From: Andrea Bianco Date: Fri, 9 Oct 2020 08:44:49 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.4 X-Git-Url: http://repos.xcallymotion.com/base//%22https:/www.w3.org/TR/wai-aria-practices?a=commitdiff_plain;h=b10cdb90859a6c8b20d9444d502230806a1deab1;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 147a01a..a949667 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2020-10-09T06:31:52.379Z", + "time": "2020-10-09T08:34:37.298Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 7e0ea28..6b2983e 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2020-10-09T06:31:52.379Z", + "time": "2020-10-09T08:34:37.298Z", "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 48f5acc..729df11 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 _0x8310=['getDataValue','action','STRING','contactManager','integration','motionbar','urlForward','browser','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','sequelize','exports'];(function(_0x30bb24,_0x49944d){var _0x330c04=function(_0x397581){while(--_0x397581){_0x30bb24['push'](_0x30bb24['shift']());}};_0x330c04(++_0x49944d);}(_0x8310,0x7e));var _0x0831=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0x8310[_0x24fa1a];return _0xc5621f;};'use strict';var Sequelize=require(_0x0831('0x0'));module[_0x0831('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x357047){return this[_0x0831('0x2')](_0x0831('0x3'));}},'action':{'type':Sequelize[_0x0831('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0831('0x5'),_0x0831('0x6'),_0x0831('0x7'),'jscripty',_0x0831('0x8'),_0x0831('0x9'),'bot',_0x0831('0xa')]],'msg':_0x0831('0xb')}},'comment':_0x0831('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x0831('0xc')},'data2':{'type':Sequelize[_0x0831('0x4')](0x1000),'comment':_0x0831('0xd')},'data3':{'type':Sequelize[_0x0831('0x4')](0x1000),'comment':_0x0831('0xe')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x0831('0x4')](0x1000)},'data6':{'type':Sequelize[_0x0831('0x4')]},'data7':{'type':Sequelize[_0x0831('0xf')]}}; \ No newline at end of file +var _0x5fa7=['contactManager','integration','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','action'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0x5fa7,0x113));var _0x75fa=function(_0x64e2ec,_0x14692d){_0x64e2ec=_0x64e2ec-0x0;var _0x28f791=_0x5fa7[_0x64e2ec];return _0x28f791;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xffe8f3){return this['getDataValue'](_0x75fa('0x0'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x75fa('0x1'),_0x75fa('0x2'),'motionbar','jscripty',_0x75fa('0x3'),_0x75fa('0x4'),_0x75fa('0x5'),_0x75fa('0x6')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x75fa('0x7')},'data1':{'type':Sequelize['STRING'](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[_0x75fa('0x8')](0x1000),'comment':_0x75fa('0x9')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x75fa('0xa')},'data4':{'type':Sequelize[_0x75fa('0x8')](0x1000)},'data5':{'type':Sequelize[_0x75fa('0x8')](0x1000)},'data6':{'type':Sequelize[_0x75fa('0x8')]},'data7':{'type':Sequelize[_0x75fa('0xb')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 6ff3ce6..9810d4a 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 _0x364b=['../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','then','stack','name','body','Action','find','params','catch','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2150c0,_0x4f0995){var _0xefa5e2=function(_0x3d33ec){while(--_0x3d33ec){_0x2150c0['push'](_0x2150c0['shift']());}};_0xefa5e2(++_0x4f0995);}(_0x364b,0x1d8));var _0xb364=function(_0x4316a2,_0x15ca2a){_0x4316a2=_0x4316a2-0x0;var _0x38d20d=_0x364b[_0x4316a2];return _0x38d20d;};'use strict';var pdf=require(_0xb364('0x0'));var emlformat=require(_0xb364('0x1'));var rimraf=require(_0xb364('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb364('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb364('0x4'));var Mustache=require(_0xb364('0x5'));var util=require('util');var path=require(_0xb364('0x6'));var sox=require(_0xb364('0x7'));var csv=require(_0xb364('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb364('0x9'));var squel=require(_0xb364('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb364('0xb'));var toCsv=require(_0xb364('0x8'));var querystring=require(_0xb364('0xc'));var Papa=require(_0xb364('0xd'));var Redis=require(_0xb364('0xe'));var authService=require(_0xb364('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb364('0x10'));var logger=require(_0xb364('0x11'))(_0xb364('0x12'));var utils=require(_0xb364('0x13'));var config=require('../../config/environment');var db=require(_0xb364('0x14'))['db'];function respondWithStatusCode(_0x2c52c8,_0x1717a9){_0x1717a9=_0x1717a9||0xcc;return function(_0x5949d){if(_0x5949d){return _0x2c52c8[_0xb364('0x15')](_0x1717a9);}return _0x2c52c8['status'](_0x1717a9)[_0xb364('0x16')]();};}function respondWithResult(_0x29cd31,_0x2b7796){_0x2b7796=_0x2b7796||0xc8;return function(_0x84e03c){if(_0x84e03c){return _0x29cd31[_0xb364('0x17')](_0x2b7796)[_0xb364('0x18')](_0x84e03c);}};}function respondWithFilteredResult(_0x319cd3,_0x3609ae){return function(_0x258972){if(_0x258972){var _0xc010ce=_0x258972['count'],_0x27043c=_0x3609ae['offset'],_0xfd5516=_0x3609ae[_0xb364('0x19')]+_0x3609ae[_0xb364('0x1a')],_0x886a03;if(_0xfd5516>=_0xc010ce){_0xfd5516=_0xc010ce;_0x886a03=0xc8;}else{_0x886a03=0xce;}_0x319cd3[_0xb364('0x17')](_0x886a03);return _0x319cd3[_0xb364('0x1b')](_0xb364('0x1c'),_0x27043c+'-'+_0xfd5516+'/'+_0xc010ce)['json'](_0x258972);}return null;};}function patchUpdates(_0x11c693){return function(_0x371010){try{jsonpatch[_0xb364('0x1d')](_0x371010,_0x11c693,!![]);}catch(_0x43910e){return BPromise['reject'](_0x43910e);}return _0x371010[_0xb364('0x1e')]();};}function saveUpdates(_0x43bce2,_0x5e9c12){return function(_0x48b172){if(_0x48b172){return _0x48b172[_0xb364('0x1f')](_0x43bce2)['then'](function(_0x47e4c0){return _0x47e4c0;});}return null;};}function removeEntity(_0x5890ec,_0x3500f5){return function(_0x426691){if(_0x426691){return _0x426691[_0xb364('0x20')]()[_0xb364('0x21')](function(){_0x5890ec[_0xb364('0x17')](0xcc)[_0xb364('0x16')]();});}};}function handleEntityNotFound(_0x3b6b2a,_0x4f9f37){return function(_0x114bfe){if(!_0x114bfe){_0x3b6b2a[_0xb364('0x15')](0x194);}return _0x114bfe;};}function handleError(_0x330443,_0x4740ab){_0x4740ab=_0x4740ab||0x1f4;return function(_0x2b2422){logger['error'](_0x2b2422[_0xb364('0x22')]);if(_0x2b2422['name']){delete _0x2b2422[_0xb364('0x23')];}_0x330443['status'](_0x4740ab)['send'](_0x2b2422);};}exports[_0xb364('0x1f')]=function(_0x5618ca,_0x9d3ff){if(_0x5618ca['body']['id']){delete _0x5618ca[_0xb364('0x24')]['id'];}return db[_0xb364('0x25')][_0xb364('0x26')]({'where':{'id':_0x5618ca[_0xb364('0x27')]['id']}})[_0xb364('0x21')](handleEntityNotFound(_0x9d3ff,null))['then'](saveUpdates(_0x5618ca[_0xb364('0x24')],null))['then'](respondWithResult(_0x9d3ff,null))[_0xb364('0x28')](handleError(_0x9d3ff,null));};exports[_0xb364('0x20')]=function(_0xd0fa52,_0x233d6f){return db['Action']['find']({'where':{'id':_0xd0fa52['params']['id']}})['then'](handleEntityNotFound(_0x233d6f,null))['then'](removeEntity(_0x233d6f,null))['catch'](handleError(_0x233d6f,null));}; \ No newline at end of file +var _0x7ce2=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','body','Action','find','catch','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x38de65,_0x2d93b7){var _0x45d693=function(_0x2c2ced){while(--_0x2c2ced){_0x38de65['push'](_0x38de65['shift']());}};_0x45d693(++_0x2d93b7);}(_0x7ce2,0x1e7));var _0x27ce=function(_0x1860ab,_0x356cb4){_0x1860ab=_0x1860ab-0x0;var _0x521635=_0x7ce2[_0x1860ab];return _0x521635;};'use strict';var pdf=require(_0x27ce('0x0'));var emlformat=require(_0x27ce('0x1'));var rimraf=require(_0x27ce('0x2'));var zipdir=require(_0x27ce('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x27ce('0x4'));var moment=require(_0x27ce('0x5'));var BPromise=require(_0x27ce('0x6'));var Mustache=require(_0x27ce('0x7'));var util=require(_0x27ce('0x8'));var path=require(_0x27ce('0x9'));var sox=require(_0x27ce('0xa'));var csv=require(_0x27ce('0xb'));var ejs=require(_0x27ce('0xc'));var fs=require('fs');var _=require(_0x27ce('0xd'));var squel=require(_0x27ce('0xe'));var crypto=require(_0x27ce('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x27ce('0x10'));var toCsv=require(_0x27ce('0xb'));var querystring=require(_0x27ce('0x11'));var Papa=require(_0x27ce('0x12'));var Redis=require(_0x27ce('0x13'));var authService=require(_0x27ce('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x27ce('0x15'));var hardwareService=require(_0x27ce('0x16'));var logger=require(_0x27ce('0x17'))(_0x27ce('0x18'));var utils=require(_0x27ce('0x19'));var config=require(_0x27ce('0x1a'));var db=require(_0x27ce('0x1b'))['db'];function respondWithStatusCode(_0x5f14ea,_0x3a54be){_0x3a54be=_0x3a54be||0xcc;return function(_0x392a72){if(_0x392a72){return _0x5f14ea['sendStatus'](_0x3a54be);}return _0x5f14ea['status'](_0x3a54be)[_0x27ce('0x1c')]();};}function respondWithResult(_0xcc510f,_0x3d4064){_0x3d4064=_0x3d4064||0xc8;return function(_0x296e96){if(_0x296e96){return _0xcc510f['status'](_0x3d4064)[_0x27ce('0x1d')](_0x296e96);}};}function respondWithFilteredResult(_0x33c0e7,_0x4f6d21){return function(_0x291d2a){if(_0x291d2a){var _0x4ca4e1=_0x291d2a[_0x27ce('0x1e')],_0x34984=_0x4f6d21[_0x27ce('0x1f')],_0x37f2f2=_0x4f6d21['offset']+_0x4f6d21[_0x27ce('0x20')],_0x201321;if(_0x37f2f2>=_0x4ca4e1){_0x37f2f2=_0x4ca4e1;_0x201321=0xc8;}else{_0x201321=0xce;}_0x33c0e7[_0x27ce('0x21')](_0x201321);return _0x33c0e7[_0x27ce('0x22')](_0x27ce('0x23'),_0x34984+'-'+_0x37f2f2+'/'+_0x4ca4e1)[_0x27ce('0x1d')](_0x291d2a);}return null;};}function patchUpdates(_0x275372){return function(_0x1cedd3){try{jsonpatch['apply'](_0x1cedd3,_0x275372,!![]);}catch(_0x355ac3){return BPromise[_0x27ce('0x24')](_0x355ac3);}return _0x1cedd3[_0x27ce('0x25')]();};}function saveUpdates(_0x3ee7a8,_0x5150a5){return function(_0x5a2469){if(_0x5a2469){return _0x5a2469[_0x27ce('0x26')](_0x3ee7a8)[_0x27ce('0x27')](function(_0x484fdf){return _0x484fdf;});}return null;};}function removeEntity(_0x49d574,_0x374538){return function(_0x4033a5){if(_0x4033a5){return _0x4033a5[_0x27ce('0x28')]()[_0x27ce('0x27')](function(){_0x49d574[_0x27ce('0x21')](0xcc)[_0x27ce('0x1c')]();});}};}function handleEntityNotFound(_0x5dcbdd,_0x9cfe4c){return function(_0x18d691){if(!_0x18d691){_0x5dcbdd[_0x27ce('0x29')](0x194);}return _0x18d691;};}function handleError(_0x2d1ba3,_0x293e07){_0x293e07=_0x293e07||0x1f4;return function(_0x273344){logger[_0x27ce('0x2a')](_0x273344[_0x27ce('0x2b')]);if(_0x273344[_0x27ce('0x2c')]){delete _0x273344[_0x27ce('0x2c')];}_0x2d1ba3['status'](_0x293e07)[_0x27ce('0x2d')](_0x273344);};}exports[_0x27ce('0x26')]=function(_0x1065ff,_0x4ec12b){if(_0x1065ff[_0x27ce('0x2e')]['id']){delete _0x1065ff['body']['id'];}return db[_0x27ce('0x2f')][_0x27ce('0x30')]({'where':{'id':_0x1065ff['params']['id']}})[_0x27ce('0x27')](handleEntityNotFound(_0x4ec12b,null))[_0x27ce('0x27')](saveUpdates(_0x1065ff[_0x27ce('0x2e')],null))[_0x27ce('0x27')](respondWithResult(_0x4ec12b,null))[_0x27ce('0x31')](handleError(_0x4ec12b,null));};exports[_0x27ce('0x28')]=function(_0x369109,_0x4a8f45){return db[_0x27ce('0x2f')][_0x27ce('0x30')]({'where':{'id':_0x369109[_0x27ce('0x32')]['id']}})[_0x27ce('0x27')](handleEntityNotFound(_0x4a8f45,null))['then'](removeEntity(_0x4a8f45,null))[_0x27ce('0x31')](handleError(_0x4a8f45,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 6183a88..2be0ffa 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 _0x169b=['Action','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x169b,0x11f));var _0xb169=function(_0x5ad88b,_0x3aa113){_0x5ad88b=_0x5ad88b-0x0;var _0x12bf00=_0x169b[_0x5ad88b];return _0x12bf00;};'use strict';var _=require(_0xb169('0x0'));var util=require(_0xb169('0x1'));var logger=require(_0xb169('0x2'))(_0xb169('0x3'));var moment=require('moment');var BPromise=require(_0xb169('0x4'));var rp=require(_0xb169('0x5'));var fs=require('fs');var path=require(_0xb169('0x6'));var rimraf=require(_0xb169('0x7'));var config=require(_0xb169('0x8'));var attributes=require('./action.attributes');module['exports']=function(_0x3ea12c,_0x34cbc3){return _0x3ea12c[_0xb169('0x9')](_0xb169('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8079=['util','moment','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash'];(function(_0x467367,_0x18087e){var _0x5b35d5=function(_0xa8a6d5){while(--_0xa8a6d5){_0x467367['push'](_0x467367['shift']());}};_0x5b35d5(++_0x18087e);}(_0x8079,0x143));var _0x9807=function(_0x12c280,_0x51dd07){_0x12c280=_0x12c280-0x0;var _0x3638d3=_0x8079[_0x12c280];return _0x3638d3;};'use strict';var _=require(_0x9807('0x0'));var util=require(_0x9807('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9807('0x2'));var BPromise=require('bluebird');var rp=require(_0x9807('0x3'));var fs=require('fs');var path=require(_0x9807('0x4'));var rimraf=require(_0x9807('0x5'));var config=require(_0x9807('0x6'));var attributes=require(_0x9807('0x7'));module[_0x9807('0x8')]=function(_0x19e375,_0x51f254){return _0x19e375[_0x9807('0x9')](_0x9807('0xa'),attributes,{'tableName':_0x9807('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 5321f58..75d4b8f 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 _0xe706=['http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\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(_0x2b2ad2,_0x3e33ac){var _0x2f0963=function(_0x3d8ddf){while(--_0x3d8ddf){_0x2b2ad2['push'](_0x2b2ad2['shift']());}};_0x2f0963(++_0x3e33ac);}(_0xe706,0xa3));var _0x6e70=function(_0x2bd264,_0x53a5d4){_0x2bd264=_0x2bd264-0x0;var _0x3cd2e3=_0xe706[_0x2bd264];return _0x3cd2e3;};'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']('Action,\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']('Action,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xbaf0=['client','http','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2c5340,_0x5c86e5){var _0x3c505e=function(_0x1089d9){while(--_0x1089d9){_0x2c5340['push'](_0x2c5340['shift']());}};_0x3c505e(++_0x5c86e5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Action,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 0c48285..2d6c7c6 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 _0x52dc=['connect-timeout','express','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','destroy','multer','util'];(function(_0x1f2f79,_0x5761c4){var _0x34b29b=function(_0x46bdb4){while(--_0x46bdb4){_0x1f2f79['push'](_0x1f2f79['shift']());}};_0x34b29b(++_0x5761c4);}(_0x52dc,0x166));var _0xc52d=function(_0xa5182e,_0x2c45f8){_0xa5182e=_0xa5182e-0x0;var _0x5ccc25=_0x52dc[_0xa5182e];return _0x5ccc25;};'use strict';var multer=require(_0xc52d('0x0'));var util=require(_0xc52d('0x1'));var path=require('path');var timeout=require(_0xc52d('0x2'));var express=require(_0xc52d('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc52d('0x4'));var config=require(_0xc52d('0x5'));var controller=require(_0xc52d('0x6'));router[_0xc52d('0x7')](_0xc52d('0x8'),auth[_0xc52d('0x9')](),controller[_0xc52d('0xa')]);router['delete'](_0xc52d('0x8'),auth[_0xc52d('0x9')](),controller[_0xc52d('0xb')]);module['exports']=router; \ No newline at end of file +var _0x4a38=['../../config/environment','./action.controller','put','/:id','isAuthenticated','update','destroy','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1ad37d,_0x1c7056){var _0x4f6549=function(_0x22d1f0){while(--_0x22d1f0){_0x1ad37d['push'](_0x1ad37d['shift']());}};_0x4f6549(++_0x1c7056);}(_0x4a38,0x70));var _0x84a3=function(_0x3a6564,_0x1c91aa){_0x3a6564=_0x3a6564-0x0;var _0x587b23=_0x4a38[_0x3a6564];return _0x587b23;};'use strict';var multer=require(_0x84a3('0x0'));var util=require(_0x84a3('0x1'));var path=require(_0x84a3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x84a3('0x3')]();var auth=require(_0x84a3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x84a3('0x5'));var controller=require(_0x84a3('0x6'));router[_0x84a3('0x7')](_0x84a3('0x8'),auth[_0x84a3('0x9')](),controller[_0x84a3('0xa')]);router['delete'](_0x84a3('0x8'),auth['isAuthenticated'](),controller[_0x84a3('0xb')]);module[_0x84a3('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 0ef98f9..cec26b9 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 _0x4d5e=['TEXT','sequelize','exports','STRING'];(function(_0x49c4ce,_0x35350b){var _0x229812=function(_0xaef6eb){while(--_0xaef6eb){_0x49c4ce['push'](_0x49c4ce['shift']());}};_0x229812(++_0x35350b);}(_0x4d5e,0x1d1));var _0xe4d5=function(_0x44175d,_0x435741){_0x44175d=_0x44175d-0x0;var _0x3a8b21=_0x4d5e[_0x44175d];return _0x3a8b21;};'use strict';var Sequelize=require(_0xe4d5('0x0'));module[_0xe4d5('0x1')]={'name':{'type':Sequelize[_0xe4d5('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xe4d5('0x2')]},'table':{'type':Sequelize[_0xe4d5('0x2')]},'conditions':{'type':Sequelize[_0xe4d5('0x3')]},'joins':{'type':Sequelize[_0xe4d5('0x3')]}}; \ No newline at end of file +var _0x244c=['sequelize','exports','STRING','TEXT'];(function(_0x1276b3,_0x10f105){var _0x57ace1=function(_0x2e279c){while(--_0x2e279c){_0x1276b3['push'](_0x1276b3['shift']());}};_0x57ace1(++_0x10f105);}(_0x244c,0x17c));var _0xc244=function(_0x5e66e2,_0x2705d4){_0x5e66e2=_0x5e66e2-0x0;var _0x6271ad=_0x244c[_0x5e66e2];return _0x6271ad;};'use strict';var Sequelize=require(_0xc244('0x0'));module[_0xc244('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xc244('0x2')]},'parent':{'type':Sequelize[_0xc244('0x2')]},'table':{'type':Sequelize[_0xc244('0x2')]},'conditions':{'type':Sequelize[_0xc244('0x3')]},'joins':{'type':Sequelize[_0xc244('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index fc6c485..cd1f7ac 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 _0x8b2b=['include','rows','catch','show','keys','length','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Sequelize','AnalyticMetric','findAll','keyBy','select','from','metric','function','replace','groupBy','orderBy','DESC','joins','parentKey','foreignKey','foreignTable','format','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','condition','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','MetricId','%s.%s\x20=\x20%s.%s','parse','No\x20available\x20data','web','fullPath','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','run','SEC_TO_TIME(%s)','alias','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','includeAll'];(function(_0x51f61d,_0x35b031){var _0x22db25=function(_0x4332c2){while(--_0x4332c2){_0x51f61d['push'](_0x51f61d['shift']());}};_0x22db25(++_0x35b031);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0xd20213,_0x31f047){_0xd20213=_0xd20213-0x0;var _0x4a8f5d=_0x8b2b[_0xd20213];return _0x4a8f5d;};'use strict';var pdf=require(_0xb8b2('0x0'));var emlformat=require(_0xb8b2('0x1'));var rimraf=require(_0xb8b2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb8b2('0x3'));var rp=require(_0xb8b2('0x4'));var moment=require(_0xb8b2('0x5'));var BPromise=require(_0xb8b2('0x6'));var Mustache=require(_0xb8b2('0x7'));var util=require(_0xb8b2('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xb8b2('0x9'));var ejs=require(_0xb8b2('0xa'));var fs=require('fs');var _=require(_0xb8b2('0xb'));var squel=require(_0xb8b2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb8b2('0xd'));var toCsv=require(_0xb8b2('0x9'));var querystring=require(_0xb8b2('0xe'));var Papa=require(_0xb8b2('0xf'));var Redis=require(_0xb8b2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb8b2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8b2('0x12'))(_0xb8b2('0x13'));var utils=require(_0xb8b2('0x14'));var config=require(_0xb8b2('0x15'));var db=require(_0xb8b2('0x16'))['db'];var dbH=require(_0xb8b2('0x16'))['dbH'];function respondWithStatusCode(_0x3440bf,_0x5bd724){_0x5bd724=_0x5bd724||0xcc;return function(_0x5d6dc1){if(_0x5d6dc1){return _0x3440bf['sendStatus'](_0x5bd724);}return _0x3440bf[_0xb8b2('0x17')](_0x5bd724)[_0xb8b2('0x18')]();};}function respondWithResult(_0x48b9df,_0x175885){_0x175885=_0x175885||0xc8;return function(_0x35ce5f){if(_0x35ce5f){return _0x48b9df[_0xb8b2('0x17')](_0x175885)[_0xb8b2('0x19')](_0x35ce5f);}};}function respondWithFilteredResult(_0x46a592,_0x5b614d){return function(_0x4b5a28){if(_0x4b5a28){var _0xda50ef=_0x4b5a28[_0xb8b2('0x1a')],_0x7eff5=_0x5b614d['offset'],_0x3fab0a=_0x5b614d['offset']+_0x5b614d[_0xb8b2('0x1b')],_0xafc1b6;if(_0x3fab0a>=_0xda50ef){_0x3fab0a=_0xda50ef;_0xafc1b6=0xc8;}else{_0xafc1b6=0xce;}_0x46a592[_0xb8b2('0x17')](_0xafc1b6);return _0x46a592[_0xb8b2('0x1c')](_0xb8b2('0x1d'),_0x7eff5+'-'+_0x3fab0a+'/'+_0xda50ef)['json'](_0x4b5a28);}return null;};}function patchUpdates(_0x23af66){return function(_0x913200){try{jsonpatch[_0xb8b2('0x1e')](_0x913200,_0x23af66,!![]);}catch(_0x30c67f){return BPromise[_0xb8b2('0x1f')](_0x30c67f);}return _0x913200[_0xb8b2('0x20')]();};}function saveUpdates(_0x34ca46,_0x4c1a22){return function(_0x382bbf){if(_0x382bbf){return _0x382bbf[_0xb8b2('0x21')](_0x34ca46)[_0xb8b2('0x22')](function(_0x162d41){return _0x162d41;});}return null;};}function removeEntity(_0x316d3c,_0x5a0a43){return function(_0xe3b3c){if(_0xe3b3c){return _0xe3b3c['destroy']()[_0xb8b2('0x22')](function(){var _0x8239a7=_0xe3b3c[_0xb8b2('0x23')]({'plain':!![]});var _0x20082f='CustomReports';return db[_0xb8b2('0x24')][_0xb8b2('0x25')]({'where':{'type':_0x20082f,'resourceId':_0x8239a7['id']}})[_0xb8b2('0x22')](function(){return _0xe3b3c;});})['then'](function(){_0x316d3c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x585d5b,_0x36ae2d){return function(_0x10d8f3){if(!_0x10d8f3){_0x585d5b[_0xb8b2('0x26')](0x194);}return _0x10d8f3;};}function handleError(_0x3b611b,_0x14ba5c){_0x14ba5c=_0x14ba5c||0x1f4;return function(_0x2026db){logger[_0xb8b2('0x27')](_0x2026db[_0xb8b2('0x28')]);if(_0x2026db[_0xb8b2('0x29')]){delete _0x2026db[_0xb8b2('0x29')];}_0x3b611b[_0xb8b2('0x17')](_0x14ba5c)[_0xb8b2('0x2a')](_0x2026db);};}exports[_0xb8b2('0x2b')]=function(_0xeb28c8,_0x396fb3){var _0x234a63={},_0x3f9dc8={},_0x51bbca={'count':0x0,'rows':[]};var _0x37ea31=_[_0xb8b2('0x2c')](db[_0xb8b2('0x2d')][_0xb8b2('0x2e')],function(_0x21b008){return{'name':_0x21b008['fieldName'],'type':_0x21b008[_0xb8b2('0x2f')][_0xb8b2('0x30')]};});_0x3f9dc8[_0xb8b2('0x31')]=_['map'](_0x37ea31,_0xb8b2('0x29'));_0x3f9dc8[_0xb8b2('0x32')]=_['keys'](_0xeb28c8[_0xb8b2('0x32')]);_0x3f9dc8[_0xb8b2('0x33')]=_[_0xb8b2('0x34')](_0x3f9dc8[_0xb8b2('0x31')],_0x3f9dc8[_0xb8b2('0x32')]);_0x234a63[_0xb8b2('0x35')]=_[_0xb8b2('0x34')](_0x3f9dc8[_0xb8b2('0x31')],qs[_0xb8b2('0x36')](_0xeb28c8[_0xb8b2('0x32')]['fields']));_0x234a63[_0xb8b2('0x35')]=_0x234a63[_0xb8b2('0x35')]['length']?_0x234a63[_0xb8b2('0x35')]:_0x3f9dc8[_0xb8b2('0x31')];if(!_0xeb28c8[_0xb8b2('0x32')][_0xb8b2('0x37')](_0xb8b2('0x38'))){_0x234a63[_0xb8b2('0x1b')]=qs[_0xb8b2('0x1b')](_0xeb28c8[_0xb8b2('0x32')][_0xb8b2('0x1b')]);_0x234a63[_0xb8b2('0x39')]=qs[_0xb8b2('0x39')](_0xeb28c8[_0xb8b2('0x32')][_0xb8b2('0x39')]);}_0x234a63[_0xb8b2('0x3a')]=qs[_0xb8b2('0x3b')](_0xeb28c8[_0xb8b2('0x32')][_0xb8b2('0x3b')]);_0x234a63[_0xb8b2('0x3c')]=qs[_0xb8b2('0x33')](_[_0xb8b2('0x3d')](_0xeb28c8[_0xb8b2('0x32')],_0x3f9dc8[_0xb8b2('0x33')]),_0x37ea31);if(_0xeb28c8[_0xb8b2('0x32')][_0xb8b2('0x3e')]){_0x234a63[_0xb8b2('0x3c')]=_[_0xb8b2('0x3f')](_0x234a63[_0xb8b2('0x3c')],{'$or':_['map'](_0x37ea31,function(_0x482d64){if(_0x482d64[_0xb8b2('0x2f')]!=='VIRTUAL'){var _0x34fc62={};_0x34fc62[_0x482d64[_0xb8b2('0x29')]]={'$like':'%'+_0xeb28c8[_0xb8b2('0x32')][_0xb8b2('0x3e')]+'%'};return _0x34fc62;}})});}_0x234a63=_['merge']({},_0x234a63,_0xeb28c8['options']);var _0xc30a91={'where':_0x234a63[_0xb8b2('0x3c')]};return db[_0xb8b2('0x2d')][_0xb8b2('0x1a')](_0xc30a91)[_0xb8b2('0x22')](function(_0x4fa963){_0x51bbca[_0xb8b2('0x1a')]=_0x4fa963;if(_0xeb28c8[_0xb8b2('0x32')][_0xb8b2('0x40')]){_0x234a63[_0xb8b2('0x41')]=[{'all':!![]}];}return db[_0xb8b2('0x2d')]['findAll'](_0x234a63);})[_0xb8b2('0x22')](function(_0xf6f946){_0x51bbca[_0xb8b2('0x42')]=_0xf6f946;return _0x51bbca;})[_0xb8b2('0x22')](respondWithFilteredResult(_0x396fb3,_0x234a63))[_0xb8b2('0x43')](handleError(_0x396fb3,null));};exports[_0xb8b2('0x44')]=function(_0x37370a,_0x339c2e){var _0x2141d3={'raw':![],'where':{'id':_0x37370a['params']['id']}},_0x1dfe2b={};_0x1dfe2b['model']=_[_0xb8b2('0x45')](db['AnalyticCustomReport'][_0xb8b2('0x2e')]);_0x1dfe2b[_0xb8b2('0x32')]=_[_0xb8b2('0x45')](_0x37370a[_0xb8b2('0x32')]);_0x1dfe2b[_0xb8b2('0x33')]=_['intersection'](_0x1dfe2b[_0xb8b2('0x31')],_0x1dfe2b[_0xb8b2('0x32')]);_0x2141d3[_0xb8b2('0x35')]=_[_0xb8b2('0x34')](_0x1dfe2b[_0xb8b2('0x31')],qs[_0xb8b2('0x36')](_0x37370a[_0xb8b2('0x32')][_0xb8b2('0x36')]));_0x2141d3[_0xb8b2('0x35')]=_0x2141d3[_0xb8b2('0x35')][_0xb8b2('0x46')]?_0x2141d3['attributes']:_0x1dfe2b[_0xb8b2('0x31')];if(_0x37370a[_0xb8b2('0x32')][_0xb8b2('0x40')]){_0x2141d3[_0xb8b2('0x41')]=[{'all':!![]}];}_0x2141d3=_[_0xb8b2('0x3f')]({},_0x2141d3,_0x37370a[_0xb8b2('0x47')]);return db[_0xb8b2('0x2d')][_0xb8b2('0x48')](_0x2141d3)[_0xb8b2('0x22')](handleEntityNotFound(_0x339c2e,null))[_0xb8b2('0x22')](respondWithResult(_0x339c2e,null))[_0xb8b2('0x43')](handleError(_0x339c2e,null));};exports[_0xb8b2('0x49')]=function(_0x21bcf8,_0x50bc93){return db[_0xb8b2('0x2d')][_0xb8b2('0x49')](_0x21bcf8['body'],{})[_0xb8b2('0x22')](function(_0x2b9c9a){var _0x3d94d1=_0x21bcf8['user'][_0xb8b2('0x23')]({'plain':!![]});if(!_0x3d94d1)throw new Error(_0xb8b2('0x4a'));if(_0x3d94d1[_0xb8b2('0x4b')]===_0xb8b2('0x4c')){var _0x2a98e3=_0x2b9c9a[_0xb8b2('0x23')]({'plain':!![]});var _0x45e952=_0xb8b2('0x4d');return db[_0xb8b2('0x4e')][_0xb8b2('0x48')]({'where':{'name':_0x45e952,'userProfileId':_0x3d94d1[_0xb8b2('0x4f')]},'raw':!![]})[_0xb8b2('0x22')](function(_0xc28eb9){if(_0xc28eb9&&_0xc28eb9[_0xb8b2('0x50')]===0x0){return db[_0xb8b2('0x24')]['create']({'name':_0x2a98e3['name'],'resourceId':_0x2a98e3['id'],'type':_0xb8b2('0x51'),'sectionId':_0xc28eb9['id']},{})[_0xb8b2('0x22')](function(){return _0x2b9c9a;});}else{return _0x2b9c9a;}})[_0xb8b2('0x43')](function(_0x765436){logger[_0xb8b2('0x27')](_0xb8b2('0x52'),_0x765436);throw _0x765436;});}return _0x2b9c9a;})['then'](respondWithResult(_0x50bc93,0xc9))[_0xb8b2('0x43')](handleError(_0x50bc93,null));};exports[_0xb8b2('0x21')]=function(_0x3a2b47,_0x34b01a){if(_0x3a2b47[_0xb8b2('0x53')]['id']){delete _0x3a2b47[_0xb8b2('0x53')]['id'];}return db[_0xb8b2('0x2d')][_0xb8b2('0x48')]({'where':{'id':_0x3a2b47['params']['id']}})[_0xb8b2('0x22')](handleEntityNotFound(_0x34b01a,null))['then'](saveUpdates(_0x3a2b47[_0xb8b2('0x53')],null))[_0xb8b2('0x22')](respondWithResult(_0x34b01a,null))[_0xb8b2('0x43')](handleError(_0x34b01a,null));};exports[_0xb8b2('0x25')]=function(_0x151d48,_0x3fc0a1){return db[_0xb8b2('0x2d')]['find']({'where':{'id':_0x151d48[_0xb8b2('0x54')]['id']}})[_0xb8b2('0x22')](handleEntityNotFound(_0x3fc0a1,null))[_0xb8b2('0x22')](removeEntity(_0x3fc0a1,null))[_0xb8b2('0x43')](handleError(_0x3fc0a1,null));};exports[_0xb8b2('0x55')]=function(_0x5dd642,_0x40399d){var _0x547550=0xa;var _0x52598e=[_0xb8b2('0x56'),_0xb8b2('0x57'),_0xb8b2('0x58'),_0xb8b2('0x59')];var _0x2ca318={'SUM':_0xb8b2('0x5a'),'COUNT':_0xb8b2('0x5b'),'COUNT DISTINCT':_0xb8b2('0x5c'),'MAX':_0xb8b2('0x5d'),'MIN':_0xb8b2('0x5e'),'AVG':_0xb8b2('0x5f'),'GROUP_CONCAT':_0xb8b2('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb8b2('0x61')};var _0x23cd35={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb8b2('0x62'),'HOUR':_0xb8b2('0x63'),'ROUND':_0xb8b2('0x64'),'UNIX_TIMESTAMP':_0xb8b2('0x65')};var _0xb29e36=function(_0x5361f8){return!_[_0xb8b2('0x66')](['IS\x20NULL',_0xb8b2('0x67'),_0xb8b2('0x68'),_0xb8b2('0x69')],_0x5361f8);};var _0x5e56b1=function(_0x34c3c9){if(!_0x34c3c9||!_0x34c3c9[_0xb8b2('0x6a')][_0xb8b2('0x46')]){return'';}for(var _0x41d670='(',_0x2f9946=0x0;_0x2f9946<_0x34c3c9['rules']['length'];_0x2f9946+=0x1){_0x2f9946>0x0&&(_0x41d670+='\x20'+_0x34c3c9[_0xb8b2('0x6b')]+'\x20');_0x41d670+=_0x34c3c9[_0xb8b2('0x6a')][_0x2f9946][_0xb8b2('0x6c')]?_0x5e56b1(_0x34c3c9[_0xb8b2('0x6a')][_0x2f9946][_0xb8b2('0x6c')]):_0x34c3c9[_0xb8b2('0x6a')][_0x2f9946][_0xb8b2('0x6d')]+'\x20'+_0x34c3c9[_0xb8b2('0x6a')][_0x2f9946]['condition']+(_0xb29e36(_0x34c3c9[_0xb8b2('0x6a')][_0x2f9946]['condition'])?'\x20'+_0x34c3c9['rules'][_0x2f9946][_0xb8b2('0x6e')]:'');}return _0x41d670+')';};var _0x3be87d={'where':{'id':_0x5dd642[_0xb8b2('0x54')]['id']}},_0x1aa19d,_0x212e2a,_0x419710,_0x8ac34e,_0x1ffea7;_0x3be87d=_['merge']({},_0x3be87d,_0x5dd642[_0xb8b2('0x47')]);return db[_0xb8b2('0x2d')]['find'](_0x3be87d)[_0xb8b2('0x22')](function(_0x47f85d){if(_0x47f85d){_0x1aa19d=_0x47f85d;return _0x47f85d[_0xb8b2('0x6f')]();}return null;})[_0xb8b2('0x22')](function(_0x150d69){if(_0x150d69){if(!_0x150d69[_0xb8b2('0x46')]){throw new db[(_0xb8b2('0x70'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x212e2a=_0x150d69;return db[_0xb8b2('0x71')][_0xb8b2('0x72')]({'raw':!![]});}return null;})['then'](function(_0x1601aa){if(_0x1601aa){_0x419710=_[_0xb8b2('0x73')](_0x1601aa,'id');var _0x45cb0c;var _0x4932e0=squel[_0xb8b2('0x74')]();_0x4932e0[_0xb8b2('0x75')](_0x1aa19d['table']);for(var _0x417d6f=0x0;_0x417d6f<_0x212e2a[_0xb8b2('0x46')];_0x417d6f+=0x1){_0x45cb0c=_0x212e2a[_0x417d6f]['MetricId']?_0x419710[_0x212e2a[_0x417d6f]['MetricId']][_0xb8b2('0x76')]:_0x212e2a[_0x417d6f][_0xb8b2('0x6d')];_0x45cb0c=_0x212e2a[_0x417d6f][_0xb8b2('0x77')]?_['replace'](_0x2ca318[_0x212e2a[_0x417d6f]['function']],'%s',_0x45cb0c):_0x45cb0c;_0x45cb0c=_0x212e2a[_0x417d6f]['format']?_[_0xb8b2('0x78')](_0x23cd35[_0x212e2a[_0x417d6f]['format']],'%s',_0x45cb0c):_0x45cb0c;if(_0x212e2a[_0x417d6f][_0xb8b2('0x79')]){_0x4932e0[_0xb8b2('0x6c')](_0x45cb0c);}_0x212e2a[_0x417d6f][_0xb8b2('0x7a')]&&_0x4932e0[_0xb8b2('0x3a')](_0x45cb0c,_0x212e2a[_0x417d6f][_0xb8b2('0x7a')]===_0xb8b2('0x7b')?![]:!![]);_0x4932e0['field'](_0x45cb0c,_0x212e2a[_0x417d6f]['alias']||_0x45cb0c);}if(_0x1aa19d[_0xb8b2('0x7c')]){_0x1aa19d[_0xb8b2('0x7c')]=JSON['parse'](_0x1aa19d[_0xb8b2('0x7c')]);for(var _0x17f221=0x0;_0x17f221<_0x1aa19d[_0xb8b2('0x7c')][_0xb8b2('0x46')];_0x17f221+=0x1){if(_0x1aa19d[_0xb8b2('0x7c')][_0x17f221]['type']&&_[_0xb8b2('0x66')](_0x52598e,_0x1aa19d[_0xb8b2('0x7c')][_0x17f221][_0xb8b2('0x2f')])&&_0x1aa19d['joins'][_0x17f221][_0xb8b2('0x7d')]&&_0x1aa19d[_0xb8b2('0x7c')][_0x17f221]['foreignTable']&&_0x1aa19d[_0xb8b2('0x7c')][_0x17f221][_0xb8b2('0x7e')]){_0x4932e0[_0x1aa19d[_0xb8b2('0x7c')][_0x17f221][_0xb8b2('0x2f')]](_0x1aa19d['joins'][_0x17f221][_0xb8b2('0x7f')],null,util[_0xb8b2('0x80')]('%s.%s\x20=\x20%s.%s',_0x1aa19d[_0xb8b2('0x81')],_0x1aa19d['joins'][_0x17f221][_0xb8b2('0x7d')],_0x1aa19d[_0xb8b2('0x7c')][_0x17f221]['foreignTable'],_0x1aa19d['joins'][_0x17f221]['foreignKey']));}}}if(_0x1aa19d['conditions']){_0x1aa19d['conditions']=JSON['parse'](_0x1aa19d[_0xb8b2('0x82')]);_0x4932e0[_0xb8b2('0x3c')](_0x5e56b1(_0x1aa19d[_0xb8b2('0x82')][_0xb8b2('0x6c')]));}_0x1ffea7=_0x4932e0[_0xb8b2('0x83')]();_0x4932e0[_0xb8b2('0x1b')](_0x547550);_0x4932e0[_0xb8b2('0x39')](0x0);logger[_0xb8b2('0x84')](_0xb8b2('0x85'),_0x4932e0[_0xb8b2('0x86')]());return db[_0xb8b2('0x87')][_0xb8b2('0x32')](_0x4932e0['toString'](),{'type':db['sequelize'][_0xb8b2('0x88')][_0xb8b2('0x89')]});}})[_0xb8b2('0x22')](respondWithResult(_0x40399d,null))['catch'](handleError(_0x40399d,null));};function runReport(_0x592fdd,_0x3fa99f,_0x50f942){var _0x42da0d=_0x3fa99f[_0xb8b2('0x29')];var _0x13428e=0xa;var _0x421f3d=['join',_0xb8b2('0x57'),_0xb8b2('0x58'),_0xb8b2('0x59')];var _0x2dbdd5={'SUM':_0xb8b2('0x5a'),'COUNT':_0xb8b2('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb8b2('0x5d'),'MIN':_0xb8b2('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb8b2('0x60'),'GROUP_CONCAT ASC':_0xb8b2('0x8a'),'GROUP_CONCAT DESC':_0xb8b2('0x61')};var _0x503c71={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb8b2('0x62'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb8b2('0x65')};var _0x523af9=function(_0x2a4dbb){return!_[_0xb8b2('0x66')](['IS\x20NULL',_0xb8b2('0x67'),_0xb8b2('0x68'),_0xb8b2('0x69')],_0x2a4dbb);};var _0x50d740=function(_0xf285bc){if(!_0xf285bc||!_0xf285bc['rules'][_0xb8b2('0x46')]){return'';}for(var _0x3c2074='(',_0x27e84f=0x0;_0x27e84f<_0xf285bc[_0xb8b2('0x6a')][_0xb8b2('0x46')];_0x27e84f+=0x1){_0x27e84f>0x0&&(_0x3c2074+='\x20'+_0xf285bc[_0xb8b2('0x6b')]+'\x20');_0x3c2074+=_0xf285bc[_0xb8b2('0x6a')][_0x27e84f][_0xb8b2('0x6c')]?_0x50d740(_0xf285bc[_0xb8b2('0x6a')][_0x27e84f]['group']):_0xf285bc[_0xb8b2('0x6a')][_0x27e84f]['field']+'\x20'+_0xf285bc[_0xb8b2('0x6a')][_0x27e84f][_0xb8b2('0x8b')]+(_0x523af9(_0xf285bc[_0xb8b2('0x6a')][_0x27e84f][_0xb8b2('0x8b')])?'\x20'+_0xf285bc[_0xb8b2('0x6a')][_0x27e84f]['value']:'');}return _0x3c2074+')';};var _0x3d40aa={'where':{'id':_0x592fdd['id']}},_0x979c21,_0x1a424f,_0x305ab1,_0x3633c7,_0x3cacfa;_0x3d40aa=_[_0xb8b2('0x3f')]({},_0x3d40aa,_0x50f942);return db['AnalyticCustomReport'][_0xb8b2('0x48')](_0x3d40aa)['then'](function(_0x4c43f5){if(_0x4c43f5){_0x979c21=_0x4c43f5;return _0x4c43f5[_0xb8b2('0x6f')]();}return null;})['then'](function(_0x365842){if(_0x365842){if(!_0x365842['length']){throw new db[(_0xb8b2('0x70'))][(_0xb8b2('0x8c'))](_0xb8b2('0x8d'),0x193);}_0x1a424f=_0x365842;return db[_0xb8b2('0x71')][_0xb8b2('0x72')]({'raw':!![]});}return null;})[_0xb8b2('0x22')](function(_0x362bcb){if(_0x362bcb){_0x305ab1=_[_0xb8b2('0x73')](_0x362bcb,'id');var _0x20c85a;var _0x2d2864=squel[_0xb8b2('0x74')]();_0x2d2864[_0xb8b2('0x75')](_0x979c21[_0xb8b2('0x81')]);for(var _0x2e515d=0x0;_0x2e515d<_0x1a424f[_0xb8b2('0x46')];_0x2e515d+=0x1){_0x20c85a=_0x1a424f[_0x2e515d][_0xb8b2('0x8e')]?_0x305ab1[_0x1a424f[_0x2e515d][_0xb8b2('0x8e')]][_0xb8b2('0x76')]:_0x1a424f[_0x2e515d][_0xb8b2('0x6d')];_0x20c85a=_0x1a424f[_0x2e515d][_0xb8b2('0x77')]?_[_0xb8b2('0x78')](_0x2dbdd5[_0x1a424f[_0x2e515d]['function']],'%s',_0x20c85a):_0x20c85a;_0x20c85a=_0x1a424f[_0x2e515d][_0xb8b2('0x80')]?_[_0xb8b2('0x78')](_0x503c71[_0x1a424f[_0x2e515d][_0xb8b2('0x80')]],'%s',_0x20c85a):_0x20c85a;if(_0x1a424f[_0x2e515d][_0xb8b2('0x79')]){_0x2d2864[_0xb8b2('0x6c')](_0x20c85a);}_0x1a424f[_0x2e515d][_0xb8b2('0x7a')]&&_0x2d2864['order'](_0x20c85a,_0x1a424f[_0x2e515d][_0xb8b2('0x7a')]===_0xb8b2('0x7b')?![]:!![]);_0x2d2864[_0xb8b2('0x6d')](_0x20c85a,_0x1a424f[_0x2e515d]['alias']||_0x20c85a);}if(_0x979c21[_0xb8b2('0x7c')]){_0x979c21[_0xb8b2('0x7c')]=JSON['parse'](_0x979c21[_0xb8b2('0x7c')]);for(var _0x23940f=0x0;_0x23940f<_0x979c21[_0xb8b2('0x7c')]['length'];_0x23940f+=0x1){if(_0x979c21[_0xb8b2('0x7c')][_0x23940f][_0xb8b2('0x2f')]&&_[_0xb8b2('0x66')](_0x421f3d,_0x979c21[_0xb8b2('0x7c')][_0x23940f][_0xb8b2('0x2f')])&&_0x979c21['joins'][_0x23940f][_0xb8b2('0x7d')]&&_0x979c21[_0xb8b2('0x7c')][_0x23940f][_0xb8b2('0x7f')]&&_0x979c21[_0xb8b2('0x7c')][_0x23940f][_0xb8b2('0x7e')]){_0x2d2864[_0x979c21[_0xb8b2('0x7c')][_0x23940f]['type']](_0x979c21[_0xb8b2('0x7c')][_0x23940f][_0xb8b2('0x7f')],null,util['format'](_0xb8b2('0x8f'),_0x979c21[_0xb8b2('0x81')],_0x979c21[_0xb8b2('0x7c')][_0x23940f][_0xb8b2('0x7d')],_0x979c21[_0xb8b2('0x7c')][_0x23940f][_0xb8b2('0x7f')],_0x979c21[_0xb8b2('0x7c')][_0x23940f][_0xb8b2('0x7e')]));}}}if(_0x979c21[_0xb8b2('0x82')]){_0x979c21[_0xb8b2('0x82')]=JSON[_0xb8b2('0x90')](_0x979c21[_0xb8b2('0x82')]);_0x2d2864[_0xb8b2('0x3c')](_0x50d740(_0x979c21['conditions'][_0xb8b2('0x6c')]));}_0x3cacfa=_0x2d2864['clone']();_0x2d2864[_0xb8b2('0x1b')](_0x13428e);_0x2d2864[_0xb8b2('0x39')](0x0);logger[_0xb8b2('0x84')]('Limited\x20Query:',_0x2d2864['toString']());return db['sequelize'][_0xb8b2('0x32')](_0x2d2864['toString'](),{'type':db[_0xb8b2('0x87')][_0xb8b2('0x88')][_0xb8b2('0x89')]});}})[_0xb8b2('0x22')](function(_0x52f4d5){if(!_0x52f4d5['length']){throw new db['Sequelize'][(_0xb8b2('0x8c'))](_0xb8b2('0x91'),0xcc);}if(_0x3fa99f['output']===_0xb8b2('0x92')){return null;}var _0x3915e2=_[_0xb8b2('0x3f')](_0x3fa99f,{'name':_0x3fa99f[_0xb8b2('0x93')]||_0x3fa99f[_0xb8b2('0x29')]||_0x979c21[_0xb8b2('0x29')],'basename':_0x42da0d,'savename':util[_0xb8b2('0x80')](_0xb8b2('0x94'),_0x3fa99f['name']||_0x979c21['name'],require(_0xb8b2('0x95'))[_0xb8b2('0x96')](0x4),_0x3fa99f[_0xb8b2('0x97')]||_0xb8b2('0x98')),'reportId':_0x979c21['id'],'reportType':_0xb8b2('0x99')});return db[_0xb8b2('0x9a')][_0xb8b2('0x49')](_0x3915e2,{'raw':!![]});})[_0xb8b2('0x22')](function(_0x3d8949){if(_0x979c21[_0xb8b2('0x81')]===_0xb8b2('0x9b')){_0x3cacfa[_0xb8b2('0x3c')](_0x979c21['table']+_0xb8b2('0x9c'),_0x3fa99f[_0xb8b2('0x9d')],_0x3fa99f[_0xb8b2('0x9e')]);}else{_0x3cacfa['where'](_0x979c21['table']+_0xb8b2('0x9f'),_0x3fa99f[_0xb8b2('0x9d')],_0x3fa99f['endDate']);}if(_0x3d8949){logger[_0xb8b2('0xa0')](_0xb8b2('0xa1'),_0x3cacfa[_0xb8b2('0x86')]());require(_0xb8b2('0xa2'))[_0xb8b2('0xa3')](path['join'](__dirname,_0xb8b2('0xa4'),_0x3d8949['output']),[_0x3d8949['id'],_0x3cacfa[_0xb8b2('0x86')](),path[_0xb8b2('0x56')](__dirname,_0xb8b2('0xa5'),_0x3d8949['savename']),_0x42da0d]);return _0x3d8949;}else{var _0x51ac7d=squel[_0xb8b2('0x74')]();_0x51ac7d[_0xb8b2('0x75')]('('+_0x3cacfa[_0xb8b2('0x86')]()+')',_0xb8b2('0xa6'));_0x51ac7d[_0xb8b2('0x6d')](_0xb8b2('0xa7'),_0xb8b2('0x1a'));_0x3cacfa[_0xb8b2('0x1b')](_0x3fa99f[_0xb8b2('0x1b')]||_0x13428e);_0x3cacfa[_0xb8b2('0x39')](_0x3fa99f[_0xb8b2('0x39')]||0x0);return dbH[_0xb8b2('0x87')][_0xb8b2('0x32')](_0x51ac7d[_0xb8b2('0x86')](),{'type':dbH[_0xb8b2('0x87')][_0xb8b2('0x88')]['SELECT']})[_0xb8b2('0x22')](function(_0x3a2399){if(!_0x3a2399[_0xb8b2('0x46')]){_0x3633c7=0x0;}else{_0x3633c7=_0x3a2399[0x0][_0xb8b2('0x1a')]||0x0;}return dbH['sequelize'][_0xb8b2('0x32')](_0x3cacfa[_0xb8b2('0x86')](),{'type':dbH[_0xb8b2('0x87')][_0xb8b2('0x88')][_0xb8b2('0x89')]});})['then'](function(_0xfb71f8){return{'rows':_0xfb71f8||[],'count':_0x3633c7};});}});}exports[_0xb8b2('0xa8')]=function(_0x53a937,_0x444b88){return runReport(_0x53a937['params'],_0x53a937['query'],_0x53a937[_0xb8b2('0x47')])[_0xb8b2('0x22')](respondWithResult(_0x444b88,null))[_0xb8b2('0x43')](handleError(_0x444b88,null));};exports['runReport']=runReport;exports[_0xb8b2('0x32')]=function(_0xeeb3a0,_0x1d9022){var _0x474b50=0xa;var _0x22a803=['join','left_join',_0xb8b2('0x58'),_0xb8b2('0x59')];var _0x5653c6={'SUM':_0xb8b2('0x5a'),'COUNT':_0xb8b2('0x5b'),'COUNT DISTINCT':_0xb8b2('0x5c'),'MAX':_0xb8b2('0x5d'),'MIN':_0xb8b2('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb8b2('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb8b2('0x61')};var _0x5756ad={'SEC_TO_TIME':_0xb8b2('0xa9'),'DATE':_0xb8b2('0x62'),'HOUR':_0xb8b2('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb8b2('0x65')};var _0x102b72=function(_0x3d557a){return!_['includes'](['IS\x20NULL',_0xb8b2('0x67'),_0xb8b2('0x68'),_0xb8b2('0x69')],_0x3d557a);};var _0x3de614=function(_0x20c5c8){if(!_0x20c5c8||!_0x20c5c8['rules'][_0xb8b2('0x46')]){return'';}for(var _0x4a9bc8='(',_0x4241f9=0x0;_0x4241f9<_0x20c5c8[_0xb8b2('0x6a')][_0xb8b2('0x46')];_0x4241f9+=0x1){_0x4241f9>0x0&&(_0x4a9bc8+='\x20'+_0x20c5c8[_0xb8b2('0x6b')]+'\x20');_0x4a9bc8+=_0x20c5c8[_0xb8b2('0x6a')][_0x4241f9][_0xb8b2('0x6c')]?_0x3de614(_0x20c5c8[_0xb8b2('0x6a')][_0x4241f9][_0xb8b2('0x6c')]):_0x20c5c8[_0xb8b2('0x6a')][_0x4241f9][_0xb8b2('0x6d')]+'\x20'+_0x20c5c8['rules'][_0x4241f9]['condition']+(_0x102b72(_0x20c5c8['rules'][_0x4241f9]['condition'])?'\x20'+_0x20c5c8[_0xb8b2('0x6a')][_0x4241f9]['value']:'');}return _0x4a9bc8+')';};var _0x299dfd={'where':{'id':_0xeeb3a0[_0xb8b2('0x54')]['id']}},_0x51c526,_0x479816,_0xabb63c,_0x367f10,_0xb340aa;_0x299dfd=_[_0xb8b2('0x3f')]({},_0x299dfd,_0xeeb3a0[_0xb8b2('0x47')]);return db[_0xb8b2('0x2d')][_0xb8b2('0x48')](_0x299dfd)[_0xb8b2('0x22')](function(_0x28a288){if(_0x28a288){_0x51c526=_0x28a288;return _0x28a288['getFields']();}return null;})['then'](function(_0x1bccb8){if(_0x1bccb8){if(!_0x1bccb8[_0xb8b2('0x46')]){throw new db[(_0xb8b2('0x70'))][(_0xb8b2('0x8c'))](_0xb8b2('0x8d'),0x193);}_0x479816=_0x1bccb8;return db[_0xb8b2('0x71')][_0xb8b2('0x72')]({'raw':!![]});}return null;})[_0xb8b2('0x22')](function(_0x14f070){if(_0x14f070){_0xabb63c=_['keyBy'](_0x14f070,'id');var _0x434ab4;var _0xe781c3=squel['select']();_0xe781c3[_0xb8b2('0x75')](_0x51c526[_0xb8b2('0x81')]);for(var _0x529921=0x0;_0x529921<_0x479816[_0xb8b2('0x46')];_0x529921+=0x1){_0x434ab4=_0x479816[_0x529921][_0xb8b2('0x8e')]?_0xabb63c[_0x479816[_0x529921][_0xb8b2('0x8e')]][_0xb8b2('0x76')]:_0x479816[_0x529921][_0xb8b2('0x6d')];_0x434ab4=_0x479816[_0x529921]['function']?_['replace'](_0x5653c6[_0x479816[_0x529921][_0xb8b2('0x77')]],'%s',_0x434ab4):_0x434ab4;_0x434ab4=_0x479816[_0x529921]['format']?_[_0xb8b2('0x78')](_0x5756ad[_0x479816[_0x529921][_0xb8b2('0x80')]],'%s',_0x434ab4):_0x434ab4;if(_0x479816[_0x529921]['groupBy']){_0xe781c3[_0xb8b2('0x6c')](_0x434ab4);}_0x479816[_0x529921][_0xb8b2('0x7a')]&&_0xe781c3[_0xb8b2('0x3a')](_0x434ab4,_0x479816[_0x529921][_0xb8b2('0x7a')]===_0xb8b2('0x7b')?![]:!![]);_0xe781c3[_0xb8b2('0x6d')](_0x434ab4,_0x479816[_0x529921][_0xb8b2('0xaa')]||_0x434ab4);}if(_0x51c526['joins']){_0x51c526[_0xb8b2('0x7c')]=JSON['parse'](_0x51c526[_0xb8b2('0x7c')]);for(var _0x11ffb2=0x0;_0x11ffb2<_0x51c526[_0xb8b2('0x7c')][_0xb8b2('0x46')];_0x11ffb2+=0x1){if(_0x51c526['joins'][_0x11ffb2][_0xb8b2('0x2f')]&&_[_0xb8b2('0x66')](_0x22a803,_0x51c526[_0xb8b2('0x7c')][_0x11ffb2][_0xb8b2('0x2f')])&&_0x51c526['joins'][_0x11ffb2][_0xb8b2('0x7d')]&&_0x51c526[_0xb8b2('0x7c')][_0x11ffb2][_0xb8b2('0x7f')]&&_0x51c526[_0xb8b2('0x7c')][_0x11ffb2]['foreignKey']){_0xe781c3[_0x51c526[_0xb8b2('0x7c')][_0x11ffb2][_0xb8b2('0x2f')]](_0x51c526[_0xb8b2('0x7c')][_0x11ffb2][_0xb8b2('0x7f')],null,util[_0xb8b2('0x80')](_0xb8b2('0x8f'),_0x51c526['table'],_0x51c526[_0xb8b2('0x7c')][_0x11ffb2][_0xb8b2('0x7d')],_0x51c526['joins'][_0x11ffb2][_0xb8b2('0x7f')],_0x51c526[_0xb8b2('0x7c')][_0x11ffb2]['foreignKey']));}}}if(_0x51c526['conditions']){_0x51c526['conditions']=JSON[_0xb8b2('0x90')](_0x51c526[_0xb8b2('0x82')]);_0xe781c3[_0xb8b2('0x3c')](_0x3de614(_0x51c526['conditions']['group']));}_0xb340aa=_0xe781c3[_0xb8b2('0x83')]();_0xe781c3[_0xb8b2('0x1b')](_0x474b50);_0xe781c3[_0xb8b2('0x39')](0x0);logger[_0xb8b2('0x84')]('Limited\x20Query:',_0xe781c3[_0xb8b2('0x86')]());return db[_0xb8b2('0x87')]['query'](_0xe781c3[_0xb8b2('0x86')](),{'type':db[_0xb8b2('0x87')][_0xb8b2('0x88')][_0xb8b2('0x89')]});}})[_0xb8b2('0x22')](function(){return{'sql':_0xb340aa['toString']()};})[_0xb8b2('0x22')](respondWithResult(_0x1d9022,null))[_0xb8b2('0x43')](handleError(_0x1d9022,null));}; \ No newline at end of file +var _0x54ef=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','cross_join','COUNT(%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','DATE(%s)','HOUR(%s)','IS\x20NULL','ValidationErrorItem','AnalyticMetric','table','function','debug','No\x20available\x20data','output','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','right_join','value','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','save','update','then','destroy','CustomReports','UserProfileResource','end','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit'];(function(_0x5ce36d,_0x1da57e){var _0x17d744=function(_0x3d198f){while(--_0x3d198f){_0x5ce36d['push'](_0x5ce36d['shift']());}};_0x17d744(++_0x1da57e);}(_0x54ef,0x112));var _0xf54e=function(_0x3c7ee1,_0x3737cf){_0x3c7ee1=_0x3c7ee1-0x0;var _0x378707=_0x54ef[_0x3c7ee1];return _0x378707;};'use strict';var pdf=require(_0xf54e('0x0'));var emlformat=require(_0xf54e('0x1'));var rimraf=require(_0xf54e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf54e('0x3'));var rp=require(_0xf54e('0x4'));var moment=require(_0xf54e('0x5'));var BPromise=require(_0xf54e('0x6'));var Mustache=require(_0xf54e('0x7'));var util=require(_0xf54e('0x8'));var path=require(_0xf54e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf54e('0xa'));var fs=require('fs');var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf54e('0x18'))['dbH'];function respondWithStatusCode(_0x4bd828,_0x15a9d4){_0x15a9d4=_0x15a9d4||0xcc;return function(_0x2033e9){if(_0x2033e9){return _0x4bd828[_0xf54e('0x19')](_0x15a9d4);}return _0x4bd828[_0xf54e('0x1a')](_0x15a9d4)['end']();};}function respondWithResult(_0x331732,_0x1bbeaa){_0x1bbeaa=_0x1bbeaa||0xc8;return function(_0x1855fe){if(_0x1855fe){return _0x331732[_0xf54e('0x1a')](_0x1bbeaa)['json'](_0x1855fe);}};}function respondWithFilteredResult(_0x2366ee,_0x389abc){return function(_0x3eb415){if(_0x3eb415){var _0x5c5d00=_0x3eb415[_0xf54e('0x1b')],_0x4af633=_0x389abc[_0xf54e('0x1c')],_0xd87020=_0x389abc[_0xf54e('0x1c')]+_0x389abc[_0xf54e('0x1d')],_0x41fb35;if(_0xd87020>=_0x5c5d00){_0xd87020=_0x5c5d00;_0x41fb35=0xc8;}else{_0x41fb35=0xce;}_0x2366ee[_0xf54e('0x1a')](_0x41fb35);return _0x2366ee[_0xf54e('0x1e')](_0xf54e('0x1f'),_0x4af633+'-'+_0xd87020+'/'+_0x5c5d00)[_0xf54e('0x20')](_0x3eb415);}return null;};}function patchUpdates(_0x226c96){return function(_0x50fc66){try{jsonpatch['apply'](_0x50fc66,_0x226c96,!![]);}catch(_0x23e14){return BPromise['reject'](_0x23e14);}return _0x50fc66[_0xf54e('0x21')]();};}function saveUpdates(_0x1bfe99,_0x106362){return function(_0x9903fc){if(_0x9903fc){return _0x9903fc[_0xf54e('0x22')](_0x1bfe99)[_0xf54e('0x23')](function(_0x388aa0){return _0x388aa0;});}return null;};}function removeEntity(_0x11985e,_0x3c0169){return function(_0x5f9eea){if(_0x5f9eea){return _0x5f9eea[_0xf54e('0x24')]()['then'](function(){var _0x6f6d29=_0x5f9eea['get']({'plain':!![]});var _0x264a8f=_0xf54e('0x25');return db[_0xf54e('0x26')][_0xf54e('0x24')]({'where':{'type':_0x264a8f,'resourceId':_0x6f6d29['id']}})[_0xf54e('0x23')](function(){return _0x5f9eea;});})[_0xf54e('0x23')](function(){_0x11985e[_0xf54e('0x1a')](0xcc)[_0xf54e('0x27')]();});}};}function handleEntityNotFound(_0x2342a9,_0x33457f){return function(_0xf6cdd7){if(!_0xf6cdd7){_0x2342a9[_0xf54e('0x19')](0x194);}return _0xf6cdd7;};}function handleError(_0x2ea001,_0x5390b8){_0x5390b8=_0x5390b8||0x1f4;return function(_0xb3706e){logger['error'](_0xb3706e[_0xf54e('0x28')]);if(_0xb3706e['name']){delete _0xb3706e[_0xf54e('0x29')];}_0x2ea001[_0xf54e('0x1a')](_0x5390b8)[_0xf54e('0x2a')](_0xb3706e);};}exports[_0xf54e('0x2b')]=function(_0x25b643,_0x3993e4){var _0x36f985={},_0x54bd8f={},_0x4b3c73={'count':0x0,'rows':[]};var _0x2f96b1=_[_0xf54e('0x2c')](db[_0xf54e('0x2d')][_0xf54e('0x2e')],function(_0xb2d4c4){return{'name':_0xb2d4c4[_0xf54e('0x2f')],'type':_0xb2d4c4[_0xf54e('0x30')][_0xf54e('0x31')]};});_0x54bd8f[_0xf54e('0x32')]=_[_0xf54e('0x2c')](_0x2f96b1,'name');_0x54bd8f['query']=_[_0xf54e('0x33')](_0x25b643[_0xf54e('0x34')]);_0x54bd8f['filters']=_[_0xf54e('0x35')](_0x54bd8f[_0xf54e('0x32')],_0x54bd8f[_0xf54e('0x34')]);_0x36f985[_0xf54e('0x36')]=_['intersection'](_0x54bd8f['model'],qs['fields'](_0x25b643[_0xf54e('0x34')][_0xf54e('0x37')]));_0x36f985[_0xf54e('0x36')]=_0x36f985[_0xf54e('0x36')][_0xf54e('0x38')]?_0x36f985[_0xf54e('0x36')]:_0x54bd8f['model'];if(!_0x25b643['query']['hasOwnProperty'](_0xf54e('0x39'))){_0x36f985[_0xf54e('0x1d')]=qs['limit'](_0x25b643['query'][_0xf54e('0x1d')]);_0x36f985[_0xf54e('0x1c')]=qs[_0xf54e('0x1c')](_0x25b643['query'][_0xf54e('0x1c')]);}_0x36f985[_0xf54e('0x3a')]=qs['sort'](_0x25b643[_0xf54e('0x34')][_0xf54e('0x3b')]);_0x36f985[_0xf54e('0x3c')]=qs[_0xf54e('0x3d')](_[_0xf54e('0x3e')](_0x25b643[_0xf54e('0x34')],_0x54bd8f['filters']),_0x2f96b1);if(_0x25b643['query'][_0xf54e('0x3f')]){_0x36f985[_0xf54e('0x3c')]=_[_0xf54e('0x40')](_0x36f985['where'],{'$or':_[_0xf54e('0x2c')](_0x2f96b1,function(_0x22fa6f){if(_0x22fa6f[_0xf54e('0x30')]!==_0xf54e('0x41')){var _0x361e4c={};_0x361e4c[_0x22fa6f[_0xf54e('0x29')]]={'$like':'%'+_0x25b643[_0xf54e('0x34')][_0xf54e('0x3f')]+'%'};return _0x361e4c;}})});}_0x36f985=_[_0xf54e('0x40')]({},_0x36f985,_0x25b643[_0xf54e('0x42')]);var _0x1c1f0d={'where':_0x36f985[_0xf54e('0x3c')]};return db[_0xf54e('0x2d')][_0xf54e('0x1b')](_0x1c1f0d)[_0xf54e('0x23')](function(_0x5085c1){_0x4b3c73['count']=_0x5085c1;if(_0x25b643['query'][_0xf54e('0x43')]){_0x36f985[_0xf54e('0x44')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xf54e('0x45')](_0x36f985);})[_0xf54e('0x23')](function(_0x381c03){_0x4b3c73['rows']=_0x381c03;return _0x4b3c73;})[_0xf54e('0x23')](respondWithFilteredResult(_0x3993e4,_0x36f985))[_0xf54e('0x46')](handleError(_0x3993e4,null));};exports[_0xf54e('0x47')]=function(_0x794be7,_0x4b1931){var _0x143a39={'raw':![],'where':{'id':_0x794be7[_0xf54e('0x48')]['id']}},_0x14ce90={};_0x14ce90[_0xf54e('0x32')]=_['keys'](db[_0xf54e('0x2d')][_0xf54e('0x2e')]);_0x14ce90[_0xf54e('0x34')]=_[_0xf54e('0x33')](_0x794be7[_0xf54e('0x34')]);_0x14ce90[_0xf54e('0x3d')]=_['intersection'](_0x14ce90[_0xf54e('0x32')],_0x14ce90['query']);_0x143a39[_0xf54e('0x36')]=_['intersection'](_0x14ce90[_0xf54e('0x32')],qs[_0xf54e('0x37')](_0x794be7[_0xf54e('0x34')]['fields']));_0x143a39[_0xf54e('0x36')]=_0x143a39[_0xf54e('0x36')][_0xf54e('0x38')]?_0x143a39[_0xf54e('0x36')]:_0x14ce90[_0xf54e('0x32')];if(_0x794be7['query'][_0xf54e('0x43')]){_0x143a39[_0xf54e('0x44')]=[{'all':!![]}];}_0x143a39=_[_0xf54e('0x40')]({},_0x143a39,_0x794be7[_0xf54e('0x42')]);return db['AnalyticCustomReport'][_0xf54e('0x49')](_0x143a39)[_0xf54e('0x23')](handleEntityNotFound(_0x4b1931,null))['then'](respondWithResult(_0x4b1931,null))[_0xf54e('0x46')](handleError(_0x4b1931,null));};exports[_0xf54e('0x4a')]=function(_0x3d24c7,_0xca0141){return db['AnalyticCustomReport'][_0xf54e('0x4a')](_0x3d24c7[_0xf54e('0x4b')],{})[_0xf54e('0x23')](function(_0xb4654f){var _0x346fc9=_0x3d24c7[_0xf54e('0x4c')][_0xf54e('0x4d')]({'plain':!![]});if(!_0x346fc9)throw new Error(_0xf54e('0x4e'));if(_0x346fc9[_0xf54e('0x4f')]===_0xf54e('0x4c')){var _0xaf9bf0=_0xb4654f[_0xf54e('0x4d')]({'plain':!![]});var _0x2deb0c=_0xf54e('0x50');return db[_0xf54e('0x51')][_0xf54e('0x49')]({'where':{'name':_0x2deb0c,'userProfileId':_0x346fc9[_0xf54e('0x52')]},'raw':!![]})[_0xf54e('0x23')](function(_0x21fd80){if(_0x21fd80&&_0x21fd80[_0xf54e('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0xaf9bf0[_0xf54e('0x29')],'resourceId':_0xaf9bf0['id'],'type':_0xf54e('0x25'),'sectionId':_0x21fd80['id']},{})[_0xf54e('0x23')](function(){return _0xb4654f;});}else{return _0xb4654f;}})[_0xf54e('0x46')](function(_0xba297c){logger[_0xf54e('0x54')](_0xf54e('0x55'),_0xba297c);throw _0xba297c;});}return _0xb4654f;})[_0xf54e('0x23')](respondWithResult(_0xca0141,0xc9))[_0xf54e('0x46')](handleError(_0xca0141,null));};exports[_0xf54e('0x22')]=function(_0x1df308,_0x59c313){if(_0x1df308[_0xf54e('0x4b')]['id']){delete _0x1df308[_0xf54e('0x4b')]['id'];}return db[_0xf54e('0x2d')][_0xf54e('0x49')]({'where':{'id':_0x1df308[_0xf54e('0x48')]['id']}})[_0xf54e('0x23')](handleEntityNotFound(_0x59c313,null))[_0xf54e('0x23')](saveUpdates(_0x1df308['body'],null))[_0xf54e('0x23')](respondWithResult(_0x59c313,null))[_0xf54e('0x46')](handleError(_0x59c313,null));};exports[_0xf54e('0x24')]=function(_0x48a5c8,_0x3ce832){return db['AnalyticCustomReport'][_0xf54e('0x49')]({'where':{'id':_0x48a5c8[_0xf54e('0x48')]['id']}})[_0xf54e('0x23')](handleEntityNotFound(_0x3ce832,null))['then'](removeEntity(_0x3ce832,null))[_0xf54e('0x46')](handleError(_0x3ce832,null));};exports[_0xf54e('0x56')]=function(_0x2096e5,_0x4e5059){var _0x3744a4=0xa;var _0x2ec72a=[_0xf54e('0x57'),'left_join','right_join',_0xf54e('0x58')];var _0x9ab4c4={'SUM':'SUM(%s)','COUNT':_0xf54e('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xf54e('0x5a'),'MIN':'MIN(%s)','AVG':_0xf54e('0x5b'),'GROUP_CONCAT':_0xf54e('0x5c'),'GROUP_CONCAT ASC':_0xf54e('0x5d'),'GROUP_CONCAT DESC':_0xf54e('0x5e')};var _0x44f1de={'SEC_TO_TIME':_0xf54e('0x5f'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xf54e('0x60'),'UNIX_TIMESTAMP':_0xf54e('0x61')};var _0x493011=function(_0x57a48e){return!_[_0xf54e('0x62')](['IS\x20NULL',_0xf54e('0x63'),_0xf54e('0x64'),_0xf54e('0x65')],_0x57a48e);};var _0x2b11f8=function(_0x1d7c52){if(!_0x1d7c52||!_0x1d7c52[_0xf54e('0x66')][_0xf54e('0x38')]){return'';}for(var _0x3d706a='(',_0x11732b=0x0;_0x11732b<_0x1d7c52[_0xf54e('0x66')][_0xf54e('0x38')];_0x11732b+=0x1){_0x11732b>0x0&&(_0x3d706a+='\x20'+_0x1d7c52[_0xf54e('0x67')]+'\x20');_0x3d706a+=_0x1d7c52[_0xf54e('0x66')][_0x11732b][_0xf54e('0x68')]?_0x2b11f8(_0x1d7c52['rules'][_0x11732b][_0xf54e('0x68')]):_0x1d7c52[_0xf54e('0x66')][_0x11732b][_0xf54e('0x69')]+'\x20'+_0x1d7c52[_0xf54e('0x66')][_0x11732b][_0xf54e('0x6a')]+(_0x493011(_0x1d7c52['rules'][_0x11732b][_0xf54e('0x6a')])?'\x20'+_0x1d7c52[_0xf54e('0x66')][_0x11732b]['value']:'');}return _0x3d706a+')';};var _0x51ec35={'where':{'id':_0x2096e5[_0xf54e('0x48')]['id']}},_0x2818cf,_0x4b4a2f,_0x26322a,_0x39c5eb,_0x105cf4;_0x51ec35=_['merge']({},_0x51ec35,_0x2096e5[_0xf54e('0x42')]);return db['AnalyticCustomReport'][_0xf54e('0x49')](_0x51ec35)[_0xf54e('0x23')](function(_0x3dc0d1){if(_0x3dc0d1){_0x2818cf=_0x3dc0d1;return _0x3dc0d1['getFields']();}return null;})[_0xf54e('0x23')](function(_0x504ec7){if(_0x504ec7){if(!_0x504ec7[_0xf54e('0x38')]){throw new db[(_0xf54e('0x6b'))]['ValidationErrorItem'](_0xf54e('0x6c'),0x193);}_0x4b4a2f=_0x504ec7;return db['AnalyticMetric'][_0xf54e('0x45')]({'raw':!![]});}return null;})[_0xf54e('0x23')](function(_0x33acd3){if(_0x33acd3){_0x26322a=_[_0xf54e('0x6d')](_0x33acd3,'id');var _0x21159f;var _0x54ee29=squel[_0xf54e('0x6e')]();_0x54ee29[_0xf54e('0x6f')](_0x2818cf['table']);for(var _0x2db742=0x0;_0x2db742<_0x4b4a2f[_0xf54e('0x38')];_0x2db742+=0x1){_0x21159f=_0x4b4a2f[_0x2db742]['MetricId']?_0x26322a[_0x4b4a2f[_0x2db742][_0xf54e('0x70')]][_0xf54e('0x71')]:_0x4b4a2f[_0x2db742][_0xf54e('0x69')];_0x21159f=_0x4b4a2f[_0x2db742]['function']?_[_0xf54e('0x72')](_0x9ab4c4[_0x4b4a2f[_0x2db742]['function']],'%s',_0x21159f):_0x21159f;_0x21159f=_0x4b4a2f[_0x2db742][_0xf54e('0x73')]?_[_0xf54e('0x72')](_0x44f1de[_0x4b4a2f[_0x2db742]['format']],'%s',_0x21159f):_0x21159f;if(_0x4b4a2f[_0x2db742][_0xf54e('0x74')]){_0x54ee29[_0xf54e('0x68')](_0x21159f);}_0x4b4a2f[_0x2db742][_0xf54e('0x75')]&&_0x54ee29[_0xf54e('0x3a')](_0x21159f,_0x4b4a2f[_0x2db742][_0xf54e('0x75')]===_0xf54e('0x76')?![]:!![]);_0x54ee29[_0xf54e('0x69')](_0x21159f,_0x4b4a2f[_0x2db742][_0xf54e('0x77')]||_0x21159f);}if(_0x2818cf[_0xf54e('0x78')]){_0x2818cf[_0xf54e('0x78')]=JSON[_0xf54e('0x79')](_0x2818cf['joins']);for(var _0x33960a=0x0;_0x33960a<_0x2818cf[_0xf54e('0x78')][_0xf54e('0x38')];_0x33960a+=0x1){if(_0x2818cf['joins'][_0x33960a][_0xf54e('0x30')]&&_[_0xf54e('0x62')](_0x2ec72a,_0x2818cf[_0xf54e('0x78')][_0x33960a][_0xf54e('0x30')])&&_0x2818cf[_0xf54e('0x78')][_0x33960a][_0xf54e('0x7a')]&&_0x2818cf[_0xf54e('0x78')][_0x33960a]['foreignTable']&&_0x2818cf[_0xf54e('0x78')][_0x33960a][_0xf54e('0x7b')]){_0x54ee29[_0x2818cf[_0xf54e('0x78')][_0x33960a]['type']](_0x2818cf[_0xf54e('0x78')][_0x33960a][_0xf54e('0x7c')],null,util[_0xf54e('0x73')](_0xf54e('0x7d'),_0x2818cf['table'],_0x2818cf['joins'][_0x33960a][_0xf54e('0x7a')],_0x2818cf[_0xf54e('0x78')][_0x33960a][_0xf54e('0x7c')],_0x2818cf[_0xf54e('0x78')][_0x33960a][_0xf54e('0x7b')]));}}}if(_0x2818cf[_0xf54e('0x7e')]){_0x2818cf[_0xf54e('0x7e')]=JSON[_0xf54e('0x79')](_0x2818cf[_0xf54e('0x7e')]);_0x54ee29[_0xf54e('0x3c')](_0x2b11f8(_0x2818cf['conditions'][_0xf54e('0x68')]));}_0x105cf4=_0x54ee29[_0xf54e('0x7f')]();_0x54ee29[_0xf54e('0x1d')](_0x3744a4);_0x54ee29[_0xf54e('0x1c')](0x0);logger['debug'](_0xf54e('0x80'),_0x54ee29[_0xf54e('0x81')]());return db[_0xf54e('0x82')][_0xf54e('0x34')](_0x54ee29['toString'](),{'type':db[_0xf54e('0x82')][_0xf54e('0x83')][_0xf54e('0x84')]});}})['then'](respondWithResult(_0x4e5059,null))['catch'](handleError(_0x4e5059,null));};function runReport(_0x3adfed,_0x1a5a77,_0x1e2834){var _0x20ed38=_0x1a5a77[_0xf54e('0x29')];var _0x14b7fc=0xa;var _0x2b42f5=[_0xf54e('0x57'),_0xf54e('0x85'),'right_join',_0xf54e('0x58')];var _0x3edfa0={'SUM':_0xf54e('0x86'),'COUNT':_0xf54e('0x59'),'COUNT DISTINCT':_0xf54e('0x87'),'MAX':_0xf54e('0x5a'),'MIN':_0xf54e('0x88'),'AVG':_0xf54e('0x5b'),'GROUP_CONCAT':_0xf54e('0x5c'),'GROUP_CONCAT ASC':_0xf54e('0x5d'),'GROUP_CONCAT DESC':_0xf54e('0x5e')};var _0x418ecc={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf54e('0x89'),'HOUR':_0xf54e('0x8a'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x85b108=function(_0x250196){return!_[_0xf54e('0x62')]([_0xf54e('0x8b'),_0xf54e('0x63'),_0xf54e('0x64'),_0xf54e('0x65')],_0x250196);};var _0x403445=function(_0x244451){if(!_0x244451||!_0x244451['rules'][_0xf54e('0x38')]){return'';}for(var _0x3c222a='(',_0x3c641b=0x0;_0x3c641b<_0x244451['rules'][_0xf54e('0x38')];_0x3c641b+=0x1){_0x3c641b>0x0&&(_0x3c222a+='\x20'+_0x244451['operator']+'\x20');_0x3c222a+=_0x244451[_0xf54e('0x66')][_0x3c641b]['group']?_0x403445(_0x244451[_0xf54e('0x66')][_0x3c641b][_0xf54e('0x68')]):_0x244451['rules'][_0x3c641b]['field']+'\x20'+_0x244451[_0xf54e('0x66')][_0x3c641b][_0xf54e('0x6a')]+(_0x85b108(_0x244451[_0xf54e('0x66')][_0x3c641b][_0xf54e('0x6a')])?'\x20'+_0x244451[_0xf54e('0x66')][_0x3c641b]['value']:'');}return _0x3c222a+')';};var _0x5c008e={'where':{'id':_0x3adfed['id']}},_0x1a358f,_0x331e1f,_0x456159,_0xc31d53,_0x9afe5;_0x5c008e=_[_0xf54e('0x40')]({},_0x5c008e,_0x1e2834);return db[_0xf54e('0x2d')][_0xf54e('0x49')](_0x5c008e)[_0xf54e('0x23')](function(_0x141f87){if(_0x141f87){_0x1a358f=_0x141f87;return _0x141f87['getFields']();}return null;})[_0xf54e('0x23')](function(_0x1dec8a){if(_0x1dec8a){if(!_0x1dec8a['length']){throw new db['Sequelize'][(_0xf54e('0x8c'))](_0xf54e('0x6c'),0x193);}_0x331e1f=_0x1dec8a;return db[_0xf54e('0x8d')][_0xf54e('0x45')]({'raw':!![]});}return null;})[_0xf54e('0x23')](function(_0x5e6713){if(_0x5e6713){_0x456159=_[_0xf54e('0x6d')](_0x5e6713,'id');var _0x1fce55;var _0xd631af=squel[_0xf54e('0x6e')]();_0xd631af['from'](_0x1a358f[_0xf54e('0x8e')]);for(var _0x276402=0x0;_0x276402<_0x331e1f[_0xf54e('0x38')];_0x276402+=0x1){_0x1fce55=_0x331e1f[_0x276402][_0xf54e('0x70')]?_0x456159[_0x331e1f[_0x276402]['MetricId']][_0xf54e('0x71')]:_0x331e1f[_0x276402][_0xf54e('0x69')];_0x1fce55=_0x331e1f[_0x276402][_0xf54e('0x8f')]?_[_0xf54e('0x72')](_0x3edfa0[_0x331e1f[_0x276402][_0xf54e('0x8f')]],'%s',_0x1fce55):_0x1fce55;_0x1fce55=_0x331e1f[_0x276402]['format']?_[_0xf54e('0x72')](_0x418ecc[_0x331e1f[_0x276402]['format']],'%s',_0x1fce55):_0x1fce55;if(_0x331e1f[_0x276402]['groupBy']){_0xd631af[_0xf54e('0x68')](_0x1fce55);}_0x331e1f[_0x276402][_0xf54e('0x75')]&&_0xd631af[_0xf54e('0x3a')](_0x1fce55,_0x331e1f[_0x276402][_0xf54e('0x75')]===_0xf54e('0x76')?![]:!![]);_0xd631af[_0xf54e('0x69')](_0x1fce55,_0x331e1f[_0x276402][_0xf54e('0x77')]||_0x1fce55);}if(_0x1a358f[_0xf54e('0x78')]){_0x1a358f[_0xf54e('0x78')]=JSON['parse'](_0x1a358f[_0xf54e('0x78')]);for(var _0x3d641c=0x0;_0x3d641c<_0x1a358f[_0xf54e('0x78')][_0xf54e('0x38')];_0x3d641c+=0x1){if(_0x1a358f[_0xf54e('0x78')][_0x3d641c][_0xf54e('0x30')]&&_['includes'](_0x2b42f5,_0x1a358f[_0xf54e('0x78')][_0x3d641c][_0xf54e('0x30')])&&_0x1a358f[_0xf54e('0x78')][_0x3d641c][_0xf54e('0x7a')]&&_0x1a358f[_0xf54e('0x78')][_0x3d641c][_0xf54e('0x7c')]&&_0x1a358f['joins'][_0x3d641c][_0xf54e('0x7b')]){_0xd631af[_0x1a358f[_0xf54e('0x78')][_0x3d641c][_0xf54e('0x30')]](_0x1a358f[_0xf54e('0x78')][_0x3d641c]['foreignTable'],null,util['format'](_0xf54e('0x7d'),_0x1a358f[_0xf54e('0x8e')],_0x1a358f[_0xf54e('0x78')][_0x3d641c][_0xf54e('0x7a')],_0x1a358f[_0xf54e('0x78')][_0x3d641c][_0xf54e('0x7c')],_0x1a358f['joins'][_0x3d641c][_0xf54e('0x7b')]));}}}if(_0x1a358f[_0xf54e('0x7e')]){_0x1a358f[_0xf54e('0x7e')]=JSON[_0xf54e('0x79')](_0x1a358f[_0xf54e('0x7e')]);_0xd631af[_0xf54e('0x3c')](_0x403445(_0x1a358f['conditions'][_0xf54e('0x68')]));}_0x9afe5=_0xd631af['clone']();_0xd631af[_0xf54e('0x1d')](_0x14b7fc);_0xd631af['offset'](0x0);logger[_0xf54e('0x90')](_0xf54e('0x80'),_0xd631af[_0xf54e('0x81')]());return db[_0xf54e('0x82')][_0xf54e('0x34')](_0xd631af['toString'](),{'type':db[_0xf54e('0x82')][_0xf54e('0x83')]['SELECT']});}})[_0xf54e('0x23')](function(_0x1b3ca4){if(!_0x1b3ca4[_0xf54e('0x38')]){throw new db[(_0xf54e('0x6b'))]['ValidationErrorItem'](_0xf54e('0x91'),0xcc);}if(_0x1a5a77[_0xf54e('0x92')]==='web'){return null;}var _0x43771a=_['merge'](_0x1a5a77,{'name':_0x1a5a77['fullPath']||_0x1a5a77[_0xf54e('0x29')]||_0x1a358f['name'],'basename':_0x20ed38,'savename':util[_0xf54e('0x73')](_0xf54e('0x93'),_0x1a5a77[_0xf54e('0x29')]||_0x1a358f[_0xf54e('0x29')],require(_0xf54e('0x94'))['generate'](0x4),_0x1a5a77[_0xf54e('0x92')]||_0xf54e('0x95')),'reportId':_0x1a358f['id'],'reportType':_0xf54e('0x96')});return db[_0xf54e('0x97')]['create'](_0x43771a,{'raw':!![]});})[_0xf54e('0x23')](function(_0x52d9fa){if(_0x1a358f[_0xf54e('0x8e')]===_0xf54e('0x98')){_0x9afe5['where'](_0x1a358f[_0xf54e('0x8e')]+_0xf54e('0x99'),_0x1a5a77[_0xf54e('0x9a')],_0x1a5a77[_0xf54e('0x9b')]);}else{_0x9afe5['where'](_0x1a358f[_0xf54e('0x8e')]+_0xf54e('0x9c'),_0x1a5a77[_0xf54e('0x9a')],_0x1a5a77['endDate']);}if(_0x52d9fa){logger['info'](_0xf54e('0x9d'),_0x9afe5['toString']());require('child_process')['fork'](path[_0xf54e('0x57')](__dirname,_0xf54e('0x9e'),_0x52d9fa[_0xf54e('0x92')]),[_0x52d9fa['id'],_0x9afe5[_0xf54e('0x81')](),path[_0xf54e('0x57')](__dirname,_0xf54e('0x9f'),_0x52d9fa[_0xf54e('0xa0')]),_0x20ed38]);return _0x52d9fa;}else{var _0x2e32f6=squel[_0xf54e('0x6e')]();_0x2e32f6['from']('('+_0x9afe5[_0xf54e('0x81')]()+')','countTable');_0x2e32f6[_0xf54e('0x69')](_0xf54e('0xa1'),'count');_0x9afe5[_0xf54e('0x1d')](_0x1a5a77['limit']||_0x14b7fc);_0x9afe5[_0xf54e('0x1c')](_0x1a5a77[_0xf54e('0x1c')]||0x0);return dbH[_0xf54e('0x82')][_0xf54e('0x34')](_0x2e32f6[_0xf54e('0x81')](),{'type':dbH[_0xf54e('0x82')]['QueryTypes']['SELECT']})['then'](function(_0x2aca3d){if(!_0x2aca3d['length']){_0xc31d53=0x0;}else{_0xc31d53=_0x2aca3d[0x0][_0xf54e('0x1b')]||0x0;}return dbH[_0xf54e('0x82')][_0xf54e('0x34')](_0x9afe5[_0xf54e('0x81')](),{'type':dbH[_0xf54e('0x82')]['QueryTypes'][_0xf54e('0x84')]});})[_0xf54e('0x23')](function(_0x134074){return{'rows':_0x134074||[],'count':_0xc31d53};});}});}exports[_0xf54e('0xa2')]=function(_0x232d8c,_0x406f82){return runReport(_0x232d8c['params'],_0x232d8c[_0xf54e('0x34')],_0x232d8c[_0xf54e('0x42')])[_0xf54e('0x23')](respondWithResult(_0x406f82,null))[_0xf54e('0x46')](handleError(_0x406f82,null));};exports[_0xf54e('0xa3')]=runReport;exports['query']=function(_0x2492a4,_0x101508){var _0x26631d=0xa;var _0x322f58=[_0xf54e('0x57'),_0xf54e('0x85'),_0xf54e('0xa4'),_0xf54e('0x58')];var _0x2e42f7={'SUM':'SUM(%s)','COUNT':_0xf54e('0x59'),'COUNT DISTINCT':_0xf54e('0x87'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xf54e('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf54e('0x5d'),'GROUP_CONCAT DESC':_0xf54e('0x5e')};var _0x41cd85={'SEC_TO_TIME':_0xf54e('0x5f'),'DATE':'DATE(%s)','HOUR':_0xf54e('0x8a'),'ROUND':_0xf54e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x90ad88=function(_0x3797bf){return!_[_0xf54e('0x62')]([_0xf54e('0x8b'),_0xf54e('0x63'),_0xf54e('0x64'),_0xf54e('0x65')],_0x3797bf);};var _0x2179fd=function(_0x37ffde){if(!_0x37ffde||!_0x37ffde[_0xf54e('0x66')][_0xf54e('0x38')]){return'';}for(var _0x5168a8='(',_0x4bb13e=0x0;_0x4bb13e<_0x37ffde[_0xf54e('0x66')][_0xf54e('0x38')];_0x4bb13e+=0x1){_0x4bb13e>0x0&&(_0x5168a8+='\x20'+_0x37ffde[_0xf54e('0x67')]+'\x20');_0x5168a8+=_0x37ffde[_0xf54e('0x66')][_0x4bb13e][_0xf54e('0x68')]?_0x2179fd(_0x37ffde['rules'][_0x4bb13e][_0xf54e('0x68')]):_0x37ffde[_0xf54e('0x66')][_0x4bb13e][_0xf54e('0x69')]+'\x20'+_0x37ffde[_0xf54e('0x66')][_0x4bb13e]['condition']+(_0x90ad88(_0x37ffde[_0xf54e('0x66')][_0x4bb13e][_0xf54e('0x6a')])?'\x20'+_0x37ffde[_0xf54e('0x66')][_0x4bb13e][_0xf54e('0xa5')]:'');}return _0x5168a8+')';};var _0x722e2c={'where':{'id':_0x2492a4[_0xf54e('0x48')]['id']}},_0xd5d99e,_0x164f3e,_0x42ec82,_0x27251a,_0x3c098a;_0x722e2c=_[_0xf54e('0x40')]({},_0x722e2c,_0x2492a4[_0xf54e('0x42')]);return db[_0xf54e('0x2d')]['find'](_0x722e2c)[_0xf54e('0x23')](function(_0x5dfa60){if(_0x5dfa60){_0xd5d99e=_0x5dfa60;return _0x5dfa60['getFields']();}return null;})[_0xf54e('0x23')](function(_0xeeb5da){if(_0xeeb5da){if(!_0xeeb5da[_0xf54e('0x38')]){throw new db[(_0xf54e('0x6b'))][(_0xf54e('0x8c'))](_0xf54e('0x6c'),0x193);}_0x164f3e=_0xeeb5da;return db[_0xf54e('0x8d')][_0xf54e('0x45')]({'raw':!![]});}return null;})[_0xf54e('0x23')](function(_0x1efe6a){if(_0x1efe6a){_0x42ec82=_[_0xf54e('0x6d')](_0x1efe6a,'id');var _0x3c77cd;var _0x4602cb=squel['select']();_0x4602cb[_0xf54e('0x6f')](_0xd5d99e[_0xf54e('0x8e')]);for(var _0x3c6eb8=0x0;_0x3c6eb8<_0x164f3e[_0xf54e('0x38')];_0x3c6eb8+=0x1){_0x3c77cd=_0x164f3e[_0x3c6eb8][_0xf54e('0x70')]?_0x42ec82[_0x164f3e[_0x3c6eb8]['MetricId']]['metric']:_0x164f3e[_0x3c6eb8][_0xf54e('0x69')];_0x3c77cd=_0x164f3e[_0x3c6eb8][_0xf54e('0x8f')]?_['replace'](_0x2e42f7[_0x164f3e[_0x3c6eb8]['function']],'%s',_0x3c77cd):_0x3c77cd;_0x3c77cd=_0x164f3e[_0x3c6eb8][_0xf54e('0x73')]?_['replace'](_0x41cd85[_0x164f3e[_0x3c6eb8][_0xf54e('0x73')]],'%s',_0x3c77cd):_0x3c77cd;if(_0x164f3e[_0x3c6eb8][_0xf54e('0x74')]){_0x4602cb[_0xf54e('0x68')](_0x3c77cd);}_0x164f3e[_0x3c6eb8][_0xf54e('0x75')]&&_0x4602cb[_0xf54e('0x3a')](_0x3c77cd,_0x164f3e[_0x3c6eb8][_0xf54e('0x75')]==='DESC'?![]:!![]);_0x4602cb[_0xf54e('0x69')](_0x3c77cd,_0x164f3e[_0x3c6eb8][_0xf54e('0x77')]||_0x3c77cd);}if(_0xd5d99e['joins']){_0xd5d99e[_0xf54e('0x78')]=JSON[_0xf54e('0x79')](_0xd5d99e['joins']);for(var _0x337fac=0x0;_0x337fac<_0xd5d99e[_0xf54e('0x78')][_0xf54e('0x38')];_0x337fac+=0x1){if(_0xd5d99e['joins'][_0x337fac]['type']&&_[_0xf54e('0x62')](_0x322f58,_0xd5d99e[_0xf54e('0x78')][_0x337fac]['type'])&&_0xd5d99e['joins'][_0x337fac]['parentKey']&&_0xd5d99e[_0xf54e('0x78')][_0x337fac][_0xf54e('0x7c')]&&_0xd5d99e[_0xf54e('0x78')][_0x337fac]['foreignKey']){_0x4602cb[_0xd5d99e[_0xf54e('0x78')][_0x337fac][_0xf54e('0x30')]](_0xd5d99e[_0xf54e('0x78')][_0x337fac][_0xf54e('0x7c')],null,util[_0xf54e('0x73')]('%s.%s\x20=\x20%s.%s',_0xd5d99e['table'],_0xd5d99e['joins'][_0x337fac]['parentKey'],_0xd5d99e['joins'][_0x337fac][_0xf54e('0x7c')],_0xd5d99e['joins'][_0x337fac][_0xf54e('0x7b')]));}}}if(_0xd5d99e[_0xf54e('0x7e')]){_0xd5d99e['conditions']=JSON[_0xf54e('0x79')](_0xd5d99e['conditions']);_0x4602cb[_0xf54e('0x3c')](_0x2179fd(_0xd5d99e[_0xf54e('0x7e')][_0xf54e('0x68')]));}_0x3c098a=_0x4602cb[_0xf54e('0x7f')]();_0x4602cb[_0xf54e('0x1d')](_0x26631d);_0x4602cb[_0xf54e('0x1c')](0x0);logger[_0xf54e('0x90')]('Limited\x20Query:',_0x4602cb[_0xf54e('0x81')]());return db[_0xf54e('0x82')][_0xf54e('0x34')](_0x4602cb[_0xf54e('0x81')](),{'type':db[_0xf54e('0x82')]['QueryTypes'][_0xf54e('0x84')]});}})[_0xf54e('0x23')](function(){return{'sql':_0x3c098a[_0xf54e('0x81')]()};})[_0xf54e('0x23')](respondWithResult(_0x101508,null))[_0xf54e('0x46')](handleError(_0x101508,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index dd0c248..4c85c32 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 _0x6eda=['../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x6eda,0x1f2));var _0xa6ed=function(_0x2924d3,_0x43216b){_0x2924d3=_0x2924d3-0x0;var _0x4be4e4=_0x6eda[_0x2924d3];return _0x4be4e4;};'use strict';var _=require(_0xa6ed('0x0'));var util=require(_0xa6ed('0x1'));var logger=require(_0xa6ed('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa6ed('0x3'));var fs=require('fs');var path=require(_0xa6ed('0x4'));var rimraf=require(_0xa6ed('0x5'));var config=require(_0xa6ed('0x6'));var attributes=require(_0xa6ed('0x7'));module[_0xa6ed('0x8')]=function(_0x3c0c11,_0x46ed06){return _0x3c0c11[_0xa6ed('0x9')](_0xa6ed('0xa'),attributes,{'tableName':_0xa6ed('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd021=['rimraf','exports','define','AnalyticCustomReport','lodash','moment','bluebird','path'];(function(_0x2e9931,_0x1464ab){var _0x3cd2e=function(_0x215e0d){while(--_0x215e0d){_0x2e9931['push'](_0x2e9931['shift']());}};_0x3cd2e(++_0x1464ab);}(_0xd021,0x17c));var _0x1d02=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd021[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1d02('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1d02('0x1'));var BPromise=require(_0x1d02('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d02('0x3'));var rimraf=require(_0x1d02('0x4'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x1d02('0x5')]=function(_0x4e77a8,_0x179fc9){return _0x4e77a8[_0x1d02('0x6')](_0x1d02('0x7'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 90b4f2e..cbbbd9c 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 _0xb1bc=['info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb1bc,0xf1));var _0xcb1b=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0xb1bc[_0x22eb96];return _0x5e1adf;};'use strict';var _=require(_0xcb1b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcb1b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb1b('0x2'));var db=require(_0xcb1b('0x3'))['db'];var utils=require(_0xcb1b('0x4'));var logger=require(_0xcb1b('0x5'))(_0xcb1b('0x6'));var config=require(_0xcb1b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcb1b('0x8')][_0xcb1b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39be3a,_0x3dfe92,_0x1c7ea6){return new BPromise(function(_0x59a61a,_0x2fc7dc){return client[_0xcb1b('0xa')](_0x39be3a,_0x1c7ea6)[_0xcb1b('0xb')](function(_0x228700){logger[_0xcb1b('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3dfe92,_0xcb1b('0xd'));logger[_0xcb1b('0xe')](_0xcb1b('0xf'),_0x3dfe92,'request\x20sent',JSON[_0xcb1b('0x10')](_0x228700));if(_0x228700[_0xcb1b('0x11')]){if(_0x228700[_0xcb1b('0x11')][_0xcb1b('0x12')]===0x1f4){logger[_0xcb1b('0x11')](_0xcb1b('0x13'),_0x3dfe92,_0x228700[_0xcb1b('0x11')]['message']);return _0x2fc7dc(_0x228700[_0xcb1b('0x11')][_0xcb1b('0x14')]);}logger[_0xcb1b('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3dfe92,_0x228700[_0xcb1b('0x11')][_0xcb1b('0x14')]);return _0x59a61a(_0x228700[_0xcb1b('0x11')][_0xcb1b('0x14')]);}else{logger['info'](_0xcb1b('0x13'),_0x3dfe92,_0xcb1b('0xd'));_0x59a61a(_0x228700[_0xcb1b('0x15')][_0xcb1b('0x14')]);}})[_0xcb1b('0x16')](function(_0x21a827){logger[_0xcb1b('0x11')](_0xcb1b('0x13'),_0x3dfe92,_0x21a827);_0x2fc7dc(_0x21a827);});});} \ No newline at end of file +var _0xb941=['jayson/promise','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5302f9,_0x379b28){var _0x1e7449=function(_0x2f5a2b){while(--_0x2f5a2b){_0x5302f9['push'](_0x5302f9['shift']());}};_0x1e7449(++_0x379b28);}(_0xb941,0x102));var _0x1b94=function(_0xef89d,_0x287047){_0xef89d=_0xef89d-0x0;var _0x23d599=_0xb941[_0xef89d];return _0x23d599;};'use strict';var _=require(_0x1b94('0x0'));var util=require(_0x1b94('0x1'));var moment=require('moment');var BPromise=require(_0x1b94('0x2'));var rs=require(_0x1b94('0x3'));var fs=require('fs');var Redis=require(_0x1b94('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b94('0x5'));var logger=require(_0x1b94('0x6'))('rpc');var config=require(_0x1b94('0x7'));var jayson=require(_0x1b94('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x823f9,_0x495476,_0x47bc10){return new BPromise(function(_0x184699,_0x499bd7){return client[_0x1b94('0x9')](_0x823f9,_0x47bc10)['then'](function(_0x21fb85){logger[_0x1b94('0xa')](_0x1b94('0xb'),_0x495476,_0x1b94('0xc'));logger['debug'](_0x1b94('0xd'),_0x495476,_0x1b94('0xc'),JSON['stringify'](_0x21fb85));if(_0x21fb85['error']){if(_0x21fb85[_0x1b94('0xe')][_0x1b94('0xf')]===0x1f4){logger['error'](_0x1b94('0xb'),_0x495476,_0x21fb85[_0x1b94('0xe')][_0x1b94('0x10')]);return _0x499bd7(_0x21fb85[_0x1b94('0xe')][_0x1b94('0x10')]);}logger['error'](_0x1b94('0xb'),_0x495476,_0x21fb85['error'][_0x1b94('0x10')]);return _0x184699(_0x21fb85['error'][_0x1b94('0x10')]);}else{logger[_0x1b94('0xa')](_0x1b94('0xb'),_0x495476,'request\x20sent');_0x184699(_0x21fb85[_0x1b94('0x11')][_0x1b94('0x10')]);}})[_0x1b94('0x12')](function(_0x1d08ef){logger[_0x1b94('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x495476,_0x1d08ef);_0x499bd7(_0x1d08ef);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index dd50941..ab5abb0 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 _0x4513=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','post','put'];(function(_0x56f6c0,_0x37c097){var _0x249342=function(_0x4ab8d9){while(--_0x4ab8d9){_0x56f6c0['push'](_0x56f6c0['shift']());}};_0x249342(++_0x37c097);}(_0x4513,0xd6));var _0x3451=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x4513[_0x618414];return _0x21c19a;};'use strict';var multer=require('multer');var util=require(_0x3451('0x0'));var path=require(_0x3451('0x1'));var timeout=require(_0x3451('0x2'));var express=require(_0x3451('0x3'));var router=express[_0x3451('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3451('0x5'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0x3451('0x6')]('/',auth[_0x3451('0x7')](),controller[_0x3451('0x8')]);router[_0x3451('0x6')](_0x3451('0x9'),auth[_0x3451('0x7')](),controller['show']);router[_0x3451('0x6')](_0x3451('0xa'),auth['isAuthenticated'](),controller[_0x3451('0xb')]);router[_0x3451('0x6')](_0x3451('0xc'),auth[_0x3451('0x7')](),controller[_0x3451('0xd')]);router['get'](_0x3451('0xe'),auth[_0x3451('0x7')](),controller['query']);router[_0x3451('0xf')]('/',auth[_0x3451('0x7')](),controller['create']);router[_0x3451('0x10')](_0x3451('0x9'),auth['isAuthenticated'](),controller[_0x3451('0x11')]);router[_0x3451('0x12')](_0x3451('0x9'),auth['isAuthenticated'](),controller[_0x3451('0x13')]);module[_0x3451('0x14')]=router; \ No newline at end of file +var _0x1197=['exports','multer','util','connect-timeout','express','../../components/auth/service','./analyticCustomReport.controller','get','/:id','show','/:id/preview','preview','/:id/run','isAuthenticated','run','/:id/query','query','post','create','put','update'];(function(_0x19b86f,_0x362385){var _0x460ac4=function(_0x848154){while(--_0x848154){_0x19b86f['push'](_0x19b86f['shift']());}};_0x460ac4(++_0x362385);}(_0x1197,0xbe));var _0x7119=function(_0x16d175,_0x25574f){_0x16d175=_0x16d175-0x0;var _0x3c4192=_0x1197[_0x16d175];return _0x3c4192;};'use strict';var multer=require(_0x7119('0x0'));var util=require(_0x7119('0x1'));var path=require('path');var timeout=require(_0x7119('0x2'));var express=require(_0x7119('0x3'));var router=express['Router']();var auth=require(_0x7119('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7119('0x5'));router[_0x7119('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7119('0x7'),auth['isAuthenticated'](),controller[_0x7119('0x8')]);router['get'](_0x7119('0x9'),auth['isAuthenticated'](),controller[_0x7119('0xa')]);router[_0x7119('0x6')](_0x7119('0xb'),auth[_0x7119('0xc')](),controller[_0x7119('0xd')]);router[_0x7119('0x6')](_0x7119('0xe'),auth['isAuthenticated'](),controller[_0x7119('0xf')]);router[_0x7119('0x10')]('/',auth[_0x7119('0xc')](),controller[_0x7119('0x11')]);router[_0x7119('0x12')](_0x7119('0x7'),auth[_0x7119('0xc')](),controller[_0x7119('0x13')]);router['delete'](_0x7119('0x7'),auth[_0x7119('0xc')](),controller['destroy']);module[_0x7119('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index df161b0..173eb06 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 _0xe4fd=['STRING','TEXT','exports'];(function(_0xbe101,_0x7cd3f5){var _0x1b2a2d=function(_0x5b4aa3){while(--_0x5b4aa3){_0xbe101['push'](_0xbe101['shift']());}};_0x1b2a2d(++_0x7cd3f5);}(_0xe4fd,0x167));var _0xde4f=function(_0x3b900a,_0x42a2ab){_0x3b900a=_0x3b900a-0x0;var _0x549046=_0xe4fd[_0x3b900a];return _0x549046;};'use strict';var Sequelize=require('sequelize');module[_0xde4f('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xde4f('0x1')]},'parent':{'type':Sequelize[_0xde4f('0x1')]},'table':{'type':Sequelize[_0xde4f('0x1')]},'conditions':{'type':Sequelize[_0xde4f('0x2')]},'joins':{'type':Sequelize[_0xde4f('0x2')]}}; \ No newline at end of file +var _0x9d99=['STRING','TEXT','exports'];(function(_0x74fa57,_0x3c9096){var _0xcb852f=function(_0x4bf9c3){while(--_0x4bf9c3){_0x74fa57['push'](_0x74fa57['shift']());}};_0xcb852f(++_0x3c9096);}(_0x9d99,0xad));var _0x99d9=function(_0xce6f11,_0x3c3137){_0xce6f11=_0xce6f11-0x0;var _0x35b709=_0x9d99[_0xce6f11];return _0x35b709;};'use strict';var Sequelize=require('sequelize');module[_0x99d9('0x0')]={'name':{'type':Sequelize[_0x99d9('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x99d9('0x1')]},'parent':{'type':Sequelize[_0x99d9('0x1')]},'table':{'type':Sequelize[_0x99d9('0x1')]},'conditions':{'type':Sequelize[_0x99d9('0x2')]},'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 6634838..9b91556 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 _0x251b=['../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','DefaultReports','UserProfileResource','error','name','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','table','MetricId','field','function','replace','format','groupBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','SUM(%s)','GROUP_CONCAT(%s)','value','select','metric','orderBy','%s.%s\x20=\x20%s.%s','QueryTypes','output','fullPath','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','from','COUNT(*)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x4d7848,_0x3df604){var _0x2b2112=function(_0x4ffcea){while(--_0x4ffcea){_0x4d7848['push'](_0x4d7848['shift']());}};_0x2b2112(++_0x3df604);}(_0x251b,0x1cf));var _0xb251=function(_0x2c3a88,_0x48637e){_0x2c3a88=_0x2c3a88-0x0;var _0x4a7925=_0x251b[_0x2c3a88];return _0x4a7925;};'use strict';var pdf=require(_0xb251('0x0'));var emlformat=require(_0xb251('0x1'));var rimraf=require(_0xb251('0x2'));var zipdir=require(_0xb251('0x3'));var jsonpatch=require(_0xb251('0x4'));var rp=require(_0xb251('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb251('0x6'));var path=require(_0xb251('0x7'));var sox=require(_0xb251('0x8'));var csv=require(_0xb251('0x9'));var ejs=require(_0xb251('0xa'));var fs=require('fs');var _=require(_0xb251('0xb'));var squel=require(_0xb251('0xc'));var crypto=require(_0xb251('0xd'));var jsforce=require(_0xb251('0xe'));var deskjs=require(_0xb251('0xf'));var toCsv=require(_0xb251('0x9'));var querystring=require(_0xb251('0x10'));var Papa=require('papaparse');var Redis=require(_0xb251('0x11'));var authService=require(_0xb251('0x12'));var qs=require(_0xb251('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb251('0x14'));var logger=require(_0xb251('0x15'))(_0xb251('0x16'));var utils=require(_0xb251('0x17'));var config=require(_0xb251('0x18'));var db=require(_0xb251('0x19'))['db'];var dbH=require(_0xb251('0x19'))[_0xb251('0x1a')];function respondWithStatusCode(_0x5ee610,_0x4a31c3){_0x4a31c3=_0x4a31c3||0xcc;return function(_0x280cbd){if(_0x280cbd){return _0x5ee610[_0xb251('0x1b')](_0x4a31c3);}return _0x5ee610['status'](_0x4a31c3)[_0xb251('0x1c')]();};}function respondWithResult(_0x2832bb,_0x27a025){_0x27a025=_0x27a025||0xc8;return function(_0x10934c){if(_0x10934c){return _0x2832bb[_0xb251('0x1d')](_0x27a025)[_0xb251('0x1e')](_0x10934c);}};}function respondWithFilteredResult(_0x44bcd4,_0x5e2891){return function(_0x59994e){if(_0x59994e){var _0x2ae81b=_0x59994e[_0xb251('0x1f')],_0x522674=_0x5e2891[_0xb251('0x20')],_0x4d5f8e=_0x5e2891['offset']+_0x5e2891[_0xb251('0x21')],_0xc78f85;if(_0x4d5f8e>=_0x2ae81b){_0x4d5f8e=_0x2ae81b;_0xc78f85=0xc8;}else{_0xc78f85=0xce;}_0x44bcd4[_0xb251('0x1d')](_0xc78f85);return _0x44bcd4['set'](_0xb251('0x22'),_0x522674+'-'+_0x4d5f8e+'/'+_0x2ae81b)[_0xb251('0x1e')](_0x59994e);}return null;};}function patchUpdates(_0x45851e){return function(_0x44db4e){try{jsonpatch[_0xb251('0x23')](_0x44db4e,_0x45851e,!![]);}catch(_0xb5cfe9){return BPromise[_0xb251('0x24')](_0xb5cfe9);}return _0x44db4e[_0xb251('0x25')]();};}function saveUpdates(_0x35f238,_0x2555f7){return function(_0x208009){if(_0x208009){return _0x208009[_0xb251('0x26')](_0x35f238)['then'](function(_0x39be89){return _0x39be89;});}return null;};}function removeEntity(_0x14aa49,_0x3356bc){return function(_0x4867d4){if(_0x4867d4){return _0x4867d4[_0xb251('0x27')]()[_0xb251('0x28')](function(){var _0xbe826b=_0x4867d4[_0xb251('0x29')]({'plain':!![]});var _0x1c2a75=_0xb251('0x2a');return db[_0xb251('0x2b')][_0xb251('0x27')]({'where':{'type':_0x1c2a75,'resourceId':_0xbe826b['id']}})[_0xb251('0x28')](function(){return _0x4867d4;});})['then'](function(){_0x14aa49[_0xb251('0x1d')](0xcc)[_0xb251('0x1c')]();});}};}function handleEntityNotFound(_0x5e75e2,_0x1218d3){return function(_0x25f034){if(!_0x25f034){_0x5e75e2[_0xb251('0x1b')](0x194);}return _0x25f034;};}function handleError(_0x762b60,_0x41f653){_0x41f653=_0x41f653||0x1f4;return function(_0x20fa21){logger[_0xb251('0x2c')](_0x20fa21['stack']);if(_0x20fa21[_0xb251('0x2d')]){delete _0x20fa21['name'];}_0x762b60[_0xb251('0x1d')](_0x41f653)['send'](_0x20fa21);};}exports[_0xb251('0x2e')]=function(_0x3e46cf,_0x572ab2){var _0x588718={},_0x3119c3={},_0x4fc26a={'count':0x0,'rows':[]};var _0x280106=_['map'](db[_0xb251('0x2f')][_0xb251('0x30')],function(_0x1b2b07){return{'name':_0x1b2b07[_0xb251('0x31')],'type':_0x1b2b07[_0xb251('0x32')][_0xb251('0x33')]};});_0x3119c3['model']=_[_0xb251('0x34')](_0x280106,_0xb251('0x2d'));_0x3119c3[_0xb251('0x35')]=_[_0xb251('0x36')](_0x3e46cf[_0xb251('0x35')]);_0x3119c3[_0xb251('0x37')]=_[_0xb251('0x38')](_0x3119c3['model'],_0x3119c3[_0xb251('0x35')]);_0x588718[_0xb251('0x39')]=_[_0xb251('0x38')](_0x3119c3[_0xb251('0x3a')],qs[_0xb251('0x3b')](_0x3e46cf[_0xb251('0x35')][_0xb251('0x3b')]));_0x588718[_0xb251('0x39')]=_0x588718[_0xb251('0x39')][_0xb251('0x3c')]?_0x588718[_0xb251('0x39')]:_0x3119c3[_0xb251('0x3a')];if(!_0x3e46cf[_0xb251('0x35')][_0xb251('0x3d')]('nolimit')){_0x588718[_0xb251('0x21')]=qs[_0xb251('0x21')](_0x3e46cf['query'][_0xb251('0x21')]);_0x588718[_0xb251('0x20')]=qs[_0xb251('0x20')](_0x3e46cf[_0xb251('0x35')][_0xb251('0x20')]);}_0x588718[_0xb251('0x3e')]=qs[_0xb251('0x3f')](_0x3e46cf['query'][_0xb251('0x3f')]);_0x588718[_0xb251('0x40')]=qs[_0xb251('0x37')](_['pick'](_0x3e46cf[_0xb251('0x35')],_0x3119c3[_0xb251('0x37')]),_0x280106);if(_0x3e46cf[_0xb251('0x35')][_0xb251('0x41')]){_0x588718['where']=_[_0xb251('0x42')](_0x588718[_0xb251('0x40')],{'$or':_[_0xb251('0x34')](_0x280106,function(_0x41e87a){if(_0x41e87a[_0xb251('0x32')]!==_0xb251('0x43')){var _0x1602ab={};_0x1602ab[_0x41e87a[_0xb251('0x2d')]]={'$like':'%'+_0x3e46cf[_0xb251('0x35')][_0xb251('0x41')]+'%'};return _0x1602ab;}})});}_0x588718=_[_0xb251('0x42')]({},_0x588718,_0x3e46cf[_0xb251('0x44')]);var _0x546243={'where':_0x588718[_0xb251('0x40')]};return db[_0xb251('0x2f')][_0xb251('0x1f')](_0x546243)[_0xb251('0x28')](function(_0x253445){_0x4fc26a[_0xb251('0x1f')]=_0x253445;if(_0x3e46cf['query']['includeAll']){_0x588718[_0xb251('0x45')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0xb251('0x46')](_0x588718);})[_0xb251('0x28')](function(_0x809b50){_0x4fc26a[_0xb251('0x47')]=_0x809b50;return _0x4fc26a;})['then'](respondWithFilteredResult(_0x572ab2,_0x588718))[_0xb251('0x48')](handleError(_0x572ab2,null));};exports[_0xb251('0x49')]=function(_0x1c0b6e,_0x28eee8){var _0xea6cee={'raw':!![],'where':{'id':_0x1c0b6e[_0xb251('0x4a')]['id']}},_0x975b38={};_0x975b38[_0xb251('0x3a')]=_[_0xb251('0x36')](db[_0xb251('0x2f')][_0xb251('0x30')]);_0x975b38[_0xb251('0x35')]=_['keys'](_0x1c0b6e[_0xb251('0x35')]);_0x975b38[_0xb251('0x37')]=_[_0xb251('0x38')](_0x975b38['model'],_0x975b38[_0xb251('0x35')]);_0xea6cee[_0xb251('0x39')]=_[_0xb251('0x38')](_0x975b38[_0xb251('0x3a')],qs[_0xb251('0x3b')](_0x1c0b6e['query'][_0xb251('0x3b')]));_0xea6cee[_0xb251('0x39')]=_0xea6cee[_0xb251('0x39')][_0xb251('0x3c')]?_0xea6cee[_0xb251('0x39')]:_0x975b38[_0xb251('0x3a')];if(_0x1c0b6e[_0xb251('0x35')][_0xb251('0x4b')]){_0xea6cee[_0xb251('0x45')]=[{'all':!![]}];}_0xea6cee=_['merge']({},_0xea6cee,_0x1c0b6e[_0xb251('0x44')]);return db[_0xb251('0x2f')][_0xb251('0x4c')](_0xea6cee)[_0xb251('0x28')](handleEntityNotFound(_0x28eee8,null))[_0xb251('0x28')](respondWithResult(_0x28eee8,null))[_0xb251('0x48')](handleError(_0x28eee8,null));};exports[_0xb251('0x4d')]=function(_0x2170f1,_0x57cf5f){return db[_0xb251('0x2f')][_0xb251('0x4d')](_0x2170f1[_0xb251('0x4e')],{})['then'](function(_0x46d534){var _0x471ec2=_0x2170f1[_0xb251('0x4f')][_0xb251('0x29')]({'plain':!![]});if(!_0x471ec2)throw new Error(_0xb251('0x50'));if(_0x471ec2['role']===_0xb251('0x4f')){var _0x31117b=_0x46d534[_0xb251('0x29')]({'plain':!![]});var _0x42b113=_0xb251('0x51');return db[_0xb251('0x52')][_0xb251('0x4c')]({'where':{'name':_0x42b113,'userProfileId':_0x471ec2[_0xb251('0x53')]},'raw':!![]})[_0xb251('0x28')](function(_0x2416d4){if(_0x2416d4&&_0x2416d4['autoAssociation']===0x0){return db[_0xb251('0x2b')]['create']({'name':_0x31117b[_0xb251('0x2d')],'resourceId':_0x31117b['id'],'type':'DefaultReports','sectionId':_0x2416d4['id']},{})[_0xb251('0x28')](function(){return _0x46d534;});}else{return _0x46d534;}})[_0xb251('0x48')](function(_0x3a764d){logger[_0xb251('0x2c')](_0xb251('0x54'),_0x3a764d);throw _0x3a764d;});}return _0x46d534;})[_0xb251('0x28')](respondWithResult(_0x57cf5f,0xc9))[_0xb251('0x48')](handleError(_0x57cf5f,null));};exports[_0xb251('0x26')]=function(_0x3cc494,_0x7cd818){if(_0x3cc494[_0xb251('0x4e')]['id']){delete _0x3cc494[_0xb251('0x4e')]['id'];}return db[_0xb251('0x2f')][_0xb251('0x4c')]({'where':{'id':_0x3cc494['params']['id']}})[_0xb251('0x28')](handleEntityNotFound(_0x7cd818,null))[_0xb251('0x28')](saveUpdates(_0x3cc494[_0xb251('0x4e')],null))[_0xb251('0x28')](respondWithResult(_0x7cd818,null))[_0xb251('0x48')](handleError(_0x7cd818,null));};exports[_0xb251('0x27')]=function(_0xbe9412,_0x15d753){return db['AnalyticDefaultReport'][_0xb251('0x4c')]({'where':{'id':_0xbe9412[_0xb251('0x4a')]['id']}})[_0xb251('0x28')](handleEntityNotFound(_0x15d753,null))[_0xb251('0x28')](removeEntity(_0x15d753,null))['catch'](handleError(_0x15d753,null));};exports['preview']=function(_0xd85720,_0x294247){var _0x2acfbc=0xa;var _0x5b5f6f=[_0xb251('0x55'),_0xb251('0x56'),_0xb251('0x57'),_0xb251('0x58')];var _0x5d93c5={'SUM':'SUM(%s)','COUNT':_0xb251('0x59'),'COUNT DISTINCT':_0xb251('0x5a'),'MAX':_0xb251('0x5b'),'MIN':_0xb251('0x5c'),'AVG':_0xb251('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb251('0x5e'),'GROUP_CONCAT DESC':_0xb251('0x5f')};var _0x21868b={'SEC_TO_TIME':_0xb251('0x60'),'DATE':_0xb251('0x61'),'HOUR':_0xb251('0x62'),'ROUND':_0xb251('0x63'),'UNIX_TIMESTAMP':_0xb251('0x64')};var _0x5b92b2=function(_0x3461dd){return!_['includes']([_0xb251('0x65'),_0xb251('0x66'),_0xb251('0x67'),_0xb251('0x68')],_0x3461dd);};var _0x5169f8=function(_0x29e005){if(!_0x29e005||!_0x29e005[_0xb251('0x69')][_0xb251('0x3c')]){return'';}for(var _0x354207='(',_0x34f25f=0x0;_0x34f25f<_0x29e005[_0xb251('0x69')][_0xb251('0x3c')];_0x34f25f+=0x1){_0x34f25f>0x0&&(_0x354207+='\x20'+_0x29e005[_0xb251('0x6a')]+'\x20');_0x354207+=_0x29e005[_0xb251('0x69')][_0x34f25f][_0xb251('0x6b')]?_0x5169f8(_0x29e005[_0xb251('0x69')][_0x34f25f][_0xb251('0x6b')]):_0x29e005[_0xb251('0x69')][_0x34f25f]['field']+'\x20'+_0x29e005[_0xb251('0x69')][_0x34f25f][_0xb251('0x6c')]+(_0x5b92b2(_0x29e005['rules'][_0x34f25f][_0xb251('0x6c')])?'\x20'+_0x29e005['rules'][_0x34f25f]['value']:'');}return _0x354207+')';};var _0x40d49a={'where':{'id':_0xd85720[_0xb251('0x4a')]['id']}},_0x4c0c47,_0x445f75,_0x3792e9,_0x21fc29,_0x5befa1;_0x40d49a=_['merge']({},_0x40d49a,_0xd85720[_0xb251('0x44')]);return db['AnalyticDefaultReport']['find'](_0x40d49a)[_0xb251('0x28')](function(_0x24f770){if(_0x24f770){_0x4c0c47=_0x24f770;return _0x24f770[_0xb251('0x6d')]();}return null;})['then'](function(_0x1a499b){if(_0x1a499b){if(!_0x1a499b[_0xb251('0x3c')]){throw new db[(_0xb251('0x6e'))][(_0xb251('0x6f'))](_0xb251('0x70'),0x193);}_0x445f75=_0x1a499b;return db[_0xb251('0x71')][_0xb251('0x46')]({'raw':!![]});}return null;})['then'](function(_0x49f498){if(_0x49f498){_0x3792e9=_[_0xb251('0x72')](_0x49f498,'id');var _0x560c4b;var _0x1ce253=squel['select']();_0x1ce253['from'](_0x4c0c47[_0xb251('0x73')]);for(var _0x16f74b=0x0;_0x16f74b<_0x445f75[_0xb251('0x3c')];_0x16f74b+=0x1){_0x560c4b=_0x445f75[_0x16f74b]['MetricId']?_0x3792e9[_0x445f75[_0x16f74b][_0xb251('0x74')]]['metric']:_0x445f75[_0x16f74b][_0xb251('0x75')];_0x560c4b=_0x445f75[_0x16f74b][_0xb251('0x76')]?_[_0xb251('0x77')](_0x5d93c5[_0x445f75[_0x16f74b][_0xb251('0x76')]],'%s',_0x560c4b):_0x560c4b;_0x560c4b=_0x445f75[_0x16f74b][_0xb251('0x78')]?_['replace'](_0x21868b[_0x445f75[_0x16f74b][_0xb251('0x78')]],'%s',_0x560c4b):_0x560c4b;if(_0x445f75[_0x16f74b][_0xb251('0x79')]){_0x1ce253[_0xb251('0x6b')](_0x560c4b);}_0x445f75[_0x16f74b]['orderBy']&&_0x1ce253['order'](_0x560c4b,_0x445f75[_0x16f74b]['orderBy']===_0xb251('0x7a')?![]:!![]);_0x1ce253['field'](_0x560c4b,_0x445f75[_0x16f74b][_0xb251('0x7b')]||_0x560c4b);}if(_0x4c0c47[_0xb251('0x7c')]){_0x4c0c47['joins']=JSON[_0xb251('0x7d')](_0x4c0c47[_0xb251('0x7c')]);for(var _0x2fd49d=0x0;_0x2fd49d<_0x4c0c47[_0xb251('0x7c')]['length'];_0x2fd49d+=0x1){if(_0x4c0c47[_0xb251('0x7c')][_0x2fd49d][_0xb251('0x32')]&&_[_0xb251('0x7e')](_0x5b5f6f,_0x4c0c47[_0xb251('0x7c')][_0x2fd49d][_0xb251('0x32')])&&_0x4c0c47[_0xb251('0x7c')][_0x2fd49d][_0xb251('0x7f')]&&_0x4c0c47['joins'][_0x2fd49d][_0xb251('0x80')]&&_0x4c0c47[_0xb251('0x7c')][_0x2fd49d][_0xb251('0x81')]){_0x1ce253[_0x4c0c47[_0xb251('0x7c')][_0x2fd49d][_0xb251('0x32')]](_0x4c0c47[_0xb251('0x7c')][_0x2fd49d][_0xb251('0x80')],null,util[_0xb251('0x78')]('%s.%s\x20=\x20%s.%s',_0x4c0c47[_0xb251('0x73')],_0x4c0c47[_0xb251('0x7c')][_0x2fd49d][_0xb251('0x7f')],_0x4c0c47[_0xb251('0x7c')][_0x2fd49d][_0xb251('0x80')],_0x4c0c47[_0xb251('0x7c')][_0x2fd49d][_0xb251('0x81')]));}}}if(_0x4c0c47[_0xb251('0x82')]){_0x4c0c47[_0xb251('0x82')]=JSON[_0xb251('0x7d')](_0x4c0c47[_0xb251('0x82')]);_0x1ce253['where'](_0x5169f8(_0x4c0c47[_0xb251('0x82')][_0xb251('0x6b')]));}_0x5befa1=_0x1ce253[_0xb251('0x83')]();_0x1ce253[_0xb251('0x21')](_0x2acfbc);_0x1ce253['offset'](0x0);logger[_0xb251('0x84')](_0xb251('0x85'),_0x1ce253[_0xb251('0x86')]());return db[_0xb251('0x87')][_0xb251('0x35')](_0x1ce253[_0xb251('0x86')](),{'type':db[_0xb251('0x87')]['QueryTypes'][_0xb251('0x88')]});}})[_0xb251('0x28')](respondWithResult(_0x294247,null))[_0xb251('0x48')](handleError(_0x294247,null));};function runReport(_0xa5f197,_0x43a0f8,_0xc9af8e){var _0x1ca888=_0x43a0f8[_0xb251('0x2d')];var _0x4a857e=0xa;var _0x42861=['join',_0xb251('0x56'),_0xb251('0x57'),'cross_join'];var _0x3ebcf1={'SUM':_0xb251('0x89'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb251('0x5a'),'MAX':_0xb251('0x5b'),'MIN':'MIN(%s)','AVG':_0xb251('0x5d'),'GROUP_CONCAT':_0xb251('0x8a'),'GROUP_CONCAT ASC':_0xb251('0x5e'),'GROUP_CONCAT DESC':_0xb251('0x5f')};var _0x591b73={'SEC_TO_TIME':_0xb251('0x60'),'DATE':'DATE(%s)','HOUR':_0xb251('0x62'),'ROUND':_0xb251('0x63'),'UNIX_TIMESTAMP':_0xb251('0x64')};var _0x2e500a=function(_0x323fd7){return!_[_0xb251('0x7e')]([_0xb251('0x65'),_0xb251('0x66'),_0xb251('0x67'),_0xb251('0x68')],_0x323fd7);};var _0x9cacbe=function(_0x37c716){if(!_0x37c716||!_0x37c716['rules'][_0xb251('0x3c')]){return'';}for(var _0x438f59='(',_0x426c8d=0x0;_0x426c8d<_0x37c716['rules']['length'];_0x426c8d+=0x1){_0x426c8d>0x0&&(_0x438f59+='\x20'+_0x37c716['operator']+'\x20');_0x438f59+=_0x37c716['rules'][_0x426c8d][_0xb251('0x6b')]?_0x9cacbe(_0x37c716[_0xb251('0x69')][_0x426c8d]['group']):_0x37c716['rules'][_0x426c8d][_0xb251('0x75')]+'\x20'+_0x37c716[_0xb251('0x69')][_0x426c8d][_0xb251('0x6c')]+(_0x2e500a(_0x37c716[_0xb251('0x69')][_0x426c8d][_0xb251('0x6c')])?'\x20'+_0x37c716[_0xb251('0x69')][_0x426c8d][_0xb251('0x8b')]:'');}return _0x438f59+')';};var _0xef02cb={'where':{'id':_0xa5f197['id']}},_0xad6d76,_0x2004d0,_0x5b9d8a,_0xffdeec,_0xabb39a;_0xef02cb=_[_0xb251('0x42')]({},_0xef02cb,_0xc9af8e);return db['AnalyticDefaultReport']['find'](_0xef02cb)['then'](function(_0x56f7e9){if(_0x56f7e9){_0xad6d76=_0x56f7e9;return _0x56f7e9['getFields']();}return null;})['then'](function(_0x3339e7){if(_0x3339e7){if(!_0x3339e7[_0xb251('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xb251('0x70'),0x193);}_0x2004d0=_0x3339e7;return db[_0xb251('0x71')][_0xb251('0x46')]({'raw':!![]});}return null;})[_0xb251('0x28')](function(_0x104b40){if(_0x104b40){_0x5b9d8a=_[_0xb251('0x72')](_0x104b40,'id');var _0x4e5fe3;var _0xfe7029=squel[_0xb251('0x8c')]();_0xfe7029['from'](_0xad6d76['table']);for(var _0x2814fa=0x0;_0x2814fa<_0x2004d0[_0xb251('0x3c')];_0x2814fa+=0x1){_0x4e5fe3=_0x2004d0[_0x2814fa][_0xb251('0x74')]?_0x5b9d8a[_0x2004d0[_0x2814fa][_0xb251('0x74')]][_0xb251('0x8d')]:_0x2004d0[_0x2814fa][_0xb251('0x75')];_0x4e5fe3=_0x2004d0[_0x2814fa][_0xb251('0x76')]?_[_0xb251('0x77')](_0x3ebcf1[_0x2004d0[_0x2814fa][_0xb251('0x76')]],'%s',_0x4e5fe3):_0x4e5fe3;_0x4e5fe3=_0x2004d0[_0x2814fa][_0xb251('0x78')]?_['replace'](_0x591b73[_0x2004d0[_0x2814fa][_0xb251('0x78')]],'%s',_0x4e5fe3):_0x4e5fe3;if(_0x2004d0[_0x2814fa]['groupBy']){_0xfe7029[_0xb251('0x6b')](_0x4e5fe3);}_0x2004d0[_0x2814fa][_0xb251('0x8e')]&&_0xfe7029['order'](_0x4e5fe3,_0x2004d0[_0x2814fa][_0xb251('0x8e')]==='DESC'?![]:!![]);_0xfe7029[_0xb251('0x75')](_0x4e5fe3,_0x2004d0[_0x2814fa]['alias']||_0x4e5fe3);}if(_0xad6d76[_0xb251('0x7c')]){_0xad6d76[_0xb251('0x7c')]=JSON[_0xb251('0x7d')](_0xad6d76['joins']);for(var _0x2cac6e=0x0;_0x2cac6e<_0xad6d76[_0xb251('0x7c')]['length'];_0x2cac6e+=0x1){if(_0xad6d76['joins'][_0x2cac6e][_0xb251('0x32')]&&_[_0xb251('0x7e')](_0x42861,_0xad6d76[_0xb251('0x7c')][_0x2cac6e]['type'])&&_0xad6d76[_0xb251('0x7c')][_0x2cac6e][_0xb251('0x7f')]&&_0xad6d76[_0xb251('0x7c')][_0x2cac6e][_0xb251('0x80')]&&_0xad6d76['joins'][_0x2cac6e][_0xb251('0x81')]){_0xfe7029[_0xad6d76[_0xb251('0x7c')][_0x2cac6e]['type']](_0xad6d76[_0xb251('0x7c')][_0x2cac6e]['foreignTable'],null,util[_0xb251('0x78')](_0xb251('0x8f'),_0xad6d76[_0xb251('0x73')],_0xad6d76['joins'][_0x2cac6e][_0xb251('0x7f')],_0xad6d76['joins'][_0x2cac6e][_0xb251('0x80')],_0xad6d76[_0xb251('0x7c')][_0x2cac6e][_0xb251('0x81')]));}}}if(_0xad6d76['conditions']){_0xad6d76[_0xb251('0x82')]=JSON[_0xb251('0x7d')](_0xad6d76[_0xb251('0x82')]);_0xfe7029[_0xb251('0x40')](_0x9cacbe(_0xad6d76[_0xb251('0x82')][_0xb251('0x6b')]));}_0xabb39a=_0xfe7029[_0xb251('0x83')]();_0xfe7029[_0xb251('0x21')](_0x4a857e);_0xfe7029[_0xb251('0x20')](0x0);logger['debug'](_0xb251('0x85'),_0xfe7029[_0xb251('0x86')]());return db[_0xb251('0x87')][_0xb251('0x35')](_0xfe7029['toString'](),{'type':db['sequelize'][_0xb251('0x90')][_0xb251('0x88')]});}})['then'](function(_0x42dbf9){if(!_0x42dbf9[_0xb251('0x3c')]){throw new db[(_0xb251('0x6e'))]['ValidationErrorItem']('No\x20available\x20data',0xcc);}if(_0x43a0f8[_0xb251('0x91')]==='web'){return null;}var _0x634520=_[_0xb251('0x42')](_0x43a0f8,{'name':_0x43a0f8[_0xb251('0x92')]||_0x43a0f8[_0xb251('0x2d')]||_0xad6d76[_0xb251('0x2d')],'basename':_0x1ca888,'savename':util[_0xb251('0x78')](_0xb251('0x93'),_0x43a0f8['name']||_0xad6d76[_0xb251('0x2d')],require(_0xb251('0x94'))[_0xb251('0x95')](0x4),_0x43a0f8[_0xb251('0x91')]||'csv'),'reportId':_0xad6d76['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0xb251('0x4d')](_0x634520,{'raw':!![]});})[_0xb251('0x28')](function(_0x10a3e0){if(_0xad6d76['table']===_0xb251('0x96')){_0xabb39a[_0xb251('0x40')](_0xad6d76['table']+_0xb251('0x97'),_0x43a0f8[_0xb251('0x98')],_0x43a0f8[_0xb251('0x99')]);}else{_0xabb39a[_0xb251('0x40')](_0xad6d76[_0xb251('0x73')]+_0xb251('0x9a'),_0x43a0f8[_0xb251('0x98')],_0x43a0f8['endDate']);}if(_0x10a3e0){logger[_0xb251('0x9b')](_0xb251('0x9c'),_0xabb39a[_0xb251('0x86')]());require(_0xb251('0x9d'))[_0xb251('0x9e')](path[_0xb251('0x55')](__dirname,_0xb251('0x9f'),_0x10a3e0[_0xb251('0x91')]),[_0x10a3e0['id'],_0xabb39a[_0xb251('0x86')](),path[_0xb251('0x55')](__dirname,'../../files/reports',_0x10a3e0['savename']),_0x1ca888]);return _0x10a3e0;}else{var _0x221dee=squel['select']();_0x221dee[_0xb251('0xa0')]('('+_0xabb39a[_0xb251('0x86')]()+')','countTable');_0x221dee[_0xb251('0x75')](_0xb251('0xa1'),'count');_0xabb39a[_0xb251('0x21')](_0x43a0f8[_0xb251('0x21')]||_0x4a857e);_0xabb39a['offset'](_0x43a0f8[_0xb251('0x20')]||0x0);return dbH[_0xb251('0x87')][_0xb251('0x35')](_0x221dee[_0xb251('0x86')](),{'type':dbH[_0xb251('0x87')][_0xb251('0x90')][_0xb251('0x88')]})[_0xb251('0x28')](function(_0x199122){if(!_0x199122['length']){_0xffdeec=0x0;}else{_0xffdeec=_0x199122[0x0][_0xb251('0x1f')]||0x0;}return dbH[_0xb251('0x87')][_0xb251('0x35')](_0xabb39a[_0xb251('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0xb251('0x88')]});})[_0xb251('0x28')](function(_0x3ca68d){return{'rows':_0x3ca68d||[],'count':_0xffdeec};});}});}exports['run']=function(_0x4cc9be,_0x3da073){return runReport(_0x4cc9be[_0xb251('0x4a')],_0x4cc9be[_0xb251('0x35')],_0x4cc9be[_0xb251('0x44')])[_0xb251('0x28')](respondWithResult(_0x3da073,null))[_0xb251('0x48')](handleError(_0x3da073,null));};exports['runReport']=runReport;exports[_0xb251('0x35')]=function(_0xe40e8a,_0x46f080){var _0x1a582d=0xa;var _0x3152ca=['join',_0xb251('0x56'),_0xb251('0x57'),_0xb251('0x58')];var _0x2b7c5f={'SUM':_0xb251('0x89'),'COUNT':_0xb251('0x59'),'COUNT DISTINCT':_0xb251('0x5a'),'MAX':'MAX(%s)','MIN':_0xb251('0x5c'),'AVG':_0xb251('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb251('0x5e'),'GROUP_CONCAT DESC':_0xb251('0x5f')};var _0x1864ac={'SEC_TO_TIME':_0xb251('0x60'),'DATE':_0xb251('0x61'),'HOUR':'HOUR(%s)','ROUND':_0xb251('0x63'),'UNIX_TIMESTAMP':_0xb251('0x64')};var _0x198a84=function(_0x50665d){return!_[_0xb251('0x7e')]([_0xb251('0x65'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xb251('0x68')],_0x50665d);};var _0x1d48ef=function(_0x56c5e5){if(!_0x56c5e5||!_0x56c5e5['rules'][_0xb251('0x3c')]){return'';}for(var _0x557c49='(',_0xd52fd7=0x0;_0xd52fd7<_0x56c5e5[_0xb251('0x69')]['length'];_0xd52fd7+=0x1){_0xd52fd7>0x0&&(_0x557c49+='\x20'+_0x56c5e5['operator']+'\x20');_0x557c49+=_0x56c5e5[_0xb251('0x69')][_0xd52fd7]['group']?_0x1d48ef(_0x56c5e5[_0xb251('0x69')][_0xd52fd7]['group']):_0x56c5e5[_0xb251('0x69')][_0xd52fd7]['field']+'\x20'+_0x56c5e5[_0xb251('0x69')][_0xd52fd7][_0xb251('0x6c')]+(_0x198a84(_0x56c5e5[_0xb251('0x69')][_0xd52fd7][_0xb251('0x6c')])?'\x20'+_0x56c5e5[_0xb251('0x69')][_0xd52fd7][_0xb251('0x8b')]:'');}return _0x557c49+')';};var _0x226fe0={'where':{'id':_0xe40e8a[_0xb251('0x4a')]['id']}},_0x4c146a,_0x2e8c18,_0x399af9,_0x2d8691,_0x28af3c;_0x226fe0=_[_0xb251('0x42')]({},_0x226fe0,_0xe40e8a[_0xb251('0x44')]);return db[_0xb251('0x2f')][_0xb251('0x4c')](_0x226fe0)[_0xb251('0x28')](function(_0x19a793){if(_0x19a793){_0x4c146a=_0x19a793;return _0x19a793[_0xb251('0x6d')]();}return null;})[_0xb251('0x28')](function(_0x149f13){if(_0x149f13){if(!_0x149f13[_0xb251('0x3c')]){throw new db[(_0xb251('0x6e'))][(_0xb251('0x6f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2e8c18=_0x149f13;return db[_0xb251('0x71')][_0xb251('0x46')]({'raw':!![]});}return null;})[_0xb251('0x28')](function(_0x15a8d){if(_0x15a8d){_0x399af9=_[_0xb251('0x72')](_0x15a8d,'id');var _0x21cb98;var _0x96e773=squel['select']();_0x96e773[_0xb251('0xa0')](_0x4c146a['table']);for(var _0xf79012=0x0;_0xf79012<_0x2e8c18['length'];_0xf79012+=0x1){_0x21cb98=_0x2e8c18[_0xf79012][_0xb251('0x74')]?_0x399af9[_0x2e8c18[_0xf79012][_0xb251('0x74')]][_0xb251('0x8d')]:_0x2e8c18[_0xf79012][_0xb251('0x75')];_0x21cb98=_0x2e8c18[_0xf79012][_0xb251('0x76')]?_['replace'](_0x2b7c5f[_0x2e8c18[_0xf79012][_0xb251('0x76')]],'%s',_0x21cb98):_0x21cb98;_0x21cb98=_0x2e8c18[_0xf79012]['format']?_[_0xb251('0x77')](_0x1864ac[_0x2e8c18[_0xf79012][_0xb251('0x78')]],'%s',_0x21cb98):_0x21cb98;if(_0x2e8c18[_0xf79012][_0xb251('0x79')]){_0x96e773['group'](_0x21cb98);}_0x2e8c18[_0xf79012][_0xb251('0x8e')]&&_0x96e773[_0xb251('0x3e')](_0x21cb98,_0x2e8c18[_0xf79012][_0xb251('0x8e')]===_0xb251('0x7a')?![]:!![]);_0x96e773[_0xb251('0x75')](_0x21cb98,_0x2e8c18[_0xf79012][_0xb251('0x7b')]||_0x21cb98);}if(_0x4c146a['joins']){_0x4c146a['joins']=JSON[_0xb251('0x7d')](_0x4c146a[_0xb251('0x7c')]);for(var _0x14b7f3=0x0;_0x14b7f3<_0x4c146a[_0xb251('0x7c')]['length'];_0x14b7f3+=0x1){if(_0x4c146a[_0xb251('0x7c')][_0x14b7f3]['type']&&_[_0xb251('0x7e')](_0x3152ca,_0x4c146a['joins'][_0x14b7f3]['type'])&&_0x4c146a[_0xb251('0x7c')][_0x14b7f3][_0xb251('0x7f')]&&_0x4c146a[_0xb251('0x7c')][_0x14b7f3]['foreignTable']&&_0x4c146a['joins'][_0x14b7f3][_0xb251('0x81')]){_0x96e773[_0x4c146a['joins'][_0x14b7f3]['type']](_0x4c146a['joins'][_0x14b7f3][_0xb251('0x80')],null,util[_0xb251('0x78')](_0xb251('0x8f'),_0x4c146a[_0xb251('0x73')],_0x4c146a['joins'][_0x14b7f3][_0xb251('0x7f')],_0x4c146a[_0xb251('0x7c')][_0x14b7f3][_0xb251('0x80')],_0x4c146a['joins'][_0x14b7f3][_0xb251('0x81')]));}}}if(_0x4c146a[_0xb251('0x82')]){_0x4c146a[_0xb251('0x82')]=JSON[_0xb251('0x7d')](_0x4c146a[_0xb251('0x82')]);_0x96e773[_0xb251('0x40')](_0x1d48ef(_0x4c146a[_0xb251('0x82')][_0xb251('0x6b')]));}_0x28af3c=_0x96e773[_0xb251('0x83')]();_0x96e773[_0xb251('0x21')](_0x1a582d);_0x96e773[_0xb251('0x20')](0x0);logger[_0xb251('0x84')](_0xb251('0x85'),_0x96e773[_0xb251('0x86')]());return db['sequelize'][_0xb251('0x35')](_0x96e773[_0xb251('0x86')](),{'type':db[_0xb251('0x87')][_0xb251('0x90')][_0xb251('0x88')]});}})[_0xb251('0x28')](function(){return{'sql':_0x28af3c['toString']()};})[_0xb251('0x28')](respondWithResult(_0x46f080,null))['catch'](handleError(_0x46f080,null));}; \ No newline at end of file +var _0xe4c1=['field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','replace','function','format','orderBy','order','DESC','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','COUNT(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','IS\x20EMPTY','value','groupBy','parse','clone','SELECT','No\x20available\x20data','output','web','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','countTable','COUNT(*)','run','runReport','IS\x20NOT\x20EMPTY','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','DefaultReports','params','left_join','right_join','cross_join','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group'];(function(_0x42df58,_0x3c24e7){var _0x5e6985=function(_0x15c9ba){while(--_0x15c9ba){_0x42df58['push'](_0x42df58['shift']());}};_0x5e6985(++_0x3c24e7);}(_0xe4c1,0x191));var _0x1e4c=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xe4c1[_0x101e7b];return _0x4995c0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1e4c('0x0'));var rimraf=require(_0x1e4c('0x1'));var zipdir=require(_0x1e4c('0x2'));var jsonpatch=require(_0x1e4c('0x3'));var rp=require(_0x1e4c('0x4'));var moment=require(_0x1e4c('0x5'));var BPromise=require(_0x1e4c('0x6'));var Mustache=require(_0x1e4c('0x7'));var util=require(_0x1e4c('0x8'));var path=require(_0x1e4c('0x9'));var sox=require(_0x1e4c('0xa'));var csv=require(_0x1e4c('0xb'));var ejs=require(_0x1e4c('0xc'));var fs=require('fs');var _=require(_0x1e4c('0xd'));var squel=require('squel');var crypto=require(_0x1e4c('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1e4c('0xb'));var querystring=require(_0x1e4c('0xf'));var Papa=require(_0x1e4c('0x10'));var Redis=require('ioredis');var authService=require(_0x1e4c('0x11'));var qs=require(_0x1e4c('0x12'));var as=require(_0x1e4c('0x13'));var hardwareService=require(_0x1e4c('0x14'));var logger=require(_0x1e4c('0x15'))(_0x1e4c('0x16'));var utils=require(_0x1e4c('0x17'));var config=require('../../config/environment');var db=require(_0x1e4c('0x18'))['db'];var dbH=require(_0x1e4c('0x18'))[_0x1e4c('0x19')];function respondWithStatusCode(_0x1c8bed,_0x4bf54d){_0x4bf54d=_0x4bf54d||0xcc;return function(_0x2642de){if(_0x2642de){return _0x1c8bed['sendStatus'](_0x4bf54d);}return _0x1c8bed[_0x1e4c('0x1a')](_0x4bf54d)[_0x1e4c('0x1b')]();};}function respondWithResult(_0x3506f0,_0x196a39){_0x196a39=_0x196a39||0xc8;return function(_0xe33d3b){if(_0xe33d3b){return _0x3506f0[_0x1e4c('0x1a')](_0x196a39)[_0x1e4c('0x1c')](_0xe33d3b);}};}function respondWithFilteredResult(_0x147f8a,_0x46f1ab){return function(_0x39f9fc){if(_0x39f9fc){var _0x2dd9ce=_0x39f9fc[_0x1e4c('0x1d')],_0xc77c04=_0x46f1ab[_0x1e4c('0x1e')],_0x5b653a=_0x46f1ab['offset']+_0x46f1ab[_0x1e4c('0x1f')],_0x1104a5;if(_0x5b653a>=_0x2dd9ce){_0x5b653a=_0x2dd9ce;_0x1104a5=0xc8;}else{_0x1104a5=0xce;}_0x147f8a[_0x1e4c('0x1a')](_0x1104a5);return _0x147f8a[_0x1e4c('0x20')](_0x1e4c('0x21'),_0xc77c04+'-'+_0x5b653a+'/'+_0x2dd9ce)[_0x1e4c('0x1c')](_0x39f9fc);}return null;};}function patchUpdates(_0x3b624b){return function(_0x2ed0a5){try{jsonpatch[_0x1e4c('0x22')](_0x2ed0a5,_0x3b624b,!![]);}catch(_0x15c216){return BPromise[_0x1e4c('0x23')](_0x15c216);}return _0x2ed0a5[_0x1e4c('0x24')]();};}function saveUpdates(_0x52e9d6,_0x2bc2c6){return function(_0x1e40ac){if(_0x1e40ac){return _0x1e40ac[_0x1e4c('0x25')](_0x52e9d6)[_0x1e4c('0x26')](function(_0x1320c1){return _0x1320c1;});}return null;};}function removeEntity(_0x153013,_0x5d3b43){return function(_0xd38fe4){if(_0xd38fe4){return _0xd38fe4[_0x1e4c('0x27')]()['then'](function(){var _0x1e3eaf=_0xd38fe4[_0x1e4c('0x28')]({'plain':!![]});var _0x5bc53e='DefaultReports';return db[_0x1e4c('0x29')][_0x1e4c('0x27')]({'where':{'type':_0x5bc53e,'resourceId':_0x1e3eaf['id']}})[_0x1e4c('0x26')](function(){return _0xd38fe4;});})[_0x1e4c('0x26')](function(){_0x153013[_0x1e4c('0x1a')](0xcc)[_0x1e4c('0x1b')]();});}};}function handleEntityNotFound(_0x5ca4d7,_0x58cbdd){return function(_0x34e087){if(!_0x34e087){_0x5ca4d7['sendStatus'](0x194);}return _0x34e087;};}function handleError(_0x53784f,_0x59bf73){_0x59bf73=_0x59bf73||0x1f4;return function(_0x4ca11c){logger[_0x1e4c('0x2a')](_0x4ca11c[_0x1e4c('0x2b')]);if(_0x4ca11c[_0x1e4c('0x2c')]){delete _0x4ca11c[_0x1e4c('0x2c')];}_0x53784f['status'](_0x59bf73)[_0x1e4c('0x2d')](_0x4ca11c);};}exports[_0x1e4c('0x2e')]=function(_0x4c2ba4,_0x408cab){var _0x52f34d={},_0x407225={},_0x16e01a={'count':0x0,'rows':[]};var _0x1c4a5f=_[_0x1e4c('0x2f')](db[_0x1e4c('0x30')][_0x1e4c('0x31')],function(_0x2d0981){return{'name':_0x2d0981[_0x1e4c('0x32')],'type':_0x2d0981[_0x1e4c('0x33')][_0x1e4c('0x34')]};});_0x407225[_0x1e4c('0x35')]=_['map'](_0x1c4a5f,_0x1e4c('0x2c'));_0x407225[_0x1e4c('0x36')]=_['keys'](_0x4c2ba4[_0x1e4c('0x36')]);_0x407225[_0x1e4c('0x37')]=_[_0x1e4c('0x38')](_0x407225[_0x1e4c('0x35')],_0x407225[_0x1e4c('0x36')]);_0x52f34d[_0x1e4c('0x39')]=_[_0x1e4c('0x38')](_0x407225['model'],qs['fields'](_0x4c2ba4[_0x1e4c('0x36')][_0x1e4c('0x3a')]));_0x52f34d[_0x1e4c('0x39')]=_0x52f34d[_0x1e4c('0x39')][_0x1e4c('0x3b')]?_0x52f34d['attributes']:_0x407225['model'];if(!_0x4c2ba4[_0x1e4c('0x36')]['hasOwnProperty'](_0x1e4c('0x3c'))){_0x52f34d[_0x1e4c('0x1f')]=qs[_0x1e4c('0x1f')](_0x4c2ba4[_0x1e4c('0x36')][_0x1e4c('0x1f')]);_0x52f34d[_0x1e4c('0x1e')]=qs['offset'](_0x4c2ba4[_0x1e4c('0x36')]['offset']);}_0x52f34d['order']=qs['sort'](_0x4c2ba4['query'][_0x1e4c('0x3d')]);_0x52f34d[_0x1e4c('0x3e')]=qs[_0x1e4c('0x37')](_[_0x1e4c('0x3f')](_0x4c2ba4['query'],_0x407225[_0x1e4c('0x37')]),_0x1c4a5f);if(_0x4c2ba4[_0x1e4c('0x36')][_0x1e4c('0x40')]){_0x52f34d['where']=_[_0x1e4c('0x41')](_0x52f34d[_0x1e4c('0x3e')],{'$or':_[_0x1e4c('0x2f')](_0x1c4a5f,function(_0x2e49d3){if(_0x2e49d3['type']!==_0x1e4c('0x42')){var _0x4c4943={};_0x4c4943[_0x2e49d3[_0x1e4c('0x2c')]]={'$like':'%'+_0x4c2ba4['query'][_0x1e4c('0x40')]+'%'};return _0x4c4943;}})});}_0x52f34d=_[_0x1e4c('0x41')]({},_0x52f34d,_0x4c2ba4[_0x1e4c('0x43')]);var _0x4c81ad={'where':_0x52f34d['where']};return db['AnalyticDefaultReport'][_0x1e4c('0x1d')](_0x4c81ad)[_0x1e4c('0x26')](function(_0x128117){_0x16e01a[_0x1e4c('0x1d')]=_0x128117;if(_0x4c2ba4['query'][_0x1e4c('0x44')]){_0x52f34d[_0x1e4c('0x45')]=[{'all':!![]}];}return db[_0x1e4c('0x30')][_0x1e4c('0x46')](_0x52f34d);})[_0x1e4c('0x26')](function(_0x267891){_0x16e01a[_0x1e4c('0x47')]=_0x267891;return _0x16e01a;})[_0x1e4c('0x26')](respondWithFilteredResult(_0x408cab,_0x52f34d))[_0x1e4c('0x48')](handleError(_0x408cab,null));};exports['show']=function(_0x156d44,_0x526816){var _0x475a3c={'raw':!![],'where':{'id':_0x156d44['params']['id']}},_0x4c3427={};_0x4c3427[_0x1e4c('0x35')]=_[_0x1e4c('0x49')](db['AnalyticDefaultReport'][_0x1e4c('0x31')]);_0x4c3427[_0x1e4c('0x36')]=_['keys'](_0x156d44['query']);_0x4c3427[_0x1e4c('0x37')]=_['intersection'](_0x4c3427[_0x1e4c('0x35')],_0x4c3427[_0x1e4c('0x36')]);_0x475a3c[_0x1e4c('0x39')]=_[_0x1e4c('0x38')](_0x4c3427[_0x1e4c('0x35')],qs[_0x1e4c('0x3a')](_0x156d44[_0x1e4c('0x36')][_0x1e4c('0x3a')]));_0x475a3c['attributes']=_0x475a3c[_0x1e4c('0x39')][_0x1e4c('0x3b')]?_0x475a3c[_0x1e4c('0x39')]:_0x4c3427[_0x1e4c('0x35')];if(_0x156d44[_0x1e4c('0x36')][_0x1e4c('0x44')]){_0x475a3c[_0x1e4c('0x45')]=[{'all':!![]}];}_0x475a3c=_[_0x1e4c('0x41')]({},_0x475a3c,_0x156d44[_0x1e4c('0x43')]);return db['AnalyticDefaultReport'][_0x1e4c('0x4a')](_0x475a3c)[_0x1e4c('0x26')](handleEntityNotFound(_0x526816,null))['then'](respondWithResult(_0x526816,null))[_0x1e4c('0x48')](handleError(_0x526816,null));};exports['create']=function(_0x58f772,_0x380b9d){return db['AnalyticDefaultReport'][_0x1e4c('0x4b')](_0x58f772[_0x1e4c('0x4c')],{})[_0x1e4c('0x26')](function(_0x52eb8d){var _0x2f1023=_0x58f772[_0x1e4c('0x4d')][_0x1e4c('0x28')]({'plain':!![]});if(!_0x2f1023)throw new Error(_0x1e4c('0x4e'));if(_0x2f1023[_0x1e4c('0x4f')]===_0x1e4c('0x4d')){var _0x10ee40=_0x52eb8d[_0x1e4c('0x28')]({'plain':!![]});var _0x54247a=_0x1e4c('0x50');return db['UserProfileSection'][_0x1e4c('0x4a')]({'where':{'name':_0x54247a,'userProfileId':_0x2f1023[_0x1e4c('0x51')]},'raw':!![]})['then'](function(_0x133d6e){if(_0x133d6e&&_0x133d6e[_0x1e4c('0x52')]===0x0){return db[_0x1e4c('0x29')]['create']({'name':_0x10ee40[_0x1e4c('0x2c')],'resourceId':_0x10ee40['id'],'type':_0x1e4c('0x53'),'sectionId':_0x133d6e['id']},{})['then'](function(){return _0x52eb8d;});}else{return _0x52eb8d;}})[_0x1e4c('0x48')](function(_0x303e27){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x303e27);throw _0x303e27;});}return _0x52eb8d;})[_0x1e4c('0x26')](respondWithResult(_0x380b9d,0xc9))['catch'](handleError(_0x380b9d,null));};exports['update']=function(_0x37f106,_0x36d214){if(_0x37f106[_0x1e4c('0x4c')]['id']){delete _0x37f106[_0x1e4c('0x4c')]['id'];}return db[_0x1e4c('0x30')]['find']({'where':{'id':_0x37f106[_0x1e4c('0x54')]['id']}})[_0x1e4c('0x26')](handleEntityNotFound(_0x36d214,null))[_0x1e4c('0x26')](saveUpdates(_0x37f106[_0x1e4c('0x4c')],null))[_0x1e4c('0x26')](respondWithResult(_0x36d214,null))[_0x1e4c('0x48')](handleError(_0x36d214,null));};exports[_0x1e4c('0x27')]=function(_0x402df3,_0x4b8c34){return db[_0x1e4c('0x30')]['find']({'where':{'id':_0x402df3[_0x1e4c('0x54')]['id']}})['then'](handleEntityNotFound(_0x4b8c34,null))[_0x1e4c('0x26')](removeEntity(_0x4b8c34,null))[_0x1e4c('0x48')](handleError(_0x4b8c34,null));};exports['preview']=function(_0x5b2f03,_0x4ab0f3){var _0x4be10d=0xa;var _0x31ae28=['join',_0x1e4c('0x55'),_0x1e4c('0x56'),_0x1e4c('0x57')];var _0x375749={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x1e4c('0x58'),'MIN':_0x1e4c('0x59'),'AVG':_0x1e4c('0x5a'),'GROUP_CONCAT':_0x1e4c('0x5b'),'GROUP_CONCAT ASC':_0x1e4c('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x24cc9b={'SEC_TO_TIME':_0x1e4c('0x5d'),'DATE':_0x1e4c('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x1e4c('0x5f'),'UNIX_TIMESTAMP':_0x1e4c('0x60')};var _0x4f9a38=function(_0x2e3ed5){return!_[_0x1e4c('0x61')]([_0x1e4c('0x62'),_0x1e4c('0x63'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x2e3ed5);};var _0x44e00b=function(_0x33953a){if(!_0x33953a||!_0x33953a[_0x1e4c('0x64')][_0x1e4c('0x3b')]){return'';}for(var _0x49acc9='(',_0x58f0b2=0x0;_0x58f0b2<_0x33953a[_0x1e4c('0x64')][_0x1e4c('0x3b')];_0x58f0b2+=0x1){_0x58f0b2>0x0&&(_0x49acc9+='\x20'+_0x33953a[_0x1e4c('0x65')]+'\x20');_0x49acc9+=_0x33953a[_0x1e4c('0x64')][_0x58f0b2][_0x1e4c('0x66')]?_0x44e00b(_0x33953a[_0x1e4c('0x64')][_0x58f0b2][_0x1e4c('0x66')]):_0x33953a[_0x1e4c('0x64')][_0x58f0b2][_0x1e4c('0x67')]+'\x20'+_0x33953a[_0x1e4c('0x64')][_0x58f0b2]['condition']+(_0x4f9a38(_0x33953a[_0x1e4c('0x64')][_0x58f0b2][_0x1e4c('0x68')])?'\x20'+_0x33953a['rules'][_0x58f0b2]['value']:'');}return _0x49acc9+')';};var _0x565d10={'where':{'id':_0x5b2f03[_0x1e4c('0x54')]['id']}},_0x3b0077,_0x2d2546,_0x22b64f,_0x344eee,_0x123fb2;_0x565d10=_[_0x1e4c('0x41')]({},_0x565d10,_0x5b2f03[_0x1e4c('0x43')]);return db[_0x1e4c('0x30')][_0x1e4c('0x4a')](_0x565d10)[_0x1e4c('0x26')](function(_0x390af0){if(_0x390af0){_0x3b0077=_0x390af0;return _0x390af0[_0x1e4c('0x69')]();}return null;})[_0x1e4c('0x26')](function(_0x81b338){if(_0x81b338){if(!_0x81b338[_0x1e4c('0x3b')]){throw new db[(_0x1e4c('0x6a'))][(_0x1e4c('0x6b'))](_0x1e4c('0x6c'),0x193);}_0x2d2546=_0x81b338;return db[_0x1e4c('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x1e4c('0x26')](function(_0x552090){if(_0x552090){_0x22b64f=_[_0x1e4c('0x6e')](_0x552090,'id');var _0x1bf232;var _0x257d72=squel['select']();_0x257d72[_0x1e4c('0x6f')](_0x3b0077['table']);for(var _0x4a7ba6=0x0;_0x4a7ba6<_0x2d2546[_0x1e4c('0x3b')];_0x4a7ba6+=0x1){_0x1bf232=_0x2d2546[_0x4a7ba6]['MetricId']?_0x22b64f[_0x2d2546[_0x4a7ba6][_0x1e4c('0x70')]][_0x1e4c('0x71')]:_0x2d2546[_0x4a7ba6]['field'];_0x1bf232=_0x2d2546[_0x4a7ba6]['function']?_[_0x1e4c('0x72')](_0x375749[_0x2d2546[_0x4a7ba6][_0x1e4c('0x73')]],'%s',_0x1bf232):_0x1bf232;_0x1bf232=_0x2d2546[_0x4a7ba6][_0x1e4c('0x74')]?_[_0x1e4c('0x72')](_0x24cc9b[_0x2d2546[_0x4a7ba6][_0x1e4c('0x74')]],'%s',_0x1bf232):_0x1bf232;if(_0x2d2546[_0x4a7ba6]['groupBy']){_0x257d72['group'](_0x1bf232);}_0x2d2546[_0x4a7ba6][_0x1e4c('0x75')]&&_0x257d72[_0x1e4c('0x76')](_0x1bf232,_0x2d2546[_0x4a7ba6][_0x1e4c('0x75')]===_0x1e4c('0x77')?![]:!![]);_0x257d72[_0x1e4c('0x67')](_0x1bf232,_0x2d2546[_0x4a7ba6][_0x1e4c('0x78')]||_0x1bf232);}if(_0x3b0077[_0x1e4c('0x79')]){_0x3b0077[_0x1e4c('0x79')]=JSON['parse'](_0x3b0077['joins']);for(var _0x4860b6=0x0;_0x4860b6<_0x3b0077[_0x1e4c('0x79')]['length'];_0x4860b6+=0x1){if(_0x3b0077['joins'][_0x4860b6]['type']&&_[_0x1e4c('0x61')](_0x31ae28,_0x3b0077[_0x1e4c('0x79')][_0x4860b6]['type'])&&_0x3b0077[_0x1e4c('0x79')][_0x4860b6]['parentKey']&&_0x3b0077[_0x1e4c('0x79')][_0x4860b6][_0x1e4c('0x7a')]&&_0x3b0077[_0x1e4c('0x79')][_0x4860b6][_0x1e4c('0x7b')]){_0x257d72[_0x3b0077['joins'][_0x4860b6][_0x1e4c('0x33')]](_0x3b0077['joins'][_0x4860b6][_0x1e4c('0x7a')],null,util[_0x1e4c('0x74')](_0x1e4c('0x7c'),_0x3b0077[_0x1e4c('0x7d')],_0x3b0077['joins'][_0x4860b6][_0x1e4c('0x7e')],_0x3b0077[_0x1e4c('0x79')][_0x4860b6][_0x1e4c('0x7a')],_0x3b0077[_0x1e4c('0x79')][_0x4860b6][_0x1e4c('0x7b')]));}}}if(_0x3b0077[_0x1e4c('0x7f')]){_0x3b0077['conditions']=JSON['parse'](_0x3b0077['conditions']);_0x257d72[_0x1e4c('0x3e')](_0x44e00b(_0x3b0077['conditions'][_0x1e4c('0x66')]));}_0x123fb2=_0x257d72['clone']();_0x257d72['limit'](_0x4be10d);_0x257d72[_0x1e4c('0x1e')](0x0);logger[_0x1e4c('0x80')](_0x1e4c('0x81'),_0x257d72[_0x1e4c('0x82')]());return db[_0x1e4c('0x83')][_0x1e4c('0x36')](_0x257d72[_0x1e4c('0x82')](),{'type':db[_0x1e4c('0x83')][_0x1e4c('0x84')]['SELECT']});}})[_0x1e4c('0x26')](respondWithResult(_0x4ab0f3,null))['catch'](handleError(_0x4ab0f3,null));};function runReport(_0x298bd4,_0x3166be,_0x44aa08){var _0x52b83f=_0x3166be[_0x1e4c('0x2c')];var _0x2f2ec9=0xa;var _0xac4012=[_0x1e4c('0x85'),_0x1e4c('0x55'),_0x1e4c('0x56'),_0x1e4c('0x57')];var _0x5515f3={'SUM':'SUM(%s)','COUNT':_0x1e4c('0x86'),'COUNT DISTINCT':_0x1e4c('0x87'),'MAX':'MAX(%s)','MIN':_0x1e4c('0x59'),'AVG':_0x1e4c('0x5a'),'GROUP_CONCAT':_0x1e4c('0x5b'),'GROUP_CONCAT ASC':_0x1e4c('0x5c'),'GROUP_CONCAT DESC':_0x1e4c('0x88')};var _0x21b3df={'SEC_TO_TIME':_0x1e4c('0x5d'),'DATE':_0x1e4c('0x5e'),'HOUR':_0x1e4c('0x89'),'ROUND':_0x1e4c('0x5f'),'UNIX_TIMESTAMP':_0x1e4c('0x60')};var _0x2c5cac=function(_0x580c62){return!_['includes']([_0x1e4c('0x62'),_0x1e4c('0x63'),_0x1e4c('0x8a'),'IS\x20NOT\x20EMPTY'],_0x580c62);};var _0x3a2e4e=function(_0x45bb37){if(!_0x45bb37||!_0x45bb37['rules']['length']){return'';}for(var _0x28bc15='(',_0x55d5ff=0x0;_0x55d5ff<_0x45bb37[_0x1e4c('0x64')][_0x1e4c('0x3b')];_0x55d5ff+=0x1){_0x55d5ff>0x0&&(_0x28bc15+='\x20'+_0x45bb37[_0x1e4c('0x65')]+'\x20');_0x28bc15+=_0x45bb37[_0x1e4c('0x64')][_0x55d5ff]['group']?_0x3a2e4e(_0x45bb37[_0x1e4c('0x64')][_0x55d5ff][_0x1e4c('0x66')]):_0x45bb37[_0x1e4c('0x64')][_0x55d5ff]['field']+'\x20'+_0x45bb37['rules'][_0x55d5ff][_0x1e4c('0x68')]+(_0x2c5cac(_0x45bb37[_0x1e4c('0x64')][_0x55d5ff][_0x1e4c('0x68')])?'\x20'+_0x45bb37[_0x1e4c('0x64')][_0x55d5ff][_0x1e4c('0x8b')]:'');}return _0x28bc15+')';};var _0x45b376={'where':{'id':_0x298bd4['id']}},_0x39fb33,_0x29d7db,_0x2b4794,_0x323600,_0x2dd1bd;_0x45b376=_['merge']({},_0x45b376,_0x44aa08);return db[_0x1e4c('0x30')][_0x1e4c('0x4a')](_0x45b376)[_0x1e4c('0x26')](function(_0x15241c){if(_0x15241c){_0x39fb33=_0x15241c;return _0x15241c[_0x1e4c('0x69')]();}return null;})[_0x1e4c('0x26')](function(_0x12c58e){if(_0x12c58e){if(!_0x12c58e[_0x1e4c('0x3b')]){throw new db[(_0x1e4c('0x6a'))][(_0x1e4c('0x6b'))](_0x1e4c('0x6c'),0x193);}_0x29d7db=_0x12c58e;return db[_0x1e4c('0x6d')][_0x1e4c('0x46')]({'raw':!![]});}return null;})[_0x1e4c('0x26')](function(_0x2fecd4){if(_0x2fecd4){_0x2b4794=_['keyBy'](_0x2fecd4,'id');var _0x1e852c;var _0x20bb7a=squel['select']();_0x20bb7a[_0x1e4c('0x6f')](_0x39fb33[_0x1e4c('0x7d')]);for(var _0x43f333=0x0;_0x43f333<_0x29d7db[_0x1e4c('0x3b')];_0x43f333+=0x1){_0x1e852c=_0x29d7db[_0x43f333][_0x1e4c('0x70')]?_0x2b4794[_0x29d7db[_0x43f333][_0x1e4c('0x70')]]['metric']:_0x29d7db[_0x43f333][_0x1e4c('0x67')];_0x1e852c=_0x29d7db[_0x43f333][_0x1e4c('0x73')]?_[_0x1e4c('0x72')](_0x5515f3[_0x29d7db[_0x43f333]['function']],'%s',_0x1e852c):_0x1e852c;_0x1e852c=_0x29d7db[_0x43f333][_0x1e4c('0x74')]?_[_0x1e4c('0x72')](_0x21b3df[_0x29d7db[_0x43f333][_0x1e4c('0x74')]],'%s',_0x1e852c):_0x1e852c;if(_0x29d7db[_0x43f333][_0x1e4c('0x8c')]){_0x20bb7a[_0x1e4c('0x66')](_0x1e852c);}_0x29d7db[_0x43f333]['orderBy']&&_0x20bb7a[_0x1e4c('0x76')](_0x1e852c,_0x29d7db[_0x43f333][_0x1e4c('0x75')]===_0x1e4c('0x77')?![]:!![]);_0x20bb7a[_0x1e4c('0x67')](_0x1e852c,_0x29d7db[_0x43f333][_0x1e4c('0x78')]||_0x1e852c);}if(_0x39fb33[_0x1e4c('0x79')]){_0x39fb33[_0x1e4c('0x79')]=JSON[_0x1e4c('0x8d')](_0x39fb33['joins']);for(var _0x3ed6e4=0x0;_0x3ed6e4<_0x39fb33[_0x1e4c('0x79')][_0x1e4c('0x3b')];_0x3ed6e4+=0x1){if(_0x39fb33['joins'][_0x3ed6e4][_0x1e4c('0x33')]&&_[_0x1e4c('0x61')](_0xac4012,_0x39fb33[_0x1e4c('0x79')][_0x3ed6e4][_0x1e4c('0x33')])&&_0x39fb33[_0x1e4c('0x79')][_0x3ed6e4][_0x1e4c('0x7e')]&&_0x39fb33['joins'][_0x3ed6e4][_0x1e4c('0x7a')]&&_0x39fb33[_0x1e4c('0x79')][_0x3ed6e4]['foreignKey']){_0x20bb7a[_0x39fb33[_0x1e4c('0x79')][_0x3ed6e4][_0x1e4c('0x33')]](_0x39fb33['joins'][_0x3ed6e4][_0x1e4c('0x7a')],null,util['format'](_0x1e4c('0x7c'),_0x39fb33[_0x1e4c('0x7d')],_0x39fb33['joins'][_0x3ed6e4][_0x1e4c('0x7e')],_0x39fb33[_0x1e4c('0x79')][_0x3ed6e4][_0x1e4c('0x7a')],_0x39fb33[_0x1e4c('0x79')][_0x3ed6e4][_0x1e4c('0x7b')]));}}}if(_0x39fb33['conditions']){_0x39fb33[_0x1e4c('0x7f')]=JSON['parse'](_0x39fb33[_0x1e4c('0x7f')]);_0x20bb7a[_0x1e4c('0x3e')](_0x3a2e4e(_0x39fb33[_0x1e4c('0x7f')][_0x1e4c('0x66')]));}_0x2dd1bd=_0x20bb7a[_0x1e4c('0x8e')]();_0x20bb7a[_0x1e4c('0x1f')](_0x2f2ec9);_0x20bb7a[_0x1e4c('0x1e')](0x0);logger[_0x1e4c('0x80')](_0x1e4c('0x81'),_0x20bb7a[_0x1e4c('0x82')]());return db['sequelize']['query'](_0x20bb7a[_0x1e4c('0x82')](),{'type':db[_0x1e4c('0x83')][_0x1e4c('0x84')][_0x1e4c('0x8f')]});}})[_0x1e4c('0x26')](function(_0x1b38e3){if(!_0x1b38e3[_0x1e4c('0x3b')]){throw new db[(_0x1e4c('0x6a'))][(_0x1e4c('0x6b'))](_0x1e4c('0x90'),0xcc);}if(_0x3166be[_0x1e4c('0x91')]===_0x1e4c('0x92')){return null;}var _0x4f2b8c=_[_0x1e4c('0x41')](_0x3166be,{'name':_0x3166be['fullPath']||_0x3166be[_0x1e4c('0x2c')]||_0x39fb33['name'],'basename':_0x52b83f,'savename':util[_0x1e4c('0x74')](_0x1e4c('0x93'),_0x3166be['name']||_0x39fb33[_0x1e4c('0x2c')],require(_0x1e4c('0x94'))[_0x1e4c('0x95')](0x4),_0x3166be['output']||'csv'),'reportId':_0x39fb33['id'],'reportType':_0x1e4c('0x96')});return db[_0x1e4c('0x97')]['create'](_0x4f2b8c,{'raw':!![]});})[_0x1e4c('0x26')](function(_0x55c3c6){if(_0x39fb33[_0x1e4c('0x7d')]===_0x1e4c('0x98')){_0x2dd1bd['where'](_0x39fb33[_0x1e4c('0x7d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3166be[_0x1e4c('0x99')],_0x3166be[_0x1e4c('0x9a')]);}else{_0x2dd1bd[_0x1e4c('0x3e')](_0x39fb33['table']+_0x1e4c('0x9b'),_0x3166be[_0x1e4c('0x99')],_0x3166be[_0x1e4c('0x9a')]);}if(_0x55c3c6){logger['info'](_0x1e4c('0x9c'),_0x2dd1bd[_0x1e4c('0x82')]());require(_0x1e4c('0x9d'))[_0x1e4c('0x9e')](path[_0x1e4c('0x85')](__dirname,_0x1e4c('0x9f'),_0x55c3c6[_0x1e4c('0x91')]),[_0x55c3c6['id'],_0x2dd1bd[_0x1e4c('0x82')](),path['join'](__dirname,_0x1e4c('0xa0'),_0x55c3c6[_0x1e4c('0xa1')]),_0x52b83f]);return _0x55c3c6;}else{var _0x13fc8c=squel[_0x1e4c('0xa2')]();_0x13fc8c[_0x1e4c('0x6f')]('('+_0x2dd1bd[_0x1e4c('0x82')]()+')',_0x1e4c('0xa3'));_0x13fc8c[_0x1e4c('0x67')](_0x1e4c('0xa4'),_0x1e4c('0x1d'));_0x2dd1bd[_0x1e4c('0x1f')](_0x3166be[_0x1e4c('0x1f')]||_0x2f2ec9);_0x2dd1bd[_0x1e4c('0x1e')](_0x3166be[_0x1e4c('0x1e')]||0x0);return dbH[_0x1e4c('0x83')][_0x1e4c('0x36')](_0x13fc8c[_0x1e4c('0x82')](),{'type':dbH[_0x1e4c('0x83')]['QueryTypes']['SELECT']})[_0x1e4c('0x26')](function(_0x871ad){if(!_0x871ad[_0x1e4c('0x3b')]){_0x323600=0x0;}else{_0x323600=_0x871ad[0x0][_0x1e4c('0x1d')]||0x0;}return dbH[_0x1e4c('0x83')][_0x1e4c('0x36')](_0x2dd1bd['toString'](),{'type':dbH[_0x1e4c('0x83')][_0x1e4c('0x84')][_0x1e4c('0x8f')]});})[_0x1e4c('0x26')](function(_0x58d976){return{'rows':_0x58d976||[],'count':_0x323600};});}});}exports[_0x1e4c('0xa5')]=function(_0x36c2b1,_0x3d1b66){return runReport(_0x36c2b1[_0x1e4c('0x54')],_0x36c2b1[_0x1e4c('0x36')],_0x36c2b1[_0x1e4c('0x43')])[_0x1e4c('0x26')](respondWithResult(_0x3d1b66,null))[_0x1e4c('0x48')](handleError(_0x3d1b66,null));};exports[_0x1e4c('0xa6')]=runReport;exports[_0x1e4c('0x36')]=function(_0x45ef5a,_0x54dbb2){var _0x5830ae=0xa;var _0x2c357c=[_0x1e4c('0x85'),_0x1e4c('0x55'),'right_join',_0x1e4c('0x57')];var _0x1eda5b={'SUM':'SUM(%s)','COUNT':_0x1e4c('0x86'),'COUNT DISTINCT':_0x1e4c('0x87'),'MAX':_0x1e4c('0x58'),'MIN':_0x1e4c('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1e4c('0x5b'),'GROUP_CONCAT ASC':_0x1e4c('0x5c'),'GROUP_CONCAT DESC':_0x1e4c('0x88')};var _0x25def0={'SEC_TO_TIME':_0x1e4c('0x5d'),'DATE':_0x1e4c('0x5e'),'HOUR':_0x1e4c('0x89'),'ROUND':_0x1e4c('0x5f'),'UNIX_TIMESTAMP':_0x1e4c('0x60')};var _0x5b8f6e=function(_0x130dc7){return!_[_0x1e4c('0x61')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x1e4c('0x8a'),_0x1e4c('0xa7')],_0x130dc7);};var _0x5c72a4=function(_0x5c26f8){if(!_0x5c26f8||!_0x5c26f8[_0x1e4c('0x64')][_0x1e4c('0x3b')]){return'';}for(var _0x2a5459='(',_0x228505=0x0;_0x228505<_0x5c26f8[_0x1e4c('0x64')][_0x1e4c('0x3b')];_0x228505+=0x1){_0x228505>0x0&&(_0x2a5459+='\x20'+_0x5c26f8[_0x1e4c('0x65')]+'\x20');_0x2a5459+=_0x5c26f8[_0x1e4c('0x64')][_0x228505][_0x1e4c('0x66')]?_0x5c72a4(_0x5c26f8[_0x1e4c('0x64')][_0x228505][_0x1e4c('0x66')]):_0x5c26f8['rules'][_0x228505][_0x1e4c('0x67')]+'\x20'+_0x5c26f8['rules'][_0x228505]['condition']+(_0x5b8f6e(_0x5c26f8[_0x1e4c('0x64')][_0x228505]['condition'])?'\x20'+_0x5c26f8[_0x1e4c('0x64')][_0x228505][_0x1e4c('0x8b')]:'');}return _0x2a5459+')';};var _0x8135be={'where':{'id':_0x45ef5a[_0x1e4c('0x54')]['id']}},_0x389fd0,_0x25779b,_0xd62543,_0x5a3552,_0x5762b9;_0x8135be=_['merge']({},_0x8135be,_0x45ef5a[_0x1e4c('0x43')]);return db[_0x1e4c('0x30')][_0x1e4c('0x4a')](_0x8135be)[_0x1e4c('0x26')](function(_0x590bb4){if(_0x590bb4){_0x389fd0=_0x590bb4;return _0x590bb4[_0x1e4c('0x69')]();}return null;})[_0x1e4c('0x26')](function(_0x27de43){if(_0x27de43){if(!_0x27de43['length']){throw new db['Sequelize'][(_0x1e4c('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x25779b=_0x27de43;return db[_0x1e4c('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x1e4c('0x26')](function(_0x1425b1){if(_0x1425b1){_0xd62543=_[_0x1e4c('0x6e')](_0x1425b1,'id');var _0x1e608f;var _0x5c638c=squel[_0x1e4c('0xa2')]();_0x5c638c[_0x1e4c('0x6f')](_0x389fd0['table']);for(var _0x2b3bda=0x0;_0x2b3bda<_0x25779b[_0x1e4c('0x3b')];_0x2b3bda+=0x1){_0x1e608f=_0x25779b[_0x2b3bda][_0x1e4c('0x70')]?_0xd62543[_0x25779b[_0x2b3bda][_0x1e4c('0x70')]][_0x1e4c('0x71')]:_0x25779b[_0x2b3bda][_0x1e4c('0x67')];_0x1e608f=_0x25779b[_0x2b3bda][_0x1e4c('0x73')]?_['replace'](_0x1eda5b[_0x25779b[_0x2b3bda]['function']],'%s',_0x1e608f):_0x1e608f;_0x1e608f=_0x25779b[_0x2b3bda][_0x1e4c('0x74')]?_['replace'](_0x25def0[_0x25779b[_0x2b3bda][_0x1e4c('0x74')]],'%s',_0x1e608f):_0x1e608f;if(_0x25779b[_0x2b3bda][_0x1e4c('0x8c')]){_0x5c638c['group'](_0x1e608f);}_0x25779b[_0x2b3bda]['orderBy']&&_0x5c638c[_0x1e4c('0x76')](_0x1e608f,_0x25779b[_0x2b3bda]['orderBy']==='DESC'?![]:!![]);_0x5c638c['field'](_0x1e608f,_0x25779b[_0x2b3bda][_0x1e4c('0x78')]||_0x1e608f);}if(_0x389fd0[_0x1e4c('0x79')]){_0x389fd0['joins']=JSON[_0x1e4c('0x8d')](_0x389fd0['joins']);for(var _0x4a38f1=0x0;_0x4a38f1<_0x389fd0[_0x1e4c('0x79')][_0x1e4c('0x3b')];_0x4a38f1+=0x1){if(_0x389fd0[_0x1e4c('0x79')][_0x4a38f1][_0x1e4c('0x33')]&&_[_0x1e4c('0x61')](_0x2c357c,_0x389fd0[_0x1e4c('0x79')][_0x4a38f1][_0x1e4c('0x33')])&&_0x389fd0[_0x1e4c('0x79')][_0x4a38f1][_0x1e4c('0x7e')]&&_0x389fd0[_0x1e4c('0x79')][_0x4a38f1][_0x1e4c('0x7a')]&&_0x389fd0[_0x1e4c('0x79')][_0x4a38f1][_0x1e4c('0x7b')]){_0x5c638c[_0x389fd0['joins'][_0x4a38f1][_0x1e4c('0x33')]](_0x389fd0[_0x1e4c('0x79')][_0x4a38f1][_0x1e4c('0x7a')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x389fd0[_0x1e4c('0x7d')],_0x389fd0[_0x1e4c('0x79')][_0x4a38f1]['parentKey'],_0x389fd0[_0x1e4c('0x79')][_0x4a38f1]['foreignTable'],_0x389fd0[_0x1e4c('0x79')][_0x4a38f1][_0x1e4c('0x7b')]));}}}if(_0x389fd0[_0x1e4c('0x7f')]){_0x389fd0[_0x1e4c('0x7f')]=JSON[_0x1e4c('0x8d')](_0x389fd0[_0x1e4c('0x7f')]);_0x5c638c[_0x1e4c('0x3e')](_0x5c72a4(_0x389fd0[_0x1e4c('0x7f')][_0x1e4c('0x66')]));}_0x5762b9=_0x5c638c[_0x1e4c('0x8e')]();_0x5c638c['limit'](_0x5830ae);_0x5c638c[_0x1e4c('0x1e')](0x0);logger[_0x1e4c('0x80')](_0x1e4c('0x81'),_0x5c638c[_0x1e4c('0x82')]());return db[_0x1e4c('0x83')][_0x1e4c('0x36')](_0x5c638c[_0x1e4c('0x82')](),{'type':db['sequelize']['QueryTypes']['SELECT']});}})['then'](function(){return{'sql':_0x5762b9[_0x1e4c('0x82')]()};})['then'](respondWithResult(_0x54dbb2,null))[_0x1e4c('0x48')](handleError(_0x54dbb2,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index b06db32..26cbc65 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 _0x3999=['api','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','../../config/logger'];(function(_0x453d76,_0x9982c8){var _0x3c53fb=function(_0x1dee0b){while(--_0x1dee0b){_0x453d76['push'](_0x453d76['shift']());}};_0x3c53fb(++_0x9982c8);}(_0x3999,0x18a));var _0x9399=function(_0x2e4125,_0x4038d7){_0x2e4125=_0x2e4125-0x0;var _0x149d5c=_0x3999[_0x2e4125];return _0x149d5c;};'use strict';var _=require(_0x9399('0x0'));var util=require('util');var logger=require(_0x9399('0x1'))(_0x9399('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9399('0x3'));var fs=require('fs');var path=require(_0x9399('0x4'));var rimraf=require(_0x9399('0x5'));var config=require(_0x9399('0x6'));var attributes=require(_0x9399('0x7'));module[_0x9399('0x8')]=function(_0xbe96e6,_0x82a508){return _0xbe96e6[_0x9399('0x9')]('AnalyticDefaultReport',attributes,{'tableName':_0x9399('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1671=['api','moment','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','util'];(function(_0x326d3b,_0x504059){var _0x4ae7a1=function(_0x3f995d){while(--_0x3f995d){_0x326d3b['push'](_0x326d3b['shift']());}};_0x4ae7a1(++_0x504059);}(_0x1671,0xfb));var _0x1167=function(_0x31d243,_0x2f8ae0){_0x31d243=_0x31d243-0x0;var _0x47159f=_0x1671[_0x31d243];return _0x47159f;};'use strict';var _=require(_0x1167('0x0'));var util=require(_0x1167('0x1'));var logger=require('../../config/logger')(_0x1167('0x2'));var moment=require(_0x1167('0x3'));var BPromise=require('bluebird');var rp=require(_0x1167('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1167('0x5'));var config=require(_0x1167('0x6'));var attributes=require(_0x1167('0x7'));module[_0x1167('0x8')]=function(_0x59fae4,_0x480d94){return _0x59fae4[_0x1167('0x9')]('AnalyticDefaultReport',attributes,{'tableName':_0x1167('0xa'),'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 eac382c..6320c7e 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 _0x4d6e=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x4d6e,0x77));var _0xe4d6=function(_0x572eea,_0x853014){_0x572eea=_0x572eea-0x0;var _0x3c8359=_0x4d6e[_0x572eea];return _0x3c8359;};'use strict';var _=require(_0xe4d6('0x0'));var util=require(_0xe4d6('0x1'));var moment=require(_0xe4d6('0x2'));var BPromise=require(_0xe4d6('0x3'));var rs=require(_0xe4d6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4d6('0x5'))['db'];var utils=require(_0xe4d6('0x6'));var logger=require(_0xe4d6('0x7'))(_0xe4d6('0x8'));var config=require(_0xe4d6('0x9'));var jayson=require(_0xe4d6('0xa'));var client=jayson[_0xe4d6('0xb')][_0xe4d6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x303058,_0x3e02bf,_0x352417){return new BPromise(function(_0xe683ad,_0x5a31f0){return client[_0xe4d6('0xd')](_0x303058,_0x352417)[_0xe4d6('0xe')](function(_0x56a295){logger[_0xe4d6('0xf')](_0xe4d6('0x10'),_0x3e02bf,_0xe4d6('0x11'));logger[_0xe4d6('0x12')](_0xe4d6('0x13'),_0x3e02bf,_0xe4d6('0x11'),JSON['stringify'](_0x56a295));if(_0x56a295['error']){if(_0x56a295[_0xe4d6('0x14')][_0xe4d6('0x15')]===0x1f4){logger[_0xe4d6('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3e02bf,_0x56a295[_0xe4d6('0x14')][_0xe4d6('0x16')]);return _0x5a31f0(_0x56a295['error'][_0xe4d6('0x16')]);}logger[_0xe4d6('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3e02bf,_0x56a295[_0xe4d6('0x14')][_0xe4d6('0x16')]);return _0xe683ad(_0x56a295[_0xe4d6('0x14')][_0xe4d6('0x16')]);}else{logger['info'](_0xe4d6('0x10'),_0x3e02bf,_0xe4d6('0x11'));_0xe683ad(_0x56a295[_0xe4d6('0x17')][_0xe4d6('0x16')]);}})['catch'](function(_0x41d1a7){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x3e02bf,_0x41d1a7);_0x5a31f0(_0x41d1a7);});});} \ No newline at end of file +var _0x4a3c=['info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x33d2e,_0x33a718){var _0x561ea6=function(_0x368fb5){while(--_0x368fb5){_0x33d2e['push'](_0x33d2e['shift']());}};_0x561ea6(++_0x33a718);}(_0x4a3c,0x13c));var _0xc4a3=function(_0x3848b9,_0xfef644){_0x3848b9=_0x3848b9-0x0;var _0x27f868=_0x4a3c[_0x3848b9];return _0x27f868;};'use strict';var _=require(_0xc4a3('0x0'));var util=require('util');var moment=require(_0xc4a3('0x1'));var BPromise=require(_0xc4a3('0x2'));var rs=require(_0xc4a3('0x3'));var fs=require('fs');var Redis=require(_0xc4a3('0x4'));var db=require(_0xc4a3('0x5'))['db'];var utils=require(_0xc4a3('0x6'));var logger=require(_0xc4a3('0x7'))('rpc');var config=require(_0xc4a3('0x8'));var jayson=require(_0xc4a3('0x9'));var client=jayson[_0xc4a3('0xa')][_0xc4a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1c84,_0x49fa26,_0x596b01){return new BPromise(function(_0xc11c29,_0x58bdcd){return client[_0xc4a3('0xc')](_0x4b1c84,_0x596b01)[_0xc4a3('0xd')](function(_0x1e7f27){logger[_0xc4a3('0xe')](_0xc4a3('0xf'),_0x49fa26,_0xc4a3('0x10'));logger[_0xc4a3('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x49fa26,'request\x20sent',JSON['stringify'](_0x1e7f27));if(_0x1e7f27['error']){if(_0x1e7f27['error']['code']===0x1f4){logger['error'](_0xc4a3('0xf'),_0x49fa26,_0x1e7f27[_0xc4a3('0x12')][_0xc4a3('0x13')]);return _0x58bdcd(_0x1e7f27[_0xc4a3('0x12')]['message']);}logger[_0xc4a3('0x12')](_0xc4a3('0xf'),_0x49fa26,_0x1e7f27['error'][_0xc4a3('0x13')]);return _0xc11c29(_0x1e7f27[_0xc4a3('0x12')][_0xc4a3('0x13')]);}else{logger[_0xc4a3('0xe')](_0xc4a3('0xf'),_0x49fa26,_0xc4a3('0x10'));_0xc11c29(_0x1e7f27[_0xc4a3('0x14')][_0xc4a3('0x13')]);}})[_0xc4a3('0x15')](function(_0x584b6d){logger[_0xc4a3('0x12')](_0xc4a3('0xf'),_0x49fa26,_0x584b6d);_0x58bdcd(_0x584b6d);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 1245089..0b2c069 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 _0x4321=['../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','show','run','/:id/query','post','create','/:id','update','delete','exports','path','../../components/auth/service'];(function(_0x39ae95,_0x41adfc){var _0x1d1efb=function(_0x396d93){while(--_0x396d93){_0x39ae95['push'](_0x39ae95['shift']());}};_0x1d1efb(++_0x41adfc);}(_0x4321,0x12e));var _0x1432=function(_0x375379,_0x4a2cbd){_0x375379=_0x375379-0x0;var _0x595f2a=_0x4321[_0x375379];return _0x595f2a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1432('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x1432('0x1'));var interaction=require(_0x1432('0x2'));var config=require('../../config/environment');var controller=require(_0x1432('0x3'));router[_0x1432('0x4')]('/',auth[_0x1432('0x5')](),controller[_0x1432('0x6')]);router[_0x1432('0x4')]('/:id',auth[_0x1432('0x5')](),controller[_0x1432('0x7')]);router[_0x1432('0x4')]('/:id/preview',auth[_0x1432('0x5')](),controller['preview']);router['get']('/:id/run',auth[_0x1432('0x5')](),controller[_0x1432('0x8')]);router[_0x1432('0x4')](_0x1432('0x9'),auth[_0x1432('0x5')](),controller['query']);router[_0x1432('0xa')]('/',auth['isAuthenticated'](),controller[_0x1432('0xb')]);router['put'](_0x1432('0xc'),auth['isAuthenticated'](),controller[_0x1432('0xd')]);router[_0x1432('0xe')](_0x1432('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x1432('0xf')]=router; \ No newline at end of file +var _0x17e0=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','create','put','update','delete','exports'];(function(_0xa7662e,_0x22304d){var _0x425053=function(_0x3e24a6){while(--_0x3e24a6){_0xa7662e['push'](_0xa7662e['shift']());}};_0x425053(++_0x22304d);}(_0x17e0,0x18c));var _0x017e=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x17e0[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require(_0x017e('0x0'));var path=require(_0x017e('0x1'));var timeout=require('connect-timeout');var express=require(_0x017e('0x2'));var router=express[_0x017e('0x3')]();var auth=require(_0x017e('0x4'));var interaction=require(_0x017e('0x5'));var config=require(_0x017e('0x6'));var controller=require(_0x017e('0x7'));router[_0x017e('0x8')]('/',auth[_0x017e('0x9')](),controller[_0x017e('0xa')]);router[_0x017e('0x8')](_0x017e('0xb'),auth[_0x017e('0x9')](),controller[_0x017e('0xc')]);router[_0x017e('0x8')](_0x017e('0xd'),auth['isAuthenticated'](),controller[_0x017e('0xe')]);router['get'](_0x017e('0xf'),auth[_0x017e('0x9')](),controller['run']);router[_0x017e('0x8')](_0x017e('0x10'),auth[_0x017e('0x9')](),controller['query']);router['post']('/',auth['isAuthenticated'](),controller[_0x017e('0x11')]);router[_0x017e('0x12')]('/:id',auth[_0x017e('0x9')](),controller[_0x017e('0x13')]);router[_0x017e('0x14')]('/:id',auth[_0x017e('0x9')](),controller['destroy']);module[_0x017e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index dd04df4..7aa69e0 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 _0x2bad=['manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv','DATE','Loading'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x2bad,0x164));var _0xd2ba=function(_0x1dbb97,_0xc2e02f){_0x1dbb97=_0x1dbb97-0x0;var _0x57612f=_0x2bad[_0x1dbb97];return _0x57612f;};'use strict';var Sequelize=require(_0xd2ba('0x0'));var moment=require(_0xd2ba('0x1'));module['exports']={'name':{'type':Sequelize[_0xd2ba('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xd2ba('0x3')](_0xd2ba('0x4'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0xd2ba('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xd2ba('0x5')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xd2ba('0x6')},'type':{'type':Sequelize[_0xd2ba('0x3')](_0xd2ba('0x7'),_0xd2ba('0x8')),'allowNull':![],'defaultValue':_0xd2ba('0x7')},'reportId':{'type':Sequelize[_0xd2ba('0x9')](0xb)[_0xd2ba('0xa')]},'reportType':{'type':Sequelize[_0xd2ba('0x2')]}}; \ No newline at end of file +var _0x2c78=['STRING','ENUM','pdf','csv','DATE','manual','INTEGER','UNSIGNED','sequelize','moment','exports'];(function(_0x495bcd,_0x1fa032){var _0x35079e=function(_0x2b9df0){while(--_0x2b9df0){_0x495bcd['push'](_0x495bcd['shift']());}};_0x35079e(++_0x1fa032);}(_0x2c78,0x97));var _0x82c7=function(_0x2252be,_0x1bceeb){_0x2252be=_0x2252be-0x0;var _0x3dd367=_0x2c78[_0x2252be];return _0x3dd367;};'use strict';var Sequelize=require(_0x82c7('0x0'));var moment=require(_0x82c7('0x1'));module[_0x82c7('0x2')]={'name':{'type':Sequelize[_0x82c7('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x82c7('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x82c7('0x4')]('csv',_0x82c7('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x82c7('0x6')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x82c7('0x7')]},'endDate':{'type':Sequelize[_0x82c7('0x7')]},'status':{'type':Sequelize[_0x82c7('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x82c7('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0x82c7('0x8')},'reportId':{'type':Sequelize[_0x82c7('0x9')](0xb)[_0x82c7('0xa')]},'reportType':{'type':Sequelize[_0x82c7('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index a557a8f..708bb01 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 _0x74ca=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','destroy','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','fieldName','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','download','basename','output','existsSync','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','root','savename','format','toLowerCase','html-pdf','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','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x111c69,_0x5445d8){var _0x5635bc=function(_0x1cfc18){while(--_0x1cfc18){_0x111c69['push'](_0x111c69['shift']());}};_0x5635bc(++_0x5445d8);}(_0x74ca,0x1dd));var _0xa74c=function(_0x355c6d,_0x11b3a9){_0x355c6d=_0x355c6d-0x0;var _0xf7d059=_0x74ca[_0x355c6d];return _0xf7d059;};'use strict';var pdf=require(_0xa74c('0x0'));var emlformat=require(_0xa74c('0x1'));var rimraf=require(_0xa74c('0x2'));var zipdir=require(_0xa74c('0x3'));var jsonpatch=require(_0xa74c('0x4'));var rp=require(_0xa74c('0x5'));var moment=require(_0xa74c('0x6'));var BPromise=require(_0xa74c('0x7'));var Mustache=require(_0xa74c('0x8'));var util=require(_0xa74c('0x9'));var path=require(_0xa74c('0xa'));var sox=require(_0xa74c('0xb'));var csv=require(_0xa74c('0xc'));var ejs=require(_0xa74c('0xd'));var fs=require('fs');var _=require(_0xa74c('0xe'));var squel=require(_0xa74c('0xf'));var crypto=require(_0xa74c('0x10'));var jsforce=require(_0xa74c('0x11'));var deskjs=require(_0xa74c('0x12'));var toCsv=require(_0xa74c('0xc'));var querystring=require(_0xa74c('0x13'));var Papa=require(_0xa74c('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa74c('0x15'));var as=require(_0xa74c('0x16'));var hardwareService=require(_0xa74c('0x17'));var logger=require(_0xa74c('0x18'))(_0xa74c('0x19'));var utils=require(_0xa74c('0x1a'));var config=require('../../config/environment');var db=require(_0xa74c('0x1b'))['db'];function respondWithStatusCode(_0x2d94ad,_0x13a995){_0x13a995=_0x13a995||0xcc;return function(_0x229c55){if(_0x229c55){return _0x2d94ad[_0xa74c('0x1c')](_0x13a995);}return _0x2d94ad[_0xa74c('0x1d')](_0x13a995)[_0xa74c('0x1e')]();};}function respondWithResult(_0x49375f,_0x87f48){_0x87f48=_0x87f48||0xc8;return function(_0x2e96ed){if(_0x2e96ed){return _0x49375f[_0xa74c('0x1d')](_0x87f48)['json'](_0x2e96ed);}};}function respondWithFilteredResult(_0x44c189,_0x23f17f){return function(_0x5a2418){if(_0x5a2418){var _0x10678f=_0x5a2418[_0xa74c('0x1f')],_0x46a3cb=_0x23f17f[_0xa74c('0x20')],_0x58b5b4=_0x23f17f[_0xa74c('0x20')]+_0x23f17f[_0xa74c('0x21')],_0x4f4fe3;if(_0x58b5b4>=_0x10678f){_0x58b5b4=_0x10678f;_0x4f4fe3=0xc8;}else{_0x4f4fe3=0xce;}_0x44c189['status'](_0x4f4fe3);return _0x44c189[_0xa74c('0x22')]('Content-Range',_0x46a3cb+'-'+_0x58b5b4+'/'+_0x10678f)[_0xa74c('0x23')](_0x5a2418);}return null;};}function patchUpdates(_0x19c28){return function(_0x183f60){try{jsonpatch[_0xa74c('0x24')](_0x183f60,_0x19c28,!![]);}catch(_0x3dff17){return BPromise[_0xa74c('0x25')](_0x3dff17);}return _0x183f60['save']();};}function saveUpdates(_0x2fa46c,_0x2b1f82){return function(_0x10a4c8){if(_0x10a4c8){return _0x10a4c8[_0xa74c('0x26')](_0x2fa46c)[_0xa74c('0x27')](function(_0x499ebd){return _0x499ebd;});}return null;};}function removeEntity(_0x34ffa7,_0x11fddf){return function(_0x447596){if(_0x447596){return _0x447596[_0xa74c('0x28')]()['then'](function(){var _0x43a312=_0x447596['get']({'plain':!![]});var _0x4abfc2=_0xa74c('0x29');return db[_0xa74c('0x2a')]['destroy']({'where':{'type':_0x4abfc2,'resourceId':_0x43a312['id']}})['then'](function(){return _0x447596;});})[_0xa74c('0x27')](function(){_0x34ffa7[_0xa74c('0x1d')](0xcc)[_0xa74c('0x1e')]();});}};}function handleEntityNotFound(_0x21583f,_0x199ca1){return function(_0x32172b){if(!_0x32172b){_0x21583f['sendStatus'](0x194);}return _0x32172b;};}function handleError(_0x489850,_0x170fba){_0x170fba=_0x170fba||0x1f4;return function(_0x32e8cb){logger[_0xa74c('0x2b')](_0x32e8cb[_0xa74c('0x2c')]);if(_0x32e8cb[_0xa74c('0x2d')]){delete _0x32e8cb['name'];}_0x489850[_0xa74c('0x1d')](_0x170fba)[_0xa74c('0x2e')](_0x32e8cb);};}exports[_0xa74c('0x2f')]=function(_0xcabed7,_0x161e1e){var _0x5d991a={},_0x53c056={},_0x565efc={'count':0x0,'rows':[]};var _0x56aaa4=_[_0xa74c('0x30')](db[_0xa74c('0x31')]['rawAttributes'],function(_0x375a44){return{'name':_0x375a44[_0xa74c('0x32')],'type':_0x375a44['type'][_0xa74c('0x33')]};});_0x53c056['model']=_[_0xa74c('0x30')](_0x56aaa4,_0xa74c('0x2d'));_0x53c056[_0xa74c('0x34')]=_[_0xa74c('0x35')](_0xcabed7[_0xa74c('0x34')]);_0x53c056['filters']=_[_0xa74c('0x36')](_0x53c056[_0xa74c('0x37')],_0x53c056['query']);_0x5d991a['attributes']=_['intersection'](_0x53c056[_0xa74c('0x37')],qs[_0xa74c('0x38')](_0xcabed7[_0xa74c('0x34')]['fields']));_0x5d991a['attributes']=_0x5d991a[_0xa74c('0x39')][_0xa74c('0x3a')]?_0x5d991a[_0xa74c('0x39')]:_0x53c056[_0xa74c('0x37')];if(!_0xcabed7[_0xa74c('0x34')][_0xa74c('0x3b')]('nolimit')){_0x5d991a[_0xa74c('0x21')]=qs['limit'](_0xcabed7[_0xa74c('0x34')]['limit']);_0x5d991a[_0xa74c('0x20')]=qs[_0xa74c('0x20')](_0xcabed7[_0xa74c('0x34')][_0xa74c('0x20')]);}_0x5d991a[_0xa74c('0x3c')]=qs['sort'](_0xcabed7[_0xa74c('0x34')][_0xa74c('0x3d')]);_0x5d991a[_0xa74c('0x3e')]=qs['filters'](_[_0xa74c('0x3f')](_0xcabed7[_0xa74c('0x34')],_0x53c056[_0xa74c('0x40')]),_0x56aaa4);if(_0xcabed7[_0xa74c('0x34')]['filter']){_0x5d991a[_0xa74c('0x3e')]=_[_0xa74c('0x41')](_0x5d991a[_0xa74c('0x3e')],{'$or':_[_0xa74c('0x30')](_0x56aaa4,function(_0x2511b1){if(_0x2511b1['type']!==_0xa74c('0x42')){var _0x9cd796={};_0x9cd796[_0x2511b1['name']]={'$like':'%'+_0xcabed7[_0xa74c('0x34')][_0xa74c('0x43')]+'%'};return _0x9cd796;}})});}_0x5d991a=_[_0xa74c('0x41')]({},_0x5d991a,_0xcabed7[_0xa74c('0x44')]);var _0x3ae601={'where':_0x5d991a[_0xa74c('0x3e')]};return db[_0xa74c('0x31')]['count'](_0x3ae601)['then'](function(_0x4edb4a){_0x565efc[_0xa74c('0x1f')]=_0x4edb4a;if(_0xcabed7[_0xa74c('0x34')][_0xa74c('0x45')]){_0x5d991a[_0xa74c('0x46')]=[{'all':!![]}];}return db[_0xa74c('0x31')][_0xa74c('0x47')](_0x5d991a);})[_0xa74c('0x27')](function(_0x3d70af){_0x565efc[_0xa74c('0x48')]=_0x3d70af;return _0x565efc;})[_0xa74c('0x27')](respondWithFilteredResult(_0x161e1e,_0x5d991a))[_0xa74c('0x49')](handleError(_0x161e1e,null));};exports[_0xa74c('0x4a')]=function(_0x2eb376,_0x6fc3bc){var _0x4a4874={'raw':!![],'where':{'id':_0x2eb376[_0xa74c('0x4b')]['id']}},_0x20d3a4={};_0x20d3a4[_0xa74c('0x37')]=_['keys'](db['AnalyticExtractedReport']['rawAttributes']);_0x20d3a4[_0xa74c('0x34')]=_[_0xa74c('0x35')](_0x2eb376[_0xa74c('0x34')]);_0x20d3a4[_0xa74c('0x40')]=_['intersection'](_0x20d3a4[_0xa74c('0x37')],_0x20d3a4[_0xa74c('0x34')]);_0x4a4874['attributes']=_[_0xa74c('0x36')](_0x20d3a4[_0xa74c('0x37')],qs['fields'](_0x2eb376[_0xa74c('0x34')][_0xa74c('0x38')]));_0x4a4874['attributes']=_0x4a4874['attributes'][_0xa74c('0x3a')]?_0x4a4874[_0xa74c('0x39')]:_0x20d3a4[_0xa74c('0x37')];if(_0x2eb376[_0xa74c('0x34')][_0xa74c('0x45')]){_0x4a4874[_0xa74c('0x46')]=[{'all':!![]}];}_0x4a4874=_['merge']({},_0x4a4874,_0x2eb376[_0xa74c('0x44')]);return db[_0xa74c('0x31')]['find'](_0x4a4874)[_0xa74c('0x27')](handleEntityNotFound(_0x6fc3bc,null))['then'](respondWithResult(_0x6fc3bc,null))[_0xa74c('0x49')](handleError(_0x6fc3bc,null));};exports[_0xa74c('0x4c')]=function(_0x311763,_0x19df43){return db[_0xa74c('0x31')][_0xa74c('0x4c')](_0x311763['body'],{})[_0xa74c('0x27')](function(_0x243870){var _0x5752cc=_0x311763['user'][_0xa74c('0x4d')]({'plain':!![]});if(!_0x5752cc)throw new Error(_0xa74c('0x4e'));if(_0x5752cc[_0xa74c('0x4f')]==='user'){var _0x3f4473=_0x243870[_0xa74c('0x4d')]({'plain':!![]});var _0x56031b=_0xa74c('0x29');return db[_0xa74c('0x50')]['find']({'where':{'name':_0x56031b,'userProfileId':_0x5752cc[_0xa74c('0x51')]},'raw':!![]})[_0xa74c('0x27')](function(_0x31ab63){if(_0x31ab63&&_0x31ab63[_0xa74c('0x52')]===0x0){return db['UserProfileResource'][_0xa74c('0x4c')]({'name':_0x3f4473[_0xa74c('0x2d')],'resourceId':_0x3f4473['id'],'type':_0x31ab63[_0xa74c('0x2d')],'sectionId':_0x31ab63['id']},{})[_0xa74c('0x27')](function(){return _0x243870;});}else{return _0x243870;}})['catch'](function(_0xe0b67e){logger[_0xa74c('0x2b')](_0xa74c('0x53'),_0xe0b67e);throw _0xe0b67e;});}return _0x243870;})['then'](respondWithResult(_0x19df43,0xc9))['catch'](handleError(_0x19df43,null));};exports[_0xa74c('0x26')]=function(_0x2e9240,_0x519d0a){if(_0x2e9240[_0xa74c('0x54')]['id']){delete _0x2e9240['body']['id'];}return db[_0xa74c('0x31')][_0xa74c('0x55')]({'where':{'id':_0x2e9240[_0xa74c('0x4b')]['id']}})[_0xa74c('0x27')](handleEntityNotFound(_0x519d0a,null))[_0xa74c('0x27')](saveUpdates(_0x2e9240[_0xa74c('0x54')],null))[_0xa74c('0x27')](respondWithResult(_0x519d0a,null))[_0xa74c('0x49')](handleError(_0x519d0a,null));};exports[_0xa74c('0x28')]=function(_0x2f4b78,_0x512fa1){return db[_0xa74c('0x31')][_0xa74c('0x55')]({'where':{'id':_0x2f4b78[_0xa74c('0x4b')]['id']}})[_0xa74c('0x27')](handleEntityNotFound(_0x512fa1,null))[_0xa74c('0x27')](removeEntity(_0x512fa1,null))[_0xa74c('0x49')](handleError(_0x512fa1,null));};exports[_0xa74c('0x56')]=function(_0xec46d3,_0x4c95e5,_0x6fc2a1){return db[_0xa74c('0x31')][_0xa74c('0x55')]({'where':{'id':_0xec46d3[_0xa74c('0x4b')]['id']},'attributes':['name',_0xa74c('0x57'),'savename',_0xa74c('0x58')],'raw':!![]})[_0xa74c('0x27')](handleEntityNotFound(_0x4c95e5,null))[_0xa74c('0x27')](function(_0x452136){if(_0x452136){if(!fs[_0xa74c('0x59')](path['join'](config['root'],_0xa74c('0x5a'),_0x452136['savename']))){throw new db[(_0xa74c('0x5b'))][(_0xa74c('0x5c'))](_0xa74c('0x5d'));}if(_0xec46d3[_0xa74c('0x34')][_0xa74c('0x5e')]){return _0x4c95e5[_0xa74c('0x1c')](0xc8);}return _0x4c95e5[_0xa74c('0x56')](path[_0xa74c('0x5f')](config[_0xa74c('0x60')],_0xa74c('0x5a'),_0x452136[_0xa74c('0x61')]),util[_0xa74c('0x62')]('%s.%s',_0x452136[_0xa74c('0x57')]||_0x452136[_0xa74c('0x2d')],_0x452136[_0xa74c('0x58')][_0xa74c('0x63')]()));}})[_0xa74c('0x49')](handleError(_0x4c95e5,null));}; \ No newline at end of file +var _0x8b0b=['catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','output','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','format','toLowerCase','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','includeAll','include','findAll','show','params','keys','find'];(function(_0x5224b9,_0x195fcb){var _0x363bcc=function(_0x3d219a){while(--_0x3d219a){_0x5224b9['push'](_0x5224b9['shift']());}};_0x363bcc(++_0x195fcb);}(_0x8b0b,0xd3));var _0xb8b0=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0x8b0b[_0x273dc5];return _0x46dae7;};'use strict';var pdf=require(_0xb8b0('0x0'));var emlformat=require(_0xb8b0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb8b0('0x2'));var jsonpatch=require(_0xb8b0('0x3'));var rp=require(_0xb8b0('0x4'));var moment=require(_0xb8b0('0x5'));var BPromise=require(_0xb8b0('0x6'));var Mustache=require(_0xb8b0('0x7'));var util=require('util');var path=require('path');var sox=require(_0xb8b0('0x8'));var csv=require(_0xb8b0('0x9'));var ejs=require(_0xb8b0('0xa'));var fs=require('fs');var _=require(_0xb8b0('0xb'));var squel=require(_0xb8b0('0xc'));var crypto=require(_0xb8b0('0xd'));var jsforce=require(_0xb8b0('0xe'));var deskjs=require(_0xb8b0('0xf'));var toCsv=require(_0xb8b0('0x9'));var querystring=require('querystring');var Papa=require(_0xb8b0('0x10'));var Redis=require(_0xb8b0('0x11'));var authService=require(_0xb8b0('0x12'));var qs=require(_0xb8b0('0x13'));var as=require(_0xb8b0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8b0('0x15'))(_0xb8b0('0x16'));var utils=require(_0xb8b0('0x17'));var config=require(_0xb8b0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e2fdb,_0xfeb034){_0xfeb034=_0xfeb034||0xcc;return function(_0x85ca35){if(_0x85ca35){return _0x5e2fdb['sendStatus'](_0xfeb034);}return _0x5e2fdb[_0xb8b0('0x19')](_0xfeb034)[_0xb8b0('0x1a')]();};}function respondWithResult(_0x1bfc87,_0x174298){_0x174298=_0x174298||0xc8;return function(_0xa4df4){if(_0xa4df4){return _0x1bfc87['status'](_0x174298)[_0xb8b0('0x1b')](_0xa4df4);}};}function respondWithFilteredResult(_0x5d015c,_0x46cbd3){return function(_0xd0aab1){if(_0xd0aab1){var _0x57788c=_0xd0aab1[_0xb8b0('0x1c')],_0x2d4512=_0x46cbd3[_0xb8b0('0x1d')],_0x537108=_0x46cbd3['offset']+_0x46cbd3[_0xb8b0('0x1e')],_0x93de9c;if(_0x537108>=_0x57788c){_0x537108=_0x57788c;_0x93de9c=0xc8;}else{_0x93de9c=0xce;}_0x5d015c['status'](_0x93de9c);return _0x5d015c[_0xb8b0('0x1f')](_0xb8b0('0x20'),_0x2d4512+'-'+_0x537108+'/'+_0x57788c)['json'](_0xd0aab1);}return null;};}function patchUpdates(_0x8c6ecd){return function(_0x3ad4ed){try{jsonpatch[_0xb8b0('0x21')](_0x3ad4ed,_0x8c6ecd,!![]);}catch(_0x5b2549){return BPromise['reject'](_0x5b2549);}return _0x3ad4ed[_0xb8b0('0x22')]();};}function saveUpdates(_0x363694,_0x52c684){return function(_0x37c6e7){if(_0x37c6e7){return _0x37c6e7[_0xb8b0('0x23')](_0x363694)[_0xb8b0('0x24')](function(_0x3040c4){return _0x3040c4;});}return null;};}function removeEntity(_0x178252,_0x526920){return function(_0x57f748){if(_0x57f748){return _0x57f748[_0xb8b0('0x25')]()[_0xb8b0('0x24')](function(){var _0x3d4c24=_0x57f748[_0xb8b0('0x26')]({'plain':!![]});var _0x25ae67=_0xb8b0('0x27');return db[_0xb8b0('0x28')][_0xb8b0('0x25')]({'where':{'type':_0x25ae67,'resourceId':_0x3d4c24['id']}})['then'](function(){return _0x57f748;});})[_0xb8b0('0x24')](function(){_0x178252[_0xb8b0('0x19')](0xcc)[_0xb8b0('0x1a')]();});}};}function handleEntityNotFound(_0x22da47,_0x26a024){return function(_0x23eaa0){if(!_0x23eaa0){_0x22da47['sendStatus'](0x194);}return _0x23eaa0;};}function handleError(_0x1375f1,_0x24d770){_0x24d770=_0x24d770||0x1f4;return function(_0x34420f){logger['error'](_0x34420f[_0xb8b0('0x29')]);if(_0x34420f[_0xb8b0('0x2a')]){delete _0x34420f[_0xb8b0('0x2a')];}_0x1375f1['status'](_0x24d770)[_0xb8b0('0x2b')](_0x34420f);};}exports[_0xb8b0('0x2c')]=function(_0x5510cf,_0x294eb7){var _0x329bc5={},_0x37ec67={},_0x267ce3={'count':0x0,'rows':[]};var _0x23bbfd=_[_0xb8b0('0x2d')](db[_0xb8b0('0x2e')][_0xb8b0('0x2f')],function(_0x51732e){return{'name':_0x51732e['fieldName'],'type':_0x51732e[_0xb8b0('0x30')][_0xb8b0('0x31')]};});_0x37ec67[_0xb8b0('0x32')]=_[_0xb8b0('0x2d')](_0x23bbfd,_0xb8b0('0x2a'));_0x37ec67[_0xb8b0('0x33')]=_['keys'](_0x5510cf[_0xb8b0('0x33')]);_0x37ec67[_0xb8b0('0x34')]=_[_0xb8b0('0x35')](_0x37ec67[_0xb8b0('0x32')],_0x37ec67[_0xb8b0('0x33')]);_0x329bc5[_0xb8b0('0x36')]=_[_0xb8b0('0x35')](_0x37ec67['model'],qs[_0xb8b0('0x37')](_0x5510cf[_0xb8b0('0x33')][_0xb8b0('0x37')]));_0x329bc5['attributes']=_0x329bc5[_0xb8b0('0x36')][_0xb8b0('0x38')]?_0x329bc5[_0xb8b0('0x36')]:_0x37ec67[_0xb8b0('0x32')];if(!_0x5510cf[_0xb8b0('0x33')][_0xb8b0('0x39')](_0xb8b0('0x3a'))){_0x329bc5[_0xb8b0('0x1e')]=qs['limit'](_0x5510cf[_0xb8b0('0x33')][_0xb8b0('0x1e')]);_0x329bc5[_0xb8b0('0x1d')]=qs[_0xb8b0('0x1d')](_0x5510cf[_0xb8b0('0x33')]['offset']);}_0x329bc5['order']=qs[_0xb8b0('0x3b')](_0x5510cf['query'][_0xb8b0('0x3b')]);_0x329bc5['where']=qs[_0xb8b0('0x34')](_[_0xb8b0('0x3c')](_0x5510cf[_0xb8b0('0x33')],_0x37ec67[_0xb8b0('0x34')]),_0x23bbfd);if(_0x5510cf['query']['filter']){_0x329bc5['where']=_[_0xb8b0('0x3d')](_0x329bc5[_0xb8b0('0x3e')],{'$or':_[_0xb8b0('0x2d')](_0x23bbfd,function(_0x4d6396){if(_0x4d6396['type']!==_0xb8b0('0x3f')){var _0x29567b={};_0x29567b[_0x4d6396[_0xb8b0('0x2a')]]={'$like':'%'+_0x5510cf['query']['filter']+'%'};return _0x29567b;}})});}_0x329bc5=_[_0xb8b0('0x3d')]({},_0x329bc5,_0x5510cf['options']);var _0xe69611={'where':_0x329bc5[_0xb8b0('0x3e')]};return db['AnalyticExtractedReport'][_0xb8b0('0x1c')](_0xe69611)[_0xb8b0('0x24')](function(_0x511360){_0x267ce3[_0xb8b0('0x1c')]=_0x511360;if(_0x5510cf[_0xb8b0('0x33')][_0xb8b0('0x40')]){_0x329bc5[_0xb8b0('0x41')]=[{'all':!![]}];}return db[_0xb8b0('0x2e')][_0xb8b0('0x42')](_0x329bc5);})[_0xb8b0('0x24')](function(_0x3df035){_0x267ce3['rows']=_0x3df035;return _0x267ce3;})[_0xb8b0('0x24')](respondWithFilteredResult(_0x294eb7,_0x329bc5))['catch'](handleError(_0x294eb7,null));};exports[_0xb8b0('0x43')]=function(_0x37d460,_0x45b8e0){var _0x5e2d58={'raw':!![],'where':{'id':_0x37d460[_0xb8b0('0x44')]['id']}},_0x30b94b={};_0x30b94b['model']=_[_0xb8b0('0x45')](db['AnalyticExtractedReport']['rawAttributes']);_0x30b94b[_0xb8b0('0x33')]=_[_0xb8b0('0x45')](_0x37d460[_0xb8b0('0x33')]);_0x30b94b['filters']=_[_0xb8b0('0x35')](_0x30b94b[_0xb8b0('0x32')],_0x30b94b['query']);_0x5e2d58[_0xb8b0('0x36')]=_[_0xb8b0('0x35')](_0x30b94b[_0xb8b0('0x32')],qs[_0xb8b0('0x37')](_0x37d460[_0xb8b0('0x33')][_0xb8b0('0x37')]));_0x5e2d58['attributes']=_0x5e2d58[_0xb8b0('0x36')][_0xb8b0('0x38')]?_0x5e2d58[_0xb8b0('0x36')]:_0x30b94b['model'];if(_0x37d460[_0xb8b0('0x33')]['includeAll']){_0x5e2d58['include']=[{'all':!![]}];}_0x5e2d58=_[_0xb8b0('0x3d')]({},_0x5e2d58,_0x37d460['options']);return db[_0xb8b0('0x2e')][_0xb8b0('0x46')](_0x5e2d58)[_0xb8b0('0x24')](handleEntityNotFound(_0x45b8e0,null))[_0xb8b0('0x24')](respondWithResult(_0x45b8e0,null))[_0xb8b0('0x47')](handleError(_0x45b8e0,null));};exports[_0xb8b0('0x48')]=function(_0x27cd3d,_0xb839d){return db['AnalyticExtractedReport'][_0xb8b0('0x48')](_0x27cd3d[_0xb8b0('0x49')],{})[_0xb8b0('0x24')](function(_0x2992c){var _0x47a728=_0x27cd3d[_0xb8b0('0x4a')][_0xb8b0('0x26')]({'plain':!![]});if(!_0x47a728)throw new Error(_0xb8b0('0x4b'));if(_0x47a728[_0xb8b0('0x4c')]===_0xb8b0('0x4a')){var _0x3fc50e=_0x2992c[_0xb8b0('0x26')]({'plain':!![]});var _0x15bb6e=_0xb8b0('0x27');return db[_0xb8b0('0x4d')][_0xb8b0('0x46')]({'where':{'name':_0x15bb6e,'userProfileId':_0x47a728[_0xb8b0('0x4e')]},'raw':!![]})[_0xb8b0('0x24')](function(_0x2618d4){if(_0x2618d4&&_0x2618d4[_0xb8b0('0x4f')]===0x0){return db[_0xb8b0('0x28')][_0xb8b0('0x48')]({'name':_0x3fc50e[_0xb8b0('0x2a')],'resourceId':_0x3fc50e['id'],'type':_0x2618d4['name'],'sectionId':_0x2618d4['id']},{})['then'](function(){return _0x2992c;});}else{return _0x2992c;}})[_0xb8b0('0x47')](function(_0xd0455d){logger[_0xb8b0('0x50')](_0xb8b0('0x51'),_0xd0455d);throw _0xd0455d;});}return _0x2992c;})[_0xb8b0('0x24')](respondWithResult(_0xb839d,0xc9))['catch'](handleError(_0xb839d,null));};exports[_0xb8b0('0x23')]=function(_0x5bf1e8,_0x56b62a){if(_0x5bf1e8[_0xb8b0('0x49')]['id']){delete _0x5bf1e8['body']['id'];}return db[_0xb8b0('0x2e')][_0xb8b0('0x46')]({'where':{'id':_0x5bf1e8[_0xb8b0('0x44')]['id']}})[_0xb8b0('0x24')](handleEntityNotFound(_0x56b62a,null))[_0xb8b0('0x24')](saveUpdates(_0x5bf1e8[_0xb8b0('0x49')],null))[_0xb8b0('0x24')](respondWithResult(_0x56b62a,null))[_0xb8b0('0x47')](handleError(_0x56b62a,null));};exports[_0xb8b0('0x25')]=function(_0x524180,_0x41d055){return db[_0xb8b0('0x2e')][_0xb8b0('0x46')]({'where':{'id':_0x524180[_0xb8b0('0x44')]['id']}})['then'](handleEntityNotFound(_0x41d055,null))[_0xb8b0('0x24')](removeEntity(_0x41d055,null))[_0xb8b0('0x47')](handleError(_0x41d055,null));};exports['download']=function(_0x3db76c,_0x23d103,_0x162c56){return db['AnalyticExtractedReport'][_0xb8b0('0x46')]({'where':{'id':_0x3db76c['params']['id']},'attributes':[_0xb8b0('0x2a'),_0xb8b0('0x52'),'savename',_0xb8b0('0x53')],'raw':!![]})[_0xb8b0('0x24')](handleEntityNotFound(_0x23d103,null))['then'](function(_0xbc6755){if(_0xbc6755){if(!fs['existsSync'](path['join'](config[_0xb8b0('0x54')],_0xb8b0('0x55'),_0xbc6755[_0xb8b0('0x56')]))){throw new db[(_0xb8b0('0x57'))][(_0xb8b0('0x58'))](_0xb8b0('0x59'));}if(_0x3db76c[_0xb8b0('0x33')][_0xb8b0('0x5a')]){return _0x23d103['sendStatus'](0xc8);}return _0x23d103['download'](path[_0xb8b0('0x5b')](config[_0xb8b0('0x54')],_0xb8b0('0x55'),_0xbc6755[_0xb8b0('0x56')]),util[_0xb8b0('0x5c')]('%s.%s',_0xbc6755[_0xb8b0('0x52')]||_0xbc6755['name'],_0xbc6755[_0xb8b0('0x53')][_0xb8b0('0x5d')]()));}})[_0xb8b0('0x47')](handleError(_0x23d103,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index ec78ce6..3c2a34d 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 _0xdae4=['rimraf','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5a9524,_0x113509){var _0xe3170=function(_0x551c2d){while(--_0x551c2d){_0x5a9524['push'](_0x5a9524['shift']());}};_0xe3170(++_0x113509);}(_0xdae4,0xf5));var _0x4dae=function(_0xcb3712,_0x5971e5){_0xcb3712=_0xcb3712-0x0;var _0x2959fe=_0xdae4[_0xcb3712];return _0x2959fe;};'use strict';var _=require(_0x4dae('0x0'));var util=require(_0x4dae('0x1'));var logger=require(_0x4dae('0x2'))(_0x4dae('0x3'));var moment=require(_0x4dae('0x4'));var BPromise=require(_0x4dae('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4dae('0x6'));var rimraf=require(_0x4dae('0x7'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0x4dae('0x8')]=function(_0x2d0c99,_0x46bb6d){return _0x2d0c99[_0x4dae('0x9')](_0x4dae('0xa'),attributes,{'tableName':_0x4dae('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe64e=['./analyticExtractedReport.attributes','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x27ea0b,_0x16d7f9){var _0x54e83e=function(_0x3c2ad7){while(--_0x3c2ad7){_0x27ea0b['push'](_0x27ea0b['shift']());}};_0x54e83e(++_0x16d7f9);}(_0xe64e,0x177));var _0xee64=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe64e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xee64('0x0'));var util=require('util');var logger=require(_0xee64('0x1'))(_0xee64('0x2'));var moment=require(_0xee64('0x3'));var BPromise=require(_0xee64('0x4'));var rp=require(_0xee64('0x5'));var fs=require('fs');var path=require(_0xee64('0x6'));var rimraf=require(_0xee64('0x7'));var config=require(_0xee64('0x8'));var attributes=require(_0xee64('0x9'));module['exports']=function(_0x59902e,_0x174e33){return _0x59902e['define'](_0xee64('0xa'),attributes,{'tableName':_0xee64('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 e393ebd..7f63b52 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 _0x7beb=['request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x1baa5e,_0x2c4314){var _0x19d576=function(_0x4cec1e){while(--_0x4cec1e){_0x1baa5e['push'](_0x1baa5e['shift']());}};_0x19d576(++_0x2c4314);}(_0x7beb,0x1f4));var _0xb7be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7beb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb7be('0x0'));var util=require(_0xb7be('0x1'));var moment=require(_0xb7be('0x2'));var BPromise=require('bluebird');var rs=require(_0xb7be('0x3'));var fs=require('fs');var Redis=require(_0xb7be('0x4'));var db=require(_0xb7be('0x5'))['db'];var utils=require(_0xb7be('0x6'));var logger=require('../../config/logger')(_0xb7be('0x7'));var config=require('../../config/environment');var jayson=require(_0xb7be('0x8'));var client=jayson[_0xb7be('0x9')][_0xb7be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf795c0,_0x45ff82,_0x5c89cb){return new BPromise(function(_0x44a2f8,_0x496e25){return client['request'](_0xf795c0,_0x5c89cb)['then'](function(_0x21e43c){logger[_0xb7be('0xb')](_0xb7be('0xc'),_0x45ff82,_0xb7be('0xd'));logger[_0xb7be('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x45ff82,_0xb7be('0xd'),JSON[_0xb7be('0xf')](_0x21e43c));if(_0x21e43c['error']){if(_0x21e43c[_0xb7be('0x10')]['code']===0x1f4){logger[_0xb7be('0x10')](_0xb7be('0xc'),_0x45ff82,_0x21e43c[_0xb7be('0x10')][_0xb7be('0x11')]);return _0x496e25(_0x21e43c[_0xb7be('0x10')][_0xb7be('0x11')]);}logger['error'](_0xb7be('0xc'),_0x45ff82,_0x21e43c[_0xb7be('0x10')][_0xb7be('0x11')]);return _0x44a2f8(_0x21e43c[_0xb7be('0x10')]['message']);}else{logger[_0xb7be('0xb')](_0xb7be('0xc'),_0x45ff82,_0xb7be('0xd'));_0x44a2f8(_0x21e43c['result'][_0xb7be('0x11')]);}})[_0xb7be('0x12')](function(_0x29ae53){logger[_0xb7be('0x10')](_0xb7be('0xc'),_0x45ff82,_0x29ae53);_0x496e25(_0x29ae53);});});} \ No newline at end of file +var _0x7553=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message'];(function(_0x363d2a,_0x59cfab){var _0x5f3830=function(_0x583627){while(--_0x583627){_0x363d2a['push'](_0x363d2a['shift']());}};_0x5f3830(++_0x59cfab);}(_0x7553,0xde));var _0x3755=function(_0x2ec00a,_0x23412a){_0x2ec00a=_0x2ec00a-0x0;var _0x27b616=_0x7553[_0x2ec00a];return _0x27b616;};'use strict';var _=require(_0x3755('0x0'));var util=require('util');var moment=require(_0x3755('0x1'));var BPromise=require(_0x3755('0x2'));var rs=require(_0x3755('0x3'));var fs=require('fs');var Redis=require(_0x3755('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3755('0x5'));var logger=require(_0x3755('0x6'))('rpc');var config=require(_0x3755('0x7'));var jayson=require(_0x3755('0x8'));var client=jayson['client'][_0x3755('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x141949,_0x4eff0e,_0x58a0f2){return new BPromise(function(_0x6a3c6a,_0x57eb86){return client[_0x3755('0xa')](_0x141949,_0x58a0f2)['then'](function(_0x1ee51c){logger[_0x3755('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4eff0e,_0x3755('0xc'));logger[_0x3755('0xd')](_0x3755('0xe'),_0x4eff0e,_0x3755('0xc'),JSON[_0x3755('0xf')](_0x1ee51c));if(_0x1ee51c['error']){if(_0x1ee51c[_0x3755('0x10')][_0x3755('0x11')]===0x1f4){logger[_0x3755('0x10')](_0x3755('0x12'),_0x4eff0e,_0x1ee51c['error'][_0x3755('0x13')]);return _0x57eb86(_0x1ee51c['error']['message']);}logger['error'](_0x3755('0x12'),_0x4eff0e,_0x1ee51c[_0x3755('0x10')][_0x3755('0x13')]);return _0x6a3c6a(_0x1ee51c[_0x3755('0x10')][_0x3755('0x13')]);}else{logger[_0x3755('0xb')](_0x3755('0x12'),_0x4eff0e,_0x3755('0xc'));_0x6a3c6a(_0x1ee51c[_0x3755('0x14')][_0x3755('0x13')]);}})[_0x3755('0x15')](function(_0x8c50b9){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x4eff0e,_0x8c50b9);_0x57eb86(_0x8c50b9);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 882238d..c575d11 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 _0x15bf=['/:id/download','isAuthenticated','create','put','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show'];(function(_0x3a2f33,_0x8946e0){var _0x437c28=function(_0x214d0b){while(--_0x214d0b){_0x3a2f33['push'](_0x3a2f33['shift']());}};_0x437c28(++_0x8946e0);}(_0x15bf,0x18e));var _0xf15b=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0x15bf[_0xfc0976];return _0x23579f;};'use strict';var multer=require(_0xf15b('0x0'));var util=require(_0xf15b('0x1'));var path=require('path');var timeout=require(_0xf15b('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf15b('0x3'));var interaction=require(_0xf15b('0x4'));var config=require(_0xf15b('0x5'));var controller=require('./analyticExtractedReport.controller');router[_0xf15b('0x6')]('/',auth['isAuthenticated'](),controller[_0xf15b('0x7')]);router[_0xf15b('0x6')](_0xf15b('0x8'),auth['isAuthenticated'](),controller[_0xf15b('0x9')]);router[_0xf15b('0x6')](_0xf15b('0xa'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xf15b('0xb')](),controller[_0xf15b('0xc')]);router[_0xf15b('0xd')]('/:id',auth[_0xf15b('0xb')](),controller['update']);router[_0xf15b('0xe')](_0xf15b('0x8'),auth[_0xf15b('0xb')](),controller[_0xf15b('0xf')]);module[_0xf15b('0x10')]=router; \ No newline at end of file +var _0x54a7=['update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','create','put'];(function(_0x5213d6,_0x25dc48){var _0x35f1b7=function(_0x284e6c){while(--_0x284e6c){_0x5213d6['push'](_0x5213d6['shift']());}};_0x35f1b7(++_0x25dc48);}(_0x54a7,0x1c3));var _0x754a=function(_0x1fc6eb,_0x81ae5f){_0x1fc6eb=_0x1fc6eb-0x0;var _0x5d1a97=_0x54a7[_0x1fc6eb];return _0x5d1a97;};'use strict';var multer=require(_0x754a('0x0'));var util=require(_0x754a('0x1'));var path=require('path');var timeout=require(_0x754a('0x2'));var express=require(_0x754a('0x3'));var router=express[_0x754a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x754a('0x5'));var config=require('../../config/environment');var controller=require(_0x754a('0x6'));router[_0x754a('0x7')]('/',auth[_0x754a('0x8')](),controller['index']);router[_0x754a('0x7')](_0x754a('0x9'),auth[_0x754a('0x8')](),controller[_0x754a('0xa')]);router[_0x754a('0x7')]('/:id/download',auth[_0x754a('0x8')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x754a('0xb')]);router[_0x754a('0xc')](_0x754a('0x9'),auth['isAuthenticated'](),controller[_0x754a('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x754a('0xe')]);module[_0x754a('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 9286381..9327638 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 _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x4224e3,_0x2774ea){var _0x5e2381=function(_0x300048){while(--_0x300048){_0x4224e3['push'](_0x4224e3['shift']());}};_0x5e2381(++_0x2774ea);}(_0x1261,0x144));var _0x1126=function(_0x1e17eb,_0x2e15c5){_0x1e17eb=_0x1e17eb-0x0;var _0x4de4c7=_0x1261[_0x1e17eb];return _0x4de4c7;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'field':{'type':Sequelize[_0x1126('0x1')]},'alias':{'type':Sequelize[_0x1126('0x2')]},'function':{'type':Sequelize[_0x1126('0x2')]},'format':{'type':Sequelize[_0x1126('0x2')]},'groupBy':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1126('0x2')]},'custom':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x326f=['STRING','BOOLEAN','sequelize'];(function(_0x2e7025,_0x187270){var _0x5373ed=function(_0x3405f2){while(--_0x3405f2){_0x2e7025['push'](_0x2e7025['shift']());}};_0x5373ed(++_0x187270);}(_0x326f,0xd1));var _0xf326=function(_0x3541f2,_0x1e20a1){_0x3541f2=_0x3541f2-0x0;var _0x71ba1=_0x326f[_0x3541f2];return _0x71ba1;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xf326('0x1')]},'function':{'type':Sequelize[_0xf326('0x1')]},'format':{'type':Sequelize[_0xf326('0x1')]},'groupBy':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xf326('0x1')]},'custom':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 86f6811..614023b 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 _0x9b9c=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','create','body','bulkCreate','update','params','find','bulkDestroy','ids','AnalyticCustomReport','findOne','transaction','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','AnalyticFieldReport','type','key','query','keys','filters','intersection','model'];(function(_0x56ca83,_0x55339c){var _0x13025a=function(_0x52bee2){while(--_0x52bee2){_0x56ca83['push'](_0x56ca83['shift']());}};_0x13025a(++_0x55339c);}(_0x9b9c,0x16a));var _0xc9b9=function(_0x36dce3,_0x3c11e1){_0x36dce3=_0x36dce3-0x0;var _0x5a8e21=_0x9b9c[_0x36dce3];return _0x5a8e21;};'use strict';var pdf=require(_0xc9b9('0x0'));var emlformat=require(_0xc9b9('0x1'));var rimraf=require(_0xc9b9('0x2'));var zipdir=require(_0xc9b9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc9b9('0x4'));var moment=require(_0xc9b9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc9b9('0x6'));var util=require('util');var path=require(_0xc9b9('0x7'));var sox=require(_0xc9b9('0x8'));var csv=require(_0xc9b9('0x9'));var ejs=require(_0xc9b9('0xa'));var fs=require('fs');var _=require(_0xc9b9('0xb'));var squel=require('squel');var crypto=require(_0xc9b9('0xc'));var jsforce=require(_0xc9b9('0xd'));var deskjs=require(_0xc9b9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc9b9('0xf'));var Papa=require(_0xc9b9('0x10'));var Redis=require('ioredis');var authService=require(_0xc9b9('0x11'));var qs=require(_0xc9b9('0x12'));var as=require(_0xc9b9('0x13'));var hardwareService=require(_0xc9b9('0x14'));var logger=require(_0xc9b9('0x15'))(_0xc9b9('0x16'));var utils=require(_0xc9b9('0x17'));var config=require(_0xc9b9('0x18'));var db=require(_0xc9b9('0x19'))['db'];function respondWithStatusCode(_0x24fb16,_0x234c24){_0x234c24=_0x234c24||0xcc;return function(_0x371da3){if(_0x371da3){return _0x24fb16[_0xc9b9('0x1a')](_0x234c24);}return _0x24fb16[_0xc9b9('0x1b')](_0x234c24)[_0xc9b9('0x1c')]();};}function respondWithResult(_0x2eefe9,_0x259f7f){_0x259f7f=_0x259f7f||0xc8;return function(_0x4f2442){if(_0x4f2442){return _0x2eefe9['status'](_0x259f7f)[_0xc9b9('0x1d')](_0x4f2442);}};}function respondWithFilteredResult(_0xf31467,_0x51e90c){return function(_0x481b64){if(_0x481b64){var _0x2ec0ed=_0x481b64[_0xc9b9('0x1e')],_0x420e30=_0x51e90c[_0xc9b9('0x1f')],_0x58eb43=_0x51e90c[_0xc9b9('0x1f')]+_0x51e90c[_0xc9b9('0x20')],_0x4dd511;if(_0x58eb43>=_0x2ec0ed){_0x58eb43=_0x2ec0ed;_0x4dd511=0xc8;}else{_0x4dd511=0xce;}_0xf31467[_0xc9b9('0x1b')](_0x4dd511);return _0xf31467[_0xc9b9('0x21')](_0xc9b9('0x22'),_0x420e30+'-'+_0x58eb43+'/'+_0x2ec0ed)[_0xc9b9('0x1d')](_0x481b64);}return null;};}function patchUpdates(_0xf73046){return function(_0x3b05e3){try{jsonpatch[_0xc9b9('0x23')](_0x3b05e3,_0xf73046,!![]);}catch(_0x4a41c4){return BPromise[_0xc9b9('0x24')](_0x4a41c4);}return _0x3b05e3[_0xc9b9('0x25')]();};}function saveUpdates(_0x5e6e11,_0x46a04e){return function(_0x3d54c1){if(_0x3d54c1){return _0x3d54c1['update'](_0x5e6e11)[_0xc9b9('0x26')](function(_0xd9dc57){return _0xd9dc57;});}return null;};}function removeEntity(_0x1ff223,_0x5dd75c){return function(_0x264e7d){if(_0x264e7d){return _0x264e7d[_0xc9b9('0x27')]()['then'](function(){_0x1ff223['status'](0xcc)[_0xc9b9('0x1c')]();});}};}function handleEntityNotFound(_0x1e6779,_0x388442){return function(_0x465207){if(!_0x465207){_0x1e6779[_0xc9b9('0x1a')](0x194);}return _0x465207;};}function handleError(_0x512bff,_0x5fa283){_0x5fa283=_0x5fa283||0x1f4;return function(_0x1d6951){logger[_0xc9b9('0x28')](_0x1d6951['stack']);if(_0x1d6951[_0xc9b9('0x29')]){delete _0x1d6951[_0xc9b9('0x29')];}_0x512bff[_0xc9b9('0x1b')](_0x5fa283)[_0xc9b9('0x2a')](_0x1d6951);};}exports[_0xc9b9('0x2b')]=function(_0x56fa07,_0x4b7830){var _0x74490e={},_0x2d7d89={},_0x2666bf={'count':0x0,'rows':[]};var _0x68aedd=_[_0xc9b9('0x2c')](db[_0xc9b9('0x2d')]['rawAttributes'],function(_0x19ba34){return{'name':_0x19ba34['fieldName'],'type':_0x19ba34[_0xc9b9('0x2e')][_0xc9b9('0x2f')]};});_0x2d7d89['model']=_[_0xc9b9('0x2c')](_0x68aedd,_0xc9b9('0x29'));_0x2d7d89[_0xc9b9('0x30')]=_[_0xc9b9('0x31')](_0x56fa07['query']);_0x2d7d89[_0xc9b9('0x32')]=_[_0xc9b9('0x33')](_0x2d7d89[_0xc9b9('0x34')],_0x2d7d89['query']);_0x74490e[_0xc9b9('0x35')]=_[_0xc9b9('0x33')](_0x2d7d89[_0xc9b9('0x34')],qs[_0xc9b9('0x36')](_0x56fa07[_0xc9b9('0x30')][_0xc9b9('0x36')]));_0x74490e[_0xc9b9('0x35')]=_0x74490e[_0xc9b9('0x35')][_0xc9b9('0x37')]?_0x74490e['attributes']:_0x2d7d89['model'];if(!_0x56fa07['query'][_0xc9b9('0x38')](_0xc9b9('0x39'))){_0x74490e[_0xc9b9('0x20')]=qs['limit'](_0x56fa07[_0xc9b9('0x30')][_0xc9b9('0x20')]);_0x74490e[_0xc9b9('0x1f')]=qs[_0xc9b9('0x1f')](_0x56fa07[_0xc9b9('0x30')][_0xc9b9('0x1f')]);}_0x74490e[_0xc9b9('0x3a')]=qs[_0xc9b9('0x3b')](_0x56fa07[_0xc9b9('0x30')][_0xc9b9('0x3b')]);_0x74490e['where']=qs[_0xc9b9('0x32')](_[_0xc9b9('0x3c')](_0x56fa07[_0xc9b9('0x30')],_0x2d7d89[_0xc9b9('0x32')]),_0x68aedd);if(_0x56fa07[_0xc9b9('0x30')][_0xc9b9('0x3d')]){_0x74490e['where']=_['merge'](_0x74490e[_0xc9b9('0x3e')],{'$or':_[_0xc9b9('0x2c')](_0x68aedd,function(_0x253604){if(_0x253604['type']!==_0xc9b9('0x3f')){var _0x18b56f={};_0x18b56f[_0x253604['name']]={'$like':'%'+_0x56fa07[_0xc9b9('0x30')][_0xc9b9('0x3d')]+'%'};return _0x18b56f;}})});}_0x74490e=_[_0xc9b9('0x40')]({},_0x74490e,_0x56fa07[_0xc9b9('0x41')]);var _0x3286d5={'where':_0x74490e[_0xc9b9('0x3e')]};return db['AnalyticFieldReport'][_0xc9b9('0x1e')](_0x3286d5)[_0xc9b9('0x26')](function(_0x28bef2){_0x2666bf[_0xc9b9('0x1e')]=_0x28bef2;if(_0x56fa07['query'][_0xc9b9('0x42')]){_0x74490e[_0xc9b9('0x43')]=[{'all':!![]}];}return db[_0xc9b9('0x2d')][_0xc9b9('0x44')](_0x74490e);})['then'](function(_0x564fd0){_0x2666bf[_0xc9b9('0x45')]=_0x564fd0;return _0x2666bf;})['then'](respondWithFilteredResult(_0x4b7830,_0x74490e))[_0xc9b9('0x46')](handleError(_0x4b7830,null));};exports['show']=function(_0x551916,_0x16806b){var _0x59c1c6={'raw':![],'where':{'id':_0x551916['params']['id']}},_0x126566={};_0x126566[_0xc9b9('0x34')]=_[_0xc9b9('0x31')](db[_0xc9b9('0x2d')][_0xc9b9('0x47')]);_0x126566[_0xc9b9('0x30')]=_[_0xc9b9('0x31')](_0x551916['query']);_0x126566[_0xc9b9('0x32')]=_[_0xc9b9('0x33')](_0x126566['model'],_0x126566['query']);_0x59c1c6[_0xc9b9('0x35')]=_['intersection'](_0x126566[_0xc9b9('0x34')],qs[_0xc9b9('0x36')](_0x551916['query']['fields']));_0x59c1c6[_0xc9b9('0x35')]=_0x59c1c6[_0xc9b9('0x35')][_0xc9b9('0x37')]?_0x59c1c6['attributes']:_0x126566[_0xc9b9('0x34')];if(_0x551916['query'][_0xc9b9('0x42')]){_0x59c1c6[_0xc9b9('0x43')]=[{'all':!![]}];}_0x59c1c6=_['merge']({},_0x59c1c6,_0x551916[_0xc9b9('0x41')]);return db[_0xc9b9('0x2d')]['find'](_0x59c1c6)['then'](handleEntityNotFound(_0x16806b,null))['then'](respondWithResult(_0x16806b,null))['catch'](handleError(_0x16806b,null));};exports[_0xc9b9('0x48')]=function(_0x5c50c1,_0xe1d6b3){return db[_0xc9b9('0x2d')]['create'](_0x5c50c1[_0xc9b9('0x49')],{})['then'](respondWithResult(_0xe1d6b3,0xc9))[_0xc9b9('0x46')](handleError(_0xe1d6b3,null));};exports['bulkCreate']=function(_0xb2cb1b,_0x57c79f){return db[_0xc9b9('0x2d')][_0xc9b9('0x4a')](_0xb2cb1b[_0xc9b9('0x49')],{'raw':![],'individualHooks':!![]})[_0xc9b9('0x26')](respondWithResult(_0x57c79f,0xc9))[_0xc9b9('0x46')](handleError(_0x57c79f,null));};exports[_0xc9b9('0x4b')]=function(_0x2914d5,_0x1d577e){if(_0x2914d5[_0xc9b9('0x49')]['id']){delete _0x2914d5[_0xc9b9('0x49')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x2914d5[_0xc9b9('0x4c')]['id']}})[_0xc9b9('0x26')](handleEntityNotFound(_0x1d577e,null))[_0xc9b9('0x26')](saveUpdates(_0x2914d5[_0xc9b9('0x49')],null))[_0xc9b9('0x26')](respondWithResult(_0x1d577e,null))[_0xc9b9('0x46')](handleError(_0x1d577e,null));};exports[_0xc9b9('0x27')]=function(_0x57da96,_0x1864dc){return db['AnalyticFieldReport'][_0xc9b9('0x4d')]({'where':{'id':_0x57da96[_0xc9b9('0x4c')]['id']}})[_0xc9b9('0x26')](handleEntityNotFound(_0x1864dc,null))['then'](removeEntity(_0x1864dc,null))['catch'](handleError(_0x1864dc,null));};exports[_0xc9b9('0x4e')]=function(_0x44174c,_0x33f53f){return db[_0xc9b9('0x2d')][_0xc9b9('0x27')]({'where':{'id':_0x44174c['query'][_0xc9b9('0x4f')]||[]},'raw':![],'individualHooks':!![]})[_0xc9b9('0x26')](respondWithResult(_0x33f53f,0xcc))[_0xc9b9('0x46')](handleError(_0x33f53f,null));};exports['addFields']=function(_0x18814b,_0x380b9d,_0x28243f){return db[_0xc9b9('0x50')][_0xc9b9('0x51')]({'where':{'id':_0x18814b[_0xc9b9('0x4c')]['id']}})[_0xc9b9('0x26')](handleEntityNotFound(_0x380b9d,null))[_0xc9b9('0x26')](function(_0x1e85a2){if(_0x1e85a2){return db['sequelize'][_0xc9b9('0x52')](function(_0x421c73){return db['AnalyticFieldReport'][_0xc9b9('0x27')]({'where':{'CustomReportId':_0x18814b[_0xc9b9('0x4c')]['id']},'transaction':_0x421c73})[_0xc9b9('0x26')](function(_0x2c775e){var _0x2d1dda=_['map'](_0x18814b[_0xc9b9('0x49')],function(_0x3b8ea3){delete _0x3b8ea3['id'];_0x3b8ea3['CustomReportId']=_0x18814b[_0xc9b9('0x4c')]['id'];return _0x3b8ea3;});return db[_0xc9b9('0x2d')]['bulkCreate'](_0x2d1dda,{'transaction':_0x421c73});});})[_0xc9b9('0x26')](function(){return db[_0xc9b9('0x2d')][_0xc9b9('0x44')]({'where':{'CustomReportId':_0x18814b[_0xc9b9('0x4c')]['id']}});});}})[_0xc9b9('0x26')](respondWithResult(_0x380b9d,null))[_0xc9b9('0x46')](handleError(_0x380b9d,null));}; \ No newline at end of file +var _0xe349=['name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','AnalyticFieldReport','includeAll','include','findAll','rows','catch','params','find','create','body','bulkCreate','bulkDestroy','destroy','AnalyticCustomReport','transaction','CustomReportId','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then'];(function(_0x6e88,_0x1ce399){var _0x3234fc=function(_0x52cf46){while(--_0x52cf46){_0x6e88['push'](_0x6e88['shift']());}};_0x3234fc(++_0x1ce399);}(_0xe349,0x107));var _0x9e34=function(_0x305b20,_0x5e57e9){_0x305b20=_0x305b20-0x0;var _0x26d64a=_0xe349[_0x305b20];return _0x26d64a;};'use strict';var pdf=require(_0x9e34('0x0'));var emlformat=require(_0x9e34('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9e34('0x2'));var jsonpatch=require(_0x9e34('0x3'));var rp=require(_0x9e34('0x4'));var moment=require('moment');var BPromise=require(_0x9e34('0x5'));var Mustache=require(_0x9e34('0x6'));var util=require(_0x9e34('0x7'));var path=require(_0x9e34('0x8'));var sox=require('sox');var csv=require(_0x9e34('0x9'));var ejs=require(_0x9e34('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9e34('0xb'));var crypto=require(_0x9e34('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9e34('0xd'));var toCsv=require(_0x9e34('0x9'));var querystring=require(_0x9e34('0xe'));var Papa=require('papaparse');var Redis=require(_0x9e34('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9e34('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e34('0x11'))(_0x9e34('0x12'));var utils=require(_0x9e34('0x13'));var config=require('../../config/environment');var db=require(_0x9e34('0x14'))['db'];function respondWithStatusCode(_0x29273d,_0x20bae9){_0x20bae9=_0x20bae9||0xcc;return function(_0x390228){if(_0x390228){return _0x29273d[_0x9e34('0x15')](_0x20bae9);}return _0x29273d[_0x9e34('0x16')](_0x20bae9)[_0x9e34('0x17')]();};}function respondWithResult(_0x11d885,_0x2d6935){_0x2d6935=_0x2d6935||0xc8;return function(_0x46714e){if(_0x46714e){return _0x11d885['status'](_0x2d6935)[_0x9e34('0x18')](_0x46714e);}};}function respondWithFilteredResult(_0x138821,_0x3dacdc){return function(_0x1ba415){if(_0x1ba415){var _0x58105f=_0x1ba415[_0x9e34('0x19')],_0x56d17e=_0x3dacdc[_0x9e34('0x1a')],_0x37f585=_0x3dacdc[_0x9e34('0x1a')]+_0x3dacdc[_0x9e34('0x1b')],_0xb64fb7;if(_0x37f585>=_0x58105f){_0x37f585=_0x58105f;_0xb64fb7=0xc8;}else{_0xb64fb7=0xce;}_0x138821[_0x9e34('0x16')](_0xb64fb7);return _0x138821['set'](_0x9e34('0x1c'),_0x56d17e+'-'+_0x37f585+'/'+_0x58105f)[_0x9e34('0x18')](_0x1ba415);}return null;};}function patchUpdates(_0x1924a0){return function(_0x36db44){try{jsonpatch[_0x9e34('0x1d')](_0x36db44,_0x1924a0,!![]);}catch(_0x274239){return BPromise[_0x9e34('0x1e')](_0x274239);}return _0x36db44['save']();};}function saveUpdates(_0x41a564,_0x247bd5){return function(_0x3ffb79){if(_0x3ffb79){return _0x3ffb79[_0x9e34('0x1f')](_0x41a564)[_0x9e34('0x20')](function(_0x199000){return _0x199000;});}return null;};}function removeEntity(_0x42e39b,_0x16a6f2){return function(_0x284f59){if(_0x284f59){return _0x284f59['destroy']()[_0x9e34('0x20')](function(){_0x42e39b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x249abb,_0x54238d){return function(_0x17f078){if(!_0x17f078){_0x249abb[_0x9e34('0x15')](0x194);}return _0x17f078;};}function handleError(_0x19799a,_0x3a7dba){_0x3a7dba=_0x3a7dba||0x1f4;return function(_0x29aafb){logger['error'](_0x29aafb['stack']);if(_0x29aafb[_0x9e34('0x21')]){delete _0x29aafb['name'];}_0x19799a[_0x9e34('0x16')](_0x3a7dba)[_0x9e34('0x22')](_0x29aafb);};}exports[_0x9e34('0x23')]=function(_0x3c9c61,_0x50cb82){var _0x402df6={},_0x5f3e2b={},_0xc96f09={'count':0x0,'rows':[]};var _0x5c094d=_[_0x9e34('0x24')](db['AnalyticFieldReport'][_0x9e34('0x25')],function(_0x2b9adf){return{'name':_0x2b9adf[_0x9e34('0x26')],'type':_0x2b9adf[_0x9e34('0x27')]['key']};});_0x5f3e2b[_0x9e34('0x28')]=_[_0x9e34('0x24')](_0x5c094d,_0x9e34('0x21'));_0x5f3e2b[_0x9e34('0x29')]=_[_0x9e34('0x2a')](_0x3c9c61['query']);_0x5f3e2b['filters']=_[_0x9e34('0x2b')](_0x5f3e2b[_0x9e34('0x28')],_0x5f3e2b[_0x9e34('0x29')]);_0x402df6['attributes']=_[_0x9e34('0x2b')](_0x5f3e2b[_0x9e34('0x28')],qs[_0x9e34('0x2c')](_0x3c9c61[_0x9e34('0x29')][_0x9e34('0x2c')]));_0x402df6['attributes']=_0x402df6[_0x9e34('0x2d')][_0x9e34('0x2e')]?_0x402df6[_0x9e34('0x2d')]:_0x5f3e2b[_0x9e34('0x28')];if(!_0x3c9c61[_0x9e34('0x29')][_0x9e34('0x2f')](_0x9e34('0x30'))){_0x402df6[_0x9e34('0x1b')]=qs['limit'](_0x3c9c61[_0x9e34('0x29')][_0x9e34('0x1b')]);_0x402df6[_0x9e34('0x1a')]=qs[_0x9e34('0x1a')](_0x3c9c61[_0x9e34('0x29')][_0x9e34('0x1a')]);}_0x402df6[_0x9e34('0x31')]=qs[_0x9e34('0x32')](_0x3c9c61[_0x9e34('0x29')][_0x9e34('0x32')]);_0x402df6[_0x9e34('0x33')]=qs[_0x9e34('0x34')](_[_0x9e34('0x35')](_0x3c9c61[_0x9e34('0x29')],_0x5f3e2b['filters']),_0x5c094d);if(_0x3c9c61[_0x9e34('0x29')][_0x9e34('0x36')]){_0x402df6[_0x9e34('0x33')]=_['merge'](_0x402df6['where'],{'$or':_['map'](_0x5c094d,function(_0x1b887a){if(_0x1b887a[_0x9e34('0x27')]!==_0x9e34('0x37')){var _0x4010c1={};_0x4010c1[_0x1b887a[_0x9e34('0x21')]]={'$like':'%'+_0x3c9c61['query'][_0x9e34('0x36')]+'%'};return _0x4010c1;}})});}_0x402df6=_[_0x9e34('0x38')]({},_0x402df6,_0x3c9c61[_0x9e34('0x39')]);var _0x2101e4={'where':_0x402df6['where']};return db[_0x9e34('0x3a')]['count'](_0x2101e4)[_0x9e34('0x20')](function(_0x4d295c){_0xc96f09[_0x9e34('0x19')]=_0x4d295c;if(_0x3c9c61[_0x9e34('0x29')][_0x9e34('0x3b')]){_0x402df6[_0x9e34('0x3c')]=[{'all':!![]}];}return db[_0x9e34('0x3a')][_0x9e34('0x3d')](_0x402df6);})[_0x9e34('0x20')](function(_0x15fc8b){_0xc96f09[_0x9e34('0x3e')]=_0x15fc8b;return _0xc96f09;})[_0x9e34('0x20')](respondWithFilteredResult(_0x50cb82,_0x402df6))[_0x9e34('0x3f')](handleError(_0x50cb82,null));};exports['show']=function(_0x540ada,_0x406d74){var _0x370351={'raw':![],'where':{'id':_0x540ada[_0x9e34('0x40')]['id']}},_0xd6156d={};_0xd6156d[_0x9e34('0x28')]=_[_0x9e34('0x2a')](db[_0x9e34('0x3a')][_0x9e34('0x25')]);_0xd6156d['query']=_[_0x9e34('0x2a')](_0x540ada['query']);_0xd6156d[_0x9e34('0x34')]=_[_0x9e34('0x2b')](_0xd6156d['model'],_0xd6156d['query']);_0x370351['attributes']=_[_0x9e34('0x2b')](_0xd6156d[_0x9e34('0x28')],qs[_0x9e34('0x2c')](_0x540ada[_0x9e34('0x29')][_0x9e34('0x2c')]));_0x370351[_0x9e34('0x2d')]=_0x370351[_0x9e34('0x2d')]['length']?_0x370351[_0x9e34('0x2d')]:_0xd6156d[_0x9e34('0x28')];if(_0x540ada['query']['includeAll']){_0x370351[_0x9e34('0x3c')]=[{'all':!![]}];}_0x370351=_[_0x9e34('0x38')]({},_0x370351,_0x540ada[_0x9e34('0x39')]);return db['AnalyticFieldReport'][_0x9e34('0x41')](_0x370351)[_0x9e34('0x20')](handleEntityNotFound(_0x406d74,null))['then'](respondWithResult(_0x406d74,null))[_0x9e34('0x3f')](handleError(_0x406d74,null));};exports[_0x9e34('0x42')]=function(_0x3893a3,_0x10d9ee){return db['AnalyticFieldReport'][_0x9e34('0x42')](_0x3893a3[_0x9e34('0x43')],{})['then'](respondWithResult(_0x10d9ee,0xc9))[_0x9e34('0x3f')](handleError(_0x10d9ee,null));};exports[_0x9e34('0x44')]=function(_0x3bf177,_0x243792){return db[_0x9e34('0x3a')][_0x9e34('0x44')](_0x3bf177['body'],{'raw':![],'individualHooks':!![]})[_0x9e34('0x20')](respondWithResult(_0x243792,0xc9))[_0x9e34('0x3f')](handleError(_0x243792,null));};exports[_0x9e34('0x1f')]=function(_0x35f012,_0x105cc9){if(_0x35f012[_0x9e34('0x43')]['id']){delete _0x35f012[_0x9e34('0x43')]['id'];}return db[_0x9e34('0x3a')][_0x9e34('0x41')]({'where':{'id':_0x35f012[_0x9e34('0x40')]['id']}})['then'](handleEntityNotFound(_0x105cc9,null))[_0x9e34('0x20')](saveUpdates(_0x35f012['body'],null))[_0x9e34('0x20')](respondWithResult(_0x105cc9,null))['catch'](handleError(_0x105cc9,null));};exports['destroy']=function(_0xc60d09,_0x5ed69b){return db['AnalyticFieldReport']['find']({'where':{'id':_0xc60d09[_0x9e34('0x40')]['id']}})[_0x9e34('0x20')](handleEntityNotFound(_0x5ed69b,null))[_0x9e34('0x20')](removeEntity(_0x5ed69b,null))['catch'](handleError(_0x5ed69b,null));};exports[_0x9e34('0x45')]=function(_0x5e61e1,_0x293f57){return db[_0x9e34('0x3a')][_0x9e34('0x46')]({'where':{'id':_0x5e61e1[_0x9e34('0x29')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x9e34('0x20')](respondWithResult(_0x293f57,0xcc))[_0x9e34('0x3f')](handleError(_0x293f57,null));};exports['addFields']=function(_0x9a2f24,_0x25d46d,_0x59282c){return db[_0x9e34('0x47')]['findOne']({'where':{'id':_0x9a2f24['params']['id']}})[_0x9e34('0x20')](handleEntityNotFound(_0x25d46d,null))[_0x9e34('0x20')](function(_0x2ea3c4){if(_0x2ea3c4){return db['sequelize'][_0x9e34('0x48')](function(_0x205bc6){return db[_0x9e34('0x3a')][_0x9e34('0x46')]({'where':{'CustomReportId':_0x9a2f24[_0x9e34('0x40')]['id']},'transaction':_0x205bc6})[_0x9e34('0x20')](function(_0x5dc369){var _0x5eb95a=_[_0x9e34('0x24')](_0x9a2f24['body'],function(_0x56bb6f){delete _0x56bb6f['id'];_0x56bb6f[_0x9e34('0x49')]=_0x9a2f24[_0x9e34('0x40')]['id'];return _0x56bb6f;});return db[_0x9e34('0x3a')][_0x9e34('0x44')](_0x5eb95a,{'transaction':_0x205bc6});});})[_0x9e34('0x20')](function(){return db['AnalyticFieldReport'][_0x9e34('0x3d')]({'where':{'CustomReportId':_0x9a2f24[_0x9e34('0x40')]['id']}});});}})[_0x9e34('0x20')](respondWithResult(_0x25d46d,null))[_0x9e34('0x3f')](handleError(_0x25d46d,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 5b9f4da..cbcb0dc 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 _0x6410=['request-promise','path','rimraf','../../config/environment','exports','define','AnalyticFieldReport','lodash','util','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6410,0x19e));var _0x0641=function(_0x7c7cd8,_0x215d30){_0x7c7cd8=_0x7c7cd8-0x0;var _0x31e062=_0x6410[_0x7c7cd8];return _0x31e062;};'use strict';var _=require(_0x0641('0x0'));var util=require(_0x0641('0x1'));var logger=require('../../config/logger')(_0x0641('0x2'));var moment=require(_0x0641('0x3'));var BPromise=require('bluebird');var rp=require(_0x0641('0x4'));var fs=require('fs');var path=require(_0x0641('0x5'));var rimraf=require(_0x0641('0x6'));var config=require(_0x0641('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0x0641('0x8')]=function(_0x406526,_0x5f3450){return _0x406526[_0x0641('0x9')](_0x0641('0xa'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa869=['AnalyticFieldReport','moment','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes','define'];(function(_0xb06354,_0x464d11){var _0x44da6c=function(_0x1c900f){while(--_0x1c900f){_0xb06354['push'](_0xb06354['shift']());}};_0x44da6c(++_0x464d11);}(_0xa869,0xc9));var _0x9a86=function(_0x3de67b,_0x31ce94){_0x3de67b=_0x3de67b-0x0;var _0xd6690d=_0xa869[_0x3de67b];return _0xd6690d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9a86('0x0'));var BPromise=require(_0x9a86('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a86('0x2'));var rimraf=require(_0x9a86('0x3'));var config=require(_0x9a86('0x4'));var attributes=require(_0x9a86('0x5'));module['exports']=function(_0x53da11,_0x374bf2){return _0x53da11[_0x9a86('0x6')](_0x9a86('0x7'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 16ab3cb..d9b9456 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 _0x30bc=['../../config/environment','jayson/promise','http','request','then','info','debug','request\x20sent','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc'];(function(_0xb7bd60,_0x12d00d){var _0x24129f=function(_0x5ccd53){while(--_0x5ccd53){_0xb7bd60['push'](_0xb7bd60['shift']());}};_0x24129f(++_0x12d00d);}(_0x30bc,0x77));var _0xc30b=function(_0x2bbbc2,_0x2fd8b9){_0x2bbbc2=_0x2bbbc2-0x0;var _0x1f0319=_0x30bc[_0x2bbbc2];return _0x1f0319;};'use strict';var _=require(_0xc30b('0x0'));var util=require(_0xc30b('0x1'));var moment=require(_0xc30b('0x2'));var BPromise=require('bluebird');var rs=require(_0xc30b('0x3'));var fs=require('fs');var Redis=require(_0xc30b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc30b('0x5'));var logger=require('../../config/logger')(_0xc30b('0x6'));var config=require(_0xc30b('0x7'));var jayson=require(_0xc30b('0x8'));var client=jayson['client'][_0xc30b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x240465,_0x2426bb,_0xaa601b){return new BPromise(function(_0x4b9f81,_0x390de2){return client[_0xc30b('0xa')](_0x240465,_0xaa601b)[_0xc30b('0xb')](function(_0x2e58af){logger[_0xc30b('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2426bb,'request\x20sent');logger[_0xc30b('0xd')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x2426bb,_0xc30b('0xe'),JSON[_0xc30b('0xf')](_0x2e58af));if(_0x2e58af[_0xc30b('0x10')]){if(_0x2e58af[_0xc30b('0x10')][_0xc30b('0x11')]===0x1f4){logger[_0xc30b('0x10')](_0xc30b('0x12'),_0x2426bb,_0x2e58af[_0xc30b('0x10')][_0xc30b('0x13')]);return _0x390de2(_0x2e58af[_0xc30b('0x10')][_0xc30b('0x13')]);}logger[_0xc30b('0x10')](_0xc30b('0x12'),_0x2426bb,_0x2e58af['error'][_0xc30b('0x13')]);return _0x4b9f81(_0x2e58af[_0xc30b('0x10')]['message']);}else{logger[_0xc30b('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2426bb,_0xc30b('0xe'));_0x4b9f81(_0x2e58af['result'][_0xc30b('0x13')]);}})[_0xc30b('0x14')](function(_0x378cc1){logger[_0xc30b('0x10')](_0xc30b('0x12'),_0x2426bb,_0x378cc1);_0x390de2(_0x378cc1);});});} \ No newline at end of file +var _0x4242=['code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x5ef41f,_0x58d805){var _0x5ae625=function(_0x62d0d0){while(--_0x62d0d0){_0x5ef41f['push'](_0x5ef41f['shift']());}};_0x5ae625(++_0x58d805);}(_0x4242,0xb8));var _0x2424=function(_0x7c19a5,_0x3ac5c9){_0x7c19a5=_0x7c19a5-0x0;var _0x24fb27=_0x4242[_0x7c19a5];return _0x24fb27;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2424('0x0'));var BPromise=require(_0x2424('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2424('0x2'));var db=require(_0x2424('0x3'))['db'];var utils=require(_0x2424('0x4'));var logger=require('../../config/logger')(_0x2424('0x5'));var config=require('../../config/environment');var jayson=require(_0x2424('0x6'));var client=jayson[_0x2424('0x7')][_0x2424('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3eed8e,_0x50dac3,_0x20ddb){return new BPromise(function(_0x1106a1,_0x5a9b94){return client[_0x2424('0x9')](_0x3eed8e,_0x20ddb)[_0x2424('0xa')](function(_0x2ee088){logger[_0x2424('0xb')](_0x2424('0xc'),_0x50dac3,_0x2424('0xd'));logger['debug'](_0x2424('0xe'),_0x50dac3,_0x2424('0xd'),JSON['stringify'](_0x2ee088));if(_0x2ee088[_0x2424('0xf')]){if(_0x2ee088['error'][_0x2424('0x10')]===0x1f4){logger[_0x2424('0xf')](_0x2424('0xc'),_0x50dac3,_0x2ee088['error'][_0x2424('0x11')]);return _0x5a9b94(_0x2ee088['error'][_0x2424('0x11')]);}logger[_0x2424('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x50dac3,_0x2ee088[_0x2424('0xf')][_0x2424('0x11')]);return _0x1106a1(_0x2ee088[_0x2424('0xf')][_0x2424('0x11')]);}else{logger[_0x2424('0xb')](_0x2424('0xc'),_0x50dac3,_0x2424('0xd'));_0x1106a1(_0x2ee088[_0x2424('0x12')]['message']);}})[_0x2424('0x13')](function(_0xdb0146){logger[_0x2424('0xf')](_0x2424('0xc'),_0x50dac3,_0xdb0146);_0x5a9b94(_0xdb0146);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 60bd598..fa727f6 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['put','update','delete','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','/create_many','bulkCreate','/:id/create_many','addFields'];(function(_0x4375af,_0x1c9918){var _0x138c81=function(_0x2db49c){while(--_0x2db49c){_0x4375af['push'](_0x4375af['shift']());}};_0x138c81(++_0x1c9918);}(_0x7217,0x19e));var _0x7721=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7217[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xc')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0x10'),auth[_0x7721('0x8')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x13')]);router[_0x7721('0x14')]('/destroy_many',auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file +var _0x3e74=['./analyticFieldReport.controller','get','isAuthenticated','index','show','post','create','/create_many','/:id/create_many','addFields','/:id','delete','/destroy_many','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x3d4b07,_0x1c8609){var _0x23f477=function(_0x3a71d4){while(--_0x3a71d4){_0x3d4b07['push'](_0x3d4b07['shift']());}};_0x23f477(++_0x1c8609);}(_0x3e74,0x175));var _0x43e7=function(_0x64b791,_0x54a055){_0x64b791=_0x64b791-0x0;var _0x2a5dbe=_0x3e74[_0x64b791];return _0x2a5dbe;};'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 auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['post'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x43e7('0xa')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router['put'](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller['update']);router[_0x43e7('0x10')](_0x43e7('0x11'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x12')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x13')]);module[_0x43e7('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 32350bb..70b1e66 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 _0x0993=['exports','STRING','name','TEXT','sequelize'];(function(_0x16b6e6,_0x246a57){var _0x53d828=function(_0x126ef3){while(--_0x126ef3){_0x16b6e6['push'](_0x16b6e6['shift']());}};_0x53d828(++_0x246a57);}(_0x0993,0x81));var _0x3099=function(_0x40e7fd,_0x20c401){_0x40e7fd=_0x40e7fd-0x0;var _0x30246f=_0x0993[_0x40e7fd];return _0x30246f;};'use strict';var Sequelize=require(_0x3099('0x0'));module[_0x3099('0x1')]={'name':{'type':Sequelize[_0x3099('0x2')],'allowNull':![],'unique':_0x3099('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x3099('0x4')]},'description':{'type':Sequelize[_0x3099('0x2')]}}; \ No newline at end of file +var _0x3095=['sequelize','exports','STRING','TEXT'];(function(_0x20f4ab,_0x472de6){var _0x2a391d=function(_0x524eda){while(--_0x524eda){_0x20f4ab['push'](_0x20f4ab['shift']());}};_0x2a391d(++_0x472de6);}(_0x3095,0x158));var _0x5309=function(_0x53ba51,_0x2f2321){_0x53ba51=_0x53ba51-0x0;var _0x2e776e=_0x3095[_0x53ba51];return _0x2e776e;};'use strict';var Sequelize=require(_0x5309('0x0'));module[_0x5309('0x1')]={'name':{'type':Sequelize[_0x5309('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x5309('0x3')]},'description':{'type':Sequelize[_0x5309('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 7469b24..92b7555 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 _0x087b=['error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','fast-json-patch','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','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','UserProfileResource','sendStatus'];(function(_0x48ba84,_0xbf40ad){var _0x5decda=function(_0x14e923){while(--_0x14e923){_0x48ba84['push'](_0x48ba84['shift']());}};_0x5decda(++_0xbf40ad);}(_0x087b,0x11a));var _0xb087=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x087b[_0x525c7b];return _0x27b33e;};'use strict';var pdf=require(_0xb087('0x0'));var emlformat=require(_0xb087('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb087('0x2'));var rp=require('request-promise');var moment=require(_0xb087('0x3'));var BPromise=require(_0xb087('0x4'));var Mustache=require(_0xb087('0x5'));var util=require(_0xb087('0x6'));var path=require(_0xb087('0x7'));var sox=require(_0xb087('0x8'));var csv=require(_0xb087('0x9'));var ejs=require(_0xb087('0xa'));var fs=require('fs');var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x9'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x189e2b,_0x31f977){_0x31f977=_0x31f977||0xcc;return function(_0x323656){if(_0x323656){return _0x189e2b['sendStatus'](_0x31f977);}return _0x189e2b[_0xb087('0x1a')](_0x31f977)[_0xb087('0x1b')]();};}function respondWithResult(_0x43f136,_0x46410b){_0x46410b=_0x46410b||0xc8;return function(_0x11784c){if(_0x11784c){return _0x43f136[_0xb087('0x1a')](_0x46410b)[_0xb087('0x1c')](_0x11784c);}};}function respondWithFilteredResult(_0x5147e3,_0x24e1a3){return function(_0x16d0b7){if(_0x16d0b7){var _0x5193a4=_0x16d0b7[_0xb087('0x1d')],_0x43e576=_0x24e1a3[_0xb087('0x1e')],_0x412b48=_0x24e1a3[_0xb087('0x1e')]+_0x24e1a3['limit'],_0x597478;if(_0x412b48>=_0x5193a4){_0x412b48=_0x5193a4;_0x597478=0xc8;}else{_0x597478=0xce;}_0x5147e3[_0xb087('0x1a')](_0x597478);return _0x5147e3[_0xb087('0x1f')](_0xb087('0x20'),_0x43e576+'-'+_0x412b48+'/'+_0x5193a4)[_0xb087('0x1c')](_0x16d0b7);}return null;};}function patchUpdates(_0x4e333b){return function(_0x13d534){try{jsonpatch[_0xb087('0x21')](_0x13d534,_0x4e333b,!![]);}catch(_0x10bb5b){return BPromise[_0xb087('0x22')](_0x10bb5b);}return _0x13d534['save']();};}function saveUpdates(_0x5aeab1,_0x5ea3dc){return function(_0x49450a){if(_0x49450a){return _0x49450a[_0xb087('0x23')](_0x5aeab1)[_0xb087('0x24')](function(_0x3d0f57){return _0x3d0f57;});}return null;};}function removeEntity(_0x1f3c0e,_0x1fb765){return function(_0x258b4c){if(_0x258b4c){return _0x258b4c[_0xb087('0x25')]()['then'](function(){var _0x1d1424=_0x258b4c[_0xb087('0x26')]({'plain':!![]});var _0x1de654=_0xb087('0x27');return db[_0xb087('0x28')]['destroy']({'where':{'type':_0x1de654,'resourceId':_0x1d1424['id']}})[_0xb087('0x24')](function(){return _0x258b4c;});})[_0xb087('0x24')](function(){_0x1f3c0e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50745a,_0x598b99){return function(_0x5a4ee0){if(!_0x5a4ee0){_0x50745a[_0xb087('0x29')](0x194);}return _0x5a4ee0;};}function handleError(_0x45685d,_0x1d124f){_0x1d124f=_0x1d124f||0x1f4;return function(_0x3ca2df){logger[_0xb087('0x2a')](_0x3ca2df[_0xb087('0x2b')]);if(_0x3ca2df[_0xb087('0x2c')]){delete _0x3ca2df[_0xb087('0x2c')];}_0x45685d[_0xb087('0x1a')](_0x1d124f)[_0xb087('0x2d')](_0x3ca2df);};}exports[_0xb087('0x2e')]=function(_0x31e3e6,_0xb0baf6){var _0x263259={},_0x593b78={},_0x37393a={'count':0x0,'rows':[]};var _0x1335d9=_[_0xb087('0x2f')](db[_0xb087('0x30')][_0xb087('0x31')],function(_0xa6d90c){return{'name':_0xa6d90c[_0xb087('0x32')],'type':_0xa6d90c[_0xb087('0x33')]['key']};});_0x593b78['model']=_[_0xb087('0x2f')](_0x1335d9,_0xb087('0x2c'));_0x593b78['query']=_[_0xb087('0x34')](_0x31e3e6[_0xb087('0x35')]);_0x593b78[_0xb087('0x36')]=_[_0xb087('0x37')](_0x593b78[_0xb087('0x38')],_0x593b78[_0xb087('0x35')]);_0x263259[_0xb087('0x39')]=_[_0xb087('0x37')](_0x593b78[_0xb087('0x38')],qs[_0xb087('0x3a')](_0x31e3e6[_0xb087('0x35')][_0xb087('0x3a')]));_0x263259['attributes']=_0x263259[_0xb087('0x39')]['length']?_0x263259[_0xb087('0x39')]:_0x593b78[_0xb087('0x38')];if(!_0x31e3e6[_0xb087('0x35')][_0xb087('0x3b')](_0xb087('0x3c'))){_0x263259[_0xb087('0x3d')]=qs[_0xb087('0x3d')](_0x31e3e6[_0xb087('0x35')][_0xb087('0x3d')]);_0x263259['offset']=qs['offset'](_0x31e3e6[_0xb087('0x35')][_0xb087('0x1e')]);}_0x263259[_0xb087('0x3e')]=qs[_0xb087('0x3f')](_0x31e3e6[_0xb087('0x35')]['sort']);_0x263259[_0xb087('0x40')]=qs[_0xb087('0x36')](_['pick'](_0x31e3e6['query'],_0x593b78[_0xb087('0x36')]),_0x1335d9);if(_0x31e3e6[_0xb087('0x35')][_0xb087('0x41')]){_0x263259['where']=_[_0xb087('0x42')](_0x263259[_0xb087('0x40')],{'$or':_[_0xb087('0x2f')](_0x1335d9,function(_0x1ed2c9){if(_0x1ed2c9[_0xb087('0x33')]!=='VIRTUAL'){var _0x7e1315={};_0x7e1315[_0x1ed2c9['name']]={'$like':'%'+_0x31e3e6[_0xb087('0x35')]['filter']+'%'};return _0x7e1315;}})});}_0x263259=_[_0xb087('0x42')]({},_0x263259,_0x31e3e6[_0xb087('0x43')]);var _0x513332={'where':_0x263259[_0xb087('0x40')]};return db['AnalyticMetric'][_0xb087('0x1d')](_0x513332)['then'](function(_0x2d2c74){_0x37393a[_0xb087('0x1d')]=_0x2d2c74;if(_0x31e3e6[_0xb087('0x35')][_0xb087('0x44')]){_0x263259[_0xb087('0x45')]=[{'all':!![]}];}return db[_0xb087('0x30')][_0xb087('0x46')](_0x263259);})['then'](function(_0x1625f6){_0x37393a['rows']=_0x1625f6;return _0x37393a;})[_0xb087('0x24')](respondWithFilteredResult(_0xb0baf6,_0x263259))[_0xb087('0x47')](handleError(_0xb0baf6,null));};exports['show']=function(_0xb662bf,_0x45dc6f){var _0x7650c5={'raw':!![],'where':{'id':_0xb662bf[_0xb087('0x48')]['id']}},_0x4c33cc={};_0x4c33cc['model']=_[_0xb087('0x34')](db[_0xb087('0x30')]['rawAttributes']);_0x4c33cc[_0xb087('0x35')]=_[_0xb087('0x34')](_0xb662bf['query']);_0x4c33cc[_0xb087('0x36')]=_[_0xb087('0x37')](_0x4c33cc['model'],_0x4c33cc[_0xb087('0x35')]);_0x7650c5[_0xb087('0x39')]=_[_0xb087('0x37')](_0x4c33cc[_0xb087('0x38')],qs['fields'](_0xb662bf['query'][_0xb087('0x3a')]));_0x7650c5[_0xb087('0x39')]=_0x7650c5[_0xb087('0x39')][_0xb087('0x49')]?_0x7650c5[_0xb087('0x39')]:_0x4c33cc[_0xb087('0x38')];if(_0xb662bf['query']['includeAll']){_0x7650c5[_0xb087('0x45')]=[{'all':!![]}];}_0x7650c5=_['merge']({},_0x7650c5,_0xb662bf[_0xb087('0x43')]);return db[_0xb087('0x30')][_0xb087('0x4a')](_0x7650c5)[_0xb087('0x24')](handleEntityNotFound(_0x45dc6f,null))['then'](respondWithResult(_0x45dc6f,null))[_0xb087('0x47')](handleError(_0x45dc6f,null));};exports['create']=function(_0x2fe8a0,_0x73413b){return db[_0xb087('0x30')][_0xb087('0x4b')](_0x2fe8a0[_0xb087('0x4c')],{})['then'](function(_0x21506f){var _0xb15e28=_0x2fe8a0[_0xb087('0x4d')]['get']({'plain':!![]});if(!_0xb15e28)throw new Error(_0xb087('0x4e'));if(_0xb15e28['role']==='user'){var _0x1c9f8f=_0x21506f[_0xb087('0x26')]({'plain':!![]});var _0x5eacf3=_0xb087('0x27');return db[_0xb087('0x4f')][_0xb087('0x4a')]({'where':{'name':_0x5eacf3,'userProfileId':_0xb15e28['userProfileId']},'raw':!![]})['then'](function(_0x30cc83){if(_0x30cc83&&_0x30cc83['autoAssociation']===0x0){return db['UserProfileResource'][_0xb087('0x4b')]({'name':_0x1c9f8f[_0xb087('0x2c')],'resourceId':_0x1c9f8f['id'],'type':_0x30cc83[_0xb087('0x2c')],'sectionId':_0x30cc83['id']},{})[_0xb087('0x24')](function(){return _0x21506f;});}else{return _0x21506f;}})[_0xb087('0x47')](function(_0x148642){logger[_0xb087('0x2a')](_0xb087('0x50'),_0x148642);throw _0x148642;});}return _0x21506f;})[_0xb087('0x24')](respondWithResult(_0x73413b,0xc9))[_0xb087('0x47')](handleError(_0x73413b,null));};exports[_0xb087('0x23')]=function(_0x2cfc44,_0x55e653){if(_0x2cfc44[_0xb087('0x4c')]['id']){delete _0x2cfc44[_0xb087('0x4c')]['id'];}return db['AnalyticMetric'][_0xb087('0x4a')]({'where':{'id':_0x2cfc44[_0xb087('0x48')]['id']}})[_0xb087('0x24')](handleEntityNotFound(_0x55e653,null))[_0xb087('0x24')](saveUpdates(_0x2cfc44[_0xb087('0x4c')],null))[_0xb087('0x24')](respondWithResult(_0x55e653,null))[_0xb087('0x47')](handleError(_0x55e653,null));};exports[_0xb087('0x25')]=function(_0x2b4f9e,_0x357616){return db[_0xb087('0x30')]['find']({'where':{'id':_0x2b4f9e[_0xb087('0x48')]['id']}})['then'](handleEntityNotFound(_0x357616,null))[_0xb087('0x24')](removeEntity(_0x357616,null))['catch'](handleError(_0x357616,null));}; \ No newline at end of file +var _0x1eba=['zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','Metrics','UserProfileResource','destroy','end','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','show','params','length','options','find','catch','create','body','user','get','role','UserProfileSection','userProfileId','error','update','html-pdf','eml-format','rimraf'];(function(_0x170eed,_0x529147){var _0x517f3b=function(_0x2f3bf2){while(--_0x2f3bf2){_0x170eed['push'](_0x170eed['shift']());}};_0x517f3b(++_0x529147);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0x1eba[_0x3df223];return _0x562d11;};'use strict';var pdf=require(_0xa1eb('0x0'));var emlformat=require(_0xa1eb('0x1'));var rimraf=require(_0xa1eb('0x2'));var zipdir=require(_0xa1eb('0x3'));var jsonpatch=require(_0xa1eb('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa1eb('0x5'));var Mustache=require(_0xa1eb('0x6'));var util=require(_0xa1eb('0x7'));var path=require(_0xa1eb('0x8'));var sox=require(_0xa1eb('0x9'));var csv=require(_0xa1eb('0xa'));var ejs=require(_0xa1eb('0xb'));var fs=require('fs');var _=require(_0xa1eb('0xc'));var squel=require(_0xa1eb('0xd'));var crypto=require(_0xa1eb('0xe'));var jsforce=require(_0xa1eb('0xf'));var deskjs=require(_0xa1eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xa1eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1eb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1eb('0x14'));var logger=require('../../config/logger')(_0xa1eb('0x15'));var utils=require(_0xa1eb('0x16'));var config=require(_0xa1eb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e28e7,_0x39b4a3){_0x39b4a3=_0x39b4a3||0xcc;return function(_0x5df92d){if(_0x5df92d){return _0x1e28e7[_0xa1eb('0x18')](_0x39b4a3);}return _0x1e28e7['status'](_0x39b4a3)['end']();};}function respondWithResult(_0x35a353,_0x4c7983){_0x4c7983=_0x4c7983||0xc8;return function(_0x25d058){if(_0x25d058){return _0x35a353[_0xa1eb('0x19')](_0x4c7983)[_0xa1eb('0x1a')](_0x25d058);}};}function respondWithFilteredResult(_0x2877cb,_0x3cd675){return function(_0x44f37d){if(_0x44f37d){var _0x1c858c=_0x44f37d[_0xa1eb('0x1b')],_0x45d6dd=_0x3cd675['offset'],_0x211e42=_0x3cd675[_0xa1eb('0x1c')]+_0x3cd675[_0xa1eb('0x1d')],_0x4aa527;if(_0x211e42>=_0x1c858c){_0x211e42=_0x1c858c;_0x4aa527=0xc8;}else{_0x4aa527=0xce;}_0x2877cb[_0xa1eb('0x19')](_0x4aa527);return _0x2877cb[_0xa1eb('0x1e')]('Content-Range',_0x45d6dd+'-'+_0x211e42+'/'+_0x1c858c)[_0xa1eb('0x1a')](_0x44f37d);}return null;};}function patchUpdates(_0x22cd44){return function(_0x83ed15){try{jsonpatch[_0xa1eb('0x1f')](_0x83ed15,_0x22cd44,!![]);}catch(_0x3d0961){return BPromise[_0xa1eb('0x20')](_0x3d0961);}return _0x83ed15[_0xa1eb('0x21')]();};}function saveUpdates(_0x166f7f,_0x4fc14a){return function(_0x137e2c){if(_0x137e2c){return _0x137e2c['update'](_0x166f7f)[_0xa1eb('0x22')](function(_0x215e7f){return _0x215e7f;});}return null;};}function removeEntity(_0x350a08,_0x250f99){return function(_0x5e7a34){if(_0x5e7a34){return _0x5e7a34['destroy']()[_0xa1eb('0x22')](function(){var _0xc64cb9=_0x5e7a34['get']({'plain':!![]});var _0x437b2a=_0xa1eb('0x23');return db[_0xa1eb('0x24')][_0xa1eb('0x25')]({'where':{'type':_0x437b2a,'resourceId':_0xc64cb9['id']}})[_0xa1eb('0x22')](function(){return _0x5e7a34;});})[_0xa1eb('0x22')](function(){_0x350a08[_0xa1eb('0x19')](0xcc)[_0xa1eb('0x26')]();});}};}function handleEntityNotFound(_0xd7bb88,_0x352796){return function(_0xb77fd6){if(!_0xb77fd6){_0xd7bb88[_0xa1eb('0x18')](0x194);}return _0xb77fd6;};}function handleError(_0x57d089,_0x7c617e){_0x7c617e=_0x7c617e||0x1f4;return function(_0xbd5517){logger['error'](_0xbd5517[_0xa1eb('0x27')]);if(_0xbd5517['name']){delete _0xbd5517[_0xa1eb('0x28')];}_0x57d089[_0xa1eb('0x19')](_0x7c617e)['send'](_0xbd5517);};}exports[_0xa1eb('0x29')]=function(_0x1581ee,_0x136835){var _0x4f64bb={},_0x12cf56={},_0x41b3ad={'count':0x0,'rows':[]};var _0x55f5cc=_[_0xa1eb('0x2a')](db[_0xa1eb('0x2b')][_0xa1eb('0x2c')],function(_0x2e281a){return{'name':_0x2e281a[_0xa1eb('0x2d')],'type':_0x2e281a['type'][_0xa1eb('0x2e')]};});_0x12cf56[_0xa1eb('0x2f')]=_[_0xa1eb('0x2a')](_0x55f5cc,_0xa1eb('0x28'));_0x12cf56[_0xa1eb('0x30')]=_[_0xa1eb('0x31')](_0x1581ee[_0xa1eb('0x30')]);_0x12cf56[_0xa1eb('0x32')]=_[_0xa1eb('0x33')](_0x12cf56[_0xa1eb('0x2f')],_0x12cf56[_0xa1eb('0x30')]);_0x4f64bb['attributes']=_['intersection'](_0x12cf56[_0xa1eb('0x2f')],qs[_0xa1eb('0x34')](_0x1581ee[_0xa1eb('0x30')][_0xa1eb('0x34')]));_0x4f64bb[_0xa1eb('0x35')]=_0x4f64bb['attributes']['length']?_0x4f64bb[_0xa1eb('0x35')]:_0x12cf56[_0xa1eb('0x2f')];if(!_0x1581ee['query']['hasOwnProperty'](_0xa1eb('0x36'))){_0x4f64bb['limit']=qs[_0xa1eb('0x1d')](_0x1581ee['query'][_0xa1eb('0x1d')]);_0x4f64bb[_0xa1eb('0x1c')]=qs[_0xa1eb('0x1c')](_0x1581ee['query'][_0xa1eb('0x1c')]);}_0x4f64bb[_0xa1eb('0x37')]=qs[_0xa1eb('0x38')](_0x1581ee['query'][_0xa1eb('0x38')]);_0x4f64bb[_0xa1eb('0x39')]=qs[_0xa1eb('0x32')](_[_0xa1eb('0x3a')](_0x1581ee[_0xa1eb('0x30')],_0x12cf56['filters']),_0x55f5cc);if(_0x1581ee[_0xa1eb('0x30')][_0xa1eb('0x3b')]){_0x4f64bb[_0xa1eb('0x39')]=_[_0xa1eb('0x3c')](_0x4f64bb[_0xa1eb('0x39')],{'$or':_[_0xa1eb('0x2a')](_0x55f5cc,function(_0x14d96b){if(_0x14d96b[_0xa1eb('0x3d')]!=='VIRTUAL'){var _0xdcb56b={};_0xdcb56b[_0x14d96b[_0xa1eb('0x28')]]={'$like':'%'+_0x1581ee[_0xa1eb('0x30')][_0xa1eb('0x3b')]+'%'};return _0xdcb56b;}})});}_0x4f64bb=_[_0xa1eb('0x3c')]({},_0x4f64bb,_0x1581ee['options']);var _0x1fc68a={'where':_0x4f64bb[_0xa1eb('0x39')]};return db[_0xa1eb('0x2b')]['count'](_0x1fc68a)[_0xa1eb('0x22')](function(_0x1b79a1){_0x41b3ad[_0xa1eb('0x1b')]=_0x1b79a1;if(_0x1581ee[_0xa1eb('0x30')][_0xa1eb('0x3e')]){_0x4f64bb[_0xa1eb('0x3f')]=[{'all':!![]}];}return db[_0xa1eb('0x2b')]['findAll'](_0x4f64bb);})[_0xa1eb('0x22')](function(_0x14c37a){_0x41b3ad['rows']=_0x14c37a;return _0x41b3ad;})[_0xa1eb('0x22')](respondWithFilteredResult(_0x136835,_0x4f64bb))['catch'](handleError(_0x136835,null));};exports[_0xa1eb('0x40')]=function(_0x3a6f36,_0x75f7f6){var _0x361675={'raw':!![],'where':{'id':_0x3a6f36[_0xa1eb('0x41')]['id']}},_0x4744a3={};_0x4744a3[_0xa1eb('0x2f')]=_[_0xa1eb('0x31')](db[_0xa1eb('0x2b')][_0xa1eb('0x2c')]);_0x4744a3[_0xa1eb('0x30')]=_[_0xa1eb('0x31')](_0x3a6f36[_0xa1eb('0x30')]);_0x4744a3[_0xa1eb('0x32')]=_[_0xa1eb('0x33')](_0x4744a3[_0xa1eb('0x2f')],_0x4744a3['query']);_0x361675[_0xa1eb('0x35')]=_['intersection'](_0x4744a3[_0xa1eb('0x2f')],qs[_0xa1eb('0x34')](_0x3a6f36['query']['fields']));_0x361675[_0xa1eb('0x35')]=_0x361675[_0xa1eb('0x35')][_0xa1eb('0x42')]?_0x361675['attributes']:_0x4744a3[_0xa1eb('0x2f')];if(_0x3a6f36[_0xa1eb('0x30')][_0xa1eb('0x3e')]){_0x361675[_0xa1eb('0x3f')]=[{'all':!![]}];}_0x361675=_[_0xa1eb('0x3c')]({},_0x361675,_0x3a6f36[_0xa1eb('0x43')]);return db[_0xa1eb('0x2b')][_0xa1eb('0x44')](_0x361675)[_0xa1eb('0x22')](handleEntityNotFound(_0x75f7f6,null))[_0xa1eb('0x22')](respondWithResult(_0x75f7f6,null))[_0xa1eb('0x45')](handleError(_0x75f7f6,null));};exports[_0xa1eb('0x46')]=function(_0x39d3c6,_0x10e15a){return db['AnalyticMetric'][_0xa1eb('0x46')](_0x39d3c6[_0xa1eb('0x47')],{})[_0xa1eb('0x22')](function(_0x977d00){var _0x2b0cbf=_0x39d3c6[_0xa1eb('0x48')][_0xa1eb('0x49')]({'plain':!![]});if(!_0x2b0cbf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b0cbf[_0xa1eb('0x4a')]===_0xa1eb('0x48')){var _0x27021a=_0x977d00[_0xa1eb('0x49')]({'plain':!![]});var _0x8975a1=_0xa1eb('0x23');return db[_0xa1eb('0x4b')][_0xa1eb('0x44')]({'where':{'name':_0x8975a1,'userProfileId':_0x2b0cbf[_0xa1eb('0x4c')]},'raw':!![]})['then'](function(_0x190370){if(_0x190370&&_0x190370['autoAssociation']===0x0){return db[_0xa1eb('0x24')]['create']({'name':_0x27021a[_0xa1eb('0x28')],'resourceId':_0x27021a['id'],'type':_0x190370[_0xa1eb('0x28')],'sectionId':_0x190370['id']},{})[_0xa1eb('0x22')](function(){return _0x977d00;});}else{return _0x977d00;}})['catch'](function(_0x3fbd6c){logger[_0xa1eb('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fbd6c);throw _0x3fbd6c;});}return _0x977d00;})[_0xa1eb('0x22')](respondWithResult(_0x10e15a,0xc9))[_0xa1eb('0x45')](handleError(_0x10e15a,null));};exports[_0xa1eb('0x4e')]=function(_0x22ceef,_0x11cc84){if(_0x22ceef[_0xa1eb('0x47')]['id']){delete _0x22ceef[_0xa1eb('0x47')]['id'];}return db[_0xa1eb('0x2b')][_0xa1eb('0x44')]({'where':{'id':_0x22ceef[_0xa1eb('0x41')]['id']}})[_0xa1eb('0x22')](handleEntityNotFound(_0x11cc84,null))[_0xa1eb('0x22')](saveUpdates(_0x22ceef[_0xa1eb('0x47')],null))[_0xa1eb('0x22')](respondWithResult(_0x11cc84,null))[_0xa1eb('0x45')](handleError(_0x11cc84,null));};exports[_0xa1eb('0x25')]=function(_0x168994,_0x589186){return db[_0xa1eb('0x2b')][_0xa1eb('0x44')]({'where':{'id':_0x168994[_0xa1eb('0x41')]['id']}})[_0xa1eb('0x22')](handleEntityNotFound(_0x589186,null))[_0xa1eb('0x22')](removeEntity(_0x589186,null))[_0xa1eb('0x45')](handleError(_0x589186,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index f188eb5..f0240f2 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 _0x5492=['define','analytics_metrics','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5492,0xf2));var _0x2549=function(_0x595719,_0x475ccc){_0x595719=_0x595719-0x0;var _0x4226ff=_0x5492[_0x595719];return _0x4226ff;};'use strict';var _=require(_0x2549('0x0'));var util=require('util');var logger=require(_0x2549('0x1'))(_0x2549('0x2'));var moment=require('moment');var BPromise=require(_0x2549('0x3'));var rp=require(_0x2549('0x4'));var fs=require('fs');var path=require(_0x2549('0x5'));var rimraf=require(_0x2549('0x6'));var config=require(_0x2549('0x7'));var attributes=require(_0x2549('0x8'));module[_0x2549('0x9')]=function(_0x50bcb2,_0x31de84){return _0x50bcb2[_0x2549('0xa')]('AnalyticMetric',attributes,{'tableName':_0x2549('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc185=['AnalyticMetric','lodash','util','../../config/logger','api','bluebird','path','rimraf','./analyticMetric.attributes','exports'];(function(_0x304b20,_0x34826a){var _0x581451=function(_0xb21feb){while(--_0xb21feb){_0x304b20['push'](_0x304b20['shift']());}};_0x581451(++_0x34826a);}(_0xc185,0xdd));var _0x5c18=function(_0x1b060f,_0xa9ce70){_0x1b060f=_0x1b060f-0x0;var _0x16a970=_0xc185[_0x1b060f];return _0x16a970;};'use strict';var _=require(_0x5c18('0x0'));var util=require(_0x5c18('0x1'));var logger=require(_0x5c18('0x2'))(_0x5c18('0x3'));var moment=require('moment');var BPromise=require(_0x5c18('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c18('0x5'));var rimraf=require(_0x5c18('0x6'));var config=require('../../config/environment');var attributes=require(_0x5c18('0x7'));module[_0x5c18('0x8')]=function(_0x5b9877,_0x1bba4f){return _0x5b9877['define'](_0x5c18('0x9'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index b5accaa..c7c3a1a 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 _0x8c50=['info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8c50,0xda));var _0x08c5=function(_0x3af5c5,_0x1b3871){_0x3af5c5=_0x3af5c5-0x0;var _0xd0629e=_0x8c50[_0x3af5c5];return _0xd0629e;};'use strict';var _=require(_0x08c5('0x0'));var util=require(_0x08c5('0x1'));var moment=require('moment');var BPromise=require(_0x08c5('0x2'));var rs=require(_0x08c5('0x3'));var fs=require('fs');var Redis=require(_0x08c5('0x4'));var db=require(_0x08c5('0x5'))['db'];var utils=require(_0x08c5('0x6'));var logger=require(_0x08c5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x08c5('0x8'));var client=jayson['client'][_0x08c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26c2ff,_0xdc3e28,_0x159336){return new BPromise(function(_0x326653,_0x314e00){return client[_0x08c5('0xa')](_0x26c2ff,_0x159336)[_0x08c5('0xb')](function(_0x12720f){logger[_0x08c5('0xc')](_0x08c5('0xd'),_0xdc3e28,_0x08c5('0xe'));logger[_0x08c5('0xf')](_0x08c5('0x10'),_0xdc3e28,'request\x20sent',JSON[_0x08c5('0x11')](_0x12720f));if(_0x12720f[_0x08c5('0x12')]){if(_0x12720f[_0x08c5('0x12')][_0x08c5('0x13')]===0x1f4){logger['error'](_0x08c5('0xd'),_0xdc3e28,_0x12720f[_0x08c5('0x12')]['message']);return _0x314e00(_0x12720f[_0x08c5('0x12')][_0x08c5('0x14')]);}logger[_0x08c5('0x12')](_0x08c5('0xd'),_0xdc3e28,_0x12720f[_0x08c5('0x12')][_0x08c5('0x14')]);return _0x326653(_0x12720f['error'][_0x08c5('0x14')]);}else{logger[_0x08c5('0xc')](_0x08c5('0xd'),_0xdc3e28,_0x08c5('0xe'));_0x326653(_0x12720f[_0x08c5('0x15')][_0x08c5('0x14')]);}})[_0x08c5('0x16')](function(_0x3b5123){logger[_0x08c5('0x12')](_0x08c5('0xd'),_0xdc3e28,_0x3b5123);_0x314e00(_0x3b5123);});});} \ No newline at end of file +var _0x4cbe=['info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4cbe,0xc7));var _0xe4cb=function(_0x392ca0,_0x41916f){_0x392ca0=_0x392ca0-0x0;var _0x289124=_0x4cbe[_0x392ca0];return _0x289124;};'use strict';var _=require(_0xe4cb('0x0'));var util=require('util');var moment=require(_0xe4cb('0x1'));var BPromise=require(_0xe4cb('0x2'));var rs=require(_0xe4cb('0x3'));var fs=require('fs');var Redis=require(_0xe4cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4cb('0x5'));var logger=require('../../config/logger')(_0xe4cb('0x6'));var config=require(_0xe4cb('0x7'));var jayson=require(_0xe4cb('0x8'));var client=jayson['client'][_0xe4cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50fbee,_0x134d79,_0x3c9db8){return new BPromise(function(_0x4f78d8,_0x1a0c74){return client[_0xe4cb('0xa')](_0x50fbee,_0x3c9db8)['then'](function(_0x4c8f36){logger[_0xe4cb('0xb')](_0xe4cb('0xc'),_0x134d79,_0xe4cb('0xd'));logger[_0xe4cb('0xe')](_0xe4cb('0xf'),_0x134d79,_0xe4cb('0xd'),JSON[_0xe4cb('0x10')](_0x4c8f36));if(_0x4c8f36[_0xe4cb('0x11')]){if(_0x4c8f36[_0xe4cb('0x11')]['code']===0x1f4){logger[_0xe4cb('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x134d79,_0x4c8f36[_0xe4cb('0x11')][_0xe4cb('0x12')]);return _0x1a0c74(_0x4c8f36[_0xe4cb('0x11')][_0xe4cb('0x12')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x134d79,_0x4c8f36[_0xe4cb('0x11')][_0xe4cb('0x12')]);return _0x4f78d8(_0x4c8f36['error'][_0xe4cb('0x12')]);}else{logger[_0xe4cb('0xb')](_0xe4cb('0xc'),_0x134d79,'request\x20sent');_0x4f78d8(_0x4c8f36[_0xe4cb('0x13')][_0xe4cb('0x12')]);}})[_0xe4cb('0x14')](function(_0x5a91a6){logger[_0xe4cb('0x11')](_0xe4cb('0xc'),_0x134d79,_0x5a91a6);_0x1a0c74(_0x5a91a6);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index a475036..55495d1 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 _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id'];(function(_0x1fa841,_0x37a70c){var _0x384b67=function(_0x248c40){while(--_0x248c40){_0x1fa841['push'](_0x1fa841['shift']());}};_0x384b67(++_0x37a70c);}(_0x687b,0x14a));var _0xb687=function(_0x49052b,_0x1612f7){_0x49052b=_0x49052b-0x0;var _0x2f40cf=_0x687b[_0x49052b];return _0x2f40cf;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xa')]);router[_0xb687('0x8')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller['show']);router[_0xb687('0xc')]('/',auth[_0xb687('0x9')](),controller['create']);router[_0xb687('0xd')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file +var _0x3f8a=['index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x33ba78,_0xbcaa2d){var _0x24a8a8=function(_0x2c25f5){while(--_0x2c25f5){_0x33ba78['push'](_0x33ba78['shift']());}};_0x24a8a8(++_0xbcaa2d);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x40eed7,_0x2c6c79){_0x40eed7=_0x40eed7-0x0;var _0x231c7b=_0x3f8a[_0x40eed7];return _0x231c7b;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xb')]);router[_0xa3f8('0x9')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xc'),auth['isAuthenticated'](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller['destroy']);module[_0xa3f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 2033645..d26aa0a 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 _0x58a3=['TEXT','sequelize'];(function(_0x4db3fa,_0x316135){var _0x234a7b=function(_0x411cfc){while(--_0x411cfc){_0x4db3fa['push'](_0x4db3fa['shift']());}};_0x234a7b(++_0x316135);}(_0x58a3,0x14f));var _0x358a=function(_0x11a962,_0x3cc338){_0x11a962=_0x11a962-0x0;var _0x55d423=_0x58a3[_0x11a962];return _0x55d423;};'use strict';var Sequelize=require(_0x358a('0x0'));module['exports']={'tree':{'type':Sequelize[_0x358a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xf786=['sequelize','TEXT'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xf786,0x1c8));var _0x6f78=function(_0x268d1e,_0x1ca9f8){_0x268d1e=_0x268d1e-0x0;var _0x40278f=_0xf786[_0x268d1e];return _0x40278f;};'use strict';var Sequelize=require(_0x6f78('0x0'));module['exports']={'tree':{'type':Sequelize[_0x6f78('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index ad257e0..7797c03 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 _0x94a0=['filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','include','findAll','rows','catch','show','keys','create','body','params','destroy','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','map','rawAttributes','fieldName','type','key','query'];(function(_0x2145f9,_0x60df18){var _0x1003ef=function(_0xc754c1){while(--_0xc754c1){_0x2145f9['push'](_0x2145f9['shift']());}};_0x1003ef(++_0x60df18);}(_0x94a0,0x144));var _0x094a=function(_0x27ab58,_0x48c638){_0x27ab58=_0x27ab58-0x0;var _0x3daff0=_0x94a0[_0x27ab58];return _0x3daff0;};'use strict';var pdf=require(_0x094a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x094a('0x1'));var zipdir=require(_0x094a('0x2'));var jsonpatch=require(_0x094a('0x3'));var rp=require(_0x094a('0x4'));var moment=require(_0x094a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x094a('0x6'));var util=require(_0x094a('0x7'));var path=require(_0x094a('0x8'));var sox=require(_0x094a('0x9'));var csv=require(_0x094a('0xa'));var ejs=require(_0x094a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x094a('0xc'));var crypto=require('crypto');var jsforce=require(_0x094a('0xd'));var deskjs=require(_0x094a('0xe'));var toCsv=require(_0x094a('0xa'));var querystring=require(_0x094a('0xf'));var Papa=require(_0x094a('0x10'));var Redis=require('ioredis');var authService=require(_0x094a('0x11'));var qs=require(_0x094a('0x12'));var as=require(_0x094a('0x13'));var hardwareService=require(_0x094a('0x14'));var logger=require(_0x094a('0x15'))('api');var utils=require(_0x094a('0x16'));var config=require(_0x094a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x549f92,_0x242190){_0x242190=_0x242190||0xcc;return function(_0x26591c){if(_0x26591c){return _0x549f92[_0x094a('0x18')](_0x242190);}return _0x549f92[_0x094a('0x19')](_0x242190)[_0x094a('0x1a')]();};}function respondWithResult(_0x216fc2,_0x51f318){_0x51f318=_0x51f318||0xc8;return function(_0x454fd3){if(_0x454fd3){return _0x216fc2[_0x094a('0x19')](_0x51f318)[_0x094a('0x1b')](_0x454fd3);}};}function respondWithFilteredResult(_0xe12b4b,_0x1f44aa){return function(_0x280687){if(_0x280687){var _0x776eab=_0x280687[_0x094a('0x1c')],_0x3a9570=_0x1f44aa[_0x094a('0x1d')],_0xff468e=_0x1f44aa['offset']+_0x1f44aa[_0x094a('0x1e')],_0x364ef8;if(_0xff468e>=_0x776eab){_0xff468e=_0x776eab;_0x364ef8=0xc8;}else{_0x364ef8=0xce;}_0xe12b4b[_0x094a('0x19')](_0x364ef8);return _0xe12b4b[_0x094a('0x1f')](_0x094a('0x20'),_0x3a9570+'-'+_0xff468e+'/'+_0x776eab)[_0x094a('0x1b')](_0x280687);}return null;};}function patchUpdates(_0x8cd2ca){return function(_0x19a0df){try{jsonpatch[_0x094a('0x21')](_0x19a0df,_0x8cd2ca,!![]);}catch(_0x1e7391){return BPromise[_0x094a('0x22')](_0x1e7391);}return _0x19a0df[_0x094a('0x23')]();};}function saveUpdates(_0x43aea0,_0xd86504){return function(_0x577e27){if(_0x577e27){return _0x577e27[_0x094a('0x24')](_0x43aea0)[_0x094a('0x25')](function(_0x5d4ff2){return _0x5d4ff2;});}return null;};}function removeEntity(_0x1bd917,_0xf17bca){return function(_0x1f4814){if(_0x1f4814){return _0x1f4814['destroy']()[_0x094a('0x25')](function(){_0x1bd917[_0x094a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aeb8a,_0x50c495){return function(_0x2abe6a){if(!_0x2abe6a){_0x3aeb8a[_0x094a('0x18')](0x194);}return _0x2abe6a;};}function handleError(_0x54ff63,_0x46f65f){_0x46f65f=_0x46f65f||0x1f4;return function(_0x264ed0){logger['error'](_0x264ed0[_0x094a('0x26')]);if(_0x264ed0['name']){delete _0x264ed0[_0x094a('0x27')];}_0x54ff63['status'](_0x46f65f)['send'](_0x264ed0);};}exports['index']=function(_0x501d61,_0x1ca37b){var _0x55a9c8={},_0x2093e2={},_0x51b95d={'count':0x0,'rows':[]};var _0x1fc9da=_[_0x094a('0x28')](db['AnalyticTreeReport'][_0x094a('0x29')],function(_0x444012){return{'name':_0x444012[_0x094a('0x2a')],'type':_0x444012[_0x094a('0x2b')][_0x094a('0x2c')]};});_0x2093e2['model']=_[_0x094a('0x28')](_0x1fc9da,_0x094a('0x27'));_0x2093e2[_0x094a('0x2d')]=_['keys'](_0x501d61['query']);_0x2093e2[_0x094a('0x2e')]=_['intersection'](_0x2093e2['model'],_0x2093e2[_0x094a('0x2d')]);_0x55a9c8[_0x094a('0x2f')]=_[_0x094a('0x30')](_0x2093e2[_0x094a('0x31')],qs[_0x094a('0x32')](_0x501d61[_0x094a('0x2d')][_0x094a('0x32')]));_0x55a9c8[_0x094a('0x2f')]=_0x55a9c8[_0x094a('0x2f')][_0x094a('0x33')]?_0x55a9c8[_0x094a('0x2f')]:_0x2093e2[_0x094a('0x31')];if(!_0x501d61['query'][_0x094a('0x34')](_0x094a('0x35'))){_0x55a9c8[_0x094a('0x1e')]=qs['limit'](_0x501d61[_0x094a('0x2d')][_0x094a('0x1e')]);_0x55a9c8[_0x094a('0x1d')]=qs['offset'](_0x501d61[_0x094a('0x2d')]['offset']);}_0x55a9c8['order']=qs[_0x094a('0x36')](_0x501d61['query'][_0x094a('0x36')]);_0x55a9c8[_0x094a('0x37')]=qs['filters'](_[_0x094a('0x38')](_0x501d61['query'],_0x2093e2[_0x094a('0x2e')]),_0x1fc9da);if(_0x501d61[_0x094a('0x2d')][_0x094a('0x39')]){_0x55a9c8['where']=_[_0x094a('0x3a')](_0x55a9c8[_0x094a('0x37')],{'$or':_[_0x094a('0x28')](_0x1fc9da,function(_0xf60782){if(_0xf60782[_0x094a('0x2b')]!==_0x094a('0x3b')){var _0x503b7f={};_0x503b7f[_0xf60782['name']]={'$like':'%'+_0x501d61['query'][_0x094a('0x39')]+'%'};return _0x503b7f;}})});}_0x55a9c8=_[_0x094a('0x3a')]({},_0x55a9c8,_0x501d61[_0x094a('0x3c')]);var _0x49d50f={'where':_0x55a9c8[_0x094a('0x37')]};return db[_0x094a('0x3d')][_0x094a('0x1c')](_0x49d50f)[_0x094a('0x25')](function(_0x530521){_0x51b95d['count']=_0x530521;if(_0x501d61['query'][_0x094a('0x3e')]){_0x55a9c8[_0x094a('0x3f')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x094a('0x40')](_0x55a9c8);})[_0x094a('0x25')](function(_0x22afe){_0x51b95d[_0x094a('0x41')]=_0x22afe;return _0x51b95d;})[_0x094a('0x25')](respondWithFilteredResult(_0x1ca37b,_0x55a9c8))[_0x094a('0x42')](handleError(_0x1ca37b,null));};exports[_0x094a('0x43')]=function(_0x575b0,_0x1e31cc){var _0x464e09={'raw':!![],'where':{'id':_0x575b0['params']['id']}},_0x42ab91={};_0x42ab91['model']=_[_0x094a('0x44')](db['AnalyticTreeReport'][_0x094a('0x29')]);_0x42ab91['query']=_[_0x094a('0x44')](_0x575b0[_0x094a('0x2d')]);_0x42ab91['filters']=_['intersection'](_0x42ab91[_0x094a('0x31')],_0x42ab91[_0x094a('0x2d')]);_0x464e09[_0x094a('0x2f')]=_[_0x094a('0x30')](_0x42ab91[_0x094a('0x31')],qs[_0x094a('0x32')](_0x575b0[_0x094a('0x2d')][_0x094a('0x32')]));_0x464e09['attributes']=_0x464e09[_0x094a('0x2f')]['length']?_0x464e09['attributes']:_0x42ab91[_0x094a('0x31')];if(_0x575b0[_0x094a('0x2d')]['includeAll']){_0x464e09[_0x094a('0x3f')]=[{'all':!![]}];}_0x464e09=_[_0x094a('0x3a')]({},_0x464e09,_0x575b0[_0x094a('0x3c')]);return db[_0x094a('0x3d')]['find'](_0x464e09)[_0x094a('0x25')](handleEntityNotFound(_0x1e31cc,null))['then'](respondWithResult(_0x1e31cc,null))[_0x094a('0x42')](handleError(_0x1e31cc,null));};exports[_0x094a('0x45')]=function(_0x53f375,_0x759b90){return db[_0x094a('0x3d')][_0x094a('0x45')](_0x53f375[_0x094a('0x46')],{})[_0x094a('0x25')](respondWithResult(_0x759b90,0xc9))[_0x094a('0x42')](handleError(_0x759b90,null));};exports[_0x094a('0x24')]=function(_0x6cd0c0,_0x438a13){if(_0x6cd0c0[_0x094a('0x46')]['id']){delete _0x6cd0c0['body']['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x6cd0c0[_0x094a('0x47')]['id']}})[_0x094a('0x25')](handleEntityNotFound(_0x438a13,null))[_0x094a('0x25')](saveUpdates(_0x6cd0c0[_0x094a('0x46')],null))[_0x094a('0x25')](respondWithResult(_0x438a13,null))['catch'](handleError(_0x438a13,null));};exports[_0x094a('0x48')]=function(_0x5ab2d0,_0x2e57df){return db[_0x094a('0x3d')][_0x094a('0x49')]({'where':{'id':_0x5ab2d0[_0x094a('0x47')]['id']}})[_0x094a('0x25')](handleEntityNotFound(_0x2e57df,null))[_0x094a('0x25')](removeEntity(_0x2e57df,null))['catch'](handleError(_0x2e57df,null));}; \ No newline at end of file +var _0x919c=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','then','error','name','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x335555,_0x3dd35a){var _0x13616f=function(_0x1a7be2){while(--_0x1a7be2){_0x335555['push'](_0x335555['shift']());}};_0x13616f(++_0x3dd35a);}(_0x919c,0x1c0));var _0xc919=function(_0x393d27,_0x102779){_0x393d27=_0x393d27-0x0;var _0x208e7b=_0x919c[_0x393d27];return _0x208e7b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc919('0x0'));var rimraf=require(_0xc919('0x1'));var zipdir=require(_0xc919('0x2'));var jsonpatch=require(_0xc919('0x3'));var rp=require(_0xc919('0x4'));var moment=require(_0xc919('0x5'));var BPromise=require(_0xc919('0x6'));var Mustache=require(_0xc919('0x7'));var util=require(_0xc919('0x8'));var path=require(_0xc919('0x9'));var sox=require(_0xc919('0xa'));var csv=require(_0xc919('0xb'));var ejs=require(_0xc919('0xc'));var fs=require('fs');var _=require(_0xc919('0xd'));var squel=require(_0xc919('0xe'));var crypto=require(_0xc919('0xf'));var jsforce=require(_0xc919('0x10'));var deskjs=require(_0xc919('0x11'));var toCsv=require(_0xc919('0xb'));var querystring=require(_0xc919('0x12'));var Papa=require('papaparse');var Redis=require(_0xc919('0x13'));var authService=require(_0xc919('0x14'));var qs=require(_0xc919('0x15'));var as=require(_0xc919('0x16'));var hardwareService=require(_0xc919('0x17'));var logger=require(_0xc919('0x18'))(_0xc919('0x19'));var utils=require(_0xc919('0x1a'));var config=require(_0xc919('0x1b'));var db=require(_0xc919('0x1c'))['db'];function respondWithStatusCode(_0x7277fc,_0x56b85b){_0x56b85b=_0x56b85b||0xcc;return function(_0x268ebe){if(_0x268ebe){return _0x7277fc[_0xc919('0x1d')](_0x56b85b);}return _0x7277fc['status'](_0x56b85b)['end']();};}function respondWithResult(_0x297980,_0x24a0f9){_0x24a0f9=_0x24a0f9||0xc8;return function(_0x814411){if(_0x814411){return _0x297980[_0xc919('0x1e')](_0x24a0f9)[_0xc919('0x1f')](_0x814411);}};}function respondWithFilteredResult(_0x33a88d,_0x24a943){return function(_0x580a38){if(_0x580a38){var _0x532455=_0x580a38['count'],_0x445cb6=_0x24a943[_0xc919('0x20')],_0x3e66fa=_0x24a943[_0xc919('0x20')]+_0x24a943[_0xc919('0x21')],_0x2f2b40;if(_0x3e66fa>=_0x532455){_0x3e66fa=_0x532455;_0x2f2b40=0xc8;}else{_0x2f2b40=0xce;}_0x33a88d['status'](_0x2f2b40);return _0x33a88d[_0xc919('0x22')](_0xc919('0x23'),_0x445cb6+'-'+_0x3e66fa+'/'+_0x532455)[_0xc919('0x1f')](_0x580a38);}return null;};}function patchUpdates(_0x5bce45){return function(_0x10ea56){try{jsonpatch[_0xc919('0x24')](_0x10ea56,_0x5bce45,!![]);}catch(_0x45407f){return BPromise[_0xc919('0x25')](_0x45407f);}return _0x10ea56[_0xc919('0x26')]();};}function saveUpdates(_0x21c194,_0x3eccc8){return function(_0xf29e57){if(_0xf29e57){return _0xf29e57['update'](_0x21c194)[_0xc919('0x27')](function(_0x301b15){return _0x301b15;});}return null;};}function removeEntity(_0x5182c8,_0x1a4dd9){return function(_0x1d8cfb){if(_0x1d8cfb){return _0x1d8cfb['destroy']()[_0xc919('0x27')](function(){_0x5182c8[_0xc919('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20e446,_0x129b56){return function(_0x3ce5ab){if(!_0x3ce5ab){_0x20e446[_0xc919('0x1d')](0x194);}return _0x3ce5ab;};}function handleError(_0x5bbd5f,_0x3826fd){_0x3826fd=_0x3826fd||0x1f4;return function(_0x17ed61){logger[_0xc919('0x28')](_0x17ed61['stack']);if(_0x17ed61[_0xc919('0x29')]){delete _0x17ed61['name'];}_0x5bbd5f[_0xc919('0x1e')](_0x3826fd)['send'](_0x17ed61);};}exports[_0xc919('0x2a')]=function(_0x1232bb,_0x1b7d85){var _0x337ee1={},_0x1ca496={},_0x49ec09={'count':0x0,'rows':[]};var _0x202ba7=_['map'](db[_0xc919('0x2b')][_0xc919('0x2c')],function(_0x697411){return{'name':_0x697411[_0xc919('0x2d')],'type':_0x697411[_0xc919('0x2e')][_0xc919('0x2f')]};});_0x1ca496[_0xc919('0x30')]=_[_0xc919('0x31')](_0x202ba7,'name');_0x1ca496[_0xc919('0x32')]=_['keys'](_0x1232bb['query']);_0x1ca496[_0xc919('0x33')]=_[_0xc919('0x34')](_0x1ca496[_0xc919('0x30')],_0x1ca496[_0xc919('0x32')]);_0x337ee1[_0xc919('0x35')]=_[_0xc919('0x34')](_0x1ca496['model'],qs[_0xc919('0x36')](_0x1232bb[_0xc919('0x32')][_0xc919('0x36')]));_0x337ee1[_0xc919('0x35')]=_0x337ee1[_0xc919('0x35')][_0xc919('0x37')]?_0x337ee1['attributes']:_0x1ca496[_0xc919('0x30')];if(!_0x1232bb[_0xc919('0x32')]['hasOwnProperty'](_0xc919('0x38'))){_0x337ee1['limit']=qs['limit'](_0x1232bb[_0xc919('0x32')]['limit']);_0x337ee1[_0xc919('0x20')]=qs[_0xc919('0x20')](_0x1232bb[_0xc919('0x32')][_0xc919('0x20')]);}_0x337ee1[_0xc919('0x39')]=qs[_0xc919('0x3a')](_0x1232bb[_0xc919('0x32')][_0xc919('0x3a')]);_0x337ee1[_0xc919('0x3b')]=qs[_0xc919('0x33')](_[_0xc919('0x3c')](_0x1232bb[_0xc919('0x32')],_0x1ca496[_0xc919('0x33')]),_0x202ba7);if(_0x1232bb[_0xc919('0x32')][_0xc919('0x3d')]){_0x337ee1['where']=_[_0xc919('0x3e')](_0x337ee1[_0xc919('0x3b')],{'$or':_[_0xc919('0x31')](_0x202ba7,function(_0x11d33a){if(_0x11d33a[_0xc919('0x2e')]!==_0xc919('0x3f')){var _0x209b86={};_0x209b86[_0x11d33a['name']]={'$like':'%'+_0x1232bb[_0xc919('0x32')]['filter']+'%'};return _0x209b86;}})});}_0x337ee1=_[_0xc919('0x3e')]({},_0x337ee1,_0x1232bb[_0xc919('0x40')]);var _0x402ca6={'where':_0x337ee1['where']};return db[_0xc919('0x2b')]['count'](_0x402ca6)[_0xc919('0x27')](function(_0x3ce7fd){_0x49ec09['count']=_0x3ce7fd;if(_0x1232bb[_0xc919('0x32')][_0xc919('0x41')]){_0x337ee1[_0xc919('0x42')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xc919('0x43')](_0x337ee1);})[_0xc919('0x27')](function(_0x2493a7){_0x49ec09[_0xc919('0x44')]=_0x2493a7;return _0x49ec09;})['then'](respondWithFilteredResult(_0x1b7d85,_0x337ee1))[_0xc919('0x45')](handleError(_0x1b7d85,null));};exports[_0xc919('0x46')]=function(_0x164405,_0x53afdb){var _0x5da313={'raw':!![],'where':{'id':_0x164405[_0xc919('0x47')]['id']}},_0x5785ca={};_0x5785ca[_0xc919('0x30')]=_['keys'](db[_0xc919('0x2b')][_0xc919('0x2c')]);_0x5785ca['query']=_['keys'](_0x164405[_0xc919('0x32')]);_0x5785ca[_0xc919('0x33')]=_[_0xc919('0x34')](_0x5785ca[_0xc919('0x30')],_0x5785ca[_0xc919('0x32')]);_0x5da313[_0xc919('0x35')]=_[_0xc919('0x34')](_0x5785ca[_0xc919('0x30')],qs[_0xc919('0x36')](_0x164405[_0xc919('0x32')][_0xc919('0x36')]));_0x5da313['attributes']=_0x5da313[_0xc919('0x35')][_0xc919('0x37')]?_0x5da313[_0xc919('0x35')]:_0x5785ca[_0xc919('0x30')];if(_0x164405[_0xc919('0x32')][_0xc919('0x41')]){_0x5da313[_0xc919('0x42')]=[{'all':!![]}];}_0x5da313=_[_0xc919('0x3e')]({},_0x5da313,_0x164405[_0xc919('0x40')]);return db[_0xc919('0x2b')][_0xc919('0x48')](_0x5da313)[_0xc919('0x27')](handleEntityNotFound(_0x53afdb,null))[_0xc919('0x27')](respondWithResult(_0x53afdb,null))[_0xc919('0x45')](handleError(_0x53afdb,null));};exports['create']=function(_0x4024dc,_0x1a27d0){return db[_0xc919('0x2b')][_0xc919('0x49')](_0x4024dc['body'],{})[_0xc919('0x27')](respondWithResult(_0x1a27d0,0xc9))['catch'](handleError(_0x1a27d0,null));};exports['update']=function(_0xe7509e,_0x221c41){if(_0xe7509e[_0xc919('0x4a')]['id']){delete _0xe7509e['body']['id'];}return db[_0xc919('0x2b')][_0xc919('0x48')]({'where':{'id':_0xe7509e[_0xc919('0x47')]['id']}})[_0xc919('0x27')](handleEntityNotFound(_0x221c41,null))['then'](saveUpdates(_0xe7509e['body'],null))[_0xc919('0x27')](respondWithResult(_0x221c41,null))[_0xc919('0x45')](handleError(_0x221c41,null));};exports[_0xc919('0x4b')]=function(_0x12f2ac,_0x256e0b){return db[_0xc919('0x2b')][_0xc919('0x48')]({'where':{'id':_0x12f2ac[_0xc919('0x47')]['id']}})[_0xc919('0x27')](handleEntityNotFound(_0x256e0b,null))[_0xc919('0x27')](removeEntity(_0x256e0b,null))[_0xc919('0x45')](handleError(_0x256e0b,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 1bf21c6..3eeb3af 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 _0xe6e9=['define','analytics_report_trees','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes','exports'];(function(_0xf670f0,_0x353747){var _0x3c21c6=function(_0xa0e0b2){while(--_0xa0e0b2){_0xf670f0['push'](_0xf670f0['shift']());}};_0x3c21c6(++_0x353747);}(_0xe6e9,0x182));var _0x9e6e=function(_0x448e9b,_0x3ba350){_0x448e9b=_0x448e9b-0x0;var _0x4db95c=_0xe6e9[_0x448e9b];return _0x4db95c;};'use strict';var _=require(_0x9e6e('0x0'));var util=require(_0x9e6e('0x1'));var logger=require(_0x9e6e('0x2'))('api');var moment=require(_0x9e6e('0x3'));var BPromise=require(_0x9e6e('0x4'));var rp=require(_0x9e6e('0x5'));var fs=require('fs');var path=require(_0x9e6e('0x6'));var rimraf=require(_0x9e6e('0x7'));var config=require('../../config/environment');var attributes=require(_0x9e6e('0x8'));module[_0x9e6e('0x9')]=function(_0x206572,_0x1e8e5e){return _0x206572[_0x9e6e('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0x9e6e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed20=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util'];(function(_0x279e95,_0xd8c05c){var _0x5d7c1a=function(_0x72d015){while(--_0x72d015){_0x279e95['push'](_0x279e95['shift']());}};_0x5d7c1a(++_0xd8c05c);}(_0xed20,0xce));var _0x0ed2=function(_0x24d656,_0x481078){_0x24d656=_0x24d656-0x0;var _0x5f0507=_0xed20[_0x24d656];return _0x5f0507;};'use strict';var _=require(_0x0ed2('0x0'));var util=require(_0x0ed2('0x1'));var logger=require(_0x0ed2('0x2'))('api');var moment=require(_0x0ed2('0x3'));var BPromise=require(_0x0ed2('0x4'));var rp=require(_0x0ed2('0x5'));var fs=require('fs');var path=require(_0x0ed2('0x6'));var rimraf=require(_0x0ed2('0x7'));var config=require(_0x0ed2('0x8'));var attributes=require('./analyticTreeReport.attributes');module[_0x0ed2('0x9')]=function(_0x88640a,_0x5c686a){return _0x88640a[_0x0ed2('0xa')](_0x0ed2('0xb'),attributes,{'tableName':_0x0ed2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index cd84deb..28805de 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 _0x311a=['../../config/logger','rpc','../../config/environment','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4889f9,_0x4fa7b1){var _0x578a83=function(_0x1782cd){while(--_0x1782cd){_0x4889f9['push'](_0x4889f9['shift']());}};_0x578a83(++_0x4fa7b1);}(_0x311a,0xc0));var _0xa311=function(_0x5a516a,_0x541200){_0x5a516a=_0x5a516a-0x0;var _0x38c0d9=_0x311a[_0x5a516a];return _0x38c0d9;};'use strict';var _=require(_0xa311('0x0'));var util=require(_0xa311('0x1'));var moment=require(_0xa311('0x2'));var BPromise=require(_0xa311('0x3'));var rs=require(_0xa311('0x4'));var fs=require('fs');var Redis=require(_0xa311('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa311('0x6'))(_0xa311('0x7'));var config=require(_0xa311('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa311('0x9')][_0xa311('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x230cdf,_0x35e122,_0x99bda0){return new BPromise(function(_0x2ed94e,_0x27f4a4){return client[_0xa311('0xb')](_0x230cdf,_0x99bda0)[_0xa311('0xc')](function(_0x279ffe){logger['info'](_0xa311('0xd'),_0x35e122,_0xa311('0xe'));logger['debug'](_0xa311('0xf'),_0x35e122,'request\x20sent',JSON[_0xa311('0x10')](_0x279ffe));if(_0x279ffe[_0xa311('0x11')]){if(_0x279ffe[_0xa311('0x11')][_0xa311('0x12')]===0x1f4){logger['error'](_0xa311('0xd'),_0x35e122,_0x279ffe[_0xa311('0x11')][_0xa311('0x13')]);return _0x27f4a4(_0x279ffe['error'][_0xa311('0x13')]);}logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x35e122,_0x279ffe[_0xa311('0x11')]['message']);return _0x2ed94e(_0x279ffe['error'][_0xa311('0x13')]);}else{logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x35e122,_0xa311('0xe'));_0x2ed94e(_0x279ffe[_0xa311('0x14')][_0xa311('0x13')]);}})[_0xa311('0x15')](function(_0x945ca6){logger[_0xa311('0x11')]('AnalyticTreeReport,\x20%s,\x20%s',_0x35e122,_0x945ca6);_0x27f4a4(_0x945ca6);});});} \ No newline at end of file +var _0xfce2=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x4b8801,_0x758d94){var _0x3ed413=function(_0x572f5){while(--_0x572f5){_0x4b8801['push'](_0x4b8801['shift']());}};_0x3ed413(++_0x758d94);}(_0xfce2,0x167));var _0x2fce=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfce2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2fce('0x0'));var util=require(_0x2fce('0x1'));var moment=require('moment');var BPromise=require(_0x2fce('0x2'));var rs=require(_0x2fce('0x3'));var fs=require('fs');var Redis=require(_0x2fce('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2fce('0x5'));var logger=require(_0x2fce('0x6'))(_0x2fce('0x7'));var config=require(_0x2fce('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2fce('0x9')][_0x2fce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x154f07,_0x2c6301,_0x3f5866){return new BPromise(function(_0x2fe739,_0x3e41e9){return client[_0x2fce('0xb')](_0x154f07,_0x3f5866)[_0x2fce('0xc')](function(_0x3daa73){logger[_0x2fce('0xd')](_0x2fce('0xe'),_0x2c6301,_0x2fce('0xf'));logger[_0x2fce('0x10')](_0x2fce('0x11'),_0x2c6301,_0x2fce('0xf'),JSON[_0x2fce('0x12')](_0x3daa73));if(_0x3daa73['error']){if(_0x3daa73[_0x2fce('0x13')][_0x2fce('0x14')]===0x1f4){logger[_0x2fce('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2c6301,_0x3daa73[_0x2fce('0x13')]['message']);return _0x3e41e9(_0x3daa73[_0x2fce('0x13')][_0x2fce('0x15')]);}logger[_0x2fce('0x13')](_0x2fce('0xe'),_0x2c6301,_0x3daa73[_0x2fce('0x13')][_0x2fce('0x15')]);return _0x2fe739(_0x3daa73[_0x2fce('0x13')][_0x2fce('0x15')]);}else{logger[_0x2fce('0xd')](_0x2fce('0xe'),_0x2c6301,_0x2fce('0xf'));_0x2fe739(_0x3daa73[_0x2fce('0x16')][_0x2fce('0x15')]);}})[_0x2fce('0x17')](function(_0x508e4a){logger[_0x2fce('0x13')](_0x2fce('0xe'),_0x2c6301,_0x508e4a);_0x3e41e9(_0x508e4a);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index f2ed3c9..2300f98 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 _0x77e1=['isAuthenticated','index','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./analyticTreeReport.controller','get'];(function(_0x2e82c2,_0x3ca803){var _0x9af733=function(_0x3f258a){while(--_0x3f258a){_0x2e82c2['push'](_0x2e82c2['shift']());}};_0x9af733(++_0x3ca803);}(_0x77e1,0x6e));var _0x177e=function(_0x2b1482,_0x12cdac){_0x2b1482=_0x2b1482-0x0;var _0x1c0d82=_0x77e1[_0x2b1482];return _0x1c0d82;};'use strict';var multer=require(_0x177e('0x0'));var util=require(_0x177e('0x1'));var path=require(_0x177e('0x2'));var timeout=require(_0x177e('0x3'));var express=require(_0x177e('0x4'));var router=express[_0x177e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x177e('0x6'));var config=require('../../config/environment');var controller=require(_0x177e('0x7'));router[_0x177e('0x8')]('/',auth[_0x177e('0x9')](),controller[_0x177e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x177e('0xb')]);router[_0x177e('0xc')]('/',auth[_0x177e('0x9')](),controller[_0x177e('0xd')]);router[_0x177e('0xe')]('/:id',auth[_0x177e('0x9')](),controller[_0x177e('0xf')]);router['delete']('/:id',auth[_0x177e('0x9')](),controller[_0x177e('0x10')]);module['exports']=router; \ No newline at end of file +var _0xc355=['./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x324100,_0xbdc8f8){var _0x3c3ced=function(_0x3d0de8){while(--_0x3d0de8){_0x324100['push'](_0x324100['shift']());}};_0x3c3ced(++_0xbdc8f8);}(_0xc355,0xaf));var _0x5c35=function(_0x59dccc,_0x184c1c){_0x59dccc=_0x59dccc-0x0;var _0xc97bcb=_0xc355[_0x59dccc];return _0xc97bcb;};'use strict';var multer=require(_0x5c35('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5c35('0x1'));var router=express['Router']();var auth=require(_0x5c35('0x2'));var interaction=require(_0x5c35('0x3'));var config=require(_0x5c35('0x4'));var controller=require(_0x5c35('0x5'));router[_0x5c35('0x6')]('/',auth[_0x5c35('0x7')](),controller[_0x5c35('0x8')]);router[_0x5c35('0x6')](_0x5c35('0x9'),auth['isAuthenticated'](),controller[_0x5c35('0xa')]);router[_0x5c35('0xb')]('/',auth[_0x5c35('0x7')](),controller[_0x5c35('0xc')]);router[_0x5c35('0xd')]('/:id',auth[_0x5c35('0x7')](),controller[_0x5c35('0xe')]);router[_0x5c35('0xf')]('/:id',auth[_0x5c35('0x7')](),controller[_0x5c35('0x10')]);module[_0x5c35('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 85b478b..0930ca7 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 _0x8e50=['sequelize','exports','STRING'];(function(_0x32b417,_0x100931){var _0x1f088c=function(_0x56eab8){while(--_0x56eab8){_0x32b417['push'](_0x32b417['shift']());}};_0x1f088c(++_0x100931);}(_0x8e50,0xf6));var _0x08e5=function(_0x33294d,_0x54b3ab){_0x33294d=_0x33294d-0x0;var _0x17fce4=_0x8e50[_0x33294d];return _0x17fce4;};'use strict';var Sequelize=require(_0x08e5('0x0'));module[_0x08e5('0x1')]={'name':{'type':Sequelize[_0x08e5('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x08e5('0x2')]}}; \ No newline at end of file +var _0x6814=['exports','STRING','sequelize'];(function(_0x5524cd,_0x3c324a){var _0x1f0068=function(_0x1f7a6b){while(--_0x1f7a6b){_0x5524cd['push'](_0x5524cd['shift']());}};_0x1f0068(++_0x3c324a);}(_0x6814,0x1be));var _0x4681=function(_0x78ad3c,_0x31e50c){_0x78ad3c=_0x78ad3c-0x0;var _0x4aec38=_0x6814[_0x78ad3c];return _0x4aec38;};'use strict';var Sequelize=require(_0x4681('0x0'));module[_0x4681('0x1')]={'name':{'type':Sequelize[_0x4681('0x2')]},'basename':{'type':Sequelize[_0x4681('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index fc45a1b..5715309 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 _0x03e8=['to-csv','squel','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','Attachment','includeAll','include','findAll','catch','params','find','get','omit','body','updatedAt','create','file','originalname','filename','mimetype','findOne','download','join','root','server/files/attachments/','basename','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x2c5ea7,_0x3e74ce){var _0x2e3ed9=function(_0x5c8391){while(--_0x5c8391){_0x2c5ea7['push'](_0x2c5ea7['shift']());}};_0x2e3ed9(++_0x3e74ce);}(_0x03e8,0x1e1));var _0x803e=function(_0x14295a,_0x530788){_0x14295a=_0x14295a-0x0;var _0x4788d3=_0x03e8[_0x14295a];return _0x4788d3;};'use strict';var pdf=require(_0x803e('0x0'));var emlformat=require(_0x803e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x803e('0x2'));var jsonpatch=require(_0x803e('0x3'));var rp=require(_0x803e('0x4'));var moment=require(_0x803e('0x5'));var BPromise=require(_0x803e('0x6'));var Mustache=require(_0x803e('0x7'));var util=require(_0x803e('0x8'));var path=require(_0x803e('0x9'));var sox=require(_0x803e('0xa'));var csv=require(_0x803e('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x803e('0xc'));var crypto=require('crypto');var jsforce=require(_0x803e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x803e('0xb'));var querystring=require('querystring');var Papa=require(_0x803e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x803e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x803e('0x10'))('api');var utils=require(_0x803e('0x11'));var config=require('../../config/environment');var db=require(_0x803e('0x12'))['db'];function respondWithStatusCode(_0x2e4b81,_0xcd7a76){_0xcd7a76=_0xcd7a76||0xcc;return function(_0x4ee559){if(_0x4ee559){return _0x2e4b81[_0x803e('0x13')](_0xcd7a76);}return _0x2e4b81[_0x803e('0x14')](_0xcd7a76)[_0x803e('0x15')]();};}function respondWithResult(_0xd9ce0e,_0x3015d9){_0x3015d9=_0x3015d9||0xc8;return function(_0x43e764){if(_0x43e764){return _0xd9ce0e[_0x803e('0x14')](_0x3015d9)[_0x803e('0x16')](_0x43e764);}};}function respondWithFilteredResult(_0x17d7e0,_0x2227f3){return function(_0x153289){if(_0x153289){var _0x1fff19=_0x153289[_0x803e('0x17')],_0x5c3071=_0x2227f3['offset'],_0x289026=_0x2227f3[_0x803e('0x18')]+_0x2227f3[_0x803e('0x19')],_0x4cf19a;if(_0x289026>=_0x1fff19){_0x289026=_0x1fff19;_0x4cf19a=0xc8;}else{_0x4cf19a=0xce;}_0x17d7e0['status'](_0x4cf19a);return _0x17d7e0[_0x803e('0x1a')](_0x803e('0x1b'),_0x5c3071+'-'+_0x289026+'/'+_0x1fff19)['json'](_0x153289);}return null;};}function patchUpdates(_0x5f07f5){return function(_0x25ca3b){try{jsonpatch['apply'](_0x25ca3b,_0x5f07f5,!![]);}catch(_0x270ba4){return BPromise[_0x803e('0x1c')](_0x270ba4);}return _0x25ca3b[_0x803e('0x1d')]();};}function saveUpdates(_0x37a42a,_0x3f19b9){return function(_0x1b9e39){if(_0x1b9e39){return _0x1b9e39[_0x803e('0x1e')](_0x37a42a)[_0x803e('0x1f')](function(_0x26a1ab){return _0x26a1ab;});}return null;};}function removeEntity(_0x5e2fda,_0x25bd9d){return function(_0x27685d){if(_0x27685d){return _0x27685d[_0x803e('0x20')]()[_0x803e('0x1f')](function(){_0x5e2fda[_0x803e('0x14')](0xcc)[_0x803e('0x15')]();});}};}function handleEntityNotFound(_0x29b44a,_0x2761c1){return function(_0x547033){if(!_0x547033){_0x29b44a['sendStatus'](0x194);}return _0x547033;};}function handleError(_0x3b7afb,_0x2913d4){_0x2913d4=_0x2913d4||0x1f4;return function(_0x4706f5){logger['error'](_0x4706f5[_0x803e('0x21')]);if(_0x4706f5['name']){delete _0x4706f5[_0x803e('0x22')];}_0x3b7afb['status'](_0x2913d4)[_0x803e('0x23')](_0x4706f5);};}exports[_0x803e('0x24')]=function(_0x3713ef,_0x30e156){var _0x34fd5f={},_0x171f05={},_0x1ed993={'count':0x0,'rows':[]};var _0x2c466f=_[_0x803e('0x25')](db['Attachment'][_0x803e('0x26')],function(_0x5271e8){return{'name':_0x5271e8[_0x803e('0x27')],'type':_0x5271e8[_0x803e('0x28')][_0x803e('0x29')]};});_0x171f05[_0x803e('0x2a')]=_['map'](_0x2c466f,'name');_0x171f05['query']=_[_0x803e('0x2b')](_0x3713ef[_0x803e('0x2c')]);_0x171f05['filters']=_[_0x803e('0x2d')](_0x171f05['model'],_0x171f05[_0x803e('0x2c')]);_0x34fd5f[_0x803e('0x2e')]=_[_0x803e('0x2d')](_0x171f05[_0x803e('0x2a')],qs[_0x803e('0x2f')](_0x3713ef[_0x803e('0x2c')][_0x803e('0x2f')]));_0x34fd5f['attributes']=_0x34fd5f[_0x803e('0x2e')][_0x803e('0x30')]?_0x34fd5f['attributes']:_0x171f05[_0x803e('0x2a')];if(!_0x3713ef['query'][_0x803e('0x31')](_0x803e('0x32'))){_0x34fd5f[_0x803e('0x19')]=qs[_0x803e('0x19')](_0x3713ef[_0x803e('0x2c')][_0x803e('0x19')]);_0x34fd5f['offset']=qs['offset'](_0x3713ef[_0x803e('0x2c')]['offset']);}_0x34fd5f[_0x803e('0x33')]=qs[_0x803e('0x34')](_0x3713ef['query'][_0x803e('0x34')]);_0x34fd5f[_0x803e('0x35')]=qs[_0x803e('0x36')](_[_0x803e('0x37')](_0x3713ef[_0x803e('0x2c')],_0x171f05[_0x803e('0x36')]),_0x2c466f);if(_0x3713ef['query']['filter']){_0x34fd5f[_0x803e('0x35')]=_[_0x803e('0x38')](_0x34fd5f[_0x803e('0x35')],{'$or':_[_0x803e('0x25')](_0x2c466f,function(_0x3e57d5){if(_0x3e57d5[_0x803e('0x28')]!==_0x803e('0x39')){var _0x1dc0e7={};_0x1dc0e7[_0x3e57d5[_0x803e('0x22')]]={'$like':'%'+_0x3713ef['query'][_0x803e('0x3a')]+'%'};return _0x1dc0e7;}})});}_0x34fd5f=_['merge']({},_0x34fd5f,_0x3713ef[_0x803e('0x3b')]);var _0x2abe10={'where':_0x34fd5f['where']};return db[_0x803e('0x3c')][_0x803e('0x17')](_0x2abe10)[_0x803e('0x1f')](function(_0x16a983){_0x1ed993[_0x803e('0x17')]=_0x16a983;if(_0x3713ef['query'][_0x803e('0x3d')]){_0x34fd5f[_0x803e('0x3e')]=[{'all':!![]}];}return db[_0x803e('0x3c')][_0x803e('0x3f')](_0x34fd5f);})[_0x803e('0x1f')](function(_0x592283){_0x1ed993['rows']=_0x592283;return _0x1ed993;})[_0x803e('0x1f')](respondWithFilteredResult(_0x30e156,_0x34fd5f))[_0x803e('0x40')](handleError(_0x30e156,null));};exports['show']=function(_0x32a4ec,_0x338330){var _0x942124={'raw':!![],'where':{'id':_0x32a4ec[_0x803e('0x41')]['id']}},_0x3d24dc={};_0x3d24dc[_0x803e('0x2a')]=_[_0x803e('0x2b')](db[_0x803e('0x3c')][_0x803e('0x26')]);_0x3d24dc[_0x803e('0x2c')]=_[_0x803e('0x2b')](_0x32a4ec[_0x803e('0x2c')]);_0x3d24dc[_0x803e('0x36')]=_[_0x803e('0x2d')](_0x3d24dc[_0x803e('0x2a')],_0x3d24dc['query']);_0x942124[_0x803e('0x2e')]=_[_0x803e('0x2d')](_0x3d24dc[_0x803e('0x2a')],qs['fields'](_0x32a4ec[_0x803e('0x2c')][_0x803e('0x2f')]));_0x942124[_0x803e('0x2e')]=_0x942124['attributes'][_0x803e('0x30')]?_0x942124['attributes']:_0x3d24dc[_0x803e('0x2a')];if(_0x32a4ec[_0x803e('0x2c')][_0x803e('0x3d')]){_0x942124[_0x803e('0x3e')]=[{'all':!![]}];}_0x942124=_[_0x803e('0x38')]({},_0x942124,_0x32a4ec['options']);return db[_0x803e('0x3c')][_0x803e('0x42')](_0x942124)[_0x803e('0x1f')](handleEntityNotFound(_0x338330,null))['then'](respondWithResult(_0x338330,null))[_0x803e('0x40')](handleError(_0x338330,null));};exports['clone']=function(_0x4e0539,_0x36abd8){var _0x554f8a={'where':{'id':_0x4e0539['params']['id']}},_0x1837cd={};_0x1837cd['model']=_[_0x803e('0x2b')](db[_0x803e('0x3c')][_0x803e('0x26')]);_0x554f8a['attributes']=_[_0x803e('0x2d')](_0x1837cd[_0x803e('0x2a')],qs[_0x803e('0x2f')](_0x4e0539[_0x803e('0x2c')][_0x803e('0x2f')]));_0x554f8a[_0x803e('0x2e')]=_0x554f8a[_0x803e('0x2e')][_0x803e('0x30')]?_0x554f8a[_0x803e('0x2e')]:_0x1837cd[_0x803e('0x2a')];if(_0x4e0539['query']['includeAll']){_0x554f8a[_0x803e('0x3e')]=[{'all':!![]}];}_0x554f8a=_[_0x803e('0x38')]({},_0x554f8a,_0x4e0539[_0x803e('0x3b')]);return db[_0x803e('0x3c')][_0x803e('0x42')](_0x554f8a)['then'](handleEntityNotFound(_0x36abd8,null))[_0x803e('0x1f')](function(_0x2f9ab3){if(_0x2f9ab3){var _0x10157f=_0x2f9ab3[_0x803e('0x43')]({'plain':!![]});_0x10157f=qs[_0x803e('0x44')](_0x10157f,['id','createdAt','updatedAt']);_0x4e0539[_0x803e('0x45')]=_['omit'](_0x4e0539[_0x803e('0x45')],['id','createdAt',_0x803e('0x46')]);return db[_0x803e('0x3c')][_0x803e('0x47')](_[_0x803e('0x38')](_0x10157f,_0x4e0539[_0x803e('0x45')]),{'include':_0x4e0539[_0x803e('0x2c')][_0x803e('0x3d')]?[{'all':!![]}]:undefined});}})[_0x803e('0x1f')](respondWithResult(_0x36abd8,0xc9))[_0x803e('0x40')](handleError(_0x36abd8,null));};exports['update']=function(_0x58791b,_0x290139){if(_0x58791b['body']['id']){delete _0x58791b[_0x803e('0x45')]['id'];}return db[_0x803e('0x3c')]['find']({'where':{'id':_0x58791b[_0x803e('0x41')]['id']}})[_0x803e('0x1f')](handleEntityNotFound(_0x290139,null))['then'](saveUpdates(_0x58791b['body'],null))[_0x803e('0x1f')](respondWithResult(_0x290139,null))[_0x803e('0x40')](handleError(_0x290139,null));};exports[_0x803e('0x20')]=function(_0x294798,_0x2a20df){return db[_0x803e('0x3c')][_0x803e('0x42')]({'where':{'id':_0x294798[_0x803e('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a20df,null))[_0x803e('0x1f')](removeEntity(_0x2a20df,null))[_0x803e('0x40')](handleError(_0x2a20df,null));};exports[_0x803e('0x47')]=function(_0x117e17,_0xd10466,_0x2cfcce){_0x117e17['body'][_0x803e('0x22')]=_0x117e17[_0x803e('0x48')][_0x803e('0x49')];_0x117e17[_0x803e('0x45')]['basename']=_0x117e17[_0x803e('0x48')][_0x803e('0x4a')];_0x117e17[_0x803e('0x45')]['type']=_0x117e17[_0x803e('0x48')][_0x803e('0x4b')];return db[_0x803e('0x3c')][_0x803e('0x47')](_0x117e17[_0x803e('0x45')])[_0x803e('0x1f')](respondWithResult(_0xd10466,0xc9))[_0x803e('0x40')](handleError(_0xd10466,null));};exports['download']=function(_0x59b8b5,_0x40aff8,_0x518374){return db['Attachment'][_0x803e('0x4c')]({'where':{'id':_0x59b8b5['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x40aff8,null))[_0x803e('0x1f')](function(_0x34320b){if(_0x34320b){return _0x40aff8[_0x803e('0x4d')](path[_0x803e('0x4e')](config[_0x803e('0x4f')],_0x803e('0x50'),_0x34320b[_0x803e('0x51')]));}})[_0x803e('0x40')](handleError(_0x40aff8,null));}; \ No newline at end of file +var _0xde4f=['VIRTUAL','Attachment','includeAll','include','findAll','catch','show','params','options','find','clone','get','createdAt','updatedAt','body','create','file','basename','findOne','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','error','stack','index','rawAttributes','fieldName','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type'];(function(_0x358214,_0x1517b9){var _0x21195a=function(_0x55187d){while(--_0x55187d){_0x358214['push'](_0x358214['shift']());}};_0x21195a(++_0x1517b9);}(_0xde4f,0xba));var _0xfde4=function(_0x920a17,_0x1619dc){_0x920a17=_0x920a17-0x0;var _0x378756=_0xde4f[_0x920a17];return _0x378756;};'use strict';var pdf=require(_0xfde4('0x0'));var emlformat=require(_0xfde4('0x1'));var rimraf=require(_0xfde4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfde4('0x3'));var BPromise=require(_0xfde4('0x4'));var Mustache=require(_0xfde4('0x5'));var util=require(_0xfde4('0x6'));var path=require(_0xfde4('0x7'));var sox=require(_0xfde4('0x8'));var csv=require(_0xfde4('0x9'));var ejs=require(_0xfde4('0xa'));var fs=require('fs');var _=require(_0xfde4('0xb'));var squel=require(_0xfde4('0xc'));var crypto=require(_0xfde4('0xd'));var jsforce=require(_0xfde4('0xe'));var deskjs=require(_0xfde4('0xf'));var toCsv=require(_0xfde4('0x9'));var querystring=require('querystring');var Papa=require(_0xfde4('0x10'));var Redis=require('ioredis');var authService=require(_0xfde4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfde4('0x12'));var hardwareService=require(_0xfde4('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xfde4('0x14'));var config=require(_0xfde4('0x15'));var db=require(_0xfde4('0x16'))['db'];function respondWithStatusCode(_0x6a4470,_0x5b64ed){_0x5b64ed=_0x5b64ed||0xcc;return function(_0x396a94){if(_0x396a94){return _0x6a4470[_0xfde4('0x17')](_0x5b64ed);}return _0x6a4470['status'](_0x5b64ed)['end']();};}function respondWithResult(_0x3ddc1b,_0xc611b){_0xc611b=_0xc611b||0xc8;return function(_0xd1bc0f){if(_0xd1bc0f){return _0x3ddc1b['status'](_0xc611b)[_0xfde4('0x18')](_0xd1bc0f);}};}function respondWithFilteredResult(_0x10a36c,_0x360de4){return function(_0x4e2874){if(_0x4e2874){var _0x2b0760=_0x4e2874[_0xfde4('0x19')],_0x52c020=_0x360de4[_0xfde4('0x1a')],_0x4090fe=_0x360de4['offset']+_0x360de4[_0xfde4('0x1b')],_0x27e2d5;if(_0x4090fe>=_0x2b0760){_0x4090fe=_0x2b0760;_0x27e2d5=0xc8;}else{_0x27e2d5=0xce;}_0x10a36c[_0xfde4('0x1c')](_0x27e2d5);return _0x10a36c[_0xfde4('0x1d')](_0xfde4('0x1e'),_0x52c020+'-'+_0x4090fe+'/'+_0x2b0760)['json'](_0x4e2874);}return null;};}function patchUpdates(_0x513005){return function(_0x1cebd5){try{jsonpatch[_0xfde4('0x1f')](_0x1cebd5,_0x513005,!![]);}catch(_0x28eb77){return BPromise[_0xfde4('0x20')](_0x28eb77);}return _0x1cebd5[_0xfde4('0x21')]();};}function saveUpdates(_0x533fb0,_0x338723){return function(_0x1ee40f){if(_0x1ee40f){return _0x1ee40f[_0xfde4('0x22')](_0x533fb0)[_0xfde4('0x23')](function(_0x64401e){return _0x64401e;});}return null;};}function removeEntity(_0x21dcc7,_0x102fbe){return function(_0x37913b){if(_0x37913b){return _0x37913b['destroy']()[_0xfde4('0x23')](function(){_0x21dcc7[_0xfde4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x346dd4,_0x413e7c){return function(_0x15f4f3){if(!_0x15f4f3){_0x346dd4[_0xfde4('0x17')](0x194);}return _0x15f4f3;};}function handleError(_0x59de0b,_0x1908b6){_0x1908b6=_0x1908b6||0x1f4;return function(_0xdf9513){logger[_0xfde4('0x24')](_0xdf9513[_0xfde4('0x25')]);if(_0xdf9513['name']){delete _0xdf9513['name'];}_0x59de0b['status'](_0x1908b6)['send'](_0xdf9513);};}exports[_0xfde4('0x26')]=function(_0x12cd1b,_0x595a41){var _0x5ee740={},_0x5d7a2b={},_0x2ffe0b={'count':0x0,'rows':[]};var _0x2866f8=_['map'](db['Attachment'][_0xfde4('0x27')],function(_0x3a535f){return{'name':_0x3a535f[_0xfde4('0x28')],'type':_0x3a535f['type'][_0xfde4('0x29')]};});_0x5d7a2b[_0xfde4('0x2a')]=_[_0xfde4('0x2b')](_0x2866f8,_0xfde4('0x2c'));_0x5d7a2b[_0xfde4('0x2d')]=_[_0xfde4('0x2e')](_0x12cd1b[_0xfde4('0x2d')]);_0x5d7a2b[_0xfde4('0x2f')]=_[_0xfde4('0x30')](_0x5d7a2b['model'],_0x5d7a2b['query']);_0x5ee740[_0xfde4('0x31')]=_[_0xfde4('0x30')](_0x5d7a2b['model'],qs[_0xfde4('0x32')](_0x12cd1b[_0xfde4('0x2d')]['fields']));_0x5ee740[_0xfde4('0x31')]=_0x5ee740[_0xfde4('0x31')][_0xfde4('0x33')]?_0x5ee740[_0xfde4('0x31')]:_0x5d7a2b[_0xfde4('0x2a')];if(!_0x12cd1b[_0xfde4('0x2d')]['hasOwnProperty'](_0xfde4('0x34'))){_0x5ee740['limit']=qs['limit'](_0x12cd1b[_0xfde4('0x2d')][_0xfde4('0x1b')]);_0x5ee740[_0xfde4('0x1a')]=qs[_0xfde4('0x1a')](_0x12cd1b[_0xfde4('0x2d')]['offset']);}_0x5ee740[_0xfde4('0x35')]=qs[_0xfde4('0x36')](_0x12cd1b[_0xfde4('0x2d')][_0xfde4('0x36')]);_0x5ee740[_0xfde4('0x37')]=qs[_0xfde4('0x2f')](_[_0xfde4('0x38')](_0x12cd1b['query'],_0x5d7a2b['filters']),_0x2866f8);if(_0x12cd1b[_0xfde4('0x2d')][_0xfde4('0x39')]){_0x5ee740['where']=_[_0xfde4('0x3a')](_0x5ee740[_0xfde4('0x37')],{'$or':_[_0xfde4('0x2b')](_0x2866f8,function(_0x562a5c){if(_0x562a5c[_0xfde4('0x3b')]!==_0xfde4('0x3c')){var _0xc6d471={};_0xc6d471[_0x562a5c['name']]={'$like':'%'+_0x12cd1b[_0xfde4('0x2d')]['filter']+'%'};return _0xc6d471;}})});}_0x5ee740=_[_0xfde4('0x3a')]({},_0x5ee740,_0x12cd1b['options']);var _0x45c870={'where':_0x5ee740[_0xfde4('0x37')]};return db[_0xfde4('0x3d')][_0xfde4('0x19')](_0x45c870)[_0xfde4('0x23')](function(_0x161c21){_0x2ffe0b['count']=_0x161c21;if(_0x12cd1b['query'][_0xfde4('0x3e')]){_0x5ee740[_0xfde4('0x3f')]=[{'all':!![]}];}return db[_0xfde4('0x3d')][_0xfde4('0x40')](_0x5ee740);})[_0xfde4('0x23')](function(_0x2256a2){_0x2ffe0b['rows']=_0x2256a2;return _0x2ffe0b;})[_0xfde4('0x23')](respondWithFilteredResult(_0x595a41,_0x5ee740))[_0xfde4('0x41')](handleError(_0x595a41,null));};exports[_0xfde4('0x42')]=function(_0x1aa999,_0x566df8){var _0x5e16a1={'raw':!![],'where':{'id':_0x1aa999[_0xfde4('0x43')]['id']}},_0x1b3732={};_0x1b3732[_0xfde4('0x2a')]=_[_0xfde4('0x2e')](db[_0xfde4('0x3d')][_0xfde4('0x27')]);_0x1b3732[_0xfde4('0x2d')]=_['keys'](_0x1aa999[_0xfde4('0x2d')]);_0x1b3732[_0xfde4('0x2f')]=_['intersection'](_0x1b3732['model'],_0x1b3732[_0xfde4('0x2d')]);_0x5e16a1[_0xfde4('0x31')]=_[_0xfde4('0x30')](_0x1b3732[_0xfde4('0x2a')],qs['fields'](_0x1aa999[_0xfde4('0x2d')][_0xfde4('0x32')]));_0x5e16a1[_0xfde4('0x31')]=_0x5e16a1['attributes'][_0xfde4('0x33')]?_0x5e16a1[_0xfde4('0x31')]:_0x1b3732['model'];if(_0x1aa999[_0xfde4('0x2d')][_0xfde4('0x3e')]){_0x5e16a1[_0xfde4('0x3f')]=[{'all':!![]}];}_0x5e16a1=_[_0xfde4('0x3a')]({},_0x5e16a1,_0x1aa999[_0xfde4('0x44')]);return db[_0xfde4('0x3d')][_0xfde4('0x45')](_0x5e16a1)[_0xfde4('0x23')](handleEntityNotFound(_0x566df8,null))[_0xfde4('0x23')](respondWithResult(_0x566df8,null))[_0xfde4('0x41')](handleError(_0x566df8,null));};exports[_0xfde4('0x46')]=function(_0x315540,_0x7ae80a){var _0x160f89={'where':{'id':_0x315540[_0xfde4('0x43')]['id']}},_0xc97cca={};_0xc97cca[_0xfde4('0x2a')]=_[_0xfde4('0x2e')](db['Attachment'][_0xfde4('0x27')]);_0x160f89[_0xfde4('0x31')]=_['intersection'](_0xc97cca[_0xfde4('0x2a')],qs[_0xfde4('0x32')](_0x315540[_0xfde4('0x2d')][_0xfde4('0x32')]));_0x160f89[_0xfde4('0x31')]=_0x160f89[_0xfde4('0x31')]['length']?_0x160f89['attributes']:_0xc97cca[_0xfde4('0x2a')];if(_0x315540[_0xfde4('0x2d')][_0xfde4('0x3e')]){_0x160f89[_0xfde4('0x3f')]=[{'all':!![]}];}_0x160f89=_['merge']({},_0x160f89,_0x315540[_0xfde4('0x44')]);return db[_0xfde4('0x3d')][_0xfde4('0x45')](_0x160f89)['then'](handleEntityNotFound(_0x7ae80a,null))[_0xfde4('0x23')](function(_0x41c205){if(_0x41c205){var _0x7f3d40=_0x41c205[_0xfde4('0x47')]({'plain':!![]});_0x7f3d40=qs['omit'](_0x7f3d40,['id',_0xfde4('0x48'),_0xfde4('0x49')]);_0x315540[_0xfde4('0x4a')]=_['omit'](_0x315540[_0xfde4('0x4a')],['id',_0xfde4('0x48'),_0xfde4('0x49')]);return db['Attachment']['create'](_[_0xfde4('0x3a')](_0x7f3d40,_0x315540['body']),{'include':_0x315540[_0xfde4('0x2d')][_0xfde4('0x3e')]?[{'all':!![]}]:undefined});}})[_0xfde4('0x23')](respondWithResult(_0x7ae80a,0xc9))[_0xfde4('0x41')](handleError(_0x7ae80a,null));};exports[_0xfde4('0x22')]=function(_0x2f6c03,_0x3a35d1){if(_0x2f6c03[_0xfde4('0x4a')]['id']){delete _0x2f6c03[_0xfde4('0x4a')]['id'];}return db[_0xfde4('0x3d')][_0xfde4('0x45')]({'where':{'id':_0x2f6c03[_0xfde4('0x43')]['id']}})[_0xfde4('0x23')](handleEntityNotFound(_0x3a35d1,null))['then'](saveUpdates(_0x2f6c03[_0xfde4('0x4a')],null))[_0xfde4('0x23')](respondWithResult(_0x3a35d1,null))[_0xfde4('0x41')](handleError(_0x3a35d1,null));};exports['destroy']=function(_0x29872c,_0x18bb6e){return db[_0xfde4('0x3d')][_0xfde4('0x45')]({'where':{'id':_0x29872c[_0xfde4('0x43')]['id']}})[_0xfde4('0x23')](handleEntityNotFound(_0x18bb6e,null))['then'](removeEntity(_0x18bb6e,null))[_0xfde4('0x41')](handleError(_0x18bb6e,null));};exports[_0xfde4('0x4b')]=function(_0x18bc19,_0x2e3486,_0x1ea0e3){_0x18bc19[_0xfde4('0x4a')][_0xfde4('0x2c')]=_0x18bc19[_0xfde4('0x4c')]['originalname'];_0x18bc19['body'][_0xfde4('0x4d')]=_0x18bc19[_0xfde4('0x4c')]['filename'];_0x18bc19['body'][_0xfde4('0x3b')]=_0x18bc19[_0xfde4('0x4c')]['mimetype'];return db[_0xfde4('0x3d')][_0xfde4('0x4b')](_0x18bc19[_0xfde4('0x4a')])[_0xfde4('0x23')](respondWithResult(_0x2e3486,0xc9))[_0xfde4('0x41')](handleError(_0x2e3486,null));};exports['download']=function(_0x55f080,_0x256e33,_0x1bf0eb){return db[_0xfde4('0x3d')][_0xfde4('0x4e')]({'where':{'id':_0x55f080[_0xfde4('0x43')]['id']},'raw':!![]})[_0xfde4('0x23')](handleEntityNotFound(_0x256e33,null))['then'](function(_0x3654b5){if(_0x3654b5){return _0x256e33['download'](path[_0xfde4('0x4f')](config[_0xfde4('0x50')],_0xfde4('0x51'),_0x3654b5[_0xfde4('0x4d')]));}})[_0xfde4('0x41')](handleError(_0x256e33,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index d4f4346..30de2ee 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 _0x980c=['./attachment.attributes','define','Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x58c7bf,_0x525914){var _0x89ccf0=function(_0x2fa7d0){while(--_0x2fa7d0){_0x58c7bf['push'](_0x58c7bf['shift']());}};_0x89ccf0(++_0x525914);}(_0x980c,0x100));var _0xc980=function(_0x11cc3a,_0x7bd8c0){_0x11cc3a=_0x11cc3a-0x0;var _0x52e9c3=_0x980c[_0x11cc3a];return _0x52e9c3;};'use strict';var _=require(_0xc980('0x0'));var util=require(_0xc980('0x1'));var logger=require(_0xc980('0x2'))(_0xc980('0x3'));var moment=require(_0xc980('0x4'));var BPromise=require(_0xc980('0x5'));var rp=require(_0xc980('0x6'));var fs=require('fs');var path=require(_0xc980('0x7'));var rimraf=require(_0xc980('0x8'));var config=require(_0xc980('0x9'));var attributes=require(_0xc980('0xa'));module['exports']=function(_0x472ece,_0x311a54){return _0x472ece[_0xc980('0xb')](_0xc980('0xc'),attributes,{'tableName':_0xc980('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2250=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','lodash'];(function(_0x2bb452,_0x2dbbc0){var _0x5f50a6=function(_0x4f66ce){while(--_0x4f66ce){_0x2bb452['push'](_0x2bb452['shift']());}};_0x5f50a6(++_0x2dbbc0);}(_0x2250,0x178));var _0x0225=function(_0x1090f8,_0xd83a11){_0x1090f8=_0x1090f8-0x0;var _0x180524=_0x2250[_0x1090f8];return _0x180524;};'use strict';var _=require(_0x0225('0x0'));var util=require(_0x0225('0x1'));var logger=require(_0x0225('0x2'))(_0x0225('0x3'));var moment=require(_0x0225('0x4'));var BPromise=require(_0x0225('0x5'));var rp=require(_0x0225('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0225('0x7'));var config=require(_0x0225('0x8'));var attributes=require(_0x0225('0x9'));module[_0x0225('0xa')]=function(_0x3d3895,_0x3779fe){return _0x3d3895[_0x0225('0xb')](_0x0225('0xc'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 7b0ee10..417b479 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 _0xe3e3=['then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','result','CreateAttachment','Attachment','create','body','options','raw','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request'];(function(_0x18f047,_0x47a9bf){var _0x3c241f=function(_0x4bf1f3){while(--_0x4bf1f3){_0x18f047['push'](_0x18f047['shift']());}};_0x3c241f(++_0x47a9bf);}(_0xe3e3,0xfa));var _0x3e3e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe3e3[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x3e3e('0x0'));var util=require('util');var moment=require(_0x3e3e('0x1'));var BPromise=require(_0x3e3e('0x2'));var rs=require(_0x3e3e('0x3'));var fs=require('fs');var Redis=require(_0x3e3e('0x4'));var db=require(_0x3e3e('0x5'))['db'];var utils=require(_0x3e3e('0x6'));var logger=require(_0x3e3e('0x7'))(_0x3e3e('0x8'));var config=require(_0x3e3e('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x432a7b,_0x529bc7,_0x3859d6){return new BPromise(function(_0x3f396d,_0x56e229){return client[_0x3e3e('0xa')](_0x432a7b,_0x3859d6)[_0x3e3e('0xb')](function(_0x290d3b){logger[_0x3e3e('0xc')]('Attachment,\x20%s,\x20%s',_0x529bc7,_0x3e3e('0xd'));logger[_0x3e3e('0xe')](_0x3e3e('0xf'),_0x529bc7,'request\x20sent',JSON[_0x3e3e('0x10')](_0x290d3b));if(_0x290d3b[_0x3e3e('0x11')]){if(_0x290d3b[_0x3e3e('0x11')][_0x3e3e('0x12')]===0x1f4){logger['error'](_0x3e3e('0x13'),_0x529bc7,_0x290d3b['error'][_0x3e3e('0x14')]);return _0x56e229(_0x290d3b[_0x3e3e('0x11')]['message']);}logger[_0x3e3e('0x11')](_0x3e3e('0x13'),_0x529bc7,_0x290d3b[_0x3e3e('0x11')][_0x3e3e('0x14')]);return _0x3f396d(_0x290d3b[_0x3e3e('0x11')][_0x3e3e('0x14')]);}else{logger[_0x3e3e('0xc')](_0x3e3e('0x13'),_0x529bc7,_0x3e3e('0xd'));_0x3f396d(_0x290d3b[_0x3e3e('0x15')][_0x3e3e('0x14')]);}})['catch'](function(_0x5b91f1){logger[_0x3e3e('0x11')](_0x3e3e('0x13'),_0x529bc7,_0x5b91f1);_0x56e229(_0x5b91f1);});});}exports[_0x3e3e('0x16')]=function(_0x136039){var _0x4458a9=this;return new Promise(function(_0x59aec4,_0x1969c3){return db[_0x3e3e('0x17')][_0x3e3e('0x18')](_0x136039[_0x3e3e('0x19')],{'raw':_0x136039[_0x3e3e('0x1a')]?_0x136039[_0x3e3e('0x1a')][_0x3e3e('0x1b')]===undefined?!![]:![]:!![]})[_0x3e3e('0xb')](function(_0x4b2a55){logger[_0x3e3e('0xc')](_0x3e3e('0x16'),_0x136039);logger[_0x3e3e('0xe')]('CreateAttachment',_0x136039,JSON['stringify'](_0x4b2a55));_0x59aec4(_0x4b2a55);})[_0x3e3e('0x1c')](function(_0xba7473){logger[_0x3e3e('0x11')](_0x3e3e('0x16'),_0xba7473['message'],_0x136039);_0x1969c3(_0x4458a9[_0x3e3e('0x11')](0x1f4,_0xba7473[_0x3e3e('0x14')]));});});}; \ No newline at end of file +var _0x070b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateAttachment','Attachment','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x162246,_0x4e5038){var _0x32ac95=function(_0x22270b){while(--_0x22270b){_0x162246['push'](_0x162246['shift']());}};_0x32ac95(++_0x4e5038);}(_0x070b,0xb4));var _0xb070=function(_0x24ffed,_0x3b9157){_0x24ffed=_0x24ffed-0x0;var _0x47dc70=_0x070b[_0x24ffed];return _0x47dc70;};'use strict';var _=require(_0xb070('0x0'));var util=require(_0xb070('0x1'));var moment=require(_0xb070('0x2'));var BPromise=require(_0xb070('0x3'));var rs=require(_0xb070('0x4'));var fs=require('fs');var Redis=require(_0xb070('0x5'));var db=require(_0xb070('0x6'))['db'];var utils=require(_0xb070('0x7'));var logger=require(_0xb070('0x8'))(_0xb070('0x9'));var config=require(_0xb070('0xa'));var jayson=require(_0xb070('0xb'));var client=jayson[_0xb070('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49d6fa,_0x527892,_0x139a44){return new BPromise(function(_0x5926da,_0x515942){return client[_0xb070('0xd')](_0x49d6fa,_0x139a44)[_0xb070('0xe')](function(_0x3b0008){logger[_0xb070('0xf')](_0xb070('0x10'),_0x527892,_0xb070('0x11'));logger[_0xb070('0x12')](_0xb070('0x13'),_0x527892,'request\x20sent',JSON['stringify'](_0x3b0008));if(_0x3b0008[_0xb070('0x14')]){if(_0x3b0008[_0xb070('0x14')][_0xb070('0x15')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x527892,_0x3b0008[_0xb070('0x14')][_0xb070('0x16')]);return _0x515942(_0x3b0008[_0xb070('0x14')][_0xb070('0x16')]);}logger[_0xb070('0x14')](_0xb070('0x10'),_0x527892,_0x3b0008[_0xb070('0x14')][_0xb070('0x16')]);return _0x5926da(_0x3b0008[_0xb070('0x14')][_0xb070('0x16')]);}else{logger[_0xb070('0xf')](_0xb070('0x10'),_0x527892,_0xb070('0x11'));_0x5926da(_0x3b0008[_0xb070('0x17')]['message']);}})[_0xb070('0x18')](function(_0x5c63bb){logger[_0xb070('0x14')](_0xb070('0x10'),_0x527892,_0x5c63bb);_0x515942(_0x5c63bb);});});}exports[_0xb070('0x19')]=function(_0x2073fc){var _0x4689dc=this;return new Promise(function(_0x385716,_0x54b560){return db[_0xb070('0x1a')][_0xb070('0x1b')](_0x2073fc['body'],{'raw':_0x2073fc[_0xb070('0x1c')]?_0x2073fc[_0xb070('0x1c')][_0xb070('0x1d')]===undefined?!![]:![]:!![]})[_0xb070('0xe')](function(_0x20f4f6){logger[_0xb070('0xf')]('CreateAttachment',_0x2073fc);logger['debug']('CreateAttachment',_0x2073fc,JSON[_0xb070('0x1e')](_0x20f4f6));_0x385716(_0x20f4f6);})[_0xb070('0x18')](function(_0x964a69){logger[_0xb070('0x14')](_0xb070('0x19'),_0x964a69[_0xb070('0x16')],_0x2073fc);_0x54b560(_0x4689dc[_0xb070('0x14')](0x1f4,_0x964a69['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 331a747..a2ab13a 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 _0x6c00=['index','show','download','post','/:id/clone','clone','diskStorage','join','format','%s-%s','replace','single','file','create','put','/:id','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','get','isAuthenticated'];(function(_0x3112af,_0x41d6fc){var _0x5504e0=function(_0x2a6a17){while(--_0x2a6a17){_0x3112af['push'](_0x3112af['shift']());}};_0x5504e0(++_0x41d6fc);}(_0x6c00,0x1a9));var _0x06c0=function(_0x1417c6,_0x194309){_0x1417c6=_0x1417c6-0x0;var _0x44db97=_0x6c00[_0x1417c6];return _0x44db97;};'use strict';var multer=require(_0x06c0('0x0'));var util=require(_0x06c0('0x1'));var path=require(_0x06c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x06c0('0x3'));var router=express[_0x06c0('0x4')]();var auth=require(_0x06c0('0x5'));var interaction=require(_0x06c0('0x6'));var config=require('../../config/environment');var controller=require(_0x06c0('0x7'));router[_0x06c0('0x8')]('/',auth[_0x06c0('0x9')](),controller[_0x06c0('0xa')]);router[_0x06c0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x06c0('0xb')]);router[_0x06c0('0x8')]('/:id/download',auth[_0x06c0('0x9')](),controller[_0x06c0('0xc')]);router[_0x06c0('0xd')](_0x06c0('0xe'),auth[_0x06c0('0x9')](),controller[_0x06c0('0xf')]);var upload=multer({'storage':multer[_0x06c0('0x10')]({'destination':function(_0x139770,_0x3bad48,_0x804c54){_0x804c54(null,path[_0x06c0('0x11')](config['root'],'server/files/attachments/'));},'filename':function(_0x394397,_0xc05495,_0x462ee2){_0x462ee2(null,util[_0x06c0('0x12')](_0x06c0('0x13'),Date['now'](),_0xc05495['originalname'][_0x06c0('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x06c0('0xd')]('/',upload[_0x06c0('0x15')](_0x06c0('0x16')),controller[_0x06c0('0x17')]);router[_0x06c0('0x18')](_0x06c0('0x19'),auth['isAuthenticated'](),controller[_0x06c0('0x1a')]);router[_0x06c0('0x1b')](_0x06c0('0x19'),auth[_0x06c0('0x9')](),controller[_0x06c0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x6478=['./attachment.controller','get','/:id','isAuthenticated','show','/:id/download','download','post','/:id/clone','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','file','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x4e6a4f,_0x204514){var _0x18a324=function(_0x5dded6){while(--_0x5dded6){_0x4e6a4f['push'](_0x4e6a4f['shift']());}};_0x18a324(++_0x204514);}(_0x6478,0x1e7));var _0x8647=function(_0x4e85ec,_0x2913b6){_0x4e85ec=_0x4e85ec-0x0;var _0x1c1ab3=_0x6478[_0x4e85ec];return _0x1c1ab3;};'use strict';var multer=require(_0x8647('0x0'));var util=require(_0x8647('0x1'));var path=require(_0x8647('0x2'));var timeout=require(_0x8647('0x3'));var express=require(_0x8647('0x4'));var router=express[_0x8647('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x8647('0x6'));var config=require(_0x8647('0x7'));var controller=require(_0x8647('0x8'));router[_0x8647('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8647('0x9')](_0x8647('0xa'),auth[_0x8647('0xb')](),controller[_0x8647('0xc')]);router[_0x8647('0x9')](_0x8647('0xd'),auth[_0x8647('0xb')](),controller[_0x8647('0xe')]);router[_0x8647('0xf')](_0x8647('0x10'),auth[_0x8647('0xb')](),controller[_0x8647('0x11')]);var upload=multer({'storage':multer[_0x8647('0x12')]({'destination':function(_0x2e27ba,_0x408549,_0x1bc120){_0x1bc120(null,path[_0x8647('0x13')](config[_0x8647('0x14')],_0x8647('0x15')));},'filename':function(_0x5f1f3a,_0x11e9d0,_0x4a7fcb){_0x4a7fcb(null,util[_0x8647('0x16')](_0x8647('0x17'),Date[_0x8647('0x18')](),_0x11e9d0[_0x8647('0x19')][_0x8647('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0x8647('0x1b')](_0x8647('0x1c')),controller[_0x8647('0x1d')]);router[_0x8647('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x8647('0x1f')]);router[_0x8647('0x20')](_0x8647('0xa'),auth[_0x8647('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 317e78d..b4db01e 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 _0xc21b=['../../components/auth/service','signToken','../../config/utils','login','/login','profile','email','callback','authenticate','google','secret','callbackURL','findOne','allowedLoginAttempts','then','User','map','emails','value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','clearBlockUser','getLicense','catch','passport','Strategy','moment','../../mysqldb','../../config/environment'];(function(_0x3946b4,_0x57b626){var _0xfca662=function(_0x25bdc3){while(--_0x25bdc3){_0x3946b4['push'](_0x3946b4['shift']());}};_0xfca662(++_0x57b626);}(_0xc21b,0xf7));var _0xbc21=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0xc21b[_0x7d62cb];return _0x3a6266;};'use strict';var _=require('lodash');var passport=require(_0xbc21('0x0'));var GoogleStrategy=require('passport-google-oauth20')[_0xbc21('0x1')];var moment=require(_0xbc21('0x2'));var db=require(_0xbc21('0x3'))['db'];var config=require(_0xbc21('0x4'));var signToken=require(_0xbc21('0x5'))[_0xbc21('0x6')];var utils=require(_0xbc21('0x7'));exports[_0xbc21('0x8')]=passport['authenticate']('google',{'failureRedirect':_0xbc21('0x9'),'scope':[_0xbc21('0xa'),_0xbc21('0xb')],'session':![]});exports[_0xbc21('0xc')]=passport[_0xbc21('0xd')](_0xbc21('0xe'),{'failureRedirect':_0xbc21('0x9'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config['google']?config[_0xbc21('0xe')]['clientID']:'id','clientSecret':config[_0xbc21('0xe')]?config[_0xbc21('0xe')]['clientSecret']:_0xbc21('0xf'),'callbackURL':config[_0xbc21('0xe')]?config['google'][_0xbc21('0x10')]:''},function(_0x12da3e,_0x522564,_0x39efff,_0x15161b){var _0x3ab877,_0x2227aa;return db['Setting'][_0xbc21('0x11')]({'where':{'id':0x1},'attributes':[_0xbc21('0x12'),'blockDuration'],'raw':!![]})[_0xbc21('0x13')](function(_0x29ca87){_0x3ab877=_0x29ca87;return db[_0xbc21('0x14')]['find']({'where':{'email':_[_0xbc21('0x15')](_0x39efff[_0xbc21('0x16')],_0xbc21('0x17')),'role':{'$or':[_0xbc21('0x18'),_0xbc21('0x19'),_0xbc21('0x1a')]}}});})[_0xbc21('0x13')](function(_0x2a7ff2){_0x2227aa=_0x2a7ff2;if(_0x2227aa){if(_0x2227aa[_0xbc21('0x1b')]){return _0x15161b(_0xbc21('0x1c'));}else if(_0x3ab877[_0xbc21('0x1d')]>0x0){if(_0x2227aa[_0xbc21('0x1e')]){if(moment(_0x2227aa[_0xbc21('0x1f')])[_0xbc21('0x20')](_0x3ab877[_0xbc21('0x1d')],'minutes')>moment()){return _0x15161b(_0xbc21('0x1c'));}else{return utils[_0xbc21('0x21')](_0x2227aa,0x0,![],null)[_0xbc21('0x13')](function(){return utils['getLicense'](_0x2227aa);})[_0xbc21('0x13')](function(){return _0x15161b(null,_0x2227aa);});}}else{return utils[_0xbc21('0x22')](_0x2227aa)[_0xbc21('0x13')](function(){return _0x15161b(null,_0x2227aa);});}}else{return utils[_0xbc21('0x22')](_0x2227aa)[_0xbc21('0x13')](function(){return _0x15161b(null,_0x2227aa);});}}return _0x15161b(_0xbc21('0x1c'));})[_0xbc21('0x23')](function(_0xa7c104){_0x15161b(_0xa7c104);});})); \ No newline at end of file +var _0x02f8=['find','map','value','admin','user','agent','disabled','blockedAt','minutes','clearBlockUser','getLicense','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../components/auth/service','google','/login','callback','use','clientID','clientSecret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then'];(function(_0xf3f94b,_0x4896ed){var _0x5d4c5a=function(_0x59129f){while(--_0x59129f){_0xf3f94b['push'](_0xf3f94b['shift']());}};_0x5d4c5a(++_0x4896ed);}(_0x02f8,0x193));var _0x802f=function(_0x32d9fe,_0x213473){_0x32d9fe=_0x32d9fe-0x0;var _0x1b8f8e=_0x02f8[_0x32d9fe];return _0x1b8f8e;};'use strict';var _=require(_0x802f('0x0'));var passport=require(_0x802f('0x1'));var GoogleStrategy=require(_0x802f('0x2'))[_0x802f('0x3')];var moment=require('moment');var db=require(_0x802f('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0x802f('0x5'))['signToken'];var utils=require('../../config/utils');exports['login']=passport['authenticate'](_0x802f('0x6'),{'failureRedirect':_0x802f('0x7'),'scope':['profile','email'],'session':![]});exports[_0x802f('0x8')]=passport['authenticate'](_0x802f('0x6'),{'failureRedirect':_0x802f('0x7'),'session':![]});passport[_0x802f('0x9')](new GoogleStrategy({'clientID':config['google']?config[_0x802f('0x6')][_0x802f('0xa')]:'id','clientSecret':config[_0x802f('0x6')]?config['google'][_0x802f('0xb')]:'secret','callbackURL':config[_0x802f('0x6')]?config[_0x802f('0x6')][_0x802f('0xc')]:''},function(_0x3a3819,_0x109244,_0x20716d,_0x3925c7){var _0x70c9d,_0x5a258c;return db['Setting'][_0x802f('0xd')]({'where':{'id':0x1},'attributes':[_0x802f('0xe'),_0x802f('0xf')],'raw':!![]})[_0x802f('0x10')](function(_0x4cba4b){_0x70c9d=_0x4cba4b;return db['User'][_0x802f('0x11')]({'where':{'email':_[_0x802f('0x12')](_0x20716d['emails'],_0x802f('0x13')),'role':{'$or':[_0x802f('0x14'),_0x802f('0x15'),_0x802f('0x16')]}}});})['then'](function(_0x59aabd){_0x5a258c=_0x59aabd;if(_0x5a258c){if(_0x5a258c[_0x802f('0x17')]){return _0x3925c7('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x70c9d[_0x802f('0xf')]>0x0){if(_0x5a258c['blocked']){if(moment(_0x5a258c[_0x802f('0x18')])['add'](_0x70c9d[_0x802f('0xf')],_0x802f('0x19'))>moment()){return _0x3925c7('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x802f('0x1a')](_0x5a258c,0x0,![],null)['then'](function(){return utils[_0x802f('0x1b')](_0x5a258c);})['then'](function(){return _0x3925c7(null,_0x5a258c);});}}else{return utils[_0x802f('0x1b')](_0x5a258c)[_0x802f('0x10')](function(){return _0x3925c7(null,_0x5a258c);});}}else{return utils[_0x802f('0x1b')](_0x5a258c)[_0x802f('0x10')](function(){return _0x3925c7(null,_0x5a258c);});}}return _0x3925c7(_0x802f('0x1c'));})[_0x802f('0x1d')](function(_0x448637){_0x3925c7(_0x448637);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 53b9ff6..055055e 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 _0x195e=['passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','exports','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x195e,0xfb));var _0xe195=function(_0x102400,_0x141525){_0x102400=_0x102400-0x0;var _0x2c8ea7=_0x195e[_0x102400];return _0x2c8ea7;};'use strict';var express=require(_0xe195('0x0'));var passport=require(_0xe195('0x1'));var router=express[_0xe195('0x2')]();var controller=require(_0xe195('0x3'));var userController=require(_0xe195('0x4'));var authService=require(_0xe195('0x5'));router[_0xe195('0x6')]('/',controller[_0xe195('0x7')]);router[_0xe195('0x6')](_0xe195('0x8'),controller[_0xe195('0x9')],authService[_0xe195('0xa')],userController[_0xe195('0x7')],authService['setTokenCookie']);module[_0xe195('0xb')]=router; \ No newline at end of file +var _0xd0bb=['exports','express','passport','Router','../user/user.controller.js','get','login','/callback','isMiddleware','setTokenCookie'];(function(_0x467cf5,_0x271278){var _0xf535ff=function(_0x3ef491){while(--_0x3ef491){_0x467cf5['push'](_0x467cf5['shift']());}};_0xf535ff(++_0x271278);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x1300ec,_0x3ff267){_0x1300ec=_0x1300ec-0x0;var _0x2c13c9=_0xd0bb[_0x1300ec];return _0x2c13c9;};'use strict';var express=require(_0xbd0b('0x0'));var passport=require(_0xbd0b('0x1'));var router=express[_0xbd0b('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xbd0b('0x3'));var authService=require('../../components/auth/service');router[_0xbd0b('0x4')]('/',controller[_0xbd0b('0x5')]);router['get'](_0xbd0b('0x6'),controller['callback'],authService[_0xbd0b('0x7')],userController[_0xbd0b('0x5')],authService[_0xbd0b('0x8')]);module[_0xbd0b('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 4812939..212a222 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 _0xce39=['blocked','blockedAt','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','Smtp','service','host','port','secure','authentication','user','merge','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','online','body','toLowerCase','User','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','http://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','securePassword','use','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','name','password','salt'];(function(_0xeec7d5,_0x5c6209){var _0x134a7b=function(_0x3dc8e4){while(--_0x3dc8e4){_0xeec7d5['push'](_0xeec7d5['shift']());}};_0x134a7b(++_0x5c6209);}(_0xce39,0x198));var _0x9ce3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xce39[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x9ce3('0x0'));var passport=require(_0x9ce3('0x1'));var LocalStrategy=require(_0x9ce3('0x2'))[_0x9ce3('0x3')];var jayson=require('jayson/promise');var _=require(_0x9ce3('0x4'));var rs=require(_0x9ce3('0x5'));var moment=require(_0x9ce3('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x9ce3('0x7'));var utils=require(_0x9ce3('0x8'));var client=jayson[_0x9ce3('0x9')][_0x9ce3('0xa')]({'port':0x232b});function localAuthenticate(_0x14e1b1,_0x350ba2,_0x3ff3a9,_0x4eb633){var _0x1db553,_0x2d4c93;return db[_0x9ce3('0xb')][_0x9ce3('0xc')]({'where':{'id':0x1},'attributes':[_0x9ce3('0xd'),_0x9ce3('0xe')],'raw':!![]})['then'](function(_0x22142d){_0x1db553=_0x22142d;return _0x14e1b1[_0x9ce3('0xc')]({'attributes':['id',_0x9ce3('0xf'),_0x9ce3('0x10'),_0x9ce3('0x11'),'role','disabled',_0x9ce3('0x12'),_0x9ce3('0x13'),'loginAttempts'],'where':{'name':_0x350ba2,'role':{'$or':['admin','user',_0x9ce3('0x14')]}}});})[_0x9ce3('0x15')](function(_0x2f6efd){if(!_0x2f6efd||_0x2f6efd&&_0x2f6efd[_0x9ce3('0xf')]!==_0x350ba2){throw new Error(_0x9ce3('0x16'));}else{_0x2d4c93=_0x2f6efd;return _0x2d4c93;}})[_0x9ce3('0x15')](function(){_0x2d4c93[_0x9ce3('0x17')](_0x3ff3a9,function(_0x846b24,_0x505813){var _0x2ad91c=_0x2d4c93['loginAttempts']+0x1;if(_0x846b24){return _0x4eb633(_0x846b24);}else if(!_0x505813){if(_0x2d4c93[_0x9ce3('0x18')]){return _0x4eb633(null,![],{'message':_0x9ce3('0x16')});}else if(_0x1db553[_0x9ce3('0xd')]>0x0){if(_0x2d4c93['blocked']){if(_0x1db553[_0x9ce3('0xe')]>0x0){if(moment(_0x2d4c93[_0x9ce3('0x13')])[_0x9ce3('0x19')](_0x1db553[_0x9ce3('0xe')],'minutes')>moment()){return _0x4eb633(null,![],{'message':_0x9ce3('0x16')});}else{return utils['clearBlockUser'](_0x2d4c93,_0x2ad91c,![],null)['then'](function(){return _0x4eb633(null,![],{'message':_0x9ce3('0x16')});});}}else{return _0x4eb633(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2ad91c>=_0x1db553[_0x9ce3('0xd')]){return utils[_0x9ce3('0x1a')](_0x2d4c93,0x0,!![],moment())[_0x9ce3('0x15')](function(){return _0x4eb633(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x9ce3('0x1a')](_0x2d4c93,_0x2ad91c,![],null)[_0x9ce3('0x15')](function(){return _0x4eb633(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x4eb633(null,![],{'message':_0x9ce3('0x16')});}}else{if(_0x2d4c93['disabled']){return _0x4eb633(null,![],{'message':_0x9ce3('0x16')});}else if(_0x1db553[_0x9ce3('0xd')]>0x0){if(_0x2d4c93[_0x9ce3('0x12')]){if(_0x1db553[_0x9ce3('0xe')]>0x0){if(moment(_0x2d4c93[_0x9ce3('0x13')])[_0x9ce3('0x19')](_0x1db553['blockDuration'],_0x9ce3('0x1b'))>moment()){return _0x4eb633(null,![],{'message':_0x9ce3('0x16')});}else{return utils['clearBlockUser'](_0x2d4c93,0x0,![],null)[_0x9ce3('0x15')](function(){return utils[_0x9ce3('0x1c')](_0x2d4c93);})[_0x9ce3('0x15')](function(){return _0x4eb633(null,_0x2d4c93);});}}else{return _0x4eb633(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x9ce3('0x1a')](_0x2d4c93,0x0,![],null)[_0x9ce3('0x15')](function(){return utils[_0x9ce3('0x1c')](_0x2d4c93);})['then'](function(){return _0x4eb633(null,_0x2d4c93);})[_0x9ce3('0x1d')](function(_0x267c14){return _0x4eb633(null,![],_0x267c14);});}}else{if(_0x2d4c93['blocked']){return _0x4eb633(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x2d4c93)['then'](function(){return _0x4eb633(null,_0x2d4c93);});}}}});})[_0x9ce3('0x1d')](function(_0x37444a){return _0x4eb633(null,![],_0x37444a);});}function sendServiceMail(_0x310b15){return db[_0x9ce3('0x1e')][_0x9ce3('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x9ce3('0xf'),_0x9ce3('0x20')],'include':[{'model':db['MailServerOut'],'as':_0x9ce3('0x21')}]})['then'](function(_0x58a7af){if(!_0x58a7af){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0xc6f1e9={'tls':{'rejectUnauthorized':![]}};if(_0x58a7af['Smtp'][_0x9ce3('0x22')]){_0xc6f1e9[_0x9ce3('0x22')]=_0x58a7af[_0x9ce3('0x21')][_0x9ce3('0x22')];}else{_0xc6f1e9[_0x9ce3('0x23')]=_0x58a7af[_0x9ce3('0x21')][_0x9ce3('0x23')];_0xc6f1e9[_0x9ce3('0x24')]=_0x58a7af[_0x9ce3('0x21')][_0x9ce3('0x24')];_0xc6f1e9['secure']=_0x58a7af[_0x9ce3('0x21')][_0x9ce3('0x25')];}if(_0x58a7af['Smtp'][_0x9ce3('0x26')]){_0xc6f1e9['auth']={'user':_0x58a7af[_0x9ce3('0x21')][_0x9ce3('0x27')],'pass':_0x58a7af['Smtp']['pass']};}var _0x413107={'account':_0xc6f1e9,'message':_[_0x9ce3('0x28')]({'from':util[_0x9ce3('0x29')]('\x22%s\x22\x20<%s>',_0x58a7af['name'],_0x58a7af[_0x9ce3('0x20')]||_0x58a7af['Smtp']['user'])},_0x310b15)};return client[_0x9ce3('0x2a')](_0x9ce3('0x2b'),_0x413107);})['then'](function(_0x4b3c21){if(_0x4b3c21[_0x9ce3('0x2c')]){throw new Error(util[_0x9ce3('0x29')](_0x9ce3('0x2d'),_0x4b3c21[_0x9ce3('0x2c')][_0x9ce3('0x2e')]||JSON[_0x9ce3('0x2f')](_0x4b3c21[_0x9ce3('0x2c')])));}return!![];});}function handleError(_0x180a2c,_0x3e7696,_0x471544){return _0x180a2c[_0x9ce3('0x30')](_0x3e7696||0x1f4)[_0x9ce3('0x31')]({'message':_0x471544?_0x471544[_0x9ce3('0x2e')]||_0x471544:''});}function checkPasswordPattern(_0x290713,_0x25ed57,_0x2aee34){if(_0x2aee34){var _0x44bb8e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x44bb8e['test'](_0x25ed57)){return _0x290713;}else{throw new Error(_0x9ce3('0x32'));}}else{return _0x290713;}}exports[_0x9ce3('0x33')]=function(_0xe44825,_0x3ffb97,_0x45535c){passport[_0x9ce3('0x17')]('local',function(_0xa95ef5,_0x5a94bb,_0x40e22a){var _0x282daf=_0xa95ef5||_0x40e22a;if(_0x282daf){return handleError(_0x3ffb97,0x191,_0x282daf);}if(!_0x5a94bb){return handleError(_0x3ffb97,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x579155={'payload':{'id':_0x5a94bb['id'],'role':_0x5a94bb['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x579155)['then'](function(_0x42dda2){_0x3ffb97['json']({'id':_0x5a94bb['id'],'token':_0x42dda2,'statusCall':'','isAlreadyLogged':_0x5a94bb[_0x9ce3('0x34')]});});}})(_0xe44825,_0x3ffb97,_0x45535c);};exports['forgot']=function(_0x558850,_0x544a70,_0x109cb1){if(!_0x558850[_0x9ce3('0x35')]['email']){return handleError(_0x544a70,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x47c3b0=rs['generate']();_0x558850['body']['email']=_0x558850[_0x9ce3('0x35')]['email']['trim']()[_0x9ce3('0x36')]();var _0x45045b;return db['Setting'][_0x9ce3('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9ce3('0xe')],'raw':!![]})['then'](function(_0xf0d2a8){_0x45045b=_0xf0d2a8;return db[_0x9ce3('0x37')]['find']({'where':{'email':_0x558850[_0x9ce3('0x35')][_0x9ce3('0x20')]}});})[_0x9ce3('0x15')](function(_0x94479){if(!_0x94479){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x94479[_0x9ce3('0x18')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x94479[_0x9ce3('0x12')]){if(moment(_0x94479[_0x9ce3('0x13')])[_0x9ce3('0x19')](_0x45045b[_0x9ce3('0xe')],_0x9ce3('0x1b'))>moment()){throw new Error(_0x9ce3('0x38'));}else{_0x94479[_0x9ce3('0x12')]=![];_0x94479['blockedAt']=null;}}_0x94479[_0x9ce3('0x39')]=_0x47c3b0;_0x94479[_0x9ce3('0x3a')]=Date[_0x9ce3('0x3b')]()+0x36ee80;return _0x94479[_0x9ce3('0x3c')]();})[_0x9ce3('0x15')](function(){return sendServiceMail({'to':_0x558850['body']['email'],'subject':_0x9ce3('0x3d'),'text':_0x9ce3('0x3e')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x9ce3('0x3f')+_0x558850['headers'][_0x9ce3('0x23')]+_0x9ce3('0x40')+_0x47c3b0+'\x0a\x0a'+_0x9ce3('0x41')});})['then'](function(){_0x544a70[_0x9ce3('0x30')](0xc8)[_0x9ce3('0x31')]({'message':_0x9ce3('0x42')});})[_0x9ce3('0x1d')](function(_0x5bd398){return handleError(_0x544a70,0x1f4,_0x5bd398);});};exports['reset']=function(_0x5cb90f,_0x25ae4b,_0x561a7d){var _0x2491e6;return db[_0x9ce3('0x37')][_0x9ce3('0x1f')]({'where':{'resetPasswordToken':_0x5cb90f[_0x9ce3('0x43')][_0x9ce3('0x44')],'resetPasswordExpires':{'$gt':Date[_0x9ce3('0x3b')]()}}})[_0x9ce3('0x15')](function(_0x5e0015){_0x2491e6=_0x5e0015;if(!_0x2491e6){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x9ce3('0xb')][_0x9ce3('0xc')]({'attributes':['id',_0x9ce3('0x45')]});})['then'](function(_0x50c57d){return checkPasswordPattern(_0x50c57d,_0x5cb90f[_0x9ce3('0x35')][_0x9ce3('0x10')],_0x50c57d['securePassword']);})[_0x9ce3('0x15')](function(){_0x2491e6[_0x9ce3('0x10')]=_0x5cb90f[_0x9ce3('0x35')][_0x9ce3('0x10')];_0x2491e6['resetPasswordToken']=null;_0x2491e6['resetPasswordExpires']=null;return _0x2491e6[_0x9ce3('0x3c')]();})[_0x9ce3('0x15')](function(){_0x25ae4b[_0x9ce3('0x30')](0xc8)[_0x9ce3('0x31')]({'message':'Password\x20reset!'});})[_0x9ce3('0x1d')](function(_0x1757f6){return handleError(_0x25ae4b,0x1f4,_0x1757f6);});};passport[_0x9ce3('0x46')](new LocalStrategy({'usernameField':_0x9ce3('0xf'),'passwordField':_0x9ce3('0x10')},function(_0x2a413b,_0x1ec760,_0x3bb920){return localAuthenticate(db[_0x9ce3('0x37')],_0x2a413b,_0x1ec760,_0x3bb920);})); \ No newline at end of file +var _0x7e88=['use','util','Strategy','jayson/promise','lodash','randomstring','moment','../../components/auth/service','../../config/utils','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','catch','getLicense','find','email','MailServerOut','Smtp','service','host','port','secure','authentication','auth','merge','format','\x22%s\x22\x20<%s>','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','Reset\x20Email\x20sent!','reset','User','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','resetPasswordToken','Password\x20reset!'];(function(_0x3b6732,_0x4e47a9){var _0x218263=function(_0x1d0749){while(--_0x1d0749){_0x3b6732['push'](_0x3b6732['shift']());}};_0x218263(++_0x4e47a9);}(_0x7e88,0x149));var _0x87e8=function(_0x48ea99,_0x23ca15){_0x48ea99=_0x48ea99-0x0;var _0x56dfdf=_0x7e88[_0x48ea99];return _0x56dfdf;};'use strict';var util=require(_0x87e8('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0x87e8('0x1')];var jayson=require(_0x87e8('0x2'));var _=require(_0x87e8('0x3'));var rs=require(_0x87e8('0x4'));var moment=require(_0x87e8('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x87e8('0x6'));var utils=require(_0x87e8('0x7'));var client=jayson['client'][_0x87e8('0x8')]({'port':0x232b});function localAuthenticate(_0x39ba58,_0x77d86d,_0x280d9b,_0x5d7694){var _0x52c659,_0x17acba;return db[_0x87e8('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x87e8('0xa'),_0x87e8('0xb')],'raw':!![]})[_0x87e8('0xc')](function(_0x3a05dc){_0x52c659=_0x3a05dc;return _0x39ba58[_0x87e8('0xd')]({'attributes':['id',_0x87e8('0xe'),_0x87e8('0xf'),_0x87e8('0x10'),_0x87e8('0x11'),_0x87e8('0x12'),_0x87e8('0x13'),_0x87e8('0x14'),_0x87e8('0x15')],'where':{'name':_0x77d86d,'role':{'$or':['admin','user',_0x87e8('0x16')]}}});})[_0x87e8('0xc')](function(_0x55e2e4){if(!_0x55e2e4||_0x55e2e4&&_0x55e2e4[_0x87e8('0xe')]!==_0x77d86d){throw new Error(_0x87e8('0x17'));}else{_0x17acba=_0x55e2e4;return _0x17acba;}})[_0x87e8('0xc')](function(){_0x17acba[_0x87e8('0x18')](_0x280d9b,function(_0x5eaa94,_0x142157){var _0x734f01=_0x17acba[_0x87e8('0x15')]+0x1;if(_0x5eaa94){return _0x5d7694(_0x5eaa94);}else if(!_0x142157){if(_0x17acba['disabled']){return _0x5d7694(null,![],{'message':_0x87e8('0x17')});}else if(_0x52c659[_0x87e8('0xa')]>0x0){if(_0x17acba[_0x87e8('0x13')]){if(_0x52c659['blockDuration']>0x0){if(moment(_0x17acba[_0x87e8('0x14')])[_0x87e8('0x19')](_0x52c659[_0x87e8('0xb')],_0x87e8('0x1a'))>moment()){return _0x5d7694(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x17acba,_0x734f01,![],null)[_0x87e8('0xc')](function(){return _0x5d7694(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x5d7694(null,![],{'message':_0x87e8('0x17')});}}else{if(_0x734f01>=_0x52c659[_0x87e8('0xa')]){return utils[_0x87e8('0x1b')](_0x17acba,0x0,!![],moment())[_0x87e8('0xc')](function(){return _0x5d7694(null,![],{'message':_0x87e8('0x17')});});}else{return utils[_0x87e8('0x1b')](_0x17acba,_0x734f01,![],null)[_0x87e8('0xc')](function(){return _0x5d7694(null,![],{'message':_0x87e8('0x17')});});}}}else{return _0x5d7694(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x17acba[_0x87e8('0x12')]){return _0x5d7694(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x52c659[_0x87e8('0xa')]>0x0){if(_0x17acba[_0x87e8('0x13')]){if(_0x52c659['blockDuration']>0x0){if(moment(_0x17acba['blockedAt'])[_0x87e8('0x19')](_0x52c659['blockDuration'],_0x87e8('0x1a'))>moment()){return _0x5d7694(null,![],{'message':_0x87e8('0x17')});}else{return utils['clearBlockUser'](_0x17acba,0x0,![],null)['then'](function(){return utils['getLicense'](_0x17acba);})[_0x87e8('0xc')](function(){return _0x5d7694(null,_0x17acba);});}}else{return _0x5d7694(null,![],{'message':_0x87e8('0x17')});}}else{return utils[_0x87e8('0x1b')](_0x17acba,0x0,![],null)[_0x87e8('0xc')](function(){return utils['getLicense'](_0x17acba);})[_0x87e8('0xc')](function(){return _0x5d7694(null,_0x17acba);})[_0x87e8('0x1c')](function(_0x361d5f){return _0x5d7694(null,![],_0x361d5f);});}}else{if(_0x17acba[_0x87e8('0x13')]){return _0x5d7694(null,![],{'message':_0x87e8('0x17')});}else{return utils[_0x87e8('0x1d')](_0x17acba)[_0x87e8('0xc')](function(){return _0x5d7694(null,_0x17acba);});}}}});})[_0x87e8('0x1c')](function(_0x6173fe){return _0x5d7694(null,![],_0x6173fe);});}function sendServiceMail(_0xa746d4){return db['MailAccount'][_0x87e8('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x87e8('0xe'),_0x87e8('0x1f')],'include':[{'model':db[_0x87e8('0x20')],'as':_0x87e8('0x21')}]})[_0x87e8('0xc')](function(_0x3be7e2){if(!_0x3be7e2){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3b330b={'tls':{'rejectUnauthorized':![]}};if(_0x3be7e2[_0x87e8('0x21')][_0x87e8('0x22')]){_0x3b330b[_0x87e8('0x22')]=_0x3be7e2[_0x87e8('0x21')][_0x87e8('0x22')];}else{_0x3b330b[_0x87e8('0x23')]=_0x3be7e2[_0x87e8('0x21')][_0x87e8('0x23')];_0x3b330b[_0x87e8('0x24')]=_0x3be7e2[_0x87e8('0x21')]['port'];_0x3b330b[_0x87e8('0x25')]=_0x3be7e2[_0x87e8('0x21')]['secure'];}if(_0x3be7e2[_0x87e8('0x21')][_0x87e8('0x26')]){_0x3b330b[_0x87e8('0x27')]={'user':_0x3be7e2[_0x87e8('0x21')]['user'],'pass':_0x3be7e2[_0x87e8('0x21')]['pass']};}var _0x8e7c84={'account':_0x3b330b,'message':_[_0x87e8('0x28')]({'from':util[_0x87e8('0x29')](_0x87e8('0x2a'),_0x3be7e2['name'],_0x3be7e2[_0x87e8('0x1f')]||_0x3be7e2['Smtp'][_0x87e8('0x2b')])},_0xa746d4)};return client[_0x87e8('0x2c')](_0x87e8('0x2d'),_0x8e7c84);})['then'](function(_0x1a150c){if(_0x1a150c[_0x87e8('0x2e')]){throw new Error(util[_0x87e8('0x29')](_0x87e8('0x2f'),_0x1a150c['error'][_0x87e8('0x30')]||JSON[_0x87e8('0x31')](_0x1a150c['error'])));}return!![];});}function handleError(_0x22b55d,_0x2c6052,_0x321f96){return _0x22b55d[_0x87e8('0x32')](_0x2c6052||0x1f4)[_0x87e8('0x33')]({'message':_0x321f96?_0x321f96[_0x87e8('0x30')]||_0x321f96:''});}function checkPasswordPattern(_0x3d325c,_0x1532c3,_0x4e5c89){if(_0x4e5c89){var _0x4c83c8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c83c8['test'](_0x1532c3)){return _0x3d325c;}else{throw new Error(_0x87e8('0x34'));}}else{return _0x3d325c;}}exports[_0x87e8('0x35')]=function(_0x38dc7c,_0x327ad9,_0x555dd2){passport[_0x87e8('0x18')](_0x87e8('0x36'),function(_0x27cccc,_0x3ec9da,_0xa30e9d){var _0x58b02f=_0x27cccc||_0xa30e9d;if(_0x58b02f){return handleError(_0x327ad9,0x191,_0x58b02f);}if(!_0x3ec9da){return handleError(_0x327ad9,0x194,{'message':_0x87e8('0x37')});}else{var _0x58ee73={'payload':{'id':_0x3ec9da['id'],'role':_0x3ec9da[_0x87e8('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x87e8('0x38')](_0x58ee73)[_0x87e8('0xc')](function(_0x212eb5){_0x327ad9[_0x87e8('0x39')]({'id':_0x3ec9da['id'],'token':_0x212eb5,'statusCall':'','isAlreadyLogged':_0x3ec9da['online']});});}})(_0x38dc7c,_0x327ad9,_0x555dd2);};exports[_0x87e8('0x3a')]=function(_0x32d72e,_0x2930df,_0x53e0ca){if(!_0x32d72e[_0x87e8('0x3b')]['email']){return handleError(_0x2930df,0x1f4,{'message':_0x87e8('0x3c')});}var _0xebcdce=rs[_0x87e8('0x3d')]();_0x32d72e[_0x87e8('0x3b')][_0x87e8('0x1f')]=_0x32d72e[_0x87e8('0x3b')][_0x87e8('0x1f')][_0x87e8('0x3e')]()['toLowerCase']();var _0x1d271d;return db[_0x87e8('0x9')][_0x87e8('0xd')]({'where':{'id':0x1},'attributes':[_0x87e8('0xa'),'blockDuration'],'raw':!![]})[_0x87e8('0xc')](function(_0x398e06){_0x1d271d=_0x398e06;return db['User']['find']({'where':{'email':_0x32d72e['body'][_0x87e8('0x1f')]}});})[_0x87e8('0xc')](function(_0x1c41d0){if(!_0x1c41d0){throw new Error(_0x87e8('0x3f'));}if(_0x1c41d0[_0x87e8('0x12')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x1c41d0[_0x87e8('0x13')]){if(moment(_0x1c41d0[_0x87e8('0x14')])['add'](_0x1d271d[_0x87e8('0xb')],_0x87e8('0x1a'))>moment()){throw new Error(_0x87e8('0x40'));}else{_0x1c41d0[_0x87e8('0x13')]=![];_0x1c41d0[_0x87e8('0x14')]=null;}}_0x1c41d0['resetPasswordToken']=_0xebcdce;_0x1c41d0[_0x87e8('0x41')]=Date[_0x87e8('0x42')]()+0x36ee80;return _0x1c41d0['save']();})['then'](function(){return sendServiceMail({'to':_0x32d72e['body'][_0x87e8('0x1f')],'subject':_0x87e8('0x43'),'text':_0x87e8('0x44')+_0x87e8('0x45')+_0x87e8('0x46')+_0x32d72e[_0x87e8('0x47')][_0x87e8('0x23')]+_0x87e8('0x48')+_0xebcdce+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x2930df[_0x87e8('0x32')](0xc8)[_0x87e8('0x33')]({'message':_0x87e8('0x49')});})[_0x87e8('0x1c')](function(_0x5b2f6e){return handleError(_0x2930df,0x1f4,_0x5b2f6e);});};exports[_0x87e8('0x4a')]=function(_0x16fe4d,_0x52fc1e,_0x566348){var _0x2378cf;return db[_0x87e8('0x4b')]['find']({'where':{'resetPasswordToken':_0x16fe4d[_0x87e8('0x4c')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x482ddf){_0x2378cf=_0x482ddf;if(!_0x2378cf){throw new Error(_0x87e8('0x4d'));}return db[_0x87e8('0x9')][_0x87e8('0xd')]({'attributes':['id',_0x87e8('0x4e')]});})['then'](function(_0x255855){return checkPasswordPattern(_0x255855,_0x16fe4d[_0x87e8('0x3b')]['password'],_0x255855[_0x87e8('0x4e')]);})['then'](function(){_0x2378cf[_0x87e8('0xf')]=_0x16fe4d[_0x87e8('0x3b')][_0x87e8('0xf')];_0x2378cf[_0x87e8('0x4f')]=null;_0x2378cf[_0x87e8('0x41')]=null;return _0x2378cf['save']();})[_0x87e8('0xc')](function(){_0x52fc1e[_0x87e8('0x32')](0xc8)[_0x87e8('0x33')]({'message':_0x87e8('0x50')});})[_0x87e8('0x1c')](function(_0x306ed4){return handleError(_0x52fc1e,0x1f4,_0x306ed4);});};passport[_0x87e8('0x51')](new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x512848,_0x5d3c77,_0x3a7754){return localAuthenticate(db['User'],_0x512848,_0x5d3c77,_0x3a7754);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 1ac304b..c805fa0 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 _0x41c5=['reset','exports','express','Router','./authLocal.controller','post','/forgot','forgot','/reset/:token'];(function(_0x590814,_0x24a410){var _0x452097=function(_0x2d82ce){while(--_0x2d82ce){_0x590814['push'](_0x590814['shift']());}};_0x452097(++_0x24a410);}(_0x41c5,0x146));var _0x541c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x41c5[_0x42cae2];return _0x5f256f;};'use strict';var express=require(_0x541c('0x0'));var router=express[_0x541c('0x1')]();var controller=require(_0x541c('0x2'));router[_0x541c('0x3')]('/',controller['login']);router[_0x541c('0x3')](_0x541c('0x4'),controller[_0x541c('0x5')]);router[_0x541c('0x3')](_0x541c('0x6'),controller[_0x541c('0x7')]);module[_0x541c('0x8')]=router; \ No newline at end of file +var _0x27f0=['/reset/:token','reset','exports','express','Router','./authLocal.controller','login','post','forgot'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x27f0,0x8a));var _0x027f=function(_0x1fcae4,_0xd1df7a){_0x1fcae4=_0x1fcae4-0x0;var _0xde1690=_0x27f0[_0x1fcae4];return _0xde1690;};'use strict';var express=require(_0x027f('0x0'));var router=express[_0x027f('0x1')]();var controller=require(_0x027f('0x2'));router['post']('/',controller[_0x027f('0x3')]);router[_0x027f('0x4')]('/forgot',controller[_0x027f('0x5')]);router[_0x027f('0x4')](_0x027f('0x6'),controller[_0x027f('0x7')]);module[_0x027f('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index f2155f6..d66054f 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 _0x04b9=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x14d7eb,_0x47bcd1){var _0x2a0f1d=function(_0x2a95a4){while(--_0x2a95a4){_0x14d7eb['push'](_0x14d7eb['shift']());}};_0x2a0f1d(++_0x47bcd1);}(_0x04b9,0x16b));var _0x904b=function(_0x3eff5f,_0x188324){_0x3eff5f=_0x3eff5f-0x0;var _0x25b74f=_0x04b9[_0x3eff5f];return _0x25b74f;};'use strict';var Sequelize=require(_0x904b('0x0'));module[_0x904b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x904b('0x2')]},'status':{'type':Sequelize[_0x904b('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x904b('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x9a55=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2bf466,_0x4929a5){var _0x856885=function(_0x102ef1){while(--_0x102ef1){_0x2bf466['push'](_0x2bf466['shift']());}};_0x856885(++_0x4929a5);}(_0x9a55,0x1ec));var _0x59a5=function(_0x18198c,_0x42dbe8){_0x18198c=_0x18198c-0x0;var _0x52faa8=_0x9a55[_0x18198c];return _0x52faa8;};'use strict';var Sequelize=require(_0x59a5('0x0'));module[_0x59a5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x59a5('0x2')]},'status':{'type':Sequelize[_0x59a5('0x3')],'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 6120460..7b700fc 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 _0xa642=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','json','apply','reject','save','destroy','sendStatus','error','stack','name','send','map','Automation','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','then','rows','show','merge','find','catch','create','update','body','params','Condition','addConditions','ids','getConditions','findOne','options','addActions','Action','omit','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x516d2e,_0x30d7c2){var _0x1664e0=function(_0x2f9f35){while(--_0x2f9f35){_0x516d2e['push'](_0x516d2e['shift']());}};_0x1664e0(++_0x30d7c2);}(_0xa642,0x196));var _0x2a64=function(_0xdd9a5f,_0x3ced93){_0xdd9a5f=_0xdd9a5f-0x0;var _0x3464b7=_0xa642[_0xdd9a5f];return _0x3464b7;};'use strict';var pdf=require(_0x2a64('0x0'));var emlformat=require(_0x2a64('0x1'));var rimraf=require(_0x2a64('0x2'));var zipdir=require(_0x2a64('0x3'));var jsonpatch=require(_0x2a64('0x4'));var rp=require(_0x2a64('0x5'));var moment=require(_0x2a64('0x6'));var BPromise=require(_0x2a64('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2a64('0x8'));var csv=require(_0x2a64('0x9'));var ejs=require(_0x2a64('0xa'));var fs=require('fs');var _=require(_0x2a64('0xb'));var squel=require(_0x2a64('0xc'));var crypto=require('crypto');var jsforce=require(_0x2a64('0xd'));var deskjs=require(_0x2a64('0xe'));var toCsv=require(_0x2a64('0x9'));var querystring=require(_0x2a64('0xf'));var Papa=require(_0x2a64('0x10'));var Redis=require('ioredis');var authService=require(_0x2a64('0x11'));var qs=require(_0x2a64('0x12'));var as=require(_0x2a64('0x13'));var hardwareService=require(_0x2a64('0x14'));var logger=require('../../config/logger')(_0x2a64('0x15'));var utils=require(_0x2a64('0x16'));var config=require(_0x2a64('0x17'));var db=require(_0x2a64('0x18'))['db'];function respondWithStatusCode(_0x537e86,_0x914655){_0x914655=_0x914655||0xcc;return function(_0x2072af){if(_0x2072af){return _0x537e86['sendStatus'](_0x914655);}return _0x537e86[_0x2a64('0x19')](_0x914655)[_0x2a64('0x1a')]();};}function respondWithResult(_0x4ae28a,_0x1e1dd2){_0x1e1dd2=_0x1e1dd2||0xc8;return function(_0x25d5cc){if(_0x25d5cc){return _0x4ae28a[_0x2a64('0x19')](_0x1e1dd2)['json'](_0x25d5cc);}};}function respondWithFilteredResult(_0x645951,_0x494d82){return function(_0x620ac9){if(_0x620ac9){var _0x39bc4d=_0x620ac9[_0x2a64('0x1b')],_0x2870ab=_0x494d82['offset'],_0x15d87f=_0x494d82[_0x2a64('0x1c')]+_0x494d82[_0x2a64('0x1d')],_0x1fe268;if(_0x15d87f>=_0x39bc4d){_0x15d87f=_0x39bc4d;_0x1fe268=0xc8;}else{_0x1fe268=0xce;}_0x645951['status'](_0x1fe268);return _0x645951[_0x2a64('0x1e')]('Content-Range',_0x2870ab+'-'+_0x15d87f+'/'+_0x39bc4d)[_0x2a64('0x1f')](_0x620ac9);}return null;};}function patchUpdates(_0x3e8020){return function(_0x313859){try{jsonpatch[_0x2a64('0x20')](_0x313859,_0x3e8020,!![]);}catch(_0x1178b7){return BPromise[_0x2a64('0x21')](_0x1178b7);}return _0x313859[_0x2a64('0x22')]();};}function saveUpdates(_0x363039,_0x29c29b){return function(_0xee4ee8){if(_0xee4ee8){return _0xee4ee8['update'](_0x363039)['then'](function(_0x3540c3){return _0x3540c3;});}return null;};}function removeEntity(_0x405139,_0x3eb4c8){return function(_0x35aa6c){if(_0x35aa6c){return _0x35aa6c[_0x2a64('0x23')]()['then'](function(){_0x405139['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e9a9f,_0x22c5a1){return function(_0x18d917){if(!_0x18d917){_0x4e9a9f[_0x2a64('0x24')](0x194);}return _0x18d917;};}function handleError(_0xa9c81e,_0x45eb73){_0x45eb73=_0x45eb73||0x1f4;return function(_0x16ceff){logger[_0x2a64('0x25')](_0x16ceff[_0x2a64('0x26')]);if(_0x16ceff[_0x2a64('0x27')]){delete _0x16ceff[_0x2a64('0x27')];}_0xa9c81e[_0x2a64('0x19')](_0x45eb73)[_0x2a64('0x28')](_0x16ceff);};}exports['index']=function(_0x5ae7bb,_0x13f26d){var _0xf119de={},_0x5001b9={},_0x1c0171={'count':0x0,'rows':[]};var _0x5b6913=_[_0x2a64('0x29')](db[_0x2a64('0x2a')][_0x2a64('0x2b')],function(_0x46d38d){return{'name':_0x46d38d[_0x2a64('0x2c')],'type':_0x46d38d['type'][_0x2a64('0x2d')]};});_0x5001b9[_0x2a64('0x2e')]=_['map'](_0x5b6913,'name');_0x5001b9[_0x2a64('0x2f')]=_[_0x2a64('0x30')](_0x5ae7bb[_0x2a64('0x2f')]);_0x5001b9[_0x2a64('0x31')]=_[_0x2a64('0x32')](_0x5001b9[_0x2a64('0x2e')],_0x5001b9[_0x2a64('0x2f')]);_0xf119de[_0x2a64('0x33')]=_['intersection'](_0x5001b9['model'],qs[_0x2a64('0x34')](_0x5ae7bb[_0x2a64('0x2f')][_0x2a64('0x34')]));_0xf119de[_0x2a64('0x33')]=_0xf119de['attributes'][_0x2a64('0x35')]?_0xf119de[_0x2a64('0x33')]:_0x5001b9['model'];if(!_0x5ae7bb['query'][_0x2a64('0x36')](_0x2a64('0x37'))){_0xf119de[_0x2a64('0x1d')]=qs[_0x2a64('0x1d')](_0x5ae7bb['query'][_0x2a64('0x1d')]);_0xf119de['offset']=qs[_0x2a64('0x1c')](_0x5ae7bb['query'][_0x2a64('0x1c')]);}_0xf119de[_0x2a64('0x38')]=qs[_0x2a64('0x39')](_0x5ae7bb[_0x2a64('0x2f')][_0x2a64('0x39')]);_0xf119de[_0x2a64('0x3a')]=qs['filters'](_[_0x2a64('0x3b')](_0x5ae7bb[_0x2a64('0x2f')],_0x5001b9[_0x2a64('0x31')]),_0x5b6913);if(_0x5ae7bb[_0x2a64('0x2f')][_0x2a64('0x3c')]){_0xf119de['where']=_['merge'](_0xf119de[_0x2a64('0x3a')],{'$or':_['map'](_0x5b6913,function(_0x301ba8){if(_0x301ba8['type']!==_0x2a64('0x3d')){var _0x3b332e={};_0x3b332e[_0x301ba8[_0x2a64('0x27')]]={'$like':'%'+_0x5ae7bb[_0x2a64('0x2f')][_0x2a64('0x3c')]+'%'};return _0x3b332e;}})});}_0xf119de=_['merge']({},_0xf119de,_0x5ae7bb['options']);var _0x4802b8={'where':_0xf119de[_0x2a64('0x3a')]};return db[_0x2a64('0x2a')][_0x2a64('0x1b')](_0x4802b8)['then'](function(_0x2cd87c){_0x1c0171[_0x2a64('0x1b')]=_0x2cd87c;if(_0x5ae7bb[_0x2a64('0x2f')][_0x2a64('0x3e')]){_0xf119de[_0x2a64('0x3f')]=[{'all':!![]}];}return db[_0x2a64('0x2a')]['findAll'](_0xf119de);})[_0x2a64('0x40')](function(_0x4d2fc9){_0x1c0171[_0x2a64('0x41')]=_0x4d2fc9;return _0x1c0171;})[_0x2a64('0x40')](respondWithFilteredResult(_0x13f26d,_0xf119de))['catch'](handleError(_0x13f26d,null));};exports[_0x2a64('0x42')]=function(_0x4ab30b,_0x18cef5){var _0x3ccf48={'raw':![],'where':{'id':_0x4ab30b['params']['id']}},_0x1d600b={};_0x1d600b[_0x2a64('0x2e')]=_[_0x2a64('0x30')](db[_0x2a64('0x2a')][_0x2a64('0x2b')]);_0x1d600b['query']=_[_0x2a64('0x30')](_0x4ab30b[_0x2a64('0x2f')]);_0x1d600b[_0x2a64('0x31')]=_[_0x2a64('0x32')](_0x1d600b[_0x2a64('0x2e')],_0x1d600b[_0x2a64('0x2f')]);_0x3ccf48[_0x2a64('0x33')]=_[_0x2a64('0x32')](_0x1d600b[_0x2a64('0x2e')],qs[_0x2a64('0x34')](_0x4ab30b[_0x2a64('0x2f')]['fields']));_0x3ccf48['attributes']=_0x3ccf48[_0x2a64('0x33')]['length']?_0x3ccf48[_0x2a64('0x33')]:_0x1d600b[_0x2a64('0x2e')];if(_0x4ab30b[_0x2a64('0x2f')]['includeAll']){_0x3ccf48['include']=[{'all':!![]}];}_0x3ccf48=_[_0x2a64('0x43')]({},_0x3ccf48,_0x4ab30b['options']);return db[_0x2a64('0x2a')][_0x2a64('0x44')](_0x3ccf48)[_0x2a64('0x40')](handleEntityNotFound(_0x18cef5,null))['then'](respondWithResult(_0x18cef5,null))[_0x2a64('0x45')](handleError(_0x18cef5,null));};exports[_0x2a64('0x46')]=function(_0x43c567,_0x5e9dfd){return db[_0x2a64('0x2a')]['create'](_0x43c567['body'],{})['then'](respondWithResult(_0x5e9dfd,0xc9))[_0x2a64('0x45')](handleError(_0x5e9dfd,null));};exports[_0x2a64('0x47')]=function(_0x22255c,_0x2fa353){if(_0x22255c[_0x2a64('0x48')]['id']){delete _0x22255c['body']['id'];}return db[_0x2a64('0x2a')]['find']({'where':{'id':_0x22255c[_0x2a64('0x49')]['id']}})[_0x2a64('0x40')](handleEntityNotFound(_0x2fa353,null))[_0x2a64('0x40')](saveUpdates(_0x22255c[_0x2a64('0x48')],null))[_0x2a64('0x40')](respondWithResult(_0x2fa353,null))[_0x2a64('0x45')](handleError(_0x2fa353,null));};exports[_0x2a64('0x23')]=function(_0x59d765,_0x426ce2){return db[_0x2a64('0x2a')][_0x2a64('0x44')]({'where':{'id':_0x59d765['params']['id']}})['then'](handleEntityNotFound(_0x426ce2,null))[_0x2a64('0x40')](removeEntity(_0x426ce2,null))['catch'](handleError(_0x426ce2,null));};exports['addConditions']=function(_0x1ff579,_0x3ae8ca,_0x269e21){return db[_0x2a64('0x4a')][_0x2a64('0x44')]({'where':{'id':_0x1ff579[_0x2a64('0x49')]['id']}})['then'](handleEntityNotFound(_0x3ae8ca,null))[_0x2a64('0x40')](function(_0x35f5d4){if(_0x35f5d4){return _0x35f5d4[_0x2a64('0x4b')](_0x1ff579[_0x2a64('0x48')][_0x2a64('0x4c')],_['omit'](_0x1ff579[_0x2a64('0x48')],['ids','id'])||{});}})[_0x2a64('0x40')](respondWithResult(_0x3ae8ca,null))[_0x2a64('0x45')](handleError(_0x3ae8ca,null));};exports[_0x2a64('0x4d')]=function(_0xd35e49,_0x3d8ab3,_0x4a2210){var _0x2bd570={};var _0x5751a7={};var _0x13212e;var _0x413045;return db[_0x2a64('0x2a')][_0x2a64('0x4e')]({'where':{'id':_0xd35e49['params']['id']}})[_0x2a64('0x40')](handleEntityNotFound(_0x3d8ab3,null))[_0x2a64('0x40')](function(_0x142bb1){if(_0x142bb1){_0x13212e=_0x142bb1;_0x5751a7['model']=_['keys'](db['Condition'][_0x2a64('0x2b')]);_0x5751a7[_0x2a64('0x2f')]=_[_0x2a64('0x30')](_0xd35e49[_0x2a64('0x2f')]);_0x5751a7['filters']=_[_0x2a64('0x32')](_0x5751a7[_0x2a64('0x2e')],_0x5751a7[_0x2a64('0x2f')]);_0x2bd570[_0x2a64('0x33')]=_[_0x2a64('0x32')](_0x5751a7[_0x2a64('0x2e')],qs[_0x2a64('0x34')](_0xd35e49[_0x2a64('0x2f')][_0x2a64('0x34')]));_0x2bd570['attributes']=_0x2bd570[_0x2a64('0x33')][_0x2a64('0x35')]?_0x2bd570['attributes']:_0x5751a7[_0x2a64('0x2e')];_0x2bd570[_0x2a64('0x38')]=qs[_0x2a64('0x39')](_0xd35e49['query']['sort']);_0x2bd570[_0x2a64('0x3a')]=qs['filters'](_[_0x2a64('0x3b')](_0xd35e49['query'],_0x5751a7[_0x2a64('0x31')]));if(_0xd35e49[_0x2a64('0x2f')][_0x2a64('0x3c')]){_0x2bd570[_0x2a64('0x3a')]=_[_0x2a64('0x43')](_0x2bd570[_0x2a64('0x3a')],{'$or':_[_0x2a64('0x29')](_0x2bd570[_0x2a64('0x33')],function(_0x1fb758){var _0x3b9ac6={};_0x3b9ac6[_0x1fb758]={'$like':'%'+_0xd35e49[_0x2a64('0x2f')]['filter']+'%'};return _0x3b9ac6;})});}_0x2bd570=_[_0x2a64('0x43')]({},_0x2bd570,_0xd35e49[_0x2a64('0x4f')]);return _0x13212e[_0x2a64('0x4d')](_0x2bd570);}})[_0x2a64('0x40')](function(_0x31fefc){if(_0x31fefc){_0x413045=_0x31fefc[_0x2a64('0x35')];if(!_0xd35e49[_0x2a64('0x2f')][_0x2a64('0x36')](_0x2a64('0x37'))){_0x2bd570[_0x2a64('0x1d')]=qs[_0x2a64('0x1d')](_0xd35e49[_0x2a64('0x2f')][_0x2a64('0x1d')]);_0x2bd570[_0x2a64('0x1c')]=qs[_0x2a64('0x1c')](_0xd35e49['query']['offset']);}return _0x13212e[_0x2a64('0x4d')](_0x2bd570);}})[_0x2a64('0x40')](function(_0x139ba5){if(_0x139ba5){return _0x139ba5?{'count':_0x413045,'rows':_0x139ba5}:null;}})[_0x2a64('0x40')](respondWithResult(_0x3d8ab3,null))['catch'](handleError(_0x3d8ab3,null));};exports[_0x2a64('0x50')]=function(_0x4481fa,_0x57aada,_0x1dfee6){return db[_0x2a64('0x51')][_0x2a64('0x44')]({'where':{'id':_0x4481fa[_0x2a64('0x49')]['id']}})[_0x2a64('0x40')](handleEntityNotFound(_0x57aada,null))[_0x2a64('0x40')](function(_0x54442f){if(_0x54442f){return _0x54442f['addActions'](_0x4481fa[_0x2a64('0x48')][_0x2a64('0x4c')],_[_0x2a64('0x52')](_0x4481fa[_0x2a64('0x48')],[_0x2a64('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x57aada,null))['catch'](handleError(_0x57aada,null));};exports[_0x2a64('0x53')]=function(_0xa7ff09,_0x362751,_0x800471){var _0x193123={};var _0x2fa549={};var _0x40a513;var _0x214bcc;return db[_0x2a64('0x2a')][_0x2a64('0x4e')]({'where':{'id':_0xa7ff09[_0x2a64('0x49')]['id']}})['then'](handleEntityNotFound(_0x362751,null))['then'](function(_0x453084){if(_0x453084){_0x40a513=_0x453084;_0x2fa549[_0x2a64('0x2e')]=_[_0x2a64('0x30')](db[_0x2a64('0x51')][_0x2a64('0x2b')]);_0x2fa549[_0x2a64('0x2f')]=_[_0x2a64('0x30')](_0xa7ff09[_0x2a64('0x2f')]);_0x2fa549['filters']=_[_0x2a64('0x32')](_0x2fa549[_0x2a64('0x2e')],_0x2fa549[_0x2a64('0x2f')]);_0x193123['attributes']=_[_0x2a64('0x32')](_0x2fa549[_0x2a64('0x2e')],qs[_0x2a64('0x34')](_0xa7ff09[_0x2a64('0x2f')][_0x2a64('0x34')]));_0x193123[_0x2a64('0x33')]=_0x193123[_0x2a64('0x33')][_0x2a64('0x35')]?_0x193123['attributes']:_0x2fa549[_0x2a64('0x2e')];_0x193123[_0x2a64('0x38')]=qs['sort'](_0xa7ff09[_0x2a64('0x2f')]['sort']);_0x193123['where']=qs['filters'](_[_0x2a64('0x3b')](_0xa7ff09[_0x2a64('0x2f')],_0x2fa549['filters']));if(_0xa7ff09[_0x2a64('0x2f')][_0x2a64('0x3c')]){_0x193123[_0x2a64('0x3a')]=_['merge'](_0x193123[_0x2a64('0x3a')],{'$or':_[_0x2a64('0x29')](_0x193123[_0x2a64('0x33')],function(_0x489e82){var _0x4884ea={};_0x4884ea[_0x489e82]={'$like':'%'+_0xa7ff09[_0x2a64('0x2f')][_0x2a64('0x3c')]+'%'};return _0x4884ea;})});}_0x193123=_[_0x2a64('0x43')]({},_0x193123,_0xa7ff09['options']);return _0x40a513['getActions'](_0x193123);}})[_0x2a64('0x40')](function(_0x4cbb9a){if(_0x4cbb9a){_0x214bcc=_0x4cbb9a[_0x2a64('0x35')];if(!_0xa7ff09['query']['hasOwnProperty'](_0x2a64('0x37'))){_0x193123[_0x2a64('0x1d')]=qs[_0x2a64('0x1d')](_0xa7ff09[_0x2a64('0x2f')][_0x2a64('0x1d')]);_0x193123['offset']=qs[_0x2a64('0x1c')](_0xa7ff09[_0x2a64('0x2f')][_0x2a64('0x1c')]);}return _0x40a513[_0x2a64('0x53')](_0x193123);}})[_0x2a64('0x40')](function(_0x180be1){if(_0x180be1){return _0x180be1?{'count':_0x214bcc,'rows':_0x180be1}:null;}})[_0x2a64('0x40')](respondWithResult(_0x362751,null))['catch'](handleError(_0x362751,null));}; \ No newline at end of file +var _0x2a48=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','offset','limit','status','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','Automation','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','find','addConditions','ids','omit','getConditions','findOne','Condition','options','addActions','getActions','Action','html-pdf','eml-format','rimraf'];(function(_0x5eca50,_0xc1e3f8){var _0x41fb84=function(_0x4ce3f3){while(--_0x4ce3f3){_0x5eca50['push'](_0x5eca50['shift']());}};_0x41fb84(++_0xc1e3f8);}(_0x2a48,0xa7));var _0x82a4=function(_0x2ad98f,_0x5ce62b){_0x2ad98f=_0x2ad98f-0x0;var _0x35ea78=_0x2a48[_0x2ad98f];return _0x35ea78;};'use strict';var pdf=require(_0x82a4('0x0'));var emlformat=require(_0x82a4('0x1'));var rimraf=require(_0x82a4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x82a4('0x3'));var rp=require(_0x82a4('0x4'));var moment=require(_0x82a4('0x5'));var BPromise=require(_0x82a4('0x6'));var Mustache=require(_0x82a4('0x7'));var util=require('util');var path=require(_0x82a4('0x8'));var sox=require(_0x82a4('0x9'));var csv=require(_0x82a4('0xa'));var ejs=require(_0x82a4('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x82a4('0xc'));var crypto=require(_0x82a4('0xd'));var jsforce=require(_0x82a4('0xe'));var deskjs=require(_0x82a4('0xf'));var toCsv=require(_0x82a4('0xa'));var querystring=require(_0x82a4('0x10'));var Papa=require(_0x82a4('0x11'));var Redis=require('ioredis');var authService=require(_0x82a4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x82a4('0x13'));var hardwareService=require(_0x82a4('0x14'));var logger=require(_0x82a4('0x15'))(_0x82a4('0x16'));var utils=require(_0x82a4('0x17'));var config=require(_0x82a4('0x18'));var db=require(_0x82a4('0x19'))['db'];function respondWithStatusCode(_0x10281a,_0x440a32){_0x440a32=_0x440a32||0xcc;return function(_0x3ca267){if(_0x3ca267){return _0x10281a['sendStatus'](_0x440a32);}return _0x10281a['status'](_0x440a32)[_0x82a4('0x1a')]();};}function respondWithResult(_0x50bf99,_0x1f4653){_0x1f4653=_0x1f4653||0xc8;return function(_0x5d7d54){if(_0x5d7d54){return _0x50bf99['status'](_0x1f4653)['json'](_0x5d7d54);}};}function respondWithFilteredResult(_0x54b4be,_0x27cded){return function(_0x43806c){if(_0x43806c){var _0x3567c6=_0x43806c['count'],_0x410a07=_0x27cded[_0x82a4('0x1b')],_0x33111f=_0x27cded[_0x82a4('0x1b')]+_0x27cded[_0x82a4('0x1c')],_0x22e5bd;if(_0x33111f>=_0x3567c6){_0x33111f=_0x3567c6;_0x22e5bd=0xc8;}else{_0x22e5bd=0xce;}_0x54b4be[_0x82a4('0x1d')](_0x22e5bd);return _0x54b4be['set'](_0x82a4('0x1e'),_0x410a07+'-'+_0x33111f+'/'+_0x3567c6)['json'](_0x43806c);}return null;};}function patchUpdates(_0x4b3eb4){return function(_0x57293c){try{jsonpatch[_0x82a4('0x1f')](_0x57293c,_0x4b3eb4,!![]);}catch(_0x2853ef){return BPromise[_0x82a4('0x20')](_0x2853ef);}return _0x57293c[_0x82a4('0x21')]();};}function saveUpdates(_0x92ca1a,_0x650834){return function(_0x569e1d){if(_0x569e1d){return _0x569e1d[_0x82a4('0x22')](_0x92ca1a)[_0x82a4('0x23')](function(_0x16195a){return _0x16195a;});}return null;};}function removeEntity(_0x1bf133,_0x49a5c5){return function(_0x159081){if(_0x159081){return _0x159081[_0x82a4('0x24')]()[_0x82a4('0x23')](function(){_0x1bf133[_0x82a4('0x1d')](0xcc)[_0x82a4('0x1a')]();});}};}function handleEntityNotFound(_0x175e68,_0x13f6cf){return function(_0x28f119){if(!_0x28f119){_0x175e68[_0x82a4('0x25')](0x194);}return _0x28f119;};}function handleError(_0x10191a,_0x3fb171){_0x3fb171=_0x3fb171||0x1f4;return function(_0x46b593){logger[_0x82a4('0x26')](_0x46b593[_0x82a4('0x27')]);if(_0x46b593['name']){delete _0x46b593[_0x82a4('0x28')];}_0x10191a[_0x82a4('0x1d')](_0x3fb171)['send'](_0x46b593);};}exports[_0x82a4('0x29')]=function(_0x31f5fd,_0x1da8bb){var _0x14398e={},_0x5e556e={},_0x11e708={'count':0x0,'rows':[]};var _0x327be0=_[_0x82a4('0x2a')](db[_0x82a4('0x2b')]['rawAttributes'],function(_0x482a54){return{'name':_0x482a54[_0x82a4('0x2c')],'type':_0x482a54[_0x82a4('0x2d')][_0x82a4('0x2e')]};});_0x5e556e[_0x82a4('0x2f')]=_[_0x82a4('0x2a')](_0x327be0,_0x82a4('0x28'));_0x5e556e[_0x82a4('0x30')]=_[_0x82a4('0x31')](_0x31f5fd[_0x82a4('0x30')]);_0x5e556e[_0x82a4('0x32')]=_[_0x82a4('0x33')](_0x5e556e[_0x82a4('0x2f')],_0x5e556e[_0x82a4('0x30')]);_0x14398e[_0x82a4('0x34')]=_[_0x82a4('0x33')](_0x5e556e['model'],qs['fields'](_0x31f5fd[_0x82a4('0x30')][_0x82a4('0x35')]));_0x14398e[_0x82a4('0x34')]=_0x14398e[_0x82a4('0x34')][_0x82a4('0x36')]?_0x14398e[_0x82a4('0x34')]:_0x5e556e[_0x82a4('0x2f')];if(!_0x31f5fd[_0x82a4('0x30')][_0x82a4('0x37')](_0x82a4('0x38'))){_0x14398e[_0x82a4('0x1c')]=qs[_0x82a4('0x1c')](_0x31f5fd[_0x82a4('0x30')][_0x82a4('0x1c')]);_0x14398e[_0x82a4('0x1b')]=qs['offset'](_0x31f5fd[_0x82a4('0x30')][_0x82a4('0x1b')]);}_0x14398e[_0x82a4('0x39')]=qs['sort'](_0x31f5fd[_0x82a4('0x30')][_0x82a4('0x3a')]);_0x14398e['where']=qs[_0x82a4('0x32')](_[_0x82a4('0x3b')](_0x31f5fd['query'],_0x5e556e[_0x82a4('0x32')]),_0x327be0);if(_0x31f5fd[_0x82a4('0x30')][_0x82a4('0x3c')]){_0x14398e['where']=_[_0x82a4('0x3d')](_0x14398e[_0x82a4('0x3e')],{'$or':_['map'](_0x327be0,function(_0x2d2168){if(_0x2d2168[_0x82a4('0x2d')]!==_0x82a4('0x3f')){var _0x437eaf={};_0x437eaf[_0x2d2168[_0x82a4('0x28')]]={'$like':'%'+_0x31f5fd[_0x82a4('0x30')][_0x82a4('0x3c')]+'%'};return _0x437eaf;}})});}_0x14398e=_[_0x82a4('0x3d')]({},_0x14398e,_0x31f5fd['options']);var _0x4d02ff={'where':_0x14398e['where']};return db[_0x82a4('0x2b')][_0x82a4('0x40')](_0x4d02ff)['then'](function(_0x13b623){_0x11e708[_0x82a4('0x40')]=_0x13b623;if(_0x31f5fd[_0x82a4('0x30')][_0x82a4('0x41')]){_0x14398e[_0x82a4('0x42')]=[{'all':!![]}];}return db[_0x82a4('0x2b')][_0x82a4('0x43')](_0x14398e);})['then'](function(_0x1ec259){_0x11e708[_0x82a4('0x44')]=_0x1ec259;return _0x11e708;})['then'](respondWithFilteredResult(_0x1da8bb,_0x14398e))[_0x82a4('0x45')](handleError(_0x1da8bb,null));};exports['show']=function(_0x6f8c2,_0xe70688){var _0x4e79f9={'raw':![],'where':{'id':_0x6f8c2[_0x82a4('0x46')]['id']}},_0x599033={};_0x599033[_0x82a4('0x2f')]=_[_0x82a4('0x31')](db[_0x82a4('0x2b')][_0x82a4('0x47')]);_0x599033[_0x82a4('0x30')]=_[_0x82a4('0x31')](_0x6f8c2[_0x82a4('0x30')]);_0x599033[_0x82a4('0x32')]=_[_0x82a4('0x33')](_0x599033[_0x82a4('0x2f')],_0x599033['query']);_0x4e79f9[_0x82a4('0x34')]=_['intersection'](_0x599033['model'],qs[_0x82a4('0x35')](_0x6f8c2['query'][_0x82a4('0x35')]));_0x4e79f9[_0x82a4('0x34')]=_0x4e79f9[_0x82a4('0x34')][_0x82a4('0x36')]?_0x4e79f9[_0x82a4('0x34')]:_0x599033[_0x82a4('0x2f')];if(_0x6f8c2[_0x82a4('0x30')][_0x82a4('0x41')]){_0x4e79f9[_0x82a4('0x42')]=[{'all':!![]}];}_0x4e79f9=_[_0x82a4('0x3d')]({},_0x4e79f9,_0x6f8c2['options']);return db['Automation']['find'](_0x4e79f9)[_0x82a4('0x23')](handleEntityNotFound(_0xe70688,null))[_0x82a4('0x23')](respondWithResult(_0xe70688,null))[_0x82a4('0x45')](handleError(_0xe70688,null));};exports[_0x82a4('0x48')]=function(_0xa3bf4a,_0x1f649e){return db[_0x82a4('0x2b')]['create'](_0xa3bf4a['body'],{})['then'](respondWithResult(_0x1f649e,0xc9))[_0x82a4('0x45')](handleError(_0x1f649e,null));};exports[_0x82a4('0x22')]=function(_0x2858b2,_0x4a99cb){if(_0x2858b2[_0x82a4('0x49')]['id']){delete _0x2858b2['body']['id'];}return db[_0x82a4('0x2b')][_0x82a4('0x4a')]({'where':{'id':_0x2858b2[_0x82a4('0x46')]['id']}})[_0x82a4('0x23')](handleEntityNotFound(_0x4a99cb,null))['then'](saveUpdates(_0x2858b2[_0x82a4('0x49')],null))[_0x82a4('0x23')](respondWithResult(_0x4a99cb,null))[_0x82a4('0x45')](handleError(_0x4a99cb,null));};exports[_0x82a4('0x24')]=function(_0x115bff,_0x34a860){return db[_0x82a4('0x2b')][_0x82a4('0x4a')]({'where':{'id':_0x115bff['params']['id']}})[_0x82a4('0x23')](handleEntityNotFound(_0x34a860,null))['then'](removeEntity(_0x34a860,null))[_0x82a4('0x45')](handleError(_0x34a860,null));};exports[_0x82a4('0x4b')]=function(_0x684440,_0x195742,_0x443559){return db['Condition'][_0x82a4('0x4a')]({'where':{'id':_0x684440['params']['id']}})[_0x82a4('0x23')](handleEntityNotFound(_0x195742,null))['then'](function(_0x1fe13c){if(_0x1fe13c){return _0x1fe13c[_0x82a4('0x4b')](_0x684440[_0x82a4('0x49')][_0x82a4('0x4c')],_[_0x82a4('0x4d')](_0x684440['body'],[_0x82a4('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x195742,null))[_0x82a4('0x45')](handleError(_0x195742,null));};exports[_0x82a4('0x4e')]=function(_0x4b7782,_0xa9de4d,_0x35ffb2){var _0x567c72={};var _0x2295f6={};var _0x1b454c;var _0x9d784e;return db[_0x82a4('0x2b')][_0x82a4('0x4f')]({'where':{'id':_0x4b7782[_0x82a4('0x46')]['id']}})['then'](handleEntityNotFound(_0xa9de4d,null))[_0x82a4('0x23')](function(_0x40d70e){if(_0x40d70e){_0x1b454c=_0x40d70e;_0x2295f6[_0x82a4('0x2f')]=_[_0x82a4('0x31')](db[_0x82a4('0x50')][_0x82a4('0x47')]);_0x2295f6[_0x82a4('0x30')]=_['keys'](_0x4b7782[_0x82a4('0x30')]);_0x2295f6[_0x82a4('0x32')]=_['intersection'](_0x2295f6['model'],_0x2295f6['query']);_0x567c72['attributes']=_[_0x82a4('0x33')](_0x2295f6[_0x82a4('0x2f')],qs[_0x82a4('0x35')](_0x4b7782['query'][_0x82a4('0x35')]));_0x567c72[_0x82a4('0x34')]=_0x567c72['attributes'][_0x82a4('0x36')]?_0x567c72[_0x82a4('0x34')]:_0x2295f6[_0x82a4('0x2f')];_0x567c72[_0x82a4('0x39')]=qs[_0x82a4('0x3a')](_0x4b7782[_0x82a4('0x30')]['sort']);_0x567c72['where']=qs[_0x82a4('0x32')](_[_0x82a4('0x3b')](_0x4b7782[_0x82a4('0x30')],_0x2295f6[_0x82a4('0x32')]));if(_0x4b7782[_0x82a4('0x30')][_0x82a4('0x3c')]){_0x567c72[_0x82a4('0x3e')]=_[_0x82a4('0x3d')](_0x567c72[_0x82a4('0x3e')],{'$or':_['map'](_0x567c72[_0x82a4('0x34')],function(_0x224dce){var _0x523ed2={};_0x523ed2[_0x224dce]={'$like':'%'+_0x4b7782[_0x82a4('0x30')][_0x82a4('0x3c')]+'%'};return _0x523ed2;})});}_0x567c72=_[_0x82a4('0x3d')]({},_0x567c72,_0x4b7782[_0x82a4('0x51')]);return _0x1b454c[_0x82a4('0x4e')](_0x567c72);}})[_0x82a4('0x23')](function(_0x42f4e6){if(_0x42f4e6){_0x9d784e=_0x42f4e6[_0x82a4('0x36')];if(!_0x4b7782[_0x82a4('0x30')][_0x82a4('0x37')](_0x82a4('0x38'))){_0x567c72[_0x82a4('0x1c')]=qs[_0x82a4('0x1c')](_0x4b7782['query']['limit']);_0x567c72[_0x82a4('0x1b')]=qs['offset'](_0x4b7782['query'][_0x82a4('0x1b')]);}return _0x1b454c[_0x82a4('0x4e')](_0x567c72);}})[_0x82a4('0x23')](function(_0x2ba3b7){if(_0x2ba3b7){return _0x2ba3b7?{'count':_0x9d784e,'rows':_0x2ba3b7}:null;}})[_0x82a4('0x23')](respondWithResult(_0xa9de4d,null))['catch'](handleError(_0xa9de4d,null));};exports[_0x82a4('0x52')]=function(_0x34df75,_0xf5c90d,_0x5d4b5f){return db['Action'][_0x82a4('0x4a')]({'where':{'id':_0x34df75[_0x82a4('0x46')]['id']}})[_0x82a4('0x23')](handleEntityNotFound(_0xf5c90d,null))['then'](function(_0x537655){if(_0x537655){return _0x537655[_0x82a4('0x52')](_0x34df75['body'][_0x82a4('0x4c')],_['omit'](_0x34df75[_0x82a4('0x49')],[_0x82a4('0x4c'),'id'])||{});}})[_0x82a4('0x23')](respondWithResult(_0xf5c90d,null))[_0x82a4('0x45')](handleError(_0xf5c90d,null));};exports[_0x82a4('0x53')]=function(_0x5bdc0d,_0x1f4579,_0x4d4a6f){var _0x1d8ae2={};var _0x41b2d1={};var _0x2bae2b;var _0xce8c31;return db[_0x82a4('0x2b')]['findOne']({'where':{'id':_0x5bdc0d[_0x82a4('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f4579,null))['then'](function(_0x3c3f6f){if(_0x3c3f6f){_0x2bae2b=_0x3c3f6f;_0x41b2d1[_0x82a4('0x2f')]=_[_0x82a4('0x31')](db[_0x82a4('0x54')]['rawAttributes']);_0x41b2d1['query']=_[_0x82a4('0x31')](_0x5bdc0d[_0x82a4('0x30')]);_0x41b2d1[_0x82a4('0x32')]=_['intersection'](_0x41b2d1[_0x82a4('0x2f')],_0x41b2d1[_0x82a4('0x30')]);_0x1d8ae2[_0x82a4('0x34')]=_['intersection'](_0x41b2d1['model'],qs[_0x82a4('0x35')](_0x5bdc0d[_0x82a4('0x30')]['fields']));_0x1d8ae2['attributes']=_0x1d8ae2[_0x82a4('0x34')]['length']?_0x1d8ae2['attributes']:_0x41b2d1[_0x82a4('0x2f')];_0x1d8ae2[_0x82a4('0x39')]=qs[_0x82a4('0x3a')](_0x5bdc0d[_0x82a4('0x30')][_0x82a4('0x3a')]);_0x1d8ae2[_0x82a4('0x3e')]=qs['filters'](_['pick'](_0x5bdc0d[_0x82a4('0x30')],_0x41b2d1[_0x82a4('0x32')]));if(_0x5bdc0d[_0x82a4('0x30')][_0x82a4('0x3c')]){_0x1d8ae2[_0x82a4('0x3e')]=_[_0x82a4('0x3d')](_0x1d8ae2[_0x82a4('0x3e')],{'$or':_['map'](_0x1d8ae2[_0x82a4('0x34')],function(_0x17d409){var _0x4ce172={};_0x4ce172[_0x17d409]={'$like':'%'+_0x5bdc0d[_0x82a4('0x30')][_0x82a4('0x3c')]+'%'};return _0x4ce172;})});}_0x1d8ae2=_[_0x82a4('0x3d')]({},_0x1d8ae2,_0x5bdc0d[_0x82a4('0x51')]);return _0x2bae2b[_0x82a4('0x53')](_0x1d8ae2);}})['then'](function(_0x4f6f45){if(_0x4f6f45){_0xce8c31=_0x4f6f45[_0x82a4('0x36')];if(!_0x5bdc0d['query'][_0x82a4('0x37')](_0x82a4('0x38'))){_0x1d8ae2[_0x82a4('0x1c')]=qs[_0x82a4('0x1c')](_0x5bdc0d['query'][_0x82a4('0x1c')]);_0x1d8ae2[_0x82a4('0x1b')]=qs[_0x82a4('0x1b')](_0x5bdc0d[_0x82a4('0x30')]['offset']);}return _0x2bae2b[_0x82a4('0x53')](_0x1d8ae2);}})[_0x82a4('0x23')](function(_0x2379d4){if(_0x2379d4){return _0x2379d4?{'count':_0xce8c31,'rows':_0x2379d4}:null;}})[_0x82a4('0x23')](respondWithResult(_0x1f4579,null))[_0x82a4('0x45')](handleError(_0x1f4579,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index ec138af..fee8de8 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 _0x75e3=['request-promise','./automation.attributes','Automation','tools_automations','util','../../config/logger','moment','bluebird'];(function(_0x55a962,_0x10daf8){var _0x5c9f57=function(_0x498e7d){while(--_0x498e7d){_0x55a962['push'](_0x55a962['shift']());}};_0x5c9f57(++_0x10daf8);}(_0x75e3,0x104));var _0x375e=function(_0x29014d,_0x50ce25){_0x29014d=_0x29014d-0x0;var _0x3e2caa=_0x75e3[_0x29014d];return _0x3e2caa;};'use strict';var _=require('lodash');var util=require(_0x375e('0x0'));var logger=require(_0x375e('0x1'))('api');var moment=require(_0x375e('0x2'));var BPromise=require(_0x375e('0x3'));var rp=require(_0x375e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x375e('0x5'));module['exports']=function(_0x17e32c,_0x52f876){return _0x17e32c['define'](_0x375e('0x6'),attributes,{'tableName':_0x375e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3da7=['request-promise','path','../../config/environment','./automation.attributes','exports','tools_automations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x25e3c3,_0x343f10){var _0x427705=function(_0x2e3c08){while(--_0x2e3c08){_0x25e3c3['push'](_0x25e3c3['shift']());}};_0x427705(++_0x343f10);}(_0x3da7,0xe2));var _0x73da=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x3da7[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0x73da('0x0'));var util=require('util');var logger=require(_0x73da('0x1'))(_0x73da('0x2'));var moment=require(_0x73da('0x3'));var BPromise=require(_0x73da('0x4'));var rp=require(_0x73da('0x5'));var fs=require('fs');var path=require(_0x73da('0x6'));var rimraf=require('rimraf');var config=require(_0x73da('0x7'));var attributes=require(_0x73da('0x8'));module[_0x73da('0x9')]=function(_0xbb84d6,_0x1f61af){return _0xbb84d6['define']('Automation',attributes,{'tableName':_0x73da('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 ab99f31..a0f3c75 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 _0xb9a2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x48fe2c,_0x55cf8c){var _0x29ce56=function(_0x4dda21){while(--_0x4dda21){_0x48fe2c['push'](_0x48fe2c['shift']());}};_0x29ce56(++_0x55cf8c);}(_0xb9a2,0x1c4));var _0x2b9a=function(_0x4db823,_0x26c87b){_0x4db823=_0x4db823-0x0;var _0x10bee0=_0xb9a2[_0x4db823];return _0x10bee0;};'use strict';var _=require(_0x2b9a('0x0'));var util=require(_0x2b9a('0x1'));var moment=require(_0x2b9a('0x2'));var BPromise=require(_0x2b9a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b9a('0x4'));var db=require(_0x2b9a('0x5'))['db'];var utils=require(_0x2b9a('0x6'));var logger=require(_0x2b9a('0x7'))(_0x2b9a('0x8'));var config=require(_0x2b9a('0x9'));var jayson=require(_0x2b9a('0xa'));var client=jayson[_0x2b9a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b6812,_0x2b0fcd,_0x3ef0de){return new BPromise(function(_0x24c247,_0x2e632c){return client[_0x2b9a('0xc')](_0x1b6812,_0x3ef0de)[_0x2b9a('0xd')](function(_0x33e873){logger[_0x2b9a('0xe')]('Automation,\x20%s,\x20%s',_0x2b0fcd,_0x2b9a('0xf'));logger[_0x2b9a('0x10')](_0x2b9a('0x11'),_0x2b0fcd,_0x2b9a('0xf'),JSON['stringify'](_0x33e873));if(_0x33e873[_0x2b9a('0x12')]){if(_0x33e873[_0x2b9a('0x12')][_0x2b9a('0x13')]===0x1f4){logger[_0x2b9a('0x12')](_0x2b9a('0x14'),_0x2b0fcd,_0x33e873[_0x2b9a('0x12')]['message']);return _0x2e632c(_0x33e873[_0x2b9a('0x12')][_0x2b9a('0x15')]);}logger[_0x2b9a('0x12')]('Automation,\x20%s,\x20%s',_0x2b0fcd,_0x33e873[_0x2b9a('0x12')][_0x2b9a('0x15')]);return _0x24c247(_0x33e873[_0x2b9a('0x12')][_0x2b9a('0x15')]);}else{logger[_0x2b9a('0xe')](_0x2b9a('0x14'),_0x2b0fcd,_0x2b9a('0xf'));_0x24c247(_0x33e873[_0x2b9a('0x16')]['message']);}})[_0x2b9a('0x17')](function(_0xa8cfd2){logger[_0x2b9a('0x12')](_0x2b9a('0x14'),_0x2b0fcd,_0xa8cfd2);_0x2e632c(_0xa8cfd2);});});} \ No newline at end of file +var _0x6f1e=['jayson/promise','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2ffc60,_0x4e8fd3){var _0x4c7ba1=function(_0x452955){while(--_0x452955){_0x2ffc60['push'](_0x2ffc60['shift']());}};_0x4c7ba1(++_0x4e8fd3);}(_0x6f1e,0x84));var _0xe6f1=function(_0x314de8,_0x34047b){_0x314de8=_0x314de8-0x0;var _0x53c3d7=_0x6f1e[_0x314de8];return _0x53c3d7;};'use strict';var _=require(_0xe6f1('0x0'));var util=require(_0xe6f1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe6f1('0x2'));var fs=require('fs');var Redis=require(_0xe6f1('0x3'));var db=require(_0xe6f1('0x4'))['db'];var utils=require(_0xe6f1('0x5'));var logger=require('../../config/logger')(_0xe6f1('0x6'));var config=require(_0xe6f1('0x7'));var jayson=require(_0xe6f1('0x8'));var client=jayson['client'][_0xe6f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x396e2c,_0x56184d,_0x9061d2){return new BPromise(function(_0x1292c0,_0x5b6214){return client[_0xe6f1('0xa')](_0x396e2c,_0x9061d2)['then'](function(_0x426dff){logger[_0xe6f1('0xb')](_0xe6f1('0xc'),_0x56184d,_0xe6f1('0xd'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x56184d,_0xe6f1('0xd'),JSON[_0xe6f1('0xe')](_0x426dff));if(_0x426dff[_0xe6f1('0xf')]){if(_0x426dff[_0xe6f1('0xf')][_0xe6f1('0x10')]===0x1f4){logger[_0xe6f1('0xf')]('Automation,\x20%s,\x20%s',_0x56184d,_0x426dff[_0xe6f1('0xf')][_0xe6f1('0x11')]);return _0x5b6214(_0x426dff[_0xe6f1('0xf')][_0xe6f1('0x11')]);}logger[_0xe6f1('0xf')](_0xe6f1('0xc'),_0x56184d,_0x426dff[_0xe6f1('0xf')][_0xe6f1('0x11')]);return _0x1292c0(_0x426dff[_0xe6f1('0xf')]['message']);}else{logger[_0xe6f1('0xb')]('Automation,\x20%s,\x20%s',_0x56184d,'request\x20sent');_0x1292c0(_0x426dff[_0xe6f1('0x12')][_0xe6f1('0x11')]);}})[_0xe6f1('0x13')](function(_0x37134a){logger['error']('Automation,\x20%s,\x20%s',_0x56184d,_0x37134a);_0x5b6214(_0x37134a);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index afcd53d..a4a4542 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 _0x2343=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','get','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','multer','util','path'];(function(_0x23e5be,_0x53c55a){var _0x3deaec=function(_0x5d7324){while(--_0x5d7324){_0x23e5be['push'](_0x23e5be['shift']());}};_0x3deaec(++_0x53c55a);}(_0x2343,0xef));var _0x3234=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0x2343[_0x29632e];return _0x426e04;};'use strict';var multer=require(_0x3234('0x0'));var util=require(_0x3234('0x1'));var path=require(_0x3234('0x2'));var timeout=require('connect-timeout');var express=require(_0x3234('0x3'));var router=express['Router']();var auth=require(_0x3234('0x4'));var interaction=require(_0x3234('0x5'));var config=require(_0x3234('0x6'));var controller=require('./automation.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3234('0x7'),auth[_0x3234('0x8')](),controller[_0x3234('0x9')]);router[_0x3234('0xa')](_0x3234('0xb'),auth['isAuthenticated'](),controller[_0x3234('0xc')]);router[_0x3234('0xa')](_0x3234('0xd'),auth[_0x3234('0x8')](),controller[_0x3234('0xe')]);router[_0x3234('0xf')]('/',auth['isAuthenticated'](),controller[_0x3234('0x10')]);router[_0x3234('0xf')](_0x3234('0xb'),auth[_0x3234('0x8')](),controller[_0x3234('0x11')]);router[_0x3234('0xf')](_0x3234('0xd'),auth[_0x3234('0x8')](),controller[_0x3234('0x12')]);router[_0x3234('0x13')](_0x3234('0x7'),auth[_0x3234('0x8')](),controller[_0x3234('0x14')]);router[_0x3234('0x15')](_0x3234('0x7'),auth[_0x3234('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x80e4=['post','create','addConditions','/:id/actions','addActions','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','getActions'];(function(_0x278085,_0x35473a){var _0x4710a6=function(_0x3b94e0){while(--_0x3b94e0){_0x278085['push'](_0x278085['shift']());}};_0x4710a6(++_0x35473a);}(_0x80e4,0x103));var _0x480e=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0x80e4[_0x2ce6d5];return _0x32d272;};'use strict';var multer=require(_0x480e('0x0'));var util=require(_0x480e('0x1'));var path=require(_0x480e('0x2'));var timeout=require('connect-timeout');var express=require(_0x480e('0x3'));var router=express[_0x480e('0x4')]();var auth=require(_0x480e('0x5'));var interaction=require(_0x480e('0x6'));var config=require(_0x480e('0x7'));var controller=require('./automation.controller');router[_0x480e('0x8')]('/',auth[_0x480e('0x9')](),controller[_0x480e('0xa')]);router[_0x480e('0x8')](_0x480e('0xb'),auth[_0x480e('0x9')](),controller[_0x480e('0xc')]);router[_0x480e('0x8')](_0x480e('0xd'),auth[_0x480e('0x9')](),controller[_0x480e('0xe')]);router[_0x480e('0x8')]('/:id/actions',auth[_0x480e('0x9')](),controller[_0x480e('0xf')]);router[_0x480e('0x10')]('/',auth[_0x480e('0x9')](),controller[_0x480e('0x11')]);router[_0x480e('0x10')]('/:id/conditions',auth[_0x480e('0x9')](),controller[_0x480e('0x12')]);router[_0x480e('0x10')](_0x480e('0x13'),auth['isAuthenticated'](),controller[_0x480e('0x14')]);router[_0x480e('0x15')](_0x480e('0xb'),auth[_0x480e('0x9')](),controller['update']);router[_0x480e('0x16')]('/:id',auth[_0x480e('0x9')](),controller[_0x480e('0x17')]);module[_0x480e('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index ca2809b..d422b72 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 _0x2142=['never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ENUM','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','UNSIGNED','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always'];(function(_0x148bd7,_0x4b58d6){var _0x38638a=function(_0x103bdb){while(--_0x103bdb){_0x148bd7['push'](_0x148bd7['shift']());}};_0x38638a(++_0x4b58d6);}(_0x2142,0x180));var _0x2214=function(_0x5e0f41,_0x1e4ad3){_0x5e0f41=_0x5e0f41-0x0;var _0x42531c=_0x2142[_0x5e0f41];return _0x42531c;};'use strict';var Sequelize=require(_0x2214('0x0'));module[_0x2214('0x1')]={'name':{'type':Sequelize[_0x2214('0x2')],'unique':_0x2214('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x2214('0x4')),'allowNull':![],'defaultValue':_0x2214('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2214('0x5')},'limitCalls':{'type':Sequelize[_0x2214('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x2214('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2214('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2214('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x2214('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2214('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2214('0x6')](0x5)[_0x2214('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2214('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x2214('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2214('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2214('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2214('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2214('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x2214('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2214('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2214('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x2214('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x2214('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2214('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x2214('0xf'),_0x2214('0x10'),_0x2214('0x11')),'defaultValue':_0x2214('0xf')},'dialAMDActive':{'type':Sequelize[_0x2214('0x12')],'defaultValue':0x0,'comment':_0x2214('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x2214('0x6')](0x9)[_0x2214('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2214('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x2214('0x6')](0x9)[_0x2214('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2214('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x2214('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2214('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2214('0x6')](0x9)[_0x2214('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2214('0x17')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2214('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2214('0x6')](0x9)[_0x2214('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2214('0x6')](0x9)[_0x2214('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2214('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x2214('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2214('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2214('0x6')](0x9)[_0x2214('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x2214('0x1b')](_0x2214('0x1c'),'ASC'),'defaultValue':_0x2214('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2214('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2214('0x1d')},'dialCutDigit':{'type':Sequelize[_0x2214('0x6')](0x3)[_0x2214('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2214('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2214('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2214('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2214('0x6')](0x5)[_0x2214('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2214('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x2214('0x6')](0x3)[_0x2214('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2214('0x21')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2214('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2214('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2214('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2214('0x6')](0x5)[_0x2214('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2214('0x23')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2214('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2214('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2214('0x6')](0x5)[_0x2214('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2214('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2214('0x6')](0x3)[_0x2214('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2214('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2214('0x6')](0x5)[_0x2214('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2214('0x27')}}; \ No newline at end of file +var _0xb623=['ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\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','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','Active/Disactive\x20AMD','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC'];(function(_0x46d830,_0x4ea71a){var _0x1e6d2a=function(_0x2ce990){while(--_0x2ce990){_0x46d830['push'](_0x46d830['shift']());}};_0x1e6d2a(++_0x4ea71a);}(_0xb623,0xbd));var _0x3b62=function(_0x42fbac,_0x1df76d){_0x42fbac=_0x42fbac-0x0;var _0x217da9=_0xb623[_0x42fbac];return _0x217da9;};'use strict';var Sequelize=require(_0x3b62('0x0'));module['exports']={'name':{'type':Sequelize[_0x3b62('0x1')],'unique':_0x3b62('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x3b62('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x3b62('0x4')},'description':{'type':Sequelize[_0x3b62('0x1')]},'active':{'type':Sequelize[_0x3b62('0x5')],'defaultValue':0x0,'comment':_0x3b62('0x6')},'limitCalls':{'type':Sequelize[_0x3b62('0x7')](0x4)[_0x3b62('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x3b62('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3b62('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3b62('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x3b62('0x7')](0x3)[_0x3b62('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b62('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b62('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3b62('0x7')](0x5)[_0x3b62('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b62('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3b62('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b62('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3b62('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3b62('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x3b62('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3b62('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b62('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3b62('0x7')](0x3)[_0x3b62('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3b62('0x10')},'dialTimezone':{'type':Sequelize[_0x3b62('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3b62('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x3b62('0x3')](_0x3b62('0x11'),_0x3b62('0x12'),'onlyIfOpen'),'defaultValue':_0x3b62('0x11')},'dialAMDActive':{'type':Sequelize[_0x3b62('0x5')],'defaultValue':0x0,'comment':_0x3b62('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3b62('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x3b62('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3b62('0x7')](0x9)[_0x3b62('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3b62('0x7')](0x9)[_0x3b62('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3b62('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0x3b62('0x7')](0x9)[_0x3b62('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3b62('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3b62('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3b62('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3b62('0x7')](0x9)[_0x3b62('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3b62('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3b62('0x7')](0x5)[_0x3b62('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3b62('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3b62('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3b62('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3b62('0x3')](_0x3b62('0x1a'),_0x3b62('0x1b')),'defaultValue':_0x3b62('0x1a')},'dialPrefix':{'type':Sequelize[_0x3b62('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3b62('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3b62('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b62('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3b62('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b62('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x3b62('0x7')](0x3)[_0x3b62('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b62('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x3b62('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3b62('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b62('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b62('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x3b62('0x7')](0x3)[_0x3b62('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x3b62('0x7')](0x5)[_0x3b62('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b62('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3b62('0x7')](0x3)[_0x3b62('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b62('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3b62('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b62('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index e75595a..9ddf5f3 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 _0x11e5=['sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','Campaign','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','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','getHoppers','findOne','CmHopper','hasOwnProperty','CampaignId','getHopperHistories','CmHopperHistory','nolimit','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ListId','createdAt','field','NOW()','ContactId','CmListId','toString','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','from','cm_hopper','CampaignId\x20=\x20?','scheduledAt','select','cm_contacts','ListId\x20=\x20?','push'];(function(_0x556be7,_0xb3feaa){var _0x485e2c=function(_0x271a08){while(--_0x271a08){_0x556be7['push'](_0x556be7['shift']());}};_0x485e2c(++_0xb3feaa);}(_0x11e5,0x8b));var _0x511e=function(_0x2c573c,_0x9cabdf){_0x2c573c=_0x2c573c-0x0;var _0x9f1946=_0x11e5[_0x2c573c];return _0x9f1946;};'use strict';var pdf=require(_0x511e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x511e('0x1'));var zipdir=require(_0x511e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x511e('0x3'));var moment=require(_0x511e('0x4'));var BPromise=require(_0x511e('0x5'));var Mustache=require('mustache');var util=require(_0x511e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x511e('0x7'));var ejs=require(_0x511e('0x8'));var fs=require('fs');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('0x7'));var querystring=require(_0x511e('0xc'));var Papa=require(_0x511e('0xd'));var Redis=require(_0x511e('0xe'));var authService=require(_0x511e('0xf'));var qs=require(_0x511e('0x10'));var as=require(_0x511e('0x11'));var hardwareService=require(_0x511e('0x12'));var logger=require(_0x511e('0x13'))('api');var utils=require(_0x511e('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3deecc,_0x327880){_0x327880=_0x327880||0xcc;return function(_0x42679e){if(_0x42679e){return _0x3deecc[_0x511e('0x15')](_0x327880);}return _0x3deecc[_0x511e('0x16')](_0x327880)[_0x511e('0x17')]();};}function respondWithResult(_0x4e72fd,_0xdd0dcd){_0xdd0dcd=_0xdd0dcd||0xc8;return function(_0x33fd64){if(_0x33fd64){return _0x4e72fd['status'](_0xdd0dcd)[_0x511e('0x18')](_0x33fd64);}};}function respondWithFilteredResult(_0x43a329,_0x4f50b9){return function(_0xed773e){if(_0xed773e){var _0x162c91=_0xed773e[_0x511e('0x19')],_0x3b990b=_0x4f50b9[_0x511e('0x1a')],_0x17fd4a=_0x4f50b9[_0x511e('0x1a')]+_0x4f50b9['limit'],_0x5b6cd6;if(_0x17fd4a>=_0x162c91){_0x17fd4a=_0x162c91;_0x5b6cd6=0xc8;}else{_0x5b6cd6=0xce;}_0x43a329[_0x511e('0x16')](_0x5b6cd6);return _0x43a329['set'](_0x511e('0x1b'),_0x3b990b+'-'+_0x17fd4a+'/'+_0x162c91)['json'](_0xed773e);}return null;};}function patchUpdates(_0x5821ee){return function(_0x37ae92){try{jsonpatch['apply'](_0x37ae92,_0x5821ee,!![]);}catch(_0x33bef5){return BPromise[_0x511e('0x1c')](_0x33bef5);}return _0x37ae92[_0x511e('0x1d')]();};}function saveUpdates(_0x3cbc5a,_0xd4df6f){return function(_0x3d3f46){if(_0x3d3f46){return _0x3d3f46[_0x511e('0x1e')](_0x3cbc5a)[_0x511e('0x1f')](function(_0x4a8067){return _0x4a8067;});}return null;};}function removeEntity(_0x1e2b41,_0x39e0b4){return function(_0x2ebf30){if(_0x2ebf30){return _0x2ebf30[_0x511e('0x20')]()[_0x511e('0x1f')](function(){var _0x18807b=_0x2ebf30[_0x511e('0x21')]({'plain':!![]});var _0x2f28fc=_0x511e('0x22');return db[_0x511e('0x23')]['destroy']({'where':{'type':_0x2f28fc,'resourceId':_0x18807b['id']}})['then'](function(){return _0x2ebf30;});})[_0x511e('0x1f')](function(){_0x1e2b41['status'](0xcc)[_0x511e('0x17')]();});}};}function handleEntityNotFound(_0x53017d,_0x3fbd19){return function(_0x473f30){if(!_0x473f30){_0x53017d[_0x511e('0x15')](0x194);}return _0x473f30;};}function handleError(_0x1f8040,_0x1bb7f9){_0x1bb7f9=_0x1bb7f9||0x1f4;return function(_0x9dfe29){logger[_0x511e('0x24')](_0x9dfe29[_0x511e('0x25')]);if(_0x9dfe29[_0x511e('0x26')]){delete _0x9dfe29[_0x511e('0x26')];}_0x1f8040['status'](_0x1bb7f9)[_0x511e('0x27')](_0x9dfe29);};}exports[_0x511e('0x28')]=function(_0xb563f6,_0x1aaac1){var _0x369be6={},_0x50305a={},_0x431b75={'count':0x0,'rows':[]};var _0x4e157f=_['map'](db[_0x511e('0x29')][_0x511e('0x2a')],function(_0xa3b110){return{'name':_0xa3b110[_0x511e('0x2b')],'type':_0xa3b110[_0x511e('0x2c')]['key']};});_0x50305a[_0x511e('0x2d')]=_[_0x511e('0x2e')](_0x4e157f,_0x511e('0x26'));_0x50305a[_0x511e('0x2f')]=_[_0x511e('0x30')](_0xb563f6['query']);_0x50305a[_0x511e('0x31')]=_[_0x511e('0x32')](_0x50305a[_0x511e('0x2d')],_0x50305a[_0x511e('0x2f')]);_0x369be6[_0x511e('0x33')]=_[_0x511e('0x32')](_0x50305a[_0x511e('0x2d')],qs[_0x511e('0x34')](_0xb563f6['query'][_0x511e('0x34')]));_0x369be6[_0x511e('0x33')]=_0x369be6[_0x511e('0x33')][_0x511e('0x35')]?_0x369be6['attributes']:_0x50305a['model'];if(!_0xb563f6[_0x511e('0x2f')]['hasOwnProperty']('nolimit')){_0x369be6[_0x511e('0x36')]=qs[_0x511e('0x36')](_0xb563f6[_0x511e('0x2f')][_0x511e('0x36')]);_0x369be6[_0x511e('0x1a')]=qs['offset'](_0xb563f6[_0x511e('0x2f')][_0x511e('0x1a')]);}_0x369be6[_0x511e('0x37')]=qs['sort'](_0xb563f6[_0x511e('0x2f')][_0x511e('0x38')]);_0x369be6[_0x511e('0x39')]=qs['filters'](_[_0x511e('0x3a')](_0xb563f6[_0x511e('0x2f')],_0x50305a['filters']),_0x4e157f);if(_0xb563f6[_0x511e('0x2f')][_0x511e('0x3b')]){_0x369be6[_0x511e('0x39')]=_[_0x511e('0x3c')](_0x369be6[_0x511e('0x39')],{'$or':_[_0x511e('0x2e')](_0x4e157f,function(_0x2032dd){if(_0x2032dd[_0x511e('0x2c')]!==_0x511e('0x3d')){var _0x217feb={};_0x217feb[_0x2032dd[_0x511e('0x26')]]={'$like':'%'+_0xb563f6['query'][_0x511e('0x3b')]+'%'};return _0x217feb;}})});}_0x369be6=_['merge']({},_0x369be6,_0xb563f6['options']);var _0xd31415={'where':_0x369be6['where']};return db['Campaign'][_0x511e('0x19')](_0xd31415)[_0x511e('0x1f')](function(_0x3c0ef4){_0x431b75[_0x511e('0x19')]=_0x3c0ef4;if(_0xb563f6[_0x511e('0x2f')][_0x511e('0x3e')]){_0x369be6[_0x511e('0x3f')]=[{'all':!![]}];}return db[_0x511e('0x29')][_0x511e('0x40')](_0x369be6);})[_0x511e('0x1f')](function(_0x26b1be){_0x431b75[_0x511e('0x41')]=_0x26b1be;return _0x431b75;})[_0x511e('0x1f')](respondWithFilteredResult(_0x1aaac1,_0x369be6))[_0x511e('0x42')](handleError(_0x1aaac1,null));};exports['show']=function(_0x5a7a12,_0x19ffde){var _0x29dcc1={'raw':![],'where':{'id':_0x5a7a12[_0x511e('0x43')]['id']}},_0x198ec1={};_0x198ec1[_0x511e('0x2d')]=_['keys'](db[_0x511e('0x29')][_0x511e('0x2a')]);_0x198ec1[_0x511e('0x2f')]=_['keys'](_0x5a7a12['query']);_0x198ec1['filters']=_[_0x511e('0x32')](_0x198ec1[_0x511e('0x2d')],_0x198ec1[_0x511e('0x2f')]);_0x29dcc1['attributes']=_['intersection'](_0x198ec1['model'],qs[_0x511e('0x34')](_0x5a7a12[_0x511e('0x2f')][_0x511e('0x34')]));_0x29dcc1[_0x511e('0x33')]=_0x29dcc1[_0x511e('0x33')][_0x511e('0x35')]?_0x29dcc1[_0x511e('0x33')]:_0x198ec1[_0x511e('0x2d')];if(_0x5a7a12[_0x511e('0x2f')][_0x511e('0x3e')]){_0x29dcc1[_0x511e('0x3f')]=[{'all':!![]}];}_0x29dcc1=_[_0x511e('0x3c')]({},_0x29dcc1,_0x5a7a12[_0x511e('0x44')]);return db[_0x511e('0x29')][_0x511e('0x45')](_0x29dcc1)[_0x511e('0x1f')](handleEntityNotFound(_0x19ffde,null))[_0x511e('0x1f')](respondWithResult(_0x19ffde,null))[_0x511e('0x42')](handleError(_0x19ffde,null));};exports[_0x511e('0x46')]=function(_0x2c2573,_0x2a00a5){return db[_0x511e('0x29')][_0x511e('0x46')](_0x2c2573[_0x511e('0x47')],{})[_0x511e('0x1f')](function(_0x4096c0){var _0x3d6f6e=_0x2c2573[_0x511e('0x48')][_0x511e('0x21')]({'plain':!![]});if(!_0x3d6f6e)throw new Error(_0x511e('0x49'));if(_0x3d6f6e[_0x511e('0x4a')]==='user'){var _0x1cd147=_0x4096c0['get']({'plain':!![]});var _0x361082=_0x511e('0x22');return db[_0x511e('0x4b')]['find']({'where':{'name':_0x361082,'userProfileId':_0x3d6f6e[_0x511e('0x4c')]},'raw':!![]})[_0x511e('0x1f')](function(_0x33d555){if(_0x33d555&&_0x33d555['autoAssociation']===0x0){return db[_0x511e('0x23')][_0x511e('0x46')]({'name':_0x1cd147['name'],'resourceId':_0x1cd147['id'],'type':_0x33d555[_0x511e('0x26')],'sectionId':_0x33d555['id']},{})[_0x511e('0x1f')](function(){return _0x4096c0;});}else{return _0x4096c0;}})[_0x511e('0x42')](function(_0x32df56){logger['error'](_0x511e('0x4d'),_0x32df56);throw _0x32df56;});}return _0x4096c0;})['then'](respondWithResult(_0x2a00a5,0xc9))[_0x511e('0x42')](handleError(_0x2a00a5,null));};exports[_0x511e('0x4e')]=function(_0x31a0e7,_0x578b75){var _0x2d2bb1={'where':{'id':_0x31a0e7[_0x511e('0x43')]['id']}},_0x59b4a7={};_0x59b4a7[_0x511e('0x2d')]=_[_0x511e('0x30')](db[_0x511e('0x29')][_0x511e('0x2a')]);_0x2d2bb1['attributes']=_[_0x511e('0x32')](_0x59b4a7[_0x511e('0x2d')],qs[_0x511e('0x34')](_0x31a0e7[_0x511e('0x2f')][_0x511e('0x34')]));_0x2d2bb1[_0x511e('0x33')]=_0x2d2bb1[_0x511e('0x33')][_0x511e('0x35')]?_0x2d2bb1['attributes']:_0x59b4a7[_0x511e('0x2d')];if(_0x31a0e7[_0x511e('0x2f')]['includeAll']){_0x2d2bb1[_0x511e('0x3f')]=[{'all':!![]}];}_0x2d2bb1=_[_0x511e('0x3c')]({},_0x2d2bb1,_0x31a0e7[_0x511e('0x44')]);return db[_0x511e('0x29')][_0x511e('0x45')](_0x2d2bb1)[_0x511e('0x1f')](handleEntityNotFound(_0x578b75,null))['then'](function(_0x31777b){if(_0x31777b){var _0x1c96c9=_0x31777b['get']({'plain':!![]});_0x1c96c9=qs[_0x511e('0x4f')](_0x1c96c9,['id','createdAt',_0x511e('0x50')]);_0x31a0e7[_0x511e('0x47')]=_['omit'](_0x31a0e7['body'],['id','createdAt','updatedAt']);return db[_0x511e('0x29')]['create'](_['merge'](_0x1c96c9,_0x31a0e7[_0x511e('0x47')]),{'include':_0x31a0e7[_0x511e('0x2f')]['includeAll']?[{'all':!![]}]:undefined})[_0x511e('0x1f')](function(_0x5a4581){var _0x3a3744=_0x31a0e7['user']['get']({'plain':!![]});if(!_0x3a3744)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a3744[_0x511e('0x4a')]===_0x511e('0x48')){var _0x4fa74c=_0x5a4581['get']({'plain':!![]});var _0x51940a='IvrCampaigns';return db[_0x511e('0x4b')]['find']({'where':{'name':_0x51940a,'userProfileId':_0x3a3744[_0x511e('0x4c')]},'raw':!![]})['then'](function(_0x2713ea){if(_0x2713ea&&_0x2713ea[_0x511e('0x51')]===0x0){return db[_0x511e('0x23')][_0x511e('0x46')]({'name':_0x4fa74c['name'],'resourceId':_0x4fa74c['id'],'type':_0x2713ea[_0x511e('0x26')],'sectionId':_0x2713ea['id']},{})[_0x511e('0x1f')](function(){return _0x5a4581;});}else{return _0x5a4581;}})[_0x511e('0x42')](function(_0x2b493f){logger[_0x511e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b493f);throw _0x2b493f;});}return _0x5a4581;});}})['then'](respondWithResult(_0x578b75,0xc9))[_0x511e('0x42')](handleError(_0x578b75,null));};exports[_0x511e('0x1e')]=function(_0x42cb48,_0x537df4){if(_0x42cb48[_0x511e('0x47')]['id']){delete _0x42cb48[_0x511e('0x47')]['id'];}return db[_0x511e('0x29')][_0x511e('0x45')]({'where':{'id':_0x42cb48[_0x511e('0x43')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x537df4,null))['then'](saveUpdates(_0x42cb48['body'],null))['then'](respondWithResult(_0x537df4,null))[_0x511e('0x42')](handleError(_0x537df4,null));};exports['destroy']=function(_0xc74be5,_0x574832){return db[_0x511e('0x29')]['find']({'where':{'id':_0xc74be5[_0x511e('0x43')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x574832,null))[_0x511e('0x1f')](removeEntity(_0x574832,null))[_0x511e('0x42')](handleError(_0x574832,null));};exports[_0x511e('0x52')]=function(_0x52f3d9,_0x2f3523,_0x5d1433){var _0x435b2a={'raw':!![],'where':{}};var _0xdf5fca={};var _0x159a45={'count':0x0,'rows':[]};return db['Campaign'][_0x511e('0x53')]({'where':{'id':_0x52f3d9[_0x511e('0x43')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x2f3523,null))[_0x511e('0x1f')](function(_0x50b93d){if(_0x50b93d){_0xdf5fca['model']=_[_0x511e('0x30')](db[_0x511e('0x54')]['rawAttributes']);_0xdf5fca[_0x511e('0x2f')]=_['keys'](_0x52f3d9[_0x511e('0x2f')]);_0xdf5fca[_0x511e('0x31')]=_['intersection'](_0xdf5fca['model'],_0xdf5fca[_0x511e('0x2f')]);_0x435b2a[_0x511e('0x33')]=_[_0x511e('0x32')](_0xdf5fca['model'],qs[_0x511e('0x34')](_0x52f3d9[_0x511e('0x2f')][_0x511e('0x34')]));_0x435b2a[_0x511e('0x33')]=_0x435b2a[_0x511e('0x33')][_0x511e('0x35')]?_0x435b2a[_0x511e('0x33')]:_0xdf5fca['model'];if(!_0x52f3d9[_0x511e('0x2f')][_0x511e('0x55')]('nolimit')){_0x435b2a['limit']=qs[_0x511e('0x36')](_0x52f3d9[_0x511e('0x2f')]['limit']);_0x435b2a[_0x511e('0x1a')]=qs['offset'](_0x52f3d9[_0x511e('0x2f')]['offset']);}_0x435b2a['order']=qs[_0x511e('0x38')](_0x52f3d9[_0x511e('0x2f')][_0x511e('0x38')]);_0x435b2a[_0x511e('0x39')]=qs[_0x511e('0x31')](_['pick'](_0x52f3d9['query'],_0xdf5fca[_0x511e('0x31')]));_0x435b2a[_0x511e('0x39')][_0x511e('0x56')]=_0x50b93d['id'];if(_0x52f3d9['query'][_0x511e('0x3b')]){_0x435b2a[_0x511e('0x39')]=_['merge'](_0x435b2a['where'],{'$or':_[_0x511e('0x2e')](_0x435b2a[_0x511e('0x33')],function(_0x3be0cb){var _0x208e4b={};_0x208e4b[_0x3be0cb]={'$like':'%'+_0x52f3d9[_0x511e('0x2f')][_0x511e('0x3b')]+'%'};return _0x208e4b;})});}_0x435b2a=_['merge']({},_0x435b2a,_0x52f3d9[_0x511e('0x44')]);return db[_0x511e('0x54')]['count']({'where':_0x435b2a['where']})[_0x511e('0x1f')](function(_0x528885){_0x159a45[_0x511e('0x19')]=_0x528885;if(_0x52f3d9['query']['includeAll']){_0x435b2a[_0x511e('0x3f')]=[{'all':!![]}];}return db[_0x511e('0x54')][_0x511e('0x40')](_0x435b2a);})[_0x511e('0x1f')](function(_0x3b497b){_0x159a45[_0x511e('0x41')]=_0x3b497b;return _0x159a45;});}})[_0x511e('0x1f')](respondWithFilteredResult(_0x2f3523,_0x435b2a))[_0x511e('0x42')](handleError(_0x2f3523,null));};exports[_0x511e('0x57')]=function(_0x1da39e,_0x451c8f,_0x2d6b92){var _0x3b4712={'raw':!![],'where':{}};var _0x2f35cc={};var _0x34325f={'count':0x0,'rows':[]};return db[_0x511e('0x29')]['findOne']({'where':{'id':_0x1da39e[_0x511e('0x43')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x451c8f,null))[_0x511e('0x1f')](function(_0x20e3ee){if(_0x20e3ee){_0x2f35cc[_0x511e('0x2d')]=_[_0x511e('0x30')](db[_0x511e('0x58')][_0x511e('0x2a')]);_0x2f35cc[_0x511e('0x2f')]=_[_0x511e('0x30')](_0x1da39e[_0x511e('0x2f')]);_0x2f35cc['filters']=_[_0x511e('0x32')](_0x2f35cc[_0x511e('0x2d')],_0x2f35cc[_0x511e('0x2f')]);_0x3b4712[_0x511e('0x33')]=_['intersection'](_0x2f35cc[_0x511e('0x2d')],qs[_0x511e('0x34')](_0x1da39e[_0x511e('0x2f')][_0x511e('0x34')]));_0x3b4712[_0x511e('0x33')]=_0x3b4712[_0x511e('0x33')][_0x511e('0x35')]?_0x3b4712[_0x511e('0x33')]:_0x2f35cc[_0x511e('0x2d')];if(!_0x1da39e[_0x511e('0x2f')]['hasOwnProperty'](_0x511e('0x59'))){_0x3b4712[_0x511e('0x36')]=qs[_0x511e('0x36')](_0x1da39e[_0x511e('0x2f')][_0x511e('0x36')]);_0x3b4712[_0x511e('0x1a')]=qs[_0x511e('0x1a')](_0x1da39e['query']['offset']);}_0x3b4712[_0x511e('0x37')]=qs[_0x511e('0x38')](_0x1da39e[_0x511e('0x2f')][_0x511e('0x38')]);_0x3b4712[_0x511e('0x39')]=qs[_0x511e('0x31')](_[_0x511e('0x3a')](_0x1da39e[_0x511e('0x2f')],_0x2f35cc[_0x511e('0x31')]));_0x3b4712[_0x511e('0x39')]['CampaignId']=_0x20e3ee['id'];if(_0x1da39e[_0x511e('0x2f')][_0x511e('0x3b')]){_0x3b4712[_0x511e('0x39')]=_[_0x511e('0x3c')](_0x3b4712[_0x511e('0x39')],{'$or':_['map'](_0x3b4712['attributes'],function(_0x1d408d){var _0x26a9f0={};_0x26a9f0[_0x1d408d]={'$like':'%'+_0x1da39e[_0x511e('0x2f')][_0x511e('0x3b')]+'%'};return _0x26a9f0;})});}_0x3b4712=_['merge']({},_0x3b4712,_0x1da39e[_0x511e('0x44')]);return db[_0x511e('0x58')]['count']({'where':_0x3b4712[_0x511e('0x39')]})['then'](function(_0xd74673){_0x34325f[_0x511e('0x19')]=_0xd74673;if(_0x1da39e[_0x511e('0x2f')][_0x511e('0x3e')]){_0x3b4712[_0x511e('0x3f')]=[{'all':!![]}];}return db[_0x511e('0x58')][_0x511e('0x40')](_0x3b4712);})[_0x511e('0x1f')](function(_0x3289a9){_0x34325f[_0x511e('0x41')]=_0x3289a9;return _0x34325f;});}})[_0x511e('0x1f')](respondWithFilteredResult(_0x451c8f,_0x3b4712))[_0x511e('0x42')](handleError(_0x451c8f,null));};exports[_0x511e('0x5a')]=function(_0x28907e,_0x19a0df,_0x185bf7){var _0x45d846={'raw':!![],'where':{}};var _0x361a75={};var _0x50ccc7={'count':0x0,'rows':[]};return db[_0x511e('0x29')][_0x511e('0x53')]({'where':{'id':_0x28907e[_0x511e('0x43')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x19a0df,null))[_0x511e('0x1f')](function(_0x503ac2){if(_0x503ac2){_0x361a75[_0x511e('0x2d')]=_[_0x511e('0x30')](db[_0x511e('0x5b')]['rawAttributes']);_0x361a75[_0x511e('0x2f')]=_[_0x511e('0x30')](_0x28907e[_0x511e('0x2f')]);_0x361a75[_0x511e('0x31')]=_['intersection'](_0x361a75['model'],_0x361a75['query']);_0x45d846[_0x511e('0x33')]=_[_0x511e('0x32')](_0x361a75['model'],qs[_0x511e('0x34')](_0x28907e['query'][_0x511e('0x34')]));_0x45d846['attributes']=_0x45d846[_0x511e('0x33')][_0x511e('0x35')]?_0x45d846['attributes']:_0x361a75[_0x511e('0x2d')];if(!_0x28907e[_0x511e('0x2f')][_0x511e('0x55')](_0x511e('0x59'))){_0x45d846[_0x511e('0x36')]=qs['limit'](_0x28907e['query']['limit']);_0x45d846['offset']=qs['offset'](_0x28907e[_0x511e('0x2f')][_0x511e('0x1a')]);}_0x45d846[_0x511e('0x37')]=qs['sort'](_0x28907e[_0x511e('0x2f')][_0x511e('0x38')]);_0x45d846[_0x511e('0x39')]=qs[_0x511e('0x31')](_[_0x511e('0x3a')](_0x28907e[_0x511e('0x2f')],_0x361a75[_0x511e('0x31')]));_0x45d846['where'][_0x511e('0x56')]=_0x503ac2['id'];if(_0x28907e[_0x511e('0x2f')][_0x511e('0x3b')]){_0x45d846['where']=_[_0x511e('0x3c')](_0x45d846[_0x511e('0x39')],{'$or':_['map'](_0x45d846[_0x511e('0x33')],function(_0xe90c1f){var _0x5dc28d={};_0x5dc28d[_0xe90c1f]={'$like':'%'+_0x28907e[_0x511e('0x2f')][_0x511e('0x3b')]+'%'};return _0x5dc28d;})});}_0x45d846=_['merge']({},_0x45d846,_0x28907e['options']);return db[_0x511e('0x5b')][_0x511e('0x19')]({'where':_0x45d846[_0x511e('0x39')]})[_0x511e('0x1f')](function(_0x4bcfef){_0x50ccc7[_0x511e('0x19')]=_0x4bcfef;if(_0x28907e[_0x511e('0x2f')][_0x511e('0x3e')]){_0x45d846[_0x511e('0x3f')]=[{'all':!![]}];}return db[_0x511e('0x5b')][_0x511e('0x40')](_0x45d846);})[_0x511e('0x1f')](function(_0x2e979c){_0x50ccc7[_0x511e('0x41')]=_0x2e979c;return _0x50ccc7;});}})['then'](respondWithFilteredResult(_0x19a0df,_0x45d846))['catch'](handleError(_0x19a0df,null));};exports[_0x511e('0x5c')]=function(_0x4e528a,_0x453d02,_0x403017){var _0x1133c4={'raw':!![],'where':{}};var _0x904e34={};var _0x1dcf29={'count':0x0,'rows':[]};return db[_0x511e('0x29')][_0x511e('0x53')]({'where':{'id':_0x4e528a['params']['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x453d02,null))['then'](function(_0x3353b8){if(_0x3353b8){_0x904e34[_0x511e('0x2d')]=_[_0x511e('0x30')](db[_0x511e('0x5d')][_0x511e('0x2a')]);_0x904e34[_0x511e('0x2f')]=_[_0x511e('0x30')](_0x4e528a[_0x511e('0x2f')]);_0x904e34[_0x511e('0x31')]=_['intersection'](_0x904e34[_0x511e('0x2d')],_0x904e34[_0x511e('0x2f')]);_0x1133c4[_0x511e('0x33')]=_['intersection'](_0x904e34[_0x511e('0x2d')],qs[_0x511e('0x34')](_0x4e528a[_0x511e('0x2f')][_0x511e('0x34')]));_0x1133c4[_0x511e('0x33')]=_0x1133c4['attributes'][_0x511e('0x35')]?_0x1133c4[_0x511e('0x33')]:_0x904e34['model'];if(!_0x4e528a[_0x511e('0x2f')]['hasOwnProperty'](_0x511e('0x59'))){_0x1133c4[_0x511e('0x36')]=qs['limit'](_0x4e528a[_0x511e('0x2f')][_0x511e('0x36')]);_0x1133c4['offset']=qs['offset'](_0x4e528a['query'][_0x511e('0x1a')]);}_0x1133c4[_0x511e('0x37')]=qs['sort'](_0x4e528a[_0x511e('0x2f')][_0x511e('0x38')]);_0x1133c4[_0x511e('0x39')]=qs['filters'](_[_0x511e('0x3a')](_0x4e528a[_0x511e('0x2f')],_0x904e34['filters']));_0x1133c4['where'][_0x511e('0x56')]=_0x3353b8['id'];if(_0x4e528a[_0x511e('0x2f')][_0x511e('0x3b')]){_0x1133c4[_0x511e('0x39')]=_[_0x511e('0x3c')](_0x1133c4['where'],{'$or':_[_0x511e('0x2e')](_0x1133c4[_0x511e('0x33')],function(_0x31feac){var _0x2a5c00={};_0x2a5c00[_0x31feac]={'$like':'%'+_0x4e528a['query']['filter']+'%'};return _0x2a5c00;})});}_0x1133c4=_[_0x511e('0x3c')]({},_0x1133c4,_0x4e528a[_0x511e('0x44')]);return db[_0x511e('0x5d')]['count']({'where':_0x1133c4[_0x511e('0x39')]})[_0x511e('0x1f')](function(_0x7eaff){_0x1dcf29['count']=_0x7eaff;if(_0x4e528a['query'][_0x511e('0x3e')]){_0x1133c4[_0x511e('0x3f')]=[{'all':!![]}];}return db[_0x511e('0x5d')][_0x511e('0x40')](_0x1133c4);})['then'](function(_0x50f5b7){_0x1dcf29['rows']=_0x50f5b7;return _0x1dcf29;});}})['then'](respondWithFilteredResult(_0x453d02,_0x1133c4))[_0x511e('0x42')](handleError(_0x453d02,null));};exports[_0x511e('0x5e')]=function(_0xa2b3e8,_0x148c22,_0x5f5cf1){var _0x51770f={};var _0x1bb4fc={};var _0x3ca915;var _0x1111df;return db[_0x511e('0x29')]['findOne']({'where':{'id':_0xa2b3e8[_0x511e('0x43')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x148c22,null))['then'](function(_0x201093){if(_0x201093){_0x3ca915=_0x201093;_0x1bb4fc[_0x511e('0x2d')]=_['keys'](db[_0x511e('0x5f')][_0x511e('0x2a')]);_0x1bb4fc['query']=_[_0x511e('0x30')](_0xa2b3e8[_0x511e('0x2f')]);_0x1bb4fc['filters']=_[_0x511e('0x32')](_0x1bb4fc['model'],_0x1bb4fc[_0x511e('0x2f')]);_0x51770f[_0x511e('0x33')]=_[_0x511e('0x32')](_0x1bb4fc[_0x511e('0x2d')],qs[_0x511e('0x34')](_0xa2b3e8[_0x511e('0x2f')][_0x511e('0x34')]));_0x51770f[_0x511e('0x33')]=_0x51770f[_0x511e('0x33')][_0x511e('0x35')]?_0x51770f['attributes']:_0x1bb4fc[_0x511e('0x2d')];_0x51770f[_0x511e('0x37')]=qs[_0x511e('0x38')](_0xa2b3e8[_0x511e('0x2f')][_0x511e('0x38')]);_0x51770f[_0x511e('0x39')]=qs[_0x511e('0x31')](_['pick'](_0xa2b3e8[_0x511e('0x2f')],_0x1bb4fc['filters']));if(_0xa2b3e8[_0x511e('0x2f')][_0x511e('0x3b')]){_0x51770f[_0x511e('0x39')]=_[_0x511e('0x3c')](_0x51770f[_0x511e('0x39')],{'$or':_[_0x511e('0x2e')](_0x51770f[_0x511e('0x33')],function(_0x277c45){var _0x37e9d0={};_0x37e9d0[_0x277c45]={'$like':'%'+_0xa2b3e8['query'][_0x511e('0x3b')]+'%'};return _0x37e9d0;})});}_0x51770f=_[_0x511e('0x3c')]({},_0x51770f,_0xa2b3e8[_0x511e('0x44')]);return _0x3ca915[_0x511e('0x5e')](_0x51770f);}})[_0x511e('0x1f')](function(_0x441f78){if(_0x441f78){_0x1111df=_0x441f78[_0x511e('0x35')];if(!_0xa2b3e8[_0x511e('0x2f')]['hasOwnProperty'](_0x511e('0x59'))){_0x51770f[_0x511e('0x36')]=qs[_0x511e('0x36')](_0xa2b3e8[_0x511e('0x2f')][_0x511e('0x36')]);_0x51770f[_0x511e('0x1a')]=qs[_0x511e('0x1a')](_0xa2b3e8['query']['offset']);}return _0x3ca915[_0x511e('0x5e')](_0x51770f);}})[_0x511e('0x1f')](function(_0x463cef){if(_0x463cef){return _0x463cef?{'count':_0x1111df,'rows':_0x463cef}:null;}})['then'](respondWithResult(_0x148c22,null))[_0x511e('0x42')](handleError(_0x148c22,null));};exports[_0x511e('0x60')]=function(_0x2d6784,_0x5d8c56,_0x332a1d){var _0x54b0d0,_0x139d09;return db['Campaign'][_0x511e('0x45')]({'where':{'id':_0x2d6784[_0x511e('0x43')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x5d8c56,null))[_0x511e('0x1f')](function(_0x1c5976){if(_0x1c5976){_0x139d09=_0x1c5976;return _0x1c5976[_0x511e('0x60')](_0x2d6784[_0x511e('0x47')]['ids'],_['omit'](_0x2d6784[_0x511e('0x47')],[_0x511e('0x61'),'id'])||{});}return null;})[_0x511e('0x62')](function(_0xc57127){var _0x528a01;_0x54b0d0=_0xc57127||[];var _0x4734d9=[];if(_0xc57127){for(var _0x3bb808=0x0;_0x3bb808<_0xc57127[_0x511e('0x35')];_0x3bb808+=0x1){var _0xc60f3c=_0xc57127[_0x3bb808]['get']({'plain':!![]});_0x139d09[_0x511e('0x63')]=_0x2d6784['body']['dialCheckDuplicateType']?_0x2d6784[_0x511e('0x47')][_0x511e('0x63')]:_0x139d09[_0x511e('0x63')];switch(_0x139d09[_0x511e('0x63')]){case _0x511e('0x64'):_0x528a01=squel[_0x511e('0x65')]()[_0x511e('0x66')]('cm_hopper')[_0x511e('0x67')]([_0x511e('0x68'),'scheduledAt','ContactId',_0x511e('0x69'),_0x511e('0x56'),_0x511e('0x6a'),_0x511e('0x50')],squel['select']()[_0x511e('0x6b')](_0x511e('0x68'),_0x511e('0x68'))['field'](_0x511e('0x6c'),'scheduledAt')[_0x511e('0x6b')]('id',_0x511e('0x6d'))['field'](_0xc60f3c[_0x511e('0x6e')]['toString'](),_0x511e('0x69'))['field'](_0x2d6784[_0x511e('0x43')]['id'][_0x511e('0x6f')](),'CampaignId')[_0x511e('0x6b')](_0x511e('0x6c'),_0x511e('0x6a'))[_0x511e('0x6b')](_0x511e('0x6c'),_0x511e('0x50'))['from']('cm_contacts')['where'](_0x511e('0x70'))[_0x511e('0x39')]('ListId\x20=\x20?',_0xc60f3c[_0x511e('0x6e')][_0x511e('0x6f')]())[_0x511e('0x39')](_0x511e('0x71'))[_0x511e('0x39')](_0x511e('0x72'),squel['select']()[_0x511e('0x6b')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x511e('0x73'))[_0x511e('0x39')]('CampaignId\x20=\x20?',_0x2d6784[_0x511e('0x43')]['id'][_0x511e('0x6f')]()))[_0x511e('0x39')](_0x511e('0x72'),squel['select']()[_0x511e('0x6b')](_0x511e('0x74'))[_0x511e('0x75')](_0x511e('0x76'))[_0x511e('0x39')](_0x511e('0x77'),_0x2d6784['params']['id'][_0x511e('0x6f')]())))[_0x511e('0x6f')]();break;case'onlyIfOpen':_0x528a01=squel[_0x511e('0x65')]()['into'](_0x511e('0x76'))[_0x511e('0x67')](['phone',_0x511e('0x78'),_0x511e('0x6d'),'ListId',_0x511e('0x56'),_0x511e('0x6a'),_0x511e('0x50')],squel[_0x511e('0x79')]()[_0x511e('0x6b')]('phone',_0x511e('0x68'))[_0x511e('0x6b')]('NOW()',_0x511e('0x78'))[_0x511e('0x6b')]('id',_0x511e('0x6d'))['field'](_0xc60f3c[_0x511e('0x6e')][_0x511e('0x6f')](),_0x511e('0x69'))[_0x511e('0x6b')](_0x2d6784[_0x511e('0x43')]['id']['toString'](),'CampaignId')[_0x511e('0x6b')](_0x511e('0x6c'),_0x511e('0x6a'))[_0x511e('0x6b')]('NOW()',_0x511e('0x50'))['from'](_0x511e('0x7a'))[_0x511e('0x39')](_0x511e('0x70'))[_0x511e('0x39')]('ListId\x20=\x20?',_0xc60f3c[_0x511e('0x6e')][_0x511e('0x6f')]())[_0x511e('0x39')](_0x511e('0x71'))[_0x511e('0x39')](_0x511e('0x72'),squel[_0x511e('0x79')]()[_0x511e('0x6b')]('COALESCE(phone,\x27\x27)')[_0x511e('0x75')](_0x511e('0x76'))[_0x511e('0x39')](_0x511e('0x77'),_0x2d6784[_0x511e('0x43')]['id'][_0x511e('0x6f')]())))[_0x511e('0x6f')]();break;default:_0x528a01=squel[_0x511e('0x65')]()[_0x511e('0x66')](_0x511e('0x76'))[_0x511e('0x67')](['phone',_0x511e('0x78'),_0x511e('0x6d'),_0x511e('0x69'),_0x511e('0x56'),'createdAt',_0x511e('0x50')],squel[_0x511e('0x79')]()['field'](_0x511e('0x68'),_0x511e('0x68'))[_0x511e('0x6b')](_0x511e('0x6c'),_0x511e('0x78'))[_0x511e('0x6b')]('id','ContactId')[_0x511e('0x6b')](_0xc60f3c[_0x511e('0x6e')]['toString'](),'ListId')[_0x511e('0x6b')](_0x2d6784['params']['id']['toString'](),_0x511e('0x56'))[_0x511e('0x6b')](_0x511e('0x6c'),_0x511e('0x6a'))[_0x511e('0x6b')]('NOW()',_0x511e('0x50'))['from'](_0x511e('0x7a'))[_0x511e('0x39')](_0x511e('0x70'))[_0x511e('0x39')](_0x511e('0x7b'),_0xc60f3c[_0x511e('0x6e')]['toString']())[_0x511e('0x39')](_0x511e('0x71')))[_0x511e('0x6f')]();}_0x4734d9[_0x511e('0x7c')](db[_0x511e('0x7d')][_0x511e('0x2f')](_0x528a01));}return BPromise[_0x511e('0x7e')](_0x4734d9);}})[_0x511e('0x1f')](function(){return _0x54b0d0;})['then'](respondWithResult(_0x5d8c56,null))['catch'](handleError(_0x5d8c56,null));};exports[_0x511e('0x7f')]=function(_0x476507,_0x2a0bff,_0x40d189){return db[_0x511e('0x29')][_0x511e('0x45')]({'where':{'id':_0x476507[_0x511e('0x43')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x2a0bff,null))[_0x511e('0x1f')](function(_0x43bb7b){if(_0x43bb7b){return _0x43bb7b[_0x511e('0x7f')](_0x476507[_0x511e('0x2f')][_0x511e('0x61')]);}})[_0x511e('0x1f')](function(_0x3d91d6){if(_0x3d91d6){return db[_0x511e('0x54')]['destroy']({'where':{'ListId':_0x476507[_0x511e('0x2f')][_0x511e('0x61')],'CampaignId':_0x476507[_0x511e('0x43')]['id']}})[_0x511e('0x1f')](function(){return _0x3d91d6;});}})[_0x511e('0x1f')](respondWithStatusCode(_0x2a0bff,null))[_0x511e('0x42')](handleError(_0x2a0bff,null));};exports[_0x511e('0x80')]=function(_0x10b412,_0x56e411,_0x39309a){var _0x48521b={'raw':!![],'where':{}};var _0x211ef1={};var _0x1a0715={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x10b412[_0x511e('0x43')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x56e411,null))[_0x511e('0x1f')](function(_0xd1b1d5){if(_0xd1b1d5){_0x211ef1[_0x511e('0x2d')]=_['keys'](db['CmList'][_0x511e('0x2a')]);_0x211ef1['query']=_[_0x511e('0x30')](_0x10b412[_0x511e('0x2f')]);_0x211ef1[_0x511e('0x31')]=_['intersection'](_0x211ef1[_0x511e('0x2d')],_0x211ef1['query']);_0x48521b[_0x511e('0x33')]=_['intersection'](_0x211ef1['model'],qs[_0x511e('0x34')](_0x10b412[_0x511e('0x2f')]['fields']));_0x48521b['attributes']=_0x48521b[_0x511e('0x33')][_0x511e('0x35')]?_0x48521b[_0x511e('0x33')]:_0x211ef1[_0x511e('0x2d')];if(!_0x10b412['query'][_0x511e('0x55')](_0x511e('0x59'))){_0x48521b[_0x511e('0x36')]=qs[_0x511e('0x36')](_0x10b412[_0x511e('0x2f')][_0x511e('0x36')]);_0x48521b[_0x511e('0x1a')]=qs[_0x511e('0x1a')](_0x10b412[_0x511e('0x2f')][_0x511e('0x1a')]);}_0x48521b[_0x511e('0x37')]=qs['sort'](_0x10b412['query'][_0x511e('0x38')]);_0x48521b[_0x511e('0x39')]=qs['filters'](_[_0x511e('0x3a')](_0x10b412[_0x511e('0x2f')],_0x211ef1[_0x511e('0x31')]));_0x48521b[_0x511e('0x39')][_0x511e('0x56')]=_0xd1b1d5['id'];if(_0x10b412[_0x511e('0x2f')][_0x511e('0x3b')]){_0x48521b[_0x511e('0x39')]=_[_0x511e('0x3c')](_0x48521b[_0x511e('0x39')],{'$or':_['map'](_0x48521b[_0x511e('0x33')],function(_0x22aa9d){var _0x372056={};_0x372056[_0x22aa9d]={'$like':'%'+_0x10b412['query'][_0x511e('0x3b')]+'%'};return _0x372056;})});}_0x48521b=_['merge']({},_0x48521b,_0x10b412[_0x511e('0x44')]);return db[_0x511e('0x5f')][_0x511e('0x19')]({'where':_0x48521b[_0x511e('0x39')]})[_0x511e('0x1f')](function(_0x51f581){_0x1a0715[_0x511e('0x19')]=_0x51f581;if(_0x10b412[_0x511e('0x2f')][_0x511e('0x3e')]){_0x48521b[_0x511e('0x3f')]=[{'all':!![]}];}return db[_0x511e('0x5f')][_0x511e('0x40')](_0x48521b);})[_0x511e('0x1f')](function(_0x230bed){_0x1a0715[_0x511e('0x41')]=_0x230bed;return _0x1a0715;});}})[_0x511e('0x1f')](respondWithFilteredResult(_0x56e411,_0x48521b))['catch'](handleError(_0x56e411,null));};exports[_0x511e('0x81')]=function(_0x1b1d55,_0x422f65,_0x415a2c){var _0x6155c5,_0x551327;return db[_0x511e('0x29')]['find']({'where':{'id':_0x1b1d55[_0x511e('0x43')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x422f65,null))[_0x511e('0x1f')](function(_0x58b87a){if(_0x58b87a){_0x551327=_0x58b87a;return _0x58b87a[_0x511e('0x81')](_0x1b1d55[_0x511e('0x47')]['ids'],_[_0x511e('0x4f')](_0x1b1d55['body'],[_0x511e('0x61'),'id'])||{});}return null;})[_0x511e('0x62')](function(_0x174c4b){var _0x3a89f8;_0x6155c5=_0x174c4b||[];var _0x10aa7c=[];if(_0x174c4b){for(var _0x34f475=0x0;_0x34f475<_0x174c4b[_0x511e('0x35')];_0x34f475+=0x1){var _0x2ea631=_0x174c4b[_0x34f475][_0x511e('0x21')]({'plain':!![]});_0x3a89f8=squel[_0x511e('0x65')]()['into'](_0x511e('0x82'))[_0x511e('0x67')]([_0x511e('0x68'),_0x511e('0x6d'),_0x511e('0x69'),'CampaignId',_0x511e('0x6a'),_0x511e('0x50')],squel[_0x511e('0x79')]()['field'](_0x511e('0x68'),'phone')[_0x511e('0x6b')]('id',_0x511e('0x6d'))[_0x511e('0x6b')](_0x2ea631[_0x511e('0x6e')]['toString'](),'ListId')['field'](_0x1b1d55[_0x511e('0x43')]['id'][_0x511e('0x6f')](),_0x511e('0x56'))['field'](_0x511e('0x6c'),_0x511e('0x6a'))['field'](_0x511e('0x6c'),_0x511e('0x50'))[_0x511e('0x75')](_0x511e('0x7a'))['where'](_0x511e('0x70'))['where'](_0x511e('0x7b'),_0x2ea631[_0x511e('0x6e')][_0x511e('0x6f')]())[_0x511e('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0x511e('0x6f')]();_0x10aa7c[_0x511e('0x7c')](db['sequelize'][_0x511e('0x2f')](_0x3a89f8));}return BPromise[_0x511e('0x7e')](_0x10aa7c);}})['then'](function(){return _0x6155c5;})[_0x511e('0x1f')](respondWithResult(_0x422f65,null))[_0x511e('0x42')](handleError(_0x422f65,null));};exports[_0x511e('0x83')]=function(_0x59f0a2,_0x5aecac,_0x148861){return db[_0x511e('0x29')][_0x511e('0x45')]({'where':{'id':_0x59f0a2[_0x511e('0x43')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x5aecac,null))['then'](function(_0x33b68c){if(_0x33b68c){return _0x33b68c[_0x511e('0x83')](_0x59f0a2[_0x511e('0x2f')][_0x511e('0x61')]);}})[_0x511e('0x1f')](function(_0x1f5ceb){if(_0x1f5ceb){return db[_0x511e('0x5d')]['destroy']({'where':{'ListId':_0x59f0a2['query'][_0x511e('0x61')],'CampaignId':_0x59f0a2['params']['id']}})[_0x511e('0x1f')](function(){return _0x1f5ceb;});}})[_0x511e('0x1f')](respondWithStatusCode(_0x5aecac,null))['catch'](handleError(_0x5aecac,null));}; \ No newline at end of file +var _0xd90a=['getBlackLists','spread','cm_hopper_black','removeBlackLists','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','stack','map','Campaign','rawAttributes','fieldName','type','key','model','name','keys','query','attributes','fields','length','nolimit','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','clone','params','omit','createdAt','updatedAt','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','findOne','CmHopper','intersection','hasOwnProperty','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','CmList','getLists','addLists','ids','dialCheckDuplicateType','always','insert','fromQuery','scheduledAt','select','field','phone','NOW()','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','into','ContactId','CmListId','deletedAt\x20IS\x20NULL','ListId','push','sequelize','all','removeLists'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd90a,0x89));var _0xad90=function(_0x29d335,_0x4de1d9){_0x29d335=_0x29d335-0x0;var _0x409c22=_0xd90a[_0x29d335];return _0x409c22;};'use strict';var pdf=require(_0xad90('0x0'));var emlformat=require(_0xad90('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xad90('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xad90('0x3'));var BPromise=require(_0xad90('0x4'));var Mustache=require(_0xad90('0x5'));var util=require(_0xad90('0x6'));var path=require(_0xad90('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xad90('0x8'));var fs=require('fs');var _=require(_0xad90('0x9'));var squel=require(_0xad90('0xa'));var crypto=require('crypto');var jsforce=require(_0xad90('0xb'));var deskjs=require(_0xad90('0xc'));var toCsv=require('to-csv');var querystring=require(_0xad90('0xd'));var Papa=require(_0xad90('0xe'));var Redis=require(_0xad90('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad90('0x10'));var logger=require(_0xad90('0x11'))(_0xad90('0x12'));var utils=require(_0xad90('0x13'));var config=require(_0xad90('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f4853,_0x74acdb){_0x74acdb=_0x74acdb||0xcc;return function(_0x2825a4){if(_0x2825a4){return _0x3f4853['sendStatus'](_0x74acdb);}return _0x3f4853[_0xad90('0x15')](_0x74acdb)[_0xad90('0x16')]();};}function respondWithResult(_0x2d46dd,_0x2d74e5){_0x2d74e5=_0x2d74e5||0xc8;return function(_0xa9b4fa){if(_0xa9b4fa){return _0x2d46dd[_0xad90('0x15')](_0x2d74e5)['json'](_0xa9b4fa);}};}function respondWithFilteredResult(_0x452837,_0x59c1f7){return function(_0x3f3775){if(_0x3f3775){var _0x2f01e3=_0x3f3775[_0xad90('0x17')],_0x176152=_0x59c1f7['offset'],_0x5165c0=_0x59c1f7[_0xad90('0x18')]+_0x59c1f7['limit'],_0x1b1e1e;if(_0x5165c0>=_0x2f01e3){_0x5165c0=_0x2f01e3;_0x1b1e1e=0xc8;}else{_0x1b1e1e=0xce;}_0x452837[_0xad90('0x15')](_0x1b1e1e);return _0x452837[_0xad90('0x19')](_0xad90('0x1a'),_0x176152+'-'+_0x5165c0+'/'+_0x2f01e3)[_0xad90('0x1b')](_0x3f3775);}return null;};}function patchUpdates(_0x3cab22){return function(_0x1f246b){try{jsonpatch[_0xad90('0x1c')](_0x1f246b,_0x3cab22,!![]);}catch(_0xece58d){return BPromise[_0xad90('0x1d')](_0xece58d);}return _0x1f246b[_0xad90('0x1e')]();};}function saveUpdates(_0x52da1e,_0x85cf8e){return function(_0x22231c){if(_0x22231c){return _0x22231c['update'](_0x52da1e)[_0xad90('0x1f')](function(_0x562932){return _0x562932;});}return null;};}function removeEntity(_0x18da8c,_0x3cb90a){return function(_0x33efb5){if(_0x33efb5){return _0x33efb5[_0xad90('0x20')]()[_0xad90('0x1f')](function(){var _0x8eac7f=_0x33efb5[_0xad90('0x21')]({'plain':!![]});var _0x579b95=_0xad90('0x22');return db[_0xad90('0x23')][_0xad90('0x20')]({'where':{'type':_0x579b95,'resourceId':_0x8eac7f['id']}})[_0xad90('0x1f')](function(){return _0x33efb5;});})[_0xad90('0x1f')](function(){_0x18da8c[_0xad90('0x15')](0xcc)[_0xad90('0x16')]();});}};}function handleEntityNotFound(_0x3d3f76,_0x14e8b6){return function(_0x27ac78){if(!_0x27ac78){_0x3d3f76[_0xad90('0x24')](0x194);}return _0x27ac78;};}function handleError(_0x2f95cb,_0x5811e5){_0x5811e5=_0x5811e5||0x1f4;return function(_0x35bf74){logger['error'](_0x35bf74[_0xad90('0x25')]);if(_0x35bf74['name']){delete _0x35bf74['name'];}_0x2f95cb[_0xad90('0x15')](_0x5811e5)['send'](_0x35bf74);};}exports['index']=function(_0x243221,_0x1129de){var _0x5a84ce={},_0x231cce={},_0x4998c6={'count':0x0,'rows':[]};var _0x22128e=_[_0xad90('0x26')](db[_0xad90('0x27')][_0xad90('0x28')],function(_0x47e425){return{'name':_0x47e425[_0xad90('0x29')],'type':_0x47e425[_0xad90('0x2a')][_0xad90('0x2b')]};});_0x231cce[_0xad90('0x2c')]=_[_0xad90('0x26')](_0x22128e,_0xad90('0x2d'));_0x231cce['query']=_[_0xad90('0x2e')](_0x243221[_0xad90('0x2f')]);_0x231cce['filters']=_['intersection'](_0x231cce[_0xad90('0x2c')],_0x231cce[_0xad90('0x2f')]);_0x5a84ce[_0xad90('0x30')]=_['intersection'](_0x231cce[_0xad90('0x2c')],qs['fields'](_0x243221[_0xad90('0x2f')][_0xad90('0x31')]));_0x5a84ce[_0xad90('0x30')]=_0x5a84ce[_0xad90('0x30')][_0xad90('0x32')]?_0x5a84ce[_0xad90('0x30')]:_0x231cce[_0xad90('0x2c')];if(!_0x243221['query']['hasOwnProperty'](_0xad90('0x33'))){_0x5a84ce['limit']=qs[_0xad90('0x34')](_0x243221[_0xad90('0x2f')][_0xad90('0x34')]);_0x5a84ce[_0xad90('0x18')]=qs[_0xad90('0x18')](_0x243221[_0xad90('0x2f')][_0xad90('0x18')]);}_0x5a84ce[_0xad90('0x35')]=qs[_0xad90('0x36')](_0x243221[_0xad90('0x2f')][_0xad90('0x36')]);_0x5a84ce[_0xad90('0x37')]=qs['filters'](_[_0xad90('0x38')](_0x243221[_0xad90('0x2f')],_0x231cce[_0xad90('0x39')]),_0x22128e);if(_0x243221[_0xad90('0x2f')][_0xad90('0x3a')]){_0x5a84ce[_0xad90('0x37')]=_[_0xad90('0x3b')](_0x5a84ce[_0xad90('0x37')],{'$or':_['map'](_0x22128e,function(_0x5c3884){if(_0x5c3884['type']!==_0xad90('0x3c')){var _0x130e55={};_0x130e55[_0x5c3884[_0xad90('0x2d')]]={'$like':'%'+_0x243221['query'][_0xad90('0x3a')]+'%'};return _0x130e55;}})});}_0x5a84ce=_[_0xad90('0x3b')]({},_0x5a84ce,_0x243221[_0xad90('0x3d')]);var _0x560a42={'where':_0x5a84ce['where']};return db['Campaign'][_0xad90('0x17')](_0x560a42)[_0xad90('0x1f')](function(_0x594614){_0x4998c6[_0xad90('0x17')]=_0x594614;if(_0x243221[_0xad90('0x2f')][_0xad90('0x3e')]){_0x5a84ce[_0xad90('0x3f')]=[{'all':!![]}];}return db['Campaign'][_0xad90('0x40')](_0x5a84ce);})[_0xad90('0x1f')](function(_0x572be7){_0x4998c6[_0xad90('0x41')]=_0x572be7;return _0x4998c6;})[_0xad90('0x1f')](respondWithFilteredResult(_0x1129de,_0x5a84ce))[_0xad90('0x42')](handleError(_0x1129de,null));};exports[_0xad90('0x43')]=function(_0x233726,_0x15c4e6){var _0x3ed499={'raw':![],'where':{'id':_0x233726['params']['id']}},_0x3fe477={};_0x3fe477['model']=_['keys'](db[_0xad90('0x27')][_0xad90('0x28')]);_0x3fe477[_0xad90('0x2f')]=_[_0xad90('0x2e')](_0x233726[_0xad90('0x2f')]);_0x3fe477[_0xad90('0x39')]=_['intersection'](_0x3fe477['model'],_0x3fe477[_0xad90('0x2f')]);_0x3ed499[_0xad90('0x30')]=_['intersection'](_0x3fe477[_0xad90('0x2c')],qs['fields'](_0x233726[_0xad90('0x2f')][_0xad90('0x31')]));_0x3ed499[_0xad90('0x30')]=_0x3ed499['attributes']['length']?_0x3ed499[_0xad90('0x30')]:_0x3fe477[_0xad90('0x2c')];if(_0x233726[_0xad90('0x2f')][_0xad90('0x3e')]){_0x3ed499[_0xad90('0x3f')]=[{'all':!![]}];}_0x3ed499=_['merge']({},_0x3ed499,_0x233726['options']);return db['Campaign'][_0xad90('0x44')](_0x3ed499)[_0xad90('0x1f')](handleEntityNotFound(_0x15c4e6,null))[_0xad90('0x1f')](respondWithResult(_0x15c4e6,null))[_0xad90('0x42')](handleError(_0x15c4e6,null));};exports[_0xad90('0x45')]=function(_0x4981b2,_0x33b615){return db[_0xad90('0x27')]['create'](_0x4981b2[_0xad90('0x46')],{})['then'](function(_0x314b7a){var _0x415e53=_0x4981b2[_0xad90('0x47')][_0xad90('0x21')]({'plain':!![]});if(!_0x415e53)throw new Error(_0xad90('0x48'));if(_0x415e53[_0xad90('0x49')]===_0xad90('0x47')){var _0x52c0e6=_0x314b7a[_0xad90('0x21')]({'plain':!![]});var _0xeef16d=_0xad90('0x22');return db[_0xad90('0x4a')][_0xad90('0x44')]({'where':{'name':_0xeef16d,'userProfileId':_0x415e53[_0xad90('0x4b')]},'raw':!![]})['then'](function(_0x669d2a){if(_0x669d2a&&_0x669d2a['autoAssociation']===0x0){return db[_0xad90('0x23')][_0xad90('0x45')]({'name':_0x52c0e6['name'],'resourceId':_0x52c0e6['id'],'type':_0x669d2a['name'],'sectionId':_0x669d2a['id']},{})[_0xad90('0x1f')](function(){return _0x314b7a;});}else{return _0x314b7a;}})[_0xad90('0x42')](function(_0x5ddbf0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ddbf0);throw _0x5ddbf0;});}return _0x314b7a;})[_0xad90('0x1f')](respondWithResult(_0x33b615,0xc9))[_0xad90('0x42')](handleError(_0x33b615,null));};exports[_0xad90('0x4c')]=function(_0x23c304,_0x327d9c){var _0x47feda={'where':{'id':_0x23c304[_0xad90('0x4d')]['id']}},_0x498262={};_0x498262['model']=_['keys'](db[_0xad90('0x27')][_0xad90('0x28')]);_0x47feda[_0xad90('0x30')]=_['intersection'](_0x498262[_0xad90('0x2c')],qs[_0xad90('0x31')](_0x23c304[_0xad90('0x2f')]['fields']));_0x47feda[_0xad90('0x30')]=_0x47feda[_0xad90('0x30')][_0xad90('0x32')]?_0x47feda[_0xad90('0x30')]:_0x498262['model'];if(_0x23c304[_0xad90('0x2f')]['includeAll']){_0x47feda[_0xad90('0x3f')]=[{'all':!![]}];}_0x47feda=_[_0xad90('0x3b')]({},_0x47feda,_0x23c304[_0xad90('0x3d')]);return db[_0xad90('0x27')][_0xad90('0x44')](_0x47feda)[_0xad90('0x1f')](handleEntityNotFound(_0x327d9c,null))[_0xad90('0x1f')](function(_0x591404){if(_0x591404){var _0x19c51c=_0x591404[_0xad90('0x21')]({'plain':!![]});_0x19c51c=qs[_0xad90('0x4e')](_0x19c51c,['id',_0xad90('0x4f'),_0xad90('0x50')]);_0x23c304['body']=_['omit'](_0x23c304[_0xad90('0x46')],['id',_0xad90('0x4f'),_0xad90('0x50')]);return db[_0xad90('0x27')][_0xad90('0x45')](_[_0xad90('0x3b')](_0x19c51c,_0x23c304[_0xad90('0x46')]),{'include':_0x23c304[_0xad90('0x2f')][_0xad90('0x3e')]?[{'all':!![]}]:undefined})[_0xad90('0x1f')](function(_0x1ac77e){var _0x59c7ef=_0x23c304[_0xad90('0x47')][_0xad90('0x21')]({'plain':!![]});if(!_0x59c7ef)throw new Error(_0xad90('0x48'));if(_0x59c7ef[_0xad90('0x49')]===_0xad90('0x47')){var _0x3600ef=_0x1ac77e[_0xad90('0x21')]({'plain':!![]});var _0x20fddb=_0xad90('0x22');return db[_0xad90('0x4a')][_0xad90('0x44')]({'where':{'name':_0x20fddb,'userProfileId':_0x59c7ef[_0xad90('0x4b')]},'raw':!![]})[_0xad90('0x1f')](function(_0x253264){if(_0x253264&&_0x253264[_0xad90('0x51')]===0x0){return db[_0xad90('0x23')][_0xad90('0x45')]({'name':_0x3600ef['name'],'resourceId':_0x3600ef['id'],'type':_0x253264['name'],'sectionId':_0x253264['id']},{})[_0xad90('0x1f')](function(){return _0x1ac77e;});}else{return _0x1ac77e;}})[_0xad90('0x42')](function(_0x125275){logger[_0xad90('0x52')](_0xad90('0x53'),_0x125275);throw _0x125275;});}return _0x1ac77e;});}})[_0xad90('0x1f')](respondWithResult(_0x327d9c,0xc9))[_0xad90('0x42')](handleError(_0x327d9c,null));};exports[_0xad90('0x54')]=function(_0x44bc15,_0xf33f25){if(_0x44bc15[_0xad90('0x46')]['id']){delete _0x44bc15['body']['id'];}return db[_0xad90('0x27')][_0xad90('0x44')]({'where':{'id':_0x44bc15[_0xad90('0x4d')]['id']}})[_0xad90('0x1f')](handleEntityNotFound(_0xf33f25,null))[_0xad90('0x1f')](saveUpdates(_0x44bc15[_0xad90('0x46')],null))[_0xad90('0x1f')](respondWithResult(_0xf33f25,null))['catch'](handleError(_0xf33f25,null));};exports[_0xad90('0x20')]=function(_0x2b2d0a,_0x223d8a){return db[_0xad90('0x27')][_0xad90('0x44')]({'where':{'id':_0x2b2d0a[_0xad90('0x4d')]['id']}})[_0xad90('0x1f')](handleEntityNotFound(_0x223d8a,null))[_0xad90('0x1f')](removeEntity(_0x223d8a,null))[_0xad90('0x42')](handleError(_0x223d8a,null));};exports[_0xad90('0x55')]=function(_0x4fcfee,_0x22afbb,_0x51ed54){var _0x20e86c={'raw':!![],'where':{}};var _0x795afe={};var _0x3dba32={'count':0x0,'rows':[]};return db['Campaign'][_0xad90('0x56')]({'where':{'id':_0x4fcfee[_0xad90('0x4d')]['id']}})[_0xad90('0x1f')](handleEntityNotFound(_0x22afbb,null))[_0xad90('0x1f')](function(_0x22b4df){if(_0x22b4df){_0x795afe[_0xad90('0x2c')]=_[_0xad90('0x2e')](db[_0xad90('0x57')]['rawAttributes']);_0x795afe[_0xad90('0x2f')]=_[_0xad90('0x2e')](_0x4fcfee['query']);_0x795afe['filters']=_[_0xad90('0x58')](_0x795afe[_0xad90('0x2c')],_0x795afe[_0xad90('0x2f')]);_0x20e86c[_0xad90('0x30')]=_[_0xad90('0x58')](_0x795afe[_0xad90('0x2c')],qs[_0xad90('0x31')](_0x4fcfee[_0xad90('0x2f')][_0xad90('0x31')]));_0x20e86c[_0xad90('0x30')]=_0x20e86c[_0xad90('0x30')][_0xad90('0x32')]?_0x20e86c[_0xad90('0x30')]:_0x795afe[_0xad90('0x2c')];if(!_0x4fcfee[_0xad90('0x2f')][_0xad90('0x59')](_0xad90('0x33'))){_0x20e86c[_0xad90('0x34')]=qs[_0xad90('0x34')](_0x4fcfee[_0xad90('0x2f')][_0xad90('0x34')]);_0x20e86c[_0xad90('0x18')]=qs[_0xad90('0x18')](_0x4fcfee[_0xad90('0x2f')][_0xad90('0x18')]);}_0x20e86c[_0xad90('0x35')]=qs['sort'](_0x4fcfee['query'][_0xad90('0x36')]);_0x20e86c[_0xad90('0x37')]=qs[_0xad90('0x39')](_['pick'](_0x4fcfee[_0xad90('0x2f')],_0x795afe['filters']));_0x20e86c[_0xad90('0x37')][_0xad90('0x5a')]=_0x22b4df['id'];if(_0x4fcfee[_0xad90('0x2f')]['filter']){_0x20e86c[_0xad90('0x37')]=_['merge'](_0x20e86c[_0xad90('0x37')],{'$or':_[_0xad90('0x26')](_0x20e86c[_0xad90('0x30')],function(_0x276b49){var _0x1ae9a7={};_0x1ae9a7[_0x276b49]={'$like':'%'+_0x4fcfee['query']['filter']+'%'};return _0x1ae9a7;})});}_0x20e86c=_[_0xad90('0x3b')]({},_0x20e86c,_0x4fcfee['options']);return db[_0xad90('0x57')][_0xad90('0x17')]({'where':_0x20e86c[_0xad90('0x37')]})['then'](function(_0x3e7a4d){_0x3dba32[_0xad90('0x17')]=_0x3e7a4d;if(_0x4fcfee['query']['includeAll']){_0x20e86c[_0xad90('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0xad90('0x40')](_0x20e86c);})[_0xad90('0x1f')](function(_0x4d941c){_0x3dba32[_0xad90('0x41')]=_0x4d941c;return _0x3dba32;});}})[_0xad90('0x1f')](respondWithFilteredResult(_0x22afbb,_0x20e86c))['catch'](handleError(_0x22afbb,null));};exports[_0xad90('0x5b')]=function(_0x250463,_0x47c24a,_0x4006be){var _0x1259be={'raw':!![],'where':{}};var _0x2b81a7={};var _0x1486f0={'count':0x0,'rows':[]};return db[_0xad90('0x27')][_0xad90('0x56')]({'where':{'id':_0x250463[_0xad90('0x4d')]['id']}})[_0xad90('0x1f')](handleEntityNotFound(_0x47c24a,null))['then'](function(_0x310ac2){if(_0x310ac2){_0x2b81a7[_0xad90('0x2c')]=_['keys'](db[_0xad90('0x5c')]['rawAttributes']);_0x2b81a7[_0xad90('0x2f')]=_['keys'](_0x250463[_0xad90('0x2f')]);_0x2b81a7[_0xad90('0x39')]=_['intersection'](_0x2b81a7[_0xad90('0x2c')],_0x2b81a7[_0xad90('0x2f')]);_0x1259be[_0xad90('0x30')]=_[_0xad90('0x58')](_0x2b81a7[_0xad90('0x2c')],qs['fields'](_0x250463[_0xad90('0x2f')][_0xad90('0x31')]));_0x1259be[_0xad90('0x30')]=_0x1259be[_0xad90('0x30')][_0xad90('0x32')]?_0x1259be[_0xad90('0x30')]:_0x2b81a7[_0xad90('0x2c')];if(!_0x250463[_0xad90('0x2f')]['hasOwnProperty'](_0xad90('0x33'))){_0x1259be[_0xad90('0x34')]=qs[_0xad90('0x34')](_0x250463[_0xad90('0x2f')][_0xad90('0x34')]);_0x1259be[_0xad90('0x18')]=qs['offset'](_0x250463[_0xad90('0x2f')][_0xad90('0x18')]);}_0x1259be[_0xad90('0x35')]=qs[_0xad90('0x36')](_0x250463[_0xad90('0x2f')]['sort']);_0x1259be[_0xad90('0x37')]=qs['filters'](_[_0xad90('0x38')](_0x250463[_0xad90('0x2f')],_0x2b81a7[_0xad90('0x39')]));_0x1259be[_0xad90('0x37')][_0xad90('0x5a')]=_0x310ac2['id'];if(_0x250463[_0xad90('0x2f')]['filter']){_0x1259be[_0xad90('0x37')]=_[_0xad90('0x3b')](_0x1259be['where'],{'$or':_[_0xad90('0x26')](_0x1259be[_0xad90('0x30')],function(_0x2c52f3){var _0x259287={};_0x259287[_0x2c52f3]={'$like':'%'+_0x250463[_0xad90('0x2f')][_0xad90('0x3a')]+'%'};return _0x259287;})});}_0x1259be=_[_0xad90('0x3b')]({},_0x1259be,_0x250463[_0xad90('0x3d')]);return db[_0xad90('0x5c')][_0xad90('0x17')]({'where':_0x1259be[_0xad90('0x37')]})[_0xad90('0x1f')](function(_0x4d6bd2){_0x1486f0[_0xad90('0x17')]=_0x4d6bd2;if(_0x250463[_0xad90('0x2f')]['includeAll']){_0x1259be[_0xad90('0x3f')]=[{'all':!![]}];}return db[_0xad90('0x5c')][_0xad90('0x40')](_0x1259be);})['then'](function(_0x28575d){_0x1486f0[_0xad90('0x41')]=_0x28575d;return _0x1486f0;});}})['then'](respondWithFilteredResult(_0x47c24a,_0x1259be))[_0xad90('0x42')](handleError(_0x47c24a,null));};exports[_0xad90('0x5d')]=function(_0x1b46d2,_0xb36ff0,_0x25a43e){var _0x182557={'raw':!![],'where':{}};var _0x32242a={};var _0x36d54c={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x1b46d2[_0xad90('0x4d')]['id']}})[_0xad90('0x1f')](handleEntityNotFound(_0xb36ff0,null))[_0xad90('0x1f')](function(_0x1285e5){if(_0x1285e5){_0x32242a[_0xad90('0x2c')]=_[_0xad90('0x2e')](db[_0xad90('0x5e')][_0xad90('0x28')]);_0x32242a['query']=_[_0xad90('0x2e')](_0x1b46d2[_0xad90('0x2f')]);_0x32242a[_0xad90('0x39')]=_['intersection'](_0x32242a['model'],_0x32242a[_0xad90('0x2f')]);_0x182557['attributes']=_[_0xad90('0x58')](_0x32242a[_0xad90('0x2c')],qs[_0xad90('0x31')](_0x1b46d2[_0xad90('0x2f')][_0xad90('0x31')]));_0x182557[_0xad90('0x30')]=_0x182557[_0xad90('0x30')]['length']?_0x182557[_0xad90('0x30')]:_0x32242a[_0xad90('0x2c')];if(!_0x1b46d2[_0xad90('0x2f')][_0xad90('0x59')]('nolimit')){_0x182557[_0xad90('0x34')]=qs['limit'](_0x1b46d2[_0xad90('0x2f')][_0xad90('0x34')]);_0x182557[_0xad90('0x18')]=qs[_0xad90('0x18')](_0x1b46d2[_0xad90('0x2f')][_0xad90('0x18')]);}_0x182557['order']=qs['sort'](_0x1b46d2[_0xad90('0x2f')][_0xad90('0x36')]);_0x182557['where']=qs[_0xad90('0x39')](_[_0xad90('0x38')](_0x1b46d2[_0xad90('0x2f')],_0x32242a[_0xad90('0x39')]));_0x182557[_0xad90('0x37')]['CampaignId']=_0x1285e5['id'];if(_0x1b46d2[_0xad90('0x2f')]['filter']){_0x182557['where']=_[_0xad90('0x3b')](_0x182557[_0xad90('0x37')],{'$or':_['map'](_0x182557[_0xad90('0x30')],function(_0x5c7d35){var _0x32a2f1={};_0x32a2f1[_0x5c7d35]={'$like':'%'+_0x1b46d2[_0xad90('0x2f')][_0xad90('0x3a')]+'%'};return _0x32a2f1;})});}_0x182557=_[_0xad90('0x3b')]({},_0x182557,_0x1b46d2[_0xad90('0x3d')]);return db[_0xad90('0x5e')][_0xad90('0x17')]({'where':_0x182557[_0xad90('0x37')]})[_0xad90('0x1f')](function(_0x2804f4){_0x36d54c['count']=_0x2804f4;if(_0x1b46d2[_0xad90('0x2f')][_0xad90('0x3e')]){_0x182557[_0xad90('0x3f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xad90('0x40')](_0x182557);})[_0xad90('0x1f')](function(_0x13ecc5){_0x36d54c[_0xad90('0x41')]=_0x13ecc5;return _0x36d54c;});}})[_0xad90('0x1f')](respondWithFilteredResult(_0xb36ff0,_0x182557))[_0xad90('0x42')](handleError(_0xb36ff0,null));};exports['getHopperBlacks']=function(_0x457ea6,_0xd76b81,_0x3728ac){var _0x361c35={'raw':!![],'where':{}};var _0x5bead5={};var _0x4a87b8={'count':0x0,'rows':[]};return db[_0xad90('0x27')][_0xad90('0x56')]({'where':{'id':_0x457ea6[_0xad90('0x4d')]['id']}})[_0xad90('0x1f')](handleEntityNotFound(_0xd76b81,null))[_0xad90('0x1f')](function(_0x155cdd){if(_0x155cdd){_0x5bead5[_0xad90('0x2c')]=_['keys'](db[_0xad90('0x5f')]['rawAttributes']);_0x5bead5['query']=_['keys'](_0x457ea6[_0xad90('0x2f')]);_0x5bead5[_0xad90('0x39')]=_['intersection'](_0x5bead5['model'],_0x5bead5[_0xad90('0x2f')]);_0x361c35[_0xad90('0x30')]=_[_0xad90('0x58')](_0x5bead5['model'],qs[_0xad90('0x31')](_0x457ea6[_0xad90('0x2f')][_0xad90('0x31')]));_0x361c35[_0xad90('0x30')]=_0x361c35[_0xad90('0x30')][_0xad90('0x32')]?_0x361c35[_0xad90('0x30')]:_0x5bead5[_0xad90('0x2c')];if(!_0x457ea6['query'][_0xad90('0x59')]('nolimit')){_0x361c35[_0xad90('0x34')]=qs['limit'](_0x457ea6[_0xad90('0x2f')]['limit']);_0x361c35[_0xad90('0x18')]=qs[_0xad90('0x18')](_0x457ea6[_0xad90('0x2f')][_0xad90('0x18')]);}_0x361c35['order']=qs['sort'](_0x457ea6[_0xad90('0x2f')][_0xad90('0x36')]);_0x361c35['where']=qs['filters'](_[_0xad90('0x38')](_0x457ea6[_0xad90('0x2f')],_0x5bead5[_0xad90('0x39')]));_0x361c35[_0xad90('0x37')][_0xad90('0x5a')]=_0x155cdd['id'];if(_0x457ea6[_0xad90('0x2f')][_0xad90('0x3a')]){_0x361c35[_0xad90('0x37')]=_[_0xad90('0x3b')](_0x361c35[_0xad90('0x37')],{'$or':_[_0xad90('0x26')](_0x361c35[_0xad90('0x30')],function(_0x2d6381){var _0x405944={};_0x405944[_0x2d6381]={'$like':'%'+_0x457ea6[_0xad90('0x2f')][_0xad90('0x3a')]+'%'};return _0x405944;})});}_0x361c35=_[_0xad90('0x3b')]({},_0x361c35,_0x457ea6[_0xad90('0x3d')]);return db[_0xad90('0x5f')][_0xad90('0x17')]({'where':_0x361c35[_0xad90('0x37')]})[_0xad90('0x1f')](function(_0xf85027){_0x4a87b8[_0xad90('0x17')]=_0xf85027;if(_0x457ea6[_0xad90('0x2f')][_0xad90('0x3e')]){_0x361c35[_0xad90('0x3f')]=[{'all':!![]}];}return db[_0xad90('0x5f')]['findAll'](_0x361c35);})[_0xad90('0x1f')](function(_0x5a86fe){_0x4a87b8['rows']=_0x5a86fe;return _0x4a87b8;});}})['then'](respondWithFilteredResult(_0xd76b81,_0x361c35))[_0xad90('0x42')](handleError(_0xd76b81,null));};exports['getLists']=function(_0x554dce,_0x1c13dd,_0x2497e1){var _0x1762db={};var _0x4ecb1d={};var _0x3c9153;var _0x185285;return db['Campaign']['findOne']({'where':{'id':_0x554dce[_0xad90('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1c13dd,null))[_0xad90('0x1f')](function(_0x596bed){if(_0x596bed){_0x3c9153=_0x596bed;_0x4ecb1d[_0xad90('0x2c')]=_['keys'](db[_0xad90('0x60')][_0xad90('0x28')]);_0x4ecb1d[_0xad90('0x2f')]=_[_0xad90('0x2e')](_0x554dce[_0xad90('0x2f')]);_0x4ecb1d['filters']=_[_0xad90('0x58')](_0x4ecb1d['model'],_0x4ecb1d[_0xad90('0x2f')]);_0x1762db['attributes']=_[_0xad90('0x58')](_0x4ecb1d[_0xad90('0x2c')],qs[_0xad90('0x31')](_0x554dce[_0xad90('0x2f')][_0xad90('0x31')]));_0x1762db[_0xad90('0x30')]=_0x1762db[_0xad90('0x30')][_0xad90('0x32')]?_0x1762db[_0xad90('0x30')]:_0x4ecb1d[_0xad90('0x2c')];_0x1762db[_0xad90('0x35')]=qs[_0xad90('0x36')](_0x554dce[_0xad90('0x2f')][_0xad90('0x36')]);_0x1762db[_0xad90('0x37')]=qs[_0xad90('0x39')](_[_0xad90('0x38')](_0x554dce[_0xad90('0x2f')],_0x4ecb1d[_0xad90('0x39')]));if(_0x554dce[_0xad90('0x2f')][_0xad90('0x3a')]){_0x1762db[_0xad90('0x37')]=_['merge'](_0x1762db[_0xad90('0x37')],{'$or':_[_0xad90('0x26')](_0x1762db[_0xad90('0x30')],function(_0x57f67d){var _0x5646fa={};_0x5646fa[_0x57f67d]={'$like':'%'+_0x554dce[_0xad90('0x2f')][_0xad90('0x3a')]+'%'};return _0x5646fa;})});}_0x1762db=_[_0xad90('0x3b')]({},_0x1762db,_0x554dce[_0xad90('0x3d')]);return _0x3c9153[_0xad90('0x61')](_0x1762db);}})[_0xad90('0x1f')](function(_0x1bf8da){if(_0x1bf8da){_0x185285=_0x1bf8da[_0xad90('0x32')];if(!_0x554dce[_0xad90('0x2f')][_0xad90('0x59')](_0xad90('0x33'))){_0x1762db[_0xad90('0x34')]=qs[_0xad90('0x34')](_0x554dce[_0xad90('0x2f')][_0xad90('0x34')]);_0x1762db[_0xad90('0x18')]=qs[_0xad90('0x18')](_0x554dce[_0xad90('0x2f')][_0xad90('0x18')]);}return _0x3c9153[_0xad90('0x61')](_0x1762db);}})[_0xad90('0x1f')](function(_0x436715){if(_0x436715){return _0x436715?{'count':_0x185285,'rows':_0x436715}:null;}})[_0xad90('0x1f')](respondWithResult(_0x1c13dd,null))[_0xad90('0x42')](handleError(_0x1c13dd,null));};exports[_0xad90('0x62')]=function(_0x552b85,_0x27261e,_0x3e7a0d){var _0x2148c0,_0x32bdd1;return db['Campaign'][_0xad90('0x44')]({'where':{'id':_0x552b85[_0xad90('0x4d')]['id']}})['then'](handleEntityNotFound(_0x27261e,null))[_0xad90('0x1f')](function(_0x35f8d0){if(_0x35f8d0){_0x32bdd1=_0x35f8d0;return _0x35f8d0[_0xad90('0x62')](_0x552b85[_0xad90('0x46')]['ids'],_[_0xad90('0x4e')](_0x552b85[_0xad90('0x46')],[_0xad90('0x63'),'id'])||{});}return null;})['spread'](function(_0x783a90){var _0x3e2d2a;_0x2148c0=_0x783a90||[];var _0x1a3dbd=[];if(_0x783a90){for(var _0xa659cf=0x0;_0xa659cf<_0x783a90[_0xad90('0x32')];_0xa659cf+=0x1){var _0x2d2206=_0x783a90[_0xa659cf][_0xad90('0x21')]({'plain':!![]});_0x32bdd1['dialCheckDuplicateType']=_0x552b85['body']['dialCheckDuplicateType']?_0x552b85[_0xad90('0x46')]['dialCheckDuplicateType']:_0x32bdd1[_0xad90('0x64')];switch(_0x32bdd1[_0xad90('0x64')]){case _0xad90('0x65'):_0x3e2d2a=squel[_0xad90('0x66')]()['into']('cm_hopper')[_0xad90('0x67')](['phone',_0xad90('0x68'),'ContactId','ListId',_0xad90('0x5a'),_0xad90('0x4f'),'updatedAt'],squel[_0xad90('0x69')]()[_0xad90('0x6a')](_0xad90('0x6b'),_0xad90('0x6b'))['field'](_0xad90('0x6c'),_0xad90('0x68'))['field']('id','ContactId')[_0xad90('0x6a')](_0x2d2206['CmListId'][_0xad90('0x6d')](),'ListId')[_0xad90('0x6a')](_0x552b85[_0xad90('0x4d')]['id'][_0xad90('0x6d')](),_0xad90('0x5a'))[_0xad90('0x6a')](_0xad90('0x6c'),_0xad90('0x4f'))[_0xad90('0x6a')](_0xad90('0x6c'),'updatedAt')[_0xad90('0x6e')](_0xad90('0x6f'))[_0xad90('0x37')]('deletedAt\x20IS\x20NULL')[_0xad90('0x37')](_0xad90('0x70'),_0x2d2206['CmListId'][_0xad90('0x6d')]())[_0xad90('0x37')](_0xad90('0x71'))['where'](_0xad90('0x72'),squel[_0xad90('0x69')]()[_0xad90('0x6a')]('COALESCE(calleridnum,\x27\x27)')[_0xad90('0x6e')](_0xad90('0x73'))[_0xad90('0x37')](_0xad90('0x74'),_0x552b85[_0xad90('0x4d')]['id'][_0xad90('0x6d')]()))[_0xad90('0x37')](_0xad90('0x72'),squel['select']()['field'](_0xad90('0x75'))[_0xad90('0x6e')](_0xad90('0x76'))[_0xad90('0x37')](_0xad90('0x74'),_0x552b85[_0xad90('0x4d')]['id'][_0xad90('0x6d')]())))['toString']();break;case _0xad90('0x77'):_0x3e2d2a=squel[_0xad90('0x66')]()[_0xad90('0x78')](_0xad90('0x76'))[_0xad90('0x67')]([_0xad90('0x6b'),_0xad90('0x68'),_0xad90('0x79'),'ListId',_0xad90('0x5a'),_0xad90('0x4f'),_0xad90('0x50')],squel[_0xad90('0x69')]()[_0xad90('0x6a')](_0xad90('0x6b'),_0xad90('0x6b'))['field'](_0xad90('0x6c'),_0xad90('0x68'))['field']('id',_0xad90('0x79'))['field'](_0x2d2206[_0xad90('0x7a')][_0xad90('0x6d')](),'ListId')['field'](_0x552b85[_0xad90('0x4d')]['id']['toString'](),'CampaignId')[_0xad90('0x6a')](_0xad90('0x6c'),_0xad90('0x4f'))['field'](_0xad90('0x6c'),_0xad90('0x50'))['from'](_0xad90('0x6f'))[_0xad90('0x37')](_0xad90('0x7b'))[_0xad90('0x37')](_0xad90('0x70'),_0x2d2206[_0xad90('0x7a')][_0xad90('0x6d')]())[_0xad90('0x37')](_0xad90('0x71'))['where'](_0xad90('0x72'),squel[_0xad90('0x69')]()[_0xad90('0x6a')](_0xad90('0x75'))['from'](_0xad90('0x76'))['where'](_0xad90('0x74'),_0x552b85['params']['id'][_0xad90('0x6d')]())))[_0xad90('0x6d')]();break;default:_0x3e2d2a=squel[_0xad90('0x66')]()[_0xad90('0x78')](_0xad90('0x76'))[_0xad90('0x67')]([_0xad90('0x6b'),_0xad90('0x68'),_0xad90('0x79'),_0xad90('0x7c'),_0xad90('0x5a'),'createdAt',_0xad90('0x50')],squel[_0xad90('0x69')]()['field'](_0xad90('0x6b'),_0xad90('0x6b'))[_0xad90('0x6a')](_0xad90('0x6c'),_0xad90('0x68'))[_0xad90('0x6a')]('id',_0xad90('0x79'))[_0xad90('0x6a')](_0x2d2206['CmListId'][_0xad90('0x6d')](),_0xad90('0x7c'))[_0xad90('0x6a')](_0x552b85[_0xad90('0x4d')]['id']['toString'](),_0xad90('0x5a'))[_0xad90('0x6a')](_0xad90('0x6c'),_0xad90('0x4f'))[_0xad90('0x6a')](_0xad90('0x6c'),_0xad90('0x50'))[_0xad90('0x6e')](_0xad90('0x6f'))[_0xad90('0x37')](_0xad90('0x7b'))['where'](_0xad90('0x70'),_0x2d2206[_0xad90('0x7a')][_0xad90('0x6d')]())['where'](_0xad90('0x71')))[_0xad90('0x6d')]();}_0x1a3dbd[_0xad90('0x7d')](db[_0xad90('0x7e')][_0xad90('0x2f')](_0x3e2d2a));}return BPromise[_0xad90('0x7f')](_0x1a3dbd);}})[_0xad90('0x1f')](function(){return _0x2148c0;})[_0xad90('0x1f')](respondWithResult(_0x27261e,null))[_0xad90('0x42')](handleError(_0x27261e,null));};exports[_0xad90('0x80')]=function(_0x41e453,_0x20f957,_0x26f6c2){return db['Campaign'][_0xad90('0x44')]({'where':{'id':_0x41e453['params']['id']}})[_0xad90('0x1f')](handleEntityNotFound(_0x20f957,null))[_0xad90('0x1f')](function(_0x88a4a1){if(_0x88a4a1){return _0x88a4a1[_0xad90('0x80')](_0x41e453[_0xad90('0x2f')][_0xad90('0x63')]);}})[_0xad90('0x1f')](function(_0xb215c8){if(_0xb215c8){return db['CmHopper'][_0xad90('0x20')]({'where':{'ListId':_0x41e453[_0xad90('0x2f')][_0xad90('0x63')],'CampaignId':_0x41e453[_0xad90('0x4d')]['id']}})[_0xad90('0x1f')](function(){return _0xb215c8;});}})[_0xad90('0x1f')](respondWithStatusCode(_0x20f957,null))[_0xad90('0x42')](handleError(_0x20f957,null));};exports[_0xad90('0x81')]=function(_0x533bbe,_0xb8a7ec,_0x241a79){var _0x2d47ea={'raw':!![],'where':{}};var _0x4f0330={};var _0x4f0181={'count':0x0,'rows':[]};return db[_0xad90('0x27')]['findOne']({'where':{'id':_0x533bbe[_0xad90('0x4d')]['id']}})[_0xad90('0x1f')](handleEntityNotFound(_0xb8a7ec,null))['then'](function(_0x149c80){if(_0x149c80){_0x4f0330[_0xad90('0x2c')]=_[_0xad90('0x2e')](db[_0xad90('0x60')]['rawAttributes']);_0x4f0330[_0xad90('0x2f')]=_[_0xad90('0x2e')](_0x533bbe[_0xad90('0x2f')]);_0x4f0330[_0xad90('0x39')]=_[_0xad90('0x58')](_0x4f0330[_0xad90('0x2c')],_0x4f0330[_0xad90('0x2f')]);_0x2d47ea['attributes']=_[_0xad90('0x58')](_0x4f0330['model'],qs[_0xad90('0x31')](_0x533bbe['query']['fields']));_0x2d47ea[_0xad90('0x30')]=_0x2d47ea['attributes'][_0xad90('0x32')]?_0x2d47ea['attributes']:_0x4f0330[_0xad90('0x2c')];if(!_0x533bbe['query'][_0xad90('0x59')](_0xad90('0x33'))){_0x2d47ea[_0xad90('0x34')]=qs[_0xad90('0x34')](_0x533bbe[_0xad90('0x2f')][_0xad90('0x34')]);_0x2d47ea['offset']=qs[_0xad90('0x18')](_0x533bbe[_0xad90('0x2f')][_0xad90('0x18')]);}_0x2d47ea[_0xad90('0x35')]=qs[_0xad90('0x36')](_0x533bbe[_0xad90('0x2f')][_0xad90('0x36')]);_0x2d47ea[_0xad90('0x37')]=qs[_0xad90('0x39')](_[_0xad90('0x38')](_0x533bbe[_0xad90('0x2f')],_0x4f0330['filters']));_0x2d47ea[_0xad90('0x37')][_0xad90('0x5a')]=_0x149c80['id'];if(_0x533bbe[_0xad90('0x2f')][_0xad90('0x3a')]){_0x2d47ea[_0xad90('0x37')]=_[_0xad90('0x3b')](_0x2d47ea[_0xad90('0x37')],{'$or':_['map'](_0x2d47ea[_0xad90('0x30')],function(_0x4b7a81){var _0x965dfa={};_0x965dfa[_0x4b7a81]={'$like':'%'+_0x533bbe[_0xad90('0x2f')][_0xad90('0x3a')]+'%'};return _0x965dfa;})});}_0x2d47ea=_[_0xad90('0x3b')]({},_0x2d47ea,_0x533bbe[_0xad90('0x3d')]);return db[_0xad90('0x60')]['count']({'where':_0x2d47ea[_0xad90('0x37')]})[_0xad90('0x1f')](function(_0x2bbe35){_0x4f0181['count']=_0x2bbe35;if(_0x533bbe[_0xad90('0x2f')]['includeAll']){_0x2d47ea['include']=[{'all':!![]}];}return db['CmList']['findAll'](_0x2d47ea);})[_0xad90('0x1f')](function(_0x1a2702){_0x4f0181['rows']=_0x1a2702;return _0x4f0181;});}})[_0xad90('0x1f')](respondWithFilteredResult(_0xb8a7ec,_0x2d47ea))[_0xad90('0x42')](handleError(_0xb8a7ec,null));};exports['addBlackLists']=function(_0x3a9330,_0x5ba3c2,_0xc406ea){var _0x27ec04,_0x438b3c;return db[_0xad90('0x27')][_0xad90('0x44')]({'where':{'id':_0x3a9330[_0xad90('0x4d')]['id']}})[_0xad90('0x1f')](handleEntityNotFound(_0x5ba3c2,null))[_0xad90('0x1f')](function(_0x360281){if(_0x360281){_0x438b3c=_0x360281;return _0x360281['addBlackLists'](_0x3a9330[_0xad90('0x46')][_0xad90('0x63')],_[_0xad90('0x4e')](_0x3a9330[_0xad90('0x46')],[_0xad90('0x63'),'id'])||{});}return null;})[_0xad90('0x82')](function(_0xe0f963){var _0x5bfa4d;_0x27ec04=_0xe0f963||[];var _0x440cbc=[];if(_0xe0f963){for(var _0x44f865=0x0;_0x44f865<_0xe0f963[_0xad90('0x32')];_0x44f865+=0x1){var _0x33e3e9=_0xe0f963[_0x44f865][_0xad90('0x21')]({'plain':!![]});_0x5bfa4d=squel[_0xad90('0x66')]()[_0xad90('0x78')](_0xad90('0x83'))[_0xad90('0x67')](['phone',_0xad90('0x79'),'ListId',_0xad90('0x5a'),_0xad90('0x4f'),_0xad90('0x50')],squel['select']()[_0xad90('0x6a')](_0xad90('0x6b'),_0xad90('0x6b'))[_0xad90('0x6a')]('id','ContactId')[_0xad90('0x6a')](_0x33e3e9['CmListId'][_0xad90('0x6d')](),_0xad90('0x7c'))[_0xad90('0x6a')](_0x3a9330['params']['id'][_0xad90('0x6d')](),_0xad90('0x5a'))[_0xad90('0x6a')](_0xad90('0x6c'),_0xad90('0x4f'))['field'](_0xad90('0x6c'),_0xad90('0x50'))[_0xad90('0x6e')](_0xad90('0x6f'))[_0xad90('0x37')]('deletedAt\x20IS\x20NULL')[_0xad90('0x37')](_0xad90('0x70'),_0x33e3e9[_0xad90('0x7a')]['toString']())[_0xad90('0x37')](_0xad90('0x71')))['toString']();_0x440cbc[_0xad90('0x7d')](db[_0xad90('0x7e')]['query'](_0x5bfa4d));}return BPromise['all'](_0x440cbc);}})[_0xad90('0x1f')](function(){return _0x27ec04;})[_0xad90('0x1f')](respondWithResult(_0x5ba3c2,null))['catch'](handleError(_0x5ba3c2,null));};exports[_0xad90('0x84')]=function(_0x24368b,_0x57499a,_0x11ce8f){return db['Campaign']['find']({'where':{'id':_0x24368b[_0xad90('0x4d')]['id']}})[_0xad90('0x1f')](handleEntityNotFound(_0x57499a,null))[_0xad90('0x1f')](function(_0x1bcac6){if(_0x1bcac6){return _0x1bcac6[_0xad90('0x84')](_0x24368b[_0xad90('0x2f')][_0xad90('0x63')]);}})[_0xad90('0x1f')](function(_0x4e209c){if(_0x4e209c){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x24368b[_0xad90('0x2f')]['ids'],'CampaignId':_0x24368b[_0xad90('0x4d')]['id']}})['then'](function(){return _0x4e209c;});}})[_0xad90('0x1f')](respondWithStatusCode(_0x57499a,null))[_0xad90('0x42')](handleError(_0x57499a,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index d28cf78..f2e1f62 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 _0xf0f1=['bluebird','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','define','lodash','../../config/logger','api','moment'];(function(_0x1be1e6,_0x18656a){var _0x40a299=function(_0x569900){while(--_0x569900){_0x1be1e6['push'](_0x1be1e6['shift']());}};_0x40a299(++_0x18656a);}(_0xf0f1,0x11c));var _0x1f0f=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0xf0f1[_0x1e172a];return _0x96338b;};'use strict';var _=require(_0x1f0f('0x0'));var util=require('util');var logger=require(_0x1f0f('0x1'))(_0x1f0f('0x2'));var moment=require(_0x1f0f('0x3'));var BPromise=require(_0x1f0f('0x4'));var rp=require(_0x1f0f('0x5'));var fs=require('fs');var path=require(_0x1f0f('0x6'));var rimraf=require(_0x1f0f('0x7'));var config=require(_0x1f0f('0x8'));var attributes=require(_0x1f0f('0x9'));module[_0x1f0f('0xa')]=function(_0xaf8e7a,_0x4a396f){return _0xaf8e7a[_0x1f0f('0xb')]('Campaign',attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2038=['lodash','util','../../config/logger','bluebird','request-promise','path','exports','define','Campaign','campaigns'];(function(_0x474664,_0x48d8bc){var _0x584798=function(_0x397456){while(--_0x397456){_0x474664['push'](_0x474664['shift']());}};_0x584798(++_0x48d8bc);}(_0x2038,0x1a4));var _0x8203=function(_0x48118b,_0x5c6bc1){_0x48118b=_0x48118b-0x0;var _0xfd9a22=_0x2038[_0x48118b];return _0xfd9a22;};'use strict';var _=require(_0x8203('0x0'));var util=require(_0x8203('0x1'));var logger=require(_0x8203('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8203('0x3'));var rp=require(_0x8203('0x4'));var fs=require('fs');var path=require(_0x8203('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./campaign.attributes');module[_0x8203('0x6')]=function(_0x4f7090,_0x30292a){return _0x4f7090[_0x8203('0x7')](_0x8203('0x8'),attributes,{'tableName':_0x8203('0x9'),'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 18c987b..03a44dc 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x52e3bf,_0x1a7cf7){var _0x5cab67=function(_0x28c644){while(--_0x28c644){_0x52e3bf['push'](_0x52e3bf['shift']());}};_0x5cab67(++_0x1a7cf7);}(_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']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x4197d6,_0x399904){var _0x20afe5=function(_0x2ffec1){while(--_0x2ffec1){_0x4197d6['push'](_0x4197d6['shift']());}};_0x20afe5(++_0x399904);}(_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']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 3d34683..bda3f7e 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 _0x5f7b=['/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','/:id/lists','addLists','addBlackLists','update','delete','destroy','removeLists','removeBlackLists','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./campaign.controller','isAuthenticated','index','/:id','show','get','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals'];(function(_0x48cd98,_0x2a3615){var _0x4af750=function(_0x32b16a){while(--_0x32b16a){_0x48cd98['push'](_0x48cd98['shift']());}};_0x4af750(++_0x2a3615);}(_0x5f7b,0x19c));var _0xb5f7=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x5f7b[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require('multer');var util=require(_0xb5f7('0x0'));var path=require(_0xb5f7('0x1'));var timeout=require(_0xb5f7('0x2'));var express=require(_0xb5f7('0x3'));var router=express[_0xb5f7('0x4')]();var auth=require(_0xb5f7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb5f7('0x6'));router['get']('/',auth[_0xb5f7('0x7')](),controller[_0xb5f7('0x8')]);router['get'](_0xb5f7('0x9'),auth[_0xb5f7('0x7')](),controller[_0xb5f7('0xa')]);router[_0xb5f7('0xb')](_0xb5f7('0xc'),auth[_0xb5f7('0x7')](),controller[_0xb5f7('0xd')]);router[_0xb5f7('0xb')](_0xb5f7('0xe'),auth[_0xb5f7('0x7')](),controller[_0xb5f7('0xf')]);router['get']('/:id/hopper_finals',auth[_0xb5f7('0x7')](),controller[_0xb5f7('0x10')]);router['get'](_0xb5f7('0x11'),auth[_0xb5f7('0x7')](),controller[_0xb5f7('0x12')]);router[_0xb5f7('0xb')]('/:id/lists',auth[_0xb5f7('0x7')](),controller[_0xb5f7('0x13')]);router[_0xb5f7('0xb')](_0xb5f7('0x14'),auth[_0xb5f7('0x7')](),controller[_0xb5f7('0x15')]);router[_0xb5f7('0x16')]('/',auth[_0xb5f7('0x7')](),controller['create']);router['post'](_0xb5f7('0x17'),auth['isAuthenticated'](),controller['clone']);router[_0xb5f7('0x16')](_0xb5f7('0x18'),auth[_0xb5f7('0x7')](),controller[_0xb5f7('0x19')]);router[_0xb5f7('0x16')]('/:id/blacklists',auth[_0xb5f7('0x7')](),controller[_0xb5f7('0x1a')]);router['put'](_0xb5f7('0x9'),auth[_0xb5f7('0x7')](),controller[_0xb5f7('0x1b')]);router[_0xb5f7('0x1c')](_0xb5f7('0x9'),auth['isAuthenticated'](),controller[_0xb5f7('0x1d')]);router['delete'](_0xb5f7('0x18'),auth[_0xb5f7('0x7')](),controller[_0xb5f7('0x1e')]);router[_0xb5f7('0x1c')]('/:id/blacklists',auth[_0xb5f7('0x7')](),controller[_0xb5f7('0x1f')]);module[_0xb5f7('0x20')]=router; \ No newline at end of file +var _0xe553=['show','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','clone','addLists','addBlackLists','put','update','delete','destroy','/:id/blacklists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x10967f,_0x1f1861){var _0x1300d3=function(_0x35c6fe){while(--_0x35c6fe){_0x10967f['push'](_0x10967f['shift']());}};_0x1300d3(++_0x1f1861);}(_0xe553,0x7c));var _0x3e55=function(_0x333409,_0x8bdf47){_0x333409=_0x333409-0x0;var _0x3649f1=_0xe553[_0x333409];return _0x3649f1;};'use strict';var multer=require(_0x3e55('0x0'));var util=require(_0x3e55('0x1'));var path=require(_0x3e55('0x2'));var timeout=require(_0x3e55('0x3'));var express=require(_0x3e55('0x4'));var router=express[_0x3e55('0x5')]();var auth=require(_0x3e55('0x6'));var interaction=require(_0x3e55('0x7'));var config=require(_0x3e55('0x8'));var controller=require('./campaign.controller');router[_0x3e55('0x9')]('/',auth['isAuthenticated'](),controller[_0x3e55('0xa')]);router[_0x3e55('0x9')](_0x3e55('0xb'),auth['isAuthenticated'](),controller[_0x3e55('0xc')]);router[_0x3e55('0x9')]('/:id/hoppers',auth[_0x3e55('0xd')](),controller[_0x3e55('0xe')]);router[_0x3e55('0x9')](_0x3e55('0xf'),auth['isAuthenticated'](),controller[_0x3e55('0x10')]);router[_0x3e55('0x9')](_0x3e55('0x11'),auth[_0x3e55('0xd')](),controller[_0x3e55('0x12')]);router['get']('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x3e55('0x13')]);router[_0x3e55('0x9')](_0x3e55('0x14'),auth[_0x3e55('0xd')](),controller[_0x3e55('0x15')]);router[_0x3e55('0x9')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x3e55('0x16')]);router[_0x3e55('0x17')]('/',auth[_0x3e55('0xd')](),controller[_0x3e55('0x18')]);router['post']('/:id/clone',auth[_0x3e55('0xd')](),controller[_0x3e55('0x19')]);router[_0x3e55('0x17')](_0x3e55('0x14'),auth[_0x3e55('0xd')](),controller[_0x3e55('0x1a')]);router['post']('/:id/blacklists',auth[_0x3e55('0xd')](),controller[_0x3e55('0x1b')]);router[_0x3e55('0x1c')](_0x3e55('0xb'),auth[_0x3e55('0xd')](),controller[_0x3e55('0x1d')]);router[_0x3e55('0x1e')](_0x3e55('0xb'),auth['isAuthenticated'](),controller[_0x3e55('0x1f')]);router['delete'](_0x3e55('0x14'),auth[_0x3e55('0xd')](),controller['removeLists']);router[_0x3e55('0x1e')](_0x3e55('0x20'),auth[_0x3e55('0xd')](),controller['removeBlackLists']);module[_0x3e55('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 d1ee13f..be8a6ce 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 _0xce72=['sequelize','TEXT','VIRTUAL','getDataValue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xce72,0x15c));var _0x2ce7=function(_0x49fae3,_0x2ea57a){_0x49fae3=_0x49fae3-0x0;var _0x294255=_0xce72[_0x49fae3];return _0x294255;};'use strict';var Sequelize=require(_0x2ce7('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x2ce7('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x2ce7('0x2')],'get':function(){return this[_0x2ce7('0x3')]('key');}}}; \ No newline at end of file +var _0x74d1=['sequelize','exports','STRING','TEXT','getDataValue','key'];(function(_0x877e0f,_0x5b95d8){var _0x4e5ec1=function(_0x3c7fab){while(--_0x3c7fab){_0x877e0f['push'](_0x877e0f['shift']());}};_0x4e5ec1(++_0x5b95d8);}(_0x74d1,0x114));var _0x174d=function(_0x299210,_0x2a3754){_0x299210=_0x299210-0x0;var _0x44b686=_0x74d1[_0x299210];return _0x44b686;};'use strict';var Sequelize=require(_0x174d('0x0'));module[_0x174d('0x1')]={'key':{'type':Sequelize[_0x174d('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x174d('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x174d('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x174d('0x4')](_0x174d('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index c6f263d..5a7f6c6 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 _0x9504=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','CannedAnswers','UserProfileResource','end','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','options','CannedAnswer','includeAll','rows','catch','show','params','merge','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9504,0xb7));var _0x4950=function(_0xe6bc7e,_0x28686e){_0xe6bc7e=_0xe6bc7e-0x0;var _0x5cc1dd=_0x9504[_0xe6bc7e];return _0x5cc1dd;};'use strict';var pdf=require(_0x4950('0x0'));var emlformat=require(_0x4950('0x1'));var rimraf=require(_0x4950('0x2'));var zipdir=require(_0x4950('0x3'));var jsonpatch=require(_0x4950('0x4'));var rp=require(_0x4950('0x5'));var moment=require(_0x4950('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x4950('0x7'));var util=require('util');var path=require('path');var sox=require(_0x4950('0x8'));var csv=require(_0x4950('0x9'));var ejs=require(_0x4950('0xa'));var fs=require('fs');var _=require(_0x4950('0xb'));var squel=require(_0x4950('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4950('0xd'));var toCsv=require(_0x4950('0x9'));var querystring=require(_0x4950('0xe'));var Papa=require(_0x4950('0xf'));var Redis=require(_0x4950('0x10'));var authService=require(_0x4950('0x11'));var qs=require(_0x4950('0x12'));var as=require(_0x4950('0x13'));var hardwareService=require(_0x4950('0x14'));var logger=require(_0x4950('0x15'))(_0x4950('0x16'));var utils=require(_0x4950('0x17'));var config=require(_0x4950('0x18'));var db=require(_0x4950('0x19'))['db'];function respondWithStatusCode(_0x524b56,_0x48cc30){_0x48cc30=_0x48cc30||0xcc;return function(_0x33d76b){if(_0x33d76b){return _0x524b56[_0x4950('0x1a')](_0x48cc30);}return _0x524b56[_0x4950('0x1b')](_0x48cc30)['end']();};}function respondWithResult(_0x21a235,_0x592958){_0x592958=_0x592958||0xc8;return function(_0x3de0b8){if(_0x3de0b8){return _0x21a235[_0x4950('0x1b')](_0x592958)[_0x4950('0x1c')](_0x3de0b8);}};}function respondWithFilteredResult(_0xbfac62,_0x2ce05c){return function(_0x3a5f5f){if(_0x3a5f5f){var _0x324c30=_0x3a5f5f[_0x4950('0x1d')],_0x2c8e81=_0x2ce05c[_0x4950('0x1e')],_0x17820e=_0x2ce05c[_0x4950('0x1e')]+_0x2ce05c[_0x4950('0x1f')],_0x4c8f41;if(_0x17820e>=_0x324c30){_0x17820e=_0x324c30;_0x4c8f41=0xc8;}else{_0x4c8f41=0xce;}_0xbfac62[_0x4950('0x1b')](_0x4c8f41);return _0xbfac62[_0x4950('0x20')](_0x4950('0x21'),_0x2c8e81+'-'+_0x17820e+'/'+_0x324c30)['json'](_0x3a5f5f);}return null;};}function patchUpdates(_0x5a2a1a){return function(_0x1ca8b6){try{jsonpatch[_0x4950('0x22')](_0x1ca8b6,_0x5a2a1a,!![]);}catch(_0x1b82f5){return BPromise[_0x4950('0x23')](_0x1b82f5);}return _0x1ca8b6[_0x4950('0x24')]();};}function saveUpdates(_0xb85f12,_0xc0da56){return function(_0x221b31){if(_0x221b31){return _0x221b31[_0x4950('0x25')](_0xb85f12)['then'](function(_0x3833c0){return _0x3833c0;});}return null;};}function removeEntity(_0x485faf,_0x4f0ce8){return function(_0x467961){if(_0x467961){return _0x467961[_0x4950('0x26')]()[_0x4950('0x27')](function(){var _0xa726fd=_0x467961[_0x4950('0x28')]({'plain':!![]});var _0x137cf9=_0x4950('0x29');return db[_0x4950('0x2a')][_0x4950('0x26')]({'where':{'type':_0x137cf9,'resourceId':_0xa726fd['id']}})[_0x4950('0x27')](function(){return _0x467961;});})['then'](function(){_0x485faf['status'](0xcc)[_0x4950('0x2b')]();});}};}function handleEntityNotFound(_0x28a663,_0x579efe){return function(_0x55ba8a){if(!_0x55ba8a){_0x28a663[_0x4950('0x1a')](0x194);}return _0x55ba8a;};}function handleError(_0x256f54,_0x5c1a05){_0x5c1a05=_0x5c1a05||0x1f4;return function(_0x1eb65f){logger['error'](_0x1eb65f[_0x4950('0x2c')]);if(_0x1eb65f[_0x4950('0x2d')]){delete _0x1eb65f[_0x4950('0x2d')];}_0x256f54[_0x4950('0x1b')](_0x5c1a05)[_0x4950('0x2e')](_0x1eb65f);};}exports['index']=function(_0x15ae22,_0x405f85){var _0x4fa0e8={},_0x2bab6c={},_0x77f26b={'count':0x0,'rows':[]};var _0x35f89a=_['map'](db['CannedAnswer'][_0x4950('0x2f')],function(_0x213386){return{'name':_0x213386[_0x4950('0x30')],'type':_0x213386[_0x4950('0x31')][_0x4950('0x32')]};});_0x2bab6c[_0x4950('0x33')]=_[_0x4950('0x34')](_0x35f89a,_0x4950('0x2d'));_0x2bab6c[_0x4950('0x35')]=_[_0x4950('0x36')](_0x15ae22[_0x4950('0x35')]);_0x2bab6c['filters']=_[_0x4950('0x37')](_0x2bab6c[_0x4950('0x33')],_0x2bab6c['query']);_0x4fa0e8['attributes']=_['intersection'](_0x2bab6c[_0x4950('0x33')],qs[_0x4950('0x38')](_0x15ae22[_0x4950('0x35')]['fields']));_0x4fa0e8[_0x4950('0x39')]=_0x4fa0e8[_0x4950('0x39')][_0x4950('0x3a')]?_0x4fa0e8[_0x4950('0x39')]:_0x2bab6c[_0x4950('0x33')];if(!_0x15ae22[_0x4950('0x35')][_0x4950('0x3b')]('nolimit')){_0x4fa0e8[_0x4950('0x1f')]=qs[_0x4950('0x1f')](_0x15ae22[_0x4950('0x35')][_0x4950('0x1f')]);_0x4fa0e8[_0x4950('0x1e')]=qs[_0x4950('0x1e')](_0x15ae22[_0x4950('0x35')][_0x4950('0x1e')]);}_0x4fa0e8[_0x4950('0x3c')]=qs[_0x4950('0x3d')](_0x15ae22['query']['sort']);_0x4fa0e8[_0x4950('0x3e')]=qs[_0x4950('0x3f')](_[_0x4950('0x40')](_0x15ae22[_0x4950('0x35')],_0x2bab6c[_0x4950('0x3f')]),_0x35f89a);if(_0x15ae22[_0x4950('0x35')][_0x4950('0x41')]){_0x4fa0e8[_0x4950('0x3e')]=_['merge'](_0x4fa0e8[_0x4950('0x3e')],{'$or':_['map'](_0x35f89a,function(_0x1513a0){if(_0x1513a0[_0x4950('0x31')]!==_0x4950('0x42')){var _0xc8f876={};_0xc8f876[_0x1513a0[_0x4950('0x2d')]]={'$like':'%'+_0x15ae22[_0x4950('0x35')][_0x4950('0x41')]+'%'};return _0xc8f876;}})});}_0x4fa0e8=_['merge']({},_0x4fa0e8,_0x15ae22[_0x4950('0x43')]);var _0x15c605={'where':_0x4fa0e8[_0x4950('0x3e')]};return db[_0x4950('0x44')][_0x4950('0x1d')](_0x15c605)[_0x4950('0x27')](function(_0xc3ac0a){_0x77f26b[_0x4950('0x1d')]=_0xc3ac0a;if(_0x15ae22[_0x4950('0x35')][_0x4950('0x45')]){_0x4fa0e8['include']=[{'all':!![]}];}return db[_0x4950('0x44')]['findAll'](_0x4fa0e8);})[_0x4950('0x27')](function(_0x297737){_0x77f26b[_0x4950('0x46')]=_0x297737;return _0x77f26b;})[_0x4950('0x27')](respondWithFilteredResult(_0x405f85,_0x4fa0e8))[_0x4950('0x47')](handleError(_0x405f85,null));};exports[_0x4950('0x48')]=function(_0x21deef,_0x2a4ead){var _0x4355e0={'raw':!![],'where':{'id':_0x21deef[_0x4950('0x49')]['id']}},_0x51fc22={};_0x51fc22[_0x4950('0x33')]=_[_0x4950('0x36')](db['CannedAnswer'][_0x4950('0x2f')]);_0x51fc22[_0x4950('0x35')]=_['keys'](_0x21deef[_0x4950('0x35')]);_0x51fc22[_0x4950('0x3f')]=_[_0x4950('0x37')](_0x51fc22[_0x4950('0x33')],_0x51fc22[_0x4950('0x35')]);_0x4355e0['attributes']=_[_0x4950('0x37')](_0x51fc22[_0x4950('0x33')],qs['fields'](_0x21deef['query'][_0x4950('0x38')]));_0x4355e0[_0x4950('0x39')]=_0x4355e0[_0x4950('0x39')][_0x4950('0x3a')]?_0x4355e0['attributes']:_0x51fc22['model'];if(_0x21deef[_0x4950('0x35')][_0x4950('0x45')]){_0x4355e0['include']=[{'all':!![]}];}_0x4355e0=_[_0x4950('0x4a')]({},_0x4355e0,_0x21deef[_0x4950('0x43')]);return db[_0x4950('0x44')]['find'](_0x4355e0)[_0x4950('0x27')](handleEntityNotFound(_0x2a4ead,null))['then'](respondWithResult(_0x2a4ead,null))['catch'](handleError(_0x2a4ead,null));};exports[_0x4950('0x25')]=function(_0x176ca1,_0x419a10){if(_0x176ca1['body']['id']){delete _0x176ca1[_0x4950('0x4b')]['id'];}return db[_0x4950('0x44')][_0x4950('0x4c')]({'where':{'id':_0x176ca1[_0x4950('0x49')]['id']}})[_0x4950('0x27')](handleEntityNotFound(_0x419a10,null))[_0x4950('0x27')](saveUpdates(_0x176ca1[_0x4950('0x4b')],null))['then'](respondWithResult(_0x419a10,null))['catch'](handleError(_0x419a10,null));};exports['destroy']=function(_0x40d024,_0x5e5c05){return db['CannedAnswer'][_0x4950('0x4c')]({'where':{'id':_0x40d024[_0x4950('0x49')]['id']}})['then'](handleEntityNotFound(_0x5e5c05,null))['then'](removeEntity(_0x5e5c05,null))['catch'](handleError(_0x5e5c05,null));};exports[_0x4950('0x4d')]=function(_0x2aaeb9,_0x51f7ae){var _0x349844={'key':_0x2aaeb9[_0x4950('0x4b')]['key']};if(_0x2aaeb9[_0x4950('0x4b')][_0x4950('0x4e')]){_0x349844[_0x4950('0x4e')]=_0x2aaeb9[_0x4950('0x4b')][_0x4950('0x4e')];}else if(_0x2aaeb9[_0x4950('0x4b')][_0x4950('0x4f')]){_0x349844['SmsAccountId']=_0x2aaeb9[_0x4950('0x4b')][_0x4950('0x4f')];}else if(_0x2aaeb9[_0x4950('0x4b')][_0x4950('0x50')]){_0x349844['OpenchannelAccountId']=_0x2aaeb9['body'][_0x4950('0x50')];}else if(_0x2aaeb9['body'][_0x4950('0x51')]){_0x349844[_0x4950('0x51')]=_0x2aaeb9['body'][_0x4950('0x51')];}return db[_0x4950('0x44')][_0x4950('0x4c')]({'where':_0x349844})[_0x4950('0x27')](function(_0x1919f3){if(_0x1919f3){throw new db[(_0x4950('0x52'))][(_0x4950('0x53'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0x4950('0x4d')](_0x2aaeb9[_0x4950('0x4b')]);})[_0x4950('0x27')](function(_0x2ac343){var _0x319fda=_0x2aaeb9[_0x4950('0x54')][_0x4950('0x28')]({'plain':!![]});if(!_0x319fda)throw new Error(_0x4950('0x55'));if(_0x319fda['role']===_0x4950('0x54')){var _0x14d168=_0x2ac343[_0x4950('0x28')]({'plain':!![]});return db[_0x4950('0x56')][_0x4950('0x4c')]({'where':{'name':'CannedAnswers','userProfileId':_0x319fda[_0x4950('0x57')]},'raw':!![]})[_0x4950('0x27')](function(_0x4849a2){if(_0x4849a2&&_0x4849a2[_0x4950('0x58')]===0x0){return db['UserProfileResource'][_0x4950('0x4d')]({'name':_0x14d168[_0x4950('0x2d')],'resourceId':_0x14d168['id'],'type':_0x4849a2['name'],'sectionId':_0x4849a2['id']},{})[_0x4950('0x27')](function(){return _0x2ac343;});}else{return _0x2ac343;}})[_0x4950('0x47')](function(_0x2c6318){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c6318);throw _0x2c6318;});}return _0x2ac343;})['then'](respondWithResult(_0x51f7ae,0xc9))[_0x4950('0x47')](handleError(_0x51f7ae,null));}; \ No newline at end of file +var _0x55a2=['attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','merge','filter','options','include','rows','catch','params','rawAttributes','includeAll','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','Content-Range','json','apply','save','then','destroy','get','CannedAnswers','UserProfileResource','name','send','index','map','CannedAnswer','fieldName','type','key','query','keys','filters','intersection','model'];(function(_0x266017,_0x450970){var _0x52c7c7=function(_0x5bf57a){while(--_0x5bf57a){_0x266017['push'](_0x266017['shift']());}};_0x52c7c7(++_0x450970);}(_0x55a2,0x126));var _0x255a=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x55a2[_0x562f3b];return _0x1edd55;};'use strict';var pdf=require(_0x255a('0x0'));var emlformat=require(_0x255a('0x1'));var rimraf=require(_0x255a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x255a('0x3'));var moment=require(_0x255a('0x4'));var BPromise=require(_0x255a('0x5'));var Mustache=require(_0x255a('0x6'));var util=require('util');var path=require(_0x255a('0x7'));var sox=require(_0x255a('0x8'));var csv=require(_0x255a('0x9'));var ejs=require(_0x255a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x255a('0xb'));var crypto=require('crypto');var jsforce=require(_0x255a('0xc'));var deskjs=require(_0x255a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x255a('0xe'));var Papa=require('papaparse');var Redis=require(_0x255a('0xf'));var authService=require(_0x255a('0x10'));var qs=require(_0x255a('0x11'));var as=require(_0x255a('0x12'));var hardwareService=require(_0x255a('0x13'));var logger=require(_0x255a('0x14'))(_0x255a('0x15'));var utils=require(_0x255a('0x16'));var config=require(_0x255a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55cb69,_0x127b15){_0x127b15=_0x127b15||0xcc;return function(_0x622030){if(_0x622030){return _0x55cb69[_0x255a('0x18')](_0x127b15);}return _0x55cb69[_0x255a('0x19')](_0x127b15)[_0x255a('0x1a')]();};}function respondWithResult(_0xa13c4a,_0x10bf5f){_0x10bf5f=_0x10bf5f||0xc8;return function(_0x4a291a){if(_0x4a291a){return _0xa13c4a['status'](_0x10bf5f)['json'](_0x4a291a);}};}function respondWithFilteredResult(_0x3f0b43,_0x2c666c){return function(_0x14cbda){if(_0x14cbda){var _0x3abe2c=_0x14cbda[_0x255a('0x1b')],_0x1a449a=_0x2c666c['offset'],_0x19b362=_0x2c666c['offset']+_0x2c666c['limit'],_0x41322d;if(_0x19b362>=_0x3abe2c){_0x19b362=_0x3abe2c;_0x41322d=0xc8;}else{_0x41322d=0xce;}_0x3f0b43[_0x255a('0x19')](_0x41322d);return _0x3f0b43['set'](_0x255a('0x1c'),_0x1a449a+'-'+_0x19b362+'/'+_0x3abe2c)[_0x255a('0x1d')](_0x14cbda);}return null;};}function patchUpdates(_0x5baa79){return function(_0x3475bf){try{jsonpatch[_0x255a('0x1e')](_0x3475bf,_0x5baa79,!![]);}catch(_0x1a60d5){return BPromise['reject'](_0x1a60d5);}return _0x3475bf[_0x255a('0x1f')]();};}function saveUpdates(_0xa9ef6f,_0x22821d){return function(_0x4f30df){if(_0x4f30df){return _0x4f30df['update'](_0xa9ef6f)[_0x255a('0x20')](function(_0x1b9cf8){return _0x1b9cf8;});}return null;};}function removeEntity(_0x3b5e35,_0x10c4a7){return function(_0x47eb67){if(_0x47eb67){return _0x47eb67[_0x255a('0x21')]()[_0x255a('0x20')](function(){var _0x1dc8cb=_0x47eb67[_0x255a('0x22')]({'plain':!![]});var _0x49ed5a=_0x255a('0x23');return db[_0x255a('0x24')][_0x255a('0x21')]({'where':{'type':_0x49ed5a,'resourceId':_0x1dc8cb['id']}})[_0x255a('0x20')](function(){return _0x47eb67;});})[_0x255a('0x20')](function(){_0x3b5e35[_0x255a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x493338,_0x390710){return function(_0x2aa207){if(!_0x2aa207){_0x493338[_0x255a('0x18')](0x194);}return _0x2aa207;};}function handleError(_0x3ef809,_0x3bc7fb){_0x3bc7fb=_0x3bc7fb||0x1f4;return function(_0x15e809){logger['error'](_0x15e809['stack']);if(_0x15e809[_0x255a('0x25')]){delete _0x15e809[_0x255a('0x25')];}_0x3ef809[_0x255a('0x19')](_0x3bc7fb)[_0x255a('0x26')](_0x15e809);};}exports[_0x255a('0x27')]=function(_0x53b8f4,_0x6acf50){var _0x3bd8cc={},_0x366780={},_0x4cb0e5={'count':0x0,'rows':[]};var _0x48f917=_[_0x255a('0x28')](db[_0x255a('0x29')]['rawAttributes'],function(_0x3155c9){return{'name':_0x3155c9[_0x255a('0x2a')],'type':_0x3155c9[_0x255a('0x2b')][_0x255a('0x2c')]};});_0x366780['model']=_[_0x255a('0x28')](_0x48f917,_0x255a('0x25'));_0x366780[_0x255a('0x2d')]=_[_0x255a('0x2e')](_0x53b8f4[_0x255a('0x2d')]);_0x366780[_0x255a('0x2f')]=_[_0x255a('0x30')](_0x366780[_0x255a('0x31')],_0x366780['query']);_0x3bd8cc[_0x255a('0x32')]=_['intersection'](_0x366780[_0x255a('0x31')],qs[_0x255a('0x33')](_0x53b8f4[_0x255a('0x2d')][_0x255a('0x33')]));_0x3bd8cc[_0x255a('0x32')]=_0x3bd8cc['attributes'][_0x255a('0x34')]?_0x3bd8cc[_0x255a('0x32')]:_0x366780[_0x255a('0x31')];if(!_0x53b8f4['query'][_0x255a('0x35')](_0x255a('0x36'))){_0x3bd8cc[_0x255a('0x37')]=qs['limit'](_0x53b8f4[_0x255a('0x2d')][_0x255a('0x37')]);_0x3bd8cc[_0x255a('0x38')]=qs[_0x255a('0x38')](_0x53b8f4[_0x255a('0x2d')][_0x255a('0x38')]);}_0x3bd8cc[_0x255a('0x39')]=qs[_0x255a('0x3a')](_0x53b8f4[_0x255a('0x2d')][_0x255a('0x3a')]);_0x3bd8cc[_0x255a('0x3b')]=qs[_0x255a('0x2f')](_['pick'](_0x53b8f4[_0x255a('0x2d')],_0x366780[_0x255a('0x2f')]),_0x48f917);if(_0x53b8f4[_0x255a('0x2d')]['filter']){_0x3bd8cc['where']=_[_0x255a('0x3c')](_0x3bd8cc[_0x255a('0x3b')],{'$or':_[_0x255a('0x28')](_0x48f917,function(_0x1c0203){if(_0x1c0203[_0x255a('0x2b')]!=='VIRTUAL'){var _0x40febc={};_0x40febc[_0x1c0203[_0x255a('0x25')]]={'$like':'%'+_0x53b8f4['query'][_0x255a('0x3d')]+'%'};return _0x40febc;}})});}_0x3bd8cc=_[_0x255a('0x3c')]({},_0x3bd8cc,_0x53b8f4[_0x255a('0x3e')]);var _0x3a9815={'where':_0x3bd8cc[_0x255a('0x3b')]};return db['CannedAnswer']['count'](_0x3a9815)[_0x255a('0x20')](function(_0x173da5){_0x4cb0e5['count']=_0x173da5;if(_0x53b8f4[_0x255a('0x2d')]['includeAll']){_0x3bd8cc[_0x255a('0x3f')]=[{'all':!![]}];}return db[_0x255a('0x29')]['findAll'](_0x3bd8cc);})[_0x255a('0x20')](function(_0x46f691){_0x4cb0e5[_0x255a('0x40')]=_0x46f691;return _0x4cb0e5;})[_0x255a('0x20')](respondWithFilteredResult(_0x6acf50,_0x3bd8cc))[_0x255a('0x41')](handleError(_0x6acf50,null));};exports['show']=function(_0xd6024,_0x5838d1){var _0x5ef4d3={'raw':!![],'where':{'id':_0xd6024[_0x255a('0x42')]['id']}},_0x2f6c96={};_0x2f6c96[_0x255a('0x31')]=_[_0x255a('0x2e')](db[_0x255a('0x29')][_0x255a('0x43')]);_0x2f6c96['query']=_[_0x255a('0x2e')](_0xd6024[_0x255a('0x2d')]);_0x2f6c96[_0x255a('0x2f')]=_[_0x255a('0x30')](_0x2f6c96[_0x255a('0x31')],_0x2f6c96[_0x255a('0x2d')]);_0x5ef4d3[_0x255a('0x32')]=_[_0x255a('0x30')](_0x2f6c96[_0x255a('0x31')],qs['fields'](_0xd6024[_0x255a('0x2d')]['fields']));_0x5ef4d3[_0x255a('0x32')]=_0x5ef4d3[_0x255a('0x32')]['length']?_0x5ef4d3[_0x255a('0x32')]:_0x2f6c96['model'];if(_0xd6024[_0x255a('0x2d')][_0x255a('0x44')]){_0x5ef4d3['include']=[{'all':!![]}];}_0x5ef4d3=_[_0x255a('0x3c')]({},_0x5ef4d3,_0xd6024[_0x255a('0x3e')]);return db[_0x255a('0x29')][_0x255a('0x45')](_0x5ef4d3)[_0x255a('0x20')](handleEntityNotFound(_0x5838d1,null))[_0x255a('0x20')](respondWithResult(_0x5838d1,null))[_0x255a('0x41')](handleError(_0x5838d1,null));};exports[_0x255a('0x46')]=function(_0x49843b,_0x54d098){if(_0x49843b[_0x255a('0x47')]['id']){delete _0x49843b['body']['id'];}return db[_0x255a('0x29')][_0x255a('0x45')]({'where':{'id':_0x49843b['params']['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x54d098,null))[_0x255a('0x20')](saveUpdates(_0x49843b[_0x255a('0x47')],null))[_0x255a('0x20')](respondWithResult(_0x54d098,null))[_0x255a('0x41')](handleError(_0x54d098,null));};exports[_0x255a('0x21')]=function(_0x270365,_0x19ad48){return db['CannedAnswer']['find']({'where':{'id':_0x270365[_0x255a('0x42')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x19ad48,null))[_0x255a('0x20')](removeEntity(_0x19ad48,null))[_0x255a('0x41')](handleError(_0x19ad48,null));};exports[_0x255a('0x48')]=function(_0x39197f,_0x509df2){var _0x2d2bd0={'key':_0x39197f['body'][_0x255a('0x2c')]};if(_0x39197f[_0x255a('0x47')][_0x255a('0x49')]){_0x2d2bd0[_0x255a('0x49')]=_0x39197f[_0x255a('0x47')][_0x255a('0x49')];}else if(_0x39197f[_0x255a('0x47')][_0x255a('0x4a')]){_0x2d2bd0[_0x255a('0x4a')]=_0x39197f[_0x255a('0x47')]['SmsAccountId'];}else if(_0x39197f['body'][_0x255a('0x4b')]){_0x2d2bd0[_0x255a('0x4b')]=_0x39197f[_0x255a('0x47')][_0x255a('0x4b')];}else if(_0x39197f[_0x255a('0x47')][_0x255a('0x4c')]){_0x2d2bd0[_0x255a('0x4c')]=_0x39197f[_0x255a('0x47')][_0x255a('0x4c')];}return db[_0x255a('0x29')][_0x255a('0x45')]({'where':_0x2d2bd0})[_0x255a('0x20')](function(_0x2789a1){if(_0x2789a1){throw new db[(_0x255a('0x4d'))][(_0x255a('0x4e'))](_0x255a('0x4f'));}return db['CannedAnswer'][_0x255a('0x48')](_0x39197f[_0x255a('0x47')]);})[_0x255a('0x20')](function(_0x5f4f90){var _0x22246b=_0x39197f[_0x255a('0x50')][_0x255a('0x22')]({'plain':!![]});if(!_0x22246b)throw new Error(_0x255a('0x51'));if(_0x22246b[_0x255a('0x52')]===_0x255a('0x50')){var _0x4140b2=_0x5f4f90[_0x255a('0x22')]({'plain':!![]});return db[_0x255a('0x53')][_0x255a('0x45')]({'where':{'name':'CannedAnswers','userProfileId':_0x22246b[_0x255a('0x54')]},'raw':!![]})[_0x255a('0x20')](function(_0x4d5cb3){if(_0x4d5cb3&&_0x4d5cb3['autoAssociation']===0x0){return db['UserProfileResource'][_0x255a('0x48')]({'name':_0x4140b2['name'],'resourceId':_0x4140b2['id'],'type':_0x4d5cb3[_0x255a('0x25')],'sectionId':_0x4d5cb3['id']},{})[_0x255a('0x20')](function(){return _0x5f4f90;});}else{return _0x5f4f90;}})[_0x255a('0x41')](function(_0x21d716){logger[_0x255a('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21d716);throw _0x21d716;});}return _0x5f4f90;})[_0x255a('0x20')](respondWithResult(_0x509df2,0xc9))[_0x255a('0x41')](handleError(_0x509df2,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 3d61d72..e665155 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 _0x4ee3=['tools_canned_answers','utf8mb4','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./cannedAnswer.attributes','define'];(function(_0x39b341,_0x1bdc83){var _0x1f1a53=function(_0x34c2e5){while(--_0x34c2e5){_0x39b341['push'](_0x39b341['shift']());}};_0x1f1a53(++_0x1bdc83);}(_0x4ee3,0x120));var _0x34ee=function(_0x3402dd,_0x3e26c2){_0x3402dd=_0x3402dd-0x0;var _0x2d60de=_0x4ee3[_0x3402dd];return _0x2d60de;};'use strict';var _=require(_0x34ee('0x0'));var util=require(_0x34ee('0x1'));var logger=require(_0x34ee('0x2'))('api');var moment=require(_0x34ee('0x3'));var BPromise=require(_0x34ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34ee('0x5'));var rimraf=require(_0x34ee('0x6'));var config=require('../../config/environment');var attributes=require(_0x34ee('0x7'));module['exports']=function(_0xd9ffb8,_0x12abdb){return _0xd9ffb8[_0x34ee('0x8')]('CannedAnswer',attributes,{'tableName':_0x34ee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x34ee('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5a9b=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','path','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer'];(function(_0x3492af,_0x4d4688){var _0x1a0e32=function(_0x42e3eb){while(--_0x42e3eb){_0x3492af['push'](_0x3492af['shift']());}};_0x1a0e32(++_0x4d4688);}(_0x5a9b,0x1b3));var _0xb5a9=function(_0x481171,_0x215ca1){_0x481171=_0x481171-0x0;var _0x40b4ff=_0x5a9b[_0x481171];return _0x40b4ff;};'use strict';var _=require(_0xb5a9('0x0'));var util=require(_0xb5a9('0x1'));var logger=require(_0xb5a9('0x2'))('api');var moment=require(_0xb5a9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5a9('0x4'));var rimraf=require('rimraf');var config=require(_0xb5a9('0x5'));var attributes=require(_0xb5a9('0x6'));module['exports']=function(_0xaa009,_0x5e975d){return _0xaa009[_0xb5a9('0x7')](_0xb5a9('0x8'),attributes,{'tableName':_0xb5a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb5a9('0xa'),'collate':_0xb5a9('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 691587f..0ef97ac 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 _0xefc4=['then','info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x1d2400,_0x2eb04d){var _0x49e9b7=function(_0x602c4c){while(--_0x602c4c){_0x1d2400['push'](_0x1d2400['shift']());}};_0x49e9b7(++_0x2eb04d);}(_0xefc4,0x15c));var _0x4efc=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0xefc4[_0x1ebce2];return _0x4a330c;};'use strict';var _=require(_0x4efc('0x0'));var util=require(_0x4efc('0x1'));var moment=require(_0x4efc('0x2'));var BPromise=require('bluebird');var rs=require(_0x4efc('0x3'));var fs=require('fs');var Redis=require(_0x4efc('0x4'));var db=require(_0x4efc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4efc('0x6'));var config=require(_0x4efc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4efc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58181c,_0x52b2d2,_0x3b3d53){return new BPromise(function(_0x920af9,_0x255cae){return client['request'](_0x58181c,_0x3b3d53)[_0x4efc('0x9')](function(_0x3aa794){logger[_0x4efc('0xa')](_0x4efc('0xb'),_0x52b2d2,'request\x20sent');logger[_0x4efc('0xc')](_0x4efc('0xd'),_0x52b2d2,_0x4efc('0xe'),JSON[_0x4efc('0xf')](_0x3aa794));if(_0x3aa794['error']){if(_0x3aa794[_0x4efc('0x10')][_0x4efc('0x11')]===0x1f4){logger[_0x4efc('0x10')](_0x4efc('0xb'),_0x52b2d2,_0x3aa794[_0x4efc('0x10')][_0x4efc('0x12')]);return _0x255cae(_0x3aa794[_0x4efc('0x10')]['message']);}logger[_0x4efc('0x10')](_0x4efc('0xb'),_0x52b2d2,_0x3aa794['error'][_0x4efc('0x12')]);return _0x920af9(_0x3aa794['error'][_0x4efc('0x12')]);}else{logger[_0x4efc('0xa')](_0x4efc('0xb'),_0x52b2d2,_0x4efc('0xe'));_0x920af9(_0x3aa794[_0x4efc('0x13')]['message']);}})[_0x4efc('0x14')](function(_0x1c6f20){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x52b2d2,_0x1c6f20);_0x255cae(_0x1c6f20);});});} \ No newline at end of file +var _0x605c=['error','code','CannedAnswer,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3e2620,_0x3129b0){var _0x276294=function(_0x631edc){while(--_0x631edc){_0x3e2620['push'](_0x3e2620['shift']());}};_0x276294(++_0x3129b0);}(_0x605c,0x17c));var _0xc605=function(_0x22b69a,_0x2c7751){_0x22b69a=_0x22b69a-0x0;var _0x2aa3f1=_0x605c[_0x22b69a];return _0x2aa3f1;};'use strict';var _=require(_0xc605('0x0'));var util=require(_0xc605('0x1'));var moment=require(_0xc605('0x2'));var BPromise=require(_0xc605('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc605('0x4'));var db=require(_0xc605('0x5'))['db'];var utils=require(_0xc605('0x6'));var logger=require(_0xc605('0x7'))(_0xc605('0x8'));var config=require(_0xc605('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e5a6c,_0x102edf,_0x510f88){return new BPromise(function(_0x14456b,_0x3986c0){return client[_0xc605('0xa')](_0x4e5a6c,_0x510f88)['then'](function(_0x3d95f6){logger[_0xc605('0xb')]('CannedAnswer,\x20%s,\x20%s',_0x102edf,_0xc605('0xc'));logger[_0xc605('0xd')](_0xc605('0xe'),_0x102edf,_0xc605('0xc'),JSON[_0xc605('0xf')](_0x3d95f6));if(_0x3d95f6[_0xc605('0x10')]){if(_0x3d95f6[_0xc605('0x10')][_0xc605('0x11')]===0x1f4){logger[_0xc605('0x10')](_0xc605('0x12'),_0x102edf,_0x3d95f6[_0xc605('0x10')]['message']);return _0x3986c0(_0x3d95f6[_0xc605('0x10')][_0xc605('0x13')]);}logger['error'](_0xc605('0x12'),_0x102edf,_0x3d95f6[_0xc605('0x10')][_0xc605('0x13')]);return _0x14456b(_0x3d95f6[_0xc605('0x10')]['message']);}else{logger[_0xc605('0xb')](_0xc605('0x12'),_0x102edf,'request\x20sent');_0x14456b(_0x3d95f6[_0xc605('0x14')]['message']);}})[_0xc605('0x15')](function(_0x531b0c){logger['error'](_0xc605('0x12'),_0x102edf,_0x531b0c);_0x3986c0(_0x531b0c);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index f26a2f3..76ae81d 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 _0x5926=['path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','util'];(function(_0x2330cf,_0x594077){var _0x36ef0c=function(_0x538f72){while(--_0x538f72){_0x2330cf['push'](_0x2330cf['shift']());}};_0x36ef0c(++_0x594077);}(_0x5926,0x10f));var _0x6592=function(_0x4f09d4,_0x3b7b51){_0x4f09d4=_0x4f09d4-0x0;var _0x296bec=_0x5926[_0x4f09d4];return _0x296bec;};'use strict';var multer=require('multer');var util=require(_0x6592('0x0'));var path=require(_0x6592('0x1'));var timeout=require('connect-timeout');var express=require(_0x6592('0x2'));var router=express[_0x6592('0x3')]();var auth=require(_0x6592('0x4'));var interaction=require(_0x6592('0x5'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router[_0x6592('0x6')]('/',auth[_0x6592('0x7')](),controller[_0x6592('0x8')]);router[_0x6592('0x6')](_0x6592('0x9'),auth['isAuthenticated'](),controller[_0x6592('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6592('0xb')]);router[_0x6592('0xc')]('/:id',auth[_0x6592('0x7')](),controller[_0x6592('0xd')]);router[_0x6592('0xe')](_0x6592('0x9'),auth[_0x6592('0x7')](),controller[_0x6592('0xf')]);module['exports']=router; \ No newline at end of file +var _0x4afa=['delete','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','get','/:id','create','update'];(function(_0x20f3bc,_0x34c2fd){var _0x2e0502=function(_0x14dd1a){while(--_0x14dd1a){_0x20f3bc['push'](_0x20f3bc['shift']());}};_0x2e0502(++_0x34c2fd);}(_0x4afa,0x10c));var _0xa4af=function(_0x518b0e,_0x38641f){_0x518b0e=_0x518b0e-0x0;var _0xc62001=_0x4afa[_0x518b0e];return _0xc62001;};'use strict';var multer=require('multer');var util=require(_0xa4af('0x0'));var path=require(_0xa4af('0x1'));var timeout=require('connect-timeout');var express=require(_0xa4af('0x2'));var router=express['Router']();var auth=require(_0xa4af('0x3'));var interaction=require(_0xa4af('0x4'));var config=require(_0xa4af('0x5'));var controller=require(_0xa4af('0x6'));router['get']('/',auth[_0xa4af('0x7')](),controller['index']);router[_0xa4af('0x8')](_0xa4af('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa4af('0x7')](),controller[_0xa4af('0xa')]);router['put'](_0xa4af('0x9'),auth[_0xa4af('0x7')](),controller[_0xa4af('0xb')]);router[_0xa4af('0xc')](_0xa4af('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xa4af('0xd')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 00907b0..f48a609 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 _0xff50=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports','DATE'];(function(_0x3d49e9,_0x112472){var _0x2ad2e8=function(_0x14a2dc){while(--_0x14a2dc){_0x3d49e9['push'](_0x3d49e9['shift']());}};_0x2ad2e8(++_0x112472);}(_0xff50,0x10b));var _0x0ff5=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0xff50[_0xd22d95];return _0x15d7a3;};'use strict';var Sequelize=require(_0x0ff5('0x0'));module[_0x0ff5('0x1')]={'calldate':{'type':Sequelize[_0x0ff5('0x2')],'allowNull':![],'defaultValue':_0x0ff5('0x3')},'clid':{'type':Sequelize[_0x0ff5('0x4')]},'src':{'type':Sequelize[_0x0ff5('0x4')]},'dst':{'type':Sequelize[_0x0ff5('0x4')]},'dcontext':{'type':Sequelize[_0x0ff5('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x0ff5('0x4')]},'lastdata':{'type':Sequelize[_0x0ff5('0x4')]},'duration':{'type':Sequelize[_0x0ff5('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0ff5('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0ff5('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x0ff5('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0ff5('0x4')]},'linkedid':{'type':Sequelize[_0x0ff5('0x4')]},'sequence':{'type':Sequelize[_0x0ff5('0x4')]},'peeraccount':{'type':Sequelize[_0x0ff5('0x4')]},'type':{'type':Sequelize[_0x0ff5('0x4')]},'tag':{'type':Sequelize[_0x0ff5('0x4')]}}; \ No newline at end of file +var _0xe1c1=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x1d1bf6,_0x338c96){var _0x4e66f4=function(_0x5698b2){while(--_0x5698b2){_0x1d1bf6['push'](_0x1d1bf6['shift']());}};_0x4e66f4(++_0x338c96);}(_0xe1c1,0x6c));var _0x1e1c=function(_0x133277,_0xb1d6b2){_0x133277=_0x133277-0x0;var _0x5b4a22=_0xe1c1[_0x133277];return _0x5b4a22;};'use strict';var Sequelize=require(_0x1e1c('0x0'));module[_0x1e1c('0x1')]={'calldate':{'type':Sequelize[_0x1e1c('0x2')],'allowNull':![],'defaultValue':_0x1e1c('0x3')},'clid':{'type':Sequelize[_0x1e1c('0x4')]},'src':{'type':Sequelize[_0x1e1c('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x1e1c('0x4')]},'channel':{'type':Sequelize[_0x1e1c('0x4')]},'dstchannel':{'type':Sequelize[_0x1e1c('0x4')]},'lastapp':{'type':Sequelize[_0x1e1c('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x1e1c('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1e1c('0x4')]},'amaflags':{'type':Sequelize[_0x1e1c('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1e1c('0x4')]},'linkedid':{'type':Sequelize[_0x1e1c('0x4')]},'sequence':{'type':Sequelize[_0x1e1c('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1e1c('0x4')]},'tag':{'type':Sequelize[_0x1e1c('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index a33eb76..4be57e2 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 _0xfd55=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','type','query','keys','filters','intersection','model'];(function(_0x3604bd,_0x353fa1){var _0x2cf55a=function(_0xb430a3){while(--_0xb430a3){_0x3604bd['push'](_0x3604bd['shift']());}};_0x2cf55a(++_0x353fa1);}(_0xfd55,0x13c));var _0x5fd5=function(_0x177c90,_0x3a6da2){_0x177c90=_0x177c90-0x0;var _0x1869d4=_0xfd55[_0x177c90];return _0x1869d4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5fd5('0x0'));var zipdir=require(_0x5fd5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5fd5('0x2'));var BPromise=require(_0x5fd5('0x3'));var Mustache=require(_0x5fd5('0x4'));var util=require(_0x5fd5('0x5'));var path=require(_0x5fd5('0x6'));var sox=require(_0x5fd5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5fd5('0x8'));var jsforce=require(_0x5fd5('0x9'));var deskjs=require(_0x5fd5('0xa'));var toCsv=require(_0x5fd5('0xb'));var querystring=require(_0x5fd5('0xc'));var Papa=require(_0x5fd5('0xd'));var Redis=require(_0x5fd5('0xe'));var authService=require(_0x5fd5('0xf'));var qs=require(_0x5fd5('0x10'));var as=require(_0x5fd5('0x11'));var hardwareService=require(_0x5fd5('0x12'));var logger=require(_0x5fd5('0x13'))(_0x5fd5('0x14'));var utils=require(_0x5fd5('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c6345,_0x4e684b){_0x4e684b=_0x4e684b||0xcc;return function(_0x153d46){if(_0x153d46){return _0x1c6345['sendStatus'](_0x4e684b);}return _0x1c6345[_0x5fd5('0x16')](_0x4e684b)[_0x5fd5('0x17')]();};}function respondWithResult(_0x48d439,_0x2e6e9a){_0x2e6e9a=_0x2e6e9a||0xc8;return function(_0x192e53){if(_0x192e53){return _0x48d439[_0x5fd5('0x16')](_0x2e6e9a)[_0x5fd5('0x18')](_0x192e53);}};}function respondWithFilteredResult(_0x2dcd51,_0x419163){return function(_0xbfbaa1){if(_0xbfbaa1){var _0x1419f6=_0xbfbaa1['count'],_0xeedd7=_0x419163[_0x5fd5('0x19')],_0x282f91=_0x419163[_0x5fd5('0x19')]+_0x419163[_0x5fd5('0x1a')],_0x550676;if(_0x282f91>=_0x1419f6){_0x282f91=_0x1419f6;_0x550676=0xc8;}else{_0x550676=0xce;}_0x2dcd51[_0x5fd5('0x16')](_0x550676);return _0x2dcd51[_0x5fd5('0x1b')](_0x5fd5('0x1c'),_0xeedd7+'-'+_0x282f91+'/'+_0x1419f6)[_0x5fd5('0x18')](_0xbfbaa1);}return null;};}function patchUpdates(_0x3645e2){return function(_0x46deb9){try{jsonpatch[_0x5fd5('0x1d')](_0x46deb9,_0x3645e2,!![]);}catch(_0x3a6f87){return BPromise[_0x5fd5('0x1e')](_0x3a6f87);}return _0x46deb9[_0x5fd5('0x1f')]();};}function saveUpdates(_0x5cce12,_0x3101d8){return function(_0x299518){if(_0x299518){return _0x299518[_0x5fd5('0x20')](_0x5cce12)[_0x5fd5('0x21')](function(_0x109059){return _0x109059;});}return null;};}function removeEntity(_0x22c6be,_0x1d67df){return function(_0x22b796){if(_0x22b796){return _0x22b796[_0x5fd5('0x22')]()[_0x5fd5('0x21')](function(){_0x22c6be[_0x5fd5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37f06e,_0xb116b3){return function(_0xde65b9){if(!_0xde65b9){_0x37f06e['sendStatus'](0x194);}return _0xde65b9;};}function handleError(_0x4912d3,_0x3193e6){_0x3193e6=_0x3193e6||0x1f4;return function(_0x47fd74){logger[_0x5fd5('0x23')](_0x47fd74[_0x5fd5('0x24')]);if(_0x47fd74[_0x5fd5('0x25')]){delete _0x47fd74[_0x5fd5('0x25')];}_0x4912d3[_0x5fd5('0x16')](_0x3193e6)[_0x5fd5('0x26')](_0x47fd74);};}exports[_0x5fd5('0x27')]=function(_0x3f3a1c,_0x4b3aa8){var _0xfbb246={},_0x545e91={},_0x48bdf2={'count':0x0,'rows':[]};var _0xdd392a=_[_0x5fd5('0x28')](db[_0x5fd5('0x29')][_0x5fd5('0x2a')],function(_0x45c063){return{'name':_0x45c063['fieldName'],'type':_0x45c063[_0x5fd5('0x2b')]['key']};});_0x545e91['model']=_[_0x5fd5('0x28')](_0xdd392a,_0x5fd5('0x25'));_0x545e91[_0x5fd5('0x2c')]=_[_0x5fd5('0x2d')](_0x3f3a1c[_0x5fd5('0x2c')]);_0x545e91[_0x5fd5('0x2e')]=_[_0x5fd5('0x2f')](_0x545e91[_0x5fd5('0x30')],_0x545e91[_0x5fd5('0x2c')]);_0xfbb246[_0x5fd5('0x31')]=_[_0x5fd5('0x2f')](_0x545e91[_0x5fd5('0x30')],qs['fields'](_0x3f3a1c[_0x5fd5('0x2c')]['fields']));_0xfbb246[_0x5fd5('0x31')]=_0xfbb246['attributes'][_0x5fd5('0x32')]?_0xfbb246[_0x5fd5('0x31')]:_0x545e91[_0x5fd5('0x30')];if(!_0x3f3a1c[_0x5fd5('0x2c')][_0x5fd5('0x33')](_0x5fd5('0x34'))){_0xfbb246[_0x5fd5('0x1a')]=qs[_0x5fd5('0x1a')](_0x3f3a1c['query']['limit']);_0xfbb246[_0x5fd5('0x19')]=qs[_0x5fd5('0x19')](_0x3f3a1c[_0x5fd5('0x2c')][_0x5fd5('0x19')]);}_0xfbb246[_0x5fd5('0x35')]=qs['sort'](_0x3f3a1c[_0x5fd5('0x2c')][_0x5fd5('0x36')]);_0xfbb246[_0x5fd5('0x37')]=qs[_0x5fd5('0x2e')](_[_0x5fd5('0x38')](_0x3f3a1c[_0x5fd5('0x2c')],_0x545e91[_0x5fd5('0x2e')]),_0xdd392a);if(_0x3f3a1c[_0x5fd5('0x2c')][_0x5fd5('0x39')]){_0xfbb246[_0x5fd5('0x37')]=_[_0x5fd5('0x3a')](_0xfbb246['where'],{'$or':_['map'](_0xdd392a,function(_0x3aa7bb){if(_0x3aa7bb['type']!==_0x5fd5('0x3b')){var _0x4977af={};_0x4977af[_0x3aa7bb[_0x5fd5('0x25')]]={'$like':'%'+_0x3f3a1c[_0x5fd5('0x2c')][_0x5fd5('0x39')]+'%'};return _0x4977af;}})});}_0xfbb246=_[_0x5fd5('0x3a')]({},_0xfbb246,_0x3f3a1c['options']);var _0xedb8da={'where':_0xfbb246[_0x5fd5('0x37')]};return db[_0x5fd5('0x29')][_0x5fd5('0x3c')](_0xedb8da)[_0x5fd5('0x21')](function(_0x42d3e4){_0x48bdf2[_0x5fd5('0x3c')]=_0x42d3e4;if(_0x3f3a1c[_0x5fd5('0x2c')][_0x5fd5('0x3d')]){_0xfbb246[_0x5fd5('0x3e')]=[{'all':!![]}];}return db[_0x5fd5('0x29')][_0x5fd5('0x3f')](_0xfbb246);})[_0x5fd5('0x21')](function(_0x3c098a){_0x48bdf2[_0x5fd5('0x40')]=_0x3c098a;return _0x48bdf2;})['then'](respondWithFilteredResult(_0x4b3aa8,_0xfbb246))[_0x5fd5('0x41')](handleError(_0x4b3aa8,null));};exports[_0x5fd5('0x42')]=function(_0x4c428d,_0x2e8693){var _0x5ab911={'raw':!![],'where':{'id':_0x4c428d[_0x5fd5('0x43')]['id']}},_0x2b2956={};_0x2b2956['model']=_[_0x5fd5('0x2d')](db[_0x5fd5('0x29')][_0x5fd5('0x2a')]);_0x2b2956['query']=_['keys'](_0x4c428d[_0x5fd5('0x2c')]);_0x2b2956[_0x5fd5('0x2e')]=_[_0x5fd5('0x2f')](_0x2b2956[_0x5fd5('0x30')],_0x2b2956[_0x5fd5('0x2c')]);_0x5ab911[_0x5fd5('0x31')]=_['intersection'](_0x2b2956['model'],qs[_0x5fd5('0x44')](_0x4c428d['query'][_0x5fd5('0x44')]));_0x5ab911[_0x5fd5('0x31')]=_0x5ab911['attributes'][_0x5fd5('0x32')]?_0x5ab911['attributes']:_0x2b2956[_0x5fd5('0x30')];if(_0x4c428d[_0x5fd5('0x2c')][_0x5fd5('0x3d')]){_0x5ab911[_0x5fd5('0x3e')]=[{'all':!![]}];}_0x5ab911=_[_0x5fd5('0x3a')]({},_0x5ab911,_0x4c428d['options']);return db[_0x5fd5('0x29')][_0x5fd5('0x45')](_0x5ab911)[_0x5fd5('0x21')](handleEntityNotFound(_0x2e8693,null))['then'](respondWithResult(_0x2e8693,null))[_0x5fd5('0x41')](handleError(_0x2e8693,null));};exports[_0x5fd5('0x46')]=function(_0x27cf5b,_0x3cbf29){return db['Cdr'][_0x5fd5('0x46')](_0x27cf5b['body'],{})['then'](respondWithResult(_0x3cbf29,0xc9))[_0x5fd5('0x41')](handleError(_0x3cbf29,null));};exports[_0x5fd5('0x20')]=function(_0x57546c,_0x5d7d95){if(_0x57546c[_0x5fd5('0x47')]['id']){delete _0x57546c[_0x5fd5('0x47')]['id'];}return db['Cdr'][_0x5fd5('0x45')]({'where':{'id':_0x57546c['params']['id']}})[_0x5fd5('0x21')](handleEntityNotFound(_0x5d7d95,null))['then'](saveUpdates(_0x57546c[_0x5fd5('0x47')],null))[_0x5fd5('0x21')](respondWithResult(_0x5d7d95,null))[_0x5fd5('0x41')](handleError(_0x5d7d95,null));};exports[_0x5fd5('0x22')]=function(_0x5b1b8f,_0x3ec0af){return db[_0x5fd5('0x29')][_0x5fd5('0x45')]({'where':{'id':_0x5b1b8f[_0x5fd5('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ec0af,null))[_0x5fd5('0x21')](removeEntity(_0x3ec0af,null))[_0x5fd5('0x41')](handleError(_0x3ec0af,null));};exports[_0x5fd5('0x48')]=function(_0x1909c4,_0x2af9cf){return db[_0x5fd5('0x29')][_0x5fd5('0x48')]()[_0x5fd5('0x21')](respondWithResult(_0x2af9cf,null))['catch'](handleError(_0x2af9cf,null));}; \ No newline at end of file +var _0x0138=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','count','offset','Content-Range','json','apply','save','then','destroy','error','name','send','index','map','Cdr','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','length','create','update','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1302e6,_0x41dcb9){var _0x17a8b9=function(_0x283ecf){while(--_0x283ecf){_0x1302e6['push'](_0x1302e6['shift']());}};_0x17a8b9(++_0x41dcb9);}(_0x0138,0x1e6));var _0x8013=function(_0x159ed0,_0xc70853){_0x159ed0=_0x159ed0-0x0;var _0x5cdd55=_0x0138[_0x159ed0];return _0x5cdd55;};'use strict';var pdf=require(_0x8013('0x0'));var emlformat=require(_0x8013('0x1'));var rimraf=require(_0x8013('0x2'));var zipdir=require(_0x8013('0x3'));var jsonpatch=require(_0x8013('0x4'));var rp=require(_0x8013('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8013('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8013('0x7'));var csv=require(_0x8013('0x8'));var ejs=require(_0x8013('0x9'));var fs=require('fs');var _=require(_0x8013('0xa'));var squel=require(_0x8013('0xb'));var crypto=require(_0x8013('0xc'));var jsforce=require(_0x8013('0xd'));var deskjs=require(_0x8013('0xe'));var toCsv=require(_0x8013('0x8'));var querystring=require(_0x8013('0xf'));var Papa=require(_0x8013('0x10'));var Redis=require(_0x8013('0x11'));var authService=require(_0x8013('0x12'));var qs=require(_0x8013('0x13'));var as=require(_0x8013('0x14'));var hardwareService=require(_0x8013('0x15'));var logger=require(_0x8013('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x8013('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c5a75,_0x2916c1){_0x2916c1=_0x2916c1||0xcc;return function(_0x19a8f2){if(_0x19a8f2){return _0x4c5a75[_0x8013('0x18')](_0x2916c1);}return _0x4c5a75[_0x8013('0x19')](_0x2916c1)[_0x8013('0x1a')]();};}function respondWithResult(_0xef51c9,_0x1f2c2f){_0x1f2c2f=_0x1f2c2f||0xc8;return function(_0x212545){if(_0x212545){return _0xef51c9[_0x8013('0x19')](_0x1f2c2f)['json'](_0x212545);}};}function respondWithFilteredResult(_0x2a681b,_0x41ff90){return function(_0xe79713){if(_0xe79713){var _0x17397f=_0xe79713[_0x8013('0x1b')],_0x4447b4=_0x41ff90[_0x8013('0x1c')],_0x3e9c5b=_0x41ff90['offset']+_0x41ff90['limit'],_0x359567;if(_0x3e9c5b>=_0x17397f){_0x3e9c5b=_0x17397f;_0x359567=0xc8;}else{_0x359567=0xce;}_0x2a681b['status'](_0x359567);return _0x2a681b['set'](_0x8013('0x1d'),_0x4447b4+'-'+_0x3e9c5b+'/'+_0x17397f)[_0x8013('0x1e')](_0xe79713);}return null;};}function patchUpdates(_0x27cd99){return function(_0x312f92){try{jsonpatch[_0x8013('0x1f')](_0x312f92,_0x27cd99,!![]);}catch(_0x4e9d6c){return BPromise['reject'](_0x4e9d6c);}return _0x312f92[_0x8013('0x20')]();};}function saveUpdates(_0x528608,_0x188615){return function(_0x251df4){if(_0x251df4){return _0x251df4['update'](_0x528608)[_0x8013('0x21')](function(_0x4f0f5c){return _0x4f0f5c;});}return null;};}function removeEntity(_0x234ed2,_0x3d2720){return function(_0x3b32cb){if(_0x3b32cb){return _0x3b32cb[_0x8013('0x22')]()[_0x8013('0x21')](function(){_0x234ed2[_0x8013('0x19')](0xcc)[_0x8013('0x1a')]();});}};}function handleEntityNotFound(_0x1f537d,_0x1abc93){return function(_0x2493e9){if(!_0x2493e9){_0x1f537d['sendStatus'](0x194);}return _0x2493e9;};}function handleError(_0x5d236d,_0x1e6345){_0x1e6345=_0x1e6345||0x1f4;return function(_0x101049){logger[_0x8013('0x23')](_0x101049['stack']);if(_0x101049[_0x8013('0x24')]){delete _0x101049['name'];}_0x5d236d[_0x8013('0x19')](_0x1e6345)[_0x8013('0x25')](_0x101049);};}exports[_0x8013('0x26')]=function(_0x3803a9,_0x12ab80){var _0x27b8e6={},_0x20fc07={},_0x3d637a={'count':0x0,'rows':[]};var _0x44e7ad=_[_0x8013('0x27')](db[_0x8013('0x28')]['rawAttributes'],function(_0x115a43){return{'name':_0x115a43[_0x8013('0x29')],'type':_0x115a43['type'][_0x8013('0x2a')]};});_0x20fc07[_0x8013('0x2b')]=_[_0x8013('0x27')](_0x44e7ad,_0x8013('0x24'));_0x20fc07[_0x8013('0x2c')]=_[_0x8013('0x2d')](_0x3803a9['query']);_0x20fc07[_0x8013('0x2e')]=_[_0x8013('0x2f')](_0x20fc07[_0x8013('0x2b')],_0x20fc07[_0x8013('0x2c')]);_0x27b8e6[_0x8013('0x30')]=_['intersection'](_0x20fc07[_0x8013('0x2b')],qs[_0x8013('0x31')](_0x3803a9[_0x8013('0x2c')][_0x8013('0x31')]));_0x27b8e6[_0x8013('0x30')]=_0x27b8e6[_0x8013('0x30')]['length']?_0x27b8e6[_0x8013('0x30')]:_0x20fc07[_0x8013('0x2b')];if(!_0x3803a9[_0x8013('0x2c')][_0x8013('0x32')](_0x8013('0x33'))){_0x27b8e6['limit']=qs[_0x8013('0x34')](_0x3803a9[_0x8013('0x2c')][_0x8013('0x34')]);_0x27b8e6[_0x8013('0x1c')]=qs[_0x8013('0x1c')](_0x3803a9['query'][_0x8013('0x1c')]);}_0x27b8e6[_0x8013('0x35')]=qs['sort'](_0x3803a9['query']['sort']);_0x27b8e6[_0x8013('0x36')]=qs[_0x8013('0x2e')](_[_0x8013('0x37')](_0x3803a9[_0x8013('0x2c')],_0x20fc07[_0x8013('0x2e')]),_0x44e7ad);if(_0x3803a9[_0x8013('0x2c')][_0x8013('0x38')]){_0x27b8e6['where']=_[_0x8013('0x39')](_0x27b8e6[_0x8013('0x36')],{'$or':_[_0x8013('0x27')](_0x44e7ad,function(_0x2739e5){if(_0x2739e5['type']!=='VIRTUAL'){var _0x8065c7={};_0x8065c7[_0x2739e5[_0x8013('0x24')]]={'$like':'%'+_0x3803a9[_0x8013('0x2c')]['filter']+'%'};return _0x8065c7;}})});}_0x27b8e6=_['merge']({},_0x27b8e6,_0x3803a9[_0x8013('0x3a')]);var _0x3cdc7c={'where':_0x27b8e6[_0x8013('0x36')]};return db[_0x8013('0x28')][_0x8013('0x1b')](_0x3cdc7c)[_0x8013('0x21')](function(_0x16cfbc){_0x3d637a['count']=_0x16cfbc;if(_0x3803a9['query'][_0x8013('0x3b')]){_0x27b8e6[_0x8013('0x3c')]=[{'all':!![]}];}return db['Cdr']['findAll'](_0x27b8e6);})[_0x8013('0x21')](function(_0x20db2f){_0x3d637a[_0x8013('0x3d')]=_0x20db2f;return _0x3d637a;})[_0x8013('0x21')](respondWithFilteredResult(_0x12ab80,_0x27b8e6))[_0x8013('0x3e')](handleError(_0x12ab80,null));};exports[_0x8013('0x3f')]=function(_0xde1590,_0x133e17){var _0x5c49cf={'raw':!![],'where':{'id':_0xde1590[_0x8013('0x40')]['id']}},_0x2b45f7={};_0x2b45f7[_0x8013('0x2b')]=_['keys'](db['Cdr'][_0x8013('0x41')]);_0x2b45f7['query']=_[_0x8013('0x2d')](_0xde1590['query']);_0x2b45f7[_0x8013('0x2e')]=_[_0x8013('0x2f')](_0x2b45f7[_0x8013('0x2b')],_0x2b45f7['query']);_0x5c49cf[_0x8013('0x30')]=_[_0x8013('0x2f')](_0x2b45f7[_0x8013('0x2b')],qs[_0x8013('0x31')](_0xde1590['query']['fields']));_0x5c49cf[_0x8013('0x30')]=_0x5c49cf[_0x8013('0x30')][_0x8013('0x42')]?_0x5c49cf[_0x8013('0x30')]:_0x2b45f7[_0x8013('0x2b')];if(_0xde1590[_0x8013('0x2c')][_0x8013('0x3b')]){_0x5c49cf['include']=[{'all':!![]}];}_0x5c49cf=_[_0x8013('0x39')]({},_0x5c49cf,_0xde1590[_0x8013('0x3a')]);return db['Cdr']['find'](_0x5c49cf)[_0x8013('0x21')](handleEntityNotFound(_0x133e17,null))[_0x8013('0x21')](respondWithResult(_0x133e17,null))[_0x8013('0x3e')](handleError(_0x133e17,null));};exports[_0x8013('0x43')]=function(_0x404295,_0x23e752){return db[_0x8013('0x28')][_0x8013('0x43')](_0x404295['body'],{})[_0x8013('0x21')](respondWithResult(_0x23e752,0xc9))['catch'](handleError(_0x23e752,null));};exports[_0x8013('0x44')]=function(_0x3e69eb,_0x53d151){if(_0x3e69eb['body']['id']){delete _0x3e69eb['body']['id'];}return db[_0x8013('0x28')]['find']({'where':{'id':_0x3e69eb[_0x8013('0x40')]['id']}})['then'](handleEntityNotFound(_0x53d151,null))['then'](saveUpdates(_0x3e69eb[_0x8013('0x45')],null))[_0x8013('0x21')](respondWithResult(_0x53d151,null))[_0x8013('0x3e')](handleError(_0x53d151,null));};exports[_0x8013('0x22')]=function(_0x43b188,_0x3f149e){return db['Cdr'][_0x8013('0x46')]({'where':{'id':_0x43b188[_0x8013('0x40')]['id']}})[_0x8013('0x21')](handleEntityNotFound(_0x3f149e,null))[_0x8013('0x21')](removeEntity(_0x3f149e,null))[_0x8013('0x3e')](handleError(_0x3f149e,null));};exports['describe']=function(_0x10c97f,_0x53af68){return db[_0x8013('0x28')][_0x8013('0x47')]()[_0x8013('0x21')](respondWithResult(_0x53af68,null))['catch'](handleError(_0x53af68,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 3fbe7d6..63403d5 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 _0x2542=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid'];(function(_0x4eeece,_0x5d0f4c){var _0xc5062e=function(_0x99e3df){while(--_0x99e3df){_0x4eeece['push'](_0x4eeece['shift']());}};_0xc5062e(++_0x5d0f4c);}(_0x2542,0x169));var _0x2254=function(_0x188134,_0x22e4c8){_0x188134=_0x188134-0x0;var _0x486f04=_0x2542[_0x188134];return _0x486f04;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));module[_0x2254('0x9')]=function(_0x508183,_0x19ad3c){return _0x508183[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[{'name':_0x2254('0xd'),'fields':[_0x2254('0xd')]},{'name':_0x2254('0xe'),'fields':[_0x2254('0xe')]},{'name':_0x2254('0xf'),'fields':[_0x2254('0xf')]},{'name':_0x2254('0x10'),'fields':['dst']},{'name':_0x2254('0x11'),'fields':[_0x2254('0x11')]},{'name':_0x2254('0x12'),'fields':[_0x2254('0x12')]}],'timestamps':![]});}; \ No newline at end of file +var _0x90b1=['path','rimraf','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x22bb21,_0x3efcf3){var _0x44b721=function(_0x4fd953){while(--_0x4fd953){_0x22bb21['push'](_0x22bb21['shift']());}};_0x44b721(++_0x3efcf3);}(_0x90b1,0x1bb));var _0x190b=function(_0x48ae62,_0x3cfce7){_0x48ae62=_0x48ae62-0x0;var _0x2634a6=_0x90b1[_0x48ae62];return _0x2634a6;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./cdr.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xa')]},{'name':_0x190b('0xb'),'fields':['calldate']},{'name':_0x190b('0xc'),'fields':[_0x190b('0xc')]},{'name':_0x190b('0xd'),'fields':[_0x190b('0xd')]},{'name':_0x190b('0xe'),'fields':[_0x190b('0xe')]},{'name':_0x190b('0xf'),'fields':[_0x190b('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index b7081f4..71fb031 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 _0xea02=['../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Cdr,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x54dc26,_0x2d2998){var _0x5dbe3a=function(_0x232ec5){while(--_0x232ec5){_0x54dc26['push'](_0x54dc26['shift']());}};_0x5dbe3a(++_0x2d2998);}(_0xea02,0x16a));var _0x2ea0=function(_0x5f058f,_0x332e1b){_0x5f058f=_0x5f058f-0x0;var _0x15fcad=_0xea02[_0x5f058f];return _0x15fcad;};'use strict';var _=require(_0x2ea0('0x0'));var util=require(_0x2ea0('0x1'));var moment=require(_0x2ea0('0x2'));var BPromise=require('bluebird');var rs=require(_0x2ea0('0x3'));var fs=require('fs');var Redis=require(_0x2ea0('0x4'));var db=require(_0x2ea0('0x5'))['db'];var utils=require(_0x2ea0('0x6'));var logger=require(_0x2ea0('0x7'))(_0x2ea0('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2ea0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ba214,_0x2f7a1a,_0x4c892c){return new BPromise(function(_0x4b0799,_0x3fb74c){return client[_0x2ea0('0xa')](_0x4ba214,_0x4c892c)[_0x2ea0('0xb')](function(_0x4eb5cc){logger[_0x2ea0('0xc')]('Cdr,\x20%s,\x20%s',_0x2f7a1a,_0x2ea0('0xd'));logger[_0x2ea0('0xe')](_0x2ea0('0xf'),_0x2f7a1a,_0x2ea0('0xd'),JSON[_0x2ea0('0x10')](_0x4eb5cc));if(_0x4eb5cc[_0x2ea0('0x11')]){if(_0x4eb5cc[_0x2ea0('0x11')][_0x2ea0('0x12')]===0x1f4){logger[_0x2ea0('0x11')]('Cdr,\x20%s,\x20%s',_0x2f7a1a,_0x4eb5cc['error'][_0x2ea0('0x13')]);return _0x3fb74c(_0x4eb5cc[_0x2ea0('0x11')][_0x2ea0('0x13')]);}logger[_0x2ea0('0x11')](_0x2ea0('0x14'),_0x2f7a1a,_0x4eb5cc[_0x2ea0('0x11')]['message']);return _0x4b0799(_0x4eb5cc[_0x2ea0('0x11')][_0x2ea0('0x13')]);}else{logger[_0x2ea0('0xc')](_0x2ea0('0x14'),_0x2f7a1a,_0x2ea0('0xd'));_0x4b0799(_0x4eb5cc[_0x2ea0('0x15')][_0x2ea0('0x13')]);}})[_0x2ea0('0x16')](function(_0x1862a1){logger[_0x2ea0('0x11')](_0x2ea0('0x14'),_0x2f7a1a,_0x1862a1);_0x3fb74c(_0x1862a1);});});} \ No newline at end of file +var _0x145f=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x145f,0x191));var _0xf145=function(_0x5587d0,_0x1085a3){_0x5587d0=_0x5587d0-0x0;var _0x35f085=_0x145f[_0x5587d0];return _0x35f085;};'use strict';var _=require(_0xf145('0x0'));var util=require(_0xf145('0x1'));var moment=require(_0xf145('0x2'));var BPromise=require(_0xf145('0x3'));var rs=require(_0xf145('0x4'));var fs=require('fs');var Redis=require(_0xf145('0x5'));var db=require(_0xf145('0x6'))['db'];var utils=require(_0xf145('0x7'));var logger=require(_0xf145('0x8'))(_0xf145('0x9'));var config=require(_0xf145('0xa'));var jayson=require(_0xf145('0xb'));var client=jayson[_0xf145('0xc')][_0xf145('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4fee37,_0x3428fc,_0x1cf18a){return new BPromise(function(_0x2578e8,_0x3186cb){return client[_0xf145('0xe')](_0x4fee37,_0x1cf18a)[_0xf145('0xf')](function(_0x91d553){logger['info'](_0xf145('0x10'),_0x3428fc,_0xf145('0x11'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x3428fc,_0xf145('0x11'),JSON[_0xf145('0x12')](_0x91d553));if(_0x91d553['error']){if(_0x91d553[_0xf145('0x13')][_0xf145('0x14')]===0x1f4){logger[_0xf145('0x13')]('Cdr,\x20%s,\x20%s',_0x3428fc,_0x91d553[_0xf145('0x13')]['message']);return _0x3186cb(_0x91d553['error'][_0xf145('0x15')]);}logger[_0xf145('0x13')](_0xf145('0x10'),_0x3428fc,_0x91d553[_0xf145('0x13')][_0xf145('0x15')]);return _0x2578e8(_0x91d553[_0xf145('0x13')][_0xf145('0x15')]);}else{logger[_0xf145('0x16')](_0xf145('0x10'),_0x3428fc,_0xf145('0x11'));_0x2578e8(_0x91d553[_0xf145('0x17')][_0xf145('0x15')]);}})[_0xf145('0x18')](function(_0x43b32a){logger[_0xf145('0x13')](_0xf145('0x10'),_0x3428fc,_0x43b32a);_0x3186cb(_0x43b32a);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 4c095a8..6e11759 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 _0x78d2=['index','/describe','isAuthenticated','describe','/:id','post','put','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x22332d,_0x34a4da){var _0x4cbd3d=function(_0x49fbe9){while(--_0x49fbe9){_0x22332d['push'](_0x22332d['shift']());}};_0x4cbd3d(++_0x34a4da);}(_0x78d2,0xcf));var _0x278d=function(_0x5dac46,_0x28e9dc){_0x5dac46=_0x5dac46-0x0;var _0x51095c=_0x78d2[_0x5dac46];return _0x51095c;};'use strict';var multer=require(_0x278d('0x0'));var util=require(_0x278d('0x1'));var path=require(_0x278d('0x2'));var timeout=require(_0x278d('0x3'));var express=require(_0x278d('0x4'));var router=express['Router']();var auth=require(_0x278d('0x5'));var interaction=require(_0x278d('0x6'));var config=require(_0x278d('0x7'));var controller=require('./cdr.controller');router[_0x278d('0x8')]('/',auth['isAuthenticated'](),controller[_0x278d('0x9')]);router[_0x278d('0x8')](_0x278d('0xa'),auth[_0x278d('0xb')](),controller[_0x278d('0xc')]);router[_0x278d('0x8')](_0x278d('0xd'),auth[_0x278d('0xb')](),controller['show']);router[_0x278d('0xe')]('/',auth[_0x278d('0xb')](),controller['create']);router[_0x278d('0xf')](_0x278d('0xd'),auth[_0x278d('0xb')](),controller[_0x278d('0x10')]);router[_0x278d('0x11')](_0x278d('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x882e=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','isAuthenticated','get','/describe','describe','/:id','show','create','delete'];(function(_0x33f95c,_0x4b2e80){var _0x581952=function(_0x37ea19){while(--_0x37ea19){_0x33f95c['push'](_0x33f95c['shift']());}};_0x581952(++_0x4b2e80);}(_0x882e,0x1dd));var _0xe882=function(_0x9e838b,_0x2df08d){_0x9e838b=_0x9e838b-0x0;var _0x1f1a90=_0x882e[_0x9e838b];return _0x1f1a90;};'use strict';var multer=require(_0xe882('0x0'));var util=require(_0xe882('0x1'));var path=require(_0xe882('0x2'));var timeout=require(_0xe882('0x3'));var express=require(_0xe882('0x4'));var router=express['Router']();var auth=require(_0xe882('0x5'));var interaction=require(_0xe882('0x6'));var config=require(_0xe882('0x7'));var controller=require(_0xe882('0x8'));router['get']('/',auth[_0xe882('0x9')](),controller['index']);router[_0xe882('0xa')](_0xe882('0xb'),auth['isAuthenticated'](),controller[_0xe882('0xc')]);router['get'](_0xe882('0xd'),auth[_0xe882('0x9')](),controller[_0xe882('0xe')]);router['post']('/',auth[_0xe882('0x9')](),controller[_0xe882('0xf')]);router['put'](_0xe882('0xd'),auth[_0xe882('0x9')](),controller['update']);router[_0xe882('0x10')](_0xe882('0xd'),auth[_0xe882('0x9')](),controller[_0xe882('0x11')]);module[_0xe882('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 280db22..44186ce 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 _0x96f0=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x3c41d0,_0x1f90bc){var _0x1118bf=function(_0xba3f49){while(--_0xba3f49){_0x3c41d0['push'](_0x3c41d0['shift']());}};_0x1118bf(++_0x1f90bc);}(_0x96f0,0x102));var _0x096f=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0x96f0[_0x3a9661];return _0x5bb119;};'use strict';var Sequelize=require(_0x096f('0x0'));module[_0x096f('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x096f('0x2')],'allowNull':![],'defaultValue':_0x096f('0x3')},'appdata':{'type':Sequelize[_0x096f('0x4')]()},'description':{'type':Sequelize[_0x096f('0x2')]},'interval':{'type':Sequelize[_0x096f('0x2')],'defaultValue':_0x096f('0x5')}}; \ No newline at end of file +var _0xcc9f=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x3e4baf,_0xb6683e){var _0x7fc674=function(_0x1569ab){while(--_0x1569ab){_0x3e4baf['push'](_0x3e4baf['shift']());}};_0x7fc674(++_0xb6683e);}(_0xcc9f,0xea));var _0xfcc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc9f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfcc9('0x0'));module[_0xfcc9('0x1')]={'priority':{'type':Sequelize[_0xfcc9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xfcc9('0x3')],'allowNull':![],'defaultValue':_0xfcc9('0x4')},'appdata':{'type':Sequelize[_0xfcc9('0x5')]()},'description':{'type':Sequelize[_0xfcc9('0x3')]},'interval':{'type':Sequelize[_0xfcc9('0x3')],'defaultValue':_0xfcc9('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 49f8213..d4c7ee0 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 _0xa6b1=['end','status','json','count','offset','limit','Content-Range','apply','save','then','error','stack','name','send','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','include','options','find','catch','update','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus'];(function(_0x50432c,_0x16c10e){var _0x556db5=function(_0x238b45){while(--_0x238b45){_0x50432c['push'](_0x50432c['shift']());}};_0x556db5(++_0x16c10e);}(_0xa6b1,0x16f));var _0x1a6b=function(_0x575bac,_0x34d716){_0x575bac=_0x575bac-0x0;var _0x8aa06a=_0xa6b1[_0x575bac];return _0x8aa06a;};'use strict';var pdf=require(_0x1a6b('0x0'));var emlformat=require(_0x1a6b('0x1'));var rimraf=require(_0x1a6b('0x2'));var zipdir=require(_0x1a6b('0x3'));var jsonpatch=require(_0x1a6b('0x4'));var rp=require('request-promise');var moment=require(_0x1a6b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1a6b('0x6'));var util=require(_0x1a6b('0x7'));var path=require(_0x1a6b('0x8'));var sox=require('sox');var csv=require(_0x1a6b('0x9'));var ejs=require(_0x1a6b('0xa'));var fs=require('fs');var _=require(_0x1a6b('0xb'));var squel=require('squel');var crypto=require(_0x1a6b('0xc'));var jsforce=require(_0x1a6b('0xd'));var deskjs=require(_0x1a6b('0xe'));var toCsv=require(_0x1a6b('0x9'));var querystring=require(_0x1a6b('0xf'));var Papa=require(_0x1a6b('0x10'));var Redis=require(_0x1a6b('0x11'));var authService=require(_0x1a6b('0x12'));var qs=require(_0x1a6b('0x13'));var as=require(_0x1a6b('0x14'));var hardwareService=require(_0x1a6b('0x15'));var logger=require('../../config/logger')(_0x1a6b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1a6b('0x17'))['db'];function respondWithStatusCode(_0x28d287,_0xf7f569){_0xf7f569=_0xf7f569||0xcc;return function(_0x2472d4){if(_0x2472d4){return _0x28d287[_0x1a6b('0x18')](_0xf7f569);}return _0x28d287['status'](_0xf7f569)[_0x1a6b('0x19')]();};}function respondWithResult(_0x1dab4f,_0x551ebc){_0x551ebc=_0x551ebc||0xc8;return function(_0x564800){if(_0x564800){return _0x1dab4f[_0x1a6b('0x1a')](_0x551ebc)[_0x1a6b('0x1b')](_0x564800);}};}function respondWithFilteredResult(_0x445df4,_0x262b14){return function(_0x533c4){if(_0x533c4){var _0x17271d=_0x533c4[_0x1a6b('0x1c')],_0x1cb756=_0x262b14['offset'],_0x4ccf93=_0x262b14[_0x1a6b('0x1d')]+_0x262b14[_0x1a6b('0x1e')],_0x41c648;if(_0x4ccf93>=_0x17271d){_0x4ccf93=_0x17271d;_0x41c648=0xc8;}else{_0x41c648=0xce;}_0x445df4[_0x1a6b('0x1a')](_0x41c648);return _0x445df4['set'](_0x1a6b('0x1f'),_0x1cb756+'-'+_0x4ccf93+'/'+_0x17271d)['json'](_0x533c4);}return null;};}function patchUpdates(_0x516e2c){return function(_0x3337da){try{jsonpatch[_0x1a6b('0x20')](_0x3337da,_0x516e2c,!![]);}catch(_0x198db9){return BPromise['reject'](_0x198db9);}return _0x3337da[_0x1a6b('0x21')]();};}function saveUpdates(_0x2303ea,_0x5e6f1e){return function(_0x4e0834){if(_0x4e0834){return _0x4e0834['update'](_0x2303ea)[_0x1a6b('0x22')](function(_0x35287c){return _0x35287c;});}return null;};}function removeEntity(_0xcb8ad0,_0xf1486f){return function(_0x3eaa55){if(_0x3eaa55){return _0x3eaa55['destroy']()[_0x1a6b('0x22')](function(){_0xcb8ad0[_0x1a6b('0x1a')](0xcc)[_0x1a6b('0x19')]();});}};}function handleEntityNotFound(_0x35dc46,_0x35021b){return function(_0x5d90f8){if(!_0x5d90f8){_0x35dc46[_0x1a6b('0x18')](0x194);}return _0x5d90f8;};}function handleError(_0x26c5be,_0x556bde){_0x556bde=_0x556bde||0x1f4;return function(_0x488a6e){logger[_0x1a6b('0x23')](_0x488a6e[_0x1a6b('0x24')]);if(_0x488a6e[_0x1a6b('0x25')]){delete _0x488a6e[_0x1a6b('0x25')];}_0x26c5be[_0x1a6b('0x1a')](_0x556bde)[_0x1a6b('0x26')](_0x488a6e);};}exports['show']=function(_0x380664,_0x48b907){var _0xef622e={'raw':!![],'where':{'id':_0x380664[_0x1a6b('0x27')]['id']}},_0x255c90={};_0x255c90[_0x1a6b('0x28')]=_[_0x1a6b('0x29')](db[_0x1a6b('0x2a')][_0x1a6b('0x2b')]);_0x255c90[_0x1a6b('0x2c')]=_['keys'](_0x380664[_0x1a6b('0x2c')]);_0x255c90[_0x1a6b('0x2d')]=_[_0x1a6b('0x2e')](_0x255c90['model'],_0x255c90[_0x1a6b('0x2c')]);_0xef622e[_0x1a6b('0x2f')]=_['intersection'](_0x255c90['model'],qs['fields'](_0x380664['query'][_0x1a6b('0x30')]));_0xef622e[_0x1a6b('0x2f')]=_0xef622e[_0x1a6b('0x2f')]['length']?_0xef622e[_0x1a6b('0x2f')]:_0x255c90['model'];if(_0x380664[_0x1a6b('0x2c')]['includeAll']){_0xef622e[_0x1a6b('0x31')]=[{'all':!![]}];}_0xef622e=_['merge']({},_0xef622e,_0x380664[_0x1a6b('0x32')]);return db[_0x1a6b('0x2a')][_0x1a6b('0x33')](_0xef622e)['then'](handleEntityNotFound(_0x48b907,null))[_0x1a6b('0x22')](respondWithResult(_0x48b907,null))[_0x1a6b('0x34')](handleError(_0x48b907,null));};exports[_0x1a6b('0x35')]=function(_0x24aa37,_0x2dd9b9){if(_0x24aa37['body']['id']){delete _0x24aa37[_0x1a6b('0x36')]['id'];}return db[_0x1a6b('0x2a')]['find']({'where':{'id':_0x24aa37[_0x1a6b('0x27')]['id']}})[_0x1a6b('0x22')](handleEntityNotFound(_0x2dd9b9,null))['then'](saveUpdates(_0x24aa37[_0x1a6b('0x36')],null))[_0x1a6b('0x22')](respondWithResult(_0x2dd9b9,null))['catch'](handleError(_0x2dd9b9,null));};exports[_0x1a6b('0x37')]=function(_0x5778b8,_0x1fba2d){return db['ChatApplication'][_0x1a6b('0x33')]({'where':{'id':_0x5778b8[_0x1a6b('0x27')]['id']}})[_0x1a6b('0x22')](handleEntityNotFound(_0x1fba2d,null))[_0x1a6b('0x22')](removeEntity(_0x1fba2d,null))[_0x1a6b('0x34')](handleError(_0x1fba2d,null));}; \ No newline at end of file +var _0x0f78=['length','includeAll','include','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','params','keys','ChatApplication','rawAttributes','query','filters','intersection','model','fields','attributes'];(function(_0x264b72,_0x1dfab8){var _0x1d21a8=function(_0x374429){while(--_0x374429){_0x264b72['push'](_0x264b72['shift']());}};_0x1d21a8(++_0x1dfab8);}(_0x0f78,0x1a7));var _0x80f7=function(_0x9cd200,_0x45b3f7){_0x9cd200=_0x9cd200-0x0;var _0x144312=_0x0f78[_0x9cd200];return _0x144312;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x80f7('0x0'));var rimraf=require(_0x80f7('0x1'));var zipdir=require(_0x80f7('0x2'));var jsonpatch=require(_0x80f7('0x3'));var rp=require(_0x80f7('0x4'));var moment=require('moment');var BPromise=require(_0x80f7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x80f7('0x6'));var sox=require(_0x80f7('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x80f7('0x8'));var squel=require('squel');var crypto=require(_0x80f7('0x9'));var jsforce=require(_0x80f7('0xa'));var deskjs=require(_0x80f7('0xb'));var toCsv=require(_0x80f7('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x80f7('0xd'));var authService=require(_0x80f7('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x80f7('0xf'));var hardwareService=require(_0x80f7('0x10'));var logger=require('../../config/logger')(_0x80f7('0x11'));var utils=require(_0x80f7('0x12'));var config=require(_0x80f7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x285b0f,_0x486321){_0x486321=_0x486321||0xcc;return function(_0x3f4478){if(_0x3f4478){return _0x285b0f['sendStatus'](_0x486321);}return _0x285b0f[_0x80f7('0x14')](_0x486321)['end']();};}function respondWithResult(_0x5c383a,_0x2c006e){_0x2c006e=_0x2c006e||0xc8;return function(_0x57e33f){if(_0x57e33f){return _0x5c383a[_0x80f7('0x14')](_0x2c006e)[_0x80f7('0x15')](_0x57e33f);}};}function respondWithFilteredResult(_0x186388,_0x2ed750){return function(_0x267839){if(_0x267839){var _0x536278=_0x267839[_0x80f7('0x16')],_0x55f6be=_0x2ed750[_0x80f7('0x17')],_0x3f8695=_0x2ed750[_0x80f7('0x17')]+_0x2ed750[_0x80f7('0x18')],_0x2c2f63;if(_0x3f8695>=_0x536278){_0x3f8695=_0x536278;_0x2c2f63=0xc8;}else{_0x2c2f63=0xce;}_0x186388['status'](_0x2c2f63);return _0x186388[_0x80f7('0x19')]('Content-Range',_0x55f6be+'-'+_0x3f8695+'/'+_0x536278)[_0x80f7('0x15')](_0x267839);}return null;};}function patchUpdates(_0x55fe32){return function(_0x880e01){try{jsonpatch[_0x80f7('0x1a')](_0x880e01,_0x55fe32,!![]);}catch(_0x6a6c7f){return BPromise[_0x80f7('0x1b')](_0x6a6c7f);}return _0x880e01[_0x80f7('0x1c')]();};}function saveUpdates(_0x1fcfe8,_0x2362e4){return function(_0xd44354){if(_0xd44354){return _0xd44354[_0x80f7('0x1d')](_0x1fcfe8)[_0x80f7('0x1e')](function(_0xb88dfe){return _0xb88dfe;});}return null;};}function removeEntity(_0x516098,_0x4768a5){return function(_0x11efe0){if(_0x11efe0){return _0x11efe0[_0x80f7('0x1f')]()[_0x80f7('0x1e')](function(){_0x516098[_0x80f7('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f8230,_0x3a6e1c){return function(_0x6de1b5){if(!_0x6de1b5){_0x2f8230['sendStatus'](0x194);}return _0x6de1b5;};}function handleError(_0x24594b,_0x28206a){_0x28206a=_0x28206a||0x1f4;return function(_0x288b95){logger['error'](_0x288b95[_0x80f7('0x20')]);if(_0x288b95[_0x80f7('0x21')]){delete _0x288b95[_0x80f7('0x21')];}_0x24594b[_0x80f7('0x14')](_0x28206a)[_0x80f7('0x22')](_0x288b95);};}exports['show']=function(_0x48ca8a,_0x2269ad){var _0x255b2d={'raw':!![],'where':{'id':_0x48ca8a[_0x80f7('0x23')]['id']}},_0x45ae5d={};_0x45ae5d['model']=_[_0x80f7('0x24')](db[_0x80f7('0x25')][_0x80f7('0x26')]);_0x45ae5d[_0x80f7('0x27')]=_[_0x80f7('0x24')](_0x48ca8a[_0x80f7('0x27')]);_0x45ae5d[_0x80f7('0x28')]=_[_0x80f7('0x29')](_0x45ae5d['model'],_0x45ae5d[_0x80f7('0x27')]);_0x255b2d['attributes']=_['intersection'](_0x45ae5d[_0x80f7('0x2a')],qs['fields'](_0x48ca8a[_0x80f7('0x27')][_0x80f7('0x2b')]));_0x255b2d['attributes']=_0x255b2d[_0x80f7('0x2c')][_0x80f7('0x2d')]?_0x255b2d[_0x80f7('0x2c')]:_0x45ae5d[_0x80f7('0x2a')];if(_0x48ca8a[_0x80f7('0x27')][_0x80f7('0x2e')]){_0x255b2d[_0x80f7('0x2f')]=[{'all':!![]}];}_0x255b2d=_['merge']({},_0x255b2d,_0x48ca8a[_0x80f7('0x30')]);return db[_0x80f7('0x25')][_0x80f7('0x31')](_0x255b2d)[_0x80f7('0x1e')](handleEntityNotFound(_0x2269ad,null))[_0x80f7('0x1e')](respondWithResult(_0x2269ad,null))[_0x80f7('0x32')](handleError(_0x2269ad,null));};exports[_0x80f7('0x1d')]=function(_0x3980b6,_0x433c72){if(_0x3980b6[_0x80f7('0x33')]['id']){delete _0x3980b6[_0x80f7('0x33')]['id'];}return db[_0x80f7('0x25')]['find']({'where':{'id':_0x3980b6[_0x80f7('0x23')]['id']}})['then'](handleEntityNotFound(_0x433c72,null))[_0x80f7('0x1e')](saveUpdates(_0x3980b6[_0x80f7('0x33')],null))[_0x80f7('0x1e')](respondWithResult(_0x433c72,null))[_0x80f7('0x32')](handleError(_0x433c72,null));};exports[_0x80f7('0x1f')]=function(_0xba1db0,_0x7ae2b6){return db['ChatApplication'][_0x80f7('0x31')]({'where':{'id':_0xba1db0[_0x80f7('0x23')]['id']}})[_0x80f7('0x1e')](handleEntityNotFound(_0x7ae2b6,null))['then'](removeEntity(_0x7ae2b6,null))[_0x80f7('0x32')](handleError(_0x7ae2b6,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index b1d7da6..fa81c5b 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 023160b..2f47ca0 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 _0x2dce=['result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x193602,_0x57b52b){var _0x975e3f=function(_0x3c4881){while(--_0x3c4881){_0x193602['push'](_0x193602['shift']());}};_0x975e3f(++_0x57b52b);}(_0x2dce,0x141));var _0xe2dc=function(_0x9a1615,_0x5de3ff){_0x9a1615=_0x9a1615-0x0;var _0x4cf30d=_0x2dce[_0x9a1615];return _0x4cf30d;};'use strict';var _=require(_0xe2dc('0x0'));var util=require(_0xe2dc('0x1'));var moment=require(_0xe2dc('0x2'));var BPromise=require(_0xe2dc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2dc('0x4'))['db'];var utils=require(_0xe2dc('0x5'));var logger=require(_0xe2dc('0x6'))(_0xe2dc('0x7'));var config=require('../../config/environment');var jayson=require(_0xe2dc('0x8'));var client=jayson[_0xe2dc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b84fc,_0x46b4ed,_0x3bf84e){return new BPromise(function(_0x4d8e84,_0x2db545){return client[_0xe2dc('0xa')](_0x1b84fc,_0x3bf84e)[_0xe2dc('0xb')](function(_0x245374){logger[_0xe2dc('0xc')](_0xe2dc('0xd'),_0x46b4ed,_0xe2dc('0xe'));logger[_0xe2dc('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x46b4ed,_0xe2dc('0xe'),JSON[_0xe2dc('0x10')](_0x245374));if(_0x245374[_0xe2dc('0x11')]){if(_0x245374[_0xe2dc('0x11')]['code']===0x1f4){logger[_0xe2dc('0x11')](_0xe2dc('0xd'),_0x46b4ed,_0x245374[_0xe2dc('0x11')][_0xe2dc('0x12')]);return _0x2db545(_0x245374[_0xe2dc('0x11')][_0xe2dc('0x12')]);}logger['error'](_0xe2dc('0xd'),_0x46b4ed,_0x245374[_0xe2dc('0x11')]['message']);return _0x4d8e84(_0x245374[_0xe2dc('0x11')][_0xe2dc('0x12')]);}else{logger[_0xe2dc('0xc')]('ChatApplication,\x20%s,\x20%s',_0x46b4ed,_0xe2dc('0xe'));_0x4d8e84(_0x245374[_0xe2dc('0x13')]['message']);}})['catch'](function(_0x17361f){logger[_0xe2dc('0x11')](_0xe2dc('0xd'),_0x46b4ed,_0x17361f);_0x2db545(_0x17361f);});});} \ No newline at end of file +var _0x370a=['message','ChatApplication,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5eea19,_0x2be01e){var _0x35fa79=function(_0x5b8b7f){while(--_0x5b8b7f){_0x5eea19['push'](_0x5eea19['shift']());}};_0x35fa79(++_0x2be01e);}(_0x370a,0x7b));var _0xa370=function(_0x15570b,_0x1205a4){_0x15570b=_0x15570b-0x0;var _0x372528=_0x370a[_0x15570b];return _0x372528;};'use strict';var _=require(_0xa370('0x0'));var util=require(_0xa370('0x1'));var moment=require(_0xa370('0x2'));var BPromise=require(_0xa370('0x3'));var rs=require(_0xa370('0x4'));var fs=require('fs');var Redis=require(_0xa370('0x5'));var db=require(_0xa370('0x6'))['db'];var utils=require(_0xa370('0x7'));var logger=require(_0xa370('0x8'))('rpc');var config=require(_0xa370('0x9'));var jayson=require(_0xa370('0xa'));var client=jayson[_0xa370('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x373e94,_0x5ba01f,_0x1d6263){return new BPromise(function(_0x3463d1,_0x5eb2b9){return client[_0xa370('0xc')](_0x373e94,_0x1d6263)[_0xa370('0xd')](function(_0xf3be0d){logger[_0xa370('0xe')]('ChatApplication,\x20%s,\x20%s',_0x5ba01f,_0xa370('0xf'));logger[_0xa370('0x10')](_0xa370('0x11'),_0x5ba01f,_0xa370('0xf'),JSON[_0xa370('0x12')](_0xf3be0d));if(_0xf3be0d[_0xa370('0x13')]){if(_0xf3be0d[_0xa370('0x13')][_0xa370('0x14')]===0x1f4){logger[_0xa370('0x13')]('ChatApplication,\x20%s,\x20%s',_0x5ba01f,_0xf3be0d[_0xa370('0x13')][_0xa370('0x15')]);return _0x5eb2b9(_0xf3be0d[_0xa370('0x13')][_0xa370('0x15')]);}logger[_0xa370('0x13')](_0xa370('0x16'),_0x5ba01f,_0xf3be0d[_0xa370('0x13')][_0xa370('0x15')]);return _0x3463d1(_0xf3be0d[_0xa370('0x13')]['message']);}else{logger[_0xa370('0xe')](_0xa370('0x16'),_0x5ba01f,_0xa370('0xf'));_0x3463d1(_0xf3be0d['result'][_0xa370('0x15')]);}})[_0xa370('0x17')](function(_0x22ff89){logger[_0xa370('0x13')](_0xa370('0x16'),_0x5ba01f,_0x22ff89);_0x5eb2b9(_0x22ff89);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index d0afcfd..b925ac1 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 _0x088f=['./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0xcf48bc,_0x407cce){var _0x6ee65a=function(_0x237fd0){while(--_0x237fd0){_0xcf48bc['push'](_0xcf48bc['shift']());}};_0x6ee65a(++_0x407cce);}(_0x088f,0xac));var _0xf088=function(_0x156c4f,_0x34d8c4){_0x156c4f=_0x156c4f-0x0;var _0x59bda4=_0x088f[_0x156c4f];return _0x59bda4;};'use strict';var multer=require(_0xf088('0x0'));var util=require(_0xf088('0x1'));var path=require(_0xf088('0x2'));var timeout=require(_0xf088('0x3'));var express=require(_0xf088('0x4'));var router=express[_0xf088('0x5')]();var auth=require(_0xf088('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf088('0x7'));var controller=require(_0xf088('0x8'));router[_0xf088('0x9')](_0xf088('0xa'),auth[_0xf088('0xb')](),controller[_0xf088('0xc')]);router[_0xf088('0xd')](_0xf088('0xa'),auth[_0xf088('0xb')](),controller[_0xf088('0xe')]);router[_0xf088('0xf')](_0xf088('0xa'),auth['isAuthenticated'](),controller[_0xf088('0x10')]);module[_0xf088('0x11')]=router; \ No newline at end of file +var _0xa400=['delete','path','express','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','put','update'];(function(_0x442b41,_0x22dc53){var _0x140d06=function(_0x5afa6d){while(--_0x5afa6d){_0x442b41['push'](_0x442b41['shift']());}};_0x140d06(++_0x22dc53);}(_0xa400,0x1b9));var _0x0a40=function(_0x5ef0ae,_0x5ee137){_0x5ef0ae=_0x5ef0ae-0x0;var _0x196435=_0xa400[_0x5ef0ae];return _0x196435;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0a40('0x0'));var timeout=require('connect-timeout');var express=require(_0x0a40('0x1'));var router=express['Router']();var auth=require(_0x0a40('0x2'));var interaction=require(_0x0a40('0x3'));var config=require('../../config/environment');var controller=require(_0x0a40('0x4'));router[_0x0a40('0x5')](_0x0a40('0x6'),auth[_0x0a40('0x7')](),controller['show']);router[_0x0a40('0x8')](_0x0a40('0x6'),auth['isAuthenticated'](),controller[_0x0a40('0x9')]);router[_0x0a40('0xa')]('/:id',auth[_0x0a40('0x7')](),controller['destroy']);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 b7af960..3a0a663 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 _0x910c=['sequelize','exports','STRING','BOOLEAN'];(function(_0x417ea3,_0x156e87){var _0x18c29d=function(_0x22df4b){while(--_0x22df4b){_0x417ea3['push'](_0x417ea3['shift']());}};_0x18c29d(++_0x156e87);}(_0x910c,0xd4));var _0xc910=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x910c[_0x19159a];return _0xa677f4;};'use strict';var Sequelize=require(_0xc910('0x0'));module[_0xc910('0x1')]={'name':{'type':Sequelize[_0xc910('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc910('0x2')]},'write':{'type':Sequelize[_0xc910('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4c14=['sequelize','exports','STRING','BOOLEAN'];(function(_0x1ca596,_0x500f9d){var _0x103813=function(_0x279583){while(--_0x279583){_0x1ca596['push'](_0x1ca596['shift']());}};_0x103813(++_0x500f9d);}(_0x4c14,0xc0));var _0x44c1=function(_0x5c2adf,_0x4af377){_0x5c2adf=_0x5c2adf-0x0;var _0x1a6a93=_0x4c14[_0x5c2adf];return _0x1a6a93;};'use strict';var Sequelize=require(_0x44c1('0x0'));module[_0x44c1('0x1')]={'name':{'type':Sequelize[_0x44c1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x44c1('0x2')]},'write':{'type':Sequelize[_0x44c1('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 56b64fe..40a8b25 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 _0x2c90=['options','body','params','find','describe','getUnread','ChatInternalMessage','user','addMembers','ids','getMembers','hasOwnProperty','removeMembers','addMessage','create','getMessages','$gte','split','format','html-pdf','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','end','stack','name','send','map','ChatGroup','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','show','include'];(function(_0x15f365,_0x1f25de){var _0x344e4b=function(_0x2be9d5){while(--_0x2be9d5){_0x15f365['push'](_0x15f365['shift']());}};_0x344e4b(++_0x1f25de);}(_0x2c90,0xe5));var _0x02c9=function(_0x6402a0,_0x4d49ea){_0x6402a0=_0x6402a0-0x0;var _0x2a112b=_0x2c90[_0x6402a0];return _0x2a112b;};'use strict';var pdf=require(_0x02c9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x02c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x02c9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x02c9('0x3'));var Mustache=require(_0x02c9('0x4'));var util=require(_0x02c9('0x5'));var path=require('path');var sox=require(_0x02c9('0x6'));var csv=require(_0x02c9('0x7'));var ejs=require(_0x02c9('0x8'));var fs=require('fs');var _=require(_0x02c9('0x9'));var squel=require('squel');var crypto=require(_0x02c9('0xa'));var jsforce=require(_0x02c9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x02c9('0x7'));var querystring=require(_0x02c9('0xc'));var Papa=require(_0x02c9('0xd'));var Redis=require(_0x02c9('0xe'));var authService=require(_0x02c9('0xf'));var qs=require(_0x02c9('0x10'));var as=require(_0x02c9('0x11'));var hardwareService=require(_0x02c9('0x12'));var logger=require(_0x02c9('0x13'))(_0x02c9('0x14'));var utils=require('../../config/utils');var config=require(_0x02c9('0x15'));var db=require(_0x02c9('0x16'))['db'];config[_0x02c9('0x17')]=_[_0x02c9('0x18')](config[_0x02c9('0x17')],{'host':_0x02c9('0x19'),'port':0x18eb});var socket=require(_0x02c9('0x1a'))(new Redis(config[_0x02c9('0x17')]));require(_0x02c9('0x1b'))[_0x02c9('0x1c')](socket);var jayson=require(_0x02c9('0x1d'));var client=jayson[_0x02c9('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x101fe6,_0x55249d,_0x4c6d47){if(_0x4c6d47){var _0x19a0d6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x19a0d6['test'](_0x55249d)){return _0x101fe6;}else{throw new db[(_0x02c9('0x1f'))]['ValidationError'](_0x02c9('0x20'));}}else{return _0x101fe6;}}function respondWithRpcPromise(_0x4a0eaa,_0x31a96d,_0x3fdc0b,_0x4a89d9){return new BPromise(function(_0x478835,_0x316dba){var _0x484a18=_0x4a89d9||client;return _0x484a18['request'](_0x4a0eaa,_0x3fdc0b)['then'](function(_0x25619e){logger[_0x02c9('0x21')](_0x02c9('0x22'),_0x31a96d,'request\x20sent');logger['debug'](_0x02c9('0x23'),_0x31a96d,'request\x20sent',JSON[_0x02c9('0x24')](_0x25619e));if(_0x25619e[_0x02c9('0x25')]){if(_0x25619e[_0x02c9('0x25')]['code']===0x1f4){logger[_0x02c9('0x25')](_0x02c9('0x22'),_0x31a96d,_0x25619e[_0x02c9('0x25')][_0x02c9('0x26')]);return _0x316dba(_0x25619e[_0x02c9('0x25')][_0x02c9('0x26')]);}logger[_0x02c9('0x25')]('ChatGroup,\x20%s,\x20%s',_0x31a96d,_0x25619e['error'][_0x02c9('0x26')]);return _0x478835(_0x25619e[_0x02c9('0x25')][_0x02c9('0x26')]);}else{logger['info'](_0x02c9('0x22'),_0x31a96d,_0x02c9('0x27'));_0x478835(_0x25619e[_0x02c9('0x28')][_0x02c9('0x26')]);}})[_0x02c9('0x29')](function(_0x269493){logger[_0x02c9('0x25')](_0x02c9('0x22'),_0x31a96d,_0x269493);_0x316dba(_0x269493);});});}function respondWithStatusCode(_0x2de6fd,_0x430858){_0x430858=_0x430858||0xcc;return function(_0x2bde42){if(_0x2bde42){return _0x2de6fd[_0x02c9('0x2a')](_0x430858);}return _0x2de6fd[_0x02c9('0x2b')](_0x430858)['end']();};}function respondWithResult(_0x48e933,_0x4621e5){_0x4621e5=_0x4621e5||0xc8;return function(_0x222d61){if(_0x222d61){return _0x48e933[_0x02c9('0x2b')](_0x4621e5)['json'](_0x222d61);}};}function respondWithFilteredResult(_0x174f76,_0x17c39e){return function(_0xbeeeec){if(_0xbeeeec){var _0x5ec459=_0xbeeeec[_0x02c9('0x2c')],_0x59fdad=_0x17c39e[_0x02c9('0x2d')],_0x1d423d=_0x17c39e[_0x02c9('0x2d')]+_0x17c39e['limit'],_0x59bb74;if(_0x1d423d>=_0x5ec459){_0x1d423d=_0x5ec459;_0x59bb74=0xc8;}else{_0x59bb74=0xce;}_0x174f76[_0x02c9('0x2b')](_0x59bb74);return _0x174f76[_0x02c9('0x2e')](_0x02c9('0x2f'),_0x59fdad+'-'+_0x1d423d+'/'+_0x5ec459)[_0x02c9('0x30')](_0xbeeeec);}return null;};}function patchUpdates(_0x4ebc7e){return function(_0x1cca7b){try{jsonpatch[_0x02c9('0x31')](_0x1cca7b,_0x4ebc7e,!![]);}catch(_0x575b4c){return BPromise[_0x02c9('0x32')](_0x575b4c);}return _0x1cca7b[_0x02c9('0x33')]();};}function saveUpdates(_0x270708,_0x3be878){return function(_0x40207d){if(_0x40207d){return _0x40207d[_0x02c9('0x34')](_0x270708)['then'](function(_0x3438ff){return _0x3438ff;});}return null;};}function removeEntity(_0xc4b5c8,_0x349533){return function(_0x2672b4){if(_0x2672b4){return _0x2672b4[_0x02c9('0x35')]()[_0x02c9('0x36')](function(){_0xc4b5c8['status'](0xcc)[_0x02c9('0x37')]();});}};}function handleEntityNotFound(_0x2dcfc2,_0x279321){return function(_0x514d63){if(!_0x514d63){_0x2dcfc2[_0x02c9('0x2a')](0x194);}return _0x514d63;};}function handleError(_0x54e6c1,_0x4fc216){_0x4fc216=_0x4fc216||0x1f4;return function(_0x106984){logger['error'](_0x106984[_0x02c9('0x38')]);if(_0x106984[_0x02c9('0x39')]){delete _0x106984[_0x02c9('0x39')];}_0x54e6c1[_0x02c9('0x2b')](_0x4fc216)[_0x02c9('0x3a')](_0x106984);};}exports['index']=function(_0x56b869,_0x2347fd){var _0x45be9e={},_0x188ac1={},_0x27399e={'count':0x0,'rows':[]};var _0x1ef144=_[_0x02c9('0x3b')](db[_0x02c9('0x3c')][_0x02c9('0x3d')],function(_0x7b1707){return{'name':_0x7b1707[_0x02c9('0x3e')],'type':_0x7b1707[_0x02c9('0x3f')][_0x02c9('0x40')]};});_0x188ac1[_0x02c9('0x41')]=_[_0x02c9('0x3b')](_0x1ef144,_0x02c9('0x39'));_0x188ac1['query']=_[_0x02c9('0x42')](_0x56b869[_0x02c9('0x43')]);_0x188ac1[_0x02c9('0x44')]=_[_0x02c9('0x45')](_0x188ac1['model'],_0x188ac1[_0x02c9('0x43')]);_0x45be9e[_0x02c9('0x46')]=_[_0x02c9('0x45')](_0x188ac1[_0x02c9('0x41')],qs[_0x02c9('0x47')](_0x56b869[_0x02c9('0x43')]['fields']));_0x45be9e[_0x02c9('0x46')]=_0x45be9e[_0x02c9('0x46')][_0x02c9('0x48')]?_0x45be9e['attributes']:_0x188ac1[_0x02c9('0x41')];if(!_0x56b869['query']['hasOwnProperty'](_0x02c9('0x49'))){_0x45be9e[_0x02c9('0x4a')]=qs['limit'](_0x56b869[_0x02c9('0x43')][_0x02c9('0x4a')]);_0x45be9e['offset']=qs[_0x02c9('0x2d')](_0x56b869[_0x02c9('0x43')][_0x02c9('0x2d')]);}_0x45be9e[_0x02c9('0x4b')]=qs[_0x02c9('0x4c')](_0x56b869[_0x02c9('0x43')][_0x02c9('0x4c')]);_0x45be9e[_0x02c9('0x4d')]=qs['filters'](_[_0x02c9('0x4e')](_0x56b869['query'],_0x188ac1['filters']),_0x1ef144);if(_0x56b869[_0x02c9('0x43')][_0x02c9('0x4f')]){_0x45be9e['where']=_[_0x02c9('0x50')](_0x45be9e[_0x02c9('0x4d')],{'$or':_['map'](_0x1ef144,function(_0xe982e1){if(_0xe982e1['type']!=='VIRTUAL'){var _0xdc3343={};_0xdc3343[_0xe982e1[_0x02c9('0x39')]]={'$like':'%'+_0x56b869[_0x02c9('0x43')][_0x02c9('0x4f')]+'%'};return _0xdc3343;}})});}_0x45be9e=_[_0x02c9('0x50')]({},_0x45be9e,_0x56b869['options']);var _0x32279e={'where':_0x45be9e[_0x02c9('0x4d')]};return db[_0x02c9('0x3c')][_0x02c9('0x2c')](_0x32279e)['then'](function(_0x5bc647){_0x27399e[_0x02c9('0x2c')]=_0x5bc647;if(_0x56b869[_0x02c9('0x43')][_0x02c9('0x51')]){_0x45be9e['include']=[{'all':!![]}];}return db[_0x02c9('0x3c')][_0x02c9('0x52')](_0x45be9e);})[_0x02c9('0x36')](function(_0x598db8){_0x27399e[_0x02c9('0x53')]=_0x598db8;return _0x27399e;})[_0x02c9('0x36')](respondWithFilteredResult(_0x2347fd,_0x45be9e))[_0x02c9('0x29')](handleError(_0x2347fd,null));};exports[_0x02c9('0x54')]=function(_0x2c4f6e,_0x394dbd){var _0xfe66b8={'raw':!![],'where':{'id':_0x2c4f6e['params']['id']}},_0x5737f3={};_0x5737f3[_0x02c9('0x41')]=_['keys'](db[_0x02c9('0x3c')]['rawAttributes']);_0x5737f3[_0x02c9('0x43')]=_[_0x02c9('0x42')](_0x2c4f6e[_0x02c9('0x43')]);_0x5737f3[_0x02c9('0x44')]=_['intersection'](_0x5737f3['model'],_0x5737f3[_0x02c9('0x43')]);_0xfe66b8[_0x02c9('0x46')]=_[_0x02c9('0x45')](_0x5737f3[_0x02c9('0x41')],qs[_0x02c9('0x47')](_0x2c4f6e[_0x02c9('0x43')][_0x02c9('0x47')]));_0xfe66b8[_0x02c9('0x46')]=_0xfe66b8['attributes']['length']?_0xfe66b8['attributes']:_0x5737f3[_0x02c9('0x41')];if(_0x2c4f6e['query']['includeAll']){_0xfe66b8[_0x02c9('0x55')]=[{'all':!![]}];}_0xfe66b8=_['merge']({},_0xfe66b8,_0x2c4f6e[_0x02c9('0x56')]);return db['ChatGroup']['find'](_0xfe66b8)[_0x02c9('0x36')](handleEntityNotFound(_0x394dbd,null))[_0x02c9('0x36')](respondWithResult(_0x394dbd,null))['catch'](handleError(_0x394dbd,null));};exports['create']=function(_0xa38c39,_0x3ca454){return db['ChatGroup']['create'](_0xa38c39['body'],{})['then'](respondWithResult(_0x3ca454,0xc9))[_0x02c9('0x29')](handleError(_0x3ca454,null));};exports['update']=function(_0x4b3ffb,_0x302767){if(_0x4b3ffb['body']['id']){delete _0x4b3ffb[_0x02c9('0x57')]['id'];}return db[_0x02c9('0x3c')]['find']({'where':{'id':_0x4b3ffb[_0x02c9('0x58')]['id']}})[_0x02c9('0x36')](handleEntityNotFound(_0x302767,null))[_0x02c9('0x36')](saveUpdates(_0x4b3ffb[_0x02c9('0x57')],null))[_0x02c9('0x36')](respondWithResult(_0x302767,null))[_0x02c9('0x29')](handleError(_0x302767,null));};exports[_0x02c9('0x35')]=function(_0x2d8305,_0x3f3aa0){return db[_0x02c9('0x3c')][_0x02c9('0x59')]({'where':{'id':_0x2d8305[_0x02c9('0x58')]['id']}})[_0x02c9('0x36')](handleEntityNotFound(_0x3f3aa0,null))[_0x02c9('0x36')](removeEntity(_0x3f3aa0,null))[_0x02c9('0x29')](handleError(_0x3f3aa0,null));};exports[_0x02c9('0x5a')]=function(_0x5591c3,_0x5a473f){return db['ChatGroup'][_0x02c9('0x5a')]()[_0x02c9('0x36')](respondWithResult(_0x5a473f,null))[_0x02c9('0x29')](handleError(_0x5a473f,null));};exports[_0x02c9('0x5b')]=function(_0x1f7eae,_0x481729,_0x328b91){return db[_0x02c9('0x5c')][_0x02c9('0x2c')]({'where':{'ChatGroupId':_0x1f7eae[_0x02c9('0x58')]['id'],'ToId':_0x1f7eae[_0x02c9('0x5d')]['id'],'read':![]}})[_0x02c9('0x36')](function(_0x59c8fd){return{'id':_['toInteger'](_0x1f7eae[_0x02c9('0x58')]['id']),'count':_0x59c8fd};})[_0x02c9('0x36')](respondWithResult(_0x481729,null))[_0x02c9('0x29')](handleError(_0x481729,null));};exports[_0x02c9('0x5e')]=function(_0x406577,_0xf9d9b7,_0x3d8be2){return db[_0x02c9('0x3c')][_0x02c9('0x59')]({'where':{'id':_0x406577['params']['id']}})[_0x02c9('0x36')](handleEntityNotFound(_0xf9d9b7,null))['then'](function(_0x3751db){if(_0x3751db){return _0x3751db['addMembers'](_0x406577[_0x02c9('0x57')][_0x02c9('0x5f')],_['omit'](_0x406577['body'],[_0x02c9('0x5f'),'id'])||{});}})[_0x02c9('0x36')](respondWithResult(_0xf9d9b7,null))['catch'](handleError(_0xf9d9b7,null));};exports[_0x02c9('0x60')]=function(_0x3c820a,_0x20412d,_0x22193a){var _0x318f21={};var _0x29492e={};var _0x55f2ee;var _0x15af95;return db[_0x02c9('0x3c')]['findOne']({'where':{'id':_0x3c820a['params']['id']}})[_0x02c9('0x36')](handleEntityNotFound(_0x20412d,null))[_0x02c9('0x36')](function(_0xbdac11){if(_0xbdac11){_0x55f2ee=_0xbdac11;_0x29492e['model']=_[_0x02c9('0x42')](db['User']['rawAttributes']);_0x29492e[_0x02c9('0x43')]=_[_0x02c9('0x42')](_0x3c820a[_0x02c9('0x43')]);_0x29492e[_0x02c9('0x44')]=_[_0x02c9('0x45')](_0x29492e['model'],_0x29492e[_0x02c9('0x43')]);_0x318f21[_0x02c9('0x46')]=_[_0x02c9('0x45')](_0x29492e[_0x02c9('0x41')],qs[_0x02c9('0x47')](_0x3c820a[_0x02c9('0x43')][_0x02c9('0x47')]));_0x318f21[_0x02c9('0x46')]=_0x318f21[_0x02c9('0x46')][_0x02c9('0x48')]?_0x318f21[_0x02c9('0x46')]:_0x29492e['model'];_0x318f21['order']=qs[_0x02c9('0x4c')](_0x3c820a[_0x02c9('0x43')][_0x02c9('0x4c')]);_0x318f21['where']=qs[_0x02c9('0x44')](_['pick'](_0x3c820a[_0x02c9('0x43')],_0x29492e['filters']));if(_0x3c820a['query'][_0x02c9('0x4f')]){_0x318f21[_0x02c9('0x4d')]=_[_0x02c9('0x50')](_0x318f21[_0x02c9('0x4d')],{'$or':_[_0x02c9('0x3b')](_0x318f21[_0x02c9('0x46')],function(_0xfb6132){var _0x41bc20={};_0x41bc20[_0xfb6132]={'$like':'%'+_0x3c820a[_0x02c9('0x43')][_0x02c9('0x4f')]+'%'};return _0x41bc20;})});}_0x318f21=_[_0x02c9('0x50')]({},_0x318f21,_0x3c820a[_0x02c9('0x56')]);return _0x55f2ee[_0x02c9('0x60')](_0x318f21);}})[_0x02c9('0x36')](function(_0xbd8c76){if(_0xbd8c76){_0x15af95=_0xbd8c76[_0x02c9('0x48')];if(!_0x3c820a[_0x02c9('0x43')][_0x02c9('0x61')]('nolimit')){_0x318f21['limit']=qs[_0x02c9('0x4a')](_0x3c820a[_0x02c9('0x43')][_0x02c9('0x4a')]);_0x318f21[_0x02c9('0x2d')]=qs[_0x02c9('0x2d')](_0x3c820a[_0x02c9('0x43')][_0x02c9('0x2d')]);}return _0x55f2ee['getMembers'](_0x318f21);}})[_0x02c9('0x36')](function(_0xf2395a){if(_0xf2395a){return _0xf2395a?{'count':_0x15af95,'rows':_0xf2395a}:null;}})[_0x02c9('0x36')](respondWithResult(_0x20412d,null))[_0x02c9('0x29')](handleError(_0x20412d,null));};exports[_0x02c9('0x62')]=function(_0x38e7e1,_0x40699a,_0x44a2ce){return db['ChatGroup']['find']({'where':{'id':_0x38e7e1[_0x02c9('0x58')]['id']}})['then'](handleEntityNotFound(_0x40699a,null))[_0x02c9('0x36')](function(_0x18aabf){if(_0x18aabf){return _0x18aabf[_0x02c9('0x62')](_0x38e7e1[_0x02c9('0x43')][_0x02c9('0x5f')]);}})[_0x02c9('0x36')](respondWithStatusCode(_0x40699a,null))[_0x02c9('0x29')](handleError(_0x40699a,null));};exports[_0x02c9('0x63')]=function(_0x159c00,_0x118323,_0x4e7749){if(_0x159c00['body']['id']){delete _0x159c00['body']['id'];}return db[_0x02c9('0x3c')][_0x02c9('0x59')]({'where':{'id':_0x159c00[_0x02c9('0x58')]['id']}})[_0x02c9('0x36')](handleEntityNotFound(_0x118323,null))[_0x02c9('0x36')](function(_0x330a40){if(_0x330a40){_0x159c00[_0x02c9('0x57')]['ChatGroupId']=_0x330a40['id'];return db['ChatInternalMessage'][_0x02c9('0x64')](_0x159c00['body']);}})[_0x02c9('0x36')](respondWithResult(_0x118323,null))[_0x02c9('0x29')](handleError(_0x118323,null));};exports[_0x02c9('0x65')]=function(_0x2d28f3,_0x135583,_0x71511d){var _0x48895c={};var _0x56120d={};var _0xad89cf;var _0x41ed85;return db[_0x02c9('0x3c')]['findOne']({'where':{'id':_0x2d28f3[_0x02c9('0x58')]['id']}})[_0x02c9('0x36')](handleEntityNotFound(_0x135583,null))[_0x02c9('0x36')](function(_0x2258f3){if(_0x2258f3){_0xad89cf=_0x2258f3;_0x56120d[_0x02c9('0x41')]=_['keys'](db[_0x02c9('0x5c')][_0x02c9('0x3d')]);_0x56120d[_0x02c9('0x43')]=_['keys'](_0x2d28f3['query']);_0x56120d['filters']=_[_0x02c9('0x45')](_0x56120d['model'],_0x56120d[_0x02c9('0x43')]);_0x48895c['attributes']=_[_0x02c9('0x45')](_0x56120d[_0x02c9('0x41')],qs['fields'](_0x2d28f3[_0x02c9('0x43')][_0x02c9('0x47')]));_0x48895c['attributes']=_0x48895c['attributes']['length']?_0x48895c['attributes']:_0x56120d[_0x02c9('0x41')];_0x48895c[_0x02c9('0x4b')]=qs[_0x02c9('0x4c')](_0x2d28f3['query'][_0x02c9('0x4c')]);_0x48895c[_0x02c9('0x4d')]=qs[_0x02c9('0x44')](_['pick'](_0x2d28f3[_0x02c9('0x43')],_0x56120d[_0x02c9('0x44')]));if(_0x2d28f3[_0x02c9('0x43')][_0x02c9('0x4f')]){_0x48895c[_0x02c9('0x4d')]=_[_0x02c9('0x50')](_0x48895c['where'],{'$or':_[_0x02c9('0x3b')](_0x48895c[_0x02c9('0x46')],function(_0x71227e){var _0x37c55a={};_0x37c55a[_0x71227e]={'$like':'%'+_0x2d28f3[_0x02c9('0x43')][_0x02c9('0x4f')]+'%'};return _0x37c55a;})});}if(_0x2d28f3[_0x02c9('0x43')][_0x02c9('0x66')]){var _0x1024d8=_0x2d28f3[_0x02c9('0x43')][_0x02c9('0x66')][_0x02c9('0x67')](',');var _0x2fa58f={};_0x2fa58f[_0x1024d8[0x0]]={'$gte':moment(_0x1024d8[0x1])[_0x02c9('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};_0x48895c[_0x02c9('0x4d')]=_['merge'](_0x48895c['where'],_0x2fa58f);}_0x48895c=_[_0x02c9('0x50')]({},_0x48895c,_0x2d28f3[_0x02c9('0x56')]);return _0xad89cf[_0x02c9('0x65')](_0x48895c);}})['then'](function(_0x34d097){if(_0x34d097){_0x41ed85=_0x34d097[_0x02c9('0x48')];if(!_0x2d28f3[_0x02c9('0x43')][_0x02c9('0x61')](_0x02c9('0x49'))){_0x48895c['limit']=qs[_0x02c9('0x4a')](_0x2d28f3[_0x02c9('0x43')]['limit']);_0x48895c[_0x02c9('0x2d')]=qs[_0x02c9('0x2d')](_0x2d28f3[_0x02c9('0x43')][_0x02c9('0x2d')]);}return _0xad89cf[_0x02c9('0x65')](_0x48895c);}})[_0x02c9('0x36')](function(_0x2a01fd){if(_0x2a01fd){return _0x2a01fd?{'count':_0x41ed85,'rows':_0x2a01fd}:null;}})[_0x02c9('0x36')](respondWithResult(_0x135583,null))[_0x02c9('0x29')](handleError(_0x135583,null));}; \ No newline at end of file +var _0x8a4e=['order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','findAll','show','params','includeAll','include','find','create','body','update','destroy','describe','getUnread','ChatInternalMessage','toInteger','addMembers','omit','findOne','getMembers','removeMembers','ids','addMessage','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','hasOwnProperty','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','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~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','ChatGroup,\x20%s,\x20%s','message','catch','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','then','name','ChatGroup','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','nolimit'];(function(_0x3c80e3,_0x4d9ab8){var _0x261d37=function(_0x35387f){while(--_0x35387f){_0x3c80e3['push'](_0x3c80e3['shift']());}};_0x261d37(++_0x4d9ab8);}(_0x8a4e,0x100));var _0xe8a4=function(_0xff8595,_0x39341d){_0xff8595=_0xff8595-0x0;var _0x31e49e=_0x8a4e[_0xff8595];return _0x31e49e;};'use strict';var pdf=require(_0xe8a4('0x0'));var emlformat=require(_0xe8a4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe8a4('0x2'));var jsonpatch=require(_0xe8a4('0x3'));var rp=require(_0xe8a4('0x4'));var moment=require(_0xe8a4('0x5'));var BPromise=require(_0xe8a4('0x6'));var Mustache=require('mustache');var util=require(_0xe8a4('0x7'));var path=require(_0xe8a4('0x8'));var sox=require(_0xe8a4('0x9'));var csv=require(_0xe8a4('0xa'));var ejs=require(_0xe8a4('0xb'));var fs=require('fs');var _=require(_0xe8a4('0xc'));var squel=require(_0xe8a4('0xd'));var crypto=require(_0xe8a4('0xe'));var jsforce=require(_0xe8a4('0xf'));var deskjs=require(_0xe8a4('0x10'));var toCsv=require(_0xe8a4('0xa'));var querystring=require(_0xe8a4('0x11'));var Papa=require(_0xe8a4('0x12'));var Redis=require(_0xe8a4('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe8a4('0x14'));var as=require(_0xe8a4('0x15'));var hardwareService=require(_0xe8a4('0x16'));var logger=require('../../config/logger')(_0xe8a4('0x17'));var utils=require(_0xe8a4('0x18'));var config=require(_0xe8a4('0x19'));var db=require(_0xe8a4('0x1a'))['db'];config[_0xe8a4('0x1b')]=_[_0xe8a4('0x1c')](config[_0xe8a4('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xe8a4('0x1d'))(new Redis(config['redis']));require('./chatGroup.socket')[_0xe8a4('0x1e')](socket);var jayson=require(_0xe8a4('0x1f'));var client=jayson[_0xe8a4('0x20')]['http']({'port':0x232a});function checkPasswordPattern(_0x401b75,_0x1cc47a,_0x408abc){if(_0x408abc){var _0x8a57f0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8a57f0[_0xe8a4('0x21')](_0x1cc47a)){return _0x401b75;}else{throw new db[(_0xe8a4('0x22'))][(_0xe8a4('0x23'))](_0xe8a4('0x24'));}}else{return _0x401b75;}}function respondWithRpcPromise(_0x5e0788,_0x4606ff,_0x3ed066,_0x2ba223){return new BPromise(function(_0x235f9e,_0x50f82a){var _0x28a373=_0x2ba223||client;return _0x28a373[_0xe8a4('0x25')](_0x5e0788,_0x3ed066)['then'](function(_0x5efb19){logger[_0xe8a4('0x26')]('ChatGroup,\x20%s,\x20%s',_0x4606ff,_0xe8a4('0x27'));logger[_0xe8a4('0x28')](_0xe8a4('0x29'),_0x4606ff,_0xe8a4('0x27'),JSON['stringify'](_0x5efb19));if(_0x5efb19[_0xe8a4('0x2a')]){if(_0x5efb19[_0xe8a4('0x2a')][_0xe8a4('0x2b')]===0x1f4){logger['error'](_0xe8a4('0x2c'),_0x4606ff,_0x5efb19[_0xe8a4('0x2a')][_0xe8a4('0x2d')]);return _0x50f82a(_0x5efb19['error']['message']);}logger['error'](_0xe8a4('0x2c'),_0x4606ff,_0x5efb19[_0xe8a4('0x2a')][_0xe8a4('0x2d')]);return _0x235f9e(_0x5efb19[_0xe8a4('0x2a')]['message']);}else{logger[_0xe8a4('0x26')](_0xe8a4('0x2c'),_0x4606ff,_0xe8a4('0x27'));_0x235f9e(_0x5efb19['result'][_0xe8a4('0x2d')]);}})[_0xe8a4('0x2e')](function(_0x22cc93){logger[_0xe8a4('0x2a')]('ChatGroup,\x20%s,\x20%s',_0x4606ff,_0x22cc93);_0x50f82a(_0x22cc93);});});}function respondWithStatusCode(_0x4ded04,_0x13d3cb){_0x13d3cb=_0x13d3cb||0xcc;return function(_0x375161){if(_0x375161){return _0x4ded04[_0xe8a4('0x2f')](_0x13d3cb);}return _0x4ded04['status'](_0x13d3cb)[_0xe8a4('0x30')]();};}function respondWithResult(_0x255eb5,_0x26e54c){_0x26e54c=_0x26e54c||0xc8;return function(_0x5ed971){if(_0x5ed971){return _0x255eb5[_0xe8a4('0x31')](_0x26e54c)['json'](_0x5ed971);}};}function respondWithFilteredResult(_0x3565e5,_0x1c1b4d){return function(_0x39e528){if(_0x39e528){var _0x544a07=_0x39e528[_0xe8a4('0x32')],_0x32edc9=_0x1c1b4d['offset'],_0x2df749=_0x1c1b4d[_0xe8a4('0x33')]+_0x1c1b4d[_0xe8a4('0x34')],_0x6f88ac;if(_0x2df749>=_0x544a07){_0x2df749=_0x544a07;_0x6f88ac=0xc8;}else{_0x6f88ac=0xce;}_0x3565e5[_0xe8a4('0x31')](_0x6f88ac);return _0x3565e5['set'](_0xe8a4('0x35'),_0x32edc9+'-'+_0x2df749+'/'+_0x544a07)[_0xe8a4('0x36')](_0x39e528);}return null;};}function patchUpdates(_0x12ab72){return function(_0xcfdfa2){try{jsonpatch[_0xe8a4('0x37')](_0xcfdfa2,_0x12ab72,!![]);}catch(_0x1c556b){return BPromise['reject'](_0x1c556b);}return _0xcfdfa2['save']();};}function saveUpdates(_0x39b909,_0x5edf40){return function(_0x1267b1){if(_0x1267b1){return _0x1267b1['update'](_0x39b909)[_0xe8a4('0x38')](function(_0x3ccc68){return _0x3ccc68;});}return null;};}function removeEntity(_0x305d3a,_0x5aa6aa){return function(_0x2102ec){if(_0x2102ec){return _0x2102ec['destroy']()['then'](function(){_0x305d3a[_0xe8a4('0x31')](0xcc)[_0xe8a4('0x30')]();});}};}function handleEntityNotFound(_0xd88d99,_0x582600){return function(_0x6c80b2){if(!_0x6c80b2){_0xd88d99['sendStatus'](0x194);}return _0x6c80b2;};}function handleError(_0x170b27,_0x10d5a5){_0x10d5a5=_0x10d5a5||0x1f4;return function(_0x1e363b){logger['error'](_0x1e363b['stack']);if(_0x1e363b['name']){delete _0x1e363b[_0xe8a4('0x39')];}_0x170b27[_0xe8a4('0x31')](_0x10d5a5)['send'](_0x1e363b);};}exports['index']=function(_0x360786,_0x50182b){var _0x5adda0={},_0x5f05f0={},_0x4db62e={'count':0x0,'rows':[]};var _0x5b5661=_['map'](db[_0xe8a4('0x3a')][_0xe8a4('0x3b')],function(_0x3efa36){return{'name':_0x3efa36[_0xe8a4('0x3c')],'type':_0x3efa36['type'][_0xe8a4('0x3d')]};});_0x5f05f0[_0xe8a4('0x3e')]=_[_0xe8a4('0x3f')](_0x5b5661,_0xe8a4('0x39'));_0x5f05f0[_0xe8a4('0x40')]=_[_0xe8a4('0x41')](_0x360786[_0xe8a4('0x40')]);_0x5f05f0['filters']=_[_0xe8a4('0x42')](_0x5f05f0[_0xe8a4('0x3e')],_0x5f05f0[_0xe8a4('0x40')]);_0x5adda0[_0xe8a4('0x43')]=_[_0xe8a4('0x42')](_0x5f05f0[_0xe8a4('0x3e')],qs[_0xe8a4('0x44')](_0x360786[_0xe8a4('0x40')][_0xe8a4('0x44')]));_0x5adda0['attributes']=_0x5adda0[_0xe8a4('0x43')][_0xe8a4('0x45')]?_0x5adda0[_0xe8a4('0x43')]:_0x5f05f0[_0xe8a4('0x3e')];if(!_0x360786[_0xe8a4('0x40')]['hasOwnProperty'](_0xe8a4('0x46'))){_0x5adda0[_0xe8a4('0x34')]=qs[_0xe8a4('0x34')](_0x360786['query']['limit']);_0x5adda0[_0xe8a4('0x33')]=qs[_0xe8a4('0x33')](_0x360786[_0xe8a4('0x40')][_0xe8a4('0x33')]);}_0x5adda0[_0xe8a4('0x47')]=qs[_0xe8a4('0x48')](_0x360786[_0xe8a4('0x40')][_0xe8a4('0x48')]);_0x5adda0[_0xe8a4('0x49')]=qs[_0xe8a4('0x4a')](_[_0xe8a4('0x4b')](_0x360786[_0xe8a4('0x40')],_0x5f05f0[_0xe8a4('0x4a')]),_0x5b5661);if(_0x360786[_0xe8a4('0x40')][_0xe8a4('0x4c')]){_0x5adda0['where']=_[_0xe8a4('0x4d')](_0x5adda0[_0xe8a4('0x49')],{'$or':_['map'](_0x5b5661,function(_0x10bbfa){if(_0x10bbfa[_0xe8a4('0x4e')]!==_0xe8a4('0x4f')){var _0x2326a0={};_0x2326a0[_0x10bbfa[_0xe8a4('0x39')]]={'$like':'%'+_0x360786[_0xe8a4('0x40')][_0xe8a4('0x4c')]+'%'};return _0x2326a0;}})});}_0x5adda0=_[_0xe8a4('0x4d')]({},_0x5adda0,_0x360786[_0xe8a4('0x50')]);var _0x344041={'where':_0x5adda0[_0xe8a4('0x49')]};return db[_0xe8a4('0x3a')]['count'](_0x344041)[_0xe8a4('0x38')](function(_0x4bbe92){_0x4db62e[_0xe8a4('0x32')]=_0x4bbe92;if(_0x360786[_0xe8a4('0x40')]['includeAll']){_0x5adda0['include']=[{'all':!![]}];}return db[_0xe8a4('0x3a')][_0xe8a4('0x51')](_0x5adda0);})['then'](function(_0x3ff038){_0x4db62e['rows']=_0x3ff038;return _0x4db62e;})[_0xe8a4('0x38')](respondWithFilteredResult(_0x50182b,_0x5adda0))['catch'](handleError(_0x50182b,null));};exports[_0xe8a4('0x52')]=function(_0xf0339,_0x15ba8a){var _0x56b980={'raw':!![],'where':{'id':_0xf0339[_0xe8a4('0x53')]['id']}},_0x3e2159={};_0x3e2159[_0xe8a4('0x3e')]=_['keys'](db['ChatGroup'][_0xe8a4('0x3b')]);_0x3e2159[_0xe8a4('0x40')]=_[_0xe8a4('0x41')](_0xf0339[_0xe8a4('0x40')]);_0x3e2159[_0xe8a4('0x4a')]=_[_0xe8a4('0x42')](_0x3e2159['model'],_0x3e2159[_0xe8a4('0x40')]);_0x56b980['attributes']=_['intersection'](_0x3e2159['model'],qs[_0xe8a4('0x44')](_0xf0339[_0xe8a4('0x40')][_0xe8a4('0x44')]));_0x56b980[_0xe8a4('0x43')]=_0x56b980[_0xe8a4('0x43')][_0xe8a4('0x45')]?_0x56b980[_0xe8a4('0x43')]:_0x3e2159[_0xe8a4('0x3e')];if(_0xf0339[_0xe8a4('0x40')][_0xe8a4('0x54')]){_0x56b980[_0xe8a4('0x55')]=[{'all':!![]}];}_0x56b980=_['merge']({},_0x56b980,_0xf0339[_0xe8a4('0x50')]);return db['ChatGroup'][_0xe8a4('0x56')](_0x56b980)['then'](handleEntityNotFound(_0x15ba8a,null))[_0xe8a4('0x38')](respondWithResult(_0x15ba8a,null))[_0xe8a4('0x2e')](handleError(_0x15ba8a,null));};exports[_0xe8a4('0x57')]=function(_0x23adfc,_0x4496fa){return db[_0xe8a4('0x3a')]['create'](_0x23adfc[_0xe8a4('0x58')],{})[_0xe8a4('0x38')](respondWithResult(_0x4496fa,0xc9))[_0xe8a4('0x2e')](handleError(_0x4496fa,null));};exports[_0xe8a4('0x59')]=function(_0x5d6d6d,_0x2ef3c6){if(_0x5d6d6d[_0xe8a4('0x58')]['id']){delete _0x5d6d6d[_0xe8a4('0x58')]['id'];}return db['ChatGroup'][_0xe8a4('0x56')]({'where':{'id':_0x5d6d6d[_0xe8a4('0x53')]['id']}})['then'](handleEntityNotFound(_0x2ef3c6,null))[_0xe8a4('0x38')](saveUpdates(_0x5d6d6d['body'],null))['then'](respondWithResult(_0x2ef3c6,null))[_0xe8a4('0x2e')](handleError(_0x2ef3c6,null));};exports[_0xe8a4('0x5a')]=function(_0x4d8aa9,_0x3788ab){return db[_0xe8a4('0x3a')][_0xe8a4('0x56')]({'where':{'id':_0x4d8aa9[_0xe8a4('0x53')]['id']}})[_0xe8a4('0x38')](handleEntityNotFound(_0x3788ab,null))[_0xe8a4('0x38')](removeEntity(_0x3788ab,null))['catch'](handleError(_0x3788ab,null));};exports[_0xe8a4('0x5b')]=function(_0x97baf8,_0x372c20){return db[_0xe8a4('0x3a')]['describe']()[_0xe8a4('0x38')](respondWithResult(_0x372c20,null))[_0xe8a4('0x2e')](handleError(_0x372c20,null));};exports[_0xe8a4('0x5c')]=function(_0x28f3e8,_0x3306a0,_0x3895a3){return db[_0xe8a4('0x5d')][_0xe8a4('0x32')]({'where':{'ChatGroupId':_0x28f3e8[_0xe8a4('0x53')]['id'],'ToId':_0x28f3e8['user']['id'],'read':![]}})[_0xe8a4('0x38')](function(_0x4c29b7){return{'id':_[_0xe8a4('0x5e')](_0x28f3e8[_0xe8a4('0x53')]['id']),'count':_0x4c29b7};})['then'](respondWithResult(_0x3306a0,null))[_0xe8a4('0x2e')](handleError(_0x3306a0,null));};exports[_0xe8a4('0x5f')]=function(_0x2616ef,_0x177887,_0x493988){return db[_0xe8a4('0x3a')][_0xe8a4('0x56')]({'where':{'id':_0x2616ef[_0xe8a4('0x53')]['id']}})[_0xe8a4('0x38')](handleEntityNotFound(_0x177887,null))['then'](function(_0x519e1b){if(_0x519e1b){return _0x519e1b[_0xe8a4('0x5f')](_0x2616ef[_0xe8a4('0x58')]['ids'],_[_0xe8a4('0x60')](_0x2616ef['body'],['ids','id'])||{});}})[_0xe8a4('0x38')](respondWithResult(_0x177887,null))[_0xe8a4('0x2e')](handleError(_0x177887,null));};exports['getMembers']=function(_0x3853db,_0x220892,_0x4213d0){var _0x281a08={};var _0x5a01d1={};var _0x5787fe;var _0x3fb9ea;return db[_0xe8a4('0x3a')][_0xe8a4('0x61')]({'where':{'id':_0x3853db['params']['id']}})[_0xe8a4('0x38')](handleEntityNotFound(_0x220892,null))['then'](function(_0x1bd288){if(_0x1bd288){_0x5787fe=_0x1bd288;_0x5a01d1[_0xe8a4('0x3e')]=_[_0xe8a4('0x41')](db['User'][_0xe8a4('0x3b')]);_0x5a01d1[_0xe8a4('0x40')]=_[_0xe8a4('0x41')](_0x3853db[_0xe8a4('0x40')]);_0x5a01d1[_0xe8a4('0x4a')]=_['intersection'](_0x5a01d1[_0xe8a4('0x3e')],_0x5a01d1[_0xe8a4('0x40')]);_0x281a08['attributes']=_['intersection'](_0x5a01d1[_0xe8a4('0x3e')],qs['fields'](_0x3853db[_0xe8a4('0x40')]['fields']));_0x281a08[_0xe8a4('0x43')]=_0x281a08[_0xe8a4('0x43')][_0xe8a4('0x45')]?_0x281a08[_0xe8a4('0x43')]:_0x5a01d1[_0xe8a4('0x3e')];_0x281a08[_0xe8a4('0x47')]=qs[_0xe8a4('0x48')](_0x3853db[_0xe8a4('0x40')][_0xe8a4('0x48')]);_0x281a08[_0xe8a4('0x49')]=qs[_0xe8a4('0x4a')](_[_0xe8a4('0x4b')](_0x3853db[_0xe8a4('0x40')],_0x5a01d1[_0xe8a4('0x4a')]));if(_0x3853db[_0xe8a4('0x40')][_0xe8a4('0x4c')]){_0x281a08['where']=_[_0xe8a4('0x4d')](_0x281a08['where'],{'$or':_[_0xe8a4('0x3f')](_0x281a08[_0xe8a4('0x43')],function(_0x45eb93){var _0x3826ba={};_0x3826ba[_0x45eb93]={'$like':'%'+_0x3853db[_0xe8a4('0x40')]['filter']+'%'};return _0x3826ba;})});}_0x281a08=_[_0xe8a4('0x4d')]({},_0x281a08,_0x3853db[_0xe8a4('0x50')]);return _0x5787fe[_0xe8a4('0x62')](_0x281a08);}})[_0xe8a4('0x38')](function(_0x478fa5){if(_0x478fa5){_0x3fb9ea=_0x478fa5[_0xe8a4('0x45')];if(!_0x3853db['query']['hasOwnProperty'](_0xe8a4('0x46'))){_0x281a08[_0xe8a4('0x34')]=qs[_0xe8a4('0x34')](_0x3853db[_0xe8a4('0x40')]['limit']);_0x281a08[_0xe8a4('0x33')]=qs[_0xe8a4('0x33')](_0x3853db[_0xe8a4('0x40')][_0xe8a4('0x33')]);}return _0x5787fe[_0xe8a4('0x62')](_0x281a08);}})[_0xe8a4('0x38')](function(_0x16ace2){if(_0x16ace2){return _0x16ace2?{'count':_0x3fb9ea,'rows':_0x16ace2}:null;}})[_0xe8a4('0x38')](respondWithResult(_0x220892,null))[_0xe8a4('0x2e')](handleError(_0x220892,null));};exports[_0xe8a4('0x63')]=function(_0xb56903,_0x3c9c03,_0xceb0ff){return db[_0xe8a4('0x3a')][_0xe8a4('0x56')]({'where':{'id':_0xb56903[_0xe8a4('0x53')]['id']}})['then'](handleEntityNotFound(_0x3c9c03,null))[_0xe8a4('0x38')](function(_0xfb50ff){if(_0xfb50ff){return _0xfb50ff[_0xe8a4('0x63')](_0xb56903[_0xe8a4('0x40')][_0xe8a4('0x64')]);}})[_0xe8a4('0x38')](respondWithStatusCode(_0x3c9c03,null))[_0xe8a4('0x2e')](handleError(_0x3c9c03,null));};exports[_0xe8a4('0x65')]=function(_0x4889f0,_0xb39508,_0x143cb1){if(_0x4889f0['body']['id']){delete _0x4889f0[_0xe8a4('0x58')]['id'];}return db[_0xe8a4('0x3a')][_0xe8a4('0x56')]({'where':{'id':_0x4889f0[_0xe8a4('0x53')]['id']}})[_0xe8a4('0x38')](handleEntityNotFound(_0xb39508,null))[_0xe8a4('0x38')](function(_0x27d2d7){if(_0x27d2d7){_0x4889f0['body'][_0xe8a4('0x66')]=_0x27d2d7['id'];return db[_0xe8a4('0x5d')]['create'](_0x4889f0[_0xe8a4('0x58')]);}})['then'](respondWithResult(_0xb39508,null))[_0xe8a4('0x2e')](handleError(_0xb39508,null));};exports['getMessages']=function(_0x2b24e9,_0x190ba0,_0x1d3b50){var _0xc2444a={};var _0x5b8775={};var _0x132f6d;var _0x39c567;return db[_0xe8a4('0x3a')][_0xe8a4('0x61')]({'where':{'id':_0x2b24e9[_0xe8a4('0x53')]['id']}})[_0xe8a4('0x38')](handleEntityNotFound(_0x190ba0,null))[_0xe8a4('0x38')](function(_0x972bef){if(_0x972bef){_0x132f6d=_0x972bef;_0x5b8775[_0xe8a4('0x3e')]=_['keys'](db[_0xe8a4('0x5d')][_0xe8a4('0x3b')]);_0x5b8775[_0xe8a4('0x40')]=_[_0xe8a4('0x41')](_0x2b24e9[_0xe8a4('0x40')]);_0x5b8775[_0xe8a4('0x4a')]=_[_0xe8a4('0x42')](_0x5b8775[_0xe8a4('0x3e')],_0x5b8775[_0xe8a4('0x40')]);_0xc2444a[_0xe8a4('0x43')]=_[_0xe8a4('0x42')](_0x5b8775['model'],qs['fields'](_0x2b24e9[_0xe8a4('0x40')][_0xe8a4('0x44')]));_0xc2444a['attributes']=_0xc2444a[_0xe8a4('0x43')][_0xe8a4('0x45')]?_0xc2444a[_0xe8a4('0x43')]:_0x5b8775[_0xe8a4('0x3e')];_0xc2444a[_0xe8a4('0x47')]=qs[_0xe8a4('0x48')](_0x2b24e9[_0xe8a4('0x40')][_0xe8a4('0x48')]);_0xc2444a[_0xe8a4('0x49')]=qs['filters'](_[_0xe8a4('0x4b')](_0x2b24e9[_0xe8a4('0x40')],_0x5b8775[_0xe8a4('0x4a')]));if(_0x2b24e9[_0xe8a4('0x40')][_0xe8a4('0x4c')]){_0xc2444a[_0xe8a4('0x49')]=_[_0xe8a4('0x4d')](_0xc2444a['where'],{'$or':_[_0xe8a4('0x3f')](_0xc2444a[_0xe8a4('0x43')],function(_0x3c529d){var _0xd64fb={};_0xd64fb[_0x3c529d]={'$like':'%'+_0x2b24e9[_0xe8a4('0x40')][_0xe8a4('0x4c')]+'%'};return _0xd64fb;})});}if(_0x2b24e9[_0xe8a4('0x40')][_0xe8a4('0x67')]){var _0x1256cf=_0x2b24e9[_0xe8a4('0x40')][_0xe8a4('0x67')][_0xe8a4('0x68')](',');var _0x33ba95={};_0x33ba95[_0x1256cf[0x0]]={'$gte':moment(_0x1256cf[0x1])[_0xe8a4('0x69')](_0xe8a4('0x6a'))};_0xc2444a[_0xe8a4('0x49')]=_[_0xe8a4('0x4d')](_0xc2444a[_0xe8a4('0x49')],_0x33ba95);}_0xc2444a=_[_0xe8a4('0x4d')]({},_0xc2444a,_0x2b24e9['options']);return _0x132f6d[_0xe8a4('0x6b')](_0xc2444a);}})[_0xe8a4('0x38')](function(_0x3dc38e){if(_0x3dc38e){_0x39c567=_0x3dc38e[_0xe8a4('0x45')];if(!_0x2b24e9[_0xe8a4('0x40')][_0xe8a4('0x6c')]('nolimit')){_0xc2444a[_0xe8a4('0x34')]=qs[_0xe8a4('0x34')](_0x2b24e9[_0xe8a4('0x40')]['limit']);_0xc2444a[_0xe8a4('0x33')]=qs[_0xe8a4('0x33')](_0x2b24e9[_0xe8a4('0x40')][_0xe8a4('0x33')]);}return _0x132f6d[_0xe8a4('0x6b')](_0xc2444a);}})[_0xe8a4('0x38')](function(_0x492386){if(_0x492386){return _0x492386?{'count':_0x39c567,'rows':_0x492386}:null;}})[_0xe8a4('0x38')](respondWithResult(_0x190ba0,null))['catch'](handleError(_0x190ba0,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 8427464..1dc3a15 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x197f78,_0x5935ff){var _0x281291=function(_0x3dd956){while(--_0x3dd956){_0x197f78['push'](_0x197f78['shift']());}};_0x281291(++_0x5935ff);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x65f6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){ChatGroupEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);ChatGroupEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0xadde88,_0x58ad47){var _0x3b8eb6=function(_0x15535a){while(--_0x15535a){_0xadde88['push'](_0xadde88['shift']());}};_0x3b8eb6(++_0x58ad47);}(_0xadb5,0xad));var _0x5adb=function(_0x2604b1,_0x6e26f2){_0x2604b1=_0x2604b1-0x0;var _0x2e9403=_0xadb5[_0x2604b1];return _0x2e9403;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5adb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatGroupEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatGroupEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatGroup[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('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 8b6a633..2fa129d 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 _0x86f4=['exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x271ce8,_0x4c3614){var _0x435b64=function(_0x3e176c){while(--_0x3e176c){_0x271ce8['push'](_0x271ce8['shift']());}};_0x435b64(++_0x4c3614);}(_0x86f4,0x18a));var _0x486f=function(_0x4a0f49,_0x583671){_0x4a0f49=_0x4a0f49-0x0;var _0x1a7451=_0x86f4[_0x4a0f49];return _0x1a7451;};'use strict';var _=require(_0x486f('0x0'));var util=require(_0x486f('0x1'));var logger=require(_0x486f('0x2'))(_0x486f('0x3'));var moment=require(_0x486f('0x4'));var BPromise=require(_0x486f('0x5'));var rp=require(_0x486f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x486f('0x7'));var config=require(_0x486f('0x8'));var attributes=require('./chatGroup.attributes');module[_0x486f('0x9')]=function(_0x1adb27,_0x39f767){return _0x1adb27[_0x486f('0xa')](_0x486f('0xb'),attributes,{'tableName':_0x486f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x684d=['ChatGroup','chat_groups','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports'];(function(_0xf5a894,_0x516cd4){var _0x9c426c=function(_0xb517cf){while(--_0xb517cf){_0xf5a894['push'](_0xf5a894['shift']());}};_0x9c426c(++_0x516cd4);}(_0x684d,0x174));var _0xd684=function(_0x205201,_0x2ba45b){_0x205201=_0x205201-0x0;var _0x4744d0=_0x684d[_0x205201];return _0x4744d0;};'use strict';var _=require('lodash');var util=require(_0xd684('0x0'));var logger=require(_0xd684('0x1'))(_0xd684('0x2'));var moment=require('moment');var BPromise=require(_0xd684('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd684('0x4'));var rimraf=require(_0xd684('0x5'));var config=require(_0xd684('0x6'));var attributes=require('./chatGroup.attributes');module[_0xd684('0x7')]=function(_0x5f50ac,_0x3bf907){return _0x5f50ac['define'](_0xd684('0x8'),attributes,{'tableName':_0xd684('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 769482e..ce5e06b 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 _0x6d33=['socket.io-emitter','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x4e8b11,_0x1d6092){var _0x4d8021=function(_0x44a06f){while(--_0x44a06f){_0x4e8b11['push'](_0x4e8b11['shift']());}};_0x4d8021(++_0x1d6092);}(_0x6d33,0x184));var _0x36d3=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x6d33[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require(_0x36d3('0x0'));var util=require(_0x36d3('0x1'));var moment=require('moment');var BPromise=require(_0x36d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36d3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x36d3('0x4'));var logger=require(_0x36d3('0x5'))('rpc');var config=require(_0x36d3('0x6'));var jayson=require(_0x36d3('0x7'));var client=jayson[_0x36d3('0x8')][_0x36d3('0x9')]({'port':0x232a});config[_0x36d3('0xa')]=_['defaults'](config[_0x36d3('0xa')],{'host':_0x36d3('0xb'),'port':0x18eb});var socket=require(_0x36d3('0xc'))(new Redis(config[_0x36d3('0xa')]));require('./chatGroup.socket')[_0x36d3('0xd')](socket);function respondWithRpcPromise(_0x88bd91,_0x10de3c,_0x19c95b){return new BPromise(function(_0xaa67e1,_0x1de1e2){return client[_0x36d3('0xe')](_0x88bd91,_0x19c95b)[_0x36d3('0xf')](function(_0x3f99a9){logger[_0x36d3('0x10')](_0x36d3('0x11'),_0x10de3c,'request\x20sent');logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x10de3c,_0x36d3('0x12'),JSON[_0x36d3('0x13')](_0x3f99a9));if(_0x3f99a9[_0x36d3('0x14')]){if(_0x3f99a9['error'][_0x36d3('0x15')]===0x1f4){logger[_0x36d3('0x14')]('ChatGroup,\x20%s,\x20%s',_0x10de3c,_0x3f99a9[_0x36d3('0x14')]['message']);return _0x1de1e2(_0x3f99a9[_0x36d3('0x14')][_0x36d3('0x16')]);}logger['error'](_0x36d3('0x11'),_0x10de3c,_0x3f99a9[_0x36d3('0x14')][_0x36d3('0x16')]);return _0xaa67e1(_0x3f99a9[_0x36d3('0x14')]['message']);}else{logger[_0x36d3('0x10')]('ChatGroup,\x20%s,\x20%s',_0x10de3c,'request\x20sent');_0xaa67e1(_0x3f99a9[_0x36d3('0x17')][_0x36d3('0x16')]);}})[_0x36d3('0x18')](function(_0x380cda){logger[_0x36d3('0x14')](_0x36d3('0x11'),_0x10de3c,_0x380cda);_0x1de1e2(_0x380cda);});});} \ No newline at end of file +var _0x7f13=['moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x4f9099,_0x371132){var _0x22c7a9=function(_0x1a3d62){while(--_0x1a3d62){_0x4f9099['push'](_0x4f9099['shift']());}};_0x22c7a9(++_0x371132);}(_0x7f13,0xf9));var _0x37f1=function(_0x32f3bc,_0x2b5218){_0x32f3bc=_0x32f3bc-0x0;var _0x3f8cc2=_0x7f13[_0x32f3bc];return _0x3f8cc2;};'use strict';var _=require(_0x37f1('0x0'));var util=require('util');var moment=require(_0x37f1('0x1'));var BPromise=require(_0x37f1('0x2'));var rs=require(_0x37f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x37f1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x37f1('0x5'));var config=require('../../config/environment');var jayson=require(_0x37f1('0x6'));var client=jayson['client'][_0x37f1('0x7')]({'port':0x232a});config[_0x37f1('0x8')]=_[_0x37f1('0x9')](config[_0x37f1('0x8')],{'host':_0x37f1('0xa'),'port':0x18eb});var socket=require(_0x37f1('0xb'))(new Redis(config[_0x37f1('0x8')]));require(_0x37f1('0xc'))[_0x37f1('0xd')](socket);function respondWithRpcPromise(_0x192d69,_0x5affc4,_0x1cf332){return new BPromise(function(_0x3c535f,_0x40c9b5){return client['request'](_0x192d69,_0x1cf332)['then'](function(_0x5a8558){logger[_0x37f1('0xe')]('ChatGroup,\x20%s,\x20%s',_0x5affc4,_0x37f1('0xf'));logger[_0x37f1('0x10')](_0x37f1('0x11'),_0x5affc4,_0x37f1('0xf'),JSON[_0x37f1('0x12')](_0x5a8558));if(_0x5a8558[_0x37f1('0x13')]){if(_0x5a8558[_0x37f1('0x13')][_0x37f1('0x14')]===0x1f4){logger[_0x37f1('0x13')](_0x37f1('0x15'),_0x5affc4,_0x5a8558[_0x37f1('0x13')][_0x37f1('0x16')]);return _0x40c9b5(_0x5a8558[_0x37f1('0x13')][_0x37f1('0x16')]);}logger['error'](_0x37f1('0x15'),_0x5affc4,_0x5a8558[_0x37f1('0x13')][_0x37f1('0x16')]);return _0x3c535f(_0x5a8558[_0x37f1('0x13')]['message']);}else{logger[_0x37f1('0xe')](_0x37f1('0x15'),_0x5affc4,_0x37f1('0xf'));_0x3c535f(_0x5a8558[_0x37f1('0x17')][_0x37f1('0x16')]);}})[_0x37f1('0x18')](function(_0xb271a1){logger[_0x37f1('0x13')](_0x37f1('0x15'),_0x5affc4,_0xb271a1);_0x40c9b5(_0xb271a1);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 345fe2c..299a3d6 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 _0x593f=['emit','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove','update'];(function(_0x5a4b13,_0x3548cc){var _0x336140=function(_0x4f0fbf){while(--_0x4f0fbf){_0x5a4b13['push'](_0x5a4b13['shift']());}};_0x336140(++_0x3548cc);}(_0x593f,0x71));var _0xf593=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0x593f[_0x2bcb75];return _0x175345;};'use strict';var ChatGroupEvents=require(_0xf593('0x0'));var events=[_0xf593('0x1'),_0xf593('0x2'),_0xf593('0x3')];function createListener(_0x377526,_0x5693a2){return function(_0x583894){_0x5693a2[_0xf593('0x4')](_0x377526,_0x583894);};}function removeListener(_0x2d44d4,_0x4b3f3a){return function(){ChatGroupEvents[_0xf593('0x5')](_0x2d44d4,_0x4b3f3a);};}exports[_0xf593('0x6')]=function(_0x27fa0d){for(var _0x429684=0x0,_0xcfb6c6=events[_0xf593('0x7')];_0x429684<_0xcfb6c6;_0x429684++){var _0xd47460=events[_0x429684];var _0x2f585e=createListener(_0xf593('0x8')+_0xd47460,_0x27fa0d);ChatGroupEvents['on'](_0xd47460,_0x2f585e);}}; \ No newline at end of file +var _0xd37b=['removeListener','register','length','chatGroup:','./chatGroup.events','remove','update','emit'];(function(_0x2dd80f,_0x53bc8e){var _0x3d8ae5=function(_0x2cda1b){while(--_0x2cda1b){_0x2dd80f['push'](_0x2dd80f['shift']());}};_0x3d8ae5(++_0x53bc8e);}(_0xd37b,0xac));var _0xbd37=function(_0x234250,_0x51238d){_0x234250=_0x234250-0x0;var _0x55f34a=_0xd37b[_0x234250];return _0x55f34a;};'use strict';var ChatGroupEvents=require(_0xbd37('0x0'));var events=['save',_0xbd37('0x1'),_0xbd37('0x2')];function createListener(_0x45f750,_0x5be407){return function(_0x17e3c9){_0x5be407[_0xbd37('0x3')](_0x45f750,_0x17e3c9);};}function removeListener(_0x5dd9de,_0x2cb30a){return function(){ChatGroupEvents[_0xbd37('0x4')](_0x5dd9de,_0x2cb30a);};}exports[_0xbd37('0x5')]=function(_0x4c394e){for(var _0x560e7f=0x0,_0xa9b8f0=events[_0xbd37('0x6')];_0x560e7f<_0xa9b8f0;_0x560e7f++){var _0x3274c8=events[_0x560e7f];var _0x1c2bcb=createListener(_0xbd37('0x7')+_0x3274c8,_0x4c394e);ChatGroupEvents['on'](_0x3274c8,_0x1c2bcb);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 8f74741..9b684db 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 _0x4efa=['put','update','delete','destroy','removeMembers','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage'];(function(_0x5d99a9,_0x69fed2){var _0x2f454f=function(_0x3c837a){while(--_0x3c837a){_0x5d99a9['push'](_0x5d99a9['shift']());}};_0x2f454f(++_0x69fed2);}(_0x4efa,0xc2));var _0xa4ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4efa[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa4ef('0x0'));var util=require(_0xa4ef('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa4ef('0x2')]();var auth=require(_0xa4ef('0x3'));var interaction=require(_0xa4ef('0x4'));var config=require(_0xa4ef('0x5'));var controller=require(_0xa4ef('0x6'));router[_0xa4ef('0x7')]('/',auth[_0xa4ef('0x8')](),controller[_0xa4ef('0x9')]);router[_0xa4ef('0x7')](_0xa4ef('0xa'),auth[_0xa4ef('0x8')](),controller['describe']);router['get'](_0xa4ef('0xb'),auth[_0xa4ef('0x8')](),controller[_0xa4ef('0xc')]);router[_0xa4ef('0x7')](_0xa4ef('0xd'),auth['isAuthenticated'](),controller[_0xa4ef('0xe')]);router[_0xa4ef('0x7')](_0xa4ef('0xf'),auth[_0xa4ef('0x8')](),controller[_0xa4ef('0x10')]);router[_0xa4ef('0x7')](_0xa4ef('0x11'),auth['isAuthenticated'](),controller['getMessages']);router[_0xa4ef('0x12')]('/',auth[_0xa4ef('0x8')](),controller[_0xa4ef('0x13')]);router[_0xa4ef('0x12')]('/:id/members',auth['isAuthenticated'](),controller[_0xa4ef('0x14')]);router[_0xa4ef('0x12')](_0xa4ef('0x11'),auth['isAuthenticated'](),controller[_0xa4ef('0x15')]);router[_0xa4ef('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xa4ef('0x17')]);router[_0xa4ef('0x18')](_0xa4ef('0xb'),auth[_0xa4ef('0x8')](),controller[_0xa4ef('0x19')]);router['delete'](_0xa4ef('0xf'),auth[_0xa4ef('0x8')](),controller[_0xa4ef('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xb949=['util','path','Router','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe','describe','/:id','isAuthenticated','show','getMembers','/:id/messages','getMessages','post','addMessage','put','update','delete','destroy','removeMembers','exports'];(function(_0x377ce7,_0x3965f7){var _0x2e5a23=function(_0x1fd216){while(--_0x1fd216){_0x377ce7['push'](_0x377ce7['shift']());}};_0x2e5a23(++_0x3965f7);}(_0xb949,0x108));var _0x9b94=function(_0x345553,_0x1aa0ee){_0x345553=_0x345553-0x0;var _0x2e4de8=_0xb949[_0x345553];return _0x2e4de8;};'use strict';var multer=require('multer');var util=require(_0x9b94('0x0'));var path=require(_0x9b94('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9b94('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x9b94('0x3'));var config=require(_0x9b94('0x4'));var controller=require(_0x9b94('0x5'));router[_0x9b94('0x6')]('/',auth['isAuthenticated'](),controller[_0x9b94('0x7')]);router[_0x9b94('0x6')](_0x9b94('0x8'),auth['isAuthenticated'](),controller[_0x9b94('0x9')]);router[_0x9b94('0x6')](_0x9b94('0xa'),auth[_0x9b94('0xb')](),controller[_0x9b94('0xc')]);router[_0x9b94('0x6')]('/:id/unread',auth[_0x9b94('0xb')](),controller['getUnread']);router[_0x9b94('0x6')]('/:id/members',auth[_0x9b94('0xb')](),controller[_0x9b94('0xd')]);router[_0x9b94('0x6')](_0x9b94('0xe'),auth[_0x9b94('0xb')](),controller[_0x9b94('0xf')]);router[_0x9b94('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9b94('0x10')]('/:id/members',auth['isAuthenticated'](),controller['addMembers']);router[_0x9b94('0x10')](_0x9b94('0xe'),auth[_0x9b94('0xb')](),controller[_0x9b94('0x11')]);router[_0x9b94('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9b94('0x13')]);router[_0x9b94('0x14')](_0x9b94('0xa'),auth[_0x9b94('0xb')](),controller[_0x9b94('0x15')]);router[_0x9b94('0x14')]('/:id/members',auth[_0x9b94('0xb')](),controller[_0x9b94('0x16')]);module[_0x9b94('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index e507c29..720372b 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 _0xe293=['long','out','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE'];(function(_0xee87d3,_0xdef526){var _0xb346=function(_0x28208d){while(--_0x28208d){_0xee87d3['push'](_0xee87d3['shift']());}};_0xb346(++_0xdef526);}(_0xe293,0x65));var _0x3e29=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0xe293[_0x2f48cd];return _0x193ae2;};'use strict';var Sequelize=require('sequelize');module[_0x3e29('0x0')]={'closed':{'type':Sequelize[_0x3e29('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3e29('0x2')]},'ratingType':{'type':Sequelize[_0x3e29('0x3')](_0x3e29('0x4'),_0x3e29('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x3e29('0x6')]},'mailTranscript':{'type':Sequelize[_0x3e29('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3e29('0x8')]},'disposition':{'type':Sequelize[_0x3e29('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x3e29('0x7')]},'osName':{'type':Sequelize[_0x3e29('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x3e29('0x7')]},'deviceVendor':{'type':Sequelize[_0x3e29('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x3e29('0x7')]},'formData':{'type':Sequelize[_0x3e29('0x6')](_0x3e29('0x9'))},'read1stAt':{'type':Sequelize[_0x3e29('0x8')]},'lastMsgAt':{'type':Sequelize[_0x3e29('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x3e29('0x3')]('in',_0x3e29('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3e29('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x3e29('0x6')]}}; \ No newline at end of file +var _0x5334=['long','ENUM','out','sequelize','exports','BOOLEAN','INTEGER','star','thumb','TEXT','STRING','DATE'];(function(_0x233716,_0x346676){var _0x302298=function(_0x53d84c){while(--_0x53d84c){_0x233716['push'](_0x233716['shift']());}};_0x302298(++_0x346676);}(_0x5334,0x1a7));var _0x4533=function(_0x17a215,_0x4c8ce8){_0x17a215=_0x17a215-0x0;var _0x5a435c=_0x5334[_0x17a215];return _0x5a435c;};'use strict';var Sequelize=require(_0x4533('0x0'));module[_0x4533('0x1')]={'closed':{'type':Sequelize[_0x4533('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x4533('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x4533('0x4'),_0x4533('0x5')),'defaultValue':_0x4533('0x4')},'ratingMessage':{'type':Sequelize[_0x4533('0x6')]},'pathTranscript':{'type':Sequelize[_0x4533('0x6')]},'mailTranscript':{'type':Sequelize[_0x4533('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x4533('0x8')]},'disposition':{'type':Sequelize[_0x4533('0x7')]},'note':{'type':Sequelize[_0x4533('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x4533('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x4533('0x7')]},'deviceType':{'type':Sequelize[_0x4533('0x7')]},'referer':{'type':Sequelize[_0x4533('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x4533('0x6')](_0x4533('0x9'))},'read1stAt':{'type':Sequelize[_0x4533('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4533('0xa')]('in',_0x4533('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x4533('0x7')]},'customerPort':{'type':Sequelize[_0x4533('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x4533('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 0e62fa0..160dde4 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 _0x4888=['follow','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','attachId','join','root','server/files/attachments/','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','agentAlias','System','%s%d','agentIdentifier','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','omit','getMessages','nolimit','pick','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','addTags','ids','spread','color','emit','chatInteractionTags:save','removeTags','download','unix','server','tmp','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Account','Owner','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','YYYY-MM-DD','closedAt','browserName','osName','referer','customerIp','customerPort','N.A.','existsSync','createReadStream','createWriteStream','renderFile','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','register','http','client','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~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatInteraction,\x20%s,\x20%s','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','fullname','TagIds','split','forEach','Tags','push','index','ChatInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','select','field','from','tools_tags','u.id','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','length','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','text','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','rawAttributes','includeAll','include','options','create','body','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','vidaooApiKey','MotionCWB:'];(function(_0x3b30be,_0x47bcd9){var _0x546361=function(_0x233425){while(--_0x233425){_0x3b30be['push'](_0x3b30be['shift']());}};_0x546361(++_0x47bcd9);}(_0x4888,0x198));var _0x8488=function(_0x263721,_0x10ce8e){_0x263721=_0x263721-0x0;var _0x5d503b=_0x4888[_0x263721];return _0x5d503b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8488('0x0'));var rimraf=require(_0x8488('0x1'));var zipdir=require(_0x8488('0x2'));var jsonpatch=require(_0x8488('0x3'));var rp=require(_0x8488('0x4'));var moment=require(_0x8488('0x5'));var BPromise=require(_0x8488('0x6'));var Mustache=require('mustache');var util=require(_0x8488('0x7'));var path=require(_0x8488('0x8'));var sox=require(_0x8488('0x9'));var csv=require(_0x8488('0xa'));var ejs=require(_0x8488('0xb'));var fs=require('fs');var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0xa'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var db=require(_0x8488('0x16'))['db'];config['redis']=_[_0x8488('0x17')](config[_0x8488('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8488('0x18')]));require('./chatInteraction.socket')[_0x8488('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8488('0x1a')]({'port':0x232b});var client9004=jayson[_0x8488('0x1b')][_0x8488('0x1a')]({'port':0x232c});function checkPasswordPattern(_0x2bcb7c,_0x3b3cfa,_0x8d3b3d){if(_0x8d3b3d){var _0x165139=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x165139['test'](_0x3b3cfa)){return _0x2bcb7c;}else{throw new db[(_0x8488('0x1c'))][(_0x8488('0x1d'))](_0x8488('0x1e'));}}else{return _0x2bcb7c;}}function respondWithRpcPromise(_0x37361d,_0x60ae2f,_0x39775f,_0x1aedb1){return new BPromise(function(_0x27c62a,_0x514c31){var _0x1de64a=_0x1aedb1||client;return _0x1de64a[_0x8488('0x1f')](_0x37361d,_0x39775f)[_0x8488('0x20')](function(_0x3dd93e){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x60ae2f,_0x8488('0x21'));logger[_0x8488('0x22')](_0x8488('0x23'),_0x60ae2f,_0x8488('0x21'),JSON[_0x8488('0x24')](_0x3dd93e));if(_0x3dd93e[_0x8488('0x25')]){if(_0x3dd93e[_0x8488('0x25')][_0x8488('0x26')]===0x1f4){logger[_0x8488('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x60ae2f,_0x3dd93e[_0x8488('0x25')][_0x8488('0x27')]);return _0x514c31(_0x3dd93e[_0x8488('0x25')][_0x8488('0x27')]);}logger[_0x8488('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x60ae2f,_0x3dd93e['error']['message']);return _0x27c62a(_0x3dd93e['error'][_0x8488('0x27')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x60ae2f,_0x8488('0x21'));_0x27c62a(_0x3dd93e[_0x8488('0x28')][_0x8488('0x27')]);}})[_0x8488('0x29')](function(_0x287662){logger['error'](_0x8488('0x2a'),_0x60ae2f,_0x287662);_0x514c31(_0x287662);});});}function respondWithStatusCode(_0x38c137,_0xf9720e){_0xf9720e=_0xf9720e||0xcc;return function(_0x3df1f9){if(_0x3df1f9){return _0x38c137[_0x8488('0x2b')](_0xf9720e);}return _0x38c137[_0x8488('0x2c')](_0xf9720e)[_0x8488('0x2d')]();};}function respondWithResult(_0x296b6c,_0x368f9c){_0x368f9c=_0x368f9c||0xc8;return function(_0x1d9317){if(_0x1d9317){return _0x296b6c[_0x8488('0x2c')](_0x368f9c)['json'](_0x1d9317);}};}function respondWithFilteredResult(_0x57ce3c,_0x4e3fe2){return function(_0x292fe8){if(_0x292fe8){var _0x408c36=_0x292fe8[_0x8488('0x2e')],_0x19cf42=_0x4e3fe2['offset'],_0x121dcc=_0x4e3fe2[_0x8488('0x2f')]+_0x4e3fe2[_0x8488('0x30')],_0x117321;if(_0x121dcc>=_0x408c36){_0x121dcc=_0x408c36;_0x117321=0xc8;}else{_0x117321=0xce;}_0x57ce3c[_0x8488('0x2c')](_0x117321);return _0x57ce3c[_0x8488('0x31')](_0x8488('0x32'),_0x19cf42+'-'+_0x121dcc+'/'+_0x408c36)['json'](_0x292fe8);}return null;};}function patchUpdates(_0x46c95b){return function(_0x23f67a){try{jsonpatch['apply'](_0x23f67a,_0x46c95b,!![]);}catch(_0x1b0637){return BPromise[_0x8488('0x33')](_0x1b0637);}return _0x23f67a[_0x8488('0x34')]();};}function saveUpdates(_0x446f90,_0x4555d0){return function(_0x484a0e){if(_0x484a0e){return _0x484a0e[_0x8488('0x35')](_0x446f90)[_0x8488('0x20')](function(_0x3f3861){return _0x3f3861;});}return null;};}function removeEntity(_0x584965,_0x17ca2f){return function(_0x5bc335){if(_0x5bc335){return _0x5bc335[_0x8488('0x36')]()[_0x8488('0x20')](function(){_0x584965[_0x8488('0x2c')](0xcc)[_0x8488('0x2d')]();});}};}function handleEntityNotFound(_0x4c3b59,_0x1bb256){return function(_0xe71bd9){if(!_0xe71bd9){_0x4c3b59[_0x8488('0x2b')](0x194);}return _0xe71bd9;};}function handleError(_0x583ece,_0x3920d1){_0x3920d1=_0x3920d1||0x1f4;return function(_0x17bfea){logger[_0x8488('0x25')](_0x17bfea[_0x8488('0x37')]);if(_0x17bfea[_0x8488('0x38')]){delete _0x17bfea[_0x8488('0x38')];}_0x583ece[_0x8488('0x2c')](_0x3920d1)[_0x8488('0x39')](_0x17bfea);};}function getInteractionUsers(_0x1a8235,_0x2171dc){return new BPromise(function(_0x3b6d07,_0x4cb675){try{if(_0x2171dc[_0x1a8235['id']]){_0x1a8235['Users']=_[_0x8488('0x3a')](_0x2171dc[_0x1a8235['id']],function(_0x36c17a){return{'id':_0x36c17a['id'],'fullname':_0x36c17a[_0x8488('0x3b')]};});}}catch(_0x390a17){_0x4cb675(_0x390a17);}_0x3b6d07(_0x1a8235);});}function getInteractionTags(_0x2d9fa1,_0x910460){return new BPromise(function(_0x13c260,_0x4481df){try{if(_0x2d9fa1[_0x8488('0x3c')]){_0x2d9fa1['Tags']=[];_0x2d9fa1[_0x8488('0x3c')][_0x8488('0x3d')](',')[_0x8488('0x3e')](function(_0x520e82){_0x2d9fa1[_0x8488('0x3f')][_0x8488('0x40')](_0x910460[_0x520e82]);});}delete _0x2d9fa1[_0x8488('0x3c')];}catch(_0x28bc84){_0x4481df(_0x28bc84);}_0x13c260(_0x2d9fa1);});}function updateChatInteraction(_0x44d5f2,_0x156246,_0x1aac4b){return new BPromise(function(_0x496ea0,_0x45db70){return getInteractionUsers(_0x44d5f2,_0x1aac4b)[_0x8488('0x20')](function(_0x891cff){return getInteractionTags(_0x891cff,_0x156246);})['then'](function(_0x3649ae){_0x496ea0(_0x3649ae);})['catch'](function(_0x40ee7e){_0x45db70(_0x40ee7e);});});}exports[_0x8488('0x41')]=function(_0x5cbd11,_0x22a3f3){var _0x4023ac={},_0x10cc1f={},_0x25ef13={'count':0x0,'rows':[]};var _0x2158b2=_['map'](db[_0x8488('0x42')]['rawAttributes'],function(_0x3440ae){return{'name':_0x3440ae[_0x8488('0x43')],'type':_0x3440ae[_0x8488('0x44')][_0x8488('0x45')]};});_0x10cc1f[_0x8488('0x46')]=_[_0x8488('0x3a')](_0x2158b2,_0x8488('0x38'));_0x10cc1f[_0x8488('0x47')]=_[_0x8488('0x48')](_0x5cbd11[_0x8488('0x47')]);_0x10cc1f[_0x8488('0x49')]=_[_0x8488('0x4a')](_0x10cc1f[_0x8488('0x46')],_0x10cc1f[_0x8488('0x47')]);_0x4023ac[_0x8488('0x4b')]=_[_0x8488('0x4a')](_0x10cc1f[_0x8488('0x46')],qs['fields'](_0x5cbd11[_0x8488('0x47')][_0x8488('0x4c')]));_0x4023ac[_0x8488('0x4b')]=_0x4023ac[_0x8488('0x4b')]['length']?_0x4023ac[_0x8488('0x4b')]:_0x10cc1f[_0x8488('0x46')];if(!_0x5cbd11[_0x8488('0x47')][_0x8488('0x4d')]('nolimit')){_0x4023ac[_0x8488('0x30')]=qs[_0x8488('0x30')](_0x5cbd11[_0x8488('0x47')][_0x8488('0x30')]);_0x4023ac[_0x8488('0x2f')]=qs[_0x8488('0x2f')](_0x5cbd11[_0x8488('0x47')][_0x8488('0x2f')]);}_0x4023ac[_0x8488('0x4e')]=qs[_0x8488('0x4f')](_0x5cbd11[_0x8488('0x47')][_0x8488('0x4f')]);_0x4023ac[_0x8488('0x50')]=qs['filters'](_['pick'](_0x5cbd11[_0x8488('0x47')],_0x10cc1f[_0x8488('0x49')]),_0x2158b2);var _0x3749da=[];var _0x45bd4b=squel[_0x8488('0x51')]()[_0x8488('0x52')]('id')[_0x8488('0x52')](_0x8488('0x38'))[_0x8488('0x52')]('color')[_0x8488('0x53')](_0x8488('0x54'));var _0x51d1eb=squel[_0x8488('0x51')]()[_0x8488('0x52')](_0x8488('0x55'))[_0x8488('0x52')]('u.fullname')[_0x8488('0x52')](_0x8488('0x56'))[_0x8488('0x53')]('user_has_chat_interactions','ui')[_0x8488('0x57')](_0x8488('0x58'),'u',_0x8488('0x59'));var _0x3eb06e=squel['select']()[_0x8488('0x53')]('chat_interactions','i')['left_join'](_0x8488('0x5a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x8488('0x57')](_0x8488('0x58'),'o',_0x8488('0x5b'))[_0x8488('0x57')](_0x8488('0x5c'),'a',_0x8488('0x5d'))['left_join'](_0x8488('0x5e'),'me',_0x8488('0x5f'))[_0x8488('0x57')](_0x8488('0x60'),'it',_0x8488('0x61'))['left_join'](_0x8488('0x54'),'t','t.id\x20=\x20it.TagId');var _0x137f50=squel[_0x8488('0x62')]();var _0x5da71e=[];var _0x342188=squel[_0x8488('0x62')]();var _0x304ceb;if(_0x5cbd11[_0x8488('0x47')][_0x8488('0x63')]){_0x304ceb=as[_0x8488('0x64')](_0x5cbd11['query'][_0x8488('0x63')]);var _0x568da7=_0x304ceb[_0x8488('0x65')];for(var _0x3fa6e2=0x0;_0x3fa6e2<_0x304ceb[_0x8488('0x66')][_0x8488('0x67')];_0x3fa6e2++){var _0x38cfa5=_0x304ceb[_0x8488('0x66')][_0x3fa6e2];var _0x5a4426='i';var _0x43ec52=_['find'](_0x2158b2,[_0x8488('0x38'),_0x38cfa5[_0x8488('0x52')]]);if(!_0x43ec52){switch(_0x38cfa5[_0x8488('0x52')]){case _0x8488('0x68'):if(_0x38cfa5[_0x8488('0x69')]==0x1){_0x3eb06e[_0x8488('0x6a')]('`'+_0x38cfa5['field']+'`\x20=\x200');}else{_0x3eb06e['having']('`'+_0x38cfa5[_0x8488('0x52')]+_0x8488('0x6b'));}break;case _0x8488('0x6c'):if(_0x38cfa5[_0x8488('0x6d')]===_0x8488('0x6e')){if(_0x38cfa5[_0x8488('0x69')][_0x8488('0x3d')]('\x20')[_0x8488('0x67')]>0x1){_0x137f50[_0x568da7](_0x8488('0x6f'),qs[_0x8488('0x70')](_0x38cfa5['value']),null);}else{var _0x1f7e98='%'+_0x38cfa5[_0x8488('0x69')]+'%';_0x137f50[_0x568da7](_0x8488('0x71'),_0x1f7e98,_0x1f7e98,_0x1f7e98);}}else{_0x43ec52=_['find'](_0x2158b2,['name',_0x8488('0x72')]);_0x38cfa5[_0x8488('0x52')]=_0x8488('0x72');_0x1a3988=as[_0x8488('0x73')](_0x5a4426,_0x43ec52['type'],_0x38cfa5);_0x137f50[_0x568da7](_0x1a3988['text'],_0x1a3988[_0x8488('0x69')][_0x8488('0x74')],_0x1a3988[_0x8488('0x69')]['end']);}break;case _0x8488('0x75'):var _0x401f4d=_0x38cfa5[_0x8488('0x69')][_0x8488('0x3d')](',')[_0x8488('0x3a')](function(_0x5e41e5){return Number(_0x5e41e5);});_0x401f4d[_0x8488('0x3e')](function(_0x3babee){_0x342188['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3babee+',%');});_0x5da71e=_[_0x8488('0x76')](_0x5da71e,_0x401f4d);break;case _0x8488('0x77'):if(_0x38cfa5['operator']===_0x8488('0x6e')){_0x137f50[_0x568da7](_0x8488('0x78'),'%'+_0x38cfa5[_0x8488('0x69')]+'%',null);}else{_0x43ec52=_[_0x8488('0x79')](_0x2158b2,[_0x8488('0x38'),_0x8488('0x7a')]);_0x38cfa5[_0x8488('0x52')]='UserId';_0x1a3988=as[_0x8488('0x73')](_0x5a4426,_0x43ec52[_0x8488('0x44')],_0x38cfa5);_0x137f50[_0x568da7](_0x1a3988['text'],_0x1a3988['value'][_0x8488('0x74')],_0x1a3988[_0x8488('0x69')][_0x8488('0x2d')]);}break;case'body':_0x1a3988=as[_0x8488('0x73')]('me',null,_0x38cfa5);_0x137f50[_0x568da7](_0x1a3988[_0x8488('0x7b')],_0x1a3988['value'][_0x8488('0x74')],_0x1a3988['value'][_0x8488('0x2d')]);break;}}else{var _0x1a3988=as[_0x8488('0x73')](_0x5a4426,_0x43ec52['type'],_0x38cfa5);_0x137f50[_0x568da7](_0x1a3988[_0x8488('0x7b')],_0x1a3988[_0x8488('0x69')]['start'],_0x1a3988['value'][_0x8488('0x2d')]);}}}else{var _0x21a42e=_(_0x5cbd11[_0x8488('0x47')])[_0x8488('0x48')]()[_0x8488('0x3a')](function(_0x2fb435){return _[_0x8488('0x7c')](_0x2158b2,[_0x8488('0x38'),_0x2fb435])?_0x2fb435:undefined;})[_0x8488('0x7d')]()[_0x8488('0x69')]();if(!_['isEmpty'](_0x21a42e)){_0x21a42e[_0x8488('0x3e')](function(_0x5c0599){if(_0x5c0599===_0x8488('0x7e')){_0x3eb06e[_0x8488('0x50')](_0x8488('0x7f'),[][_0x8488('0x80')](_0x5cbd11['query'][_0x5c0599]));}else if(_0x5c0599===_0x8488('0x81')){var _0x15ee3a=JSON['parse'](_0x5cbd11[_0x8488('0x47')][_0x5c0599])['$gte'];var _0x26241b=JSON[_0x8488('0x82')](_0x5cbd11[_0x8488('0x47')][_0x5c0599])[_0x8488('0x83')];_0x3eb06e[_0x8488('0x50')](_0x8488('0x84'),_0x15ee3a,_0x26241b);}else{if(_0x5cbd11[_0x8488('0x47')][_0x5c0599]===_0x8488('0x85')){_0x3eb06e['where']('i.'+_0x5c0599+_0x8488('0x86'));}else{_0x3eb06e['where']('i.'+_0x5c0599+'\x20=\x20?',_0x5cbd11[_0x8488('0x47')][_0x5c0599]);}}});}if(_0x5cbd11[_0x8488('0x47')][_0x8488('0x87')]){if(_0x5cbd11['query']['read']==0x1){_0x3eb06e[_0x8488('0x6a')](_0x8488('0x88'));}else{_0x3eb06e['having'](_0x8488('0x89'));}}if(_0x5cbd11[_0x8488('0x47')][_0x8488('0x8a')]){_0x5da71e=_[_0x8488('0x8b')](_0x5cbd11[_0x8488('0x47')][_0x8488('0x8a')])?_0x5cbd11['query'][_0x8488('0x8a')]:new Array(_0x5cbd11[_0x8488('0x47')][_0x8488('0x8a')]);_0x5da71e['forEach'](function(_0x1cfe70){_0x342188['or'](_0x8488('0x8c'),'%,'+_0x1cfe70+',%');});}if(_0x5cbd11[_0x8488('0x47')]['filter']){var _0x28468b=_0x5cbd11[_0x8488('0x47')]['filter']['replace']('\x5c','\x5c\x5c')[_0x8488('0x8d')]('\x27\x27',_0x8488('0x8e'));if(qs['isNumeric'](_0x28468b)){_0x137f50['or'](_0x8488('0x8f'),_0x28468b+'%');}else{_0x137f50['or'](_0x8488('0x90'),qs['getFullTextValue'](_0x28468b))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x28468b+'%');}}}_0x3eb06e[_0x8488('0x50')](_0x137f50);_0x3eb06e['group'](_0x8488('0x91'));var _0x202d16={'type':db[_0x8488('0x1c')][_0x8488('0x92')]['SELECT'],'raw':!![]};var _0xde3227=_0x3eb06e['clone']();_0xde3227[_0x8488('0x52')]('i.id');_0xde3227[_0x8488('0x52')](_0x8488('0x93'),_0x8488('0x68'));if(_0x4023ac[_0x8488('0x4e')]){_0x4023ac[_0x8488('0x4e')][_0x8488('0x3e')](function(_0x784d23){_0x3eb06e[_0x8488('0x4e')]('i.'+_0x784d23[0x0],_0x784d23[0x1]===_0x8488('0x94')?![]:!![]);});}if(!_[_0x8488('0x95')](_0x5da71e)){_0x3eb06e[_0x8488('0x6a')](_0x342188);_0xde3227[_0x8488('0x50')](_0x8488('0x96'),_0x5da71e);}BPromise[_0x8488('0x97')]()['then'](function(){if(!_0x304ceb){if(_0x5cbd11[_0x8488('0x47')][_0x8488('0x7e')]||_0x5cbd11['query'][_0x8488('0x98')])return;_0xde3227[_0x8488('0x50')](_0x8488('0x99'));_0x3eb06e[_0x8488('0x50')](_0x8488('0x99'));return;}return _0x5cbd11[_0x8488('0x9a')][_0x8488('0x9b')]({'attributes':['id'],'raw':!![]})[_0x8488('0x20')](function(_0x8682a5){if(_[_0x8488('0x95')](_0x8682a5)){_0xde3227[_0x8488('0x50')]('i.ChatWebsiteId\x20IS\x20NULL');_0x3eb06e[_0x8488('0x50')](_0x8488('0x9c'));}else{_0xde3227['where'](_0x8488('0x7f'),_[_0x8488('0x3a')](_0x8682a5,'id'));_0x3eb06e[_0x8488('0x50')](_0x8488('0x7f'),_[_0x8488('0x3a')](_0x8682a5,'id'));}});})['then'](function(){db['sequelize'][_0x8488('0x47')](_0xde3227[_0x8488('0x9d')](),_0x202d16)[_0x8488('0x20')](function(_0x244a2b){_0x25ef13[_0x8488('0x2e')]=_0x244a2b[_0x8488('0x67')];if(_0x25ef13[_0x8488('0x2e')]===0x0)return[];return db[_0x8488('0x9e')][_0x8488('0x47')](_0x45bd4b[_0x8488('0x9d')](),_0x202d16)[_0x8488('0x20')](function(_0xb045bc){_0x3749da=_[_0x8488('0x9f')](_0xb045bc,'id');_0x202d16=_[_0x8488('0xa0')](_0x202d16,{'model':db[_0x8488('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5cbd11['query'][_0x8488('0x4c')]){_0x4023ac['attributes']['forEach'](function(_0x1e25a3){_0x3eb06e[_0x8488('0x52')]('i.'+_0x1e25a3);});}else{_0x3eb06e[_0x8488('0x52')](_0x8488('0x93'),_0x8488('0x68'));_0x3eb06e[_0x8488('0x52')](_0x8488('0xa1'),_0x8488('0xa2'));_0x3eb06e[_0x8488('0x52')](_0x8488('0xa3'),'Account.mandatoryDisposition');_0x3eb06e[_0x8488('0x52')](_0x8488('0xa4'));_0x3eb06e[_0x8488('0x52')](_0x8488('0xa5'),_0x8488('0xa6'));_0x3eb06e[_0x8488('0x52')]('c.lastName',_0x8488('0xa7'));_0x3eb06e['field'](_0x8488('0xa8'),_0x8488('0xa9'));_0x3eb06e['field']('c.phone',_0x8488('0xaa'));_0x3eb06e[_0x8488('0x52')](_0x8488('0xab'),_0x8488('0xac'));_0x3eb06e[_0x8488('0x52')]('c.fax',_0x8488('0xad'));_0x3eb06e[_0x8488('0x52')]('o.fullname','Owner.fullname');_0x3eb06e[_0x8488('0x52')](_0x8488('0xae'),_0x8488('0xaf'));_0x3eb06e['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8488('0x3c'));}if(_0x4023ac[_0x8488('0x30')])_0x3eb06e[_0x8488('0x30')](_0x4023ac['limit']);if(_0x4023ac[_0x8488('0x2f')])_0x3eb06e[_0x8488('0x2f')](_0x4023ac[_0x8488('0x2f')]);return db[_0x8488('0x9e')][_0x8488('0x47')](_0x3eb06e[_0x8488('0x9d')](),_0x202d16);})[_0x8488('0x20')](function(_0x1c8f5d){_0x51d1eb[_0x8488('0x50')](_0x8488('0xb0'),_[_0x8488('0x3a')](_0x1c8f5d,'id'));return db[_0x8488('0x9e')][_0x8488('0x47')](_0x51d1eb['toString'](),_0x202d16)[_0x8488('0x20')](function(_0x1445c7){var _0x248175=_['groupBy'](_0x1445c7,_0x8488('0xb1'));var _0x546a25=[];_0x1c8f5d[_0x8488('0x3e')](function(_0x52fe9f){_0x546a25['push'](updateChatInteraction(_0x52fe9f,_0x3749da,_0x248175));});return BPromise[_0x8488('0xb2')](_0x546a25);});});})['then'](function(_0x42f36b){_0x25ef13[_0x8488('0xb3')]=_0x42f36b;return _0x25ef13;})[_0x8488('0x20')](respondWithFilteredResult(_0x22a3f3,_0x4023ac));})[_0x8488('0x29')](handleError(_0x22a3f3,null));};exports['show']=function(_0x391e86,_0x450afa){var _0x477a86={'raw':![],'where':{'id':_0x391e86['params']['id']}},_0x37ca73={};_0x37ca73[_0x8488('0x46')]=_[_0x8488('0x48')](db[_0x8488('0x42')][_0x8488('0xb4')]);_0x37ca73[_0x8488('0x47')]=_['keys'](_0x391e86['query']);_0x37ca73[_0x8488('0x49')]=_[_0x8488('0x4a')](_0x37ca73[_0x8488('0x46')],_0x37ca73[_0x8488('0x47')]);_0x477a86[_0x8488('0x4b')]=_['intersection'](_0x37ca73['model'],qs['fields'](_0x391e86[_0x8488('0x47')][_0x8488('0x4c')]));_0x477a86[_0x8488('0x4b')]=_0x477a86['attributes'][_0x8488('0x67')]?_0x477a86[_0x8488('0x4b')]:_0x37ca73['model'];if(_0x391e86[_0x8488('0x47')][_0x8488('0xb5')]){_0x477a86[_0x8488('0xb6')]=[{'all':!![]}];}_0x477a86=_[_0x8488('0xa0')]({},_0x477a86,_0x391e86[_0x8488('0xb7')]);return db[_0x8488('0x42')][_0x8488('0x79')](_0x477a86)[_0x8488('0x20')](handleEntityNotFound(_0x450afa,null))[_0x8488('0x20')](respondWithResult(_0x450afa,null))[_0x8488('0x29')](handleError(_0x450afa,null));};exports[_0x8488('0xb8')]=function(_0x13add2,_0xa0c692){return db['ChatInteraction'][_0x8488('0xb8')](_0x13add2[_0x8488('0xb9')],{})['then'](respondWithResult(_0xa0c692,0xc9))['catch'](handleError(_0xa0c692,null));};exports['update']=function(_0x5e60cb,_0x14ff09){if(_0x5e60cb[_0x8488('0xb9')]['id']){delete _0x5e60cb['body']['id'];}return db[_0x8488('0x42')]['find']({'where':{'id':_0x5e60cb[_0x8488('0xba')]['id']}})[_0x8488('0x20')](handleEntityNotFound(_0x14ff09,null))[_0x8488('0x20')](saveUpdates(_0x5e60cb[_0x8488('0xb9')],null))[_0x8488('0x20')](respondWithResult(_0x14ff09,null))['catch'](handleError(_0x14ff09,null));};exports[_0x8488('0x36')]=function(_0x27c233,_0x41e251){return db[_0x8488('0x42')]['find']({'where':{'id':_0x27c233['params']['id']}})[_0x8488('0x20')](handleEntityNotFound(_0x41e251,null))[_0x8488('0x20')](removeEntity(_0x41e251,null))[_0x8488('0x29')](handleError(_0x41e251,null));};exports[_0x8488('0xbb')]=function(_0x2f8191,_0x14b32b){return db[_0x8488('0x42')][_0x8488('0xbb')]()[_0x8488('0x20')](respondWithResult(_0x14b32b,null))[_0x8488('0x29')](handleError(_0x14b32b,null));};exports[_0x8488('0xbc')]=function(_0x1e7617,_0x315136){var _0x193a96=_0x1e7617['params']['id'];var _0x556b9b;var _0x2c20e9;var _0x312a32;return db[_0x8488('0x42')][_0x8488('0xbd')]({'where':{'id':_0x193a96}})[_0x8488('0x20')](function(_0x22f2de){_0x556b9b=_0x22f2de;return db[_0x8488('0xbe')][_0x8488('0xbd')]({'where':{'id':_0x22f2de[_0x8488('0x7e')]},'attributes':['id','vidaooApiKey',_0x8488('0xbf')],'raw':!![]});})[_0x8488('0x20')](function(_0x2d7d0b){if(_0x2d7d0b&&_0x2d7d0b['vidaooApiKey']&&_0x2d7d0b[_0x8488('0xbf')]){_0x2c20e9=_0x2d7d0b;var _0x3a5ce0={'rejectUnauthorized':![],'method':_0x8488('0xc0'),'uri':_0x8488('0xc1'),'headers':{'X-APIKEY':_0x2d7d0b[_0x8488('0xc2')]},'body':{'name':_0x8488('0xc3')+_0x193a96},'redirect':_0x8488('0xc4'),'json':!![]};return rp(_0x3a5ce0);}else{throw new db[(_0x8488('0x1c'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x8488('0x20')](function(_0x215d7e){_0x312a32=_0x215d7e;if(_0x312a32['id']){var _0x257a1b={'body':_0x312a32[_0x8488('0xc5')],'ChatWebsiteId':_0x2c20e9['id'],'ChatInteractionId':_0x556b9b['id'],'direction':_0x8488('0xc6'),'UserId':_0x1e7617[_0x8488('0x9a')]['id']};return db[_0x8488('0xc7')]['create'](_0x257a1b,{});}else{throw new db[(_0x8488('0x1c'))]['ValidationError'](_0x8488('0xc8'));}})[_0x8488('0x20')](function(){return _0x556b9b[_0x8488('0xc9')]({'vidaooSessionId':_0x312a32['id']});})[_0x8488('0x20')](respondWithResult(_0x315136,null))[_0x8488('0x29')](handleError(_0x315136,null));};exports['customUpdate']=function(_0x27add0,_0x319fa8){if(_0x27add0[_0x8488('0xb9')]['id']){delete _0x27add0[_0x8488('0xb9')]['id'];}return db[_0x8488('0x42')][_0x8488('0x79')]({'where':{'id':_0x27add0[_0x8488('0xba')]['id']}})['then'](handleEntityNotFound(_0x319fa8,null))[_0x8488('0x20')](saveUpdates(_0x27add0['body'],null))['then'](respondWithResult(_0x319fa8,null))[_0x8488('0x29')](handleError(_0x319fa8,null));};exports[_0x8488('0xca')]=function(_0x5da38e,_0x47633f,_0x2ba4ba){if(_0x5da38e[_0x8488('0xb9')]['id']){delete _0x5da38e[_0x8488('0xb9')]['id'];}return db[_0x8488('0x42')]['find']({'where':{'id':_0x5da38e['params']['id']}})[_0x8488('0x20')](function(_0x1c4b86){if(!_0x1c4b86){logger[_0x8488('0x25')](_0x8488('0xcb'),_0x8488('0xca'),0x194,'entity\x20not\x20found');_0x47633f['sendStatus'](0x194);}else{if(_0x1c4b86[_0x8488('0x7a')]){throw new db[(_0x8488('0x1c'))][(_0x8488('0x1d'))](_0x8488('0xcc'));}}return _0x1c4b86;})[_0x8488('0x20')](function(_0x1a2b0d){if(_0x1a2b0d){return _0x1a2b0d[_0x8488('0x35')]({'closed':_0x5da38e[_0x8488('0xb9')][_0x8488('0xcd')],'disposition':_0x5da38e[_0x8488('0xb9')][_0x8488('0xce')]})[_0x8488('0x20')](function(_0x327051){return _0x327051;});}})[_0x8488('0x20')](function(_0x4a3c76){return respondWithRpcPromise(_0x8488('0xcf'),_0x8488('0xca'),_0x5da38e[_0x8488('0xb9')],client9004);})['then'](respondWithResult(_0x47633f,null))[_0x8488('0x29')](handleError(_0x47633f,null));};exports[_0x8488('0xd0')]=function(_0x24c5ed,_0x4ef936,_0x62adfe){_0x24c5ed[_0x8488('0xb9')]['name']=_0x24c5ed[_0x8488('0xd1')][_0x8488('0xd2')];_0x24c5ed['body'][_0x8488('0xd3')]=_0x24c5ed[_0x8488('0xd1')][_0x8488('0xd4')];_0x24c5ed[_0x8488('0xb9')][_0x8488('0x44')]=_0x24c5ed[_0x8488('0xd1')][_0x8488('0xd5')];return db[_0x8488('0xd6')][_0x8488('0xb8')](_0x24c5ed[_0x8488('0xb9')])['then'](respondWithResult(_0x4ef936,0xc9))[_0x8488('0x29')](handleError(_0x4ef936,null));};exports[_0x8488('0xd7')]=function(_0x52e72a,_0x230e13,_0x54bed4){return db[_0x8488('0x42')][_0x8488('0xbd')]({'where':{'id':_0x52e72a[_0x8488('0xba')]['id']},'raw':!![]})[_0x8488('0x20')](handleEntityNotFound(_0x230e13,null))[_0x8488('0x20')](function(_0x2c587f){if(_0x2c587f){if(_0x2c587f['closed']){return _0x230e13[_0x8488('0x2c')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x8488('0xd6')][_0x8488('0xbd')]({'where':{'id':_0x52e72a[_0x8488('0x47')][_0x8488('0xd8')]},'raw':!![]})['then'](handleEntityNotFound(_0x230e13,null));}})['then'](function(_0x52749d){if(_0x52749d){return _0x230e13['download'](path[_0x8488('0xd9')](config[_0x8488('0xda')],_0x8488('0xdb'),_0x52749d[_0x8488('0xd3')]));}})[_0x8488('0x29')](handleError(_0x230e13,null));};exports['close']=function(_0x1f5299,_0x939646){var _0x42b9b7=null;var _0x491c3c=null;var _0x50b45f=null;var _0x1f8fb1=null;if(_0x1f5299[_0x8488('0xb9')]['id']){delete _0x1f5299['body']['id'];}if(_0x1f5299['body'][_0x8488('0xdc')]){_0x1f8fb1=path[_0x8488('0xd9')](config[_0x8488('0xda')],_0x8488('0xdd'),util[_0x8488('0xde')](_0x8488('0xdf'),Date[_0x8488('0xe0')]()));_0x1f5299[_0x8488('0xb9')][_0x8488('0xe1')]=_0x1f8fb1;}return db[_0x8488('0x42')][_0x8488('0x79')]({'where':{'id':_0x1f5299[_0x8488('0xba')]['id']},'include':[{'model':db[_0x8488('0xc7')],'as':_0x8488('0xe2'),'include':[{'model':db[_0x8488('0x77')],'as':_0x8488('0x77')}]}]})[_0x8488('0x20')](handleEntityNotFound(_0x939646,null))['then'](saveUpdates(_0x1f5299[_0x8488('0xb9')],null))[_0x8488('0x20')](function(_0xddf093){if(_0xddf093){_0x42b9b7=_0xddf093;return db['ChatWebsite'][_0x8488('0x79')]({'where':{'id':_0x42b9b7[_0x8488('0x7e')]}});}})[_0x8488('0x20')](function(_0x674d19){if(_0x674d19){_0x50b45f=_0x674d19;return db['CmContact'][_0x8488('0x79')]({'where':{'id':_0x42b9b7['ContactId']}});}})[_0x8488('0x20')](function(_0x391b98){if(_0x391b98){_0x491c3c=_0x391b98;if(_0x1f8fb1){var _0x5b2721=null;for(var _0x388871=0x1;_0x388871<_0x42b9b7[_0x8488('0xe2')][_0x8488('0x67')];++_0x388871){_0x5b2721=_0x42b9b7[_0x8488('0xe2')][_0x388871];var _0x3cd626=_0x5b2721[_0x8488('0x7a')]?util['format']('%s%d',_0x50b45f[_0x8488('0xe3')],_0x5b2721[_0x8488('0x7a')]):_0x8488('0xe4');var _0x2628ba=_0x1f5299[_0x8488('0xb9')]['customer']||util['format'](_0x8488('0xe5'),'Visitor',_0x5b2721[_0x8488('0x72')]);switch(_0x50b45f[_0x8488('0xe6')]){case'website_alias':_0x3cd626=_0x5b2721['UserId']?util[_0x8488('0xde')](_0x8488('0xe5'),_0x50b45f['agentAlias'],_0x5b2721[_0x8488('0x7a')]):'System';break;case'agent_alias':_0x3cd626=_0x5b2721[_0x8488('0x7a')]?_0x5b2721[_0x8488('0x77')][_0x8488('0xe7')]||_0x5b2721['User'][_0x8488('0x3b')]:_0x8488('0xe4');break;case _0x8488('0xe8'):_0x3cd626=_0x5b2721[_0x8488('0x7a')]?_0x5b2721['User'][_0x8488('0x3b')]:_0x8488('0xe4');break;default:_0x3cd626=_0x5b2721[_0x8488('0x7a')]?util[_0x8488('0xde')](_0x8488('0xe5'),_0x50b45f[_0x8488('0xe3')],_0x5b2721[_0x8488('0x7a')]):_0x8488('0xe4');}var _0x201a91=util[_0x8488('0xde')](_0x8488('0xe9'),moment(_0x5b2721['createdAt'])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x5b2721[_0x8488('0xea')]==='in'?_0x2628ba:_0x3cd626,_0x5b2721['body']);if(!_0x5b2721[_0x8488('0xeb')]){fs['appendFileSync'](_0x1f8fb1,_0x201a91);}}return db[_0x8488('0xec')][_0x8488('0xbd')]({'where':{'service':!![]},'include':[{'model':db[_0x8488('0xed')],'as':_0x8488('0xee'),'raw':!![]}]});}}})['then'](function(_0x4957f0){if(_0x4957f0&&_0x4957f0[_0x8488('0xee')]&&_0x1f5299['body']){var _0x9eebf6={'tls':{'rejectUnauthorized':![]}};if(_0x4957f0['Smtp'][_0x8488('0xef')]){_0x9eebf6[_0x8488('0xef')]=_0x4957f0['Smtp'][_0x8488('0xef')];}else{_0x9eebf6[_0x8488('0xf0')]=_0x4957f0[_0x8488('0xee')][_0x8488('0xf0')];_0x9eebf6[_0x8488('0xf1')]=_0x4957f0[_0x8488('0xee')][_0x8488('0xf1')];_0x9eebf6[_0x8488('0xf2')]=_0x4957f0[_0x8488('0xee')][_0x8488('0xf2')];}if(_0x4957f0[_0x8488('0xee')][_0x8488('0xf3')]){_0x9eebf6['auth']={'user':_0x4957f0[_0x8488('0xee')][_0x8488('0x9a')],'pass':_0x4957f0[_0x8488('0xee')]['pass']};}return respondWithRpcPromise(_0x8488('0xf4'),'sendMail',{'account':_0x9eebf6,'message':{'from':util[_0x8488('0xde')](_0x8488('0xf5'),_0x4957f0[_0x8488('0x38')],_0x4957f0['email']||_0x4957f0['Smtp'][_0x8488('0x9a')]),'to':_0x1f5299[_0x8488('0xb9')][_0x8488('0xdc')],'subject':_0x8488('0xf6'),'text':util[_0x8488('0xde')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x1f5299['body']['mailTranscript']),'attachments':[{'path':_0x1f8fb1}]}})[_0x8488('0x20')](function(){return _0x42b9b7;})[_0x8488('0x29')](function(_0x2c0ae1){console[_0x8488('0x25')](_0x2c0ae1);});}else{return _0x42b9b7;}})['then'](respondWithStatusCode(_0x939646,0xc8))[_0x8488('0x29')](handleError(_0x939646,null));};exports[_0x8488('0xf7')]=function(_0xa358dc,_0x5be3e5,_0xab367e){return db['ChatMessage'][_0x8488('0x79')]({'where':{'id':_0xa358dc[_0x8488('0xba')]['id']}})[_0x8488('0x20')](handleEntityNotFound(_0x5be3e5,null))[_0x8488('0x20')](function(_0x59b90a){if(_0x59b90a){return _0x59b90a[_0x8488('0xf7')](_0xa358dc['body']['ids'],_[_0x8488('0xf8')](_0xa358dc[_0x8488('0xb9')],['ids','id'])||{});}})[_0x8488('0x20')](respondWithResult(_0x5be3e5,null))['catch'](handleError(_0x5be3e5,null));};exports[_0x8488('0xf9')]=function(_0x1c1375,_0x5dbd0c,_0x4e5c26){var _0x1e98c8={'raw':![],'where':{}};var _0x184265={};var _0x3bd2cb={'count':0x0,'rows':[]};return db[_0x8488('0x42')]['findOne']({'where':{'id':_0x1c1375[_0x8488('0xba')]['id']}})[_0x8488('0x20')](handleEntityNotFound(_0x5dbd0c,null))[_0x8488('0x20')](function(_0x5da39c){if(_0x5da39c){_0x184265[_0x8488('0x46')]=_[_0x8488('0x48')](db['ChatMessage'][_0x8488('0xb4')]);_0x184265[_0x8488('0x47')]=_[_0x8488('0x48')](_0x1c1375['query']);_0x184265[_0x8488('0x49')]=_[_0x8488('0x4a')](_0x184265[_0x8488('0x46')],_0x184265[_0x8488('0x47')]);_0x1e98c8[_0x8488('0x4b')]=_['intersection'](_0x184265[_0x8488('0x46')],qs[_0x8488('0x4c')](_0x1c1375[_0x8488('0x47')][_0x8488('0x4c')]));_0x1e98c8['attributes']=_0x1e98c8['attributes'][_0x8488('0x67')]?_0x1e98c8['attributes']:_0x184265[_0x8488('0x46')];if(!_0x1c1375['query'][_0x8488('0x4d')](_0x8488('0xfa'))){_0x1e98c8['limit']=qs['limit'](_0x1c1375['query'][_0x8488('0x30')]);_0x1e98c8[_0x8488('0x2f')]=qs[_0x8488('0x2f')](_0x1c1375['query'][_0x8488('0x2f')]);}_0x1e98c8[_0x8488('0x4e')]=qs[_0x8488('0x4f')](_0x1c1375[_0x8488('0x47')][_0x8488('0x4f')]);_0x1e98c8[_0x8488('0x50')]=qs[_0x8488('0x49')](_[_0x8488('0xfb')](_0x1c1375['query'],_0x184265[_0x8488('0x49')]));_0x1e98c8['where'][_0x8488('0xb1')]=_0x5da39c['id'];if(_0x1c1375['query'][_0x8488('0xfc')]){_0x1e98c8['where']=_['merge'](_0x1e98c8[_0x8488('0x50')],{'$or':_['map'](_0x1e98c8[_0x8488('0x4b')],function(_0x582b7d){var _0x358868={};_0x358868[_0x582b7d]={'$like':'%'+_0x1c1375['query']['filter']+'%'};return _0x358868;})});}if(_0x1c1375['query'][_0x8488('0xfd')]){var _0x5807e9=_0x1c1375[_0x8488('0x47')][_0x8488('0xfd')][_0x8488('0x3d')](',');var _0x1d3714={};_0x1d3714[_0x5807e9[0x0]]={'$gte':moment(_0x5807e9[0x1])[_0x8488('0xde')](_0x8488('0xfe'))};_0x1e98c8['where']=_[_0x8488('0xa0')](_0x1e98c8['where'],_0x1d3714);}_0x1e98c8=_[_0x8488('0xa0')]({},_0x1e98c8,_0x1c1375[_0x8488('0xb7')]);return db[_0x8488('0xc7')][_0x8488('0x2e')]({'where':_0x1e98c8[_0x8488('0x50')]})['then'](function(_0x7c86dd){_0x3bd2cb['count']=_0x7c86dd;if(_0x1c1375['query'][_0x8488('0xb5')]){_0x1e98c8['include']=[{'all':!![]}];}return db[_0x8488('0xc7')][_0x8488('0xff')](_0x1e98c8);})[_0x8488('0x20')](function(_0x3abbe0){_0x3bd2cb[_0x8488('0xb3')]=_0x3abbe0;return _0x3bd2cb;});}})[_0x8488('0x20')](respondWithFilteredResult(_0x5dbd0c,_0x1e98c8))[_0x8488('0x29')](handleError(_0x5dbd0c,null));};exports[_0x8488('0x100')]=function(_0x5d287f,_0x29ea4b,_0xab7ae3){var _0x42295c={'where':{}},_0x51ca92={},_0x554d9a={'count':0x0,'rows':[]};return db[_0x8488('0x42')][_0x8488('0xbd')]({'where':{'id':_0x5d287f[_0x8488('0xba')]['id']}})[_0x8488('0x20')](handleEntityNotFound(_0x29ea4b,null))[_0x8488('0x20')](function(_0x21e76e){if(_0x21e76e){_0x51ca92[_0x8488('0x46')]=_[_0x8488('0x48')](db[_0x8488('0xc7')][_0x8488('0xb4')]);_0x51ca92[_0x8488('0x47')]=_[_0x8488('0x48')](_0x5d287f[_0x8488('0x47')]);_0x51ca92['filters']=_[_0x8488('0x4a')](_0x51ca92[_0x8488('0x46')],_0x51ca92[_0x8488('0x47')]);_0x42295c[_0x8488('0x4b')]=_[_0x8488('0x4a')](_0x51ca92['model'],qs['fields'](_0x5d287f[_0x8488('0x47')][_0x8488('0x4c')]));_0x42295c[_0x8488('0x4b')]=_0x42295c['attributes'][_0x8488('0x67')]?_0x42295c[_0x8488('0x4b')]:_0x51ca92[_0x8488('0x46')];if(!_0x5d287f[_0x8488('0x47')][_0x8488('0x4d')](_0x8488('0xfa'))){_0x42295c[_0x8488('0x30')]=qs[_0x8488('0x30')](_0x5d287f[_0x8488('0x47')][_0x8488('0x30')]);_0x42295c[_0x8488('0x2f')]=qs[_0x8488('0x2f')](_0x5d287f[_0x8488('0x47')][_0x8488('0x2f')]);}_0x42295c[_0x8488('0x4e')]=qs[_0x8488('0x4f')](_0x5d287f[_0x8488('0x47')][_0x8488('0x4f')]);_0x42295c[_0x8488('0x50')]=qs[_0x8488('0x49')](_[_0x8488('0xfb')](_0x5d287f[_0x8488('0x47')],_0x51ca92['filters']));_0x42295c['where'][_0x8488('0xb1')]=_0x21e76e['id'];if(_0x5d287f[_0x8488('0x47')][_0x8488('0xfc')]){_0x42295c[_0x8488('0x50')]=_[_0x8488('0xa0')](_0x42295c['where'],{'$or':_[_0x8488('0x3a')](_0x42295c[_0x8488('0x4b')],function(_0x2f96cb){var _0x379b81={};_0x379b81[_0x2f96cb]={'$like':'%'+_0x5d287f[_0x8488('0x47')][_0x8488('0xfc')]+'%'};return _0x379b81;})});}_0x42295c[_0x8488('0x50')][_0x8488('0xeb')]=![];if(_0x5d287f['query']['id']){_0x42295c[_0x8488('0x50')]['id']={'$gt':_0x5d287f[_0x8488('0x47')]['id']};}_0x42295c=_[_0x8488('0xa0')]({},_0x42295c,_0x5d287f[_0x8488('0xb7')]);return db[_0x8488('0xc7')][_0x8488('0x2e')]({'where':_0x42295c[_0x8488('0x50')]})['then'](function(_0x24ff97){_0x554d9a[_0x8488('0x2e')]=_0x24ff97;_0x42295c[_0x8488('0xb6')]=[];if(_0x5d287f[_0x8488('0x47')][_0x8488('0x101')]){_0x42295c[_0x8488('0xb6')][_0x8488('0x40')]({'model':db[_0x8488('0x77')],'as':'User','attributes':['id',_0x8488('0x3b'),_0x8488('0xe7')]});}if(_0x5d287f[_0x8488('0x47')][_0x8488('0xb5')]){_0x42295c[_0x8488('0xb6')]=[{'all':!![]}];}return db[_0x8488('0xc7')][_0x8488('0xff')](_0x42295c);})[_0x8488('0x20')](function(_0x32bd5f){_0x554d9a[_0x8488('0xb3')]=_0x32bd5f;return _0x554d9a;});}})[_0x8488('0x20')](respondWithFilteredResult(_0x29ea4b,_0x42295c))['catch'](handleError(_0x29ea4b,null));};exports[_0x8488('0x102')]=function(_0x5608c4,_0x5d3b8d,_0x51f315){return db[_0x8488('0x42')]['find']({'where':{'id':_0x5608c4['params']['id']}})['then'](handleEntityNotFound(_0x5d3b8d,null))[_0x8488('0x20')](function(_0x3f9240){if(_0x3f9240){return _0x3f9240['setTags'](_0x5608c4[_0x8488('0xb9')]['ids'],_['omit'](_0x5608c4['body'],[_0x8488('0x103'),'id'])||{})[_0x8488('0x104')](function(){return db['Tag']['findAll']({'attributes':['id',_0x8488('0x38'),_0x8488('0x105')],'where':{'id':_0x5608c4[_0x8488('0xb9')]['ids']}});})[_0x8488('0x20')](function(_0x3377ae){socket[_0x8488('0x106')](_0x8488('0x107'),{'id':Number(_0x5608c4[_0x8488('0xba')]['id']),'tags':_0x3377ae||[]});return{'id':Number(_0x5608c4['params']['id']),'tags':_0x3377ae||[]};});}})[_0x8488('0x20')](respondWithResult(_0x5d3b8d,null))[_0x8488('0x29')](handleError(_0x5d3b8d,null));};exports[_0x8488('0x108')]=function(_0x1aa9de,_0x190c7a,_0x524c83){return db['ChatInteraction'][_0x8488('0x79')]({'where':{'id':_0x1aa9de[_0x8488('0xba')]['id']}})[_0x8488('0x20')](handleEntityNotFound(_0x190c7a,null))['then'](function(_0x5c0461){if(_0x5c0461){return _0x5c0461['removeTags'](_0x1aa9de[_0x8488('0x47')][_0x8488('0x103')]);}})[_0x8488('0x20')](respondWithStatusCode(_0x190c7a,null))['catch'](handleError(_0x190c7a,null));};exports[_0x8488('0x109')]=function(_0x5d038c,_0x42afd4){var _0x54e484=moment()[_0x8488('0x10a')]()['toString']();var _0x42367d=path[_0x8488('0xd9')](config[_0x8488('0xda')],_0x8488('0x10b'),'files',_0x8488('0x10c'));var _0x49d626=path[_0x8488('0xd9')](config[_0x8488('0xda')],_0x8488('0x10b'),_0x8488('0x10d'),_0x8488('0x10e'));var _0x33e945=path[_0x8488('0xd9')](_0x42367d,_0x54e484);var _0x116d17=util['format'](_0x8488('0x10f'),_0x5d038c['params']['id'],_0x54e484);var _0x2370fd=path['join'](_0x42367d,_0x116d17);var _0x21d61a=[];_0x21d61a[_0x8488('0x40')]({'model':db[_0x8488('0x77')],'as':'User','attributes':['id',_0x8488('0x3b')],'raw':!![]});_0x21d61a[_0x8488('0x40')]({'model':db[_0x8488('0x110')],'as':_0x8488('0x6c'),'attributes':['id',_0x8488('0x111'),_0x8488('0x112')],'raw':!![]});if(_0x5d038c[_0x8488('0x47')]['attachments']){_0x21d61a[_0x8488('0x40')]({'model':db[_0x8488('0xd6')],'as':_0x8488('0xd6'),'raw':!![]});}var _0x1aef84=[{'model':db[_0x8488('0xc7')],'as':'Messages','attributes':['id',_0x8488('0xb9'),_0x8488('0x81'),_0x8488('0xea'),'secret',_0x8488('0x87')],'include':_0x21d61a}];_0x1aef84['push']({'model':db['ChatWebsite'],'as':_0x8488('0x113'),'attributes':['id',_0x8488('0x38')]});_0x1aef84[_0x8488('0x40')]({'model':db[_0x8488('0x77')],'as':_0x8488('0x114'),'attributes':['id',_0x8488('0x3b')]});return db['ChatInteraction']['find']({'where':{'id':_0x5d038c[_0x8488('0xba')]['id']},'include':_0x1aef84})[_0x8488('0x20')](handleEntityNotFound(_0x42afd4,null))[_0x8488('0x20')](function(_0x47edf8){if(_0x47edf8){var _0x1dc04e=_0x47edf8[_0x8488('0x115')]({'plain':!![]});fs[_0x8488('0x116')](_0x33e945);var _0x22749f={'format':'A4','border':'10px','header':{'height':_0x8488('0x117'),'contents':{'first':_0x8488('0x118')}},'footer':{'height':_0x8488('0x119'),'contents':{'default':util[_0x8488('0xde')](_0x8488('0x11a'),util['format']('%s\x20#%d',_0x8488('0x11b'),_0x1dc04e['id']),moment()['format'](_0x8488('0x11c'))[_0x8488('0x9d')]())}}};var _0x33f830={'channel':'Chat','account':_0x1dc04e[_0x8488('0x113')][_0x8488('0x38')],'agent':_0x1dc04e['Owner']?_0x1dc04e[_0x8488('0x114')][_0x8488('0x3b')]:'N.A.','createdAt':moment(_0x1dc04e[_0x8488('0x81')])[_0x8488('0xde')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x1dc04e['closed']?moment(_0x1dc04e[_0x8488('0x11d')])[_0x8488('0xde')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x1dc04e[_0x8488('0xce')],'chatInfo':{'browser':_0x1dc04e[_0x8488('0x11e')],'os':_0x1dc04e[_0x8488('0x11f')],'referer':_0x1dc04e[_0x8488('0x120')],'customerIp':_0x1dc04e[_0x8488('0x121')],'customerPort':_0x1dc04e['customerPort']?_0x1dc04e[_0x8488('0x122')]:_0x8488('0x123')},'messages':_(_0x1dc04e[_0x8488('0xe2')])['tail']()['filter']({'secret':![]})[_0x8488('0x3a')](function(_0x34bcaa){if(_0x34bcaa[_0x8488('0xd6')]){var _0x520188=path[_0x8488('0xd9')](_0x49d626,_0x34bcaa[_0x8488('0xd6')][_0x8488('0xd3')]);if(fs[_0x8488('0x124')](_0x520188)){fs[_0x8488('0x125')](_0x520188)['pipe'](fs[_0x8488('0x126')](path[_0x8488('0xd9')](_0x33e945,_0x34bcaa['Attachment'][_0x8488('0xd3')])));}}return{'date':moment(_0x34bcaa['createdAt'])[_0x8488('0xde')](_0x8488('0xfe'))[_0x8488('0x9d')](),'sender':_0x34bcaa['direction']===_0x8488('0xc6')?_0x34bcaa[_0x8488('0x77')]?_0x34bcaa['User'][_0x8488('0x3b')]:_0x8488('0xe4'):_0x34bcaa['Contact'][_0x8488('0x111')]+(_0x34bcaa['Contact'][_0x8488('0x112')]?'\x20'+_0x34bcaa[_0x8488('0x6c')][_0x8488('0x112')]:''),'body':_0x34bcaa[_0x8488('0xd6')]?_0x34bcaa[_0x8488('0xd6')]['basename']:_0x34bcaa[_0x8488('0xb9')],'direction':_0x34bcaa['direction']==='out'?'A':'C','secret':_0x34bcaa['secret'],'read':_0x34bcaa[_0x8488('0x87')],'attachment':_0x34bcaa['Attachment']};})[_0x8488('0x69')]()};return ejs[_0x8488('0x127')](path[_0x8488('0xd9')](config[_0x8488('0xda')],_0x8488('0x10b'),'views',_0x8488('0x128')),{'interaction':_0x33f830})[_0x8488('0x20')](function(_0x407cd5){return new BPromise(function(_0x6a3925,_0x4d1227){pdf[_0x8488('0xb8')](_0x407cd5,_0x22749f)['toFile'](path[_0x8488('0xd9')](_0x33e945,_0x8488('0x129')+_0x1dc04e['id']+'-'+_0x54e484+_0x8488('0x12a')),function(_0x358f95,_0x520c5a){if(_0x358f95)return _0x4d1227(_0x358f95);_0x6a3925(_0x520c5a);});});})[_0x8488('0x20')](function(){return new BPromise(function(_0x5baaa5,_0x34a5e4){zipdir(_0x33e945,{'saveTo':_0x2370fd},function(_0x22efdd,_0x4b3081){if(_0x22efdd)return _0x34a5e4(_0x22efdd);return _0x5baaa5(_0x4b3081);});})[_0x8488('0x20')](function(){return new BPromise(function(_0xf8bfa8,_0x3cf327){rimraf(_0x33e945,function(_0x3c4b4d){if(_0x3c4b4d)_0x3cf327(_0x3c4b4d);return _0xf8bfa8();});});})['then'](function(){return _0x42afd4[_0x8488('0x109')](_0x2370fd,_0x116d17,function(_0x337cac){if(_0x337cac){console[_0x8488('0x12b')](_0x8488('0x12c'),_0x337cac);}else{fs[_0x8488('0x12d')](_0x2370fd);}});});});}else{return _0x42afd4[_0x8488('0x2b')](0xc8);}})['catch'](handleError(_0x42afd4,null));}; \ No newline at end of file +var _0x687b=['Account','get','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Owner','N.A.','closedAt','browserName','osName','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','direction','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','stack','name','send','Users','map','fullname','Tags','TagIds','forEach','push','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','ChatWebsiteId','where','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','unreadMessages','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','toString','sequelize','keyBy','merge','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','show','includeAll','options','create','update','params','destroy','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','updateAttributes','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','originalname','basename','file','mimetype','Attachment','attachmentDownload','attachId','download','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','CmContact','%s%d','agentAlias','System','customer','ContactId','agentIdentifier','agent_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','include','findAll','secret','includeAgent','spread','Tag','emit','chatInteractionTags:save','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName'];(function(_0x499352,_0x406143){var _0x3236e4=function(_0x1912e9){while(--_0x1912e9){_0x499352['push'](_0x499352['shift']());}};_0x3236e4(++_0x406143);}(_0x687b,0x14a));var _0xb687=function(_0x587577,_0x53a237){_0x587577=_0x587577-0x0;var _0x75d167=_0x687b[_0x587577];return _0x75d167;};'use strict';var pdf=require(_0xb687('0x0'));var emlformat=require(_0xb687('0x1'));var rimraf=require(_0xb687('0x2'));var zipdir=require(_0xb687('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb687('0x4'));var BPromise=require(_0xb687('0x5'));var Mustache=require(_0xb687('0x6'));var util=require(_0xb687('0x7'));var path=require(_0xb687('0x8'));var sox=require(_0xb687('0x9'));var csv=require(_0xb687('0xa'));var ejs=require(_0xb687('0xb'));var fs=require('fs');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 db=require(_0xb687('0x1a'))['db'];config[_0xb687('0x1b')]=_[_0xb687('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb687('0x1d'))(new Redis(config[_0xb687('0x1b')]));require('./chatInteraction.socket')[_0xb687('0x1e')](socket);var jayson=require(_0xb687('0x1f'));var client=jayson[_0xb687('0x20')][_0xb687('0x21')]({'port':0x232b});var client9004=jayson[_0xb687('0x20')][_0xb687('0x21')]({'port':0x232c});function checkPasswordPattern(_0x30622f,_0x141375,_0x263085){if(_0x263085){var _0x2c7a18=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2c7a18[_0xb687('0x22')](_0x141375)){return _0x30622f;}else{throw new db[(_0xb687('0x23'))]['ValidationError'](_0xb687('0x24'));}}else{return _0x30622f;}}function respondWithRpcPromise(_0x328301,_0x30d370,_0x5eb9b9,_0x48958d){return new BPromise(function(_0x12eff1,_0x3a10ef){var _0x19ee14=_0x48958d||client;return _0x19ee14['request'](_0x328301,_0x5eb9b9)[_0xb687('0x25')](function(_0x481f1d){logger[_0xb687('0x26')](_0xb687('0x27'),_0x30d370,_0xb687('0x28'));logger[_0xb687('0x29')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x30d370,_0xb687('0x28'),JSON['stringify'](_0x481f1d));if(_0x481f1d[_0xb687('0x2a')]){if(_0x481f1d[_0xb687('0x2a')][_0xb687('0x2b')]===0x1f4){logger['error'](_0xb687('0x27'),_0x30d370,_0x481f1d[_0xb687('0x2a')][_0xb687('0x2c')]);return _0x3a10ef(_0x481f1d[_0xb687('0x2a')][_0xb687('0x2c')]);}logger[_0xb687('0x2a')](_0xb687('0x27'),_0x30d370,_0x481f1d[_0xb687('0x2a')]['message']);return _0x12eff1(_0x481f1d[_0xb687('0x2a')][_0xb687('0x2c')]);}else{logger[_0xb687('0x26')](_0xb687('0x27'),_0x30d370,_0xb687('0x28'));_0x12eff1(_0x481f1d[_0xb687('0x2d')][_0xb687('0x2c')]);}})[_0xb687('0x2e')](function(_0x3ff9e1){logger[_0xb687('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x30d370,_0x3ff9e1);_0x3a10ef(_0x3ff9e1);});});}function respondWithStatusCode(_0x3712cf,_0x192966){_0x192966=_0x192966||0xcc;return function(_0x392721){if(_0x392721){return _0x3712cf[_0xb687('0x2f')](_0x192966);}return _0x3712cf[_0xb687('0x30')](_0x192966)[_0xb687('0x31')]();};}function respondWithResult(_0x4e9a06,_0x28b69a){_0x28b69a=_0x28b69a||0xc8;return function(_0x5143af){if(_0x5143af){return _0x4e9a06[_0xb687('0x30')](_0x28b69a)[_0xb687('0x32')](_0x5143af);}};}function respondWithFilteredResult(_0x6df7a2,_0x245db1){return function(_0x1ad3ef){if(_0x1ad3ef){var _0x43d20d=_0x1ad3ef[_0xb687('0x33')],_0xf1f0dd=_0x245db1[_0xb687('0x34')],_0x556815=_0x245db1[_0xb687('0x34')]+_0x245db1[_0xb687('0x35')],_0x3da2be;if(_0x556815>=_0x43d20d){_0x556815=_0x43d20d;_0x3da2be=0xc8;}else{_0x3da2be=0xce;}_0x6df7a2[_0xb687('0x30')](_0x3da2be);return _0x6df7a2[_0xb687('0x36')](_0xb687('0x37'),_0xf1f0dd+'-'+_0x556815+'/'+_0x43d20d)[_0xb687('0x32')](_0x1ad3ef);}return null;};}function patchUpdates(_0x576cc1){return function(_0x17185e){try{jsonpatch['apply'](_0x17185e,_0x576cc1,!![]);}catch(_0x4cb06d){return BPromise[_0xb687('0x38')](_0x4cb06d);}return _0x17185e[_0xb687('0x39')]();};}function saveUpdates(_0x24c418,_0x32abc4){return function(_0x4fc44a){if(_0x4fc44a){return _0x4fc44a['update'](_0x24c418)[_0xb687('0x25')](function(_0x2f4773){return _0x2f4773;});}return null;};}function removeEntity(_0x491a8d,_0x23dc96){return function(_0x449074){if(_0x449074){return _0x449074['destroy']()[_0xb687('0x25')](function(){_0x491a8d['status'](0xcc)[_0xb687('0x31')]();});}};}function handleEntityNotFound(_0x24f34e,_0x2da038){return function(_0x3e146a){if(!_0x3e146a){_0x24f34e[_0xb687('0x2f')](0x194);}return _0x3e146a;};}function handleError(_0x28087e,_0x5f59d0){_0x5f59d0=_0x5f59d0||0x1f4;return function(_0x529b1a){logger[_0xb687('0x2a')](_0x529b1a[_0xb687('0x3a')]);if(_0x529b1a[_0xb687('0x3b')]){delete _0x529b1a['name'];}_0x28087e[_0xb687('0x30')](_0x5f59d0)[_0xb687('0x3c')](_0x529b1a);};}function getInteractionUsers(_0x1f1c88,_0xce9624){return new BPromise(function(_0xa3f0f9,_0x58c214){try{if(_0xce9624[_0x1f1c88['id']]){_0x1f1c88[_0xb687('0x3d')]=_[_0xb687('0x3e')](_0xce9624[_0x1f1c88['id']],function(_0x24c013){return{'id':_0x24c013['id'],'fullname':_0x24c013[_0xb687('0x3f')]};});}}catch(_0x24b785){_0x58c214(_0x24b785);}_0xa3f0f9(_0x1f1c88);});}function getInteractionTags(_0x29cf09,_0x572b5a){return new BPromise(function(_0x5ad577,_0x43f29c){try{if(_0x29cf09['TagIds']){_0x29cf09[_0xb687('0x40')]=[];_0x29cf09[_0xb687('0x41')]['split'](',')[_0xb687('0x42')](function(_0x2ce07a){_0x29cf09['Tags'][_0xb687('0x43')](_0x572b5a[_0x2ce07a]);});}delete _0x29cf09[_0xb687('0x41')];}catch(_0x127b25){_0x43f29c(_0x127b25);}_0x5ad577(_0x29cf09);});}function updateChatInteraction(_0x5253df,_0x66fabe,_0x9cffb2){return new BPromise(function(_0x38abe5,_0x75102a){return getInteractionUsers(_0x5253df,_0x9cffb2)[_0xb687('0x25')](function(_0x1375f7){return getInteractionTags(_0x1375f7,_0x66fabe);})[_0xb687('0x25')](function(_0x4bb665){_0x38abe5(_0x4bb665);})[_0xb687('0x2e')](function(_0x4cf6ad){_0x75102a(_0x4cf6ad);});});}exports['index']=function(_0xa3a9e0,_0x430364){var _0x515985={},_0x19a21c={},_0x5f1b59={'count':0x0,'rows':[]};var _0x3e886d=_[_0xb687('0x3e')](db['ChatInteraction'][_0xb687('0x44')],function(_0x3a8509){return{'name':_0x3a8509['fieldName'],'type':_0x3a8509[_0xb687('0x45')][_0xb687('0x46')]};});_0x19a21c[_0xb687('0x47')]=_[_0xb687('0x3e')](_0x3e886d,_0xb687('0x3b'));_0x19a21c[_0xb687('0x48')]=_[_0xb687('0x49')](_0xa3a9e0[_0xb687('0x48')]);_0x19a21c[_0xb687('0x4a')]=_[_0xb687('0x4b')](_0x19a21c[_0xb687('0x47')],_0x19a21c[_0xb687('0x48')]);_0x515985['attributes']=_[_0xb687('0x4b')](_0x19a21c['model'],qs[_0xb687('0x4c')](_0xa3a9e0[_0xb687('0x48')][_0xb687('0x4c')]));_0x515985[_0xb687('0x4d')]=_0x515985[_0xb687('0x4d')][_0xb687('0x4e')]?_0x515985['attributes']:_0x19a21c['model'];if(!_0xa3a9e0[_0xb687('0x48')][_0xb687('0x4f')](_0xb687('0x50'))){_0x515985[_0xb687('0x35')]=qs['limit'](_0xa3a9e0[_0xb687('0x48')][_0xb687('0x35')]);_0x515985[_0xb687('0x34')]=qs[_0xb687('0x34')](_0xa3a9e0['query'][_0xb687('0x34')]);}_0x515985[_0xb687('0x51')]=qs[_0xb687('0x52')](_0xa3a9e0[_0xb687('0x48')]['sort']);_0x515985['where']=qs[_0xb687('0x4a')](_[_0xb687('0x53')](_0xa3a9e0[_0xb687('0x48')],_0x19a21c['filters']),_0x3e886d);var _0x5d92e7=[];var _0x214ee3=squel[_0xb687('0x54')]()[_0xb687('0x55')]('id')[_0xb687('0x55')](_0xb687('0x3b'))[_0xb687('0x55')](_0xb687('0x56'))[_0xb687('0x57')]('tools_tags');var _0xe39007=squel[_0xb687('0x54')]()[_0xb687('0x55')]('u.id')['field']('u.fullname')['field'](_0xb687('0x58'))[_0xb687('0x57')](_0xb687('0x59'),'ui')[_0xb687('0x5a')](_0xb687('0x5b'),'u',_0xb687('0x5c'));var _0x21d795=squel[_0xb687('0x54')]()[_0xb687('0x57')](_0xb687('0x5d'),'i')[_0xb687('0x5a')](_0xb687('0x5e'),'c',_0xb687('0x5f'))[_0xb687('0x5a')](_0xb687('0x5b'),'o',_0xb687('0x60'))[_0xb687('0x5a')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')[_0xb687('0x5a')](_0xb687('0x61'),'me',_0xb687('0x62'))[_0xb687('0x5a')]('chat_interaction_has_tags','it',_0xb687('0x63'))[_0xb687('0x5a')]('tools_tags','t',_0xb687('0x64'));var _0x5b87cd=squel[_0xb687('0x65')]();var _0x1cd045=[];var _0x50fb31=squel['expr']();var _0x13ad6a;if(_0xa3a9e0[_0xb687('0x48')]['search']){_0x13ad6a=as[_0xb687('0x66')](_0xa3a9e0[_0xb687('0x48')][_0xb687('0x67')]);var _0x50c7e0=_0x13ad6a[_0xb687('0x68')];for(var _0x5b3c93=0x0;_0x5b3c93<_0x13ad6a[_0xb687('0x69')][_0xb687('0x4e')];_0x5b3c93++){var _0x3223f8=_0x13ad6a[_0xb687('0x69')][_0x5b3c93];var _0x819b63='i';var _0x49b403=_['find'](_0x3e886d,[_0xb687('0x3b'),_0x3223f8['field']]);if(!_0x49b403){switch(_0x3223f8['field']){case'unreadMessages':if(_0x3223f8['value']==0x1){_0x21d795[_0xb687('0x6a')]('`'+_0x3223f8[_0xb687('0x55')]+_0xb687('0x6b'));}else{_0x21d795[_0xb687('0x6a')]('`'+_0x3223f8[_0xb687('0x55')]+_0xb687('0x6c'));}break;case _0xb687('0x6d'):if(_0x3223f8[_0xb687('0x6e')]===_0xb687('0x6f')){if(_0x3223f8[_0xb687('0x70')][_0xb687('0x71')]('\x20')['length']>0x1){_0x5b87cd[_0x50c7e0]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb687('0x72')](_0x3223f8['value']),null);}else{var _0x667e39='%'+_0x3223f8[_0xb687('0x70')]+'%';_0x5b87cd[_0x50c7e0](_0xb687('0x73'),_0x667e39,_0x667e39,_0x667e39);}}else{_0x49b403=_[_0xb687('0x74')](_0x3e886d,[_0xb687('0x3b'),'ContactId']);_0x3223f8[_0xb687('0x55')]='ContactId';_0x8dc972=as[_0xb687('0x75')](_0x819b63,_0x49b403[_0xb687('0x45')],_0x3223f8);_0x5b87cd[_0x50c7e0](_0x8dc972[_0xb687('0x76')],_0x8dc972[_0xb687('0x70')][_0xb687('0x77')],_0x8dc972[_0xb687('0x70')][_0xb687('0x31')]);}break;case'Tag':var _0x28a6aa=_0x3223f8[_0xb687('0x70')][_0xb687('0x71')](',')[_0xb687('0x3e')](function(_0x258caf){return Number(_0x258caf);});_0x28a6aa['forEach'](function(_0x2bd850){_0x50fb31['or'](_0xb687('0x78'),'%,'+_0x2bd850+',%');});_0x1cd045=_[_0xb687('0x79')](_0x1cd045,_0x28a6aa);break;case _0xb687('0x7a'):if(_0x3223f8[_0xb687('0x6e')]===_0xb687('0x6f')){_0x5b87cd[_0x50c7e0](_0xb687('0x7b'),'%'+_0x3223f8[_0xb687('0x70')]+'%',null);}else{_0x49b403=_[_0xb687('0x74')](_0x3e886d,[_0xb687('0x3b'),_0xb687('0x7c')]);_0x3223f8['field']=_0xb687('0x7c');_0x8dc972=as[_0xb687('0x75')](_0x819b63,_0x49b403[_0xb687('0x45')],_0x3223f8);_0x5b87cd[_0x50c7e0](_0x8dc972[_0xb687('0x76')],_0x8dc972['value'][_0xb687('0x77')],_0x8dc972[_0xb687('0x70')]['end']);}break;case _0xb687('0x7d'):_0x8dc972=as[_0xb687('0x75')]('me',null,_0x3223f8);_0x5b87cd[_0x50c7e0](_0x8dc972[_0xb687('0x76')],_0x8dc972['value'][_0xb687('0x77')],_0x8dc972[_0xb687('0x70')]['end']);break;}}else{var _0x8dc972=as[_0xb687('0x75')](_0x819b63,_0x49b403[_0xb687('0x45')],_0x3223f8);_0x5b87cd[_0x50c7e0](_0x8dc972[_0xb687('0x76')],_0x8dc972['value'][_0xb687('0x77')],_0x8dc972[_0xb687('0x70')]['end']);}}}else{var _0x1c2c65=_(_0xa3a9e0[_0xb687('0x48')])['keys']()['map'](function(_0x2d8fc1){return _['some'](_0x3e886d,[_0xb687('0x3b'),_0x2d8fc1])?_0x2d8fc1:undefined;})[_0xb687('0x7e')]()[_0xb687('0x70')]();if(!_[_0xb687('0x7f')](_0x1c2c65)){_0x1c2c65[_0xb687('0x42')](function(_0x30031b){if(_0x30031b===_0xb687('0x80')){_0x21d795[_0xb687('0x81')]('i.ChatWebsiteId\x20IN\x20?',[][_0xb687('0x82')](_0xa3a9e0[_0xb687('0x48')][_0x30031b]));}else if(_0x30031b===_0xb687('0x83')){var _0x3c49dc=JSON[_0xb687('0x84')](_0xa3a9e0[_0xb687('0x48')][_0x30031b])['$gte'];var _0x451ce9=JSON[_0xb687('0x84')](_0xa3a9e0['query'][_0x30031b])[_0xb687('0x85')];_0x21d795[_0xb687('0x81')](_0xb687('0x86'),_0x3c49dc,_0x451ce9);}else{if(_0xa3a9e0[_0xb687('0x48')][_0x30031b]==='null'){_0x21d795[_0xb687('0x81')]('i.'+_0x30031b+'\x20IS\x20NULL');}else{_0x21d795['where']('i.'+_0x30031b+_0xb687('0x87'),_0xa3a9e0['query'][_0x30031b]);}}});}if(_0xa3a9e0['query'][_0xb687('0x88')]){if(_0xa3a9e0['query'][_0xb687('0x88')]==0x1){_0x21d795[_0xb687('0x6a')]('`unreadMessages`\x20=\x200');}else{_0x21d795[_0xb687('0x6a')](_0xb687('0x89'));}}if(_0xa3a9e0['query'][_0xb687('0x8a')]){_0x1cd045=_[_0xb687('0x8b')](_0xa3a9e0[_0xb687('0x48')][_0xb687('0x8a')])?_0xa3a9e0[_0xb687('0x48')][_0xb687('0x8a')]:new Array(_0xa3a9e0[_0xb687('0x48')][_0xb687('0x8a')]);_0x1cd045[_0xb687('0x42')](function(_0x4092a0){_0x50fb31['or'](_0xb687('0x78'),'%,'+_0x4092a0+',%');});}if(_0xa3a9e0['query'][_0xb687('0x8c')]){var _0x4f190f=_0xa3a9e0['query'][_0xb687('0x8c')][_0xb687('0x8d')]('\x5c','\x5c\x5c')[_0xb687('0x8d')]('\x27\x27',_0xb687('0x8e'));if(qs[_0xb687('0x8f')](_0x4f190f)){_0x5b87cd['or']('i.id\x20LIKE\x20?',_0x4f190f+'%');}else{_0x5b87cd['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb687('0x72')](_0x4f190f))['or'](_0xb687('0x90'),_0x4f190f+'%');}}}_0x21d795[_0xb687('0x81')](_0x5b87cd);_0x21d795[_0xb687('0x91')]('i.id');var _0x448d59={'type':db[_0xb687('0x23')][_0xb687('0x92')][_0xb687('0x93')],'raw':!![]};var _0x16872d=_0x21d795[_0xb687('0x94')]();_0x16872d[_0xb687('0x55')](_0xb687('0x95'));_0x16872d[_0xb687('0x55')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb687('0x96'));if(_0x515985[_0xb687('0x51')]){_0x515985[_0xb687('0x51')][_0xb687('0x42')](function(_0x3cbc92){_0x21d795['order']('i.'+_0x3cbc92[0x0],_0x3cbc92[0x1]===_0xb687('0x97')?![]:!![]);});}if(!_[_0xb687('0x7f')](_0x1cd045)){_0x21d795['having'](_0x50fb31);_0x16872d[_0xb687('0x81')]('t.id\x20IN\x20?',_0x1cd045);}BPromise[_0xb687('0x98')]()[_0xb687('0x25')](function(){if(!_0x13ad6a){if(_0xa3a9e0['query'][_0xb687('0x80')]||_0xa3a9e0[_0xb687('0x48')]['journey'])return;_0x16872d[_0xb687('0x81')](_0xb687('0x99'));_0x21d795[_0xb687('0x81')](_0xb687('0x99'));return;}return _0xa3a9e0[_0xb687('0x9a')][_0xb687('0x9b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x105ad2){if(_[_0xb687('0x7f')](_0x105ad2)){_0x16872d[_0xb687('0x81')](_0xb687('0x9c'));_0x21d795[_0xb687('0x81')](_0xb687('0x9c'));}else{_0x16872d[_0xb687('0x81')](_0xb687('0x9d'),_[_0xb687('0x3e')](_0x105ad2,'id'));_0x21d795[_0xb687('0x81')](_0xb687('0x9d'),_['map'](_0x105ad2,'id'));}});})[_0xb687('0x25')](function(){db['sequelize'][_0xb687('0x48')](_0x16872d[_0xb687('0x9e')](),_0x448d59)['then'](function(_0x4c484f){_0x5f1b59[_0xb687('0x33')]=_0x4c484f[_0xb687('0x4e')];if(_0x5f1b59[_0xb687('0x33')]===0x0)return[];return db[_0xb687('0x9f')][_0xb687('0x48')](_0x214ee3[_0xb687('0x9e')](),_0x448d59)[_0xb687('0x25')](function(_0xbf6e66){_0x5d92e7=_[_0xb687('0xa0')](_0xbf6e66,'id');_0x448d59=_[_0xb687('0xa1')](_0x448d59,{'model':db[_0xb687('0xa2')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xa3a9e0[_0xb687('0x48')][_0xb687('0x4c')]){_0x515985[_0xb687('0x4d')][_0xb687('0x42')](function(_0x3f45b7){_0x21d795['field']('i.'+_0x3f45b7);});}else{_0x21d795['field'](_0xb687('0xa3'),'unreadMessages');_0x21d795['field'](_0xb687('0xa4'),_0xb687('0xa5'));_0x21d795['field'](_0xb687('0xa6'),_0xb687('0xa7'));_0x21d795['field'](_0xb687('0xa8'));_0x21d795[_0xb687('0x55')](_0xb687('0xa9'),_0xb687('0xaa'));_0x21d795[_0xb687('0x55')](_0xb687('0xab'),_0xb687('0xac'));_0x21d795[_0xb687('0x55')](_0xb687('0xad'),'Contact.email');_0x21d795[_0xb687('0x55')](_0xb687('0xae'),'Contact.phone');_0x21d795[_0xb687('0x55')]('c.mobile',_0xb687('0xaf'));_0x21d795[_0xb687('0x55')]('c.fax',_0xb687('0xb0'));_0x21d795[_0xb687('0x55')](_0xb687('0xb1'),_0xb687('0xb2'));_0x21d795[_0xb687('0x55')](_0xb687('0xb3'),_0xb687('0xb4'));_0x21d795['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xb687('0x41'));}if(_0x515985['limit'])_0x21d795[_0xb687('0x35')](_0x515985[_0xb687('0x35')]);if(_0x515985[_0xb687('0x34')])_0x21d795[_0xb687('0x34')](_0x515985['offset']);return db[_0xb687('0x9f')][_0xb687('0x48')](_0x21d795['toString'](),_0x448d59);})[_0xb687('0x25')](function(_0x4546c5){_0xe39007[_0xb687('0x81')](_0xb687('0xb5'),_[_0xb687('0x3e')](_0x4546c5,'id'));return db[_0xb687('0x9f')]['query'](_0xe39007[_0xb687('0x9e')](),_0x448d59)[_0xb687('0x25')](function(_0x9ba6c0){var _0x1a8913=_[_0xb687('0xb6')](_0x9ba6c0,_0xb687('0xb7'));var _0x1290c0=[];_0x4546c5[_0xb687('0x42')](function(_0x1411bf){_0x1290c0[_0xb687('0x43')](updateChatInteraction(_0x1411bf,_0x5d92e7,_0x1a8913));});return BPromise['all'](_0x1290c0);});});})['then'](function(_0x40a3ce){_0x5f1b59[_0xb687('0xb8')]=_0x40a3ce;return _0x5f1b59;})[_0xb687('0x25')](respondWithFilteredResult(_0x430364,_0x515985));})[_0xb687('0x2e')](handleError(_0x430364,null));};exports[_0xb687('0xb9')]=function(_0x2fed73,_0x286f5b){var _0x11f925={'raw':![],'where':{'id':_0x2fed73['params']['id']}},_0x24d2c8={};_0x24d2c8['model']=_['keys'](db[_0xb687('0xa2')][_0xb687('0x44')]);_0x24d2c8[_0xb687('0x48')]=_[_0xb687('0x49')](_0x2fed73[_0xb687('0x48')]);_0x24d2c8[_0xb687('0x4a')]=_[_0xb687('0x4b')](_0x24d2c8[_0xb687('0x47')],_0x24d2c8['query']);_0x11f925[_0xb687('0x4d')]=_[_0xb687('0x4b')](_0x24d2c8[_0xb687('0x47')],qs[_0xb687('0x4c')](_0x2fed73[_0xb687('0x48')][_0xb687('0x4c')]));_0x11f925[_0xb687('0x4d')]=_0x11f925[_0xb687('0x4d')]['length']?_0x11f925[_0xb687('0x4d')]:_0x24d2c8['model'];if(_0x2fed73[_0xb687('0x48')][_0xb687('0xba')]){_0x11f925['include']=[{'all':!![]}];}_0x11f925=_[_0xb687('0xa1')]({},_0x11f925,_0x2fed73[_0xb687('0xbb')]);return db[_0xb687('0xa2')]['find'](_0x11f925)[_0xb687('0x25')](handleEntityNotFound(_0x286f5b,null))[_0xb687('0x25')](respondWithResult(_0x286f5b,null))[_0xb687('0x2e')](handleError(_0x286f5b,null));};exports[_0xb687('0xbc')]=function(_0x3d4596,_0x1e37ce){return db[_0xb687('0xa2')]['create'](_0x3d4596[_0xb687('0x7d')],{})[_0xb687('0x25')](respondWithResult(_0x1e37ce,0xc9))[_0xb687('0x2e')](handleError(_0x1e37ce,null));};exports[_0xb687('0xbd')]=function(_0x401b7e,_0x4e0712){if(_0x401b7e[_0xb687('0x7d')]['id']){delete _0x401b7e[_0xb687('0x7d')]['id'];}return db[_0xb687('0xa2')]['find']({'where':{'id':_0x401b7e[_0xb687('0xbe')]['id']}})['then'](handleEntityNotFound(_0x4e0712,null))[_0xb687('0x25')](saveUpdates(_0x401b7e[_0xb687('0x7d')],null))['then'](respondWithResult(_0x4e0712,null))[_0xb687('0x2e')](handleError(_0x4e0712,null));};exports[_0xb687('0xbf')]=function(_0x1ef403,_0x5532e4){return db[_0xb687('0xa2')][_0xb687('0x74')]({'where':{'id':_0x1ef403[_0xb687('0xbe')]['id']}})[_0xb687('0x25')](handleEntityNotFound(_0x5532e4,null))[_0xb687('0x25')](removeEntity(_0x5532e4,null))[_0xb687('0x2e')](handleError(_0x5532e4,null));};exports[_0xb687('0xc0')]=function(_0x32e116,_0x8f6ba0){return db['ChatInteraction'][_0xb687('0xc0')]()[_0xb687('0x25')](respondWithResult(_0x8f6ba0,null))[_0xb687('0x2e')](handleError(_0x8f6ba0,null));};exports['createVidaooSession']=function(_0x4c7f4c,_0x2ac9ef){var _0x4d6600=_0x4c7f4c[_0xb687('0xbe')]['id'];var _0x1d21ef;var _0x386d12;var _0x4dd8f4;return db['ChatInteraction'][_0xb687('0xc1')]({'where':{'id':_0x4d6600}})[_0xb687('0x25')](function(_0x2b432d){_0x1d21ef=_0x2b432d;return db[_0xb687('0xc2')][_0xb687('0xc1')]({'where':{'id':_0x2b432d['ChatWebsiteId']},'attributes':['id',_0xb687('0xc3'),_0xb687('0xc4')],'raw':!![]});})['then'](function(_0x1ad9fc){if(_0x1ad9fc&&_0x1ad9fc[_0xb687('0xc3')]&&_0x1ad9fc['vidaooEscalation']){_0x386d12=_0x1ad9fc;var _0x2daf62={'rejectUnauthorized':![],'method':_0xb687('0xc5'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x1ad9fc[_0xb687('0xc3')]},'body':{'name':_0xb687('0xc6')+_0x4d6600},'redirect':_0xb687('0xc7'),'json':!![]};return rp(_0x2daf62);}else{throw new db[(_0xb687('0x23'))][(_0xb687('0xc8'))](_0xb687('0xc9'));}})[_0xb687('0x25')](function(_0x532201){_0x4dd8f4=_0x532201;if(_0x4dd8f4['id']){var _0x394a94={'body':_0x4dd8f4['join_url'],'ChatWebsiteId':_0x386d12['id'],'ChatInteractionId':_0x1d21ef['id'],'direction':_0xb687('0xca'),'UserId':_0x4c7f4c[_0xb687('0x9a')]['id']};return db[_0xb687('0xcb')][_0xb687('0xbc')](_0x394a94,{});}else{throw new db['Sequelize'][(_0xb687('0xc8'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x1d21ef[_0xb687('0xcc')]({'vidaooSessionId':_0x4dd8f4['id']});})[_0xb687('0x25')](respondWithResult(_0x2ac9ef,null))[_0xb687('0x2e')](handleError(_0x2ac9ef,null));};exports['customUpdate']=function(_0x258497,_0x219b35){if(_0x258497['body']['id']){delete _0x258497[_0xb687('0x7d')]['id'];}return db['ChatInteraction'][_0xb687('0x74')]({'where':{'id':_0x258497[_0xb687('0xbe')]['id']}})['then'](handleEntityNotFound(_0x219b35,null))[_0xb687('0x25')](saveUpdates(_0x258497['body'],null))[_0xb687('0x25')](respondWithResult(_0x219b35,null))['catch'](handleError(_0x219b35,null));};exports['abandon']=function(_0x303738,_0x3904a3,_0x581338){if(_0x303738[_0xb687('0x7d')]['id']){delete _0x303738['body']['id'];}return db[_0xb687('0xa2')][_0xb687('0x74')]({'where':{'id':_0x303738[_0xb687('0xbe')]['id']}})['then'](function(_0xc29834){if(!_0xc29834){logger[_0xb687('0x2a')](_0xb687('0xcd'),_0xb687('0xce'),0x194,_0xb687('0xcf'));_0x3904a3[_0xb687('0x2f')](0x194);}else{if(_0xc29834['UserId']){throw new db[(_0xb687('0x23'))][(_0xb687('0xc8'))](_0xb687('0xd0'));}}return _0xc29834;})[_0xb687('0x25')](function(_0x3591e2){if(_0x3591e2){return _0x3591e2['update']({'closed':_0x303738['body'][_0xb687('0xd1')],'disposition':_0x303738[_0xb687('0x7d')][_0xb687('0xd2')]})[_0xb687('0x25')](function(_0x33f4de){return _0x33f4de;});}})[_0xb687('0x25')](function(_0x87c14c){return respondWithRpcPromise('AbandonInteraction',_0xb687('0xce'),_0x303738[_0xb687('0x7d')],client9004);})[_0xb687('0x25')](respondWithResult(_0x3904a3,null))['catch'](handleError(_0x3904a3,null));};exports[_0xb687('0xd3')]=function(_0x300448,_0x15e9d2,_0x4b65c4){_0x300448[_0xb687('0x7d')][_0xb687('0x3b')]=_0x300448['file'][_0xb687('0xd4')];_0x300448[_0xb687('0x7d')][_0xb687('0xd5')]=_0x300448[_0xb687('0xd6')]['filename'];_0x300448[_0xb687('0x7d')][_0xb687('0x45')]=_0x300448[_0xb687('0xd6')][_0xb687('0xd7')];return db[_0xb687('0xd8')]['create'](_0x300448[_0xb687('0x7d')])[_0xb687('0x25')](respondWithResult(_0x15e9d2,0xc9))['catch'](handleError(_0x15e9d2,null));};exports[_0xb687('0xd9')]=function(_0x343e6b,_0x4c40b1,_0x45525a){return db[_0xb687('0xa2')][_0xb687('0xc1')]({'where':{'id':_0x343e6b['params']['id']},'raw':!![]})[_0xb687('0x25')](handleEntityNotFound(_0x4c40b1,null))[_0xb687('0x25')](function(_0x5e2200){if(_0x5e2200){if(_0x5e2200['closed']){return _0x4c40b1['status'](0x193)[_0xb687('0x32')]({'status':0x193,'message':'Unauthorized'});}return db[_0xb687('0xd8')][_0xb687('0xc1')]({'where':{'id':_0x343e6b[_0xb687('0x48')][_0xb687('0xda')]},'raw':!![]})[_0xb687('0x25')](handleEntityNotFound(_0x4c40b1,null));}})['then'](function(_0x4a6d20){if(_0x4a6d20){return _0x4c40b1[_0xb687('0xdb')](path[_0xb687('0xdc')](config[_0xb687('0xdd')],_0xb687('0xde'),_0x4a6d20[_0xb687('0xd5')]));}})[_0xb687('0x2e')](handleError(_0x4c40b1,null));};exports[_0xb687('0xdf')]=function(_0x4d39fc,_0x4a5102){var _0x4a7895=null;var _0x2c9199=null;var _0x29d687=null;var _0x19e253=null;if(_0x4d39fc['body']['id']){delete _0x4d39fc['body']['id'];}if(_0x4d39fc['body'][_0xb687('0xe0')]){_0x19e253=path['join'](config[_0xb687('0xdd')],_0xb687('0xe1'),util[_0xb687('0xe2')](_0xb687('0xe3'),Date[_0xb687('0xe4')]()));_0x4d39fc[_0xb687('0x7d')]['pathTranscript']=_0x19e253;}return db['ChatInteraction']['find']({'where':{'id':_0x4d39fc[_0xb687('0xbe')]['id']},'include':[{'model':db[_0xb687('0xcb')],'as':_0xb687('0xe5'),'include':[{'model':db[_0xb687('0x7a')],'as':_0xb687('0x7a')}]}]})[_0xb687('0x25')](handleEntityNotFound(_0x4a5102,null))[_0xb687('0x25')](saveUpdates(_0x4d39fc['body'],null))[_0xb687('0x25')](function(_0x292739){if(_0x292739){_0x4a7895=_0x292739;return db[_0xb687('0xc2')][_0xb687('0x74')]({'where':{'id':_0x4a7895[_0xb687('0x80')]}});}})['then'](function(_0x1764ee){if(_0x1764ee){_0x29d687=_0x1764ee;return db[_0xb687('0xe6')][_0xb687('0x74')]({'where':{'id':_0x4a7895['ContactId']}});}})[_0xb687('0x25')](function(_0x2ed4bf){if(_0x2ed4bf){_0x2c9199=_0x2ed4bf;if(_0x19e253){var _0x2bb569=null;for(var _0x1a1d48=0x1;_0x1a1d48<_0x4a7895[_0xb687('0xe5')][_0xb687('0x4e')];++_0x1a1d48){_0x2bb569=_0x4a7895[_0xb687('0xe5')][_0x1a1d48];var _0x3492aa=_0x2bb569[_0xb687('0x7c')]?util[_0xb687('0xe2')](_0xb687('0xe7'),_0x29d687[_0xb687('0xe8')],_0x2bb569[_0xb687('0x7c')]):_0xb687('0xe9');var _0x35952a=_0x4d39fc['body'][_0xb687('0xea')]||util[_0xb687('0xe2')](_0xb687('0xe7'),'Visitor',_0x2bb569[_0xb687('0xeb')]);switch(_0x29d687[_0xb687('0xec')]){case'website_alias':_0x3492aa=_0x2bb569[_0xb687('0x7c')]?util['format'](_0xb687('0xe7'),_0x29d687[_0xb687('0xe8')],_0x2bb569[_0xb687('0x7c')]):'System';break;case _0xb687('0xed'):_0x3492aa=_0x2bb569[_0xb687('0x7c')]?_0x2bb569[_0xb687('0x7a')][_0xb687('0xee')]||_0x2bb569['User']['fullname']:_0xb687('0xe9');break;case _0xb687('0xef'):_0x3492aa=_0x2bb569[_0xb687('0x7c')]?_0x2bb569[_0xb687('0x7a')][_0xb687('0x3f')]:_0xb687('0xe9');break;default:_0x3492aa=_0x2bb569['UserId']?util[_0xb687('0xe2')](_0xb687('0xe7'),_0x29d687[_0xb687('0xe8')],_0x2bb569['UserId']):_0xb687('0xe9');}var _0x8717e5=util[_0xb687('0xe2')]('[%s]\x20%s:\x20%s\x0a',moment(_0x2bb569['createdAt'])['format'](_0xb687('0xf0')),_0x2bb569['direction']==='in'?_0x35952a:_0x3492aa,_0x2bb569['body']);if(!_0x2bb569['secret']){fs[_0xb687('0xf1')](_0x19e253,_0x8717e5);}}return db[_0xb687('0xf2')][_0xb687('0xc1')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb687('0xf3'),'raw':!![]}]});}}})[_0xb687('0x25')](function(_0x1cb9e1){if(_0x1cb9e1&&_0x1cb9e1[_0xb687('0xf3')]&&_0x4d39fc[_0xb687('0x7d')]){var _0x532c69={'tls':{'rejectUnauthorized':![]}};if(_0x1cb9e1[_0xb687('0xf3')][_0xb687('0xf4')]){_0x532c69[_0xb687('0xf4')]=_0x1cb9e1[_0xb687('0xf3')][_0xb687('0xf4')];}else{_0x532c69[_0xb687('0xf5')]=_0x1cb9e1[_0xb687('0xf3')][_0xb687('0xf5')];_0x532c69[_0xb687('0xf6')]=_0x1cb9e1['Smtp'][_0xb687('0xf6')];_0x532c69[_0xb687('0xf7')]=_0x1cb9e1['Smtp'][_0xb687('0xf7')];}if(_0x1cb9e1['Smtp'][_0xb687('0xf8')]){_0x532c69[_0xb687('0xf9')]={'user':_0x1cb9e1[_0xb687('0xf3')][_0xb687('0x9a')],'pass':_0x1cb9e1[_0xb687('0xf3')]['pass']};}return respondWithRpcPromise(_0xb687('0xfa'),'sendMail',{'account':_0x532c69,'message':{'from':util['format'](_0xb687('0xfb'),_0x1cb9e1[_0xb687('0x3b')],_0x1cb9e1['email']||_0x1cb9e1[_0xb687('0xf3')][_0xb687('0x9a')]),'to':_0x4d39fc[_0xb687('0x7d')][_0xb687('0xe0')],'subject':_0xb687('0xfc'),'text':util[_0xb687('0xe2')](_0xb687('0xfd'),_0x4d39fc[_0xb687('0x7d')][_0xb687('0xe0')]),'attachments':[{'path':_0x19e253}]}})[_0xb687('0x25')](function(){return _0x4a7895;})['catch'](function(_0x5a39a2){console['error'](_0x5a39a2);});}else{return _0x4a7895;}})[_0xb687('0x25')](respondWithStatusCode(_0x4a5102,0xc8))[_0xb687('0x2e')](handleError(_0x4a5102,null));};exports[_0xb687('0xfe')]=function(_0x5d49ea,_0x5e585,_0x36ea67){return db[_0xb687('0xcb')]['find']({'where':{'id':_0x5d49ea[_0xb687('0xbe')]['id']}})[_0xb687('0x25')](handleEntityNotFound(_0x5e585,null))[_0xb687('0x25')](function(_0x5915a8){if(_0x5915a8){return _0x5915a8['addMessage'](_0x5d49ea[_0xb687('0x7d')][_0xb687('0xff')],_[_0xb687('0x100')](_0x5d49ea[_0xb687('0x7d')],[_0xb687('0xff'),'id'])||{});}})[_0xb687('0x25')](respondWithResult(_0x5e585,null))['catch'](handleError(_0x5e585,null));};exports[_0xb687('0x101')]=function(_0x22191b,_0x5cad1b,_0x3ce6dd){var _0x1e4fc9={'raw':![],'where':{}};var _0xeb37b0={};var _0x13f9b7={'count':0x0,'rows':[]};return db[_0xb687('0xa2')][_0xb687('0xc1')]({'where':{'id':_0x22191b[_0xb687('0xbe')]['id']}})[_0xb687('0x25')](handleEntityNotFound(_0x5cad1b,null))['then'](function(_0xd68690){if(_0xd68690){_0xeb37b0[_0xb687('0x47')]=_['keys'](db[_0xb687('0xcb')][_0xb687('0x44')]);_0xeb37b0['query']=_[_0xb687('0x49')](_0x22191b[_0xb687('0x48')]);_0xeb37b0['filters']=_['intersection'](_0xeb37b0[_0xb687('0x47')],_0xeb37b0[_0xb687('0x48')]);_0x1e4fc9[_0xb687('0x4d')]=_[_0xb687('0x4b')](_0xeb37b0[_0xb687('0x47')],qs[_0xb687('0x4c')](_0x22191b['query'][_0xb687('0x4c')]));_0x1e4fc9['attributes']=_0x1e4fc9[_0xb687('0x4d')][_0xb687('0x4e')]?_0x1e4fc9[_0xb687('0x4d')]:_0xeb37b0[_0xb687('0x47')];if(!_0x22191b[_0xb687('0x48')][_0xb687('0x4f')](_0xb687('0x50'))){_0x1e4fc9[_0xb687('0x35')]=qs['limit'](_0x22191b[_0xb687('0x48')][_0xb687('0x35')]);_0x1e4fc9['offset']=qs[_0xb687('0x34')](_0x22191b[_0xb687('0x48')]['offset']);}_0x1e4fc9[_0xb687('0x51')]=qs[_0xb687('0x52')](_0x22191b[_0xb687('0x48')][_0xb687('0x52')]);_0x1e4fc9[_0xb687('0x81')]=qs[_0xb687('0x4a')](_['pick'](_0x22191b[_0xb687('0x48')],_0xeb37b0[_0xb687('0x4a')]));_0x1e4fc9[_0xb687('0x81')]['ChatInteractionId']=_0xd68690['id'];if(_0x22191b[_0xb687('0x48')]['filter']){_0x1e4fc9[_0xb687('0x81')]=_[_0xb687('0xa1')](_0x1e4fc9[_0xb687('0x81')],{'$or':_[_0xb687('0x3e')](_0x1e4fc9[_0xb687('0x4d')],function(_0x25718a){var _0x28a3f0={};_0x28a3f0[_0x25718a]={'$like':'%'+_0x22191b[_0xb687('0x48')][_0xb687('0x8c')]+'%'};return _0x28a3f0;})});}if(_0x22191b[_0xb687('0x48')][_0xb687('0x102')]){var _0x4123b4=_0x22191b[_0xb687('0x48')]['$gte'][_0xb687('0x71')](',');var _0x3d7e26={};_0x3d7e26[_0x4123b4[0x0]]={'$gte':moment(_0x4123b4[0x1])['format'](_0xb687('0x103'))};_0x1e4fc9[_0xb687('0x81')]=_[_0xb687('0xa1')](_0x1e4fc9[_0xb687('0x81')],_0x3d7e26);}_0x1e4fc9=_[_0xb687('0xa1')]({},_0x1e4fc9,_0x22191b['options']);return db[_0xb687('0xcb')][_0xb687('0x33')]({'where':_0x1e4fc9['where']})[_0xb687('0x25')](function(_0x34400c){_0x13f9b7[_0xb687('0x33')]=_0x34400c;if(_0x22191b[_0xb687('0x48')][_0xb687('0xba')]){_0x1e4fc9[_0xb687('0x104')]=[{'all':!![]}];}return db[_0xb687('0xcb')][_0xb687('0x105')](_0x1e4fc9);})[_0xb687('0x25')](function(_0x5941d5){_0x13f9b7['rows']=_0x5941d5;return _0x13f9b7;});}})[_0xb687('0x25')](respondWithFilteredResult(_0x5cad1b,_0x1e4fc9))[_0xb687('0x2e')](handleError(_0x5cad1b,null));};exports['getMyMessages']=function(_0x2bb3b9,_0xf0720d,_0x4de920){var _0x2fdf5d={'where':{}},_0x8ccc33={},_0x36158a={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x2bb3b9['params']['id']}})[_0xb687('0x25')](handleEntityNotFound(_0xf0720d,null))[_0xb687('0x25')](function(_0x4b6a00){if(_0x4b6a00){_0x8ccc33[_0xb687('0x47')]=_[_0xb687('0x49')](db['ChatMessage'][_0xb687('0x44')]);_0x8ccc33[_0xb687('0x48')]=_['keys'](_0x2bb3b9[_0xb687('0x48')]);_0x8ccc33['filters']=_[_0xb687('0x4b')](_0x8ccc33[_0xb687('0x47')],_0x8ccc33['query']);_0x2fdf5d[_0xb687('0x4d')]=_[_0xb687('0x4b')](_0x8ccc33[_0xb687('0x47')],qs[_0xb687('0x4c')](_0x2bb3b9['query']['fields']));_0x2fdf5d[_0xb687('0x4d')]=_0x2fdf5d[_0xb687('0x4d')][_0xb687('0x4e')]?_0x2fdf5d[_0xb687('0x4d')]:_0x8ccc33[_0xb687('0x47')];if(!_0x2bb3b9[_0xb687('0x48')][_0xb687('0x4f')]('nolimit')){_0x2fdf5d[_0xb687('0x35')]=qs['limit'](_0x2bb3b9[_0xb687('0x48')]['limit']);_0x2fdf5d[_0xb687('0x34')]=qs[_0xb687('0x34')](_0x2bb3b9[_0xb687('0x48')][_0xb687('0x34')]);}_0x2fdf5d['order']=qs['sort'](_0x2bb3b9[_0xb687('0x48')][_0xb687('0x52')]);_0x2fdf5d[_0xb687('0x81')]=qs[_0xb687('0x4a')](_[_0xb687('0x53')](_0x2bb3b9[_0xb687('0x48')],_0x8ccc33[_0xb687('0x4a')]));_0x2fdf5d['where'][_0xb687('0xb7')]=_0x4b6a00['id'];if(_0x2bb3b9[_0xb687('0x48')]['filter']){_0x2fdf5d[_0xb687('0x81')]=_[_0xb687('0xa1')](_0x2fdf5d[_0xb687('0x81')],{'$or':_[_0xb687('0x3e')](_0x2fdf5d[_0xb687('0x4d')],function(_0x57afac){var _0x14c7a6={};_0x14c7a6[_0x57afac]={'$like':'%'+_0x2bb3b9[_0xb687('0x48')]['filter']+'%'};return _0x14c7a6;})});}_0x2fdf5d[_0xb687('0x81')][_0xb687('0x106')]=![];if(_0x2bb3b9[_0xb687('0x48')]['id']){_0x2fdf5d['where']['id']={'$gt':_0x2bb3b9['query']['id']};}_0x2fdf5d=_[_0xb687('0xa1')]({},_0x2fdf5d,_0x2bb3b9['options']);return db[_0xb687('0xcb')][_0xb687('0x33')]({'where':_0x2fdf5d[_0xb687('0x81')]})[_0xb687('0x25')](function(_0x482b4c){_0x36158a[_0xb687('0x33')]=_0x482b4c;_0x2fdf5d[_0xb687('0x104')]=[];if(_0x2bb3b9[_0xb687('0x48')][_0xb687('0x107')]){_0x2fdf5d['include'][_0xb687('0x43')]({'model':db['User'],'as':_0xb687('0x7a'),'attributes':['id','fullname',_0xb687('0xee')]});}if(_0x2bb3b9['query']['includeAll']){_0x2fdf5d['include']=[{'all':!![]}];}return db[_0xb687('0xcb')][_0xb687('0x105')](_0x2fdf5d);})[_0xb687('0x25')](function(_0x118df7){_0x36158a[_0xb687('0xb8')]=_0x118df7;return _0x36158a;});}})[_0xb687('0x25')](respondWithFilteredResult(_0xf0720d,_0x2fdf5d))['catch'](handleError(_0xf0720d,null));};exports['addTags']=function(_0x3f3ba2,_0x370043,_0x2d3f85){return db['ChatInteraction'][_0xb687('0x74')]({'where':{'id':_0x3f3ba2[_0xb687('0xbe')]['id']}})[_0xb687('0x25')](handleEntityNotFound(_0x370043,null))[_0xb687('0x25')](function(_0x2a9fc0){if(_0x2a9fc0){return _0x2a9fc0['setTags'](_0x3f3ba2[_0xb687('0x7d')][_0xb687('0xff')],_[_0xb687('0x100')](_0x3f3ba2['body'],[_0xb687('0xff'),'id'])||{})[_0xb687('0x108')](function(){return db[_0xb687('0x109')][_0xb687('0x105')]({'attributes':['id',_0xb687('0x3b'),_0xb687('0x56')],'where':{'id':_0x3f3ba2[_0xb687('0x7d')][_0xb687('0xff')]}});})['then'](function(_0x476024){socket[_0xb687('0x10a')](_0xb687('0x10b'),{'id':Number(_0x3f3ba2[_0xb687('0xbe')]['id']),'tags':_0x476024||[]});return{'id':Number(_0x3f3ba2['params']['id']),'tags':_0x476024||[]};});}})[_0xb687('0x25')](respondWithResult(_0x370043,null))['catch'](handleError(_0x370043,null));};exports[_0xb687('0x10c')]=function(_0x4418e3,_0x261136,_0x5a107b){return db['ChatInteraction']['find']({'where':{'id':_0x4418e3['params']['id']}})[_0xb687('0x25')](handleEntityNotFound(_0x261136,null))[_0xb687('0x25')](function(_0x3ab472){if(_0x3ab472){return _0x3ab472[_0xb687('0x10c')](_0x4418e3['query'][_0xb687('0xff')]);}})[_0xb687('0x25')](respondWithStatusCode(_0x261136,null))[_0xb687('0x2e')](handleError(_0x261136,null));};exports['download']=function(_0x1c8ba9,_0x3309a4){var _0x378e6c=moment()['unix']()['toString']();var _0x29cd81=path[_0xb687('0xdc')](config[_0xb687('0xdd')],_0xb687('0x10d'),_0xb687('0x10e'),_0xb687('0x10f'));var _0xad8e24=path[_0xb687('0xdc')](config[_0xb687('0xdd')],_0xb687('0x10d'),'files',_0xb687('0x110'));var _0x4f0591=path[_0xb687('0xdc')](_0x29cd81,_0x378e6c);var _0x409f5f=util['format'](_0xb687('0x111'),_0x1c8ba9[_0xb687('0xbe')]['id'],_0x378e6c);var _0x3085d4=path[_0xb687('0xdc')](_0x29cd81,_0x409f5f);var _0x6b3c83=[];_0x6b3c83[_0xb687('0x43')]({'model':db[_0xb687('0x7a')],'as':_0xb687('0x7a'),'attributes':['id',_0xb687('0x3f')],'raw':!![]});_0x6b3c83[_0xb687('0x43')]({'model':db[_0xb687('0xe6')],'as':'Contact','attributes':['id',_0xb687('0x112'),_0xb687('0x113')],'raw':!![]});if(_0x1c8ba9[_0xb687('0x48')]['attachments']){_0x6b3c83[_0xb687('0x43')]({'model':db[_0xb687('0xd8')],'as':_0xb687('0xd8'),'raw':!![]});}var _0x9002c7=[{'model':db[_0xb687('0xcb')],'as':_0xb687('0xe5'),'attributes':['id',_0xb687('0x7d'),_0xb687('0x83'),'direction',_0xb687('0x106'),'read'],'include':_0x6b3c83}];_0x9002c7[_0xb687('0x43')]({'model':db[_0xb687('0xc2')],'as':_0xb687('0x114'),'attributes':['id',_0xb687('0x3b')]});_0x9002c7[_0xb687('0x43')]({'model':db[_0xb687('0x7a')],'as':'Owner','attributes':['id',_0xb687('0x3f')]});return db[_0xb687('0xa2')][_0xb687('0x74')]({'where':{'id':_0x1c8ba9[_0xb687('0xbe')]['id']},'include':_0x9002c7})['then'](handleEntityNotFound(_0x3309a4,null))[_0xb687('0x25')](function(_0x45ce7d){if(_0x45ce7d){var _0x3ff2d8=_0x45ce7d[_0xb687('0x115')]({'plain':!![]});fs[_0xb687('0x116')](_0x4f0591);var _0x32386f={'format':'A4','border':_0xb687('0x117'),'header':{'height':_0xb687('0x118'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0xb687('0x119'),'contents':{'default':util['format'](_0xb687('0x11a'),util[_0xb687('0xe2')](_0xb687('0x11b'),'Chat',_0x3ff2d8['id']),moment()[_0xb687('0xe2')]('YYYY-MM-DD')[_0xb687('0x9e')]())}}};var _0x129116={'channel':'Chat','account':_0x3ff2d8[_0xb687('0x114')][_0xb687('0x3b')],'agent':_0x3ff2d8[_0xb687('0x11c')]?_0x3ff2d8[_0xb687('0x11c')][_0xb687('0x3f')]:_0xb687('0x11d'),'createdAt':moment(_0x3ff2d8['createdAt'])['format'](_0xb687('0x103'))['toString'](),'closedAt':_0x3ff2d8[_0xb687('0xd1')]?moment(_0x3ff2d8[_0xb687('0x11e')])['format'](_0xb687('0x103'))['toString']():'','disposition':_0x3ff2d8[_0xb687('0xd2')],'chatInfo':{'browser':_0x3ff2d8[_0xb687('0x11f')],'os':_0x3ff2d8[_0xb687('0x120')],'referer':_0x3ff2d8['referer'],'customerIp':_0x3ff2d8['customerIp'],'customerPort':_0x3ff2d8[_0xb687('0x121')]?_0x3ff2d8[_0xb687('0x121')]:'N.A.'},'messages':_(_0x3ff2d8['Messages'])[_0xb687('0x122')]()['filter']({'secret':![]})['map'](function(_0x9009ea){if(_0x9009ea[_0xb687('0xd8')]){var _0x1bec8d=path[_0xb687('0xdc')](_0xad8e24,_0x9009ea[_0xb687('0xd8')][_0xb687('0xd5')]);if(fs[_0xb687('0x123')](_0x1bec8d)){fs[_0xb687('0x124')](_0x1bec8d)[_0xb687('0x125')](fs[_0xb687('0x126')](path[_0xb687('0xdc')](_0x4f0591,_0x9009ea[_0xb687('0xd8')][_0xb687('0xd5')])));}}return{'date':moment(_0x9009ea[_0xb687('0x83')])[_0xb687('0xe2')](_0xb687('0x103'))[_0xb687('0x9e')](),'sender':_0x9009ea[_0xb687('0x127')]==='out'?_0x9009ea[_0xb687('0x7a')]?_0x9009ea[_0xb687('0x7a')]['fullname']:_0xb687('0xe9'):_0x9009ea[_0xb687('0x6d')][_0xb687('0x112')]+(_0x9009ea[_0xb687('0x6d')][_0xb687('0x113')]?'\x20'+_0x9009ea['Contact'][_0xb687('0x113')]:''),'body':_0x9009ea[_0xb687('0xd8')]?_0x9009ea[_0xb687('0xd8')][_0xb687('0xd5')]:_0x9009ea[_0xb687('0x7d')],'direction':_0x9009ea['direction']===_0xb687('0xca')?'A':'C','secret':_0x9009ea[_0xb687('0x106')],'read':_0x9009ea[_0xb687('0x88')],'attachment':_0x9009ea['Attachment']};})[_0xb687('0x70')]()};return ejs['renderFile'](path[_0xb687('0xdc')](config[_0xb687('0xdd')],_0xb687('0x10d'),_0xb687('0x128'),_0xb687('0x129')),{'interaction':_0x129116})[_0xb687('0x25')](function(_0x51cb45){return new BPromise(function(_0x33f4a6,_0xb8cae6){pdf[_0xb687('0xbc')](_0x51cb45,_0x32386f)[_0xb687('0x12a')](path[_0xb687('0xdc')](_0x4f0591,_0xb687('0x12b')+_0x3ff2d8['id']+'-'+_0x378e6c+'.pdf'),function(_0x9d4dba,_0x5b1df3){if(_0x9d4dba)return _0xb8cae6(_0x9d4dba);_0x33f4a6(_0x5b1df3);});});})['then'](function(){return new BPromise(function(_0x570eb4,_0x4004a7){zipdir(_0x4f0591,{'saveTo':_0x3085d4},function(_0x4db889,_0x1e938f){if(_0x4db889)return _0x4004a7(_0x4db889);return _0x570eb4(_0x1e938f);});})['then'](function(){return new BPromise(function(_0x7754d7,_0x7b400a){rimraf(_0x4f0591,function(_0x252a54){if(_0x252a54)_0x7b400a(_0x252a54);return _0x7754d7();});});})[_0xb687('0x25')](function(){return _0x3309a4[_0xb687('0xdb')](_0x3085d4,_0x409f5f,function(_0x203830){if(_0x203830){console[_0xb687('0x12c')](_0xb687('0x12d'),_0x203830);}else{fs[_0xb687('0x12e')](_0x3085d4);}});});});}else{return _0x3309a4[_0xb687('0x2f')](0xc8);}})[_0xb687('0x2e')](handleError(_0x3309a4,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index a220523..a5b5252 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 _0xd9cb=['../../mysqldb','setMaxListeners','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','events','ChatInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd9cb,0x1be));var _0xbd9c=function(_0x3e8f8e,_0x50e78d){_0x3e8f8e=_0x3e8f8e-0x0;var _0x428d54=_0xd9cb[_0x3e8f8e];return _0x428d54;};'use strict';var EventEmitter=require(_0xbd9c('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xbd9c('0x1')];var ChatMessage=require(_0xbd9c('0x2'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xbd9c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbd9c('0x4')};function emitEvent(_0x44d44b){return function(_0x1d3d34,_0x308ba8,_0x39cc0d){_0x1d3d34[_0xbd9c('0x5')]({'attributes':['id'],'raw':!![]})[_0xbd9c('0x6')](function(_0x97f579){_0x1d3d34['setDataValue'](_0xbd9c('0x7'),_0x97f579[_0xbd9c('0x8')](function(_0xd1975f){return{'id':_0xd1975f['id']};}));return ChatMessage[_0xbd9c('0x9')]({'where':{'ChatInteractionId':_0x1d3d34['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbd9c('0x6')](function(_0x3784bf){_0x1d3d34[_0xbd9c('0xa')](_0xbd9c('0xb'),_0x3784bf[_0xbd9c('0xc')]);ChatInteractionEvents[_0xbd9c('0xd')](_0x44d44b+':'+_0x1d3d34['id'],_0x1d3d34);ChatInteractionEvents['emit'](_0x44d44b,_0x1d3d34);_0x39cc0d(null);})['catch'](_0x39cc0d(null));};}for(var e in events){if(events[_0xbd9c('0xe')](e)){var event=events[e];ChatInteraction[_0xbd9c('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xbae0=['Users','map','findAll','setDataValue','length','emit','hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','then'];(function(_0x587728,_0x1ee8b8){var _0x163668=function(_0x34f38b){while(--_0x34f38b){_0x587728['push'](_0x587728['shift']());}};_0x163668(++_0x1ee8b8);}(_0xbae0,0x171));var _0x0bae=function(_0x2d69e1,_0x43f881){_0x2d69e1=_0x2d69e1-0x0;var _0x9b5140=_0xbae0[_0x2d69e1];return _0x9b5140;};'use strict';var EventEmitter=require(_0x0bae('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x0bae('0x1')];var ChatMessage=require(_0x0bae('0x2'))['db'][_0x0bae('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x0bae('0x4')](0x0);var events={'afterCreate':_0x0bae('0x5'),'afterUpdate':_0x0bae('0x6'),'afterDestroy':_0x0bae('0x7')};function emitEvent(_0x1f64c8){return function(_0x4fbca2,_0x5b6b2b,_0x50b74e){_0x4fbca2['getUsers']({'attributes':['id'],'raw':!![]})[_0x0bae('0x8')](function(_0x2a0453){_0x4fbca2['setDataValue'](_0x0bae('0x9'),_0x2a0453[_0x0bae('0xa')](function(_0x38f21d){return{'id':_0x38f21d['id']};}));return ChatMessage[_0x0bae('0xb')]({'where':{'ChatInteractionId':_0x4fbca2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0bae('0x8')](function(_0x1a38ca){_0x4fbca2[_0x0bae('0xc')]('unreadMessages',_0x1a38ca[_0x0bae('0xd')]);ChatInteractionEvents[_0x0bae('0xe')](_0x1f64c8+':'+_0x4fbca2['id'],_0x4fbca2);ChatInteractionEvents[_0x0bae('0xe')](_0x1f64c8,_0x4fbca2);_0x50b74e(null);})['catch'](_0x50b74e(null));};}for(var e in events){if(events[_0x0bae('0xf')](e)){var event=events[e];ChatInteraction[_0x0bae('0x10')](e,emitEvent(event));}}module[_0x0bae('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 8c03821..5d91f65 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 _0x97df=['lodash','api','moment','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4'];(function(_0x2a1b8e,_0x3e67fa){var _0x3a1d74=function(_0x5103b3){while(--_0x5103b3){_0x2a1b8e['push'](_0x2a1b8e['shift']());}};_0x3a1d74(++_0x3e67fa);}(_0x97df,0x1d1));var _0xf97d=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x97df[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0xf97d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf97d('0x1'));var moment=require(_0xf97d('0x2'));var BPromise=require(_0xf97d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf97d('0x4'));var rimraf=require(_0xf97d('0x5'));var config=require(_0xf97d('0x6'));var attributes=require(_0xf97d('0x7'));module[_0xf97d('0x8')]=function(_0x2b7804,_0x5ea59b){return _0x2b7804[_0xf97d('0x9')](_0xf97d('0xa'),attributes,{'tableName':_0xf97d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x32ad7c,_0x41d2da,_0x27619f){if(_0x32ad7c['changed']('closed')){_0x32ad7c[_0xf97d('0xc')]=moment()['format'](_0xf97d('0xd'));}_0x27619f(null,_0x32ad7c);}},'charset':_0xf97d('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8c3c=['chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction'];(function(_0x5b5345,_0xbfb2ab){var _0x31d3fc=function(_0x3f3fbf){while(--_0x3f3fbf){_0x5b5345['push'](_0x5b5345['shift']());}};_0x31d3fc(++_0xbfb2ab);}(_0x8c3c,0xd8));var _0xc8c3=function(_0x1bfa99,_0x1c1efe){_0x1bfa99=_0x1bfa99-0x0;var _0xf4f9ae=_0x8c3c[_0x1bfa99];return _0xf4f9ae;};'use strict';var _=require('lodash');var util=require(_0xc8c3('0x0'));var logger=require(_0xc8c3('0x1'))(_0xc8c3('0x2'));var moment=require(_0xc8c3('0x3'));var BPromise=require(_0xc8c3('0x4'));var rp=require(_0xc8c3('0x5'));var fs=require('fs');var path=require(_0xc8c3('0x6'));var rimraf=require('rimraf');var config=require(_0xc8c3('0x7'));var attributes=require(_0xc8c3('0x8'));module[_0xc8c3('0x9')]=function(_0x5db780,_0x32e5a3){return _0x5db780[_0xc8c3('0xa')](_0xc8c3('0xb'),attributes,{'tableName':_0xc8c3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30fed6,_0x585716,_0x3a8a3b){if(_0x30fed6[_0xc8c3('0xd')]('closed')){_0x30fed6[_0xc8c3('0xe')]=moment()[_0xc8c3('0xf')](_0xc8c3('0x10'));}_0x3a8a3b(null,_0x30fed6);}},'charset':_0xc8c3('0x11'),'collate':_0xc8c3('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index b9a1083..3321abe 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 _0x3052=['find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','limit','AddTagsToChatInteraction'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x3052,0x1d9));var _0x2305=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3052[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2305('0x0'));var util=require(_0x2305('0x1'));var moment=require(_0x2305('0x2'));var BPromise=require(_0x2305('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2305('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2305('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2305('0x6'));var client=jayson[_0x2305('0x7')][_0x2305('0x8')]({'port':0x232a});config[_0x2305('0x9')]=_[_0x2305('0xa')](config['redis'],{'host':_0x2305('0xb'),'port':0x18eb});var socket=require(_0x2305('0xc'))(new Redis(config[_0x2305('0x9')]));require('./chatInteraction.socket')[_0x2305('0xd')](socket);function respondWithRpcPromise(_0x28b30e,_0xa1e177,_0x18dac9){return new BPromise(function(_0x129a93,_0x43274f){return client['request'](_0x28b30e,_0x18dac9)[_0x2305('0xe')](function(_0x12a45d){logger[_0x2305('0xf')](_0x2305('0x10'),_0xa1e177,_0x2305('0x11'));logger[_0x2305('0x12')](_0x2305('0x13'),_0xa1e177,'request\x20sent',JSON[_0x2305('0x14')](_0x12a45d));if(_0x12a45d[_0x2305('0x15')]){if(_0x12a45d[_0x2305('0x15')]['code']===0x1f4){logger[_0x2305('0x15')](_0x2305('0x10'),_0xa1e177,_0x12a45d['error']['message']);return _0x43274f(_0x12a45d[_0x2305('0x15')]['message']);}logger[_0x2305('0x15')](_0x2305('0x10'),_0xa1e177,_0x12a45d['error'][_0x2305('0x16')]);return _0x129a93(_0x12a45d[_0x2305('0x15')][_0x2305('0x16')]);}else{logger['info'](_0x2305('0x10'),_0xa1e177,'request\x20sent');_0x129a93(_0x12a45d[_0x2305('0x17')][_0x2305('0x16')]);}})[_0x2305('0x18')](function(_0x5b39b7){logger[_0x2305('0x15')](_0x2305('0x10'),_0xa1e177,_0x5b39b7);_0x43274f(_0x5b39b7);});});}exports[_0x2305('0x19')]=function(_0x4c42b4){var _0x2263bc=this;return new Promise(function(_0x2ed132,_0x42ec2b){return db[_0x2305('0x1a')]['update'](_0x4c42b4[_0x2305('0x1b')],{'raw':_0x4c42b4[_0x2305('0x1c')]?_0x4c42b4[_0x2305('0x1c')][_0x2305('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c42b4[_0x2305('0x1c')]?_0x4c42b4['options'][_0x2305('0x1e')]||null:null,'attributes':_0x4c42b4[_0x2305('0x1c')]?_0x4c42b4[_0x2305('0x1c')][_0x2305('0x1f')]||null:null,'limit':_0x4c42b4['options']?_0x4c42b4['options'][_0x2305('0x20')]||null:null})[_0x2305('0xe')](function(_0x4103b3){logger['info'](_0x2305('0x19'),_0x4c42b4);logger['debug'](_0x2305('0x19'),_0x4c42b4,JSON['stringify'](_0x4103b3));_0x2ed132(_0x4103b3);})[_0x2305('0x18')](function(_0x328b12){logger['error'](_0x2305('0x19'),_0x328b12[_0x2305('0x16')],_0x4c42b4);_0x42ec2b(_0x2263bc['error'](0x1f4,_0x328b12[_0x2305('0x16')]));});});};exports[_0x2305('0x21')]=function(_0x1bf40e){return new Promise(function(_0x474369,_0x2eb747){return db[_0x2305('0x1a')][_0x2305('0x22')]({'where':_0x1bf40e['options']?_0x1bf40e[_0x2305('0x1c')][_0x2305('0x1e')]||null:null})[_0x2305('0xe')](function(_0x7440e0){if(_0x7440e0){return _0x7440e0[_0x2305('0x23')](_0x1bf40e[_0x2305('0x1b')]['ids'],_['omit'](_0x1bf40e[_0x2305('0x1b')],[_0x2305('0x24'),'id'])||{});}})[_0x2305('0x25')](function(_0x4a608f){logger[_0x2305('0xf')]('AddTags',_0x1bf40e);logger[_0x2305('0x12')](_0x2305('0x26'),_0x1bf40e,JSON[_0x2305('0x14')](_0x4a608f));_0x474369(_0x4a608f);})[_0x2305('0x18')](function(_0x5dd509){logger[_0x2305('0x15')](_0x2305('0x26'),_0x5dd509[_0x2305('0x16')],_0x1bf40e);_0x2eb747(_this[_0x2305('0x15')](0x1f4,_0x5dd509[_0x2305('0x16')]));});});}; \ No newline at end of file +var _0x1f93=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ChatInteraction','body','raw','options','where','attributes','limit','debug','UpdateChatInteraction','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis'];(function(_0x2181fc,_0x7283aa){var _0x315da1=function(_0x1df7ca){while(--_0x1df7ca){_0x2181fc['push'](_0x2181fc['shift']());}};_0x315da1(++_0x7283aa);}(_0x1f93,0x163));var _0x31f9=function(_0x3040ca,_0x29c0c2){_0x3040ca=_0x3040ca-0x0;var _0x3a2134=_0x1f93[_0x3040ca];return _0x3a2134;};'use strict';var _=require(_0x31f9('0x0'));var util=require(_0x31f9('0x1'));var moment=require(_0x31f9('0x2'));var BPromise=require(_0x31f9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31f9('0x4'));var db=require(_0x31f9('0x5'))['db'];var utils=require(_0x31f9('0x6'));var logger=require('../../config/logger')(_0x31f9('0x7'));var config=require(_0x31f9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x31f9('0x9')]['http']({'port':0x232a});config[_0x31f9('0xa')]=_[_0x31f9('0xb')](config[_0x31f9('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x31f9('0xc'))(new Redis(config[_0x31f9('0xa')]));require('./chatInteraction.socket')[_0x31f9('0xd')](socket);function respondWithRpcPromise(_0xc161ae,_0x124eb7,_0x26b90d){return new BPromise(function(_0x31759a,_0x416f48){return client['request'](_0xc161ae,_0x26b90d)[_0x31f9('0xe')](function(_0x514d73){logger[_0x31f9('0xf')](_0x31f9('0x10'),_0x124eb7,_0x31f9('0x11'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x124eb7,'request\x20sent',JSON[_0x31f9('0x12')](_0x514d73));if(_0x514d73[_0x31f9('0x13')]){if(_0x514d73['error'][_0x31f9('0x14')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x124eb7,_0x514d73[_0x31f9('0x13')][_0x31f9('0x15')]);return _0x416f48(_0x514d73['error'][_0x31f9('0x15')]);}logger[_0x31f9('0x13')](_0x31f9('0x10'),_0x124eb7,_0x514d73['error']['message']);return _0x31759a(_0x514d73['error']['message']);}else{logger[_0x31f9('0xf')](_0x31f9('0x10'),_0x124eb7,_0x31f9('0x11'));_0x31759a(_0x514d73[_0x31f9('0x16')][_0x31f9('0x15')]);}})[_0x31f9('0x17')](function(_0x8fa72a){logger['error'](_0x31f9('0x10'),_0x124eb7,_0x8fa72a);_0x416f48(_0x8fa72a);});});}exports['UpdateChatInteraction']=function(_0x32307d){var _0x34d8b0=this;return new Promise(function(_0x26a97f,_0x577363){return db[_0x31f9('0x18')]['update'](_0x32307d[_0x31f9('0x19')],{'raw':_0x32307d['options']?_0x32307d['options'][_0x31f9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32307d[_0x31f9('0x1b')]?_0x32307d[_0x31f9('0x1b')][_0x31f9('0x1c')]||null:null,'attributes':_0x32307d[_0x31f9('0x1b')]?_0x32307d[_0x31f9('0x1b')][_0x31f9('0x1d')]||null:null,'limit':_0x32307d[_0x31f9('0x1b')]?_0x32307d[_0x31f9('0x1b')][_0x31f9('0x1e')]||null:null})[_0x31f9('0xe')](function(_0x3a94dc){logger[_0x31f9('0xf')]('UpdateChatInteraction',_0x32307d);logger[_0x31f9('0x1f')](_0x31f9('0x20'),_0x32307d,JSON[_0x31f9('0x12')](_0x3a94dc));_0x26a97f(_0x3a94dc);})['catch'](function(_0x3a4722){logger[_0x31f9('0x13')](_0x31f9('0x20'),_0x3a4722[_0x31f9('0x15')],_0x32307d);_0x577363(_0x34d8b0['error'](0x1f4,_0x3a4722[_0x31f9('0x15')]));});});};exports[_0x31f9('0x21')]=function(_0x52e239){return new Promise(function(_0x176bae,_0x3c30ba){return db[_0x31f9('0x18')][_0x31f9('0x22')]({'where':_0x52e239[_0x31f9('0x1b')]?_0x52e239['options'][_0x31f9('0x1c')]||null:null})[_0x31f9('0xe')](function(_0x15803a){if(_0x15803a){return _0x15803a[_0x31f9('0x23')](_0x52e239[_0x31f9('0x19')][_0x31f9('0x24')],_[_0x31f9('0x25')](_0x52e239[_0x31f9('0x19')],['ids','id'])||{});}})[_0x31f9('0x26')](function(_0x3dadd0){logger[_0x31f9('0xf')](_0x31f9('0x27'),_0x52e239);logger['debug'](_0x31f9('0x27'),_0x52e239,JSON[_0x31f9('0x12')](_0x3dadd0));_0x176bae(_0x3dadd0);})[_0x31f9('0x17')](function(_0x585199){logger[_0x31f9('0x13')](_0x31f9('0x27'),_0x585199[_0x31f9('0x15')],_0x52e239);_0x3c30ba(_this['error'](0x1f4,_0x585199[_0x31f9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index b30f1e1..f0656c6 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 _0x9b27=['length','chatInteraction:','./chatInteraction.events','update','removeListener','register'];(function(_0x8efbee,_0x107af1){var _0x1e92c1=function(_0x3695c7){while(--_0x3695c7){_0x8efbee['push'](_0x8efbee['shift']());}};_0x1e92c1(++_0x107af1);}(_0x9b27,0x158));var _0x79b2=function(_0x441db3,_0x10f359){_0x441db3=_0x441db3-0x0;var _0x16c05d=_0x9b27[_0x441db3];return _0x16c05d;};'use strict';var ChatInteractionEvents=require(_0x79b2('0x0'));var events=['save','remove',_0x79b2('0x1')];function createListener(_0x2ca582,_0x452f51){return function(_0x152b01){_0x452f51['emit'](_0x2ca582,_0x152b01);};}function removeListener(_0x2de458,_0x6dcdf0){return function(){ChatInteractionEvents[_0x79b2('0x2')](_0x2de458,_0x6dcdf0);};}exports[_0x79b2('0x3')]=function(_0x713d0c){for(var _0x380e93=0x0,_0xc7611e=events[_0x79b2('0x4')];_0x380e93<_0xc7611e;_0x380e93++){var _0x3dd463=events[_0x380e93];var _0x1c37f7=createListener(_0x79b2('0x5')+_0x3dd463,_0x713d0c);ChatInteractionEvents['on'](_0x3dd463,_0x1c37f7);}}; \ No newline at end of file +var _0x34ff=['./chatInteraction.events','save','update','emit','register','length','chatInteraction:'];(function(_0x138d25,_0x3824e5){var _0x51d564=function(_0x520dbf){while(--_0x520dbf){_0x138d25['push'](_0x138d25['shift']());}};_0x51d564(++_0x3824e5);}(_0x34ff,0x1c0));var _0xf34f=function(_0x356ed2,_0x1f3607){_0x356ed2=_0x356ed2-0x0;var _0x4983be=_0x34ff[_0x356ed2];return _0x4983be;};'use strict';var ChatInteractionEvents=require(_0xf34f('0x0'));var events=[_0xf34f('0x1'),'remove',_0xf34f('0x2')];function createListener(_0x323a5c,_0x1712cb){return function(_0x37e152){_0x1712cb[_0xf34f('0x3')](_0x323a5c,_0x37e152);};}function removeListener(_0x37a6cd,_0xa04539){return function(){ChatInteractionEvents['removeListener'](_0x37a6cd,_0xa04539);};}exports[_0xf34f('0x4')]=function(_0x2ed655){for(var _0x1e8cd1=0x0,_0xfc9df0=events[_0xf34f('0x5')];_0x1e8cd1<_0xfc9df0;_0x1e8cd1++){var _0xc6cb6d=events[_0x1e8cd1];var _0x49659f=createListener(_0xf34f('0x6')+_0xc6cb6d,_0x2ed655);ChatInteractionEvents['on'](_0xc6cb6d,_0x49659f);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 1b78a10..79b8ef9 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 _0x3308=['/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','%s-%s','now','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./chatInteraction.controller','isAuthenticated','index','get','describe'];(function(_0x3cf080,_0x5e475f){var _0x1fac5f=function(_0x430849){while(--_0x430849){_0x3cf080['push'](_0x3cf080['shift']());}};_0x1fac5f(++_0x5e475f);}(_0x3308,0x160));var _0x8330=function(_0x54ee3c,_0x5bba4d){_0x54ee3c=_0x54ee3c-0x0;var _0x433ff4=_0x3308[_0x54ee3c];return _0x433ff4;};'use strict';var multer=require(_0x8330('0x0'));var util=require(_0x8330('0x1'));var path=require(_0x8330('0x2'));var timeout=require(_0x8330('0x3'));var express=require(_0x8330('0x4'));var router=express[_0x8330('0x5')]();var auth=require(_0x8330('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8330('0x7'));router['get']('/',auth[_0x8330('0x8')](),controller[_0x8330('0x9')]);router[_0x8330('0xa')]('/describe',auth[_0x8330('0x8')](),controller[_0x8330('0xb')]);router[_0x8330('0xa')](_0x8330('0xc'),auth[_0x8330('0xd')](),controller[_0x8330('0xe')]);router['get'](_0x8330('0xf'),auth[_0x8330('0xd')](),controller[_0x8330('0x10')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/my_messages',auth[_0x8330('0xd')](),controller['getMyMessages']);router[_0x8330('0xa')](_0x8330('0x11'),auth[_0x8330('0x8')](),controller[_0x8330('0x12')]);router[_0x8330('0x13')]('/',auth['isAuthenticated'](),controller[_0x8330('0x14')]);router['post'](_0x8330('0x15'),auth[_0x8330('0x8')](),controller[_0x8330('0x16')]);var upload=multer({'storage':multer[_0x8330('0x17')]({'destination':function(_0x432aca,_0x28998e,_0x2c3e2f){_0x2c3e2f(null,path[_0x8330('0x18')](config[_0x8330('0x19')],'server/files/attachments/'));},'filename':function(_0x27ebf8,_0x2486ba,_0x47895b){_0x47895b(null,util[_0x8330('0x1a')](_0x8330('0x1b'),Date[_0x8330('0x1c')](),_0x2486ba['originalname'][_0x8330('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x8330('0x1e'),upload[_0x8330('0x1f')](_0x8330('0x20')),controller[_0x8330('0x21')]);router['post'](_0x8330('0x22'),auth['isChatInteractionAuthorized'](),controller[_0x8330('0x23')]);router['post'](_0x8330('0x24'),auth[_0x8330('0x8')](),interaction[_0x8330('0x25')](_0x8330('0x26'),_0x8330('0x27')),controller[_0x8330('0x28')]);router[_0x8330('0x29')](_0x8330('0xc'),auth[_0x8330('0x8')](),interaction[_0x8330('0x25')](_0x8330('0x26'),'chatinteraction:update'),controller['update']);router['put'](_0x8330('0x2a'),controller[_0x8330('0x2b')]);router[_0x8330('0x29')](_0x8330('0x2c'),auth[_0x8330('0xd')](),controller[_0x8330('0x2d')]);router[_0x8330('0x29')]('/:id/close',controller[_0x8330('0x2e')]);router[_0x8330('0x2f')]('/:id',auth[_0x8330('0x8')](),interaction[_0x8330('0x25')](_0x8330('0x26'),_0x8330('0x30')),controller[_0x8330('0x31')]);router['delete'](_0x8330('0x24'),auth['isAuthenticated'](),controller[_0x8330('0x32')]);module[_0x8330('0x33')]=router; \ No newline at end of file +var _0x3cae=['/:id/attachment_download','getMessages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','now','originalname','replace','file','/:id/messages','addMessage','/:id/tags','tracked','chat','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','destroy','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInteraction.controller','isAuthenticated','get','/describe','/:id','isChatInteractionAuthorized','show'];(function(_0xb725be,_0x45bd01){var _0x2f2424=function(_0x2566ca){while(--_0x2566ca){_0xb725be['push'](_0xb725be['shift']());}};_0x2f2424(++_0x45bd01);}(_0x3cae,0x117));var _0xe3ca=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x3cae[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require(_0xe3ca('0x0'));var util=require(_0xe3ca('0x1'));var path=require(_0xe3ca('0x2'));var timeout=require(_0xe3ca('0x3'));var express=require(_0xe3ca('0x4'));var router=express[_0xe3ca('0x5')]();var auth=require(_0xe3ca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe3ca('0x7'));var controller=require(_0xe3ca('0x8'));router['get']('/',auth[_0xe3ca('0x9')](),controller['index']);router[_0xe3ca('0xa')](_0xe3ca('0xb'),auth[_0xe3ca('0x9')](),controller['describe']);router[_0xe3ca('0xa')](_0xe3ca('0xc'),auth[_0xe3ca('0xd')](),controller[_0xe3ca('0xe')]);router[_0xe3ca('0xa')](_0xe3ca('0xf'),auth[_0xe3ca('0xd')](),controller['attachmentDownload']);router[_0xe3ca('0xa')]('/:id/messages',auth[_0xe3ca('0x9')](),controller[_0xe3ca('0x10')]);router[_0xe3ca('0xa')](_0xe3ca('0x11'),auth[_0xe3ca('0xd')](),controller['getMyMessages']);router['get'](_0xe3ca('0x12'),auth['isAuthenticated'](),controller[_0xe3ca('0x13')]);router[_0xe3ca('0x14')]('/',auth['isAuthenticated'](),controller[_0xe3ca('0x15')]);router[_0xe3ca('0x14')](_0xe3ca('0x16'),auth[_0xe3ca('0x9')](),controller[_0xe3ca('0x17')]);var upload=multer({'storage':multer[_0xe3ca('0x18')]({'destination':function(_0x884795,_0x337b6c,_0x5f2e2d){_0x5f2e2d(null,path['join'](config[_0xe3ca('0x19')],_0xe3ca('0x1a')));},'filename':function(_0x8c2e12,_0x3dae55,_0x1dd153){_0x1dd153(null,util[_0xe3ca('0x1b')]('%s-%s',Date[_0xe3ca('0x1c')](),_0x3dae55[_0xe3ca('0x1d')][_0xe3ca('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload['single'](_0xe3ca('0x1f')),controller['attachmentUpload']);router['post'](_0xe3ca('0x20'),auth[_0xe3ca('0xd')](),controller[_0xe3ca('0x21')]);router[_0xe3ca('0x14')](_0xe3ca('0x22'),auth['isAuthenticated'](),interaction[_0xe3ca('0x23')](_0xe3ca('0x24'),'chatinteraction:addtags'),controller[_0xe3ca('0x25')]);router[_0xe3ca('0x26')](_0xe3ca('0xc'),auth[_0xe3ca('0x9')](),interaction[_0xe3ca('0x23')](_0xe3ca('0x24'),_0xe3ca('0x27')),controller[_0xe3ca('0x28')]);router[_0xe3ca('0x26')](_0xe3ca('0x29'),controller[_0xe3ca('0x2a')]);router['put'](_0xe3ca('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0xe3ca('0x2c')]);router[_0xe3ca('0x26')](_0xe3ca('0x2d'),controller[_0xe3ca('0x2e')]);router['delete']('/:id',auth[_0xe3ca('0x9')](),interaction[_0xe3ca('0x23')](_0xe3ca('0x24'),'chatinteraction:destroy'),controller[_0xe3ca('0x2f')]);router[_0xe3ca('0x30')](_0xe3ca('0x22'),auth[_0xe3ca('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index fd7822c..dfe0862 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 _0x1a85=['BOOLEAN','TEXT','medium'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0x1a85,0x178));var _0x51a8=function(_0x558010,_0x4a71e6){_0x558010=_0x558010-0x0;var _0x3b9dba=_0x1a85[_0x558010];return _0x3b9dba;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x51a8('0x0')](_0x51a8('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5f66=['exports','medium','BOOLEAN','INTEGER'];(function(_0x4a4e0d,_0x1971fe){var _0x12c311=function(_0x16413d){while(--_0x16413d){_0x4a4e0d['push'](_0x4a4e0d['shift']());}};_0x12c311(++_0x1971fe);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x65f6('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 0863235..1b1e877 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 _0x9026=['lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','userpic','internal','lastLoginAt','allowmessenger','showWebBar','sort','-online','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','length','role','agent','resourceId','push','FromId','read','-createdAt','all','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','end','json','count','offset','limit','status','reject','save','update','then','name','send','index','ChatInternalMessage','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','pick','filter','where','options','includeAll','include','findAll','rows','catch','show','merge','find','create','body','params','describe','messages','lastMessageAt'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x9026,0x1ae));var _0x6902=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x9026[_0x4fbfd9];return _0x31dc94;};'use strict';var pdf=require(_0x6902('0x0'));var emlformat=require(_0x6902('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6902('0x2'));var rp=require(_0x6902('0x3'));var moment=require(_0x6902('0x4'));var BPromise=require(_0x6902('0x5'));var Mustache=require('mustache');var util=require(_0x6902('0x6'));var path=require('path');var sox=require(_0x6902('0x7'));var csv=require(_0x6902('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6902('0x9'));var crypto=require(_0x6902('0xa'));var jsforce=require(_0x6902('0xb'));var deskjs=require(_0x6902('0xc'));var toCsv=require(_0x6902('0x8'));var querystring=require(_0x6902('0xd'));var Papa=require('papaparse');var Redis=require(_0x6902('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6902('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6902('0x10'));var logger=require('../../config/logger')(_0x6902('0x11'));var utils=require(_0x6902('0x12'));var config=require(_0x6902('0x13'));var db=require('../../mysqldb')['db'];config[_0x6902('0x14')]=_['defaults'](config[_0x6902('0x14')],{'host':_0x6902('0x15'),'port':0x18eb});var socket=require(_0x6902('0x16'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x6902('0x17')](socket);function respondWithStatusCode(_0xeb671,_0x5da2e9){_0x5da2e9=_0x5da2e9||0xcc;return function(_0x4196ef){if(_0x4196ef){return _0xeb671[_0x6902('0x18')](_0x5da2e9);}return _0xeb671['status'](_0x5da2e9)[_0x6902('0x19')]();};}function respondWithResult(_0x493b66,_0x46e930){_0x46e930=_0x46e930||0xc8;return function(_0x23545b){if(_0x23545b){return _0x493b66['status'](_0x46e930)[_0x6902('0x1a')](_0x23545b);}};}function respondWithFilteredResult(_0x4474ce,_0x38542d){return function(_0x67d05b){if(_0x67d05b){var _0x47f775=_0x67d05b[_0x6902('0x1b')],_0x284597=_0x38542d[_0x6902('0x1c')],_0x4bc5cd=_0x38542d[_0x6902('0x1c')]+_0x38542d[_0x6902('0x1d')],_0xaddc7a;if(_0x4bc5cd>=_0x47f775){_0x4bc5cd=_0x47f775;_0xaddc7a=0xc8;}else{_0xaddc7a=0xce;}_0x4474ce[_0x6902('0x1e')](_0xaddc7a);return _0x4474ce['set']('Content-Range',_0x284597+'-'+_0x4bc5cd+'/'+_0x47f775)['json'](_0x67d05b);}return null;};}function patchUpdates(_0x125a12){return function(_0x56aa20){try{jsonpatch['apply'](_0x56aa20,_0x125a12,!![]);}catch(_0x4aa2e9){return BPromise[_0x6902('0x1f')](_0x4aa2e9);}return _0x56aa20[_0x6902('0x20')]();};}function saveUpdates(_0x26d041,_0x32e0ea){return function(_0x7e3da9){if(_0x7e3da9){return _0x7e3da9[_0x6902('0x21')](_0x26d041)['then'](function(_0x59a68d){return _0x59a68d;});}return null;};}function removeEntity(_0x55cf7f,_0x1ade6e){return function(_0x214d6e){if(_0x214d6e){return _0x214d6e['destroy']()[_0x6902('0x22')](function(){_0x55cf7f['status'](0xcc)[_0x6902('0x19')]();});}};}function handleEntityNotFound(_0x16d568,_0xaf8a05){return function(_0x3438b7){if(!_0x3438b7){_0x16d568[_0x6902('0x18')](0x194);}return _0x3438b7;};}function handleError(_0x260a2a,_0x16cf50){_0x16cf50=_0x16cf50||0x1f4;return function(_0x3f3339){logger['error'](_0x3f3339['stack']);if(_0x3f3339[_0x6902('0x23')]){delete _0x3f3339[_0x6902('0x23')];}_0x260a2a[_0x6902('0x1e')](_0x16cf50)[_0x6902('0x24')](_0x3f3339);};}exports[_0x6902('0x25')]=function(_0x3e0eef,_0x5310b7){var _0x3cdd72={},_0xbb5b0a={},_0x11770a={'count':0x0,'rows':[]};var _0x525cf1=_['map'](db[_0x6902('0x26')]['rawAttributes'],function(_0x2cc7a1){return{'name':_0x2cc7a1[_0x6902('0x27')],'type':_0x2cc7a1[_0x6902('0x28')][_0x6902('0x29')]};});_0xbb5b0a[_0x6902('0x2a')]=_[_0x6902('0x2b')](_0x525cf1,_0x6902('0x23'));_0xbb5b0a[_0x6902('0x2c')]=_[_0x6902('0x2d')](_0x3e0eef[_0x6902('0x2c')]);_0xbb5b0a[_0x6902('0x2e')]=_[_0x6902('0x2f')](_0xbb5b0a[_0x6902('0x2a')],_0xbb5b0a[_0x6902('0x2c')]);_0x3cdd72[_0x6902('0x30')]=_['intersection'](_0xbb5b0a[_0x6902('0x2a')],qs[_0x6902('0x31')](_0x3e0eef[_0x6902('0x2c')]['fields']));_0x3cdd72['attributes']=_0x3cdd72[_0x6902('0x30')]['length']?_0x3cdd72[_0x6902('0x30')]:_0xbb5b0a['model'];if(!_0x3e0eef[_0x6902('0x2c')]['hasOwnProperty'](_0x6902('0x32'))){_0x3cdd72[_0x6902('0x1d')]=qs[_0x6902('0x1d')](_0x3e0eef[_0x6902('0x2c')][_0x6902('0x1d')]);_0x3cdd72['offset']=qs['offset'](_0x3e0eef['query']['offset']);}_0x3cdd72[_0x6902('0x33')]=qs['sort'](_0x3e0eef[_0x6902('0x2c')]['sort']);_0x3cdd72['where']=qs[_0x6902('0x2e')](_[_0x6902('0x34')](_0x3e0eef[_0x6902('0x2c')],_0xbb5b0a[_0x6902('0x2e')]),_0x525cf1);if(_0x3e0eef[_0x6902('0x2c')][_0x6902('0x35')]){_0x3cdd72[_0x6902('0x36')]=_['merge'](_0x3cdd72[_0x6902('0x36')],{'$or':_[_0x6902('0x2b')](_0x525cf1,function(_0x4fb0b9){if(_0x4fb0b9[_0x6902('0x28')]!=='VIRTUAL'){var _0x523c43={};_0x523c43[_0x4fb0b9[_0x6902('0x23')]]={'$like':'%'+_0x3e0eef[_0x6902('0x2c')]['filter']+'%'};return _0x523c43;}})});}_0x3cdd72=_['merge']({},_0x3cdd72,_0x3e0eef[_0x6902('0x37')]);var _0xfc06a5={'where':_0x3cdd72[_0x6902('0x36')]};return db[_0x6902('0x26')][_0x6902('0x1b')](_0xfc06a5)[_0x6902('0x22')](function(_0xf2be27){_0x11770a['count']=_0xf2be27;if(_0x3e0eef[_0x6902('0x2c')][_0x6902('0x38')]){_0x3cdd72[_0x6902('0x39')]=[{'all':!![]}];}return db[_0x6902('0x26')][_0x6902('0x3a')](_0x3cdd72);})['then'](function(_0x5641ae){_0x11770a[_0x6902('0x3b')]=_0x5641ae;return _0x11770a;})[_0x6902('0x22')](respondWithFilteredResult(_0x5310b7,_0x3cdd72))[_0x6902('0x3c')](handleError(_0x5310b7,null));};exports[_0x6902('0x3d')]=function(_0x4d013b,_0x155190){var _0x473916={'raw':!![],'where':{'id':_0x4d013b['params']['id']}},_0x37c1a5={};_0x37c1a5[_0x6902('0x2a')]=_[_0x6902('0x2d')](db[_0x6902('0x26')]['rawAttributes']);_0x37c1a5[_0x6902('0x2c')]=_[_0x6902('0x2d')](_0x4d013b[_0x6902('0x2c')]);_0x37c1a5[_0x6902('0x2e')]=_[_0x6902('0x2f')](_0x37c1a5['model'],_0x37c1a5[_0x6902('0x2c')]);_0x473916[_0x6902('0x30')]=_['intersection'](_0x37c1a5[_0x6902('0x2a')],qs[_0x6902('0x31')](_0x4d013b['query'][_0x6902('0x31')]));_0x473916[_0x6902('0x30')]=_0x473916['attributes']['length']?_0x473916[_0x6902('0x30')]:_0x37c1a5['model'];if(_0x4d013b[_0x6902('0x2c')][_0x6902('0x38')]){_0x473916[_0x6902('0x39')]=[{'all':!![]}];}_0x473916=_[_0x6902('0x3e')]({},_0x473916,_0x4d013b[_0x6902('0x37')]);return db['ChatInternalMessage'][_0x6902('0x3f')](_0x473916)[_0x6902('0x22')](handleEntityNotFound(_0x155190,null))[_0x6902('0x22')](respondWithResult(_0x155190,null))[_0x6902('0x3c')](handleError(_0x155190,null));};exports[_0x6902('0x40')]=function(_0x835fb2,_0x2ef80f){return db[_0x6902('0x26')]['create'](_0x835fb2[_0x6902('0x41')],{})[_0x6902('0x22')](respondWithResult(_0x2ef80f,0xc9))[_0x6902('0x3c')](handleError(_0x2ef80f,null));};exports[_0x6902('0x21')]=function(_0x32d0a3,_0x2a2007){if(_0x32d0a3[_0x6902('0x41')]['id']){delete _0x32d0a3[_0x6902('0x41')]['id'];}return db[_0x6902('0x26')]['find']({'where':{'id':_0x32d0a3['params']['id']}})[_0x6902('0x22')](handleEntityNotFound(_0x2a2007,null))[_0x6902('0x22')](saveUpdates(_0x32d0a3[_0x6902('0x41')],null))['then'](respondWithResult(_0x2a2007,null))[_0x6902('0x3c')](handleError(_0x2a2007,null));};exports['destroy']=function(_0x3f97c6,_0x2fde7b){return db[_0x6902('0x26')]['find']({'where':{'id':_0x3f97c6[_0x6902('0x42')]['id']}})['then'](handleEntityNotFound(_0x2fde7b,null))['then'](removeEntity(_0x2fde7b,null))[_0x6902('0x3c')](handleError(_0x2fde7b,null));};exports[_0x6902('0x43')]=function(_0x452bb6,_0x24e7af){return db[_0x6902('0x26')]['describe']()[_0x6902('0x22')](respondWithResult(_0x24e7af,null))[_0x6902('0x3c')](handleError(_0x24e7af,null));};function wrapUser(_0x35cfaa){return function(_0x54db68){var _0x290d78=_0x35cfaa['get']({'plain':!![]});_0x290d78[_0x6902('0x44')]=[];if(_0x54db68){_0x290d78[_0x6902('0x45')]=_0x54db68['createdAt'];_0x290d78[_0x6902('0x46')]=_0x54db68;}else{_0x290d78['lastMessageAt']=moment(0x0)[_0x6902('0x47')](_0x6902('0x48'));_0x290d78[_0x6902('0x46')]={};}return _0x290d78;};}exports[_0x6902('0x49')]=function(_0x110614,_0x479daf,_0x1c678c){var _0x50492e=[];return db[_0x6902('0x4a')][_0x6902('0x3a')]({'where':{'role':['agent',_0x6902('0x4b'),_0x6902('0x4c')]},'attributes':['id','fullname','name','role',_0x6902('0x4d'),_0x6902('0x4e'),'online',_0x6902('0x4f'),_0x6902('0x50'),_0x6902('0x51')],'order':qs[_0x6902('0x52')](_0x6902('0x53')),'include':[{'model':db['VoiceQueue'],'as':_0x6902('0x54'),'attributes':['id','name',_0x6902('0x28')],'through':{'attributes':[]}}]})['then'](function(_0x1b4015){if(_0x1b4015){var _0x25e87c=_0x110614[_0x6902('0x4c')][_0x6902('0x55')]({'plain':!![]});if(!_0x25e87c)throw new Error(_0x6902('0x56'));if(_0x25e87c['role']===_0x6902('0x4c')){return db[_0x6902('0x57')]['find']({'where':{'name':_0x6902('0x58'),'userProfileId':_0x25e87c[_0x6902('0x59')]},'raw':!![]})[_0x6902('0x22')](function(_0x5193db){if(_0x5193db){if(_0x5193db[_0x6902('0x5a')]===0x0){return db['UserProfileResource'][_0x6902('0x3a')]({'where':{'sectionId':_0x5193db['id']},'raw':!![]})[_0x6902('0x22')](function(_0x5c4382){var _0x41534e=[];if(_['isEmpty'](_0x5c4382)){_0x41534e=_[_0x6902('0x35')](_0x1b4015,function(_0x382ee2){if(_0x382ee2['role']!=='agent'){return _0x382ee2;}});return _0x41534e;}else{for(var _0x56bb7e=0x0;_0x56bb7e<_0x1b4015[_0x6902('0x5b')];_0x56bb7e++){var _0x39b68e=_0x1b4015[_0x56bb7e];if(_0x39b68e[_0x6902('0x5c')]===_0x6902('0x5d')){var _0x31df53=_['find'](_0x5c4382,function(_0x18ba32){return _0x18ba32[_0x6902('0x5e')]===_0x39b68e['id'];});if(_0x31df53)_0x41534e[_0x6902('0x5f')](_0x39b68e);}else{_0x41534e[_0x6902('0x5f')](_0x39b68e);}}return _0x41534e;}});}else{return _0x1b4015;}}else{var _0x369796=_[_0x6902('0x35')](_0x1b4015,function(_0x1429dc){if(_0x1429dc[_0x6902('0x5c')]!==_0x6902('0x5d')){return _0x1429dc;}});return _0x369796;}});}else{return _0x1b4015;}}})[_0x6902('0x22')](function(_0x4b5f15){var _0x54a28d=[];if(_0x4b5f15){_0x50492e=_0x4b5f15;for(var _0x48ba60=0x0;_0x48ba60<_0x4b5f15[_0x6902('0x5b')];_0x48ba60+=0x1){_0x50492e[_0x48ba60]['messages']=[];_0x54a28d[_0x6902('0x5f')](db[_0x6902('0x26')][_0x6902('0x3f')]({'where':{'FromId':[_0x110614[_0x6902('0x4c')]['id'],_0x4b5f15[_0x48ba60]['id']],'ToId':[_0x110614[_0x6902('0x4c')]['id'],_0x4b5f15[_0x48ba60]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x6902('0x60'),'ToId',_0x6902('0x61'),'body'],'order':qs['sort'](_0x6902('0x62')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x6902('0x22')](wrapUser(_0x4b5f15[_0x48ba60])));}return BPromise[_0x6902('0x63')](_0x54a28d);}return[];})['then'](function(_0x57b349){return{'rows':_0x57b349,'count':_0x57b349[_0x6902('0x5b')]};})[_0x6902('0x22')](respondWithResult(_0x479daf,null))[_0x6902('0x3c')](handleError(_0x479daf,null));}; \ No newline at end of file +var _0x962a=['jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','query','keys','filters','attributes','intersection','model','length','hasOwnProperty','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','ChatInternalMessage','findAll','params','fields','catch','create','body','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','User','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','ejs','lodash','squel','crypto'];(function(_0x2facc6,_0x40787d){var _0x21a9af=function(_0x192b10){while(--_0x192b10){_0x2facc6['push'](_0x2facc6['shift']());}};_0x21a9af(++_0x40787d);}(_0x962a,0x139));var _0xa962=function(_0x2304e5,_0x1697c0){_0x2304e5=_0x2304e5-0x0;var _0x5ed68d=_0x962a[_0x2304e5];return _0x5ed68d;};'use strict';var pdf=require(_0xa962('0x0'));var emlformat=require(_0xa962('0x1'));var rimraf=require(_0xa962('0x2'));var zipdir=require(_0xa962('0x3'));var jsonpatch=require(_0xa962('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa962('0x5'));var Mustache=require('mustache');var util=require(_0xa962('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa962('0x7'));var fs=require('fs');var _=require(_0xa962('0x8'));var squel=require(_0xa962('0x9'));var crypto=require(_0xa962('0xa'));var jsforce=require(_0xa962('0xb'));var deskjs=require(_0xa962('0xc'));var toCsv=require(_0xa962('0xd'));var querystring=require('querystring');var Papa=require(_0xa962('0xe'));var Redis=require(_0xa962('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa962('0x10'));var as=require(_0xa962('0x11'));var hardwareService=require(_0xa962('0x12'));var logger=require(_0xa962('0x13'))(_0xa962('0x14'));var utils=require(_0xa962('0x15'));var config=require(_0xa962('0x16'));var db=require(_0xa962('0x17'))['db'];config[_0xa962('0x18')]=_[_0xa962('0x19')](config[_0xa962('0x18')],{'host':_0xa962('0x1a'),'port':0x18eb});var socket=require(_0xa962('0x1b'))(new Redis(config[_0xa962('0x18')]));require(_0xa962('0x1c'))['register'](socket);function respondWithStatusCode(_0x4a428f,_0x4834dc){_0x4834dc=_0x4834dc||0xcc;return function(_0x550db5){if(_0x550db5){return _0x4a428f[_0xa962('0x1d')](_0x4834dc);}return _0x4a428f[_0xa962('0x1e')](_0x4834dc)[_0xa962('0x1f')]();};}function respondWithResult(_0x31f6a9,_0x10dfb9){_0x10dfb9=_0x10dfb9||0xc8;return function(_0x327399){if(_0x327399){return _0x31f6a9['status'](_0x10dfb9)[_0xa962('0x20')](_0x327399);}};}function respondWithFilteredResult(_0x6517ad,_0x145b8a){return function(_0x2d68b3){if(_0x2d68b3){var _0x888252=_0x2d68b3[_0xa962('0x21')],_0x46adaa=_0x145b8a[_0xa962('0x22')],_0x248a2a=_0x145b8a[_0xa962('0x22')]+_0x145b8a[_0xa962('0x23')],_0x4387f4;if(_0x248a2a>=_0x888252){_0x248a2a=_0x888252;_0x4387f4=0xc8;}else{_0x4387f4=0xce;}_0x6517ad['status'](_0x4387f4);return _0x6517ad[_0xa962('0x24')](_0xa962('0x25'),_0x46adaa+'-'+_0x248a2a+'/'+_0x888252)[_0xa962('0x20')](_0x2d68b3);}return null;};}function patchUpdates(_0x16ea84){return function(_0x2d8721){try{jsonpatch['apply'](_0x2d8721,_0x16ea84,!![]);}catch(_0x4c5840){return BPromise[_0xa962('0x26')](_0x4c5840);}return _0x2d8721[_0xa962('0x27')]();};}function saveUpdates(_0x59c5d1,_0x477a31){return function(_0x4a9abe){if(_0x4a9abe){return _0x4a9abe[_0xa962('0x28')](_0x59c5d1)[_0xa962('0x29')](function(_0x27c6cf){return _0x27c6cf;});}return null;};}function removeEntity(_0x164e90,_0x5f90f2){return function(_0x41767d){if(_0x41767d){return _0x41767d[_0xa962('0x2a')]()[_0xa962('0x29')](function(){_0x164e90[_0xa962('0x1e')](0xcc)[_0xa962('0x1f')]();});}};}function handleEntityNotFound(_0x4cce95,_0x3feae2){return function(_0x5692ca){if(!_0x5692ca){_0x4cce95[_0xa962('0x1d')](0x194);}return _0x5692ca;};}function handleError(_0x18b359,_0x5cef2d){_0x5cef2d=_0x5cef2d||0x1f4;return function(_0x28deaf){logger[_0xa962('0x2b')](_0x28deaf[_0xa962('0x2c')]);if(_0x28deaf[_0xa962('0x2d')]){delete _0x28deaf[_0xa962('0x2d')];}_0x18b359[_0xa962('0x1e')](_0x5cef2d)[_0xa962('0x2e')](_0x28deaf);};}exports[_0xa962('0x2f')]=function(_0x85dd4,_0xaee637){var _0x15333d={},_0x2b2698={},_0x3b5c4b={'count':0x0,'rows':[]};var _0xaed7a2=_[_0xa962('0x30')](db['ChatInternalMessage'][_0xa962('0x31')],function(_0x298b5a){return{'name':_0x298b5a['fieldName'],'type':_0x298b5a[_0xa962('0x32')]['key']};});_0x2b2698['model']=_[_0xa962('0x30')](_0xaed7a2,'name');_0x2b2698[_0xa962('0x33')]=_[_0xa962('0x34')](_0x85dd4[_0xa962('0x33')]);_0x2b2698[_0xa962('0x35')]=_['intersection'](_0x2b2698['model'],_0x2b2698[_0xa962('0x33')]);_0x15333d[_0xa962('0x36')]=_[_0xa962('0x37')](_0x2b2698[_0xa962('0x38')],qs['fields'](_0x85dd4[_0xa962('0x33')]['fields']));_0x15333d[_0xa962('0x36')]=_0x15333d['attributes'][_0xa962('0x39')]?_0x15333d[_0xa962('0x36')]:_0x2b2698[_0xa962('0x38')];if(!_0x85dd4[_0xa962('0x33')][_0xa962('0x3a')]('nolimit')){_0x15333d['limit']=qs[_0xa962('0x23')](_0x85dd4[_0xa962('0x33')]['limit']);_0x15333d[_0xa962('0x22')]=qs['offset'](_0x85dd4[_0xa962('0x33')][_0xa962('0x22')]);}_0x15333d['order']=qs[_0xa962('0x3b')](_0x85dd4[_0xa962('0x33')]['sort']);_0x15333d['where']=qs['filters'](_[_0xa962('0x3c')](_0x85dd4[_0xa962('0x33')],_0x2b2698[_0xa962('0x35')]),_0xaed7a2);if(_0x85dd4[_0xa962('0x33')][_0xa962('0x3d')]){_0x15333d['where']=_[_0xa962('0x3e')](_0x15333d[_0xa962('0x3f')],{'$or':_[_0xa962('0x30')](_0xaed7a2,function(_0x44388d){if(_0x44388d[_0xa962('0x32')]!==_0xa962('0x40')){var _0x343be6={};_0x343be6[_0x44388d['name']]={'$like':'%'+_0x85dd4[_0xa962('0x33')][_0xa962('0x3d')]+'%'};return _0x343be6;}})});}_0x15333d=_['merge']({},_0x15333d,_0x85dd4[_0xa962('0x41')]);var _0x1ad626={'where':_0x15333d[_0xa962('0x3f')]};return db['ChatInternalMessage'][_0xa962('0x21')](_0x1ad626)['then'](function(_0x1e88d6){_0x3b5c4b[_0xa962('0x21')]=_0x1e88d6;if(_0x85dd4['query'][_0xa962('0x42')]){_0x15333d[_0xa962('0x43')]=[{'all':!![]}];}return db[_0xa962('0x44')][_0xa962('0x45')](_0x15333d);})[_0xa962('0x29')](function(_0xf07a87){_0x3b5c4b['rows']=_0xf07a87;return _0x3b5c4b;})['then'](respondWithFilteredResult(_0xaee637,_0x15333d))['catch'](handleError(_0xaee637,null));};exports['show']=function(_0x2d96cd,_0x143f1c){var _0x3fd48c={'raw':!![],'where':{'id':_0x2d96cd[_0xa962('0x46')]['id']}},_0x12c048={};_0x12c048['model']=_[_0xa962('0x34')](db[_0xa962('0x44')][_0xa962('0x31')]);_0x12c048[_0xa962('0x33')]=_[_0xa962('0x34')](_0x2d96cd[_0xa962('0x33')]);_0x12c048['filters']=_[_0xa962('0x37')](_0x12c048[_0xa962('0x38')],_0x12c048['query']);_0x3fd48c[_0xa962('0x36')]=_[_0xa962('0x37')](_0x12c048[_0xa962('0x38')],qs[_0xa962('0x47')](_0x2d96cd[_0xa962('0x33')][_0xa962('0x47')]));_0x3fd48c[_0xa962('0x36')]=_0x3fd48c[_0xa962('0x36')][_0xa962('0x39')]?_0x3fd48c[_0xa962('0x36')]:_0x12c048['model'];if(_0x2d96cd[_0xa962('0x33')][_0xa962('0x42')]){_0x3fd48c[_0xa962('0x43')]=[{'all':!![]}];}_0x3fd48c=_['merge']({},_0x3fd48c,_0x2d96cd[_0xa962('0x41')]);return db[_0xa962('0x44')]['find'](_0x3fd48c)[_0xa962('0x29')](handleEntityNotFound(_0x143f1c,null))['then'](respondWithResult(_0x143f1c,null))[_0xa962('0x48')](handleError(_0x143f1c,null));};exports[_0xa962('0x49')]=function(_0x4b08c9,_0x253053){return db[_0xa962('0x44')][_0xa962('0x49')](_0x4b08c9[_0xa962('0x4a')],{})[_0xa962('0x29')](respondWithResult(_0x253053,0xc9))['catch'](handleError(_0x253053,null));};exports[_0xa962('0x28')]=function(_0x9e3d79,_0x5f510e){if(_0x9e3d79['body']['id']){delete _0x9e3d79[_0xa962('0x4a')]['id'];}return db[_0xa962('0x44')][_0xa962('0x4b')]({'where':{'id':_0x9e3d79[_0xa962('0x46')]['id']}})['then'](handleEntityNotFound(_0x5f510e,null))[_0xa962('0x29')](saveUpdates(_0x9e3d79[_0xa962('0x4a')],null))[_0xa962('0x29')](respondWithResult(_0x5f510e,null))[_0xa962('0x48')](handleError(_0x5f510e,null));};exports[_0xa962('0x2a')]=function(_0x1472f2,_0x259375){return db['ChatInternalMessage'][_0xa962('0x4b')]({'where':{'id':_0x1472f2['params']['id']}})[_0xa962('0x29')](handleEntityNotFound(_0x259375,null))['then'](removeEntity(_0x259375,null))[_0xa962('0x48')](handleError(_0x259375,null));};exports[_0xa962('0x4c')]=function(_0xde3b62,_0x706d90){return db[_0xa962('0x44')][_0xa962('0x4c')]()[_0xa962('0x29')](respondWithResult(_0x706d90,null))[_0xa962('0x48')](handleError(_0x706d90,null));};function wrapUser(_0x13e6dd){return function(_0x1fa773){var _0xcbb958=_0x13e6dd[_0xa962('0x4d')]({'plain':!![]});_0xcbb958[_0xa962('0x4e')]=[];if(_0x1fa773){_0xcbb958[_0xa962('0x4f')]=_0x1fa773[_0xa962('0x50')];_0xcbb958[_0xa962('0x51')]=_0x1fa773;}else{_0xcbb958[_0xa962('0x4f')]=moment(0x0)[_0xa962('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0xcbb958['lastMessage']={};}return _0xcbb958;};}exports['getUsers']=function(_0x57c69e,_0x4f6a60,_0x34d0ce){var _0x43dbae=[];return db[_0xa962('0x53')][_0xa962('0x45')]({'where':{'role':['agent',_0xa962('0x54'),_0xa962('0x55')]},'attributes':['id',_0xa962('0x56'),_0xa962('0x2d'),_0xa962('0x57'),_0xa962('0x58'),_0xa962('0x59'),_0xa962('0x5a'),_0xa962('0x5b'),_0xa962('0x5c'),_0xa962('0x5d')],'order':qs['sort'](_0xa962('0x5e')),'include':[{'model':db[_0xa962('0x5f')],'as':_0xa962('0x60'),'attributes':['id',_0xa962('0x2d'),_0xa962('0x32')],'through':{'attributes':[]}}]})[_0xa962('0x29')](function(_0x455ffd){if(_0x455ffd){var _0x2a0eae=_0x57c69e[_0xa962('0x55')]['get']({'plain':!![]});if(!_0x2a0eae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a0eae[_0xa962('0x57')]===_0xa962('0x55')){return db[_0xa962('0x61')][_0xa962('0x4b')]({'where':{'name':_0xa962('0x62'),'userProfileId':_0x2a0eae[_0xa962('0x63')]},'raw':!![]})['then'](function(_0x530ac9){if(_0x530ac9){if(_0x530ac9[_0xa962('0x64')]===0x0){return db[_0xa962('0x65')][_0xa962('0x45')]({'where':{'sectionId':_0x530ac9['id']},'raw':!![]})[_0xa962('0x29')](function(_0x428cd9){var _0x41a5d5=[];if(_[_0xa962('0x66')](_0x428cd9)){_0x41a5d5=_['filter'](_0x455ffd,function(_0x285fcc){if(_0x285fcc[_0xa962('0x57')]!==_0xa962('0x67')){return _0x285fcc;}});return _0x41a5d5;}else{for(var _0x2c67de=0x0;_0x2c67de<_0x455ffd[_0xa962('0x39')];_0x2c67de++){var _0x87f3ef=_0x455ffd[_0x2c67de];if(_0x87f3ef[_0xa962('0x57')]==='agent'){var _0x3bff88=_[_0xa962('0x4b')](_0x428cd9,function(_0xdecb58){return _0xdecb58[_0xa962('0x68')]===_0x87f3ef['id'];});if(_0x3bff88)_0x41a5d5[_0xa962('0x69')](_0x87f3ef);}else{_0x41a5d5[_0xa962('0x69')](_0x87f3ef);}}return _0x41a5d5;}});}else{return _0x455ffd;}}else{var _0x375d41=_[_0xa962('0x3d')](_0x455ffd,function(_0x46d60f){if(_0x46d60f['role']!==_0xa962('0x67')){return _0x46d60f;}});return _0x375d41;}});}else{return _0x455ffd;}}})[_0xa962('0x29')](function(_0x5bfd77){var _0x2bb4cc=[];if(_0x5bfd77){_0x43dbae=_0x5bfd77;for(var _0x8ea42a=0x0;_0x8ea42a<_0x5bfd77[_0xa962('0x39')];_0x8ea42a+=0x1){_0x43dbae[_0x8ea42a][_0xa962('0x4e')]=[];_0x2bb4cc[_0xa962('0x69')](db[_0xa962('0x44')]['find']({'where':{'FromId':[_0x57c69e[_0xa962('0x55')]['id'],_0x5bfd77[_0x8ea42a]['id']],'ToId':[_0x57c69e[_0xa962('0x55')]['id'],_0x5bfd77[_0x8ea42a]['id']],'ChatGroupId':null},'attributes':['id',_0xa962('0x50'),_0xa962('0x6a'),'ToId','read','body'],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa962('0x29')](wrapUser(_0x5bfd77[_0x8ea42a])));}return BPromise[_0xa962('0x6b')](_0x2bb4cc);}return[];})[_0xa962('0x29')](function(_0x4ea8e6){return{'rows':_0x4ea8e6,'count':_0x4ea8e6[_0xa962('0x39')]};})[_0xa962('0x29')](respondWithResult(_0x4f6a60,null))[_0xa962('0x48')](handleError(_0x4f6a60,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 7b3cb1e..cf6d8e7 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 _0xbfda=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatInternalMessage','save'];(function(_0x30d09f,_0x2ac445){var _0x522d91=function(_0x3c7ccb){while(--_0x3c7ccb){_0x30d09f['push'](_0x30d09f['shift']());}};_0x522d91(++_0x2ac445);}(_0xbfda,0x1dc));var _0xabfd=function(_0xe6f4ef,_0x4e34cc){_0xe6f4ef=_0xe6f4ef-0x0;var _0x4f3447=_0xbfda[_0xe6f4ef];return _0x4f3447;};'use strict';var EventEmitter=require(_0xabfd('0x0'));var ChatInternalMessage=require(_0xabfd('0x1'))['db'][_0xabfd('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xabfd('0x3'),'afterUpdate':'update','afterDestroy':_0xabfd('0x4')};function emitEvent(_0x138c67){return function(_0x384d8e,_0x3818ef,_0x48aff0){ChatInternalMessageEvents[_0xabfd('0x5')](_0x138c67+':'+_0x384d8e['id'],_0x384d8e);ChatInternalMessageEvents['emit'](_0x138c67,_0x384d8e);_0x48aff0(null);};}for(var e in events){if(events[_0xabfd('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xabfd('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x6510=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3abb96,_0x277de1){var _0x2b5d62=function(_0x5d1692){while(--_0x5d1692){_0x3abb96['push'](_0x3abb96['shift']());}};_0x2b5d62(++_0x277de1);}(_0x6510,0x77));var _0x0651=function(_0x514d0a,_0x55d308){_0x514d0a=_0x514d0a-0x0;var _0x156092=_0x6510[_0x514d0a];return _0x156092;};'use strict';var EventEmitter=require(_0x0651('0x0'));var ChatInternalMessage=require(_0x0651('0x1'))['db'][_0x0651('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0651('0x3')](0x0);var events={'afterCreate':_0x0651('0x4'),'afterUpdate':'update','afterDestroy':_0x0651('0x5')};function emitEvent(_0x2e883e){return function(_0xb9587e,_0x38d1c9,_0xe8ff90){ChatInternalMessageEvents['emit'](_0x2e883e+':'+_0xb9587e['id'],_0xb9587e);ChatInternalMessageEvents[_0x0651('0x6')](_0x2e883e,_0xb9587e);_0xe8ff90(null);};}for(var e in events){if(events[_0x0651('0x7')](e)){var event=events[e];ChatInternalMessage[_0x0651('0x8')](e,emitEvent(event));}}module[_0x0651('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index e6d204c..0a3a825 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 _0xf4eb=['./chatInternalMessage.attributes','exports','define','chat_internal_messages','lodash','bluebird','rimraf','../../config/environment'];(function(_0x538452,_0x3f0c4d){var _0x2f51e6=function(_0x4ce35e){while(--_0x4ce35e){_0x538452['push'](_0x538452['shift']());}};_0x2f51e6(++_0x3f0c4d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x7ab635,_0x333717){_0x7ab635=_0x7ab635-0x0;var _0x4e926f=_0xf4eb[_0x7ab635];return _0x4e926f;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('ChatInternalMessage',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbaf0=['define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x553a1a,_0x5e53b8){var _0x5bd163=function(_0x17bb06){while(--_0x17bb06){_0x553a1a['push'](_0x553a1a['shift']());}};_0x5bd163(++_0x5e53b8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0baf('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 2a4feda..c952409 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 _0xbcfe=['request\x20sent','debug','ChatInternalMessage,\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','http','defaults','redis','localhost','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbcfe,0x9e));var _0xebcf=function(_0x1a0652,_0x4a3233){_0x1a0652=_0x1a0652-0x0;var _0x43f52c=_0xbcfe[_0x1a0652];return _0x43f52c;};'use strict';var _=require(_0xebcf('0x0'));var util=require(_0xebcf('0x1'));var moment=require(_0xebcf('0x2'));var BPromise=require(_0xebcf('0x3'));var rs=require(_0xebcf('0x4'));var fs=require('fs');var Redis=require(_0xebcf('0x5'));var db=require(_0xebcf('0x6'))['db'];var utils=require(_0xebcf('0x7'));var logger=require(_0xebcf('0x8'))(_0xebcf('0x9'));var config=require(_0xebcf('0xa'));var jayson=require(_0xebcf('0xb'));var client=jayson[_0xebcf('0xc')][_0xebcf('0xd')]({'port':0x232a});config['redis']=_[_0xebcf('0xe')](config[_0xebcf('0xf')],{'host':_0xebcf('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xebcf('0xf')]));require(_0xebcf('0x11'))['register'](socket);function respondWithRpcPromise(_0x3cda27,_0x52717d,_0x571663){return new BPromise(function(_0x39ca07,_0xd85ed2){return client[_0xebcf('0x12')](_0x3cda27,_0x571663)[_0xebcf('0x13')](function(_0x15ba7c){logger[_0xebcf('0x14')](_0xebcf('0x15'),_0x52717d,_0xebcf('0x16'));logger[_0xebcf('0x17')](_0xebcf('0x18'),_0x52717d,_0xebcf('0x16'),JSON[_0xebcf('0x19')](_0x15ba7c));if(_0x15ba7c['error']){if(_0x15ba7c[_0xebcf('0x1a')]['code']===0x1f4){logger['error'](_0xebcf('0x15'),_0x52717d,_0x15ba7c[_0xebcf('0x1a')][_0xebcf('0x1b')]);return _0xd85ed2(_0x15ba7c[_0xebcf('0x1a')][_0xebcf('0x1b')]);}logger[_0xebcf('0x1a')]('ChatInternalMessage,\x20%s,\x20%s',_0x52717d,_0x15ba7c[_0xebcf('0x1a')][_0xebcf('0x1b')]);return _0x39ca07(_0x15ba7c['error'][_0xebcf('0x1b')]);}else{logger['info'](_0xebcf('0x15'),_0x52717d,'request\x20sent');_0x39ca07(_0x15ba7c[_0xebcf('0x1c')]['message']);}})[_0xebcf('0x1d')](function(_0x5dbad0){logger['error'](_0xebcf('0x15'),_0x52717d,_0x5dbad0);_0xd85ed2(_0x5dbad0);});});} \ No newline at end of file +var _0x9ab7=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','./chatInternalMessage.socket','register','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0x9ab7,0x7c));var _0x79ab=function(_0x18e01e,_0x2d3afb){_0x18e01e=_0x18e01e-0x0;var _0x57567c=_0x9ab7[_0x18e01e];return _0x57567c;};'use strict';var _=require(_0x79ab('0x0'));var util=require(_0x79ab('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x79ab('0x2'));var fs=require('fs');var Redis=require(_0x79ab('0x3'));var db=require(_0x79ab('0x4'))['db'];var utils=require(_0x79ab('0x5'));var logger=require(_0x79ab('0x6'))(_0x79ab('0x7'));var config=require(_0x79ab('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x79ab('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x79ab('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x79ab('0xa')]));require(_0x79ab('0xb'))[_0x79ab('0xc')](socket);function respondWithRpcPromise(_0x2c3e3e,_0x157c4e,_0x33e9f2){return new BPromise(function(_0xe2efcb,_0x535a8b){return client[_0x79ab('0xd')](_0x2c3e3e,_0x33e9f2)[_0x79ab('0xe')](function(_0x4721ce){logger[_0x79ab('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x157c4e,'request\x20sent');logger[_0x79ab('0x10')](_0x79ab('0x11'),_0x157c4e,_0x79ab('0x12'),JSON[_0x79ab('0x13')](_0x4721ce));if(_0x4721ce[_0x79ab('0x14')]){if(_0x4721ce[_0x79ab('0x14')]['code']===0x1f4){logger['error'](_0x79ab('0x15'),_0x157c4e,_0x4721ce[_0x79ab('0x14')]['message']);return _0x535a8b(_0x4721ce[_0x79ab('0x14')]['message']);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x157c4e,_0x4721ce['error']['message']);return _0xe2efcb(_0x4721ce[_0x79ab('0x14')][_0x79ab('0x16')]);}else{logger[_0x79ab('0xf')](_0x79ab('0x15'),_0x157c4e,_0x79ab('0x12'));_0xe2efcb(_0x4721ce[_0x79ab('0x17')][_0x79ab('0x16')]);}})[_0x79ab('0x18')](function(_0x9d79f7){logger[_0x79ab('0x14')](_0x79ab('0x15'),_0x157c4e,_0x9d79f7);_0x535a8b(_0x9d79f7);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 483b2bf..d159eb7 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 _0x385b=['register','length','chatInternalMessage:','save','update','removeListener'];(function(_0xfd5f37,_0x24a79c){var _0x11bd01=function(_0x4ae9bd){while(--_0x4ae9bd){_0xfd5f37['push'](_0xfd5f37['shift']());}};_0x11bd01(++_0x24a79c);}(_0x385b,0x1a7));var _0xb385=function(_0x8b0efc,_0x1c44fb){_0x8b0efc=_0x8b0efc-0x0;var _0x135945=_0x385b[_0x8b0efc];return _0x135945;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xb385('0x0'),'remove',_0xb385('0x1')];function createListener(_0x3e35c3,_0x12124b){return function(_0x1f7c4f){_0x12124b['emit'](_0x3e35c3,_0x1f7c4f);};}function removeListener(_0x2ea8dd,_0xd61b87){return function(){ChatInternalMessageEvents[_0xb385('0x2')](_0x2ea8dd,_0xd61b87);};}exports[_0xb385('0x3')]=function(_0x3268bc){for(var _0x576d81=0x0,_0x411034=events[_0xb385('0x4')];_0x576d81<_0x411034;_0x576d81++){var _0x5b7929=events[_0x576d81];var _0x397ddc=createListener(_0xb385('0x5')+_0x5b7929,_0x3268bc);ChatInternalMessageEvents['on'](_0x5b7929,_0x397ddc);}}; \ No newline at end of file +var _0x3df4=['emit','register','chatInternalMessage:','remove','update'];(function(_0x2c7bf6,_0x363421){var _0xfdb896=function(_0x9be7df){while(--_0x9be7df){_0x2c7bf6['push'](_0x2c7bf6['shift']());}};_0xfdb896(++_0x363421);}(_0x3df4,0x102));var _0x43df=function(_0x530287,_0x385daf){_0x530287=_0x530287-0x0;var _0x1bfde5=_0x3df4[_0x530287];return _0x1bfde5;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x43df('0x0'),_0x43df('0x1')];function createListener(_0x40bf18,_0x206707){return function(_0x38a050){_0x206707[_0x43df('0x2')](_0x40bf18,_0x38a050);};}function removeListener(_0x4297f4,_0x5affd4){return function(){ChatInternalMessageEvents['removeListener'](_0x4297f4,_0x5affd4);};}exports[_0x43df('0x3')]=function(_0x3111bf){for(var _0x3af1ec=0x0,_0x43fd8c=events['length'];_0x3af1ec<_0x43fd8c;_0x3af1ec++){var _0x5863be=events[_0x3af1ec];var _0x2492a9=createListener(_0x43df('0x4')+_0x5863be,_0x3111bf);ChatInternalMessageEvents['on'](_0x5863be,_0x2492a9);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index eba1179..e631ce9 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 _0x70e0=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/users','isAuthenticated','getUsers','/:id','post','create','put','update','delete','destroy'];(function(_0x4c21b9,_0x5ea3a5){var _0x2f4915=function(_0x3af015){while(--_0x3af015){_0x4c21b9['push'](_0x4c21b9['shift']());}};_0x2f4915(++_0x5ea3a5);}(_0x70e0,0x17b));var _0x070e=function(_0x5aea54,_0x44ca22){_0x5aea54=_0x5aea54-0x0;var _0xc47f28=_0x70e0[_0x5aea54];return _0xc47f28;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0x7')](_0x070e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x070e('0xe')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xd'),controller[_0x070e('0x11')]);router[_0x070e('0x12')](_0x070e('0xd'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);module[_0x070e('0x14')]=router; \ No newline at end of file +var _0x70e0=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/users','isAuthenticated','getUsers','/:id','post','create','put','update','delete','destroy'];(function(_0x2e34cc,_0x41c060){var _0x2abce6=function(_0x50d415){while(--_0x50d415){_0x2e34cc['push'](_0x2e34cc['shift']());}};_0x2abce6(++_0x41c060);}(_0x70e0,0x17b));var _0x070e=function(_0x5cb788,_0x2bc343){_0x5cb788=_0x5cb788-0x0;var _0xc55ecb=_0x70e0[_0x5cb788];return _0xc55ecb;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0x7')](_0x070e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x070e('0xe')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xd'),controller[_0x070e('0x11')]);router[_0x070e('0x12')](_0x070e('0xd'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);module[_0x070e('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index d207af7..81b7d8b 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 _0x401d=['BOOLEAN','ENUM','sequelize','exports','TEXT','medium'];(function(_0x20016c,_0x12ed1d){var _0x223af7=function(_0x1f9fe6){while(--_0x1f9fe6){_0x20016c['push'](_0x20016c['shift']());}};_0x223af7(++_0x12ed1d);}(_0x401d,0x12e));var _0xd401=function(_0x38750a,_0x316de4){_0x38750a=_0x38750a-0x0;var _0x92e34a=_0x401d[_0x38750a];return _0x92e34a;};'use strict';var Sequelize=require(_0xd401('0x0'));module[_0xd401('0x1')]={'body':{'type':Sequelize[_0xd401('0x2')](_0xd401('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd401('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd401('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd401('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xee82=['DATE','exports','BOOLEAN','ENUM','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee82,0x173));var _0x2ee8=function(_0x92713a,_0x68f8b0){_0x92713a=_0x92713a-0x0;var _0x1893e1=_0xee82[_0x92713a];return _0x1893e1;};'use strict';var Sequelize=require('sequelize');module[_0x2ee8('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2ee8('0x1')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2ee8('0x2')]('in',_0x2ee8('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x2ee8('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index f059851..738c91f 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 _0x036b=['name','send','ChatMessage','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','merge','includeAll','include','findAll','params','find','create','body','destroy','describe','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','ChatInteraction','info','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','./chatMessage.socket','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x036b,0x130));var _0xb036=function(_0x91340d,_0x13ee89){_0x91340d=_0x91340d-0x0;var _0x4d935f=_0x036b[_0x91340d];return _0x4d935f;};'use strict';var pdf=require(_0xb036('0x0'));var emlformat=require(_0xb036('0x1'));var rimraf=require(_0xb036('0x2'));var zipdir=require(_0xb036('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb036('0x4'));var moment=require(_0xb036('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb036('0x6'));var util=require('util');var path=require(_0xb036('0x7'));var sox=require(_0xb036('0x8'));var csv=require(_0xb036('0x9'));var ejs=require(_0xb036('0xa'));var fs=require('fs');var _=require(_0xb036('0xb'));var squel=require(_0xb036('0xc'));var crypto=require(_0xb036('0xd'));var jsforce=require(_0xb036('0xe'));var deskjs=require(_0xb036('0xf'));var toCsv=require(_0xb036('0x9'));var querystring=require(_0xb036('0x10'));var Papa=require(_0xb036('0x11'));var Redis=require('ioredis');var authService=require(_0xb036('0x12'));var qs=require(_0xb036('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb036('0x14'));var logger=require('../../config/logger')(_0xb036('0x15'));var utils=require(_0xb036('0x16'));var config=require(_0xb036('0x17'));var db=require('../../mysqldb')['db'];config[_0xb036('0x18')]=_[_0xb036('0x19')](config[_0xb036('0x18')],{'host':_0xb036('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb036('0x18')]));require(_0xb036('0x1b'))['register'](socket);var jayson=require(_0xb036('0x1c'));var client=jayson[_0xb036('0x1d')][_0xb036('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xb036('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x46b92b,_0x22801d,_0x2d120b){if(_0x2d120b){var _0x9c974d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x9c974d[_0xb036('0x1f')](_0x22801d)){return _0x46b92b;}else{throw new db['Sequelize'][(_0xb036('0x20'))](_0xb036('0x21'));}}else{return _0x46b92b;}}function respondWithRpcPromise(_0xa01e90,_0x2cd1c2,_0x58c59d,_0x44c536){return new BPromise(function(_0x41a7a4,_0x5c89db){var _0x53172d=_0x44c536||client;return _0x53172d['request'](_0xa01e90,_0x58c59d)[_0xb036('0x22')](function(_0x480f2d){logger['info']('ChatMessage,\x20%s,\x20%s',_0x2cd1c2,'request\x20sent');logger[_0xb036('0x23')](_0xb036('0x24'),_0x2cd1c2,'request\x20sent',JSON[_0xb036('0x25')](_0x480f2d));if(_0x480f2d[_0xb036('0x26')]){if(_0x480f2d[_0xb036('0x26')][_0xb036('0x27')]===0x1f4){logger[_0xb036('0x26')](_0xb036('0x28'),_0x2cd1c2,_0x480f2d[_0xb036('0x26')][_0xb036('0x29')]);return _0x5c89db(_0x480f2d[_0xb036('0x26')][_0xb036('0x29')]);}logger[_0xb036('0x26')](_0xb036('0x28'),_0x2cd1c2,_0x480f2d[_0xb036('0x26')][_0xb036('0x29')]);return _0x41a7a4(_0x480f2d[_0xb036('0x26')][_0xb036('0x29')]);}else{logger['info'](_0xb036('0x28'),_0x2cd1c2,_0xb036('0x2a'));_0x41a7a4(_0x480f2d[_0xb036('0x2b')][_0xb036('0x29')]);}})[_0xb036('0x2c')](function(_0x2e005){logger[_0xb036('0x26')](_0xb036('0x28'),_0x2cd1c2,_0x2e005);_0x5c89db(_0x2e005);});});}function respondWithStatusCode(_0x387165,_0x149e10){_0x149e10=_0x149e10||0xcc;return function(_0x1d3a9b){if(_0x1d3a9b){return _0x387165[_0xb036('0x2d')](_0x149e10);}return _0x387165[_0xb036('0x2e')](_0x149e10)[_0xb036('0x2f')]();};}function respondWithResult(_0x1089a3,_0x1c9217){_0x1c9217=_0x1c9217||0xc8;return function(_0x5d6aa7){if(_0x5d6aa7){return _0x1089a3[_0xb036('0x2e')](_0x1c9217)[_0xb036('0x30')](_0x5d6aa7);}};}function respondWithFilteredResult(_0x52a0d8,_0x52ce83){return function(_0xbb4526){if(_0xbb4526){var _0x184a74=_0xbb4526[_0xb036('0x31')],_0x13685b=_0x52ce83[_0xb036('0x32')],_0x50eafd=_0x52ce83[_0xb036('0x32')]+_0x52ce83[_0xb036('0x33')],_0x268ebf;if(_0x50eafd>=_0x184a74){_0x50eafd=_0x184a74;_0x268ebf=0xc8;}else{_0x268ebf=0xce;}_0x52a0d8[_0xb036('0x2e')](_0x268ebf);return _0x52a0d8['set'](_0xb036('0x34'),_0x13685b+'-'+_0x50eafd+'/'+_0x184a74)[_0xb036('0x30')](_0xbb4526);}return null;};}function patchUpdates(_0x54e626){return function(_0x2e2806){try{jsonpatch['apply'](_0x2e2806,_0x54e626,!![]);}catch(_0x349bd1){return BPromise[_0xb036('0x35')](_0x349bd1);}return _0x2e2806[_0xb036('0x36')]();};}function saveUpdates(_0x58dc2c,_0x281190){return function(_0x3706c2){if(_0x3706c2){return _0x3706c2[_0xb036('0x37')](_0x58dc2c)[_0xb036('0x22')](function(_0x2871dc){return _0x2871dc;});}return null;};}function removeEntity(_0x1ea6c5,_0x46fdef){return function(_0x35fa02){if(_0x35fa02){return _0x35fa02['destroy']()[_0xb036('0x22')](function(){_0x1ea6c5[_0xb036('0x2e')](0xcc)[_0xb036('0x2f')]();});}};}function handleEntityNotFound(_0x17d52c,_0x5ca2ed){return function(_0xf69ce2){if(!_0xf69ce2){_0x17d52c[_0xb036('0x2d')](0x194);}return _0xf69ce2;};}function handleError(_0x4e235d,_0x547c0e){_0x547c0e=_0x547c0e||0x1f4;return function(_0x1eb09e){logger['error'](_0x1eb09e['stack']);if(_0x1eb09e[_0xb036('0x38')]){delete _0x1eb09e[_0xb036('0x38')];}_0x4e235d[_0xb036('0x2e')](_0x547c0e)[_0xb036('0x39')](_0x1eb09e);};}exports['index']=function(_0x4eb907,_0x5ca167){var _0x2f4558={},_0x3e6b6f={},_0xa5f785={'count':0x0,'rows':[]};var _0x55332f=_['map'](db[_0xb036('0x3a')][_0xb036('0x3b')],function(_0x97e539){return{'name':_0x97e539['fieldName'],'type':_0x97e539[_0xb036('0x3c')][_0xb036('0x3d')]};});_0x3e6b6f['model']=_['map'](_0x55332f,'name');_0x3e6b6f['query']=_[_0xb036('0x3e')](_0x4eb907[_0xb036('0x3f')]);_0x3e6b6f[_0xb036('0x40')]=_[_0xb036('0x41')](_0x3e6b6f[_0xb036('0x42')],_0x3e6b6f[_0xb036('0x3f')]);_0x2f4558[_0xb036('0x43')]=_[_0xb036('0x41')](_0x3e6b6f['model'],qs[_0xb036('0x44')](_0x4eb907['query'][_0xb036('0x44')]));_0x2f4558[_0xb036('0x43')]=_0x2f4558[_0xb036('0x43')]['length']?_0x2f4558['attributes']:_0x3e6b6f[_0xb036('0x42')];if(!_0x4eb907['query'][_0xb036('0x45')](_0xb036('0x46'))){_0x2f4558[_0xb036('0x33')]=qs[_0xb036('0x33')](_0x4eb907[_0xb036('0x3f')]['limit']);_0x2f4558[_0xb036('0x32')]=qs[_0xb036('0x32')](_0x4eb907[_0xb036('0x3f')][_0xb036('0x32')]);}_0x2f4558[_0xb036('0x47')]=qs[_0xb036('0x48')](_0x4eb907[_0xb036('0x3f')][_0xb036('0x48')]);_0x2f4558[_0xb036('0x49')]=qs[_0xb036('0x40')](_[_0xb036('0x4a')](_0x4eb907[_0xb036('0x3f')],_0x3e6b6f[_0xb036('0x40')]),_0x55332f);if(_0x4eb907['query'][_0xb036('0x4b')]){_0x2f4558[_0xb036('0x49')]=_['merge'](_0x2f4558['where'],{'$or':_[_0xb036('0x4c')](_0x55332f,function(_0x43b06d){if(_0x43b06d['type']!=='VIRTUAL'){var _0x20cdd3={};_0x20cdd3[_0x43b06d[_0xb036('0x38')]]={'$like':'%'+_0x4eb907[_0xb036('0x3f')][_0xb036('0x4b')]+'%'};return _0x20cdd3;}})});}_0x2f4558=_[_0xb036('0x4d')]({},_0x2f4558,_0x4eb907['options']);var _0xd324fc={'where':_0x2f4558[_0xb036('0x49')]};return db[_0xb036('0x3a')][_0xb036('0x31')](_0xd324fc)['then'](function(_0x335aa3){_0xa5f785[_0xb036('0x31')]=_0x335aa3;if(_0x4eb907[_0xb036('0x3f')][_0xb036('0x4e')]){_0x2f4558[_0xb036('0x4f')]=[{'all':!![]}];}return db[_0xb036('0x3a')][_0xb036('0x50')](_0x2f4558);})[_0xb036('0x22')](function(_0x3530c4){_0xa5f785['rows']=_0x3530c4;return _0xa5f785;})[_0xb036('0x22')](respondWithFilteredResult(_0x5ca167,_0x2f4558))['catch'](handleError(_0x5ca167,null));};exports['show']=function(_0x12b30f,_0x2e47e0){var _0x1745ab={'raw':!![],'where':{'id':_0x12b30f[_0xb036('0x51')]['id']}},_0x9317ef={};_0x9317ef[_0xb036('0x42')]=_[_0xb036('0x3e')](db['ChatMessage'][_0xb036('0x3b')]);_0x9317ef[_0xb036('0x3f')]=_[_0xb036('0x3e')](_0x12b30f[_0xb036('0x3f')]);_0x9317ef[_0xb036('0x40')]=_[_0xb036('0x41')](_0x9317ef[_0xb036('0x42')],_0x9317ef[_0xb036('0x3f')]);_0x1745ab[_0xb036('0x43')]=_[_0xb036('0x41')](_0x9317ef[_0xb036('0x42')],qs['fields'](_0x12b30f[_0xb036('0x3f')]['fields']));_0x1745ab[_0xb036('0x43')]=_0x1745ab[_0xb036('0x43')]['length']?_0x1745ab[_0xb036('0x43')]:_0x9317ef[_0xb036('0x42')];if(_0x12b30f[_0xb036('0x3f')][_0xb036('0x4e')]){_0x1745ab['include']=[{'all':!![]}];}_0x1745ab=_['merge']({},_0x1745ab,_0x12b30f['options']);return db[_0xb036('0x3a')][_0xb036('0x52')](_0x1745ab)[_0xb036('0x22')](handleEntityNotFound(_0x2e47e0,null))[_0xb036('0x22')](respondWithResult(_0x2e47e0,null))[_0xb036('0x2c')](handleError(_0x2e47e0,null));};exports['create']=function(_0x575ee1,_0x3c88b5){return db[_0xb036('0x3a')][_0xb036('0x53')](_0x575ee1[_0xb036('0x54')],{})['then'](respondWithResult(_0x3c88b5,0xc9))[_0xb036('0x2c')](handleError(_0x3c88b5,null));};exports[_0xb036('0x37')]=function(_0x151019,_0x28aa90){if(_0x151019[_0xb036('0x54')]['id']){delete _0x151019['body']['id'];}return db[_0xb036('0x3a')][_0xb036('0x52')]({'where':{'id':_0x151019[_0xb036('0x51')]['id']}})['then'](handleEntityNotFound(_0x28aa90,null))['then'](saveUpdates(_0x151019[_0xb036('0x54')],null))[_0xb036('0x22')](respondWithResult(_0x28aa90,null))[_0xb036('0x2c')](handleError(_0x28aa90,null));};exports[_0xb036('0x55')]=function(_0x4367c4,_0x2ae9ce){return db['ChatMessage']['find']({'where':{'id':_0x4367c4[_0xb036('0x51')]['id']}})['then'](handleEntityNotFound(_0x2ae9ce,null))['then'](removeEntity(_0x2ae9ce,null))[_0xb036('0x2c')](handleError(_0x2ae9ce,null));};exports[_0xb036('0x56')]=function(_0xd774f4,_0x4407aa){return db['ChatMessage'][_0xb036('0x56')]()['then'](respondWithResult(_0x4407aa,null))[_0xb036('0x2c')](handleError(_0x4407aa,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0xb036('0x57')]=function(_0x124079,_0x49f44b,_0x22db0f){var _0x1a49d4={'channel':_0xb036('0x58')};if(_0x124079[_0xb036('0x54')]['id']){delete _0x124079[_0xb036('0x54')]['id'];}_0x124079[_0xb036('0x54')][_0xb036('0x59')]=!![];_0x124079['body']['readAt']=moment()[_0xb036('0x5a')](_0xb036('0x5b'));_0x124079[_0xb036('0x54')]['UserId']=_0x124079[_0xb036('0x54')][_0xb036('0x5c')]||_0x124079[_0xb036('0x5d')]['id'];return db[_0xb036('0x3a')][_0xb036('0x52')]({'where':{'id':_0x124079['params']['id'],'UserId':null},'include':[{'model':db[_0xb036('0x5e')],'as':_0xb036('0x5f')}]})[_0xb036('0x22')](handleEntityNotFound(_0x49f44b,null))[_0xb036('0x22')](saveUpdates(_0x124079[_0xb036('0x54')],null))[_0xb036('0x22')](function(_0x298465){if(_0x298465){_0x1a49d4['message']=_0x298465[_0xb036('0x60')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x298465[_0xb036('0x61')]}});}return null;})[_0xb036('0x22')](handleEntityNotFound(_0x49f44b,null))[_0xb036('0x22')](function(_0x114a3a){if(_0x114a3a){return _0x114a3a[_0xb036('0x37')]({'UserId':_0x124079[_0xb036('0x54')][_0xb036('0x5c')],'read1stAt':_['isNil'](_0x114a3a[_0xb036('0x62')])?moment()[_0xb036('0x5a')](_0xb036('0x5b')):undefined});}return null;})[_0xb036('0x22')](function(_0x226cec){if(_0x226cec){_0x1a49d4[_0xb036('0x63')]=_0x226cec['get']({'plain':!![]});interaction_log['info'](_0xb036('0x64'),_0x124079[_0xb036('0x5d')]['id'],_0x124079[_0xb036('0x5d')][_0xb036('0x38')],_0x124079[_0xb036('0x5d')][_0xb036('0x65')],_0x1a49d4['interaction']['id'],_0x124079[_0xb036('0x54')]?JSON[_0xb036('0x25')](_0x124079['body']):_0xb036('0x66'));return respondWithRpcPromise(_0xb036('0x67'),_0xb036('0x68'),_0x1a49d4);}return null;})['then'](function(_0x226d28){if(_0x226d28){if(_0x124079[_0xb036('0x54')][_0xb036('0x69')]){_0x1a49d4[_0xb036('0x29')][_0xb036('0x6a')]=util[_0xb036('0x5a')](_0xb036('0x6b'),_0x124079['user'][_0xb036('0x38')]);_0x1a49d4['message'][_0xb036('0x6c')]=_0x1a49d4[_0xb036('0x6c')];_0x1a49d4['message'][_0xb036('0x6d')]=_0xb036('0x57');return respondWithRpcPromise('EventManager',_0xb036('0x6e'),{'event':_0xb036('0x6f'),'message':_[_0xb036('0x4d')](_0x1a49d4[_0xb036('0x29')],JSON[_0xb036('0x70')](_0x1a49d4['interaction'][_0xb036('0x71')]))},client9002)[_0xb036('0x22')](function(){return _0x1a49d4;});}return _0x1a49d4;}return null;})[_0xb036('0x22')](respondWithResult(_0x49f44b,null))[_0xb036('0x2c')](handleError(_0x49f44b,null));};var interaction_log=require('../../config/logger')(_0xb036('0x72'));exports[_0xb036('0x35')]=function(_0x46ce55,_0x4709e9,_0x31a77d){var _0x4d03b={'agent':{},'channel':_0xb036('0x58')};if(_0x46ce55[_0xb036('0x54')]['id']){delete _0x46ce55[_0xb036('0x54')]['id'];}_0x46ce55[_0xb036('0x54')][_0xb036('0x5c')]=_0x46ce55[_0xb036('0x54')][_0xb036('0x5c')]||_0x46ce55[_0xb036('0x5d')]['id'];_0x4d03b['agent']['id']=_0x46ce55[_0xb036('0x54')]['UserId'];return db[_0xb036('0x3a')][_0xb036('0x52')]({'where':{'id':_0x46ce55[_0xb036('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4709e9,null))[_0xb036('0x22')](function(_0x72bdab){if(_0x72bdab){_0x4d03b[_0xb036('0x29')]=_0x72bdab[_0xb036('0x60')]({'plain':!![]});return db[_0xb036('0x73')]['find']({'where':{'id':_0x72bdab[_0xb036('0x61')]}});}return null;})[_0xb036('0x22')](handleEntityNotFound(_0x4709e9,null))[_0xb036('0x22')](function(_0x21061e){if(_0x21061e){_0x4d03b['interaction']=_0x21061e[_0xb036('0x60')]({'plain':!![]});interaction_log[_0xb036('0x74')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x46ce55[_0xb036('0x5d')]['id'],_0x46ce55[_0xb036('0x5d')][_0xb036('0x38')],_0x46ce55[_0xb036('0x5d')][_0xb036('0x65')],_0x4d03b['interaction']['id'],_0x46ce55[_0xb036('0x54')]?JSON['stringify'](_0x46ce55['body']):_0xb036('0x66'));return respondWithRpcPromise(_0xb036('0x75'),_0xb036('0x76'),_0x4d03b);}return null;})[_0xb036('0x22')](function(_0x1071fc){if(_0x1071fc){_0x1071fc[_0xb036('0x29')][_0xb036('0x6a')]=util['format'](_0xb036('0x6b'),_0x46ce55[_0xb036('0x5d')]['name']);_0x1071fc['message'][_0xb036('0x6c')]=_0x4d03b[_0xb036('0x6c')];_0x1071fc[_0xb036('0x29')][_0xb036('0x6d')]=_0xb036('0x35');respondWithRpcPromise(_0xb036('0x6e'),_0xb036('0x6e'),{'event':_0xb036('0x77'),'message':_0x1071fc['message']},client9002);return _0x4d03b;}return null;})[_0xb036('0x22')](respondWithResult(_0x4709e9,null))[_0xb036('0x2c')](handleError(_0x4709e9,null));}; \ No newline at end of file +var _0x8576=['read','readAt','format','UserId','Contact','get','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','manual','SIP/%s','channel','accept','EventManager','acceptmessage','parse','formData','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','event','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','index','ChatMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','show','params','fields','include','find','catch','create','body','describe','chat-interactions','chat'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x8576,0xa0));var _0x6857=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x8576[_0x4b73a2];return _0x383c66;};'use strict';var pdf=require(_0x6857('0x0'));var emlformat=require(_0x6857('0x1'));var rimraf=require(_0x6857('0x2'));var zipdir=require(_0x6857('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6857('0x4'));var BPromise=require(_0x6857('0x5'));var Mustache=require(_0x6857('0x6'));var util=require(_0x6857('0x7'));var path=require(_0x6857('0x8'));var sox=require('sox');var csv=require(_0x6857('0x9'));var ejs=require(_0x6857('0xa'));var fs=require('fs');var _=require(_0x6857('0xb'));var squel=require(_0x6857('0xc'));var crypto=require(_0x6857('0xd'));var jsforce=require(_0x6857('0xe'));var deskjs=require(_0x6857('0xf'));var toCsv=require(_0x6857('0x9'));var querystring=require(_0x6857('0x10'));var Papa=require(_0x6857('0x11'));var Redis=require(_0x6857('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6857('0x13'));var as=require(_0x6857('0x14'));var hardwareService=require(_0x6857('0x15'));var logger=require('../../config/logger')(_0x6857('0x16'));var utils=require('../../config/utils');var config=require(_0x6857('0x17'));var db=require(_0x6857('0x18'))['db'];config[_0x6857('0x19')]=_[_0x6857('0x1a')](config[_0x6857('0x19')],{'host':_0x6857('0x1b'),'port':0x18eb});var socket=require(_0x6857('0x1c'))(new Redis(config[_0x6857('0x19')]));require(_0x6857('0x1d'))[_0x6857('0x1e')](socket);var jayson=require(_0x6857('0x1f'));var client=jayson[_0x6857('0x20')][_0x6857('0x21')]({'port':0x232c});var client9002=jayson[_0x6857('0x20')][_0x6857('0x21')]({'port':0x232a});function checkPasswordPattern(_0x389997,_0x4fac9c,_0x1868f7){if(_0x1868f7){var _0x49a94b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x49a94b[_0x6857('0x22')](_0x4fac9c)){return _0x389997;}else{throw new db[(_0x6857('0x23'))]['ValidationError'](_0x6857('0x24'));}}else{return _0x389997;}}function respondWithRpcPromise(_0x2ad4f5,_0x3598f5,_0x2bf52e,_0xc0b3c0){return new BPromise(function(_0x4fcb13,_0x2ac7e4){var _0x473749=_0xc0b3c0||client;return _0x473749[_0x6857('0x25')](_0x2ad4f5,_0x2bf52e)['then'](function(_0x340e73){logger[_0x6857('0x26')](_0x6857('0x27'),_0x3598f5,_0x6857('0x28'));logger[_0x6857('0x29')](_0x6857('0x2a'),_0x3598f5,_0x6857('0x28'),JSON[_0x6857('0x2b')](_0x340e73));if(_0x340e73[_0x6857('0x2c')]){if(_0x340e73[_0x6857('0x2c')]['code']===0x1f4){logger[_0x6857('0x2c')](_0x6857('0x27'),_0x3598f5,_0x340e73[_0x6857('0x2c')]['message']);return _0x2ac7e4(_0x340e73[_0x6857('0x2c')][_0x6857('0x2d')]);}logger[_0x6857('0x2c')](_0x6857('0x27'),_0x3598f5,_0x340e73['error'][_0x6857('0x2d')]);return _0x4fcb13(_0x340e73[_0x6857('0x2c')][_0x6857('0x2d')]);}else{logger[_0x6857('0x26')](_0x6857('0x27'),_0x3598f5,_0x6857('0x28'));_0x4fcb13(_0x340e73[_0x6857('0x2e')][_0x6857('0x2d')]);}})['catch'](function(_0x2b2986){logger[_0x6857('0x2c')]('ChatMessage,\x20%s,\x20%s',_0x3598f5,_0x2b2986);_0x2ac7e4(_0x2b2986);});});}function respondWithStatusCode(_0x554be3,_0xd3f92e){_0xd3f92e=_0xd3f92e||0xcc;return function(_0x29d8d5){if(_0x29d8d5){return _0x554be3['sendStatus'](_0xd3f92e);}return _0x554be3[_0x6857('0x2f')](_0xd3f92e)[_0x6857('0x30')]();};}function respondWithResult(_0x18a530,_0xfdae79){_0xfdae79=_0xfdae79||0xc8;return function(_0x2e9d4c){if(_0x2e9d4c){return _0x18a530[_0x6857('0x2f')](_0xfdae79)[_0x6857('0x31')](_0x2e9d4c);}};}function respondWithFilteredResult(_0x4a7c65,_0x30ea77){return function(_0x331b75){if(_0x331b75){var _0x448b7c=_0x331b75[_0x6857('0x32')],_0x2403ae=_0x30ea77[_0x6857('0x33')],_0x4baa85=_0x30ea77['offset']+_0x30ea77['limit'],_0x2b50c3;if(_0x4baa85>=_0x448b7c){_0x4baa85=_0x448b7c;_0x2b50c3=0xc8;}else{_0x2b50c3=0xce;}_0x4a7c65[_0x6857('0x2f')](_0x2b50c3);return _0x4a7c65[_0x6857('0x34')](_0x6857('0x35'),_0x2403ae+'-'+_0x4baa85+'/'+_0x448b7c)['json'](_0x331b75);}return null;};}function patchUpdates(_0x4fae1b){return function(_0x1cbffd){try{jsonpatch[_0x6857('0x36')](_0x1cbffd,_0x4fae1b,!![]);}catch(_0x375e42){return BPromise[_0x6857('0x37')](_0x375e42);}return _0x1cbffd['save']();};}function saveUpdates(_0x5f3c22,_0x54c476){return function(_0x1a6b53){if(_0x1a6b53){return _0x1a6b53[_0x6857('0x38')](_0x5f3c22)[_0x6857('0x39')](function(_0x301303){return _0x301303;});}return null;};}function removeEntity(_0x12e9d6,_0x27097b){return function(_0xf93eba){if(_0xf93eba){return _0xf93eba[_0x6857('0x3a')]()['then'](function(){_0x12e9d6[_0x6857('0x2f')](0xcc)[_0x6857('0x30')]();});}};}function handleEntityNotFound(_0x280d2d,_0x1acb09){return function(_0x38e2c0){if(!_0x38e2c0){_0x280d2d[_0x6857('0x3b')](0x194);}return _0x38e2c0;};}function handleError(_0x3fabf8,_0x5c777d){_0x5c777d=_0x5c777d||0x1f4;return function(_0x50e8aa){logger[_0x6857('0x2c')](_0x50e8aa[_0x6857('0x3c')]);if(_0x50e8aa[_0x6857('0x3d')]){delete _0x50e8aa['name'];}_0x3fabf8[_0x6857('0x2f')](_0x5c777d)['send'](_0x50e8aa);};}exports[_0x6857('0x3e')]=function(_0x2861c1,_0x893491){var _0x5e5b17={},_0x769713={},_0x47b938={'count':0x0,'rows':[]};var _0x329b43=_['map'](db[_0x6857('0x3f')][_0x6857('0x40')],function(_0x50510d){return{'name':_0x50510d[_0x6857('0x41')],'type':_0x50510d[_0x6857('0x42')][_0x6857('0x43')]};});_0x769713[_0x6857('0x44')]=_[_0x6857('0x45')](_0x329b43,_0x6857('0x3d'));_0x769713[_0x6857('0x46')]=_[_0x6857('0x47')](_0x2861c1[_0x6857('0x46')]);_0x769713[_0x6857('0x48')]=_[_0x6857('0x49')](_0x769713[_0x6857('0x44')],_0x769713['query']);_0x5e5b17[_0x6857('0x4a')]=_[_0x6857('0x49')](_0x769713['model'],qs['fields'](_0x2861c1[_0x6857('0x46')]['fields']));_0x5e5b17[_0x6857('0x4a')]=_0x5e5b17['attributes'][_0x6857('0x4b')]?_0x5e5b17[_0x6857('0x4a')]:_0x769713[_0x6857('0x44')];if(!_0x2861c1[_0x6857('0x46')][_0x6857('0x4c')](_0x6857('0x4d'))){_0x5e5b17['limit']=qs[_0x6857('0x4e')](_0x2861c1[_0x6857('0x46')]['limit']);_0x5e5b17[_0x6857('0x33')]=qs[_0x6857('0x33')](_0x2861c1[_0x6857('0x46')]['offset']);}_0x5e5b17[_0x6857('0x4f')]=qs[_0x6857('0x50')](_0x2861c1[_0x6857('0x46')][_0x6857('0x50')]);_0x5e5b17[_0x6857('0x51')]=qs['filters'](_[_0x6857('0x52')](_0x2861c1['query'],_0x769713[_0x6857('0x48')]),_0x329b43);if(_0x2861c1[_0x6857('0x46')]['filter']){_0x5e5b17[_0x6857('0x51')]=_[_0x6857('0x53')](_0x5e5b17['where'],{'$or':_[_0x6857('0x45')](_0x329b43,function(_0x4dce05){if(_0x4dce05[_0x6857('0x42')]!=='VIRTUAL'){var _0x1a6cb9={};_0x1a6cb9[_0x4dce05[_0x6857('0x3d')]]={'$like':'%'+_0x2861c1['query'][_0x6857('0x54')]+'%'};return _0x1a6cb9;}})});}_0x5e5b17=_[_0x6857('0x53')]({},_0x5e5b17,_0x2861c1[_0x6857('0x55')]);var _0xba42db={'where':_0x5e5b17[_0x6857('0x51')]};return db[_0x6857('0x3f')][_0x6857('0x32')](_0xba42db)[_0x6857('0x39')](function(_0x42a443){_0x47b938[_0x6857('0x32')]=_0x42a443;if(_0x2861c1[_0x6857('0x46')][_0x6857('0x56')]){_0x5e5b17['include']=[{'all':!![]}];}return db['ChatMessage'][_0x6857('0x57')](_0x5e5b17);})[_0x6857('0x39')](function(_0x28878a){_0x47b938[_0x6857('0x58')]=_0x28878a;return _0x47b938;})[_0x6857('0x39')](respondWithFilteredResult(_0x893491,_0x5e5b17))['catch'](handleError(_0x893491,null));};exports[_0x6857('0x59')]=function(_0x377672,_0x2e8884){var _0x3d0293={'raw':!![],'where':{'id':_0x377672[_0x6857('0x5a')]['id']}},_0x34f7aa={};_0x34f7aa[_0x6857('0x44')]=_['keys'](db[_0x6857('0x3f')][_0x6857('0x40')]);_0x34f7aa[_0x6857('0x46')]=_['keys'](_0x377672['query']);_0x34f7aa[_0x6857('0x48')]=_[_0x6857('0x49')](_0x34f7aa[_0x6857('0x44')],_0x34f7aa['query']);_0x3d0293[_0x6857('0x4a')]=_['intersection'](_0x34f7aa['model'],qs[_0x6857('0x5b')](_0x377672[_0x6857('0x46')][_0x6857('0x5b')]));_0x3d0293[_0x6857('0x4a')]=_0x3d0293[_0x6857('0x4a')][_0x6857('0x4b')]?_0x3d0293[_0x6857('0x4a')]:_0x34f7aa[_0x6857('0x44')];if(_0x377672['query'][_0x6857('0x56')]){_0x3d0293[_0x6857('0x5c')]=[{'all':!![]}];}_0x3d0293=_['merge']({},_0x3d0293,_0x377672[_0x6857('0x55')]);return db[_0x6857('0x3f')][_0x6857('0x5d')](_0x3d0293)[_0x6857('0x39')](handleEntityNotFound(_0x2e8884,null))[_0x6857('0x39')](respondWithResult(_0x2e8884,null))[_0x6857('0x5e')](handleError(_0x2e8884,null));};exports['create']=function(_0x28fbee,_0x4fa4a3){return db['ChatMessage'][_0x6857('0x5f')](_0x28fbee['body'],{})[_0x6857('0x39')](respondWithResult(_0x4fa4a3,0xc9))[_0x6857('0x5e')](handleError(_0x4fa4a3,null));};exports[_0x6857('0x38')]=function(_0x252a6a,_0x287994){if(_0x252a6a[_0x6857('0x60')]['id']){delete _0x252a6a[_0x6857('0x60')]['id'];}return db[_0x6857('0x3f')][_0x6857('0x5d')]({'where':{'id':_0x252a6a['params']['id']}})[_0x6857('0x39')](handleEntityNotFound(_0x287994,null))[_0x6857('0x39')](saveUpdates(_0x252a6a[_0x6857('0x60')],null))[_0x6857('0x39')](respondWithResult(_0x287994,null))['catch'](handleError(_0x287994,null));};exports[_0x6857('0x3a')]=function(_0x1a6b50,_0x4205c4){return db[_0x6857('0x3f')]['find']({'where':{'id':_0x1a6b50['params']['id']}})[_0x6857('0x39')](handleEntityNotFound(_0x4205c4,null))[_0x6857('0x39')](removeEntity(_0x4205c4,null))[_0x6857('0x5e')](handleError(_0x4205c4,null));};exports['describe']=function(_0x101503,_0x18aa19){return db[_0x6857('0x3f')][_0x6857('0x61')]()[_0x6857('0x39')](respondWithResult(_0x18aa19,null))[_0x6857('0x5e')](handleError(_0x18aa19,null));};var interaction_log=require('../../config/logger')(_0x6857('0x62'));exports['accept']=function(_0x44e221,_0x197bf1,_0x1c6ff3){var _0x99df9a={'channel':_0x6857('0x63')};if(_0x44e221[_0x6857('0x60')]['id']){delete _0x44e221[_0x6857('0x60')]['id'];}_0x44e221[_0x6857('0x60')][_0x6857('0x64')]=!![];_0x44e221['body'][_0x6857('0x65')]=moment()[_0x6857('0x66')]('YYYY-MM-DD\x20HH:mm:ss');_0x44e221[_0x6857('0x60')][_0x6857('0x67')]=_0x44e221[_0x6857('0x60')]['UserId']||_0x44e221['user']['id'];return db[_0x6857('0x3f')][_0x6857('0x5d')]({'where':{'id':_0x44e221[_0x6857('0x5a')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x6857('0x68')}]})[_0x6857('0x39')](handleEntityNotFound(_0x197bf1,null))[_0x6857('0x39')](saveUpdates(_0x44e221[_0x6857('0x60')],null))[_0x6857('0x39')](function(_0x2a18c2){if(_0x2a18c2){_0x99df9a[_0x6857('0x2d')]=_0x2a18c2[_0x6857('0x69')]({'plain':!![]});return db['ChatInteraction'][_0x6857('0x5d')]({'where':{'id':_0x2a18c2[_0x6857('0x6a')]}});}return null;})[_0x6857('0x39')](handleEntityNotFound(_0x197bf1,null))[_0x6857('0x39')](function(_0xd3f0f7){if(_0xd3f0f7){return _0xd3f0f7[_0x6857('0x38')]({'UserId':_0x44e221[_0x6857('0x60')][_0x6857('0x67')],'read1stAt':_[_0x6857('0x6b')](_0xd3f0f7[_0x6857('0x6c')])?moment()[_0x6857('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6857('0x39')](function(_0xd47a5e){if(_0xd47a5e){_0x99df9a[_0x6857('0x6d')]=_0xd47a5e['get']({'plain':!![]});interaction_log[_0x6857('0x26')](_0x6857('0x6e'),_0x44e221['user']['id'],_0x44e221[_0x6857('0x6f')][_0x6857('0x3d')],_0x44e221[_0x6857('0x6f')][_0x6857('0x70')],_0x99df9a[_0x6857('0x6d')]['id'],_0x44e221['body']?JSON[_0x6857('0x2b')](_0x44e221[_0x6857('0x60')]):_0x6857('0x71'));return respondWithRpcPromise(_0x6857('0x72'),'acceptMessage',_0x99df9a);}return null;})['then'](function(_0xf4981e){if(_0xf4981e){if(_0x44e221['body'][_0x6857('0x73')]){_0x99df9a['message']['interface']=util[_0x6857('0x66')](_0x6857('0x74'),_0x44e221['user']['name']);_0x99df9a['message'][_0x6857('0x75')]=_0x99df9a['channel'];_0x99df9a['message']['event']=_0x6857('0x76');return respondWithRpcPromise(_0x6857('0x77'),_0x6857('0x77'),{'event':_0x6857('0x78'),'message':_[_0x6857('0x53')](_0x99df9a['message'],JSON[_0x6857('0x79')](_0x99df9a[_0x6857('0x6d')][_0x6857('0x7a')]))},client9002)[_0x6857('0x39')](function(){return _0x99df9a;});}return _0x99df9a;}return null;})['then'](respondWithResult(_0x197bf1,null))['catch'](handleError(_0x197bf1,null));};var interaction_log=require('../../config/logger')(_0x6857('0x62'));exports[_0x6857('0x37')]=function(_0x171527,_0x1fdc89,_0x1696f1){var _0x12d21c={'agent':{},'channel':_0x6857('0x63')};if(_0x171527['body']['id']){delete _0x171527[_0x6857('0x60')]['id'];}_0x171527[_0x6857('0x60')][_0x6857('0x67')]=_0x171527['body'][_0x6857('0x67')]||_0x171527['user']['id'];_0x12d21c[_0x6857('0x7b')]['id']=_0x171527['body'][_0x6857('0x67')];return db[_0x6857('0x3f')][_0x6857('0x5d')]({'where':{'id':_0x171527[_0x6857('0x5a')]['id'],'UserId':null}})[_0x6857('0x39')](handleEntityNotFound(_0x1fdc89,null))[_0x6857('0x39')](function(_0x487885){if(_0x487885){_0x12d21c['message']=_0x487885['get']({'plain':!![]});return db['ChatInteraction'][_0x6857('0x5d')]({'where':{'id':_0x487885[_0x6857('0x6a')]}});}return null;})[_0x6857('0x39')](handleEntityNotFound(_0x1fdc89,null))[_0x6857('0x39')](function(_0x4a1288){if(_0x4a1288){_0x12d21c[_0x6857('0x6d')]=_0x4a1288[_0x6857('0x69')]({'plain':!![]});interaction_log[_0x6857('0x26')](_0x6857('0x7c'),_0x171527['user']['id'],_0x171527[_0x6857('0x6f')][_0x6857('0x3d')],_0x171527[_0x6857('0x6f')][_0x6857('0x70')],_0x12d21c[_0x6857('0x6d')]['id'],_0x171527[_0x6857('0x60')]?JSON[_0x6857('0x2b')](_0x171527[_0x6857('0x60')]):_0x6857('0x71'));return respondWithRpcPromise(_0x6857('0x7d'),_0x6857('0x7e'),_0x12d21c);}return null;})[_0x6857('0x39')](function(_0x9cb022){if(_0x9cb022){_0x9cb022[_0x6857('0x2d')][_0x6857('0x7f')]=util[_0x6857('0x66')](_0x6857('0x74'),_0x171527['user'][_0x6857('0x3d')]);_0x9cb022[_0x6857('0x2d')][_0x6857('0x75')]=_0x12d21c['channel'];_0x9cb022[_0x6857('0x2d')][_0x6857('0x80')]=_0x6857('0x37');respondWithRpcPromise(_0x6857('0x77'),'EventManager',{'event':_0x6857('0x81'),'message':_0x9cb022[_0x6857('0x2d')]},client9002);return _0x12d21c;}return null;})[_0x6857('0x39')](respondWithResult(_0x1fdc89,null))[_0x6857('0x5e')](handleError(_0x1fdc89,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index af637b4..d0f80b4 100644 --- a/server/api/chatMessage/chatMessage.events.js +++ b/server/api/chatMessage/chatMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd470=['events','../../mysqldb','setMaxListeners','remove','emit','hook','exports'];(function(_0x2554b6,_0x22e703){var _0x4b23b9=function(_0x1b025c){while(--_0x1b025c){_0x2554b6['push'](_0x2554b6['shift']());}};_0x4b23b9(++_0x22e703);}(_0xd470,0xe7));var _0x0d47=function(_0x24ae62,_0x246c33){_0x24ae62=_0x24ae62-0x0;var _0x5336c0=_0xd470[_0x24ae62];return _0x5336c0;};'use strict';var EventEmitter=require(_0x0d47('0x0'));var ChatMessage=require(_0x0d47('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x0d47('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0d47('0x3')};function emitEvent(_0x526ba6){return function(_0x4747a5,_0x9a13eb,_0x135bf7){ChatMessageEvents[_0x0d47('0x4')](_0x526ba6+':'+_0x4747a5['id'],_0x4747a5);ChatMessageEvents[_0x0d47('0x4')](_0x526ba6,_0x4747a5);_0x135bf7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x0d47('0x5')](e,emitEvent(event));}}module[_0x0d47('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0x463e=['exports','events','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x4727f1,_0x2ff773){var _0x2977ce=function(_0x29be89){while(--_0x29be89){_0x4727f1['push'](_0x4727f1['shift']());}};_0x2977ce(++_0x2ff773);}(_0x463e,0x1c1));var _0xe463=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x463e[_0x411add];return _0x238242;};'use strict';var EventEmitter=require(_0xe463('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xe463('0x1')](0x0);var events={'afterCreate':_0xe463('0x2'),'afterUpdate':_0xe463('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5167e4){return function(_0x23c901,_0x1c478c,_0x1b574f){ChatMessageEvents[_0xe463('0x4')](_0x5167e4+':'+_0x23c901['id'],_0x23c901);ChatMessageEvents['emit'](_0x5167e4,_0x23c901);_0x1b574f(null);};}for(var e in events){if(events[_0xe463('0x5')](e)){var event=events[e];ChatMessage[_0xe463('0x6')](e,emitEvent(event));}}module[_0xe463('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 362c47d..a6bd4fe 100644 --- a/server/api/chatMessage/chatMessage.model.js +++ b/server/api/chatMessage/chatMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f22=['exports','define','ChatMessage','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','update','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x52ac88,_0x37f413){var _0x2a8f62=function(_0x2178ed){while(--_0x2178ed){_0x52ac88['push'](_0x52ac88['shift']());}};_0x2a8f62(++_0x37f413);}(_0x7f22,0xe1));var _0x27f2=function(_0x2f5e4e,_0x457537){_0x2f5e4e=_0x2f5e4e-0x0;var _0x15e24a=_0x7f22[_0x2f5e4e];return _0x15e24a;};'use strict';var _=require(_0x27f2('0x0'));var util=require(_0x27f2('0x1'));var logger=require(_0x27f2('0x2'))(_0x27f2('0x3'));var moment=require(_0x27f2('0x4'));var BPromise=require(_0x27f2('0x5'));var rp=require(_0x27f2('0x6'));var fs=require('fs');var path=require(_0x27f2('0x7'));var rimraf=require('rimraf');var config=require(_0x27f2('0x8'));var attributes=require('./chatMessage.attributes');module[_0x27f2('0x9')]=function(_0x3e0939,_0x1ba863){return _0x3e0939[_0x27f2('0xa')](_0x27f2('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x409a4f,_0x94ced,_0x3b8234){var _0x5cd3e1=_0x3e0939[_0x27f2('0xc')];var _0x1be66f=_0x409a4f[_0x27f2('0xd')]({'plain':!![]});if(_0x1be66f[_0x27f2('0xe')][_0x27f2('0xf')]()==='in'||_0x1be66f['direction'][_0x27f2('0xf')]()===_0x27f2('0x10')&&!_0x1be66f[_0x27f2('0x11')]&&!_[_0x27f2('0x12')](_0x1be66f[_0x27f2('0x13')])){_0x5cd3e1[_0x27f2('0x14')]['findOne']({'where':{'id':_0x1be66f[_0x27f2('0x15')]}})['then'](function(_0x442d1d){if(_0x442d1d){_0x442d1d[_0x27f2('0x16')]({'lastMsgAt':_0x1be66f['createdAt'],'lastMsgDirection':_0x1be66f[_0x27f2('0xe')][_0x27f2('0xf')]()});}})[_0x27f2('0x17')](function(_0x39fb1c){console[_0x27f2('0x18')](_0x39fb1c);});}_0x3b8234();}},'charset':'utf8mb4','collate':_0x27f2('0x19')});}; \ No newline at end of file +var _0xcedf=['toLowerCase','out','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','direction','catch','error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get'];(function(_0x15a23a,_0x167484){var _0x319ed1=function(_0x32b496){while(--_0x32b496){_0x15a23a['push'](_0x15a23a['shift']());}};_0x319ed1(++_0x167484);}(_0xcedf,0x1b0));var _0xfced=function(_0x1afac6,_0x111103){_0x1afac6=_0x1afac6-0x0;var _0x4fbca1=_0xcedf[_0x1afac6];return _0x4fbca1;};'use strict';var _=require(_0xfced('0x0'));var util=require(_0xfced('0x1'));var logger=require(_0xfced('0x2'))(_0xfced('0x3'));var moment=require(_0xfced('0x4'));var BPromise=require(_0xfced('0x5'));var rp=require(_0xfced('0x6'));var fs=require('fs');var path=require(_0xfced('0x7'));var rimraf=require(_0xfced('0x8'));var config=require('../../config/environment');var attributes=require(_0xfced('0x9'));module[_0xfced('0xa')]=function(_0x2ec564,_0x5a72d3){return _0x2ec564['define'](_0xfced('0xb'),attributes,{'tableName':_0xfced('0xc'),'paranoid':![],'indexes':[{'name':_0xfced('0xd'),'fields':[_0xfced('0xe')],'type':_0xfced('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2dd8e5,_0x4341ee,_0x380674){var _0x4d6b2f=_0x2ec564[_0xfced('0x10')];var _0x1fb279=_0x2dd8e5[_0xfced('0x11')]({'plain':!![]});if(_0x1fb279['direction'][_0xfced('0x12')]()==='in'||_0x1fb279['direction'][_0xfced('0x12')]()===_0xfced('0x13')&&!_0x1fb279['secret']&&!_['isNil'](_0x1fb279[_0xfced('0x14')])){_0x4d6b2f[_0xfced('0x15')][_0xfced('0x16')]({'where':{'id':_0x1fb279[_0xfced('0x17')]}})[_0xfced('0x18')](function(_0x42ce88){if(_0x42ce88){_0x42ce88[_0xfced('0x19')]({'lastMsgAt':_0x1fb279[_0xfced('0x1a')],'lastMsgDirection':_0x1fb279[_0xfced('0x1b')][_0xfced('0x12')]()});}})[_0xfced('0x1c')](function(_0x50b9a0){console[_0xfced('0x1d')](_0x50b9a0);});}_0x380674();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index df50174..4061a0e 100644 --- a/server/api/chatMessage/chatMessage.rpc.js +++ b/server/api/chatMessage/chatMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf04e=['socket.io-emitter','./chatMessage.socket','register','then','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ChatMessage','create','body','options','raw','info','CreateChatMessage','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x3c4370,_0x16a88b){var _0x184b69=function(_0xaa2d0d){while(--_0xaa2d0d){_0x3c4370['push'](_0x3c4370['shift']());}};_0x184b69(++_0x16a88b);}(_0xf04e,0x17e));var _0xef04=function(_0x39ba1b,_0x3185b4){_0x39ba1b=_0x39ba1b-0x0;var _0x15dabf=_0xf04e[_0x39ba1b];return _0x15dabf;};'use strict';var _=require(_0xef04('0x0'));var util=require(_0xef04('0x1'));var moment=require(_0xef04('0x2'));var BPromise=require(_0xef04('0x3'));var rs=require(_0xef04('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef04('0x5'))['db'];var utils=require(_0xef04('0x6'));var logger=require(_0xef04('0x7'))(_0xef04('0x8'));var config=require(_0xef04('0x9'));var jayson=require(_0xef04('0xa'));var client=jayson[_0xef04('0xb')]['http']({'port':0x232a});config[_0xef04('0xc')]=_[_0xef04('0xd')](config[_0xef04('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xef04('0xe'))(new Redis(config[_0xef04('0xc')]));require(_0xef04('0xf'))[_0xef04('0x10')](socket);function respondWithRpcPromise(_0xf2e4a2,_0x4c23ff,_0x3d340b){return new BPromise(function(_0x1e6f66,_0xf0129b){return client['request'](_0xf2e4a2,_0x3d340b)[_0xef04('0x11')](function(_0x4e604d){logger['info'](_0xef04('0x12'),_0x4c23ff,'request\x20sent');logger['debug'](_0xef04('0x13'),_0x4c23ff,_0xef04('0x14'),JSON[_0xef04('0x15')](_0x4e604d));if(_0x4e604d[_0xef04('0x16')]){if(_0x4e604d['error']['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x4c23ff,_0x4e604d[_0xef04('0x16')][_0xef04('0x17')]);return _0xf0129b(_0x4e604d[_0xef04('0x16')]['message']);}logger[_0xef04('0x16')](_0xef04('0x12'),_0x4c23ff,_0x4e604d[_0xef04('0x16')][_0xef04('0x17')]);return _0x1e6f66(_0x4e604d[_0xef04('0x16')][_0xef04('0x17')]);}else{logger['info'](_0xef04('0x12'),_0x4c23ff,_0xef04('0x14'));_0x1e6f66(_0x4e604d['result']['message']);}})['catch'](function(_0x277052){logger[_0xef04('0x16')](_0xef04('0x12'),_0x4c23ff,_0x277052);_0xf0129b(_0x277052);});});}exports['CreateChatMessage']=function(_0x52469d){var _0x29942d=this;return new Promise(function(_0x32a6e1,_0x2a94f7){return db[_0xef04('0x18')][_0xef04('0x19')](_0x52469d[_0xef04('0x1a')],{'raw':_0x52469d['options']?_0x52469d[_0xef04('0x1b')][_0xef04('0x1c')]===undefined?!![]:![]:!![]})[_0xef04('0x11')](function(_0x4356d6){logger[_0xef04('0x1d')](_0xef04('0x1e'),_0x52469d);logger[_0xef04('0x1f')](_0xef04('0x1e'),_0x52469d,JSON['stringify'](_0x4356d6));_0x32a6e1(_0x4356d6);})[_0xef04('0x20')](function(_0x4d6b20){logger[_0xef04('0x16')](_0xef04('0x1e'),_0x4d6b20[_0xef04('0x17')],_0x52469d);_0x2a94f7(_0x29942d[_0xef04('0x16')](0x1f4,_0x4d6b20[_0xef04('0x17')]));});});}; \ No newline at end of file +var _0x4e39=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatMessage','options','raw','CreateChatMessage','debug','lodash','util','moment'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x4e39,0x81));var _0x94e3=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x4e39[_0x1b70e3];return _0x1452ab;};'use strict';var _=require(_0x94e3('0x0'));var util=require(_0x94e3('0x1'));var moment=require(_0x94e3('0x2'));var BPromise=require('bluebird');var rs=require(_0x94e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94e3('0x4'))['db'];var utils=require(_0x94e3('0x5'));var logger=require(_0x94e3('0x6'))(_0x94e3('0x7'));var config=require(_0x94e3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x94e3('0x9')][_0x94e3('0xa')]({'port':0x232a});config[_0x94e3('0xb')]=_['defaults'](config[_0x94e3('0xb')],{'host':_0x94e3('0xc'),'port':0x18eb});var socket=require(_0x94e3('0xd'))(new Redis(config[_0x94e3('0xb')]));require(_0x94e3('0xe'))[_0x94e3('0xf')](socket);function respondWithRpcPromise(_0x8ca3d9,_0x410fff,_0x342fc6){return new BPromise(function(_0x150fcb,_0x1713d7){return client[_0x94e3('0x10')](_0x8ca3d9,_0x342fc6)[_0x94e3('0x11')](function(_0x5c53d2){logger[_0x94e3('0x12')](_0x94e3('0x13'),_0x410fff,_0x94e3('0x14'));logger['debug'](_0x94e3('0x15'),_0x410fff,'request\x20sent',JSON[_0x94e3('0x16')](_0x5c53d2));if(_0x5c53d2[_0x94e3('0x17')]){if(_0x5c53d2[_0x94e3('0x17')][_0x94e3('0x18')]===0x1f4){logger[_0x94e3('0x17')]('ChatMessage,\x20%s,\x20%s',_0x410fff,_0x5c53d2[_0x94e3('0x17')][_0x94e3('0x19')]);return _0x1713d7(_0x5c53d2['error'][_0x94e3('0x19')]);}logger[_0x94e3('0x17')]('ChatMessage,\x20%s,\x20%s',_0x410fff,_0x5c53d2['error']['message']);return _0x150fcb(_0x5c53d2[_0x94e3('0x17')]['message']);}else{logger[_0x94e3('0x12')](_0x94e3('0x13'),_0x410fff,'request\x20sent');_0x150fcb(_0x5c53d2[_0x94e3('0x1a')]['message']);}})[_0x94e3('0x1b')](function(_0x28f278){logger[_0x94e3('0x17')](_0x94e3('0x13'),_0x410fff,_0x28f278);_0x1713d7(_0x28f278);});});}exports['CreateChatMessage']=function(_0x381833){var _0x2ef940=this;return new Promise(function(_0x1aa6d6,_0x3e1a1b){return db[_0x94e3('0x1c')]['create'](_0x381833['body'],{'raw':_0x381833[_0x94e3('0x1d')]?_0x381833['options'][_0x94e3('0x1e')]===undefined?!![]:![]:!![]})[_0x94e3('0x11')](function(_0x32e708){logger['info'](_0x94e3('0x1f'),_0x381833);logger[_0x94e3('0x20')]('CreateChatMessage',_0x381833,JSON[_0x94e3('0x16')](_0x32e708));_0x1aa6d6(_0x32e708);})[_0x94e3('0x1b')](function(_0x1ea927){logger['error'](_0x94e3('0x1f'),_0x1ea927[_0x94e3('0x19')],_0x381833);_0x3e1a1b(_0x2ef940[_0x94e3('0x17')](0x1f4,_0x1ea927[_0x94e3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 214a62e..7865472 100644 --- a/server/api/chatMessage/chatMessage.socket.js +++ b/server/api/chatMessage/chatMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf61e=['chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x39cbe4,_0x4a7958){var _0xe76ba7=function(_0x332a08){while(--_0x332a08){_0x39cbe4['push'](_0x39cbe4['shift']());}};_0xe76ba7(++_0x4a7958);}(_0xf61e,0x191));var _0xef61=function(_0x37edc1,_0x41d7d4){_0x37edc1=_0x37edc1-0x0;var _0x5780a3=_0xf61e[_0x37edc1];return _0x5780a3;};'use strict';var ChatMessageEvents=require(_0xef61('0x0'));var events=[_0xef61('0x1'),_0xef61('0x2'),_0xef61('0x3')];function createListener(_0x205269,_0xeccd26){return function(_0x3613e6){_0xeccd26[_0xef61('0x4')](_0x205269,_0x3613e6);};}function removeListener(_0x2bd1d0,_0x14122a){return function(){ChatMessageEvents[_0xef61('0x5')](_0x2bd1d0,_0x14122a);};}exports[_0xef61('0x6')]=function(_0x5b00b2){for(var _0x9e17f4=0x0,_0x3e2f79=events['length'];_0x9e17f4<_0x3e2f79;_0x9e17f4++){var _0x2242a7=events[_0x9e17f4];var _0x277fa1=createListener(_0xef61('0x7')+_0x2242a7,_0x5b00b2);ChatMessageEvents['on'](_0x2242a7,_0x277fa1);}}; \ No newline at end of file +var _0x2ef3=['update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0xdf31a,_0x307e16){var _0x368de6=function(_0x2b40c4){while(--_0x2b40c4){_0xdf31a['push'](_0xdf31a['shift']());}};_0x368de6(++_0x307e16);}(_0x2ef3,0xba));var _0x32ef=function(_0x9b6d8c,_0x2a647c){_0x9b6d8c=_0x9b6d8c-0x0;var _0x5f38d6=_0x2ef3[_0x9b6d8c];return _0x5f38d6;};'use strict';var ChatMessageEvents=require(_0x32ef('0x0'));var events=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3')];function createListener(_0x3944df,_0x38047b){return function(_0x48106c){_0x38047b[_0x32ef('0x4')](_0x3944df,_0x48106c);};}function removeListener(_0x38b7f3,_0x524ab6){return function(){ChatMessageEvents[_0x32ef('0x5')](_0x38b7f3,_0x524ab6);};}exports[_0x32ef('0x6')]=function(_0x4c8104){for(var _0x5dfa09=0x0,_0x2c0089=events[_0x32ef('0x7')];_0x5dfa09<_0x2c0089;_0x5dfa09++){var _0x367c39=events[_0x5dfa09];var _0x2fb8eb=createListener(_0x32ef('0x8')+_0x367c39,_0x4c8104);ChatMessageEvents['on'](_0x367c39,_0x2fb8eb);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 653b109..0fea2ba 100644 --- a/server/api/chatMessage/index.js +++ b/server/api/chatMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e5e=['reject','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','describe','post','tracked','chat','chatmessage:create','put','/:id','update','/:id/accept','accept','/:id/reject'];(function(_0x3b40de,_0x125dfe){var _0x467042=function(_0x452b80){while(--_0x452b80){_0x3b40de['push'](_0x3b40de['shift']());}};_0x467042(++_0x125dfe);}(_0x2e5e,0xfe));var _0xe2e5=function(_0x5631ef,_0x5f3e87){_0x5631ef=_0x5631ef-0x0;var _0x3912fc=_0x2e5e[_0x5631ef];return _0x3912fc;};'use strict';var multer=require(_0xe2e5('0x0'));var util=require(_0xe2e5('0x1'));var path=require(_0xe2e5('0x2'));var timeout=require('connect-timeout');var express=require(_0xe2e5('0x3'));var router=express['Router']();var auth=require(_0xe2e5('0x4'));var interaction=require(_0xe2e5('0x5'));var config=require('../../config/environment');var controller=require(_0xe2e5('0x6'));router[_0xe2e5('0x7')]('/',auth[_0xe2e5('0x8')](),controller[_0xe2e5('0x9')]);router[_0xe2e5('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xe2e5('0xa')]);router[_0xe2e5('0x7')]('/:id',auth[_0xe2e5('0x8')](),controller['show']);router[_0xe2e5('0xb')]('/',auth[_0xe2e5('0x8')](),interaction[_0xe2e5('0xc')](_0xe2e5('0xd'),_0xe2e5('0xe')),controller['create']);router[_0xe2e5('0xf')](_0xe2e5('0x10'),controller[_0xe2e5('0x11')]);router[_0xe2e5('0xf')](_0xe2e5('0x12'),auth['isAuthenticated'](),controller[_0xe2e5('0x13')]);router[_0xe2e5('0xf')](_0xe2e5('0x14'),auth['isAuthenticated'](),controller[_0xe2e5('0x15')]);router[_0xe2e5('0x16')](_0xe2e5('0x10'),auth['isAuthenticated'](),controller[_0xe2e5('0x17')]);module[_0xe2e5('0x18')]=router; \ No newline at end of file +var _0x6413=['chat','chatmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked'];(function(_0x4ededc,_0x11aaa0){var _0x2e1618=function(_0x4df814){while(--_0x4df814){_0x4ededc['push'](_0x4ededc['shift']());}};_0x2e1618(++_0x11aaa0);}(_0x6413,0x1c3));var _0x3641=function(_0x531732,_0x5172db){_0x531732=_0x531732-0x0;var _0x3e94f8=_0x6413[_0x531732];return _0x3e94f8;};'use strict';var multer=require(_0x3641('0x0'));var util=require('util');var path=require(_0x3641('0x1'));var timeout=require(_0x3641('0x2'));var express=require(_0x3641('0x3'));var router=express['Router']();var auth=require(_0x3641('0x4'));var interaction=require(_0x3641('0x5'));var config=require(_0x3641('0x6'));var controller=require(_0x3641('0x7'));router[_0x3641('0x8')]('/',auth[_0x3641('0x9')](),controller[_0x3641('0xa')]);router[_0x3641('0x8')](_0x3641('0xb'),auth[_0x3641('0x9')](),controller[_0x3641('0xc')]);router[_0x3641('0x8')](_0x3641('0xd'),auth['isAuthenticated'](),controller[_0x3641('0xe')]);router[_0x3641('0xf')]('/',auth[_0x3641('0x9')](),interaction[_0x3641('0x10')](_0x3641('0x11'),_0x3641('0x12')),controller['create']);router[_0x3641('0x13')](_0x3641('0xd'),controller[_0x3641('0x14')]);router[_0x3641('0x13')](_0x3641('0x15'),auth[_0x3641('0x9')](),controller[_0x3641('0x16')]);router['put'](_0x3641('0x17'),auth[_0x3641('0x9')](),controller[_0x3641('0x18')]);router['delete']('/:id',auth[_0x3641('0x9')](),controller['destroy']);module[_0x3641('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 24ff4b4..f37c9b6 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07e6=['medium','sequelize','exports'];(function(_0x2dc96f,_0x459058){var _0xd012da=function(_0x38d032){while(--_0x38d032){_0x2dc96f['push'](_0x2dc96f['shift']());}};_0xd012da(++_0x459058);}(_0x07e6,0x199));var _0x607e=function(_0x57ef67,_0x4e7fb1){_0x57ef67=_0x57ef67-0x0;var _0x33f2a1=_0x07e6[_0x57ef67];return _0x33f2a1;};'use strict';var Sequelize=require(_0x607e('0x0'));module[_0x607e('0x1')]={'body':{'type':Sequelize['TEXT'](_0x607e('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x1cc9=['medium','exports','TEXT'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x1cc9,0x1f0));var _0x91cc=function(_0x447ef1,_0x374cd2){_0x447ef1=_0x447ef1-0x0;var _0x3d72ec=_0x1cc9[_0x447ef1];return _0x3d72ec;};'use strict';var Sequelize=require('sequelize');module[_0x91cc('0x0')]={'body':{'type':Sequelize[_0x91cc('0x1')](_0x91cc('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 7738b58..e60ddfc 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11e5=['request-promise','moment','bluebird','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','html-pdf','rimraf','zip-dir'];(function(_0x1aac31,_0xe597cd){var _0x43f285=function(_0x4b5fc7){while(--_0x4b5fc7){_0x1aac31['push'](_0x1aac31['shift']());}};_0x43f285(++_0xe597cd);}(_0x11e5,0x8b));var _0x511e=function(_0x1ea3b9,_0x3c6b2c){_0x1ea3b9=_0x1ea3b9-0x0;var _0x206d41=_0x11e5[_0x1ea3b9];return _0x206d41;};'use strict';var pdf=require(_0x511e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x511e('0x1'));var zipdir=require(_0x511e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x511e('0x3'));var moment=require(_0x511e('0x4'));var BPromise=require(_0x511e('0x5'));var Mustache=require('mustache');var util=require(_0x511e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x511e('0x7'));var ejs=require(_0x511e('0x8'));var fs=require('fs');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('0x7'));var querystring=require(_0x511e('0xc'));var Papa=require(_0x511e('0xd'));var Redis=require(_0x511e('0xe'));var authService=require(_0x511e('0xf'));var qs=require(_0x511e('0x10'));var as=require(_0x511e('0x11'));var hardwareService=require(_0x511e('0x12'));var logger=require(_0x511e('0x13'))('api');var utils=require(_0x511e('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3deecc,_0x327880){_0x327880=_0x327880||0xcc;return function(_0x42679e){if(_0x42679e){return _0x3deecc[_0x511e('0x15')](_0x327880);}return _0x3deecc[_0x511e('0x16')](_0x327880)[_0x511e('0x17')]();};}function respondWithResult(_0x4e72fd,_0xdd0dcd){_0xdd0dcd=_0xdd0dcd||0xc8;return function(_0x33fd64){if(_0x33fd64){return _0x4e72fd['status'](_0xdd0dcd)[_0x511e('0x18')](_0x33fd64);}};}function respondWithFilteredResult(_0x43a329,_0x4f50b9){return function(_0xed773e){if(_0xed773e){var _0x162c91=_0xed773e[_0x511e('0x19')],_0x3b990b=_0x4f50b9[_0x511e('0x1a')],_0x17fd4a=_0x4f50b9[_0x511e('0x1a')]+_0x4f50b9['limit'],_0x5b6cd6;if(_0x17fd4a>=_0x162c91){_0x17fd4a=_0x162c91;_0x5b6cd6=0xc8;}else{_0x5b6cd6=0xce;}_0x43a329[_0x511e('0x16')](_0x5b6cd6);return _0x43a329['set'](_0x511e('0x1b'),_0x3b990b+'-'+_0x17fd4a+'/'+_0x162c91)['json'](_0xed773e);}return null;};}function patchUpdates(_0x5821ee){return function(_0x37ae92){try{jsonpatch['apply'](_0x37ae92,_0x5821ee,!![]);}catch(_0x33bef5){return BPromise[_0x511e('0x1c')](_0x33bef5);}return _0x37ae92[_0x511e('0x1d')]();};}function saveUpdates(_0x3cbc5a,_0xd4df6f){return function(_0x3d3f46){if(_0x3d3f46){return _0x3d3f46[_0x511e('0x1e')](_0x3cbc5a)[_0x511e('0x1f')](function(_0x4a8067){return _0x4a8067;});}return null;};}function removeEntity(_0x1e2b41,_0x39e0b4){return function(_0x2ebf30){if(_0x2ebf30){return _0x2ebf30[_0x511e('0x20')]()[_0x511e('0x1f')](function(){_0x1e2b41[_0x511e('0x16')](0xcc)[_0x511e('0x17')]();});}};}function handleEntityNotFound(_0x2f28fc,_0x211b90){return function(_0x26618d){if(!_0x26618d){_0x2f28fc['sendStatus'](0x194);}return _0x26618d;};}function handleError(_0x4ad22b,_0x3e1711){_0x3e1711=_0x3e1711||0x1f4;return function(_0x4d94a1){logger[_0x511e('0x21')](_0x4d94a1['stack']);if(_0x4d94a1[_0x511e('0x22')]){delete _0x4d94a1[_0x511e('0x22')];}_0x4ad22b[_0x511e('0x16')](_0x3e1711)[_0x511e('0x23')](_0x4d94a1);};}exports[_0x511e('0x24')]=function(_0x9dfe29,_0x3c057c){var _0x4d89a5={},_0x309695={},_0x2451c2={'count':0x0,'rows':[]};var _0x5b72fe=_[_0x511e('0x25')](db[_0x511e('0x26')][_0x511e('0x27')],function(_0x1aaac1){return{'name':_0x1aaac1[_0x511e('0x28')],'type':_0x1aaac1['type'][_0x511e('0x29')]};});_0x309695['model']=_['map'](_0x5b72fe,_0x511e('0x22'));_0x309695[_0x511e('0x2a')]=_[_0x511e('0x2b')](_0x9dfe29[_0x511e('0x2a')]);_0x309695[_0x511e('0x2c')]=_['intersection'](_0x309695[_0x511e('0x2d')],_0x309695[_0x511e('0x2a')]);_0x4d89a5[_0x511e('0x2e')]=_[_0x511e('0x2f')](_0x309695[_0x511e('0x2d')],qs['fields'](_0x9dfe29[_0x511e('0x2a')][_0x511e('0x30')]));_0x4d89a5[_0x511e('0x2e')]=_0x4d89a5[_0x511e('0x2e')][_0x511e('0x31')]?_0x4d89a5[_0x511e('0x2e')]:_0x309695[_0x511e('0x2d')];if(!_0x9dfe29[_0x511e('0x2a')]['hasOwnProperty'](_0x511e('0x32'))){_0x4d89a5[_0x511e('0x33')]=qs[_0x511e('0x33')](_0x9dfe29[_0x511e('0x2a')]['limit']);_0x4d89a5['offset']=qs[_0x511e('0x1a')](_0x9dfe29['query']['offset']);}_0x4d89a5[_0x511e('0x34')]=qs[_0x511e('0x35')](_0x9dfe29[_0x511e('0x2a')][_0x511e('0x35')]);_0x4d89a5[_0x511e('0x36')]=qs['filters'](_[_0x511e('0x37')](_0x9dfe29[_0x511e('0x2a')],_0x309695[_0x511e('0x2c')]),_0x5b72fe);if(_0x9dfe29['query'][_0x511e('0x38')]){_0x4d89a5[_0x511e('0x36')]=_[_0x511e('0x39')](_0x4d89a5['where'],{'$or':_[_0x511e('0x25')](_0x5b72fe,function(_0x2fd83d){if(_0x2fd83d['type']!==_0x511e('0x3a')){var _0xff2428={};_0xff2428[_0x2fd83d[_0x511e('0x22')]]={'$like':'%'+_0x9dfe29[_0x511e('0x2a')][_0x511e('0x38')]+'%'};return _0xff2428;}})});}_0x4d89a5=_[_0x511e('0x39')]({},_0x4d89a5,_0x9dfe29[_0x511e('0x3b')]);var _0x8cc26e={'where':_0x4d89a5[_0x511e('0x36')]};return db[_0x511e('0x26')][_0x511e('0x19')](_0x8cc26e)['then'](function(_0x4014b6){_0x2451c2['count']=_0x4014b6;if(_0x9dfe29['query'][_0x511e('0x3c')]){_0x4d89a5['include']=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x511e('0x3d')](_0x4d89a5);})[_0x511e('0x1f')](function(_0x3c0ef4){_0x2451c2[_0x511e('0x3e')]=_0x3c0ef4;return _0x2451c2;})[_0x511e('0x1f')](respondWithFilteredResult(_0x3c057c,_0x4d89a5))[_0x511e('0x3f')](handleError(_0x3c057c,null));};exports[_0x511e('0x40')]=function(_0x27a78a,_0x215f1d){var _0x396542={'raw':!![],'where':{'id':_0x27a78a[_0x511e('0x41')]['id']}},_0x26b1be={};_0x26b1be[_0x511e('0x2d')]=_[_0x511e('0x2b')](db['ChatOfflineMessage']['rawAttributes']);_0x26b1be[_0x511e('0x2a')]=_[_0x511e('0x2b')](_0x27a78a[_0x511e('0x2a')]);_0x26b1be[_0x511e('0x2c')]=_[_0x511e('0x2f')](_0x26b1be['model'],_0x26b1be[_0x511e('0x2a')]);_0x396542[_0x511e('0x2e')]=_[_0x511e('0x2f')](_0x26b1be['model'],qs['fields'](_0x27a78a['query'][_0x511e('0x30')]));_0x396542[_0x511e('0x2e')]=_0x396542[_0x511e('0x2e')]['length']?_0x396542['attributes']:_0x26b1be['model'];if(_0x27a78a[_0x511e('0x2a')][_0x511e('0x3c')]){_0x396542[_0x511e('0x42')]=[{'all':!![]}];}_0x396542=_[_0x511e('0x39')]({},_0x396542,_0x27a78a[_0x511e('0x3b')]);return db[_0x511e('0x26')][_0x511e('0x43')](_0x396542)[_0x511e('0x1f')](handleEntityNotFound(_0x215f1d,null))[_0x511e('0x1f')](respondWithResult(_0x215f1d,null))[_0x511e('0x3f')](handleError(_0x215f1d,null));};exports[_0x511e('0x44')]=function(_0x354f06,_0x19a6c8){return db[_0x511e('0x26')][_0x511e('0x44')](_0x354f06[_0x511e('0x45')],{})[_0x511e('0x1f')](respondWithResult(_0x19a6c8,0xc9))[_0x511e('0x3f')](handleError(_0x19a6c8,null));};exports[_0x511e('0x1e')]=function(_0x2c2573,_0x2a00a5){if(_0x2c2573[_0x511e('0x45')]['id']){delete _0x2c2573[_0x511e('0x45')]['id'];}return db[_0x511e('0x26')][_0x511e('0x43')]({'where':{'id':_0x2c2573[_0x511e('0x41')]['id']}})[_0x511e('0x1f')](handleEntityNotFound(_0x2a00a5,null))[_0x511e('0x1f')](saveUpdates(_0x2c2573[_0x511e('0x45')],null))[_0x511e('0x1f')](respondWithResult(_0x2a00a5,null))[_0x511e('0x3f')](handleError(_0x2a00a5,null));};exports['destroy']=function(_0x1cd147,_0x56bfd4){return db[_0x511e('0x26')][_0x511e('0x43')]({'where':{'id':_0x1cd147[_0x511e('0x41')]['id']}})['then'](handleEntityNotFound(_0x56bfd4,null))[_0x511e('0x1f')](removeEntity(_0x56bfd4,null))[_0x511e('0x3f')](handleError(_0x56bfd4,null));};exports[_0x511e('0x46')]=function(_0x5cc04d,_0x320487){return db[_0x511e('0x26')]['describe']()[_0x511e('0x1f')](respondWithResult(_0x320487,null))[_0x511e('0x3f')](handleError(_0x320487,null));}; \ No newline at end of file +var _0x4fb4=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','count','include','rows','show','params','includeAll','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','then','destroy','error','stack','name','map','ChatOfflineMessage','rawAttributes','key','keys','query','filters','intersection','model'];(function(_0x39b085,_0x41f18e){var _0x206ea9=function(_0x144e3e){while(--_0x144e3e){_0x39b085['push'](_0x39b085['shift']());}};_0x206ea9(++_0x41f18e);}(_0x4fb4,0x190));var _0x44fb=function(_0xd0622c,_0x142253){_0xd0622c=_0xd0622c-0x0;var _0x378332=_0x4fb4[_0xd0622c];return _0x378332;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x44fb('0x0'));var rimraf=require(_0x44fb('0x1'));var zipdir=require(_0x44fb('0x2'));var jsonpatch=require(_0x44fb('0x3'));var rp=require(_0x44fb('0x4'));var moment=require(_0x44fb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x44fb('0x6'));var util=require(_0x44fb('0x7'));var path=require(_0x44fb('0x8'));var sox=require(_0x44fb('0x9'));var csv=require(_0x44fb('0xa'));var ejs=require(_0x44fb('0xb'));var fs=require('fs');var _=require(_0x44fb('0xc'));var squel=require(_0x44fb('0xd'));var crypto=require('crypto');var jsforce=require(_0x44fb('0xe'));var deskjs=require(_0x44fb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x44fb('0x10'));var Papa=require(_0x44fb('0x11'));var Redis=require(_0x44fb('0x12'));var authService=require(_0x44fb('0x13'));var qs=require(_0x44fb('0x14'));var as=require(_0x44fb('0x15'));var hardwareService=require(_0x44fb('0x16'));var logger=require(_0x44fb('0x17'))(_0x44fb('0x18'));var utils=require(_0x44fb('0x19'));var config=require('../../config/environment');var db=require(_0x44fb('0x1a'))['db'];function respondWithStatusCode(_0x1e8a60,_0x40cb86){_0x40cb86=_0x40cb86||0xcc;return function(_0x103b56){if(_0x103b56){return _0x1e8a60[_0x44fb('0x1b')](_0x40cb86);}return _0x1e8a60['status'](_0x40cb86)[_0x44fb('0x1c')]();};}function respondWithResult(_0xaedd7f,_0x39fb83){_0x39fb83=_0x39fb83||0xc8;return function(_0x449150){if(_0x449150){return _0xaedd7f[_0x44fb('0x1d')](_0x39fb83)['json'](_0x449150);}};}function respondWithFilteredResult(_0xbc84db,_0x18268c){return function(_0x472658){if(_0x472658){var _0x147fe0=_0x472658['count'],_0x550b32=_0x18268c[_0x44fb('0x1e')],_0x43ce3=_0x18268c[_0x44fb('0x1e')]+_0x18268c[_0x44fb('0x1f')],_0x19b828;if(_0x43ce3>=_0x147fe0){_0x43ce3=_0x147fe0;_0x19b828=0xc8;}else{_0x19b828=0xce;}_0xbc84db[_0x44fb('0x1d')](_0x19b828);return _0xbc84db[_0x44fb('0x20')](_0x44fb('0x21'),_0x550b32+'-'+_0x43ce3+'/'+_0x147fe0)[_0x44fb('0x22')](_0x472658);}return null;};}function patchUpdates(_0x1074cd){return function(_0x44e6de){try{jsonpatch[_0x44fb('0x23')](_0x44e6de,_0x1074cd,!![]);}catch(_0x5eafcb){return BPromise['reject'](_0x5eafcb);}return _0x44e6de['save']();};}function saveUpdates(_0x4188f9,_0xca80c){return function(_0x2dd412){if(_0x2dd412){return _0x2dd412['update'](_0x4188f9)[_0x44fb('0x24')](function(_0x11449d){return _0x11449d;});}return null;};}function removeEntity(_0x3394e2,_0x5adc98){return function(_0x558283){if(_0x558283){return _0x558283[_0x44fb('0x25')]()[_0x44fb('0x24')](function(){_0x3394e2[_0x44fb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x954b1d,_0x3563a6){return function(_0x1f3d5c){if(!_0x1f3d5c){_0x954b1d['sendStatus'](0x194);}return _0x1f3d5c;};}function handleError(_0x5cd889,_0x105b88){_0x105b88=_0x105b88||0x1f4;return function(_0xa50a49){logger[_0x44fb('0x26')](_0xa50a49[_0x44fb('0x27')]);if(_0xa50a49['name']){delete _0xa50a49[_0x44fb('0x28')];}_0x5cd889[_0x44fb('0x1d')](_0x105b88)['send'](_0xa50a49);};}exports['index']=function(_0x4aaab6,_0x2611d6){var _0x1560eb={},_0x1f5d4c={},_0xb7e5e8={'count':0x0,'rows':[]};var _0x15e748=_[_0x44fb('0x29')](db[_0x44fb('0x2a')][_0x44fb('0x2b')],function(_0x4f079d){return{'name':_0x4f079d['fieldName'],'type':_0x4f079d['type'][_0x44fb('0x2c')]};});_0x1f5d4c['model']=_[_0x44fb('0x29')](_0x15e748,_0x44fb('0x28'));_0x1f5d4c['query']=_[_0x44fb('0x2d')](_0x4aaab6[_0x44fb('0x2e')]);_0x1f5d4c[_0x44fb('0x2f')]=_[_0x44fb('0x30')](_0x1f5d4c[_0x44fb('0x31')],_0x1f5d4c['query']);_0x1560eb['attributes']=_[_0x44fb('0x30')](_0x1f5d4c['model'],qs[_0x44fb('0x32')](_0x4aaab6[_0x44fb('0x2e')][_0x44fb('0x32')]));_0x1560eb[_0x44fb('0x33')]=_0x1560eb[_0x44fb('0x33')][_0x44fb('0x34')]?_0x1560eb[_0x44fb('0x33')]:_0x1f5d4c[_0x44fb('0x31')];if(!_0x4aaab6[_0x44fb('0x2e')][_0x44fb('0x35')](_0x44fb('0x36'))){_0x1560eb[_0x44fb('0x1f')]=qs[_0x44fb('0x1f')](_0x4aaab6[_0x44fb('0x2e')][_0x44fb('0x1f')]);_0x1560eb['offset']=qs['offset'](_0x4aaab6['query'][_0x44fb('0x1e')]);}_0x1560eb[_0x44fb('0x37')]=qs[_0x44fb('0x38')](_0x4aaab6[_0x44fb('0x2e')]['sort']);_0x1560eb[_0x44fb('0x39')]=qs[_0x44fb('0x2f')](_['pick'](_0x4aaab6[_0x44fb('0x2e')],_0x1f5d4c['filters']),_0x15e748);if(_0x4aaab6[_0x44fb('0x2e')]['filter']){_0x1560eb[_0x44fb('0x39')]=_['merge'](_0x1560eb[_0x44fb('0x39')],{'$or':_['map'](_0x15e748,function(_0x5aa5f4){if(_0x5aa5f4[_0x44fb('0x3a')]!==_0x44fb('0x3b')){var _0x41a668={};_0x41a668[_0x5aa5f4[_0x44fb('0x28')]]={'$like':'%'+_0x4aaab6[_0x44fb('0x2e')][_0x44fb('0x3c')]+'%'};return _0x41a668;}})});}_0x1560eb=_[_0x44fb('0x3d')]({},_0x1560eb,_0x4aaab6[_0x44fb('0x3e')]);var _0xb96aa4={'where':_0x1560eb[_0x44fb('0x39')]};return db['ChatOfflineMessage'][_0x44fb('0x3f')](_0xb96aa4)[_0x44fb('0x24')](function(_0x3e1040){_0xb7e5e8[_0x44fb('0x3f')]=_0x3e1040;if(_0x4aaab6[_0x44fb('0x2e')]['includeAll']){_0x1560eb[_0x44fb('0x40')]=[{'all':!![]}];}return db[_0x44fb('0x2a')]['findAll'](_0x1560eb);})['then'](function(_0x3dc86f){_0xb7e5e8[_0x44fb('0x41')]=_0x3dc86f;return _0xb7e5e8;})[_0x44fb('0x24')](respondWithFilteredResult(_0x2611d6,_0x1560eb))['catch'](handleError(_0x2611d6,null));};exports[_0x44fb('0x42')]=function(_0x80efc3,_0x3fdd9d){var _0x2bfb76={'raw':!![],'where':{'id':_0x80efc3[_0x44fb('0x43')]['id']}},_0x8f8aae={};_0x8f8aae['model']=_[_0x44fb('0x2d')](db['ChatOfflineMessage'][_0x44fb('0x2b')]);_0x8f8aae[_0x44fb('0x2e')]=_[_0x44fb('0x2d')](_0x80efc3[_0x44fb('0x2e')]);_0x8f8aae['filters']=_[_0x44fb('0x30')](_0x8f8aae[_0x44fb('0x31')],_0x8f8aae[_0x44fb('0x2e')]);_0x2bfb76[_0x44fb('0x33')]=_[_0x44fb('0x30')](_0x8f8aae['model'],qs[_0x44fb('0x32')](_0x80efc3[_0x44fb('0x2e')][_0x44fb('0x32')]));_0x2bfb76[_0x44fb('0x33')]=_0x2bfb76['attributes']['length']?_0x2bfb76[_0x44fb('0x33')]:_0x8f8aae[_0x44fb('0x31')];if(_0x80efc3['query'][_0x44fb('0x44')]){_0x2bfb76['include']=[{'all':!![]}];}_0x2bfb76=_['merge']({},_0x2bfb76,_0x80efc3['options']);return db['ChatOfflineMessage'][_0x44fb('0x45')](_0x2bfb76)[_0x44fb('0x24')](handleEntityNotFound(_0x3fdd9d,null))[_0x44fb('0x24')](respondWithResult(_0x3fdd9d,null))[_0x44fb('0x46')](handleError(_0x3fdd9d,null));};exports['create']=function(_0xf27802,_0x2bf1e0){return db[_0x44fb('0x2a')][_0x44fb('0x47')](_0xf27802[_0x44fb('0x48')],{})[_0x44fb('0x24')](respondWithResult(_0x2bf1e0,0xc9))[_0x44fb('0x46')](handleError(_0x2bf1e0,null));};exports[_0x44fb('0x49')]=function(_0x4d9e1c,_0x255989){if(_0x4d9e1c['body']['id']){delete _0x4d9e1c['body']['id'];}return db[_0x44fb('0x2a')][_0x44fb('0x45')]({'where':{'id':_0x4d9e1c[_0x44fb('0x43')]['id']}})['then'](handleEntityNotFound(_0x255989,null))[_0x44fb('0x24')](saveUpdates(_0x4d9e1c[_0x44fb('0x48')],null))[_0x44fb('0x24')](respondWithResult(_0x255989,null))[_0x44fb('0x46')](handleError(_0x255989,null));};exports[_0x44fb('0x25')]=function(_0x2547a9,_0x24eb8a){return db['ChatOfflineMessage'][_0x44fb('0x45')]({'where':{'id':_0x2547a9['params']['id']}})[_0x44fb('0x24')](handleEntityNotFound(_0x24eb8a,null))['then'](removeEntity(_0x24eb8a,null))[_0x44fb('0x46')](handleError(_0x24eb8a,null));};exports[_0x44fb('0x4a')]=function(_0xf56878,_0x82975){return db['ChatOfflineMessage'][_0x44fb('0x4a')]()[_0x44fb('0x24')](respondWithResult(_0x82975,null))[_0x44fb('0x46')](handleError(_0x82975,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index f194ea9..77dbc7c 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 _0x9a19=['exports','define','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x9a19,0x114));var _0x99a1=function(_0x4b6830,_0x2bf6fb){_0x4b6830=_0x4b6830-0x0;var _0x239e4a=_0x9a19[_0x4b6830];return _0x239e4a;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x99a1('0xc')});}; \ No newline at end of file +var _0x9f62=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','util','api','moment','bluebird','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0x9f62,0x154));var _0x29f6=function(_0x108adc,_0x5285fa){_0x108adc=_0x108adc-0x0;var _0xa577a2=_0x9f62[_0x108adc];return _0xa577a2;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x29f6('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index d99ff21..279f416 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 _0xb5e2=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x287195,_0x337e5d){var _0x545b3c=function(_0x36fa52){while(--_0x36fa52){_0x287195['push'](_0x287195['shift']());}};_0x545b3c(++_0x337e5d);}(_0xb5e2,0x135));var _0x2b5e=function(_0x19868d,_0x10bd0b){_0x19868d=_0x19868d-0x0;var _0x4d8040=_0xb5e2[_0x19868d];return _0x4d8040;};'use strict';var _=require(_0x2b5e('0x0'));var util=require(_0x2b5e('0x1'));var moment=require(_0x2b5e('0x2'));var BPromise=require(_0x2b5e('0x3'));var rs=require(_0x2b5e('0x4'));var fs=require('fs');var Redis=require(_0x2b5e('0x5'));var db=require(_0x2b5e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b5e('0x7'))(_0x2b5e('0x8'));var config=require('../../config/environment');var jayson=require(_0x2b5e('0x9'));var client=jayson[_0x2b5e('0xa')][_0x2b5e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c0188,_0x114681,_0x52c584){return new BPromise(function(_0x2d2807,_0x30843d){return client['request'](_0x2c0188,_0x52c584)[_0x2b5e('0xc')](function(_0x1866dd){logger[_0x2b5e('0xd')](_0x2b5e('0xe'),_0x114681,_0x2b5e('0xf'));logger[_0x2b5e('0x10')](_0x2b5e('0x11'),_0x114681,_0x2b5e('0xf'),JSON[_0x2b5e('0x12')](_0x1866dd));if(_0x1866dd[_0x2b5e('0x13')]){if(_0x1866dd['error']['code']===0x1f4){logger[_0x2b5e('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x114681,_0x1866dd[_0x2b5e('0x13')][_0x2b5e('0x14')]);return _0x30843d(_0x1866dd['error'][_0x2b5e('0x14')]);}logger[_0x2b5e('0x13')](_0x2b5e('0xe'),_0x114681,_0x1866dd[_0x2b5e('0x13')][_0x2b5e('0x14')]);return _0x2d2807(_0x1866dd['error']['message']);}else{logger[_0x2b5e('0xd')](_0x2b5e('0xe'),_0x114681,_0x2b5e('0xf'));_0x2d2807(_0x1866dd[_0x2b5e('0x15')][_0x2b5e('0x14')]);}})['catch'](function(_0x5d0d89){logger['error'](_0x2b5e('0xe'),_0x114681,_0x5d0d89);_0x30843d(_0x5d0d89);});});} \ No newline at end of file +var _0x61ea=['jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1d4c90,_0x342292){var _0x167489=function(_0x3e0fd5){while(--_0x3e0fd5){_0x1d4c90['push'](_0x1d4c90['shift']());}};_0x167489(++_0x342292);}(_0x61ea,0xc7));var _0xa61e=function(_0x396ed9,_0xdcf8ed){_0x396ed9=_0x396ed9-0x0;var _0x10af6e=_0x61ea[_0x396ed9];return _0x10af6e;};'use strict';var _=require(_0xa61e('0x0'));var util=require(_0xa61e('0x1'));var moment=require(_0xa61e('0x2'));var BPromise=require(_0xa61e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa61e('0x4'));var db=require(_0xa61e('0x5'))['db'];var utils=require(_0xa61e('0x6'));var logger=require('../../config/logger')(_0xa61e('0x7'));var config=require('../../config/environment');var jayson=require(_0xa61e('0x8'));var client=jayson[_0xa61e('0x9')][_0xa61e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59d918,_0x515737,_0x1b216a){return new BPromise(function(_0x3510ed,_0x32ee0d){return client[_0xa61e('0xb')](_0x59d918,_0x1b216a)[_0xa61e('0xc')](function(_0x31ab83){logger[_0xa61e('0xd')](_0xa61e('0xe'),_0x515737,_0xa61e('0xf'));logger[_0xa61e('0x10')](_0xa61e('0x11'),_0x515737,_0xa61e('0xf'),JSON[_0xa61e('0x12')](_0x31ab83));if(_0x31ab83['error']){if(_0x31ab83[_0xa61e('0x13')][_0xa61e('0x14')]===0x1f4){logger['error'](_0xa61e('0xe'),_0x515737,_0x31ab83[_0xa61e('0x13')][_0xa61e('0x15')]);return _0x32ee0d(_0x31ab83[_0xa61e('0x13')][_0xa61e('0x15')]);}logger['error'](_0xa61e('0xe'),_0x515737,_0x31ab83['error'][_0xa61e('0x15')]);return _0x3510ed(_0x31ab83[_0xa61e('0x13')]['message']);}else{logger[_0xa61e('0xd')](_0xa61e('0xe'),_0x515737,_0xa61e('0xf'));_0x3510ed(_0x31ab83['result'][_0xa61e('0x15')]);}})[_0xa61e('0x16')](function(_0x19f1ab){logger['error'](_0xa61e('0xe'),_0x515737,_0x19f1ab);_0x32ee0d(_0x19f1ab);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 5dcecd3..2d183c5 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 _0xdfe8=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer'];(function(_0x3e4e7e,_0x558667){var _0x3cfab1=function(_0x2b2769){while(--_0x2b2769){_0x3e4e7e['push'](_0x3e4e7e['shift']());}};_0x3cfab1(++_0x558667);}(_0xdfe8,0x8b));var _0x8dfe=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0xdfe8[_0xd816e2];return _0x1f5924;};'use strict';var multer=require(_0x8dfe('0x0'));var util=require(_0x8dfe('0x1'));var path=require(_0x8dfe('0x2'));var timeout=require(_0x8dfe('0x3'));var express=require('express');var router=express[_0x8dfe('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8dfe('0x5'));var config=require(_0x8dfe('0x6'));var controller=require(_0x8dfe('0x7'));router[_0x8dfe('0x8')]('/',auth[_0x8dfe('0x9')](),controller[_0x8dfe('0xa')]);router[_0x8dfe('0x8')](_0x8dfe('0xb'),auth['isAuthenticated'](),controller[_0x8dfe('0xc')]);router[_0x8dfe('0x8')](_0x8dfe('0xd'),auth[_0x8dfe('0x9')](),controller[_0x8dfe('0xe')]);router[_0x8dfe('0xf')]('/',auth[_0x8dfe('0x9')](),controller['create']);router[_0x8dfe('0x10')](_0x8dfe('0xd'),auth[_0x8dfe('0x9')](),controller['update']);router[_0x8dfe('0x11')](_0x8dfe('0xd'),auth[_0x8dfe('0x9')](),controller[_0x8dfe('0x12')]);module[_0x8dfe('0x13')]=router; \ No newline at end of file +var _0x9442=['/:id','create','update','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x2cf80f,_0x5df107){var _0x544c5b=function(_0x4cc02c){while(--_0x4cc02c){_0x2cf80f['push'](_0x2cf80f['shift']());}};_0x544c5b(++_0x5df107);}(_0x9442,0x1b6));var _0x2944=function(_0x1823bc,_0x2e97d0){_0x1823bc=_0x1823bc-0x0;var _0x1d47cf=_0x9442[_0x1823bc];return _0x1d47cf;};'use strict';var multer=require(_0x2944('0x0'));var util=require(_0x2944('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2944('0x2'));var router=express[_0x2944('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2944('0x4'));var config=require(_0x2944('0x5'));var controller=require(_0x2944('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x2944('0x7')]);router[_0x2944('0x8')](_0x2944('0x9'),auth[_0x2944('0xa')](),controller[_0x2944('0xb')]);router['get'](_0x2944('0xc'),auth[_0x2944('0xa')](),controller['show']);router['post']('/',auth[_0x2944('0xa')](),controller[_0x2944('0xd')]);router['put'](_0x2944('0xc'),auth[_0x2944('0xa')](),controller[_0x2944('0xe')]);router[_0x2944('0xf')](_0x2944('0xc'),auth[_0x2944('0xa')](),controller[_0x2944('0x10')]);module[_0x2944('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 edeb5b9..a1f436d 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 _0x1599=['exports','STRING','mouseOver','timeout','INTEGER','sequelize'];(function(_0x132ae5,_0x27b7a6){var _0x132432=function(_0x39c000){while(--_0x39c000){_0x132ae5['push'](_0x132ae5['shift']());}};_0x132432(++_0x27b7a6);}(_0x1599,0x1af));var _0x9159=function(_0x13a23e,_0x5a2c8d){_0x13a23e=_0x13a23e-0x0;var _0x3456ef=_0x1599[_0x13a23e];return _0x3456ef;};'use strict';var Sequelize=require(_0x9159('0x0'));module[_0x9159('0x1')]={'name':{'type':Sequelize[_0x9159('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9159('0x3'),_0x9159('0x4')),'defaultValue':_0x9159('0x3')},'selector':{'type':Sequelize[_0x9159('0x2')]},'timeout':{'type':Sequelize[_0x9159('0x5')]}}; \ No newline at end of file +var _0x922e=['mouseOver','exports','STRING'];(function(_0x18c684,_0x4ab29b){var _0x452353=function(_0x463788){while(--_0x463788){_0x18c684['push'](_0x18c684['shift']());}};_0x452353(++_0x4ab29b);}(_0x922e,0xa0));var _0xe922=function(_0x1b38e8,_0x237fe2){_0x1b38e8=_0x1b38e8-0x0;var _0x5c27d2=_0x922e[_0x1b38e8];return _0x5c27d2;};'use strict';var Sequelize=require('sequelize');module[_0xe922('0x0')]={'name':{'type':Sequelize[_0xe922('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe922('0x2'),'timeout'),'defaultValue':_0xe922('0x2')},'selector':{'type':Sequelize[_0xe922('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 26e158d..76af0e1 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 _0x9c44=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','params','model','keys','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','merge','options','catch','create','ChatProactiveAction','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs'];(function(_0xb9e9e6,_0x4247bd){var _0x3f57bb=function(_0x24dbcb){while(--_0x24dbcb){_0xb9e9e6['push'](_0xb9e9e6['shift']());}};_0x3f57bb(++_0x4247bd);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){_0x2197d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2263ae,_0x15581b){return function(_0x26c640){if(!_0x26c640){_0x2263ae[_0x49c4('0x14')](0x194);}return _0x26c640;};}function handleError(_0x4811c4,_0x5850f2){_0x5850f2=_0x5850f2||0x1f4;return function(_0x180276){logger[_0x49c4('0x21')](_0x180276['stack']);if(_0x180276[_0x49c4('0x22')]){delete _0x180276[_0x49c4('0x22')];}_0x4811c4[_0x49c4('0x16')](_0x5850f2)[_0x49c4('0x23')](_0x180276);};}exports['show']=function(_0x543ea2,_0x449960){var _0x53c199={'raw':!![],'where':{'id':_0x543ea2[_0x49c4('0x24')]['id']}},_0x3800b7={};_0x3800b7[_0x49c4('0x25')]=_[_0x49c4('0x26')](db['ChatProactiveAction'][_0x49c4('0x27')]);_0x3800b7[_0x49c4('0x28')]=_[_0x49c4('0x26')](_0x543ea2[_0x49c4('0x28')]);_0x3800b7[_0x49c4('0x29')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],_0x3800b7[_0x49c4('0x28')]);_0x53c199[_0x49c4('0x2b')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],qs['fields'](_0x543ea2['query']['fields']));_0x53c199[_0x49c4('0x2b')]=_0x53c199[_0x49c4('0x2b')][_0x49c4('0x2c')]?_0x53c199[_0x49c4('0x2b')]:_0x3800b7[_0x49c4('0x25')];if(_0x543ea2['query'][_0x49c4('0x2d')]){_0x53c199[_0x49c4('0x2e')]=[{'all':!![]}];}_0x53c199=_[_0x49c4('0x2f')]({},_0x53c199,_0x543ea2[_0x49c4('0x30')]);return db['ChatProactiveAction']['find'](_0x53c199)[_0x49c4('0x20')](handleEntityNotFound(_0x449960,null))[_0x49c4('0x20')](respondWithResult(_0x449960,null))[_0x49c4('0x31')](handleError(_0x449960,null));};exports[_0x49c4('0x32')]=function(_0xd38540,_0x4a0c7a){return db[_0x49c4('0x33')][_0x49c4('0x32')](_0xd38540[_0x49c4('0x34')],{})['then'](respondWithResult(_0x4a0c7a,0xc9))['catch'](handleError(_0x4a0c7a,null));};exports[_0x49c4('0x1f')]=function(_0x1991e9,_0x3bec0a){if(_0x1991e9[_0x49c4('0x34')]['id']){delete _0x1991e9[_0x49c4('0x34')]['id'];}return db[_0x49c4('0x33')][_0x49c4('0x35')]({'where':{'id':_0x1991e9[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x3bec0a,null))['then'](saveUpdates(_0x1991e9[_0x49c4('0x34')],null))['then'](respondWithResult(_0x3bec0a,null))[_0x49c4('0x31')](handleError(_0x3bec0a,null));};exports[_0x49c4('0x36')]=function(_0x2625a6,_0x1c2830){return db['ChatProactiveAction'][_0x49c4('0x35')]({'where':{'id':_0x2625a6[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x1c2830,null))['then'](removeEntity(_0x1c2830,null))[_0x49c4('0x31')](handleError(_0x1c2830,null));}; \ No newline at end of file +var _0xd8b0=['eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','params','keys','rawAttributes','filters','model','attributes','intersection','length','query','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','html-pdf'];(function(_0x43df8b,_0x163b58){var _0x3268fd=function(_0x190e88){while(--_0x190e88){_0x43df8b['push'](_0x43df8b['shift']());}};_0x3268fd(++_0x163b58);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');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('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){_0x33fb87[_0x0d8b('0x17')](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x38efc8,_0x221071){return function(_0x2c64e2){if(!_0x2c64e2){_0x38efc8[_0x0d8b('0x16')](0x194);}return _0x2c64e2;};}function handleError(_0x4562cb,_0x27b695){_0x27b695=_0x27b695||0x1f4;return function(_0x5e5bc3){logger[_0x0d8b('0x23')](_0x5e5bc3[_0x0d8b('0x24')]);if(_0x5e5bc3['name']){delete _0x5e5bc3[_0x0d8b('0x25')];}_0x4562cb['status'](_0x27b695)[_0x0d8b('0x26')](_0x5e5bc3);};}exports[_0x0d8b('0x27')]=function(_0xa2af02,_0x4fe6f9){var _0x59a905={'raw':!![],'where':{'id':_0xa2af02[_0x0d8b('0x28')]['id']}},_0x28f639={};_0x28f639['model']=_[_0x0d8b('0x29')](db['ChatProactiveAction'][_0x0d8b('0x2a')]);_0x28f639['query']=_[_0x0d8b('0x29')](_0xa2af02['query']);_0x28f639[_0x0d8b('0x2b')]=_['intersection'](_0x28f639[_0x0d8b('0x2c')],_0x28f639['query']);_0x59a905[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x28f639[_0x0d8b('0x2c')],qs['fields'](_0xa2af02['query']['fields']));_0x59a905[_0x0d8b('0x2d')]=_0x59a905['attributes'][_0x0d8b('0x2f')]?_0x59a905['attributes']:_0x28f639['model'];if(_0xa2af02[_0x0d8b('0x30')][_0x0d8b('0x31')]){_0x59a905[_0x0d8b('0x32')]=[{'all':!![]}];}_0x59a905=_[_0x0d8b('0x33')]({},_0x59a905,_0xa2af02[_0x0d8b('0x34')]);return db[_0x0d8b('0x35')][_0x0d8b('0x36')](_0x59a905)[_0x0d8b('0x22')](handleEntityNotFound(_0x4fe6f9,null))['then'](respondWithResult(_0x4fe6f9,null))[_0x0d8b('0x37')](handleError(_0x4fe6f9,null));};exports[_0x0d8b('0x38')]=function(_0x4b3ea0,_0xb18586){return db[_0x0d8b('0x35')][_0x0d8b('0x38')](_0x4b3ea0['body'],{})[_0x0d8b('0x22')](respondWithResult(_0xb18586,0xc9))[_0x0d8b('0x37')](handleError(_0xb18586,null));};exports[_0x0d8b('0x21')]=function(_0x31ceba,_0x933e01){if(_0x31ceba['body']['id']){delete _0x31ceba[_0x0d8b('0x39')]['id'];}return db[_0x0d8b('0x35')]['find']({'where':{'id':_0x31ceba[_0x0d8b('0x28')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x933e01,null))[_0x0d8b('0x22')](saveUpdates(_0x31ceba[_0x0d8b('0x39')],null))[_0x0d8b('0x22')](respondWithResult(_0x933e01,null))['catch'](handleError(_0x933e01,null));};exports['destroy']=function(_0x41b4f9,_0x5c2c04){return db['ChatProactiveAction'][_0x0d8b('0x36')]({'where':{'id':_0x41b4f9[_0x0d8b('0x28')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x5c2c04,null))[_0x0d8b('0x22')](removeEntity(_0x5c2c04,null))[_0x0d8b('0x37')](handleError(_0x5c2c04,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 9f23f12..201eab6 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 _0xa219=['../../config/environment','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','api','moment','request-promise','rimraf'];(function(_0x4651d5,_0x2a0b55){var _0x46c12e=function(_0x5300ba){while(--_0x5300ba){_0x4651d5['push'](_0x4651d5['shift']());}};_0x46c12e(++_0x2a0b55);}(_0xa219,0x180));var _0x9a21=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xa219[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x9a21('0x0'));var util=require(_0x9a21('0x1'));var logger=require('../../config/logger')(_0x9a21('0x2'));var moment=require(_0x9a21('0x3'));var BPromise=require('bluebird');var rp=require(_0x9a21('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a21('0x5'));var config=require(_0x9a21('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0x9a21('0x7')]=function(_0x417be2,_0x57ccc5){return _0x417be2['define'](_0x9a21('0x8'),attributes,{'tableName':_0x9a21('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb85f=['rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2fe89,_0xeca645){var _0x513043=function(_0x205e10){while(--_0x205e10){_0x2fe89['push'](_0x2fe89['shift']());}};_0x513043(++_0xeca645);}(_0xb85f,0xc1));var _0xfb85=function(_0x385a12,_0x21af01){_0x385a12=_0x385a12-0x0;var _0x1263bd=_0xb85f[_0x385a12];return _0x1263bd;};'use strict';var _=require('lodash');var util=require(_0xfb85('0x0'));var logger=require(_0xfb85('0x1'))('api');var moment=require(_0xfb85('0x2'));var BPromise=require(_0xfb85('0x3'));var rp=require(_0xfb85('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb85('0x5'));var config=require('../../config/environment');var attributes=require(_0xfb85('0x6'));module[_0xfb85('0x7')]=function(_0x53466a,_0x51282d){return _0x53466a[_0xfb85('0x8')](_0xfb85('0x9'),attributes,{'tableName':_0xfb85('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 42b0c6b..d9b89d4 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 _0x9ff4=['debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x5c2d41,_0x27e870){var _0x1d352a=function(_0x606718){while(--_0x606718){_0x5c2d41['push'](_0x5c2d41['shift']());}};_0x1d352a(++_0x27e870);}(_0x9ff4,0xf8));var _0x49ff=function(_0x1ed3a2,_0x1642b7){_0x1ed3a2=_0x1ed3a2-0x0;var _0x7f0a49=_0x9ff4[_0x1ed3a2];return _0x7f0a49;};'use strict';var _=require(_0x49ff('0x0'));var util=require(_0x49ff('0x1'));var moment=require('moment');var BPromise=require(_0x49ff('0x2'));var rs=require(_0x49ff('0x3'));var fs=require('fs');var Redis=require(_0x49ff('0x4'));var db=require(_0x49ff('0x5'))['db'];var utils=require(_0x49ff('0x6'));var logger=require('../../config/logger')(_0x49ff('0x7'));var config=require(_0x49ff('0x8'));var jayson=require(_0x49ff('0x9'));var client=jayson[_0x49ff('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39b37d,_0x200f4b,_0x13e4d8){return new BPromise(function(_0x20c73b,_0x143717){return client[_0x49ff('0xb')](_0x39b37d,_0x13e4d8)[_0x49ff('0xc')](function(_0x5ad42a){logger[_0x49ff('0xd')](_0x49ff('0xe'),_0x200f4b,_0x49ff('0xf'));logger[_0x49ff('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x200f4b,_0x49ff('0xf'),JSON[_0x49ff('0x11')](_0x5ad42a));if(_0x5ad42a[_0x49ff('0x12')]){if(_0x5ad42a['error'][_0x49ff('0x13')]===0x1f4){logger[_0x49ff('0x12')](_0x49ff('0xe'),_0x200f4b,_0x5ad42a[_0x49ff('0x12')]['message']);return _0x143717(_0x5ad42a['error']['message']);}logger[_0x49ff('0x12')](_0x49ff('0xe'),_0x200f4b,_0x5ad42a[_0x49ff('0x12')]['message']);return _0x20c73b(_0x5ad42a[_0x49ff('0x12')][_0x49ff('0x14')]);}else{logger[_0x49ff('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x200f4b,_0x49ff('0xf'));_0x20c73b(_0x5ad42a['result'][_0x49ff('0x14')]);}})[_0x49ff('0x15')](function(_0x1035ed){logger[_0x49ff('0x12')](_0x49ff('0xe'),_0x200f4b,_0x1035ed);_0x143717(_0x1035ed);});});} \ No newline at end of file +var _0x44b7=['rpc','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x44b7,0xc6));var _0x744b=function(_0x137842,_0x319515){_0x137842=_0x137842-0x0;var _0x505945=_0x44b7[_0x137842];return _0x505945;};'use strict';var _=require(_0x744b('0x0'));var util=require(_0x744b('0x1'));var moment=require(_0x744b('0x2'));var BPromise=require(_0x744b('0x3'));var rs=require(_0x744b('0x4'));var fs=require('fs');var Redis=require(_0x744b('0x5'));var db=require(_0x744b('0x6'))['db'];var utils=require(_0x744b('0x7'));var logger=require(_0x744b('0x8'))(_0x744b('0x9'));var config=require('../../config/environment');var jayson=require(_0x744b('0xa'));var client=jayson[_0x744b('0xb')][_0x744b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6c1515,_0xbcc446,_0x326dfc){return new BPromise(function(_0x309309,_0x5d52bd){return client[_0x744b('0xd')](_0x6c1515,_0x326dfc)[_0x744b('0xe')](function(_0xe015a9){logger[_0x744b('0xf')](_0x744b('0x10'),_0xbcc446,_0x744b('0x11'));logger[_0x744b('0x12')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0xbcc446,_0x744b('0x11'),JSON['stringify'](_0xe015a9));if(_0xe015a9[_0x744b('0x13')]){if(_0xe015a9[_0x744b('0x13')]['code']===0x1f4){logger[_0x744b('0x13')](_0x744b('0x10'),_0xbcc446,_0xe015a9[_0x744b('0x13')][_0x744b('0x14')]);return _0x5d52bd(_0xe015a9[_0x744b('0x13')][_0x744b('0x14')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0xbcc446,_0xe015a9[_0x744b('0x13')][_0x744b('0x14')]);return _0x309309(_0xe015a9['error'][_0x744b('0x14')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0xbcc446,'request\x20sent');_0x309309(_0xe015a9[_0x744b('0x15')][_0x744b('0x14')]);}})[_0x744b('0x16')](function(_0x2aad22){logger[_0x744b('0x13')](_0x744b('0x10'),_0xbcc446,_0x2aad22);_0x5d52bd(_0x2aad22);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 2e5f14b..9c2a3af 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 _0x491d=['/:id','show','isAuthenticated','put','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x491d,0xe6));var _0xd491=function(_0x467d9b,_0xcd92a6){_0x467d9b=_0x467d9b-0x0;var _0x1c0cae=_0x491d[_0x467d9b];return _0x1c0cae;};'use strict';var multer=require(_0xd491('0x0'));var util=require(_0xd491('0x1'));var path=require(_0xd491('0x2'));var timeout=require(_0xd491('0x3'));var express=require(_0xd491('0x4'));var router=express['Router']();var auth=require(_0xd491('0x5'));var interaction=require(_0xd491('0x6'));var config=require(_0xd491('0x7'));var controller=require(_0xd491('0x8'));router[_0xd491('0x9')](_0xd491('0xa'),auth['isAuthenticated'](),controller[_0xd491('0xb')]);router['post']('/',auth[_0xd491('0xc')](),controller['create']);router[_0xd491('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xd491('0xe')]);router[_0xd491('0xf')]('/:id',auth[_0xd491('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6a39=['express','Router','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5528ea,_0x4d95cf){var _0x1253b8=function(_0x972d5d){while(--_0x972d5d){_0x5528ea['push'](_0x5528ea['shift']());}};_0x1253b8(++_0x4d95cf);}(_0x6a39,0x140));var _0x96a3=function(_0x41cd34,_0x32cd0c){_0x41cd34=_0x41cd34-0x0;var _0x1273e8=_0x6a39[_0x41cd34];return _0x1273e8;};'use strict';var multer=require(_0x96a3('0x0'));var util=require(_0x96a3('0x1'));var path=require(_0x96a3('0x2'));var timeout=require(_0x96a3('0x3'));var express=require(_0x96a3('0x4'));var router=express[_0x96a3('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x96a3('0x6'));var config=require(_0x96a3('0x7'));var controller=require(_0x96a3('0x8'));router[_0x96a3('0x9')](_0x96a3('0xa'),auth[_0x96a3('0xb')](),controller[_0x96a3('0xc')]);router[_0x96a3('0xd')]('/',auth[_0x96a3('0xb')](),controller[_0x96a3('0xe')]);router['put'](_0x96a3('0xa'),auth[_0x96a3('0xb')](),controller[_0x96a3('0xf')]);router['delete'](_0x96a3('0xa'),auth[_0x96a3('0xb')](),controller[_0x96a3('0x10')]);module[_0x96a3('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 ffabd36..8ce41e9 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 _0x4f79=['sequelize','exports','STRING','name','INTEGER','beepall','roundrobin'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x4f79,0x70));var _0x94f7=function(_0x1e9ed3,_0x23dcd7){_0x1e9ed3=_0x1e9ed3-0x0;var _0x4a0744=_0x4f79[_0x1e9ed3];return _0x4a0744;};'use strict';var Sequelize=require(_0x94f7('0x0'));module[_0x94f7('0x1')]={'name':{'type':Sequelize[_0x94f7('0x2')],'unique':_0x94f7('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x94f7('0x2')]},'timeout':{'type':Sequelize[_0x94f7('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x94f7('0x5'),_0x94f7('0x6'))}}; \ No newline at end of file +var _0xd615=['roundrobin','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x55c965,_0x566c86){var _0x49f655=function(_0x48bd0d){while(--_0x48bd0d){_0x55c965['push'](_0x55c965['shift']());}};_0x49f655(++_0x566c86);}(_0xd615,0x79));var _0x5d61=function(_0x54b519,_0x45cefd){_0x54b519=_0x54b519-0x0;var _0x339037=_0xd615[_0x54b519];return _0x339037;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5d61('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5d61('0x0')]},'timeout':{'type':Sequelize[_0x5d61('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5d61('0x2')](_0x5d61('0x3'),_0x5d61('0x4'),_0x5d61('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 35a4778..370057a 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 _0x1e96=['ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','every','TeamId','union','compact','value','ids','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','client','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~!@#$%^&-_=+[{]}.','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','where','pick','merge','filter','includeAll','include','findAll','rows','show','params','keys','attributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','UserChatQueue','order','sort','ChatQueueId','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','chatPause','findOne','getTeams','addTeams','Agents','interface','flatMap','each','findOrCreate','emit','removeTeams','Team','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x1e96,0xad));var _0x61e9=function(_0x3b0f51,_0x3ad986){_0x3b0f51=_0x3b0f51-0x0;var _0x252154=_0x1e96[_0x3b0f51];return _0x252154;};'use strict';var pdf=require(_0x61e9('0x0'));var emlformat=require(_0x61e9('0x1'));var rimraf=require(_0x61e9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x61e9('0x3'));var rp=require(_0x61e9('0x4'));var moment=require(_0x61e9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x61e9('0x6'));var util=require('util');var path=require(_0x61e9('0x7'));var sox=require(_0x61e9('0x8'));var csv=require(_0x61e9('0x9'));var ejs=require(_0x61e9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x61e9('0xb'));var crypto=require(_0x61e9('0xc'));var jsforce=require(_0x61e9('0xd'));var deskjs=require(_0x61e9('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x61e9('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x61e9('0x10'));var hardwareService=require(_0x61e9('0x11'));var logger=require('../../config/logger')(_0x61e9('0x12'));var utils=require('../../config/utils');var config=require(_0x61e9('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x61e9('0x14')](config[_0x61e9('0x15')],{'host':_0x61e9('0x16'),'port':0x18eb});var socket=require(_0x61e9('0x17'))(new Redis(config[_0x61e9('0x15')]));require(_0x61e9('0x18'))['register'](socket);var jayson=require(_0x61e9('0x19'));var client=jayson[_0x61e9('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x75d44,_0x4fdfde,_0x2bceac){if(_0x2bceac){var _0x2b97d4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b97d4[_0x61e9('0x1b')](_0x4fdfde)){return _0x75d44;}else{throw new db[(_0x61e9('0x1c'))][(_0x61e9('0x1d'))](_0x61e9('0x1e'));}}else{return _0x75d44;}}function respondWithRpcPromise(_0x28a550,_0x35a1d9,_0x206b41,_0x1ce6c0){return new BPromise(function(_0xd6815f,_0x2e7fbc){var _0x57d5ab=_0x1ce6c0||client;return _0x57d5ab['request'](_0x28a550,_0x206b41)[_0x61e9('0x1f')](function(_0x42de00){logger[_0x61e9('0x20')](_0x61e9('0x21'),_0x35a1d9,'request\x20sent');logger[_0x61e9('0x22')](_0x61e9('0x23'),_0x35a1d9,_0x61e9('0x24'),JSON[_0x61e9('0x25')](_0x42de00));if(_0x42de00['error']){if(_0x42de00[_0x61e9('0x26')][_0x61e9('0x27')]===0x1f4){logger[_0x61e9('0x26')]('ChatQueue,\x20%s,\x20%s',_0x35a1d9,_0x42de00[_0x61e9('0x26')]['message']);return _0x2e7fbc(_0x42de00[_0x61e9('0x26')][_0x61e9('0x28')]);}logger[_0x61e9('0x26')]('ChatQueue,\x20%s,\x20%s',_0x35a1d9,_0x42de00[_0x61e9('0x26')][_0x61e9('0x28')]);return _0xd6815f(_0x42de00[_0x61e9('0x26')][_0x61e9('0x28')]);}else{logger['info'](_0x61e9('0x21'),_0x35a1d9,_0x61e9('0x24'));_0xd6815f(_0x42de00[_0x61e9('0x29')]['message']);}})[_0x61e9('0x2a')](function(_0x3b1937){logger['error'](_0x61e9('0x21'),_0x35a1d9,_0x3b1937);_0x2e7fbc(_0x3b1937);});});}function respondWithStatusCode(_0x35fa60,_0x3096b8){_0x3096b8=_0x3096b8||0xcc;return function(_0x2b3649){if(_0x2b3649){return _0x35fa60[_0x61e9('0x2b')](_0x3096b8);}return _0x35fa60[_0x61e9('0x2c')](_0x3096b8)['end']();};}function respondWithResult(_0x3675c9,_0x1371d8){_0x1371d8=_0x1371d8||0xc8;return function(_0x15a631){if(_0x15a631){return _0x3675c9[_0x61e9('0x2c')](_0x1371d8)[_0x61e9('0x2d')](_0x15a631);}};}function respondWithFilteredResult(_0x3981a7,_0x10cc10){return function(_0x14e40c){if(_0x14e40c){var _0x2d3463=_0x14e40c[_0x61e9('0x2e')],_0x3bd19a=_0x10cc10[_0x61e9('0x2f')],_0x255be1=_0x10cc10[_0x61e9('0x2f')]+_0x10cc10[_0x61e9('0x30')],_0xa1b1bc;if(_0x255be1>=_0x2d3463){_0x255be1=_0x2d3463;_0xa1b1bc=0xc8;}else{_0xa1b1bc=0xce;}_0x3981a7[_0x61e9('0x2c')](_0xa1b1bc);return _0x3981a7[_0x61e9('0x31')](_0x61e9('0x32'),_0x3bd19a+'-'+_0x255be1+'/'+_0x2d3463)['json'](_0x14e40c);}return null;};}function patchUpdates(_0x5f57c1){return function(_0x283c2d){try{jsonpatch[_0x61e9('0x33')](_0x283c2d,_0x5f57c1,!![]);}catch(_0x170ae4){return BPromise['reject'](_0x170ae4);}return _0x283c2d[_0x61e9('0x34')]();};}function saveUpdates(_0xf32a6,_0xeaeec5){return function(_0x3bcaad){if(_0x3bcaad){return _0x3bcaad[_0x61e9('0x35')](_0xf32a6)[_0x61e9('0x1f')](function(_0xca125a){return _0xca125a;});}return null;};}function removeEntity(_0x117bd8,_0x6f0d81){return function(_0x4653a1){if(_0x4653a1){return _0x4653a1[_0x61e9('0x36')]()['then'](function(){var _0x6fd9dc=_0x4653a1[_0x61e9('0x37')]({'plain':!![]});var _0x55d6e2='ChatQueues';return db[_0x61e9('0x38')]['destroy']({'where':{'type':_0x55d6e2,'resourceId':_0x6fd9dc['id']}})[_0x61e9('0x1f')](function(){return _0x4653a1;});})[_0x61e9('0x1f')](function(){_0x117bd8['status'](0xcc)[_0x61e9('0x39')]();});}};}function handleEntityNotFound(_0x383938,_0x27e4cc){return function(_0x12d329){if(!_0x12d329){_0x383938[_0x61e9('0x2b')](0x194);}return _0x12d329;};}function handleError(_0x41479d,_0x1b758b){_0x1b758b=_0x1b758b||0x1f4;return function(_0x15ba64){logger['error'](_0x15ba64[_0x61e9('0x3a')]);if(_0x15ba64[_0x61e9('0x3b')]){delete _0x15ba64[_0x61e9('0x3b')];}_0x41479d[_0x61e9('0x2c')](_0x1b758b)[_0x61e9('0x3c')](_0x15ba64);};}exports['index']=function(_0x3e7e74,_0x251c34){var _0x3ae125={},_0x2dda82={},_0x899dbc={'count':0x0,'rows':[]};var _0x2d5195=_[_0x61e9('0x3d')](db[_0x61e9('0x3e')][_0x61e9('0x3f')],function(_0x3853dd){return{'name':_0x3853dd[_0x61e9('0x40')],'type':_0x3853dd[_0x61e9('0x41')][_0x61e9('0x42')]};});_0x2dda82[_0x61e9('0x43')]=_[_0x61e9('0x3d')](_0x2d5195,_0x61e9('0x3b'));_0x2dda82['query']=_['keys'](_0x3e7e74[_0x61e9('0x44')]);_0x2dda82[_0x61e9('0x45')]=_[_0x61e9('0x46')](_0x2dda82[_0x61e9('0x43')],_0x2dda82[_0x61e9('0x44')]);_0x3ae125['attributes']=_[_0x61e9('0x46')](_0x2dda82[_0x61e9('0x43')],qs[_0x61e9('0x47')](_0x3e7e74[_0x61e9('0x44')][_0x61e9('0x47')]));_0x3ae125['attributes']=_0x3ae125['attributes'][_0x61e9('0x48')]?_0x3ae125['attributes']:_0x2dda82['model'];if(!_0x3e7e74[_0x61e9('0x44')][_0x61e9('0x49')](_0x61e9('0x4a'))){_0x3ae125['limit']=qs[_0x61e9('0x30')](_0x3e7e74['query'][_0x61e9('0x30')]);_0x3ae125['offset']=qs[_0x61e9('0x2f')](_0x3e7e74[_0x61e9('0x44')][_0x61e9('0x2f')]);}_0x3ae125['order']=qs['sort'](_0x3e7e74[_0x61e9('0x44')]['sort']);_0x3ae125[_0x61e9('0x4b')]=qs[_0x61e9('0x45')](_[_0x61e9('0x4c')](_0x3e7e74[_0x61e9('0x44')],_0x2dda82[_0x61e9('0x45')]),_0x2d5195);if(_0x3e7e74[_0x61e9('0x44')]['filter']){_0x3ae125[_0x61e9('0x4b')]=_[_0x61e9('0x4d')](_0x3ae125[_0x61e9('0x4b')],{'$or':_['map'](_0x2d5195,function(_0x17bbea){if(_0x17bbea[_0x61e9('0x41')]!=='VIRTUAL'){var _0x45d298={};_0x45d298[_0x17bbea[_0x61e9('0x3b')]]={'$like':'%'+_0x3e7e74[_0x61e9('0x44')][_0x61e9('0x4e')]+'%'};return _0x45d298;}})});}_0x3ae125=_[_0x61e9('0x4d')]({},_0x3ae125,_0x3e7e74['options']);var _0x4e971d={'where':_0x3ae125[_0x61e9('0x4b')]};return db['ChatQueue'][_0x61e9('0x2e')](_0x4e971d)[_0x61e9('0x1f')](function(_0x1b1f9d){_0x899dbc[_0x61e9('0x2e')]=_0x1b1f9d;if(_0x3e7e74[_0x61e9('0x44')][_0x61e9('0x4f')]){_0x3ae125[_0x61e9('0x50')]=[{'all':!![]}];}return db[_0x61e9('0x3e')][_0x61e9('0x51')](_0x3ae125);})[_0x61e9('0x1f')](function(_0x2fc00f){_0x899dbc[_0x61e9('0x52')]=_0x2fc00f;return _0x899dbc;})['then'](respondWithFilteredResult(_0x251c34,_0x3ae125))[_0x61e9('0x2a')](handleError(_0x251c34,null));};exports[_0x61e9('0x53')]=function(_0x373bbf,_0x4baa3e){var _0x44fdf4={'raw':!![],'where':{'id':_0x373bbf[_0x61e9('0x54')]['id']}},_0x4c0f6f={};_0x4c0f6f[_0x61e9('0x43')]=_[_0x61e9('0x55')](db[_0x61e9('0x3e')]['rawAttributes']);_0x4c0f6f[_0x61e9('0x44')]=_['keys'](_0x373bbf['query']);_0x4c0f6f[_0x61e9('0x45')]=_['intersection'](_0x4c0f6f[_0x61e9('0x43')],_0x4c0f6f[_0x61e9('0x44')]);_0x44fdf4['attributes']=_[_0x61e9('0x46')](_0x4c0f6f['model'],qs[_0x61e9('0x47')](_0x373bbf[_0x61e9('0x44')][_0x61e9('0x47')]));_0x44fdf4['attributes']=_0x44fdf4[_0x61e9('0x56')]['length']?_0x44fdf4[_0x61e9('0x56')]:_0x4c0f6f['model'];if(_0x373bbf[_0x61e9('0x44')][_0x61e9('0x4f')]){_0x44fdf4[_0x61e9('0x50')]=[{'all':!![]}];}_0x44fdf4=_[_0x61e9('0x4d')]({},_0x44fdf4,_0x373bbf[_0x61e9('0x57')]);return db[_0x61e9('0x3e')]['find'](_0x44fdf4)[_0x61e9('0x1f')](handleEntityNotFound(_0x4baa3e,null))['then'](respondWithResult(_0x4baa3e,null))[_0x61e9('0x2a')](handleError(_0x4baa3e,null));};exports[_0x61e9('0x58')]=function(_0x33dc67,_0x376ab4){return db['ChatQueue'][_0x61e9('0x58')](_0x33dc67[_0x61e9('0x59')],{})[_0x61e9('0x1f')](function(_0x5d5deb){var _0x393900=_0x33dc67[_0x61e9('0x5a')][_0x61e9('0x37')]({'plain':!![]});if(!_0x393900)throw new Error(_0x61e9('0x5b'));if(_0x393900[_0x61e9('0x5c')]===_0x61e9('0x5a')){var _0x274124=_0x5d5deb['get']({'plain':!![]});var _0x57c488=_0x61e9('0x5d');return db[_0x61e9('0x5e')]['find']({'where':{'name':_0x57c488,'userProfileId':_0x393900[_0x61e9('0x5f')]},'raw':!![]})[_0x61e9('0x1f')](function(_0x4b5369){if(_0x4b5369&&_0x4b5369[_0x61e9('0x60')]===0x0){return db[_0x61e9('0x38')][_0x61e9('0x58')]({'name':_0x274124[_0x61e9('0x3b')],'resourceId':_0x274124['id'],'type':_0x4b5369['name'],'sectionId':_0x4b5369['id']},{})[_0x61e9('0x1f')](function(){return _0x5d5deb;});}else{return _0x5d5deb;}})['catch'](function(_0x8205c4){logger['error'](_0x61e9('0x61'),_0x8205c4);throw _0x8205c4;});}return _0x5d5deb;})['then'](respondWithResult(_0x376ab4,0xc9))[_0x61e9('0x2a')](handleError(_0x376ab4,null));};exports[_0x61e9('0x35')]=function(_0x4da428,_0x43c45f){if(_0x4da428['body']['id']){delete _0x4da428[_0x61e9('0x59')]['id'];}return db[_0x61e9('0x3e')][_0x61e9('0x62')]({'where':{'id':_0x4da428[_0x61e9('0x54')]['id']}})['then'](handleEntityNotFound(_0x43c45f,null))[_0x61e9('0x1f')](saveUpdates(_0x4da428[_0x61e9('0x59')],null))[_0x61e9('0x1f')](respondWithResult(_0x43c45f,null))[_0x61e9('0x2a')](handleError(_0x43c45f,null));};exports[_0x61e9('0x36')]=function(_0x232414,_0x20d12b){return db['ChatQueue']['find']({'where':{'id':_0x232414[_0x61e9('0x54')]['id']}})[_0x61e9('0x1f')](handleEntityNotFound(_0x20d12b,null))['then'](removeEntity(_0x20d12b,null))[_0x61e9('0x2a')](handleError(_0x20d12b,null));};exports[_0x61e9('0x63')]=function(_0x416966,_0x200395){return db[_0x61e9('0x3e')][_0x61e9('0x63')]()[_0x61e9('0x1f')](respondWithResult(_0x200395,null))[_0x61e9('0x2a')](handleError(_0x200395,null));};exports[_0x61e9('0x64')]=function(_0x58206c,_0x3f78a1,_0x1a96a7){var _0x559013={'raw':!![],'where':{}},_0x36393a={},_0x35c55a;return db['ChatQueue']['findOne']({'where':{'id':_0x58206c[_0x61e9('0x54')]['id']}})['then'](handleEntityNotFound(_0x3f78a1,null))[_0x61e9('0x1f')](function(_0xf021f){if(_0xf021f){_0x35c55a=_0xf021f[_0x61e9('0x37')]({'plain':!![]});_0x36393a[_0x61e9('0x43')]=_[_0x61e9('0x55')](db[_0x61e9('0x65')][_0x61e9('0x3f')]);_0x36393a['query']=_['keys'](_0x58206c[_0x61e9('0x44')]);_0x36393a[_0x61e9('0x45')]=_[_0x61e9('0x46')](_0x36393a[_0x61e9('0x43')],_0x36393a['query']);_0x559013[_0x61e9('0x56')]=_['intersection'](_0x36393a[_0x61e9('0x43')],qs[_0x61e9('0x47')](_0x58206c[_0x61e9('0x44')][_0x61e9('0x47')]));_0x559013[_0x61e9('0x56')]=_0x559013[_0x61e9('0x56')]['length']?_0x559013[_0x61e9('0x56')]:_0x36393a[_0x61e9('0x43')];if(!_0x58206c['query']['hasOwnProperty']('nolimit')){_0x559013[_0x61e9('0x30')]=qs[_0x61e9('0x30')](_0x58206c[_0x61e9('0x44')][_0x61e9('0x30')]);_0x559013[_0x61e9('0x2f')]=qs['offset'](_0x58206c['query'][_0x61e9('0x2f')]);}_0x559013[_0x61e9('0x66')]=qs[_0x61e9('0x67')](_0x58206c[_0x61e9('0x44')][_0x61e9('0x67')]);_0x559013[_0x61e9('0x4b')]=qs[_0x61e9('0x45')](_['pick'](_0x58206c['query'],_0x36393a[_0x61e9('0x45')]));_0x559013[_0x61e9('0x4b')][_0x61e9('0x68')]=_0xf021f['id'];if(_0x58206c[_0x61e9('0x44')][_0x61e9('0x4e')]){_0x559013[_0x61e9('0x4b')]=_[_0x61e9('0x4d')](_0x559013[_0x61e9('0x4b')],{'$or':_['map'](_0x559013[_0x61e9('0x56')],function(_0x46678d){var _0x9d1721={};_0x9d1721[_0x46678d]={'$like':'%'+_0x58206c[_0x61e9('0x44')]['filter']+'%'};return _0x9d1721;})});}_0x559013=_[_0x61e9('0x4d')]({},_0x559013,_0x58206c[_0x61e9('0x57')]);return db[_0x61e9('0x65')][_0x61e9('0x51')](_0x559013);}})[_0x61e9('0x1f')](function(_0xf429cf){if(_0xf429cf){return db[_0x61e9('0x69')][_0x61e9('0x6a')]({'where':{'id':_[_0x61e9('0x3d')](_0xf429cf,_0x61e9('0x6b')),'role':_0x61e9('0x6c')},'attributes':['id',_0x61e9('0x3b'),'chatPause','updatedAt',_0x61e9('0x6d')]});}})[_0x61e9('0x1f')](function(_0x3ef259){if(_0x3ef259){return{'count':_0x3ef259['count'],'rows':_[_0x61e9('0x3d')](_0x3ef259[_0x61e9('0x52')],function(_0x5577af){return{'membername':_0x5577af['name'],'UserId':_0x5577af['id'],'queue_name':_0x35c55a[_0x61e9('0x3b')],'ChatQueueId':_0x35c55a['id'],'interface':util[_0x61e9('0x6e')](_0x61e9('0x6f'),_0x61e9('0x70'),_0x5577af[_0x61e9('0x3b')]),'penalty':0x0,'paused':_0x5577af[_0x61e9('0x71')],'createdAt':_0x5577af[_0x61e9('0x6d')],'updatedAt':_0x5577af['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x61e9('0x1f')](respondWithFilteredResult(_0x3f78a1,_0x559013))[_0x61e9('0x2a')](handleError(_0x3f78a1,null));};exports['getTeams']=function(_0x49dcfd,_0x1d4c8f,_0x204df8){var _0x2e231e={};var _0x56c39d={};var _0xaf96ea;var _0x944302;return db[_0x61e9('0x3e')][_0x61e9('0x72')]({'where':{'id':_0x49dcfd['params']['id']}})['then'](handleEntityNotFound(_0x1d4c8f,null))['then'](function(_0x592850){if(_0x592850){_0xaf96ea=_0x592850;_0x56c39d[_0x61e9('0x43')]=_[_0x61e9('0x55')](db['Team']['rawAttributes']);_0x56c39d[_0x61e9('0x44')]=_['keys'](_0x49dcfd[_0x61e9('0x44')]);_0x56c39d[_0x61e9('0x45')]=_[_0x61e9('0x46')](_0x56c39d[_0x61e9('0x43')],_0x56c39d[_0x61e9('0x44')]);_0x2e231e[_0x61e9('0x56')]=_[_0x61e9('0x46')](_0x56c39d[_0x61e9('0x43')],qs[_0x61e9('0x47')](_0x49dcfd[_0x61e9('0x44')][_0x61e9('0x47')]));_0x2e231e[_0x61e9('0x56')]=_0x2e231e[_0x61e9('0x56')][_0x61e9('0x48')]?_0x2e231e[_0x61e9('0x56')]:_0x56c39d[_0x61e9('0x43')];_0x2e231e['order']=qs[_0x61e9('0x67')](_0x49dcfd[_0x61e9('0x44')]['sort']);_0x2e231e[_0x61e9('0x4b')]=qs[_0x61e9('0x45')](_['pick'](_0x49dcfd[_0x61e9('0x44')],_0x56c39d['filters']));if(_0x49dcfd[_0x61e9('0x44')][_0x61e9('0x4e')]){_0x2e231e[_0x61e9('0x4b')]=_[_0x61e9('0x4d')](_0x2e231e[_0x61e9('0x4b')],{'$or':_[_0x61e9('0x3d')](_0x2e231e[_0x61e9('0x56')],function(_0x3ac88a){var _0x21cbbf={};_0x21cbbf[_0x3ac88a]={'$like':'%'+_0x49dcfd[_0x61e9('0x44')][_0x61e9('0x4e')]+'%'};return _0x21cbbf;})});}_0x2e231e=_[_0x61e9('0x4d')]({},_0x2e231e,_0x49dcfd[_0x61e9('0x57')]);return _0xaf96ea[_0x61e9('0x73')](_0x2e231e);}})[_0x61e9('0x1f')](function(_0x22180f){if(_0x22180f){_0x944302=_0x22180f[_0x61e9('0x48')];if(!_0x49dcfd['query'][_0x61e9('0x49')](_0x61e9('0x4a'))){_0x2e231e['limit']=qs[_0x61e9('0x30')](_0x49dcfd[_0x61e9('0x44')]['limit']);_0x2e231e['offset']=qs[_0x61e9('0x2f')](_0x49dcfd[_0x61e9('0x44')][_0x61e9('0x2f')]);}return _0xaf96ea['getTeams'](_0x2e231e);}})['then'](function(_0x412756){if(_0x412756){return _0x412756?{'count':_0x944302,'rows':_0x412756}:null;}})[_0x61e9('0x1f')](respondWithResult(_0x1d4c8f,null))['catch'](handleError(_0x1d4c8f,null));};exports[_0x61e9('0x74')]=function(_0x2c9888,_0x4c3756,_0x266350){var _0x4cc0ae=_0x2c9888['body']['ids'];return db['Team'][_0x61e9('0x51')]({'where':{'id':_0x4cc0ae},'attributes':['id'],'include':[{'model':db[_0x61e9('0x69')],'as':_0x61e9('0x75'),'attributes':['id',_0x61e9('0x3b'),'online','voicePause',_0x61e9('0x76')],'raw':!![]}]})['then'](function(_0x4f298e){if(_0x4f298e){var _0x5345e7=_[_0x61e9('0x77')](_0x4f298e,function(_0x1531f7){var _0x1459d2=_0x1531f7['get']({'plain':!![]});return _0x1459d2[_0x61e9('0x75')];});return db[_0x61e9('0x3e')][_0x61e9('0x62')]({'where':{'id':_0x2c9888[_0x61e9('0x54')]['id']}})[_0x61e9('0x1f')](function(_0x4d4471){return db['sequelize']['transaction'](function(_0x5bf2b5){return _0x4d4471[_0x61e9('0x74')](_0x4cc0ae,{'transaction':_0x5bf2b5})['then'](function(){return BPromise[_0x61e9('0x78')](_0x5345e7,function(_0x5dd3a7){return db[_0x61e9('0x65')][_0x61e9('0x79')]({'where':{'UserId':_0x5dd3a7['id'],'ChatQueueId':_0x2c9888[_0x61e9('0x54')]['id']},'transaction':_0x5bf2b5});});})[_0x61e9('0x1f')](function(){_0x5345e7['forEach'](function(_0x2eac03){socket[_0x61e9('0x7a')]('userChatQueue:save',{'UserId':_0x2eac03['id'],'ChatQueueId':_0x4d4471['id']});});});});});}})[_0x61e9('0x1f')](respondWithStatusCode(_0x4c3756,null))[_0x61e9('0x2a')](handleError(_0x4c3756,null));};exports[_0x61e9('0x7b')]=function(_0x298ae2,_0x139bb6,_0x2583de){return db[_0x61e9('0x7c')][_0x61e9('0x51')]({'where':{'id':_0x298ae2[_0x61e9('0x44')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x139bb6,null))[_0x61e9('0x1f')](function(_0x559aa1){var _0xbfe175=_[_0x61e9('0x3d')](_0x559aa1,'id');var _0x32a684=[];var _0x30b090=[];var _0x5b8d46=squel[_0x61e9('0x7d')]();_0x5b8d46[_0x61e9('0x7e')](_0x61e9('0x7f'))[_0x61e9('0x80')](_0x61e9('0x81'),'tq')['join'](_0x61e9('0x82'),'ut',_0x61e9('0x83'))[_0x61e9('0x4b')]('ChatQueueId\x20=\x20?',_0x298ae2[_0x61e9('0x54')]['id']);for(var _0x2d458c=0x0;_0x2d458c<_0x559aa1[_0x61e9('0x48')];_0x2d458c+=0x1){let _0x46060b=_0x559aa1[_0x2d458c];for(var _0x1ae43b=0x0;_0x1ae43b<_0x46060b[_0x61e9('0x75')]['length'];_0x1ae43b+=0x1){let _0x73f6a8=_0x46060b['Agents'][_0x1ae43b];var _0x2cd871=_0x5b8d46[_0x61e9('0x84')]();_0x2cd871['where'](_0x61e9('0x85'),_0x73f6a8['id']);_0x30b090['push'](db[_0x61e9('0x86')][_0x61e9('0x44')](_0x2cd871[_0x61e9('0x87')](),{'type':db[_0x61e9('0x86')][_0x61e9('0x88')]['SELECT']})[_0x61e9('0x1f')](function(_0x1a4207){if(_0x1a4207['length']===0x1){return _0x73f6a8['id'];}else{var _0x5a0a59=_[_0x61e9('0x89')](_[_0x61e9('0x3d')](_0x1a4207,_0x61e9('0x8a')),function(_0x459507){return _['includes'](_0xbfe175,_0x459507);});if(_0x5a0a59){return _0x73f6a8['id'];}}}));}}return BPromise['all'](_0x30b090)[_0x61e9('0x1f')](function(_0x32b84a){_0x32a684=_(_0x32a684)[_0x61e9('0x8b')](_0x32b84a)[_0x61e9('0x8c')]()[_0x61e9('0x8d')]();return db[_0x61e9('0x3e')][_0x61e9('0x62')]({'where':{'id':_0x298ae2[_0x61e9('0x54')]['id']}})[_0x61e9('0x1f')](function(_0xc26909){return db[_0x61e9('0x86')]['transaction'](function(_0x5e64a1){return _0xc26909[_0x61e9('0x7b')](_0x298ae2[_0x61e9('0x44')][_0x61e9('0x8e')],{'transaction':_0x5e64a1})[_0x61e9('0x1f')](function(){if(!_[_0x61e9('0x8f')](_0x32a684)){return _0xc26909[_0x61e9('0x90')](_0x32a684,{'transaction':_0x5e64a1});}})[_0x61e9('0x1f')](function(){_0x32a684[_0x61e9('0x91')](function(_0x4968db){socket[_0x61e9('0x7a')](_0x61e9('0x92'),{'UserId':_0x4968db,'ChatQueueId':_0xc26909['id']});});});});});});})[_0x61e9('0x1f')](respondWithStatusCode(_0x139bb6,null))['catch'](handleError(_0x139bb6,null));};exports[_0x61e9('0x93')]=function(_0x475a57,_0xf5ab03,_0x278da3){return db[_0x61e9('0x3e')]['find']({'where':{'id':_0x475a57['params']['id']}})[_0x61e9('0x1f')](handleEntityNotFound(_0xf5ab03,null))[_0x61e9('0x1f')](function(_0x3f97c2){if(_0x3f97c2){return _0x3f97c2[_0x61e9('0x93')](_0x475a57[_0x61e9('0x59')][_0x61e9('0x8e')],_[_0x61e9('0x94')](_0x475a57[_0x61e9('0x59')],[_0x61e9('0x8e'),'id'])||{})[_0x61e9('0x95')](function(_0x39f758){for(var _0x46a211=0x0;_0x46a211<_0x475a57[_0x61e9('0x59')]['ids'][_0x61e9('0x48')];_0x46a211+=0x1){socket['emit']('userChatQueue:save',{'UserId':_0x475a57[_0x61e9('0x59')]['ids'][_0x46a211],'ChatQueueId':_0x475a57[_0x61e9('0x54')]['id']});}return _0x39f758;});}})[_0x61e9('0x1f')](respondWithResult(_0xf5ab03,null))[_0x61e9('0x2a')](handleError(_0xf5ab03,null));};exports[_0x61e9('0x90')]=function(_0x582c15,_0x508e83,_0x23dea6){return db[_0x61e9('0x3e')][_0x61e9('0x62')]({'where':{'id':_0x582c15[_0x61e9('0x54')]['id']}})[_0x61e9('0x1f')](handleEntityNotFound(_0x508e83,null))[_0x61e9('0x1f')](function(_0x22ac46){if(_0x22ac46){return _0x22ac46[_0x61e9('0x90')](_0x582c15[_0x61e9('0x44')][_0x61e9('0x8e')])['then'](function(){if(_[_0x61e9('0x96')](_0x582c15[_0x61e9('0x44')]['ids'])){for(var _0x47a351=0x0;_0x47a351<_0x582c15[_0x61e9('0x44')][_0x61e9('0x8e')][_0x61e9('0x48')];_0x47a351+=0x1){socket[_0x61e9('0x7a')](_0x61e9('0x92'),{'UserId':Number(_0x582c15[_0x61e9('0x44')][_0x61e9('0x8e')][_0x47a351]),'ChatQueueId':Number(_0x582c15[_0x61e9('0x54')]['id'])});}}else{socket[_0x61e9('0x7a')](_0x61e9('0x92'),{'UserId':Number(_0x582c15['query'][_0x61e9('0x8e')]),'ChatQueueId':Number(_0x582c15[_0x61e9('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x508e83,null))['catch'](handleError(_0x508e83,null));};exports[_0x61e9('0x97')]=function(_0x44f5a3,_0xfbacdc,_0x35b71f){var _0x2bcf79={};var _0x520da0={};var _0x6ab30a;var _0x4d5844;return db[_0x61e9('0x3e')]['findOne']({'where':{'id':_0x44f5a3[_0x61e9('0x54')]['id']}})[_0x61e9('0x1f')](handleEntityNotFound(_0xfbacdc,null))[_0x61e9('0x1f')](function(_0x230b42){if(_0x230b42){_0x6ab30a=_0x230b42;_0x520da0[_0x61e9('0x43')]=_[_0x61e9('0x55')](db['User'][_0x61e9('0x3f')]);_0x520da0[_0x61e9('0x44')]=_[_0x61e9('0x55')](_0x44f5a3['query']);_0x520da0[_0x61e9('0x45')]=_[_0x61e9('0x46')](_0x520da0[_0x61e9('0x43')],_0x520da0[_0x61e9('0x44')]);_0x2bcf79[_0x61e9('0x56')]=_[_0x61e9('0x46')](_0x520da0[_0x61e9('0x43')],qs[_0x61e9('0x47')](_0x44f5a3[_0x61e9('0x44')][_0x61e9('0x47')]));_0x2bcf79['attributes']=_0x2bcf79['attributes'][_0x61e9('0x48')]?_0x2bcf79[_0x61e9('0x56')]:_0x520da0[_0x61e9('0x43')];_0x2bcf79[_0x61e9('0x66')]=qs[_0x61e9('0x67')](_0x44f5a3[_0x61e9('0x44')][_0x61e9('0x67')]);_0x2bcf79[_0x61e9('0x4b')]=qs[_0x61e9('0x45')](_[_0x61e9('0x4c')](_0x44f5a3[_0x61e9('0x44')],_0x520da0[_0x61e9('0x45')]));if(_0x44f5a3[_0x61e9('0x44')][_0x61e9('0x4e')]){_0x2bcf79[_0x61e9('0x4b')]=_[_0x61e9('0x4d')](_0x2bcf79[_0x61e9('0x4b')],{'$or':_[_0x61e9('0x3d')](_0x2bcf79[_0x61e9('0x56')],function(_0x4c2c71){var _0x16d094={};_0x16d094[_0x4c2c71]={'$like':'%'+_0x44f5a3[_0x61e9('0x44')]['filter']+'%'};return _0x16d094;})});}_0x2bcf79=_['merge']({},_0x2bcf79,_0x44f5a3[_0x61e9('0x57')]);return _0x6ab30a[_0x61e9('0x97')](_0x2bcf79);}})['then'](function(_0x5769db){if(_0x5769db){_0x4d5844=_0x5769db[_0x61e9('0x48')];if(!_0x44f5a3[_0x61e9('0x44')][_0x61e9('0x49')](_0x61e9('0x4a'))){_0x2bcf79[_0x61e9('0x30')]=qs['limit'](_0x44f5a3[_0x61e9('0x44')][_0x61e9('0x30')]);_0x2bcf79[_0x61e9('0x2f')]=qs['offset'](_0x44f5a3[_0x61e9('0x44')]['offset']);}return _0x6ab30a[_0x61e9('0x97')](_0x2bcf79);}})[_0x61e9('0x1f')](function(_0x26ec9c){if(_0x26ec9c){return _0x26ec9c?{'count':_0x4d5844,'rows':_0x26ec9c}:null;}})['then'](respondWithResult(_0xfbacdc,null))[_0x61e9('0x2a')](handleError(_0xfbacdc,null));}; \ No newline at end of file +var _0x433a=['mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatQueue.socket','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','reject','update','destroy','ChatQueues','UserProfileResource','end','stack','name','send','index','map','ChatQueue','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','show','include','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','findOne','UserChatQueue','nolimit','limit','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','userChatQueue:save','removeTeams','select','field','tq.TeamId','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','removeAgents','forEach','emit','userChatQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x433a,0x94));var _0xa433=function(_0xd80950,_0x46eaa9){_0xd80950=_0xd80950-0x0;var _0x4b8e57=_0x433a[_0xd80950];return _0x4b8e57;};'use strict';var pdf=require(_0xa433('0x0'));var emlformat=require(_0xa433('0x1'));var rimraf=require(_0xa433('0x2'));var zipdir=require(_0xa433('0x3'));var jsonpatch=require(_0xa433('0x4'));var rp=require('request-promise');var moment=require(_0xa433('0x5'));var BPromise=require(_0xa433('0x6'));var Mustache=require(_0xa433('0x7'));var util=require(_0xa433('0x8'));var path=require('path');var sox=require(_0xa433('0x9'));var csv=require('to-csv');var ejs=require(_0xa433('0xa'));var fs=require('fs');var _=require(_0xa433('0xb'));var squel=require(_0xa433('0xc'));var crypto=require(_0xa433('0xd'));var jsforce=require(_0xa433('0xe'));var deskjs=require(_0xa433('0xf'));var toCsv=require(_0xa433('0x10'));var querystring=require('querystring');var Papa=require(_0xa433('0x11'));var Redis=require('ioredis');var authService=require(_0xa433('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa433('0x13'))(_0xa433('0x14'));var utils=require(_0xa433('0x15'));var config=require(_0xa433('0x16'));var db=require(_0xa433('0x17'))['db'];config['redis']=_[_0xa433('0x18')](config['redis'],{'host':_0xa433('0x19'),'port':0x18eb});var socket=require(_0xa433('0x1a'))(new Redis(config[_0xa433('0x1b')]));require(_0xa433('0x1c'))['register'](socket);var jayson=require(_0xa433('0x1d'));var client=jayson[_0xa433('0x1e')][_0xa433('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x4354c1,_0x4b1849,_0x50e791){if(_0x50e791){var _0x40a585=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x40a585['test'](_0x4b1849)){return _0x4354c1;}else{throw new db[(_0xa433('0x20'))][(_0xa433('0x21'))](_0xa433('0x22'));}}else{return _0x4354c1;}}function respondWithRpcPromise(_0x33d42f,_0xc3401e,_0x4292ee,_0x462542){return new BPromise(function(_0x36c333,_0x1bc7f9){var _0x35593e=_0x462542||client;return _0x35593e[_0xa433('0x23')](_0x33d42f,_0x4292ee)[_0xa433('0x24')](function(_0x538875){logger[_0xa433('0x25')](_0xa433('0x26'),_0xc3401e,_0xa433('0x27'));logger[_0xa433('0x28')](_0xa433('0x29'),_0xc3401e,_0xa433('0x27'),JSON[_0xa433('0x2a')](_0x538875));if(_0x538875[_0xa433('0x2b')]){if(_0x538875[_0xa433('0x2b')][_0xa433('0x2c')]===0x1f4){logger[_0xa433('0x2b')]('ChatQueue,\x20%s,\x20%s',_0xc3401e,_0x538875[_0xa433('0x2b')][_0xa433('0x2d')]);return _0x1bc7f9(_0x538875[_0xa433('0x2b')]['message']);}logger[_0xa433('0x2b')](_0xa433('0x26'),_0xc3401e,_0x538875[_0xa433('0x2b')][_0xa433('0x2d')]);return _0x36c333(_0x538875['error'][_0xa433('0x2d')]);}else{logger[_0xa433('0x25')]('ChatQueue,\x20%s,\x20%s',_0xc3401e,_0xa433('0x27'));_0x36c333(_0x538875[_0xa433('0x2e')][_0xa433('0x2d')]);}})[_0xa433('0x2f')](function(_0x14772d){logger[_0xa433('0x2b')]('ChatQueue,\x20%s,\x20%s',_0xc3401e,_0x14772d);_0x1bc7f9(_0x14772d);});});}function respondWithStatusCode(_0x5012b1,_0x22d1e0){_0x22d1e0=_0x22d1e0||0xcc;return function(_0x453deb){if(_0x453deb){return _0x5012b1[_0xa433('0x30')](_0x22d1e0);}return _0x5012b1[_0xa433('0x31')](_0x22d1e0)['end']();};}function respondWithResult(_0x1004bc,_0x319d4c){_0x319d4c=_0x319d4c||0xc8;return function(_0xd5b811){if(_0xd5b811){return _0x1004bc[_0xa433('0x31')](_0x319d4c)[_0xa433('0x32')](_0xd5b811);}};}function respondWithFilteredResult(_0xff2d15,_0x3a4dfc){return function(_0x5c3b5a){if(_0x5c3b5a){var _0x58d738=_0x5c3b5a[_0xa433('0x33')],_0x1a5ce3=_0x3a4dfc[_0xa433('0x34')],_0x235018=_0x3a4dfc[_0xa433('0x34')]+_0x3a4dfc['limit'],_0x20052f;if(_0x235018>=_0x58d738){_0x235018=_0x58d738;_0x20052f=0xc8;}else{_0x20052f=0xce;}_0xff2d15['status'](_0x20052f);return _0xff2d15[_0xa433('0x35')]('Content-Range',_0x1a5ce3+'-'+_0x235018+'/'+_0x58d738)[_0xa433('0x32')](_0x5c3b5a);}return null;};}function patchUpdates(_0x4598e8){return function(_0x35e72d){try{jsonpatch['apply'](_0x35e72d,_0x4598e8,!![]);}catch(_0x214cb4){return BPromise[_0xa433('0x36')](_0x214cb4);}return _0x35e72d['save']();};}function saveUpdates(_0x34811c,_0x5bc895){return function(_0x21efe7){if(_0x21efe7){return _0x21efe7[_0xa433('0x37')](_0x34811c)['then'](function(_0x16a13a){return _0x16a13a;});}return null;};}function removeEntity(_0x4a2edc,_0x42f9a3){return function(_0x3ee3c7){if(_0x3ee3c7){return _0x3ee3c7[_0xa433('0x38')]()[_0xa433('0x24')](function(){var _0x11cbb3=_0x3ee3c7['get']({'plain':!![]});var _0x3d57b0=_0xa433('0x39');return db[_0xa433('0x3a')][_0xa433('0x38')]({'where':{'type':_0x3d57b0,'resourceId':_0x11cbb3['id']}})[_0xa433('0x24')](function(){return _0x3ee3c7;});})[_0xa433('0x24')](function(){_0x4a2edc[_0xa433('0x31')](0xcc)[_0xa433('0x3b')]();});}};}function handleEntityNotFound(_0x2ddf67,_0x25628e){return function(_0xe36550){if(!_0xe36550){_0x2ddf67['sendStatus'](0x194);}return _0xe36550;};}function handleError(_0x37779d,_0x53fe60){_0x53fe60=_0x53fe60||0x1f4;return function(_0x51833b){logger['error'](_0x51833b[_0xa433('0x3c')]);if(_0x51833b[_0xa433('0x3d')]){delete _0x51833b[_0xa433('0x3d')];}_0x37779d[_0xa433('0x31')](_0x53fe60)[_0xa433('0x3e')](_0x51833b);};}exports[_0xa433('0x3f')]=function(_0x3b15d5,_0x74aa22){var _0x4ea661={},_0xa812a4={},_0x44cd02={'count':0x0,'rows':[]};var _0x125581=_[_0xa433('0x40')](db[_0xa433('0x41')][_0xa433('0x42')],function(_0x5c1daf){return{'name':_0x5c1daf['fieldName'],'type':_0x5c1daf[_0xa433('0x43')]['key']};});_0xa812a4[_0xa433('0x44')]=_[_0xa433('0x40')](_0x125581,'name');_0xa812a4['query']=_[_0xa433('0x45')](_0x3b15d5[_0xa433('0x46')]);_0xa812a4[_0xa433('0x47')]=_['intersection'](_0xa812a4[_0xa433('0x44')],_0xa812a4[_0xa433('0x46')]);_0x4ea661['attributes']=_[_0xa433('0x48')](_0xa812a4[_0xa433('0x44')],qs[_0xa433('0x49')](_0x3b15d5[_0xa433('0x46')][_0xa433('0x49')]));_0x4ea661[_0xa433('0x4a')]=_0x4ea661[_0xa433('0x4a')][_0xa433('0x4b')]?_0x4ea661[_0xa433('0x4a')]:_0xa812a4['model'];if(!_0x3b15d5[_0xa433('0x46')][_0xa433('0x4c')]('nolimit')){_0x4ea661['limit']=qs['limit'](_0x3b15d5['query']['limit']);_0x4ea661['offset']=qs[_0xa433('0x34')](_0x3b15d5[_0xa433('0x46')][_0xa433('0x34')]);}_0x4ea661[_0xa433('0x4d')]=qs['sort'](_0x3b15d5['query'][_0xa433('0x4e')]);_0x4ea661[_0xa433('0x4f')]=qs[_0xa433('0x47')](_[_0xa433('0x50')](_0x3b15d5[_0xa433('0x46')],_0xa812a4[_0xa433('0x47')]),_0x125581);if(_0x3b15d5[_0xa433('0x46')]['filter']){_0x4ea661[_0xa433('0x4f')]=_[_0xa433('0x51')](_0x4ea661[_0xa433('0x4f')],{'$or':_[_0xa433('0x40')](_0x125581,function(_0x2b14dc){if(_0x2b14dc[_0xa433('0x43')]!==_0xa433('0x52')){var _0x5b23af={};_0x5b23af[_0x2b14dc[_0xa433('0x3d')]]={'$like':'%'+_0x3b15d5[_0xa433('0x46')][_0xa433('0x53')]+'%'};return _0x5b23af;}})});}_0x4ea661=_[_0xa433('0x51')]({},_0x4ea661,_0x3b15d5['options']);var _0x3ffba3={'where':_0x4ea661['where']};return db[_0xa433('0x41')][_0xa433('0x33')](_0x3ffba3)[_0xa433('0x24')](function(_0x56b9d0){_0x44cd02[_0xa433('0x33')]=_0x56b9d0;if(_0x3b15d5[_0xa433('0x46')][_0xa433('0x54')]){_0x4ea661['include']=[{'all':!![]}];}return db[_0xa433('0x41')][_0xa433('0x55')](_0x4ea661);})[_0xa433('0x24')](function(_0x47ac99){_0x44cd02['rows']=_0x47ac99;return _0x44cd02;})[_0xa433('0x24')](respondWithFilteredResult(_0x74aa22,_0x4ea661))[_0xa433('0x2f')](handleError(_0x74aa22,null));};exports[_0xa433('0x56')]=function(_0x2785ff,_0x452e16){var _0x4a4512={'raw':!![],'where':{'id':_0x2785ff['params']['id']}},_0x5c8b53={};_0x5c8b53[_0xa433('0x44')]=_[_0xa433('0x45')](db[_0xa433('0x41')][_0xa433('0x42')]);_0x5c8b53[_0xa433('0x46')]=_['keys'](_0x2785ff[_0xa433('0x46')]);_0x5c8b53[_0xa433('0x47')]=_[_0xa433('0x48')](_0x5c8b53[_0xa433('0x44')],_0x5c8b53[_0xa433('0x46')]);_0x4a4512[_0xa433('0x4a')]=_['intersection'](_0x5c8b53[_0xa433('0x44')],qs[_0xa433('0x49')](_0x2785ff['query']['fields']));_0x4a4512[_0xa433('0x4a')]=_0x4a4512['attributes']['length']?_0x4a4512[_0xa433('0x4a')]:_0x5c8b53[_0xa433('0x44')];if(_0x2785ff[_0xa433('0x46')][_0xa433('0x54')]){_0x4a4512[_0xa433('0x57')]=[{'all':!![]}];}_0x4a4512=_[_0xa433('0x51')]({},_0x4a4512,_0x2785ff[_0xa433('0x58')]);return db[_0xa433('0x41')]['find'](_0x4a4512)['then'](handleEntityNotFound(_0x452e16,null))[_0xa433('0x24')](respondWithResult(_0x452e16,null))[_0xa433('0x2f')](handleError(_0x452e16,null));};exports[_0xa433('0x59')]=function(_0x4c7723,_0x52d5c2){return db[_0xa433('0x41')][_0xa433('0x59')](_0x4c7723[_0xa433('0x5a')],{})[_0xa433('0x24')](function(_0x354f72){var _0x548feb=_0x4c7723['user']['get']({'plain':!![]});if(!_0x548feb)throw new Error(_0xa433('0x5b'));if(_0x548feb['role']===_0xa433('0x5c')){var _0x1cc2b5=_0x354f72[_0xa433('0x5d')]({'plain':!![]});var _0xc8fbb5=_0xa433('0x39');return db[_0xa433('0x5e')][_0xa433('0x5f')]({'where':{'name':_0xc8fbb5,'userProfileId':_0x548feb['userProfileId']},'raw':!![]})[_0xa433('0x24')](function(_0x1939b7){if(_0x1939b7&&_0x1939b7[_0xa433('0x60')]===0x0){return db[_0xa433('0x3a')][_0xa433('0x59')]({'name':_0x1cc2b5[_0xa433('0x3d')],'resourceId':_0x1cc2b5['id'],'type':_0x1939b7[_0xa433('0x3d')],'sectionId':_0x1939b7['id']},{})['then'](function(){return _0x354f72;});}else{return _0x354f72;}})['catch'](function(_0x1f41f9){logger['error'](_0xa433('0x61'),_0x1f41f9);throw _0x1f41f9;});}return _0x354f72;})['then'](respondWithResult(_0x52d5c2,0xc9))[_0xa433('0x2f')](handleError(_0x52d5c2,null));};exports[_0xa433('0x37')]=function(_0x5a2c7a,_0xea50ba){if(_0x5a2c7a[_0xa433('0x5a')]['id']){delete _0x5a2c7a['body']['id'];}return db[_0xa433('0x41')][_0xa433('0x5f')]({'where':{'id':_0x5a2c7a[_0xa433('0x62')]['id']}})['then'](handleEntityNotFound(_0xea50ba,null))[_0xa433('0x24')](saveUpdates(_0x5a2c7a[_0xa433('0x5a')],null))[_0xa433('0x24')](respondWithResult(_0xea50ba,null))[_0xa433('0x2f')](handleError(_0xea50ba,null));};exports['destroy']=function(_0x3b71c3,_0x585f55){return db[_0xa433('0x41')]['find']({'where':{'id':_0x3b71c3[_0xa433('0x62')]['id']}})[_0xa433('0x24')](handleEntityNotFound(_0x585f55,null))[_0xa433('0x24')](removeEntity(_0x585f55,null))[_0xa433('0x2f')](handleError(_0x585f55,null));};exports['describe']=function(_0x1268a5,_0x1b2bc7){return db[_0xa433('0x41')]['describe']()[_0xa433('0x24')](respondWithResult(_0x1b2bc7,null))[_0xa433('0x2f')](handleError(_0x1b2bc7,null));};exports[_0xa433('0x63')]=function(_0x4e17e6,_0x4bceb9,_0x443bf9){var _0x6aa045={'raw':!![],'where':{}},_0x56f213={},_0x2ef5e7;return db[_0xa433('0x41')][_0xa433('0x64')]({'where':{'id':_0x4e17e6['params']['id']}})['then'](handleEntityNotFound(_0x4bceb9,null))[_0xa433('0x24')](function(_0x543354){if(_0x543354){_0x2ef5e7=_0x543354[_0xa433('0x5d')]({'plain':!![]});_0x56f213[_0xa433('0x44')]=_['keys'](db[_0xa433('0x65')][_0xa433('0x42')]);_0x56f213[_0xa433('0x46')]=_[_0xa433('0x45')](_0x4e17e6['query']);_0x56f213['filters']=_['intersection'](_0x56f213[_0xa433('0x44')],_0x56f213['query']);_0x6aa045[_0xa433('0x4a')]=_[_0xa433('0x48')](_0x56f213['model'],qs[_0xa433('0x49')](_0x4e17e6['query'][_0xa433('0x49')]));_0x6aa045[_0xa433('0x4a')]=_0x6aa045[_0xa433('0x4a')][_0xa433('0x4b')]?_0x6aa045[_0xa433('0x4a')]:_0x56f213[_0xa433('0x44')];if(!_0x4e17e6['query'][_0xa433('0x4c')](_0xa433('0x66'))){_0x6aa045[_0xa433('0x67')]=qs[_0xa433('0x67')](_0x4e17e6[_0xa433('0x46')][_0xa433('0x67')]);_0x6aa045[_0xa433('0x34')]=qs[_0xa433('0x34')](_0x4e17e6[_0xa433('0x46')][_0xa433('0x34')]);}_0x6aa045[_0xa433('0x4d')]=qs[_0xa433('0x4e')](_0x4e17e6[_0xa433('0x46')][_0xa433('0x4e')]);_0x6aa045[_0xa433('0x4f')]=qs[_0xa433('0x47')](_[_0xa433('0x50')](_0x4e17e6[_0xa433('0x46')],_0x56f213['filters']));_0x6aa045[_0xa433('0x4f')][_0xa433('0x68')]=_0x543354['id'];if(_0x4e17e6[_0xa433('0x46')][_0xa433('0x53')]){_0x6aa045[_0xa433('0x4f')]=_[_0xa433('0x51')](_0x6aa045[_0xa433('0x4f')],{'$or':_[_0xa433('0x40')](_0x6aa045['attributes'],function(_0x562ca8){var _0x4ab40f={};_0x4ab40f[_0x562ca8]={'$like':'%'+_0x4e17e6['query'][_0xa433('0x53')]+'%'};return _0x4ab40f;})});}_0x6aa045=_[_0xa433('0x51')]({},_0x6aa045,_0x4e17e6['options']);return db[_0xa433('0x65')]['findAll'](_0x6aa045);}})[_0xa433('0x24')](function(_0x525efc){if(_0x525efc){return db[_0xa433('0x69')][_0xa433('0x6a')]({'where':{'id':_[_0xa433('0x40')](_0x525efc,_0xa433('0x6b')),'role':_0xa433('0x6c')},'attributes':['id',_0xa433('0x3d'),_0xa433('0x6d'),_0xa433('0x6e'),_0xa433('0x6f')]});}})['then'](function(_0x11e0cc){if(_0x11e0cc){return{'count':_0x11e0cc['count'],'rows':_['map'](_0x11e0cc['rows'],function(_0x2c695c){return{'membername':_0x2c695c[_0xa433('0x3d')],'UserId':_0x2c695c['id'],'queue_name':_0x2ef5e7['name'],'ChatQueueId':_0x2ef5e7['id'],'interface':util[_0xa433('0x70')](_0xa433('0x71'),_0xa433('0x72'),_0x2c695c[_0xa433('0x3d')]),'penalty':0x0,'paused':_0x2c695c[_0xa433('0x6d')],'createdAt':_0x2c695c[_0xa433('0x6f')],'updatedAt':_0x2c695c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa433('0x24')](respondWithFilteredResult(_0x4bceb9,_0x6aa045))['catch'](handleError(_0x4bceb9,null));};exports[_0xa433('0x73')]=function(_0x101927,_0x35a3df,_0x557c6c){var _0x473250={};var _0x19d3d5={};var _0x175554;var _0x469f20;return db[_0xa433('0x41')][_0xa433('0x64')]({'where':{'id':_0x101927[_0xa433('0x62')]['id']}})[_0xa433('0x24')](handleEntityNotFound(_0x35a3df,null))[_0xa433('0x24')](function(_0x704bbf){if(_0x704bbf){_0x175554=_0x704bbf;_0x19d3d5[_0xa433('0x44')]=_[_0xa433('0x45')](db[_0xa433('0x74')]['rawAttributes']);_0x19d3d5[_0xa433('0x46')]=_['keys'](_0x101927[_0xa433('0x46')]);_0x19d3d5['filters']=_[_0xa433('0x48')](_0x19d3d5[_0xa433('0x44')],_0x19d3d5[_0xa433('0x46')]);_0x473250[_0xa433('0x4a')]=_['intersection'](_0x19d3d5['model'],qs[_0xa433('0x49')](_0x101927['query']['fields']));_0x473250['attributes']=_0x473250[_0xa433('0x4a')][_0xa433('0x4b')]?_0x473250['attributes']:_0x19d3d5[_0xa433('0x44')];_0x473250[_0xa433('0x4d')]=qs[_0xa433('0x4e')](_0x101927[_0xa433('0x46')][_0xa433('0x4e')]);_0x473250[_0xa433('0x4f')]=qs[_0xa433('0x47')](_[_0xa433('0x50')](_0x101927[_0xa433('0x46')],_0x19d3d5['filters']));if(_0x101927[_0xa433('0x46')][_0xa433('0x53')]){_0x473250[_0xa433('0x4f')]=_[_0xa433('0x51')](_0x473250[_0xa433('0x4f')],{'$or':_[_0xa433('0x40')](_0x473250[_0xa433('0x4a')],function(_0x466e28){var _0x1556a={};_0x1556a[_0x466e28]={'$like':'%'+_0x101927[_0xa433('0x46')][_0xa433('0x53')]+'%'};return _0x1556a;})});}_0x473250=_[_0xa433('0x51')]({},_0x473250,_0x101927['options']);return _0x175554[_0xa433('0x73')](_0x473250);}})[_0xa433('0x24')](function(_0x3e0ebc){if(_0x3e0ebc){_0x469f20=_0x3e0ebc[_0xa433('0x4b')];if(!_0x101927[_0xa433('0x46')]['hasOwnProperty'](_0xa433('0x66'))){_0x473250['limit']=qs['limit'](_0x101927[_0xa433('0x46')]['limit']);_0x473250[_0xa433('0x34')]=qs[_0xa433('0x34')](_0x101927[_0xa433('0x46')][_0xa433('0x34')]);}return _0x175554['getTeams'](_0x473250);}})[_0xa433('0x24')](function(_0x3264d6){if(_0x3264d6){return _0x3264d6?{'count':_0x469f20,'rows':_0x3264d6}:null;}})[_0xa433('0x24')](respondWithResult(_0x35a3df,null))[_0xa433('0x2f')](handleError(_0x35a3df,null));};exports[_0xa433('0x75')]=function(_0x2dfaf0,_0x36c5f2,_0x39536d){var _0x6a4d37=_0x2dfaf0[_0xa433('0x5a')][_0xa433('0x76')];return db[_0xa433('0x74')][_0xa433('0x55')]({'where':{'id':_0x6a4d37},'attributes':['id'],'include':[{'model':db[_0xa433('0x69')],'as':_0xa433('0x77'),'attributes':['id',_0xa433('0x3d'),_0xa433('0x78'),'voicePause',_0xa433('0x79')],'raw':!![]}]})[_0xa433('0x24')](function(_0x4a9c07){if(_0x4a9c07){var _0x4471fe=_[_0xa433('0x7a')](_0x4a9c07,function(_0x112aae){var _0x2cffec=_0x112aae[_0xa433('0x5d')]({'plain':!![]});return _0x2cffec[_0xa433('0x77')];});return db['ChatQueue'][_0xa433('0x5f')]({'where':{'id':_0x2dfaf0[_0xa433('0x62')]['id']}})[_0xa433('0x24')](function(_0x42a287){return db[_0xa433('0x7b')][_0xa433('0x7c')](function(_0x404e65){return _0x42a287[_0xa433('0x75')](_0x6a4d37,{'transaction':_0x404e65})['then'](function(){return BPromise[_0xa433('0x7d')](_0x4471fe,function(_0x53a9b0){return db[_0xa433('0x65')][_0xa433('0x7e')]({'where':{'UserId':_0x53a9b0['id'],'ChatQueueId':_0x2dfaf0[_0xa433('0x62')]['id']},'transaction':_0x404e65});});})['then'](function(){_0x4471fe['forEach'](function(_0x4195b0){socket['emit'](_0xa433('0x7f'),{'UserId':_0x4195b0['id'],'ChatQueueId':_0x42a287['id']});});});});});}})['then'](respondWithStatusCode(_0x36c5f2,null))[_0xa433('0x2f')](handleError(_0x36c5f2,null));};exports[_0xa433('0x80')]=function(_0x499108,_0x8b940b,_0x51ee9f){return db[_0xa433('0x74')][_0xa433('0x55')]({'where':{'id':_0x499108['query'][_0xa433('0x76')]},'attributes':['id'],'include':[{'model':db[_0xa433('0x69')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x8b940b,null))[_0xa433('0x24')](function(_0x565b8d){var _0x58c833=_['map'](_0x565b8d,'id');var _0x511196=[];var _0x6d181e=[];var _0x58ef80=squel[_0xa433('0x81')]();_0x58ef80[_0xa433('0x82')](_0xa433('0x83'))['from'](_0xa433('0x84'),'tq')['join'](_0xa433('0x85'),'ut',_0xa433('0x86'))[_0xa433('0x4f')]('ChatQueueId\x20=\x20?',_0x499108[_0xa433('0x62')]['id']);for(var _0x4a6d16=0x0;_0x4a6d16<_0x565b8d[_0xa433('0x4b')];_0x4a6d16+=0x1){let _0x2ada1d=_0x565b8d[_0x4a6d16];for(var _0xf1ed8f=0x0;_0xf1ed8f<_0x2ada1d[_0xa433('0x77')][_0xa433('0x4b')];_0xf1ed8f+=0x1){let _0x250566=_0x2ada1d[_0xa433('0x77')][_0xf1ed8f];var _0x16fa0e=_0x58ef80[_0xa433('0x87')]();_0x16fa0e[_0xa433('0x4f')](_0xa433('0x88'),_0x250566['id']);_0x6d181e[_0xa433('0x89')](db[_0xa433('0x7b')][_0xa433('0x46')](_0x16fa0e[_0xa433('0x8a')](),{'type':db[_0xa433('0x7b')][_0xa433('0x8b')][_0xa433('0x8c')]})['then'](function(_0x2a042a){if(_0x2a042a[_0xa433('0x4b')]===0x1){return _0x250566['id'];}else{var _0x17633d=_[_0xa433('0x8d')](_['map'](_0x2a042a,'TeamId'),function(_0x32db87){return _[_0xa433('0x8e')](_0x58c833,_0x32db87);});if(_0x17633d){return _0x250566['id'];}}}));}}return BPromise[_0xa433('0x8f')](_0x6d181e)[_0xa433('0x24')](function(_0x25ac21){_0x511196=_(_0x511196)[_0xa433('0x90')](_0x25ac21)[_0xa433('0x91')]()[_0xa433('0x92')]();return db['ChatQueue'][_0xa433('0x5f')]({'where':{'id':_0x499108[_0xa433('0x62')]['id']}})[_0xa433('0x24')](function(_0x57f6c5){return db[_0xa433('0x7b')]['transaction'](function(_0x598b63){return _0x57f6c5[_0xa433('0x80')](_0x499108[_0xa433('0x46')][_0xa433('0x76')],{'transaction':_0x598b63})[_0xa433('0x24')](function(){if(!_['isEmpty'](_0x511196)){return _0x57f6c5[_0xa433('0x93')](_0x511196,{'transaction':_0x598b63});}})[_0xa433('0x24')](function(){_0x511196[_0xa433('0x94')](function(_0x3003b5){socket[_0xa433('0x95')](_0xa433('0x96'),{'UserId':_0x3003b5,'ChatQueueId':_0x57f6c5['id']});});});});});});})[_0xa433('0x24')](respondWithStatusCode(_0x8b940b,null))[_0xa433('0x2f')](handleError(_0x8b940b,null));};exports[_0xa433('0x97')]=function(_0x1bb96e,_0x596d29,_0x31641b){return db[_0xa433('0x41')][_0xa433('0x5f')]({'where':{'id':_0x1bb96e[_0xa433('0x62')]['id']}})[_0xa433('0x24')](handleEntityNotFound(_0x596d29,null))[_0xa433('0x24')](function(_0xc0a7a7){if(_0xc0a7a7){return _0xc0a7a7[_0xa433('0x97')](_0x1bb96e[_0xa433('0x5a')][_0xa433('0x76')],_[_0xa433('0x98')](_0x1bb96e[_0xa433('0x5a')],[_0xa433('0x76'),'id'])||{})['spread'](function(_0x2ecada){for(var _0x18837d=0x0;_0x18837d<_0x1bb96e['body'][_0xa433('0x76')]['length'];_0x18837d+=0x1){socket[_0xa433('0x95')](_0xa433('0x7f'),{'UserId':_0x1bb96e[_0xa433('0x5a')][_0xa433('0x76')][_0x18837d],'ChatQueueId':_0x1bb96e['params']['id']});}return _0x2ecada;});}})[_0xa433('0x24')](respondWithResult(_0x596d29,null))['catch'](handleError(_0x596d29,null));};exports[_0xa433('0x93')]=function(_0x3b1069,_0x296b6f,_0xa3907e){return db['ChatQueue'][_0xa433('0x5f')]({'where':{'id':_0x3b1069[_0xa433('0x62')]['id']}})[_0xa433('0x24')](handleEntityNotFound(_0x296b6f,null))['then'](function(_0xf77308){if(_0xf77308){return _0xf77308[_0xa433('0x93')](_0x3b1069[_0xa433('0x46')][_0xa433('0x76')])[_0xa433('0x24')](function(){if(_[_0xa433('0x99')](_0x3b1069[_0xa433('0x46')]['ids'])){for(var _0x2e042d=0x0;_0x2e042d<_0x3b1069[_0xa433('0x46')]['ids'][_0xa433('0x4b')];_0x2e042d+=0x1){socket[_0xa433('0x95')]('userChatQueue:remove',{'UserId':Number(_0x3b1069['query'][_0xa433('0x76')][_0x2e042d]),'ChatQueueId':Number(_0x3b1069[_0xa433('0x62')]['id'])});}}else{socket[_0xa433('0x95')](_0xa433('0x96'),{'UserId':Number(_0x3b1069[_0xa433('0x46')]['ids']),'ChatQueueId':Number(_0x3b1069['params']['id'])});}});}})[_0xa433('0x24')](respondWithStatusCode(_0x296b6f,null))['catch'](handleError(_0x296b6f,null));};exports[_0xa433('0x9a')]=function(_0xa06fcb,_0xdbdf25,_0x11980a){var _0x83fe67={};var _0x46c423={};var _0x488cc7;var _0x2e9f3d;return db[_0xa433('0x41')][_0xa433('0x64')]({'where':{'id':_0xa06fcb[_0xa433('0x62')]['id']}})[_0xa433('0x24')](handleEntityNotFound(_0xdbdf25,null))['then'](function(_0x4f3cd4){if(_0x4f3cd4){_0x488cc7=_0x4f3cd4;_0x46c423[_0xa433('0x44')]=_['keys'](db['User'][_0xa433('0x42')]);_0x46c423['query']=_['keys'](_0xa06fcb[_0xa433('0x46')]);_0x46c423['filters']=_[_0xa433('0x48')](_0x46c423[_0xa433('0x44')],_0x46c423[_0xa433('0x46')]);_0x83fe67[_0xa433('0x4a')]=_[_0xa433('0x48')](_0x46c423[_0xa433('0x44')],qs[_0xa433('0x49')](_0xa06fcb[_0xa433('0x46')]['fields']));_0x83fe67[_0xa433('0x4a')]=_0x83fe67[_0xa433('0x4a')][_0xa433('0x4b')]?_0x83fe67[_0xa433('0x4a')]:_0x46c423[_0xa433('0x44')];_0x83fe67[_0xa433('0x4d')]=qs['sort'](_0xa06fcb[_0xa433('0x46')]['sort']);_0x83fe67[_0xa433('0x4f')]=qs['filters'](_[_0xa433('0x50')](_0xa06fcb[_0xa433('0x46')],_0x46c423[_0xa433('0x47')]));if(_0xa06fcb['query'][_0xa433('0x53')]){_0x83fe67['where']=_[_0xa433('0x51')](_0x83fe67[_0xa433('0x4f')],{'$or':_['map'](_0x83fe67['attributes'],function(_0x586705){var _0x3f6118={};_0x3f6118[_0x586705]={'$like':'%'+_0xa06fcb['query'][_0xa433('0x53')]+'%'};return _0x3f6118;})});}_0x83fe67=_[_0xa433('0x51')]({},_0x83fe67,_0xa06fcb['options']);return _0x488cc7[_0xa433('0x9a')](_0x83fe67);}})[_0xa433('0x24')](function(_0x42c0bd){if(_0x42c0bd){_0x2e9f3d=_0x42c0bd['length'];if(!_0xa06fcb[_0xa433('0x46')][_0xa433('0x4c')](_0xa433('0x66'))){_0x83fe67[_0xa433('0x67')]=qs['limit'](_0xa06fcb[_0xa433('0x46')][_0xa433('0x67')]);_0x83fe67['offset']=qs[_0xa433('0x34')](_0xa06fcb[_0xa433('0x46')]['offset']);}return _0x488cc7[_0xa433('0x9a')](_0x83fe67);}})['then'](function(_0x541b0b){if(_0x541b0b){return _0x541b0b?{'count':_0x2e9f3d,'rows':_0x541b0b}:null;}})[_0xa433('0x24')](respondWithResult(_0xdbdf25,null))[_0xa433('0x2f')](handleError(_0xdbdf25,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 913001b..09ec5f6 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x3fa146,_0x443a70){var _0x1fd32f=function(_0x1ab386){while(--_0x1ab386){_0x3fa146['push'](_0x3fa146['shift']());}};_0x1fd32f(++_0x443a70);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3393f7,_0x58b453){_0x3393f7=_0x3393f7-0x0;var _0x4ba2d8=_0x5f2f[_0x3393f7];return _0x4ba2d8;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x45ab4b,_0x137148){var _0x189be0=function(_0x54a82d){while(--_0x54a82d){_0x45ab4b['push'](_0x45ab4b['shift']());}};_0x189be0(++_0x137148);}(_0x5f2f,0x73));var _0xf5f2=function(_0x38a035,_0x117208){_0x38a035=_0x38a035-0x0;var _0x246052=_0x5f2f[_0x38a035];return _0x246052;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 414dc27..30c5602 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 _0xbaa2=['./chatQueue.attributes','exports','ChatQueue','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4906ca,_0x7cb8c0){var _0x493642=function(_0x3624fa){while(--_0x3624fa){_0x4906ca['push'](_0x4906ca['shift']());}};_0x493642(++_0x7cb8c0);}(_0xbaa2,0x123));var _0x2baa=function(_0x5da9f4,_0x49d1ac){_0x5da9f4=_0x5da9f4-0x0;var _0xeb401b=_0xbaa2[_0x5da9f4];return _0xeb401b;};'use strict';var _=require(_0x2baa('0x0'));var util=require(_0x2baa('0x1'));var logger=require(_0x2baa('0x2'))(_0x2baa('0x3'));var moment=require(_0x2baa('0x4'));var BPromise=require(_0x2baa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2baa('0x6'));var rimraf=require(_0x2baa('0x7'));var config=require(_0x2baa('0x8'));var attributes=require(_0x2baa('0x9'));module[_0x2baa('0xa')]=function(_0x220deb,_0x5669c3){return _0x220deb['define'](_0x2baa('0xb'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bdb=['./chatQueue.attributes','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x469e78,_0x3bb77e){var _0x1e2468=function(_0x467741){while(--_0x467741){_0x469e78['push'](_0x469e78['shift']());}};_0x1e2468(++_0x3bb77e);}(_0x2bdb,0x1c9));var _0xb2bd=function(_0x5c3419,_0x4bf557){_0x5c3419=_0x5c3419-0x0;var _0x4ecf41=_0x2bdb[_0x5c3419];return _0x4ecf41;};'use strict';var _=require('lodash');var util=require(_0xb2bd('0x0'));var logger=require(_0xb2bd('0x1'))(_0xb2bd('0x2'));var moment=require(_0xb2bd('0x3'));var BPromise=require(_0xb2bd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2bd('0x5'));var rimraf=require('rimraf');var config=require(_0xb2bd('0x6'));var attributes=require(_0xb2bd('0x7'));module['exports']=function(_0x5bab0b,_0x23086d){return _0x5bab0b['define']('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 9816d5d..c6614a5 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 _0xe195=['request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','model','map','info','stringify','find','ShowChatQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register'];(function(_0x25abc3,_0x5bac1b){var _0x3bd83a=function(_0x103a81){while(--_0x103a81){_0x25abc3['push'](_0x25abc3['shift']());}};_0x3bd83a(++_0x5bac1b);}(_0xe195,0x1c6));var _0x5e19=function(_0x48cdbf,_0xb8270b){_0x48cdbf=_0x48cdbf-0x0;var _0x327f2d=_0xe195[_0x48cdbf];return _0x327f2d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5e19('0x0'));var BPromise=require(_0x5e19('0x1'));var rs=require(_0x5e19('0x2'));var fs=require('fs');var Redis=require(_0x5e19('0x3'));var db=require(_0x5e19('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e19('0x5'))(_0x5e19('0x6'));var config=require(_0x5e19('0x7'));var jayson=require(_0x5e19('0x8'));var client=jayson[_0x5e19('0x9')]['http']({'port':0x232a});config[_0x5e19('0xa')]=_['defaults'](config[_0x5e19('0xa')],{'host':_0x5e19('0xb'),'port':0x18eb});var socket=require(_0x5e19('0xc'))(new Redis(config[_0x5e19('0xa')]));require('./chatQueue.socket')[_0x5e19('0xd')](socket);function respondWithRpcPromise(_0x58562a,_0x28d8e4,_0x382234){return new BPromise(function(_0x44eb24,_0x1312f5){return client[_0x5e19('0xe')](_0x58562a,_0x382234)[_0x5e19('0xf')](function(_0xdb7aae){logger['info'](_0x5e19('0x10'),_0x28d8e4,_0x5e19('0x11'));logger[_0x5e19('0x12')](_0x5e19('0x13'),_0x28d8e4,_0x5e19('0x11'),JSON['stringify'](_0xdb7aae));if(_0xdb7aae[_0x5e19('0x14')]){if(_0xdb7aae[_0x5e19('0x14')]['code']===0x1f4){logger[_0x5e19('0x14')](_0x5e19('0x10'),_0x28d8e4,_0xdb7aae[_0x5e19('0x14')]['message']);return _0x1312f5(_0xdb7aae['error'][_0x5e19('0x15')]);}logger['error'](_0x5e19('0x10'),_0x28d8e4,_0xdb7aae[_0x5e19('0x14')][_0x5e19('0x15')]);return _0x44eb24(_0xdb7aae['error']['message']);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x28d8e4,_0x5e19('0x11'));_0x44eb24(_0xdb7aae[_0x5e19('0x16')]['message']);}})[_0x5e19('0x17')](function(_0x250b8d){logger[_0x5e19('0x14')](_0x5e19('0x10'),_0x28d8e4,_0x250b8d);_0x1312f5(_0x250b8d);});});}exports[_0x5e19('0x18')]=function(_0x3128f1){var _0x7124b5=this;return new Promise(function(_0x38c48b,_0x5a80dc){return db[_0x5e19('0x19')][_0x5e19('0x1a')]({'raw':_0x3128f1['options']?_0x3128f1[_0x5e19('0x1b')][_0x5e19('0x1c')]===undefined?!![]:![]:!![],'where':_0x3128f1[_0x5e19('0x1b')]?_0x3128f1[_0x5e19('0x1b')][_0x5e19('0x1d')]||null:null,'attributes':_0x3128f1[_0x5e19('0x1b')]?_0x3128f1[_0x5e19('0x1b')][_0x5e19('0x1e')]||null:null,'limit':_0x3128f1['options']?_0x3128f1[_0x5e19('0x1b')][_0x5e19('0x1f')]||null:null,'include':_0x3128f1[_0x5e19('0x1b')]?_0x3128f1[_0x5e19('0x1b')][_0x5e19('0x20')]?_['map'](_0x3128f1[_0x5e19('0x1b')][_0x5e19('0x20')],function(_0x969467){return{'model':db[_0x969467[_0x5e19('0x21')]],'as':_0x969467['as'],'attributes':_0x969467[_0x5e19('0x1e')],'include':_0x969467[_0x5e19('0x20')]?_[_0x5e19('0x22')](_0x969467[_0x5e19('0x20')],function(_0xa9e310){return{'model':db[_0xa9e310[_0x5e19('0x21')]],'as':_0xa9e310['as'],'attributes':_0xa9e310[_0x5e19('0x1e')],'include':_0xa9e310[_0x5e19('0x20')]?_[_0x5e19('0x22')](_0xa9e310[_0x5e19('0x20')],function(_0x5e883b){return{'model':db[_0x5e883b[_0x5e19('0x21')]],'as':_0x5e883b['as'],'attributes':_0x5e883b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x24d31f){logger[_0x5e19('0x23')](_0x5e19('0x18'),_0x3128f1);logger[_0x5e19('0x12')](_0x5e19('0x18'),_0x3128f1,JSON[_0x5e19('0x24')](_0x24d31f));_0x38c48b(_0x24d31f);})[_0x5e19('0x17')](function(_0x5a74d3){logger[_0x5e19('0x14')](_0x5e19('0x18'),_0x5a74d3['message'],_0x3128f1);_0x5a80dc(_0x7124b5[_0x5e19('0x14')](0x1f4,_0x5a74d3['message']));});});};exports['ShowChatQueue']=function(_0x5ea6b3){var _0x2b6527=this;return new Promise(function(_0x127b6f,_0x47d9a4){return db['ChatQueue'][_0x5e19('0x25')]({'raw':_0x5ea6b3[_0x5e19('0x1b')]?_0x5ea6b3[_0x5e19('0x1b')][_0x5e19('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea6b3[_0x5e19('0x1b')]?_0x5ea6b3[_0x5e19('0x1b')][_0x5e19('0x1d')]||null:null,'attributes':_0x5ea6b3[_0x5e19('0x1b')]?_0x5ea6b3[_0x5e19('0x1b')][_0x5e19('0x1e')]||null:null,'include':_0x5ea6b3['options']?_0x5ea6b3['options'][_0x5e19('0x20')]?_['map'](_0x5ea6b3[_0x5e19('0x1b')][_0x5e19('0x20')],function(_0x4747e1){return{'model':db[_0x4747e1[_0x5e19('0x21')]],'as':_0x4747e1['as'],'attributes':_0x4747e1[_0x5e19('0x1e')],'include':_0x4747e1[_0x5e19('0x20')]?_[_0x5e19('0x22')](_0x4747e1[_0x5e19('0x20')],function(_0x250a2a){return{'model':db[_0x250a2a['model']],'as':_0x250a2a['as'],'attributes':_0x250a2a[_0x5e19('0x1e')],'include':_0x250a2a[_0x5e19('0x20')]?_[_0x5e19('0x22')](_0x250a2a[_0x5e19('0x20')],function(_0x42f9ef){return{'model':db[_0x42f9ef[_0x5e19('0x21')]],'as':_0x42f9ef['as'],'attributes':_0x42f9ef['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x240565){logger['info'](_0x5e19('0x26'),_0x5ea6b3);logger[_0x5e19('0x12')](_0x5e19('0x26'),_0x5ea6b3,JSON[_0x5e19('0x24')](_0x240565));_0x127b6f(_0x240565);})[_0x5e19('0x17')](function(_0x1bac91){logger[_0x5e19('0x14')](_0x5e19('0x26'),_0x1bac91['message'],_0x5ea6b3);_0x47d9a4(_0x2b6527[_0x5e19('0x14')](0x1f4,_0x1bac91['message']));});});}; \ No newline at end of file +var _0xe6e4=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./chatQueue.socket','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetChatQueue','ChatQueue','options','raw','attributes','limit','include','map','model','ShowChatQueue','find','where','lodash','util'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0xe6e4,0xc1));var _0x4e6e=function(_0x1486bc,_0x204e1f){_0x1486bc=_0x1486bc-0x0;var _0x4009e1=_0xe6e4[_0x1486bc];return _0x4009e1;};'use strict';var _=require(_0x4e6e('0x0'));var util=require(_0x4e6e('0x1'));var moment=require(_0x4e6e('0x2'));var BPromise=require(_0x4e6e('0x3'));var rs=require(_0x4e6e('0x4'));var fs=require('fs');var Redis=require(_0x4e6e('0x5'));var db=require(_0x4e6e('0x6'))['db'];var utils=require(_0x4e6e('0x7'));var logger=require(_0x4e6e('0x8'))('rpc');var config=require(_0x4e6e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4e6e('0xa')]({'port':0x232a});config[_0x4e6e('0xb')]=_['defaults'](config[_0x4e6e('0xb')],{'host':_0x4e6e('0xc'),'port':0x18eb});var socket=require(_0x4e6e('0xd'))(new Redis(config[_0x4e6e('0xb')]));require(_0x4e6e('0xe'))['register'](socket);function respondWithRpcPromise(_0x2a5eb1,_0x382c9d,_0x3fc2c5){return new BPromise(function(_0x1021f1,_0xc33fd8){return client['request'](_0x2a5eb1,_0x3fc2c5)[_0x4e6e('0xf')](function(_0x1640d6){logger['info'](_0x4e6e('0x10'),_0x382c9d,_0x4e6e('0x11'));logger[_0x4e6e('0x12')](_0x4e6e('0x13'),_0x382c9d,_0x4e6e('0x11'),JSON[_0x4e6e('0x14')](_0x1640d6));if(_0x1640d6[_0x4e6e('0x15')]){if(_0x1640d6['error'][_0x4e6e('0x16')]===0x1f4){logger[_0x4e6e('0x15')](_0x4e6e('0x10'),_0x382c9d,_0x1640d6[_0x4e6e('0x15')][_0x4e6e('0x17')]);return _0xc33fd8(_0x1640d6[_0x4e6e('0x15')]['message']);}logger['error'](_0x4e6e('0x10'),_0x382c9d,_0x1640d6[_0x4e6e('0x15')]['message']);return _0x1021f1(_0x1640d6[_0x4e6e('0x15')][_0x4e6e('0x17')]);}else{logger[_0x4e6e('0x18')](_0x4e6e('0x10'),_0x382c9d,'request\x20sent');_0x1021f1(_0x1640d6[_0x4e6e('0x19')][_0x4e6e('0x17')]);}})[_0x4e6e('0x1a')](function(_0x3dbc30){logger[_0x4e6e('0x15')]('ChatQueue,\x20%s,\x20%s',_0x382c9d,_0x3dbc30);_0xc33fd8(_0x3dbc30);});});}exports[_0x4e6e('0x1b')]=function(_0x5cb1d4){var _0x3205af=this;return new Promise(function(_0x1f0cec,_0x143333){return db[_0x4e6e('0x1c')]['findAll']({'raw':_0x5cb1d4[_0x4e6e('0x1d')]?_0x5cb1d4[_0x4e6e('0x1d')][_0x4e6e('0x1e')]===undefined?!![]:![]:!![],'where':_0x5cb1d4['options']?_0x5cb1d4[_0x4e6e('0x1d')]['where']||null:null,'attributes':_0x5cb1d4[_0x4e6e('0x1d')]?_0x5cb1d4[_0x4e6e('0x1d')][_0x4e6e('0x1f')]||null:null,'limit':_0x5cb1d4['options']?_0x5cb1d4[_0x4e6e('0x1d')][_0x4e6e('0x20')]||null:null,'include':_0x5cb1d4['options']?_0x5cb1d4[_0x4e6e('0x1d')][_0x4e6e('0x21')]?_[_0x4e6e('0x22')](_0x5cb1d4[_0x4e6e('0x1d')][_0x4e6e('0x21')],function(_0x3e7bce){return{'model':db[_0x3e7bce[_0x4e6e('0x23')]],'as':_0x3e7bce['as'],'attributes':_0x3e7bce[_0x4e6e('0x1f')],'include':_0x3e7bce['include']?_['map'](_0x3e7bce['include'],function(_0x4f6279){return{'model':db[_0x4f6279['model']],'as':_0x4f6279['as'],'attributes':_0x4f6279['attributes'],'include':_0x4f6279[_0x4e6e('0x21')]?_['map'](_0x4f6279[_0x4e6e('0x21')],function(_0x3ab5b8){return{'model':db[_0x3ab5b8['model']],'as':_0x3ab5b8['as'],'attributes':_0x3ab5b8['attributes']};}):[]};}):[]};}):[]:[]})[_0x4e6e('0xf')](function(_0x282075){logger[_0x4e6e('0x18')](_0x4e6e('0x1b'),_0x5cb1d4);logger[_0x4e6e('0x12')](_0x4e6e('0x1b'),_0x5cb1d4,JSON[_0x4e6e('0x14')](_0x282075));_0x1f0cec(_0x282075);})[_0x4e6e('0x1a')](function(_0x5aa252){logger[_0x4e6e('0x15')](_0x4e6e('0x1b'),_0x5aa252[_0x4e6e('0x17')],_0x5cb1d4);_0x143333(_0x3205af['error'](0x1f4,_0x5aa252[_0x4e6e('0x17')]));});});};exports[_0x4e6e('0x24')]=function(_0x219329){var _0x1ee22e=this;return new Promise(function(_0x13cec0,_0x2c9a09){return db[_0x4e6e('0x1c')][_0x4e6e('0x25')]({'raw':_0x219329[_0x4e6e('0x1d')]?_0x219329[_0x4e6e('0x1d')][_0x4e6e('0x1e')]===undefined?!![]:![]:!![],'where':_0x219329[_0x4e6e('0x1d')]?_0x219329['options'][_0x4e6e('0x26')]||null:null,'attributes':_0x219329[_0x4e6e('0x1d')]?_0x219329[_0x4e6e('0x1d')][_0x4e6e('0x1f')]||null:null,'include':_0x219329[_0x4e6e('0x1d')]?_0x219329[_0x4e6e('0x1d')]['include']?_[_0x4e6e('0x22')](_0x219329[_0x4e6e('0x1d')][_0x4e6e('0x21')],function(_0x46deb5){return{'model':db[_0x46deb5[_0x4e6e('0x23')]],'as':_0x46deb5['as'],'attributes':_0x46deb5[_0x4e6e('0x1f')],'include':_0x46deb5[_0x4e6e('0x21')]?_[_0x4e6e('0x22')](_0x46deb5[_0x4e6e('0x21')],function(_0x21fdaa){return{'model':db[_0x21fdaa[_0x4e6e('0x23')]],'as':_0x21fdaa['as'],'attributes':_0x21fdaa[_0x4e6e('0x1f')],'include':_0x21fdaa[_0x4e6e('0x21')]?_['map'](_0x21fdaa[_0x4e6e('0x21')],function(_0x20da75){return{'model':db[_0x20da75[_0x4e6e('0x23')]],'as':_0x20da75['as'],'attributes':_0x20da75[_0x4e6e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4e6e('0xf')](function(_0x52953e){logger[_0x4e6e('0x18')](_0x4e6e('0x24'),_0x219329);logger[_0x4e6e('0x12')](_0x4e6e('0x24'),_0x219329,JSON['stringify'](_0x52953e));_0x13cec0(_0x52953e);})[_0x4e6e('0x1a')](function(_0x3a54c2){logger['error']('ShowChatQueue',_0x3a54c2['message'],_0x219329);_0x2c9a09(_0x1ee22e[_0x4e6e('0x15')](0x1f4,_0x3a54c2['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 7cc7288..626855a 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x3231cd,_0x469dfd){var _0x215c47=function(_0xc405f){while(--_0xc405f){_0x3231cd['push'](_0x3231cd['shift']());}};_0x215c47(++_0x469dfd);}(_0x0b0e,0x187));var _0xe0b0=function(_0x25f805,_0x59caf3){_0x25f805=_0x25f805-0x0;var _0xf6628f=_0x0b0e[_0x25f805];return _0xf6628f;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0xadb5=['update','emit','register','length','chatQueue:','save'];(function(_0xd7802a,_0x5bc757){var _0x3cb1c8=function(_0x212480){while(--_0x212480){_0xd7802a['push'](_0xd7802a['shift']());}};_0x3cb1c8(++_0x5bc757);}(_0xadb5,0xad));var _0x5adb=function(_0xf4553,_0x2bc07f){_0xf4553=_0xf4553-0x0;var _0x16a2c4=_0xadb5[_0xf4553];return _0x16a2c4;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x5adb('0x0'),'remove',_0x5adb('0x1')];function createListener(_0x38f67f,_0x3129c3){return function(_0x4aecec){_0x3129c3[_0x5adb('0x2')](_0x38f67f,_0x4aecec);};}function removeListener(_0x31457,_0x2e3ef4){return function(){ChatQueueEvents['removeListener'](_0x31457,_0x2e3ef4);};}exports[_0x5adb('0x3')]=function(_0x168d89){for(var _0x3e2555=0x0,_0x3213e8=events[_0x5adb('0x4')];_0x3e2555<_0x3213e8;_0x3e2555++){var _0x353885=events[_0x3e2555];var _0x47228a=createListener(_0x5adb('0x5')+_0x353885,_0x168d89);ChatQueueEvents['on'](_0x353885,_0x47228a);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 95d95ed..66a388c 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 _0x55ef=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','delete','removeTeams','removeAgents','exports'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x55ef,0x198));var _0xf55e=function(_0x1dcc95,_0x2cb90e){_0x1dcc95=_0x1dcc95-0x0;var _0xdb9a1d=_0x55ef[_0x1dcc95];return _0xdb9a1d;};'use strict';var multer=require(_0xf55e('0x0'));var util=require('util');var path=require(_0xf55e('0x1'));var timeout=require(_0xf55e('0x2'));var express=require('express');var router=express[_0xf55e('0x3')]();var auth=require(_0xf55e('0x4'));var interaction=require(_0xf55e('0x5'));var config=require('../../config/environment');var controller=require('./chatQueue.controller');router[_0xf55e('0x6')]('/',auth[_0xf55e('0x7')](),controller['index']);router[_0xf55e('0x6')](_0xf55e('0x8'),auth[_0xf55e('0x7')](),controller[_0xf55e('0x9')]);router[_0xf55e('0x6')](_0xf55e('0xa'),auth[_0xf55e('0x7')](),controller[_0xf55e('0xb')]);router[_0xf55e('0x6')]('/:id/members',auth['isAuthenticated'](),controller[_0xf55e('0xc')]);router[_0xf55e('0x6')](_0xf55e('0xd'),auth['isAuthenticated'](),controller[_0xf55e('0xe')]);router[_0xf55e('0x6')](_0xf55e('0xf'),auth[_0xf55e('0x7')](),controller[_0xf55e('0x10')]);router[_0xf55e('0x11')]('/',auth[_0xf55e('0x7')](),controller[_0xf55e('0x12')]);router[_0xf55e('0x11')](_0xf55e('0xd'),auth[_0xf55e('0x7')](),controller[_0xf55e('0x13')]);router[_0xf55e('0x11')]('/:id/users',auth[_0xf55e('0x7')](),controller['addAgents']);router['put'](_0xf55e('0xa'),auth[_0xf55e('0x7')](),controller['update']);router[_0xf55e('0x14')](_0xf55e('0xa'),auth[_0xf55e('0x7')](),controller['destroy']);router[_0xf55e('0x14')]('/:id/teams',auth[_0xf55e('0x7')](),controller[_0xf55e('0x15')]);router[_0xf55e('0x14')](_0xf55e('0xf'),auth[_0xf55e('0x7')](),controller[_0xf55e('0x16')]);module[_0xf55e('0x17')]=router; \ No newline at end of file +var _0xdd86=['../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0xef4ef0,_0x3c72f9){var _0x39b60b=function(_0x1d824c){while(--_0x1d824c){_0xef4ef0['push'](_0xef4ef0['shift']());}};_0x39b60b(++_0x3c72f9);}(_0xdd86,0x163));var _0x6dd8=function(_0x4fe2e7,_0x8a434){_0x4fe2e7=_0x4fe2e7-0x0;var _0x1df240=_0xdd86[_0x4fe2e7];return _0x1df240;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6dd8('0x0'));var timeout=require(_0x6dd8('0x1'));var express=require(_0x6dd8('0x2'));var router=express[_0x6dd8('0x3')]();var auth=require(_0x6dd8('0x4'));var interaction=require(_0x6dd8('0x5'));var config=require(_0x6dd8('0x6'));var controller=require(_0x6dd8('0x7'));router[_0x6dd8('0x8')]('/',auth[_0x6dd8('0x9')](),controller['index']);router[_0x6dd8('0x8')]('/describe',auth[_0x6dd8('0x9')](),controller[_0x6dd8('0xa')]);router['get'](_0x6dd8('0xb'),auth[_0x6dd8('0x9')](),controller['show']);router[_0x6dd8('0x8')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x6dd8('0x8')](_0x6dd8('0xc'),auth[_0x6dd8('0x9')](),controller[_0x6dd8('0xd')]);router[_0x6dd8('0x8')](_0x6dd8('0xe'),auth[_0x6dd8('0x9')](),controller[_0x6dd8('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6dd8('0x10')]);router[_0x6dd8('0x11')]('/:id/teams',auth[_0x6dd8('0x9')](),controller[_0x6dd8('0x12')]);router['post'](_0x6dd8('0xe'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x6dd8('0xb'),auth[_0x6dd8('0x9')](),controller['update']);router[_0x6dd8('0x13')](_0x6dd8('0xb'),auth['isAuthenticated'](),controller[_0x6dd8('0x14')]);router[_0x6dd8('0x13')](_0x6dd8('0xc'),auth[_0x6dd8('0x9')](),controller[_0x6dd8('0x15')]);router[_0x6dd8('0x13')](_0x6dd8('0xe'),auth[_0x6dd8('0x9')](),controller[_0x6dd8('0x16')]);module[_0x6dd8('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 75c6020..4dd8e0b 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 _0xb73d=['STRING','DATE','moment','sequelize','exports'];(function(_0x5c7638,_0x16de22){var _0x32b328=function(_0x5e6fca){while(--_0x5e6fca){_0x5c7638['push'](_0x5c7638['shift']());}};_0x32b328(++_0x16de22);}(_0xb73d,0xed));var _0xdb73=function(_0x3f48c8,_0x299d53){_0x3f48c8=_0x3f48c8-0x0;var _0x4c7512=_0xb73d[_0x3f48c8];return _0x4c7512;};'use strict';var moment=require(_0xdb73('0x0'));var Sequelize=require(_0xdb73('0x1'));module[_0xdb73('0x2')]={'uniqueid':{'type':Sequelize[_0xdb73('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xdb73('0x3')]},'joinAt':{'type':Sequelize[_0xdb73('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xdb73('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xdb73('0x3')]}}; \ No newline at end of file +var _0x2e45=['sequelize','exports','STRING','DATE','moment'];(function(_0x369636,_0x434e54){var _0x42e25e=function(_0x3783a9){while(--_0x3783a9){_0x369636['push'](_0x369636['shift']());}};_0x42e25e(++_0x434e54);}(_0x2e45,0x162));var _0x52e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2e45[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x52e4('0x0'));var Sequelize=require(_0x52e4('0x1'));module[_0x52e4('0x2')]={'uniqueid':{'type':Sequelize[_0x52e4('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x52e4('0x4')]},'leaveAt':{'type':Sequelize[_0x52e4('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x52e4('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index b90af91..eff028b 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 _0xcb91=['options','includeAll','include','findAll','params','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','ChatQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge'];(function(_0xa899dd,_0x36a5f1){var _0x21ea9a=function(_0x42fa21){while(--_0x42fa21){_0xa899dd['push'](_0xa899dd['shift']());}};_0x21ea9a(++_0x36a5f1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xcb91[_0x465a0c];return _0x1e202e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['index']=function(_0xd6891c,_0x21effa){var _0x41a9a0={},_0x1804fd={},_0x406821={'count':0x0,'rows':[]};var _0x21d6f5=_[_0x1cb9('0x26')](db[_0x1cb9('0x27')][_0x1cb9('0x28')],function(_0x9de64b){return{'name':_0x9de64b['fieldName'],'type':_0x9de64b[_0x1cb9('0x29')]['key']};});_0x1804fd[_0x1cb9('0x2a')]=_['map'](_0x21d6f5,_0x1cb9('0x24'));_0x1804fd[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2d')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x1804fd['model'],qs[_0x1cb9('0x2f')](_0xd6891c['query'][_0x1cb9('0x2f')]));_0x41a9a0['attributes']=_0x41a9a0[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x41a9a0[_0x1cb9('0x2e')]:_0x1804fd[_0x1cb9('0x2a')];if(!_0xd6891c['query'][_0x1cb9('0x31')](_0x1cb9('0x32'))){_0x41a9a0[_0x1cb9('0x1b')]=qs[_0x1cb9('0x1b')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1b')]);_0x41a9a0[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1a')]);}_0x41a9a0[_0x1cb9('0x33')]=qs[_0x1cb9('0x34')](_0xd6891c[_0x1cb9('0x2b')]['sort']);_0x41a9a0['where']=qs[_0x1cb9('0x35')](_[_0x1cb9('0x36')](_0xd6891c[_0x1cb9('0x2b')],_0x1804fd[_0x1cb9('0x35')]),_0x21d6f5);if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x37')]){_0x41a9a0[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x41a9a0['where'],{'$or':_[_0x1cb9('0x26')](_0x21d6f5,function(_0x1482c4){if(_0x1482c4[_0x1cb9('0x29')]!=='VIRTUAL'){var _0x2a5aac={};_0x2a5aac[_0x1482c4['name']]={'$like':'%'+_0xd6891c[_0x1cb9('0x2b')]['filter']+'%'};return _0x2a5aac;}})});}_0x41a9a0=_[_0x1cb9('0x39')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x3a')]);var _0x289b73={'where':_0x41a9a0[_0x1cb9('0x38')]};return db[_0x1cb9('0x27')][_0x1cb9('0x19')](_0x289b73)[_0x1cb9('0x1f')](function(_0x4a4788){_0x406821['count']=_0x4a4788;if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x3b')]){_0x41a9a0[_0x1cb9('0x3c')]=[{'all':!![]}];}return db[_0x1cb9('0x27')][_0x1cb9('0x3d')](_0x41a9a0);})[_0x1cb9('0x1f')](function(_0x32130b){_0x406821['rows']=_0x32130b;return _0x406821;})[_0x1cb9('0x1f')](respondWithFilteredResult(_0x21effa,_0x41a9a0))['catch'](handleError(_0x21effa,null));};exports['show']=function(_0x4c6c75,_0x409c62){var _0x397ff9={'raw':!![],'where':{'id':_0x4c6c75[_0x1cb9('0x3e')]['id']}},_0x1bf51c={};_0x1bf51c[_0x1cb9('0x2a')]=_['keys'](db[_0x1cb9('0x27')]['rawAttributes']);_0x1bf51c[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0x4c6c75[_0x1cb9('0x2b')]);_0x1bf51c['filters']=_[_0x1cb9('0x2d')](_0x1bf51c['model'],_0x1bf51c[_0x1cb9('0x2b')]);_0x397ff9[_0x1cb9('0x2e')]=_['intersection'](_0x1bf51c['model'],qs[_0x1cb9('0x2f')](_0x4c6c75[_0x1cb9('0x2b')][_0x1cb9('0x2f')]));_0x397ff9[_0x1cb9('0x2e')]=_0x397ff9[_0x1cb9('0x2e')]['length']?_0x397ff9[_0x1cb9('0x2e')]:_0x1bf51c['model'];if(_0x4c6c75['query']['includeAll']){_0x397ff9[_0x1cb9('0x3c')]=[{'all':!![]}];}_0x397ff9=_[_0x1cb9('0x39')]({},_0x397ff9,_0x4c6c75[_0x1cb9('0x3a')]);return db[_0x1cb9('0x27')][_0x1cb9('0x3f')](_0x397ff9)[_0x1cb9('0x1f')](handleEntityNotFound(_0x409c62,null))[_0x1cb9('0x1f')](respondWithResult(_0x409c62,null))[_0x1cb9('0x40')](handleError(_0x409c62,null));};exports[_0x1cb9('0x41')]=function(_0x148a01,_0x3ea88c){return db['ChatQueueReport'][_0x1cb9('0x41')](_0x148a01[_0x1cb9('0x42')],{})[_0x1cb9('0x1f')](respondWithResult(_0x3ea88c,0xc9))['catch'](handleError(_0x3ea88c,null));};exports[_0x1cb9('0x43')]=function(_0x57251,_0x3c6044){if(_0x57251[_0x1cb9('0x42')]['id']){delete _0x57251[_0x1cb9('0x42')]['id'];}return db['ChatQueueReport'][_0x1cb9('0x3f')]({'where':{'id':_0x57251['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x3c6044,null))['then'](saveUpdates(_0x57251[_0x1cb9('0x42')],null))[_0x1cb9('0x1f')](respondWithResult(_0x3c6044,null))[_0x1cb9('0x40')](handleError(_0x3c6044,null));};exports[_0x1cb9('0x20')]=function(_0x56d0c5,_0x298475){return db[_0x1cb9('0x27')][_0x1cb9('0x3f')]({'where':{'id':_0x56d0c5[_0x1cb9('0x3e')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x298475,null))[_0x1cb9('0x1f')](removeEntity(_0x298475,null))[_0x1cb9('0x40')](handleError(_0x298475,null));};exports[_0x1cb9('0x44')]=function(_0xbb500e,_0x17f10e){return db['ChatQueueReport']['describe']()[_0x1cb9('0x1f')](respondWithResult(_0x17f10e,null))[_0x1cb9('0x40')](handleError(_0x17f10e,null));}; \ No newline at end of file +var _0xa9e0=['merge','options','include','findAll','catch','params','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL'];(function(_0x1d9fbc,_0x6a62f3){var _0x50e7e0=function(_0x4e0c6c){while(--_0x4e0c6c){_0x1d9fbc['push'](_0x1d9fbc['shift']());}};_0x50e7e0(++_0x6a62f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));};exports[_0x0a9e('0x45')]=function(_0x3fe430,_0x4f7240){return db['ChatQueueReport']['describe']()[_0x0a9e('0x1f')](respondWithResult(_0x4f7240,null))[_0x0a9e('0x3f')](handleError(_0x4f7240,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 497c02a..a1855bf 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 _0x99db=['../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x99db,0x12b));var _0xb99d=function(_0x3a7455,_0x46b004){_0x3a7455=_0x3a7455-0x0;var _0x216c72=_0x99db[_0x3a7455];return _0x216c72;};'use strict';var _=require(_0xb99d('0x0'));var util=require('util');var logger=require(_0xb99d('0x1'))(_0xb99d('0x2'));var moment=require('moment');var BPromise=require(_0xb99d('0x3'));var rp=require(_0xb99d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb99d('0x5'));var attributes=require('./chatQueueReport.attributes');module[_0xb99d('0x6')]=function(_0x2214ae,_0x3f599d){return _0x2214ae[_0xb99d('0x7')]('ChatQueueReport',attributes,{'tableName':_0xb99d('0x8'),'paranoid':![],'indexes':[{'name':_0xb99d('0x9'),'fields':[_0xb99d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x275c=['path','rimraf','../../config/environment','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','api','moment','bluebird','request-promise'];(function(_0x31cd65,_0x46e41c){var _0x384bba=function(_0x2079ca){while(--_0x2079ca){_0x31cd65['push'](_0x31cd65['shift']());}};_0x384bba(++_0x46e41c);}(_0x275c,0x70));var _0xc275=function(_0x105778,_0x2988aa){_0x105778=_0x105778-0x0;var _0x11ec56=_0x275c[_0x105778];return _0x11ec56;};'use strict';var _=require(_0xc275('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc275('0x1'));var moment=require(_0xc275('0x2'));var BPromise=require(_0xc275('0x3'));var rp=require(_0xc275('0x4'));var fs=require('fs');var path=require(_0xc275('0x5'));var rimraf=require(_0xc275('0x6'));var config=require(_0xc275('0x7'));var attributes=require('./chatQueueReport.attributes');module[_0xc275('0x8')]=function(_0xf92bee,_0xae7980){return _0xf92bee[_0xc275('0x9')](_0xc275('0xa'),attributes,{'tableName':_0xc275('0xb'),'paranoid':![],'indexes':[{'name':_0xc275('0xc'),'fields':[_0xc275('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index e41ef5a..fd258b5 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 _0xb9f9=['stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','UpdateChatQueueReport','where','attributes','limit','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x1b8f91,_0x4b1eca){var _0x2c25a5=function(_0x365bfe){while(--_0x365bfe){_0x1b8f91['push'](_0x1b8f91['shift']());}};_0x2c25a5(++_0x4b1eca);}(_0xb9f9,0x11d));var _0x9b9f=function(_0x1f0611,_0x8ef37a){_0x1f0611=_0x1f0611-0x0;var _0x4a42bc=_0xb9f9[_0x1f0611];return _0x4a42bc;};'use strict';var _=require('lodash');var util=require(_0x9b9f('0x0'));var moment=require(_0x9b9f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b9f('0x2'));var db=require(_0x9b9f('0x3'))['db'];var utils=require(_0x9b9f('0x4'));var logger=require(_0x9b9f('0x5'))(_0x9b9f('0x6'));var config=require(_0x9b9f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9b9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x207a22,_0x2316b8,_0x1dcabf){return new BPromise(function(_0x1d41ad,_0x2f81be){return client['request'](_0x207a22,_0x1dcabf)[_0x9b9f('0x9')](function(_0x5b9544){logger[_0x9b9f('0xa')](_0x9b9f('0xb'),_0x2316b8,_0x9b9f('0xc'));logger[_0x9b9f('0xd')](_0x9b9f('0xe'),_0x2316b8,_0x9b9f('0xc'),JSON[_0x9b9f('0xf')](_0x5b9544));if(_0x5b9544[_0x9b9f('0x10')]){if(_0x5b9544[_0x9b9f('0x10')][_0x9b9f('0x11')]===0x1f4){logger[_0x9b9f('0x10')](_0x9b9f('0xb'),_0x2316b8,_0x5b9544[_0x9b9f('0x10')][_0x9b9f('0x12')]);return _0x2f81be(_0x5b9544[_0x9b9f('0x10')]['message']);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x2316b8,_0x5b9544['error'][_0x9b9f('0x12')]);return _0x1d41ad(_0x5b9544['error'][_0x9b9f('0x12')]);}else{logger[_0x9b9f('0xa')]('ChatQueueReport,\x20%s,\x20%s',_0x2316b8,_0x9b9f('0xc'));_0x1d41ad(_0x5b9544[_0x9b9f('0x13')][_0x9b9f('0x12')]);}})[_0x9b9f('0x14')](function(_0x1e7935){logger[_0x9b9f('0x10')](_0x9b9f('0xb'),_0x2316b8,_0x1e7935);_0x2f81be(_0x1e7935);});});}exports[_0x9b9f('0x15')]=function(_0x5ce058){var _0x45edc0=this;return new Promise(function(_0x3287e5,_0x8657b9){return db[_0x9b9f('0x16')][_0x9b9f('0x17')](_0x5ce058['body'],{'raw':_0x5ce058[_0x9b9f('0x18')]?_0x5ce058[_0x9b9f('0x18')][_0x9b9f('0x19')]===undefined?!![]:![]:!![]})[_0x9b9f('0x9')](function(_0x5c15d8){logger[_0x9b9f('0xa')](_0x9b9f('0x15'),_0x5ce058);logger[_0x9b9f('0xd')](_0x9b9f('0x15'),_0x5ce058,JSON['stringify'](_0x5c15d8));_0x3287e5(_0x5c15d8);})[_0x9b9f('0x14')](function(_0x402292){logger['error'](_0x9b9f('0x15'),_0x402292[_0x9b9f('0x12')],_0x5ce058);_0x8657b9(_0x45edc0[_0x9b9f('0x10')](0x1f4,_0x402292['message']));});});};exports[_0x9b9f('0x1a')]=function(_0x575ee1){var _0x5df1bd=this;return new Promise(function(_0x186903,_0x527a6e){return db['ChatQueueReport']['update'](_0x575ee1['body'],{'raw':_0x575ee1[_0x9b9f('0x18')]?_0x575ee1[_0x9b9f('0x18')][_0x9b9f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x575ee1['options']?_0x575ee1[_0x9b9f('0x18')][_0x9b9f('0x1b')]||null:null,'attributes':_0x575ee1[_0x9b9f('0x18')]?_0x575ee1[_0x9b9f('0x18')][_0x9b9f('0x1c')]||null:null,'limit':_0x575ee1[_0x9b9f('0x18')]?_0x575ee1[_0x9b9f('0x18')][_0x9b9f('0x1d')]||null:null})[_0x9b9f('0x9')](function(_0x57f1a5){logger[_0x9b9f('0xa')](_0x9b9f('0x1a'),_0x575ee1);logger['debug'](_0x9b9f('0x1a'),_0x575ee1,JSON[_0x9b9f('0xf')](_0x57f1a5));_0x186903(_0x57f1a5);})[_0x9b9f('0x14')](function(_0xa4a050){logger[_0x9b9f('0x10')]('UpdateChatQueueReport',_0xa4a050[_0x9b9f('0x12')],_0x575ee1);_0x527a6e(_0x5df1bd[_0x9b9f('0x10')](0x1f4,_0xa4a050[_0x9b9f('0x12')]));});});}; \ No newline at end of file +var _0x79ee=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ChatQueueReport','create','options','raw','CreateChatQueueReport','UpdateChatQueueReport','update','body','where','attributes','limit','debug','lodash','util'];(function(_0x138d3b,_0x29b83f){var _0x46f137=function(_0x4b6505){while(--_0x4b6505){_0x138d3b['push'](_0x138d3b['shift']());}};_0x46f137(++_0x29b83f);}(_0x79ee,0x152));var _0xe79e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x79ee[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe79e('0x0'));var util=require(_0xe79e('0x1'));var moment=require(_0xe79e('0x2'));var BPromise=require('bluebird');var rs=require(_0xe79e('0x3'));var fs=require('fs');var Redis=require(_0xe79e('0x4'));var db=require(_0xe79e('0x5'))['db'];var utils=require(_0xe79e('0x6'));var logger=require(_0xe79e('0x7'))(_0xe79e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe79e('0x9')][_0xe79e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc028ce,_0x3c5fcc,_0x53599d){return new BPromise(function(_0x4a8084,_0x1881b7){return client[_0xe79e('0xb')](_0xc028ce,_0x53599d)[_0xe79e('0xc')](function(_0x1db140){logger[_0xe79e('0xd')](_0xe79e('0xe'),_0x3c5fcc,'request\x20sent');logger['debug'](_0xe79e('0xf'),_0x3c5fcc,_0xe79e('0x10'),JSON[_0xe79e('0x11')](_0x1db140));if(_0x1db140[_0xe79e('0x12')]){if(_0x1db140['error'][_0xe79e('0x13')]===0x1f4){logger[_0xe79e('0x12')](_0xe79e('0xe'),_0x3c5fcc,_0x1db140['error'][_0xe79e('0x14')]);return _0x1881b7(_0x1db140[_0xe79e('0x12')]['message']);}logger[_0xe79e('0x12')](_0xe79e('0xe'),_0x3c5fcc,_0x1db140[_0xe79e('0x12')][_0xe79e('0x14')]);return _0x4a8084(_0x1db140['error']['message']);}else{logger['info'](_0xe79e('0xe'),_0x3c5fcc,_0xe79e('0x10'));_0x4a8084(_0x1db140['result'][_0xe79e('0x14')]);}})[_0xe79e('0x15')](function(_0x359eb8){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x3c5fcc,_0x359eb8);_0x1881b7(_0x359eb8);});});}exports['CreateChatQueueReport']=function(_0x5446f3){var _0x140be6=this;return new Promise(function(_0x34eebb,_0x5a519c){return db[_0xe79e('0x16')][_0xe79e('0x17')](_0x5446f3['body'],{'raw':_0x5446f3[_0xe79e('0x18')]?_0x5446f3[_0xe79e('0x18')][_0xe79e('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x567f4f){logger['info'](_0xe79e('0x1a'),_0x5446f3);logger['debug'](_0xe79e('0x1a'),_0x5446f3,JSON[_0xe79e('0x11')](_0x567f4f));_0x34eebb(_0x567f4f);})['catch'](function(_0x5e4860){logger[_0xe79e('0x12')]('CreateChatQueueReport',_0x5e4860['message'],_0x5446f3);_0x5a519c(_0x140be6['error'](0x1f4,_0x5e4860['message']));});});};exports[_0xe79e('0x1b')]=function(_0x11c221){var _0x5486f6=this;return new Promise(function(_0x1457fc,_0x4d7c9d){return db[_0xe79e('0x16')][_0xe79e('0x1c')](_0x11c221[_0xe79e('0x1d')],{'raw':_0x11c221[_0xe79e('0x18')]?_0x11c221[_0xe79e('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11c221[_0xe79e('0x18')]?_0x11c221[_0xe79e('0x18')][_0xe79e('0x1e')]||null:null,'attributes':_0x11c221[_0xe79e('0x18')]?_0x11c221['options'][_0xe79e('0x1f')]||null:null,'limit':_0x11c221[_0xe79e('0x18')]?_0x11c221[_0xe79e('0x18')][_0xe79e('0x20')]||null:null})['then'](function(_0x43bde5){logger[_0xe79e('0xd')](_0xe79e('0x1b'),_0x11c221);logger[_0xe79e('0x21')](_0xe79e('0x1b'),_0x11c221,JSON[_0xe79e('0x11')](_0x43bde5));_0x1457fc(_0x43bde5);})[_0xe79e('0x15')](function(_0x52ec70){logger[_0xe79e('0x12')](_0xe79e('0x1b'),_0x52ec70[_0xe79e('0x14')],_0x11c221);_0x4d7c9d(_0x5486f6['error'](0x1f4,_0x52ec70[_0xe79e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 3ae65b4..f6b7977 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 _0x5e86=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','describe','show','create','/:id','update','delete','exports','multer','util'];(function(_0x4e0094,_0x2a9c9f){var _0x30d937=function(_0x56e002){while(--_0x56e002){_0x4e0094['push'](_0x4e0094['shift']());}};_0x30d937(++_0x2a9c9f);}(_0x5e86,0x108));var _0x65e8=function(_0x37c9f0,_0xaee900){_0x37c9f0=_0x37c9f0-0x0;var _0x5a83f7=_0x5e86[_0x37c9f0];return _0x5a83f7;};'use strict';var multer=require(_0x65e8('0x0'));var util=require(_0x65e8('0x1'));var path=require('path');var timeout=require(_0x65e8('0x2'));var express=require(_0x65e8('0x3'));var router=express['Router']();var auth=require(_0x65e8('0x4'));var interaction=require(_0x65e8('0x5'));var config=require(_0x65e8('0x6'));var controller=require(_0x65e8('0x7'));router[_0x65e8('0x8')]('/',auth['isAuthenticated'](),controller[_0x65e8('0x9')]);router[_0x65e8('0x8')](_0x65e8('0xa'),auth[_0x65e8('0xb')](),controller[_0x65e8('0xc')]);router['get']('/:id',auth[_0x65e8('0xb')](),controller[_0x65e8('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x65e8('0xe')]);router['put'](_0x65e8('0xf'),auth[_0x65e8('0xb')](),controller[_0x65e8('0x10')]);router[_0x65e8('0x11')]('/:id',auth[_0x65e8('0xb')](),controller['destroy']);module[_0x65e8('0x12')]=router; \ No newline at end of file +var _0xfe3d=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/:id','show','post','create','put','exports','multer','util','path'];(function(_0x2cd933,_0x14816e){var _0x178d9e=function(_0x23e83b){while(--_0x23e83b){_0x2cd933['push'](_0x2cd933['shift']());}};_0x178d9e(++_0x14816e);}(_0xfe3d,0xfc));var _0xdfe3=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xfe3d[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0xdfe3('0x0'));var util=require(_0xdfe3('0x1'));var path=require(_0xdfe3('0x2'));var timeout=require(_0xdfe3('0x3'));var express=require(_0xdfe3('0x4'));var router=express['Router']();var auth=require(_0xdfe3('0x5'));var interaction=require(_0xdfe3('0x6'));var config=require(_0xdfe3('0x7'));var controller=require(_0xdfe3('0x8'));router[_0xdfe3('0x9')]('/',auth[_0xdfe3('0xa')](),controller['index']);router['get']('/describe',auth[_0xdfe3('0xa')](),controller['describe']);router['get'](_0xdfe3('0xb'),auth[_0xdfe3('0xa')](),controller[_0xdfe3('0xc')]);router[_0xdfe3('0xd')]('/',auth['isAuthenticated'](),controller[_0xdfe3('0xe')]);router[_0xdfe3('0xf')](_0xdfe3('0xb'),auth[_0xdfe3('0xa')](),controller['update']);router['delete'](_0xdfe3('0xb'),auth[_0xdfe3('0xa')](),controller['destroy']);module[_0xdfe3('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 37e8edc..f73b55d 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 _0xb09b=['exports','STRING','ENUM','account','agent','queue','DATE','NOW','moment'];(function(_0x369449,_0x24432c){var _0xe0ba23=function(_0x478c2e){while(--_0x478c2e){_0x369449['push'](_0x369449['shift']());}};_0xe0ba23(++_0x24432c);}(_0xb09b,0x74));var _0xbb09=function(_0x4de1c3,_0xbe77b9){_0x4de1c3=_0x4de1c3-0x0;var _0x26acfe=_0xb09b[_0x4de1c3];return _0x26acfe;};'use strict';var moment=require(_0xbb09('0x0'));var Sequelize=require('sequelize');module[_0xbb09('0x1')]={'uniqueid':{'type':Sequelize[_0xbb09('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb09('0x3')](_0xbb09('0x4'),_0xbb09('0x5'),_0xbb09('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xbb09('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xbb09('0x8')]}}; \ No newline at end of file +var _0x6d08=['DATE','NOW','moment','sequelize','exports','ENUM','agent','queue'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x6d08,0x152));var _0x86d0=function(_0x27657e,_0x4d1e60){_0x27657e=_0x27657e-0x0;var _0x51c518=_0x6d08[_0x27657e];return _0x51c518;};'use strict';var moment=require(_0x86d0('0x0'));var Sequelize=require(_0x86d0('0x1'));module[_0x86d0('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x86d0('0x3')]('account',_0x86d0('0x4'),_0x86d0('0x5')),'allowNull':![],'defaultValue':_0x86d0('0x5')},'transferredAt':{'type':Sequelize[_0x86d0('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x86d0('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 4d23457..53343d2 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 _0x77df=['order','sort','where','pick','filter','merge','VIRTUAL','name','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','error','send','index','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x5de2b2,_0x1c72a8){var _0x2657ab=function(_0x35a6e5){while(--_0x35a6e5){_0x5de2b2['push'](_0x5de2b2['shift']());}};_0x2657ab(++_0x1c72a8);}(_0x77df,0x1e9));var _0xf77d=function(_0x1a3750,_0x2680a1){_0x1a3750=_0x1a3750-0x0;var _0x145ef6=_0x77df[_0x1a3750];return _0x145ef6;};'use strict';var pdf=require(_0xf77d('0x0'));var emlformat=require(_0xf77d('0x1'));var rimraf=require(_0xf77d('0x2'));var zipdir=require(_0xf77d('0x3'));var jsonpatch=require(_0xf77d('0x4'));var rp=require(_0xf77d('0x5'));var moment=require('moment');var BPromise=require(_0xf77d('0x6'));var Mustache=require('mustache');var util=require(_0xf77d('0x7'));var path=require(_0xf77d('0x8'));var sox=require('sox');var csv=require(_0xf77d('0x9'));var ejs=require(_0xf77d('0xa'));var fs=require('fs');var _=require(_0xf77d('0xb'));var squel=require(_0xf77d('0xc'));var crypto=require('crypto');var jsforce=require(_0xf77d('0xd'));var deskjs=require(_0xf77d('0xe'));var toCsv=require(_0xf77d('0x9'));var querystring=require(_0xf77d('0xf'));var Papa=require(_0xf77d('0x10'));var Redis=require(_0xf77d('0x11'));var authService=require(_0xf77d('0x12'));var qs=require(_0xf77d('0x13'));var as=require(_0xf77d('0x14'));var hardwareService=require(_0xf77d('0x15'));var logger=require(_0xf77d('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xf77d('0x17'));var db=require(_0xf77d('0x18'))['db'];function respondWithStatusCode(_0x279f10,_0x42285a){_0x42285a=_0x42285a||0xcc;return function(_0x14adcd){if(_0x14adcd){return _0x279f10[_0xf77d('0x19')](_0x42285a);}return _0x279f10[_0xf77d('0x1a')](_0x42285a)[_0xf77d('0x1b')]();};}function respondWithResult(_0xcc8e41,_0x34b8d0){_0x34b8d0=_0x34b8d0||0xc8;return function(_0x411733){if(_0x411733){return _0xcc8e41[_0xf77d('0x1a')](_0x34b8d0)[_0xf77d('0x1c')](_0x411733);}};}function respondWithFilteredResult(_0x1a7e3f,_0x3cea35){return function(_0x142b06){if(_0x142b06){var _0x481154=_0x142b06[_0xf77d('0x1d')],_0x12266b=_0x3cea35[_0xf77d('0x1e')],_0x50d859=_0x3cea35[_0xf77d('0x1e')]+_0x3cea35[_0xf77d('0x1f')],_0x2cf62f;if(_0x50d859>=_0x481154){_0x50d859=_0x481154;_0x2cf62f=0xc8;}else{_0x2cf62f=0xce;}_0x1a7e3f[_0xf77d('0x1a')](_0x2cf62f);return _0x1a7e3f[_0xf77d('0x20')](_0xf77d('0x21'),_0x12266b+'-'+_0x50d859+'/'+_0x481154)[_0xf77d('0x1c')](_0x142b06);}return null;};}function patchUpdates(_0x5ed30f){return function(_0xe2102d){try{jsonpatch['apply'](_0xe2102d,_0x5ed30f,!![]);}catch(_0x549fd0){return BPromise[_0xf77d('0x22')](_0x549fd0);}return _0xe2102d[_0xf77d('0x23')]();};}function saveUpdates(_0x118efc,_0x139a4d){return function(_0x101f91){if(_0x101f91){return _0x101f91[_0xf77d('0x24')](_0x118efc)['then'](function(_0x21d332){return _0x21d332;});}return null;};}function removeEntity(_0x1ecd74,_0x4a05bf){return function(_0xbdecd0){if(_0xbdecd0){return _0xbdecd0[_0xf77d('0x25')]()['then'](function(){_0x1ecd74[_0xf77d('0x1a')](0xcc)[_0xf77d('0x1b')]();});}};}function handleEntityNotFound(_0x3db97c,_0x31c3e8){return function(_0x3ebce1){if(!_0x3ebce1){_0x3db97c[_0xf77d('0x19')](0x194);}return _0x3ebce1;};}function handleError(_0x2a8c42,_0x19ccc2){_0x19ccc2=_0x19ccc2||0x1f4;return function(_0x30af98){logger[_0xf77d('0x26')](_0x30af98['stack']);if(_0x30af98['name']){delete _0x30af98['name'];}_0x2a8c42[_0xf77d('0x1a')](_0x19ccc2)[_0xf77d('0x27')](_0x30af98);};}exports[_0xf77d('0x28')]=function(_0x24e42d,_0x4ef47a){var _0x63afcc={},_0x250bc5={},_0x168f0c={'count':0x0,'rows':[]};var _0x200e76=_['map'](db[_0xf77d('0x29')][_0xf77d('0x2a')],function(_0x35cf94){return{'name':_0x35cf94[_0xf77d('0x2b')],'type':_0x35cf94[_0xf77d('0x2c')][_0xf77d('0x2d')]};});_0x250bc5[_0xf77d('0x2e')]=_[_0xf77d('0x2f')](_0x200e76,'name');_0x250bc5[_0xf77d('0x30')]=_[_0xf77d('0x31')](_0x24e42d[_0xf77d('0x30')]);_0x250bc5[_0xf77d('0x32')]=_[_0xf77d('0x33')](_0x250bc5[_0xf77d('0x2e')],_0x250bc5['query']);_0x63afcc[_0xf77d('0x34')]=_[_0xf77d('0x33')](_0x250bc5[_0xf77d('0x2e')],qs['fields'](_0x24e42d[_0xf77d('0x30')][_0xf77d('0x35')]));_0x63afcc[_0xf77d('0x34')]=_0x63afcc['attributes'][_0xf77d('0x36')]?_0x63afcc[_0xf77d('0x34')]:_0x250bc5['model'];if(!_0x24e42d[_0xf77d('0x30')][_0xf77d('0x37')](_0xf77d('0x38'))){_0x63afcc[_0xf77d('0x1f')]=qs[_0xf77d('0x1f')](_0x24e42d[_0xf77d('0x30')]['limit']);_0x63afcc[_0xf77d('0x1e')]=qs['offset'](_0x24e42d[_0xf77d('0x30')][_0xf77d('0x1e')]);}_0x63afcc[_0xf77d('0x39')]=qs[_0xf77d('0x3a')](_0x24e42d[_0xf77d('0x30')][_0xf77d('0x3a')]);_0x63afcc[_0xf77d('0x3b')]=qs['filters'](_[_0xf77d('0x3c')](_0x24e42d[_0xf77d('0x30')],_0x250bc5[_0xf77d('0x32')]),_0x200e76);if(_0x24e42d[_0xf77d('0x30')][_0xf77d('0x3d')]){_0x63afcc[_0xf77d('0x3b')]=_[_0xf77d('0x3e')](_0x63afcc['where'],{'$or':_[_0xf77d('0x2f')](_0x200e76,function(_0x33601c){if(_0x33601c[_0xf77d('0x2c')]!==_0xf77d('0x3f')){var _0x49fc3e={};_0x49fc3e[_0x33601c[_0xf77d('0x40')]]={'$like':'%'+_0x24e42d[_0xf77d('0x30')][_0xf77d('0x3d')]+'%'};return _0x49fc3e;}})});}_0x63afcc=_['merge']({},_0x63afcc,_0x24e42d[_0xf77d('0x41')]);var _0x13ec46={'where':_0x63afcc[_0xf77d('0x3b')]};return db['ChatTransferReport'][_0xf77d('0x1d')](_0x13ec46)[_0xf77d('0x42')](function(_0x3f63bb){_0x168f0c[_0xf77d('0x1d')]=_0x3f63bb;if(_0x24e42d[_0xf77d('0x30')][_0xf77d('0x43')]){_0x63afcc[_0xf77d('0x44')]=[{'all':!![]}];}return db[_0xf77d('0x29')][_0xf77d('0x45')](_0x63afcc);})['then'](function(_0x142b64){_0x168f0c[_0xf77d('0x46')]=_0x142b64;return _0x168f0c;})[_0xf77d('0x42')](respondWithFilteredResult(_0x4ef47a,_0x63afcc))[_0xf77d('0x47')](handleError(_0x4ef47a,null));};exports[_0xf77d('0x48')]=function(_0x952f3b,_0x481d1a){var _0x934665={'raw':!![],'where':{'id':_0x952f3b[_0xf77d('0x49')]['id']}},_0x30db14={};_0x30db14['model']=_[_0xf77d('0x31')](db['ChatTransferReport'][_0xf77d('0x2a')]);_0x30db14['query']=_[_0xf77d('0x31')](_0x952f3b[_0xf77d('0x30')]);_0x30db14['filters']=_[_0xf77d('0x33')](_0x30db14['model'],_0x30db14[_0xf77d('0x30')]);_0x934665[_0xf77d('0x34')]=_[_0xf77d('0x33')](_0x30db14['model'],qs[_0xf77d('0x35')](_0x952f3b[_0xf77d('0x30')][_0xf77d('0x35')]));_0x934665[_0xf77d('0x34')]=_0x934665[_0xf77d('0x34')][_0xf77d('0x36')]?_0x934665[_0xf77d('0x34')]:_0x30db14[_0xf77d('0x2e')];if(_0x952f3b[_0xf77d('0x30')]['includeAll']){_0x934665[_0xf77d('0x44')]=[{'all':!![]}];}_0x934665=_[_0xf77d('0x3e')]({},_0x934665,_0x952f3b['options']);return db[_0xf77d('0x29')][_0xf77d('0x4a')](_0x934665)['then'](handleEntityNotFound(_0x481d1a,null))[_0xf77d('0x42')](respondWithResult(_0x481d1a,null))['catch'](handleError(_0x481d1a,null));};exports[_0xf77d('0x4b')]=function(_0x12d4bc,_0x1c8289){return db['ChatTransferReport'][_0xf77d('0x4b')](_0x12d4bc[_0xf77d('0x4c')],{})[_0xf77d('0x42')](respondWithResult(_0x1c8289,0xc9))['catch'](handleError(_0x1c8289,null));};exports[_0xf77d('0x24')]=function(_0x56df66,_0x18b0e2){if(_0x56df66['body']['id']){delete _0x56df66[_0xf77d('0x4c')]['id'];}return db['ChatTransferReport'][_0xf77d('0x4a')]({'where':{'id':_0x56df66[_0xf77d('0x49')]['id']}})['then'](handleEntityNotFound(_0x18b0e2,null))[_0xf77d('0x42')](saveUpdates(_0x56df66[_0xf77d('0x4c')],null))[_0xf77d('0x42')](respondWithResult(_0x18b0e2,null))[_0xf77d('0x47')](handleError(_0x18b0e2,null));};exports['destroy']=function(_0x2ff02b,_0x595fb0){return db['ChatTransferReport']['find']({'where':{'id':_0x2ff02b[_0xf77d('0x49')]['id']}})[_0xf77d('0x42')](handleEntityNotFound(_0x595fb0,null))[_0xf77d('0x42')](removeEntity(_0x595fb0,null))[_0xf77d('0x47')](handleError(_0x595fb0,null));};exports[_0xf77d('0x4d')]=function(_0x109b2e,_0xf5575e){return db[_0xf77d('0x29')][_0xf77d('0x4d')]()[_0xf77d('0x42')](respondWithResult(_0xf5575e,null))[_0xf77d('0x47')](handleError(_0xf5575e,null));}; \ No newline at end of file +var _0x091f=['pick','filter','merge','map','VIRTUAL','options','ChatTransferReport','include','findAll','rows','catch','length','includeAll','find','create','body','destroy','params','describe','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','send','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','nolimit','limit','sort','where'];(function(_0x1bf611,_0x5a169b){var _0x46c450=function(_0x3528e0){while(--_0x3528e0){_0x1bf611['push'](_0x1bf611['shift']());}};_0x46c450(++_0x5a169b);}(_0x091f,0x1a5));var _0xf091=function(_0x32ad52,_0x3867b7){_0x32ad52=_0x32ad52-0x0;var _0xd4d3d3=_0x091f[_0x32ad52];return _0xd4d3d3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf091('0x0'));var jsonpatch=require(_0xf091('0x1'));var rp=require(_0xf091('0x2'));var moment=require('moment');var BPromise=require(_0xf091('0x3'));var Mustache=require('mustache');var util=require(_0xf091('0x4'));var path=require(_0xf091('0x5'));var sox=require(_0xf091('0x6'));var csv=require(_0xf091('0x7'));var ejs=require(_0xf091('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf091('0x9'));var crypto=require(_0xf091('0xa'));var jsforce=require(_0xf091('0xb'));var deskjs=require(_0xf091('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf091('0xd'));var Papa=require(_0xf091('0xe'));var Redis=require(_0xf091('0xf'));var authService=require(_0xf091('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf091('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf091('0x12'))['db'];function respondWithStatusCode(_0x3066fd,_0x3b424d){_0x3b424d=_0x3b424d||0xcc;return function(_0x3bcdb4){if(_0x3bcdb4){return _0x3066fd[_0xf091('0x13')](_0x3b424d);}return _0x3066fd[_0xf091('0x14')](_0x3b424d)[_0xf091('0x15')]();};}function respondWithResult(_0x14b158,_0x5136ed){_0x5136ed=_0x5136ed||0xc8;return function(_0x22ce04){if(_0x22ce04){return _0x14b158[_0xf091('0x14')](_0x5136ed)[_0xf091('0x16')](_0x22ce04);}};}function respondWithFilteredResult(_0x5476ca,_0x4443cc){return function(_0x5dd4e6){if(_0x5dd4e6){var _0xcf9e24=_0x5dd4e6[_0xf091('0x17')],_0x562911=_0x4443cc[_0xf091('0x18')],_0x3ae5c0=_0x4443cc['offset']+_0x4443cc['limit'],_0x2310ea;if(_0x3ae5c0>=_0xcf9e24){_0x3ae5c0=_0xcf9e24;_0x2310ea=0xc8;}else{_0x2310ea=0xce;}_0x5476ca[_0xf091('0x14')](_0x2310ea);return _0x5476ca['set'](_0xf091('0x19'),_0x562911+'-'+_0x3ae5c0+'/'+_0xcf9e24)[_0xf091('0x16')](_0x5dd4e6);}return null;};}function patchUpdates(_0x3cdb22){return function(_0x386231){try{jsonpatch[_0xf091('0x1a')](_0x386231,_0x3cdb22,!![]);}catch(_0x4a419a){return BPromise[_0xf091('0x1b')](_0x4a419a);}return _0x386231[_0xf091('0x1c')]();};}function saveUpdates(_0x576958,_0x177080){return function(_0x3c12e3){if(_0x3c12e3){return _0x3c12e3[_0xf091('0x1d')](_0x576958)[_0xf091('0x1e')](function(_0x13e197){return _0x13e197;});}return null;};}function removeEntity(_0x4a45fb,_0xed6988){return function(_0x39f80c){if(_0x39f80c){return _0x39f80c['destroy']()[_0xf091('0x1e')](function(){_0x4a45fb[_0xf091('0x14')](0xcc)[_0xf091('0x15')]();});}};}function handleEntityNotFound(_0x3b62ce,_0x3e2f33){return function(_0x501cab){if(!_0x501cab){_0x3b62ce[_0xf091('0x13')](0x194);}return _0x501cab;};}function handleError(_0x3a6f41,_0x4a837e){_0x4a837e=_0x4a837e||0x1f4;return function(_0x44a1fb){logger[_0xf091('0x1f')](_0x44a1fb[_0xf091('0x20')]);if(_0x44a1fb['name']){delete _0x44a1fb[_0xf091('0x21')];}_0x3a6f41[_0xf091('0x14')](_0x4a837e)[_0xf091('0x22')](_0x44a1fb);};}exports['index']=function(_0x51fd71,_0xe5d02f){var _0x4fa54f={},_0x59751b={},_0x2f6ef9={'count':0x0,'rows':[]};var _0xa3044c=_['map'](db['ChatTransferReport'][_0xf091('0x23')],function(_0x45caa4){return{'name':_0x45caa4['fieldName'],'type':_0x45caa4[_0xf091('0x24')]['key']};});_0x59751b['model']=_['map'](_0xa3044c,_0xf091('0x21'));_0x59751b[_0xf091('0x25')]=_[_0xf091('0x26')](_0x51fd71[_0xf091('0x25')]);_0x59751b[_0xf091('0x27')]=_[_0xf091('0x28')](_0x59751b[_0xf091('0x29')],_0x59751b[_0xf091('0x25')]);_0x4fa54f[_0xf091('0x2a')]=_[_0xf091('0x28')](_0x59751b[_0xf091('0x29')],qs[_0xf091('0x2b')](_0x51fd71['query'][_0xf091('0x2b')]));_0x4fa54f[_0xf091('0x2a')]=_0x4fa54f['attributes']['length']?_0x4fa54f[_0xf091('0x2a')]:_0x59751b[_0xf091('0x29')];if(!_0x51fd71['query']['hasOwnProperty'](_0xf091('0x2c'))){_0x4fa54f[_0xf091('0x2d')]=qs['limit'](_0x51fd71[_0xf091('0x25')][_0xf091('0x2d')]);_0x4fa54f['offset']=qs[_0xf091('0x18')](_0x51fd71['query'][_0xf091('0x18')]);}_0x4fa54f['order']=qs[_0xf091('0x2e')](_0x51fd71[_0xf091('0x25')][_0xf091('0x2e')]);_0x4fa54f[_0xf091('0x2f')]=qs[_0xf091('0x27')](_[_0xf091('0x30')](_0x51fd71['query'],_0x59751b['filters']),_0xa3044c);if(_0x51fd71['query'][_0xf091('0x31')]){_0x4fa54f[_0xf091('0x2f')]=_[_0xf091('0x32')](_0x4fa54f[_0xf091('0x2f')],{'$or':_[_0xf091('0x33')](_0xa3044c,function(_0x500f0f){if(_0x500f0f[_0xf091('0x24')]!==_0xf091('0x34')){var _0x73159a={};_0x73159a[_0x500f0f[_0xf091('0x21')]]={'$like':'%'+_0x51fd71['query'][_0xf091('0x31')]+'%'};return _0x73159a;}})});}_0x4fa54f=_[_0xf091('0x32')]({},_0x4fa54f,_0x51fd71[_0xf091('0x35')]);var _0x56087a={'where':_0x4fa54f[_0xf091('0x2f')]};return db[_0xf091('0x36')][_0xf091('0x17')](_0x56087a)['then'](function(_0x41366a){_0x2f6ef9[_0xf091('0x17')]=_0x41366a;if(_0x51fd71[_0xf091('0x25')]['includeAll']){_0x4fa54f[_0xf091('0x37')]=[{'all':!![]}];}return db[_0xf091('0x36')][_0xf091('0x38')](_0x4fa54f);})['then'](function(_0x38cba1){_0x2f6ef9[_0xf091('0x39')]=_0x38cba1;return _0x2f6ef9;})[_0xf091('0x1e')](respondWithFilteredResult(_0xe5d02f,_0x4fa54f))[_0xf091('0x3a')](handleError(_0xe5d02f,null));};exports['show']=function(_0x4ee45b,_0x3268d4){var _0x3350ce={'raw':!![],'where':{'id':_0x4ee45b['params']['id']}},_0x1843c7={};_0x1843c7['model']=_[_0xf091('0x26')](db[_0xf091('0x36')]['rawAttributes']);_0x1843c7['query']=_[_0xf091('0x26')](_0x4ee45b[_0xf091('0x25')]);_0x1843c7[_0xf091('0x27')]=_[_0xf091('0x28')](_0x1843c7[_0xf091('0x29')],_0x1843c7['query']);_0x3350ce['attributes']=_[_0xf091('0x28')](_0x1843c7[_0xf091('0x29')],qs[_0xf091('0x2b')](_0x4ee45b[_0xf091('0x25')][_0xf091('0x2b')]));_0x3350ce['attributes']=_0x3350ce[_0xf091('0x2a')][_0xf091('0x3b')]?_0x3350ce['attributes']:_0x1843c7[_0xf091('0x29')];if(_0x4ee45b['query'][_0xf091('0x3c')]){_0x3350ce['include']=[{'all':!![]}];}_0x3350ce=_[_0xf091('0x32')]({},_0x3350ce,_0x4ee45b[_0xf091('0x35')]);return db[_0xf091('0x36')][_0xf091('0x3d')](_0x3350ce)[_0xf091('0x1e')](handleEntityNotFound(_0x3268d4,null))[_0xf091('0x1e')](respondWithResult(_0x3268d4,null))[_0xf091('0x3a')](handleError(_0x3268d4,null));};exports[_0xf091('0x3e')]=function(_0x668ed0,_0x1cc8d3){return db['ChatTransferReport'][_0xf091('0x3e')](_0x668ed0['body'],{})[_0xf091('0x1e')](respondWithResult(_0x1cc8d3,0xc9))['catch'](handleError(_0x1cc8d3,null));};exports[_0xf091('0x1d')]=function(_0x59a0a5,_0x47670c){if(_0x59a0a5[_0xf091('0x3f')]['id']){delete _0x59a0a5[_0xf091('0x3f')]['id'];}return db['ChatTransferReport'][_0xf091('0x3d')]({'where':{'id':_0x59a0a5['params']['id']}})[_0xf091('0x1e')](handleEntityNotFound(_0x47670c,null))[_0xf091('0x1e')](saveUpdates(_0x59a0a5[_0xf091('0x3f')],null))[_0xf091('0x1e')](respondWithResult(_0x47670c,null))[_0xf091('0x3a')](handleError(_0x47670c,null));};exports[_0xf091('0x40')]=function(_0x5297f4,_0x3f70c9){return db[_0xf091('0x36')]['find']({'where':{'id':_0x5297f4[_0xf091('0x41')]['id']}})[_0xf091('0x1e')](handleEntityNotFound(_0x3f70c9,null))[_0xf091('0x1e')](removeEntity(_0x3f70c9,null))[_0xf091('0x3a')](handleError(_0x3f70c9,null));};exports[_0xf091('0x42')]=function(_0x533b8b,_0x279005){return db['ChatTransferReport'][_0xf091('0x42')]()['then'](respondWithResult(_0x279005,null))[_0xf091('0x3a')](handleError(_0x279005,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 23c7277..0c0eff7 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 _0x121d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x29e26b,_0x2db184){var _0x18057c=function(_0x3fab23){while(--_0x3fab23){_0x29e26b['push'](_0x29e26b['shift']());}};_0x18057c(++_0x2db184);}(_0x121d,0xea));var _0xd121=function(_0x4f1677,_0x53cd94){_0x4f1677=_0x4f1677-0x0;var _0x1025a6=_0x121d[_0x4f1677];return _0x1025a6;};'use strict';var _=require(_0xd121('0x0'));var util=require(_0xd121('0x1'));var logger=require(_0xd121('0x2'))(_0xd121('0x3'));var moment=require(_0xd121('0x4'));var BPromise=require(_0xd121('0x5'));var rp=require(_0xd121('0x6'));var fs=require('fs');var path=require(_0xd121('0x7'));var rimraf=require(_0xd121('0x8'));var config=require(_0xd121('0x9'));var attributes=require(_0xd121('0xa'));module[_0xd121('0xb')]=function(_0x2b2f41,_0x31c727){return _0x2b2f41['define'](_0xd121('0xc'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xd121('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x113a=['report_chat_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x52bd89,_0x29a557){var _0x5e5365=function(_0x4cf2bd){while(--_0x4cf2bd){_0x52bd89['push'](_0x52bd89['shift']());}};_0x5e5365(++_0x29a557);}(_0x113a,0xf2));var _0xa113=function(_0x1cfb0d,_0x5c26d1){_0x1cfb0d=_0x1cfb0d-0x0;var _0x27ac8f=_0x113a[_0x1cfb0d];return _0x27ac8f;};'use strict';var _=require(_0xa113('0x0'));var util=require(_0xa113('0x1'));var logger=require('../../config/logger')(_0xa113('0x2'));var moment=require(_0xa113('0x3'));var BPromise=require(_0xa113('0x4'));var rp=require(_0xa113('0x5'));var fs=require('fs');var path=require(_0xa113('0x6'));var rimraf=require(_0xa113('0x7'));var config=require(_0xa113('0x8'));var attributes=require(_0xa113('0x9'));module[_0xa113('0xa')]=function(_0x43c8f8,_0x1dbfd2){return _0x43c8f8[_0xa113('0xb')](_0xa113('0xc'),attributes,{'tableName':_0xa113('0xd'),'paranoid':![],'indexes':[{'name':_0xa113('0xe'),'fields':[_0xa113('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index a242205..1ac1790 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 _0x4c3c=['code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x1d3162,_0x4debcc){var _0x16c9d0=function(_0x29dff5){while(--_0x29dff5){_0x1d3162['push'](_0x1d3162['shift']());}};_0x16c9d0(++_0x4debcc);}(_0x4c3c,0xfb));var _0xc4c3=function(_0x553837,_0x161714){_0x553837=_0x553837-0x0;var _0x124212=_0x4c3c[_0x553837];return _0x124212;};'use strict';var _=require(_0xc4c3('0x0'));var util=require('util');var moment=require(_0xc4c3('0x1'));var BPromise=require(_0xc4c3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4c3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc4c3('0x4'))(_0xc4c3('0x5'));var config=require(_0xc4c3('0x6'));var jayson=require(_0xc4c3('0x7'));var client=jayson['client'][_0xc4c3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ff0d3,_0x2b494b,_0x71b58f){return new BPromise(function(_0xa549df,_0x43af48){return client['request'](_0x4ff0d3,_0x71b58f)[_0xc4c3('0x9')](function(_0x5a395c){logger[_0xc4c3('0xa')](_0xc4c3('0xb'),_0x2b494b,'request\x20sent');logger['debug'](_0xc4c3('0xc'),_0x2b494b,_0xc4c3('0xd'),JSON['stringify'](_0x5a395c));if(_0x5a395c[_0xc4c3('0xe')]){if(_0x5a395c[_0xc4c3('0xe')][_0xc4c3('0xf')]===0x1f4){logger[_0xc4c3('0xe')](_0xc4c3('0xb'),_0x2b494b,_0x5a395c['error'][_0xc4c3('0x10')]);return _0x43af48(_0x5a395c[_0xc4c3('0xe')][_0xc4c3('0x10')]);}logger['error'](_0xc4c3('0xb'),_0x2b494b,_0x5a395c[_0xc4c3('0xe')]['message']);return _0xa549df(_0x5a395c[_0xc4c3('0xe')][_0xc4c3('0x10')]);}else{logger[_0xc4c3('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0x2b494b,_0xc4c3('0xd'));_0xa549df(_0x5a395c[_0xc4c3('0x11')][_0xc4c3('0x10')]);}})[_0xc4c3('0x12')](function(_0x2ff2a4){logger[_0xc4c3('0xe')](_0xc4c3('0xb'),_0x2b494b,_0x2ff2a4);_0x43af48(_0x2ff2a4);});});} \ No newline at end of file +var _0x979a=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x2f9d3e,_0x29345f){var _0x32d8e6=function(_0x9f63fc){while(--_0x9f63fc){_0x2f9d3e['push'](_0x2f9d3e['shift']());}};_0x32d8e6(++_0x29345f);}(_0x979a,0x1b9));var _0xa979=function(_0xe2c665,_0x5467a0){_0xe2c665=_0xe2c665-0x0;var _0x5bcbb7=_0x979a[_0xe2c665];return _0x5bcbb7;};'use strict';var _=require(_0xa979('0x0'));var util=require('util');var moment=require(_0xa979('0x1'));var BPromise=require('bluebird');var rs=require(_0xa979('0x2'));var fs=require('fs');var Redis=require(_0xa979('0x3'));var db=require(_0xa979('0x4'))['db'];var utils=require(_0xa979('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa979('0x6'));var jayson=require(_0xa979('0x7'));var client=jayson[_0xa979('0x8')][_0xa979('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28309a,_0x4bdbb3,_0x486954){return new BPromise(function(_0x29844f,_0x507dae){return client['request'](_0x28309a,_0x486954)[_0xa979('0xa')](function(_0x231ea6){logger[_0xa979('0xb')](_0xa979('0xc'),_0x4bdbb3,'request\x20sent');logger[_0xa979('0xd')](_0xa979('0xe'),_0x4bdbb3,'request\x20sent',JSON['stringify'](_0x231ea6));if(_0x231ea6['error']){if(_0x231ea6[_0xa979('0xf')][_0xa979('0x10')]===0x1f4){logger['error'](_0xa979('0xc'),_0x4bdbb3,_0x231ea6[_0xa979('0xf')][_0xa979('0x11')]);return _0x507dae(_0x231ea6[_0xa979('0xf')][_0xa979('0x11')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x4bdbb3,_0x231ea6[_0xa979('0xf')]['message']);return _0x29844f(_0x231ea6[_0xa979('0xf')][_0xa979('0x11')]);}else{logger['info'](_0xa979('0xc'),_0x4bdbb3,'request\x20sent');_0x29844f(_0x231ea6[_0xa979('0x12')]['message']);}})[_0xa979('0x13')](function(_0xa2d7ec){logger[_0xa979('0xf')](_0xa979('0xc'),_0x4bdbb3,_0xa2d7ec);_0x507dae(_0xa2d7ec);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 845761f..080fa45 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 _0x0b0e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','delete','exports'];(function(_0xe934f1,_0x5a8217){var _0x32f246=function(_0x173fa1){while(--_0x173fa1){_0xe934f1['push'](_0xe934f1['shift']());}};_0x32f246(++_0x5a8217);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1cdb2d,_0x8f1f76){_0x1cdb2d=_0x1cdb2d-0x0;var _0x4dafe3=_0x0b0e[_0x1cdb2d];return _0x4dafe3;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['post']('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['update']);router[_0xe0b0('0xf')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['destroy']);module[_0xe0b0('0x10')]=router; \ No newline at end of file +var _0x2032=['describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x528078,_0x4a0b84){var _0x4b9783=function(_0x970e49){while(--_0x970e49){_0x528078['push'](_0x528078['shift']());}};_0x4b9783(++_0x4a0b84);}(_0x2032,0xd9));var _0x2203=function(_0x2187f2,_0x4e1dbc){_0x2187f2=_0x2187f2-0x0;var _0x510935=_0x2032[_0x2187f2];return _0x510935;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var auth=require(_0x2203('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2203('0x5'));var controller=require(_0x2203('0x6'));router[_0x2203('0x7')]('/',auth[_0x2203('0x8')](),controller[_0x2203('0x9')]);router[_0x2203('0x7')](_0x2203('0xa'),auth[_0x2203('0x8')](),controller[_0x2203('0xb')]);router[_0x2203('0x7')](_0x2203('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller[_0x2203('0xe')]);router[_0x2203('0xf')](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x10')]);router['delete'](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);module[_0x2203('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index ad89e9e..f174549 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 _0x1f89=['System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','TEXT','stringify','input','name','text','onlineForm','parse','getDataValue','Comments','offlineForm','setDataValue','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa'];(function(_0x5bb997,_0x2d8eff){var _0x26a97f=function(_0x3d9e4a){while(--_0x3d9e4a){_0x5bb997['push'](_0x5bb997['shift']());}};_0x26a97f(++_0x2d8eff);}(_0x1f89,0x14c));var _0x91f8=function(_0x8b7409,_0x441e53){_0x8b7409=_0x8b7409-0x0;var _0x822ada=_0x1f89[_0x8b7409];return _0x822ada;};'use strict';var Sequelize=require(_0x91f8('0x0'));var rs=require(_0x91f8('0x1'));module[_0x91f8('0x2')]={'name':{'type':Sequelize[_0x91f8('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x91f8('0x3')],'allowNull':![],'unique':_0x91f8('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x91f8('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x91f8('0x3')],'defaultValue':_0x91f8('0x5')},'key':{'type':Sequelize[_0x91f8('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x91f8('0x6')},'customerAlias':{'type':Sequelize[_0x91f8('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x91f8('0x3')],'allowNull':![],'defaultValue':_0x91f8('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x91f8('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x91f8('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x91f8('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x91f8('0xa')](_0x91f8('0xb'),_0x91f8('0xc')),'defaultValue':_0x91f8('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x91f8('0xd')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x91f8('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x91f8('0x3')],'defaultValue':_0x91f8('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x91f8('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x91f8('0x3')],'defaultValue':_0x91f8('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x91f8('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x91f8('0x3')],'defaultValue':_0x91f8('0x12')},'noteTitle':{'type':Sequelize[_0x91f8('0x3')],'defaultValue':_0x91f8('0x13')},'placeholderMessage':{'type':Sequelize[_0x91f8('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x91f8('0x14')},'closingMessageButton':{'type':Sequelize[_0x91f8('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x91f8('0x15')},'conditionAgreement':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x91f8('0x16')},'ratingType':{'type':Sequelize[_0x91f8('0xa')]('star','thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x91f8('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x91f8('0x17')],'defaultValue':function(){return JSON[_0x91f8('0x18')]({'items':[{'type':_0x91f8('0x19'),'variable':null,'config':{'placeholder':_0x91f8('0x1a'),'type':_0x91f8('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x91f8('0x19'),'props':{'title':_0x91f8('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x91f8('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x91f8('0x1c'))?JSON[_0x91f8('0x1d')](this[_0x91f8('0x1e')](_0x91f8('0x1c'))):{};},'set':function(_0x14d949){return this['setDataValue'](_0x91f8('0x1c'),JSON[_0x91f8('0x18')](_0x14d949));}},'offlineForm':{'type':Sequelize[_0x91f8('0x17')],'defaultValue':function(){return JSON[_0x91f8('0x18')]({'items':[{'type':'input','props':{'title':_0x91f8('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x91f8('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0x91f8('0x1f'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x91f8('0x1e')](_0x91f8('0x20'))?JSON[_0x91f8('0x1d')](this[_0x91f8('0x1e')](_0x91f8('0x20'))):{};},'set':function(_0x3f1876){return this[_0x91f8('0x21')](_0x91f8('0x20'),JSON[_0x91f8('0x18')](_0x3f1876));}},'token':{'type':Sequelize[_0x91f8('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x91f8('0x3')]},'forwardOffline':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x91f8('0x3')]},'waitingTitle':{'type':Sequelize[_0x91f8('0x3')],'defaultValue':_0x91f8('0x22')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x91f8('0x23')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x91f8('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x91f8('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x91f8('0x26')},'skipUnmanaged':{'type':Sequelize[_0x91f8('0x3')],'defaultValue':_0x91f8('0x15')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x91f8('0x27')},'enableCustomerAttachment':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x91f8('0x17')]},'showAgentAvatar':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x91f8('0x3')]},'notificationTemplate':{'type':Sequelize[_0x91f8('0x17')],'defaultValue':function(){return _0x91f8('0x28');}},'notificationSound':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x91f8('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x91f8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x91f8('0x3')],'defaultValue':_0x91f8('0x2a')},'verticalAlignment':{'type':Sequelize[_0x91f8('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x91f8('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x91f8('0x3')]},'customerAvatar':{'type':Sequelize[_0x91f8('0x17')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x91f8('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x91f8('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x91f8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x91f8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x91f8('0x3')],'defaultValue':_0x91f8('0x2c')},'systemAvatar':{'type':Sequelize[_0x91f8('0x17')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x91f8('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x91f8('0x2d'),'set':function(_0x83c96a){if(!_0x83c96a)this[_0x91f8('0x21')]('mandatoryDispositionPauseId',null);this[_0x91f8('0x21')](_0x91f8('0x2e'),_0x83c96a);}},'vidaooEscalation':{'type':Sequelize[_0x91f8('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x91f8('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xb1dc=['Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Skip','Feedback','star','thumb','stringify','input','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.','TEXT','website_alias','bottom_right','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us'];(function(_0x208e3b,_0x25f1e1){var _0x3942f1=function(_0x5c3d62){while(--_0x5c3d62){_0x208e3b['push'](_0x208e3b['shift']());}};_0x3942f1(++_0x25f1e1);}(_0xb1dc,0x133));var _0xcb1d=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0xb1dc[_0x1d70db];return _0x3060c6;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xcb1d('0x0'));module['exports']={'name':{'type':Sequelize[_0xcb1d('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0xcb1d('0x1')],'allowNull':![],'unique':_0xcb1d('0x2')},'description':{'type':Sequelize[_0xcb1d('0x1')]},'mapKey':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':_0xcb1d('0x3')},'mapKeyOffline':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':_0xcb1d('0x3')},'key':{'type':Sequelize[_0xcb1d('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':_0xcb1d('0x4')},'customerAlias':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcb1d('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcb1d('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xcb1d('0x1')],'allowNull':![],'defaultValue':_0xcb1d('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xcb1d('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xcb1d('0x1')]},'animation':{'type':Sequelize[_0xcb1d('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xcb1d('0x9')](_0xcb1d('0xa'),_0xcb1d('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':_0xcb1d('0xc')},'start_chat_button':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xcb1d('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xcb1d('0xe')},'download_transcript':{'type':Sequelize[_0xcb1d('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xcb1d('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xcb1d('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':_0xcb1d('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':_0xcb1d('0x10')},'noteTitle':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':_0xcb1d('0x11')},'placeholderMessage':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':_0xcb1d('0x12')},'conditionAgreement':{'type':Sequelize[_0xcb1d('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xcb1d('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xcb1d('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xcb1d('0x13')},'ratingType':{'type':Sequelize[_0xcb1d('0x9')](_0xcb1d('0x14'),_0xcb1d('0x15')),'defaultValue':_0xcb1d('0x14')},'ratingStarsNumber':{'type':Sequelize[_0xcb1d('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xcb1d('0x16')]({'items':[{'type':_0xcb1d('0x17'),'variable':null,'config':{'placeholder':'name','type':_0xcb1d('0x18'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xcb1d('0x17'),'props':{'title':_0xcb1d('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xcb1d('0x19')](_0xcb1d('0x1a'))?JSON[_0xcb1d('0x1b')](this[_0xcb1d('0x19')](_0xcb1d('0x1a'))):{};},'set':function(_0x370513){return this[_0xcb1d('0x1c')](_0xcb1d('0x1a'),JSON['stringify'](_0x370513));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xcb1d('0x17'),'props':{'title':_0xcb1d('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xcb1d('0x3'),'type':_0xcb1d('0x3')},'variable':null},{'type':_0xcb1d('0x1d'),'config':{'placeholder':_0xcb1d('0x1e')},'props':{'title':'Comments','helpText':_0xcb1d('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0xcb1d('0x19')](_0xcb1d('0x20'))?JSON['parse'](this[_0xcb1d('0x19')](_0xcb1d('0x20'))):{};},'set':function(_0x5f891a){return this['setDataValue'](_0xcb1d('0x20'),JSON[_0xcb1d('0x16')](_0x5f891a));}},'token':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':function(){return rs[_0xcb1d('0x21')]();}},'autoclose':{'type':Sequelize[_0xcb1d('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xcb1d('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xcb1d('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xcb1d('0x1')]},'waitingTitle':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':_0xcb1d('0x22')},'waitingMessage':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':_0xcb1d('0x23')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xcb1d('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xcb1d('0x25')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xcb1d('0x26')},'skipUnmanaged':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':_0xcb1d('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xcb1d('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xcb1d('0x27')]},'showAgentAvatar':{'type':Sequelize[_0xcb1d('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xcb1d('0x1')]},'notificationTemplate':{'type':Sequelize[_0xcb1d('0x27')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xcb1d('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcb1d('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xcb1d('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':_0xcb1d('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0xcb1d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':_0xcb1d('0x29')},'verticalAlignment':{'type':Sequelize[_0xcb1d('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xcb1d('0x1')]},'customerAvatar':{'type':Sequelize[_0xcb1d('0x27')]},'showCustomerAvatar':{'type':Sequelize[_0xcb1d('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xcb1d('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xcb1d('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xcb1d('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcb1d('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcb1d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':_0xcb1d('0x2a')},'systemAvatar':{'type':Sequelize[_0xcb1d('0x27')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xcb1d('0x2b'),'set':function(_0x27964b){if(!_0x27964b)this[_0xcb1d('0x1c')](_0xcb1d('0x2c'),null);this[_0xcb1d('0x1c')](_0xcb1d('0x2d'),_0x27964b);}},'vidaooEscalation':{'type':Sequelize[_0xcb1d('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xcb1d('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 75f04a8..dc9034f 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 _0x764a=['merge','type','includeAll','include','findAll','rows','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ChatWebsiteId','getDispositions','Disposition','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','nolimit','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar','notify','setUA','user-agent','getResult','chat','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','Contacts','defaults','CmContact','contact','cf-connecting-ip','headers','x-forwarded-for','first','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','ListId','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','findOrCreate','spread','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','addInteraction','omit','options','Contact','User','Owner','fullname','internal','Tag','Tags','tag','Command','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','virtual','License','chatLicenseExceeded','all','some','readFileSync','server/files/chat/iframe.js','remote','connection','remoteAddress','referer','replace','verticalAlignment','color','textColor','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatWebsite.socket','register','client','http','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~!@#$%^&-_=+[{]}.','request','info','ChatWebsite,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','ChatWebsites','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x2c0085,_0x59d3e6){var _0x5e63de=function(_0x4e5f1a){while(--_0x4e5f1a){_0x2c0085['push'](_0x2c0085['shift']());}};_0x5e63de(++_0x59d3e6);}(_0x764a,0x1f2));var _0xa764=function(_0x3dafc7,_0x25b132){_0x3dafc7=_0x3dafc7-0x0;var _0x5a2cb1=_0x764a[_0x3dafc7];return _0x5a2cb1;};'use strict';var pdf=require(_0xa764('0x0'));var emlformat=require(_0xa764('0x1'));var rimraf=require(_0xa764('0x2'));var zipdir=require(_0xa764('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa764('0x4'));var moment=require(_0xa764('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa764('0x6'));var util=require('util');var path=require(_0xa764('0x7'));var sox=require(_0xa764('0x8'));var csv=require('to-csv');var ejs=require(_0xa764('0x9'));var fs=require('fs');var _=require(_0xa764('0xa'));var squel=require('squel');var crypto=require(_0xa764('0xb'));var jsforce=require(_0xa764('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa764('0xd'));var querystring=require('querystring');var Papa=require(_0xa764('0xe'));var Redis=require('ioredis');var authService=require(_0xa764('0xf'));var qs=require(_0xa764('0x10'));var as=require(_0xa764('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa764('0x12'))(_0xa764('0x13'));var utils=require(_0xa764('0x14'));var config=require(_0xa764('0x15'));var db=require(_0xa764('0x16'))['db'];config[_0xa764('0x17')]=_['defaults'](config[_0xa764('0x17')],{'host':_0xa764('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa764('0x17')]));require(_0xa764('0x19'))[_0xa764('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa764('0x1b')][_0xa764('0x1c')]({'port':0x232c});var client9002=jayson[_0xa764('0x1b')][_0xa764('0x1c')]({'port':0x232a});var client9003=jayson[_0xa764('0x1b')][_0xa764('0x1c')]({'port':0x232b});function checkPasswordPattern(_0x4fbcc3,_0x5744b9,_0x7ea578){if(_0x7ea578){var _0x1e389e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e389e[_0xa764('0x1d')](_0x5744b9)){return _0x4fbcc3;}else{throw new db[(_0xa764('0x1e'))][(_0xa764('0x1f'))](_0xa764('0x20'));}}else{return _0x4fbcc3;}}function respondWithRpcPromise(_0x45a2d4,_0x481230,_0x37eb2f,_0x36a2de){return new BPromise(function(_0x52e9a0,_0x51e33a){var _0x1d491d=_0x36a2de||client;return _0x1d491d[_0xa764('0x21')](_0x45a2d4,_0x37eb2f)['then'](function(_0x8688cf){logger[_0xa764('0x22')](_0xa764('0x23'),_0x481230,'request\x20sent');logger[_0xa764('0x24')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x481230,'request\x20sent',JSON[_0xa764('0x25')](_0x8688cf));if(_0x8688cf[_0xa764('0x26')]){if(_0x8688cf['error'][_0xa764('0x27')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x481230,_0x8688cf[_0xa764('0x26')][_0xa764('0x28')]);return _0x51e33a(_0x8688cf[_0xa764('0x26')]['message']);}logger[_0xa764('0x26')](_0xa764('0x23'),_0x481230,_0x8688cf[_0xa764('0x26')][_0xa764('0x28')]);return _0x52e9a0(_0x8688cf['error'][_0xa764('0x28')]);}else{logger[_0xa764('0x22')](_0xa764('0x23'),_0x481230,_0xa764('0x29'));_0x52e9a0(_0x8688cf[_0xa764('0x2a')][_0xa764('0x28')]);}})[_0xa764('0x2b')](function(_0x441ad1){logger['error'](_0xa764('0x23'),_0x481230,_0x441ad1);_0x51e33a(_0x441ad1);});});}function respondWithStatusCode(_0x499f7a,_0x59d671){_0x59d671=_0x59d671||0xcc;return function(_0x50fff8){if(_0x50fff8){return _0x499f7a[_0xa764('0x2c')](_0x59d671);}return _0x499f7a[_0xa764('0x2d')](_0x59d671)[_0xa764('0x2e')]();};}function respondWithResult(_0x387e76,_0x1defbc){_0x1defbc=_0x1defbc||0xc8;return function(_0x2922da){if(_0x2922da){return _0x387e76[_0xa764('0x2d')](_0x1defbc)['json'](_0x2922da);}};}function respondWithFilteredResult(_0x12011b,_0x2ffdc3){return function(_0x5d4cf1){if(_0x5d4cf1){var _0x3c8c25=_0x5d4cf1[_0xa764('0x2f')],_0x3ed2ce=_0x2ffdc3[_0xa764('0x30')],_0xdeccad=_0x2ffdc3['offset']+_0x2ffdc3[_0xa764('0x31')],_0x4ecced;if(_0xdeccad>=_0x3c8c25){_0xdeccad=_0x3c8c25;_0x4ecced=0xc8;}else{_0x4ecced=0xce;}_0x12011b[_0xa764('0x2d')](_0x4ecced);return _0x12011b[_0xa764('0x32')](_0xa764('0x33'),_0x3ed2ce+'-'+_0xdeccad+'/'+_0x3c8c25)['json'](_0x5d4cf1);}return null;};}function patchUpdates(_0x7a710){return function(_0x340c02){try{jsonpatch['apply'](_0x340c02,_0x7a710,!![]);}catch(_0xec4878){return BPromise[_0xa764('0x34')](_0xec4878);}return _0x340c02[_0xa764('0x35')]();};}function saveUpdates(_0x1fd4e6,_0x546fdd){return function(_0x53646a){if(_0x53646a){return _0x53646a[_0xa764('0x36')](_0x1fd4e6)[_0xa764('0x37')](function(_0x42c05a){return _0x42c05a;});}return null;};}function removeEntity(_0x2acbc0,_0x478366){return function(_0x5b7353){if(_0x5b7353){return _0x5b7353[_0xa764('0x38')]()['then'](function(){var _0x429296=_0x5b7353[_0xa764('0x39')]({'plain':!![]});var _0xc85ea0=_0xa764('0x3a');return db[_0xa764('0x3b')][_0xa764('0x38')]({'where':{'type':_0xc85ea0,'resourceId':_0x429296['id']}})[_0xa764('0x37')](function(){return _0x5b7353;});})[_0xa764('0x37')](function(){_0x2acbc0[_0xa764('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dab17,_0x3b950a){return function(_0x1892e4){if(!_0x1892e4){_0x4dab17[_0xa764('0x2c')](0x194);}return _0x1892e4;};}function handleError(_0x50a570,_0x104fab){_0x104fab=_0x104fab||0x1f4;return function(_0x2500d4){logger[_0xa764('0x26')](_0x2500d4['stack']);if(_0x2500d4['name']){delete _0x2500d4[_0xa764('0x3c')];}_0x50a570[_0xa764('0x2d')](_0x104fab)[_0xa764('0x3d')](_0x2500d4);};}exports[_0xa764('0x3e')]=function(_0x5330cc,_0x2a089b){var _0x1c2fa0={'include':[{'model':db[_0xa764('0x3f')],'as':_0xa764('0x40')}]},_0xb99417={},_0x28c940={'count':0x0,'rows':[]};var _0x51124a=_[_0xa764('0x41')](db[_0xa764('0x42')][_0xa764('0x43')],function(_0x3a3b21){return{'name':_0x3a3b21[_0xa764('0x44')],'type':_0x3a3b21['type'][_0xa764('0x45')]};});_0xb99417[_0xa764('0x46')]=_[_0xa764('0x41')](_0x51124a,_0xa764('0x3c'));_0xb99417[_0xa764('0x47')]=_[_0xa764('0x48')](_0x5330cc[_0xa764('0x47')]);_0xb99417[_0xa764('0x49')]=_[_0xa764('0x4a')](_0xb99417[_0xa764('0x46')],_0xb99417[_0xa764('0x47')]);_0x1c2fa0[_0xa764('0x4b')]=_[_0xa764('0x4a')](_0xb99417[_0xa764('0x46')],qs[_0xa764('0x4c')](_0x5330cc[_0xa764('0x47')]['fields']));_0x1c2fa0['attributes']=_0x1c2fa0[_0xa764('0x4b')][_0xa764('0x4d')]?_0x1c2fa0[_0xa764('0x4b')]:_0xb99417[_0xa764('0x46')];if(!_0x5330cc[_0xa764('0x47')][_0xa764('0x4e')]('nolimit')){_0x1c2fa0[_0xa764('0x31')]=qs['limit'](_0x5330cc['query'][_0xa764('0x31')]);_0x1c2fa0[_0xa764('0x30')]=qs['offset'](_0x5330cc[_0xa764('0x47')][_0xa764('0x30')]);}_0x1c2fa0[_0xa764('0x4f')]=qs[_0xa764('0x50')](_0x5330cc[_0xa764('0x47')][_0xa764('0x50')]);_0x1c2fa0[_0xa764('0x51')]=qs[_0xa764('0x49')](_[_0xa764('0x52')](_0x5330cc[_0xa764('0x47')],_0xb99417[_0xa764('0x49')]),_0x51124a);if(_0x5330cc[_0xa764('0x47')][_0xa764('0x53')]){_0x1c2fa0[_0xa764('0x51')]=_[_0xa764('0x54')](_0x1c2fa0['where'],{'$or':_[_0xa764('0x41')](_0x51124a,function(_0x7eb06){if(_0x7eb06[_0xa764('0x55')]!=='VIRTUAL'){var _0x2caa6d={};_0x2caa6d[_0x7eb06['name']]={'$like':'%'+_0x5330cc[_0xa764('0x47')][_0xa764('0x53')]+'%'};return _0x2caa6d;}})});}_0x1c2fa0=_[_0xa764('0x54')]({},_0x1c2fa0,_0x5330cc['options']);var _0x17c867={'where':_0x1c2fa0[_0xa764('0x51')]};return db[_0xa764('0x42')][_0xa764('0x2f')](_0x17c867)['then'](function(_0x222fb2){_0x28c940[_0xa764('0x2f')]=_0x222fb2;if(_0x5330cc[_0xa764('0x47')][_0xa764('0x56')]){_0x1c2fa0[_0xa764('0x57')]=[{'all':!![]}];}return db['ChatWebsite'][_0xa764('0x58')](_0x1c2fa0);})[_0xa764('0x37')](function(_0x4fdc4f){_0x28c940[_0xa764('0x59')]=_0x4fdc4f;return _0x28c940;})[_0xa764('0x37')](respondWithFilteredResult(_0x2a089b,_0x1c2fa0))[_0xa764('0x2b')](handleError(_0x2a089b,null));};exports[_0xa764('0x5a')]=function(_0x482a1c,_0x57383d){var _0x1c01bf={'raw':![],'where':{'id':_0x482a1c['params']['id']},'include':[{'model':db[_0xa764('0x3f')],'as':_0xa764('0x40')}]},_0x285809={};_0x285809[_0xa764('0x46')]=_[_0xa764('0x48')](db['ChatWebsite'][_0xa764('0x43')]);_0x285809['query']=_[_0xa764('0x48')](_0x482a1c['query']);_0x285809[_0xa764('0x49')]=_['intersection'](_0x285809[_0xa764('0x46')],_0x285809[_0xa764('0x47')]);_0x1c01bf[_0xa764('0x4b')]=_[_0xa764('0x4a')](_0x285809['model'],qs[_0xa764('0x4c')](_0x482a1c[_0xa764('0x47')][_0xa764('0x4c')]));_0x1c01bf['attributes']=_0x1c01bf[_0xa764('0x4b')]['length']?_0x1c01bf[_0xa764('0x4b')]:_0x285809[_0xa764('0x46')];if(_0x482a1c[_0xa764('0x47')][_0xa764('0x56')]){_0x1c01bf[_0xa764('0x57')]=[{'all':!![]}];}_0x1c01bf=_[_0xa764('0x54')]({},_0x1c01bf,_0x482a1c['options']);return db['ChatWebsite']['find'](_0x1c01bf)[_0xa764('0x37')](handleEntityNotFound(_0x57383d,null))[_0xa764('0x37')](respondWithResult(_0x57383d,null))['catch'](handleError(_0x57383d,null));};exports[_0xa764('0x5b')]=function(_0x201389,_0x472c2e){return db[_0xa764('0x42')][_0xa764('0x5b')](_0x201389[_0xa764('0x5c')],{})['then'](function(_0x388e5e){var _0x33f177=_0x201389[_0xa764('0x5d')][_0xa764('0x39')]({'plain':!![]});if(!_0x33f177)throw new Error(_0xa764('0x5e'));if(_0x33f177[_0xa764('0x5f')]===_0xa764('0x5d')){var _0x421ed5=_0x388e5e[_0xa764('0x39')]({'plain':!![]});var _0x18624c=_0xa764('0x3a');return db['UserProfileSection'][_0xa764('0x60')]({'where':{'name':_0x18624c,'userProfileId':_0x33f177[_0xa764('0x61')]},'raw':!![]})[_0xa764('0x37')](function(_0x2cae8c){if(_0x2cae8c&&_0x2cae8c[_0xa764('0x62')]===0x0){return db[_0xa764('0x3b')][_0xa764('0x5b')]({'name':_0x421ed5[_0xa764('0x3c')],'resourceId':_0x421ed5['id'],'type':_0x2cae8c['name'],'sectionId':_0x2cae8c['id']},{})[_0xa764('0x37')](function(){return _0x388e5e;});}else{return _0x388e5e;}})[_0xa764('0x2b')](function(_0x5dfb72){logger['error'](_0xa764('0x63'),_0x5dfb72);throw _0x5dfb72;});}return _0x388e5e;})[_0xa764('0x37')](respondWithResult(_0x472c2e,0xc9))[_0xa764('0x2b')](handleError(_0x472c2e,null));};exports[_0xa764('0x36')]=function(_0x3cda74,_0xd9aa37){if(_0x3cda74['body']['id']){delete _0x3cda74[_0xa764('0x5c')]['id'];}return db[_0xa764('0x42')][_0xa764('0x60')]({'where':{'id':_0x3cda74[_0xa764('0x64')]['id']},'include':[{'model':db[_0xa764('0x3f')],'as':_0xa764('0x40')}]})['then'](handleEntityNotFound(_0xd9aa37,null))['then'](saveUpdates(_0x3cda74[_0xa764('0x5c')],null))[_0xa764('0x37')](respondWithResult(_0xd9aa37,null))['catch'](handleError(_0xd9aa37,null));};exports[_0xa764('0x38')]=function(_0x54aef7,_0x2bb74a){return db['ChatWebsite'][_0xa764('0x60')]({'where':{'id':_0x54aef7[_0xa764('0x64')]['id']}})[_0xa764('0x37')](handleEntityNotFound(_0x2bb74a,null))[_0xa764('0x37')](removeEntity(_0x2bb74a,null))[_0xa764('0x2b')](handleError(_0x2bb74a,null));};exports[_0xa764('0x65')]=function(_0x53ab52,_0x27f773){return db[_0xa764('0x42')][_0xa764('0x65')]()[_0xa764('0x37')](respondWithResult(_0x27f773,null))[_0xa764('0x2b')](handleError(_0x27f773,null));};exports[_0xa764('0x66')]=function(_0x545bdb,_0x47d3b9,_0x371795){if(_0x545bdb[_0xa764('0x5c')]['id']){delete _0x545bdb[_0xa764('0x5c')]['id'];}return db[_0xa764('0x42')][_0xa764('0x60')]({'where':{'id':_0x545bdb['params']['id']}})['then'](handleEntityNotFound(_0x47d3b9,null))['then'](function(_0x26533f){if(_0x26533f){_0x545bdb['body'][_0xa764('0x67')]=_0x26533f['id'];return db['Disposition']['create'](_0x545bdb['body']);}})['then'](respondWithResult(_0x47d3b9,null))[_0xa764('0x2b')](handleError(_0x47d3b9,null));};exports[_0xa764('0x68')]=function(_0xef4fb0,_0x50907b,_0x5da913){var _0x211827={'raw':![],'where':{}};var _0x15d0f5={};var _0xb3bc0f={'count':0x0,'rows':[]};return db[_0xa764('0x42')]['findOne']({'where':{'id':_0xef4fb0[_0xa764('0x64')]['id']}})['then'](handleEntityNotFound(_0x50907b,null))[_0xa764('0x37')](function(_0x31fd32){if(_0x31fd32){_0x15d0f5[_0xa764('0x46')]=_['keys'](db[_0xa764('0x69')][_0xa764('0x43')]);_0x15d0f5[_0xa764('0x47')]=_['keys'](_0xef4fb0[_0xa764('0x47')]);_0x15d0f5['filters']=_[_0xa764('0x4a')](_0x15d0f5[_0xa764('0x46')],_0x15d0f5[_0xa764('0x47')]);_0x211827['attributes']=_[_0xa764('0x4a')](_0x15d0f5[_0xa764('0x46')],qs[_0xa764('0x4c')](_0xef4fb0[_0xa764('0x47')][_0xa764('0x4c')]));_0x211827[_0xa764('0x4b')]=_0x211827['attributes'][_0xa764('0x4d')]?_0x211827[_0xa764('0x4b')]:_0x15d0f5[_0xa764('0x46')];if(!_0xef4fb0['query'][_0xa764('0x4e')]('nolimit')){_0x211827[_0xa764('0x31')]=qs[_0xa764('0x31')](_0xef4fb0['query'][_0xa764('0x31')]);_0x211827[_0xa764('0x30')]=qs[_0xa764('0x30')](_0xef4fb0[_0xa764('0x47')][_0xa764('0x30')]);}_0x211827[_0xa764('0x4f')]=qs[_0xa764('0x50')](_0xef4fb0[_0xa764('0x47')][_0xa764('0x50')]);_0x211827[_0xa764('0x51')]=qs[_0xa764('0x49')](_[_0xa764('0x52')](_0xef4fb0[_0xa764('0x47')],_0x15d0f5['filters']));_0x211827['where'][_0xa764('0x67')]=_0x31fd32['id'];if(_0xef4fb0['query'][_0xa764('0x53')]){_0x211827[_0xa764('0x51')]=_[_0xa764('0x54')](_0x211827[_0xa764('0x51')],{'$or':_[_0xa764('0x41')](_0x211827[_0xa764('0x4b')],function(_0x295a83){var _0x41ae9e={};_0x41ae9e[_0x295a83]={'$like':'%'+_0xef4fb0[_0xa764('0x47')][_0xa764('0x53')]+'%'};return _0x41ae9e;})});}_0x211827=_['merge']({},_0x211827,_0xef4fb0['options']);return db[_0xa764('0x69')][_0xa764('0x2f')]({'where':_0x211827[_0xa764('0x51')]})[_0xa764('0x37')](function(_0x4e006b){_0xb3bc0f[_0xa764('0x2f')]=_0x4e006b;if(_0xef4fb0[_0xa764('0x47')]['includeAll']){_0x211827[_0xa764('0x57')]=[{'all':!![]}];}return db[_0xa764('0x69')][_0xa764('0x58')](_0x211827);})[_0xa764('0x37')](function(_0x203398){_0xb3bc0f[_0xa764('0x59')]=_0x203398;return _0xb3bc0f;});}})['then'](respondWithFilteredResult(_0x50907b,_0x211827))['catch'](handleError(_0x50907b,null));};exports[_0xa764('0x6a')]=function(_0x5c9534,_0x43a737,_0x2f9f6c){return db['ChatWebsite'][_0xa764('0x60')]({'where':{'id':_0x5c9534['params']['id']}})[_0xa764('0x37')](handleEntityNotFound(_0x43a737,null))['then'](function(_0x3c1b48){if(_0x3c1b48){return _0x3c1b48[_0xa764('0x6a')](_0x5c9534[_0xa764('0x47')][_0xa764('0x6b')]);}})[_0xa764('0x37')](respondWithStatusCode(_0x43a737,null))[_0xa764('0x2b')](handleError(_0x43a737,null));};exports[_0xa764('0x6c')]=function(_0x2a7123,_0xd1b086,_0x5727ed){if(_0x2a7123[_0xa764('0x5c')]['id']){delete _0x2a7123[_0xa764('0x5c')]['id'];}return db[_0xa764('0x42')][_0xa764('0x60')]({'where':{'id':_0x2a7123[_0xa764('0x64')]['id']}})['then'](handleEntityNotFound(_0xd1b086,null))[_0xa764('0x37')](function(_0x5792b8){if(_0x5792b8){_0x2a7123['body'][_0xa764('0x67')]=_0x5792b8['id'];return db['CannedAnswer']['create'](_0x2a7123[_0xa764('0x5c')]);}})[_0xa764('0x37')](respondWithResult(_0xd1b086,null))['catch'](handleError(_0xd1b086,null));};exports[_0xa764('0x6d')]=function(_0x1a57a6,_0x2d3901,_0xaa3492){var _0x135e74={'raw':![],'where':{}};var _0x2705ea={};var _0x528874={'count':0x0,'rows':[]};return db[_0xa764('0x42')][_0xa764('0x6e')]({'where':{'id':_0x1a57a6[_0xa764('0x64')]['id']}})[_0xa764('0x37')](handleEntityNotFound(_0x2d3901,null))['then'](function(_0x16a1c0){if(_0x16a1c0){_0x2705ea['model']=_['keys'](db[_0xa764('0x6f')][_0xa764('0x43')]);_0x2705ea[_0xa764('0x47')]=_[_0xa764('0x48')](_0x1a57a6['query']);_0x2705ea[_0xa764('0x49')]=_['intersection'](_0x2705ea[_0xa764('0x46')],_0x2705ea[_0xa764('0x47')]);_0x135e74[_0xa764('0x4b')]=_[_0xa764('0x4a')](_0x2705ea[_0xa764('0x46')],qs[_0xa764('0x4c')](_0x1a57a6[_0xa764('0x47')][_0xa764('0x4c')]));_0x135e74[_0xa764('0x4b')]=_0x135e74[_0xa764('0x4b')]['length']?_0x135e74['attributes']:_0x2705ea['model'];if(!_0x1a57a6[_0xa764('0x47')][_0xa764('0x4e')](_0xa764('0x70'))){_0x135e74['limit']=qs[_0xa764('0x31')](_0x1a57a6[_0xa764('0x47')][_0xa764('0x31')]);_0x135e74['offset']=qs[_0xa764('0x30')](_0x1a57a6[_0xa764('0x47')]['offset']);}_0x135e74[_0xa764('0x4f')]=qs[_0xa764('0x50')](_0x1a57a6[_0xa764('0x47')]['sort']);_0x135e74['where']=qs[_0xa764('0x49')](_[_0xa764('0x52')](_0x1a57a6['query'],_0x2705ea[_0xa764('0x49')]));_0x135e74[_0xa764('0x51')][_0xa764('0x67')]=_0x16a1c0['id'];if(_0x1a57a6[_0xa764('0x47')][_0xa764('0x53')]){_0x135e74['where']=_[_0xa764('0x54')](_0x135e74[_0xa764('0x51')],{'$or':_[_0xa764('0x41')](_0x135e74[_0xa764('0x4b')],function(_0x31057f){var _0x40d839={};_0x40d839[_0x31057f]={'$like':'%'+_0x1a57a6[_0xa764('0x47')][_0xa764('0x53')]+'%'};return _0x40d839;})});}_0x135e74=_[_0xa764('0x54')]({},_0x135e74,_0x1a57a6['options']);return db[_0xa764('0x6f')][_0xa764('0x2f')]({'where':_0x135e74[_0xa764('0x51')]})['then'](function(_0x460ae4){_0x528874['count']=_0x460ae4;if(_0x1a57a6['query'][_0xa764('0x56')]){_0x135e74[_0xa764('0x57')]=[{'all':!![]}];}return db[_0xa764('0x6f')]['findAll'](_0x135e74);})[_0xa764('0x37')](function(_0x5b6d7d){_0x528874[_0xa764('0x59')]=_0x5b6d7d;return _0x528874;});}})[_0xa764('0x37')](respondWithFilteredResult(_0x2d3901,_0x135e74))['catch'](handleError(_0x2d3901,null));};exports[_0xa764('0x71')]=function(_0x4385a2,_0x3660d6,_0x34e0b8){return db[_0xa764('0x42')][_0xa764('0x60')]({'where':{'id':_0x4385a2[_0xa764('0x64')]['id']}})['then'](handleEntityNotFound(_0x3660d6,null))[_0xa764('0x37')](function(_0x433b02){if(_0x433b02){return _0x433b02['removeAnswers'](_0x4385a2[_0xa764('0x47')]['ids']);}})[_0xa764('0x37')](respondWithStatusCode(_0x3660d6,null))[_0xa764('0x2b')](handleError(_0x3660d6,null));};exports[_0xa764('0x72')]=function(_0x1d465e,_0x260fd2,_0x238568){_0x1d465e[_0xa764('0x5c')][_0xa764('0x73')]=_0x1d465e[_0xa764('0x74')][_0xa764('0x75')];return db[_0xa764('0x42')][_0xa764('0x60')]({'where':{'id':_0x1d465e['params']['id']}})[_0xa764('0x37')](handleEntityNotFound(_0x260fd2,null))['then'](saveUpdates(_0x1d465e[_0xa764('0x5c')],null))['then'](respondWithResult(_0x260fd2,null))[_0xa764('0x2b')](handleError(_0x260fd2,null));};exports['addAvatar']=function(_0x4f684a,_0x20ab72,_0x51c934){_0x4f684a[_0xa764('0x5c')][_0xa764('0x76')]=_0x4f684a[_0xa764('0x74')][_0xa764('0x75')];return db['ChatWebsite'][_0xa764('0x60')]({'where':{'id':_0x4f684a[_0xa764('0x64')]['id']}})[_0xa764('0x37')](handleEntityNotFound(_0x20ab72,null))['then'](saveUpdates(_0x4f684a[_0xa764('0x5c')],null))[_0xa764('0x37')](respondWithResult(_0x20ab72,null))['catch'](handleError(_0x20ab72,null));};exports[_0xa764('0x77')]=function(_0x3d5fd2,_0x1a4c51,_0x4c9923){_0x3d5fd2['body'][_0xa764('0x78')]=_0x3d5fd2[_0xa764('0x74')][_0xa764('0x75')];return db[_0xa764('0x42')][_0xa764('0x60')]({'where':{'id':_0x3d5fd2['params']['id']}})[_0xa764('0x37')](handleEntityNotFound(_0x1a4c51,null))[_0xa764('0x37')](saveUpdates(_0x3d5fd2[_0xa764('0x5c')],null))['then'](respondWithResult(_0x1a4c51,null))['catch'](handleError(_0x1a4c51,null));};exports[_0xa764('0x79')]=function(_0x53ee9d,_0x41c7ed,_0x40762e){_0x53ee9d[_0xa764('0x5c')][_0xa764('0x7a')]=_0x53ee9d[_0xa764('0x74')]['filename'];return db[_0xa764('0x42')]['find']({'where':{'id':_0x53ee9d[_0xa764('0x64')]['id']}})[_0xa764('0x37')](handleEntityNotFound(_0x41c7ed,null))['then'](saveUpdates(_0x53ee9d[_0xa764('0x5c')],null))['then'](respondWithResult(_0x41c7ed,null))[_0xa764('0x2b')](handleError(_0x41c7ed,null));};exports[_0xa764('0x7b')]=function(_0x1550b8,_0x4734e4,_0x2d3005){var _0x20d8ad=path['join'](config[_0xa764('0x7c')],_0xa764('0x7d'));var _0x1188b9={'where':{'id':_0x1550b8['params']['id']},'attributes':['id',_0xa764('0x73')],'raw':!![]};var _0x2f1029=![];return require(_0xa764('0x7e'))[_0xa764('0x7f')]()['then'](function(_0x3ed2a3){if(_0x3ed2a3){_0x2f1029=_0x3ed2a3[_0xa764('0x80')];}})['then'](function(){return db[_0xa764('0x42')][_0xa764('0x60')](_0x1188b9);})[_0xa764('0x37')](handleEntityNotFound(_0x4734e4,null))[_0xa764('0x37')](function(_0x13abd3){if(_0x13abd3){if(!_[_0xa764('0x81')](_0x13abd3[_0xa764('0x73')])){if(fs[_0xa764('0x82')](path[_0xa764('0x83')](config[_0xa764('0x7c')],_0xa764('0x84'),_0x13abd3[_0xa764('0x73')]))&&_0x2f1029){_0x20d8ad=path[_0xa764('0x83')](config[_0xa764('0x7c')],_0xa764('0x84'),_0x13abd3[_0xa764('0x73')]);}}return _0x4734e4[_0xa764('0x85')](_0x20d8ad);}})[_0xa764('0x2b')](handleError(_0x4734e4,null));};exports[_0xa764('0x86')]=function(_0x25267f,_0x2cbd47,_0x258cec){var _0x2b7dd7=path[_0xa764('0x83')](config[_0xa764('0x7c')],'server/files/images/avatars/default_avatar.png');var _0xa75d86={'where':{'id':_0x25267f['params']['id']},'attributes':['id',_0xa764('0x76')],'raw':!![]};return db['ChatWebsite'][_0xa764('0x60')](_0xa75d86)['then'](handleEntityNotFound(_0x2cbd47,null))[_0xa764('0x37')](function(_0x23c103){if(_0x23c103){if(!_['isNil'](_0x23c103['agentAvatar'])){if(fs[_0xa764('0x82')](path[_0xa764('0x83')](config[_0xa764('0x7c')],'server/files/images/avatars/',_0x23c103[_0xa764('0x76')]))){_0x2b7dd7=path[_0xa764('0x83')](config[_0xa764('0x7c')],'server/files/images/avatars/',_0x23c103[_0xa764('0x76')]);}}return _0x2cbd47['download'](_0x2b7dd7);}})[_0xa764('0x2b')](handleError(_0x2cbd47,null));};exports['getCustomerAvatar']=function(_0x543c65,_0x141c7c,_0x5aa1ab){var _0x3e2e6c=path['join'](config[_0xa764('0x7c')],_0xa764('0x87'));var _0x3872fa={'where':{'id':_0x543c65[_0xa764('0x64')]['id']},'attributes':['id',_0xa764('0x78'),_0xa764('0x88')],'raw':!![]};return db[_0xa764('0x42')][_0xa764('0x60')](_0x3872fa)[_0xa764('0x37')](handleEntityNotFound(_0x141c7c,null))[_0xa764('0x37')](function(_0x41b033){if(_0x41b033){if(!_[_0xa764('0x81')](_0x41b033[_0xa764('0x78')])){if(fs[_0xa764('0x82')](path['join'](config[_0xa764('0x7c')],_0xa764('0x89'),_0x41b033[_0xa764('0x78')]))&&_0x41b033[_0xa764('0x88')]){_0x3e2e6c=path[_0xa764('0x83')](config[_0xa764('0x7c')],_0xa764('0x89'),_0x41b033[_0xa764('0x78')]);}}return _0x141c7c[_0xa764('0x85')](_0x3e2e6c);}})[_0xa764('0x2b')](handleError(_0x141c7c,null));};exports[_0xa764('0x8a')]=function(_0x2a4326,_0x3682fe,_0x2faae8){var _0x12c9ea=path[_0xa764('0x83')](config[_0xa764('0x7c')],'server/files/images/avatars/system_avatar.png');var _0x3548bb={'where':{'id':_0x2a4326[_0xa764('0x64')]['id']},'attributes':['id',_0xa764('0x7a')],'raw':!![]};return db[_0xa764('0x42')][_0xa764('0x60')](_0x3548bb)[_0xa764('0x37')](handleEntityNotFound(_0x3682fe,null))[_0xa764('0x37')](function(_0x234c2b){if(_0x234c2b){if(!_[_0xa764('0x81')](_0x234c2b[_0xa764('0x7a')])){if(fs[_0xa764('0x82')](path['join'](config[_0xa764('0x7c')],_0xa764('0x89'),_0x234c2b[_0xa764('0x7a')]))){_0x12c9ea=path[_0xa764('0x83')](config['root'],_0xa764('0x89'),_0x234c2b[_0xa764('0x7a')]);}}return _0x3682fe[_0xa764('0x85')](_0x12c9ea);}})[_0xa764('0x2b')](handleError(_0x3682fe,null));};exports[_0xa764('0x8b')]=function(_0x2e9022,_0x2b56be,_0x34e4e5){var _0x13c963=require('user-agent-parser');var _0x49bb20=new _0x13c963();var _0x55bb9d=_0x49bb20[_0xa764('0x8c')](_0x2e9022['headers'][_0xa764('0x8d')])[_0xa764('0x8e')]();var _0x54888d={'body':_0x2e9022[_0xa764('0x5c')],'channel':_0xa764('0x8f')};var _0x3b58a0=[];var _0x4fb558=[];var _0x4139c5={};var _0x5f83f7=![];return db['CmContact']['describe']()[_0xa764('0x37')](function(_0x428715){if(!_0x428715){throw new db[(_0xa764('0x1e'))][(_0xa764('0x1f'))](_0xa764('0x90'));}_0x3b58a0=_[_0xa764('0x91')](_['keys'](_0x428715),[_0xa764('0x92'),_0xa764('0x93')]);_0x4fb558=_[_0xa764('0x91')](_[_0xa764('0x48')](_0x428715),['createdAt','updatedAt',_0xa764('0x94'),'ListId']);if(_0x2e9022['body']['id']){delete _0x2e9022[_0xa764('0x5c')]['id'];}if(_[_0xa764('0x81')](_0x2e9022[_0xa764('0x5c')][_0xa764('0x95')])){throw new db[(_0xa764('0x1e'))][(_0xa764('0x1f'))](_0xa764('0x96'));}if(_[_0xa764('0x81')](_0x2e9022[_0xa764('0x5c')][_0xa764('0x5c')])||_0x2e9022[_0xa764('0x5c')][_0xa764('0x5c')]===''){throw new db[(_0xa764('0x1e'))]['ValidationError'](_0xa764('0x97'));}if(_[_0xa764('0x81')](_0x2e9022[_0xa764('0x5c')]['mapKey'])){throw new db[(_0xa764('0x1e'))][(_0xa764('0x1f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4fb558);}if(!_[_0xa764('0x98')](_0x4fb558,_0x2e9022[_0xa764('0x5c')][_0xa764('0x99')])){throw new db[(_0xa764('0x1e'))][(_0xa764('0x1f'))](_0xa764('0x9a')+_0x4fb558);}_0x4139c5[_0x2e9022[_0xa764('0x5c')]['mapKey']]=_0x2e9022[_0xa764('0x5c')][_0xa764('0x95')];})['then'](function(){return db[_0xa764('0x42')]['find']({'where':{'id':_0x2e9022[_0xa764('0x64')]['id']},'include':[{'model':db[_0xa764('0x9b')],'as':_0xa764('0x9c'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4139c5,'limit':0x1,'order':[[_0xa764('0x93'),_0xa764('0x9d')]]}]},{'model':db[_0xa764('0x9e')],'as':_0xa764('0x9f')}]});})['then'](handleEntityNotFound(_0x2b56be,null))[_0xa764('0x37')](function(_0x1ff7f7){if(_0x1ff7f7&&_0x1ff7f7[_0xa764('0x9c')]){_0x54888d[_0xa764('0xa0')]=_0x1ff7f7;_0x54888d[_0xa764('0xa1')]=_0x1ff7f7[_0xa764('0x9f')];_0x54888d[_0xa764('0xa2')]=_0x1ff7f7[_0xa764('0x9c')];_0x54888d['applications']=_[_0xa764('0xa3')](_0x54888d[_0xa764('0xa1')],[_0xa764('0xa4')],['asc']);if(_0x54888d[_0xa764('0xa0')][_0xa764('0x9f')]){delete _0x54888d[_0xa764('0xa0')][_0xa764('0x9f')];}if(_0x54888d['account'][_0xa764('0x9c')]&&_0x54888d[_0xa764('0xa0')][_0xa764('0x9c')][_0xa764('0xa5')]['length']){return _0x54888d['account'][_0xa764('0x9c')][_0xa764('0xa5')][0x0];}var _0x446036=_[_0xa764('0xa6')](_0x2e9022[_0xa764('0x5c')],{'firstName':_0x2e9022[_0xa764('0x5c')][_0xa764('0x95')],'ListId':_0x1ff7f7['ListId']});_0x446036[_0x2e9022[_0xa764('0x5c')]['mapKey']]=_0x2e9022['body']['from'];return db[_0xa764('0xa7')][_0xa764('0x5b')](_0x446036,{'fields':_0x3b58a0,'raw':!![]});}})[_0xa764('0x37')](handleEntityNotFound(_0x2b56be,null))['then'](function(_0xe7034f){_0x54888d[_0xa764('0xa8')]=_0xe7034f;var _0x2eb682=_0x2e9022['body']['customerIp'];if(_0x2e9022['headers'][_0xa764('0xa9')]){_0x2eb682=_0x2e9022[_0xa764('0xaa')][_0xa764('0xa9')];}else if(_0x2e9022['headers'][_0xa764('0xab')]){_0x2eb682=_[_0xa764('0xac')](_0x2e9022['headers'][_0xa764('0xab')]['split'](','));}if(_0xe7034f){var _0x3d43a6={'ContactId':_0xe7034f['id'],'ChatWebsiteId':_0x2e9022['params']['id'],'from':(_0xe7034f[_0xa764('0xad')]||'')+'\x20'+(_0xe7034f[_0xa764('0xae')]||''),'customerIp':_0x2eb682,'customerPort':_0x2e9022['headers']['x-real-port']?_0x2e9022[_0xa764('0xaa')][_0xa764('0xaf')]:null,'referer':_0x2e9022['body']['referer'],'browserName':_0x55bb9d[_0xa764('0xb0')][_0xa764('0x3c')]&&_0x55bb9d[_0xa764('0xb0')][_0xa764('0xb1')]?util[_0xa764('0xb2')](_0xa764('0xb3'),_0x55bb9d[_0xa764('0xb0')]['name'],_0x55bb9d[_0xa764('0xb0')][_0xa764('0xb1')]):_0xa764('0xb4'),'browserVersion':_0x55bb9d[_0xa764('0xb0')][_0xa764('0xb1')]||_0xa764('0xb4'),'osName':util['format'](_0xa764('0xb3'),_0x55bb9d['os']['name'],_0x55bb9d['os'][_0xa764('0xb1')]),'osVersion':_0x55bb9d['os'][_0xa764('0xb1')],'deviceModel':_0x55bb9d[_0xa764('0xb5')]['model']&&_0x55bb9d[_0xa764('0xb5')][_0xa764('0xb6')]?util['format'](_0xa764('0xb7'),_0x55bb9d[_0xa764('0xb5')][_0xa764('0x46')],_0x55bb9d['device']['vendor'],_0x55bb9d[_0xa764('0xb5')][_0xa764('0x55')]):null,'deviceVendor':_0x55bb9d['device'][_0xa764('0xb6')],'deviceType':_0x55bb9d[_0xa764('0xb5')][_0xa764('0x55')],'formData':JSON[_0xa764('0x25')](_0x2e9022['body'])};var _0x4a7884={'ChatWebsiteId':_0x2e9022[_0xa764('0x64')]['id'],'closed':![]};if(_0x2e9022[_0xa764('0x5c')]['threadId']){_0x4a7884[_0xa764('0xb8')]=_0x2e9022[_0xa764('0x5c')][_0xa764('0xb8')];return db[_0xa764('0xb9')][_0xa764('0x60')]({'where':_0x4a7884})[_0xa764('0x37')](function(_0x3c13c5){if(_0x3c13c5){return[_0x3c13c5,![]];}_0x3d43a6[_0xa764('0xb8')]=_0x2e9022[_0xa764('0x5c')][_0xa764('0xb8')];_0x3d43a6[_0xa764('0xba')]=_0x2e9022['body'][_0xa764('0xba')];return db[_0xa764('0xb9')][_0xa764('0x5b')](_0x3d43a6)[_0xa764('0x37')](function(_0x10d061){return[_0x10d061,!![]];});});}_0x4a7884[_0xa764('0xbb')]=_0xe7034f['id'];if(_0x2e9022[_0xa764('0x5c')][_0xa764('0xbc')]&&_0x2e9022['body'][_0xa764('0xbc')]['id']){_0x4a7884['id']=_0x2e9022['body'][_0xa764('0xbc')]['id'];return db[_0xa764('0xb9')][_0xa764('0x60')]({'where':_0x4a7884})[_0xa764('0x37')](function(_0x192c92){if(_0x192c92){return[_0x192c92,![]];}return db[_0xa764('0xb9')][_0xa764('0x5b')](_0x3d43a6)[_0xa764('0x37')](function(_0x4e4f41){return[_0x4e4f41,!![]];});});}return db[_0xa764('0xb9')][_0xa764('0x5b')](_0x3d43a6)[_0xa764('0x37')](function(_0x454bc2){return[_0x454bc2,!![]];});}})['spread'](function(_0x2f72b5,_0x48e66b){if(_0x2f72b5){_0x5f83f7=_0x48e66b;if(!_0x48e66b){var _0x3c8ebc={'from':(_0x54888d[_0xa764('0xa8')][_0xa764('0xad')]||'')+'\x20'+(_0x54888d['contact'][_0xa764('0xae')]||'')};if(_0x2e9022[_0xa764('0x5c')][_0xa764('0xb8')]&&_0x2e9022['body'][_0xa764('0xbd')]&&_0x2e9022[_0xa764('0x5c')][_0xa764('0xb8')]!=_0x2e9022[_0xa764('0x5c')][_0xa764('0xbd')]){_0x3c8ebc[_0xa764('0xb8')]=_0x2e9022[_0xa764('0x5c')]['messageId'];}return _0x2f72b5[_0xa764('0x36')](_0x3c8ebc);}else{return _0x2f72b5;}}})[_0xa764('0x37')](function(_0x3f5f80){_0x54888d[_0xa764('0xbc')]=_0x3f5f80['get']({'plain':!![]});_0x54888d[_0xa764('0xbc')][_0xa764('0xbe')]=_0x5f83f7;if(_0x54888d['interaction']['created']){if(_0x54888d[_0xa764('0xa0')][_0xa764('0xbf')]){_0x54888d[_0xa764('0xa1')][_0xa764('0xc0')]({'id':0x0,'priority':_0x54888d[_0xa764('0xa1')]['length']+0x1,'app':_0xa764('0xc1'),'appdata':_0xa764('0xc2'),'interval':_0xa764('0xc3')});}}return db['ChatMessage'][_0xa764('0x5b')]({'body':_0x2e9022[_0xa764('0x5c')][_0xa764('0x5c')],'ChatWebsiteId':_0x2e9022['params']['id'],'ChatInteractionId':_0x3f5f80['id'],'direction':'in','ContactId':_0x54888d['contact']['id'],'AttachmentId':_0x2e9022[_0xa764('0x5c')][_0xa764('0xc4')]});})[_0xa764('0x37')](function(_0x59299a){_0x54888d['message']=_0x59299a;if(_0x54888d[_0xa764('0xbc')][_0xa764('0xc5')]){return db['User'][_0xa764('0x60')]({'attributes':['id',_0xa764('0x3c')],'where':{'id':_0x54888d[_0xa764('0xbc')][_0xa764('0xc5')]}})[_0xa764('0x37')](function(_0x419d7b){if(_0x419d7b){_0x54888d[_0xa764('0xa1')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x419d7b[_0xa764('0x3c')]+','+(_0x54888d[_0xa764('0xa0')][_0xa764('0xc6')]||0xa),'interval':_0xa764('0xc3')});_0x54888d[_0xa764('0xc7')]=!![];}return respondWithRpcPromise(_0xa764('0xc8'),_0xa764('0xc9'),_0x54888d);});}return respondWithRpcPromise(_0xa764('0xc8'),_0xa764('0xc9'),_0x54888d);})[_0xa764('0x37')](function(_0x494ba0){respondWithRpcPromise('EventManager',_0xa764('0xca'),{'event':_0xa764('0x8b'),'message':_0x494ba0},client9002);return _0x494ba0;})[_0xa764('0x37')](respondWithResult(_0x2b56be,null))[_0xa764('0x2b')](handleError(_0x2b56be,null));};exports[_0xa764('0xcb')]=function(_0x28439d,_0x19411d,_0x1a46e5){var _0x2aa2f8,_0x192e45,_0x8a7d90;var _0x46caf2=[];var _0x312cfc=[];var _0x283c40={};return db[_0xa764('0xa7')][_0xa764('0x65')]()[_0xa764('0x37')](function(_0x2800de){if(!_0x2800de){throw new db[(_0xa764('0x1e'))][(_0xa764('0x1f'))](_0xa764('0x90'));}_0x312cfc=_['difference'](_['keys'](_0x2800de),[_0xa764('0x92'),'updatedAt']);_0x46caf2=_[_0xa764('0x91')](_['keys'](_0x2800de),[_0xa764('0x92'),'updatedAt',_0xa764('0x94'),_0xa764('0xcc')]);if(_0x28439d[_0xa764('0x5c')]['id']){delete _0x28439d[_0xa764('0x5c')]['id'];}if(_[_0xa764('0x81')](_0x28439d[_0xa764('0x5c')][_0xa764('0x95')])){throw _0x19411d['status'](0x1f4)[_0xa764('0x3d')](new db[(_0xa764('0x1e'))][(_0xa764('0x1f'))](_0xa764('0x96')));}if(_[_0xa764('0x81')](_0x28439d[_0xa764('0x5c')][_0xa764('0x5c')])||_0x28439d[_0xa764('0x5c')][_0xa764('0x5c')]===''){throw _0x19411d[_0xa764('0x2d')](0x1f4)[_0xa764('0x3d')](new db[(_0xa764('0x1e'))][(_0xa764('0x1f'))](_0xa764('0x97')));}if(_[_0xa764('0x81')](_0x28439d[_0xa764('0x5c')]['mapKeyOffline'])){throw _0x19411d[_0xa764('0x2d')](0x1f4)[_0xa764('0x3d')](new db[(_0xa764('0x1e'))][(_0xa764('0x1f'))](_0xa764('0xcd')+_0x46caf2));}if(!_[_0xa764('0x98')](_0x46caf2,_0x28439d[_0xa764('0x5c')]['mapKeyOffline'])){throw _0x19411d['status'](0x1f4)['send'](new db['Sequelize'][(_0xa764('0x1f'))](_0xa764('0xce')+_0x46caf2));}_0x283c40[_0x28439d[_0xa764('0x5c')][_0xa764('0xcf')]]=_0x28439d['body']['from'];})['then'](function(){return db[_0xa764('0x42')]['find']({'where':{'id':_0x28439d[_0xa764('0x64')]['id']},'include':[{'model':db[_0xa764('0x9b')],'as':'List'}]});})[_0xa764('0x37')](handleEntityNotFound(_0x19411d,null))[_0xa764('0x37')](function(_0x224bb9){if(_0x224bb9&&_0x224bb9[_0xa764('0x9c')]){_0x192e45=_0x224bb9;var _0x3ff60b=_[_0xa764('0xa6')](_0x28439d[_0xa764('0x5c')],{'firstName':_0x28439d[_0xa764('0x5c')][_0xa764('0x95')],'phone':_0x28439d[_0xa764('0x5c')][_0xa764('0x95')],'ListId':_0x224bb9[_0xa764('0xcc')]});_0x3ff60b[_0x28439d[_0xa764('0x5c')]['mapKeyOffline']]=_0x28439d[_0xa764('0x5c')][_0xa764('0x95')];return db[_0xa764('0xa7')][_0xa764('0xd0')]({'where':_0x283c40,'defaults':_0x3ff60b});}})[_0xa764('0xd1')](function(_0x3cc361){if(_0x3cc361){_0x8a7d90=_0x3cc361;var _0x393f9c=fs['readFileSync'](path[_0xa764('0x83')](config[_0xa764('0x7c')],'server/files/templates/chatOfflineMessage.ejs'),_0xa764('0xd2'));var _0x4fa887=ejs[_0xa764('0xd3')](_0x393f9c,{'body':_[_0xa764('0xd4')](_0x28439d[_0xa764('0x5c')][_0xa764('0x5c')]),'bodyTitle':_0x192e45[_0xa764('0xd5')]});return db[_0xa764('0xd6')][_0xa764('0x5b')]({'body':_0x4fa887,'ContactId':_0x3cc361['id'],'ChatWebsiteId':_0x192e45['id']});}})[_0xa764('0x37')](function(_0x454ddc){if(_0x454ddc){_0x2aa2f8=_0x454ddc;return db[_0xa764('0xd7')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xa764('0xd8')],'as':_0xa764('0xd9'),'raw':!![]}]});}})[_0xa764('0x37')](function(_0x3e844b){if(_0x3e844b&&_0x3e844b['Smtp']&&_0x192e45[_0xa764('0xda')]){var _0x210b4b={'tls':{'rejectUnauthorized':![]}};if(_0x3e844b[_0xa764('0xd9')][_0xa764('0xdb')]){_0x210b4b[_0xa764('0xdb')]=_0x3e844b[_0xa764('0xd9')]['service'];}else{_0x210b4b[_0xa764('0xdc')]=_0x3e844b[_0xa764('0xd9')][_0xa764('0xdc')];_0x210b4b[_0xa764('0xdd')]=_0x3e844b[_0xa764('0xd9')][_0xa764('0xdd')];_0x210b4b[_0xa764('0xde')]=_0x3e844b[_0xa764('0xd9')]['secure'];}if(_0x3e844b[_0xa764('0xd9')][_0xa764('0xdf')]){_0x210b4b[_0xa764('0xe0')]={'user':_0x3e844b['Smtp'][_0xa764('0x5d')],'pass':_0x3e844b['Smtp'][_0xa764('0xe1')]};}return respondWithRpcPromise(_0xa764('0xe2'),_0xa764('0xe3'),{'account':_0x210b4b,'message':{'from':util[_0xa764('0xb2')]('\x22%s\x22\x20<%s>',_0x3e844b[_0xa764('0x3c')],_0x3e844b['email']||_0x3e844b[_0xa764('0xd9')]['user']),'to':_0x192e45[_0xa764('0xda')],'subject':_0x192e45['offlineMessageSubject'],'text':_0x2aa2f8[_0xa764('0x5c')]}},client9003)[_0xa764('0x37')](function(){return _0x2aa2f8;})['catch'](function(_0xbd35bb){console['error'](_0xbd35bb);});}})[_0xa764('0x37')](function(){if(_0x2aa2f8){return _0x2aa2f8;}})[_0xa764('0x37')](respondWithResult(_0x19411d,null))['catch'](handleError(_0x19411d,null));};exports[_0xa764('0xe4')]=function(_0x58afc2,_0x64a88e,_0x327305){return db['ChatInteraction'][_0xa764('0x60')]({'where':{'id':_0x58afc2[_0xa764('0x64')]['id']}})['then'](handleEntityNotFound(_0x64a88e,null))[_0xa764('0x37')](function(_0x397867){if(_0x397867){return _0x397867['addInteraction'](_0x58afc2['body'][_0xa764('0x6b')],_[_0xa764('0xe5')](_0x58afc2[_0xa764('0x5c')],['ids','id'])||{});}})[_0xa764('0x37')](respondWithResult(_0x64a88e,null))['catch'](handleError(_0x64a88e,null));};exports['getInteractions']=function(_0x528bf0,_0x441900,_0x5dd276){var _0x1d6119={'raw':![],'where':{}};var _0x42861f={};var _0x37b4cc={'count':0x0,'rows':[]};return db[_0xa764('0x42')][_0xa764('0x6e')]({'where':{'id':_0x528bf0[_0xa764('0x64')]['id']}})['then'](handleEntityNotFound(_0x441900,null))['then'](function(_0x3d2a0a){if(_0x3d2a0a){_0x42861f['model']=_[_0xa764('0x48')](db['ChatInteraction'][_0xa764('0x43')]);_0x42861f[_0xa764('0x47')]=_['keys'](_0x528bf0[_0xa764('0x47')]);_0x42861f[_0xa764('0x49')]=_[_0xa764('0x4a')](_0x42861f[_0xa764('0x46')],_0x42861f[_0xa764('0x47')]);_0x1d6119[_0xa764('0x4b')]=_[_0xa764('0x4a')](_0x42861f[_0xa764('0x46')],qs[_0xa764('0x4c')](_0x528bf0['query']['fields']));_0x1d6119[_0xa764('0x4b')]=_0x1d6119[_0xa764('0x4b')]['length']?_0x1d6119['attributes']:_0x42861f['model'];if(!_0x528bf0[_0xa764('0x47')]['hasOwnProperty'](_0xa764('0x70'))){_0x1d6119[_0xa764('0x31')]=qs[_0xa764('0x31')](_0x528bf0[_0xa764('0x47')][_0xa764('0x31')]);_0x1d6119[_0xa764('0x30')]=qs[_0xa764('0x30')](_0x528bf0['query'][_0xa764('0x30')]);}_0x1d6119[_0xa764('0x4f')]=qs['sort'](_0x528bf0[_0xa764('0x47')][_0xa764('0x50')]);_0x1d6119[_0xa764('0x51')]=qs[_0xa764('0x49')](_[_0xa764('0x52')](_0x528bf0['query'],_0x42861f[_0xa764('0x49')]));_0x1d6119[_0xa764('0x51')][_0xa764('0x67')]=_0x3d2a0a['id'];if(_0x528bf0['query'][_0xa764('0x53')]){_0x1d6119[_0xa764('0x51')]=_['merge'](_0x1d6119[_0xa764('0x51')],{'$or':_[_0xa764('0x41')](_0x1d6119['attributes'],function(_0x56df20){var _0x21dc49={};_0x21dc49[_0x56df20]={'$like':'%'+_0x528bf0[_0xa764('0x47')][_0xa764('0x53')]+'%'};return _0x21dc49;})});}_0x1d6119=_['merge']({},_0x1d6119,_0x528bf0[_0xa764('0xe6')]);return db['ChatInteraction'][_0xa764('0x2f')]({'where':_0x1d6119[_0xa764('0x51')]})[_0xa764('0x37')](function(_0x25f3aa){_0x37b4cc[_0xa764('0x2f')]=_0x25f3aa;if(_0x528bf0['query']['includeAll']){_0x1d6119['include']=[{'model':db['CmContact'],'as':_0xa764('0xe7'),'required':![]},{'model':db[_0xa764('0xe8')],'as':_0xa764('0xe9'),'attributes':[_0xa764('0x3c'),_0xa764('0xea'),_0xa764('0xeb')],'required':![]},{'model':db[_0xa764('0xec')],'as':_0xa764('0xed'),'attributes':['id',_0xa764('0x3c'),'color'],'where':_0x528bf0[_0xa764('0x47')][_0xa764('0xee')]?{'id':_0x528bf0[_0xa764('0x47')]['tag']}:undefined,'required':_0x528bf0['query'][_0xa764('0xee')]?!![]:![]}];}return db[_0xa764('0xb9')]['findAll'](_0x1d6119);})[_0xa764('0x37')](function(_0x3b6bed){_0x37b4cc['rows']=_0x3b6bed;return _0x37b4cc;});}})[_0xa764('0x37')](respondWithFilteredResult(_0x441900,_0x1d6119))[_0xa764('0x2b')](handleError(_0x441900,null));};function iftimePromise(_0x43f2cf,_0x2b90e8){return respondWithRpcPromise(_0xa764('0xef'),'getSnippet',{'command':_0x2b90e8['timezone']?util[_0xa764('0xb2')](_0xa764('0xf0'),_0x43f2cf[_0xa764('0xf1')],_0x2b90e8[_0xa764('0xf2')]):util[_0xa764('0xb2')](_0xa764('0xf3'),_0x43f2cf['interval'])},client9002)[_0xa764('0x37')](function(_0x4c4bb2){var _0x412789=_0x4c4bb2&&_0x4c4bb2[_0xa764('0xf4')](_0xa764('0xf5'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2b90e8['id'],_0x43f2cf['id'],_0x43f2cf[_0xa764('0xf1')],_0x412789?_0xa764('0xf6'):_0xa764('0xf7'),_0x2b90e8[_0xa764('0xf2')]?_0x2b90e8['timezone']:_0xa764('0xf8'));return _0x412789;})[_0xa764('0x2b')](function(_0x483d8b){logger[_0xa764('0x26')](_0xa764('0xf9'),_0x2b90e8['id'],_0x43f2cf['id'],_0x43f2cf[_0xa764('0xf1')],util[_0xa764('0xfa')](_0x483d8b,{'showHidden':![],'depth':null}),_0x2b90e8['timezone']?_0x2b90e8[_0xa764('0xf2')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x23ac7d,_0x2bd19f,_0x10bce8){var _0x4d0108=0x0;var _0x3a612c=0x0;var _0x4baba0=![];var _0x1132ee;var _0x1f0134;return db[_0xa764('0x42')]['find']({'where':{'id':_0x23ac7d[_0xa764('0x64')]['id']},'include':[{'model':db['Interval'],'as':_0xa764('0xfb'),'include':[{'model':db[_0xa764('0xfb')],'as':_0xa764('0xfc'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2bd19f,null))[_0xa764('0x37')](function(_0x309ad6){if(_0x309ad6){_0x1132ee=_0x309ad6;return _0x309ad6['getProactiveActions']({'raw':!![]});}})[_0xa764('0x37')](function(_0x5ced1d){if(_0x1132ee){if(_0x5ced1d){_0x1f0134=_0x5ced1d;}}return require(_0xa764('0x7e'))[_0xa764('0x7f')]();})[_0xa764('0x37')](function(_0x583f01){if(_0x583f01){_0x3a612c=_0x583f01[_0xa764('0xfd')];_0x4baba0=_0x583f01[_0xa764('0x80')];}})[_0xa764('0x37')](function(){return db[_0xa764('0xb9')][_0xa764('0x2f')]({'where':{'closed':![]}});})[_0xa764('0x37')](function(_0x3336d1){_0x4d0108=_0x3336d1;if(_0x3a612c&&_0x3336d1>_0x3a612c){return db[_0xa764('0xfe')][_0xa764('0x6e')]({'where':{'id':0x1}})[_0xa764('0x37')](function(_0x31af84){if(_0x31af84){_0x31af84['increment'](_0xa764('0xff'));}});}})[_0xa764('0x37')](function(){if(_0x1132ee['Interval']&&_0x1132ee['Interval'][_0xa764('0xfc')]){var _0x3060f2=[];for(var _0x57bf42=0x0;_0x57bf42<_0x1132ee[_0xa764('0xfb')][_0xa764('0xfc')][_0xa764('0x4d')];_0x57bf42++){var _0x2df8f9=_0x1132ee[_0xa764('0xfb')][_0xa764('0xfc')][_0x57bf42]['get']({'plain':!![]});_0x3060f2[_0xa764('0xc0')](iftimePromise(_0x2df8f9,_0x1132ee));}return BPromise[_0xa764('0x100')](_0x3060f2)[_0xa764('0x37')](function(_0x5643a8){return _[_0xa764('0x101')](_0x5643a8);});}else{return!![];}})[_0xa764('0x37')](function(_0x3a542e){var _0x165d74=fs[_0xa764('0x102')](path[_0xa764('0x83')](config[_0xa764('0x7c')],_0xa764('0x103')),_0xa764('0xd2'));var _0x13fc9d={'remote':_0x1132ee[_0xa764('0x104')],'query':querystring[_0xa764('0x25')](_[_0xa764('0x54')](_0x1132ee[_0xa764('0x39')]({'plain':!![]}),{'customerIp':_0x23ac7d[_0xa764('0xaa')]['x-forwarded-for']||_0x23ac7d[_0xa764('0xaa')]['x-real-ip']||_0x23ac7d[_0xa764('0x105')][_0xa764('0x106')]||_0x23ac7d['ip'],'referer':_0x23ac7d[_0xa764('0xaa')][_0xa764('0x107')],'openedInteractions':_0x4d0108,'maxInteractions':_0x3a612c,'virtual':_0x4baba0[_0xa764('0xfd')],'online':_0x3a542e,'custom':_0x4baba0}))[_0xa764('0x108')](/'/g,'\x5c\x27')};_0x2bd19f[_0xa764('0x3d')](ejs[_0xa764('0xd3')](Mustache[_0xa764('0xd3')](_0x165d74,_0x13fc9d),{'proactiveActions':_0x1f0134,'alignment':_0x1132ee['alignment'],'verticalAlignment':_0x1132ee[_0xa764('0x109')],'div_color':_0x1132ee[_0xa764('0x10a')],'text_color':_0x1132ee[_0xa764('0x10b')]}));})[_0xa764('0x2b')](handleError(_0x2bd19f,null));};exports[_0xa764('0x10c')]=function(_0x4b6359,_0x16cefd,_0x373448){return db[_0xa764('0x42')][_0xa764('0x6e')]({'where':{'id':_0x4b6359['params']['id']}})[_0xa764('0x37')](handleEntityNotFound(_0x16cefd,null))['then'](function(_0x8e4ba5){if(_0x8e4ba5){return db['sequelize'][_0xa764('0x10d')](function(_0x304c7b){return db['ChatApplication'][_0xa764('0x38')]({'where':{'ChatWebsiteId':_0x4b6359[_0xa764('0x64')]['id']},'transaction':_0x304c7b})[_0xa764('0x37')](function(_0x4c77f6){var _0x54642d=_[_0xa764('0x41')](_0x4b6359[_0xa764('0x5c')],function(_0x283d2f){_0x283d2f[_0xa764('0x67')]=_0x4b6359[_0xa764('0x64')]['id'];return _0x283d2f;});return db[_0xa764('0x9e')][_0xa764('0x10e')](_0x54642d,{'transaction':_0x304c7b});});})['then'](function(){return db[_0xa764('0x9e')][_0xa764('0x10f')]({'where':{'ChatWebsiteId':_0x4b6359['params']['id']},'order':'priority'});});}})['then'](respondWithResult(_0x16cefd,null))[_0xa764('0x2b')](handleError(_0x16cefd,null));};exports[_0xa764('0x110')]=function(_0x858661,_0x501815,_0x46abc1){var _0x16beab={};var _0x43fb0f={};var _0x9fa0;var _0x333a2a;return db[_0xa764('0x42')][_0xa764('0x6e')]({'where':{'id':_0x858661[_0xa764('0x64')]['id']}})[_0xa764('0x37')](handleEntityNotFound(_0x501815,null))[_0xa764('0x37')](function(_0x574085){if(_0x574085){_0x9fa0=_0x574085;_0x43fb0f[_0xa764('0x46')]=_[_0xa764('0x48')](db['ChatApplication'][_0xa764('0x43')]);_0x43fb0f[_0xa764('0x47')]=_[_0xa764('0x48')](_0x858661[_0xa764('0x47')]);_0x43fb0f['filters']=_['intersection'](_0x43fb0f[_0xa764('0x46')],_0x43fb0f[_0xa764('0x47')]);_0x16beab['attributes']=_['intersection'](_0x43fb0f['model'],qs['fields'](_0x858661['query'][_0xa764('0x4c')]));_0x16beab[_0xa764('0x4b')]=_0x16beab[_0xa764('0x4b')]['length']?_0x16beab[_0xa764('0x4b')]:_0x43fb0f['model'];_0x16beab[_0xa764('0x4f')]=qs[_0xa764('0x50')](_0x858661['query'][_0xa764('0x50')]);_0x16beab[_0xa764('0x51')]=qs[_0xa764('0x49')](_[_0xa764('0x52')](_0x858661['query'],_0x43fb0f[_0xa764('0x49')]));if(_0x858661[_0xa764('0x47')][_0xa764('0x53')]){_0x16beab['where']=_[_0xa764('0x54')](_0x16beab[_0xa764('0x51')],{'$or':_[_0xa764('0x41')](_0x16beab[_0xa764('0x4b')],function(_0x5e8d21){var _0x40f0dc={};_0x40f0dc[_0x5e8d21]={'$like':'%'+_0x858661[_0xa764('0x47')][_0xa764('0x53')]+'%'};return _0x40f0dc;})});}_0x16beab=_[_0xa764('0x54')]({},_0x16beab,_0x858661[_0xa764('0xe6')]);return _0x9fa0[_0xa764('0x110')](_0x16beab);}})[_0xa764('0x37')](function(_0x1b5fd2){if(_0x1b5fd2){_0x333a2a=_0x1b5fd2[_0xa764('0x4d')];if(!_0x858661[_0xa764('0x47')][_0xa764('0x4e')](_0xa764('0x70'))){_0x16beab[_0xa764('0x31')]=qs[_0xa764('0x31')](_0x858661['query']['limit']);_0x16beab[_0xa764('0x30')]=qs[_0xa764('0x30')](_0x858661[_0xa764('0x47')][_0xa764('0x30')]);}return _0x9fa0['getApplications'](_0x16beab);}})[_0xa764('0x37')](function(_0x10427d){if(_0x10427d){return _0x10427d?{'count':_0x333a2a,'rows':_0x10427d}:null;}})[_0xa764('0x37')](respondWithResult(_0x501815,null))[_0xa764('0x2b')](handleError(_0x501815,null));};exports[_0xa764('0x111')]=function(_0x58ee15,_0x13639b,_0x46604e){return db[_0xa764('0x112')][_0xa764('0x60')]({'where':{'id':_0x58ee15[_0xa764('0x64')]['id']}})[_0xa764('0x37')](handleEntityNotFound(_0x13639b,null))[_0xa764('0x37')](function(_0x478edf){if(_0x478edf){return _0x478edf[_0xa764('0x111')](_0x58ee15[_0xa764('0x5c')]['ids'],_['omit'](_0x58ee15[_0xa764('0x5c')],[_0xa764('0x6b'),'id'])||{});}})[_0xa764('0x37')](respondWithResult(_0x13639b,null))[_0xa764('0x2b')](handleError(_0x13639b,null));};exports[_0xa764('0x113')]=function(_0x5ebd6d,_0x377066,_0x4810b2){var _0x20acff={};var _0x4ff500={};var _0x2b2279;var _0xc9fb04;return db[_0xa764('0x42')]['findOne']({'where':{'id':_0x5ebd6d[_0xa764('0x64')]['id']}})[_0xa764('0x37')](handleEntityNotFound(_0x377066,null))['then'](function(_0x4ed2fd){if(_0x4ed2fd){_0x2b2279=_0x4ed2fd;_0x4ff500[_0xa764('0x46')]=_[_0xa764('0x48')](db['ChatProactiveAction']['rawAttributes']);_0x4ff500[_0xa764('0x47')]=_[_0xa764('0x48')](_0x5ebd6d[_0xa764('0x47')]);_0x4ff500[_0xa764('0x49')]=_[_0xa764('0x4a')](_0x4ff500['model'],_0x4ff500[_0xa764('0x47')]);_0x20acff[_0xa764('0x4b')]=_['intersection'](_0x4ff500['model'],qs[_0xa764('0x4c')](_0x5ebd6d[_0xa764('0x47')][_0xa764('0x4c')]));_0x20acff['attributes']=_0x20acff['attributes'][_0xa764('0x4d')]?_0x20acff[_0xa764('0x4b')]:_0x4ff500[_0xa764('0x46')];_0x20acff[_0xa764('0x4f')]=qs[_0xa764('0x50')](_0x5ebd6d[_0xa764('0x47')]['sort']);_0x20acff[_0xa764('0x51')]=qs['filters'](_[_0xa764('0x52')](_0x5ebd6d['query'],_0x4ff500[_0xa764('0x49')]));if(_0x5ebd6d[_0xa764('0x47')]['filter']){_0x20acff[_0xa764('0x51')]=_[_0xa764('0x54')](_0x20acff['where'],{'$or':_[_0xa764('0x41')](_0x20acff['attributes'],function(_0x2d8a3d){var _0x3cee15={};_0x3cee15[_0x2d8a3d]={'$like':'%'+_0x5ebd6d['query'][_0xa764('0x53')]+'%'};return _0x3cee15;})});}_0x20acff=_[_0xa764('0x54')]({},_0x20acff,_0x5ebd6d['options']);return _0x2b2279[_0xa764('0x113')](_0x20acff);}})[_0xa764('0x37')](function(_0x39f289){if(_0x39f289){_0xc9fb04=_0x39f289[_0xa764('0x4d')];if(!_0x5ebd6d[_0xa764('0x47')][_0xa764('0x4e')](_0xa764('0x70'))){_0x20acff[_0xa764('0x31')]=qs[_0xa764('0x31')](_0x5ebd6d[_0xa764('0x47')][_0xa764('0x31')]);_0x20acff['offset']=qs[_0xa764('0x30')](_0x5ebd6d[_0xa764('0x47')][_0xa764('0x30')]);}return _0x2b2279[_0xa764('0x113')](_0x20acff);}})[_0xa764('0x37')](function(_0x3f5ef2){if(_0x3f5ef2){return _0x3f5ef2?{'count':_0xc9fb04,'rows':_0x3f5ef2}:null;}})['then'](respondWithResult(_0x377066,null))[_0xa764('0x2b')](handleError(_0x377066,null));};exports[_0xa764('0x114')]=function(_0x4fd386,_0x282662,_0x412e82){var _0x3d9a4b=_0x4fd386['query'][_0xa764('0x115')]===_0xa764('0x116')?_0xa764('0x117'):_0xa764('0x118');return db[_0xa764('0x42')]['find']({'attributes':['id',_0x3d9a4b],'where':{'id':_0x4fd386[_0xa764('0x64')]['id']}})[_0xa764('0x37')](handleEntityNotFound(_0x282662,null))[_0xa764('0x37')](function(_0x572648){if(_0x572648){var _0x44f569=_0x572648[_0x3d9a4b];var _0x3b7b4d=_0x44f569&&_0x44f569[_0xa764('0x119')]?_0x44f569[_0xa764('0x119')]:[];_0x282662[_0xa764('0x3d')]({'fromKey':_[_0xa764('0x81')](_0x44f569[_0xa764('0x11a')])?undefined:_0x44f569[_0xa764('0x11a')],'count':_0x3b7b4d['length'],'rows':_0x3b7b4d});}})[_0xa764('0x2b')](handleError(_0x282662,null));};exports[_0xa764('0x11b')]=function(_0x39bbd2,_0x48d1a5,_0x3b4077){var _0x7d112b={'raw':![],'where':{}};var _0x196330={};var _0x5a0ced={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa764('0x6e')]({'where':{'id':_0x39bbd2['params']['id']}})[_0xa764('0x37')](handleEntityNotFound(_0x48d1a5,null))[_0xa764('0x37')](function(_0x19ba10){if(_0x19ba10){_0x196330[_0xa764('0x46')]=_[_0xa764('0x48')](db['ChatOfflineMessage']['rawAttributes']);_0x196330['query']=_[_0xa764('0x48')](_0x39bbd2[_0xa764('0x47')]);_0x196330[_0xa764('0x49')]=_[_0xa764('0x4a')](_0x196330['model'],_0x196330[_0xa764('0x47')]);_0x7d112b[_0xa764('0x4b')]=_[_0xa764('0x4a')](_0x196330['model'],qs['fields'](_0x39bbd2[_0xa764('0x47')][_0xa764('0x4c')]));_0x7d112b['attributes']=_0x7d112b[_0xa764('0x4b')]['length']?_0x7d112b[_0xa764('0x4b')]:_0x196330[_0xa764('0x46')];if(!_0x39bbd2[_0xa764('0x47')][_0xa764('0x4e')](_0xa764('0x70'))){_0x7d112b[_0xa764('0x31')]=qs['limit'](_0x39bbd2[_0xa764('0x47')]['limit']);_0x7d112b[_0xa764('0x30')]=qs[_0xa764('0x30')](_0x39bbd2[_0xa764('0x47')]['offset']);}_0x7d112b['order']=qs[_0xa764('0x50')](_0x39bbd2[_0xa764('0x47')][_0xa764('0x50')]);_0x7d112b[_0xa764('0x51')]=qs['filters'](_['pick'](_0x39bbd2[_0xa764('0x47')],_0x196330[_0xa764('0x49')]));_0x7d112b[_0xa764('0x51')][_0xa764('0x67')]=_0x19ba10['id'];if(_0x39bbd2[_0xa764('0x47')][_0xa764('0x53')]){_0x7d112b['where']=_['merge'](_0x7d112b[_0xa764('0x51')],{'$or':_[_0xa764('0x41')](_0x7d112b['attributes'],function(_0x1ad570){var _0x835ceb={};_0x835ceb[_0x1ad570]={'$like':'%'+_0x39bbd2[_0xa764('0x47')][_0xa764('0x53')]+'%'};return _0x835ceb;})});}_0x7d112b=_[_0xa764('0x54')]({},_0x7d112b,_0x39bbd2['options']);return db[_0xa764('0xd6')][_0xa764('0x2f')]({'where':_0x7d112b['where']})[_0xa764('0x37')](function(_0x21526d){_0x5a0ced[_0xa764('0x2f')]=_0x21526d;if(_0x39bbd2['query'][_0xa764('0x56')]){_0x7d112b[_0xa764('0x57')]=[{'all':!![]}];}else{_0x7d112b[_0xa764('0x57')]=[{'model':db[_0xa764('0xa7')],'as':_0xa764('0xe7'),'required':![]}];}return db['ChatOfflineMessage'][_0xa764('0x58')](_0x7d112b);})['then'](function(_0x3dd834){_0x5a0ced['rows']=_0x3dd834;return _0x5a0ced;});}})[_0xa764('0x37')](respondWithFilteredResult(_0x48d1a5,_0x7d112b))[_0xa764('0x2b')](handleError(_0x48d1a5,null));};exports[_0xa764('0x11c')]=function(_0x524d80,_0x4478a4,_0x3521d2){return db[_0xa764('0x42')][_0xa764('0x60')]({'where':{'id':_0x524d80[_0xa764('0x64')]['id']}})['then'](handleEntityNotFound(_0x4478a4,null))[_0xa764('0x37')](function(_0x5bb5b9){if(_0x5bb5b9){return _0x5bb5b9[_0xa764('0x11c')](_0x524d80[_0xa764('0x5c')][_0xa764('0x6b')],_[_0xa764('0xe5')](_0x524d80[_0xa764('0x5c')],[_0xa764('0x6b'),'id'])||{})['spread'](function(_0x39cbaf){for(var _0x2173fa=0x0;_0x2173fa<_0x524d80[_0xa764('0x5c')][_0xa764('0x6b')][_0xa764('0x4d')];_0x2173fa+=0x1){socket[_0xa764('0x11d')](_0xa764('0x11e'),{'UserId':_0x524d80[_0xa764('0x5c')][_0xa764('0x6b')][_0x2173fa],'ChatWebsiteId':_0x524d80[_0xa764('0x64')]['id']});}return _0x39cbaf;});}})['then'](respondWithResult(_0x4478a4,null))[_0xa764('0x2b')](handleError(_0x4478a4,null));};exports['removeAgents']=function(_0x169557,_0x2ad05a,_0x1ce799){return db[_0xa764('0x42')][_0xa764('0x60')]({'where':{'id':_0x169557[_0xa764('0x64')]['id']}})[_0xa764('0x37')](handleEntityNotFound(_0x2ad05a,null))[_0xa764('0x37')](function(_0xd869aa){if(_0xd869aa){return _0xd869aa[_0xa764('0x11f')](_0x169557[_0xa764('0x47')][_0xa764('0x6b')])[_0xa764('0x37')](function(){if(_[_0xa764('0x120')](_0x169557['query'][_0xa764('0x6b')])){for(var _0x361736=0x0;_0x361736<_0x169557['query']['ids'][_0xa764('0x4d')];_0x361736+=0x1){socket['emit'](_0xa764('0x121'),{'UserId':Number(_0x169557[_0xa764('0x47')][_0xa764('0x6b')][_0x361736]),'ChatWebsiteId':Number(_0x169557[_0xa764('0x64')]['id'])});}}else{socket[_0xa764('0x11d')](_0xa764('0x121'),{'UserId':Number(_0x169557[_0xa764('0x47')]['ids']),'ChatWebsiteId':Number(_0x169557['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2ad05a,null))[_0xa764('0x2b')](handleError(_0x2ad05a,null));};exports[_0xa764('0x122')]=function(_0x56155a,_0x1c2066,_0x12e2a7){var _0x3c4f86={};var _0x1b3a51={};var _0x3ff424;var _0x6f8e16;return db['ChatWebsite'][_0xa764('0x6e')]({'where':{'id':_0x56155a[_0xa764('0x64')]['id']}})[_0xa764('0x37')](handleEntityNotFound(_0x1c2066,null))[_0xa764('0x37')](function(_0x3e901e){if(_0x3e901e){_0x3ff424=_0x3e901e;_0x1b3a51['model']=_[_0xa764('0x48')](db['User']['rawAttributes']);_0x1b3a51['query']=_['keys'](_0x56155a[_0xa764('0x47')]);_0x1b3a51[_0xa764('0x49')]=_[_0xa764('0x4a')](_0x1b3a51['model'],_0x1b3a51[_0xa764('0x47')]);_0x3c4f86[_0xa764('0x4b')]=_[_0xa764('0x4a')](_0x1b3a51['model'],qs[_0xa764('0x4c')](_0x56155a[_0xa764('0x47')][_0xa764('0x4c')]));_0x3c4f86[_0xa764('0x4b')]=_0x3c4f86[_0xa764('0x4b')][_0xa764('0x4d')]?_0x3c4f86[_0xa764('0x4b')]:_0x1b3a51[_0xa764('0x46')];_0x3c4f86[_0xa764('0x4f')]=qs[_0xa764('0x50')](_0x56155a[_0xa764('0x47')]['sort']);_0x3c4f86[_0xa764('0x51')]=qs[_0xa764('0x49')](_[_0xa764('0x52')](_0x56155a[_0xa764('0x47')],_0x1b3a51[_0xa764('0x49')]));if(_0x56155a['query']['filter']){_0x3c4f86[_0xa764('0x51')]=_[_0xa764('0x54')](_0x3c4f86[_0xa764('0x51')],{'$or':_[_0xa764('0x41')](_0x3c4f86['attributes'],function(_0x18ef0b){var _0x276c94={};_0x276c94[_0x18ef0b]={'$like':'%'+_0x56155a['query']['filter']+'%'};return _0x276c94;})});}_0x3c4f86=_[_0xa764('0x54')]({},_0x3c4f86,_0x56155a[_0xa764('0xe6')]);return _0x3ff424['getAgents'](_0x3c4f86);}})[_0xa764('0x37')](function(_0x31199c){if(_0x31199c){_0x6f8e16=_0x31199c[_0xa764('0x4d')];if(!_0x56155a['query'][_0xa764('0x4e')](_0xa764('0x70'))){_0x3c4f86[_0xa764('0x31')]=qs[_0xa764('0x31')](_0x56155a[_0xa764('0x47')][_0xa764('0x31')]);_0x3c4f86[_0xa764('0x30')]=qs[_0xa764('0x30')](_0x56155a[_0xa764('0x47')][_0xa764('0x30')]);}return _0x3ff424[_0xa764('0x122')](_0x3c4f86);}})[_0xa764('0x37')](function(_0x30ae44){if(_0x30ae44){return _0x30ae44?{'count':_0x6f8e16,'rows':_0x30ae44}:null;}})[_0xa764('0x37')](respondWithResult(_0x1c2066,null))['catch'](handleError(_0x1c2066,null));}; \ No newline at end of file +var _0x6634=['from\x20is\x20mandatory','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','applications','list','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','interaction','ChatInteraction','spread','messageId','created','autoclose','push','close','unmanaged','AttachmentId','UserId','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','no\x20available\x20attributes','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','forwardOfflineAddress','service','Smtp','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','User','Owner','fullname','Tag','Tags','color','tag','findAll','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','some','readFileSync','server/files/chat/iframe.js','x-forwarded-for','x-real-ip','connection','replace','render','alignment','verticalAlignment','textColor','sequelize','transaction','ChatApplication','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','omit','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','register','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','get','destroy','stack','send','index','Pause','map','ChatWebsite','rawAttributes','fieldName','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','ChatWebsiteId','findOne','Disposition','includeAll','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','file','filename','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','existsSync','getCustomerAvatar','server/files/images/avatars/','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','chat','CmContact','difference','createdAt','updatedAt','CompanyId','ListId','from'];(function(_0x4de6cd,_0x2c74bb){var _0x26b6d8=function(_0x162504){while(--_0x162504){_0x4de6cd['push'](_0x4de6cd['shift']());}};_0x26b6d8(++_0x2c74bb);}(_0x6634,0x8d));var _0x4663=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x6634[_0x376b45];return _0x2341b3;};'use strict';var pdf=require(_0x4663('0x0'));var emlformat=require(_0x4663('0x1'));var rimraf=require(_0x4663('0x2'));var zipdir=require(_0x4663('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4663('0x4'));var moment=require('moment');var BPromise=require(_0x4663('0x5'));var Mustache=require(_0x4663('0x6'));var util=require(_0x4663('0x7'));var path=require(_0x4663('0x8'));var sox=require(_0x4663('0x9'));var csv=require(_0x4663('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4663('0xb'));var jsforce=require(_0x4663('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4663('0xd'));var Papa=require(_0x4663('0xe'));var Redis=require('ioredis');var authService=require(_0x4663('0xf'));var qs=require(_0x4663('0x10'));var as=require(_0x4663('0x11'));var hardwareService=require(_0x4663('0x12'));var logger=require('../../config/logger')(_0x4663('0x13'));var utils=require('../../config/utils');var config=require(_0x4663('0x14'));var db=require('../../mysqldb')['db'];config[_0x4663('0x15')]=_[_0x4663('0x16')](config[_0x4663('0x15')],{'host':_0x4663('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')[_0x4663('0x18')](socket);var jayson=require(_0x4663('0x19'));var client=jayson[_0x4663('0x1a')][_0x4663('0x1b')]({'port':0x232c});var client9002=jayson[_0x4663('0x1a')][_0x4663('0x1b')]({'port':0x232a});var client9003=jayson[_0x4663('0x1a')][_0x4663('0x1b')]({'port':0x232b});function checkPasswordPattern(_0x375e0f,_0x286057,_0x4d1cc1){if(_0x4d1cc1){var _0x1a76c9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a76c9[_0x4663('0x1c')](_0x286057)){return _0x375e0f;}else{throw new db[(_0x4663('0x1d'))][(_0x4663('0x1e'))](_0x4663('0x1f'));}}else{return _0x375e0f;}}function respondWithRpcPromise(_0x3a4e70,_0x411f9d,_0x195d29,_0x1caaeb){return new BPromise(function(_0x164042,_0xc5ac1d){var _0x3a7a29=_0x1caaeb||client;return _0x3a7a29[_0x4663('0x20')](_0x3a4e70,_0x195d29)[_0x4663('0x21')](function(_0x814981){logger[_0x4663('0x22')](_0x4663('0x23'),_0x411f9d,_0x4663('0x24'));logger[_0x4663('0x25')](_0x4663('0x26'),_0x411f9d,'request\x20sent',JSON[_0x4663('0x27')](_0x814981));if(_0x814981['error']){if(_0x814981['error'][_0x4663('0x28')]===0x1f4){logger[_0x4663('0x29')](_0x4663('0x23'),_0x411f9d,_0x814981[_0x4663('0x29')][_0x4663('0x2a')]);return _0xc5ac1d(_0x814981[_0x4663('0x29')][_0x4663('0x2a')]);}logger[_0x4663('0x29')](_0x4663('0x23'),_0x411f9d,_0x814981['error'][_0x4663('0x2a')]);return _0x164042(_0x814981[_0x4663('0x29')][_0x4663('0x2a')]);}else{logger[_0x4663('0x22')](_0x4663('0x23'),_0x411f9d,_0x4663('0x24'));_0x164042(_0x814981[_0x4663('0x2b')][_0x4663('0x2a')]);}})[_0x4663('0x2c')](function(_0x4138d9){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x411f9d,_0x4138d9);_0xc5ac1d(_0x4138d9);});});}function respondWithStatusCode(_0x1f2de9,_0x14e998){_0x14e998=_0x14e998||0xcc;return function(_0x36eab2){if(_0x36eab2){return _0x1f2de9[_0x4663('0x2d')](_0x14e998);}return _0x1f2de9[_0x4663('0x2e')](_0x14e998)[_0x4663('0x2f')]();};}function respondWithResult(_0x5d3afe,_0x1d4d46){_0x1d4d46=_0x1d4d46||0xc8;return function(_0x54e242){if(_0x54e242){return _0x5d3afe['status'](_0x1d4d46)['json'](_0x54e242);}};}function respondWithFilteredResult(_0x51e7ef,_0x1d6c5e){return function(_0x2273df){if(_0x2273df){var _0x50b0bb=_0x2273df[_0x4663('0x30')],_0x46544b=_0x1d6c5e[_0x4663('0x31')],_0x43f4af=_0x1d6c5e[_0x4663('0x31')]+_0x1d6c5e[_0x4663('0x32')],_0x34f2f4;if(_0x43f4af>=_0x50b0bb){_0x43f4af=_0x50b0bb;_0x34f2f4=0xc8;}else{_0x34f2f4=0xce;}_0x51e7ef[_0x4663('0x2e')](_0x34f2f4);return _0x51e7ef[_0x4663('0x33')](_0x4663('0x34'),_0x46544b+'-'+_0x43f4af+'/'+_0x50b0bb)['json'](_0x2273df);}return null;};}function patchUpdates(_0x365b0f){return function(_0x22670c){try{jsonpatch['apply'](_0x22670c,_0x365b0f,!![]);}catch(_0x199958){return BPromise[_0x4663('0x35')](_0x199958);}return _0x22670c[_0x4663('0x36')]();};}function saveUpdates(_0x3da22b,_0x4d52e3){return function(_0x29ccf2){if(_0x29ccf2){return _0x29ccf2['update'](_0x3da22b)['then'](function(_0x3036e0){return _0x3036e0;});}return null;};}function removeEntity(_0x31bf8f,_0x1b991b){return function(_0x265f5b){if(_0x265f5b){return _0x265f5b['destroy']()[_0x4663('0x21')](function(){var _0x1c667a=_0x265f5b[_0x4663('0x37')]({'plain':!![]});var _0x4377c7='ChatWebsites';return db['UserProfileResource'][_0x4663('0x38')]({'where':{'type':_0x4377c7,'resourceId':_0x1c667a['id']}})['then'](function(){return _0x265f5b;});})['then'](function(){_0x31bf8f[_0x4663('0x2e')](0xcc)[_0x4663('0x2f')]();});}};}function handleEntityNotFound(_0x4d478f,_0x5245b1){return function(_0x2b07c1){if(!_0x2b07c1){_0x4d478f[_0x4663('0x2d')](0x194);}return _0x2b07c1;};}function handleError(_0x468999,_0xec6487){_0xec6487=_0xec6487||0x1f4;return function(_0x24f51a){logger[_0x4663('0x29')](_0x24f51a[_0x4663('0x39')]);if(_0x24f51a['name']){delete _0x24f51a['name'];}_0x468999['status'](_0xec6487)[_0x4663('0x3a')](_0x24f51a);};}exports[_0x4663('0x3b')]=function(_0x5b3af3,_0x269789){var _0x5a72f8={'include':[{'model':db[_0x4663('0x3c')],'as':'mandatoryDispositionPause'}]},_0x1acf0a={},_0x597e62={'count':0x0,'rows':[]};var _0x3e1764=_[_0x4663('0x3d')](db[_0x4663('0x3e')][_0x4663('0x3f')],function(_0x36d4e3){return{'name':_0x36d4e3[_0x4663('0x40')],'type':_0x36d4e3['type'][_0x4663('0x41')]};});_0x1acf0a[_0x4663('0x42')]=_[_0x4663('0x3d')](_0x3e1764,_0x4663('0x43'));_0x1acf0a[_0x4663('0x44')]=_[_0x4663('0x45')](_0x5b3af3[_0x4663('0x44')]);_0x1acf0a['filters']=_[_0x4663('0x46')](_0x1acf0a[_0x4663('0x42')],_0x1acf0a[_0x4663('0x44')]);_0x5a72f8['attributes']=_['intersection'](_0x1acf0a[_0x4663('0x42')],qs['fields'](_0x5b3af3[_0x4663('0x44')][_0x4663('0x47')]));_0x5a72f8[_0x4663('0x48')]=_0x5a72f8[_0x4663('0x48')][_0x4663('0x49')]?_0x5a72f8[_0x4663('0x48')]:_0x1acf0a[_0x4663('0x42')];if(!_0x5b3af3[_0x4663('0x44')][_0x4663('0x4a')](_0x4663('0x4b'))){_0x5a72f8['limit']=qs[_0x4663('0x32')](_0x5b3af3[_0x4663('0x44')]['limit']);_0x5a72f8[_0x4663('0x31')]=qs['offset'](_0x5b3af3[_0x4663('0x44')]['offset']);}_0x5a72f8[_0x4663('0x4c')]=qs[_0x4663('0x4d')](_0x5b3af3[_0x4663('0x44')][_0x4663('0x4d')]);_0x5a72f8[_0x4663('0x4e')]=qs[_0x4663('0x4f')](_[_0x4663('0x50')](_0x5b3af3[_0x4663('0x44')],_0x1acf0a[_0x4663('0x4f')]),_0x3e1764);if(_0x5b3af3[_0x4663('0x44')][_0x4663('0x51')]){_0x5a72f8['where']=_[_0x4663('0x52')](_0x5a72f8[_0x4663('0x4e')],{'$or':_[_0x4663('0x3d')](_0x3e1764,function(_0x1e9af8){if(_0x1e9af8[_0x4663('0x53')]!==_0x4663('0x54')){var _0xff4b09={};_0xff4b09[_0x1e9af8[_0x4663('0x43')]]={'$like':'%'+_0x5b3af3[_0x4663('0x44')][_0x4663('0x51')]+'%'};return _0xff4b09;}})});}_0x5a72f8=_[_0x4663('0x52')]({},_0x5a72f8,_0x5b3af3[_0x4663('0x55')]);var _0x295523={'where':_0x5a72f8[_0x4663('0x4e')]};return db[_0x4663('0x3e')][_0x4663('0x30')](_0x295523)[_0x4663('0x21')](function(_0x3eaf24){_0x597e62[_0x4663('0x30')]=_0x3eaf24;if(_0x5b3af3[_0x4663('0x44')]['includeAll']){_0x5a72f8[_0x4663('0x56')]=[{'all':!![]}];}return db[_0x4663('0x3e')]['findAll'](_0x5a72f8);})['then'](function(_0x570b58){_0x597e62['rows']=_0x570b58;return _0x597e62;})[_0x4663('0x21')](respondWithFilteredResult(_0x269789,_0x5a72f8))[_0x4663('0x2c')](handleError(_0x269789,null));};exports[_0x4663('0x57')]=function(_0x3ff1ed,_0x12477f){var _0x17f37d={'raw':![],'where':{'id':_0x3ff1ed['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1a86b4={};_0x1a86b4['model']=_[_0x4663('0x45')](db['ChatWebsite'][_0x4663('0x3f')]);_0x1a86b4[_0x4663('0x44')]=_[_0x4663('0x45')](_0x3ff1ed[_0x4663('0x44')]);_0x1a86b4['filters']=_['intersection'](_0x1a86b4[_0x4663('0x42')],_0x1a86b4[_0x4663('0x44')]);_0x17f37d[_0x4663('0x48')]=_[_0x4663('0x46')](_0x1a86b4[_0x4663('0x42')],qs[_0x4663('0x47')](_0x3ff1ed[_0x4663('0x44')]['fields']));_0x17f37d['attributes']=_0x17f37d[_0x4663('0x48')]['length']?_0x17f37d[_0x4663('0x48')]:_0x1a86b4['model'];if(_0x3ff1ed['query']['includeAll']){_0x17f37d['include']=[{'all':!![]}];}_0x17f37d=_['merge']({},_0x17f37d,_0x3ff1ed[_0x4663('0x55')]);return db['ChatWebsite'][_0x4663('0x58')](_0x17f37d)[_0x4663('0x21')](handleEntityNotFound(_0x12477f,null))[_0x4663('0x21')](respondWithResult(_0x12477f,null))[_0x4663('0x2c')](handleError(_0x12477f,null));};exports[_0x4663('0x59')]=function(_0x3529bb,_0x56ad4d){return db['ChatWebsite'][_0x4663('0x59')](_0x3529bb[_0x4663('0x5a')],{})[_0x4663('0x21')](function(_0xcc3588){var _0x57119d=_0x3529bb[_0x4663('0x5b')][_0x4663('0x37')]({'plain':!![]});if(!_0x57119d)throw new Error(_0x4663('0x5c'));if(_0x57119d['role']===_0x4663('0x5b')){var _0x5cdf44=_0xcc3588[_0x4663('0x37')]({'plain':!![]});var _0x548c15='ChatWebsites';return db[_0x4663('0x5d')][_0x4663('0x58')]({'where':{'name':_0x548c15,'userProfileId':_0x57119d[_0x4663('0x5e')]},'raw':!![]})['then'](function(_0x5bd437){if(_0x5bd437&&_0x5bd437[_0x4663('0x5f')]===0x0){return db[_0x4663('0x60')][_0x4663('0x59')]({'name':_0x5cdf44['name'],'resourceId':_0x5cdf44['id'],'type':_0x5bd437[_0x4663('0x43')],'sectionId':_0x5bd437['id']},{})[_0x4663('0x21')](function(){return _0xcc3588;});}else{return _0xcc3588;}})['catch'](function(_0x262164){logger['error'](_0x4663('0x61'),_0x262164);throw _0x262164;});}return _0xcc3588;})[_0x4663('0x21')](respondWithResult(_0x56ad4d,0xc9))['catch'](handleError(_0x56ad4d,null));};exports[_0x4663('0x62')]=function(_0x509e41,_0x6c28a1){if(_0x509e41[_0x4663('0x5a')]['id']){delete _0x509e41[_0x4663('0x5a')]['id'];}return db['ChatWebsite'][_0x4663('0x58')]({'where':{'id':_0x509e41[_0x4663('0x63')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x6c28a1,null))[_0x4663('0x21')](saveUpdates(_0x509e41[_0x4663('0x5a')],null))[_0x4663('0x21')](respondWithResult(_0x6c28a1,null))[_0x4663('0x2c')](handleError(_0x6c28a1,null));};exports[_0x4663('0x38')]=function(_0x42ee4f,_0x4a2fc8){return db[_0x4663('0x3e')][_0x4663('0x58')]({'where':{'id':_0x42ee4f[_0x4663('0x63')]['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x4a2fc8,null))['then'](removeEntity(_0x4a2fc8,null))[_0x4663('0x2c')](handleError(_0x4a2fc8,null));};exports[_0x4663('0x64')]=function(_0x3c0090,_0x850381){return db[_0x4663('0x3e')]['describe']()['then'](respondWithResult(_0x850381,null))[_0x4663('0x2c')](handleError(_0x850381,null));};exports[_0x4663('0x65')]=function(_0x5cc266,_0x5559c4,_0x47b83f){if(_0x5cc266[_0x4663('0x5a')]['id']){delete _0x5cc266['body']['id'];}return db['ChatWebsite'][_0x4663('0x58')]({'where':{'id':_0x5cc266['params']['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x5559c4,null))[_0x4663('0x21')](function(_0x2409b7){if(_0x2409b7){_0x5cc266[_0x4663('0x5a')][_0x4663('0x66')]=_0x2409b7['id'];return db['Disposition'][_0x4663('0x59')](_0x5cc266[_0x4663('0x5a')]);}})['then'](respondWithResult(_0x5559c4,null))[_0x4663('0x2c')](handleError(_0x5559c4,null));};exports['getDispositions']=function(_0x89d23d,_0x4f5fe1,_0xe8551d){var _0x3ce236={'raw':![],'where':{}};var _0x4cec1d={};var _0x46c43c={'count':0x0,'rows':[]};return db[_0x4663('0x3e')][_0x4663('0x67')]({'where':{'id':_0x89d23d['params']['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x4f5fe1,null))[_0x4663('0x21')](function(_0x152d89){if(_0x152d89){_0x4cec1d['model']=_[_0x4663('0x45')](db[_0x4663('0x68')]['rawAttributes']);_0x4cec1d['query']=_[_0x4663('0x45')](_0x89d23d[_0x4663('0x44')]);_0x4cec1d['filters']=_['intersection'](_0x4cec1d['model'],_0x4cec1d[_0x4663('0x44')]);_0x3ce236[_0x4663('0x48')]=_[_0x4663('0x46')](_0x4cec1d[_0x4663('0x42')],qs[_0x4663('0x47')](_0x89d23d[_0x4663('0x44')][_0x4663('0x47')]));_0x3ce236[_0x4663('0x48')]=_0x3ce236[_0x4663('0x48')][_0x4663('0x49')]?_0x3ce236[_0x4663('0x48')]:_0x4cec1d['model'];if(!_0x89d23d['query'][_0x4663('0x4a')](_0x4663('0x4b'))){_0x3ce236['limit']=qs[_0x4663('0x32')](_0x89d23d[_0x4663('0x44')][_0x4663('0x32')]);_0x3ce236[_0x4663('0x31')]=qs[_0x4663('0x31')](_0x89d23d[_0x4663('0x44')][_0x4663('0x31')]);}_0x3ce236['order']=qs[_0x4663('0x4d')](_0x89d23d[_0x4663('0x44')]['sort']);_0x3ce236[_0x4663('0x4e')]=qs[_0x4663('0x4f')](_['pick'](_0x89d23d[_0x4663('0x44')],_0x4cec1d[_0x4663('0x4f')]));_0x3ce236['where'][_0x4663('0x66')]=_0x152d89['id'];if(_0x89d23d[_0x4663('0x44')]['filter']){_0x3ce236[_0x4663('0x4e')]=_[_0x4663('0x52')](_0x3ce236['where'],{'$or':_[_0x4663('0x3d')](_0x3ce236[_0x4663('0x48')],function(_0x490822){var _0x5980b8={};_0x5980b8[_0x490822]={'$like':'%'+_0x89d23d[_0x4663('0x44')][_0x4663('0x51')]+'%'};return _0x5980b8;})});}_0x3ce236=_[_0x4663('0x52')]({},_0x3ce236,_0x89d23d[_0x4663('0x55')]);return db[_0x4663('0x68')]['count']({'where':_0x3ce236[_0x4663('0x4e')]})[_0x4663('0x21')](function(_0xf73a17){_0x46c43c[_0x4663('0x30')]=_0xf73a17;if(_0x89d23d['query'][_0x4663('0x69')]){_0x3ce236[_0x4663('0x56')]=[{'all':!![]}];}return db[_0x4663('0x68')]['findAll'](_0x3ce236);})['then'](function(_0x48f825){_0x46c43c[_0x4663('0x6a')]=_0x48f825;return _0x46c43c;});}})[_0x4663('0x21')](respondWithFilteredResult(_0x4f5fe1,_0x3ce236))[_0x4663('0x2c')](handleError(_0x4f5fe1,null));};exports[_0x4663('0x6b')]=function(_0x3ae18e,_0xb60462,_0x27f956){return db[_0x4663('0x3e')][_0x4663('0x58')]({'where':{'id':_0x3ae18e[_0x4663('0x63')]['id']}})[_0x4663('0x21')](handleEntityNotFound(_0xb60462,null))[_0x4663('0x21')](function(_0x51dd5a){if(_0x51dd5a){return _0x51dd5a['removeDispositions'](_0x3ae18e[_0x4663('0x44')]['ids']);}})['then'](respondWithStatusCode(_0xb60462,null))[_0x4663('0x2c')](handleError(_0xb60462,null));};exports[_0x4663('0x6c')]=function(_0x485f4a,_0x2b03bd,_0x529932){if(_0x485f4a['body']['id']){delete _0x485f4a['body']['id'];}return db[_0x4663('0x3e')]['find']({'where':{'id':_0x485f4a[_0x4663('0x63')]['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x2b03bd,null))[_0x4663('0x21')](function(_0xbef791){if(_0xbef791){_0x485f4a[_0x4663('0x5a')][_0x4663('0x66')]=_0xbef791['id'];return db[_0x4663('0x6d')]['create'](_0x485f4a[_0x4663('0x5a')]);}})[_0x4663('0x21')](respondWithResult(_0x2b03bd,null))[_0x4663('0x2c')](handleError(_0x2b03bd,null));};exports[_0x4663('0x6e')]=function(_0x2575d2,_0x244fef,_0x553f19){var _0x50e6e5={'raw':![],'where':{}};var _0x1d4999={};var _0x9cbcc3={'count':0x0,'rows':[]};return db[_0x4663('0x3e')][_0x4663('0x67')]({'where':{'id':_0x2575d2['params']['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x244fef,null))[_0x4663('0x21')](function(_0x552410){if(_0x552410){_0x1d4999['model']=_[_0x4663('0x45')](db['CannedAnswer'][_0x4663('0x3f')]);_0x1d4999[_0x4663('0x44')]=_['keys'](_0x2575d2['query']);_0x1d4999['filters']=_[_0x4663('0x46')](_0x1d4999[_0x4663('0x42')],_0x1d4999['query']);_0x50e6e5[_0x4663('0x48')]=_['intersection'](_0x1d4999[_0x4663('0x42')],qs[_0x4663('0x47')](_0x2575d2['query'][_0x4663('0x47')]));_0x50e6e5['attributes']=_0x50e6e5[_0x4663('0x48')][_0x4663('0x49')]?_0x50e6e5['attributes']:_0x1d4999[_0x4663('0x42')];if(!_0x2575d2[_0x4663('0x44')][_0x4663('0x4a')](_0x4663('0x4b'))){_0x50e6e5['limit']=qs[_0x4663('0x32')](_0x2575d2[_0x4663('0x44')][_0x4663('0x32')]);_0x50e6e5[_0x4663('0x31')]=qs['offset'](_0x2575d2[_0x4663('0x44')]['offset']);}_0x50e6e5[_0x4663('0x4c')]=qs[_0x4663('0x4d')](_0x2575d2[_0x4663('0x44')][_0x4663('0x4d')]);_0x50e6e5[_0x4663('0x4e')]=qs[_0x4663('0x4f')](_[_0x4663('0x50')](_0x2575d2[_0x4663('0x44')],_0x1d4999[_0x4663('0x4f')]));_0x50e6e5[_0x4663('0x4e')]['ChatWebsiteId']=_0x552410['id'];if(_0x2575d2[_0x4663('0x44')][_0x4663('0x51')]){_0x50e6e5['where']=_['merge'](_0x50e6e5['where'],{'$or':_[_0x4663('0x3d')](_0x50e6e5[_0x4663('0x48')],function(_0x3c0237){var _0x3bfefa={};_0x3bfefa[_0x3c0237]={'$like':'%'+_0x2575d2[_0x4663('0x44')][_0x4663('0x51')]+'%'};return _0x3bfefa;})});}_0x50e6e5=_['merge']({},_0x50e6e5,_0x2575d2[_0x4663('0x55')]);return db[_0x4663('0x6d')][_0x4663('0x30')]({'where':_0x50e6e5[_0x4663('0x4e')]})[_0x4663('0x21')](function(_0x55f872){_0x9cbcc3[_0x4663('0x30')]=_0x55f872;if(_0x2575d2[_0x4663('0x44')][_0x4663('0x69')]){_0x50e6e5['include']=[{'all':!![]}];}return db[_0x4663('0x6d')]['findAll'](_0x50e6e5);})[_0x4663('0x21')](function(_0x465877){_0x9cbcc3[_0x4663('0x6a')]=_0x465877;return _0x9cbcc3;});}})['then'](respondWithFilteredResult(_0x244fef,_0x50e6e5))[_0x4663('0x2c')](handleError(_0x244fef,null));};exports[_0x4663('0x6f')]=function(_0x212dfb,_0x170839,_0x1f9fb7){return db['ChatWebsite'][_0x4663('0x58')]({'where':{'id':_0x212dfb[_0x4663('0x63')]['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x170839,null))['then'](function(_0x42a52a){if(_0x42a52a){return _0x42a52a[_0x4663('0x6f')](_0x212dfb['query'][_0x4663('0x70')]);}})[_0x4663('0x21')](respondWithStatusCode(_0x170839,null))[_0x4663('0x2c')](handleError(_0x170839,null));};exports[_0x4663('0x71')]=function(_0x2ddc1e,_0x49aa24,_0x422ceb){_0x2ddc1e[_0x4663('0x5a')]['sitepic']=_0x2ddc1e[_0x4663('0x72')][_0x4663('0x73')];return db['ChatWebsite'][_0x4663('0x58')]({'where':{'id':_0x2ddc1e[_0x4663('0x63')]['id']}})['then'](handleEntityNotFound(_0x49aa24,null))[_0x4663('0x21')](saveUpdates(_0x2ddc1e[_0x4663('0x5a')],null))[_0x4663('0x21')](respondWithResult(_0x49aa24,null))[_0x4663('0x2c')](handleError(_0x49aa24,null));};exports['addAvatar']=function(_0x11e995,_0x1d50d3,_0x59cdbb){_0x11e995[_0x4663('0x5a')][_0x4663('0x74')]=_0x11e995['file'][_0x4663('0x73')];return db['ChatWebsite'][_0x4663('0x58')]({'where':{'id':_0x11e995['params']['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x1d50d3,null))[_0x4663('0x21')](saveUpdates(_0x11e995[_0x4663('0x5a')],null))['then'](respondWithResult(_0x1d50d3,null))['catch'](handleError(_0x1d50d3,null));};exports['addCustomerAvatar']=function(_0x12729a,_0x41c01f,_0xf6ca37){_0x12729a[_0x4663('0x5a')][_0x4663('0x75')]=_0x12729a[_0x4663('0x72')][_0x4663('0x73')];return db[_0x4663('0x3e')][_0x4663('0x58')]({'where':{'id':_0x12729a[_0x4663('0x63')]['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x41c01f,null))[_0x4663('0x21')](saveUpdates(_0x12729a['body'],null))[_0x4663('0x21')](respondWithResult(_0x41c01f,null))['catch'](handleError(_0x41c01f,null));};exports[_0x4663('0x76')]=function(_0x1b366a,_0x1fa1f1,_0x2655d1){_0x1b366a[_0x4663('0x5a')][_0x4663('0x77')]=_0x1b366a[_0x4663('0x72')]['filename'];return db['ChatWebsite'][_0x4663('0x58')]({'where':{'id':_0x1b366a['params']['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x1fa1f1,null))[_0x4663('0x21')](saveUpdates(_0x1b366a['body'],null))[_0x4663('0x21')](respondWithResult(_0x1fa1f1,null))[_0x4663('0x2c')](handleError(_0x1fa1f1,null));};exports[_0x4663('0x78')]=function(_0x38aca0,_0x5427a9,_0x8b0565){var _0x200009=path[_0x4663('0x79')](config[_0x4663('0x7a')],_0x4663('0x7b'));var _0x76f5bd={'where':{'id':_0x38aca0[_0x4663('0x63')]['id']},'attributes':['id',_0x4663('0x7c')],'raw':!![]};var _0x41c78c=![];return require(_0x4663('0x7d'))[_0x4663('0x7e')]()[_0x4663('0x21')](function(_0x218750){if(_0x218750){_0x41c78c=_0x218750[_0x4663('0x7f')];}})[_0x4663('0x21')](function(){return db['ChatWebsite'][_0x4663('0x58')](_0x76f5bd);})[_0x4663('0x21')](handleEntityNotFound(_0x5427a9,null))[_0x4663('0x21')](function(_0x5a6877){if(_0x5a6877){if(!_[_0x4663('0x80')](_0x5a6877[_0x4663('0x7c')])){if(fs['existsSync'](path['join'](config[_0x4663('0x7a')],_0x4663('0x81'),_0x5a6877[_0x4663('0x7c')]))&&_0x41c78c){_0x200009=path[_0x4663('0x79')](config[_0x4663('0x7a')],_0x4663('0x81'),_0x5a6877[_0x4663('0x7c')]);}}return _0x5427a9[_0x4663('0x82')](_0x200009);}})[_0x4663('0x2c')](handleError(_0x5427a9,null));};exports['getAvatar']=function(_0x218b11,_0x276b98,_0x130a59){var _0x5148a3=path[_0x4663('0x79')](config[_0x4663('0x7a')],_0x4663('0x83'));var _0x373161={'where':{'id':_0x218b11[_0x4663('0x63')]['id']},'attributes':['id',_0x4663('0x74')],'raw':!![]};return db[_0x4663('0x3e')][_0x4663('0x58')](_0x373161)['then'](handleEntityNotFound(_0x276b98,null))['then'](function(_0x4b72a9){if(_0x4b72a9){if(!_[_0x4663('0x80')](_0x4b72a9['agentAvatar'])){if(fs[_0x4663('0x84')](path[_0x4663('0x79')](config[_0x4663('0x7a')],'server/files/images/avatars/',_0x4b72a9[_0x4663('0x74')]))){_0x5148a3=path[_0x4663('0x79')](config['root'],'server/files/images/avatars/',_0x4b72a9['agentAvatar']);}}return _0x276b98[_0x4663('0x82')](_0x5148a3);}})[_0x4663('0x2c')](handleError(_0x276b98,null));};exports[_0x4663('0x85')]=function(_0x14b45a,_0x325b57,_0x155704){var _0x3b9694=path[_0x4663('0x79')](config[_0x4663('0x7a')],'server/files/images/avatars/customer_avatar.png');var _0x38818e={'where':{'id':_0x14b45a['params']['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0x4663('0x3e')]['find'](_0x38818e)[_0x4663('0x21')](handleEntityNotFound(_0x325b57,null))[_0x4663('0x21')](function(_0x2c00cc){if(_0x2c00cc){if(!_[_0x4663('0x80')](_0x2c00cc[_0x4663('0x75')])){if(fs[_0x4663('0x84')](path['join'](config['root'],_0x4663('0x86'),_0x2c00cc['customerAvatar']))&&_0x2c00cc['showCustomerAvatar']){_0x3b9694=path[_0x4663('0x79')](config[_0x4663('0x7a')],_0x4663('0x86'),_0x2c00cc[_0x4663('0x75')]);}}return _0x325b57[_0x4663('0x82')](_0x3b9694);}})[_0x4663('0x2c')](handleError(_0x325b57,null));};exports['getSystemAvatar']=function(_0x534a93,_0x443dbd,_0xb937a2){var _0x4fcbbd=path[_0x4663('0x79')](config[_0x4663('0x7a')],_0x4663('0x87'));var _0x5339c9={'where':{'id':_0x534a93['params']['id']},'attributes':['id',_0x4663('0x77')],'raw':!![]};return db[_0x4663('0x3e')][_0x4663('0x58')](_0x5339c9)['then'](handleEntityNotFound(_0x443dbd,null))[_0x4663('0x21')](function(_0x235241){if(_0x235241){if(!_[_0x4663('0x80')](_0x235241[_0x4663('0x77')])){if(fs[_0x4663('0x84')](path[_0x4663('0x79')](config[_0x4663('0x7a')],_0x4663('0x86'),_0x235241[_0x4663('0x77')]))){_0x4fcbbd=path[_0x4663('0x79')](config[_0x4663('0x7a')],_0x4663('0x86'),_0x235241[_0x4663('0x77')]);}}return _0x443dbd[_0x4663('0x82')](_0x4fcbbd);}})[_0x4663('0x2c')](handleError(_0x443dbd,null));};exports[_0x4663('0x88')]=function(_0x20705c,_0x3d3495,_0x4bb9bc){var _0x45e2a5=require(_0x4663('0x89'));var _0x1323f3=new _0x45e2a5();var _0x51a2f0=_0x1323f3[_0x4663('0x8a')](_0x20705c[_0x4663('0x8b')]['user-agent'])['getResult']();var _0x1920af={'body':_0x20705c['body'],'channel':_0x4663('0x8c')};var _0x4866be=[];var _0xce092a=[];var _0x4fc66a={};var _0x27a770=![];return db[_0x4663('0x8d')][_0x4663('0x64')]()['then'](function(_0x1fcaed){if(!_0x1fcaed){throw new db['Sequelize'][(_0x4663('0x1e'))]('no\x20available\x20attributes');}_0x4866be=_[_0x4663('0x8e')](_[_0x4663('0x45')](_0x1fcaed),[_0x4663('0x8f'),_0x4663('0x90')]);_0xce092a=_['difference'](_[_0x4663('0x45')](_0x1fcaed),[_0x4663('0x8f'),'updatedAt',_0x4663('0x91'),_0x4663('0x92')]);if(_0x20705c['body']['id']){delete _0x20705c[_0x4663('0x5a')]['id'];}if(_[_0x4663('0x80')](_0x20705c[_0x4663('0x5a')][_0x4663('0x93')])){throw new db[(_0x4663('0x1d'))][(_0x4663('0x1e'))](_0x4663('0x94'));}if(_[_0x4663('0x80')](_0x20705c[_0x4663('0x5a')]['body'])||_0x20705c[_0x4663('0x5a')][_0x4663('0x5a')]===''){throw new db[(_0x4663('0x1d'))][(_0x4663('0x1e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4663('0x80')](_0x20705c['body']['mapKey'])){throw new db['Sequelize'][(_0x4663('0x1e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xce092a);}if(!_[_0x4663('0x95')](_0xce092a,_0x20705c[_0x4663('0x5a')][_0x4663('0x96')])){throw new db[(_0x4663('0x1d'))][(_0x4663('0x1e'))](_0x4663('0x97')+_0xce092a);}_0x4fc66a[_0x20705c['body']['mapKey']]=_0x20705c[_0x4663('0x5a')][_0x4663('0x93')];})[_0x4663('0x21')](function(){return db[_0x4663('0x3e')][_0x4663('0x58')]({'where':{'id':_0x20705c['params']['id']},'include':[{'model':db[_0x4663('0x98')],'as':_0x4663('0x99'),'include':[{'model':db['CmContact'],'as':_0x4663('0x9a'),'where':_0x4fc66a,'limit':0x1,'order':[[_0x4663('0x90'),_0x4663('0x9b')]]}]},{'model':db['ChatApplication'],'as':_0x4663('0x9c')}]});})['then'](handleEntityNotFound(_0x3d3495,null))[_0x4663('0x21')](function(_0x3785aa){if(_0x3785aa&&_0x3785aa[_0x4663('0x99')]){_0x1920af[_0x4663('0x9d')]=_0x3785aa;_0x1920af[_0x4663('0x9e')]=_0x3785aa[_0x4663('0x9c')];_0x1920af[_0x4663('0x9f')]=_0x3785aa[_0x4663('0x99')];_0x1920af[_0x4663('0x9e')]=_[_0x4663('0xa0')](_0x1920af[_0x4663('0x9e')],[_0x4663('0xa1')],[_0x4663('0xa2')]);if(_0x1920af[_0x4663('0x9d')][_0x4663('0x9c')]){delete _0x1920af[_0x4663('0x9d')][_0x4663('0x9c')];}if(_0x1920af[_0x4663('0x9d')][_0x4663('0x99')]&&_0x1920af[_0x4663('0x9d')][_0x4663('0x99')][_0x4663('0x9a')]['length']){return _0x1920af[_0x4663('0x9d')]['List'][_0x4663('0x9a')][0x0];}var _0x3bb136=_[_0x4663('0x16')](_0x20705c[_0x4663('0x5a')],{'firstName':_0x20705c['body'][_0x4663('0x93')],'ListId':_0x3785aa['ListId']});_0x3bb136[_0x20705c[_0x4663('0x5a')][_0x4663('0x96')]]=_0x20705c[_0x4663('0x5a')][_0x4663('0x93')];return db[_0x4663('0x8d')][_0x4663('0x59')](_0x3bb136,{'fields':_0x4866be,'raw':!![]});}})['then'](handleEntityNotFound(_0x3d3495,null))[_0x4663('0x21')](function(_0x186da5){_0x1920af[_0x4663('0xa3')]=_0x186da5;var _0x38dd51=_0x20705c[_0x4663('0x5a')][_0x4663('0xa4')];if(_0x20705c[_0x4663('0x8b')][_0x4663('0xa5')]){_0x38dd51=_0x20705c['headers'][_0x4663('0xa5')];}else if(_0x20705c[_0x4663('0x8b')]['x-forwarded-for']){_0x38dd51=_[_0x4663('0xa6')](_0x20705c[_0x4663('0x8b')]['x-forwarded-for'][_0x4663('0xa7')](','));}if(_0x186da5){var _0x614645={'ContactId':_0x186da5['id'],'ChatWebsiteId':_0x20705c[_0x4663('0x63')]['id'],'from':(_0x186da5[_0x4663('0xa8')]||'')+'\x20'+(_0x186da5[_0x4663('0xa9')]||''),'customerIp':_0x38dd51,'customerPort':_0x20705c[_0x4663('0x8b')]['x-real-port']?_0x20705c[_0x4663('0x8b')][_0x4663('0xaa')]:null,'referer':_0x20705c[_0x4663('0x5a')][_0x4663('0xab')],'browserName':_0x51a2f0[_0x4663('0xac')][_0x4663('0x43')]&&_0x51a2f0[_0x4663('0xac')][_0x4663('0xad')]?util[_0x4663('0xae')](_0x4663('0xaf'),_0x51a2f0[_0x4663('0xac')]['name'],_0x51a2f0[_0x4663('0xac')][_0x4663('0xad')]):_0x4663('0xb0'),'browserVersion':_0x51a2f0[_0x4663('0xac')][_0x4663('0xad')]||_0x4663('0xb0'),'osName':util[_0x4663('0xae')](_0x4663('0xaf'),_0x51a2f0['os'][_0x4663('0x43')],_0x51a2f0['os'][_0x4663('0xad')]),'osVersion':_0x51a2f0['os'][_0x4663('0xad')],'deviceModel':_0x51a2f0[_0x4663('0xb1')][_0x4663('0x42')]&&_0x51a2f0['device'][_0x4663('0xb2')]?util[_0x4663('0xae')](_0x4663('0xb3'),_0x51a2f0[_0x4663('0xb1')][_0x4663('0x42')],_0x51a2f0[_0x4663('0xb1')][_0x4663('0xb2')],_0x51a2f0[_0x4663('0xb1')]['type']):null,'deviceVendor':_0x51a2f0[_0x4663('0xb1')][_0x4663('0xb2')],'deviceType':_0x51a2f0[_0x4663('0xb1')][_0x4663('0x53')],'formData':JSON[_0x4663('0x27')](_0x20705c[_0x4663('0x5a')])};var _0x27f4ae={'ChatWebsiteId':_0x20705c[_0x4663('0x63')]['id'],'closed':![]};if(_0x20705c['body'][_0x4663('0xb4')]){_0x27f4ae[_0x4663('0xb4')]=_0x20705c[_0x4663('0x5a')]['threadId'];return db['ChatInteraction']['find']({'where':_0x27f4ae})[_0x4663('0x21')](function(_0x185fde){if(_0x185fde){return[_0x185fde,![]];}_0x614645[_0x4663('0xb4')]=_0x20705c[_0x4663('0x5a')][_0x4663('0xb4')];_0x614645[_0x4663('0xb5')]=_0x20705c[_0x4663('0x5a')][_0x4663('0xb5')];return db['ChatInteraction'][_0x4663('0x59')](_0x614645)[_0x4663('0x21')](function(_0x3662f1){return[_0x3662f1,!![]];});});}_0x27f4ae['ContactId']=_0x186da5['id'];if(_0x20705c['body']['interaction']&&_0x20705c[_0x4663('0x5a')]['interaction']['id']){_0x27f4ae['id']=_0x20705c['body'][_0x4663('0xb6')]['id'];return db[_0x4663('0xb7')][_0x4663('0x58')]({'where':_0x27f4ae})['then'](function(_0x384e4b){if(_0x384e4b){return[_0x384e4b,![]];}return db[_0x4663('0xb7')]['create'](_0x614645)['then'](function(_0x574633){return[_0x574633,!![]];});});}return db[_0x4663('0xb7')][_0x4663('0x59')](_0x614645)[_0x4663('0x21')](function(_0x7102c9){return[_0x7102c9,!![]];});}})[_0x4663('0xb8')](function(_0x24d261,_0x13f84d){if(_0x24d261){_0x27a770=_0x13f84d;if(!_0x13f84d){var _0x1dafa6={'from':(_0x1920af[_0x4663('0xa3')][_0x4663('0xa8')]||'')+'\x20'+(_0x1920af[_0x4663('0xa3')][_0x4663('0xa9')]||'')};if(_0x20705c[_0x4663('0x5a')]['threadId']&&_0x20705c['body'][_0x4663('0xb9')]&&_0x20705c['body'][_0x4663('0xb4')]!=_0x20705c['body'][_0x4663('0xb9')]){_0x1dafa6[_0x4663('0xb4')]=_0x20705c[_0x4663('0x5a')][_0x4663('0xb9')];}return _0x24d261['update'](_0x1dafa6);}else{return _0x24d261;}}})['then'](function(_0x1d9696){_0x1920af[_0x4663('0xb6')]=_0x1d9696['get']({'plain':!![]});_0x1920af[_0x4663('0xb6')][_0x4663('0xba')]=_0x27a770;if(_0x1920af[_0x4663('0xb6')][_0x4663('0xba')]){if(_0x1920af[_0x4663('0x9d')][_0x4663('0xbb')]){_0x1920af[_0x4663('0x9e')][_0x4663('0xbc')]({'id':0x0,'priority':_0x1920af[_0x4663('0x9e')][_0x4663('0x49')]+0x1,'app':_0x4663('0xbd'),'appdata':_0x4663('0xbe'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0x4663('0x59')]({'body':_0x20705c[_0x4663('0x5a')][_0x4663('0x5a')],'ChatWebsiteId':_0x20705c['params']['id'],'ChatInteractionId':_0x1d9696['id'],'direction':'in','ContactId':_0x1920af[_0x4663('0xa3')]['id'],'AttachmentId':_0x20705c[_0x4663('0x5a')][_0x4663('0xbf')]});})['then'](function(_0x59f726){_0x1920af['message']=_0x59f726;if(_0x1920af[_0x4663('0xb6')][_0x4663('0xc0')]){return db['User'][_0x4663('0x58')]({'attributes':['id',_0x4663('0x43')],'where':{'id':_0x1920af['interaction'][_0x4663('0xc0')]}})[_0x4663('0x21')](function(_0x41c9da){if(_0x41c9da){_0x1920af[_0x4663('0x9e')][_0x4663('0xc1')]({'id':0x0,'priority':0x0,'app':_0x4663('0xc2'),'appdata':_0x41c9da['name']+','+(_0x1920af[_0x4663('0x9d')]['waitForTheAssignedAgent']||0xa),'interval':_0x4663('0xc3')});_0x1920af[_0x4663('0xc4')]=!![];}return respondWithRpcPromise(_0x4663('0xc5'),_0x4663('0xc6'),_0x1920af);});}return respondWithRpcPromise(_0x4663('0xc5'),_0x4663('0xc6'),_0x1920af);})[_0x4663('0x21')](function(_0x42667d){respondWithRpcPromise('EventManager',_0x4663('0xc7'),{'event':_0x4663('0x88'),'message':_0x42667d},client9002);return _0x42667d;})[_0x4663('0x21')](respondWithResult(_0x3d3495,null))[_0x4663('0x2c')](handleError(_0x3d3495,null));};exports[_0x4663('0xc8')]=function(_0xd2649a,_0x5dbf9a,_0x45ea1f){var _0x5dd592,_0x3be4c4,_0x2028ed;var _0x15cc21=[];var _0x5da570=[];var _0x34919f={};return db[_0x4663('0x8d')][_0x4663('0x64')]()[_0x4663('0x21')](function(_0x5d6b5f){if(!_0x5d6b5f){throw new db[(_0x4663('0x1d'))][(_0x4663('0x1e'))](_0x4663('0xc9'));}_0x5da570=_[_0x4663('0x8e')](_['keys'](_0x5d6b5f),[_0x4663('0x8f'),_0x4663('0x90')]);_0x15cc21=_['difference'](_[_0x4663('0x45')](_0x5d6b5f),[_0x4663('0x8f'),_0x4663('0x90'),_0x4663('0x91'),_0x4663('0x92')]);if(_0xd2649a['body']['id']){delete _0xd2649a[_0x4663('0x5a')]['id'];}if(_[_0x4663('0x80')](_0xd2649a[_0x4663('0x5a')][_0x4663('0x93')])){throw _0x5dbf9a[_0x4663('0x2e')](0x1f4)[_0x4663('0x3a')](new db['Sequelize'][(_0x4663('0x1e'))](_0x4663('0x94')));}if(_['isNil'](_0xd2649a[_0x4663('0x5a')]['body'])||_0xd2649a[_0x4663('0x5a')]['body']===''){throw _0x5dbf9a[_0x4663('0x2e')](0x1f4)[_0x4663('0x3a')](new db[(_0x4663('0x1d'))][(_0x4663('0x1e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x4663('0x80')](_0xd2649a[_0x4663('0x5a')][_0x4663('0xca')])){throw _0x5dbf9a[_0x4663('0x2e')](0x1f4)[_0x4663('0x3a')](new db['Sequelize'][(_0x4663('0x1e'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x15cc21));}if(!_[_0x4663('0x95')](_0x15cc21,_0xd2649a[_0x4663('0x5a')][_0x4663('0xca')])){throw _0x5dbf9a[_0x4663('0x2e')](0x1f4)[_0x4663('0x3a')](new db[(_0x4663('0x1d'))][(_0x4663('0x1e'))](_0x4663('0xcb')+_0x15cc21));}_0x34919f[_0xd2649a[_0x4663('0x5a')][_0x4663('0xca')]]=_0xd2649a[_0x4663('0x5a')][_0x4663('0x93')];})[_0x4663('0x21')](function(){return db[_0x4663('0x3e')][_0x4663('0x58')]({'where':{'id':_0xd2649a[_0x4663('0x63')]['id']},'include':[{'model':db[_0x4663('0x98')],'as':_0x4663('0x99')}]});})[_0x4663('0x21')](handleEntityNotFound(_0x5dbf9a,null))[_0x4663('0x21')](function(_0x57a9cf){if(_0x57a9cf&&_0x57a9cf[_0x4663('0x99')]){_0x3be4c4=_0x57a9cf;var _0x528fbd=_['defaults'](_0xd2649a[_0x4663('0x5a')],{'firstName':_0xd2649a[_0x4663('0x5a')][_0x4663('0x93')],'phone':_0xd2649a['body']['from'],'ListId':_0x57a9cf[_0x4663('0x92')]});_0x528fbd[_0xd2649a[_0x4663('0x5a')]['mapKeyOffline']]=_0xd2649a['body'][_0x4663('0x93')];return db[_0x4663('0x8d')][_0x4663('0xcc')]({'where':_0x34919f,'defaults':_0x528fbd});}})[_0x4663('0xb8')](function(_0x2d1523){if(_0x2d1523){_0x2028ed=_0x2d1523;var _0x29f443=fs['readFileSync'](path[_0x4663('0x79')](config[_0x4663('0x7a')],'server/files/templates/chatOfflineMessage.ejs'),_0x4663('0xcd'));var _0x267af1=ejs['render'](_0x29f443,{'body':_[_0x4663('0xce')](_0xd2649a[_0x4663('0x5a')]['body']),'bodyTitle':_0x3be4c4[_0x4663('0xcf')]});return db[_0x4663('0xd0')][_0x4663('0x59')]({'body':_0x267af1,'ContactId':_0x2d1523['id'],'ChatWebsiteId':_0x3be4c4['id']});}})[_0x4663('0x21')](function(_0x4ba8df){if(_0x4ba8df){_0x5dd592=_0x4ba8df;return db[_0x4663('0xd1')][_0x4663('0x67')]({'where':{'service':!![]},'include':[{'model':db[_0x4663('0xd2')],'as':'Smtp','raw':!![]}]});}})[_0x4663('0x21')](function(_0x30ba61){if(_0x30ba61&&_0x30ba61['Smtp']&&_0x3be4c4[_0x4663('0xd3')]){var _0x55a657={'tls':{'rejectUnauthorized':![]}};if(_0x30ba61['Smtp'][_0x4663('0xd4')]){_0x55a657['service']=_0x30ba61[_0x4663('0xd5')]['service'];}else{_0x55a657[_0x4663('0xd6')]=_0x30ba61[_0x4663('0xd5')][_0x4663('0xd6')];_0x55a657[_0x4663('0xd7')]=_0x30ba61['Smtp'][_0x4663('0xd7')];_0x55a657['secure']=_0x30ba61[_0x4663('0xd5')][_0x4663('0xd8')];}if(_0x30ba61[_0x4663('0xd5')][_0x4663('0xd9')]){_0x55a657[_0x4663('0xda')]={'user':_0x30ba61[_0x4663('0xd5')][_0x4663('0x5b')],'pass':_0x30ba61[_0x4663('0xd5')][_0x4663('0xdb')]};}return respondWithRpcPromise(_0x4663('0xdc'),_0x4663('0xdd'),{'account':_0x55a657,'message':{'from':util['format'](_0x4663('0xde'),_0x30ba61[_0x4663('0x43')],_0x30ba61[_0x4663('0xdf')]||_0x30ba61[_0x4663('0xd5')][_0x4663('0x5b')]),'to':_0x3be4c4[_0x4663('0xd3')],'subject':_0x3be4c4[_0x4663('0xe0')],'text':_0x5dd592['body']}},client9003)[_0x4663('0x21')](function(){return _0x5dd592;})[_0x4663('0x2c')](function(_0x183189){console[_0x4663('0x29')](_0x183189);});}})[_0x4663('0x21')](function(){if(_0x5dd592){return _0x5dd592;}})[_0x4663('0x21')](respondWithResult(_0x5dbf9a,null))[_0x4663('0x2c')](handleError(_0x5dbf9a,null));};exports[_0x4663('0xe1')]=function(_0x10d391,_0x2c3cd1,_0x35a5e0){return db['ChatInteraction'][_0x4663('0x58')]({'where':{'id':_0x10d391[_0x4663('0x63')]['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x2c3cd1,null))['then'](function(_0x1a2f16){if(_0x1a2f16){return _0x1a2f16[_0x4663('0xe1')](_0x10d391[_0x4663('0x5a')][_0x4663('0x70')],_['omit'](_0x10d391[_0x4663('0x5a')],[_0x4663('0x70'),'id'])||{});}})[_0x4663('0x21')](respondWithResult(_0x2c3cd1,null))['catch'](handleError(_0x2c3cd1,null));};exports['getInteractions']=function(_0x4c5fbc,_0x40b3aa,_0x352403){var _0x514ff0={'raw':![],'where':{}};var _0x4e3df8={};var _0x472f97={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x4663('0x67')]({'where':{'id':_0x4c5fbc[_0x4663('0x63')]['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x40b3aa,null))[_0x4663('0x21')](function(_0x1dea15){if(_0x1dea15){_0x4e3df8['model']=_[_0x4663('0x45')](db[_0x4663('0xb7')]['rawAttributes']);_0x4e3df8['query']=_['keys'](_0x4c5fbc[_0x4663('0x44')]);_0x4e3df8['filters']=_['intersection'](_0x4e3df8['model'],_0x4e3df8[_0x4663('0x44')]);_0x514ff0['attributes']=_[_0x4663('0x46')](_0x4e3df8[_0x4663('0x42')],qs[_0x4663('0x47')](_0x4c5fbc[_0x4663('0x44')]['fields']));_0x514ff0[_0x4663('0x48')]=_0x514ff0[_0x4663('0x48')]['length']?_0x514ff0[_0x4663('0x48')]:_0x4e3df8['model'];if(!_0x4c5fbc[_0x4663('0x44')][_0x4663('0x4a')](_0x4663('0x4b'))){_0x514ff0[_0x4663('0x32')]=qs['limit'](_0x4c5fbc[_0x4663('0x44')][_0x4663('0x32')]);_0x514ff0['offset']=qs[_0x4663('0x31')](_0x4c5fbc['query']['offset']);}_0x514ff0['order']=qs['sort'](_0x4c5fbc['query'][_0x4663('0x4d')]);_0x514ff0[_0x4663('0x4e')]=qs[_0x4663('0x4f')](_[_0x4663('0x50')](_0x4c5fbc['query'],_0x4e3df8['filters']));_0x514ff0[_0x4663('0x4e')][_0x4663('0x66')]=_0x1dea15['id'];if(_0x4c5fbc[_0x4663('0x44')][_0x4663('0x51')]){_0x514ff0[_0x4663('0x4e')]=_[_0x4663('0x52')](_0x514ff0['where'],{'$or':_[_0x4663('0x3d')](_0x514ff0[_0x4663('0x48')],function(_0x10a7c1){var _0x5e4176={};_0x5e4176[_0x10a7c1]={'$like':'%'+_0x4c5fbc[_0x4663('0x44')][_0x4663('0x51')]+'%'};return _0x5e4176;})});}_0x514ff0=_[_0x4663('0x52')]({},_0x514ff0,_0x4c5fbc[_0x4663('0x55')]);return db[_0x4663('0xb7')][_0x4663('0x30')]({'where':_0x514ff0[_0x4663('0x4e')]})[_0x4663('0x21')](function(_0xfbdee5){_0x472f97[_0x4663('0x30')]=_0xfbdee5;if(_0x4c5fbc['query'][_0x4663('0x69')]){_0x514ff0[_0x4663('0x56')]=[{'model':db[_0x4663('0x8d')],'as':'Contact','required':![]},{'model':db[_0x4663('0xe2')],'as':_0x4663('0xe3'),'attributes':[_0x4663('0x43'),_0x4663('0xe4'),'internal'],'required':![]},{'model':db[_0x4663('0xe5')],'as':_0x4663('0xe6'),'attributes':['id',_0x4663('0x43'),_0x4663('0xe7')],'where':_0x4c5fbc[_0x4663('0x44')]['tag']?{'id':_0x4c5fbc[_0x4663('0x44')][_0x4663('0xe8')]}:undefined,'required':_0x4c5fbc[_0x4663('0x44')][_0x4663('0xe8')]?!![]:![]}];}return db['ChatInteraction'][_0x4663('0xe9')](_0x514ff0);})[_0x4663('0x21')](function(_0x16c2f4){_0x472f97[_0x4663('0x6a')]=_0x16c2f4;return _0x472f97;});}})[_0x4663('0x21')](respondWithFilteredResult(_0x40b3aa,_0x514ff0))[_0x4663('0x2c')](handleError(_0x40b3aa,null));};function iftimePromise(_0x5e3824,_0x4d168a){return respondWithRpcPromise(_0x4663('0xea'),_0x4663('0xeb'),{'command':_0x4d168a[_0x4663('0xec')]?util['format'](_0x4663('0xed'),_0x5e3824[_0x4663('0xee')],_0x4d168a[_0x4663('0xec')]):util[_0x4663('0xae')](_0x4663('0xef'),_0x5e3824['interval'])},client9002)[_0x4663('0x21')](function(_0x5bd175){var _0x28b974=_0x5bd175&&_0x5bd175[_0x4663('0xf0')](_0x4663('0xf1'))>=0x0?!![]:![];logger[_0x4663('0x22')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4d168a['id'],_0x5e3824['id'],_0x5e3824['interval'],_0x28b974?_0x4663('0xf2'):_0x4663('0xf3'),_0x4d168a['timezone']?_0x4d168a['timezone']:'No\x20timezone');return _0x28b974;})[_0x4663('0x2c')](function(_0x1b9d40){logger['error'](_0x4663('0xf4'),_0x4d168a['id'],_0x5e3824['id'],_0x5e3824[_0x4663('0xee')],util[_0x4663('0xf5')](_0x1b9d40,{'showHidden':![],'depth':null}),_0x4d168a[_0x4663('0xec')]?_0x4d168a['timezone']:_0x4663('0xf6'));return![];});}exports[_0x4663('0xeb')]=function(_0x43bd80,_0x5c2d5f,_0x5eeba5){var _0x5e5f04=0x0;var _0xa3ae8=0x0;var _0x51f214=![];var _0x1aaa94;var _0x23de90;return db['ChatWebsite'][_0x4663('0x58')]({'where':{'id':_0x43bd80['params']['id']},'include':[{'model':db[_0x4663('0xf7')],'as':_0x4663('0xf7'),'include':[{'model':db[_0x4663('0xf7')],'as':_0x4663('0xf8'),'attributes':['id',_0x4663('0xee')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5c2d5f,null))[_0x4663('0x21')](function(_0x33d276){if(_0x33d276){_0x1aaa94=_0x33d276;return _0x33d276[_0x4663('0xf9')]({'raw':!![]});}})[_0x4663('0x21')](function(_0x409d6b){if(_0x1aaa94){if(_0x409d6b){_0x23de90=_0x409d6b;}}return require(_0x4663('0x7d'))['getLicense']();})[_0x4663('0x21')](function(_0x4d3c5a){if(_0x4d3c5a){_0xa3ae8=_0x4d3c5a[_0x4663('0xfa')];_0x51f214=_0x4d3c5a['custom'];}})['then'](function(){return db['ChatInteraction'][_0x4663('0x30')]({'where':{'closed':![]}});})[_0x4663('0x21')](function(_0x9be613){_0x5e5f04=_0x9be613;if(_0xa3ae8&&_0x9be613>_0xa3ae8){return db[_0x4663('0xfb')][_0x4663('0x67')]({'where':{'id':0x1}})[_0x4663('0x21')](function(_0x188a94){if(_0x188a94){_0x188a94[_0x4663('0xfc')](_0x4663('0xfd'));}});}})[_0x4663('0x21')](function(){if(_0x1aaa94[_0x4663('0xf7')]&&_0x1aaa94['Interval'][_0x4663('0xf8')]){var _0x39709a=[];for(var _0x230d46=0x0;_0x230d46<_0x1aaa94[_0x4663('0xf7')][_0x4663('0xf8')]['length'];_0x230d46++){var _0x444512=_0x1aaa94[_0x4663('0xf7')][_0x4663('0xf8')][_0x230d46][_0x4663('0x37')]({'plain':!![]});_0x39709a[_0x4663('0xbc')](iftimePromise(_0x444512,_0x1aaa94));}return BPromise[_0x4663('0xfe')](_0x39709a)['then'](function(_0x49b9c1){return _[_0x4663('0xff')](_0x49b9c1);});}else{return!![];}})[_0x4663('0x21')](function(_0x25de06){var _0x3a9a15=fs[_0x4663('0x100')](path[_0x4663('0x79')](config[_0x4663('0x7a')],_0x4663('0x101')),_0x4663('0xcd'));var _0x2d8fa6={'remote':_0x1aaa94['remote'],'query':querystring[_0x4663('0x27')](_[_0x4663('0x52')](_0x1aaa94[_0x4663('0x37')]({'plain':!![]}),{'customerIp':_0x43bd80['headers'][_0x4663('0x102')]||_0x43bd80[_0x4663('0x8b')][_0x4663('0x103')]||_0x43bd80[_0x4663('0x104')]['remoteAddress']||_0x43bd80['ip'],'referer':_0x43bd80[_0x4663('0x8b')][_0x4663('0xab')],'openedInteractions':_0x5e5f04,'maxInteractions':_0xa3ae8,'virtual':_0x51f214['virtual'],'online':_0x25de06,'custom':_0x51f214}))[_0x4663('0x105')](/'/g,'\x5c\x27')};_0x5c2d5f[_0x4663('0x3a')](ejs[_0x4663('0x106')](Mustache[_0x4663('0x106')](_0x3a9a15,_0x2d8fa6),{'proactiveActions':_0x23de90,'alignment':_0x1aaa94[_0x4663('0x107')],'verticalAlignment':_0x1aaa94[_0x4663('0x108')],'div_color':_0x1aaa94[_0x4663('0xe7')],'text_color':_0x1aaa94[_0x4663('0x109')]}));})[_0x4663('0x2c')](handleError(_0x5c2d5f,null));};exports['addApplications']=function(_0x9e6932,_0x37a0c9,_0x4b0de3){return db[_0x4663('0x3e')]['findOne']({'where':{'id':_0x9e6932[_0x4663('0x63')]['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x37a0c9,null))[_0x4663('0x21')](function(_0x58a7c9){if(_0x58a7c9){return db[_0x4663('0x10a')][_0x4663('0x10b')](function(_0x561325){return db[_0x4663('0x10c')][_0x4663('0x38')]({'where':{'ChatWebsiteId':_0x9e6932[_0x4663('0x63')]['id']},'transaction':_0x561325})[_0x4663('0x21')](function(_0x2fd609){var _0x4a7db2=_['map'](_0x9e6932[_0x4663('0x5a')],function(_0x83feff){_0x83feff['ChatWebsiteId']=_0x9e6932[_0x4663('0x63')]['id'];return _0x83feff;});return db[_0x4663('0x10c')][_0x4663('0x10d')](_0x4a7db2,{'transaction':_0x561325});});})[_0x4663('0x21')](function(){return db[_0x4663('0x10c')][_0x4663('0x10e')]({'where':{'ChatWebsiteId':_0x9e6932[_0x4663('0x63')]['id']},'order':_0x4663('0xa1')});});}})[_0x4663('0x21')](respondWithResult(_0x37a0c9,null))[_0x4663('0x2c')](handleError(_0x37a0c9,null));};exports[_0x4663('0x10f')]=function(_0x29a064,_0x559e15,_0x3b50f0){var _0xf95aef={};var _0x1d72b5={};var _0xc2569e;var _0x58c5c3;return db[_0x4663('0x3e')][_0x4663('0x67')]({'where':{'id':_0x29a064[_0x4663('0x63')]['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x559e15,null))[_0x4663('0x21')](function(_0x132ea3){if(_0x132ea3){_0xc2569e=_0x132ea3;_0x1d72b5[_0x4663('0x42')]=_[_0x4663('0x45')](db[_0x4663('0x10c')][_0x4663('0x3f')]);_0x1d72b5['query']=_[_0x4663('0x45')](_0x29a064[_0x4663('0x44')]);_0x1d72b5[_0x4663('0x4f')]=_[_0x4663('0x46')](_0x1d72b5[_0x4663('0x42')],_0x1d72b5['query']);_0xf95aef[_0x4663('0x48')]=_[_0x4663('0x46')](_0x1d72b5[_0x4663('0x42')],qs['fields'](_0x29a064[_0x4663('0x44')][_0x4663('0x47')]));_0xf95aef[_0x4663('0x48')]=_0xf95aef[_0x4663('0x48')]['length']?_0xf95aef['attributes']:_0x1d72b5[_0x4663('0x42')];_0xf95aef[_0x4663('0x4c')]=qs[_0x4663('0x4d')](_0x29a064[_0x4663('0x44')]['sort']);_0xf95aef[_0x4663('0x4e')]=qs['filters'](_[_0x4663('0x50')](_0x29a064['query'],_0x1d72b5[_0x4663('0x4f')]));if(_0x29a064[_0x4663('0x44')][_0x4663('0x51')]){_0xf95aef[_0x4663('0x4e')]=_[_0x4663('0x52')](_0xf95aef[_0x4663('0x4e')],{'$or':_['map'](_0xf95aef[_0x4663('0x48')],function(_0x1d8645){var _0x55de2d={};_0x55de2d[_0x1d8645]={'$like':'%'+_0x29a064[_0x4663('0x44')][_0x4663('0x51')]+'%'};return _0x55de2d;})});}_0xf95aef=_[_0x4663('0x52')]({},_0xf95aef,_0x29a064[_0x4663('0x55')]);return _0xc2569e[_0x4663('0x10f')](_0xf95aef);}})[_0x4663('0x21')](function(_0x3c3dd8){if(_0x3c3dd8){_0x58c5c3=_0x3c3dd8[_0x4663('0x49')];if(!_0x29a064[_0x4663('0x44')][_0x4663('0x4a')](_0x4663('0x4b'))){_0xf95aef[_0x4663('0x32')]=qs['limit'](_0x29a064[_0x4663('0x44')][_0x4663('0x32')]);_0xf95aef['offset']=qs[_0x4663('0x31')](_0x29a064['query'][_0x4663('0x31')]);}return _0xc2569e[_0x4663('0x10f')](_0xf95aef);}})[_0x4663('0x21')](function(_0x50f8a8){if(_0x50f8a8){return _0x50f8a8?{'count':_0x58c5c3,'rows':_0x50f8a8}:null;}})['then'](respondWithResult(_0x559e15,null))[_0x4663('0x2c')](handleError(_0x559e15,null));};exports[_0x4663('0x110')]=function(_0x3cb36d,_0x51b99d,_0x13bd93){return db[_0x4663('0x111')][_0x4663('0x58')]({'where':{'id':_0x3cb36d[_0x4663('0x63')]['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x51b99d,null))[_0x4663('0x21')](function(_0x40deef){if(_0x40deef){return _0x40deef[_0x4663('0x110')](_0x3cb36d['body']['ids'],_['omit'](_0x3cb36d[_0x4663('0x5a')],['ids','id'])||{});}})[_0x4663('0x21')](respondWithResult(_0x51b99d,null))[_0x4663('0x2c')](handleError(_0x51b99d,null));};exports[_0x4663('0xf9')]=function(_0x209a80,_0x43ee1a,_0x5bd89b){var _0x1ca173={};var _0x246f42={};var _0x3bcbc4;var _0x3b15d6;return db[_0x4663('0x3e')][_0x4663('0x67')]({'where':{'id':_0x209a80[_0x4663('0x63')]['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x43ee1a,null))['then'](function(_0x2d491d){if(_0x2d491d){_0x3bcbc4=_0x2d491d;_0x246f42['model']=_[_0x4663('0x45')](db['ChatProactiveAction'][_0x4663('0x3f')]);_0x246f42[_0x4663('0x44')]=_[_0x4663('0x45')](_0x209a80[_0x4663('0x44')]);_0x246f42[_0x4663('0x4f')]=_[_0x4663('0x46')](_0x246f42[_0x4663('0x42')],_0x246f42[_0x4663('0x44')]);_0x1ca173['attributes']=_['intersection'](_0x246f42[_0x4663('0x42')],qs[_0x4663('0x47')](_0x209a80['query']['fields']));_0x1ca173[_0x4663('0x48')]=_0x1ca173[_0x4663('0x48')]['length']?_0x1ca173[_0x4663('0x48')]:_0x246f42[_0x4663('0x42')];_0x1ca173[_0x4663('0x4c')]=qs[_0x4663('0x4d')](_0x209a80[_0x4663('0x44')][_0x4663('0x4d')]);_0x1ca173[_0x4663('0x4e')]=qs[_0x4663('0x4f')](_[_0x4663('0x50')](_0x209a80[_0x4663('0x44')],_0x246f42[_0x4663('0x4f')]));if(_0x209a80[_0x4663('0x44')][_0x4663('0x51')]){_0x1ca173[_0x4663('0x4e')]=_[_0x4663('0x52')](_0x1ca173[_0x4663('0x4e')],{'$or':_[_0x4663('0x3d')](_0x1ca173[_0x4663('0x48')],function(_0x10aa90){var _0x5bb62c={};_0x5bb62c[_0x10aa90]={'$like':'%'+_0x209a80[_0x4663('0x44')][_0x4663('0x51')]+'%'};return _0x5bb62c;})});}_0x1ca173=_[_0x4663('0x52')]({},_0x1ca173,_0x209a80[_0x4663('0x55')]);return _0x3bcbc4[_0x4663('0xf9')](_0x1ca173);}})[_0x4663('0x21')](function(_0x41e011){if(_0x41e011){_0x3b15d6=_0x41e011[_0x4663('0x49')];if(!_0x209a80[_0x4663('0x44')][_0x4663('0x4a')]('nolimit')){_0x1ca173[_0x4663('0x32')]=qs[_0x4663('0x32')](_0x209a80[_0x4663('0x44')][_0x4663('0x32')]);_0x1ca173['offset']=qs[_0x4663('0x31')](_0x209a80[_0x4663('0x44')][_0x4663('0x31')]);}return _0x3bcbc4[_0x4663('0xf9')](_0x1ca173);}})[_0x4663('0x21')](function(_0x17a899){if(_0x17a899){return _0x17a899?{'count':_0x3b15d6,'rows':_0x17a899}:null;}})[_0x4663('0x21')](respondWithResult(_0x43ee1a,null))[_0x4663('0x2c')](handleError(_0x43ee1a,null));};exports[_0x4663('0x112')]=function(_0x5233c7,_0x2fa253,_0x409942){var _0x182cd0=_0x5233c7[_0x4663('0x44')][_0x4663('0x113')]===_0x4663('0x114')?_0x4663('0x115'):_0x4663('0x116');return db[_0x4663('0x3e')][_0x4663('0x58')]({'attributes':['id',_0x182cd0],'where':{'id':_0x5233c7['params']['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x2fa253,null))[_0x4663('0x21')](function(_0x1e8043){if(_0x1e8043){var _0x371f26=_0x1e8043[_0x182cd0];var _0x76557e=_0x371f26&&_0x371f26[_0x4663('0x117')]?_0x371f26[_0x4663('0x117')]:[];_0x2fa253['send']({'fromKey':_[_0x4663('0x80')](_0x371f26[_0x4663('0x118')])?undefined:_0x371f26['fromKey'],'count':_0x76557e['length'],'rows':_0x76557e});}})['catch'](handleError(_0x2fa253,null));};exports[_0x4663('0x119')]=function(_0x148983,_0x34e0f0,_0x5fe2f4){var _0x1f3a7b={'raw':![],'where':{}};var _0x3269ff={};var _0xa6a6a8={'count':0x0,'rows':[]};return db[_0x4663('0x3e')]['findOne']({'where':{'id':_0x148983[_0x4663('0x63')]['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x34e0f0,null))['then'](function(_0x5bf705){if(_0x5bf705){_0x3269ff[_0x4663('0x42')]=_[_0x4663('0x45')](db[_0x4663('0xd0')]['rawAttributes']);_0x3269ff['query']=_[_0x4663('0x45')](_0x148983[_0x4663('0x44')]);_0x3269ff[_0x4663('0x4f')]=_[_0x4663('0x46')](_0x3269ff[_0x4663('0x42')],_0x3269ff['query']);_0x1f3a7b[_0x4663('0x48')]=_[_0x4663('0x46')](_0x3269ff[_0x4663('0x42')],qs[_0x4663('0x47')](_0x148983[_0x4663('0x44')][_0x4663('0x47')]));_0x1f3a7b[_0x4663('0x48')]=_0x1f3a7b[_0x4663('0x48')][_0x4663('0x49')]?_0x1f3a7b[_0x4663('0x48')]:_0x3269ff[_0x4663('0x42')];if(!_0x148983[_0x4663('0x44')][_0x4663('0x4a')](_0x4663('0x4b'))){_0x1f3a7b[_0x4663('0x32')]=qs[_0x4663('0x32')](_0x148983['query'][_0x4663('0x32')]);_0x1f3a7b[_0x4663('0x31')]=qs['offset'](_0x148983[_0x4663('0x44')][_0x4663('0x31')]);}_0x1f3a7b[_0x4663('0x4c')]=qs[_0x4663('0x4d')](_0x148983[_0x4663('0x44')]['sort']);_0x1f3a7b[_0x4663('0x4e')]=qs[_0x4663('0x4f')](_[_0x4663('0x50')](_0x148983[_0x4663('0x44')],_0x3269ff[_0x4663('0x4f')]));_0x1f3a7b[_0x4663('0x4e')][_0x4663('0x66')]=_0x5bf705['id'];if(_0x148983['query'][_0x4663('0x51')]){_0x1f3a7b['where']=_[_0x4663('0x52')](_0x1f3a7b[_0x4663('0x4e')],{'$or':_[_0x4663('0x3d')](_0x1f3a7b['attributes'],function(_0x57a04d){var _0x143fcf={};_0x143fcf[_0x57a04d]={'$like':'%'+_0x148983[_0x4663('0x44')][_0x4663('0x51')]+'%'};return _0x143fcf;})});}_0x1f3a7b=_[_0x4663('0x52')]({},_0x1f3a7b,_0x148983['options']);return db[_0x4663('0xd0')]['count']({'where':_0x1f3a7b[_0x4663('0x4e')]})[_0x4663('0x21')](function(_0x1915d5){_0xa6a6a8[_0x4663('0x30')]=_0x1915d5;if(_0x148983[_0x4663('0x44')][_0x4663('0x69')]){_0x1f3a7b[_0x4663('0x56')]=[{'all':!![]}];}else{_0x1f3a7b['include']=[{'model':db['CmContact'],'as':'Contact','required':![]}];}return db[_0x4663('0xd0')][_0x4663('0xe9')](_0x1f3a7b);})[_0x4663('0x21')](function(_0x4d5bbf){_0xa6a6a8[_0x4663('0x6a')]=_0x4d5bbf;return _0xa6a6a8;});}})[_0x4663('0x21')](respondWithFilteredResult(_0x34e0f0,_0x1f3a7b))[_0x4663('0x2c')](handleError(_0x34e0f0,null));};exports['addAgents']=function(_0x57ec34,_0x7ab58b,_0x4a3691){return db[_0x4663('0x3e')]['find']({'where':{'id':_0x57ec34[_0x4663('0x63')]['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x7ab58b,null))[_0x4663('0x21')](function(_0x15a128){if(_0x15a128){return _0x15a128[_0x4663('0x11a')](_0x57ec34[_0x4663('0x5a')][_0x4663('0x70')],_[_0x4663('0x11b')](_0x57ec34['body'],['ids','id'])||{})[_0x4663('0xb8')](function(_0x22047d){for(var _0x53eed4=0x0;_0x53eed4<_0x57ec34['body'][_0x4663('0x70')][_0x4663('0x49')];_0x53eed4+=0x1){socket[_0x4663('0x11c')]('userChatWebsite:save',{'UserId':_0x57ec34[_0x4663('0x5a')]['ids'][_0x53eed4],'ChatWebsiteId':_0x57ec34['params']['id']});}return _0x22047d;});}})[_0x4663('0x21')](respondWithResult(_0x7ab58b,null))[_0x4663('0x2c')](handleError(_0x7ab58b,null));};exports[_0x4663('0x11d')]=function(_0x540fa3,_0x408abc,_0x55357b){return db['ChatWebsite'][_0x4663('0x58')]({'where':{'id':_0x540fa3[_0x4663('0x63')]['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x408abc,null))['then'](function(_0x55205a){if(_0x55205a){return _0x55205a[_0x4663('0x11d')](_0x540fa3[_0x4663('0x44')]['ids'])[_0x4663('0x21')](function(){if(_[_0x4663('0x11e')](_0x540fa3[_0x4663('0x44')]['ids'])){for(var _0x360bf8=0x0;_0x360bf8<_0x540fa3['query'][_0x4663('0x70')][_0x4663('0x49')];_0x360bf8+=0x1){socket[_0x4663('0x11c')](_0x4663('0x11f'),{'UserId':Number(_0x540fa3[_0x4663('0x44')][_0x4663('0x70')][_0x360bf8]),'ChatWebsiteId':Number(_0x540fa3[_0x4663('0x63')]['id'])});}}else{socket[_0x4663('0x11c')](_0x4663('0x11f'),{'UserId':Number(_0x540fa3[_0x4663('0x44')][_0x4663('0x70')]),'ChatWebsiteId':Number(_0x540fa3[_0x4663('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0x408abc,null))['catch'](handleError(_0x408abc,null));};exports[_0x4663('0x120')]=function(_0x1cfb44,_0x506d86,_0x82907f){var _0x524e45={};var _0x41231e={};var _0x11e4cd;var _0x562e9d;return db[_0x4663('0x3e')][_0x4663('0x67')]({'where':{'id':_0x1cfb44['params']['id']}})[_0x4663('0x21')](handleEntityNotFound(_0x506d86,null))[_0x4663('0x21')](function(_0x1395d5){if(_0x1395d5){_0x11e4cd=_0x1395d5;_0x41231e['model']=_[_0x4663('0x45')](db[_0x4663('0xe2')][_0x4663('0x3f')]);_0x41231e[_0x4663('0x44')]=_[_0x4663('0x45')](_0x1cfb44[_0x4663('0x44')]);_0x41231e['filters']=_[_0x4663('0x46')](_0x41231e[_0x4663('0x42')],_0x41231e[_0x4663('0x44')]);_0x524e45[_0x4663('0x48')]=_['intersection'](_0x41231e[_0x4663('0x42')],qs[_0x4663('0x47')](_0x1cfb44[_0x4663('0x44')][_0x4663('0x47')]));_0x524e45['attributes']=_0x524e45['attributes'][_0x4663('0x49')]?_0x524e45[_0x4663('0x48')]:_0x41231e[_0x4663('0x42')];_0x524e45[_0x4663('0x4c')]=qs[_0x4663('0x4d')](_0x1cfb44['query'][_0x4663('0x4d')]);_0x524e45[_0x4663('0x4e')]=qs['filters'](_[_0x4663('0x50')](_0x1cfb44[_0x4663('0x44')],_0x41231e['filters']));if(_0x1cfb44[_0x4663('0x44')][_0x4663('0x51')]){_0x524e45[_0x4663('0x4e')]=_[_0x4663('0x52')](_0x524e45[_0x4663('0x4e')],{'$or':_[_0x4663('0x3d')](_0x524e45[_0x4663('0x48')],function(_0x1a23e6){var _0x941361={};_0x941361[_0x1a23e6]={'$like':'%'+_0x1cfb44[_0x4663('0x44')]['filter']+'%'};return _0x941361;})});}_0x524e45=_[_0x4663('0x52')]({},_0x524e45,_0x1cfb44[_0x4663('0x55')]);return _0x11e4cd[_0x4663('0x120')](_0x524e45);}})['then'](function(_0x10ff65){if(_0x10ff65){_0x562e9d=_0x10ff65[_0x4663('0x49')];if(!_0x1cfb44[_0x4663('0x44')][_0x4663('0x4a')](_0x4663('0x4b'))){_0x524e45[_0x4663('0x32')]=qs[_0x4663('0x32')](_0x1cfb44[_0x4663('0x44')]['limit']);_0x524e45[_0x4663('0x31')]=qs[_0x4663('0x31')](_0x1cfb44[_0x4663('0x44')][_0x4663('0x31')]);}return _0x11e4cd[_0x4663('0x120')](_0x524e45);}})[_0x4663('0x21')](function(_0x318c65){if(_0x318c65){return _0x318c65?{'count':_0x562e9d,'rows':_0x318c65}:null;}})[_0x4663('0x21')](respondWithResult(_0x506d86,null))[_0x4663('0x2c')](handleError(_0x506d86,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 929cc1b..dacfcff 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 _0xb701=['hook','exports','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x2d1971,_0x20b764){var _0x4d7759=function(_0x56a550){while(--_0x56a550){_0x2d1971['push'](_0x2d1971['shift']());}};_0x4d7759(++_0x20b764);}(_0xb701,0x144));var _0x1b70=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xb701[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x1b70('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1b70('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1b70('0x2')};function emitEvent(_0x2b21c3){return function(_0x10a362,_0x556f50,_0x3d7757){ChatWebsiteEvents[_0x1b70('0x3')](_0x2b21c3+':'+_0x10a362['id'],_0x10a362);ChatWebsiteEvents[_0x1b70('0x3')](_0x2b21c3,_0x10a362);_0x3d7757(null);};}for(var e in events){if(events[_0x1b70('0x4')](e)){var event=events[e];ChatWebsite[_0x1b70('0x5')](e,emitEvent(event));}}module[_0x1b70('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x15cb=['emit','hook','exports','../../mysqldb','setMaxListeners','update','remove'];(function(_0x2bbed1,_0x55779e){var _0x2a0d6a=function(_0x1bc677){while(--_0x1bc677){_0x2bbed1['push'](_0x2bbed1['shift']());}};_0x2a0d6a(++_0x55779e);}(_0x15cb,0x16f));var _0xb15c=function(_0x2a1ef1,_0x2aa198){_0x2a1ef1=_0x2a1ef1-0x0;var _0xf693a5=_0x15cb[_0x2a1ef1];return _0xf693a5;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xb15c('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xb15c('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb15c('0x2'),'afterDestroy':_0xb15c('0x3')};function emitEvent(_0x2777f9){return function(_0x3d8546,_0x4f1c8f,_0x432920){ChatWebsiteEvents[_0xb15c('0x4')](_0x2777f9+':'+_0x3d8546['id'],_0x3d8546);ChatWebsiteEvents['emit'](_0x2777f9,_0x3d8546);_0x432920(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xb15c('0x5')](e,emitEvent(event));}}module[_0xb15c('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 981d6a8..af72586 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 _0x2750=['rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4276ce,_0x57db91){var _0x3a02dc=function(_0x3f6d84){while(--_0x3f6d84){_0x4276ce['push'](_0x4276ce['shift']());}};_0x3a02dc(++_0x57db91);}(_0x2750,0x13b));var _0x0275=function(_0x475f8a,_0x237a19){_0x475f8a=_0x475f8a-0x0;var _0x2fc170=_0x2750[_0x475f8a];return _0x2fc170;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var moment=require(_0x0275('0x3'));var BPromise=require(_0x0275('0x4'));var rp=require(_0x0275('0x5'));var fs=require('fs');var path=require(_0x0275('0x6'));var rimraf=require(_0x0275('0x7'));var config=require(_0x0275('0x8'));var attributes=require(_0x0275('0x9'));module[_0x0275('0xa')]=function(_0x5953f9,_0x3f645f){return _0x5953f9[_0x0275('0xb')](_0x0275('0xc'),attributes,{'tableName':_0x0275('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b02=['define','ChatWebsite','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x2a05b0,_0x45eed9){var _0x36eb0a=function(_0xef6224){while(--_0xef6224){_0x2a05b0['push'](_0x2a05b0['shift']());}};_0x36eb0a(++_0x45eed9);}(_0x5b02,0xe9));var _0x25b0=function(_0x4d9736,_0x3358b9){_0x4d9736=_0x4d9736-0x0;var _0x4ca8d6=_0x5b02[_0x4d9736];return _0x4ca8d6;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x25b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var attributes=require(_0x25b0('0x7'));module[_0x25b0('0x8')]=function(_0x2d84a9,_0x4eea55){return _0x2d84a9[_0x25b0('0x9')](_0x25b0('0xa'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index f8ea134..e7524ba 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 _0x4975=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','register','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','lodash'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x4975,0x86));var _0x5497=function(_0x2cbb73,_0x32a8c5){_0x2cbb73=_0x2cbb73-0x0;var _0x31ebbd=_0x4975[_0x2cbb73];return _0x31ebbd;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});config['redis']=_[_0x5497('0xc')](config[_0x5497('0xd')],{'host':_0x5497('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5497('0xd')]));require('./chatWebsite.socket')[_0x5497('0xf')](socket);function respondWithRpcPromise(_0x29c93f,_0x2ec5a4,_0x32a8a2){return new BPromise(function(_0x131627,_0x425288){return client[_0x5497('0x10')](_0x29c93f,_0x32a8a2)[_0x5497('0x11')](function(_0x50d716){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x2ec5a4,_0x5497('0x12'));logger[_0x5497('0x13')](_0x5497('0x14'),_0x2ec5a4,_0x5497('0x12'),JSON[_0x5497('0x15')](_0x50d716));if(_0x50d716[_0x5497('0x16')]){if(_0x50d716[_0x5497('0x16')][_0x5497('0x17')]===0x1f4){logger[_0x5497('0x16')](_0x5497('0x18'),_0x2ec5a4,_0x50d716['error'][_0x5497('0x19')]);return _0x425288(_0x50d716['error'][_0x5497('0x19')]);}logger[_0x5497('0x16')](_0x5497('0x18'),_0x2ec5a4,_0x50d716[_0x5497('0x16')][_0x5497('0x19')]);return _0x131627(_0x50d716[_0x5497('0x16')][_0x5497('0x19')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x2ec5a4,_0x5497('0x12'));_0x131627(_0x50d716[_0x5497('0x1a')][_0x5497('0x19')]);}})['catch'](function(_0xbf1ba7){logger[_0x5497('0x16')](_0x5497('0x18'),_0x2ec5a4,_0xbf1ba7);_0x425288(_0xbf1ba7);});});} \ No newline at end of file +var _0x5496=['request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s'];(function(_0x3f1710,_0x3877a2){var _0x528458=function(_0x4b5d0f){while(--_0x4b5d0f){_0x3f1710['push'](_0x3f1710['shift']());}};_0x528458(++_0x3877a2);}(_0x5496,0x175));var _0x6549=function(_0x32727d,_0x19871c){_0x32727d=_0x32727d-0x0;var _0x57b020=_0x5496[_0x32727d];return _0x57b020;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});config[_0x6549('0xa')]=_['defaults'](config[_0x6549('0xa')],{'host':_0x6549('0xb'),'port':0x18eb});var socket=require(_0x6549('0xc'))(new Redis(config['redis']));require(_0x6549('0xd'))[_0x6549('0xe')](socket);function respondWithRpcPromise(_0x2ecce2,_0x135c2c,_0x1e5083){return new BPromise(function(_0x3e08a6,_0x50fa35){return client['request'](_0x2ecce2,_0x1e5083)[_0x6549('0xf')](function(_0xac828c){logger[_0x6549('0x10')](_0x6549('0x11'),_0x135c2c,_0x6549('0x12'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x135c2c,_0x6549('0x12'),JSON[_0x6549('0x13')](_0xac828c));if(_0xac828c['error']){if(_0xac828c[_0x6549('0x14')][_0x6549('0x15')]===0x1f4){logger[_0x6549('0x14')](_0x6549('0x11'),_0x135c2c,_0xac828c[_0x6549('0x14')][_0x6549('0x16')]);return _0x50fa35(_0xac828c['error']['message']);}logger[_0x6549('0x14')](_0x6549('0x11'),_0x135c2c,_0xac828c['error'][_0x6549('0x16')]);return _0x3e08a6(_0xac828c[_0x6549('0x14')][_0x6549('0x16')]);}else{logger[_0x6549('0x10')](_0x6549('0x11'),_0x135c2c,'request\x20sent');_0x3e08a6(_0xac828c['result'][_0x6549('0x16')]);}})['catch'](function(_0x56c15b){logger[_0x6549('0x14')](_0x6549('0x11'),_0x135c2c,_0x56c15b);_0x50fa35(_0x56c15b);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index f356194..c327cb3 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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x244ddb,_0x107a6c){var _0x2aa596=function(_0x30fad9){while(--_0x30fad9){_0x244ddb['push'](_0x244ddb['shift']());}};_0x2aa596(++_0x107a6c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2f020f,_0x2ecc68){_0x2f020f=_0x2f020f-0x0;var _0xad725e=_0x5f2f[_0x2f020f];return _0xad725e;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x12e650,_0x33f29f){var _0x5b56b1=function(_0xa7f3d8){while(--_0xa7f3d8){_0x12e650['push'](_0x12e650['shift']());}};_0x5b56b1(++_0x33f29f);}(_0xb10b,0x12a));var _0xbb10=function(_0x54cd0b,_0x182ab9){_0x54cd0b=_0x54cd0b-0x0;var _0x2dbfb7=_0xb10b[_0x54cd0b];return _0x2dbfb7;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index b96c11f..d2a5794 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 _0x25a3=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','diskStorage','server/files/images/avatars/','file','addAvatar','/:id/customer_avatar','addCustomerAvatar','notify','offline','addApplications','addProactiveActions','put','/:id','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout'];(function(_0x410763,_0x4af9fd){var _0x1bac2f=function(_0x455434){while(--_0x455434){_0x410763['push'](_0x410763['shift']());}};_0x1bac2f(++_0x4af9fd);}(_0x25a3,0x11f));var _0x325a=function(_0x16f407,_0x56afbf){_0x16f407=_0x16f407-0x0;var _0x14264a=_0x25a3[_0x16f407];return _0x14264a;};'use strict';var multer=require(_0x325a('0x0'));var util=require('util');var path=require(_0x325a('0x1'));var timeout=require(_0x325a('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x325a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x325a('0x4'));var controller=require('./chatWebsite.controller');router[_0x325a('0x5')]('/',auth[_0x325a('0x6')](),controller[_0x325a('0x7')]);router[_0x325a('0x5')]('/describe',auth[_0x325a('0x6')](),controller[_0x325a('0x8')]);router[_0x325a('0x5')]('/:id',auth[_0x325a('0x6')](),controller[_0x325a('0x9')]);router[_0x325a('0x5')](_0x325a('0xa'),auth[_0x325a('0x6')](),controller[_0x325a('0xb')]);router[_0x325a('0x5')](_0x325a('0xc'),auth['isAuthenticated'](),controller[_0x325a('0xd')]);router[_0x325a('0x5')]('/:id/logo',controller['getLogo']);router[_0x325a('0x5')](_0x325a('0xe'),controller[_0x325a('0xf')]);router['get']('/:id/customer_avatar',controller[_0x325a('0x10')]);router[_0x325a('0x5')](_0x325a('0x11'),controller['getSystemAvatar']);router[_0x325a('0x5')](_0x325a('0x12'),auth[_0x325a('0x6')](),controller[_0x325a('0x13')]);router[_0x325a('0x5')]('/:id/snippet',controller[_0x325a('0x14')]);router[_0x325a('0x5')](_0x325a('0x15'),auth[_0x325a('0x6')](),controller[_0x325a('0x16')]);router[_0x325a('0x5')](_0x325a('0x17'),auth[_0x325a('0x6')](),controller['getProactiveActions']);router[_0x325a('0x5')](_0x325a('0x18'),controller[_0x325a('0x19')]);router[_0x325a('0x5')]('/:id/offline_messages',auth[_0x325a('0x6')](),controller[_0x325a('0x1a')]);router[_0x325a('0x5')](_0x325a('0x1b'),auth[_0x325a('0x6')](),controller['getAgents']);router[_0x325a('0x1c')]('/',auth[_0x325a('0x6')](),controller[_0x325a('0x1d')]);router['post']('/:id/dispositions',auth[_0x325a('0x6')](),controller[_0x325a('0x1e')]);router['post']('/:id/canned_answers',auth[_0x325a('0x6')](),controller[_0x325a('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x129165,_0x24157a,_0x3c36d9){_0x3c36d9(null,path[_0x325a('0x20')](config[_0x325a('0x21')],_0x325a('0x22')));},'filename':function(_0xec05ea,_0x349903,_0x2b52c9){_0x2b52c9(null,util[_0x325a('0x23')](_0x325a('0x24'),Date[_0x325a('0x25')](),_0x349903[_0x325a('0x26')]));}})});router['post'](_0x325a('0x27'),upload[_0x325a('0x28')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x325a('0x29')]({'destination':function(_0x20636b,_0x100914,_0x2ce060){_0x2ce060(null,path[_0x325a('0x20')](config[_0x325a('0x21')],_0x325a('0x2a')));},'filename':function(_0x40a878,_0x47f151,_0x40a943){_0x40a943(null,util[_0x325a('0x23')]('%s-%s',Date[_0x325a('0x25')](),_0x47f151[_0x325a('0x26')]));}})});router['post'](_0x325a('0xe'),upload[_0x325a('0x28')](_0x325a('0x2b')),controller[_0x325a('0x2c')]);var upload=multer({'storage':multer[_0x325a('0x29')]({'destination':function(_0x2ea7d2,_0x17984d,_0x59c007){_0x59c007(null,path[_0x325a('0x20')](config[_0x325a('0x21')],_0x325a('0x2a')));},'filename':function(_0x458516,_0x2c52e0,_0x300c40){_0x300c40(null,util['format'](_0x325a('0x24'),Date[_0x325a('0x25')](),_0x2c52e0[_0x325a('0x26')]));}})});router[_0x325a('0x1c')](_0x325a('0x2d'),upload['single'](_0x325a('0x2b')),controller[_0x325a('0x2e')]);var upload=multer({'storage':multer[_0x325a('0x29')]({'destination':function(_0x3e0b74,_0x4f6730,_0xb17590){_0xb17590(null,path[_0x325a('0x20')](config[_0x325a('0x21')],_0x325a('0x2a')));},'filename':function(_0x54f428,_0x28e0c0,_0x4c0cce){_0x4c0cce(null,util['format'](_0x325a('0x24'),Date[_0x325a('0x25')](),_0x28e0c0[_0x325a('0x26')]));}})});router['post']('/:id/system_avatar',upload['single'](_0x325a('0x2b')),controller['addSystemAvatar']);router['post']('/:id/notify',controller[_0x325a('0x2f')]);router['post']('/:id/offline',controller[_0x325a('0x30')]);router[_0x325a('0x1c')](_0x325a('0x12'),auth[_0x325a('0x6')](),controller['addInteraction']);router['post'](_0x325a('0x15'),auth[_0x325a('0x6')](),controller[_0x325a('0x31')]);router[_0x325a('0x1c')](_0x325a('0x17'),auth[_0x325a('0x6')](),controller[_0x325a('0x32')]);router['post'](_0x325a('0x1b'),auth[_0x325a('0x6')](),controller['addAgents']);router[_0x325a('0x33')](_0x325a('0x34'),auth['isAuthenticated'](),controller['update']);router[_0x325a('0x35')]('/:id',auth[_0x325a('0x6')](),controller[_0x325a('0x36')]);router[_0x325a('0x35')](_0x325a('0xa'),auth['isAuthenticated'](),controller[_0x325a('0x37')]);router['delete']('/:id/canned_answers',auth[_0x325a('0x6')](),controller['removeAnswers']);router[_0x325a('0x35')](_0x325a('0x1b'),auth[_0x325a('0x6')](),controller[_0x325a('0x38')]);module[_0x325a('0x39')]=router; \ No newline at end of file +var _0xdb18=['update','/:id','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','/describe','isAuthenticated','show','getDispositions','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','post','/:id/dispositions','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','now','originalname','/:id/logo','single','file','addLogo','server/files/images/avatars/','%s-%s','addAvatar','addCustomerAvatar','/:id/notify','notify','offline','addInteraction','/:id/applications','addProactiveActions','/:id/users','addAgents','put'];(function(_0x4fc80b,_0xfe1b3d){var _0x119dba=function(_0x16ed12){while(--_0x16ed12){_0x4fc80b['push'](_0x4fc80b['shift']());}};_0x119dba(++_0xfe1b3d);}(_0xdb18,0xd3));var _0x8db1=function(_0x184926,_0x17bfe8){_0x184926=_0x184926-0x0;var _0x374036=_0xdb18[_0x184926];return _0x374036;};'use strict';var multer=require(_0x8db1('0x0'));var util=require(_0x8db1('0x1'));var path=require(_0x8db1('0x2'));var timeout=require(_0x8db1('0x3'));var express=require(_0x8db1('0x4'));var router=express[_0x8db1('0x5')]();var auth=require(_0x8db1('0x6'));var interaction=require(_0x8db1('0x7'));var config=require(_0x8db1('0x8'));var controller=require(_0x8db1('0x9'));router[_0x8db1('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8db1('0xa')](_0x8db1('0xb'),auth[_0x8db1('0xc')](),controller['describe']);router['get']('/:id',auth[_0x8db1('0xc')](),controller[_0x8db1('0xd')]);router[_0x8db1('0xa')]('/:id/dispositions',auth[_0x8db1('0xc')](),controller[_0x8db1('0xe')]);router[_0x8db1('0xa')]('/:id/canned_answers',auth[_0x8db1('0xc')](),controller[_0x8db1('0xf')]);router[_0x8db1('0xa')]('/:id/logo',controller[_0x8db1('0x10')]);router[_0x8db1('0xa')](_0x8db1('0x11'),controller[_0x8db1('0x12')]);router[_0x8db1('0xa')](_0x8db1('0x13'),controller[_0x8db1('0x14')]);router[_0x8db1('0xa')](_0x8db1('0x15'),controller[_0x8db1('0x16')]);router['get'](_0x8db1('0x17'),auth[_0x8db1('0xc')](),controller[_0x8db1('0x18')]);router[_0x8db1('0xa')](_0x8db1('0x19'),controller[_0x8db1('0x1a')]);router['get']('/:id/applications',auth[_0x8db1('0xc')](),controller[_0x8db1('0x1b')]);router[_0x8db1('0xa')](_0x8db1('0x1c'),auth[_0x8db1('0xc')](),controller[_0x8db1('0x1d')]);router[_0x8db1('0xa')](_0x8db1('0x1e'),controller[_0x8db1('0x1f')]);router['get']('/:id/offline_messages',auth['isAuthenticated'](),controller[_0x8db1('0x20')]);router[_0x8db1('0xa')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x8db1('0x21')]('/',auth[_0x8db1('0xc')](),controller['create']);router['post'](_0x8db1('0x22'),auth[_0x8db1('0xc')](),controller['addDisposition']);router[_0x8db1('0x21')](_0x8db1('0x23'),auth[_0x8db1('0xc')](),controller[_0x8db1('0x24')]);var upload=multer({'storage':multer[_0x8db1('0x25')]({'destination':function(_0x3bc701,_0x340959,_0xf978a7){_0xf978a7(null,path[_0x8db1('0x26')](config[_0x8db1('0x27')],_0x8db1('0x28')));},'filename':function(_0x579c02,_0x48f8cf,_0x1863f6){_0x1863f6(null,util[_0x8db1('0x29')]('%s-%s',Date[_0x8db1('0x2a')](),_0x48f8cf[_0x8db1('0x2b')]));}})});router[_0x8db1('0x21')](_0x8db1('0x2c'),upload[_0x8db1('0x2d')](_0x8db1('0x2e')),controller[_0x8db1('0x2f')]);var upload=multer({'storage':multer[_0x8db1('0x25')]({'destination':function(_0xc32f62,_0x218d39,_0x2dc985){_0x2dc985(null,path[_0x8db1('0x26')](config[_0x8db1('0x27')],_0x8db1('0x30')));},'filename':function(_0x18f740,_0x3c57bc,_0x2db2f9){_0x2db2f9(null,util[_0x8db1('0x29')](_0x8db1('0x31'),Date[_0x8db1('0x2a')](),_0x3c57bc[_0x8db1('0x2b')]));}})});router[_0x8db1('0x21')](_0x8db1('0x11'),upload['single'](_0x8db1('0x2e')),controller[_0x8db1('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xdda0a4,_0x338d20,_0x736c43){_0x736c43(null,path[_0x8db1('0x26')](config['root'],_0x8db1('0x30')));},'filename':function(_0x426f3d,_0x3bad92,_0x4d3331){_0x4d3331(null,util['format'](_0x8db1('0x31'),Date[_0x8db1('0x2a')](),_0x3bad92[_0x8db1('0x2b')]));}})});router[_0x8db1('0x21')]('/:id/customer_avatar',upload[_0x8db1('0x2d')]('file'),controller[_0x8db1('0x33')]);var upload=multer({'storage':multer[_0x8db1('0x25')]({'destination':function(_0x22db2e,_0x569d30,_0x5d01bc){_0x5d01bc(null,path[_0x8db1('0x26')](config['root'],_0x8db1('0x30')));},'filename':function(_0x5afddb,_0x5ea82d,_0x3ad757){_0x3ad757(null,util[_0x8db1('0x29')](_0x8db1('0x31'),Date['now'](),_0x5ea82d[_0x8db1('0x2b')]));}})});router[_0x8db1('0x21')](_0x8db1('0x15'),upload['single'](_0x8db1('0x2e')),controller['addSystemAvatar']);router[_0x8db1('0x21')](_0x8db1('0x34'),controller[_0x8db1('0x35')]);router['post']('/:id/offline',controller[_0x8db1('0x36')]);router[_0x8db1('0x21')]('/:id/interactions',auth[_0x8db1('0xc')](),controller[_0x8db1('0x37')]);router[_0x8db1('0x21')](_0x8db1('0x38'),auth['isAuthenticated'](),controller['addApplications']);router[_0x8db1('0x21')](_0x8db1('0x1c'),auth[_0x8db1('0xc')](),controller[_0x8db1('0x39')]);router[_0x8db1('0x21')](_0x8db1('0x3a'),auth['isAuthenticated'](),controller[_0x8db1('0x3b')]);router[_0x8db1('0x3c')]('/:id',auth[_0x8db1('0xc')](),controller[_0x8db1('0x3d')]);router['delete'](_0x8db1('0x3e'),auth['isAuthenticated'](),controller[_0x8db1('0x3f')]);router[_0x8db1('0x40')](_0x8db1('0x22'),auth[_0x8db1('0xc')](),controller[_0x8db1('0x41')]);router[_0x8db1('0x40')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x8db1('0x42')]);router[_0x8db1('0x40')](_0x8db1('0x3a'),auth[_0x8db1('0xc')](),controller['removeAgents']);module[_0x8db1('0x43')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index b326ec3..b642bdc 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 _0x8458=['Google','sequelize','STRING','ENUM','AmazonAWS'];(function(_0x410fe2,_0x504b75){var _0x4a5c07=function(_0x3cbc7c){while(--_0x3cbc7c){_0x410fe2['push'](_0x410fe2['shift']());}};_0x4a5c07(++_0x504b75);}(_0x8458,0x1a5));var _0x8845=function(_0x1dbdfd,_0x53dee4){_0x1dbdfd=_0x1dbdfd-0x0;var _0x3f8755=_0x8458[_0x1dbdfd];return _0x3f8755;};'use strict';var Sequelize=require(_0x8845('0x0'));module['exports']={'name':{'type':Sequelize[_0x8845('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x8845('0x2')](_0x8845('0x3'),_0x8845('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x8845('0x1')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7a3e=['exports','STRING','AmazonAWS','Google','sequelize'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x7a3e,0x18a));var _0xe7a3=function(_0x5e7a15,_0x17400f){_0x5e7a15=_0x5e7a15-0x0;var _0x1900a8=_0x7a3e[_0x5e7a15];return _0x1900a8;};'use strict';var Sequelize=require(_0xe7a3('0x0'));module[_0xe7a3('0x1')]={'name':{'type':Sequelize[_0xe7a3('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xe7a3('0x3'),_0xe7a3('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 14b568e..e54f5e8 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 _0x6eeb=['include','options','find','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','error','stack','name','send','index','CloudProvider','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','then','rows','catch','show'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x6eeb,0x178));var _0xb6ee=function(_0x179b74,_0x5dc97d){_0x179b74=_0x179b74-0x0;var _0x268f76=_0x6eeb[_0x179b74];return _0x268f76;};'use strict';var pdf=require(_0xb6ee('0x0'));var emlformat=require(_0xb6ee('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb6ee('0x2'));var jsonpatch=require(_0xb6ee('0x3'));var rp=require(_0xb6ee('0x4'));var moment=require(_0xb6ee('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb6ee('0x6'));var util=require(_0xb6ee('0x7'));var path=require(_0xb6ee('0x8'));var sox=require(_0xb6ee('0x9'));var csv=require(_0xb6ee('0xa'));var ejs=require(_0xb6ee('0xb'));var fs=require('fs');var _=require(_0xb6ee('0xc'));var squel=require(_0xb6ee('0xd'));var crypto=require('crypto');var jsforce=require(_0xb6ee('0xe'));var deskjs=require(_0xb6ee('0xf'));var toCsv=require(_0xb6ee('0xa'));var querystring=require(_0xb6ee('0x10'));var Papa=require(_0xb6ee('0x11'));var Redis=require(_0xb6ee('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb6ee('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb6ee('0x14'));var utils=require(_0xb6ee('0x15'));var config=require(_0xb6ee('0x16'));var db=require(_0xb6ee('0x17'))['db'];function respondWithStatusCode(_0x4b35ca,_0x350573){_0x350573=_0x350573||0xcc;return function(_0x2b5f38){if(_0x2b5f38){return _0x4b35ca[_0xb6ee('0x18')](_0x350573);}return _0x4b35ca['status'](_0x350573)[_0xb6ee('0x19')]();};}function respondWithResult(_0x4208b4,_0x4fcfe8){_0x4fcfe8=_0x4fcfe8||0xc8;return function(_0x21b5eb){if(_0x21b5eb){return _0x4208b4[_0xb6ee('0x1a')](_0x4fcfe8)[_0xb6ee('0x1b')](_0x21b5eb);}};}function respondWithFilteredResult(_0x3b28e2,_0x189093){return function(_0x75fd4){if(_0x75fd4){var _0x3e8373=_0x75fd4[_0xb6ee('0x1c')],_0x348897=_0x189093[_0xb6ee('0x1d')],_0x234a0e=_0x189093[_0xb6ee('0x1d')]+_0x189093[_0xb6ee('0x1e')],_0x5e6332;if(_0x234a0e>=_0x3e8373){_0x234a0e=_0x3e8373;_0x5e6332=0xc8;}else{_0x5e6332=0xce;}_0x3b28e2[_0xb6ee('0x1a')](_0x5e6332);return _0x3b28e2[_0xb6ee('0x1f')](_0xb6ee('0x20'),_0x348897+'-'+_0x234a0e+'/'+_0x3e8373)[_0xb6ee('0x1b')](_0x75fd4);}return null;};}function patchUpdates(_0x517c0c){return function(_0xd3a74d){try{jsonpatch[_0xb6ee('0x21')](_0xd3a74d,_0x517c0c,!![]);}catch(_0x2f8e97){return BPromise['reject'](_0x2f8e97);}return _0xd3a74d[_0xb6ee('0x22')]();};}function saveUpdates(_0x2ea61b,_0x4b06c3){return function(_0x3039df){if(_0x3039df){return _0x3039df[_0xb6ee('0x23')](_0x2ea61b)['then'](function(_0x543e83){return _0x543e83;});}return null;};}function removeEntity(_0x23d700,_0x573c96){return function(_0x469c22){if(_0x469c22){return _0x469c22[_0xb6ee('0x24')]()['then'](function(){_0x23d700[_0xb6ee('0x1a')](0xcc)[_0xb6ee('0x19')]();});}};}function handleEntityNotFound(_0x42b868,_0x2dfd7c){return function(_0x5ae979){if(!_0x5ae979){_0x42b868[_0xb6ee('0x18')](0x194);}return _0x5ae979;};}function handleError(_0x99baa3,_0x49314c){_0x49314c=_0x49314c||0x1f4;return function(_0x28a2ac){logger[_0xb6ee('0x25')](_0x28a2ac[_0xb6ee('0x26')]);if(_0x28a2ac[_0xb6ee('0x27')]){delete _0x28a2ac['name'];}_0x99baa3['status'](_0x49314c)[_0xb6ee('0x28')](_0x28a2ac);};}exports[_0xb6ee('0x29')]=function(_0x3f55a2,_0x38a959){var _0x4ec4ce={},_0x5d2ba2={},_0x5d231e={'count':0x0,'rows':[]};var _0x377bce=_['map'](db[_0xb6ee('0x2a')][_0xb6ee('0x2b')],function(_0x17818f){return{'name':_0x17818f[_0xb6ee('0x2c')],'type':_0x17818f[_0xb6ee('0x2d')][_0xb6ee('0x2e')]};});_0x5d2ba2[_0xb6ee('0x2f')]=_[_0xb6ee('0x30')](_0x377bce,_0xb6ee('0x27'));_0x5d2ba2[_0xb6ee('0x31')]=_[_0xb6ee('0x32')](_0x3f55a2[_0xb6ee('0x31')]);_0x5d2ba2['filters']=_[_0xb6ee('0x33')](_0x5d2ba2['model'],_0x5d2ba2['query']);_0x4ec4ce[_0xb6ee('0x34')]=_[_0xb6ee('0x33')](_0x5d2ba2['model'],qs[_0xb6ee('0x35')](_0x3f55a2['query'][_0xb6ee('0x35')]));_0x4ec4ce[_0xb6ee('0x34')]=_0x4ec4ce[_0xb6ee('0x34')][_0xb6ee('0x36')]?_0x4ec4ce[_0xb6ee('0x34')]:_0x5d2ba2[_0xb6ee('0x2f')];if(!_0x3f55a2[_0xb6ee('0x31')][_0xb6ee('0x37')](_0xb6ee('0x38'))){_0x4ec4ce[_0xb6ee('0x1e')]=qs[_0xb6ee('0x1e')](_0x3f55a2[_0xb6ee('0x31')][_0xb6ee('0x1e')]);_0x4ec4ce[_0xb6ee('0x1d')]=qs[_0xb6ee('0x1d')](_0x3f55a2[_0xb6ee('0x31')][_0xb6ee('0x1d')]);}_0x4ec4ce['order']=qs[_0xb6ee('0x39')](_0x3f55a2[_0xb6ee('0x31')][_0xb6ee('0x39')]);_0x4ec4ce[_0xb6ee('0x3a')]=qs['filters'](_[_0xb6ee('0x3b')](_0x3f55a2[_0xb6ee('0x31')],_0x5d2ba2['filters']),_0x377bce);if(_0x3f55a2[_0xb6ee('0x31')][_0xb6ee('0x3c')]){_0x4ec4ce[_0xb6ee('0x3a')]=_['merge'](_0x4ec4ce[_0xb6ee('0x3a')],{'$or':_[_0xb6ee('0x30')](_0x377bce,function(_0x1cf0f1){if(_0x1cf0f1[_0xb6ee('0x2d')]!==_0xb6ee('0x3d')){var _0x55b624={};_0x55b624[_0x1cf0f1[_0xb6ee('0x27')]]={'$like':'%'+_0x3f55a2[_0xb6ee('0x31')][_0xb6ee('0x3c')]+'%'};return _0x55b624;}})});}_0x4ec4ce=_[_0xb6ee('0x3e')]({},_0x4ec4ce,_0x3f55a2['options']);var _0x278e2b={'where':_0x4ec4ce[_0xb6ee('0x3a')]};return db[_0xb6ee('0x2a')][_0xb6ee('0x1c')](_0x278e2b)['then'](function(_0x1e6e12){_0x5d231e[_0xb6ee('0x1c')]=_0x1e6e12;if(_0x3f55a2['query'][_0xb6ee('0x3f')]){_0x4ec4ce['include']=[{'all':!![]}];}return db[_0xb6ee('0x2a')]['findAll'](_0x4ec4ce);})[_0xb6ee('0x40')](function(_0x2ba9fd){_0x5d231e[_0xb6ee('0x41')]=_0x2ba9fd;return _0x5d231e;})[_0xb6ee('0x40')](respondWithFilteredResult(_0x38a959,_0x4ec4ce))[_0xb6ee('0x42')](handleError(_0x38a959,null));};exports[_0xb6ee('0x43')]=function(_0x3eb566,_0x377880){var _0x2199db={'raw':!![],'where':{'id':_0x3eb566['params']['id']}},_0x266a63={};_0x266a63[_0xb6ee('0x2f')]=_['keys'](db[_0xb6ee('0x2a')][_0xb6ee('0x2b')]);_0x266a63[_0xb6ee('0x31')]=_[_0xb6ee('0x32')](_0x3eb566['query']);_0x266a63['filters']=_[_0xb6ee('0x33')](_0x266a63[_0xb6ee('0x2f')],_0x266a63[_0xb6ee('0x31')]);_0x2199db[_0xb6ee('0x34')]=_['intersection'](_0x266a63['model'],qs[_0xb6ee('0x35')](_0x3eb566['query'][_0xb6ee('0x35')]));_0x2199db[_0xb6ee('0x34')]=_0x2199db[_0xb6ee('0x34')]['length']?_0x2199db[_0xb6ee('0x34')]:_0x266a63[_0xb6ee('0x2f')];if(_0x3eb566[_0xb6ee('0x31')]['includeAll']){_0x2199db[_0xb6ee('0x44')]=[{'all':!![]}];}_0x2199db=_['merge']({},_0x2199db,_0x3eb566[_0xb6ee('0x45')]);return db[_0xb6ee('0x2a')][_0xb6ee('0x46')](_0x2199db)[_0xb6ee('0x40')](handleEntityNotFound(_0x377880,null))[_0xb6ee('0x40')](respondWithResult(_0x377880,null))[_0xb6ee('0x42')](handleError(_0x377880,null));};exports[_0xb6ee('0x47')]=function(_0x198618,_0x24bdb8){return db[_0xb6ee('0x2a')][_0xb6ee('0x47')](_0x198618['body'],{})[_0xb6ee('0x40')](respondWithResult(_0x24bdb8,0xc9))[_0xb6ee('0x42')](handleError(_0x24bdb8,null));};exports[_0xb6ee('0x23')]=function(_0x5becbe,_0x32f2ec){if(_0x5becbe['body']['id']){delete _0x5becbe[_0xb6ee('0x48')]['id'];}return db['CloudProvider'][_0xb6ee('0x46')]({'where':{'id':_0x5becbe[_0xb6ee('0x49')]['id']}})[_0xb6ee('0x40')](handleEntityNotFound(_0x32f2ec,null))[_0xb6ee('0x40')](saveUpdates(_0x5becbe[_0xb6ee('0x48')],null))['then'](respondWithResult(_0x32f2ec,null))[_0xb6ee('0x42')](handleError(_0x32f2ec,null));};exports[_0xb6ee('0x24')]=function(_0x34d757,_0x88947f){return db['CloudProvider'][_0xb6ee('0x46')]({'where':{'id':_0x34d757[_0xb6ee('0x49')]['id']}})[_0xb6ee('0x40')](handleEntityNotFound(_0x88947f,null))['then'](removeEntity(_0x88947f,null))['catch'](handleError(_0x88947f,null));}; \ No newline at end of file +var _0xc1e2=['../../mysqldb','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','CloudProvider','includeAll','findAll','catch','show','rawAttributes','include','find','create','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x2b8728,_0x172225){var _0x1336a7=function(_0xbff3a3){while(--_0xbff3a3){_0x2b8728['push'](_0x2b8728['shift']());}};_0x1336a7(++_0x172225);}(_0xc1e2,0x168));var _0x2c1e=function(_0x29e507,_0x1ce87d){_0x29e507=_0x29e507-0x0;var _0x2732e9=_0xc1e2[_0x29e507];return _0x2732e9;};'use strict';var pdf=require(_0x2c1e('0x0'));var emlformat=require(_0x2c1e('0x1'));var rimraf=require(_0x2c1e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2c1e('0x3'));var moment=require(_0x2c1e('0x4'));var BPromise=require(_0x2c1e('0x5'));var Mustache=require(_0x2c1e('0x6'));var util=require(_0x2c1e('0x7'));var path=require(_0x2c1e('0x8'));var sox=require(_0x2c1e('0x9'));var csv=require(_0x2c1e('0xa'));var ejs=require(_0x2c1e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2c1e('0xc'));var crypto=require(_0x2c1e('0xd'));var jsforce=require(_0x2c1e('0xe'));var deskjs=require(_0x2c1e('0xf'));var toCsv=require(_0x2c1e('0xa'));var querystring=require(_0x2c1e('0x10'));var Papa=require('papaparse');var Redis=require(_0x2c1e('0x11'));var authService=require(_0x2c1e('0x12'));var qs=require(_0x2c1e('0x13'));var as=require(_0x2c1e('0x14'));var hardwareService=require(_0x2c1e('0x15'));var logger=require('../../config/logger')(_0x2c1e('0x16'));var utils=require(_0x2c1e('0x17'));var config=require(_0x2c1e('0x18'));var db=require(_0x2c1e('0x19'))['db'];function respondWithStatusCode(_0xa10d90,_0x1e62c4){_0x1e62c4=_0x1e62c4||0xcc;return function(_0x4a1bd3){if(_0x4a1bd3){return _0xa10d90[_0x2c1e('0x1a')](_0x1e62c4);}return _0xa10d90[_0x2c1e('0x1b')](_0x1e62c4)[_0x2c1e('0x1c')]();};}function respondWithResult(_0x21e7c0,_0x5ce63f){_0x5ce63f=_0x5ce63f||0xc8;return function(_0x5560ff){if(_0x5560ff){return _0x21e7c0[_0x2c1e('0x1b')](_0x5ce63f)[_0x2c1e('0x1d')](_0x5560ff);}};}function respondWithFilteredResult(_0x3b8a06,_0x549c32){return function(_0x42aef0){if(_0x42aef0){var _0x578c8c=_0x42aef0[_0x2c1e('0x1e')],_0x2589f9=_0x549c32['offset'],_0x1e76ba=_0x549c32['offset']+_0x549c32[_0x2c1e('0x1f')],_0x37d0c7;if(_0x1e76ba>=_0x578c8c){_0x1e76ba=_0x578c8c;_0x37d0c7=0xc8;}else{_0x37d0c7=0xce;}_0x3b8a06[_0x2c1e('0x1b')](_0x37d0c7);return _0x3b8a06['set'](_0x2c1e('0x20'),_0x2589f9+'-'+_0x1e76ba+'/'+_0x578c8c)[_0x2c1e('0x1d')](_0x42aef0);}return null;};}function patchUpdates(_0x48b249){return function(_0x57896f){try{jsonpatch[_0x2c1e('0x21')](_0x57896f,_0x48b249,!![]);}catch(_0x4fb4ed){return BPromise[_0x2c1e('0x22')](_0x4fb4ed);}return _0x57896f[_0x2c1e('0x23')]();};}function saveUpdates(_0x2dddce,_0x149531){return function(_0x501b2f){if(_0x501b2f){return _0x501b2f[_0x2c1e('0x24')](_0x2dddce)[_0x2c1e('0x25')](function(_0x258fbd){return _0x258fbd;});}return null;};}function removeEntity(_0x409e1a,_0x59aa48){return function(_0x904104){if(_0x904104){return _0x904104[_0x2c1e('0x26')]()[_0x2c1e('0x25')](function(){_0x409e1a['status'](0xcc)[_0x2c1e('0x1c')]();});}};}function handleEntityNotFound(_0x178598,_0x12749f){return function(_0x4d5f0a){if(!_0x4d5f0a){_0x178598[_0x2c1e('0x1a')](0x194);}return _0x4d5f0a;};}function handleError(_0x5d5cc0,_0x528863){_0x528863=_0x528863||0x1f4;return function(_0x21d094){logger[_0x2c1e('0x27')](_0x21d094[_0x2c1e('0x28')]);if(_0x21d094[_0x2c1e('0x29')]){delete _0x21d094[_0x2c1e('0x29')];}_0x5d5cc0['status'](_0x528863)[_0x2c1e('0x2a')](_0x21d094);};}exports[_0x2c1e('0x2b')]=function(_0x1949e9,_0x106dff){var _0x4b1b59={},_0x40a3fd={},_0x3eca12={'count':0x0,'rows':[]};var _0x5f349b=_['map'](db['CloudProvider']['rawAttributes'],function(_0x2aaac3){return{'name':_0x2aaac3[_0x2c1e('0x2c')],'type':_0x2aaac3['type'][_0x2c1e('0x2d')]};});_0x40a3fd[_0x2c1e('0x2e')]=_['map'](_0x5f349b,_0x2c1e('0x29'));_0x40a3fd['query']=_[_0x2c1e('0x2f')](_0x1949e9['query']);_0x40a3fd[_0x2c1e('0x30')]=_[_0x2c1e('0x31')](_0x40a3fd[_0x2c1e('0x2e')],_0x40a3fd[_0x2c1e('0x32')]);_0x4b1b59['attributes']=_['intersection'](_0x40a3fd[_0x2c1e('0x2e')],qs['fields'](_0x1949e9[_0x2c1e('0x32')][_0x2c1e('0x33')]));_0x4b1b59[_0x2c1e('0x34')]=_0x4b1b59[_0x2c1e('0x34')][_0x2c1e('0x35')]?_0x4b1b59[_0x2c1e('0x34')]:_0x40a3fd['model'];if(!_0x1949e9[_0x2c1e('0x32')][_0x2c1e('0x36')](_0x2c1e('0x37'))){_0x4b1b59[_0x2c1e('0x1f')]=qs['limit'](_0x1949e9[_0x2c1e('0x32')][_0x2c1e('0x1f')]);_0x4b1b59[_0x2c1e('0x38')]=qs[_0x2c1e('0x38')](_0x1949e9['query'][_0x2c1e('0x38')]);}_0x4b1b59[_0x2c1e('0x39')]=qs[_0x2c1e('0x3a')](_0x1949e9[_0x2c1e('0x32')][_0x2c1e('0x3a')]);_0x4b1b59['where']=qs[_0x2c1e('0x30')](_[_0x2c1e('0x3b')](_0x1949e9['query'],_0x40a3fd[_0x2c1e('0x30')]),_0x5f349b);if(_0x1949e9[_0x2c1e('0x32')][_0x2c1e('0x3c')]){_0x4b1b59[_0x2c1e('0x3d')]=_[_0x2c1e('0x3e')](_0x4b1b59['where'],{'$or':_[_0x2c1e('0x3f')](_0x5f349b,function(_0x3c8670){if(_0x3c8670[_0x2c1e('0x40')]!==_0x2c1e('0x41')){var _0x3a0599={};_0x3a0599[_0x3c8670[_0x2c1e('0x29')]]={'$like':'%'+_0x1949e9[_0x2c1e('0x32')][_0x2c1e('0x3c')]+'%'};return _0x3a0599;}})});}_0x4b1b59=_[_0x2c1e('0x3e')]({},_0x4b1b59,_0x1949e9[_0x2c1e('0x42')]);var _0x16d0bf={'where':_0x4b1b59[_0x2c1e('0x3d')]};return db[_0x2c1e('0x43')]['count'](_0x16d0bf)[_0x2c1e('0x25')](function(_0x26c76c){_0x3eca12['count']=_0x26c76c;if(_0x1949e9[_0x2c1e('0x32')][_0x2c1e('0x44')]){_0x4b1b59['include']=[{'all':!![]}];}return db[_0x2c1e('0x43')][_0x2c1e('0x45')](_0x4b1b59);})[_0x2c1e('0x25')](function(_0x2ebd87){_0x3eca12['rows']=_0x2ebd87;return _0x3eca12;})[_0x2c1e('0x25')](respondWithFilteredResult(_0x106dff,_0x4b1b59))[_0x2c1e('0x46')](handleError(_0x106dff,null));};exports[_0x2c1e('0x47')]=function(_0x1dbe1e,_0x1a0fd5){var _0x15f957={'raw':!![],'where':{'id':_0x1dbe1e['params']['id']}},_0x1b9de2={};_0x1b9de2[_0x2c1e('0x2e')]=_[_0x2c1e('0x2f')](db[_0x2c1e('0x43')][_0x2c1e('0x48')]);_0x1b9de2['query']=_[_0x2c1e('0x2f')](_0x1dbe1e[_0x2c1e('0x32')]);_0x1b9de2['filters']=_[_0x2c1e('0x31')](_0x1b9de2[_0x2c1e('0x2e')],_0x1b9de2[_0x2c1e('0x32')]);_0x15f957[_0x2c1e('0x34')]=_['intersection'](_0x1b9de2['model'],qs[_0x2c1e('0x33')](_0x1dbe1e[_0x2c1e('0x32')]['fields']));_0x15f957['attributes']=_0x15f957[_0x2c1e('0x34')][_0x2c1e('0x35')]?_0x15f957[_0x2c1e('0x34')]:_0x1b9de2[_0x2c1e('0x2e')];if(_0x1dbe1e[_0x2c1e('0x32')][_0x2c1e('0x44')]){_0x15f957[_0x2c1e('0x49')]=[{'all':!![]}];}_0x15f957=_[_0x2c1e('0x3e')]({},_0x15f957,_0x1dbe1e[_0x2c1e('0x42')]);return db[_0x2c1e('0x43')][_0x2c1e('0x4a')](_0x15f957)[_0x2c1e('0x25')](handleEntityNotFound(_0x1a0fd5,null))[_0x2c1e('0x25')](respondWithResult(_0x1a0fd5,null))[_0x2c1e('0x46')](handleError(_0x1a0fd5,null));};exports[_0x2c1e('0x4b')]=function(_0x4dc9a0,_0x48a347){return db[_0x2c1e('0x43')][_0x2c1e('0x4b')](_0x4dc9a0[_0x2c1e('0x4c')],{})[_0x2c1e('0x25')](respondWithResult(_0x48a347,0xc9))['catch'](handleError(_0x48a347,null));};exports['update']=function(_0xb55c5a,_0x264acd){if(_0xb55c5a[_0x2c1e('0x4c')]['id']){delete _0xb55c5a[_0x2c1e('0x4c')]['id'];}return db[_0x2c1e('0x43')][_0x2c1e('0x4a')]({'where':{'id':_0xb55c5a['params']['id']}})[_0x2c1e('0x25')](handleEntityNotFound(_0x264acd,null))['then'](saveUpdates(_0xb55c5a[_0x2c1e('0x4c')],null))[_0x2c1e('0x25')](respondWithResult(_0x264acd,null))['catch'](handleError(_0x264acd,null));};exports['destroy']=function(_0x210ff3,_0x287938){return db[_0x2c1e('0x43')][_0x2c1e('0x4a')]({'where':{'id':_0x210ff3['params']['id']}})[_0x2c1e('0x25')](handleEntityNotFound(_0x287938,null))['then'](removeEntity(_0x287938,null))[_0x2c1e('0x46')](handleError(_0x287938,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index a5a77d7..ce2a61c 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 _0xcdc0=['lodash','util','../../config/logger','moment','request-promise','./cloudProvider.attributes','exports','define','CloudProvider'];(function(_0x510f3c,_0x558a31){var _0x3eccb7=function(_0x5c22be){while(--_0x5c22be){_0x510f3c['push'](_0x510f3c['shift']());}};_0x3eccb7(++_0x558a31);}(_0xcdc0,0xab));var _0x0cdc=function(_0x4ffc9f,_0x3deb91){_0x4ffc9f=_0x4ffc9f-0x0;var _0x203920=_0xcdc0[_0x4ffc9f];return _0x203920;};'use strict';var _=require(_0x0cdc('0x0'));var util=require(_0x0cdc('0x1'));var logger=require(_0x0cdc('0x2'))('api');var moment=require(_0x0cdc('0x3'));var BPromise=require('bluebird');var rp=require(_0x0cdc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0cdc('0x5'));module[_0x0cdc('0x6')]=function(_0x41b276,_0x2054c6){return _0x41b276[_0x0cdc('0x7')](_0x0cdc('0x8'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20cb=['bluebird','request-promise','path','rimraf','./cloudProvider.attributes','define','CloudProvider','cloud_providers','util','../../config/logger','moment'];(function(_0x5222d9,_0x12496d){var _0x16b0d5=function(_0x4220a6){while(--_0x4220a6){_0x5222d9['push'](_0x5222d9['shift']());}};_0x16b0d5(++_0x12496d);}(_0x20cb,0xce));var _0xb20c=function(_0x5e27f9,_0x453b18){_0x5e27f9=_0x5e27f9-0x0;var _0x347296=_0x20cb[_0x5e27f9];return _0x347296;};'use strict';var _=require('lodash');var util=require(_0xb20c('0x0'));var logger=require(_0xb20c('0x1'))('api');var moment=require(_0xb20c('0x2'));var BPromise=require(_0xb20c('0x3'));var rp=require(_0xb20c('0x4'));var fs=require('fs');var path=require(_0xb20c('0x5'));var rimraf=require(_0xb20c('0x6'));var config=require('../../config/environment');var attributes=require(_0xb20c('0x7'));module['exports']=function(_0x4f2b18,_0x4681f1){return _0x4f2b18[_0xb20c('0x8')](_0xb20c('0x9'),attributes,{'tableName':_0xb20c('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 c85e23f..2232c5c 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 _0x7720=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x367770,_0x17dd4d){var _0x1fa3b7=function(_0x205815){while(--_0x205815){_0x367770['push'](_0x367770['shift']());}};_0x1fa3b7(++_0x17dd4d);}(_0x7720,0xf5));var _0x0772=function(_0x5d9163,_0x35b4d1){_0x5d9163=_0x5d9163-0x0;var _0x169398=_0x7720[_0x5d9163];return _0x169398;};'use strict';var _=require(_0x0772('0x0'));var util=require(_0x0772('0x1'));var moment=require(_0x0772('0x2'));var BPromise=require(_0x0772('0x3'));var rs=require(_0x0772('0x4'));var fs=require('fs');var Redis=require(_0x0772('0x5'));var db=require(_0x0772('0x6'))['db'];var utils=require(_0x0772('0x7'));var logger=require(_0x0772('0x8'))(_0x0772('0x9'));var config=require(_0x0772('0xa'));var jayson=require(_0x0772('0xb'));var client=jayson[_0x0772('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a2cea,_0x5ce52a,_0x74775d){return new BPromise(function(_0xfd5153,_0xeb4df7){return client[_0x0772('0xd')](_0x5a2cea,_0x74775d)[_0x0772('0xe')](function(_0x339d6e){logger[_0x0772('0xf')](_0x0772('0x10'),_0x5ce52a,_0x0772('0x11'));logger[_0x0772('0x12')](_0x0772('0x13'),_0x5ce52a,_0x0772('0x11'),JSON[_0x0772('0x14')](_0x339d6e));if(_0x339d6e[_0x0772('0x15')]){if(_0x339d6e['error']['code']===0x1f4){logger[_0x0772('0x15')](_0x0772('0x10'),_0x5ce52a,_0x339d6e[_0x0772('0x15')][_0x0772('0x16')]);return _0xeb4df7(_0x339d6e[_0x0772('0x15')][_0x0772('0x16')]);}logger[_0x0772('0x15')](_0x0772('0x10'),_0x5ce52a,_0x339d6e['error'][_0x0772('0x16')]);return _0xfd5153(_0x339d6e['error']['message']);}else{logger[_0x0772('0xf')](_0x0772('0x10'),_0x5ce52a,_0x0772('0x11'));_0xfd5153(_0x339d6e['result'][_0x0772('0x16')]);}})['catch'](function(_0x35aad5){logger[_0x0772('0x15')](_0x0772('0x10'),_0x5ce52a,_0x35aad5);_0xeb4df7(_0x35aad5);});});} \ No newline at end of file +var _0x3956=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x575057,_0x14baf3){var _0x49dbc8=function(_0x23599a){while(--_0x23599a){_0x575057['push'](_0x575057['shift']());}};_0x49dbc8(++_0x14baf3);}(_0x3956,0x129));var _0x6395=function(_0x3fa296,_0x2bd315){_0x3fa296=_0x3fa296-0x0;var _0x10b19f=_0x3956[_0x3fa296];return _0x10b19f;};'use strict';var _=require(_0x6395('0x0'));var util=require(_0x6395('0x1'));var moment=require(_0x6395('0x2'));var BPromise=require(_0x6395('0x3'));var rs=require(_0x6395('0x4'));var fs=require('fs');var Redis=require(_0x6395('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6395('0x6'));var logger=require(_0x6395('0x7'))('rpc');var config=require(_0x6395('0x8'));var jayson=require(_0x6395('0x9'));var client=jayson[_0x6395('0xa')][_0x6395('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x304584,_0x3fa33b,_0x43238f){return new BPromise(function(_0x89883f,_0x2acdfe){return client[_0x6395('0xc')](_0x304584,_0x43238f)[_0x6395('0xd')](function(_0x3ffd40){logger[_0x6395('0xe')](_0x6395('0xf'),_0x3fa33b,_0x6395('0x10'));logger[_0x6395('0x11')](_0x6395('0x12'),_0x3fa33b,_0x6395('0x10'),JSON['stringify'](_0x3ffd40));if(_0x3ffd40[_0x6395('0x13')]){if(_0x3ffd40[_0x6395('0x13')][_0x6395('0x14')]===0x1f4){logger[_0x6395('0x13')](_0x6395('0xf'),_0x3fa33b,_0x3ffd40[_0x6395('0x13')]['message']);return _0x2acdfe(_0x3ffd40['error'][_0x6395('0x15')]);}logger[_0x6395('0x13')](_0x6395('0xf'),_0x3fa33b,_0x3ffd40[_0x6395('0x13')][_0x6395('0x15')]);return _0x89883f(_0x3ffd40[_0x6395('0x13')][_0x6395('0x15')]);}else{logger[_0x6395('0xe')]('CloudProvider,\x20%s,\x20%s',_0x3fa33b,'request\x20sent');_0x89883f(_0x3ffd40[_0x6395('0x16')][_0x6395('0x15')]);}})[_0x6395('0x17')](function(_0x33131a){logger[_0x6395('0x13')](_0x6395('0xf'),_0x3fa33b,_0x33131a);_0x2acdfe(_0x33131a);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 1825109..65e5b86 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 _0xf4e5=['post','isAuthenticated','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','show'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0xf4e5,0x124));var _0x5f4e=function(_0x204ae6,_0x2f9d10){_0x204ae6=_0x204ae6-0x0;var _0x44ad55=_0xf4e5[_0x204ae6];return _0x44ad55;};'use strict';var multer=require(_0x5f4e('0x0'));var util=require(_0x5f4e('0x1'));var path=require(_0x5f4e('0x2'));var timeout=require(_0x5f4e('0x3'));var express=require(_0x5f4e('0x4'));var router=express[_0x5f4e('0x5')]();var auth=require(_0x5f4e('0x6'));var interaction=require(_0x5f4e('0x7'));var config=require(_0x5f4e('0x8'));var controller=require(_0x5f4e('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5f4e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5f4e('0xb')]);router[_0x5f4e('0xc')]('/',auth[_0x5f4e('0xd')](),controller['create']);router[_0x5f4e('0xe')](_0x5f4e('0xf'),auth[_0x5f4e('0xd')](),controller['update']);router[_0x5f4e('0x10')](_0x5f4e('0xf'),auth[_0x5f4e('0xd')](),controller[_0x5f4e('0x11')]);module[_0x5f4e('0x12')]=router; \ No newline at end of file +var _0x8108=['../../config/environment','./cloudProvider.controller','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x106d51,_0x2eb27c){var _0x1924b9=function(_0x180c90){while(--_0x180c90){_0x106d51['push'](_0x106d51['shift']());}};_0x1924b9(++_0x2eb27c);}(_0x8108,0x173));var _0x8810=function(_0x25dfe3,_0x8699a8){_0x25dfe3=_0x25dfe3-0x0;var _0xa2ea8b=_0x8108[_0x25dfe3];return _0xa2ea8b;};'use strict';var multer=require(_0x8810('0x0'));var util=require(_0x8810('0x1'));var path=require(_0x8810('0x2'));var timeout=require(_0x8810('0x3'));var express=require(_0x8810('0x4'));var router=express['Router']();var auth=require(_0x8810('0x5'));var interaction=require(_0x8810('0x6'));var config=require(_0x8810('0x7'));var controller=require(_0x8810('0x8'));router['get']('/',auth[_0x8810('0x9')](),controller[_0x8810('0xa')]);router['get'](_0x8810('0xb'),auth[_0x8810('0x9')](),controller[_0x8810('0xc')]);router[_0x8810('0xd')]('/',auth[_0x8810('0x9')](),controller[_0x8810('0xe')]);router['put'](_0x8810('0xb'),auth[_0x8810('0x9')](),controller['update']);router[_0x8810('0xf')](_0x8810('0xb'),auth[_0x8810('0x9')](),controller[_0x8810('0x10')]);module[_0x8810('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 271e9e9..43bdfd8 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 _0x476a=['exports','STRING','sequelize'];(function(_0x537241,_0x115661){var _0x363222=function(_0x2b40ce){while(--_0x2b40ce){_0x537241['push'](_0x537241['shift']());}};_0x363222(++_0x115661);}(_0x476a,0x86));var _0xa476=function(_0x2f5943,_0xba490b){_0x2f5943=_0x2f5943-0x0;var _0x465b7b=_0x476a[_0x2f5943];return _0x465b7b;};'use strict';var Sequelize=require(_0xa476('0x0'));module[_0xa476('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa476('0x2')]},'fax':{'type':Sequelize[_0xa476('0x2')]},'type':{'type':Sequelize[_0xa476('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xa476('0x2')]},'country':{'type':Sequelize[_0xa476('0x2')]},'email':{'type':Sequelize[_0xa476('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xa476('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xa476('0x2')]},'sCountry':{'type':Sequelize[_0xa476('0x2')]},'description':{'type':Sequelize[_0xa476('0x2')]}}; \ No newline at end of file +var _0x0798=['STRING','name','sequelize','exports'];(function(_0x19c799,_0x10edc9){var _0x4ddc81=function(_0x238e35){while(--_0x238e35){_0x19c799['push'](_0x19c799['shift']());}};_0x4ddc81(++_0x10edc9);}(_0x0798,0xda));var _0x8079=function(_0x3a5630,_0x275649){_0x3a5630=_0x3a5630-0x0;var _0x5053dd=_0x0798[_0x3a5630];return _0x5053dd;};'use strict';var Sequelize=require(_0x8079('0x0'));module[_0x8079('0x1')]={'name':{'type':Sequelize[_0x8079('0x2')],'unique':_0x8079('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x8079('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x8079('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x8079('0x2')]},'country':{'type':Sequelize[_0x8079('0x2')]},'email':{'type':Sequelize[_0x8079('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8079('0x2')]},'sStreet':{'type':Sequelize[_0x8079('0x2')]},'sPostalCode':{'type':Sequelize[_0x8079('0x2')]},'sCity':{'type':Sequelize[_0x8079('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8079('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 1265c18..e048ed0 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 _0xf243=['UserProfileSection','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','CmContact','addContacts','ids','findOne','sort','getContacts','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','CmCompany','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','map','options','includeAll','include','findAll','show','params','rawAttributes','find','create','body','get','Companies'];(function(_0x1c8bb1,_0x5621e8){var _0x1f5c9f=function(_0x2293ad){while(--_0x2293ad){_0x1c8bb1['push'](_0x1c8bb1['shift']());}};_0x1f5c9f(++_0x5621e8);}(_0xf243,0xf9));var _0x3f24=function(_0x3fd737,_0x263d58){_0x3fd737=_0x3fd737-0x0;var _0x4b9e85=_0xf243[_0x3fd737];return _0x4b9e85;};'use strict';var pdf=require(_0x3f24('0x0'));var emlformat=require(_0x3f24('0x1'));var rimraf=require(_0x3f24('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f24('0x3'));var rp=require('request-promise');var moment=require(_0x3f24('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3f24('0x5'));var util=require('util');var path=require(_0x3f24('0x6'));var sox=require(_0x3f24('0x7'));var csv=require(_0x3f24('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3f24('0x9'));var squel=require('squel');var crypto=require(_0x3f24('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3f24('0xb'));var toCsv=require(_0x3f24('0x8'));var querystring=require(_0x3f24('0xc'));var Papa=require(_0x3f24('0xd'));var Redis=require(_0x3f24('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3f24('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3f24('0x10'));var config=require(_0x3f24('0x11'));var db=require(_0x3f24('0x12'))['db'];function respondWithStatusCode(_0x43d754,_0x3c5e54){_0x3c5e54=_0x3c5e54||0xcc;return function(_0x3697a5){if(_0x3697a5){return _0x43d754[_0x3f24('0x13')](_0x3c5e54);}return _0x43d754['status'](_0x3c5e54)[_0x3f24('0x14')]();};}function respondWithResult(_0x6bc8d1,_0x23f447){_0x23f447=_0x23f447||0xc8;return function(_0x59ea86){if(_0x59ea86){return _0x6bc8d1[_0x3f24('0x15')](_0x23f447)[_0x3f24('0x16')](_0x59ea86);}};}function respondWithFilteredResult(_0x2b31f3,_0x22123a){return function(_0x423df4){if(_0x423df4){var _0x83ffd6=_0x423df4[_0x3f24('0x17')],_0x46c321=_0x22123a[_0x3f24('0x18')],_0x121667=_0x22123a['offset']+_0x22123a[_0x3f24('0x19')],_0x5ef560;if(_0x121667>=_0x83ffd6){_0x121667=_0x83ffd6;_0x5ef560=0xc8;}else{_0x5ef560=0xce;}_0x2b31f3[_0x3f24('0x15')](_0x5ef560);return _0x2b31f3[_0x3f24('0x1a')](_0x3f24('0x1b'),_0x46c321+'-'+_0x121667+'/'+_0x83ffd6)['json'](_0x423df4);}return null;};}function patchUpdates(_0x59a398){return function(_0x398301){try{jsonpatch[_0x3f24('0x1c')](_0x398301,_0x59a398,!![]);}catch(_0x2e4568){return BPromise[_0x3f24('0x1d')](_0x2e4568);}return _0x398301[_0x3f24('0x1e')]();};}function saveUpdates(_0x528753,_0x57aba8){return function(_0x168e6a){if(_0x168e6a){return _0x168e6a[_0x3f24('0x1f')](_0x528753)[_0x3f24('0x20')](function(_0x2b6d63){return _0x2b6d63;});}return null;};}function removeEntity(_0x20ea16,_0x47a349){return function(_0x11ba3f){if(_0x11ba3f){return _0x11ba3f[_0x3f24('0x21')]()[_0x3f24('0x20')](function(){var _0x2b21a9=_0x11ba3f['get']({'plain':!![]});var _0x18baff='Companies';return db['UserProfileResource'][_0x3f24('0x21')]({'where':{'type':_0x18baff,'resourceId':_0x2b21a9['id']}})['then'](function(){return _0x11ba3f;});})[_0x3f24('0x20')](function(){_0x20ea16['status'](0xcc)[_0x3f24('0x14')]();});}};}function handleEntityNotFound(_0x5c07c3,_0x37b94d){return function(_0x138a62){if(!_0x138a62){_0x5c07c3[_0x3f24('0x13')](0x194);}return _0x138a62;};}function handleError(_0x4937ff,_0x473be8){_0x473be8=_0x473be8||0x1f4;return function(_0x4316e3){logger[_0x3f24('0x22')](_0x4316e3[_0x3f24('0x23')]);if(_0x4316e3['name']){delete _0x4316e3[_0x3f24('0x24')];}_0x4937ff[_0x3f24('0x15')](_0x473be8)[_0x3f24('0x25')](_0x4316e3);};}exports['index']=function(_0x103fbd,_0x1883da){var _0x31368c={},_0x5dd299={},_0x2e2d34={'count':0x0,'rows':[]};return db[_0x3f24('0x26')]['describe']()['then'](function(_0x1041d0){_0x5dd299[_0x3f24('0x27')]=_[_0x3f24('0x28')](_0x1041d0);_0x5dd299[_0x3f24('0x29')]=_[_0x3f24('0x28')](_0x103fbd[_0x3f24('0x29')]);_0x5dd299[_0x3f24('0x2a')]=_[_0x3f24('0x2b')](_0x5dd299[_0x3f24('0x27')],_0x5dd299[_0x3f24('0x29')]);_0x31368c['attributes']=_[_0x3f24('0x2b')](_0x5dd299[_0x3f24('0x27')],qs[_0x3f24('0x2c')](_0x103fbd['query'][_0x3f24('0x2c')]));_0x31368c[_0x3f24('0x2d')]=_0x31368c[_0x3f24('0x2d')][_0x3f24('0x2e')]?_0x31368c['attributes']:_0x5dd299[_0x3f24('0x27')];if(!_0x103fbd['query'][_0x3f24('0x2f')](_0x3f24('0x30'))){_0x31368c[_0x3f24('0x19')]=qs[_0x3f24('0x19')](_0x103fbd[_0x3f24('0x29')]['limit']);_0x31368c[_0x3f24('0x18')]=qs['offset'](_0x103fbd[_0x3f24('0x29')][_0x3f24('0x18')]);}_0x31368c[_0x3f24('0x31')]=qs['sort'](_0x103fbd[_0x3f24('0x29')]['sort']);_0x31368c[_0x3f24('0x32')]=qs['filters'](_[_0x3f24('0x33')](_0x103fbd[_0x3f24('0x29')],_0x5dd299[_0x3f24('0x2a')]),_0x1041d0);if(_0x103fbd['query'][_0x3f24('0x34')]){_0x31368c['where']=_[_0x3f24('0x35')](_0x31368c[_0x3f24('0x32')],{'$or':_[_0x3f24('0x36')](_0x31368c[_0x3f24('0x2d')],function(_0x444d59){var _0x187620={};_0x187620[_0x444d59]={'$like':'%'+_0x103fbd[_0x3f24('0x29')][_0x3f24('0x34')]+'%'};return _0x187620;})});}_0x31368c=_[_0x3f24('0x35')]({},_0x31368c,_0x103fbd[_0x3f24('0x37')]);var _0x429c22={'where':_0x31368c[_0x3f24('0x32')]};return db[_0x3f24('0x26')]['count'](_0x429c22)[_0x3f24('0x20')](function(_0x2f2917){_0x2e2d34[_0x3f24('0x17')]=_0x2f2917;if(_0x103fbd[_0x3f24('0x29')][_0x3f24('0x38')]){_0x31368c[_0x3f24('0x39')]=[{'all':!![]}];}return db[_0x3f24('0x26')][_0x3f24('0x3a')](_0x31368c);})[_0x3f24('0x20')](function(_0xb96773){_0x2e2d34['rows']=_0xb96773;return _0x2e2d34;})[_0x3f24('0x20')](respondWithFilteredResult(_0x1883da,_0x31368c))['catch'](handleError(_0x1883da,null));})['catch'](handleError(_0x1883da,null));};exports[_0x3f24('0x3b')]=function(_0x3379d7,_0x3de92d){var _0x3b7bab={'raw':![],'where':{'id':_0x3379d7[_0x3f24('0x3c')]['id']}},_0x3ff7fe={};_0x3ff7fe[_0x3f24('0x27')]=_[_0x3f24('0x28')](db[_0x3f24('0x26')][_0x3f24('0x3d')]);_0x3ff7fe[_0x3f24('0x29')]=_[_0x3f24('0x28')](_0x3379d7[_0x3f24('0x29')]);_0x3ff7fe[_0x3f24('0x2a')]=_[_0x3f24('0x2b')](_0x3ff7fe[_0x3f24('0x27')],_0x3ff7fe[_0x3f24('0x29')]);_0x3b7bab[_0x3f24('0x2d')]=_[_0x3f24('0x2b')](_0x3ff7fe[_0x3f24('0x27')],qs[_0x3f24('0x2c')](_0x3379d7[_0x3f24('0x29')]['fields']));_0x3b7bab[_0x3f24('0x2d')]=_0x3b7bab[_0x3f24('0x2d')][_0x3f24('0x2e')]?_0x3b7bab['attributes']:_0x3ff7fe['model'];if(_0x3379d7[_0x3f24('0x29')][_0x3f24('0x38')]){_0x3b7bab[_0x3f24('0x39')]=[{'all':!![]}];}_0x3b7bab=_[_0x3f24('0x35')]({},_0x3b7bab,_0x3379d7[_0x3f24('0x37')]);return db[_0x3f24('0x26')][_0x3f24('0x3e')](_0x3b7bab)['then'](handleEntityNotFound(_0x3de92d,null))[_0x3f24('0x20')](respondWithResult(_0x3de92d,null))['catch'](handleError(_0x3de92d,null));};exports[_0x3f24('0x3f')]=function(_0x5f1d6f,_0x469665){return db[_0x3f24('0x26')][_0x3f24('0x3f')](_0x5f1d6f[_0x3f24('0x40')],{})[_0x3f24('0x20')](function(_0x877529){var _0x3e8ccd=_0x5f1d6f['user']['get']({'plain':!![]});if(!_0x3e8ccd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e8ccd['role']==='user'){var _0x7b7c83=_0x877529[_0x3f24('0x41')]({'plain':!![]});var _0x108771=_0x3f24('0x42');return db[_0x3f24('0x43')][_0x3f24('0x3e')]({'where':{'name':_0x108771,'userProfileId':_0x3e8ccd['userProfileId']},'raw':!![]})[_0x3f24('0x20')](function(_0x2d89ac){if(_0x2d89ac&&_0x2d89ac[_0x3f24('0x44')]===0x0){return db[_0x3f24('0x45')][_0x3f24('0x3f')]({'name':_0x7b7c83[_0x3f24('0x24')],'resourceId':_0x7b7c83['id'],'type':_0x2d89ac[_0x3f24('0x24')],'sectionId':_0x2d89ac['id']},{})[_0x3f24('0x20')](function(){return _0x877529;});}else{return _0x877529;}})[_0x3f24('0x46')](function(_0x21b600){logger[_0x3f24('0x22')](_0x3f24('0x47'),_0x21b600);throw _0x21b600;});}return _0x877529;})[_0x3f24('0x20')](respondWithResult(_0x469665,0xc9))['catch'](handleError(_0x469665,null));};exports[_0x3f24('0x1f')]=function(_0x2806d7,_0x48a366){if(_0x2806d7[_0x3f24('0x40')]['id']){delete _0x2806d7[_0x3f24('0x40')]['id'];}return db[_0x3f24('0x26')][_0x3f24('0x3e')]({'where':{'id':_0x2806d7[_0x3f24('0x3c')]['id']}})[_0x3f24('0x20')](handleEntityNotFound(_0x48a366,null))[_0x3f24('0x20')](saveUpdates(_0x2806d7[_0x3f24('0x40')],null))[_0x3f24('0x20')](respondWithResult(_0x48a366,null))[_0x3f24('0x46')](handleError(_0x48a366,null));};exports[_0x3f24('0x21')]=function(_0x40f967,_0x4fd77e){return db[_0x3f24('0x26')][_0x3f24('0x3e')]({'where':{'id':_0x40f967[_0x3f24('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4fd77e,null))[_0x3f24('0x20')](removeEntity(_0x4fd77e,null))[_0x3f24('0x46')](handleError(_0x4fd77e,null));};exports[_0x3f24('0x48')]=function(_0x3cdce5,_0x3a11ad){return db['CmCompany']['describe']()[_0x3f24('0x20')](respondWithResult(_0x3a11ad,null))[_0x3f24('0x46')](handleError(_0x3a11ad,null));};exports['addContacts']=function(_0x423183,_0x1f341f,_0x37f6de){return db[_0x3f24('0x49')]['find']({'where':{'id':_0x423183[_0x3f24('0x3c')]['id']}})[_0x3f24('0x20')](handleEntityNotFound(_0x1f341f,null))['then'](function(_0x93b9aa){if(_0x93b9aa){return _0x93b9aa[_0x3f24('0x4a')](_0x423183[_0x3f24('0x40')][_0x3f24('0x4b')],_['omit'](_0x423183['body'],[_0x3f24('0x4b'),'id'])||{});}})[_0x3f24('0x20')](respondWithResult(_0x1f341f,null))[_0x3f24('0x46')](handleError(_0x1f341f,null));};exports['getContacts']=function(_0x3e2bd2,_0x5be428,_0x5bf146){var _0x2a41fa={};var _0x331130={};var _0x591b30;var _0x51e2a2;return db[_0x3f24('0x26')][_0x3f24('0x4c')]({'where':{'id':_0x3e2bd2['params']['id']}})[_0x3f24('0x20')](handleEntityNotFound(_0x5be428,null))[_0x3f24('0x20')](function(_0x31e603){if(_0x31e603){_0x591b30=_0x31e603;_0x331130[_0x3f24('0x27')]=_[_0x3f24('0x28')](db[_0x3f24('0x49')][_0x3f24('0x3d')]);_0x331130[_0x3f24('0x29')]=_['keys'](_0x3e2bd2['query']);_0x331130[_0x3f24('0x2a')]=_['intersection'](_0x331130[_0x3f24('0x27')],_0x331130[_0x3f24('0x29')]);_0x2a41fa[_0x3f24('0x2d')]=_[_0x3f24('0x2b')](_0x331130[_0x3f24('0x27')],qs[_0x3f24('0x2c')](_0x3e2bd2['query'][_0x3f24('0x2c')]));_0x2a41fa['attributes']=_0x2a41fa[_0x3f24('0x2d')][_0x3f24('0x2e')]?_0x2a41fa['attributes']:_0x331130[_0x3f24('0x27')];_0x2a41fa[_0x3f24('0x31')]=qs[_0x3f24('0x4d')](_0x3e2bd2[_0x3f24('0x29')]['sort']);_0x2a41fa[_0x3f24('0x32')]=qs['filters'](_['pick'](_0x3e2bd2[_0x3f24('0x29')],_0x331130['filters']));if(_0x3e2bd2[_0x3f24('0x29')]['filter']){_0x2a41fa[_0x3f24('0x32')]=_[_0x3f24('0x35')](_0x2a41fa['where'],{'$or':_[_0x3f24('0x36')](_0x2a41fa[_0x3f24('0x2d')],function(_0x3019a0){var _0x55033d={};_0x55033d[_0x3019a0]={'$like':'%'+_0x3e2bd2[_0x3f24('0x29')][_0x3f24('0x34')]+'%'};return _0x55033d;})});}_0x2a41fa=_[_0x3f24('0x35')]({},_0x2a41fa,_0x3e2bd2[_0x3f24('0x37')]);return _0x591b30[_0x3f24('0x4e')](_0x2a41fa);}})[_0x3f24('0x20')](function(_0x3e17dc){if(_0x3e17dc){_0x51e2a2=_0x3e17dc[_0x3f24('0x2e')];if(!_0x3e2bd2[_0x3f24('0x29')][_0x3f24('0x2f')](_0x3f24('0x30'))){_0x2a41fa[_0x3f24('0x19')]=qs['limit'](_0x3e2bd2[_0x3f24('0x29')][_0x3f24('0x19')]);_0x2a41fa[_0x3f24('0x18')]=qs[_0x3f24('0x18')](_0x3e2bd2[_0x3f24('0x29')][_0x3f24('0x18')]);}return _0x591b30[_0x3f24('0x4e')](_0x2a41fa);}})['then'](function(_0x948d8a){if(_0x948d8a){return _0x948d8a?{'count':_0x51e2a2,'rows':_0x948d8a}:null;}})[_0x3f24('0x20')](respondWithResult(_0x5be428,null))[_0x3f24('0x46')](handleError(_0x5be428,null));}; \ No newline at end of file +var _0x5cbe=['nolimit','sort','where','filters','pick','filter','merge','map','CmCompany','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','addContacts','ids','getContacts','findOne','order','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','error','send','describe','keys','query','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x37c420,_0x38e92b){var _0x35b8ec=function(_0x4fe714){while(--_0x4fe714){_0x37c420['push'](_0x37c420['shift']());}};_0x35b8ec(++_0x38e92b);}(_0x5cbe,0xc9));var _0xe5cb=function(_0x103797,_0xea41e2){_0x103797=_0x103797-0x0;var _0x1a1a01=_0x5cbe[_0x103797];return _0x1a1a01;};'use strict';var pdf=require(_0xe5cb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe5cb('0x1'));var jsonpatch=require(_0xe5cb('0x2'));var rp=require(_0xe5cb('0x3'));var moment=require(_0xe5cb('0x4'));var BPromise=require(_0xe5cb('0x5'));var Mustache=require('mustache');var util=require(_0xe5cb('0x6'));var path=require(_0xe5cb('0x7'));var sox=require(_0xe5cb('0x8'));var csv=require(_0xe5cb('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe5cb('0xa'));var squel=require(_0xe5cb('0xb'));var crypto=require(_0xe5cb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe5cb('0xd'));var toCsv=require(_0xe5cb('0x9'));var querystring=require(_0xe5cb('0xe'));var Papa=require(_0xe5cb('0xf'));var Redis=require(_0xe5cb('0x10'));var authService=require(_0xe5cb('0x11'));var qs=require(_0xe5cb('0x12'));var as=require(_0xe5cb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe5cb('0x14'))(_0xe5cb('0x15'));var utils=require('../../config/utils');var config=require(_0xe5cb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ea067,_0x5057ca){_0x5057ca=_0x5057ca||0xcc;return function(_0x5d041d){if(_0x5d041d){return _0x5ea067[_0xe5cb('0x17')](_0x5057ca);}return _0x5ea067[_0xe5cb('0x18')](_0x5057ca)[_0xe5cb('0x19')]();};}function respondWithResult(_0x3f7b9c,_0x5d256e){_0x5d256e=_0x5d256e||0xc8;return function(_0xcb3478){if(_0xcb3478){return _0x3f7b9c[_0xe5cb('0x18')](_0x5d256e)[_0xe5cb('0x1a')](_0xcb3478);}};}function respondWithFilteredResult(_0x18b1b4,_0x2d776b){return function(_0x21e30e){if(_0x21e30e){var _0x3ac94f=_0x21e30e[_0xe5cb('0x1b')],_0x5701a6=_0x2d776b[_0xe5cb('0x1c')],_0x367a9f=_0x2d776b[_0xe5cb('0x1c')]+_0x2d776b[_0xe5cb('0x1d')],_0x36e047;if(_0x367a9f>=_0x3ac94f){_0x367a9f=_0x3ac94f;_0x36e047=0xc8;}else{_0x36e047=0xce;}_0x18b1b4[_0xe5cb('0x18')](_0x36e047);return _0x18b1b4['set'](_0xe5cb('0x1e'),_0x5701a6+'-'+_0x367a9f+'/'+_0x3ac94f)['json'](_0x21e30e);}return null;};}function patchUpdates(_0x326846){return function(_0x4b8a60){try{jsonpatch[_0xe5cb('0x1f')](_0x4b8a60,_0x326846,!![]);}catch(_0x5d8b0e){return BPromise['reject'](_0x5d8b0e);}return _0x4b8a60[_0xe5cb('0x20')]();};}function saveUpdates(_0x55afe8,_0x3c85c0){return function(_0x25e02f){if(_0x25e02f){return _0x25e02f[_0xe5cb('0x21')](_0x55afe8)[_0xe5cb('0x22')](function(_0x328a0e){return _0x328a0e;});}return null;};}function removeEntity(_0x186991,_0x141af0){return function(_0xefdc84){if(_0xefdc84){return _0xefdc84[_0xe5cb('0x23')]()[_0xe5cb('0x22')](function(){var _0x448ccd=_0xefdc84[_0xe5cb('0x24')]({'plain':!![]});var _0x1883c9='Companies';return db['UserProfileResource'][_0xe5cb('0x23')]({'where':{'type':_0x1883c9,'resourceId':_0x448ccd['id']}})[_0xe5cb('0x22')](function(){return _0xefdc84;});})[_0xe5cb('0x22')](function(){_0x186991['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc0a021,_0x365b07){return function(_0x379af3){if(!_0x379af3){_0xc0a021[_0xe5cb('0x17')](0x194);}return _0x379af3;};}function handleError(_0xc74ded,_0x11e0d8){_0x11e0d8=_0x11e0d8||0x1f4;return function(_0x28356b){logger[_0xe5cb('0x25')](_0x28356b['stack']);if(_0x28356b['name']){delete _0x28356b['name'];}_0xc74ded['status'](_0x11e0d8)[_0xe5cb('0x26')](_0x28356b);};}exports['index']=function(_0x2841e5,_0x20a46d){var _0x707f2b={},_0x3125d1={},_0x34c045={'count':0x0,'rows':[]};return db['CmCompany'][_0xe5cb('0x27')]()[_0xe5cb('0x22')](function(_0x595caa){_0x3125d1['model']=_[_0xe5cb('0x28')](_0x595caa);_0x3125d1['query']=_[_0xe5cb('0x28')](_0x2841e5[_0xe5cb('0x29')]);_0x3125d1['filters']=_[_0xe5cb('0x2a')](_0x3125d1[_0xe5cb('0x2b')],_0x3125d1[_0xe5cb('0x29')]);_0x707f2b[_0xe5cb('0x2c')]=_[_0xe5cb('0x2a')](_0x3125d1[_0xe5cb('0x2b')],qs[_0xe5cb('0x2d')](_0x2841e5['query'][_0xe5cb('0x2d')]));_0x707f2b[_0xe5cb('0x2c')]=_0x707f2b[_0xe5cb('0x2c')][_0xe5cb('0x2e')]?_0x707f2b[_0xe5cb('0x2c')]:_0x3125d1[_0xe5cb('0x2b')];if(!_0x2841e5['query'][_0xe5cb('0x2f')](_0xe5cb('0x30'))){_0x707f2b[_0xe5cb('0x1d')]=qs[_0xe5cb('0x1d')](_0x2841e5[_0xe5cb('0x29')][_0xe5cb('0x1d')]);_0x707f2b['offset']=qs['offset'](_0x2841e5[_0xe5cb('0x29')][_0xe5cb('0x1c')]);}_0x707f2b['order']=qs[_0xe5cb('0x31')](_0x2841e5[_0xe5cb('0x29')]['sort']);_0x707f2b[_0xe5cb('0x32')]=qs[_0xe5cb('0x33')](_[_0xe5cb('0x34')](_0x2841e5['query'],_0x3125d1['filters']),_0x595caa);if(_0x2841e5[_0xe5cb('0x29')][_0xe5cb('0x35')]){_0x707f2b['where']=_[_0xe5cb('0x36')](_0x707f2b[_0xe5cb('0x32')],{'$or':_[_0xe5cb('0x37')](_0x707f2b['attributes'],function(_0x1e77ed){var _0x21be15={};_0x21be15[_0x1e77ed]={'$like':'%'+_0x2841e5[_0xe5cb('0x29')][_0xe5cb('0x35')]+'%'};return _0x21be15;})});}_0x707f2b=_['merge']({},_0x707f2b,_0x2841e5['options']);var _0x528f1a={'where':_0x707f2b['where']};return db[_0xe5cb('0x38')][_0xe5cb('0x1b')](_0x528f1a)[_0xe5cb('0x22')](function(_0xb1b9e1){_0x34c045[_0xe5cb('0x1b')]=_0xb1b9e1;if(_0x2841e5[_0xe5cb('0x29')][_0xe5cb('0x39')]){_0x707f2b[_0xe5cb('0x3a')]=[{'all':!![]}];}return db[_0xe5cb('0x38')][_0xe5cb('0x3b')](_0x707f2b);})[_0xe5cb('0x22')](function(_0x39238c){_0x34c045[_0xe5cb('0x3c')]=_0x39238c;return _0x34c045;})[_0xe5cb('0x22')](respondWithFilteredResult(_0x20a46d,_0x707f2b))[_0xe5cb('0x3d')](handleError(_0x20a46d,null));})[_0xe5cb('0x3d')](handleError(_0x20a46d,null));};exports[_0xe5cb('0x3e')]=function(_0x595c33,_0x302494){var _0x33ac2e={'raw':![],'where':{'id':_0x595c33[_0xe5cb('0x3f')]['id']}},_0x43b72d={};_0x43b72d[_0xe5cb('0x2b')]=_['keys'](db[_0xe5cb('0x38')][_0xe5cb('0x40')]);_0x43b72d['query']=_[_0xe5cb('0x28')](_0x595c33['query']);_0x43b72d[_0xe5cb('0x33')]=_[_0xe5cb('0x2a')](_0x43b72d['model'],_0x43b72d['query']);_0x33ac2e[_0xe5cb('0x2c')]=_[_0xe5cb('0x2a')](_0x43b72d[_0xe5cb('0x2b')],qs[_0xe5cb('0x2d')](_0x595c33[_0xe5cb('0x29')][_0xe5cb('0x2d')]));_0x33ac2e[_0xe5cb('0x2c')]=_0x33ac2e[_0xe5cb('0x2c')][_0xe5cb('0x2e')]?_0x33ac2e[_0xe5cb('0x2c')]:_0x43b72d[_0xe5cb('0x2b')];if(_0x595c33['query'][_0xe5cb('0x39')]){_0x33ac2e[_0xe5cb('0x3a')]=[{'all':!![]}];}_0x33ac2e=_['merge']({},_0x33ac2e,_0x595c33[_0xe5cb('0x41')]);return db[_0xe5cb('0x38')][_0xe5cb('0x42')](_0x33ac2e)[_0xe5cb('0x22')](handleEntityNotFound(_0x302494,null))['then'](respondWithResult(_0x302494,null))[_0xe5cb('0x3d')](handleError(_0x302494,null));};exports[_0xe5cb('0x43')]=function(_0x5544b8,_0xf8f17c){return db[_0xe5cb('0x38')][_0xe5cb('0x43')](_0x5544b8[_0xe5cb('0x44')],{})[_0xe5cb('0x22')](function(_0x1e7fd4){var _0x501134=_0x5544b8[_0xe5cb('0x45')][_0xe5cb('0x24')]({'plain':!![]});if(!_0x501134)throw new Error(_0xe5cb('0x46'));if(_0x501134[_0xe5cb('0x47')]==='user'){var _0x1439aa=_0x1e7fd4[_0xe5cb('0x24')]({'plain':!![]});var _0x517e88=_0xe5cb('0x48');return db['UserProfileSection']['find']({'where':{'name':_0x517e88,'userProfileId':_0x501134[_0xe5cb('0x49')]},'raw':!![]})[_0xe5cb('0x22')](function(_0x49136d){if(_0x49136d&&_0x49136d[_0xe5cb('0x4a')]===0x0){return db['UserProfileResource'][_0xe5cb('0x43')]({'name':_0x1439aa[_0xe5cb('0x4b')],'resourceId':_0x1439aa['id'],'type':_0x49136d[_0xe5cb('0x4b')],'sectionId':_0x49136d['id']},{})['then'](function(){return _0x1e7fd4;});}else{return _0x1e7fd4;}})['catch'](function(_0x5b2912){logger['error'](_0xe5cb('0x4c'),_0x5b2912);throw _0x5b2912;});}return _0x1e7fd4;})[_0xe5cb('0x22')](respondWithResult(_0xf8f17c,0xc9))[_0xe5cb('0x3d')](handleError(_0xf8f17c,null));};exports[_0xe5cb('0x21')]=function(_0x4f5387,_0x557359){if(_0x4f5387[_0xe5cb('0x44')]['id']){delete _0x4f5387['body']['id'];}return db['CmCompany'][_0xe5cb('0x42')]({'where':{'id':_0x4f5387[_0xe5cb('0x3f')]['id']}})['then'](handleEntityNotFound(_0x557359,null))[_0xe5cb('0x22')](saveUpdates(_0x4f5387[_0xe5cb('0x44')],null))[_0xe5cb('0x22')](respondWithResult(_0x557359,null))[_0xe5cb('0x3d')](handleError(_0x557359,null));};exports['destroy']=function(_0x1bd05b,_0x128440){return db[_0xe5cb('0x38')]['find']({'where':{'id':_0x1bd05b[_0xe5cb('0x3f')]['id']}})[_0xe5cb('0x22')](handleEntityNotFound(_0x128440,null))[_0xe5cb('0x22')](removeEntity(_0x128440,null))[_0xe5cb('0x3d')](handleError(_0x128440,null));};exports['describe']=function(_0x530740,_0x1727de){return db[_0xe5cb('0x38')]['describe']()[_0xe5cb('0x22')](respondWithResult(_0x1727de,null))[_0xe5cb('0x3d')](handleError(_0x1727de,null));};exports['addContacts']=function(_0x2228f0,_0x20d7c2,_0x34f278){return db[_0xe5cb('0x4d')][_0xe5cb('0x42')]({'where':{'id':_0x2228f0[_0xe5cb('0x3f')]['id']}})[_0xe5cb('0x22')](handleEntityNotFound(_0x20d7c2,null))[_0xe5cb('0x22')](function(_0x2e6bc0){if(_0x2e6bc0){return _0x2e6bc0[_0xe5cb('0x4e')](_0x2228f0[_0xe5cb('0x44')][_0xe5cb('0x4f')],_['omit'](_0x2228f0[_0xe5cb('0x44')],[_0xe5cb('0x4f'),'id'])||{});}})[_0xe5cb('0x22')](respondWithResult(_0x20d7c2,null))['catch'](handleError(_0x20d7c2,null));};exports[_0xe5cb('0x50')]=function(_0x32684a,_0x1e65f6,_0x2b69c4){var _0x3a10d7={};var _0x1309ac={};var _0x42fe7b;var _0x10074a;return db[_0xe5cb('0x38')][_0xe5cb('0x51')]({'where':{'id':_0x32684a[_0xe5cb('0x3f')]['id']}})[_0xe5cb('0x22')](handleEntityNotFound(_0x1e65f6,null))[_0xe5cb('0x22')](function(_0x5c5995){if(_0x5c5995){_0x42fe7b=_0x5c5995;_0x1309ac['model']=_['keys'](db[_0xe5cb('0x4d')][_0xe5cb('0x40')]);_0x1309ac['query']=_[_0xe5cb('0x28')](_0x32684a[_0xe5cb('0x29')]);_0x1309ac['filters']=_['intersection'](_0x1309ac[_0xe5cb('0x2b')],_0x1309ac[_0xe5cb('0x29')]);_0x3a10d7[_0xe5cb('0x2c')]=_[_0xe5cb('0x2a')](_0x1309ac[_0xe5cb('0x2b')],qs['fields'](_0x32684a[_0xe5cb('0x29')]['fields']));_0x3a10d7[_0xe5cb('0x2c')]=_0x3a10d7['attributes'][_0xe5cb('0x2e')]?_0x3a10d7[_0xe5cb('0x2c')]:_0x1309ac[_0xe5cb('0x2b')];_0x3a10d7[_0xe5cb('0x52')]=qs[_0xe5cb('0x31')](_0x32684a[_0xe5cb('0x29')][_0xe5cb('0x31')]);_0x3a10d7[_0xe5cb('0x32')]=qs[_0xe5cb('0x33')](_[_0xe5cb('0x34')](_0x32684a[_0xe5cb('0x29')],_0x1309ac[_0xe5cb('0x33')]));if(_0x32684a[_0xe5cb('0x29')][_0xe5cb('0x35')]){_0x3a10d7[_0xe5cb('0x32')]=_[_0xe5cb('0x36')](_0x3a10d7[_0xe5cb('0x32')],{'$or':_[_0xe5cb('0x37')](_0x3a10d7[_0xe5cb('0x2c')],function(_0x547f94){var _0x8a34fd={};_0x8a34fd[_0x547f94]={'$like':'%'+_0x32684a[_0xe5cb('0x29')]['filter']+'%'};return _0x8a34fd;})});}_0x3a10d7=_[_0xe5cb('0x36')]({},_0x3a10d7,_0x32684a['options']);return _0x42fe7b['getContacts'](_0x3a10d7);}})[_0xe5cb('0x22')](function(_0x10364e){if(_0x10364e){_0x10074a=_0x10364e[_0xe5cb('0x2e')];if(!_0x32684a['query'][_0xe5cb('0x2f')](_0xe5cb('0x30'))){_0x3a10d7['limit']=qs[_0xe5cb('0x1d')](_0x32684a[_0xe5cb('0x29')][_0xe5cb('0x1d')]);_0x3a10d7[_0xe5cb('0x1c')]=qs[_0xe5cb('0x1c')](_0x32684a[_0xe5cb('0x29')]['offset']);}return _0x42fe7b[_0xe5cb('0x50')](_0x3a10d7);}})[_0xe5cb('0x22')](function(_0x5689e8){if(_0x5689e8){return _0x5689e8?{'count':_0x10074a,'rows':_0x5689e8}:null;}})[_0xe5cb('0x22')](respondWithResult(_0x1e65f6,null))[_0xe5cb('0x3d')](handleError(_0x1e65f6,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 496ba24..8bfc0f2 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 _0x8ef6=['exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x2e284d,_0x290919){var _0x504f8d=function(_0xf613c2){while(--_0xf613c2){_0x2e284d['push'](_0x2e284d['shift']());}};_0x504f8d(++_0x290919);}(_0x8ef6,0xf2));var _0x68ef=function(_0x311a67,_0x28be26){_0x311a67=_0x311a67-0x0;var _0x33862e=_0x8ef6[_0x311a67];return _0x33862e;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde6c=['cm_companies','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x26d7b3,_0x4b3eb4){var _0x3bed78=function(_0x57b07c){while(--_0x57b07c){_0x26d7b3['push'](_0x26d7b3['shift']());}};_0x3bed78(++_0x4b3eb4);}(_0xde6c,0x119));var _0xcde6=function(_0x482598,_0x54c1cf){_0x482598=_0x482598-0x0;var _0x4c9aae=_0xde6c[_0x482598];return _0x4c9aae;};'use strict';var _=require(_0xcde6('0x0'));var util=require(_0xcde6('0x1'));var logger=require('../../config/logger')(_0xcde6('0x2'));var moment=require(_0xcde6('0x3'));var BPromise=require(_0xcde6('0x4'));var rp=require(_0xcde6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcde6('0x6'));var config=require(_0xcde6('0x7'));var attributes=require(_0xcde6('0x8'));module['exports']=function(_0x430ed4,_0xed7d8d){return _0x430ed4['define']('CmCompany',attributes,{'tableName':_0xcde6('0x9'),'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 81cc52f..fc9bf69 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 _0xee0e=['CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info'];(function(_0x56f6e9,_0x12b2c4){var _0x42879f=function(_0x31cbd8){while(--_0x31cbd8){_0x56f6e9['push'](_0x56f6e9['shift']());}};_0x42879f(++_0x12b2c4);}(_0xee0e,0xd1));var _0xeee0=function(_0x4e9274,_0x49576e){_0x4e9274=_0x4e9274-0x0;var _0x8b474c=_0xee0e[_0x4e9274];return _0x8b474c;};'use strict';var _=require(_0xeee0('0x0'));var util=require('util');var moment=require(_0xeee0('0x1'));var BPromise=require(_0xeee0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeee0('0x3'));var db=require(_0xeee0('0x4'))['db'];var utils=require(_0xeee0('0x5'));var logger=require(_0xeee0('0x6'))('rpc');var config=require(_0xeee0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeee0('0x8')][_0xeee0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x388534,_0x50be61,_0x5acda7){return new BPromise(function(_0x56ac2a,_0x4d9cb4){return client['request'](_0x388534,_0x5acda7)['then'](function(_0x175c8d){logger[_0xeee0('0xa')](_0xeee0('0xb'),_0x50be61,_0xeee0('0xc'));logger[_0xeee0('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x50be61,_0xeee0('0xc'),JSON[_0xeee0('0xe')](_0x175c8d));if(_0x175c8d[_0xeee0('0xf')]){if(_0x175c8d[_0xeee0('0xf')][_0xeee0('0x10')]===0x1f4){logger[_0xeee0('0xf')](_0xeee0('0xb'),_0x50be61,_0x175c8d['error'][_0xeee0('0x11')]);return _0x4d9cb4(_0x175c8d[_0xeee0('0xf')][_0xeee0('0x11')]);}logger[_0xeee0('0xf')](_0xeee0('0xb'),_0x50be61,_0x175c8d['error'][_0xeee0('0x11')]);return _0x56ac2a(_0x175c8d[_0xeee0('0xf')][_0xeee0('0x11')]);}else{logger[_0xeee0('0xa')]('CmCompany,\x20%s,\x20%s',_0x50be61,_0xeee0('0xc'));_0x56ac2a(_0x175c8d[_0xeee0('0x12')]['message']);}})[_0xeee0('0x13')](function(_0x1be6c9){logger['error'](_0xeee0('0xb'),_0x50be61,_0x1be6c9);_0x4d9cb4(_0x1be6c9);});});} \ No newline at end of file +var _0x4f49=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x3e7990,_0x3581f6){var _0x9de195=function(_0x173bfc){while(--_0x173bfc){_0x3e7990['push'](_0x3e7990['shift']());}};_0x9de195(++_0x3581f6);}(_0x4f49,0xf1));var _0x94f4=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4f49[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x94f4('0x0'));var moment=require('moment');var BPromise=require(_0x94f4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94f4('0x2'))['db'];var utils=require(_0x94f4('0x3'));var logger=require(_0x94f4('0x4'))(_0x94f4('0x5'));var config=require(_0x94f4('0x6'));var jayson=require(_0x94f4('0x7'));var client=jayson[_0x94f4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2933a9,_0x4f5175,_0x55c97b){return new BPromise(function(_0x2f4336,_0x1f3ba0){return client[_0x94f4('0x9')](_0x2933a9,_0x55c97b)[_0x94f4('0xa')](function(_0x3e8e33){logger[_0x94f4('0xb')](_0x94f4('0xc'),_0x4f5175,_0x94f4('0xd'));logger[_0x94f4('0xe')](_0x94f4('0xf'),_0x4f5175,_0x94f4('0xd'),JSON[_0x94f4('0x10')](_0x3e8e33));if(_0x3e8e33[_0x94f4('0x11')]){if(_0x3e8e33[_0x94f4('0x11')][_0x94f4('0x12')]===0x1f4){logger[_0x94f4('0x11')]('CmCompany,\x20%s,\x20%s',_0x4f5175,_0x3e8e33[_0x94f4('0x11')][_0x94f4('0x13')]);return _0x1f3ba0(_0x3e8e33[_0x94f4('0x11')]['message']);}logger['error'](_0x94f4('0xc'),_0x4f5175,_0x3e8e33['error'][_0x94f4('0x13')]);return _0x2f4336(_0x3e8e33[_0x94f4('0x11')][_0x94f4('0x13')]);}else{logger[_0x94f4('0xb')]('CmCompany,\x20%s,\x20%s',_0x4f5175,_0x94f4('0xd'));_0x2f4336(_0x3e8e33[_0x94f4('0x14')]['message']);}})[_0x94f4('0x15')](function(_0x42f906){logger[_0x94f4('0x11')]('CmCompany,\x20%s,\x20%s',_0x4f5175,_0x42f906);_0x1f3ba0(_0x42f906);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 9416181..ac5e8be 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 _0x2272=['show','/:id/contacts','getContacts','post','create','addContacts','put','update','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x491ee6,_0x290b18){var _0x541e79=function(_0x4f1b11){while(--_0x4f1b11){_0x491ee6['push'](_0x491ee6['shift']());}};_0x541e79(++_0x290b18);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var path=require(_0x2227('0x2'));var timeout=require(_0x2227('0x3'));var express=require(_0x2227('0x4'));var router=express['Router']();var auth=require(_0x2227('0x5'));var interaction=require(_0x2227('0x6'));var config=require(_0x2227('0x7'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x2227('0x8')](),controller[_0x2227('0x9')]);router[_0x2227('0xa')](_0x2227('0xb'),auth[_0x2227('0x8')](),controller[_0x2227('0xc')]);router[_0x2227('0xa')](_0x2227('0xd'),auth[_0x2227('0x8')](),controller[_0x2227('0xe')]);router['get'](_0x2227('0xf'),auth['isAuthenticated'](),controller[_0x2227('0x10')]);router[_0x2227('0x11')]('/',auth[_0x2227('0x8')](),controller[_0x2227('0x12')]);router[_0x2227('0x11')]('/:id/contacts',auth[_0x2227('0x8')](),controller[_0x2227('0x13')]);router[_0x2227('0x14')](_0x2227('0xd'),auth[_0x2227('0x8')](),controller[_0x2227('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2227('0x16')]);module['exports']=router; \ No newline at end of file +var _0x4c60=['index','/describe','describe','/:id','show','post','create','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','get','isAuthenticated'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x4c60,0xc1));var _0x04c6=function(_0x51076d,_0xa3923a){_0x51076d=_0x51076d-0x0;var _0x23a7b8=_0x4c60[_0x51076d];return _0x23a7b8;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x04c6('0x5')]('/',auth[_0x04c6('0x6')](),controller[_0x04c6('0x7')]);router[_0x04c6('0x5')](_0x04c6('0x8'),auth[_0x04c6('0x6')](),controller[_0x04c6('0x9')]);router['get'](_0x04c6('0xa'),auth[_0x04c6('0x6')](),controller[_0x04c6('0xb')]);router[_0x04c6('0x5')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0x04c6('0xc')]('/',auth['isAuthenticated'](),controller[_0x04c6('0xd')]);router[_0x04c6('0xc')]('/:id/contacts',auth[_0x04c6('0x6')](),controller[_0x04c6('0xe')]);router[_0x04c6('0xf')](_0x04c6('0xa'),auth['isAuthenticated'](),controller[_0x04c6('0x10')]);router[_0x04c6('0x11')](_0x04c6('0xa'),auth['isAuthenticated'](),controller[_0x04c6('0x12')]);module[_0x04c6('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 7c0b34e..7d9c7f4 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 _0x4b82=['lodash','sequelize','exports','STRING','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x261abd,_0x2f2e52){var _0x345c8e=function(_0x5841ee){while(--_0x5841ee){_0x261abd['push'](_0x261abd['shift']());}};_0x345c8e(++_0x2f2e52);}(_0x4b82,0xc8));var _0x24b8=function(_0xfc5a04,_0xb77332){_0xfc5a04=_0xfc5a04-0x0;var _0x24b690=_0x4b82[_0xfc5a04];return _0x24b690;};'use strict';var _=require(_0x24b8('0x0'));var Sequelize=require(_0x24b8('0x1'));module[_0x24b8('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x24b8('0x3')]},'postalCode':{'type':Sequelize[_0x24b8('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x24b8('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x24b8('0x3')]},'mobile':{'type':Sequelize[_0x24b8('0x3')]},'fax':{'type':Sequelize[_0x24b8('0x3')]},'email':{'type':Sequelize[_0x24b8('0x3')]},'url':{'type':Sequelize[_0x24b8('0x3')]},'facebook':{'type':Sequelize[_0x24b8('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x24b8('0x3')]},'skype':{'type':Sequelize[_0x24b8('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x24b8('0x3')]},'line':{'type':Sequelize[_0x24b8('0x3')]},'wechat':{'type':Sequelize[_0x24b8('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x24b8('0x4')]},'priority':{'type':Sequelize[_0x24b8('0x4')](0x2)[_0x24b8('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x24b8('0x6')],'defaultValue':Sequelize[_0x24b8('0x7')]}}; \ No newline at end of file +var _0xa6d4=['TEXT','INTEGER','UNSIGNED','DATE','lodash','STRING'];(function(_0x43f252,_0x18e2e6){var _0x28a2db=function(_0x5b0bb0){while(--_0x5b0bb0){_0x43f252['push'](_0x43f252['shift']());}};_0x28a2db(++_0x18e2e6);}(_0xa6d4,0x1ea));var _0x4a6d=function(_0x3c735c,_0x336cf6){_0x3c735c=_0x3c735c-0x0;var _0x17571f=_0xa6d4[_0x3c735c];return _0x17571f;};'use strict';var _=require(_0x4a6d('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0x4a6d('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x4a6d('0x1')]},'street':{'type':Sequelize[_0x4a6d('0x1')]},'postalCode':{'type':Sequelize[_0x4a6d('0x1')]},'city':{'type':Sequelize[_0x4a6d('0x1')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x4a6d('0x1')]},'description':{'type':Sequelize[_0x4a6d('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x4a6d('0x1')]},'fax':{'type':Sequelize[_0x4a6d('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x4a6d('0x1')]},'fb_data':{'type':Sequelize[_0x4a6d('0x1')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x4a6d('0x1')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x4a6d('0x1')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x4a6d('0x3')](0x2)[_0x4a6d('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x4a6d('0x5')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 4aa16ba..1325370 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 _0xeb60=['../../config/environment','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','CmContact','describe','keys','length','startsWith','cf_','push','CmCustomField','findOne','all','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','from','cm_contacts','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','expr','search','parseSearch','sqlOperator','conditions','find','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','text','start','filter','isNil','isEmpty','ListId','c.ListId\x20IN\x20?','concat','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','QueryTypes','SELECT','clone','DESC','having','resolve','some','user','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','params','tags','columnName','displayName','alias','custom','values','body','get','mergeWith','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','info','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','bulkCreate','each','duplicates','$or','spread','error','$and','findAll','format','omit','pickBy','cf_%d','table','setFields','id\x20=\x20?','phone','getTags','options','setTags','ids','getHoppers','rawAttributes','ContactId','includeAll','include','getHopperFinals','CmHopperFinal','getJscriptySessions','No\x20ListId\x20specified','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','0777','child_process','fork','binding_keys','CompanyId','socket_timestamp','pid','send','createReadStream','file','parse','meta','import','binding','No\x20phone\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1da289,_0x417651){var _0x41c889=function(_0x2cea8c){while(--_0x2cea8c){_0x1da289['push'](_0x1da289['shift']());}};_0x41c889(++_0x417651);}(_0xeb60,0x1d6));var _0x0eb6=function(_0x343343,_0x39814c){_0x343343=_0x343343-0x0;var _0x3c4739=_0xeb60[_0x343343];return _0x3c4739;};'use strict';var pdf=require(_0x0eb6('0x0'));var emlformat=require(_0x0eb6('0x1'));var rimraf=require(_0x0eb6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0eb6('0x3'));var rp=require(_0x0eb6('0x4'));var moment=require(_0x0eb6('0x5'));var BPromise=require(_0x0eb6('0x6'));var Mustache=require(_0x0eb6('0x7'));var util=require(_0x0eb6('0x8'));var path=require(_0x0eb6('0x9'));var sox=require(_0x0eb6('0xa'));var csv=require(_0x0eb6('0xb'));var ejs=require(_0x0eb6('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0eb6('0xb'));var querystring=require(_0x0eb6('0xd'));var Papa=require(_0x0eb6('0xe'));var Redis=require(_0x0eb6('0xf'));var authService=require(_0x0eb6('0x10'));var qs=require(_0x0eb6('0x11'));var as=require(_0x0eb6('0x12'));var hardwareService=require(_0x0eb6('0x13'));var logger=require(_0x0eb6('0x14'))(_0x0eb6('0x15'));var utils=require('../../config/utils');var config=require(_0x0eb6('0x16'));var db=require(_0x0eb6('0x17'))['db'];config[_0x0eb6('0x18')]=_[_0x0eb6('0x19')](config[_0x0eb6('0x18')],{'host':_0x0eb6('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0eb6('0x18')]));require(_0x0eb6('0x1b'))[_0x0eb6('0x1c')](socket);function respondWithStatusCode(_0x38c07f,_0x38bdf3){_0x38bdf3=_0x38bdf3||0xcc;return function(_0x3cab2f){if(_0x3cab2f){return _0x38c07f[_0x0eb6('0x1d')](_0x38bdf3);}return _0x38c07f[_0x0eb6('0x1e')](_0x38bdf3)[_0x0eb6('0x1f')]();};}function respondWithResult(_0x58440b,_0x1a7784){_0x1a7784=_0x1a7784||0xc8;return function(_0x58f2f3){if(_0x58f2f3){return _0x58440b[_0x0eb6('0x1e')](_0x1a7784)[_0x0eb6('0x20')](_0x58f2f3);}};}function respondWithFilteredResult(_0x242fec,_0x14be38){return function(_0x493970){if(_0x493970){var _0x53bc38=_0x493970[_0x0eb6('0x21')],_0x503217=_0x14be38[_0x0eb6('0x22')],_0x947056=_0x14be38[_0x0eb6('0x22')]+_0x14be38[_0x0eb6('0x23')],_0x1e95ca;if(_0x947056>=_0x53bc38){_0x947056=_0x53bc38;_0x1e95ca=0xc8;}else{_0x1e95ca=0xce;}_0x242fec[_0x0eb6('0x1e')](_0x1e95ca);return _0x242fec[_0x0eb6('0x24')](_0x0eb6('0x25'),_0x503217+'-'+_0x947056+'/'+_0x53bc38)[_0x0eb6('0x20')](_0x493970);}return null;};}function patchUpdates(_0x4b95ce){return function(_0x113300){try{jsonpatch[_0x0eb6('0x26')](_0x113300,_0x4b95ce,!![]);}catch(_0x336535){return BPromise[_0x0eb6('0x27')](_0x336535);}return _0x113300[_0x0eb6('0x28')]();};}function saveUpdates(_0x1abde0,_0x499276){return function(_0x54972e){if(_0x54972e){return _0x54972e['update'](_0x1abde0)[_0x0eb6('0x29')](function(_0x5da8fc){return _0x5da8fc;});}return null;};}function removeEntity(_0x514fef,_0x5309e1){return function(_0x1f88a3){if(_0x1f88a3){return _0x1f88a3[_0x0eb6('0x2a')]()[_0x0eb6('0x29')](function(){_0x514fef[_0x0eb6('0x1e')](0xcc)[_0x0eb6('0x1f')]();});}};}function handleEntityNotFound(_0x4e6e8c,_0x107a1d){return function(_0x21ce4c){if(!_0x21ce4c){_0x4e6e8c[_0x0eb6('0x1d')](0x194);}return _0x21ce4c;};}function handleError(_0x228476,_0x399aba){_0x399aba=_0x399aba||0x1f4;return function(_0x4ece1e){logger['error'](_0x4ece1e[_0x0eb6('0x2b')]);if(_0x4ece1e[_0x0eb6('0x2c')]){delete _0x4ece1e[_0x0eb6('0x2c')];}_0x228476[_0x0eb6('0x1e')](_0x399aba)['send'](_0x4ece1e);};}exports[_0x0eb6('0x2d')]=function(_0x527cb9,_0x450d3d){var _0x276453={},_0x4a6f0f={},_0x16fca3={'count':0x0,'rows':[]};return db[_0x0eb6('0x2e')][_0x0eb6('0x2f')]()[_0x0eb6('0x29')](function(_0x1c5e64){var _0x32fc21=[];for(var _0x2f0637=0x0;_0x2f06370x1){_0x1c80f7['or'](_0x0eb6('0x72'),qs[_0x0eb6('0x73')](_0x1633bc),null);}else{if(qs['isNumeric'](_0x1633bc)){_0x1c80f7['or'](_0x0eb6('0x74'),_0x1633bc+'%');_0x1c80f7['or'](_0x0eb6('0x75'),_0x1633bc+'%');_0x1c80f7['or'](_0x0eb6('0x76'),_0x1633bc+'%');_0x1c80f7['or'](_0x0eb6('0x77'),_0x1633bc+'%');}else if(qs[_0x0eb6('0x78')](_0x1633bc)){_0x1c80f7['or'](_0x0eb6('0x79'),_0x1633bc+'%');}else{_0x1c80f7['or'](_0x0eb6('0x7a'),'%'+_0x1633bc+'%');_0x1c80f7['or']('c.lastName\x20LIKE\x20?','%'+_0x1633bc+'%');_0x1c80f7['or']('c.email\x20LIKE\x20?','%'+_0x1633bc+'%');}}}}_0x117d06[_0x0eb6('0x44')](_0x1c80f7);_0x117d06[_0x0eb6('0x7b')](_0x0eb6('0x7c'));var _0x3d5549={'type':db['Sequelize'][_0x0eb6('0x7d')][_0x0eb6('0x7e')],'raw':!![]};var _0x475b82=_0x117d06[_0x0eb6('0x7f')]()['field'](_0x0eb6('0x7c'));if(_0x276453[_0x0eb6('0x42')]){_0x276453[_0x0eb6('0x42')]['forEach'](function(_0x4adfde){_0x117d06[_0x0eb6('0x42')]('c.'+_0x4adfde[0x0],_0x4adfde[0x1]===_0x0eb6('0x80')?![]:!![]);});}if(!_['isEmpty'](_0x5553e9)){_0x117d06[_0x0eb6('0x81')](_0x183a97);_0x475b82['where']('t.id\x20IN\x20?',_0x5553e9);}BPromise[_0x0eb6('0x82')]()[_0x0eb6('0x29')](function(){if(_0x18aa00&&!_[_0x0eb6('0x83')](_0x18aa00['conditions'],[_0x0eb6('0x47'),'User'])){return _0x527cb9[_0x0eb6('0x84')]['getLists']({'attributes':['id'],'raw':!![]})[_0x0eb6('0x29')](function(_0x2e96b3){if(_[_0x0eb6('0x68')](_0x2e96b3)){_0x475b82[_0x0eb6('0x44')]('c.ListId\x20IS\x20NULL');_0x117d06['where']('c.ListId\x20IS\x20NULL');}else{_0x475b82['where'](_0x0eb6('0x6a'),_[_0x0eb6('0x59')](_0x2e96b3,'id'));_0x117d06['where'](_0x0eb6('0x6a'),_['map'](_0x2e96b3,'id'));}});}else{return;}})[_0x0eb6('0x29')](function(){db[_0x0eb6('0x85')][_0x0eb6('0x3b')](_0x475b82['toString'](),_0x3d5549)['then'](function(_0x26980e){_0x16fca3['count']=_0x26980e[_0x0eb6('0x31')];if(_0x16fca3[_0x0eb6('0x21')]===0x0)return[];return db[_0x0eb6('0x85')][_0x0eb6('0x3b')](_0x38cb1d[_0x0eb6('0x86')](),_0x3d5549);})[_0x0eb6('0x29')](function(_0xdee52b){_0x1b1157=_[_0x0eb6('0x87')](_0xdee52b,'id');_0x3d5549=_[_0x0eb6('0x88')](_0x3d5549,{'model':db[_0x0eb6('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x527cb9[_0x0eb6('0x3b')]['fields']){_0x276453[_0x0eb6('0x3e')][_0x0eb6('0x5a')](function(_0xe94f19){_0x117d06['field']('c.'+_0xe94f19);});}else{_0x117d06['field']('c.id');_0x117d06['field'](_0x0eb6('0x89'));_0x117d06[_0x0eb6('0x47')](_0x0eb6('0x8a'));_0x117d06[_0x0eb6('0x47')](_0x0eb6('0x8b'));_0x117d06[_0x0eb6('0x47')](_0x0eb6('0x8c'));_0x117d06[_0x0eb6('0x47')](_0x0eb6('0x8d'));_0x117d06[_0x0eb6('0x47')](_0x0eb6('0x8e'));_0x117d06[_0x0eb6('0x47')](_0x0eb6('0x8f'));_0x117d06['field'](_0x0eb6('0x90'));_0x117d06[_0x0eb6('0x47')](_0x0eb6('0x91'),_0x0eb6('0x92'));}if(_0x276453[_0x0eb6('0x23')])_0x117d06['limit'](_0x276453[_0x0eb6('0x23')]);if(_0x276453[_0x0eb6('0x22')])_0x117d06['offset'](_0x276453[_0x0eb6('0x22')]);return db[_0x0eb6('0x85')]['query'](_0x117d06[_0x0eb6('0x86')](),_0x3d5549);})[_0x0eb6('0x29')](function(_0x3fa28e){_0x3fa28e[_0x0eb6('0x5a')](function(_0x2629a6){if(_0x2629a6['TagIds']){_0x2629a6['Tags']=[];_0x2629a6[_0x0eb6('0x92')][_0x0eb6('0x58')](',')[_0x0eb6('0x5a')](function(_0x20a1e3){_0x2629a6[_0x0eb6('0x93')][_0x0eb6('0x34')](_0x1b1157[_0x20a1e3]);});}delete _0x2629a6[_0x0eb6('0x92')];});_0x16fca3[_0x0eb6('0x94')]=_0x3fa28e;return _0x16fca3;})[_0x0eb6('0x29')](respondWithFilteredResult(_0x450d3d,_0x276453));});})[_0x0eb6('0x95')](handleError(_0x450d3d,null));};exports[_0x0eb6('0x2a')]=function(_0x6d5458,_0x272ea7){return db['CmContact'][_0x0eb6('0x55')]({'where':{'id':_0x6d5458[_0x0eb6('0x96')]['id']}})[_0x0eb6('0x29')](handleEntityNotFound(_0x272ea7,null))[_0x0eb6('0x29')](removeEntity(_0x272ea7,null))[_0x0eb6('0x95')](handleError(_0x272ea7,null));};exports[_0x0eb6('0x2f')]=function(_0x5df189,_0x512fdc){return db[_0x0eb6('0x2e')][_0x0eb6('0x2f')]()['then'](function(_0x2a2bf3){delete _0x2a2bf3[_0x0eb6('0x97')];for(var _0xacc770=0x0;_0xacc770=_0x32e7c2){_0x4bd7e3=_0x32e7c2;_0x4398b3=0xc8;}else{_0x4398b3=0xce;}_0x3c805[_0xe712('0x1d')](_0x4398b3);return _0x3c805[_0xe712('0x23')](_0xe712('0x24'),_0x55c78a+'-'+_0x4bd7e3+'/'+_0x32e7c2)[_0xe712('0x1f')](_0x3c736c);}return null;};}function patchUpdates(_0x4a4161){return function(_0x761f78){try{jsonpatch['apply'](_0x761f78,_0x4a4161,!![]);}catch(_0x329858){return BPromise[_0xe712('0x25')](_0x329858);}return _0x761f78[_0xe712('0x26')]();};}function saveUpdates(_0x3b4b4b,_0xaf4147){return function(_0xc6f86a){if(_0xc6f86a){return _0xc6f86a[_0xe712('0x27')](_0x3b4b4b)[_0xe712('0x28')](function(_0x489072){return _0x489072;});}return null;};}function removeEntity(_0x53e672,_0x8c3014){return function(_0x1497f3){if(_0x1497f3){return _0x1497f3[_0xe712('0x29')]()[_0xe712('0x28')](function(){_0x53e672[_0xe712('0x1d')](0xcc)[_0xe712('0x1e')]();});}};}function handleEntityNotFound(_0x232a5e,_0x12d979){return function(_0x512def){if(!_0x512def){_0x232a5e[_0xe712('0x2a')](0x194);}return _0x512def;};}function handleError(_0x5e6064,_0x502219){_0x502219=_0x502219||0x1f4;return function(_0x13e544){logger[_0xe712('0x2b')](_0x13e544[_0xe712('0x2c')]);if(_0x13e544[_0xe712('0x2d')]){delete _0x13e544[_0xe712('0x2d')];}_0x5e6064['status'](_0x502219)[_0xe712('0x2e')](_0x13e544);};}exports[_0xe712('0x2f')]=function(_0x3bbdaf,_0xb2cd44){var _0x4cbf0f={},_0x241f65={},_0x23b7fd={'count':0x0,'rows':[]};return db['CmContact'][_0xe712('0x30')]()[_0xe712('0x28')](function(_0x1b40fc){var _0x408641=[];for(var _0x2f160f=0x0;_0x2f160f0x1){_0x21e351['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe712('0x6b')](_0xdca611),null);}else{if(qs[_0xe712('0x6c')](_0xdca611)){_0x21e351['or'](_0xe712('0x6d'),_0xdca611+'%');_0x21e351['or']('c.phone\x20LIKE\x20?',_0xdca611+'%');_0x21e351['or'](_0xe712('0x6e'),_0xdca611+'%');_0x21e351['or'](_0xe712('0x6f'),_0xdca611+'%');}else if(qs[_0xe712('0x70')](_0xdca611)){_0x21e351['or'](_0xe712('0x71'),_0xdca611+'%');}else{_0x21e351['or'](_0xe712('0x72'),'%'+_0xdca611+'%');_0x21e351['or'](_0xe712('0x73'),'%'+_0xdca611+'%');_0x21e351['or'](_0xe712('0x71'),'%'+_0xdca611+'%');}}}}_0x26aa48[_0xe712('0x4b')](_0x21e351);_0x26aa48[_0xe712('0x74')](_0xe712('0x75'));var _0x55d949={'type':db['Sequelize']['QueryTypes'][_0xe712('0x76')],'raw':!![]};var _0x5692f3=_0x26aa48[_0xe712('0x77')]()[_0xe712('0x43')]('c.id');if(_0x4cbf0f[_0xe712('0x3f')]){_0x4cbf0f[_0xe712('0x3f')][_0xe712('0x55')](function(_0x4ccdb2){_0x26aa48[_0xe712('0x3f')]('c.'+_0x4ccdb2[0x0],_0x4ccdb2[0x1]==='DESC'?![]:!![]);});}if(!_[_0xe712('0x61')](_0x39a760)){_0x26aa48['having'](_0x143426);_0x5692f3['where'](_0xe712('0x78'),_0x39a760);}BPromise['resolve']()[_0xe712('0x28')](function(){if(_0xe18566&&!_[_0xe712('0x79')](_0xe18566[_0xe712('0x4f')],[_0xe712('0x43'),_0xe712('0x58')])){return _0x3bbdaf[_0xe712('0x7a')]['getLists']({'attributes':['id'],'raw':!![]})[_0xe712('0x28')](function(_0x1aab28){if(_[_0xe712('0x61')](_0x1aab28)){_0x5692f3[_0xe712('0x4b')](_0xe712('0x7b'));_0x26aa48[_0xe712('0x4b')]('c.ListId\x20IS\x20NULL');}else{_0x5692f3['where'](_0xe712('0x63'),_[_0xe712('0x54')](_0x1aab28,'id'));_0x26aa48['where'](_0xe712('0x63'),_[_0xe712('0x54')](_0x1aab28,'id'));}});}else{return;}})[_0xe712('0x28')](function(){db[_0xe712('0x7c')][_0xe712('0x38')](_0x5692f3[_0xe712('0x7d')](),_0x55d949)['then'](function(_0x48d998){_0x23b7fd[_0xe712('0x20')]=_0x48d998[_0xe712('0x32')];if(_0x23b7fd[_0xe712('0x20')]===0x0)return[];return db[_0xe712('0x7c')][_0xe712('0x38')](_0xe23b06['toString'](),_0x55d949);})['then'](function(_0x3b784b){_0x4bb2ea=_['keyBy'](_0x3b784b,'id');_0x55d949=_[_0xe712('0x7e')](_0x55d949,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3bbdaf[_0xe712('0x38')][_0xe712('0x3d')]){_0x4cbf0f[_0xe712('0x3c')][_0xe712('0x55')](function(_0x26e4b8){_0x26aa48['field']('c.'+_0x26e4b8);});}else{_0x26aa48[_0xe712('0x43')](_0xe712('0x75'));_0x26aa48[_0xe712('0x43')](_0xe712('0x7f'));_0x26aa48['field']('c.lastName');_0x26aa48[_0xe712('0x43')]('c.phone');_0x26aa48['field'](_0xe712('0x80'));_0x26aa48[_0xe712('0x43')](_0xe712('0x81'));_0x26aa48[_0xe712('0x43')](_0xe712('0x82'));_0x26aa48[_0xe712('0x43')](_0xe712('0x83'));_0x26aa48[_0xe712('0x43')](_0xe712('0x84'));_0x26aa48[_0xe712('0x43')](_0xe712('0x85'),'TagIds');}if(_0x4cbf0f[_0xe712('0x22')])_0x26aa48['limit'](_0x4cbf0f[_0xe712('0x22')]);if(_0x4cbf0f[_0xe712('0x21')])_0x26aa48[_0xe712('0x21')](_0x4cbf0f['offset']);return db[_0xe712('0x7c')][_0xe712('0x38')](_0x26aa48[_0xe712('0x7d')](),_0x55d949);})[_0xe712('0x28')](function(_0x3d115f){_0x3d115f[_0xe712('0x55')](function(_0x1ef093){if(_0x1ef093[_0xe712('0x86')]){_0x1ef093[_0xe712('0x87')]=[];_0x1ef093['TagIds']['split'](',')[_0xe712('0x55')](function(_0x18c1f7){_0x1ef093[_0xe712('0x87')][_0xe712('0x60')](_0x4bb2ea[_0x18c1f7]);});}delete _0x1ef093[_0xe712('0x86')];});_0x23b7fd[_0xe712('0x88')]=_0x3d115f;return _0x23b7fd;})[_0xe712('0x28')](respondWithFilteredResult(_0xb2cd44,_0x4cbf0f));});})[_0xe712('0x89')](handleError(_0xb2cd44,null));};exports[_0xe712('0x29')]=function(_0x21caf5,_0x31ef6c){return db['CmContact'][_0xe712('0x50')]({'where':{'id':_0x21caf5['params']['id']}})[_0xe712('0x28')](handleEntityNotFound(_0x31ef6c,null))[_0xe712('0x28')](removeEntity(_0x31ef6c,null))[_0xe712('0x89')](handleError(_0x31ef6c,null));};exports[_0xe712('0x30')]=function(_0x56a1c7,_0x3c6dad){return db[_0xe712('0x8a')][_0xe712('0x30')]()[_0xe712('0x28')](function(_0x2a2804){delete _0x2a2804[_0xe712('0x8b')];for(var _0x214523=0x0;_0x214523{}\s\\|]/g,'-');_0x328693(null,util[_0x6eec('0x24')](_0x6eec('0x25'),path['basename'](_0x536429[_0x6eec('0x22')],path[_0x6eec('0x26')](_0x536429[_0x6eec('0x22')])),Date[_0x6eec('0x27')](),path[_0x6eec('0x26')](_0x536429[_0x6eec('0x22')])));}})});router['post'](_0x6eec('0x28'),upload[_0x6eec('0x29')](_0x6eec('0x2a')),controller[_0x6eec('0x2b')]);var upload=multer({'storage':multer[_0x6eec('0x1e')]({'destination':function(_0x1f386c,_0x29879c,_0x20bed3){_0x20bed3(null,path[_0x6eec('0x1f')](config['root'],_0x6eec('0x21')));},'filename':function(_0x44b31c,_0x30eb98,_0x275fd0){_0x30eb98['originalname']=_0x30eb98[_0x6eec('0x22')][_0x6eec('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x275fd0(null,util['format']('%s-%s%s',path[_0x6eec('0x2c')](_0x30eb98['originalname'],path[_0x6eec('0x26')](_0x30eb98[_0x6eec('0x22')])),Date[_0x6eec('0x27')](),path[_0x6eec('0x26')](_0x30eb98[_0x6eec('0x22')])));}})});router[_0x6eec('0x17')](_0x6eec('0x2d'),upload[_0x6eec('0x29')](_0x6eec('0x2a')),controller[_0x6eec('0x2e')]);router['post'](_0x6eec('0x2f'),auth['isAuthenticated'](),controller[_0x6eec('0x30')]);router[_0x6eec('0x31')](_0x6eec('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6eec('0xd'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x32')]);module[_0x6eec('0x33')]=router; \ No newline at end of file +var _0x8958=['replace','format','%s-%s%s','basename','now','extname','file','uploadCsv','single','upload','/upload/:id','import','update','delete','destroy','util','../../components/auth/service','../../config/environment','./cmContact.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','post','merge','create','/create_many','bulkCreate','setTags','diskStorage','join','root','originalname'];(function(_0x2ec5f2,_0x5d22f5){var _0x359fb6=function(_0xcabf55){while(--_0xcabf55){_0x2ec5f2['push'](_0x2ec5f2['shift']());}};_0x359fb6(++_0x5d22f5);}(_0x8958,0x93));var _0x8895=function(_0x37e9b0,_0x3586c7){_0x37e9b0=_0x37e9b0-0x0;var _0x6d3cce=_0x8958[_0x37e9b0];return _0x6d3cce;};'use strict';var multer=require('multer');var util=require(_0x8895('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x8895('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x8895('0x2'));var controller=require(_0x8895('0x3'));router[_0x8895('0x4')]('/',auth['isAuthenticated'](),controller[_0x8895('0x5')]);router[_0x8895('0x4')](_0x8895('0x6'),auth[_0x8895('0x7')](),controller[_0x8895('0x8')]);router['get'](_0x8895('0x9'),auth[_0x8895('0x7')](),controller[_0x8895('0xa')]);router[_0x8895('0x4')](_0x8895('0xb'),auth[_0x8895('0x7')](),controller[_0x8895('0xc')]);router[_0x8895('0x4')](_0x8895('0xd'),auth[_0x8895('0x7')](),controller['getHoppers']);router[_0x8895('0x4')](_0x8895('0xe'),auth[_0x8895('0x7')](),controller[_0x8895('0xf')]);router[_0x8895('0x4')](_0x8895('0x10'),auth['isAuthenticated'](),controller[_0x8895('0x11')]);router[_0x8895('0x4')](_0x8895('0x12'),auth['isAuthenticated'](),controller['getJscriptySessions']);router[_0x8895('0x13')]('/merge',auth[_0x8895('0x7')](),controller[_0x8895('0x14')]);router[_0x8895('0x13')]('/',auth[_0x8895('0x7')](),controller[_0x8895('0x15')]);router['post'](_0x8895('0x16'),auth[_0x8895('0x7')](),controller[_0x8895('0x17')]);router[_0x8895('0x13')](_0x8895('0xb'),auth[_0x8895('0x7')](),controller[_0x8895('0x18')]);var upload=multer({'storage':multer[_0x8895('0x19')]({'destination':function(_0x135c11,_0x2da618,_0x24fef0){_0x24fef0(null,path[_0x8895('0x1a')](config[_0x8895('0x1b')],'server/files/tmp'));},'filename':function(_0x522a4e,_0x4fcbc3,_0x3daf43){_0x4fcbc3[_0x8895('0x1c')]=_0x4fcbc3[_0x8895('0x1c')][_0x8895('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3daf43(null,util[_0x8895('0x1e')](_0x8895('0x1f'),path[_0x8895('0x20')](_0x4fcbc3[_0x8895('0x1c')],path['extname'](_0x4fcbc3[_0x8895('0x1c')])),Date[_0x8895('0x21')](),path[_0x8895('0x22')](_0x4fcbc3[_0x8895('0x1c')])));}})});router[_0x8895('0x13')]('/csv',upload['single'](_0x8895('0x23')),controller[_0x8895('0x24')]);var upload=multer({'storage':multer[_0x8895('0x19')]({'destination':function(_0x24a376,_0x4fc150,_0x25da11){_0x25da11(null,path[_0x8895('0x1a')](config[_0x8895('0x1b')],'server/files/tmp'));},'filename':function(_0x4aee03,_0x78b57,_0x555e60){_0x78b57[_0x8895('0x1c')]=_0x78b57[_0x8895('0x1c')][_0x8895('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x555e60(null,util[_0x8895('0x1e')](_0x8895('0x1f'),path['basename'](_0x78b57['originalname'],path[_0x8895('0x22')](_0x78b57[_0x8895('0x1c')])),Date[_0x8895('0x21')](),path[_0x8895('0x22')](_0x78b57[_0x8895('0x1c')])));}})});router['post']('/upload',upload[_0x8895('0x25')](_0x8895('0x23')),controller[_0x8895('0x26')]);router[_0x8895('0x13')](_0x8895('0x27'),auth['isAuthenticated'](),controller[_0x8895('0x28')]);router['put'](_0x8895('0x9'),auth['isAuthenticated'](),controller[_0x8895('0x29')]);router[_0x8895('0x2a')](_0x8895('0x9'),auth[_0x8895('0x7')](),controller[_0x8895('0x2b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index fd3426d..8f28c10 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 _0x98d9=['exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','name','TEXT','type','select','parse','values','isArray','stringify','BOOLEAN','sequelize'];(function(_0xe79b7f,_0x68768f){var _0x4c0359=function(_0x5c49b4){while(--_0x5c49b4){_0xe79b7f['push'](_0xe79b7f['shift']());}};_0x4c0359(++_0x68768f);}(_0x98d9,0xff));var _0x998d=function(_0x55a72c,_0x1b768a){_0x55a72c=_0x55a72c-0x0;var _0x29bd21=_0x98d9[_0x55a72c];return _0x29bd21;};'use strict';var Sequelize=require(_0x998d('0x0'));var _=require('lodash');module[_0x998d('0x1')]={'name':{'type':Sequelize[_0x998d('0x2')],'get':function(_0x3ef12a){return this[_0x998d('0x3')]('alias');}},'alias':{'type':Sequelize[_0x998d('0x4')],'allowNull':![],'set':function(_0x30a904){this[_0x998d('0x5')](_0x998d('0x6'),_0x30a904?_0x30a904:this['getDataValue'](_0x998d('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x998d('0x8')]('long'),'get':function(){if(this[_0x998d('0x3')](_0x998d('0x9'))===_0x998d('0xa')){return JSON[_0x998d('0xb')](this['getDataValue'](_0x998d('0xc')));}else{return this[_0x998d('0x3')](_0x998d('0xc'));}},'set':function(_0x30700e){if(Array[_0x998d('0xd')](_0x30700e)){this[_0x998d('0x5')](_0x998d('0xc'),JSON[_0x998d('0xe')](_0x30700e));}else{this['setDataValue'](_0x998d('0xc'),_0x30700e);}}},'required':{'type':Sequelize[_0x998d('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x2ec9=['long','type','parse','values','setDataValue','stringify','BOOLEAN','sequelize','exports','VIRTUAL','getDataValue','alias','STRING'];(function(_0x53e26e,_0x4a5f9c){var _0xf87fd2=function(_0x1d5bdb){while(--_0x1d5bdb){_0x53e26e['push'](_0x53e26e['shift']());}};_0xf87fd2(++_0x4a5f9c);}(_0x2ec9,0x173));var _0x92ec=function(_0x14fd10,_0x207b9a){_0x14fd10=_0x14fd10-0x0;var _0x323483=_0x2ec9[_0x14fd10];return _0x323483;};'use strict';var Sequelize=require(_0x92ec('0x0'));var _=require('lodash');module[_0x92ec('0x1')]={'name':{'type':Sequelize[_0x92ec('0x2')],'get':function(_0x342e1c){return this[_0x92ec('0x3')](_0x92ec('0x4'));}},'alias':{'type':Sequelize[_0x92ec('0x5')],'allowNull':![],'set':function(_0x3d203a){this['setDataValue'](_0x92ec('0x4'),_0x3d203a?_0x3d203a:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x92ec('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x92ec('0x6')),'get':function(){if(this[_0x92ec('0x3')](_0x92ec('0x7'))==='select'){return JSON[_0x92ec('0x8')](this['getDataValue'](_0x92ec('0x9')));}else{return this[_0x92ec('0x3')](_0x92ec('0x9'));}},'set':function(_0x540a45){if(Array['isArray'](_0x540a45)){this[_0x92ec('0xa')](_0x92ec('0x9'),JSON[_0x92ec('0xb')](_0x540a45));}else{this[_0x92ec('0xa')](_0x92ec('0x9'),_0x540a45);}}},'required':{'type':Sequelize[_0x92ec('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 7b54708..6982907 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 _0xb276=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','CmCustomField','rawAttributes','type','keys','filters','intersection','model','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','merge','find','body','params','create','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','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'];(function(_0x4a9a54,_0x540399){var _0x1b8bd6=function(_0x1dc6f4){while(--_0x1dc6f4){_0x4a9a54['push'](_0x4a9a54['shift']());}};_0x1b8bd6(++_0x540399);}(_0xb276,0x1f2));var _0x6b27=function(_0x4df6f9,_0x44bd65){_0x4df6f9=_0x4df6f9-0x0;var _0x4b1a73=_0xb276[_0x4df6f9];return _0x4b1a73;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6b27('0x0'));var rimraf=require(_0x6b27('0x1'));var zipdir=require(_0x6b27('0x2'));var jsonpatch=require(_0x6b27('0x3'));var rp=require(_0x6b27('0x4'));var moment=require(_0x6b27('0x5'));var BPromise=require(_0x6b27('0x6'));var Mustache=require(_0x6b27('0x7'));var util=require(_0x6b27('0x8'));var path=require(_0x6b27('0x9'));var sox=require(_0x6b27('0xa'));var csv=require(_0x6b27('0xb'));var ejs=require(_0x6b27('0xc'));var fs=require('fs');var _=require(_0x6b27('0xd'));var squel=require(_0x6b27('0xe'));var crypto=require(_0x6b27('0xf'));var jsforce=require(_0x6b27('0x10'));var deskjs=require(_0x6b27('0x11'));var toCsv=require(_0x6b27('0xb'));var querystring=require(_0x6b27('0x12'));var Papa=require(_0x6b27('0x13'));var Redis=require(_0x6b27('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x6b27('0x15'));var as=require(_0x6b27('0x16'));var hardwareService=require(_0x6b27('0x17'));var logger=require(_0x6b27('0x18'))(_0x6b27('0x19'));var utils=require('../../config/utils');var config=require(_0x6b27('0x1a'));var db=require(_0x6b27('0x1b'))['db'];function respondWithStatusCode(_0x5517f9,_0x53bb90){_0x53bb90=_0x53bb90||0xcc;return function(_0x233bad){if(_0x233bad){return _0x5517f9['sendStatus'](_0x53bb90);}return _0x5517f9[_0x6b27('0x1c')](_0x53bb90)['end']();};}function respondWithResult(_0x33b979,_0x330281){_0x330281=_0x330281||0xc8;return function(_0x1d2edb){if(_0x1d2edb){return _0x33b979[_0x6b27('0x1c')](_0x330281)[_0x6b27('0x1d')](_0x1d2edb);}};}function respondWithFilteredResult(_0x2ac952,_0x12a7d6){return function(_0x33110e){if(_0x33110e){var _0x4626b6=_0x33110e[_0x6b27('0x1e')],_0x2fcf67=_0x12a7d6[_0x6b27('0x1f')],_0x23e6df=_0x12a7d6[_0x6b27('0x1f')]+_0x12a7d6[_0x6b27('0x20')],_0x36acd7;if(_0x23e6df>=_0x4626b6){_0x23e6df=_0x4626b6;_0x36acd7=0xc8;}else{_0x36acd7=0xce;}_0x2ac952[_0x6b27('0x1c')](_0x36acd7);return _0x2ac952[_0x6b27('0x21')](_0x6b27('0x22'),_0x2fcf67+'-'+_0x23e6df+'/'+_0x4626b6)[_0x6b27('0x1d')](_0x33110e);}return null;};}function patchUpdates(_0x77c80c){return function(_0x4cfda9){try{jsonpatch[_0x6b27('0x23')](_0x4cfda9,_0x77c80c,!![]);}catch(_0x1a0f2d){return BPromise[_0x6b27('0x24')](_0x1a0f2d);}return _0x4cfda9['save']();};}function saveUpdates(_0x389f18,_0x2554b5){return function(_0x91aaff){if(_0x91aaff){return _0x91aaff[_0x6b27('0x25')](_0x389f18)[_0x6b27('0x26')](function(_0x5917b0){return _0x5917b0;});}return null;};}function removeEntity(_0x19ad82,_0x4d7d11){return function(_0x251c42){if(_0x251c42){return _0x251c42[_0x6b27('0x27')]()['then'](function(){_0x19ad82[_0x6b27('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46cb1b,_0x1a6388){return function(_0x4697c8){if(!_0x4697c8){_0x46cb1b[_0x6b27('0x28')](0x194);}return _0x4697c8;};}function handleError(_0x3a853e,_0x4124ac){_0x4124ac=_0x4124ac||0x1f4;return function(_0x562b5f){logger[_0x6b27('0x29')](_0x562b5f[_0x6b27('0x2a')]);if(_0x562b5f[_0x6b27('0x2b')]){delete _0x562b5f['name'];}_0x3a853e['status'](_0x4124ac)[_0x6b27('0x2c')](_0x562b5f);};}exports['index']=function(_0x4b5e9e,_0x3bbb00){var _0x3638c3={},_0x1081af={},_0x24d392={'count':0x0,'rows':[]};var _0x4246dd=_[_0x6b27('0x2d')](db[_0x6b27('0x2e')][_0x6b27('0x2f')],function(_0x3e3d78){return{'name':_0x3e3d78['fieldName'],'type':_0x3e3d78[_0x6b27('0x30')]['key']};});_0x1081af['model']=_['differenceBy'](_['map'](_0x4246dd,_0x6b27('0x2b')),['name']);_0x1081af['query']=_[_0x6b27('0x31')](_0x4b5e9e['query']);_0x1081af[_0x6b27('0x32')]=_[_0x6b27('0x33')](_0x1081af[_0x6b27('0x34')],_0x1081af[_0x6b27('0x35')]);_0x3638c3[_0x6b27('0x36')]=_['intersection'](_0x1081af[_0x6b27('0x34')],qs[_0x6b27('0x37')](_0x4b5e9e['query'][_0x6b27('0x37')]));_0x3638c3[_0x6b27('0x36')]=_0x3638c3['attributes'][_0x6b27('0x38')]?_0x3638c3[_0x6b27('0x36')]:_0x1081af[_0x6b27('0x34')];if(!_0x4b5e9e[_0x6b27('0x35')]['hasOwnProperty'](_0x6b27('0x39'))){_0x3638c3[_0x6b27('0x20')]=qs['limit'](_0x4b5e9e['query']['limit']);_0x3638c3[_0x6b27('0x1f')]=qs[_0x6b27('0x1f')](_0x4b5e9e[_0x6b27('0x35')][_0x6b27('0x1f')]);}_0x3638c3[_0x6b27('0x3a')]=qs[_0x6b27('0x3b')](_0x4b5e9e[_0x6b27('0x35')][_0x6b27('0x3b')]);_0x3638c3[_0x6b27('0x3c')]=qs[_0x6b27('0x32')](_[_0x6b27('0x3d')](_0x4b5e9e['query'],_0x1081af[_0x6b27('0x32')]),_0x4246dd);if(_0x4b5e9e[_0x6b27('0x35')][_0x6b27('0x3e')]){_0x3638c3[_0x6b27('0x3c')]=_['merge'](_0x3638c3[_0x6b27('0x3c')],{'$or':_['map'](_0x4246dd,function(_0x1de336){if(_0x1de336[_0x6b27('0x30')]!==_0x6b27('0x3f')){var _0x1f8644={};_0x1f8644[_0x1de336['name']]={'$like':'%'+_0x4b5e9e[_0x6b27('0x35')][_0x6b27('0x3e')]+'%'};return _0x1f8644;}})});}_0x3638c3=_['merge']({},_0x3638c3,_0x4b5e9e[_0x6b27('0x40')]);var _0x4c6d5b={'where':_0x3638c3[_0x6b27('0x3c')]};return db['CmCustomField'][_0x6b27('0x1e')](_0x4c6d5b)[_0x6b27('0x26')](function(_0x17b5c2){_0x24d392[_0x6b27('0x1e')]=_0x17b5c2;if(_0x4b5e9e['query'][_0x6b27('0x41')]){_0x3638c3[_0x6b27('0x42')]=[{'all':!![]}];}return db[_0x6b27('0x2e')]['findAll'](_0x3638c3);})[_0x6b27('0x26')](function(_0x42e306){_0x24d392[_0x6b27('0x43')]=_0x42e306;return _0x24d392;})[_0x6b27('0x26')](respondWithFilteredResult(_0x3bbb00,_0x3638c3))[_0x6b27('0x44')](handleError(_0x3bbb00,null));};exports[_0x6b27('0x45')]=function(_0x9006e9,_0x1a77bc){var _0xcd3d5d={'raw':!![],'where':{'id':_0x9006e9['params']['id']}},_0x243cd8={};_0x243cd8['model']=_['keys'](db[_0x6b27('0x2e')][_0x6b27('0x2f')]);_0x243cd8[_0x6b27('0x35')]=_[_0x6b27('0x31')](_0x9006e9['query']);_0x243cd8[_0x6b27('0x32')]=_[_0x6b27('0x33')](_0x243cd8[_0x6b27('0x34')],_0x243cd8[_0x6b27('0x35')]);_0xcd3d5d[_0x6b27('0x36')]=_['intersection'](_0x243cd8[_0x6b27('0x34')],qs[_0x6b27('0x37')](_0x9006e9[_0x6b27('0x35')][_0x6b27('0x37')]));_0xcd3d5d[_0x6b27('0x36')]=_0xcd3d5d[_0x6b27('0x36')][_0x6b27('0x38')]?_0xcd3d5d[_0x6b27('0x36')]:_0x243cd8[_0x6b27('0x34')];if(_0x9006e9['query'][_0x6b27('0x41')]){_0xcd3d5d[_0x6b27('0x42')]=[{'all':!![]}];}_0xcd3d5d=_[_0x6b27('0x46')]({},_0xcd3d5d,_0x9006e9[_0x6b27('0x40')]);return db[_0x6b27('0x2e')][_0x6b27('0x47')](_0xcd3d5d)[_0x6b27('0x26')](handleEntityNotFound(_0x1a77bc,null))[_0x6b27('0x26')](respondWithResult(_0x1a77bc,null))[_0x6b27('0x44')](handleError(_0x1a77bc,null));};exports['update']=function(_0x3ec886,_0x2927d2){if(_0x3ec886[_0x6b27('0x48')]['id']){delete _0x3ec886[_0x6b27('0x48')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x3ec886[_0x6b27('0x49')]['id']}})[_0x6b27('0x26')](handleEntityNotFound(_0x2927d2,null))['then'](saveUpdates(_0x3ec886[_0x6b27('0x48')],null))[_0x6b27('0x26')](respondWithResult(_0x2927d2,null))['catch'](handleError(_0x2927d2,null));};exports[_0x6b27('0x27')]=function(_0x451e45,_0x180ad3){return db['CmCustomField'][_0x6b27('0x47')]({'where':{'id':_0x451e45[_0x6b27('0x49')]['id']}})[_0x6b27('0x26')](handleEntityNotFound(_0x180ad3,null))['then'](removeEntity(_0x180ad3,null))[_0x6b27('0x44')](handleError(_0x180ad3,null));};exports[_0x6b27('0x4a')]=function(_0x2f6df6,_0x5c15cb){var _0x2bd63b;return db['sequelize']['transaction'](function(_0x5b8a27){return db[_0x6b27('0x2e')][_0x6b27('0x4a')](_0x2f6df6['body'],{'transaction':_0x5b8a27})[_0x6b27('0x26')](function(_0x4136a2){_0x2bd63b=_0x4136a2;var _0x40f878={'type':db[_0x6b27('0x4b')][_0x6b27('0x4c')],'transaction':_0x5b8a27};switch(_0x2f6df6['body'][_0x6b27('0x30')]){case _0x6b27('0x4d'):_0x40f878[_0x6b27('0x30')]=db['Sequelize'][_0x6b27('0x4c')];break;case _0x6b27('0x4e'):_0x40f878[_0x6b27('0x30')]=db[_0x6b27('0x4b')][_0x6b27('0x4f')];break;case'switch':_0x40f878[_0x6b27('0x30')]=db['Sequelize'][_0x6b27('0x50')];_0x40f878[_0x6b27('0x51')]=![];break;default:}return db['sequelize'][_0x6b27('0x52')][_0x6b27('0x53')](_0x6b27('0x54'),util['format'](_0x6b27('0x55'),_0x2bd63b['id']),_0x40f878);})['then'](function(){return _0x2bd63b;});})['then'](respondWithResult(_0x5c15cb,0xc9))['catch'](handleError(_0x5c15cb,null));}; \ No newline at end of file +var _0x0e74=['BOOLEAN','defaultValue','queryInterface','addColumn','format','html-pdf','eml-format','zip-dir','fast-json-patch','mustache','ejs','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','stack','send','map','CmCustomField','rawAttributes','type','key','model','differenceBy','name','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','length','options','find','body','destroy','create','sequelize','TEXT','text','Sequelize','INTEGER','switch'];(function(_0x234cfb,_0x53897f){var _0x18750a=function(_0x1c5b6e){while(--_0x1c5b6e){_0x234cfb['push'](_0x234cfb['shift']());}};_0x18750a(++_0x53897f);}(_0x0e74,0xa5));var _0x40e7=function(_0x34f404,_0x2b5cd9){_0x34f404=_0x34f404-0x0;var _0x454116=_0x0e74[_0x34f404];return _0x454116;};'use strict';var pdf=require(_0x40e7('0x0'));var emlformat=require(_0x40e7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x40e7('0x2'));var jsonpatch=require(_0x40e7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x40e7('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x40e7('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0x40e7('0x6'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x40e7('0x7'));var querystring=require(_0x40e7('0x8'));var Papa=require(_0x40e7('0x9'));var Redis=require(_0x40e7('0xa'));var authService=require(_0x40e7('0xb'));var qs=require(_0x40e7('0xc'));var as=require(_0x40e7('0xd'));var hardwareService=require(_0x40e7('0xe'));var logger=require(_0x40e7('0xf'))(_0x40e7('0x10'));var utils=require(_0x40e7('0x11'));var config=require(_0x40e7('0x12'));var db=require(_0x40e7('0x13'))['db'];function respondWithStatusCode(_0x4ebfe8,_0x5997fd){_0x5997fd=_0x5997fd||0xcc;return function(_0x12077c){if(_0x12077c){return _0x4ebfe8['sendStatus'](_0x5997fd);}return _0x4ebfe8[_0x40e7('0x14')](_0x5997fd)[_0x40e7('0x15')]();};}function respondWithResult(_0x14fcf5,_0x1b6e1a){_0x1b6e1a=_0x1b6e1a||0xc8;return function(_0x49705e){if(_0x49705e){return _0x14fcf5[_0x40e7('0x14')](_0x1b6e1a)['json'](_0x49705e);}};}function respondWithFilteredResult(_0x34134f,_0x35735c){return function(_0xa71b74){if(_0xa71b74){var _0x5c1e37=_0xa71b74[_0x40e7('0x16')],_0x3cddc8=_0x35735c['offset'],_0x6f3f18=_0x35735c[_0x40e7('0x17')]+_0x35735c[_0x40e7('0x18')],_0x4ee20c;if(_0x6f3f18>=_0x5c1e37){_0x6f3f18=_0x5c1e37;_0x4ee20c=0xc8;}else{_0x4ee20c=0xce;}_0x34134f[_0x40e7('0x14')](_0x4ee20c);return _0x34134f[_0x40e7('0x19')](_0x40e7('0x1a'),_0x3cddc8+'-'+_0x6f3f18+'/'+_0x5c1e37)[_0x40e7('0x1b')](_0xa71b74);}return null;};}function patchUpdates(_0x4cc7a7){return function(_0x33a83f){try{jsonpatch[_0x40e7('0x1c')](_0x33a83f,_0x4cc7a7,!![]);}catch(_0x49b527){return BPromise[_0x40e7('0x1d')](_0x49b527);}return _0x33a83f[_0x40e7('0x1e')]();};}function saveUpdates(_0x314116,_0x5a51f5){return function(_0x5e24b3){if(_0x5e24b3){return _0x5e24b3[_0x40e7('0x1f')](_0x314116)[_0x40e7('0x20')](function(_0x51395a){return _0x51395a;});}return null;};}function removeEntity(_0x449274,_0x5ddc2a){return function(_0x5152e1){if(_0x5152e1){return _0x5152e1['destroy']()[_0x40e7('0x20')](function(){_0x449274[_0x40e7('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x574100,_0x3f311c){return function(_0x34df7d){if(!_0x34df7d){_0x574100[_0x40e7('0x21')](0x194);}return _0x34df7d;};}function handleError(_0xa13404,_0x5815be){_0x5815be=_0x5815be||0x1f4;return function(_0x818abb){logger['error'](_0x818abb[_0x40e7('0x22')]);if(_0x818abb['name']){delete _0x818abb['name'];}_0xa13404['status'](_0x5815be)[_0x40e7('0x23')](_0x818abb);};}exports['index']=function(_0x4d82d3,_0x3496a2){var _0x5073ab={},_0x35248d={},_0x3001ef={'count':0x0,'rows':[]};var _0x4ea776=_[_0x40e7('0x24')](db[_0x40e7('0x25')][_0x40e7('0x26')],function(_0x40e9c9){return{'name':_0x40e9c9['fieldName'],'type':_0x40e9c9[_0x40e7('0x27')][_0x40e7('0x28')]};});_0x35248d[_0x40e7('0x29')]=_[_0x40e7('0x2a')](_[_0x40e7('0x24')](_0x4ea776,_0x40e7('0x2b')),[_0x40e7('0x2b')]);_0x35248d[_0x40e7('0x2c')]=_[_0x40e7('0x2d')](_0x4d82d3[_0x40e7('0x2c')]);_0x35248d[_0x40e7('0x2e')]=_['intersection'](_0x35248d['model'],_0x35248d[_0x40e7('0x2c')]);_0x5073ab['attributes']=_[_0x40e7('0x2f')](_0x35248d[_0x40e7('0x29')],qs[_0x40e7('0x30')](_0x4d82d3['query'][_0x40e7('0x30')]));_0x5073ab[_0x40e7('0x31')]=_0x5073ab[_0x40e7('0x31')]['length']?_0x5073ab[_0x40e7('0x31')]:_0x35248d[_0x40e7('0x29')];if(!_0x4d82d3[_0x40e7('0x2c')]['hasOwnProperty'](_0x40e7('0x32'))){_0x5073ab[_0x40e7('0x18')]=qs[_0x40e7('0x18')](_0x4d82d3[_0x40e7('0x2c')][_0x40e7('0x18')]);_0x5073ab['offset']=qs[_0x40e7('0x17')](_0x4d82d3[_0x40e7('0x2c')][_0x40e7('0x17')]);}_0x5073ab[_0x40e7('0x33')]=qs[_0x40e7('0x34')](_0x4d82d3[_0x40e7('0x2c')]['sort']);_0x5073ab[_0x40e7('0x35')]=qs[_0x40e7('0x2e')](_[_0x40e7('0x36')](_0x4d82d3[_0x40e7('0x2c')],_0x35248d['filters']),_0x4ea776);if(_0x4d82d3[_0x40e7('0x2c')][_0x40e7('0x37')]){_0x5073ab['where']=_[_0x40e7('0x38')](_0x5073ab[_0x40e7('0x35')],{'$or':_[_0x40e7('0x24')](_0x4ea776,function(_0x28578f){if(_0x28578f[_0x40e7('0x27')]!=='VIRTUAL'){var _0x26aaff={};_0x26aaff[_0x28578f[_0x40e7('0x2b')]]={'$like':'%'+_0x4d82d3['query'][_0x40e7('0x37')]+'%'};return _0x26aaff;}})});}_0x5073ab=_[_0x40e7('0x38')]({},_0x5073ab,_0x4d82d3['options']);var _0x42d622={'where':_0x5073ab[_0x40e7('0x35')]};return db[_0x40e7('0x25')]['count'](_0x42d622)[_0x40e7('0x20')](function(_0x5375e0){_0x3001ef[_0x40e7('0x16')]=_0x5375e0;if(_0x4d82d3[_0x40e7('0x2c')][_0x40e7('0x39')]){_0x5073ab[_0x40e7('0x3a')]=[{'all':!![]}];}return db['CmCustomField'][_0x40e7('0x3b')](_0x5073ab);})[_0x40e7('0x20')](function(_0x531796){_0x3001ef[_0x40e7('0x3c')]=_0x531796;return _0x3001ef;})[_0x40e7('0x20')](respondWithFilteredResult(_0x3496a2,_0x5073ab))[_0x40e7('0x3d')](handleError(_0x3496a2,null));};exports['show']=function(_0x485bd6,_0x12fcf7){var _0x4584ea={'raw':!![],'where':{'id':_0x485bd6[_0x40e7('0x3e')]['id']}},_0xe9c9c9={};_0xe9c9c9['model']=_[_0x40e7('0x2d')](db[_0x40e7('0x25')][_0x40e7('0x26')]);_0xe9c9c9[_0x40e7('0x2c')]=_[_0x40e7('0x2d')](_0x485bd6[_0x40e7('0x2c')]);_0xe9c9c9['filters']=_[_0x40e7('0x2f')](_0xe9c9c9[_0x40e7('0x29')],_0xe9c9c9[_0x40e7('0x2c')]);_0x4584ea[_0x40e7('0x31')]=_[_0x40e7('0x2f')](_0xe9c9c9[_0x40e7('0x29')],qs[_0x40e7('0x30')](_0x485bd6[_0x40e7('0x2c')][_0x40e7('0x30')]));_0x4584ea[_0x40e7('0x31')]=_0x4584ea['attributes'][_0x40e7('0x3f')]?_0x4584ea[_0x40e7('0x31')]:_0xe9c9c9[_0x40e7('0x29')];if(_0x485bd6[_0x40e7('0x2c')][_0x40e7('0x39')]){_0x4584ea[_0x40e7('0x3a')]=[{'all':!![]}];}_0x4584ea=_[_0x40e7('0x38')]({},_0x4584ea,_0x485bd6[_0x40e7('0x40')]);return db[_0x40e7('0x25')][_0x40e7('0x41')](_0x4584ea)[_0x40e7('0x20')](handleEntityNotFound(_0x12fcf7,null))['then'](respondWithResult(_0x12fcf7,null))['catch'](handleError(_0x12fcf7,null));};exports[_0x40e7('0x1f')]=function(_0x429e80,_0x56316c){if(_0x429e80[_0x40e7('0x42')]['id']){delete _0x429e80[_0x40e7('0x42')]['id'];}return db[_0x40e7('0x25')][_0x40e7('0x41')]({'where':{'id':_0x429e80['params']['id']}})[_0x40e7('0x20')](handleEntityNotFound(_0x56316c,null))[_0x40e7('0x20')](saveUpdates(_0x429e80[_0x40e7('0x42')],null))[_0x40e7('0x20')](respondWithResult(_0x56316c,null))[_0x40e7('0x3d')](handleError(_0x56316c,null));};exports[_0x40e7('0x43')]=function(_0x346bdc,_0x1b8b6a){return db['CmCustomField']['find']({'where':{'id':_0x346bdc[_0x40e7('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1b8b6a,null))[_0x40e7('0x20')](removeEntity(_0x1b8b6a,null))[_0x40e7('0x3d')](handleError(_0x1b8b6a,null));};exports[_0x40e7('0x44')]=function(_0x13dd04,_0x4b2118){var _0x4962cb;return db[_0x40e7('0x45')]['transaction'](function(_0x2b4f81){return db[_0x40e7('0x25')][_0x40e7('0x44')](_0x13dd04['body'],{'transaction':_0x2b4f81})[_0x40e7('0x20')](function(_0xc6adcb){_0x4962cb=_0xc6adcb;var _0xdaa70f={'type':db['Sequelize'][_0x40e7('0x46')],'transaction':_0x2b4f81};switch(_0x13dd04[_0x40e7('0x42')][_0x40e7('0x27')]){case _0x40e7('0x47'):_0xdaa70f[_0x40e7('0x27')]=db[_0x40e7('0x48')][_0x40e7('0x46')];break;case'number':_0xdaa70f[_0x40e7('0x27')]=db[_0x40e7('0x48')][_0x40e7('0x49')];break;case _0x40e7('0x4a'):_0xdaa70f['type']=db['Sequelize'][_0x40e7('0x4b')];_0xdaa70f[_0x40e7('0x4c')]=![];break;default:}return db['sequelize'][_0x40e7('0x4d')][_0x40e7('0x4e')]('cm_contacts',util[_0x40e7('0x4f')]('cf_%d',_0x4962cb['id']),_0xdaa70f);})[_0x40e7('0x20')](function(){return _0x4962cb;});})[_0x40e7('0x20')](respondWithResult(_0x4b2118,0xc9))[_0x40e7('0x3d')](handleError(_0x4b2118,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 37ae765..54a6522 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 _0x9a1b=['cm_custom_fields','lodash','moment','bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','define'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x9a1b,0x1ba));var _0xb9a1=function(_0x57190f,_0xd420d3){_0x57190f=_0x57190f-0x0;var _0x584d63=_0x9a1b[_0x57190f];return _0x584d63;};'use strict';var _=require(_0xb9a1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb9a1('0x1'));var BPromise=require(_0xb9a1('0x2'));var rp=require(_0xb9a1('0x3'));var fs=require('fs');var path=require(_0xb9a1('0x4'));var rimraf=require('rimraf');var config=require(_0xb9a1('0x5'));var attributes=require(_0xb9a1('0x6'));module['exports']=function(_0x69b74e,_0x455fac){return _0x69b74e[_0xb9a1('0x7')]('CmCustomField',attributes,{'tableName':_0xb9a1('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bea=['request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','lodash','util','../../config/logger','bluebird'];(function(_0x46b129,_0x417ff9){var _0x2b75c7=function(_0xdacc2b){while(--_0xdacc2b){_0x46b129['push'](_0x46b129['shift']());}};_0x2b75c7(++_0x417ff9);}(_0x0bea,0xee));var _0xa0be=function(_0x525370,_0x5abe18){_0x525370=_0x525370-0x0;var _0x4a1ae9=_0x0bea[_0x525370];return _0x4a1ae9;};'use strict';var _=require(_0xa0be('0x0'));var util=require(_0xa0be('0x1'));var logger=require(_0xa0be('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa0be('0x3'));var rp=require(_0xa0be('0x4'));var fs=require('fs');var path=require(_0xa0be('0x5'));var rimraf=require('rimraf');var config=require(_0xa0be('0x6'));var attributes=require(_0xa0be('0x7'));module[_0xa0be('0x8')]=function(_0x21c151,_0x58eebc){return _0x21c151[_0xa0be('0x9')](_0xa0be('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 0b3e551..c94169d 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 _0x6737=['stringify','error','code','message','info','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3e50f6,_0x32527e){var _0x27c969=function(_0x90bdf0){while(--_0x90bdf0){_0x3e50f6['push'](_0x3e50f6['shift']());}};_0x27c969(++_0x32527e);}(_0x6737,0xe2));var _0x7673=function(_0x1bb285,_0x4b91be){_0x1bb285=_0x1bb285-0x0;var _0x65eed7=_0x6737[_0x1bb285];return _0x65eed7;};'use strict';var _=require('lodash');var util=require(_0x7673('0x0'));var moment=require(_0x7673('0x1'));var BPromise=require('bluebird');var rs=require(_0x7673('0x2'));var fs=require('fs');var Redis=require(_0x7673('0x3'));var db=require(_0x7673('0x4'))['db'];var utils=require(_0x7673('0x5'));var logger=require('../../config/logger')(_0x7673('0x6'));var config=require(_0x7673('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7673('0x8')][_0x7673('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af802,_0x4e4b24,_0x53d67d){return new BPromise(function(_0x5292f7,_0x285c6d){return client['request'](_0x5af802,_0x53d67d)[_0x7673('0xa')](function(_0x1fb769){logger['info'](_0x7673('0xb'),_0x4e4b24,_0x7673('0xc'));logger[_0x7673('0xd')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4e4b24,'request\x20sent',JSON[_0x7673('0xe')](_0x1fb769));if(_0x1fb769['error']){if(_0x1fb769[_0x7673('0xf')][_0x7673('0x10')]===0x1f4){logger[_0x7673('0xf')](_0x7673('0xb'),_0x4e4b24,_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);return _0x285c6d(_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);}logger[_0x7673('0xf')](_0x7673('0xb'),_0x4e4b24,_0x1fb769['error'][_0x7673('0x11')]);return _0x5292f7(_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);}else{logger[_0x7673('0x12')](_0x7673('0xb'),_0x4e4b24,_0x7673('0xc'));_0x5292f7(_0x1fb769[_0x7673('0x13')]['message']);}})['catch'](function(_0x164d05){logger[_0x7673('0xf')]('CmCustomField,\x20%s,\x20%s',_0x4e4b24,_0x164d05);_0x285c6d(_0x164d05);});});} \ No newline at end of file +var _0xadb8=['CmCustomField,\x20%s,\x20%s','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x358ad8,_0x2f3109){var _0x5d0066=function(_0x763cb2){while(--_0x763cb2){_0x358ad8['push'](_0x358ad8['shift']());}};_0x5d0066(++_0x2f3109);}(_0xadb8,0x1d0));var _0x8adb=function(_0x51b19b,_0x5015d2){_0x51b19b=_0x51b19b-0x0;var _0x1a3cd6=_0xadb8[_0x51b19b];return _0x1a3cd6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8adb('0x0'));var BPromise=require('bluebird');var rs=require(_0x8adb('0x1'));var fs=require('fs');var Redis=require(_0x8adb('0x2'));var db=require(_0x8adb('0x3'))['db'];var utils=require(_0x8adb('0x4'));var logger=require(_0x8adb('0x5'))(_0x8adb('0x6'));var config=require(_0x8adb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8adb('0x8')][_0x8adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9f435,_0x2bebfe,_0x271bed){return new BPromise(function(_0x16b932,_0x27d994){return client['request'](_0x9f435,_0x271bed)['then'](function(_0x58ad1a){logger[_0x8adb('0xa')]('CmCustomField,\x20%s,\x20%s',_0x2bebfe,'request\x20sent');logger['debug'](_0x8adb('0xb'),_0x2bebfe,_0x8adb('0xc'),JSON[_0x8adb('0xd')](_0x58ad1a));if(_0x58ad1a[_0x8adb('0xe')]){if(_0x58ad1a[_0x8adb('0xe')][_0x8adb('0xf')]===0x1f4){logger[_0x8adb('0xe')](_0x8adb('0x10'),_0x2bebfe,_0x58ad1a[_0x8adb('0xe')][_0x8adb('0x11')]);return _0x27d994(_0x58ad1a['error']['message']);}logger['error'](_0x8adb('0x10'),_0x2bebfe,_0x58ad1a['error'][_0x8adb('0x11')]);return _0x16b932(_0x58ad1a[_0x8adb('0xe')][_0x8adb('0x11')]);}else{logger['info'](_0x8adb('0x10'),_0x2bebfe,_0x8adb('0xc'));_0x16b932(_0x58ad1a[_0x8adb('0x12')][_0x8adb('0x11')]);}})[_0x8adb('0x13')](function(_0x13659c){logger['error'](_0x8adb('0x10'),_0x2bebfe,_0x13659c);_0x27d994(_0x13659c);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 4bfbe22..518b880 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 _0x2f56=['./cmCustomField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x57b443,_0x5145b4){var _0x1a763d=function(_0x513b90){while(--_0x513b90){_0x57b443['push'](_0x57b443['shift']());}};_0x1a763d(++_0x5145b4);}(_0x2f56,0xb5));var _0x62f5=function(_0x127806,_0x2f0b6a){_0x127806=_0x127806-0x0;var _0x19125c=_0x2f56[_0x127806];return _0x19125c;};'use strict';var multer=require(_0x62f5('0x0'));var util=require(_0x62f5('0x1'));var path=require(_0x62f5('0x2'));var timeout=require(_0x62f5('0x3'));var express=require('express');var router=express[_0x62f5('0x4')]();var auth=require(_0x62f5('0x5'));var interaction=require(_0x62f5('0x6'));var config=require(_0x62f5('0x7'));var controller=require(_0x62f5('0x8'));router['get']('/',auth[_0x62f5('0x9')](),controller[_0x62f5('0xa')]);router[_0x62f5('0xb')](_0x62f5('0xc'),auth['isAuthenticated'](),controller[_0x62f5('0xd')]);router[_0x62f5('0xe')]('/',auth['isAuthenticated'](),controller[_0x62f5('0xf')]);router[_0x62f5('0x10')]('/:id',auth[_0x62f5('0x9')](),controller[_0x62f5('0x11')]);router[_0x62f5('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x62f5('0x13')]);module[_0x62f5('0x14')]=router; \ No newline at end of file +var _0x87da=['post','create','put','/:id','delete','destroy','exports','multer','util','express','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x87da,0x19f));var _0xa87d=function(_0x13e84b,_0x34aded){_0x13e84b=_0x13e84b-0x0;var _0x538afa=_0x87da[_0x13e84b];return _0x538afa;};'use strict';var multer=require(_0xa87d('0x0'));var util=require(_0xa87d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa87d('0x2'));var router=express['Router']();var auth=require(_0xa87d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa87d('0x4'));var controller=require(_0xa87d('0x5'));router[_0xa87d('0x6')]('/',auth[_0xa87d('0x7')](),controller[_0xa87d('0x8')]);router[_0xa87d('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xa87d('0x9')]);router[_0xa87d('0xa')]('/',auth['isAuthenticated'](),controller[_0xa87d('0xb')]);router[_0xa87d('0xc')](_0xa87d('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xa87d('0xe')](_0xa87d('0xd'),auth[_0xa87d('0x7')](),controller[_0xa87d('0xf')]);module[_0xa87d('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 62eb518..af269e3 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 _0x9c5a=['format','INTEGER','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x3d54a1,_0x5d9107){_0x3d54a1=_0x3d54a1-0x0;var _0x23f326=_0x9c5a[_0x3d54a1];return _0x23f326;};'use strict';var moment=require(_0xa9c5('0x0'));var Sequelize=require(_0xa9c5('0x1'));module['exports']={'phone':{'type':Sequelize[_0xa9c5('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xa9c5('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa9c5('0x4')],'defaultValue':moment()[_0xa9c5('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa9c5('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa9c5('0x4')]},'priority':{'type':Sequelize[_0xa9c5('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa9c5('0x6')],'unique':_0xa9c5('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xa9c5('0x7')},'UserId':{'type':Sequelize[_0xa9c5('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa9c5('0x7')},'CampaignId':{'type':Sequelize[_0xa9c5('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd67b=['INTEGER','UNSIGNED','contactListQueue','sequelize','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2da239,_0x36c187){var _0x4f3b2f=function(_0x4ded2d){while(--_0x4ded2d){_0x2da239['push'](_0x2da239['shift']());}};_0x4f3b2f(++_0x36c187);}(_0xd67b,0x133));var _0xbd67=function(_0x36871c,_0x3d5ef){_0x36871c=_0x36871c-0x0;var _0xe10aa7=_0xd67b[_0x36871c];return _0xe10aa7;};'use strict';var moment=require('moment');var Sequelize=require(_0xbd67('0x0'));module['exports']={'phone':{'type':Sequelize[_0xbd67('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xbd67('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xbd67('0x3')],'defaultValue':moment()['format'](_0xbd67('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbd67('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xbd67('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbd67('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbd67('0x3')]},'priority':{'type':Sequelize[_0xbd67('0x5')](0x2)[_0xbd67('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xbd67('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xbd67('0x5')],'unique':_0xbd67('0x7')},'ListId':{'type':Sequelize[_0xbd67('0x5')],'unique':_0xbd67('0x7')},'UserId':{'type':Sequelize[_0xbd67('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xbd67('0x5')],'unique':_0xbd67('0x7')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbd67('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbd67('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbd67('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 5e2dcfc..51625dd 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 _0x885b=['sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','dataValues','createdAt','updatedAt','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','ContactId','lastName','isNil','firstName','calleridname','finally','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','findOne','LOCK','UPDATE','CmContact','CmList','List','Queue','dialActive','update','preview','isNumber','error','getOpenContacts','entity\x20not\x20found','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','sendStatus','status','count','offset','set','Content-Range','json','apply','save','destroy','then','end','name','send','index','map','CmHopper','rawAttributes','type','model','query','keys','filters','intersection','$and','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contained','$any','fields','length','attributes','nolimit','limit','order'];(function(_0x5b7307,_0x1b4448){var _0x400560=function(_0x21aa38){while(--_0x21aa38){_0x5b7307['push'](_0x5b7307['shift']());}};_0x400560(++_0x1b4448);}(_0x885b,0xd3));var _0xb885=function(_0x6fade2,_0x58f7d2){_0x6fade2=_0x6fade2-0x0;var _0x43ec25=_0x885b[_0x6fade2];return _0x43ec25;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb885('0x0'));var rimraf=require(_0xb885('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb885('0x2'));var rp=require('request-promise');var moment=require(_0xb885('0x3'));var BPromise=require(_0xb885('0x4'));var Mustache=require(_0xb885('0x5'));var util=require(_0xb885('0x6'));var path=require(_0xb885('0x7'));var sox=require(_0xb885('0x8'));var csv=require(_0xb885('0x9'));var ejs=require(_0xb885('0xa'));var fs=require('fs');var _=require(_0xb885('0xb'));var squel=require(_0xb885('0xc'));var crypto=require('crypto');var jsforce=require(_0xb885('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb885('0x9'));var querystring=require(_0xb885('0xe'));var Papa=require(_0xb885('0xf'));var Redis=require(_0xb885('0x10'));var authService=require(_0xb885('0x11'));var qs=require(_0xb885('0x12'));var as=require(_0xb885('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb885('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x71b3bf,_0x40fb2e){_0x40fb2e=_0x40fb2e||0xcc;return function(_0x4656f9){if(_0x4656f9){return _0x71b3bf[_0xb885('0x15')](_0x40fb2e);}return _0x71b3bf[_0xb885('0x16')](_0x40fb2e)['end']();};}function respondWithResult(_0x305153,_0x274a09){_0x274a09=_0x274a09||0xc8;return function(_0x546029){if(_0x546029){return _0x305153[_0xb885('0x16')](_0x274a09)['json'](_0x546029);}};}function respondWithFilteredResult(_0x8bd942,_0x36ff29){return function(_0x388a9d){if(_0x388a9d){var _0x7b6e66=_0x388a9d[_0xb885('0x17')],_0x659145=_0x36ff29['offset'],_0x2afe5f=_0x36ff29[_0xb885('0x18')]+_0x36ff29['limit'],_0x34d293;if(_0x2afe5f>=_0x7b6e66){_0x2afe5f=_0x7b6e66;_0x34d293=0xc8;}else{_0x34d293=0xce;}_0x8bd942[_0xb885('0x16')](_0x34d293);return _0x8bd942[_0xb885('0x19')](_0xb885('0x1a'),_0x659145+'-'+_0x2afe5f+'/'+_0x7b6e66)[_0xb885('0x1b')](_0x388a9d);}return null;};}function patchUpdates(_0xfbe3a9){return function(_0x5f35be){try{jsonpatch[_0xb885('0x1c')](_0x5f35be,_0xfbe3a9,!![]);}catch(_0x3a5843){return BPromise['reject'](_0x3a5843);}return _0x5f35be[_0xb885('0x1d')]();};}function saveUpdates(_0x11b943,_0x5ded01){return function(_0x431dfe){if(_0x431dfe){return _0x431dfe['update'](_0x11b943)['then'](function(_0x498796){return _0x498796;});}return null;};}function removeEntity(_0x187b5a,_0x49eef4){return function(_0x12c31a){if(_0x12c31a){return _0x12c31a[_0xb885('0x1e')]()[_0xb885('0x1f')](function(){_0x187b5a[_0xb885('0x16')](0xcc)[_0xb885('0x20')]();});}};}function handleEntityNotFound(_0x79a028,_0x24cc13){return function(_0x546b99){if(!_0x546b99){_0x79a028[_0xb885('0x15')](0x194);}return _0x546b99;};}function handleError(_0x2f2668,_0x386edc){_0x386edc=_0x386edc||0x1f4;return function(_0x53893a){logger['error'](_0x53893a['stack']);if(_0x53893a[_0xb885('0x21')]){delete _0x53893a[_0xb885('0x21')];}_0x2f2668[_0xb885('0x16')](_0x386edc)[_0xb885('0x22')](_0x53893a);};}exports[_0xb885('0x23')]=function(_0x582cbc,_0x30db9e){var _0x5964a4={},_0x3b3793={},_0x13cf69={'count':0x0,'rows':[]};var _0x2714c2=_[_0xb885('0x24')](db[_0xb885('0x25')][_0xb885('0x26')],function(_0x564ee4){return{'name':_0x564ee4['fieldName'],'type':_0x564ee4[_0xb885('0x27')]['key']};});_0x3b3793[_0xb885('0x28')]=_[_0xb885('0x24')](_0x2714c2,'name');_0x3b3793[_0xb885('0x29')]=_[_0xb885('0x2a')](_0x582cbc[_0xb885('0x29')]);_0x3b3793[_0xb885('0x2b')]=_[_0xb885('0x2c')](_0x3b3793['model'],_0x3b3793[_0xb885('0x29')]);_0x3b3793[_0xb885('0x2b')]=_['concat'](_0x3b3793[_0xb885('0x2b')],[_0xb885('0x2d'),'$or',_0xb885('0x2e'),_0xb885('0x2f'),_0xb885('0x30'),_0xb885('0x31'),_0xb885('0x32'),'$eq',_0xb885('0x33'),_0xb885('0x34'),_0xb885('0x35'),_0xb885('0x36'),_0xb885('0x37'),'$like',_0xb885('0x38'),_0xb885('0x39'),_0xb885('0x3a'),_0xb885('0x3b'),_0xb885('0x3c'),'$contains',_0xb885('0x3d'),_0xb885('0x3e')]);_0x5964a4['attributes']=_[_0xb885('0x2c')](_0x3b3793[_0xb885('0x28')],qs[_0xb885('0x3f')](_0x582cbc[_0xb885('0x29')][_0xb885('0x3f')]));_0x5964a4['attributes']=_0x5964a4['attributes'][_0xb885('0x40')]?_0x5964a4[_0xb885('0x41')]:_0x3b3793[_0xb885('0x28')];if(!_0x582cbc[_0xb885('0x29')]['hasOwnProperty'](_0xb885('0x42'))){_0x5964a4[_0xb885('0x43')]=qs[_0xb885('0x43')](_0x582cbc[_0xb885('0x29')]['limit']);_0x5964a4[_0xb885('0x18')]=qs[_0xb885('0x18')](_0x582cbc[_0xb885('0x29')][_0xb885('0x18')]);}_0x5964a4[_0xb885('0x44')]=qs[_0xb885('0x45')](_0x582cbc['query'][_0xb885('0x45')]);_0x5964a4[_0xb885('0x46')]=qs[_0xb885('0x2b')](_['pick'](_0x582cbc[_0xb885('0x29')],_0x3b3793['filters']),_0x2714c2);if(_0x582cbc[_0xb885('0x29')][_0xb885('0x47')]){_0x5964a4[_0xb885('0x46')]=_[_0xb885('0x48')](_0x5964a4['where'],{'$or':_['map'](_0x2714c2,function(_0x1c64c2){if(_0x1c64c2['type']!==_0xb885('0x49')){var _0x3c25a4={};_0x3c25a4[_0x1c64c2[_0xb885('0x21')]]={'$like':'%'+_0x582cbc[_0xb885('0x29')][_0xb885('0x47')]+'%'};return _0x3c25a4;}})});}_0x5964a4=_[_0xb885('0x48')]({},_0x5964a4,_0x582cbc[_0xb885('0x4a')]);var _0x669c7f={'where':_0x5964a4[_0xb885('0x46')]};return db[_0xb885('0x25')][_0xb885('0x17')](_0x669c7f)[_0xb885('0x1f')](function(_0x5750fa){_0x13cf69[_0xb885('0x17')]=_0x5750fa;if(_0x582cbc['query'][_0xb885('0x4b')]){_0x5964a4[_0xb885('0x4c')]=[{'all':!![]}];}return db[_0xb885('0x25')][_0xb885('0x4d')](_0x5964a4);})[_0xb885('0x1f')](function(_0x2994c1){_0x13cf69[_0xb885('0x4e')]=_0x2994c1;return _0x13cf69;})[_0xb885('0x1f')](respondWithFilteredResult(_0x30db9e,_0x5964a4))[_0xb885('0x4f')](handleError(_0x30db9e,null));};exports['show']=function(_0x58a7d4,_0x3b5832){var _0xc559d1={'raw':!![],'where':{'id':_0x58a7d4[_0xb885('0x50')]['id']}},_0xcf64c1={};_0xcf64c1['model']=_[_0xb885('0x2a')](db[_0xb885('0x25')][_0xb885('0x26')]);_0xcf64c1[_0xb885('0x29')]=_[_0xb885('0x2a')](_0x58a7d4[_0xb885('0x29')]);_0xcf64c1[_0xb885('0x2b')]=_[_0xb885('0x2c')](_0xcf64c1[_0xb885('0x28')],_0xcf64c1[_0xb885('0x29')]);_0xc559d1[_0xb885('0x41')]=_[_0xb885('0x2c')](_0xcf64c1[_0xb885('0x28')],qs[_0xb885('0x3f')](_0x58a7d4[_0xb885('0x29')][_0xb885('0x3f')]));_0xc559d1[_0xb885('0x41')]=_0xc559d1['attributes'][_0xb885('0x40')]?_0xc559d1[_0xb885('0x41')]:_0xcf64c1[_0xb885('0x28')];if(_0x58a7d4[_0xb885('0x29')][_0xb885('0x4b')]){_0xc559d1[_0xb885('0x4c')]=[{'all':!![]}];}_0xc559d1=_[_0xb885('0x48')]({},_0xc559d1,_0x58a7d4[_0xb885('0x4a')]);return db['CmHopper']['find'](_0xc559d1)['then'](handleEntityNotFound(_0x3b5832,null))[_0xb885('0x1f')](respondWithResult(_0x3b5832,null))['catch'](handleError(_0x3b5832,null));};exports[_0xb885('0x51')]=function(_0x38c484,_0x359faa){return db[_0xb885('0x25')][_0xb885('0x51')](_0x38c484[_0xb885('0x52')],{})[_0xb885('0x1f')](respondWithResult(_0x359faa,0xc9))[_0xb885('0x4f')](handleError(_0x359faa,null));};exports['update']=function(_0xe0dfae,_0x1d71e6){if(_0xe0dfae[_0xb885('0x52')]['id']){delete _0xe0dfae[_0xb885('0x52')]['id'];}return db[_0xb885('0x25')][_0xb885('0x53')]({'where':{'id':_0xe0dfae[_0xb885('0x50')]['id']}})[_0xb885('0x1f')](handleEntityNotFound(_0x1d71e6,null))['then'](saveUpdates(_0xe0dfae[_0xb885('0x52')],null))[_0xb885('0x1f')](respondWithResult(_0x1d71e6,null))[_0xb885('0x4f')](handleError(_0x1d71e6,null));};exports[_0xb885('0x54')]=function(_0x48bc25,_0x52ac7e){return db['CmHopper'][_0xb885('0x54')]()['then'](respondWithResult(_0x52ac7e,null))['catch'](handleError(_0x52ac7e,null));};exports[_0xb885('0x1e')]=function(_0x572d48,_0x1eabd3){var _0x17c941;return db['CmHopper']['find']({'where':{'id':_0x572d48[_0xb885('0x50')]['id']}})[_0xb885('0x1f')](handleEntityNotFound(_0x1eabd3,null))[_0xb885('0x1f')](function(_0x14827a){if(_0x14827a){return _0x14827a[_0xb885('0x1e')]()['then'](function(_0x3a3d8f){return _0x3a3d8f;});}})['then'](function(_0x277b56){_0x17c941=_0x277b56;if(_0x277b56){if(_0x277b56[_0xb885('0x55')]||_0x277b56['CampaignId']){return db[_0x277b56[_0xb885('0x55')]?_0xb885('0x56'):_0xb885('0x57')]['find']({'where':{'id':_0x277b56['VoiceQueueId']?_0x277b56['VoiceQueueId']:_0x277b56[_0xb885('0x58')]},'attributes':['id','name'],'raw':!![]});}}})[_0xb885('0x1f')](function(_0x5a54dd){var _0x511940={};if(_0x5a54dd){_[_0xb885('0x48')](_0x511940,_['omit'](_0x17c941[_0xb885('0x59')],[_0xb885('0x5a'),_0xb885('0x5b'),'id']));_0x511940['state']=0x15;_0x511940['statedesc']=_0xb885('0x5c');_0x511940[_0xb885('0x5d')]=_0x5a54dd[_0xb885('0x21')];_0x511940[_0xb885('0x5e')]=_0x572d48[_0xb885('0x5f')][_0xb885('0x21')];_0x511940[_0xb885('0x60')]=_0x572d48[_0xb885('0x5f')]['id'];_0x511940[_0xb885('0x5c')]=!![];_0x511940[_0xb885('0x61')]=moment()[_0xb885('0x62')](_0xb885('0x63'));_0x511940[_0xb885('0x64')]=_0x17c941[_0xb885('0x65')];_0x511940[_0xb885('0x66')]=_0x17c941[_0xb885('0x55')]?_0xb885('0x67'):_0xb885('0x68');return db['CmContact'][_0xb885('0x53')]({'where':{'id':_0x511940[_0xb885('0x69')]},'attributes':['firstName',_0xb885('0x6a')]})['then'](function(_0x13d760){if(!_[_0xb885('0x6b')](_0x1eabd3)&&!_[_0xb885('0x6b')](_0x13d760[_0xb885('0x6c')])){_0x511940[_0xb885('0x6d')]=_0x13d760[_0xb885('0x6c')];if(!_[_0xb885('0x6b')](_0x13d760[_0xb885('0x6a')])){_0x511940[_0xb885('0x6d')]+='\x20'+_0x13d760[_0xb885('0x6a')];}}})[_0xb885('0x6e')](function(){return db['CmHopperFinal'][_0xb885('0x51')](_0x511940);});}})[_0xb885('0x1f')](function(){return _0x1eabd3[_0xb885('0x16')](0xcc)['end']();})[_0xb885('0x4f')](handleError(_0x1eabd3,null));};exports[_0xb885('0x6f')]=function(_0xb2a5,_0xc4cd5c,_0x1f8522){var _0x251405=[];return db['CmContact'][_0xb885('0x54')]()[_0xb885('0x1f')](function(_0xa6fbd3){_0x251405=_[_0xb885('0x2a')](_0xa6fbd3);return _0xb2a5[_0xb885('0x5f')][_0xb885('0x70')]({'where':{'type':_0xb885('0x71'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xb885('0x72')],'raw':!![]});})[_0xb885('0x1f')](function(_0x1ea163){if(_0x1ea163&&_0x1ea163['length']){return db[_0xb885('0x73')][_0xb885('0x74')](function(_0x4fc1a3){var _0x21a127={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xb885('0x62')](_0xb885('0x63'))},'VoiceQueueId':{'$in':_['map'](_0x1ea163,'id')},'$or':[{'UserId':null},{'UserId':_0xb2a5[_0xb885('0x5f')]['id']}]};var _0x2ad9b5=[];if(_0xb2a5['body']['direction']&&_0xb2a5[_0xb885('0x52')][_0xb885('0x75')]===_0xb885('0x76')){if(!_[_0xb885('0x77')](_0xb2a5[_0xb885('0x52')][_0xb885('0x78')])){_0x21a127['id']={'$in':_0xb2a5[_0xb885('0x52')]['hopperIds']};}_0x2ad9b5=[[_0xb885('0x79'),_0xb885('0x7a')],['scheduledAt',_0x1ea163[0x0][_0xb885('0x72')]===_0xb885('0x7a')?_0xb885('0x7b'):_0xb885('0x7a')],db['sequelize'][_0xb885('0x7c')](_0xb885('0x7d')),['id',_0xb885('0x7b')]];}else{if(!_[_0xb885('0x77')](_0xb2a5[_0xb885('0x52')][_0xb885('0x78')])){_0x21a127['id']={'$notIn':_0xb2a5[_0xb885('0x52')][_0xb885('0x78')]};}_0x2ad9b5=[[_0xb885('0x79'),'DESC'],['scheduledAt',_0x1ea163[0x0][_0xb885('0x72')]],db[_0xb885('0x73')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xb885('0x7a')]];}return db[_0xb885('0x25')][_0xb885('0x7e')]({'attributes':['id','scheduledat'],'where':_0x21a127,'order':_0x2ad9b5,'transaction':_0x4fc1a3,'lock':_0x4fc1a3[_0xb885('0x7f')][_0xb885('0x80')],'include':[{'model':db[_0xb885('0x81')],'as':'Contact','attributes':_0x251405,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0xb885('0x21')]}]},{'model':db[_0xb885('0x82')],'as':_0xb885('0x83'),'attributes':['id',_0xb885('0x21')]},{'model':db[_0xb885('0x56')],'as':_0xb885('0x84'),'attributes':['id',_0xb885('0x21'),_0xb885('0x85')]}]})[_0xb885('0x1f')](function(_0x57ec38){if(_0x57ec38){return _0x57ec38[_0xb885('0x86')]({'UserId':_0xb2a5[_0xb885('0x5f')]['id']},{'transaction':_0x4fc1a3});}});});}})[_0xb885('0x1f')](handleEntityNotFound(_0xc4cd5c,null))[_0xb885('0x1f')](respondWithResult(_0xc4cd5c,null))['catch'](handleError(_0xc4cd5c,null));};exports['getOpenContacts']=function(_0x36b488,_0x1a1ff3,_0x569892){return _0x36b488[_0xb885('0x5f')][_0xb885('0x70')]({'where':{'type':_0xb885('0x71'),'dialActive':!![],'dialMethod':_0xb885('0x87')},'attributes':['id'],'raw':!![]})['then'](function(_0x3a5aa5){if(_0x3a5aa5&&_0x3a5aa5[_0xb885('0x40')]){return db[_0xb885('0x25')][_0xb885('0x17')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xb885('0x24')](_0x3a5aa5,'id')},'$or':[{'UserId':null},{'UserId':_0x36b488[_0xb885('0x5f')]['id']}]}});}return 0x0;})[_0xb885('0x1f')](function(_0x37d144){if(!_[_0xb885('0x6b')](_0x37d144)&&_[_0xb885('0x88')](_0x37d144)){return _0x1a1ff3[_0xb885('0x16')](0xc8)['json']({'contacts':_0x37d144});}else{logger[_0xb885('0x89')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xb885('0x8a'),0x194,_0xb885('0x8b'));_0x1a1ff3[_0xb885('0x15')](0x194);}})[_0xb885('0x4f')](handleError(_0x1a1ff3,null));}; \ No newline at end of file +var _0x69df=['prev','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','UPDATE','Contact','CmCompany','Company','CmList','VoiceQueue','Queue','getOpenContacts','outbound','preview','error','CmHopper,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','name','send','index','CmHopper','fieldName','type','key','model','map','query','keys','filters','intersection','$and','$or','$gt','$lt','$lte','$ne','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','update','describe','VoiceQueueId','CampaignId','Campaign','createdAt','state','deleted','campaign','membername','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal','getPreview','CmContact','user','getVoiceQueues','dialOrderByScheduledAt','sequelize','direction'];(function(_0x11400a,_0x22416d){var _0x5a655b=function(_0x30631d){while(--_0x30631d){_0x11400a['push'](_0x11400a['shift']());}};_0x5a655b(++_0x22416d);}(_0x69df,0xa2));var _0xf69d=function(_0x3c1309,_0x66e161){_0x3c1309=_0x3c1309-0x0;var _0x4b71bf=_0x69df[_0x3c1309];return _0x4b71bf;};'use strict';var pdf=require(_0xf69d('0x0'));var emlformat=require(_0xf69d('0x1'));var rimraf=require(_0xf69d('0x2'));var zipdir=require(_0xf69d('0x3'));var jsonpatch=require(_0xf69d('0x4'));var rp=require('request-promise');var moment=require(_0xf69d('0x5'));var BPromise=require(_0xf69d('0x6'));var Mustache=require(_0xf69d('0x7'));var util=require('util');var path=require(_0xf69d('0x8'));var sox=require(_0xf69d('0x9'));var csv=require(_0xf69d('0xa'));var ejs=require(_0xf69d('0xb'));var fs=require('fs');var _=require(_0xf69d('0xc'));var squel=require(_0xf69d('0xd'));var crypto=require(_0xf69d('0xe'));var jsforce=require(_0xf69d('0xf'));var deskjs=require(_0xf69d('0x10'));var toCsv=require(_0xf69d('0xa'));var querystring=require(_0xf69d('0x11'));var Papa=require(_0xf69d('0x12'));var Redis=require(_0xf69d('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf69d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf69d('0x15'))(_0xf69d('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x366e10,_0x37910c){_0x37910c=_0x37910c||0xcc;return function(_0x4a45eb){if(_0x4a45eb){return _0x366e10[_0xf69d('0x17')](_0x37910c);}return _0x366e10[_0xf69d('0x18')](_0x37910c)['end']();};}function respondWithResult(_0x130ee3,_0x37024b){_0x37024b=_0x37024b||0xc8;return function(_0x4a1e0a){if(_0x4a1e0a){return _0x130ee3[_0xf69d('0x18')](_0x37024b)[_0xf69d('0x19')](_0x4a1e0a);}};}function respondWithFilteredResult(_0x99a7b5,_0x25324e){return function(_0x34fced){if(_0x34fced){var _0x2c2cfe=_0x34fced[_0xf69d('0x1a')],_0x3856a0=_0x25324e[_0xf69d('0x1b')],_0x1d48c1=_0x25324e[_0xf69d('0x1b')]+_0x25324e['limit'],_0x18d6ec;if(_0x1d48c1>=_0x2c2cfe){_0x1d48c1=_0x2c2cfe;_0x18d6ec=0xc8;}else{_0x18d6ec=0xce;}_0x99a7b5[_0xf69d('0x18')](_0x18d6ec);return _0x99a7b5[_0xf69d('0x1c')](_0xf69d('0x1d'),_0x3856a0+'-'+_0x1d48c1+'/'+_0x2c2cfe)[_0xf69d('0x19')](_0x34fced);}return null;};}function patchUpdates(_0x5cf8b2){return function(_0x5c115c){try{jsonpatch[_0xf69d('0x1e')](_0x5c115c,_0x5cf8b2,!![]);}catch(_0x185089){return BPromise[_0xf69d('0x1f')](_0x185089);}return _0x5c115c[_0xf69d('0x20')]();};}function saveUpdates(_0x2dafc1,_0x2db490){return function(_0x4c6846){if(_0x4c6846){return _0x4c6846['update'](_0x2dafc1)[_0xf69d('0x21')](function(_0x4383f1){return _0x4383f1;});}return null;};}function removeEntity(_0x473aab,_0x4ae0cd){return function(_0x1352d4){if(_0x1352d4){return _0x1352d4[_0xf69d('0x22')]()[_0xf69d('0x21')](function(){_0x473aab['status'](0xcc)[_0xf69d('0x23')]();});}};}function handleEntityNotFound(_0x2863ec,_0x5bded8){return function(_0x45a4b5){if(!_0x45a4b5){_0x2863ec[_0xf69d('0x17')](0x194);}return _0x45a4b5;};}function handleError(_0x117584,_0x3e59ce){_0x3e59ce=_0x3e59ce||0x1f4;return function(_0xf0bc90){logger['error'](_0xf0bc90['stack']);if(_0xf0bc90['name']){delete _0xf0bc90[_0xf69d('0x24')];}_0x117584[_0xf69d('0x18')](_0x3e59ce)[_0xf69d('0x25')](_0xf0bc90);};}exports[_0xf69d('0x26')]=function(_0x562a58,_0x3707d4){var _0x3cdd5c={},_0x4140d7={},_0x20484a={'count':0x0,'rows':[]};var _0x402c05=_['map'](db[_0xf69d('0x27')]['rawAttributes'],function(_0x3cfc5c){return{'name':_0x3cfc5c[_0xf69d('0x28')],'type':_0x3cfc5c[_0xf69d('0x29')][_0xf69d('0x2a')]};});_0x4140d7[_0xf69d('0x2b')]=_[_0xf69d('0x2c')](_0x402c05,_0xf69d('0x24'));_0x4140d7[_0xf69d('0x2d')]=_[_0xf69d('0x2e')](_0x562a58['query']);_0x4140d7[_0xf69d('0x2f')]=_[_0xf69d('0x30')](_0x4140d7['model'],_0x4140d7[_0xf69d('0x2d')]);_0x4140d7['filters']=_['concat'](_0x4140d7[_0xf69d('0x2f')],[_0xf69d('0x31'),_0xf69d('0x32'),_0xf69d('0x33'),'$gte',_0xf69d('0x34'),_0xf69d('0x35'),_0xf69d('0x36'),'$eq',_0xf69d('0x37'),'$between',_0xf69d('0x38'),_0xf69d('0x39'),_0xf69d('0x3a'),_0xf69d('0x3b'),_0xf69d('0x3c'),_0xf69d('0x3d'),'$notILike',_0xf69d('0x3b'),_0xf69d('0x3e'),_0xf69d('0x3f'),_0xf69d('0x40'),'$any']);_0x3cdd5c['attributes']=_[_0xf69d('0x30')](_0x4140d7['model'],qs[_0xf69d('0x41')](_0x562a58['query'][_0xf69d('0x41')]));_0x3cdd5c['attributes']=_0x3cdd5c[_0xf69d('0x42')]['length']?_0x3cdd5c[_0xf69d('0x42')]:_0x4140d7['model'];if(!_0x562a58[_0xf69d('0x2d')][_0xf69d('0x43')](_0xf69d('0x44'))){_0x3cdd5c[_0xf69d('0x45')]=qs[_0xf69d('0x45')](_0x562a58[_0xf69d('0x2d')][_0xf69d('0x45')]);_0x3cdd5c['offset']=qs[_0xf69d('0x1b')](_0x562a58[_0xf69d('0x2d')][_0xf69d('0x1b')]);}_0x3cdd5c[_0xf69d('0x46')]=qs[_0xf69d('0x47')](_0x562a58[_0xf69d('0x2d')]['sort']);_0x3cdd5c[_0xf69d('0x48')]=qs[_0xf69d('0x2f')](_[_0xf69d('0x49')](_0x562a58[_0xf69d('0x2d')],_0x4140d7[_0xf69d('0x2f')]),_0x402c05);if(_0x562a58['query'][_0xf69d('0x4a')]){_0x3cdd5c[_0xf69d('0x48')]=_['merge'](_0x3cdd5c[_0xf69d('0x48')],{'$or':_[_0xf69d('0x2c')](_0x402c05,function(_0x53045e){if(_0x53045e[_0xf69d('0x29')]!==_0xf69d('0x4b')){var _0x5deec5={};_0x5deec5[_0x53045e[_0xf69d('0x24')]]={'$like':'%'+_0x562a58[_0xf69d('0x2d')][_0xf69d('0x4a')]+'%'};return _0x5deec5;}})});}_0x3cdd5c=_[_0xf69d('0x4c')]({},_0x3cdd5c,_0x562a58[_0xf69d('0x4d')]);var _0x58c6f7={'where':_0x3cdd5c[_0xf69d('0x48')]};return db[_0xf69d('0x27')]['count'](_0x58c6f7)[_0xf69d('0x21')](function(_0x1b11ea){_0x20484a[_0xf69d('0x1a')]=_0x1b11ea;if(_0x562a58[_0xf69d('0x2d')]['includeAll']){_0x3cdd5c[_0xf69d('0x4e')]=[{'all':!![]}];}return db[_0xf69d('0x27')][_0xf69d('0x4f')](_0x3cdd5c);})[_0xf69d('0x21')](function(_0x2f51fe){_0x20484a[_0xf69d('0x50')]=_0x2f51fe;return _0x20484a;})['then'](respondWithFilteredResult(_0x3707d4,_0x3cdd5c))[_0xf69d('0x51')](handleError(_0x3707d4,null));};exports[_0xf69d('0x52')]=function(_0x9c8b8d,_0x25d124){var _0x1f884a={'raw':!![],'where':{'id':_0x9c8b8d[_0xf69d('0x53')]['id']}},_0x2912bf={};_0x2912bf[_0xf69d('0x2b')]=_[_0xf69d('0x2e')](db[_0xf69d('0x27')][_0xf69d('0x54')]);_0x2912bf[_0xf69d('0x2d')]=_[_0xf69d('0x2e')](_0x9c8b8d[_0xf69d('0x2d')]);_0x2912bf[_0xf69d('0x2f')]=_[_0xf69d('0x30')](_0x2912bf[_0xf69d('0x2b')],_0x2912bf[_0xf69d('0x2d')]);_0x1f884a[_0xf69d('0x42')]=_[_0xf69d('0x30')](_0x2912bf[_0xf69d('0x2b')],qs[_0xf69d('0x41')](_0x9c8b8d['query'][_0xf69d('0x41')]));_0x1f884a[_0xf69d('0x42')]=_0x1f884a[_0xf69d('0x42')][_0xf69d('0x55')]?_0x1f884a[_0xf69d('0x42')]:_0x2912bf[_0xf69d('0x2b')];if(_0x9c8b8d[_0xf69d('0x2d')]['includeAll']){_0x1f884a[_0xf69d('0x4e')]=[{'all':!![]}];}_0x1f884a=_[_0xf69d('0x4c')]({},_0x1f884a,_0x9c8b8d[_0xf69d('0x4d')]);return db[_0xf69d('0x27')][_0xf69d('0x56')](_0x1f884a)[_0xf69d('0x21')](handleEntityNotFound(_0x25d124,null))[_0xf69d('0x21')](respondWithResult(_0x25d124,null))['catch'](handleError(_0x25d124,null));};exports['create']=function(_0x1c0820,_0x3c8049){return db[_0xf69d('0x27')][_0xf69d('0x57')](_0x1c0820[_0xf69d('0x58')],{})['then'](respondWithResult(_0x3c8049,0xc9))['catch'](handleError(_0x3c8049,null));};exports[_0xf69d('0x59')]=function(_0x33f8c4,_0x5cab15){if(_0x33f8c4[_0xf69d('0x58')]['id']){delete _0x33f8c4[_0xf69d('0x58')]['id'];}return db[_0xf69d('0x27')][_0xf69d('0x56')]({'where':{'id':_0x33f8c4[_0xf69d('0x53')]['id']}})['then'](handleEntityNotFound(_0x5cab15,null))[_0xf69d('0x21')](saveUpdates(_0x33f8c4[_0xf69d('0x58')],null))['then'](respondWithResult(_0x5cab15,null))['catch'](handleError(_0x5cab15,null));};exports[_0xf69d('0x5a')]=function(_0x2a053e,_0x367c27){return db['CmHopper'][_0xf69d('0x5a')]()[_0xf69d('0x21')](respondWithResult(_0x367c27,null))[_0xf69d('0x51')](handleError(_0x367c27,null));};exports['destroy']=function(_0x2badd6,_0x7a901a){var _0x183190;return db['CmHopper'][_0xf69d('0x56')]({'where':{'id':_0x2badd6[_0xf69d('0x53')]['id']}})[_0xf69d('0x21')](handleEntityNotFound(_0x7a901a,null))['then'](function(_0x810fb){if(_0x810fb){return _0x810fb[_0xf69d('0x22')]()[_0xf69d('0x21')](function(_0x55d688){return _0x55d688;});}})[_0xf69d('0x21')](function(_0x3dea1e){_0x183190=_0x3dea1e;if(_0x3dea1e){if(_0x3dea1e[_0xf69d('0x5b')]||_0x3dea1e[_0xf69d('0x5c')]){return db[_0x3dea1e['VoiceQueueId']?'VoiceQueue':_0xf69d('0x5d')][_0xf69d('0x56')]({'where':{'id':_0x3dea1e[_0xf69d('0x5b')]?_0x3dea1e[_0xf69d('0x5b')]:_0x3dea1e[_0xf69d('0x5c')]},'attributes':['id','name'],'raw':!![]});}}})[_0xf69d('0x21')](function(_0x27e662){var _0x14aafe={};if(_0x27e662){_[_0xf69d('0x4c')](_0x14aafe,_['omit'](_0x183190['dataValues'],[_0xf69d('0x5e'),'updatedAt','id']));_0x14aafe[_0xf69d('0x5f')]=0x15;_0x14aafe['statedesc']=_0xf69d('0x60');_0x14aafe[_0xf69d('0x61')]=_0x27e662['name'];_0x14aafe[_0xf69d('0x62')]=_0x2badd6['user']['name'];_0x14aafe['UserId']=_0x2badd6['user']['id'];_0x14aafe['deleted']=!![];_0x14aafe[_0xf69d('0x63')]=moment()[_0xf69d('0x64')](_0xf69d('0x65'));_0x14aafe[_0xf69d('0x66')]=_0x183190[_0xf69d('0x67')];_0x14aafe[_0xf69d('0x68')]=_0x183190['VoiceQueueId']?'queue':'ivr';return db['CmContact'][_0xf69d('0x56')]({'where':{'id':_0x14aafe[_0xf69d('0x69')]},'attributes':['firstName',_0xf69d('0x6a')]})[_0xf69d('0x21')](function(_0x215127){if(!_['isNil'](_0x7a901a)&&!_[_0xf69d('0x6b')](_0x215127[_0xf69d('0x6c')])){_0x14aafe[_0xf69d('0x6d')]=_0x215127['firstName'];if(!_[_0xf69d('0x6b')](_0x215127['lastName'])){_0x14aafe[_0xf69d('0x6d')]+='\x20'+_0x215127[_0xf69d('0x6a')];}}})['finally'](function(){return db[_0xf69d('0x6e')][_0xf69d('0x57')](_0x14aafe);});}})[_0xf69d('0x21')](function(){return _0x7a901a[_0xf69d('0x18')](0xcc)[_0xf69d('0x23')]();})['catch'](handleError(_0x7a901a,null));};exports[_0xf69d('0x6f')]=function(_0x1e7833,_0x4f17a3,_0x408193){var _0x44c085=[];return db[_0xf69d('0x70')]['describe']()[_0xf69d('0x21')](function(_0x5b81f5){_0x44c085=_[_0xf69d('0x2e')](_0x5b81f5);return _0x1e7833[_0xf69d('0x71')][_0xf69d('0x72')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xf69d('0x73')],'raw':!![]});})[_0xf69d('0x21')](function(_0x1113ee){if(_0x1113ee&&_0x1113ee[_0xf69d('0x55')]){return db[_0xf69d('0x74')]['transaction'](function(_0x15eb5f){var _0x4c32fc={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf69d('0x64')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xf69d('0x2c')](_0x1113ee,'id')},'$or':[{'UserId':null},{'UserId':_0x1e7833[_0xf69d('0x71')]['id']}]};var _0x11eadf=[];if(_0x1e7833[_0xf69d('0x58')][_0xf69d('0x75')]&&_0x1e7833[_0xf69d('0x58')][_0xf69d('0x75')]===_0xf69d('0x76')){if(!_[_0xf69d('0x77')](_0x1e7833[_0xf69d('0x58')]['hopperIds'])){_0x4c32fc['id']={'$in':_0x1e7833[_0xf69d('0x58')][_0xf69d('0x78')]};}_0x11eadf=[[_0xf69d('0x79'),'ASC'],[_0xf69d('0x7a'),_0x1113ee[0x0][_0xf69d('0x73')]===_0xf69d('0x7b')?_0xf69d('0x7c'):_0xf69d('0x7b')],db[_0xf69d('0x74')][_0xf69d('0x7d')](_0xf69d('0x7e')),['id',_0xf69d('0x7c')]];}else{if(!_[_0xf69d('0x77')](_0x1e7833[_0xf69d('0x58')][_0xf69d('0x78')])){_0x4c32fc['id']={'$notIn':_0x1e7833[_0xf69d('0x58')][_0xf69d('0x78')]};}_0x11eadf=[[_0xf69d('0x79'),_0xf69d('0x7c')],[_0xf69d('0x7a'),_0x1113ee[0x0][_0xf69d('0x73')]],db[_0xf69d('0x74')][_0xf69d('0x7d')](_0xf69d('0x7f')),['id','ASC']];}return db['CmHopper']['findOne']({'attributes':['id','scheduledat'],'where':_0x4c32fc,'order':_0x11eadf,'transaction':_0x15eb5f,'lock':_0x15eb5f['LOCK'][_0xf69d('0x80')],'include':[{'model':db[_0xf69d('0x70')],'as':_0xf69d('0x81'),'attributes':_0x44c085,'include':[{'model':db[_0xf69d('0x82')],'as':_0xf69d('0x83'),'attributes':['id',_0xf69d('0x24')]}]},{'model':db[_0xf69d('0x84')],'as':'List','attributes':['id','name']},{'model':db[_0xf69d('0x85')],'as':_0xf69d('0x86'),'attributes':['id',_0xf69d('0x24'),'dialActive']}]})[_0xf69d('0x21')](function(_0x241ac6){if(_0x241ac6){return _0x241ac6[_0xf69d('0x59')]({'UserId':_0x1e7833[_0xf69d('0x71')]['id']},{'transaction':_0x15eb5f});}});});}})[_0xf69d('0x21')](handleEntityNotFound(_0x4f17a3,null))[_0xf69d('0x21')](respondWithResult(_0x4f17a3,null))[_0xf69d('0x51')](handleError(_0x4f17a3,null));};exports[_0xf69d('0x87')]=function(_0x18cc9a,_0x26f79a,_0x5e0db3){return _0x18cc9a['user'][_0xf69d('0x72')]({'where':{'type':_0xf69d('0x88'),'dialActive':!![],'dialMethod':_0xf69d('0x89')},'attributes':['id'],'raw':!![]})[_0xf69d('0x21')](function(_0x3b9755){if(_0x3b9755&&_0x3b9755[_0xf69d('0x55')]){return db[_0xf69d('0x27')][_0xf69d('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf69d('0x64')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xf69d('0x2c')](_0x3b9755,'id')},'$or':[{'UserId':null},{'UserId':_0x18cc9a['user']['id']}]}});}return 0x0;})['then'](function(_0x38d16f){if(!_[_0xf69d('0x6b')](_0x38d16f)&&_['isNumber'](_0x38d16f)){return _0x26f79a[_0xf69d('0x18')](0xc8)[_0xf69d('0x19')]({'contacts':_0x38d16f});}else{logger[_0xf69d('0x8a')](_0xf69d('0x8b'),_0xf69d('0x87'),0x194,'entity\x20not\x20found');_0x26f79a['sendStatus'](0x194);}})['catch'](handleError(_0x26f79a,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index b97c0f9..c71981f 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 _0x4903=['moment','path','rimraf','./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger'];(function(_0x1c93f5,_0x199600){var _0xee1c4f=function(_0x3bcd2b){while(--_0x3bcd2b){_0x1c93f5['push'](_0x1c93f5['shift']());}};_0xee1c4f(++_0x199600);}(_0x4903,0x128));var _0x3490=function(_0xb3e9a4,_0x1e98bb){_0xb3e9a4=_0xb3e9a4-0x0;var _0x4c0f16=_0x4903[_0xb3e9a4];return _0x4c0f16;};'use strict';var _=require(_0x3490('0x0'));var util=require(_0x3490('0x1'));var logger=require(_0x3490('0x2'))('api');var moment=require(_0x3490('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3490('0x4'));var rimraf=require(_0x3490('0x5'));var config=require('../../config/environment');var attributes=require(_0x3490('0x6'));module[_0x3490('0x7')]=function(_0x41221a,_0x320ede){return _0x41221a['define'](_0x3490('0x8'),attributes,{'tableName':_0x3490('0x9'),'paranoid':![],'indexes':[{'name':_0x3490('0xa'),'fields':[_0x3490('0xa')]},{'name':_0x3490('0xb'),'fields':['phone']},{'name':_0x3490('0xc'),'fields':[_0x3490('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4cc8=['bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x4cc8,0x91));var _0x84cc=function(_0x95180f,_0x26fbf7){_0x95180f=_0x95180f-0x0;var _0x19a217=_0x4cc8[_0x95180f];return _0x19a217;};'use strict';var _=require(_0x84cc('0x0'));var util=require(_0x84cc('0x1'));var logger=require(_0x84cc('0x2'))(_0x84cc('0x3'));var moment=require(_0x84cc('0x4'));var BPromise=require(_0x84cc('0x5'));var rp=require(_0x84cc('0x6'));var fs=require('fs');var path=require(_0x84cc('0x7'));var rimraf=require(_0x84cc('0x8'));var config=require('../../config/environment');var attributes=require(_0x84cc('0x9'));module[_0x84cc('0xa')]=function(_0x2317b4,_0x2d8829){return _0x2317b4['define']('CmHopper',attributes,{'tableName':_0x84cc('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x84cc('0xc')]},{'name':_0x84cc('0xd'),'fields':['phone']},{'name':_0x84cc('0xe'),'fields':[_0x84cc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 63a0490..cd1a738 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 _0x8e28=['Contact','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','catch','options','where','limit','include','map','model','attributes','GetCmHopper','ShowCmHopper','CmHopper','find','raw','CreateCmHopper','create','body','UpdateCmHopper','DestroyCmHopper','CmContact','describe','transaction','findAll','order','UPDATE','keys','User','Agent','name','voicePause','length','UserId','update','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','`scheduledat`\x20>=\x20','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','push','GetCmHopperPreview'];(function(_0x3750c,_0x24a144){var _0x4e5930=function(_0x1373bd){while(--_0x1373bd){_0x3750c['push'](_0x3750c['shift']());}};_0x4e5930(++_0x24a144);}(_0x8e28,0xc7));var _0x88e2=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x8e28[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require('lodash');var util=require(_0x88e2('0x0'));var moment=require(_0x88e2('0x1'));var BPromise=require(_0x88e2('0x2'));var rs=require(_0x88e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88e2('0x4'))['db'];var utils=require(_0x88e2('0x5'));var logger=require(_0x88e2('0x6'))(_0x88e2('0x7'));var config=require(_0x88e2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x88e2('0x9')][_0x88e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31b234,_0x578cb9,_0x1fd000){return new BPromise(function(_0x4cd2ef,_0x2f1880){return client['request'](_0x31b234,_0x1fd000)[_0x88e2('0xb')](function(_0xbf4a28){logger[_0x88e2('0xc')]('CmHopper,\x20%s,\x20%s',_0x578cb9,_0x88e2('0xd'));logger[_0x88e2('0xe')](_0x88e2('0xf'),_0x578cb9,_0x88e2('0xd'),JSON[_0x88e2('0x10')](_0xbf4a28));if(_0xbf4a28[_0x88e2('0x11')]){if(_0xbf4a28[_0x88e2('0x11')][_0x88e2('0x12')]===0x1f4){logger[_0x88e2('0x11')](_0x88e2('0x13'),_0x578cb9,_0xbf4a28[_0x88e2('0x11')][_0x88e2('0x14')]);return _0x2f1880(_0xbf4a28[_0x88e2('0x11')][_0x88e2('0x14')]);}logger[_0x88e2('0x11')](_0x88e2('0x13'),_0x578cb9,_0xbf4a28['error'][_0x88e2('0x14')]);return _0x4cd2ef(_0xbf4a28[_0x88e2('0x11')]['message']);}else{logger[_0x88e2('0xc')](_0x88e2('0x13'),_0x578cb9,_0x88e2('0xd'));_0x4cd2ef(_0xbf4a28['result'][_0x88e2('0x14')]);}})[_0x88e2('0x15')](function(_0x12b0e){logger[_0x88e2('0x11')](_0x88e2('0x13'),_0x578cb9,_0x12b0e);_0x2f1880(_0x12b0e);});});}exports['GetCmHopper']=function(_0x19cdc0){var _0x176f57=this;return new Promise(function(_0x42436f,_0x5d745b){return db['CmHopper']['findAll']({'raw':_0x19cdc0[_0x88e2('0x16')]?_0x19cdc0[_0x88e2('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x19cdc0[_0x88e2('0x16')]?_0x19cdc0[_0x88e2('0x16')][_0x88e2('0x17')]||null:null,'attributes':_0x19cdc0[_0x88e2('0x16')]?_0x19cdc0[_0x88e2('0x16')]['attributes']||null:null,'limit':_0x19cdc0['options']?_0x19cdc0[_0x88e2('0x16')][_0x88e2('0x18')]||null:null,'include':_0x19cdc0[_0x88e2('0x16')]?_0x19cdc0[_0x88e2('0x16')][_0x88e2('0x19')]?_[_0x88e2('0x1a')](_0x19cdc0[_0x88e2('0x16')][_0x88e2('0x19')],function(_0x52cc92){return{'model':db[_0x52cc92[_0x88e2('0x1b')]],'as':_0x52cc92['as'],'attributes':_0x52cc92[_0x88e2('0x1c')],'include':_0x52cc92[_0x88e2('0x19')]?_[_0x88e2('0x1a')](_0x52cc92[_0x88e2('0x19')],function(_0x351902){return{'model':db[_0x351902[_0x88e2('0x1b')]],'as':_0x351902['as'],'attributes':_0x351902['attributes'],'include':_0x351902[_0x88e2('0x19')]?_[_0x88e2('0x1a')](_0x351902[_0x88e2('0x19')],function(_0x382a3f){return{'model':db[_0x382a3f['model']],'as':_0x382a3f['as'],'attributes':_0x382a3f[_0x88e2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x88e2('0xb')](function(_0x48d84){logger[_0x88e2('0xc')](_0x88e2('0x1d'),_0x19cdc0);logger[_0x88e2('0xe')](_0x88e2('0x1d'),_0x19cdc0,JSON['stringify'](_0x48d84));_0x42436f(_0x48d84);})[_0x88e2('0x15')](function(_0x3f21e2){logger[_0x88e2('0x11')](_0x88e2('0x1d'),_0x3f21e2['message'],_0x19cdc0);_0x5d745b(_0x176f57[_0x88e2('0x11')](0x1f4,_0x3f21e2[_0x88e2('0x14')]));});});};exports[_0x88e2('0x1e')]=function(_0x52dda7){var _0x15dc60=this;return new Promise(function(_0x421287,_0xa1200f){return db[_0x88e2('0x1f')][_0x88e2('0x20')]({'raw':_0x52dda7[_0x88e2('0x16')]?_0x52dda7[_0x88e2('0x16')][_0x88e2('0x21')]===undefined?!![]:![]:!![],'where':_0x52dda7['options']?_0x52dda7[_0x88e2('0x16')][_0x88e2('0x17')]||null:null,'attributes':_0x52dda7[_0x88e2('0x16')]?_0x52dda7[_0x88e2('0x16')][_0x88e2('0x1c')]||null:null,'include':_0x52dda7[_0x88e2('0x16')]?_0x52dda7[_0x88e2('0x16')][_0x88e2('0x19')]?_[_0x88e2('0x1a')](_0x52dda7[_0x88e2('0x16')]['include'],function(_0x48e43f){return{'model':db[_0x48e43f[_0x88e2('0x1b')]],'as':_0x48e43f['as'],'attributes':_0x48e43f[_0x88e2('0x1c')],'include':_0x48e43f[_0x88e2('0x19')]?_[_0x88e2('0x1a')](_0x48e43f[_0x88e2('0x19')],function(_0x483b2a){return{'model':db[_0x483b2a[_0x88e2('0x1b')]],'as':_0x483b2a['as'],'attributes':_0x483b2a[_0x88e2('0x1c')],'include':_0x483b2a[_0x88e2('0x19')]?_[_0x88e2('0x1a')](_0x483b2a[_0x88e2('0x19')],function(_0x26c877){return{'model':db[_0x26c877['model']],'as':_0x26c877['as'],'attributes':_0x26c877[_0x88e2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x88e2('0xb')](function(_0x110fcb){logger[_0x88e2('0xc')](_0x88e2('0x1e'),_0x52dda7);logger[_0x88e2('0xe')](_0x88e2('0x1e'),_0x52dda7,JSON[_0x88e2('0x10')](_0x110fcb));_0x421287(_0x110fcb);})[_0x88e2('0x15')](function(_0x168820){logger[_0x88e2('0x11')](_0x88e2('0x1e'),_0x168820['message'],_0x52dda7);_0xa1200f(_0x15dc60['error'](0x1f4,_0x168820['message']));});});};exports[_0x88e2('0x22')]=function(_0x5ca048){var _0x1faed2=this;return new Promise(function(_0x3a86b6,_0x4bf956){return db['CmHopper'][_0x88e2('0x23')](_0x5ca048[_0x88e2('0x24')],{'raw':_0x5ca048[_0x88e2('0x16')]?_0x5ca048[_0x88e2('0x16')][_0x88e2('0x21')]===undefined?!![]:![]:!![]})[_0x88e2('0xb')](function(_0x56354f){logger[_0x88e2('0xc')]('CreateCmHopper',_0x5ca048);logger[_0x88e2('0xe')](_0x88e2('0x22'),_0x5ca048,JSON['stringify'](_0x56354f));_0x3a86b6(_0x56354f);})[_0x88e2('0x15')](function(_0x36362f){logger['error'](_0x88e2('0x22'),_0x36362f[_0x88e2('0x14')],_0x5ca048);_0x4bf956(_0x1faed2[_0x88e2('0x11')](0x1f4,_0x36362f['message']));});});};exports[_0x88e2('0x25')]=function(_0x5254e1){var _0x18718d=this;return new Promise(function(_0xc839e2,_0x23e9f3){return db[_0x88e2('0x1f')]['update'](_0x5254e1[_0x88e2('0x24')],{'raw':_0x5254e1['options']?_0x5254e1['options'][_0x88e2('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5254e1[_0x88e2('0x16')]?_0x5254e1['options'][_0x88e2('0x17')]||null:null,'attributes':_0x5254e1[_0x88e2('0x16')]?_0x5254e1[_0x88e2('0x16')][_0x88e2('0x1c')]||null:null,'limit':_0x5254e1['options']?_0x5254e1[_0x88e2('0x16')]['limit']||null:null})[_0x88e2('0xb')](function(_0x2c0228){logger[_0x88e2('0xc')](_0x88e2('0x25'),_0x5254e1);logger[_0x88e2('0xe')](_0x88e2('0x25'),_0x5254e1,JSON[_0x88e2('0x10')](_0x2c0228));_0xc839e2(_0x2c0228);})[_0x88e2('0x15')](function(_0x4ca865){logger[_0x88e2('0x11')](_0x88e2('0x25'),_0x4ca865['message'],_0x5254e1);_0x23e9f3(_0x18718d[_0x88e2('0x11')](0x1f4,_0x4ca865[_0x88e2('0x14')]));});});};exports[_0x88e2('0x26')]=function(_0x496833){var _0x49026a=this;return new Promise(function(_0x2a728d,_0x15d8bf){return db['CmHopper']['destroy']({'where':_0x496833[_0x88e2('0x16')]?_0x496833[_0x88e2('0x16')][_0x88e2('0x17')]||null:null})[_0x88e2('0xb')](function(_0x59f386){logger['info'](_0x88e2('0x26'),_0x496833);logger[_0x88e2('0xe')](_0x88e2('0x26'),_0x496833,JSON[_0x88e2('0x10')](_0x59f386));_0x2a728d(_0x59f386);})[_0x88e2('0x15')](function(_0x252437){logger['error'](_0x88e2('0x26'),_0x252437[_0x88e2('0x14')],_0x496833);_0x15d8bf(_0x49026a[_0x88e2('0x11')](0x1f4,_0x252437[_0x88e2('0x14')]));});});};exports['GetContactDialer']=function(_0x5a91db){var _0x477c56=this;return new Promise(function(_0x4ad47f,_0x4ef641){return db[_0x88e2('0x27')][_0x88e2('0x28')]()['then'](function(_0x48959f){return db['sequelize'][_0x88e2('0x29')](function(_0x264f04){return db['CmHopper'][_0x88e2('0x2a')]({'where':_0x5a91db['options']?_0x5a91db['options'][_0x88e2('0x17')]||null:null,'attributes':_0x5a91db[_0x88e2('0x16')]?_0x5a91db['options'][_0x88e2('0x1c')]||null:null,'limit':_0x5a91db['options']?_0x5a91db[_0x88e2('0x16')]['limit']||null:null,'order':_0x5a91db[_0x88e2('0x16')]?_0x5a91db['options'][_0x88e2('0x2b')]||null:null,'transaction':_0x264f04,'lock':_0x264f04['LOCK'][_0x88e2('0x2c')],'include':[{'model':db[_0x88e2('0x27')],'as':'Contact','attributes':_[_0x88e2('0x2d')](_0x48959f)},{'model':db[_0x88e2('0x2e')],'as':_0x88e2('0x2f'),'attributes':['id',_0x88e2('0x30'),_0x88e2('0x31')]}]})[_0x88e2('0xb')](function(_0x97a7d6){var _0x453c64=[];var _0xeb99ee=[];for(var _0x120619=0x0;_0x120619<_0x97a7d6[_0x88e2('0x32')];_0x120619+=0x1){if(!_0xeb99ee['includes'](_0x97a7d6[_0x120619][_0x88e2('0x33')])){_0xeb99ee['push'](_0x97a7d6[_0x120619][_0x88e2('0x33')]);_0x453c64['push'](_0x97a7d6[_0x120619][_0x88e2('0x34')](_0x5a91db[_0x88e2('0x24')],{'transaction':_0x264f04}));}}return BPromise['all'](_0x453c64);});})[_0x88e2('0xb')](function(_0x1130ab){logger['info']('GetContactDialer',_0x5a91db);logger[_0x88e2('0xe')]('GetContactDialer',_0x5a91db,JSON[_0x88e2('0x10')](_0x1130ab));_0x4ad47f(_0x1130ab);})['catch'](function(_0x22ebd8){logger[_0x88e2('0x11')]('GetContactDialer',_0x22ebd8['message'],_0x5a91db);_0x4ef641(_0x477c56[_0x88e2('0x11')](0x1f4,_0x22ebd8[_0x88e2('0x14')]));});});});};exports[_0x88e2('0x35')]=function(_0x7128cf){var _0x48f900=this;return new Promise(function(_0x2f5644,_0x39f3df){return db[_0x88e2('0x36')][_0x88e2('0x29')](function(_0xa55778){return db[_0x88e2('0x37')][_0x88e2('0x23')](_0x7128cf[_0x88e2('0x24')],{'raw':_0x7128cf['options']?_0x7128cf[_0x88e2('0x16')][_0x88e2('0x21')]===undefined?!![]:![]:!![],'transaction':_0xa55778})[_0x88e2('0xb')](function(){return db[_0x88e2('0x1f')]['destroy']({'where':_0x7128cf[_0x88e2('0x16')]?_0x7128cf['options'][_0x88e2('0x17')]||null:null,'transaction':_0xa55778});});})[_0x88e2('0xb')](function(_0x416df1){logger[_0x88e2('0xc')](_0x88e2('0x35'),_0x7128cf);logger['debug']('MoveContactManagedDialer',_0x7128cf,JSON['stringify'](_0x416df1));_0x2f5644(_0x416df1);})['catch'](function(_0x46baf2){logger[_0x88e2('0x11')](_0x88e2('0x35'),_0x46baf2[_0x88e2('0x14')],_0x7128cf);_0x39f3df(_0x48f900[_0x88e2('0x11')](0x1f4,_0x46baf2[_0x88e2('0x14')]));});});};exports[_0x88e2('0x38')]=function(_0x68c3c3){var _0x2b7697=this;return new Promise(function(_0x2c83be,_0xa7d1ce){return db[_0x88e2('0x1f')][_0x88e2('0x2a')]({'raw':_0x68c3c3[_0x88e2('0x16')]?_0x68c3c3[_0x88e2('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x68c3c3['options']?_0x68c3c3[_0x88e2('0x16')][_0x88e2('0x17')]||null:null,'attributes':[[db[_0x88e2('0x36')]['fn']('COUNT',db[_0x88e2('0x36')]['fn']('IF',db[_0x88e2('0x36')]['literal'](_0x88e2('0x39')+util['format'](_0x88e2('0x3a'),moment()['format'](_0x88e2('0x3b')))+_0x88e2('0x3c')))),_0x88e2('0x3d')]]})[_0x88e2('0xb')](function(_0x3e7f7a){logger['info']('CountReScheduled',_0x68c3c3);logger['debug'](_0x88e2('0x38'),_0x68c3c3,JSON['stringify'](_0x3e7f7a));_0x2c83be(_0x3e7f7a);})[_0x88e2('0x15')](function(_0x53e0a1){logger[_0x88e2('0x11')]('CountReScheduled',_0x53e0a1[_0x88e2('0x14')],_0x68c3c3);_0xa7d1ce(_0x2b7697['error'](0x1f4,_0x53e0a1[_0x88e2('0x14')]));});});};exports[_0x88e2('0x3e')]=function(_0x384c07){var _0xb317e3=this;return new Promise(function(_0x5824d6,_0x530e4e){return db[_0x88e2('0x27')][_0x88e2('0x28')]()['then'](function(_0x1440a9){return db[_0x88e2('0x36')]['transaction'](function(_0x37707c){return db[_0x88e2('0x1f')]['findAll']({'where':_0x384c07[_0x88e2('0x16')]?_0x384c07['options'][_0x88e2('0x17')]||null:null,'attributes':_0x384c07['options']?_0x384c07[_0x88e2('0x16')][_0x88e2('0x1c')]||null:null,'limit':0x1,'order':_0x384c07[_0x88e2('0x16')]?_0x384c07[_0x88e2('0x16')]['order']||null:null,'group':db[_0x88e2('0x1f')]['UserId'],'transaction':_0x37707c,'lock':_0x37707c['LOCK']['UPDATE'],'include':_0x384c07['options']?_0x384c07['options'][_0x88e2('0x19')]?_[_0x88e2('0x1a')](_0x384c07[_0x88e2('0x16')][_0x88e2('0x19')],function(_0x550e8c){return{'model':db[_0x550e8c[_0x88e2('0x1b')]],'as':_0x550e8c['as'],'attributes':_0x550e8c[_0x88e2('0x1c')],'include':_0x550e8c[_0x88e2('0x19')]?_[_0x88e2('0x1a')](_0x550e8c[_0x88e2('0x19')],function(_0x2381c6){return{'model':db[_0x2381c6[_0x88e2('0x1b')]],'as':_0x2381c6['as'],'attributes':_0x2381c6[_0x88e2('0x1c')],'include':_0x2381c6[_0x88e2('0x19')]?_[_0x88e2('0x1a')](_0x2381c6['include'],function(_0x54d6c3){return{'model':db[_0x54d6c3[_0x88e2('0x1b')]],'as':_0x54d6c3['as'],'attributes':_0x54d6c3[_0x88e2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x88e2('0xb')](function(_0x496246){var _0x17907f=[];for(var _0x5c0b16=0x0;_0x5c0b16<_0x496246[_0x88e2('0x32')];_0x5c0b16+=0x1){_0x17907f[_0x88e2('0x3f')](_0x496246[_0x5c0b16][_0x88e2('0x34')](_0x384c07[_0x88e2('0x24')],{'transaction':_0x37707c}));}return BPromise['all'](_0x17907f);});})[_0x88e2('0xb')](function(_0x32dda6){logger[_0x88e2('0xc')](_0x88e2('0x3e'),_0x384c07);logger[_0x88e2('0xe')]('GetContactRecallMe',_0x384c07,JSON[_0x88e2('0x10')](_0x32dda6));_0x5824d6(_0x32dda6);})['catch'](function(_0x1e3f3b){logger[_0x88e2('0x11')](_0x88e2('0x3e'),_0x1e3f3b[_0x88e2('0x14')],_0x384c07);_0x530e4e(_0xb317e3[_0x88e2('0x11')](0x1f4,_0x1e3f3b['message']));});});});};exports[_0x88e2('0x40')]=function(_0x4fb5dd){var _0x19b0a0=this;return new Promise(function(_0x247988,_0xe8bd4e){db[_0x88e2('0x27')][_0x88e2('0x28')]()[_0x88e2('0xb')](function(_0x50ff2a){return db[_0x88e2('0x1f')]['findAll']({'raw':_0x4fb5dd[_0x88e2('0x16')]?_0x4fb5dd[_0x88e2('0x16')][_0x88e2('0x21')]===undefined?!![]:![]:!![],'where':_0x4fb5dd[_0x88e2('0x16')]?_0x4fb5dd[_0x88e2('0x16')][_0x88e2('0x17')]||null:null,'attributes':_0x4fb5dd['options']?_0x4fb5dd[_0x88e2('0x16')][_0x88e2('0x1c')]||null:null,'limit':_0x4fb5dd[_0x88e2('0x16')]?_0x4fb5dd[_0x88e2('0x16')][_0x88e2('0x18')]||null:null,'include':_0x4fb5dd[_0x88e2('0x16')]?_0x4fb5dd[_0x88e2('0x16')][_0x88e2('0x19')]?_[_0x88e2('0x1a')](_0x4fb5dd[_0x88e2('0x16')][_0x88e2('0x19')],function(_0x5c130f){return{'model':db[_0x5c130f[_0x88e2('0x1b')]],'as':_0x5c130f['as'],'attributes':_0x5c130f['as']===_0x88e2('0x41')?_['keys'](_0x50ff2a):_0x5c130f[_0x88e2('0x1c')],'include':_0x5c130f['include']?_[_0x88e2('0x1a')](_0x5c130f[_0x88e2('0x19')],function(_0x3c03a1){return{'model':db[_0x3c03a1[_0x88e2('0x1b')]],'as':_0x3c03a1['as'],'attributes':_0x3c03a1[_0x88e2('0x1c')],'include':_0x3c03a1[_0x88e2('0x19')]?_[_0x88e2('0x1a')](_0x3c03a1['include'],function(_0x17cf5a){return{'model':db[_0x17cf5a[_0x88e2('0x1b')]],'as':_0x17cf5a['as'],'attributes':_0x17cf5a['attributes']};}):[]};}):[]};}):[]:[]})[_0x88e2('0xb')](function(_0x2960c6){logger['info'](_0x88e2('0x1d'),_0x4fb5dd);logger[_0x88e2('0xe')](_0x88e2('0x1d'),_0x4fb5dd,JSON[_0x88e2('0x10')](_0x2960c6));_0x247988(_0x2960c6);})['catch'](function(_0x27c30f){logger[_0x88e2('0x11')](_0x88e2('0x1d'),_0x27c30f[_0x88e2('0x14')],_0x4fb5dd);_0xe8bd4e(_0x19b0a0[_0x88e2('0x11')](0x1f4,_0x27c30f[_0x88e2('0x14')]));});});});}; \ No newline at end of file +var _0x07f1=['options','raw','where','attributes','limit','include','model','map','GetCmHopper','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','destroy','DestroyCmHopper','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','length','includes','UserId','push','all','GetContactDialer','MoveContactManagedDialer','CountReScheduled','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','GetCmHopperPreview','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CmHopper','findAll'];(function(_0x542ae7,_0x57332f){var _0x5a96a6=function(_0x3c06ad){while(--_0x3c06ad){_0x542ae7['push'](_0x542ae7['shift']());}};_0x5a96a6(++_0x57332f);}(_0x07f1,0x106));var _0x107f=function(_0x1bfb96,_0x4bf573){_0x1bfb96=_0x1bfb96-0x0;var _0x141e1d=_0x07f1[_0x1bfb96];return _0x141e1d;};'use strict';var _=require(_0x107f('0x0'));var util=require(_0x107f('0x1'));var moment=require('moment');var BPromise=require(_0x107f('0x2'));var rs=require(_0x107f('0x3'));var fs=require('fs');var Redis=require(_0x107f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x107f('0x5'));var logger=require(_0x107f('0x6'))(_0x107f('0x7'));var config=require(_0x107f('0x8'));var jayson=require(_0x107f('0x9'));var client=jayson[_0x107f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48efaa,_0x3cba52,_0x21772c){return new BPromise(function(_0x459167,_0x5b7d21){return client[_0x107f('0xb')](_0x48efaa,_0x21772c)[_0x107f('0xc')](function(_0x92b841){logger[_0x107f('0xd')](_0x107f('0xe'),_0x3cba52,'request\x20sent');logger[_0x107f('0xf')](_0x107f('0x10'),_0x3cba52,_0x107f('0x11'),JSON[_0x107f('0x12')](_0x92b841));if(_0x92b841[_0x107f('0x13')]){if(_0x92b841[_0x107f('0x13')][_0x107f('0x14')]===0x1f4){logger[_0x107f('0x13')](_0x107f('0xe'),_0x3cba52,_0x92b841[_0x107f('0x13')][_0x107f('0x15')]);return _0x5b7d21(_0x92b841['error'][_0x107f('0x15')]);}logger[_0x107f('0x13')](_0x107f('0xe'),_0x3cba52,_0x92b841[_0x107f('0x13')][_0x107f('0x15')]);return _0x459167(_0x92b841[_0x107f('0x13')][_0x107f('0x15')]);}else{logger[_0x107f('0xd')](_0x107f('0xe'),_0x3cba52,_0x107f('0x11'));_0x459167(_0x92b841[_0x107f('0x16')][_0x107f('0x15')]);}})[_0x107f('0x17')](function(_0x3c0f09){logger['error'](_0x107f('0xe'),_0x3cba52,_0x3c0f09);_0x5b7d21(_0x3c0f09);});});}exports['GetCmHopper']=function(_0x36e278){var _0x47a582=this;return new Promise(function(_0x186d81,_0x5abfe4){return db[_0x107f('0x18')][_0x107f('0x19')]({'raw':_0x36e278[_0x107f('0x1a')]?_0x36e278[_0x107f('0x1a')][_0x107f('0x1b')]===undefined?!![]:![]:!![],'where':_0x36e278[_0x107f('0x1a')]?_0x36e278[_0x107f('0x1a')][_0x107f('0x1c')]||null:null,'attributes':_0x36e278[_0x107f('0x1a')]?_0x36e278[_0x107f('0x1a')][_0x107f('0x1d')]||null:null,'limit':_0x36e278[_0x107f('0x1a')]?_0x36e278[_0x107f('0x1a')][_0x107f('0x1e')]||null:null,'include':_0x36e278[_0x107f('0x1a')]?_0x36e278[_0x107f('0x1a')][_0x107f('0x1f')]?_['map'](_0x36e278['options'][_0x107f('0x1f')],function(_0x1a7179){return{'model':db[_0x1a7179[_0x107f('0x20')]],'as':_0x1a7179['as'],'attributes':_0x1a7179[_0x107f('0x1d')],'include':_0x1a7179[_0x107f('0x1f')]?_[_0x107f('0x21')](_0x1a7179[_0x107f('0x1f')],function(_0x4e7bde){return{'model':db[_0x4e7bde[_0x107f('0x20')]],'as':_0x4e7bde['as'],'attributes':_0x4e7bde['attributes'],'include':_0x4e7bde[_0x107f('0x1f')]?_[_0x107f('0x21')](_0x4e7bde[_0x107f('0x1f')],function(_0x1b517e){return{'model':db[_0x1b517e['model']],'as':_0x1b517e['as'],'attributes':_0x1b517e[_0x107f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x107f('0xc')](function(_0x4e75b0){logger[_0x107f('0xd')]('GetCmHopper',_0x36e278);logger[_0x107f('0xf')](_0x107f('0x22'),_0x36e278,JSON[_0x107f('0x12')](_0x4e75b0));_0x186d81(_0x4e75b0);})['catch'](function(_0x585a0b){logger[_0x107f('0x13')](_0x107f('0x22'),_0x585a0b[_0x107f('0x15')],_0x36e278);_0x5abfe4(_0x47a582[_0x107f('0x13')](0x1f4,_0x585a0b[_0x107f('0x15')]));});});};exports[_0x107f('0x23')]=function(_0x1746f0){var _0x2aec3b=this;return new Promise(function(_0x36cbfd,_0x278147){return db[_0x107f('0x18')][_0x107f('0x24')]({'raw':_0x1746f0['options']?_0x1746f0[_0x107f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1746f0[_0x107f('0x1a')]?_0x1746f0[_0x107f('0x1a')][_0x107f('0x1c')]||null:null,'attributes':_0x1746f0[_0x107f('0x1a')]?_0x1746f0[_0x107f('0x1a')][_0x107f('0x1d')]||null:null,'include':_0x1746f0[_0x107f('0x1a')]?_0x1746f0[_0x107f('0x1a')]['include']?_[_0x107f('0x21')](_0x1746f0[_0x107f('0x1a')][_0x107f('0x1f')],function(_0xcd7aaa){return{'model':db[_0xcd7aaa[_0x107f('0x20')]],'as':_0xcd7aaa['as'],'attributes':_0xcd7aaa[_0x107f('0x1d')],'include':_0xcd7aaa['include']?_['map'](_0xcd7aaa[_0x107f('0x1f')],function(_0x4dc81f){return{'model':db[_0x4dc81f[_0x107f('0x20')]],'as':_0x4dc81f['as'],'attributes':_0x4dc81f['attributes'],'include':_0x4dc81f[_0x107f('0x1f')]?_[_0x107f('0x21')](_0x4dc81f[_0x107f('0x1f')],function(_0x52bca6){return{'model':db[_0x52bca6[_0x107f('0x20')]],'as':_0x52bca6['as'],'attributes':_0x52bca6['attributes']};}):[]};}):[]};}):[]:[]})[_0x107f('0xc')](function(_0x3c74d3){logger[_0x107f('0xd')]('ShowCmHopper',_0x1746f0);logger[_0x107f('0xf')](_0x107f('0x23'),_0x1746f0,JSON[_0x107f('0x12')](_0x3c74d3));_0x36cbfd(_0x3c74d3);})[_0x107f('0x17')](function(_0x2a6052){logger[_0x107f('0x13')]('ShowCmHopper',_0x2a6052[_0x107f('0x15')],_0x1746f0);_0x278147(_0x2aec3b['error'](0x1f4,_0x2a6052['message']));});});};exports[_0x107f('0x25')]=function(_0x325745){var _0x1df969=this;return new Promise(function(_0x61a2ad,_0x53d406){return db['CmHopper'][_0x107f('0x26')](_0x325745[_0x107f('0x27')],{'raw':_0x325745[_0x107f('0x1a')]?_0x325745[_0x107f('0x1a')][_0x107f('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3a8855){logger[_0x107f('0xd')](_0x107f('0x25'),_0x325745);logger[_0x107f('0xf')]('CreateCmHopper',_0x325745,JSON[_0x107f('0x12')](_0x3a8855));_0x61a2ad(_0x3a8855);})[_0x107f('0x17')](function(_0x35c605){logger[_0x107f('0x13')](_0x107f('0x25'),_0x35c605['message'],_0x325745);_0x53d406(_0x1df969[_0x107f('0x13')](0x1f4,_0x35c605[_0x107f('0x15')]));});});};exports[_0x107f('0x28')]=function(_0x1bde6d){var _0x1c448a=this;return new Promise(function(_0x11683a,_0x168cad){return db['CmHopper'][_0x107f('0x29')](_0x1bde6d['body'],{'raw':_0x1bde6d[_0x107f('0x1a')]?_0x1bde6d[_0x107f('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bde6d[_0x107f('0x1a')]?_0x1bde6d[_0x107f('0x1a')][_0x107f('0x1c')]||null:null,'attributes':_0x1bde6d[_0x107f('0x1a')]?_0x1bde6d['options'][_0x107f('0x1d')]||null:null,'limit':_0x1bde6d[_0x107f('0x1a')]?_0x1bde6d[_0x107f('0x1a')][_0x107f('0x1e')]||null:null})['then'](function(_0xad9b5d){logger['info'](_0x107f('0x28'),_0x1bde6d);logger[_0x107f('0xf')](_0x107f('0x28'),_0x1bde6d,JSON[_0x107f('0x12')](_0xad9b5d));_0x11683a(_0xad9b5d);})[_0x107f('0x17')](function(_0x22d244){logger[_0x107f('0x13')](_0x107f('0x28'),_0x22d244[_0x107f('0x15')],_0x1bde6d);_0x168cad(_0x1c448a[_0x107f('0x13')](0x1f4,_0x22d244['message']));});});};exports['DestroyCmHopper']=function(_0x2447df){var _0x55b4d5=this;return new Promise(function(_0x58f1c7,_0x494077){return db[_0x107f('0x18')][_0x107f('0x2a')]({'where':_0x2447df[_0x107f('0x1a')]?_0x2447df[_0x107f('0x1a')]['where']||null:null})[_0x107f('0xc')](function(_0x55e5a3){logger[_0x107f('0xd')](_0x107f('0x2b'),_0x2447df);logger[_0x107f('0xf')](_0x107f('0x2b'),_0x2447df,JSON['stringify'](_0x55e5a3));_0x58f1c7(_0x55e5a3);})[_0x107f('0x17')](function(_0x39c3ca){logger[_0x107f('0x13')](_0x107f('0x2b'),_0x39c3ca['message'],_0x2447df);_0x494077(_0x55b4d5[_0x107f('0x13')](0x1f4,_0x39c3ca[_0x107f('0x15')]));});});};exports['GetContactDialer']=function(_0x28f791){var _0x217336=this;return new Promise(function(_0x5027db,_0x39c1bf){return db[_0x107f('0x2c')][_0x107f('0x2d')]()[_0x107f('0xc')](function(_0x17f371){return db[_0x107f('0x2e')][_0x107f('0x2f')](function(_0x5e98fe){return db['CmHopper'][_0x107f('0x19')]({'where':_0x28f791[_0x107f('0x1a')]?_0x28f791[_0x107f('0x1a')][_0x107f('0x1c')]||null:null,'attributes':_0x28f791['options']?_0x28f791[_0x107f('0x1a')][_0x107f('0x1d')]||null:null,'limit':_0x28f791['options']?_0x28f791[_0x107f('0x1a')][_0x107f('0x1e')]||null:null,'order':_0x28f791[_0x107f('0x1a')]?_0x28f791[_0x107f('0x1a')][_0x107f('0x30')]||null:null,'transaction':_0x5e98fe,'lock':_0x5e98fe[_0x107f('0x31')][_0x107f('0x32')],'include':[{'model':db['CmContact'],'as':_0x107f('0x33'),'attributes':_[_0x107f('0x34')](_0x17f371)},{'model':db[_0x107f('0x35')],'as':_0x107f('0x36'),'attributes':['id',_0x107f('0x37'),'voicePause']}]})[_0x107f('0xc')](function(_0x23d51b){var _0x30bdd6=[];var _0x5b8bd2=[];for(var _0x4edc55=0x0;_0x4edc55<_0x23d51b[_0x107f('0x38')];_0x4edc55+=0x1){if(!_0x5b8bd2[_0x107f('0x39')](_0x23d51b[_0x4edc55][_0x107f('0x3a')])){_0x5b8bd2[_0x107f('0x3b')](_0x23d51b[_0x4edc55]['UserId']);_0x30bdd6[_0x107f('0x3b')](_0x23d51b[_0x4edc55][_0x107f('0x29')](_0x28f791[_0x107f('0x27')],{'transaction':_0x5e98fe}));}}return BPromise[_0x107f('0x3c')](_0x30bdd6);});})[_0x107f('0xc')](function(_0x48dbbc){logger[_0x107f('0xd')]('GetContactDialer',_0x28f791);logger[_0x107f('0xf')](_0x107f('0x3d'),_0x28f791,JSON['stringify'](_0x48dbbc));_0x5027db(_0x48dbbc);})[_0x107f('0x17')](function(_0x3cc052){logger[_0x107f('0x13')]('GetContactDialer',_0x3cc052[_0x107f('0x15')],_0x28f791);_0x39c1bf(_0x217336[_0x107f('0x13')](0x1f4,_0x3cc052[_0x107f('0x15')]));});});});};exports[_0x107f('0x3e')]=function(_0x598ba3){var _0x471a4b=this;return new Promise(function(_0x9154fa,_0xcfefac){return db[_0x107f('0x2e')][_0x107f('0x2f')](function(_0x4866c6){return db['CmHopperFinal'][_0x107f('0x26')](_0x598ba3[_0x107f('0x27')],{'raw':_0x598ba3[_0x107f('0x1a')]?_0x598ba3[_0x107f('0x1a')][_0x107f('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x4866c6})[_0x107f('0xc')](function(){return db[_0x107f('0x18')]['destroy']({'where':_0x598ba3['options']?_0x598ba3[_0x107f('0x1a')][_0x107f('0x1c')]||null:null,'transaction':_0x4866c6});});})[_0x107f('0xc')](function(_0x7c45ee){logger['info'](_0x107f('0x3e'),_0x598ba3);logger[_0x107f('0xf')](_0x107f('0x3e'),_0x598ba3,JSON[_0x107f('0x12')](_0x7c45ee));_0x9154fa(_0x7c45ee);})[_0x107f('0x17')](function(_0x36fd99){logger[_0x107f('0x13')]('MoveContactManagedDialer',_0x36fd99[_0x107f('0x15')],_0x598ba3);_0xcfefac(_0x471a4b[_0x107f('0x13')](0x1f4,_0x36fd99[_0x107f('0x15')]));});});};exports[_0x107f('0x3f')]=function(_0x380041){var _0x34f0f5=this;return new Promise(function(_0x37e6c0,_0x22e42e){return db['CmHopper'][_0x107f('0x19')]({'raw':_0x380041[_0x107f('0x1a')]?_0x380041['options'][_0x107f('0x1b')]===undefined?!![]:![]:!![],'where':_0x380041[_0x107f('0x1a')]?_0x380041[_0x107f('0x1a')][_0x107f('0x1c')]||null:null,'attributes':[[db[_0x107f('0x2e')]['fn'](_0x107f('0x40'),db[_0x107f('0x2e')]['fn']('IF',db[_0x107f('0x2e')][_0x107f('0x41')]('`scheduledat`\x20>=\x20'+util[_0x107f('0x42')](_0x107f('0x43'),moment()[_0x107f('0x42')](_0x107f('0x44')))+_0x107f('0x45')))),'contactsRescheduled']]})[_0x107f('0xc')](function(_0x16743d){logger[_0x107f('0xd')](_0x107f('0x3f'),_0x380041);logger[_0x107f('0xf')]('CountReScheduled',_0x380041,JSON[_0x107f('0x12')](_0x16743d));_0x37e6c0(_0x16743d);})[_0x107f('0x17')](function(_0x586947){logger[_0x107f('0x13')]('CountReScheduled',_0x586947['message'],_0x380041);_0x22e42e(_0x34f0f5[_0x107f('0x13')](0x1f4,_0x586947[_0x107f('0x15')]));});});};exports['GetContactRecallMe']=function(_0x2f1444){var _0x4c7dd2=this;return new Promise(function(_0x47a7d1,_0x404a35){return db[_0x107f('0x2c')][_0x107f('0x2d')]()[_0x107f('0xc')](function(_0xeb97df){return db[_0x107f('0x2e')]['transaction'](function(_0x2fb886){return db[_0x107f('0x18')][_0x107f('0x19')]({'where':_0x2f1444[_0x107f('0x1a')]?_0x2f1444[_0x107f('0x1a')][_0x107f('0x1c')]||null:null,'attributes':_0x2f1444[_0x107f('0x1a')]?_0x2f1444[_0x107f('0x1a')][_0x107f('0x1d')]||null:null,'limit':0x1,'order':_0x2f1444[_0x107f('0x1a')]?_0x2f1444['options']['order']||null:null,'group':db['CmHopper'][_0x107f('0x3a')],'transaction':_0x2fb886,'lock':_0x2fb886['LOCK'][_0x107f('0x32')],'include':_0x2f1444[_0x107f('0x1a')]?_0x2f1444[_0x107f('0x1a')][_0x107f('0x1f')]?_['map'](_0x2f1444['options'][_0x107f('0x1f')],function(_0x3a76dd){return{'model':db[_0x3a76dd[_0x107f('0x20')]],'as':_0x3a76dd['as'],'attributes':_0x3a76dd[_0x107f('0x1d')],'include':_0x3a76dd['include']?_[_0x107f('0x21')](_0x3a76dd[_0x107f('0x1f')],function(_0x475d70){return{'model':db[_0x475d70[_0x107f('0x20')]],'as':_0x475d70['as'],'attributes':_0x475d70[_0x107f('0x1d')],'include':_0x475d70[_0x107f('0x1f')]?_['map'](_0x475d70[_0x107f('0x1f')],function(_0x16de1d){return{'model':db[_0x16de1d[_0x107f('0x20')]],'as':_0x16de1d['as'],'attributes':_0x16de1d[_0x107f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x107f('0xc')](function(_0x1268ce){var _0x69578e=[];for(var _0x444d16=0x0;_0x444d16<_0x1268ce[_0x107f('0x38')];_0x444d16+=0x1){_0x69578e[_0x107f('0x3b')](_0x1268ce[_0x444d16]['update'](_0x2f1444[_0x107f('0x27')],{'transaction':_0x2fb886}));}return BPromise[_0x107f('0x3c')](_0x69578e);});})[_0x107f('0xc')](function(_0x5bea8e){logger[_0x107f('0xd')]('GetContactRecallMe',_0x2f1444);logger[_0x107f('0xf')](_0x107f('0x46'),_0x2f1444,JSON[_0x107f('0x12')](_0x5bea8e));_0x47a7d1(_0x5bea8e);})[_0x107f('0x17')](function(_0x4be8df){logger[_0x107f('0x13')](_0x107f('0x46'),_0x4be8df[_0x107f('0x15')],_0x2f1444);_0x404a35(_0x4c7dd2[_0x107f('0x13')](0x1f4,_0x4be8df[_0x107f('0x15')]));});});});};exports[_0x107f('0x47')]=function(_0x87be70){var _0x3f93e3=this;return new Promise(function(_0x501149,_0x2a74c2){db[_0x107f('0x2c')]['describe']()[_0x107f('0xc')](function(_0x1f4f78){return db[_0x107f('0x18')]['findAll']({'raw':_0x87be70[_0x107f('0x1a')]?_0x87be70['options'][_0x107f('0x1b')]===undefined?!![]:![]:!![],'where':_0x87be70[_0x107f('0x1a')]?_0x87be70['options']['where']||null:null,'attributes':_0x87be70['options']?_0x87be70[_0x107f('0x1a')][_0x107f('0x1d')]||null:null,'limit':_0x87be70['options']?_0x87be70[_0x107f('0x1a')][_0x107f('0x1e')]||null:null,'include':_0x87be70[_0x107f('0x1a')]?_0x87be70['options'][_0x107f('0x1f')]?_[_0x107f('0x21')](_0x87be70[_0x107f('0x1a')][_0x107f('0x1f')],function(_0x334fe1){return{'model':db[_0x334fe1[_0x107f('0x20')]],'as':_0x334fe1['as'],'attributes':_0x334fe1['as']===_0x107f('0x33')?_[_0x107f('0x34')](_0x1f4f78):_0x334fe1[_0x107f('0x1d')],'include':_0x334fe1[_0x107f('0x1f')]?_[_0x107f('0x21')](_0x334fe1[_0x107f('0x1f')],function(_0x2f4d0a){return{'model':db[_0x2f4d0a[_0x107f('0x20')]],'as':_0x2f4d0a['as'],'attributes':_0x2f4d0a[_0x107f('0x1d')],'include':_0x2f4d0a[_0x107f('0x1f')]?_[_0x107f('0x21')](_0x2f4d0a[_0x107f('0x1f')],function(_0x23d054){return{'model':db[_0x23d054[_0x107f('0x20')]],'as':_0x23d054['as'],'attributes':_0x23d054[_0x107f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bc3c5){logger[_0x107f('0xd')](_0x107f('0x22'),_0x87be70);logger[_0x107f('0xf')](_0x107f('0x22'),_0x87be70,JSON[_0x107f('0x12')](_0x1bc3c5));_0x501149(_0x1bc3c5);})[_0x107f('0x17')](function(_0x9a4ca7){logger['error'](_0x107f('0x22'),_0x9a4ca7[_0x107f('0x15')],_0x87be70);_0x2a74c2(_0x3f93e3[_0x107f('0x13')](0x1f4,_0x9a4ca7[_0x107f('0x15')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index b43f334..0d81881 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 _0x38b2=['get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','/:id','show','create','post','/preview','put','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0x38b2,0xf6));var _0x238b=function(_0x29f9b8,_0x460c00){_0x29f9b8=_0x29f9b8-0x0;var _0x2be105=_0x38b2[_0x29f9b8];return _0x2be105;};'use strict';var multer=require(_0x238b('0x0'));var util=require(_0x238b('0x1'));var path=require(_0x238b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x238b('0x3')]();var auth=require(_0x238b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x238b('0x5'));var controller=require('./cmHopper.controller');router[_0x238b('0x6')]('/',auth[_0x238b('0x7')](),controller[_0x238b('0x8')]);router[_0x238b('0x6')]('/describe',auth[_0x238b('0x7')](),controller[_0x238b('0x9')]);router['get'](_0x238b('0xa'),auth[_0x238b('0x7')](),controller[_0x238b('0xb')]);router[_0x238b('0x6')](_0x238b('0xc'),auth[_0x238b('0x7')](),controller[_0x238b('0xd')]);router['post']('/',auth[_0x238b('0x7')](),controller[_0x238b('0xe')]);router[_0x238b('0xf')](_0x238b('0x10'),auth[_0x238b('0x7')](),controller['getPreview']);router[_0x238b('0x11')](_0x238b('0xc'),auth[_0x238b('0x7')](),controller[_0x238b('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x238b('0x13')]);module[_0x238b('0x14')]=router; \ No newline at end of file +var _0x794b=['describe','/opencontacts','getOpenContacts','/:id','show','post','create','/preview','getPreview','put','update','delete','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0x15cef4,_0x448b97){var _0x384430=function(_0x38ebce){while(--_0x38ebce){_0x15cef4['push'](_0x15cef4['shift']());}};_0x384430(++_0x448b97);}(_0x794b,0x1c2));var _0xb794=function(_0x159a12,_0x8795b1){_0x159a12=_0x159a12-0x0;var _0x40d7f9=_0x794b[_0x159a12];return _0x40d7f9;};'use strict';var multer=require(_0xb794('0x0'));var util=require(_0xb794('0x1'));var path=require('path');var timeout=require(_0xb794('0x2'));var express=require(_0xb794('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb794('0x4'));var config=require(_0xb794('0x5'));var controller=require('./cmHopper.controller');router['get']('/',auth[_0xb794('0x6')](),controller[_0xb794('0x7')]);router[_0xb794('0x8')](_0xb794('0x9'),auth[_0xb794('0x6')](),controller[_0xb794('0xa')]);router['get'](_0xb794('0xb'),auth[_0xb794('0x6')](),controller[_0xb794('0xc')]);router[_0xb794('0x8')](_0xb794('0xd'),auth[_0xb794('0x6')](),controller[_0xb794('0xe')]);router[_0xb794('0xf')]('/',auth[_0xb794('0x6')](),controller[_0xb794('0x10')]);router[_0xb794('0xf')](_0xb794('0x11'),auth[_0xb794('0x6')](),controller[_0xb794('0x12')]);router[_0xb794('0x13')](_0xb794('0xd'),auth[_0xb794('0x6')](),controller[_0xb794('0x14')]);router[_0xb794('0x15')](_0xb794('0xd'),auth[_0xb794('0x6')](),controller['destroy']);module[_0xb794('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 6fa09f9..370766c 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 _0xcd90=['moment','exports','STRING','INTEGER','contactListQueue'];(function(_0x4f0b9e,_0xe5436){var _0x1fe02f=function(_0x29c906){while(--_0x29c906){_0x4f0b9e['push'](_0x4f0b9e['shift']());}};_0x1fe02f(++_0xe5436);}(_0xcd90,0xe1));var _0x0cd9=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xcd90[_0x4cf98e];return _0x1623ac;};'use strict';var moment=require(_0x0cd9('0x0'));var Sequelize=require('sequelize');module[_0x0cd9('0x1')]={'phone':{'type':Sequelize[_0x0cd9('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x0cd9('0x3')],'unique':_0x0cd9('0x4')},'ListId':{'type':Sequelize[_0x0cd9('0x3')],'unique':_0x0cd9('0x4')},'VoiceQueueId':{'type':Sequelize[_0x0cd9('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xf65b=['sequelize','exports','contactListQueue','INTEGER','moment'];(function(_0x51af96,_0x42104c){var _0x2bb16b=function(_0x4b9cc5){while(--_0x4b9cc5){_0x51af96['push'](_0x51af96['shift']());}};_0x2bb16b(++_0x42104c);}(_0xf65b,0x10d));var _0xbf65=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf65b[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0xbf65('0x0'));var Sequelize=require(_0xbf65('0x1'));module[_0xbf65('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xbf65('0x3')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xbf65('0x3')},'VoiceQueueId':{'type':Sequelize[_0xbf65('0x4')],'unique':_0xbf65('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 95ed30d..4f57220 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x4772cd,_0x42b214){var _0x2bb48c=function(_0x5bbb99){while(--_0x5bbb99){_0x4772cd['push'](_0x4772cd['shift']());}};_0x2bb48c(++_0x42b214);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x1b0844,_0x114dec){var _0x395ca0=function(_0xb82e26){while(--_0xb82e26){_0x1b0844['push'](_0x1b0844['shift']());}};_0x395ca0(++_0x114dec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 92294e1..c65903f 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 _0x71d1=['../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','lodash','util','api','moment','request-promise','rimraf'];(function(_0x54afe1,_0x3a71c2){var _0x1426bd=function(_0x535a2f){while(--_0x535a2f){_0x54afe1['push'](_0x54afe1['shift']());}};_0x1426bd(++_0x3a71c2);}(_0x71d1,0x68));var _0x171d=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x71d1[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x171d('0x0'));var util=require(_0x171d('0x1'));var logger=require('../../config/logger')(_0x171d('0x2'));var moment=require(_0x171d('0x3'));var BPromise=require('bluebird');var rp=require(_0x171d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x171d('0x5'));var config=require(_0x171d('0x6'));var attributes=require(_0x171d('0x7'));module['exports']=function(_0x534967,_0x3380c7){return _0x534967[_0x171d('0x8')](_0x171d('0x9'),attributes,{'tableName':_0x171d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc114=['request-promise','rimraf','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','lodash','util','bluebird'];(function(_0x24dd71,_0x2c14b4){var _0x2bea3c=function(_0x25fa56){while(--_0x25fa56){_0x24dd71['push'](_0x24dd71['shift']());}};_0x2bea3c(++_0x2c14b4);}(_0xc114,0x1a4));var _0x4c11=function(_0x3fc67c,_0x229bc4){_0x3fc67c=_0x3fc67c-0x0;var _0x1a5695=_0xc114[_0x3fc67c];return _0x1a5695;};'use strict';var _=require(_0x4c11('0x0'));var util=require(_0x4c11('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4c11('0x2'));var rp=require(_0x4c11('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c11('0x4'));var config=require('../../config/environment');var attributes=require(_0x4c11('0x5'));module['exports']=function(_0x1086e4,_0x369c8c){return _0x1086e4[_0x4c11('0x6')](_0x4c11('0x7'),attributes,{'tableName':_0x4c11('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index f20f36d..5c76201 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 _0xf569=['jayson/promise','client','http','request','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','raw','options','where','attributes','limit','include','map','model','then','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x4b10e1,_0x4a4196){var _0x13829a=function(_0x4106ba){while(--_0x4106ba){_0x4b10e1['push'](_0x4b10e1['shift']());}};_0x13829a(++_0x4a4196);}(_0xf569,0xbb));var _0x9f56=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xf569[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x9f56('0x0'));var util=require(_0x9f56('0x1'));var moment=require('moment');var BPromise=require(_0x9f56('0x2'));var rs=require(_0x9f56('0x3'));var fs=require('fs');var Redis=require(_0x9f56('0x4'));var db=require(_0x9f56('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f56('0x6'))(_0x9f56('0x7'));var config=require('../../config/environment');var jayson=require(_0x9f56('0x8'));var client=jayson[_0x9f56('0x9')][_0x9f56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9caeab,_0x8523bb,_0x4fcc84){return new BPromise(function(_0x5b1a0c,_0x251984){return client[_0x9f56('0xb')](_0x9caeab,_0x4fcc84)['then'](function(_0x82b85d){logger[_0x9f56('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x8523bb,_0x9f56('0xd'));logger[_0x9f56('0xe')](_0x9f56('0xf'),_0x8523bb,_0x9f56('0xd'),JSON[_0x9f56('0x10')](_0x82b85d));if(_0x82b85d[_0x9f56('0x11')]){if(_0x82b85d['error'][_0x9f56('0x12')]===0x1f4){logger['error'](_0x9f56('0x13'),_0x8523bb,_0x82b85d[_0x9f56('0x11')]['message']);return _0x251984(_0x82b85d[_0x9f56('0x11')][_0x9f56('0x14')]);}logger[_0x9f56('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x8523bb,_0x82b85d['error'][_0x9f56('0x14')]);return _0x5b1a0c(_0x82b85d[_0x9f56('0x11')][_0x9f56('0x14')]);}else{logger[_0x9f56('0xc')](_0x9f56('0x13'),_0x8523bb,_0x9f56('0xd'));_0x5b1a0c(_0x82b85d[_0x9f56('0x15')]['message']);}})[_0x9f56('0x16')](function(_0x57f060){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x8523bb,_0x57f060);_0x251984(_0x57f060);});});}exports[_0x9f56('0x17')]=function(_0x55d99f){var _0x162dbc=this;return new Promise(function(_0x31aa9d,_0x1b452b){return db[_0x9f56('0x18')]['findAll']({'raw':_0x55d99f['options']?_0x55d99f['options'][_0x9f56('0x19')]===undefined?!![]:![]:!![],'where':_0x55d99f[_0x9f56('0x1a')]?_0x55d99f['options'][_0x9f56('0x1b')]||null:null,'attributes':_0x55d99f[_0x9f56('0x1a')]?_0x55d99f['options'][_0x9f56('0x1c')]||null:null,'limit':_0x55d99f[_0x9f56('0x1a')]?_0x55d99f['options'][_0x9f56('0x1d')]||null:null,'include':_0x55d99f[_0x9f56('0x1a')]?_0x55d99f[_0x9f56('0x1a')][_0x9f56('0x1e')]?_[_0x9f56('0x1f')](_0x55d99f[_0x9f56('0x1a')][_0x9f56('0x1e')],function(_0x24c31b){return{'model':db[_0x24c31b[_0x9f56('0x20')]],'as':_0x24c31b['as'],'attributes':_0x24c31b[_0x9f56('0x1c')],'include':_0x24c31b[_0x9f56('0x1e')]?_[_0x9f56('0x1f')](_0x24c31b['include'],function(_0x4deab6){return{'model':db[_0x4deab6[_0x9f56('0x20')]],'as':_0x4deab6['as'],'attributes':_0x4deab6['attributes'],'include':_0x4deab6[_0x9f56('0x1e')]?_['map'](_0x4deab6['include'],function(_0x31f73c){return{'model':db[_0x31f73c[_0x9f56('0x20')]],'as':_0x31f73c['as'],'attributes':_0x31f73c['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f56('0x21')](function(_0x35dedf){logger[_0x9f56('0xc')](_0x9f56('0x17'),_0x55d99f);logger['debug'](_0x9f56('0x17'),_0x55d99f,JSON[_0x9f56('0x10')](_0x35dedf));_0x31aa9d(_0x35dedf);})[_0x9f56('0x16')](function(_0x26f49c){logger['error'](_0x9f56('0x17'),_0x26f49c[_0x9f56('0x14')],_0x55d99f);_0x1b452b(_0x162dbc['error'](0x1f4,_0x26f49c[_0x9f56('0x14')]));});});};exports[_0x9f56('0x22')]=function(_0x4ea682){var _0x13abe5=this;return new Promise(function(_0xbf8e4b,_0x46dc7a){return db[_0x9f56('0x18')][_0x9f56('0x23')](_0x4ea682[_0x9f56('0x24')],{'raw':_0x4ea682[_0x9f56('0x1a')]?_0x4ea682[_0x9f56('0x1a')][_0x9f56('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ea682[_0x9f56('0x1a')]?_0x4ea682[_0x9f56('0x1a')][_0x9f56('0x1b')]||null:null,'attributes':_0x4ea682['options']?_0x4ea682[_0x9f56('0x1a')][_0x9f56('0x1c')]||null:null,'limit':_0x4ea682[_0x9f56('0x1a')]?_0x4ea682['options'][_0x9f56('0x1d')]||null:null})['then'](function(_0x417399){logger[_0x9f56('0xc')]('UpdateCmHopperBlack',_0x4ea682);logger[_0x9f56('0xe')](_0x9f56('0x22'),_0x4ea682,JSON[_0x9f56('0x10')](_0x417399));_0xbf8e4b(_0x417399);})['catch'](function(_0x56820c){logger[_0x9f56('0x11')](_0x9f56('0x22'),_0x56820c[_0x9f56('0x14')],_0x4ea682);_0x46dc7a(_0x13abe5[_0x9f56('0x11')](0x1f4,_0x56820c[_0x9f56('0x14')]));});});};exports[_0x9f56('0x25')]=function(_0x160198){var _0x441edc=this;return new Promise(function(_0x128cdc,_0x1ac87b){return db[_0x9f56('0x18')][_0x9f56('0x26')]({'where':_0x160198['options']?_0x160198[_0x9f56('0x1a')][_0x9f56('0x1b')]||null:null})[_0x9f56('0x21')](function(_0x804b1b){logger['info'](_0x9f56('0x25'),_0x160198);logger['debug'](_0x9f56('0x25'),_0x160198,JSON[_0x9f56('0x10')](_0x804b1b));_0x128cdc(_0x804b1b);})[_0x9f56('0x16')](function(_0x31a7d4){logger['error'](_0x9f56('0x25'),_0x31a7d4[_0x9f56('0x14')],_0x160198);_0x1ac87b(_0x441edc[_0x9f56('0x11')](0x1f4,_0x31a7d4['message']));});});}; \ No newline at end of file +var _0xb509=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xb509,0x12b));var _0x9b50=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xb509[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x9b50('0x0'));var util=require(_0x9b50('0x1'));var moment=require(_0x9b50('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b50('0x3'));var db=require(_0x9b50('0x4'))['db'];var utils=require(_0x9b50('0x5'));var logger=require(_0x9b50('0x6'))(_0x9b50('0x7'));var config=require(_0x9b50('0x8'));var jayson=require(_0x9b50('0x9'));var client=jayson['client'][_0x9b50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x176ae1,_0x39a49a,_0x3a5d24){return new BPromise(function(_0x23d0c1,_0x21cbc9){return client[_0x9b50('0xb')](_0x176ae1,_0x3a5d24)['then'](function(_0x5a2744){logger['info'](_0x9b50('0xc'),_0x39a49a,_0x9b50('0xd'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x39a49a,_0x9b50('0xd'),JSON[_0x9b50('0xe')](_0x5a2744));if(_0x5a2744[_0x9b50('0xf')]){if(_0x5a2744[_0x9b50('0xf')]['code']===0x1f4){logger[_0x9b50('0xf')](_0x9b50('0xc'),_0x39a49a,_0x5a2744[_0x9b50('0xf')][_0x9b50('0x10')]);return _0x21cbc9(_0x5a2744['error'][_0x9b50('0x10')]);}logger[_0x9b50('0xf')](_0x9b50('0xc'),_0x39a49a,_0x5a2744[_0x9b50('0xf')][_0x9b50('0x10')]);return _0x23d0c1(_0x5a2744[_0x9b50('0xf')]['message']);}else{logger[_0x9b50('0x11')](_0x9b50('0xc'),_0x39a49a,_0x9b50('0xd'));_0x23d0c1(_0x5a2744[_0x9b50('0x12')][_0x9b50('0x10')]);}})[_0x9b50('0x13')](function(_0x4decac){logger[_0x9b50('0xf')](_0x9b50('0xc'),_0x39a49a,_0x4decac);_0x21cbc9(_0x4decac);});});}exports[_0x9b50('0x14')]=function(_0x5caa57){var _0x1a23df=this;return new Promise(function(_0x2cca4a,_0x5b8a4b){return db[_0x9b50('0x15')][_0x9b50('0x16')]({'raw':_0x5caa57['options']?_0x5caa57[_0x9b50('0x17')][_0x9b50('0x18')]===undefined?!![]:![]:!![],'where':_0x5caa57[_0x9b50('0x17')]?_0x5caa57['options'][_0x9b50('0x19')]||null:null,'attributes':_0x5caa57[_0x9b50('0x17')]?_0x5caa57['options'][_0x9b50('0x1a')]||null:null,'limit':_0x5caa57['options']?_0x5caa57[_0x9b50('0x17')][_0x9b50('0x1b')]||null:null,'include':_0x5caa57[_0x9b50('0x17')]?_0x5caa57[_0x9b50('0x17')][_0x9b50('0x1c')]?_[_0x9b50('0x1d')](_0x5caa57[_0x9b50('0x17')][_0x9b50('0x1c')],function(_0x3fd70c){return{'model':db[_0x3fd70c[_0x9b50('0x1e')]],'as':_0x3fd70c['as'],'attributes':_0x3fd70c[_0x9b50('0x1a')],'include':_0x3fd70c[_0x9b50('0x1c')]?_[_0x9b50('0x1d')](_0x3fd70c[_0x9b50('0x1c')],function(_0x4d37f6){return{'model':db[_0x4d37f6['model']],'as':_0x4d37f6['as'],'attributes':_0x4d37f6[_0x9b50('0x1a')],'include':_0x4d37f6['include']?_['map'](_0x4d37f6[_0x9b50('0x1c')],function(_0x469517){return{'model':db[_0x469517[_0x9b50('0x1e')]],'as':_0x469517['as'],'attributes':_0x469517[_0x9b50('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9b50('0x1f')](function(_0xe92e80){logger[_0x9b50('0x11')](_0x9b50('0x14'),_0x5caa57);logger[_0x9b50('0x20')](_0x9b50('0x14'),_0x5caa57,JSON[_0x9b50('0xe')](_0xe92e80));_0x2cca4a(_0xe92e80);})[_0x9b50('0x13')](function(_0x4d7170){logger[_0x9b50('0xf')](_0x9b50('0x14'),_0x4d7170['message'],_0x5caa57);_0x5b8a4b(_0x1a23df[_0x9b50('0xf')](0x1f4,_0x4d7170['message']));});});};exports[_0x9b50('0x21')]=function(_0x39cab1){var _0x59a7e2=this;return new Promise(function(_0x20e789,_0xae3b78){return db[_0x9b50('0x15')][_0x9b50('0x22')](_0x39cab1[_0x9b50('0x23')],{'raw':_0x39cab1[_0x9b50('0x17')]?_0x39cab1['options'][_0x9b50('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39cab1['options']?_0x39cab1[_0x9b50('0x17')][_0x9b50('0x19')]||null:null,'attributes':_0x39cab1[_0x9b50('0x17')]?_0x39cab1[_0x9b50('0x17')][_0x9b50('0x1a')]||null:null,'limit':_0x39cab1[_0x9b50('0x17')]?_0x39cab1['options']['limit']||null:null})['then'](function(_0x2b70d9){logger['info'](_0x9b50('0x21'),_0x39cab1);logger[_0x9b50('0x20')](_0x9b50('0x21'),_0x39cab1,JSON[_0x9b50('0xe')](_0x2b70d9));_0x20e789(_0x2b70d9);})[_0x9b50('0x13')](function(_0x41bb85){logger[_0x9b50('0xf')]('UpdateCmHopperBlack',_0x41bb85[_0x9b50('0x10')],_0x39cab1);_0xae3b78(_0x59a7e2[_0x9b50('0xf')](0x1f4,_0x41bb85[_0x9b50('0x10')]));});});};exports[_0x9b50('0x24')]=function(_0x5d5eee){var _0x55e791=this;return new Promise(function(_0x24f31b,_0x4391b3){return db[_0x9b50('0x15')][_0x9b50('0x25')]({'where':_0x5d5eee[_0x9b50('0x17')]?_0x5d5eee['options']['where']||null:null})[_0x9b50('0x1f')](function(_0x350355){logger[_0x9b50('0x11')]('DestroyCmHopperBlack',_0x5d5eee);logger[_0x9b50('0x20')](_0x9b50('0x24'),_0x5d5eee,JSON['stringify'](_0x350355));_0x24f31b(_0x350355);})[_0x9b50('0x13')](function(_0x108737){logger[_0x9b50('0xf')](_0x9b50('0x24'),_0x108737[_0x9b50('0x10')],_0x5d5eee);_0x4391b3(_0x55e791[_0x9b50('0xf')](0x1f4,_0x108737[_0x9b50('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 1c1e4e0..061baf8 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 _0xae24=['isAuthenticated','index','/describe','/:id','put','update','delete','exports','multer','path','express','Router','../../config/environment','get'];(function(_0x1241b1,_0x5a467f){var _0x2e229f=function(_0x62006){while(--_0x62006){_0x1241b1['push'](_0x1241b1['shift']());}};_0x2e229f(++_0x5a467f);}(_0xae24,0x182));var _0x4ae2=function(_0x458867,_0x193fbd){_0x458867=_0x458867-0x0;var _0x305d3e=_0xae24[_0x458867];return _0x305d3e;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ae2('0x4'));var controller=require('./cmHopperBlack.controller');router[_0x4ae2('0x5')]('/',auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x7')]);router[_0x4ae2('0x5')](_0x4ae2('0x8'),auth[_0x4ae2('0x6')](),controller['describe']);router['get'](_0x4ae2('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x4ae2('0xa')](_0x4ae2('0x9'),auth['isAuthenticated'](),controller[_0x4ae2('0xb')]);router[_0x4ae2('0xc')](_0x4ae2('0x9'),auth[_0x4ae2('0x6')](),controller['destroy']);module[_0x4ae2('0xd')]=router; \ No newline at end of file +var _0xd6d6=['./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2f7f56,_0x389de3){var _0x49a05b=function(_0x3a89d6){while(--_0x3a89d6){_0x2f7f56['push'](_0x2f7f56['shift']());}};_0x49a05b(++_0x389de3);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x2fd3a4,_0x496a7c){_0x2fd3a4=_0x2fd3a4-0x0;var _0x4b0d96=_0xd6d6[_0x2fd3a4];return _0x4b0d96;};'use strict';var multer=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var path=require(_0x6d6d('0x2'));var timeout=require(_0x6d6d('0x3'));var express=require('express');var router=express[_0x6d6d('0x4')]();var auth=require(_0x6d6d('0x5'));var interaction=require(_0x6d6d('0x6'));var config=require(_0x6d6d('0x7'));var controller=require(_0x6d6d('0x8'));router[_0x6d6d('0x9')]('/',auth[_0x6d6d('0xa')](),controller['index']);router[_0x6d6d('0x9')](_0x6d6d('0xb'),auth[_0x6d6d('0xa')](),controller[_0x6d6d('0xc')]);router[_0x6d6d('0x9')](_0x6d6d('0xd'),auth[_0x6d6d('0xa')](),controller['show']);router['put'](_0x6d6d('0xd'),auth[_0x6d6d('0xa')](),controller[_0x6d6d('0xe')]);router[_0x6d6d('0xf')](_0x6d6d('0xd'),auth['isAuthenticated'](),controller[_0x6d6d('0x10')]);module[_0x6d6d('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 09e5bd5..b5897a8 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 _0xf9ec=['seconds','dispositionat','BOOLEAN','sequelize','exports','STRING','DATE','INTEGER','getDataValue','endtime','setDataValue'];(function(_0x2dc985,_0x1f771e){var _0x470251=function(_0x527aee){while(--_0x527aee){_0x2dc985['push'](_0x2dc985['shift']());}};_0x470251(++_0x1f771e);}(_0xf9ec,0xa8));var _0xcf9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf9ec[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xcf9e('0x0'));var moment=require('moment');module[_0xcf9e('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xcf9e('0x2')]},'scheduledat':{'type':Sequelize[_0xcf9e('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcf9e('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xcf9e('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xcf9e('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xcf9e('0x2')]},'calleridname':{'type':Sequelize[_0xcf9e('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xcf9e('0x3')]},'answertime':{'type':Sequelize[_0xcf9e('0x3')]},'droptime':{'type':Sequelize[_0xcf9e('0x3')]},'endtime':{'type':Sequelize[_0xcf9e('0x3')]},'ringtime':{'type':Sequelize[_0xcf9e('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xcf9e('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xcf9e('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcf9e('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcf9e('0x2')]},'campaign':{'type':Sequelize[_0xcf9e('0x2')]},'campaigntype':{'type':Sequelize[_0xcf9e('0x2')]},'membername':{'type':Sequelize[_0xcf9e('0x2')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xcf9e('0x2')]},'dispositionat':{'type':Sequelize[_0xcf9e('0x3')],'set':function(_0x1a1edf){var _0x434ce5=this[_0xcf9e('0x5')](_0xcf9e('0x6'));if(_0x434ce5&&_0x1a1edf){this[_0xcf9e('0x7')]('followuptime',moment(_0x1a1edf)['diff'](moment(_0x434ce5),_0xcf9e('0x8')));}return this[_0xcf9e('0x7')](_0xcf9e('0x9'),_0x1a1edf);}},'amd':{'type':Sequelize[_0xcf9e('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xcf9e('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xcf9e('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xcf9e('0x3')]},'callback':{'type':Sequelize[_0xcf9e('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcf9e('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcf9e('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xcf9e('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xcf9e('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xcf9e('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcf9e('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcf9e('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcf9e('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcf9e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8f8a=['dispositionat','BOOLEAN','moment','exports','INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime','seconds'];(function(_0x4ecbce,_0x290a94){var _0x5dda0d=function(_0x3a5ed5){while(--_0x3a5ed5){_0x4ecbce['push'](_0x4ecbce['shift']());}};_0x5dda0d(++_0x290a94);}(_0x8f8a,0x65));var _0xa8f8=function(_0x2d2c1c,_0x68b497){_0x2d2c1c=_0x2d2c1c-0x0;var _0x357c7a=_0x8f8a[_0x2d2c1c];return _0x357c7a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa8f8('0x0'));module[_0xa8f8('0x1')]={'state':{'type':Sequelize[_0xa8f8('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xa8f8('0x3')]},'scheduledat':{'type':Sequelize[_0xa8f8('0x4')]},'countbusyretry':{'type':Sequelize[_0xa8f8('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa8f8('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa8f8('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xa8f8('0x3')]},'originatecalleridname':{'type':Sequelize[_0xa8f8('0x3')]},'calleridnum':{'type':Sequelize[_0xa8f8('0x3')]},'calleridname':{'type':Sequelize[_0xa8f8('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xa8f8('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xa8f8('0x4')]},'endtime':{'type':Sequelize[_0xa8f8('0x4')]},'ringtime':{'type':Sequelize[_0xa8f8('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa8f8('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa8f8('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa8f8('0x3')]},'campaign':{'type':Sequelize[_0xa8f8('0x3')]},'campaigntype':{'type':Sequelize[_0xa8f8('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xa8f8('0x3')]},'disposition':{'type':Sequelize[_0xa8f8('0x3')]},'dispositionat':{'type':Sequelize[_0xa8f8('0x4')],'set':function(_0x2020fd){var _0x27beab=this[_0xa8f8('0x5')]('endtime');if(_0x27beab&&_0x2020fd){this[_0xa8f8('0x6')](_0xa8f8('0x7'),moment(_0x2020fd)['diff'](moment(_0x27beab),_0xa8f8('0x8')));}return this[_0xa8f8('0x6')](_0xa8f8('0x9'),_0x2020fd);}},'amd':{'type':Sequelize[_0xa8f8('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xa8f8('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xa8f8('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xa8f8('0x4')]},'callback':{'type':Sequelize[_0xa8f8('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa8f8('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa8f8('0x4')]},'deleted':{'type':Sequelize[_0xa8f8('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xa8f8('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xa8f8('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xa8f8('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa8f8('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa8f8('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa8f8('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa8f8('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 00ca876..9dbcacb 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 _0x6db4=['checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','count','include','findAll','rows','catch','show','params','options','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','find','into','cm_hopper','phone','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','scheduledAt','ANY_VALUE(ContactId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x6db4,0x111));var _0x46db=function(_0x34aee7,_0x160bfc){_0x34aee7=_0x34aee7-0x0;var _0x330b4d=_0x6db4[_0x34aee7];return _0x330b4d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x46db('0x0'));var rimraf=require(_0x46db('0x1'));var zipdir=require(_0x46db('0x2'));var jsonpatch=require(_0x46db('0x3'));var rp=require(_0x46db('0x4'));var moment=require(_0x46db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x46db('0x6'));var util=require(_0x46db('0x7'));var path=require(_0x46db('0x8'));var sox=require(_0x46db('0x9'));var csv=require(_0x46db('0xa'));var ejs=require(_0x46db('0xb'));var fs=require('fs');var _=require(_0x46db('0xc'));var squel=require('squel');var crypto=require(_0x46db('0xd'));var jsforce=require(_0x46db('0xe'));var deskjs=require(_0x46db('0xf'));var toCsv=require(_0x46db('0xa'));var querystring=require(_0x46db('0x10'));var Papa=require(_0x46db('0x11'));var Redis=require(_0x46db('0x12'));var authService=require(_0x46db('0x13'));var qs=require(_0x46db('0x14'));var as=require(_0x46db('0x15'));var hardwareService=require(_0x46db('0x16'));var logger=require(_0x46db('0x17'))('api');var utils=require(_0x46db('0x18'));var config=require(_0x46db('0x19'));var db=require(_0x46db('0x1a'))['db'];function respondWithStatusCode(_0x250d26,_0xfd2064){_0xfd2064=_0xfd2064||0xcc;return function(_0xc6d202){if(_0xc6d202){return _0x250d26[_0x46db('0x1b')](_0xfd2064);}return _0x250d26[_0x46db('0x1c')](_0xfd2064)[_0x46db('0x1d')]();};}function respondWithResult(_0x5dee53,_0x54b34d){_0x54b34d=_0x54b34d||0xc8;return function(_0x5f3f69){if(_0x5f3f69){return _0x5dee53[_0x46db('0x1c')](_0x54b34d)[_0x46db('0x1e')](_0x5f3f69);}};}function respondWithFilteredResult(_0x5c982c,_0x1a79a6){return function(_0x479544){if(_0x479544){var _0x30e5a9=_0x479544['count'],_0x5dccf9=_0x1a79a6[_0x46db('0x1f')],_0x12976b=_0x1a79a6[_0x46db('0x1f')]+_0x1a79a6[_0x46db('0x20')],_0x41a0bc;if(_0x12976b>=_0x30e5a9){_0x12976b=_0x30e5a9;_0x41a0bc=0xc8;}else{_0x41a0bc=0xce;}_0x5c982c[_0x46db('0x1c')](_0x41a0bc);return _0x5c982c[_0x46db('0x21')](_0x46db('0x22'),_0x5dccf9+'-'+_0x12976b+'/'+_0x30e5a9)[_0x46db('0x1e')](_0x479544);}return null;};}function patchUpdates(_0x40cf26){return function(_0x5cfc1b){try{jsonpatch[_0x46db('0x23')](_0x5cfc1b,_0x40cf26,!![]);}catch(_0x2d5af3){return BPromise[_0x46db('0x24')](_0x2d5af3);}return _0x5cfc1b['save']();};}function saveUpdates(_0x521b93,_0x4fb609){return function(_0x597a95){if(_0x597a95){return _0x597a95[_0x46db('0x25')](_0x521b93)[_0x46db('0x26')](function(_0x38ee0c){return _0x38ee0c;});}return null;};}function removeEntity(_0x4c7fd1,_0x50090f){return function(_0x27aab2){if(_0x27aab2){return _0x27aab2[_0x46db('0x27')]()[_0x46db('0x26')](function(){_0x4c7fd1[_0x46db('0x1c')](0xcc)[_0x46db('0x1d')]();});}};}function handleEntityNotFound(_0x2d3688,_0x2bf7b4){return function(_0x3a50dd){if(!_0x3a50dd){_0x2d3688[_0x46db('0x1b')](0x194);}return _0x3a50dd;};}function handleError(_0x7bcdf5,_0x509ebf){_0x509ebf=_0x509ebf||0x1f4;return function(_0x44f676){logger[_0x46db('0x28')](_0x44f676[_0x46db('0x29')]);if(_0x44f676[_0x46db('0x2a')]){delete _0x44f676[_0x46db('0x2a')];}_0x7bcdf5[_0x46db('0x1c')](_0x509ebf)['send'](_0x44f676);};}exports[_0x46db('0x2b')]=function(_0x1ed102,_0x1a3855){var _0x4e9bf5={},_0x131d75={},_0x3d3d3d={'count':0x0,'rows':[]};var _0x346b0c=_[_0x46db('0x2c')](db[_0x46db('0x2d')][_0x46db('0x2e')],function(_0x2c66e5){return{'name':_0x2c66e5[_0x46db('0x2f')],'type':_0x2c66e5[_0x46db('0x30')][_0x46db('0x31')]};});_0x131d75['model']=_[_0x46db('0x2c')](_0x346b0c,_0x46db('0x2a'));_0x131d75['query']=_[_0x46db('0x32')](_0x1ed102[_0x46db('0x33')]);_0x131d75[_0x46db('0x34')]=_[_0x46db('0x35')](_0x131d75[_0x46db('0x36')],_0x131d75[_0x46db('0x33')]);_0x4e9bf5[_0x46db('0x37')]=_[_0x46db('0x35')](_0x131d75[_0x46db('0x36')],qs[_0x46db('0x38')](_0x1ed102[_0x46db('0x33')][_0x46db('0x38')]));_0x4e9bf5['attributes']=_0x4e9bf5['attributes'][_0x46db('0x39')]?_0x4e9bf5[_0x46db('0x37')]:_0x131d75[_0x46db('0x36')];if(!_0x1ed102['query'][_0x46db('0x3a')](_0x46db('0x3b'))){_0x4e9bf5['limit']=qs[_0x46db('0x20')](_0x1ed102[_0x46db('0x33')][_0x46db('0x20')]);_0x4e9bf5[_0x46db('0x1f')]=qs[_0x46db('0x1f')](_0x1ed102['query']['offset']);}_0x4e9bf5[_0x46db('0x3c')]=qs[_0x46db('0x3d')](_0x1ed102[_0x46db('0x33')][_0x46db('0x3d')]);_0x4e9bf5[_0x46db('0x3e')]=qs['filters'](_[_0x46db('0x3f')](_0x1ed102[_0x46db('0x33')],_0x131d75[_0x46db('0x34')]),_0x346b0c);if(_0x1ed102['query']['filter']){_0x4e9bf5[_0x46db('0x3e')]=_[_0x46db('0x40')](_0x4e9bf5[_0x46db('0x3e')],{'$or':_[_0x46db('0x2c')](_0x346b0c,function(_0x6fb7){if(_0x6fb7[_0x46db('0x30')]!=='VIRTUAL'){var _0x4c3779={};_0x4c3779[_0x6fb7[_0x46db('0x2a')]]={'$like':'%'+_0x1ed102[_0x46db('0x33')]['filter']+'%'};return _0x4c3779;}})});}_0x4e9bf5=_[_0x46db('0x40')]({},_0x4e9bf5,_0x1ed102['options']);var _0x3cd7c9={'where':_0x4e9bf5['where']};return db[_0x46db('0x2d')][_0x46db('0x41')](_0x3cd7c9)[_0x46db('0x26')](function(_0xc94b7c){_0x3d3d3d['count']=_0xc94b7c;if(_0x1ed102['query']['includeAll']){_0x4e9bf5[_0x46db('0x42')]=[{'all':!![]}];}return db[_0x46db('0x2d')][_0x46db('0x43')](_0x4e9bf5);})[_0x46db('0x26')](function(_0x4e2fde){_0x3d3d3d[_0x46db('0x44')]=_0x4e2fde;return _0x3d3d3d;})[_0x46db('0x26')](respondWithFilteredResult(_0x1a3855,_0x4e9bf5))[_0x46db('0x45')](handleError(_0x1a3855,null));};exports[_0x46db('0x46')]=function(_0x36b031,_0x3c96fb){var _0x3f31e1={'raw':!![],'where':{'id':_0x36b031[_0x46db('0x47')]['id']}},_0x1c9b12={};_0x1c9b12[_0x46db('0x36')]=_[_0x46db('0x32')](db[_0x46db('0x2d')][_0x46db('0x2e')]);_0x1c9b12[_0x46db('0x33')]=_[_0x46db('0x32')](_0x36b031[_0x46db('0x33')]);_0x1c9b12['filters']=_[_0x46db('0x35')](_0x1c9b12[_0x46db('0x36')],_0x1c9b12[_0x46db('0x33')]);_0x3f31e1[_0x46db('0x37')]=_[_0x46db('0x35')](_0x1c9b12['model'],qs[_0x46db('0x38')](_0x36b031[_0x46db('0x33')][_0x46db('0x38')]));_0x3f31e1[_0x46db('0x37')]=_0x3f31e1[_0x46db('0x37')][_0x46db('0x39')]?_0x3f31e1[_0x46db('0x37')]:_0x1c9b12[_0x46db('0x36')];if(_0x36b031['query']['includeAll']){_0x3f31e1[_0x46db('0x42')]=[{'all':!![]}];}_0x3f31e1=_[_0x46db('0x40')]({},_0x3f31e1,_0x36b031[_0x46db('0x48')]);return db[_0x46db('0x2d')]['find'](_0x3f31e1)[_0x46db('0x26')](handleEntityNotFound(_0x3c96fb,null))[_0x46db('0x26')](respondWithResult(_0x3c96fb,null))[_0x46db('0x45')](handleError(_0x3c96fb,null));};exports[_0x46db('0x49')]=function(_0x290cd1,_0x193b2f){return db[_0x46db('0x2d')][_0x46db('0x49')]()[_0x46db('0x26')](respondWithResult(_0x193b2f,null))[_0x46db('0x45')](handleError(_0x193b2f,null));};exports['update']=function(_0x20ec6d,_0x49acb1){if(_0x20ec6d[_0x46db('0x4a')][_0x46db('0x4b')]){delete _0x20ec6d[_0x46db('0x4a')][_0x46db('0x4b')];}return db[_0x46db('0x2d')]['find']({'where':{'uniqueid':_0x20ec6d[_0x46db('0x47')]['id']}})[_0x46db('0x26')](handleEntityNotFound(_0x49acb1,null))['then'](saveUpdates(_0x20ec6d[_0x46db('0x4a')],null))[_0x46db('0x26')](respondWithResult(_0x49acb1,null))['catch'](handleError(_0x49acb1,null));};exports[_0x46db('0x4c')]=function(_0x23b511,_0x4c4892,_0x55ba77){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x23b511[_0x46db('0x47')]['id']},'attributes':[[db['sequelize']['fn'](_0x46db('0x4d'),db[_0x46db('0x4e')]['fn']('IF',db[_0x46db('0x4e')]['literal'](_0x46db('0x4f')))),_0x46db('0x50')],[db[_0x46db('0x4e')]['fn'](_0x46db('0x4d'),db['sequelize']['fn']('IF',db[_0x46db('0x4e')][_0x46db('0x51')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db['sequelize']['fn'](_0x46db('0x4d'),db['sequelize']['fn']('IF',db[_0x46db('0x4e')][_0x46db('0x51')](_0x46db('0x52')))),'busyContacts'],[db[_0x46db('0x4e')]['fn'](_0x46db('0x4d'),db[_0x46db('0x4e')]['fn']('IF',db[_0x46db('0x4e')][_0x46db('0x51')]('`state`\x20=\x208,\x201,\x20null'))),_0x46db('0x53')],[db['sequelize']['fn'](_0x46db('0x4d'),db['sequelize']['fn']('IF',db[_0x46db('0x4e')][_0x46db('0x51')](_0x46db('0x54')))),_0x46db('0x55')],[db['sequelize']['fn'](_0x46db('0x4d'),db[_0x46db('0x4e')]['fn']('IF',db[_0x46db('0x4e')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x46db('0x56')],[db[_0x46db('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x46db('0x4e')][_0x46db('0x51')](_0x46db('0x57')))),_0x46db('0x58')],[db['sequelize']['fn'](_0x46db('0x4d'),db[_0x46db('0x4e')]['fn']('IF',db[_0x46db('0x4e')]['literal'](_0x46db('0x59')))),'answeringMachine']]})[_0x46db('0x26')](handleEntityNotFound(_0x4c4892,null))[_0x46db('0x26')](respondWithResult(_0x4c4892,null))[_0x46db('0x45')](handleError(_0x4c4892,null));};exports[_0x46db('0x5a')]=function(_0x3a36ca,_0x2eac59,_0x471726){return db[_0x46db('0x2d')][_0x46db('0x43')]({'raw':![],'where':{'CampaignId':_0x3a36ca[_0x46db('0x47')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x46db('0x51')](_0x46db('0x4f')))),_0x46db('0x50')],[db[_0x46db('0x4e')]['fn']('COUNT',db[_0x46db('0x4e')]['fn']('IF',db[_0x46db('0x4e')]['literal'](_0x46db('0x5b')))),_0x46db('0x5c')],[db[_0x46db('0x4e')]['fn'](_0x46db('0x4d'),db[_0x46db('0x4e')]['fn']('IF',db['sequelize']['literal'](_0x46db('0x52')))),_0x46db('0x5d')],[db[_0x46db('0x4e')]['fn'](_0x46db('0x4d'),db[_0x46db('0x4e')]['fn']('IF',db['sequelize'][_0x46db('0x51')](_0x46db('0x5e')))),_0x46db('0x53')],[db[_0x46db('0x4e')]['fn']('COUNT',db[_0x46db('0x4e')]['fn']('IF',db[_0x46db('0x4e')][_0x46db('0x51')](_0x46db('0x54')))),_0x46db('0x55')],[db['sequelize']['fn'](_0x46db('0x4d'),db[_0x46db('0x4e')]['fn']('IF',db[_0x46db('0x4e')][_0x46db('0x51')](_0x46db('0x5f')))),_0x46db('0x56')],[db[_0x46db('0x4e')]['fn']('COUNT',db[_0x46db('0x4e')]['fn']('IF',db[_0x46db('0x4e')][_0x46db('0x51')](_0x46db('0x57')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x46db('0x4e')][_0x46db('0x51')](_0x46db('0x59')))),_0x46db('0x60')]]})[_0x46db('0x26')](handleEntityNotFound(_0x2eac59,null))[_0x46db('0x26')](respondWithResult(_0x2eac59,null))['catch'](handleError(_0x2eac59,null));};exports[_0x46db('0x61')]=function(_0x2013e4,_0x56f4c8,_0x337bb3){return db['VoiceQueue'][_0x46db('0x62')]({'where':{'id':_0x2013e4['params']['id']}})[_0x46db('0x26')](handleEntityNotFound(_0x56f4c8,null))[_0x46db('0x26')](function(_0x3bd0f4){var _0x473e74;if(_0x3bd0f4){_0x473e74=squel['insert']()[_0x46db('0x63')](_0x46db('0x64'))['fromQuery']([_0x46db('0x65'),'scheduledAt',_0x46db('0x66'),'ListId',_0x46db('0x67'),_0x46db('0x68'),_0x46db('0x69')],squel[_0x46db('0x6a')]()[_0x46db('0x6b')](_0x46db('0x6c'),_0x46db('0x65'))[_0x46db('0x6b')](_0x46db('0x6d'),_0x46db('0x6e'))[_0x46db('0x6b')](_0x46db('0x6f'),'ContactId')[_0x46db('0x6b')]('ANY_VALUE(ListId)',_0x46db('0x70'))['field'](_0x46db('0x71'),_0x46db('0x67'))[_0x46db('0x6b')](_0x46db('0x6d'),_0x46db('0x68'))[_0x46db('0x6b')](_0x46db('0x6d'),_0x46db('0x69'))[_0x46db('0x72')](_0x46db('0x73'))[_0x46db('0x3e')](_0x46db('0x74'),_0x2013e4[_0x46db('0x47')]['id'][_0x46db('0x75')]())[_0x46db('0x3e')]('state\x20=\x20?',_0x2013e4['body'][_0x46db('0x76')][_0x46db('0x75')]())['where'](_0x46db('0x77'))['where'](_0x46db('0x78'),squel[_0x46db('0x6a')]()[_0x46db('0x6b')]('phone')['from'](_0x46db('0x64'))[_0x46db('0x3e')](_0x46db('0x74'),_0x2013e4[_0x46db('0x47')]['id'][_0x46db('0x75')]()))[_0x46db('0x3e')](_0x46db('0x78'),squel[_0x46db('0x6a')]()[_0x46db('0x6b')](_0x46db('0x79'))[_0x46db('0x72')]('cm_hopper_final')[_0x46db('0x3e')]('VoiceQueueId\x20=\x20?',_0x2013e4[_0x46db('0x47')]['id'][_0x46db('0x75')]())[_0x46db('0x3e')](_0x46db('0x7a')))[_0x46db('0x7b')]('ContactId'))[_0x46db('0x75')]();return db[_0x46db('0x4e')][_0x46db('0x33')](_0x473e74);}return[];})[_0x46db('0x26')](respondWithResult(_0x56f4c8,null))[_0x46db('0x45')](handleError(_0x56f4c8,null));};exports[_0x46db('0x7c')]=function(_0x1a430a,_0x326ac2,_0x5ef702){return db[_0x46db('0x7d')][_0x46db('0x62')]({'where':{'id':_0x1a430a[_0x46db('0x47')]['id']}})[_0x46db('0x26')](handleEntityNotFound(_0x326ac2,null))[_0x46db('0x26')](function(_0x4eb2b6){var _0x451cf7;if(_0x4eb2b6){_0x451cf7=squel[_0x46db('0x7e')]()[_0x46db('0x63')](_0x46db('0x64'))[_0x46db('0x7f')](['phone','scheduledAt',_0x46db('0x66'),_0x46db('0x70'),_0x46db('0x80'),'createdAt',_0x46db('0x69')],squel[_0x46db('0x6a')]()['field'](_0x46db('0x6c'),'phone')[_0x46db('0x6b')](_0x46db('0x6d'),_0x46db('0x6e'))[_0x46db('0x6b')]('ANY_VALUE(ContactId)',_0x46db('0x66'))[_0x46db('0x6b')]('ANY_VALUE(ListId)',_0x46db('0x70'))[_0x46db('0x6b')](_0x46db('0x81'),'CampaignId')[_0x46db('0x6b')](_0x46db('0x6d'),_0x46db('0x68'))[_0x46db('0x6b')](_0x46db('0x6d'),_0x46db('0x69'))['from'](_0x46db('0x73'))[_0x46db('0x3e')](_0x46db('0x82'),_0x1a430a[_0x46db('0x47')]['id'][_0x46db('0x75')]())[_0x46db('0x3e')](_0x46db('0x83'),_0x1a430a['body'][_0x46db('0x76')][_0x46db('0x75')]())[_0x46db('0x3e')](_0x46db('0x77'))['where'](_0x46db('0x78'),squel['select']()['field'](_0x46db('0x65'))[_0x46db('0x72')](_0x46db('0x64'))['where']('CampaignId\x20=\x20?',_0x1a430a['params']['id'][_0x46db('0x75')]()))[_0x46db('0x3e')](_0x46db('0x78'),squel[_0x46db('0x6a')]()[_0x46db('0x6b')](_0x46db('0x79'))[_0x46db('0x72')](_0x46db('0x73'))[_0x46db('0x3e')](_0x46db('0x82'),_0x1a430a['params']['id'][_0x46db('0x75')]())[_0x46db('0x3e')](_0x46db('0x7a')))['group'](_0x46db('0x66')))[_0x46db('0x75')]();return db[_0x46db('0x4e')][_0x46db('0x33')](_0x451cf7);}return[];})['then'](respondWithResult(_0x326ac2,null))[_0x46db('0x45')](handleError(_0x326ac2,null));};exports[_0x46db('0x84')]=function(_0x2f6d64,_0x47cfd9,_0x4814f8){return db[_0x46db('0x85')][_0x46db('0x86')]({'where':{'VoiceQueueId':_0x2f6d64[_0x46db('0x4a')][_0x46db('0x67')],'CampaignId':_0x2f6d64[_0x46db('0x4a')][_0x46db('0x80')],'ContactId':_0x2f6d64[_0x46db('0x4a')][_0x46db('0x66')]}})[_0x46db('0x26')](handleEntityNotFound(_0x47cfd9,null))[_0x46db('0x26')](function(_0x3bac02){if(_0x3bac02){return _0x3bac02;}return null;})[_0x46db('0x26')](respondWithResult(_0x47cfd9,null))[_0x46db('0x45')](handleError(_0x47cfd9,null));}; \ No newline at end of file +var _0xcaef=['filter','options','includeAll','include','CmHopperFinal','findAll','rows','catch','show','params','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','select','field','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','updatedAt','from','toString','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','VoiceQueueId\x20=\x20?','calleridnum','cm_hopper_final','Campaign','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','state','state\x20=\x204','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','nolimit','order','sort','where','pick','merge','map','VIRTUAL'];(function(_0x213c94,_0x5cb383){var _0x357d3e=function(_0xcf0638){while(--_0xcf0638){_0x213c94['push'](_0x213c94['shift']());}};_0x357d3e(++_0x5cb383);}(_0xcaef,0x1c9));var _0xfcae=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xcaef[_0xa8883];return _0x479426;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfcae('0x0'));var rimraf=require(_0xfcae('0x1'));var zipdir=require(_0xfcae('0x2'));var jsonpatch=require(_0xfcae('0x3'));var rp=require('request-promise');var moment=require(_0xfcae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfcae('0x5'));var util=require(_0xfcae('0x6'));var path=require('path');var sox=require(_0xfcae('0x7'));var csv=require(_0xfcae('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfcae('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfcae('0xa'));var deskjs=require(_0xfcae('0xb'));var toCsv=require(_0xfcae('0x8'));var querystring=require('querystring');var Papa=require(_0xfcae('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfcae('0xd'));var as=require(_0xfcae('0xe'));var hardwareService=require(_0xfcae('0xf'));var logger=require(_0xfcae('0x10'))(_0xfcae('0x11'));var utils=require(_0xfcae('0x12'));var config=require(_0xfcae('0x13'));var db=require(_0xfcae('0x14'))['db'];function respondWithStatusCode(_0x2b8561,_0x56398a){_0x56398a=_0x56398a||0xcc;return function(_0x209f76){if(_0x209f76){return _0x2b8561[_0xfcae('0x15')](_0x56398a);}return _0x2b8561[_0xfcae('0x16')](_0x56398a)[_0xfcae('0x17')]();};}function respondWithResult(_0x2569c2,_0x38e387){_0x38e387=_0x38e387||0xc8;return function(_0x19cf42){if(_0x19cf42){return _0x2569c2[_0xfcae('0x16')](_0x38e387)['json'](_0x19cf42);}};}function respondWithFilteredResult(_0x42a59b,_0x4a84aa){return function(_0x145ee3){if(_0x145ee3){var _0x12a15e=_0x145ee3[_0xfcae('0x18')],_0x1ab8f3=_0x4a84aa[_0xfcae('0x19')],_0x3e8a36=_0x4a84aa[_0xfcae('0x19')]+_0x4a84aa[_0xfcae('0x1a')],_0x7504d;if(_0x3e8a36>=_0x12a15e){_0x3e8a36=_0x12a15e;_0x7504d=0xc8;}else{_0x7504d=0xce;}_0x42a59b['status'](_0x7504d);return _0x42a59b[_0xfcae('0x1b')]('Content-Range',_0x1ab8f3+'-'+_0x3e8a36+'/'+_0x12a15e)[_0xfcae('0x1c')](_0x145ee3);}return null;};}function patchUpdates(_0xb79156){return function(_0x2ed097){try{jsonpatch[_0xfcae('0x1d')](_0x2ed097,_0xb79156,!![]);}catch(_0x439567){return BPromise[_0xfcae('0x1e')](_0x439567);}return _0x2ed097[_0xfcae('0x1f')]();};}function saveUpdates(_0x50c34a,_0x53cb65){return function(_0x1f79cb){if(_0x1f79cb){return _0x1f79cb[_0xfcae('0x20')](_0x50c34a)[_0xfcae('0x21')](function(_0x17daf9){return _0x17daf9;});}return null;};}function removeEntity(_0x1e9b7a,_0x35d5d7){return function(_0xc2d0ed){if(_0xc2d0ed){return _0xc2d0ed[_0xfcae('0x22')]()[_0xfcae('0x21')](function(){_0x1e9b7a['status'](0xcc)[_0xfcae('0x17')]();});}};}function handleEntityNotFound(_0x4571a9,_0x57687e){return function(_0x49e534){if(!_0x49e534){_0x4571a9['sendStatus'](0x194);}return _0x49e534;};}function handleError(_0x337324,_0x5a19be){_0x5a19be=_0x5a19be||0x1f4;return function(_0x229e86){logger[_0xfcae('0x23')](_0x229e86[_0xfcae('0x24')]);if(_0x229e86['name']){delete _0x229e86[_0xfcae('0x25')];}_0x337324[_0xfcae('0x16')](_0x5a19be)[_0xfcae('0x26')](_0x229e86);};}exports[_0xfcae('0x27')]=function(_0x58611e,_0x4ca906){var _0x48f6bb={},_0x47b7ed={},_0x4b874b={'count':0x0,'rows':[]};var _0x28f157=_['map'](db['CmHopperFinal'][_0xfcae('0x28')],function(_0xb3f001){return{'name':_0xb3f001[_0xfcae('0x29')],'type':_0xb3f001['type'][_0xfcae('0x2a')]};});_0x47b7ed['model']=_['map'](_0x28f157,'name');_0x47b7ed[_0xfcae('0x2b')]=_[_0xfcae('0x2c')](_0x58611e[_0xfcae('0x2b')]);_0x47b7ed[_0xfcae('0x2d')]=_['intersection'](_0x47b7ed['model'],_0x47b7ed['query']);_0x48f6bb[_0xfcae('0x2e')]=_[_0xfcae('0x2f')](_0x47b7ed[_0xfcae('0x30')],qs['fields'](_0x58611e['query'][_0xfcae('0x31')]));_0x48f6bb['attributes']=_0x48f6bb[_0xfcae('0x2e')][_0xfcae('0x32')]?_0x48f6bb[_0xfcae('0x2e')]:_0x47b7ed[_0xfcae('0x30')];if(!_0x58611e[_0xfcae('0x2b')]['hasOwnProperty'](_0xfcae('0x33'))){_0x48f6bb[_0xfcae('0x1a')]=qs[_0xfcae('0x1a')](_0x58611e['query'][_0xfcae('0x1a')]);_0x48f6bb[_0xfcae('0x19')]=qs[_0xfcae('0x19')](_0x58611e[_0xfcae('0x2b')]['offset']);}_0x48f6bb[_0xfcae('0x34')]=qs[_0xfcae('0x35')](_0x58611e[_0xfcae('0x2b')]['sort']);_0x48f6bb[_0xfcae('0x36')]=qs[_0xfcae('0x2d')](_[_0xfcae('0x37')](_0x58611e[_0xfcae('0x2b')],_0x47b7ed['filters']),_0x28f157);if(_0x58611e['query']['filter']){_0x48f6bb[_0xfcae('0x36')]=_[_0xfcae('0x38')](_0x48f6bb['where'],{'$or':_[_0xfcae('0x39')](_0x28f157,function(_0x5039d6){if(_0x5039d6['type']!==_0xfcae('0x3a')){var _0x28cdbe={};_0x28cdbe[_0x5039d6[_0xfcae('0x25')]]={'$like':'%'+_0x58611e[_0xfcae('0x2b')][_0xfcae('0x3b')]+'%'};return _0x28cdbe;}})});}_0x48f6bb=_[_0xfcae('0x38')]({},_0x48f6bb,_0x58611e[_0xfcae('0x3c')]);var _0x14a200={'where':_0x48f6bb['where']};return db['CmHopperFinal']['count'](_0x14a200)['then'](function(_0x50db9){_0x4b874b[_0xfcae('0x18')]=_0x50db9;if(_0x58611e['query'][_0xfcae('0x3d')]){_0x48f6bb[_0xfcae('0x3e')]=[{'all':!![]}];}return db[_0xfcae('0x3f')][_0xfcae('0x40')](_0x48f6bb);})[_0xfcae('0x21')](function(_0x2f57a7){_0x4b874b[_0xfcae('0x41')]=_0x2f57a7;return _0x4b874b;})[_0xfcae('0x21')](respondWithFilteredResult(_0x4ca906,_0x48f6bb))[_0xfcae('0x42')](handleError(_0x4ca906,null));};exports[_0xfcae('0x43')]=function(_0xc54cba,_0x23873f){var _0x3f6d02={'raw':!![],'where':{'id':_0xc54cba[_0xfcae('0x44')]['id']}},_0x4211fc={};_0x4211fc[_0xfcae('0x30')]=_[_0xfcae('0x2c')](db['CmHopperFinal'][_0xfcae('0x28')]);_0x4211fc[_0xfcae('0x2b')]=_['keys'](_0xc54cba[_0xfcae('0x2b')]);_0x4211fc[_0xfcae('0x2d')]=_[_0xfcae('0x2f')](_0x4211fc[_0xfcae('0x30')],_0x4211fc[_0xfcae('0x2b')]);_0x3f6d02[_0xfcae('0x2e')]=_[_0xfcae('0x2f')](_0x4211fc['model'],qs[_0xfcae('0x31')](_0xc54cba[_0xfcae('0x2b')]['fields']));_0x3f6d02[_0xfcae('0x2e')]=_0x3f6d02[_0xfcae('0x2e')][_0xfcae('0x32')]?_0x3f6d02[_0xfcae('0x2e')]:_0x4211fc['model'];if(_0xc54cba['query']['includeAll']){_0x3f6d02[_0xfcae('0x3e')]=[{'all':!![]}];}_0x3f6d02=_['merge']({},_0x3f6d02,_0xc54cba[_0xfcae('0x3c')]);return db['CmHopperFinal'][_0xfcae('0x45')](_0x3f6d02)['then'](handleEntityNotFound(_0x23873f,null))[_0xfcae('0x21')](respondWithResult(_0x23873f,null))[_0xfcae('0x42')](handleError(_0x23873f,null));};exports[_0xfcae('0x46')]=function(_0x55838c,_0x5991d4){return db['CmHopperFinal']['describe']()[_0xfcae('0x21')](respondWithResult(_0x5991d4,null))['catch'](handleError(_0x5991d4,null));};exports[_0xfcae('0x20')]=function(_0x103cdb,_0x25b433){if(_0x103cdb[_0xfcae('0x47')]['uniqueid']){delete _0x103cdb[_0xfcae('0x47')][_0xfcae('0x48')];}return db['CmHopperFinal'][_0xfcae('0x45')]({'where':{'uniqueid':_0x103cdb[_0xfcae('0x44')]['id']}})['then'](handleEntityNotFound(_0x25b433,null))['then'](saveUpdates(_0x103cdb[_0xfcae('0x47')],null))['then'](respondWithResult(_0x25b433,null))[_0xfcae('0x42')](handleError(_0x25b433,null));};exports[_0xfcae('0x49')]=function(_0x41b0fe,_0x524cee,_0x43b66c){return db[_0xfcae('0x3f')][_0xfcae('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x41b0fe['params']['id']},'attributes':[[db[_0xfcae('0x4a')]['fn'](_0xfcae('0x4b'),db[_0xfcae('0x4a')]['fn']('IF',db[_0xfcae('0x4a')][_0xfcae('0x4c')](_0xfcae('0x4d')))),'noSuchContacts'],[db[_0xfcae('0x4a')]['fn'](_0xfcae('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0xfcae('0x4c')](_0xfcae('0x4e')))),_0xfcae('0x4f')],[db[_0xfcae('0x4a')]['fn'](_0xfcae('0x4b'),db[_0xfcae('0x4a')]['fn']('IF',db[_0xfcae('0x4a')][_0xfcae('0x4c')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0xfcae('0x4a')]['fn'](_0xfcae('0x4b'),db[_0xfcae('0x4a')]['fn']('IF',db[_0xfcae('0x4a')][_0xfcae('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0xfcae('0x50')],[db[_0xfcae('0x4a')]['fn'](_0xfcae('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0xfcae('0x4c')](_0xfcae('0x51')))),_0xfcae('0x52')],[db[_0xfcae('0x4a')]['fn'](_0xfcae('0x4b'),db[_0xfcae('0x4a')]['fn']('IF',db[_0xfcae('0x4a')][_0xfcae('0x4c')](_0xfcae('0x53')))),'abandonedContacts'],[db[_0xfcae('0x4a')]['fn'](_0xfcae('0x4b'),db[_0xfcae('0x4a')]['fn']('IF',db['sequelize'][_0xfcae('0x4c')](_0xfcae('0x54')))),_0xfcae('0x55')],[db[_0xfcae('0x4a')]['fn']('COUNT',db[_0xfcae('0x4a')]['fn']('IF',db[_0xfcae('0x4a')][_0xfcae('0x4c')](_0xfcae('0x56')))),_0xfcae('0x57')]]})[_0xfcae('0x21')](handleEntityNotFound(_0x524cee,null))[_0xfcae('0x21')](respondWithResult(_0x524cee,null))[_0xfcae('0x42')](handleError(_0x524cee,null));};exports[_0xfcae('0x58')]=function(_0x187709,_0x32e4ea,_0x49f328){return db[_0xfcae('0x3f')][_0xfcae('0x40')]({'raw':![],'where':{'CampaignId':_0x187709[_0xfcae('0x44')]['id']},'attributes':[[db[_0xfcae('0x4a')]['fn'](_0xfcae('0x4b'),db['sequelize']['fn']('IF',db[_0xfcae('0x4a')]['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0xfcae('0x4a')]['fn'](_0xfcae('0x4b'),db[_0xfcae('0x4a')]['fn']('IF',db[_0xfcae('0x4a')][_0xfcae('0x4c')]('`state`\x20=\x203,\x201,\x20null'))),_0xfcae('0x4f')],[db[_0xfcae('0x4a')]['fn']('COUNT',db[_0xfcae('0x4a')]['fn']('IF',db[_0xfcae('0x4a')][_0xfcae('0x4c')](_0xfcae('0x59')))),_0xfcae('0x5a')],[db[_0xfcae('0x4a')]['fn']('COUNT',db[_0xfcae('0x4a')]['fn']('IF',db[_0xfcae('0x4a')][_0xfcae('0x4c')](_0xfcae('0x5b')))),_0xfcae('0x50')],[db[_0xfcae('0x4a')]['fn'](_0xfcae('0x4b'),db[_0xfcae('0x4a')]['fn']('IF',db[_0xfcae('0x4a')][_0xfcae('0x4c')](_0xfcae('0x51')))),_0xfcae('0x52')],[db[_0xfcae('0x4a')]['fn'](_0xfcae('0x4b'),db[_0xfcae('0x4a')]['fn']('IF',db[_0xfcae('0x4a')][_0xfcae('0x4c')](_0xfcae('0x53')))),_0xfcae('0x5c')],[db['sequelize']['fn'](_0xfcae('0x4b'),db[_0xfcae('0x4a')]['fn']('IF',db[_0xfcae('0x4a')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0xfcae('0x55')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xfcae('0x4a')][_0xfcae('0x4c')](_0xfcae('0x56')))),_0xfcae('0x57')]]})[_0xfcae('0x21')](handleEntityNotFound(_0x32e4ea,null))['then'](respondWithResult(_0x32e4ea,null))[_0xfcae('0x42')](handleError(_0x32e4ea,null));};exports[_0xfcae('0x5d')]=function(_0x918b06,_0x162f66,_0x33a5cf){return db[_0xfcae('0x5e')]['find']({'where':{'id':_0x918b06[_0xfcae('0x44')]['id']}})[_0xfcae('0x21')](handleEntityNotFound(_0x162f66,null))[_0xfcae('0x21')](function(_0x2d6b43){var _0x5d0a31;if(_0x2d6b43){_0x5d0a31=squel[_0xfcae('0x5f')]()[_0xfcae('0x60')]('cm_hopper')[_0xfcae('0x61')](['phone',_0xfcae('0x62'),_0xfcae('0x63'),_0xfcae('0x64'),_0xfcae('0x65'),_0xfcae('0x66'),'updatedAt'],squel[_0xfcae('0x67')]()[_0xfcae('0x68')]('ANY_VALUE(calleridnum)',_0xfcae('0x69'))['field'](_0xfcae('0x6a'),_0xfcae('0x62'))[_0xfcae('0x68')](_0xfcae('0x6b'),_0xfcae('0x63'))[_0xfcae('0x68')](_0xfcae('0x6c'),_0xfcae('0x64'))[_0xfcae('0x68')]('ANY_VALUE(VoiceQueueId)',_0xfcae('0x65'))[_0xfcae('0x68')](_0xfcae('0x6a'),_0xfcae('0x66'))['field'](_0xfcae('0x6a'),_0xfcae('0x6d'))[_0xfcae('0x6e')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x918b06['params']['id'][_0xfcae('0x6f')]())[_0xfcae('0x36')]('state\x20=\x20?',_0x918b06[_0xfcae('0x47')]['state']['toString']())[_0xfcae('0x36')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xfcae('0x36')](_0xfcae('0x70'),squel[_0xfcae('0x67')]()[_0xfcae('0x68')](_0xfcae('0x69'))[_0xfcae('0x6e')](_0xfcae('0x71'))[_0xfcae('0x36')](_0xfcae('0x72'),_0x918b06[_0xfcae('0x44')]['id']['toString']()))[_0xfcae('0x36')](_0xfcae('0x70'),squel[_0xfcae('0x67')]()[_0xfcae('0x68')](_0xfcae('0x73'))[_0xfcae('0x6e')](_0xfcae('0x74'))[_0xfcae('0x36')](_0xfcae('0x72'),_0x918b06['params']['id'][_0xfcae('0x6f')]())[_0xfcae('0x36')]('state\x20=\x204'))['group']('ContactId'))[_0xfcae('0x6f')]();return db[_0xfcae('0x4a')][_0xfcae('0x2b')](_0x5d0a31);}return[];})['then'](respondWithResult(_0x162f66,null))[_0xfcae('0x42')](handleError(_0x162f66,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0xb98b19,_0x377f85,_0x18ee95){return db[_0xfcae('0x75')][_0xfcae('0x45')]({'where':{'id':_0xb98b19['params']['id']}})['then'](handleEntityNotFound(_0x377f85,null))[_0xfcae('0x21')](function(_0x3ffe0a){var _0x37539e;if(_0x3ffe0a){_0x37539e=squel['insert']()[_0xfcae('0x60')](_0xfcae('0x71'))['fromQuery'](['phone',_0xfcae('0x62'),_0xfcae('0x63'),_0xfcae('0x64'),'CampaignId','createdAt','updatedAt'],squel[_0xfcae('0x67')]()[_0xfcae('0x68')](_0xfcae('0x76'),_0xfcae('0x69'))[_0xfcae('0x68')](_0xfcae('0x6a'),_0xfcae('0x62'))['field']('ANY_VALUE(ContactId)',_0xfcae('0x63'))[_0xfcae('0x68')]('ANY_VALUE(ListId)',_0xfcae('0x64'))[_0xfcae('0x68')](_0xfcae('0x77'),_0xfcae('0x78'))['field']('NOW()',_0xfcae('0x66'))[_0xfcae('0x68')](_0xfcae('0x6a'),_0xfcae('0x6d'))[_0xfcae('0x6e')](_0xfcae('0x74'))['where'](_0xfcae('0x79'),_0xb98b19[_0xfcae('0x44')]['id'][_0xfcae('0x6f')]())[_0xfcae('0x36')](_0xfcae('0x7a'),_0xb98b19[_0xfcae('0x47')][_0xfcae('0x7b')][_0xfcae('0x6f')]())[_0xfcae('0x36')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xfcae('0x36')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xfcae('0x67')]()[_0xfcae('0x68')]('phone')[_0xfcae('0x6e')](_0xfcae('0x71'))[_0xfcae('0x36')]('CampaignId\x20=\x20?',_0xb98b19['params']['id'][_0xfcae('0x6f')]()))['where'](_0xfcae('0x70'),squel[_0xfcae('0x67')]()['field'](_0xfcae('0x73'))[_0xfcae('0x6e')]('cm_hopper_final')[_0xfcae('0x36')](_0xfcae('0x79'),_0xb98b19[_0xfcae('0x44')]['id'][_0xfcae('0x6f')]())['where'](_0xfcae('0x7c')))[_0xfcae('0x7d')](_0xfcae('0x63')))[_0xfcae('0x6f')]();return db[_0xfcae('0x4a')][_0xfcae('0x2b')](_0x37539e);}return[];})[_0xfcae('0x21')](respondWithResult(_0x377f85,null))[_0xfcae('0x42')](handleError(_0x377f85,null));};exports[_0xfcae('0x7e')]=function(_0x1aae99,_0x57fb5b,_0xcebbeb){return db[_0xfcae('0x7f')][_0xfcae('0x80')]({'where':{'VoiceQueueId':_0x1aae99[_0xfcae('0x47')][_0xfcae('0x65')],'CampaignId':_0x1aae99[_0xfcae('0x47')][_0xfcae('0x78')],'ContactId':_0x1aae99['body'][_0xfcae('0x63')]}})[_0xfcae('0x21')](handleEntityNotFound(_0x57fb5b,null))['then'](function(_0x4d6672){if(_0x4d6672){return _0x4d6672;}return null;})['then'](respondWithResult(_0x57fb5b,null))[_0xfcae('0x42')](handleError(_0x57fb5b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 25400ef..b1999dd 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 _0xed74=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0xed74,0xfc));var _0x4ed7=function(_0x33628a,_0x2df134){_0x33628a=_0x33628a-0x0;var _0x25d370=_0xed74[_0x33628a];return _0x25d370;};'use strict';var _=require(_0x4ed7('0x0'));var util=require(_0x4ed7('0x1'));var logger=require(_0x4ed7('0x2'))('api');var moment=require(_0x4ed7('0x3'));var BPromise=require(_0x4ed7('0x4'));var rp=require(_0x4ed7('0x5'));var fs=require('fs');var path=require(_0x4ed7('0x6'));var rimraf=require('rimraf');var config=require(_0x4ed7('0x7'));var attributes=require(_0x4ed7('0x8'));module[_0x4ed7('0x9')]=function(_0x35c82a,_0x8ccbe6){return _0x35c82a[_0x4ed7('0xa')](_0x4ed7('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x4ed7('0xc'),'fields':['calleridnum']},{'name':_0x4ed7('0xd'),'fields':[_0x4ed7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc508=['api','bluebird','request-promise','path','rimraf','define','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x37ae2e,_0x35be3a){var _0x19c50f=function(_0x49732a){while(--_0x49732a){_0x37ae2e['push'](_0x37ae2e['shift']());}};_0x19c50f(++_0x35be3a);}(_0xc508,0x111));var _0x8c50=function(_0x1d698c,_0x4d1c3b){_0x1d698c=_0x1d698c-0x0;var _0x297ab7=_0xc508[_0x1d698c];return _0x297ab7;};'use strict';var _=require(_0x8c50('0x0'));var util=require(_0x8c50('0x1'));var logger=require(_0x8c50('0x2'))(_0x8c50('0x3'));var moment=require('moment');var BPromise=require(_0x8c50('0x4'));var rp=require(_0x8c50('0x5'));var fs=require('fs');var path=require(_0x8c50('0x6'));var rimraf=require(_0x8c50('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0xfbe2ad,_0x6b322d){return _0xfbe2ad[_0x8c50('0x8')](_0x8c50('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x8c50('0xa'),'fields':[_0x8c50('0xa')]},{'name':_0x8c50('0xb'),'fields':[_0x8c50('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index aae6f88..a7acce0 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 _0x9aba=['info','request\x20sent','stringify','error','code','CmHopperFinal,\x20%s,\x20%s','message','result','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x392886,_0x2543c5){var _0x50214e=function(_0x4b858e){while(--_0x4b858e){_0x392886['push'](_0x392886['shift']());}};_0x50214e(++_0x2543c5);}(_0x9aba,0x1df));var _0xa9ab=function(_0x65c51,_0x3055ef){_0x65c51=_0x65c51-0x0;var _0x3783d2=_0x9aba[_0x65c51];return _0x3783d2;};'use strict';var _=require(_0xa9ab('0x0'));var util=require(_0xa9ab('0x1'));var moment=require(_0xa9ab('0x2'));var BPromise=require(_0xa9ab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9ab('0x4'));var db=require(_0xa9ab('0x5'))['db'];var utils=require(_0xa9ab('0x6'));var logger=require(_0xa9ab('0x7'))('rpc');var config=require(_0xa9ab('0x8'));var jayson=require(_0xa9ab('0x9'));var client=jayson[_0xa9ab('0xa')][_0xa9ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e8327,_0x3ad15e,_0x12b069){return new BPromise(function(_0x1e48a6,_0xe30ee7){return client[_0xa9ab('0xc')](_0x4e8327,_0x12b069)[_0xa9ab('0xd')](function(_0x4bb7df){logger[_0xa9ab('0xe')]('CmHopperFinal,\x20%s,\x20%s',_0x3ad15e,'request\x20sent');logger['debug']('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x3ad15e,_0xa9ab('0xf'),JSON[_0xa9ab('0x10')](_0x4bb7df));if(_0x4bb7df[_0xa9ab('0x11')]){if(_0x4bb7df[_0xa9ab('0x11')][_0xa9ab('0x12')]===0x1f4){logger[_0xa9ab('0x11')](_0xa9ab('0x13'),_0x3ad15e,_0x4bb7df['error']['message']);return _0xe30ee7(_0x4bb7df[_0xa9ab('0x11')]['message']);}logger[_0xa9ab('0x11')](_0xa9ab('0x13'),_0x3ad15e,_0x4bb7df[_0xa9ab('0x11')][_0xa9ab('0x14')]);return _0x1e48a6(_0x4bb7df['error'][_0xa9ab('0x14')]);}else{logger[_0xa9ab('0xe')](_0xa9ab('0x13'),_0x3ad15e,_0xa9ab('0xf'));_0x1e48a6(_0x4bb7df[_0xa9ab('0x15')][_0xa9ab('0x14')]);}})['catch'](function(_0x20ae1f){logger[_0xa9ab('0x11')]('CmHopperFinal,\x20%s,\x20%s',_0x3ad15e,_0x20ae1f);_0xe30ee7(_0x20ae1f);});});}exports[_0xa9ab('0x16')]=function(_0x582316){var _0x5b0a5b=this;return new Promise(function(_0x34a16a,_0x41f927){return db[_0xa9ab('0x17')][_0xa9ab('0x18')](_0x582316[_0xa9ab('0x19')],{'raw':_0x582316[_0xa9ab('0x1a')]?_0x582316['options'][_0xa9ab('0x1b')]===undefined?!![]:![]:!![]})[_0xa9ab('0xd')](function(_0x1f3c7a){logger[_0xa9ab('0xe')](_0xa9ab('0x16'),_0x582316);logger[_0xa9ab('0x1c')]('CreateCmHopperFinal',_0x582316,JSON['stringify'](_0x1f3c7a));_0x34a16a(_0x1f3c7a);})['catch'](function(_0x187668){logger[_0xa9ab('0x11')](_0xa9ab('0x16'),_0x187668['message'],_0x582316);_0x41f927(_0x5b0a5b['error'](0x1f4,_0x187668[_0xa9ab('0x14')]));});});}; \ No newline at end of file +var _0x77b4=['info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateCmHopperFinal','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x2ade68,_0x3c6b4f){var _0xd360b8=function(_0xeff059){while(--_0xeff059){_0x2ade68['push'](_0x2ade68['shift']());}};_0xd360b8(++_0x3c6b4f);}(_0x77b4,0x11d));var _0x477b=function(_0x262736,_0x1c6067){_0x262736=_0x262736-0x0;var _0x5e018a=_0x77b4[_0x262736];return _0x5e018a;};'use strict';var _=require('lodash');var util=require(_0x477b('0x0'));var moment=require(_0x477b('0x1'));var BPromise=require(_0x477b('0x2'));var rs=require(_0x477b('0x3'));var fs=require('fs');var Redis=require(_0x477b('0x4'));var db=require(_0x477b('0x5'))['db'];var utils=require(_0x477b('0x6'));var logger=require('../../config/logger')(_0x477b('0x7'));var config=require(_0x477b('0x8'));var jayson=require(_0x477b('0x9'));var client=jayson[_0x477b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c9fb6,_0x4022ad,_0x2c2894){return new BPromise(function(_0x32601a,_0x4b180e){return client['request'](_0x5c9fb6,_0x2c2894)[_0x477b('0xb')](function(_0x552ead){logger[_0x477b('0xc')](_0x477b('0xd'),_0x4022ad,_0x477b('0xe'));logger[_0x477b('0xf')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x4022ad,_0x477b('0xe'),JSON[_0x477b('0x10')](_0x552ead));if(_0x552ead[_0x477b('0x11')]){if(_0x552ead[_0x477b('0x11')][_0x477b('0x12')]===0x1f4){logger[_0x477b('0x11')]('CmHopperFinal,\x20%s,\x20%s',_0x4022ad,_0x552ead[_0x477b('0x11')]['message']);return _0x4b180e(_0x552ead[_0x477b('0x11')]['message']);}logger[_0x477b('0x11')](_0x477b('0xd'),_0x4022ad,_0x552ead[_0x477b('0x11')][_0x477b('0x13')]);return _0x32601a(_0x552ead[_0x477b('0x11')][_0x477b('0x13')]);}else{logger[_0x477b('0xc')]('CmHopperFinal,\x20%s,\x20%s',_0x4022ad,_0x477b('0xe'));_0x32601a(_0x552ead[_0x477b('0x14')][_0x477b('0x13')]);}})[_0x477b('0x15')](function(_0x4b151e){logger[_0x477b('0x11')](_0x477b('0xd'),_0x4022ad,_0x4b151e);_0x4b180e(_0x4b151e);});});}exports[_0x477b('0x16')]=function(_0x223e77){var _0x31a16f=this;return new Promise(function(_0x5fdc78,_0xcc295){return db['CmHopperFinal'][_0x477b('0x17')](_0x223e77[_0x477b('0x18')],{'raw':_0x223e77[_0x477b('0x19')]?_0x223e77['options'][_0x477b('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2ff34f){logger['info'](_0x477b('0x16'),_0x223e77);logger[_0x477b('0xf')](_0x477b('0x16'),_0x223e77,JSON[_0x477b('0x10')](_0x2ff34f));_0x5fdc78(_0x2ff34f);})[_0x477b('0x15')](function(_0x325063){logger[_0x477b('0x11')](_0x477b('0x16'),_0x325063[_0x477b('0x13')],_0x223e77);_0xcc295(_0x31a16f['error'](0x1f4,_0x325063[_0x477b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index f0c803a..338d50a 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 _0x2a7b=['countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','update','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id'];(function(_0x21ecd3,_0x3ec7b8){var _0x2d4eb2=function(_0x114ac8){while(--_0x114ac8){_0x21ecd3['push'](_0x21ecd3['shift']());}};_0x2d4eb2(++_0x3ec7b8);}(_0x2a7b,0x8d));var _0xb2a7=function(_0x204218,_0x3081c4){_0x204218=_0x204218-0x0;var _0x2ba7b1=_0x2a7b[_0x204218];return _0x2ba7b1;};'use strict';var multer=require(_0xb2a7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb2a7('0x1'));var express=require(_0xb2a7('0x2'));var router=express[_0xb2a7('0x3')]();var auth=require(_0xb2a7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb2a7('0x5'));var controller=require(_0xb2a7('0x6'));router[_0xb2a7('0x7')]('/',auth[_0xb2a7('0x8')](),controller[_0xb2a7('0x9')]);router[_0xb2a7('0x7')](_0xb2a7('0xa'),auth[_0xb2a7('0x8')](),controller[_0xb2a7('0xb')]);router[_0xb2a7('0x7')]('/:id',auth[_0xb2a7('0x8')](),controller[_0xb2a7('0xc')]);router[_0xb2a7('0x7')](_0xb2a7('0xd'),auth[_0xb2a7('0x8')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xb2a7('0x7')](_0xb2a7('0xe'),auth[_0xb2a7('0x8')](),controller[_0xb2a7('0xf')]);router[_0xb2a7('0x10')](_0xb2a7('0x11'),auth['isAuthenticated'](),controller[_0xb2a7('0x12')]);router[_0xb2a7('0x10')](_0xb2a7('0x13'),auth['isAuthenticated'](),controller[_0xb2a7('0x14')]);router[_0xb2a7('0x10')](_0xb2a7('0x15'),auth['isAuthenticated'](),controller[_0xb2a7('0x16')]);router[_0xb2a7('0x17')](_0xb2a7('0x18'),auth[_0xb2a7('0x8')](),controller[_0xb2a7('0x19')]);module['exports']=router; \ No newline at end of file +var _0x89ee=['get','/describe','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','connect-timeout','express','Router','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index'];(function(_0xc6cd9,_0x24938f){var _0x39ca4b=function(_0x454857){while(--_0x454857){_0xc6cd9['push'](_0xc6cd9['shift']());}};_0x39ca4b(++_0x24938f);}(_0x89ee,0x1c1));var _0xe89e=function(_0x1b5e55,_0x4ca780){_0x1b5e55=_0x1b5e55-0x0;var _0xa95690=_0x89ee[_0x1b5e55];return _0xa95690;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe89e('0x0'));var express=require(_0xe89e('0x1'));var router=express[_0xe89e('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe89e('0x3'));var controller=require(_0xe89e('0x4'));router['get']('/',auth[_0xe89e('0x5')](),controller[_0xe89e('0x6')]);router[_0xe89e('0x7')](_0xe89e('0x8'),auth[_0xe89e('0x5')](),controller[_0xe89e('0x9')]);router[_0xe89e('0x7')](_0xe89e('0xa'),auth[_0xe89e('0x5')](),controller['show']);router['get'](_0xe89e('0xb'),auth[_0xe89e('0x5')](),controller[_0xe89e('0xc')]);router[_0xe89e('0x7')](_0xe89e('0xd'),auth[_0xe89e('0x5')](),controller[_0xe89e('0xe')]);router[_0xe89e('0xf')](_0xe89e('0x10'),auth['isAuthenticated'](),controller[_0xe89e('0x11')]);router[_0xe89e('0xf')](_0xe89e('0x12'),auth[_0xe89e('0x5')](),controller[_0xe89e('0x13')]);router['post']('/checkContactHopper',auth[_0xe89e('0x5')](),controller[_0xe89e('0x14')]);router[_0xe89e('0x15')](_0xe89e('0xa'),auth[_0xe89e('0x5')](),controller[_0xe89e('0x16')]);module[_0xe89e('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index ca193d2..f3d0da6 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 _0xe7ae=['DATE','BOOLEAN','INTEGER','STRING'];(function(_0x31b9bb,_0x5ba620){var _0x5b10ae=function(_0x540ac0){while(--_0x540ac0){_0x31b9bb['push'](_0x31b9bb['shift']());}};_0x5b10ae(++_0x5ba620);}(_0xe7ae,0xfa));var _0xee7a=function(_0x418980,_0x397796){_0x418980=_0x418980-0x0;var _0x510a02=_0xe7ae[_0x418980];return _0x510a02;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0xee7a('0x0')](0x2)},'statedesc':{'type':Sequelize[_0xee7a('0x1')]},'scheduledat':{'type':Sequelize[_0xee7a('0x2')]},'countbusyretry':{'type':Sequelize[_0xee7a('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xee7a('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xee7a('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xee7a('0x1')]},'originatecalleridnum':{'type':Sequelize[_0xee7a('0x1')]},'originatecalleridname':{'type':Sequelize[_0xee7a('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xee7a('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xee7a('0x2')]},'droptime':{'type':Sequelize[_0xee7a('0x2')]},'endtime':{'type':Sequelize[_0xee7a('0x2')]},'ringtime':{'type':Sequelize[_0xee7a('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xee7a('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xee7a('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xee7a('0x1')]},'reason':{'type':Sequelize[_0xee7a('0x1')]},'amd':{'type':Sequelize[_0xee7a('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0xee7a('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0xee7a('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xee7a('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xee7a('0x2')]},'edited':{'type':Sequelize[_0xee7a('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xee7a('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xee7a('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xee7a('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xee7a('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc266=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x34097c,_0x17dd64){var _0x9443f8=function(_0x4e6cd0){while(--_0x4e6cd0){_0x34097c['push'](_0x34097c['shift']());}};_0x9443f8(++_0x17dd64);}(_0xc266,0xb3));var _0x6c26=function(_0x535e7b,_0x5d1da6){_0x535e7b=_0x535e7b-0x0;var _0x5077ec=_0xc266[_0x535e7b];return _0x5077ec;};'use strict';var Sequelize=require(_0x6c26('0x0'));module[_0x6c26('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x6c26('0x2')]},'scheduledat':{'type':Sequelize[_0x6c26('0x3')]},'countbusyretry':{'type':Sequelize[_0x6c26('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6c26('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6c26('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6c26('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x6c26('0x2')]},'originatecalleridname':{'type':Sequelize[_0x6c26('0x2')]},'calleridnum':{'type':Sequelize[_0x6c26('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6c26('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x6c26('0x3')]},'endtime':{'type':Sequelize[_0x6c26('0x3')]},'ringtime':{'type':Sequelize[_0x6c26('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6c26('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6c26('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6c26('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6c26('0x2')]},'campaign':{'type':Sequelize[_0x6c26('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x6c26('0x2')]},'amd':{'type':Sequelize[_0x6c26('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6c26('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6c26('0x3')]},'recallme':{'type':Sequelize[_0x6c26('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x6c26('0x3')]},'edited':{'type':Sequelize[_0x6c26('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6c26('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6c26('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index d4c2df7..6ec70a7 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 _0x907d=['../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','error','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','update','uniqueid','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x907d,0x1ad));var _0xd907=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x907d[_0x82129b];return _0x2ae5dc;};'use strict';var pdf=require(_0xd907('0x0'));var emlformat=require(_0xd907('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd907('0x2'));var jsonpatch=require(_0xd907('0x3'));var rp=require('request-promise');var moment=require(_0xd907('0x4'));var BPromise=require(_0xd907('0x5'));var Mustache=require(_0xd907('0x6'));var util=require(_0xd907('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd907('0x8'));var ejs=require(_0xd907('0x9'));var fs=require('fs');var _=require(_0xd907('0xa'));var squel=require(_0xd907('0xb'));var crypto=require('crypto');var jsforce=require(_0xd907('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd907('0xd'));var Papa=require(_0xd907('0xe'));var Redis=require('ioredis');var authService=require(_0xd907('0xf'));var qs=require(_0xd907('0x10'));var as=require(_0xd907('0x11'));var hardwareService=require(_0xd907('0x12'));var logger=require(_0xd907('0x13'))(_0xd907('0x14'));var utils=require(_0xd907('0x15'));var config=require('../../config/environment');var db=require(_0xd907('0x16'))['db'];function respondWithStatusCode(_0x589c06,_0x2d347f){_0x2d347f=_0x2d347f||0xcc;return function(_0x25c68a){if(_0x25c68a){return _0x589c06[_0xd907('0x17')](_0x2d347f);}return _0x589c06[_0xd907('0x18')](_0x2d347f)[_0xd907('0x19')]();};}function respondWithResult(_0x14f1de,_0x42667d){_0x42667d=_0x42667d||0xc8;return function(_0x15cfa0){if(_0x15cfa0){return _0x14f1de[_0xd907('0x18')](_0x42667d)[_0xd907('0x1a')](_0x15cfa0);}};}function respondWithFilteredResult(_0x442e44,_0x140e43){return function(_0x467c0c){if(_0x467c0c){var _0x2f8266=_0x467c0c[_0xd907('0x1b')],_0x1eb7d6=_0x140e43[_0xd907('0x1c')],_0x5d465a=_0x140e43[_0xd907('0x1c')]+_0x140e43[_0xd907('0x1d')],_0x40695b;if(_0x5d465a>=_0x2f8266){_0x5d465a=_0x2f8266;_0x40695b=0xc8;}else{_0x40695b=0xce;}_0x442e44[_0xd907('0x18')](_0x40695b);return _0x442e44[_0xd907('0x1e')]('Content-Range',_0x1eb7d6+'-'+_0x5d465a+'/'+_0x2f8266)[_0xd907('0x1a')](_0x467c0c);}return null;};}function patchUpdates(_0x137174){return function(_0x3d5fe0){try{jsonpatch[_0xd907('0x1f')](_0x3d5fe0,_0x137174,!![]);}catch(_0x25a868){return BPromise[_0xd907('0x20')](_0x25a868);}return _0x3d5fe0[_0xd907('0x21')]();};}function saveUpdates(_0x2b42c8,_0x205617){return function(_0x34dc52){if(_0x34dc52){return _0x34dc52['update'](_0x2b42c8)[_0xd907('0x22')](function(_0x5c4a30){return _0x5c4a30;});}return null;};}function removeEntity(_0x559304,_0x4345c8){return function(_0xcee304){if(_0xcee304){return _0xcee304[_0xd907('0x23')]()[_0xd907('0x22')](function(){_0x559304[_0xd907('0x18')](0xcc)[_0xd907('0x19')]();});}};}function handleEntityNotFound(_0x599c02,_0x53056d){return function(_0x59ba37){if(!_0x59ba37){_0x599c02[_0xd907('0x17')](0x194);}return _0x59ba37;};}function handleError(_0xc0021e,_0x2ddaf1){_0x2ddaf1=_0x2ddaf1||0x1f4;return function(_0x145c25){logger[_0xd907('0x24')](_0x145c25['stack']);if(_0x145c25['name']){delete _0x145c25[_0xd907('0x25')];}_0xc0021e[_0xd907('0x18')](_0x2ddaf1)[_0xd907('0x26')](_0x145c25);};}exports[_0xd907('0x27')]=function(_0x5476ca,_0x360154){var _0x19278a={},_0xc30a45={},_0x772c55={'count':0x0,'rows':[]};var _0x2c9f12=_[_0xd907('0x28')](db[_0xd907('0x29')][_0xd907('0x2a')],function(_0x3555c2){return{'name':_0x3555c2[_0xd907('0x2b')],'type':_0x3555c2[_0xd907('0x2c')][_0xd907('0x2d')]};});_0xc30a45[_0xd907('0x2e')]=_[_0xd907('0x28')](_0x2c9f12,_0xd907('0x25'));_0xc30a45['query']=_[_0xd907('0x2f')](_0x5476ca[_0xd907('0x30')]);_0xc30a45['filters']=_['intersection'](_0xc30a45[_0xd907('0x2e')],_0xc30a45[_0xd907('0x30')]);_0x19278a[_0xd907('0x31')]=_[_0xd907('0x32')](_0xc30a45[_0xd907('0x2e')],qs[_0xd907('0x33')](_0x5476ca[_0xd907('0x30')][_0xd907('0x33')]));_0x19278a[_0xd907('0x31')]=_0x19278a[_0xd907('0x31')][_0xd907('0x34')]?_0x19278a[_0xd907('0x31')]:_0xc30a45['model'];if(!_0x5476ca[_0xd907('0x30')][_0xd907('0x35')](_0xd907('0x36'))){_0x19278a[_0xd907('0x1d')]=qs[_0xd907('0x1d')](_0x5476ca[_0xd907('0x30')][_0xd907('0x1d')]);_0x19278a[_0xd907('0x1c')]=qs[_0xd907('0x1c')](_0x5476ca[_0xd907('0x30')]['offset']);}_0x19278a['order']=qs[_0xd907('0x37')](_0x5476ca[_0xd907('0x30')][_0xd907('0x37')]);_0x19278a[_0xd907('0x38')]=qs['filters'](_[_0xd907('0x39')](_0x5476ca[_0xd907('0x30')],_0xc30a45[_0xd907('0x3a')]),_0x2c9f12);if(_0x5476ca[_0xd907('0x30')]['filter']){_0x19278a[_0xd907('0x38')]=_[_0xd907('0x3b')](_0x19278a[_0xd907('0x38')],{'$or':_['map'](_0x2c9f12,function(_0x462650){if(_0x462650['type']!==_0xd907('0x3c')){var _0x383d49={};_0x383d49[_0x462650[_0xd907('0x25')]]={'$like':'%'+_0x5476ca['query']['filter']+'%'};return _0x383d49;}})});}_0x19278a=_['merge']({},_0x19278a,_0x5476ca[_0xd907('0x3d')]);var _0x28a8d0={'where':_0x19278a['where']};return db[_0xd907('0x29')][_0xd907('0x1b')](_0x28a8d0)[_0xd907('0x22')](function(_0x26eb38){_0x772c55[_0xd907('0x1b')]=_0x26eb38;if(_0x5476ca[_0xd907('0x30')][_0xd907('0x3e')]){_0x19278a[_0xd907('0x3f')]=[{'all':!![]}];}return db[_0xd907('0x29')][_0xd907('0x40')](_0x19278a);})[_0xd907('0x22')](function(_0x4c0e67){_0x772c55[_0xd907('0x41')]=_0x4c0e67;return _0x772c55;})[_0xd907('0x22')](respondWithFilteredResult(_0x360154,_0x19278a))[_0xd907('0x42')](handleError(_0x360154,null));};exports[_0xd907('0x43')]=function(_0x4d9a94,_0x2d3bb8){var _0x4a48a9={'raw':!![],'where':{'id':_0x4d9a94[_0xd907('0x44')]['id']}},_0x28995d={};_0x28995d[_0xd907('0x2e')]=_[_0xd907('0x2f')](db[_0xd907('0x29')][_0xd907('0x2a')]);_0x28995d['query']=_[_0xd907('0x2f')](_0x4d9a94['query']);_0x28995d['filters']=_[_0xd907('0x32')](_0x28995d[_0xd907('0x2e')],_0x28995d[_0xd907('0x30')]);_0x4a48a9[_0xd907('0x31')]=_[_0xd907('0x32')](_0x28995d[_0xd907('0x2e')],qs[_0xd907('0x33')](_0x4d9a94[_0xd907('0x30')][_0xd907('0x33')]));_0x4a48a9['attributes']=_0x4a48a9[_0xd907('0x31')][_0xd907('0x34')]?_0x4a48a9[_0xd907('0x31')]:_0x28995d['model'];if(_0x4d9a94[_0xd907('0x30')][_0xd907('0x3e')]){_0x4a48a9[_0xd907('0x3f')]=[{'all':!![]}];}_0x4a48a9=_[_0xd907('0x3b')]({},_0x4a48a9,_0x4d9a94[_0xd907('0x3d')]);return db[_0xd907('0x29')][_0xd907('0x45')](_0x4a48a9)[_0xd907('0x22')](handleEntityNotFound(_0x2d3bb8,null))['then'](respondWithResult(_0x2d3bb8,null))[_0xd907('0x42')](handleError(_0x2d3bb8,null));};exports['create']=function(_0x590444,_0xcf3f54){return db[_0xd907('0x29')][_0xd907('0x46')](_0x590444[_0xd907('0x47')],{})[_0xd907('0x22')](respondWithResult(_0xcf3f54,0xc9))['catch'](handleError(_0xcf3f54,null));};exports[_0xd907('0x48')]=function(_0x777b2c,_0x27834c){return db[_0xd907('0x29')][_0xd907('0x48')]()[_0xd907('0x22')](respondWithResult(_0x27834c,null))['catch'](handleError(_0x27834c,null));};exports[_0xd907('0x49')]=function(_0x56470f,_0x4747ab){if(_0x56470f[_0xd907('0x47')][_0xd907('0x4a')]){delete _0x56470f[_0xd907('0x47')][_0xd907('0x4a')];}return db[_0xd907('0x29')][_0xd907('0x45')]({'where':{'uniqueid':_0x56470f[_0xd907('0x44')]['id']}})[_0xd907('0x22')](handleEntityNotFound(_0x4747ab,null))[_0xd907('0x22')](saveUpdates(_0x56470f['body'],null))[_0xd907('0x22')](respondWithResult(_0x4747ab,null))[_0xd907('0x42')](handleError(_0x4747ab,null));}; \ No newline at end of file +var _0x8907=['count','includeAll','findAll','catch','params','find','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','end','json','offset','limit','status','Content-Range','reject','save','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','CmHopperHistory'];(function(_0x47623f,_0x148f3a){var _0x282ce8=function(_0x35bca1){while(--_0x35bca1){_0x47623f['push'](_0x47623f['shift']());}};_0x282ce8(++_0x148f3a);}(_0x8907,0x122));var _0x7890=function(_0x5ea510,_0x556455){_0x5ea510=_0x5ea510-0x0;var _0x247b28=_0x8907[_0x5ea510];return _0x247b28;};'use strict';var pdf=require(_0x7890('0x0'));var emlformat=require(_0x7890('0x1'));var rimraf=require(_0x7890('0x2'));var zipdir=require(_0x7890('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7890('0x4'));var moment=require(_0x7890('0x5'));var BPromise=require(_0x7890('0x6'));var Mustache=require(_0x7890('0x7'));var util=require(_0x7890('0x8'));var path=require(_0x7890('0x9'));var sox=require(_0x7890('0xa'));var csv=require(_0x7890('0xb'));var ejs=require(_0x7890('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7890('0xd'));var jsforce=require(_0x7890('0xe'));var deskjs=require(_0x7890('0xf'));var toCsv=require(_0x7890('0xb'));var querystring=require(_0x7890('0x10'));var Papa=require('papaparse');var Redis=require(_0x7890('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7890('0x12'));var as=require(_0x7890('0x13'));var hardwareService=require(_0x7890('0x14'));var logger=require('../../config/logger')(_0x7890('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7890('0x16'))['db'];function respondWithStatusCode(_0xb479d,_0x4d913f){_0x4d913f=_0x4d913f||0xcc;return function(_0x3d5691){if(_0x3d5691){return _0xb479d['sendStatus'](_0x4d913f);}return _0xb479d['status'](_0x4d913f)[_0x7890('0x17')]();};}function respondWithResult(_0x142a34,_0x3195f5){_0x3195f5=_0x3195f5||0xc8;return function(_0x2dcee9){if(_0x2dcee9){return _0x142a34['status'](_0x3195f5)[_0x7890('0x18')](_0x2dcee9);}};}function respondWithFilteredResult(_0x1db957,_0x1a4321){return function(_0x4a859b){if(_0x4a859b){var _0x39fe01=_0x4a859b['count'],_0x229929=_0x1a4321[_0x7890('0x19')],_0x165978=_0x1a4321['offset']+_0x1a4321[_0x7890('0x1a')],_0x56c22b;if(_0x165978>=_0x39fe01){_0x165978=_0x39fe01;_0x56c22b=0xc8;}else{_0x56c22b=0xce;}_0x1db957[_0x7890('0x1b')](_0x56c22b);return _0x1db957['set'](_0x7890('0x1c'),_0x229929+'-'+_0x165978+'/'+_0x39fe01)[_0x7890('0x18')](_0x4a859b);}return null;};}function patchUpdates(_0x14ff3c){return function(_0x52c382){try{jsonpatch['apply'](_0x52c382,_0x14ff3c,!![]);}catch(_0x1a99f6){return BPromise[_0x7890('0x1d')](_0x1a99f6);}return _0x52c382[_0x7890('0x1e')]();};}function saveUpdates(_0x5d796e,_0x23db4f){return function(_0x414ccd){if(_0x414ccd){return _0x414ccd[_0x7890('0x1f')](_0x5d796e)[_0x7890('0x20')](function(_0x4143e7){return _0x4143e7;});}return null;};}function removeEntity(_0xc1d506,_0x523869){return function(_0x4b8a03){if(_0x4b8a03){return _0x4b8a03[_0x7890('0x21')]()['then'](function(){_0xc1d506[_0x7890('0x1b')](0xcc)[_0x7890('0x17')]();});}};}function handleEntityNotFound(_0x461afc,_0x4f4a91){return function(_0x37c193){if(!_0x37c193){_0x461afc[_0x7890('0x22')](0x194);}return _0x37c193;};}function handleError(_0xc3d18,_0x44561c){_0x44561c=_0x44561c||0x1f4;return function(_0x5ab4be){logger['error'](_0x5ab4be['stack']);if(_0x5ab4be[_0x7890('0x23')]){delete _0x5ab4be[_0x7890('0x23')];}_0xc3d18['status'](_0x44561c)[_0x7890('0x24')](_0x5ab4be);};}exports[_0x7890('0x25')]=function(_0x9c1345,_0x3eea3d){var _0x15b60d={},_0x1df939={},_0x1bbff4={'count':0x0,'rows':[]};var _0x11a781=_[_0x7890('0x26')](db['CmHopperHistory'][_0x7890('0x27')],function(_0xb2dcad){return{'name':_0xb2dcad[_0x7890('0x28')],'type':_0xb2dcad[_0x7890('0x29')][_0x7890('0x2a')]};});_0x1df939[_0x7890('0x2b')]=_[_0x7890('0x26')](_0x11a781,_0x7890('0x23'));_0x1df939[_0x7890('0x2c')]=_[_0x7890('0x2d')](_0x9c1345[_0x7890('0x2c')]);_0x1df939[_0x7890('0x2e')]=_[_0x7890('0x2f')](_0x1df939[_0x7890('0x2b')],_0x1df939[_0x7890('0x2c')]);_0x15b60d[_0x7890('0x30')]=_[_0x7890('0x2f')](_0x1df939['model'],qs[_0x7890('0x31')](_0x9c1345[_0x7890('0x2c')][_0x7890('0x31')]));_0x15b60d[_0x7890('0x30')]=_0x15b60d[_0x7890('0x30')][_0x7890('0x32')]?_0x15b60d[_0x7890('0x30')]:_0x1df939[_0x7890('0x2b')];if(!_0x9c1345[_0x7890('0x2c')]['hasOwnProperty'](_0x7890('0x33'))){_0x15b60d[_0x7890('0x1a')]=qs['limit'](_0x9c1345['query']['limit']);_0x15b60d[_0x7890('0x19')]=qs[_0x7890('0x19')](_0x9c1345['query'][_0x7890('0x19')]);}_0x15b60d[_0x7890('0x34')]=qs[_0x7890('0x35')](_0x9c1345[_0x7890('0x2c')]['sort']);_0x15b60d[_0x7890('0x36')]=qs['filters'](_[_0x7890('0x37')](_0x9c1345['query'],_0x1df939[_0x7890('0x2e')]),_0x11a781);if(_0x9c1345[_0x7890('0x2c')][_0x7890('0x38')]){_0x15b60d[_0x7890('0x36')]=_[_0x7890('0x39')](_0x15b60d[_0x7890('0x36')],{'$or':_['map'](_0x11a781,function(_0x3d4c2d){if(_0x3d4c2d[_0x7890('0x29')]!=='VIRTUAL'){var _0x2dff0f={};_0x2dff0f[_0x3d4c2d[_0x7890('0x23')]]={'$like':'%'+_0x9c1345[_0x7890('0x2c')]['filter']+'%'};return _0x2dff0f;}})});}_0x15b60d=_[_0x7890('0x39')]({},_0x15b60d,_0x9c1345[_0x7890('0x3a')]);var _0x59784a={'where':_0x15b60d[_0x7890('0x36')]};return db[_0x7890('0x3b')][_0x7890('0x3c')](_0x59784a)['then'](function(_0x333f7e){_0x1bbff4[_0x7890('0x3c')]=_0x333f7e;if(_0x9c1345[_0x7890('0x2c')][_0x7890('0x3d')]){_0x15b60d['include']=[{'all':!![]}];}return db[_0x7890('0x3b')][_0x7890('0x3e')](_0x15b60d);})['then'](function(_0x3197b5){_0x1bbff4['rows']=_0x3197b5;return _0x1bbff4;})['then'](respondWithFilteredResult(_0x3eea3d,_0x15b60d))[_0x7890('0x3f')](handleError(_0x3eea3d,null));};exports['show']=function(_0x178882,_0x5c9d85){var _0x45d488={'raw':!![],'where':{'id':_0x178882[_0x7890('0x40')]['id']}},_0x459e2d={};_0x459e2d[_0x7890('0x2b')]=_[_0x7890('0x2d')](db[_0x7890('0x3b')]['rawAttributes']);_0x459e2d['query']=_[_0x7890('0x2d')](_0x178882[_0x7890('0x2c')]);_0x459e2d['filters']=_[_0x7890('0x2f')](_0x459e2d[_0x7890('0x2b')],_0x459e2d[_0x7890('0x2c')]);_0x45d488[_0x7890('0x30')]=_[_0x7890('0x2f')](_0x459e2d[_0x7890('0x2b')],qs[_0x7890('0x31')](_0x178882['query'][_0x7890('0x31')]));_0x45d488[_0x7890('0x30')]=_0x45d488[_0x7890('0x30')][_0x7890('0x32')]?_0x45d488[_0x7890('0x30')]:_0x459e2d['model'];if(_0x178882['query']['includeAll']){_0x45d488['include']=[{'all':!![]}];}_0x45d488=_['merge']({},_0x45d488,_0x178882[_0x7890('0x3a')]);return db['CmHopperHistory'][_0x7890('0x41')](_0x45d488)[_0x7890('0x20')](handleEntityNotFound(_0x5c9d85,null))[_0x7890('0x20')](respondWithResult(_0x5c9d85,null))[_0x7890('0x3f')](handleError(_0x5c9d85,null));};exports[_0x7890('0x42')]=function(_0x43553e,_0x26ac91){return db[_0x7890('0x3b')][_0x7890('0x42')](_0x43553e[_0x7890('0x43')],{})[_0x7890('0x20')](respondWithResult(_0x26ac91,0xc9))['catch'](handleError(_0x26ac91,null));};exports[_0x7890('0x44')]=function(_0x2731a4,_0x191a74){return db[_0x7890('0x3b')][_0x7890('0x44')]()['then'](respondWithResult(_0x191a74,null))[_0x7890('0x3f')](handleError(_0x191a74,null));};exports[_0x7890('0x1f')]=function(_0x493c5e,_0x30cdd6){if(_0x493c5e['body'][_0x7890('0x45')]){delete _0x493c5e[_0x7890('0x43')][_0x7890('0x45')];}return db[_0x7890('0x3b')][_0x7890('0x41')]({'where':{'uniqueid':_0x493c5e[_0x7890('0x40')]['id']}})[_0x7890('0x20')](handleEntityNotFound(_0x30cdd6,null))[_0x7890('0x20')](saveUpdates(_0x493c5e[_0x7890('0x43')],null))[_0x7890('0x20')](respondWithResult(_0x30cdd6,null))[_0x7890('0x3f')](handleError(_0x30cdd6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index d1b1ab9..acd8b8d 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 _0xb883=['uniqueid','lodash','moment','bluebird','request-promise','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime'];(function(_0x3a1156,_0x153672){var _0x3a18af=function(_0x3efbd0){while(--_0x3efbd0){_0x3a1156['push'](_0x3a1156['shift']());}};_0x3a18af(++_0x153672);}(_0xb883,0x182));var _0x3b88=function(_0x5a7a40,_0xbf2756){_0x5a7a40=_0x5a7a40-0x0;var _0x441e5b=_0xb883[_0x5a7a40];return _0x441e5b;};'use strict';var _=require(_0x3b88('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3b88('0x1'));var BPromise=require(_0x3b88('0x2'));var rp=require(_0x3b88('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3b88('0x4'));var attributes=require(_0x3b88('0x5'));module[_0x3b88('0x6')]=function(_0x580d8c,_0x4c8c21){return _0x580d8c[_0x3b88('0x7')]('CmHopperHistory',attributes,{'tableName':_0x3b88('0x8'),'paranoid':![],'indexes':[{'name':_0x3b88('0x9'),'fields':[_0x3b88('0x9')]},{'name':_0x3b88('0xa'),'fields':[_0x3b88('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xde38=['cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define'];(function(_0x1c5bf6,_0x5acaa9){var _0x4e3a3f=function(_0x5bb25){while(--_0x5bb25){_0x1c5bf6['push'](_0x1c5bf6['shift']());}};_0x4e3a3f(++_0x5acaa9);}(_0xde38,0x14d));var _0x8de3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde38[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8de3('0x0'));var util=require('util');var logger=require(_0x8de3('0x1'))(_0x8de3('0x2'));var moment=require(_0x8de3('0x3'));var BPromise=require(_0x8de3('0x4'));var rp=require(_0x8de3('0x5'));var fs=require('fs');var path=require(_0x8de3('0x6'));var rimraf=require(_0x8de3('0x7'));var config=require(_0x8de3('0x8'));var attributes=require(_0x8de3('0x9'));module[_0x8de3('0xa')]=function(_0x5b6b84,_0x16cb9d){return _0x5b6b84[_0x8de3('0xb')]('CmHopperHistory',attributes,{'tableName':_0x8de3('0xc'),'paranoid':![],'indexes':[{'name':_0x8de3('0xd'),'fields':[_0x8de3('0xd')]},{'name':_0x8de3('0xe'),'fields':[_0x8de3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index d145c2d..0995a07 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 _0xa571=['CreateCmHopperHistory','CmHopperHistory','create','body','options','AvgHandleTime','findAll','raw','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa571,0x107));var _0x1a57=function(_0x2f14cf,_0x5ede17){_0x2f14cf=_0x2f14cf-0x0;var _0xcf73e7=_0xa571[_0x2f14cf];return _0xcf73e7;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var moment=require(_0x1a57('0x2'));var BPromise=require(_0x1a57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a57('0x4'));var db=require(_0x1a57('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a57('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a57('0x7'));var client=jayson[_0x1a57('0x8')][_0x1a57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5352,_0x2492f5,_0x924873){return new BPromise(function(_0x5d9f45,_0x3edb40){return client[_0x1a57('0xa')](_0x3c5352,_0x924873)[_0x1a57('0xb')](function(_0x58e266){logger[_0x1a57('0xc')](_0x1a57('0xd'),_0x2492f5,_0x1a57('0xe'));logger[_0x1a57('0xf')](_0x1a57('0x10'),_0x2492f5,_0x1a57('0xe'),JSON[_0x1a57('0x11')](_0x58e266));if(_0x58e266[_0x1a57('0x12')]){if(_0x58e266['error']['code']===0x1f4){logger[_0x1a57('0x12')](_0x1a57('0xd'),_0x2492f5,_0x58e266[_0x1a57('0x12')]['message']);return _0x3edb40(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}logger['error'](_0x1a57('0xd'),_0x2492f5,_0x58e266['error'][_0x1a57('0x13')]);return _0x5d9f45(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}else{logger[_0x1a57('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x2492f5,_0x1a57('0xe'));_0x5d9f45(_0x58e266['result']['message']);}})[_0x1a57('0x14')](function(_0x1c537f){logger[_0x1a57('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x2492f5,_0x1c537f);_0x3edb40(_0x1c537f);});});}exports[_0x1a57('0x15')]=function(_0x1662a3){var _0x80f8c1=this;return new Promise(function(_0x53bb20,_0x3daa66){return db[_0x1a57('0x16')][_0x1a57('0x17')](_0x1662a3[_0x1a57('0x18')],{'raw':_0x1662a3[_0x1a57('0x19')]?_0x1662a3['options']['raw']===undefined?!![]:![]:!![]})[_0x1a57('0xb')](function(_0x21e811){logger[_0x1a57('0xc')]('CreateCmHopperHistory',_0x1662a3);logger['debug']('CreateCmHopperHistory',_0x1662a3,JSON[_0x1a57('0x11')](_0x21e811));_0x53bb20(_0x21e811);})[_0x1a57('0x14')](function(_0x3f52b9){logger[_0x1a57('0x12')](_0x1a57('0x15'),_0x3f52b9[_0x1a57('0x13')],_0x1662a3);_0x3daa66(_0x80f8c1[_0x1a57('0x12')](0x1f4,_0x3f52b9[_0x1a57('0x13')]));});});};exports[_0x1a57('0x1a')]=function(_0x35d5dc){var _0x29e7cd=this;return new Promise(function(_0x36b17e,_0x26cdd3){return db[_0x1a57('0x16')][_0x1a57('0x1b')]({'raw':_0x35d5dc[_0x1a57('0x19')]?_0x35d5dc[_0x1a57('0x19')][_0x1a57('0x1c')]===undefined?!![]:![]:!![],'where':_0x35d5dc[_0x1a57('0x19')]?_0x35d5dc[_0x1a57('0x19')][_0x1a57('0x1d')]||null:null,'attributes':[[db[_0x1a57('0x1e')]['fn']('COUNT',db['sequelize'][_0x1a57('0x1f')]('id')),_0x1a57('0x20')],[db['sequelize']['fn'](_0x1a57('0x21'),db['sequelize']['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x1a57('0x23')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db['sequelize'][_0x1a57('0x22')](_0x1a57('0x24')))),_0x1a57('0x25')],[db[_0x1a57('0x1e')]['fn']('COUNT',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x26')))),_0x1a57('0x27')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x28'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')]['literal'](_0x1a57('0x29')))),_0x1a57('0x2a')],[db['sequelize']['fn']('AVG',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x2b')))),_0x1a57('0x2c')]]})[_0x1a57('0xb')](function(_0xe80d94){logger[_0x1a57('0xc')](_0x1a57('0x1a'),_0x35d5dc);logger[_0x1a57('0xf')](_0x1a57('0x1a'),_0x35d5dc,JSON[_0x1a57('0x11')](_0xe80d94));_0x36b17e(_0xe80d94);})[_0x1a57('0x14')](function(_0x1a6231){logger[_0x1a57('0x12')](_0x1a57('0x1a'),_0x1a6231[_0x1a57('0x13')],_0x35d5dc);_0x26cdd3(_0x29e7cd[_0x1a57('0x12')](0x1f4,_0x1a6231['message']));});});};exports[_0x1a57('0x2d')]=function(_0x173671){var _0x137920=this;return new Promise(function(_0x3dad7c,_0x58b7dc){return db[_0x1a57('0x16')][_0x1a57('0x1b')]({'raw':_0x173671[_0x1a57('0x19')]?_0x173671[_0x1a57('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x173671['options']?_0x173671['options']['where']||null:null,'attributes':[[_0x1a57('0x2e'),_0x1a57('0x2f')],[db[_0x1a57('0x1e')]['fn']('COUNT',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x30')))),'outboundNoSuchCallsDay'],[db[_0x1a57('0x1e')]['fn']('COUNT',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')]('`state`\x20=\x203,\x201,\x20null'))),_0x1a57('0x31')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')]['literal'](_0x1a57('0x32')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x1a57('0x21'),db['sequelize']['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x33')))),'outboundBusyCallsDay'],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')]['literal'](_0x1a57('0x34')))),_0x1a57('0x35')],[db['sequelize']['fn'](_0x1a57('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x1a57('0x22')](_0x1a57('0x36')))),_0x1a57('0x37')],[db[_0x1a57('0x1e')]['fn']('COUNT',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x38')))),_0x1a57('0x39')],[db['sequelize']['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0x1a57('0x3a')],[db['sequelize']['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x3b')))),_0x1a57('0x3c')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x3d')))),_0x1a57('0x3e')],[db['sequelize']['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x3f')))),_0x1a57('0x40')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),_0x1a57('0x41')],[db[_0x1a57('0x1e')]['fn']('COUNT',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')]['literal'](_0x1a57('0x42')))),_0x1a57('0x40')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x1a57('0x43')]],'group':[_0x1a57('0x2e')]})['then'](function(_0x5e510e){logger['info'](_0x1a57('0x2d'),_0x173671);logger[_0x1a57('0xf')](_0x1a57('0x2d'),_0x173671,JSON[_0x1a57('0x11')](_0x5e510e));_0x3dad7c(_0x5e510e);})[_0x1a57('0x14')](function(_0x33379c){logger[_0x1a57('0x12')](_0x1a57('0x2d'),_0x33379c['message'],_0x173671);_0x58b7dc(_0x137920['error'](0x1f4,_0x33379c['message']));});});};exports['GetCampaignHopperHistory']=function(_0x554208){var _0xd0261c=this;return new Promise(function(_0x13c04d,_0xcba9f0){return db[_0x1a57('0x16')][_0x1a57('0x1b')]({'raw':_0x554208[_0x1a57('0x19')]?_0x554208[_0x1a57('0x19')][_0x1a57('0x1c')]===undefined?!![]:![]:!![],'where':_0x554208['options']?_0x554208['options']['where']||null:null,'attributes':[[_0x1a57('0x2e'),'name'],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')][_0x1a57('0x1f')]('id')),_0x1a57('0x44')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x1a57('0x32')))),_0x1a57('0x45')]],'group':[_0x1a57('0x2e')]})[_0x1a57('0xb')](function(_0x2db770){logger[_0x1a57('0xc')](_0x1a57('0x46'),_0x554208);logger['debug']('GetCampaignHopperHistory',_0x554208,JSON[_0x1a57('0x11')](_0x2db770));_0x13c04d(_0x2db770);})[_0x1a57('0x14')](function(_0x231154){logger[_0x1a57('0x12')](_0x1a57('0x46'),_0x231154[_0x1a57('0x13')],_0x554208);_0xcba9f0(_0xd0261c['error'](0x1f4,_0x231154['message']));});});}; \ No newline at end of file +var _0xac4a=['COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','where','sequelize'];(function(_0x3f4d8f,_0x14b1c4){var _0x5bafa5=function(_0xf16272){while(--_0xf16272){_0x3f4d8f['push'](_0x3f4d8f['shift']());}};_0x5bafa5(++_0x14b1c4);}(_0xac4a,0x13f));var _0xaac4=function(_0x2f0623,_0x50ad63){_0x2f0623=_0x2f0623-0x0;var _0x1578b0=_0xac4a[_0x2f0623];return _0x1578b0;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});}exports[_0xaac4('0x15')]=function(_0x52085a){var _0x220630=this;return new Promise(function(_0x5b6fd6,_0x3ce35a){return db[_0xaac4('0x16')][_0xaac4('0x17')](_0x52085a[_0xaac4('0x18')],{'raw':_0x52085a[_0xaac4('0x19')]?_0x52085a[_0xaac4('0x19')][_0xaac4('0x1a')]===undefined?!![]:![]:!![]})[_0xaac4('0xa')](function(_0x4166ee){logger['info'](_0xaac4('0x15'),_0x52085a);logger['debug'](_0xaac4('0x15'),_0x52085a,JSON[_0xaac4('0xf')](_0x4166ee));_0x5b6fd6(_0x4166ee);})[_0xaac4('0x14')](function(_0x477b77){logger[_0xaac4('0x10')](_0xaac4('0x15'),_0x477b77['message'],_0x52085a);_0x3ce35a(_0x220630[_0xaac4('0x10')](0x1f4,_0x477b77[_0xaac4('0x12')]));});});};exports[_0xaac4('0x1b')]=function(_0x4f10ec){var _0x3dd059=this;return new Promise(function(_0x2dcc59,_0xb2577b){return db['CmHopperHistory'][_0xaac4('0x1c')]({'raw':_0x4f10ec['options']?_0x4f10ec['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f10ec['options']?_0x4f10ec[_0xaac4('0x19')][_0xaac4('0x1d')]||null:null,'attributes':[[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')][_0xaac4('0x20')]('id')),_0xaac4('0x21')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db['sequelize'][_0xaac4('0x22')](_0xaac4('0x23')))),_0xaac4('0x24')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db['sequelize'][_0xaac4('0x22')]('`state`\x20=\x2010,\x201,\x20null'))),_0xaac4('0x25')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0xaac4('0x26')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x27'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')][_0xaac4('0x22')](_0xaac4('0x28')))),_0xaac4('0x29')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x27'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')][_0xaac4('0x22')](_0xaac4('0x2a')))),_0xaac4('0x2b')]]})['then'](function(_0x5bad9f){logger[_0xaac4('0xb')](_0xaac4('0x1b'),_0x4f10ec);logger[_0xaac4('0xc')]('AvgHandleTime',_0x4f10ec,JSON[_0xaac4('0xf')](_0x5bad9f));_0x2dcc59(_0x5bad9f);})[_0xaac4('0x14')](function(_0x2cbf8d){logger[_0xaac4('0x10')](_0xaac4('0x1b'),_0x2cbf8d[_0xaac4('0x12')],_0x4f10ec);_0xb2577b(_0x3dd059[_0xaac4('0x10')](0x1f4,_0x2cbf8d['message']));});});};exports[_0xaac4('0x2c')]=function(_0x31ec51){var _0x1ffa56=this;return new Promise(function(_0x5d64a2,_0x36d84a){return db['CmHopperHistory']['findAll']({'raw':_0x31ec51[_0xaac4('0x19')]?_0x31ec51[_0xaac4('0x19')][_0xaac4('0x1a')]===undefined?!![]:![]:!![],'where':_0x31ec51['options']?_0x31ec51['options'][_0xaac4('0x1d')]||null:null,'attributes':[[_0xaac4('0x2d'),_0xaac4('0x2e')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xaac4('0x2f')))),_0xaac4('0x30')],[db['sequelize']['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')]['literal'](_0xaac4('0x31')))),_0xaac4('0x32')],[db[_0xaac4('0x1e')]['fn']('COUNT',db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')][_0xaac4('0x22')](_0xaac4('0x23')))),'outboundAnswerCallsDay'],[db[_0xaac4('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xaac4('0x1e')][_0xaac4('0x22')](_0xaac4('0x33')))),_0xaac4('0x34')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')]['literal'](_0xaac4('0x35')))),_0xaac4('0x36')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db['sequelize']['fn']('IF',db[_0xaac4('0x1e')][_0xaac4('0x22')](_0xaac4('0x37')))),'outboundDropCallsDayTimeout'],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')]['literal'](_0xaac4('0x38')))),_0xaac4('0x39')],[db[_0xaac4('0x1e')]['fn']('COUNT',db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')][_0xaac4('0x22')](_0xaac4('0x3a')))),_0xaac4('0x3b')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')]['literal'](_0xaac4('0x3c')))),_0xaac4('0x3d')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xaac4('0x3e')))),_0xaac4('0x3f')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db['sequelize']['fn']('IF',db[_0xaac4('0x1e')]['literal'](_0xaac4('0x40')))),_0xaac4('0x41')],[db['sequelize']['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0xaac4('0x42')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')][_0xaac4('0x22')]('`state`\x20=\x2020,\x201,\x20null'))),_0xaac4('0x41')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db['sequelize'][_0xaac4('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xaac4('0x43')]],'group':[_0xaac4('0x2d')]})[_0xaac4('0xa')](function(_0x3922a0){logger[_0xaac4('0xb')](_0xaac4('0x2c'),_0x31ec51);logger[_0xaac4('0xc')](_0xaac4('0x2c'),_0x31ec51,JSON[_0xaac4('0xf')](_0x3922a0));_0x5d64a2(_0x3922a0);})[_0xaac4('0x14')](function(_0x1a637e){logger[_0xaac4('0x10')](_0xaac4('0x2c'),_0x1a637e[_0xaac4('0x12')],_0x31ec51);_0x36d84a(_0x1ffa56['error'](0x1f4,_0x1a637e[_0xaac4('0x12')]));});});};exports[_0xaac4('0x44')]=function(_0x1f0e9f){var _0x1e6e0e=this;return new Promise(function(_0x3b39a1,_0x10e218){return db[_0xaac4('0x16')][_0xaac4('0x1c')]({'raw':_0x1f0e9f['options']?_0x1f0e9f[_0xaac4('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1f0e9f[_0xaac4('0x19')]?_0x1f0e9f['options'][_0xaac4('0x1d')]||null:null,'attributes':[['campaign','name'],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db['sequelize'][_0xaac4('0x20')]('id')),_0xaac4('0x45')],[db[_0xaac4('0x1e')]['fn'](_0xaac4('0x1f'),db[_0xaac4('0x1e')]['fn']('IF',db[_0xaac4('0x1e')]['literal'](_0xaac4('0x23')))),'ivrAnswerCallsDay']],'group':[_0xaac4('0x2d')]})['then'](function(_0x4dcc7d){logger['info'](_0xaac4('0x44'),_0x1f0e9f);logger[_0xaac4('0xc')](_0xaac4('0x44'),_0x1f0e9f,JSON[_0xaac4('0xf')](_0x4dcc7d));_0x3b39a1(_0x4dcc7d);})['catch'](function(_0x372f96){logger[_0xaac4('0x10')](_0xaac4('0x44'),_0x372f96['message'],_0x1f0e9f);_0x10e218(_0x1e6e0e[_0xaac4('0x10')](0x1f4,_0x372f96[_0xaac4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 3aa2fc4..4c2a66c 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 _0xb658=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','get','describe','/:id','show','post'];(function(_0x57df10,_0x2d411b){var _0x4859ff=function(_0x34450c){while(--_0x34450c){_0x57df10['push'](_0x57df10['shift']());}};_0x4859ff(++_0x2d411b);}(_0xb658,0x15a));var _0x8b65=function(_0x11d39c,_0x350fc3){_0x11d39c=_0x11d39c-0x0;var _0x2f302f=_0xb658[_0x11d39c];return _0x2f302f;};'use strict';var multer=require(_0x8b65('0x0'));var util=require('util');var path=require(_0x8b65('0x1'));var timeout=require('connect-timeout');var express=require(_0x8b65('0x2'));var router=express[_0x8b65('0x3')]();var auth=require(_0x8b65('0x4'));var interaction=require(_0x8b65('0x5'));var config=require(_0x8b65('0x6'));var controller=require(_0x8b65('0x7'));router['get']('/',auth[_0x8b65('0x8')](),controller['index']);router[_0x8b65('0x9')]('/describe',auth[_0x8b65('0x8')](),controller[_0x8b65('0xa')]);router[_0x8b65('0x9')](_0x8b65('0xb'),auth[_0x8b65('0x8')](),controller[_0x8b65('0xc')]);router[_0x8b65('0xd')]('/',auth[_0x8b65('0x8')](),controller['create']);router['put']('/:id',auth[_0x8b65('0x8')](),controller['update']);module[_0x8b65('0xe')]=router; \ No newline at end of file +var _0x228b=['put','update','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','describe','/:id','post','create'];(function(_0x2b1848,_0x39a32c){var _0x520094=function(_0x40cad5){while(--_0x40cad5){_0x2b1848['push'](_0x2b1848['shift']());}};_0x520094(++_0x39a32c);}(_0x228b,0x1f3));var _0xb228=function(_0x1134b2,_0x2977f3){_0x1134b2=_0x1134b2-0x0;var _0x54b9c6=_0x228b[_0x1134b2];return _0x54b9c6;};'use strict';var multer=require('multer');var util=require(_0xb228('0x0'));var path=require('path');var timeout=require(_0xb228('0x1'));var express=require(_0xb228('0x2'));var router=express[_0xb228('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb228('0x4'));var config=require(_0xb228('0x5'));var controller=require(_0xb228('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb228('0x7')]('/describe',auth[_0xb228('0x8')](),controller[_0xb228('0x9')]);router['get'](_0xb228('0xa'),auth[_0xb228('0x8')](),controller['show']);router[_0xb228('0xb')]('/',auth['isAuthenticated'](),controller[_0xb228('0xc')]);router[_0xb228('0xd')](_0xb228('0xa'),auth['isAuthenticated'](),controller[_0xb228('0xe')]);module[_0xb228('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 6ad9d4e..4a0dded 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 _0x68b3=['exports','STRING','name','sequelize'];(function(_0x37d639,_0x2bc08e){var _0x915348=function(_0x335f7e){while(--_0x335f7e){_0x37d639['push'](_0x37d639['shift']());}};_0x915348(++_0x2bc08e);}(_0x68b3,0xcf));var _0x368b=function(_0x4cd8b7,_0x42a7e1){_0x4cd8b7=_0x4cd8b7-0x0;var _0x156e6d=_0x68b3[_0x4cd8b7];return _0x156e6d;};'use strict';var Sequelize=require(_0x368b('0x0'));module[_0x368b('0x1')]={'name':{'type':Sequelize[_0x368b('0x2')],'unique':_0x368b('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x368b('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbbd7=['sequelize','STRING'];(function(_0x389c92,_0x4852f9){var _0x1ff810=function(_0x198975){while(--_0x198975){_0x389c92['push'](_0x389c92['shift']());}};_0x1ff810(++_0x4852f9);}(_0xbbd7,0x9e));var _0x7bbd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbd7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7bbd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7bbd('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index e87507d..c6ef704 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 _0x76fa=['intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','params','include','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','nolimit','includeAll','removeDispositions','ids','addContacts','tags','isArray','join','push','CmContact','omit','success','dataValues','errors','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','isEmpty','now','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','download','/tmp/list_%d_%s.csv','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','addColumn','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','get','Lists','UserProfileResource','error','name','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x76fa,0x169));var _0xa76f=function(_0x526b45,_0x40bb8f){_0x526b45=_0x526b45-0x0;var _0x50990d=_0x76fa[_0x526b45];return _0x50990d;};'use strict';var pdf=require(_0xa76f('0x0'));var emlformat=require(_0xa76f('0x1'));var rimraf=require(_0xa76f('0x2'));var zipdir=require(_0xa76f('0x3'));var jsonpatch=require(_0xa76f('0x4'));var rp=require(_0xa76f('0x5'));var moment=require('moment');var BPromise=require(_0xa76f('0x6'));var Mustache=require(_0xa76f('0x7'));var util=require('util');var path=require(_0xa76f('0x8'));var sox=require(_0xa76f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa76f('0xa'));var squel=require(_0xa76f('0xb'));var crypto=require(_0xa76f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa76f('0xd'));var toCsv=require(_0xa76f('0xe'));var querystring=require(_0xa76f('0xf'));var Papa=require(_0xa76f('0x10'));var Redis=require(_0xa76f('0x11'));var authService=require(_0xa76f('0x12'));var qs=require(_0xa76f('0x13'));var as=require(_0xa76f('0x14'));var hardwareService=require(_0xa76f('0x15'));var logger=require('../../config/logger')(_0xa76f('0x16'));var utils=require(_0xa76f('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xa76f('0x18')]=_[_0xa76f('0x19')](config[_0xa76f('0x18')],{'host':_0xa76f('0x1a'),'port':0x18eb});var socket=require(_0xa76f('0x1b'))(new Redis(config[_0xa76f('0x18')]));require(_0xa76f('0x1c'))[_0xa76f('0x1d')](socket);function respondWithStatusCode(_0x51d260,_0x3c1134){_0x3c1134=_0x3c1134||0xcc;return function(_0x2401ff){if(_0x2401ff){return _0x51d260[_0xa76f('0x1e')](_0x3c1134);}return _0x51d260[_0xa76f('0x1f')](_0x3c1134)[_0xa76f('0x20')]();};}function respondWithResult(_0x96d87f,_0x155800){_0x155800=_0x155800||0xc8;return function(_0x4c6d39){if(_0x4c6d39){return _0x96d87f[_0xa76f('0x1f')](_0x155800)[_0xa76f('0x21')](_0x4c6d39);}};}function respondWithFilteredResult(_0x26241c,_0x375115){return function(_0x3dd294){if(_0x3dd294){var _0x41efda=_0x3dd294[_0xa76f('0x22')],_0x57a621=_0x375115[_0xa76f('0x23')],_0x4e76ac=_0x375115['offset']+_0x375115[_0xa76f('0x24')],_0x411d5b;if(_0x4e76ac>=_0x41efda){_0x4e76ac=_0x41efda;_0x411d5b=0xc8;}else{_0x411d5b=0xce;}_0x26241c[_0xa76f('0x1f')](_0x411d5b);return _0x26241c['set'](_0xa76f('0x25'),_0x57a621+'-'+_0x4e76ac+'/'+_0x41efda)[_0xa76f('0x21')](_0x3dd294);}return null;};}function patchUpdates(_0x1d4be3){return function(_0x5e41e7){try{jsonpatch['apply'](_0x5e41e7,_0x1d4be3,!![]);}catch(_0x9d6ff4){return BPromise[_0xa76f('0x26')](_0x9d6ff4);}return _0x5e41e7[_0xa76f('0x27')]();};}function saveUpdates(_0x36df4a,_0x1d659d){return function(_0x26a630){if(_0x26a630){return _0x26a630[_0xa76f('0x28')](_0x36df4a)['then'](function(_0x34a721){return _0x34a721;});}return null;};}function removeEntity(_0x50d51d,_0x3025e9){return function(_0x311e3e){if(_0x311e3e){return _0x311e3e[_0xa76f('0x29')]()[_0xa76f('0x2a')](function(){var _0x5ed6aa=_0x311e3e[_0xa76f('0x2b')]({'plain':!![]});var _0x57d1e4=_0xa76f('0x2c');return db[_0xa76f('0x2d')]['destroy']({'where':{'type':_0x57d1e4,'resourceId':_0x5ed6aa['id']}})[_0xa76f('0x2a')](function(){return _0x311e3e;});})['then'](function(){_0x50d51d[_0xa76f('0x1f')](0xcc)[_0xa76f('0x20')]();});}};}function handleEntityNotFound(_0x548f42,_0x550226){return function(_0x5eb69a){if(!_0x5eb69a){_0x548f42[_0xa76f('0x1e')](0x194);}return _0x5eb69a;};}function handleError(_0x3a1ede,_0x3e7d80){_0x3e7d80=_0x3e7d80||0x1f4;return function(_0x5d068f){logger[_0xa76f('0x2e')](_0x5d068f['stack']);if(_0x5d068f[_0xa76f('0x2f')]){delete _0x5d068f['name'];}_0x3a1ede[_0xa76f('0x1f')](_0x3e7d80)['send'](_0x5d068f);};}exports[_0xa76f('0x30')]=function(_0x4d8dee,_0x1edf90){var _0x593817={},_0x3ab5a1={},_0x157b32={'count':0x0,'rows':[]};var _0x5e3258=_[_0xa76f('0x31')](db[_0xa76f('0x32')][_0xa76f('0x33')],function(_0x4ce4ef){return{'name':_0x4ce4ef[_0xa76f('0x34')],'type':_0x4ce4ef[_0xa76f('0x35')][_0xa76f('0x36')]};});_0x3ab5a1[_0xa76f('0x37')]=_[_0xa76f('0x31')](_0x5e3258,'name');_0x3ab5a1[_0xa76f('0x38')]=_[_0xa76f('0x39')](_0x4d8dee[_0xa76f('0x38')]);_0x3ab5a1[_0xa76f('0x3a')]=_[_0xa76f('0x3b')](_0x3ab5a1[_0xa76f('0x37')],_0x3ab5a1[_0xa76f('0x38')]);_0x593817['attributes']=_[_0xa76f('0x3b')](_0x3ab5a1[_0xa76f('0x37')],qs[_0xa76f('0x3c')](_0x4d8dee['query'][_0xa76f('0x3c')]));_0x593817['attributes']=_0x593817[_0xa76f('0x3d')][_0xa76f('0x3e')]?_0x593817[_0xa76f('0x3d')]:_0x3ab5a1['model'];if(!_0x4d8dee[_0xa76f('0x38')][_0xa76f('0x3f')]('nolimit')){_0x593817[_0xa76f('0x24')]=qs['limit'](_0x4d8dee['query'][_0xa76f('0x24')]);_0x593817[_0xa76f('0x23')]=qs[_0xa76f('0x23')](_0x4d8dee[_0xa76f('0x38')][_0xa76f('0x23')]);}_0x593817[_0xa76f('0x40')]=qs[_0xa76f('0x41')](_0x4d8dee[_0xa76f('0x38')]['sort']);_0x593817[_0xa76f('0x42')]=qs[_0xa76f('0x3a')](_[_0xa76f('0x43')](_0x4d8dee[_0xa76f('0x38')],_0x3ab5a1['filters']),_0x5e3258);if(_0x4d8dee[_0xa76f('0x38')][_0xa76f('0x44')]){_0x593817[_0xa76f('0x42')]=_[_0xa76f('0x45')](_0x593817[_0xa76f('0x42')],{'$or':_[_0xa76f('0x31')](_0x5e3258,function(_0x4e816b){if(_0x4e816b['type']!==_0xa76f('0x46')){var _0x303454={};_0x303454[_0x4e816b['name']]={'$like':'%'+_0x4d8dee[_0xa76f('0x38')]['filter']+'%'};return _0x303454;}})});}_0x593817=_['merge']({},_0x593817,_0x4d8dee['options']);var _0x47fb63={'where':_0x593817[_0xa76f('0x42')]};return db[_0xa76f('0x32')][_0xa76f('0x22')](_0x47fb63)['then'](function(_0x1a92e5){_0x157b32['count']=_0x1a92e5;if(_0x4d8dee[_0xa76f('0x38')]['includeAll']){_0x593817['include']=[{'all':!![]}];}return db['CmList'][_0xa76f('0x47')](_0x593817);})[_0xa76f('0x2a')](function(_0x3b354b){_0x157b32[_0xa76f('0x48')]=_0x3b354b;return _0x157b32;})[_0xa76f('0x2a')](respondWithFilteredResult(_0x1edf90,_0x593817))[_0xa76f('0x49')](handleError(_0x1edf90,null));};exports[_0xa76f('0x4a')]=function(_0x350fcf,_0x38bffd){var _0x181b6f={'raw':![],'where':{'id':_0x350fcf[_0xa76f('0x4b')]['id']}},_0x25748a={};_0x25748a['model']=_[_0xa76f('0x39')](db[_0xa76f('0x32')]['rawAttributes']);_0x25748a[_0xa76f('0x38')]=_['keys'](_0x350fcf[_0xa76f('0x38')]);_0x25748a['filters']=_['intersection'](_0x25748a['model'],_0x25748a[_0xa76f('0x38')]);_0x181b6f[_0xa76f('0x3d')]=_[_0xa76f('0x3b')](_0x25748a[_0xa76f('0x37')],qs[_0xa76f('0x3c')](_0x350fcf[_0xa76f('0x38')][_0xa76f('0x3c')]));_0x181b6f[_0xa76f('0x3d')]=_0x181b6f[_0xa76f('0x3d')][_0xa76f('0x3e')]?_0x181b6f['attributes']:_0x25748a[_0xa76f('0x37')];if(_0x350fcf['query']['includeAll']){_0x181b6f[_0xa76f('0x4c')]=[{'all':!![]}];}_0x181b6f=_[_0xa76f('0x45')]({},_0x181b6f,_0x350fcf[_0xa76f('0x4d')]);return db['CmList']['find'](_0x181b6f)[_0xa76f('0x2a')](handleEntityNotFound(_0x38bffd,null))[_0xa76f('0x2a')](respondWithResult(_0x38bffd,null))[_0xa76f('0x49')](handleError(_0x38bffd,null));};exports[_0xa76f('0x4e')]=function(_0x48cc48,_0x4b7223){return db['CmList'][_0xa76f('0x4e')](_0x48cc48[_0xa76f('0x4f')],{})['then'](function(_0x3419e8){var _0x2ec272=_0x48cc48['user'][_0xa76f('0x2b')]({'plain':!![]});if(!_0x2ec272)throw new Error(_0xa76f('0x50'));if(_0x2ec272[_0xa76f('0x51')]==='user'){var _0x1dd024=_0x3419e8[_0xa76f('0x2b')]({'plain':!![]});var _0x4bd2e0=_0xa76f('0x2c');return db[_0xa76f('0x52')][_0xa76f('0x53')]({'where':{'name':_0x4bd2e0,'userProfileId':_0x2ec272['userProfileId']},'raw':!![]})[_0xa76f('0x2a')](function(_0x5450cf){if(_0x5450cf&&_0x5450cf['autoAssociation']===0x0){return db['UserProfileResource'][_0xa76f('0x4e')]({'name':_0x1dd024['name'],'resourceId':_0x1dd024['id'],'type':_0x5450cf[_0xa76f('0x2f')],'sectionId':_0x5450cf['id']},{})['then'](function(){return _0x3419e8;});}else{return _0x3419e8;}})[_0xa76f('0x49')](function(_0x3d1b3a){logger[_0xa76f('0x2e')](_0xa76f('0x54'),_0x3d1b3a);throw _0x3d1b3a;});}return _0x3419e8;})[_0xa76f('0x2a')](respondWithResult(_0x4b7223,0xc9))['catch'](handleError(_0x4b7223,null));};exports[_0xa76f('0x28')]=function(_0x252adb,_0x157a95){if(_0x252adb[_0xa76f('0x4f')]['id']){delete _0x252adb[_0xa76f('0x4f')]['id'];}return db['CmList'][_0xa76f('0x53')]({'where':{'id':_0x252adb[_0xa76f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x157a95,null))['then'](saveUpdates(_0x252adb['body'],null))['then'](respondWithResult(_0x157a95,null))['catch'](handleError(_0x157a95,null));};exports[_0xa76f('0x29')]=function(_0x4bf247,_0x2e527d){return db[_0xa76f('0x32')][_0xa76f('0x53')]({'where':{'id':_0x4bf247[_0xa76f('0x4b')]['id']}})[_0xa76f('0x2a')](handleEntityNotFound(_0x2e527d,null))['then'](removeEntity(_0x2e527d,null))[_0xa76f('0x49')](handleError(_0x2e527d,null));};exports['describe']=function(_0x4b5d5f,_0x356625){return db[_0xa76f('0x32')][_0xa76f('0x55')]()[_0xa76f('0x2a')](respondWithResult(_0x356625,null))[_0xa76f('0x49')](handleError(_0x356625,null));};exports[_0xa76f('0x56')]=function(_0x3816ea,_0x517671,_0x205385){if(_0x3816ea[_0xa76f('0x4f')]['id']){delete _0x3816ea[_0xa76f('0x4f')]['id'];}return db[_0xa76f('0x32')][_0xa76f('0x53')]({'where':{'id':_0x3816ea[_0xa76f('0x4b')]['id']}})[_0xa76f('0x2a')](handleEntityNotFound(_0x517671,null))['then'](function(_0x3570a7){if(_0x3570a7){_0x3816ea[_0xa76f('0x4f')][_0xa76f('0x57')]=_0x3570a7['id'];return db[_0xa76f('0x58')][_0xa76f('0x4e')](_0x3816ea[_0xa76f('0x4f')]);}})[_0xa76f('0x2a')](respondWithResult(_0x517671,null))[_0xa76f('0x49')](handleError(_0x517671,null));};exports[_0xa76f('0x59')]=function(_0x2f0178,_0x55fc74,_0x31374e){var _0x107b67={'raw':![],'where':{}};var _0x418f40={};var _0x45cb12={'count':0x0,'rows':[]};return db[_0xa76f('0x32')]['findOne']({'where':{'id':_0x2f0178[_0xa76f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x55fc74,null))['then'](function(_0xcfa12){if(_0xcfa12){_0x418f40['model']=_[_0xa76f('0x39')](db[_0xa76f('0x58')][_0xa76f('0x33')]);_0x418f40[_0xa76f('0x38')]=_[_0xa76f('0x39')](_0x2f0178[_0xa76f('0x38')]);_0x418f40['filters']=_['intersection'](_0x418f40[_0xa76f('0x37')],_0x418f40[_0xa76f('0x38')]);_0x107b67['attributes']=_['intersection'](_0x418f40['model'],qs[_0xa76f('0x3c')](_0x2f0178[_0xa76f('0x38')][_0xa76f('0x3c')]));_0x107b67[_0xa76f('0x3d')]=_0x107b67[_0xa76f('0x3d')][_0xa76f('0x3e')]?_0x107b67[_0xa76f('0x3d')]:_0x418f40[_0xa76f('0x37')];if(!_0x2f0178[_0xa76f('0x38')][_0xa76f('0x3f')](_0xa76f('0x5a'))){_0x107b67['limit']=qs['limit'](_0x2f0178[_0xa76f('0x38')][_0xa76f('0x24')]);_0x107b67[_0xa76f('0x23')]=qs[_0xa76f('0x23')](_0x2f0178[_0xa76f('0x38')][_0xa76f('0x23')]);}_0x107b67['order']=qs['sort'](_0x2f0178[_0xa76f('0x38')]['sort']);_0x107b67[_0xa76f('0x42')]=qs[_0xa76f('0x3a')](_[_0xa76f('0x43')](_0x2f0178[_0xa76f('0x38')],_0x418f40['filters']));_0x107b67['where'][_0xa76f('0x57')]=_0xcfa12['id'];if(_0x2f0178['query'][_0xa76f('0x44')]){_0x107b67[_0xa76f('0x42')]=_[_0xa76f('0x45')](_0x107b67[_0xa76f('0x42')],{'$or':_['map'](_0x107b67['attributes'],function(_0x471017){var _0x5036d9={};_0x5036d9[_0x471017]={'$like':'%'+_0x2f0178['query'][_0xa76f('0x44')]+'%'};return _0x5036d9;})});}_0x107b67=_[_0xa76f('0x45')]({},_0x107b67,_0x2f0178[_0xa76f('0x4d')]);return db[_0xa76f('0x58')][_0xa76f('0x22')]({'where':_0x107b67[_0xa76f('0x42')]})[_0xa76f('0x2a')](function(_0x275309){_0x45cb12[_0xa76f('0x22')]=_0x275309;if(_0x2f0178[_0xa76f('0x38')][_0xa76f('0x5b')]){_0x107b67[_0xa76f('0x4c')]=[{'all':!![]}];}return db[_0xa76f('0x58')][_0xa76f('0x47')](_0x107b67);})[_0xa76f('0x2a')](function(_0x74754b){_0x45cb12['rows']=_0x74754b;return _0x45cb12;});}})[_0xa76f('0x2a')](respondWithFilteredResult(_0x55fc74,_0x107b67))[_0xa76f('0x49')](handleError(_0x55fc74,null));};exports['removeDispositions']=function(_0x429562,_0x433613,_0x469a8b){return db[_0xa76f('0x32')][_0xa76f('0x53')]({'where':{'id':_0x429562[_0xa76f('0x4b')]['id']}})[_0xa76f('0x2a')](handleEntityNotFound(_0x433613,null))[_0xa76f('0x2a')](function(_0x18e129){if(_0x18e129){return _0x18e129[_0xa76f('0x5c')](_0x429562['query'][_0xa76f('0x5d')]);}})['then'](respondWithStatusCode(_0x433613,null))[_0xa76f('0x49')](handleError(_0x433613,null));};exports[_0xa76f('0x5e')]=function(_0x16aa64,_0x2ad211,_0x30c3eb){return db[_0xa76f('0x32')][_0xa76f('0x53')]({'where':{'id':_0x16aa64[_0xa76f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2ad211,null))[_0xa76f('0x2a')](function(_0x55b1fe){if(_0x55b1fe){var _0x3957ef=[];var _0x24bf94={'success':[],'errors':[]};return db['CmContact'][_0xa76f('0x55')]()[_0xa76f('0x2a')](function(_0x19c985){if(_0x16aa64[_0xa76f('0x4f')][_0xa76f('0x5f')]&&_[_0xa76f('0x60')](_0x16aa64[_0xa76f('0x4f')][_0xa76f('0x5f')])){if(_0x16aa64['body'][_0xa76f('0x5f')][_0xa76f('0x3e')]){_0x16aa64[_0xa76f('0x4f')][_0xa76f('0x5f')]=_0x16aa64[_0xa76f('0x4f')][_0xa76f('0x5f')][_0xa76f('0x61')](';')+';';}else{_0x16aa64['body'][_0xa76f('0x5f')]=null;}}else{_0x16aa64['body'][_0xa76f('0x5f')]=null;}if(_0x16aa64[_0xa76f('0x4f')]&&_['isArray'](_0x16aa64[_0xa76f('0x4f')])){for(var _0x3da024=0x0;_0x3da024<_0x16aa64[_0xa76f('0x4f')][_0xa76f('0x3e')];_0x3da024+=0x1){_0x16aa64[_0xa76f('0x4f')][_0x3da024][_0xa76f('0x57')]=_0x16aa64[_0xa76f('0x4b')]['id'];_0x3957ef[_0xa76f('0x62')](_0x16aa64[_0xa76f('0x4f')][_0x3da024]);}return BPromise['each'](_0x3957ef,function(_0xbdea){return db[_0xa76f('0x63')][_0xa76f('0x4e')](_[_0xa76f('0x64')](_0xbdea,[_0xa76f('0x5d'),'id'])||{},{'fields':_[_0xa76f('0x39')](_0x19c985),'raw':!![]})['then'](function(_0x4c7a17){_0x24bf94[_0xa76f('0x65')][_0xa76f('0x62')](_0x4c7a17[_0xa76f('0x66')]);})['catch'](function(_0x221129){_0x24bf94[_0xa76f('0x67')]['push']({'data':_0xbdea,'error':_0x221129['message']});});})[_0xa76f('0x2a')](function(_0xed3cfa){return _0x24bf94;})[_0xa76f('0x49')](function(_0x2565c8){return _0x2565c8;});}else{_0x2ad211['status'](0x190)[_0xa76f('0x21')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xa76f('0x2a')](respondWithResult(_0x2ad211,null))['catch'](handleError(_0x2ad211,null));};exports[_0xa76f('0x68')]=function(_0x571234,_0x226f2f,_0x448b0){var _0x4a69d2;return db[_0xa76f('0x32')][_0xa76f('0x53')]({'where':{'id':_0x571234[_0xa76f('0x4b')]['id']},'include':[{'model':db[_0xa76f('0x69')],'as':_0xa76f('0x6a')}]})[_0xa76f('0x2a')](handleEntityNotFound(_0x226f2f,null))[_0xa76f('0x2a')](function(_0x66d54d){if(_0x66d54d){_0x4a69d2=_0x66d54d;return db['CmContact'][_0xa76f('0x33')];}})['then'](function(_0x56d2cb){if(_0x56d2cb){var _0x16fe0b={};var _0x5047b3={};_0x5047b3[_0xa76f('0x37')]=_[_0xa76f('0x6b')](_['keys'](_0x56d2cb),_[_0xa76f('0x31')](_0x4a69d2[_0xa76f('0x6a')],function(_0xb7e666){return util[_0xa76f('0x6c')](_0xa76f('0x6d'),_0xb7e666['id']);}));_0x5047b3[_0xa76f('0x38')]=_[_0xa76f('0x39')](_0x571234[_0xa76f('0x38')]);_0x5047b3[_0xa76f('0x3a')]=_[_0xa76f('0x3b')](_0x5047b3[_0xa76f('0x37')],_0x5047b3[_0xa76f('0x38')]);_0x16fe0b[_0xa76f('0x3d')]=_[_0xa76f('0x3b')](_0x5047b3[_0xa76f('0x37')],qs[_0xa76f('0x3c')](_0x571234[_0xa76f('0x38')]['fields']));_0x16fe0b[_0xa76f('0x3d')]=_0x16fe0b[_0xa76f('0x3d')][_0xa76f('0x3e')]?_0x16fe0b[_0xa76f('0x3d')]:_0x5047b3['model'];if(!_0x571234[_0xa76f('0x38')][_0xa76f('0x3f')](_0xa76f('0x5a'))){_0x16fe0b[_0xa76f('0x24')]=qs[_0xa76f('0x24')](_0x571234[_0xa76f('0x38')][_0xa76f('0x24')]);_0x16fe0b[_0xa76f('0x23')]=qs['offset'](_0x571234[_0xa76f('0x38')]['offset']);}_0x16fe0b[_0xa76f('0x40')]=qs[_0xa76f('0x41')](_0x571234[_0xa76f('0x38')][_0xa76f('0x41')]);_0x16fe0b['where']=qs[_0xa76f('0x3a')](_[_0xa76f('0x43')](_0x571234['query'],_0x5047b3['filters']));_0x16fe0b[_0xa76f('0x6e')]=!![];if(_0x571234[_0xa76f('0x38')][_0xa76f('0x44')]){_0x16fe0b[_0xa76f('0x42')]=_[_0xa76f('0x45')](_0x16fe0b['where'],{'$or':_['map'](_0x16fe0b['attributes'],function(_0x23ef64){var _0x120ef9={};_0x120ef9[_0x23ef64]={'$like':'%'+_0x571234[_0xa76f('0x38')][_0xa76f('0x44')]+'%'};return _0x120ef9;})});}_0x16fe0b=_[_0xa76f('0x45')]({},_0x16fe0b,_0x571234['options']);return _0x4a69d2[_0xa76f('0x68')](_0x16fe0b);}})[_0xa76f('0x2a')](respondWithResult(_0x226f2f,null))[_0xa76f('0x49')](handleError(_0x226f2f,null));};exports[_0xa76f('0x6f')]=function(_0x34e32b,_0x276199,_0x45f31f){var _0x5dd97f;return db[_0xa76f('0x32')][_0xa76f('0x53')]({'where':{'id':_0x34e32b[_0xa76f('0x4b')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xa76f('0x6a')}]})[_0xa76f('0x2a')](handleEntityNotFound(_0x276199,null))[_0xa76f('0x2a')](function(_0x35b7fb){if(_0x35b7fb){_0x5dd97f=_0x35b7fb;return db[_0xa76f('0x63')][_0xa76f('0x33')];}})[_0xa76f('0x2a')](function(_0x479bfb){if(_0x479bfb){var _0x49d69c={};var _0x443212={};_0x443212[_0xa76f('0x37')]=_['concat'](_['keys'](_0x479bfb),_[_0xa76f('0x31')](_0x5dd97f['CustomFields'],function(_0x460324){return util['format']('cf_%d',_0x460324['id']);}));_0x443212[_0xa76f('0x38')]=_[_0xa76f('0x39')](_0x34e32b[_0xa76f('0x38')]);_0x443212[_0xa76f('0x3a')]=_['intersection'](_0x443212[_0xa76f('0x37')],_0x443212[_0xa76f('0x38')]);_0x49d69c['attributes']=_[_0xa76f('0x3b')](_0x443212[_0xa76f('0x37')],qs[_0xa76f('0x3c')](_0x34e32b[_0xa76f('0x38')][_0xa76f('0x3c')]));_0x49d69c[_0xa76f('0x3d')]=_0x49d69c[_0xa76f('0x3d')][_0xa76f('0x3e')]?_0x49d69c['attributes']:_0x443212[_0xa76f('0x37')];if(!_0x34e32b[_0xa76f('0x38')][_0xa76f('0x3f')](_0xa76f('0x5a'))){_0x49d69c[_0xa76f('0x24')]=qs[_0xa76f('0x24')](_0x34e32b['query'][_0xa76f('0x24')]);_0x49d69c['offset']=qs[_0xa76f('0x23')](_0x34e32b[_0xa76f('0x38')]['offset']);}_0x49d69c[_0xa76f('0x40')]=qs[_0xa76f('0x41')](_0x34e32b[_0xa76f('0x38')][_0xa76f('0x41')]);_0x49d69c[_0xa76f('0x42')]=qs[_0xa76f('0x3a')](_[_0xa76f('0x43')](_0x34e32b[_0xa76f('0x38')],_0x443212['filters']));_0x49d69c['raw']=!![];if(_0x34e32b[_0xa76f('0x38')]['filter']){_0x49d69c['where']=_[_0xa76f('0x45')](_0x49d69c[_0xa76f('0x42')],{'$or':_[_0xa76f('0x31')](_0x49d69c['attributes'],function(_0x190369){var _0x1d436b={};_0x1d436b[_0x190369]={'$like':'%'+_0x34e32b[_0xa76f('0x38')][_0xa76f('0x44')]+'%'};return _0x1d436b;})});}_0x49d69c=_['merge']({},_0x49d69c,_0x34e32b[_0xa76f('0x4d')]);return _0x5dd97f[_0xa76f('0x68')](_0x49d69c);}})[_0xa76f('0x2a')](function(_0x190498){if(!_[_0xa76f('0x70')](_0x190498)){var _0x546b67=toCsv(_0x190498);var _0x2a97a9=Date[_0xa76f('0x71')]();fs['writeFileSync'](util[_0xa76f('0x6c')]('/tmp/list_%d_%s.csv',_0x5dd97f['id'],_0x2a97a9),_0x546b67);_0x276199['setHeader'](_0xa76f('0x72'),_0xa76f('0x73')+util[_0xa76f('0x6c')]('list_%d_%s.csv',_0x5dd97f['id'],_0x2a97a9));_0x276199[_0xa76f('0x74')](_0xa76f('0x75'),_0xa76f('0x76'));return _0x276199[_0xa76f('0x77')](util[_0xa76f('0x6c')](_0xa76f('0x78'),_0x5dd97f['id'],_0x2a97a9));}else{return _0x276199[_0xa76f('0x1e')](0xcc);}})[_0xa76f('0x49')](handleError(_0x276199,null));};exports['addCustomField']=function(_0x58b72d,_0x4f6a8f,_0x37dd82){var _0x5f3a4c;delete _0x58b72d[_0xa76f('0x4f')]['id'];return db[_0xa76f('0x32')][_0xa76f('0x79')]({'where':{'id':_0x58b72d['params']['id']}})['then'](handleEntityNotFound(_0x4f6a8f,null))[_0xa76f('0x2a')](function(_0x2c6146){if(_0x2c6146){return db[_0xa76f('0x7a')][_0xa76f('0x7b')](function(_0x12989e){return db['CmCustomField']['create'](_0x58b72d[_0xa76f('0x4f')],{'transaction':_0x12989e})[_0xa76f('0x2a')](function(_0x23406f){_0x5f3a4c=_0x23406f;return _0x2c6146[_0xa76f('0x7c')](_0x23406f,{'transaction':_0x12989e});})[_0xa76f('0x2a')](function(){var _0x428691={'type':db[_0xa76f('0x7d')][_0xa76f('0x7e')],'transaction':_0x12989e};switch(_0x58b72d[_0xa76f('0x4f')][_0xa76f('0x35')]){case _0xa76f('0x7f'):_0x428691[_0xa76f('0x35')]=db[_0xa76f('0x7d')][_0xa76f('0x7e')];break;case _0xa76f('0x80'):_0x428691[_0xa76f('0x35')]=db[_0xa76f('0x7d')]['INTEGER'];break;case _0xa76f('0x81'):_0x428691['type']=db[_0xa76f('0x7d')]['BOOLEAN'];_0x428691['defaultValue']=![];break;default:}return db['sequelize']['queryInterface'][_0xa76f('0x82')]('cm_contacts',util[_0xa76f('0x6c')]('cf_%s',_0x5f3a4c['id']),_0x428691);})[_0xa76f('0x2a')](function(){return _0x5f3a4c;});});}})[_0xa76f('0x2a')](respondWithResult(_0x4f6a8f,null))[_0xa76f('0x49')](handleError(_0x4f6a8f,null));};exports[_0xa76f('0x83')]=function(_0x1b1c24,_0x40a570,_0x592290){var _0x4d1b20={};var _0x68c64f={};var _0xb2ef5c;var _0x243f64;return db[_0xa76f('0x32')][_0xa76f('0x79')]({'where':{'id':_0x1b1c24[_0xa76f('0x4b')]['id']}})[_0xa76f('0x2a')](handleEntityNotFound(_0x40a570,null))[_0xa76f('0x2a')](function(_0x5676b1){if(_0x5676b1){_0xb2ef5c=_0x5676b1;_0x68c64f['model']=_[_0xa76f('0x39')](db[_0xa76f('0x69')]['rawAttributes']);_0x68c64f['query']=_[_0xa76f('0x39')](_0x1b1c24[_0xa76f('0x38')]);_0x68c64f['filters']=_[_0xa76f('0x3b')](_0x68c64f[_0xa76f('0x37')],_0x68c64f[_0xa76f('0x38')]);_0x4d1b20[_0xa76f('0x3d')]=_[_0xa76f('0x3b')](_0x68c64f[_0xa76f('0x37')],qs['fields'](_0x1b1c24[_0xa76f('0x38')][_0xa76f('0x3c')]));_0x4d1b20[_0xa76f('0x3d')]=_0x4d1b20[_0xa76f('0x3d')]['length']?_0x4d1b20[_0xa76f('0x3d')]:_0x68c64f[_0xa76f('0x37')];_0x4d1b20[_0xa76f('0x40')]=qs[_0xa76f('0x41')](_0x1b1c24[_0xa76f('0x38')][_0xa76f('0x41')]);_0x4d1b20[_0xa76f('0x42')]=qs['filters'](_[_0xa76f('0x43')](_0x1b1c24[_0xa76f('0x38')],_0x68c64f[_0xa76f('0x3a')]));_0x4d1b20[_0xa76f('0x42')]=_['merge'](_0x4d1b20[_0xa76f('0x42')],{'$or':[{'ListId':_0x5676b1['id']},{'ListId':null}]});if(_0x1b1c24[_0xa76f('0x38')][_0xa76f('0x44')]){_0x4d1b20[_0xa76f('0x42')]=_['merge'](_0x4d1b20[_0xa76f('0x42')],{'$or':_[_0xa76f('0x31')](_0x4d1b20[_0xa76f('0x3d')],function(_0x27d85e){var _0x1eb7e1={};_0x1eb7e1[_0x27d85e]={'$like':'%'+_0x1b1c24[_0xa76f('0x38')][_0xa76f('0x44')]+'%'};return _0x1eb7e1;})});}_0x4d1b20=_['merge']({},_0x4d1b20,_0x1b1c24[_0xa76f('0x4d')]);return db[_0xa76f('0x69')][_0xa76f('0x84')](_0x4d1b20);}})[_0xa76f('0x2a')](respondWithResult(_0x40a570,null))[_0xa76f('0x49')](handleError(_0x40a570,null));};exports[_0xa76f('0x85')]=function(_0x2d1133,_0xd998,_0x2a217c){return db['CmList'][_0xa76f('0x53')]({'where':{'id':_0x2d1133['params']['id']}})['then'](handleEntityNotFound(_0xd998,null))[_0xa76f('0x2a')](function(_0x2e1492){if(_0x2e1492){return _0x2e1492[_0xa76f('0x85')](_0x2d1133[_0xa76f('0x4f')][_0xa76f('0x5d')],_[_0xa76f('0x64')](_0x2d1133['body'],[_0xa76f('0x5d'),'id'])||{})['spread'](function(_0x49c54c){for(var _0x3b3c0a=0x0;_0x3b3c0a<_0x2d1133['body']['ids']['length'];_0x3b3c0a+=0x1){socket[_0xa76f('0x86')](_0xa76f('0x87'),{'UserId':_0x2d1133[_0xa76f('0x4f')]['ids'][_0x3b3c0a],'CmListId':_0x2d1133[_0xa76f('0x4b')]['id']});}return _0x49c54c;});}})[_0xa76f('0x2a')](respondWithResult(_0xd998,null))['catch'](handleError(_0xd998,null));};exports[_0xa76f('0x88')]=function(_0x184022,_0xd0f6a1,_0x45bb16){return db[_0xa76f('0x32')][_0xa76f('0x53')]({'where':{'id':_0x184022['params']['id']}})[_0xa76f('0x2a')](handleEntityNotFound(_0xd0f6a1,null))[_0xa76f('0x2a')](function(_0x3c22ff){if(_0x3c22ff){return _0x3c22ff[_0xa76f('0x88')](_0x184022[_0xa76f('0x38')][_0xa76f('0x5d')])[_0xa76f('0x2a')](function(){if(_[_0xa76f('0x60')](_0x184022[_0xa76f('0x38')][_0xa76f('0x5d')])){for(var _0x3825f9=0x0;_0x3825f9<_0x184022[_0xa76f('0x38')]['ids'][_0xa76f('0x3e')];_0x3825f9+=0x1){socket[_0xa76f('0x86')](_0xa76f('0x89'),{'UserId':Number(_0x184022['query']['ids'][_0x3825f9]),'CmListId':Number(_0x184022[_0xa76f('0x4b')]['id'])});}}else{socket['emit'](_0xa76f('0x89'),{'UserId':Number(_0x184022[_0xa76f('0x38')][_0xa76f('0x5d')]),'CmListId':Number(_0x184022[_0xa76f('0x4b')]['id'])});}});}})[_0xa76f('0x2a')](respondWithStatusCode(_0xd0f6a1,null))[_0xa76f('0x49')](handleError(_0xd0f6a1,null));};exports[_0xa76f('0x8a')]=function(_0x22f52e,_0x452990,_0x177490){var _0x7fa0df={};var _0x5761f8={};var _0x58bf60;var _0x55f441;return db[_0xa76f('0x32')][_0xa76f('0x79')]({'where':{'id':_0x22f52e['params']['id']}})[_0xa76f('0x2a')](handleEntityNotFound(_0x452990,null))[_0xa76f('0x2a')](function(_0x32c7a1){if(_0x32c7a1){_0x58bf60=_0x32c7a1;_0x5761f8['model']=_[_0xa76f('0x39')](db[_0xa76f('0x8b')][_0xa76f('0x33')]);_0x5761f8[_0xa76f('0x38')]=_['keys'](_0x22f52e[_0xa76f('0x38')]);_0x5761f8[_0xa76f('0x3a')]=_[_0xa76f('0x3b')](_0x5761f8['model'],_0x5761f8[_0xa76f('0x38')]);_0x7fa0df[_0xa76f('0x3d')]=_[_0xa76f('0x3b')](_0x5761f8['model'],qs['fields'](_0x22f52e[_0xa76f('0x38')][_0xa76f('0x3c')]));_0x7fa0df[_0xa76f('0x3d')]=_0x7fa0df[_0xa76f('0x3d')][_0xa76f('0x3e')]?_0x7fa0df[_0xa76f('0x3d')]:_0x5761f8['model'];_0x7fa0df[_0xa76f('0x40')]=qs[_0xa76f('0x41')](_0x22f52e[_0xa76f('0x38')][_0xa76f('0x41')]);_0x7fa0df[_0xa76f('0x42')]=qs[_0xa76f('0x3a')](_[_0xa76f('0x43')](_0x22f52e[_0xa76f('0x38')],_0x5761f8['filters']));if(_0x22f52e[_0xa76f('0x38')]['filter']){_0x7fa0df[_0xa76f('0x42')]=_['merge'](_0x7fa0df['where'],{'$or':_[_0xa76f('0x31')](_0x7fa0df[_0xa76f('0x3d')],function(_0x194262){var _0x2fbba5={};_0x2fbba5[_0x194262]={'$like':'%'+_0x22f52e[_0xa76f('0x38')][_0xa76f('0x44')]+'%'};return _0x2fbba5;})});}_0x7fa0df=_[_0xa76f('0x45')]({},_0x7fa0df,_0x22f52e[_0xa76f('0x4d')]);return _0x58bf60[_0xa76f('0x8a')](_0x7fa0df);}})[_0xa76f('0x2a')](function(_0x2f310f){if(_0x2f310f){_0x55f441=_0x2f310f[_0xa76f('0x3e')];if(!_0x22f52e['query'][_0xa76f('0x3f')]('nolimit')){_0x7fa0df[_0xa76f('0x24')]=qs[_0xa76f('0x24')](_0x22f52e[_0xa76f('0x38')][_0xa76f('0x24')]);_0x7fa0df[_0xa76f('0x23')]=qs[_0xa76f('0x23')](_0x22f52e[_0xa76f('0x38')][_0xa76f('0x23')]);}return _0x58bf60[_0xa76f('0x8a')](_0x7fa0df);}})[_0xa76f('0x2a')](function(_0x13fab3){if(_0x13fab3){return _0x13fab3?{'count':_0x55f441,'rows':_0x13fab3}:null;}})['then'](respondWithResult(_0x452990,null))['catch'](handleError(_0x452990,null));}; \ No newline at end of file +var _0xa16a=['emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','./cmList.socket','register','sendStatus','end','status','json','count','offset','limit','set','save','destroy','then','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','include','removeDispositions','addContacts','isArray','tags','push','each','CmContact','omit','ids','success','dataValues','errors','message','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','nolimit','raw','getContactsCsv','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','addAgents','userCmList:save','removeAgents'];(function(_0x533e3,_0x511935){var _0x32938e=function(_0x27f37a){while(--_0x27f37a){_0x533e3['push'](_0x533e3['shift']());}};_0x32938e(++_0x511935);}(_0xa16a,0x128));var _0xaa16=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0xa16a[_0x33ebf5];return _0x66957b;};'use strict';var pdf=require(_0xaa16('0x0'));var emlformat=require(_0xaa16('0x1'));var rimraf=require(_0xaa16('0x2'));var zipdir=require(_0xaa16('0x3'));var jsonpatch=require(_0xaa16('0x4'));var rp=require(_0xaa16('0x5'));var moment=require(_0xaa16('0x6'));var BPromise=require(_0xaa16('0x7'));var Mustache=require(_0xaa16('0x8'));var util=require(_0xaa16('0x9'));var path=require(_0xaa16('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaa16('0xb'));var fs=require('fs');var _=require(_0xaa16('0xc'));var squel=require('squel');var crypto=require(_0xaa16('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa16('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaa16('0xf'));var Papa=require(_0xaa16('0x10'));var Redis=require(_0xaa16('0x11'));var authService=require(_0xaa16('0x12'));var qs=require(_0xaa16('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa16('0x14'));var logger=require(_0xaa16('0x15'))(_0xaa16('0x16'));var utils=require(_0xaa16('0x17'));var config=require(_0xaa16('0x18'));var db=require(_0xaa16('0x19'))['db'];config['redis']=_[_0xaa16('0x1a')](config[_0xaa16('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa16('0x1b')]));require(_0xaa16('0x1c'))[_0xaa16('0x1d')](socket);function respondWithStatusCode(_0x497a4b,_0xcdebb8){_0xcdebb8=_0xcdebb8||0xcc;return function(_0x5b25ca){if(_0x5b25ca){return _0x497a4b[_0xaa16('0x1e')](_0xcdebb8);}return _0x497a4b['status'](_0xcdebb8)[_0xaa16('0x1f')]();};}function respondWithResult(_0x466c22,_0x102e74){_0x102e74=_0x102e74||0xc8;return function(_0x4871bd){if(_0x4871bd){return _0x466c22[_0xaa16('0x20')](_0x102e74)[_0xaa16('0x21')](_0x4871bd);}};}function respondWithFilteredResult(_0x496151,_0x5abff7){return function(_0x4a5b7b){if(_0x4a5b7b){var _0x5f0c07=_0x4a5b7b[_0xaa16('0x22')],_0x39f02c=_0x5abff7['offset'],_0x116022=_0x5abff7[_0xaa16('0x23')]+_0x5abff7[_0xaa16('0x24')],_0x3ad6bb;if(_0x116022>=_0x5f0c07){_0x116022=_0x5f0c07;_0x3ad6bb=0xc8;}else{_0x3ad6bb=0xce;}_0x496151[_0xaa16('0x20')](_0x3ad6bb);return _0x496151[_0xaa16('0x25')]('Content-Range',_0x39f02c+'-'+_0x116022+'/'+_0x5f0c07)[_0xaa16('0x21')](_0x4a5b7b);}return null;};}function patchUpdates(_0x16be76){return function(_0x48d443){try{jsonpatch['apply'](_0x48d443,_0x16be76,!![]);}catch(_0x453fea){return BPromise['reject'](_0x453fea);}return _0x48d443[_0xaa16('0x26')]();};}function saveUpdates(_0x5b25ba,_0x1883fc){return function(_0xb4e84){if(_0xb4e84){return _0xb4e84['update'](_0x5b25ba)['then'](function(_0x588a70){return _0x588a70;});}return null;};}function removeEntity(_0x2d7c9c,_0x5c229a){return function(_0x385f18){if(_0x385f18){return _0x385f18[_0xaa16('0x27')]()[_0xaa16('0x28')](function(){var _0x654b2d=_0x385f18[_0xaa16('0x29')]({'plain':!![]});var _0x49d6fb=_0xaa16('0x2a');return db[_0xaa16('0x2b')]['destroy']({'where':{'type':_0x49d6fb,'resourceId':_0x654b2d['id']}})[_0xaa16('0x28')](function(){return _0x385f18;});})['then'](function(){_0x2d7c9c[_0xaa16('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x477382,_0x131881){return function(_0x7384ce){if(!_0x7384ce){_0x477382['sendStatus'](0x194);}return _0x7384ce;};}function handleError(_0x2bf2ba,_0x359fab){_0x359fab=_0x359fab||0x1f4;return function(_0x186fca){logger[_0xaa16('0x2c')](_0x186fca[_0xaa16('0x2d')]);if(_0x186fca['name']){delete _0x186fca[_0xaa16('0x2e')];}_0x2bf2ba[_0xaa16('0x20')](_0x359fab)[_0xaa16('0x2f')](_0x186fca);};}exports[_0xaa16('0x30')]=function(_0x5e2b9b,_0x4e1159){var _0x22bb16={},_0x267229={},_0x5793b3={'count':0x0,'rows':[]};var _0x53e57b=_[_0xaa16('0x31')](db[_0xaa16('0x32')]['rawAttributes'],function(_0x1ad880){return{'name':_0x1ad880[_0xaa16('0x33')],'type':_0x1ad880[_0xaa16('0x34')][_0xaa16('0x35')]};});_0x267229[_0xaa16('0x36')]=_[_0xaa16('0x31')](_0x53e57b,_0xaa16('0x2e'));_0x267229['query']=_[_0xaa16('0x37')](_0x5e2b9b['query']);_0x267229['filters']=_[_0xaa16('0x38')](_0x267229[_0xaa16('0x36')],_0x267229[_0xaa16('0x39')]);_0x22bb16[_0xaa16('0x3a')]=_[_0xaa16('0x38')](_0x267229[_0xaa16('0x36')],qs[_0xaa16('0x3b')](_0x5e2b9b[_0xaa16('0x39')][_0xaa16('0x3b')]));_0x22bb16[_0xaa16('0x3a')]=_0x22bb16[_0xaa16('0x3a')][_0xaa16('0x3c')]?_0x22bb16[_0xaa16('0x3a')]:_0x267229[_0xaa16('0x36')];if(!_0x5e2b9b[_0xaa16('0x39')][_0xaa16('0x3d')]('nolimit')){_0x22bb16[_0xaa16('0x24')]=qs[_0xaa16('0x24')](_0x5e2b9b[_0xaa16('0x39')][_0xaa16('0x24')]);_0x22bb16['offset']=qs[_0xaa16('0x23')](_0x5e2b9b['query'][_0xaa16('0x23')]);}_0x22bb16[_0xaa16('0x3e')]=qs[_0xaa16('0x3f')](_0x5e2b9b[_0xaa16('0x39')][_0xaa16('0x3f')]);_0x22bb16[_0xaa16('0x40')]=qs[_0xaa16('0x41')](_[_0xaa16('0x42')](_0x5e2b9b[_0xaa16('0x39')],_0x267229['filters']),_0x53e57b);if(_0x5e2b9b[_0xaa16('0x39')][_0xaa16('0x43')]){_0x22bb16['where']=_[_0xaa16('0x44')](_0x22bb16[_0xaa16('0x40')],{'$or':_[_0xaa16('0x31')](_0x53e57b,function(_0x528377){if(_0x528377[_0xaa16('0x34')]!==_0xaa16('0x45')){var _0x5ca546={};_0x5ca546[_0x528377[_0xaa16('0x2e')]]={'$like':'%'+_0x5e2b9b[_0xaa16('0x39')][_0xaa16('0x43')]+'%'};return _0x5ca546;}})});}_0x22bb16=_[_0xaa16('0x44')]({},_0x22bb16,_0x5e2b9b[_0xaa16('0x46')]);var _0x4e6fca={'where':_0x22bb16['where']};return db[_0xaa16('0x32')][_0xaa16('0x22')](_0x4e6fca)[_0xaa16('0x28')](function(_0xb67ac5){_0x5793b3[_0xaa16('0x22')]=_0xb67ac5;if(_0x5e2b9b[_0xaa16('0x39')][_0xaa16('0x47')]){_0x22bb16['include']=[{'all':!![]}];}return db[_0xaa16('0x32')][_0xaa16('0x48')](_0x22bb16);})[_0xaa16('0x28')](function(_0x440267){_0x5793b3['rows']=_0x440267;return _0x5793b3;})['then'](respondWithFilteredResult(_0x4e1159,_0x22bb16))[_0xaa16('0x49')](handleError(_0x4e1159,null));};exports[_0xaa16('0x4a')]=function(_0x48d7f7,_0x4cb402){var _0x53f72d={'raw':![],'where':{'id':_0x48d7f7[_0xaa16('0x4b')]['id']}},_0x12940c={};_0x12940c[_0xaa16('0x36')]=_['keys'](db[_0xaa16('0x32')][_0xaa16('0x4c')]);_0x12940c[_0xaa16('0x39')]=_[_0xaa16('0x37')](_0x48d7f7[_0xaa16('0x39')]);_0x12940c[_0xaa16('0x41')]=_[_0xaa16('0x38')](_0x12940c[_0xaa16('0x36')],_0x12940c['query']);_0x53f72d[_0xaa16('0x3a')]=_['intersection'](_0x12940c[_0xaa16('0x36')],qs[_0xaa16('0x3b')](_0x48d7f7[_0xaa16('0x39')][_0xaa16('0x3b')]));_0x53f72d['attributes']=_0x53f72d['attributes'][_0xaa16('0x3c')]?_0x53f72d['attributes']:_0x12940c[_0xaa16('0x36')];if(_0x48d7f7[_0xaa16('0x39')][_0xaa16('0x47')]){_0x53f72d['include']=[{'all':!![]}];}_0x53f72d=_[_0xaa16('0x44')]({},_0x53f72d,_0x48d7f7[_0xaa16('0x46')]);return db[_0xaa16('0x32')][_0xaa16('0x4d')](_0x53f72d)[_0xaa16('0x28')](handleEntityNotFound(_0x4cb402,null))[_0xaa16('0x28')](respondWithResult(_0x4cb402,null))[_0xaa16('0x49')](handleError(_0x4cb402,null));};exports[_0xaa16('0x4e')]=function(_0xddb87,_0x162df2){return db[_0xaa16('0x32')][_0xaa16('0x4e')](_0xddb87[_0xaa16('0x4f')],{})[_0xaa16('0x28')](function(_0x68b8c6){var _0x22c5fd=_0xddb87[_0xaa16('0x50')][_0xaa16('0x29')]({'plain':!![]});if(!_0x22c5fd)throw new Error(_0xaa16('0x51'));if(_0x22c5fd[_0xaa16('0x52')]===_0xaa16('0x50')){var _0x1e2634=_0x68b8c6[_0xaa16('0x29')]({'plain':!![]});var _0x5ab7ec='Lists';return db[_0xaa16('0x53')][_0xaa16('0x4d')]({'where':{'name':_0x5ab7ec,'userProfileId':_0x22c5fd[_0xaa16('0x54')]},'raw':!![]})['then'](function(_0x35bcec){if(_0x35bcec&&_0x35bcec[_0xaa16('0x55')]===0x0){return db['UserProfileResource'][_0xaa16('0x4e')]({'name':_0x1e2634[_0xaa16('0x2e')],'resourceId':_0x1e2634['id'],'type':_0x35bcec[_0xaa16('0x2e')],'sectionId':_0x35bcec['id']},{})[_0xaa16('0x28')](function(){return _0x68b8c6;});}else{return _0x68b8c6;}})[_0xaa16('0x49')](function(_0x493ebc){logger[_0xaa16('0x2c')](_0xaa16('0x56'),_0x493ebc);throw _0x493ebc;});}return _0x68b8c6;})[_0xaa16('0x28')](respondWithResult(_0x162df2,0xc9))[_0xaa16('0x49')](handleError(_0x162df2,null));};exports['update']=function(_0x2c17a5,_0x4abc82){if(_0x2c17a5[_0xaa16('0x4f')]['id']){delete _0x2c17a5[_0xaa16('0x4f')]['id'];}return db['CmList'][_0xaa16('0x4d')]({'where':{'id':_0x2c17a5[_0xaa16('0x4b')]['id']}})[_0xaa16('0x28')](handleEntityNotFound(_0x4abc82,null))['then'](saveUpdates(_0x2c17a5['body'],null))['then'](respondWithResult(_0x4abc82,null))[_0xaa16('0x49')](handleError(_0x4abc82,null));};exports[_0xaa16('0x27')]=function(_0x14eb4f,_0x2cf46d){return db[_0xaa16('0x32')][_0xaa16('0x4d')]({'where':{'id':_0x14eb4f['params']['id']}})[_0xaa16('0x28')](handleEntityNotFound(_0x2cf46d,null))[_0xaa16('0x28')](removeEntity(_0x2cf46d,null))[_0xaa16('0x49')](handleError(_0x2cf46d,null));};exports[_0xaa16('0x57')]=function(_0x3dac2e,_0x364a06){return db['CmList'][_0xaa16('0x57')]()[_0xaa16('0x28')](respondWithResult(_0x364a06,null))[_0xaa16('0x49')](handleError(_0x364a06,null));};exports[_0xaa16('0x58')]=function(_0x40d21c,_0x440816,_0x3363f6){if(_0x40d21c['body']['id']){delete _0x40d21c['body']['id'];}return db[_0xaa16('0x32')][_0xaa16('0x4d')]({'where':{'id':_0x40d21c[_0xaa16('0x4b')]['id']}})[_0xaa16('0x28')](handleEntityNotFound(_0x440816,null))[_0xaa16('0x28')](function(_0x27b88a){if(_0x27b88a){_0x40d21c[_0xaa16('0x4f')][_0xaa16('0x59')]=_0x27b88a['id'];return db['Disposition']['create'](_0x40d21c[_0xaa16('0x4f')]);}})[_0xaa16('0x28')](respondWithResult(_0x440816,null))[_0xaa16('0x49')](handleError(_0x440816,null));};exports['getDispositions']=function(_0x55d88c,_0x1eb2f9,_0x510fe8){var _0x52720d={'raw':![],'where':{}};var _0x776de5={};var _0x3b9b5d={'count':0x0,'rows':[]};return db[_0xaa16('0x32')]['findOne']({'where':{'id':_0x55d88c[_0xaa16('0x4b')]['id']}})[_0xaa16('0x28')](handleEntityNotFound(_0x1eb2f9,null))[_0xaa16('0x28')](function(_0x426eab){if(_0x426eab){_0x776de5[_0xaa16('0x36')]=_['keys'](db[_0xaa16('0x5a')][_0xaa16('0x4c')]);_0x776de5[_0xaa16('0x39')]=_[_0xaa16('0x37')](_0x55d88c[_0xaa16('0x39')]);_0x776de5['filters']=_[_0xaa16('0x38')](_0x776de5[_0xaa16('0x36')],_0x776de5['query']);_0x52720d[_0xaa16('0x3a')]=_[_0xaa16('0x38')](_0x776de5[_0xaa16('0x36')],qs[_0xaa16('0x3b')](_0x55d88c[_0xaa16('0x39')][_0xaa16('0x3b')]));_0x52720d[_0xaa16('0x3a')]=_0x52720d[_0xaa16('0x3a')][_0xaa16('0x3c')]?_0x52720d['attributes']:_0x776de5[_0xaa16('0x36')];if(!_0x55d88c[_0xaa16('0x39')][_0xaa16('0x3d')]('nolimit')){_0x52720d['limit']=qs[_0xaa16('0x24')](_0x55d88c['query'][_0xaa16('0x24')]);_0x52720d[_0xaa16('0x23')]=qs[_0xaa16('0x23')](_0x55d88c[_0xaa16('0x39')][_0xaa16('0x23')]);}_0x52720d[_0xaa16('0x3e')]=qs[_0xaa16('0x3f')](_0x55d88c[_0xaa16('0x39')]['sort']);_0x52720d[_0xaa16('0x40')]=qs[_0xaa16('0x41')](_[_0xaa16('0x42')](_0x55d88c['query'],_0x776de5['filters']));_0x52720d[_0xaa16('0x40')]['ListId']=_0x426eab['id'];if(_0x55d88c['query'][_0xaa16('0x43')]){_0x52720d[_0xaa16('0x40')]=_[_0xaa16('0x44')](_0x52720d['where'],{'$or':_[_0xaa16('0x31')](_0x52720d[_0xaa16('0x3a')],function(_0x5f0c09){var _0x482243={};_0x482243[_0x5f0c09]={'$like':'%'+_0x55d88c[_0xaa16('0x39')][_0xaa16('0x43')]+'%'};return _0x482243;})});}_0x52720d=_[_0xaa16('0x44')]({},_0x52720d,_0x55d88c[_0xaa16('0x46')]);return db['Disposition'][_0xaa16('0x22')]({'where':_0x52720d[_0xaa16('0x40')]})[_0xaa16('0x28')](function(_0x265dd5){_0x3b9b5d[_0xaa16('0x22')]=_0x265dd5;if(_0x55d88c[_0xaa16('0x39')][_0xaa16('0x47')]){_0x52720d[_0xaa16('0x5b')]=[{'all':!![]}];}return db['Disposition'][_0xaa16('0x48')](_0x52720d);})[_0xaa16('0x28')](function(_0x55173e){_0x3b9b5d['rows']=_0x55173e;return _0x3b9b5d;});}})['then'](respondWithFilteredResult(_0x1eb2f9,_0x52720d))['catch'](handleError(_0x1eb2f9,null));};exports[_0xaa16('0x5c')]=function(_0xefd5c0,_0x2643d6,_0x2df884){return db['CmList'][_0xaa16('0x4d')]({'where':{'id':_0xefd5c0[_0xaa16('0x4b')]['id']}})[_0xaa16('0x28')](handleEntityNotFound(_0x2643d6,null))[_0xaa16('0x28')](function(_0x3ea6c8){if(_0x3ea6c8){return _0x3ea6c8[_0xaa16('0x5c')](_0xefd5c0[_0xaa16('0x39')]['ids']);}})[_0xaa16('0x28')](respondWithStatusCode(_0x2643d6,null))[_0xaa16('0x49')](handleError(_0x2643d6,null));};exports[_0xaa16('0x5d')]=function(_0x37335f,_0x491e92,_0x598b88){return db[_0xaa16('0x32')][_0xaa16('0x4d')]({'where':{'id':_0x37335f['params']['id']}})[_0xaa16('0x28')](handleEntityNotFound(_0x491e92,null))['then'](function(_0x2ce603){if(_0x2ce603){var _0x2767d1=[];var _0x4b85fc={'success':[],'errors':[]};return db['CmContact'][_0xaa16('0x57')]()['then'](function(_0x8ea94d){if(_0x37335f[_0xaa16('0x4f')]['tags']&&_[_0xaa16('0x5e')](_0x37335f[_0xaa16('0x4f')][_0xaa16('0x5f')])){if(_0x37335f[_0xaa16('0x4f')][_0xaa16('0x5f')]['length']){_0x37335f[_0xaa16('0x4f')]['tags']=_0x37335f[_0xaa16('0x4f')]['tags']['join'](';')+';';}else{_0x37335f['body'][_0xaa16('0x5f')]=null;}}else{_0x37335f[_0xaa16('0x4f')][_0xaa16('0x5f')]=null;}if(_0x37335f[_0xaa16('0x4f')]&&_[_0xaa16('0x5e')](_0x37335f[_0xaa16('0x4f')])){for(var _0x4fba5a=0x0;_0x4fba5a<_0x37335f[_0xaa16('0x4f')][_0xaa16('0x3c')];_0x4fba5a+=0x1){_0x37335f[_0xaa16('0x4f')][_0x4fba5a]['ListId']=_0x37335f[_0xaa16('0x4b')]['id'];_0x2767d1[_0xaa16('0x60')](_0x37335f['body'][_0x4fba5a]);}return BPromise[_0xaa16('0x61')](_0x2767d1,function(_0x287e3c){return db[_0xaa16('0x62')]['create'](_[_0xaa16('0x63')](_0x287e3c,[_0xaa16('0x64'),'id'])||{},{'fields':_[_0xaa16('0x37')](_0x8ea94d),'raw':!![]})[_0xaa16('0x28')](function(_0x5199d9){_0x4b85fc[_0xaa16('0x65')]['push'](_0x5199d9[_0xaa16('0x66')]);})[_0xaa16('0x49')](function(_0x1ddbf8){_0x4b85fc[_0xaa16('0x67')][_0xaa16('0x60')]({'data':_0x287e3c,'error':_0x1ddbf8[_0xaa16('0x68')]});});})[_0xaa16('0x28')](function(_0x4ce40d){return _0x4b85fc;})[_0xaa16('0x49')](function(_0x32746b){return _0x32746b;});}else{_0x491e92[_0xaa16('0x20')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0xaa16('0x28')](respondWithResult(_0x491e92,null))[_0xaa16('0x49')](handleError(_0x491e92,null));};exports[_0xaa16('0x69')]=function(_0x34eb18,_0x1fe328,_0x59915e){var _0x1b12b4;return db['CmList'][_0xaa16('0x4d')]({'where':{'id':_0x34eb18['params']['id']},'include':[{'model':db[_0xaa16('0x6a')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x1fe328,null))['then'](function(_0x38755c){if(_0x38755c){_0x1b12b4=_0x38755c;return db[_0xaa16('0x62')][_0xaa16('0x4c')];}})[_0xaa16('0x28')](function(_0x96701){if(_0x96701){var _0x296157={};var _0x1ac320={};_0x1ac320[_0xaa16('0x36')]=_[_0xaa16('0x6b')](_[_0xaa16('0x37')](_0x96701),_[_0xaa16('0x31')](_0x1b12b4[_0xaa16('0x6c')],function(_0x1cbfc1){return util[_0xaa16('0x6d')](_0xaa16('0x6e'),_0x1cbfc1['id']);}));_0x1ac320[_0xaa16('0x39')]=_[_0xaa16('0x37')](_0x34eb18['query']);_0x1ac320['filters']=_[_0xaa16('0x38')](_0x1ac320[_0xaa16('0x36')],_0x1ac320['query']);_0x296157[_0xaa16('0x3a')]=_[_0xaa16('0x38')](_0x1ac320[_0xaa16('0x36')],qs[_0xaa16('0x3b')](_0x34eb18['query'][_0xaa16('0x3b')]));_0x296157[_0xaa16('0x3a')]=_0x296157[_0xaa16('0x3a')][_0xaa16('0x3c')]?_0x296157[_0xaa16('0x3a')]:_0x1ac320['model'];if(!_0x34eb18[_0xaa16('0x39')][_0xaa16('0x3d')](_0xaa16('0x6f'))){_0x296157[_0xaa16('0x24')]=qs[_0xaa16('0x24')](_0x34eb18[_0xaa16('0x39')]['limit']);_0x296157[_0xaa16('0x23')]=qs[_0xaa16('0x23')](_0x34eb18[_0xaa16('0x39')][_0xaa16('0x23')]);}_0x296157['order']=qs[_0xaa16('0x3f')](_0x34eb18[_0xaa16('0x39')]['sort']);_0x296157['where']=qs[_0xaa16('0x41')](_[_0xaa16('0x42')](_0x34eb18[_0xaa16('0x39')],_0x1ac320[_0xaa16('0x41')]));_0x296157[_0xaa16('0x70')]=!![];if(_0x34eb18[_0xaa16('0x39')][_0xaa16('0x43')]){_0x296157[_0xaa16('0x40')]=_[_0xaa16('0x44')](_0x296157[_0xaa16('0x40')],{'$or':_[_0xaa16('0x31')](_0x296157['attributes'],function(_0x1005ce){var _0x9fe58d={};_0x9fe58d[_0x1005ce]={'$like':'%'+_0x34eb18['query'][_0xaa16('0x43')]+'%'};return _0x9fe58d;})});}_0x296157=_['merge']({},_0x296157,_0x34eb18[_0xaa16('0x46')]);return _0x1b12b4[_0xaa16('0x69')](_0x296157);}})[_0xaa16('0x28')](respondWithResult(_0x1fe328,null))[_0xaa16('0x49')](handleError(_0x1fe328,null));};exports[_0xaa16('0x71')]=function(_0xdfc9c9,_0x2b8254,_0x663b2a){var _0x288ac1;return db[_0xaa16('0x32')][_0xaa16('0x4d')]({'where':{'id':_0xdfc9c9[_0xaa16('0x4b')]['id']},'include':[{'model':db[_0xaa16('0x6a')],'as':'CustomFields'}]})[_0xaa16('0x28')](handleEntityNotFound(_0x2b8254,null))['then'](function(_0x558977){if(_0x558977){_0x288ac1=_0x558977;return db[_0xaa16('0x62')][_0xaa16('0x4c')];}})[_0xaa16('0x28')](function(_0x31e4da){if(_0x31e4da){var _0xc3b6cc={};var _0x1c443e={};_0x1c443e[_0xaa16('0x36')]=_[_0xaa16('0x6b')](_[_0xaa16('0x37')](_0x31e4da),_[_0xaa16('0x31')](_0x288ac1['CustomFields'],function(_0x1ce511){return util[_0xaa16('0x6d')]('cf_%d',_0x1ce511['id']);}));_0x1c443e['query']=_[_0xaa16('0x37')](_0xdfc9c9[_0xaa16('0x39')]);_0x1c443e[_0xaa16('0x41')]=_['intersection'](_0x1c443e[_0xaa16('0x36')],_0x1c443e[_0xaa16('0x39')]);_0xc3b6cc[_0xaa16('0x3a')]=_[_0xaa16('0x38')](_0x1c443e[_0xaa16('0x36')],qs[_0xaa16('0x3b')](_0xdfc9c9['query']['fields']));_0xc3b6cc[_0xaa16('0x3a')]=_0xc3b6cc[_0xaa16('0x3a')][_0xaa16('0x3c')]?_0xc3b6cc[_0xaa16('0x3a')]:_0x1c443e[_0xaa16('0x36')];if(!_0xdfc9c9[_0xaa16('0x39')][_0xaa16('0x3d')](_0xaa16('0x6f'))){_0xc3b6cc[_0xaa16('0x24')]=qs[_0xaa16('0x24')](_0xdfc9c9[_0xaa16('0x39')][_0xaa16('0x24')]);_0xc3b6cc[_0xaa16('0x23')]=qs[_0xaa16('0x23')](_0xdfc9c9[_0xaa16('0x39')][_0xaa16('0x23')]);}_0xc3b6cc['order']=qs[_0xaa16('0x3f')](_0xdfc9c9[_0xaa16('0x39')][_0xaa16('0x3f')]);_0xc3b6cc[_0xaa16('0x40')]=qs[_0xaa16('0x41')](_['pick'](_0xdfc9c9[_0xaa16('0x39')],_0x1c443e['filters']));_0xc3b6cc[_0xaa16('0x70')]=!![];if(_0xdfc9c9[_0xaa16('0x39')][_0xaa16('0x43')]){_0xc3b6cc[_0xaa16('0x40')]=_['merge'](_0xc3b6cc[_0xaa16('0x40')],{'$or':_[_0xaa16('0x31')](_0xc3b6cc['attributes'],function(_0x59b9ec){var _0x4f2374={};_0x4f2374[_0x59b9ec]={'$like':'%'+_0xdfc9c9[_0xaa16('0x39')][_0xaa16('0x43')]+'%'};return _0x4f2374;})});}_0xc3b6cc=_[_0xaa16('0x44')]({},_0xc3b6cc,_0xdfc9c9[_0xaa16('0x46')]);return _0x288ac1[_0xaa16('0x69')](_0xc3b6cc);}})[_0xaa16('0x28')](function(_0x2f7b00){if(!_[_0xaa16('0x72')](_0x2f7b00)){var _0x26b3ba=toCsv(_0x2f7b00);var _0x494515=Date['now']();fs[_0xaa16('0x73')](util[_0xaa16('0x6d')](_0xaa16('0x74'),_0x288ac1['id'],_0x494515),_0x26b3ba);_0x2b8254[_0xaa16('0x75')](_0xaa16('0x76'),_0xaa16('0x77')+util[_0xaa16('0x6d')](_0xaa16('0x78'),_0x288ac1['id'],_0x494515));_0x2b8254[_0xaa16('0x75')](_0xaa16('0x79'),_0xaa16('0x7a'));return _0x2b8254[_0xaa16('0x7b')](util[_0xaa16('0x6d')](_0xaa16('0x74'),_0x288ac1['id'],_0x494515));}else{return _0x2b8254[_0xaa16('0x1e')](0xcc);}})[_0xaa16('0x49')](handleError(_0x2b8254,null));};exports[_0xaa16('0x7c')]=function(_0x56e64d,_0x20b50a,_0x13fd56){var _0x239f43;delete _0x56e64d[_0xaa16('0x4f')]['id'];return db[_0xaa16('0x32')][_0xaa16('0x7d')]({'where':{'id':_0x56e64d[_0xaa16('0x4b')]['id']}})[_0xaa16('0x28')](handleEntityNotFound(_0x20b50a,null))['then'](function(_0x59bda5){if(_0x59bda5){return db[_0xaa16('0x7e')][_0xaa16('0x7f')](function(_0x1a9049){return db[_0xaa16('0x6a')][_0xaa16('0x4e')](_0x56e64d[_0xaa16('0x4f')],{'transaction':_0x1a9049})[_0xaa16('0x28')](function(_0x320eb1){_0x239f43=_0x320eb1;return _0x59bda5[_0xaa16('0x80')](_0x320eb1,{'transaction':_0x1a9049});})[_0xaa16('0x28')](function(){var _0x41b3b3={'type':db[_0xaa16('0x81')][_0xaa16('0x82')],'transaction':_0x1a9049};switch(_0x56e64d[_0xaa16('0x4f')][_0xaa16('0x34')]){case _0xaa16('0x83'):_0x41b3b3[_0xaa16('0x34')]=db[_0xaa16('0x81')][_0xaa16('0x82')];break;case _0xaa16('0x84'):_0x41b3b3[_0xaa16('0x34')]=db[_0xaa16('0x81')][_0xaa16('0x85')];break;case'switch':_0x41b3b3[_0xaa16('0x34')]=db[_0xaa16('0x81')][_0xaa16('0x86')];_0x41b3b3[_0xaa16('0x87')]=![];break;default:}return db[_0xaa16('0x7e')][_0xaa16('0x88')][_0xaa16('0x89')](_0xaa16('0x8a'),util['format']('cf_%s',_0x239f43['id']),_0x41b3b3);})['then'](function(){return _0x239f43;});});}})[_0xaa16('0x28')](respondWithResult(_0x20b50a,null))[_0xaa16('0x49')](handleError(_0x20b50a,null));};exports['getCustomFields']=function(_0x1fd3c3,_0x4b9582,_0x295956){var _0x524093={};var _0x5c18c6={};var _0xbfa1f9;var _0x39d432;return db[_0xaa16('0x32')][_0xaa16('0x7d')]({'where':{'id':_0x1fd3c3[_0xaa16('0x4b')]['id']}})[_0xaa16('0x28')](handleEntityNotFound(_0x4b9582,null))[_0xaa16('0x28')](function(_0x17579f){if(_0x17579f){_0xbfa1f9=_0x17579f;_0x5c18c6[_0xaa16('0x36')]=_['keys'](db[_0xaa16('0x6a')][_0xaa16('0x4c')]);_0x5c18c6['query']=_['keys'](_0x1fd3c3[_0xaa16('0x39')]);_0x5c18c6[_0xaa16('0x41')]=_[_0xaa16('0x38')](_0x5c18c6[_0xaa16('0x36')],_0x5c18c6[_0xaa16('0x39')]);_0x524093[_0xaa16('0x3a')]=_[_0xaa16('0x38')](_0x5c18c6[_0xaa16('0x36')],qs[_0xaa16('0x3b')](_0x1fd3c3['query'][_0xaa16('0x3b')]));_0x524093[_0xaa16('0x3a')]=_0x524093[_0xaa16('0x3a')][_0xaa16('0x3c')]?_0x524093[_0xaa16('0x3a')]:_0x5c18c6[_0xaa16('0x36')];_0x524093[_0xaa16('0x3e')]=qs[_0xaa16('0x3f')](_0x1fd3c3[_0xaa16('0x39')][_0xaa16('0x3f')]);_0x524093['where']=qs[_0xaa16('0x41')](_[_0xaa16('0x42')](_0x1fd3c3['query'],_0x5c18c6[_0xaa16('0x41')]));_0x524093[_0xaa16('0x40')]=_['merge'](_0x524093[_0xaa16('0x40')],{'$or':[{'ListId':_0x17579f['id']},{'ListId':null}]});if(_0x1fd3c3['query']['filter']){_0x524093[_0xaa16('0x40')]=_[_0xaa16('0x44')](_0x524093[_0xaa16('0x40')],{'$or':_[_0xaa16('0x31')](_0x524093[_0xaa16('0x3a')],function(_0x34e292){var _0x313aa9={};_0x313aa9[_0x34e292]={'$like':'%'+_0x1fd3c3[_0xaa16('0x39')][_0xaa16('0x43')]+'%'};return _0x313aa9;})});}_0x524093=_[_0xaa16('0x44')]({},_0x524093,_0x1fd3c3[_0xaa16('0x46')]);return db['CmCustomField']['findAndCountAll'](_0x524093);}})[_0xaa16('0x28')](respondWithResult(_0x4b9582,null))[_0xaa16('0x49')](handleError(_0x4b9582,null));};exports[_0xaa16('0x8b')]=function(_0x3b1826,_0x10feff,_0x4b8a96){return db['CmList']['find']({'where':{'id':_0x3b1826['params']['id']}})[_0xaa16('0x28')](handleEntityNotFound(_0x10feff,null))[_0xaa16('0x28')](function(_0x536e5c){if(_0x536e5c){return _0x536e5c[_0xaa16('0x8b')](_0x3b1826['body']['ids'],_['omit'](_0x3b1826[_0xaa16('0x4f')],[_0xaa16('0x64'),'id'])||{})['spread'](function(_0x5af2eb){for(var _0x1bbb69=0x0;_0x1bbb69<_0x3b1826[_0xaa16('0x4f')][_0xaa16('0x64')]['length'];_0x1bbb69+=0x1){socket['emit'](_0xaa16('0x8c'),{'UserId':_0x3b1826[_0xaa16('0x4f')][_0xaa16('0x64')][_0x1bbb69],'CmListId':_0x3b1826['params']['id']});}return _0x5af2eb;});}})[_0xaa16('0x28')](respondWithResult(_0x10feff,null))[_0xaa16('0x49')](handleError(_0x10feff,null));};exports['removeAgents']=function(_0x4d6d95,_0x225611,_0x15e7be){return db[_0xaa16('0x32')][_0xaa16('0x4d')]({'where':{'id':_0x4d6d95[_0xaa16('0x4b')]['id']}})[_0xaa16('0x28')](handleEntityNotFound(_0x225611,null))[_0xaa16('0x28')](function(_0x12449d){if(_0x12449d){return _0x12449d[_0xaa16('0x8d')](_0x4d6d95['query'][_0xaa16('0x64')])['then'](function(){if(_[_0xaa16('0x5e')](_0x4d6d95[_0xaa16('0x39')]['ids'])){for(var _0x50c2b1=0x0;_0x50c2b1<_0x4d6d95[_0xaa16('0x39')][_0xaa16('0x64')][_0xaa16('0x3c')];_0x50c2b1+=0x1){socket[_0xaa16('0x8e')](_0xaa16('0x8f'),{'UserId':Number(_0x4d6d95[_0xaa16('0x39')][_0xaa16('0x64')][_0x50c2b1]),'CmListId':Number(_0x4d6d95[_0xaa16('0x4b')]['id'])});}}else{socket[_0xaa16('0x8e')](_0xaa16('0x8f'),{'UserId':Number(_0x4d6d95[_0xaa16('0x39')][_0xaa16('0x64')]),'CmListId':Number(_0x4d6d95[_0xaa16('0x4b')]['id'])});}});}})[_0xaa16('0x28')](respondWithStatusCode(_0x225611,null))['catch'](handleError(_0x225611,null));};exports[_0xaa16('0x90')]=function(_0x2ba381,_0x5789f4,_0x5651d4){var _0x332dfd={};var _0x2dbcf7={};var _0x153e37;var _0x435fd3;return db[_0xaa16('0x32')]['findOne']({'where':{'id':_0x2ba381[_0xaa16('0x4b')]['id']}})[_0xaa16('0x28')](handleEntityNotFound(_0x5789f4,null))[_0xaa16('0x28')](function(_0x5d9b37){if(_0x5d9b37){_0x153e37=_0x5d9b37;_0x2dbcf7[_0xaa16('0x36')]=_[_0xaa16('0x37')](db[_0xaa16('0x91')][_0xaa16('0x4c')]);_0x2dbcf7['query']=_['keys'](_0x2ba381[_0xaa16('0x39')]);_0x2dbcf7[_0xaa16('0x41')]=_[_0xaa16('0x38')](_0x2dbcf7[_0xaa16('0x36')],_0x2dbcf7['query']);_0x332dfd[_0xaa16('0x3a')]=_[_0xaa16('0x38')](_0x2dbcf7[_0xaa16('0x36')],qs[_0xaa16('0x3b')](_0x2ba381['query']['fields']));_0x332dfd[_0xaa16('0x3a')]=_0x332dfd[_0xaa16('0x3a')][_0xaa16('0x3c')]?_0x332dfd[_0xaa16('0x3a')]:_0x2dbcf7[_0xaa16('0x36')];_0x332dfd[_0xaa16('0x3e')]=qs[_0xaa16('0x3f')](_0x2ba381[_0xaa16('0x39')]['sort']);_0x332dfd[_0xaa16('0x40')]=qs[_0xaa16('0x41')](_['pick'](_0x2ba381[_0xaa16('0x39')],_0x2dbcf7[_0xaa16('0x41')]));if(_0x2ba381['query'][_0xaa16('0x43')]){_0x332dfd['where']=_['merge'](_0x332dfd[_0xaa16('0x40')],{'$or':_[_0xaa16('0x31')](_0x332dfd[_0xaa16('0x3a')],function(_0x54b56a){var _0x4b5f37={};_0x4b5f37[_0x54b56a]={'$like':'%'+_0x2ba381[_0xaa16('0x39')]['filter']+'%'};return _0x4b5f37;})});}_0x332dfd=_[_0xaa16('0x44')]({},_0x332dfd,_0x2ba381[_0xaa16('0x46')]);return _0x153e37[_0xaa16('0x90')](_0x332dfd);}})[_0xaa16('0x28')](function(_0x7e22d0){if(_0x7e22d0){_0x435fd3=_0x7e22d0[_0xaa16('0x3c')];if(!_0x2ba381[_0xaa16('0x39')][_0xaa16('0x3d')](_0xaa16('0x6f'))){_0x332dfd[_0xaa16('0x24')]=qs['limit'](_0x2ba381[_0xaa16('0x39')][_0xaa16('0x24')]);_0x332dfd[_0xaa16('0x23')]=qs[_0xaa16('0x23')](_0x2ba381[_0xaa16('0x39')][_0xaa16('0x23')]);}return _0x153e37['getAgents'](_0x332dfd);}})[_0xaa16('0x28')](function(_0x4af0cf){if(_0x4af0cf){return _0x4af0cf?{'count':_0x435fd3,'rows':_0x4af0cf}:null;}})[_0xaa16('0x28')](respondWithResult(_0x5789f4,null))['catch'](handleError(_0x5789f4,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 690d361..aa0c707 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 _0x3454=['exports','events','../../mysqldb','CmList','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5dc4d8,_0x16e8f6){var _0x47eb30=function(_0xe13ba2){while(--_0xe13ba2){_0x5dc4d8['push'](_0x5dc4d8['shift']());}};_0x47eb30(++_0x16e8f6);}(_0x3454,0x90));var _0x4345=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3454[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x4345('0x0'));var CmList=require(_0x4345('0x1'))['db'][_0x4345('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x4345('0x3')](0x0);var events={'afterCreate':_0x4345('0x4'),'afterUpdate':_0x4345('0x5'),'afterDestroy':_0x4345('0x6')};function emitEvent(_0x4394bb){return function(_0x257dea,_0x4b0f10,_0x13cd87){CmListEvents[_0x4345('0x7')](_0x4394bb+':'+_0x257dea['id'],_0x257dea);CmListEvents['emit'](_0x4394bb,_0x257dea);_0x13cd87(null);};}for(var e in events){if(events[_0x4345('0x8')](e)){var event=events[e];CmList[_0x4345('0x9')](e,emitEvent(event));}}module[_0x4345('0xa')]=CmListEvents; \ No newline at end of file +var _0xe9b5=['remove','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save','update'];(function(_0xb754c0,_0x35c35e){var _0x16807f=function(_0x45b318){while(--_0x45b318){_0xb754c0['push'](_0xb754c0['shift']());}};_0x16807f(++_0x35c35e);}(_0xe9b5,0x16c));var _0x5e9b=function(_0x351870,_0x349ac7){_0x351870=_0x351870-0x0;var _0x5c3200=_0xe9b5[_0x351870];return _0x5c3200;};'use strict';var EventEmitter=require(_0x5e9b('0x0'));var CmList=require(_0x5e9b('0x1'))['db'][_0x5e9b('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x5e9b('0x3')](0x0);var events={'afterCreate':_0x5e9b('0x4'),'afterUpdate':_0x5e9b('0x5'),'afterDestroy':_0x5e9b('0x6')};function emitEvent(_0x1f92e6){return function(_0x2954ea,_0x5b2b88,_0x9ef9bb){CmListEvents[_0x5e9b('0x7')](_0x1f92e6+':'+_0x2954ea['id'],_0x2954ea);CmListEvents[_0x5e9b('0x7')](_0x1f92e6,_0x2954ea);_0x9ef9bb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x5e9b('0x8')](e,emitEvent(event));}}module[_0x5e9b('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 7e69569..40378de 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 _0xab8b=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','cm_lists','lodash','util','api'];(function(_0x3337b6,_0x42c7f9){var _0x568270=function(_0x56e5df){while(--_0x56e5df){_0x3337b6['push'](_0x3337b6['shift']());}};_0x568270(++_0x42c7f9);}(_0xab8b,0x81));var _0xbab8=function(_0x578e3e,_0x4d39ce){_0x578e3e=_0x578e3e-0x0;var _0x14c37c=_0xab8b[_0x578e3e];return _0x14c37c;};'use strict';var _=require(_0xbab8('0x0'));var util=require(_0xbab8('0x1'));var logger=require('../../config/logger')(_0xbab8('0x2'));var moment=require(_0xbab8('0x3'));var BPromise=require(_0xbab8('0x4'));var rp=require(_0xbab8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbab8('0x6'));var config=require(_0xbab8('0x7'));var attributes=require(_0xbab8('0x8'));module[_0xbab8('0x9')]=function(_0x5c2468,_0x31453b){return _0x5c2468[_0xbab8('0xa')]('CmList',attributes,{'tableName':_0xbab8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc633=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','CmList','cm_lists','lodash','../../config/logger'];(function(_0x5bfb8a,_0x1079ca){var _0x23c3c4=function(_0x3cf2a7){while(--_0x3cf2a7){_0x5bfb8a['push'](_0x5bfb8a['shift']());}};_0x23c3c4(++_0x1079ca);}(_0xc633,0x8d));var _0x3c63=function(_0x40303e,_0x3a7282){_0x40303e=_0x40303e-0x0;var _0x127f6d=_0xc633[_0x40303e];return _0x127f6d;};'use strict';var _=require(_0x3c63('0x0'));var util=require('util');var logger=require(_0x3c63('0x1'))(_0x3c63('0x2'));var moment=require(_0x3c63('0x3'));var BPromise=require(_0x3c63('0x4'));var rp=require(_0x3c63('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c63('0x6'));var config=require(_0x3c63('0x7'));var attributes=require('./cmList.attributes');module[_0x3c63('0x8')]=function(_0x551b5e,_0x42f71f){return _0x551b5e['define'](_0x3c63('0x9'),attributes,{'tableName':_0x3c63('0xa'),'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 045c3fa..ed43405 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 _0x043b=['../../config/environment','redis','defaults','localhost','socket.io-emitter','./cmList.socket','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x043b,0xa0));var _0xb043=function(_0x9bb4a3,_0x24e6cc){_0x9bb4a3=_0x9bb4a3-0x0;var _0x4ed4c3=_0x043b[_0x9bb4a3];return _0x4ed4c3;};'use strict';var _=require(_0xb043('0x0'));var util=require(_0xb043('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb043('0x2'));var fs=require('fs');var Redis=require(_0xb043('0x3'));var db=require(_0xb043('0x4'))['db'];var utils=require(_0xb043('0x5'));var logger=require(_0xb043('0x6'))(_0xb043('0x7'));var config=require(_0xb043('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xb043('0x9')]=_[_0xb043('0xa')](config['redis'],{'host':_0xb043('0xb'),'port':0x18eb});var socket=require(_0xb043('0xc'))(new Redis(config[_0xb043('0x9')]));require(_0xb043('0xd'))['register'](socket);function respondWithRpcPromise(_0x466849,_0x52c9b0,_0x34647e){return new BPromise(function(_0x405f9d,_0x4daa89){return client['request'](_0x466849,_0x34647e)[_0xb043('0xe')](function(_0x963ed4){logger[_0xb043('0xf')](_0xb043('0x10'),_0x52c9b0,_0xb043('0x11'));logger[_0xb043('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x52c9b0,_0xb043('0x11'),JSON[_0xb043('0x13')](_0x963ed4));if(_0x963ed4['error']){if(_0x963ed4[_0xb043('0x14')][_0xb043('0x15')]===0x1f4){logger[_0xb043('0x14')](_0xb043('0x10'),_0x52c9b0,_0x963ed4[_0xb043('0x14')][_0xb043('0x16')]);return _0x4daa89(_0x963ed4['error'][_0xb043('0x16')]);}logger[_0xb043('0x14')](_0xb043('0x10'),_0x52c9b0,_0x963ed4['error'][_0xb043('0x16')]);return _0x405f9d(_0x963ed4[_0xb043('0x14')][_0xb043('0x16')]);}else{logger[_0xb043('0xf')](_0xb043('0x10'),_0x52c9b0,_0xb043('0x11'));_0x405f9d(_0x963ed4[_0xb043('0x17')][_0xb043('0x16')]);}})['catch'](function(_0xc24240){logger[_0xb043('0x14')]('CmList,\x20%s,\x20%s',_0x52c9b0,_0xc24240);_0x4daa89(_0xc24240);});});} \ No newline at end of file +var _0x097f=['redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults'];(function(_0x384af5,_0x5bb2af){var _0x2ae352=function(_0x3eae9d){while(--_0x3eae9d){_0x384af5['push'](_0x384af5['shift']());}};_0x2ae352(++_0x5bb2af);}(_0x097f,0x189));var _0xf097=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0x097f[_0x55969b];return _0x3d7fc1;};'use strict';var _=require(_0xf097('0x0'));var util=require('util');var moment=require(_0xf097('0x1'));var BPromise=require(_0xf097('0x2'));var rs=require(_0xf097('0x3'));var fs=require('fs');var Redis=require(_0xf097('0x4'));var db=require(_0xf097('0x5'))['db'];var utils=require(_0xf097('0x6'));var logger=require(_0xf097('0x7'))(_0xf097('0x8'));var config=require(_0xf097('0x9'));var jayson=require(_0xf097('0xa'));var client=jayson['client'][_0xf097('0xb')]({'port':0x232a});config['redis']=_[_0xf097('0xc')](config[_0xf097('0xd')],{'host':_0xf097('0xe'),'port':0x18eb});var socket=require(_0xf097('0xf'))(new Redis(config[_0xf097('0xd')]));require(_0xf097('0x10'))[_0xf097('0x11')](socket);function respondWithRpcPromise(_0x50b5d6,_0x30a2dd,_0x14e1bd){return new BPromise(function(_0x2a8a05,_0x23652b){return client[_0xf097('0x12')](_0x50b5d6,_0x14e1bd)[_0xf097('0x13')](function(_0x55eeea){logger['info'](_0xf097('0x14'),_0x30a2dd,'request\x20sent');logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x30a2dd,_0xf097('0x15'),JSON[_0xf097('0x16')](_0x55eeea));if(_0x55eeea[_0xf097('0x17')]){if(_0x55eeea[_0xf097('0x17')][_0xf097('0x18')]===0x1f4){logger[_0xf097('0x17')](_0xf097('0x14'),_0x30a2dd,_0x55eeea[_0xf097('0x17')][_0xf097('0x19')]);return _0x23652b(_0x55eeea['error']['message']);}logger[_0xf097('0x17')](_0xf097('0x14'),_0x30a2dd,_0x55eeea[_0xf097('0x17')][_0xf097('0x19')]);return _0x2a8a05(_0x55eeea[_0xf097('0x17')][_0xf097('0x19')]);}else{logger[_0xf097('0x1a')](_0xf097('0x14'),_0x30a2dd,_0xf097('0x15'));_0x2a8a05(_0x55eeea[_0xf097('0x1b')][_0xf097('0x19')]);}})[_0xf097('0x1c')](function(_0x4afd32){logger[_0xf097('0x17')](_0xf097('0x14'),_0x30a2dd,_0x4afd32);_0x23652b(_0x4afd32);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 2d804c0..31ce993 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 _0x280b=['update','emit','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x280b,0xce));var _0xb280=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x280b[_0x19e35c];return _0x3e1fe8;};'use strict';var CmListEvents=require(_0xb280('0x0'));var events=[_0xb280('0x1'),'remove',_0xb280('0x2')];function createListener(_0x3c4f59,_0x444d16){return function(_0x3a59e1){_0x444d16[_0xb280('0x3')](_0x3c4f59,_0x3a59e1);};}function removeListener(_0x69abb,_0x2fa322){return function(){CmListEvents[_0xb280('0x4')](_0x69abb,_0x2fa322);};}exports[_0xb280('0x5')]=function(_0x5d1991){for(var _0x4d1b2e=0x0,_0x43e0ee=events[_0xb280('0x6')];_0x4d1b2e<_0x43e0ee;_0x4d1b2e++){var _0x5c98b9=events[_0x4d1b2e];var _0x12433f=createListener(_0xb280('0x7')+_0x5c98b9,_0x5d1991);CmListEvents['on'](_0x5c98b9,_0x12433f);}}; \ No newline at end of file +var _0x0dd6=['removeListener','cmList:','remove','update','emit'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x0dd6,0xca));var _0x60dd=function(_0x57e5fa,_0x579542){_0x57e5fa=_0x57e5fa-0x0;var _0x4d8b97=_0x0dd6[_0x57e5fa];return _0x4d8b97;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0x60dd('0x0'),_0x60dd('0x1')];function createListener(_0x292e8,_0x200bcf){return function(_0x1cf933){_0x200bcf[_0x60dd('0x2')](_0x292e8,_0x1cf933);};}function removeListener(_0x8fc15c,_0x684bfa){return function(){CmListEvents[_0x60dd('0x3')](_0x8fc15c,_0x684bfa);};}exports['register']=function(_0x1c8c4e){for(var _0x4875cb=0x0,_0x87ab7=events['length'];_0x4875cb<_0x87ab7;_0x4875cb++){var _0x30543f=events[_0x4875cb];var _0x407a6c=createListener(_0x60dd('0x4')+_0x30543f,_0x1c8c4e);CmListEvents['on'](_0x30543f,_0x407a6c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 76e6332..bb0c7cb 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 _0x7f4f=['show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','addDisposition','addContacts','addCustomField','addAgents','update','delete','destroy','removeDispositions','removeAgents','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','/describe','isAuthenticated','/:id'];(function(_0x220cbd,_0x2689bd){var _0x2b94b5=function(_0x4a5904){while(--_0x4a5904){_0x220cbd['push'](_0x220cbd['shift']());}};_0x2b94b5(++_0x2689bd);}(_0x7f4f,0x1c6));var _0xf7f4=function(_0x28e98c,_0x44342b){_0x28e98c=_0x28e98c-0x0;var _0x5af17b=_0x7f4f[_0x28e98c];return _0x5af17b;};'use strict';var multer=require(_0xf7f4('0x0'));var util=require(_0xf7f4('0x1'));var path=require('path');var timeout=require(_0xf7f4('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf7f4('0x3'));var interaction=require(_0xf7f4('0x4'));var config=require(_0xf7f4('0x5'));var controller=require(_0xf7f4('0x6'));router[_0xf7f4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf7f4('0x7')](_0xf7f4('0x8'),auth[_0xf7f4('0x9')](),controller['describe']);router[_0xf7f4('0x7')](_0xf7f4('0xa'),auth[_0xf7f4('0x9')](),controller[_0xf7f4('0xb')]);router[_0xf7f4('0x7')](_0xf7f4('0xc'),auth[_0xf7f4('0x9')](),controller[_0xf7f4('0xd')]);router[_0xf7f4('0x7')]('/:id/contacts',auth[_0xf7f4('0x9')](),controller[_0xf7f4('0xe')]);router['get'](_0xf7f4('0xf'),auth[_0xf7f4('0x9')](),controller[_0xf7f4('0x10')]);router[_0xf7f4('0x7')](_0xf7f4('0x11'),auth['isAuthenticated'](),controller[_0xf7f4('0x12')]);router[_0xf7f4('0x7')](_0xf7f4('0x13'),auth[_0xf7f4('0x9')](),controller[_0xf7f4('0x14')]);router['post']('/',auth[_0xf7f4('0x9')](),controller['create']);router[_0xf7f4('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf7f4('0x16')]);router['post']('/:id/contacts',auth[_0xf7f4('0x9')](),controller[_0xf7f4('0x17')]);router[_0xf7f4('0x15')]('/:id/fields',auth[_0xf7f4('0x9')](),controller[_0xf7f4('0x18')]);router[_0xf7f4('0x15')](_0xf7f4('0x13'),auth[_0xf7f4('0x9')](),controller[_0xf7f4('0x19')]);router['put']('/:id',auth[_0xf7f4('0x9')](),controller[_0xf7f4('0x1a')]);router[_0xf7f4('0x1b')](_0xf7f4('0xa'),auth[_0xf7f4('0x9')](),controller[_0xf7f4('0x1c')]);router[_0xf7f4('0x1b')]('/:id/dispositions',auth[_0xf7f4('0x9')](),controller[_0xf7f4('0x1d')]);router[_0xf7f4('0x1b')]('/:id/users',auth[_0xf7f4('0x9')](),controller[_0xf7f4('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xc820=['getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addAgents','put','/:id','update','delete','removeDispositions','exports','util','path','express','Router','../../components/auth/service','../../config/environment','index','get','/describe','describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv'];(function(_0x5d642e,_0x588c40){var _0x1b11d2=function(_0x39d9fe){while(--_0x39d9fe){_0x5d642e['push'](_0x5d642e['shift']());}};_0x1b11d2(++_0x588c40);}(_0xc820,0xaf));var _0x0c82=function(_0x5cec50,_0x3b834b){_0x5cec50=_0x5cec50-0x0;var _0x2fce66=_0xc820[_0x5cec50];return _0x2fce66;};'use strict';var multer=require('multer');var util=require(_0x0c82('0x0'));var path=require(_0x0c82('0x1'));var timeout=require('connect-timeout');var express=require(_0x0c82('0x2'));var router=express[_0x0c82('0x3')]();var auth=require(_0x0c82('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c82('0x5'));var controller=require('./cmList.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0c82('0x6')]);router[_0x0c82('0x7')](_0x0c82('0x8'),auth['isAuthenticated'](),controller[_0x0c82('0x9')]);router[_0x0c82('0x7')]('/:id',auth[_0x0c82('0xa')](),controller[_0x0c82('0xb')]);router['get'](_0x0c82('0xc'),auth[_0x0c82('0xa')](),controller[_0x0c82('0xd')]);router[_0x0c82('0x7')](_0x0c82('0xe'),auth['isAuthenticated'](),controller[_0x0c82('0xf')]);router[_0x0c82('0x7')](_0x0c82('0x10'),auth[_0x0c82('0xa')](),controller[_0x0c82('0x11')]);router[_0x0c82('0x7')](_0x0c82('0x12'),auth[_0x0c82('0xa')](),controller[_0x0c82('0x13')]);router[_0x0c82('0x7')](_0x0c82('0x14'),auth[_0x0c82('0xa')](),controller[_0x0c82('0x15')]);router[_0x0c82('0x16')]('/',auth[_0x0c82('0xa')](),controller[_0x0c82('0x17')]);router[_0x0c82('0x16')](_0x0c82('0xc'),auth['isAuthenticated'](),controller[_0x0c82('0x18')]);router[_0x0c82('0x16')]('/:id/contacts',auth[_0x0c82('0xa')](),controller['addContacts']);router['post'](_0x0c82('0x12'),auth[_0x0c82('0xa')](),controller['addCustomField']);router[_0x0c82('0x16')](_0x0c82('0x14'),auth[_0x0c82('0xa')](),controller[_0x0c82('0x19')]);router[_0x0c82('0x1a')](_0x0c82('0x1b'),auth['isAuthenticated'](),controller[_0x0c82('0x1c')]);router[_0x0c82('0x1d')](_0x0c82('0x1b'),auth[_0x0c82('0xa')](),controller['destroy']);router[_0x0c82('0x1d')](_0x0c82('0xc'),auth[_0x0c82('0xa')](),controller[_0x0c82('0x1e')]);router[_0x0c82('0x1d')](_0x0c82('0x14'),auth[_0x0c82('0xa')](),controller['removeAgents']);module[_0x0c82('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 2c08048..c6cb089 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x1ea124,_0x2244b3){var _0x480f33=function(_0x287ef2){while(--_0x287ef2){_0x1ea124['push'](_0x1ea124['shift']());}};_0x480f33(++_0x2244b3);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x5a48f9,_0x3acef4){var _0x226006=function(_0x158059){while(--_0x158059){_0x5a48f9['push'](_0x5a48f9['shift']());}};_0x226006(++_0x3acef4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index c68f7e5..1b14699 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 _0x4b20=['params','Condition','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','update','body','find'];(function(_0x5811f6,_0x5bb649){var _0x5346ef=function(_0x38709d){while(--_0x38709d){_0x5811f6['push'](_0x5811f6['shift']());}};_0x5346ef(++_0x5bb649);}(_0x4b20,0x116));var _0x04b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b20[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x04b2('0x0'));var emlformat=require(_0x04b2('0x1'));var rimraf=require(_0x04b2('0x2'));var zipdir=require(_0x04b2('0x3'));var jsonpatch=require(_0x04b2('0x4'));var rp=require(_0x04b2('0x5'));var moment=require(_0x04b2('0x6'));var BPromise=require(_0x04b2('0x7'));var Mustache=require(_0x04b2('0x8'));var util=require(_0x04b2('0x9'));var path=require(_0x04b2('0xa'));var sox=require('sox');var csv=require(_0x04b2('0xb'));var ejs=require(_0x04b2('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x04b2('0xd'));var crypto=require(_0x04b2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x04b2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x04b2('0x10'));var Papa=require('papaparse');var Redis=require(_0x04b2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x04b2('0x12'));var as=require(_0x04b2('0x13'));var hardwareService=require(_0x04b2('0x14'));var logger=require(_0x04b2('0x15'))(_0x04b2('0x16'));var utils=require('../../config/utils');var config=require(_0x04b2('0x17'));var db=require(_0x04b2('0x18'))['db'];function respondWithStatusCode(_0x5f14bf,_0xdeb966){_0xdeb966=_0xdeb966||0xcc;return function(_0x4f2fdc){if(_0x4f2fdc){return _0x5f14bf[_0x04b2('0x19')](_0xdeb966);}return _0x5f14bf[_0x04b2('0x1a')](_0xdeb966)[_0x04b2('0x1b')]();};}function respondWithResult(_0x2b55cc,_0x5bb357){_0x5bb357=_0x5bb357||0xc8;return function(_0x35d8fc){if(_0x35d8fc){return _0x2b55cc[_0x04b2('0x1a')](_0x5bb357)['json'](_0x35d8fc);}};}function respondWithFilteredResult(_0xf23959,_0x40c3a4){return function(_0x181c2d){if(_0x181c2d){var _0x49c773=_0x181c2d[_0x04b2('0x1c')],_0xfdda48=_0x40c3a4[_0x04b2('0x1d')],_0x218557=_0x40c3a4[_0x04b2('0x1d')]+_0x40c3a4['limit'],_0x43547a;if(_0x218557>=_0x49c773){_0x218557=_0x49c773;_0x43547a=0xc8;}else{_0x43547a=0xce;}_0xf23959['status'](_0x43547a);return _0xf23959[_0x04b2('0x1e')](_0x04b2('0x1f'),_0xfdda48+'-'+_0x218557+'/'+_0x49c773)[_0x04b2('0x20')](_0x181c2d);}return null;};}function patchUpdates(_0x41526b){return function(_0x24e5ff){try{jsonpatch[_0x04b2('0x21')](_0x24e5ff,_0x41526b,!![]);}catch(_0x1f6d1c){return BPromise[_0x04b2('0x22')](_0x1f6d1c);}return _0x24e5ff[_0x04b2('0x23')]();};}function saveUpdates(_0x16a042,_0x37fdc6){return function(_0x282bf2){if(_0x282bf2){return _0x282bf2['update'](_0x16a042)[_0x04b2('0x24')](function(_0x199656){return _0x199656;});}return null;};}function removeEntity(_0x462e77,_0xbe584a){return function(_0x288e06){if(_0x288e06){return _0x288e06[_0x04b2('0x25')]()[_0x04b2('0x24')](function(){_0x462e77['status'](0xcc)[_0x04b2('0x1b')]();});}};}function handleEntityNotFound(_0x4eb4e3,_0x1432b8){return function(_0x2374b7){if(!_0x2374b7){_0x4eb4e3[_0x04b2('0x19')](0x194);}return _0x2374b7;};}function handleError(_0x5f15d3,_0x19d38c){_0x19d38c=_0x19d38c||0x1f4;return function(_0xa3dd24){logger['error'](_0xa3dd24[_0x04b2('0x26')]);if(_0xa3dd24[_0x04b2('0x27')]){delete _0xa3dd24[_0x04b2('0x27')];}_0x5f15d3[_0x04b2('0x1a')](_0x19d38c)[_0x04b2('0x28')](_0xa3dd24);};}exports[_0x04b2('0x29')]=function(_0x4a6f7e,_0x3433ce){if(_0x4a6f7e[_0x04b2('0x2a')]['id']){delete _0x4a6f7e[_0x04b2('0x2a')]['id'];}return db['Condition'][_0x04b2('0x2b')]({'where':{'id':_0x4a6f7e[_0x04b2('0x2c')]['id']}})[_0x04b2('0x24')](handleEntityNotFound(_0x3433ce,null))[_0x04b2('0x24')](saveUpdates(_0x4a6f7e[_0x04b2('0x2a')],null))[_0x04b2('0x24')](respondWithResult(_0x3433ce,null))['catch'](handleError(_0x3433ce,null));};exports['destroy']=function(_0x49ef0d,_0x5228bf){return db[_0x04b2('0x2d')][_0x04b2('0x2b')]({'where':{'id':_0x49ef0d[_0x04b2('0x2c')]['id']}})[_0x04b2('0x24')](handleEntityNotFound(_0x5228bf,null))[_0x04b2('0x24')](removeEntity(_0x5228bf,null))['catch'](handleError(_0x5228bf,null));}; \ No newline at end of file +var _0x5e25=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','status','end','stack','name','send','body','Condition','params','catch','find','html-pdf','eml-format','zip-dir','fast-json-patch','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x5e25,0x1c5));var _0x55e2=function(_0x1ed20f,_0x410f2f){_0x1ed20f=_0x1ed20f-0x0;var _0x162a07=_0x5e25[_0x1ed20f];return _0x162a07;};'use strict';var pdf=require(_0x55e2('0x0'));var emlformat=require(_0x55e2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x55e2('0x2'));var jsonpatch=require(_0x55e2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x55e2('0x4'));var util=require('util');var path=require(_0x55e2('0x5'));var sox=require(_0x55e2('0x6'));var csv=require('to-csv');var ejs=require(_0x55e2('0x7'));var fs=require('fs');var _=require(_0x55e2('0x8'));var squel=require(_0x55e2('0x9'));var crypto=require(_0x55e2('0xa'));var jsforce=require(_0x55e2('0xb'));var deskjs=require(_0x55e2('0xc'));var toCsv=require(_0x55e2('0xd'));var querystring=require(_0x55e2('0xe'));var Papa=require(_0x55e2('0xf'));var Redis=require(_0x55e2('0x10'));var authService=require(_0x55e2('0x11'));var qs=require(_0x55e2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x55e2('0x13'));var logger=require('../../config/logger')(_0x55e2('0x14'));var utils=require(_0x55e2('0x15'));var config=require(_0x55e2('0x16'));var db=require(_0x55e2('0x17'))['db'];function respondWithStatusCode(_0x2706c8,_0x2a997a){_0x2a997a=_0x2a997a||0xcc;return function(_0x12f444){if(_0x12f444){return _0x2706c8[_0x55e2('0x18')](_0x2a997a);}return _0x2706c8['status'](_0x2a997a)['end']();};}function respondWithResult(_0xff43f5,_0x224607){_0x224607=_0x224607||0xc8;return function(_0x127062){if(_0x127062){return _0xff43f5['status'](_0x224607)['json'](_0x127062);}};}function respondWithFilteredResult(_0x2da39d,_0x4f8c51){return function(_0x2010c8){if(_0x2010c8){var _0x4739c5=_0x2010c8[_0x55e2('0x19')],_0x3104e1=_0x4f8c51[_0x55e2('0x1a')],_0x9411aa=_0x4f8c51[_0x55e2('0x1a')]+_0x4f8c51[_0x55e2('0x1b')],_0x28ccce;if(_0x9411aa>=_0x4739c5){_0x9411aa=_0x4739c5;_0x28ccce=0xc8;}else{_0x28ccce=0xce;}_0x2da39d['status'](_0x28ccce);return _0x2da39d[_0x55e2('0x1c')](_0x55e2('0x1d'),_0x3104e1+'-'+_0x9411aa+'/'+_0x4739c5)[_0x55e2('0x1e')](_0x2010c8);}return null;};}function patchUpdates(_0x16b7d3){return function(_0x5eb1aa){try{jsonpatch[_0x55e2('0x1f')](_0x5eb1aa,_0x16b7d3,!![]);}catch(_0x228248){return BPromise[_0x55e2('0x20')](_0x228248);}return _0x5eb1aa[_0x55e2('0x21')]();};}function saveUpdates(_0x3e847d,_0x504329){return function(_0x45bc92){if(_0x45bc92){return _0x45bc92[_0x55e2('0x22')](_0x3e847d)[_0x55e2('0x23')](function(_0x5ef6a1){return _0x5ef6a1;});}return null;};}function removeEntity(_0x3f2423,_0x191161){return function(_0x4a05db){if(_0x4a05db){return _0x4a05db[_0x55e2('0x24')]()['then'](function(){_0x3f2423[_0x55e2('0x25')](0xcc)[_0x55e2('0x26')]();});}};}function handleEntityNotFound(_0x378251,_0x3155ed){return function(_0x292029){if(!_0x292029){_0x378251['sendStatus'](0x194);}return _0x292029;};}function handleError(_0x40060a,_0x1bcdf3){_0x1bcdf3=_0x1bcdf3||0x1f4;return function(_0x197a00){logger['error'](_0x197a00[_0x55e2('0x27')]);if(_0x197a00[_0x55e2('0x28')]){delete _0x197a00['name'];}_0x40060a[_0x55e2('0x25')](_0x1bcdf3)[_0x55e2('0x29')](_0x197a00);};}exports[_0x55e2('0x22')]=function(_0x4678fe,_0x236bbd){if(_0x4678fe[_0x55e2('0x2a')]['id']){delete _0x4678fe[_0x55e2('0x2a')]['id'];}return db[_0x55e2('0x2b')]['find']({'where':{'id':_0x4678fe[_0x55e2('0x2c')]['id']}})[_0x55e2('0x23')](handleEntityNotFound(_0x236bbd,null))['then'](saveUpdates(_0x4678fe[_0x55e2('0x2a')],null))[_0x55e2('0x23')](respondWithResult(_0x236bbd,null))[_0x55e2('0x2d')](handleError(_0x236bbd,null));};exports['destroy']=function(_0x218232,_0x2505f9){return db[_0x55e2('0x2b')][_0x55e2('0x2e')]({'where':{'id':_0x218232[_0x55e2('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2505f9,null))[_0x55e2('0x23')](removeEntity(_0x2505f9,null))[_0x55e2('0x2d')](handleError(_0x2505f9,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 902ff13..f531e81 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 _0x12d4=['../../config/environment','exports','define','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5280f4,_0x3c36d0){var _0xba93e7=function(_0x14d63a){while(--_0x14d63a){_0x5280f4['push'](_0x5280f4['shift']());}};_0xba93e7(++_0x3c36d0);}(_0x12d4,0x156));var _0x412d=function(_0x51a6d6,_0x3c9c49){_0x51a6d6=_0x51a6d6-0x0;var _0x5ef1a8=_0x12d4[_0x51a6d6];return _0x5ef1a8;};'use strict';var _=require(_0x412d('0x0'));var util=require(_0x412d('0x1'));var logger=require(_0x412d('0x2'))(_0x412d('0x3'));var moment=require(_0x412d('0x4'));var BPromise=require(_0x412d('0x5'));var rp=require(_0x412d('0x6'));var fs=require('fs');var path=require(_0x412d('0x7'));var rimraf=require(_0x412d('0x8'));var config=require(_0x412d('0x9'));var attributes=require('./condition.attributes');module[_0x412d('0xa')]=function(_0x4599b5,_0x360215){return _0x4599b5[_0x412d('0xb')]('Condition',attributes,{'tableName':_0x412d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a0f=['rimraf','../../config/environment','./condition.attributes','define','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x21eba0,_0x49cad4){var _0x318fee=function(_0x49981f){while(--_0x49981f){_0x21eba0['push'](_0x21eba0['shift']());}};_0x318fee(++_0x49cad4);}(_0x2a0f,0x14a));var _0xf2a0=function(_0x52d117,_0x1be1e4){_0x52d117=_0x52d117-0x0;var _0x2fddc2=_0x2a0f[_0x52d117];return _0x2fddc2;};'use strict';var _=require(_0xf2a0('0x0'));var util=require(_0xf2a0('0x1'));var logger=require(_0xf2a0('0x2'))(_0xf2a0('0x3'));var moment=require(_0xf2a0('0x4'));var BPromise=require(_0xf2a0('0x5'));var rp=require(_0xf2a0('0x6'));var fs=require('fs');var path=require(_0xf2a0('0x7'));var rimraf=require(_0xf2a0('0x8'));var config=require(_0xf2a0('0x9'));var attributes=require(_0xf2a0('0xa'));module['exports']=function(_0x415f18,_0x52d9b2){return _0x415f18[_0xf2a0('0xb')]('Condition',attributes,{'tableName':_0xf2a0('0xc'),'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 11532ec..1869434 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 _0xcf4a=['request','then','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Condition,\x20%s,\x20%s','info','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http'];(function(_0x31c3b4,_0x29ebae){var _0x439577=function(_0x27c68d){while(--_0x27c68d){_0x31c3b4['push'](_0x31c3b4['shift']());}};_0x439577(++_0x29ebae);}(_0xcf4a,0x89));var _0xacf4=function(_0x21eb01,_0x5f0492){_0x21eb01=_0x21eb01-0x0;var _0x1d6025=_0xcf4a[_0x21eb01];return _0x1d6025;};'use strict';var _=require(_0xacf4('0x0'));var util=require(_0xacf4('0x1'));var moment=require(_0xacf4('0x2'));var BPromise=require(_0xacf4('0x3'));var rs=require(_0xacf4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xacf4('0x5'))['db'];var utils=require(_0xacf4('0x6'));var logger=require('../../config/logger')(_0xacf4('0x7'));var config=require('../../config/environment');var jayson=require(_0xacf4('0x8'));var client=jayson['client'][_0xacf4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fb07b,_0x5a1f36,_0xb05e09){return new BPromise(function(_0x3172ab,_0xb39003){return client[_0xacf4('0xa')](_0x1fb07b,_0xb05e09)[_0xacf4('0xb')](function(_0x33368f){logger['info']('Condition,\x20%s,\x20%s',_0x5a1f36,'request\x20sent');logger['debug'](_0xacf4('0xc'),_0x5a1f36,'request\x20sent',JSON[_0xacf4('0xd')](_0x33368f));if(_0x33368f[_0xacf4('0xe')]){if(_0x33368f[_0xacf4('0xe')][_0xacf4('0xf')]===0x1f4){logger[_0xacf4('0xe')]('Condition,\x20%s,\x20%s',_0x5a1f36,_0x33368f[_0xacf4('0xe')][_0xacf4('0x10')]);return _0xb39003(_0x33368f[_0xacf4('0xe')][_0xacf4('0x10')]);}logger[_0xacf4('0xe')](_0xacf4('0x11'),_0x5a1f36,_0x33368f[_0xacf4('0xe')][_0xacf4('0x10')]);return _0x3172ab(_0x33368f[_0xacf4('0xe')]['message']);}else{logger[_0xacf4('0x12')](_0xacf4('0x11'),_0x5a1f36,_0xacf4('0x13'));_0x3172ab(_0x33368f['result'][_0xacf4('0x10')]);}})[_0xacf4('0x14')](function(_0x5e7b2d){logger[_0xacf4('0xe')](_0xacf4('0x11'),_0x5a1f36,_0x5e7b2d);_0xb39003(_0x5e7b2d);});});} \ No newline at end of file +var _0xdcdd=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x21eb40,_0x595e29){var _0x12d7d6=function(_0x5e9643){while(--_0x5e9643){_0x21eb40['push'](_0x21eb40['shift']());}};_0x12d7d6(++_0x595e29);}(_0xdcdd,0x1e7));var _0xddcd=function(_0x3d8017,_0x4db91a){_0x3d8017=_0x3d8017-0x0;var _0x162357=_0xdcdd[_0x3d8017];return _0x162357;};'use strict';var _=require(_0xddcd('0x0'));var util=require(_0xddcd('0x1'));var moment=require(_0xddcd('0x2'));var BPromise=require(_0xddcd('0x3'));var rs=require(_0xddcd('0x4'));var fs=require('fs');var Redis=require(_0xddcd('0x5'));var db=require(_0xddcd('0x6'))['db'];var utils=require(_0xddcd('0x7'));var logger=require('../../config/logger')(_0xddcd('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xddcd('0x9')][_0xddcd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2680e5,_0x194b63,_0x4cccd1){return new BPromise(function(_0x913a8,_0x4a5a52){return client[_0xddcd('0xb')](_0x2680e5,_0x4cccd1)['then'](function(_0x40c543){logger[_0xddcd('0xc')](_0xddcd('0xd'),_0x194b63,_0xddcd('0xe'));logger['debug'](_0xddcd('0xf'),_0x194b63,_0xddcd('0xe'),JSON[_0xddcd('0x10')](_0x40c543));if(_0x40c543['error']){if(_0x40c543[_0xddcd('0x11')][_0xddcd('0x12')]===0x1f4){logger[_0xddcd('0x11')]('Condition,\x20%s,\x20%s',_0x194b63,_0x40c543['error'][_0xddcd('0x13')]);return _0x4a5a52(_0x40c543['error'][_0xddcd('0x13')]);}logger[_0xddcd('0x11')](_0xddcd('0xd'),_0x194b63,_0x40c543[_0xddcd('0x11')][_0xddcd('0x13')]);return _0x913a8(_0x40c543['error'][_0xddcd('0x13')]);}else{logger[_0xddcd('0xc')](_0xddcd('0xd'),_0x194b63,_0xddcd('0xe'));_0x913a8(_0x40c543[_0xddcd('0x14')]['message']);}})['catch'](function(_0x3dfabd){logger[_0xddcd('0x11')](_0xddcd('0xd'),_0x194b63,_0x3dfabd);_0x4a5a52(_0x3dfabd);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 5994297..83e10f3 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 _0x8858=['destroy','exports','util','path','express','Router','../../components/auth/service','./condition.controller','/:id','update','delete','isAuthenticated'];(function(_0x254dbd,_0x12696f){var _0x2a3436=function(_0x256fa0){while(--_0x256fa0){_0x254dbd['push'](_0x254dbd['shift']());}};_0x2a3436(++_0x12696f);}(_0x8858,0xf2));var _0x8885=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x8858[_0xefd519];return _0x4bb882;};'use strict';var multer=require('multer');var util=require(_0x8885('0x0'));var path=require(_0x8885('0x1'));var timeout=require('connect-timeout');var express=require(_0x8885('0x2'));var router=express[_0x8885('0x3')]();var auth=require(_0x8885('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8885('0x5'));router['put'](_0x8885('0x6'),auth['isAuthenticated'](),controller[_0x8885('0x7')]);router[_0x8885('0x8')](_0x8885('0x6'),auth[_0x8885('0x9')](),controller[_0x8885('0xa')]);module[_0x8885('0xb')]=router; \ No newline at end of file +var _0x9380=['isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0x9380,0x84));var _0x0938=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x9380[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0x0938('0x0'));var util=require(_0x0938('0x1'));var path=require(_0x0938('0x2'));var timeout=require(_0x0938('0x3'));var express=require(_0x0938('0x4'));var router=express[_0x0938('0x5')]();var auth=require(_0x0938('0x6'));var interaction=require(_0x0938('0x7'));var config=require(_0x0938('0x8'));var controller=require(_0x0938('0x9'));router[_0x0938('0xa')](_0x0938('0xb'),auth[_0x0938('0xc')](),controller[_0x0938('0xd')]);router['delete'](_0x0938('0xb'),auth[_0x0938('0xc')](),controller[_0x0938('0xe')]);module[_0x0938('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 6399c61..c1cccad 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 _0x5b20=['STRING','name','sequelize','exports'];(function(_0x2742c4,_0x20a82d){var _0x13dfe4=function(_0x551df5){while(--_0x551df5){_0x2742c4['push'](_0x2742c4['shift']());}};_0x13dfe4(++_0x20a82d);}(_0x5b20,0x86));var _0x05b2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5b20[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x05b2('0x0'));module[_0x05b2('0x1')]={'name':{'type':Sequelize[_0x05b2('0x2')],'allowNull':![],'unique':_0x05b2('0x3')},'description':{'type':Sequelize[_0x05b2('0x2')]}}; \ No newline at end of file +var _0xd0e7=['name','sequelize','exports','STRING'];(function(_0x4b0af1,_0x48c56a){var _0x1c6953=function(_0x797f87){while(--_0x797f87){_0x4b0af1['push'](_0x4b0af1['shift']());}};_0x1c6953(++_0x48c56a);}(_0xd0e7,0x10d));var _0x7d0e=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0xd0e7[_0x5eaa0b];return _0x28b295;};'use strict';var Sequelize=require(_0x7d0e('0x0'));module[_0x7d0e('0x1')]={'name':{'type':Sequelize[_0x7d0e('0x2')],'allowNull':![],'unique':_0x7d0e('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 935168e..c73f472 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 _0x78bd=['end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','name','send','index','map','Dashboard','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','getItems','pick','html-pdf','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','status'];(function(_0xbc3542,_0x4de021){var _0x1c88ff=function(_0x1d1fb4){while(--_0x1d1fb4){_0xbc3542['push'](_0xbc3542['shift']());}};_0x1c88ff(++_0x4de021);}(_0x78bd,0x1b7));var _0xd78b=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0x78bd[_0x490be3];return _0x3f5140;};'use strict';var pdf=require(_0xd78b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd78b('0x1'));var rp=require(_0xd78b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd78b('0x3'));var util=require('util');var path=require(_0xd78b('0x4'));var sox=require('sox');var csv=require(_0xd78b('0x5'));var ejs=require(_0xd78b('0x6'));var fs=require('fs');var _=require(_0xd78b('0x7'));var squel=require(_0xd78b('0x8'));var crypto=require(_0xd78b('0x9'));var jsforce=require(_0xd78b('0xa'));var deskjs=require(_0xd78b('0xb'));var toCsv=require(_0xd78b('0x5'));var querystring=require(_0xd78b('0xc'));var Papa=require('papaparse');var Redis=require(_0xd78b('0xd'));var authService=require(_0xd78b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd78b('0xf'));var hardwareService=require(_0xd78b('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xd78b('0x11'));var config=require(_0xd78b('0x12'));var db=require(_0xd78b('0x13'))['db'];config[_0xd78b('0x14')]=_[_0xd78b('0x15')](config[_0xd78b('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xd78b('0x16'))(new Redis(config[_0xd78b('0x14')]));require('./dashboard.socket')[_0xd78b('0x17')](socket);function respondWithStatusCode(_0x433a86,_0x5f1222){_0x5f1222=_0x5f1222||0xcc;return function(_0x279bd3){if(_0x279bd3){return _0x433a86['sendStatus'](_0x5f1222);}return _0x433a86[_0xd78b('0x18')](_0x5f1222)[_0xd78b('0x19')]();};}function respondWithResult(_0x5caa5b,_0x5ed55a){_0x5ed55a=_0x5ed55a||0xc8;return function(_0x5735ef){if(_0x5735ef){return _0x5caa5b[_0xd78b('0x18')](_0x5ed55a)[_0xd78b('0x1a')](_0x5735ef);}};}function respondWithFilteredResult(_0x2d3cd2,_0x21f697){return function(_0x5a8ac4){if(_0x5a8ac4){var _0x430eae=_0x5a8ac4[_0xd78b('0x1b')],_0x260c70=_0x21f697[_0xd78b('0x1c')],_0x45d861=_0x21f697[_0xd78b('0x1c')]+_0x21f697['limit'],_0x4448e4;if(_0x45d861>=_0x430eae){_0x45d861=_0x430eae;_0x4448e4=0xc8;}else{_0x4448e4=0xce;}_0x2d3cd2[_0xd78b('0x18')](_0x4448e4);return _0x2d3cd2[_0xd78b('0x1d')](_0xd78b('0x1e'),_0x260c70+'-'+_0x45d861+'/'+_0x430eae)[_0xd78b('0x1a')](_0x5a8ac4);}return null;};}function patchUpdates(_0xa1afa3){return function(_0x567ef6){try{jsonpatch[_0xd78b('0x1f')](_0x567ef6,_0xa1afa3,!![]);}catch(_0x30e495){return BPromise[_0xd78b('0x20')](_0x30e495);}return _0x567ef6[_0xd78b('0x21')]();};}function saveUpdates(_0xdba3f8,_0x452929){return function(_0x11ed1f){if(_0x11ed1f){return _0x11ed1f[_0xd78b('0x22')](_0xdba3f8)[_0xd78b('0x23')](function(_0x598378){return _0x598378;});}return null;};}function removeEntity(_0xdb9508,_0x48be3c){return function(_0x328e79){if(_0x328e79){return _0x328e79[_0xd78b('0x24')]()['then'](function(){var _0x2352e9=_0x328e79[_0xd78b('0x25')]({'plain':!![]});var _0x4754e0='CustomDashboards';return db[_0xd78b('0x26')][_0xd78b('0x24')]({'where':{'type':_0x4754e0,'resourceId':_0x2352e9['id']}})['then'](function(){return _0x328e79;});})['then'](function(){_0xdb9508[_0xd78b('0x18')](0xcc)[_0xd78b('0x19')]();});}};}function handleEntityNotFound(_0x6a8950,_0x3cfaa5){return function(_0x386369){if(!_0x386369){_0x6a8950[_0xd78b('0x27')](0x194);}return _0x386369;};}function handleError(_0x484bfb,_0x57377c){_0x57377c=_0x57377c||0x1f4;return function(_0x314e03){logger[_0xd78b('0x28')](_0x314e03['stack']);if(_0x314e03[_0xd78b('0x29')]){delete _0x314e03[_0xd78b('0x29')];}_0x484bfb[_0xd78b('0x18')](_0x57377c)[_0xd78b('0x2a')](_0x314e03);};}exports[_0xd78b('0x2b')]=function(_0x38050e,_0x1ee7ef){var _0x46fae5={},_0x2d8f26={},_0x458b83={'count':0x0,'rows':[]};var _0x3df01b=_[_0xd78b('0x2c')](db[_0xd78b('0x2d')][_0xd78b('0x2e')],function(_0x4725c7){return{'name':_0x4725c7['fieldName'],'type':_0x4725c7[_0xd78b('0x2f')][_0xd78b('0x30')]};});_0x2d8f26['model']=_['map'](_0x3df01b,_0xd78b('0x29'));_0x2d8f26[_0xd78b('0x31')]=_[_0xd78b('0x32')](_0x38050e[_0xd78b('0x31')]);_0x2d8f26['filters']=_[_0xd78b('0x33')](_0x2d8f26[_0xd78b('0x34')],_0x2d8f26[_0xd78b('0x31')]);_0x46fae5[_0xd78b('0x35')]=_[_0xd78b('0x33')](_0x2d8f26[_0xd78b('0x34')],qs[_0xd78b('0x36')](_0x38050e[_0xd78b('0x31')][_0xd78b('0x36')]));_0x46fae5[_0xd78b('0x35')]=_0x46fae5[_0xd78b('0x35')][_0xd78b('0x37')]?_0x46fae5['attributes']:_0x2d8f26['model'];if(!_0x38050e[_0xd78b('0x31')]['hasOwnProperty'](_0xd78b('0x38'))){_0x46fae5['limit']=qs[_0xd78b('0x39')](_0x38050e[_0xd78b('0x31')][_0xd78b('0x39')]);_0x46fae5[_0xd78b('0x1c')]=qs[_0xd78b('0x1c')](_0x38050e['query'][_0xd78b('0x1c')]);}_0x46fae5[_0xd78b('0x3a')]=qs[_0xd78b('0x3b')](_0x38050e[_0xd78b('0x31')][_0xd78b('0x3b')]);_0x46fae5[_0xd78b('0x3c')]=qs[_0xd78b('0x3d')](_['pick'](_0x38050e[_0xd78b('0x31')],_0x2d8f26['filters']),_0x3df01b);if(_0x38050e['query']['filter']){_0x46fae5[_0xd78b('0x3c')]=_[_0xd78b('0x3e')](_0x46fae5['where'],{'$or':_[_0xd78b('0x2c')](_0x3df01b,function(_0xe98749){if(_0xe98749[_0xd78b('0x2f')]!==_0xd78b('0x3f')){var _0x5f4116={};_0x5f4116[_0xe98749[_0xd78b('0x29')]]={'$like':'%'+_0x38050e['query']['filter']+'%'};return _0x5f4116;}})});}_0x46fae5=_[_0xd78b('0x3e')]({},_0x46fae5,_0x38050e[_0xd78b('0x40')]);var _0x515615={'where':_0x46fae5['where']};return db[_0xd78b('0x2d')]['count'](_0x515615)[_0xd78b('0x23')](function(_0x527323){_0x458b83['count']=_0x527323;if(_0x38050e[_0xd78b('0x31')][_0xd78b('0x41')]){_0x46fae5[_0xd78b('0x42')]=[{'all':!![]}];}return db[_0xd78b('0x2d')][_0xd78b('0x43')](_0x46fae5);})[_0xd78b('0x23')](function(_0x266307){_0x458b83[_0xd78b('0x44')]=_0x266307;return _0x458b83;})['then'](respondWithFilteredResult(_0x1ee7ef,_0x46fae5))[_0xd78b('0x45')](handleError(_0x1ee7ef,null));};exports[_0xd78b('0x46')]=function(_0x190dea,_0xbac0a4){var _0xda42f1={'raw':![],'where':{'id':_0x190dea[_0xd78b('0x47')]['id']}},_0x59335e={};_0x59335e['model']=_[_0xd78b('0x32')](db[_0xd78b('0x2d')][_0xd78b('0x2e')]);_0x59335e[_0xd78b('0x31')]=_['keys'](_0x190dea[_0xd78b('0x31')]);_0x59335e[_0xd78b('0x3d')]=_[_0xd78b('0x33')](_0x59335e['model'],_0x59335e[_0xd78b('0x31')]);_0xda42f1[_0xd78b('0x35')]=_[_0xd78b('0x33')](_0x59335e[_0xd78b('0x34')],qs['fields'](_0x190dea[_0xd78b('0x31')][_0xd78b('0x36')]));_0xda42f1[_0xd78b('0x35')]=_0xda42f1['attributes'][_0xd78b('0x37')]?_0xda42f1[_0xd78b('0x35')]:_0x59335e[_0xd78b('0x34')];if(_0x190dea[_0xd78b('0x31')][_0xd78b('0x41')]){_0xda42f1[_0xd78b('0x42')]=[{'all':!![]}];}_0xda42f1=_[_0xd78b('0x3e')]({},_0xda42f1,_0x190dea[_0xd78b('0x40')]);return db[_0xd78b('0x2d')][_0xd78b('0x48')](_0xda42f1)['then'](handleEntityNotFound(_0xbac0a4,null))[_0xd78b('0x23')](respondWithResult(_0xbac0a4,null))[_0xd78b('0x45')](handleError(_0xbac0a4,null));};exports[_0xd78b('0x49')]=function(_0x4bb49c,_0x207a92){return db['Dashboard'][_0xd78b('0x49')](_0x4bb49c[_0xd78b('0x4a')],{})[_0xd78b('0x23')](function(_0x7b3833){var _0x123de3=_0x4bb49c[_0xd78b('0x4b')][_0xd78b('0x25')]({'plain':!![]});if(!_0x123de3)throw new Error(_0xd78b('0x4c'));if(_0x123de3[_0xd78b('0x4d')]===_0xd78b('0x4b')){var _0x44511c=_0x7b3833[_0xd78b('0x25')]({'plain':!![]});var _0x32fe2f=_0xd78b('0x4e');return db[_0xd78b('0x4f')]['find']({'where':{'name':_0x32fe2f,'userProfileId':_0x123de3[_0xd78b('0x50')]},'raw':!![]})[_0xd78b('0x23')](function(_0xa0bc82){if(_0xa0bc82&&_0xa0bc82[_0xd78b('0x51')]===0x0){return db[_0xd78b('0x26')][_0xd78b('0x49')]({'name':_0x44511c[_0xd78b('0x29')],'resourceId':_0x44511c['id'],'type':_0xa0bc82[_0xd78b('0x29')],'sectionId':_0xa0bc82['id']},{})[_0xd78b('0x23')](function(){return _0x7b3833;});}else{return _0x7b3833;}})[_0xd78b('0x45')](function(_0x28fb29){logger[_0xd78b('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28fb29);throw _0x28fb29;});}return _0x7b3833;})['then'](respondWithResult(_0x207a92,0xc9))[_0xd78b('0x45')](handleError(_0x207a92,null));};exports[_0xd78b('0x52')]=function(_0x528056,_0x59bf68){var _0x164721={'where':{'id':_0x528056[_0xd78b('0x47')]['id']}},_0xb58ef5={};_0xb58ef5[_0xd78b('0x34')]=_[_0xd78b('0x32')](db['Dashboard'][_0xd78b('0x2e')]);_0x164721[_0xd78b('0x35')]=_[_0xd78b('0x33')](_0xb58ef5['model'],qs[_0xd78b('0x36')](_0x528056[_0xd78b('0x31')][_0xd78b('0x36')]));_0x164721[_0xd78b('0x35')]=_0x164721[_0xd78b('0x35')][_0xd78b('0x37')]?_0x164721[_0xd78b('0x35')]:_0xb58ef5['model'];if(_0x528056[_0xd78b('0x31')][_0xd78b('0x41')]){_0x164721[_0xd78b('0x42')]=[{'all':!![]}];}_0x164721=_['merge']({},_0x164721,_0x528056[_0xd78b('0x40')]);return db['Dashboard']['find'](_0x164721)['then'](handleEntityNotFound(_0x59bf68,null))['then'](function(_0x3806da){if(_0x3806da){var _0x38760e=_0x3806da['get']({'plain':!![]});_0x38760e=qs[_0xd78b('0x53')](_0x38760e,['id',_0xd78b('0x54'),_0xd78b('0x55')]);_0x528056['body']=_[_0xd78b('0x53')](_0x528056[_0xd78b('0x4a')],['id','createdAt','updatedAt']);return db['Dashboard']['create'](_['merge'](_0x38760e,_0x528056[_0xd78b('0x4a')]),{'include':_0x528056[_0xd78b('0x31')][_0xd78b('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x3824c2){var _0x12492d=_0x528056[_0xd78b('0x4b')]['get']({'plain':!![]});if(!_0x12492d)throw new Error(_0xd78b('0x4c'));if(_0x12492d[_0xd78b('0x4d')]==='user'){var _0x4f2489=_0x3824c2[_0xd78b('0x25')]({'plain':!![]});var _0x5d113d='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0x5d113d,'userProfileId':_0x12492d[_0xd78b('0x50')]},'raw':!![]})[_0xd78b('0x23')](function(_0x4b2d3a){if(_0x4b2d3a&&_0x4b2d3a[_0xd78b('0x51')]===0x0){return db[_0xd78b('0x26')][_0xd78b('0x49')]({'name':_0x4f2489[_0xd78b('0x29')],'resourceId':_0x4f2489['id'],'type':_0x4b2d3a[_0xd78b('0x29')],'sectionId':_0x4b2d3a['id']},{})[_0xd78b('0x23')](function(){return _0x3824c2;});}else{return _0x3824c2;}})[_0xd78b('0x45')](function(_0x55e220){logger[_0xd78b('0x28')](_0xd78b('0x56'),_0x55e220);throw _0x55e220;});}return _0x3824c2;});}})[_0xd78b('0x23')](respondWithResult(_0x59bf68,0xc9))[_0xd78b('0x45')](handleError(_0x59bf68,null));};exports[_0xd78b('0x22')]=function(_0x5236a6,_0x11f31b){if(_0x5236a6[_0xd78b('0x4a')]['id']){delete _0x5236a6[_0xd78b('0x4a')]['id'];}return db[_0xd78b('0x2d')][_0xd78b('0x48')]({'where':{'id':_0x5236a6[_0xd78b('0x47')]['id']}})[_0xd78b('0x23')](handleEntityNotFound(_0x11f31b,null))['then'](saveUpdates(_0x5236a6[_0xd78b('0x4a')],null))['then'](respondWithResult(_0x11f31b,null))[_0xd78b('0x45')](handleError(_0x11f31b,null));};exports[_0xd78b('0x24')]=function(_0x515d43,_0x1d1816){return db[_0xd78b('0x2d')][_0xd78b('0x48')]({'where':{'id':_0x515d43[_0xd78b('0x47')]['id']}})[_0xd78b('0x23')](handleEntityNotFound(_0x1d1816,null))[_0xd78b('0x23')](removeEntity(_0x1d1816,null))[_0xd78b('0x45')](handleError(_0x1d1816,null));};function widgetAttributes(_0x54207e){try{switch(_0x54207e[_0xd78b('0x2f')]){case _0xd78b('0x57'):return[{'name':_0xd78b('0x58'),'value':_0x54207e[_0xd78b('0x58')]||(_0x54207e[_0xd78b('0x59')]&&_0x54207e['attrs'][0x0]?_0x54207e[_0xd78b('0x59')][0x0][_0xd78b('0x5a')]:undefined)||_0xd78b('0x5b')}];case _0xd78b('0x5c'):return[{'name':_0xd78b('0x5d'),'value':_0x54207e[_0xd78b('0x5d')]||(_0x54207e[_0xd78b('0x59')]&&_0x54207e[_0xd78b('0x59')][0x0]?_0x54207e[_0xd78b('0x59')][0x0][_0xd78b('0x5a')]:undefined)||''}];case'clock':return[{'name':_0xd78b('0x5e'),'value':_0x54207e[_0xd78b('0x5e')]||(_0x54207e[_0xd78b('0x59')]&&_0x54207e['attrs'][0x0]?_0x54207e[_0xd78b('0x59')][0x0][_0xd78b('0x5a')]:undefined)||_0xd78b('0x5f')},{'name':_0xd78b('0x60'),'value':_0x54207e['attrTimezone']||(_0x54207e[_0xd78b('0x59')]&&_0x54207e[_0xd78b('0x59')][0x1]?_0x54207e[_0xd78b('0x59')][0x1][_0xd78b('0x5a')]:undefined)||_0xd78b('0x61')},{'name':'attrFontSize','value':_0x54207e[_0xd78b('0x62')]||(_0x54207e[_0xd78b('0x59')]&&_0x54207e[_0xd78b('0x59')][0x2]?_0x54207e['attrs'][0x2][_0xd78b('0x5a')]:undefined)||0xc}];case _0xd78b('0x63'):return[{'name':_0xd78b('0x64'),'value':_0x54207e[_0xd78b('0x64')]||(_0x54207e[_0xd78b('0x59')]&&_0x54207e[_0xd78b('0x59')][0x0]?_0x54207e['attrs'][0x0][_0xd78b('0x5a')]:undefined)||'total'},{'name':_0xd78b('0x65'),'value':_0x54207e[_0xd78b('0x65')]||(_0x54207e[_0xd78b('0x59')]&&_0x54207e[_0xd78b('0x59')][0x1]?_0x54207e['attrs'][0x1][_0xd78b('0x5a')]:undefined)||[]},{'name':_0xd78b('0x62'),'value':_0x54207e[_0xd78b('0x62')]||(_0x54207e['attrs']&&_0x54207e[_0xd78b('0x59')][0x2]?_0x54207e['attrs'][0x2][_0xd78b('0x5a')]:undefined)||0x14}];case _0xd78b('0x66'):case'pie-chart':return[{'name':_0xd78b('0x67'),'value':_0x54207e['attrSerie1']||(_0x54207e['attrs']&&_0x54207e['attrs'][0x0]?_0x54207e[_0xd78b('0x59')][0x0][_0xd78b('0x5a')]:undefined)||_0xd78b('0x68')},{'name':_0xd78b('0x69'),'value':_0x54207e[_0xd78b('0x69')]||(_0x54207e['attrs']&&_0x54207e[_0xd78b('0x59')][0x1]?_0x54207e[_0xd78b('0x59')][0x1][_0xd78b('0x5a')]:undefined)||null},{'name':_0xd78b('0x6a'),'value':_0x54207e[_0xd78b('0x6a')]||(_0x54207e['attrs']&&_0x54207e[_0xd78b('0x59')][0x2]?_0x54207e[_0xd78b('0x59')][0x2][_0xd78b('0x5a')]:undefined)||null},{'name':_0xd78b('0x65'),'value':_0x54207e['attrVoiceQueues']||(_0x54207e['attrs']&&_0x54207e[_0xd78b('0x59')][0x3]?_0x54207e['attrs'][0x3][_0xd78b('0x5a')]:undefined)||[]}];case _0xd78b('0x6b'):return[{'name':'attrReport','type':_0x54207e[_0xd78b('0x6c')]||(_0x54207e['attrs']&&_0x54207e[_0xd78b('0x59')][0x0]?_0x54207e[_0xd78b('0x59')][0x0][_0xd78b('0x2f')]:undefined)||null,'value':_0x54207e[_0xd78b('0x6d')]||(_0x54207e[_0xd78b('0x59')]&&_0x54207e['attrs'][0x0]?_0x54207e[_0xd78b('0x59')][0x0][_0xd78b('0x5a')]:undefined)||null},{'name':_0xd78b('0x6e'),'value':_0x54207e['attrRefresh']||(_0x54207e['attrs']&&_0x54207e['attrs'][0x1]?_0x54207e[_0xd78b('0x59')][0x1][_0xd78b('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x3b8eb5){logger['error'](_0xd78b('0x6f'),JSON[_0xd78b('0x70')](_0x3b8eb5));return[];}}exports[_0xd78b('0x71')]=function(_0x346104,_0x45a400,_0x851324){if(_0x346104[_0xd78b('0x4a')]['id']){delete _0x346104['body']['id'];}return db[_0xd78b('0x2d')][_0xd78b('0x48')]({'where':{'id':_0x346104['params']['id']}})[_0xd78b('0x23')](handleEntityNotFound(_0x45a400,null))[_0xd78b('0x23')](function(_0x5755f8){if(_0x5755f8){_0x346104[_0xd78b('0x4a')]['DashboardId']=_0x5755f8['id'];_0x346104[_0xd78b('0x4a')][_0xd78b('0x59')]=widgetAttributes(_0x346104[_0xd78b('0x4a')]);return db['DashboardItem']['create'](_0x346104[_0xd78b('0x4a')]);}})['then'](respondWithResult(_0x45a400,null))[_0xd78b('0x45')](handleError(_0x45a400,null));};exports[_0xd78b('0x72')]=function(_0x202be7,_0x1c479c,_0x286764){var _0x112b37={};var _0x3afa92={};var _0xf94855;var _0x408bd0;return db[_0xd78b('0x2d')]['findOne']({'where':{'id':_0x202be7[_0xd78b('0x47')]['id']}})[_0xd78b('0x23')](handleEntityNotFound(_0x1c479c,null))[_0xd78b('0x23')](function(_0x54a492){if(_0x54a492){_0xf94855=_0x54a492;_0x3afa92[_0xd78b('0x34')]=_[_0xd78b('0x32')](db['DashboardItem'][_0xd78b('0x2e')]);_0x3afa92[_0xd78b('0x31')]=_[_0xd78b('0x32')](_0x202be7[_0xd78b('0x31')]);_0x3afa92[_0xd78b('0x3d')]=_[_0xd78b('0x33')](_0x3afa92[_0xd78b('0x34')],_0x3afa92[_0xd78b('0x31')]);_0x112b37[_0xd78b('0x35')]=_[_0xd78b('0x33')](_0x3afa92[_0xd78b('0x34')],qs[_0xd78b('0x36')](_0x202be7['query']['fields']));_0x112b37[_0xd78b('0x35')]=_0x112b37[_0xd78b('0x35')][_0xd78b('0x37')]?_0x112b37[_0xd78b('0x35')]:_0x3afa92[_0xd78b('0x34')];_0x112b37[_0xd78b('0x3a')]=qs[_0xd78b('0x3b')](_0x202be7['query'][_0xd78b('0x3b')]);_0x112b37[_0xd78b('0x3c')]=qs[_0xd78b('0x3d')](_[_0xd78b('0x73')](_0x202be7[_0xd78b('0x31')],_0x3afa92[_0xd78b('0x3d')]));if(_0x202be7[_0xd78b('0x31')]['filter']){_0x112b37[_0xd78b('0x3c')]=_[_0xd78b('0x3e')](_0x112b37['where'],{'$or':_['map'](_0x112b37[_0xd78b('0x35')],function(_0x26ca5d){var _0x10438c={};_0x10438c[_0x26ca5d]={'$like':'%'+_0x202be7[_0xd78b('0x31')]['filter']+'%'};return _0x10438c;})});}_0x112b37=_[_0xd78b('0x3e')]({},_0x112b37,_0x202be7['options']);return _0xf94855[_0xd78b('0x72')](_0x112b37);}})[_0xd78b('0x23')](function(_0x4e4d46){if(_0x4e4d46){_0x408bd0=_0x4e4d46[_0xd78b('0x37')];if(!_0x202be7[_0xd78b('0x31')]['hasOwnProperty'](_0xd78b('0x38'))){_0x112b37[_0xd78b('0x39')]=qs['limit'](_0x202be7[_0xd78b('0x31')][_0xd78b('0x39')]);_0x112b37[_0xd78b('0x1c')]=qs[_0xd78b('0x1c')](_0x202be7[_0xd78b('0x31')][_0xd78b('0x1c')]);}return _0xf94855[_0xd78b('0x72')](_0x112b37);}})['then'](function(_0x5cdb1f){if(_0x5cdb1f){return _0x5cdb1f?{'count':_0x408bd0,'rows':_0x5cdb1f}:null;}})[_0xd78b('0x23')](respondWithResult(_0x1c479c,null))[_0xd78b('0x45')](handleError(_0x1c479c,null));}; \ No newline at end of file +var _0xb9a3=['querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Dashboard','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','stringify','addItem','DashboardId','DashboardItem','order','getItems','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x51fb0a,_0x5b392f){var _0x1cb1f7=function(_0x33384d){while(--_0x33384d){_0x51fb0a['push'](_0x51fb0a['shift']());}};_0x1cb1f7(++_0x5b392f);}(_0xb9a3,0xe2));var _0x3b9a=function(_0x58f21a,_0x351eae){_0x58f21a=_0x58f21a-0x0;var _0x4b197a=_0xb9a3[_0x58f21a];return _0x4b197a;};'use strict';var pdf=require(_0x3b9a('0x0'));var emlformat=require(_0x3b9a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3b9a('0x2'));var jsonpatch=require(_0x3b9a('0x3'));var rp=require('request-promise');var moment=require(_0x3b9a('0x4'));var BPromise=require(_0x3b9a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3b9a('0x6'));var sox=require(_0x3b9a('0x7'));var csv=require('to-csv');var ejs=require(_0x3b9a('0x8'));var fs=require('fs');var _=require(_0x3b9a('0x9'));var squel=require(_0x3b9a('0xa'));var crypto=require(_0x3b9a('0xb'));var jsforce=require(_0x3b9a('0xc'));var deskjs=require(_0x3b9a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3b9a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3b9a('0xf'));var qs=require(_0x3b9a('0x10'));var as=require(_0x3b9a('0x11'));var hardwareService=require(_0x3b9a('0x12'));var logger=require(_0x3b9a('0x13'))(_0x3b9a('0x14'));var utils=require(_0x3b9a('0x15'));var config=require(_0x3b9a('0x16'));var db=require(_0x3b9a('0x17'))['db'];config['redis']=_[_0x3b9a('0x18')](config[_0x3b9a('0x19')],{'host':_0x3b9a('0x1a'),'port':0x18eb});var socket=require(_0x3b9a('0x1b'))(new Redis(config[_0x3b9a('0x19')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x583db5,_0x1470fb){_0x1470fb=_0x1470fb||0xcc;return function(_0x8d1191){if(_0x8d1191){return _0x583db5[_0x3b9a('0x1c')](_0x1470fb);}return _0x583db5['status'](_0x1470fb)[_0x3b9a('0x1d')]();};}function respondWithResult(_0x48c966,_0x3b78be){_0x3b78be=_0x3b78be||0xc8;return function(_0xe68cdf){if(_0xe68cdf){return _0x48c966[_0x3b9a('0x1e')](_0x3b78be)['json'](_0xe68cdf);}};}function respondWithFilteredResult(_0x12ce30,_0x4ef933){return function(_0x363886){if(_0x363886){var _0x3abbd0=_0x363886[_0x3b9a('0x1f')],_0x499f89=_0x4ef933[_0x3b9a('0x20')],_0x96275f=_0x4ef933['offset']+_0x4ef933[_0x3b9a('0x21')],_0x43a28f;if(_0x96275f>=_0x3abbd0){_0x96275f=_0x3abbd0;_0x43a28f=0xc8;}else{_0x43a28f=0xce;}_0x12ce30[_0x3b9a('0x1e')](_0x43a28f);return _0x12ce30['set'](_0x3b9a('0x22'),_0x499f89+'-'+_0x96275f+'/'+_0x3abbd0)[_0x3b9a('0x23')](_0x363886);}return null;};}function patchUpdates(_0x2957ac){return function(_0x47e788){try{jsonpatch[_0x3b9a('0x24')](_0x47e788,_0x2957ac,!![]);}catch(_0x1b9e90){return BPromise[_0x3b9a('0x25')](_0x1b9e90);}return _0x47e788[_0x3b9a('0x26')]();};}function saveUpdates(_0x5e123c,_0x279adf){return function(_0x3e8dcd){if(_0x3e8dcd){return _0x3e8dcd[_0x3b9a('0x27')](_0x5e123c)[_0x3b9a('0x28')](function(_0x552d6d){return _0x552d6d;});}return null;};}function removeEntity(_0x29815a,_0x5dde4a){return function(_0x1d0418){if(_0x1d0418){return _0x1d0418[_0x3b9a('0x29')]()[_0x3b9a('0x28')](function(){var _0x50eee8=_0x1d0418[_0x3b9a('0x2a')]({'plain':!![]});var _0x31a3cd=_0x3b9a('0x2b');return db[_0x3b9a('0x2c')][_0x3b9a('0x29')]({'where':{'type':_0x31a3cd,'resourceId':_0x50eee8['id']}})[_0x3b9a('0x28')](function(){return _0x1d0418;});})[_0x3b9a('0x28')](function(){_0x29815a['status'](0xcc)[_0x3b9a('0x1d')]();});}};}function handleEntityNotFound(_0x4323ba,_0x374323){return function(_0x2c876d){if(!_0x2c876d){_0x4323ba[_0x3b9a('0x1c')](0x194);}return _0x2c876d;};}function handleError(_0x1f27c6,_0x32f70f){_0x32f70f=_0x32f70f||0x1f4;return function(_0xd127b1){logger['error'](_0xd127b1[_0x3b9a('0x2d')]);if(_0xd127b1[_0x3b9a('0x2e')]){delete _0xd127b1[_0x3b9a('0x2e')];}_0x1f27c6['status'](_0x32f70f)['send'](_0xd127b1);};}exports[_0x3b9a('0x2f')]=function(_0x348092,_0x231601){var _0xfa4ec7={},_0x593b46={},_0x2970f2={'count':0x0,'rows':[]};var _0x4e275d=_[_0x3b9a('0x30')](db['Dashboard'][_0x3b9a('0x31')],function(_0x25bd2a){return{'name':_0x25bd2a[_0x3b9a('0x32')],'type':_0x25bd2a[_0x3b9a('0x33')][_0x3b9a('0x34')]};});_0x593b46[_0x3b9a('0x35')]=_[_0x3b9a('0x30')](_0x4e275d,'name');_0x593b46[_0x3b9a('0x36')]=_['keys'](_0x348092[_0x3b9a('0x36')]);_0x593b46[_0x3b9a('0x37')]=_[_0x3b9a('0x38')](_0x593b46[_0x3b9a('0x35')],_0x593b46['query']);_0xfa4ec7['attributes']=_['intersection'](_0x593b46[_0x3b9a('0x35')],qs[_0x3b9a('0x39')](_0x348092[_0x3b9a('0x36')]['fields']));_0xfa4ec7[_0x3b9a('0x3a')]=_0xfa4ec7[_0x3b9a('0x3a')][_0x3b9a('0x3b')]?_0xfa4ec7[_0x3b9a('0x3a')]:_0x593b46['model'];if(!_0x348092['query'][_0x3b9a('0x3c')](_0x3b9a('0x3d'))){_0xfa4ec7[_0x3b9a('0x21')]=qs['limit'](_0x348092[_0x3b9a('0x36')]['limit']);_0xfa4ec7[_0x3b9a('0x20')]=qs[_0x3b9a('0x20')](_0x348092[_0x3b9a('0x36')][_0x3b9a('0x20')]);}_0xfa4ec7['order']=qs[_0x3b9a('0x3e')](_0x348092[_0x3b9a('0x36')][_0x3b9a('0x3e')]);_0xfa4ec7[_0x3b9a('0x3f')]=qs[_0x3b9a('0x37')](_[_0x3b9a('0x40')](_0x348092['query'],_0x593b46[_0x3b9a('0x37')]),_0x4e275d);if(_0x348092[_0x3b9a('0x36')][_0x3b9a('0x41')]){_0xfa4ec7[_0x3b9a('0x3f')]=_[_0x3b9a('0x42')](_0xfa4ec7['where'],{'$or':_[_0x3b9a('0x30')](_0x4e275d,function(_0xe2b9cb){if(_0xe2b9cb[_0x3b9a('0x33')]!==_0x3b9a('0x43')){var _0x4513ba={};_0x4513ba[_0xe2b9cb[_0x3b9a('0x2e')]]={'$like':'%'+_0x348092[_0x3b9a('0x36')][_0x3b9a('0x41')]+'%'};return _0x4513ba;}})});}_0xfa4ec7=_['merge']({},_0xfa4ec7,_0x348092[_0x3b9a('0x44')]);var _0x460e7f={'where':_0xfa4ec7[_0x3b9a('0x3f')]};return db[_0x3b9a('0x45')][_0x3b9a('0x1f')](_0x460e7f)['then'](function(_0x30bf71){_0x2970f2[_0x3b9a('0x1f')]=_0x30bf71;if(_0x348092[_0x3b9a('0x36')][_0x3b9a('0x46')]){_0xfa4ec7[_0x3b9a('0x47')]=[{'all':!![]}];}return db[_0x3b9a('0x45')][_0x3b9a('0x48')](_0xfa4ec7);})['then'](function(_0x1ec9a1){_0x2970f2[_0x3b9a('0x49')]=_0x1ec9a1;return _0x2970f2;})[_0x3b9a('0x28')](respondWithFilteredResult(_0x231601,_0xfa4ec7))[_0x3b9a('0x4a')](handleError(_0x231601,null));};exports[_0x3b9a('0x4b')]=function(_0x1fcdaa,_0x308fc1){var _0x1349a1={'raw':![],'where':{'id':_0x1fcdaa[_0x3b9a('0x4c')]['id']}},_0x1a118c={};_0x1a118c[_0x3b9a('0x35')]=_[_0x3b9a('0x4d')](db[_0x3b9a('0x45')]['rawAttributes']);_0x1a118c[_0x3b9a('0x36')]=_[_0x3b9a('0x4d')](_0x1fcdaa[_0x3b9a('0x36')]);_0x1a118c[_0x3b9a('0x37')]=_[_0x3b9a('0x38')](_0x1a118c[_0x3b9a('0x35')],_0x1a118c[_0x3b9a('0x36')]);_0x1349a1[_0x3b9a('0x3a')]=_[_0x3b9a('0x38')](_0x1a118c['model'],qs[_0x3b9a('0x39')](_0x1fcdaa[_0x3b9a('0x36')][_0x3b9a('0x39')]));_0x1349a1[_0x3b9a('0x3a')]=_0x1349a1[_0x3b9a('0x3a')]['length']?_0x1349a1[_0x3b9a('0x3a')]:_0x1a118c['model'];if(_0x1fcdaa[_0x3b9a('0x36')][_0x3b9a('0x46')]){_0x1349a1['include']=[{'all':!![]}];}_0x1349a1=_[_0x3b9a('0x42')]({},_0x1349a1,_0x1fcdaa[_0x3b9a('0x44')]);return db['Dashboard'][_0x3b9a('0x4e')](_0x1349a1)[_0x3b9a('0x28')](handleEntityNotFound(_0x308fc1,null))[_0x3b9a('0x28')](respondWithResult(_0x308fc1,null))[_0x3b9a('0x4a')](handleError(_0x308fc1,null));};exports[_0x3b9a('0x4f')]=function(_0x33e1c9,_0x41f645){return db[_0x3b9a('0x45')][_0x3b9a('0x4f')](_0x33e1c9[_0x3b9a('0x50')],{})['then'](function(_0x3710a4){var _0x5cde07=_0x33e1c9[_0x3b9a('0x51')]['get']({'plain':!![]});if(!_0x5cde07)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cde07[_0x3b9a('0x52')]===_0x3b9a('0x51')){var _0x21d5eb=_0x3710a4[_0x3b9a('0x2a')]({'plain':!![]});var _0x5758c6=_0x3b9a('0x2b');return db[_0x3b9a('0x53')][_0x3b9a('0x4e')]({'where':{'name':_0x5758c6,'userProfileId':_0x5cde07[_0x3b9a('0x54')]},'raw':!![]})[_0x3b9a('0x28')](function(_0x5bc0ed){if(_0x5bc0ed&&_0x5bc0ed[_0x3b9a('0x55')]===0x0){return db['UserProfileResource'][_0x3b9a('0x4f')]({'name':_0x21d5eb[_0x3b9a('0x2e')],'resourceId':_0x21d5eb['id'],'type':_0x5bc0ed['name'],'sectionId':_0x5bc0ed['id']},{})['then'](function(){return _0x3710a4;});}else{return _0x3710a4;}})[_0x3b9a('0x4a')](function(_0x35c56d){logger[_0x3b9a('0x56')](_0x3b9a('0x57'),_0x35c56d);throw _0x35c56d;});}return _0x3710a4;})[_0x3b9a('0x28')](respondWithResult(_0x41f645,0xc9))[_0x3b9a('0x4a')](handleError(_0x41f645,null));};exports[_0x3b9a('0x58')]=function(_0x347928,_0x51d743){var _0x347f5b={'where':{'id':_0x347928[_0x3b9a('0x4c')]['id']}},_0x21e065={};_0x21e065['model']=_['keys'](db['Dashboard'][_0x3b9a('0x31')]);_0x347f5b['attributes']=_['intersection'](_0x21e065[_0x3b9a('0x35')],qs[_0x3b9a('0x39')](_0x347928['query'][_0x3b9a('0x39')]));_0x347f5b[_0x3b9a('0x3a')]=_0x347f5b[_0x3b9a('0x3a')][_0x3b9a('0x3b')]?_0x347f5b['attributes']:_0x21e065[_0x3b9a('0x35')];if(_0x347928['query'][_0x3b9a('0x46')]){_0x347f5b[_0x3b9a('0x47')]=[{'all':!![]}];}_0x347f5b=_[_0x3b9a('0x42')]({},_0x347f5b,_0x347928[_0x3b9a('0x44')]);return db['Dashboard'][_0x3b9a('0x4e')](_0x347f5b)[_0x3b9a('0x28')](handleEntityNotFound(_0x51d743,null))[_0x3b9a('0x28')](function(_0x4373a8){if(_0x4373a8){var _0x46435a=_0x4373a8[_0x3b9a('0x2a')]({'plain':!![]});_0x46435a=qs[_0x3b9a('0x59')](_0x46435a,['id','createdAt','updatedAt']);_0x347928['body']=_[_0x3b9a('0x59')](_0x347928['body'],['id',_0x3b9a('0x5a'),_0x3b9a('0x5b')]);return db[_0x3b9a('0x45')][_0x3b9a('0x4f')](_[_0x3b9a('0x42')](_0x46435a,_0x347928[_0x3b9a('0x50')]),{'include':_0x347928['query'][_0x3b9a('0x46')]?[{'all':!![]}]:undefined})[_0x3b9a('0x28')](function(_0xce602){var _0x3b4d14=_0x347928['user'][_0x3b9a('0x2a')]({'plain':!![]});if(!_0x3b4d14)throw new Error(_0x3b9a('0x5c'));if(_0x3b4d14[_0x3b9a('0x52')]===_0x3b9a('0x51')){var _0x3cc452=_0xce602[_0x3b9a('0x2a')]({'plain':!![]});var _0x1b21c7=_0x3b9a('0x2b');return db['UserProfileSection'][_0x3b9a('0x4e')]({'where':{'name':_0x1b21c7,'userProfileId':_0x3b4d14[_0x3b9a('0x54')]},'raw':!![]})['then'](function(_0x5a2fe9){if(_0x5a2fe9&&_0x5a2fe9[_0x3b9a('0x55')]===0x0){return db[_0x3b9a('0x2c')]['create']({'name':_0x3cc452['name'],'resourceId':_0x3cc452['id'],'type':_0x5a2fe9[_0x3b9a('0x2e')],'sectionId':_0x5a2fe9['id']},{})['then'](function(){return _0xce602;});}else{return _0xce602;}})[_0x3b9a('0x4a')](function(_0x43624c){logger[_0x3b9a('0x56')](_0x3b9a('0x57'),_0x43624c);throw _0x43624c;});}return _0xce602;});}})[_0x3b9a('0x28')](respondWithResult(_0x51d743,0xc9))[_0x3b9a('0x4a')](handleError(_0x51d743,null));};exports['update']=function(_0x3cbb5c,_0x253230){if(_0x3cbb5c[_0x3b9a('0x50')]['id']){delete _0x3cbb5c[_0x3b9a('0x50')]['id'];}return db[_0x3b9a('0x45')][_0x3b9a('0x4e')]({'where':{'id':_0x3cbb5c[_0x3b9a('0x4c')]['id']}})[_0x3b9a('0x28')](handleEntityNotFound(_0x253230,null))['then'](saveUpdates(_0x3cbb5c['body'],null))['then'](respondWithResult(_0x253230,null))[_0x3b9a('0x4a')](handleError(_0x253230,null));};exports[_0x3b9a('0x29')]=function(_0x12b6b9,_0x5d481d){return db['Dashboard'][_0x3b9a('0x4e')]({'where':{'id':_0x12b6b9[_0x3b9a('0x4c')]['id']}})[_0x3b9a('0x28')](handleEntityNotFound(_0x5d481d,null))['then'](removeEntity(_0x5d481d,null))['catch'](handleError(_0x5d481d,null));};function widgetAttributes(_0x23528c){try{switch(_0x23528c[_0x3b9a('0x33')]){case'iframe':return[{'name':'attrUrl','value':_0x23528c[_0x3b9a('0x5d')]||(_0x23528c[_0x3b9a('0x5e')]&&_0x23528c[_0x3b9a('0x5e')][0x0]?_0x23528c[_0x3b9a('0x5e')][0x0][_0x3b9a('0x5f')]:undefined)||_0x3b9a('0x60')}];case _0x3b9a('0x61'):return[{'name':_0x3b9a('0x62'),'value':_0x23528c[_0x3b9a('0x62')]||(_0x23528c['attrs']&&_0x23528c[_0x3b9a('0x5e')][0x0]?_0x23528c[_0x3b9a('0x5e')][0x0]['value']:undefined)||''}];case _0x3b9a('0x63'):return[{'name':_0x3b9a('0x64'),'value':_0x23528c[_0x3b9a('0x64')]||(_0x23528c[_0x3b9a('0x5e')]&&_0x23528c[_0x3b9a('0x5e')][0x0]?_0x23528c[_0x3b9a('0x5e')][0x0][_0x3b9a('0x5f')]:undefined)||_0x3b9a('0x65')},{'name':_0x3b9a('0x66'),'value':_0x23528c['attrTimezone']||(_0x23528c['attrs']&&_0x23528c['attrs'][0x1]?_0x23528c[_0x3b9a('0x5e')][0x1]['value']:undefined)||_0x3b9a('0x67')},{'name':_0x3b9a('0x68'),'value':_0x23528c[_0x3b9a('0x68')]||(_0x23528c[_0x3b9a('0x5e')]&&_0x23528c[_0x3b9a('0x5e')][0x2]?_0x23528c[_0x3b9a('0x5e')][0x2][_0x3b9a('0x5f')]:undefined)||0xc}];case'counter':return[{'name':_0x3b9a('0x69'),'value':_0x23528c[_0x3b9a('0x69')]||(_0x23528c['attrs']&&_0x23528c[_0x3b9a('0x5e')][0x0]?_0x23528c[_0x3b9a('0x5e')][0x0][_0x3b9a('0x5f')]:undefined)||_0x3b9a('0x6a')},{'name':'attrVoiceQueues','value':_0x23528c['attrVoiceQueues']||(_0x23528c['attrs']&&_0x23528c['attrs'][0x1]?_0x23528c[_0x3b9a('0x5e')][0x1][_0x3b9a('0x5f')]:undefined)||[]},{'name':_0x3b9a('0x68'),'value':_0x23528c[_0x3b9a('0x68')]||(_0x23528c[_0x3b9a('0x5e')]&&_0x23528c[_0x3b9a('0x5e')][0x2]?_0x23528c[_0x3b9a('0x5e')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0x3b9a('0x6b'):return[{'name':_0x3b9a('0x6c'),'value':_0x23528c[_0x3b9a('0x6c')]||(_0x23528c['attrs']&&_0x23528c[_0x3b9a('0x5e')][0x0]?_0x23528c[_0x3b9a('0x5e')][0x0]['value']:undefined)||_0x3b9a('0x6a')},{'name':_0x3b9a('0x6d'),'value':_0x23528c[_0x3b9a('0x6d')]||(_0x23528c[_0x3b9a('0x5e')]&&_0x23528c[_0x3b9a('0x5e')][0x1]?_0x23528c[_0x3b9a('0x5e')][0x1][_0x3b9a('0x5f')]:undefined)||null},{'name':'attrSerie3','value':_0x23528c[_0x3b9a('0x6e')]||(_0x23528c[_0x3b9a('0x5e')]&&_0x23528c['attrs'][0x2]?_0x23528c[_0x3b9a('0x5e')][0x2][_0x3b9a('0x5f')]:undefined)||null},{'name':_0x3b9a('0x6f'),'value':_0x23528c['attrVoiceQueues']||(_0x23528c[_0x3b9a('0x5e')]&&_0x23528c[_0x3b9a('0x5e')][0x3]?_0x23528c[_0x3b9a('0x5e')][0x3][_0x3b9a('0x5f')]:undefined)||[]}];case _0x3b9a('0x70'):return[{'name':_0x3b9a('0x71'),'type':_0x23528c['reportType']||(_0x23528c[_0x3b9a('0x5e')]&&_0x23528c[_0x3b9a('0x5e')][0x0]?_0x23528c[_0x3b9a('0x5e')][0x0][_0x3b9a('0x33')]:undefined)||null,'value':_0x23528c['attrReport']||(_0x23528c[_0x3b9a('0x5e')]&&_0x23528c[_0x3b9a('0x5e')][0x0]?_0x23528c[_0x3b9a('0x5e')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x23528c['attrRefresh']||(_0x23528c[_0x3b9a('0x5e')]&&_0x23528c[_0x3b9a('0x5e')][0x1]?_0x23528c[_0x3b9a('0x5e')][0x1][_0x3b9a('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x43b9f8){logger[_0x3b9a('0x56')]('widgetAttributes:\x20%s',JSON[_0x3b9a('0x72')](_0x43b9f8));return[];}}exports[_0x3b9a('0x73')]=function(_0x17b663,_0xe25c7b,_0x2db885){if(_0x17b663[_0x3b9a('0x50')]['id']){delete _0x17b663[_0x3b9a('0x50')]['id'];}return db[_0x3b9a('0x45')][_0x3b9a('0x4e')]({'where':{'id':_0x17b663[_0x3b9a('0x4c')]['id']}})[_0x3b9a('0x28')](handleEntityNotFound(_0xe25c7b,null))[_0x3b9a('0x28')](function(_0x317de3){if(_0x317de3){_0x17b663[_0x3b9a('0x50')][_0x3b9a('0x74')]=_0x317de3['id'];_0x17b663[_0x3b9a('0x50')][_0x3b9a('0x5e')]=widgetAttributes(_0x17b663[_0x3b9a('0x50')]);return db[_0x3b9a('0x75')]['create'](_0x17b663['body']);}})['then'](respondWithResult(_0xe25c7b,null))[_0x3b9a('0x4a')](handleError(_0xe25c7b,null));};exports['getItems']=function(_0x1cdaa6,_0x1ce24e,_0x1bb10b){var _0x4280cc={};var _0x57f6ed={};var _0x39e2df;var _0x544e22;return db[_0x3b9a('0x45')]['findOne']({'where':{'id':_0x1cdaa6[_0x3b9a('0x4c')]['id']}})[_0x3b9a('0x28')](handleEntityNotFound(_0x1ce24e,null))[_0x3b9a('0x28')](function(_0x18e78d){if(_0x18e78d){_0x39e2df=_0x18e78d;_0x57f6ed[_0x3b9a('0x35')]=_[_0x3b9a('0x4d')](db[_0x3b9a('0x75')]['rawAttributes']);_0x57f6ed[_0x3b9a('0x36')]=_['keys'](_0x1cdaa6[_0x3b9a('0x36')]);_0x57f6ed['filters']=_[_0x3b9a('0x38')](_0x57f6ed[_0x3b9a('0x35')],_0x57f6ed[_0x3b9a('0x36')]);_0x4280cc[_0x3b9a('0x3a')]=_[_0x3b9a('0x38')](_0x57f6ed[_0x3b9a('0x35')],qs['fields'](_0x1cdaa6[_0x3b9a('0x36')][_0x3b9a('0x39')]));_0x4280cc[_0x3b9a('0x3a')]=_0x4280cc['attributes'][_0x3b9a('0x3b')]?_0x4280cc[_0x3b9a('0x3a')]:_0x57f6ed[_0x3b9a('0x35')];_0x4280cc[_0x3b9a('0x76')]=qs[_0x3b9a('0x3e')](_0x1cdaa6[_0x3b9a('0x36')][_0x3b9a('0x3e')]);_0x4280cc[_0x3b9a('0x3f')]=qs[_0x3b9a('0x37')](_['pick'](_0x1cdaa6[_0x3b9a('0x36')],_0x57f6ed[_0x3b9a('0x37')]));if(_0x1cdaa6[_0x3b9a('0x36')][_0x3b9a('0x41')]){_0x4280cc[_0x3b9a('0x3f')]=_['merge'](_0x4280cc['where'],{'$or':_[_0x3b9a('0x30')](_0x4280cc[_0x3b9a('0x3a')],function(_0x3ff974){var _0x447815={};_0x447815[_0x3ff974]={'$like':'%'+_0x1cdaa6['query'][_0x3b9a('0x41')]+'%'};return _0x447815;})});}_0x4280cc=_[_0x3b9a('0x42')]({},_0x4280cc,_0x1cdaa6[_0x3b9a('0x44')]);return _0x39e2df['getItems'](_0x4280cc);}})[_0x3b9a('0x28')](function(_0x3a00ee){if(_0x3a00ee){_0x544e22=_0x3a00ee[_0x3b9a('0x3b')];if(!_0x1cdaa6['query'][_0x3b9a('0x3c')](_0x3b9a('0x3d'))){_0x4280cc['limit']=qs[_0x3b9a('0x21')](_0x1cdaa6['query'][_0x3b9a('0x21')]);_0x4280cc['offset']=qs[_0x3b9a('0x20')](_0x1cdaa6[_0x3b9a('0x36')]['offset']);}return _0x39e2df[_0x3b9a('0x77')](_0x4280cc);}})['then'](function(_0x53bfc6){if(_0x53bfc6){return _0x53bfc6?{'count':_0x544e22,'rows':_0x53bfc6}:null;}})[_0x3b9a('0x28')](respondWithResult(_0x1ce24e,null))[_0x3b9a('0x4a')](handleError(_0x1ce24e,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index b612408..b1d19fa 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 _0x45e1=['exports','events','../../mysqldb','Dashboard','save','remove','emit','hasOwnProperty','hook'];(function(_0x3a9df0,_0x4fb575){var _0x40b07c=function(_0x3c3054){while(--_0x3c3054){_0x3a9df0['push'](_0x3a9df0['shift']());}};_0x40b07c(++_0x4fb575);}(_0x45e1,0x1f0));var _0x145e=function(_0x2d10f7,_0x36abd0){_0x2d10f7=_0x2d10f7-0x0;var _0x94c2f7=_0x45e1[_0x2d10f7];return _0x94c2f7;};'use strict';var EventEmitter=require(_0x145e('0x0'));var Dashboard=require(_0x145e('0x1'))['db'][_0x145e('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x145e('0x3'),'afterUpdate':'update','afterDestroy':_0x145e('0x4')};function emitEvent(_0x5dadbd){return function(_0x1d9002,_0x4f46ed,_0x5b5785){DashboardEvents[_0x145e('0x5')](_0x5dadbd+':'+_0x1d9002['id'],_0x1d9002);DashboardEvents[_0x145e('0x5')](_0x5dadbd,_0x1d9002);_0x5b5785(null);};}for(var e in events){if(events[_0x145e('0x6')](e)){var event=events[e];Dashboard[_0x145e('0x7')](e,emitEvent(event));}}module[_0x145e('0x8')]=DashboardEvents; \ No newline at end of file +var _0x1207=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x81ba34,_0x333d88){var _0x285be1=function(_0x580fa4){while(--_0x580fa4){_0x81ba34['push'](_0x81ba34['shift']());}};_0x285be1(++_0x333d88);}(_0x1207,0x172));var _0x7120=function(_0x40df7b,_0x3f1161){_0x40df7b=_0x40df7b-0x0;var _0x2b5912=_0x1207[_0x40df7b];return _0x2b5912;};'use strict';var EventEmitter=require(_0x7120('0x0'));var Dashboard=require(_0x7120('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x7120('0x2')](0x0);var events={'afterCreate':_0x7120('0x3'),'afterUpdate':_0x7120('0x4'),'afterDestroy':_0x7120('0x5')};function emitEvent(_0x3b4792){return function(_0x454661,_0x952162,_0x1a29e6){DashboardEvents[_0x7120('0x6')](_0x3b4792+':'+_0x454661['id'],_0x454661);DashboardEvents['emit'](_0x3b4792,_0x454661);_0x1a29e6(null);};}for(var e in events){if(events[_0x7120('0x7')](e)){var event=events[e];Dashboard[_0x7120('0x8')](e,emitEvent(event));}}module[_0x7120('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 7bfabab..bc027bb 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 _0x7cfb=['moment','bluebird','path','../../config/environment','./dashboard.attributes','define','Dashboard','lodash','util','../../config/logger','api'];(function(_0x2b0984,_0x4ebb73){var _0x32a31c=function(_0x5c82bd){while(--_0x5c82bd){_0x2b0984['push'](_0x2b0984['shift']());}};_0x32a31c(++_0x4ebb73);}(_0x7cfb,0x146));var _0xb7cf=function(_0x3d75c9,_0x4085d7){_0x3d75c9=_0x3d75c9-0x0;var _0x3269e7=_0x7cfb[_0x3d75c9];return _0x3269e7;};'use strict';var _=require(_0xb7cf('0x0'));var util=require(_0xb7cf('0x1'));var logger=require(_0xb7cf('0x2'))(_0xb7cf('0x3'));var moment=require(_0xb7cf('0x4'));var BPromise=require(_0xb7cf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7cf('0x6'));var rimraf=require('rimraf');var config=require(_0xb7cf('0x7'));var attributes=require(_0xb7cf('0x8'));module['exports']=function(_0x3e02fd,_0x40479c){return _0x3e02fd[_0xb7cf('0x9')](_0xb7cf('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x977c=['lodash','util','../../config/logger','bluebird','../../config/environment','exports','Dashboard','dashboards'];(function(_0x3b7250,_0x107752){var _0xb3dd3=function(_0x2f30c2){while(--_0x2f30c2){_0x3b7250['push'](_0x3b7250['shift']());}};_0xb3dd3(++_0x107752);}(_0x977c,0x1e8));var _0xc977=function(_0x4fb3f6,_0x24b211){_0x4fb3f6=_0x4fb3f6-0x0;var _0x4bdc64=_0x977c[_0x4fb3f6];return _0x4bdc64;};'use strict';var _=require(_0xc977('0x0'));var util=require(_0xc977('0x1'));var logger=require(_0xc977('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc977('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc977('0x4'));var attributes=require('./dashboard.attributes');module[_0xc977('0x5')]=function(_0x10b0f7,_0x1ad0be){return _0x10b0f7['define'](_0xc977('0x6'),attributes,{'tableName':_0xc977('0x7'),'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 3c04b80..f92d482 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 _0xd70e=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment'];(function(_0x23e88c,_0x273f7a){var _0xde4edc=function(_0x37155f){while(--_0x37155f){_0x23e88c['push'](_0x23e88c['shift']());}};_0xde4edc(++_0x273f7a);}(_0xd70e,0xbf));var _0xed70=function(_0x1cd538,_0x17bd72){_0x1cd538=_0x1cd538-0x0;var _0x120635=_0xd70e[_0x1cd538];return _0x120635;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xed70('0x0'));var BPromise=require(_0xed70('0x1'));var rs=require(_0xed70('0x2'));var fs=require('fs');var Redis=require(_0xed70('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xed70('0x4'));var logger=require(_0xed70('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xed70('0x6')][_0xed70('0x7')]({'port':0x232a});config[_0xed70('0x8')]=_[_0xed70('0x9')](config[_0xed70('0x8')],{'host':_0xed70('0xa'),'port':0x18eb});var socket=require(_0xed70('0xb'))(new Redis(config[_0xed70('0x8')]));require(_0xed70('0xc'))[_0xed70('0xd')](socket);function respondWithRpcPromise(_0x4a3f10,_0x1fd994,_0x9c79d8){return new BPromise(function(_0x77cf08,_0x416a96){return client['request'](_0x4a3f10,_0x9c79d8)[_0xed70('0xe')](function(_0x393e8b){logger[_0xed70('0xf')](_0xed70('0x10'),_0x1fd994,'request\x20sent');logger[_0xed70('0x11')](_0xed70('0x12'),_0x1fd994,'request\x20sent',JSON[_0xed70('0x13')](_0x393e8b));if(_0x393e8b[_0xed70('0x14')]){if(_0x393e8b[_0xed70('0x14')]['code']===0x1f4){logger[_0xed70('0x14')]('Dashboard,\x20%s,\x20%s',_0x1fd994,_0x393e8b[_0xed70('0x14')][_0xed70('0x15')]);return _0x416a96(_0x393e8b['error'][_0xed70('0x15')]);}logger[_0xed70('0x14')](_0xed70('0x10'),_0x1fd994,_0x393e8b[_0xed70('0x14')][_0xed70('0x15')]);return _0x77cf08(_0x393e8b[_0xed70('0x14')][_0xed70('0x15')]);}else{logger[_0xed70('0xf')]('Dashboard,\x20%s,\x20%s',_0x1fd994,'request\x20sent');_0x77cf08(_0x393e8b[_0xed70('0x16')][_0xed70('0x15')]);}})[_0xed70('0x17')](function(_0x45f707){logger['error'](_0xed70('0x10'),_0x1fd994,_0x45f707);_0x416a96(_0x45f707);});});} \ No newline at end of file +var _0xaa2d=['localhost','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults'];(function(_0x1e0b60,_0x56eb8e){var _0x2cb304=function(_0x9c7929){while(--_0x9c7929){_0x1e0b60['push'](_0x1e0b60['shift']());}};_0x2cb304(++_0x56eb8e);}(_0xaa2d,0x174));var _0xdaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdaa2('0x0'));var util=require(_0xdaa2('0x1'));var moment=require(_0xdaa2('0x2'));var BPromise=require(_0xdaa2('0x3'));var rs=require(_0xdaa2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdaa2('0x5'));var logger=require(_0xdaa2('0x6'))(_0xdaa2('0x7'));var config=require('../../config/environment');var jayson=require(_0xdaa2('0x8'));var client=jayson['client'][_0xdaa2('0x9')]({'port':0x232a});config[_0xdaa2('0xa')]=_[_0xdaa2('0xb')](config[_0xdaa2('0xa')],{'host':_0xdaa2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdaa2('0xa')]));require(_0xdaa2('0xd'))[_0xdaa2('0xe')](socket);function respondWithRpcPromise(_0x13b94c,_0x5a6ad0,_0x4e0da7){return new BPromise(function(_0x272f4b,_0x1a815b){return client[_0xdaa2('0xf')](_0x13b94c,_0x4e0da7)[_0xdaa2('0x10')](function(_0x14a931){logger[_0xdaa2('0x11')](_0xdaa2('0x12'),_0x5a6ad0,_0xdaa2('0x13'));logger[_0xdaa2('0x14')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x5a6ad0,_0xdaa2('0x13'),JSON[_0xdaa2('0x15')](_0x14a931));if(_0x14a931[_0xdaa2('0x16')]){if(_0x14a931[_0xdaa2('0x16')]['code']===0x1f4){logger['error'](_0xdaa2('0x12'),_0x5a6ad0,_0x14a931['error'][_0xdaa2('0x17')]);return _0x1a815b(_0x14a931[_0xdaa2('0x16')][_0xdaa2('0x17')]);}logger[_0xdaa2('0x16')](_0xdaa2('0x12'),_0x5a6ad0,_0x14a931[_0xdaa2('0x16')][_0xdaa2('0x17')]);return _0x272f4b(_0x14a931[_0xdaa2('0x16')][_0xdaa2('0x17')]);}else{logger[_0xdaa2('0x11')](_0xdaa2('0x12'),_0x5a6ad0,_0xdaa2('0x13'));_0x272f4b(_0x14a931['result']['message']);}})['catch'](function(_0x204b78){logger[_0xdaa2('0x16')](_0xdaa2('0x12'),_0x5a6ad0,_0x204b78);_0x1a815b(_0x204b78);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index ddfa7c5..c7d0a66 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 _0x520e=['register','length','dashboard:','./dashboard.events','remove','update','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x520e,0x11b));var _0xe520=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x520e[_0x4243a3];return _0x1b2a33;};'use strict';var DashboardEvents=require(_0xe520('0x0'));var events=['save',_0xe520('0x1'),_0xe520('0x2')];function createListener(_0x3b7870,_0x434c1e){return function(_0x1e2375){_0x434c1e['emit'](_0x3b7870,_0x1e2375);};}function removeListener(_0x3b4c57,_0x4ed64f){return function(){DashboardEvents[_0xe520('0x3')](_0x3b4c57,_0x4ed64f);};}exports[_0xe520('0x4')]=function(_0x1d6e8f){for(var _0x66bb3b=0x0,_0x4bb44d=events[_0xe520('0x5')];_0x66bb3b<_0x4bb44d;_0x66bb3b++){var _0x7e58e4=events[_0x66bb3b];var _0x38d49f=createListener(_0xe520('0x6')+_0x7e58e4,_0x1d6e8f);DashboardEvents['on'](_0x7e58e4,_0x38d49f);}}; \ No newline at end of file +var _0x3a15=['save','remove','removeListener','register','length','./dashboard.events'];(function(_0x586d,_0x5533e8){var _0xa70f36=function(_0x8a351f){while(--_0x8a351f){_0x586d['push'](_0x586d['shift']());}};_0xa70f36(++_0x5533e8);}(_0x3a15,0x1eb));var _0x53a1=function(_0x44c5c1,_0x4d9d55){_0x44c5c1=_0x44c5c1-0x0;var _0x467172=_0x3a15[_0x44c5c1];return _0x467172;};'use strict';var DashboardEvents=require(_0x53a1('0x0'));var events=[_0x53a1('0x1'),_0x53a1('0x2'),'update'];function createListener(_0x516a7a,_0x22b573){return function(_0x32021e){_0x22b573['emit'](_0x516a7a,_0x32021e);};}function removeListener(_0x4a6d8e,_0x3ed70e){return function(){DashboardEvents[_0x53a1('0x3')](_0x4a6d8e,_0x3ed70e);};}exports[_0x53a1('0x4')]=function(_0x5b25f1){for(var _0x2f0ea4=0x0,_0x2d3041=events[_0x53a1('0x5')];_0x2f0ea4<_0x2d3041;_0x2f0ea4++){var _0x4ab760=events[_0x2f0ea4];var _0x43486e=createListener('dashboard:'+_0x4ab760,_0x5b25f1);DashboardEvents['on'](_0x4ab760,_0x43486e);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 7807f1a..1c34a19 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 _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','multer','util','path','express','Router'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0xe706,0xa3));var _0x6e70=function(_0x5df3ab,_0x4a0a7e){_0x5df3ab=_0x5df3ab-0x0;var _0x42cce5=_0xe706[_0x5df3ab];return _0x42cce5;};'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 auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x10')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x10')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['post']('/:id/items',auth[_0x6e70('0xa')](),controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','update'];(function(_0x58bbca,_0x35fd8e){var _0x5cf51d=function(_0xa98bc9){while(--_0xa98bc9){_0x58bbca['push'](_0x58bbca['shift']());}};_0x5cf51d(++_0x35fd8e);}(_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 auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0x10'),auth[_0x3071('0x8')](),controller['clone']);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['delete'](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index c2adda9..d10bf6d 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 _0x5f81=['attrs','stringify','setDataValue','INTEGER','#ffffff','sequelize','squel','lodash','STRING','long','parse'];(function(_0x4f7a7e,_0x2a88ab){var _0x2f8aff=function(_0x4a3420){while(--_0x4a3420){_0x4f7a7e['push'](_0x4f7a7e['shift']());}};_0x2f8aff(++_0x2a88ab);}(_0x5f81,0x12e));var _0x15f8=function(_0x18a551,_0x53ffb2){_0x18a551=_0x18a551-0x0;var _0x5ecf1a=_0x5f81[_0x18a551];return _0x5ecf1a;};'use strict';var Sequelize=require(_0x15f8('0x0'));var squel=require(_0x15f8('0x1'));var _=require(_0x15f8('0x2'));module['exports']={'title':{'type':Sequelize[_0x15f8('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x15f8('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x15f8('0x4')),'get':function(){try{return JSON[_0x15f8('0x5')](this['getDataValue'](_0x15f8('0x6')));}catch(_0x202ada){return[];}},'set':function(_0x1734dd){try{this['setDataValue'](_0x15f8('0x6'),JSON[_0x15f8('0x7')](_0x1734dd));}catch(_0x4f14ef){this[_0x15f8('0x8')]('attrs',JSON[_0x15f8('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x15f8('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x15f8('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x15f8('0x9')]},'background':{'type':Sequelize[_0x15f8('0x3')],'allowNull':![],'defaultValue':_0x15f8('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x15f8('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x15f8('0x3')]}}; \ No newline at end of file +var _0xce85=['attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','long','getDataValue'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0xce85,0x1f4));var _0x5ce8=function(_0x19616a,_0x545c46){_0x19616a=_0x19616a-0x0;var _0x57bfb4=_0xce85[_0x19616a];return _0x57bfb4;};'use strict';var Sequelize=require(_0x5ce8('0x0'));var squel=require(_0x5ce8('0x1'));var _=require(_0x5ce8('0x2'));module[_0x5ce8('0x3')]={'title':{'type':Sequelize[_0x5ce8('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x5ce8('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x5ce8('0x5')),'get':function(){try{return JSON['parse'](this[_0x5ce8('0x6')](_0x5ce8('0x7')));}catch(_0x109c61){return[];}},'set':function(_0x513495){try{this[_0x5ce8('0x8')](_0x5ce8('0x7'),JSON[_0x5ce8('0x9')](_0x513495));}catch(_0x2a397d){this[_0x5ce8('0x8')]('attrs',JSON[_0x5ce8('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x5ce8('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5ce8('0xa')]},'col':{'type':Sequelize[_0x5ce8('0xa')]},'background':{'type':Sequelize[_0x5ce8('0x4')],'allowNull':![],'defaultValue':_0x5ce8('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5ce8('0x4')],'allowNull':![],'defaultValue':_0x5ce8('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index fce85ae..2d99614 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 _0x8f95=['attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','sendStatus','end','status','json','count','offset','limit','set','apply','reject','update','destroy','then','error','stack','name','send','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','multibar-chart'];(function(_0x41924f,_0x2d277e){var _0x5ec299=function(_0x3af9ef){while(--_0x3af9ef){_0x41924f['push'](_0x41924f['shift']());}};_0x5ec299(++_0x2d277e);}(_0x8f95,0xba));var _0x58f9=function(_0x4496ee,_0x211bab){_0x4496ee=_0x4496ee-0x0;var _0x37dbbf=_0x8f95[_0x4496ee];return _0x37dbbf;};'use strict';var pdf=require(_0x58f9('0x0'));var emlformat=require(_0x58f9('0x1'));var rimraf=require(_0x58f9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x58f9('0x3'));var moment=require(_0x58f9('0x4'));var BPromise=require(_0x58f9('0x5'));var Mustache=require(_0x58f9('0x6'));var util=require(_0x58f9('0x7'));var path=require(_0x58f9('0x8'));var sox=require('sox');var csv=require(_0x58f9('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x58f9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x58f9('0xb'));var deskjs=require(_0x58f9('0xc'));var toCsv=require(_0x58f9('0x9'));var querystring=require(_0x58f9('0xd'));var Papa=require('papaparse');var Redis=require(_0x58f9('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x58f9('0xf'));var hardwareService=require(_0x58f9('0x10'));var logger=require(_0x58f9('0x11'))(_0x58f9('0x12'));var utils=require(_0x58f9('0x13'));var config=require(_0x58f9('0x14'));var db=require('../../mysqldb')['db'];config[_0x58f9('0x15')]=_[_0x58f9('0x16')](config[_0x58f9('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x58f9('0x17'))(new Redis(config[_0x58f9('0x15')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0xafec47,_0x4f389b){_0x4f389b=_0x4f389b||0xcc;return function(_0x537486){if(_0x537486){return _0xafec47[_0x58f9('0x18')](_0x4f389b);}return _0xafec47['status'](_0x4f389b)[_0x58f9('0x19')]();};}function respondWithResult(_0x46ded6,_0x2813dc){_0x2813dc=_0x2813dc||0xc8;return function(_0x585928){if(_0x585928){return _0x46ded6[_0x58f9('0x1a')](_0x2813dc)[_0x58f9('0x1b')](_0x585928);}};}function respondWithFilteredResult(_0x5b77f9,_0x4f8588){return function(_0x2c0ce9){if(_0x2c0ce9){var _0x5e1695=_0x2c0ce9[_0x58f9('0x1c')],_0x315d15=_0x4f8588[_0x58f9('0x1d')],_0x3adcc5=_0x4f8588[_0x58f9('0x1d')]+_0x4f8588[_0x58f9('0x1e')],_0x4b9a86;if(_0x3adcc5>=_0x5e1695){_0x3adcc5=_0x5e1695;_0x4b9a86=0xc8;}else{_0x4b9a86=0xce;}_0x5b77f9[_0x58f9('0x1a')](_0x4b9a86);return _0x5b77f9[_0x58f9('0x1f')]('Content-Range',_0x315d15+'-'+_0x3adcc5+'/'+_0x5e1695)['json'](_0x2c0ce9);}return null;};}function patchUpdates(_0x5c2898){return function(_0x7e1304){try{jsonpatch[_0x58f9('0x20')](_0x7e1304,_0x5c2898,!![]);}catch(_0x58391a){return BPromise[_0x58f9('0x21')](_0x58391a);}return _0x7e1304['save']();};}function saveUpdates(_0x2f3400,_0x47cb5c){return function(_0x36fd2a){if(_0x36fd2a){return _0x36fd2a[_0x58f9('0x22')](_0x2f3400)['then'](function(_0x2da894){return _0x2da894;});}return null;};}function removeEntity(_0x5b9adb,_0x5df737){return function(_0x12968a){if(_0x12968a){return _0x12968a[_0x58f9('0x23')]()[_0x58f9('0x24')](function(){_0x5b9adb[_0x58f9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bc6c3,_0x1d5a76){return function(_0x11ec17){if(!_0x11ec17){_0x3bc6c3[_0x58f9('0x18')](0x194);}return _0x11ec17;};}function handleError(_0x246d2f,_0x2c03db){_0x2c03db=_0x2c03db||0x1f4;return function(_0xdd29e0){logger[_0x58f9('0x25')](_0xdd29e0[_0x58f9('0x26')]);if(_0xdd29e0[_0x58f9('0x27')]){delete _0xdd29e0['name'];}_0x246d2f[_0x58f9('0x1a')](_0x2c03db)[_0x58f9('0x28')](_0xdd29e0);};}exports['show']=function(_0x57074b,_0x4c01b8){var _0x14436c={'raw':![],'where':{'id':_0x57074b[_0x58f9('0x29')]['id']}},_0x2885e6={};_0x2885e6[_0x58f9('0x2a')]=_[_0x58f9('0x2b')](db[_0x58f9('0x2c')][_0x58f9('0x2d')]);_0x2885e6[_0x58f9('0x2e')]=_[_0x58f9('0x2b')](_0x57074b['query']);_0x2885e6[_0x58f9('0x2f')]=_[_0x58f9('0x30')](_0x2885e6[_0x58f9('0x2a')],_0x2885e6[_0x58f9('0x2e')]);_0x14436c[_0x58f9('0x31')]=_[_0x58f9('0x30')](_0x2885e6[_0x58f9('0x2a')],qs['fields'](_0x57074b[_0x58f9('0x2e')][_0x58f9('0x32')]));_0x14436c[_0x58f9('0x31')]=_0x14436c[_0x58f9('0x31')][_0x58f9('0x33')]?_0x14436c[_0x58f9('0x31')]:_0x2885e6['model'];if(_0x57074b['query']['includeAll']){_0x14436c[_0x58f9('0x34')]=[{'all':!![]}];}_0x14436c=_[_0x58f9('0x35')]({},_0x14436c,_0x57074b[_0x58f9('0x36')]);return db['DashboardItem'][_0x58f9('0x37')](_0x14436c)[_0x58f9('0x24')](handleEntityNotFound(_0x4c01b8,null))[_0x58f9('0x24')](respondWithResult(_0x4c01b8,null))[_0x58f9('0x38')](handleError(_0x4c01b8,null));};exports['destroy']=function(_0x1a84e4,_0x13df8d){return db[_0x58f9('0x2c')][_0x58f9('0x37')]({'where':{'id':_0x1a84e4['params']['id']}})[_0x58f9('0x24')](handleEntityNotFound(_0x13df8d,null))[_0x58f9('0x24')](removeEntity(_0x13df8d,null))[_0x58f9('0x38')](handleError(_0x13df8d,null));};function widgetAttributes(_0x27faf9){try{switch(_0x27faf9[_0x58f9('0x39')]){case _0x58f9('0x3a'):return[{'name':_0x58f9('0x3b'),'value':_0x27faf9[_0x58f9('0x3b')]||(_0x27faf9[_0x58f9('0x3c')]&&_0x27faf9[_0x58f9('0x3c')][0x0]?_0x27faf9[_0x58f9('0x3c')][0x0][_0x58f9('0x3d')]:undefined)||_0x58f9('0x3e')}];case _0x58f9('0x3f'):return[{'name':_0x58f9('0x40'),'value':_0x27faf9[_0x58f9('0x40')]||(_0x27faf9[_0x58f9('0x3c')]&&_0x27faf9[_0x58f9('0x3c')][0x0]?_0x27faf9['attrs'][0x0]['value']:undefined)||''}];case _0x58f9('0x41'):return[{'name':_0x58f9('0x42'),'value':_0x27faf9['attrHourFormat']||(_0x27faf9[_0x58f9('0x3c')]&&_0x27faf9[_0x58f9('0x3c')][0x0]?_0x27faf9[_0x58f9('0x3c')][0x0]['value']:undefined)||_0x58f9('0x43')},{'name':'attrTimezone','value':_0x27faf9[_0x58f9('0x44')]||(_0x27faf9[_0x58f9('0x3c')]&&_0x27faf9[_0x58f9('0x3c')][0x1]?_0x27faf9['attrs'][0x1][_0x58f9('0x3d')]:undefined)||_0x58f9('0x45')},{'name':_0x58f9('0x46'),'value':_0x27faf9[_0x58f9('0x46')]||(_0x27faf9[_0x58f9('0x3c')]&&_0x27faf9[_0x58f9('0x3c')][0x2]?_0x27faf9[_0x58f9('0x3c')][0x2]['value']:undefined)||0xc}];case _0x58f9('0x47'):return[{'name':_0x58f9('0x48'),'value':_0x27faf9[_0x58f9('0x48')]||(_0x27faf9['attrs']&&_0x27faf9[_0x58f9('0x3c')][0x0]?_0x27faf9['attrs'][0x0][_0x58f9('0x3d')]:undefined)||_0x58f9('0x49')},{'name':'attrVoiceQueues','value':_0x27faf9['attrVoiceQueues']||(_0x27faf9[_0x58f9('0x3c')]&&_0x27faf9['attrs'][0x1]?_0x27faf9[_0x58f9('0x3c')][0x1][_0x58f9('0x3d')]:undefined)||[]},{'name':_0x58f9('0x46'),'value':_0x27faf9[_0x58f9('0x46')]||(_0x27faf9[_0x58f9('0x3c')]&&_0x27faf9['attrs'][0x2]?_0x27faf9[_0x58f9('0x3c')][0x2][_0x58f9('0x3d')]:undefined)||0x14}];case _0x58f9('0x4a'):case'pie-chart':return[{'name':_0x58f9('0x4b'),'value':_0x27faf9[_0x58f9('0x4b')]||(_0x27faf9[_0x58f9('0x3c')]&&_0x27faf9[_0x58f9('0x3c')][0x0]?_0x27faf9['attrs'][0x0][_0x58f9('0x3d')]:undefined)||_0x58f9('0x49')},{'name':'attrSerie2','value':_0x27faf9[_0x58f9('0x4c')]||(_0x27faf9['attrs']&&_0x27faf9['attrs'][0x1]?_0x27faf9[_0x58f9('0x3c')][0x1][_0x58f9('0x3d')]:undefined)||null},{'name':_0x58f9('0x4d'),'value':_0x27faf9['attrSerie3']||(_0x27faf9['attrs']&&_0x27faf9['attrs'][0x2]?_0x27faf9[_0x58f9('0x3c')][0x2]['value']:undefined)||null},{'name':_0x58f9('0x4e'),'value':_0x27faf9[_0x58f9('0x4e')]||(_0x27faf9['attrs']&&_0x27faf9[_0x58f9('0x3c')][0x3]?_0x27faf9[_0x58f9('0x3c')][0x3][_0x58f9('0x3d')]:undefined)||[]}];case _0x58f9('0x4f'):return[{'name':_0x58f9('0x50'),'type':_0x27faf9[_0x58f9('0x51')]||(_0x27faf9['attrs']&&_0x27faf9['attrs'][0x0]?_0x27faf9[_0x58f9('0x3c')][0x0][_0x58f9('0x39')]:undefined)||null,'value':_0x27faf9[_0x58f9('0x50')]||(_0x27faf9[_0x58f9('0x3c')]&&_0x27faf9[_0x58f9('0x3c')][0x0]?_0x27faf9[_0x58f9('0x3c')][0x0][_0x58f9('0x3d')]:undefined)||null},{'name':_0x58f9('0x52'),'value':_0x27faf9[_0x58f9('0x52')]||(_0x27faf9['attrs']&&_0x27faf9[_0x58f9('0x3c')][0x1]?_0x27faf9['attrs'][0x1][_0x58f9('0x3d')]:undefined)||0x0}];default:return[];}}catch(_0x46a28e){logger[_0x58f9('0x25')](_0x58f9('0x53'),JSON[_0x58f9('0x54')](_0x46a28e));return[];}}exports[_0x58f9('0x55')]=function(_0x56b1e2,_0x21bc78){if(_0x56b1e2['body']){_0x56b1e2[_0x58f9('0x56')][_0x58f9('0x3c')]=widgetAttributes(_0x56b1e2['body']);}return db[_0x58f9('0x2c')]['create'](_0x56b1e2[_0x58f9('0x56')],{})[_0x58f9('0x24')](respondWithResult(_0x21bc78,0xc9))[_0x58f9('0x38')](handleError(_0x21bc78,null));};exports[_0x58f9('0x22')]=function(_0x568ea1,_0x4fc1d0){if(_0x568ea1['body']['id']){delete _0x568ea1['body']['id'];}_0x568ea1[_0x58f9('0x56')][_0x58f9('0x3c')]=widgetAttributes(_0x568ea1['body']);return db[_0x58f9('0x2c')][_0x58f9('0x37')]({'where':{'id':_0x568ea1[_0x58f9('0x29')]['id']}})[_0x58f9('0x24')](handleEntityNotFound(_0x4fc1d0,null))[_0x58f9('0x24')](saveUpdates(_0x568ea1[_0x58f9('0x56')],null))['then'](respondWithResult(_0x4fc1d0,null))[_0x58f9('0x38')](handleError(_0x4fc1d0,null));}; \ No newline at end of file +var _0xc30c=['https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','total','attrVoiceQueues','attrFontSize','multibar-chart','attrSerie1','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','destroy','then','error','stack','name','show','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','find','catch','DashboardItem','params','type','iframe','attrUrl','attrs','value'];(function(_0xca01fe,_0x5ce7d4){var _0x2b46d9=function(_0x1f612e){while(--_0x1f612e){_0xca01fe['push'](_0xca01fe['shift']());}};_0x2b46d9(++_0x5ce7d4);}(_0xc30c,0x103));var _0xcc30=function(_0x4aa9b4,_0x56be72){_0x4aa9b4=_0x4aa9b4-0x0;var _0x124e50=_0xc30c[_0x4aa9b4];return _0x124e50;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcc30('0x0'));var rimraf=require(_0xcc30('0x1'));var zipdir=require(_0xcc30('0x2'));var jsonpatch=require(_0xcc30('0x3'));var rp=require('request-promise');var moment=require(_0xcc30('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcc30('0x5'));var util=require(_0xcc30('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xcc30('0x7'));var ejs=require(_0xcc30('0x8'));var fs=require('fs');var _=require(_0xcc30('0x9'));var squel=require('squel');var crypto=require(_0xcc30('0xa'));var jsforce=require(_0xcc30('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcc30('0xc'));var Redis=require('ioredis');var authService=require(_0xcc30('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xcc30('0xe'));var hardwareService=require(_0xcc30('0xf'));var logger=require(_0xcc30('0x10'))('api');var utils=require(_0xcc30('0x11'));var config=require(_0xcc30('0x12'));var db=require(_0xcc30('0x13'))['db'];config['redis']=_['defaults'](config[_0xcc30('0x14')],{'host':_0xcc30('0x15'),'port':0x18eb});var socket=require(_0xcc30('0x16'))(new Redis(config[_0xcc30('0x14')]));require('./dashboardItem.socket')[_0xcc30('0x17')](socket);function respondWithStatusCode(_0x5a0781,_0xdbfd94){_0xdbfd94=_0xdbfd94||0xcc;return function(_0x549223){if(_0x549223){return _0x5a0781[_0xcc30('0x18')](_0xdbfd94);}return _0x5a0781[_0xcc30('0x19')](_0xdbfd94)[_0xcc30('0x1a')]();};}function respondWithResult(_0x1600fe,_0x2620fc){_0x2620fc=_0x2620fc||0xc8;return function(_0x42c741){if(_0x42c741){return _0x1600fe[_0xcc30('0x19')](_0x2620fc)[_0xcc30('0x1b')](_0x42c741);}};}function respondWithFilteredResult(_0x577f25,_0x3fb70a){return function(_0x483c6b){if(_0x483c6b){var _0x3665e4=_0x483c6b[_0xcc30('0x1c')],_0x4eda24=_0x3fb70a[_0xcc30('0x1d')],_0x3a5380=_0x3fb70a['offset']+_0x3fb70a['limit'],_0x1f2e55;if(_0x3a5380>=_0x3665e4){_0x3a5380=_0x3665e4;_0x1f2e55=0xc8;}else{_0x1f2e55=0xce;}_0x577f25[_0xcc30('0x19')](_0x1f2e55);return _0x577f25[_0xcc30('0x1e')](_0xcc30('0x1f'),_0x4eda24+'-'+_0x3a5380+'/'+_0x3665e4)['json'](_0x483c6b);}return null;};}function patchUpdates(_0xb0ee21){return function(_0x2ca660){try{jsonpatch[_0xcc30('0x20')](_0x2ca660,_0xb0ee21,!![]);}catch(_0x4a5d7f){return BPromise[_0xcc30('0x21')](_0x4a5d7f);}return _0x2ca660['save']();};}function saveUpdates(_0x4d7e04,_0x1fde20){return function(_0x18cbbe){if(_0x18cbbe){return _0x18cbbe['update'](_0x4d7e04)['then'](function(_0x513609){return _0x513609;});}return null;};}function removeEntity(_0x346322,_0x3e9abb){return function(_0x2b951a){if(_0x2b951a){return _0x2b951a[_0xcc30('0x22')]()[_0xcc30('0x23')](function(){_0x346322['status'](0xcc)[_0xcc30('0x1a')]();});}};}function handleEntityNotFound(_0x1f47a8,_0x2ec138){return function(_0x30c30f){if(!_0x30c30f){_0x1f47a8['sendStatus'](0x194);}return _0x30c30f;};}function handleError(_0x290860,_0x48d288){_0x48d288=_0x48d288||0x1f4;return function(_0xef8f77){logger[_0xcc30('0x24')](_0xef8f77[_0xcc30('0x25')]);if(_0xef8f77[_0xcc30('0x26')]){delete _0xef8f77['name'];}_0x290860[_0xcc30('0x19')](_0x48d288)['send'](_0xef8f77);};}exports[_0xcc30('0x27')]=function(_0x5362fe,_0x1da440){var _0x8b0b16={'raw':![],'where':{'id':_0x5362fe['params']['id']}},_0x2d154d={};_0x2d154d[_0xcc30('0x28')]=_[_0xcc30('0x29')](db['DashboardItem'][_0xcc30('0x2a')]);_0x2d154d[_0xcc30('0x2b')]=_[_0xcc30('0x29')](_0x5362fe['query']);_0x2d154d[_0xcc30('0x2c')]=_['intersection'](_0x2d154d['model'],_0x2d154d[_0xcc30('0x2b')]);_0x8b0b16['attributes']=_[_0xcc30('0x2d')](_0x2d154d['model'],qs[_0xcc30('0x2e')](_0x5362fe[_0xcc30('0x2b')]['fields']));_0x8b0b16[_0xcc30('0x2f')]=_0x8b0b16['attributes'][_0xcc30('0x30')]?_0x8b0b16[_0xcc30('0x2f')]:_0x2d154d[_0xcc30('0x28')];if(_0x5362fe[_0xcc30('0x2b')][_0xcc30('0x31')]){_0x8b0b16[_0xcc30('0x32')]=[{'all':!![]}];}_0x8b0b16=_[_0xcc30('0x33')]({},_0x8b0b16,_0x5362fe['options']);return db['DashboardItem'][_0xcc30('0x34')](_0x8b0b16)[_0xcc30('0x23')](handleEntityNotFound(_0x1da440,null))[_0xcc30('0x23')](respondWithResult(_0x1da440,null))[_0xcc30('0x35')](handleError(_0x1da440,null));};exports[_0xcc30('0x22')]=function(_0x30f752,_0x5f3c37){return db[_0xcc30('0x36')][_0xcc30('0x34')]({'where':{'id':_0x30f752[_0xcc30('0x37')]['id']}})[_0xcc30('0x23')](handleEntityNotFound(_0x5f3c37,null))[_0xcc30('0x23')](removeEntity(_0x5f3c37,null))[_0xcc30('0x35')](handleError(_0x5f3c37,null));};function widgetAttributes(_0x24c6d5){try{switch(_0x24c6d5[_0xcc30('0x38')]){case _0xcc30('0x39'):return[{'name':_0xcc30('0x3a'),'value':_0x24c6d5[_0xcc30('0x3a')]||(_0x24c6d5[_0xcc30('0x3b')]&&_0x24c6d5['attrs'][0x0]?_0x24c6d5[_0xcc30('0x3b')][0x0][_0xcc30('0x3c')]:undefined)||_0xcc30('0x3d')}];case'custom':return[{'name':'attrPath','value':_0x24c6d5[_0xcc30('0x3e')]||(_0x24c6d5['attrs']&&_0x24c6d5[_0xcc30('0x3b')][0x0]?_0x24c6d5['attrs'][0x0]['value']:undefined)||''}];case _0xcc30('0x3f'):return[{'name':_0xcc30('0x40'),'value':_0x24c6d5[_0xcc30('0x40')]||(_0x24c6d5[_0xcc30('0x3b')]&&_0x24c6d5[_0xcc30('0x3b')][0x0]?_0x24c6d5['attrs'][0x0][_0xcc30('0x3c')]:undefined)||'HH:mm:ss'},{'name':_0xcc30('0x41'),'value':_0x24c6d5['attrTimezone']||(_0x24c6d5[_0xcc30('0x3b')]&&_0x24c6d5[_0xcc30('0x3b')][0x1]?_0x24c6d5[_0xcc30('0x3b')][0x1]['value']:undefined)||_0xcc30('0x42')},{'name':'attrFontSize','value':_0x24c6d5['attrFontSize']||(_0x24c6d5[_0xcc30('0x3b')]&&_0x24c6d5['attrs'][0x2]?_0x24c6d5[_0xcc30('0x3b')][0x2][_0xcc30('0x3c')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x24c6d5['attrMetric']||(_0x24c6d5['attrs']&&_0x24c6d5['attrs'][0x0]?_0x24c6d5[_0xcc30('0x3b')][0x0][_0xcc30('0x3c')]:undefined)||_0xcc30('0x43')},{'name':_0xcc30('0x44'),'value':_0x24c6d5[_0xcc30('0x44')]||(_0x24c6d5[_0xcc30('0x3b')]&&_0x24c6d5['attrs'][0x1]?_0x24c6d5['attrs'][0x1][_0xcc30('0x3c')]:undefined)||[]},{'name':'attrFontSize','value':_0x24c6d5[_0xcc30('0x45')]||(_0x24c6d5['attrs']&&_0x24c6d5[_0xcc30('0x3b')][0x2]?_0x24c6d5[_0xcc30('0x3b')][0x2][_0xcc30('0x3c')]:undefined)||0x14}];case _0xcc30('0x46'):case'pie-chart':return[{'name':_0xcc30('0x47'),'value':_0x24c6d5[_0xcc30('0x47')]||(_0x24c6d5['attrs']&&_0x24c6d5[_0xcc30('0x3b')][0x0]?_0x24c6d5[_0xcc30('0x3b')][0x0]['value']:undefined)||_0xcc30('0x43')},{'name':'attrSerie2','value':_0x24c6d5['attrSerie2']||(_0x24c6d5[_0xcc30('0x3b')]&&_0x24c6d5[_0xcc30('0x3b')][0x1]?_0x24c6d5[_0xcc30('0x3b')][0x1][_0xcc30('0x3c')]:undefined)||null},{'name':_0xcc30('0x48'),'value':_0x24c6d5['attrSerie3']||(_0x24c6d5[_0xcc30('0x3b')]&&_0x24c6d5['attrs'][0x2]?_0x24c6d5[_0xcc30('0x3b')][0x2][_0xcc30('0x3c')]:undefined)||null},{'name':_0xcc30('0x44'),'value':_0x24c6d5[_0xcc30('0x44')]||(_0x24c6d5[_0xcc30('0x3b')]&&_0x24c6d5['attrs'][0x3]?_0x24c6d5[_0xcc30('0x3b')][0x3]['value']:undefined)||[]}];case _0xcc30('0x49'):return[{'name':_0xcc30('0x4a'),'type':_0x24c6d5[_0xcc30('0x4b')]||(_0x24c6d5[_0xcc30('0x3b')]&&_0x24c6d5['attrs'][0x0]?_0x24c6d5[_0xcc30('0x3b')][0x0][_0xcc30('0x38')]:undefined)||null,'value':_0x24c6d5['attrReport']||(_0x24c6d5[_0xcc30('0x3b')]&&_0x24c6d5[_0xcc30('0x3b')][0x0]?_0x24c6d5[_0xcc30('0x3b')][0x0][_0xcc30('0x3c')]:undefined)||null},{'name':_0xcc30('0x4c'),'value':_0x24c6d5[_0xcc30('0x4c')]||(_0x24c6d5[_0xcc30('0x3b')]&&_0x24c6d5[_0xcc30('0x3b')][0x1]?_0x24c6d5[_0xcc30('0x3b')][0x1][_0xcc30('0x3c')]:undefined)||0x0}];default:return[];}}catch(_0x3a5651){logger['error'](_0xcc30('0x4d'),JSON['stringify'](_0x3a5651));return[];}}exports[_0xcc30('0x4e')]=function(_0x2d772e,_0x15e7c8){if(_0x2d772e['body']){_0x2d772e['body']['attrs']=widgetAttributes(_0x2d772e[_0xcc30('0x4f')]);}return db[_0xcc30('0x36')][_0xcc30('0x4e')](_0x2d772e[_0xcc30('0x4f')],{})['then'](respondWithResult(_0x15e7c8,0xc9))['catch'](handleError(_0x15e7c8,null));};exports['update']=function(_0x204fb3,_0x48e59c){if(_0x204fb3[_0xcc30('0x4f')]['id']){delete _0x204fb3['body']['id'];}_0x204fb3[_0xcc30('0x4f')][_0xcc30('0x3b')]=widgetAttributes(_0x204fb3[_0xcc30('0x4f')]);return db[_0xcc30('0x36')][_0xcc30('0x34')]({'where':{'id':_0x204fb3[_0xcc30('0x37')]['id']}})[_0xcc30('0x23')](handleEntityNotFound(_0x48e59c,null))[_0xcc30('0x23')](saveUpdates(_0x204fb3['body'],null))[_0xcc30('0x23')](respondWithResult(_0x48e59c,null))[_0xcc30('0x35')](handleError(_0x48e59c,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 7a63a5e..fd49d7f 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 _0xb280=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','DashboardItem'];(function(_0x5848d2,_0x27a3c2){var _0xcf3958=function(_0x4b7ea7){while(--_0x4b7ea7){_0x5848d2['push'](_0x5848d2['shift']());}};_0xcf3958(++_0x27a3c2);}(_0xb280,0x148));var _0x0b28=function(_0x3ecb54,_0x308242){_0x3ecb54=_0x3ecb54-0x0;var _0x256777=_0xb280[_0x3ecb54];return _0x256777;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x0b28('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0b28('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0b28('0x2')};function emitEvent(_0x2f9500){return function(_0x54181d,_0x4b18b9,_0x3b3904){DashboardItemEvents['emit'](_0x2f9500+':'+_0x54181d['id'],_0x54181d);DashboardItemEvents[_0x0b28('0x3')](_0x2f9500,_0x54181d);_0x3b3904(null);};}for(var e in events){if(events[_0x0b28('0x4')](e)){var event=events[e];DashboardItem[_0x0b28('0x5')](e,emitEvent(event));}}module[_0x0b28('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0xb941=['DashboardItem','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0xb941,0x7e));var _0x1b94=function(_0x105cb7,_0x5c3dcd){_0x105cb7=_0x105cb7-0x0;var _0x275b8d=_0xb941[_0x105cb7];return _0x275b8d;};'use strict';var EventEmitter=require(_0x1b94('0x0'));var DashboardItem=require(_0x1b94('0x1'))['db'][_0x1b94('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1b94('0x3'),'afterUpdate':_0x1b94('0x4'),'afterDestroy':'remove'};function emitEvent(_0x51834b){return function(_0x456990,_0x135895,_0x2480d9){DashboardItemEvents[_0x1b94('0x5')](_0x51834b+':'+_0x456990['id'],_0x456990);DashboardItemEvents[_0x1b94('0x5')](_0x51834b,_0x456990);_0x2480d9(null);};}for(var e in events){if(events[_0x1b94('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x1b94('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index b141971..d55121c 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 _0xc05b=['./dashboardItem.attributes','define','DashboardItem','dashboard_items','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x2a5f37,_0x34adf4){var _0x37789a=function(_0x1a5aee){while(--_0x1a5aee){_0x2a5f37['push'](_0x2a5f37['shift']());}};_0x37789a(++_0x34adf4);}(_0xc05b,0x1d0));var _0xbc05=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0xc05b[_0x13137e];return _0x346261;};'use strict';var _=require('lodash');var util=require(_0xbc05('0x0'));var logger=require(_0xbc05('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbc05('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc05('0x3'));var rimraf=require(_0xbc05('0x4'));var config=require(_0xbc05('0x5'));var attributes=require(_0xbc05('0x6'));module['exports']=function(_0x324af7,_0x521d42){return _0x324af7[_0xbc05('0x7')](_0xbc05('0x8'),attributes,{'tableName':_0xbc05('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8d5=['dashboard_items','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','DashboardItem'];(function(_0x2e5a71,_0x1e825b){var _0x1bb869=function(_0xbf8be0){while(--_0xbf8be0){_0x2e5a71['push'](_0x2e5a71['shift']());}};_0x1bb869(++_0x1e825b);}(_0xf8d5,0x109));var _0x5f8d=function(_0x3ef886,_0x38a802){_0x3ef886=_0x3ef886-0x0;var _0x6e2589=_0xf8d5[_0x3ef886];return _0x6e2589;};'use strict';var _=require(_0x5f8d('0x0'));var util=require(_0x5f8d('0x1'));var logger=require('../../config/logger')(_0x5f8d('0x2'));var moment=require(_0x5f8d('0x3'));var BPromise=require(_0x5f8d('0x4'));var rp=require(_0x5f8d('0x5'));var fs=require('fs');var path=require(_0x5f8d('0x6'));var rimraf=require('rimraf');var config=require(_0x5f8d('0x7'));var attributes=require('./dashboardItem.attributes');module[_0x5f8d('0x8')]=function(_0x1d579b,_0x5d034a){return _0x1d579b['define'](_0x5f8d('0x9'),attributes,{'tableName':_0x5f8d('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 b761ccc..5b1722e 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 _0x5032=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0x5032,0x1a7));var _0x2503=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5032[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x2503('0x0'));var util=require(_0x2503('0x1'));var moment=require('moment');var BPromise=require(_0x2503('0x2'));var rs=require(_0x2503('0x3'));var fs=require('fs');var Redis=require(_0x2503('0x4'));var db=require(_0x2503('0x5'))['db'];var utils=require(_0x2503('0x6'));var logger=require(_0x2503('0x7'))(_0x2503('0x8'));var config=require(_0x2503('0x9'));var jayson=require(_0x2503('0xa'));var client=jayson['client'][_0x2503('0xb')]({'port':0x232a});config[_0x2503('0xc')]=_[_0x2503('0xd')](config[_0x2503('0xc')],{'host':_0x2503('0xe'),'port':0x18eb});var socket=require(_0x2503('0xf'))(new Redis(config[_0x2503('0xc')]));require(_0x2503('0x10'))[_0x2503('0x11')](socket);function respondWithRpcPromise(_0x36778d,_0x277325,_0x432110){return new BPromise(function(_0x6ba462,_0x30728b){return client['request'](_0x36778d,_0x432110)[_0x2503('0x12')](function(_0x11ce06){logger[_0x2503('0x13')](_0x2503('0x14'),_0x277325,_0x2503('0x15'));logger[_0x2503('0x16')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x277325,_0x2503('0x15'),JSON['stringify'](_0x11ce06));if(_0x11ce06[_0x2503('0x17')]){if(_0x11ce06[_0x2503('0x17')][_0x2503('0x18')]===0x1f4){logger[_0x2503('0x17')]('DashboardItem,\x20%s,\x20%s',_0x277325,_0x11ce06['error'][_0x2503('0x19')]);return _0x30728b(_0x11ce06['error'][_0x2503('0x19')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x277325,_0x11ce06['error'][_0x2503('0x19')]);return _0x6ba462(_0x11ce06[_0x2503('0x17')][_0x2503('0x19')]);}else{logger[_0x2503('0x13')](_0x2503('0x14'),_0x277325,_0x2503('0x15'));_0x6ba462(_0x11ce06[_0x2503('0x1a')][_0x2503('0x19')]);}})[_0x2503('0x1b')](function(_0x60ec33){logger[_0x2503('0x17')](_0x2503('0x14'),_0x277325,_0x60ec33);_0x30728b(_0x60ec33);});});} \ No newline at end of file +var _0x3c6e=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','DashboardItem,\x20%s,\x20%s','message','info','result','catch','lodash','moment'];(function(_0x5dc609,_0x2af609){var _0x19d74c=function(_0x3160e9){while(--_0x3160e9){_0x5dc609['push'](_0x5dc609['shift']());}};_0x19d74c(++_0x2af609);}(_0x3c6e,0x127));var _0xe3c6=function(_0x34d67a,_0x16fbcd){_0x34d67a=_0x34d67a-0x0;var _0x3a5600=_0x3c6e[_0x34d67a];return _0x3a5600;};'use strict';var _=require(_0xe3c6('0x0'));var util=require('util');var moment=require(_0xe3c6('0x1'));var BPromise=require('bluebird');var rs=require(_0xe3c6('0x2'));var fs=require('fs');var Redis=require(_0xe3c6('0x3'));var db=require(_0xe3c6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3c6('0x5'))(_0xe3c6('0x6'));var config=require(_0xe3c6('0x7'));var jayson=require(_0xe3c6('0x8'));var client=jayson[_0xe3c6('0x9')][_0xe3c6('0xa')]({'port':0x232a});config[_0xe3c6('0xb')]=_[_0xe3c6('0xc')](config[_0xe3c6('0xb')],{'host':_0xe3c6('0xd'),'port':0x18eb});var socket=require(_0xe3c6('0xe'))(new Redis(config[_0xe3c6('0xb')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x1380f4,_0x1c974d,_0x413def){return new BPromise(function(_0x29870e,_0x100b36){return client[_0xe3c6('0xf')](_0x1380f4,_0x413def)[_0xe3c6('0x10')](function(_0x17dcf4){logger['info']('DashboardItem,\x20%s,\x20%s',_0x1c974d,_0xe3c6('0x11'));logger[_0xe3c6('0x12')](_0xe3c6('0x13'),_0x1c974d,_0xe3c6('0x11'),JSON[_0xe3c6('0x14')](_0x17dcf4));if(_0x17dcf4[_0xe3c6('0x15')]){if(_0x17dcf4[_0xe3c6('0x15')]['code']===0x1f4){logger['error'](_0xe3c6('0x16'),_0x1c974d,_0x17dcf4['error'][_0xe3c6('0x17')]);return _0x100b36(_0x17dcf4[_0xe3c6('0x15')][_0xe3c6('0x17')]);}logger[_0xe3c6('0x15')]('DashboardItem,\x20%s,\x20%s',_0x1c974d,_0x17dcf4[_0xe3c6('0x15')]['message']);return _0x29870e(_0x17dcf4[_0xe3c6('0x15')]['message']);}else{logger[_0xe3c6('0x18')](_0xe3c6('0x16'),_0x1c974d,_0xe3c6('0x11'));_0x29870e(_0x17dcf4[_0xe3c6('0x19')][_0xe3c6('0x17')]);}})[_0xe3c6('0x1a')](function(_0x276e1e){logger[_0xe3c6('0x15')]('DashboardItem,\x20%s,\x20%s',_0x1c974d,_0x276e1e);_0x100b36(_0x276e1e);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 0dddcb6..9a0761e 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 _0xe7c7=['./dashboardItem.events','remove','update','emit','removeListener','register','dashboardItem:'];(function(_0x267893,_0x32e5b7){var _0x1d0bbd=function(_0xb4d3f4){while(--_0xb4d3f4){_0x267893['push'](_0x267893['shift']());}};_0x1d0bbd(++_0x32e5b7);}(_0xe7c7,0x10a));var _0x7e7c=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xe7c7[_0x342baa];return _0x1208f3;};'use strict';var DashboardItemEvents=require(_0x7e7c('0x0'));var events=['save',_0x7e7c('0x1'),_0x7e7c('0x2')];function createListener(_0x4b209d,_0x384ca6){return function(_0xa32aeb){_0x384ca6[_0x7e7c('0x3')](_0x4b209d,_0xa32aeb);};}function removeListener(_0x34f9b0,_0x5856ee){return function(){DashboardItemEvents[_0x7e7c('0x4')](_0x34f9b0,_0x5856ee);};}exports[_0x7e7c('0x5')]=function(_0x540c02){for(var _0x54bb73=0x0,_0x535eef=events['length'];_0x54bb73<_0x535eef;_0x54bb73++){var _0x4cde0a=events[_0x54bb73];var _0x5f4cfe=createListener(_0x7e7c('0x6')+_0x4cde0a,_0x540c02);DashboardItemEvents['on'](_0x4cde0a,_0x5f4cfe);}}; \ No newline at end of file +var _0xb229=['length','dashboardItem:','./dashboardItem.events','remove','update','removeListener','register'];(function(_0x30fe8c,_0x272cb9){var _0x4f1068=function(_0x5f52c7){while(--_0x5f52c7){_0x30fe8c['push'](_0x30fe8c['shift']());}};_0x4f1068(++_0x272cb9);}(_0xb229,0x17c));var _0x9b22=function(_0x374320,_0x55464d){_0x374320=_0x374320-0x0;var _0x6a96c9=_0xb229[_0x374320];return _0x6a96c9;};'use strict';var DashboardItemEvents=require(_0x9b22('0x0'));var events=['save',_0x9b22('0x1'),_0x9b22('0x2')];function createListener(_0x20403a,_0x3507d3){return function(_0x1daef5){_0x3507d3['emit'](_0x20403a,_0x1daef5);};}function removeListener(_0x283f2e,_0x4fc9bb){return function(){DashboardItemEvents[_0x9b22('0x3')](_0x283f2e,_0x4fc9bb);};}exports[_0x9b22('0x4')]=function(_0x56bbc0){for(var _0x3f2571=0x0,_0x515f4e=events[_0x9b22('0x5')];_0x3f2571<_0x515f4e;_0x3f2571++){var _0x2d8211=events[_0x3f2571];var _0x5bfabc=createListener(_0x9b22('0x6')+_0x2d8211,_0x56bbc0);DashboardItemEvents['on'](_0x2d8211,_0x5bfabc);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index fa458b1..9a8d80d 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 _0xe14b=['post','create','update','delete','multer','util','express','Router','../../components/interaction/service','get','/:id','isAuthenticated','show'];(function(_0x3798eb,_0x5314fc){var _0x466967=function(_0x5c8852){while(--_0x5c8852){_0x3798eb['push'](_0x3798eb['shift']());}};_0x466967(++_0x5314fc);}(_0xe14b,0x93));var _0xbe14=function(_0x4c23cc,_0x46193e){_0x4c23cc=_0x4c23cc-0x0;var _0x1b1dc2=_0xe14b[_0x4c23cc];return _0x1b1dc2;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0xbe14('0x5')](_0xbe14('0x6'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x9')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xbe14('0xb')]);router[_0xbe14('0xc')](_0xbe14('0x6'),auth[_0xbe14('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3f8a=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x5ccb1c,_0x3e2234){_0x5ccb1c=_0x5ccb1c-0x0;var _0x2b6519=_0x3f8a[_0x5ccb1c];return _0x2b6519;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')](_0xa3f8('0xa'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xd')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xf')](_0xa3f8('0xa'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router[_0xa3f8('0x11')]('/:id',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x12')]);module[_0xa3f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 9abc83e..dadda17 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 _0x1717=['sequelize','exports','STRING'];(function(_0x36305e,_0xb53d1f){var _0x42d169=function(_0x5b1ac5){while(--_0x5b1ac5){_0x36305e['push'](_0x36305e['shift']());}};_0x42d169(++_0xb53d1f);}(_0x1717,0x15f));var _0x7171=function(_0x35d59c,_0x341ef9){_0x35d59c=_0x35d59c-0x0;var _0x18cd27=_0x1717[_0x35d59c];return _0x18cd27;};'use strict';var Sequelize=require(_0x7171('0x0'));module[_0x7171('0x1')]={'name':{'type':Sequelize[_0x7171('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9d2e=['STRING','sequelize','exports'];(function(_0x39b74c,_0x2dac3e){var _0x418d98=function(_0x43baa5){while(--_0x43baa5){_0x39b74c['push'](_0x39b74c['shift']());}};_0x418d98(++_0x2dac3e);}(_0x9d2e,0x8e));var _0xe9d2=function(_0x4854c8,_0x1b74ae){_0x4854c8=_0x4854c8-0x0;var _0x520619=_0x9d2e[_0x4854c8];return _0x520619;};'use strict';var Sequelize=require(_0xe9d2('0x0'));module[_0xe9d2('0x1')]={'name':{'type':Sequelize[_0xe9d2('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 66f4a1c..eb46d93 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 _0x81ca=['Dispositions','UserProfileResource','end','error','stack','name','send','index','map','Disposition','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','catch','show','params','keys','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','update','destroy','then'];(function(_0x495b3d,_0x4d3da4){var _0x4cb329=function(_0xdef9f0){while(--_0xdef9f0){_0x495b3d['push'](_0x495b3d['shift']());}};_0x4cb329(++_0x4d3da4);}(_0x81ca,0x115));var _0xa81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81ca[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xa81c('0x0'));var emlformat=require(_0xa81c('0x1'));var rimraf=require(_0xa81c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa81c('0x3'));var rp=require('request-promise');var moment=require(_0xa81c('0x4'));var BPromise=require(_0xa81c('0x5'));var Mustache=require(_0xa81c('0x6'));var util=require(_0xa81c('0x7'));var path=require(_0xa81c('0x8'));var sox=require('sox');var csv=require(_0xa81c('0x9'));var ejs=require(_0xa81c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa81c('0xb'));var jsforce=require(_0xa81c('0xc'));var deskjs=require(_0xa81c('0xd'));var toCsv=require(_0xa81c('0x9'));var querystring=require(_0xa81c('0xe'));var Papa=require(_0xa81c('0xf'));var Redis=require(_0xa81c('0x10'));var authService=require(_0xa81c('0x11'));var qs=require(_0xa81c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa81c('0x13'));var logger=require(_0xa81c('0x14'))(_0xa81c('0x15'));var utils=require(_0xa81c('0x16'));var config=require(_0xa81c('0x17'));var db=require(_0xa81c('0x18'))['db'];function respondWithStatusCode(_0xe84377,_0x347693){_0x347693=_0x347693||0xcc;return function(_0x2b631e){if(_0x2b631e){return _0xe84377[_0xa81c('0x19')](_0x347693);}return _0xe84377[_0xa81c('0x1a')](_0x347693)['end']();};}function respondWithResult(_0x2be839,_0x406b68){_0x406b68=_0x406b68||0xc8;return function(_0x2cb5a4){if(_0x2cb5a4){return _0x2be839['status'](_0x406b68)['json'](_0x2cb5a4);}};}function respondWithFilteredResult(_0x1ecfcf,_0x35277d){return function(_0xc06ab0){if(_0xc06ab0){var _0x535d1d=_0xc06ab0[_0xa81c('0x1b')],_0x47fc61=_0x35277d[_0xa81c('0x1c')],_0x2e10ef=_0x35277d[_0xa81c('0x1c')]+_0x35277d[_0xa81c('0x1d')],_0x18e9aa;if(_0x2e10ef>=_0x535d1d){_0x2e10ef=_0x535d1d;_0x18e9aa=0xc8;}else{_0x18e9aa=0xce;}_0x1ecfcf[_0xa81c('0x1a')](_0x18e9aa);return _0x1ecfcf[_0xa81c('0x1e')](_0xa81c('0x1f'),_0x47fc61+'-'+_0x2e10ef+'/'+_0x535d1d)['json'](_0xc06ab0);}return null;};}function patchUpdates(_0x587006){return function(_0x4f7615){try{jsonpatch['apply'](_0x4f7615,_0x587006,!![]);}catch(_0x2db1df){return BPromise['reject'](_0x2db1df);}return _0x4f7615['save']();};}function saveUpdates(_0xfb39fa,_0x21956d){return function(_0x334d17){if(_0x334d17){return _0x334d17[_0xa81c('0x20')](_0xfb39fa)['then'](function(_0x1038cf){return _0x1038cf;});}return null;};}function removeEntity(_0x329631,_0x45c82b){return function(_0x1d7263){if(_0x1d7263){return _0x1d7263[_0xa81c('0x21')]()[_0xa81c('0x22')](function(){var _0x13a0b4=_0x1d7263['get']({'plain':!![]});var _0x1fbc24=_0xa81c('0x23');return db[_0xa81c('0x24')]['destroy']({'where':{'type':_0x1fbc24,'resourceId':_0x13a0b4['id']}})[_0xa81c('0x22')](function(){return _0x1d7263;});})[_0xa81c('0x22')](function(){_0x329631[_0xa81c('0x1a')](0xcc)[_0xa81c('0x25')]();});}};}function handleEntityNotFound(_0x1cda61,_0x54491c){return function(_0x5a6f91){if(!_0x5a6f91){_0x1cda61[_0xa81c('0x19')](0x194);}return _0x5a6f91;};}function handleError(_0xce8c8,_0x54f781){_0x54f781=_0x54f781||0x1f4;return function(_0x497e0a){logger[_0xa81c('0x26')](_0x497e0a[_0xa81c('0x27')]);if(_0x497e0a[_0xa81c('0x28')]){delete _0x497e0a['name'];}_0xce8c8['status'](_0x54f781)[_0xa81c('0x29')](_0x497e0a);};}exports[_0xa81c('0x2a')]=function(_0x3befc8,_0x1b6c22){var _0x236dd3={},_0x4391f3={},_0x21ac0c={'count':0x0,'rows':[]};var _0x1c78ab=_[_0xa81c('0x2b')](db[_0xa81c('0x2c')][_0xa81c('0x2d')],function(_0x470b83){return{'name':_0x470b83['fieldName'],'type':_0x470b83[_0xa81c('0x2e')]['key']};});_0x4391f3[_0xa81c('0x2f')]=_[_0xa81c('0x2b')](_0x1c78ab,'name');_0x4391f3[_0xa81c('0x30')]=_['keys'](_0x3befc8[_0xa81c('0x30')]);_0x4391f3[_0xa81c('0x31')]=_['intersection'](_0x4391f3[_0xa81c('0x2f')],_0x4391f3[_0xa81c('0x30')]);_0x236dd3[_0xa81c('0x32')]=_[_0xa81c('0x33')](_0x4391f3['model'],qs[_0xa81c('0x34')](_0x3befc8[_0xa81c('0x30')]['fields']));_0x236dd3[_0xa81c('0x32')]=_0x236dd3[_0xa81c('0x32')][_0xa81c('0x35')]?_0x236dd3[_0xa81c('0x32')]:_0x4391f3[_0xa81c('0x2f')];if(!_0x3befc8[_0xa81c('0x30')][_0xa81c('0x36')](_0xa81c('0x37'))){_0x236dd3[_0xa81c('0x1d')]=qs[_0xa81c('0x1d')](_0x3befc8['query'][_0xa81c('0x1d')]);_0x236dd3[_0xa81c('0x1c')]=qs[_0xa81c('0x1c')](_0x3befc8[_0xa81c('0x30')][_0xa81c('0x1c')]);}_0x236dd3[_0xa81c('0x38')]=qs[_0xa81c('0x39')](_0x3befc8[_0xa81c('0x30')][_0xa81c('0x39')]);_0x236dd3[_0xa81c('0x3a')]=qs[_0xa81c('0x31')](_[_0xa81c('0x3b')](_0x3befc8['query'],_0x4391f3[_0xa81c('0x31')]),_0x1c78ab);if(_0x3befc8[_0xa81c('0x30')][_0xa81c('0x3c')]){_0x236dd3[_0xa81c('0x3a')]=_[_0xa81c('0x3d')](_0x236dd3[_0xa81c('0x3a')],{'$or':_[_0xa81c('0x2b')](_0x1c78ab,function(_0x5698cf){if(_0x5698cf[_0xa81c('0x2e')]!=='VIRTUAL'){var _0x4f07b3={};_0x4f07b3[_0x5698cf[_0xa81c('0x28')]]={'$like':'%'+_0x3befc8['query'][_0xa81c('0x3c')]+'%'};return _0x4f07b3;}})});}_0x236dd3=_['merge']({},_0x236dd3,_0x3befc8[_0xa81c('0x3e')]);var _0x546bff={'where':_0x236dd3[_0xa81c('0x3a')]};return db[_0xa81c('0x2c')]['count'](_0x546bff)[_0xa81c('0x22')](function(_0x4396af){_0x21ac0c[_0xa81c('0x1b')]=_0x4396af;if(_0x3befc8[_0xa81c('0x30')]['includeAll']){_0x236dd3['include']=[{'all':!![]}];}return db['Disposition'][_0xa81c('0x3f')](_0x236dd3);})[_0xa81c('0x22')](function(_0x131c20){_0x21ac0c[_0xa81c('0x40')]=_0x131c20;return _0x21ac0c;})[_0xa81c('0x22')](respondWithFilteredResult(_0x1b6c22,_0x236dd3))[_0xa81c('0x41')](handleError(_0x1b6c22,null));};exports[_0xa81c('0x42')]=function(_0x156b4b,_0x1e0833){var _0xbe5b9={'raw':!![],'where':{'id':_0x156b4b[_0xa81c('0x43')]['id']}},_0x3f38c2={};_0x3f38c2[_0xa81c('0x2f')]=_[_0xa81c('0x44')](db[_0xa81c('0x2c')][_0xa81c('0x2d')]);_0x3f38c2['query']=_[_0xa81c('0x44')](_0x156b4b['query']);_0x3f38c2[_0xa81c('0x31')]=_['intersection'](_0x3f38c2[_0xa81c('0x2f')],_0x3f38c2[_0xa81c('0x30')]);_0xbe5b9[_0xa81c('0x32')]=_[_0xa81c('0x33')](_0x3f38c2[_0xa81c('0x2f')],qs[_0xa81c('0x34')](_0x156b4b[_0xa81c('0x30')][_0xa81c('0x34')]));_0xbe5b9[_0xa81c('0x32')]=_0xbe5b9[_0xa81c('0x32')][_0xa81c('0x35')]?_0xbe5b9[_0xa81c('0x32')]:_0x3f38c2[_0xa81c('0x2f')];if(_0x156b4b[_0xa81c('0x30')]['includeAll']){_0xbe5b9[_0xa81c('0x45')]=[{'all':!![]}];}_0xbe5b9=_[_0xa81c('0x3d')]({},_0xbe5b9,_0x156b4b[_0xa81c('0x3e')]);return db[_0xa81c('0x2c')][_0xa81c('0x46')](_0xbe5b9)[_0xa81c('0x22')](handleEntityNotFound(_0x1e0833,null))[_0xa81c('0x22')](respondWithResult(_0x1e0833,null))[_0xa81c('0x41')](handleError(_0x1e0833,null));};exports[_0xa81c('0x47')]=function(_0x12ead6,_0x52d386){return db[_0xa81c('0x2c')][_0xa81c('0x47')](_0x12ead6[_0xa81c('0x48')],{})[_0xa81c('0x22')](function(_0x2aed50){var _0x5377e2=_0x12ead6[_0xa81c('0x49')][_0xa81c('0x4a')]({'plain':!![]});if(!_0x5377e2)throw new Error(_0xa81c('0x4b'));if(_0x5377e2['role']===_0xa81c('0x49')){var _0x2ef084=_0x2aed50['get']({'plain':!![]});var _0x289809=_0xa81c('0x23');return db['UserProfileSection'][_0xa81c('0x46')]({'where':{'name':_0x289809,'userProfileId':_0x5377e2[_0xa81c('0x4c')]},'raw':!![]})[_0xa81c('0x22')](function(_0x4594d9){if(_0x4594d9&&_0x4594d9['autoAssociation']===0x0){return db[_0xa81c('0x24')][_0xa81c('0x47')]({'name':_0x2ef084['name'],'resourceId':_0x2ef084['id'],'type':_0x4594d9[_0xa81c('0x28')],'sectionId':_0x4594d9['id']},{})[_0xa81c('0x22')](function(){return _0x2aed50;});}else{return _0x2aed50;}})['catch'](function(_0xf6952b){logger[_0xa81c('0x26')](_0xa81c('0x4d'),_0xf6952b);throw _0xf6952b;});}return _0x2aed50;})[_0xa81c('0x22')](respondWithResult(_0x52d386,0xc9))[_0xa81c('0x41')](handleError(_0x52d386,null));};exports[_0xa81c('0x20')]=function(_0x352710,_0x3f4c89){if(_0x352710[_0xa81c('0x48')]['id']){delete _0x352710[_0xa81c('0x48')]['id'];}return db[_0xa81c('0x2c')]['find']({'where':{'id':_0x352710[_0xa81c('0x43')]['id']}})['then'](handleEntityNotFound(_0x3f4c89,null))[_0xa81c('0x22')](saveUpdates(_0x352710[_0xa81c('0x48')],null))[_0xa81c('0x22')](respondWithResult(_0x3f4c89,null))[_0xa81c('0x41')](handleError(_0x3f4c89,null));};exports[_0xa81c('0x21')]=function(_0x3d91b7,_0x7d4a81){return db['Disposition'][_0xa81c('0x46')]({'where':{'id':_0x3d91b7['params']['id']}})[_0xa81c('0x22')](handleEntityNotFound(_0x7d4a81,null))[_0xa81c('0x22')](removeEntity(_0x7d4a81,null))[_0xa81c('0x41')](handleError(_0x7d4a81,null));}; \ No newline at end of file +var _0x5c84=['length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','index','map','Disposition','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes'];(function(_0x4392f3,_0x1b1307){var _0x556942=function(_0x19c68a){while(--_0x19c68a){_0x4392f3['push'](_0x4392f3['shift']());}};_0x556942(++_0x1b1307);}(_0x5c84,0xb8));var _0x45c8=function(_0x15563a,_0x54094d){_0x15563a=_0x15563a-0x0;var _0x4a1be3=_0x5c84[_0x15563a];return _0x4a1be3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x45c8('0x0'));var rimraf=require(_0x45c8('0x1'));var zipdir=require(_0x45c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x45c8('0x3'));var moment=require(_0x45c8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x45c8('0x5'));var util=require(_0x45c8('0x6'));var path=require('path');var sox=require(_0x45c8('0x7'));var csv=require(_0x45c8('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x45c8('0x9'));var crypto=require(_0x45c8('0xa'));var jsforce=require(_0x45c8('0xb'));var deskjs=require(_0x45c8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x45c8('0xd'));var Papa=require(_0x45c8('0xe'));var Redis=require(_0x45c8('0xf'));var authService=require(_0x45c8('0x10'));var qs=require(_0x45c8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x45c8('0x12'));var utils=require(_0x45c8('0x13'));var config=require(_0x45c8('0x14'));var db=require(_0x45c8('0x15'))['db'];function respondWithStatusCode(_0x39f7d5,_0x49919e){_0x49919e=_0x49919e||0xcc;return function(_0x31e637){if(_0x31e637){return _0x39f7d5[_0x45c8('0x16')](_0x49919e);}return _0x39f7d5[_0x45c8('0x17')](_0x49919e)[_0x45c8('0x18')]();};}function respondWithResult(_0x1f6ef5,_0x2f4d34){_0x2f4d34=_0x2f4d34||0xc8;return function(_0xdce395){if(_0xdce395){return _0x1f6ef5[_0x45c8('0x17')](_0x2f4d34)[_0x45c8('0x19')](_0xdce395);}};}function respondWithFilteredResult(_0x3a1f03,_0x3fa995){return function(_0x512cfd){if(_0x512cfd){var _0x39a67d=_0x512cfd['count'],_0x2029c0=_0x3fa995[_0x45c8('0x1a')],_0x557eeb=_0x3fa995[_0x45c8('0x1a')]+_0x3fa995[_0x45c8('0x1b')],_0x2320b2;if(_0x557eeb>=_0x39a67d){_0x557eeb=_0x39a67d;_0x2320b2=0xc8;}else{_0x2320b2=0xce;}_0x3a1f03[_0x45c8('0x17')](_0x2320b2);return _0x3a1f03['set']('Content-Range',_0x2029c0+'-'+_0x557eeb+'/'+_0x39a67d)[_0x45c8('0x19')](_0x512cfd);}return null;};}function patchUpdates(_0x1762db){return function(_0x487273){try{jsonpatch[_0x45c8('0x1c')](_0x487273,_0x1762db,!![]);}catch(_0x34f33d){return BPromise[_0x45c8('0x1d')](_0x34f33d);}return _0x487273[_0x45c8('0x1e')]();};}function saveUpdates(_0x44a2d7,_0x387d8f){return function(_0x385134){if(_0x385134){return _0x385134[_0x45c8('0x1f')](_0x44a2d7)[_0x45c8('0x20')](function(_0x423710){return _0x423710;});}return null;};}function removeEntity(_0x238f3d,_0x434177){return function(_0xada236){if(_0xada236){return _0xada236[_0x45c8('0x21')]()[_0x45c8('0x20')](function(){var _0x318d79=_0xada236[_0x45c8('0x22')]({'plain':!![]});var _0x4aa3ed=_0x45c8('0x23');return db[_0x45c8('0x24')][_0x45c8('0x21')]({'where':{'type':_0x4aa3ed,'resourceId':_0x318d79['id']}})[_0x45c8('0x20')](function(){return _0xada236;});})['then'](function(){_0x238f3d[_0x45c8('0x17')](0xcc)[_0x45c8('0x18')]();});}};}function handleEntityNotFound(_0xea5db,_0x4a4b7a){return function(_0x535183){if(!_0x535183){_0xea5db[_0x45c8('0x16')](0x194);}return _0x535183;};}function handleError(_0x119114,_0x29fa23){_0x29fa23=_0x29fa23||0x1f4;return function(_0x44e751){logger[_0x45c8('0x25')](_0x44e751[_0x45c8('0x26')]);if(_0x44e751[_0x45c8('0x27')]){delete _0x44e751['name'];}_0x119114[_0x45c8('0x17')](_0x29fa23)['send'](_0x44e751);};}exports[_0x45c8('0x28')]=function(_0x498261,_0x2c844e){var _0x5155e9={},_0x107e61={},_0x551605={'count':0x0,'rows':[]};var _0x4378e4=_[_0x45c8('0x29')](db[_0x45c8('0x2a')][_0x45c8('0x2b')],function(_0x24141c){return{'name':_0x24141c[_0x45c8('0x2c')],'type':_0x24141c[_0x45c8('0x2d')]['key']};});_0x107e61[_0x45c8('0x2e')]=_[_0x45c8('0x29')](_0x4378e4,_0x45c8('0x27'));_0x107e61[_0x45c8('0x2f')]=_[_0x45c8('0x30')](_0x498261[_0x45c8('0x2f')]);_0x107e61[_0x45c8('0x31')]=_[_0x45c8('0x32')](_0x107e61[_0x45c8('0x2e')],_0x107e61[_0x45c8('0x2f')]);_0x5155e9['attributes']=_[_0x45c8('0x32')](_0x107e61[_0x45c8('0x2e')],qs[_0x45c8('0x33')](_0x498261[_0x45c8('0x2f')][_0x45c8('0x33')]));_0x5155e9[_0x45c8('0x34')]=_0x5155e9[_0x45c8('0x34')][_0x45c8('0x35')]?_0x5155e9['attributes']:_0x107e61[_0x45c8('0x2e')];if(!_0x498261['query'][_0x45c8('0x36')]('nolimit')){_0x5155e9['limit']=qs[_0x45c8('0x1b')](_0x498261[_0x45c8('0x2f')][_0x45c8('0x1b')]);_0x5155e9['offset']=qs[_0x45c8('0x1a')](_0x498261[_0x45c8('0x2f')][_0x45c8('0x1a')]);}_0x5155e9[_0x45c8('0x37')]=qs['sort'](_0x498261[_0x45c8('0x2f')][_0x45c8('0x38')]);_0x5155e9[_0x45c8('0x39')]=qs[_0x45c8('0x31')](_[_0x45c8('0x3a')](_0x498261[_0x45c8('0x2f')],_0x107e61[_0x45c8('0x31')]),_0x4378e4);if(_0x498261[_0x45c8('0x2f')][_0x45c8('0x3b')]){_0x5155e9[_0x45c8('0x39')]=_[_0x45c8('0x3c')](_0x5155e9[_0x45c8('0x39')],{'$or':_[_0x45c8('0x29')](_0x4378e4,function(_0x56fa0d){if(_0x56fa0d['type']!==_0x45c8('0x3d')){var _0xede292={};_0xede292[_0x56fa0d['name']]={'$like':'%'+_0x498261[_0x45c8('0x2f')]['filter']+'%'};return _0xede292;}})});}_0x5155e9=_['merge']({},_0x5155e9,_0x498261[_0x45c8('0x3e')]);var _0x2d506f={'where':_0x5155e9[_0x45c8('0x39')]};return db[_0x45c8('0x2a')][_0x45c8('0x3f')](_0x2d506f)[_0x45c8('0x20')](function(_0x43a154){_0x551605[_0x45c8('0x3f')]=_0x43a154;if(_0x498261[_0x45c8('0x2f')][_0x45c8('0x40')]){_0x5155e9[_0x45c8('0x41')]=[{'all':!![]}];}return db['Disposition'][_0x45c8('0x42')](_0x5155e9);})[_0x45c8('0x20')](function(_0x308a7a){_0x551605[_0x45c8('0x43')]=_0x308a7a;return _0x551605;})[_0x45c8('0x20')](respondWithFilteredResult(_0x2c844e,_0x5155e9))['catch'](handleError(_0x2c844e,null));};exports[_0x45c8('0x44')]=function(_0x56cec7,_0x3edd81){var _0x268190={'raw':!![],'where':{'id':_0x56cec7[_0x45c8('0x45')]['id']}},_0x39adc0={};_0x39adc0[_0x45c8('0x2e')]=_[_0x45c8('0x30')](db[_0x45c8('0x2a')]['rawAttributes']);_0x39adc0[_0x45c8('0x2f')]=_['keys'](_0x56cec7[_0x45c8('0x2f')]);_0x39adc0[_0x45c8('0x31')]=_[_0x45c8('0x32')](_0x39adc0[_0x45c8('0x2e')],_0x39adc0[_0x45c8('0x2f')]);_0x268190[_0x45c8('0x34')]=_['intersection'](_0x39adc0['model'],qs[_0x45c8('0x33')](_0x56cec7[_0x45c8('0x2f')][_0x45c8('0x33')]));_0x268190[_0x45c8('0x34')]=_0x268190[_0x45c8('0x34')][_0x45c8('0x35')]?_0x268190[_0x45c8('0x34')]:_0x39adc0[_0x45c8('0x2e')];if(_0x56cec7[_0x45c8('0x2f')][_0x45c8('0x40')]){_0x268190['include']=[{'all':!![]}];}_0x268190=_[_0x45c8('0x3c')]({},_0x268190,_0x56cec7['options']);return db[_0x45c8('0x2a')]['find'](_0x268190)[_0x45c8('0x20')](handleEntityNotFound(_0x3edd81,null))[_0x45c8('0x20')](respondWithResult(_0x3edd81,null))['catch'](handleError(_0x3edd81,null));};exports[_0x45c8('0x46')]=function(_0x24a7f4,_0x52c844){return db[_0x45c8('0x2a')][_0x45c8('0x46')](_0x24a7f4['body'],{})[_0x45c8('0x20')](function(_0x451802){var _0x4ad388=_0x24a7f4[_0x45c8('0x47')][_0x45c8('0x22')]({'plain':!![]});if(!_0x4ad388)throw new Error(_0x45c8('0x48'));if(_0x4ad388[_0x45c8('0x49')]===_0x45c8('0x47')){var _0x5ff51d=_0x451802[_0x45c8('0x22')]({'plain':!![]});var _0x5f3a43=_0x45c8('0x23');return db[_0x45c8('0x4a')][_0x45c8('0x4b')]({'where':{'name':_0x5f3a43,'userProfileId':_0x4ad388[_0x45c8('0x4c')]},'raw':!![]})['then'](function(_0x421fe0){if(_0x421fe0&&_0x421fe0['autoAssociation']===0x0){return db[_0x45c8('0x24')][_0x45c8('0x46')]({'name':_0x5ff51d[_0x45c8('0x27')],'resourceId':_0x5ff51d['id'],'type':_0x421fe0[_0x45c8('0x27')],'sectionId':_0x421fe0['id']},{})[_0x45c8('0x20')](function(){return _0x451802;});}else{return _0x451802;}})['catch'](function(_0x2d7da6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d7da6);throw _0x2d7da6;});}return _0x451802;})[_0x45c8('0x20')](respondWithResult(_0x52c844,0xc9))[_0x45c8('0x4d')](handleError(_0x52c844,null));};exports[_0x45c8('0x1f')]=function(_0x306177,_0x346a95){if(_0x306177['body']['id']){delete _0x306177[_0x45c8('0x4e')]['id'];}return db[_0x45c8('0x2a')][_0x45c8('0x4b')]({'where':{'id':_0x306177[_0x45c8('0x45')]['id']}})[_0x45c8('0x20')](handleEntityNotFound(_0x346a95,null))[_0x45c8('0x20')](saveUpdates(_0x306177['body'],null))[_0x45c8('0x20')](respondWithResult(_0x346a95,null))[_0x45c8('0x4d')](handleError(_0x346a95,null));};exports[_0x45c8('0x21')]=function(_0xd9eb60,_0x4df52b){return db['Disposition'][_0x45c8('0x4b')]({'where':{'id':_0xd9eb60[_0x45c8('0x45')]['id']}})['then'](handleEntityNotFound(_0x4df52b,null))[_0x45c8('0x20')](removeEntity(_0x4df52b,null))[_0x45c8('0x4d')](handleError(_0x4df52b,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index f149155..ac2b7df 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 _0x741c=['MailAccountId','name_sms','SmsAccountId','name_fax','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./disposition.attributes','exports','define','Disposition','tools_dispositions','name','ListId'];(function(_0x45262e,_0x1d9c0b){var _0x3b7f60=function(_0x1d7a53){while(--_0x1d7a53){_0x45262e['push'](_0x45262e['shift']());}};_0x3b7f60(++_0x1d9c0b);}(_0x741c,0x196));var _0xc741=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x741c[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var logger=require(_0xc741('0x2'))(_0xc741('0x3'));var moment=require(_0xc741('0x4'));var BPromise=require(_0xc741('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc741('0x6'));var config=require('../../config/environment');var attributes=require(_0xc741('0x7'));module[_0xc741('0x8')]=function(_0x3708ae,_0x133bc4){return _0x3708ae[_0xc741('0x9')](_0xc741('0xa'),attributes,{'tableName':_0xc741('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xc741('0xc'),_0xc741('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0xc741('0xc'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0xc741('0xc'),_0xc741('0xe')]},{'unique':!![],'name':_0xc741('0xf'),'fields':[_0xc741('0xc'),_0xc741('0x10')]},{'unique':!![],'name':_0xc741('0x11'),'fields':[_0xc741('0xc'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':['name',_0xc741('0x12')]},{'unique':!![],'name':_0xc741('0x13'),'fields':[_0xc741('0xc'),_0xc741('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x869e=['name','ListId','name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./disposition.attributes','exports','tools_dispositions','name_voice'];(function(_0x4f431b,_0x42f2a4){var _0x2ff1b4=function(_0x384843){while(--_0x384843){_0x4f431b['push'](_0x4f431b['shift']());}};_0x2ff1b4(++_0x42f2a4);}(_0x869e,0x15c));var _0xe869=function(_0x52ac57,_0x1ebf9a){_0x52ac57=_0x52ac57-0x0;var _0x13c382=_0x869e[_0x52ac57];return _0x13c382;};'use strict';var _=require(_0xe869('0x0'));var util=require(_0xe869('0x1'));var logger=require(_0xe869('0x2'))('api');var moment=require(_0xe869('0x3'));var BPromise=require(_0xe869('0x4'));var rp=require(_0xe869('0x5'));var fs=require('fs');var path=require(_0xe869('0x6'));var rimraf=require(_0xe869('0x7'));var config=require('../../config/environment');var attributes=require(_0xe869('0x8'));module[_0xe869('0x9')]=function(_0x26a223,_0x26afde){return _0x26a223['define']('Disposition',attributes,{'tableName':_0xe869('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xe869('0xb'),'fields':[_0xe869('0xc'),_0xe869('0xd')]},{'unique':!![],'name':_0xe869('0xe'),'fields':[_0xe869('0xc'),_0xe869('0xf')]},{'unique':!![],'name':_0xe869('0x10'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0xe869('0x11'),'fields':[_0xe869('0xc'),_0xe869('0x12')]},{'unique':!![],'name':_0xe869('0x13'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0xe869('0x14'),'fields':['name',_0xe869('0x15')]},{'unique':!![],'name':_0xe869('0x16'),'fields':['name',_0xe869('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 6c6cec1..d3bb0e8 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 _0xcfb3=['Disposition,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x35c464,_0x1d976b){var _0xb83aac=function(_0x27ef81){while(--_0x27ef81){_0x35c464['push'](_0x35c464['shift']());}};_0xb83aac(++_0x1d976b);}(_0xcfb3,0x93));var _0x3cfb=function(_0xda974f,_0x228e93){_0xda974f=_0xda974f-0x0;var _0x1c01cf=_0xcfb3[_0xda974f];return _0x1c01cf;};'use strict';var _=require(_0x3cfb('0x0'));var util=require(_0x3cfb('0x1'));var moment=require(_0x3cfb('0x2'));var BPromise=require(_0x3cfb('0x3'));var rs=require(_0x3cfb('0x4'));var fs=require('fs');var Redis=require(_0x3cfb('0x5'));var db=require(_0x3cfb('0x6'))['db'];var utils=require(_0x3cfb('0x7'));var logger=require(_0x3cfb('0x8'))(_0x3cfb('0x9'));var config=require(_0x3cfb('0xa'));var jayson=require(_0x3cfb('0xb'));var client=jayson[_0x3cfb('0xc')][_0x3cfb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x40baab,_0x576973,_0x18f8c3){return new BPromise(function(_0x14c996,_0x251875){return client[_0x3cfb('0xe')](_0x40baab,_0x18f8c3)['then'](function(_0x426385){logger[_0x3cfb('0xf')]('Disposition,\x20%s,\x20%s',_0x576973,_0x3cfb('0x10'));logger[_0x3cfb('0x11')](_0x3cfb('0x12'),_0x576973,_0x3cfb('0x10'),JSON['stringify'](_0x426385));if(_0x426385[_0x3cfb('0x13')]){if(_0x426385[_0x3cfb('0x13')][_0x3cfb('0x14')]===0x1f4){logger[_0x3cfb('0x13')](_0x3cfb('0x15'),_0x576973,_0x426385[_0x3cfb('0x13')][_0x3cfb('0x16')]);return _0x251875(_0x426385[_0x3cfb('0x13')]['message']);}logger[_0x3cfb('0x13')](_0x3cfb('0x15'),_0x576973,_0x426385[_0x3cfb('0x13')][_0x3cfb('0x16')]);return _0x14c996(_0x426385[_0x3cfb('0x13')][_0x3cfb('0x16')]);}else{logger[_0x3cfb('0xf')]('Disposition,\x20%s,\x20%s',_0x576973,_0x3cfb('0x10'));_0x14c996(_0x426385['result']['message']);}})[_0x3cfb('0x17')](function(_0x286c7e){logger[_0x3cfb('0x13')](_0x3cfb('0x15'),_0x576973,_0x286c7e);_0x251875(_0x286c7e);});});} \ No newline at end of file +var _0x1c9c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Disposition,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3977ce,_0x466a62){var _0x40820d=function(_0x31983d){while(--_0x31983d){_0x3977ce['push'](_0x3977ce['shift']());}};_0x40820d(++_0x466a62);}(_0x1c9c,0xf7));var _0xc1c9=function(_0x375492,_0x4ed149){_0x375492=_0x375492-0x0;var _0x18ba5b=_0x1c9c[_0x375492];return _0x18ba5b;};'use strict';var _=require(_0xc1c9('0x0'));var util=require(_0xc1c9('0x1'));var moment=require(_0xc1c9('0x2'));var BPromise=require(_0xc1c9('0x3'));var rs=require(_0xc1c9('0x4'));var fs=require('fs');var Redis=require(_0xc1c9('0x5'));var db=require(_0xc1c9('0x6'))['db'];var utils=require(_0xc1c9('0x7'));var logger=require(_0xc1c9('0x8'))(_0xc1c9('0x9'));var config=require(_0xc1c9('0xa'));var jayson=require(_0xc1c9('0xb'));var client=jayson[_0xc1c9('0xc')][_0xc1c9('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2c0895,_0x369991,_0x2d5fbd){return new BPromise(function(_0x47d388,_0x8c9efd){return client['request'](_0x2c0895,_0x2d5fbd)[_0xc1c9('0xe')](function(_0x5a02ab){logger[_0xc1c9('0xf')]('Disposition,\x20%s,\x20%s',_0x369991,'request\x20sent');logger[_0xc1c9('0x10')](_0xc1c9('0x11'),_0x369991,_0xc1c9('0x12'),JSON['stringify'](_0x5a02ab));if(_0x5a02ab[_0xc1c9('0x13')]){if(_0x5a02ab[_0xc1c9('0x13')][_0xc1c9('0x14')]===0x1f4){logger[_0xc1c9('0x13')](_0xc1c9('0x15'),_0x369991,_0x5a02ab[_0xc1c9('0x13')][_0xc1c9('0x16')]);return _0x8c9efd(_0x5a02ab[_0xc1c9('0x13')][_0xc1c9('0x16')]);}logger[_0xc1c9('0x13')](_0xc1c9('0x15'),_0x369991,_0x5a02ab['error']['message']);return _0x47d388(_0x5a02ab[_0xc1c9('0x13')][_0xc1c9('0x16')]);}else{logger[_0xc1c9('0xf')](_0xc1c9('0x15'),_0x369991,_0xc1c9('0x12'));_0x47d388(_0x5a02ab['result'][_0xc1c9('0x16')]);}})['catch'](function(_0x27c1a4){logger[_0xc1c9('0x13')](_0xc1c9('0x15'),_0x369991,_0x27c1a4);_0x8c9efd(_0x27c1a4);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 9ba6fb0..76e146b 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 _0xfa94=['path','express','Router','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','show','create','/:id','update','destroy','exports','multer'];(function(_0x3ae15d,_0x474e34){var _0x3fdeaf=function(_0x109080){while(--_0x109080){_0x3ae15d['push'](_0x3ae15d['shift']());}};_0x3fdeaf(++_0x474e34);}(_0xfa94,0xef));var _0x4fa9=function(_0x5c9f56,_0x42c9ad){_0x5c9f56=_0x5c9f56-0x0;var _0x2a726b=_0xfa94[_0x5c9f56];return _0x2a726b;};'use strict';var multer=require(_0x4fa9('0x0'));var util=require('util');var path=require(_0x4fa9('0x1'));var timeout=require('connect-timeout');var express=require(_0x4fa9('0x2'));var router=express[_0x4fa9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4fa9('0x4'));var config=require(_0x4fa9('0x5'));var controller=require(_0x4fa9('0x6'));router[_0x4fa9('0x7')]('/',auth[_0x4fa9('0x8')](),controller[_0x4fa9('0x9')]);router[_0x4fa9('0x7')]('/:id',auth[_0x4fa9('0x8')](),controller[_0x4fa9('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4fa9('0xb')]);router['put'](_0x4fa9('0xc'),auth[_0x4fa9('0x8')](),controller[_0x4fa9('0xd')]);router['delete'](_0x4fa9('0xc'),auth['isAuthenticated'](),controller[_0x4fa9('0xe')]);module[_0x4fa9('0xf')]=router; \ No newline at end of file +var _0x2542=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0x417955,_0x4ed8c8){var _0x3a94ef=function(_0xa3a38d){while(--_0xa3a38d){_0x417955['push'](_0x417955['shift']());}};_0x3a94ef(++_0x4ed8c8);}(_0x2542,0x169));var _0x2254=function(_0x1a6c17,_0x4b4b88){_0x1a6c17=_0x1a6c17-0x0;var _0x1f4557=_0x2542[_0x1a6c17];return _0x1f4557;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2254('0x5'));var config=require(_0x2254('0x6'));var controller=require(_0x2254('0x7'));router[_0x2254('0x8')]('/',auth[_0x2254('0x9')](),controller['index']);router[_0x2254('0x8')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xb')]);router[_0x2254('0xc')]('/',auth[_0x2254('0x9')](),controller[_0x2254('0xd')]);router[_0x2254('0xe')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xf')]);router['delete'](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0x10')]);module[_0x2254('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index a8427c0..3c1c514 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 _0x358b=['4800','7200','9600','14400','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400'];(function(_0x692282,_0x279660){var _0x172aa8=function(_0x5bd982){while(--_0x5bd982){_0x692282['push'](_0x692282['shift']());}};_0x172aa8(++_0x279660);}(_0x358b,0xca));var _0xb358=function(_0x37537f,_0x18d693){_0x37537f=_0x37537f-0x0;var _0x3296f0=_0x358b[_0x37537f];return _0x3296f0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb358('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb358('0x0')]},'ecm':{'type':Sequelize[_0xb358('0x1')](_0xb358('0x2'),'no'),'defaultValue':_0xb358('0x2')},'headerinfo':{'type':Sequelize[_0xb358('0x0')],'defaultValue':_0xb358('0x3')},'localstationid':{'type':Sequelize[_0xb358('0x0')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xb358('0x1')](_0xb358('0x4'),_0xb358('0x5'),_0xb358('0x6'),_0xb358('0x7'),'12000',_0xb358('0x8')),'defaultValue':_0xb358('0x5')},'maxrate':{'type':Sequelize['ENUM'](_0xb358('0x4'),_0xb358('0x5'),'7200',_0xb358('0x7'),_0xb358('0x9'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xb358('0x0')],'defaultValue':_0xb358('0xa')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xb358('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xb358('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xb358('0x1')](_0xb358('0xc'),_0xb358('0xd'),_0xb358('0xe'),_0xb358('0xf')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xb358('0x0')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb358('0x10')],'defaultValue':function(){return _0xb358('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb358('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb358('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb358('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb358('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0xb358('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xb358('0x12')],'defaultValue':![],'comment':_0xb358('0x14'),'set':function(_0x2fc5f7){if(!_0x2fc5f7)this['setDataValue'](_0xb358('0x15'),null);this['setDataValue'](_0xb358('0x16'),_0x2fc5f7);}}}; \ No newline at end of file +var _0x2893=['DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','STRING','ENUM','yes','2400','4800','7200','9600','12000','v17,v27,v29','INTEGER','SIP','IAX'];(function(_0x2edf08,_0x1f458b){var _0x13de8d=function(_0x3a864a){while(--_0x3a864a){_0x2edf08['push'](_0x2edf08['shift']());}};_0x13de8d(++_0x1f458b);}(_0x2893,0x12e));var _0x3289=function(_0x9f3e89,_0x39b12c){_0x9f3e89=_0x9f3e89-0x0;var _0x12d365=_0x2893[_0x9f3e89];return _0x12d365;};'use strict';var Sequelize=require(_0x3289('0x0'));module['exports']={'name':{'type':Sequelize[_0x3289('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3289('0x1')]},'ecm':{'type':Sequelize[_0x3289('0x2')](_0x3289('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x3289('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x3289('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x3289('0x2')](_0x3289('0x4'),_0x3289('0x5'),_0x3289('0x6'),'9600','12000','14400'),'defaultValue':_0x3289('0x5')},'maxrate':{'type':Sequelize[_0x3289('0x2')](_0x3289('0x4'),_0x3289('0x5'),_0x3289('0x6'),_0x3289('0x7'),_0x3289('0x8'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x3289('0x1')],'defaultValue':_0x3289('0x9')},'gateway':{'type':Sequelize[_0x3289('0x1')],'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[_0x3289('0xa')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x3289('0x2')](_0x3289('0xb'),_0x3289('0xc'),_0x3289('0xd'),_0x3289('0xe')),'defaultValue':_0x3289('0xb')},'key':{'type':Sequelize[_0x3289('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3289('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x3289('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3289('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3289('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3289('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3289('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3289('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3289('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x3289('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x3289('0x10')],'defaultValue':![],'comment':_0x3289('0x12'),'set':function(_0x5c59b7){if(!_0x5c59b7)this['setDataValue'](_0x3289('0x13'),null);this[_0x3289('0x14')]('mandatoryDisposition',_0x5c59b7);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 95b9e8f..55a871b 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 _0x82bf=['Tags','color','tag','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','exten','localstationid','app','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','modem','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','addAccountApplications','VoiceExtension','updateAccountApplications','tech','key','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','send','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','isNil','from','\x22%s\x22\x20<%s>','fax','defaults','Send\x20Fax\x20failed','out','filename','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','destroy','get','FaxAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','FaxAccount','includeAll','findAll','params','keys','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','include','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname'];(function(_0x217007,_0x1446d7){var _0x5287bd=function(_0x2413fd){while(--_0x2413fd){_0x217007['push'](_0x217007['shift']());}};_0x5287bd(++_0x1446d7);}(_0x82bf,0xfd));var _0xf82b=function(_0x508300,_0xa0a97b){_0x508300=_0x508300-0x0;var _0xd6cfcd=_0x82bf[_0x508300];return _0xd6cfcd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf82b('0x0'));var rimraf=require(_0xf82b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf82b('0x2'));var moment=require('moment');var BPromise=require(_0xf82b('0x3'));var Mustache=require(_0xf82b('0x4'));var util=require('util');var path=require(_0xf82b('0x5'));var sox=require(_0xf82b('0x6'));var csv=require(_0xf82b('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf82b('0x8'));var squel=require(_0xf82b('0x9'));var crypto=require('crypto');var jsforce=require(_0xf82b('0xa'));var deskjs=require(_0xf82b('0xb'));var toCsv=require(_0xf82b('0x7'));var querystring=require(_0xf82b('0xc'));var Papa=require('papaparse');var Redis=require(_0xf82b('0xd'));var authService=require(_0xf82b('0xe'));var qs=require(_0xf82b('0xf'));var as=require(_0xf82b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf82b('0x11'))(_0xf82b('0x12'));var utils=require(_0xf82b('0x13'));var config=require('../../config/environment');var db=require(_0xf82b('0x14'))['db'];config[_0xf82b('0x15')]=_['defaults'](config[_0xf82b('0x15')],{'host':_0xf82b('0x16'),'port':0x18eb});var socket=require(_0xf82b('0x17'))(new Redis(config['redis']));require(_0xf82b('0x18'))[_0xf82b('0x19')](socket);var jayson=require(_0xf82b('0x1a'));var client=jayson[_0xf82b('0x1b')][_0xf82b('0x1c')]({'port':0x232c});var client9002=jayson[_0xf82b('0x1b')][_0xf82b('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3d0190,_0x122c3a,_0x7598a7){if(_0x7598a7){var _0x581d33=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x581d33[_0xf82b('0x1d')](_0x122c3a)){return _0x3d0190;}else{throw new db[(_0xf82b('0x1e'))][(_0xf82b('0x1f'))](_0xf82b('0x20'));}}else{return _0x3d0190;}}function respondWithRpcPromise(_0x4f52e7,_0x322f0d,_0x3df114,_0x1562b2){return new BPromise(function(_0x4985ec,_0x1ae046){var _0x25ed4d=_0x1562b2||client;return _0x25ed4d[_0xf82b('0x21')](_0x4f52e7,_0x3df114)[_0xf82b('0x22')](function(_0x20baff){logger[_0xf82b('0x23')]('FaxAccount,\x20%s,\x20%s',_0x322f0d,'request\x20sent');logger[_0xf82b('0x24')](_0xf82b('0x25'),_0x322f0d,_0xf82b('0x26'),JSON[_0xf82b('0x27')](_0x20baff));if(_0x20baff[_0xf82b('0x28')]){if(_0x20baff[_0xf82b('0x28')][_0xf82b('0x29')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x322f0d,_0x20baff[_0xf82b('0x28')]['message']);return _0x1ae046(_0x20baff[_0xf82b('0x28')]['message']);}logger[_0xf82b('0x28')](_0xf82b('0x2a'),_0x322f0d,_0x20baff[_0xf82b('0x28')][_0xf82b('0x2b')]);return _0x4985ec(_0x20baff[_0xf82b('0x28')][_0xf82b('0x2b')]);}else{logger['info'](_0xf82b('0x2a'),_0x322f0d,_0xf82b('0x26'));_0x4985ec(_0x20baff['result'][_0xf82b('0x2b')]);}})[_0xf82b('0x2c')](function(_0x5bdc7b){logger[_0xf82b('0x28')]('FaxAccount,\x20%s,\x20%s',_0x322f0d,_0x5bdc7b);_0x1ae046(_0x5bdc7b);});});}function respondWithStatusCode(_0x5c4048,_0xc55f37){_0xc55f37=_0xc55f37||0xcc;return function(_0x4e4c81){if(_0x4e4c81){return _0x5c4048[_0xf82b('0x2d')](_0xc55f37);}return _0x5c4048[_0xf82b('0x2e')](_0xc55f37)[_0xf82b('0x2f')]();};}function respondWithResult(_0x228b11,_0x2db021){_0x2db021=_0x2db021||0xc8;return function(_0x2ba112){if(_0x2ba112){return _0x228b11[_0xf82b('0x2e')](_0x2db021)[_0xf82b('0x30')](_0x2ba112);}};}function respondWithFilteredResult(_0x52e933,_0x780aa4){return function(_0x49891d){if(_0x49891d){var _0x2a4aa8=_0x49891d[_0xf82b('0x31')],_0x11e711=_0x780aa4[_0xf82b('0x32')],_0x97c913=_0x780aa4['offset']+_0x780aa4[_0xf82b('0x33')],_0x1df0ed;if(_0x97c913>=_0x2a4aa8){_0x97c913=_0x2a4aa8;_0x1df0ed=0xc8;}else{_0x1df0ed=0xce;}_0x52e933[_0xf82b('0x2e')](_0x1df0ed);return _0x52e933[_0xf82b('0x34')]('Content-Range',_0x11e711+'-'+_0x97c913+'/'+_0x2a4aa8)[_0xf82b('0x30')](_0x49891d);}return null;};}function patchUpdates(_0x161cd2){return function(_0x5b004d){try{jsonpatch[_0xf82b('0x35')](_0x5b004d,_0x161cd2,!![]);}catch(_0x2931e7){return BPromise[_0xf82b('0x36')](_0x2931e7);}return _0x5b004d['save']();};}function saveUpdates(_0x248ad9,_0x1ad951){return function(_0x1f0e1d){if(_0x1f0e1d){return _0x1f0e1d[_0xf82b('0x37')](_0x248ad9)['then'](function(_0x289bb7){return _0x289bb7;});}return null;};}function removeEntity(_0x1de92e,_0x34a536){return function(_0x406889){if(_0x406889){return _0x406889[_0xf82b('0x38')]()['then'](function(){var _0x5eed9a=_0x406889[_0xf82b('0x39')]({'plain':!![]});var _0x76baee=_0xf82b('0x3a');return db[_0xf82b('0x3b')]['destroy']({'where':{'type':_0x76baee,'resourceId':_0x5eed9a['id']}})['then'](function(){return _0x406889;});})[_0xf82b('0x22')](function(){_0x1de92e['status'](0xcc)[_0xf82b('0x2f')]();});}};}function handleEntityNotFound(_0x933570,_0x3c55d7){return function(_0x4e8ffb){if(!_0x4e8ffb){_0x933570[_0xf82b('0x2d')](0x194);}return _0x4e8ffb;};}function handleError(_0x1428f0,_0x504ac6){_0x504ac6=_0x504ac6||0x1f4;return function(_0x17bac9){logger[_0xf82b('0x28')](_0x17bac9['stack']);if(_0x17bac9[_0xf82b('0x3c')]){delete _0x17bac9[_0xf82b('0x3c')];}_0x1428f0[_0xf82b('0x2e')](_0x504ac6)['send'](_0x17bac9);};}exports[_0xf82b('0x3d')]=function(_0x399d16,_0x20faae){var _0x361f19={'include':[{'model':db[_0xf82b('0x3e')],'as':_0xf82b('0x3f')}]},_0x34913e={},_0x5c1159={'count':0x0,'rows':[]};var _0x3c40f8=_[_0xf82b('0x40')](db['FaxAccount']['rawAttributes'],function(_0x53087f){return{'name':_0x53087f[_0xf82b('0x41')],'type':_0x53087f[_0xf82b('0x42')]['key']};});_0x34913e['model']=_['map'](_0x3c40f8,'name');_0x34913e[_0xf82b('0x43')]=_['keys'](_0x399d16[_0xf82b('0x43')]);_0x34913e[_0xf82b('0x44')]=_['intersection'](_0x34913e[_0xf82b('0x45')],_0x34913e[_0xf82b('0x43')]);_0x361f19[_0xf82b('0x46')]=_[_0xf82b('0x47')](_0x34913e['model'],qs['fields'](_0x399d16['query'][_0xf82b('0x48')]));_0x361f19[_0xf82b('0x46')]=_0x361f19[_0xf82b('0x46')][_0xf82b('0x49')]?_0x361f19[_0xf82b('0x46')]:_0x34913e[_0xf82b('0x45')];if(!_0x399d16['query'][_0xf82b('0x4a')](_0xf82b('0x4b'))){_0x361f19[_0xf82b('0x33')]=qs[_0xf82b('0x33')](_0x399d16[_0xf82b('0x43')]['limit']);_0x361f19[_0xf82b('0x32')]=qs[_0xf82b('0x32')](_0x399d16[_0xf82b('0x43')][_0xf82b('0x32')]);}_0x361f19[_0xf82b('0x4c')]=qs[_0xf82b('0x4d')](_0x399d16[_0xf82b('0x43')][_0xf82b('0x4d')]);_0x361f19[_0xf82b('0x4e')]=qs[_0xf82b('0x44')](_[_0xf82b('0x4f')](_0x399d16[_0xf82b('0x43')],_0x34913e[_0xf82b('0x44')]),_0x3c40f8);if(_0x399d16[_0xf82b('0x43')][_0xf82b('0x50')]){_0x361f19[_0xf82b('0x4e')]=_['merge'](_0x361f19[_0xf82b('0x4e')],{'$or':_['map'](_0x3c40f8,function(_0x1d9f64){if(_0x1d9f64[_0xf82b('0x42')]!==_0xf82b('0x51')){var _0x3f568f={};_0x3f568f[_0x1d9f64[_0xf82b('0x3c')]]={'$like':'%'+_0x399d16['query'][_0xf82b('0x50')]+'%'};return _0x3f568f;}})});}_0x361f19=_[_0xf82b('0x52')]({},_0x361f19,_0x399d16[_0xf82b('0x53')]);var _0x34d999={'where':_0x361f19['where']};return db[_0xf82b('0x54')][_0xf82b('0x31')](_0x34d999)['then'](function(_0x3745ff){_0x5c1159[_0xf82b('0x31')]=_0x3745ff;if(_0x399d16['query'][_0xf82b('0x55')]){_0x361f19['include']=[{'all':!![]}];}return db[_0xf82b('0x54')][_0xf82b('0x56')](_0x361f19);})[_0xf82b('0x22')](function(_0x4a9243){_0x5c1159['rows']=_0x4a9243;return _0x5c1159;})['then'](respondWithFilteredResult(_0x20faae,_0x361f19))['catch'](handleError(_0x20faae,null));};exports['show']=function(_0x30ff3d,_0x4dc421){var _0x599824={'raw':![],'where':{'id':_0x30ff3d[_0xf82b('0x57')]['id']},'include':[{'model':db[_0xf82b('0x3e')],'as':_0xf82b('0x3f')}]},_0x313f45={};_0x313f45['model']=_[_0xf82b('0x58')](db[_0xf82b('0x54')][_0xf82b('0x59')]);_0x313f45[_0xf82b('0x43')]=_[_0xf82b('0x58')](_0x30ff3d['query']);_0x313f45['filters']=_['intersection'](_0x313f45['model'],_0x313f45[_0xf82b('0x43')]);_0x599824[_0xf82b('0x46')]=_[_0xf82b('0x47')](_0x313f45['model'],qs[_0xf82b('0x48')](_0x30ff3d[_0xf82b('0x43')][_0xf82b('0x48')]));_0x599824[_0xf82b('0x46')]=_0x599824[_0xf82b('0x46')][_0xf82b('0x49')]?_0x599824[_0xf82b('0x46')]:_0x313f45[_0xf82b('0x45')];if(_0x30ff3d[_0xf82b('0x43')]['includeAll']){_0x599824['include']=[{'all':!![]}];}_0x599824=_[_0xf82b('0x52')]({},_0x599824,_0x30ff3d[_0xf82b('0x53')]);return db[_0xf82b('0x54')]['find'](_0x599824)['then'](handleEntityNotFound(_0x4dc421,null))[_0xf82b('0x22')](respondWithResult(_0x4dc421,null))['catch'](handleError(_0x4dc421,null));};exports['create']=function(_0x261c7a,_0x5b5ac7){return db['FaxAccount'][_0xf82b('0x5a')](_0x261c7a[_0xf82b('0x5b')],{})[_0xf82b('0x22')](function(_0x16a7b4){var _0x178a51=_0x261c7a['user']['get']({'plain':!![]});if(!_0x178a51)throw new Error(_0xf82b('0x5c'));if(_0x178a51['role']===_0xf82b('0x5d')){var _0x36fd18=_0x16a7b4[_0xf82b('0x39')]({'plain':!![]});var _0x227e02='FaxAccounts';return db['UserProfileSection'][_0xf82b('0x5e')]({'where':{'name':_0x227e02,'userProfileId':_0x178a51[_0xf82b('0x5f')]},'raw':!![]})[_0xf82b('0x22')](function(_0x3bc942){if(_0x3bc942&&_0x3bc942[_0xf82b('0x60')]===0x0){return db[_0xf82b('0x3b')][_0xf82b('0x5a')]({'name':_0x36fd18[_0xf82b('0x3c')],'resourceId':_0x36fd18['id'],'type':_0x3bc942[_0xf82b('0x3c')],'sectionId':_0x3bc942['id']},{})[_0xf82b('0x22')](function(){return _0x16a7b4;});}else{return _0x16a7b4;}})[_0xf82b('0x2c')](function(_0x568ede){logger['error'](_0xf82b('0x61'),_0x568ede);throw _0x568ede;});}return _0x16a7b4;})[_0xf82b('0x22')](respondWithResult(_0x5b5ac7,0xc9))[_0xf82b('0x2c')](handleError(_0x5b5ac7,null));};exports[_0xf82b('0x37')]=function(_0x30c4c5,_0x27a21a){if(_0x30c4c5[_0xf82b('0x5b')]['id']){delete _0x30c4c5['body']['id'];}return db[_0xf82b('0x54')][_0xf82b('0x5e')]({'where':{'id':_0x30c4c5['params']['id']},'include':[{'model':db[_0xf82b('0x3e')],'as':_0xf82b('0x3f')}]})['then'](handleEntityNotFound(_0x27a21a,null))['then'](saveUpdates(_0x30c4c5[_0xf82b('0x5b')],null))['then'](respondWithResult(_0x27a21a,null))[_0xf82b('0x2c')](handleError(_0x27a21a,null));};exports['destroy']=function(_0x33f35e,_0xba0873){return db[_0xf82b('0x54')][_0xf82b('0x5e')]({'where':{'id':_0x33f35e[_0xf82b('0x57')]['id']}})[_0xf82b('0x22')](handleEntityNotFound(_0xba0873,null))[_0xf82b('0x22')](removeEntity(_0xba0873,null))[_0xf82b('0x2c')](handleError(_0xba0873,null));};exports[_0xf82b('0x62')]=function(_0x381664,_0x123ac0){return db[_0xf82b('0x54')][_0xf82b('0x62')]()[_0xf82b('0x22')](respondWithResult(_0x123ac0,null))['catch'](handleError(_0x123ac0,null));};exports[_0xf82b('0x63')]=function(_0x3d9f9f,_0xac86ba,_0x460ed1){if(_0x3d9f9f['body']['id']){delete _0x3d9f9f[_0xf82b('0x5b')]['id'];}return db[_0xf82b('0x54')][_0xf82b('0x5e')]({'where':{'id':_0x3d9f9f[_0xf82b('0x57')]['id']}})[_0xf82b('0x22')](handleEntityNotFound(_0xac86ba,null))[_0xf82b('0x22')](function(_0x147401){if(_0x147401){_0x3d9f9f[_0xf82b('0x5b')][_0xf82b('0x64')]=_0x147401['id'];return db['Disposition'][_0xf82b('0x5a')](_0x3d9f9f[_0xf82b('0x5b')]);}})[_0xf82b('0x22')](respondWithResult(_0xac86ba,null))[_0xf82b('0x2c')](handleError(_0xac86ba,null));};exports[_0xf82b('0x65')]=function(_0xe6cab3,_0x5acb0c,_0x17f771){var _0x16d75d={'raw':![],'where':{}};var _0x98ef6f={};var _0xc169ce={'count':0x0,'rows':[]};return db[_0xf82b('0x54')][_0xf82b('0x66')]({'where':{'id':_0xe6cab3['params']['id']}})[_0xf82b('0x22')](handleEntityNotFound(_0x5acb0c,null))[_0xf82b('0x22')](function(_0x1e51e5){if(_0x1e51e5){_0x98ef6f[_0xf82b('0x45')]=_[_0xf82b('0x58')](db[_0xf82b('0x67')]['rawAttributes']);_0x98ef6f[_0xf82b('0x43')]=_[_0xf82b('0x58')](_0xe6cab3[_0xf82b('0x43')]);_0x98ef6f[_0xf82b('0x44')]=_[_0xf82b('0x47')](_0x98ef6f['model'],_0x98ef6f['query']);_0x16d75d[_0xf82b('0x46')]=_[_0xf82b('0x47')](_0x98ef6f[_0xf82b('0x45')],qs['fields'](_0xe6cab3[_0xf82b('0x43')][_0xf82b('0x48')]));_0x16d75d[_0xf82b('0x46')]=_0x16d75d['attributes'][_0xf82b('0x49')]?_0x16d75d[_0xf82b('0x46')]:_0x98ef6f[_0xf82b('0x45')];if(!_0xe6cab3['query'][_0xf82b('0x4a')](_0xf82b('0x4b'))){_0x16d75d['limit']=qs[_0xf82b('0x33')](_0xe6cab3[_0xf82b('0x43')][_0xf82b('0x33')]);_0x16d75d['offset']=qs['offset'](_0xe6cab3['query'][_0xf82b('0x32')]);}_0x16d75d[_0xf82b('0x4c')]=qs['sort'](_0xe6cab3[_0xf82b('0x43')][_0xf82b('0x4d')]);_0x16d75d['where']=qs[_0xf82b('0x44')](_['pick'](_0xe6cab3[_0xf82b('0x43')],_0x98ef6f[_0xf82b('0x44')]));_0x16d75d[_0xf82b('0x4e')][_0xf82b('0x64')]=_0x1e51e5['id'];if(_0xe6cab3[_0xf82b('0x43')][_0xf82b('0x50')]){_0x16d75d['where']=_[_0xf82b('0x52')](_0x16d75d[_0xf82b('0x4e')],{'$or':_['map'](_0x16d75d['attributes'],function(_0xbc77f0){var _0x145ef2={};_0x145ef2[_0xbc77f0]={'$like':'%'+_0xe6cab3[_0xf82b('0x43')][_0xf82b('0x50')]+'%'};return _0x145ef2;})});}_0x16d75d=_[_0xf82b('0x52')]({},_0x16d75d,_0xe6cab3['options']);return db['Disposition'][_0xf82b('0x31')]({'where':_0x16d75d[_0xf82b('0x4e')]})[_0xf82b('0x22')](function(_0x39432a){_0xc169ce[_0xf82b('0x31')]=_0x39432a;if(_0xe6cab3[_0xf82b('0x43')][_0xf82b('0x55')]){_0x16d75d[_0xf82b('0x68')]=[{'all':!![]}];}return db['Disposition'][_0xf82b('0x56')](_0x16d75d);})[_0xf82b('0x22')](function(_0x3ab71b){_0xc169ce[_0xf82b('0x69')]=_0x3ab71b;return _0xc169ce;});}})[_0xf82b('0x22')](respondWithFilteredResult(_0x5acb0c,_0x16d75d))[_0xf82b('0x2c')](handleError(_0x5acb0c,null));};exports[_0xf82b('0x6a')]=function(_0x70d6c1,_0x1b6ca5,_0x378225){return db[_0xf82b('0x54')]['find']({'where':{'id':_0x70d6c1[_0xf82b('0x57')]['id']}})[_0xf82b('0x22')](handleEntityNotFound(_0x1b6ca5,null))[_0xf82b('0x22')](function(_0x822190){if(_0x822190){return _0x822190[_0xf82b('0x6a')](_0x70d6c1['query'][_0xf82b('0x6b')]);}})[_0xf82b('0x22')](respondWithStatusCode(_0x1b6ca5,null))[_0xf82b('0x2c')](handleError(_0x1b6ca5,null));};exports['addAnswer']=function(_0x5a01d9,_0x340083,_0x5cbadf){if(_0x5a01d9['body']['id']){delete _0x5a01d9[_0xf82b('0x5b')]['id'];}return db[_0xf82b('0x54')]['find']({'where':{'id':_0x5a01d9[_0xf82b('0x57')]['id']}})[_0xf82b('0x22')](handleEntityNotFound(_0x340083,null))[_0xf82b('0x22')](function(_0x5264f5){if(_0x5264f5){_0x5a01d9['body']['FaxAccountId']=_0x5264f5['id'];return db[_0xf82b('0x6c')][_0xf82b('0x5a')](_0x5a01d9['body']);}})[_0xf82b('0x22')](respondWithResult(_0x340083,null))['catch'](handleError(_0x340083,null));};exports[_0xf82b('0x6d')]=function(_0x56f0ba,_0x2a9bb5,_0x2346ed){var _0x95f880={'raw':![],'where':{}};var _0x1164c8={};var _0x5e34d0={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x56f0ba[_0xf82b('0x57')]['id']}})['then'](handleEntityNotFound(_0x2a9bb5,null))[_0xf82b('0x22')](function(_0x356d2d){if(_0x356d2d){_0x1164c8['model']=_['keys'](db[_0xf82b('0x6c')][_0xf82b('0x59')]);_0x1164c8[_0xf82b('0x43')]=_['keys'](_0x56f0ba['query']);_0x1164c8[_0xf82b('0x44')]=_['intersection'](_0x1164c8[_0xf82b('0x45')],_0x1164c8['query']);_0x95f880['attributes']=_[_0xf82b('0x47')](_0x1164c8['model'],qs[_0xf82b('0x48')](_0x56f0ba[_0xf82b('0x43')][_0xf82b('0x48')]));_0x95f880[_0xf82b('0x46')]=_0x95f880['attributes'][_0xf82b('0x49')]?_0x95f880['attributes']:_0x1164c8[_0xf82b('0x45')];if(!_0x56f0ba[_0xf82b('0x43')][_0xf82b('0x4a')](_0xf82b('0x4b'))){_0x95f880['limit']=qs[_0xf82b('0x33')](_0x56f0ba['query'][_0xf82b('0x33')]);_0x95f880[_0xf82b('0x32')]=qs[_0xf82b('0x32')](_0x56f0ba[_0xf82b('0x43')][_0xf82b('0x32')]);}_0x95f880[_0xf82b('0x4c')]=qs[_0xf82b('0x4d')](_0x56f0ba[_0xf82b('0x43')][_0xf82b('0x4d')]);_0x95f880[_0xf82b('0x4e')]=qs[_0xf82b('0x44')](_['pick'](_0x56f0ba[_0xf82b('0x43')],_0x1164c8['filters']));_0x95f880[_0xf82b('0x4e')][_0xf82b('0x64')]=_0x356d2d['id'];if(_0x56f0ba[_0xf82b('0x43')]['filter']){_0x95f880[_0xf82b('0x4e')]=_[_0xf82b('0x52')](_0x95f880[_0xf82b('0x4e')],{'$or':_[_0xf82b('0x40')](_0x95f880[_0xf82b('0x46')],function(_0x22df89){var _0x495177={};_0x495177[_0x22df89]={'$like':'%'+_0x56f0ba[_0xf82b('0x43')][_0xf82b('0x50')]+'%'};return _0x495177;})});}_0x95f880=_['merge']({},_0x95f880,_0x56f0ba['options']);return db[_0xf82b('0x6c')][_0xf82b('0x31')]({'where':_0x95f880['where']})[_0xf82b('0x22')](function(_0x4f26d3){_0x5e34d0[_0xf82b('0x31')]=_0x4f26d3;if(_0x56f0ba[_0xf82b('0x43')][_0xf82b('0x55')]){_0x95f880[_0xf82b('0x68')]=[{'all':!![]}];}return db[_0xf82b('0x6c')][_0xf82b('0x56')](_0x95f880);})[_0xf82b('0x22')](function(_0x44f2e6){_0x5e34d0[_0xf82b('0x69')]=_0x44f2e6;return _0x5e34d0;});}})[_0xf82b('0x22')](respondWithFilteredResult(_0x2a9bb5,_0x95f880))['catch'](handleError(_0x2a9bb5,null));};exports[_0xf82b('0x6e')]=function(_0x599397,_0x53fafd,_0x1d65e2){return db['FaxAccount']['find']({'where':{'id':_0x599397['params']['id']}})[_0xf82b('0x22')](handleEntityNotFound(_0x53fafd,null))['then'](function(_0x3a807e){if(_0x3a807e){return _0x3a807e['removeAnswers'](_0x599397[_0xf82b('0x43')][_0xf82b('0x6b')]);}})[_0xf82b('0x22')](respondWithStatusCode(_0x53fafd,null))[_0xf82b('0x2c')](handleError(_0x53fafd,null));};exports[_0xf82b('0x6f')]=function(_0x94ce36,_0x554d21,_0x2c914b){return db[_0xf82b('0x70')][_0xf82b('0x5e')]({'where':{'id':_0x94ce36['params']['id']}})[_0xf82b('0x22')](handleEntityNotFound(_0x554d21,null))[_0xf82b('0x22')](function(_0x13bc5e){if(_0x13bc5e){return _0x13bc5e[_0xf82b('0x6f')](_0x94ce36[_0xf82b('0x5b')]['ids'],_[_0xf82b('0x71')](_0x94ce36[_0xf82b('0x5b')],[_0xf82b('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x554d21,null))[_0xf82b('0x2c')](handleError(_0x554d21,null));};exports[_0xf82b('0x72')]=function(_0x3dd4b2,_0x53b53c,_0x500bc4){var _0x222fc5={'raw':![],'where':{}};var _0x11e89b={};var _0x34a39c={'count':0x0,'rows':[]};return db[_0xf82b('0x54')]['findOne']({'where':{'id':_0x3dd4b2[_0xf82b('0x57')]['id']}})['then'](handleEntityNotFound(_0x53b53c,null))[_0xf82b('0x22')](function(_0x18b82f){if(_0x18b82f){_0x11e89b[_0xf82b('0x45')]=_[_0xf82b('0x58')](db[_0xf82b('0x70')][_0xf82b('0x59')]);_0x11e89b[_0xf82b('0x43')]=_[_0xf82b('0x58')](_0x3dd4b2['query']);_0x11e89b[_0xf82b('0x44')]=_[_0xf82b('0x47')](_0x11e89b[_0xf82b('0x45')],_0x11e89b[_0xf82b('0x43')]);_0x222fc5[_0xf82b('0x46')]=_['intersection'](_0x11e89b['model'],qs[_0xf82b('0x48')](_0x3dd4b2[_0xf82b('0x43')][_0xf82b('0x48')]));_0x222fc5['attributes']=_0x222fc5[_0xf82b('0x46')][_0xf82b('0x49')]?_0x222fc5[_0xf82b('0x46')]:_0x11e89b['model'];if(!_0x3dd4b2[_0xf82b('0x43')]['hasOwnProperty']('nolimit')){_0x222fc5['limit']=qs[_0xf82b('0x33')](_0x3dd4b2[_0xf82b('0x43')][_0xf82b('0x33')]);_0x222fc5[_0xf82b('0x32')]=qs[_0xf82b('0x32')](_0x3dd4b2['query'][_0xf82b('0x32')]);}_0x222fc5[_0xf82b('0x4c')]=qs[_0xf82b('0x4d')](_0x3dd4b2[_0xf82b('0x43')][_0xf82b('0x4d')]);_0x222fc5[_0xf82b('0x4e')]=qs[_0xf82b('0x44')](_[_0xf82b('0x4f')](_0x3dd4b2['query'],_0x11e89b[_0xf82b('0x44')]));_0x222fc5[_0xf82b('0x4e')][_0xf82b('0x64')]=_0x18b82f['id'];if(_0x3dd4b2[_0xf82b('0x43')][_0xf82b('0x50')]){_0x222fc5[_0xf82b('0x4e')]=_[_0xf82b('0x52')](_0x222fc5[_0xf82b('0x4e')],{'$or':_[_0xf82b('0x40')](_0x222fc5[_0xf82b('0x46')],function(_0x18fab8){var _0x3e3ad6={};_0x3e3ad6[_0x18fab8]={'$like':'%'+_0x3dd4b2[_0xf82b('0x43')]['filter']+'%'};return _0x3e3ad6;})});}_0x222fc5=_[_0xf82b('0x52')]({},_0x222fc5,_0x3dd4b2['options']);return db[_0xf82b('0x70')]['count']({'where':_0x222fc5[_0xf82b('0x4e')]})[_0xf82b('0x22')](function(_0x3cdde3){_0x34a39c[_0xf82b('0x31')]=_0x3cdde3;if(_0x3dd4b2[_0xf82b('0x43')][_0xf82b('0x55')]){_0x222fc5[_0xf82b('0x68')]=[{'model':db[_0xf82b('0x73')],'as':'Contact','required':![]},{'model':db[_0xf82b('0x74')],'as':_0xf82b('0x75'),'attributes':[_0xf82b('0x3c'),_0xf82b('0x76'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xf82b('0x77'),'attributes':['id',_0xf82b('0x3c'),_0xf82b('0x78')],'where':_0x3dd4b2[_0xf82b('0x43')]['tag']?{'id':_0x3dd4b2[_0xf82b('0x43')][_0xf82b('0x79')]}:undefined,'required':_0x3dd4b2['query'][_0xf82b('0x79')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x222fc5);})[_0xf82b('0x22')](function(_0xa044c5){_0x34a39c[_0xf82b('0x69')]=_0xa044c5;return _0x34a39c;});}})['then'](respondWithFilteredResult(_0x53b53c,_0x222fc5))[_0xf82b('0x2c')](handleError(_0x53b53c,null));};exports['addApplications']=function(_0x7502b3,_0xf796a2,_0x24eee0){return db['FaxAccount'][_0xf82b('0x66')]({'where':{'id':_0x7502b3[_0xf82b('0x57')]['id']}})['then'](handleEntityNotFound(_0xf796a2,null))[_0xf82b('0x22')](function(_0x46ad9c){if(_0x46ad9c){return db[_0xf82b('0x7a')][_0xf82b('0x7b')](function(_0x3e3317){return db[_0xf82b('0x7c')]['destroy']({'where':{'FaxAccountId':_0x7502b3[_0xf82b('0x57')]['id']},'transaction':_0x3e3317})[_0xf82b('0x22')](function(_0x3d72a3){var _0x4ea6bd=_[_0xf82b('0x40')](_0x7502b3[_0xf82b('0x5b')],function(_0xa69df3){_0xa69df3[_0xf82b('0x64')]=_0x7502b3[_0xf82b('0x57')]['id'];return _0xa69df3;});return db[_0xf82b('0x7c')][_0xf82b('0x7d')](_0x4ea6bd,{'transaction':_0x3e3317});});})[_0xf82b('0x22')](function(){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x7502b3[_0xf82b('0x57')]['id']},'order':_0xf82b('0x7e')});});}})['then'](respondWithResult(_0xf796a2,null))[_0xf82b('0x2c')](handleError(_0xf796a2,null));};exports[_0xf82b('0x7f')]=function(_0x57bbd9,_0x4218e3,_0x4dd42d){var _0xc77ec9={};var _0x46785d={};var _0x35ece8;var _0x43eb5b;return db['FaxAccount'][_0xf82b('0x66')]({'where':{'id':_0x57bbd9[_0xf82b('0x57')]['id']}})[_0xf82b('0x22')](handleEntityNotFound(_0x4218e3,null))['then'](function(_0x1a0080){if(_0x1a0080){_0x35ece8=_0x1a0080;_0x46785d[_0xf82b('0x45')]=_[_0xf82b('0x58')](db[_0xf82b('0x7c')]['rawAttributes']);_0x46785d[_0xf82b('0x43')]=_[_0xf82b('0x58')](_0x57bbd9[_0xf82b('0x43')]);_0x46785d[_0xf82b('0x44')]=_[_0xf82b('0x47')](_0x46785d['model'],_0x46785d[_0xf82b('0x43')]);_0xc77ec9['attributes']=_[_0xf82b('0x47')](_0x46785d[_0xf82b('0x45')],qs['fields'](_0x57bbd9['query'][_0xf82b('0x48')]));_0xc77ec9['attributes']=_0xc77ec9[_0xf82b('0x46')][_0xf82b('0x49')]?_0xc77ec9[_0xf82b('0x46')]:_0x46785d['model'];_0xc77ec9[_0xf82b('0x4c')]=qs[_0xf82b('0x4d')](_0x57bbd9['query']['sort']);_0xc77ec9[_0xf82b('0x4e')]=qs['filters'](_[_0xf82b('0x4f')](_0x57bbd9[_0xf82b('0x43')],_0x46785d[_0xf82b('0x44')]));if(_0x57bbd9[_0xf82b('0x43')][_0xf82b('0x50')]){_0xc77ec9[_0xf82b('0x4e')]=_['merge'](_0xc77ec9['where'],{'$or':_[_0xf82b('0x40')](_0xc77ec9[_0xf82b('0x46')],function(_0x3c2520){var _0x46310f={};_0x46310f[_0x3c2520]={'$like':'%'+_0x57bbd9[_0xf82b('0x43')][_0xf82b('0x50')]+'%'};return _0x46310f;})});}_0xc77ec9=_[_0xf82b('0x52')]({},_0xc77ec9,_0x57bbd9[_0xf82b('0x53')]);return _0x35ece8[_0xf82b('0x7f')](_0xc77ec9);}})[_0xf82b('0x22')](function(_0x211c05){if(_0x211c05){_0x43eb5b=_0x211c05[_0xf82b('0x49')];if(!_0x57bbd9[_0xf82b('0x43')][_0xf82b('0x4a')](_0xf82b('0x4b'))){_0xc77ec9['limit']=qs[_0xf82b('0x33')](_0x57bbd9['query'][_0xf82b('0x33')]);_0xc77ec9['offset']=qs[_0xf82b('0x32')](_0x57bbd9[_0xf82b('0x43')][_0xf82b('0x32')]);}return _0x35ece8['getApplications'](_0xc77ec9);}})['then'](function(_0x566893){if(_0x566893){return _0x566893?{'count':_0x43eb5b,'rows':_0x566893}:null;}})[_0xf82b('0x22')](respondWithResult(_0x4218e3,null))[_0xf82b('0x2c')](handleError(_0x4218e3,null));};function Extension(_0x3e78a3,_0x54e938,_0x2da406,_0x49234c){this[_0xf82b('0x80')]=_0xf82b('0x81');this[_0xf82b('0x82')]=_0x3e78a3[_0xf82b('0x83')];this[_0xf82b('0x84')]=_0x49234c;this[_0xf82b('0x42')]='system';this['description']=_0xf82b('0x85');this[_0xf82b('0x64')]=_0x3e78a3['id'];this['priority']=_0x54e938;this[_0xf82b('0x86')]=_0x2da406;}function createExtensionsReciveFax(_0x3995b8){var _0x24fabd=0x1;var _0x50f504=[];_0x50f504[_0xf82b('0x87')](new Extension(_0x3995b8,_0x24fabd,'','Answer'));_0x24fabd+=0x1;_0x50f504[_0xf82b('0x87')](new Extension(_0x3995b8,_0x24fabd,_0xf82b('0x88'),_0xf82b('0x89')));_0x24fabd+=0x1;for(var _0x56afac in _0x3995b8){if(_0x3995b8[_0xf82b('0x4a')](_0x56afac)&&(_0x56afac===_0xf82b('0x8a')||_0x56afac===_0xf82b('0x83')||_0x56afac===_0xf82b('0x8b')||_0x56afac==='faxdetect'||_0x56afac===_0xf82b('0x8c')||_0x56afac===_0xf82b('0x8d')||_0x56afac==='minrate'||_0x56afac===_0xf82b('0x8e')||_0x56afac==='t38timeout')){_0x50f504[_0xf82b('0x87')](new Extension(_0x3995b8,_0x24fabd,'FAXOPT('+_0x56afac+')='+_0x3995b8[_0x56afac],_0xf82b('0x89')));_0x24fabd+=0x1;}}_0x50f504[_0xf82b('0x87')](new Extension(_0x3995b8,_0x24fabd,'6',_0xf82b('0x8f')));_0x24fabd+=0x1;_0x50f504[_0xf82b('0x87')](new Extension(_0x3995b8,_0x24fabd,_0xf82b('0x90'),'ReceiveFax'));_0x24fabd=0x0;return _0x50f504;}exports[_0xf82b('0x91')]=function(_0x512d44,_0x4f5d03,_0x47987b){var _0x130366;return db[_0xf82b('0x7a')][_0xf82b('0x7b')](function(_0x57af7e){return db['FaxAccount'][_0xf82b('0x5a')](_0x512d44[_0xf82b('0x5b')],{'transaction':_0x57af7e})[_0xf82b('0x22')](function(_0x39ecb8){_0x130366=_0x39ecb8[_0xf82b('0x39')]({'plain':!![]});return db[_0xf82b('0x92')][_0xf82b('0x7d')](createExtensionsReciveFax(_0x130366),{'transaction':_0x57af7e});});})[_0xf82b('0x22')](function(){return _0x130366;})['then'](respondWithResult(_0x4f5d03,null))[_0xf82b('0x2c')](handleError(_0x4f5d03,null));};exports[_0xf82b('0x93')]=function(_0x1bf21c,_0x5aefa5,_0xff0041){var _0xf16b1f;return db[_0xf82b('0x7a')]['transaction'](function(_0x123e02){return db[_0xf82b('0x54')][_0xf82b('0x37')](_0x1bf21c[_0xf82b('0x5b')],{'where':{'id':_0x1bf21c[_0xf82b('0x5b')]['id']},'transaction':_0x123e02})[_0xf82b('0x22')](function(_0x531ad9){return db['VoiceExtension'][_0xf82b('0x38')]({'where':{'FaxAccountId':_0x1bf21c[_0xf82b('0x5b')]['id']},'transaction':_0x123e02})[_0xf82b('0x22')](function(_0x4642cf){return db[_0xf82b('0x92')][_0xf82b('0x7d')](createExtensionsReciveFax(_[_0xf82b('0x71')](_0x1bf21c['body'],[_0xf82b('0x94'),_0xf82b('0x95'),'createdAt','updatedAt',_0xf82b('0x96'),_0xf82b('0x97')])),{'transaction':_0x123e02});});});})[_0xf82b('0x22')](function(){return db[_0xf82b('0x54')][_0xf82b('0x98')](_0x1bf21c['body']['id']);})[_0xf82b('0x22')](respondWithResult(_0x5aefa5,null))[_0xf82b('0x2c')](handleError(_0x5aefa5,null));};exports[_0xf82b('0x99')]=function(_0x9579d,_0x327e26,_0x594c0c){var _0x1611bf={'raw':!![],'where':{}};var _0x38a30d={};var _0x56757b={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x9579d[_0xf82b('0x57')]['id']}})['then'](handleEntityNotFound(_0x327e26,null))['then'](function(_0x3ae059){if(_0x3ae059){_0x38a30d[_0xf82b('0x45')]=_['keys'](db[_0xf82b('0x9a')][_0xf82b('0x59')]);_0x38a30d['query']=_['keys'](_0x9579d[_0xf82b('0x43')]);_0x38a30d[_0xf82b('0x44')]=_[_0xf82b('0x47')](_0x38a30d[_0xf82b('0x45')],_0x38a30d['query']);_0x1611bf[_0xf82b('0x46')]=_[_0xf82b('0x47')](_0x38a30d[_0xf82b('0x45')],qs[_0xf82b('0x48')](_0x9579d['query'][_0xf82b('0x48')]));_0x1611bf[_0xf82b('0x46')]=_0x1611bf[_0xf82b('0x46')]['length']?_0x1611bf[_0xf82b('0x46')]:_0x38a30d['model'];if(!_0x9579d[_0xf82b('0x43')][_0xf82b('0x4a')](_0xf82b('0x4b'))){_0x1611bf[_0xf82b('0x33')]=qs[_0xf82b('0x33')](_0x9579d[_0xf82b('0x43')][_0xf82b('0x33')]);_0x1611bf[_0xf82b('0x32')]=qs['offset'](_0x9579d['query']['offset']);}_0x1611bf[_0xf82b('0x4c')]=qs['sort'](_0x9579d[_0xf82b('0x43')][_0xf82b('0x4d')]);_0x1611bf[_0xf82b('0x4e')]=qs[_0xf82b('0x44')](_[_0xf82b('0x4f')](_0x9579d['query'],_0x38a30d[_0xf82b('0x44')]));_0x1611bf['where'][_0xf82b('0x64')]=_0x3ae059['id'];if(_0x9579d[_0xf82b('0x43')]['filter']){_0x1611bf[_0xf82b('0x4e')]=_[_0xf82b('0x52')](_0x1611bf[_0xf82b('0x4e')],{'$or':_[_0xf82b('0x40')](_0x1611bf[_0xf82b('0x46')],function(_0x3b93c8){var _0x2498bb={};_0x2498bb[_0x3b93c8]={'$like':'%'+_0x9579d['query']['filter']+'%'};return _0x2498bb;})});}if(_0x9579d['query']['$gte']){var _0x112c28=_0x9579d[_0xf82b('0x43')][_0xf82b('0x9b')]['split'](',');var _0x40fe8b={};_0x40fe8b[_0x112c28[0x0]]={'$gte':moment(_0x112c28[0x1])[_0xf82b('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1611bf[_0xf82b('0x4e')]=_['merge'](_0x1611bf[_0xf82b('0x4e')],_0x40fe8b);}_0x1611bf=_[_0xf82b('0x52')]({},_0x1611bf,_0x9579d['options']);return db[_0xf82b('0x9a')][_0xf82b('0x31')]({'where':_0x1611bf[_0xf82b('0x4e')]})[_0xf82b('0x22')](function(_0x3ae720){_0x56757b[_0xf82b('0x31')]=_0x3ae720;if(_0x9579d['query'][_0xf82b('0x55')]){_0x1611bf[_0xf82b('0x68')]=[{'all':!![]}];}return db[_0xf82b('0x9a')][_0xf82b('0x56')](_0x1611bf);})[_0xf82b('0x22')](function(_0x5e6aab){_0x56757b[_0xf82b('0x69')]=_0x5e6aab;return _0x56757b;});}})['then'](respondWithFilteredResult(_0x327e26,_0x1611bf))[_0xf82b('0x2c')](handleError(_0x327e26,null));};exports[_0xf82b('0x9d')]=function(_0x40d9fc,_0x5e5602,_0x1a3099){var _0xe92ddd,_0x4c4584={},_0x1817ce;if(_0x40d9fc['body']['to']){_0x1817ce=_0x40d9fc[_0xf82b('0x5b')]['to'][0x0];}return db[_0xf82b('0x54')][_0xf82b('0x5e')]({'where':{'id':_0x40d9fc[_0xf82b('0x57')]['id']},'include':[{'model':db[_0xf82b('0x9e')],'as':_0xf82b('0x9f'),'include':[{'model':db[_0xf82b('0x73')],'as':_0xf82b('0xa0'),'where':{'fax':_0x1817ce},'limit':0x1,'order':[['updatedAt',_0xf82b('0xa1')]]}]}]})[_0xf82b('0x22')](handleEntityNotFound(_0x5e5602,null))['then'](function(_0xe0948e){_0xe92ddd=_0xe0948e;if(_0x40d9fc['body']['attachments']&&_0x40d9fc['body'][_0xf82b('0xa2')][_0xf82b('0x49')]){for(var _0xff4175=0x0;_0xff4175<_0x40d9fc[_0xf82b('0x5b')][_0xf82b('0xa2')][_0xf82b('0x49')];_0xff4175+=0x1){_0x40d9fc['body'][_0xf82b('0xa2')][_0xff4175]={'filename':_0x40d9fc['body'][_0xf82b('0xa2')][_0xff4175]['name'],'id':_0x40d9fc['body'][_0xf82b('0xa2')][_0xff4175]['id'],'path':path[_0xf82b('0xa3')](config[_0xf82b('0xa4')],_0xf82b('0xa5'),_0x40d9fc[_0xf82b('0x5b')][_0xf82b('0xa2')][_0xff4175]['basename'])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_['isNil'](_0x40d9fc[_0xf82b('0x57')]['id'])?undefined:_0x40d9fc['params']['id'],'path':_[_0xf82b('0xa6')](_0x40d9fc[_0xf82b('0x5b')][_0xf82b('0xa2')][0x0][_0xf82b('0x5')])?undefined:_0x40d9fc[_0xf82b('0x5b')][_0xf82b('0xa2')][0x0][_0xf82b('0x5')],'fax':_[_0xf82b('0xa6')](_0x40d9fc['body']['to'][0x0])?undefined:_0x40d9fc[_0xf82b('0x5b')]['to'][0x0]},client9002);})[_0xf82b('0x22')](function(){if(_0xe92ddd){if(_['isNil'](_0x40d9fc['body'][_0xf82b('0xa7')])){_0x40d9fc[_0xf82b('0x5b')]['from']=util[_0xf82b('0x9c')](_0xf82b('0xa8'),_0xe92ddd[_0xf82b('0x3c')],_0xe92ddd[_0xf82b('0xa9')]);}if(_0xe92ddd[_0xf82b('0x9f')]){if(_0xe92ddd[_0xf82b('0x9f')][_0xf82b('0xa0')][_0xf82b('0x49')]){return _0xe92ddd[_0xf82b('0x9f')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0xf82b('0xaa')](_0x40d9fc[_0xf82b('0x5b')],{'firstName':_0x40d9fc['body']['to'][0x0],'phone':_0x40d9fc['body']['to'][0x0],'fax':_0x40d9fc[_0xf82b('0x5b')]['to'][0x0],'ListId':_0xe92ddd[_0xf82b('0x97')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xf82b('0xab'));}})['then'](function(_0x48eafe){if(_0x48eafe){return db[_0xf82b('0x70')][_0xf82b('0x5e')]({'where':{'ContactId':_0x48eafe['id'],'closed':![],'FaxAccountId':_0xe92ddd['id']}})[_0xf82b('0x22')](function(_0x5d9923){if(_0x5d9923){return[_0x5d9923,![]];}return db['FaxInteraction']['create']({'UserId':_0x40d9fc[_0xf82b('0x5d')]['id'],'ContactId':_0x48eafe['id'],'FaxAccountId':_0xe92ddd['id'],'fax':_0x40d9fc[_0xf82b('0x5b')]['to'][0x0],'firstMsgDirection':_0xf82b('0xac'),'Messages':[_[_0xf82b('0x52')](_0x40d9fc[_0xf82b('0x5b')],{'read':![],'body':_0x40d9fc[_0xf82b('0x5b')][_0xf82b('0xa2')][0x0][_0xf82b('0xad')],'FaxAccountId':_0xe92ddd['id'],'UserId':_0x40d9fc['user']['id'],'ContactId':_0x48eafe['id'],'AttachmentId':_0x40d9fc[_0xf82b('0x5b')][_0xf82b('0xa2')][0x0]['id']})]},{'include':[{'model':db[_0xf82b('0x9a')],'as':_0xf82b('0xae')}]})[_0xf82b('0x22')](function(_0x1b2fe5){return[_0x1b2fe5,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf82b('0xaf')](function(_0x2d6032,_0x53bbb4){if(_0x53bbb4){return _0x2d6032;}return db['FaxMessage'][_0xf82b('0x5a')]({'direction':_0xf82b('0xac'),'read':![],'body':_0x40d9fc[_0xf82b('0x5b')][_0xf82b('0xa2')][0x0][_0xf82b('0xad')],'FaxAccountId':_0xe92ddd['id'],'FaxInteractionId':_0x2d6032['id'],'UserId':_0x40d9fc[_0xf82b('0x5d')]['id'],'ContactId':_0x2d6032[_0xf82b('0xb0')],'AttachmentId':_0x40d9fc[_0xf82b('0x5b')]['attachments'][0x0]['id']})[_0xf82b('0x22')](function(_0x2a3d90){_0x2d6032['dataValues'][_0xf82b('0xae')]=[];_0x2d6032[_0xf82b('0xb1')][_0xf82b('0xae')][_0xf82b('0x87')](_0x2a3d90[_0xf82b('0xb1')]);return _0x2d6032;});})[_0xf82b('0x22')](function(_0xbe838f){respondWithRpcPromise(_0xf82b('0xb2'),'SendFax',{'FaxAccountId':_[_0xf82b('0xa6')](_0x40d9fc['params']['id'])?undefined:_0x40d9fc['params']['id'],'path':_[_0xf82b('0xa6')](_0x40d9fc[_0xf82b('0x5b')][_0xf82b('0xa2')][0x0][_0xf82b('0x5')])?undefined:_0x40d9fc[_0xf82b('0x5b')][_0xf82b('0xa2')][0x0][_0xf82b('0x5')],'fax':_[_0xf82b('0xa6')](_0x40d9fc[_0xf82b('0x5b')]['to'][0x0])?undefined:_0x40d9fc[_0xf82b('0x5b')]['to'][0x0],'AttachmentId':_0x40d9fc[_0xf82b('0x5b')][_0xf82b('0xa2')][0x0]['id']},client9002)[_0xf82b('0x22')](function(_0x3d9569){logger[_0xf82b('0x23')](_0xf82b('0xb3'),_0x3d9569);})[_0xf82b('0x2c')](function(_0xec84cc){logger['info'](_0xf82b('0xb3'),_0xec84cc);});return _0xbe838f;})[_0xf82b('0x22')](respondWithResult(_0x5e5602,null))[_0xf82b('0x2c')](handleError(_0x5e5602,null));};exports[_0xf82b('0xb4')]=function(_0xac1ea3,_0x7bd0a6,_0x11eb2c){return db[_0xf82b('0x54')][_0xf82b('0x5e')]({'where':{'id':_0xac1ea3[_0xf82b('0x57')]['id']}})['then'](handleEntityNotFound(_0x7bd0a6,null))['then'](function(_0x36d131){if(_0x36d131){return _0x36d131[_0xf82b('0xb4')](_0xac1ea3[_0xf82b('0x5b')][_0xf82b('0x6b')],_[_0xf82b('0x71')](_0xac1ea3[_0xf82b('0x5b')],[_0xf82b('0x6b'),'id'])||{})[_0xf82b('0xaf')](function(_0x5ac874){for(var _0x71c3e6=0x0;_0x71c3e6<_0xac1ea3[_0xf82b('0x5b')]['ids']['length'];_0x71c3e6+=0x1){socket[_0xf82b('0xb5')]('userFaxAccount:save',{'UserId':_0xac1ea3[_0xf82b('0x5b')]['ids'][_0x71c3e6],'FaxAccountId':_0xac1ea3['params']['id']});}return _0x5ac874;});}})[_0xf82b('0x22')](respondWithResult(_0x7bd0a6,null))[_0xf82b('0x2c')](handleError(_0x7bd0a6,null));};exports[_0xf82b('0xb6')]=function(_0x2b47c0,_0x2a8ad8,_0x55e2f4){return db[_0xf82b('0x54')]['find']({'where':{'id':_0x2b47c0['params']['id']}})['then'](handleEntityNotFound(_0x2a8ad8,null))['then'](function(_0x1c4f25){if(_0x1c4f25){return _0x1c4f25['removeAgents'](_0x2b47c0[_0xf82b('0x43')][_0xf82b('0x6b')])[_0xf82b('0x22')](function(){if(_[_0xf82b('0xb7')](_0x2b47c0['query']['ids'])){for(var _0x5bc015=0x0;_0x5bc015<_0x2b47c0['query']['ids'][_0xf82b('0x49')];_0x5bc015+=0x1){socket[_0xf82b('0xb5')]('userFaxAccount:remove',{'UserId':Number(_0x2b47c0[_0xf82b('0x43')][_0xf82b('0x6b')][_0x5bc015]),'FaxAccountId':Number(_0x2b47c0['params']['id'])});}}else{socket[_0xf82b('0xb5')](_0xf82b('0xb8'),{'UserId':Number(_0x2b47c0[_0xf82b('0x43')][_0xf82b('0x6b')]),'FaxAccountId':Number(_0x2b47c0[_0xf82b('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a8ad8,null))[_0xf82b('0x2c')](handleError(_0x2a8ad8,null));};exports[_0xf82b('0xb9')]=function(_0x3b4f5f,_0x296629,_0x1ff1f4){var _0x291b20={};var _0x4c8b87={};var _0x583ef7;var _0x1cc04a;return db[_0xf82b('0x54')]['findOne']({'where':{'id':_0x3b4f5f[_0xf82b('0x57')]['id']}})['then'](handleEntityNotFound(_0x296629,null))[_0xf82b('0x22')](function(_0x572baf){if(_0x572baf){_0x583ef7=_0x572baf;_0x4c8b87['model']=_[_0xf82b('0x58')](db['User']['rawAttributes']);_0x4c8b87[_0xf82b('0x43')]=_[_0xf82b('0x58')](_0x3b4f5f[_0xf82b('0x43')]);_0x4c8b87[_0xf82b('0x44')]=_[_0xf82b('0x47')](_0x4c8b87[_0xf82b('0x45')],_0x4c8b87['query']);_0x291b20[_0xf82b('0x46')]=_[_0xf82b('0x47')](_0x4c8b87[_0xf82b('0x45')],qs[_0xf82b('0x48')](_0x3b4f5f[_0xf82b('0x43')][_0xf82b('0x48')]));_0x291b20[_0xf82b('0x46')]=_0x291b20[_0xf82b('0x46')]['length']?_0x291b20[_0xf82b('0x46')]:_0x4c8b87[_0xf82b('0x45')];_0x291b20['order']=qs['sort'](_0x3b4f5f['query'][_0xf82b('0x4d')]);_0x291b20[_0xf82b('0x4e')]=qs[_0xf82b('0x44')](_[_0xf82b('0x4f')](_0x3b4f5f[_0xf82b('0x43')],_0x4c8b87[_0xf82b('0x44')]));if(_0x3b4f5f[_0xf82b('0x43')][_0xf82b('0x50')]){_0x291b20[_0xf82b('0x4e')]=_['merge'](_0x291b20[_0xf82b('0x4e')],{'$or':_[_0xf82b('0x40')](_0x291b20[_0xf82b('0x46')],function(_0x50844b){var _0x2f0fb1={};_0x2f0fb1[_0x50844b]={'$like':'%'+_0x3b4f5f['query'][_0xf82b('0x50')]+'%'};return _0x2f0fb1;})});}_0x291b20=_['merge']({},_0x291b20,_0x3b4f5f[_0xf82b('0x53')]);return _0x583ef7['getAgents'](_0x291b20);}})[_0xf82b('0x22')](function(_0x23292b){if(_0x23292b){_0x1cc04a=_0x23292b['length'];if(!_0x3b4f5f[_0xf82b('0x43')][_0xf82b('0x4a')](_0xf82b('0x4b'))){_0x291b20[_0xf82b('0x33')]=qs[_0xf82b('0x33')](_0x3b4f5f['query']['limit']);_0x291b20[_0xf82b('0x32')]=qs['offset'](_0x3b4f5f[_0xf82b('0x43')][_0xf82b('0x32')]);}return _0x583ef7[_0xf82b('0xb9')](_0x291b20);}})['then'](function(_0x4f9d2f){if(_0x4f9d2f){return _0x4f9d2f?{'count':_0x1cc04a,'rows':_0x4f9d2f}:null;}})[_0xf82b('0x22')](respondWithResult(_0x296629,null))[_0xf82b('0x2c')](handleError(_0x296629,null));}; \ No newline at end of file +var _0x1c20=['join','root','server/files/attachments','CheckAfterSend','isNil','from','List','CmContact','List\x20not\x20found','Send\x20Fax\x20failed','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','test','ValidationError','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','end','status','count','offset','limit','set','json','update','destroy','get','FaxAccounts','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','pick','filter','where','VIRTUAL','merge','options','FaxAccount','include','findAll','rows','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','getDispositions','findOne','hasOwnProperty','sort','Disposition','includeAll','removeDispositions','ids','addAnswer','getAnswers','rawAttributes','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','Contact','User','Owner','internal','Tags','color','tag','sequelize','transaction','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','minrate','modem','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','ReceiveFax','VoiceExtension','bulkCreate','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments'];(function(_0x5dc03e,_0x54e60c){var _0x466a07=function(_0x2ce0cd){while(--_0x2ce0cd){_0x5dc03e['push'](_0x5dc03e['shift']());}};_0x466a07(++_0x54e60c);}(_0x1c20,0xdc));var _0x01c2=function(_0x37ded3,_0x371ebb){_0x37ded3=_0x37ded3-0x0;var _0x51e49e=_0x1c20[_0x37ded3];return _0x51e49e;};'use strict';var pdf=require(_0x01c2('0x0'));var emlformat=require(_0x01c2('0x1'));var rimraf=require(_0x01c2('0x2'));var zipdir=require(_0x01c2('0x3'));var jsonpatch=require(_0x01c2('0x4'));var rp=require(_0x01c2('0x5'));var moment=require(_0x01c2('0x6'));var BPromise=require(_0x01c2('0x7'));var Mustache=require(_0x01c2('0x8'));var util=require('util');var path=require(_0x01c2('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x01c2('0xa'));var fs=require('fs');var _=require(_0x01c2('0xb'));var squel=require(_0x01c2('0xc'));var crypto=require(_0x01c2('0xd'));var jsforce=require(_0x01c2('0xe'));var deskjs=require(_0x01c2('0xf'));var toCsv=require(_0x01c2('0x10'));var querystring=require('querystring');var Papa=require(_0x01c2('0x11'));var Redis=require(_0x01c2('0x12'));var authService=require(_0x01c2('0x13'));var qs=require(_0x01c2('0x14'));var as=require(_0x01c2('0x15'));var hardwareService=require(_0x01c2('0x16'));var logger=require(_0x01c2('0x17'))(_0x01c2('0x18'));var utils=require(_0x01c2('0x19'));var config=require(_0x01c2('0x1a'));var db=require('../../mysqldb')['db'];config[_0x01c2('0x1b')]=_[_0x01c2('0x1c')](config[_0x01c2('0x1b')],{'host':_0x01c2('0x1d'),'port':0x18eb});var socket=require(_0x01c2('0x1e'))(new Redis(config[_0x01c2('0x1b')]));require(_0x01c2('0x1f'))[_0x01c2('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x01c2('0x21')][_0x01c2('0x22')]({'port':0x232c});var client9002=jayson[_0x01c2('0x21')][_0x01c2('0x22')]({'port':0x232a});function checkPasswordPattern(_0x13b151,_0x51bd74,_0x452ce5){if(_0x452ce5){var _0x1a1b67=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a1b67[_0x01c2('0x23')](_0x51bd74)){return _0x13b151;}else{throw new db['Sequelize'][(_0x01c2('0x24'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x13b151;}}function respondWithRpcPromise(_0x4ede12,_0x428656,_0x18fc67,_0x24c509){return new BPromise(function(_0x56efaf,_0x47dec8){var _0x48bf40=_0x24c509||client;return _0x48bf40[_0x01c2('0x25')](_0x4ede12,_0x18fc67)[_0x01c2('0x26')](function(_0x263897){logger[_0x01c2('0x27')](_0x01c2('0x28'),_0x428656,_0x01c2('0x29'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x428656,_0x01c2('0x29'),JSON[_0x01c2('0x2a')](_0x263897));if(_0x263897[_0x01c2('0x2b')]){if(_0x263897[_0x01c2('0x2b')]['code']===0x1f4){logger[_0x01c2('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x428656,_0x263897['error']['message']);return _0x47dec8(_0x263897[_0x01c2('0x2b')][_0x01c2('0x2c')]);}logger[_0x01c2('0x2b')](_0x01c2('0x28'),_0x428656,_0x263897[_0x01c2('0x2b')][_0x01c2('0x2c')]);return _0x56efaf(_0x263897['error'][_0x01c2('0x2c')]);}else{logger[_0x01c2('0x27')](_0x01c2('0x28'),_0x428656,'request\x20sent');_0x56efaf(_0x263897[_0x01c2('0x2d')]['message']);}})['catch'](function(_0x3fa1f0){logger[_0x01c2('0x2b')](_0x01c2('0x28'),_0x428656,_0x3fa1f0);_0x47dec8(_0x3fa1f0);});});}function respondWithStatusCode(_0x7c862c,_0x29ca4d){_0x29ca4d=_0x29ca4d||0xcc;return function(_0x49965c){if(_0x49965c){return _0x7c862c['sendStatus'](_0x29ca4d);}return _0x7c862c['status'](_0x29ca4d)[_0x01c2('0x2e')]();};}function respondWithResult(_0x326a25,_0x17ae84){_0x17ae84=_0x17ae84||0xc8;return function(_0x2376a5){if(_0x2376a5){return _0x326a25[_0x01c2('0x2f')](_0x17ae84)['json'](_0x2376a5);}};}function respondWithFilteredResult(_0x5877d0,_0x439c54){return function(_0x4a623a){if(_0x4a623a){var _0xe95ff7=_0x4a623a[_0x01c2('0x30')],_0x151e21=_0x439c54[_0x01c2('0x31')],_0x1de1fa=_0x439c54[_0x01c2('0x31')]+_0x439c54[_0x01c2('0x32')],_0x588c9b;if(_0x1de1fa>=_0xe95ff7){_0x1de1fa=_0xe95ff7;_0x588c9b=0xc8;}else{_0x588c9b=0xce;}_0x5877d0['status'](_0x588c9b);return _0x5877d0[_0x01c2('0x33')]('Content-Range',_0x151e21+'-'+_0x1de1fa+'/'+_0xe95ff7)[_0x01c2('0x34')](_0x4a623a);}return null;};}function patchUpdates(_0x57628d){return function(_0x212c0e){try{jsonpatch['apply'](_0x212c0e,_0x57628d,!![]);}catch(_0x5aa443){return BPromise['reject'](_0x5aa443);}return _0x212c0e['save']();};}function saveUpdates(_0x224dd3,_0xe89836){return function(_0x3ea038){if(_0x3ea038){return _0x3ea038[_0x01c2('0x35')](_0x224dd3)[_0x01c2('0x26')](function(_0xe0e3d5){return _0xe0e3d5;});}return null;};}function removeEntity(_0x57e3bb,_0x55b7a6){return function(_0x56be3e){if(_0x56be3e){return _0x56be3e[_0x01c2('0x36')]()[_0x01c2('0x26')](function(){var _0x4359d6=_0x56be3e[_0x01c2('0x37')]({'plain':!![]});var _0x27d72d=_0x01c2('0x38');return db['UserProfileResource'][_0x01c2('0x36')]({'where':{'type':_0x27d72d,'resourceId':_0x4359d6['id']}})[_0x01c2('0x26')](function(){return _0x56be3e;});})['then'](function(){_0x57e3bb['status'](0xcc)[_0x01c2('0x2e')]();});}};}function handleEntityNotFound(_0x381232,_0x4541c6){return function(_0x4c1eeb){if(!_0x4c1eeb){_0x381232[_0x01c2('0x39')](0x194);}return _0x4c1eeb;};}function handleError(_0x1a24c8,_0x96e077){_0x96e077=_0x96e077||0x1f4;return function(_0x3f1e4e){logger[_0x01c2('0x2b')](_0x3f1e4e[_0x01c2('0x3a')]);if(_0x3f1e4e[_0x01c2('0x3b')]){delete _0x3f1e4e[_0x01c2('0x3b')];}_0x1a24c8[_0x01c2('0x2f')](_0x96e077)[_0x01c2('0x3c')](_0x3f1e4e);};}exports[_0x01c2('0x3d')]=function(_0x3edd86,_0x390c5f){var _0x3993d0={'include':[{'model':db[_0x01c2('0x3e')],'as':_0x01c2('0x3f')}]},_0x3514e6={},_0x4563b1={'count':0x0,'rows':[]};var _0x5cd246=_[_0x01c2('0x40')](db['FaxAccount']['rawAttributes'],function(_0x1aadf2){return{'name':_0x1aadf2['fieldName'],'type':_0x1aadf2[_0x01c2('0x41')][_0x01c2('0x42')]};});_0x3514e6[_0x01c2('0x43')]=_[_0x01c2('0x40')](_0x5cd246,'name');_0x3514e6['query']=_[_0x01c2('0x44')](_0x3edd86[_0x01c2('0x45')]);_0x3514e6[_0x01c2('0x46')]=_['intersection'](_0x3514e6[_0x01c2('0x43')],_0x3514e6[_0x01c2('0x45')]);_0x3993d0[_0x01c2('0x47')]=_[_0x01c2('0x48')](_0x3514e6[_0x01c2('0x43')],qs[_0x01c2('0x49')](_0x3edd86['query']['fields']));_0x3993d0[_0x01c2('0x47')]=_0x3993d0['attributes'][_0x01c2('0x4a')]?_0x3993d0[_0x01c2('0x47')]:_0x3514e6[_0x01c2('0x43')];if(!_0x3edd86['query']['hasOwnProperty'](_0x01c2('0x4b'))){_0x3993d0[_0x01c2('0x32')]=qs['limit'](_0x3edd86['query']['limit']);_0x3993d0[_0x01c2('0x31')]=qs['offset'](_0x3edd86[_0x01c2('0x45')][_0x01c2('0x31')]);}_0x3993d0[_0x01c2('0x4c')]=qs['sort'](_0x3edd86[_0x01c2('0x45')]['sort']);_0x3993d0['where']=qs['filters'](_[_0x01c2('0x4d')](_0x3edd86[_0x01c2('0x45')],_0x3514e6[_0x01c2('0x46')]),_0x5cd246);if(_0x3edd86[_0x01c2('0x45')][_0x01c2('0x4e')]){_0x3993d0[_0x01c2('0x4f')]=_['merge'](_0x3993d0[_0x01c2('0x4f')],{'$or':_[_0x01c2('0x40')](_0x5cd246,function(_0x568bd1){if(_0x568bd1['type']!==_0x01c2('0x50')){var _0x17ec69={};_0x17ec69[_0x568bd1[_0x01c2('0x3b')]]={'$like':'%'+_0x3edd86[_0x01c2('0x45')][_0x01c2('0x4e')]+'%'};return _0x17ec69;}})});}_0x3993d0=_[_0x01c2('0x51')]({},_0x3993d0,_0x3edd86[_0x01c2('0x52')]);var _0x1531ab={'where':_0x3993d0[_0x01c2('0x4f')]};return db[_0x01c2('0x53')][_0x01c2('0x30')](_0x1531ab)[_0x01c2('0x26')](function(_0x1b84e7){_0x4563b1[_0x01c2('0x30')]=_0x1b84e7;if(_0x3edd86[_0x01c2('0x45')]['includeAll']){_0x3993d0[_0x01c2('0x54')]=[{'all':!![]}];}return db['FaxAccount'][_0x01c2('0x55')](_0x3993d0);})[_0x01c2('0x26')](function(_0x11a791){_0x4563b1[_0x01c2('0x56')]=_0x11a791;return _0x4563b1;})['then'](respondWithFilteredResult(_0x390c5f,_0x3993d0))['catch'](handleError(_0x390c5f,null));};exports[_0x01c2('0x57')]=function(_0x5a4854,_0x34ca5d){var _0x40032f={'raw':![],'where':{'id':_0x5a4854[_0x01c2('0x58')]['id']},'include':[{'model':db[_0x01c2('0x3e')],'as':_0x01c2('0x3f')}]},_0x3919f3={};_0x3919f3[_0x01c2('0x43')]=_[_0x01c2('0x44')](db[_0x01c2('0x53')]['rawAttributes']);_0x3919f3['query']=_[_0x01c2('0x44')](_0x5a4854[_0x01c2('0x45')]);_0x3919f3['filters']=_[_0x01c2('0x48')](_0x3919f3[_0x01c2('0x43')],_0x3919f3[_0x01c2('0x45')]);_0x40032f['attributes']=_[_0x01c2('0x48')](_0x3919f3[_0x01c2('0x43')],qs[_0x01c2('0x49')](_0x5a4854[_0x01c2('0x45')][_0x01c2('0x49')]));_0x40032f[_0x01c2('0x47')]=_0x40032f[_0x01c2('0x47')][_0x01c2('0x4a')]?_0x40032f[_0x01c2('0x47')]:_0x3919f3[_0x01c2('0x43')];if(_0x5a4854[_0x01c2('0x45')]['includeAll']){_0x40032f[_0x01c2('0x54')]=[{'all':!![]}];}_0x40032f=_['merge']({},_0x40032f,_0x5a4854[_0x01c2('0x52')]);return db[_0x01c2('0x53')][_0x01c2('0x59')](_0x40032f)[_0x01c2('0x26')](handleEntityNotFound(_0x34ca5d,null))['then'](respondWithResult(_0x34ca5d,null))[_0x01c2('0x5a')](handleError(_0x34ca5d,null));};exports[_0x01c2('0x5b')]=function(_0x1a7b31,_0x4837e9){return db[_0x01c2('0x53')][_0x01c2('0x5b')](_0x1a7b31['body'],{})[_0x01c2('0x26')](function(_0x2599c7){var _0x818df9=_0x1a7b31[_0x01c2('0x5c')][_0x01c2('0x37')]({'plain':!![]});if(!_0x818df9)throw new Error(_0x01c2('0x5d'));if(_0x818df9[_0x01c2('0x5e')]==='user'){var _0x2a65a7=_0x2599c7[_0x01c2('0x37')]({'plain':!![]});var _0x5b5d1f='FaxAccounts';return db[_0x01c2('0x5f')][_0x01c2('0x59')]({'where':{'name':_0x5b5d1f,'userProfileId':_0x818df9[_0x01c2('0x60')]},'raw':!![]})['then'](function(_0x2f99cc){if(_0x2f99cc&&_0x2f99cc[_0x01c2('0x61')]===0x0){return db[_0x01c2('0x62')][_0x01c2('0x5b')]({'name':_0x2a65a7['name'],'resourceId':_0x2a65a7['id'],'type':_0x2f99cc[_0x01c2('0x3b')],'sectionId':_0x2f99cc['id']},{})[_0x01c2('0x26')](function(){return _0x2599c7;});}else{return _0x2599c7;}})[_0x01c2('0x5a')](function(_0x1481c2){logger[_0x01c2('0x2b')](_0x01c2('0x63'),_0x1481c2);throw _0x1481c2;});}return _0x2599c7;})[_0x01c2('0x26')](respondWithResult(_0x4837e9,0xc9))[_0x01c2('0x5a')](handleError(_0x4837e9,null));};exports[_0x01c2('0x35')]=function(_0x2cd3fe,_0x1c809c){if(_0x2cd3fe[_0x01c2('0x64')]['id']){delete _0x2cd3fe[_0x01c2('0x64')]['id'];}return db[_0x01c2('0x53')][_0x01c2('0x59')]({'where':{'id':_0x2cd3fe[_0x01c2('0x58')]['id']},'include':[{'model':db[_0x01c2('0x3e')],'as':_0x01c2('0x3f')}]})[_0x01c2('0x26')](handleEntityNotFound(_0x1c809c,null))['then'](saveUpdates(_0x2cd3fe['body'],null))['then'](respondWithResult(_0x1c809c,null))[_0x01c2('0x5a')](handleError(_0x1c809c,null));};exports[_0x01c2('0x36')]=function(_0x471135,_0x929dd){return db[_0x01c2('0x53')][_0x01c2('0x59')]({'where':{'id':_0x471135['params']['id']}})[_0x01c2('0x26')](handleEntityNotFound(_0x929dd,null))[_0x01c2('0x26')](removeEntity(_0x929dd,null))[_0x01c2('0x5a')](handleError(_0x929dd,null));};exports[_0x01c2('0x65')]=function(_0x380e6d,_0xe19238){return db[_0x01c2('0x53')][_0x01c2('0x65')]()[_0x01c2('0x26')](respondWithResult(_0xe19238,null))[_0x01c2('0x5a')](handleError(_0xe19238,null));};exports[_0x01c2('0x66')]=function(_0xe9543,_0xa5a341,_0x4534f5){if(_0xe9543[_0x01c2('0x64')]['id']){delete _0xe9543['body']['id'];}return db['FaxAccount'][_0x01c2('0x59')]({'where':{'id':_0xe9543['params']['id']}})[_0x01c2('0x26')](handleEntityNotFound(_0xa5a341,null))[_0x01c2('0x26')](function(_0x585480){if(_0x585480){_0xe9543[_0x01c2('0x64')][_0x01c2('0x67')]=_0x585480['id'];return db['Disposition'][_0x01c2('0x5b')](_0xe9543[_0x01c2('0x64')]);}})[_0x01c2('0x26')](respondWithResult(_0xa5a341,null))[_0x01c2('0x5a')](handleError(_0xa5a341,null));};exports[_0x01c2('0x68')]=function(_0x2ca081,_0x2ad226,_0x396e9c){var _0x5cf50={'raw':![],'where':{}};var _0x436868={};var _0x23416f={'count':0x0,'rows':[]};return db[_0x01c2('0x53')][_0x01c2('0x69')]({'where':{'id':_0x2ca081[_0x01c2('0x58')]['id']}})[_0x01c2('0x26')](handleEntityNotFound(_0x2ad226,null))[_0x01c2('0x26')](function(_0x2e23bf){if(_0x2e23bf){_0x436868[_0x01c2('0x43')]=_[_0x01c2('0x44')](db['Disposition']['rawAttributes']);_0x436868[_0x01c2('0x45')]=_[_0x01c2('0x44')](_0x2ca081['query']);_0x436868[_0x01c2('0x46')]=_[_0x01c2('0x48')](_0x436868[_0x01c2('0x43')],_0x436868[_0x01c2('0x45')]);_0x5cf50['attributes']=_['intersection'](_0x436868[_0x01c2('0x43')],qs[_0x01c2('0x49')](_0x2ca081[_0x01c2('0x45')][_0x01c2('0x49')]));_0x5cf50[_0x01c2('0x47')]=_0x5cf50[_0x01c2('0x47')][_0x01c2('0x4a')]?_0x5cf50[_0x01c2('0x47')]:_0x436868['model'];if(!_0x2ca081[_0x01c2('0x45')][_0x01c2('0x6a')](_0x01c2('0x4b'))){_0x5cf50[_0x01c2('0x32')]=qs[_0x01c2('0x32')](_0x2ca081[_0x01c2('0x45')][_0x01c2('0x32')]);_0x5cf50[_0x01c2('0x31')]=qs[_0x01c2('0x31')](_0x2ca081[_0x01c2('0x45')][_0x01c2('0x31')]);}_0x5cf50[_0x01c2('0x4c')]=qs[_0x01c2('0x6b')](_0x2ca081[_0x01c2('0x45')][_0x01c2('0x6b')]);_0x5cf50[_0x01c2('0x4f')]=qs[_0x01c2('0x46')](_['pick'](_0x2ca081[_0x01c2('0x45')],_0x436868['filters']));_0x5cf50[_0x01c2('0x4f')][_0x01c2('0x67')]=_0x2e23bf['id'];if(_0x2ca081[_0x01c2('0x45')]['filter']){_0x5cf50[_0x01c2('0x4f')]=_[_0x01c2('0x51')](_0x5cf50[_0x01c2('0x4f')],{'$or':_[_0x01c2('0x40')](_0x5cf50[_0x01c2('0x47')],function(_0x33f361){var _0x22dc86={};_0x22dc86[_0x33f361]={'$like':'%'+_0x2ca081[_0x01c2('0x45')][_0x01c2('0x4e')]+'%'};return _0x22dc86;})});}_0x5cf50=_[_0x01c2('0x51')]({},_0x5cf50,_0x2ca081[_0x01c2('0x52')]);return db[_0x01c2('0x6c')][_0x01c2('0x30')]({'where':_0x5cf50['where']})['then'](function(_0x48c360){_0x23416f['count']=_0x48c360;if(_0x2ca081[_0x01c2('0x45')][_0x01c2('0x6d')]){_0x5cf50[_0x01c2('0x54')]=[{'all':!![]}];}return db[_0x01c2('0x6c')]['findAll'](_0x5cf50);})[_0x01c2('0x26')](function(_0x2a9fad){_0x23416f[_0x01c2('0x56')]=_0x2a9fad;return _0x23416f;});}})[_0x01c2('0x26')](respondWithFilteredResult(_0x2ad226,_0x5cf50))[_0x01c2('0x5a')](handleError(_0x2ad226,null));};exports[_0x01c2('0x6e')]=function(_0x19f96b,_0x1900e7,_0x2cdaa2){return db['FaxAccount'][_0x01c2('0x59')]({'where':{'id':_0x19f96b[_0x01c2('0x58')]['id']}})[_0x01c2('0x26')](handleEntityNotFound(_0x1900e7,null))[_0x01c2('0x26')](function(_0x3796fa){if(_0x3796fa){return _0x3796fa['removeDispositions'](_0x19f96b['query'][_0x01c2('0x6f')]);}})[_0x01c2('0x26')](respondWithStatusCode(_0x1900e7,null))[_0x01c2('0x5a')](handleError(_0x1900e7,null));};exports[_0x01c2('0x70')]=function(_0x505329,_0x47c1c8,_0x170575){if(_0x505329[_0x01c2('0x64')]['id']){delete _0x505329[_0x01c2('0x64')]['id'];}return db[_0x01c2('0x53')][_0x01c2('0x59')]({'where':{'id':_0x505329['params']['id']}})[_0x01c2('0x26')](handleEntityNotFound(_0x47c1c8,null))[_0x01c2('0x26')](function(_0x513840){if(_0x513840){_0x505329[_0x01c2('0x64')][_0x01c2('0x67')]=_0x513840['id'];return db['CannedAnswer']['create'](_0x505329['body']);}})[_0x01c2('0x26')](respondWithResult(_0x47c1c8,null))[_0x01c2('0x5a')](handleError(_0x47c1c8,null));};exports[_0x01c2('0x71')]=function(_0x13f200,_0x327fd2,_0x27ffd4){var _0x670851={'raw':![],'where':{}};var _0x438d5a={};var _0x2bca70={'count':0x0,'rows':[]};return db[_0x01c2('0x53')][_0x01c2('0x69')]({'where':{'id':_0x13f200[_0x01c2('0x58')]['id']}})[_0x01c2('0x26')](handleEntityNotFound(_0x327fd2,null))[_0x01c2('0x26')](function(_0x4e3d14){if(_0x4e3d14){_0x438d5a[_0x01c2('0x43')]=_[_0x01c2('0x44')](db['CannedAnswer'][_0x01c2('0x72')]);_0x438d5a['query']=_[_0x01c2('0x44')](_0x13f200[_0x01c2('0x45')]);_0x438d5a['filters']=_[_0x01c2('0x48')](_0x438d5a[_0x01c2('0x43')],_0x438d5a[_0x01c2('0x45')]);_0x670851[_0x01c2('0x47')]=_[_0x01c2('0x48')](_0x438d5a[_0x01c2('0x43')],qs[_0x01c2('0x49')](_0x13f200[_0x01c2('0x45')][_0x01c2('0x49')]));_0x670851[_0x01c2('0x47')]=_0x670851[_0x01c2('0x47')][_0x01c2('0x4a')]?_0x670851[_0x01c2('0x47')]:_0x438d5a['model'];if(!_0x13f200[_0x01c2('0x45')]['hasOwnProperty'](_0x01c2('0x4b'))){_0x670851[_0x01c2('0x32')]=qs[_0x01c2('0x32')](_0x13f200[_0x01c2('0x45')][_0x01c2('0x32')]);_0x670851[_0x01c2('0x31')]=qs[_0x01c2('0x31')](_0x13f200[_0x01c2('0x45')][_0x01c2('0x31')]);}_0x670851['order']=qs[_0x01c2('0x6b')](_0x13f200[_0x01c2('0x45')][_0x01c2('0x6b')]);_0x670851[_0x01c2('0x4f')]=qs[_0x01c2('0x46')](_['pick'](_0x13f200[_0x01c2('0x45')],_0x438d5a['filters']));_0x670851[_0x01c2('0x4f')][_0x01c2('0x67')]=_0x4e3d14['id'];if(_0x13f200[_0x01c2('0x45')]['filter']){_0x670851[_0x01c2('0x4f')]=_['merge'](_0x670851[_0x01c2('0x4f')],{'$or':_[_0x01c2('0x40')](_0x670851[_0x01c2('0x47')],function(_0x38febe){var _0x500d38={};_0x500d38[_0x38febe]={'$like':'%'+_0x13f200[_0x01c2('0x45')][_0x01c2('0x4e')]+'%'};return _0x500d38;})});}_0x670851=_[_0x01c2('0x51')]({},_0x670851,_0x13f200[_0x01c2('0x52')]);return db[_0x01c2('0x73')][_0x01c2('0x30')]({'where':_0x670851[_0x01c2('0x4f')]})['then'](function(_0x4390d0){_0x2bca70[_0x01c2('0x30')]=_0x4390d0;if(_0x13f200[_0x01c2('0x45')][_0x01c2('0x6d')]){_0x670851['include']=[{'all':!![]}];}return db[_0x01c2('0x73')][_0x01c2('0x55')](_0x670851);})[_0x01c2('0x26')](function(_0x5459a6){_0x2bca70[_0x01c2('0x56')]=_0x5459a6;return _0x2bca70;});}})[_0x01c2('0x26')](respondWithFilteredResult(_0x327fd2,_0x670851))[_0x01c2('0x5a')](handleError(_0x327fd2,null));};exports[_0x01c2('0x74')]=function(_0xe6501f,_0x3dd1ba,_0x3487a3){return db[_0x01c2('0x53')][_0x01c2('0x59')]({'where':{'id':_0xe6501f[_0x01c2('0x58')]['id']}})['then'](handleEntityNotFound(_0x3dd1ba,null))[_0x01c2('0x26')](function(_0x364ed6){if(_0x364ed6){return _0x364ed6['removeAnswers'](_0xe6501f['query'][_0x01c2('0x6f')]);}})[_0x01c2('0x26')](respondWithStatusCode(_0x3dd1ba,null))['catch'](handleError(_0x3dd1ba,null));};exports[_0x01c2('0x75')]=function(_0x13c210,_0xa867d9,_0x2a4986){return db[_0x01c2('0x76')][_0x01c2('0x59')]({'where':{'id':_0x13c210[_0x01c2('0x58')]['id']}})['then'](handleEntityNotFound(_0xa867d9,null))['then'](function(_0x53f225){if(_0x53f225){return _0x53f225[_0x01c2('0x75')](_0x13c210[_0x01c2('0x64')][_0x01c2('0x6f')],_[_0x01c2('0x77')](_0x13c210[_0x01c2('0x64')],[_0x01c2('0x6f'),'id'])||{});}})['then'](respondWithResult(_0xa867d9,null))['catch'](handleError(_0xa867d9,null));};exports['getInteractions']=function(_0x4a7932,_0x12f5ea,_0x3aaf6a){var _0x210388={'raw':![],'where':{}};var _0x2b68a9={};var _0x5becc4={'count':0x0,'rows':[]};return db[_0x01c2('0x53')][_0x01c2('0x69')]({'where':{'id':_0x4a7932[_0x01c2('0x58')]['id']}})[_0x01c2('0x26')](handleEntityNotFound(_0x12f5ea,null))[_0x01c2('0x26')](function(_0x2054bb){if(_0x2054bb){_0x2b68a9[_0x01c2('0x43')]=_[_0x01c2('0x44')](db['FaxInteraction'][_0x01c2('0x72')]);_0x2b68a9[_0x01c2('0x45')]=_['keys'](_0x4a7932[_0x01c2('0x45')]);_0x2b68a9[_0x01c2('0x46')]=_[_0x01c2('0x48')](_0x2b68a9[_0x01c2('0x43')],_0x2b68a9[_0x01c2('0x45')]);_0x210388[_0x01c2('0x47')]=_[_0x01c2('0x48')](_0x2b68a9['model'],qs['fields'](_0x4a7932[_0x01c2('0x45')][_0x01c2('0x49')]));_0x210388['attributes']=_0x210388['attributes']['length']?_0x210388[_0x01c2('0x47')]:_0x2b68a9[_0x01c2('0x43')];if(!_0x4a7932[_0x01c2('0x45')]['hasOwnProperty'](_0x01c2('0x4b'))){_0x210388['limit']=qs[_0x01c2('0x32')](_0x4a7932[_0x01c2('0x45')][_0x01c2('0x32')]);_0x210388[_0x01c2('0x31')]=qs[_0x01c2('0x31')](_0x4a7932[_0x01c2('0x45')][_0x01c2('0x31')]);}_0x210388[_0x01c2('0x4c')]=qs[_0x01c2('0x6b')](_0x4a7932['query']['sort']);_0x210388['where']=qs[_0x01c2('0x46')](_[_0x01c2('0x4d')](_0x4a7932[_0x01c2('0x45')],_0x2b68a9[_0x01c2('0x46')]));_0x210388[_0x01c2('0x4f')][_0x01c2('0x67')]=_0x2054bb['id'];if(_0x4a7932[_0x01c2('0x45')][_0x01c2('0x4e')]){_0x210388[_0x01c2('0x4f')]=_[_0x01c2('0x51')](_0x210388[_0x01c2('0x4f')],{'$or':_[_0x01c2('0x40')](_0x210388[_0x01c2('0x47')],function(_0x3fdb4c){var _0x19ffdc={};_0x19ffdc[_0x3fdb4c]={'$like':'%'+_0x4a7932[_0x01c2('0x45')][_0x01c2('0x4e')]+'%'};return _0x19ffdc;})});}_0x210388=_['merge']({},_0x210388,_0x4a7932[_0x01c2('0x52')]);return db[_0x01c2('0x76')][_0x01c2('0x30')]({'where':_0x210388[_0x01c2('0x4f')]})['then'](function(_0xcbae9d){_0x5becc4[_0x01c2('0x30')]=_0xcbae9d;if(_0x4a7932[_0x01c2('0x45')][_0x01c2('0x6d')]){_0x210388[_0x01c2('0x54')]=[{'model':db['CmContact'],'as':_0x01c2('0x78'),'required':![]},{'model':db[_0x01c2('0x79')],'as':_0x01c2('0x7a'),'attributes':[_0x01c2('0x3b'),'fullname',_0x01c2('0x7b')],'required':![]},{'model':db['Tag'],'as':_0x01c2('0x7c'),'attributes':['id',_0x01c2('0x3b'),_0x01c2('0x7d')],'where':_0x4a7932['query'][_0x01c2('0x7e')]?{'id':_0x4a7932[_0x01c2('0x45')][_0x01c2('0x7e')]}:undefined,'required':_0x4a7932['query'][_0x01c2('0x7e')]?!![]:![]}];}return db[_0x01c2('0x76')]['findAll'](_0x210388);})['then'](function(_0x25b36e){_0x5becc4['rows']=_0x25b36e;return _0x5becc4;});}})[_0x01c2('0x26')](respondWithFilteredResult(_0x12f5ea,_0x210388))['catch'](handleError(_0x12f5ea,null));};exports['addApplications']=function(_0x132ad7,_0x2d5a97,_0x481b6c){return db[_0x01c2('0x53')][_0x01c2('0x69')]({'where':{'id':_0x132ad7[_0x01c2('0x58')]['id']}})['then'](handleEntityNotFound(_0x2d5a97,null))['then'](function(_0x3b9201){if(_0x3b9201){return db[_0x01c2('0x7f')][_0x01c2('0x80')](function(_0x538237){return db[_0x01c2('0x81')][_0x01c2('0x36')]({'where':{'FaxAccountId':_0x132ad7[_0x01c2('0x58')]['id']},'transaction':_0x538237})[_0x01c2('0x26')](function(_0x1e3f4e){var _0x2d6865=_[_0x01c2('0x40')](_0x132ad7[_0x01c2('0x64')],function(_0x2368f0){_0x2368f0['FaxAccountId']=_0x132ad7['params']['id'];return _0x2368f0;});return db[_0x01c2('0x81')]['bulkCreate'](_0x2d6865,{'transaction':_0x538237});});})[_0x01c2('0x26')](function(){return db[_0x01c2('0x81')][_0x01c2('0x82')]({'where':{'FaxAccountId':_0x132ad7['params']['id']},'order':_0x01c2('0x83')});});}})['then'](respondWithResult(_0x2d5a97,null))[_0x01c2('0x5a')](handleError(_0x2d5a97,null));};exports[_0x01c2('0x84')]=function(_0xe9f7bb,_0x3ca7e5,_0x25409c){var _0x5dbc9c={};var _0x1d2552={};var _0x4d1011;var _0x2969ef;return db['FaxAccount']['findOne']({'where':{'id':_0xe9f7bb[_0x01c2('0x58')]['id']}})['then'](handleEntityNotFound(_0x3ca7e5,null))[_0x01c2('0x26')](function(_0x268881){if(_0x268881){_0x4d1011=_0x268881;_0x1d2552['model']=_['keys'](db[_0x01c2('0x81')][_0x01c2('0x72')]);_0x1d2552['query']=_[_0x01c2('0x44')](_0xe9f7bb[_0x01c2('0x45')]);_0x1d2552['filters']=_[_0x01c2('0x48')](_0x1d2552[_0x01c2('0x43')],_0x1d2552[_0x01c2('0x45')]);_0x5dbc9c[_0x01c2('0x47')]=_[_0x01c2('0x48')](_0x1d2552[_0x01c2('0x43')],qs[_0x01c2('0x49')](_0xe9f7bb['query'][_0x01c2('0x49')]));_0x5dbc9c['attributes']=_0x5dbc9c[_0x01c2('0x47')][_0x01c2('0x4a')]?_0x5dbc9c[_0x01c2('0x47')]:_0x1d2552[_0x01c2('0x43')];_0x5dbc9c[_0x01c2('0x4c')]=qs['sort'](_0xe9f7bb['query'][_0x01c2('0x6b')]);_0x5dbc9c[_0x01c2('0x4f')]=qs[_0x01c2('0x46')](_[_0x01c2('0x4d')](_0xe9f7bb['query'],_0x1d2552['filters']));if(_0xe9f7bb[_0x01c2('0x45')]['filter']){_0x5dbc9c[_0x01c2('0x4f')]=_[_0x01c2('0x51')](_0x5dbc9c[_0x01c2('0x4f')],{'$or':_[_0x01c2('0x40')](_0x5dbc9c[_0x01c2('0x47')],function(_0x2ac6c4){var _0x1b8540={};_0x1b8540[_0x2ac6c4]={'$like':'%'+_0xe9f7bb[_0x01c2('0x45')]['filter']+'%'};return _0x1b8540;})});}_0x5dbc9c=_['merge']({},_0x5dbc9c,_0xe9f7bb['options']);return _0x4d1011[_0x01c2('0x84')](_0x5dbc9c);}})[_0x01c2('0x26')](function(_0x184112){if(_0x184112){_0x2969ef=_0x184112[_0x01c2('0x4a')];if(!_0xe9f7bb[_0x01c2('0x45')][_0x01c2('0x6a')](_0x01c2('0x4b'))){_0x5dbc9c[_0x01c2('0x32')]=qs['limit'](_0xe9f7bb[_0x01c2('0x45')][_0x01c2('0x32')]);_0x5dbc9c['offset']=qs[_0x01c2('0x31')](_0xe9f7bb[_0x01c2('0x45')][_0x01c2('0x31')]);}return _0x4d1011[_0x01c2('0x84')](_0x5dbc9c);}})['then'](function(_0x351fb4){if(_0x351fb4){return _0x351fb4?{'count':_0x2969ef,'rows':_0x351fb4}:null;}})[_0x01c2('0x26')](respondWithResult(_0x3ca7e5,null))[_0x01c2('0x5a')](handleError(_0x3ca7e5,null));};function Extension(_0x2f36e0,_0x1e9a7f,_0x19ab08,_0xd7723d){this[_0x01c2('0x85')]=_0x01c2('0x86');this[_0x01c2('0x87')]=_0x2f36e0[_0x01c2('0x88')];this['app']=_0xd7723d;this[_0x01c2('0x41')]=_0x01c2('0x89');this[_0x01c2('0x8a')]=_0x01c2('0x8b');this[_0x01c2('0x67')]=_0x2f36e0['id'];this['priority']=_0x1e9a7f;this[_0x01c2('0x8c')]=_0x19ab08;}function createExtensionsReciveFax(_0x4d06fe){var _0x234a50=0x1;var _0xaa71f5=[];_0xaa71f5[_0x01c2('0x8d')](new Extension(_0x4d06fe,_0x234a50,'',_0x01c2('0x8e')));_0x234a50+=0x1;_0xaa71f5[_0x01c2('0x8d')](new Extension(_0x4d06fe,_0x234a50,_0x01c2('0x8f'),_0x01c2('0x90')));_0x234a50+=0x1;for(var _0x15d27a in _0x4d06fe){if(_0x4d06fe[_0x01c2('0x6a')](_0x15d27a)&&(_0x15d27a===_0x01c2('0x91')||_0x15d27a===_0x01c2('0x88')||_0x15d27a===_0x01c2('0x92')||_0x15d27a==='faxdetect'||_0x15d27a===_0x01c2('0x93')||_0x15d27a==='maxrate'||_0x15d27a===_0x01c2('0x94')||_0x15d27a===_0x01c2('0x95')||_0x15d27a==='t38timeout')){_0xaa71f5[_0x01c2('0x8d')](new Extension(_0x4d06fe,_0x234a50,_0x01c2('0x96')+_0x15d27a+')='+_0x4d06fe[_0x15d27a],_0x01c2('0x90')));_0x234a50+=0x1;}}_0xaa71f5[_0x01c2('0x8d')](new Extension(_0x4d06fe,_0x234a50,'6','Wait'));_0x234a50+=0x1;_0xaa71f5[_0x01c2('0x8d')](new Extension(_0x4d06fe,_0x234a50,_0x01c2('0x97'),_0x01c2('0x98')));_0x234a50=0x0;return _0xaa71f5;}exports['addAccountApplications']=function(_0x3d1fca,_0x2a7701,_0x141857){var _0x55bc3d;return db[_0x01c2('0x7f')][_0x01c2('0x80')](function(_0x58e223){return db[_0x01c2('0x53')][_0x01c2('0x5b')](_0x3d1fca[_0x01c2('0x64')],{'transaction':_0x58e223})[_0x01c2('0x26')](function(_0x243192){_0x55bc3d=_0x243192[_0x01c2('0x37')]({'plain':!![]});return db[_0x01c2('0x99')][_0x01c2('0x9a')](createExtensionsReciveFax(_0x55bc3d),{'transaction':_0x58e223});});})[_0x01c2('0x26')](function(){return _0x55bc3d;})['then'](respondWithResult(_0x2a7701,null))[_0x01c2('0x5a')](handleError(_0x2a7701,null));};exports[_0x01c2('0x9b')]=function(_0xfc89f,_0x1f3c13,_0x393328){var _0x527680;return db[_0x01c2('0x7f')][_0x01c2('0x80')](function(_0x2ffe05){return db[_0x01c2('0x53')][_0x01c2('0x35')](_0xfc89f['body'],{'where':{'id':_0xfc89f[_0x01c2('0x64')]['id']},'transaction':_0x2ffe05})[_0x01c2('0x26')](function(_0xbfd0ed){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0xfc89f[_0x01c2('0x64')]['id']},'transaction':_0x2ffe05})[_0x01c2('0x26')](function(_0x175dc1){return db[_0x01c2('0x99')][_0x01c2('0x9a')](createExtensionsReciveFax(_[_0x01c2('0x77')](_0xfc89f[_0x01c2('0x64')],[_0x01c2('0x9c'),_0x01c2('0x42'),_0x01c2('0x9d'),_0x01c2('0x9e'),_0x01c2('0x9f'),_0x01c2('0xa0')])),{'transaction':_0x2ffe05});});});})['then'](function(){return db['FaxAccount'][_0x01c2('0xa1')](_0xfc89f['body']['id']);})[_0x01c2('0x26')](respondWithResult(_0x1f3c13,null))[_0x01c2('0x5a')](handleError(_0x1f3c13,null));};exports[_0x01c2('0xa2')]=function(_0x166844,_0x57e807,_0x3351f6){var _0x24dfe7={'raw':!![],'where':{}};var _0x60a6dc={};var _0x11b334={'count':0x0,'rows':[]};return db[_0x01c2('0x53')]['findOne']({'where':{'id':_0x166844[_0x01c2('0x58')]['id']}})[_0x01c2('0x26')](handleEntityNotFound(_0x57e807,null))[_0x01c2('0x26')](function(_0x4bb633){if(_0x4bb633){_0x60a6dc['model']=_[_0x01c2('0x44')](db[_0x01c2('0xa3')]['rawAttributes']);_0x60a6dc[_0x01c2('0x45')]=_[_0x01c2('0x44')](_0x166844[_0x01c2('0x45')]);_0x60a6dc[_0x01c2('0x46')]=_[_0x01c2('0x48')](_0x60a6dc[_0x01c2('0x43')],_0x60a6dc[_0x01c2('0x45')]);_0x24dfe7['attributes']=_[_0x01c2('0x48')](_0x60a6dc[_0x01c2('0x43')],qs[_0x01c2('0x49')](_0x166844[_0x01c2('0x45')][_0x01c2('0x49')]));_0x24dfe7[_0x01c2('0x47')]=_0x24dfe7[_0x01c2('0x47')][_0x01c2('0x4a')]?_0x24dfe7[_0x01c2('0x47')]:_0x60a6dc[_0x01c2('0x43')];if(!_0x166844[_0x01c2('0x45')][_0x01c2('0x6a')]('nolimit')){_0x24dfe7[_0x01c2('0x32')]=qs[_0x01c2('0x32')](_0x166844[_0x01c2('0x45')]['limit']);_0x24dfe7['offset']=qs[_0x01c2('0x31')](_0x166844[_0x01c2('0x45')][_0x01c2('0x31')]);}_0x24dfe7[_0x01c2('0x4c')]=qs[_0x01c2('0x6b')](_0x166844[_0x01c2('0x45')][_0x01c2('0x6b')]);_0x24dfe7[_0x01c2('0x4f')]=qs[_0x01c2('0x46')](_[_0x01c2('0x4d')](_0x166844[_0x01c2('0x45')],_0x60a6dc[_0x01c2('0x46')]));_0x24dfe7['where'][_0x01c2('0x67')]=_0x4bb633['id'];if(_0x166844[_0x01c2('0x45')][_0x01c2('0x4e')]){_0x24dfe7[_0x01c2('0x4f')]=_['merge'](_0x24dfe7[_0x01c2('0x4f')],{'$or':_[_0x01c2('0x40')](_0x24dfe7[_0x01c2('0x47')],function(_0x407980){var _0x20adf4={};_0x20adf4[_0x407980]={'$like':'%'+_0x166844[_0x01c2('0x45')][_0x01c2('0x4e')]+'%'};return _0x20adf4;})});}if(_0x166844[_0x01c2('0x45')]['$gte']){var _0x27d0c9=_0x166844[_0x01c2('0x45')][_0x01c2('0xa4')][_0x01c2('0xa5')](',');var _0x4b7cdc={};_0x4b7cdc[_0x27d0c9[0x0]]={'$gte':moment(_0x27d0c9[0x1])[_0x01c2('0xa6')](_0x01c2('0xa7'))};_0x24dfe7[_0x01c2('0x4f')]=_['merge'](_0x24dfe7[_0x01c2('0x4f')],_0x4b7cdc);}_0x24dfe7=_[_0x01c2('0x51')]({},_0x24dfe7,_0x166844[_0x01c2('0x52')]);return db['FaxMessage'][_0x01c2('0x30')]({'where':_0x24dfe7[_0x01c2('0x4f')]})[_0x01c2('0x26')](function(_0x14489c){_0x11b334[_0x01c2('0x30')]=_0x14489c;if(_0x166844[_0x01c2('0x45')][_0x01c2('0x6d')]){_0x24dfe7[_0x01c2('0x54')]=[{'all':!![]}];}return db[_0x01c2('0xa3')]['findAll'](_0x24dfe7);})[_0x01c2('0x26')](function(_0x1d26dd){_0x11b334[_0x01c2('0x56')]=_0x1d26dd;return _0x11b334;});}})[_0x01c2('0x26')](respondWithFilteredResult(_0x57e807,_0x24dfe7))[_0x01c2('0x5a')](handleError(_0x57e807,null));};exports[_0x01c2('0x3c')]=function(_0x3a00d1,_0x3fd892,_0x43ce96){var _0x40feb9,_0x3513db={},_0x1b526d;if(_0x3a00d1['body']['to']){_0x1b526d=_0x3a00d1['body']['to'][0x0];}return db['FaxAccount'][_0x01c2('0x59')]({'where':{'id':_0x3a00d1['params']['id']},'include':[{'model':db[_0x01c2('0xa8')],'as':'List','include':[{'model':db['CmContact'],'as':_0x01c2('0xa9'),'where':{'fax':_0x1b526d},'limit':0x1,'order':[[_0x01c2('0x9e'),_0x01c2('0xaa')]]}]}]})[_0x01c2('0x26')](handleEntityNotFound(_0x3fd892,null))[_0x01c2('0x26')](function(_0xd126a9){_0x40feb9=_0xd126a9;if(_0x3a00d1[_0x01c2('0x64')]['attachments']&&_0x3a00d1[_0x01c2('0x64')]['attachments'][_0x01c2('0x4a')]){for(var _0x70dee=0x0;_0x70dee<_0x3a00d1[_0x01c2('0x64')][_0x01c2('0xab')][_0x01c2('0x4a')];_0x70dee+=0x1){_0x3a00d1['body']['attachments'][_0x70dee]={'filename':_0x3a00d1[_0x01c2('0x64')][_0x01c2('0xab')][_0x70dee][_0x01c2('0x3b')],'id':_0x3a00d1[_0x01c2('0x64')][_0x01c2('0xab')][_0x70dee]['id'],'path':path[_0x01c2('0xac')](config[_0x01c2('0xad')],_0x01c2('0xae'),_0x3a00d1[_0x01c2('0x64')][_0x01c2('0xab')][_0x70dee]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0x01c2('0xaf'),{'FaxAccountId':_[_0x01c2('0xb0')](_0x3a00d1[_0x01c2('0x58')]['id'])?undefined:_0x3a00d1['params']['id'],'path':_[_0x01c2('0xb0')](_0x3a00d1[_0x01c2('0x64')]['attachments'][0x0][_0x01c2('0x9')])?undefined:_0x3a00d1[_0x01c2('0x64')][_0x01c2('0xab')][0x0][_0x01c2('0x9')],'fax':_[_0x01c2('0xb0')](_0x3a00d1[_0x01c2('0x64')]['to'][0x0])?undefined:_0x3a00d1[_0x01c2('0x64')]['to'][0x0]},client9002);})[_0x01c2('0x26')](function(){if(_0x40feb9){if(_[_0x01c2('0xb0')](_0x3a00d1['body'][_0x01c2('0xb1')])){_0x3a00d1[_0x01c2('0x64')]['from']=util[_0x01c2('0xa6')]('\x22%s\x22\x20<%s>',_0x40feb9[_0x01c2('0x3b')],_0x40feb9['fax']);}if(_0x40feb9[_0x01c2('0xb2')]){if(_0x40feb9[_0x01c2('0xb2')]['Contacts'][_0x01c2('0x4a')]){return _0x40feb9['List'][_0x01c2('0xa9')][0x0];}else{return db[_0x01c2('0xb3')]['create'](_[_0x01c2('0x1c')](_0x3a00d1['body'],{'firstName':_0x3a00d1[_0x01c2('0x64')]['to'][0x0],'phone':_0x3a00d1[_0x01c2('0x64')]['to'][0x0],'fax':_0x3a00d1['body']['to'][0x0],'ListId':_0x40feb9[_0x01c2('0xa0')]}));}}else{throw new Error(_0x01c2('0xb4'));}}else{throw new Error(_0x01c2('0xb5'));}})['then'](function(_0x18f991){if(_0x18f991){return db[_0x01c2('0x76')][_0x01c2('0x59')]({'where':{'ContactId':_0x18f991['id'],'closed':![],'FaxAccountId':_0x40feb9['id']}})[_0x01c2('0x26')](function(_0x2513b4){if(_0x2513b4){return[_0x2513b4,![]];}return db[_0x01c2('0x76')][_0x01c2('0x5b')]({'UserId':_0x3a00d1['user']['id'],'ContactId':_0x18f991['id'],'FaxAccountId':_0x40feb9['id'],'fax':_0x3a00d1[_0x01c2('0x64')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x01c2('0x51')](_0x3a00d1[_0x01c2('0x64')],{'read':![],'body':_0x3a00d1[_0x01c2('0x64')][_0x01c2('0xab')][0x0][_0x01c2('0xb6')],'FaxAccountId':_0x40feb9['id'],'UserId':_0x3a00d1['user']['id'],'ContactId':_0x18f991['id'],'AttachmentId':_0x3a00d1['body'][_0x01c2('0xab')][0x0]['id']})]},{'include':[{'model':db[_0x01c2('0xa3')],'as':'Messages'}]})[_0x01c2('0x26')](function(_0x2c46d1){return[_0x2c46d1,!![]];});});}else{throw new Error(_0x01c2('0xb7'));}})[_0x01c2('0xb8')](function(_0x257a4c,_0x1740c1){if(_0x1740c1){return _0x257a4c;}return db[_0x01c2('0xa3')][_0x01c2('0x5b')]({'direction':'out','read':![],'body':_0x3a00d1[_0x01c2('0x64')][_0x01c2('0xab')][0x0]['filename'],'FaxAccountId':_0x40feb9['id'],'FaxInteractionId':_0x257a4c['id'],'UserId':_0x3a00d1[_0x01c2('0x5c')]['id'],'ContactId':_0x257a4c[_0x01c2('0xb9')],'AttachmentId':_0x3a00d1[_0x01c2('0x64')][_0x01c2('0xab')][0x0]['id']})[_0x01c2('0x26')](function(_0x517c60){_0x257a4c[_0x01c2('0xba')][_0x01c2('0xbb')]=[];_0x257a4c[_0x01c2('0xba')][_0x01c2('0xbb')][_0x01c2('0x8d')](_0x517c60[_0x01c2('0xba')]);return _0x257a4c;});})[_0x01c2('0x26')](function(_0x399c6e){respondWithRpcPromise(_0x01c2('0xbc'),_0x01c2('0xbc'),{'FaxAccountId':_['isNil'](_0x3a00d1['params']['id'])?undefined:_0x3a00d1[_0x01c2('0x58')]['id'],'path':_[_0x01c2('0xb0')](_0x3a00d1[_0x01c2('0x64')][_0x01c2('0xab')][0x0][_0x01c2('0x9')])?undefined:_0x3a00d1[_0x01c2('0x64')][_0x01c2('0xab')][0x0][_0x01c2('0x9')],'fax':_[_0x01c2('0xb0')](_0x3a00d1[_0x01c2('0x64')]['to'][0x0])?undefined:_0x3a00d1['body']['to'][0x0],'AttachmentId':_0x3a00d1[_0x01c2('0x64')][_0x01c2('0xab')][0x0]['id']},client9002)['then'](function(_0x4eb457){logger[_0x01c2('0x27')](_0x01c2('0xbd'),_0x4eb457);})[_0x01c2('0x5a')](function(_0x3620c7){logger[_0x01c2('0x27')](_0x01c2('0xbd'),_0x3620c7);});return _0x399c6e;})[_0x01c2('0x26')](respondWithResult(_0x3fd892,null))['catch'](handleError(_0x3fd892,null));};exports[_0x01c2('0xbe')]=function(_0x1b0ff3,_0x18be3f,_0x4bc726){return db[_0x01c2('0x53')][_0x01c2('0x59')]({'where':{'id':_0x1b0ff3[_0x01c2('0x58')]['id']}})['then'](handleEntityNotFound(_0x18be3f,null))[_0x01c2('0x26')](function(_0x24d2b4){if(_0x24d2b4){return _0x24d2b4[_0x01c2('0xbe')](_0x1b0ff3[_0x01c2('0x64')][_0x01c2('0x6f')],_['omit'](_0x1b0ff3[_0x01c2('0x64')],[_0x01c2('0x6f'),'id'])||{})[_0x01c2('0xb8')](function(_0x5e4382){for(var _0x317697=0x0;_0x317697<_0x1b0ff3[_0x01c2('0x64')][_0x01c2('0x6f')][_0x01c2('0x4a')];_0x317697+=0x1){socket['emit']('userFaxAccount:save',{'UserId':_0x1b0ff3[_0x01c2('0x64')][_0x01c2('0x6f')][_0x317697],'FaxAccountId':_0x1b0ff3[_0x01c2('0x58')]['id']});}return _0x5e4382;});}})[_0x01c2('0x26')](respondWithResult(_0x18be3f,null))[_0x01c2('0x5a')](handleError(_0x18be3f,null));};exports['removeAgents']=function(_0xf1c4f9,_0x2ec3b6,_0x557320){return db[_0x01c2('0x53')][_0x01c2('0x59')]({'where':{'id':_0xf1c4f9['params']['id']}})[_0x01c2('0x26')](handleEntityNotFound(_0x2ec3b6,null))['then'](function(_0x5ea1b7){if(_0x5ea1b7){return _0x5ea1b7[_0x01c2('0xbf')](_0xf1c4f9['query'][_0x01c2('0x6f')])[_0x01c2('0x26')](function(){if(_[_0x01c2('0xc0')](_0xf1c4f9[_0x01c2('0x45')][_0x01c2('0x6f')])){for(var _0x4fca99=0x0;_0x4fca99<_0xf1c4f9[_0x01c2('0x45')][_0x01c2('0x6f')][_0x01c2('0x4a')];_0x4fca99+=0x1){socket[_0x01c2('0xc1')](_0x01c2('0xc2'),{'UserId':Number(_0xf1c4f9[_0x01c2('0x45')][_0x01c2('0x6f')][_0x4fca99]),'FaxAccountId':Number(_0xf1c4f9['params']['id'])});}}else{socket[_0x01c2('0xc1')](_0x01c2('0xc2'),{'UserId':Number(_0xf1c4f9[_0x01c2('0x45')]['ids']),'FaxAccountId':Number(_0xf1c4f9[_0x01c2('0x58')]['id'])});}});}})[_0x01c2('0x26')](respondWithStatusCode(_0x2ec3b6,null))[_0x01c2('0x5a')](handleError(_0x2ec3b6,null));};exports[_0x01c2('0xc3')]=function(_0x32ca2d,_0x451a88,_0x2bf7ae){var _0x501a8d={};var _0x1f11b0={};var _0x476118;var _0xda9bd5;return db['FaxAccount'][_0x01c2('0x69')]({'where':{'id':_0x32ca2d[_0x01c2('0x58')]['id']}})['then'](handleEntityNotFound(_0x451a88,null))[_0x01c2('0x26')](function(_0x4d8143){if(_0x4d8143){_0x476118=_0x4d8143;_0x1f11b0[_0x01c2('0x43')]=_[_0x01c2('0x44')](db[_0x01c2('0x79')]['rawAttributes']);_0x1f11b0[_0x01c2('0x45')]=_[_0x01c2('0x44')](_0x32ca2d['query']);_0x1f11b0[_0x01c2('0x46')]=_['intersection'](_0x1f11b0[_0x01c2('0x43')],_0x1f11b0[_0x01c2('0x45')]);_0x501a8d[_0x01c2('0x47')]=_[_0x01c2('0x48')](_0x1f11b0[_0x01c2('0x43')],qs[_0x01c2('0x49')](_0x32ca2d[_0x01c2('0x45')][_0x01c2('0x49')]));_0x501a8d[_0x01c2('0x47')]=_0x501a8d[_0x01c2('0x47')][_0x01c2('0x4a')]?_0x501a8d[_0x01c2('0x47')]:_0x1f11b0[_0x01c2('0x43')];_0x501a8d[_0x01c2('0x4c')]=qs[_0x01c2('0x6b')](_0x32ca2d[_0x01c2('0x45')][_0x01c2('0x6b')]);_0x501a8d[_0x01c2('0x4f')]=qs[_0x01c2('0x46')](_[_0x01c2('0x4d')](_0x32ca2d[_0x01c2('0x45')],_0x1f11b0[_0x01c2('0x46')]));if(_0x32ca2d[_0x01c2('0x45')]['filter']){_0x501a8d[_0x01c2('0x4f')]=_['merge'](_0x501a8d['where'],{'$or':_['map'](_0x501a8d[_0x01c2('0x47')],function(_0x393c38){var _0x2d7ba9={};_0x2d7ba9[_0x393c38]={'$like':'%'+_0x32ca2d[_0x01c2('0x45')]['filter']+'%'};return _0x2d7ba9;})});}_0x501a8d=_[_0x01c2('0x51')]({},_0x501a8d,_0x32ca2d[_0x01c2('0x52')]);return _0x476118[_0x01c2('0xc3')](_0x501a8d);}})[_0x01c2('0x26')](function(_0x9905d1){if(_0x9905d1){_0xda9bd5=_0x9905d1[_0x01c2('0x4a')];if(!_0x32ca2d[_0x01c2('0x45')]['hasOwnProperty'](_0x01c2('0x4b'))){_0x501a8d[_0x01c2('0x32')]=qs[_0x01c2('0x32')](_0x32ca2d[_0x01c2('0x45')]['limit']);_0x501a8d['offset']=qs[_0x01c2('0x31')](_0x32ca2d[_0x01c2('0x45')][_0x01c2('0x31')]);}return _0x476118['getAgents'](_0x501a8d);}})['then'](function(_0x3edf3b){if(_0x3edf3b){return _0x3edf3b?{'count':_0xda9bd5,'rows':_0x3edf3b}:null;}})['then'](respondWithResult(_0x451a88,null))[_0x01c2('0x5a')](handleError(_0x451a88,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index d841e1f..80bc27d 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 _0xce47=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','FaxAccount'];(function(_0x36ce4b,_0x17ff14){var _0x5701c4=function(_0x25788c){while(--_0x25788c){_0x36ce4b['push'](_0x36ce4b['shift']());}};_0x5701c4(++_0x17ff14);}(_0xce47,0x6e));var _0x7ce4=function(_0x1c308e,_0x705ac3){_0x1c308e=_0x1c308e-0x0;var _0x312e97=_0xce47[_0x1c308e];return _0x312e97;};'use strict';var EventEmitter=require(_0x7ce4('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x7ce4('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x7ce4('0x2')](0x0);var events={'afterCreate':_0x7ce4('0x3'),'afterUpdate':'update','afterDestroy':_0x7ce4('0x4')};function emitEvent(_0x28dafc){return function(_0x2b818e,_0x4ef469,_0x7f4dc4){FaxAccountEvents[_0x7ce4('0x5')](_0x28dafc+':'+_0x2b818e['id'],_0x2b818e);FaxAccountEvents[_0x7ce4('0x5')](_0x28dafc,_0x2b818e);_0x7f4dc4(null);};}for(var e in events){if(events[_0x7ce4('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x7ce4('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0xe64d=['remove','hasOwnProperty','exports','events','FaxAccount','setMaxListeners','save'];(function(_0x175136,_0x5cefc5){var _0x5931cc=function(_0x46aab7){while(--_0x46aab7){_0x175136['push'](_0x175136['shift']());}};_0x5931cc(++_0x5cefc5);}(_0xe64d,0x65));var _0xde64=function(_0x290694,_0x281935){_0x290694=_0x290694-0x0;var _0x5a0f2e=_0xe64d[_0x290694];return _0x5a0f2e;};'use strict';var EventEmitter=require(_0xde64('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xde64('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xde64('0x2')](0x0);var events={'afterCreate':_0xde64('0x3'),'afterUpdate':'update','afterDestroy':_0xde64('0x4')};function emitEvent(_0x319985){return function(_0x5b205d,_0x2c982a,_0xe26e0f){FaxAccountEvents['emit'](_0x319985+':'+_0x5b205d['id'],_0x5b205d);FaxAccountEvents['emit'](_0x319985,_0x5b205d);_0xe26e0f(null);};}for(var e in events){if(events[_0xde64('0x5')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xde64('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 451d256..e0ab490 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 _0x5195=['request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts','lodash','util','api','moment','bluebird'];(function(_0x1776e3,_0x14e945){var _0x102946=function(_0x3455c7){while(--_0x3455c7){_0x1776e3['push'](_0x1776e3['shift']());}};_0x102946(++_0x14e945);}(_0x5195,0x10c));var _0x5519=function(_0x74c392,_0x29cc28){_0x74c392=_0x74c392-0x0;var _0x306791=_0x5195[_0x74c392];return _0x306791;};'use strict';var _=require(_0x5519('0x0'));var util=require(_0x5519('0x1'));var logger=require('../../config/logger')(_0x5519('0x2'));var moment=require(_0x5519('0x3'));var BPromise=require(_0x5519('0x4'));var rp=require(_0x5519('0x5'));var fs=require('fs');var path=require(_0x5519('0x6'));var rimraf=require(_0x5519('0x7'));var config=require(_0x5519('0x8'));var attributes=require(_0x5519('0x9'));module[_0x5519('0xa')]=function(_0x4e187a,_0x3f7151){return _0x4e187a['define'](_0x5519('0xb'),attributes,{'tableName':_0x5519('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9284=['request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','fax_accounts','lodash','api','moment','bluebird'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x9284,0x8b));var _0x4928=function(_0x5f3811,_0x423d22){_0x5f3811=_0x5f3811-0x0;var _0xb46324=_0x9284[_0x5f3811];return _0xb46324;};'use strict';var _=require(_0x4928('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4928('0x1'));var moment=require(_0x4928('0x2'));var BPromise=require(_0x4928('0x3'));var rp=require(_0x4928('0x4'));var fs=require('fs');var path=require(_0x4928('0x5'));var rimraf=require(_0x4928('0x6'));var config=require(_0x4928('0x7'));var attributes=require(_0x4928('0x8'));module[_0x4928('0x9')]=function(_0x42ea5a,_0xe136fc){return _0x42ea5a['define']('FaxAccount',attributes,{'tableName':_0x4928('0xa'),'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 a38ea39..d318a4a 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 _0xbcf9=['model','stringify','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','CmList','List','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','Contacts','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','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','request\x20sent','debug','error','code','FaxAccount,\x20%s,\x20%s','message','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','include','map'];(function(_0xe318fe,_0x514d16){var _0x45a207=function(_0x325299){while(--_0x325299){_0xe318fe['push'](_0xe318fe['shift']());}};_0x45a207(++_0x514d16);}(_0xbcf9,0xfd));var _0x9bcf=function(_0x77c015,_0xdc01c1){_0x77c015=_0x77c015-0x0;var _0x4c0762=_0xbcf9[_0x77c015];return _0x4c0762;};'use strict';var _=require(_0x9bcf('0x0'));var util=require(_0x9bcf('0x1'));var moment=require(_0x9bcf('0x2'));var BPromise=require(_0x9bcf('0x3'));var rs=require(_0x9bcf('0x4'));var fs=require('fs');var Redis=require(_0x9bcf('0x5'));var db=require(_0x9bcf('0x6'))['db'];var utils=require(_0x9bcf('0x7'));var logger=require('../../config/logger')(_0x9bcf('0x8'));var config=require('../../config/environment');var jayson=require(_0x9bcf('0x9'));var client=jayson[_0x9bcf('0xa')][_0x9bcf('0xb')]({'port':0x232c});config['redis']=_[_0x9bcf('0xc')](config[_0x9bcf('0xd')],{'host':_0x9bcf('0xe'),'port':0x18eb});var socket=require(_0x9bcf('0xf'))(new Redis(config[_0x9bcf('0xd')]));require(_0x9bcf('0x10'))['register'](socket);function respondWithRpcPromise(_0x46fdd6,_0x59bd25,_0x4be15c){return new BPromise(function(_0x584127,_0x120fa6){return client[_0x9bcf('0x11')](_0x46fdd6,_0x4be15c)[_0x9bcf('0x12')](function(_0x2cf594){logger[_0x9bcf('0x13')]('FaxAccount,\x20%s,\x20%s',_0x59bd25,_0x9bcf('0x14'));logger[_0x9bcf('0x15')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x59bd25,'request\x20sent',JSON['stringify'](_0x2cf594));if(_0x2cf594['error']){if(_0x2cf594[_0x9bcf('0x16')][_0x9bcf('0x17')]===0x1f4){logger['error'](_0x9bcf('0x18'),_0x59bd25,_0x2cf594[_0x9bcf('0x16')][_0x9bcf('0x19')]);return _0x120fa6(_0x2cf594[_0x9bcf('0x16')][_0x9bcf('0x19')]);}logger[_0x9bcf('0x16')](_0x9bcf('0x18'),_0x59bd25,_0x2cf594[_0x9bcf('0x16')][_0x9bcf('0x19')]);return _0x584127(_0x2cf594['error']['message']);}else{logger[_0x9bcf('0x13')](_0x9bcf('0x18'),_0x59bd25,'request\x20sent');_0x584127(_0x2cf594['result'][_0x9bcf('0x19')]);}})[_0x9bcf('0x1a')](function(_0x35eb8e){logger[_0x9bcf('0x16')](_0x9bcf('0x18'),_0x59bd25,_0x35eb8e);_0x120fa6(_0x35eb8e);});});}exports[_0x9bcf('0x1b')]=function(_0x28462c){var _0x42ae54=this;return new Promise(function(_0x96748c,_0x5eb9b5){return db[_0x9bcf('0x1c')][_0x9bcf('0x1d')]({'raw':_0x28462c[_0x9bcf('0x1e')]?_0x28462c[_0x9bcf('0x1e')][_0x9bcf('0x1f')]===undefined?!![]:![]:!![],'where':_0x28462c[_0x9bcf('0x1e')]?_0x28462c[_0x9bcf('0x1e')]['where']||null:null,'attributes':_0x28462c[_0x9bcf('0x1e')]?_0x28462c[_0x9bcf('0x1e')][_0x9bcf('0x20')]||null:null,'limit':_0x28462c[_0x9bcf('0x1e')]?_0x28462c[_0x9bcf('0x1e')]['limit']||null:null,'include':_0x28462c[_0x9bcf('0x1e')]?_0x28462c[_0x9bcf('0x1e')][_0x9bcf('0x21')]?_[_0x9bcf('0x22')](_0x28462c[_0x9bcf('0x1e')]['include'],function(_0x3fabfa){return{'model':db[_0x3fabfa[_0x9bcf('0x23')]],'as':_0x3fabfa['as'],'attributes':_0x3fabfa[_0x9bcf('0x20')],'include':_0x3fabfa[_0x9bcf('0x21')]?_[_0x9bcf('0x22')](_0x3fabfa['include'],function(_0x2e9e32){return{'model':db[_0x2e9e32[_0x9bcf('0x23')]],'as':_0x2e9e32['as'],'attributes':_0x2e9e32[_0x9bcf('0x20')],'include':_0x2e9e32[_0x9bcf('0x21')]?_[_0x9bcf('0x22')](_0x2e9e32[_0x9bcf('0x21')],function(_0x38f952){return{'model':db[_0x38f952[_0x9bcf('0x23')]],'as':_0x38f952['as'],'attributes':_0x38f952[_0x9bcf('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9bcf('0x12')](function(_0x382cbb){logger[_0x9bcf('0x13')](_0x9bcf('0x1b'),_0x28462c);logger[_0x9bcf('0x15')](_0x9bcf('0x1b'),_0x28462c,JSON[_0x9bcf('0x24')](_0x382cbb));_0x96748c(_0x382cbb);})[_0x9bcf('0x1a')](function(_0x233a52){logger[_0x9bcf('0x16')](_0x9bcf('0x1b'),_0x233a52['message'],_0x28462c);_0x5eb9b5(_0x42ae54[_0x9bcf('0x16')](0x1f4,_0x233a52[_0x9bcf('0x19')]));});});};exports[_0x9bcf('0x25')]=function(_0x333560,_0xca9c39,_0x5a51f0){var _0x5beeb4=this;return new Promise(function(_0x1099bc,_0x512928){var _0x29d162={'body':_0x333560['body'],'channel':_0x9bcf('0x26')};var _0x2a2309=[];var _0x4f3820=[];var _0x57ce37={};return db[_0x9bcf('0x27')][_0x9bcf('0x28')]()[_0x9bcf('0x12')](function(_0x5883fe){if(!_0x5883fe){throw new db[(_0x9bcf('0x29'))][(_0x9bcf('0x2a'))](_0x9bcf('0x2b'));}_0x2a2309=_[_0x9bcf('0x2c')](_[_0x9bcf('0x2d')](_0x5883fe),[_0x9bcf('0x2e'),_0x9bcf('0x2f')]);_0x4f3820=_[_0x9bcf('0x2c')](_[_0x9bcf('0x2d')](_0x5883fe),['createdAt',_0x9bcf('0x2f'),_0x9bcf('0x30'),_0x9bcf('0x31')]);if(_0x333560[_0x9bcf('0x32')]['id']){delete _0x333560[_0x9bcf('0x32')]['id'];}if(_['isNil'](_0x333560['body'][_0x9bcf('0x33')])){throw new db[(_0x9bcf('0x29'))][(_0x9bcf('0x2a'))](_0x9bcf('0x34'));}if(_[_0x9bcf('0x35')](_0x333560['body']['body'])||_0x333560[_0x9bcf('0x32')]['body']===''){throw new db['Sequelize'][(_0x9bcf('0x2a'))](_0x9bcf('0x36'));}if(_['isNil'](_0x333560[_0x9bcf('0x32')][_0x9bcf('0x37')])){throw new db[(_0x9bcf('0x29'))][(_0x9bcf('0x2a'))](_0x9bcf('0x38')+_0x4f3820);}if(!_[_0x9bcf('0x39')](_0x4f3820,_0x333560[_0x9bcf('0x32')][_0x9bcf('0x37')])){throw new db[(_0x9bcf('0x29'))][(_0x9bcf('0x2a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4f3820);}_0x57ce37[_0x333560['body'][_0x9bcf('0x37')]]=_0x333560[_0x9bcf('0x32')][_0x9bcf('0x33')];})[_0x9bcf('0x12')](function(){return db[_0x9bcf('0x1c')][_0x9bcf('0x3a')]({'where':{'id':_0x333560[_0x9bcf('0x3b')]['id']},'include':[{'model':db[_0x9bcf('0x3c')],'as':_0x9bcf('0x3d'),'include':[{'model':db[_0x9bcf('0x27')],'as':'Contacts','where':_0x57ce37,'limit':0x1,'order':[[_0x9bcf('0x2f'),_0x9bcf('0x3e')]]}]},{'model':db[_0x9bcf('0x3f')],'as':_0x9bcf('0x40')}]});})[_0x9bcf('0x12')](function(_0x118c3d){if(_0x118c3d&&_0x118c3d[_0x9bcf('0x3d')]){var _0x16e638=_0x118c3d[_0x9bcf('0x41')]({'plain':!![]});_0x29d162['account']=_0x16e638;_0x29d162[_0x9bcf('0x42')]=_0x16e638[_0x9bcf('0x40')];_0x29d162[_0x9bcf('0x43')]=_0x16e638[_0x9bcf('0x3d')];_0x29d162[_0x9bcf('0x42')]=_[_0x9bcf('0x44')](_0x29d162['applications'],[_0x9bcf('0x45')],[_0x9bcf('0x46')]);if(_0x29d162['account'][_0x9bcf('0x40')]){delete _0x29d162['account'][_0x9bcf('0x40')];}if(_0x29d162[_0x9bcf('0x3b')][_0x9bcf('0x3d')]&&_0x29d162[_0x9bcf('0x3b')][_0x9bcf('0x3d')][_0x9bcf('0x47')][_0x9bcf('0x48')]){return _0x29d162[_0x9bcf('0x3b')][_0x9bcf('0x3d')][_0x9bcf('0x47')][0x0];}var _0x3cf8c5=_[_0x9bcf('0xc')](_0x333560[_0x9bcf('0x32')],{'firstName':_0x333560['body'][_0x9bcf('0x33')],'ListId':_0x16e638[_0x9bcf('0x31')]});_0x3cf8c5[_0x333560[_0x9bcf('0x32')][_0x9bcf('0x37')]]=_0x333560[_0x9bcf('0x32')][_0x9bcf('0x33')];return db['CmContact'][_0x9bcf('0x49')](_0x3cf8c5,{'fields':_0x2a2309,'raw':!![]});}})['then'](function(_0x9fa2bb){_0x29d162[_0x9bcf('0x4a')]=_0x9fa2bb;if(_0x9fa2bb){var _0x1e0c7c={'ContactId':_0x9fa2bb['id'],'FaxAccountId':_0x333560[_0x9bcf('0x3b')]['id'],'fax':_0x9fa2bb['fax']};return db[_0x9bcf('0x4b')][_0x9bcf('0x3a')]({'where':{'ContactId':_0x9fa2bb['id'],'closed':![],'FaxAccountId':_0x333560[_0x9bcf('0x3b')]['id']}})['then'](function(_0x2fc602){if(_0x2fc602){return[_0x2fc602,![]];}return db[_0x9bcf('0x4b')][_0x9bcf('0x49')](_0x1e0c7c)[_0x9bcf('0x12')](function(_0x5845bd){return[_0x5845bd,!![]];});});}else{throw new Error(_0x9bcf('0x4c'));}})[_0x9bcf('0x4d')](function(_0x459900,_0x4f87f0){var _0x18fa08=_0x459900[_0x9bcf('0x41')]({'plain':!![]});if(_0x4f87f0){if(_0x29d162[_0x9bcf('0x3b')][_0x9bcf('0x4e')]){_0x29d162['applications'][_0x9bcf('0x4f')]({'id':0x0,'priority':_0x29d162[_0x9bcf('0x42')]['length']+0x1,'app':_0x9bcf('0x50'),'appdata':_0x9bcf('0x51'),'interval':_0x9bcf('0x52')});}_0x18fa08[_0x9bcf('0x53')]=!![];}else{_0x18fa08['created']=![];}_0x29d162[_0x9bcf('0x54')]=_0x18fa08;return db[_0x9bcf('0x55')][_0x9bcf('0x49')]({'body':_0x333560[_0x9bcf('0x32')][_0x9bcf('0x32')],'FaxAccountId':_0x333560[_0x9bcf('0x3b')]['id'],'FaxInteractionId':_0x459900['id'],'direction':'in','ContactId':_0x459900[_0x9bcf('0x56')],'AttachmentId':_0x333560[_0x9bcf('0x32')][_0x9bcf('0x57')]});})[_0x9bcf('0x12')](function(_0x36c7b1){_0x29d162[_0x9bcf('0x19')]=_0x36c7b1;if(_0x29d162[_0x9bcf('0x54')][_0x9bcf('0x58')]){return db[_0x9bcf('0x59')][_0x9bcf('0x3a')]({'attributes':['id',_0x9bcf('0x5a')],'where':{'id':_0x29d162[_0x9bcf('0x54')][_0x9bcf('0x58')]}})[_0x9bcf('0x12')](function(_0x393a63){if(_0x393a63){_0x29d162[_0x9bcf('0x42')][_0x9bcf('0x5b')]({'id':0x0,'priority':0x0,'app':_0x9bcf('0x5c'),'appdata':_0x393a63[_0x9bcf('0x5a')]+','+(_0x29d162[_0x9bcf('0x3b')][_0x9bcf('0x5d')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x9bcf('0x5e'),'startRouting',_0x29d162);});}return respondWithRpcPromise('Start',_0x9bcf('0x5f'),_0x29d162);})[_0x9bcf('0x12')](function(_0x48defe){_0x1099bc(_0x48defe);})[_0x9bcf('0x1a')](function(_0x5d2f33){_0x512928(_0x5beeb4['error'](0x1f4,_0x5d2f33[_0x9bcf('0x19')]));});});}; \ No newline at end of file +var _0xa2c5=['FaxAccount','find','account','CmList','List','Contacts','DESC','FaxApplication','get','applications','orderBy','priority','Applications','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','./faxAccount.socket','register','request','debug','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','catch','options','raw','where','attributes','limit','include','model','map','then','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','ListId','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','from'];(function(_0x13f3b6,_0x5f53b4){var _0x45afb4=function(_0x8be0ff){while(--_0x8be0ff){_0x13f3b6['push'](_0x13f3b6['shift']());}};_0x45afb4(++_0x5f53b4);}(_0xa2c5,0x7a));var _0x5a2c=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xa2c5[_0x368fb9];return _0x4892fb;};'use strict';var _=require('lodash');var util=require(_0x5a2c('0x0'));var moment=require(_0x5a2c('0x1'));var BPromise=require(_0x5a2c('0x2'));var rs=require(_0x5a2c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a2c('0x4'))['db'];var utils=require(_0x5a2c('0x5'));var logger=require('../../config/logger')(_0x5a2c('0x6'));var config=require('../../config/environment');var jayson=require(_0x5a2c('0x7'));var client=jayson[_0x5a2c('0x8')][_0x5a2c('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0x5a2c('0xa')],{'host':_0x5a2c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5a2c('0xa')]));require(_0x5a2c('0xc'))[_0x5a2c('0xd')](socket);function respondWithRpcPromise(_0x143c19,_0x167c73,_0x1f3124){return new BPromise(function(_0x53360c,_0x4fe684){return client[_0x5a2c('0xe')](_0x143c19,_0x1f3124)['then'](function(_0x4d38ce){logger['info']('FaxAccount,\x20%s,\x20%s',_0x167c73,'request\x20sent');logger[_0x5a2c('0xf')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x167c73,_0x5a2c('0x10'),JSON[_0x5a2c('0x11')](_0x4d38ce));if(_0x4d38ce[_0x5a2c('0x12')]){if(_0x4d38ce[_0x5a2c('0x12')][_0x5a2c('0x13')]===0x1f4){logger[_0x5a2c('0x12')]('FaxAccount,\x20%s,\x20%s',_0x167c73,_0x4d38ce[_0x5a2c('0x12')]['message']);return _0x4fe684(_0x4d38ce['error']['message']);}logger[_0x5a2c('0x12')](_0x5a2c('0x14'),_0x167c73,_0x4d38ce[_0x5a2c('0x12')][_0x5a2c('0x15')]);return _0x53360c(_0x4d38ce[_0x5a2c('0x12')]['message']);}else{logger[_0x5a2c('0x16')](_0x5a2c('0x14'),_0x167c73,_0x5a2c('0x10'));_0x53360c(_0x4d38ce['result'][_0x5a2c('0x15')]);}})[_0x5a2c('0x17')](function(_0x2471ec){logger[_0x5a2c('0x12')](_0x5a2c('0x14'),_0x167c73,_0x2471ec);_0x4fe684(_0x2471ec);});});}exports['GetFaxAccount']=function(_0xddf943){var _0x5a3848=this;return new Promise(function(_0x33653f,_0x12ad11){return db['FaxAccount']['findAll']({'raw':_0xddf943[_0x5a2c('0x18')]?_0xddf943[_0x5a2c('0x18')][_0x5a2c('0x19')]===undefined?!![]:![]:!![],'where':_0xddf943[_0x5a2c('0x18')]?_0xddf943[_0x5a2c('0x18')][_0x5a2c('0x1a')]||null:null,'attributes':_0xddf943[_0x5a2c('0x18')]?_0xddf943['options'][_0x5a2c('0x1b')]||null:null,'limit':_0xddf943[_0x5a2c('0x18')]?_0xddf943[_0x5a2c('0x18')][_0x5a2c('0x1c')]||null:null,'include':_0xddf943[_0x5a2c('0x18')]?_0xddf943[_0x5a2c('0x18')][_0x5a2c('0x1d')]?_['map'](_0xddf943[_0x5a2c('0x18')][_0x5a2c('0x1d')],function(_0x3302d9){return{'model':db[_0x3302d9[_0x5a2c('0x1e')]],'as':_0x3302d9['as'],'attributes':_0x3302d9[_0x5a2c('0x1b')],'include':_0x3302d9[_0x5a2c('0x1d')]?_['map'](_0x3302d9[_0x5a2c('0x1d')],function(_0x2d7a9d){return{'model':db[_0x2d7a9d[_0x5a2c('0x1e')]],'as':_0x2d7a9d['as'],'attributes':_0x2d7a9d[_0x5a2c('0x1b')],'include':_0x2d7a9d[_0x5a2c('0x1d')]?_[_0x5a2c('0x1f')](_0x2d7a9d[_0x5a2c('0x1d')],function(_0x3ba50b){return{'model':db[_0x3ba50b['model']],'as':_0x3ba50b['as'],'attributes':_0x3ba50b[_0x5a2c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5a2c('0x20')](function(_0x525367){logger[_0x5a2c('0x16')](_0x5a2c('0x21'),_0xddf943);logger[_0x5a2c('0xf')](_0x5a2c('0x21'),_0xddf943,JSON[_0x5a2c('0x11')](_0x525367));_0x33653f(_0x525367);})['catch'](function(_0x561be6){logger['error'](_0x5a2c('0x21'),_0x561be6[_0x5a2c('0x15')],_0xddf943);_0x12ad11(_0x5a3848[_0x5a2c('0x12')](0x1f4,_0x561be6[_0x5a2c('0x15')]));});});};exports[_0x5a2c('0x22')]=function(_0x4cbb0c,_0x416dbe,_0xd507b3){var _0x18ef5e=this;return new Promise(function(_0x507eb0,_0x4c718a){var _0x3cc5cd={'body':_0x4cbb0c[_0x5a2c('0x23')],'channel':_0x5a2c('0x24')};var _0x5eccf4=[];var _0x18a417=[];var _0x3f2b32={};return db[_0x5a2c('0x25')]['describe']()['then'](function(_0xa02ab){if(!_0xa02ab){throw new db[(_0x5a2c('0x26'))][(_0x5a2c('0x27'))](_0x5a2c('0x28'));}_0x5eccf4=_['difference'](_[_0x5a2c('0x29')](_0xa02ab),[_0x5a2c('0x2a'),_0x5a2c('0x2b')]);_0x18a417=_[_0x5a2c('0x2c')](_[_0x5a2c('0x29')](_0xa02ab),[_0x5a2c('0x2a'),_0x5a2c('0x2b'),_0x5a2c('0x2d'),_0x5a2c('0x2e')]);if(_0x4cbb0c[_0x5a2c('0x23')]['id']){delete _0x4cbb0c['body']['id'];}if(_['isNil'](_0x4cbb0c[_0x5a2c('0x23')]['from'])){throw new db[(_0x5a2c('0x26'))]['ValidationError'](_0x5a2c('0x2f'));}if(_['isNil'](_0x4cbb0c[_0x5a2c('0x23')][_0x5a2c('0x23')])||_0x4cbb0c['body'][_0x5a2c('0x23')]===''){throw new db[(_0x5a2c('0x26'))][(_0x5a2c('0x27'))](_0x5a2c('0x30'));}if(_['isNil'](_0x4cbb0c[_0x5a2c('0x23')][_0x5a2c('0x31')])){throw new db[(_0x5a2c('0x26'))]['ValidationError'](_0x5a2c('0x32')+_0x18a417);}if(!_[_0x5a2c('0x33')](_0x18a417,_0x4cbb0c[_0x5a2c('0x23')][_0x5a2c('0x31')])){throw new db[(_0x5a2c('0x26'))][(_0x5a2c('0x27'))](_0x5a2c('0x34')+_0x18a417);}_0x3f2b32[_0x4cbb0c[_0x5a2c('0x23')][_0x5a2c('0x31')]]=_0x4cbb0c[_0x5a2c('0x23')][_0x5a2c('0x35')];})[_0x5a2c('0x20')](function(){return db[_0x5a2c('0x36')][_0x5a2c('0x37')]({'where':{'id':_0x4cbb0c[_0x5a2c('0x38')]['id']},'include':[{'model':db[_0x5a2c('0x39')],'as':_0x5a2c('0x3a'),'include':[{'model':db[_0x5a2c('0x25')],'as':_0x5a2c('0x3b'),'where':_0x3f2b32,'limit':0x1,'order':[['updatedAt',_0x5a2c('0x3c')]]}]},{'model':db[_0x5a2c('0x3d')],'as':'Applications'}]});})[_0x5a2c('0x20')](function(_0x14d72){if(_0x14d72&&_0x14d72['List']){var _0x240662=_0x14d72[_0x5a2c('0x3e')]({'plain':!![]});_0x3cc5cd['account']=_0x240662;_0x3cc5cd[_0x5a2c('0x3f')]=_0x240662['Applications'];_0x3cc5cd['list']=_0x240662[_0x5a2c('0x3a')];_0x3cc5cd[_0x5a2c('0x3f')]=_[_0x5a2c('0x40')](_0x3cc5cd[_0x5a2c('0x3f')],[_0x5a2c('0x41')],['asc']);if(_0x3cc5cd[_0x5a2c('0x38')][_0x5a2c('0x42')]){delete _0x3cc5cd[_0x5a2c('0x38')]['Applications'];}if(_0x3cc5cd[_0x5a2c('0x38')]['List']&&_0x3cc5cd[_0x5a2c('0x38')][_0x5a2c('0x3a')][_0x5a2c('0x3b')][_0x5a2c('0x43')]){return _0x3cc5cd[_0x5a2c('0x38')][_0x5a2c('0x3a')]['Contacts'][0x0];}var _0x57b348=_[_0x5a2c('0x44')](_0x4cbb0c[_0x5a2c('0x23')],{'firstName':_0x4cbb0c[_0x5a2c('0x23')][_0x5a2c('0x35')],'ListId':_0x240662[_0x5a2c('0x2e')]});_0x57b348[_0x4cbb0c['body'][_0x5a2c('0x31')]]=_0x4cbb0c[_0x5a2c('0x23')][_0x5a2c('0x35')];return db[_0x5a2c('0x25')][_0x5a2c('0x45')](_0x57b348,{'fields':_0x5eccf4,'raw':!![]});}})['then'](function(_0x527a23){_0x3cc5cd[_0x5a2c('0x46')]=_0x527a23;if(_0x527a23){var _0x317063={'ContactId':_0x527a23['id'],'FaxAccountId':_0x4cbb0c['account']['id'],'fax':_0x527a23[_0x5a2c('0x24')]};return db[_0x5a2c('0x47')]['find']({'where':{'ContactId':_0x527a23['id'],'closed':![],'FaxAccountId':_0x4cbb0c[_0x5a2c('0x38')]['id']}})[_0x5a2c('0x20')](function(_0x5c4af2){if(_0x5c4af2){return[_0x5c4af2,![]];}return db[_0x5a2c('0x47')][_0x5a2c('0x45')](_0x317063)[_0x5a2c('0x20')](function(_0x1980b9){return[_0x1980b9,!![]];});});}else{throw new Error(_0x5a2c('0x48'));}})[_0x5a2c('0x49')](function(_0x3a0280,_0x1dbef5){var _0xc108a0=_0x3a0280['get']({'plain':!![]});if(_0x1dbef5){if(_0x3cc5cd[_0x5a2c('0x38')][_0x5a2c('0x4a')]){_0x3cc5cd[_0x5a2c('0x3f')][_0x5a2c('0x4b')]({'id':0x0,'priority':_0x3cc5cd[_0x5a2c('0x3f')][_0x5a2c('0x43')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x5a2c('0x4c')});}_0xc108a0[_0x5a2c('0x4d')]=!![];}else{_0xc108a0[_0x5a2c('0x4d')]=![];}_0x3cc5cd[_0x5a2c('0x4e')]=_0xc108a0;return db[_0x5a2c('0x4f')][_0x5a2c('0x45')]({'body':_0x4cbb0c[_0x5a2c('0x23')][_0x5a2c('0x23')],'FaxAccountId':_0x4cbb0c[_0x5a2c('0x38')]['id'],'FaxInteractionId':_0x3a0280['id'],'direction':'in','ContactId':_0x3a0280[_0x5a2c('0x50')],'AttachmentId':_0x4cbb0c[_0x5a2c('0x23')][_0x5a2c('0x51')]});})['then'](function(_0x2444b6){_0x3cc5cd[_0x5a2c('0x15')]=_0x2444b6;if(_0x3cc5cd[_0x5a2c('0x4e')][_0x5a2c('0x52')]){return db['User'][_0x5a2c('0x37')]({'attributes':['id',_0x5a2c('0x53')],'where':{'id':_0x3cc5cd[_0x5a2c('0x4e')][_0x5a2c('0x52')]}})[_0x5a2c('0x20')](function(_0x399f8c){if(_0x399f8c){_0x3cc5cd[_0x5a2c('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5a2c('0x54'),'appdata':_0x399f8c[_0x5a2c('0x53')]+','+(_0x3cc5cd[_0x5a2c('0x38')][_0x5a2c('0x55')]||0xa),'interval':_0x5a2c('0x4c')});}return respondWithRpcPromise(_0x5a2c('0x56'),_0x5a2c('0x57'),_0x3cc5cd);});}return respondWithRpcPromise(_0x5a2c('0x56'),_0x5a2c('0x57'),_0x3cc5cd);})[_0x5a2c('0x20')](function(_0x3ac553){_0x507eb0(_0x3ac553);})[_0x5a2c('0x17')](function(_0xc630d9){_0x4c718a(_0x18ef5e[_0x5a2c('0x12')](0x1f4,_0xc630d9[_0x5a2c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 520b458..16fbbf3 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 _0x6455=['emit','removeListener','register','length','./faxAccount.events','remove','update'];(function(_0x54f6bb,_0x549589){var _0x810755=function(_0x517ac9){while(--_0x517ac9){_0x54f6bb['push'](_0x54f6bb['shift']());}};_0x810755(++_0x549589);}(_0x6455,0x97));var _0x5645=function(_0x1cd0ab,_0x5e27e0){_0x1cd0ab=_0x1cd0ab-0x0;var _0x53f982=_0x6455[_0x1cd0ab];return _0x53f982;};'use strict';var FaxAccountEvents=require(_0x5645('0x0'));var events=['save',_0x5645('0x1'),_0x5645('0x2')];function createListener(_0x431773,_0x1c3f7e){return function(_0x37c67a){_0x1c3f7e[_0x5645('0x3')](_0x431773,_0x37c67a);};}function removeListener(_0x5388ff,_0x233875){return function(){FaxAccountEvents[_0x5645('0x4')](_0x5388ff,_0x233875);};}exports[_0x5645('0x5')]=function(_0x9400a8){for(var _0x3a635d=0x0,_0x37d672=events[_0x5645('0x6')];_0x3a635d<_0x37d672;_0x3a635d++){var _0x278d86=events[_0x3a635d];var _0x518a28=createListener('faxAccount:'+_0x278d86,_0x9400a8);FaxAccountEvents['on'](_0x278d86,_0x518a28);}}; \ No newline at end of file +var _0x9f0e=['save','remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x5378ba,_0x107e8f){var _0xb606ab=function(_0x4a54ce){while(--_0x4a54ce){_0x5378ba['push'](_0x5378ba['shift']());}};_0xb606ab(++_0x107e8f);}(_0x9f0e,0x116));var _0xe9f0=function(_0x15e8c0,_0x300a9c){_0x15e8c0=_0x15e8c0-0x0;var _0x57262d=_0x9f0e[_0x15e8c0];return _0x57262d;};'use strict';var FaxAccountEvents=require(_0xe9f0('0x0'));var events=[_0xe9f0('0x1'),_0xe9f0('0x2'),_0xe9f0('0x3')];function createListener(_0x146ad8,_0x4a1a30){return function(_0x5856dc){_0x4a1a30[_0xe9f0('0x4')](_0x146ad8,_0x5856dc);};}function removeListener(_0x150a03,_0x3c589d){return function(){FaxAccountEvents[_0xe9f0('0x5')](_0x150a03,_0x3c589d);};}exports[_0xe9f0('0x6')]=function(_0x50313d){for(var _0x5b87c1=0x0,_0x3a17b3=events[_0xe9f0('0x7')];_0x5b87c1<_0x3a17b3;_0x5b87c1++){var _0xe64a79=events[_0x5b87c1];var _0x4be6a6=createListener(_0xe9f0('0x8')+_0xe64a79,_0x50313d);FaxAccountEvents['on'](_0xe64a79,_0x4be6a6);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 02e8e10..db7a1e9 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 _0xf92c=['destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxAccount.controller','index','isAuthenticated','describe','get','/:id','show','getAnswers','/:id/interactions','/:id/applications','/:id/messages','getMessages','/:id/dispositions','post','addAnswer','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','addAgents','put','update','delete'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xf92c,0x136));var _0xcf92=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xf92c[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0xcf92('0x0'));var util=require(_0xcf92('0x1'));var path=require(_0xcf92('0x2'));var timeout=require(_0xcf92('0x3'));var express=require(_0xcf92('0x4'));var router=express[_0xcf92('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xcf92('0x6'));var config=require('../../config/environment');var controller=require(_0xcf92('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcf92('0x8')]);router['get']('/describe',auth[_0xcf92('0x9')](),controller[_0xcf92('0xa')]);router[_0xcf92('0xb')](_0xcf92('0xc'),auth[_0xcf92('0x9')](),controller[_0xcf92('0xd')]);router['get']('/:id/dispositions',auth[_0xcf92('0x9')](),controller['getDispositions']);router[_0xcf92('0xb')]('/:id/canned_answers',auth[_0xcf92('0x9')](),controller[_0xcf92('0xe')]);router[_0xcf92('0xb')](_0xcf92('0xf'),auth[_0xcf92('0x9')](),controller['getInteractions']);router['get'](_0xcf92('0x10'),auth[_0xcf92('0x9')](),controller['getApplications']);router[_0xcf92('0xb')](_0xcf92('0x11'),auth['isAuthenticated'](),controller[_0xcf92('0x12')]);router[_0xcf92('0xb')]('/:id/users',auth[_0xcf92('0x9')](),controller['getAgents']);router['post']('/',auth[_0xcf92('0x9')](),controller['create']);router['post'](_0xcf92('0x13'),auth[_0xcf92('0x9')](),controller['addDisposition']);router[_0xcf92('0x14')]('/:id/canned_answers',auth[_0xcf92('0x9')](),controller[_0xcf92('0x15')]);router[_0xcf92('0x14')](_0xcf92('0xf'),auth[_0xcf92('0x9')](),controller['addInteraction']);router[_0xcf92('0x14')](_0xcf92('0x10'),auth[_0xcf92('0x9')](),controller['addApplications']);router[_0xcf92('0x14')]('/addaccountapplications',auth[_0xcf92('0x9')](),controller[_0xcf92('0x16')]);router['post'](_0xcf92('0x17'),auth[_0xcf92('0x9')](),controller[_0xcf92('0x18')]);router[_0xcf92('0x14')](_0xcf92('0x19'),auth['isAuthenticated'](),controller[_0xcf92('0x1a')]);router[_0xcf92('0x14')](_0xcf92('0x1b'),auth[_0xcf92('0x9')](),controller[_0xcf92('0x1c')]);router[_0xcf92('0x1d')](_0xcf92('0xc'),auth[_0xcf92('0x9')](),controller[_0xcf92('0x1e')]);router[_0xcf92('0x1f')](_0xcf92('0xc'),auth['isAuthenticated'](),controller[_0xcf92('0x20')]);router[_0xcf92('0x1f')](_0xcf92('0x13'),auth[_0xcf92('0x9')](),controller[_0xcf92('0x21')]);router[_0xcf92('0x1f')](_0xcf92('0x22'),auth['isAuthenticated'](),controller[_0xcf92('0x23')]);router[_0xcf92('0x1f')]('/:id/users',auth[_0xcf92('0x9')](),controller[_0xcf92('0x24')]);module[_0xcf92('0x25')]=router; \ No newline at end of file +var _0x3023=['getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','create','post','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions'];(function(_0x10f280,_0x12c6e1){var _0x3efa3b=function(_0x45345e){while(--_0x45345e){_0x10f280['push'](_0x10f280['shift']());}};_0x3efa3b(++_0x12c6e1);}(_0x3023,0x1d9));var _0x3302=function(_0x234469,_0x1aad54){_0x234469=_0x234469-0x0;var _0x9fb9f8=_0x3023[_0x234469];return _0x9fb9f8;};'use strict';var multer=require(_0x3302('0x0'));var util=require(_0x3302('0x1'));var path=require(_0x3302('0x2'));var timeout=require(_0x3302('0x3'));var express=require(_0x3302('0x4'));var router=express[_0x3302('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3302('0x6'));var config=require(_0x3302('0x7'));var controller=require('./faxAccount.controller');router['get']('/',auth[_0x3302('0x8')](),controller[_0x3302('0x9')]);router[_0x3302('0xa')](_0x3302('0xb'),auth[_0x3302('0x8')](),controller['describe']);router[_0x3302('0xa')](_0x3302('0xc'),auth[_0x3302('0x8')](),controller[_0x3302('0xd')]);router[_0x3302('0xa')](_0x3302('0xe'),auth[_0x3302('0x8')](),controller[_0x3302('0xf')]);router['get'](_0x3302('0x10'),auth[_0x3302('0x8')](),controller[_0x3302('0x11')]);router['get'](_0x3302('0x12'),auth[_0x3302('0x8')](),controller[_0x3302('0x13')]);router[_0x3302('0xa')](_0x3302('0x14'),auth['isAuthenticated'](),controller[_0x3302('0x15')]);router[_0x3302('0xa')](_0x3302('0x16'),auth[_0x3302('0x8')](),controller[_0x3302('0x17')]);router[_0x3302('0xa')]('/:id/users',auth[_0x3302('0x8')](),controller['getAgents']);router['post']('/',auth[_0x3302('0x8')](),controller[_0x3302('0x18')]);router[_0x3302('0x19')](_0x3302('0xe'),auth[_0x3302('0x8')](),controller['addDisposition']);router[_0x3302('0x19')](_0x3302('0x10'),auth[_0x3302('0x8')](),controller[_0x3302('0x1a')]);router[_0x3302('0x19')](_0x3302('0x12'),auth['isAuthenticated'](),controller[_0x3302('0x1b')]);router[_0x3302('0x19')](_0x3302('0x14'),auth['isAuthenticated'](),controller[_0x3302('0x1c')]);router[_0x3302('0x19')]('/addaccountapplications',auth[_0x3302('0x8')](),controller[_0x3302('0x1d')]);router['post'](_0x3302('0x1e'),auth['isAuthenticated'](),controller[_0x3302('0x1f')]);router[_0x3302('0x19')]('/:id/send',auth[_0x3302('0x8')](),controller[_0x3302('0x20')]);router[_0x3302('0x19')](_0x3302('0x21'),auth['isAuthenticated'](),controller[_0x3302('0x22')]);router[_0x3302('0x23')](_0x3302('0xc'),auth[_0x3302('0x8')](),controller[_0x3302('0x24')]);router[_0x3302('0x25')](_0x3302('0xc'),auth[_0x3302('0x8')](),controller['destroy']);router[_0x3302('0x25')](_0x3302('0xe'),auth[_0x3302('0x8')](),controller[_0x3302('0x26')]);router[_0x3302('0x25')](_0x3302('0x10'),auth[_0x3302('0x8')](),controller[_0x3302('0x27')]);router['delete']('/:id/users',auth[_0x3302('0x8')](),controller[_0x3302('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 5dd41cf..fbbee89 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 _0x14c7=['exports','INTEGER','noop','TEXT','STRING','sequelize'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x14c7,0x1d9));var _0x714c=function(_0x68ea51,_0x368632){_0x68ea51=_0x68ea51-0x0;var _0xcaabea=_0x14c7[_0x68ea51];return _0xcaabea;};'use strict';var Sequelize=require(_0x714c('0x0'));module[_0x714c('0x1')]={'priority':{'type':Sequelize[_0x714c('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x714c('0x3')},'appdata':{'type':Sequelize[_0x714c('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x714c('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x7da6=['TEXT','*,*,*,*','INTEGER','STRING','noop'];(function(_0x1ca9fb,_0xe05445){var _0x2cd45c=function(_0x360084){while(--_0x360084){_0x1ca9fb['push'](_0x1ca9fb['shift']());}};_0x2cd45c(++_0xe05445);}(_0x7da6,0x124));var _0x67da=function(_0x111311,_0x1e2f69){_0x111311=_0x111311-0x0;var _0x4cef39=_0x7da6[_0x111311];return _0x4cef39;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x67da('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x67da('0x1')],'allowNull':![],'defaultValue':_0x67da('0x2')},'appdata':{'type':Sequelize[_0x67da('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x67da('0x1')],'defaultValue':_0x67da('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 921f0f3..0838cc6 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 _0x1261=['model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','merge','options','includeAll','findAll','rows','show','params','keys','length','include','catch','create','body','update','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','error','stack','name','index','FaxApplication','rawAttributes','fieldName','key','map','query','intersection'];(function(_0x5efaf3,_0x3c82f9){var _0x23e7dd=function(_0x3eaaa9){while(--_0x3eaaa9){_0x5efaf3['push'](_0x5efaf3['shift']());}};_0x23e7dd(++_0x3c82f9);}(_0x1261,0x144));var _0x1126=function(_0xd6640b,_0x475e47){_0xd6640b=_0xd6640b-0x0;var _0x4c843e=_0x1261[_0xd6640b];return _0x4c843e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var db=require(_0x1126('0x16'))['db'];function respondWithStatusCode(_0x1b364a,_0xd26a32){_0xd26a32=_0xd26a32||0xcc;return function(_0x273896){if(_0x273896){return _0x1b364a[_0x1126('0x17')](_0xd26a32);}return _0x1b364a[_0x1126('0x18')](_0xd26a32)[_0x1126('0x19')]();};}function respondWithResult(_0x2048ad,_0x43850b){_0x43850b=_0x43850b||0xc8;return function(_0x53a8f0){if(_0x53a8f0){return _0x2048ad['status'](_0x43850b)[_0x1126('0x1a')](_0x53a8f0);}};}function respondWithFilteredResult(_0x154e20,_0x279455){return function(_0x4be0c6){if(_0x4be0c6){var _0x45149c=_0x4be0c6[_0x1126('0x1b')],_0x4794a7=_0x279455['offset'],_0x35fe9f=_0x279455[_0x1126('0x1c')]+_0x279455[_0x1126('0x1d')],_0x42f379;if(_0x35fe9f>=_0x45149c){_0x35fe9f=_0x45149c;_0x42f379=0xc8;}else{_0x42f379=0xce;}_0x154e20['status'](_0x42f379);return _0x154e20['set'](_0x1126('0x1e'),_0x4794a7+'-'+_0x35fe9f+'/'+_0x45149c)[_0x1126('0x1a')](_0x4be0c6);}return null;};}function patchUpdates(_0x58d11a){return function(_0x548359){try{jsonpatch[_0x1126('0x1f')](_0x548359,_0x58d11a,!![]);}catch(_0x58b109){return BPromise[_0x1126('0x20')](_0x58b109);}return _0x548359[_0x1126('0x21')]();};}function saveUpdates(_0x2f70ac,_0x54400a){return function(_0x2a08ba){if(_0x2a08ba){return _0x2a08ba['update'](_0x2f70ac)['then'](function(_0x30f6b3){return _0x30f6b3;});}return null;};}function removeEntity(_0x3a9bed,_0x25b24b){return function(_0x36d254){if(_0x36d254){return _0x36d254['destroy']()[_0x1126('0x22')](function(){_0x3a9bed[_0x1126('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(!_0x529dd9){_0x2175fa['sendStatus'](0x194);}return _0x529dd9;};}function handleError(_0x2199d9,_0x15bcc3){_0x15bcc3=_0x15bcc3||0x1f4;return function(_0x329914){logger[_0x1126('0x23')](_0x329914[_0x1126('0x24')]);if(_0x329914[_0x1126('0x25')]){delete _0x329914[_0x1126('0x25')];}_0x2199d9[_0x1126('0x18')](_0x15bcc3)['send'](_0x329914);};}exports[_0x1126('0x26')]=function(_0x375e59,_0xa293f4){var _0x5ddf63={},_0x541bc9={},_0xeb7d89={'count':0x0,'rows':[]};var _0x39bf0e=_['map'](db[_0x1126('0x27')][_0x1126('0x28')],function(_0x4a334a){return{'name':_0x4a334a[_0x1126('0x29')],'type':_0x4a334a['type'][_0x1126('0x2a')]};});_0x541bc9['model']=_[_0x1126('0x2b')](_0x39bf0e,'name');_0x541bc9[_0x1126('0x2c')]=_['keys'](_0x375e59['query']);_0x541bc9['filters']=_[_0x1126('0x2d')](_0x541bc9[_0x1126('0x2e')],_0x541bc9[_0x1126('0x2c')]);_0x5ddf63['attributes']=_[_0x1126('0x2d')](_0x541bc9[_0x1126('0x2e')],qs['fields'](_0x375e59[_0x1126('0x2c')][_0x1126('0x2f')]));_0x5ddf63[_0x1126('0x30')]=_0x5ddf63[_0x1126('0x30')]['length']?_0x5ddf63['attributes']:_0x541bc9[_0x1126('0x2e')];if(!_0x375e59[_0x1126('0x2c')][_0x1126('0x31')](_0x1126('0x32'))){_0x5ddf63['limit']=qs[_0x1126('0x1d')](_0x375e59[_0x1126('0x2c')][_0x1126('0x1d')]);_0x5ddf63[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x375e59['query'][_0x1126('0x1c')]);}_0x5ddf63[_0x1126('0x33')]=qs[_0x1126('0x34')](_0x375e59[_0x1126('0x2c')]['sort']);_0x5ddf63['where']=qs[_0x1126('0x35')](_[_0x1126('0x36')](_0x375e59['query'],_0x541bc9[_0x1126('0x35')]),_0x39bf0e);if(_0x375e59[_0x1126('0x2c')][_0x1126('0x37')]){_0x5ddf63['where']=_['merge'](_0x5ddf63[_0x1126('0x38')],{'$or':_[_0x1126('0x2b')](_0x39bf0e,function(_0x3aa08f){if(_0x3aa08f[_0x1126('0x39')]!=='VIRTUAL'){var _0x428d3d={};_0x428d3d[_0x3aa08f['name']]={'$like':'%'+_0x375e59[_0x1126('0x2c')][_0x1126('0x37')]+'%'};return _0x428d3d;}})});}_0x5ddf63=_[_0x1126('0x3a')]({},_0x5ddf63,_0x375e59[_0x1126('0x3b')]);var _0x57e5d2={'where':_0x5ddf63['where']};return db[_0x1126('0x27')][_0x1126('0x1b')](_0x57e5d2)[_0x1126('0x22')](function(_0x397e3b){_0xeb7d89[_0x1126('0x1b')]=_0x397e3b;if(_0x375e59[_0x1126('0x2c')][_0x1126('0x3c')]){_0x5ddf63['include']=[{'all':!![]}];}return db[_0x1126('0x27')][_0x1126('0x3d')](_0x5ddf63);})[_0x1126('0x22')](function(_0xf3a0bd){_0xeb7d89[_0x1126('0x3e')]=_0xf3a0bd;return _0xeb7d89;})['then'](respondWithFilteredResult(_0xa293f4,_0x5ddf63))['catch'](handleError(_0xa293f4,null));};exports[_0x1126('0x3f')]=function(_0x219bcc,_0xcee9de){var _0x21c38e={'raw':!![],'where':{'id':_0x219bcc[_0x1126('0x40')]['id']}},_0x18b496={};_0x18b496['model']=_['keys'](db['FaxApplication'][_0x1126('0x28')]);_0x18b496['query']=_[_0x1126('0x41')](_0x219bcc[_0x1126('0x2c')]);_0x18b496[_0x1126('0x35')]=_[_0x1126('0x2d')](_0x18b496['model'],_0x18b496['query']);_0x21c38e[_0x1126('0x30')]=_[_0x1126('0x2d')](_0x18b496[_0x1126('0x2e')],qs['fields'](_0x219bcc[_0x1126('0x2c')]['fields']));_0x21c38e[_0x1126('0x30')]=_0x21c38e['attributes'][_0x1126('0x42')]?_0x21c38e[_0x1126('0x30')]:_0x18b496[_0x1126('0x2e')];if(_0x219bcc['query'][_0x1126('0x3c')]){_0x21c38e[_0x1126('0x43')]=[{'all':!![]}];}_0x21c38e=_[_0x1126('0x3a')]({},_0x21c38e,_0x219bcc['options']);return db['FaxApplication']['find'](_0x21c38e)[_0x1126('0x22')](handleEntityNotFound(_0xcee9de,null))['then'](respondWithResult(_0xcee9de,null))[_0x1126('0x44')](handleError(_0xcee9de,null));};exports['create']=function(_0x2f45b9,_0x323499){return db[_0x1126('0x27')][_0x1126('0x45')](_0x2f45b9[_0x1126('0x46')],{})['then'](respondWithResult(_0x323499,0xc9))[_0x1126('0x44')](handleError(_0x323499,null));};exports[_0x1126('0x47')]=function(_0x5111d3,_0x1a15f8){if(_0x5111d3[_0x1126('0x46')]['id']){delete _0x5111d3['body']['id'];}return db[_0x1126('0x27')][_0x1126('0x48')]({'where':{'id':_0x5111d3['params']['id']}})[_0x1126('0x22')](handleEntityNotFound(_0x1a15f8,null))[_0x1126('0x22')](saveUpdates(_0x5111d3[_0x1126('0x46')],null))['then'](respondWithResult(_0x1a15f8,null))[_0x1126('0x44')](handleError(_0x1a15f8,null));};exports[_0x1126('0x49')]=function(_0x411c89,_0x5878bb){return db[_0x1126('0x27')][_0x1126('0x48')]({'where':{'id':_0x411c89[_0x1126('0x40')]['id']}})[_0x1126('0x22')](handleEntityNotFound(_0x5878bb,null))['then'](removeEntity(_0x5878bb,null))[_0x1126('0x44')](handleError(_0x5878bb,null));}; \ No newline at end of file +var _0xabce=['offset','limit','status','set','Content-Range','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','keys','options','FaxApplication','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xabce,0x103));var _0xeabc=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xabce[_0x110c3d];return _0x226d67;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var db=require(_0xeabc('0x18'))['db'];function respondWithStatusCode(_0x435ea7,_0x3fd0b5){_0x3fd0b5=_0x3fd0b5||0xcc;return function(_0x36a92e){if(_0x36a92e){return _0x435ea7[_0xeabc('0x19')](_0x3fd0b5);}return _0x435ea7['status'](_0x3fd0b5)[_0xeabc('0x1a')]();};}function respondWithResult(_0x1319f3,_0x3251c6){_0x3251c6=_0x3251c6||0xc8;return function(_0x55f0de){if(_0x55f0de){return _0x1319f3['status'](_0x3251c6)[_0xeabc('0x1b')](_0x55f0de);}};}function respondWithFilteredResult(_0x3ae954,_0x326bac){return function(_0x53d5cb){if(_0x53d5cb){var _0xf913d7=_0x53d5cb[_0xeabc('0x1c')],_0x638976=_0x326bac['offset'],_0x49f2d8=_0x326bac[_0xeabc('0x1d')]+_0x326bac[_0xeabc('0x1e')],_0x53fe28;if(_0x49f2d8>=_0xf913d7){_0x49f2d8=_0xf913d7;_0x53fe28=0xc8;}else{_0x53fe28=0xce;}_0x3ae954[_0xeabc('0x1f')](_0x53fe28);return _0x3ae954[_0xeabc('0x20')](_0xeabc('0x21'),_0x638976+'-'+_0x49f2d8+'/'+_0xf913d7)[_0xeabc('0x1b')](_0x53d5cb);}return null;};}function patchUpdates(_0x384be5){return function(_0x5e30ee){try{jsonpatch['apply'](_0x5e30ee,_0x384be5,!![]);}catch(_0x1253e4){return BPromise['reject'](_0x1253e4);}return _0x5e30ee[_0xeabc('0x22')]();};}function saveUpdates(_0x16530c,_0x502947){return function(_0x28063a){if(_0x28063a){return _0x28063a[_0xeabc('0x23')](_0x16530c)[_0xeabc('0x24')](function(_0x184e60){return _0x184e60;});}return null;};}function removeEntity(_0x3c9611,_0x4e99a4){return function(_0xecdbf){if(_0xecdbf){return _0xecdbf[_0xeabc('0x25')]()[_0xeabc('0x24')](function(){_0x3c9611['status'](0xcc)[_0xeabc('0x1a')]();});}};}function handleEntityNotFound(_0x3854d2,_0x214953){return function(_0x319119){if(!_0x319119){_0x3854d2['sendStatus'](0x194);}return _0x319119;};}function handleError(_0x109e1d,_0x480440){_0x480440=_0x480440||0x1f4;return function(_0x27dbaf){logger['error'](_0x27dbaf[_0xeabc('0x26')]);if(_0x27dbaf[_0xeabc('0x27')]){delete _0x27dbaf[_0xeabc('0x27')];}_0x109e1d[_0xeabc('0x1f')](_0x480440)[_0xeabc('0x28')](_0x27dbaf);};}exports[_0xeabc('0x29')]=function(_0x131722,_0x4c2693){var _0x5b2934={},_0x459c8a={},_0x5bf8f2={'count':0x0,'rows':[]};var _0x3c1b5b=_[_0xeabc('0x2a')](db['FaxApplication'][_0xeabc('0x2b')],function(_0x38572d){return{'name':_0x38572d[_0xeabc('0x2c')],'type':_0x38572d[_0xeabc('0x2d')][_0xeabc('0x2e')]};});_0x459c8a[_0xeabc('0x2f')]=_[_0xeabc('0x2a')](_0x3c1b5b,_0xeabc('0x27'));_0x459c8a[_0xeabc('0x30')]=_['keys'](_0x131722[_0xeabc('0x30')]);_0x459c8a['filters']=_[_0xeabc('0x31')](_0x459c8a[_0xeabc('0x2f')],_0x459c8a[_0xeabc('0x30')]);_0x5b2934[_0xeabc('0x32')]=_[_0xeabc('0x31')](_0x459c8a[_0xeabc('0x2f')],qs[_0xeabc('0x33')](_0x131722['query'][_0xeabc('0x33')]));_0x5b2934[_0xeabc('0x32')]=_0x5b2934[_0xeabc('0x32')]['length']?_0x5b2934[_0xeabc('0x32')]:_0x459c8a[_0xeabc('0x2f')];if(!_0x131722[_0xeabc('0x30')]['hasOwnProperty'](_0xeabc('0x34'))){_0x5b2934[_0xeabc('0x1e')]=qs[_0xeabc('0x1e')](_0x131722['query'][_0xeabc('0x1e')]);_0x5b2934[_0xeabc('0x1d')]=qs['offset'](_0x131722['query'][_0xeabc('0x1d')]);}_0x5b2934[_0xeabc('0x35')]=qs['sort'](_0x131722[_0xeabc('0x30')][_0xeabc('0x36')]);_0x5b2934[_0xeabc('0x37')]=qs[_0xeabc('0x38')](_[_0xeabc('0x39')](_0x131722['query'],_0x459c8a[_0xeabc('0x38')]),_0x3c1b5b);if(_0x131722['query'][_0xeabc('0x3a')]){_0x5b2934[_0xeabc('0x37')]=_[_0xeabc('0x3b')](_0x5b2934['where'],{'$or':_['map'](_0x3c1b5b,function(_0x452580){if(_0x452580['type']!==_0xeabc('0x3c')){var _0x4ebd64={};_0x4ebd64[_0x452580['name']]={'$like':'%'+_0x131722['query']['filter']+'%'};return _0x4ebd64;}})});}_0x5b2934=_[_0xeabc('0x3b')]({},_0x5b2934,_0x131722['options']);var _0x257fe8={'where':_0x5b2934[_0xeabc('0x37')]};return db['FaxApplication'][_0xeabc('0x1c')](_0x257fe8)['then'](function(_0x3d48f4){_0x5bf8f2['count']=_0x3d48f4;if(_0x131722[_0xeabc('0x30')][_0xeabc('0x3d')]){_0x5b2934[_0xeabc('0x3e')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x5b2934);})['then'](function(_0x46056c){_0x5bf8f2[_0xeabc('0x3f')]=_0x46056c;return _0x5bf8f2;})[_0xeabc('0x24')](respondWithFilteredResult(_0x4c2693,_0x5b2934))['catch'](handleError(_0x4c2693,null));};exports['show']=function(_0x5cd62e,_0x1680e8){var _0x5e9cb3={'raw':!![],'where':{'id':_0x5cd62e['params']['id']}},_0xc6af4d={};_0xc6af4d[_0xeabc('0x2f')]=_['keys'](db['FaxApplication']['rawAttributes']);_0xc6af4d[_0xeabc('0x30')]=_[_0xeabc('0x40')](_0x5cd62e[_0xeabc('0x30')]);_0xc6af4d[_0xeabc('0x38')]=_['intersection'](_0xc6af4d[_0xeabc('0x2f')],_0xc6af4d['query']);_0x5e9cb3[_0xeabc('0x32')]=_[_0xeabc('0x31')](_0xc6af4d[_0xeabc('0x2f')],qs[_0xeabc('0x33')](_0x5cd62e[_0xeabc('0x30')]['fields']));_0x5e9cb3['attributes']=_0x5e9cb3[_0xeabc('0x32')]['length']?_0x5e9cb3[_0xeabc('0x32')]:_0xc6af4d[_0xeabc('0x2f')];if(_0x5cd62e['query'][_0xeabc('0x3d')]){_0x5e9cb3[_0xeabc('0x3e')]=[{'all':!![]}];}_0x5e9cb3=_[_0xeabc('0x3b')]({},_0x5e9cb3,_0x5cd62e[_0xeabc('0x41')]);return db[_0xeabc('0x42')][_0xeabc('0x43')](_0x5e9cb3)[_0xeabc('0x24')](handleEntityNotFound(_0x1680e8,null))['then'](respondWithResult(_0x1680e8,null))[_0xeabc('0x44')](handleError(_0x1680e8,null));};exports[_0xeabc('0x45')]=function(_0x2e7a5e,_0x1b41c8){return db[_0xeabc('0x42')][_0xeabc('0x45')](_0x2e7a5e[_0xeabc('0x46')],{})[_0xeabc('0x24')](respondWithResult(_0x1b41c8,0xc9))[_0xeabc('0x44')](handleError(_0x1b41c8,null));};exports[_0xeabc('0x23')]=function(_0x5689fc,_0x38356c){if(_0x5689fc[_0xeabc('0x46')]['id']){delete _0x5689fc[_0xeabc('0x46')]['id'];}return db[_0xeabc('0x42')][_0xeabc('0x43')]({'where':{'id':_0x5689fc[_0xeabc('0x47')]['id']}})[_0xeabc('0x24')](handleEntityNotFound(_0x38356c,null))['then'](saveUpdates(_0x5689fc[_0xeabc('0x46')],null))[_0xeabc('0x24')](respondWithResult(_0x38356c,null))[_0xeabc('0x44')](handleError(_0x38356c,null));};exports[_0xeabc('0x25')]=function(_0x47440e,_0x58e2c1){return db[_0xeabc('0x42')][_0xeabc('0x43')]({'where':{'id':_0x47440e[_0xeabc('0x47')]['id']}})[_0xeabc('0x24')](handleEntityNotFound(_0x58e2c1,null))['then'](removeEntity(_0x58e2c1,null))[_0xeabc('0x44')](handleError(_0x58e2c1,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 5aab3fe..d33cc46 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 _0xff9b=['fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','path','./faxApplication.attributes','exports','FaxApplication'];(function(_0x4895ee,_0x46e14c){var _0x5e9e26=function(_0x16a8fc){while(--_0x16a8fc){_0x4895ee['push'](_0x4895ee['shift']());}};_0x5e9e26(++_0x46e14c);}(_0xff9b,0x67));var _0xbff9=function(_0x19416d,_0x54c85e){_0x19416d=_0x19416d-0x0;var _0x17528f=_0xff9b[_0x19416d];return _0x17528f;};'use strict';var _=require(_0xbff9('0x0'));var util=require('util');var logger=require(_0xbff9('0x1'))(_0xbff9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbff9('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbff9('0x4'));module[_0xbff9('0x5')]=function(_0x8dd93a,_0x5cd450){return _0x8dd93a['define'](_0xbff9('0x6'),attributes,{'tableName':_0xbff9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbff9('0x8'),'collate':_0xbff9('0x9')});}; \ No newline at end of file +var _0x9f15=['moment','bluebird','path','rimraf','../../config/environment','exports','FaxApplication','fax_applications','utf8mb4','util','../../config/logger'];(function(_0x204e43,_0x59a350){var _0x3888d2=function(_0x247208){while(--_0x247208){_0x204e43['push'](_0x204e43['shift']());}};_0x3888d2(++_0x59a350);}(_0x9f15,0x17f));var _0x59f1=function(_0xb36ccf,_0x24c93b){_0xb36ccf=_0xb36ccf-0x0;var _0x37b01e=_0x9f15[_0xb36ccf];return _0x37b01e;};'use strict';var _=require('lodash');var util=require(_0x59f1('0x0'));var logger=require(_0x59f1('0x1'))('api');var moment=require(_0x59f1('0x2'));var BPromise=require(_0x59f1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x59f1('0x4'));var rimraf=require(_0x59f1('0x5'));var config=require(_0x59f1('0x6'));var attributes=require('./faxApplication.attributes');module[_0x59f1('0x7')]=function(_0x4eea85,_0x150eb1){return _0x4eea85['define'](_0x59f1('0x8'),attributes,{'tableName':_0x59f1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x59f1('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 4b76930..82165e3 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 _0xa37e=['info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','UpdateFaxApplication','FaxApplication','update','body','options','raw','limit','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x2b7d93,_0x5ce1f3){var _0xb4dc9c=function(_0x336e01){while(--_0x336e01){_0x2b7d93['push'](_0x2b7d93['shift']());}};_0xb4dc9c(++_0x5ce1f3);}(_0xa37e,0x13d));var _0xea37=function(_0x4d3980,_0x13c17f){_0x4d3980=_0x4d3980-0x0;var _0x4aee7b=_0xa37e[_0x4d3980];return _0x4aee7b;};'use strict';var _=require(_0xea37('0x0'));var util=require(_0xea37('0x1'));var moment=require(_0xea37('0x2'));var BPromise=require('bluebird');var rs=require(_0xea37('0x3'));var fs=require('fs');var Redis=require(_0xea37('0x4'));var db=require(_0xea37('0x5'))['db'];var utils=require(_0xea37('0x6'));var logger=require(_0xea37('0x7'))('rpc');var config=require(_0xea37('0x8'));var jayson=require(_0xea37('0x9'));var client=jayson[_0xea37('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4040c5,_0x375007,_0x45cb9f){return new BPromise(function(_0x1b56c4,_0x2eb64b){return client[_0xea37('0xb')](_0x4040c5,_0x45cb9f)[_0xea37('0xc')](function(_0x26b01c){logger[_0xea37('0xd')](_0xea37('0xe'),_0x375007,_0xea37('0xf'));logger[_0xea37('0x10')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x375007,_0xea37('0xf'),JSON['stringify'](_0x26b01c));if(_0x26b01c[_0xea37('0x11')]){if(_0x26b01c[_0xea37('0x11')][_0xea37('0x12')]===0x1f4){logger['error'](_0xea37('0xe'),_0x375007,_0x26b01c[_0xea37('0x11')][_0xea37('0x13')]);return _0x2eb64b(_0x26b01c[_0xea37('0x11')][_0xea37('0x13')]);}logger['error'](_0xea37('0xe'),_0x375007,_0x26b01c['error'][_0xea37('0x13')]);return _0x1b56c4(_0x26b01c[_0xea37('0x11')][_0xea37('0x13')]);}else{logger[_0xea37('0xd')](_0xea37('0xe'),_0x375007,_0xea37('0xf'));_0x1b56c4(_0x26b01c[_0xea37('0x14')][_0xea37('0x13')]);}})['catch'](function(_0x287e0e){logger[_0xea37('0x11')](_0xea37('0xe'),_0x375007,_0x287e0e);_0x2eb64b(_0x287e0e);});});}exports[_0xea37('0x15')]=function(_0x7a86ca){var _0xd8563=this;return new Promise(function(_0x2fe270,_0x2ed14b){return db[_0xea37('0x16')][_0xea37('0x17')](_0x7a86ca[_0xea37('0x18')],{'raw':_0x7a86ca[_0xea37('0x19')]?_0x7a86ca[_0xea37('0x19')][_0xea37('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7a86ca[_0xea37('0x19')]?_0x7a86ca[_0xea37('0x19')]['where']||null:null,'attributes':_0x7a86ca[_0xea37('0x19')]?_0x7a86ca[_0xea37('0x19')]['attributes']||null:null,'limit':_0x7a86ca['options']?_0x7a86ca[_0xea37('0x19')][_0xea37('0x1b')]||null:null})['then'](function(_0x52e4e){logger[_0xea37('0xd')]('UpdateFaxApplication',_0x7a86ca);logger[_0xea37('0x10')](_0xea37('0x15'),_0x7a86ca,JSON[_0xea37('0x1c')](_0x52e4e));_0x2fe270(_0x52e4e);})[_0xea37('0x1d')](function(_0x216039){logger[_0xea37('0x11')](_0xea37('0x15'),_0x216039[_0xea37('0x13')],_0x7a86ca);_0x2ed14b(_0xd8563['error'](0x1f4,_0x216039[_0xea37('0x13')]));});});}; \ No newline at end of file +var _0x3117=['update','body','options','where','attributes','limit','UpdateFaxApplication','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','FaxApplication'];(function(_0x2170fd,_0x29808a){var _0x3a16ec=function(_0x331c2c){while(--_0x331c2c){_0x2170fd['push'](_0x2170fd['shift']());}};_0x3a16ec(++_0x29808a);}(_0x3117,0x6d));var _0x7311=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0x3117[_0x31a938];return _0x1bf341;};'use strict';var _=require(_0x7311('0x0'));var util=require(_0x7311('0x1'));var moment=require(_0x7311('0x2'));var BPromise=require(_0x7311('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7311('0x4'));var db=require(_0x7311('0x5'))['db'];var utils=require(_0x7311('0x6'));var logger=require(_0x7311('0x7'))(_0x7311('0x8'));var config=require(_0x7311('0x9'));var jayson=require(_0x7311('0xa'));var client=jayson[_0x7311('0xb')][_0x7311('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x524f14,_0x5a6dc9,_0x478e44){return new BPromise(function(_0x1e2e57,_0x1cde7a){return client[_0x7311('0xd')](_0x524f14,_0x478e44)[_0x7311('0xe')](function(_0x346918){logger[_0x7311('0xf')]('FaxApplication,\x20%s,\x20%s',_0x5a6dc9,_0x7311('0x10'));logger[_0x7311('0x11')](_0x7311('0x12'),_0x5a6dc9,_0x7311('0x10'),JSON[_0x7311('0x13')](_0x346918));if(_0x346918[_0x7311('0x14')]){if(_0x346918['error'][_0x7311('0x15')]===0x1f4){logger[_0x7311('0x14')](_0x7311('0x16'),_0x5a6dc9,_0x346918['error']['message']);return _0x1cde7a(_0x346918['error'][_0x7311('0x17')]);}logger['error'](_0x7311('0x16'),_0x5a6dc9,_0x346918['error'][_0x7311('0x17')]);return _0x1e2e57(_0x346918[_0x7311('0x14')]['message']);}else{logger[_0x7311('0xf')](_0x7311('0x16'),_0x5a6dc9,_0x7311('0x10'));_0x1e2e57(_0x346918[_0x7311('0x18')]['message']);}})[_0x7311('0x19')](function(_0x6df484){logger['error'](_0x7311('0x16'),_0x5a6dc9,_0x6df484);_0x1cde7a(_0x6df484);});});}exports['UpdateFaxApplication']=function(_0xa67536){var _0x2b17d1=this;return new Promise(function(_0x580c3a,_0x13014f){return db[_0x7311('0x1a')][_0x7311('0x1b')](_0xa67536[_0x7311('0x1c')],{'raw':_0xa67536[_0x7311('0x1d')]?_0xa67536[_0x7311('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa67536[_0x7311('0x1d')]?_0xa67536[_0x7311('0x1d')][_0x7311('0x1e')]||null:null,'attributes':_0xa67536[_0x7311('0x1d')]?_0xa67536['options'][_0x7311('0x1f')]||null:null,'limit':_0xa67536[_0x7311('0x1d')]?_0xa67536[_0x7311('0x1d')][_0x7311('0x20')]||null:null})[_0x7311('0xe')](function(_0x3cb465){logger[_0x7311('0xf')]('UpdateFaxApplication',_0xa67536);logger[_0x7311('0x11')](_0x7311('0x21'),_0xa67536,JSON['stringify'](_0x3cb465));_0x580c3a(_0x3cb465);})[_0x7311('0x19')](function(_0x2fef1f){logger[_0x7311('0x14')](_0x7311('0x21'),_0x2fef1f[_0x7311('0x17')],_0xa67536);_0x13014f(_0x2b17d1[_0x7311('0x14')](0x1f4,_0x2fef1f['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index eebdcf7..e1e19ab 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 _0x6aa7=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','path'];(function(_0x43fb85,_0x380a61){var _0x46e84b=function(_0x5b32c9){while(--_0x5b32c9){_0x43fb85['push'](_0x43fb85['shift']());}};_0x46e84b(++_0x380a61);}(_0x6aa7,0x178));var _0x76aa=function(_0x3c6009,_0x4a1c43){_0x3c6009=_0x3c6009-0x0;var _0x3ff494=_0x6aa7[_0x3c6009];return _0x3ff494;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x76aa('0x5'));var config=require(_0x76aa('0x6'));var controller=require(_0x76aa('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x76aa('0x8')]);router['get'](_0x76aa('0x9'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xb')]);router['post']('/',auth[_0x76aa('0xa')](),controller[_0x76aa('0xc')]);router[_0x76aa('0xd')]('/:id',auth[_0x76aa('0xa')](),controller[_0x76aa('0xe')]);router[_0x76aa('0xf')](_0x76aa('0x9'),auth[_0x76aa('0xa')](),controller[_0x76aa('0x10')]);module[_0x76aa('0x11')]=router; \ No newline at end of file +var _0x33c5=['destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x57ab29,_0x32ed52){var _0x4b1b4a=function(_0xd4b7cd){while(--_0xd4b7cd){_0x57ab29['push'](_0x57ab29['shift']());}};_0x4b1b4a(++_0x32ed52);}(_0x33c5,0xe6));var _0x533c=function(_0x364a36,_0x1e2677){_0x364a36=_0x364a36-0x0;var _0x5cd6fa=_0x33c5[_0x364a36];return _0x5cd6fa;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var auth=require(_0x533c('0x4'));var interaction=require(_0x533c('0x5'));var config=require(_0x533c('0x6'));var controller=require('./faxApplication.controller');router[_0x533c('0x7')]('/',auth[_0x533c('0x8')](),controller[_0x533c('0x9')]);router[_0x533c('0x7')](_0x533c('0xa'),auth[_0x533c('0x8')](),controller[_0x533c('0xb')]);router[_0x533c('0xc')]('/',auth[_0x533c('0x8')](),controller[_0x533c('0xd')]);router[_0x533c('0xe')](_0x533c('0xa'),auth[_0x533c('0x8')](),controller[_0x533c('0xf')]);router[_0x533c('0x10')](_0x533c('0xa'),auth['isAuthenticated'](),controller[_0x533c('0x11')]);module[_0x533c('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 5094022..d7f4ba3 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 _0xdb0a=['out','sequelize','exports','DATE','STRING','ENUM'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xdb0a,0x1bd));var _0xadb0=function(_0x3b9df1,_0xcb6d35){_0x3b9df1=_0x3b9df1-0x0;var _0x3c3575=_0xdb0a[_0x3b9df1];return _0x3c3575;};'use strict';var Sequelize=require(_0xadb0('0x0'));module[_0xadb0('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xadb0('0x2')]},'disposition':{'type':Sequelize[_0xadb0('0x3')]},'note':{'type':Sequelize[_0xadb0('0x3')]},'read1stAt':{'type':Sequelize[_0xadb0('0x2')]},'fax':{'type':Sequelize[_0xadb0('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xadb0('0x4')]('in',_0xadb0('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xadb0('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xadb0('0x4')]('in',_0xadb0('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xe6da=['DATE','STRING','out','ENUM','sequelize','exports','BOOLEAN'];(function(_0x2193ad,_0x5d8a36){var _0x2c5354=function(_0x397fa7){while(--_0x397fa7){_0x2193ad['push'](_0x2193ad['shift']());}};_0x2c5354(++_0x5d8a36);}(_0xe6da,0x1ee));var _0xae6d=function(_0x535358,_0x3b9b04){_0x535358=_0x535358-0x0;var _0x50261c=_0xe6da[_0x535358];return _0x50261c;};'use strict';var Sequelize=require(_0xae6d('0x0'));module[_0xae6d('0x1')]={'closed':{'type':Sequelize[_0xae6d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xae6d('0x3')]},'disposition':{'type':Sequelize[_0xae6d('0x4')]},'note':{'type':Sequelize[_0xae6d('0x4')]},'read1stAt':{'type':Sequelize[_0xae6d('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xae6d('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xae6d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xae6d('0x6')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 1fbf33b..305b478 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 _0x902b=['buildExpression','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','count','merge','a.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','push','all','show','params','includeAll','create','body','describe','addMessage','FaxMessage','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','setTags','omit','download','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','fullname','Tags','TagIds','split','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','operator','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?'];(function(_0x471448,_0x1c0e9e){var _0x38190b=function(_0x41dd2f){while(--_0x41dd2f){_0x471448['push'](_0x471448['shift']());}};_0x38190b(++_0x1c0e9e);}(_0x902b,0x6a));var _0xb902=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x902b[_0x5f3f88];return _0xd08119;};'use strict';var pdf=require(_0xb902('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb902('0x1'));var zipdir=require(_0xb902('0x2'));var jsonpatch=require(_0xb902('0x3'));var rp=require(_0xb902('0x4'));var moment=require(_0xb902('0x5'));var BPromise=require(_0xb902('0x6'));var Mustache=require('mustache');var util=require(_0xb902('0x7'));var path=require('path');var sox=require(_0xb902('0x8'));var csv=require('to-csv');var ejs=require(_0xb902('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb902('0xa'));var querystring=require(_0xb902('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb902('0xc'));var qs=require(_0xb902('0xd'));var as=require(_0xb902('0xe'));var hardwareService=require(_0xb902('0xf'));var logger=require(_0xb902('0x10'))(_0xb902('0x11'));var utils=require(_0xb902('0x12'));var config=require(_0xb902('0x13'));var db=require('../../mysqldb')['db'];config[_0xb902('0x14')]=_[_0xb902('0x15')](config[_0xb902('0x14')],{'host':_0xb902('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb902('0x17'))[_0xb902('0x18')](socket);function respondWithStatusCode(_0x5be74d,_0x69cdd0){_0x69cdd0=_0x69cdd0||0xcc;return function(_0x1f5eea){if(_0x1f5eea){return _0x5be74d[_0xb902('0x19')](_0x69cdd0);}return _0x5be74d[_0xb902('0x1a')](_0x69cdd0)[_0xb902('0x1b')]();};}function respondWithResult(_0x400ee9,_0x5d2e45){_0x5d2e45=_0x5d2e45||0xc8;return function(_0x359244){if(_0x359244){return _0x400ee9[_0xb902('0x1a')](_0x5d2e45)[_0xb902('0x1c')](_0x359244);}};}function respondWithFilteredResult(_0x218353,_0x14d496){return function(_0x5753cd){if(_0x5753cd){var _0x10bd3a=_0x5753cd['count'],_0x15fda2=_0x14d496[_0xb902('0x1d')],_0x271218=_0x14d496['offset']+_0x14d496[_0xb902('0x1e')],_0x22e859;if(_0x271218>=_0x10bd3a){_0x271218=_0x10bd3a;_0x22e859=0xc8;}else{_0x22e859=0xce;}_0x218353[_0xb902('0x1a')](_0x22e859);return _0x218353[_0xb902('0x1f')]('Content-Range',_0x15fda2+'-'+_0x271218+'/'+_0x10bd3a)['json'](_0x5753cd);}return null;};}function patchUpdates(_0x433a92){return function(_0x2727d2){try{jsonpatch[_0xb902('0x20')](_0x2727d2,_0x433a92,!![]);}catch(_0x5ca580){return BPromise[_0xb902('0x21')](_0x5ca580);}return _0x2727d2[_0xb902('0x22')]();};}function saveUpdates(_0x67720d,_0x332fa5){return function(_0x41d245){if(_0x41d245){return _0x41d245[_0xb902('0x23')](_0x67720d)[_0xb902('0x24')](function(_0x3243a2){return _0x3243a2;});}return null;};}function removeEntity(_0xcd806b,_0x43ab79){return function(_0x4d0b76){if(_0x4d0b76){return _0x4d0b76[_0xb902('0x25')]()[_0xb902('0x24')](function(){_0xcd806b[_0xb902('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39fe80,_0x5cc191){return function(_0x3ae3e5){if(!_0x3ae3e5){_0x39fe80[_0xb902('0x19')](0x194);}return _0x3ae3e5;};}function handleError(_0x5a7e71,_0x447e06){_0x447e06=_0x447e06||0x1f4;return function(_0x10e2a4){logger[_0xb902('0x26')](_0x10e2a4[_0xb902('0x27')]);if(_0x10e2a4['name']){delete _0x10e2a4[_0xb902('0x28')];}_0x5a7e71[_0xb902('0x1a')](_0x447e06)[_0xb902('0x29')](_0x10e2a4);};}function getInteractionUsers(_0x54bcbd,_0x86e3ab){return new BPromise(function(_0x133786,_0xdb81){try{if(_0x86e3ab[_0x54bcbd['id']]){_0x54bcbd['Users']=_['map'](_0x86e3ab[_0x54bcbd['id']],function(_0x378772){return{'id':_0x378772['id'],'fullname':_0x378772[_0xb902('0x2a')]};});}}catch(_0x33995f){_0xdb81(_0x33995f);}_0x133786(_0x54bcbd);});}function getInteractionTags(_0x2d9352,_0x39e4af){return new BPromise(function(_0x3ce95c,_0x7e0375){try{if(_0x2d9352['TagIds']){_0x2d9352[_0xb902('0x2b')]=[];_0x2d9352[_0xb902('0x2c')][_0xb902('0x2d')](',')['forEach'](function(_0x9b17ef){_0x2d9352[_0xb902('0x2b')]['push'](_0x39e4af[_0x9b17ef]);});}delete _0x2d9352[_0xb902('0x2c')];}catch(_0x2dcf80){_0x7e0375(_0x2dcf80);}_0x3ce95c(_0x2d9352);});}function updateFaxInteraction(_0x108d48,_0x9c8016,_0x5c52ee){return new BPromise(function(_0x25c9a1,_0x554f0b){return getInteractionUsers(_0x108d48,_0x5c52ee)['then'](function(_0x3d3b21){return getInteractionTags(_0x3d3b21,_0x9c8016);})[_0xb902('0x24')](function(_0x44a3bc){_0x25c9a1(_0x44a3bc);})[_0xb902('0x2e')](function(_0x4a1884){_0x554f0b(_0x4a1884);});});}exports[_0xb902('0x2f')]=function(_0x531901,_0x790cce){var _0x22311e={},_0x5dbb44={},_0x35218c={'count':0x0,'rows':[]};var _0x377994=_['map'](db[_0xb902('0x30')][_0xb902('0x31')],function(_0x25d771){return{'name':_0x25d771[_0xb902('0x32')],'type':_0x25d771[_0xb902('0x33')][_0xb902('0x34')]};});_0x5dbb44[_0xb902('0x35')]=_[_0xb902('0x36')](_0x377994,'name');_0x5dbb44['query']=_[_0xb902('0x37')](_0x531901[_0xb902('0x38')]);_0x5dbb44[_0xb902('0x39')]=_[_0xb902('0x3a')](_0x5dbb44[_0xb902('0x35')],_0x5dbb44[_0xb902('0x38')]);_0x22311e[_0xb902('0x3b')]=_[_0xb902('0x3a')](_0x5dbb44[_0xb902('0x35')],qs[_0xb902('0x3c')](_0x531901[_0xb902('0x38')][_0xb902('0x3c')]));_0x22311e[_0xb902('0x3b')]=_0x22311e[_0xb902('0x3b')][_0xb902('0x3d')]?_0x22311e[_0xb902('0x3b')]:_0x5dbb44['model'];if(!_0x531901[_0xb902('0x38')][_0xb902('0x3e')](_0xb902('0x3f'))){_0x22311e[_0xb902('0x1e')]=qs[_0xb902('0x1e')](_0x531901['query']['limit']);_0x22311e['offset']=qs['offset'](_0x531901[_0xb902('0x38')][_0xb902('0x1d')]);}_0x22311e[_0xb902('0x40')]=qs[_0xb902('0x41')](_0x531901[_0xb902('0x38')][_0xb902('0x41')]);_0x22311e[_0xb902('0x42')]=qs['filters'](_[_0xb902('0x43')](_0x531901['query'],_0x5dbb44['filters']),_0x377994);var _0x5775d1=[];var _0x37d9fe=squel[_0xb902('0x44')]()[_0xb902('0x45')]('id')['field'](_0xb902('0x28'))[_0xb902('0x45')](_0xb902('0x46'))['from'](_0xb902('0x47'));var _0x4d633a=squel[_0xb902('0x44')]()['field'](_0xb902('0x48'))[_0xb902('0x45')](_0xb902('0x49'))['field'](_0xb902('0x4a'))['from'](_0xb902('0x4b'),'ui')[_0xb902('0x4c')](_0xb902('0x4d'),'u',_0xb902('0x4e'));var _0x53ca08=squel['select']()[_0xb902('0x4f')](_0xb902('0x50'),'i')[_0xb902('0x4c')](_0xb902('0x51'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xb902('0x4c')]('users','o',_0xb902('0x52'))['left_join'](_0xb902('0x53'),'a',_0xb902('0x54'))[_0xb902('0x4c')](_0xb902('0x55'),'me',_0xb902('0x56'))[_0xb902('0x4c')](_0xb902('0x57'),'it',_0xb902('0x58'))[_0xb902('0x4c')](_0xb902('0x47'),'t',_0xb902('0x59'));var _0x904564=squel[_0xb902('0x5a')]();var _0x2fa767=[];var _0x42482d=squel['expr']();var _0x2ce170;if(_0x531901[_0xb902('0x38')][_0xb902('0x5b')]){_0x2ce170=as[_0xb902('0x5c')](_0x531901[_0xb902('0x38')]['search']);var _0x8accd9=_0x2ce170[_0xb902('0x5d')];for(var _0x4c5e41=0x0;_0x4c5e41<_0x2ce170[_0xb902('0x5e')]['length'];_0x4c5e41++){var _0x21539a=_0x2ce170[_0xb902('0x5e')][_0x4c5e41];var _0x312683='i';var _0x4d88d7=_[_0xb902('0x5f')](_0x377994,[_0xb902('0x28'),_0x21539a[_0xb902('0x45')]]);if(!_0x4d88d7){switch(_0x21539a[_0xb902('0x45')]){case _0xb902('0x60'):if(_0x21539a['value']==0x1){_0x53ca08[_0xb902('0x61')]('`'+_0x21539a[_0xb902('0x45')]+_0xb902('0x62'));}else{_0x53ca08[_0xb902('0x61')]('`'+_0x21539a[_0xb902('0x45')]+_0xb902('0x63'));}break;case'Contact':if(_0x21539a[_0xb902('0x64')]==='$substring'){if(_0x21539a['value'][_0xb902('0x2d')]('\x20')['length']>0x1){_0x904564[_0x8accd9]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb902('0x65')](_0x21539a[_0xb902('0x66')]),null);}else{var _0x4e7c22='%'+_0x21539a[_0xb902('0x66')]+'%';_0x904564[_0x8accd9](_0xb902('0x67'),_0x4e7c22,_0x4e7c22,_0x4e7c22);}}else{_0x4d88d7=_[_0xb902('0x5f')](_0x377994,[_0xb902('0x28'),'ContactId']);_0x21539a[_0xb902('0x45')]='ContactId';_0x13ce33=as[_0xb902('0x68')](_0x312683,_0x4d88d7['type'],_0x21539a);_0x904564[_0x8accd9](_0x13ce33['text'],_0x13ce33[_0xb902('0x66')][_0xb902('0x69')],_0x13ce33[_0xb902('0x66')]['end']);}break;case'Tag':var _0x376f8c=_0x21539a[_0xb902('0x66')][_0xb902('0x2d')](',')[_0xb902('0x36')](function(_0xef616e){return Number(_0xef616e);});_0x376f8c[_0xb902('0x6a')](function(_0x2d8462){_0x42482d['or'](_0xb902('0x6b'),'%,'+_0x2d8462+',%');});_0x2fa767=_[_0xb902('0x6c')](_0x2fa767,_0x376f8c);break;case'User':if(_0x21539a[_0xb902('0x64')]===_0xb902('0x6d')){_0x904564[_0x8accd9](_0xb902('0x6e'),'%'+_0x21539a[_0xb902('0x66')]+'%',null);}else{_0x4d88d7=_['find'](_0x377994,['name',_0xb902('0x6f')]);_0x21539a[_0xb902('0x45')]='UserId';_0x13ce33=as['buildExpression'](_0x312683,_0x4d88d7['type'],_0x21539a);_0x904564[_0x8accd9](_0x13ce33[_0xb902('0x70')],_0x13ce33['value'][_0xb902('0x69')],_0x13ce33[_0xb902('0x66')][_0xb902('0x1b')]);}break;case'body':_0x13ce33=as[_0xb902('0x68')]('me',null,_0x21539a);_0x904564[_0x8accd9](_0x13ce33[_0xb902('0x70')],_0x13ce33[_0xb902('0x66')][_0xb902('0x69')],_0x13ce33[_0xb902('0x66')][_0xb902('0x1b')]);break;}}else{var _0x13ce33=as[_0xb902('0x68')](_0x312683,_0x4d88d7[_0xb902('0x33')],_0x21539a);_0x904564[_0x8accd9](_0x13ce33[_0xb902('0x70')],_0x13ce33[_0xb902('0x66')][_0xb902('0x69')],_0x13ce33[_0xb902('0x66')][_0xb902('0x1b')]);}}}else{var _0x1a6646=_(_0x531901[_0xb902('0x38')])[_0xb902('0x37')]()[_0xb902('0x36')](function(_0x23bd68){return _[_0xb902('0x71')](_0x377994,['name',_0x23bd68])?_0x23bd68:undefined;})[_0xb902('0x72')]()['value']();if(!_[_0xb902('0x73')](_0x1a6646)){_0x1a6646[_0xb902('0x6a')](function(_0x5d7cb1){if(_0x5d7cb1===_0xb902('0x74')){_0x53ca08['where'](_0xb902('0x75'),[][_0xb902('0x76')](_0x531901['query'][_0x5d7cb1]));}else if(_0x5d7cb1===_0xb902('0x77')){var _0x29251f=JSON[_0xb902('0x78')](_0x531901[_0xb902('0x38')][_0x5d7cb1])[_0xb902('0x79')];var _0x4d2cbd=JSON[_0xb902('0x78')](_0x531901[_0xb902('0x38')][_0x5d7cb1])['$lte'];_0x53ca08[_0xb902('0x42')](_0xb902('0x7a'),_0x29251f,_0x4d2cbd);}else{if(_0x531901[_0xb902('0x38')][_0x5d7cb1]===_0xb902('0x7b')){_0x53ca08['where']('i.'+_0x5d7cb1+_0xb902('0x7c'));}else{_0x53ca08['where']('i.'+_0x5d7cb1+_0xb902('0x7d'),_0x531901[_0xb902('0x38')][_0x5d7cb1]);}}});}if(_0x531901[_0xb902('0x38')][_0xb902('0x7e')]){if(_0x531901[_0xb902('0x38')]['read']==0x1){_0x53ca08[_0xb902('0x61')]('`unreadMessages`\x20=\x200');}else{_0x53ca08[_0xb902('0x61')](_0xb902('0x7f'));}}if(_0x531901['query'][_0xb902('0x80')]){_0x2fa767=_['isArray'](_0x531901[_0xb902('0x38')][_0xb902('0x80')])?_0x531901[_0xb902('0x38')][_0xb902('0x80')]:new Array(_0x531901[_0xb902('0x38')][_0xb902('0x80')]);_0x2fa767[_0xb902('0x6a')](function(_0x3209b0){_0x42482d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3209b0+',%');});}if(_0x531901[_0xb902('0x38')]['filter']){var _0x1c566d=_0x531901[_0xb902('0x38')][_0xb902('0x81')][_0xb902('0x82')]('\x5c','\x5c\x5c')[_0xb902('0x82')]('\x27\x27','\x27\x27\x27\x27');if(qs['isNumeric'](_0x1c566d)){_0x904564['or']('i.id\x20LIKE\x20?',_0x1c566d+'%')['or'](_0xb902('0x83'),_0x1c566d+'%');}_0x904564['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1c566d+'%');}}_0x53ca08[_0xb902('0x42')](_0x904564);_0x53ca08[_0xb902('0x84')](_0xb902('0x85'));var _0x470c8b={'type':db[_0xb902('0x86')][_0xb902('0x87')][_0xb902('0x88')],'raw':!![]};var _0xb64f88=_0x53ca08['clone']();_0xb64f88[_0xb902('0x45')](_0xb902('0x85'));_0xb64f88[_0xb902('0x45')](_0xb902('0x89'),_0xb902('0x60'));if(_0x22311e[_0xb902('0x40')]){_0x22311e[_0xb902('0x40')]['forEach'](function(_0x547d9c){_0x53ca08[_0xb902('0x40')]('i.'+_0x547d9c[0x0],_0x547d9c[0x1]===_0xb902('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x2fa767)){_0x53ca08[_0xb902('0x61')](_0x42482d);_0xb64f88[_0xb902('0x42')](_0xb902('0x8b'),_0x2fa767);}BPromise[_0xb902('0x8c')]()[_0xb902('0x24')](function(){if(!_0x2ce170){if(_0x531901[_0xb902('0x38')][_0xb902('0x74')]||_0x531901[_0xb902('0x38')][_0xb902('0x8d')])return;_0xb64f88['where'](_0xb902('0x8e'));_0x53ca08['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}return _0x531901[_0xb902('0x8f')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xb902('0x24')](function(_0x460682){if(_[_0xb902('0x73')](_0x460682)){_0xb64f88[_0xb902('0x42')](_0xb902('0x90'));_0x53ca08[_0xb902('0x42')](_0xb902('0x90'));}else{_0xb64f88[_0xb902('0x42')](_0xb902('0x75'),_['map'](_0x460682,'id'));_0x53ca08[_0xb902('0x42')]('i.FaxAccountId\x20IN\x20?',_[_0xb902('0x36')](_0x460682,'id'));}});})[_0xb902('0x24')](function(){db[_0xb902('0x91')][_0xb902('0x38')](_0xb64f88[_0xb902('0x92')](),_0x470c8b)[_0xb902('0x24')](function(_0x381061){_0x35218c['count']=_0x381061[_0xb902('0x3d')];if(_0x35218c[_0xb902('0x93')]===0x0)return[];return db[_0xb902('0x91')][_0xb902('0x38')](_0x37d9fe[_0xb902('0x92')](),_0x470c8b)['then'](function(_0x500698){_0x5775d1=_['keyBy'](_0x500698,'id');_0x470c8b=_[_0xb902('0x94')](_0x470c8b,{'model':db[_0xb902('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x531901[_0xb902('0x38')][_0xb902('0x3c')]){_0x22311e[_0xb902('0x3b')][_0xb902('0x6a')](function(_0x429130){_0x53ca08[_0xb902('0x45')]('i.'+_0x429130);});}else{_0x53ca08['field'](_0xb902('0x89'),_0xb902('0x60'));_0x53ca08[_0xb902('0x45')](_0xb902('0x95'),'Account.key');_0x53ca08[_0xb902('0x45')](_0xb902('0x96'),'Account.mandatoryDisposition');_0x53ca08[_0xb902('0x45')](_0xb902('0x97'));_0x53ca08[_0xb902('0x45')](_0xb902('0x98'),_0xb902('0x99'));_0x53ca08[_0xb902('0x45')](_0xb902('0x9a'),'Contact.lastName');_0x53ca08['field'](_0xb902('0x9b'),_0xb902('0x9c'));_0x53ca08['field'](_0xb902('0x9d'),_0xb902('0x9e'));_0x53ca08[_0xb902('0x45')](_0xb902('0x9f'),_0xb902('0xa0'));_0x53ca08[_0xb902('0x45')](_0xb902('0xa1'),_0xb902('0xa2'));_0x53ca08[_0xb902('0x45')](_0xb902('0xa3'),_0xb902('0xa4'));_0x53ca08[_0xb902('0x45')](_0xb902('0xa5'),'Owner.internal');_0x53ca08[_0xb902('0x45')](_0xb902('0xa6'),_0xb902('0x2c'));}if(_0x22311e[_0xb902('0x1e')])_0x53ca08['limit'](_0x22311e[_0xb902('0x1e')]);if(_0x22311e[_0xb902('0x1d')])_0x53ca08['offset'](_0x22311e[_0xb902('0x1d')]);return db['sequelize']['query'](_0x53ca08[_0xb902('0x92')](),_0x470c8b);})[_0xb902('0x24')](function(_0x4efef3){_0x4d633a[_0xb902('0x42')](_0xb902('0xa7'),_['map'](_0x4efef3,'id'));return db['sequelize'][_0xb902('0x38')](_0x4d633a[_0xb902('0x92')](),_0x470c8b)[_0xb902('0x24')](function(_0x404d14){var _0x18f484=_[_0xb902('0xa8')](_0x404d14,_0xb902('0xa9'));var _0x2d3e18=[];_0x4efef3['forEach'](function(_0x1c8a94){_0x2d3e18[_0xb902('0xaa')](updateFaxInteraction(_0x1c8a94,_0x5775d1,_0x18f484));});return BPromise[_0xb902('0xab')](_0x2d3e18);});});})[_0xb902('0x24')](function(_0x2d0429){_0x35218c['rows']=_0x2d0429;return _0x35218c;})[_0xb902('0x24')](respondWithFilteredResult(_0x790cce,_0x22311e));})[_0xb902('0x2e')](handleError(_0x790cce,null));};exports[_0xb902('0xac')]=function(_0x32d171,_0x8e5c18){var _0x504189={'raw':![],'where':{'id':_0x32d171[_0xb902('0xad')]['id']}},_0x4f80aa={};_0x4f80aa[_0xb902('0x35')]=_[_0xb902('0x37')](db['FaxInteraction'][_0xb902('0x31')]);_0x4f80aa[_0xb902('0x38')]=_['keys'](_0x32d171[_0xb902('0x38')]);_0x4f80aa['filters']=_[_0xb902('0x3a')](_0x4f80aa[_0xb902('0x35')],_0x4f80aa[_0xb902('0x38')]);_0x504189[_0xb902('0x3b')]=_[_0xb902('0x3a')](_0x4f80aa[_0xb902('0x35')],qs['fields'](_0x32d171['query'][_0xb902('0x3c')]));_0x504189[_0xb902('0x3b')]=_0x504189['attributes'][_0xb902('0x3d')]?_0x504189[_0xb902('0x3b')]:_0x4f80aa[_0xb902('0x35')];if(_0x32d171[_0xb902('0x38')][_0xb902('0xae')]){_0x504189['include']=[{'all':!![]}];}_0x504189=_[_0xb902('0x94')]({},_0x504189,_0x32d171['options']);return db[_0xb902('0x30')][_0xb902('0x5f')](_0x504189)[_0xb902('0x24')](handleEntityNotFound(_0x8e5c18,null))[_0xb902('0x24')](respondWithResult(_0x8e5c18,null))[_0xb902('0x2e')](handleError(_0x8e5c18,null));};exports[_0xb902('0xaf')]=function(_0x94efe1,_0x31a105){return db['FaxInteraction'][_0xb902('0xaf')](_0x94efe1[_0xb902('0xb0')],{})[_0xb902('0x24')](respondWithResult(_0x31a105,0xc9))[_0xb902('0x2e')](handleError(_0x31a105,null));};exports['update']=function(_0x588927,_0xd2dc01){if(_0x588927['body']['id']){delete _0x588927[_0xb902('0xb0')]['id'];}return db[_0xb902('0x30')]['find']({'where':{'id':_0x588927[_0xb902('0xad')]['id']}})[_0xb902('0x24')](handleEntityNotFound(_0xd2dc01,null))[_0xb902('0x24')](saveUpdates(_0x588927[_0xb902('0xb0')],null))['then'](respondWithResult(_0xd2dc01,null))[_0xb902('0x2e')](handleError(_0xd2dc01,null));};exports['destroy']=function(_0x3d7cdc,_0x4becef){return db[_0xb902('0x30')][_0xb902('0x5f')]({'where':{'id':_0x3d7cdc[_0xb902('0xad')]['id']}})[_0xb902('0x24')](handleEntityNotFound(_0x4becef,null))['then'](removeEntity(_0x4becef,null))['catch'](handleError(_0x4becef,null));};exports[_0xb902('0xb1')]=function(_0x55ea33,_0x1231d1){return db[_0xb902('0x30')][_0xb902('0xb1')]()[_0xb902('0x24')](respondWithResult(_0x1231d1,null))['catch'](handleError(_0x1231d1,null));};exports[_0xb902('0xb2')]=function(_0x1d0274,_0x31e6eb,_0x56d3d2){return db[_0xb902('0xb3')][_0xb902('0x5f')]({'where':{'id':_0x1d0274[_0xb902('0xad')]['id']}})[_0xb902('0x24')](handleEntityNotFound(_0x31e6eb,null))[_0xb902('0x24')](function(_0x9cfa76){if(_0x9cfa76){return _0x9cfa76[_0xb902('0xb2')](_0x1d0274['body'][_0xb902('0xb4')],_['omit'](_0x1d0274[_0xb902('0xb0')],[_0xb902('0xb4'),'id'])||{});}})[_0xb902('0x24')](respondWithResult(_0x31e6eb,null))[_0xb902('0x2e')](handleError(_0x31e6eb,null));};exports[_0xb902('0xb5')]=function(_0x4ad814,_0x3258ff,_0x4c0fcf){var _0x2e5613={'raw':![],'where':{}};var _0x1db32a={};var _0x1d5a34={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xb902('0xb6')]({'where':{'id':_0x4ad814[_0xb902('0xad')]['id']}})[_0xb902('0x24')](handleEntityNotFound(_0x3258ff,null))[_0xb902('0x24')](function(_0x31b701){if(_0x31b701){_0x1db32a[_0xb902('0x35')]=_['keys'](db[_0xb902('0xb3')][_0xb902('0x31')]);_0x1db32a[_0xb902('0x38')]=_[_0xb902('0x37')](_0x4ad814[_0xb902('0x38')]);_0x1db32a[_0xb902('0x39')]=_[_0xb902('0x3a')](_0x1db32a['model'],_0x1db32a[_0xb902('0x38')]);_0x2e5613['attributes']=_[_0xb902('0x3a')](_0x1db32a[_0xb902('0x35')],qs[_0xb902('0x3c')](_0x4ad814[_0xb902('0x38')][_0xb902('0x3c')]));_0x2e5613[_0xb902('0x3b')]=_0x2e5613[_0xb902('0x3b')][_0xb902('0x3d')]?_0x2e5613[_0xb902('0x3b')]:_0x1db32a['model'];if(!_0x4ad814[_0xb902('0x38')]['hasOwnProperty'](_0xb902('0x3f'))){_0x2e5613[_0xb902('0x1e')]=qs[_0xb902('0x1e')](_0x4ad814['query']['limit']);_0x2e5613[_0xb902('0x1d')]=qs[_0xb902('0x1d')](_0x4ad814[_0xb902('0x38')]['offset']);}_0x2e5613[_0xb902('0x40')]=qs[_0xb902('0x41')](_0x4ad814[_0xb902('0x38')]['sort']);_0x2e5613[_0xb902('0x42')]=qs['filters'](_[_0xb902('0x43')](_0x4ad814[_0xb902('0x38')],_0x1db32a[_0xb902('0x39')]));_0x2e5613[_0xb902('0x42')][_0xb902('0xa9')]=_0x31b701['id'];if(_0x4ad814['query'][_0xb902('0x81')]){_0x2e5613[_0xb902('0x42')]=_[_0xb902('0x94')](_0x2e5613[_0xb902('0x42')],{'$or':_['map'](_0x2e5613[_0xb902('0x3b')],function(_0x239be3){var _0x4024a9={};_0x4024a9[_0x239be3]={'$like':'%'+_0x4ad814[_0xb902('0x38')][_0xb902('0x81')]+'%'};return _0x4024a9;})});}if(_0x4ad814['query']['$gte']){var _0x46bb3e=_0x4ad814[_0xb902('0x38')][_0xb902('0x79')][_0xb902('0x2d')](',');var _0xb4a89c={};_0xb4a89c[_0x46bb3e[0x0]]={'$gte':moment(_0x46bb3e[0x1])[_0xb902('0xb7')](_0xb902('0xb8'))};_0x2e5613[_0xb902('0x42')]=_['merge'](_0x2e5613[_0xb902('0x42')],_0xb4a89c);}_0x2e5613=_[_0xb902('0x94')]({},_0x2e5613,_0x4ad814[_0xb902('0xb9')]);return db[_0xb902('0xb3')][_0xb902('0x93')]({'where':_0x2e5613['where']})[_0xb902('0x24')](function(_0x526c32){_0x1d5a34[_0xb902('0x93')]=_0x526c32;if(_0x4ad814[_0xb902('0x38')][_0xb902('0xae')]){_0x2e5613[_0xb902('0xba')]=[{'all':!![]}];}return db['FaxMessage'][_0xb902('0xbb')](_0x2e5613);})[_0xb902('0x24')](function(_0x29eb7b){_0x1d5a34['rows']=_0x29eb7b;return _0x1d5a34;});}})[_0xb902('0x24')](respondWithFilteredResult(_0x3258ff,_0x2e5613))[_0xb902('0x2e')](handleError(_0x3258ff,null));};exports['addTags']=function(_0x11636d,_0x3729b9,_0x3af397){return db[_0xb902('0x30')][_0xb902('0x5f')]({'where':{'id':_0x11636d[_0xb902('0xad')]['id']}})[_0xb902('0x24')](handleEntityNotFound(_0x3729b9,null))[_0xb902('0x24')](function(_0x314eea){if(_0x314eea){return _0x314eea[_0xb902('0xbc')](_0x11636d[_0xb902('0xb0')][_0xb902('0xb4')],_[_0xb902('0xbd')](_0x11636d[_0xb902('0xb0')],[_0xb902('0xb4'),'id'])||{})['spread'](function(){return db['Tag'][_0xb902('0xbb')]({'attributes':['id','name',_0xb902('0x46')],'where':{'id':_0x11636d[_0xb902('0xb0')][_0xb902('0xb4')]}});})[_0xb902('0x24')](function(_0x25fa0f){socket['emit']('faxInteractionTags:save',{'id':Number(_0x11636d[_0xb902('0xad')]['id']),'tags':_0x25fa0f||[]});return{'id':Number(_0x11636d[_0xb902('0xad')]['id']),'tags':_0x25fa0f||[]};});}})[_0xb902('0x24')](respondWithResult(_0x3729b9,null))[_0xb902('0x2e')](handleError(_0x3729b9,null));};exports['removeTags']=function(_0x5dfef4,_0x358a27,_0x1c2949){return db[_0xb902('0x30')]['find']({'where':{'id':_0x5dfef4[_0xb902('0xad')]['id']}})[_0xb902('0x24')](handleEntityNotFound(_0x358a27,null))[_0xb902('0x24')](function(_0xfa6cd4){if(_0xfa6cd4){return _0xfa6cd4['removeTags'](_0x5dfef4[_0xb902('0x38')][_0xb902('0xb4')]);}})['then'](respondWithStatusCode(_0x358a27,null))[_0xb902('0x2e')](handleError(_0x358a27,null));};exports[_0xb902('0xbe')]=function(_0x5e00e4,_0x12773d){var _0x1ea9fc=moment()['unix']()[_0xb902('0x92')]();var _0x7d1b1a=path[_0xb902('0xbf')](config['root'],_0xb902('0xc0'),_0xb902('0xc1'),_0xb902('0xc2'));var _0x5c2c0e=path['join'](config[_0xb902('0xc3')],_0xb902('0xc0'),_0xb902('0xc1'),_0xb902('0xc4'));var _0x150d67=path[_0xb902('0xbf')](_0x7d1b1a,_0x1ea9fc);var _0x35bbff=util[_0xb902('0xb7')](_0xb902('0xc5'),_0x5e00e4[_0xb902('0xad')]['id'],_0x1ea9fc);var _0x5d0596=path[_0xb902('0xbf')](_0x7d1b1a,_0x35bbff);var _0x53684b=[];_0x53684b[_0xb902('0xaa')]({'model':db[_0xb902('0xc6')],'as':_0xb902('0xc6'),'raw':!![]});var _0x429a97=[{'model':db[_0xb902('0xb3')],'as':_0xb902('0xc7'),'attributes':['id',_0xb902('0xb0'),'createdAt'],'include':_0x53684b}];return db[_0xb902('0x30')][_0xb902('0x5f')]({'where':{'id':_0x5e00e4[_0xb902('0xad')]['id']},'include':_0x429a97})[_0xb902('0x24')](handleEntityNotFound(_0x12773d,null))['then'](function(_0xc27d36){if(_0xc27d36&&_0xc27d36[_0xb902('0xc7')]){var _0x578f27=_0xc27d36[_0xb902('0xc8')]({'plain':!![]});fs[_0xb902('0xc9')](_0x150d67);for(var _0x5a4889=0x0;_0x5a4889<_0x578f27[_0xb902('0xc7')][_0xb902('0x3d')];_0x5a4889++){var _0x596de8=_0x578f27[_0xb902('0xc7')][_0x5a4889][_0xb902('0xc6')];if(_0x596de8){var _0x2aee6b=path[_0xb902('0xbf')](_0x5c2c0e,_0x596de8[_0xb902('0xca')]);if(fs[_0xb902('0xcb')](_0x2aee6b)){fs[_0xb902('0xcc')](_0x2aee6b)[_0xb902('0xcd')](fs[_0xb902('0xce')](path['join'](_0x150d67,_0x596de8[_0xb902('0xca')])));}}}return BPromise['resolve']()[_0xb902('0x24')](function(){return new BPromise(function(_0x68e9d2,_0x53306f){zipdir(_0x150d67,{'saveTo':_0x5d0596},function(_0x6a015d,_0x13c53e){if(_0x6a015d)return _0x53306f(_0x6a015d);return _0x68e9d2(_0x13c53e);});})[_0xb902('0x24')](function(){return new BPromise(function(_0x1268a9,_0x22a983){rimraf(_0x150d67,function(_0x4b24d7){if(_0x4b24d7)_0x22a983(_0x4b24d7);return _0x1268a9();});});})[_0xb902('0x24')](function(){return _0x12773d['download'](_0x5d0596,_0x35bbff,function(_0x58507f){if(_0x58507f){console[_0xb902('0xcf')](_0xb902('0xd0'),_0x58507f);}else{fs[_0xb902('0xd1')](_0x5d0596);}});});});}else{return _0x12773d[_0xb902('0x19')](0xc8);}})['catch'](handleError(_0x12773d,null));}; \ No newline at end of file +var _0xdf79=['end','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','index','FaxInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','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','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','i.id','journey','user','getFaxAccounts','i.FaxAccountId\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.*','c.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','push','all','rows','catch','params','includeAll','include','options','create','body','describe','addMessage','ids','omit','findOne','FaxMessage','FaxInteractionId','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','findAll','emit','removeTags','download','join','root','files','server','format','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','pipe','log','err','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy'];(function(_0x971e2d,_0x2e6df2){var _0x2c1473=function(_0xb03fe1){while(--_0xb03fe1){_0x971e2d['push'](_0x971e2d['shift']());}};_0x2c1473(++_0x2e6df2);}(_0xdf79,0xa7));var _0x9df7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdf79[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9df7('0x0'));var zipdir=require(_0x9df7('0x1'));var jsonpatch=require(_0x9df7('0x2'));var rp=require(_0x9df7('0x3'));var moment=require(_0x9df7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9df7('0x5'));var csv=require(_0x9df7('0x6'));var ejs=require(_0x9df7('0x7'));var fs=require('fs');var _=require(_0x9df7('0x8'));var squel=require('squel');var crypto=require(_0x9df7('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9df7('0xa'));var toCsv=require('to-csv');var querystring=require(_0x9df7('0xb'));var Papa=require(_0x9df7('0xc'));var Redis=require(_0x9df7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9df7('0xe'));var as=require(_0x9df7('0xf'));var hardwareService=require(_0x9df7('0x10'));var logger=require('../../config/logger')(_0x9df7('0x11'));var utils=require(_0x9df7('0x12'));var config=require(_0x9df7('0x13'));var db=require(_0x9df7('0x14'))['db'];config[_0x9df7('0x15')]=_[_0x9df7('0x16')](config[_0x9df7('0x15')],{'host':_0x9df7('0x17'),'port':0x18eb});var socket=require(_0x9df7('0x18'))(new Redis(config[_0x9df7('0x15')]));require(_0x9df7('0x19'))[_0x9df7('0x1a')](socket);function respondWithStatusCode(_0x5ccc00,_0x49a64d){_0x49a64d=_0x49a64d||0xcc;return function(_0x66813f){if(_0x66813f){return _0x5ccc00[_0x9df7('0x1b')](_0x49a64d);}return _0x5ccc00[_0x9df7('0x1c')](_0x49a64d)['end']();};}function respondWithResult(_0x3bf032,_0x5cb6dc){_0x5cb6dc=_0x5cb6dc||0xc8;return function(_0x5128ea){if(_0x5128ea){return _0x3bf032['status'](_0x5cb6dc)[_0x9df7('0x1d')](_0x5128ea);}};}function respondWithFilteredResult(_0x3d545b,_0x26ba07){return function(_0xfec64c){if(_0xfec64c){var _0x11760e=_0xfec64c[_0x9df7('0x1e')],_0x31d468=_0x26ba07[_0x9df7('0x1f')],_0x1a27dd=_0x26ba07[_0x9df7('0x1f')]+_0x26ba07[_0x9df7('0x20')],_0x92d81c;if(_0x1a27dd>=_0x11760e){_0x1a27dd=_0x11760e;_0x92d81c=0xc8;}else{_0x92d81c=0xce;}_0x3d545b[_0x9df7('0x1c')](_0x92d81c);return _0x3d545b['set']('Content-Range',_0x31d468+'-'+_0x1a27dd+'/'+_0x11760e)[_0x9df7('0x1d')](_0xfec64c);}return null;};}function patchUpdates(_0x45f9c9){return function(_0x48fa39){try{jsonpatch[_0x9df7('0x21')](_0x48fa39,_0x45f9c9,!![]);}catch(_0x5ada11){return BPromise[_0x9df7('0x22')](_0x5ada11);}return _0x48fa39[_0x9df7('0x23')]();};}function saveUpdates(_0x30f344,_0x25dc95){return function(_0x1171e4){if(_0x1171e4){return _0x1171e4[_0x9df7('0x24')](_0x30f344)[_0x9df7('0x25')](function(_0x5ad362){return _0x5ad362;});}return null;};}function removeEntity(_0x32c681,_0x482d07){return function(_0x149e61){if(_0x149e61){return _0x149e61[_0x9df7('0x26')]()[_0x9df7('0x25')](function(){_0x32c681['status'](0xcc)[_0x9df7('0x27')]();});}};}function handleEntityNotFound(_0x33376e,_0x374395){return function(_0x5210f1){if(!_0x5210f1){_0x33376e[_0x9df7('0x1b')](0x194);}return _0x5210f1;};}function handleError(_0x36c612,_0x559ab1){_0x559ab1=_0x559ab1||0x1f4;return function(_0x43c6dd){logger['error'](_0x43c6dd[_0x9df7('0x28')]);if(_0x43c6dd[_0x9df7('0x29')]){delete _0x43c6dd['name'];}_0x36c612[_0x9df7('0x1c')](_0x559ab1)[_0x9df7('0x2a')](_0x43c6dd);};}function getInteractionUsers(_0x2c5cc8,_0x331a55){return new BPromise(function(_0x383453,_0x1a5da9){try{if(_0x331a55[_0x2c5cc8['id']]){_0x2c5cc8[_0x9df7('0x2b')]=_[_0x9df7('0x2c')](_0x331a55[_0x2c5cc8['id']],function(_0x549f4b){return{'id':_0x549f4b['id'],'fullname':_0x549f4b[_0x9df7('0x2d')]};});}}catch(_0x24084c){_0x1a5da9(_0x24084c);}_0x383453(_0x2c5cc8);});}function getInteractionTags(_0xcc3be4,_0x4c2107){return new BPromise(function(_0xb678b0,_0x527302){try{if(_0xcc3be4['TagIds']){_0xcc3be4[_0x9df7('0x2e')]=[];_0xcc3be4[_0x9df7('0x2f')][_0x9df7('0x30')](',')[_0x9df7('0x31')](function(_0x35d3a3){_0xcc3be4[_0x9df7('0x2e')]['push'](_0x4c2107[_0x35d3a3]);});}delete _0xcc3be4[_0x9df7('0x2f')];}catch(_0x115d29){_0x527302(_0x115d29);}_0xb678b0(_0xcc3be4);});}function updateFaxInteraction(_0xbaef1,_0x2d20e7,_0x37c2ae){return new BPromise(function(_0xc7d6c6,_0x5a6d0b){return getInteractionUsers(_0xbaef1,_0x37c2ae)[_0x9df7('0x25')](function(_0x1bcf5f){return getInteractionTags(_0x1bcf5f,_0x2d20e7);})[_0x9df7('0x25')](function(_0x13d316){_0xc7d6c6(_0x13d316);})['catch'](function(_0x31dbbc){_0x5a6d0b(_0x31dbbc);});});}exports[_0x9df7('0x32')]=function(_0x6fb9fb,_0x33484d){var _0x3a10e4={},_0x5948ec={},_0x59340d={'count':0x0,'rows':[]};var _0x4a3418=_[_0x9df7('0x2c')](db[_0x9df7('0x33')][_0x9df7('0x34')],function(_0x281d37){return{'name':_0x281d37[_0x9df7('0x35')],'type':_0x281d37['type'][_0x9df7('0x36')]};});_0x5948ec[_0x9df7('0x37')]=_[_0x9df7('0x2c')](_0x4a3418,_0x9df7('0x29'));_0x5948ec[_0x9df7('0x38')]=_[_0x9df7('0x39')](_0x6fb9fb[_0x9df7('0x38')]);_0x5948ec[_0x9df7('0x3a')]=_[_0x9df7('0x3b')](_0x5948ec[_0x9df7('0x37')],_0x5948ec[_0x9df7('0x38')]);_0x3a10e4[_0x9df7('0x3c')]=_['intersection'](_0x5948ec[_0x9df7('0x37')],qs[_0x9df7('0x3d')](_0x6fb9fb['query']['fields']));_0x3a10e4['attributes']=_0x3a10e4[_0x9df7('0x3c')][_0x9df7('0x3e')]?_0x3a10e4[_0x9df7('0x3c')]:_0x5948ec['model'];if(!_0x6fb9fb[_0x9df7('0x38')][_0x9df7('0x3f')](_0x9df7('0x40'))){_0x3a10e4[_0x9df7('0x20')]=qs[_0x9df7('0x20')](_0x6fb9fb[_0x9df7('0x38')]['limit']);_0x3a10e4[_0x9df7('0x1f')]=qs[_0x9df7('0x1f')](_0x6fb9fb[_0x9df7('0x38')][_0x9df7('0x1f')]);}_0x3a10e4[_0x9df7('0x41')]=qs[_0x9df7('0x42')](_0x6fb9fb['query'][_0x9df7('0x42')]);_0x3a10e4[_0x9df7('0x43')]=qs[_0x9df7('0x3a')](_[_0x9df7('0x44')](_0x6fb9fb[_0x9df7('0x38')],_0x5948ec[_0x9df7('0x3a')]),_0x4a3418);var _0x505e19=[];var _0x3175d8=squel[_0x9df7('0x45')]()[_0x9df7('0x46')]('id')['field'](_0x9df7('0x29'))[_0x9df7('0x46')](_0x9df7('0x47'))[_0x9df7('0x48')](_0x9df7('0x49'));var _0x2bde24=squel[_0x9df7('0x45')]()[_0x9df7('0x46')]('u.id')[_0x9df7('0x46')]('u.fullname')[_0x9df7('0x46')](_0x9df7('0x4a'))[_0x9df7('0x48')](_0x9df7('0x4b'),'ui')[_0x9df7('0x4c')](_0x9df7('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x3bf2ca=squel[_0x9df7('0x45')]()[_0x9df7('0x48')](_0x9df7('0x4e'),'i')[_0x9df7('0x4c')](_0x9df7('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x9df7('0x4c')](_0x9df7('0x4d'),'o',_0x9df7('0x50'))[_0x9df7('0x4c')](_0x9df7('0x51'),'a',_0x9df7('0x52'))[_0x9df7('0x4c')](_0x9df7('0x53'),'me',_0x9df7('0x54'))[_0x9df7('0x4c')](_0x9df7('0x55'),'it',_0x9df7('0x56'))['left_join'](_0x9df7('0x49'),'t','t.id\x20=\x20it.TagId');var _0x2812ec=squel['expr']();var _0x1e117a=[];var _0x3200eb=squel[_0x9df7('0x57')]();var _0x4f7695;if(_0x6fb9fb[_0x9df7('0x38')][_0x9df7('0x58')]){_0x4f7695=as[_0x9df7('0x59')](_0x6fb9fb[_0x9df7('0x38')][_0x9df7('0x58')]);var _0x45a837=_0x4f7695[_0x9df7('0x5a')];for(var _0x31a794=0x0;_0x31a794<_0x4f7695[_0x9df7('0x5b')][_0x9df7('0x3e')];_0x31a794++){var _0x243ab9=_0x4f7695['conditions'][_0x31a794];var _0x3c85fa='i';var _0x44c3f6=_[_0x9df7('0x5c')](_0x4a3418,[_0x9df7('0x29'),_0x243ab9['field']]);if(!_0x44c3f6){switch(_0x243ab9[_0x9df7('0x46')]){case _0x9df7('0x5d'):if(_0x243ab9['value']==0x1){_0x3bf2ca['having']('`'+_0x243ab9['field']+'`\x20=\x200');}else{_0x3bf2ca[_0x9df7('0x5e')]('`'+_0x243ab9['field']+'`\x20>\x200');}break;case'Contact':if(_0x243ab9[_0x9df7('0x5f')]===_0x9df7('0x60')){if(_0x243ab9[_0x9df7('0x61')][_0x9df7('0x30')]('\x20')['length']>0x1){_0x2812ec[_0x45a837](_0x9df7('0x62'),qs[_0x9df7('0x63')](_0x243ab9['value']),null);}else{var _0x2cc84f='%'+_0x243ab9[_0x9df7('0x61')]+'%';_0x2812ec[_0x45a837](_0x9df7('0x64'),_0x2cc84f,_0x2cc84f,_0x2cc84f);}}else{_0x44c3f6=_[_0x9df7('0x5c')](_0x4a3418,[_0x9df7('0x29'),_0x9df7('0x65')]);_0x243ab9[_0x9df7('0x46')]=_0x9df7('0x65');_0x9fb36f=as[_0x9df7('0x66')](_0x3c85fa,_0x44c3f6[_0x9df7('0x67')],_0x243ab9);_0x2812ec[_0x45a837](_0x9fb36f[_0x9df7('0x68')],_0x9fb36f[_0x9df7('0x61')]['start'],_0x9fb36f[_0x9df7('0x61')][_0x9df7('0x27')]);}break;case _0x9df7('0x69'):var _0x996cd6=_0x243ab9[_0x9df7('0x61')]['split'](',')[_0x9df7('0x2c')](function(_0x587587){return Number(_0x587587);});_0x996cd6[_0x9df7('0x31')](function(_0x599c24){_0x3200eb['or'](_0x9df7('0x6a'),'%,'+_0x599c24+',%');});_0x1e117a=_[_0x9df7('0x6b')](_0x1e117a,_0x996cd6);break;case _0x9df7('0x6c'):if(_0x243ab9[_0x9df7('0x5f')]===_0x9df7('0x60')){_0x2812ec[_0x45a837](_0x9df7('0x6d'),'%'+_0x243ab9[_0x9df7('0x61')]+'%',null);}else{_0x44c3f6=_[_0x9df7('0x5c')](_0x4a3418,[_0x9df7('0x29'),_0x9df7('0x6e')]);_0x243ab9['field']=_0x9df7('0x6e');_0x9fb36f=as['buildExpression'](_0x3c85fa,_0x44c3f6[_0x9df7('0x67')],_0x243ab9);_0x2812ec[_0x45a837](_0x9fb36f[_0x9df7('0x68')],_0x9fb36f[_0x9df7('0x61')][_0x9df7('0x6f')],_0x9fb36f[_0x9df7('0x61')][_0x9df7('0x27')]);}break;case'body':_0x9fb36f=as[_0x9df7('0x66')]('me',null,_0x243ab9);_0x2812ec[_0x45a837](_0x9fb36f[_0x9df7('0x68')],_0x9fb36f[_0x9df7('0x61')]['start'],_0x9fb36f[_0x9df7('0x61')][_0x9df7('0x27')]);break;}}else{var _0x9fb36f=as['buildExpression'](_0x3c85fa,_0x44c3f6['type'],_0x243ab9);_0x2812ec[_0x45a837](_0x9fb36f[_0x9df7('0x68')],_0x9fb36f['value'][_0x9df7('0x6f')],_0x9fb36f[_0x9df7('0x61')][_0x9df7('0x27')]);}}}else{var _0x52683e=_(_0x6fb9fb[_0x9df7('0x38')])[_0x9df7('0x39')]()[_0x9df7('0x2c')](function(_0x36b266){return _[_0x9df7('0x70')](_0x4a3418,[_0x9df7('0x29'),_0x36b266])?_0x36b266:undefined;})[_0x9df7('0x71')]()[_0x9df7('0x61')]();if(!_[_0x9df7('0x72')](_0x52683e)){_0x52683e[_0x9df7('0x31')](function(_0x235b3c){if(_0x235b3c===_0x9df7('0x73')){_0x3bf2ca[_0x9df7('0x43')](_0x9df7('0x74'),[][_0x9df7('0x75')](_0x6fb9fb[_0x9df7('0x38')][_0x235b3c]));}else if(_0x235b3c===_0x9df7('0x76')){var _0x48b9be=JSON['parse'](_0x6fb9fb[_0x9df7('0x38')][_0x235b3c])[_0x9df7('0x77')];var _0x2542f4=JSON[_0x9df7('0x78')](_0x6fb9fb[_0x9df7('0x38')][_0x235b3c])[_0x9df7('0x79')];_0x3bf2ca['where'](_0x9df7('0x7a'),_0x48b9be,_0x2542f4);}else{if(_0x6fb9fb[_0x9df7('0x38')][_0x235b3c]===_0x9df7('0x7b')){_0x3bf2ca[_0x9df7('0x43')]('i.'+_0x235b3c+'\x20IS\x20NULL');}else{_0x3bf2ca[_0x9df7('0x43')]('i.'+_0x235b3c+_0x9df7('0x7c'),_0x6fb9fb[_0x9df7('0x38')][_0x235b3c]);}}});}if(_0x6fb9fb[_0x9df7('0x38')][_0x9df7('0x7d')]){if(_0x6fb9fb['query'][_0x9df7('0x7d')]==0x1){_0x3bf2ca[_0x9df7('0x5e')](_0x9df7('0x7e'));}else{_0x3bf2ca[_0x9df7('0x5e')](_0x9df7('0x7f'));}}if(_0x6fb9fb[_0x9df7('0x38')]['tag']){_0x1e117a=_[_0x9df7('0x80')](_0x6fb9fb[_0x9df7('0x38')]['tag'])?_0x6fb9fb['query'][_0x9df7('0x81')]:new Array(_0x6fb9fb[_0x9df7('0x38')]['tag']);_0x1e117a[_0x9df7('0x31')](function(_0x58023e){_0x3200eb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58023e+',%');});}if(_0x6fb9fb[_0x9df7('0x38')]['filter']){var _0x3f1157=_0x6fb9fb[_0x9df7('0x38')][_0x9df7('0x82')][_0x9df7('0x83')]('\x5c','\x5c\x5c')[_0x9df7('0x83')]('\x27\x27',_0x9df7('0x84'));if(qs[_0x9df7('0x85')](_0x3f1157)){_0x2812ec['or'](_0x9df7('0x86'),_0x3f1157+'%')['or']('i.fax\x20LIKE\x20?',_0x3f1157+'%');}_0x2812ec['or'](_0x9df7('0x87'),_0x3f1157+'%');}}_0x3bf2ca['where'](_0x2812ec);_0x3bf2ca[_0x9df7('0x88')]('i.id');var _0x4e9fa1={'type':db['Sequelize'][_0x9df7('0x89')][_0x9df7('0x8a')],'raw':!![]};var _0x54fe56=_0x3bf2ca['clone']();_0x54fe56[_0x9df7('0x46')](_0x9df7('0x8b'));_0x54fe56[_0x9df7('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9df7('0x5d'));if(_0x3a10e4[_0x9df7('0x41')]){_0x3a10e4[_0x9df7('0x41')][_0x9df7('0x31')](function(_0x3f546a){_0x3bf2ca['order']('i.'+_0x3f546a[0x0],_0x3f546a[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9df7('0x72')](_0x1e117a)){_0x3bf2ca[_0x9df7('0x5e')](_0x3200eb);_0x54fe56['where']('t.id\x20IN\x20?',_0x1e117a);}BPromise['resolve']()[_0x9df7('0x25')](function(){if(!_0x4f7695){if(_0x6fb9fb[_0x9df7('0x38')]['FaxAccountId']||_0x6fb9fb['query'][_0x9df7('0x8c')])return;_0x54fe56[_0x9df7('0x43')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x3bf2ca['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}return _0x6fb9fb[_0x9df7('0x8d')][_0x9df7('0x8e')]({'attributes':['id'],'raw':!![]})[_0x9df7('0x25')](function(_0x462e08){if(_[_0x9df7('0x72')](_0x462e08)){_0x54fe56[_0x9df7('0x43')](_0x9df7('0x8f'));_0x3bf2ca[_0x9df7('0x43')](_0x9df7('0x8f'));}else{_0x54fe56[_0x9df7('0x43')](_0x9df7('0x74'),_[_0x9df7('0x2c')](_0x462e08,'id'));_0x3bf2ca[_0x9df7('0x43')](_0x9df7('0x74'),_[_0x9df7('0x2c')](_0x462e08,'id'));}});})[_0x9df7('0x25')](function(){db[_0x9df7('0x90')]['query'](_0x54fe56[_0x9df7('0x91')](),_0x4e9fa1)[_0x9df7('0x25')](function(_0x9bc784){_0x59340d['count']=_0x9bc784[_0x9df7('0x3e')];if(_0x59340d[_0x9df7('0x1e')]===0x0)return[];return db[_0x9df7('0x90')][_0x9df7('0x38')](_0x3175d8['toString'](),_0x4e9fa1)[_0x9df7('0x25')](function(_0xf14dda){_0x505e19=_[_0x9df7('0x92')](_0xf14dda,'id');_0x4e9fa1=_[_0x9df7('0x93')](_0x4e9fa1,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x6fb9fb[_0x9df7('0x38')][_0x9df7('0x3d')]){_0x3a10e4[_0x9df7('0x3c')]['forEach'](function(_0x8a89bf){_0x3bf2ca[_0x9df7('0x46')]('i.'+_0x8a89bf);});}else{_0x3bf2ca['field'](_0x9df7('0x94'),_0x9df7('0x5d'));_0x3bf2ca[_0x9df7('0x46')](_0x9df7('0x95'),_0x9df7('0x96'));_0x3bf2ca[_0x9df7('0x46')](_0x9df7('0x97'),_0x9df7('0x98'));_0x3bf2ca[_0x9df7('0x46')](_0x9df7('0x99'));_0x3bf2ca[_0x9df7('0x46')](_0x9df7('0x9a'),'Contact.firstName');_0x3bf2ca['field']('c.lastName',_0x9df7('0x9b'));_0x3bf2ca[_0x9df7('0x46')](_0x9df7('0x9c'),_0x9df7('0x9d'));_0x3bf2ca[_0x9df7('0x46')](_0x9df7('0x9e'),'Contact.phone');_0x3bf2ca['field'](_0x9df7('0x9f'),_0x9df7('0xa0'));_0x3bf2ca[_0x9df7('0x46')](_0x9df7('0xa1'),_0x9df7('0xa2'));_0x3bf2ca[_0x9df7('0x46')](_0x9df7('0xa3'),_0x9df7('0xa4'));_0x3bf2ca['field']('o.internal','Owner.internal');_0x3bf2ca[_0x9df7('0x46')](_0x9df7('0xa5'),_0x9df7('0x2f'));}if(_0x3a10e4['limit'])_0x3bf2ca[_0x9df7('0x20')](_0x3a10e4['limit']);if(_0x3a10e4[_0x9df7('0x1f')])_0x3bf2ca[_0x9df7('0x1f')](_0x3a10e4['offset']);return db[_0x9df7('0x90')]['query'](_0x3bf2ca[_0x9df7('0x91')](),_0x4e9fa1);})[_0x9df7('0x25')](function(_0x57b16d){_0x2bde24[_0x9df7('0x43')]('ui.FaxInteractionId\x20IN\x20?',_[_0x9df7('0x2c')](_0x57b16d,'id'));return db[_0x9df7('0x90')]['query'](_0x2bde24[_0x9df7('0x91')](),_0x4e9fa1)['then'](function(_0x32e83b){var _0x52260d=_[_0x9df7('0xa6')](_0x32e83b,'FaxInteractionId');var _0x95c665=[];_0x57b16d[_0x9df7('0x31')](function(_0xfc4498){_0x95c665[_0x9df7('0xa7')](updateFaxInteraction(_0xfc4498,_0x505e19,_0x52260d));});return BPromise[_0x9df7('0xa8')](_0x95c665);});});})['then'](function(_0x4e1c51){_0x59340d[_0x9df7('0xa9')]=_0x4e1c51;return _0x59340d;})[_0x9df7('0x25')](respondWithFilteredResult(_0x33484d,_0x3a10e4));})[_0x9df7('0xaa')](handleError(_0x33484d,null));};exports['show']=function(_0x27a660,_0x22df4e){var _0x3af58b={'raw':![],'where':{'id':_0x27a660[_0x9df7('0xab')]['id']}},_0x493def={};_0x493def[_0x9df7('0x37')]=_[_0x9df7('0x39')](db[_0x9df7('0x33')][_0x9df7('0x34')]);_0x493def['query']=_[_0x9df7('0x39')](_0x27a660[_0x9df7('0x38')]);_0x493def[_0x9df7('0x3a')]=_[_0x9df7('0x3b')](_0x493def[_0x9df7('0x37')],_0x493def['query']);_0x3af58b[_0x9df7('0x3c')]=_['intersection'](_0x493def[_0x9df7('0x37')],qs[_0x9df7('0x3d')](_0x27a660[_0x9df7('0x38')]['fields']));_0x3af58b['attributes']=_0x3af58b[_0x9df7('0x3c')]['length']?_0x3af58b[_0x9df7('0x3c')]:_0x493def[_0x9df7('0x37')];if(_0x27a660[_0x9df7('0x38')][_0x9df7('0xac')]){_0x3af58b[_0x9df7('0xad')]=[{'all':!![]}];}_0x3af58b=_['merge']({},_0x3af58b,_0x27a660[_0x9df7('0xae')]);return db[_0x9df7('0x33')][_0x9df7('0x5c')](_0x3af58b)[_0x9df7('0x25')](handleEntityNotFound(_0x22df4e,null))['then'](respondWithResult(_0x22df4e,null))[_0x9df7('0xaa')](handleError(_0x22df4e,null));};exports[_0x9df7('0xaf')]=function(_0x14471b,_0x2a856d){return db[_0x9df7('0x33')][_0x9df7('0xaf')](_0x14471b[_0x9df7('0xb0')],{})[_0x9df7('0x25')](respondWithResult(_0x2a856d,0xc9))[_0x9df7('0xaa')](handleError(_0x2a856d,null));};exports['update']=function(_0x4dcc74,_0x331f9e){if(_0x4dcc74['body']['id']){delete _0x4dcc74[_0x9df7('0xb0')]['id'];}return db[_0x9df7('0x33')][_0x9df7('0x5c')]({'where':{'id':_0x4dcc74[_0x9df7('0xab')]['id']}})[_0x9df7('0x25')](handleEntityNotFound(_0x331f9e,null))[_0x9df7('0x25')](saveUpdates(_0x4dcc74[_0x9df7('0xb0')],null))[_0x9df7('0x25')](respondWithResult(_0x331f9e,null))[_0x9df7('0xaa')](handleError(_0x331f9e,null));};exports[_0x9df7('0x26')]=function(_0x19755d,_0x43a1bc){return db[_0x9df7('0x33')][_0x9df7('0x5c')]({'where':{'id':_0x19755d[_0x9df7('0xab')]['id']}})['then'](handleEntityNotFound(_0x43a1bc,null))[_0x9df7('0x25')](removeEntity(_0x43a1bc,null))[_0x9df7('0xaa')](handleError(_0x43a1bc,null));};exports[_0x9df7('0xb1')]=function(_0x4b7d60,_0x2467b6){return db[_0x9df7('0x33')][_0x9df7('0xb1')]()[_0x9df7('0x25')](respondWithResult(_0x2467b6,null))[_0x9df7('0xaa')](handleError(_0x2467b6,null));};exports[_0x9df7('0xb2')]=function(_0x29f39a,_0x51bcaf,_0x2f82cb){return db['FaxMessage'][_0x9df7('0x5c')]({'where':{'id':_0x29f39a[_0x9df7('0xab')]['id']}})[_0x9df7('0x25')](handleEntityNotFound(_0x51bcaf,null))[_0x9df7('0x25')](function(_0x49d57f){if(_0x49d57f){return _0x49d57f[_0x9df7('0xb2')](_0x29f39a[_0x9df7('0xb0')][_0x9df7('0xb3')],_[_0x9df7('0xb4')](_0x29f39a['body'],['ids','id'])||{});}})[_0x9df7('0x25')](respondWithResult(_0x51bcaf,null))['catch'](handleError(_0x51bcaf,null));};exports['getMessages']=function(_0x644e94,_0x53dda9,_0x195948){var _0x2146ea={'raw':![],'where':{}};var _0x396575={};var _0x3d1a4a={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x9df7('0xb5')]({'where':{'id':_0x644e94[_0x9df7('0xab')]['id']}})[_0x9df7('0x25')](handleEntityNotFound(_0x53dda9,null))['then'](function(_0x58bc29){if(_0x58bc29){_0x396575['model']=_[_0x9df7('0x39')](db[_0x9df7('0xb6')]['rawAttributes']);_0x396575[_0x9df7('0x38')]=_[_0x9df7('0x39')](_0x644e94[_0x9df7('0x38')]);_0x396575[_0x9df7('0x3a')]=_['intersection'](_0x396575[_0x9df7('0x37')],_0x396575['query']);_0x2146ea[_0x9df7('0x3c')]=_[_0x9df7('0x3b')](_0x396575[_0x9df7('0x37')],qs[_0x9df7('0x3d')](_0x644e94[_0x9df7('0x38')]['fields']));_0x2146ea[_0x9df7('0x3c')]=_0x2146ea[_0x9df7('0x3c')]['length']?_0x2146ea['attributes']:_0x396575[_0x9df7('0x37')];if(!_0x644e94['query'][_0x9df7('0x3f')](_0x9df7('0x40'))){_0x2146ea[_0x9df7('0x20')]=qs[_0x9df7('0x20')](_0x644e94['query'][_0x9df7('0x20')]);_0x2146ea[_0x9df7('0x1f')]=qs[_0x9df7('0x1f')](_0x644e94[_0x9df7('0x38')][_0x9df7('0x1f')]);}_0x2146ea[_0x9df7('0x41')]=qs[_0x9df7('0x42')](_0x644e94[_0x9df7('0x38')]['sort']);_0x2146ea[_0x9df7('0x43')]=qs[_0x9df7('0x3a')](_[_0x9df7('0x44')](_0x644e94[_0x9df7('0x38')],_0x396575[_0x9df7('0x3a')]));_0x2146ea[_0x9df7('0x43')][_0x9df7('0xb7')]=_0x58bc29['id'];if(_0x644e94[_0x9df7('0x38')][_0x9df7('0x82')]){_0x2146ea['where']=_[_0x9df7('0x93')](_0x2146ea['where'],{'$or':_[_0x9df7('0x2c')](_0x2146ea[_0x9df7('0x3c')],function(_0xa93750){var _0x419a77={};_0x419a77[_0xa93750]={'$like':'%'+_0x644e94[_0x9df7('0x38')]['filter']+'%'};return _0x419a77;})});}if(_0x644e94[_0x9df7('0x38')][_0x9df7('0x77')]){var _0x1b36c7=_0x644e94[_0x9df7('0x38')][_0x9df7('0x77')][_0x9df7('0x30')](',');var _0x27ad75={};_0x27ad75[_0x1b36c7[0x0]]={'$gte':moment(_0x1b36c7[0x1])['format'](_0x9df7('0xb8'))};_0x2146ea[_0x9df7('0x43')]=_[_0x9df7('0x93')](_0x2146ea['where'],_0x27ad75);}_0x2146ea=_[_0x9df7('0x93')]({},_0x2146ea,_0x644e94[_0x9df7('0xae')]);return db[_0x9df7('0xb6')]['count']({'where':_0x2146ea[_0x9df7('0x43')]})[_0x9df7('0x25')](function(_0x11cee1){_0x3d1a4a['count']=_0x11cee1;if(_0x644e94[_0x9df7('0x38')][_0x9df7('0xac')]){_0x2146ea['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x2146ea);})['then'](function(_0x21ad60){_0x3d1a4a[_0x9df7('0xa9')]=_0x21ad60;return _0x3d1a4a;});}})[_0x9df7('0x25')](respondWithFilteredResult(_0x53dda9,_0x2146ea))[_0x9df7('0xaa')](handleError(_0x53dda9,null));};exports[_0x9df7('0xb9')]=function(_0x3dabb0,_0x5461b1,_0xda6a41){return db['FaxInteraction'][_0x9df7('0x5c')]({'where':{'id':_0x3dabb0[_0x9df7('0xab')]['id']}})[_0x9df7('0x25')](handleEntityNotFound(_0x5461b1,null))[_0x9df7('0x25')](function(_0x1ae714){if(_0x1ae714){return _0x1ae714[_0x9df7('0xba')](_0x3dabb0[_0x9df7('0xb0')][_0x9df7('0xb3')],_['omit'](_0x3dabb0[_0x9df7('0xb0')],[_0x9df7('0xb3'),'id'])||{})['spread'](function(){return db['Tag'][_0x9df7('0xbb')]({'attributes':['id',_0x9df7('0x29'),_0x9df7('0x47')],'where':{'id':_0x3dabb0[_0x9df7('0xb0')][_0x9df7('0xb3')]}});})[_0x9df7('0x25')](function(_0x3f2750){socket[_0x9df7('0xbc')]('faxInteractionTags:save',{'id':Number(_0x3dabb0[_0x9df7('0xab')]['id']),'tags':_0x3f2750||[]});return{'id':Number(_0x3dabb0[_0x9df7('0xab')]['id']),'tags':_0x3f2750||[]};});}})[_0x9df7('0x25')](respondWithResult(_0x5461b1,null))[_0x9df7('0xaa')](handleError(_0x5461b1,null));};exports[_0x9df7('0xbd')]=function(_0x38cf29,_0x16e501,_0x3575a3){return db[_0x9df7('0x33')][_0x9df7('0x5c')]({'where':{'id':_0x38cf29[_0x9df7('0xab')]['id']}})[_0x9df7('0x25')](handleEntityNotFound(_0x16e501,null))[_0x9df7('0x25')](function(_0x3fc515){if(_0x3fc515){return _0x3fc515['removeTags'](_0x38cf29[_0x9df7('0x38')][_0x9df7('0xb3')]);}})[_0x9df7('0x25')](respondWithStatusCode(_0x16e501,null))[_0x9df7('0xaa')](handleError(_0x16e501,null));};exports[_0x9df7('0xbe')]=function(_0x2bc34d,_0x238e76){var _0x27cd17=moment()['unix']()[_0x9df7('0x91')]();var _0x374fc7=path[_0x9df7('0xbf')](config[_0x9df7('0xc0')],'server',_0x9df7('0xc1'),'tmp');var _0xf70edc=path[_0x9df7('0xbf')](config['root'],_0x9df7('0xc2'),_0x9df7('0xc1'),'attachments');var _0x4bc12e=path['join'](_0x374fc7,_0x27cd17);var _0x3799cc=util[_0x9df7('0xc3')](_0x9df7('0xc4'),_0x2bc34d[_0x9df7('0xab')]['id'],_0x27cd17);var _0x4b57a3=path[_0x9df7('0xbf')](_0x374fc7,_0x3799cc);var _0x598991=[];_0x598991[_0x9df7('0xa7')]({'model':db[_0x9df7('0xc5')],'as':_0x9df7('0xc5'),'raw':!![]});var _0x4ac283=[{'model':db[_0x9df7('0xb6')],'as':_0x9df7('0xc6'),'attributes':['id',_0x9df7('0xb0'),'createdAt'],'include':_0x598991}];return db['FaxInteraction'][_0x9df7('0x5c')]({'where':{'id':_0x2bc34d[_0x9df7('0xab')]['id']},'include':_0x4ac283})['then'](handleEntityNotFound(_0x238e76,null))[_0x9df7('0x25')](function(_0x2c40a8){if(_0x2c40a8&&_0x2c40a8[_0x9df7('0xc6')]){var _0x3a9d2d=_0x2c40a8['get']({'plain':!![]});fs[_0x9df7('0xc7')](_0x4bc12e);for(var _0x1e5a0d=0x0;_0x1e5a0d<_0x3a9d2d[_0x9df7('0xc6')][_0x9df7('0x3e')];_0x1e5a0d++){var _0x257fbd=_0x3a9d2d[_0x9df7('0xc6')][_0x1e5a0d][_0x9df7('0xc5')];if(_0x257fbd){var _0x5ad459=path['join'](_0xf70edc,_0x257fbd[_0x9df7('0xc8')]);if(fs[_0x9df7('0xc9')](_0x5ad459)){fs[_0x9df7('0xca')](_0x5ad459)[_0x9df7('0xcb')](fs['createWriteStream'](path[_0x9df7('0xbf')](_0x4bc12e,_0x257fbd['basename'])));}}}return BPromise['resolve']()[_0x9df7('0x25')](function(){return new BPromise(function(_0x1968dc,_0x962dc0){zipdir(_0x4bc12e,{'saveTo':_0x4b57a3},function(_0x1b9ecc,_0x2f02a5){if(_0x1b9ecc)return _0x962dc0(_0x1b9ecc);return _0x1968dc(_0x2f02a5);});})[_0x9df7('0x25')](function(){return new BPromise(function(_0x473a50,_0x57fbb7){rimraf(_0x4bc12e,function(_0x347f1e){if(_0x347f1e)_0x57fbb7(_0x347f1e);return _0x473a50();});});})[_0x9df7('0x25')](function(){return _0x238e76['download'](_0x4b57a3,_0x3799cc,function(_0x30be55){if(_0x30be55){console[_0x9df7('0xcc')](_0x9df7('0xcd'),_0x30be55);}else{fs['unlinkSync'](_0x4b57a3);}});});});}else{return _0x238e76[_0x9df7('0x1b')](0xc8);}})[_0x9df7('0xaa')](handleError(_0x238e76,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index ba8559d..87150d7 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 _0xdb28=['Users','map','findAll','then','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','save','update','remove','setDataValue'];(function(_0x3c6b7d,_0x5f0d90){var _0x1d3ed2=function(_0x1a8f35){while(--_0x1a8f35){_0x3c6b7d['push'](_0x3c6b7d['shift']());}};_0x1d3ed2(++_0x5f0d90);}(_0xdb28,0x106));var _0x8db2=function(_0x15213f,_0x549beb){_0x15213f=_0x15213f-0x0;var _0x48408d=_0xdb28[_0x15213f];return _0x48408d;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var FaxInteraction=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var FaxMessage=require(_0x8db2('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':_0x8db2('0x4'),'afterUpdate':_0x8db2('0x5'),'afterDestroy':_0x8db2('0x6')};function emitEvent(_0x11109e){return function(_0x52bf99,_0x21a03e,_0x1d2dd3){_0x52bf99['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x477f50){_0x52bf99[_0x8db2('0x7')](_0x8db2('0x8'),_0x477f50[_0x8db2('0x9')](function(_0x2f3f2f){return{'id':_0x2f3f2f['id']};}));return FaxMessage[_0x8db2('0xa')]({'where':{'FaxInteractionId':_0x52bf99['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8db2('0xb')](function(_0x4ba340){_0x52bf99[_0x8db2('0x7')](_0x8db2('0xc'),_0x4ba340[_0x8db2('0xd')]);FaxInteractionEvents['emit'](_0x11109e+':'+_0x52bf99['id'],_0x52bf99);FaxInteractionEvents[_0x8db2('0xe')](_0x11109e,_0x52bf99);_0x1d2dd3(null);})[_0x8db2('0xf')](_0x1d2dd3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x8db2('0x10')](e,emitEvent(event));}}module[_0x8db2('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0xc4aa=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','getUsers','then','setDataValue','findAll'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xc4aa[_0x273c39];return _0x46d6b5;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var FaxInteraction=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var FaxMessage=require(_0xac4a('0x1'))['db'][_0xac4a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xac4a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f48ed){return function(_0x15b967,_0x730a38,_0x215f39){_0x15b967[_0xac4a('0x5')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x6')](function(_0x3ef77c){_0x15b967[_0xac4a('0x7')]('Users',_0x3ef77c['map'](function(_0x1aba6d){return{'id':_0x1aba6d['id']};}));return FaxMessage[_0xac4a('0x8')]({'where':{'FaxInteractionId':_0x15b967['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac4a('0x6')](function(_0x4f4146){_0x15b967[_0xac4a('0x7')](_0xac4a('0x9'),_0x4f4146[_0xac4a('0xa')]);FaxInteractionEvents['emit'](_0x2f48ed+':'+_0x15b967['id'],_0x15b967);FaxInteractionEvents[_0xac4a('0xb')](_0x2f48ed,_0x15b967);_0x215f39(null);})['catch'](_0x215f39(null));};}for(var e in events){if(events[_0xac4a('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xac4a('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 54cdeeb..90fe17b 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 _0xa111=['moment','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','format','util','../../config/logger','api'];(function(_0x34ab94,_0x56b2e7){var _0x4c34c2=function(_0x34c0f3){while(--_0x34c0f3){_0x34ab94['push'](_0x34ab94['shift']());}};_0x4c34c2(++_0x56b2e7);}(_0xa111,0xde));var _0x1a11=function(_0x341f2a,_0x1f6bd1){_0x341f2a=_0x341f2a-0x0;var _0x42af16=_0xa111[_0x341f2a];return _0x42af16;};'use strict';var _=require('lodash');var util=require(_0x1a11('0x0'));var logger=require(_0x1a11('0x1'))(_0x1a11('0x2'));var moment=require(_0x1a11('0x3'));var BPromise=require('bluebird');var rp=require(_0x1a11('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a11('0x5'));var config=require(_0x1a11('0x6'));var attributes=require(_0x1a11('0x7'));module[_0x1a11('0x8')]=function(_0x2e4fee,_0x4d748c){return _0x2e4fee[_0x1a11('0x9')](_0x1a11('0xa'),attributes,{'tableName':_0x1a11('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40c6a2,_0x2bc7a9,_0x3c5319){if(_0x40c6a2[_0x1a11('0xc')](_0x1a11('0xd'))){_0x40c6a2['closedAt']=moment()[_0x1a11('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3c5319(null,_0x40c6a2);}}});}; \ No newline at end of file +var _0xf5f3=['moment','request-promise','path','rimraf','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api'];(function(_0x1753fc,_0x2be716){var _0x3edc2a=function(_0x436a6f){while(--_0x436a6f){_0x1753fc['push'](_0x1753fc['shift']());}};_0x3edc2a(++_0x2be716);}(_0xf5f3,0x177));var _0x3f5f=function(_0xc8dd60,_0x23deee){_0xc8dd60=_0xc8dd60-0x0;var _0x533e4c=_0xf5f3[_0xc8dd60];return _0x533e4c;};'use strict';var _=require(_0x3f5f('0x0'));var util=require('util');var logger=require(_0x3f5f('0x1'))(_0x3f5f('0x2'));var moment=require(_0x3f5f('0x3'));var BPromise=require('bluebird');var rp=require(_0x3f5f('0x4'));var fs=require('fs');var path=require(_0x3f5f('0x5'));var rimraf=require(_0x3f5f('0x6'));var config=require('../../config/environment');var attributes=require(_0x3f5f('0x7'));module['exports']=function(_0x3ca39e,_0x2a51b2){return _0x3ca39e[_0x3f5f('0x8')](_0x3f5f('0x9'),attributes,{'tableName':_0x3f5f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b5278,_0x34b2cc,_0x1ab46a){if(_0x2b5278[_0x3f5f('0xb')]('closed')){_0x2b5278[_0x3f5f('0xc')]=moment()['format'](_0x3f5f('0xd'));}_0x1ab46a(null,_0x2b5278);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 1e80483..d6531b8 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 _0x6162=['jayson/promise','client','redis','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxInteraction','body','options','raw','where','attributes','limit','UpdateFaxInteraction','debug','AddTagsToFaxInteraction','find','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xa1397e,_0x12d423){var _0x1ee271=function(_0x193864){while(--_0x193864){_0xa1397e['push'](_0xa1397e['shift']());}};_0x1ee271(++_0x12d423);}(_0x6162,0x77));var _0x2616=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x6162[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x2616('0x0'));var util=require(_0x2616('0x1'));var moment=require('moment');var BPromise=require(_0x2616('0x2'));var rs=require(_0x2616('0x3'));var fs=require('fs');var Redis=require(_0x2616('0x4'));var db=require(_0x2616('0x5'))['db'];var utils=require(_0x2616('0x6'));var logger=require(_0x2616('0x7'))(_0x2616('0x8'));var config=require(_0x2616('0x9'));var jayson=require(_0x2616('0xa'));var client=jayson[_0x2616('0xb')]['http']({'port':0x232a});config[_0x2616('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2616('0xd'))(new Redis(config[_0x2616('0xc')]));require(_0x2616('0xe'))[_0x2616('0xf')](socket);function respondWithRpcPromise(_0x31b914,_0x35d8f5,_0x24ba71){return new BPromise(function(_0x28379e,_0x3a1cca){return client[_0x2616('0x10')](_0x31b914,_0x24ba71)[_0x2616('0x11')](function(_0x14512f){logger[_0x2616('0x12')](_0x2616('0x13'),_0x35d8f5,'request\x20sent');logger['debug'](_0x2616('0x14'),_0x35d8f5,_0x2616('0x15'),JSON[_0x2616('0x16')](_0x14512f));if(_0x14512f[_0x2616('0x17')]){if(_0x14512f['error'][_0x2616('0x18')]===0x1f4){logger[_0x2616('0x17')](_0x2616('0x13'),_0x35d8f5,_0x14512f[_0x2616('0x17')][_0x2616('0x19')]);return _0x3a1cca(_0x14512f['error'][_0x2616('0x19')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x35d8f5,_0x14512f[_0x2616('0x17')][_0x2616('0x19')]);return _0x28379e(_0x14512f[_0x2616('0x17')]['message']);}else{logger[_0x2616('0x12')](_0x2616('0x13'),_0x35d8f5,'request\x20sent');_0x28379e(_0x14512f[_0x2616('0x1a')][_0x2616('0x19')]);}})[_0x2616('0x1b')](function(_0x6f9b38){logger[_0x2616('0x17')](_0x2616('0x13'),_0x35d8f5,_0x6f9b38);_0x3a1cca(_0x6f9b38);});});}exports['UpdateFaxInteraction']=function(_0x59db88){var _0x34fe6d=this;return new Promise(function(_0x3cd6ae,_0x259757){return db[_0x2616('0x1c')]['update'](_0x59db88[_0x2616('0x1d')],{'raw':_0x59db88['options']?_0x59db88[_0x2616('0x1e')][_0x2616('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59db88[_0x2616('0x1e')]?_0x59db88[_0x2616('0x1e')][_0x2616('0x20')]||null:null,'attributes':_0x59db88[_0x2616('0x1e')]?_0x59db88[_0x2616('0x1e')][_0x2616('0x21')]||null:null,'limit':_0x59db88['options']?_0x59db88['options'][_0x2616('0x22')]||null:null})['then'](function(_0x2a45b4){logger[_0x2616('0x12')](_0x2616('0x23'),_0x59db88);logger[_0x2616('0x24')]('UpdateFaxInteraction',_0x59db88,JSON[_0x2616('0x16')](_0x2a45b4));_0x3cd6ae(_0x2a45b4);})[_0x2616('0x1b')](function(_0x151f98){logger[_0x2616('0x17')]('UpdateFaxInteraction',_0x151f98['message'],_0x59db88);_0x259757(_0x34fe6d[_0x2616('0x17')](0x1f4,_0x151f98[_0x2616('0x19')]));});});};exports[_0x2616('0x25')]=function(_0x4cbb0c){return new Promise(function(_0x4b3b6c,_0x1e426e){return db[_0x2616('0x1c')][_0x2616('0x26')]({'where':_0x4cbb0c[_0x2616('0x1e')]?_0x4cbb0c['options']['where']||null:null})['then'](function(_0x128c3f){if(_0x128c3f){return _0x128c3f['addTags'](_0x4cbb0c[_0x2616('0x1d')]['ids'],_[_0x2616('0x27')](_0x4cbb0c[_0x2616('0x1d')],[_0x2616('0x28'),'id'])||{});}})[_0x2616('0x29')](function(_0x5c3e90){logger[_0x2616('0x12')](_0x2616('0x2a'),_0x4cbb0c);logger[_0x2616('0x24')](_0x2616('0x2a'),_0x4cbb0c,JSON['stringify'](_0x5c3e90));_0x4b3b6c(_0x5c3e90);})['catch'](function(_0x4888b1){logger[_0x2616('0x17')](_0x2616('0x2a'),_0x4888b1['message'],_0x4cbb0c);_0x1e426e(_this['error'](0x1f4,_0x4888b1[_0x2616('0x19')]));});});}; \ No newline at end of file +var _0xba17=['FaxInteraction','update','body','options','where','catch','AddTagsToFaxInteraction','addTags','ids','omit','spread','AddTags','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateFaxInteraction'];(function(_0x360fa9,_0x40e248){var _0x1bf5e6=function(_0x355d0e){while(--_0x355d0e){_0x360fa9['push'](_0x360fa9['shift']());}};_0x1bf5e6(++_0x40e248);}(_0xba17,0xac));var _0x7ba1=function(_0x3a7d1c,_0x184d91){_0x3a7d1c=_0x3a7d1c-0x0;var _0x287a84=_0xba17[_0x3a7d1c];return _0x287a84;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7ba1('0x0'));var BPromise=require('bluebird');var rs=require(_0x7ba1('0x1'));var fs=require('fs');var Redis=require(_0x7ba1('0x2'));var db=require(_0x7ba1('0x3'))['db'];var utils=require(_0x7ba1('0x4'));var logger=require(_0x7ba1('0x5'))(_0x7ba1('0x6'));var config=require('../../config/environment');var jayson=require(_0x7ba1('0x7'));var client=jayson[_0x7ba1('0x8')][_0x7ba1('0x9')]({'port':0x232a});config[_0x7ba1('0xa')]=_[_0x7ba1('0xb')](config[_0x7ba1('0xa')],{'host':_0x7ba1('0xc'),'port':0x18eb});var socket=require(_0x7ba1('0xd'))(new Redis(config[_0x7ba1('0xa')]));require(_0x7ba1('0xe'))[_0x7ba1('0xf')](socket);function respondWithRpcPromise(_0x35c4a6,_0x404604,_0x2ae985){return new BPromise(function(_0x1b44a5,_0x254202){return client[_0x7ba1('0x10')](_0x35c4a6,_0x2ae985)[_0x7ba1('0x11')](function(_0x23be97){logger[_0x7ba1('0x12')](_0x7ba1('0x13'),_0x404604,_0x7ba1('0x14'));logger[_0x7ba1('0x15')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x404604,'request\x20sent',JSON[_0x7ba1('0x16')](_0x23be97));if(_0x23be97[_0x7ba1('0x17')]){if(_0x23be97[_0x7ba1('0x17')][_0x7ba1('0x18')]===0x1f4){logger['error'](_0x7ba1('0x13'),_0x404604,_0x23be97[_0x7ba1('0x17')][_0x7ba1('0x19')]);return _0x254202(_0x23be97[_0x7ba1('0x17')][_0x7ba1('0x19')]);}logger[_0x7ba1('0x17')](_0x7ba1('0x13'),_0x404604,_0x23be97[_0x7ba1('0x17')]['message']);return _0x1b44a5(_0x23be97[_0x7ba1('0x17')][_0x7ba1('0x19')]);}else{logger[_0x7ba1('0x12')](_0x7ba1('0x13'),_0x404604,_0x7ba1('0x14'));_0x1b44a5(_0x23be97[_0x7ba1('0x1a')]['message']);}})['catch'](function(_0x20e82e){logger[_0x7ba1('0x17')](_0x7ba1('0x13'),_0x404604,_0x20e82e);_0x254202(_0x20e82e);});});}exports[_0x7ba1('0x1b')]=function(_0x5d1251){var _0x4dd84b=this;return new Promise(function(_0x229a25,_0x25d892){return db[_0x7ba1('0x1c')][_0x7ba1('0x1d')](_0x5d1251[_0x7ba1('0x1e')],{'raw':_0x5d1251[_0x7ba1('0x1f')]?_0x5d1251['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d1251[_0x7ba1('0x1f')]?_0x5d1251[_0x7ba1('0x1f')][_0x7ba1('0x20')]||null:null,'attributes':_0x5d1251['options']?_0x5d1251[_0x7ba1('0x1f')]['attributes']||null:null,'limit':_0x5d1251[_0x7ba1('0x1f')]?_0x5d1251['options']['limit']||null:null})[_0x7ba1('0x11')](function(_0x498f0e){logger['info'](_0x7ba1('0x1b'),_0x5d1251);logger[_0x7ba1('0x15')]('UpdateFaxInteraction',_0x5d1251,JSON[_0x7ba1('0x16')](_0x498f0e));_0x229a25(_0x498f0e);})[_0x7ba1('0x21')](function(_0x103e6b){logger['error'](_0x7ba1('0x1b'),_0x103e6b[_0x7ba1('0x19')],_0x5d1251);_0x25d892(_0x4dd84b[_0x7ba1('0x17')](0x1f4,_0x103e6b[_0x7ba1('0x19')]));});});};exports[_0x7ba1('0x22')]=function(_0x155cbd){return new Promise(function(_0x5186bd,_0x4cf5f0){return db['FaxInteraction']['find']({'where':_0x155cbd[_0x7ba1('0x1f')]?_0x155cbd['options'][_0x7ba1('0x20')]||null:null})['then'](function(_0x2273d0){if(_0x2273d0){return _0x2273d0[_0x7ba1('0x23')](_0x155cbd[_0x7ba1('0x1e')][_0x7ba1('0x24')],_[_0x7ba1('0x25')](_0x155cbd[_0x7ba1('0x1e')],['ids','id'])||{});}})[_0x7ba1('0x26')](function(_0x5e078c){logger[_0x7ba1('0x12')]('AddTags',_0x155cbd);logger['debug'](_0x7ba1('0x27'),_0x155cbd,JSON[_0x7ba1('0x16')](_0x5e078c));_0x5186bd(_0x5e078c);})[_0x7ba1('0x21')](function(_0x4e516a){logger[_0x7ba1('0x17')]('AddTags',_0x4e516a['message'],_0x155cbd);_0x4cf5f0(_this['error'](0x1f4,_0x4e516a[_0x7ba1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 41533d9..1bfe564 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 _0x1e8b=['./faxInteraction.events','remove','removeListener','register','length','faxInteraction:'];(function(_0x4227de,_0x5de933){var _0x6c4716=function(_0x15577b){while(--_0x15577b){_0x4227de['push'](_0x4227de['shift']());}};_0x6c4716(++_0x5de933);}(_0x1e8b,0x15c));var _0xb1e8=function(_0x4cf769,_0x476fd9){_0x4cf769=_0x4cf769-0x0;var _0x2232ad=_0x1e8b[_0x4cf769];return _0x2232ad;};'use strict';var FaxInteractionEvents=require(_0xb1e8('0x0'));var events=['save',_0xb1e8('0x1'),'update'];function createListener(_0xc012da,_0x35624c){return function(_0x2e8ce2){_0x35624c['emit'](_0xc012da,_0x2e8ce2);};}function removeListener(_0x2e05a0,_0x13de3e){return function(){FaxInteractionEvents[_0xb1e8('0x2')](_0x2e05a0,_0x13de3e);};}exports[_0xb1e8('0x3')]=function(_0xca8595){for(var _0x38cf94=0x0,_0x3c8732=events[_0xb1e8('0x4')];_0x38cf94<_0x3c8732;_0x38cf94++){var _0x2ed8ef=events[_0x38cf94];var _0x1f22ba=createListener(_0xb1e8('0x5')+_0x2ed8ef,_0xca8595);FaxInteractionEvents['on'](_0x2ed8ef,_0x1f22ba);}}; \ No newline at end of file +var _0xfa9b=['./faxInteraction.events','update','emit','removeListener','register','length','faxInteraction:'];(function(_0x6d8f9d,_0x239dc4){var _0x3eee3f=function(_0xf3a913){while(--_0xf3a913){_0x6d8f9d['push'](_0x6d8f9d['shift']());}};_0x3eee3f(++_0x239dc4);}(_0xfa9b,0xf5));var _0xbfa9=function(_0x134c52,_0x587329){_0x134c52=_0x134c52-0x0;var _0x3720be=_0xfa9b[_0x134c52];return _0x3720be;};'use strict';var FaxInteractionEvents=require(_0xbfa9('0x0'));var events=['save','remove',_0xbfa9('0x1')];function createListener(_0x4a35e2,_0x25f90f){return function(_0x32c253){_0x25f90f[_0xbfa9('0x2')](_0x4a35e2,_0x32c253);};}function removeListener(_0x5456d0,_0x3c6e7c){return function(){FaxInteractionEvents[_0xbfa9('0x3')](_0x5456d0,_0x3c6e7c);};}exports[_0xbfa9('0x4')]=function(_0x8a5eb6){for(var _0x3de725=0x0,_0x4c4ad2=events[_0xbfa9('0x5')];_0x3de725<_0x4c4ad2;_0x3de725++){var _0xd2a11e=events[_0x3de725];var _0x55d9c5=createListener(_0xbfa9('0x6')+_0xd2a11e,_0x8a5eb6);FaxInteractionEvents['on'](_0xd2a11e,_0x55d9c5);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 20d9351..c721d44 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 _0x4764=['update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','tracked','faxinteraction:addtags','put','fax','faxinteraction:update'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x4764,0x14f));var _0x4476=function(_0x3dd57e,_0x23ab11){_0x3dd57e=_0x3dd57e-0x0;var _0x4ab65f=_0x4764[_0x3dd57e];return _0x4ab65f;};'use strict';var multer=require(_0x4476('0x0'));var util=require(_0x4476('0x1'));var path=require(_0x4476('0x2'));var timeout=require(_0x4476('0x3'));var express=require('express');var router=express[_0x4476('0x4')]();var auth=require(_0x4476('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4476('0x6'));var controller=require(_0x4476('0x7'));router[_0x4476('0x8')]('/',auth[_0x4476('0x9')](),controller[_0x4476('0xa')]);router[_0x4476('0x8')]('/describe',auth[_0x4476('0x9')](),controller[_0x4476('0xb')]);router['get'](_0x4476('0xc'),auth[_0x4476('0x9')](),controller[_0x4476('0xd')]);router[_0x4476('0x8')](_0x4476('0xe'),auth[_0x4476('0x9')](),controller['getMessages']);router[_0x4476('0x8')](_0x4476('0xf'),auth[_0x4476('0x9')](),controller[_0x4476('0x10')]);router[_0x4476('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4476('0x11')](_0x4476('0xe'),auth[_0x4476('0x9')](),controller[_0x4476('0x12')]);router['post'](_0x4476('0x13'),auth[_0x4476('0x9')](),interaction[_0x4476('0x14')]('fax',_0x4476('0x15')),controller['addTags']);router[_0x4476('0x16')]('/:id',auth[_0x4476('0x9')](),interaction[_0x4476('0x14')](_0x4476('0x17'),_0x4476('0x18')),controller[_0x4476('0x19')]);router[_0x4476('0x1a')](_0x4476('0xc'),auth[_0x4476('0x9')](),interaction[_0x4476('0x14')](_0x4476('0x17'),'faxinteraction:destroy'),controller[_0x4476('0x1b')]);router[_0x4476('0x1a')](_0x4476('0x13'),auth[_0x4476('0x9')](),controller[_0x4476('0x1c')]);module[_0x4476('0x1d')]=router; \ No newline at end of file +var _0xa87e=['util','path','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','/describe','describe','/:id','show','/:id/messages','isAuthenticated','/:id/download','download','create','post','addMessage','fax','addTags','put','tracked','faxinteraction:update','update','faxinteraction:destroy','destroy','removeTags'];(function(_0x40b7fc,_0x51c685){var _0xe7387a=function(_0x3a9c1d){while(--_0x3a9c1d){_0x40b7fc['push'](_0x40b7fc['shift']());}};_0xe7387a(++_0x51c685);}(_0xa87e,0x118));var _0xea87=function(_0x4fbee5,_0x53e8da){_0x4fbee5=_0x4fbee5-0x0;var _0x3426e8=_0xa87e[_0x4fbee5];return _0x3426e8;};'use strict';var multer=require('multer');var util=require(_0xea87('0x0'));var path=require(_0xea87('0x1'));var timeout=require('connect-timeout');var express=require(_0xea87('0x2'));var router=express[_0xea87('0x3')]();var auth=require(_0xea87('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xea87('0x5'));var controller=require(_0xea87('0x6'));router[_0xea87('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xea87('0x7')](_0xea87('0x8'),auth['isAuthenticated'](),controller[_0xea87('0x9')]);router['get'](_0xea87('0xa'),auth['isAuthenticated'](),controller[_0xea87('0xb')]);router['get'](_0xea87('0xc'),auth[_0xea87('0xd')](),controller['getMessages']);router['get'](_0xea87('0xe'),auth[_0xea87('0xd')](),controller[_0xea87('0xf')]);router['post']('/',auth[_0xea87('0xd')](),controller[_0xea87('0x10')]);router[_0xea87('0x11')](_0xea87('0xc'),auth[_0xea87('0xd')](),controller[_0xea87('0x12')]);router[_0xea87('0x11')]('/:id/tags',auth[_0xea87('0xd')](),interaction['tracked'](_0xea87('0x13'),'faxinteraction:addtags'),controller[_0xea87('0x14')]);router[_0xea87('0x15')](_0xea87('0xa'),auth['isAuthenticated'](),interaction[_0xea87('0x16')](_0xea87('0x13'),_0xea87('0x17')),controller[_0xea87('0x18')]);router['delete'](_0xea87('0xa'),auth['isAuthenticated'](),interaction[_0xea87('0x16')](_0xea87('0x13'),_0xea87('0x19')),controller[_0xea87('0x1a')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0xea87('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index f30bb8c..727976e 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 _0x6b56=['TEXT','DATE','exports','medium','BOOLEAN','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b56,0xf8));var _0x66b5=function(_0x34882f,_0x601a99){_0x34882f=_0x34882f-0x0;var _0x455929=_0x6b56[_0x34882f];return _0x455929;};'use strict';var Sequelize=require('sequelize');module[_0x66b5('0x0')]={'body':{'type':Sequelize['TEXT'](_0x66b5('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x66b5('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x66b5('0x3')),'defaultValue':_0x66b5('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x66b5('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0x66b5('0x5')]}}; \ No newline at end of file +var _0x9867=['out','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0xe7929f,_0x5a34fe){var _0x3c2962=function(_0xc75e66){while(--_0xc75e66){_0xe7929f['push'](_0xe7929f['shift']());}};_0x3c2962(++_0x5a34fe);}(_0x9867,0x64));var _0x7986=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9867[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x7986('0x0'));module[_0x7986('0x1')]={'body':{'type':Sequelize[_0x7986('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7986('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7986('0x4')]('in',_0x7986('0x5')),'defaultValue':_0x7986('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x7986('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index b0e9026..98247a2 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 _0x5c53=['join','server','attachments','Attachment','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','client','http','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~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','FaxMessage,\x20%s,\x20%s','message','info','catch','sendStatus','status','json','offset','limit','apply','reject','update','end','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','params','include','find','body','destroy','../../config/logger','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','FaxInteraction','FaxInteractionId','isNil','read1stAt','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','manual','interface','channel','EventManager','acceptmessage','fax-interactions','agent','role','RejectMessage','rejectMessage','event','create','findOne','ContactId','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download'];(function(_0x8e7879,_0x5059c2){var _0x22e95e=function(_0x432d9e){while(--_0x432d9e){_0x8e7879['push'](_0x8e7879['shift']());}};_0x22e95e(++_0x5059c2);}(_0x5c53,0x83));var _0x35c5=function(_0x4d966b,_0x4e96ed){_0x4d966b=_0x4d966b-0x0;var _0x57cfc0=_0x5c53[_0x4d966b];return _0x57cfc0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x35c5('0x0'));var rp=require(_0x35c5('0x1'));var moment=require(_0x35c5('0x2'));var BPromise=require(_0x35c5('0x3'));var Mustache=require(_0x35c5('0x4'));var util=require(_0x35c5('0x5'));var path=require(_0x35c5('0x6'));var sox=require(_0x35c5('0x7'));var csv=require(_0x35c5('0x8'));var ejs=require(_0x35c5('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x35c5('0xa'));var crypto=require(_0x35c5('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x35c5('0x8'));var querystring=require(_0x35c5('0xc'));var Papa=require(_0x35c5('0xd'));var Redis=require(_0x35c5('0xe'));var authService=require(_0x35c5('0xf'));var qs=require(_0x35c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35c5('0x11'));var logger=require('../../config/logger')(_0x35c5('0x12'));var utils=require('../../config/utils');var config=require(_0x35c5('0x13'));var db=require(_0x35c5('0x14'))['db'];config[_0x35c5('0x15')]=_[_0x35c5('0x16')](config[_0x35c5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x35c5('0x17'))(new Redis(config[_0x35c5('0x15')]));require(_0x35c5('0x18'))[_0x35c5('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x35c5('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x35c5('0x1a')][_0x35c5('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x444f56,_0x5b362b,_0x2b9ca9){if(_0x2b9ca9){var _0x3af2f8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3af2f8[_0x35c5('0x1c')](_0x5b362b)){return _0x444f56;}else{throw new db[(_0x35c5('0x1d'))][(_0x35c5('0x1e'))](_0x35c5('0x1f'));}}else{return _0x444f56;}}function respondWithRpcPromise(_0x15cd26,_0x3a9ccf,_0x11b0b4,_0x16e185){return new BPromise(function(_0x19eaa3,_0x291bc8){var _0x897502=_0x16e185||client;return _0x897502[_0x35c5('0x20')](_0x15cd26,_0x11b0b4)[_0x35c5('0x21')](function(_0x126ae5){logger['info']('FaxMessage,\x20%s,\x20%s',_0x3a9ccf,_0x35c5('0x22'));logger[_0x35c5('0x23')](_0x35c5('0x24'),_0x3a9ccf,'request\x20sent',JSON['stringify'](_0x126ae5));if(_0x126ae5[_0x35c5('0x25')]){if(_0x126ae5['error']['code']===0x1f4){logger[_0x35c5('0x25')](_0x35c5('0x26'),_0x3a9ccf,_0x126ae5[_0x35c5('0x25')]['message']);return _0x291bc8(_0x126ae5[_0x35c5('0x25')][_0x35c5('0x27')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x3a9ccf,_0x126ae5[_0x35c5('0x25')][_0x35c5('0x27')]);return _0x19eaa3(_0x126ae5[_0x35c5('0x25')]['message']);}else{logger[_0x35c5('0x28')]('FaxMessage,\x20%s,\x20%s',_0x3a9ccf,_0x35c5('0x22'));_0x19eaa3(_0x126ae5['result'][_0x35c5('0x27')]);}})[_0x35c5('0x29')](function(_0x3c080c){logger[_0x35c5('0x25')]('FaxMessage,\x20%s,\x20%s',_0x3a9ccf,_0x3c080c);_0x291bc8(_0x3c080c);});});}function respondWithStatusCode(_0x495fd6,_0x568a97){_0x568a97=_0x568a97||0xcc;return function(_0x506ca6){if(_0x506ca6){return _0x495fd6[_0x35c5('0x2a')](_0x568a97);}return _0x495fd6[_0x35c5('0x2b')](_0x568a97)['end']();};}function respondWithResult(_0x149c80,_0x2301dc){_0x2301dc=_0x2301dc||0xc8;return function(_0x10b88b){if(_0x10b88b){return _0x149c80['status'](_0x2301dc)[_0x35c5('0x2c')](_0x10b88b);}};}function respondWithFilteredResult(_0x4d1ac6,_0x42e060){return function(_0x4ada67){if(_0x4ada67){var _0x2371b3=_0x4ada67['count'],_0x2a40d7=_0x42e060['offset'],_0x43c34d=_0x42e060[_0x35c5('0x2d')]+_0x42e060[_0x35c5('0x2e')],_0x166e2a;if(_0x43c34d>=_0x2371b3){_0x43c34d=_0x2371b3;_0x166e2a=0xc8;}else{_0x166e2a=0xce;}_0x4d1ac6[_0x35c5('0x2b')](_0x166e2a);return _0x4d1ac6['set']('Content-Range',_0x2a40d7+'-'+_0x43c34d+'/'+_0x2371b3)[_0x35c5('0x2c')](_0x4ada67);}return null;};}function patchUpdates(_0x576cf7){return function(_0x50e059){try{jsonpatch[_0x35c5('0x2f')](_0x50e059,_0x576cf7,!![]);}catch(_0x240f76){return BPromise[_0x35c5('0x30')](_0x240f76);}return _0x50e059['save']();};}function saveUpdates(_0x3532d0,_0x1c5a3c){return function(_0x5c5051){if(_0x5c5051){return _0x5c5051[_0x35c5('0x31')](_0x3532d0)[_0x35c5('0x21')](function(_0x1bd3de){return _0x1bd3de;});}return null;};}function removeEntity(_0x1b6005,_0x23d1cb){return function(_0x57a626){if(_0x57a626){return _0x57a626['destroy']()[_0x35c5('0x21')](function(){_0x1b6005[_0x35c5('0x2b')](0xcc)[_0x35c5('0x32')]();});}};}function handleEntityNotFound(_0x5a3f5b,_0xabd546){return function(_0x473223){if(!_0x473223){_0x5a3f5b['sendStatus'](0x194);}return _0x473223;};}function handleError(_0xeb148d,_0x2aad16){_0x2aad16=_0x2aad16||0x1f4;return function(_0x50d4f7){logger[_0x35c5('0x25')](_0x50d4f7[_0x35c5('0x33')]);if(_0x50d4f7[_0x35c5('0x34')]){delete _0x50d4f7['name'];}_0xeb148d['status'](_0x2aad16)['send'](_0x50d4f7);};}exports[_0x35c5('0x35')]=function(_0x21da56,_0x582436){var _0x4cecc4={},_0x1981f9={},_0x25e2d4={'count':0x0,'rows':[]};var _0x2f3730=_[_0x35c5('0x36')](db[_0x35c5('0x37')][_0x35c5('0x38')],function(_0x4a716f){return{'name':_0x4a716f[_0x35c5('0x39')],'type':_0x4a716f[_0x35c5('0x3a')][_0x35c5('0x3b')]};});_0x1981f9[_0x35c5('0x3c')]=_[_0x35c5('0x36')](_0x2f3730,_0x35c5('0x34'));_0x1981f9[_0x35c5('0x3d')]=_[_0x35c5('0x3e')](_0x21da56['query']);_0x1981f9[_0x35c5('0x3f')]=_[_0x35c5('0x40')](_0x1981f9[_0x35c5('0x3c')],_0x1981f9[_0x35c5('0x3d')]);_0x4cecc4[_0x35c5('0x41')]=_[_0x35c5('0x40')](_0x1981f9[_0x35c5('0x3c')],qs[_0x35c5('0x42')](_0x21da56[_0x35c5('0x3d')][_0x35c5('0x42')]));_0x4cecc4[_0x35c5('0x41')]=_0x4cecc4[_0x35c5('0x41')]['length']?_0x4cecc4[_0x35c5('0x41')]:_0x1981f9[_0x35c5('0x3c')];if(!_0x21da56[_0x35c5('0x3d')]['hasOwnProperty'](_0x35c5('0x43'))){_0x4cecc4[_0x35c5('0x2e')]=qs[_0x35c5('0x2e')](_0x21da56[_0x35c5('0x3d')][_0x35c5('0x2e')]);_0x4cecc4['offset']=qs[_0x35c5('0x2d')](_0x21da56['query'][_0x35c5('0x2d')]);}_0x4cecc4['order']=qs['sort'](_0x21da56[_0x35c5('0x3d')][_0x35c5('0x44')]);_0x4cecc4['where']=qs[_0x35c5('0x3f')](_[_0x35c5('0x45')](_0x21da56['query'],_0x1981f9['filters']),_0x2f3730);if(_0x21da56['query'][_0x35c5('0x46')]){_0x4cecc4[_0x35c5('0x47')]=_[_0x35c5('0x48')](_0x4cecc4[_0x35c5('0x47')],{'$or':_[_0x35c5('0x36')](_0x2f3730,function(_0x38e8dc){if(_0x38e8dc[_0x35c5('0x3a')]!==_0x35c5('0x49')){var _0x18e0ae={};_0x18e0ae[_0x38e8dc['name']]={'$like':'%'+_0x21da56[_0x35c5('0x3d')][_0x35c5('0x46')]+'%'};return _0x18e0ae;}})});}_0x4cecc4=_[_0x35c5('0x48')]({},_0x4cecc4,_0x21da56[_0x35c5('0x4a')]);var _0x4c8509={'where':_0x4cecc4[_0x35c5('0x47')]};return db['FaxMessage'][_0x35c5('0x4b')](_0x4c8509)[_0x35c5('0x21')](function(_0x17550f){_0x25e2d4[_0x35c5('0x4b')]=_0x17550f;if(_0x21da56['query'][_0x35c5('0x4c')]){_0x4cecc4['include']=[{'all':!![]}];}return db[_0x35c5('0x37')][_0x35c5('0x4d')](_0x4cecc4);})[_0x35c5('0x21')](function(_0x5a7c86){_0x25e2d4[_0x35c5('0x4e')]=_0x5a7c86;return _0x25e2d4;})[_0x35c5('0x21')](respondWithFilteredResult(_0x582436,_0x4cecc4))[_0x35c5('0x29')](handleError(_0x582436,null));};exports['show']=function(_0x17f387,_0x1f128e){var _0x4bbf1e={'raw':!![],'where':{'id':_0x17f387[_0x35c5('0x4f')]['id']}},_0x5ccf52={};_0x5ccf52['model']=_[_0x35c5('0x3e')](db[_0x35c5('0x37')][_0x35c5('0x38')]);_0x5ccf52[_0x35c5('0x3d')]=_[_0x35c5('0x3e')](_0x17f387['query']);_0x5ccf52['filters']=_[_0x35c5('0x40')](_0x5ccf52[_0x35c5('0x3c')],_0x5ccf52[_0x35c5('0x3d')]);_0x4bbf1e[_0x35c5('0x41')]=_[_0x35c5('0x40')](_0x5ccf52[_0x35c5('0x3c')],qs[_0x35c5('0x42')](_0x17f387[_0x35c5('0x3d')]['fields']));_0x4bbf1e['attributes']=_0x4bbf1e[_0x35c5('0x41')]['length']?_0x4bbf1e['attributes']:_0x5ccf52['model'];if(_0x17f387['query']['includeAll']){_0x4bbf1e[_0x35c5('0x50')]=[{'all':!![]}];}_0x4bbf1e=_[_0x35c5('0x48')]({},_0x4bbf1e,_0x17f387[_0x35c5('0x4a')]);return db[_0x35c5('0x37')][_0x35c5('0x51')](_0x4bbf1e)['then'](handleEntityNotFound(_0x1f128e,null))['then'](respondWithResult(_0x1f128e,null))[_0x35c5('0x29')](handleError(_0x1f128e,null));};exports['update']=function(_0x8dc905,_0x1b8beb){if(_0x8dc905[_0x35c5('0x52')]['id']){delete _0x8dc905['body']['id'];}return db[_0x35c5('0x37')][_0x35c5('0x51')]({'where':{'id':_0x8dc905['params']['id']}})[_0x35c5('0x21')](handleEntityNotFound(_0x1b8beb,null))[_0x35c5('0x21')](saveUpdates(_0x8dc905[_0x35c5('0x52')],null))[_0x35c5('0x21')](respondWithResult(_0x1b8beb,null))[_0x35c5('0x29')](handleError(_0x1b8beb,null));};exports[_0x35c5('0x53')]=function(_0x476aaa,_0x3ad143){return db[_0x35c5('0x37')]['find']({'where':{'id':_0x476aaa[_0x35c5('0x4f')]['id']}})[_0x35c5('0x21')](handleEntityNotFound(_0x3ad143,null))['then'](removeEntity(_0x3ad143,null))[_0x35c5('0x29')](handleError(_0x3ad143,null));};exports['describe']=function(_0x4e5056,_0x1724a0){return db[_0x35c5('0x37')]['describe']()[_0x35c5('0x21')](respondWithResult(_0x1724a0,null))[_0x35c5('0x29')](handleError(_0x1724a0,null));};var interaction_log=require(_0x35c5('0x54'))('fax-interactions');exports[_0x35c5('0x55')]=function(_0x2e5718,_0x504a32,_0x197a01){var _0x2242d5={'channel':_0x35c5('0x56')};if(_0x2e5718['body']['id']){delete _0x2e5718[_0x35c5('0x52')]['id'];}_0x2e5718[_0x35c5('0x52')][_0x35c5('0x57')]=!![];_0x2e5718[_0x35c5('0x52')]['readAt']=moment()[_0x35c5('0x58')](_0x35c5('0x59'));_0x2e5718[_0x35c5('0x52')][_0x35c5('0x5a')]=_0x2e5718[_0x35c5('0x52')][_0x35c5('0x5a')]||_0x2e5718[_0x35c5('0x5b')]['id'];return db['FaxMessage']['find']({'where':{'id':_0x2e5718[_0x35c5('0x4f')]['id'],'UserId':null},'include':[{'model':db[_0x35c5('0x5c')],'as':'Contact'}]})[_0x35c5('0x21')](handleEntityNotFound(_0x504a32,null))['then'](saveUpdates(_0x2e5718[_0x35c5('0x52')],null))[_0x35c5('0x21')](function(_0x18ef89){if(_0x18ef89){_0x2242d5['message']=_0x18ef89['get']({'plain':!![]});return db[_0x35c5('0x5d')][_0x35c5('0x51')]({'where':{'id':_0x18ef89[_0x35c5('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x504a32,null))[_0x35c5('0x21')](function(_0x4fa285){if(_0x4fa285){return _0x4fa285[_0x35c5('0x31')]({'UserId':_0x2e5718[_0x35c5('0x52')][_0x35c5('0x5a')],'read1stAt':_[_0x35c5('0x5f')](_0x4fa285[_0x35c5('0x60')])?moment()[_0x35c5('0x58')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x35c5('0x21')](function(_0x4fe725){if(_0x4fe725){_0x2242d5['interaction']=_0x4fe725[_0x35c5('0x61')]({'plain':!![]});interaction_log[_0x35c5('0x28')](_0x35c5('0x62'),_0x2e5718[_0x35c5('0x5b')]['id'],_0x2e5718['user'][_0x35c5('0x34')],_0x2e5718[_0x35c5('0x5b')]['role'],_0x2242d5[_0x35c5('0x63')]['id'],_0x2e5718[_0x35c5('0x52')]?JSON[_0x35c5('0x64')](_0x2e5718['body']):_0x35c5('0x65'));return respondWithRpcPromise(_0x35c5('0x66'),'acceptMessage',_0x2242d5);}return null;})[_0x35c5('0x21')](function(_0x2e9afc){if(_0x2e9afc){if(_0x2e5718[_0x35c5('0x52')][_0x35c5('0x67')]){_0x2242d5[_0x35c5('0x27')][_0x35c5('0x68')]=util[_0x35c5('0x58')]('SIP/%s',_0x2e5718[_0x35c5('0x5b')][_0x35c5('0x34')]);_0x2242d5['message'][_0x35c5('0x69')]=_0x2242d5[_0x35c5('0x69')];_0x2242d5['message']['event']='accept';return respondWithRpcPromise(_0x35c5('0x6a'),_0x35c5('0x6a'),{'event':_0x35c5('0x6b'),'message':_0x2242d5[_0x35c5('0x27')]},client9002)['then'](function(){return _0x2242d5;});}return _0x2242d5;}return null;})[_0x35c5('0x21')](respondWithResult(_0x504a32,null))[_0x35c5('0x29')](handleError(_0x504a32,null));};var interaction_log=require(_0x35c5('0x54'))(_0x35c5('0x6c'));exports[_0x35c5('0x30')]=function(_0x9f040b,_0x19e5fe,_0xa4c0da){var _0x42d9e7={'agent':{},'channel':'fax'};if(_0x9f040b['body']['id']){delete _0x9f040b['body']['id'];}_0x9f040b['body']['UserId']=_0x9f040b['body'][_0x35c5('0x5a')]||_0x9f040b[_0x35c5('0x5b')]['id'];_0x42d9e7[_0x35c5('0x6d')]['id']=_0x9f040b[_0x35c5('0x52')][_0x35c5('0x5a')];return db[_0x35c5('0x37')][_0x35c5('0x51')]({'where':{'id':_0x9f040b['params']['id'],'UserId':null}})[_0x35c5('0x21')](handleEntityNotFound(_0x19e5fe,null))['then'](function(_0x16e324){if(_0x16e324){_0x42d9e7[_0x35c5('0x27')]=_0x16e324[_0x35c5('0x61')]({'plain':!![]});return db[_0x35c5('0x5d')]['find']({'where':{'id':_0x16e324[_0x35c5('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x19e5fe,null))[_0x35c5('0x21')](function(_0x18ad56){if(_0x18ad56){_0x42d9e7[_0x35c5('0x63')]=_0x18ad56['get']({'plain':!![]});interaction_log[_0x35c5('0x28')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x9f040b['user']['id'],_0x9f040b[_0x35c5('0x5b')]['name'],_0x9f040b[_0x35c5('0x5b')][_0x35c5('0x6e')],_0x42d9e7[_0x35c5('0x63')]['id'],_0x9f040b[_0x35c5('0x52')]?JSON[_0x35c5('0x64')](_0x9f040b[_0x35c5('0x52')]):'null');return respondWithRpcPromise(_0x35c5('0x6f'),_0x35c5('0x70'),_0x42d9e7);}return null;})[_0x35c5('0x21')](function(_0x7f1fc5){if(_0x7f1fc5){_0x7f1fc5[_0x35c5('0x27')][_0x35c5('0x68')]=util['format']('SIP/%s',_0x9f040b['user'][_0x35c5('0x34')]);_0x7f1fc5[_0x35c5('0x27')][_0x35c5('0x69')]=_0x42d9e7[_0x35c5('0x69')];_0x7f1fc5[_0x35c5('0x27')][_0x35c5('0x71')]=_0x35c5('0x30');respondWithRpcPromise(_0x35c5('0x6a'),_0x35c5('0x6a'),{'event':'rejectmessage','message':_0x7f1fc5['message']},client9002);return _0x42d9e7;}return null;})[_0x35c5('0x21')](respondWithResult(_0x19e5fe,null))[_0x35c5('0x29')](handleError(_0x19e5fe,null));};exports['create']=function(_0x2d8e15,_0x261888){var _0x4b01ac;return db['FaxMessage'][_0x35c5('0x72')](_0x2d8e15[_0x35c5('0x52')],{})[_0x35c5('0x21')](function(_0x26f13b){_0x4b01ac=_0x26f13b;return db[_0x35c5('0x5c')][_0x35c5('0x73')]({'where':{'id':_0x4b01ac[_0x35c5('0x74')]}});})[_0x35c5('0x21')](function(_0x44567e){if(_[_0x35c5('0x5f')](_0x44567e)){return;}else{_0x4b01ac[_0x35c5('0x56')]=_0x44567e[_0x35c5('0x56')];return db['Attachment'][_0x35c5('0x73')]({'where':{'id':_0x4b01ac[_0x35c5('0x75')]}});}})[_0x35c5('0x21')](function(_0x4414a2){return respondWithRpcPromise('SendFax',_0x35c5('0x76'),{'FaxAccountId':_[_0x35c5('0x5f')](_0x2d8e15[_0x35c5('0x52')])?undefined:_0x2d8e15[_0x35c5('0x52')][_0x35c5('0x77')],'path':_[_0x35c5('0x5f')](_0x4414a2)?undefined:util[_0x35c5('0x58')](_0x35c5('0x78'),_0x4414a2[_0x35c5('0x79')]),'fax':_[_0x35c5('0x5f')](_0x4b01ac[_0x35c5('0x56')])?undefined:_0x4b01ac[_0x35c5('0x56')],'AttachmentId':_0x4b01ac[_0x35c5('0x75')]},client9002);})['then'](respondWithResult(_0x261888,0xc9))[_0x35c5('0x29')](handleError(_0x261888,null));};exports[_0x35c5('0x7a')]=function(_0x1e4906,_0x11bb79){var _0x3d0cb8=path[_0x35c5('0x7b')](config['root'],_0x35c5('0x7c'),'files',_0x35c5('0x7d'));return db[_0x35c5('0x37')][_0x35c5('0x51')]({'where':{'id':_0x1e4906[_0x35c5('0x4f')]['id']},'include':[{'model':db[_0x35c5('0x7e')],'as':_0x35c5('0x7e')}]})['then'](handleEntityNotFound(_0x11bb79,null))[_0x35c5('0x21')](function(_0x430ad4){if(_0x430ad4){return _0x11bb79['download'](path[_0x35c5('0x7b')](_0x3d0cb8,_0x430ad4[_0x35c5('0x7e')]['basename']));}})['catch'](handleError(_0x11bb79,null));}; \ No newline at end of file +var _0x8e41=['show','includeAll','find','update','body','params','describe','fax-interactions','accept','fax','readAt','UserId','CmContact','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','manual','channel','event','EventManager','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','create','findOne','ContactId','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','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','redis','defaults','localhost','register','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','destroy','stack','name','send','map','FaxMessage','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x8e41,0xb7));var _0x18e4=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x8e41[_0x50007c];return _0x5c1ec7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x18e4('0x0'));var rimraf=require(_0x18e4('0x1'));var zipdir=require(_0x18e4('0x2'));var jsonpatch=require(_0x18e4('0x3'));var rp=require(_0x18e4('0x4'));var moment=require('moment');var BPromise=require(_0x18e4('0x5'));var Mustache=require('mustache');var util=require(_0x18e4('0x6'));var path=require(_0x18e4('0x7'));var sox=require('sox');var csv=require(_0x18e4('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x18e4('0x9'));var squel=require(_0x18e4('0xa'));var crypto=require(_0x18e4('0xb'));var jsforce=require(_0x18e4('0xc'));var deskjs=require(_0x18e4('0xd'));var toCsv=require(_0x18e4('0x8'));var querystring=require(_0x18e4('0xe'));var Papa=require(_0x18e4('0xf'));var Redis=require(_0x18e4('0x10'));var authService=require(_0x18e4('0x11'));var qs=require(_0x18e4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x18e4('0x13'));var logger=require(_0x18e4('0x14'))(_0x18e4('0x15'));var utils=require(_0x18e4('0x16'));var config=require(_0x18e4('0x17'));var db=require('../../mysqldb')['db'];config[_0x18e4('0x18')]=_[_0x18e4('0x19')](config[_0x18e4('0x18')],{'host':_0x18e4('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')[_0x18e4('0x1b')](socket);var jayson=require(_0x18e4('0x1c'));var client=jayson[_0x18e4('0x1d')][_0x18e4('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x18e4('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x15aba4,_0x589953,_0x4b0954){if(_0x4b0954){var _0x265605=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x265605['test'](_0x589953)){return _0x15aba4;}else{throw new db[(_0x18e4('0x1f'))][(_0x18e4('0x20'))](_0x18e4('0x21'));}}else{return _0x15aba4;}}function respondWithRpcPromise(_0x450d86,_0x2f7188,_0x17323a,_0x1b8ab2){return new BPromise(function(_0x32c19f,_0x4a4fb5){var _0x2628bc=_0x1b8ab2||client;return _0x2628bc[_0x18e4('0x22')](_0x450d86,_0x17323a)[_0x18e4('0x23')](function(_0x38252b){logger[_0x18e4('0x24')]('FaxMessage,\x20%s,\x20%s',_0x2f7188,_0x18e4('0x25'));logger[_0x18e4('0x26')](_0x18e4('0x27'),_0x2f7188,_0x18e4('0x25'),JSON[_0x18e4('0x28')](_0x38252b));if(_0x38252b['error']){if(_0x38252b[_0x18e4('0x29')][_0x18e4('0x2a')]===0x1f4){logger[_0x18e4('0x29')]('FaxMessage,\x20%s,\x20%s',_0x2f7188,_0x38252b['error']['message']);return _0x4a4fb5(_0x38252b['error']['message']);}logger[_0x18e4('0x29')](_0x18e4('0x2b'),_0x2f7188,_0x38252b['error'][_0x18e4('0x2c')]);return _0x32c19f(_0x38252b['error']['message']);}else{logger[_0x18e4('0x24')](_0x18e4('0x2b'),_0x2f7188,_0x18e4('0x25'));_0x32c19f(_0x38252b['result'][_0x18e4('0x2c')]);}})[_0x18e4('0x2d')](function(_0x3ea0f1){logger[_0x18e4('0x29')]('FaxMessage,\x20%s,\x20%s',_0x2f7188,_0x3ea0f1);_0x4a4fb5(_0x3ea0f1);});});}function respondWithStatusCode(_0x283a0b,_0x1a1a53){_0x1a1a53=_0x1a1a53||0xcc;return function(_0x4a3a83){if(_0x4a3a83){return _0x283a0b[_0x18e4('0x2e')](_0x1a1a53);}return _0x283a0b[_0x18e4('0x2f')](_0x1a1a53)[_0x18e4('0x30')]();};}function respondWithResult(_0x26f713,_0xca7547){_0xca7547=_0xca7547||0xc8;return function(_0x54b8e8){if(_0x54b8e8){return _0x26f713[_0x18e4('0x2f')](_0xca7547)['json'](_0x54b8e8);}};}function respondWithFilteredResult(_0x146ca8,_0x5387c8){return function(_0x16a7ab){if(_0x16a7ab){var _0x51e728=_0x16a7ab[_0x18e4('0x31')],_0x3d6d86=_0x5387c8[_0x18e4('0x32')],_0x3c6efb=_0x5387c8[_0x18e4('0x32')]+_0x5387c8[_0x18e4('0x33')],_0xa4d483;if(_0x3c6efb>=_0x51e728){_0x3c6efb=_0x51e728;_0xa4d483=0xc8;}else{_0xa4d483=0xce;}_0x146ca8[_0x18e4('0x2f')](_0xa4d483);return _0x146ca8['set'](_0x18e4('0x34'),_0x3d6d86+'-'+_0x3c6efb+'/'+_0x51e728)[_0x18e4('0x35')](_0x16a7ab);}return null;};}function patchUpdates(_0x2170dc){return function(_0x34f9d8){try{jsonpatch[_0x18e4('0x36')](_0x34f9d8,_0x2170dc,!![]);}catch(_0xcc617d){return BPromise[_0x18e4('0x37')](_0xcc617d);}return _0x34f9d8[_0x18e4('0x38')]();};}function saveUpdates(_0x27a3a3,_0x3f0976){return function(_0x211d72){if(_0x211d72){return _0x211d72['update'](_0x27a3a3)['then'](function(_0xeb834b){return _0xeb834b;});}return null;};}function removeEntity(_0x2d52bf,_0x3b21e9){return function(_0x434049){if(_0x434049){return _0x434049[_0x18e4('0x39')]()['then'](function(){_0x2d52bf[_0x18e4('0x2f')](0xcc)[_0x18e4('0x30')]();});}};}function handleEntityNotFound(_0x23f8f4,_0x13face){return function(_0x56ac53){if(!_0x56ac53){_0x23f8f4[_0x18e4('0x2e')](0x194);}return _0x56ac53;};}function handleError(_0x20b724,_0xc9a8a0){_0xc9a8a0=_0xc9a8a0||0x1f4;return function(_0x50cd22){logger[_0x18e4('0x29')](_0x50cd22[_0x18e4('0x3a')]);if(_0x50cd22[_0x18e4('0x3b')]){delete _0x50cd22['name'];}_0x20b724[_0x18e4('0x2f')](_0xc9a8a0)[_0x18e4('0x3c')](_0x50cd22);};}exports['index']=function(_0x55619b,_0xbd9a66){var _0x4db32d={},_0x1e6996={},_0x4ead32={'count':0x0,'rows':[]};var _0x449ee8=_[_0x18e4('0x3d')](db[_0x18e4('0x3e')][_0x18e4('0x3f')],function(_0x1bc205){return{'name':_0x1bc205['fieldName'],'type':_0x1bc205[_0x18e4('0x40')][_0x18e4('0x41')]};});_0x1e6996[_0x18e4('0x42')]=_['map'](_0x449ee8,_0x18e4('0x3b'));_0x1e6996[_0x18e4('0x43')]=_[_0x18e4('0x44')](_0x55619b['query']);_0x1e6996[_0x18e4('0x45')]=_['intersection'](_0x1e6996[_0x18e4('0x42')],_0x1e6996['query']);_0x4db32d[_0x18e4('0x46')]=_[_0x18e4('0x47')](_0x1e6996[_0x18e4('0x42')],qs['fields'](_0x55619b[_0x18e4('0x43')][_0x18e4('0x48')]));_0x4db32d[_0x18e4('0x46')]=_0x4db32d[_0x18e4('0x46')][_0x18e4('0x49')]?_0x4db32d[_0x18e4('0x46')]:_0x1e6996['model'];if(!_0x55619b[_0x18e4('0x43')][_0x18e4('0x4a')](_0x18e4('0x4b'))){_0x4db32d[_0x18e4('0x33')]=qs[_0x18e4('0x33')](_0x55619b[_0x18e4('0x43')][_0x18e4('0x33')]);_0x4db32d[_0x18e4('0x32')]=qs['offset'](_0x55619b[_0x18e4('0x43')][_0x18e4('0x32')]);}_0x4db32d['order']=qs[_0x18e4('0x4c')](_0x55619b[_0x18e4('0x43')][_0x18e4('0x4c')]);_0x4db32d[_0x18e4('0x4d')]=qs[_0x18e4('0x45')](_['pick'](_0x55619b[_0x18e4('0x43')],_0x1e6996[_0x18e4('0x45')]),_0x449ee8);if(_0x55619b[_0x18e4('0x43')][_0x18e4('0x4e')]){_0x4db32d['where']=_[_0x18e4('0x4f')](_0x4db32d['where'],{'$or':_[_0x18e4('0x3d')](_0x449ee8,function(_0x1447d9){if(_0x1447d9[_0x18e4('0x40')]!==_0x18e4('0x50')){var _0x569f5c={};_0x569f5c[_0x1447d9[_0x18e4('0x3b')]]={'$like':'%'+_0x55619b[_0x18e4('0x43')][_0x18e4('0x4e')]+'%'};return _0x569f5c;}})});}_0x4db32d=_[_0x18e4('0x4f')]({},_0x4db32d,_0x55619b[_0x18e4('0x51')]);var _0x297e73={'where':_0x4db32d[_0x18e4('0x4d')]};return db[_0x18e4('0x3e')][_0x18e4('0x31')](_0x297e73)[_0x18e4('0x23')](function(_0x1d119){_0x4ead32['count']=_0x1d119;if(_0x55619b[_0x18e4('0x43')]['includeAll']){_0x4db32d[_0x18e4('0x52')]=[{'all':!![]}];}return db[_0x18e4('0x3e')][_0x18e4('0x53')](_0x4db32d);})[_0x18e4('0x23')](function(_0x5e4a7a){_0x4ead32[_0x18e4('0x54')]=_0x5e4a7a;return _0x4ead32;})['then'](respondWithFilteredResult(_0xbd9a66,_0x4db32d))[_0x18e4('0x2d')](handleError(_0xbd9a66,null));};exports[_0x18e4('0x55')]=function(_0x142c7f,_0x75505d){var _0x157ba2={'raw':!![],'where':{'id':_0x142c7f['params']['id']}},_0x2dd3a5={};_0x2dd3a5[_0x18e4('0x42')]=_[_0x18e4('0x44')](db[_0x18e4('0x3e')][_0x18e4('0x3f')]);_0x2dd3a5['query']=_[_0x18e4('0x44')](_0x142c7f[_0x18e4('0x43')]);_0x2dd3a5[_0x18e4('0x45')]=_[_0x18e4('0x47')](_0x2dd3a5[_0x18e4('0x42')],_0x2dd3a5['query']);_0x157ba2[_0x18e4('0x46')]=_[_0x18e4('0x47')](_0x2dd3a5[_0x18e4('0x42')],qs['fields'](_0x142c7f[_0x18e4('0x43')][_0x18e4('0x48')]));_0x157ba2[_0x18e4('0x46')]=_0x157ba2[_0x18e4('0x46')][_0x18e4('0x49')]?_0x157ba2[_0x18e4('0x46')]:_0x2dd3a5[_0x18e4('0x42')];if(_0x142c7f[_0x18e4('0x43')][_0x18e4('0x56')]){_0x157ba2[_0x18e4('0x52')]=[{'all':!![]}];}_0x157ba2=_[_0x18e4('0x4f')]({},_0x157ba2,_0x142c7f[_0x18e4('0x51')]);return db['FaxMessage'][_0x18e4('0x57')](_0x157ba2)['then'](handleEntityNotFound(_0x75505d,null))[_0x18e4('0x23')](respondWithResult(_0x75505d,null))[_0x18e4('0x2d')](handleError(_0x75505d,null));};exports[_0x18e4('0x58')]=function(_0x35feb2,_0x48b98f){if(_0x35feb2[_0x18e4('0x59')]['id']){delete _0x35feb2['body']['id'];}return db[_0x18e4('0x3e')][_0x18e4('0x57')]({'where':{'id':_0x35feb2[_0x18e4('0x5a')]['id']}})[_0x18e4('0x23')](handleEntityNotFound(_0x48b98f,null))[_0x18e4('0x23')](saveUpdates(_0x35feb2[_0x18e4('0x59')],null))['then'](respondWithResult(_0x48b98f,null))[_0x18e4('0x2d')](handleError(_0x48b98f,null));};exports[_0x18e4('0x39')]=function(_0x156052,_0x15a163){return db[_0x18e4('0x3e')][_0x18e4('0x57')]({'where':{'id':_0x156052[_0x18e4('0x5a')]['id']}})[_0x18e4('0x23')](handleEntityNotFound(_0x15a163,null))[_0x18e4('0x23')](removeEntity(_0x15a163,null))[_0x18e4('0x2d')](handleError(_0x15a163,null));};exports[_0x18e4('0x5b')]=function(_0x2f8db7,_0x433cf6){return db['FaxMessage'][_0x18e4('0x5b')]()[_0x18e4('0x23')](respondWithResult(_0x433cf6,null))[_0x18e4('0x2d')](handleError(_0x433cf6,null));};var interaction_log=require(_0x18e4('0x14'))(_0x18e4('0x5c'));exports[_0x18e4('0x5d')]=function(_0x55a961,_0x2d9568,_0x33024b){var _0x4da1e4={'channel':_0x18e4('0x5e')};if(_0x55a961[_0x18e4('0x59')]['id']){delete _0x55a961[_0x18e4('0x59')]['id'];}_0x55a961[_0x18e4('0x59')]['read']=!![];_0x55a961['body'][_0x18e4('0x5f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x55a961['body'][_0x18e4('0x60')]=_0x55a961[_0x18e4('0x59')][_0x18e4('0x60')]||_0x55a961['user']['id'];return db[_0x18e4('0x3e')][_0x18e4('0x57')]({'where':{'id':_0x55a961[_0x18e4('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x18e4('0x61')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x2d9568,null))[_0x18e4('0x23')](saveUpdates(_0x55a961['body'],null))['then'](function(_0x218ed7){if(_0x218ed7){_0x4da1e4[_0x18e4('0x2c')]=_0x218ed7['get']({'plain':!![]});return db[_0x18e4('0x62')][_0x18e4('0x57')]({'where':{'id':_0x218ed7[_0x18e4('0x63')]}});}return null;})[_0x18e4('0x23')](handleEntityNotFound(_0x2d9568,null))[_0x18e4('0x23')](function(_0x1c77d0){if(_0x1c77d0){return _0x1c77d0[_0x18e4('0x58')]({'UserId':_0x55a961[_0x18e4('0x59')][_0x18e4('0x60')],'read1stAt':_[_0x18e4('0x64')](_0x1c77d0[_0x18e4('0x65')])?moment()[_0x18e4('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x18e4('0x23')](function(_0x35cd8e){if(_0x35cd8e){_0x4da1e4[_0x18e4('0x67')]=_0x35cd8e[_0x18e4('0x68')]({'plain':!![]});interaction_log[_0x18e4('0x24')](_0x18e4('0x69'),_0x55a961[_0x18e4('0x6a')]['id'],_0x55a961[_0x18e4('0x6a')]['name'],_0x55a961[_0x18e4('0x6a')][_0x18e4('0x6b')],_0x4da1e4['interaction']['id'],_0x55a961[_0x18e4('0x59')]?JSON['stringify'](_0x55a961['body']):_0x18e4('0x6c'));return respondWithRpcPromise(_0x18e4('0x6d'),'acceptMessage',_0x4da1e4);}return null;})[_0x18e4('0x23')](function(_0x41727e){if(_0x41727e){if(_0x55a961[_0x18e4('0x59')][_0x18e4('0x6e')]){_0x4da1e4[_0x18e4('0x2c')]['interface']=util[_0x18e4('0x66')]('SIP/%s',_0x55a961[_0x18e4('0x6a')][_0x18e4('0x3b')]);_0x4da1e4[_0x18e4('0x2c')][_0x18e4('0x6f')]=_0x4da1e4[_0x18e4('0x6f')];_0x4da1e4[_0x18e4('0x2c')][_0x18e4('0x70')]=_0x18e4('0x5d');return respondWithRpcPromise(_0x18e4('0x71'),_0x18e4('0x71'),{'event':'acceptmessage','message':_0x4da1e4[_0x18e4('0x2c')]},client9002)['then'](function(){return _0x4da1e4;});}return _0x4da1e4;}return null;})['then'](respondWithResult(_0x2d9568,null))[_0x18e4('0x2d')](handleError(_0x2d9568,null));};var interaction_log=require(_0x18e4('0x14'))(_0x18e4('0x5c'));exports[_0x18e4('0x37')]=function(_0x1cfd4c,_0x12eca4,_0x3adc83){var _0x1a2d2d={'agent':{},'channel':_0x18e4('0x5e')};if(_0x1cfd4c[_0x18e4('0x59')]['id']){delete _0x1cfd4c['body']['id'];}_0x1cfd4c[_0x18e4('0x59')][_0x18e4('0x60')]=_0x1cfd4c[_0x18e4('0x59')][_0x18e4('0x60')]||_0x1cfd4c[_0x18e4('0x6a')]['id'];_0x1a2d2d[_0x18e4('0x72')]['id']=_0x1cfd4c[_0x18e4('0x59')]['UserId'];return db['FaxMessage'][_0x18e4('0x57')]({'where':{'id':_0x1cfd4c[_0x18e4('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x12eca4,null))[_0x18e4('0x23')](function(_0x34cf62){if(_0x34cf62){_0x1a2d2d['message']=_0x34cf62['get']({'plain':!![]});return db[_0x18e4('0x62')][_0x18e4('0x57')]({'where':{'id':_0x34cf62[_0x18e4('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x12eca4,null))['then'](function(_0x59bd62){if(_0x59bd62){_0x1a2d2d[_0x18e4('0x67')]=_0x59bd62['get']({'plain':!![]});interaction_log['info'](_0x18e4('0x73'),_0x1cfd4c[_0x18e4('0x6a')]['id'],_0x1cfd4c[_0x18e4('0x6a')]['name'],_0x1cfd4c['user'][_0x18e4('0x6b')],_0x1a2d2d[_0x18e4('0x67')]['id'],_0x1cfd4c[_0x18e4('0x59')]?JSON['stringify'](_0x1cfd4c['body']):_0x18e4('0x6c'));return respondWithRpcPromise(_0x18e4('0x74'),_0x18e4('0x75'),_0x1a2d2d);}return null;})[_0x18e4('0x23')](function(_0x372e19){if(_0x372e19){_0x372e19[_0x18e4('0x2c')][_0x18e4('0x76')]=util[_0x18e4('0x66')]('SIP/%s',_0x1cfd4c[_0x18e4('0x6a')][_0x18e4('0x3b')]);_0x372e19[_0x18e4('0x2c')][_0x18e4('0x6f')]=_0x1a2d2d[_0x18e4('0x6f')];_0x372e19[_0x18e4('0x2c')][_0x18e4('0x70')]=_0x18e4('0x37');respondWithRpcPromise(_0x18e4('0x71'),_0x18e4('0x71'),{'event':'rejectmessage','message':_0x372e19['message']},client9002);return _0x1a2d2d;}return null;})[_0x18e4('0x23')](respondWithResult(_0x12eca4,null))[_0x18e4('0x2d')](handleError(_0x12eca4,null));};exports[_0x18e4('0x77')]=function(_0x3c3c1f,_0x3fa20d){var _0x5a4cf4;return db[_0x18e4('0x3e')][_0x18e4('0x77')](_0x3c3c1f[_0x18e4('0x59')],{})[_0x18e4('0x23')](function(_0x397ca2){_0x5a4cf4=_0x397ca2;return db[_0x18e4('0x61')][_0x18e4('0x78')]({'where':{'id':_0x5a4cf4[_0x18e4('0x79')]}});})[_0x18e4('0x23')](function(_0x408f12){if(_['isNil'](_0x408f12)){return;}else{_0x5a4cf4[_0x18e4('0x5e')]=_0x408f12[_0x18e4('0x5e')];return db['Attachment'][_0x18e4('0x78')]({'where':{'id':_0x5a4cf4[_0x18e4('0x7a')]}});}})['then'](function(_0x1e7704){return respondWithRpcPromise('SendFax',_0x18e4('0x7b'),{'FaxAccountId':_[_0x18e4('0x64')](_0x3c3c1f[_0x18e4('0x59')])?undefined:_0x3c3c1f['body'][_0x18e4('0x7c')],'path':_[_0x18e4('0x64')](_0x1e7704)?undefined:util[_0x18e4('0x66')](_0x18e4('0x7d'),_0x1e7704[_0x18e4('0x7e')]),'fax':_[_0x18e4('0x64')](_0x5a4cf4['fax'])?undefined:_0x5a4cf4[_0x18e4('0x5e')],'AttachmentId':_0x5a4cf4[_0x18e4('0x7a')]},client9002);})[_0x18e4('0x23')](respondWithResult(_0x3fa20d,0xc9))[_0x18e4('0x2d')](handleError(_0x3fa20d,null));};exports[_0x18e4('0x7f')]=function(_0x1c2bed,_0x1f3492){var _0x316885=path[_0x18e4('0x80')](config[_0x18e4('0x81')],_0x18e4('0x82'),_0x18e4('0x83'),_0x18e4('0x84'));return db['FaxMessage'][_0x18e4('0x57')]({'where':{'id':_0x1c2bed[_0x18e4('0x5a')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x18e4('0x23')](handleEntityNotFound(_0x1f3492,null))[_0x18e4('0x23')](function(_0x444cc9){if(_0x444cc9){return _0x1f3492['download'](path['join'](_0x316885,_0x444cc9[_0x18e4('0x85')][_0x18e4('0x7e')]));}})['catch'](handleError(_0x1f3492,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index c2308a3..e9128c7 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x37494f,_0x4db498){var _0x5d5d63=function(_0x129d68){while(--_0x129d68){_0x37494f['push'](_0x37494f['shift']());}};_0x5d5d63(++_0x4db498);}(_0x008c,0x188));var _0xc008=function(_0x371ac2,_0xc5961c){_0x371ac2=_0x371ac2-0x0;var _0x37d93d=_0x008c[_0x371ac2];return _0x37d93d;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x458d87,_0x59f9db){var _0x1bdf93=function(_0x42819a){while(--_0x42819a){_0x458d87['push'](_0x458d87['shift']());}};_0x1bdf93(++_0x59f9db);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0x7995('0x0'));var FaxMessage=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){FaxMessageEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);FaxMessageEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];FaxMessage[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 47a033b..08ecead 100644 --- a/server/api/faxMessage/faxMessage.model.js +++ b/server/api/faxMessage/faxMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbef=['./faxMessage.attributes','exports','FaxMessage','fax_messages','body','models','get','toLowerCase','direction','out','secret','isNil','FaxInteraction','findOne','then','update','createdAt','error','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x502256,_0x19a90){var _0x2dfb66=function(_0x569d62){while(--_0x569d62){_0x502256['push'](_0x502256['shift']());}};_0x2dfb66(++_0x19a90);}(_0xfbef,0x1ee));var _0xffbe=function(_0x477c4b,_0xf0d48f){_0x477c4b=_0x477c4b-0x0;var _0x2a20d3=_0xfbef[_0x477c4b];return _0x2a20d3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xffbe('0x0'))('api');var moment=require(_0xffbe('0x1'));var BPromise=require(_0xffbe('0x2'));var rp=require(_0xffbe('0x3'));var fs=require('fs');var path=require(_0xffbe('0x4'));var rimraf=require('rimraf');var config=require(_0xffbe('0x5'));var attributes=require(_0xffbe('0x6'));module[_0xffbe('0x7')]=function(_0x598ef5,_0xb7725d){return _0x598ef5['define'](_0xffbe('0x8'),attributes,{'tableName':_0xffbe('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xffbe('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x50d9f1,_0x51d4a0,_0x56165a){var _0x5cd7f0=_0x598ef5[_0xffbe('0xb')];var _0x39017c=_0x50d9f1[_0xffbe('0xc')]({'plain':!![]});if(_0x39017c['direction'][_0xffbe('0xd')]()==='in'||_0x39017c[_0xffbe('0xe')][_0xffbe('0xd')]()===_0xffbe('0xf')&&!_0x39017c[_0xffbe('0x10')]&&!_[_0xffbe('0x11')](_0x39017c['UserId'])){_0x5cd7f0[_0xffbe('0x12')][_0xffbe('0x13')]({'where':{'id':_0x39017c['FaxInteractionId']}})[_0xffbe('0x14')](function(_0x57de09){if(_0x57de09){_0x57de09[_0xffbe('0x15')]({'lastMsgAt':_0x39017c[_0xffbe('0x16')],'lastMsgDirection':_0x39017c['direction']['toLowerCase']()});}})['catch'](function(_0x5a4655){console[_0xffbe('0x17')](_0x5a4655);});}_0x56165a();}},'charset':'utf8mb4','collate':_0xffbe('0x18')});}; \ No newline at end of file +var _0x800e=['FaxInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne'];(function(_0x3468aa,_0x2730e2){var _0x44ede6=function(_0x5e52c2){while(--_0x5e52c2){_0x3468aa['push'](_0x3468aa['shift']());}};_0x44ede6(++_0x2730e2);}(_0x800e,0x115));var _0xe800=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x800e[_0x59bcb1];return _0x4a737f;};'use strict';var _=require('lodash');var util=require(_0xe800('0x0'));var logger=require(_0xe800('0x1'))(_0xe800('0x2'));var moment=require(_0xe800('0x3'));var BPromise=require('bluebird');var rp=require(_0xe800('0x4'));var fs=require('fs');var path=require(_0xe800('0x5'));var rimraf=require(_0xe800('0x6'));var config=require(_0xe800('0x7'));var attributes=require(_0xe800('0x8'));module[_0xe800('0x9')]=function(_0x5b33f3,_0x25d079){return _0x5b33f3[_0xe800('0xa')]('FaxMessage',attributes,{'tableName':_0xe800('0xb'),'paranoid':![],'indexes':[{'name':_0xe800('0xc'),'fields':['body'],'type':_0xe800('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ea527,_0x3dee71,_0x395f98){var _0x30484d=_0x5b33f3[_0xe800('0xe')];var _0x2779be=_0x1ea527[_0xe800('0xf')]({'plain':!![]});if(_0x2779be[_0xe800('0x10')][_0xe800('0x11')]()==='in'||_0x2779be[_0xe800('0x10')][_0xe800('0x11')]()===_0xe800('0x12')&&!_0x2779be[_0xe800('0x13')]&&!_[_0xe800('0x14')](_0x2779be[_0xe800('0x15')])){_0x30484d['FaxInteraction'][_0xe800('0x16')]({'where':{'id':_0x2779be[_0xe800('0x17')]}})[_0xe800('0x18')](function(_0x7976f3){if(_0x7976f3){_0x7976f3[_0xe800('0x19')]({'lastMsgAt':_0x2779be[_0xe800('0x1a')],'lastMsgDirection':_0x2779be['direction'][_0xe800('0x11')]()});}})[_0xe800('0x1b')](function(_0x1ee1cc){console[_0xe800('0x1c')](_0x1ee1cc);});}_0x395f98();}},'charset':'utf8mb4','collate':_0xe800('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 8137a73..11b3ead 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb575=['body','options','raw','then','UpdateFaxMessage','update','where','limit','lodash','util','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxMessage.socket','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','create'];(function(_0x1493d4,_0xe73627){var _0x263b06=function(_0x3ddfd0){while(--_0x3ddfd0){_0x1493d4['push'](_0x1493d4['shift']());}};_0x263b06(++_0xe73627);}(_0xb575,0xda));var _0x5b57=function(_0x5536f6,_0x31724d){_0x5536f6=_0x5536f6-0x0;var _0x45ba38=_0xb575[_0x5536f6];return _0x45ba38;};'use strict';var _=require(_0x5b57('0x0'));var util=require(_0x5b57('0x1'));var moment=require('moment');var BPromise=require(_0x5b57('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b57('0x3'));var logger=require(_0x5b57('0x4'))('rpc');var config=require(_0x5b57('0x5'));var jayson=require(_0x5b57('0x6'));var client=jayson[_0x5b57('0x7')][_0x5b57('0x8')]({'port':0x232a});config[_0x5b57('0x9')]=_['defaults'](config[_0x5b57('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x5b57('0xa'))(new Redis(config[_0x5b57('0x9')]));require(_0x5b57('0xb'))['register'](socket);function respondWithRpcPromise(_0x2a28c1,_0x1fa52c,_0x266f0b){return new BPromise(function(_0x566a8d,_0x342e70){return client[_0x5b57('0xc')](_0x2a28c1,_0x266f0b)['then'](function(_0x523805){logger[_0x5b57('0xd')](_0x5b57('0xe'),_0x1fa52c,_0x5b57('0xf'));logger[_0x5b57('0x10')](_0x5b57('0x11'),_0x1fa52c,_0x5b57('0xf'),JSON[_0x5b57('0x12')](_0x523805));if(_0x523805[_0x5b57('0x13')]){if(_0x523805[_0x5b57('0x13')][_0x5b57('0x14')]===0x1f4){logger['error'](_0x5b57('0xe'),_0x1fa52c,_0x523805[_0x5b57('0x13')][_0x5b57('0x15')]);return _0x342e70(_0x523805['error'][_0x5b57('0x15')]);}logger[_0x5b57('0x13')](_0x5b57('0xe'),_0x1fa52c,_0x523805[_0x5b57('0x13')][_0x5b57('0x15')]);return _0x566a8d(_0x523805[_0x5b57('0x13')][_0x5b57('0x15')]);}else{logger[_0x5b57('0xd')]('FaxMessage,\x20%s,\x20%s',_0x1fa52c,_0x5b57('0xf'));_0x566a8d(_0x523805[_0x5b57('0x16')][_0x5b57('0x15')]);}})[_0x5b57('0x17')](function(_0x30f8d4){logger[_0x5b57('0x13')]('FaxMessage,\x20%s,\x20%s',_0x1fa52c,_0x30f8d4);_0x342e70(_0x30f8d4);});});}exports[_0x5b57('0x18')]=function(_0x35969c){var _0x41df30=this;return new Promise(function(_0x412b62,_0x53378c){return db[_0x5b57('0x19')][_0x5b57('0x1a')](_0x35969c[_0x5b57('0x1b')],{'raw':_0x35969c['options']?_0x35969c[_0x5b57('0x1c')][_0x5b57('0x1d')]===undefined?!![]:![]:!![]})[_0x5b57('0x1e')](function(_0x28721f){logger[_0x5b57('0xd')](_0x5b57('0x18'),_0x35969c);logger['debug'](_0x5b57('0x18'),_0x35969c,JSON['stringify'](_0x28721f));_0x412b62(_0x28721f);})[_0x5b57('0x17')](function(_0x38a3b3){logger['error']('CreateFaxMessage',_0x38a3b3[_0x5b57('0x15')],_0x35969c);_0x53378c(_0x41df30['error'](0x1f4,_0x38a3b3[_0x5b57('0x15')]));});});};exports[_0x5b57('0x1f')]=function(_0x1ab440){var _0x20a95a=this;return new Promise(function(_0x39b2f4,_0x17ac8b){return db[_0x5b57('0x19')][_0x5b57('0x20')](_0x1ab440[_0x5b57('0x1b')],{'raw':_0x1ab440[_0x5b57('0x1c')]?_0x1ab440[_0x5b57('0x1c')][_0x5b57('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ab440[_0x5b57('0x1c')]?_0x1ab440[_0x5b57('0x1c')][_0x5b57('0x21')]||null:null,'attributes':_0x1ab440[_0x5b57('0x1c')]?_0x1ab440[_0x5b57('0x1c')]['attributes']||null:null,'limit':_0x1ab440[_0x5b57('0x1c')]?_0x1ab440['options'][_0x5b57('0x22')]||null:null})[_0x5b57('0x1e')](function(_0x33b262){logger[_0x5b57('0xd')](_0x5b57('0x1f'),_0x1ab440);logger[_0x5b57('0x10')]('UpdateFaxMessage',_0x1ab440,JSON[_0x5b57('0x12')](_0x33b262));_0x39b2f4(_0x33b262);})[_0x5b57('0x17')](function(_0x424cac){logger[_0x5b57('0x13')](_0x5b57('0x1f'),_0x424cac['message'],_0x1ab440);_0x17ac8b(_0x20a95a[_0x5b57('0x13')](0x1f4,_0x424cac['message']));});});}; \ No newline at end of file +var _0x9b8c=['UpdateFaxMessage','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./faxMessage.socket','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxMessage','body','options','raw','CreateFaxMessage'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x9b8c,0x1ed));var _0xc9b8=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x9b8c[_0x3c4f1f];return _0x19cb69;};'use strict';var _=require(_0xc9b8('0x0'));var util=require(_0xc9b8('0x1'));var moment=require(_0xc9b8('0x2'));var BPromise=require(_0xc9b8('0x3'));var rs=require(_0xc9b8('0x4'));var fs=require('fs');var Redis=require(_0xc9b8('0x5'));var db=require(_0xc9b8('0x6'))['db'];var utils=require(_0xc9b8('0x7'));var logger=require(_0xc9b8('0x8'))('rpc');var config=require(_0xc9b8('0x9'));var jayson=require(_0xc9b8('0xa'));var client=jayson[_0xc9b8('0xb')]['http']({'port':0x232a});config[_0xc9b8('0xc')]=_[_0xc9b8('0xd')](config[_0xc9b8('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc9b8('0xe'))(new Redis(config[_0xc9b8('0xc')]));require(_0xc9b8('0xf'))['register'](socket);function respondWithRpcPromise(_0xc6c380,_0x2dc7a0,_0x105ace){return new BPromise(function(_0x4ba6fd,_0x425c07){return client['request'](_0xc6c380,_0x105ace)[_0xc9b8('0x10')](function(_0x3b4ea3){logger[_0xc9b8('0x11')](_0xc9b8('0x12'),_0x2dc7a0,_0xc9b8('0x13'));logger[_0xc9b8('0x14')](_0xc9b8('0x15'),_0x2dc7a0,_0xc9b8('0x13'),JSON[_0xc9b8('0x16')](_0x3b4ea3));if(_0x3b4ea3[_0xc9b8('0x17')]){if(_0x3b4ea3[_0xc9b8('0x17')]['code']===0x1f4){logger[_0xc9b8('0x17')](_0xc9b8('0x12'),_0x2dc7a0,_0x3b4ea3[_0xc9b8('0x17')][_0xc9b8('0x18')]);return _0x425c07(_0x3b4ea3[_0xc9b8('0x17')][_0xc9b8('0x18')]);}logger[_0xc9b8('0x17')](_0xc9b8('0x12'),_0x2dc7a0,_0x3b4ea3[_0xc9b8('0x17')][_0xc9b8('0x18')]);return _0x4ba6fd(_0x3b4ea3[_0xc9b8('0x17')][_0xc9b8('0x18')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x2dc7a0,'request\x20sent');_0x4ba6fd(_0x3b4ea3[_0xc9b8('0x19')][_0xc9b8('0x18')]);}})[_0xc9b8('0x1a')](function(_0x58b179){logger[_0xc9b8('0x17')](_0xc9b8('0x12'),_0x2dc7a0,_0x58b179);_0x425c07(_0x58b179);});});}exports['CreateFaxMessage']=function(_0x2d3453){var _0x17732b=this;return new Promise(function(_0x11c805,_0x6f99c1){return db[_0xc9b8('0x1b')]['create'](_0x2d3453[_0xc9b8('0x1c')],{'raw':_0x2d3453[_0xc9b8('0x1d')]?_0x2d3453[_0xc9b8('0x1d')][_0xc9b8('0x1e')]===undefined?!![]:![]:!![]})[_0xc9b8('0x10')](function(_0xa2599a){logger[_0xc9b8('0x11')]('CreateFaxMessage',_0x2d3453);logger['debug'](_0xc9b8('0x1f'),_0x2d3453,JSON[_0xc9b8('0x16')](_0xa2599a));_0x11c805(_0xa2599a);})[_0xc9b8('0x1a')](function(_0x132e5d){logger[_0xc9b8('0x17')](_0xc9b8('0x1f'),_0x132e5d[_0xc9b8('0x18')],_0x2d3453);_0x6f99c1(_0x17732b[_0xc9b8('0x17')](0x1f4,_0x132e5d[_0xc9b8('0x18')]));});});};exports[_0xc9b8('0x20')]=function(_0x521d7b){var _0x953585=this;return new Promise(function(_0x268177,_0xb7904d){return db[_0xc9b8('0x1b')]['update'](_0x521d7b[_0xc9b8('0x1c')],{'raw':_0x521d7b[_0xc9b8('0x1d')]?_0x521d7b[_0xc9b8('0x1d')][_0xc9b8('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x521d7b['options']?_0x521d7b[_0xc9b8('0x1d')][_0xc9b8('0x21')]||null:null,'attributes':_0x521d7b[_0xc9b8('0x1d')]?_0x521d7b[_0xc9b8('0x1d')]['attributes']||null:null,'limit':_0x521d7b[_0xc9b8('0x1d')]?_0x521d7b[_0xc9b8('0x1d')][_0xc9b8('0x22')]||null:null})[_0xc9b8('0x10')](function(_0x528950){logger[_0xc9b8('0x11')](_0xc9b8('0x20'),_0x521d7b);logger[_0xc9b8('0x14')]('UpdateFaxMessage',_0x521d7b,JSON['stringify'](_0x528950));_0x268177(_0x528950);})['catch'](function(_0x343c34){logger['error'](_0xc9b8('0x20'),_0x343c34[_0xc9b8('0x18')],_0x521d7b);_0xb7904d(_0x953585[_0xc9b8('0x17')](0x1f4,_0x343c34['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 1d4c77b..f9d0270 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 7f2b52e..82a1dbd 100644 --- a/server/api/faxMessage/index.js +++ b/server/api/faxMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70f0=['/:id/accept','accept','reject','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update'];(function(_0x338a0e,_0x1dd927){var _0x4780b0=function(_0x34f76f){while(--_0x34f76f){_0x338a0e['push'](_0x338a0e['shift']());}};_0x4780b0(++_0x1dd927);}(_0x70f0,0x18e));var _0x070f=function(_0x488ca1,_0xf6858e){_0x488ca1=_0x488ca1-0x0;var _0x4dd0a4=_0x70f0[_0x488ca1];return _0x4dd0a4;};'use strict';var multer=require('multer');var util=require(_0x070f('0x0'));var path=require(_0x070f('0x1'));var timeout=require(_0x070f('0x2'));var express=require(_0x070f('0x3'));var router=express['Router']();var auth=require(_0x070f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x070f('0x5'));var controller=require(_0x070f('0x6'));router[_0x070f('0x7')]('/',auth[_0x070f('0x8')](),controller[_0x070f('0x9')]);router[_0x070f('0x7')](_0x070f('0xa'),auth[_0x070f('0x8')](),controller[_0x070f('0xb')]);router[_0x070f('0x7')](_0x070f('0xc'),auth[_0x070f('0x8')](),controller[_0x070f('0xd')]);router[_0x070f('0x7')](_0x070f('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x070f('0xf')]('/',auth[_0x070f('0x8')](),interaction[_0x070f('0x10')](_0x070f('0x11'),_0x070f('0x12')),controller[_0x070f('0x13')]);router[_0x070f('0x14')]('/:id',auth[_0x070f('0x8')](),controller[_0x070f('0x15')]);router[_0x070f('0x14')](_0x070f('0x16'),auth['isAuthenticated'](),controller[_0x070f('0x17')]);router[_0x070f('0x14')]('/:id/reject',auth[_0x070f('0x8')](),controller[_0x070f('0x18')]);router[_0x070f('0x19')](_0x070f('0xc'),auth[_0x070f('0x8')](),controller[_0x070f('0x1a')]);module[_0x070f('0x1b')]=router; \ No newline at end of file +var _0xb30c=['isAuthenticated','index','show','/:id/download','download','post','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','/:id','destroy','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./faxMessage.controller','get'];(function(_0x29337e,_0x520e52){var _0x451fbe=function(_0x34f34e){while(--_0x34f34e){_0x29337e['push'](_0x29337e['shift']());}};_0x451fbe(++_0x520e52);}(_0xb30c,0x1dd));var _0xcb30=function(_0x3cebb7,_0x6a7701){_0x3cebb7=_0x3cebb7-0x0;var _0x2a5135=_0xb30c[_0x3cebb7];return _0x2a5135;};'use strict';var multer=require(_0xcb30('0x0'));var util=require('util');var path=require(_0xcb30('0x1'));var timeout=require(_0xcb30('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xcb30('0x3'));var config=require(_0xcb30('0x4'));var controller=require(_0xcb30('0x5'));router[_0xcb30('0x6')]('/',auth[_0xcb30('0x7')](),controller[_0xcb30('0x8')]);router[_0xcb30('0x6')]('/describe',auth[_0xcb30('0x7')](),controller['describe']);router[_0xcb30('0x6')]('/:id',auth[_0xcb30('0x7')](),controller[_0xcb30('0x9')]);router['get'](_0xcb30('0xa'),auth[_0xcb30('0x7')](),controller[_0xcb30('0xb')]);router[_0xcb30('0xc')]('/',auth['isAuthenticated'](),interaction['tracked']('fax',_0xcb30('0xd')),controller['create']);router[_0xcb30('0xe')]('/:id',auth[_0xcb30('0x7')](),controller[_0xcb30('0xf')]);router[_0xcb30('0xe')](_0xcb30('0x10'),auth['isAuthenticated'](),controller[_0xcb30('0x11')]);router[_0xcb30('0xe')](_0xcb30('0x12'),auth['isAuthenticated'](),controller[_0xcb30('0x13')]);router['delete'](_0xcb30('0x14'),auth[_0xcb30('0x7')](),controller[_0xcb30('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 883e72d..d8ec4ef 100644 --- a/server/api/faxQueue/faxQueue.attributes.js +++ b/server/api/faxQueue/faxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabfb=['beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x2de2ac,_0x3f9f76){var _0x58f01e=function(_0x491f0e){while(--_0x491f0e){_0x2de2ac['push'](_0x2de2ac['shift']());}};_0x58f01e(++_0x3f9f76);}(_0xabfb,0xa2));var _0xbabf=function(_0x51beba,_0x202d19){_0x51beba=_0x51beba-0x0;var _0x167ee0=_0xabfb[_0x51beba];return _0x167ee0;};'use strict';var Sequelize=require(_0xbabf('0x0'));module['exports']={'name':{'type':Sequelize[_0xbabf('0x1')],'unique':_0xbabf('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbabf('0x1')]},'timeout':{'type':Sequelize[_0xbabf('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbabf('0x4')](_0xbabf('0x5'),_0xbabf('0x6'),_0xbabf('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xbabf('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5f09=['STRING','beepall','roundrobin','INTEGER','exports'];(function(_0x2ddde4,_0x10f6e3){var _0x4bc5ca=function(_0x35ee6a){while(--_0x35ee6a){_0x2ddde4['push'](_0x2ddde4['shift']());}};_0x4bc5ca(++_0x10f6e3);}(_0x5f09,0x8b));var _0x95f0=function(_0x4e230a,_0x282474){_0x4e230a=_0x4e230a-0x0;var _0x44fca1=_0x5f09[_0x4e230a];return _0x44fca1;};'use strict';var Sequelize=require('sequelize');module[_0x95f0('0x0')]={'name':{'type':Sequelize[_0x95f0('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x95f0('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x95f0('0x2'),_0x95f0('0x3')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x95f0('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 6b9b354..6c210e4 100644 --- a/server/api/faxQueue/faxQueue.controller.js +++ b/server/api/faxQueue/faxQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9ed=['toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./faxQueue.socket','register','sendStatus','status','end','offset','set','Content-Range','json','reject','save','update','then','get','FaxQueues','UserProfileResource','destroy','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','query','keys','attributes','fields','model','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','options','count','includeAll','include','findAll','rows','catch','show','intersection','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','transaction','forEach','emit','userFaxQueue:save','removeTeams','select','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb9ed,0x1bc));var _0xdb9e=function(_0x1ab75a,_0x4d3538){_0x1ab75a=_0x1ab75a-0x0;var _0x43d69e=_0xb9ed[_0x1ab75a];return _0x43d69e;};'use strict';var pdf=require(_0xdb9e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdb9e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb9e('0x2'));var rp=require(_0xdb9e('0x3'));var moment=require(_0xdb9e('0x4'));var BPromise=require(_0xdb9e('0x5'));var Mustache=require(_0xdb9e('0x6'));var util=require(_0xdb9e('0x7'));var path=require(_0xdb9e('0x8'));var sox=require(_0xdb9e('0x9'));var csv=require('to-csv');var ejs=require(_0xdb9e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdb9e('0xb'));var crypto=require('crypto');var jsforce=require(_0xdb9e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdb9e('0xd'));var querystring=require('querystring');var Papa=require(_0xdb9e('0xe'));var Redis=require(_0xdb9e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdb9e('0x10'));var hardwareService=require(_0xdb9e('0x11'));var logger=require(_0xdb9e('0x12'))(_0xdb9e('0x13'));var utils=require(_0xdb9e('0x14'));var config=require(_0xdb9e('0x15'));var db=require(_0xdb9e('0x16'))['db'];config['redis']=_['defaults'](config[_0xdb9e('0x17')],{'host':_0xdb9e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdb9e('0x19'))[_0xdb9e('0x1a')](socket);function respondWithStatusCode(_0x49f441,_0x28edee){_0x28edee=_0x28edee||0xcc;return function(_0x5b6040){if(_0x5b6040){return _0x49f441[_0xdb9e('0x1b')](_0x28edee);}return _0x49f441[_0xdb9e('0x1c')](_0x28edee)[_0xdb9e('0x1d')]();};}function respondWithResult(_0x29e40b,_0x3e5a4f){_0x3e5a4f=_0x3e5a4f||0xc8;return function(_0x1ed73e){if(_0x1ed73e){return _0x29e40b['status'](_0x3e5a4f)['json'](_0x1ed73e);}};}function respondWithFilteredResult(_0x3d1f7f,_0x348eb6){return function(_0x38cbd6){if(_0x38cbd6){var _0x254f5b=_0x38cbd6['count'],_0x1185eb=_0x348eb6[_0xdb9e('0x1e')],_0x29174c=_0x348eb6[_0xdb9e('0x1e')]+_0x348eb6['limit'],_0x2634ac;if(_0x29174c>=_0x254f5b){_0x29174c=_0x254f5b;_0x2634ac=0xc8;}else{_0x2634ac=0xce;}_0x3d1f7f[_0xdb9e('0x1c')](_0x2634ac);return _0x3d1f7f[_0xdb9e('0x1f')](_0xdb9e('0x20'),_0x1185eb+'-'+_0x29174c+'/'+_0x254f5b)[_0xdb9e('0x21')](_0x38cbd6);}return null;};}function patchUpdates(_0x4047e9){return function(_0x53b93e){try{jsonpatch['apply'](_0x53b93e,_0x4047e9,!![]);}catch(_0x433952){return BPromise[_0xdb9e('0x22')](_0x433952);}return _0x53b93e[_0xdb9e('0x23')]();};}function saveUpdates(_0x4e7d8c,_0x2540a1){return function(_0x23c27a){if(_0x23c27a){return _0x23c27a[_0xdb9e('0x24')](_0x4e7d8c)[_0xdb9e('0x25')](function(_0x341b26){return _0x341b26;});}return null;};}function removeEntity(_0x4084a3,_0x406eb2){return function(_0x2df62f){if(_0x2df62f){return _0x2df62f['destroy']()[_0xdb9e('0x25')](function(){var _0x378df7=_0x2df62f[_0xdb9e('0x26')]({'plain':!![]});var _0xb1e64=_0xdb9e('0x27');return db[_0xdb9e('0x28')][_0xdb9e('0x29')]({'where':{'type':_0xb1e64,'resourceId':_0x378df7['id']}})[_0xdb9e('0x25')](function(){return _0x2df62f;});})[_0xdb9e('0x25')](function(){_0x4084a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xcc1c45,_0x22970a){return function(_0x49d69b){if(!_0x49d69b){_0xcc1c45[_0xdb9e('0x1b')](0x194);}return _0x49d69b;};}function handleError(_0x3c5554,_0x55056f){_0x55056f=_0x55056f||0x1f4;return function(_0xa4b6ff){logger[_0xdb9e('0x2a')](_0xa4b6ff['stack']);if(_0xa4b6ff[_0xdb9e('0x2b')]){delete _0xa4b6ff[_0xdb9e('0x2b')];}_0x3c5554[_0xdb9e('0x1c')](_0x55056f)[_0xdb9e('0x2c')](_0xa4b6ff);};}exports[_0xdb9e('0x2d')]=function(_0xb8e64d,_0x147281){var _0x5a6fc7={},_0x56a58f={},_0x1c9d8a={'count':0x0,'rows':[]};var _0x193cda=_[_0xdb9e('0x2e')](db[_0xdb9e('0x2f')][_0xdb9e('0x30')],function(_0x1cff3e){return{'name':_0x1cff3e[_0xdb9e('0x31')],'type':_0x1cff3e['type'][_0xdb9e('0x32')]};});_0x56a58f['model']=_[_0xdb9e('0x2e')](_0x193cda,_0xdb9e('0x2b'));_0x56a58f[_0xdb9e('0x33')]=_[_0xdb9e('0x34')](_0xb8e64d[_0xdb9e('0x33')]);_0x56a58f['filters']=_['intersection'](_0x56a58f['model'],_0x56a58f[_0xdb9e('0x33')]);_0x5a6fc7[_0xdb9e('0x35')]=_['intersection'](_0x56a58f['model'],qs[_0xdb9e('0x36')](_0xb8e64d[_0xdb9e('0x33')][_0xdb9e('0x36')]));_0x5a6fc7[_0xdb9e('0x35')]=_0x5a6fc7[_0xdb9e('0x35')]['length']?_0x5a6fc7[_0xdb9e('0x35')]:_0x56a58f[_0xdb9e('0x37')];if(!_0xb8e64d[_0xdb9e('0x33')]['hasOwnProperty'](_0xdb9e('0x38'))){_0x5a6fc7['limit']=qs[_0xdb9e('0x39')](_0xb8e64d[_0xdb9e('0x33')][_0xdb9e('0x39')]);_0x5a6fc7[_0xdb9e('0x1e')]=qs[_0xdb9e('0x1e')](_0xb8e64d[_0xdb9e('0x33')][_0xdb9e('0x1e')]);}_0x5a6fc7[_0xdb9e('0x3a')]=qs[_0xdb9e('0x3b')](_0xb8e64d[_0xdb9e('0x33')][_0xdb9e('0x3b')]);_0x5a6fc7[_0xdb9e('0x3c')]=qs[_0xdb9e('0x3d')](_[_0xdb9e('0x3e')](_0xb8e64d[_0xdb9e('0x33')],_0x56a58f[_0xdb9e('0x3d')]),_0x193cda);if(_0xb8e64d['query'][_0xdb9e('0x3f')]){_0x5a6fc7[_0xdb9e('0x3c')]=_[_0xdb9e('0x40')](_0x5a6fc7[_0xdb9e('0x3c')],{'$or':_[_0xdb9e('0x2e')](_0x193cda,function(_0x322858){if(_0x322858[_0xdb9e('0x41')]!=='VIRTUAL'){var _0x3d98b5={};_0x3d98b5[_0x322858['name']]={'$like':'%'+_0xb8e64d[_0xdb9e('0x33')][_0xdb9e('0x3f')]+'%'};return _0x3d98b5;}})});}_0x5a6fc7=_['merge']({},_0x5a6fc7,_0xb8e64d[_0xdb9e('0x42')]);var _0x3a772f={'where':_0x5a6fc7['where']};return db['FaxQueue']['count'](_0x3a772f)[_0xdb9e('0x25')](function(_0xf47875){_0x1c9d8a[_0xdb9e('0x43')]=_0xf47875;if(_0xb8e64d[_0xdb9e('0x33')][_0xdb9e('0x44')]){_0x5a6fc7[_0xdb9e('0x45')]=[{'all':!![]}];}return db['FaxQueue'][_0xdb9e('0x46')](_0x5a6fc7);})[_0xdb9e('0x25')](function(_0x1a0b85){_0x1c9d8a[_0xdb9e('0x47')]=_0x1a0b85;return _0x1c9d8a;})[_0xdb9e('0x25')](respondWithFilteredResult(_0x147281,_0x5a6fc7))[_0xdb9e('0x48')](handleError(_0x147281,null));};exports[_0xdb9e('0x49')]=function(_0xdda609,_0x1489c5){var _0x479478={'raw':!![],'where':{'id':_0xdda609['params']['id']}},_0x1ff864={};_0x1ff864['model']=_[_0xdb9e('0x34')](db[_0xdb9e('0x2f')][_0xdb9e('0x30')]);_0x1ff864[_0xdb9e('0x33')]=_['keys'](_0xdda609[_0xdb9e('0x33')]);_0x1ff864[_0xdb9e('0x3d')]=_['intersection'](_0x1ff864[_0xdb9e('0x37')],_0x1ff864['query']);_0x479478[_0xdb9e('0x35')]=_[_0xdb9e('0x4a')](_0x1ff864['model'],qs[_0xdb9e('0x36')](_0xdda609['query'][_0xdb9e('0x36')]));_0x479478[_0xdb9e('0x35')]=_0x479478['attributes'][_0xdb9e('0x4b')]?_0x479478[_0xdb9e('0x35')]:_0x1ff864[_0xdb9e('0x37')];if(_0xdda609[_0xdb9e('0x33')][_0xdb9e('0x44')]){_0x479478[_0xdb9e('0x45')]=[{'all':!![]}];}_0x479478=_[_0xdb9e('0x40')]({},_0x479478,_0xdda609['options']);return db[_0xdb9e('0x2f')][_0xdb9e('0x4c')](_0x479478)['then'](handleEntityNotFound(_0x1489c5,null))['then'](respondWithResult(_0x1489c5,null))[_0xdb9e('0x48')](handleError(_0x1489c5,null));};exports[_0xdb9e('0x4d')]=function(_0x184622,_0x4cc7b9){return db['FaxQueue'][_0xdb9e('0x4d')](_0x184622[_0xdb9e('0x4e')],{})[_0xdb9e('0x25')](function(_0x3b19ef){var _0x4f72e7=_0x184622[_0xdb9e('0x4f')][_0xdb9e('0x26')]({'plain':!![]});if(!_0x4f72e7)throw new Error(_0xdb9e('0x50'));if(_0x4f72e7['role']===_0xdb9e('0x4f')){var _0x5d7bc0=_0x3b19ef[_0xdb9e('0x26')]({'plain':!![]});var _0x145ba0=_0xdb9e('0x27');return db[_0xdb9e('0x51')][_0xdb9e('0x4c')]({'where':{'name':_0x145ba0,'userProfileId':_0x4f72e7[_0xdb9e('0x52')]},'raw':!![]})['then'](function(_0x561ad4){if(_0x561ad4&&_0x561ad4['autoAssociation']===0x0){return db[_0xdb9e('0x28')][_0xdb9e('0x4d')]({'name':_0x5d7bc0['name'],'resourceId':_0x5d7bc0['id'],'type':_0x561ad4[_0xdb9e('0x2b')],'sectionId':_0x561ad4['id']},{})[_0xdb9e('0x25')](function(){return _0x3b19ef;});}else{return _0x3b19ef;}})[_0xdb9e('0x48')](function(_0x1eb50e){logger['error'](_0xdb9e('0x53'),_0x1eb50e);throw _0x1eb50e;});}return _0x3b19ef;})[_0xdb9e('0x25')](respondWithResult(_0x4cc7b9,0xc9))[_0xdb9e('0x48')](handleError(_0x4cc7b9,null));};exports[_0xdb9e('0x24')]=function(_0x51bd01,_0x1e9276){if(_0x51bd01[_0xdb9e('0x4e')]['id']){delete _0x51bd01[_0xdb9e('0x4e')]['id'];}return db[_0xdb9e('0x2f')][_0xdb9e('0x4c')]({'where':{'id':_0x51bd01[_0xdb9e('0x54')]['id']}})[_0xdb9e('0x25')](handleEntityNotFound(_0x1e9276,null))['then'](saveUpdates(_0x51bd01[_0xdb9e('0x4e')],null))[_0xdb9e('0x25')](respondWithResult(_0x1e9276,null))[_0xdb9e('0x48')](handleError(_0x1e9276,null));};exports['destroy']=function(_0xc6a6f4,_0x2cd04e){return db[_0xdb9e('0x2f')]['find']({'where':{'id':_0xc6a6f4['params']['id']}})[_0xdb9e('0x25')](handleEntityNotFound(_0x2cd04e,null))[_0xdb9e('0x25')](removeEntity(_0x2cd04e,null))['catch'](handleError(_0x2cd04e,null));};exports[_0xdb9e('0x55')]=function(_0x1c7f37,_0x4cd25e){return db['FaxQueue']['describe']()[_0xdb9e('0x25')](respondWithResult(_0x4cd25e,null))[_0xdb9e('0x48')](handleError(_0x4cd25e,null));};exports[_0xdb9e('0x56')]=function(_0x23a7ff,_0x23ce09,_0x49200b){var _0x138263={'raw':!![],'where':{}},_0x5ae4f2={},_0x344071;return db[_0xdb9e('0x2f')][_0xdb9e('0x57')]({'where':{'id':_0x23a7ff[_0xdb9e('0x54')]['id']}})['then'](handleEntityNotFound(_0x23ce09,null))[_0xdb9e('0x25')](function(_0xdf6c25){if(_0xdf6c25){_0x344071=_0xdf6c25[_0xdb9e('0x26')]({'plain':!![]});_0x5ae4f2[_0xdb9e('0x37')]=_[_0xdb9e('0x34')](db[_0xdb9e('0x58')][_0xdb9e('0x30')]);_0x5ae4f2[_0xdb9e('0x33')]=_['keys'](_0x23a7ff[_0xdb9e('0x33')]);_0x5ae4f2[_0xdb9e('0x3d')]=_[_0xdb9e('0x4a')](_0x5ae4f2[_0xdb9e('0x37')],_0x5ae4f2['query']);_0x138263['attributes']=_[_0xdb9e('0x4a')](_0x5ae4f2[_0xdb9e('0x37')],qs[_0xdb9e('0x36')](_0x23a7ff[_0xdb9e('0x33')]['fields']));_0x138263['attributes']=_0x138263['attributes'][_0xdb9e('0x4b')]?_0x138263['attributes']:_0x5ae4f2[_0xdb9e('0x37')];if(!_0x23a7ff[_0xdb9e('0x33')]['hasOwnProperty'](_0xdb9e('0x38'))){_0x138263[_0xdb9e('0x39')]=qs[_0xdb9e('0x39')](_0x23a7ff['query']['limit']);_0x138263['offset']=qs[_0xdb9e('0x1e')](_0x23a7ff[_0xdb9e('0x33')]['offset']);}_0x138263[_0xdb9e('0x3a')]=qs[_0xdb9e('0x3b')](_0x23a7ff[_0xdb9e('0x33')][_0xdb9e('0x3b')]);_0x138263['where']=qs[_0xdb9e('0x3d')](_[_0xdb9e('0x3e')](_0x23a7ff['query'],_0x5ae4f2[_0xdb9e('0x3d')]));_0x138263['where'][_0xdb9e('0x59')]=_0xdf6c25['id'];if(_0x23a7ff['query'][_0xdb9e('0x3f')]){_0x138263[_0xdb9e('0x3c')]=_[_0xdb9e('0x40')](_0x138263[_0xdb9e('0x3c')],{'$or':_[_0xdb9e('0x2e')](_0x138263[_0xdb9e('0x35')],function(_0x4dff73){var _0x5eb02c={};_0x5eb02c[_0x4dff73]={'$like':'%'+_0x23a7ff[_0xdb9e('0x33')][_0xdb9e('0x3f')]+'%'};return _0x5eb02c;})});}_0x138263=_['merge']({},_0x138263,_0x23a7ff[_0xdb9e('0x42')]);return db[_0xdb9e('0x58')][_0xdb9e('0x46')](_0x138263);}})[_0xdb9e('0x25')](function(_0x24183b){if(_0x24183b){return db[_0xdb9e('0x5a')][_0xdb9e('0x5b')]({'where':{'id':_[_0xdb9e('0x2e')](_0x24183b,'UserId'),'role':_0xdb9e('0x5c')},'attributes':['id',_0xdb9e('0x2b'),_0xdb9e('0x5d'),_0xdb9e('0x5e'),_0xdb9e('0x5f')]});}})[_0xdb9e('0x25')](function(_0x5ec2db){if(_0x5ec2db){return{'count':_0x5ec2db['count'],'rows':_[_0xdb9e('0x2e')](_0x5ec2db[_0xdb9e('0x47')],function(_0x1c76b4){return{'membername':_0x1c76b4['name'],'UserId':_0x1c76b4['id'],'queue_name':_0x344071[_0xdb9e('0x2b')],'FaxQueueId':_0x344071['id'],'interface':util[_0xdb9e('0x60')](_0xdb9e('0x61'),_0xdb9e('0x62'),_0x1c76b4[_0xdb9e('0x2b')]),'penalty':0x0,'paused':_0x1c76b4[_0xdb9e('0x5d')],'createdAt':_0x1c76b4[_0xdb9e('0x5f')],'updatedAt':_0x1c76b4[_0xdb9e('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdb9e('0x25')](respondWithFilteredResult(_0x23ce09,_0x138263))[_0xdb9e('0x48')](handleError(_0x23ce09,null));};exports[_0xdb9e('0x63')]=function(_0x190c06,_0x57405f,_0x543626){var _0x198fe0={};var _0x382695={};var _0x3e108e;var _0x2eff90;return db[_0xdb9e('0x2f')]['findOne']({'where':{'id':_0x190c06['params']['id']}})[_0xdb9e('0x25')](handleEntityNotFound(_0x57405f,null))[_0xdb9e('0x25')](function(_0x1091aa){if(_0x1091aa){_0x3e108e=_0x1091aa;_0x382695[_0xdb9e('0x37')]=_[_0xdb9e('0x34')](db['Team'][_0xdb9e('0x30')]);_0x382695[_0xdb9e('0x33')]=_[_0xdb9e('0x34')](_0x190c06[_0xdb9e('0x33')]);_0x382695['filters']=_[_0xdb9e('0x4a')](_0x382695[_0xdb9e('0x37')],_0x382695['query']);_0x198fe0[_0xdb9e('0x35')]=_['intersection'](_0x382695[_0xdb9e('0x37')],qs[_0xdb9e('0x36')](_0x190c06[_0xdb9e('0x33')]['fields']));_0x198fe0['attributes']=_0x198fe0[_0xdb9e('0x35')][_0xdb9e('0x4b')]?_0x198fe0['attributes']:_0x382695['model'];_0x198fe0[_0xdb9e('0x3a')]=qs['sort'](_0x190c06[_0xdb9e('0x33')]['sort']);_0x198fe0['where']=qs[_0xdb9e('0x3d')](_['pick'](_0x190c06[_0xdb9e('0x33')],_0x382695[_0xdb9e('0x3d')]));if(_0x190c06[_0xdb9e('0x33')][_0xdb9e('0x3f')]){_0x198fe0[_0xdb9e('0x3c')]=_[_0xdb9e('0x40')](_0x198fe0[_0xdb9e('0x3c')],{'$or':_[_0xdb9e('0x2e')](_0x198fe0[_0xdb9e('0x35')],function(_0x22bdee){var _0x582589={};_0x582589[_0x22bdee]={'$like':'%'+_0x190c06['query'][_0xdb9e('0x3f')]+'%'};return _0x582589;})});}_0x198fe0=_[_0xdb9e('0x40')]({},_0x198fe0,_0x190c06[_0xdb9e('0x42')]);return _0x3e108e['getTeams'](_0x198fe0);}})[_0xdb9e('0x25')](function(_0x3c3dc2){if(_0x3c3dc2){_0x2eff90=_0x3c3dc2[_0xdb9e('0x4b')];if(!_0x190c06['query']['hasOwnProperty'](_0xdb9e('0x38'))){_0x198fe0[_0xdb9e('0x39')]=qs['limit'](_0x190c06['query'][_0xdb9e('0x39')]);_0x198fe0[_0xdb9e('0x1e')]=qs[_0xdb9e('0x1e')](_0x190c06[_0xdb9e('0x33')][_0xdb9e('0x1e')]);}return _0x3e108e[_0xdb9e('0x63')](_0x198fe0);}})[_0xdb9e('0x25')](function(_0x6e1271){if(_0x6e1271){return _0x6e1271?{'count':_0x2eff90,'rows':_0x6e1271}:null;}})[_0xdb9e('0x25')](respondWithResult(_0x57405f,null))[_0xdb9e('0x48')](handleError(_0x57405f,null));};exports[_0xdb9e('0x64')]=function(_0x5cbff6,_0x2a2f92,_0x8ecc64){var _0x5506c1=_0x5cbff6[_0xdb9e('0x4e')][_0xdb9e('0x65')];return db[_0xdb9e('0x66')][_0xdb9e('0x46')]({'where':{'id':_0x5506c1},'attributes':['id'],'include':[{'model':db[_0xdb9e('0x5a')],'as':_0xdb9e('0x67'),'attributes':['id',_0xdb9e('0x2b'),_0xdb9e('0x68'),_0xdb9e('0x69'),_0xdb9e('0x6a')],'raw':!![]}]})[_0xdb9e('0x25')](function(_0x1da60c){if(_0x1da60c){var _0x5b0018=_['flatMap'](_0x1da60c,function(_0xd554c0){var _0x3df527=_0xd554c0[_0xdb9e('0x26')]({'plain':!![]});return _0x3df527[_0xdb9e('0x67')];});return db[_0xdb9e('0x2f')][_0xdb9e('0x4c')]({'where':{'id':_0x5cbff6[_0xdb9e('0x54')]['id']}})[_0xdb9e('0x25')](function(_0x57f00c){return db['sequelize'][_0xdb9e('0x6b')](function(_0x5b5a9b){return _0x57f00c[_0xdb9e('0x64')](_0x5506c1,{'transaction':_0x5b5a9b})['then'](function(){return BPromise['each'](_0x5b0018,function(_0x52f657){return db[_0xdb9e('0x58')]['findOrCreate']({'where':{'UserId':_0x52f657['id'],'FaxQueueId':_0x5cbff6[_0xdb9e('0x54')]['id']},'transaction':_0x5b5a9b});});})[_0xdb9e('0x25')](function(){_0x5b0018[_0xdb9e('0x6c')](function(_0x36f136){socket[_0xdb9e('0x6d')](_0xdb9e('0x6e'),{'UserId':_0x36f136['id'],'FaxQueueId':_0x57f00c['id']});});});});});}})[_0xdb9e('0x25')](respondWithStatusCode(_0x2a2f92,null))[_0xdb9e('0x48')](handleError(_0x2a2f92,null));};exports[_0xdb9e('0x6f')]=function(_0x3dea2,_0x490f5d,_0x3a2093){return db[_0xdb9e('0x66')][_0xdb9e('0x46')]({'where':{'id':_0x3dea2[_0xdb9e('0x33')][_0xdb9e('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdb9e('0x67'),'attributes':['id'],'raw':!![]}]})[_0xdb9e('0x25')](handleEntityNotFound(_0x490f5d,null))[_0xdb9e('0x25')](function(_0x31ad30){var _0x37cd7d=_['map'](_0x31ad30,'id');var _0x4c6351=[];var _0x1d56ad=[];var _0x5b5d44=squel[_0xdb9e('0x70')]();_0x5b5d44[_0xdb9e('0x71')]('tq.TeamId')[_0xdb9e('0x72')](_0xdb9e('0x73'),'tq')[_0xdb9e('0x74')](_0xdb9e('0x75'),'ut',_0xdb9e('0x76'))[_0xdb9e('0x3c')](_0xdb9e('0x77'),_0x3dea2[_0xdb9e('0x54')]['id']);for(var _0x15745f=0x0;_0x15745f<_0x31ad30[_0xdb9e('0x4b')];_0x15745f+=0x1){let _0x56ad01=_0x31ad30[_0x15745f];for(var _0x1ee633=0x0;_0x1ee633<_0x56ad01[_0xdb9e('0x67')][_0xdb9e('0x4b')];_0x1ee633+=0x1){let _0x2d67ce=_0x56ad01['Agents'][_0x1ee633];var _0xc09989=_0x5b5d44[_0xdb9e('0x78')]();_0xc09989[_0xdb9e('0x3c')](_0xdb9e('0x79'),_0x2d67ce['id']);_0x1d56ad[_0xdb9e('0x7a')](db[_0xdb9e('0x7b')][_0xdb9e('0x33')](_0xc09989[_0xdb9e('0x7c')](),{'type':db[_0xdb9e('0x7b')][_0xdb9e('0x7d')][_0xdb9e('0x7e')]})[_0xdb9e('0x25')](function(_0x15730e){if(_0x15730e['length']===0x1){return _0x2d67ce['id'];}else{var _0x302615=_[_0xdb9e('0x7f')](_[_0xdb9e('0x2e')](_0x15730e,'TeamId'),function(_0x511c5a){return _[_0xdb9e('0x80')](_0x37cd7d,_0x511c5a);});if(_0x302615){return _0x2d67ce['id'];}}}));}}return BPromise[_0xdb9e('0x81')](_0x1d56ad)[_0xdb9e('0x25')](function(_0x49fdd7){_0x4c6351=_(_0x4c6351)[_0xdb9e('0x82')](_0x49fdd7)[_0xdb9e('0x83')]()[_0xdb9e('0x84')]();return db[_0xdb9e('0x2f')][_0xdb9e('0x4c')]({'where':{'id':_0x3dea2[_0xdb9e('0x54')]['id']}})['then'](function(_0x208a67){return db[_0xdb9e('0x7b')][_0xdb9e('0x6b')](function(_0x20a25c){return _0x208a67[_0xdb9e('0x6f')](_0x3dea2[_0xdb9e('0x33')]['ids'],{'transaction':_0x20a25c})[_0xdb9e('0x25')](function(){if(!_[_0xdb9e('0x85')](_0x4c6351)){return _0x208a67[_0xdb9e('0x86')](_0x4c6351,{'transaction':_0x20a25c});}})[_0xdb9e('0x25')](function(){_0x4c6351[_0xdb9e('0x6c')](function(_0x4f4ed0){socket['emit'](_0xdb9e('0x87'),{'UserId':_0x4f4ed0,'FaxQueueId':_0x208a67['id']});});});});});});})['then'](respondWithStatusCode(_0x490f5d,null))['catch'](handleError(_0x490f5d,null));};exports[_0xdb9e('0x88')]=function(_0x3f766e,_0x223280,_0x34c2ea){return db['FaxQueue']['find']({'where':{'id':_0x3f766e['params']['id']}})[_0xdb9e('0x25')](handleEntityNotFound(_0x223280,null))['then'](function(_0x3e0218){if(_0x3e0218){return _0x3e0218[_0xdb9e('0x88')](_0x3f766e[_0xdb9e('0x4e')]['ids'],_[_0xdb9e('0x89')](_0x3f766e[_0xdb9e('0x4e')],[_0xdb9e('0x65'),'id'])||{})[_0xdb9e('0x8a')](function(_0x3b089d){for(var _0x5282a9=0x0;_0x5282a9<_0x3f766e[_0xdb9e('0x4e')][_0xdb9e('0x65')][_0xdb9e('0x4b')];_0x5282a9+=0x1){socket['emit'](_0xdb9e('0x6e'),{'UserId':_0x3f766e[_0xdb9e('0x4e')][_0xdb9e('0x65')][_0x5282a9],'FaxQueueId':_0x3f766e[_0xdb9e('0x54')]['id']});}return _0x3b089d;});}})[_0xdb9e('0x25')](respondWithResult(_0x223280,null))[_0xdb9e('0x48')](handleError(_0x223280,null));};exports['removeAgents']=function(_0x243296,_0x250fe5,_0x13abc9){return db[_0xdb9e('0x2f')][_0xdb9e('0x4c')]({'where':{'id':_0x243296[_0xdb9e('0x54')]['id']}})['then'](handleEntityNotFound(_0x250fe5,null))[_0xdb9e('0x25')](function(_0x5c6c4f){if(_0x5c6c4f){return _0x5c6c4f[_0xdb9e('0x86')](_0x243296[_0xdb9e('0x33')][_0xdb9e('0x65')])[_0xdb9e('0x25')](function(){if(_[_0xdb9e('0x8b')](_0x243296['query'][_0xdb9e('0x65')])){for(var _0xc5d3df=0x0;_0xc5d3df<_0x243296[_0xdb9e('0x33')]['ids']['length'];_0xc5d3df+=0x1){socket[_0xdb9e('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x243296['query'][_0xdb9e('0x65')][_0xc5d3df]),'FaxQueueId':Number(_0x243296[_0xdb9e('0x54')]['id'])});}}else{socket['emit'](_0xdb9e('0x87'),{'UserId':Number(_0x243296[_0xdb9e('0x33')]['ids']),'FaxQueueId':Number(_0x243296[_0xdb9e('0x54')]['id'])});}});}})[_0xdb9e('0x25')](respondWithStatusCode(_0x250fe5,null))[_0xdb9e('0x48')](handleError(_0x250fe5,null));};exports[_0xdb9e('0x8c')]=function(_0x1a4223,_0x52d55d,_0x1c20d1){var _0x501a84={};var _0x536995={};var _0xd60baf;var _0x22f402;return db['FaxQueue']['findOne']({'where':{'id':_0x1a4223[_0xdb9e('0x54')]['id']}})[_0xdb9e('0x25')](handleEntityNotFound(_0x52d55d,null))[_0xdb9e('0x25')](function(_0x561119){if(_0x561119){_0xd60baf=_0x561119;_0x536995[_0xdb9e('0x37')]=_[_0xdb9e('0x34')](db[_0xdb9e('0x5a')][_0xdb9e('0x30')]);_0x536995[_0xdb9e('0x33')]=_[_0xdb9e('0x34')](_0x1a4223[_0xdb9e('0x33')]);_0x536995[_0xdb9e('0x3d')]=_[_0xdb9e('0x4a')](_0x536995[_0xdb9e('0x37')],_0x536995[_0xdb9e('0x33')]);_0x501a84[_0xdb9e('0x35')]=_[_0xdb9e('0x4a')](_0x536995[_0xdb9e('0x37')],qs[_0xdb9e('0x36')](_0x1a4223[_0xdb9e('0x33')]['fields']));_0x501a84[_0xdb9e('0x35')]=_0x501a84[_0xdb9e('0x35')][_0xdb9e('0x4b')]?_0x501a84[_0xdb9e('0x35')]:_0x536995[_0xdb9e('0x37')];_0x501a84[_0xdb9e('0x3a')]=qs['sort'](_0x1a4223['query'][_0xdb9e('0x3b')]);_0x501a84[_0xdb9e('0x3c')]=qs[_0xdb9e('0x3d')](_[_0xdb9e('0x3e')](_0x1a4223[_0xdb9e('0x33')],_0x536995[_0xdb9e('0x3d')]));if(_0x1a4223[_0xdb9e('0x33')]['filter']){_0x501a84['where']=_[_0xdb9e('0x40')](_0x501a84[_0xdb9e('0x3c')],{'$or':_['map'](_0x501a84[_0xdb9e('0x35')],function(_0x2594f5){var _0x1fb992={};_0x1fb992[_0x2594f5]={'$like':'%'+_0x1a4223[_0xdb9e('0x33')][_0xdb9e('0x3f')]+'%'};return _0x1fb992;})});}_0x501a84=_['merge']({},_0x501a84,_0x1a4223[_0xdb9e('0x42')]);return _0xd60baf[_0xdb9e('0x8c')](_0x501a84);}})['then'](function(_0x2e65f8){if(_0x2e65f8){_0x22f402=_0x2e65f8[_0xdb9e('0x4b')];if(!_0x1a4223[_0xdb9e('0x33')][_0xdb9e('0x8d')](_0xdb9e('0x38'))){_0x501a84[_0xdb9e('0x39')]=qs[_0xdb9e('0x39')](_0x1a4223[_0xdb9e('0x33')]['limit']);_0x501a84[_0xdb9e('0x1e')]=qs['offset'](_0x1a4223[_0xdb9e('0x33')][_0xdb9e('0x1e')]);}return _0xd60baf[_0xdb9e('0x8c')](_0x501a84);}})[_0xdb9e('0x25')](function(_0x3b340f){if(_0x3b340f){return _0x3b340f?{'count':_0x22f402,'rows':_0x3b340f}:null;}})[_0xdb9e('0x25')](respondWithResult(_0x52d55d,null))[_0xdb9e('0x48')](handleError(_0x52d55d,null));}; \ No newline at end of file +var _0x8d5e=['json','offset','limit','set','Content-Range','apply','reject','update','then','get','FaxQueues','UserProfileResource','error','stack','send','map','FaxQueue','rawAttributes','fieldName','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','findOne','UserFaxQueue','pick','FaxQueueId','findAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','ids','Agents','interface','flatMap','transaction','addTeams','each','forEach','emit','userFaxQueue:save','removeTeams','User','select','tq.TeamId','from','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status'];(function(_0x21d257,_0xb331a2){var _0x16e92d=function(_0x38159b){while(--_0x38159b){_0x21d257['push'](_0x21d257['shift']());}};_0x16e92d(++_0xb331a2);}(_0x8d5e,0xf6));var _0xe8d5=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x8d5e[_0x50007c];return _0x5c1ec7;};'use strict';var pdf=require(_0xe8d5('0x0'));var emlformat=require(_0xe8d5('0x1'));var rimraf=require(_0xe8d5('0x2'));var zipdir=require(_0xe8d5('0x3'));var jsonpatch=require(_0xe8d5('0x4'));var rp=require(_0xe8d5('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe8d5('0x6'));var util=require(_0xe8d5('0x7'));var path=require(_0xe8d5('0x8'));var sox=require(_0xe8d5('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe8d5('0xa'));var squel=require(_0xe8d5('0xb'));var crypto=require('crypto');var jsforce=require(_0xe8d5('0xc'));var deskjs=require(_0xe8d5('0xd'));var toCsv=require(_0xe8d5('0xe'));var querystring=require(_0xe8d5('0xf'));var Papa=require('papaparse');var Redis=require(_0xe8d5('0x10'));var authService=require(_0xe8d5('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe8d5('0x12'));var logger=require(_0xe8d5('0x13'))('api');var utils=require(_0xe8d5('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xe8d5('0x15')](config[_0xe8d5('0x16')],{'host':_0xe8d5('0x17'),'port':0x18eb});var socket=require(_0xe8d5('0x18'))(new Redis(config[_0xe8d5('0x16')]));require(_0xe8d5('0x19'))[_0xe8d5('0x1a')](socket);function respondWithStatusCode(_0x1f8bf7,_0x32153d){_0x32153d=_0x32153d||0xcc;return function(_0x40c7e9){if(_0x40c7e9){return _0x1f8bf7[_0xe8d5('0x1b')](_0x32153d);}return _0x1f8bf7['status'](_0x32153d)[_0xe8d5('0x1c')]();};}function respondWithResult(_0xd213e1,_0x5c2f3e){_0x5c2f3e=_0x5c2f3e||0xc8;return function(_0x2f6445){if(_0x2f6445){return _0xd213e1[_0xe8d5('0x1d')](_0x5c2f3e)[_0xe8d5('0x1e')](_0x2f6445);}};}function respondWithFilteredResult(_0x180a99,_0x5e6933){return function(_0x46713f){if(_0x46713f){var _0x4660f2=_0x46713f['count'],_0x5c40c4=_0x5e6933[_0xe8d5('0x1f')],_0x529770=_0x5e6933['offset']+_0x5e6933[_0xe8d5('0x20')],_0x46d8a6;if(_0x529770>=_0x4660f2){_0x529770=_0x4660f2;_0x46d8a6=0xc8;}else{_0x46d8a6=0xce;}_0x180a99[_0xe8d5('0x1d')](_0x46d8a6);return _0x180a99[_0xe8d5('0x21')](_0xe8d5('0x22'),_0x5c40c4+'-'+_0x529770+'/'+_0x4660f2)[_0xe8d5('0x1e')](_0x46713f);}return null;};}function patchUpdates(_0x481083){return function(_0x545514){try{jsonpatch[_0xe8d5('0x23')](_0x545514,_0x481083,!![]);}catch(_0x5cc8b7){return BPromise[_0xe8d5('0x24')](_0x5cc8b7);}return _0x545514['save']();};}function saveUpdates(_0x3f4f18,_0x2d0c75){return function(_0x314452){if(_0x314452){return _0x314452[_0xe8d5('0x25')](_0x3f4f18)[_0xe8d5('0x26')](function(_0x13e7c9){return _0x13e7c9;});}return null;};}function removeEntity(_0x5c8c96,_0x231605){return function(_0x351f51){if(_0x351f51){return _0x351f51['destroy']()[_0xe8d5('0x26')](function(){var _0x6db699=_0x351f51[_0xe8d5('0x27')]({'plain':!![]});var _0x1532e8=_0xe8d5('0x28');return db[_0xe8d5('0x29')]['destroy']({'where':{'type':_0x1532e8,'resourceId':_0x6db699['id']}})[_0xe8d5('0x26')](function(){return _0x351f51;});})[_0xe8d5('0x26')](function(){_0x5c8c96[_0xe8d5('0x1d')](0xcc)[_0xe8d5('0x1c')]();});}};}function handleEntityNotFound(_0x442326,_0x1b8f2e){return function(_0x71007f){if(!_0x71007f){_0x442326['sendStatus'](0x194);}return _0x71007f;};}function handleError(_0x49a069,_0x3fd052){_0x3fd052=_0x3fd052||0x1f4;return function(_0x2263a6){logger[_0xe8d5('0x2a')](_0x2263a6[_0xe8d5('0x2b')]);if(_0x2263a6['name']){delete _0x2263a6['name'];}_0x49a069[_0xe8d5('0x1d')](_0x3fd052)[_0xe8d5('0x2c')](_0x2263a6);};}exports['index']=function(_0x3c1c9a,_0x5a2766){var _0x2d84e2={},_0x29a001={},_0x55fa58={'count':0x0,'rows':[]};var _0xdc3aa8=_[_0xe8d5('0x2d')](db[_0xe8d5('0x2e')][_0xe8d5('0x2f')],function(_0x1e98f1){return{'name':_0x1e98f1[_0xe8d5('0x30')],'type':_0x1e98f1['type'][_0xe8d5('0x31')]};});_0x29a001[_0xe8d5('0x32')]=_['map'](_0xdc3aa8,_0xe8d5('0x33'));_0x29a001[_0xe8d5('0x34')]=_[_0xe8d5('0x35')](_0x3c1c9a[_0xe8d5('0x34')]);_0x29a001['filters']=_[_0xe8d5('0x36')](_0x29a001[_0xe8d5('0x32')],_0x29a001[_0xe8d5('0x34')]);_0x2d84e2['attributes']=_['intersection'](_0x29a001['model'],qs[_0xe8d5('0x37')](_0x3c1c9a['query'][_0xe8d5('0x37')]));_0x2d84e2[_0xe8d5('0x38')]=_0x2d84e2['attributes'][_0xe8d5('0x39')]?_0x2d84e2[_0xe8d5('0x38')]:_0x29a001['model'];if(!_0x3c1c9a[_0xe8d5('0x34')][_0xe8d5('0x3a')](_0xe8d5('0x3b'))){_0x2d84e2[_0xe8d5('0x20')]=qs['limit'](_0x3c1c9a[_0xe8d5('0x34')]['limit']);_0x2d84e2[_0xe8d5('0x1f')]=qs[_0xe8d5('0x1f')](_0x3c1c9a[_0xe8d5('0x34')]['offset']);}_0x2d84e2[_0xe8d5('0x3c')]=qs[_0xe8d5('0x3d')](_0x3c1c9a[_0xe8d5('0x34')][_0xe8d5('0x3d')]);_0x2d84e2[_0xe8d5('0x3e')]=qs[_0xe8d5('0x3f')](_['pick'](_0x3c1c9a[_0xe8d5('0x34')],_0x29a001[_0xe8d5('0x3f')]),_0xdc3aa8);if(_0x3c1c9a[_0xe8d5('0x34')][_0xe8d5('0x40')]){_0x2d84e2[_0xe8d5('0x3e')]=_[_0xe8d5('0x41')](_0x2d84e2[_0xe8d5('0x3e')],{'$or':_[_0xe8d5('0x2d')](_0xdc3aa8,function(_0x529756){if(_0x529756[_0xe8d5('0x42')]!==_0xe8d5('0x43')){var _0x284d11={};_0x284d11[_0x529756[_0xe8d5('0x33')]]={'$like':'%'+_0x3c1c9a[_0xe8d5('0x34')][_0xe8d5('0x40')]+'%'};return _0x284d11;}})});}_0x2d84e2=_[_0xe8d5('0x41')]({},_0x2d84e2,_0x3c1c9a[_0xe8d5('0x44')]);var _0x4ea713={'where':_0x2d84e2[_0xe8d5('0x3e')]};return db[_0xe8d5('0x2e')]['count'](_0x4ea713)[_0xe8d5('0x26')](function(_0x5ccf1a){_0x55fa58[_0xe8d5('0x45')]=_0x5ccf1a;if(_0x3c1c9a[_0xe8d5('0x34')][_0xe8d5('0x46')]){_0x2d84e2[_0xe8d5('0x47')]=[{'all':!![]}];}return db[_0xe8d5('0x2e')]['findAll'](_0x2d84e2);})['then'](function(_0x205f04){_0x55fa58[_0xe8d5('0x48')]=_0x205f04;return _0x55fa58;})['then'](respondWithFilteredResult(_0x5a2766,_0x2d84e2))[_0xe8d5('0x49')](handleError(_0x5a2766,null));};exports[_0xe8d5('0x4a')]=function(_0x532d12,_0x36fc87){var _0x51644d={'raw':!![],'where':{'id':_0x532d12['params']['id']}},_0x22c903={};_0x22c903[_0xe8d5('0x32')]=_[_0xe8d5('0x35')](db['FaxQueue'][_0xe8d5('0x2f')]);_0x22c903[_0xe8d5('0x34')]=_[_0xe8d5('0x35')](_0x532d12[_0xe8d5('0x34')]);_0x22c903[_0xe8d5('0x3f')]=_[_0xe8d5('0x36')](_0x22c903[_0xe8d5('0x32')],_0x22c903[_0xe8d5('0x34')]);_0x51644d[_0xe8d5('0x38')]=_[_0xe8d5('0x36')](_0x22c903[_0xe8d5('0x32')],qs[_0xe8d5('0x37')](_0x532d12[_0xe8d5('0x34')]['fields']));_0x51644d[_0xe8d5('0x38')]=_0x51644d[_0xe8d5('0x38')][_0xe8d5('0x39')]?_0x51644d[_0xe8d5('0x38')]:_0x22c903[_0xe8d5('0x32')];if(_0x532d12[_0xe8d5('0x34')][_0xe8d5('0x46')]){_0x51644d['include']=[{'all':!![]}];}_0x51644d=_[_0xe8d5('0x41')]({},_0x51644d,_0x532d12[_0xe8d5('0x44')]);return db[_0xe8d5('0x2e')][_0xe8d5('0x4b')](_0x51644d)[_0xe8d5('0x26')](handleEntityNotFound(_0x36fc87,null))[_0xe8d5('0x26')](respondWithResult(_0x36fc87,null))[_0xe8d5('0x49')](handleError(_0x36fc87,null));};exports[_0xe8d5('0x4c')]=function(_0x26ea7d,_0x1a0795){return db[_0xe8d5('0x2e')]['create'](_0x26ea7d[_0xe8d5('0x4d')],{})[_0xe8d5('0x26')](function(_0xb93aee){var _0x499792=_0x26ea7d['user'][_0xe8d5('0x27')]({'plain':!![]});if(!_0x499792)throw new Error(_0xe8d5('0x4e'));if(_0x499792[_0xe8d5('0x4f')]===_0xe8d5('0x50')){var _0x4d9840=_0xb93aee[_0xe8d5('0x27')]({'plain':!![]});var _0x215cab=_0xe8d5('0x28');return db[_0xe8d5('0x51')][_0xe8d5('0x4b')]({'where':{'name':_0x215cab,'userProfileId':_0x499792[_0xe8d5('0x52')]},'raw':!![]})[_0xe8d5('0x26')](function(_0x2812fe){if(_0x2812fe&&_0x2812fe[_0xe8d5('0x53')]===0x0){return db['UserProfileResource'][_0xe8d5('0x4c')]({'name':_0x4d9840[_0xe8d5('0x33')],'resourceId':_0x4d9840['id'],'type':_0x2812fe[_0xe8d5('0x33')],'sectionId':_0x2812fe['id']},{})[_0xe8d5('0x26')](function(){return _0xb93aee;});}else{return _0xb93aee;}})['catch'](function(_0x38cd36){logger['error'](_0xe8d5('0x54'),_0x38cd36);throw _0x38cd36;});}return _0xb93aee;})[_0xe8d5('0x26')](respondWithResult(_0x1a0795,0xc9))['catch'](handleError(_0x1a0795,null));};exports['update']=function(_0x1a8733,_0x5a64ca){if(_0x1a8733[_0xe8d5('0x4d')]['id']){delete _0x1a8733[_0xe8d5('0x4d')]['id'];}return db[_0xe8d5('0x2e')][_0xe8d5('0x4b')]({'where':{'id':_0x1a8733[_0xe8d5('0x55')]['id']}})[_0xe8d5('0x26')](handleEntityNotFound(_0x5a64ca,null))['then'](saveUpdates(_0x1a8733['body'],null))[_0xe8d5('0x26')](respondWithResult(_0x5a64ca,null))[_0xe8d5('0x49')](handleError(_0x5a64ca,null));};exports[_0xe8d5('0x56')]=function(_0x23f2cc,_0x51e31e){return db['FaxQueue'][_0xe8d5('0x4b')]({'where':{'id':_0x23f2cc['params']['id']}})[_0xe8d5('0x26')](handleEntityNotFound(_0x51e31e,null))[_0xe8d5('0x26')](removeEntity(_0x51e31e,null))[_0xe8d5('0x49')](handleError(_0x51e31e,null));};exports['describe']=function(_0x18a746,_0xe7bbf1){return db[_0xe8d5('0x2e')][_0xe8d5('0x57')]()[_0xe8d5('0x26')](respondWithResult(_0xe7bbf1,null))[_0xe8d5('0x49')](handleError(_0xe7bbf1,null));};exports['getMembers']=function(_0x23de30,_0x2d1330,_0x21aaf6){var _0x1bfbba={'raw':!![],'where':{}},_0x18c7fa={},_0x3e2ebe;return db[_0xe8d5('0x2e')][_0xe8d5('0x58')]({'where':{'id':_0x23de30[_0xe8d5('0x55')]['id']}})[_0xe8d5('0x26')](handleEntityNotFound(_0x2d1330,null))[_0xe8d5('0x26')](function(_0x1e1e29){if(_0x1e1e29){_0x3e2ebe=_0x1e1e29[_0xe8d5('0x27')]({'plain':!![]});_0x18c7fa[_0xe8d5('0x32')]=_[_0xe8d5('0x35')](db[_0xe8d5('0x59')]['rawAttributes']);_0x18c7fa[_0xe8d5('0x34')]=_['keys'](_0x23de30['query']);_0x18c7fa[_0xe8d5('0x3f')]=_['intersection'](_0x18c7fa[_0xe8d5('0x32')],_0x18c7fa[_0xe8d5('0x34')]);_0x1bfbba['attributes']=_[_0xe8d5('0x36')](_0x18c7fa[_0xe8d5('0x32')],qs[_0xe8d5('0x37')](_0x23de30[_0xe8d5('0x34')][_0xe8d5('0x37')]));_0x1bfbba[_0xe8d5('0x38')]=_0x1bfbba[_0xe8d5('0x38')][_0xe8d5('0x39')]?_0x1bfbba[_0xe8d5('0x38')]:_0x18c7fa[_0xe8d5('0x32')];if(!_0x23de30[_0xe8d5('0x34')][_0xe8d5('0x3a')](_0xe8d5('0x3b'))){_0x1bfbba[_0xe8d5('0x20')]=qs['limit'](_0x23de30['query'][_0xe8d5('0x20')]);_0x1bfbba[_0xe8d5('0x1f')]=qs[_0xe8d5('0x1f')](_0x23de30[_0xe8d5('0x34')][_0xe8d5('0x1f')]);}_0x1bfbba[_0xe8d5('0x3c')]=qs['sort'](_0x23de30[_0xe8d5('0x34')]['sort']);_0x1bfbba[_0xe8d5('0x3e')]=qs['filters'](_[_0xe8d5('0x5a')](_0x23de30['query'],_0x18c7fa[_0xe8d5('0x3f')]));_0x1bfbba[_0xe8d5('0x3e')][_0xe8d5('0x5b')]=_0x1e1e29['id'];if(_0x23de30[_0xe8d5('0x34')]['filter']){_0x1bfbba[_0xe8d5('0x3e')]=_[_0xe8d5('0x41')](_0x1bfbba[_0xe8d5('0x3e')],{'$or':_[_0xe8d5('0x2d')](_0x1bfbba[_0xe8d5('0x38')],function(_0x454beb){var _0x55d593={};_0x55d593[_0x454beb]={'$like':'%'+_0x23de30[_0xe8d5('0x34')][_0xe8d5('0x40')]+'%'};return _0x55d593;})});}_0x1bfbba=_[_0xe8d5('0x41')]({},_0x1bfbba,_0x23de30[_0xe8d5('0x44')]);return db[_0xe8d5('0x59')][_0xe8d5('0x5c')](_0x1bfbba);}})[_0xe8d5('0x26')](function(_0x4f13c4){if(_0x4f13c4){return db['User']['findAndCountAll']({'where':{'id':_[_0xe8d5('0x2d')](_0x4f13c4,_0xe8d5('0x5d')),'role':'agent'},'attributes':['id',_0xe8d5('0x33'),_0xe8d5('0x5e'),_0xe8d5('0x5f'),_0xe8d5('0x60')]});}})['then'](function(_0x193c2a){if(_0x193c2a){return{'count':_0x193c2a[_0xe8d5('0x45')],'rows':_[_0xe8d5('0x2d')](_0x193c2a['rows'],function(_0x15ad2d){return{'membername':_0x15ad2d[_0xe8d5('0x33')],'UserId':_0x15ad2d['id'],'queue_name':_0x3e2ebe['name'],'FaxQueueId':_0x3e2ebe['id'],'interface':util[_0xe8d5('0x61')](_0xe8d5('0x62'),_0xe8d5('0x63'),_0x15ad2d['name']),'penalty':0x0,'paused':_0x15ad2d[_0xe8d5('0x5e')],'createdAt':_0x15ad2d[_0xe8d5('0x60')],'updatedAt':_0x15ad2d[_0xe8d5('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2d1330,_0x1bfbba))[_0xe8d5('0x49')](handleError(_0x2d1330,null));};exports['getTeams']=function(_0xe521c8,_0x1e80c2,_0x50ea16){var _0x3b0ff6={};var _0x6734e9={};var _0x32e29e;var _0x25d8c6;return db[_0xe8d5('0x2e')][_0xe8d5('0x58')]({'where':{'id':_0xe521c8[_0xe8d5('0x55')]['id']}})[_0xe8d5('0x26')](handleEntityNotFound(_0x1e80c2,null))[_0xe8d5('0x26')](function(_0xf8d989){if(_0xf8d989){_0x32e29e=_0xf8d989;_0x6734e9[_0xe8d5('0x32')]=_[_0xe8d5('0x35')](db[_0xe8d5('0x64')][_0xe8d5('0x2f')]);_0x6734e9[_0xe8d5('0x34')]=_[_0xe8d5('0x35')](_0xe521c8[_0xe8d5('0x34')]);_0x6734e9[_0xe8d5('0x3f')]=_[_0xe8d5('0x36')](_0x6734e9[_0xe8d5('0x32')],_0x6734e9[_0xe8d5('0x34')]);_0x3b0ff6['attributes']=_['intersection'](_0x6734e9['model'],qs[_0xe8d5('0x37')](_0xe521c8[_0xe8d5('0x34')][_0xe8d5('0x37')]));_0x3b0ff6['attributes']=_0x3b0ff6[_0xe8d5('0x38')][_0xe8d5('0x39')]?_0x3b0ff6[_0xe8d5('0x38')]:_0x6734e9[_0xe8d5('0x32')];_0x3b0ff6[_0xe8d5('0x3c')]=qs['sort'](_0xe521c8[_0xe8d5('0x34')][_0xe8d5('0x3d')]);_0x3b0ff6['where']=qs[_0xe8d5('0x3f')](_[_0xe8d5('0x5a')](_0xe521c8[_0xe8d5('0x34')],_0x6734e9[_0xe8d5('0x3f')]));if(_0xe521c8[_0xe8d5('0x34')][_0xe8d5('0x40')]){_0x3b0ff6[_0xe8d5('0x3e')]=_['merge'](_0x3b0ff6[_0xe8d5('0x3e')],{'$or':_[_0xe8d5('0x2d')](_0x3b0ff6[_0xe8d5('0x38')],function(_0x594283){var _0x12b662={};_0x12b662[_0x594283]={'$like':'%'+_0xe521c8[_0xe8d5('0x34')][_0xe8d5('0x40')]+'%'};return _0x12b662;})});}_0x3b0ff6=_[_0xe8d5('0x41')]({},_0x3b0ff6,_0xe521c8[_0xe8d5('0x44')]);return _0x32e29e[_0xe8d5('0x65')](_0x3b0ff6);}})[_0xe8d5('0x26')](function(_0xdeaf83){if(_0xdeaf83){_0x25d8c6=_0xdeaf83['length'];if(!_0xe521c8[_0xe8d5('0x34')][_0xe8d5('0x3a')](_0xe8d5('0x3b'))){_0x3b0ff6[_0xe8d5('0x20')]=qs['limit'](_0xe521c8[_0xe8d5('0x34')][_0xe8d5('0x20')]);_0x3b0ff6[_0xe8d5('0x1f')]=qs[_0xe8d5('0x1f')](_0xe521c8[_0xe8d5('0x34')]['offset']);}return _0x32e29e['getTeams'](_0x3b0ff6);}})[_0xe8d5('0x26')](function(_0x1e15e3){if(_0x1e15e3){return _0x1e15e3?{'count':_0x25d8c6,'rows':_0x1e15e3}:null;}})['then'](respondWithResult(_0x1e80c2,null))[_0xe8d5('0x49')](handleError(_0x1e80c2,null));};exports['addTeams']=function(_0x559335,_0x305d9a,_0x39fc68){var _0x40c333=_0x559335[_0xe8d5('0x4d')][_0xe8d5('0x66')];return db[_0xe8d5('0x64')][_0xe8d5('0x5c')]({'where':{'id':_0x40c333},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe8d5('0x67'),'attributes':['id','name','online','voicePause',_0xe8d5('0x68')],'raw':!![]}]})[_0xe8d5('0x26')](function(_0x38e46c){if(_0x38e46c){var _0x17e526=_[_0xe8d5('0x69')](_0x38e46c,function(_0x479ce2){var _0x23f15b=_0x479ce2['get']({'plain':!![]});return _0x23f15b[_0xe8d5('0x67')];});return db['FaxQueue'][_0xe8d5('0x4b')]({'where':{'id':_0x559335['params']['id']}})[_0xe8d5('0x26')](function(_0x2037ce){return db['sequelize'][_0xe8d5('0x6a')](function(_0x45e598){return _0x2037ce[_0xe8d5('0x6b')](_0x40c333,{'transaction':_0x45e598})[_0xe8d5('0x26')](function(){return BPromise[_0xe8d5('0x6c')](_0x17e526,function(_0x49a90f){return db[_0xe8d5('0x59')]['findOrCreate']({'where':{'UserId':_0x49a90f['id'],'FaxQueueId':_0x559335[_0xe8d5('0x55')]['id']},'transaction':_0x45e598});});})[_0xe8d5('0x26')](function(){_0x17e526[_0xe8d5('0x6d')](function(_0x59ae52){socket[_0xe8d5('0x6e')](_0xe8d5('0x6f'),{'UserId':_0x59ae52['id'],'FaxQueueId':_0x2037ce['id']});});});});});}})[_0xe8d5('0x26')](respondWithStatusCode(_0x305d9a,null))['catch'](handleError(_0x305d9a,null));};exports[_0xe8d5('0x70')]=function(_0x4c2959,_0x2a5cb4,_0x4f732d){return db[_0xe8d5('0x64')][_0xe8d5('0x5c')]({'where':{'id':_0x4c2959[_0xe8d5('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe8d5('0x71')],'as':_0xe8d5('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2a5cb4,null))[_0xe8d5('0x26')](function(_0x1c00ec){var _0x4c545d=_['map'](_0x1c00ec,'id');var _0x9fc36=[];var _0x5c946e=[];var _0x2b6b44=squel[_0xe8d5('0x72')]();_0x2b6b44['field'](_0xe8d5('0x73'))[_0xe8d5('0x74')](_0xe8d5('0x75'),'tq')['join']('user_has_teams','ut',_0xe8d5('0x76'))['where'](_0xe8d5('0x77'),_0x4c2959[_0xe8d5('0x55')]['id']);for(var _0x3520e2=0x0;_0x3520e2<_0x1c00ec[_0xe8d5('0x39')];_0x3520e2+=0x1){let _0x291612=_0x1c00ec[_0x3520e2];for(var _0x5f03f5=0x0;_0x5f03f5<_0x291612['Agents']['length'];_0x5f03f5+=0x1){let _0x2efafa=_0x291612['Agents'][_0x5f03f5];var _0x222d6a=_0x2b6b44[_0xe8d5('0x78')]();_0x222d6a[_0xe8d5('0x3e')](_0xe8d5('0x79'),_0x2efafa['id']);_0x5c946e['push'](db[_0xe8d5('0x7a')][_0xe8d5('0x34')](_0x222d6a[_0xe8d5('0x7b')](),{'type':db[_0xe8d5('0x7a')]['QueryTypes'][_0xe8d5('0x7c')]})[_0xe8d5('0x26')](function(_0x5023ae){if(_0x5023ae[_0xe8d5('0x39')]===0x1){return _0x2efafa['id'];}else{var _0x34dffb=_[_0xe8d5('0x7d')](_[_0xe8d5('0x2d')](_0x5023ae,_0xe8d5('0x7e')),function(_0xd9b43b){return _[_0xe8d5('0x7f')](_0x4c545d,_0xd9b43b);});if(_0x34dffb){return _0x2efafa['id'];}}}));}}return BPromise[_0xe8d5('0x80')](_0x5c946e)[_0xe8d5('0x26')](function(_0x4d87f6){_0x9fc36=_(_0x9fc36)[_0xe8d5('0x81')](_0x4d87f6)['compact']()[_0xe8d5('0x82')]();return db[_0xe8d5('0x2e')][_0xe8d5('0x4b')]({'where':{'id':_0x4c2959[_0xe8d5('0x55')]['id']}})[_0xe8d5('0x26')](function(_0x19da32){return db[_0xe8d5('0x7a')]['transaction'](function(_0x3f4174){return _0x19da32[_0xe8d5('0x70')](_0x4c2959[_0xe8d5('0x34')][_0xe8d5('0x66')],{'transaction':_0x3f4174})['then'](function(){if(!_[_0xe8d5('0x83')](_0x9fc36)){return _0x19da32[_0xe8d5('0x84')](_0x9fc36,{'transaction':_0x3f4174});}})[_0xe8d5('0x26')](function(){_0x9fc36[_0xe8d5('0x6d')](function(_0xd8ccbb){socket[_0xe8d5('0x6e')](_0xe8d5('0x85'),{'UserId':_0xd8ccbb,'FaxQueueId':_0x19da32['id']});});});});});});})[_0xe8d5('0x26')](respondWithStatusCode(_0x2a5cb4,null))[_0xe8d5('0x49')](handleError(_0x2a5cb4,null));};exports[_0xe8d5('0x86')]=function(_0x332c3d,_0xeefe0a,_0x517ebd){return db['FaxQueue'][_0xe8d5('0x4b')]({'where':{'id':_0x332c3d['params']['id']}})[_0xe8d5('0x26')](handleEntityNotFound(_0xeefe0a,null))[_0xe8d5('0x26')](function(_0x3c2a7c){if(_0x3c2a7c){return _0x3c2a7c['addAgents'](_0x332c3d['body']['ids'],_[_0xe8d5('0x87')](_0x332c3d['body'],[_0xe8d5('0x66'),'id'])||{})['spread'](function(_0x6f757f){for(var _0x28e97e=0x0;_0x28e97e<_0x332c3d[_0xe8d5('0x4d')][_0xe8d5('0x66')]['length'];_0x28e97e+=0x1){socket[_0xe8d5('0x6e')](_0xe8d5('0x6f'),{'UserId':_0x332c3d[_0xe8d5('0x4d')][_0xe8d5('0x66')][_0x28e97e],'FaxQueueId':_0x332c3d[_0xe8d5('0x55')]['id']});}return _0x6f757f;});}})[_0xe8d5('0x26')](respondWithResult(_0xeefe0a,null))[_0xe8d5('0x49')](handleError(_0xeefe0a,null));};exports[_0xe8d5('0x84')]=function(_0x19f2af,_0xb8a84f,_0x31b5a8){return db[_0xe8d5('0x2e')]['find']({'where':{'id':_0x19f2af[_0xe8d5('0x55')]['id']}})['then'](handleEntityNotFound(_0xb8a84f,null))['then'](function(_0x3fc61c){if(_0x3fc61c){return _0x3fc61c[_0xe8d5('0x84')](_0x19f2af['query'][_0xe8d5('0x66')])[_0xe8d5('0x26')](function(){if(_[_0xe8d5('0x88')](_0x19f2af[_0xe8d5('0x34')][_0xe8d5('0x66')])){for(var _0xbf0840=0x0;_0xbf0840<_0x19f2af[_0xe8d5('0x34')]['ids'][_0xe8d5('0x39')];_0xbf0840+=0x1){socket[_0xe8d5('0x6e')](_0xe8d5('0x85'),{'UserId':Number(_0x19f2af[_0xe8d5('0x34')][_0xe8d5('0x66')][_0xbf0840]),'FaxQueueId':Number(_0x19f2af[_0xe8d5('0x55')]['id'])});}}else{socket[_0xe8d5('0x6e')](_0xe8d5('0x85'),{'UserId':Number(_0x19f2af[_0xe8d5('0x34')][_0xe8d5('0x66')]),'FaxQueueId':Number(_0x19f2af[_0xe8d5('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0xb8a84f,null))[_0xe8d5('0x49')](handleError(_0xb8a84f,null));};exports['getAgents']=function(_0x1f7d3f,_0x4b95b5,_0x39c453){var _0xc3a381={};var _0x184def={};var _0xddd4ad;var _0x282b67;return db['FaxQueue'][_0xe8d5('0x58')]({'where':{'id':_0x1f7d3f[_0xe8d5('0x55')]['id']}})['then'](handleEntityNotFound(_0x4b95b5,null))['then'](function(_0xbae53a){if(_0xbae53a){_0xddd4ad=_0xbae53a;_0x184def['model']=_['keys'](db[_0xe8d5('0x71')][_0xe8d5('0x2f')]);_0x184def[_0xe8d5('0x34')]=_['keys'](_0x1f7d3f[_0xe8d5('0x34')]);_0x184def[_0xe8d5('0x3f')]=_[_0xe8d5('0x36')](_0x184def[_0xe8d5('0x32')],_0x184def[_0xe8d5('0x34')]);_0xc3a381[_0xe8d5('0x38')]=_['intersection'](_0x184def[_0xe8d5('0x32')],qs[_0xe8d5('0x37')](_0x1f7d3f[_0xe8d5('0x34')][_0xe8d5('0x37')]));_0xc3a381[_0xe8d5('0x38')]=_0xc3a381[_0xe8d5('0x38')][_0xe8d5('0x39')]?_0xc3a381[_0xe8d5('0x38')]:_0x184def[_0xe8d5('0x32')];_0xc3a381['order']=qs['sort'](_0x1f7d3f[_0xe8d5('0x34')]['sort']);_0xc3a381[_0xe8d5('0x3e')]=qs[_0xe8d5('0x3f')](_[_0xe8d5('0x5a')](_0x1f7d3f[_0xe8d5('0x34')],_0x184def[_0xe8d5('0x3f')]));if(_0x1f7d3f['query'][_0xe8d5('0x40')]){_0xc3a381[_0xe8d5('0x3e')]=_[_0xe8d5('0x41')](_0xc3a381[_0xe8d5('0x3e')],{'$or':_[_0xe8d5('0x2d')](_0xc3a381['attributes'],function(_0x455b43){var _0x20ef0a={};_0x20ef0a[_0x455b43]={'$like':'%'+_0x1f7d3f[_0xe8d5('0x34')]['filter']+'%'};return _0x20ef0a;})});}_0xc3a381=_[_0xe8d5('0x41')]({},_0xc3a381,_0x1f7d3f[_0xe8d5('0x44')]);return _0xddd4ad['getAgents'](_0xc3a381);}})[_0xe8d5('0x26')](function(_0x323266){if(_0x323266){_0x282b67=_0x323266['length'];if(!_0x1f7d3f[_0xe8d5('0x34')][_0xe8d5('0x3a')](_0xe8d5('0x3b'))){_0xc3a381['limit']=qs[_0xe8d5('0x20')](_0x1f7d3f['query'][_0xe8d5('0x20')]);_0xc3a381[_0xe8d5('0x1f')]=qs[_0xe8d5('0x1f')](_0x1f7d3f['query'][_0xe8d5('0x1f')]);}return _0xddd4ad[_0xe8d5('0x89')](_0xc3a381);}})[_0xe8d5('0x26')](function(_0x23734a){if(_0x23734a){return _0x23734a?{'count':_0x282b67,'rows':_0x23734a}:null;}})[_0xe8d5('0x26')](respondWithResult(_0x4b95b5,null))[_0xe8d5('0x49')](handleError(_0x4b95b5,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index d499b22..9654a67 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 _0x3984=['emit','exports','events','../../mysqldb','setMaxListeners','remove'];(function(_0x226ff7,_0x587db6){var _0x53f612=function(_0x261078){while(--_0x261078){_0x226ff7['push'](_0x226ff7['shift']());}};_0x53f612(++_0x587db6);}(_0x3984,0x1e2));var _0x4398=function(_0x6aad74,_0x32ecf4){_0x6aad74=_0x6aad74-0x0;var _0x5b1c38=_0x3984[_0x6aad74];return _0x5b1c38;};'use strict';var EventEmitter=require(_0x4398('0x0'));var FaxQueue=require(_0x4398('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x4398('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4398('0x3')};function emitEvent(_0x4bdf13){return function(_0xa49257,_0x52bddc,_0x2f87f8){FaxQueueEvents[_0x4398('0x4')](_0x4bdf13+':'+_0xa49257['id'],_0xa49257);FaxQueueEvents['emit'](_0x4bdf13,_0xa49257);_0x2f87f8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x4398('0x5')]=FaxQueueEvents; \ No newline at end of file +var _0xe911=['setMaxListeners','update','remove','emit','exports','../../mysqldb','FaxQueue'];(function(_0x3eca5a,_0x20d490){var _0x15470e=function(_0x219cc6){while(--_0x219cc6){_0x3eca5a['push'](_0x3eca5a['shift']());}};_0x15470e(++_0x20d490);}(_0xe911,0x163));var _0x1e91=function(_0x12e9b1,_0x1524ea){_0x12e9b1=_0x12e9b1-0x0;var _0x4d2027=_0xe911[_0x12e9b1];return _0x4d2027;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x1e91('0x0'))['db'][_0x1e91('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x1e91('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1e91('0x3'),'afterDestroy':_0x1e91('0x4')};function emitEvent(_0x30f947){return function(_0x1451ad,_0x4107a7,_0x3df602){FaxQueueEvents[_0x1e91('0x5')](_0x30f947+':'+_0x1451ad['id'],_0x1451ad);FaxQueueEvents[_0x1e91('0x5')](_0x30f947,_0x1451ad);_0x3df602(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x1e91('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 82076b3..a9bb09b 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 _0xfdb0=['exports','fax_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./faxQueue.attributes'];(function(_0x1ee8b1,_0x25bafb){var _0x46d3d5=function(_0x5480fe){while(--_0x5480fe){_0x1ee8b1['push'](_0x1ee8b1['shift']());}};_0x46d3d5(++_0x25bafb);}(_0xfdb0,0x70));var _0x0fdb=function(_0x3a91c5,_0x218d9e){_0x3a91c5=_0x3a91c5-0x0;var _0x5cbe27=_0xfdb0[_0x3a91c5];return _0x5cbe27;};'use strict';var _=require(_0x0fdb('0x0'));var util=require('util');var logger=require(_0x0fdb('0x1'))(_0x0fdb('0x2'));var moment=require(_0x0fdb('0x3'));var BPromise=require('bluebird');var rp=require(_0x0fdb('0x4'));var fs=require('fs');var path=require(_0x0fdb('0x5'));var rimraf=require(_0x0fdb('0x6'));var config=require('../../config/environment');var attributes=require(_0x0fdb('0x7'));module[_0x0fdb('0x8')]=function(_0x58491c,_0x50dcac){return _0x58491c['define']('FaxQueue',attributes,{'tableName':_0x0fdb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb07=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes','exports','FaxQueue','lodash'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xdb07,0x154));var _0x7db0=function(_0x5641d9,_0x1de53b){_0x5641d9=_0x5641d9-0x0;var _0x1b1f89=_0xdb07[_0x5641d9];return _0x1b1f89;};'use strict';var _=require(_0x7db0('0x0'));var util=require('util');var logger=require(_0x7db0('0x1'))(_0x7db0('0x2'));var moment=require(_0x7db0('0x3'));var BPromise=require(_0x7db0('0x4'));var rp=require(_0x7db0('0x5'));var fs=require('fs');var path=require(_0x7db0('0x6'));var rimraf=require(_0x7db0('0x7'));var config=require('../../config/environment');var attributes=require(_0x7db0('0x8'));module[_0x7db0('0x9')]=function(_0x5b756a,_0x39268f){return _0x5b756a['define'](_0x7db0('0xa'),attributes,{'tableName':'fax_queues','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 925faa8..adacde5 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 _0x1c91=['request\x20sent','stringify','error','code','message','result','catch','FaxQueue','findAll','options','where','attributes','limit','include','map','model','debug','GetFaxQueue','ShowFaxQueue','find','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','request','then','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x4ab886,_0x1dbda5){var _0x535229=function(_0x5cb163){while(--_0x5cb163){_0x4ab886['push'](_0x4ab886['shift']());}};_0x535229(++_0x1dbda5);}(_0x1c91,0x13b));var _0x11c9=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x1c91[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x11c9('0x0'));var util=require(_0x11c9('0x1'));var moment=require(_0x11c9('0x2'));var BPromise=require(_0x11c9('0x3'));var rs=require(_0x11c9('0x4'));var fs=require('fs');var Redis=require(_0x11c9('0x5'));var db=require(_0x11c9('0x6'))['db'];var utils=require(_0x11c9('0x7'));var logger=require(_0x11c9('0x8'))(_0x11c9('0x9'));var config=require(_0x11c9('0xa'));var jayson=require(_0x11c9('0xb'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x11c9('0xc')](config[_0x11c9('0xd')],{'host':_0x11c9('0xe'),'port':0x18eb});var socket=require(_0x11c9('0xf'))(new Redis(config[_0x11c9('0xd')]));require(_0x11c9('0x10'))['register'](socket);function respondWithRpcPromise(_0x17604a,_0x5cedee,_0x314787){return new BPromise(function(_0x2460b3,_0x452ee8){return client[_0x11c9('0x11')](_0x17604a,_0x314787)[_0x11c9('0x12')](function(_0x4e6d30){logger['info'](_0x11c9('0x13'),_0x5cedee,'request\x20sent');logger['debug'](_0x11c9('0x14'),_0x5cedee,_0x11c9('0x15'),JSON[_0x11c9('0x16')](_0x4e6d30));if(_0x4e6d30['error']){if(_0x4e6d30[_0x11c9('0x17')][_0x11c9('0x18')]===0x1f4){logger['error'](_0x11c9('0x13'),_0x5cedee,_0x4e6d30['error'][_0x11c9('0x19')]);return _0x452ee8(_0x4e6d30['error']['message']);}logger['error'](_0x11c9('0x13'),_0x5cedee,_0x4e6d30[_0x11c9('0x17')][_0x11c9('0x19')]);return _0x2460b3(_0x4e6d30['error'][_0x11c9('0x19')]);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x5cedee,_0x11c9('0x15'));_0x2460b3(_0x4e6d30[_0x11c9('0x1a')][_0x11c9('0x19')]);}})[_0x11c9('0x1b')](function(_0x4ea683){logger['error'](_0x11c9('0x13'),_0x5cedee,_0x4ea683);_0x452ee8(_0x4ea683);});});}exports['GetFaxQueue']=function(_0x3d2c69){var _0x4d870d=this;return new Promise(function(_0x39eb36,_0x204efa){return db[_0x11c9('0x1c')][_0x11c9('0x1d')]({'raw':_0x3d2c69[_0x11c9('0x1e')]?_0x3d2c69[_0x11c9('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3d2c69['options']?_0x3d2c69[_0x11c9('0x1e')][_0x11c9('0x1f')]||null:null,'attributes':_0x3d2c69[_0x11c9('0x1e')]?_0x3d2c69[_0x11c9('0x1e')][_0x11c9('0x20')]||null:null,'limit':_0x3d2c69['options']?_0x3d2c69['options'][_0x11c9('0x21')]||null:null,'include':_0x3d2c69[_0x11c9('0x1e')]?_0x3d2c69[_0x11c9('0x1e')][_0x11c9('0x22')]?_[_0x11c9('0x23')](_0x3d2c69['options'][_0x11c9('0x22')],function(_0x5a95e9){return{'model':db[_0x5a95e9[_0x11c9('0x24')]],'as':_0x5a95e9['as'],'attributes':_0x5a95e9[_0x11c9('0x20')],'include':_0x5a95e9[_0x11c9('0x22')]?_[_0x11c9('0x23')](_0x5a95e9[_0x11c9('0x22')],function(_0x1a16cc){return{'model':db[_0x1a16cc[_0x11c9('0x24')]],'as':_0x1a16cc['as'],'attributes':_0x1a16cc[_0x11c9('0x20')],'include':_0x1a16cc[_0x11c9('0x22')]?_[_0x11c9('0x23')](_0x1a16cc[_0x11c9('0x22')],function(_0x3b5a3a){return{'model':db[_0x3b5a3a['model']],'as':_0x3b5a3a['as'],'attributes':_0x3b5a3a[_0x11c9('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b86f3){logger['info']('GetFaxQueue',_0x3d2c69);logger[_0x11c9('0x25')](_0x11c9('0x26'),_0x3d2c69,JSON[_0x11c9('0x16')](_0x3b86f3));_0x39eb36(_0x3b86f3);})['catch'](function(_0x5b9e28){logger[_0x11c9('0x17')]('GetFaxQueue',_0x5b9e28[_0x11c9('0x19')],_0x3d2c69);_0x204efa(_0x4d870d['error'](0x1f4,_0x5b9e28['message']));});});};exports[_0x11c9('0x27')]=function(_0x2270cf){var _0x518c7e=this;return new Promise(function(_0x4ea1a1,_0x36160c){return db[_0x11c9('0x1c')][_0x11c9('0x28')]({'raw':_0x2270cf[_0x11c9('0x1e')]?_0x2270cf[_0x11c9('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2270cf[_0x11c9('0x1e')]?_0x2270cf['options'][_0x11c9('0x1f')]||null:null,'attributes':_0x2270cf['options']?_0x2270cf[_0x11c9('0x1e')]['attributes']||null:null,'include':_0x2270cf['options']?_0x2270cf['options'][_0x11c9('0x22')]?_[_0x11c9('0x23')](_0x2270cf[_0x11c9('0x1e')][_0x11c9('0x22')],function(_0x42ea44){return{'model':db[_0x42ea44[_0x11c9('0x24')]],'as':_0x42ea44['as'],'attributes':_0x42ea44[_0x11c9('0x20')],'include':_0x42ea44[_0x11c9('0x22')]?_['map'](_0x42ea44['include'],function(_0xc3eb5f){return{'model':db[_0xc3eb5f['model']],'as':_0xc3eb5f['as'],'attributes':_0xc3eb5f['attributes'],'include':_0xc3eb5f[_0x11c9('0x22')]?_['map'](_0xc3eb5f[_0x11c9('0x22')],function(_0x58dd55){return{'model':db[_0x58dd55['model']],'as':_0x58dd55['as'],'attributes':_0x58dd55['attributes']};}):[]};}):[]};}):[]:[]})[_0x11c9('0x12')](function(_0x54292f){logger[_0x11c9('0x29')](_0x11c9('0x27'),_0x2270cf);logger[_0x11c9('0x25')](_0x11c9('0x27'),_0x2270cf,JSON[_0x11c9('0x16')](_0x54292f));_0x4ea1a1(_0x54292f);})[_0x11c9('0x1b')](function(_0x4e1ecf){logger[_0x11c9('0x17')]('ShowFaxQueue',_0x4e1ecf[_0x11c9('0x19')],_0x2270cf);_0x36160c(_0x518c7e[_0x11c9('0x17')](0x1f4,_0x4e1ecf[_0x11c9('0x19')]));});});}; \ No newline at end of file +var _0xf234=['options','raw','where','limit','include','model','attributes','map','then','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','findAll'];(function(_0x21090b,_0x39dd3b){var _0x3c68d7=function(_0x28ecd4){while(--_0x28ecd4){_0x21090b['push'](_0x21090b['shift']());}};_0x3c68d7(++_0x39dd3b);}(_0xf234,0x12a));var _0x4f23=function(_0x25cfd2,_0x3ad9d5){_0x25cfd2=_0x25cfd2-0x0;var _0x56c169=_0xf234[_0x25cfd2];return _0x56c169;};'use strict';var _=require(_0x4f23('0x0'));var util=require(_0x4f23('0x1'));var moment=require(_0x4f23('0x2'));var BPromise=require(_0x4f23('0x3'));var rs=require(_0x4f23('0x4'));var fs=require('fs');var Redis=require(_0x4f23('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f23('0x6'));var logger=require(_0x4f23('0x7'))(_0x4f23('0x8'));var config=require(_0x4f23('0x9'));var jayson=require(_0x4f23('0xa'));var client=jayson[_0x4f23('0xb')][_0x4f23('0xc')]({'port':0x232a});config[_0x4f23('0xd')]=_['defaults'](config['redis'],{'host':_0x4f23('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f23('0xd')]));require(_0x4f23('0xf'))[_0x4f23('0x10')](socket);function respondWithRpcPromise(_0x12986b,_0x47ae52,_0x3da3d1){return new BPromise(function(_0x1e3f08,_0x16c681){return client[_0x4f23('0x11')](_0x12986b,_0x3da3d1)['then'](function(_0x445bfb){logger[_0x4f23('0x12')](_0x4f23('0x13'),_0x47ae52,_0x4f23('0x14'));logger[_0x4f23('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x47ae52,_0x4f23('0x14'),JSON[_0x4f23('0x16')](_0x445bfb));if(_0x445bfb[_0x4f23('0x17')]){if(_0x445bfb['error'][_0x4f23('0x18')]===0x1f4){logger[_0x4f23('0x17')](_0x4f23('0x13'),_0x47ae52,_0x445bfb[_0x4f23('0x17')][_0x4f23('0x19')]);return _0x16c681(_0x445bfb[_0x4f23('0x17')][_0x4f23('0x19')]);}logger[_0x4f23('0x17')]('FaxQueue,\x20%s,\x20%s',_0x47ae52,_0x445bfb[_0x4f23('0x17')]['message']);return _0x1e3f08(_0x445bfb[_0x4f23('0x17')]['message']);}else{logger[_0x4f23('0x12')](_0x4f23('0x13'),_0x47ae52,_0x4f23('0x14'));_0x1e3f08(_0x445bfb['result'][_0x4f23('0x19')]);}})[_0x4f23('0x1a')](function(_0x36b3f1){logger['error'](_0x4f23('0x13'),_0x47ae52,_0x36b3f1);_0x16c681(_0x36b3f1);});});}exports[_0x4f23('0x1b')]=function(_0x14a367){var _0x44967a=this;return new Promise(function(_0xa7d350,_0x4b13ef){return db[_0x4f23('0x1c')][_0x4f23('0x1d')]({'raw':_0x14a367[_0x4f23('0x1e')]?_0x14a367[_0x4f23('0x1e')][_0x4f23('0x1f')]===undefined?!![]:![]:!![],'where':_0x14a367['options']?_0x14a367[_0x4f23('0x1e')][_0x4f23('0x20')]||null:null,'attributes':_0x14a367[_0x4f23('0x1e')]?_0x14a367['options']['attributes']||null:null,'limit':_0x14a367[_0x4f23('0x1e')]?_0x14a367[_0x4f23('0x1e')][_0x4f23('0x21')]||null:null,'include':_0x14a367[_0x4f23('0x1e')]?_0x14a367[_0x4f23('0x1e')][_0x4f23('0x22')]?_['map'](_0x14a367['options']['include'],function(_0x18e740){return{'model':db[_0x18e740[_0x4f23('0x23')]],'as':_0x18e740['as'],'attributes':_0x18e740[_0x4f23('0x24')],'include':_0x18e740[_0x4f23('0x22')]?_[_0x4f23('0x25')](_0x18e740['include'],function(_0xf163d0){return{'model':db[_0xf163d0[_0x4f23('0x23')]],'as':_0xf163d0['as'],'attributes':_0xf163d0[_0x4f23('0x24')],'include':_0xf163d0[_0x4f23('0x22')]?_[_0x4f23('0x25')](_0xf163d0[_0x4f23('0x22')],function(_0x2c2f09){return{'model':db[_0x2c2f09['model']],'as':_0x2c2f09['as'],'attributes':_0x2c2f09['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f23('0x26')](function(_0x571c96){logger[_0x4f23('0x12')](_0x4f23('0x1b'),_0x14a367);logger[_0x4f23('0x15')](_0x4f23('0x1b'),_0x14a367,JSON[_0x4f23('0x16')](_0x571c96));_0xa7d350(_0x571c96);})[_0x4f23('0x1a')](function(_0x488df0){logger['error'](_0x4f23('0x1b'),_0x488df0[_0x4f23('0x19')],_0x14a367);_0x4b13ef(_0x44967a[_0x4f23('0x17')](0x1f4,_0x488df0[_0x4f23('0x19')]));});});};exports[_0x4f23('0x27')]=function(_0x47f307){var _0x1da16c=this;return new Promise(function(_0x1697c4,_0xab509f){return db['FaxQueue'][_0x4f23('0x28')]({'raw':_0x47f307['options']?_0x47f307[_0x4f23('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x47f307[_0x4f23('0x1e')]?_0x47f307[_0x4f23('0x1e')][_0x4f23('0x20')]||null:null,'attributes':_0x47f307[_0x4f23('0x1e')]?_0x47f307['options'][_0x4f23('0x24')]||null:null,'include':_0x47f307[_0x4f23('0x1e')]?_0x47f307['options'][_0x4f23('0x22')]?_['map'](_0x47f307[_0x4f23('0x1e')][_0x4f23('0x22')],function(_0x2df8e8){return{'model':db[_0x2df8e8['model']],'as':_0x2df8e8['as'],'attributes':_0x2df8e8[_0x4f23('0x24')],'include':_0x2df8e8[_0x4f23('0x22')]?_[_0x4f23('0x25')](_0x2df8e8[_0x4f23('0x22')],function(_0x2b60e6){return{'model':db[_0x2b60e6['model']],'as':_0x2b60e6['as'],'attributes':_0x2b60e6[_0x4f23('0x24')],'include':_0x2b60e6[_0x4f23('0x22')]?_[_0x4f23('0x25')](_0x2b60e6[_0x4f23('0x22')],function(_0x507a8f){return{'model':db[_0x507a8f[_0x4f23('0x23')]],'as':_0x507a8f['as'],'attributes':_0x507a8f[_0x4f23('0x24')]};}):[]};}):[]};}):[]:[]})[_0x4f23('0x26')](function(_0x1aec61){logger[_0x4f23('0x12')](_0x4f23('0x27'),_0x47f307);logger[_0x4f23('0x15')](_0x4f23('0x27'),_0x47f307,JSON[_0x4f23('0x16')](_0x1aec61));_0x1697c4(_0x1aec61);})[_0x4f23('0x1a')](function(_0xc1dcb5){logger['error']('ShowFaxQueue',_0xc1dcb5[_0x4f23('0x19')],_0x47f307);_0xab509f(_0x1da16c['error'](0x1f4,_0xc1dcb5[_0x4f23('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 1845eea..4e5ed2c 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 _0xaa83=['./faxQueue.events','remove','update','emit','removeListener','register','length','faxQueue:'];(function(_0x3f081d,_0x5de063){var _0x886be8=function(_0x3683ae){while(--_0x3683ae){_0x3f081d['push'](_0x3f081d['shift']());}};_0x886be8(++_0x5de063);}(_0xaa83,0xf8));var _0x3aa8=function(_0x39b7ad,_0x50c5fe){_0x39b7ad=_0x39b7ad-0x0;var _0x1188bb=_0xaa83[_0x39b7ad];return _0x1188bb;};'use strict';var FaxQueueEvents=require(_0x3aa8('0x0'));var events=['save',_0x3aa8('0x1'),_0x3aa8('0x2')];function createListener(_0x22bc90,_0x3b93dc){return function(_0x4b4602){_0x3b93dc[_0x3aa8('0x3')](_0x22bc90,_0x4b4602);};}function removeListener(_0x46d303,_0x6f74d0){return function(){FaxQueueEvents[_0x3aa8('0x4')](_0x46d303,_0x6f74d0);};}exports[_0x3aa8('0x5')]=function(_0x5ce655){for(var _0x290d4e=0x0,_0x5a7838=events[_0x3aa8('0x6')];_0x290d4e<_0x5a7838;_0x290d4e++){var _0x2f4697=events[_0x290d4e];var _0x1f0a64=createListener(_0x3aa8('0x7')+_0x2f4697,_0x5ce655);FaxQueueEvents['on'](_0x2f4697,_0x1f0a64);}}; \ No newline at end of file +var _0x5cde=['emit','removeListener','length','./faxQueue.events','save'];(function(_0x53e218,_0x2e8554){var _0x1eb76a=function(_0x58707d){while(--_0x58707d){_0x53e218['push'](_0x53e218['shift']());}};_0x1eb76a(++_0x2e8554);}(_0x5cde,0x143));var _0xe5cd=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x5cde[_0x3511d3];return _0x5d6321;};'use strict';var FaxQueueEvents=require(_0xe5cd('0x0'));var events=[_0xe5cd('0x1'),'remove','update'];function createListener(_0x1368fb,_0x1c44b7){return function(_0x4bd009){_0x1c44b7[_0xe5cd('0x2')](_0x1368fb,_0x4bd009);};}function removeListener(_0x1c9c29,_0xf320c4){return function(){FaxQueueEvents[_0xe5cd('0x3')](_0x1c9c29,_0xf320c4);};}exports['register']=function(_0x65444e){for(var _0x1477ab=0x0,_0x1ce27f=events[_0xe5cd('0x4')];_0x1477ab<_0x1ce27f;_0x1477ab++){var _0x5adbd3=events[_0x1477ab];var _0x53738a=createListener('faxQueue:'+_0x5adbd3,_0x65444e);FaxQueueEvents['on'](_0x5adbd3,_0x53738a);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 35b5e6b..011d590 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 _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0xb10b,0x12a));var _0xbb10=function(_0x263714,_0x399b37){_0x263714=_0x263714-0x0;var _0x1cd43d=_0xb10b[_0x263714];return _0x1cd43d;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5ebe34,_0x421337){_0x5ebe34=_0x5ebe34-0x0;var _0x36a3ee=_0x0b0e[_0x5ebe34];return _0x36a3ee;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index aaad9d5..47a0444 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 _0xe3b5=['exports','STRING','DATE','moment'];(function(_0x1b1669,_0x7cea4a){var _0x2471dc=function(_0x33ff84){while(--_0x33ff84){_0x1b1669['push'](_0x1b1669['shift']());}};_0x2471dc(++_0x7cea4a);}(_0xe3b5,0xcf));var _0x5e3b=function(_0x48c800,_0x429df){_0x48c800=_0x48c800-0x0;var _0xb4b9f6=_0xe3b5[_0x48c800];return _0xb4b9f6;};'use strict';var moment=require(_0x5e3b('0x0'));var Sequelize=require('sequelize');module[_0x5e3b('0x1')]={'uniqueid':{'type':Sequelize[_0x5e3b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5e3b('0x2')]},'joinAt':{'type':Sequelize[_0x5e3b('0x3')]},'leaveAt':{'type':Sequelize[_0x5e3b('0x3')]},'acceptAt':{'type':Sequelize[_0x5e3b('0x3')]},'exitAt':{'type':Sequelize[_0x5e3b('0x3')]},'reason':{'type':Sequelize[_0x5e3b('0x2')]}}; \ No newline at end of file +var _0x5aee=['exports','STRING','DATE','sequelize'];(function(_0x142b04,_0x3343b9){var _0x6f3459=function(_0x411a6c){while(--_0x411a6c){_0x142b04['push'](_0x142b04['shift']());}};_0x6f3459(++_0x3343b9);}(_0x5aee,0x147));var _0xe5ae=function(_0x57543b,_0x379d03){_0x57543b=_0x57543b-0x0;var _0x62fe70=_0x5aee[_0x57543b];return _0x62fe70;};'use strict';var moment=require('moment');var Sequelize=require(_0xe5ae('0x0'));module[_0xe5ae('0x1')]={'uniqueid':{'type':Sequelize[_0xe5ae('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xe5ae('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe5ae('0x3')]},'reason':{'type':Sequelize[_0xe5ae('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 3d7ab33..0343e3f 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 _0x353a=['util','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','FaxQueueReport','rawAttributes','type','key','keys','filters','intersection','attributes','fields','query','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','show','params','length','find','create','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x578543,_0x2ac9bb){var _0x24ff33=function(_0x1a3b72){while(--_0x1a3b72){_0x578543['push'](_0x578543['shift']());}};_0x24ff33(++_0x2ac9bb);}(_0x353a,0x1ad));var _0xa353=function(_0xdbff26,_0xfc8995){_0xdbff26=_0xdbff26-0x0;var _0x4adb23=_0x353a[_0xdbff26];return _0x4adb23;};'use strict';var pdf=require(_0xa353('0x0'));var emlformat=require(_0xa353('0x1'));var rimraf=require(_0xa353('0x2'));var zipdir=require(_0xa353('0x3'));var jsonpatch=require(_0xa353('0x4'));var rp=require(_0xa353('0x5'));var moment=require(_0xa353('0x6'));var BPromise=require(_0xa353('0x7'));var Mustache=require(_0xa353('0x8'));var util=require(_0xa353('0x9'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa353('0xa'));var squel=require('squel');var crypto=require(_0xa353('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa353('0xc'));var Papa=require(_0xa353('0xd'));var Redis=require('ioredis');var authService=require(_0xa353('0xe'));var qs=require(_0xa353('0xf'));var as=require(_0xa353('0x10'));var hardwareService=require(_0xa353('0x11'));var logger=require(_0xa353('0x12'))('api');var utils=require(_0xa353('0x13'));var config=require(_0xa353('0x14'));var db=require(_0xa353('0x15'))['db'];function respondWithStatusCode(_0x2f1f19,_0x31ca36){_0x31ca36=_0x31ca36||0xcc;return function(_0x41df32){if(_0x41df32){return _0x2f1f19[_0xa353('0x16')](_0x31ca36);}return _0x2f1f19[_0xa353('0x17')](_0x31ca36)['end']();};}function respondWithResult(_0x422958,_0x49e00c){_0x49e00c=_0x49e00c||0xc8;return function(_0x14049d){if(_0x14049d){return _0x422958[_0xa353('0x17')](_0x49e00c)['json'](_0x14049d);}};}function respondWithFilteredResult(_0xf49b99,_0x2a5077){return function(_0x40dc09){if(_0x40dc09){var _0x454101=_0x40dc09[_0xa353('0x18')],_0x595292=_0x2a5077[_0xa353('0x19')],_0x2749d2=_0x2a5077[_0xa353('0x19')]+_0x2a5077[_0xa353('0x1a')],_0x10c53d;if(_0x2749d2>=_0x454101){_0x2749d2=_0x454101;_0x10c53d=0xc8;}else{_0x10c53d=0xce;}_0xf49b99['status'](_0x10c53d);return _0xf49b99[_0xa353('0x1b')](_0xa353('0x1c'),_0x595292+'-'+_0x2749d2+'/'+_0x454101)[_0xa353('0x1d')](_0x40dc09);}return null;};}function patchUpdates(_0x3846f6){return function(_0x20027e){try{jsonpatch[_0xa353('0x1e')](_0x20027e,_0x3846f6,!![]);}catch(_0x5d4c2b){return BPromise['reject'](_0x5d4c2b);}return _0x20027e[_0xa353('0x1f')]();};}function saveUpdates(_0x11e42d,_0x41f52f){return function(_0x1081d6){if(_0x1081d6){return _0x1081d6[_0xa353('0x20')](_0x11e42d)[_0xa353('0x21')](function(_0x15a173){return _0x15a173;});}return null;};}function removeEntity(_0xcdc95b,_0x1e494f){return function(_0x3a554f){if(_0x3a554f){return _0x3a554f[_0xa353('0x22')]()['then'](function(){_0xcdc95b[_0xa353('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x113050,_0x21418f){return function(_0x212128){if(!_0x212128){_0x113050[_0xa353('0x16')](0x194);}return _0x212128;};}function handleError(_0x54054f,_0x5a82b5){_0x5a82b5=_0x5a82b5||0x1f4;return function(_0x556e99){logger[_0xa353('0x23')](_0x556e99[_0xa353('0x24')]);if(_0x556e99[_0xa353('0x25')]){delete _0x556e99[_0xa353('0x25')];}_0x54054f[_0xa353('0x17')](_0x5a82b5)[_0xa353('0x26')](_0x556e99);};}exports[_0xa353('0x27')]=function(_0x4282da,_0x27bd01){var _0x7ee675={},_0x4b7be6={},_0x26a601={'count':0x0,'rows':[]};var _0x20ab3d=_['map'](db[_0xa353('0x28')][_0xa353('0x29')],function(_0x16d458){return{'name':_0x16d458['fieldName'],'type':_0x16d458[_0xa353('0x2a')][_0xa353('0x2b')]};});_0x4b7be6['model']=_['map'](_0x20ab3d,_0xa353('0x25'));_0x4b7be6['query']=_[_0xa353('0x2c')](_0x4282da['query']);_0x4b7be6[_0xa353('0x2d')]=_[_0xa353('0x2e')](_0x4b7be6['model'],_0x4b7be6['query']);_0x7ee675[_0xa353('0x2f')]=_['intersection'](_0x4b7be6['model'],qs[_0xa353('0x30')](_0x4282da[_0xa353('0x31')][_0xa353('0x30')]));_0x7ee675[_0xa353('0x2f')]=_0x7ee675[_0xa353('0x2f')]['length']?_0x7ee675[_0xa353('0x2f')]:_0x4b7be6[_0xa353('0x32')];if(!_0x4282da[_0xa353('0x31')][_0xa353('0x33')](_0xa353('0x34'))){_0x7ee675[_0xa353('0x1a')]=qs[_0xa353('0x1a')](_0x4282da[_0xa353('0x31')]['limit']);_0x7ee675[_0xa353('0x19')]=qs[_0xa353('0x19')](_0x4282da[_0xa353('0x31')][_0xa353('0x19')]);}_0x7ee675[_0xa353('0x35')]=qs[_0xa353('0x36')](_0x4282da[_0xa353('0x31')][_0xa353('0x36')]);_0x7ee675[_0xa353('0x37')]=qs[_0xa353('0x2d')](_[_0xa353('0x38')](_0x4282da[_0xa353('0x31')],_0x4b7be6[_0xa353('0x2d')]),_0x20ab3d);if(_0x4282da[_0xa353('0x31')][_0xa353('0x39')]){_0x7ee675[_0xa353('0x37')]=_[_0xa353('0x3a')](_0x7ee675[_0xa353('0x37')],{'$or':_[_0xa353('0x3b')](_0x20ab3d,function(_0x3665b3){if(_0x3665b3[_0xa353('0x2a')]!==_0xa353('0x3c')){var _0x4cb88c={};_0x4cb88c[_0x3665b3[_0xa353('0x25')]]={'$like':'%'+_0x4282da[_0xa353('0x31')][_0xa353('0x39')]+'%'};return _0x4cb88c;}})});}_0x7ee675=_[_0xa353('0x3a')]({},_0x7ee675,_0x4282da[_0xa353('0x3d')]);var _0x1fea04={'where':_0x7ee675[_0xa353('0x37')]};return db[_0xa353('0x28')][_0xa353('0x18')](_0x1fea04)[_0xa353('0x21')](function(_0x36d84b){_0x26a601['count']=_0x36d84b;if(_0x4282da[_0xa353('0x31')][_0xa353('0x3e')]){_0x7ee675[_0xa353('0x3f')]=[{'all':!![]}];}return db[_0xa353('0x28')][_0xa353('0x40')](_0x7ee675);})[_0xa353('0x21')](function(_0x5a6582){_0x26a601['rows']=_0x5a6582;return _0x26a601;})[_0xa353('0x21')](respondWithFilteredResult(_0x27bd01,_0x7ee675))['catch'](handleError(_0x27bd01,null));};exports[_0xa353('0x41')]=function(_0x3cd719,_0x2b6e70){var _0xa1c9cd={'raw':!![],'where':{'id':_0x3cd719[_0xa353('0x42')]['id']}},_0x34205f={};_0x34205f[_0xa353('0x32')]=_[_0xa353('0x2c')](db[_0xa353('0x28')][_0xa353('0x29')]);_0x34205f[_0xa353('0x31')]=_['keys'](_0x3cd719[_0xa353('0x31')]);_0x34205f[_0xa353('0x2d')]=_[_0xa353('0x2e')](_0x34205f['model'],_0x34205f[_0xa353('0x31')]);_0xa1c9cd[_0xa353('0x2f')]=_['intersection'](_0x34205f['model'],qs[_0xa353('0x30')](_0x3cd719[_0xa353('0x31')][_0xa353('0x30')]));_0xa1c9cd[_0xa353('0x2f')]=_0xa1c9cd['attributes'][_0xa353('0x43')]?_0xa1c9cd[_0xa353('0x2f')]:_0x34205f[_0xa353('0x32')];if(_0x3cd719[_0xa353('0x31')][_0xa353('0x3e')]){_0xa1c9cd['include']=[{'all':!![]}];}_0xa1c9cd=_[_0xa353('0x3a')]({},_0xa1c9cd,_0x3cd719[_0xa353('0x3d')]);return db['FaxQueueReport'][_0xa353('0x44')](_0xa1c9cd)[_0xa353('0x21')](handleEntityNotFound(_0x2b6e70,null))[_0xa353('0x21')](respondWithResult(_0x2b6e70,null))['catch'](handleError(_0x2b6e70,null));};exports[_0xa353('0x45')]=function(_0x3f0852,_0x5e257f){return db[_0xa353('0x28')][_0xa353('0x45')](_0x3f0852[_0xa353('0x46')],{})[_0xa353('0x21')](respondWithResult(_0x5e257f,0xc9))[_0xa353('0x47')](handleError(_0x5e257f,null));};exports[_0xa353('0x20')]=function(_0x5df5f2,_0x1c4d31){if(_0x5df5f2[_0xa353('0x46')]['id']){delete _0x5df5f2['body']['id'];}return db[_0xa353('0x28')][_0xa353('0x44')]({'where':{'id':_0x5df5f2[_0xa353('0x42')]['id']}})[_0xa353('0x21')](handleEntityNotFound(_0x1c4d31,null))[_0xa353('0x21')](saveUpdates(_0x5df5f2[_0xa353('0x46')],null))[_0xa353('0x21')](respondWithResult(_0x1c4d31,null))[_0xa353('0x47')](handleError(_0x1c4d31,null));};exports['destroy']=function(_0x592072,_0xa1698b){return db[_0xa353('0x28')][_0xa353('0x44')]({'where':{'id':_0x592072[_0xa353('0x42')]['id']}})[_0xa353('0x21')](handleEntityNotFound(_0xa1698b,null))[_0xa353('0x21')](removeEntity(_0xa1698b,null))['catch'](handleError(_0xa1698b,null));};exports[_0xa353('0x48')]=function(_0x4596ca,_0x405813){return db['FaxQueueReport'][_0xa353('0x48')]()[_0xa353('0x21')](respondWithResult(_0x405813,null))['catch'](handleError(_0x405813,null));}; \ No newline at end of file +var _0x6d5c=['destroy','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x6d5c,0x72));var _0xc6d5=function(_0x4b6edf,_0x351e94){_0x4b6edf=_0x4b6edf-0x0;var _0x2d925b=_0x6d5c[_0x4b6edf];return _0x2d925b;};'use strict';var pdf=require(_0xc6d5('0x0'));var emlformat=require(_0xc6d5('0x1'));var rimraf=require(_0xc6d5('0x2'));var zipdir=require(_0xc6d5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc6d5('0x4'));var moment=require(_0xc6d5('0x5'));var BPromise=require(_0xc6d5('0x6'));var Mustache=require(_0xc6d5('0x7'));var util=require(_0xc6d5('0x8'));var path=require(_0xc6d5('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc6d5('0xa'));var fs=require('fs');var _=require(_0xc6d5('0xb'));var squel=require(_0xc6d5('0xc'));var crypto=require(_0xc6d5('0xd'));var jsforce=require(_0xc6d5('0xe'));var deskjs=require(_0xc6d5('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc6d5('0x10'));var Papa=require('papaparse');var Redis=require(_0xc6d5('0x11'));var authService=require(_0xc6d5('0x12'));var qs=require(_0xc6d5('0x13'));var as=require(_0xc6d5('0x14'));var hardwareService=require(_0xc6d5('0x15'));var logger=require(_0xc6d5('0x16'))(_0xc6d5('0x17'));var utils=require(_0xc6d5('0x18'));var config=require(_0xc6d5('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x484907,_0x1d3995){_0x1d3995=_0x1d3995||0xcc;return function(_0x46fed0){if(_0x46fed0){return _0x484907[_0xc6d5('0x1a')](_0x1d3995);}return _0x484907[_0xc6d5('0x1b')](_0x1d3995)[_0xc6d5('0x1c')]();};}function respondWithResult(_0x16418f,_0x143c6c){_0x143c6c=_0x143c6c||0xc8;return function(_0xcc80b5){if(_0xcc80b5){return _0x16418f[_0xc6d5('0x1b')](_0x143c6c)['json'](_0xcc80b5);}};}function respondWithFilteredResult(_0x486b41,_0x399391){return function(_0x8e3e1c){if(_0x8e3e1c){var _0x12c852=_0x8e3e1c[_0xc6d5('0x1d')],_0x1d15d7=_0x399391[_0xc6d5('0x1e')],_0x16f377=_0x399391['offset']+_0x399391[_0xc6d5('0x1f')],_0x51bddf;if(_0x16f377>=_0x12c852){_0x16f377=_0x12c852;_0x51bddf=0xc8;}else{_0x51bddf=0xce;}_0x486b41['status'](_0x51bddf);return _0x486b41[_0xc6d5('0x20')](_0xc6d5('0x21'),_0x1d15d7+'-'+_0x16f377+'/'+_0x12c852)[_0xc6d5('0x22')](_0x8e3e1c);}return null;};}function patchUpdates(_0x41684f){return function(_0x4e59e8){try{jsonpatch[_0xc6d5('0x23')](_0x4e59e8,_0x41684f,!![]);}catch(_0x11262d){return BPromise['reject'](_0x11262d);}return _0x4e59e8[_0xc6d5('0x24')]();};}function saveUpdates(_0x2322bb,_0x5db41e){return function(_0x3fad71){if(_0x3fad71){return _0x3fad71[_0xc6d5('0x25')](_0x2322bb)['then'](function(_0x5993b8){return _0x5993b8;});}return null;};}function removeEntity(_0x3fc8ed,_0x4bf6a5){return function(_0x4b52df){if(_0x4b52df){return _0x4b52df[_0xc6d5('0x26')]()[_0xc6d5('0x27')](function(){_0x3fc8ed['status'](0xcc)[_0xc6d5('0x1c')]();});}};}function handleEntityNotFound(_0x4dc3d9,_0x2ce429){return function(_0x51811a){if(!_0x51811a){_0x4dc3d9[_0xc6d5('0x1a')](0x194);}return _0x51811a;};}function handleError(_0x106b34,_0x4d448d){_0x4d448d=_0x4d448d||0x1f4;return function(_0x4fde6e){logger[_0xc6d5('0x28')](_0x4fde6e[_0xc6d5('0x29')]);if(_0x4fde6e[_0xc6d5('0x2a')]){delete _0x4fde6e['name'];}_0x106b34['status'](_0x4d448d)[_0xc6d5('0x2b')](_0x4fde6e);};}exports[_0xc6d5('0x2c')]=function(_0x35545d,_0x24bb19){var _0x5900f8={},_0x4ce48f={},_0x5e2963={'count':0x0,'rows':[]};var _0x3bea4a=_[_0xc6d5('0x2d')](db[_0xc6d5('0x2e')][_0xc6d5('0x2f')],function(_0x3a6c22){return{'name':_0x3a6c22[_0xc6d5('0x30')],'type':_0x3a6c22[_0xc6d5('0x31')][_0xc6d5('0x32')]};});_0x4ce48f['model']=_['map'](_0x3bea4a,'name');_0x4ce48f[_0xc6d5('0x33')]=_[_0xc6d5('0x34')](_0x35545d[_0xc6d5('0x33')]);_0x4ce48f[_0xc6d5('0x35')]=_['intersection'](_0x4ce48f[_0xc6d5('0x36')],_0x4ce48f[_0xc6d5('0x33')]);_0x5900f8['attributes']=_[_0xc6d5('0x37')](_0x4ce48f[_0xc6d5('0x36')],qs[_0xc6d5('0x38')](_0x35545d['query']['fields']));_0x5900f8['attributes']=_0x5900f8[_0xc6d5('0x39')]['length']?_0x5900f8[_0xc6d5('0x39')]:_0x4ce48f['model'];if(!_0x35545d[_0xc6d5('0x33')]['hasOwnProperty'](_0xc6d5('0x3a'))){_0x5900f8[_0xc6d5('0x1f')]=qs[_0xc6d5('0x1f')](_0x35545d[_0xc6d5('0x33')][_0xc6d5('0x1f')]);_0x5900f8['offset']=qs[_0xc6d5('0x1e')](_0x35545d['query']['offset']);}_0x5900f8['order']=qs[_0xc6d5('0x3b')](_0x35545d['query'][_0xc6d5('0x3b')]);_0x5900f8[_0xc6d5('0x3c')]=qs[_0xc6d5('0x35')](_['pick'](_0x35545d[_0xc6d5('0x33')],_0x4ce48f[_0xc6d5('0x35')]),_0x3bea4a);if(_0x35545d[_0xc6d5('0x33')][_0xc6d5('0x3d')]){_0x5900f8[_0xc6d5('0x3c')]=_[_0xc6d5('0x3e')](_0x5900f8[_0xc6d5('0x3c')],{'$or':_[_0xc6d5('0x2d')](_0x3bea4a,function(_0x4b348b){if(_0x4b348b[_0xc6d5('0x31')]!==_0xc6d5('0x3f')){var _0x4b78f8={};_0x4b78f8[_0x4b348b[_0xc6d5('0x2a')]]={'$like':'%'+_0x35545d[_0xc6d5('0x33')][_0xc6d5('0x3d')]+'%'};return _0x4b78f8;}})});}_0x5900f8=_[_0xc6d5('0x3e')]({},_0x5900f8,_0x35545d[_0xc6d5('0x40')]);var _0x2faae6={'where':_0x5900f8[_0xc6d5('0x3c')]};return db[_0xc6d5('0x2e')][_0xc6d5('0x1d')](_0x2faae6)[_0xc6d5('0x27')](function(_0xc5104){_0x5e2963[_0xc6d5('0x1d')]=_0xc5104;if(_0x35545d[_0xc6d5('0x33')][_0xc6d5('0x41')]){_0x5900f8[_0xc6d5('0x42')]=[{'all':!![]}];}return db[_0xc6d5('0x2e')][_0xc6d5('0x43')](_0x5900f8);})[_0xc6d5('0x27')](function(_0x41ef76){_0x5e2963[_0xc6d5('0x44')]=_0x41ef76;return _0x5e2963;})[_0xc6d5('0x27')](respondWithFilteredResult(_0x24bb19,_0x5900f8))[_0xc6d5('0x45')](handleError(_0x24bb19,null));};exports[_0xc6d5('0x46')]=function(_0x3e4802,_0x231760){var _0x2a570c={'raw':!![],'where':{'id':_0x3e4802[_0xc6d5('0x47')]['id']}},_0x4f62e5={};_0x4f62e5[_0xc6d5('0x36')]=_[_0xc6d5('0x34')](db[_0xc6d5('0x2e')]['rawAttributes']);_0x4f62e5[_0xc6d5('0x33')]=_[_0xc6d5('0x34')](_0x3e4802[_0xc6d5('0x33')]);_0x4f62e5[_0xc6d5('0x35')]=_['intersection'](_0x4f62e5[_0xc6d5('0x36')],_0x4f62e5['query']);_0x2a570c[_0xc6d5('0x39')]=_[_0xc6d5('0x37')](_0x4f62e5['model'],qs[_0xc6d5('0x38')](_0x3e4802[_0xc6d5('0x33')][_0xc6d5('0x38')]));_0x2a570c['attributes']=_0x2a570c[_0xc6d5('0x39')]['length']?_0x2a570c[_0xc6d5('0x39')]:_0x4f62e5[_0xc6d5('0x36')];if(_0x3e4802[_0xc6d5('0x33')][_0xc6d5('0x41')]){_0x2a570c[_0xc6d5('0x42')]=[{'all':!![]}];}_0x2a570c=_['merge']({},_0x2a570c,_0x3e4802['options']);return db[_0xc6d5('0x2e')][_0xc6d5('0x48')](_0x2a570c)[_0xc6d5('0x27')](handleEntityNotFound(_0x231760,null))['then'](respondWithResult(_0x231760,null))['catch'](handleError(_0x231760,null));};exports[_0xc6d5('0x49')]=function(_0x3ba21a,_0x24393f){return db[_0xc6d5('0x2e')][_0xc6d5('0x49')](_0x3ba21a['body'],{})[_0xc6d5('0x27')](respondWithResult(_0x24393f,0xc9))[_0xc6d5('0x45')](handleError(_0x24393f,null));};exports['update']=function(_0x162069,_0x25f28b){if(_0x162069[_0xc6d5('0x4a')]['id']){delete _0x162069['body']['id'];}return db[_0xc6d5('0x2e')][_0xc6d5('0x48')]({'where':{'id':_0x162069['params']['id']}})[_0xc6d5('0x27')](handleEntityNotFound(_0x25f28b,null))[_0xc6d5('0x27')](saveUpdates(_0x162069[_0xc6d5('0x4a')],null))[_0xc6d5('0x27')](respondWithResult(_0x25f28b,null))[_0xc6d5('0x45')](handleError(_0x25f28b,null));};exports[_0xc6d5('0x26')]=function(_0x2c2d94,_0x4c673e){return db[_0xc6d5('0x2e')][_0xc6d5('0x48')]({'where':{'id':_0x2c2d94['params']['id']}})[_0xc6d5('0x27')](handleEntityNotFound(_0x4c673e,null))['then'](removeEntity(_0x4c673e,null))[_0xc6d5('0x45')](handleError(_0x4c673e,null));};exports[_0xc6d5('0x4b')]=function(_0x5e0ae9,_0x4203ba){return db[_0xc6d5('0x2e')][_0xc6d5('0x4b')]()[_0xc6d5('0x27')](respondWithResult(_0x4203ba,null))[_0xc6d5('0x45')](handleError(_0x4203ba,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index cf7e79a..70e0d1f 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 _0x1c3a=['define','report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./faxQueueReport.attributes','exports'];(function(_0x443706,_0x16a95d){var _0x50a50e=function(_0x2399ab){while(--_0x2399ab){_0x443706['push'](_0x443706['shift']());}};_0x50a50e(++_0x16a95d);}(_0x1c3a,0xdb));var _0xa1c3=function(_0x3b3210,_0x25e8ed){_0x3b3210=_0x3b3210-0x0;var _0x5b5484=_0x1c3a[_0x3b3210];return _0x5b5484;};'use strict';var _=require(_0xa1c3('0x0'));var util=require(_0xa1c3('0x1'));var logger=require(_0xa1c3('0x2'))('api');var moment=require(_0xa1c3('0x3'));var BPromise=require('bluebird');var rp=require(_0xa1c3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1c3('0x5'));var config=require(_0xa1c3('0x6'));var attributes=require(_0xa1c3('0x7'));module[_0xa1c3('0x8')]=function(_0xc72fbc,_0x3a3337){return _0xc72fbc[_0xa1c3('0x9')]('FaxQueueReport',attributes,{'tableName':_0xa1c3('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa1c3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x28a8=['api','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger'];(function(_0x56fb33,_0x37be08){var _0x435ee4=function(_0xa80804){while(--_0xa80804){_0x56fb33['push'](_0x56fb33['shift']());}};_0x435ee4(++_0x37be08);}(_0x28a8,0x1aa));var _0x828a=function(_0x42f4e0,_0x1a481f){_0x42f4e0=_0x42f4e0-0x0;var _0x5eb3e0=_0x28a8[_0x42f4e0];return _0x5eb3e0;};'use strict';var _=require(_0x828a('0x0'));var util=require(_0x828a('0x1'));var logger=require(_0x828a('0x2'))(_0x828a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x828a('0x4'));var fs=require('fs');var path=require(_0x828a('0x5'));var rimraf=require(_0x828a('0x6'));var config=require(_0x828a('0x7'));var attributes=require(_0x828a('0x8'));module[_0x828a('0x9')]=function(_0x314043,_0x3c2f1a){return _0x314043[_0x828a('0xa')](_0x828a('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x828a('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index af77561..1a51e82 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 _0xb8f6=['message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','stringify','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x36ebca,_0x57a851){var _0x5d751a=function(_0x396619){while(--_0x396619){_0x36ebca['push'](_0x36ebca['shift']());}};_0x5d751a(++_0x57a851);}(_0xb8f6,0x6f));var _0x6b8f=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xb8f6[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x6b8f('0x0'));var util=require(_0x6b8f('0x1'));var moment=require(_0x6b8f('0x2'));var BPromise=require(_0x6b8f('0x3'));var rs=require(_0x6b8f('0x4'));var fs=require('fs');var Redis=require(_0x6b8f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6b8f('0x6'));var logger=require('../../config/logger')(_0x6b8f('0x7'));var config=require(_0x6b8f('0x8'));var jayson=require(_0x6b8f('0x9'));var client=jayson[_0x6b8f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9b96aa,_0x1e9b14,_0x5b1c94){return new BPromise(function(_0x2ff00b,_0x469de3){return client[_0x6b8f('0xb')](_0x9b96aa,_0x5b1c94)['then'](function(_0x10670c){logger[_0x6b8f('0xc')](_0x6b8f('0xd'),_0x1e9b14,_0x6b8f('0xe'));logger[_0x6b8f('0xf')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1e9b14,_0x6b8f('0xe'),JSON['stringify'](_0x10670c));if(_0x10670c[_0x6b8f('0x10')]){if(_0x10670c['error']['code']===0x1f4){logger[_0x6b8f('0x10')](_0x6b8f('0xd'),_0x1e9b14,_0x10670c[_0x6b8f('0x10')][_0x6b8f('0x11')]);return _0x469de3(_0x10670c[_0x6b8f('0x10')][_0x6b8f('0x11')]);}logger[_0x6b8f('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x1e9b14,_0x10670c['error'][_0x6b8f('0x11')]);return _0x2ff00b(_0x10670c[_0x6b8f('0x10')]['message']);}else{logger[_0x6b8f('0xc')](_0x6b8f('0xd'),_0x1e9b14,_0x6b8f('0xe'));_0x2ff00b(_0x10670c[_0x6b8f('0x12')][_0x6b8f('0x11')]);}})[_0x6b8f('0x13')](function(_0x1afed2){logger[_0x6b8f('0x10')](_0x6b8f('0xd'),_0x1e9b14,_0x1afed2);_0x469de3(_0x1afed2);});});}exports[_0x6b8f('0x14')]=function(_0xd03ff0){var _0x27fb7d=this;return new Promise(function(_0x5aec43,_0x6d09ee){return db[_0x6b8f('0x15')][_0x6b8f('0x16')](_0xd03ff0[_0x6b8f('0x17')],{'raw':_0xd03ff0[_0x6b8f('0x18')]?_0xd03ff0[_0x6b8f('0x18')][_0x6b8f('0x19')]===undefined?!![]:![]:!![]})[_0x6b8f('0x1a')](function(_0x2b5d4a){logger['info'](_0x6b8f('0x14'),_0xd03ff0);logger[_0x6b8f('0xf')]('CreateFaxQueueReport',_0xd03ff0,JSON[_0x6b8f('0x1b')](_0x2b5d4a));_0x5aec43(_0x2b5d4a);})['catch'](function(_0xe752ef){logger[_0x6b8f('0x10')](_0x6b8f('0x14'),_0xe752ef[_0x6b8f('0x11')],_0xd03ff0);_0x6d09ee(_0x27fb7d[_0x6b8f('0x10')](0x1f4,_0xe752ef[_0x6b8f('0x11')]));});});};exports['UpdateFaxQueueReport']=function(_0x53abf8){var _0x1283df=this;return new Promise(function(_0xf97a83,_0x2d081d){return db[_0x6b8f('0x15')]['update'](_0x53abf8[_0x6b8f('0x17')],{'raw':_0x53abf8['options']?_0x53abf8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53abf8[_0x6b8f('0x18')]?_0x53abf8[_0x6b8f('0x18')][_0x6b8f('0x1c')]||null:null,'attributes':_0x53abf8[_0x6b8f('0x18')]?_0x53abf8['options'][_0x6b8f('0x1d')]||null:null,'limit':_0x53abf8[_0x6b8f('0x18')]?_0x53abf8[_0x6b8f('0x18')][_0x6b8f('0x1e')]||null:null})[_0x6b8f('0x1a')](function(_0x1c3246){logger[_0x6b8f('0xc')](_0x6b8f('0x1f'),_0x53abf8);logger['debug']('UpdateFaxQueueReport',_0x53abf8,JSON[_0x6b8f('0x1b')](_0x1c3246));_0xf97a83(_0x1c3246);})['catch'](function(_0x336185){logger['error']('UpdateFaxQueueReport',_0x336185['message'],_0x53abf8);_0x2d081d(_0x1283df['error'](0x1f4,_0x336185['message']));});});}; \ No newline at end of file +var _0xaaef=['../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateFaxQueueReport','create','body','options','FaxQueueReport','update','raw','where','UpdateFaxQueueReport','lodash','moment','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x3fddcc,_0x23f3e3){var _0x3104cc=function(_0x50b8db){while(--_0x50b8db){_0x3fddcc['push'](_0x3fddcc['shift']());}};_0x3104cc(++_0x23f3e3);}(_0xaaef,0x8b));var _0xfaae=function(_0x1d4fb3,_0x51b055){_0x1d4fb3=_0x1d4fb3-0x0;var _0x14759d=_0xaaef[_0x1d4fb3];return _0x14759d;};'use strict';var _=require(_0xfaae('0x0'));var util=require('util');var moment=require(_0xfaae('0x1'));var BPromise=require(_0xfaae('0x2'));var rs=require(_0xfaae('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfaae('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfaae('0x5'));var config=require(_0xfaae('0x6'));var jayson=require(_0xfaae('0x7'));var client=jayson[_0xfaae('0x8')][_0xfaae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x249b9a,_0x25f7f8,_0x3660bf){return new BPromise(function(_0x34ec4c,_0x50bd81){return client[_0xfaae('0xa')](_0x249b9a,_0x3660bf)[_0xfaae('0xb')](function(_0x3466ab){logger[_0xfaae('0xc')](_0xfaae('0xd'),_0x25f7f8,_0xfaae('0xe'));logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x25f7f8,_0xfaae('0xe'),JSON[_0xfaae('0xf')](_0x3466ab));if(_0x3466ab[_0xfaae('0x10')]){if(_0x3466ab[_0xfaae('0x10')][_0xfaae('0x11')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x25f7f8,_0x3466ab[_0xfaae('0x10')]['message']);return _0x50bd81(_0x3466ab[_0xfaae('0x10')][_0xfaae('0x12')]);}logger['error'](_0xfaae('0xd'),_0x25f7f8,_0x3466ab[_0xfaae('0x10')]['message']);return _0x34ec4c(_0x3466ab[_0xfaae('0x10')]['message']);}else{logger[_0xfaae('0xc')](_0xfaae('0xd'),_0x25f7f8,_0xfaae('0xe'));_0x34ec4c(_0x3466ab[_0xfaae('0x13')][_0xfaae('0x12')]);}})['catch'](function(_0x5bf6ba){logger[_0xfaae('0x10')](_0xfaae('0xd'),_0x25f7f8,_0x5bf6ba);_0x50bd81(_0x5bf6ba);});});}exports[_0xfaae('0x14')]=function(_0x4533ad){var _0x4d183f=this;return new Promise(function(_0x19529e,_0x33632f){return db['FaxQueueReport'][_0xfaae('0x15')](_0x4533ad[_0xfaae('0x16')],{'raw':_0x4533ad[_0xfaae('0x17')]?_0x4533ad[_0xfaae('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xfaae('0xb')](function(_0x52be45){logger['info'](_0xfaae('0x14'),_0x4533ad);logger['debug']('CreateFaxQueueReport',_0x4533ad,JSON['stringify'](_0x52be45));_0x19529e(_0x52be45);})['catch'](function(_0x66591){logger[_0xfaae('0x10')](_0xfaae('0x14'),_0x66591['message'],_0x4533ad);_0x33632f(_0x4d183f[_0xfaae('0x10')](0x1f4,_0x66591[_0xfaae('0x12')]));});});};exports['UpdateFaxQueueReport']=function(_0x3135aa){var _0x58a77e=this;return new Promise(function(_0x25014d,_0x2bf601){return db[_0xfaae('0x18')][_0xfaae('0x19')](_0x3135aa['body'],{'raw':_0x3135aa[_0xfaae('0x17')]?_0x3135aa[_0xfaae('0x17')][_0xfaae('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3135aa[_0xfaae('0x17')]?_0x3135aa['options'][_0xfaae('0x1b')]||null:null,'attributes':_0x3135aa[_0xfaae('0x17')]?_0x3135aa[_0xfaae('0x17')]['attributes']||null:null,'limit':_0x3135aa[_0xfaae('0x17')]?_0x3135aa[_0xfaae('0x17')]['limit']||null:null})[_0xfaae('0xb')](function(_0x557b9e){logger[_0xfaae('0xc')](_0xfaae('0x1c'),_0x3135aa);logger['debug'](_0xfaae('0x1c'),_0x3135aa,JSON[_0xfaae('0xf')](_0x557b9e));_0x25014d(_0x557b9e);})['catch'](function(_0x228f36){logger['error']('UpdateFaxQueueReport',_0x228f36['message'],_0x3135aa);_0x2bf601(_0x58a77e[_0xfaae('0x10')](0x1f4,_0x228f36['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 59c818a..ad55982 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 _0xcbc5=['multer','util','express','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','delete','destroy','exports'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xcbc5,0x66));var _0x5cbc=function(_0x103c4c,_0x285348){_0x103c4c=_0x103c4c-0x0;var _0x3fc15e=_0xcbc5[_0x103c4c];return _0x3fc15e;};'use strict';var multer=require(_0x5cbc('0x0'));var util=require(_0x5cbc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5cbc('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5cbc('0x3'));var config=require(_0x5cbc('0x4'));var controller=require(_0x5cbc('0x5'));router[_0x5cbc('0x6')]('/',auth[_0x5cbc('0x7')](),controller[_0x5cbc('0x8')]);router[_0x5cbc('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x5cbc('0x9')]);router[_0x5cbc('0x6')](_0x5cbc('0xa'),auth[_0x5cbc('0x7')](),controller[_0x5cbc('0xb')]);router['post']('/',auth[_0x5cbc('0x7')](),controller[_0x5cbc('0xc')]);router[_0x5cbc('0xd')](_0x5cbc('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5cbc('0xe')](_0x5cbc('0xa'),auth[_0x5cbc('0x7')](),controller[_0x5cbc('0xf')]);module[_0x5cbc('0x10')]=router; \ No newline at end of file +var _0x80ef=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','index','get','isAuthenticated','describe','/:id','show','create','put'];(function(_0x3425f9,_0x2358ca){var _0x814f39=function(_0x4cb267){while(--_0x4cb267){_0x3425f9['push'](_0x3425f9['shift']());}};_0x814f39(++_0x2358ca);}(_0x80ef,0xd5));var _0xf80e=function(_0x486e6f,_0x395450){_0x486e6f=_0x486e6f-0x0;var _0x104212=_0x80ef[_0x486e6f];return _0x104212;};'use strict';var multer=require(_0xf80e('0x0'));var util=require('util');var path=require(_0xf80e('0x1'));var timeout=require(_0xf80e('0x2'));var express=require(_0xf80e('0x3'));var router=express[_0xf80e('0x4')]();var auth=require(_0xf80e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf80e('0x6'));var controller=require('./faxQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf80e('0x7')]);router[_0xf80e('0x8')]('/describe',auth[_0xf80e('0x9')](),controller[_0xf80e('0xa')]);router[_0xf80e('0x8')](_0xf80e('0xb'),auth['isAuthenticated'](),controller[_0xf80e('0xc')]);router['post']('/',auth[_0xf80e('0x9')](),controller[_0xf80e('0xd')]);router[_0xf80e('0xe')]('/:id',auth[_0xf80e('0x9')](),controller[_0xf80e('0xf')]);router[_0xf80e('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf80e('0x11')]);module[_0xf80e('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 65e1af6..4593e28 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 _0xfd09=['DATE','NOW','moment','sequelize','exports','STRING','ENUM','account','agent','queue'];(function(_0x53e654,_0xf5d2a0){var _0xed8977=function(_0x35a504){while(--_0x35a504){_0x53e654['push'](_0x53e654['shift']());}};_0xed8977(++_0xf5d2a0);}(_0xfd09,0xde));var _0x9fd0=function(_0x56f935,_0xbb3e13){_0x56f935=_0x56f935-0x0;var _0x25ff2f=_0xfd09[_0x56f935];return _0x25ff2f;};'use strict';var moment=require(_0x9fd0('0x0'));var Sequelize=require(_0x9fd0('0x1'));module[_0x9fd0('0x2')]={'uniqueid':{'type':Sequelize[_0x9fd0('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9fd0('0x4')](_0x9fd0('0x5'),_0x9fd0('0x6'),'queue'),'allowNull':![],'defaultValue':_0x9fd0('0x7')},'transferredAt':{'type':Sequelize[_0x9fd0('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x9fd0('0x9')]}}; \ No newline at end of file +var _0xbbb2=['ENUM','agent','queue','moment','exports'];(function(_0x1b6c1f,_0x2416af){var _0xc19361=function(_0x4084eb){while(--_0x4084eb){_0x1b6c1f['push'](_0x1b6c1f['shift']());}};_0xc19361(++_0x2416af);}(_0xbbb2,0x161));var _0x2bbb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbbb2[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x2bbb('0x0'));var Sequelize=require('sequelize');module[_0x2bbb('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2bbb('0x2')]('account',_0x2bbb('0x3'),_0x2bbb('0x4')),'allowNull':![],'defaultValue':_0x2bbb('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index ef0c8dd..c08616e 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 _0xadb5=['map','fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','VIRTUAL','merge','options','FaxTransferReport','findAll','rows','catch','show','rawAttributes','fields','includeAll','include','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','then','destroy','stack','name','send','index'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xadb5,0xad));var _0x5adb=function(_0x46a22b,_0x4ef17d){_0x46a22b=_0x46a22b-0x0;var _0x341c21=_0xadb5[_0x46a22b];return _0x341c21;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');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('0x8'));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 db=require(_0x5adb('0x17'))['db'];function respondWithStatusCode(_0x56012f,_0x2a0b70){_0x2a0b70=_0x2a0b70||0xcc;return function(_0x5433bf){if(_0x5433bf){return _0x56012f[_0x5adb('0x18')](_0x2a0b70);}return _0x56012f[_0x5adb('0x19')](_0x2a0b70)[_0x5adb('0x1a')]();};}function respondWithResult(_0x5c929a,_0x2a545b){_0x2a545b=_0x2a545b||0xc8;return function(_0x34af2c){if(_0x34af2c){return _0x5c929a[_0x5adb('0x19')](_0x2a545b)['json'](_0x34af2c);}};}function respondWithFilteredResult(_0x2312de,_0x518823){return function(_0x367d82){if(_0x367d82){var _0x42a482=_0x367d82[_0x5adb('0x1b')],_0x30614e=_0x518823[_0x5adb('0x1c')],_0x304784=_0x518823[_0x5adb('0x1c')]+_0x518823[_0x5adb('0x1d')],_0x1c0f97;if(_0x304784>=_0x42a482){_0x304784=_0x42a482;_0x1c0f97=0xc8;}else{_0x1c0f97=0xce;}_0x2312de['status'](_0x1c0f97);return _0x2312de[_0x5adb('0x1e')]('Content-Range',_0x30614e+'-'+_0x304784+'/'+_0x42a482)[_0x5adb('0x1f')](_0x367d82);}return null;};}function patchUpdates(_0x558f76){return function(_0x3ef465){try{jsonpatch['apply'](_0x3ef465,_0x558f76,!![]);}catch(_0x5e218c){return BPromise[_0x5adb('0x20')](_0x5e218c);}return _0x3ef465[_0x5adb('0x21')]();};}function saveUpdates(_0x438671,_0x1fd4a7){return function(_0x99bc6c){if(_0x99bc6c){return _0x99bc6c['update'](_0x438671)[_0x5adb('0x22')](function(_0x5c296e){return _0x5c296e;});}return null;};}function removeEntity(_0x4e9f16,_0x3754cc){return function(_0x379b33){if(_0x379b33){return _0x379b33[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0x4e9f16[_0x5adb('0x19')](0xcc)[_0x5adb('0x1a')]();});}};}function handleEntityNotFound(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(!_0x4b1957){_0xfd9bb9[_0x5adb('0x18')](0x194);}return _0x4b1957;};}function handleError(_0x3220cd,_0x3839fb){_0x3839fb=_0x3839fb||0x1f4;return function(_0xeb556c){logger['error'](_0xeb556c[_0x5adb('0x24')]);if(_0xeb556c[_0x5adb('0x25')]){delete _0xeb556c['name'];}_0x3220cd[_0x5adb('0x19')](_0x3839fb)[_0x5adb('0x26')](_0xeb556c);};}exports[_0x5adb('0x27')]=function(_0x55b40a,_0x13ad1d){var _0xbe21b1={},_0x3a4fca={},_0x2c64a3={'count':0x0,'rows':[]};var _0x36459b=_[_0x5adb('0x28')](db['FaxTransferReport']['rawAttributes'],function(_0x5d457e){return{'name':_0x5d457e[_0x5adb('0x29')],'type':_0x5d457e[_0x5adb('0x2a')][_0x5adb('0x2b')]};});_0x3a4fca[_0x5adb('0x2c')]=_[_0x5adb('0x28')](_0x36459b,'name');_0x3a4fca[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x55b40a[_0x5adb('0x2d')]);_0x3a4fca[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x3a4fca[_0x5adb('0x2c')],_0x3a4fca[_0x5adb('0x2d')]);_0xbe21b1[_0x5adb('0x31')]=_[_0x5adb('0x30')](_0x3a4fca[_0x5adb('0x2c')],qs['fields'](_0x55b40a[_0x5adb('0x2d')]['fields']));_0xbe21b1[_0x5adb('0x31')]=_0xbe21b1[_0x5adb('0x31')]['length']?_0xbe21b1[_0x5adb('0x31')]:_0x3a4fca[_0x5adb('0x2c')];if(!_0x55b40a[_0x5adb('0x2d')]['hasOwnProperty'](_0x5adb('0x32'))){_0xbe21b1[_0x5adb('0x1d')]=qs['limit'](_0x55b40a['query'][_0x5adb('0x1d')]);_0xbe21b1['offset']=qs[_0x5adb('0x1c')](_0x55b40a[_0x5adb('0x2d')][_0x5adb('0x1c')]);}_0xbe21b1[_0x5adb('0x33')]=qs[_0x5adb('0x34')](_0x55b40a['query'][_0x5adb('0x34')]);_0xbe21b1[_0x5adb('0x35')]=qs[_0x5adb('0x2f')](_['pick'](_0x55b40a['query'],_0x3a4fca[_0x5adb('0x2f')]),_0x36459b);if(_0x55b40a[_0x5adb('0x2d')]['filter']){_0xbe21b1[_0x5adb('0x35')]=_['merge'](_0xbe21b1[_0x5adb('0x35')],{'$or':_['map'](_0x36459b,function(_0x11cb37){if(_0x11cb37['type']!==_0x5adb('0x36')){var _0x23a1db={};_0x23a1db[_0x11cb37['name']]={'$like':'%'+_0x55b40a[_0x5adb('0x2d')]['filter']+'%'};return _0x23a1db;}})});}_0xbe21b1=_[_0x5adb('0x37')]({},_0xbe21b1,_0x55b40a[_0x5adb('0x38')]);var _0xd5660c={'where':_0xbe21b1['where']};return db[_0x5adb('0x39')][_0x5adb('0x1b')](_0xd5660c)[_0x5adb('0x22')](function(_0x132803){_0x2c64a3[_0x5adb('0x1b')]=_0x132803;if(_0x55b40a['query']['includeAll']){_0xbe21b1['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x5adb('0x3a')](_0xbe21b1);})[_0x5adb('0x22')](function(_0x3a104a){_0x2c64a3[_0x5adb('0x3b')]=_0x3a104a;return _0x2c64a3;})[_0x5adb('0x22')](respondWithFilteredResult(_0x13ad1d,_0xbe21b1))[_0x5adb('0x3c')](handleError(_0x13ad1d,null));};exports[_0x5adb('0x3d')]=function(_0x3bf282,_0x478a70){var _0x53f2c6={'raw':!![],'where':{'id':_0x3bf282['params']['id']}},_0x27dbb7={};_0x27dbb7[_0x5adb('0x2c')]=_[_0x5adb('0x2e')](db[_0x5adb('0x39')][_0x5adb('0x3e')]);_0x27dbb7[_0x5adb('0x2d')]=_['keys'](_0x3bf282[_0x5adb('0x2d')]);_0x27dbb7[_0x5adb('0x2f')]=_['intersection'](_0x27dbb7[_0x5adb('0x2c')],_0x27dbb7[_0x5adb('0x2d')]);_0x53f2c6['attributes']=_[_0x5adb('0x30')](_0x27dbb7[_0x5adb('0x2c')],qs[_0x5adb('0x3f')](_0x3bf282[_0x5adb('0x2d')][_0x5adb('0x3f')]));_0x53f2c6[_0x5adb('0x31')]=_0x53f2c6[_0x5adb('0x31')]['length']?_0x53f2c6['attributes']:_0x27dbb7[_0x5adb('0x2c')];if(_0x3bf282[_0x5adb('0x2d')][_0x5adb('0x40')]){_0x53f2c6[_0x5adb('0x41')]=[{'all':!![]}];}_0x53f2c6=_['merge']({},_0x53f2c6,_0x3bf282['options']);return db[_0x5adb('0x39')][_0x5adb('0x42')](_0x53f2c6)[_0x5adb('0x22')](handleEntityNotFound(_0x478a70,null))[_0x5adb('0x22')](respondWithResult(_0x478a70,null))[_0x5adb('0x3c')](handleError(_0x478a70,null));};exports['create']=function(_0x182cbc,_0x437f52){return db['FaxTransferReport'][_0x5adb('0x43')](_0x182cbc[_0x5adb('0x44')],{})[_0x5adb('0x22')](respondWithResult(_0x437f52,0xc9))[_0x5adb('0x3c')](handleError(_0x437f52,null));};exports[_0x5adb('0x45')]=function(_0x3a5409,_0x39840e){if(_0x3a5409[_0x5adb('0x44')]['id']){delete _0x3a5409['body']['id'];}return db[_0x5adb('0x39')]['find']({'where':{'id':_0x3a5409['params']['id']}})['then'](handleEntityNotFound(_0x39840e,null))[_0x5adb('0x22')](saveUpdates(_0x3a5409[_0x5adb('0x44')],null))[_0x5adb('0x22')](respondWithResult(_0x39840e,null))['catch'](handleError(_0x39840e,null));};exports[_0x5adb('0x23')]=function(_0x5cbab5,_0x177a81){return db[_0x5adb('0x39')][_0x5adb('0x42')]({'where':{'id':_0x5cbab5['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x177a81,null))['then'](removeEntity(_0x177a81,null))[_0x5adb('0x3c')](handleError(_0x177a81,null));};exports[_0x5adb('0x46')]=function(_0x55c535,_0x2402a3){return db[_0x5adb('0x39')][_0x5adb('0x46')]()[_0x5adb('0x22')](respondWithResult(_0x2402a3,null))[_0x5adb('0x3c')](handleError(_0x2402a3,null));}; \ No newline at end of file +var _0x5f66=['show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','FaxTransferReport','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x239ebd,_0x1ce664){var _0x25c9c7=function(_0x133bdd){while(--_0x133bdd){_0x239ebd['push'](_0x239ebd['shift']());}};_0x25c9c7(++_0x1ce664);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');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('0x8'));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 db=require(_0x65f6('0x13'))['db'];function respondWithStatusCode(_0x576875,_0x419819){_0x419819=_0x419819||0xcc;return function(_0x4862a5){if(_0x4862a5){return _0x576875[_0x65f6('0x14')](_0x419819);}return _0x576875[_0x65f6('0x15')](_0x419819)[_0x65f6('0x16')]();};}function respondWithResult(_0x217570,_0x369f96){_0x369f96=_0x369f96||0xc8;return function(_0x1d29fd){if(_0x1d29fd){return _0x217570[_0x65f6('0x15')](_0x369f96)[_0x65f6('0x17')](_0x1d29fd);}};}function respondWithFilteredResult(_0x46dbc6,_0x3440af){return function(_0x59154e){if(_0x59154e){var _0x19b9ff=_0x59154e[_0x65f6('0x18')],_0x49a913=_0x3440af[_0x65f6('0x19')],_0x5dd324=_0x3440af[_0x65f6('0x19')]+_0x3440af[_0x65f6('0x1a')],_0x1693e6;if(_0x5dd324>=_0x19b9ff){_0x5dd324=_0x19b9ff;_0x1693e6=0xc8;}else{_0x1693e6=0xce;}_0x46dbc6[_0x65f6('0x15')](_0x1693e6);return _0x46dbc6[_0x65f6('0x1b')](_0x65f6('0x1c'),_0x49a913+'-'+_0x5dd324+'/'+_0x19b9ff)['json'](_0x59154e);}return null;};}function patchUpdates(_0x4d79a1){return function(_0x2d538c){try{jsonpatch['apply'](_0x2d538c,_0x4d79a1,!![]);}catch(_0x4c81f3){return BPromise['reject'](_0x4c81f3);}return _0x2d538c[_0x65f6('0x1d')]();};}function saveUpdates(_0x21ea88,_0x5114a4){return function(_0x39e19f){if(_0x39e19f){return _0x39e19f[_0x65f6('0x1e')](_0x21ea88)[_0x65f6('0x1f')](function(_0x3876ed){return _0x3876ed;});}return null;};}function removeEntity(_0x219ab2,_0xc139c2){return function(_0x581374){if(_0x581374){return _0x581374[_0x65f6('0x20')]()['then'](function(){_0x219ab2['status'](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(!_0x1eeaaa){_0xd173f4[_0x65f6('0x14')](0x194);}return _0x1eeaaa;};}function handleError(_0x2317ce,_0x2774a1){_0x2774a1=_0x2774a1||0x1f4;return function(_0x4f5a69){logger[_0x65f6('0x21')](_0x4f5a69[_0x65f6('0x22')]);if(_0x4f5a69[_0x65f6('0x23')]){delete _0x4f5a69['name'];}_0x2317ce['status'](_0x2774a1)['send'](_0x4f5a69);};}exports[_0x65f6('0x24')]=function(_0x16cde8,_0x4b2292){var _0x296cd9={},_0x28f710={},_0x52277c={'count':0x0,'rows':[]};var _0x325cb4=_[_0x65f6('0x25')](db[_0x65f6('0x26')]['rawAttributes'],function(_0x4ac04b){return{'name':_0x4ac04b['fieldName'],'type':_0x4ac04b[_0x65f6('0x27')][_0x65f6('0x28')]};});_0x28f710[_0x65f6('0x29')]=_[_0x65f6('0x25')](_0x325cb4,_0x65f6('0x23'));_0x28f710[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x16cde8['query']);_0x28f710['filters']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],_0x28f710['query']);_0x296cd9['attributes']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0x296cd9[_0x65f6('0x2e')]=_0x296cd9['attributes'][_0x65f6('0x2f')]?_0x296cd9[_0x65f6('0x2e')]:_0x28f710[_0x65f6('0x29')];if(!_0x16cde8['query'][_0x65f6('0x30')](_0x65f6('0x31'))){_0x296cd9[_0x65f6('0x1a')]=qs[_0x65f6('0x1a')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x1a')]);_0x296cd9['offset']=qs[_0x65f6('0x19')](_0x16cde8[_0x65f6('0x2a')]['offset']);}_0x296cd9[_0x65f6('0x32')]=qs['sort'](_0x16cde8[_0x65f6('0x2a')]['sort']);_0x296cd9[_0x65f6('0x33')]=qs[_0x65f6('0x34')](_['pick'](_0x16cde8[_0x65f6('0x2a')],_0x28f710[_0x65f6('0x34')]),_0x325cb4);if(_0x16cde8[_0x65f6('0x2a')]['filter']){_0x296cd9['where']=_[_0x65f6('0x35')](_0x296cd9['where'],{'$or':_[_0x65f6('0x25')](_0x325cb4,function(_0x4e6653){if(_0x4e6653[_0x65f6('0x27')]!==_0x65f6('0x36')){var _0x5e97f1={};_0x5e97f1[_0x4e6653[_0x65f6('0x23')]]={'$like':'%'+_0x16cde8['query']['filter']+'%'};return _0x5e97f1;}})});}_0x296cd9=_[_0x65f6('0x35')]({},_0x296cd9,_0x16cde8[_0x65f6('0x37')]);var _0x413956={'where':_0x296cd9[_0x65f6('0x33')]};return db[_0x65f6('0x26')][_0x65f6('0x18')](_0x413956)[_0x65f6('0x1f')](function(_0x1153f1){_0x52277c['count']=_0x1153f1;if(_0x16cde8[_0x65f6('0x2a')]['includeAll']){_0x296cd9[_0x65f6('0x38')]=[{'all':!![]}];}return db[_0x65f6('0x26')][_0x65f6('0x39')](_0x296cd9);})[_0x65f6('0x1f')](function(_0x5ef5c2){_0x52277c[_0x65f6('0x3a')]=_0x5ef5c2;return _0x52277c;})[_0x65f6('0x1f')](respondWithFilteredResult(_0x4b2292,_0x296cd9))[_0x65f6('0x3b')](handleError(_0x4b2292,null));};exports[_0x65f6('0x3c')]=function(_0x81fd69,_0x3f6103){var _0xed4c96={'raw':!![],'where':{'id':_0x81fd69[_0x65f6('0x3d')]['id']}},_0x2acca5={};_0x2acca5['model']=_[_0x65f6('0x2b')](db[_0x65f6('0x26')][_0x65f6('0x3e')]);_0x2acca5[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x81fd69[_0x65f6('0x2a')]);_0x2acca5[_0x65f6('0x34')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],_0x2acca5[_0x65f6('0x2a')]);_0xed4c96[_0x65f6('0x2e')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x81fd69[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0xed4c96['attributes']=_0xed4c96[_0x65f6('0x2e')][_0x65f6('0x2f')]?_0xed4c96[_0x65f6('0x2e')]:_0x2acca5[_0x65f6('0x29')];if(_0x81fd69['query'][_0x65f6('0x3f')]){_0xed4c96[_0x65f6('0x38')]=[{'all':!![]}];}_0xed4c96=_[_0x65f6('0x35')]({},_0xed4c96,_0x81fd69['options']);return db[_0x65f6('0x26')][_0x65f6('0x40')](_0xed4c96)[_0x65f6('0x1f')](handleEntityNotFound(_0x3f6103,null))[_0x65f6('0x1f')](respondWithResult(_0x3f6103,null))['catch'](handleError(_0x3f6103,null));};exports[_0x65f6('0x41')]=function(_0x512527,_0x3f1baa){return db[_0x65f6('0x26')]['create'](_0x512527[_0x65f6('0x42')],{})['then'](respondWithResult(_0x3f1baa,0xc9))[_0x65f6('0x3b')](handleError(_0x3f1baa,null));};exports[_0x65f6('0x1e')]=function(_0x2d1706,_0xc0db01){if(_0x2d1706[_0x65f6('0x42')]['id']){delete _0x2d1706[_0x65f6('0x42')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x2d1706[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0xc0db01,null))[_0x65f6('0x1f')](saveUpdates(_0x2d1706[_0x65f6('0x42')],null))[_0x65f6('0x1f')](respondWithResult(_0xc0db01,null))[_0x65f6('0x3b')](handleError(_0xc0db01,null));};exports[_0x65f6('0x20')]=function(_0x41690c,_0x414f49){return db['FaxTransferReport'][_0x65f6('0x40')]({'where':{'id':_0x41690c[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x414f49,null))['then'](removeEntity(_0x414f49,null))[_0x65f6('0x3b')](handleError(_0x414f49,null));};exports[_0x65f6('0x43')]=function(_0x49ba5a,_0x22d745){return db[_0x65f6('0x26')]['describe']()[_0x65f6('0x1f')](respondWithResult(_0x22d745,null))['catch'](handleError(_0x22d745,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 4109ca8..2d9bbaa 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 _0x73a1=['uniqueid','lodash','../../config/logger','moment','path','rimraf','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer'];(function(_0x1841d9,_0x2f87bd){var _0x437e8d=function(_0xbd2696){while(--_0xbd2696){_0x1841d9['push'](_0x1841d9['shift']());}};_0x437e8d(++_0x2f87bd);}(_0x73a1,0x114));var _0x173a=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0x73a1[_0x41d02a];return _0x4c3983;};'use strict';var _=require(_0x173a('0x0'));var util=require('util');var logger=require(_0x173a('0x1'))('api');var moment=require(_0x173a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x173a('0x3'));var rimraf=require(_0x173a('0x4'));var config=require(_0x173a('0x5'));var attributes=require('./faxTransferReport.attributes');module[_0x173a('0x6')]=function(_0x328948,_0x25503a){return _0x328948[_0x173a('0x7')](_0x173a('0x8'),attributes,{'tableName':_0x173a('0x9'),'paranoid':![],'indexes':[{'name':_0x173a('0xa'),'fields':[_0x173a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xee12=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x33bd34,_0x5e6134){var _0x5828c5=function(_0x4ebb96){while(--_0x4ebb96){_0x33bd34['push'](_0x33bd34['shift']());}};_0x5828c5(++_0x5e6134);}(_0xee12,0x155));var _0x2ee1=function(_0x1cd526,_0x3e4e85){_0x1cd526=_0x1cd526-0x0;var _0x5d326b=_0xee12[_0x1cd526];return _0x5d326b;};'use strict';var _=require(_0x2ee1('0x0'));var util=require(_0x2ee1('0x1'));var logger=require(_0x2ee1('0x2'))(_0x2ee1('0x3'));var moment=require(_0x2ee1('0x4'));var BPromise=require(_0x2ee1('0x5'));var rp=require(_0x2ee1('0x6'));var fs=require('fs');var path=require(_0x2ee1('0x7'));var rimraf=require(_0x2ee1('0x8'));var config=require(_0x2ee1('0x9'));var attributes=require('./faxTransferReport.attributes');module[_0x2ee1('0xa')]=function(_0x1429f1,_0x3ecb04){return _0x1429f1[_0x2ee1('0xb')](_0x2ee1('0xc'),attributes,{'tableName':_0x2ee1('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2ee1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index c953fbc..b73edd0 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 _0x6f82=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','util','bluebird','randomstring'];(function(_0x498ef7,_0x481efe){var _0x45490b=function(_0x1c850e){while(--_0x1c850e){_0x498ef7['push'](_0x498ef7['shift']());}};_0x45490b(++_0x481efe);}(_0x6f82,0x101));var _0x26f8=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0x6f82[_0xd21fe7];return _0x14d570;};'use strict';var _=require('lodash');var util=require(_0x26f8('0x0'));var moment=require('moment');var BPromise=require(_0x26f8('0x1'));var rs=require(_0x26f8('0x2'));var fs=require('fs');var Redis=require(_0x26f8('0x3'));var db=require(_0x26f8('0x4'))['db'];var utils=require(_0x26f8('0x5'));var logger=require(_0x26f8('0x6'))(_0x26f8('0x7'));var config=require('../../config/environment');var jayson=require(_0x26f8('0x8'));var client=jayson[_0x26f8('0x9')][_0x26f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a4442,_0xe598fd,_0x3897f9){return new BPromise(function(_0x34623a,_0x43d1aa){return client[_0x26f8('0xb')](_0x5a4442,_0x3897f9)[_0x26f8('0xc')](function(_0x8c5e46){logger[_0x26f8('0xd')](_0x26f8('0xe'),_0xe598fd,_0x26f8('0xf'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0xe598fd,'request\x20sent',JSON[_0x26f8('0x10')](_0x8c5e46));if(_0x8c5e46[_0x26f8('0x11')]){if(_0x8c5e46['error'][_0x26f8('0x12')]===0x1f4){logger[_0x26f8('0x11')](_0x26f8('0xe'),_0xe598fd,_0x8c5e46[_0x26f8('0x11')][_0x26f8('0x13')]);return _0x43d1aa(_0x8c5e46[_0x26f8('0x11')][_0x26f8('0x13')]);}logger[_0x26f8('0x11')](_0x26f8('0xe'),_0xe598fd,_0x8c5e46[_0x26f8('0x11')][_0x26f8('0x13')]);return _0x34623a(_0x8c5e46[_0x26f8('0x11')][_0x26f8('0x13')]);}else{logger[_0x26f8('0xd')](_0x26f8('0xe'),_0xe598fd,_0x26f8('0xf'));_0x34623a(_0x8c5e46['result'][_0x26f8('0x13')]);}})['catch'](function(_0x1d0f45){logger[_0x26f8('0x11')](_0x26f8('0xe'),_0xe598fd,_0x1d0f45);_0x43d1aa(_0x1d0f45);});});} \ No newline at end of file +var _0x3373=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','FaxTransferReport,\x20%s,\x20%s','message','result'];(function(_0x11a1f5,_0x5eb5d4){var _0x23206f=function(_0x18ca67){while(--_0x18ca67){_0x11a1f5['push'](_0x11a1f5['shift']());}};_0x23206f(++_0x5eb5d4);}(_0x3373,0x127));var _0x3337=function(_0x2f7a37,_0x51a001){_0x2f7a37=_0x2f7a37-0x0;var _0xd8ff7a=_0x3373[_0x2f7a37];return _0xd8ff7a;};'use strict';var _=require(_0x3337('0x0'));var util=require(_0x3337('0x1'));var moment=require(_0x3337('0x2'));var BPromise=require(_0x3337('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3337('0x4'));var db=require(_0x3337('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3337('0x6'))(_0x3337('0x7'));var config=require(_0x3337('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3337('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55c9a5,_0x135bd6,_0x46586b){return new BPromise(function(_0x33059d,_0x20927f){return client[_0x3337('0xa')](_0x55c9a5,_0x46586b)[_0x3337('0xb')](function(_0x42d2b4){logger[_0x3337('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x135bd6,_0x3337('0xd'));logger['debug'](_0x3337('0xe'),_0x135bd6,_0x3337('0xd'),JSON['stringify'](_0x42d2b4));if(_0x42d2b4[_0x3337('0xf')]){if(_0x42d2b4[_0x3337('0xf')][_0x3337('0x10')]===0x1f4){logger[_0x3337('0xf')](_0x3337('0x11'),_0x135bd6,_0x42d2b4[_0x3337('0xf')][_0x3337('0x12')]);return _0x20927f(_0x42d2b4[_0x3337('0xf')]['message']);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x135bd6,_0x42d2b4['error'][_0x3337('0x12')]);return _0x33059d(_0x42d2b4[_0x3337('0xf')][_0x3337('0x12')]);}else{logger[_0x3337('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x135bd6,'request\x20sent');_0x33059d(_0x42d2b4[_0x3337('0x13')]['message']);}})[_0x3337('0x14')](function(_0x196dd5){logger[_0x3337('0xf')](_0x3337('0x11'),_0x135bd6,_0x196dd5);_0x20927f(_0x196dd5);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index ab2096a..684f672 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 _0x659a=['show','post','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','get','/:id'];(function(_0xad7b9c,_0x3abc49){var _0x4539e3=function(_0x5bc2f0){while(--_0x5bc2f0){_0xad7b9c['push'](_0xad7b9c['shift']());}};_0x4539e3(++_0x3abc49);}(_0x659a,0xb9));var _0xa659=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x659a[_0x396466];return _0x5e9ab4;};'use strict';var multer=require(_0xa659('0x0'));var util=require(_0xa659('0x1'));var path=require(_0xa659('0x2'));var timeout=require(_0xa659('0x3'));var express=require(_0xa659('0x4'));var router=express[_0xa659('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa659('0x6'));var config=require(_0xa659('0x7'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0xa659('0x8')](),controller['index']);router['get'](_0xa659('0x9'),auth[_0xa659('0x8')](),controller[_0xa659('0xa')]);router[_0xa659('0xb')](_0xa659('0xc'),auth[_0xa659('0x8')](),controller[_0xa659('0xd')]);router[_0xa659('0xe')]('/',auth[_0xa659('0x8')](),controller['create']);router[_0xa659('0xf')](_0xa659('0xc'),auth[_0xa659('0x8')](),controller[_0xa659('0x10')]);router[_0xa659('0x11')](_0xa659('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6836=['isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get'];(function(_0x42524a,_0x26709a){var _0x2ce121=function(_0x348a8e){while(--_0x348a8e){_0x42524a['push'](_0x42524a['shift']());}};_0x2ce121(++_0x26709a);}(_0x6836,0x6e));var _0x6683=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x6836[_0x1f9f37];return _0x21c080;};'use strict';var multer=require(_0x6683('0x0'));var util=require(_0x6683('0x1'));var path=require(_0x6683('0x2'));var timeout=require(_0x6683('0x3'));var express=require(_0x6683('0x4'));var router=express[_0x6683('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6683('0x6'));var config=require(_0x6683('0x7'));var controller=require(_0x6683('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6683('0x9')]('/describe',auth[_0x6683('0xa')](),controller[_0x6683('0xb')]);router[_0x6683('0x9')](_0x6683('0xc'),auth[_0x6683('0xa')](),controller[_0x6683('0xd')]);router[_0x6683('0xe')]('/',auth[_0x6683('0xa')](),controller[_0x6683('0xf')]);router[_0x6683('0x10')](_0x6683('0xc'),auth['isAuthenticated'](),controller[_0x6683('0x11')]);router[_0x6683('0x12')](_0x6683('0xc'),auth[_0x6683('0xa')](),controller[_0x6683('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 1460176..d814b7c 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 _0x826a=['getFields','post','create','addConfiguration','put','update','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x8c55e4,_0x3ddc06){var _0x2b3f15=function(_0x44ca6b){while(--_0x44ca6b){_0x8c55e4['push'](_0x8c55e4['shift']());}};_0x2b3f15(++_0x3ddc06);}(_0x826a,0x1aa));var _0xa826=function(_0x441071,_0x5f985e){_0x441071=_0x441071-0x0;var _0x553033=_0x826a[_0x441071];return _0x553033;};'use strict';var multer=require('multer');var util=require(_0xa826('0x0'));var path=require('path');var timeout=require(_0xa826('0x1'));var express=require('express');var router=express[_0xa826('0x2')]();var auth=require(_0xa826('0x3'));var interaction=require(_0xa826('0x4'));var config=require(_0xa826('0x5'));var controller=require('./intDeskAccount.controller');router[_0xa826('0x6')]('/',auth[_0xa826('0x7')](),controller[_0xa826('0x8')]);router[_0xa826('0x6')](_0xa826('0x9'),auth[_0xa826('0x7')](),controller[_0xa826('0xa')]);router[_0xa826('0x6')](_0xa826('0xb'),auth[_0xa826('0x7')](),controller[_0xa826('0xc')]);router[_0xa826('0x6')](_0xa826('0xd'),auth[_0xa826('0x7')](),controller[_0xa826('0xe')]);router[_0xa826('0xf')]('/',auth['isAuthenticated'](),controller[_0xa826('0x10')]);router['post'](_0xa826('0xb'),auth[_0xa826('0x7')](),controller[_0xa826('0x11')]);router[_0xa826('0x12')](_0xa826('0x9'),auth[_0xa826('0x7')](),controller[_0xa826('0x13')]);router['delete'](_0xa826('0x9'),auth['isAuthenticated'](),controller[_0xa826('0x14')]);module[_0xa826('0x15')]=router; \ No newline at end of file +var _0x6596=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration'];(function(_0x3a8b73,_0x49cb2d){var _0xd56249=function(_0x266974){while(--_0x266974){_0x3a8b73['push'](_0x3a8b73['shift']());}};_0xd56249(++_0x49cb2d);}(_0x6596,0x1d3));var _0x6659=function(_0xfb27f5,_0x2fd234){_0xfb27f5=_0xfb27f5-0x0;var _0x15a108=_0x6596[_0xfb27f5];return _0x15a108;};'use strict';var multer=require(_0x6659('0x0'));var util=require(_0x6659('0x1'));var path=require('path');var timeout=require(_0x6659('0x2'));var express=require(_0x6659('0x3'));var router=express[_0x6659('0x4')]();var auth=require(_0x6659('0x5'));var interaction=require(_0x6659('0x6'));var config=require(_0x6659('0x7'));var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0x6659('0x8')](),controller[_0x6659('0x9')]);router[_0x6659('0xa')](_0x6659('0xb'),auth[_0x6659('0x8')](),controller['show']);router['get'](_0x6659('0xc'),auth[_0x6659('0x8')](),controller[_0x6659('0xd')]);router[_0x6659('0xa')](_0x6659('0xe'),auth[_0x6659('0x8')](),controller['getFields']);router[_0x6659('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6659('0xf')]('/:id/configurations',auth[_0x6659('0x8')](),controller[_0x6659('0x10')]);router[_0x6659('0x11')](_0x6659('0xb'),auth['isAuthenticated'](),controller[_0x6659('0x12')]);router[_0x6659('0x13')]('/:id',auth[_0x6659('0x8')](),controller[_0x6659('0x14')]);module[_0x6659('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 3fb12e2..56d66e7 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 _0xb194=['ENUM','basic','integrationTab','sequelize','exports','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb194,0x75));var _0x4b19=function(_0x50dd44,_0x7a67d){_0x50dd44=_0x50dd44-0x0;var _0x1ebb0c=_0xb194[_0x50dd44];return _0x1ebb0c;};'use strict';var Sequelize=require(_0x4b19('0x0'));module[_0x4b19('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4b19('0x2')]},'username':{'type':Sequelize[_0x4b19('0x2')]},'remoteUri':{'type':Sequelize[_0x4b19('0x2')]},'authType':{'type':Sequelize[_0x4b19('0x3')](_0x4b19('0x4')),'defaultValue':_0x4b19('0x4')},'password':{'type':Sequelize[_0x4b19('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x4b19('0x2')]},'token':{'type':Sequelize[_0x4b19('0x2')]},'tokenSecret':{'type':Sequelize[_0x4b19('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4b19('0x3')](_0x4b19('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x818e=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x427155,_0x3f365b){var _0x3aa308=function(_0x302d98){while(--_0x302d98){_0x427155['push'](_0x427155['shift']());}};_0x3aa308(++_0x3f365b);}(_0x818e,0xfb));var _0xe818=function(_0x94b941,_0x1b09f8){_0x94b941=_0x94b941-0x0;var _0x4a2427=_0x818e[_0x94b941];return _0x4a2427;};'use strict';var Sequelize=require(_0xe818('0x0'));module[_0xe818('0x1')]={'name':{'type':Sequelize[_0xe818('0x2')]},'description':{'type':Sequelize[_0xe818('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xe818('0x3')](_0xe818('0x4')),'defaultValue':_0xe818('0x4')},'password':{'type':Sequelize[_0xe818('0x2')]},'consumerKey':{'type':Sequelize[_0xe818('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe818('0x2')]},'tokenSecret':{'type':Sequelize[_0xe818('0x2')]},'serverUrl':{'type':Sequelize[_0xe818('0x2')]},'type':{'type':Sequelize[_0xe818('0x3')](_0xe818('0x5'),_0xe818('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 8ed9c3a..5743ea7 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 _0x68c5=['base64','concat','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','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','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','findAll','rows','show','params','length','include','options','find','body','getConfigurations','findOne','DeskConfiguration','fields','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','create','DeskField','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','application/json','basic','headers','Authorization','format','toString'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x68c5,0x8a));var _0x568c=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x68c5[_0x2b4411];return _0x8e41ef;};'use strict';var pdf=require(_0x568c('0x0'));var emlformat=require(_0x568c('0x1'));var rimraf=require(_0x568c('0x2'));var zipdir=require(_0x568c('0x3'));var jsonpatch=require(_0x568c('0x4'));var rp=require(_0x568c('0x5'));var moment=require(_0x568c('0x6'));var BPromise=require(_0x568c('0x7'));var Mustache=require(_0x568c('0x8'));var util=require(_0x568c('0x9'));var path=require(_0x568c('0xa'));var sox=require('sox');var csv=require(_0x568c('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x568c('0xc'));var squel=require(_0x568c('0xd'));var crypto=require(_0x568c('0xe'));var jsforce=require(_0x568c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x568c('0xb'));var querystring=require(_0x568c('0x10'));var Papa=require(_0x568c('0x11'));var Redis=require(_0x568c('0x12'));var authService=require(_0x568c('0x13'));var qs=require(_0x568c('0x14'));var as=require(_0x568c('0x15'));var hardwareService=require(_0x568c('0x16'));var logger=require(_0x568c('0x17'))('api');var utils=require(_0x568c('0x18'));var config=require(_0x568c('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x568c('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0x568c('0x1b')][_0x568c('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x339202,_0xc631ce,_0xe81d13){if(_0xe81d13){var _0x1c2ca9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c2ca9[_0x568c('0x1d')](_0xc631ce)){return _0x339202;}else{throw new db[(_0x568c('0x1e'))][(_0x568c('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x339202;}}function respondWithRpcPromise(_0x924d4c,_0x8fde8b,_0x4ee84e,_0x59a88f){return new BPromise(function(_0x53671a,_0x86b8bb){var _0x4a1628=_0x59a88f||client;return _0x4a1628[_0x568c('0x20')](_0x924d4c,_0x4ee84e)[_0x568c('0x21')](function(_0x1e15df){logger[_0x568c('0x22')](_0x568c('0x23'),_0x8fde8b,_0x568c('0x24'));logger[_0x568c('0x25')](_0x568c('0x26'),_0x8fde8b,'request\x20sent',JSON[_0x568c('0x27')](_0x1e15df));if(_0x1e15df['error']){if(_0x1e15df['error']['code']===0x1f4){logger[_0x568c('0x28')](_0x568c('0x23'),_0x8fde8b,_0x1e15df[_0x568c('0x28')][_0x568c('0x29')]);return _0x86b8bb(_0x1e15df[_0x568c('0x28')]['message']);}logger[_0x568c('0x28')]('DeskAccount,\x20%s,\x20%s',_0x8fde8b,_0x1e15df[_0x568c('0x28')][_0x568c('0x29')]);return _0x53671a(_0x1e15df[_0x568c('0x28')][_0x568c('0x29')]);}else{logger[_0x568c('0x22')]('DeskAccount,\x20%s,\x20%s',_0x8fde8b,_0x568c('0x24'));_0x53671a(_0x1e15df[_0x568c('0x2a')][_0x568c('0x29')]);}})[_0x568c('0x2b')](function(_0xb81b5){logger['error'](_0x568c('0x23'),_0x8fde8b,_0xb81b5);_0x86b8bb(_0xb81b5);});});}function respondWithStatusCode(_0x496245,_0x5d78dc){_0x5d78dc=_0x5d78dc||0xcc;return function(_0x1d21f9){if(_0x1d21f9){return _0x496245[_0x568c('0x2c')](_0x5d78dc);}return _0x496245[_0x568c('0x2d')](_0x5d78dc)[_0x568c('0x2e')]();};}function respondWithResult(_0x13ca99,_0x3a026d){_0x3a026d=_0x3a026d||0xc8;return function(_0x4573f4){if(_0x4573f4){return _0x13ca99[_0x568c('0x2d')](_0x3a026d)[_0x568c('0x2f')](_0x4573f4);}};}function respondWithFilteredResult(_0x137eb3,_0x49962f){return function(_0x5619f3){if(_0x5619f3){var _0x47eb0e=_0x5619f3[_0x568c('0x30')],_0x5f3156=_0x49962f[_0x568c('0x31')],_0x1827cc=_0x49962f[_0x568c('0x31')]+_0x49962f[_0x568c('0x32')],_0x28bd5a;if(_0x1827cc>=_0x47eb0e){_0x1827cc=_0x47eb0e;_0x28bd5a=0xc8;}else{_0x28bd5a=0xce;}_0x137eb3['status'](_0x28bd5a);return _0x137eb3['set'](_0x568c('0x33'),_0x5f3156+'-'+_0x1827cc+'/'+_0x47eb0e)[_0x568c('0x2f')](_0x5619f3);}return null;};}function patchUpdates(_0x58a9f2){return function(_0x13400d){try{jsonpatch['apply'](_0x13400d,_0x58a9f2,!![]);}catch(_0x3de101){return BPromise[_0x568c('0x34')](_0x3de101);}return _0x13400d[_0x568c('0x35')]();};}function saveUpdates(_0x3b20a3,_0x397705){return function(_0x80cad2){if(_0x80cad2){return _0x80cad2[_0x568c('0x36')](_0x3b20a3)['then'](function(_0x804bed){return _0x804bed;});}return null;};}function removeEntity(_0x270720,_0x5a78aa){return function(_0x621611){if(_0x621611){return _0x621611[_0x568c('0x37')]()[_0x568c('0x21')](function(){_0x270720[_0x568c('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32219d,_0x42a834){return function(_0x18d824){if(!_0x18d824){_0x32219d['sendStatus'](0x194);}return _0x18d824;};}function handleError(_0x30e82f,_0x23b230){_0x23b230=_0x23b230||0x1f4;return function(_0x255b3e){logger['error'](_0x255b3e['stack']);if(_0x255b3e[_0x568c('0x38')]){delete _0x255b3e[_0x568c('0x38')];}_0x30e82f[_0x568c('0x2d')](_0x23b230)[_0x568c('0x39')](_0x255b3e);};}exports[_0x568c('0x3a')]=function(_0x5ceaec,_0x4f95c0){var _0x5f3121={},_0x3939c0={},_0x1ddbc1={'count':0x0,'rows':[]};var _0x372b4f=_[_0x568c('0x3b')](db[_0x568c('0x3c')][_0x568c('0x3d')],function(_0x1292bd){return{'name':_0x1292bd[_0x568c('0x3e')],'type':_0x1292bd[_0x568c('0x3f')][_0x568c('0x40')]};});_0x3939c0[_0x568c('0x41')]=_[_0x568c('0x3b')](_0x372b4f,_0x568c('0x38'));_0x3939c0[_0x568c('0x42')]=_[_0x568c('0x43')](_0x5ceaec[_0x568c('0x42')]);_0x3939c0['filters']=_['intersection'](_0x3939c0['model'],_0x3939c0['query']);_0x5f3121[_0x568c('0x44')]=_[_0x568c('0x45')](_0x3939c0['model'],qs['fields'](_0x5ceaec[_0x568c('0x42')]['fields']));_0x5f3121[_0x568c('0x44')]=_0x5f3121[_0x568c('0x44')]['length']?_0x5f3121[_0x568c('0x44')]:_0x3939c0[_0x568c('0x41')];if(!_0x5ceaec['query'][_0x568c('0x46')](_0x568c('0x47'))){_0x5f3121[_0x568c('0x32')]=qs[_0x568c('0x32')](_0x5ceaec[_0x568c('0x42')][_0x568c('0x32')]);_0x5f3121[_0x568c('0x31')]=qs[_0x568c('0x31')](_0x5ceaec[_0x568c('0x42')][_0x568c('0x31')]);}_0x5f3121[_0x568c('0x48')]=qs[_0x568c('0x49')](_0x5ceaec['query']['sort']);_0x5f3121[_0x568c('0x4a')]=qs[_0x568c('0x4b')](_[_0x568c('0x4c')](_0x5ceaec['query'],_0x3939c0[_0x568c('0x4b')]),_0x372b4f);if(_0x5ceaec[_0x568c('0x42')][_0x568c('0x4d')]){_0x5f3121[_0x568c('0x4a')]=_['merge'](_0x5f3121[_0x568c('0x4a')],{'$or':_['map'](_0x372b4f,function(_0x27a595){if(_0x27a595[_0x568c('0x3f')]!==_0x568c('0x4e')){var _0x4abd1d={};_0x4abd1d[_0x27a595[_0x568c('0x38')]]={'$like':'%'+_0x5ceaec[_0x568c('0x42')][_0x568c('0x4d')]+'%'};return _0x4abd1d;}})});}_0x5f3121=_[_0x568c('0x4f')]({},_0x5f3121,_0x5ceaec['options']);var _0x40fb0d={'where':_0x5f3121[_0x568c('0x4a')]};return db[_0x568c('0x3c')][_0x568c('0x30')](_0x40fb0d)[_0x568c('0x21')](function(_0x4b6776){_0x1ddbc1[_0x568c('0x30')]=_0x4b6776;if(_0x5ceaec[_0x568c('0x42')]['includeAll']){_0x5f3121['include']=[{'all':!![]}];}return db['DeskAccount'][_0x568c('0x50')](_0x5f3121);})['then'](function(_0x26f4ff){_0x1ddbc1[_0x568c('0x51')]=_0x26f4ff;return _0x1ddbc1;})[_0x568c('0x21')](respondWithFilteredResult(_0x4f95c0,_0x5f3121))[_0x568c('0x2b')](handleError(_0x4f95c0,null));};exports[_0x568c('0x52')]=function(_0x30ec78,_0x1f8271){var _0x37b319={'raw':![],'where':{'id':_0x30ec78[_0x568c('0x53')]['id']}},_0x1627ef={};_0x1627ef[_0x568c('0x41')]=_[_0x568c('0x43')](db['DeskAccount']['rawAttributes']);_0x1627ef[_0x568c('0x42')]=_['keys'](_0x30ec78[_0x568c('0x42')]);_0x1627ef[_0x568c('0x4b')]=_[_0x568c('0x45')](_0x1627ef[_0x568c('0x41')],_0x1627ef[_0x568c('0x42')]);_0x37b319[_0x568c('0x44')]=_['intersection'](_0x1627ef['model'],qs['fields'](_0x30ec78[_0x568c('0x42')]['fields']));_0x37b319['attributes']=_0x37b319[_0x568c('0x44')][_0x568c('0x54')]?_0x37b319[_0x568c('0x44')]:_0x1627ef[_0x568c('0x41')];if(_0x30ec78['query']['includeAll']){_0x37b319[_0x568c('0x55')]=[{'all':!![]}];}_0x37b319=_[_0x568c('0x4f')]({},_0x37b319,_0x30ec78[_0x568c('0x56')]);return db[_0x568c('0x3c')][_0x568c('0x57')](_0x37b319)['then'](handleEntityNotFound(_0x1f8271,null))[_0x568c('0x21')](respondWithResult(_0x1f8271,null))['catch'](handleError(_0x1f8271,null));};exports['create']=function(_0x52165e,_0x3eb0b9){return db[_0x568c('0x3c')]['create'](_0x52165e['body'],{})[_0x568c('0x21')](respondWithResult(_0x3eb0b9,0xc9))[_0x568c('0x2b')](handleError(_0x3eb0b9,null));};exports[_0x568c('0x36')]=function(_0x1e8079,_0x4fc28b){if(_0x1e8079[_0x568c('0x58')]['id']){delete _0x1e8079[_0x568c('0x58')]['id'];}return db[_0x568c('0x3c')][_0x568c('0x57')]({'where':{'id':_0x1e8079[_0x568c('0x53')]['id']}})[_0x568c('0x21')](handleEntityNotFound(_0x4fc28b,null))[_0x568c('0x21')](saveUpdates(_0x1e8079[_0x568c('0x58')],null))[_0x568c('0x21')](respondWithResult(_0x4fc28b,null))['catch'](handleError(_0x4fc28b,null));};exports[_0x568c('0x37')]=function(_0x404b14,_0x37afc7){return db[_0x568c('0x3c')][_0x568c('0x57')]({'where':{'id':_0x404b14[_0x568c('0x53')]['id']}})[_0x568c('0x21')](handleEntityNotFound(_0x37afc7,null))[_0x568c('0x21')](removeEntity(_0x37afc7,null))['catch'](handleError(_0x37afc7,null));};exports[_0x568c('0x59')]=function(_0x1e449c,_0x23474e,_0x318057){var _0x54aa26={};var _0x90dcc={};var _0x45d034;var _0x5078b1;return db[_0x568c('0x3c')][_0x568c('0x5a')]({'where':{'id':_0x1e449c['params']['id']}})['then'](handleEntityNotFound(_0x23474e,null))[_0x568c('0x21')](function(_0x5dcb49){if(_0x5dcb49){_0x45d034=_0x5dcb49;_0x90dcc[_0x568c('0x41')]=_[_0x568c('0x43')](db[_0x568c('0x5b')][_0x568c('0x3d')]);_0x90dcc[_0x568c('0x42')]=_[_0x568c('0x43')](_0x1e449c[_0x568c('0x42')]);_0x90dcc[_0x568c('0x4b')]=_[_0x568c('0x45')](_0x90dcc[_0x568c('0x41')],_0x90dcc[_0x568c('0x42')]);_0x54aa26[_0x568c('0x44')]=_[_0x568c('0x45')](_0x90dcc[_0x568c('0x41')],qs['fields'](_0x1e449c['query'][_0x568c('0x5c')]));_0x54aa26[_0x568c('0x44')]=_0x54aa26[_0x568c('0x44')][_0x568c('0x54')]?_0x54aa26[_0x568c('0x44')]:_0x90dcc[_0x568c('0x41')];_0x54aa26['order']=qs[_0x568c('0x49')](_0x1e449c['query'][_0x568c('0x49')]);_0x54aa26[_0x568c('0x4a')]=qs[_0x568c('0x4b')](_[_0x568c('0x4c')](_0x1e449c[_0x568c('0x42')],_0x90dcc[_0x568c('0x4b')]));if(_0x1e449c['query']['filter']){_0x54aa26[_0x568c('0x4a')]=_[_0x568c('0x4f')](_0x54aa26[_0x568c('0x4a')],{'$or':_['map'](_0x54aa26['attributes'],function(_0x3b22ce){var _0x27db3e={};_0x27db3e[_0x3b22ce]={'$like':'%'+_0x1e449c['query']['filter']+'%'};return _0x27db3e;})});}_0x54aa26=_[_0x568c('0x4f')]({},_0x54aa26,_0x1e449c['options']);return _0x45d034[_0x568c('0x59')](_0x54aa26);}})[_0x568c('0x21')](function(_0x1d4728){if(_0x1d4728){_0x5078b1=_0x1d4728['length'];if(!_0x1e449c[_0x568c('0x42')][_0x568c('0x46')](_0x568c('0x47'))){_0x54aa26['limit']=qs[_0x568c('0x32')](_0x1e449c['query'][_0x568c('0x32')]);_0x54aa26['offset']=qs['offset'](_0x1e449c[_0x568c('0x42')][_0x568c('0x31')]);}return _0x45d034[_0x568c('0x59')](_0x54aa26);}})[_0x568c('0x21')](function(_0x2dc3c9){if(_0x2dc3c9){return _0x2dc3c9?{'count':_0x5078b1,'rows':_0x2dc3c9}:null;}})['then'](respondWithResult(_0x23474e,null))[_0x568c('0x2b')](handleError(_0x23474e,null));};exports[_0x568c('0x5d')]=function(_0x110693,_0x276d31,_0x26804c){if(_0x110693[_0x568c('0x58')]['id']){delete _0x110693[_0x568c('0x58')]['id'];}return db[_0x568c('0x3c')]['findOne']({'where':{'id':_0x110693['params']['id']}})['then'](handleEntityNotFound(_0x276d31,null))['then'](function(_0xfca798){if(_0xfca798){_0x110693[_0x568c('0x58')][_0x568c('0x5e')]=_0xfca798['id'];_0x110693['body'][_0x568c('0x5f')]=integrations['getSubjects'](_0x110693[_0x568c('0x58')][_0x568c('0x60')],_0x110693['body']['type']);_0x110693['body'][_0x568c('0x61')]=integrations[_0x568c('0x62')](_0x110693[_0x568c('0x58')][_0x568c('0x60')],_0x110693[_0x568c('0x58')][_0x568c('0x3f')]);return db[_0x568c('0x5b')][_0x568c('0x63')](_0x110693[_0x568c('0x58')],{'include':[{'model':db[_0x568c('0x64')],'as':_0x568c('0x5f')},{'model':db['DeskField'],'as':_0x568c('0x61')}]});}return null;})[_0x568c('0x21')](respondWithResult(_0x276d31,null))[_0x568c('0x2b')](handleError(_0x276d31,null));};exports['getFields']=function(_0x3f87aa,_0x2c5055,_0x20953a){var _0x38d98b=[{'name':'priority','label':_0x568c('0x65'),'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 _0x18883a='';return db['DeskAccount'][_0x568c('0x5a')]({'where':{'id':_0x3f87aa[_0x568c('0x53')]['id']},'attributes':['id',_0x568c('0x66'),_0x568c('0x67'),_0x568c('0x68'),_0x568c('0x69'),_0x568c('0x6a'),_0x568c('0x6b'),_0x568c('0x6c'),_0x568c('0x6d')]})[_0x568c('0x21')](handleEntityNotFound(_0x2c5055,null))[_0x568c('0x21')](function(_0x3aea1c){if(_0x3aea1c){_0x18883a=_0x3aea1c[_0x568c('0x66')];var _0x4e15a7=_0x18883a[_0x568c('0x6e')](-0x1);if(_0x4e15a7==='/'){_0x18883a=_0x18883a[_0x568c('0x6f')](0x0,_0x18883a[_0x568c('0x70')](_0x4e15a7));}var _0x1a80a5={'method':_0x568c('0x71'),'uri':util['format']('%s/custom_fields',_0x18883a),'headers':{'Content-Type':_0x568c('0x72'),'Accept':'application/json'},'json':!![]};if(_0x3aea1c[_0x568c('0x67')]===_0x568c('0x73')){_0x1a80a5[_0x568c('0x74')][_0x568c('0x75')]=util[_0x568c('0x76')]('Basic\x20%s',new Buffer(util[_0x568c('0x76')]('%s:%s',_0x3aea1c['username'],_0x3aea1c[_0x568c('0x69')]))[_0x568c('0x77')](_0x568c('0x78')));}return rp(_0x1a80a5)[_0x568c('0x21')](function(_0x344b3f){return _0x38d98b[_0x568c('0x79')](_['map'](_0x344b3f['_embedded'][_0x568c('0x7a')],function(_0x231643){return{'id':_0x231643[_0x568c('0x38')],'name':_0x231643[_0x568c('0x38')],'type':_0x231643[_0x568c('0x3f')],'active':_0x231643[_0x568c('0x7b')],'label':_0x231643[_0x568c('0x7c')],'custom':!![]};}));});}})[_0x568c('0x21')](function(_0x4fbf07){return{'count':_0x4fbf07['length'],'rows':_0x4fbf07};})[_0x568c('0x21')](respondWithResult(_0x2c5055,null))[_0x568c('0x2b')](function(_0x48f7e6){var _0x3f0c46=_0x3f87aa[_0x568c('0x42')][_0x568c('0x1d')]?0x1f4:_0x48f7e6[_0x568c('0x7d')]||0x1f4;logger[_0x568c('0x28')](_0x568c('0x7e'),_0x568c('0x7f'),_0x3f0c46,JSON['stringify'](_0x48f7e6));delete _0x48f7e6[_0x568c('0x38')];if(_0x3f0c46===0x191){_0x3f0c46=0x190;}_0x2c5055[_0x568c('0x2d')](_0x3f0c46)['send'](_0x3f87aa[_0x568c('0x42')][_0x568c('0x1d')]?{'message':_0x568c('0x80'),'statusCode':_0x48f7e6['statusCode']}:_0x48f7e6);});}; \ No newline at end of file +var _0x9ffb=['moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','message','catch','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','merge','VIRTUAL','filter','options','DeskAccount','includeAll','include','findAll','rows','show','find','create','body','params','getConfigurations','findOne','DeskConfiguration','order','where','getSubjects','channel','Descriptions','DeskField','Subjects','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','Authorization','Basic\x20%s','toString','base64','concat','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','zip-dir','request-promise'];(function(_0x3a0d2b,_0xd5e35d){var _0x7e8d74=function(_0x549f2c){while(--_0x549f2c){_0x3a0d2b['push'](_0x3a0d2b['shift']());}};_0x7e8d74(++_0xd5e35d);}(_0x9ffb,0x1ec));var _0xb9ff=function(_0xea78cf,_0x38299f){_0xea78cf=_0xea78cf-0x0;var _0x22d82a=_0x9ffb[_0xea78cf];return _0x22d82a;};'use strict';var pdf=require(_0xb9ff('0x0'));var emlformat=require(_0xb9ff('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9ff('0x3'));var moment=require(_0xb9ff('0x4'));var BPromise=require(_0xb9ff('0x5'));var Mustache=require('mustache');var util=require(_0xb9ff('0x6'));var path=require(_0xb9ff('0x7'));var sox=require(_0xb9ff('0x8'));var csv=require(_0xb9ff('0x9'));var ejs=require(_0xb9ff('0xa'));var fs=require('fs');var _=require(_0xb9ff('0xb'));var squel=require('squel');var crypto=require(_0xb9ff('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb9ff('0x9'));var querystring=require(_0xb9ff('0xd'));var Papa=require(_0xb9ff('0xe'));var Redis=require(_0xb9ff('0xf'));var authService=require(_0xb9ff('0x10'));var qs=require(_0xb9ff('0x11'));var as=require(_0xb9ff('0x12'));var hardwareService=require(_0xb9ff('0x13'));var logger=require(_0xb9ff('0x14'))(_0xb9ff('0x15'));var utils=require('../../config/utils');var config=require(_0xb9ff('0x16'));var db=require(_0xb9ff('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xb9ff('0x18'));var client=jayson[_0xb9ff('0x19')][_0xb9ff('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4a895d,_0x21d172,_0x1ce2c0){if(_0x1ce2c0){var _0x446f50=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x446f50[_0xb9ff('0x1b')](_0x21d172)){return _0x4a895d;}else{throw new db[(_0xb9ff('0x1c'))][(_0xb9ff('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4a895d;}}function respondWithRpcPromise(_0xa0c778,_0x19c3d0,_0xf7d9c0,_0x386ae7){return new BPromise(function(_0x1e6bff,_0x563219){var _0x54c5fb=_0x386ae7||client;return _0x54c5fb[_0xb9ff('0x1e')](_0xa0c778,_0xf7d9c0)[_0xb9ff('0x1f')](function(_0x2e5ca8){logger[_0xb9ff('0x20')](_0xb9ff('0x21'),_0x19c3d0,_0xb9ff('0x22'));logger['debug'](_0xb9ff('0x23'),_0x19c3d0,'request\x20sent',JSON['stringify'](_0x2e5ca8));if(_0x2e5ca8[_0xb9ff('0x24')]){if(_0x2e5ca8[_0xb9ff('0x24')]['code']===0x1f4){logger['error'](_0xb9ff('0x21'),_0x19c3d0,_0x2e5ca8['error'][_0xb9ff('0x25')]);return _0x563219(_0x2e5ca8[_0xb9ff('0x24')][_0xb9ff('0x25')]);}logger[_0xb9ff('0x24')](_0xb9ff('0x21'),_0x19c3d0,_0x2e5ca8[_0xb9ff('0x24')]['message']);return _0x1e6bff(_0x2e5ca8['error'][_0xb9ff('0x25')]);}else{logger['info'](_0xb9ff('0x21'),_0x19c3d0,_0xb9ff('0x22'));_0x1e6bff(_0x2e5ca8['result']['message']);}})[_0xb9ff('0x26')](function(_0x24b842){logger[_0xb9ff('0x24')](_0xb9ff('0x21'),_0x19c3d0,_0x24b842);_0x563219(_0x24b842);});});}function respondWithStatusCode(_0x18030e,_0x3fbf3e){_0x3fbf3e=_0x3fbf3e||0xcc;return function(_0x2bd02b){if(_0x2bd02b){return _0x18030e['sendStatus'](_0x3fbf3e);}return _0x18030e[_0xb9ff('0x27')](_0x3fbf3e)['end']();};}function respondWithResult(_0x355961,_0x399580){_0x399580=_0x399580||0xc8;return function(_0x342933){if(_0x342933){return _0x355961[_0xb9ff('0x27')](_0x399580)[_0xb9ff('0x28')](_0x342933);}};}function respondWithFilteredResult(_0x50e82c,_0x444ec4){return function(_0x284951){if(_0x284951){var _0x1cbc5c=_0x284951[_0xb9ff('0x29')],_0x328b3b=_0x444ec4[_0xb9ff('0x2a')],_0x21a812=_0x444ec4[_0xb9ff('0x2a')]+_0x444ec4['limit'],_0x4372f0;if(_0x21a812>=_0x1cbc5c){_0x21a812=_0x1cbc5c;_0x4372f0=0xc8;}else{_0x4372f0=0xce;}_0x50e82c[_0xb9ff('0x27')](_0x4372f0);return _0x50e82c[_0xb9ff('0x2b')](_0xb9ff('0x2c'),_0x328b3b+'-'+_0x21a812+'/'+_0x1cbc5c)[_0xb9ff('0x28')](_0x284951);}return null;};}function patchUpdates(_0x25297c){return function(_0x4de1e5){try{jsonpatch[_0xb9ff('0x2d')](_0x4de1e5,_0x25297c,!![]);}catch(_0x1f4634){return BPromise[_0xb9ff('0x2e')](_0x1f4634);}return _0x4de1e5[_0xb9ff('0x2f')]();};}function saveUpdates(_0xfce1dc,_0x3b3da8){return function(_0x380475){if(_0x380475){return _0x380475[_0xb9ff('0x30')](_0xfce1dc)[_0xb9ff('0x1f')](function(_0xdfbe3f){return _0xdfbe3f;});}return null;};}function removeEntity(_0x1d543c,_0x548d06){return function(_0x5c3fd5){if(_0x5c3fd5){return _0x5c3fd5[_0xb9ff('0x31')]()['then'](function(){_0x1d543c[_0xb9ff('0x27')](0xcc)[_0xb9ff('0x32')]();});}};}function handleEntityNotFound(_0x5d7274,_0x330716){return function(_0x612ce0){if(!_0x612ce0){_0x5d7274[_0xb9ff('0x33')](0x194);}return _0x612ce0;};}function handleError(_0x3db270,_0x5df0e6){_0x5df0e6=_0x5df0e6||0x1f4;return function(_0x24a914){logger[_0xb9ff('0x24')](_0x24a914[_0xb9ff('0x34')]);if(_0x24a914[_0xb9ff('0x35')]){delete _0x24a914['name'];}_0x3db270[_0xb9ff('0x27')](_0x5df0e6)['send'](_0x24a914);};}exports[_0xb9ff('0x36')]=function(_0x4e1cc8,_0x5875f2){var _0x4f1a45={},_0x24680d={},_0x486ebe={'count':0x0,'rows':[]};var _0x20ce92=_['map'](db['DeskAccount'][_0xb9ff('0x37')],function(_0x300d0c){return{'name':_0x300d0c['fieldName'],'type':_0x300d0c[_0xb9ff('0x38')][_0xb9ff('0x39')]};});_0x24680d[_0xb9ff('0x3a')]=_[_0xb9ff('0x3b')](_0x20ce92,_0xb9ff('0x35'));_0x24680d[_0xb9ff('0x3c')]=_[_0xb9ff('0x3d')](_0x4e1cc8[_0xb9ff('0x3c')]);_0x24680d[_0xb9ff('0x3e')]=_[_0xb9ff('0x3f')](_0x24680d[_0xb9ff('0x3a')],_0x24680d[_0xb9ff('0x3c')]);_0x4f1a45[_0xb9ff('0x40')]=_[_0xb9ff('0x3f')](_0x24680d[_0xb9ff('0x3a')],qs[_0xb9ff('0x41')](_0x4e1cc8[_0xb9ff('0x3c')][_0xb9ff('0x41')]));_0x4f1a45[_0xb9ff('0x40')]=_0x4f1a45[_0xb9ff('0x40')][_0xb9ff('0x42')]?_0x4f1a45[_0xb9ff('0x40')]:_0x24680d[_0xb9ff('0x3a')];if(!_0x4e1cc8[_0xb9ff('0x3c')][_0xb9ff('0x43')](_0xb9ff('0x44'))){_0x4f1a45['limit']=qs[_0xb9ff('0x45')](_0x4e1cc8[_0xb9ff('0x3c')][_0xb9ff('0x45')]);_0x4f1a45[_0xb9ff('0x2a')]=qs[_0xb9ff('0x2a')](_0x4e1cc8[_0xb9ff('0x3c')]['offset']);}_0x4f1a45['order']=qs[_0xb9ff('0x46')](_0x4e1cc8['query']['sort']);_0x4f1a45['where']=qs['filters'](_[_0xb9ff('0x47')](_0x4e1cc8[_0xb9ff('0x3c')],_0x24680d[_0xb9ff('0x3e')]),_0x20ce92);if(_0x4e1cc8[_0xb9ff('0x3c')]['filter']){_0x4f1a45['where']=_[_0xb9ff('0x48')](_0x4f1a45['where'],{'$or':_[_0xb9ff('0x3b')](_0x20ce92,function(_0x11cf73){if(_0x11cf73[_0xb9ff('0x38')]!==_0xb9ff('0x49')){var _0x5c8d1c={};_0x5c8d1c[_0x11cf73[_0xb9ff('0x35')]]={'$like':'%'+_0x4e1cc8[_0xb9ff('0x3c')][_0xb9ff('0x4a')]+'%'};return _0x5c8d1c;}})});}_0x4f1a45=_['merge']({},_0x4f1a45,_0x4e1cc8[_0xb9ff('0x4b')]);var _0x224694={'where':_0x4f1a45['where']};return db[_0xb9ff('0x4c')]['count'](_0x224694)[_0xb9ff('0x1f')](function(_0x3d5118){_0x486ebe[_0xb9ff('0x29')]=_0x3d5118;if(_0x4e1cc8['query'][_0xb9ff('0x4d')]){_0x4f1a45[_0xb9ff('0x4e')]=[{'all':!![]}];}return db[_0xb9ff('0x4c')][_0xb9ff('0x4f')](_0x4f1a45);})[_0xb9ff('0x1f')](function(_0x2f68ab){_0x486ebe[_0xb9ff('0x50')]=_0x2f68ab;return _0x486ebe;})[_0xb9ff('0x1f')](respondWithFilteredResult(_0x5875f2,_0x4f1a45))[_0xb9ff('0x26')](handleError(_0x5875f2,null));};exports[_0xb9ff('0x51')]=function(_0x117afc,_0x4ebad3){var _0x5b698b={'raw':![],'where':{'id':_0x117afc['params']['id']}},_0x270fa6={};_0x270fa6[_0xb9ff('0x3a')]=_['keys'](db['DeskAccount'][_0xb9ff('0x37')]);_0x270fa6[_0xb9ff('0x3c')]=_[_0xb9ff('0x3d')](_0x117afc['query']);_0x270fa6[_0xb9ff('0x3e')]=_[_0xb9ff('0x3f')](_0x270fa6['model'],_0x270fa6[_0xb9ff('0x3c')]);_0x5b698b[_0xb9ff('0x40')]=_[_0xb9ff('0x3f')](_0x270fa6[_0xb9ff('0x3a')],qs[_0xb9ff('0x41')](_0x117afc[_0xb9ff('0x3c')][_0xb9ff('0x41')]));_0x5b698b[_0xb9ff('0x40')]=_0x5b698b['attributes'][_0xb9ff('0x42')]?_0x5b698b[_0xb9ff('0x40')]:_0x270fa6[_0xb9ff('0x3a')];if(_0x117afc[_0xb9ff('0x3c')][_0xb9ff('0x4d')]){_0x5b698b[_0xb9ff('0x4e')]=[{'all':!![]}];}_0x5b698b=_['merge']({},_0x5b698b,_0x117afc[_0xb9ff('0x4b')]);return db['DeskAccount'][_0xb9ff('0x52')](_0x5b698b)[_0xb9ff('0x1f')](handleEntityNotFound(_0x4ebad3,null))[_0xb9ff('0x1f')](respondWithResult(_0x4ebad3,null))[_0xb9ff('0x26')](handleError(_0x4ebad3,null));};exports[_0xb9ff('0x53')]=function(_0x39893f,_0x4aceb2){return db[_0xb9ff('0x4c')][_0xb9ff('0x53')](_0x39893f['body'],{})['then'](respondWithResult(_0x4aceb2,0xc9))[_0xb9ff('0x26')](handleError(_0x4aceb2,null));};exports[_0xb9ff('0x30')]=function(_0x3e0d5a,_0x590c5b){if(_0x3e0d5a[_0xb9ff('0x54')]['id']){delete _0x3e0d5a[_0xb9ff('0x54')]['id'];}return db['DeskAccount'][_0xb9ff('0x52')]({'where':{'id':_0x3e0d5a[_0xb9ff('0x55')]['id']}})[_0xb9ff('0x1f')](handleEntityNotFound(_0x590c5b,null))[_0xb9ff('0x1f')](saveUpdates(_0x3e0d5a[_0xb9ff('0x54')],null))[_0xb9ff('0x1f')](respondWithResult(_0x590c5b,null))['catch'](handleError(_0x590c5b,null));};exports[_0xb9ff('0x31')]=function(_0xeffbe5,_0x3d1f58){return db[_0xb9ff('0x4c')][_0xb9ff('0x52')]({'where':{'id':_0xeffbe5[_0xb9ff('0x55')]['id']}})['then'](handleEntityNotFound(_0x3d1f58,null))[_0xb9ff('0x1f')](removeEntity(_0x3d1f58,null))[_0xb9ff('0x26')](handleError(_0x3d1f58,null));};exports[_0xb9ff('0x56')]=function(_0x351e9a,_0x525729,_0x19a5ed){var _0x4ece74={};var _0x311751={};var _0x2aa78c;var _0x152e3e;return db[_0xb9ff('0x4c')][_0xb9ff('0x57')]({'where':{'id':_0x351e9a[_0xb9ff('0x55')]['id']}})[_0xb9ff('0x1f')](handleEntityNotFound(_0x525729,null))[_0xb9ff('0x1f')](function(_0x2f6f55){if(_0x2f6f55){_0x2aa78c=_0x2f6f55;_0x311751[_0xb9ff('0x3a')]=_['keys'](db[_0xb9ff('0x58')]['rawAttributes']);_0x311751[_0xb9ff('0x3c')]=_['keys'](_0x351e9a['query']);_0x311751[_0xb9ff('0x3e')]=_[_0xb9ff('0x3f')](_0x311751['model'],_0x311751['query']);_0x4ece74[_0xb9ff('0x40')]=_[_0xb9ff('0x3f')](_0x311751[_0xb9ff('0x3a')],qs[_0xb9ff('0x41')](_0x351e9a['query'][_0xb9ff('0x41')]));_0x4ece74['attributes']=_0x4ece74[_0xb9ff('0x40')][_0xb9ff('0x42')]?_0x4ece74[_0xb9ff('0x40')]:_0x311751['model'];_0x4ece74[_0xb9ff('0x59')]=qs[_0xb9ff('0x46')](_0x351e9a[_0xb9ff('0x3c')][_0xb9ff('0x46')]);_0x4ece74[_0xb9ff('0x5a')]=qs[_0xb9ff('0x3e')](_[_0xb9ff('0x47')](_0x351e9a['query'],_0x311751[_0xb9ff('0x3e')]));if(_0x351e9a['query'][_0xb9ff('0x4a')]){_0x4ece74['where']=_[_0xb9ff('0x48')](_0x4ece74[_0xb9ff('0x5a')],{'$or':_[_0xb9ff('0x3b')](_0x4ece74[_0xb9ff('0x40')],function(_0xe303d2){var _0x1fa098={};_0x1fa098[_0xe303d2]={'$like':'%'+_0x351e9a['query']['filter']+'%'};return _0x1fa098;})});}_0x4ece74=_['merge']({},_0x4ece74,_0x351e9a['options']);return _0x2aa78c[_0xb9ff('0x56')](_0x4ece74);}})['then'](function(_0x4fa3a3){if(_0x4fa3a3){_0x152e3e=_0x4fa3a3[_0xb9ff('0x42')];if(!_0x351e9a['query'][_0xb9ff('0x43')](_0xb9ff('0x44'))){_0x4ece74[_0xb9ff('0x45')]=qs[_0xb9ff('0x45')](_0x351e9a[_0xb9ff('0x3c')]['limit']);_0x4ece74[_0xb9ff('0x2a')]=qs[_0xb9ff('0x2a')](_0x351e9a[_0xb9ff('0x3c')][_0xb9ff('0x2a')]);}return _0x2aa78c[_0xb9ff('0x56')](_0x4ece74);}})['then'](function(_0x59751a){if(_0x59751a){return _0x59751a?{'count':_0x152e3e,'rows':_0x59751a}:null;}})['then'](respondWithResult(_0x525729,null))[_0xb9ff('0x26')](handleError(_0x525729,null));};exports['addConfiguration']=function(_0xde788e,_0x290ffd,_0xc88863){if(_0xde788e[_0xb9ff('0x54')]['id']){delete _0xde788e[_0xb9ff('0x54')]['id'];}return db[_0xb9ff('0x4c')]['findOne']({'where':{'id':_0xde788e[_0xb9ff('0x55')]['id']}})[_0xb9ff('0x1f')](handleEntityNotFound(_0x290ffd,null))[_0xb9ff('0x1f')](function(_0x69ae){if(_0x69ae){_0xde788e[_0xb9ff('0x54')]['AccountId']=_0x69ae['id'];_0xde788e[_0xb9ff('0x54')]['Subjects']=integrations[_0xb9ff('0x5b')](_0xde788e[_0xb9ff('0x54')][_0xb9ff('0x5c')],_0xde788e[_0xb9ff('0x54')][_0xb9ff('0x38')]);_0xde788e[_0xb9ff('0x54')][_0xb9ff('0x5d')]=integrations['getDescriptions'](_0xde788e[_0xb9ff('0x54')][_0xb9ff('0x5c')],_0xde788e['body'][_0xb9ff('0x38')]);return db[_0xb9ff('0x58')]['create'](_0xde788e[_0xb9ff('0x54')],{'include':[{'model':db[_0xb9ff('0x5e')],'as':_0xb9ff('0x5f')},{'model':db['DeskField'],'as':_0xb9ff('0x5d')}]});}return null;})['then'](respondWithResult(_0x290ffd,null))[_0xb9ff('0x26')](handleError(_0x290ffd,null));};exports[_0xb9ff('0x60')]=function(_0x47c494,_0x3f39cb,_0x4d133c){var _0x97981c=[{'name':_0xb9ff('0x61'),'label':_0xb9ff('0x61'),'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 _0x3ddee7='';return db[_0xb9ff('0x4c')]['findOne']({'where':{'id':_0x47c494[_0xb9ff('0x55')]['id']},'attributes':['id',_0xb9ff('0x62'),_0xb9ff('0x63'),_0xb9ff('0x64'),_0xb9ff('0x65'),_0xb9ff('0x66'),'consumerSecret',_0xb9ff('0x67'),_0xb9ff('0x68')]})[_0xb9ff('0x1f')](handleEntityNotFound(_0x3f39cb,null))['then'](function(_0x499705){if(_0x499705){_0x3ddee7=_0x499705['remoteUri'];var _0x3a730d=_0x3ddee7[_0xb9ff('0x69')](-0x1);if(_0x3a730d==='/'){_0x3ddee7=_0x3ddee7[_0xb9ff('0x6a')](0x0,_0x3ddee7[_0xb9ff('0x6b')](_0x3a730d));}var _0x4b8eb6={'method':'GET','uri':util[_0xb9ff('0x6c')](_0xb9ff('0x6d'),_0x3ddee7),'headers':{'Content-Type':'application/json','Accept':_0xb9ff('0x6e')},'json':!![]};if(_0x499705['authType']==='basic'){_0x4b8eb6['headers'][_0xb9ff('0x6f')]=util[_0xb9ff('0x6c')](_0xb9ff('0x70'),new Buffer(util[_0xb9ff('0x6c')]('%s:%s',_0x499705[_0xb9ff('0x64')],_0x499705[_0xb9ff('0x65')]))[_0xb9ff('0x71')](_0xb9ff('0x72')));}return rp(_0x4b8eb6)[_0xb9ff('0x1f')](function(_0x54a402){return _0x97981c[_0xb9ff('0x73')](_[_0xb9ff('0x3b')](_0x54a402[_0xb9ff('0x74')][_0xb9ff('0x75')],function(_0x5db953){return{'id':_0x5db953['name'],'name':_0x5db953[_0xb9ff('0x35')],'type':_0x5db953[_0xb9ff('0x38')],'active':_0x5db953[_0xb9ff('0x76')],'label':_0x5db953[_0xb9ff('0x77')],'custom':!![]};}));});}})['then'](function(_0x17f145){return{'count':_0x17f145[_0xb9ff('0x42')],'rows':_0x17f145};})[_0xb9ff('0x1f')](respondWithResult(_0x3f39cb,null))[_0xb9ff('0x26')](function(_0x1cef31){var _0x266a52=_0x47c494['query'][_0xb9ff('0x1b')]?0x1f4:_0x1cef31[_0xb9ff('0x78')]||0x1f4;logger['error'](_0xb9ff('0x79'),_0xb9ff('0x60'),_0x266a52,JSON[_0xb9ff('0x7a')](_0x1cef31));delete _0x1cef31[_0xb9ff('0x35')];if(_0x266a52===0x191){_0x266a52=0x190;}_0x3f39cb[_0xb9ff('0x27')](_0x266a52)['send'](_0x47c494[_0xb9ff('0x3c')][_0xb9ff('0x1b')]?{'message':_0xb9ff('0x7b'),'statusCode':_0x1cef31['statusCode']}:_0x1cef31);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index f8410fc..081808e 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 _0x7f2e=['exports','define','DeskAccount','bluebird','request-promise','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x59d389,_0x165058){var _0x3545de=function(_0x29970a){while(--_0x29970a){_0x59d389['push'](_0x59d389['shift']());}};_0x3545de(++_0x165058);}(_0x7f2e,0x11b));var _0xe7f2=function(_0x288efd,_0x86ff6b){_0x288efd=_0x288efd-0x0;var _0x7466bb=_0x7f2e[_0x288efd];return _0x7466bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe7f2('0x0'));var rp=require(_0xe7f2('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe7f2('0x2'));var attributes=require(_0xe7f2('0x3'));var integrations=require(_0xe7f2('0x4'));module[_0xe7f2('0x5')]=function(_0x182dd2,_0x9cb0b1){return _0x182dd2[_0xe7f2('0x6')](_0xe7f2('0x7'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dbe=['../../config/environment','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger','api','rimraf'];(function(_0x58c38f,_0x2e89a5){var _0x1f1d37=function(_0x4cafa9){while(--_0x4cafa9){_0x58c38f['push'](_0x58c38f['shift']());}};_0x1f1d37(++_0x2e89a5);}(_0x2dbe,0x1cf));var _0xe2db=function(_0x49dcc3,_0x1c5065){_0x49dcc3=_0x49dcc3-0x0;var _0x254986=_0x2dbe[_0x49dcc3];return _0x254986;};'use strict';var _=require(_0xe2db('0x0'));var util=require(_0xe2db('0x1'));var logger=require(_0xe2db('0x2'))(_0xe2db('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe2db('0x4'));var config=require(_0xe2db('0x5'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xe2db('0x6'));module[_0xe2db('0x7')]=function(_0xfc2f72,_0x1dab65){return _0xfc2f72[_0xe2db('0x8')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index b584dab..6c97360 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 _0xbb65=['DeskAccount','options','raw','where','limit','include','map','model','attributes','info','stringify','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','catch','GetDeskAccount'];(function(_0x215b81,_0x2e5b6d){var _0x52177b=function(_0x6d0731){while(--_0x6d0731){_0x215b81['push'](_0x215b81['shift']());}};_0x52177b(++_0x2e5b6d);}(_0xbb65,0xfa));var _0x5bb6=function(_0x581c2b,_0x3ed3b4){_0x581c2b=_0x581c2b-0x0;var _0x51f361=_0xbb65[_0x581c2b];return _0x51f361;};'use strict';var _=require(_0x5bb6('0x0'));var util=require(_0x5bb6('0x1'));var moment=require(_0x5bb6('0x2'));var BPromise=require(_0x5bb6('0x3'));var rs=require(_0x5bb6('0x4'));var fs=require('fs');var Redis=require(_0x5bb6('0x5'));var db=require(_0x5bb6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bb6('0x7'))('rpc');var config=require(_0x5bb6('0x8'));var jayson=require(_0x5bb6('0x9'));var client=jayson[_0x5bb6('0xa')][_0x5bb6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9953f8,_0x58b4be,_0x56e501){return new BPromise(function(_0x5016cf,_0x1af662){return client['request'](_0x9953f8,_0x56e501)[_0x5bb6('0xc')](function(_0x77c37e){logger['info'](_0x5bb6('0xd'),_0x58b4be,'request\x20sent');logger[_0x5bb6('0xe')](_0x5bb6('0xf'),_0x58b4be,_0x5bb6('0x10'),JSON['stringify'](_0x77c37e));if(_0x77c37e['error']){if(_0x77c37e['error'][_0x5bb6('0x11')]===0x1f4){logger[_0x5bb6('0x12')](_0x5bb6('0xd'),_0x58b4be,_0x77c37e['error'][_0x5bb6('0x13')]);return _0x1af662(_0x77c37e[_0x5bb6('0x12')][_0x5bb6('0x13')]);}logger[_0x5bb6('0x12')]('DeskAccount,\x20%s,\x20%s',_0x58b4be,_0x77c37e[_0x5bb6('0x12')][_0x5bb6('0x13')]);return _0x5016cf(_0x77c37e[_0x5bb6('0x12')][_0x5bb6('0x13')]);}else{logger['info'](_0x5bb6('0xd'),_0x58b4be,_0x5bb6('0x10'));_0x5016cf(_0x77c37e['result'][_0x5bb6('0x13')]);}})[_0x5bb6('0x14')](function(_0x2a4b58){logger[_0x5bb6('0x12')](_0x5bb6('0xd'),_0x58b4be,_0x2a4b58);_0x1af662(_0x2a4b58);});});}exports[_0x5bb6('0x15')]=function(_0x4ff4aa){var _0x2066c9=this;return new Promise(function(_0x576562,_0x588ada){return db[_0x5bb6('0x16')]['findAll']({'raw':_0x4ff4aa['options']?_0x4ff4aa[_0x5bb6('0x17')][_0x5bb6('0x18')]===undefined?!![]:![]:!![],'where':_0x4ff4aa['options']?_0x4ff4aa[_0x5bb6('0x17')][_0x5bb6('0x19')]||null:null,'attributes':_0x4ff4aa['options']?_0x4ff4aa[_0x5bb6('0x17')]['attributes']||null:null,'limit':_0x4ff4aa[_0x5bb6('0x17')]?_0x4ff4aa['options'][_0x5bb6('0x1a')]||null:null,'include':_0x4ff4aa[_0x5bb6('0x17')]?_0x4ff4aa['options'][_0x5bb6('0x1b')]?_[_0x5bb6('0x1c')](_0x4ff4aa[_0x5bb6('0x17')][_0x5bb6('0x1b')],function(_0x8d4476){return{'model':db[_0x8d4476[_0x5bb6('0x1d')]],'as':_0x8d4476['as'],'attributes':_0x8d4476[_0x5bb6('0x1e')],'include':_0x8d4476[_0x5bb6('0x1b')]?_[_0x5bb6('0x1c')](_0x8d4476[_0x5bb6('0x1b')],function(_0x24d008){return{'model':db[_0x24d008[_0x5bb6('0x1d')]],'as':_0x24d008['as'],'attributes':_0x24d008[_0x5bb6('0x1e')],'include':_0x24d008[_0x5bb6('0x1b')]?_[_0x5bb6('0x1c')](_0x24d008[_0x5bb6('0x1b')],function(_0x7954f1){return{'model':db[_0x7954f1['model']],'as':_0x7954f1['as'],'attributes':_0x7954f1[_0x5bb6('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x413f82){logger[_0x5bb6('0x1f')]('GetDeskAccount',_0x4ff4aa);logger['debug']('GetDeskAccount',_0x4ff4aa,JSON[_0x5bb6('0x20')](_0x413f82));_0x576562(_0x413f82);})['catch'](function(_0x47fa36){logger['error'](_0x5bb6('0x15'),_0x47fa36[_0x5bb6('0x13')],_0x4ff4aa);_0x588ada(_0x2066c9[_0x5bb6('0x12')](0x1f4,_0x47fa36[_0x5bb6('0x13')]));});});};exports['ShowDeskAccount']=function(_0x42a9e2){var _0x47332f=this;return new Promise(function(_0x5db25c,_0x293d1e){return db[_0x5bb6('0x16')]['find']({'raw':_0x42a9e2[_0x5bb6('0x17')]?_0x42a9e2[_0x5bb6('0x17')][_0x5bb6('0x18')]===undefined?!![]:![]:!![],'where':_0x42a9e2[_0x5bb6('0x17')]?_0x42a9e2[_0x5bb6('0x17')]['where']||null:null,'attributes':_0x42a9e2[_0x5bb6('0x17')]?_0x42a9e2['options']['attributes']||null:null,'include':_0x42a9e2[_0x5bb6('0x17')]?_0x42a9e2[_0x5bb6('0x17')][_0x5bb6('0x1b')]?_[_0x5bb6('0x1c')](_0x42a9e2[_0x5bb6('0x17')]['include'],function(_0x37e81d){return{'model':db[_0x37e81d[_0x5bb6('0x1d')]],'as':_0x37e81d['as'],'attributes':_0x37e81d[_0x5bb6('0x1e')],'include':_0x37e81d[_0x5bb6('0x1b')]?_[_0x5bb6('0x1c')](_0x37e81d[_0x5bb6('0x1b')],function(_0x327ce1){return{'model':db[_0x327ce1['model']],'as':_0x327ce1['as'],'attributes':_0x327ce1['attributes'],'include':_0x327ce1[_0x5bb6('0x1b')]?_[_0x5bb6('0x1c')](_0x327ce1[_0x5bb6('0x1b')],function(_0x5b3db9){return{'model':db[_0x5b3db9[_0x5bb6('0x1d')]],'as':_0x5b3db9['as'],'attributes':_0x5b3db9['attributes']};}):[]};}):[]};}):[]:[]})[_0x5bb6('0xc')](function(_0x16b7c7){logger[_0x5bb6('0x1f')](_0x5bb6('0x21'),_0x42a9e2);logger['debug'](_0x5bb6('0x21'),_0x42a9e2,JSON[_0x5bb6('0x20')](_0x16b7c7));_0x5db25c(_0x16b7c7);})[_0x5bb6('0x14')](function(_0x471cb8){logger[_0x5bb6('0x12')](_0x5bb6('0x21'),_0x471cb8[_0x5bb6('0x13')],_0x42a9e2);_0x293d1e(_0x47332f['error'](0x1f4,_0x471cb8['message']));});});}; \ No newline at end of file +var _0xb690=['then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','http','request','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','include','model','map','attributes','ShowDeskAccount'];(function(_0x529853,_0x5eb985){var _0x34fc49=function(_0x278d41){while(--_0x278d41){_0x529853['push'](_0x529853['shift']());}};_0x34fc49(++_0x5eb985);}(_0xb690,0x1cf));var _0x0b69=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0xb690[_0x155c64];return _0x1f154a;};'use strict';var _=require(_0x0b69('0x0'));var util=require(_0x0b69('0x1'));var moment=require(_0x0b69('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b69('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b69('0x4'));var logger=require(_0x0b69('0x5'))(_0x0b69('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0b69('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x11b67b,_0x3075c2,_0x5d8550){return new BPromise(function(_0x28672d,_0x429577){return client[_0x0b69('0x8')](_0x11b67b,_0x5d8550)['then'](function(_0x25110e){logger[_0x0b69('0x9')]('DeskAccount,\x20%s,\x20%s',_0x3075c2,_0x0b69('0xa'));logger[_0x0b69('0xb')](_0x0b69('0xc'),_0x3075c2,'request\x20sent',JSON[_0x0b69('0xd')](_0x25110e));if(_0x25110e[_0x0b69('0xe')]){if(_0x25110e['error'][_0x0b69('0xf')]===0x1f4){logger[_0x0b69('0xe')](_0x0b69('0x10'),_0x3075c2,_0x25110e[_0x0b69('0xe')]['message']);return _0x429577(_0x25110e[_0x0b69('0xe')][_0x0b69('0x11')]);}logger[_0x0b69('0xe')](_0x0b69('0x10'),_0x3075c2,_0x25110e[_0x0b69('0xe')]['message']);return _0x28672d(_0x25110e[_0x0b69('0xe')][_0x0b69('0x11')]);}else{logger[_0x0b69('0x9')](_0x0b69('0x10'),_0x3075c2,_0x0b69('0xa'));_0x28672d(_0x25110e[_0x0b69('0x12')][_0x0b69('0x11')]);}})[_0x0b69('0x13')](function(_0x5d99d4){logger[_0x0b69('0xe')](_0x0b69('0x10'),_0x3075c2,_0x5d99d4);_0x429577(_0x5d99d4);});});}exports[_0x0b69('0x14')]=function(_0xc7d4da){var _0x58a219=this;return new Promise(function(_0x5c8467,_0x2b8246){return db[_0x0b69('0x15')][_0x0b69('0x16')]({'raw':_0xc7d4da[_0x0b69('0x17')]?_0xc7d4da['options'][_0x0b69('0x18')]===undefined?!![]:![]:!![],'where':_0xc7d4da['options']?_0xc7d4da['options'][_0x0b69('0x19')]||null:null,'attributes':_0xc7d4da[_0x0b69('0x17')]?_0xc7d4da[_0x0b69('0x17')]['attributes']||null:null,'limit':_0xc7d4da[_0x0b69('0x17')]?_0xc7d4da[_0x0b69('0x17')][_0x0b69('0x1a')]||null:null,'include':_0xc7d4da['options']?_0xc7d4da[_0x0b69('0x17')][_0x0b69('0x1b')]?_['map'](_0xc7d4da[_0x0b69('0x17')]['include'],function(_0x4ad11b){return{'model':db[_0x4ad11b[_0x0b69('0x1c')]],'as':_0x4ad11b['as'],'attributes':_0x4ad11b['attributes'],'include':_0x4ad11b[_0x0b69('0x1b')]?_[_0x0b69('0x1d')](_0x4ad11b[_0x0b69('0x1b')],function(_0x2a208d){return{'model':db[_0x2a208d[_0x0b69('0x1c')]],'as':_0x2a208d['as'],'attributes':_0x2a208d[_0x0b69('0x1e')],'include':_0x2a208d[_0x0b69('0x1b')]?_[_0x0b69('0x1d')](_0x2a208d[_0x0b69('0x1b')],function(_0x3ec950){return{'model':db[_0x3ec950[_0x0b69('0x1c')]],'as':_0x3ec950['as'],'attributes':_0x3ec950[_0x0b69('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2169e0){logger[_0x0b69('0x9')](_0x0b69('0x14'),_0xc7d4da);logger[_0x0b69('0xb')](_0x0b69('0x14'),_0xc7d4da,JSON['stringify'](_0x2169e0));_0x5c8467(_0x2169e0);})[_0x0b69('0x13')](function(_0x48ec8d){logger[_0x0b69('0xe')](_0x0b69('0x14'),_0x48ec8d[_0x0b69('0x11')],_0xc7d4da);_0x2b8246(_0x58a219[_0x0b69('0xe')](0x1f4,_0x48ec8d[_0x0b69('0x11')]));});});};exports[_0x0b69('0x1f')]=function(_0x370e73){var _0x54a67e=this;return new Promise(function(_0x21504a,_0x306c16){return db[_0x0b69('0x15')]['find']({'raw':_0x370e73['options']?_0x370e73[_0x0b69('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x370e73[_0x0b69('0x17')]?_0x370e73[_0x0b69('0x17')][_0x0b69('0x19')]||null:null,'attributes':_0x370e73[_0x0b69('0x17')]?_0x370e73[_0x0b69('0x17')]['attributes']||null:null,'include':_0x370e73['options']?_0x370e73[_0x0b69('0x17')][_0x0b69('0x1b')]?_[_0x0b69('0x1d')](_0x370e73['options'][_0x0b69('0x1b')],function(_0x415863){return{'model':db[_0x415863[_0x0b69('0x1c')]],'as':_0x415863['as'],'attributes':_0x415863[_0x0b69('0x1e')],'include':_0x415863[_0x0b69('0x1b')]?_['map'](_0x415863[_0x0b69('0x1b')],function(_0x5ae7aa){return{'model':db[_0x5ae7aa['model']],'as':_0x5ae7aa['as'],'attributes':_0x5ae7aa[_0x0b69('0x1e')],'include':_0x5ae7aa[_0x0b69('0x1b')]?_[_0x0b69('0x1d')](_0x5ae7aa[_0x0b69('0x1b')],function(_0x1b8f3c){return{'model':db[_0x1b8f3c[_0x0b69('0x1c')]],'as':_0x1b8f3c['as'],'attributes':_0x1b8f3c['attributes']};}):[]};}):[]};}):[]:[]})[_0x0b69('0x20')](function(_0x4c95d0){logger[_0x0b69('0x9')](_0x0b69('0x1f'),_0x370e73);logger[_0x0b69('0xb')](_0x0b69('0x1f'),_0x370e73,JSON[_0x0b69('0xd')](_0x4c95d0));_0x21504a(_0x4c95d0);})['catch'](function(_0x13efe9){logger[_0x0b69('0xe')](_0x0b69('0x1f'),_0x13efe9[_0x0b69('0x11')],_0x370e73);_0x306c16(_0x54a67e[_0x0b69('0xe')](0x1f4,_0x13efe9['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index a643e7b..97bfae9 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 _0xf722=['create','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post'];(function(_0x330747,_0x3b9954){var _0x595770=function(_0x45df03){while(--_0x45df03){_0x330747['push'](_0x330747['shift']());}};_0x595770(++_0x3b9954);}(_0xf722,0x18f));var _0x2f72=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf722[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x2f72('0x0'));var util=require(_0x2f72('0x1'));var path=require(_0x2f72('0x2'));var timeout=require(_0x2f72('0x3'));var express=require('express');var router=express[_0x2f72('0x4')]();var auth=require(_0x2f72('0x5'));var interaction=require(_0x2f72('0x6'));var config=require(_0x2f72('0x7'));var controller=require('./intDeskConfiguration.controller');router[_0x2f72('0x8')]('/',auth[_0x2f72('0x9')](),controller[_0x2f72('0xa')]);router['get']('/:id',auth[_0x2f72('0x9')](),controller[_0x2f72('0xb')]);router[_0x2f72('0x8')](_0x2f72('0xc'),auth[_0x2f72('0x9')](),controller[_0x2f72('0xd')]);router[_0x2f72('0x8')](_0x2f72('0xe'),auth[_0x2f72('0x9')](),controller[_0x2f72('0xf')]);router[_0x2f72('0x8')](_0x2f72('0x10'),auth[_0x2f72('0x9')](),controller[_0x2f72('0x11')]);router['get'](_0x2f72('0x12'),auth[_0x2f72('0x9')](),controller[_0x2f72('0x13')]);router[_0x2f72('0x14')]('/',auth[_0x2f72('0x9')](),controller[_0x2f72('0x15')]);router[_0x2f72('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x2f72('0x16')]);router[_0x2f72('0x17')]('/:id',auth[_0x2f72('0x9')](),controller[_0x2f72('0x18')]);router[_0x2f72('0x19')]('/:id',auth[_0x2f72('0x9')](),controller[_0x2f72('0x1a')]);module[_0x2f72('0x1b')]=router; \ No newline at end of file +var _0x80c4=['getTags','post','create','setTags','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags'];(function(_0xf81b04,_0x348467){var _0x3efc97=function(_0x9e0f00){while(--_0x9e0f00){_0xf81b04['push'](_0xf81b04['shift']());}};_0x3efc97(++_0x348467);}(_0x80c4,0xa3));var _0x480c=function(_0x39f970,_0x7b0e47){_0x39f970=_0x39f970-0x0;var _0x22bef4=_0x80c4[_0x39f970];return _0x22bef4;};'use strict';var multer=require(_0x480c('0x0'));var util=require('util');var path=require(_0x480c('0x1'));var timeout=require(_0x480c('0x2'));var express=require(_0x480c('0x3'));var router=express[_0x480c('0x4')]();var auth=require(_0x480c('0x5'));var interaction=require(_0x480c('0x6'));var config=require('../../config/environment');var controller=require(_0x480c('0x7'));router[_0x480c('0x8')]('/',auth[_0x480c('0x9')](),controller[_0x480c('0xa')]);router[_0x480c('0x8')](_0x480c('0xb'),auth[_0x480c('0x9')](),controller[_0x480c('0xc')]);router[_0x480c('0x8')]('/:id/fields',auth[_0x480c('0x9')](),controller[_0x480c('0xd')]);router[_0x480c('0x8')](_0x480c('0xe'),auth[_0x480c('0x9')](),controller[_0x480c('0xf')]);router[_0x480c('0x8')](_0x480c('0x10'),auth[_0x480c('0x9')](),controller[_0x480c('0x11')]);router[_0x480c('0x8')](_0x480c('0x12'),auth[_0x480c('0x9')](),controller[_0x480c('0x13')]);router[_0x480c('0x14')]('/',auth[_0x480c('0x9')](),controller[_0x480c('0x15')]);router[_0x480c('0x14')]('/:id/tags',auth[_0x480c('0x9')](),controller[_0x480c('0x16')]);router['put'](_0x480c('0xb'),auth[_0x480c('0x9')](),controller[_0x480c('0x17')]);router['delete']('/:id',auth[_0x480c('0x9')](),controller[_0x480c('0x18')]);module[_0x480c('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index c6ffc8b..7a73f1f 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 _0x6116=['exports','STRING'];(function(_0x348f02,_0x3c0edc){var _0x502d16=function(_0x6dabff){while(--_0x6dabff){_0x348f02['push'](_0x348f02['shift']());}};_0x502d16(++_0x3c0edc);}(_0x6116,0x72));var _0x6611=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6116[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x6611('0x0')]={'name':{'type':Sequelize[_0x6611('0x1')]},'description':{'type':Sequelize[_0x6611('0x1')]}}; \ No newline at end of file +var _0xd423=['sequelize','STRING'];(function(_0xa1e3ca,_0x559022){var _0x5005ab=function(_0x12f90e){while(--_0x12f90e){_0xa1e3ca['push'](_0xa1e3ca['shift']());}};_0x5005ab(++_0x559022);}(_0xd423,0xa4));var _0x3d42=function(_0x30c646,_0x1056ce){_0x30c646=_0x30c646-0x0;var _0x19b17a=_0xd423[_0x30c646];return _0x19b17a;};'use strict';var Sequelize=require(_0x3d42('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3d42('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 3c02085..3da1e1a 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 _0x63bb=['sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','getFields','getSubjects','findOne','DeskField','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x4ca505,_0x48182e){var _0x258f6f=function(_0x4b5401){while(--_0x4b5401){_0x4ca505['push'](_0x4ca505['shift']());}};_0x258f6f(++_0x48182e);}(_0x63bb,0xf8));var _0xb63b=function(_0x248fc8,_0x121ebf){_0x248fc8=_0x248fc8-0x0;var _0x1ec5d1=_0x63bb[_0x248fc8];return _0x1ec5d1;};'use strict';var pdf=require(_0xb63b('0x0'));var emlformat=require(_0xb63b('0x1'));var rimraf=require(_0xb63b('0x2'));var zipdir=require(_0xb63b('0x3'));var jsonpatch=require(_0xb63b('0x4'));var rp=require(_0xb63b('0x5'));var moment=require(_0xb63b('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb63b('0x7'));var path=require(_0xb63b('0x8'));var sox=require(_0xb63b('0x9'));var csv=require(_0xb63b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb63b('0xb'));var squel=require(_0xb63b('0xc'));var crypto=require(_0xb63b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb63b('0xe'));var toCsv=require(_0xb63b('0xa'));var querystring=require('querystring');var Papa=require(_0xb63b('0xf'));var Redis=require(_0xb63b('0x10'));var authService=require(_0xb63b('0x11'));var qs=require(_0xb63b('0x12'));var as=require(_0xb63b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb63b('0x14'))(_0xb63b('0x15'));var utils=require(_0xb63b('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xb63b('0x17'));var client=jayson[_0xb63b('0x18')][_0xb63b('0x19')]({'port':0x232a});function checkPasswordPattern(_0x41ff77,_0x5d43ae,_0x33fa77){if(_0x33fa77){var _0x16c594=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16c594[_0xb63b('0x1a')](_0x5d43ae)){return _0x41ff77;}else{throw new db[(_0xb63b('0x1b'))][(_0xb63b('0x1c'))](_0xb63b('0x1d'));}}else{return _0x41ff77;}}function respondWithRpcPromise(_0x40fd5e,_0x55bfc8,_0x4a0e68,_0x535c8f){return new BPromise(function(_0x21ac0e,_0x44ae16){var _0x108d3a=_0x535c8f||client;return _0x108d3a[_0xb63b('0x1e')](_0x40fd5e,_0x4a0e68)[_0xb63b('0x1f')](function(_0x59718f){logger[_0xb63b('0x20')](_0xb63b('0x21'),_0x55bfc8,'request\x20sent');logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x55bfc8,_0xb63b('0x22'),JSON[_0xb63b('0x23')](_0x59718f));if(_0x59718f[_0xb63b('0x24')]){if(_0x59718f[_0xb63b('0x24')]['code']===0x1f4){logger[_0xb63b('0x24')](_0xb63b('0x21'),_0x55bfc8,_0x59718f[_0xb63b('0x24')][_0xb63b('0x25')]);return _0x44ae16(_0x59718f['error']['message']);}logger[_0xb63b('0x24')]('DeskConfiguration,\x20%s,\x20%s',_0x55bfc8,_0x59718f[_0xb63b('0x24')][_0xb63b('0x25')]);return _0x21ac0e(_0x59718f[_0xb63b('0x24')][_0xb63b('0x25')]);}else{logger[_0xb63b('0x20')](_0xb63b('0x21'),_0x55bfc8,_0xb63b('0x22'));_0x21ac0e(_0x59718f[_0xb63b('0x26')]['message']);}})[_0xb63b('0x27')](function(_0x5e19eb){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x55bfc8,_0x5e19eb);_0x44ae16(_0x5e19eb);});});}function respondWithStatusCode(_0x89c2ed,_0x3e8121){_0x3e8121=_0x3e8121||0xcc;return function(_0x4f8b1d){if(_0x4f8b1d){return _0x89c2ed[_0xb63b('0x28')](_0x3e8121);}return _0x89c2ed['status'](_0x3e8121)['end']();};}function respondWithResult(_0x512053,_0x4dd4c6){_0x4dd4c6=_0x4dd4c6||0xc8;return function(_0x5c396a){if(_0x5c396a){return _0x512053[_0xb63b('0x29')](_0x4dd4c6)[_0xb63b('0x2a')](_0x5c396a);}};}function respondWithFilteredResult(_0x29e1e1,_0x261bcf){return function(_0x1b0342){if(_0x1b0342){var _0x52be4c=_0x1b0342[_0xb63b('0x2b')],_0x50c87e=_0x261bcf[_0xb63b('0x2c')],_0x1fd64d=_0x261bcf[_0xb63b('0x2c')]+_0x261bcf[_0xb63b('0x2d')],_0x4ddcf0;if(_0x1fd64d>=_0x52be4c){_0x1fd64d=_0x52be4c;_0x4ddcf0=0xc8;}else{_0x4ddcf0=0xce;}_0x29e1e1[_0xb63b('0x29')](_0x4ddcf0);return _0x29e1e1['set'](_0xb63b('0x2e'),_0x50c87e+'-'+_0x1fd64d+'/'+_0x52be4c)['json'](_0x1b0342);}return null;};}function patchUpdates(_0x2d7592){return function(_0x3bca37){try{jsonpatch[_0xb63b('0x2f')](_0x3bca37,_0x2d7592,!![]);}catch(_0x49cd65){return BPromise[_0xb63b('0x30')](_0x49cd65);}return _0x3bca37[_0xb63b('0x31')]();};}function saveUpdates(_0x286100,_0x4597d3){return function(_0x4b8b5e){if(_0x4b8b5e){return _0x4b8b5e[_0xb63b('0x32')](_0x286100)[_0xb63b('0x1f')](function(_0x1d8285){return _0x1d8285;});}return null;};}function removeEntity(_0x327cf3,_0x1609b3){return function(_0x393556){if(_0x393556){return _0x393556[_0xb63b('0x33')]()[_0xb63b('0x1f')](function(){_0x327cf3[_0xb63b('0x29')](0xcc)[_0xb63b('0x34')]();});}};}function handleEntityNotFound(_0xa04281,_0x2cbeb7){return function(_0x2ad429){if(!_0x2ad429){_0xa04281['sendStatus'](0x194);}return _0x2ad429;};}function handleError(_0xe546a3,_0x162fe0){_0x162fe0=_0x162fe0||0x1f4;return function(_0x47a46a){logger[_0xb63b('0x24')](_0x47a46a[_0xb63b('0x35')]);if(_0x47a46a['name']){delete _0x47a46a[_0xb63b('0x36')];}_0xe546a3[_0xb63b('0x29')](_0x162fe0)[_0xb63b('0x37')](_0x47a46a);};}exports['index']=function(_0x20d1f5,_0xaf8077){var _0x5d33b4={},_0x4d0299={},_0x2b0a89={'count':0x0,'rows':[]};var _0x3a0cf3=_[_0xb63b('0x38')](db[_0xb63b('0x39')][_0xb63b('0x3a')],function(_0x26db83){return{'name':_0x26db83[_0xb63b('0x3b')],'type':_0x26db83[_0xb63b('0x3c')]['key']};});_0x4d0299[_0xb63b('0x3d')]=_['map'](_0x3a0cf3,_0xb63b('0x36'));_0x4d0299[_0xb63b('0x3e')]=_['keys'](_0x20d1f5['query']);_0x4d0299[_0xb63b('0x3f')]=_[_0xb63b('0x40')](_0x4d0299[_0xb63b('0x3d')],_0x4d0299[_0xb63b('0x3e')]);_0x5d33b4[_0xb63b('0x41')]=_[_0xb63b('0x40')](_0x4d0299[_0xb63b('0x3d')],qs[_0xb63b('0x42')](_0x20d1f5[_0xb63b('0x3e')][_0xb63b('0x42')]));_0x5d33b4[_0xb63b('0x41')]=_0x5d33b4[_0xb63b('0x41')][_0xb63b('0x43')]?_0x5d33b4[_0xb63b('0x41')]:_0x4d0299[_0xb63b('0x3d')];if(!_0x20d1f5[_0xb63b('0x3e')][_0xb63b('0x44')](_0xb63b('0x45'))){_0x5d33b4[_0xb63b('0x2d')]=qs[_0xb63b('0x2d')](_0x20d1f5[_0xb63b('0x3e')][_0xb63b('0x2d')]);_0x5d33b4['offset']=qs['offset'](_0x20d1f5['query']['offset']);}_0x5d33b4[_0xb63b('0x46')]=qs[_0xb63b('0x47')](_0x20d1f5[_0xb63b('0x3e')][_0xb63b('0x47')]);_0x5d33b4[_0xb63b('0x48')]=qs[_0xb63b('0x3f')](_[_0xb63b('0x49')](_0x20d1f5[_0xb63b('0x3e')],_0x4d0299['filters']),_0x3a0cf3);if(_0x20d1f5[_0xb63b('0x3e')][_0xb63b('0x4a')]){_0x5d33b4[_0xb63b('0x48')]=_[_0xb63b('0x4b')](_0x5d33b4[_0xb63b('0x48')],{'$or':_[_0xb63b('0x38')](_0x3a0cf3,function(_0x41e0ee){if(_0x41e0ee['type']!=='VIRTUAL'){var _0x41c5c3={};_0x41c5c3[_0x41e0ee['name']]={'$like':'%'+_0x20d1f5[_0xb63b('0x3e')][_0xb63b('0x4a')]+'%'};return _0x41c5c3;}})});}_0x5d33b4=_['merge']({},_0x5d33b4,_0x20d1f5[_0xb63b('0x4c')]);var _0x224931={'where':_0x5d33b4[_0xb63b('0x48')]};return db[_0xb63b('0x39')]['count'](_0x224931)[_0xb63b('0x1f')](function(_0x205bc8){_0x2b0a89[_0xb63b('0x2b')]=_0x205bc8;if(_0x20d1f5[_0xb63b('0x3e')][_0xb63b('0x4d')]){_0x5d33b4[_0xb63b('0x4e')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xb63b('0x4f')](_0x5d33b4);})[_0xb63b('0x1f')](function(_0x19e8c4){_0x2b0a89[_0xb63b('0x50')]=_0x19e8c4;return _0x2b0a89;})['then'](respondWithFilteredResult(_0xaf8077,_0x5d33b4))[_0xb63b('0x27')](handleError(_0xaf8077,null));};exports[_0xb63b('0x51')]=function(_0x503443,_0x771923){var _0x2e785a={'raw':![],'where':{'id':_0x503443[_0xb63b('0x52')]['id']}},_0x45f679={};_0x45f679[_0xb63b('0x3d')]=_[_0xb63b('0x53')](db[_0xb63b('0x39')]['rawAttributes']);_0x45f679[_0xb63b('0x3e')]=_['keys'](_0x503443['query']);_0x45f679[_0xb63b('0x3f')]=_['intersection'](_0x45f679[_0xb63b('0x3d')],_0x45f679[_0xb63b('0x3e')]);_0x2e785a[_0xb63b('0x41')]=_['intersection'](_0x45f679['model'],qs['fields'](_0x503443[_0xb63b('0x3e')][_0xb63b('0x42')]));_0x2e785a['attributes']=_0x2e785a[_0xb63b('0x41')][_0xb63b('0x43')]?_0x2e785a['attributes']:_0x45f679[_0xb63b('0x3d')];if(_0x503443[_0xb63b('0x3e')][_0xb63b('0x4d')]){_0x2e785a['include']=[{'all':!![]}];}_0x2e785a=_['merge']({},_0x2e785a,_0x503443[_0xb63b('0x4c')]);return db[_0xb63b('0x39')][_0xb63b('0x54')](_0x2e785a)[_0xb63b('0x1f')](handleEntityNotFound(_0x771923,null))[_0xb63b('0x1f')](respondWithResult(_0x771923,null))[_0xb63b('0x27')](handleError(_0x771923,null));};exports['create']=function(_0x5ec6f2,_0x4d97cc){return db[_0xb63b('0x39')][_0xb63b('0x55')](_0x5ec6f2[_0xb63b('0x56')],{})['then'](respondWithResult(_0x4d97cc,0xc9))['catch'](handleError(_0x4d97cc,null));};exports['update']=function(_0x5c4c49,_0x2600d6){if(_0x5c4c49[_0xb63b('0x56')]['id']){delete _0x5c4c49[_0xb63b('0x56')]['id'];}return db[_0xb63b('0x39')]['find']({'where':{'id':_0x5c4c49[_0xb63b('0x52')]['id']}})[_0xb63b('0x1f')](handleEntityNotFound(_0x2600d6,null))['then'](saveUpdates(_0x5c4c49[_0xb63b('0x56')],null))[_0xb63b('0x1f')](respondWithResult(_0x2600d6,null))[_0xb63b('0x27')](handleError(_0x2600d6,null));};exports[_0xb63b('0x33')]=function(_0x4f8227,_0x30eb23){return db['DeskConfiguration'][_0xb63b('0x54')]({'where':{'id':_0x4f8227[_0xb63b('0x52')]['id']}})['then'](handleEntityNotFound(_0x30eb23,null))[_0xb63b('0x1f')](removeEntity(_0x30eb23,null))[_0xb63b('0x27')](handleError(_0x30eb23,null));};exports[_0xb63b('0x57')]=function(_0x859f67,_0x59d035,_0x18e36a){var _0x404cb0={};var _0x239f04={};var _0x3efc0d;var _0x94d066;return db[_0xb63b('0x39')]['findOne']({'where':{'id':_0x859f67[_0xb63b('0x52')]['id']}})[_0xb63b('0x1f')](handleEntityNotFound(_0x59d035,null))[_0xb63b('0x1f')](function(_0x4b4a8d){if(_0x4b4a8d){_0x3efc0d=_0x4b4a8d;_0x239f04['model']=_[_0xb63b('0x53')](db['DeskField'][_0xb63b('0x3a')]);_0x239f04[_0xb63b('0x3e')]=_[_0xb63b('0x53')](_0x859f67[_0xb63b('0x3e')]);_0x239f04[_0xb63b('0x3f')]=_[_0xb63b('0x40')](_0x239f04['model'],_0x239f04[_0xb63b('0x3e')]);_0x404cb0['attributes']=_[_0xb63b('0x40')](_0x239f04[_0xb63b('0x3d')],qs['fields'](_0x859f67['query'][_0xb63b('0x42')]));_0x404cb0[_0xb63b('0x41')]=_0x404cb0[_0xb63b('0x41')][_0xb63b('0x43')]?_0x404cb0[_0xb63b('0x41')]:_0x239f04[_0xb63b('0x3d')];_0x404cb0['order']=qs[_0xb63b('0x47')](_0x859f67[_0xb63b('0x3e')]['sort']);_0x404cb0[_0xb63b('0x48')]=qs['filters'](_['pick'](_0x859f67[_0xb63b('0x3e')],_0x239f04[_0xb63b('0x3f')]));if(_0x859f67[_0xb63b('0x3e')][_0xb63b('0x4a')]){_0x404cb0[_0xb63b('0x48')]=_[_0xb63b('0x4b')](_0x404cb0[_0xb63b('0x48')],{'$or':_[_0xb63b('0x38')](_0x404cb0[_0xb63b('0x41')],function(_0x86a391){var _0x5c1212={};_0x5c1212[_0x86a391]={'$like':'%'+_0x859f67[_0xb63b('0x3e')][_0xb63b('0x4a')]+'%'};return _0x5c1212;})});}_0x404cb0=_[_0xb63b('0x4b')]({},_0x404cb0,_0x859f67[_0xb63b('0x4c')]);return _0x3efc0d[_0xb63b('0x57')](_0x404cb0);}})[_0xb63b('0x1f')](function(_0x74d804){if(_0x74d804){_0x94d066=_0x74d804[_0xb63b('0x43')];if(!_0x859f67[_0xb63b('0x3e')][_0xb63b('0x44')](_0xb63b('0x45'))){_0x404cb0[_0xb63b('0x2d')]=qs[_0xb63b('0x2d')](_0x859f67[_0xb63b('0x3e')][_0xb63b('0x2d')]);_0x404cb0[_0xb63b('0x2c')]=qs['offset'](_0x859f67[_0xb63b('0x3e')]['offset']);}return _0x3efc0d[_0xb63b('0x57')](_0x404cb0);}})[_0xb63b('0x1f')](function(_0x90d787){if(_0x90d787){return _0x90d787?{'count':_0x94d066,'rows':_0x90d787}:null;}})[_0xb63b('0x1f')](respondWithResult(_0x59d035,null))[_0xb63b('0x27')](handleError(_0x59d035,null));};exports[_0xb63b('0x58')]=function(_0xbb5553,_0x3a055f,_0x5eef9a){var _0x69534a={};var _0xc188c4={};var _0x1f0a82;var _0x5a9abe;return db[_0xb63b('0x39')][_0xb63b('0x59')]({'where':{'id':_0xbb5553[_0xb63b('0x52')]['id']}})[_0xb63b('0x1f')](handleEntityNotFound(_0x3a055f,null))['then'](function(_0x3c2088){if(_0x3c2088){_0x1f0a82=_0x3c2088;_0xc188c4[_0xb63b('0x3d')]=_[_0xb63b('0x53')](db[_0xb63b('0x5a')][_0xb63b('0x3a')]);_0xc188c4['query']=_[_0xb63b('0x53')](_0xbb5553[_0xb63b('0x3e')]);_0xc188c4[_0xb63b('0x3f')]=_[_0xb63b('0x40')](_0xc188c4[_0xb63b('0x3d')],_0xc188c4[_0xb63b('0x3e')]);_0x69534a[_0xb63b('0x41')]=_[_0xb63b('0x40')](_0xc188c4[_0xb63b('0x3d')],qs['fields'](_0xbb5553[_0xb63b('0x3e')][_0xb63b('0x42')]));_0x69534a[_0xb63b('0x41')]=_0x69534a[_0xb63b('0x41')][_0xb63b('0x43')]?_0x69534a[_0xb63b('0x41')]:_0xc188c4[_0xb63b('0x3d')];_0x69534a[_0xb63b('0x46')]=qs[_0xb63b('0x47')](_0xbb5553[_0xb63b('0x3e')][_0xb63b('0x47')]);_0x69534a[_0xb63b('0x48')]=qs['filters'](_[_0xb63b('0x49')](_0xbb5553['query'],_0xc188c4[_0xb63b('0x3f')]));if(_0xbb5553['query']['filter']){_0x69534a[_0xb63b('0x48')]=_[_0xb63b('0x4b')](_0x69534a[_0xb63b('0x48')],{'$or':_[_0xb63b('0x38')](_0x69534a[_0xb63b('0x41')],function(_0x306755){var _0x44aa4b={};_0x44aa4b[_0x306755]={'$like':'%'+_0xbb5553[_0xb63b('0x3e')]['filter']+'%'};return _0x44aa4b;})});}_0x69534a=_['merge']({},_0x69534a,_0xbb5553[_0xb63b('0x4c')]);return _0x1f0a82[_0xb63b('0x58')](_0x69534a);}})['then'](function(_0x552838){if(_0x552838){_0x5a9abe=_0x552838['length'];if(!_0xbb5553['query'][_0xb63b('0x44')](_0xb63b('0x45'))){_0x69534a[_0xb63b('0x2d')]=qs['limit'](_0xbb5553['query']['limit']);_0x69534a[_0xb63b('0x2c')]=qs[_0xb63b('0x2c')](_0xbb5553[_0xb63b('0x3e')][_0xb63b('0x2c')]);}return _0x1f0a82['getSubjects'](_0x69534a);}})[_0xb63b('0x1f')](function(_0x1a29d9){if(_0x1a29d9){return _0x1a29d9?{'count':_0x5a9abe,'rows':_0x1a29d9}:null;}})[_0xb63b('0x1f')](respondWithResult(_0x3a055f,null))[_0xb63b('0x27')](handleError(_0x3a055f,null));};exports[_0xb63b('0x5b')]=function(_0x1bbeb1,_0x4bf076,_0x1c2dd5){var _0x1dde48={};var _0x409b83={};var _0x5d4d36;var _0x18d7fe;return db[_0xb63b('0x39')][_0xb63b('0x59')]({'where':{'id':_0x1bbeb1[_0xb63b('0x52')]['id']}})['then'](handleEntityNotFound(_0x4bf076,null))['then'](function(_0x145eac){if(_0x145eac){_0x5d4d36=_0x145eac;_0x409b83[_0xb63b('0x3d')]=_['keys'](db[_0xb63b('0x5a')][_0xb63b('0x3a')]);_0x409b83[_0xb63b('0x3e')]=_[_0xb63b('0x53')](_0x1bbeb1[_0xb63b('0x3e')]);_0x409b83['filters']=_['intersection'](_0x409b83['model'],_0x409b83[_0xb63b('0x3e')]);_0x1dde48[_0xb63b('0x41')]=_[_0xb63b('0x40')](_0x409b83[_0xb63b('0x3d')],qs['fields'](_0x1bbeb1['query'][_0xb63b('0x42')]));_0x1dde48['attributes']=_0x1dde48['attributes']['length']?_0x1dde48[_0xb63b('0x41')]:_0x409b83[_0xb63b('0x3d')];_0x1dde48[_0xb63b('0x46')]=qs[_0xb63b('0x47')](_0x1bbeb1[_0xb63b('0x3e')]['sort']);_0x1dde48[_0xb63b('0x48')]=qs[_0xb63b('0x3f')](_[_0xb63b('0x49')](_0x1bbeb1[_0xb63b('0x3e')],_0x409b83[_0xb63b('0x3f')]));if(_0x1bbeb1[_0xb63b('0x3e')][_0xb63b('0x4a')]){_0x1dde48[_0xb63b('0x48')]=_['merge'](_0x1dde48[_0xb63b('0x48')],{'$or':_['map'](_0x1dde48[_0xb63b('0x41')],function(_0x4ef1de){var _0x702713={};_0x702713[_0x4ef1de]={'$like':'%'+_0x1bbeb1[_0xb63b('0x3e')][_0xb63b('0x4a')]+'%'};return _0x702713;})});}_0x1dde48=_['merge']({},_0x1dde48,_0x1bbeb1['options']);return _0x5d4d36[_0xb63b('0x5b')](_0x1dde48);}})[_0xb63b('0x1f')](function(_0x329981){if(_0x329981){_0x18d7fe=_0x329981[_0xb63b('0x43')];if(!_0x1bbeb1[_0xb63b('0x3e')][_0xb63b('0x44')](_0xb63b('0x45'))){_0x1dde48['limit']=qs[_0xb63b('0x2d')](_0x1bbeb1[_0xb63b('0x3e')][_0xb63b('0x2d')]);_0x1dde48[_0xb63b('0x2c')]=qs[_0xb63b('0x2c')](_0x1bbeb1[_0xb63b('0x3e')][_0xb63b('0x2c')]);}return _0x5d4d36[_0xb63b('0x5b')](_0x1dde48);}})['then'](function(_0x50a4f1){if(_0x50a4f1){return _0x50a4f1?{'count':_0x18d7fe,'rows':_0x50a4f1}:null;}})['then'](respondWithResult(_0x4bf076,null))['catch'](handleError(_0x4bf076,null));};exports['getTags']=function(_0x120be5,_0x1c10ac,_0x16f921){var _0x22a2ce={};var _0x46426a={};var _0x2ae5f3;var _0x52ee04;return db[_0xb63b('0x39')]['findOne']({'where':{'id':_0x120be5['params']['id']}})[_0xb63b('0x1f')](handleEntityNotFound(_0x1c10ac,null))[_0xb63b('0x1f')](function(_0x36f64b){if(_0x36f64b){_0x2ae5f3=_0x36f64b;_0x46426a[_0xb63b('0x3d')]=_['keys'](db[_0xb63b('0x5c')][_0xb63b('0x3a')]);_0x46426a['query']=_[_0xb63b('0x53')](_0x120be5[_0xb63b('0x3e')]);_0x46426a['filters']=_[_0xb63b('0x40')](_0x46426a['model'],_0x46426a['query']);_0x22a2ce[_0xb63b('0x41')]=_[_0xb63b('0x40')](_0x46426a[_0xb63b('0x3d')],qs['fields'](_0x120be5[_0xb63b('0x3e')][_0xb63b('0x42')]));_0x22a2ce[_0xb63b('0x41')]=_0x22a2ce[_0xb63b('0x41')]['length']?_0x22a2ce[_0xb63b('0x41')]:_0x46426a[_0xb63b('0x3d')];_0x22a2ce[_0xb63b('0x46')]=qs[_0xb63b('0x47')](_0x120be5['query'][_0xb63b('0x47')]);_0x22a2ce['where']=qs['filters'](_[_0xb63b('0x49')](_0x120be5[_0xb63b('0x3e')],_0x46426a[_0xb63b('0x3f')]));if(_0x120be5['query']['filter']){_0x22a2ce[_0xb63b('0x48')]=_['merge'](_0x22a2ce[_0xb63b('0x48')],{'$or':_[_0xb63b('0x38')](_0x22a2ce[_0xb63b('0x41')],function(_0x161965){var _0x4a3760={};_0x4a3760[_0x161965]={'$like':'%'+_0x120be5[_0xb63b('0x3e')][_0xb63b('0x4a')]+'%'};return _0x4a3760;})});}_0x22a2ce=_[_0xb63b('0x4b')]({},_0x22a2ce,_0x120be5[_0xb63b('0x4c')]);return _0x2ae5f3[_0xb63b('0x5d')](_0x22a2ce);}})[_0xb63b('0x1f')](function(_0x51a570){if(_0x51a570){_0x52ee04=_0x51a570['length'];if(!_0x120be5[_0xb63b('0x3e')][_0xb63b('0x44')](_0xb63b('0x45'))){_0x22a2ce[_0xb63b('0x2d')]=qs[_0xb63b('0x2d')](_0x120be5[_0xb63b('0x3e')][_0xb63b('0x2d')]);_0x22a2ce[_0xb63b('0x2c')]=qs[_0xb63b('0x2c')](_0x120be5[_0xb63b('0x3e')][_0xb63b('0x2c')]);}return _0x2ae5f3['getTags'](_0x22a2ce);}})['then'](function(_0x59f9c2){if(_0x59f9c2){return _0x59f9c2?{'count':_0x52ee04,'rows':_0x59f9c2}:null;}})[_0xb63b('0x1f')](respondWithResult(_0x1c10ac,null))[_0xb63b('0x27')](handleError(_0x1c10ac,null));};exports[_0xb63b('0x5e')]=function(_0x3bdf0e,_0x5ab68e,_0x6bf138){if(_0x3bdf0e['body']['id']){delete _0x3bdf0e[_0xb63b('0x56')]['id'];}return db[_0xb63b('0x39')][_0xb63b('0x59')]({'where':{'id':_0x3bdf0e[_0xb63b('0x52')]['id']}})[_0xb63b('0x1f')](handleEntityNotFound(_0x5ab68e,null))[_0xb63b('0x1f')](function(_0x1f6d13){if(_0x1f6d13){return _0x1f6d13['setTags'](_0x3bdf0e['body'][_0xb63b('0x5f')]||[]);}return null;})[_0xb63b('0x1f')](respondWithResult(_0x5ab68e,null))[_0xb63b('0x27')](handleError(_0x5ab68e,null));}; \ No newline at end of file +var _0x6183=['model','fields','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','getFields','DeskField','hasOwnProperty','findOne','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','client','http','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~!@#$%^&-_=+[{]}.','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','end','stack','name','send','index','map','DeskConfiguration','rawAttributes','type','query','keys','attributes','intersection'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x6183,0x19b));var _0x3618=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x6183[_0xfae23b];return _0x200640;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3618('0x0'));var rimraf=require(_0x3618('0x1'));var zipdir=require(_0x3618('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3618('0x3'));var moment=require(_0x3618('0x4'));var BPromise=require(_0x3618('0x5'));var Mustache=require(_0x3618('0x6'));var util=require(_0x3618('0x7'));var path=require(_0x3618('0x8'));var sox=require(_0x3618('0x9'));var csv=require(_0x3618('0xa'));var ejs=require(_0x3618('0xb'));var fs=require('fs');var _=require(_0x3618('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3618('0xd'));var deskjs=require(_0x3618('0xe'));var toCsv=require(_0x3618('0xa'));var querystring=require(_0x3618('0xf'));var Papa=require(_0x3618('0x10'));var Redis=require(_0x3618('0x11'));var authService=require(_0x3618('0x12'));var qs=require(_0x3618('0x13'));var as=require(_0x3618('0x14'));var hardwareService=require(_0x3618('0x15'));var logger=require(_0x3618('0x16'))(_0x3618('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x3618('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x3618('0x19')][_0x3618('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x588b38,_0x32bf30,_0x351a81){if(_0x351a81){var _0x638c87=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x638c87[_0x3618('0x1b')](_0x32bf30)){return _0x588b38;}else{throw new db[(_0x3618('0x1c'))][(_0x3618('0x1d'))](_0x3618('0x1e'));}}else{return _0x588b38;}}function respondWithRpcPromise(_0x31530b,_0x48bed1,_0x2a6034,_0x540466){return new BPromise(function(_0x2e8b42,_0x3e9a42){var _0xcd8d44=_0x540466||client;return _0xcd8d44['request'](_0x31530b,_0x2a6034)['then'](function(_0x5e9c82){logger[_0x3618('0x1f')](_0x3618('0x20'),_0x48bed1,_0x3618('0x21'));logger[_0x3618('0x22')](_0x3618('0x23'),_0x48bed1,_0x3618('0x21'),JSON['stringify'](_0x5e9c82));if(_0x5e9c82[_0x3618('0x24')]){if(_0x5e9c82[_0x3618('0x24')]['code']===0x1f4){logger[_0x3618('0x24')](_0x3618('0x20'),_0x48bed1,_0x5e9c82[_0x3618('0x24')]['message']);return _0x3e9a42(_0x5e9c82[_0x3618('0x24')][_0x3618('0x25')]);}logger['error'](_0x3618('0x20'),_0x48bed1,_0x5e9c82[_0x3618('0x24')][_0x3618('0x25')]);return _0x2e8b42(_0x5e9c82['error'][_0x3618('0x25')]);}else{logger[_0x3618('0x1f')](_0x3618('0x20'),_0x48bed1,_0x3618('0x21'));_0x2e8b42(_0x5e9c82[_0x3618('0x26')][_0x3618('0x25')]);}})['catch'](function(_0x49eb7f){logger[_0x3618('0x24')](_0x3618('0x20'),_0x48bed1,_0x49eb7f);_0x3e9a42(_0x49eb7f);});});}function respondWithStatusCode(_0x333e9a,_0x4fd5cf){_0x4fd5cf=_0x4fd5cf||0xcc;return function(_0x191b64){if(_0x191b64){return _0x333e9a[_0x3618('0x27')](_0x4fd5cf);}return _0x333e9a[_0x3618('0x28')](_0x4fd5cf)['end']();};}function respondWithResult(_0x379dde,_0x2b520c){_0x2b520c=_0x2b520c||0xc8;return function(_0x154b41){if(_0x154b41){return _0x379dde[_0x3618('0x28')](_0x2b520c)[_0x3618('0x29')](_0x154b41);}};}function respondWithFilteredResult(_0x1705da,_0x3906af){return function(_0x4e7e0f){if(_0x4e7e0f){var _0x3f991a=_0x4e7e0f[_0x3618('0x2a')],_0x744ddf=_0x3906af[_0x3618('0x2b')],_0x24e2ac=_0x3906af[_0x3618('0x2b')]+_0x3906af[_0x3618('0x2c')],_0x976933;if(_0x24e2ac>=_0x3f991a){_0x24e2ac=_0x3f991a;_0x976933=0xc8;}else{_0x976933=0xce;}_0x1705da['status'](_0x976933);return _0x1705da['set'](_0x3618('0x2d'),_0x744ddf+'-'+_0x24e2ac+'/'+_0x3f991a)['json'](_0x4e7e0f);}return null;};}function patchUpdates(_0x292694){return function(_0x1e2699){try{jsonpatch['apply'](_0x1e2699,_0x292694,!![]);}catch(_0x2213ac){return BPromise[_0x3618('0x2e')](_0x2213ac);}return _0x1e2699[_0x3618('0x2f')]();};}function saveUpdates(_0x11aebc,_0x342d44){return function(_0x4540da){if(_0x4540da){return _0x4540da[_0x3618('0x30')](_0x11aebc)['then'](function(_0x1a16c9){return _0x1a16c9;});}return null;};}function removeEntity(_0x396eb6,_0x3c4257){return function(_0x3d1d04){if(_0x3d1d04){return _0x3d1d04[_0x3618('0x31')]()[_0x3618('0x32')](function(){_0x396eb6[_0x3618('0x28')](0xcc)[_0x3618('0x33')]();});}};}function handleEntityNotFound(_0x451fa5,_0x466bb1){return function(_0x450bfa){if(!_0x450bfa){_0x451fa5['sendStatus'](0x194);}return _0x450bfa;};}function handleError(_0x19761c,_0x28604d){_0x28604d=_0x28604d||0x1f4;return function(_0x3df1a7){logger[_0x3618('0x24')](_0x3df1a7[_0x3618('0x34')]);if(_0x3df1a7[_0x3618('0x35')]){delete _0x3df1a7[_0x3618('0x35')];}_0x19761c[_0x3618('0x28')](_0x28604d)[_0x3618('0x36')](_0x3df1a7);};}exports[_0x3618('0x37')]=function(_0x27c22f,_0x5b46a6){var _0x269ba4={},_0x477b5c={},_0x32317c={'count':0x0,'rows':[]};var _0x22d90e=_[_0x3618('0x38')](db[_0x3618('0x39')][_0x3618('0x3a')],function(_0x2b952f){return{'name':_0x2b952f['fieldName'],'type':_0x2b952f[_0x3618('0x3b')]['key']};});_0x477b5c['model']=_[_0x3618('0x38')](_0x22d90e,_0x3618('0x35'));_0x477b5c[_0x3618('0x3c')]=_[_0x3618('0x3d')](_0x27c22f[_0x3618('0x3c')]);_0x477b5c['filters']=_['intersection'](_0x477b5c['model'],_0x477b5c[_0x3618('0x3c')]);_0x269ba4[_0x3618('0x3e')]=_[_0x3618('0x3f')](_0x477b5c[_0x3618('0x40')],qs[_0x3618('0x41')](_0x27c22f[_0x3618('0x3c')][_0x3618('0x41')]));_0x269ba4[_0x3618('0x3e')]=_0x269ba4[_0x3618('0x3e')]['length']?_0x269ba4['attributes']:_0x477b5c['model'];if(!_0x27c22f['query']['hasOwnProperty'](_0x3618('0x42'))){_0x269ba4['limit']=qs[_0x3618('0x2c')](_0x27c22f['query']['limit']);_0x269ba4['offset']=qs['offset'](_0x27c22f[_0x3618('0x3c')]['offset']);}_0x269ba4[_0x3618('0x43')]=qs['sort'](_0x27c22f['query'][_0x3618('0x44')]);_0x269ba4['where']=qs[_0x3618('0x45')](_[_0x3618('0x46')](_0x27c22f['query'],_0x477b5c[_0x3618('0x45')]),_0x22d90e);if(_0x27c22f[_0x3618('0x3c')][_0x3618('0x47')]){_0x269ba4[_0x3618('0x48')]=_[_0x3618('0x49')](_0x269ba4[_0x3618('0x48')],{'$or':_['map'](_0x22d90e,function(_0xbfae48){if(_0xbfae48[_0x3618('0x3b')]!==_0x3618('0x4a')){var _0x4a9200={};_0x4a9200[_0xbfae48['name']]={'$like':'%'+_0x27c22f[_0x3618('0x3c')][_0x3618('0x47')]+'%'};return _0x4a9200;}})});}_0x269ba4=_['merge']({},_0x269ba4,_0x27c22f[_0x3618('0x4b')]);var _0x44585f={'where':_0x269ba4[_0x3618('0x48')]};return db[_0x3618('0x39')][_0x3618('0x2a')](_0x44585f)[_0x3618('0x32')](function(_0x241a1b){_0x32317c[_0x3618('0x2a')]=_0x241a1b;if(_0x27c22f[_0x3618('0x3c')][_0x3618('0x4c')]){_0x269ba4[_0x3618('0x4d')]=[{'all':!![]}];}return db[_0x3618('0x39')][_0x3618('0x4e')](_0x269ba4);})[_0x3618('0x32')](function(_0x113802){_0x32317c[_0x3618('0x4f')]=_0x113802;return _0x32317c;})[_0x3618('0x32')](respondWithFilteredResult(_0x5b46a6,_0x269ba4))[_0x3618('0x50')](handleError(_0x5b46a6,null));};exports['show']=function(_0x25b809,_0x30818d){var _0xeaf980={'raw':![],'where':{'id':_0x25b809[_0x3618('0x51')]['id']}},_0x3361c0={};_0x3361c0[_0x3618('0x40')]=_['keys'](db[_0x3618('0x39')][_0x3618('0x3a')]);_0x3361c0[_0x3618('0x3c')]=_[_0x3618('0x3d')](_0x25b809[_0x3618('0x3c')]);_0x3361c0[_0x3618('0x45')]=_['intersection'](_0x3361c0['model'],_0x3361c0[_0x3618('0x3c')]);_0xeaf980[_0x3618('0x3e')]=_['intersection'](_0x3361c0[_0x3618('0x40')],qs[_0x3618('0x41')](_0x25b809[_0x3618('0x3c')][_0x3618('0x41')]));_0xeaf980[_0x3618('0x3e')]=_0xeaf980[_0x3618('0x3e')][_0x3618('0x52')]?_0xeaf980[_0x3618('0x3e')]:_0x3361c0[_0x3618('0x40')];if(_0x25b809['query'][_0x3618('0x4c')]){_0xeaf980['include']=[{'all':!![]}];}_0xeaf980=_['merge']({},_0xeaf980,_0x25b809[_0x3618('0x4b')]);return db[_0x3618('0x39')][_0x3618('0x53')](_0xeaf980)[_0x3618('0x32')](handleEntityNotFound(_0x30818d,null))[_0x3618('0x32')](respondWithResult(_0x30818d,null))['catch'](handleError(_0x30818d,null));};exports[_0x3618('0x54')]=function(_0xf53419,_0x360a3e){return db[_0x3618('0x39')]['create'](_0xf53419[_0x3618('0x55')],{})['then'](respondWithResult(_0x360a3e,0xc9))['catch'](handleError(_0x360a3e,null));};exports['update']=function(_0x3e4d9b,_0x39244a){if(_0x3e4d9b['body']['id']){delete _0x3e4d9b[_0x3618('0x55')]['id'];}return db['DeskConfiguration'][_0x3618('0x53')]({'where':{'id':_0x3e4d9b[_0x3618('0x51')]['id']}})[_0x3618('0x32')](handleEntityNotFound(_0x39244a,null))[_0x3618('0x32')](saveUpdates(_0x3e4d9b[_0x3618('0x55')],null))['then'](respondWithResult(_0x39244a,null))[_0x3618('0x50')](handleError(_0x39244a,null));};exports[_0x3618('0x31')]=function(_0x4bd04a,_0x28be8b){return db['DeskConfiguration'][_0x3618('0x53')]({'where':{'id':_0x4bd04a[_0x3618('0x51')]['id']}})['then'](handleEntityNotFound(_0x28be8b,null))['then'](removeEntity(_0x28be8b,null))[_0x3618('0x50')](handleError(_0x28be8b,null));};exports[_0x3618('0x56')]=function(_0x4e74bf,_0x2fd28a,_0x3a9aed){var _0x5de027={};var _0x3ac344={};var _0x154d5f;var _0x1231d6;return db[_0x3618('0x39')]['findOne']({'where':{'id':_0x4e74bf['params']['id']}})[_0x3618('0x32')](handleEntityNotFound(_0x2fd28a,null))[_0x3618('0x32')](function(_0x1e71a5){if(_0x1e71a5){_0x154d5f=_0x1e71a5;_0x3ac344['model']=_[_0x3618('0x3d')](db[_0x3618('0x57')][_0x3618('0x3a')]);_0x3ac344[_0x3618('0x3c')]=_[_0x3618('0x3d')](_0x4e74bf[_0x3618('0x3c')]);_0x3ac344[_0x3618('0x45')]=_[_0x3618('0x3f')](_0x3ac344[_0x3618('0x40')],_0x3ac344[_0x3618('0x3c')]);_0x5de027[_0x3618('0x3e')]=_['intersection'](_0x3ac344[_0x3618('0x40')],qs[_0x3618('0x41')](_0x4e74bf['query'][_0x3618('0x41')]));_0x5de027[_0x3618('0x3e')]=_0x5de027[_0x3618('0x3e')][_0x3618('0x52')]?_0x5de027[_0x3618('0x3e')]:_0x3ac344[_0x3618('0x40')];_0x5de027[_0x3618('0x43')]=qs[_0x3618('0x44')](_0x4e74bf['query'][_0x3618('0x44')]);_0x5de027['where']=qs[_0x3618('0x45')](_[_0x3618('0x46')](_0x4e74bf[_0x3618('0x3c')],_0x3ac344[_0x3618('0x45')]));if(_0x4e74bf[_0x3618('0x3c')][_0x3618('0x47')]){_0x5de027[_0x3618('0x48')]=_[_0x3618('0x49')](_0x5de027['where'],{'$or':_[_0x3618('0x38')](_0x5de027[_0x3618('0x3e')],function(_0x3e5b41){var _0x31a35c={};_0x31a35c[_0x3e5b41]={'$like':'%'+_0x4e74bf[_0x3618('0x3c')]['filter']+'%'};return _0x31a35c;})});}_0x5de027=_[_0x3618('0x49')]({},_0x5de027,_0x4e74bf[_0x3618('0x4b')]);return _0x154d5f[_0x3618('0x56')](_0x5de027);}})['then'](function(_0x1a2031){if(_0x1a2031){_0x1231d6=_0x1a2031['length'];if(!_0x4e74bf[_0x3618('0x3c')][_0x3618('0x58')]('nolimit')){_0x5de027[_0x3618('0x2c')]=qs[_0x3618('0x2c')](_0x4e74bf[_0x3618('0x3c')][_0x3618('0x2c')]);_0x5de027[_0x3618('0x2b')]=qs[_0x3618('0x2b')](_0x4e74bf[_0x3618('0x3c')][_0x3618('0x2b')]);}return _0x154d5f['getFields'](_0x5de027);}})[_0x3618('0x32')](function(_0x31364c){if(_0x31364c){return _0x31364c?{'count':_0x1231d6,'rows':_0x31364c}:null;}})[_0x3618('0x32')](respondWithResult(_0x2fd28a,null))[_0x3618('0x50')](handleError(_0x2fd28a,null));};exports['getSubjects']=function(_0x6ae22d,_0x1528f4,_0x2a7288){var _0x142c35={};var _0x27f00d={};var _0x55c1a2;var _0xc39a90;return db[_0x3618('0x39')][_0x3618('0x59')]({'where':{'id':_0x6ae22d[_0x3618('0x51')]['id']}})[_0x3618('0x32')](handleEntityNotFound(_0x1528f4,null))[_0x3618('0x32')](function(_0x1943a0){if(_0x1943a0){_0x55c1a2=_0x1943a0;_0x27f00d[_0x3618('0x40')]=_[_0x3618('0x3d')](db[_0x3618('0x57')][_0x3618('0x3a')]);_0x27f00d[_0x3618('0x3c')]=_['keys'](_0x6ae22d[_0x3618('0x3c')]);_0x27f00d[_0x3618('0x45')]=_[_0x3618('0x3f')](_0x27f00d[_0x3618('0x40')],_0x27f00d[_0x3618('0x3c')]);_0x142c35[_0x3618('0x3e')]=_[_0x3618('0x3f')](_0x27f00d['model'],qs[_0x3618('0x41')](_0x6ae22d['query'][_0x3618('0x41')]));_0x142c35[_0x3618('0x3e')]=_0x142c35[_0x3618('0x3e')][_0x3618('0x52')]?_0x142c35[_0x3618('0x3e')]:_0x27f00d[_0x3618('0x40')];_0x142c35[_0x3618('0x43')]=qs['sort'](_0x6ae22d[_0x3618('0x3c')]['sort']);_0x142c35[_0x3618('0x48')]=qs[_0x3618('0x45')](_['pick'](_0x6ae22d[_0x3618('0x3c')],_0x27f00d[_0x3618('0x45')]));if(_0x6ae22d[_0x3618('0x3c')][_0x3618('0x47')]){_0x142c35[_0x3618('0x48')]=_[_0x3618('0x49')](_0x142c35['where'],{'$or':_[_0x3618('0x38')](_0x142c35[_0x3618('0x3e')],function(_0x5e217d){var _0x23ae50={};_0x23ae50[_0x5e217d]={'$like':'%'+_0x6ae22d[_0x3618('0x3c')][_0x3618('0x47')]+'%'};return _0x23ae50;})});}_0x142c35=_['merge']({},_0x142c35,_0x6ae22d[_0x3618('0x4b')]);return _0x55c1a2[_0x3618('0x5a')](_0x142c35);}})['then'](function(_0x20080b){if(_0x20080b){_0xc39a90=_0x20080b[_0x3618('0x52')];if(!_0x6ae22d['query'][_0x3618('0x58')](_0x3618('0x42'))){_0x142c35[_0x3618('0x2c')]=qs['limit'](_0x6ae22d[_0x3618('0x3c')][_0x3618('0x2c')]);_0x142c35[_0x3618('0x2b')]=qs[_0x3618('0x2b')](_0x6ae22d['query']['offset']);}return _0x55c1a2[_0x3618('0x5a')](_0x142c35);}})[_0x3618('0x32')](function(_0x1d49a9){if(_0x1d49a9){return _0x1d49a9?{'count':_0xc39a90,'rows':_0x1d49a9}:null;}})[_0x3618('0x32')](respondWithResult(_0x1528f4,null))['catch'](handleError(_0x1528f4,null));};exports[_0x3618('0x5b')]=function(_0x48256b,_0x4c13ac,_0x1a69a8){var _0x4b444a={};var _0x1661ec={};var _0x1bcede;var _0x5e6048;return db['DeskConfiguration'][_0x3618('0x59')]({'where':{'id':_0x48256b[_0x3618('0x51')]['id']}})['then'](handleEntityNotFound(_0x4c13ac,null))[_0x3618('0x32')](function(_0x185136){if(_0x185136){_0x1bcede=_0x185136;_0x1661ec[_0x3618('0x40')]=_[_0x3618('0x3d')](db[_0x3618('0x57')][_0x3618('0x3a')]);_0x1661ec['query']=_[_0x3618('0x3d')](_0x48256b['query']);_0x1661ec['filters']=_['intersection'](_0x1661ec[_0x3618('0x40')],_0x1661ec[_0x3618('0x3c')]);_0x4b444a[_0x3618('0x3e')]=_[_0x3618('0x3f')](_0x1661ec[_0x3618('0x40')],qs[_0x3618('0x41')](_0x48256b[_0x3618('0x3c')][_0x3618('0x41')]));_0x4b444a[_0x3618('0x3e')]=_0x4b444a[_0x3618('0x3e')][_0x3618('0x52')]?_0x4b444a[_0x3618('0x3e')]:_0x1661ec[_0x3618('0x40')];_0x4b444a[_0x3618('0x43')]=qs[_0x3618('0x44')](_0x48256b[_0x3618('0x3c')][_0x3618('0x44')]);_0x4b444a[_0x3618('0x48')]=qs[_0x3618('0x45')](_[_0x3618('0x46')](_0x48256b[_0x3618('0x3c')],_0x1661ec[_0x3618('0x45')]));if(_0x48256b['query'][_0x3618('0x47')]){_0x4b444a[_0x3618('0x48')]=_[_0x3618('0x49')](_0x4b444a[_0x3618('0x48')],{'$or':_[_0x3618('0x38')](_0x4b444a['attributes'],function(_0x34fe51){var _0x177823={};_0x177823[_0x34fe51]={'$like':'%'+_0x48256b['query'][_0x3618('0x47')]+'%'};return _0x177823;})});}_0x4b444a=_[_0x3618('0x49')]({},_0x4b444a,_0x48256b[_0x3618('0x4b')]);return _0x1bcede['getDescriptions'](_0x4b444a);}})[_0x3618('0x32')](function(_0x2612c4){if(_0x2612c4){_0x5e6048=_0x2612c4[_0x3618('0x52')];if(!_0x48256b[_0x3618('0x3c')][_0x3618('0x58')](_0x3618('0x42'))){_0x4b444a[_0x3618('0x2c')]=qs['limit'](_0x48256b[_0x3618('0x3c')][_0x3618('0x2c')]);_0x4b444a[_0x3618('0x2b')]=qs[_0x3618('0x2b')](_0x48256b[_0x3618('0x3c')][_0x3618('0x2b')]);}return _0x1bcede[_0x3618('0x5b')](_0x4b444a);}})[_0x3618('0x32')](function(_0xee0547){if(_0xee0547){return _0xee0547?{'count':_0x5e6048,'rows':_0xee0547}:null;}})['then'](respondWithResult(_0x4c13ac,null))[_0x3618('0x50')](handleError(_0x4c13ac,null));};exports[_0x3618('0x5c')]=function(_0x399ddb,_0x3c020b,_0x16e1d0){var _0x4f134f={};var _0xed403c={};var _0xc96c21;var _0x55d7b3;return db['DeskConfiguration'][_0x3618('0x59')]({'where':{'id':_0x399ddb[_0x3618('0x51')]['id']}})[_0x3618('0x32')](handleEntityNotFound(_0x3c020b,null))[_0x3618('0x32')](function(_0x45d53c){if(_0x45d53c){_0xc96c21=_0x45d53c;_0xed403c[_0x3618('0x40')]=_[_0x3618('0x3d')](db['Tag'][_0x3618('0x3a')]);_0xed403c[_0x3618('0x3c')]=_[_0x3618('0x3d')](_0x399ddb['query']);_0xed403c['filters']=_[_0x3618('0x3f')](_0xed403c[_0x3618('0x40')],_0xed403c[_0x3618('0x3c')]);_0x4f134f[_0x3618('0x3e')]=_['intersection'](_0xed403c[_0x3618('0x40')],qs[_0x3618('0x41')](_0x399ddb[_0x3618('0x3c')][_0x3618('0x41')]));_0x4f134f[_0x3618('0x3e')]=_0x4f134f[_0x3618('0x3e')]['length']?_0x4f134f[_0x3618('0x3e')]:_0xed403c['model'];_0x4f134f[_0x3618('0x43')]=qs[_0x3618('0x44')](_0x399ddb[_0x3618('0x3c')][_0x3618('0x44')]);_0x4f134f[_0x3618('0x48')]=qs[_0x3618('0x45')](_[_0x3618('0x46')](_0x399ddb['query'],_0xed403c[_0x3618('0x45')]));if(_0x399ddb[_0x3618('0x3c')][_0x3618('0x47')]){_0x4f134f[_0x3618('0x48')]=_[_0x3618('0x49')](_0x4f134f[_0x3618('0x48')],{'$or':_[_0x3618('0x38')](_0x4f134f[_0x3618('0x3e')],function(_0x179801){var _0x5988e6={};_0x5988e6[_0x179801]={'$like':'%'+_0x399ddb[_0x3618('0x3c')]['filter']+'%'};return _0x5988e6;})});}_0x4f134f=_[_0x3618('0x49')]({},_0x4f134f,_0x399ddb[_0x3618('0x4b')]);return _0xc96c21[_0x3618('0x5c')](_0x4f134f);}})[_0x3618('0x32')](function(_0x544323){if(_0x544323){_0x55d7b3=_0x544323[_0x3618('0x52')];if(!_0x399ddb[_0x3618('0x3c')][_0x3618('0x58')](_0x3618('0x42'))){_0x4f134f[_0x3618('0x2c')]=qs[_0x3618('0x2c')](_0x399ddb['query'][_0x3618('0x2c')]);_0x4f134f['offset']=qs[_0x3618('0x2b')](_0x399ddb[_0x3618('0x3c')][_0x3618('0x2b')]);}return _0xc96c21['getTags'](_0x4f134f);}})['then'](function(_0x2169d9){if(_0x2169d9){return _0x2169d9?{'count':_0x55d7b3,'rows':_0x2169d9}:null;}})[_0x3618('0x32')](respondWithResult(_0x3c020b,null))['catch'](handleError(_0x3c020b,null));};exports[_0x3618('0x5d')]=function(_0x3d2851,_0x262876,_0x1e874d){if(_0x3d2851['body']['id']){delete _0x3d2851[_0x3618('0x55')]['id'];}return db[_0x3618('0x39')][_0x3618('0x59')]({'where':{'id':_0x3d2851[_0x3618('0x51')]['id']}})[_0x3618('0x32')](handleEntityNotFound(_0x262876,null))[_0x3618('0x32')](function(_0x9729a0){if(_0x9729a0){return _0x9729a0[_0x3618('0x5d')](_0x3d2851[_0x3618('0x55')][_0x3618('0x5e')]||[]);}return null;})[_0x3618('0x32')](respondWithResult(_0x262876,null))['catch'](handleError(_0x262876,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 5e8ba16..64e5624 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 _0x19a9=['moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api'];(function(_0x41c897,_0xe07880){var _0x3e6e83=function(_0x362955){while(--_0x362955){_0x41c897['push'](_0x41c897['shift']());}};_0x3e6e83(++_0xe07880);}(_0x19a9,0x135));var _0x919a=function(_0x590214,_0x5e7d7e){_0x590214=_0x590214-0x0;var _0xfd432c=_0x19a9[_0x590214];return _0xfd432c;};'use strict';var _=require(_0x919a('0x0'));var util=require(_0x919a('0x1'));var logger=require('../../config/logger')(_0x919a('0x2'));var moment=require(_0x919a('0x3'));var BPromise=require(_0x919a('0x4'));var rp=require(_0x919a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x919a('0x6'));var config=require(_0x919a('0x7'));var attributes=require(_0x919a('0x8'));module[_0x919a('0x9')]=function(_0x1bfcbf,_0x4bc398){return _0x1bfcbf[_0x919a('0xa')](_0x919a('0xb'),attributes,{'tableName':_0x919a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cdb=['exports','DeskConfiguration','util','../../config/logger','api','moment','bluebird','request-promise','path','./intDeskConfiguration.attributes'];(function(_0xbd3cf0,_0x1db153){var _0x3609d5=function(_0x2e4899){while(--_0x2e4899){_0xbd3cf0['push'](_0xbd3cf0['shift']());}};_0x3609d5(++_0x1db153);}(_0x0cdb,0x138));var _0xb0cd=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0x0cdb[_0x496333];return _0x44256e;};'use strict';var _=require('lodash');var util=require(_0xb0cd('0x0'));var logger=require(_0xb0cd('0x1'))(_0xb0cd('0x2'));var moment=require(_0xb0cd('0x3'));var BPromise=require(_0xb0cd('0x4'));var rp=require(_0xb0cd('0x5'));var fs=require('fs');var path=require(_0xb0cd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb0cd('0x7'));module[_0xb0cd('0x8')]=function(_0xdacb21,_0x368418){return _0xdacb21['define'](_0xb0cd('0x9'),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 d2dbbdb..4b68acf 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 _0xe0c0=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x1c2994,_0x3b6d6f){var _0x3b8b2a=function(_0x2c660a){while(--_0x2c660a){_0x1c2994['push'](_0x1c2994['shift']());}};_0x3b8b2a(++_0x3b6d6f);}(_0xe0c0,0xa7));var _0x0e0c=function(_0x5b6fcd,_0x52aa7a){_0x5b6fcd=_0x5b6fcd-0x0;var _0x535ffe=_0xe0c0[_0x5b6fcd];return _0x535ffe;};'use strict';var _=require(_0x0e0c('0x0'));var util=require('util');var moment=require(_0x0e0c('0x1'));var BPromise=require(_0x0e0c('0x2'));var rs=require(_0x0e0c('0x3'));var fs=require('fs');var Redis=require(_0x0e0c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e0c('0x5'));var logger=require(_0x0e0c('0x6'))(_0x0e0c('0x7'));var config=require('../../config/environment');var jayson=require(_0x0e0c('0x8'));var client=jayson[_0x0e0c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14e5de,_0xd67cf8,_0xf7de29){return new BPromise(function(_0x13e45d,_0xe3ccce){return client['request'](_0x14e5de,_0xf7de29)['then'](function(_0x518486){logger[_0x0e0c('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0xd67cf8,_0x0e0c('0xb'));logger[_0x0e0c('0xc')](_0x0e0c('0xd'),_0xd67cf8,_0x0e0c('0xb'),JSON[_0x0e0c('0xe')](_0x518486));if(_0x518486[_0x0e0c('0xf')]){if(_0x518486[_0x0e0c('0xf')][_0x0e0c('0x10')]===0x1f4){logger['error'](_0x0e0c('0x11'),_0xd67cf8,_0x518486['error']['message']);return _0xe3ccce(_0x518486[_0x0e0c('0xf')][_0x0e0c('0x12')]);}logger[_0x0e0c('0xf')](_0x0e0c('0x11'),_0xd67cf8,_0x518486[_0x0e0c('0xf')][_0x0e0c('0x12')]);return _0x13e45d(_0x518486['error'][_0x0e0c('0x12')]);}else{logger[_0x0e0c('0xa')](_0x0e0c('0x11'),_0xd67cf8,'request\x20sent');_0x13e45d(_0x518486[_0x0e0c('0x13')][_0x0e0c('0x12')]);}})[_0x0e0c('0x14')](function(_0x20f13d){logger[_0x0e0c('0xf')](_0x0e0c('0x11'),_0xd67cf8,_0x20f13d);_0xe3ccce(_0x20f13d);});});} \ No newline at end of file +var _0xc7ea=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2cb2e6,_0x401618){var _0x8c40d9=function(_0x45e452){while(--_0x45e452){_0x2cb2e6['push'](_0x2cb2e6['shift']());}};_0x8c40d9(++_0x401618);}(_0xc7ea,0x171));var _0xac7e=function(_0xe64ec5,_0x50ddd4){_0xe64ec5=_0xe64ec5-0x0;var _0x2cc3fc=_0xc7ea[_0xe64ec5];return _0x2cc3fc;};'use strict';var _=require(_0xac7e('0x0'));var util=require(_0xac7e('0x1'));var moment=require('moment');var BPromise=require(_0xac7e('0x2'));var rs=require(_0xac7e('0x3'));var fs=require('fs');var Redis=require(_0xac7e('0x4'));var db=require(_0xac7e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac7e('0x6'))(_0xac7e('0x7'));var config=require(_0xac7e('0x8'));var jayson=require(_0xac7e('0x9'));var client=jayson[_0xac7e('0xa')][_0xac7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x447bfe,_0x1aca29,_0x1612f3){return new BPromise(function(_0x1cb874,_0x4d83fb){return client[_0xac7e('0xc')](_0x447bfe,_0x1612f3)[_0xac7e('0xd')](function(_0x2efbf4){logger[_0xac7e('0xe')](_0xac7e('0xf'),_0x1aca29,_0xac7e('0x10'));logger[_0xac7e('0x11')](_0xac7e('0x12'),_0x1aca29,_0xac7e('0x10'),JSON[_0xac7e('0x13')](_0x2efbf4));if(_0x2efbf4[_0xac7e('0x14')]){if(_0x2efbf4[_0xac7e('0x14')]['code']===0x1f4){logger[_0xac7e('0x14')](_0xac7e('0xf'),_0x1aca29,_0x2efbf4['error'][_0xac7e('0x15')]);return _0x4d83fb(_0x2efbf4[_0xac7e('0x14')][_0xac7e('0x15')]);}logger[_0xac7e('0x14')](_0xac7e('0xf'),_0x1aca29,_0x2efbf4['error'][_0xac7e('0x15')]);return _0x1cb874(_0x2efbf4[_0xac7e('0x14')][_0xac7e('0x15')]);}else{logger[_0xac7e('0xe')](_0xac7e('0xf'),_0x1aca29,_0xac7e('0x10'));_0x1cb874(_0x2efbf4[_0xac7e('0x16')][_0xac7e('0x15')]);}})['catch'](function(_0x3f4869){logger[_0xac7e('0x14')](_0xac7e('0xf'),_0x1aca29,_0x3f4869);_0x4d83fb(_0x3f4869);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index baab983..5a5b273 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 _0xd7a1=['get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskField.controller'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xd7a1,0x107));var _0x1d7a=function(_0x217542,_0x15cc22){_0x217542=_0x217542-0x0;var _0x4bb071=_0xd7a1[_0x217542];return _0x4bb071;};'use strict';var multer=require('multer');var util=require(_0x1d7a('0x0'));var path=require(_0x1d7a('0x1'));var timeout=require(_0x1d7a('0x2'));var express=require(_0x1d7a('0x3'));var router=express['Router']();var auth=require(_0x1d7a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1d7a('0x5'));var controller=require(_0x1d7a('0x6'));router[_0x1d7a('0x7')]('/',auth[_0x1d7a('0x8')](),controller[_0x1d7a('0x9')]);router['get'](_0x1d7a('0xa'),auth[_0x1d7a('0x8')](),controller[_0x1d7a('0xb')]);router[_0x1d7a('0xc')]('/',auth[_0x1d7a('0x8')](),controller[_0x1d7a('0xd')]);router[_0x1d7a('0xe')](_0x1d7a('0xa'),auth[_0x1d7a('0x8')](),controller['update']);router[_0x1d7a('0xf')](_0x1d7a('0xa'),auth[_0x1d7a('0x8')](),controller[_0x1d7a('0x10')]);module[_0x1d7a('0x11')]=router; \ No newline at end of file +var _0xca3d=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','update','destroy','multer','util','path','connect-timeout'];(function(_0x2ab99a,_0x20b68e){var _0x5109c8=function(_0x37cd67){while(--_0x37cd67){_0x2ab99a['push'](_0x2ab99a['shift']());}};_0x5109c8(++_0x20b68e);}(_0xca3d,0x1c7));var _0xdca3=function(_0x53fda3,_0x5cc847){_0x53fda3=_0x53fda3-0x0;var _0x3c0742=_0xca3d[_0x53fda3];return _0x3c0742;};'use strict';var multer=require(_0xdca3('0x0'));var util=require(_0xdca3('0x1'));var path=require(_0xdca3('0x2'));var timeout=require(_0xdca3('0x3'));var express=require(_0xdca3('0x4'));var router=express[_0xdca3('0x5')]();var auth=require(_0xdca3('0x6'));var interaction=require(_0xdca3('0x7'));var config=require(_0xdca3('0x8'));var controller=require('./intDeskField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xdca3('0x9')](_0xdca3('0xa'),auth[_0xdca3('0xb')](),controller[_0xdca3('0xc')]);router[_0xdca3('0xd')]('/',auth['isAuthenticated'](),controller[_0xdca3('0xe')]);router['put'](_0xdca3('0xa'),auth[_0xdca3('0xb')](),controller[_0xdca3('0xf')]);router['delete'](_0xdca3('0xa'),auth[_0xdca3('0xb')](),controller[_0xdca3('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index fa9ebac..bebe0b4 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 _0x859b=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x16bb4b,_0x1e2484){var _0x4e01bc=function(_0x1dd306){while(--_0x1dd306){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x4e01bc(++_0x1e2484);}(_0x859b,0xc2));var _0xb859=function(_0x572052,_0x3a3a24){_0x572052=_0x572052-0x0;var _0x188a0c=_0x859b[_0x572052];return _0x188a0c;};'use strict';var Sequelize=require(_0xb859('0x0'));module[_0xb859('0x1')]={'type':{'type':Sequelize[_0xb859('0x2')](_0xb859('0x3'),_0xb859('0x4'),_0xb859('0x5'),_0xb859('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb859('0x7')]},'key':{'type':Sequelize[_0xb859('0x7')]},'keyType':{'type':Sequelize[_0xb859('0x2')](_0xb859('0x3'),_0xb859('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xb859('0x7')]},'idField':{'type':Sequelize[_0xb859('0x7')]},'nameField':{'type':Sequelize[_0xb859('0x7')]},'customField':{'type':Sequelize[_0xb859('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb859('0x7')]}}; \ No newline at end of file +var _0x129e=['customVariable','keyValue','STRING','exports','ENUM','string'];(function(_0x4497d1,_0x3b9f15){var _0x43cfd4=function(_0x2a6d4f){while(--_0x2a6d4f){_0x4497d1['push'](_0x4497d1['shift']());}};_0x43cfd4(++_0x3b9f15);}(_0x129e,0x147));var _0xe129=function(_0x196703,_0x4d3ed4){_0x196703=_0x196703-0x0;var _0x523999=_0x129e[_0x196703];return _0x523999;};'use strict';var Sequelize=require('sequelize');module[_0xe129('0x0')]={'type':{'type':Sequelize[_0xe129('0x1')](_0xe129('0x2'),'variable',_0xe129('0x3'),_0xe129('0x4')),'defaultValue':_0xe129('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe129('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xe129('0x2'),'variable',_0xe129('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe129('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe129('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index d432a6f..ad687fc 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 _0xeb67=['util','sox','to-csv','ejs','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','map','DeskField','rawAttributes','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache'];(function(_0x1d422d,_0xfd3800){var _0x105f74=function(_0x246ef5){while(--_0x246ef5){_0x1d422d['push'](_0x1d422d['shift']());}};_0x105f74(++_0xfd3800);}(_0xeb67,0x191));var _0x7eb6=function(_0x5ca76c,_0x1ad5fe){_0x5ca76c=_0x5ca76c-0x0;var _0x15dbe0=_0xeb67[_0x5ca76c];return _0x15dbe0;};'use strict';var pdf=require(_0x7eb6('0x0'));var emlformat=require(_0x7eb6('0x1'));var rimraf=require(_0x7eb6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7eb6('0x3'));var rp=require('request-promise');var moment=require(_0x7eb6('0x4'));var BPromise=require(_0x7eb6('0x5'));var Mustache=require(_0x7eb6('0x6'));var util=require(_0x7eb6('0x7'));var path=require('path');var sox=require(_0x7eb6('0x8'));var csv=require(_0x7eb6('0x9'));var ejs=require(_0x7eb6('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7eb6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7eb6('0x9'));var querystring=require(_0x7eb6('0xc'));var Papa=require(_0x7eb6('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7eb6('0xe'));var as=require(_0x7eb6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7eb6('0x10'))(_0x7eb6('0x11'));var utils=require(_0x7eb6('0x12'));var config=require(_0x7eb6('0x13'));var db=require(_0x7eb6('0x14'))['db'];function respondWithStatusCode(_0x36e672,_0x2d5d64){_0x2d5d64=_0x2d5d64||0xcc;return function(_0x4c2de4){if(_0x4c2de4){return _0x36e672[_0x7eb6('0x15')](_0x2d5d64);}return _0x36e672[_0x7eb6('0x16')](_0x2d5d64)[_0x7eb6('0x17')]();};}function respondWithResult(_0x7ac0f2,_0x507fab){_0x507fab=_0x507fab||0xc8;return function(_0x228d90){if(_0x228d90){return _0x7ac0f2[_0x7eb6('0x16')](_0x507fab)['json'](_0x228d90);}};}function respondWithFilteredResult(_0x463e90,_0x2f80ff){return function(_0x48ce40){if(_0x48ce40){var _0xf8aff1=_0x48ce40[_0x7eb6('0x18')],_0x3d0668=_0x2f80ff['offset'],_0x96927d=_0x2f80ff[_0x7eb6('0x19')]+_0x2f80ff[_0x7eb6('0x1a')],_0x62626;if(_0x96927d>=_0xf8aff1){_0x96927d=_0xf8aff1;_0x62626=0xc8;}else{_0x62626=0xce;}_0x463e90[_0x7eb6('0x16')](_0x62626);return _0x463e90[_0x7eb6('0x1b')](_0x7eb6('0x1c'),_0x3d0668+'-'+_0x96927d+'/'+_0xf8aff1)[_0x7eb6('0x1d')](_0x48ce40);}return null;};}function patchUpdates(_0x560e1f){return function(_0x9d6d67){try{jsonpatch[_0x7eb6('0x1e')](_0x9d6d67,_0x560e1f,!![]);}catch(_0x9c8d78){return BPromise[_0x7eb6('0x1f')](_0x9c8d78);}return _0x9d6d67['save']();};}function saveUpdates(_0x15f597,_0x3e81be){return function(_0x1bb354){if(_0x1bb354){return _0x1bb354[_0x7eb6('0x20')](_0x15f597)[_0x7eb6('0x21')](function(_0x43146a){return _0x43146a;});}return null;};}function removeEntity(_0x501c79,_0x33598f){return function(_0x9c74ef){if(_0x9c74ef){return _0x9c74ef[_0x7eb6('0x22')]()[_0x7eb6('0x21')](function(){_0x501c79[_0x7eb6('0x16')](0xcc)[_0x7eb6('0x17')]();});}};}function handleEntityNotFound(_0x519614,_0xbcc68d){return function(_0x12a394){if(!_0x12a394){_0x519614[_0x7eb6('0x15')](0x194);}return _0x12a394;};}function handleError(_0x44d1e3,_0x2c3d94){_0x2c3d94=_0x2c3d94||0x1f4;return function(_0x39fe25){logger[_0x7eb6('0x23')](_0x39fe25[_0x7eb6('0x24')]);if(_0x39fe25[_0x7eb6('0x25')]){delete _0x39fe25[_0x7eb6('0x25')];}_0x44d1e3['status'](_0x2c3d94)['send'](_0x39fe25);};}exports[_0x7eb6('0x26')]=function(_0x20f3e0,_0x3bfe75){var _0x53fcf1={},_0x184fb7={},_0x3a1b97={'count':0x0,'rows':[]};var _0x5cc53a=_[_0x7eb6('0x27')](db[_0x7eb6('0x28')][_0x7eb6('0x29')],function(_0x57cbb2){return{'name':_0x57cbb2['fieldName'],'type':_0x57cbb2['type'][_0x7eb6('0x2a')]};});_0x184fb7[_0x7eb6('0x2b')]=_[_0x7eb6('0x27')](_0x5cc53a,_0x7eb6('0x25'));_0x184fb7[_0x7eb6('0x2c')]=_['keys'](_0x20f3e0[_0x7eb6('0x2c')]);_0x184fb7[_0x7eb6('0x2d')]=_[_0x7eb6('0x2e')](_0x184fb7[_0x7eb6('0x2b')],_0x184fb7[_0x7eb6('0x2c')]);_0x53fcf1[_0x7eb6('0x2f')]=_[_0x7eb6('0x2e')](_0x184fb7[_0x7eb6('0x2b')],qs[_0x7eb6('0x30')](_0x20f3e0[_0x7eb6('0x2c')]['fields']));_0x53fcf1[_0x7eb6('0x2f')]=_0x53fcf1[_0x7eb6('0x2f')]['length']?_0x53fcf1[_0x7eb6('0x2f')]:_0x184fb7[_0x7eb6('0x2b')];if(!_0x20f3e0[_0x7eb6('0x2c')]['hasOwnProperty'](_0x7eb6('0x31'))){_0x53fcf1[_0x7eb6('0x1a')]=qs[_0x7eb6('0x1a')](_0x20f3e0[_0x7eb6('0x2c')]['limit']);_0x53fcf1[_0x7eb6('0x19')]=qs[_0x7eb6('0x19')](_0x20f3e0[_0x7eb6('0x2c')][_0x7eb6('0x19')]);}_0x53fcf1['order']=qs[_0x7eb6('0x32')](_0x20f3e0[_0x7eb6('0x2c')][_0x7eb6('0x32')]);_0x53fcf1[_0x7eb6('0x33')]=qs[_0x7eb6('0x2d')](_['pick'](_0x20f3e0[_0x7eb6('0x2c')],_0x184fb7['filters']),_0x5cc53a);if(_0x20f3e0['query'][_0x7eb6('0x34')]){_0x53fcf1[_0x7eb6('0x33')]=_[_0x7eb6('0x35')](_0x53fcf1['where'],{'$or':_[_0x7eb6('0x27')](_0x5cc53a,function(_0x34417a){if(_0x34417a[_0x7eb6('0x36')]!==_0x7eb6('0x37')){var _0x4628f3={};_0x4628f3[_0x34417a[_0x7eb6('0x25')]]={'$like':'%'+_0x20f3e0['query']['filter']+'%'};return _0x4628f3;}})});}_0x53fcf1=_[_0x7eb6('0x35')]({},_0x53fcf1,_0x20f3e0[_0x7eb6('0x38')]);var _0x294460={'where':_0x53fcf1[_0x7eb6('0x33')]};return db['DeskField'][_0x7eb6('0x18')](_0x294460)[_0x7eb6('0x21')](function(_0x1ac70e){_0x3a1b97[_0x7eb6('0x18')]=_0x1ac70e;if(_0x20f3e0[_0x7eb6('0x2c')][_0x7eb6('0x39')]){_0x53fcf1[_0x7eb6('0x3a')]=[{'all':!![]}];}return db[_0x7eb6('0x28')][_0x7eb6('0x3b')](_0x53fcf1);})[_0x7eb6('0x21')](function(_0x569108){_0x3a1b97[_0x7eb6('0x3c')]=_0x569108;return _0x3a1b97;})[_0x7eb6('0x21')](respondWithFilteredResult(_0x3bfe75,_0x53fcf1))[_0x7eb6('0x3d')](handleError(_0x3bfe75,null));};exports['show']=function(_0x498e55,_0x5b8c89){var _0x20671e={'raw':!![],'where':{'id':_0x498e55[_0x7eb6('0x3e')]['id']}},_0x475627={};_0x475627[_0x7eb6('0x2b')]=_[_0x7eb6('0x3f')](db['DeskField']['rawAttributes']);_0x475627[_0x7eb6('0x2c')]=_[_0x7eb6('0x3f')](_0x498e55[_0x7eb6('0x2c')]);_0x475627[_0x7eb6('0x2d')]=_[_0x7eb6('0x2e')](_0x475627['model'],_0x475627['query']);_0x20671e['attributes']=_['intersection'](_0x475627[_0x7eb6('0x2b')],qs[_0x7eb6('0x30')](_0x498e55[_0x7eb6('0x2c')]['fields']));_0x20671e['attributes']=_0x20671e[_0x7eb6('0x2f')][_0x7eb6('0x40')]?_0x20671e[_0x7eb6('0x2f')]:_0x475627[_0x7eb6('0x2b')];if(_0x498e55[_0x7eb6('0x2c')]['includeAll']){_0x20671e['include']=[{'all':!![]}];}_0x20671e=_['merge']({},_0x20671e,_0x498e55[_0x7eb6('0x38')]);return db[_0x7eb6('0x28')][_0x7eb6('0x41')](_0x20671e)[_0x7eb6('0x21')](handleEntityNotFound(_0x5b8c89,null))[_0x7eb6('0x21')](respondWithResult(_0x5b8c89,null))[_0x7eb6('0x3d')](handleError(_0x5b8c89,null));};exports[_0x7eb6('0x42')]=function(_0xbdc8c4,_0x5b53c0){return db[_0x7eb6('0x28')][_0x7eb6('0x42')](_0xbdc8c4[_0x7eb6('0x43')],{})[_0x7eb6('0x21')](respondWithResult(_0x5b53c0,0xc9))[_0x7eb6('0x3d')](handleError(_0x5b53c0,null));};exports[_0x7eb6('0x20')]=function(_0x35fdb3,_0x897fad){if(_0x35fdb3[_0x7eb6('0x43')]['id']){delete _0x35fdb3[_0x7eb6('0x43')]['id'];}return db[_0x7eb6('0x28')][_0x7eb6('0x41')]({'where':{'id':_0x35fdb3[_0x7eb6('0x3e')]['id']}})[_0x7eb6('0x21')](handleEntityNotFound(_0x897fad,null))[_0x7eb6('0x21')](saveUpdates(_0x35fdb3[_0x7eb6('0x43')],null))['then'](respondWithResult(_0x897fad,null))[_0x7eb6('0x3d')](handleError(_0x897fad,null));};exports['destroy']=function(_0xc32bc1,_0x344101){return db[_0x7eb6('0x28')][_0x7eb6('0x41')]({'where':{'id':_0xc32bc1['params']['id']}})[_0x7eb6('0x21')](handleEntityNotFound(_0x344101,null))[_0x7eb6('0x21')](removeEntity(_0x344101,null))[_0x7eb6('0x3d')](handleError(_0x344101,null));}; \ No newline at end of file +var _0x795e=['pick','filter','merge','VIRTUAL','count','include','findAll','catch','show','options','find','create','body','params','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x2bebeb,_0x33deac){var _0x4ade2d=function(_0x25139b){while(--_0x25139b){_0x2bebeb['push'](_0x2bebeb['shift']());}};_0x4ade2d(++_0x33deac);}(_0x795e,0x1f1));var _0xe795=function(_0x23a8f3,_0x264bb7){_0x23a8f3=_0x23a8f3-0x0;var _0xd9b7b6=_0x795e[_0x23a8f3];return _0xd9b7b6;};'use strict';var pdf=require(_0xe795('0x0'));var emlformat=require(_0xe795('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe795('0x2'));var rp=require(_0xe795('0x3'));var moment=require('moment');var BPromise=require(_0xe795('0x4'));var Mustache=require('mustache');var util=require(_0xe795('0x5'));var path=require(_0xe795('0x6'));var sox=require('sox');var csv=require(_0xe795('0x7'));var ejs=require(_0xe795('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe795('0x9'));var crypto=require(_0xe795('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe795('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe795('0xc'));var Redis=require('ioredis');var authService=require(_0xe795('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xe795('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe795('0xf'))(_0xe795('0x10'));var utils=require(_0xe795('0x11'));var config=require(_0xe795('0x12'));var db=require(_0xe795('0x13'))['db'];function respondWithStatusCode(_0x35d179,_0x390682){_0x390682=_0x390682||0xcc;return function(_0x218e26){if(_0x218e26){return _0x35d179[_0xe795('0x14')](_0x390682);}return _0x35d179[_0xe795('0x15')](_0x390682)[_0xe795('0x16')]();};}function respondWithResult(_0x2f8223,_0x413b70){_0x413b70=_0x413b70||0xc8;return function(_0x32ed6f){if(_0x32ed6f){return _0x2f8223[_0xe795('0x15')](_0x413b70)[_0xe795('0x17')](_0x32ed6f);}};}function respondWithFilteredResult(_0x3bb268,_0x45fbbb){return function(_0x3586e2){if(_0x3586e2){var _0x535def=_0x3586e2['count'],_0x15fd81=_0x45fbbb['offset'],_0x565b67=_0x45fbbb[_0xe795('0x18')]+_0x45fbbb[_0xe795('0x19')],_0x48b516;if(_0x565b67>=_0x535def){_0x565b67=_0x535def;_0x48b516=0xc8;}else{_0x48b516=0xce;}_0x3bb268[_0xe795('0x15')](_0x48b516);return _0x3bb268['set'](_0xe795('0x1a'),_0x15fd81+'-'+_0x565b67+'/'+_0x535def)['json'](_0x3586e2);}return null;};}function patchUpdates(_0x35eca7){return function(_0x10c4bf){try{jsonpatch[_0xe795('0x1b')](_0x10c4bf,_0x35eca7,!![]);}catch(_0x307164){return BPromise[_0xe795('0x1c')](_0x307164);}return _0x10c4bf[_0xe795('0x1d')]();};}function saveUpdates(_0x9d88f7,_0x4ce8fe){return function(_0x10e2c2){if(_0x10e2c2){return _0x10e2c2[_0xe795('0x1e')](_0x9d88f7)[_0xe795('0x1f')](function(_0x449339){return _0x449339;});}return null;};}function removeEntity(_0x38018e,_0x4e6c62){return function(_0x127cb7){if(_0x127cb7){return _0x127cb7[_0xe795('0x20')]()[_0xe795('0x1f')](function(){_0x38018e[_0xe795('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39550f,_0x1bd5b0){return function(_0x3072a3){if(!_0x3072a3){_0x39550f[_0xe795('0x14')](0x194);}return _0x3072a3;};}function handleError(_0x23fc93,_0x4ea2bd){_0x4ea2bd=_0x4ea2bd||0x1f4;return function(_0x585cdb){logger[_0xe795('0x21')](_0x585cdb[_0xe795('0x22')]);if(_0x585cdb[_0xe795('0x23')]){delete _0x585cdb[_0xe795('0x23')];}_0x23fc93['status'](_0x4ea2bd)[_0xe795('0x24')](_0x585cdb);};}exports['index']=function(_0x3e36d9,_0x2c91f1){var _0x5f1a10={},_0x23ca0d={},_0x22bcd4={'count':0x0,'rows':[]};var _0x5b6232=_[_0xe795('0x25')](db[_0xe795('0x26')][_0xe795('0x27')],function(_0x21ae8b){return{'name':_0x21ae8b[_0xe795('0x28')],'type':_0x21ae8b[_0xe795('0x29')][_0xe795('0x2a')]};});_0x23ca0d[_0xe795('0x2b')]=_[_0xe795('0x25')](_0x5b6232,_0xe795('0x23'));_0x23ca0d[_0xe795('0x2c')]=_[_0xe795('0x2d')](_0x3e36d9[_0xe795('0x2c')]);_0x23ca0d['filters']=_[_0xe795('0x2e')](_0x23ca0d['model'],_0x23ca0d[_0xe795('0x2c')]);_0x5f1a10[_0xe795('0x2f')]=_[_0xe795('0x2e')](_0x23ca0d['model'],qs[_0xe795('0x30')](_0x3e36d9[_0xe795('0x2c')][_0xe795('0x30')]));_0x5f1a10[_0xe795('0x2f')]=_0x5f1a10[_0xe795('0x2f')][_0xe795('0x31')]?_0x5f1a10[_0xe795('0x2f')]:_0x23ca0d['model'];if(!_0x3e36d9['query'][_0xe795('0x32')](_0xe795('0x33'))){_0x5f1a10['limit']=qs[_0xe795('0x19')](_0x3e36d9[_0xe795('0x2c')][_0xe795('0x19')]);_0x5f1a10[_0xe795('0x18')]=qs[_0xe795('0x18')](_0x3e36d9[_0xe795('0x2c')][_0xe795('0x18')]);}_0x5f1a10['order']=qs[_0xe795('0x34')](_0x3e36d9[_0xe795('0x2c')][_0xe795('0x34')]);_0x5f1a10[_0xe795('0x35')]=qs[_0xe795('0x36')](_[_0xe795('0x37')](_0x3e36d9['query'],_0x23ca0d[_0xe795('0x36')]),_0x5b6232);if(_0x3e36d9[_0xe795('0x2c')][_0xe795('0x38')]){_0x5f1a10[_0xe795('0x35')]=_[_0xe795('0x39')](_0x5f1a10['where'],{'$or':_['map'](_0x5b6232,function(_0x2429dd){if(_0x2429dd[_0xe795('0x29')]!==_0xe795('0x3a')){var _0x25901e={};_0x25901e[_0x2429dd[_0xe795('0x23')]]={'$like':'%'+_0x3e36d9[_0xe795('0x2c')][_0xe795('0x38')]+'%'};return _0x25901e;}})});}_0x5f1a10=_['merge']({},_0x5f1a10,_0x3e36d9['options']);var _0x5d220a={'where':_0x5f1a10[_0xe795('0x35')]};return db[_0xe795('0x26')][_0xe795('0x3b')](_0x5d220a)['then'](function(_0x452cc4){_0x22bcd4[_0xe795('0x3b')]=_0x452cc4;if(_0x3e36d9[_0xe795('0x2c')]['includeAll']){_0x5f1a10[_0xe795('0x3c')]=[{'all':!![]}];}return db[_0xe795('0x26')][_0xe795('0x3d')](_0x5f1a10);})[_0xe795('0x1f')](function(_0x33b60a){_0x22bcd4['rows']=_0x33b60a;return _0x22bcd4;})[_0xe795('0x1f')](respondWithFilteredResult(_0x2c91f1,_0x5f1a10))[_0xe795('0x3e')](handleError(_0x2c91f1,null));};exports[_0xe795('0x3f')]=function(_0x58bb9b,_0x489e71){var _0x53532a={'raw':!![],'where':{'id':_0x58bb9b['params']['id']}},_0x1039f5={};_0x1039f5[_0xe795('0x2b')]=_[_0xe795('0x2d')](db[_0xe795('0x26')][_0xe795('0x27')]);_0x1039f5[_0xe795('0x2c')]=_['keys'](_0x58bb9b[_0xe795('0x2c')]);_0x1039f5['filters']=_[_0xe795('0x2e')](_0x1039f5[_0xe795('0x2b')],_0x1039f5[_0xe795('0x2c')]);_0x53532a[_0xe795('0x2f')]=_[_0xe795('0x2e')](_0x1039f5[_0xe795('0x2b')],qs[_0xe795('0x30')](_0x58bb9b[_0xe795('0x2c')][_0xe795('0x30')]));_0x53532a['attributes']=_0x53532a[_0xe795('0x2f')]['length']?_0x53532a[_0xe795('0x2f')]:_0x1039f5[_0xe795('0x2b')];if(_0x58bb9b[_0xe795('0x2c')]['includeAll']){_0x53532a[_0xe795('0x3c')]=[{'all':!![]}];}_0x53532a=_[_0xe795('0x39')]({},_0x53532a,_0x58bb9b[_0xe795('0x40')]);return db[_0xe795('0x26')][_0xe795('0x41')](_0x53532a)[_0xe795('0x1f')](handleEntityNotFound(_0x489e71,null))[_0xe795('0x1f')](respondWithResult(_0x489e71,null))[_0xe795('0x3e')](handleError(_0x489e71,null));};exports[_0xe795('0x42')]=function(_0x303d5c,_0x11cdf6){return db['DeskField'][_0xe795('0x42')](_0x303d5c['body'],{})[_0xe795('0x1f')](respondWithResult(_0x11cdf6,0xc9))[_0xe795('0x3e')](handleError(_0x11cdf6,null));};exports[_0xe795('0x1e')]=function(_0x3ebd1f,_0x6ee686){if(_0x3ebd1f[_0xe795('0x43')]['id']){delete _0x3ebd1f['body']['id'];}return db[_0xe795('0x26')][_0xe795('0x41')]({'where':{'id':_0x3ebd1f['params']['id']}})[_0xe795('0x1f')](handleEntityNotFound(_0x6ee686,null))['then'](saveUpdates(_0x3ebd1f[_0xe795('0x43')],null))[_0xe795('0x1f')](respondWithResult(_0x6ee686,null))[_0xe795('0x3e')](handleError(_0x6ee686,null));};exports[_0xe795('0x20')]=function(_0x1ad5fc,_0x357313){return db[_0xe795('0x26')][_0xe795('0x41')]({'where':{'id':_0x1ad5fc[_0xe795('0x44')]['id']}})[_0xe795('0x1f')](handleEntityNotFound(_0x357313,null))['then'](removeEntity(_0x357313,null))['catch'](handleError(_0x357313,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index b164072..ad101bf 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 _0x42ac=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField'];(function(_0x33e18e,_0x4c0501){var _0x2076a9=function(_0x237d60){while(--_0x237d60){_0x33e18e['push'](_0x33e18e['shift']());}};_0x2076a9(++_0x4c0501);}(_0x42ac,0x1e0));var _0xc42a=function(_0x3f37fe,_0x519848){_0x3f37fe=_0x3f37fe-0x0;var _0x5c2526=_0x42ac[_0x3f37fe];return _0x5c2526;};'use strict';var _=require(_0xc42a('0x0'));var util=require(_0xc42a('0x1'));var logger=require(_0xc42a('0x2'))(_0xc42a('0x3'));var moment=require('moment');var BPromise=require(_0xc42a('0x4'));var rp=require(_0xc42a('0x5'));var fs=require('fs');var path=require(_0xc42a('0x6'));var rimraf=require(_0xc42a('0x7'));var config=require(_0xc42a('0x8'));var attributes=require(_0xc42a('0x9'));module[_0xc42a('0xa')]=function(_0x186fea,_0x1f3a80){return _0x186fea[_0xc42a('0xb')](_0xc42a('0xc'),attributes,{'tableName':_0xc42a('0xd'),'paranoid':![],'indexes':[{'name':_0xc42a('0xe'),'fields':[_0xc42a('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa16a=['request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','api','bluebird'];(function(_0x2e7c1b,_0x232f79){var _0x42f565=function(_0x31ee5a){while(--_0x31ee5a){_0x2e7c1b['push'](_0x2e7c1b['shift']());}};_0x42f565(++_0x232f79);}(_0xa16a,0xbf));var _0xaa16=function(_0x168127,_0x59cea1){_0x168127=_0x168127-0x0;var _0x4c99ad=_0xa16a[_0x168127];return _0x4c99ad;};'use strict';var _=require(_0xaa16('0x0'));var util=require(_0xaa16('0x1'));var logger=require('../../config/logger')(_0xaa16('0x2'));var moment=require('moment');var BPromise=require(_0xaa16('0x3'));var rp=require(_0xaa16('0x4'));var fs=require('fs');var path=require(_0xaa16('0x5'));var rimraf=require(_0xaa16('0x6'));var config=require(_0xaa16('0x7'));var attributes=require(_0xaa16('0x8'));module[_0xaa16('0x9')]=function(_0x359872,_0x2a0103){return _0x359872[_0xaa16('0xa')](_0xaa16('0xb'),attributes,{'tableName':_0xaa16('0xc'),'paranoid':![],'indexes':[{'name':_0xaa16('0xd'),'fields':[_0xaa16('0xe'),'FieldId'],'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 9745ca7..0dc5d35 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 _0xe810=['message','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe810,0xfd));var _0x0e81=function(_0x14b11d,_0x3e39db){_0x14b11d=_0x14b11d-0x0;var _0x5a9c9e=_0xe810[_0x14b11d];return _0x5a9c9e;};'use strict';var _=require(_0x0e81('0x0'));var util=require('util');var moment=require(_0x0e81('0x1'));var BPromise=require(_0x0e81('0x2'));var rs=require(_0x0e81('0x3'));var fs=require('fs');var Redis=require(_0x0e81('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e81('0x5'));var logger=require(_0x0e81('0x6'))(_0x0e81('0x7'));var config=require('../../config/environment');var jayson=require(_0x0e81('0x8'));var client=jayson[_0x0e81('0x9')][_0x0e81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39da58,_0x510c08,_0x420636){return new BPromise(function(_0x7370d5,_0x351c1c){return client[_0x0e81('0xb')](_0x39da58,_0x420636)['then'](function(_0x415770){logger[_0x0e81('0xc')](_0x0e81('0xd'),_0x510c08,_0x0e81('0xe'));logger[_0x0e81('0xf')](_0x0e81('0x10'),_0x510c08,'request\x20sent',JSON[_0x0e81('0x11')](_0x415770));if(_0x415770[_0x0e81('0x12')]){if(_0x415770[_0x0e81('0x12')][_0x0e81('0x13')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x510c08,_0x415770[_0x0e81('0x12')][_0x0e81('0x14')]);return _0x351c1c(_0x415770[_0x0e81('0x12')][_0x0e81('0x14')]);}logger[_0x0e81('0x12')]('DeskField,\x20%s,\x20%s',_0x510c08,_0x415770[_0x0e81('0x12')]['message']);return _0x7370d5(_0x415770[_0x0e81('0x12')][_0x0e81('0x14')]);}else{logger['info'](_0x0e81('0xd'),_0x510c08,_0x0e81('0xe'));_0x7370d5(_0x415770['result']['message']);}})['catch'](function(_0x25ce72){logger[_0x0e81('0x12')](_0x0e81('0xd'),_0x510c08,_0x25ce72);_0x351c1c(_0x25ce72);});});} \ No newline at end of file +var _0x5ea8=['then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x1f77d8,_0x4174a9){var _0x2e93c0=function(_0x2ed806){while(--_0x2ed806){_0x1f77d8['push'](_0x1f77d8['shift']());}};_0x2e93c0(++_0x4174a9);}(_0x5ea8,0x15c));var _0x85ea=function(_0x289300,_0x44d211){_0x289300=_0x289300-0x0;var _0x2e3d93=_0x5ea8[_0x289300];return _0x2e3d93;};'use strict';var _=require(_0x85ea('0x0'));var util=require(_0x85ea('0x1'));var moment=require(_0x85ea('0x2'));var BPromise=require('bluebird');var rs=require(_0x85ea('0x3'));var fs=require('fs');var Redis=require(_0x85ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x85ea('0x5'));var logger=require(_0x85ea('0x6'))(_0x85ea('0x7'));var config=require(_0x85ea('0x8'));var jayson=require(_0x85ea('0x9'));var client=jayson[_0x85ea('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a4c10,_0x1aa27f,_0x27afe2){return new BPromise(function(_0x55d592,_0xd76cda){return client[_0x85ea('0xb')](_0x2a4c10,_0x27afe2)[_0x85ea('0xc')](function(_0x2e1694){logger[_0x85ea('0xd')](_0x85ea('0xe'),_0x1aa27f,_0x85ea('0xf'));logger[_0x85ea('0x10')](_0x85ea('0x11'),_0x1aa27f,_0x85ea('0xf'),JSON[_0x85ea('0x12')](_0x2e1694));if(_0x2e1694[_0x85ea('0x13')]){if(_0x2e1694[_0x85ea('0x13')][_0x85ea('0x14')]===0x1f4){logger[_0x85ea('0x13')](_0x85ea('0xe'),_0x1aa27f,_0x2e1694[_0x85ea('0x13')]['message']);return _0xd76cda(_0x2e1694[_0x85ea('0x13')][_0x85ea('0x15')]);}logger[_0x85ea('0x13')](_0x85ea('0xe'),_0x1aa27f,_0x2e1694['error'][_0x85ea('0x15')]);return _0x55d592(_0x2e1694[_0x85ea('0x13')][_0x85ea('0x15')]);}else{logger[_0x85ea('0xd')](_0x85ea('0xe'),_0x1aa27f,'request\x20sent');_0x55d592(_0x2e1694[_0x85ea('0x16')]['message']);}})[_0x85ea('0x17')](function(_0xb0a9cd){logger[_0x85ea('0x13')](_0x85ea('0xe'),_0x1aa27f,_0xb0a9cd);_0xd76cda(_0xb0a9cd);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 7d870c0..71f4d9b 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 _0xce88=['multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','update','delete','exports'];(function(_0x4824fb,_0x4cedb3){var _0x1181cd=function(_0x7abaae){while(--_0x7abaae){_0x4824fb['push'](_0x4824fb['shift']());}};_0x1181cd(++_0x4cedb3);}(_0xce88,0x120));var _0x8ce8=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xce88[_0x5e36d1];return _0x950b9e;};'use strict';var multer=require(_0x8ce8('0x0'));var util=require('util');var path=require(_0x8ce8('0x1'));var timeout=require(_0x8ce8('0x2'));var express=require('express');var router=express[_0x8ce8('0x3')]();var auth=require(_0x8ce8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8ce8('0x5'));var controller=require('./intDynamics365Account.controller');router[_0x8ce8('0x6')]('/',auth[_0x8ce8('0x7')](),controller['index']);router['get'](_0x8ce8('0x8'),auth['isAuthenticated'](),controller[_0x8ce8('0x9')]);router[_0x8ce8('0x6')](_0x8ce8('0xa'),auth[_0x8ce8('0x7')](),controller[_0x8ce8('0xb')]);router[_0x8ce8('0x6')](_0x8ce8('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x8ce8('0xd')]('/',auth[_0x8ce8('0x7')](),controller['create']);router[_0x8ce8('0xd')]('/:id/configurations',auth[_0x8ce8('0x7')](),controller[_0x8ce8('0xe')]);router['put'](_0x8ce8('0x8'),auth[_0x8ce8('0x7')](),controller[_0x8ce8('0xf')]);router[_0x8ce8('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8ce8('0x11')]=router; \ No newline at end of file +var _0xcf55=['index','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xb2e21b,_0x51cb42){var _0x31f5ff=function(_0x8e5b9c){while(--_0x8e5b9c){_0xb2e21b['push'](_0xb2e21b['shift']());}};_0x31f5ff(++_0x51cb42);}(_0xcf55,0x1c5));var _0x5cf5=function(_0x5d8cd3,_0x1638dd){_0x5d8cd3=_0x5d8cd3-0x0;var _0x804d64=_0xcf55[_0x5d8cd3];return _0x804d64;};'use strict';var multer=require('multer');var util=require(_0x5cf5('0x0'));var path=require(_0x5cf5('0x1'));var timeout=require(_0x5cf5('0x2'));var express=require(_0x5cf5('0x3'));var router=express[_0x5cf5('0x4')]();var auth=require(_0x5cf5('0x5'));var interaction=require(_0x5cf5('0x6'));var config=require(_0x5cf5('0x7'));var controller=require('./intDynamics365Account.controller');router[_0x5cf5('0x8')]('/',auth['isAuthenticated'](),controller[_0x5cf5('0x9')]);router[_0x5cf5('0x8')]('/:id',auth[_0x5cf5('0xa')](),controller[_0x5cf5('0xb')]);router[_0x5cf5('0x8')](_0x5cf5('0xc'),auth[_0x5cf5('0xa')](),controller[_0x5cf5('0xd')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x5cf5('0xe')]);router[_0x5cf5('0xf')]('/',auth['isAuthenticated'](),controller[_0x5cf5('0x10')]);router[_0x5cf5('0xf')](_0x5cf5('0xc'),auth[_0x5cf5('0xa')](),controller[_0x5cf5('0x11')]);router[_0x5cf5('0x12')](_0x5cf5('0x13'),auth[_0x5cf5('0xa')](),controller[_0x5cf5('0x14')]);router['delete'](_0x5cf5('0x13'),auth[_0x5cf5('0xa')](),controller['destroy']);module[_0x5cf5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 6395273..db3ec93 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 _0xd969=['exports','STRING','sequelize'];(function(_0x4cea31,_0x54ef05){var _0x30bf16=function(_0x1530a7){while(--_0x1530a7){_0x4cea31['push'](_0x4cea31['shift']());}};_0x30bf16(++_0x54ef05);}(_0xd969,0x131));var _0x9d96=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0xd969[_0x31a37b];return _0x49ae16;};'use strict';var Sequelize=require(_0x9d96('0x0'));module[_0x9d96('0x1')]={'name':{'type':Sequelize[_0x9d96('0x2')]},'username':{'type':Sequelize[_0x9d96('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9d96('0x2')]},'tenantId':{'type':Sequelize[_0x9d96('0x2')]},'clientId':{'type':Sequelize[_0x9d96('0x2')]},'clientSecret':{'type':Sequelize[_0x9d96('0x2')]},'serverUrl':{'type':Sequelize[_0x9d96('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xac83=['exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xac83,0x168));var _0x3ac8=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0xac83[_0xcd0918];return _0x250704;};'use strict';var Sequelize=require('sequelize');module[_0x3ac8('0x0')]={'name':{'type':Sequelize[_0x3ac8('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3ac8('0x1')]},'tenantId':{'type':Sequelize[_0x3ac8('0x1')]},'clientId':{'type':Sequelize[_0x3ac8('0x1')]},'clientSecret':{'type':Sequelize[_0x3ac8('0x1')]},'serverUrl':{'type':Sequelize[_0x3ac8('0x1')]},'description':{'type':Sequelize[_0x3ac8('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 9fee76f..c6863c7 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 _0xa8f1=['fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','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~!@#$%^&-_=+[{]}.','request','then','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','stack','name','index','Dynamics365Account','fieldName','type','key','model','query','filters','attributes','fields','length','nolimit','limit','sort','where','filter','map','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','keys','rawAttributes','intersection','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Dynamics365Field','Descriptions','incident','Incident','PhoneCall','title','description','customerid','subject','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','primarycontactidyominame','prioritycodename','productidname','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','clientSecret','slice','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','4.0','value','MetadataId','EntityDefinitions(','Bearer\x20','Attributes','remove','includes','LogicalName','@odata.type','substring','lastIndexOf','PicklistAttributeMetadata','all','forEach','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','concat','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format'];(function(_0x184bca,_0x46ce0c){var _0x3faaa8=function(_0xf2c07e){while(--_0xf2c07e){_0x184bca['push'](_0x184bca['shift']());}};_0x3faaa8(++_0x46ce0c);}(_0xa8f1,0x1b8));var _0x1a8f=function(_0x294e59,_0x1f3262){_0x294e59=_0x294e59-0x0;var _0x232b9d=_0xa8f1[_0x294e59];return _0x232b9d;};'use strict';var pdf=require(_0x1a8f('0x0'));var emlformat=require(_0x1a8f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1a8f('0x2'));var rp=require(_0x1a8f('0x3'));var moment=require('moment');var BPromise=require(_0x1a8f('0x4'));var Mustache=require(_0x1a8f('0x5'));var util=require(_0x1a8f('0x6'));var path=require('path');var sox=require(_0x1a8f('0x7'));var csv=require('to-csv');var ejs=require(_0x1a8f('0x8'));var fs=require('fs');var _=require(_0x1a8f('0x9'));var squel=require('squel');var crypto=require(_0x1a8f('0xa'));var jsforce=require(_0x1a8f('0xb'));var deskjs=require(_0x1a8f('0xc'));var toCsv=require(_0x1a8f('0xd'));var querystring=require(_0x1a8f('0xe'));var Papa=require(_0x1a8f('0xf'));var Redis=require(_0x1a8f('0x10'));var authService=require(_0x1a8f('0x11'));var qs=require(_0x1a8f('0x12'));var as=require(_0x1a8f('0x13'));var hardwareService=require(_0x1a8f('0x14'));var logger=require('../../config/logger')(_0x1a8f('0x15'));var utils=require(_0x1a8f('0x16'));var config=require(_0x1a8f('0x17'));var db=require(_0x1a8f('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x1a8f('0x19'));var client=jayson[_0x1a8f('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x3d1416,_0x3976ac,_0x1d7509){if(_0x1d7509){var _0x485355=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x485355[_0x1a8f('0x1b')](_0x3976ac)){return _0x3d1416;}else{throw new db[(_0x1a8f('0x1c'))][(_0x1a8f('0x1d'))](_0x1a8f('0x1e'));}}else{return _0x3d1416;}}function respondWithRpcPromise(_0x37e0ac,_0x19ecae,_0x3784d9,_0xf7ae35){return new BPromise(function(_0x2164d0,_0x195efd){var _0x1835f8=_0xf7ae35||client;return _0x1835f8[_0x1a8f('0x1f')](_0x37e0ac,_0x3784d9)[_0x1a8f('0x20')](function(_0x2e5688){logger['info'](_0x1a8f('0x21'),_0x19ecae,'request\x20sent');logger[_0x1a8f('0x22')](_0x1a8f('0x23'),_0x19ecae,'request\x20sent',JSON[_0x1a8f('0x24')](_0x2e5688));if(_0x2e5688[_0x1a8f('0x25')]){if(_0x2e5688[_0x1a8f('0x25')][_0x1a8f('0x26')]===0x1f4){logger[_0x1a8f('0x25')](_0x1a8f('0x21'),_0x19ecae,_0x2e5688[_0x1a8f('0x25')][_0x1a8f('0x27')]);return _0x195efd(_0x2e5688[_0x1a8f('0x25')]['message']);}logger[_0x1a8f('0x25')]('Dynamics365Account,\x20%s,\x20%s',_0x19ecae,_0x2e5688[_0x1a8f('0x25')][_0x1a8f('0x27')]);return _0x2164d0(_0x2e5688['error'][_0x1a8f('0x27')]);}else{logger['info'](_0x1a8f('0x21'),_0x19ecae,_0x1a8f('0x28'));_0x2164d0(_0x2e5688[_0x1a8f('0x29')]['message']);}})['catch'](function(_0x51084b){logger[_0x1a8f('0x25')]('Dynamics365Account,\x20%s,\x20%s',_0x19ecae,_0x51084b);_0x195efd(_0x51084b);});});}function respondWithStatusCode(_0x17cf50,_0x1eb0b5){_0x1eb0b5=_0x1eb0b5||0xcc;return function(_0x36d4a){if(_0x36d4a){return _0x17cf50[_0x1a8f('0x2a')](_0x1eb0b5);}return _0x17cf50[_0x1a8f('0x2b')](_0x1eb0b5)[_0x1a8f('0x2c')]();};}function respondWithResult(_0x117e40,_0x587fcd){_0x587fcd=_0x587fcd||0xc8;return function(_0x19c27a){if(_0x19c27a){return _0x117e40[_0x1a8f('0x2b')](_0x587fcd)[_0x1a8f('0x2d')](_0x19c27a);}};}function respondWithFilteredResult(_0x329f2e,_0x37114f){return function(_0x10871f){if(_0x10871f){var _0x54b83c=_0x10871f[_0x1a8f('0x2e')],_0xaf1e8d=_0x37114f[_0x1a8f('0x2f')],_0x5d2bf4=_0x37114f[_0x1a8f('0x2f')]+_0x37114f['limit'],_0x26f18e;if(_0x5d2bf4>=_0x54b83c){_0x5d2bf4=_0x54b83c;_0x26f18e=0xc8;}else{_0x26f18e=0xce;}_0x329f2e[_0x1a8f('0x2b')](_0x26f18e);return _0x329f2e[_0x1a8f('0x30')](_0x1a8f('0x31'),_0xaf1e8d+'-'+_0x5d2bf4+'/'+_0x54b83c)['json'](_0x10871f);}return null;};}function patchUpdates(_0x53b460){return function(_0x15d7df){try{jsonpatch['apply'](_0x15d7df,_0x53b460,!![]);}catch(_0x39a810){return BPromise[_0x1a8f('0x32')](_0x39a810);}return _0x15d7df[_0x1a8f('0x33')]();};}function saveUpdates(_0x51b15a,_0x30f939){return function(_0x3d8acb){if(_0x3d8acb){return _0x3d8acb[_0x1a8f('0x34')](_0x51b15a)['then'](function(_0x5d8062){return _0x5d8062;});}return null;};}function removeEntity(_0x471ea5,_0x3cec46){return function(_0x1d27b9){if(_0x1d27b9){return _0x1d27b9[_0x1a8f('0x35')]()['then'](function(){_0x471ea5['status'](0xcc)[_0x1a8f('0x2c')]();});}};}function handleEntityNotFound(_0x296424,_0x5d41d1){return function(_0x4dd00d){if(!_0x4dd00d){_0x296424['sendStatus'](0x194);}return _0x4dd00d;};}function handleError(_0x36c447,_0x20d892){_0x20d892=_0x20d892||0x1f4;return function(_0xb80898){logger[_0x1a8f('0x25')](_0xb80898[_0x1a8f('0x36')]);if(_0xb80898['name']){delete _0xb80898[_0x1a8f('0x37')];}_0x36c447['status'](_0x20d892)['send'](_0xb80898);};}exports[_0x1a8f('0x38')]=function(_0x7ef1ee,_0xc3d1da){var _0x1438de={},_0x5e0166={},_0x185ed={'count':0x0,'rows':[]};var _0x456d30=_['map'](db[_0x1a8f('0x39')]['rawAttributes'],function(_0x598551){return{'name':_0x598551[_0x1a8f('0x3a')],'type':_0x598551[_0x1a8f('0x3b')][_0x1a8f('0x3c')]};});_0x5e0166[_0x1a8f('0x3d')]=_['map'](_0x456d30,_0x1a8f('0x37'));_0x5e0166[_0x1a8f('0x3e')]=_['keys'](_0x7ef1ee['query']);_0x5e0166[_0x1a8f('0x3f')]=_['intersection'](_0x5e0166[_0x1a8f('0x3d')],_0x5e0166[_0x1a8f('0x3e')]);_0x1438de[_0x1a8f('0x40')]=_['intersection'](_0x5e0166[_0x1a8f('0x3d')],qs[_0x1a8f('0x41')](_0x7ef1ee[_0x1a8f('0x3e')][_0x1a8f('0x41')]));_0x1438de[_0x1a8f('0x40')]=_0x1438de[_0x1a8f('0x40')][_0x1a8f('0x42')]?_0x1438de[_0x1a8f('0x40')]:_0x5e0166[_0x1a8f('0x3d')];if(!_0x7ef1ee[_0x1a8f('0x3e')]['hasOwnProperty'](_0x1a8f('0x43'))){_0x1438de[_0x1a8f('0x44')]=qs[_0x1a8f('0x44')](_0x7ef1ee[_0x1a8f('0x3e')][_0x1a8f('0x44')]);_0x1438de['offset']=qs[_0x1a8f('0x2f')](_0x7ef1ee[_0x1a8f('0x3e')][_0x1a8f('0x2f')]);}_0x1438de['order']=qs[_0x1a8f('0x45')](_0x7ef1ee[_0x1a8f('0x3e')][_0x1a8f('0x45')]);_0x1438de[_0x1a8f('0x46')]=qs[_0x1a8f('0x3f')](_['pick'](_0x7ef1ee['query'],_0x5e0166[_0x1a8f('0x3f')]),_0x456d30);if(_0x7ef1ee['query'][_0x1a8f('0x47')]){_0x1438de[_0x1a8f('0x46')]=_['merge'](_0x1438de['where'],{'$or':_[_0x1a8f('0x48')](_0x456d30,function(_0x530681){if(_0x530681[_0x1a8f('0x3b')]!==_0x1a8f('0x49')){var _0xae5a7={};_0xae5a7[_0x530681['name']]={'$like':'%'+_0x7ef1ee['query'][_0x1a8f('0x47')]+'%'};return _0xae5a7;}})});}_0x1438de=_[_0x1a8f('0x4a')]({},_0x1438de,_0x7ef1ee['options']);var _0xbdbde8={'where':_0x1438de[_0x1a8f('0x46')]};return db[_0x1a8f('0x39')][_0x1a8f('0x2e')](_0xbdbde8)['then'](function(_0x29438c){_0x185ed[_0x1a8f('0x2e')]=_0x29438c;if(_0x7ef1ee[_0x1a8f('0x3e')][_0x1a8f('0x4b')]){_0x1438de[_0x1a8f('0x4c')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x1a8f('0x4d')](_0x1438de);})[_0x1a8f('0x20')](function(_0x507d8a){_0x185ed['rows']=_0x507d8a;return _0x185ed;})[_0x1a8f('0x20')](respondWithFilteredResult(_0xc3d1da,_0x1438de))[_0x1a8f('0x4e')](handleError(_0xc3d1da,null));};exports[_0x1a8f('0x4f')]=function(_0x4262bc,_0x1a55b3){var _0x8dfd83={'raw':![],'where':{'id':_0x4262bc[_0x1a8f('0x50')]['id']}},_0x195e21={};_0x195e21[_0x1a8f('0x3d')]=_[_0x1a8f('0x51')](db[_0x1a8f('0x39')][_0x1a8f('0x52')]);_0x195e21[_0x1a8f('0x3e')]=_[_0x1a8f('0x51')](_0x4262bc[_0x1a8f('0x3e')]);_0x195e21[_0x1a8f('0x3f')]=_[_0x1a8f('0x53')](_0x195e21[_0x1a8f('0x3d')],_0x195e21['query']);_0x8dfd83[_0x1a8f('0x40')]=_[_0x1a8f('0x53')](_0x195e21[_0x1a8f('0x3d')],qs['fields'](_0x4262bc[_0x1a8f('0x3e')][_0x1a8f('0x41')]));_0x8dfd83[_0x1a8f('0x40')]=_0x8dfd83[_0x1a8f('0x40')][_0x1a8f('0x42')]?_0x8dfd83[_0x1a8f('0x40')]:_0x195e21[_0x1a8f('0x3d')];if(_0x4262bc[_0x1a8f('0x3e')]['includeAll']){_0x8dfd83[_0x1a8f('0x4c')]=[{'all':!![]}];}_0x8dfd83=_[_0x1a8f('0x4a')]({},_0x8dfd83,_0x4262bc[_0x1a8f('0x54')]);return db[_0x1a8f('0x39')][_0x1a8f('0x55')](_0x8dfd83)['then'](handleEntityNotFound(_0x1a55b3,null))['then'](respondWithResult(_0x1a55b3,null))[_0x1a8f('0x4e')](handleError(_0x1a55b3,null));};exports['create']=function(_0x197b8a,_0x101f31){return db['Dynamics365Account'][_0x1a8f('0x56')](_0x197b8a[_0x1a8f('0x57')],{})[_0x1a8f('0x20')](respondWithResult(_0x101f31,0xc9))[_0x1a8f('0x4e')](handleError(_0x101f31,null));};exports['update']=function(_0x1bfda8,_0x184e7b){if(_0x1bfda8[_0x1a8f('0x57')]['id']){delete _0x1bfda8['body']['id'];}return db[_0x1a8f('0x39')][_0x1a8f('0x55')]({'where':{'id':_0x1bfda8[_0x1a8f('0x50')]['id']}})['then'](handleEntityNotFound(_0x184e7b,null))[_0x1a8f('0x20')](saveUpdates(_0x1bfda8[_0x1a8f('0x57')],null))[_0x1a8f('0x20')](respondWithResult(_0x184e7b,null))[_0x1a8f('0x4e')](handleError(_0x184e7b,null));};exports[_0x1a8f('0x35')]=function(_0x103fa6,_0x1e0df7){return db['Dynamics365Account'][_0x1a8f('0x55')]({'where':{'id':_0x103fa6[_0x1a8f('0x50')]['id']}})[_0x1a8f('0x20')](handleEntityNotFound(_0x1e0df7,null))[_0x1a8f('0x20')](removeEntity(_0x1e0df7,null))[_0x1a8f('0x4e')](handleError(_0x1e0df7,null));};exports[_0x1a8f('0x58')]=function(_0x180264,_0x12dda6,_0x58783e){var _0x1ae0e6={};var _0x4e1914={};var _0x55afdd;var _0x5e76b0;return db['Dynamics365Account'][_0x1a8f('0x59')]({'where':{'id':_0x180264[_0x1a8f('0x50')]['id']}})['then'](handleEntityNotFound(_0x12dda6,null))[_0x1a8f('0x20')](function(_0x4493b8){if(_0x4493b8){_0x55afdd=_0x4493b8;_0x4e1914[_0x1a8f('0x3d')]=_[_0x1a8f('0x51')](db[_0x1a8f('0x5a')][_0x1a8f('0x52')]);_0x4e1914[_0x1a8f('0x3e')]=_[_0x1a8f('0x51')](_0x180264['query']);_0x4e1914[_0x1a8f('0x3f')]=_['intersection'](_0x4e1914[_0x1a8f('0x3d')],_0x4e1914[_0x1a8f('0x3e')]);_0x1ae0e6[_0x1a8f('0x40')]=_[_0x1a8f('0x53')](_0x4e1914[_0x1a8f('0x3d')],qs[_0x1a8f('0x41')](_0x180264[_0x1a8f('0x3e')]['fields']));_0x1ae0e6[_0x1a8f('0x40')]=_0x1ae0e6['attributes'][_0x1a8f('0x42')]?_0x1ae0e6[_0x1a8f('0x40')]:_0x4e1914[_0x1a8f('0x3d')];_0x1ae0e6['order']=qs[_0x1a8f('0x45')](_0x180264['query']['sort']);_0x1ae0e6[_0x1a8f('0x46')]=qs[_0x1a8f('0x3f')](_[_0x1a8f('0x5b')](_0x180264[_0x1a8f('0x3e')],_0x4e1914[_0x1a8f('0x3f')]));if(_0x180264['query'][_0x1a8f('0x47')]){_0x1ae0e6['where']=_[_0x1a8f('0x4a')](_0x1ae0e6['where'],{'$or':_[_0x1a8f('0x48')](_0x1ae0e6[_0x1a8f('0x40')],function(_0x4b0579){var _0x3f7cae={};_0x3f7cae[_0x4b0579]={'$like':'%'+_0x180264[_0x1a8f('0x3e')][_0x1a8f('0x47')]+'%'};return _0x3f7cae;})});}_0x1ae0e6=_[_0x1a8f('0x4a')]({},_0x1ae0e6,_0x180264[_0x1a8f('0x54')]);return _0x55afdd[_0x1a8f('0x58')](_0x1ae0e6);}})[_0x1a8f('0x20')](function(_0x29deff){if(_0x29deff){_0x5e76b0=_0x29deff[_0x1a8f('0x42')];if(!_0x180264[_0x1a8f('0x3e')][_0x1a8f('0x5c')](_0x1a8f('0x43'))){_0x1ae0e6['limit']=qs[_0x1a8f('0x44')](_0x180264[_0x1a8f('0x3e')][_0x1a8f('0x44')]);_0x1ae0e6['offset']=qs[_0x1a8f('0x2f')](_0x180264[_0x1a8f('0x3e')][_0x1a8f('0x2f')]);}return _0x55afdd['getConfigurations'](_0x1ae0e6);}})[_0x1a8f('0x20')](function(_0x51bc39){if(_0x51bc39){return _0x51bc39?{'count':_0x5e76b0,'rows':_0x51bc39}:null;}})['then'](respondWithResult(_0x12dda6,null))[_0x1a8f('0x4e')](handleError(_0x12dda6,null));};exports[_0x1a8f('0x5d')]=function(_0x30959b,_0x31910b,_0x1221d9){if(_0x30959b[_0x1a8f('0x57')]['id']){delete _0x30959b['body']['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x30959b[_0x1a8f('0x50')]['id']}})[_0x1a8f('0x20')](handleEntityNotFound(_0x31910b,null))['then'](function(_0x2f0152){if(_0x2f0152){_0x30959b[_0x1a8f('0x57')][_0x1a8f('0x5e')]=_0x2f0152['id'];_0x30959b[_0x1a8f('0x57')][_0x1a8f('0x5f')]=integrations['getSubjects'](_0x30959b['body'][_0x1a8f('0x60')],_0x30959b['body'][_0x1a8f('0x3b')]);_0x30959b[_0x1a8f('0x57')]['Descriptions']=integrations['getDescriptions'](_0x30959b[_0x1a8f('0x57')][_0x1a8f('0x60')],_0x30959b[_0x1a8f('0x57')][_0x1a8f('0x3b')]);return db[_0x1a8f('0x5a')][_0x1a8f('0x56')](_0x30959b[_0x1a8f('0x57')],{'include':[{'model':db[_0x1a8f('0x61')],'as':_0x1a8f('0x5f')},{'model':db[_0x1a8f('0x61')],'as':_0x1a8f('0x62')}]});}return null;})['then'](respondWithResult(_0x31910b,null))[_0x1a8f('0x4e')](handleError(_0x31910b,null));};exports['getFields']=function(_0x57c2ee,_0x8fbd6e,_0x56dac0){var _0x4a2709=_0x57c2ee[_0x1a8f('0x3e')]['ticketType'];var _0x22c439=_0x4a2709===_0x1a8f('0x63')?_0x1a8f('0x64'):_0x1a8f('0x65');var _0x4fecb3='';var _0x46d8f1='';var _0x597b16='';var _0x14775d='';var _0x55ac57='';var _0x2c64f1='';var _0x527e38='';var _0x1e111e='';var _0x2ab151=[_0x1a8f('0x66'),_0x1a8f('0x67'),_0x1a8f('0x68'),'ownerid','caseorigincode',_0x1a8f('0x69'),'phonenumber','regardingobjectid',_0x1a8f('0x6a'),_0x1a8f('0x6b')];var _0x41ec0d=[_0x1a8f('0x6c'),'accountidyominame',_0x1a8f('0x6d'),'billedserviceunits',_0x1a8f('0x6e'),_0x1a8f('0x6f'),_0x1a8f('0x70'),_0x1a8f('0x71'),'createdbyexternalpartyname',_0x1a8f('0x72'),'createdbyname',_0x1a8f('0x73'),_0x1a8f('0x74'),_0x1a8f('0x75'),_0x1a8f('0x76'),_0x1a8f('0x77'),_0x1a8f('0x78'),_0x1a8f('0x79'),'emailaddress',_0x1a8f('0x7a'),_0x1a8f('0x7b'),_0x1a8f('0x7c'),_0x1a8f('0x7d'),_0x1a8f('0x7e'),_0x1a8f('0x7f'),_0x1a8f('0x80'),_0x1a8f('0x81'),'influencescore',_0x1a8f('0x82'),_0x1a8f('0x83'),_0x1a8f('0x84'),_0x1a8f('0x85'),_0x1a8f('0x86'),_0x1a8f('0x87'),'modifiedbyyominame',_0x1a8f('0x88'),_0x1a8f('0x89'),'modifiedonbehalfbyyominame',_0x1a8f('0x8a'),'msdyn_iotalertname',_0x1a8f('0x8b'),_0x1a8f('0x8c'),_0x1a8f('0x8d'),'owneridname',_0x1a8f('0x8e'),_0x1a8f('0x8f'),'parentcaseidname','primarycontactidname',_0x1a8f('0x90'),_0x1a8f('0x91'),_0x1a8f('0x92'),'productserialnumber','resolveby',_0x1a8f('0x93'),_0x1a8f('0x94'),_0x1a8f('0x95'),_0x1a8f('0x96'),'sentimentvalue',_0x1a8f('0x97'),_0x1a8f('0x98'),_0x1a8f('0x99'),_0x1a8f('0x9a'),'statuscode',_0x1a8f('0x9b'),_0x1a8f('0x9c'),'timezoneruleversionnumber',_0x1a8f('0x9d'),_0x1a8f('0x9e'),_0x1a8f('0x9f'),_0x1a8f('0xa0')];var _0x188bb2=_0x2ab151['concat'](_0x41ec0d);return db['Dynamics365Account'][_0x1a8f('0x59')]({'where':{'id':_0x57c2ee[_0x1a8f('0x50')]['id']},'attributes':['id',_0x1a8f('0xa1'),_0x1a8f('0xa2'),_0x1a8f('0xa3'),_0x1a8f('0xa4'),_0x1a8f('0xa5'),_0x1a8f('0xa6')]})[_0x1a8f('0x20')](handleEntityNotFound(_0x8fbd6e,null))[_0x1a8f('0x20')](function(_0x4fb544){if(_0x4fb544){_0x1e111e=_0x4fb544[_0x1a8f('0xa3')];var _0x3a99bd=_0x1e111e[_0x1a8f('0xa7')](-0x1);if(_0x3a99bd==='/'){_0x1e111e=_0x1e111e['substring'](0x0,_0x1e111e['lastIndexOf'](_0x3a99bd));}_0x527e38=util[_0x1a8f('0xa8')](_0x1a8f('0xa9'),_0x1e111e);var _0x369049={'method':_0x1a8f('0xaa'),'uri':_0x1a8f('0xab')+_0x4fb544[_0x1a8f('0xa4')]+_0x1a8f('0xac'),'form':{'client_id':_0x4fb544[_0x1a8f('0xa5')],'resource':_0x1e111e,'username':_0x4fb544[_0x1a8f('0xa1')],'password':_0x4fb544[_0x1a8f('0xa2')],'grant_type':_0x1a8f('0xa2'),'client_secret':_0x4fb544[_0x1a8f('0xa6')]},'json':!![]};return rp(_0x369049);}})['then'](function(_0x38e732){_0x2c64f1=_0x38e732[_0x1a8f('0xad')];var _0x5c1706={'method':_0x1a8f('0xae'),'uri':encodeURI(_0x527e38+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x22c439+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2c64f1,'If-None-Match':null,'OData-Version':_0x1a8f('0xaf')},'json':!![]};return rp(_0x5c1706);})[_0x1a8f('0x20')](function(_0x1e44a9){var _0x52adea=_0x1e44a9[_0x1a8f('0xb0')][0x0];var _0x4f37e2=_0x52adea[_0x1a8f('0xb1')];var _0x124fa2={'method':_0x1a8f('0xae'),'uri':_0x527e38+_0x1a8f('0xb2')+_0x4f37e2+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x1a8f('0xb3')+_0x2c64f1,'If-None-Match':null,'OData-Version':_0x1a8f('0xaf')},'json':!![]};return rp(_0x124fa2);})['then'](function(_0x1c12d9){_0x4fecb3=_0x1c12d9;_0x46d8f1=_0x4fecb3[_0x1a8f('0xb4')];_0x46d8f1=_[_0x1a8f('0xb5')](_0x46d8f1,function(_0x2e95b9){return!_0x188bb2[_0x1a8f('0xb6')](_0x2e95b9[_0x1a8f('0xb7')]);});var _0x15f507=[];var _0x2fd52a=[];_0x46d8f1['forEach'](function(_0x7bb114){if(_0x7bb114[_0x1a8f('0xb8')]){var _0x33dc44=_0x7bb114['@odata.type'][_0x1a8f('0xb9')](_0x7bb114[_0x1a8f('0xb8')][_0x1a8f('0xba')]('.')+0x1);if(_0x33dc44===_0x1a8f('0xbb')){_0x15f507['push'](getSelectList(_0x527e38,_0x4a2709,_0x2fd52a,_0x4fecb3[_0x1a8f('0xb1')],_0x7bb114[_0x1a8f('0xb1')],_0x2c64f1));}}});return Promise[_0x1a8f('0xbc')](_0x15f507);})[_0x1a8f('0x20')](function(_0x3de134){_0x597b16=_0x3de134[0x0];var _0x2d6563=[];var _0x36d628=[];_0x46d8f1[_0x1a8f('0xbd')](function(_0x42d848){if(!_[_0x1a8f('0xbe')](_0x42d848[_0x1a8f('0xb8')])){var _0x3f63f5=_0x42d848[_0x1a8f('0xb8')][_0x1a8f('0xb9')](_0x42d848['@odata.type']['lastIndexOf']('.')+0x1);if(_0x3f63f5===_0x1a8f('0xbf')){_0x2d6563[_0x1a8f('0xc0')](getBooleanList(_0x527e38,_0x4a2709,_0x36d628,_0x4fecb3[_0x1a8f('0xb1')],_0x42d848[_0x1a8f('0xb1')],_0x2c64f1));}}});return Promise[_0x1a8f('0xbc')](_0x2d6563);})[_0x1a8f('0x20')](function(_0x10bce8){_0x14775d=_0x10bce8[0x0];var _0x25fa8e=[];var _0x25c333=[];_0x46d8f1['forEach'](function(_0x151e75){if(_0x151e75[_0x1a8f('0xb8')]){var _0xff3b3f=_0x151e75['@odata.type'][_0x1a8f('0xb9')](_0x151e75['@odata.type'][_0x1a8f('0xba')]('.')+0x1);if(_0xff3b3f===_0x1a8f('0xc1')||_0xff3b3f===_0x1a8f('0xc2')||_0xff3b3f===_0x1a8f('0xc3')||_0xff3b3f===_0x1a8f('0xc4')||_0xff3b3f===_0x1a8f('0xc5')||_0xff3b3f===_0x1a8f('0xc6')||_0xff3b3f===_0x1a8f('0xc7')||_0xff3b3f===_0x1a8f('0xc8')||_0xff3b3f===_0x1a8f('0xc9')||_0xff3b3f==='DecimalAttributeMetadata'){_0x25fa8e[_0x1a8f('0xc0')](getInputList(_0x527e38,_0x4a2709,_0xff3b3f,_0x25c333,_0x4fecb3['MetadataId'],_0x151e75['MetadataId'],_0x2c64f1));}}});return Promise[_0x1a8f('0xbc')](_0x25fa8e);})[_0x1a8f('0x20')](function(_0x3b188d){_0x55ac57=_0x3b188d[0x0];var _0x4fb4b5=_0x597b16[_0x1a8f('0xca')](_0x14775d)[_0x1a8f('0xca')](_0x55ac57);var _0x49cd9a={'count':_0x4fb4b5['length'],'rows':_0x4fb4b5};return _0x49cd9a;})[_0x1a8f('0x20')](respondWithResult(_0x8fbd6e,null))['catch'](function(_0x381b5f){var _0x3a1d53=_0x57c2ee[_0x1a8f('0x3e')][_0x1a8f('0x1b')]?0x1f4:_0x381b5f[_0x1a8f('0xcb')]||0x1f4;logger['error'](_0x381b5f[_0x1a8f('0x36')]);delete _0x381b5f['name'];if(_0x3a1d53===0x191){_0x3a1d53=0x190;}_0x8fbd6e[_0x1a8f('0x2b')](_0x3a1d53)[_0x1a8f('0xcc')](_0x57c2ee[_0x1a8f('0x3e')][_0x1a8f('0x1b')]?{'message':_0x1a8f('0xcd'),'statusCode':_0x381b5f[_0x1a8f('0xcb')]}:_0x381b5f);});};function getSelectList(_0x2443a2,_0x41c3f9,_0x27da20,_0x39b1f0,_0x2073db,_0x49cba4){var _0x545af3={'method':_0x1a8f('0xae'),'uri':_0x2443a2+_0x1a8f('0xb2')+_0x39b1f0+_0x1a8f('0xce')+_0x2073db+_0x1a8f('0xcf')+_0x1a8f('0xd0'),'headers':{'Authorization':_0x1a8f('0xb3')+_0x49cba4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x545af3)[_0x1a8f('0x20')](function(_0x4051b5){var _0x32e6ed=[];var _0x291cbd=_0x4051b5['OptionSet'][_0x1a8f('0xd1')];_0x291cbd[_0x1a8f('0xbd')](function(_0x3dd67f){_0x32e6ed['push']({'name':_0x3dd67f[_0x1a8f('0xd2')]['UserLocalizedLabel'][_0x1a8f('0xd2')],'value':String(_0x3dd67f[_0x1a8f('0xd3')])});});var _0x43d0f2={'id':_0x41c3f9+'_'+_0x4051b5['LogicalName'],'name':_0x4051b5[_0x1a8f('0xd4')][_0x1a8f('0xd5')][_0x1a8f('0xd2')],'custom':![],'options':_0x32e6ed};_0x27da20[_0x1a8f('0xc0')](_0x43d0f2);return _0x27da20;});}function getBooleanList(_0x10aa56,_0x5807f5,_0x589034,_0x4c72ae,_0x1d5492,_0x4d8bb0){var _0x341050={'method':_0x1a8f('0xae'),'uri':_0x10aa56+'EntityDefinitions('+_0x4c72ae+_0x1a8f('0xce')+_0x1d5492+_0x1a8f('0xd6'),'headers':{'Authorization':_0x1a8f('0xb3')+_0x4d8bb0,'If-None-Match':null,'OData-Version':_0x1a8f('0xaf')},'json':!![]};return rp(_0x341050)[_0x1a8f('0x20')](function(_0x17d3c0){var _0x442c4d=[];_0x442c4d[_0x1a8f('0xc0')]({'name':_0x17d3c0[_0x1a8f('0xd7')][_0x1a8f('0xd8')][_0x1a8f('0xd2')]['UserLocalizedLabel'][_0x1a8f('0xd2')],'value':_0x1a8f('0xd9')},{'name':_0x17d3c0['OptionSet'][_0x1a8f('0xda')][_0x1a8f('0xd2')]['UserLocalizedLabel'][_0x1a8f('0xd2')],'value':'false'});var _0x31b230={'id':_0x5807f5+'_'+_0x17d3c0[_0x1a8f('0xb7')],'name':_0x17d3c0['DisplayName'][_0x1a8f('0xd5')][_0x1a8f('0xd2')],'custom':![],'options':_0x442c4d};_0x589034[_0x1a8f('0xc0')](_0x31b230);return _0x589034;});}function getInputList(_0x1f3c8a,_0x48a2f6,_0x3ca52a,_0x234816,_0x44ead1,_0x429439,_0x4a84c3){var _0x58e488={'method':_0x1a8f('0xae'),'uri':_0x1f3c8a+_0x1a8f('0xb2')+_0x44ead1+_0x1a8f('0xce')+_0x429439+_0x1a8f('0xdb')+_0x3ca52a+_0x1a8f('0xdc'),'headers':{'Authorization':_0x1a8f('0xb3')+_0x4a84c3,'If-None-Match':null,'OData-Version':_0x1a8f('0xaf')},'json':!![]};return rp(_0x58e488)['then'](function(_0x36c0ff){var _0x5844c6={'id':_0x48a2f6+'_'+_0x36c0ff[_0x1a8f('0xb7')],'name':_0x36c0ff[_0x1a8f('0xd4')]['UserLocalizedLabel']?_0x36c0ff[_0x1a8f('0xd4')]['UserLocalizedLabel'][_0x1a8f('0xd2')]:_0x36c0ff[_0x1a8f('0xb7')],'custom':![],'options':[]};_0x234816['push'](_0x5844c6);return _0x234816;});} \ No newline at end of file +var _0xa8f1=['fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','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~!@#$%^&-_=+[{]}.','request','then','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','stack','name','index','Dynamics365Account','fieldName','type','key','model','query','filters','attributes','fields','length','nolimit','limit','sort','where','filter','map','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','keys','rawAttributes','intersection','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Dynamics365Field','Descriptions','incident','Incident','PhoneCall','title','description','customerid','subject','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','primarycontactidyominame','prioritycodename','productidname','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','clientSecret','slice','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','4.0','value','MetadataId','EntityDefinitions(','Bearer\x20','Attributes','remove','includes','LogicalName','@odata.type','substring','lastIndexOf','PicklistAttributeMetadata','all','forEach','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','concat','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format'];(function(_0x74dc55,_0x438b5a){var _0x34d4e2=function(_0x4d9475){while(--_0x4d9475){_0x74dc55['push'](_0x74dc55['shift']());}};_0x34d4e2(++_0x438b5a);}(_0xa8f1,0x1b8));var _0x1a8f=function(_0x28cd8c,_0x5a0f59){_0x28cd8c=_0x28cd8c-0x0;var _0xa19b73=_0xa8f1[_0x28cd8c];return _0xa19b73;};'use strict';var pdf=require(_0x1a8f('0x0'));var emlformat=require(_0x1a8f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1a8f('0x2'));var rp=require(_0x1a8f('0x3'));var moment=require('moment');var BPromise=require(_0x1a8f('0x4'));var Mustache=require(_0x1a8f('0x5'));var util=require(_0x1a8f('0x6'));var path=require('path');var sox=require(_0x1a8f('0x7'));var csv=require('to-csv');var ejs=require(_0x1a8f('0x8'));var fs=require('fs');var _=require(_0x1a8f('0x9'));var squel=require('squel');var crypto=require(_0x1a8f('0xa'));var jsforce=require(_0x1a8f('0xb'));var deskjs=require(_0x1a8f('0xc'));var toCsv=require(_0x1a8f('0xd'));var querystring=require(_0x1a8f('0xe'));var Papa=require(_0x1a8f('0xf'));var Redis=require(_0x1a8f('0x10'));var authService=require(_0x1a8f('0x11'));var qs=require(_0x1a8f('0x12'));var as=require(_0x1a8f('0x13'));var hardwareService=require(_0x1a8f('0x14'));var logger=require('../../config/logger')(_0x1a8f('0x15'));var utils=require(_0x1a8f('0x16'));var config=require(_0x1a8f('0x17'));var db=require(_0x1a8f('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x1a8f('0x19'));var client=jayson[_0x1a8f('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x3d1416,_0x3976ac,_0x1d7509){if(_0x1d7509){var _0x485355=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x485355[_0x1a8f('0x1b')](_0x3976ac)){return _0x3d1416;}else{throw new db[(_0x1a8f('0x1c'))][(_0x1a8f('0x1d'))](_0x1a8f('0x1e'));}}else{return _0x3d1416;}}function respondWithRpcPromise(_0x37e0ac,_0x19ecae,_0x3784d9,_0xf7ae35){return new BPromise(function(_0x2164d0,_0x195efd){var _0x1835f8=_0xf7ae35||client;return _0x1835f8[_0x1a8f('0x1f')](_0x37e0ac,_0x3784d9)[_0x1a8f('0x20')](function(_0x2e5688){logger['info'](_0x1a8f('0x21'),_0x19ecae,'request\x20sent');logger[_0x1a8f('0x22')](_0x1a8f('0x23'),_0x19ecae,'request\x20sent',JSON[_0x1a8f('0x24')](_0x2e5688));if(_0x2e5688[_0x1a8f('0x25')]){if(_0x2e5688[_0x1a8f('0x25')][_0x1a8f('0x26')]===0x1f4){logger[_0x1a8f('0x25')](_0x1a8f('0x21'),_0x19ecae,_0x2e5688[_0x1a8f('0x25')][_0x1a8f('0x27')]);return _0x195efd(_0x2e5688[_0x1a8f('0x25')]['message']);}logger[_0x1a8f('0x25')]('Dynamics365Account,\x20%s,\x20%s',_0x19ecae,_0x2e5688[_0x1a8f('0x25')][_0x1a8f('0x27')]);return _0x2164d0(_0x2e5688['error'][_0x1a8f('0x27')]);}else{logger['info'](_0x1a8f('0x21'),_0x19ecae,_0x1a8f('0x28'));_0x2164d0(_0x2e5688[_0x1a8f('0x29')]['message']);}})['catch'](function(_0x51084b){logger[_0x1a8f('0x25')]('Dynamics365Account,\x20%s,\x20%s',_0x19ecae,_0x51084b);_0x195efd(_0x51084b);});});}function respondWithStatusCode(_0x17cf50,_0x1eb0b5){_0x1eb0b5=_0x1eb0b5||0xcc;return function(_0x36d4a){if(_0x36d4a){return _0x17cf50[_0x1a8f('0x2a')](_0x1eb0b5);}return _0x17cf50[_0x1a8f('0x2b')](_0x1eb0b5)[_0x1a8f('0x2c')]();};}function respondWithResult(_0x117e40,_0x587fcd){_0x587fcd=_0x587fcd||0xc8;return function(_0x19c27a){if(_0x19c27a){return _0x117e40[_0x1a8f('0x2b')](_0x587fcd)[_0x1a8f('0x2d')](_0x19c27a);}};}function respondWithFilteredResult(_0x329f2e,_0x37114f){return function(_0x10871f){if(_0x10871f){var _0x54b83c=_0x10871f[_0x1a8f('0x2e')],_0xaf1e8d=_0x37114f[_0x1a8f('0x2f')],_0x5d2bf4=_0x37114f[_0x1a8f('0x2f')]+_0x37114f['limit'],_0x26f18e;if(_0x5d2bf4>=_0x54b83c){_0x5d2bf4=_0x54b83c;_0x26f18e=0xc8;}else{_0x26f18e=0xce;}_0x329f2e[_0x1a8f('0x2b')](_0x26f18e);return _0x329f2e[_0x1a8f('0x30')](_0x1a8f('0x31'),_0xaf1e8d+'-'+_0x5d2bf4+'/'+_0x54b83c)['json'](_0x10871f);}return null;};}function patchUpdates(_0x53b460){return function(_0x15d7df){try{jsonpatch['apply'](_0x15d7df,_0x53b460,!![]);}catch(_0x39a810){return BPromise[_0x1a8f('0x32')](_0x39a810);}return _0x15d7df[_0x1a8f('0x33')]();};}function saveUpdates(_0x51b15a,_0x30f939){return function(_0x3d8acb){if(_0x3d8acb){return _0x3d8acb[_0x1a8f('0x34')](_0x51b15a)['then'](function(_0x5d8062){return _0x5d8062;});}return null;};}function removeEntity(_0x471ea5,_0x3cec46){return function(_0x1d27b9){if(_0x1d27b9){return _0x1d27b9[_0x1a8f('0x35')]()['then'](function(){_0x471ea5['status'](0xcc)[_0x1a8f('0x2c')]();});}};}function handleEntityNotFound(_0x296424,_0x5d41d1){return function(_0x4dd00d){if(!_0x4dd00d){_0x296424['sendStatus'](0x194);}return _0x4dd00d;};}function handleError(_0x36c447,_0x20d892){_0x20d892=_0x20d892||0x1f4;return function(_0xb80898){logger[_0x1a8f('0x25')](_0xb80898[_0x1a8f('0x36')]);if(_0xb80898['name']){delete _0xb80898[_0x1a8f('0x37')];}_0x36c447['status'](_0x20d892)['send'](_0xb80898);};}exports[_0x1a8f('0x38')]=function(_0x7ef1ee,_0xc3d1da){var _0x1438de={},_0x5e0166={},_0x185ed={'count':0x0,'rows':[]};var _0x456d30=_['map'](db[_0x1a8f('0x39')]['rawAttributes'],function(_0x598551){return{'name':_0x598551[_0x1a8f('0x3a')],'type':_0x598551[_0x1a8f('0x3b')][_0x1a8f('0x3c')]};});_0x5e0166[_0x1a8f('0x3d')]=_['map'](_0x456d30,_0x1a8f('0x37'));_0x5e0166[_0x1a8f('0x3e')]=_['keys'](_0x7ef1ee['query']);_0x5e0166[_0x1a8f('0x3f')]=_['intersection'](_0x5e0166[_0x1a8f('0x3d')],_0x5e0166[_0x1a8f('0x3e')]);_0x1438de[_0x1a8f('0x40')]=_['intersection'](_0x5e0166[_0x1a8f('0x3d')],qs[_0x1a8f('0x41')](_0x7ef1ee[_0x1a8f('0x3e')][_0x1a8f('0x41')]));_0x1438de[_0x1a8f('0x40')]=_0x1438de[_0x1a8f('0x40')][_0x1a8f('0x42')]?_0x1438de[_0x1a8f('0x40')]:_0x5e0166[_0x1a8f('0x3d')];if(!_0x7ef1ee[_0x1a8f('0x3e')]['hasOwnProperty'](_0x1a8f('0x43'))){_0x1438de[_0x1a8f('0x44')]=qs[_0x1a8f('0x44')](_0x7ef1ee[_0x1a8f('0x3e')][_0x1a8f('0x44')]);_0x1438de['offset']=qs[_0x1a8f('0x2f')](_0x7ef1ee[_0x1a8f('0x3e')][_0x1a8f('0x2f')]);}_0x1438de['order']=qs[_0x1a8f('0x45')](_0x7ef1ee[_0x1a8f('0x3e')][_0x1a8f('0x45')]);_0x1438de[_0x1a8f('0x46')]=qs[_0x1a8f('0x3f')](_['pick'](_0x7ef1ee['query'],_0x5e0166[_0x1a8f('0x3f')]),_0x456d30);if(_0x7ef1ee['query'][_0x1a8f('0x47')]){_0x1438de[_0x1a8f('0x46')]=_['merge'](_0x1438de['where'],{'$or':_[_0x1a8f('0x48')](_0x456d30,function(_0x530681){if(_0x530681[_0x1a8f('0x3b')]!==_0x1a8f('0x49')){var _0xae5a7={};_0xae5a7[_0x530681['name']]={'$like':'%'+_0x7ef1ee['query'][_0x1a8f('0x47')]+'%'};return _0xae5a7;}})});}_0x1438de=_[_0x1a8f('0x4a')]({},_0x1438de,_0x7ef1ee['options']);var _0xbdbde8={'where':_0x1438de[_0x1a8f('0x46')]};return db[_0x1a8f('0x39')][_0x1a8f('0x2e')](_0xbdbde8)['then'](function(_0x29438c){_0x185ed[_0x1a8f('0x2e')]=_0x29438c;if(_0x7ef1ee[_0x1a8f('0x3e')][_0x1a8f('0x4b')]){_0x1438de[_0x1a8f('0x4c')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x1a8f('0x4d')](_0x1438de);})[_0x1a8f('0x20')](function(_0x507d8a){_0x185ed['rows']=_0x507d8a;return _0x185ed;})[_0x1a8f('0x20')](respondWithFilteredResult(_0xc3d1da,_0x1438de))[_0x1a8f('0x4e')](handleError(_0xc3d1da,null));};exports[_0x1a8f('0x4f')]=function(_0x4262bc,_0x1a55b3){var _0x8dfd83={'raw':![],'where':{'id':_0x4262bc[_0x1a8f('0x50')]['id']}},_0x195e21={};_0x195e21[_0x1a8f('0x3d')]=_[_0x1a8f('0x51')](db[_0x1a8f('0x39')][_0x1a8f('0x52')]);_0x195e21[_0x1a8f('0x3e')]=_[_0x1a8f('0x51')](_0x4262bc[_0x1a8f('0x3e')]);_0x195e21[_0x1a8f('0x3f')]=_[_0x1a8f('0x53')](_0x195e21[_0x1a8f('0x3d')],_0x195e21['query']);_0x8dfd83[_0x1a8f('0x40')]=_[_0x1a8f('0x53')](_0x195e21[_0x1a8f('0x3d')],qs['fields'](_0x4262bc[_0x1a8f('0x3e')][_0x1a8f('0x41')]));_0x8dfd83[_0x1a8f('0x40')]=_0x8dfd83[_0x1a8f('0x40')][_0x1a8f('0x42')]?_0x8dfd83[_0x1a8f('0x40')]:_0x195e21[_0x1a8f('0x3d')];if(_0x4262bc[_0x1a8f('0x3e')]['includeAll']){_0x8dfd83[_0x1a8f('0x4c')]=[{'all':!![]}];}_0x8dfd83=_[_0x1a8f('0x4a')]({},_0x8dfd83,_0x4262bc[_0x1a8f('0x54')]);return db[_0x1a8f('0x39')][_0x1a8f('0x55')](_0x8dfd83)['then'](handleEntityNotFound(_0x1a55b3,null))['then'](respondWithResult(_0x1a55b3,null))[_0x1a8f('0x4e')](handleError(_0x1a55b3,null));};exports['create']=function(_0x197b8a,_0x101f31){return db['Dynamics365Account'][_0x1a8f('0x56')](_0x197b8a[_0x1a8f('0x57')],{})[_0x1a8f('0x20')](respondWithResult(_0x101f31,0xc9))[_0x1a8f('0x4e')](handleError(_0x101f31,null));};exports['update']=function(_0x1bfda8,_0x184e7b){if(_0x1bfda8[_0x1a8f('0x57')]['id']){delete _0x1bfda8['body']['id'];}return db[_0x1a8f('0x39')][_0x1a8f('0x55')]({'where':{'id':_0x1bfda8[_0x1a8f('0x50')]['id']}})['then'](handleEntityNotFound(_0x184e7b,null))[_0x1a8f('0x20')](saveUpdates(_0x1bfda8[_0x1a8f('0x57')],null))[_0x1a8f('0x20')](respondWithResult(_0x184e7b,null))[_0x1a8f('0x4e')](handleError(_0x184e7b,null));};exports[_0x1a8f('0x35')]=function(_0x103fa6,_0x1e0df7){return db['Dynamics365Account'][_0x1a8f('0x55')]({'where':{'id':_0x103fa6[_0x1a8f('0x50')]['id']}})[_0x1a8f('0x20')](handleEntityNotFound(_0x1e0df7,null))[_0x1a8f('0x20')](removeEntity(_0x1e0df7,null))[_0x1a8f('0x4e')](handleError(_0x1e0df7,null));};exports[_0x1a8f('0x58')]=function(_0x180264,_0x12dda6,_0x58783e){var _0x1ae0e6={};var _0x4e1914={};var _0x55afdd;var _0x5e76b0;return db['Dynamics365Account'][_0x1a8f('0x59')]({'where':{'id':_0x180264[_0x1a8f('0x50')]['id']}})['then'](handleEntityNotFound(_0x12dda6,null))[_0x1a8f('0x20')](function(_0x4493b8){if(_0x4493b8){_0x55afdd=_0x4493b8;_0x4e1914[_0x1a8f('0x3d')]=_[_0x1a8f('0x51')](db[_0x1a8f('0x5a')][_0x1a8f('0x52')]);_0x4e1914[_0x1a8f('0x3e')]=_[_0x1a8f('0x51')](_0x180264['query']);_0x4e1914[_0x1a8f('0x3f')]=_['intersection'](_0x4e1914[_0x1a8f('0x3d')],_0x4e1914[_0x1a8f('0x3e')]);_0x1ae0e6[_0x1a8f('0x40')]=_[_0x1a8f('0x53')](_0x4e1914[_0x1a8f('0x3d')],qs[_0x1a8f('0x41')](_0x180264[_0x1a8f('0x3e')]['fields']));_0x1ae0e6[_0x1a8f('0x40')]=_0x1ae0e6['attributes'][_0x1a8f('0x42')]?_0x1ae0e6[_0x1a8f('0x40')]:_0x4e1914[_0x1a8f('0x3d')];_0x1ae0e6['order']=qs[_0x1a8f('0x45')](_0x180264['query']['sort']);_0x1ae0e6[_0x1a8f('0x46')]=qs[_0x1a8f('0x3f')](_[_0x1a8f('0x5b')](_0x180264[_0x1a8f('0x3e')],_0x4e1914[_0x1a8f('0x3f')]));if(_0x180264['query'][_0x1a8f('0x47')]){_0x1ae0e6['where']=_[_0x1a8f('0x4a')](_0x1ae0e6['where'],{'$or':_[_0x1a8f('0x48')](_0x1ae0e6[_0x1a8f('0x40')],function(_0x4b0579){var _0x3f7cae={};_0x3f7cae[_0x4b0579]={'$like':'%'+_0x180264[_0x1a8f('0x3e')][_0x1a8f('0x47')]+'%'};return _0x3f7cae;})});}_0x1ae0e6=_[_0x1a8f('0x4a')]({},_0x1ae0e6,_0x180264[_0x1a8f('0x54')]);return _0x55afdd[_0x1a8f('0x58')](_0x1ae0e6);}})[_0x1a8f('0x20')](function(_0x29deff){if(_0x29deff){_0x5e76b0=_0x29deff[_0x1a8f('0x42')];if(!_0x180264[_0x1a8f('0x3e')][_0x1a8f('0x5c')](_0x1a8f('0x43'))){_0x1ae0e6['limit']=qs[_0x1a8f('0x44')](_0x180264[_0x1a8f('0x3e')][_0x1a8f('0x44')]);_0x1ae0e6['offset']=qs[_0x1a8f('0x2f')](_0x180264[_0x1a8f('0x3e')][_0x1a8f('0x2f')]);}return _0x55afdd['getConfigurations'](_0x1ae0e6);}})[_0x1a8f('0x20')](function(_0x51bc39){if(_0x51bc39){return _0x51bc39?{'count':_0x5e76b0,'rows':_0x51bc39}:null;}})['then'](respondWithResult(_0x12dda6,null))[_0x1a8f('0x4e')](handleError(_0x12dda6,null));};exports[_0x1a8f('0x5d')]=function(_0x30959b,_0x31910b,_0x1221d9){if(_0x30959b[_0x1a8f('0x57')]['id']){delete _0x30959b['body']['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x30959b[_0x1a8f('0x50')]['id']}})[_0x1a8f('0x20')](handleEntityNotFound(_0x31910b,null))['then'](function(_0x2f0152){if(_0x2f0152){_0x30959b[_0x1a8f('0x57')][_0x1a8f('0x5e')]=_0x2f0152['id'];_0x30959b[_0x1a8f('0x57')][_0x1a8f('0x5f')]=integrations['getSubjects'](_0x30959b['body'][_0x1a8f('0x60')],_0x30959b['body'][_0x1a8f('0x3b')]);_0x30959b[_0x1a8f('0x57')]['Descriptions']=integrations['getDescriptions'](_0x30959b[_0x1a8f('0x57')][_0x1a8f('0x60')],_0x30959b[_0x1a8f('0x57')][_0x1a8f('0x3b')]);return db[_0x1a8f('0x5a')][_0x1a8f('0x56')](_0x30959b[_0x1a8f('0x57')],{'include':[{'model':db[_0x1a8f('0x61')],'as':_0x1a8f('0x5f')},{'model':db[_0x1a8f('0x61')],'as':_0x1a8f('0x62')}]});}return null;})['then'](respondWithResult(_0x31910b,null))[_0x1a8f('0x4e')](handleError(_0x31910b,null));};exports['getFields']=function(_0x57c2ee,_0x8fbd6e,_0x56dac0){var _0x4a2709=_0x57c2ee[_0x1a8f('0x3e')]['ticketType'];var _0x22c439=_0x4a2709===_0x1a8f('0x63')?_0x1a8f('0x64'):_0x1a8f('0x65');var _0x4fecb3='';var _0x46d8f1='';var _0x597b16='';var _0x14775d='';var _0x55ac57='';var _0x2c64f1='';var _0x527e38='';var _0x1e111e='';var _0x2ab151=[_0x1a8f('0x66'),_0x1a8f('0x67'),_0x1a8f('0x68'),'ownerid','caseorigincode',_0x1a8f('0x69'),'phonenumber','regardingobjectid',_0x1a8f('0x6a'),_0x1a8f('0x6b')];var _0x41ec0d=[_0x1a8f('0x6c'),'accountidyominame',_0x1a8f('0x6d'),'billedserviceunits',_0x1a8f('0x6e'),_0x1a8f('0x6f'),_0x1a8f('0x70'),_0x1a8f('0x71'),'createdbyexternalpartyname',_0x1a8f('0x72'),'createdbyname',_0x1a8f('0x73'),_0x1a8f('0x74'),_0x1a8f('0x75'),_0x1a8f('0x76'),_0x1a8f('0x77'),_0x1a8f('0x78'),_0x1a8f('0x79'),'emailaddress',_0x1a8f('0x7a'),_0x1a8f('0x7b'),_0x1a8f('0x7c'),_0x1a8f('0x7d'),_0x1a8f('0x7e'),_0x1a8f('0x7f'),_0x1a8f('0x80'),_0x1a8f('0x81'),'influencescore',_0x1a8f('0x82'),_0x1a8f('0x83'),_0x1a8f('0x84'),_0x1a8f('0x85'),_0x1a8f('0x86'),_0x1a8f('0x87'),'modifiedbyyominame',_0x1a8f('0x88'),_0x1a8f('0x89'),'modifiedonbehalfbyyominame',_0x1a8f('0x8a'),'msdyn_iotalertname',_0x1a8f('0x8b'),_0x1a8f('0x8c'),_0x1a8f('0x8d'),'owneridname',_0x1a8f('0x8e'),_0x1a8f('0x8f'),'parentcaseidname','primarycontactidname',_0x1a8f('0x90'),_0x1a8f('0x91'),_0x1a8f('0x92'),'productserialnumber','resolveby',_0x1a8f('0x93'),_0x1a8f('0x94'),_0x1a8f('0x95'),_0x1a8f('0x96'),'sentimentvalue',_0x1a8f('0x97'),_0x1a8f('0x98'),_0x1a8f('0x99'),_0x1a8f('0x9a'),'statuscode',_0x1a8f('0x9b'),_0x1a8f('0x9c'),'timezoneruleversionnumber',_0x1a8f('0x9d'),_0x1a8f('0x9e'),_0x1a8f('0x9f'),_0x1a8f('0xa0')];var _0x188bb2=_0x2ab151['concat'](_0x41ec0d);return db['Dynamics365Account'][_0x1a8f('0x59')]({'where':{'id':_0x57c2ee[_0x1a8f('0x50')]['id']},'attributes':['id',_0x1a8f('0xa1'),_0x1a8f('0xa2'),_0x1a8f('0xa3'),_0x1a8f('0xa4'),_0x1a8f('0xa5'),_0x1a8f('0xa6')]})[_0x1a8f('0x20')](handleEntityNotFound(_0x8fbd6e,null))[_0x1a8f('0x20')](function(_0x4fb544){if(_0x4fb544){_0x1e111e=_0x4fb544[_0x1a8f('0xa3')];var _0x3a99bd=_0x1e111e[_0x1a8f('0xa7')](-0x1);if(_0x3a99bd==='/'){_0x1e111e=_0x1e111e['substring'](0x0,_0x1e111e['lastIndexOf'](_0x3a99bd));}_0x527e38=util[_0x1a8f('0xa8')](_0x1a8f('0xa9'),_0x1e111e);var _0x369049={'method':_0x1a8f('0xaa'),'uri':_0x1a8f('0xab')+_0x4fb544[_0x1a8f('0xa4')]+_0x1a8f('0xac'),'form':{'client_id':_0x4fb544[_0x1a8f('0xa5')],'resource':_0x1e111e,'username':_0x4fb544[_0x1a8f('0xa1')],'password':_0x4fb544[_0x1a8f('0xa2')],'grant_type':_0x1a8f('0xa2'),'client_secret':_0x4fb544[_0x1a8f('0xa6')]},'json':!![]};return rp(_0x369049);}})['then'](function(_0x38e732){_0x2c64f1=_0x38e732[_0x1a8f('0xad')];var _0x5c1706={'method':_0x1a8f('0xae'),'uri':encodeURI(_0x527e38+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x22c439+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2c64f1,'If-None-Match':null,'OData-Version':_0x1a8f('0xaf')},'json':!![]};return rp(_0x5c1706);})[_0x1a8f('0x20')](function(_0x1e44a9){var _0x52adea=_0x1e44a9[_0x1a8f('0xb0')][0x0];var _0x4f37e2=_0x52adea[_0x1a8f('0xb1')];var _0x124fa2={'method':_0x1a8f('0xae'),'uri':_0x527e38+_0x1a8f('0xb2')+_0x4f37e2+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x1a8f('0xb3')+_0x2c64f1,'If-None-Match':null,'OData-Version':_0x1a8f('0xaf')},'json':!![]};return rp(_0x124fa2);})['then'](function(_0x1c12d9){_0x4fecb3=_0x1c12d9;_0x46d8f1=_0x4fecb3[_0x1a8f('0xb4')];_0x46d8f1=_[_0x1a8f('0xb5')](_0x46d8f1,function(_0x2e95b9){return!_0x188bb2[_0x1a8f('0xb6')](_0x2e95b9[_0x1a8f('0xb7')]);});var _0x15f507=[];var _0x2fd52a=[];_0x46d8f1['forEach'](function(_0x7bb114){if(_0x7bb114[_0x1a8f('0xb8')]){var _0x33dc44=_0x7bb114['@odata.type'][_0x1a8f('0xb9')](_0x7bb114[_0x1a8f('0xb8')][_0x1a8f('0xba')]('.')+0x1);if(_0x33dc44===_0x1a8f('0xbb')){_0x15f507['push'](getSelectList(_0x527e38,_0x4a2709,_0x2fd52a,_0x4fecb3[_0x1a8f('0xb1')],_0x7bb114[_0x1a8f('0xb1')],_0x2c64f1));}}});return Promise[_0x1a8f('0xbc')](_0x15f507);})[_0x1a8f('0x20')](function(_0x3de134){_0x597b16=_0x3de134[0x0];var _0x2d6563=[];var _0x36d628=[];_0x46d8f1[_0x1a8f('0xbd')](function(_0x42d848){if(!_[_0x1a8f('0xbe')](_0x42d848[_0x1a8f('0xb8')])){var _0x3f63f5=_0x42d848[_0x1a8f('0xb8')][_0x1a8f('0xb9')](_0x42d848['@odata.type']['lastIndexOf']('.')+0x1);if(_0x3f63f5===_0x1a8f('0xbf')){_0x2d6563[_0x1a8f('0xc0')](getBooleanList(_0x527e38,_0x4a2709,_0x36d628,_0x4fecb3[_0x1a8f('0xb1')],_0x42d848[_0x1a8f('0xb1')],_0x2c64f1));}}});return Promise[_0x1a8f('0xbc')](_0x2d6563);})[_0x1a8f('0x20')](function(_0x10bce8){_0x14775d=_0x10bce8[0x0];var _0x25fa8e=[];var _0x25c333=[];_0x46d8f1['forEach'](function(_0x151e75){if(_0x151e75[_0x1a8f('0xb8')]){var _0xff3b3f=_0x151e75['@odata.type'][_0x1a8f('0xb9')](_0x151e75['@odata.type'][_0x1a8f('0xba')]('.')+0x1);if(_0xff3b3f===_0x1a8f('0xc1')||_0xff3b3f===_0x1a8f('0xc2')||_0xff3b3f===_0x1a8f('0xc3')||_0xff3b3f===_0x1a8f('0xc4')||_0xff3b3f===_0x1a8f('0xc5')||_0xff3b3f===_0x1a8f('0xc6')||_0xff3b3f===_0x1a8f('0xc7')||_0xff3b3f===_0x1a8f('0xc8')||_0xff3b3f===_0x1a8f('0xc9')||_0xff3b3f==='DecimalAttributeMetadata'){_0x25fa8e[_0x1a8f('0xc0')](getInputList(_0x527e38,_0x4a2709,_0xff3b3f,_0x25c333,_0x4fecb3['MetadataId'],_0x151e75['MetadataId'],_0x2c64f1));}}});return Promise[_0x1a8f('0xbc')](_0x25fa8e);})[_0x1a8f('0x20')](function(_0x3b188d){_0x55ac57=_0x3b188d[0x0];var _0x4fb4b5=_0x597b16[_0x1a8f('0xca')](_0x14775d)[_0x1a8f('0xca')](_0x55ac57);var _0x49cd9a={'count':_0x4fb4b5['length'],'rows':_0x4fb4b5};return _0x49cd9a;})[_0x1a8f('0x20')](respondWithResult(_0x8fbd6e,null))['catch'](function(_0x381b5f){var _0x3a1d53=_0x57c2ee[_0x1a8f('0x3e')][_0x1a8f('0x1b')]?0x1f4:_0x381b5f[_0x1a8f('0xcb')]||0x1f4;logger['error'](_0x381b5f[_0x1a8f('0x36')]);delete _0x381b5f['name'];if(_0x3a1d53===0x191){_0x3a1d53=0x190;}_0x8fbd6e[_0x1a8f('0x2b')](_0x3a1d53)[_0x1a8f('0xcc')](_0x57c2ee[_0x1a8f('0x3e')][_0x1a8f('0x1b')]?{'message':_0x1a8f('0xcd'),'statusCode':_0x381b5f[_0x1a8f('0xcb')]}:_0x381b5f);});};function getSelectList(_0x2443a2,_0x41c3f9,_0x27da20,_0x39b1f0,_0x2073db,_0x49cba4){var _0x545af3={'method':_0x1a8f('0xae'),'uri':_0x2443a2+_0x1a8f('0xb2')+_0x39b1f0+_0x1a8f('0xce')+_0x2073db+_0x1a8f('0xcf')+_0x1a8f('0xd0'),'headers':{'Authorization':_0x1a8f('0xb3')+_0x49cba4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x545af3)[_0x1a8f('0x20')](function(_0x4051b5){var _0x32e6ed=[];var _0x291cbd=_0x4051b5['OptionSet'][_0x1a8f('0xd1')];_0x291cbd[_0x1a8f('0xbd')](function(_0x3dd67f){_0x32e6ed['push']({'name':_0x3dd67f[_0x1a8f('0xd2')]['UserLocalizedLabel'][_0x1a8f('0xd2')],'value':String(_0x3dd67f[_0x1a8f('0xd3')])});});var _0x43d0f2={'id':_0x41c3f9+'_'+_0x4051b5['LogicalName'],'name':_0x4051b5[_0x1a8f('0xd4')][_0x1a8f('0xd5')][_0x1a8f('0xd2')],'custom':![],'options':_0x32e6ed};_0x27da20[_0x1a8f('0xc0')](_0x43d0f2);return _0x27da20;});}function getBooleanList(_0x10aa56,_0x5807f5,_0x589034,_0x4c72ae,_0x1d5492,_0x4d8bb0){var _0x341050={'method':_0x1a8f('0xae'),'uri':_0x10aa56+'EntityDefinitions('+_0x4c72ae+_0x1a8f('0xce')+_0x1d5492+_0x1a8f('0xd6'),'headers':{'Authorization':_0x1a8f('0xb3')+_0x4d8bb0,'If-None-Match':null,'OData-Version':_0x1a8f('0xaf')},'json':!![]};return rp(_0x341050)[_0x1a8f('0x20')](function(_0x17d3c0){var _0x442c4d=[];_0x442c4d[_0x1a8f('0xc0')]({'name':_0x17d3c0[_0x1a8f('0xd7')][_0x1a8f('0xd8')][_0x1a8f('0xd2')]['UserLocalizedLabel'][_0x1a8f('0xd2')],'value':_0x1a8f('0xd9')},{'name':_0x17d3c0['OptionSet'][_0x1a8f('0xda')][_0x1a8f('0xd2')]['UserLocalizedLabel'][_0x1a8f('0xd2')],'value':'false'});var _0x31b230={'id':_0x5807f5+'_'+_0x17d3c0[_0x1a8f('0xb7')],'name':_0x17d3c0['DisplayName'][_0x1a8f('0xd5')][_0x1a8f('0xd2')],'custom':![],'options':_0x442c4d};_0x589034[_0x1a8f('0xc0')](_0x31b230);return _0x589034;});}function getInputList(_0x1f3c8a,_0x48a2f6,_0x3ca52a,_0x234816,_0x44ead1,_0x429439,_0x4a84c3){var _0x58e488={'method':_0x1a8f('0xae'),'uri':_0x1f3c8a+_0x1a8f('0xb2')+_0x44ead1+_0x1a8f('0xce')+_0x429439+_0x1a8f('0xdb')+_0x3ca52a+_0x1a8f('0xdc'),'headers':{'Authorization':_0x1a8f('0xb3')+_0x4a84c3,'If-None-Match':null,'OData-Version':_0x1a8f('0xaf')},'json':!![]};return rp(_0x58e488)['then'](function(_0x36c0ff){var _0x5844c6={'id':_0x48a2f6+'_'+_0x36c0ff[_0x1a8f('0xb7')],'name':_0x36c0ff[_0x1a8f('0xd4')]['UserLocalizedLabel']?_0x36c0ff[_0x1a8f('0xd4')]['UserLocalizedLabel'][_0x1a8f('0xd2')]:_0x36c0ff[_0x1a8f('0xb7')],'custom':![],'options':[]};_0x234816['push'](_0x5844c6);return _0x234816;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 913d00f..5557b8d 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 _0xe1cc=['../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1be3a7,_0x4f94ab){var _0x49697a=function(_0x4c2a7a){while(--_0x4c2a7a){_0x1be3a7['push'](_0x1be3a7['shift']());}};_0x49697a(++_0x4f94ab);}(_0xe1cc,0x16e));var _0xce1c=function(_0x1dbbe1,_0x5ab7d4){_0x1dbbe1=_0x1dbbe1-0x0;var _0x1663a0=_0xe1cc[_0x1dbbe1];return _0x1663a0;};'use strict';var _=require(_0xce1c('0x0'));var util=require(_0xce1c('0x1'));var logger=require(_0xce1c('0x2'))(_0xce1c('0x3'));var moment=require('moment');var BPromise=require(_0xce1c('0x4'));var rp=require(_0xce1c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xce1c('0x6'));var attributes=require(_0xce1c('0x7'));var integrations=require(_0xce1c('0x8'));module[_0xce1c('0x9')]=function(_0xa342a5,_0x500c0e){return _0xa342a5[_0xce1c('0xa')](_0xce1c('0xb'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32a0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','int_dynamics365_accounts','lodash','util'];(function(_0x481113,_0x5b008f){var _0x4910f2=function(_0x4d5ce2){while(--_0x4d5ce2){_0x481113['push'](_0x481113['shift']());}};_0x4910f2(++_0x5b008f);}(_0x32a0,0x19e));var _0x032a=function(_0x5da54c,_0x520452){_0x5da54c=_0x5da54c-0x0;var _0x1246b0=_0x32a0[_0x5da54c];return _0x1246b0;};'use strict';var _=require(_0x032a('0x0'));var util=require(_0x032a('0x1'));var logger=require(_0x032a('0x2'))(_0x032a('0x3'));var moment=require(_0x032a('0x4'));var BPromise=require(_0x032a('0x5'));var rp=require(_0x032a('0x6'));var fs=require('fs');var path=require(_0x032a('0x7'));var rimraf=require(_0x032a('0x8'));var config=require('../../config/environment');var attributes=require(_0x032a('0x9'));var integrations=require(_0x032a('0xa'));module[_0x032a('0xb')]=function(_0x2a1356,_0x4563b4){return _0x2a1356['define']('Dynamics365Account',attributes,{'tableName':_0x032a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index bcb1555..f0adc0d 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 _0xe978=['find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','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','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','map','model','attributes','info','catch','ShowDynamics365Account'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0xe978,0x70));var _0x8e97=function(_0x4906d6,_0x1607fb){_0x4906d6=_0x4906d6-0x0;var _0x20ad81=_0xe978[_0x4906d6];return _0x20ad81;};'use strict';var _=require(_0x8e97('0x0'));var util=require(_0x8e97('0x1'));var moment=require(_0x8e97('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e97('0x3'));var db=require(_0x8e97('0x4'))['db'];var utils=require(_0x8e97('0x5'));var logger=require(_0x8e97('0x6'))(_0x8e97('0x7'));var config=require('../../config/environment');var jayson=require(_0x8e97('0x8'));var client=jayson[_0x8e97('0x9')][_0x8e97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xef1516,_0x2302ff,_0x539b76){return new BPromise(function(_0x641dc2,_0x5d727e){return client[_0x8e97('0xb')](_0xef1516,_0x539b76)[_0x8e97('0xc')](function(_0x2e17a1){logger['info'](_0x8e97('0xd'),_0x2302ff,_0x8e97('0xe'));logger[_0x8e97('0xf')](_0x8e97('0x10'),_0x2302ff,_0x8e97('0xe'),JSON[_0x8e97('0x11')](_0x2e17a1));if(_0x2e17a1[_0x8e97('0x12')]){if(_0x2e17a1[_0x8e97('0x12')][_0x8e97('0x13')]===0x1f4){logger[_0x8e97('0x12')](_0x8e97('0xd'),_0x2302ff,_0x2e17a1['error'][_0x8e97('0x14')]);return _0x5d727e(_0x2e17a1[_0x8e97('0x12')][_0x8e97('0x14')]);}logger[_0x8e97('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x2302ff,_0x2e17a1['error']['message']);return _0x641dc2(_0x2e17a1['error']['message']);}else{logger['info'](_0x8e97('0xd'),_0x2302ff,'request\x20sent');_0x641dc2(_0x2e17a1[_0x8e97('0x15')][_0x8e97('0x14')]);}})['catch'](function(_0x4efaa3){logger[_0x8e97('0x12')](_0x8e97('0xd'),_0x2302ff,_0x4efaa3);_0x5d727e(_0x4efaa3);});});}exports[_0x8e97('0x16')]=function(_0x2f475c){var _0x2155ab=this;return new Promise(function(_0x2b823e,_0x1d0436){return db[_0x8e97('0x17')][_0x8e97('0x18')]({'raw':_0x2f475c['options']?_0x2f475c[_0x8e97('0x19')][_0x8e97('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f475c[_0x8e97('0x19')]?_0x2f475c[_0x8e97('0x19')][_0x8e97('0x1b')]||null:null,'attributes':_0x2f475c[_0x8e97('0x19')]?_0x2f475c[_0x8e97('0x19')]['attributes']||null:null,'limit':_0x2f475c[_0x8e97('0x19')]?_0x2f475c[_0x8e97('0x19')][_0x8e97('0x1c')]||null:null,'include':_0x2f475c[_0x8e97('0x19')]?_0x2f475c[_0x8e97('0x19')][_0x8e97('0x1d')]?_[_0x8e97('0x1e')](_0x2f475c[_0x8e97('0x19')][_0x8e97('0x1d')],function(_0x5dde33){return{'model':db[_0x5dde33['model']],'as':_0x5dde33['as'],'attributes':_0x5dde33['attributes'],'include':_0x5dde33['include']?_[_0x8e97('0x1e')](_0x5dde33[_0x8e97('0x1d')],function(_0x2be986){return{'model':db[_0x2be986[_0x8e97('0x1f')]],'as':_0x2be986['as'],'attributes':_0x2be986[_0x8e97('0x20')],'include':_0x2be986[_0x8e97('0x1d')]?_[_0x8e97('0x1e')](_0x2be986[_0x8e97('0x1d')],function(_0x5cc6fc){return{'model':db[_0x5cc6fc[_0x8e97('0x1f')]],'as':_0x5cc6fc['as'],'attributes':_0x5cc6fc[_0x8e97('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8e97('0xc')](function(_0x5bb338){logger[_0x8e97('0x21')]('GetDynamics365Account',_0x2f475c);logger[_0x8e97('0xf')](_0x8e97('0x16'),_0x2f475c,JSON[_0x8e97('0x11')](_0x5bb338));_0x2b823e(_0x5bb338);})[_0x8e97('0x22')](function(_0xb1ce05){logger[_0x8e97('0x12')](_0x8e97('0x16'),_0xb1ce05['message'],_0x2f475c);_0x1d0436(_0x2155ab['error'](0x1f4,_0xb1ce05[_0x8e97('0x14')]));});});};exports[_0x8e97('0x23')]=function(_0x19d800){var _0x3f24d0=this;return new Promise(function(_0x5818b0,_0x5a63ce){return db[_0x8e97('0x17')][_0x8e97('0x24')]({'raw':_0x19d800[_0x8e97('0x19')]?_0x19d800[_0x8e97('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x19d800[_0x8e97('0x19')]?_0x19d800[_0x8e97('0x19')][_0x8e97('0x1b')]||null:null,'attributes':_0x19d800[_0x8e97('0x19')]?_0x19d800[_0x8e97('0x19')]['attributes']||null:null,'include':_0x19d800[_0x8e97('0x19')]?_0x19d800['options'][_0x8e97('0x1d')]?_[_0x8e97('0x1e')](_0x19d800[_0x8e97('0x19')][_0x8e97('0x1d')],function(_0x2c6c72){return{'model':db[_0x2c6c72['model']],'as':_0x2c6c72['as'],'attributes':_0x2c6c72[_0x8e97('0x20')],'include':_0x2c6c72[_0x8e97('0x1d')]?_['map'](_0x2c6c72['include'],function(_0x30a009){return{'model':db[_0x30a009[_0x8e97('0x1f')]],'as':_0x30a009['as'],'attributes':_0x30a009[_0x8e97('0x20')],'include':_0x30a009['include']?_[_0x8e97('0x1e')](_0x30a009[_0x8e97('0x1d')],function(_0x3c9d97){return{'model':db[_0x3c9d97[_0x8e97('0x1f')]],'as':_0x3c9d97['as'],'attributes':_0x3c9d97[_0x8e97('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x197b29){logger['info'](_0x8e97('0x23'),_0x19d800);logger[_0x8e97('0xf')](_0x8e97('0x23'),_0x19d800,JSON['stringify'](_0x197b29));_0x5818b0(_0x197b29);})['catch'](function(_0x3b8fae){logger[_0x8e97('0x12')](_0x8e97('0x23'),_0x3b8fae['message'],_0x19d800);_0x5a63ce(_0x3f24d0['error'](0x1f4,_0x3b8fae[_0x8e97('0x14')]));});});}; \ No newline at end of file +var _0xf3fe=['stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','GetDynamics365Account','findAll','options','attributes','include','map','model','debug','ShowDynamics365Account','Dynamics365Account','find','raw','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0x53cb44,_0xa8eb4a){var _0x3ffab5=function(_0x328103){while(--_0x328103){_0x53cb44['push'](_0x53cb44['shift']());}};_0x3ffab5(++_0xa8eb4a);}(_0xf3fe,0x1cd));var _0xef3f=function(_0x2f922f,_0x34a14f){_0x2f922f=_0x2f922f-0x0;var _0x4a63d4=_0xf3fe[_0x2f922f];return _0x4a63d4;};'use strict';var _=require('lodash');var util=require(_0xef3f('0x0'));var moment=require(_0xef3f('0x1'));var BPromise=require(_0xef3f('0x2'));var rs=require(_0xef3f('0x3'));var fs=require('fs');var Redis=require(_0xef3f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xef3f('0x5'));var logger=require(_0xef3f('0x6'))(_0xef3f('0x7'));var config=require(_0xef3f('0x8'));var jayson=require(_0xef3f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9e20c7,_0x2f5a64,_0x211a6c){return new BPromise(function(_0x262ea3,_0x2e9ce4){return client[_0xef3f('0xa')](_0x9e20c7,_0x211a6c)[_0xef3f('0xb')](function(_0x3f2363){logger[_0xef3f('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x2f5a64,_0xef3f('0xd'));logger['debug'](_0xef3f('0xe'),_0x2f5a64,_0xef3f('0xd'),JSON[_0xef3f('0xf')](_0x3f2363));if(_0x3f2363[_0xef3f('0x10')]){if(_0x3f2363['error'][_0xef3f('0x11')]===0x1f4){logger[_0xef3f('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x2f5a64,_0x3f2363[_0xef3f('0x10')]['message']);return _0x2e9ce4(_0x3f2363[_0xef3f('0x10')]['message']);}logger[_0xef3f('0x10')](_0xef3f('0x12'),_0x2f5a64,_0x3f2363[_0xef3f('0x10')][_0xef3f('0x13')]);return _0x262ea3(_0x3f2363[_0xef3f('0x10')][_0xef3f('0x13')]);}else{logger[_0xef3f('0xc')](_0xef3f('0x12'),_0x2f5a64,_0xef3f('0xd'));_0x262ea3(_0x3f2363[_0xef3f('0x14')][_0xef3f('0x13')]);}})['catch'](function(_0x39d905){logger[_0xef3f('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x2f5a64,_0x39d905);_0x2e9ce4(_0x39d905);});});}exports[_0xef3f('0x15')]=function(_0x1d6e89){var _0x5e47d5=this;return new Promise(function(_0x4b97cf,_0x4b1aab){return db['Dynamics365Account'][_0xef3f('0x16')]({'raw':_0x1d6e89[_0xef3f('0x17')]?_0x1d6e89['options']['raw']===undefined?!![]:![]:!![],'where':_0x1d6e89['options']?_0x1d6e89[_0xef3f('0x17')]['where']||null:null,'attributes':_0x1d6e89[_0xef3f('0x17')]?_0x1d6e89[_0xef3f('0x17')][_0xef3f('0x18')]||null:null,'limit':_0x1d6e89[_0xef3f('0x17')]?_0x1d6e89['options']['limit']||null:null,'include':_0x1d6e89[_0xef3f('0x17')]?_0x1d6e89[_0xef3f('0x17')][_0xef3f('0x19')]?_[_0xef3f('0x1a')](_0x1d6e89[_0xef3f('0x17')]['include'],function(_0x157b36){return{'model':db[_0x157b36[_0xef3f('0x1b')]],'as':_0x157b36['as'],'attributes':_0x157b36[_0xef3f('0x18')],'include':_0x157b36[_0xef3f('0x19')]?_['map'](_0x157b36[_0xef3f('0x19')],function(_0x274fc9){return{'model':db[_0x274fc9['model']],'as':_0x274fc9['as'],'attributes':_0x274fc9[_0xef3f('0x18')],'include':_0x274fc9['include']?_[_0xef3f('0x1a')](_0x274fc9['include'],function(_0x5d1024){return{'model':db[_0x5d1024['model']],'as':_0x5d1024['as'],'attributes':_0x5d1024[_0xef3f('0x18')]};}):[]};}):[]};}):[]:[]})[_0xef3f('0xb')](function(_0x3f790d){logger[_0xef3f('0xc')](_0xef3f('0x15'),_0x1d6e89);logger[_0xef3f('0x1c')]('GetDynamics365Account',_0x1d6e89,JSON['stringify'](_0x3f790d));_0x4b97cf(_0x3f790d);})['catch'](function(_0x23fd64){logger[_0xef3f('0x10')](_0xef3f('0x15'),_0x23fd64['message'],_0x1d6e89);_0x4b1aab(_0x5e47d5[_0xef3f('0x10')](0x1f4,_0x23fd64[_0xef3f('0x13')]));});});};exports[_0xef3f('0x1d')]=function(_0x4fd250){var _0x545151=this;return new Promise(function(_0x1fe5ce,_0x19704f){return db[_0xef3f('0x1e')][_0xef3f('0x1f')]({'raw':_0x4fd250['options']?_0x4fd250[_0xef3f('0x17')][_0xef3f('0x20')]===undefined?!![]:![]:!![],'where':_0x4fd250[_0xef3f('0x17')]?_0x4fd250[_0xef3f('0x17')]['where']||null:null,'attributes':_0x4fd250[_0xef3f('0x17')]?_0x4fd250[_0xef3f('0x17')][_0xef3f('0x18')]||null:null,'include':_0x4fd250['options']?_0x4fd250[_0xef3f('0x17')][_0xef3f('0x19')]?_[_0xef3f('0x1a')](_0x4fd250[_0xef3f('0x17')][_0xef3f('0x19')],function(_0xb2745e){return{'model':db[_0xb2745e['model']],'as':_0xb2745e['as'],'attributes':_0xb2745e[_0xef3f('0x18')],'include':_0xb2745e['include']?_[_0xef3f('0x1a')](_0xb2745e['include'],function(_0x29fa23){return{'model':db[_0x29fa23['model']],'as':_0x29fa23['as'],'attributes':_0x29fa23['attributes'],'include':_0x29fa23['include']?_[_0xef3f('0x1a')](_0x29fa23[_0xef3f('0x19')],function(_0x1b7e97){return{'model':db[_0x1b7e97[_0xef3f('0x1b')]],'as':_0x1b7e97['as'],'attributes':_0x1b7e97[_0xef3f('0x18')]};}):[]};}):[]};}):[]:[]})[_0xef3f('0xb')](function(_0x325adc){logger[_0xef3f('0xc')]('ShowDynamics365Account',_0x4fd250);logger[_0xef3f('0x1c')](_0xef3f('0x1d'),_0x4fd250,JSON[_0xef3f('0xf')](_0x325adc));_0x1fe5ce(_0x325adc);})[_0xef3f('0x21')](function(_0x1cbf5b){logger[_0xef3f('0x10')](_0xef3f('0x1d'),_0x1cbf5b[_0xef3f('0x13')],_0x4fd250);_0x19704f(_0x545151[_0xef3f('0x10')](0x1f4,_0x1cbf5b[_0xef3f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 9dde6a4..cce3ef8 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 _0x7249=['../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','exports','util','path','express','Router'];(function(_0x285f9b,_0xfcae6c){var _0x32dd58=function(_0x392920){while(--_0x392920){_0x285f9b['push'](_0x285f9b['shift']());}};_0x32dd58(++_0xfcae6c);}(_0x7249,0x1c4));var _0x9724=function(_0x5b3bc0,_0x5ce0d3){_0x5b3bc0=_0x5b3bc0-0x0;var _0xec3c4b=_0x7249[_0x5b3bc0];return _0xec3c4b;};'use strict';var multer=require('multer');var util=require(_0x9724('0x0'));var path=require(_0x9724('0x1'));var timeout=require('connect-timeout');var express=require(_0x9724('0x2'));var router=express[_0x9724('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9724('0x4'));var config=require('../../config/environment');var controller=require(_0x9724('0x5'));router[_0x9724('0x6')]('/',auth[_0x9724('0x7')](),controller[_0x9724('0x8')]);router['get'](_0x9724('0x9'),auth[_0x9724('0x7')](),controller['show']);router[_0x9724('0x6')](_0x9724('0xa'),auth[_0x9724('0x7')](),controller[_0x9724('0xb')]);router[_0x9724('0x6')](_0x9724('0xc'),auth[_0x9724('0x7')](),controller['getSubjects']);router['get'](_0x9724('0xd'),auth[_0x9724('0x7')](),controller[_0x9724('0xe')]);router[_0x9724('0xf')]('/',auth[_0x9724('0x7')](),controller['create']);router[_0x9724('0x10')](_0x9724('0x9'),auth[_0x9724('0x7')](),controller[_0x9724('0x11')]);router['delete'](_0x9724('0x9'),auth[_0x9724('0x7')](),controller['destroy']);module[_0x9724('0x12')]=router; \ No newline at end of file +var _0x5d2a=['delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x5d2a,0x93));var _0xa5d2=function(_0x395126,_0x549493){_0x395126=_0x395126-0x0;var _0x427161=_0x5d2a[_0x395126];return _0x427161;};'use strict';var multer=require('multer');var util=require(_0xa5d2('0x0'));var path=require(_0xa5d2('0x1'));var timeout=require('connect-timeout');var express=require(_0xa5d2('0x2'));var router=express[_0xa5d2('0x3')]();var auth=require(_0xa5d2('0x4'));var interaction=require(_0xa5d2('0x5'));var config=require(_0xa5d2('0x6'));var controller=require(_0xa5d2('0x7'));router['get']('/',auth[_0xa5d2('0x8')](),controller[_0xa5d2('0x9')]);router[_0xa5d2('0xa')](_0xa5d2('0xb'),auth[_0xa5d2('0x8')](),controller[_0xa5d2('0xc')]);router['get'](_0xa5d2('0xd'),auth[_0xa5d2('0x8')](),controller[_0xa5d2('0xe')]);router[_0xa5d2('0xa')](_0xa5d2('0xf'),auth[_0xa5d2('0x8')](),controller[_0xa5d2('0x10')]);router['get'](_0xa5d2('0x11'),auth[_0xa5d2('0x8')](),controller[_0xa5d2('0x12')]);router['post']('/',auth[_0xa5d2('0x8')](),controller[_0xa5d2('0x13')]);router[_0xa5d2('0x14')](_0xa5d2('0xb'),auth[_0xa5d2('0x8')](),controller['update']);router[_0xa5d2('0x15')](_0xa5d2('0xb'),auth[_0xa5d2('0x8')](),controller[_0xa5d2('0x16')]);module[_0xa5d2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index afe3265..cd601e1 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 _0xa9de=['STRING','incident','phonecall','exports'];(function(_0x4f3bb4,_0x18451e){var _0x19586f=function(_0x300410){while(--_0x300410){_0x4f3bb4['push'](_0x4f3bb4['shift']());}};_0x19586f(++_0x18451e);}(_0xa9de,0x1e3));var _0xea9d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa9de[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0xea9d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xea9d('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0xea9d('0x2'),_0xea9d('0x3')),'defaultValue':'incident'}}; \ No newline at end of file +var _0x4533=['exports','STRING','ENUM','phonecall','sequelize'];(function(_0x402975,_0x498840){var _0x2f51c7=function(_0x2e17bf){while(--_0x2e17bf){_0x402975['push'](_0x402975['shift']());}};_0x2f51c7(++_0x498840);}(_0x4533,0xea));var _0x3453=function(_0x1be5e6,_0x2e6414){_0x1be5e6=_0x1be5e6-0x0;var _0x43b0b5=_0x4533[_0x1be5e6];return _0x43b0b5;};'use strict';var Sequelize=require(_0x3453('0x0'));module[_0x3453('0x1')]={'name':{'type':Sequelize[_0x3453('0x2')]},'description':{'type':Sequelize[_0x3453('0x2')]},'ticketType':{'type':Sequelize[_0x3453('0x3')]('incident',_0x3453('0x4')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 9c720fa..ab53259 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 _0xd6c4=['key','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','keys','options','find','body','params','getFields','findOne','Dynamics365Field','length','sort','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type'];(function(_0x5bba85,_0x3bd96a){var _0x22b6cd=function(_0x403096){while(--_0x403096){_0x5bba85['push'](_0x5bba85['shift']());}};_0x22b6cd(++_0x3bd96a);}(_0xd6c4,0x1f0));var _0x4d6c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd6c4[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x4d6c('0x0'));var emlformat=require(_0x4d6c('0x1'));var rimraf=require(_0x4d6c('0x2'));var zipdir=require(_0x4d6c('0x3'));var jsonpatch=require(_0x4d6c('0x4'));var rp=require('request-promise');var moment=require(_0x4d6c('0x5'));var BPromise=require(_0x4d6c('0x6'));var Mustache=require(_0x4d6c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x4d6c('0x8'));var csv=require('to-csv');var ejs=require(_0x4d6c('0x9'));var fs=require('fs');var _=require(_0x4d6c('0xa'));var squel=require(_0x4d6c('0xb'));var crypto=require(_0x4d6c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4d6c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4d6c('0xe'));var Papa=require(_0x4d6c('0xf'));var Redis=require(_0x4d6c('0x10'));var authService=require(_0x4d6c('0x11'));var qs=require(_0x4d6c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d6c('0x13'));var logger=require('../../config/logger')(_0x4d6c('0x14'));var utils=require(_0x4d6c('0x15'));var config=require(_0x4d6c('0x16'));var db=require(_0x4d6c('0x17'))['db'];var jayson=require(_0x4d6c('0x18'));var client=jayson[_0x4d6c('0x19')][_0x4d6c('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5a72f3,_0x3b74c1,_0xa0e448){if(_0xa0e448){var _0x40a42e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x40a42e[_0x4d6c('0x1b')](_0x3b74c1)){return _0x5a72f3;}else{throw new db[(_0x4d6c('0x1c'))][(_0x4d6c('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5a72f3;}}function respondWithRpcPromise(_0x6858ff,_0x853d4,_0x205edf,_0x2b3e11){return new BPromise(function(_0x5945da,_0xb87022){var _0x3f0290=_0x2b3e11||client;return _0x3f0290['request'](_0x6858ff,_0x205edf)['then'](function(_0x4f3bf9){logger[_0x4d6c('0x1e')](_0x4d6c('0x1f'),_0x853d4,_0x4d6c('0x20'));logger[_0x4d6c('0x21')](_0x4d6c('0x22'),_0x853d4,_0x4d6c('0x20'),JSON[_0x4d6c('0x23')](_0x4f3bf9));if(_0x4f3bf9[_0x4d6c('0x24')]){if(_0x4f3bf9[_0x4d6c('0x24')][_0x4d6c('0x25')]===0x1f4){logger[_0x4d6c('0x24')](_0x4d6c('0x1f'),_0x853d4,_0x4f3bf9['error']['message']);return _0xb87022(_0x4f3bf9['error'][_0x4d6c('0x26')]);}logger[_0x4d6c('0x24')](_0x4d6c('0x1f'),_0x853d4,_0x4f3bf9[_0x4d6c('0x24')]['message']);return _0x5945da(_0x4f3bf9['error']['message']);}else{logger[_0x4d6c('0x1e')](_0x4d6c('0x1f'),_0x853d4,_0x4d6c('0x20'));_0x5945da(_0x4f3bf9['result'][_0x4d6c('0x26')]);}})['catch'](function(_0x5329d1){logger[_0x4d6c('0x24')](_0x4d6c('0x1f'),_0x853d4,_0x5329d1);_0xb87022(_0x5329d1);});});}function respondWithStatusCode(_0x3217a6,_0x3120de){_0x3120de=_0x3120de||0xcc;return function(_0x4fd98c){if(_0x4fd98c){return _0x3217a6[_0x4d6c('0x27')](_0x3120de);}return _0x3217a6[_0x4d6c('0x28')](_0x3120de)['end']();};}function respondWithResult(_0x19ce01,_0x47c657){_0x47c657=_0x47c657||0xc8;return function(_0x3c6d20){if(_0x3c6d20){return _0x19ce01[_0x4d6c('0x28')](_0x47c657)[_0x4d6c('0x29')](_0x3c6d20);}};}function respondWithFilteredResult(_0x605620,_0x307fe5){return function(_0x56249f){if(_0x56249f){var _0x5cfa72=_0x56249f['count'],_0x3ad8e6=_0x307fe5[_0x4d6c('0x2a')],_0x56849b=_0x307fe5[_0x4d6c('0x2a')]+_0x307fe5[_0x4d6c('0x2b')],_0x15c24d;if(_0x56849b>=_0x5cfa72){_0x56849b=_0x5cfa72;_0x15c24d=0xc8;}else{_0x15c24d=0xce;}_0x605620[_0x4d6c('0x28')](_0x15c24d);return _0x605620[_0x4d6c('0x2c')](_0x4d6c('0x2d'),_0x3ad8e6+'-'+_0x56849b+'/'+_0x5cfa72)['json'](_0x56249f);}return null;};}function patchUpdates(_0x1b978c){return function(_0x1d2446){try{jsonpatch[_0x4d6c('0x2e')](_0x1d2446,_0x1b978c,!![]);}catch(_0x1c6745){return BPromise[_0x4d6c('0x2f')](_0x1c6745);}return _0x1d2446[_0x4d6c('0x30')]();};}function saveUpdates(_0x3a4ac3,_0x50452b){return function(_0x31d856){if(_0x31d856){return _0x31d856[_0x4d6c('0x31')](_0x3a4ac3)[_0x4d6c('0x32')](function(_0x4c91b1){return _0x4c91b1;});}return null;};}function removeEntity(_0x41c708,_0x18e9ea){return function(_0x1890e9){if(_0x1890e9){return _0x1890e9[_0x4d6c('0x33')]()[_0x4d6c('0x32')](function(){_0x41c708[_0x4d6c('0x28')](0xcc)[_0x4d6c('0x34')]();});}};}function handleEntityNotFound(_0x131e65,_0x1cc2bc){return function(_0x2df5b8){if(!_0x2df5b8){_0x131e65[_0x4d6c('0x27')](0x194);}return _0x2df5b8;};}function handleError(_0x219c50,_0x528c14){_0x528c14=_0x528c14||0x1f4;return function(_0x509a91){logger['error'](_0x509a91[_0x4d6c('0x35')]);if(_0x509a91[_0x4d6c('0x36')]){delete _0x509a91[_0x4d6c('0x36')];}_0x219c50[_0x4d6c('0x28')](_0x528c14)[_0x4d6c('0x37')](_0x509a91);};}exports[_0x4d6c('0x38')]=function(_0x16297e,_0x25ee2a){var _0x31c417={},_0x31c1fa={},_0x503b94={'count':0x0,'rows':[]};var _0x2bc379=_[_0x4d6c('0x39')](db[_0x4d6c('0x3a')][_0x4d6c('0x3b')],function(_0x3078fc){return{'name':_0x3078fc[_0x4d6c('0x3c')],'type':_0x3078fc[_0x4d6c('0x3d')][_0x4d6c('0x3e')]};});_0x31c1fa['model']=_['map'](_0x2bc379,'name');_0x31c1fa[_0x4d6c('0x3f')]=_['keys'](_0x16297e[_0x4d6c('0x3f')]);_0x31c1fa['filters']=_[_0x4d6c('0x40')](_0x31c1fa['model'],_0x31c1fa[_0x4d6c('0x3f')]);_0x31c417['attributes']=_[_0x4d6c('0x40')](_0x31c1fa[_0x4d6c('0x41')],qs[_0x4d6c('0x42')](_0x16297e[_0x4d6c('0x3f')][_0x4d6c('0x42')]));_0x31c417[_0x4d6c('0x43')]=_0x31c417[_0x4d6c('0x43')]['length']?_0x31c417[_0x4d6c('0x43')]:_0x31c1fa[_0x4d6c('0x41')];if(!_0x16297e[_0x4d6c('0x3f')][_0x4d6c('0x44')](_0x4d6c('0x45'))){_0x31c417[_0x4d6c('0x2b')]=qs['limit'](_0x16297e[_0x4d6c('0x3f')][_0x4d6c('0x2b')]);_0x31c417[_0x4d6c('0x2a')]=qs['offset'](_0x16297e[_0x4d6c('0x3f')]['offset']);}_0x31c417[_0x4d6c('0x46')]=qs['sort'](_0x16297e[_0x4d6c('0x3f')]['sort']);_0x31c417[_0x4d6c('0x47')]=qs[_0x4d6c('0x48')](_[_0x4d6c('0x49')](_0x16297e['query'],_0x31c1fa[_0x4d6c('0x48')]),_0x2bc379);if(_0x16297e[_0x4d6c('0x3f')][_0x4d6c('0x4a')]){_0x31c417[_0x4d6c('0x47')]=_[_0x4d6c('0x4b')](_0x31c417[_0x4d6c('0x47')],{'$or':_[_0x4d6c('0x39')](_0x2bc379,function(_0x301b96){if(_0x301b96[_0x4d6c('0x3d')]!=='VIRTUAL'){var _0x4d7422={};_0x4d7422[_0x301b96['name']]={'$like':'%'+_0x16297e['query']['filter']+'%'};return _0x4d7422;}})});}_0x31c417=_['merge']({},_0x31c417,_0x16297e['options']);var _0x417d8a={'where':_0x31c417['where']};return db[_0x4d6c('0x3a')]['count'](_0x417d8a)['then'](function(_0x29088d){_0x503b94['count']=_0x29088d;if(_0x16297e[_0x4d6c('0x3f')][_0x4d6c('0x4c')]){_0x31c417[_0x4d6c('0x4d')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x4d6c('0x4e')](_0x31c417);})[_0x4d6c('0x32')](function(_0x5afe7a){_0x503b94[_0x4d6c('0x4f')]=_0x5afe7a;return _0x503b94;})['then'](respondWithFilteredResult(_0x25ee2a,_0x31c417))[_0x4d6c('0x50')](handleError(_0x25ee2a,null));};exports['show']=function(_0x50198d,_0x4b34be){var _0x2864d8={'raw':![],'where':{'id':_0x50198d['params']['id']}},_0xd4e5de={};_0xd4e5de[_0x4d6c('0x41')]=_[_0x4d6c('0x51')](db[_0x4d6c('0x3a')][_0x4d6c('0x3b')]);_0xd4e5de[_0x4d6c('0x3f')]=_['keys'](_0x50198d[_0x4d6c('0x3f')]);_0xd4e5de[_0x4d6c('0x48')]=_[_0x4d6c('0x40')](_0xd4e5de['model'],_0xd4e5de['query']);_0x2864d8[_0x4d6c('0x43')]=_['intersection'](_0xd4e5de[_0x4d6c('0x41')],qs[_0x4d6c('0x42')](_0x50198d[_0x4d6c('0x3f')][_0x4d6c('0x42')]));_0x2864d8[_0x4d6c('0x43')]=_0x2864d8['attributes']['length']?_0x2864d8['attributes']:_0xd4e5de[_0x4d6c('0x41')];if(_0x50198d[_0x4d6c('0x3f')][_0x4d6c('0x4c')]){_0x2864d8['include']=[{'all':!![]}];}_0x2864d8=_[_0x4d6c('0x4b')]({},_0x2864d8,_0x50198d[_0x4d6c('0x52')]);return db[_0x4d6c('0x3a')][_0x4d6c('0x53')](_0x2864d8)['then'](handleEntityNotFound(_0x4b34be,null))[_0x4d6c('0x32')](respondWithResult(_0x4b34be,null))[_0x4d6c('0x50')](handleError(_0x4b34be,null));};exports['create']=function(_0x16e202,_0x1a248b){return db['Dynamics365Configuration']['create'](_0x16e202['body'],{})[_0x4d6c('0x32')](respondWithResult(_0x1a248b,0xc9))[_0x4d6c('0x50')](handleError(_0x1a248b,null));};exports[_0x4d6c('0x31')]=function(_0x1ed4b0,_0x15e81c){if(_0x1ed4b0[_0x4d6c('0x54')]['id']){delete _0x1ed4b0['body']['id'];}return db['Dynamics365Configuration'][_0x4d6c('0x53')]({'where':{'id':_0x1ed4b0[_0x4d6c('0x55')]['id']}})[_0x4d6c('0x32')](handleEntityNotFound(_0x15e81c,null))[_0x4d6c('0x32')](saveUpdates(_0x1ed4b0[_0x4d6c('0x54')],null))['then'](respondWithResult(_0x15e81c,null))['catch'](handleError(_0x15e81c,null));};exports[_0x4d6c('0x33')]=function(_0x400cb3,_0x504f54){return db[_0x4d6c('0x3a')]['find']({'where':{'id':_0x400cb3[_0x4d6c('0x55')]['id']}})[_0x4d6c('0x32')](handleEntityNotFound(_0x504f54,null))[_0x4d6c('0x32')](removeEntity(_0x504f54,null))['catch'](handleError(_0x504f54,null));};exports[_0x4d6c('0x56')]=function(_0xfaf81e,_0x1eb59d,_0x22a4c8){var _0x493298={};var _0x3744d6={};var _0x506ce2;var _0x500a48;return db[_0x4d6c('0x3a')][_0x4d6c('0x57')]({'where':{'id':_0xfaf81e[_0x4d6c('0x55')]['id']}})['then'](handleEntityNotFound(_0x1eb59d,null))[_0x4d6c('0x32')](function(_0x27d950){if(_0x27d950){_0x506ce2=_0x27d950;_0x3744d6['model']=_[_0x4d6c('0x51')](db[_0x4d6c('0x58')]['rawAttributes']);_0x3744d6[_0x4d6c('0x3f')]=_[_0x4d6c('0x51')](_0xfaf81e[_0x4d6c('0x3f')]);_0x3744d6[_0x4d6c('0x48')]=_[_0x4d6c('0x40')](_0x3744d6[_0x4d6c('0x41')],_0x3744d6[_0x4d6c('0x3f')]);_0x493298['attributes']=_['intersection'](_0x3744d6[_0x4d6c('0x41')],qs[_0x4d6c('0x42')](_0xfaf81e[_0x4d6c('0x3f')]['fields']));_0x493298['attributes']=_0x493298[_0x4d6c('0x43')][_0x4d6c('0x59')]?_0x493298[_0x4d6c('0x43')]:_0x3744d6['model'];_0x493298[_0x4d6c('0x46')]=qs[_0x4d6c('0x5a')](_0xfaf81e[_0x4d6c('0x3f')]['sort']);_0x493298[_0x4d6c('0x47')]=qs['filters'](_[_0x4d6c('0x49')](_0xfaf81e[_0x4d6c('0x3f')],_0x3744d6['filters']));if(_0xfaf81e['query'][_0x4d6c('0x4a')]){_0x493298[_0x4d6c('0x47')]=_['merge'](_0x493298[_0x4d6c('0x47')],{'$or':_[_0x4d6c('0x39')](_0x493298[_0x4d6c('0x43')],function(_0x20e282){var _0x4c75da={};_0x4c75da[_0x20e282]={'$like':'%'+_0xfaf81e['query'][_0x4d6c('0x4a')]+'%'};return _0x4c75da;})});}_0x493298=_[_0x4d6c('0x4b')]({},_0x493298,_0xfaf81e['options']);return _0x506ce2['getFields'](_0x493298);}})[_0x4d6c('0x32')](function(_0x4118da){if(_0x4118da){_0x500a48=_0x4118da[_0x4d6c('0x59')];if(!_0xfaf81e['query'][_0x4d6c('0x44')](_0x4d6c('0x45'))){_0x493298[_0x4d6c('0x2b')]=qs[_0x4d6c('0x2b')](_0xfaf81e[_0x4d6c('0x3f')]['limit']);_0x493298['offset']=qs[_0x4d6c('0x2a')](_0xfaf81e[_0x4d6c('0x3f')][_0x4d6c('0x2a')]);}return _0x506ce2[_0x4d6c('0x56')](_0x493298);}})[_0x4d6c('0x32')](function(_0x5be4cc){if(_0x5be4cc){return _0x5be4cc?{'count':_0x500a48,'rows':_0x5be4cc}:null;}})[_0x4d6c('0x32')](respondWithResult(_0x1eb59d,null))['catch'](handleError(_0x1eb59d,null));};exports[_0x4d6c('0x5b')]=function(_0x222f7d,_0x4ab890,_0x7f68cd){var _0xdf979b={};var _0x4713e3={};var _0x28d219;var _0x3a7524;return db['Dynamics365Configuration'][_0x4d6c('0x57')]({'where':{'id':_0x222f7d['params']['id']}})[_0x4d6c('0x32')](handleEntityNotFound(_0x4ab890,null))[_0x4d6c('0x32')](function(_0x14d507){if(_0x14d507){_0x28d219=_0x14d507;_0x4713e3[_0x4d6c('0x41')]=_[_0x4d6c('0x51')](db[_0x4d6c('0x58')][_0x4d6c('0x3b')]);_0x4713e3[_0x4d6c('0x3f')]=_['keys'](_0x222f7d['query']);_0x4713e3['filters']=_['intersection'](_0x4713e3[_0x4d6c('0x41')],_0x4713e3['query']);_0xdf979b[_0x4d6c('0x43')]=_[_0x4d6c('0x40')](_0x4713e3[_0x4d6c('0x41')],qs[_0x4d6c('0x42')](_0x222f7d['query'][_0x4d6c('0x42')]));_0xdf979b[_0x4d6c('0x43')]=_0xdf979b[_0x4d6c('0x43')][_0x4d6c('0x59')]?_0xdf979b[_0x4d6c('0x43')]:_0x4713e3['model'];_0xdf979b[_0x4d6c('0x46')]=qs[_0x4d6c('0x5a')](_0x222f7d[_0x4d6c('0x3f')][_0x4d6c('0x5a')]);_0xdf979b['where']=qs['filters'](_['pick'](_0x222f7d['query'],_0x4713e3['filters']));if(_0x222f7d[_0x4d6c('0x3f')][_0x4d6c('0x4a')]){_0xdf979b[_0x4d6c('0x47')]=_['merge'](_0xdf979b['where'],{'$or':_[_0x4d6c('0x39')](_0xdf979b[_0x4d6c('0x43')],function(_0x5e4d1b){var _0x5120f0={};_0x5120f0[_0x5e4d1b]={'$like':'%'+_0x222f7d[_0x4d6c('0x3f')]['filter']+'%'};return _0x5120f0;})});}_0xdf979b=_[_0x4d6c('0x4b')]({},_0xdf979b,_0x222f7d[_0x4d6c('0x52')]);return _0x28d219[_0x4d6c('0x5b')](_0xdf979b);}})[_0x4d6c('0x32')](function(_0x46e366){if(_0x46e366){_0x3a7524=_0x46e366[_0x4d6c('0x59')];if(!_0x222f7d['query'][_0x4d6c('0x44')](_0x4d6c('0x45'))){_0xdf979b[_0x4d6c('0x2b')]=qs[_0x4d6c('0x2b')](_0x222f7d[_0x4d6c('0x3f')][_0x4d6c('0x2b')]);_0xdf979b[_0x4d6c('0x2a')]=qs['offset'](_0x222f7d[_0x4d6c('0x3f')][_0x4d6c('0x2a')]);}return _0x28d219[_0x4d6c('0x5b')](_0xdf979b);}})['then'](function(_0x164f60){if(_0x164f60){return _0x164f60?{'count':_0x3a7524,'rows':_0x164f60}:null;}})[_0x4d6c('0x32')](respondWithResult(_0x4ab890,null))[_0x4d6c('0x50')](handleError(_0x4ab890,null));};exports[_0x4d6c('0x5c')]=function(_0x5f5092,_0x4d7b9a,_0x20e3cb){var _0x18eefb={};var _0x1f1fb9={};var _0xfcfbd0;var _0x32ceb2;return db[_0x4d6c('0x3a')][_0x4d6c('0x57')]({'where':{'id':_0x5f5092[_0x4d6c('0x55')]['id']}})[_0x4d6c('0x32')](handleEntityNotFound(_0x4d7b9a,null))[_0x4d6c('0x32')](function(_0x5877e4){if(_0x5877e4){_0xfcfbd0=_0x5877e4;_0x1f1fb9[_0x4d6c('0x41')]=_[_0x4d6c('0x51')](db['Dynamics365Field'][_0x4d6c('0x3b')]);_0x1f1fb9['query']=_['keys'](_0x5f5092['query']);_0x1f1fb9[_0x4d6c('0x48')]=_['intersection'](_0x1f1fb9[_0x4d6c('0x41')],_0x1f1fb9[_0x4d6c('0x3f')]);_0x18eefb['attributes']=_[_0x4d6c('0x40')](_0x1f1fb9[_0x4d6c('0x41')],qs[_0x4d6c('0x42')](_0x5f5092[_0x4d6c('0x3f')]['fields']));_0x18eefb['attributes']=_0x18eefb[_0x4d6c('0x43')]['length']?_0x18eefb[_0x4d6c('0x43')]:_0x1f1fb9[_0x4d6c('0x41')];_0x18eefb[_0x4d6c('0x46')]=qs[_0x4d6c('0x5a')](_0x5f5092[_0x4d6c('0x3f')][_0x4d6c('0x5a')]);_0x18eefb['where']=qs['filters'](_[_0x4d6c('0x49')](_0x5f5092[_0x4d6c('0x3f')],_0x1f1fb9['filters']));if(_0x5f5092[_0x4d6c('0x3f')][_0x4d6c('0x4a')]){_0x18eefb[_0x4d6c('0x47')]=_[_0x4d6c('0x4b')](_0x18eefb['where'],{'$or':_[_0x4d6c('0x39')](_0x18eefb[_0x4d6c('0x43')],function(_0x4bc065){var _0x1802c9={};_0x1802c9[_0x4bc065]={'$like':'%'+_0x5f5092['query'][_0x4d6c('0x4a')]+'%'};return _0x1802c9;})});}_0x18eefb=_['merge']({},_0x18eefb,_0x5f5092[_0x4d6c('0x52')]);return _0xfcfbd0[_0x4d6c('0x5c')](_0x18eefb);}})[_0x4d6c('0x32')](function(_0x4eb275){if(_0x4eb275){_0x32ceb2=_0x4eb275[_0x4d6c('0x59')];if(!_0x5f5092[_0x4d6c('0x3f')][_0x4d6c('0x44')](_0x4d6c('0x45'))){_0x18eefb['limit']=qs['limit'](_0x5f5092[_0x4d6c('0x3f')]['limit']);_0x18eefb[_0x4d6c('0x2a')]=qs[_0x4d6c('0x2a')](_0x5f5092[_0x4d6c('0x3f')][_0x4d6c('0x2a')]);}return _0xfcfbd0[_0x4d6c('0x5c')](_0x18eefb);}})[_0x4d6c('0x32')](function(_0x316278){if(_0x316278){return _0x316278?{'count':_0x32ceb2,'rows':_0x316278}:null;}})[_0x4d6c('0x32')](respondWithResult(_0x4d7b9a,null))[_0x4d6c('0x50')](handleError(_0x4d7b9a,null));}; \ No newline at end of file +var _0xc0e8=['sort','pick','where','VIRTUAL','filter','merge','options','count','includeAll','Dynamics365Configuration','findAll','rows','show','params','create','body','find','Dynamics365Field','getFields','nolimit','findOne','getSubjects','getDescriptions','html-pdf','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','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','http','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~!@#$%^&-_=+[{]}.','then','info','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','offset','set','save','update','destroy','end','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc0e8,0xc9));var _0x8c0e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc0e8[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x8c0e('0x0'));var emlformat=require(_0x8c0e('0x1'));var rimraf=require(_0x8c0e('0x2'));var zipdir=require(_0x8c0e('0x3'));var jsonpatch=require(_0x8c0e('0x4'));var rp=require(_0x8c0e('0x5'));var moment=require(_0x8c0e('0x6'));var BPromise=require(_0x8c0e('0x7'));var Mustache=require(_0x8c0e('0x8'));var util=require(_0x8c0e('0x9'));var path=require(_0x8c0e('0xa'));var sox=require(_0x8c0e('0xb'));var csv=require(_0x8c0e('0xc'));var ejs=require(_0x8c0e('0xd'));var fs=require('fs');var _=require(_0x8c0e('0xe'));var squel=require(_0x8c0e('0xf'));var crypto=require(_0x8c0e('0x10'));var jsforce=require(_0x8c0e('0x11'));var deskjs=require(_0x8c0e('0x12'));var toCsv=require(_0x8c0e('0xc'));var querystring=require(_0x8c0e('0x13'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8c0e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c0e('0x15'));var logger=require(_0x8c0e('0x16'))(_0x8c0e('0x17'));var utils=require('../../config/utils');var config=require(_0x8c0e('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8c0e('0x19'));var client=jayson['client'][_0x8c0e('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x7b3afb,_0x234049,_0x310a7e){if(_0x310a7e){var _0x5bbe95=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5bbe95['test'](_0x234049)){return _0x7b3afb;}else{throw new db['Sequelize'][(_0x8c0e('0x1b'))](_0x8c0e('0x1c'));}}else{return _0x7b3afb;}}function respondWithRpcPromise(_0x3bc87a,_0x8955ea,_0x545e12,_0x172467){return new BPromise(function(_0x3ea782,_0x5e1209){var _0x3295de=_0x172467||client;return _0x3295de['request'](_0x3bc87a,_0x545e12)[_0x8c0e('0x1d')](function(_0x4c5698){logger[_0x8c0e('0x1e')](_0x8c0e('0x1f'),_0x8955ea,'request\x20sent');logger['debug'](_0x8c0e('0x20'),_0x8955ea,_0x8c0e('0x21'),JSON['stringify'](_0x4c5698));if(_0x4c5698[_0x8c0e('0x22')]){if(_0x4c5698[_0x8c0e('0x22')][_0x8c0e('0x23')]===0x1f4){logger['error'](_0x8c0e('0x1f'),_0x8955ea,_0x4c5698[_0x8c0e('0x22')][_0x8c0e('0x24')]);return _0x5e1209(_0x4c5698['error'][_0x8c0e('0x24')]);}logger[_0x8c0e('0x22')](_0x8c0e('0x1f'),_0x8955ea,_0x4c5698[_0x8c0e('0x22')][_0x8c0e('0x24')]);return _0x3ea782(_0x4c5698[_0x8c0e('0x22')][_0x8c0e('0x24')]);}else{logger[_0x8c0e('0x1e')](_0x8c0e('0x1f'),_0x8955ea,'request\x20sent');_0x3ea782(_0x4c5698[_0x8c0e('0x25')][_0x8c0e('0x24')]);}})[_0x8c0e('0x26')](function(_0xeadb81){logger[_0x8c0e('0x22')](_0x8c0e('0x1f'),_0x8955ea,_0xeadb81);_0x5e1209(_0xeadb81);});});}function respondWithStatusCode(_0x3b76ae,_0x33aab2){_0x33aab2=_0x33aab2||0xcc;return function(_0x1cf8dd){if(_0x1cf8dd){return _0x3b76ae[_0x8c0e('0x27')](_0x33aab2);}return _0x3b76ae[_0x8c0e('0x28')](_0x33aab2)['end']();};}function respondWithResult(_0x417a3f,_0x56e0bb){_0x56e0bb=_0x56e0bb||0xc8;return function(_0x1e829a){if(_0x1e829a){return _0x417a3f['status'](_0x56e0bb)[_0x8c0e('0x29')](_0x1e829a);}};}function respondWithFilteredResult(_0x862724,_0x53c182){return function(_0x94f3b4){if(_0x94f3b4){var _0x57d0c3=_0x94f3b4['count'],_0x29f9ce=_0x53c182[_0x8c0e('0x2a')],_0x352499=_0x53c182[_0x8c0e('0x2a')]+_0x53c182['limit'],_0x46bf54;if(_0x352499>=_0x57d0c3){_0x352499=_0x57d0c3;_0x46bf54=0xc8;}else{_0x46bf54=0xce;}_0x862724['status'](_0x46bf54);return _0x862724[_0x8c0e('0x2b')]('Content-Range',_0x29f9ce+'-'+_0x352499+'/'+_0x57d0c3)['json'](_0x94f3b4);}return null;};}function patchUpdates(_0x338019){return function(_0x303e77){try{jsonpatch['apply'](_0x303e77,_0x338019,!![]);}catch(_0x299da9){return BPromise['reject'](_0x299da9);}return _0x303e77[_0x8c0e('0x2c')]();};}function saveUpdates(_0x3ccf32,_0x3bca3d){return function(_0x55ac92){if(_0x55ac92){return _0x55ac92[_0x8c0e('0x2d')](_0x3ccf32)[_0x8c0e('0x1d')](function(_0x5ef136){return _0x5ef136;});}return null;};}function removeEntity(_0x108c19,_0x25db04){return function(_0x1bf654){if(_0x1bf654){return _0x1bf654[_0x8c0e('0x2e')]()['then'](function(){_0x108c19[_0x8c0e('0x28')](0xcc)[_0x8c0e('0x2f')]();});}};}function handleEntityNotFound(_0x4d9d78,_0x1afb3d){return function(_0xe09d8b){if(!_0xe09d8b){_0x4d9d78[_0x8c0e('0x27')](0x194);}return _0xe09d8b;};}function handleError(_0x626b38,_0x5ae00a){_0x5ae00a=_0x5ae00a||0x1f4;return function(_0x3dfdb7){logger[_0x8c0e('0x22')](_0x3dfdb7['stack']);if(_0x3dfdb7['name']){delete _0x3dfdb7[_0x8c0e('0x30')];}_0x626b38[_0x8c0e('0x28')](_0x5ae00a)[_0x8c0e('0x31')](_0x3dfdb7);};}exports[_0x8c0e('0x32')]=function(_0x58a6e8,_0x147e71){var _0x11745b={},_0x46bdde={},_0x504f5a={'count':0x0,'rows':[]};var _0x54202d=_[_0x8c0e('0x33')](db['Dynamics365Configuration'][_0x8c0e('0x34')],function(_0x10282b){return{'name':_0x10282b[_0x8c0e('0x35')],'type':_0x10282b[_0x8c0e('0x36')]['key']};});_0x46bdde[_0x8c0e('0x37')]=_[_0x8c0e('0x33')](_0x54202d,'name');_0x46bdde[_0x8c0e('0x38')]=_[_0x8c0e('0x39')](_0x58a6e8['query']);_0x46bdde[_0x8c0e('0x3a')]=_[_0x8c0e('0x3b')](_0x46bdde[_0x8c0e('0x37')],_0x46bdde['query']);_0x11745b[_0x8c0e('0x3c')]=_[_0x8c0e('0x3b')](_0x46bdde[_0x8c0e('0x37')],qs[_0x8c0e('0x3d')](_0x58a6e8['query'][_0x8c0e('0x3d')]));_0x11745b['attributes']=_0x11745b[_0x8c0e('0x3c')][_0x8c0e('0x3e')]?_0x11745b[_0x8c0e('0x3c')]:_0x46bdde[_0x8c0e('0x37')];if(!_0x58a6e8['query'][_0x8c0e('0x3f')]('nolimit')){_0x11745b[_0x8c0e('0x40')]=qs[_0x8c0e('0x40')](_0x58a6e8['query'][_0x8c0e('0x40')]);_0x11745b['offset']=qs[_0x8c0e('0x2a')](_0x58a6e8[_0x8c0e('0x38')][_0x8c0e('0x2a')]);}_0x11745b[_0x8c0e('0x41')]=qs[_0x8c0e('0x42')](_0x58a6e8[_0x8c0e('0x38')]['sort']);_0x11745b['where']=qs[_0x8c0e('0x3a')](_[_0x8c0e('0x43')](_0x58a6e8['query'],_0x46bdde[_0x8c0e('0x3a')]),_0x54202d);if(_0x58a6e8[_0x8c0e('0x38')]['filter']){_0x11745b[_0x8c0e('0x44')]=_['merge'](_0x11745b['where'],{'$or':_['map'](_0x54202d,function(_0x14d987){if(_0x14d987[_0x8c0e('0x36')]!==_0x8c0e('0x45')){var _0x440d01={};_0x440d01[_0x14d987[_0x8c0e('0x30')]]={'$like':'%'+_0x58a6e8['query'][_0x8c0e('0x46')]+'%'};return _0x440d01;}})});}_0x11745b=_[_0x8c0e('0x47')]({},_0x11745b,_0x58a6e8[_0x8c0e('0x48')]);var _0x1a40f3={'where':_0x11745b[_0x8c0e('0x44')]};return db['Dynamics365Configuration'][_0x8c0e('0x49')](_0x1a40f3)[_0x8c0e('0x1d')](function(_0x4c92ea){_0x504f5a[_0x8c0e('0x49')]=_0x4c92ea;if(_0x58a6e8[_0x8c0e('0x38')][_0x8c0e('0x4a')]){_0x11745b['include']=[{'all':!![]}];}return db[_0x8c0e('0x4b')][_0x8c0e('0x4c')](_0x11745b);})[_0x8c0e('0x1d')](function(_0x261968){_0x504f5a[_0x8c0e('0x4d')]=_0x261968;return _0x504f5a;})['then'](respondWithFilteredResult(_0x147e71,_0x11745b))[_0x8c0e('0x26')](handleError(_0x147e71,null));};exports[_0x8c0e('0x4e')]=function(_0x424b4d,_0x40ff25){var _0x33fa0a={'raw':![],'where':{'id':_0x424b4d[_0x8c0e('0x4f')]['id']}},_0x1e0d50={};_0x1e0d50[_0x8c0e('0x37')]=_[_0x8c0e('0x39')](db[_0x8c0e('0x4b')][_0x8c0e('0x34')]);_0x1e0d50[_0x8c0e('0x38')]=_[_0x8c0e('0x39')](_0x424b4d['query']);_0x1e0d50[_0x8c0e('0x3a')]=_['intersection'](_0x1e0d50['model'],_0x1e0d50[_0x8c0e('0x38')]);_0x33fa0a['attributes']=_[_0x8c0e('0x3b')](_0x1e0d50['model'],qs[_0x8c0e('0x3d')](_0x424b4d[_0x8c0e('0x38')]['fields']));_0x33fa0a[_0x8c0e('0x3c')]=_0x33fa0a[_0x8c0e('0x3c')][_0x8c0e('0x3e')]?_0x33fa0a['attributes']:_0x1e0d50[_0x8c0e('0x37')];if(_0x424b4d[_0x8c0e('0x38')][_0x8c0e('0x4a')]){_0x33fa0a['include']=[{'all':!![]}];}_0x33fa0a=_['merge']({},_0x33fa0a,_0x424b4d[_0x8c0e('0x48')]);return db[_0x8c0e('0x4b')]['find'](_0x33fa0a)['then'](handleEntityNotFound(_0x40ff25,null))['then'](respondWithResult(_0x40ff25,null))['catch'](handleError(_0x40ff25,null));};exports[_0x8c0e('0x50')]=function(_0x56f006,_0x1c346d){return db[_0x8c0e('0x4b')]['create'](_0x56f006[_0x8c0e('0x51')],{})[_0x8c0e('0x1d')](respondWithResult(_0x1c346d,0xc9))[_0x8c0e('0x26')](handleError(_0x1c346d,null));};exports[_0x8c0e('0x2d')]=function(_0x598bf9,_0x5679e9){if(_0x598bf9[_0x8c0e('0x51')]['id']){delete _0x598bf9[_0x8c0e('0x51')]['id'];}return db[_0x8c0e('0x4b')][_0x8c0e('0x52')]({'where':{'id':_0x598bf9['params']['id']}})[_0x8c0e('0x1d')](handleEntityNotFound(_0x5679e9,null))['then'](saveUpdates(_0x598bf9[_0x8c0e('0x51')],null))[_0x8c0e('0x1d')](respondWithResult(_0x5679e9,null))[_0x8c0e('0x26')](handleError(_0x5679e9,null));};exports['destroy']=function(_0x16ef49,_0x3965b5){return db[_0x8c0e('0x4b')][_0x8c0e('0x52')]({'where':{'id':_0x16ef49[_0x8c0e('0x4f')]['id']}})[_0x8c0e('0x1d')](handleEntityNotFound(_0x3965b5,null))[_0x8c0e('0x1d')](removeEntity(_0x3965b5,null))[_0x8c0e('0x26')](handleError(_0x3965b5,null));};exports['getFields']=function(_0x416b4a,_0x89261c,_0x342ec8){var _0x13d384={};var _0x39a85d={};var _0x4d292d;var _0x1a5289;return db[_0x8c0e('0x4b')]['findOne']({'where':{'id':_0x416b4a[_0x8c0e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x89261c,null))[_0x8c0e('0x1d')](function(_0x5ad814){if(_0x5ad814){_0x4d292d=_0x5ad814;_0x39a85d[_0x8c0e('0x37')]=_['keys'](db[_0x8c0e('0x53')][_0x8c0e('0x34')]);_0x39a85d[_0x8c0e('0x38')]=_[_0x8c0e('0x39')](_0x416b4a[_0x8c0e('0x38')]);_0x39a85d[_0x8c0e('0x3a')]=_['intersection'](_0x39a85d[_0x8c0e('0x37')],_0x39a85d[_0x8c0e('0x38')]);_0x13d384[_0x8c0e('0x3c')]=_[_0x8c0e('0x3b')](_0x39a85d[_0x8c0e('0x37')],qs[_0x8c0e('0x3d')](_0x416b4a['query'][_0x8c0e('0x3d')]));_0x13d384[_0x8c0e('0x3c')]=_0x13d384[_0x8c0e('0x3c')][_0x8c0e('0x3e')]?_0x13d384[_0x8c0e('0x3c')]:_0x39a85d[_0x8c0e('0x37')];_0x13d384[_0x8c0e('0x41')]=qs[_0x8c0e('0x42')](_0x416b4a['query'][_0x8c0e('0x42')]);_0x13d384[_0x8c0e('0x44')]=qs[_0x8c0e('0x3a')](_[_0x8c0e('0x43')](_0x416b4a[_0x8c0e('0x38')],_0x39a85d[_0x8c0e('0x3a')]));if(_0x416b4a['query'][_0x8c0e('0x46')]){_0x13d384[_0x8c0e('0x44')]=_[_0x8c0e('0x47')](_0x13d384['where'],{'$or':_['map'](_0x13d384[_0x8c0e('0x3c')],function(_0x17ae5b){var _0x5c7fda={};_0x5c7fda[_0x17ae5b]={'$like':'%'+_0x416b4a[_0x8c0e('0x38')][_0x8c0e('0x46')]+'%'};return _0x5c7fda;})});}_0x13d384=_[_0x8c0e('0x47')]({},_0x13d384,_0x416b4a[_0x8c0e('0x48')]);return _0x4d292d[_0x8c0e('0x54')](_0x13d384);}})[_0x8c0e('0x1d')](function(_0x29f109){if(_0x29f109){_0x1a5289=_0x29f109['length'];if(!_0x416b4a['query']['hasOwnProperty'](_0x8c0e('0x55'))){_0x13d384['limit']=qs['limit'](_0x416b4a['query']['limit']);_0x13d384[_0x8c0e('0x2a')]=qs[_0x8c0e('0x2a')](_0x416b4a[_0x8c0e('0x38')][_0x8c0e('0x2a')]);}return _0x4d292d[_0x8c0e('0x54')](_0x13d384);}})[_0x8c0e('0x1d')](function(_0x5a9c50){if(_0x5a9c50){return _0x5a9c50?{'count':_0x1a5289,'rows':_0x5a9c50}:null;}})[_0x8c0e('0x1d')](respondWithResult(_0x89261c,null))[_0x8c0e('0x26')](handleError(_0x89261c,null));};exports['getSubjects']=function(_0x2531ba,_0x56aed5,_0x2d6761){var _0x42d572={};var _0x3693ed={};var _0x8bd04a;var _0x55e92c;return db['Dynamics365Configuration'][_0x8c0e('0x56')]({'where':{'id':_0x2531ba[_0x8c0e('0x4f')]['id']}})[_0x8c0e('0x1d')](handleEntityNotFound(_0x56aed5,null))['then'](function(_0x280938){if(_0x280938){_0x8bd04a=_0x280938;_0x3693ed['model']=_[_0x8c0e('0x39')](db[_0x8c0e('0x53')][_0x8c0e('0x34')]);_0x3693ed['query']=_[_0x8c0e('0x39')](_0x2531ba[_0x8c0e('0x38')]);_0x3693ed['filters']=_[_0x8c0e('0x3b')](_0x3693ed[_0x8c0e('0x37')],_0x3693ed[_0x8c0e('0x38')]);_0x42d572[_0x8c0e('0x3c')]=_[_0x8c0e('0x3b')](_0x3693ed[_0x8c0e('0x37')],qs['fields'](_0x2531ba[_0x8c0e('0x38')][_0x8c0e('0x3d')]));_0x42d572[_0x8c0e('0x3c')]=_0x42d572[_0x8c0e('0x3c')][_0x8c0e('0x3e')]?_0x42d572['attributes']:_0x3693ed[_0x8c0e('0x37')];_0x42d572[_0x8c0e('0x41')]=qs[_0x8c0e('0x42')](_0x2531ba[_0x8c0e('0x38')][_0x8c0e('0x42')]);_0x42d572[_0x8c0e('0x44')]=qs['filters'](_[_0x8c0e('0x43')](_0x2531ba['query'],_0x3693ed[_0x8c0e('0x3a')]));if(_0x2531ba[_0x8c0e('0x38')]['filter']){_0x42d572[_0x8c0e('0x44')]=_[_0x8c0e('0x47')](_0x42d572[_0x8c0e('0x44')],{'$or':_[_0x8c0e('0x33')](_0x42d572[_0x8c0e('0x3c')],function(_0x25910f){var _0x29349a={};_0x29349a[_0x25910f]={'$like':'%'+_0x2531ba[_0x8c0e('0x38')][_0x8c0e('0x46')]+'%'};return _0x29349a;})});}_0x42d572=_[_0x8c0e('0x47')]({},_0x42d572,_0x2531ba[_0x8c0e('0x48')]);return _0x8bd04a[_0x8c0e('0x57')](_0x42d572);}})['then'](function(_0x2709db){if(_0x2709db){_0x55e92c=_0x2709db[_0x8c0e('0x3e')];if(!_0x2531ba[_0x8c0e('0x38')][_0x8c0e('0x3f')]('nolimit')){_0x42d572[_0x8c0e('0x40')]=qs['limit'](_0x2531ba['query'][_0x8c0e('0x40')]);_0x42d572[_0x8c0e('0x2a')]=qs[_0x8c0e('0x2a')](_0x2531ba[_0x8c0e('0x38')][_0x8c0e('0x2a')]);}return _0x8bd04a['getSubjects'](_0x42d572);}})[_0x8c0e('0x1d')](function(_0x52b5fb){if(_0x52b5fb){return _0x52b5fb?{'count':_0x55e92c,'rows':_0x52b5fb}:null;}})[_0x8c0e('0x1d')](respondWithResult(_0x56aed5,null))[_0x8c0e('0x26')](handleError(_0x56aed5,null));};exports[_0x8c0e('0x58')]=function(_0x3ade96,_0x5c3069,_0x388f61){var _0x957c78={};var _0x2130f6={};var _0x5d2828;var _0x3dfd07;return db[_0x8c0e('0x4b')][_0x8c0e('0x56')]({'where':{'id':_0x3ade96['params']['id']}})[_0x8c0e('0x1d')](handleEntityNotFound(_0x5c3069,null))[_0x8c0e('0x1d')](function(_0x5858ca){if(_0x5858ca){_0x5d2828=_0x5858ca;_0x2130f6[_0x8c0e('0x37')]=_[_0x8c0e('0x39')](db[_0x8c0e('0x53')][_0x8c0e('0x34')]);_0x2130f6[_0x8c0e('0x38')]=_[_0x8c0e('0x39')](_0x3ade96[_0x8c0e('0x38')]);_0x2130f6[_0x8c0e('0x3a')]=_[_0x8c0e('0x3b')](_0x2130f6['model'],_0x2130f6['query']);_0x957c78[_0x8c0e('0x3c')]=_[_0x8c0e('0x3b')](_0x2130f6[_0x8c0e('0x37')],qs['fields'](_0x3ade96['query']['fields']));_0x957c78['attributes']=_0x957c78[_0x8c0e('0x3c')][_0x8c0e('0x3e')]?_0x957c78[_0x8c0e('0x3c')]:_0x2130f6[_0x8c0e('0x37')];_0x957c78['order']=qs[_0x8c0e('0x42')](_0x3ade96[_0x8c0e('0x38')][_0x8c0e('0x42')]);_0x957c78[_0x8c0e('0x44')]=qs[_0x8c0e('0x3a')](_[_0x8c0e('0x43')](_0x3ade96[_0x8c0e('0x38')],_0x2130f6['filters']));if(_0x3ade96[_0x8c0e('0x38')][_0x8c0e('0x46')]){_0x957c78[_0x8c0e('0x44')]=_[_0x8c0e('0x47')](_0x957c78['where'],{'$or':_[_0x8c0e('0x33')](_0x957c78[_0x8c0e('0x3c')],function(_0x1635e8){var _0x17476e={};_0x17476e[_0x1635e8]={'$like':'%'+_0x3ade96[_0x8c0e('0x38')][_0x8c0e('0x46')]+'%'};return _0x17476e;})});}_0x957c78=_[_0x8c0e('0x47')]({},_0x957c78,_0x3ade96[_0x8c0e('0x48')]);return _0x5d2828[_0x8c0e('0x58')](_0x957c78);}})['then'](function(_0x5c2ec0){if(_0x5c2ec0){_0x3dfd07=_0x5c2ec0['length'];if(!_0x3ade96['query'][_0x8c0e('0x3f')](_0x8c0e('0x55'))){_0x957c78[_0x8c0e('0x40')]=qs[_0x8c0e('0x40')](_0x3ade96[_0x8c0e('0x38')][_0x8c0e('0x40')]);_0x957c78[_0x8c0e('0x2a')]=qs[_0x8c0e('0x2a')](_0x3ade96['query'][_0x8c0e('0x2a')]);}return _0x5d2828[_0x8c0e('0x58')](_0x957c78);}})[_0x8c0e('0x1d')](function(_0x428190){if(_0x428190){return _0x428190?{'count':_0x3dfd07,'rows':_0x428190}:null;}})[_0x8c0e('0x1d')](respondWithResult(_0x5c3069,null))[_0x8c0e('0x26')](handleError(_0x5c3069,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index c1ba180..8c6112f 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 _0x5914=['rimraf','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','bluebird','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5914,0x127));var _0x4591=function(_0x114a5f,_0x53fcbe){_0x114a5f=_0x114a5f-0x0;var _0x55d365=_0x5914[_0x114a5f];return _0x55d365;};'use strict';var _=require('lodash');var util=require(_0x4591('0x0'));var logger=require(_0x4591('0x1'))(_0x4591('0x2'));var moment=require('moment');var BPromise=require(_0x4591('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4591('0x4'));var rimraf=require(_0x4591('0x5'));var config=require('../../config/environment');var attributes=require('./intDynamics365Configuration.attributes');module[_0x4591('0x6')]=function(_0x1cca24,_0x47f5d7){return _0x1cca24[_0x4591('0x7')](_0x4591('0x8'),attributes,{'tableName':_0x4591('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84fe=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x10a142,_0x57c8fa){var _0x113226=function(_0x48dc51){while(--_0x48dc51){_0x10a142['push'](_0x10a142['shift']());}};_0x113226(++_0x57c8fa);}(_0x84fe,0xdb));var _0xe84f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x84fe[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xe84f('0x0'));var util=require(_0xe84f('0x1'));var logger=require(_0xe84f('0x2'))(_0xe84f('0x3'));var moment=require(_0xe84f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe84f('0x5'));var rimraf=require(_0xe84f('0x6'));var config=require(_0xe84f('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xe84f('0x8')]=function(_0x33ac1a,_0x6d5bd0){return _0x33ac1a['define'](_0xe84f('0x9'),attributes,{'tableName':_0xe84f('0xa'),'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 4ebb7e9..91d1943 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 _0xeeb1=['jayson/promise','request','info','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x227a91,_0x47b106){var _0x3d229b=function(_0x112d0f){while(--_0x112d0f){_0x227a91['push'](_0x227a91['shift']());}};_0x3d229b(++_0x47b106);}(_0xeeb1,0x187));var _0x1eeb=function(_0x284609,_0x386b54){_0x284609=_0x284609-0x0;var _0x55116b=_0xeeb1[_0x284609];return _0x55116b;};'use strict';var _=require(_0x1eeb('0x0'));var util=require('util');var moment=require(_0x1eeb('0x1'));var BPromise=require(_0x1eeb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1eeb('0x3'));var db=require(_0x1eeb('0x4'))['db'];var utils=require(_0x1eeb('0x5'));var logger=require(_0x1eeb('0x6'))(_0x1eeb('0x7'));var config=require(_0x1eeb('0x8'));var jayson=require(_0x1eeb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e89fd,_0x5bf5f1,_0x55ce5a){return new BPromise(function(_0x1f8d19,_0x2fc5ad){return client[_0x1eeb('0xa')](_0x2e89fd,_0x55ce5a)['then'](function(_0x215956){logger[_0x1eeb('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5bf5f1,_0x1eeb('0xc'));logger['debug'](_0x1eeb('0xd'),_0x5bf5f1,_0x1eeb('0xc'),JSON['stringify'](_0x215956));if(_0x215956[_0x1eeb('0xe')]){if(_0x215956['error'][_0x1eeb('0xf')]===0x1f4){logger['error'](_0x1eeb('0x10'),_0x5bf5f1,_0x215956['error'][_0x1eeb('0x11')]);return _0x2fc5ad(_0x215956[_0x1eeb('0xe')][_0x1eeb('0x11')]);}logger[_0x1eeb('0xe')](_0x1eeb('0x10'),_0x5bf5f1,_0x215956['error'][_0x1eeb('0x11')]);return _0x1f8d19(_0x215956['error'][_0x1eeb('0x11')]);}else{logger[_0x1eeb('0xb')](_0x1eeb('0x10'),_0x5bf5f1,_0x1eeb('0xc'));_0x1f8d19(_0x215956[_0x1eeb('0x12')]['message']);}})[_0x1eeb('0x13')](function(_0x3eead0){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x5bf5f1,_0x3eead0);_0x2fc5ad(_0x3eead0);});});} \ No newline at end of file +var _0xea14=['client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x573083,_0x336e1c){var _0x4c9fdc=function(_0x3f3404){while(--_0x3f3404){_0x573083['push'](_0x573083['shift']());}};_0x4c9fdc(++_0x336e1c);}(_0xea14,0xc9));var _0x4ea1=function(_0x54fb1c,_0x2946d0){_0x54fb1c=_0x54fb1c-0x0;var _0x4f94b0=_0xea14[_0x54fb1c];return _0x4f94b0;};'use strict';var _=require(_0x4ea1('0x0'));var util=require(_0x4ea1('0x1'));var moment=require('moment');var BPromise=require(_0x4ea1('0x2'));var rs=require(_0x4ea1('0x3'));var fs=require('fs');var Redis=require(_0x4ea1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ea1('0x5'));var logger=require('../../config/logger')(_0x4ea1('0x6'));var config=require(_0x4ea1('0x7'));var jayson=require(_0x4ea1('0x8'));var client=jayson[_0x4ea1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29be6d,_0x31598a,_0x51a591){return new BPromise(function(_0x1b67ad,_0x4cc644){return client[_0x4ea1('0xa')](_0x29be6d,_0x51a591)[_0x4ea1('0xb')](function(_0x48b228){logger[_0x4ea1('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x31598a,'request\x20sent');logger['debug'](_0x4ea1('0xd'),_0x31598a,_0x4ea1('0xe'),JSON[_0x4ea1('0xf')](_0x48b228));if(_0x48b228[_0x4ea1('0x10')]){if(_0x48b228[_0x4ea1('0x10')][_0x4ea1('0x11')]===0x1f4){logger['error'](_0x4ea1('0x12'),_0x31598a,_0x48b228['error']['message']);return _0x4cc644(_0x48b228[_0x4ea1('0x10')][_0x4ea1('0x13')]);}logger[_0x4ea1('0x10')](_0x4ea1('0x12'),_0x31598a,_0x48b228[_0x4ea1('0x10')][_0x4ea1('0x13')]);return _0x1b67ad(_0x48b228[_0x4ea1('0x10')][_0x4ea1('0x13')]);}else{logger['info'](_0x4ea1('0x12'),_0x31598a,_0x4ea1('0xe'));_0x1b67ad(_0x48b228['result'][_0x4ea1('0x13')]);}})[_0x4ea1('0x14')](function(_0x28bd6b){logger[_0x4ea1('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x31598a,_0x28bd6b);_0x4cc644(_0x28bd6b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 479b7c5..ac4e1a4 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 _0x2bc6=['get','index','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','util','path','../../components/interaction/service','./intDynamics365Field.controller'];(function(_0x3a3afe,_0x15da25){var _0x262dab=function(_0x364a7f){while(--_0x364a7f){_0x3a3afe['push'](_0x3a3afe['shift']());}};_0x262dab(++_0x15da25);}(_0x2bc6,0x163));var _0x62bc=function(_0x3dae84,_0x2481cb){_0x3dae84=_0x3dae84-0x0;var _0xf4ca3a=_0x2bc6[_0x3dae84];return _0xf4ca3a;};'use strict';var multer=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var path=require(_0x62bc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x62bc('0x3'));var config=require('../../config/environment');var controller=require(_0x62bc('0x4'));router[_0x62bc('0x5')]('/',auth['isAuthenticated'](),controller[_0x62bc('0x6')]);router[_0x62bc('0x5')](_0x62bc('0x7'),auth[_0x62bc('0x8')](),controller[_0x62bc('0x9')]);router[_0x62bc('0xa')]('/',auth['isAuthenticated'](),controller[_0x62bc('0xb')]);router[_0x62bc('0xc')](_0x62bc('0x7'),auth[_0x62bc('0x8')](),controller['update']);router[_0x62bc('0xd')](_0x62bc('0x7'),auth[_0x62bc('0x8')](),controller['destroy']);module[_0x62bc('0xe')]=router; \ No newline at end of file +var _0xbe02=['/:id','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xbe02,0x146));var _0x2be0=function(_0x5de3f8,_0x5d2fda){_0x5de3f8=_0x5de3f8-0x0;var _0x80da1a=_0xbe02[_0x5de3f8];return _0x80da1a;};'use strict';var multer=require(_0x2be0('0x0'));var util=require(_0x2be0('0x1'));var path=require(_0x2be0('0x2'));var timeout=require(_0x2be0('0x3'));var express=require('express');var router=express[_0x2be0('0x4')]();var auth=require(_0x2be0('0x5'));var interaction=require(_0x2be0('0x6'));var config=require(_0x2be0('0x7'));var controller=require(_0x2be0('0x8'));router[_0x2be0('0x9')]('/',auth[_0x2be0('0xa')](),controller[_0x2be0('0xb')]);router[_0x2be0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2be0('0xc')]);router[_0x2be0('0xd')]('/',auth[_0x2be0('0xa')](),controller[_0x2be0('0xe')]);router[_0x2be0('0xf')](_0x2be0('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2be0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 68e927d..17c047f 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 _0x0641=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x33f550,_0x589b94){var _0x4f5bae=function(_0x3c986a){while(--_0x3c986a){_0x33f550['push'](_0x33f550['shift']());}};_0x4f5bae(++_0x589b94);}(_0x0641,0x140));var _0x1064=function(_0x4c02db,_0x1919d6){_0x4c02db=_0x4c02db-0x0;var _0x9c80ce=_0x0641[_0x4c02db];return _0x9c80ce;};'use strict';var Sequelize=require(_0x1064('0x0'));module[_0x1064('0x1')]={'type':{'type':Sequelize[_0x1064('0x2')](_0x1064('0x3'),_0x1064('0x4'),_0x1064('0x5'),_0x1064('0x6')),'defaultValue':_0x1064('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x1064('0x4'),_0x1064('0x5'))},'keyContent':{'type':Sequelize[_0x1064('0x7')]},'idField':{'type':Sequelize[_0x1064('0x7')]},'nameField':{'type':Sequelize[_0x1064('0x7')]},'customField':{'type':Sequelize[_0x1064('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1064('0x7')]}}; \ No newline at end of file +var _0x6797=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x4464b4,_0x29509d){var _0x2a3ac4=function(_0x19f78f){while(--_0x19f78f){_0x4464b4['push'](_0x4464b4['shift']());}};_0x2a3ac4(++_0x29509d);}(_0x6797,0xda));var _0x7679=function(_0x188958,_0x126ed1){_0x188958=_0x188958-0x0;var _0x4f89a2=_0x6797[_0x188958];return _0x4f89a2;};'use strict';var Sequelize=require(_0x7679('0x0'));module[_0x7679('0x1')]={'type':{'type':Sequelize[_0x7679('0x2')](_0x7679('0x3'),_0x7679('0x4'),_0x7679('0x5'),'keyValue'),'defaultValue':_0x7679('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7679('0x6')]},'keyType':{'type':Sequelize[_0x7679('0x2')](_0x7679('0x3'),_0x7679('0x4'),_0x7679('0x5'))},'keyContent':{'type':Sequelize[_0x7679('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7679('0x6')]},'customField':{'type':Sequelize[_0x7679('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index c55d79c..309ae5c 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 _0x9362=['include','findAll','rows','catch','show','params','keys','create','body','update','find','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','destroy','error','stack','name','send','map','Dynamics365Field','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','then','includeAll'];(function(_0x21b59b,_0x49582d){var _0x18f5d3=function(_0x2d4fc9){while(--_0x2d4fc9){_0x21b59b['push'](_0x21b59b['shift']());}};_0x18f5d3(++_0x49582d);}(_0x9362,0x169));var _0x2936=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9362[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x2936('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2936('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2936('0x2'));var rp=require(_0x2936('0x3'));var moment=require(_0x2936('0x4'));var BPromise=require(_0x2936('0x5'));var Mustache=require('mustache');var util=require(_0x2936('0x6'));var path=require('path');var sox=require(_0x2936('0x7'));var csv=require(_0x2936('0x8'));var ejs=require(_0x2936('0x9'));var fs=require('fs');var _=require(_0x2936('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2936('0xb'));var deskjs=require(_0x2936('0xc'));var toCsv=require(_0x2936('0x8'));var querystring=require('querystring');var Papa=require(_0x2936('0xd'));var Redis=require(_0x2936('0xe'));var authService=require(_0x2936('0xf'));var qs=require(_0x2936('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2936('0x11'));var logger=require(_0x2936('0x12'))(_0x2936('0x13'));var utils=require(_0x2936('0x14'));var config=require(_0x2936('0x15'));var db=require(_0x2936('0x16'))['db'];function respondWithStatusCode(_0x3f8d36,_0x597f3d){_0x597f3d=_0x597f3d||0xcc;return function(_0x5811b7){if(_0x5811b7){return _0x3f8d36[_0x2936('0x17')](_0x597f3d);}return _0x3f8d36[_0x2936('0x18')](_0x597f3d)[_0x2936('0x19')]();};}function respondWithResult(_0x56aea5,_0x23f951){_0x23f951=_0x23f951||0xc8;return function(_0x40b794){if(_0x40b794){return _0x56aea5[_0x2936('0x18')](_0x23f951)[_0x2936('0x1a')](_0x40b794);}};}function respondWithFilteredResult(_0x38c18b,_0x56a5ee){return function(_0x5f531f){if(_0x5f531f){var _0x4a1af9=_0x5f531f[_0x2936('0x1b')],_0x9fe85f=_0x56a5ee[_0x2936('0x1c')],_0x31f440=_0x56a5ee['offset']+_0x56a5ee[_0x2936('0x1d')],_0x448b44;if(_0x31f440>=_0x4a1af9){_0x31f440=_0x4a1af9;_0x448b44=0xc8;}else{_0x448b44=0xce;}_0x38c18b['status'](_0x448b44);return _0x38c18b['set']('Content-Range',_0x9fe85f+'-'+_0x31f440+'/'+_0x4a1af9)[_0x2936('0x1a')](_0x5f531f);}return null;};}function patchUpdates(_0x428e41){return function(_0x36f272){try{jsonpatch[_0x2936('0x1e')](_0x36f272,_0x428e41,!![]);}catch(_0x558e5c){return BPromise[_0x2936('0x1f')](_0x558e5c);}return _0x36f272[_0x2936('0x20')]();};}function saveUpdates(_0x26ab47,_0x4f6486){return function(_0xa7546b){if(_0xa7546b){return _0xa7546b['update'](_0x26ab47)['then'](function(_0x4d4976){return _0x4d4976;});}return null;};}function removeEntity(_0x253ae3,_0x81c228){return function(_0x57110b){if(_0x57110b){return _0x57110b[_0x2936('0x21')]()['then'](function(){_0x253ae3[_0x2936('0x18')](0xcc)[_0x2936('0x19')]();});}};}function handleEntityNotFound(_0x39db85,_0x43e278){return function(_0x3e2fc6){if(!_0x3e2fc6){_0x39db85[_0x2936('0x17')](0x194);}return _0x3e2fc6;};}function handleError(_0x588e48,_0x47ac99){_0x47ac99=_0x47ac99||0x1f4;return function(_0x5a60d9){logger[_0x2936('0x22')](_0x5a60d9[_0x2936('0x23')]);if(_0x5a60d9[_0x2936('0x24')]){delete _0x5a60d9['name'];}_0x588e48[_0x2936('0x18')](_0x47ac99)[_0x2936('0x25')](_0x5a60d9);};}exports['index']=function(_0x42af83,_0x32b12c){var _0x3687e9={},_0x2463bc={},_0xca20e8={'count':0x0,'rows':[]};var _0x3bca1d=_[_0x2936('0x26')](db[_0x2936('0x27')][_0x2936('0x28')],function(_0x2f8ebf){return{'name':_0x2f8ebf['fieldName'],'type':_0x2f8ebf[_0x2936('0x29')]['key']};});_0x2463bc[_0x2936('0x2a')]=_[_0x2936('0x26')](_0x3bca1d,'name');_0x2463bc[_0x2936('0x2b')]=_['keys'](_0x42af83[_0x2936('0x2b')]);_0x2463bc[_0x2936('0x2c')]=_[_0x2936('0x2d')](_0x2463bc[_0x2936('0x2a')],_0x2463bc[_0x2936('0x2b')]);_0x3687e9[_0x2936('0x2e')]=_[_0x2936('0x2d')](_0x2463bc['model'],qs[_0x2936('0x2f')](_0x42af83[_0x2936('0x2b')][_0x2936('0x2f')]));_0x3687e9[_0x2936('0x2e')]=_0x3687e9[_0x2936('0x2e')][_0x2936('0x30')]?_0x3687e9[_0x2936('0x2e')]:_0x2463bc[_0x2936('0x2a')];if(!_0x42af83['query'][_0x2936('0x31')]('nolimit')){_0x3687e9[_0x2936('0x1d')]=qs[_0x2936('0x1d')](_0x42af83['query']['limit']);_0x3687e9[_0x2936('0x1c')]=qs[_0x2936('0x1c')](_0x42af83[_0x2936('0x2b')][_0x2936('0x1c')]);}_0x3687e9[_0x2936('0x32')]=qs[_0x2936('0x33')](_0x42af83[_0x2936('0x2b')][_0x2936('0x33')]);_0x3687e9[_0x2936('0x34')]=qs['filters'](_['pick'](_0x42af83[_0x2936('0x2b')],_0x2463bc[_0x2936('0x2c')]),_0x3bca1d);if(_0x42af83[_0x2936('0x2b')]['filter']){_0x3687e9[_0x2936('0x34')]=_[_0x2936('0x35')](_0x3687e9[_0x2936('0x34')],{'$or':_['map'](_0x3bca1d,function(_0x3c39c4){if(_0x3c39c4[_0x2936('0x29')]!==_0x2936('0x36')){var _0x5373b3={};_0x5373b3[_0x3c39c4['name']]={'$like':'%'+_0x42af83[_0x2936('0x2b')][_0x2936('0x37')]+'%'};return _0x5373b3;}})});}_0x3687e9=_['merge']({},_0x3687e9,_0x42af83[_0x2936('0x38')]);var _0x1cf364={'where':_0x3687e9[_0x2936('0x34')]};return db[_0x2936('0x27')][_0x2936('0x1b')](_0x1cf364)[_0x2936('0x39')](function(_0x419dbd){_0xca20e8['count']=_0x419dbd;if(_0x42af83[_0x2936('0x2b')][_0x2936('0x3a')]){_0x3687e9[_0x2936('0x3b')]=[{'all':!![]}];}return db[_0x2936('0x27')][_0x2936('0x3c')](_0x3687e9);})[_0x2936('0x39')](function(_0x307fb0){_0xca20e8[_0x2936('0x3d')]=_0x307fb0;return _0xca20e8;})[_0x2936('0x39')](respondWithFilteredResult(_0x32b12c,_0x3687e9))[_0x2936('0x3e')](handleError(_0x32b12c,null));};exports[_0x2936('0x3f')]=function(_0xbd178f,_0x4d8872){var _0x526a5f={'raw':!![],'where':{'id':_0xbd178f[_0x2936('0x40')]['id']}},_0x126b36={};_0x126b36[_0x2936('0x2a')]=_['keys'](db[_0x2936('0x27')]['rawAttributes']);_0x126b36[_0x2936('0x2b')]=_[_0x2936('0x41')](_0xbd178f[_0x2936('0x2b')]);_0x126b36[_0x2936('0x2c')]=_[_0x2936('0x2d')](_0x126b36['model'],_0x126b36[_0x2936('0x2b')]);_0x526a5f[_0x2936('0x2e')]=_['intersection'](_0x126b36['model'],qs[_0x2936('0x2f')](_0xbd178f[_0x2936('0x2b')][_0x2936('0x2f')]));_0x526a5f[_0x2936('0x2e')]=_0x526a5f[_0x2936('0x2e')][_0x2936('0x30')]?_0x526a5f[_0x2936('0x2e')]:_0x126b36['model'];if(_0xbd178f[_0x2936('0x2b')][_0x2936('0x3a')]){_0x526a5f[_0x2936('0x3b')]=[{'all':!![]}];}_0x526a5f=_[_0x2936('0x35')]({},_0x526a5f,_0xbd178f['options']);return db[_0x2936('0x27')]['find'](_0x526a5f)[_0x2936('0x39')](handleEntityNotFound(_0x4d8872,null))[_0x2936('0x39')](respondWithResult(_0x4d8872,null))[_0x2936('0x3e')](handleError(_0x4d8872,null));};exports[_0x2936('0x42')]=function(_0x4878c4,_0x3705a0){return db[_0x2936('0x27')][_0x2936('0x42')](_0x4878c4[_0x2936('0x43')],{})[_0x2936('0x39')](respondWithResult(_0x3705a0,0xc9))['catch'](handleError(_0x3705a0,null));};exports[_0x2936('0x44')]=function(_0x29c964,_0x45b35b){if(_0x29c964[_0x2936('0x43')]['id']){delete _0x29c964[_0x2936('0x43')]['id'];}return db[_0x2936('0x27')][_0x2936('0x45')]({'where':{'id':_0x29c964[_0x2936('0x40')]['id']}})['then'](handleEntityNotFound(_0x45b35b,null))[_0x2936('0x39')](saveUpdates(_0x29c964['body'],null))[_0x2936('0x39')](respondWithResult(_0x45b35b,null))[_0x2936('0x3e')](handleError(_0x45b35b,null));};exports['destroy']=function(_0xec6bc2,_0x2f8c92){return db[_0x2936('0x27')]['find']({'where':{'id':_0xec6bc2[_0x2936('0x40')]['id']}})[_0x2936('0x39')](handleEntityNotFound(_0x2f8c92,null))['then'](removeEntity(_0x2f8c92,null))[_0x2936('0x3e')](handleError(_0x2f8c92,null));}; \ No newline at end of file +var _0x265e=['lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','reject','save','then','destroy','end','name','send','index','Dynamics365Field','rawAttributes','fieldName','key','model','map','keys','query','intersection','fields','attributes','where','filters','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x265e,0xc7));var _0xe265=function(_0x53c746,_0x4e32a1){_0x53c746=_0x53c746-0x0;var _0x35d963=_0x265e[_0x53c746];return _0x35d963;};'use strict';var pdf=require(_0xe265('0x0'));var emlformat=require(_0xe265('0x1'));var rimraf=require(_0xe265('0x2'));var zipdir=require(_0xe265('0x3'));var jsonpatch=require(_0xe265('0x4'));var rp=require(_0xe265('0x5'));var moment=require(_0xe265('0x6'));var BPromise=require(_0xe265('0x7'));var Mustache=require(_0xe265('0x8'));var util=require(_0xe265('0x9'));var path=require(_0xe265('0xa'));var sox=require(_0xe265('0xb'));var csv=require(_0xe265('0xc'));var ejs=require(_0xe265('0xd'));var fs=require('fs');var _=require(_0xe265('0xe'));var squel=require(_0xe265('0xf'));var crypto=require('crypto');var jsforce=require(_0xe265('0x10'));var deskjs=require(_0xe265('0x11'));var toCsv=require(_0xe265('0xc'));var querystring=require('querystring');var Papa=require(_0xe265('0x12'));var Redis=require(_0xe265('0x13'));var authService=require(_0xe265('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe265('0x15'));var logger=require(_0xe265('0x16'))(_0xe265('0x17'));var utils=require('../../config/utils');var config=require(_0xe265('0x18'));var db=require(_0xe265('0x19'))['db'];function respondWithStatusCode(_0x1642a3,_0x1f96f1){_0x1f96f1=_0x1f96f1||0xcc;return function(_0x329bd4){if(_0x329bd4){return _0x1642a3['sendStatus'](_0x1f96f1);}return _0x1642a3[_0xe265('0x1a')](_0x1f96f1)['end']();};}function respondWithResult(_0x1012e4,_0x396276){_0x396276=_0x396276||0xc8;return function(_0x40d7bb){if(_0x40d7bb){return _0x1012e4[_0xe265('0x1a')](_0x396276)[_0xe265('0x1b')](_0x40d7bb);}};}function respondWithFilteredResult(_0x420e13,_0x14b215){return function(_0x237463){if(_0x237463){var _0x5c341b=_0x237463[_0xe265('0x1c')],_0xeab637=_0x14b215[_0xe265('0x1d')],_0x50d39a=_0x14b215[_0xe265('0x1d')]+_0x14b215[_0xe265('0x1e')],_0x295dec;if(_0x50d39a>=_0x5c341b){_0x50d39a=_0x5c341b;_0x295dec=0xc8;}else{_0x295dec=0xce;}_0x420e13[_0xe265('0x1a')](_0x295dec);return _0x420e13[_0xe265('0x1f')]('Content-Range',_0xeab637+'-'+_0x50d39a+'/'+_0x5c341b)[_0xe265('0x1b')](_0x237463);}return null;};}function patchUpdates(_0x2d3626){return function(_0x3def44){try{jsonpatch['apply'](_0x3def44,_0x2d3626,!![]);}catch(_0x1612db){return BPromise[_0xe265('0x20')](_0x1612db);}return _0x3def44[_0xe265('0x21')]();};}function saveUpdates(_0x4c431c,_0x501fd7){return function(_0x55f077){if(_0x55f077){return _0x55f077['update'](_0x4c431c)[_0xe265('0x22')](function(_0xdd4d7d){return _0xdd4d7d;});}return null;};}function removeEntity(_0x1aaf45,_0x496475){return function(_0x2dcc78){if(_0x2dcc78){return _0x2dcc78[_0xe265('0x23')]()[_0xe265('0x22')](function(){_0x1aaf45[_0xe265('0x1a')](0xcc)[_0xe265('0x24')]();});}};}function handleEntityNotFound(_0x1897f7,_0x2e65aa){return function(_0x4e0967){if(!_0x4e0967){_0x1897f7['sendStatus'](0x194);}return _0x4e0967;};}function handleError(_0x40328d,_0x4da777){_0x4da777=_0x4da777||0x1f4;return function(_0x40c3cc){logger['error'](_0x40c3cc['stack']);if(_0x40c3cc['name']){delete _0x40c3cc[_0xe265('0x25')];}_0x40328d['status'](_0x4da777)[_0xe265('0x26')](_0x40c3cc);};}exports[_0xe265('0x27')]=function(_0x3acd71,_0x311e11){var _0x33e230={},_0x30a50c={},_0x2abba0={'count':0x0,'rows':[]};var _0x1fbe82=_['map'](db[_0xe265('0x28')][_0xe265('0x29')],function(_0x375b41){return{'name':_0x375b41[_0xe265('0x2a')],'type':_0x375b41['type'][_0xe265('0x2b')]};});_0x30a50c[_0xe265('0x2c')]=_[_0xe265('0x2d')](_0x1fbe82,'name');_0x30a50c['query']=_[_0xe265('0x2e')](_0x3acd71[_0xe265('0x2f')]);_0x30a50c['filters']=_[_0xe265('0x30')](_0x30a50c[_0xe265('0x2c')],_0x30a50c[_0xe265('0x2f')]);_0x33e230['attributes']=_[_0xe265('0x30')](_0x30a50c[_0xe265('0x2c')],qs[_0xe265('0x31')](_0x3acd71[_0xe265('0x2f')][_0xe265('0x31')]));_0x33e230[_0xe265('0x32')]=_0x33e230[_0xe265('0x32')]['length']?_0x33e230['attributes']:_0x30a50c['model'];if(!_0x3acd71[_0xe265('0x2f')]['hasOwnProperty']('nolimit')){_0x33e230['limit']=qs[_0xe265('0x1e')](_0x3acd71['query']['limit']);_0x33e230[_0xe265('0x1d')]=qs['offset'](_0x3acd71[_0xe265('0x2f')]['offset']);}_0x33e230['order']=qs['sort'](_0x3acd71[_0xe265('0x2f')]['sort']);_0x33e230[_0xe265('0x33')]=qs[_0xe265('0x34')](_[_0xe265('0x35')](_0x3acd71[_0xe265('0x2f')],_0x30a50c[_0xe265('0x34')]),_0x1fbe82);if(_0x3acd71[_0xe265('0x2f')]['filter']){_0x33e230[_0xe265('0x33')]=_['merge'](_0x33e230[_0xe265('0x33')],{'$or':_[_0xe265('0x2d')](_0x1fbe82,function(_0x3d085b){if(_0x3d085b[_0xe265('0x36')]!==_0xe265('0x37')){var _0x3ba859={};_0x3ba859[_0x3d085b[_0xe265('0x25')]]={'$like':'%'+_0x3acd71[_0xe265('0x2f')][_0xe265('0x38')]+'%'};return _0x3ba859;}})});}_0x33e230=_[_0xe265('0x39')]({},_0x33e230,_0x3acd71[_0xe265('0x3a')]);var _0x262343={'where':_0x33e230['where']};return db[_0xe265('0x28')][_0xe265('0x1c')](_0x262343)['then'](function(_0x3e755f){_0x2abba0[_0xe265('0x1c')]=_0x3e755f;if(_0x3acd71[_0xe265('0x2f')][_0xe265('0x3b')]){_0x33e230[_0xe265('0x3c')]=[{'all':!![]}];}return db[_0xe265('0x28')][_0xe265('0x3d')](_0x33e230);})[_0xe265('0x22')](function(_0x1ddad8){_0x2abba0[_0xe265('0x3e')]=_0x1ddad8;return _0x2abba0;})['then'](respondWithFilteredResult(_0x311e11,_0x33e230))[_0xe265('0x3f')](handleError(_0x311e11,null));};exports[_0xe265('0x40')]=function(_0x26c2c4,_0x32a58f){var _0x53f594={'raw':!![],'where':{'id':_0x26c2c4[_0xe265('0x41')]['id']}},_0x1bbeed={};_0x1bbeed['model']=_[_0xe265('0x2e')](db['Dynamics365Field'][_0xe265('0x29')]);_0x1bbeed[_0xe265('0x2f')]=_[_0xe265('0x2e')](_0x26c2c4[_0xe265('0x2f')]);_0x1bbeed[_0xe265('0x34')]=_[_0xe265('0x30')](_0x1bbeed[_0xe265('0x2c')],_0x1bbeed[_0xe265('0x2f')]);_0x53f594[_0xe265('0x32')]=_['intersection'](_0x1bbeed[_0xe265('0x2c')],qs[_0xe265('0x31')](_0x26c2c4[_0xe265('0x2f')][_0xe265('0x31')]));_0x53f594[_0xe265('0x32')]=_0x53f594[_0xe265('0x32')][_0xe265('0x42')]?_0x53f594[_0xe265('0x32')]:_0x1bbeed[_0xe265('0x2c')];if(_0x26c2c4[_0xe265('0x2f')][_0xe265('0x3b')]){_0x53f594['include']=[{'all':!![]}];}_0x53f594=_[_0xe265('0x39')]({},_0x53f594,_0x26c2c4[_0xe265('0x3a')]);return db['Dynamics365Field'][_0xe265('0x43')](_0x53f594)[_0xe265('0x22')](handleEntityNotFound(_0x32a58f,null))[_0xe265('0x22')](respondWithResult(_0x32a58f,null))['catch'](handleError(_0x32a58f,null));};exports[_0xe265('0x44')]=function(_0x3bf780,_0x2b27bc){return db[_0xe265('0x28')][_0xe265('0x44')](_0x3bf780['body'],{})[_0xe265('0x22')](respondWithResult(_0x2b27bc,0xc9))[_0xe265('0x3f')](handleError(_0x2b27bc,null));};exports[_0xe265('0x45')]=function(_0x173507,_0x3bab53){if(_0x173507['body']['id']){delete _0x173507[_0xe265('0x46')]['id'];}return db[_0xe265('0x28')][_0xe265('0x43')]({'where':{'id':_0x173507[_0xe265('0x41')]['id']}})[_0xe265('0x22')](handleEntityNotFound(_0x3bab53,null))[_0xe265('0x22')](saveUpdates(_0x173507[_0xe265('0x46')],null))[_0xe265('0x22')](respondWithResult(_0x3bab53,null))['catch'](handleError(_0x3bab53,null));};exports[_0xe265('0x23')]=function(_0x370c4f,_0x3a327c){return db[_0xe265('0x28')][_0xe265('0x43')]({'where':{'id':_0x370c4f['params']['id']}})[_0xe265('0x22')](handleEntityNotFound(_0x3a327c,null))['then'](removeEntity(_0x3a327c,null))[_0xe265('0x3f')](handleError(_0x3a327c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2d08c82..1069dce 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 _0xdb05=['FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','idField'];(function(_0x4a2cf5,_0x5f4992){var _0x5d4d17=function(_0x4bf2a7){while(--_0x4bf2a7){_0x4a2cf5['push'](_0x4a2cf5['shift']());}};_0x5d4d17(++_0x5f4992);}(_0xdb05,0xd3));var _0x5db0=function(_0x1a621b,_0x18aad1){_0x1a621b=_0x1a621b-0x0;var _0x34a43d=_0xdb05[_0x1a621b];return _0x34a43d;};'use strict';var _=require(_0x5db0('0x0'));var util=require(_0x5db0('0x1'));var logger=require(_0x5db0('0x2'))(_0x5db0('0x3'));var moment=require('moment');var BPromise=require(_0x5db0('0x4'));var rp=require(_0x5db0('0x5'));var fs=require('fs');var path=require(_0x5db0('0x6'));var rimraf=require(_0x5db0('0x7'));var config=require('../../config/environment');var attributes=require(_0x5db0('0x8'));module[_0x5db0('0x9')]=function(_0x52c590,_0x5a76c3){return _0x52c590[_0x5db0('0xa')](_0x5db0('0xb'),attributes,{'tableName':_0x5db0('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x5db0('0xd'),_0x5db0('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5873=['dynamics365_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intDynamics365Field.attributes','define','int_dynamics365_fields'];(function(_0x2c0441,_0x144a5d){var _0x19de8c=function(_0x5e4aa6){while(--_0x5e4aa6){_0x2c0441['push'](_0x2c0441['shift']());}};_0x19de8c(++_0x144a5d);}(_0x5873,0x120));var _0x3587=function(_0x522f64,_0x4fd021){_0x522f64=_0x522f64-0x0;var _0x27452c=_0x5873[_0x522f64];return _0x27452c;};'use strict';var _=require(_0x3587('0x0'));var util=require(_0x3587('0x1'));var logger=require(_0x3587('0x2'))(_0x3587('0x3'));var moment=require(_0x3587('0x4'));var BPromise=require('bluebird');var rp=require(_0x3587('0x5'));var fs=require('fs');var path=require(_0x3587('0x6'));var rimraf=require('rimraf');var config=require(_0x3587('0x7'));var attributes=require(_0x3587('0x8'));module['exports']=function(_0x1c5ba8,_0x36b1f6){return _0x1c5ba8[_0x3587('0x9')]('Dynamics365Field',attributes,{'tableName':_0x3587('0xa'),'paranoid':![],'indexes':[{'name':_0x3587('0xb'),'fields':[_0x3587('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 4d09d1a..ba31b92 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 _0x4e83=['info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','then'];(function(_0x52f848,_0x3d48b3){var _0x2798ac=function(_0x3a7fe5){while(--_0x3a7fe5){_0x52f848['push'](_0x52f848['shift']());}};_0x2798ac(++_0x3d48b3);}(_0x4e83,0x1ae));var _0x34e8=function(_0x3b1106,_0x4bd523){_0x3b1106=_0x3b1106-0x0;var _0x1fbeef=_0x4e83[_0x3b1106];return _0x1fbeef;};'use strict';var _=require(_0x34e8('0x0'));var util=require('util');var moment=require(_0x34e8('0x1'));var BPromise=require(_0x34e8('0x2'));var rs=require(_0x34e8('0x3'));var fs=require('fs');var Redis=require(_0x34e8('0x4'));var db=require(_0x34e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x34e8('0x6'));var client=jayson[_0x34e8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30a3c4,_0x4567bd,_0x28677c){return new BPromise(function(_0x5b5ddc,_0x44d3bf){return client[_0x34e8('0x8')](_0x30a3c4,_0x28677c)[_0x34e8('0x9')](function(_0x5cb792){logger[_0x34e8('0xa')](_0x34e8('0xb'),_0x4567bd,_0x34e8('0xc'));logger[_0x34e8('0xd')](_0x34e8('0xe'),_0x4567bd,_0x34e8('0xc'),JSON[_0x34e8('0xf')](_0x5cb792));if(_0x5cb792[_0x34e8('0x10')]){if(_0x5cb792[_0x34e8('0x10')]['code']===0x1f4){logger[_0x34e8('0x10')](_0x34e8('0xb'),_0x4567bd,_0x5cb792['error'][_0x34e8('0x11')]);return _0x44d3bf(_0x5cb792[_0x34e8('0x10')][_0x34e8('0x11')]);}logger[_0x34e8('0x10')](_0x34e8('0xb'),_0x4567bd,_0x5cb792[_0x34e8('0x10')][_0x34e8('0x11')]);return _0x5b5ddc(_0x5cb792[_0x34e8('0x10')][_0x34e8('0x11')]);}else{logger['info'](_0x34e8('0xb'),_0x4567bd,_0x34e8('0xc'));_0x5b5ddc(_0x5cb792[_0x34e8('0x12')][_0x34e8('0x11')]);}})[_0x34e8('0x13')](function(_0x4a4d17){logger[_0x34e8('0x10')](_0x34e8('0xb'),_0x4567bd,_0x4a4d17);_0x44d3bf(_0x4a4d17);});});} \ No newline at end of file +var _0x15ef=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','Dynamics365Field,\x20%s,\x20%s','message','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0xe50e1,_0x30bf72){var _0x441f9a=function(_0x40ac92){while(--_0x40ac92){_0xe50e1['push'](_0xe50e1['shift']());}};_0x441f9a(++_0x30bf72);}(_0x15ef,0x80));var _0xf15e=function(_0x52235a,_0x5c5d57){_0x52235a=_0x52235a-0x0;var _0x3bb8bd=_0x15ef[_0x52235a];return _0x3bb8bd;};'use strict';var _=require('lodash');var util=require(_0xf15e('0x0'));var moment=require(_0xf15e('0x1'));var BPromise=require('bluebird');var rs=require(_0xf15e('0x2'));var fs=require('fs');var Redis=require(_0xf15e('0x3'));var db=require(_0xf15e('0x4'))['db'];var utils=require(_0xf15e('0x5'));var logger=require(_0xf15e('0x6'))('rpc');var config=require(_0xf15e('0x7'));var jayson=require(_0xf15e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x66708e,_0x232359,_0x490097){return new BPromise(function(_0x2d6e94,_0x4daf89){return client[_0xf15e('0x9')](_0x66708e,_0x490097)[_0xf15e('0xa')](function(_0x16fedb){logger[_0xf15e('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x232359,'request\x20sent');logger['debug'](_0xf15e('0xc'),_0x232359,_0xf15e('0xd'),JSON['stringify'](_0x16fedb));if(_0x16fedb['error']){if(_0x16fedb['error'][_0xf15e('0xe')]===0x1f4){logger[_0xf15e('0xf')](_0xf15e('0x10'),_0x232359,_0x16fedb['error'][_0xf15e('0x11')]);return _0x4daf89(_0x16fedb[_0xf15e('0xf')][_0xf15e('0x11')]);}logger['error'](_0xf15e('0x10'),_0x232359,_0x16fedb[_0xf15e('0xf')][_0xf15e('0x11')]);return _0x2d6e94(_0x16fedb[_0xf15e('0xf')][_0xf15e('0x11')]);}else{logger[_0xf15e('0xb')](_0xf15e('0x10'),_0x232359,_0xf15e('0xd'));_0x2d6e94(_0x16fedb['result'][_0xf15e('0x11')]);}})[_0xf15e('0x12')](function(_0x4a2c32){logger[_0xf15e('0xf')](_0xf15e('0x10'),_0x232359,_0x4a2c32);_0x4daf89(_0x4a2c32);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7d199be..ab6067b 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 _0x0c87=['/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations'];(function(_0x4541da,_0x104a44){var _0xf2bbf7=function(_0x3db582){while(--_0x3db582){_0x4541da['push'](_0x4541da['shift']());}};_0xf2bbf7(++_0x104a44);}(_0x0c87,0x1ad));var _0x70c8=function(_0x2d3aed,_0x1b36e5){_0x2d3aed=_0x2d3aed-0x0;var _0x57fb4e=_0x0c87[_0x2d3aed];return _0x57fb4e;};'use strict';var multer=require(_0x70c8('0x0'));var util=require(_0x70c8('0x1'));var path=require(_0x70c8('0x2'));var timeout=require(_0x70c8('0x3'));var express=require('express');var router=express[_0x70c8('0x4')]();var auth=require(_0x70c8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x70c8('0x6'));router[_0x70c8('0x7')]('/',auth[_0x70c8('0x8')](),controller['index']);router[_0x70c8('0x7')](_0x70c8('0x9'),auth[_0x70c8('0x8')](),controller['show']);router[_0x70c8('0x7')](_0x70c8('0xa'),auth[_0x70c8('0x8')](),controller[_0x70c8('0xb')]);router[_0x70c8('0x7')](_0x70c8('0xc'),auth[_0x70c8('0x8')](),controller[_0x70c8('0xd')]);router[_0x70c8('0xe')]('/',auth[_0x70c8('0x8')](),controller[_0x70c8('0xf')]);router[_0x70c8('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x70c8('0x10')]);router['put'](_0x70c8('0x9'),auth[_0x70c8('0x8')](),controller[_0x70c8('0x11')]);router[_0x70c8('0x12')](_0x70c8('0x9'),auth[_0x70c8('0x8')](),controller[_0x70c8('0x13')]);module[_0x70c8('0x14')]=router; \ No newline at end of file +var _0x512d=['util','connect-timeout','Router','../../config/environment','isAuthenticated','index','get','/:id/configurations','getConfigurations','getFields','post','create','/:id','delete','destroy','exports','multer'];(function(_0x5398ca,_0x530e4c){var _0x6c8338=function(_0x1e77fd){while(--_0x1e77fd){_0x5398ca['push'](_0x5398ca['shift']());}};_0x6c8338(++_0x530e4c);}(_0x512d,0x98));var _0xd512=function(_0x43ddaf,_0x443f23){_0x43ddaf=_0x43ddaf-0x0;var _0xc6c9e8=_0x512d[_0x43ddaf];return _0xc6c9e8;};'use strict';var multer=require(_0xd512('0x0'));var util=require(_0xd512('0x1'));var path=require('path');var timeout=require(_0xd512('0x2'));var express=require('express');var router=express[_0xd512('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd512('0x4'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0xd512('0x5')](),controller[_0xd512('0x6')]);router[_0xd512('0x7')]('/:id',auth[_0xd512('0x5')](),controller['show']);router[_0xd512('0x7')](_0xd512('0x8'),auth['isAuthenticated'](),controller[_0xd512('0x9')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xd512('0xa')]);router[_0xd512('0xb')]('/',auth['isAuthenticated'](),controller[_0xd512('0xc')]);router['post'](_0xd512('0x8'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xd512('0xd'),auth[_0xd512('0x5')](),controller['update']);router[_0xd512('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd512('0xf')]);module[_0xd512('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 7aad28e..7711645 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 _0x4808=['sequelize','exports','STRING','remoteUri'];(function(_0x93dd51,_0x5f32b4){var _0x248868=function(_0x1b8dc1){while(--_0x1b8dc1){_0x93dd51['push'](_0x93dd51['shift']());}};_0x248868(++_0x5f32b4);}(_0x4808,0x160));var _0x8480=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x4808[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require(_0x8480('0x0'));module[_0x8480('0x1')]={'name':{'type':Sequelize[_0x8480('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8480('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x8480('0x2')]},'remoteUri':{'type':Sequelize[_0x8480('0x2')],'unique':_0x8480('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xea4e=['sequelize','STRING'];(function(_0xc14e9b,_0x5c3047){var _0x48f298=function(_0x3ddc68){while(--_0x3ddc68){_0xc14e9b['push'](_0xc14e9b['shift']());}};_0x48f298(++_0x5c3047);}(_0xea4e,0x10c));var _0xeea4=function(_0x32cce8,_0x18762f){_0x32cce8=_0x32cce8-0x0;var _0x4a732b=_0xea4e[_0x32cce8];return _0x4a732b;};'use strict';var Sequelize=require(_0xeea4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xeea4('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xeea4('0x1')]},'remoteUri':{'type':Sequelize[_0xeea4('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xeea4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index f7c52cf..e2ef9f8 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 _0xf494=['set','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','apiKey','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','agent','description','source','ticket_type','group','company','remove','includes','default','custom_text','custom_dropdown','label','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result','status','end','count','limit'];(function(_0x2fcb60,_0x51be6f){var _0x25bfd1=function(_0x2c4914){while(--_0x2c4914){_0x2fcb60['push'](_0x2fcb60['shift']());}};_0x25bfd1(++_0x51be6f);}(_0xf494,0x1c6));var _0x4f49=function(_0x1f19bc,_0x3e307b){_0x1f19bc=_0x1f19bc-0x0;var _0x43cbb0=_0xf494[_0x1f19bc];return _0x43cbb0;};'use strict';var pdf=require(_0x4f49('0x0'));var emlformat=require(_0x4f49('0x1'));var rimraf=require(_0x4f49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f49('0x3'));var rp=require(_0x4f49('0x4'));var moment=require(_0x4f49('0x5'));var BPromise=require(_0x4f49('0x6'));var Mustache=require(_0x4f49('0x7'));var util=require(_0x4f49('0x8'));var path=require(_0x4f49('0x9'));var sox=require(_0x4f49('0xa'));var csv=require(_0x4f49('0xb'));var ejs=require(_0x4f49('0xc'));var fs=require('fs');var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xb'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x4f49('0x18'));var jayson=require(_0x4f49('0x19'));var client=jayson['client'][_0x4f49('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x111a8b,_0x1b9145,_0x2efe49){if(_0x2efe49){var _0x1a0f1e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a0f1e[_0x4f49('0x1b')](_0x1b9145)){return _0x111a8b;}else{throw new db[(_0x4f49('0x1c'))]['ValidationError'](_0x4f49('0x1d'));}}else{return _0x111a8b;}}function respondWithRpcPromise(_0x1f2d0d,_0x415e83,_0x5878f4,_0x5bdfaf){return new BPromise(function(_0x2f0a0d,_0x2ecaaa){var _0x74886e=_0x5bdfaf||client;return _0x74886e['request'](_0x1f2d0d,_0x5878f4)[_0x4f49('0x1e')](function(_0x399be7){logger[_0x4f49('0x1f')]('FreshdeskAccount,\x20%s,\x20%s',_0x415e83,'request\x20sent');logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x415e83,_0x4f49('0x20'),JSON[_0x4f49('0x21')](_0x399be7));if(_0x399be7[_0x4f49('0x22')]){if(_0x399be7[_0x4f49('0x22')]['code']===0x1f4){logger[_0x4f49('0x22')](_0x4f49('0x23'),_0x415e83,_0x399be7[_0x4f49('0x22')][_0x4f49('0x24')]);return _0x2ecaaa(_0x399be7[_0x4f49('0x22')]['message']);}logger[_0x4f49('0x22')](_0x4f49('0x23'),_0x415e83,_0x399be7[_0x4f49('0x22')]['message']);return _0x2f0a0d(_0x399be7[_0x4f49('0x22')][_0x4f49('0x24')]);}else{logger[_0x4f49('0x1f')](_0x4f49('0x23'),_0x415e83,_0x4f49('0x20'));_0x2f0a0d(_0x399be7[_0x4f49('0x25')]['message']);}})['catch'](function(_0x3a947b){logger[_0x4f49('0x22')]('FreshdeskAccount,\x20%s,\x20%s',_0x415e83,_0x3a947b);_0x2ecaaa(_0x3a947b);});});}function respondWithStatusCode(_0x408552,_0x2c1519){_0x2c1519=_0x2c1519||0xcc;return function(_0x35f8e0){if(_0x35f8e0){return _0x408552['sendStatus'](_0x2c1519);}return _0x408552[_0x4f49('0x26')](_0x2c1519)[_0x4f49('0x27')]();};}function respondWithResult(_0x298785,_0x148153){_0x148153=_0x148153||0xc8;return function(_0xfefbab){if(_0xfefbab){return _0x298785[_0x4f49('0x26')](_0x148153)['json'](_0xfefbab);}};}function respondWithFilteredResult(_0x50c571,_0x239f44){return function(_0x2c00ee){if(_0x2c00ee){var _0x605c91=_0x2c00ee[_0x4f49('0x28')],_0x560050=_0x239f44['offset'],_0x3cbfbd=_0x239f44['offset']+_0x239f44[_0x4f49('0x29')],_0x206203;if(_0x3cbfbd>=_0x605c91){_0x3cbfbd=_0x605c91;_0x206203=0xc8;}else{_0x206203=0xce;}_0x50c571[_0x4f49('0x26')](_0x206203);return _0x50c571[_0x4f49('0x2a')]('Content-Range',_0x560050+'-'+_0x3cbfbd+'/'+_0x605c91)[_0x4f49('0x2b')](_0x2c00ee);}return null;};}function patchUpdates(_0x35aa33){return function(_0x173657){try{jsonpatch[_0x4f49('0x2c')](_0x173657,_0x35aa33,!![]);}catch(_0x3e103b){return BPromise[_0x4f49('0x2d')](_0x3e103b);}return _0x173657[_0x4f49('0x2e')]();};}function saveUpdates(_0x45ae19,_0x1f38d3){return function(_0x310ee2){if(_0x310ee2){return _0x310ee2[_0x4f49('0x2f')](_0x45ae19)[_0x4f49('0x1e')](function(_0x29ff83){return _0x29ff83;});}return null;};}function removeEntity(_0x6625cd,_0x135d17){return function(_0x97ef98){if(_0x97ef98){return _0x97ef98[_0x4f49('0x30')]()[_0x4f49('0x1e')](function(){_0x6625cd[_0x4f49('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d0d2,_0x46b7ba){return function(_0x24f568){if(!_0x24f568){_0x45d0d2[_0x4f49('0x31')](0x194);}return _0x24f568;};}function handleError(_0x1c3af8,_0x15e82b){_0x15e82b=_0x15e82b||0x1f4;return function(_0x2cbe4e){logger[_0x4f49('0x22')](_0x2cbe4e[_0x4f49('0x32')]);if(_0x2cbe4e[_0x4f49('0x33')]){delete _0x2cbe4e[_0x4f49('0x33')];}_0x1c3af8[_0x4f49('0x26')](_0x15e82b)[_0x4f49('0x34')](_0x2cbe4e);};}exports['index']=function(_0x371282,_0x27b7a9){var _0x36000a={},_0x26014f={},_0x1c1e9b={'count':0x0,'rows':[]};var _0x3ee818=_[_0x4f49('0x35')](db[_0x4f49('0x36')][_0x4f49('0x37')],function(_0xf8c377){return{'name':_0xf8c377[_0x4f49('0x38')],'type':_0xf8c377[_0x4f49('0x39')][_0x4f49('0x3a')]};});_0x26014f[_0x4f49('0x3b')]=_['map'](_0x3ee818,_0x4f49('0x33'));_0x26014f[_0x4f49('0x3c')]=_['keys'](_0x371282[_0x4f49('0x3c')]);_0x26014f[_0x4f49('0x3d')]=_['intersection'](_0x26014f[_0x4f49('0x3b')],_0x26014f[_0x4f49('0x3c')]);_0x36000a[_0x4f49('0x3e')]=_[_0x4f49('0x3f')](_0x26014f[_0x4f49('0x3b')],qs[_0x4f49('0x40')](_0x371282[_0x4f49('0x3c')]['fields']));_0x36000a['attributes']=_0x36000a['attributes'][_0x4f49('0x41')]?_0x36000a[_0x4f49('0x3e')]:_0x26014f[_0x4f49('0x3b')];if(!_0x371282[_0x4f49('0x3c')][_0x4f49('0x42')](_0x4f49('0x43'))){_0x36000a[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x371282[_0x4f49('0x3c')]['limit']);_0x36000a['offset']=qs[_0x4f49('0x44')](_0x371282[_0x4f49('0x3c')][_0x4f49('0x44')]);}_0x36000a['order']=qs[_0x4f49('0x45')](_0x371282['query']['sort']);_0x36000a[_0x4f49('0x46')]=qs[_0x4f49('0x3d')](_[_0x4f49('0x47')](_0x371282['query'],_0x26014f[_0x4f49('0x3d')]),_0x3ee818);if(_0x371282[_0x4f49('0x3c')]['filter']){_0x36000a[_0x4f49('0x46')]=_['merge'](_0x36000a[_0x4f49('0x46')],{'$or':_[_0x4f49('0x35')](_0x3ee818,function(_0x133f39){if(_0x133f39['type']!==_0x4f49('0x48')){var _0x1e5f0b={};_0x1e5f0b[_0x133f39[_0x4f49('0x33')]]={'$like':'%'+_0x371282[_0x4f49('0x3c')][_0x4f49('0x49')]+'%'};return _0x1e5f0b;}})});}_0x36000a=_[_0x4f49('0x4a')]({},_0x36000a,_0x371282[_0x4f49('0x4b')]);var _0x356785={'where':_0x36000a[_0x4f49('0x46')]};return db[_0x4f49('0x36')]['count'](_0x356785)[_0x4f49('0x1e')](function(_0x44bf1d){_0x1c1e9b['count']=_0x44bf1d;if(_0x371282[_0x4f49('0x3c')]['includeAll']){_0x36000a[_0x4f49('0x4c')]=[{'all':!![]}];}return db[_0x4f49('0x36')][_0x4f49('0x4d')](_0x36000a);})[_0x4f49('0x1e')](function(_0x4a91ec){_0x1c1e9b[_0x4f49('0x4e')]=_0x4a91ec;return _0x1c1e9b;})[_0x4f49('0x1e')](respondWithFilteredResult(_0x27b7a9,_0x36000a))[_0x4f49('0x4f')](handleError(_0x27b7a9,null));};exports[_0x4f49('0x50')]=function(_0x3ec266,_0x72ea05){var _0x37fdb7={'raw':![],'where':{'id':_0x3ec266[_0x4f49('0x51')]['id']}},_0xd282c={};_0xd282c[_0x4f49('0x3b')]=_[_0x4f49('0x52')](db[_0x4f49('0x36')][_0x4f49('0x37')]);_0xd282c[_0x4f49('0x3c')]=_[_0x4f49('0x52')](_0x3ec266[_0x4f49('0x3c')]);_0xd282c['filters']=_['intersection'](_0xd282c[_0x4f49('0x3b')],_0xd282c[_0x4f49('0x3c')]);_0x37fdb7[_0x4f49('0x3e')]=_[_0x4f49('0x3f')](_0xd282c[_0x4f49('0x3b')],qs[_0x4f49('0x40')](_0x3ec266[_0x4f49('0x3c')]['fields']));_0x37fdb7[_0x4f49('0x3e')]=_0x37fdb7['attributes'][_0x4f49('0x41')]?_0x37fdb7[_0x4f49('0x3e')]:_0xd282c[_0x4f49('0x3b')];if(_0x3ec266[_0x4f49('0x3c')]['includeAll']){_0x37fdb7[_0x4f49('0x4c')]=[{'all':!![]}];}_0x37fdb7=_['merge']({},_0x37fdb7,_0x3ec266['options']);return db[_0x4f49('0x36')][_0x4f49('0x53')](_0x37fdb7)[_0x4f49('0x1e')](handleEntityNotFound(_0x72ea05,null))[_0x4f49('0x1e')](respondWithResult(_0x72ea05,null))['catch'](handleError(_0x72ea05,null));};exports['create']=function(_0xd7f47b,_0x291a45){return db['FreshdeskAccount'][_0x4f49('0x54')](_0xd7f47b['body'],{})['then'](respondWithResult(_0x291a45,0xc9))[_0x4f49('0x4f')](handleError(_0x291a45,null));};exports['update']=function(_0xfa7dd6,_0x492aaa){if(_0xfa7dd6[_0x4f49('0x55')]['id']){delete _0xfa7dd6[_0x4f49('0x55')]['id'];}return db[_0x4f49('0x36')][_0x4f49('0x53')]({'where':{'id':_0xfa7dd6[_0x4f49('0x51')]['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x492aaa,null))[_0x4f49('0x1e')](saveUpdates(_0xfa7dd6[_0x4f49('0x55')],null))['then'](respondWithResult(_0x492aaa,null))[_0x4f49('0x4f')](handleError(_0x492aaa,null));};exports['destroy']=function(_0x213608,_0x1f640d){return db[_0x4f49('0x36')][_0x4f49('0x53')]({'where':{'id':_0x213608[_0x4f49('0x51')]['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x1f640d,null))['then'](removeEntity(_0x1f640d,null))[_0x4f49('0x4f')](handleError(_0x1f640d,null));};exports[_0x4f49('0x56')]=function(_0x5e3568,_0x5d2b3c,_0x121c04){var _0x447dde={};var _0x2e0df5={};var _0x2409f1;var _0x19a788;return db['FreshdeskAccount'][_0x4f49('0x57')]({'where':{'id':_0x5e3568['params']['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x5d2b3c,null))[_0x4f49('0x1e')](function(_0x2a2b0d){if(_0x2a2b0d){_0x2409f1=_0x2a2b0d;_0x2e0df5['model']=_[_0x4f49('0x52')](db[_0x4f49('0x58')][_0x4f49('0x37')]);_0x2e0df5[_0x4f49('0x3c')]=_['keys'](_0x5e3568[_0x4f49('0x3c')]);_0x2e0df5[_0x4f49('0x3d')]=_['intersection'](_0x2e0df5[_0x4f49('0x3b')],_0x2e0df5[_0x4f49('0x3c')]);_0x447dde[_0x4f49('0x3e')]=_[_0x4f49('0x3f')](_0x2e0df5[_0x4f49('0x3b')],qs[_0x4f49('0x40')](_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x40')]));_0x447dde['attributes']=_0x447dde[_0x4f49('0x3e')][_0x4f49('0x41')]?_0x447dde[_0x4f49('0x3e')]:_0x2e0df5[_0x4f49('0x3b')];_0x447dde[_0x4f49('0x59')]=qs[_0x4f49('0x45')](_0x5e3568[_0x4f49('0x3c')]['sort']);_0x447dde[_0x4f49('0x46')]=qs['filters'](_[_0x4f49('0x47')](_0x5e3568[_0x4f49('0x3c')],_0x2e0df5[_0x4f49('0x3d')]));if(_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x49')]){_0x447dde[_0x4f49('0x46')]=_[_0x4f49('0x4a')](_0x447dde[_0x4f49('0x46')],{'$or':_[_0x4f49('0x35')](_0x447dde[_0x4f49('0x3e')],function(_0x545552){var _0x2f9f2e={};_0x2f9f2e[_0x545552]={'$like':'%'+_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x49')]+'%'};return _0x2f9f2e;})});}_0x447dde=_[_0x4f49('0x4a')]({},_0x447dde,_0x5e3568['options']);return _0x2409f1['getConfigurations'](_0x447dde);}})[_0x4f49('0x1e')](function(_0x5e4879){if(_0x5e4879){_0x19a788=_0x5e4879[_0x4f49('0x41')];if(!_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x42')](_0x4f49('0x43'))){_0x447dde[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x29')]);_0x447dde[_0x4f49('0x44')]=qs[_0x4f49('0x44')](_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x44')]);}return _0x2409f1[_0x4f49('0x56')](_0x447dde);}})[_0x4f49('0x1e')](function(_0x234984){if(_0x234984){return _0x234984?{'count':_0x19a788,'rows':_0x234984}:null;}})[_0x4f49('0x1e')](respondWithResult(_0x5d2b3c,null))[_0x4f49('0x4f')](handleError(_0x5d2b3c,null));};exports[_0x4f49('0x5a')]=function(_0x1f9161,_0x1434ea,_0x2c3962){if(_0x1f9161[_0x4f49('0x55')]['id']){delete _0x1f9161[_0x4f49('0x55')]['id'];}return db[_0x4f49('0x36')][_0x4f49('0x57')]({'where':{'id':_0x1f9161['params']['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x1434ea,null))['then'](function(_0x31df7f){if(_0x31df7f){_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5b')]=_0x31df7f['id'];_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5c')]=integrations[_0x4f49('0x5d')](_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5e')],_0x1f9161[_0x4f49('0x55')]['type']);_0x1f9161['body'][_0x4f49('0x5f')]=integrations['getDescriptions'](_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5e')],_0x1f9161[_0x4f49('0x55')][_0x4f49('0x39')]);return db[_0x4f49('0x58')]['create'](_0x1f9161['body'],{'include':[{'model':db[_0x4f49('0x60')],'as':_0x4f49('0x5c')},{'model':db['FreshdeskField'],'as':_0x4f49('0x5f')}]});}return null;})[_0x4f49('0x1e')](respondWithResult(_0x1434ea,null))['catch'](handleError(_0x1434ea,null));};exports[_0x4f49('0x61')]=function(_0x5b88aa,_0x121972,_0x160cf8){var _0x544356='';return db[_0x4f49('0x36')][_0x4f49('0x57')]({'where':{'id':_0x5b88aa[_0x4f49('0x51')]['id']},'attributes':['id',_0x4f49('0x62'),_0x4f49('0x63')]})[_0x4f49('0x1e')](handleEntityNotFound(_0x121972,null))['then'](function(_0x25ed14){if(_0x25ed14){_0x544356=_0x25ed14['remoteUri'];var _0x3ecc94=_0x544356['slice'](-0x1);if(_0x3ecc94==='/'){_0x544356=_0x544356[_0x4f49('0x64')](0x0,_0x544356['lastIndexOf'](_0x3ecc94));}return rp({'method':_0x4f49('0x65'),'uri':util[_0x4f49('0x66')](_0x4f49('0x67'),_0x544356,_0x4f49('0x68')),'headers':{'Authorization':util['format'](_0x4f49('0x69'),new Buffer(util['format'](_0x4f49('0x6a'),_0x25ed14['apiKey']))[_0x4f49('0x6b')]('base64'))},'json':!![]});}})['then'](function(_0x329a49){if(_0x329a49){var _0x20b2be=[_0x4f49('0x6c'),'subject',_0x4f49('0x6d'),_0x4f49('0x6e'),'status','priority','group',_0x4f49('0x6f'),_0x4f49('0x70'),_0x4f49('0x71'),_0x4f49('0x72')];_[_0x4f49('0x73')](_0x329a49,function(_0x517144){return _0x20b2be[_0x4f49('0x74')](_0x517144[_0x4f49('0x33')])||!_0x517144[_0x4f49('0x75')]&&_0x517144['type']!==_0x4f49('0x76')&&_0x517144[_0x4f49('0x39')]!==_0x4f49('0x77');});return{'count':_0x329a49[_0x4f49('0x41')],'rows':_['map'](_0x329a49,function(_0x249799){return{'id':_0x249799[_0x4f49('0x33')],'name':_0x249799[_0x4f49('0x78')],'custom':!_0x249799[_0x4f49('0x75')],'options':_0x249799[_0x4f49('0x79')]?_['map'](_0x249799[_0x4f49('0x79')],function(_0x32539c){return{'name':_['capitalize'](_0x32539c),'value':_0x32539c};}):[]};})};}})[_0x4f49('0x1e')](respondWithResult(_0x121972,null))['catch'](function(_0x351a33){var _0x4d72a0=_0x5b88aa[_0x4f49('0x3c')][_0x4f49('0x1b')]?0x1f4:_0x351a33[_0x4f49('0x7a')]||0x1f4;logger[_0x4f49('0x22')](_0x4f49('0x7b'),'getFields',_0x4d72a0,JSON[_0x4f49('0x21')](_0x351a33));delete _0x351a33[_0x4f49('0x33')];if(_0x4d72a0===0x191){_0x4d72a0=0x190;}_0x121972[_0x4f49('0x26')](_0x4d72a0)[_0x4f49('0x34')](_0x5b88aa['query'][_0x4f49('0x1b')]?{'message':'Wrong\x20credentials','statusCode':_0x351a33[_0x4f49('0x7a')]}:_0x351a33);});}; \ No newline at end of file +var _0x9957=['requester','subject','agent','priority','group','source','ticket_type','company','remove','includes','custom_text','custom_dropdown','label','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','count','set','Content-Range','reject','update','end','stack','send','map','FreshdeskAccount','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','limit','offset','sort','where','pick','filter','merge','VIRTUAL','include','findAll','params','keys','length','options','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','order','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X'];(function(_0x4451d1,_0x1a7046){var _0x336bb2=function(_0xf3666d){while(--_0xf3666d){_0x4451d1['push'](_0x4451d1['shift']());}};_0x336bb2(++_0x1a7046);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');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 db=require(_0x7995('0x19'))['db'];var integrations=require(_0x7995('0x1a'));var jayson=require(_0x7995('0x1b'));var client=jayson[_0x7995('0x1c')][_0x7995('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x23999f,_0x2bbe7a,_0x4cc004){if(_0x4cc004){var _0x58f5ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58f5ad[_0x7995('0x1e')](_0x2bbe7a)){return _0x23999f;}else{throw new db[(_0x7995('0x1f'))][(_0x7995('0x20'))](_0x7995('0x21'));}}else{return _0x23999f;}}function respondWithRpcPromise(_0x3f1d3e,_0x1a5310,_0x2202ce,_0x41cbf0){return new BPromise(function(_0x5377e5,_0x2eeacc){var _0x565d97=_0x41cbf0||client;return _0x565d97[_0x7995('0x22')](_0x3f1d3e,_0x2202ce)[_0x7995('0x23')](function(_0x43d4b8){logger[_0x7995('0x24')](_0x7995('0x25'),_0x1a5310,_0x7995('0x26'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x1a5310,_0x7995('0x26'),JSON['stringify'](_0x43d4b8));if(_0x43d4b8['error']){if(_0x43d4b8[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger['error'](_0x7995('0x25'),_0x1a5310,_0x43d4b8['error']['message']);return _0x2eeacc(_0x43d4b8[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x25'),_0x1a5310,_0x43d4b8[_0x7995('0x27')][_0x7995('0x29')]);return _0x5377e5(_0x43d4b8['error'][_0x7995('0x29')]);}else{logger[_0x7995('0x24')](_0x7995('0x25'),_0x1a5310,_0x7995('0x26'));_0x5377e5(_0x43d4b8[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x472195){logger['error'](_0x7995('0x25'),_0x1a5310,_0x472195);_0x2eeacc(_0x472195);});});}function respondWithStatusCode(_0x34e70c,_0x401dc3){_0x401dc3=_0x401dc3||0xcc;return function(_0x268ce7){if(_0x268ce7){return _0x34e70c[_0x7995('0x2c')](_0x401dc3);}return _0x34e70c[_0x7995('0x2d')](_0x401dc3)['end']();};}function respondWithResult(_0x47625f,_0x5911c3){_0x5911c3=_0x5911c3||0xc8;return function(_0x229742){if(_0x229742){return _0x47625f[_0x7995('0x2d')](_0x5911c3)[_0x7995('0x2e')](_0x229742);}};}function respondWithFilteredResult(_0x132a42,_0x11c1eb){return function(_0x4b6f99){if(_0x4b6f99){var _0x9b2a15=_0x4b6f99[_0x7995('0x2f')],_0x514445=_0x11c1eb['offset'],_0x456a28=_0x11c1eb['offset']+_0x11c1eb['limit'],_0x3250e0;if(_0x456a28>=_0x9b2a15){_0x456a28=_0x9b2a15;_0x3250e0=0xc8;}else{_0x3250e0=0xce;}_0x132a42[_0x7995('0x2d')](_0x3250e0);return _0x132a42[_0x7995('0x30')](_0x7995('0x31'),_0x514445+'-'+_0x456a28+'/'+_0x9b2a15)[_0x7995('0x2e')](_0x4b6f99);}return null;};}function patchUpdates(_0x2e3493){return function(_0x1ca460){try{jsonpatch['apply'](_0x1ca460,_0x2e3493,!![]);}catch(_0x481c74){return BPromise[_0x7995('0x32')](_0x481c74);}return _0x1ca460['save']();};}function saveUpdates(_0x553671,_0x3eb566){return function(_0x29fac5){if(_0x29fac5){return _0x29fac5[_0x7995('0x33')](_0x553671)[_0x7995('0x23')](function(_0x510841){return _0x510841;});}return null;};}function removeEntity(_0x44309d,_0x33e24e){return function(_0x5dd802){if(_0x5dd802){return _0x5dd802['destroy']()['then'](function(){_0x44309d[_0x7995('0x2d')](0xcc)[_0x7995('0x34')]();});}};}function handleEntityNotFound(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(!_0x51b95d){_0x4a176f[_0x7995('0x2c')](0x194);}return _0x51b95d;};}function handleError(_0x1cb058,_0x177cb4){_0x177cb4=_0x177cb4||0x1f4;return function(_0x5014d2){logger['error'](_0x5014d2[_0x7995('0x35')]);if(_0x5014d2['name']){delete _0x5014d2['name'];}_0x1cb058[_0x7995('0x2d')](_0x177cb4)[_0x7995('0x36')](_0x5014d2);};}exports['index']=function(_0x1baa15,_0x1922b4){var _0x2b772f={},_0x18667c={},_0x1e3dbf={'count':0x0,'rows':[]};var _0x53002a=_[_0x7995('0x37')](db[_0x7995('0x38')][_0x7995('0x39')],function(_0x1d60b8){return{'name':_0x1d60b8['fieldName'],'type':_0x1d60b8[_0x7995('0x3a')][_0x7995('0x3b')]};});_0x18667c[_0x7995('0x3c')]=_[_0x7995('0x37')](_0x53002a,_0x7995('0x3d'));_0x18667c[_0x7995('0x3e')]=_['keys'](_0x1baa15[_0x7995('0x3e')]);_0x18667c[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x18667c[_0x7995('0x3c')],_0x18667c[_0x7995('0x3e')]);_0x2b772f[_0x7995('0x41')]=_[_0x7995('0x40')](_0x18667c[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x1baa15[_0x7995('0x3e')][_0x7995('0x42')]));_0x2b772f[_0x7995('0x41')]=_0x2b772f[_0x7995('0x41')]['length']?_0x2b772f['attributes']:_0x18667c[_0x7995('0x3c')];if(!_0x1baa15[_0x7995('0x3e')]['hasOwnProperty']('nolimit')){_0x2b772f[_0x7995('0x43')]=qs['limit'](_0x1baa15['query'][_0x7995('0x43')]);_0x2b772f[_0x7995('0x44')]=qs[_0x7995('0x44')](_0x1baa15['query'][_0x7995('0x44')]);}_0x2b772f['order']=qs[_0x7995('0x45')](_0x1baa15['query']['sort']);_0x2b772f[_0x7995('0x46')]=qs[_0x7995('0x3f')](_[_0x7995('0x47')](_0x1baa15[_0x7995('0x3e')],_0x18667c['filters']),_0x53002a);if(_0x1baa15[_0x7995('0x3e')][_0x7995('0x48')]){_0x2b772f[_0x7995('0x46')]=_[_0x7995('0x49')](_0x2b772f['where'],{'$or':_['map'](_0x53002a,function(_0x1c37c6){if(_0x1c37c6['type']!==_0x7995('0x4a')){var _0x59c153={};_0x59c153[_0x1c37c6[_0x7995('0x3d')]]={'$like':'%'+_0x1baa15['query'][_0x7995('0x48')]+'%'};return _0x59c153;}})});}_0x2b772f=_[_0x7995('0x49')]({},_0x2b772f,_0x1baa15['options']);var _0x3e9e62={'where':_0x2b772f[_0x7995('0x46')]};return db[_0x7995('0x38')][_0x7995('0x2f')](_0x3e9e62)['then'](function(_0x2458cb){_0x1e3dbf[_0x7995('0x2f')]=_0x2458cb;if(_0x1baa15[_0x7995('0x3e')]['includeAll']){_0x2b772f[_0x7995('0x4b')]=[{'all':!![]}];}return db[_0x7995('0x38')][_0x7995('0x4c')](_0x2b772f);})[_0x7995('0x23')](function(_0x255313){_0x1e3dbf['rows']=_0x255313;return _0x1e3dbf;})[_0x7995('0x23')](respondWithFilteredResult(_0x1922b4,_0x2b772f))[_0x7995('0x2b')](handleError(_0x1922b4,null));};exports['show']=function(_0x3d1dbb,_0x5843ba){var _0x1d87f9={'raw':![],'where':{'id':_0x3d1dbb[_0x7995('0x4d')]['id']}},_0x187735={};_0x187735[_0x7995('0x3c')]=_[_0x7995('0x4e')](db[_0x7995('0x38')][_0x7995('0x39')]);_0x187735['query']=_[_0x7995('0x4e')](_0x3d1dbb[_0x7995('0x3e')]);_0x187735[_0x7995('0x3f')]=_['intersection'](_0x187735[_0x7995('0x3c')],_0x187735[_0x7995('0x3e')]);_0x1d87f9[_0x7995('0x41')]=_['intersection'](_0x187735['model'],qs['fields'](_0x3d1dbb[_0x7995('0x3e')][_0x7995('0x42')]));_0x1d87f9['attributes']=_0x1d87f9[_0x7995('0x41')][_0x7995('0x4f')]?_0x1d87f9[_0x7995('0x41')]:_0x187735[_0x7995('0x3c')];if(_0x3d1dbb[_0x7995('0x3e')]['includeAll']){_0x1d87f9[_0x7995('0x4b')]=[{'all':!![]}];}_0x1d87f9=_['merge']({},_0x1d87f9,_0x3d1dbb[_0x7995('0x50')]);return db[_0x7995('0x38')][_0x7995('0x51')](_0x1d87f9)['then'](handleEntityNotFound(_0x5843ba,null))['then'](respondWithResult(_0x5843ba,null))['catch'](handleError(_0x5843ba,null));};exports['create']=function(_0x2e13b0,_0x3709de){return db[_0x7995('0x38')][_0x7995('0x52')](_0x2e13b0[_0x7995('0x53')],{})[_0x7995('0x23')](respondWithResult(_0x3709de,0xc9))[_0x7995('0x2b')](handleError(_0x3709de,null));};exports[_0x7995('0x33')]=function(_0x328671,_0x17ecd3){if(_0x328671[_0x7995('0x53')]['id']){delete _0x328671[_0x7995('0x53')]['id'];}return db[_0x7995('0x38')][_0x7995('0x51')]({'where':{'id':_0x328671[_0x7995('0x4d')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x17ecd3,null))[_0x7995('0x23')](saveUpdates(_0x328671[_0x7995('0x53')],null))[_0x7995('0x23')](respondWithResult(_0x17ecd3,null))['catch'](handleError(_0x17ecd3,null));};exports[_0x7995('0x54')]=function(_0x630737,_0x3b8a54){return db[_0x7995('0x38')]['find']({'where':{'id':_0x630737['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3b8a54,null))[_0x7995('0x23')](removeEntity(_0x3b8a54,null))[_0x7995('0x2b')](handleError(_0x3b8a54,null));};exports[_0x7995('0x55')]=function(_0x51c50b,_0x13cd7b,_0x74ff38){var _0xef5044={};var _0x33c49c={};var _0x502d43;var _0x5e2d97;return db[_0x7995('0x38')][_0x7995('0x56')]({'where':{'id':_0x51c50b[_0x7995('0x4d')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x13cd7b,null))[_0x7995('0x23')](function(_0x27c5cd){if(_0x27c5cd){_0x502d43=_0x27c5cd;_0x33c49c[_0x7995('0x3c')]=_[_0x7995('0x4e')](db[_0x7995('0x57')]['rawAttributes']);_0x33c49c[_0x7995('0x3e')]=_[_0x7995('0x4e')](_0x51c50b[_0x7995('0x3e')]);_0x33c49c[_0x7995('0x3f')]=_['intersection'](_0x33c49c['model'],_0x33c49c[_0x7995('0x3e')]);_0xef5044[_0x7995('0x41')]=_['intersection'](_0x33c49c[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x51c50b[_0x7995('0x3e')][_0x7995('0x42')]));_0xef5044[_0x7995('0x41')]=_0xef5044['attributes'][_0x7995('0x4f')]?_0xef5044['attributes']:_0x33c49c[_0x7995('0x3c')];_0xef5044[_0x7995('0x58')]=qs[_0x7995('0x45')](_0x51c50b[_0x7995('0x3e')][_0x7995('0x45')]);_0xef5044[_0x7995('0x46')]=qs[_0x7995('0x3f')](_[_0x7995('0x47')](_0x51c50b[_0x7995('0x3e')],_0x33c49c[_0x7995('0x3f')]));if(_0x51c50b[_0x7995('0x3e')][_0x7995('0x48')]){_0xef5044['where']=_[_0x7995('0x49')](_0xef5044[_0x7995('0x46')],{'$or':_[_0x7995('0x37')](_0xef5044[_0x7995('0x41')],function(_0x2c6548){var _0x54a2e0={};_0x54a2e0[_0x2c6548]={'$like':'%'+_0x51c50b['query'][_0x7995('0x48')]+'%'};return _0x54a2e0;})});}_0xef5044=_[_0x7995('0x49')]({},_0xef5044,_0x51c50b[_0x7995('0x50')]);return _0x502d43[_0x7995('0x55')](_0xef5044);}})['then'](function(_0x22d317){if(_0x22d317){_0x5e2d97=_0x22d317['length'];if(!_0x51c50b['query'][_0x7995('0x59')](_0x7995('0x5a'))){_0xef5044[_0x7995('0x43')]=qs[_0x7995('0x43')](_0x51c50b[_0x7995('0x3e')][_0x7995('0x43')]);_0xef5044[_0x7995('0x44')]=qs[_0x7995('0x44')](_0x51c50b[_0x7995('0x3e')][_0x7995('0x44')]);}return _0x502d43['getConfigurations'](_0xef5044);}})[_0x7995('0x23')](function(_0x8908cd){if(_0x8908cd){return _0x8908cd?{'count':_0x5e2d97,'rows':_0x8908cd}:null;}})[_0x7995('0x23')](respondWithResult(_0x13cd7b,null))['catch'](handleError(_0x13cd7b,null));};exports[_0x7995('0x5b')]=function(_0x1d2f9d,_0x705f0,_0x3a7d9d){if(_0x1d2f9d[_0x7995('0x53')]['id']){delete _0x1d2f9d[_0x7995('0x53')]['id'];}return db[_0x7995('0x38')][_0x7995('0x56')]({'where':{'id':_0x1d2f9d[_0x7995('0x4d')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x705f0,null))[_0x7995('0x23')](function(_0x535131){if(_0x535131){_0x1d2f9d['body'][_0x7995('0x5c')]=_0x535131['id'];_0x1d2f9d[_0x7995('0x53')][_0x7995('0x5d')]=integrations[_0x7995('0x5e')](_0x1d2f9d['body'][_0x7995('0x5f')],_0x1d2f9d[_0x7995('0x53')]['type']);_0x1d2f9d['body'][_0x7995('0x60')]=integrations[_0x7995('0x61')](_0x1d2f9d['body'][_0x7995('0x5f')],_0x1d2f9d['body'][_0x7995('0x3a')]);return db[_0x7995('0x57')]['create'](_0x1d2f9d['body'],{'include':[{'model':db[_0x7995('0x62')],'as':'Subjects'},{'model':db[_0x7995('0x62')],'as':_0x7995('0x60')}]});}return null;})[_0x7995('0x23')](respondWithResult(_0x705f0,null))[_0x7995('0x2b')](handleError(_0x705f0,null));};exports[_0x7995('0x63')]=function(_0x18cff7,_0x8af865,_0x14cb17){var _0x29e0ee='';return db[_0x7995('0x38')][_0x7995('0x56')]({'where':{'id':_0x18cff7[_0x7995('0x4d')]['id']},'attributes':['id',_0x7995('0x64'),_0x7995('0x65')]})[_0x7995('0x23')](handleEntityNotFound(_0x8af865,null))[_0x7995('0x23')](function(_0x6ad274){if(_0x6ad274){_0x29e0ee=_0x6ad274[_0x7995('0x64')];var _0x2ff7ba=_0x29e0ee[_0x7995('0x66')](-0x1);if(_0x2ff7ba==='/'){_0x29e0ee=_0x29e0ee[_0x7995('0x67')](0x0,_0x29e0ee[_0x7995('0x68')](_0x2ff7ba));}return rp({'method':_0x7995('0x69'),'uri':util[_0x7995('0x6a')](_0x7995('0x6b'),_0x29e0ee,_0x7995('0x6c')),'headers':{'Authorization':util[_0x7995('0x6a')](_0x7995('0x6d'),new Buffer(util['format'](_0x7995('0x6e'),_0x6ad274[_0x7995('0x65')]))['toString']('base64'))},'json':!![]});}})[_0x7995('0x23')](function(_0x3fe8fc){if(_0x3fe8fc){var _0x2d45d5=[_0x7995('0x6f'),_0x7995('0x70'),_0x7995('0x71'),'description',_0x7995('0x2d'),_0x7995('0x72'),_0x7995('0x73'),_0x7995('0x74'),_0x7995('0x75'),_0x7995('0x73'),_0x7995('0x76')];_[_0x7995('0x77')](_0x3fe8fc,function(_0x560095){return _0x2d45d5[_0x7995('0x78')](_0x560095[_0x7995('0x3d')])||!_0x560095['default']&&_0x560095['type']!==_0x7995('0x79')&&_0x560095[_0x7995('0x3a')]!==_0x7995('0x7a');});return{'count':_0x3fe8fc[_0x7995('0x4f')],'rows':_[_0x7995('0x37')](_0x3fe8fc,function(_0x4a02ea){return{'id':_0x4a02ea[_0x7995('0x3d')],'name':_0x4a02ea[_0x7995('0x7b')],'custom':!_0x4a02ea['default'],'options':_0x4a02ea[_0x7995('0x7c')]?_[_0x7995('0x37')](_0x4a02ea['choices'],function(_0x1535a3){return{'name':_['capitalize'](_0x1535a3),'value':_0x1535a3};}):[]};})};}})[_0x7995('0x23')](respondWithResult(_0x8af865,null))[_0x7995('0x2b')](function(_0x3ab421){var _0x428a1b=_0x18cff7[_0x7995('0x3e')]['test']?0x1f4:_0x3ab421[_0x7995('0x7d')]||0x1f4;logger[_0x7995('0x27')](_0x7995('0x7e'),'getFields',_0x428a1b,JSON[_0x7995('0x7f')](_0x3ab421));delete _0x3ab421[_0x7995('0x3d')];if(_0x428a1b===0x191){_0x428a1b=0x190;}_0x8af865[_0x7995('0x2d')](_0x428a1b)[_0x7995('0x36')](_0x18cff7['query'][_0x7995('0x1e')]?{'message':_0x7995('0x80'),'statusCode':_0x3ab421[_0x7995('0x7d')]}:_0x3ab421);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 9d391ec..be1fa09 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 _0xfccc=['exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','request-promise','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x7849b3,_0x693704){var _0x20bf46=function(_0x27bb43){while(--_0x27bb43){_0x7849b3['push'](_0x7849b3['shift']());}};_0x20bf46(++_0x693704);}(_0xfccc,0xac));var _0xcfcc=function(_0x426fab,_0x778fa8){_0x426fab=_0x426fab-0x0;var _0x36feee=_0xfccc[_0x426fab];return _0x36feee;};'use strict';var _=require(_0xcfcc('0x0'));var util=require(_0xcfcc('0x1'));var logger=require(_0xcfcc('0x2'))(_0xcfcc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcfcc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcfcc('0x5'));var attributes=require(_0xcfcc('0x6'));var integrations=require(_0xcfcc('0x7'));module[_0xcfcc('0x8')]=function(_0x5de173,_0x55ce4d){return _0x5de173[_0xcfcc('0x9')](_0xcfcc('0xa'),attributes,{'tableName':_0xcfcc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80e4=['exports','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x554e4b,_0x5006a1){var _0x33450b=function(_0x7d3647){while(--_0x7d3647){_0x554e4b['push'](_0x554e4b['shift']());}};_0x33450b(++_0x5006a1);}(_0x80e4,0x1b0));var _0x480e=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0x80e4[_0x1ca9e9];return _0x309f3c;};'use strict';var _=require('lodash');var util=require(_0x480e('0x0'));var logger=require(_0x480e('0x1'))(_0x480e('0x2'));var moment=require(_0x480e('0x3'));var BPromise=require(_0x480e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x480e('0x5'));var rimraf=require(_0x480e('0x6'));var config=require(_0x480e('0x7'));var attributes=require(_0x480e('0x8'));var integrations=require(_0x480e('0x9'));module[_0x480e('0xa')]=function(_0x2b2616,_0x37a544){return _0x2b2616['define'](_0x480e('0xb'),attributes,{'tableName':_0x480e('0xc'),'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 c86c8e0..13c2c4a 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 _0x0c71=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshdeskAccount','options','where','include','map','model','attributes','info','GetFreshdeskAccount','ShowFreshdeskAccount','find','raw','then','lodash','moment','bluebird','randomstring'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x0c71,0x1e6));var _0x10c7=function(_0x288ad2,_0x434f5e){_0x288ad2=_0x288ad2-0x0;var _0x2f655e=_0x0c71[_0x288ad2];return _0x2f655e;};'use strict';var _=require(_0x10c7('0x0'));var util=require('util');var moment=require(_0x10c7('0x1'));var BPromise=require(_0x10c7('0x2'));var rs=require(_0x10c7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x10c7('0x4'))['db'];var utils=require(_0x10c7('0x5'));var logger=require(_0x10c7('0x6'))(_0x10c7('0x7'));var config=require(_0x10c7('0x8'));var jayson=require(_0x10c7('0x9'));var client=jayson[_0x10c7('0xa')][_0x10c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf8cf88,_0x549c3f,_0x5c98e3){return new BPromise(function(_0x28ca1b,_0x141b55){return client['request'](_0xf8cf88,_0x5c98e3)['then'](function(_0x50cc82){logger['info'](_0x10c7('0xc'),_0x549c3f,_0x10c7('0xd'));logger[_0x10c7('0xe')](_0x10c7('0xf'),_0x549c3f,_0x10c7('0xd'),JSON[_0x10c7('0x10')](_0x50cc82));if(_0x50cc82[_0x10c7('0x11')]){if(_0x50cc82['error'][_0x10c7('0x12')]===0x1f4){logger[_0x10c7('0x11')](_0x10c7('0xc'),_0x549c3f,_0x50cc82[_0x10c7('0x11')]['message']);return _0x141b55(_0x50cc82['error'][_0x10c7('0x13')]);}logger['error'](_0x10c7('0xc'),_0x549c3f,_0x50cc82['error'][_0x10c7('0x13')]);return _0x28ca1b(_0x50cc82[_0x10c7('0x11')]['message']);}else{logger['info'](_0x10c7('0xc'),_0x549c3f,_0x10c7('0xd'));_0x28ca1b(_0x50cc82[_0x10c7('0x14')][_0x10c7('0x13')]);}})[_0x10c7('0x15')](function(_0x4e8e53){logger['error'](_0x10c7('0xc'),_0x549c3f,_0x4e8e53);_0x141b55(_0x4e8e53);});});}exports['GetFreshdeskAccount']=function(_0x13f243){var _0x4ed30e=this;return new Promise(function(_0x4f435f,_0x269e28){return db[_0x10c7('0x16')]['findAll']({'raw':_0x13f243[_0x10c7('0x17')]?_0x13f243[_0x10c7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x13f243[_0x10c7('0x17')]?_0x13f243['options'][_0x10c7('0x18')]||null:null,'attributes':_0x13f243[_0x10c7('0x17')]?_0x13f243['options']['attributes']||null:null,'limit':_0x13f243['options']?_0x13f243[_0x10c7('0x17')]['limit']||null:null,'include':_0x13f243[_0x10c7('0x17')]?_0x13f243['options'][_0x10c7('0x19')]?_[_0x10c7('0x1a')](_0x13f243['options'][_0x10c7('0x19')],function(_0x34a434){return{'model':db[_0x34a434[_0x10c7('0x1b')]],'as':_0x34a434['as'],'attributes':_0x34a434[_0x10c7('0x1c')],'include':_0x34a434['include']?_[_0x10c7('0x1a')](_0x34a434[_0x10c7('0x19')],function(_0x2cf5c4){return{'model':db[_0x2cf5c4[_0x10c7('0x1b')]],'as':_0x2cf5c4['as'],'attributes':_0x2cf5c4[_0x10c7('0x1c')],'include':_0x2cf5c4['include']?_[_0x10c7('0x1a')](_0x2cf5c4['include'],function(_0x53eadf){return{'model':db[_0x53eadf[_0x10c7('0x1b')]],'as':_0x53eadf['as'],'attributes':_0x53eadf['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bc0f4){logger[_0x10c7('0x1d')](_0x10c7('0x1e'),_0x13f243);logger[_0x10c7('0xe')](_0x10c7('0x1e'),_0x13f243,JSON[_0x10c7('0x10')](_0x2bc0f4));_0x4f435f(_0x2bc0f4);})[_0x10c7('0x15')](function(_0x5460a1){logger[_0x10c7('0x11')]('GetFreshdeskAccount',_0x5460a1[_0x10c7('0x13')],_0x13f243);_0x269e28(_0x4ed30e['error'](0x1f4,_0x5460a1['message']));});});};exports[_0x10c7('0x1f')]=function(_0x36c7f2){var _0x31bec1=this;return new Promise(function(_0x3367d0,_0x27c60b){return db[_0x10c7('0x16')][_0x10c7('0x20')]({'raw':_0x36c7f2[_0x10c7('0x17')]?_0x36c7f2[_0x10c7('0x17')][_0x10c7('0x21')]===undefined?!![]:![]:!![],'where':_0x36c7f2['options']?_0x36c7f2[_0x10c7('0x17')][_0x10c7('0x18')]||null:null,'attributes':_0x36c7f2[_0x10c7('0x17')]?_0x36c7f2[_0x10c7('0x17')][_0x10c7('0x1c')]||null:null,'include':_0x36c7f2[_0x10c7('0x17')]?_0x36c7f2[_0x10c7('0x17')][_0x10c7('0x19')]?_[_0x10c7('0x1a')](_0x36c7f2[_0x10c7('0x17')][_0x10c7('0x19')],function(_0x39d000){return{'model':db[_0x39d000[_0x10c7('0x1b')]],'as':_0x39d000['as'],'attributes':_0x39d000['attributes'],'include':_0x39d000[_0x10c7('0x19')]?_['map'](_0x39d000['include'],function(_0x259e02){return{'model':db[_0x259e02[_0x10c7('0x1b')]],'as':_0x259e02['as'],'attributes':_0x259e02[_0x10c7('0x1c')],'include':_0x259e02['include']?_[_0x10c7('0x1a')](_0x259e02['include'],function(_0x39dd5a){return{'model':db[_0x39dd5a['model']],'as':_0x39dd5a['as'],'attributes':_0x39dd5a[_0x10c7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x10c7('0x22')](function(_0x4dec90){logger['info'](_0x10c7('0x1f'),_0x36c7f2);logger[_0x10c7('0xe')](_0x10c7('0x1f'),_0x36c7f2,JSON[_0x10c7('0x10')](_0x4dec90));_0x3367d0(_0x4dec90);})[_0x10c7('0x15')](function(_0x17cf75){logger['error'](_0x10c7('0x1f'),_0x17cf75[_0x10c7('0x13')],_0x36c7f2);_0x27c60b(_0x31bec1[_0x10c7('0x11')](0x1f4,_0x17cf75[_0x10c7('0x13')]));});});}; \ No newline at end of file +var _0x383e=['findAll','options','raw','where','limit','map','include','model','attributes','stringify','ShowFreshdeskAccount','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x383e,0x1e7));var _0xe383=function(_0x4945f6,_0xca6d06){_0x4945f6=_0x4945f6-0x0;var _0x394b26=_0x383e[_0x4945f6];return _0x394b26;};'use strict';var _=require(_0xe383('0x0'));var util=require('util');var moment=require(_0xe383('0x1'));var BPromise=require(_0xe383('0x2'));var rs=require(_0xe383('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe383('0x4'));var logger=require(_0xe383('0x5'))(_0xe383('0x6'));var config=require(_0xe383('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe383('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5fba32,_0x35c837,_0x2df941){return new BPromise(function(_0x1d69bb,_0x401fde){return client[_0xe383('0x9')](_0x5fba32,_0x2df941)[_0xe383('0xa')](function(_0x1906e6){logger[_0xe383('0xb')](_0xe383('0xc'),_0x35c837,_0xe383('0xd'));logger[_0xe383('0xe')](_0xe383('0xf'),_0x35c837,'request\x20sent',JSON['stringify'](_0x1906e6));if(_0x1906e6[_0xe383('0x10')]){if(_0x1906e6[_0xe383('0x10')][_0xe383('0x11')]===0x1f4){logger[_0xe383('0x10')](_0xe383('0xc'),_0x35c837,_0x1906e6[_0xe383('0x10')][_0xe383('0x12')]);return _0x401fde(_0x1906e6[_0xe383('0x10')][_0xe383('0x12')]);}logger['error'](_0xe383('0xc'),_0x35c837,_0x1906e6[_0xe383('0x10')][_0xe383('0x12')]);return _0x1d69bb(_0x1906e6[_0xe383('0x10')][_0xe383('0x12')]);}else{logger[_0xe383('0xb')](_0xe383('0xc'),_0x35c837,_0xe383('0xd'));_0x1d69bb(_0x1906e6[_0xe383('0x13')][_0xe383('0x12')]);}})[_0xe383('0x14')](function(_0xebf10){logger[_0xe383('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x35c837,_0xebf10);_0x401fde(_0xebf10);});});}exports[_0xe383('0x15')]=function(_0xb5bb1){var _0x5e28ca=this;return new Promise(function(_0x411bdb,_0x5e1e){return db[_0xe383('0x16')][_0xe383('0x17')]({'raw':_0xb5bb1[_0xe383('0x18')]?_0xb5bb1[_0xe383('0x18')][_0xe383('0x19')]===undefined?!![]:![]:!![],'where':_0xb5bb1[_0xe383('0x18')]?_0xb5bb1[_0xe383('0x18')][_0xe383('0x1a')]||null:null,'attributes':_0xb5bb1['options']?_0xb5bb1[_0xe383('0x18')]['attributes']||null:null,'limit':_0xb5bb1[_0xe383('0x18')]?_0xb5bb1[_0xe383('0x18')][_0xe383('0x1b')]||null:null,'include':_0xb5bb1[_0xe383('0x18')]?_0xb5bb1[_0xe383('0x18')]['include']?_[_0xe383('0x1c')](_0xb5bb1[_0xe383('0x18')][_0xe383('0x1d')],function(_0x2a6dc8){return{'model':db[_0x2a6dc8[_0xe383('0x1e')]],'as':_0x2a6dc8['as'],'attributes':_0x2a6dc8['attributes'],'include':_0x2a6dc8[_0xe383('0x1d')]?_['map'](_0x2a6dc8[_0xe383('0x1d')],function(_0x32e532){return{'model':db[_0x32e532['model']],'as':_0x32e532['as'],'attributes':_0x32e532[_0xe383('0x1f')],'include':_0x32e532['include']?_[_0xe383('0x1c')](_0x32e532[_0xe383('0x1d')],function(_0x1e3b2e){return{'model':db[_0x1e3b2e[_0xe383('0x1e')]],'as':_0x1e3b2e['as'],'attributes':_0x1e3b2e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x407a85){logger[_0xe383('0xb')](_0xe383('0x15'),_0xb5bb1);logger[_0xe383('0xe')](_0xe383('0x15'),_0xb5bb1,JSON[_0xe383('0x20')](_0x407a85));_0x411bdb(_0x407a85);})[_0xe383('0x14')](function(_0x399ece){logger[_0xe383('0x10')]('GetFreshdeskAccount',_0x399ece[_0xe383('0x12')],_0xb5bb1);_0x5e1e(_0x5e28ca[_0xe383('0x10')](0x1f4,_0x399ece['message']));});});};exports[_0xe383('0x21')]=function(_0x49b25b){var _0x1a5ad7=this;return new Promise(function(_0x1bcc0d,_0x45c41b){return db[_0xe383('0x16')]['find']({'raw':_0x49b25b[_0xe383('0x18')]?_0x49b25b[_0xe383('0x18')][_0xe383('0x19')]===undefined?!![]:![]:!![],'where':_0x49b25b['options']?_0x49b25b[_0xe383('0x18')][_0xe383('0x1a')]||null:null,'attributes':_0x49b25b[_0xe383('0x18')]?_0x49b25b[_0xe383('0x18')][_0xe383('0x1f')]||null:null,'include':_0x49b25b[_0xe383('0x18')]?_0x49b25b['options'][_0xe383('0x1d')]?_['map'](_0x49b25b['options'][_0xe383('0x1d')],function(_0x181008){return{'model':db[_0x181008['model']],'as':_0x181008['as'],'attributes':_0x181008[_0xe383('0x1f')],'include':_0x181008['include']?_[_0xe383('0x1c')](_0x181008['include'],function(_0x46f3c9){return{'model':db[_0x46f3c9[_0xe383('0x1e')]],'as':_0x46f3c9['as'],'attributes':_0x46f3c9[_0xe383('0x1f')],'include':_0x46f3c9[_0xe383('0x1d')]?_[_0xe383('0x1c')](_0x46f3c9['include'],function(_0x13767a){return{'model':db[_0x13767a[_0xe383('0x1e')]],'as':_0x13767a['as'],'attributes':_0x13767a['attributes']};}):[]};}):[]};}):[]:[]})[_0xe383('0xa')](function(_0x9ee17d){logger[_0xe383('0xb')]('ShowFreshdeskAccount',_0x49b25b);logger['debug']('ShowFreshdeskAccount',_0x49b25b,JSON[_0xe383('0x20')](_0x9ee17d));_0x1bcc0d(_0x9ee17d);})[_0xe383('0x14')](function(_0x91fb25){logger[_0xe383('0x10')](_0xe383('0x21'),_0x91fb25[_0xe383('0x12')],_0x49b25b);_0x45c41b(_0x1a5ad7[_0xe383('0x10')](0x1f4,_0x91fb25[_0xe383('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index d936c67..588b7ee 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 _0x9295=['express','../../components/auth/service','../../components/interaction/service','index','/:id','isAuthenticated','show','get','/:id/fields','getFields','getDescriptions','/:id/tags','post','create','setTags','update','delete','destroy','exports','multer','util','path'];(function(_0x3c8c63,_0x5530ea){var _0x872537=function(_0x10236e){while(--_0x10236e){_0x3c8c63['push'](_0x3c8c63['shift']());}};_0x872537(++_0x5530ea);}(_0x9295,0x1b5));var _0x5929=function(_0x1d072e,_0x22c9af){_0x1d072e=_0x1d072e-0x0;var _0x5f50e3=_0x9295[_0x1d072e];return _0x5f50e3;};'use strict';var multer=require(_0x5929('0x0'));var util=require(_0x5929('0x1'));var path=require(_0x5929('0x2'));var timeout=require('connect-timeout');var express=require(_0x5929('0x3'));var router=express['Router']();var auth=require(_0x5929('0x4'));var interaction=require(_0x5929('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5929('0x6')]);router['get'](_0x5929('0x7'),auth[_0x5929('0x8')](),controller[_0x5929('0x9')]);router[_0x5929('0xa')](_0x5929('0xb'),auth[_0x5929('0x8')](),controller[_0x5929('0xc')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x5929('0xa')]('/:id/descriptions',auth[_0x5929('0x8')](),controller[_0x5929('0xd')]);router['get'](_0x5929('0xe'),auth[_0x5929('0x8')](),controller['getTags']);router[_0x5929('0xf')]('/',auth['isAuthenticated'](),controller[_0x5929('0x10')]);router[_0x5929('0xf')](_0x5929('0xe'),auth['isAuthenticated'](),controller[_0x5929('0x11')]);router['put'](_0x5929('0x7'),auth['isAuthenticated'](),controller[_0x5929('0x12')]);router[_0x5929('0x13')](_0x5929('0x7'),auth[_0x5929('0x8')](),controller[_0x5929('0x14')]);module[_0x5929('0x15')]=router; \ No newline at end of file +var _0x253b=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields'];(function(_0x130775,_0x5eefa1){var _0x3a202a=function(_0x4c99d9){while(--_0x4c99d9){_0x130775['push'](_0x130775['shift']());}};_0x3a202a(++_0x5eefa1);}(_0x253b,0x150));var _0xb253=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x253b[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb253('0x0'));var util=require(_0xb253('0x1'));var path=require('path');var timeout=require(_0xb253('0x2'));var express=require(_0xb253('0x3'));var router=express[_0xb253('0x4')]();var auth=require(_0xb253('0x5'));var interaction=require(_0xb253('0x6'));var config=require(_0xb253('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0xb253('0x8')](),controller[_0xb253('0x9')]);router[_0xb253('0xa')](_0xb253('0xb'),auth[_0xb253('0x8')](),controller[_0xb253('0xc')]);router[_0xb253('0xa')](_0xb253('0xd'),auth['isAuthenticated'](),controller[_0xb253('0xe')]);router[_0xb253('0xa')](_0xb253('0xf'),auth[_0xb253('0x8')](),controller[_0xb253('0x10')]);router[_0xb253('0xa')](_0xb253('0x11'),auth['isAuthenticated'](),controller[_0xb253('0x12')]);router[_0xb253('0xa')]('/:id/tags',auth[_0xb253('0x8')](),controller[_0xb253('0x13')]);router[_0xb253('0x14')]('/',auth[_0xb253('0x8')](),controller[_0xb253('0x15')]);router[_0xb253('0x14')](_0xb253('0x16'),auth[_0xb253('0x8')](),controller[_0xb253('0x17')]);router['put'](_0xb253('0xb'),auth[_0xb253('0x8')](),controller['update']);router[_0xb253('0x18')](_0xb253('0xb'),auth[_0xb253('0x8')](),controller[_0xb253('0x19')]);module[_0xb253('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 87d8710..50e796c 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 _0x37a8=['STRING','sequelize','exports'];(function(_0x5e5781,_0x511076){var _0x336f60=function(_0x583af6){while(--_0x583af6){_0x5e5781['push'](_0x5e5781['shift']());}};_0x336f60(++_0x511076);}(_0x37a8,0xe8));var _0x837a=function(_0x3fb780,_0x540d09){_0x3fb780=_0x3fb780-0x0;var _0x49bcf4=_0x37a8[_0x3fb780];return _0x49bcf4;};'use strict';var Sequelize=require(_0x837a('0x0'));module[_0x837a('0x1')]={'name':{'type':Sequelize[_0x837a('0x2')]},'description':{'type':Sequelize[_0x837a('0x2')]}}; \ No newline at end of file +var _0x687c=['exports','STRING','sequelize'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x687c,0x197));var _0xc687=function(_0x356f9b,_0x5f476b){_0x356f9b=_0x356f9b-0x0;var _0x253110=_0x687c[_0x356f9b];return _0x253110;};'use strict';var Sequelize=require(_0xc687('0x0'));module[_0xc687('0x1')]={'name':{'type':Sequelize[_0xc687('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 593cb36..ee90470 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 _0xbe2a=['Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','jayson/promise','client','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~!@#$%^&-_=+[{]}.','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','reject','save','destroy','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','length','sort','where','pick','merge','VIRTUAL','options','include','show','params','fields','create','body','update','find','findOne','FreshdeskField','order','getFields','hasOwnProperty','nolimit','filter','getSubjects','getDescriptions','getTags'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbe2a,0x1d9));var _0xabe2=function(_0x15a208,_0x48b89d){_0x15a208=_0x15a208-0x0;var _0x47b8c8=_0xbe2a[_0x15a208];return _0x47b8c8;};'use strict';var pdf=require(_0xabe2('0x0'));var emlformat=require(_0xabe2('0x1'));var rimraf=require(_0xabe2('0x2'));var zipdir=require(_0xabe2('0x3'));var jsonpatch=require(_0xabe2('0x4'));var rp=require(_0xabe2('0x5'));var moment=require(_0xabe2('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xabe2('0x7'));var util=require('util');var path=require(_0xabe2('0x8'));var sox=require(_0xabe2('0x9'));var csv=require(_0xabe2('0xa'));var ejs=require(_0xabe2('0xb'));var fs=require('fs');var _=require(_0xabe2('0xc'));var squel=require(_0xabe2('0xd'));var crypto=require('crypto');var jsforce=require(_0xabe2('0xe'));var deskjs=require(_0xabe2('0xf'));var toCsv=require(_0xabe2('0xa'));var querystring=require(_0xabe2('0x10'));var Papa=require(_0xabe2('0x11'));var Redis=require(_0xabe2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xabe2('0x13'));var as=require(_0xabe2('0x14'));var hardwareService=require(_0xabe2('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xabe2('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xabe2('0x17'));var client=jayson[_0xabe2('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x5773a1,_0x4150fa,_0x4303eb){if(_0x4303eb){var _0xc8d55d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc8d55d[_0xabe2('0x19')](_0x4150fa)){return _0x5773a1;}else{throw new db[(_0xabe2('0x1a'))][(_0xabe2('0x1b'))](_0xabe2('0x1c'));}}else{return _0x5773a1;}}function respondWithRpcPromise(_0x3eb2e3,_0x4196fd,_0x2bea88,_0x5320d9){return new BPromise(function(_0x3dd6d9,_0x3ba203){var _0x3eb2b2=_0x5320d9||client;return _0x3eb2b2['request'](_0x3eb2e3,_0x2bea88)[_0xabe2('0x1d')](function(_0x59d667){logger[_0xabe2('0x1e')](_0xabe2('0x1f'),_0x4196fd,'request\x20sent');logger[_0xabe2('0x20')](_0xabe2('0x21'),_0x4196fd,'request\x20sent',JSON[_0xabe2('0x22')](_0x59d667));if(_0x59d667[_0xabe2('0x23')]){if(_0x59d667['error'][_0xabe2('0x24')]===0x1f4){logger[_0xabe2('0x23')](_0xabe2('0x1f'),_0x4196fd,_0x59d667['error'][_0xabe2('0x25')]);return _0x3ba203(_0x59d667[_0xabe2('0x23')][_0xabe2('0x25')]);}logger[_0xabe2('0x23')](_0xabe2('0x1f'),_0x4196fd,_0x59d667[_0xabe2('0x23')]['message']);return _0x3dd6d9(_0x59d667[_0xabe2('0x23')][_0xabe2('0x25')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4196fd,_0xabe2('0x26'));_0x3dd6d9(_0x59d667[_0xabe2('0x27')][_0xabe2('0x25')]);}})[_0xabe2('0x28')](function(_0x5c83fb){logger[_0xabe2('0x23')](_0xabe2('0x1f'),_0x4196fd,_0x5c83fb);_0x3ba203(_0x5c83fb);});});}function respondWithStatusCode(_0x2c0c92,_0x49cd80){_0x49cd80=_0x49cd80||0xcc;return function(_0x3857cd){if(_0x3857cd){return _0x2c0c92[_0xabe2('0x29')](_0x49cd80);}return _0x2c0c92['status'](_0x49cd80)[_0xabe2('0x2a')]();};}function respondWithResult(_0x3cd356,_0x4c39e9){_0x4c39e9=_0x4c39e9||0xc8;return function(_0x22a760){if(_0x22a760){return _0x3cd356['status'](_0x4c39e9)[_0xabe2('0x2b')](_0x22a760);}};}function respondWithFilteredResult(_0x18f7b3,_0x20aee1){return function(_0x8a5517){if(_0x8a5517){var _0x302919=_0x8a5517[_0xabe2('0x2c')],_0x2b2535=_0x20aee1[_0xabe2('0x2d')],_0x293e3e=_0x20aee1[_0xabe2('0x2d')]+_0x20aee1[_0xabe2('0x2e')],_0x4a8738;if(_0x293e3e>=_0x302919){_0x293e3e=_0x302919;_0x4a8738=0xc8;}else{_0x4a8738=0xce;}_0x18f7b3[_0xabe2('0x2f')](_0x4a8738);return _0x18f7b3['set'](_0xabe2('0x30'),_0x2b2535+'-'+_0x293e3e+'/'+_0x302919)[_0xabe2('0x2b')](_0x8a5517);}return null;};}function patchUpdates(_0x464a01){return function(_0x4ff339){try{jsonpatch[_0xabe2('0x31')](_0x4ff339,_0x464a01,!![]);}catch(_0x2ea99d){return BPromise[_0xabe2('0x32')](_0x2ea99d);}return _0x4ff339[_0xabe2('0x33')]();};}function saveUpdates(_0x436a78,_0x27df96){return function(_0x5c5451){if(_0x5c5451){return _0x5c5451['update'](_0x436a78)['then'](function(_0x52e3ad){return _0x52e3ad;});}return null;};}function removeEntity(_0x667d0b,_0xa7e356){return function(_0x5aacbb){if(_0x5aacbb){return _0x5aacbb[_0xabe2('0x34')]()['then'](function(){_0x667d0b[_0xabe2('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ea4ea,_0x264e25){return function(_0xffa094){if(!_0xffa094){_0x5ea4ea[_0xabe2('0x29')](0x194);}return _0xffa094;};}function handleError(_0x343329,_0x2a12d0){_0x2a12d0=_0x2a12d0||0x1f4;return function(_0x1be786){logger['error'](_0x1be786['stack']);if(_0x1be786['name']){delete _0x1be786[_0xabe2('0x35')];}_0x343329[_0xabe2('0x2f')](_0x2a12d0)['send'](_0x1be786);};}exports[_0xabe2('0x36')]=function(_0x568cdd,_0x510ca1){var _0x438d68={},_0x4fd7c2={},_0x25f4c6={'count':0x0,'rows':[]};var _0x97363a=_[_0xabe2('0x37')](db[_0xabe2('0x38')][_0xabe2('0x39')],function(_0x170940){return{'name':_0x170940[_0xabe2('0x3a')],'type':_0x170940[_0xabe2('0x3b')]['key']};});_0x4fd7c2['model']=_[_0xabe2('0x37')](_0x97363a,_0xabe2('0x35'));_0x4fd7c2['query']=_[_0xabe2('0x3c')](_0x568cdd[_0xabe2('0x3d')]);_0x4fd7c2[_0xabe2('0x3e')]=_[_0xabe2('0x3f')](_0x4fd7c2[_0xabe2('0x40')],_0x4fd7c2['query']);_0x438d68[_0xabe2('0x41')]=_[_0xabe2('0x3f')](_0x4fd7c2['model'],qs['fields'](_0x568cdd[_0xabe2('0x3d')]['fields']));_0x438d68['attributes']=_0x438d68[_0xabe2('0x41')][_0xabe2('0x42')]?_0x438d68[_0xabe2('0x41')]:_0x4fd7c2[_0xabe2('0x40')];if(!_0x568cdd[_0xabe2('0x3d')]['hasOwnProperty']('nolimit')){_0x438d68['limit']=qs[_0xabe2('0x2e')](_0x568cdd['query'][_0xabe2('0x2e')]);_0x438d68['offset']=qs[_0xabe2('0x2d')](_0x568cdd[_0xabe2('0x3d')]['offset']);}_0x438d68['order']=qs[_0xabe2('0x43')](_0x568cdd[_0xabe2('0x3d')][_0xabe2('0x43')]);_0x438d68[_0xabe2('0x44')]=qs['filters'](_[_0xabe2('0x45')](_0x568cdd[_0xabe2('0x3d')],_0x4fd7c2[_0xabe2('0x3e')]),_0x97363a);if(_0x568cdd[_0xabe2('0x3d')]['filter']){_0x438d68[_0xabe2('0x44')]=_[_0xabe2('0x46')](_0x438d68[_0xabe2('0x44')],{'$or':_['map'](_0x97363a,function(_0x4114ce){if(_0x4114ce[_0xabe2('0x3b')]!==_0xabe2('0x47')){var _0x61aa2f={};_0x61aa2f[_0x4114ce[_0xabe2('0x35')]]={'$like':'%'+_0x568cdd[_0xabe2('0x3d')]['filter']+'%'};return _0x61aa2f;}})});}_0x438d68=_[_0xabe2('0x46')]({},_0x438d68,_0x568cdd[_0xabe2('0x48')]);var _0x17297c={'where':_0x438d68['where']};return db['FreshdeskConfiguration'][_0xabe2('0x2c')](_0x17297c)['then'](function(_0x28b71f){_0x25f4c6[_0xabe2('0x2c')]=_0x28b71f;if(_0x568cdd['query']['includeAll']){_0x438d68[_0xabe2('0x49')]=[{'all':!![]}];}return db[_0xabe2('0x38')]['findAll'](_0x438d68);})[_0xabe2('0x1d')](function(_0x45aa10){_0x25f4c6['rows']=_0x45aa10;return _0x25f4c6;})['then'](respondWithFilteredResult(_0x510ca1,_0x438d68))['catch'](handleError(_0x510ca1,null));};exports[_0xabe2('0x4a')]=function(_0x3d1788,_0x1fa5fd){var _0x52760f={'raw':![],'where':{'id':_0x3d1788[_0xabe2('0x4b')]['id']}},_0x3b9f11={};_0x3b9f11[_0xabe2('0x40')]=_[_0xabe2('0x3c')](db[_0xabe2('0x38')][_0xabe2('0x39')]);_0x3b9f11[_0xabe2('0x3d')]=_['keys'](_0x3d1788[_0xabe2('0x3d')]);_0x3b9f11[_0xabe2('0x3e')]=_[_0xabe2('0x3f')](_0x3b9f11['model'],_0x3b9f11['query']);_0x52760f[_0xabe2('0x41')]=_[_0xabe2('0x3f')](_0x3b9f11[_0xabe2('0x40')],qs[_0xabe2('0x4c')](_0x3d1788[_0xabe2('0x3d')][_0xabe2('0x4c')]));_0x52760f[_0xabe2('0x41')]=_0x52760f[_0xabe2('0x41')][_0xabe2('0x42')]?_0x52760f[_0xabe2('0x41')]:_0x3b9f11[_0xabe2('0x40')];if(_0x3d1788[_0xabe2('0x3d')]['includeAll']){_0x52760f[_0xabe2('0x49')]=[{'all':!![]}];}_0x52760f=_[_0xabe2('0x46')]({},_0x52760f,_0x3d1788['options']);return db[_0xabe2('0x38')]['find'](_0x52760f)['then'](handleEntityNotFound(_0x1fa5fd,null))['then'](respondWithResult(_0x1fa5fd,null))[_0xabe2('0x28')](handleError(_0x1fa5fd,null));};exports[_0xabe2('0x4d')]=function(_0x1c34cd,_0x2df209){return db['FreshdeskConfiguration'][_0xabe2('0x4d')](_0x1c34cd[_0xabe2('0x4e')],{})[_0xabe2('0x1d')](respondWithResult(_0x2df209,0xc9))['catch'](handleError(_0x2df209,null));};exports[_0xabe2('0x4f')]=function(_0x3bd3b1,_0x3a2b1e){if(_0x3bd3b1[_0xabe2('0x4e')]['id']){delete _0x3bd3b1[_0xabe2('0x4e')]['id'];}return db[_0xabe2('0x38')][_0xabe2('0x50')]({'where':{'id':_0x3bd3b1[_0xabe2('0x4b')]['id']}})[_0xabe2('0x1d')](handleEntityNotFound(_0x3a2b1e,null))[_0xabe2('0x1d')](saveUpdates(_0x3bd3b1[_0xabe2('0x4e')],null))['then'](respondWithResult(_0x3a2b1e,null))[_0xabe2('0x28')](handleError(_0x3a2b1e,null));};exports['destroy']=function(_0x201fa6,_0x6ad87a){return db[_0xabe2('0x38')][_0xabe2('0x50')]({'where':{'id':_0x201fa6[_0xabe2('0x4b')]['id']}})[_0xabe2('0x1d')](handleEntityNotFound(_0x6ad87a,null))[_0xabe2('0x1d')](removeEntity(_0x6ad87a,null))[_0xabe2('0x28')](handleError(_0x6ad87a,null));};exports['getFields']=function(_0x4cef3a,_0x481660,_0x3708d1){var _0x3748a1={};var _0x5cd31e={};var _0x5ccfd6;var _0x288d6e;return db[_0xabe2('0x38')][_0xabe2('0x51')]({'where':{'id':_0x4cef3a[_0xabe2('0x4b')]['id']}})[_0xabe2('0x1d')](handleEntityNotFound(_0x481660,null))['then'](function(_0x237cb9){if(_0x237cb9){_0x5ccfd6=_0x237cb9;_0x5cd31e[_0xabe2('0x40')]=_['keys'](db[_0xabe2('0x52')]['rawAttributes']);_0x5cd31e[_0xabe2('0x3d')]=_[_0xabe2('0x3c')](_0x4cef3a[_0xabe2('0x3d')]);_0x5cd31e[_0xabe2('0x3e')]=_[_0xabe2('0x3f')](_0x5cd31e[_0xabe2('0x40')],_0x5cd31e[_0xabe2('0x3d')]);_0x3748a1[_0xabe2('0x41')]=_[_0xabe2('0x3f')](_0x5cd31e[_0xabe2('0x40')],qs[_0xabe2('0x4c')](_0x4cef3a[_0xabe2('0x3d')][_0xabe2('0x4c')]));_0x3748a1['attributes']=_0x3748a1[_0xabe2('0x41')][_0xabe2('0x42')]?_0x3748a1[_0xabe2('0x41')]:_0x5cd31e[_0xabe2('0x40')];_0x3748a1[_0xabe2('0x53')]=qs[_0xabe2('0x43')](_0x4cef3a[_0xabe2('0x3d')][_0xabe2('0x43')]);_0x3748a1[_0xabe2('0x44')]=qs[_0xabe2('0x3e')](_[_0xabe2('0x45')](_0x4cef3a[_0xabe2('0x3d')],_0x5cd31e['filters']));if(_0x4cef3a[_0xabe2('0x3d')]['filter']){_0x3748a1[_0xabe2('0x44')]=_['merge'](_0x3748a1['where'],{'$or':_[_0xabe2('0x37')](_0x3748a1[_0xabe2('0x41')],function(_0x3c7798){var _0x4e5df6={};_0x4e5df6[_0x3c7798]={'$like':'%'+_0x4cef3a['query']['filter']+'%'};return _0x4e5df6;})});}_0x3748a1=_[_0xabe2('0x46')]({},_0x3748a1,_0x4cef3a[_0xabe2('0x48')]);return _0x5ccfd6[_0xabe2('0x54')](_0x3748a1);}})[_0xabe2('0x1d')](function(_0x33b89f){if(_0x33b89f){_0x288d6e=_0x33b89f[_0xabe2('0x42')];if(!_0x4cef3a['query'][_0xabe2('0x55')](_0xabe2('0x56'))){_0x3748a1[_0xabe2('0x2e')]=qs[_0xabe2('0x2e')](_0x4cef3a[_0xabe2('0x3d')]['limit']);_0x3748a1['offset']=qs[_0xabe2('0x2d')](_0x4cef3a[_0xabe2('0x3d')]['offset']);}return _0x5ccfd6[_0xabe2('0x54')](_0x3748a1);}})[_0xabe2('0x1d')](function(_0x31480e){if(_0x31480e){return _0x31480e?{'count':_0x288d6e,'rows':_0x31480e}:null;}})[_0xabe2('0x1d')](respondWithResult(_0x481660,null))[_0xabe2('0x28')](handleError(_0x481660,null));};exports['getSubjects']=function(_0x1a6909,_0xcb2573,_0x29d85d){var _0x1ea1b5={};var _0x4bf702={};var _0x4884bf;var _0x412725;return db[_0xabe2('0x38')][_0xabe2('0x51')]({'where':{'id':_0x1a6909[_0xabe2('0x4b')]['id']}})[_0xabe2('0x1d')](handleEntityNotFound(_0xcb2573,null))[_0xabe2('0x1d')](function(_0x59ae11){if(_0x59ae11){_0x4884bf=_0x59ae11;_0x4bf702[_0xabe2('0x40')]=_[_0xabe2('0x3c')](db[_0xabe2('0x52')][_0xabe2('0x39')]);_0x4bf702[_0xabe2('0x3d')]=_[_0xabe2('0x3c')](_0x1a6909['query']);_0x4bf702[_0xabe2('0x3e')]=_[_0xabe2('0x3f')](_0x4bf702[_0xabe2('0x40')],_0x4bf702[_0xabe2('0x3d')]);_0x1ea1b5[_0xabe2('0x41')]=_['intersection'](_0x4bf702[_0xabe2('0x40')],qs[_0xabe2('0x4c')](_0x1a6909['query'][_0xabe2('0x4c')]));_0x1ea1b5[_0xabe2('0x41')]=_0x1ea1b5[_0xabe2('0x41')][_0xabe2('0x42')]?_0x1ea1b5['attributes']:_0x4bf702[_0xabe2('0x40')];_0x1ea1b5[_0xabe2('0x53')]=qs[_0xabe2('0x43')](_0x1a6909[_0xabe2('0x3d')][_0xabe2('0x43')]);_0x1ea1b5['where']=qs[_0xabe2('0x3e')](_[_0xabe2('0x45')](_0x1a6909['query'],_0x4bf702[_0xabe2('0x3e')]));if(_0x1a6909[_0xabe2('0x3d')][_0xabe2('0x57')]){_0x1ea1b5[_0xabe2('0x44')]=_[_0xabe2('0x46')](_0x1ea1b5[_0xabe2('0x44')],{'$or':_[_0xabe2('0x37')](_0x1ea1b5[_0xabe2('0x41')],function(_0x4377a3){var _0x49f06d={};_0x49f06d[_0x4377a3]={'$like':'%'+_0x1a6909[_0xabe2('0x3d')]['filter']+'%'};return _0x49f06d;})});}_0x1ea1b5=_['merge']({},_0x1ea1b5,_0x1a6909[_0xabe2('0x48')]);return _0x4884bf['getSubjects'](_0x1ea1b5);}})[_0xabe2('0x1d')](function(_0x61e288){if(_0x61e288){_0x412725=_0x61e288[_0xabe2('0x42')];if(!_0x1a6909[_0xabe2('0x3d')][_0xabe2('0x55')](_0xabe2('0x56'))){_0x1ea1b5[_0xabe2('0x2e')]=qs[_0xabe2('0x2e')](_0x1a6909[_0xabe2('0x3d')][_0xabe2('0x2e')]);_0x1ea1b5['offset']=qs[_0xabe2('0x2d')](_0x1a6909[_0xabe2('0x3d')][_0xabe2('0x2d')]);}return _0x4884bf[_0xabe2('0x58')](_0x1ea1b5);}})['then'](function(_0x3a05db){if(_0x3a05db){return _0x3a05db?{'count':_0x412725,'rows':_0x3a05db}:null;}})[_0xabe2('0x1d')](respondWithResult(_0xcb2573,null))[_0xabe2('0x28')](handleError(_0xcb2573,null));};exports[_0xabe2('0x59')]=function(_0x30f532,_0x1c0b82,_0xc66a7c){var _0x563bfb={};var _0x2baeef={};var _0x6544cc;var _0x3e7427;return db['FreshdeskConfiguration'][_0xabe2('0x51')]({'where':{'id':_0x30f532[_0xabe2('0x4b')]['id']}})[_0xabe2('0x1d')](handleEntityNotFound(_0x1c0b82,null))[_0xabe2('0x1d')](function(_0x270829){if(_0x270829){_0x6544cc=_0x270829;_0x2baeef[_0xabe2('0x40')]=_[_0xabe2('0x3c')](db[_0xabe2('0x52')][_0xabe2('0x39')]);_0x2baeef[_0xabe2('0x3d')]=_[_0xabe2('0x3c')](_0x30f532[_0xabe2('0x3d')]);_0x2baeef[_0xabe2('0x3e')]=_['intersection'](_0x2baeef[_0xabe2('0x40')],_0x2baeef[_0xabe2('0x3d')]);_0x563bfb[_0xabe2('0x41')]=_[_0xabe2('0x3f')](_0x2baeef['model'],qs[_0xabe2('0x4c')](_0x30f532[_0xabe2('0x3d')][_0xabe2('0x4c')]));_0x563bfb[_0xabe2('0x41')]=_0x563bfb['attributes'][_0xabe2('0x42')]?_0x563bfb[_0xabe2('0x41')]:_0x2baeef[_0xabe2('0x40')];_0x563bfb[_0xabe2('0x53')]=qs[_0xabe2('0x43')](_0x30f532[_0xabe2('0x3d')][_0xabe2('0x43')]);_0x563bfb[_0xabe2('0x44')]=qs[_0xabe2('0x3e')](_['pick'](_0x30f532[_0xabe2('0x3d')],_0x2baeef[_0xabe2('0x3e')]));if(_0x30f532[_0xabe2('0x3d')][_0xabe2('0x57')]){_0x563bfb[_0xabe2('0x44')]=_[_0xabe2('0x46')](_0x563bfb[_0xabe2('0x44')],{'$or':_[_0xabe2('0x37')](_0x563bfb[_0xabe2('0x41')],function(_0xd9346f){var _0x364f8c={};_0x364f8c[_0xd9346f]={'$like':'%'+_0x30f532[_0xabe2('0x3d')][_0xabe2('0x57')]+'%'};return _0x364f8c;})});}_0x563bfb=_[_0xabe2('0x46')]({},_0x563bfb,_0x30f532[_0xabe2('0x48')]);return _0x6544cc[_0xabe2('0x59')](_0x563bfb);}})[_0xabe2('0x1d')](function(_0x980148){if(_0x980148){_0x3e7427=_0x980148[_0xabe2('0x42')];if(!_0x30f532['query'][_0xabe2('0x55')](_0xabe2('0x56'))){_0x563bfb[_0xabe2('0x2e')]=qs['limit'](_0x30f532[_0xabe2('0x3d')][_0xabe2('0x2e')]);_0x563bfb[_0xabe2('0x2d')]=qs['offset'](_0x30f532['query'][_0xabe2('0x2d')]);}return _0x6544cc[_0xabe2('0x59')](_0x563bfb);}})['then'](function(_0x584c1a){if(_0x584c1a){return _0x584c1a?{'count':_0x3e7427,'rows':_0x584c1a}:null;}})[_0xabe2('0x1d')](respondWithResult(_0x1c0b82,null))[_0xabe2('0x28')](handleError(_0x1c0b82,null));};exports[_0xabe2('0x5a')]=function(_0x546033,_0x12f3e1,_0x33bb31){var _0x78ec52={};var _0x528dc3={};var _0x3d4d2b;var _0xfe3157;return db[_0xabe2('0x38')][_0xabe2('0x51')]({'where':{'id':_0x546033['params']['id']}})[_0xabe2('0x1d')](handleEntityNotFound(_0x12f3e1,null))[_0xabe2('0x1d')](function(_0x1b7621){if(_0x1b7621){_0x3d4d2b=_0x1b7621;_0x528dc3['model']=_[_0xabe2('0x3c')](db[_0xabe2('0x5b')]['rawAttributes']);_0x528dc3[_0xabe2('0x3d')]=_[_0xabe2('0x3c')](_0x546033[_0xabe2('0x3d')]);_0x528dc3['filters']=_[_0xabe2('0x3f')](_0x528dc3[_0xabe2('0x40')],_0x528dc3[_0xabe2('0x3d')]);_0x78ec52[_0xabe2('0x41')]=_[_0xabe2('0x3f')](_0x528dc3['model'],qs['fields'](_0x546033[_0xabe2('0x3d')][_0xabe2('0x4c')]));_0x78ec52['attributes']=_0x78ec52[_0xabe2('0x41')][_0xabe2('0x42')]?_0x78ec52[_0xabe2('0x41')]:_0x528dc3[_0xabe2('0x40')];_0x78ec52[_0xabe2('0x53')]=qs['sort'](_0x546033[_0xabe2('0x3d')][_0xabe2('0x43')]);_0x78ec52['where']=qs[_0xabe2('0x3e')](_[_0xabe2('0x45')](_0x546033[_0xabe2('0x3d')],_0x528dc3['filters']));if(_0x546033[_0xabe2('0x3d')][_0xabe2('0x57')]){_0x78ec52[_0xabe2('0x44')]=_[_0xabe2('0x46')](_0x78ec52[_0xabe2('0x44')],{'$or':_['map'](_0x78ec52[_0xabe2('0x41')],function(_0x326bf5){var _0x3db4b6={};_0x3db4b6[_0x326bf5]={'$like':'%'+_0x546033[_0xabe2('0x3d')][_0xabe2('0x57')]+'%'};return _0x3db4b6;})});}_0x78ec52=_[_0xabe2('0x46')]({},_0x78ec52,_0x546033[_0xabe2('0x48')]);return _0x3d4d2b[_0xabe2('0x5a')](_0x78ec52);}})[_0xabe2('0x1d')](function(_0x3b3d87){if(_0x3b3d87){_0xfe3157=_0x3b3d87[_0xabe2('0x42')];if(!_0x546033[_0xabe2('0x3d')][_0xabe2('0x55')](_0xabe2('0x56'))){_0x78ec52[_0xabe2('0x2e')]=qs[_0xabe2('0x2e')](_0x546033[_0xabe2('0x3d')][_0xabe2('0x2e')]);_0x78ec52[_0xabe2('0x2d')]=qs[_0xabe2('0x2d')](_0x546033[_0xabe2('0x3d')][_0xabe2('0x2d')]);}return _0x3d4d2b[_0xabe2('0x5a')](_0x78ec52);}})[_0xabe2('0x1d')](function(_0x25d6f7){if(_0x25d6f7){return _0x25d6f7?{'count':_0xfe3157,'rows':_0x25d6f7}:null;}})[_0xabe2('0x1d')](respondWithResult(_0x12f3e1,null))[_0xabe2('0x28')](handleError(_0x12f3e1,null));};exports[_0xabe2('0x5c')]=function(_0x4b893c,_0x57c38e,_0x41b0d9){if(_0x4b893c['body']['id']){delete _0x4b893c[_0xabe2('0x4e')]['id'];}return db[_0xabe2('0x38')]['findOne']({'where':{'id':_0x4b893c[_0xabe2('0x4b')]['id']}})[_0xabe2('0x1d')](handleEntityNotFound(_0x57c38e,null))[_0xabe2('0x1d')](function(_0x40e8cd){if(_0x40e8cd){return _0x40e8cd[_0xabe2('0x5c')](_0x4b893c[_0xabe2('0x4e')][_0xabe2('0x5d')]||[]);}return null;})[_0xabe2('0x1d')](respondWithResult(_0x57c38e,null))[_0xabe2('0x28')](handleError(_0x57c38e,null));}; \ No newline at end of file +var _0x6f72=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','debug','request\x20sent','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','destroy','end','name','send','FreshdeskConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','show','params','fields','include','find','catch','create','body','FreshdeskField','getFields','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','squel','crypto','to-csv'];(function(_0x4c7775,_0x1f6095){var _0x1fbe10=function(_0xd5f21b){while(--_0xd5f21b){_0x4c7775['push'](_0x4c7775['shift']());}};_0x1fbe10(++_0x1f6095);}(_0x6f72,0xae));var _0x26f7=function(_0x47e739,_0x551381){_0x47e739=_0x47e739-0x0;var _0x1c0aad=_0x6f72[_0x47e739];return _0x1c0aad;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x26f7('0x0'));var rimraf=require(_0x26f7('0x1'));var zipdir=require(_0x26f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x26f7('0x3'));var moment=require(_0x26f7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x26f7('0x5'));var util=require(_0x26f7('0x6'));var path=require('path');var sox=require(_0x26f7('0x7'));var csv=require('to-csv');var ejs=require(_0x26f7('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x26f7('0x9'));var crypto=require(_0x26f7('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x26f7('0xb'));var querystring=require(_0x26f7('0xc'));var Papa=require(_0x26f7('0xd'));var Redis=require(_0x26f7('0xe'));var authService=require(_0x26f7('0xf'));var qs=require(_0x26f7('0x10'));var as=require(_0x26f7('0x11'));var hardwareService=require(_0x26f7('0x12'));var logger=require('../../config/logger')(_0x26f7('0x13'));var utils=require('../../config/utils');var config=require(_0x26f7('0x14'));var db=require(_0x26f7('0x15'))['db'];var jayson=require(_0x26f7('0x16'));var client=jayson[_0x26f7('0x17')][_0x26f7('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2e1300,_0x157bcc,_0x64b65a){if(_0x64b65a){var _0x3e3fab=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e3fab[_0x26f7('0x19')](_0x157bcc)){return _0x2e1300;}else{throw new db[(_0x26f7('0x1a'))][(_0x26f7('0x1b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2e1300;}}function respondWithRpcPromise(_0x330387,_0xe6ba20,_0x1693b0,_0x46c0d5){return new BPromise(function(_0x5014b2,_0x127d23){var _0x5e9d09=_0x46c0d5||client;return _0x5e9d09[_0x26f7('0x1c')](_0x330387,_0x1693b0)[_0x26f7('0x1d')](function(_0x27d28f){logger[_0x26f7('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xe6ba20,'request\x20sent');logger[_0x26f7('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0xe6ba20,_0x26f7('0x20'),JSON[_0x26f7('0x21')](_0x27d28f));if(_0x27d28f[_0x26f7('0x22')]){if(_0x27d28f[_0x26f7('0x22')][_0x26f7('0x23')]===0x1f4){logger[_0x26f7('0x22')](_0x26f7('0x24'),_0xe6ba20,_0x27d28f[_0x26f7('0x22')][_0x26f7('0x25')]);return _0x127d23(_0x27d28f[_0x26f7('0x22')]['message']);}logger[_0x26f7('0x22')](_0x26f7('0x24'),_0xe6ba20,_0x27d28f[_0x26f7('0x22')][_0x26f7('0x25')]);return _0x5014b2(_0x27d28f[_0x26f7('0x22')][_0x26f7('0x25')]);}else{logger[_0x26f7('0x1e')](_0x26f7('0x24'),_0xe6ba20,_0x26f7('0x20'));_0x5014b2(_0x27d28f[_0x26f7('0x26')][_0x26f7('0x25')]);}})['catch'](function(_0x28c587){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0xe6ba20,_0x28c587);_0x127d23(_0x28c587);});});}function respondWithStatusCode(_0x46fedb,_0x333a53){_0x333a53=_0x333a53||0xcc;return function(_0x19c994){if(_0x19c994){return _0x46fedb[_0x26f7('0x27')](_0x333a53);}return _0x46fedb[_0x26f7('0x28')](_0x333a53)['end']();};}function respondWithResult(_0x337eee,_0x313552){_0x313552=_0x313552||0xc8;return function(_0xafef8b){if(_0xafef8b){return _0x337eee[_0x26f7('0x28')](_0x313552)[_0x26f7('0x29')](_0xafef8b);}};}function respondWithFilteredResult(_0x2a5c27,_0x557169){return function(_0x365c6d){if(_0x365c6d){var _0x5a522d=_0x365c6d['count'],_0x4ade43=_0x557169['offset'],_0x424ea1=_0x557169[_0x26f7('0x2a')]+_0x557169[_0x26f7('0x2b')],_0x4c02a0;if(_0x424ea1>=_0x5a522d){_0x424ea1=_0x5a522d;_0x4c02a0=0xc8;}else{_0x4c02a0=0xce;}_0x2a5c27[_0x26f7('0x28')](_0x4c02a0);return _0x2a5c27[_0x26f7('0x2c')](_0x26f7('0x2d'),_0x4ade43+'-'+_0x424ea1+'/'+_0x5a522d)['json'](_0x365c6d);}return null;};}function patchUpdates(_0x2accb9){return function(_0x5ca32b){try{jsonpatch['apply'](_0x5ca32b,_0x2accb9,!![]);}catch(_0x5a5a65){return BPromise[_0x26f7('0x2e')](_0x5a5a65);}return _0x5ca32b[_0x26f7('0x2f')]();};}function saveUpdates(_0x154fe9,_0x3ae167){return function(_0x494a77){if(_0x494a77){return _0x494a77['update'](_0x154fe9)['then'](function(_0x3f18cc){return _0x3f18cc;});}return null;};}function removeEntity(_0x8bdb69,_0x568e71){return function(_0x3c71c6){if(_0x3c71c6){return _0x3c71c6[_0x26f7('0x30')]()[_0x26f7('0x1d')](function(){_0x8bdb69[_0x26f7('0x28')](0xcc)[_0x26f7('0x31')]();});}};}function handleEntityNotFound(_0x261ffc,_0x49d0bc){return function(_0x38acfa){if(!_0x38acfa){_0x261ffc[_0x26f7('0x27')](0x194);}return _0x38acfa;};}function handleError(_0x1fc71b,_0x544bde){_0x544bde=_0x544bde||0x1f4;return function(_0x6e371c){logger[_0x26f7('0x22')](_0x6e371c['stack']);if(_0x6e371c[_0x26f7('0x32')]){delete _0x6e371c['name'];}_0x1fc71b[_0x26f7('0x28')](_0x544bde)[_0x26f7('0x33')](_0x6e371c);};}exports['index']=function(_0x2973dd,_0xbde39a){var _0x1f858d={},_0x577429={},_0x5af2d7={'count':0x0,'rows':[]};var _0x1e8831=_['map'](db[_0x26f7('0x34')][_0x26f7('0x35')],function(_0x3ecf58){return{'name':_0x3ecf58[_0x26f7('0x36')],'type':_0x3ecf58['type'][_0x26f7('0x37')]};});_0x577429[_0x26f7('0x38')]=_[_0x26f7('0x39')](_0x1e8831,_0x26f7('0x32'));_0x577429[_0x26f7('0x3a')]=_[_0x26f7('0x3b')](_0x2973dd[_0x26f7('0x3a')]);_0x577429[_0x26f7('0x3c')]=_[_0x26f7('0x3d')](_0x577429[_0x26f7('0x38')],_0x577429[_0x26f7('0x3a')]);_0x1f858d['attributes']=_[_0x26f7('0x3d')](_0x577429[_0x26f7('0x38')],qs['fields'](_0x2973dd[_0x26f7('0x3a')]['fields']));_0x1f858d[_0x26f7('0x3e')]=_0x1f858d[_0x26f7('0x3e')][_0x26f7('0x3f')]?_0x1f858d[_0x26f7('0x3e')]:_0x577429[_0x26f7('0x38')];if(!_0x2973dd[_0x26f7('0x3a')][_0x26f7('0x40')](_0x26f7('0x41'))){_0x1f858d[_0x26f7('0x2b')]=qs[_0x26f7('0x2b')](_0x2973dd[_0x26f7('0x3a')][_0x26f7('0x2b')]);_0x1f858d['offset']=qs[_0x26f7('0x2a')](_0x2973dd['query']['offset']);}_0x1f858d[_0x26f7('0x42')]=qs['sort'](_0x2973dd['query'][_0x26f7('0x43')]);_0x1f858d['where']=qs[_0x26f7('0x3c')](_[_0x26f7('0x44')](_0x2973dd[_0x26f7('0x3a')],_0x577429[_0x26f7('0x3c')]),_0x1e8831);if(_0x2973dd[_0x26f7('0x3a')][_0x26f7('0x45')]){_0x1f858d[_0x26f7('0x46')]=_[_0x26f7('0x47')](_0x1f858d[_0x26f7('0x46')],{'$or':_[_0x26f7('0x39')](_0x1e8831,function(_0x5d30d1){if(_0x5d30d1[_0x26f7('0x48')]!==_0x26f7('0x49')){var _0x1767bd={};_0x1767bd[_0x5d30d1['name']]={'$like':'%'+_0x2973dd[_0x26f7('0x3a')][_0x26f7('0x45')]+'%'};return _0x1767bd;}})});}_0x1f858d=_[_0x26f7('0x47')]({},_0x1f858d,_0x2973dd[_0x26f7('0x4a')]);var _0x322728={'where':_0x1f858d[_0x26f7('0x46')]};return db['FreshdeskConfiguration']['count'](_0x322728)[_0x26f7('0x1d')](function(_0x33997e){_0x5af2d7[_0x26f7('0x4b')]=_0x33997e;if(_0x2973dd[_0x26f7('0x3a')][_0x26f7('0x4c')]){_0x1f858d['include']=[{'all':!![]}];}return db[_0x26f7('0x34')]['findAll'](_0x1f858d);})[_0x26f7('0x1d')](function(_0x45e6a8){_0x5af2d7['rows']=_0x45e6a8;return _0x5af2d7;})[_0x26f7('0x1d')](respondWithFilteredResult(_0xbde39a,_0x1f858d))['catch'](handleError(_0xbde39a,null));};exports[_0x26f7('0x4d')]=function(_0x4f4e2b,_0x46d567){var _0x5d4c93={'raw':![],'where':{'id':_0x4f4e2b[_0x26f7('0x4e')]['id']}},_0x17537d={};_0x17537d[_0x26f7('0x38')]=_['keys'](db[_0x26f7('0x34')][_0x26f7('0x35')]);_0x17537d[_0x26f7('0x3a')]=_[_0x26f7('0x3b')](_0x4f4e2b['query']);_0x17537d[_0x26f7('0x3c')]=_[_0x26f7('0x3d')](_0x17537d[_0x26f7('0x38')],_0x17537d[_0x26f7('0x3a')]);_0x5d4c93[_0x26f7('0x3e')]=_[_0x26f7('0x3d')](_0x17537d['model'],qs[_0x26f7('0x4f')](_0x4f4e2b[_0x26f7('0x3a')][_0x26f7('0x4f')]));_0x5d4c93[_0x26f7('0x3e')]=_0x5d4c93['attributes']['length']?_0x5d4c93[_0x26f7('0x3e')]:_0x17537d[_0x26f7('0x38')];if(_0x4f4e2b['query'][_0x26f7('0x4c')]){_0x5d4c93[_0x26f7('0x50')]=[{'all':!![]}];}_0x5d4c93=_[_0x26f7('0x47')]({},_0x5d4c93,_0x4f4e2b[_0x26f7('0x4a')]);return db[_0x26f7('0x34')][_0x26f7('0x51')](_0x5d4c93)['then'](handleEntityNotFound(_0x46d567,null))[_0x26f7('0x1d')](respondWithResult(_0x46d567,null))[_0x26f7('0x52')](handleError(_0x46d567,null));};exports[_0x26f7('0x53')]=function(_0x36e33c,_0x1adf4e){return db[_0x26f7('0x34')]['create'](_0x36e33c[_0x26f7('0x54')],{})['then'](respondWithResult(_0x1adf4e,0xc9))['catch'](handleError(_0x1adf4e,null));};exports['update']=function(_0x3b66ba,_0x5f16d6){if(_0x3b66ba[_0x26f7('0x54')]['id']){delete _0x3b66ba[_0x26f7('0x54')]['id'];}return db['FreshdeskConfiguration'][_0x26f7('0x51')]({'where':{'id':_0x3b66ba[_0x26f7('0x4e')]['id']}})[_0x26f7('0x1d')](handleEntityNotFound(_0x5f16d6,null))[_0x26f7('0x1d')](saveUpdates(_0x3b66ba[_0x26f7('0x54')],null))[_0x26f7('0x1d')](respondWithResult(_0x5f16d6,null))[_0x26f7('0x52')](handleError(_0x5f16d6,null));};exports[_0x26f7('0x30')]=function(_0x318bff,_0x492115){return db[_0x26f7('0x34')]['find']({'where':{'id':_0x318bff[_0x26f7('0x4e')]['id']}})[_0x26f7('0x1d')](handleEntityNotFound(_0x492115,null))[_0x26f7('0x1d')](removeEntity(_0x492115,null))[_0x26f7('0x52')](handleError(_0x492115,null));};exports['getFields']=function(_0x3b91c7,_0x257ab8,_0x1f2baf){var _0x370682={};var _0x40336e={};var _0x5206cc;var _0x407151;return db[_0x26f7('0x34')]['findOne']({'where':{'id':_0x3b91c7[_0x26f7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x257ab8,null))[_0x26f7('0x1d')](function(_0x57d880){if(_0x57d880){_0x5206cc=_0x57d880;_0x40336e['model']=_[_0x26f7('0x3b')](db[_0x26f7('0x55')][_0x26f7('0x35')]);_0x40336e[_0x26f7('0x3a')]=_[_0x26f7('0x3b')](_0x3b91c7['query']);_0x40336e[_0x26f7('0x3c')]=_['intersection'](_0x40336e[_0x26f7('0x38')],_0x40336e[_0x26f7('0x3a')]);_0x370682[_0x26f7('0x3e')]=_['intersection'](_0x40336e['model'],qs[_0x26f7('0x4f')](_0x3b91c7[_0x26f7('0x3a')]['fields']));_0x370682[_0x26f7('0x3e')]=_0x370682['attributes']['length']?_0x370682[_0x26f7('0x3e')]:_0x40336e[_0x26f7('0x38')];_0x370682[_0x26f7('0x42')]=qs[_0x26f7('0x43')](_0x3b91c7[_0x26f7('0x3a')][_0x26f7('0x43')]);_0x370682[_0x26f7('0x46')]=qs[_0x26f7('0x3c')](_[_0x26f7('0x44')](_0x3b91c7[_0x26f7('0x3a')],_0x40336e[_0x26f7('0x3c')]));if(_0x3b91c7[_0x26f7('0x3a')][_0x26f7('0x45')]){_0x370682[_0x26f7('0x46')]=_[_0x26f7('0x47')](_0x370682['where'],{'$or':_[_0x26f7('0x39')](_0x370682[_0x26f7('0x3e')],function(_0xe9a58c){var _0x47836d={};_0x47836d[_0xe9a58c]={'$like':'%'+_0x3b91c7[_0x26f7('0x3a')]['filter']+'%'};return _0x47836d;})});}_0x370682=_[_0x26f7('0x47')]({},_0x370682,_0x3b91c7[_0x26f7('0x4a')]);return _0x5206cc[_0x26f7('0x56')](_0x370682);}})[_0x26f7('0x1d')](function(_0x281135){if(_0x281135){_0x407151=_0x281135[_0x26f7('0x3f')];if(!_0x3b91c7[_0x26f7('0x3a')]['hasOwnProperty'](_0x26f7('0x41'))){_0x370682['limit']=qs[_0x26f7('0x2b')](_0x3b91c7[_0x26f7('0x3a')][_0x26f7('0x2b')]);_0x370682['offset']=qs[_0x26f7('0x2a')](_0x3b91c7[_0x26f7('0x3a')][_0x26f7('0x2a')]);}return _0x5206cc[_0x26f7('0x56')](_0x370682);}})['then'](function(_0x1f072c){if(_0x1f072c){return _0x1f072c?{'count':_0x407151,'rows':_0x1f072c}:null;}})['then'](respondWithResult(_0x257ab8,null))[_0x26f7('0x52')](handleError(_0x257ab8,null));};exports[_0x26f7('0x57')]=function(_0x2b06e0,_0x1452c6,_0x149177){var _0x1b1e6a={};var _0x29f5b1={};var _0x41179f;var _0x46f18e;return db['FreshdeskConfiguration'][_0x26f7('0x58')]({'where':{'id':_0x2b06e0[_0x26f7('0x4e')]['id']}})[_0x26f7('0x1d')](handleEntityNotFound(_0x1452c6,null))[_0x26f7('0x1d')](function(_0x7b203e){if(_0x7b203e){_0x41179f=_0x7b203e;_0x29f5b1[_0x26f7('0x38')]=_[_0x26f7('0x3b')](db['FreshdeskField'][_0x26f7('0x35')]);_0x29f5b1[_0x26f7('0x3a')]=_[_0x26f7('0x3b')](_0x2b06e0['query']);_0x29f5b1[_0x26f7('0x3c')]=_['intersection'](_0x29f5b1['model'],_0x29f5b1['query']);_0x1b1e6a[_0x26f7('0x3e')]=_['intersection'](_0x29f5b1[_0x26f7('0x38')],qs['fields'](_0x2b06e0['query'][_0x26f7('0x4f')]));_0x1b1e6a[_0x26f7('0x3e')]=_0x1b1e6a['attributes'][_0x26f7('0x3f')]?_0x1b1e6a[_0x26f7('0x3e')]:_0x29f5b1['model'];_0x1b1e6a[_0x26f7('0x42')]=qs['sort'](_0x2b06e0['query'][_0x26f7('0x43')]);_0x1b1e6a[_0x26f7('0x46')]=qs['filters'](_['pick'](_0x2b06e0[_0x26f7('0x3a')],_0x29f5b1[_0x26f7('0x3c')]));if(_0x2b06e0[_0x26f7('0x3a')]['filter']){_0x1b1e6a[_0x26f7('0x46')]=_[_0x26f7('0x47')](_0x1b1e6a[_0x26f7('0x46')],{'$or':_[_0x26f7('0x39')](_0x1b1e6a['attributes'],function(_0x1eb30e){var _0x226684={};_0x226684[_0x1eb30e]={'$like':'%'+_0x2b06e0[_0x26f7('0x3a')][_0x26f7('0x45')]+'%'};return _0x226684;})});}_0x1b1e6a=_[_0x26f7('0x47')]({},_0x1b1e6a,_0x2b06e0[_0x26f7('0x4a')]);return _0x41179f[_0x26f7('0x57')](_0x1b1e6a);}})['then'](function(_0x3c0236){if(_0x3c0236){_0x46f18e=_0x3c0236[_0x26f7('0x3f')];if(!_0x2b06e0[_0x26f7('0x3a')][_0x26f7('0x40')](_0x26f7('0x41'))){_0x1b1e6a['limit']=qs[_0x26f7('0x2b')](_0x2b06e0['query'][_0x26f7('0x2b')]);_0x1b1e6a[_0x26f7('0x2a')]=qs[_0x26f7('0x2a')](_0x2b06e0[_0x26f7('0x3a')][_0x26f7('0x2a')]);}return _0x41179f[_0x26f7('0x57')](_0x1b1e6a);}})[_0x26f7('0x1d')](function(_0x3a9d33){if(_0x3a9d33){return _0x3a9d33?{'count':_0x46f18e,'rows':_0x3a9d33}:null;}})[_0x26f7('0x1d')](respondWithResult(_0x1452c6,null))['catch'](handleError(_0x1452c6,null));};exports[_0x26f7('0x59')]=function(_0x5df8b5,_0x3af117,_0x409e6a){var _0x453fb0={};var _0x2ac446={};var _0x4efe49;var _0x5c7697;return db[_0x26f7('0x34')][_0x26f7('0x58')]({'where':{'id':_0x5df8b5['params']['id']}})[_0x26f7('0x1d')](handleEntityNotFound(_0x3af117,null))[_0x26f7('0x1d')](function(_0x4db788){if(_0x4db788){_0x4efe49=_0x4db788;_0x2ac446[_0x26f7('0x38')]=_[_0x26f7('0x3b')](db[_0x26f7('0x55')]['rawAttributes']);_0x2ac446[_0x26f7('0x3a')]=_[_0x26f7('0x3b')](_0x5df8b5[_0x26f7('0x3a')]);_0x2ac446[_0x26f7('0x3c')]=_[_0x26f7('0x3d')](_0x2ac446[_0x26f7('0x38')],_0x2ac446[_0x26f7('0x3a')]);_0x453fb0[_0x26f7('0x3e')]=_[_0x26f7('0x3d')](_0x2ac446['model'],qs[_0x26f7('0x4f')](_0x5df8b5[_0x26f7('0x3a')][_0x26f7('0x4f')]));_0x453fb0[_0x26f7('0x3e')]=_0x453fb0['attributes'][_0x26f7('0x3f')]?_0x453fb0[_0x26f7('0x3e')]:_0x2ac446[_0x26f7('0x38')];_0x453fb0[_0x26f7('0x42')]=qs['sort'](_0x5df8b5[_0x26f7('0x3a')][_0x26f7('0x43')]);_0x453fb0['where']=qs[_0x26f7('0x3c')](_[_0x26f7('0x44')](_0x5df8b5[_0x26f7('0x3a')],_0x2ac446[_0x26f7('0x3c')]));if(_0x5df8b5['query'][_0x26f7('0x45')]){_0x453fb0['where']=_['merge'](_0x453fb0['where'],{'$or':_[_0x26f7('0x39')](_0x453fb0[_0x26f7('0x3e')],function(_0x1a81c5){var _0x4bd2e9={};_0x4bd2e9[_0x1a81c5]={'$like':'%'+_0x5df8b5[_0x26f7('0x3a')][_0x26f7('0x45')]+'%'};return _0x4bd2e9;})});}_0x453fb0=_['merge']({},_0x453fb0,_0x5df8b5[_0x26f7('0x4a')]);return _0x4efe49[_0x26f7('0x59')](_0x453fb0);}})[_0x26f7('0x1d')](function(_0x5e4f4e){if(_0x5e4f4e){_0x5c7697=_0x5e4f4e[_0x26f7('0x3f')];if(!_0x5df8b5[_0x26f7('0x3a')][_0x26f7('0x40')]('nolimit')){_0x453fb0[_0x26f7('0x2b')]=qs['limit'](_0x5df8b5['query']['limit']);_0x453fb0[_0x26f7('0x2a')]=qs['offset'](_0x5df8b5[_0x26f7('0x3a')]['offset']);}return _0x4efe49[_0x26f7('0x59')](_0x453fb0);}})[_0x26f7('0x1d')](function(_0xb4d0e5){if(_0xb4d0e5){return _0xb4d0e5?{'count':_0x5c7697,'rows':_0xb4d0e5}:null;}})[_0x26f7('0x1d')](respondWithResult(_0x3af117,null))[_0x26f7('0x52')](handleError(_0x3af117,null));};exports[_0x26f7('0x5a')]=function(_0x3e9a81,_0x3ecba6,_0xb6e7e8){var _0x453d0f={};var _0x69253d={};var _0x1afc9a;var _0xb1dcf3;return db['FreshdeskConfiguration'][_0x26f7('0x58')]({'where':{'id':_0x3e9a81[_0x26f7('0x4e')]['id']}})[_0x26f7('0x1d')](handleEntityNotFound(_0x3ecba6,null))[_0x26f7('0x1d')](function(_0x12f8fd){if(_0x12f8fd){_0x1afc9a=_0x12f8fd;_0x69253d[_0x26f7('0x38')]=_[_0x26f7('0x3b')](db[_0x26f7('0x5b')][_0x26f7('0x35')]);_0x69253d[_0x26f7('0x3a')]=_[_0x26f7('0x3b')](_0x3e9a81[_0x26f7('0x3a')]);_0x69253d[_0x26f7('0x3c')]=_[_0x26f7('0x3d')](_0x69253d['model'],_0x69253d[_0x26f7('0x3a')]);_0x453d0f[_0x26f7('0x3e')]=_[_0x26f7('0x3d')](_0x69253d['model'],qs['fields'](_0x3e9a81['query'][_0x26f7('0x4f')]));_0x453d0f[_0x26f7('0x3e')]=_0x453d0f['attributes'][_0x26f7('0x3f')]?_0x453d0f['attributes']:_0x69253d['model'];_0x453d0f[_0x26f7('0x42')]=qs[_0x26f7('0x43')](_0x3e9a81[_0x26f7('0x3a')]['sort']);_0x453d0f[_0x26f7('0x46')]=qs[_0x26f7('0x3c')](_[_0x26f7('0x44')](_0x3e9a81[_0x26f7('0x3a')],_0x69253d[_0x26f7('0x3c')]));if(_0x3e9a81[_0x26f7('0x3a')]['filter']){_0x453d0f[_0x26f7('0x46')]=_[_0x26f7('0x47')](_0x453d0f[_0x26f7('0x46')],{'$or':_['map'](_0x453d0f[_0x26f7('0x3e')],function(_0x35d9df){var _0x5d8ff6={};_0x5d8ff6[_0x35d9df]={'$like':'%'+_0x3e9a81[_0x26f7('0x3a')][_0x26f7('0x45')]+'%'};return _0x5d8ff6;})});}_0x453d0f=_['merge']({},_0x453d0f,_0x3e9a81[_0x26f7('0x4a')]);return _0x1afc9a[_0x26f7('0x5a')](_0x453d0f);}})[_0x26f7('0x1d')](function(_0x1c78ce){if(_0x1c78ce){_0xb1dcf3=_0x1c78ce['length'];if(!_0x3e9a81[_0x26f7('0x3a')][_0x26f7('0x40')](_0x26f7('0x41'))){_0x453d0f[_0x26f7('0x2b')]=qs[_0x26f7('0x2b')](_0x3e9a81[_0x26f7('0x3a')][_0x26f7('0x2b')]);_0x453d0f[_0x26f7('0x2a')]=qs[_0x26f7('0x2a')](_0x3e9a81[_0x26f7('0x3a')]['offset']);}return _0x1afc9a[_0x26f7('0x5a')](_0x453d0f);}})[_0x26f7('0x1d')](function(_0xdc1568){if(_0xdc1568){return _0xdc1568?{'count':_0xb1dcf3,'rows':_0xdc1568}:null;}})['then'](respondWithResult(_0x3ecba6,null))[_0x26f7('0x52')](handleError(_0x3ecba6,null));};exports[_0x26f7('0x5c')]=function(_0x2e1d0a,_0x244e7c,_0x3f4c5d){if(_0x2e1d0a[_0x26f7('0x54')]['id']){delete _0x2e1d0a['body']['id'];}return db[_0x26f7('0x34')][_0x26f7('0x58')]({'where':{'id':_0x2e1d0a[_0x26f7('0x4e')]['id']}})[_0x26f7('0x1d')](handleEntityNotFound(_0x244e7c,null))['then'](function(_0x5ba643){if(_0x5ba643){return _0x5ba643[_0x26f7('0x5c')](_0x2e1d0a[_0x26f7('0x54')]['ids']||[]);}return null;})[_0x26f7('0x1d')](respondWithResult(_0x244e7c,null))[_0x26f7('0x52')](handleError(_0x244e7c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 7d7d00f..b9f1548 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 _0x8e73=['path','rimraf','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api','bluebird','request-promise'];(function(_0xdaffc7,_0x453662){var _0x503d65=function(_0x4070fc){while(--_0x4070fc){_0xdaffc7['push'](_0xdaffc7['shift']());}};_0x503d65(++_0x453662);}(_0x8e73,0xb6));var _0x38e7=function(_0x4baa95,_0x528a9b){_0x4baa95=_0x4baa95-0x0;var _0x145101=_0x8e73[_0x4baa95];return _0x145101;};'use strict';var _=require('lodash');var util=require(_0x38e7('0x0'));var logger=require(_0x38e7('0x1'))(_0x38e7('0x2'));var moment=require('moment');var BPromise=require(_0x38e7('0x3'));var rp=require(_0x38e7('0x4'));var fs=require('fs');var path=require(_0x38e7('0x5'));var rimraf=require(_0x38e7('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x38e7('0x7')]=function(_0xb25507,_0x5f1e1a){return _0xb25507[_0x38e7('0x8')](_0x38e7('0x9'),attributes,{'tableName':_0x38e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2525=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskConfiguration'];(function(_0x104fec,_0x34b639){var _0x3d1c7e=function(_0x482bfb){while(--_0x482bfb){_0x104fec['push'](_0x104fec['shift']());}};_0x3d1c7e(++_0x34b639);}(_0x2525,0xf0));var _0x5252=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x2525[_0x138f59];return _0x3d114d;};'use strict';var _=require('lodash');var util=require(_0x5252('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5252('0x1'));var BPromise=require(_0x5252('0x2'));var rp=require(_0x5252('0x3'));var fs=require('fs');var path=require(_0x5252('0x4'));var rimraf=require(_0x5252('0x5'));var config=require(_0x5252('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x5252('0x7')]=function(_0x346ea0,_0xfcdd82){return _0x346ea0[_0x5252('0x8')](_0x5252('0x9'),attributes,{'tableName':'int_freshdesk_configurations','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 24a2ab8..9840261 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 _0x9418=['FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x142777,_0x180409){var _0x34e2d9=function(_0x13e4d5){while(--_0x13e4d5){_0x142777['push'](_0x142777['shift']());}};_0x34e2d9(++_0x180409);}(_0x9418,0x84));var _0x8941=function(_0x5b3b6a,_0x906f49){_0x5b3b6a=_0x5b3b6a-0x0;var _0x4a9af7=_0x9418[_0x5b3b6a];return _0x4a9af7;};'use strict';var _=require(_0x8941('0x0'));var util=require(_0x8941('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8941('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8941('0x3'))['db'];var utils=require(_0x8941('0x4'));var logger=require(_0x8941('0x5'))(_0x8941('0x6'));var config=require(_0x8941('0x7'));var jayson=require(_0x8941('0x8'));var client=jayson[_0x8941('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10299b,_0x43c551,_0x31f81d){return new BPromise(function(_0x463752,_0x153027){return client[_0x8941('0xa')](_0x10299b,_0x31f81d)['then'](function(_0x3974d7){logger[_0x8941('0xb')](_0x8941('0xc'),_0x43c551,_0x8941('0xd'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x43c551,_0x8941('0xd'),JSON[_0x8941('0xe')](_0x3974d7));if(_0x3974d7['error']){if(_0x3974d7['error']['code']===0x1f4){logger[_0x8941('0xf')](_0x8941('0xc'),_0x43c551,_0x3974d7[_0x8941('0xf')][_0x8941('0x10')]);return _0x153027(_0x3974d7[_0x8941('0xf')][_0x8941('0x10')]);}logger[_0x8941('0xf')](_0x8941('0xc'),_0x43c551,_0x3974d7[_0x8941('0xf')]['message']);return _0x463752(_0x3974d7[_0x8941('0xf')][_0x8941('0x10')]);}else{logger[_0x8941('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x43c551,_0x8941('0xd'));_0x463752(_0x3974d7['result'][_0x8941('0x10')]);}})[_0x8941('0x11')](function(_0x3445c0){logger[_0x8941('0xf')](_0x8941('0xc'),_0x43c551,_0x3445c0);_0x153027(_0x3445c0);});});} \ No newline at end of file +var _0x6824=['info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x6824,0x145));var _0x4682=function(_0x46ef5e,_0x35aa8e){_0x46ef5e=_0x46ef5e-0x0;var _0x24bed8=_0x6824[_0x46ef5e];return _0x24bed8;};'use strict';var _=require(_0x4682('0x0'));var util=require('util');var moment=require(_0x4682('0x1'));var BPromise=require(_0x4682('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4682('0x3'));var db=require(_0x4682('0x4'))['db'];var utils=require(_0x4682('0x5'));var logger=require(_0x4682('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4682('0x7'));var client=jayson[_0x4682('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3acae0,_0x596081,_0x35db32){return new BPromise(function(_0x5032e2,_0x264dca){return client[_0x4682('0x9')](_0x3acae0,_0x35db32)[_0x4682('0xa')](function(_0x39c98e){logger[_0x4682('0xb')](_0x4682('0xc'),_0x596081,_0x4682('0xd'));logger[_0x4682('0xe')](_0x4682('0xf'),_0x596081,_0x4682('0xd'),JSON['stringify'](_0x39c98e));if(_0x39c98e[_0x4682('0x10')]){if(_0x39c98e[_0x4682('0x10')][_0x4682('0x11')]===0x1f4){logger['error'](_0x4682('0xc'),_0x596081,_0x39c98e[_0x4682('0x10')][_0x4682('0x12')]);return _0x264dca(_0x39c98e[_0x4682('0x10')]['message']);}logger[_0x4682('0x10')](_0x4682('0xc'),_0x596081,_0x39c98e[_0x4682('0x10')][_0x4682('0x12')]);return _0x5032e2(_0x39c98e[_0x4682('0x10')][_0x4682('0x12')]);}else{logger[_0x4682('0xb')](_0x4682('0xc'),_0x596081,_0x4682('0xd'));_0x5032e2(_0x39c98e[_0x4682('0x13')][_0x4682('0x12')]);}})[_0x4682('0x14')](function(_0x2df723){logger[_0x4682('0x10')](_0x4682('0xc'),_0x596081,_0x2df723);_0x264dca(_0x2df723);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 92b9341..8db2be2 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 _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x5da7a6,_0x33981f){var _0x423237=function(_0x371c2c){while(--_0x371c2c){_0x5da7a6['push'](_0x5da7a6['shift']());}};_0x423237(++_0x33981f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['post']('/',auth[_0x0a9e('0x8')](),controller['create']);router['put'](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xa')]);router[_0x0a9e('0xb')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3e74=['connect-timeout','express','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','multer','path'];(function(_0x3931d7,_0x34c702){var _0x2ec3f3=function(_0x2c1507){while(--_0x2c1507){_0x3931d7['push'](_0x3931d7['shift']());}};_0x2ec3f3(++_0x34c702);}(_0x3e74,0x175));var _0x43e7=function(_0x2d8dce,_0x5d9e43){_0x2d8dce=_0x2d8dce-0x0;var _0x1a6b4f=_0x3e74[_0x2d8dce];return _0x1a6b4f;};'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 auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['put'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0xd')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);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 58e3f1d..3bb37f1 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 _0xe8eb=['exports','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN','sequelize'];(function(_0x8131d9,_0x2b2b89){var _0x55b063=function(_0xc4ae93){while(--_0xc4ae93){_0x8131d9['push'](_0x8131d9['shift']());}};_0x55b063(++_0x2b2b89);}(_0xe8eb,0xce));var _0xbe8e=function(_0x19d629,_0x29c0f9){_0x19d629=_0x19d629-0x0;var _0x203025=_0xe8eb[_0x19d629];return _0x203025;};'use strict';var Sequelize=require(_0xbe8e('0x0'));module[_0xbe8e('0x1')]={'type':{'type':Sequelize[_0xbe8e('0x2')]('string',_0xbe8e('0x3'),_0xbe8e('0x4'),_0xbe8e('0x5')),'defaultValue':_0xbe8e('0x6')},'content':{'type':Sequelize[_0xbe8e('0x7')]},'key':{'type':Sequelize[_0xbe8e('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xbe8e('0x6'),_0xbe8e('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xbe8e('0x7')]},'idField':{'type':Sequelize[_0xbe8e('0x7')]},'nameField':{'type':Sequelize[_0xbe8e('0x7')]},'customField':{'type':Sequelize[_0xbe8e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaa3f=['exports','string','variable','STRING','ENUM','sequelize'];(function(_0x58e4d1,_0x2bfc2e){var _0x13a4d2=function(_0x55b67e){while(--_0x55b67e){_0x58e4d1['push'](_0x58e4d1['shift']());}};_0x13a4d2(++_0x2bfc2e);}(_0xaa3f,0x95));var _0xfaa3=function(_0x5b3a31,_0x12a8b5){_0x5b3a31=_0x5b3a31-0x0;var _0x5856ca=_0xaa3f[_0x5b3a31];return _0x5856ca;};'use strict';var Sequelize=require(_0xfaa3('0x0'));module[_0xfaa3('0x1')]={'type':{'type':Sequelize['ENUM'](_0xfaa3('0x2'),_0xfaa3('0x3'),'customVariable','keyValue'),'defaultValue':_0xfaa3('0x2')},'content':{'type':Sequelize[_0xfaa3('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfaa3('0x5')]('string',_0xfaa3('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xfaa3('0x4')]},'idField':{'type':Sequelize[_0xfaa3('0x4')]},'nameField':{'type':Sequelize[_0xfaa3('0x4')]},'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 1817a2c..395313d 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 _0x3d50=['reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskField','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x34ad4b,_0x3e3513){var _0x21b04f=function(_0x53b331){while(--_0x53b331){_0x34ad4b['push'](_0x34ad4b['shift']());}};_0x21b04f(++_0x3e3513);}(_0x3d50,0x115));var _0x03d5=function(_0x5cc466,_0x4096d8){_0x5cc466=_0x5cc466-0x0;var _0x52c1fa=_0x3d50[_0x5cc466];return _0x52c1fa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x03d5('0x0'));var rimraf=require(_0x03d5('0x1'));var zipdir=require(_0x03d5('0x2'));var jsonpatch=require(_0x03d5('0x3'));var rp=require(_0x03d5('0x4'));var moment=require(_0x03d5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x03d5('0x6'));var util=require(_0x03d5('0x7'));var path=require(_0x03d5('0x8'));var sox=require(_0x03d5('0x9'));var csv=require(_0x03d5('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x03d5('0xb'));var squel=require(_0x03d5('0xc'));var crypto=require(_0x03d5('0xd'));var jsforce=require(_0x03d5('0xe'));var deskjs=require(_0x03d5('0xf'));var toCsv=require(_0x03d5('0xa'));var querystring=require(_0x03d5('0x10'));var Papa=require('papaparse');var Redis=require(_0x03d5('0x11'));var authService=require(_0x03d5('0x12'));var qs=require(_0x03d5('0x13'));var as=require(_0x03d5('0x14'));var hardwareService=require(_0x03d5('0x15'));var logger=require(_0x03d5('0x16'))(_0x03d5('0x17'));var utils=require('../../config/utils');var config=require(_0x03d5('0x18'));var db=require(_0x03d5('0x19'))['db'];function respondWithStatusCode(_0x4abd14,_0x5404da){_0x5404da=_0x5404da||0xcc;return function(_0x5809e8){if(_0x5809e8){return _0x4abd14[_0x03d5('0x1a')](_0x5404da);}return _0x4abd14[_0x03d5('0x1b')](_0x5404da)[_0x03d5('0x1c')]();};}function respondWithResult(_0x268691,_0x171a8e){_0x171a8e=_0x171a8e||0xc8;return function(_0x31fce9){if(_0x31fce9){return _0x268691[_0x03d5('0x1b')](_0x171a8e)[_0x03d5('0x1d')](_0x31fce9);}};}function respondWithFilteredResult(_0x1d30e6,_0x39d84c){return function(_0x49d683){if(_0x49d683){var _0x37aa67=_0x49d683[_0x03d5('0x1e')],_0x2c841a=_0x39d84c[_0x03d5('0x1f')],_0x5185c1=_0x39d84c['offset']+_0x39d84c[_0x03d5('0x20')],_0x230c78;if(_0x5185c1>=_0x37aa67){_0x5185c1=_0x37aa67;_0x230c78=0xc8;}else{_0x230c78=0xce;}_0x1d30e6[_0x03d5('0x1b')](_0x230c78);return _0x1d30e6[_0x03d5('0x21')](_0x03d5('0x22'),_0x2c841a+'-'+_0x5185c1+'/'+_0x37aa67)['json'](_0x49d683);}return null;};}function patchUpdates(_0x5590f0){return function(_0x5d9591){try{jsonpatch['apply'](_0x5d9591,_0x5590f0,!![]);}catch(_0x5c1467){return BPromise[_0x03d5('0x23')](_0x5c1467);}return _0x5d9591[_0x03d5('0x24')]();};}function saveUpdates(_0x3251f1,_0x42a855){return function(_0x1fcf30){if(_0x1fcf30){return _0x1fcf30[_0x03d5('0x25')](_0x3251f1)[_0x03d5('0x26')](function(_0x24e880){return _0x24e880;});}return null;};}function removeEntity(_0xfad09c,_0x1bd476){return function(_0x2b3dc2){if(_0x2b3dc2){return _0x2b3dc2[_0x03d5('0x27')]()[_0x03d5('0x26')](function(){_0xfad09c[_0x03d5('0x1b')](0xcc)[_0x03d5('0x1c')]();});}};}function handleEntityNotFound(_0xaa4c22,_0x580718){return function(_0x39bdc8){if(!_0x39bdc8){_0xaa4c22[_0x03d5('0x1a')](0x194);}return _0x39bdc8;};}function handleError(_0x2f6c00,_0x51d699){_0x51d699=_0x51d699||0x1f4;return function(_0x46d0ef){logger[_0x03d5('0x28')](_0x46d0ef[_0x03d5('0x29')]);if(_0x46d0ef['name']){delete _0x46d0ef[_0x03d5('0x2a')];}_0x2f6c00[_0x03d5('0x1b')](_0x51d699)[_0x03d5('0x2b')](_0x46d0ef);};}exports[_0x03d5('0x2c')]=function(_0x46e767,_0x514247){var _0x5256cc={},_0x23c2eb={},_0x1a509c={'count':0x0,'rows':[]};var _0x564e3d=_[_0x03d5('0x2d')](db['FreshdeskField'][_0x03d5('0x2e')],function(_0x2acde3){return{'name':_0x2acde3[_0x03d5('0x2f')],'type':_0x2acde3[_0x03d5('0x30')]['key']};});_0x23c2eb[_0x03d5('0x31')]=_['map'](_0x564e3d,'name');_0x23c2eb[_0x03d5('0x32')]=_[_0x03d5('0x33')](_0x46e767['query']);_0x23c2eb[_0x03d5('0x34')]=_[_0x03d5('0x35')](_0x23c2eb[_0x03d5('0x31')],_0x23c2eb[_0x03d5('0x32')]);_0x5256cc['attributes']=_['intersection'](_0x23c2eb[_0x03d5('0x31')],qs[_0x03d5('0x36')](_0x46e767[_0x03d5('0x32')]['fields']));_0x5256cc[_0x03d5('0x37')]=_0x5256cc[_0x03d5('0x37')][_0x03d5('0x38')]?_0x5256cc[_0x03d5('0x37')]:_0x23c2eb[_0x03d5('0x31')];if(!_0x46e767[_0x03d5('0x32')][_0x03d5('0x39')](_0x03d5('0x3a'))){_0x5256cc[_0x03d5('0x20')]=qs[_0x03d5('0x20')](_0x46e767[_0x03d5('0x32')][_0x03d5('0x20')]);_0x5256cc[_0x03d5('0x1f')]=qs[_0x03d5('0x1f')](_0x46e767[_0x03d5('0x32')][_0x03d5('0x1f')]);}_0x5256cc[_0x03d5('0x3b')]=qs[_0x03d5('0x3c')](_0x46e767[_0x03d5('0x32')][_0x03d5('0x3c')]);_0x5256cc[_0x03d5('0x3d')]=qs[_0x03d5('0x34')](_[_0x03d5('0x3e')](_0x46e767[_0x03d5('0x32')],_0x23c2eb['filters']),_0x564e3d);if(_0x46e767[_0x03d5('0x32')][_0x03d5('0x3f')]){_0x5256cc[_0x03d5('0x3d')]=_[_0x03d5('0x40')](_0x5256cc[_0x03d5('0x3d')],{'$or':_[_0x03d5('0x2d')](_0x564e3d,function(_0x5126e9){if(_0x5126e9[_0x03d5('0x30')]!==_0x03d5('0x41')){var _0x5babc1={};_0x5babc1[_0x5126e9[_0x03d5('0x2a')]]={'$like':'%'+_0x46e767[_0x03d5('0x32')][_0x03d5('0x3f')]+'%'};return _0x5babc1;}})});}_0x5256cc=_[_0x03d5('0x40')]({},_0x5256cc,_0x46e767[_0x03d5('0x42')]);var _0x3fc0ec={'where':_0x5256cc[_0x03d5('0x3d')]};return db[_0x03d5('0x43')][_0x03d5('0x1e')](_0x3fc0ec)['then'](function(_0x27834b){_0x1a509c['count']=_0x27834b;if(_0x46e767[_0x03d5('0x32')][_0x03d5('0x44')]){_0x5256cc['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x03d5('0x45')](_0x5256cc);})[_0x03d5('0x26')](function(_0x5ea4de){_0x1a509c[_0x03d5('0x46')]=_0x5ea4de;return _0x1a509c;})['then'](respondWithFilteredResult(_0x514247,_0x5256cc))[_0x03d5('0x47')](handleError(_0x514247,null));};exports[_0x03d5('0x48')]=function(_0x2128d4,_0x5bdaf0){var _0x104089={'raw':!![],'where':{'id':_0x2128d4[_0x03d5('0x49')]['id']}},_0x4bd277={};_0x4bd277[_0x03d5('0x31')]=_[_0x03d5('0x33')](db[_0x03d5('0x43')][_0x03d5('0x2e')]);_0x4bd277[_0x03d5('0x32')]=_[_0x03d5('0x33')](_0x2128d4['query']);_0x4bd277[_0x03d5('0x34')]=_[_0x03d5('0x35')](_0x4bd277['model'],_0x4bd277[_0x03d5('0x32')]);_0x104089[_0x03d5('0x37')]=_[_0x03d5('0x35')](_0x4bd277[_0x03d5('0x31')],qs[_0x03d5('0x36')](_0x2128d4['query'][_0x03d5('0x36')]));_0x104089['attributes']=_0x104089[_0x03d5('0x37')][_0x03d5('0x38')]?_0x104089['attributes']:_0x4bd277[_0x03d5('0x31')];if(_0x2128d4[_0x03d5('0x32')][_0x03d5('0x44')]){_0x104089[_0x03d5('0x4a')]=[{'all':!![]}];}_0x104089=_[_0x03d5('0x40')]({},_0x104089,_0x2128d4[_0x03d5('0x42')]);return db[_0x03d5('0x43')][_0x03d5('0x4b')](_0x104089)['then'](handleEntityNotFound(_0x5bdaf0,null))['then'](respondWithResult(_0x5bdaf0,null))[_0x03d5('0x47')](handleError(_0x5bdaf0,null));};exports[_0x03d5('0x4c')]=function(_0x426c8f,_0xa9a3d2){return db[_0x03d5('0x43')][_0x03d5('0x4c')](_0x426c8f[_0x03d5('0x4d')],{})[_0x03d5('0x26')](respondWithResult(_0xa9a3d2,0xc9))[_0x03d5('0x47')](handleError(_0xa9a3d2,null));};exports['update']=function(_0x2f0591,_0x4b1604){if(_0x2f0591['body']['id']){delete _0x2f0591[_0x03d5('0x4d')]['id'];}return db[_0x03d5('0x43')][_0x03d5('0x4b')]({'where':{'id':_0x2f0591[_0x03d5('0x49')]['id']}})[_0x03d5('0x26')](handleEntityNotFound(_0x4b1604,null))['then'](saveUpdates(_0x2f0591[_0x03d5('0x4d')],null))[_0x03d5('0x26')](respondWithResult(_0x4b1604,null))[_0x03d5('0x47')](handleError(_0x4b1604,null));};exports['destroy']=function(_0x30cdb7,_0x15a37e){return db[_0x03d5('0x43')][_0x03d5('0x4b')]({'where':{'id':_0x30cdb7[_0x03d5('0x49')]['id']}})[_0x03d5('0x26')](handleEntityNotFound(_0x15a37e,null))[_0x03d5('0x26')](removeEntity(_0x15a37e,null))['catch'](handleError(_0x15a37e,null));}; \ No newline at end of file +var _0x05e7=['body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','count','includeAll','include','findAll','rows','params','keys','options','find','catch','create'];(function(_0x219143,_0x451ca3){var _0x501e6b=function(_0x5888fc){while(--_0x5888fc){_0x219143['push'](_0x219143['shift']());}};_0x501e6b(++_0x451ca3);}(_0x05e7,0x95));var _0x705e=function(_0x6a603a,_0x20983b){_0x6a603a=_0x6a603a-0x0;var _0x2b12b9=_0x05e7[_0x6a603a];return _0x2b12b9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x705e('0x0'));var rimraf=require(_0x705e('0x1'));var zipdir=require(_0x705e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x705e('0x3'));var moment=require('moment');var BPromise=require(_0x705e('0x4'));var Mustache=require(_0x705e('0x5'));var util=require('util');var path=require(_0x705e('0x6'));var sox=require(_0x705e('0x7'));var csv=require(_0x705e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x705e('0x9'));var squel=require(_0x705e('0xa'));var crypto=require(_0x705e('0xb'));var jsforce=require(_0x705e('0xc'));var deskjs=require(_0x705e('0xd'));var toCsv=require(_0x705e('0x8'));var querystring=require(_0x705e('0xe'));var Papa=require(_0x705e('0xf'));var Redis=require('ioredis');var authService=require(_0x705e('0x10'));var qs=require(_0x705e('0x11'));var as=require(_0x705e('0x12'));var hardwareService=require(_0x705e('0x13'));var logger=require(_0x705e('0x14'))(_0x705e('0x15'));var utils=require('../../config/utils');var config=require(_0x705e('0x16'));var db=require(_0x705e('0x17'))['db'];function respondWithStatusCode(_0x1da1e3,_0x2a92e8){_0x2a92e8=_0x2a92e8||0xcc;return function(_0x1a68ee){if(_0x1a68ee){return _0x1da1e3[_0x705e('0x18')](_0x2a92e8);}return _0x1da1e3['status'](_0x2a92e8)[_0x705e('0x19')]();};}function respondWithResult(_0x52f316,_0x1e66f4){_0x1e66f4=_0x1e66f4||0xc8;return function(_0x4b0667){if(_0x4b0667){return _0x52f316[_0x705e('0x1a')](_0x1e66f4)['json'](_0x4b0667);}};}function respondWithFilteredResult(_0xd70729,_0x5caf5a){return function(_0x3fea69){if(_0x3fea69){var _0x108f70=_0x3fea69['count'],_0x1d9e1e=_0x5caf5a['offset'],_0x404234=_0x5caf5a[_0x705e('0x1b')]+_0x5caf5a[_0x705e('0x1c')],_0x2f871d;if(_0x404234>=_0x108f70){_0x404234=_0x108f70;_0x2f871d=0xc8;}else{_0x2f871d=0xce;}_0xd70729[_0x705e('0x1a')](_0x2f871d);return _0xd70729[_0x705e('0x1d')](_0x705e('0x1e'),_0x1d9e1e+'-'+_0x404234+'/'+_0x108f70)['json'](_0x3fea69);}return null;};}function patchUpdates(_0x3842d1){return function(_0x49d622){try{jsonpatch[_0x705e('0x1f')](_0x49d622,_0x3842d1,!![]);}catch(_0x461a53){return BPromise[_0x705e('0x20')](_0x461a53);}return _0x49d622['save']();};}function saveUpdates(_0x48de86,_0x478d3){return function(_0x114578){if(_0x114578){return _0x114578[_0x705e('0x21')](_0x48de86)['then'](function(_0x7ff515){return _0x7ff515;});}return null;};}function removeEntity(_0x3c72fa,_0x3d47b9){return function(_0x3d6b51){if(_0x3d6b51){return _0x3d6b51[_0x705e('0x22')]()[_0x705e('0x23')](function(){_0x3c72fa[_0x705e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x162ac1,_0x8def88){return function(_0x58b630){if(!_0x58b630){_0x162ac1[_0x705e('0x18')](0x194);}return _0x58b630;};}function handleError(_0x107b3a,_0x317120){_0x317120=_0x317120||0x1f4;return function(_0x29dd9b){logger[_0x705e('0x24')](_0x29dd9b[_0x705e('0x25')]);if(_0x29dd9b[_0x705e('0x26')]){delete _0x29dd9b[_0x705e('0x26')];}_0x107b3a[_0x705e('0x1a')](_0x317120)[_0x705e('0x27')](_0x29dd9b);};}exports[_0x705e('0x28')]=function(_0x38502d,_0x2c2c2f){var _0x355f79={},_0x42897f={},_0x5132f1={'count':0x0,'rows':[]};var _0x5a7396=_[_0x705e('0x29')](db[_0x705e('0x2a')][_0x705e('0x2b')],function(_0xc89d89){return{'name':_0xc89d89[_0x705e('0x2c')],'type':_0xc89d89[_0x705e('0x2d')][_0x705e('0x2e')]};});_0x42897f['model']=_[_0x705e('0x29')](_0x5a7396,_0x705e('0x26'));_0x42897f[_0x705e('0x2f')]=_['keys'](_0x38502d[_0x705e('0x2f')]);_0x42897f[_0x705e('0x30')]=_[_0x705e('0x31')](_0x42897f[_0x705e('0x32')],_0x42897f[_0x705e('0x2f')]);_0x355f79[_0x705e('0x33')]=_[_0x705e('0x31')](_0x42897f['model'],qs[_0x705e('0x34')](_0x38502d[_0x705e('0x2f')][_0x705e('0x34')]));_0x355f79['attributes']=_0x355f79[_0x705e('0x33')]['length']?_0x355f79[_0x705e('0x33')]:_0x42897f[_0x705e('0x32')];if(!_0x38502d['query'][_0x705e('0x35')](_0x705e('0x36'))){_0x355f79[_0x705e('0x1c')]=qs[_0x705e('0x1c')](_0x38502d[_0x705e('0x2f')][_0x705e('0x1c')]);_0x355f79[_0x705e('0x1b')]=qs['offset'](_0x38502d[_0x705e('0x2f')][_0x705e('0x1b')]);}_0x355f79[_0x705e('0x37')]=qs[_0x705e('0x38')](_0x38502d[_0x705e('0x2f')]['sort']);_0x355f79['where']=qs['filters'](_[_0x705e('0x39')](_0x38502d[_0x705e('0x2f')],_0x42897f[_0x705e('0x30')]),_0x5a7396);if(_0x38502d[_0x705e('0x2f')][_0x705e('0x3a')]){_0x355f79[_0x705e('0x3b')]=_['merge'](_0x355f79[_0x705e('0x3b')],{'$or':_['map'](_0x5a7396,function(_0x337505){if(_0x337505['type']!==_0x705e('0x3c')){var _0x333846={};_0x333846[_0x337505[_0x705e('0x26')]]={'$like':'%'+_0x38502d[_0x705e('0x2f')][_0x705e('0x3a')]+'%'};return _0x333846;}})});}_0x355f79=_[_0x705e('0x3d')]({},_0x355f79,_0x38502d['options']);var _0x62eb08={'where':_0x355f79[_0x705e('0x3b')]};return db[_0x705e('0x2a')][_0x705e('0x3e')](_0x62eb08)[_0x705e('0x23')](function(_0x32968c){_0x5132f1[_0x705e('0x3e')]=_0x32968c;if(_0x38502d[_0x705e('0x2f')][_0x705e('0x3f')]){_0x355f79[_0x705e('0x40')]=[{'all':!![]}];}return db['FreshdeskField'][_0x705e('0x41')](_0x355f79);})[_0x705e('0x23')](function(_0xd9473d){_0x5132f1[_0x705e('0x42')]=_0xd9473d;return _0x5132f1;})['then'](respondWithFilteredResult(_0x2c2c2f,_0x355f79))['catch'](handleError(_0x2c2c2f,null));};exports['show']=function(_0x1e4483,_0x25f84a){var _0x13ab23={'raw':!![],'where':{'id':_0x1e4483[_0x705e('0x43')]['id']}},_0x4850d6={};_0x4850d6[_0x705e('0x32')]=_[_0x705e('0x44')](db[_0x705e('0x2a')][_0x705e('0x2b')]);_0x4850d6['query']=_[_0x705e('0x44')](_0x1e4483[_0x705e('0x2f')]);_0x4850d6[_0x705e('0x30')]=_[_0x705e('0x31')](_0x4850d6[_0x705e('0x32')],_0x4850d6[_0x705e('0x2f')]);_0x13ab23[_0x705e('0x33')]=_['intersection'](_0x4850d6[_0x705e('0x32')],qs[_0x705e('0x34')](_0x1e4483[_0x705e('0x2f')]['fields']));_0x13ab23[_0x705e('0x33')]=_0x13ab23['attributes']['length']?_0x13ab23[_0x705e('0x33')]:_0x4850d6[_0x705e('0x32')];if(_0x1e4483[_0x705e('0x2f')][_0x705e('0x3f')]){_0x13ab23[_0x705e('0x40')]=[{'all':!![]}];}_0x13ab23=_[_0x705e('0x3d')]({},_0x13ab23,_0x1e4483[_0x705e('0x45')]);return db[_0x705e('0x2a')][_0x705e('0x46')](_0x13ab23)[_0x705e('0x23')](handleEntityNotFound(_0x25f84a,null))[_0x705e('0x23')](respondWithResult(_0x25f84a,null))[_0x705e('0x47')](handleError(_0x25f84a,null));};exports['create']=function(_0x3a6db8,_0x1837e9){return db[_0x705e('0x2a')][_0x705e('0x48')](_0x3a6db8['body'],{})[_0x705e('0x23')](respondWithResult(_0x1837e9,0xc9))['catch'](handleError(_0x1837e9,null));};exports[_0x705e('0x21')]=function(_0x3ac393,_0x107c1b){if(_0x3ac393[_0x705e('0x49')]['id']){delete _0x3ac393['body']['id'];}return db['FreshdeskField'][_0x705e('0x46')]({'where':{'id':_0x3ac393[_0x705e('0x43')]['id']}})[_0x705e('0x23')](handleEntityNotFound(_0x107c1b,null))[_0x705e('0x23')](saveUpdates(_0x3ac393[_0x705e('0x49')],null))[_0x705e('0x23')](respondWithResult(_0x107c1b,null))[_0x705e('0x47')](handleError(_0x107c1b,null));};exports['destroy']=function(_0x20daf6,_0x21871d){return db[_0x705e('0x2a')][_0x705e('0x46')]({'where':{'id':_0x20daf6[_0x705e('0x43')]['id']}})['then'](handleEntityNotFound(_0x21871d,null))['then'](removeEntity(_0x21871d,null))[_0x705e('0x47')](handleError(_0x21871d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 5e24181..a0d0293 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 _0x12d7=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','idField','FieldId'];(function(_0x96f94a,_0x50f7db){var _0x2e64ad=function(_0x54f3a5){while(--_0x54f3a5){_0x96f94a['push'](_0x96f94a['shift']());}};_0x2e64ad(++_0x50f7db);}(_0x12d7,0x1bc));var _0x712d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x712d('0x0'));var logger=require(_0x712d('0x1'))(_0x712d('0x2'));var moment=require('moment');var BPromise=require(_0x712d('0x3'));var rp=require(_0x712d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x712d('0x5'));var config=require(_0x712d('0x6'));var attributes=require(_0x712d('0x7'));module[_0x712d('0x8')]=function(_0x3b3c3d,_0x4cd2a1){return _0x3b3c3d[_0x712d('0x9')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x712d('0xa'),_0x712d('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x584b=['request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird'];(function(_0x29409b,_0x4ef7a7){var _0x33e3c5=function(_0x2d03cb){while(--_0x2d03cb){_0x29409b['push'](_0x29409b['shift']());}};_0x33e3c5(++_0x4ef7a7);}(_0x584b,0x14f));var _0xb584=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0x584b[_0x4aa4e6];return _0x322588;};'use strict';var _=require(_0xb584('0x0'));var util=require(_0xb584('0x1'));var logger=require(_0xb584('0x2'))(_0xb584('0x3'));var moment=require('moment');var BPromise=require(_0xb584('0x4'));var rp=require(_0xb584('0x5'));var fs=require('fs');var path=require(_0xb584('0x6'));var rimraf=require(_0xb584('0x7'));var config=require(_0xb584('0x8'));var attributes=require(_0xb584('0x9'));module[_0xb584('0xa')]=function(_0x41631e,_0x4a838e){return _0x41631e[_0xb584('0xb')](_0xb584('0xc'),attributes,{'tableName':_0xb584('0xd'),'paranoid':![],'indexes':[{'name':_0xb584('0xe'),'fields':[_0xb584('0xf'),_0xb584('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index e82a445..5d535db 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2d5dc3,_0x2c16cf){var _0x5e12d2=function(_0x561317){while(--_0x561317){_0x2d5dc3['push'](_0x2d5dc3['shift']());}};_0x5e12d2(++_0x2c16cf);}(_0xb10b,0x12a));var _0xbb10=function(_0x361026,_0x2375e2){_0x361026=_0x361026-0x0;var _0x37028e=_0xb10b[_0x361026];return _0x37028e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x101ffc,_0x33920e){var _0x12585f=function(_0x1fb0aa){while(--_0x1fb0aa){_0x101ffc['push'](_0x101ffc['shift']());}};_0x12585f(++_0x33920e);}(_0xb10b,0x12a));var _0xbb10=function(_0x15cf93,_0x5b1029){_0x15cf93=_0x15cf93-0x0;var _0x2afb0a=_0xb10b[_0x15cf93];return _0x2afb0a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 262caae..341c301 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 _0xc4ad=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','post','create','/:id/configurations','addConfiguration','update','delete','exports','util'];(function(_0x29a11c,_0x370f91){var _0x1f6132=function(_0x15a371){while(--_0x15a371){_0x29a11c['push'](_0x29a11c['shift']());}};_0x1f6132(++_0x370f91);}(_0xc4ad,0xe6));var _0xdc4a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4ad[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xdc4a('0x0'));var path=require(_0xdc4a('0x1'));var timeout=require(_0xdc4a('0x2'));var express=require(_0xdc4a('0x3'));var router=express['Router']();var auth=require(_0xdc4a('0x4'));var interaction=require(_0xdc4a('0x5'));var config=require(_0xdc4a('0x6'));var controller=require(_0xdc4a('0x7'));router[_0xdc4a('0x8')]('/',auth[_0xdc4a('0x9')](),controller[_0xdc4a('0xa')]);router[_0xdc4a('0x8')](_0xdc4a('0xb'),auth['isAuthenticated'](),controller[_0xdc4a('0xc')]);router['get']('/:id/configurations',auth[_0xdc4a('0x9')](),controller[_0xdc4a('0xd')]);router[_0xdc4a('0x8')]('/:id/fields',auth[_0xdc4a('0x9')](),controller['getFields']);router[_0xdc4a('0xe')]('/',auth[_0xdc4a('0x9')](),controller[_0xdc4a('0xf')]);router['post'](_0xdc4a('0x10'),auth[_0xdc4a('0x9')](),controller[_0xdc4a('0x11')]);router['put'](_0xdc4a('0xb'),auth[_0xdc4a('0x9')](),controller[_0xdc4a('0x12')]);router[_0xdc4a('0x13')](_0xdc4a('0xb'),auth[_0xdc4a('0x9')](),controller['destroy']);module[_0xdc4a('0x14')]=router; \ No newline at end of file +var _0x838e=['../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x761b6d,_0x7c7fa8){var _0x3a1639=function(_0x33b90a){while(--_0x33b90a){_0x761b6d['push'](_0x761b6d['shift']());}};_0x3a1639(++_0x7c7fa8);}(_0x838e,0xcc));var _0xe838=function(_0x309bce,_0x2eec61){_0x309bce=_0x309bce-0x0;var _0x5c01f8=_0x838e[_0x309bce];return _0x5c01f8;};'use strict';var multer=require(_0xe838('0x0'));var util=require(_0xe838('0x1'));var path=require(_0xe838('0x2'));var timeout=require(_0xe838('0x3'));var express=require(_0xe838('0x4'));var router=express[_0xe838('0x5')]();var auth=require(_0xe838('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe838('0x7'));var controller=require(_0xe838('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe838('0x9')](_0xe838('0xa'),auth[_0xe838('0xb')](),controller[_0xe838('0xc')]);router['get'](_0xe838('0xd'),auth[_0xe838('0xb')](),controller['getConfigurations']);router[_0xe838('0x9')](_0xe838('0xe'),auth['isAuthenticated'](),controller[_0xe838('0xf')]);router['post']('/',auth[_0xe838('0xb')](),controller[_0xe838('0x10')]);router['post'](_0xe838('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xe838('0x11')](_0xe838('0xa'),auth[_0xe838('0xb')](),controller[_0xe838('0x12')]);router['delete'](_0xe838('0xa'),auth[_0xe838('0xb')](),controller[_0xe838('0x13')]);module[_0xe838('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 8357563..3531a6f 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 _0xf954=['STRING','username','sequelize','exports'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xf954,0x10e));var _0x4f95=function(_0x4c6a41,_0x27ae8c){_0x4c6a41=_0x4c6a41-0x0;var _0x4e350f=_0xf954[_0x4c6a41];return _0x4e350f;};'use strict';var Sequelize=require(_0x4f95('0x0'));module[_0x4f95('0x1')]={'name':{'type':Sequelize[_0x4f95('0x2')]},'description':{'type':Sequelize[_0x4f95('0x2')]},'username':{'type':Sequelize[_0x4f95('0x2')],'unique':_0x4f95('0x3')},'apiKey':{'type':Sequelize[_0x4f95('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4f95('0x2')]}}; \ No newline at end of file +var _0x68fd=['remoteUri','sequelize','STRING','username'];(function(_0x500c2e,_0x543e9a){var _0x2c5df0=function(_0x3f699c){while(--_0x3f699c){_0x500c2e['push'](_0x500c2e['shift']());}};_0x2c5df0(++_0x543e9a);}(_0x68fd,0x1e9));var _0xd68f=function(_0x6f9986,_0x47cc82){_0x6f9986=_0x6f9986-0x0;var _0x520e0d=_0x68fd[_0x6f9986];return _0x520e0d;};'use strict';var Sequelize=require(_0xd68f('0x0'));module['exports']={'name':{'type':Sequelize[_0xd68f('0x1')]},'description':{'type':Sequelize[_0xd68f('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xd68f('0x2')},'apiKey':{'type':Sequelize[_0xd68f('0x1')]},'remoteUri':{'type':Sequelize[_0xd68f('0x1')],'unique':_0xd68f('0x3')},'serverUrl':{'type':Sequelize[_0xd68f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 340f48a..8054c17 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 _0xa3bc=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','destroy','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','find','create','body','update','getConfigurations','FreshsalesConfiguration','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','substring','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0xa3bc,0x1a6));var _0xca3b=function(_0x1e3164,_0x370328){_0x1e3164=_0x1e3164-0x0;var _0x129218=_0xa3bc[_0x1e3164];return _0x129218;};'use strict';var pdf=require(_0xca3b('0x0'));var emlformat=require(_0xca3b('0x1'));var rimraf=require(_0xca3b('0x2'));var zipdir=require(_0xca3b('0x3'));var jsonpatch=require(_0xca3b('0x4'));var rp=require(_0xca3b('0x5'));var moment=require(_0xca3b('0x6'));var BPromise=require(_0xca3b('0x7'));var Mustache=require(_0xca3b('0x8'));var util=require(_0xca3b('0x9'));var path=require(_0xca3b('0xa'));var sox=require('sox');var csv=require(_0xca3b('0xb'));var ejs=require(_0xca3b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xca3b('0xd'));var deskjs=require(_0xca3b('0xe'));var toCsv=require(_0xca3b('0xb'));var querystring=require(_0xca3b('0xf'));var Papa=require('papaparse');var Redis=require(_0xca3b('0x10'));var authService=require(_0xca3b('0x11'));var qs=require(_0xca3b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xca3b('0x13'))(_0xca3b('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0xca3b('0x15'));var jayson=require(_0xca3b('0x16'));var client=jayson[_0xca3b('0x17')][_0xca3b('0x18')]({'port':0x232a});function checkPasswordPattern(_0x159e30,_0x1e9b9c,_0x389185){if(_0x389185){var _0x496d71=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x496d71[_0xca3b('0x19')](_0x1e9b9c)){return _0x159e30;}else{throw new db[(_0xca3b('0x1a'))][(_0xca3b('0x1b'))](_0xca3b('0x1c'));}}else{return _0x159e30;}}function respondWithRpcPromise(_0x39b6e2,_0x55cbaa,_0x2d9080,_0x1f181e){return new BPromise(function(_0x36c859,_0x4b3fa0){var _0x461cec=_0x1f181e||client;return _0x461cec[_0xca3b('0x1d')](_0x39b6e2,_0x2d9080)[_0xca3b('0x1e')](function(_0x39bc7d){logger[_0xca3b('0x1f')](_0xca3b('0x20'),_0x55cbaa,_0xca3b('0x21'));logger[_0xca3b('0x22')](_0xca3b('0x23'),_0x55cbaa,'request\x20sent',JSON[_0xca3b('0x24')](_0x39bc7d));if(_0x39bc7d[_0xca3b('0x25')]){if(_0x39bc7d[_0xca3b('0x25')][_0xca3b('0x26')]===0x1f4){logger[_0xca3b('0x25')]('FreshsalesAccount,\x20%s,\x20%s',_0x55cbaa,_0x39bc7d[_0xca3b('0x25')]['message']);return _0x4b3fa0(_0x39bc7d[_0xca3b('0x25')][_0xca3b('0x27')]);}logger[_0xca3b('0x25')](_0xca3b('0x20'),_0x55cbaa,_0x39bc7d[_0xca3b('0x25')][_0xca3b('0x27')]);return _0x36c859(_0x39bc7d[_0xca3b('0x25')][_0xca3b('0x27')]);}else{logger[_0xca3b('0x1f')]('FreshsalesAccount,\x20%s,\x20%s',_0x55cbaa,_0xca3b('0x21'));_0x36c859(_0x39bc7d['result'][_0xca3b('0x27')]);}})[_0xca3b('0x28')](function(_0x272ff2){logger[_0xca3b('0x25')](_0xca3b('0x20'),_0x55cbaa,_0x272ff2);_0x4b3fa0(_0x272ff2);});});}function respondWithStatusCode(_0x3fff19,_0x498868){_0x498868=_0x498868||0xcc;return function(_0x270591){if(_0x270591){return _0x3fff19[_0xca3b('0x29')](_0x498868);}return _0x3fff19[_0xca3b('0x2a')](_0x498868)[_0xca3b('0x2b')]();};}function respondWithResult(_0xb26d47,_0x31805e){_0x31805e=_0x31805e||0xc8;return function(_0x1e478f){if(_0x1e478f){return _0xb26d47[_0xca3b('0x2a')](_0x31805e)['json'](_0x1e478f);}};}function respondWithFilteredResult(_0x30a04f,_0x5a697f){return function(_0x158611){if(_0x158611){var _0x55b8dc=_0x158611[_0xca3b('0x2c')],_0x475672=_0x5a697f[_0xca3b('0x2d')],_0x5914fd=_0x5a697f[_0xca3b('0x2d')]+_0x5a697f[_0xca3b('0x2e')],_0x2bda9b;if(_0x5914fd>=_0x55b8dc){_0x5914fd=_0x55b8dc;_0x2bda9b=0xc8;}else{_0x2bda9b=0xce;}_0x30a04f[_0xca3b('0x2a')](_0x2bda9b);return _0x30a04f['set'](_0xca3b('0x2f'),_0x475672+'-'+_0x5914fd+'/'+_0x55b8dc)[_0xca3b('0x30')](_0x158611);}return null;};}function patchUpdates(_0x348a8a){return function(_0x57ac53){try{jsonpatch[_0xca3b('0x31')](_0x57ac53,_0x348a8a,!![]);}catch(_0x562ea0){return BPromise[_0xca3b('0x32')](_0x562ea0);}return _0x57ac53[_0xca3b('0x33')]();};}function saveUpdates(_0x564b38,_0x27b424){return function(_0xc9e1ab){if(_0xc9e1ab){return _0xc9e1ab['update'](_0x564b38)['then'](function(_0x5b17e2){return _0x5b17e2;});}return null;};}function removeEntity(_0x4e6f9c,_0x36d787){return function(_0x1d2d91){if(_0x1d2d91){return _0x1d2d91[_0xca3b('0x34')]()['then'](function(){_0x4e6f9c[_0xca3b('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x423f07,_0x199c51){return function(_0x1bba71){if(!_0x1bba71){_0x423f07['sendStatus'](0x194);}return _0x1bba71;};}function handleError(_0x1c1ab1,_0x189390){_0x189390=_0x189390||0x1f4;return function(_0x3d3dd1){logger[_0xca3b('0x25')](_0x3d3dd1[_0xca3b('0x35')]);if(_0x3d3dd1[_0xca3b('0x36')]){delete _0x3d3dd1[_0xca3b('0x36')];}_0x1c1ab1[_0xca3b('0x2a')](_0x189390)[_0xca3b('0x37')](_0x3d3dd1);};}exports['index']=function(_0x417e71,_0x3bea33){var _0xd07ba6={},_0x5bcca6={},_0x40e0d7={'count':0x0,'rows':[]};var _0x5a8a61=_[_0xca3b('0x38')](db[_0xca3b('0x39')][_0xca3b('0x3a')],function(_0x71c599){return{'name':_0x71c599[_0xca3b('0x3b')],'type':_0x71c599[_0xca3b('0x3c')][_0xca3b('0x3d')]};});_0x5bcca6[_0xca3b('0x3e')]=_[_0xca3b('0x38')](_0x5a8a61,_0xca3b('0x36'));_0x5bcca6[_0xca3b('0x3f')]=_[_0xca3b('0x40')](_0x417e71[_0xca3b('0x3f')]);_0x5bcca6[_0xca3b('0x41')]=_[_0xca3b('0x42')](_0x5bcca6[_0xca3b('0x3e')],_0x5bcca6['query']);_0xd07ba6['attributes']=_[_0xca3b('0x42')](_0x5bcca6[_0xca3b('0x3e')],qs[_0xca3b('0x43')](_0x417e71[_0xca3b('0x3f')][_0xca3b('0x43')]));_0xd07ba6[_0xca3b('0x44')]=_0xd07ba6[_0xca3b('0x44')][_0xca3b('0x45')]?_0xd07ba6['attributes']:_0x5bcca6[_0xca3b('0x3e')];if(!_0x417e71['query']['hasOwnProperty'](_0xca3b('0x46'))){_0xd07ba6[_0xca3b('0x2e')]=qs[_0xca3b('0x2e')](_0x417e71[_0xca3b('0x3f')][_0xca3b('0x2e')]);_0xd07ba6[_0xca3b('0x2d')]=qs[_0xca3b('0x2d')](_0x417e71[_0xca3b('0x3f')]['offset']);}_0xd07ba6[_0xca3b('0x47')]=qs[_0xca3b('0x48')](_0x417e71[_0xca3b('0x3f')][_0xca3b('0x48')]);_0xd07ba6[_0xca3b('0x49')]=qs[_0xca3b('0x41')](_['pick'](_0x417e71[_0xca3b('0x3f')],_0x5bcca6[_0xca3b('0x41')]),_0x5a8a61);if(_0x417e71['query']['filter']){_0xd07ba6[_0xca3b('0x49')]=_[_0xca3b('0x4a')](_0xd07ba6[_0xca3b('0x49')],{'$or':_[_0xca3b('0x38')](_0x5a8a61,function(_0x16ea01){if(_0x16ea01[_0xca3b('0x3c')]!==_0xca3b('0x4b')){var _0x32457b={};_0x32457b[_0x16ea01[_0xca3b('0x36')]]={'$like':'%'+_0x417e71[_0xca3b('0x3f')][_0xca3b('0x4c')]+'%'};return _0x32457b;}})});}_0xd07ba6=_[_0xca3b('0x4a')]({},_0xd07ba6,_0x417e71[_0xca3b('0x4d')]);var _0x120c92={'where':_0xd07ba6['where']};return db['FreshsalesAccount']['count'](_0x120c92)['then'](function(_0x14a703){_0x40e0d7['count']=_0x14a703;if(_0x417e71[_0xca3b('0x3f')]['includeAll']){_0xd07ba6[_0xca3b('0x4e')]=[{'all':!![]}];}return db[_0xca3b('0x39')][_0xca3b('0x4f')](_0xd07ba6);})[_0xca3b('0x1e')](function(_0x1fd91){_0x40e0d7[_0xca3b('0x50')]=_0x1fd91;return _0x40e0d7;})[_0xca3b('0x1e')](respondWithFilteredResult(_0x3bea33,_0xd07ba6))[_0xca3b('0x28')](handleError(_0x3bea33,null));};exports[_0xca3b('0x51')]=function(_0x55b54a,_0x3143c1){var _0x1853c4={'raw':![],'where':{'id':_0x55b54a[_0xca3b('0x52')]['id']}},_0x39b58b={};_0x39b58b['model']=_[_0xca3b('0x40')](db[_0xca3b('0x39')][_0xca3b('0x3a')]);_0x39b58b[_0xca3b('0x3f')]=_['keys'](_0x55b54a[_0xca3b('0x3f')]);_0x39b58b[_0xca3b('0x41')]=_[_0xca3b('0x42')](_0x39b58b[_0xca3b('0x3e')],_0x39b58b[_0xca3b('0x3f')]);_0x1853c4[_0xca3b('0x44')]=_[_0xca3b('0x42')](_0x39b58b[_0xca3b('0x3e')],qs['fields'](_0x55b54a[_0xca3b('0x3f')]['fields']));_0x1853c4['attributes']=_0x1853c4['attributes']['length']?_0x1853c4[_0xca3b('0x44')]:_0x39b58b[_0xca3b('0x3e')];if(_0x55b54a[_0xca3b('0x3f')][_0xca3b('0x53')]){_0x1853c4[_0xca3b('0x4e')]=[{'all':!![]}];}_0x1853c4=_[_0xca3b('0x4a')]({},_0x1853c4,_0x55b54a['options']);return db[_0xca3b('0x39')][_0xca3b('0x54')](_0x1853c4)[_0xca3b('0x1e')](handleEntityNotFound(_0x3143c1,null))[_0xca3b('0x1e')](respondWithResult(_0x3143c1,null))[_0xca3b('0x28')](handleError(_0x3143c1,null));};exports[_0xca3b('0x55')]=function(_0x50bab1,_0x345e2c){return db[_0xca3b('0x39')][_0xca3b('0x55')](_0x50bab1[_0xca3b('0x56')],{})[_0xca3b('0x1e')](respondWithResult(_0x345e2c,0xc9))['catch'](handleError(_0x345e2c,null));};exports[_0xca3b('0x57')]=function(_0x49dc42,_0xb648cd){if(_0x49dc42['body']['id']){delete _0x49dc42[_0xca3b('0x56')]['id'];}return db[_0xca3b('0x39')][_0xca3b('0x54')]({'where':{'id':_0x49dc42[_0xca3b('0x52')]['id']}})['then'](handleEntityNotFound(_0xb648cd,null))[_0xca3b('0x1e')](saveUpdates(_0x49dc42[_0xca3b('0x56')],null))[_0xca3b('0x1e')](respondWithResult(_0xb648cd,null))[_0xca3b('0x28')](handleError(_0xb648cd,null));};exports[_0xca3b('0x34')]=function(_0x355128,_0x23ffb3){return db[_0xca3b('0x39')][_0xca3b('0x54')]({'where':{'id':_0x355128[_0xca3b('0x52')]['id']}})['then'](handleEntityNotFound(_0x23ffb3,null))[_0xca3b('0x1e')](removeEntity(_0x23ffb3,null))['catch'](handleError(_0x23ffb3,null));};exports[_0xca3b('0x58')]=function(_0x421dd1,_0x5d8dab,_0x46f34b){var _0x2095f9={};var _0x4dbfbc={};var _0x584688;var _0x3da251;return db[_0xca3b('0x39')]['findOne']({'where':{'id':_0x421dd1['params']['id']}})['then'](handleEntityNotFound(_0x5d8dab,null))[_0xca3b('0x1e')](function(_0xbbc76){if(_0xbbc76){_0x584688=_0xbbc76;_0x4dbfbc[_0xca3b('0x3e')]=_[_0xca3b('0x40')](db[_0xca3b('0x59')][_0xca3b('0x3a')]);_0x4dbfbc[_0xca3b('0x3f')]=_[_0xca3b('0x40')](_0x421dd1[_0xca3b('0x3f')]);_0x4dbfbc[_0xca3b('0x41')]=_[_0xca3b('0x42')](_0x4dbfbc[_0xca3b('0x3e')],_0x4dbfbc[_0xca3b('0x3f')]);_0x2095f9[_0xca3b('0x44')]=_['intersection'](_0x4dbfbc[_0xca3b('0x3e')],qs[_0xca3b('0x43')](_0x421dd1[_0xca3b('0x3f')][_0xca3b('0x43')]));_0x2095f9[_0xca3b('0x44')]=_0x2095f9[_0xca3b('0x44')]['length']?_0x2095f9['attributes']:_0x4dbfbc[_0xca3b('0x3e')];_0x2095f9[_0xca3b('0x47')]=qs[_0xca3b('0x48')](_0x421dd1[_0xca3b('0x3f')][_0xca3b('0x48')]);_0x2095f9[_0xca3b('0x49')]=qs[_0xca3b('0x41')](_[_0xca3b('0x5a')](_0x421dd1[_0xca3b('0x3f')],_0x4dbfbc[_0xca3b('0x41')]));if(_0x421dd1[_0xca3b('0x3f')]['filter']){_0x2095f9['where']=_[_0xca3b('0x4a')](_0x2095f9[_0xca3b('0x49')],{'$or':_[_0xca3b('0x38')](_0x2095f9[_0xca3b('0x44')],function(_0x186c56){var _0x10cd29={};_0x10cd29[_0x186c56]={'$like':'%'+_0x421dd1[_0xca3b('0x3f')][_0xca3b('0x4c')]+'%'};return _0x10cd29;})});}_0x2095f9=_[_0xca3b('0x4a')]({},_0x2095f9,_0x421dd1[_0xca3b('0x4d')]);return _0x584688[_0xca3b('0x58')](_0x2095f9);}})[_0xca3b('0x1e')](function(_0x17eb5f){if(_0x17eb5f){_0x3da251=_0x17eb5f[_0xca3b('0x45')];if(!_0x421dd1[_0xca3b('0x3f')]['hasOwnProperty'](_0xca3b('0x46'))){_0x2095f9[_0xca3b('0x2e')]=qs[_0xca3b('0x2e')](_0x421dd1[_0xca3b('0x3f')][_0xca3b('0x2e')]);_0x2095f9[_0xca3b('0x2d')]=qs['offset'](_0x421dd1[_0xca3b('0x3f')][_0xca3b('0x2d')]);}return _0x584688[_0xca3b('0x58')](_0x2095f9);}})[_0xca3b('0x1e')](function(_0x19ba15){if(_0x19ba15){return _0x19ba15?{'count':_0x3da251,'rows':_0x19ba15}:null;}})[_0xca3b('0x1e')](respondWithResult(_0x5d8dab,null))[_0xca3b('0x28')](handleError(_0x5d8dab,null));};exports[_0xca3b('0x5b')]=function(_0x878c7c,_0x54b318,_0x5e3ad0){if(_0x878c7c['body']['id']){delete _0x878c7c['body']['id'];}return db[_0xca3b('0x39')][_0xca3b('0x5c')]({'where':{'id':_0x878c7c['params']['id']}})[_0xca3b('0x1e')](handleEntityNotFound(_0x54b318,null))[_0xca3b('0x1e')](function(_0x16c8da){if(_0x16c8da){_0x878c7c[_0xca3b('0x56')][_0xca3b('0x5d')]=_0x16c8da['id'];_0x878c7c[_0xca3b('0x56')][_0xca3b('0x5e')]=integrations[_0xca3b('0x5f')](_0x878c7c[_0xca3b('0x56')][_0xca3b('0x60')],_0x878c7c[_0xca3b('0x56')][_0xca3b('0x3c')]);_0x878c7c[_0xca3b('0x56')][_0xca3b('0x61')]=integrations[_0xca3b('0x62')](_0x878c7c['body']['channel'],_0x878c7c[_0xca3b('0x56')][_0xca3b('0x3c')]);return db[_0xca3b('0x59')]['create'](_0x878c7c[_0xca3b('0x56')],{'include':[{'model':db[_0xca3b('0x63')],'as':'Subjects'},{'model':db[_0xca3b('0x63')],'as':_0xca3b('0x61')}]});}return null;})['then'](respondWithResult(_0x54b318,null))[_0xca3b('0x28')](handleError(_0x54b318,null));};exports[_0xca3b('0x64')]=function(_0x5eb55a,_0x65b286,_0x5bec0d){var _0x44c5b0='';var _0x38706d='';return db['FreshsalesAccount'][_0xca3b('0x5c')]({'where':{'id':_0x5eb55a['params']['id']},'attributes':['id',_0xca3b('0x65'),'remoteUri','apiKey']})['then'](handleEntityNotFound(_0x65b286,null))[_0xca3b('0x1e')](function(_0x37b268){if(_0x37b268){_0x38706d=_0x37b268[_0xca3b('0x65')];_0x44c5b0=_0x37b268[_0xca3b('0x66')];var _0x436771=_0x37b268[_0xca3b('0x66')]['slice'](-0x1);if(_0x436771==='/'){_0x44c5b0=_0x44c5b0[_0xca3b('0x67')](0x0,_0x44c5b0['lastIndexOf'](_0x436771));}return rp({'method':'GET','uri':util[_0xca3b('0x68')](_0xca3b('0x69'),_0x44c5b0,_0xca3b('0x6a')),'headers':{'Authorization':_0xca3b('0x6b')+_0x37b268[_0xca3b('0x6c')]},'json':!![]});}})[_0xca3b('0x1e')](function(_0x5e1f0a){if(_0x5e1f0a){var _0x3af3c=_0x5e1f0a[_0xca3b('0x6d')];var _0x4dda8f=![];var _0x5a03b6=null;for(_0x5a03b6=0x0;_0x5a03b6<_0x3af3c[_0xca3b('0x45')];_0x5a03b6++){if(_0x3af3c[_0x5a03b6][_0xca3b('0x6e')]===_0x38706d){_0x4dda8f=!![];}}if(_0x4dda8f){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xca3b('0x1e')](respondWithResult(_0x65b286,null))[_0xca3b('0x28')](function(_0x411bdc){var _0x522bf1=_0x5eb55a[_0xca3b('0x3f')][_0xca3b('0x19')]?0x1f4:_0x411bdc[_0xca3b('0x6f')]||0x1f4;logger[_0xca3b('0x25')](_0xca3b('0x70'),'getFields',_0x522bf1,JSON[_0xca3b('0x24')](_0x411bdc));delete _0x411bdc[_0xca3b('0x36')];if(_0x522bf1===0x191){_0x522bf1=0x190;}_0x65b286[_0xca3b('0x2a')](_0x522bf1)[_0xca3b('0x37')](_0x5eb55a[_0xca3b('0x3f')][_0xca3b('0x19')]?{'message':_0xca3b('0x71'),'statusCode':_0x411bdc[_0xca3b('0x6f')]}:_0x411bdc);});}; \ No newline at end of file +var _0x51aa=['map','FreshsalesAccount','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','length','find','create','body','destroy','FreshsalesConfiguration','rawAttributes','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','stack','name','index'];(function(_0x139a23,_0x184a3f){var _0x4da424=function(_0x5d6309){while(--_0x5d6309){_0x139a23['push'](_0x139a23['shift']());}};_0x4da424(++_0x184a3f);}(_0x51aa,0x1a2));var _0xa51a=function(_0xe9a431,_0x1105d5){_0xe9a431=_0xe9a431-0x0;var _0x419685=_0x51aa[_0xe9a431];return _0x419685;};'use strict';var pdf=require(_0xa51a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa51a('0x1'));var zipdir=require(_0xa51a('0x2'));var jsonpatch=require(_0xa51a('0x3'));var rp=require(_0xa51a('0x4'));var moment=require(_0xa51a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa51a('0x6'));var util=require(_0xa51a('0x7'));var path=require('path');var sox=require(_0xa51a('0x8'));var csv=require(_0xa51a('0x9'));var ejs=require(_0xa51a('0xa'));var fs=require('fs');var _=require(_0xa51a('0xb'));var squel=require(_0xa51a('0xc'));var crypto=require(_0xa51a('0xd'));var jsforce=require(_0xa51a('0xe'));var deskjs=require(_0xa51a('0xf'));var toCsv=require(_0xa51a('0x9'));var querystring=require('querystring');var Papa=require(_0xa51a('0x10'));var Redis=require(_0xa51a('0x11'));var authService=require(_0xa51a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa51a('0x13'));var logger=require(_0xa51a('0x14'))(_0xa51a('0x15'));var utils=require('../../config/utils');var config=require(_0xa51a('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa51a('0x17'));var jayson=require(_0xa51a('0x18'));var client=jayson[_0xa51a('0x19')][_0xa51a('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x12432e,_0x3256a9,_0x5a7e3e){if(_0x5a7e3e){var _0x2c78b5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2c78b5['test'](_0x3256a9)){return _0x12432e;}else{throw new db[(_0xa51a('0x1b'))][(_0xa51a('0x1c'))](_0xa51a('0x1d'));}}else{return _0x12432e;}}function respondWithRpcPromise(_0x227abc,_0x2b2c62,_0x2c3cbb,_0x365418){return new BPromise(function(_0x5cb68b,_0x5aa95e){var _0x3dde85=_0x365418||client;return _0x3dde85[_0xa51a('0x1e')](_0x227abc,_0x2c3cbb)['then'](function(_0x4bb452){logger[_0xa51a('0x1f')](_0xa51a('0x20'),_0x2b2c62,_0xa51a('0x21'));logger[_0xa51a('0x22')](_0xa51a('0x23'),_0x2b2c62,'request\x20sent',JSON[_0xa51a('0x24')](_0x4bb452));if(_0x4bb452[_0xa51a('0x25')]){if(_0x4bb452[_0xa51a('0x25')][_0xa51a('0x26')]===0x1f4){logger[_0xa51a('0x25')](_0xa51a('0x20'),_0x2b2c62,_0x4bb452['error'][_0xa51a('0x27')]);return _0x5aa95e(_0x4bb452['error'][_0xa51a('0x27')]);}logger[_0xa51a('0x25')](_0xa51a('0x20'),_0x2b2c62,_0x4bb452['error']['message']);return _0x5cb68b(_0x4bb452[_0xa51a('0x25')][_0xa51a('0x27')]);}else{logger[_0xa51a('0x1f')](_0xa51a('0x20'),_0x2b2c62,_0xa51a('0x21'));_0x5cb68b(_0x4bb452['result'][_0xa51a('0x27')]);}})[_0xa51a('0x28')](function(_0x1b9cad){logger['error'](_0xa51a('0x20'),_0x2b2c62,_0x1b9cad);_0x5aa95e(_0x1b9cad);});});}function respondWithStatusCode(_0x1d532c,_0x281911){_0x281911=_0x281911||0xcc;return function(_0x300f1e){if(_0x300f1e){return _0x1d532c[_0xa51a('0x29')](_0x281911);}return _0x1d532c[_0xa51a('0x2a')](_0x281911)[_0xa51a('0x2b')]();};}function respondWithResult(_0x4796e4,_0x135507){_0x135507=_0x135507||0xc8;return function(_0x172aa8){if(_0x172aa8){return _0x4796e4[_0xa51a('0x2a')](_0x135507)['json'](_0x172aa8);}};}function respondWithFilteredResult(_0x51c9c8,_0x2b55cc){return function(_0x5ac28b){if(_0x5ac28b){var _0x438641=_0x5ac28b[_0xa51a('0x2c')],_0xb5bbe8=_0x2b55cc[_0xa51a('0x2d')],_0x35ef4e=_0x2b55cc[_0xa51a('0x2d')]+_0x2b55cc[_0xa51a('0x2e')],_0x8ced0;if(_0x35ef4e>=_0x438641){_0x35ef4e=_0x438641;_0x8ced0=0xc8;}else{_0x8ced0=0xce;}_0x51c9c8[_0xa51a('0x2a')](_0x8ced0);return _0x51c9c8[_0xa51a('0x2f')](_0xa51a('0x30'),_0xb5bbe8+'-'+_0x35ef4e+'/'+_0x438641)[_0xa51a('0x31')](_0x5ac28b);}return null;};}function patchUpdates(_0x5350e6){return function(_0x21ada9){try{jsonpatch[_0xa51a('0x32')](_0x21ada9,_0x5350e6,!![]);}catch(_0x36af74){return BPromise[_0xa51a('0x33')](_0x36af74);}return _0x21ada9[_0xa51a('0x34')]();};}function saveUpdates(_0x37ccf2,_0x483551){return function(_0x53d595){if(_0x53d595){return _0x53d595[_0xa51a('0x35')](_0x37ccf2)['then'](function(_0x5de1be){return _0x5de1be;});}return null;};}function removeEntity(_0x5f0e2f,_0x121387){return function(_0x3cb2f7){if(_0x3cb2f7){return _0x3cb2f7['destroy']()[_0xa51a('0x36')](function(){_0x5f0e2f['status'](0xcc)[_0xa51a('0x2b')]();});}};}function handleEntityNotFound(_0x5a80d4,_0x21cccb){return function(_0x2ef974){if(!_0x2ef974){_0x5a80d4[_0xa51a('0x29')](0x194);}return _0x2ef974;};}function handleError(_0x111475,_0x591967){_0x591967=_0x591967||0x1f4;return function(_0x383213){logger[_0xa51a('0x25')](_0x383213[_0xa51a('0x37')]);if(_0x383213[_0xa51a('0x38')]){delete _0x383213[_0xa51a('0x38')];}_0x111475[_0xa51a('0x2a')](_0x591967)['send'](_0x383213);};}exports[_0xa51a('0x39')]=function(_0x3c89bb,_0x1a8fd4){var _0x2744f3={},_0x35e28c={},_0x15ebf4={'count':0x0,'rows':[]};var _0x3519b1=_[_0xa51a('0x3a')](db[_0xa51a('0x3b')]['rawAttributes'],function(_0x43cd62){return{'name':_0x43cd62['fieldName'],'type':_0x43cd62[_0xa51a('0x3c')][_0xa51a('0x3d')]};});_0x35e28c[_0xa51a('0x3e')]=_[_0xa51a('0x3a')](_0x3519b1,_0xa51a('0x38'));_0x35e28c['query']=_[_0xa51a('0x3f')](_0x3c89bb[_0xa51a('0x40')]);_0x35e28c[_0xa51a('0x41')]=_['intersection'](_0x35e28c[_0xa51a('0x3e')],_0x35e28c['query']);_0x2744f3['attributes']=_[_0xa51a('0x42')](_0x35e28c[_0xa51a('0x3e')],qs[_0xa51a('0x43')](_0x3c89bb[_0xa51a('0x40')][_0xa51a('0x43')]));_0x2744f3[_0xa51a('0x44')]=_0x2744f3[_0xa51a('0x44')]['length']?_0x2744f3[_0xa51a('0x44')]:_0x35e28c[_0xa51a('0x3e')];if(!_0x3c89bb[_0xa51a('0x40')]['hasOwnProperty'](_0xa51a('0x45'))){_0x2744f3[_0xa51a('0x2e')]=qs[_0xa51a('0x2e')](_0x3c89bb[_0xa51a('0x40')][_0xa51a('0x2e')]);_0x2744f3[_0xa51a('0x2d')]=qs[_0xa51a('0x2d')](_0x3c89bb['query'][_0xa51a('0x2d')]);}_0x2744f3[_0xa51a('0x46')]=qs[_0xa51a('0x47')](_0x3c89bb[_0xa51a('0x40')]['sort']);_0x2744f3[_0xa51a('0x48')]=qs[_0xa51a('0x41')](_[_0xa51a('0x49')](_0x3c89bb[_0xa51a('0x40')],_0x35e28c['filters']),_0x3519b1);if(_0x3c89bb['query'][_0xa51a('0x4a')]){_0x2744f3[_0xa51a('0x48')]=_[_0xa51a('0x4b')](_0x2744f3[_0xa51a('0x48')],{'$or':_[_0xa51a('0x3a')](_0x3519b1,function(_0x50c848){if(_0x50c848[_0xa51a('0x3c')]!=='VIRTUAL'){var _0x151ebd={};_0x151ebd[_0x50c848[_0xa51a('0x38')]]={'$like':'%'+_0x3c89bb[_0xa51a('0x40')][_0xa51a('0x4a')]+'%'};return _0x151ebd;}})});}_0x2744f3=_['merge']({},_0x2744f3,_0x3c89bb[_0xa51a('0x4c')]);var _0x5f0ebf={'where':_0x2744f3['where']};return db[_0xa51a('0x3b')][_0xa51a('0x2c')](_0x5f0ebf)[_0xa51a('0x36')](function(_0x4fba67){_0x15ebf4[_0xa51a('0x2c')]=_0x4fba67;if(_0x3c89bb[_0xa51a('0x40')][_0xa51a('0x4d')]){_0x2744f3[_0xa51a('0x4e')]=[{'all':!![]}];}return db[_0xa51a('0x3b')][_0xa51a('0x4f')](_0x2744f3);})[_0xa51a('0x36')](function(_0x3cbc7e){_0x15ebf4[_0xa51a('0x50')]=_0x3cbc7e;return _0x15ebf4;})[_0xa51a('0x36')](respondWithFilteredResult(_0x1a8fd4,_0x2744f3))[_0xa51a('0x28')](handleError(_0x1a8fd4,null));};exports[_0xa51a('0x51')]=function(_0x59afda,_0x5ee69f){var _0x501467={'raw':![],'where':{'id':_0x59afda[_0xa51a('0x52')]['id']}},_0x2d63fd={};_0x2d63fd[_0xa51a('0x3e')]=_[_0xa51a('0x3f')](db[_0xa51a('0x3b')]['rawAttributes']);_0x2d63fd[_0xa51a('0x40')]=_[_0xa51a('0x3f')](_0x59afda[_0xa51a('0x40')]);_0x2d63fd[_0xa51a('0x41')]=_['intersection'](_0x2d63fd[_0xa51a('0x3e')],_0x2d63fd[_0xa51a('0x40')]);_0x501467['attributes']=_[_0xa51a('0x42')](_0x2d63fd[_0xa51a('0x3e')],qs['fields'](_0x59afda[_0xa51a('0x40')][_0xa51a('0x43')]));_0x501467[_0xa51a('0x44')]=_0x501467['attributes'][_0xa51a('0x53')]?_0x501467[_0xa51a('0x44')]:_0x2d63fd[_0xa51a('0x3e')];if(_0x59afda[_0xa51a('0x40')][_0xa51a('0x4d')]){_0x501467[_0xa51a('0x4e')]=[{'all':!![]}];}_0x501467=_[_0xa51a('0x4b')]({},_0x501467,_0x59afda[_0xa51a('0x4c')]);return db[_0xa51a('0x3b')][_0xa51a('0x54')](_0x501467)[_0xa51a('0x36')](handleEntityNotFound(_0x5ee69f,null))[_0xa51a('0x36')](respondWithResult(_0x5ee69f,null))[_0xa51a('0x28')](handleError(_0x5ee69f,null));};exports[_0xa51a('0x55')]=function(_0x1d4814,_0x26c3b6){return db[_0xa51a('0x3b')][_0xa51a('0x55')](_0x1d4814[_0xa51a('0x56')],{})[_0xa51a('0x36')](respondWithResult(_0x26c3b6,0xc9))['catch'](handleError(_0x26c3b6,null));};exports[_0xa51a('0x35')]=function(_0xd71f22,_0x36f651){if(_0xd71f22['body']['id']){delete _0xd71f22['body']['id'];}return db[_0xa51a('0x3b')]['find']({'where':{'id':_0xd71f22['params']['id']}})['then'](handleEntityNotFound(_0x36f651,null))[_0xa51a('0x36')](saveUpdates(_0xd71f22[_0xa51a('0x56')],null))[_0xa51a('0x36')](respondWithResult(_0x36f651,null))[_0xa51a('0x28')](handleError(_0x36f651,null));};exports[_0xa51a('0x57')]=function(_0x287539,_0x1b1592){return db[_0xa51a('0x3b')][_0xa51a('0x54')]({'where':{'id':_0x287539['params']['id']}})[_0xa51a('0x36')](handleEntityNotFound(_0x1b1592,null))['then'](removeEntity(_0x1b1592,null))[_0xa51a('0x28')](handleError(_0x1b1592,null));};exports['getConfigurations']=function(_0x396dac,_0x4f3cd2,_0x4cea1c){var _0x52ca6f={};var _0x206a42={};var _0x1006d0;var _0x42b06c;return db[_0xa51a('0x3b')]['findOne']({'where':{'id':_0x396dac[_0xa51a('0x52')]['id']}})[_0xa51a('0x36')](handleEntityNotFound(_0x4f3cd2,null))[_0xa51a('0x36')](function(_0x5bf800){if(_0x5bf800){_0x1006d0=_0x5bf800;_0x206a42[_0xa51a('0x3e')]=_[_0xa51a('0x3f')](db[_0xa51a('0x58')][_0xa51a('0x59')]);_0x206a42[_0xa51a('0x40')]=_[_0xa51a('0x3f')](_0x396dac['query']);_0x206a42[_0xa51a('0x41')]=_[_0xa51a('0x42')](_0x206a42[_0xa51a('0x3e')],_0x206a42[_0xa51a('0x40')]);_0x52ca6f[_0xa51a('0x44')]=_[_0xa51a('0x42')](_0x206a42['model'],qs[_0xa51a('0x43')](_0x396dac['query'][_0xa51a('0x43')]));_0x52ca6f[_0xa51a('0x44')]=_0x52ca6f[_0xa51a('0x44')]['length']?_0x52ca6f[_0xa51a('0x44')]:_0x206a42[_0xa51a('0x3e')];_0x52ca6f[_0xa51a('0x46')]=qs[_0xa51a('0x47')](_0x396dac[_0xa51a('0x40')][_0xa51a('0x47')]);_0x52ca6f[_0xa51a('0x48')]=qs[_0xa51a('0x41')](_['pick'](_0x396dac[_0xa51a('0x40')],_0x206a42[_0xa51a('0x41')]));if(_0x396dac[_0xa51a('0x40')][_0xa51a('0x4a')]){_0x52ca6f[_0xa51a('0x48')]=_[_0xa51a('0x4b')](_0x52ca6f['where'],{'$or':_[_0xa51a('0x3a')](_0x52ca6f[_0xa51a('0x44')],function(_0x93fd18){var _0x2b8a87={};_0x2b8a87[_0x93fd18]={'$like':'%'+_0x396dac[_0xa51a('0x40')][_0xa51a('0x4a')]+'%'};return _0x2b8a87;})});}_0x52ca6f=_['merge']({},_0x52ca6f,_0x396dac['options']);return _0x1006d0[_0xa51a('0x5a')](_0x52ca6f);}})[_0xa51a('0x36')](function(_0x43f6be){if(_0x43f6be){_0x42b06c=_0x43f6be[_0xa51a('0x53')];if(!_0x396dac[_0xa51a('0x40')][_0xa51a('0x5b')]('nolimit')){_0x52ca6f['limit']=qs['limit'](_0x396dac[_0xa51a('0x40')][_0xa51a('0x2e')]);_0x52ca6f[_0xa51a('0x2d')]=qs[_0xa51a('0x2d')](_0x396dac[_0xa51a('0x40')][_0xa51a('0x2d')]);}return _0x1006d0['getConfigurations'](_0x52ca6f);}})['then'](function(_0x2f0862){if(_0x2f0862){return _0x2f0862?{'count':_0x42b06c,'rows':_0x2f0862}:null;}})[_0xa51a('0x36')](respondWithResult(_0x4f3cd2,null))['catch'](handleError(_0x4f3cd2,null));};exports[_0xa51a('0x5c')]=function(_0x6d95c3,_0x468a28,_0x920013){if(_0x6d95c3[_0xa51a('0x56')]['id']){delete _0x6d95c3[_0xa51a('0x56')]['id'];}return db['FreshsalesAccount'][_0xa51a('0x5d')]({'where':{'id':_0x6d95c3[_0xa51a('0x52')]['id']}})[_0xa51a('0x36')](handleEntityNotFound(_0x468a28,null))[_0xa51a('0x36')](function(_0x4edea9){if(_0x4edea9){_0x6d95c3[_0xa51a('0x56')][_0xa51a('0x5e')]=_0x4edea9['id'];_0x6d95c3[_0xa51a('0x56')][_0xa51a('0x5f')]=integrations[_0xa51a('0x60')](_0x6d95c3['body'][_0xa51a('0x61')],_0x6d95c3[_0xa51a('0x56')][_0xa51a('0x3c')]);_0x6d95c3['body'][_0xa51a('0x62')]=integrations[_0xa51a('0x63')](_0x6d95c3['body'][_0xa51a('0x61')],_0x6d95c3[_0xa51a('0x56')][_0xa51a('0x3c')]);return db[_0xa51a('0x58')][_0xa51a('0x55')](_0x6d95c3[_0xa51a('0x56')],{'include':[{'model':db[_0xa51a('0x64')],'as':_0xa51a('0x5f')},{'model':db[_0xa51a('0x64')],'as':_0xa51a('0x62')}]});}return null;})['then'](respondWithResult(_0x468a28,null))[_0xa51a('0x28')](handleError(_0x468a28,null));};exports[_0xa51a('0x65')]=function(_0x554f43,_0x25f13d,_0x3325a0){var _0x2798b9='';var _0x3e3283='';return db[_0xa51a('0x3b')][_0xa51a('0x5d')]({'where':{'id':_0x554f43[_0xa51a('0x52')]['id']},'attributes':['id',_0xa51a('0x66'),_0xa51a('0x67'),'apiKey']})[_0xa51a('0x36')](handleEntityNotFound(_0x25f13d,null))['then'](function(_0x375b04){if(_0x375b04){_0x3e3283=_0x375b04[_0xa51a('0x66')];_0x2798b9=_0x375b04['remoteUri'];var _0x4e07c6=_0x375b04['remoteUri'][_0xa51a('0x68')](-0x1);if(_0x4e07c6==='/'){_0x2798b9=_0x2798b9['substring'](0x0,_0x2798b9[_0xa51a('0x69')](_0x4e07c6));}return rp({'method':_0xa51a('0x6a'),'uri':util[_0xa51a('0x6b')](_0xa51a('0x6c'),_0x2798b9,_0xa51a('0x6d')),'headers':{'Authorization':_0xa51a('0x6e')+_0x375b04[_0xa51a('0x6f')]},'json':!![]});}})[_0xa51a('0x36')](function(_0x42d6a4){if(_0x42d6a4){var _0x45e911=_0x42d6a4[_0xa51a('0x70')];var _0x1f6844=![];var _0x3046e0=null;for(_0x3046e0=0x0;_0x3046e0<_0x45e911[_0xa51a('0x53')];_0x3046e0++){if(_0x45e911[_0x3046e0][_0xa51a('0x71')]===_0x3e3283){_0x1f6844=!![];}}if(_0x1f6844){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xa51a('0x72')});}}})[_0xa51a('0x36')](respondWithResult(_0x25f13d,null))['catch'](function(_0x4a11b5){var _0x2fb554=_0x554f43[_0xa51a('0x40')][_0xa51a('0x73')]?0x1f4:_0x4a11b5[_0xa51a('0x74')]||0x1f4;logger[_0xa51a('0x25')](_0xa51a('0x75'),_0xa51a('0x65'),_0x2fb554,JSON[_0xa51a('0x24')](_0x4a11b5));delete _0x4a11b5[_0xa51a('0x38')];if(_0x2fb554===0x191){_0x2fb554=0x190;}_0x25f13d[_0xa51a('0x2a')](_0x2fb554)['send'](_0x554f43['query'][_0xa51a('0x73')]?{'message':_0xa51a('0x76'),'statusCode':_0x4a11b5[_0xa51a('0x74')]}:_0x4a11b5);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index a9acfea..76eb2ea 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 _0xf76d=['moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger'];(function(_0x4b793b,_0x1ee112){var _0xcfbd6a=function(_0x2eb91c){while(--_0x2eb91c){_0x4b793b['push'](_0x4b793b['shift']());}};_0xcfbd6a(++_0x1ee112);}(_0xf76d,0xc1));var _0xdf76=function(_0x5ab238,_0x4ddda9){_0x5ab238=_0x5ab238-0x0;var _0x236db6=_0xf76d[_0x5ab238];return _0x236db6;};'use strict';var _=require('lodash');var util=require(_0xdf76('0x0'));var logger=require(_0xdf76('0x1'))('api');var moment=require(_0xdf76('0x2'));var BPromise=require(_0xdf76('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf76('0x4'));var rimraf=require(_0xdf76('0x5'));var config=require(_0xdf76('0x6'));var attributes=require(_0xdf76('0x7'));var integrations=require(_0xdf76('0x8'));module[_0xdf76('0x9')]=function(_0x11475f,_0x3266a0){return _0x11475f[_0xdf76('0xa')](_0xdf76('0xb'),attributes,{'tableName':_0xdf76('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9666=['path','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0x9666,0x17a));var _0x6966=function(_0x3013b4,_0x327aef){_0x3013b4=_0x3013b4-0x0;var _0x24ae45=_0x9666[_0x3013b4];return _0x24ae45;};'use strict';var _=require(_0x6966('0x0'));var util=require(_0x6966('0x1'));var logger=require(_0x6966('0x2'))(_0x6966('0x3'));var moment=require('moment');var BPromise=require(_0x6966('0x4'));var rp=require(_0x6966('0x5'));var fs=require('fs');var path=require(_0x6966('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6966('0x7'));var integrations=require(_0x6966('0x8'));module[_0x6966('0x9')]=function(_0x17198b,_0x363f5f){return _0x17198b[_0x6966('0xa')]('FreshsalesAccount',attributes,{'tableName':_0x6966('0xb'),'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 d488e3e..b966faa 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 _0x2c91=['find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','limit','include','map','model','attributes','debug','stringify','ShowFreshsalesAccount'];(function(_0x6a416a,_0x1d0bfe){var _0xd33148=function(_0x5460e9){while(--_0x5460e9){_0x6a416a['push'](_0x6a416a['shift']());}};_0xd33148(++_0x1d0bfe);}(_0x2c91,0x158));var _0x12c9=function(_0x230303,_0x54d807){_0x230303=_0x230303-0x0;var _0x2a525e=_0x2c91[_0x230303];return _0x2a525e;};'use strict';var _=require(_0x12c9('0x0'));var util=require(_0x12c9('0x1'));var moment=require(_0x12c9('0x2'));var BPromise=require(_0x12c9('0x3'));var rs=require(_0x12c9('0x4'));var fs=require('fs');var Redis=require(_0x12c9('0x5'));var db=require(_0x12c9('0x6'))['db'];var utils=require(_0x12c9('0x7'));var logger=require('../../config/logger')(_0x12c9('0x8'));var config=require(_0x12c9('0x9'));var jayson=require(_0x12c9('0xa'));var client=jayson[_0x12c9('0xb')][_0x12c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x170c17,_0x3e30ed,_0x55c40a){return new BPromise(function(_0x283633,_0x2cbffe){return client['request'](_0x170c17,_0x55c40a)[_0x12c9('0xd')](function(_0x397004){logger['info'](_0x12c9('0xe'),_0x3e30ed,_0x12c9('0xf'));logger['debug'](_0x12c9('0x10'),_0x3e30ed,_0x12c9('0xf'),JSON['stringify'](_0x397004));if(_0x397004[_0x12c9('0x11')]){if(_0x397004[_0x12c9('0x11')][_0x12c9('0x12')]===0x1f4){logger[_0x12c9('0x11')](_0x12c9('0xe'),_0x3e30ed,_0x397004[_0x12c9('0x11')]['message']);return _0x2cbffe(_0x397004[_0x12c9('0x11')][_0x12c9('0x13')]);}logger[_0x12c9('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x3e30ed,_0x397004['error']['message']);return _0x283633(_0x397004['error']['message']);}else{logger[_0x12c9('0x14')]('FreshsalesAccount,\x20%s,\x20%s',_0x3e30ed,_0x12c9('0xf'));_0x283633(_0x397004[_0x12c9('0x15')][_0x12c9('0x13')]);}})[_0x12c9('0x16')](function(_0x8caeda){logger['error'](_0x12c9('0xe'),_0x3e30ed,_0x8caeda);_0x2cbffe(_0x8caeda);});});}exports[_0x12c9('0x17')]=function(_0x1890d4){var _0x38c12e=this;return new Promise(function(_0x44e9af,_0x1def14){return db[_0x12c9('0x18')][_0x12c9('0x19')]({'raw':_0x1890d4['options']?_0x1890d4[_0x12c9('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1890d4[_0x12c9('0x1a')]?_0x1890d4[_0x12c9('0x1a')][_0x12c9('0x1b')]||null:null,'attributes':_0x1890d4[_0x12c9('0x1a')]?_0x1890d4[_0x12c9('0x1a')]['attributes']||null:null,'limit':_0x1890d4[_0x12c9('0x1a')]?_0x1890d4[_0x12c9('0x1a')][_0x12c9('0x1c')]||null:null,'include':_0x1890d4[_0x12c9('0x1a')]?_0x1890d4[_0x12c9('0x1a')][_0x12c9('0x1d')]?_[_0x12c9('0x1e')](_0x1890d4[_0x12c9('0x1a')][_0x12c9('0x1d')],function(_0x2eecec){return{'model':db[_0x2eecec[_0x12c9('0x1f')]],'as':_0x2eecec['as'],'attributes':_0x2eecec['attributes'],'include':_0x2eecec[_0x12c9('0x1d')]?_[_0x12c9('0x1e')](_0x2eecec[_0x12c9('0x1d')],function(_0x1aa6a8){return{'model':db[_0x1aa6a8[_0x12c9('0x1f')]],'as':_0x1aa6a8['as'],'attributes':_0x1aa6a8[_0x12c9('0x20')],'include':_0x1aa6a8[_0x12c9('0x1d')]?_[_0x12c9('0x1e')](_0x1aa6a8[_0x12c9('0x1d')],function(_0x3ed911){return{'model':db[_0x3ed911[_0x12c9('0x1f')]],'as':_0x3ed911['as'],'attributes':_0x3ed911[_0x12c9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x12c9('0xd')](function(_0x2224ce){logger[_0x12c9('0x14')](_0x12c9('0x17'),_0x1890d4);logger[_0x12c9('0x21')](_0x12c9('0x17'),_0x1890d4,JSON[_0x12c9('0x22')](_0x2224ce));_0x44e9af(_0x2224ce);})[_0x12c9('0x16')](function(_0x5c02fb){logger[_0x12c9('0x11')](_0x12c9('0x17'),_0x5c02fb[_0x12c9('0x13')],_0x1890d4);_0x1def14(_0x38c12e[_0x12c9('0x11')](0x1f4,_0x5c02fb[_0x12c9('0x13')]));});});};exports[_0x12c9('0x23')]=function(_0x98660f){var _0x59ba1a=this;return new Promise(function(_0x179def,_0x35a37d){return db[_0x12c9('0x18')][_0x12c9('0x24')]({'raw':_0x98660f[_0x12c9('0x1a')]?_0x98660f['options'][_0x12c9('0x25')]===undefined?!![]:![]:!![],'where':_0x98660f['options']?_0x98660f[_0x12c9('0x1a')][_0x12c9('0x1b')]||null:null,'attributes':_0x98660f[_0x12c9('0x1a')]?_0x98660f[_0x12c9('0x1a')][_0x12c9('0x20')]||null:null,'include':_0x98660f[_0x12c9('0x1a')]?_0x98660f[_0x12c9('0x1a')][_0x12c9('0x1d')]?_[_0x12c9('0x1e')](_0x98660f['options']['include'],function(_0x46bfc0){return{'model':db[_0x46bfc0[_0x12c9('0x1f')]],'as':_0x46bfc0['as'],'attributes':_0x46bfc0[_0x12c9('0x20')],'include':_0x46bfc0[_0x12c9('0x1d')]?_[_0x12c9('0x1e')](_0x46bfc0[_0x12c9('0x1d')],function(_0x410841){return{'model':db[_0x410841['model']],'as':_0x410841['as'],'attributes':_0x410841[_0x12c9('0x20')],'include':_0x410841[_0x12c9('0x1d')]?_[_0x12c9('0x1e')](_0x410841['include'],function(_0x30221c){return{'model':db[_0x30221c[_0x12c9('0x1f')]],'as':_0x30221c['as'],'attributes':_0x30221c['attributes']};}):[]};}):[]};}):[]:[]})[_0x12c9('0xd')](function(_0x34dacd){logger[_0x12c9('0x14')]('ShowFreshsalesAccount',_0x98660f);logger[_0x12c9('0x21')](_0x12c9('0x23'),_0x98660f,JSON[_0x12c9('0x22')](_0x34dacd));_0x179def(_0x34dacd);})[_0x12c9('0x16')](function(_0x2f4cf7){logger[_0x12c9('0x11')](_0x12c9('0x23'),_0x2f4cf7[_0x12c9('0x13')],_0x98660f);_0x35a37d(_0x59ba1a[_0x12c9('0x11')](0x1f4,_0x2f4cf7[_0x12c9('0x13')]));});});}; \ No newline at end of file +var _0xd386=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','attributes','map','model','ShowFreshsalesAccount','find','then','lodash','util','moment','randomstring'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd386,0x10c));var _0x6d38=function(_0x562cc9,_0x1cb01e){_0x562cc9=_0x562cc9-0x0;var _0x5ddbf8=_0xd386[_0x562cc9];return _0x5ddbf8;};'use strict';var _=require(_0x6d38('0x0'));var util=require(_0x6d38('0x1'));var moment=require(_0x6d38('0x2'));var BPromise=require('bluebird');var rs=require(_0x6d38('0x3'));var fs=require('fs');var Redis=require(_0x6d38('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d38('0x5'));var logger=require(_0x6d38('0x6'))(_0x6d38('0x7'));var config=require(_0x6d38('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d38('0x9')][_0x6d38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b2038,_0x83823e,_0x2b742c){return new BPromise(function(_0x44ef4e,_0x49d71a){return client[_0x6d38('0xb')](_0x1b2038,_0x2b742c)['then'](function(_0x274898){logger['info'](_0x6d38('0xc'),_0x83823e,_0x6d38('0xd'));logger[_0x6d38('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x83823e,_0x6d38('0xd'),JSON[_0x6d38('0xf')](_0x274898));if(_0x274898[_0x6d38('0x10')]){if(_0x274898['error']['code']===0x1f4){logger['error'](_0x6d38('0xc'),_0x83823e,_0x274898[_0x6d38('0x10')][_0x6d38('0x11')]);return _0x49d71a(_0x274898[_0x6d38('0x10')][_0x6d38('0x11')]);}logger['error'](_0x6d38('0xc'),_0x83823e,_0x274898[_0x6d38('0x10')][_0x6d38('0x11')]);return _0x44ef4e(_0x274898[_0x6d38('0x10')][_0x6d38('0x11')]);}else{logger[_0x6d38('0x12')](_0x6d38('0xc'),_0x83823e,'request\x20sent');_0x44ef4e(_0x274898['result']['message']);}})[_0x6d38('0x13')](function(_0x46e7d7){logger[_0x6d38('0x10')](_0x6d38('0xc'),_0x83823e,_0x46e7d7);_0x49d71a(_0x46e7d7);});});}exports[_0x6d38('0x14')]=function(_0x11298c){var _0x5dcd45=this;return new Promise(function(_0x278829,_0xffcf23){return db[_0x6d38('0x15')][_0x6d38('0x16')]({'raw':_0x11298c[_0x6d38('0x17')]?_0x11298c[_0x6d38('0x17')][_0x6d38('0x18')]===undefined?!![]:![]:!![],'where':_0x11298c[_0x6d38('0x17')]?_0x11298c['options'][_0x6d38('0x19')]||null:null,'attributes':_0x11298c[_0x6d38('0x17')]?_0x11298c['options']['attributes']||null:null,'limit':_0x11298c[_0x6d38('0x17')]?_0x11298c[_0x6d38('0x17')][_0x6d38('0x1a')]||null:null,'include':_0x11298c[_0x6d38('0x17')]?_0x11298c['options'][_0x6d38('0x1b')]?_['map'](_0x11298c[_0x6d38('0x17')]['include'],function(_0x473895){return{'model':db[_0x473895['model']],'as':_0x473895['as'],'attributes':_0x473895[_0x6d38('0x1c')],'include':_0x473895[_0x6d38('0x1b')]?_[_0x6d38('0x1d')](_0x473895[_0x6d38('0x1b')],function(_0x3c777a){return{'model':db[_0x3c777a['model']],'as':_0x3c777a['as'],'attributes':_0x3c777a['attributes'],'include':_0x3c777a[_0x6d38('0x1b')]?_[_0x6d38('0x1d')](_0x3c777a['include'],function(_0x4f2769){return{'model':db[_0x4f2769[_0x6d38('0x1e')]],'as':_0x4f2769['as'],'attributes':_0x4f2769['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a41f8){logger[_0x6d38('0x12')](_0x6d38('0x14'),_0x11298c);logger[_0x6d38('0xe')](_0x6d38('0x14'),_0x11298c,JSON[_0x6d38('0xf')](_0x3a41f8));_0x278829(_0x3a41f8);})['catch'](function(_0x3e62cf){logger['error'](_0x6d38('0x14'),_0x3e62cf['message'],_0x11298c);_0xffcf23(_0x5dcd45[_0x6d38('0x10')](0x1f4,_0x3e62cf['message']));});});};exports[_0x6d38('0x1f')]=function(_0x471f08){var _0x503658=this;return new Promise(function(_0x4863b1,_0x1824f4){return db[_0x6d38('0x15')][_0x6d38('0x20')]({'raw':_0x471f08[_0x6d38('0x17')]?_0x471f08[_0x6d38('0x17')][_0x6d38('0x18')]===undefined?!![]:![]:!![],'where':_0x471f08['options']?_0x471f08['options'][_0x6d38('0x19')]||null:null,'attributes':_0x471f08['options']?_0x471f08[_0x6d38('0x17')]['attributes']||null:null,'include':_0x471f08[_0x6d38('0x17')]?_0x471f08[_0x6d38('0x17')][_0x6d38('0x1b')]?_['map'](_0x471f08[_0x6d38('0x17')][_0x6d38('0x1b')],function(_0xfc85c3){return{'model':db[_0xfc85c3[_0x6d38('0x1e')]],'as':_0xfc85c3['as'],'attributes':_0xfc85c3[_0x6d38('0x1c')],'include':_0xfc85c3[_0x6d38('0x1b')]?_[_0x6d38('0x1d')](_0xfc85c3[_0x6d38('0x1b')],function(_0x197b3f){return{'model':db[_0x197b3f['model']],'as':_0x197b3f['as'],'attributes':_0x197b3f[_0x6d38('0x1c')],'include':_0x197b3f[_0x6d38('0x1b')]?_[_0x6d38('0x1d')](_0x197b3f['include'],function(_0x4f5350){return{'model':db[_0x4f5350[_0x6d38('0x1e')]],'as':_0x4f5350['as'],'attributes':_0x4f5350['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d38('0x21')](function(_0x41cb07){logger[_0x6d38('0x12')](_0x6d38('0x1f'),_0x471f08);logger['debug'](_0x6d38('0x1f'),_0x471f08,JSON['stringify'](_0x41cb07));_0x4863b1(_0x41cb07);})['catch'](function(_0x3fefe3){logger[_0x6d38('0x10')]('ShowFreshsalesAccount',_0x3fefe3['message'],_0x471f08);_0x1824f4(_0x503658[_0x6d38('0x10')](0x1f4,_0x3fefe3[_0x6d38('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 6fa10db..1f02c34 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 _0x85e9=['index','get','/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated'];(function(_0x3b3c1a,_0x1854ad){var _0x26dac5=function(_0x41ef2){while(--_0x41ef2){_0x3b3c1a['push'](_0x3b3c1a['shift']());}};_0x26dac5(++_0x1854ad);}(_0x85e9,0x8b));var _0x985e=function(_0x8bd3ff,_0x2a53d9){_0x8bd3ff=_0x8bd3ff-0x0;var _0x24ec1a=_0x85e9[_0x8bd3ff];return _0x24ec1a;};'use strict';var multer=require(_0x985e('0x0'));var util=require(_0x985e('0x1'));var path=require(_0x985e('0x2'));var timeout=require(_0x985e('0x3'));var express=require(_0x985e('0x4'));var router=express[_0x985e('0x5')]();var auth=require(_0x985e('0x6'));var interaction=require(_0x985e('0x7'));var config=require(_0x985e('0x8'));var controller=require(_0x985e('0x9'));router['get']('/',auth[_0x985e('0xa')](),controller[_0x985e('0xb')]);router[_0x985e('0xc')](_0x985e('0xd'),auth[_0x985e('0xa')](),controller[_0x985e('0xe')]);router['get'](_0x985e('0xf'),auth[_0x985e('0xa')](),controller[_0x985e('0x10')]);router['get']('/:id/descriptions',auth[_0x985e('0xa')](),controller[_0x985e('0x11')]);router[_0x985e('0xc')](_0x985e('0x12'),auth[_0x985e('0xa')](),controller[_0x985e('0x13')]);router['post']('/',auth[_0x985e('0xa')](),controller[_0x985e('0x14')]);router[_0x985e('0x15')]('/:id',auth[_0x985e('0xa')](),controller[_0x985e('0x16')]);router[_0x985e('0x17')](_0x985e('0xd'),auth[_0x985e('0xa')](),controller[_0x985e('0x18')]);module['exports']=router; \ No newline at end of file +var _0x5fc7=['/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1135ae,_0x1b8863){var _0x5f0314=function(_0x2a3b3f){while(--_0x2a3b3f){_0x1135ae['push'](_0x1135ae['shift']());}};_0x5f0314(++_0x1b8863);}(_0x5fc7,0x1a9));var _0x75fc=function(_0x11deef,_0x34bbdb){_0x11deef=_0x11deef-0x0;var _0xe9ba85=_0x5fc7[_0x11deef];return _0xe9ba85;};'use strict';var multer=require(_0x75fc('0x0'));var util=require(_0x75fc('0x1'));var path=require('path');var timeout=require(_0x75fc('0x2'));var express=require('express');var router=express[_0x75fc('0x3')]();var auth=require(_0x75fc('0x4'));var interaction=require(_0x75fc('0x5'));var config=require('../../config/environment');var controller=require(_0x75fc('0x6'));router[_0x75fc('0x7')]('/',auth[_0x75fc('0x8')](),controller[_0x75fc('0x9')]);router[_0x75fc('0x7')](_0x75fc('0xa'),auth['isAuthenticated'](),controller[_0x75fc('0xb')]);router[_0x75fc('0x7')](_0x75fc('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x75fc('0x7')](_0x75fc('0xd'),auth[_0x75fc('0x8')](),controller[_0x75fc('0xe')]);router[_0x75fc('0x7')](_0x75fc('0xf'),auth[_0x75fc('0x8')](),controller[_0x75fc('0x10')]);router[_0x75fc('0x11')]('/',auth[_0x75fc('0x8')](),controller['create']);router[_0x75fc('0x12')](_0x75fc('0xa'),auth[_0x75fc('0x8')](),controller[_0x75fc('0x13')]);router[_0x75fc('0x14')](_0x75fc('0xa'),auth[_0x75fc('0x8')](),controller[_0x75fc('0x15')]);module[_0x75fc('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index c539a6a..a7ea191 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 _0xda08=['STRING','sequelize','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xda08,0xe2));var _0x8da0=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xda08[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require(_0x8da0('0x0'));module[_0x8da0('0x1')]={'name':{'type':Sequelize[_0x8da0('0x2')]},'description':{'type':Sequelize[_0x8da0('0x2')]}}; \ No newline at end of file +var _0xe9a2=['STRING','exports'];(function(_0x45161c,_0x5494fc){var _0x186581=function(_0x78fada){while(--_0x78fada){_0x45161c['push'](_0x45161c['shift']());}};_0x186581(++_0x5494fc);}(_0xe9a2,0x13b));var _0x2e9a=function(_0x56598a,_0x261823){_0x56598a=_0x56598a-0x0;var _0x23d950=_0xe9a2[_0x56598a];return _0x23d950;};'use strict';var Sequelize=require('sequelize');module[_0x2e9a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2e9a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 6263f1c..1f748d3 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 _0xa312=['sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','fields','find','create','body','findOne','FreshsalesField','getSubjects','getDescriptions','getFields','order','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','http','test','Sequelize','request','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','count','offset','limit','reject','save','update','then','destroy','stack','name','send','index','map','FreshsalesConfiguration','type','keys','query','filters','intersection','model','attributes','length','nolimit'];(function(_0x560704,_0x46a20d){var _0x44812e=function(_0x1afe92){while(--_0x1afe92){_0x560704['push'](_0x560704['shift']());}};_0x44812e(++_0x46a20d);}(_0xa312,0x17c));var _0x2a31=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xa312[_0xdea41a];return _0x15d0d8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2a31('0x0'));var rimraf=require(_0x2a31('0x1'));var zipdir=require(_0x2a31('0x2'));var jsonpatch=require(_0x2a31('0x3'));var rp=require(_0x2a31('0x4'));var moment=require(_0x2a31('0x5'));var BPromise=require(_0x2a31('0x6'));var Mustache=require(_0x2a31('0x7'));var util=require(_0x2a31('0x8'));var path=require(_0x2a31('0x9'));var sox=require('sox');var csv=require(_0x2a31('0xa'));var ejs=require(_0x2a31('0xb'));var fs=require('fs');var _=require(_0x2a31('0xc'));var squel=require(_0x2a31('0xd'));var crypto=require(_0x2a31('0xe'));var jsforce=require(_0x2a31('0xf'));var deskjs=require(_0x2a31('0x10'));var toCsv=require(_0x2a31('0xa'));var querystring=require(_0x2a31('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2a31('0x12'));var qs=require(_0x2a31('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a31('0x14'));var logger=require('../../config/logger')(_0x2a31('0x15'));var utils=require(_0x2a31('0x16'));var config=require('../../config/environment');var db=require(_0x2a31('0x17'))['db'];var jayson=require(_0x2a31('0x18'));var client=jayson['client'][_0x2a31('0x19')]({'port':0x232a});function checkPasswordPattern(_0x111129,_0x7746a4,_0xee38d2){if(_0xee38d2){var _0x2a5285=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a5285[_0x2a31('0x1a')](_0x7746a4)){return _0x111129;}else{throw new db[(_0x2a31('0x1b'))]['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~!@#$%^&-_=+[{]}.');}}else{return _0x111129;}}function respondWithRpcPromise(_0x4361c2,_0x2b6930,_0x4b4384,_0x4941cc){return new BPromise(function(_0x53538d,_0x50c2be){var _0x4f758f=_0x4941cc||client;return _0x4f758f[_0x2a31('0x1c')](_0x4361c2,_0x4b4384)['then'](function(_0xf14fac){logger[_0x2a31('0x1d')](_0x2a31('0x1e'),_0x2b6930,'request\x20sent');logger[_0x2a31('0x1f')](_0x2a31('0x20'),_0x2b6930,_0x2a31('0x21'),JSON[_0x2a31('0x22')](_0xf14fac));if(_0xf14fac['error']){if(_0xf14fac['error']['code']===0x1f4){logger['error'](_0x2a31('0x1e'),_0x2b6930,_0xf14fac['error']['message']);return _0x50c2be(_0xf14fac[_0x2a31('0x23')][_0x2a31('0x24')]);}logger[_0x2a31('0x23')](_0x2a31('0x1e'),_0x2b6930,_0xf14fac[_0x2a31('0x23')][_0x2a31('0x24')]);return _0x53538d(_0xf14fac['error'][_0x2a31('0x24')]);}else{logger[_0x2a31('0x1d')](_0x2a31('0x1e'),_0x2b6930,'request\x20sent');_0x53538d(_0xf14fac[_0x2a31('0x25')][_0x2a31('0x24')]);}})['catch'](function(_0x4126f4){logger['error'](_0x2a31('0x1e'),_0x2b6930,_0x4126f4);_0x50c2be(_0x4126f4);});});}function respondWithStatusCode(_0x5e5e71,_0x4bfb36){_0x4bfb36=_0x4bfb36||0xcc;return function(_0x41d4fc){if(_0x41d4fc){return _0x5e5e71[_0x2a31('0x26')](_0x4bfb36);}return _0x5e5e71[_0x2a31('0x27')](_0x4bfb36)[_0x2a31('0x28')]();};}function respondWithResult(_0x5ed543,_0xbf539f){_0xbf539f=_0xbf539f||0xc8;return function(_0x267a9a){if(_0x267a9a){return _0x5ed543[_0x2a31('0x27')](_0xbf539f)[_0x2a31('0x29')](_0x267a9a);}};}function respondWithFilteredResult(_0x291d1a,_0x5cb9d8){return function(_0x1d707d){if(_0x1d707d){var _0x312698=_0x1d707d[_0x2a31('0x2a')],_0x2cc923=_0x5cb9d8[_0x2a31('0x2b')],_0x46c15b=_0x5cb9d8['offset']+_0x5cb9d8[_0x2a31('0x2c')],_0x195702;if(_0x46c15b>=_0x312698){_0x46c15b=_0x312698;_0x195702=0xc8;}else{_0x195702=0xce;}_0x291d1a['status'](_0x195702);return _0x291d1a['set']('Content-Range',_0x2cc923+'-'+_0x46c15b+'/'+_0x312698)['json'](_0x1d707d);}return null;};}function patchUpdates(_0x47a312){return function(_0x562c35){try{jsonpatch['apply'](_0x562c35,_0x47a312,!![]);}catch(_0xe22e4a){return BPromise[_0x2a31('0x2d')](_0xe22e4a);}return _0x562c35[_0x2a31('0x2e')]();};}function saveUpdates(_0x2abc52,_0x1dfe70){return function(_0x3bb163){if(_0x3bb163){return _0x3bb163[_0x2a31('0x2f')](_0x2abc52)[_0x2a31('0x30')](function(_0x4ac61f){return _0x4ac61f;});}return null;};}function removeEntity(_0x82a040,_0x414fe){return function(_0x56f848){if(_0x56f848){return _0x56f848[_0x2a31('0x31')]()[_0x2a31('0x30')](function(){_0x82a040[_0x2a31('0x27')](0xcc)[_0x2a31('0x28')]();});}};}function handleEntityNotFound(_0x44a4a3,_0x5dea58){return function(_0x10043d){if(!_0x10043d){_0x44a4a3['sendStatus'](0x194);}return _0x10043d;};}function handleError(_0x1259b3,_0x533990){_0x533990=_0x533990||0x1f4;return function(_0x43d149){logger[_0x2a31('0x23')](_0x43d149[_0x2a31('0x32')]);if(_0x43d149[_0x2a31('0x33')]){delete _0x43d149[_0x2a31('0x33')];}_0x1259b3['status'](_0x533990)[_0x2a31('0x34')](_0x43d149);};}exports[_0x2a31('0x35')]=function(_0x265e66,_0xfbc357){var _0x4c31fc={},_0x1344c9={},_0x556e26={'count':0x0,'rows':[]};var _0x319a1f=_[_0x2a31('0x36')](db[_0x2a31('0x37')]['rawAttributes'],function(_0x15100f){return{'name':_0x15100f['fieldName'],'type':_0x15100f[_0x2a31('0x38')]['key']};});_0x1344c9['model']=_[_0x2a31('0x36')](_0x319a1f,_0x2a31('0x33'));_0x1344c9['query']=_[_0x2a31('0x39')](_0x265e66[_0x2a31('0x3a')]);_0x1344c9[_0x2a31('0x3b')]=_[_0x2a31('0x3c')](_0x1344c9[_0x2a31('0x3d')],_0x1344c9[_0x2a31('0x3a')]);_0x4c31fc[_0x2a31('0x3e')]=_['intersection'](_0x1344c9[_0x2a31('0x3d')],qs['fields'](_0x265e66[_0x2a31('0x3a')]['fields']));_0x4c31fc['attributes']=_0x4c31fc[_0x2a31('0x3e')][_0x2a31('0x3f')]?_0x4c31fc['attributes']:_0x1344c9[_0x2a31('0x3d')];if(!_0x265e66[_0x2a31('0x3a')]['hasOwnProperty'](_0x2a31('0x40'))){_0x4c31fc[_0x2a31('0x2c')]=qs[_0x2a31('0x2c')](_0x265e66[_0x2a31('0x3a')][_0x2a31('0x2c')]);_0x4c31fc[_0x2a31('0x2b')]=qs[_0x2a31('0x2b')](_0x265e66[_0x2a31('0x3a')][_0x2a31('0x2b')]);}_0x4c31fc['order']=qs['sort'](_0x265e66[_0x2a31('0x3a')][_0x2a31('0x41')]);_0x4c31fc[_0x2a31('0x42')]=qs[_0x2a31('0x3b')](_[_0x2a31('0x43')](_0x265e66['query'],_0x1344c9[_0x2a31('0x3b')]),_0x319a1f);if(_0x265e66[_0x2a31('0x3a')][_0x2a31('0x44')]){_0x4c31fc[_0x2a31('0x42')]=_[_0x2a31('0x45')](_0x4c31fc[_0x2a31('0x42')],{'$or':_[_0x2a31('0x36')](_0x319a1f,function(_0xc505be){if(_0xc505be['type']!=='VIRTUAL'){var _0x1ab0c2={};_0x1ab0c2[_0xc505be[_0x2a31('0x33')]]={'$like':'%'+_0x265e66['query'][_0x2a31('0x44')]+'%'};return _0x1ab0c2;}})});}_0x4c31fc=_[_0x2a31('0x45')]({},_0x4c31fc,_0x265e66[_0x2a31('0x46')]);var _0x11894a={'where':_0x4c31fc[_0x2a31('0x42')]};return db[_0x2a31('0x37')][_0x2a31('0x2a')](_0x11894a)['then'](function(_0x438112){_0x556e26[_0x2a31('0x2a')]=_0x438112;if(_0x265e66[_0x2a31('0x3a')][_0x2a31('0x47')]){_0x4c31fc[_0x2a31('0x48')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x2a31('0x49')](_0x4c31fc);})['then'](function(_0x198fad){_0x556e26['rows']=_0x198fad;return _0x556e26;})[_0x2a31('0x30')](respondWithFilteredResult(_0xfbc357,_0x4c31fc))[_0x2a31('0x4a')](handleError(_0xfbc357,null));};exports[_0x2a31('0x4b')]=function(_0x2d5801,_0x47e278){var _0x10df14={'raw':![],'where':{'id':_0x2d5801[_0x2a31('0x4c')]['id']}},_0x39e8a2={};_0x39e8a2[_0x2a31('0x3d')]=_[_0x2a31('0x39')](db[_0x2a31('0x37')][_0x2a31('0x4d')]);_0x39e8a2[_0x2a31('0x3a')]=_['keys'](_0x2d5801[_0x2a31('0x3a')]);_0x39e8a2[_0x2a31('0x3b')]=_[_0x2a31('0x3c')](_0x39e8a2[_0x2a31('0x3d')],_0x39e8a2[_0x2a31('0x3a')]);_0x10df14[_0x2a31('0x3e')]=_[_0x2a31('0x3c')](_0x39e8a2[_0x2a31('0x3d')],qs[_0x2a31('0x4e')](_0x2d5801[_0x2a31('0x3a')]['fields']));_0x10df14['attributes']=_0x10df14[_0x2a31('0x3e')][_0x2a31('0x3f')]?_0x10df14[_0x2a31('0x3e')]:_0x39e8a2[_0x2a31('0x3d')];if(_0x2d5801[_0x2a31('0x3a')][_0x2a31('0x47')]){_0x10df14['include']=[{'all':!![]}];}_0x10df14=_[_0x2a31('0x45')]({},_0x10df14,_0x2d5801[_0x2a31('0x46')]);return db[_0x2a31('0x37')][_0x2a31('0x4f')](_0x10df14)[_0x2a31('0x30')](handleEntityNotFound(_0x47e278,null))[_0x2a31('0x30')](respondWithResult(_0x47e278,null))[_0x2a31('0x4a')](handleError(_0x47e278,null));};exports['create']=function(_0x593e57,_0x1f696b){return db['FreshsalesConfiguration'][_0x2a31('0x50')](_0x593e57[_0x2a31('0x51')],{})['then'](respondWithResult(_0x1f696b,0xc9))[_0x2a31('0x4a')](handleError(_0x1f696b,null));};exports['update']=function(_0xfbc39b,_0x45b4f5){if(_0xfbc39b['body']['id']){delete _0xfbc39b[_0x2a31('0x51')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0xfbc39b[_0x2a31('0x4c')]['id']}})['then'](handleEntityNotFound(_0x45b4f5,null))[_0x2a31('0x30')](saveUpdates(_0xfbc39b['body'],null))[_0x2a31('0x30')](respondWithResult(_0x45b4f5,null))['catch'](handleError(_0x45b4f5,null));};exports['destroy']=function(_0x8c43ab,_0x34c24d){return db[_0x2a31('0x37')][_0x2a31('0x4f')]({'where':{'id':_0x8c43ab['params']['id']}})['then'](handleEntityNotFound(_0x34c24d,null))[_0x2a31('0x30')](removeEntity(_0x34c24d,null))['catch'](handleError(_0x34c24d,null));};exports['getSubjects']=function(_0x41ab35,_0x2d9795,_0x5463d6){var _0x27b893={};var _0x3328d6={};var _0x54122e;var _0x53a430;return db['FreshsalesConfiguration'][_0x2a31('0x52')]({'where':{'id':_0x41ab35[_0x2a31('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2d9795,null))[_0x2a31('0x30')](function(_0x4ce4ec){if(_0x4ce4ec){_0x54122e=_0x4ce4ec;_0x3328d6[_0x2a31('0x3d')]=_[_0x2a31('0x39')](db[_0x2a31('0x53')][_0x2a31('0x4d')]);_0x3328d6[_0x2a31('0x3a')]=_[_0x2a31('0x39')](_0x41ab35[_0x2a31('0x3a')]);_0x3328d6[_0x2a31('0x3b')]=_['intersection'](_0x3328d6['model'],_0x3328d6[_0x2a31('0x3a')]);_0x27b893[_0x2a31('0x3e')]=_[_0x2a31('0x3c')](_0x3328d6[_0x2a31('0x3d')],qs[_0x2a31('0x4e')](_0x41ab35['query'][_0x2a31('0x4e')]));_0x27b893['attributes']=_0x27b893[_0x2a31('0x3e')][_0x2a31('0x3f')]?_0x27b893[_0x2a31('0x3e')]:_0x3328d6[_0x2a31('0x3d')];_0x27b893['order']=qs['sort'](_0x41ab35['query'][_0x2a31('0x41')]);_0x27b893[_0x2a31('0x42')]=qs[_0x2a31('0x3b')](_['pick'](_0x41ab35['query'],_0x3328d6[_0x2a31('0x3b')]));if(_0x41ab35[_0x2a31('0x3a')]['filter']){_0x27b893[_0x2a31('0x42')]=_[_0x2a31('0x45')](_0x27b893['where'],{'$or':_[_0x2a31('0x36')](_0x27b893['attributes'],function(_0x14c0a8){var _0x45f951={};_0x45f951[_0x14c0a8]={'$like':'%'+_0x41ab35[_0x2a31('0x3a')][_0x2a31('0x44')]+'%'};return _0x45f951;})});}_0x27b893=_[_0x2a31('0x45')]({},_0x27b893,_0x41ab35[_0x2a31('0x46')]);return _0x54122e['getSubjects'](_0x27b893);}})['then'](function(_0x313d37){if(_0x313d37){_0x53a430=_0x313d37[_0x2a31('0x3f')];if(!_0x41ab35[_0x2a31('0x3a')]['hasOwnProperty'](_0x2a31('0x40'))){_0x27b893[_0x2a31('0x2c')]=qs['limit'](_0x41ab35['query'][_0x2a31('0x2c')]);_0x27b893['offset']=qs[_0x2a31('0x2b')](_0x41ab35[_0x2a31('0x3a')][_0x2a31('0x2b')]);}return _0x54122e[_0x2a31('0x54')](_0x27b893);}})[_0x2a31('0x30')](function(_0x254507){if(_0x254507){return _0x254507?{'count':_0x53a430,'rows':_0x254507}:null;}})[_0x2a31('0x30')](respondWithResult(_0x2d9795,null))[_0x2a31('0x4a')](handleError(_0x2d9795,null));};exports[_0x2a31('0x55')]=function(_0xdf5ac4,_0x530723,_0x1e4b59){var _0x1ebd07={};var _0x3d673c={};var _0x355507;var _0x5ad25a;return db[_0x2a31('0x37')]['findOne']({'where':{'id':_0xdf5ac4[_0x2a31('0x4c')]['id']}})[_0x2a31('0x30')](handleEntityNotFound(_0x530723,null))['then'](function(_0x35584c){if(_0x35584c){_0x355507=_0x35584c;_0x3d673c[_0x2a31('0x3d')]=_[_0x2a31('0x39')](db[_0x2a31('0x53')][_0x2a31('0x4d')]);_0x3d673c[_0x2a31('0x3a')]=_['keys'](_0xdf5ac4['query']);_0x3d673c[_0x2a31('0x3b')]=_['intersection'](_0x3d673c['model'],_0x3d673c[_0x2a31('0x3a')]);_0x1ebd07[_0x2a31('0x3e')]=_[_0x2a31('0x3c')](_0x3d673c[_0x2a31('0x3d')],qs[_0x2a31('0x4e')](_0xdf5ac4['query'][_0x2a31('0x4e')]));_0x1ebd07[_0x2a31('0x3e')]=_0x1ebd07['attributes']['length']?_0x1ebd07['attributes']:_0x3d673c['model'];_0x1ebd07['order']=qs[_0x2a31('0x41')](_0xdf5ac4[_0x2a31('0x3a')][_0x2a31('0x41')]);_0x1ebd07['where']=qs[_0x2a31('0x3b')](_[_0x2a31('0x43')](_0xdf5ac4[_0x2a31('0x3a')],_0x3d673c['filters']));if(_0xdf5ac4[_0x2a31('0x3a')][_0x2a31('0x44')]){_0x1ebd07['where']=_[_0x2a31('0x45')](_0x1ebd07['where'],{'$or':_[_0x2a31('0x36')](_0x1ebd07['attributes'],function(_0x408e92){var _0x23d0be={};_0x23d0be[_0x408e92]={'$like':'%'+_0xdf5ac4[_0x2a31('0x3a')][_0x2a31('0x44')]+'%'};return _0x23d0be;})});}_0x1ebd07=_['merge']({},_0x1ebd07,_0xdf5ac4['options']);return _0x355507['getDescriptions'](_0x1ebd07);}})[_0x2a31('0x30')](function(_0x45089e){if(_0x45089e){_0x5ad25a=_0x45089e['length'];if(!_0xdf5ac4[_0x2a31('0x3a')]['hasOwnProperty'](_0x2a31('0x40'))){_0x1ebd07[_0x2a31('0x2c')]=qs['limit'](_0xdf5ac4[_0x2a31('0x3a')][_0x2a31('0x2c')]);_0x1ebd07[_0x2a31('0x2b')]=qs['offset'](_0xdf5ac4[_0x2a31('0x3a')][_0x2a31('0x2b')]);}return _0x355507[_0x2a31('0x55')](_0x1ebd07);}})['then'](function(_0x5aaa00){if(_0x5aaa00){return _0x5aaa00?{'count':_0x5ad25a,'rows':_0x5aaa00}:null;}})[_0x2a31('0x30')](respondWithResult(_0x530723,null))[_0x2a31('0x4a')](handleError(_0x530723,null));};exports[_0x2a31('0x56')]=function(_0x1f7462,_0x5b0f11,_0x31d17a){var _0x3cf66f={};var _0x154a6f={};var _0x31a71f;var _0x583ffb;return db[_0x2a31('0x37')][_0x2a31('0x52')]({'where':{'id':_0x1f7462[_0x2a31('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5b0f11,null))[_0x2a31('0x30')](function(_0x1528cf){if(_0x1528cf){_0x31a71f=_0x1528cf;_0x154a6f[_0x2a31('0x3d')]=_[_0x2a31('0x39')](db[_0x2a31('0x53')][_0x2a31('0x4d')]);_0x154a6f[_0x2a31('0x3a')]=_[_0x2a31('0x39')](_0x1f7462[_0x2a31('0x3a')]);_0x154a6f['filters']=_['intersection'](_0x154a6f[_0x2a31('0x3d')],_0x154a6f[_0x2a31('0x3a')]);_0x3cf66f[_0x2a31('0x3e')]=_[_0x2a31('0x3c')](_0x154a6f[_0x2a31('0x3d')],qs[_0x2a31('0x4e')](_0x1f7462[_0x2a31('0x3a')]['fields']));_0x3cf66f[_0x2a31('0x3e')]=_0x3cf66f['attributes'][_0x2a31('0x3f')]?_0x3cf66f[_0x2a31('0x3e')]:_0x154a6f[_0x2a31('0x3d')];_0x3cf66f[_0x2a31('0x57')]=qs[_0x2a31('0x41')](_0x1f7462['query'][_0x2a31('0x41')]);_0x3cf66f[_0x2a31('0x42')]=qs['filters'](_[_0x2a31('0x43')](_0x1f7462[_0x2a31('0x3a')],_0x154a6f[_0x2a31('0x3b')]));if(_0x1f7462[_0x2a31('0x3a')][_0x2a31('0x44')]){_0x3cf66f[_0x2a31('0x42')]=_[_0x2a31('0x45')](_0x3cf66f[_0x2a31('0x42')],{'$or':_[_0x2a31('0x36')](_0x3cf66f[_0x2a31('0x3e')],function(_0x4859f8){var _0x1df0b5={};_0x1df0b5[_0x4859f8]={'$like':'%'+_0x1f7462['query'][_0x2a31('0x44')]+'%'};return _0x1df0b5;})});}_0x3cf66f=_[_0x2a31('0x45')]({},_0x3cf66f,_0x1f7462['options']);return _0x31a71f[_0x2a31('0x56')](_0x3cf66f);}})[_0x2a31('0x30')](function(_0x428695){if(_0x428695){_0x583ffb=_0x428695[_0x2a31('0x3f')];if(!_0x1f7462['query'][_0x2a31('0x58')]('nolimit')){_0x3cf66f[_0x2a31('0x2c')]=qs[_0x2a31('0x2c')](_0x1f7462[_0x2a31('0x3a')]['limit']);_0x3cf66f[_0x2a31('0x2b')]=qs[_0x2a31('0x2b')](_0x1f7462[_0x2a31('0x3a')][_0x2a31('0x2b')]);}return _0x31a71f[_0x2a31('0x56')](_0x3cf66f);}})[_0x2a31('0x30')](function(_0x1fce6c){if(_0x1fce6c){return _0x1fce6c?{'count':_0x583ffb,'rows':_0x1fce6c}:null;}})['then'](respondWithResult(_0x5b0f11,null))[_0x2a31('0x4a')](handleError(_0x5b0f11,null));}; \ No newline at end of file +var _0xd6b6=['desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','apply','reject','update','destroy','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','type','filter','includeAll','findAll','rows','params','include','options','find','create','body','getSubjects','findOne','getDescriptions','FreshsalesField','order','hasOwnProperty','getFields','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','crypto','jsforce'];(function(_0x4458e4,_0x119760){var _0x2e1f7=function(_0x4e02f9){while(--_0x4e02f9){_0x4458e4['push'](_0x4458e4['shift']());}};_0x2e1f7(++_0x119760);}(_0xd6b6,0x158));var _0x6d6b=function(_0x341bf7,_0x2f76d3){_0x341bf7=_0x341bf7-0x0;var _0x3cf419=_0xd6b6[_0x341bf7];return _0x3cf419;};'use strict';var pdf=require(_0x6d6b('0x0'));var emlformat=require(_0x6d6b('0x1'));var rimraf=require(_0x6d6b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d6b('0x3'));var rp=require(_0x6d6b('0x4'));var moment=require('moment');var BPromise=require(_0x6d6b('0x5'));var Mustache=require(_0x6d6b('0x6'));var util=require('util');var path=require(_0x6d6b('0x7'));var sox=require(_0x6d6b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6d6b('0x9'));var squel=require('squel');var crypto=require(_0x6d6b('0xa'));var jsforce=require(_0x6d6b('0xb'));var deskjs=require(_0x6d6b('0xc'));var toCsv=require(_0x6d6b('0xd'));var querystring=require(_0x6d6b('0xe'));var Papa=require(_0x6d6b('0xf'));var Redis=require('ioredis');var authService=require(_0x6d6b('0x10'));var qs=require(_0x6d6b('0x11'));var as=require(_0x6d6b('0x12'));var hardwareService=require(_0x6d6b('0x13'));var logger=require('../../config/logger')(_0x6d6b('0x14'));var utils=require(_0x6d6b('0x15'));var config=require(_0x6d6b('0x16'));var db=require(_0x6d6b('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x6d6b('0x18')]({'port':0x232a});function checkPasswordPattern(_0x56675f,_0x5ca96a,_0x138ad2){if(_0x138ad2){var _0x39b1eb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x39b1eb[_0x6d6b('0x19')](_0x5ca96a)){return _0x56675f;}else{throw new db[(_0x6d6b('0x1a'))]['ValidationError'](_0x6d6b('0x1b'));}}else{return _0x56675f;}}function respondWithRpcPromise(_0x4542c5,_0x3478dc,_0xb7b214,_0x386e9d){return new BPromise(function(_0x740cf3,_0x2ad7b0){var _0x56bf25=_0x386e9d||client;return _0x56bf25[_0x6d6b('0x1c')](_0x4542c5,_0xb7b214)[_0x6d6b('0x1d')](function(_0x3631c8){logger[_0x6d6b('0x1e')](_0x6d6b('0x1f'),_0x3478dc,'request\x20sent');logger[_0x6d6b('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x3478dc,_0x6d6b('0x21'),JSON[_0x6d6b('0x22')](_0x3631c8));if(_0x3631c8[_0x6d6b('0x23')]){if(_0x3631c8[_0x6d6b('0x23')][_0x6d6b('0x24')]===0x1f4){logger['error'](_0x6d6b('0x1f'),_0x3478dc,_0x3631c8[_0x6d6b('0x23')]['message']);return _0x2ad7b0(_0x3631c8['error'][_0x6d6b('0x25')]);}logger[_0x6d6b('0x23')](_0x6d6b('0x1f'),_0x3478dc,_0x3631c8[_0x6d6b('0x23')]['message']);return _0x740cf3(_0x3631c8['error'][_0x6d6b('0x25')]);}else{logger[_0x6d6b('0x1e')](_0x6d6b('0x1f'),_0x3478dc,_0x6d6b('0x21'));_0x740cf3(_0x3631c8[_0x6d6b('0x26')][_0x6d6b('0x25')]);}})[_0x6d6b('0x27')](function(_0x428ed7){logger[_0x6d6b('0x23')](_0x6d6b('0x1f'),_0x3478dc,_0x428ed7);_0x2ad7b0(_0x428ed7);});});}function respondWithStatusCode(_0x3ed0c0,_0x552814){_0x552814=_0x552814||0xcc;return function(_0x54b227){if(_0x54b227){return _0x3ed0c0[_0x6d6b('0x28')](_0x552814);}return _0x3ed0c0[_0x6d6b('0x29')](_0x552814)['end']();};}function respondWithResult(_0x456a08,_0x5626cc){_0x5626cc=_0x5626cc||0xc8;return function(_0xcd3d9f){if(_0xcd3d9f){return _0x456a08['status'](_0x5626cc)[_0x6d6b('0x2a')](_0xcd3d9f);}};}function respondWithFilteredResult(_0x5dbd86,_0x1c6538){return function(_0xb8a391){if(_0xb8a391){var _0x19bbf1=_0xb8a391[_0x6d6b('0x2b')],_0x5e2604=_0x1c6538[_0x6d6b('0x2c')],_0x508836=_0x1c6538[_0x6d6b('0x2c')]+_0x1c6538[_0x6d6b('0x2d')],_0x3030fc;if(_0x508836>=_0x19bbf1){_0x508836=_0x19bbf1;_0x3030fc=0xc8;}else{_0x3030fc=0xce;}_0x5dbd86['status'](_0x3030fc);return _0x5dbd86['set']('Content-Range',_0x5e2604+'-'+_0x508836+'/'+_0x19bbf1)[_0x6d6b('0x2a')](_0xb8a391);}return null;};}function patchUpdates(_0x51e102){return function(_0x708620){try{jsonpatch[_0x6d6b('0x2e')](_0x708620,_0x51e102,!![]);}catch(_0x59d16b){return BPromise[_0x6d6b('0x2f')](_0x59d16b);}return _0x708620['save']();};}function saveUpdates(_0x1b6d34,_0x304ca2){return function(_0x47c58a){if(_0x47c58a){return _0x47c58a[_0x6d6b('0x30')](_0x1b6d34)[_0x6d6b('0x1d')](function(_0x30f037){return _0x30f037;});}return null;};}function removeEntity(_0x37458d,_0x5cd587){return function(_0x304e22){if(_0x304e22){return _0x304e22[_0x6d6b('0x31')]()['then'](function(){_0x37458d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18df6f,_0xf19ea){return function(_0x39fd36){if(!_0x39fd36){_0x18df6f[_0x6d6b('0x28')](0x194);}return _0x39fd36;};}function handleError(_0x2266e5,_0x1bb631){_0x1bb631=_0x1bb631||0x1f4;return function(_0x161ec6){logger['error'](_0x161ec6['stack']);if(_0x161ec6['name']){delete _0x161ec6[_0x6d6b('0x32')];}_0x2266e5['status'](_0x1bb631)[_0x6d6b('0x33')](_0x161ec6);};}exports[_0x6d6b('0x34')]=function(_0x27e447,_0x4fe236){var _0xa068de={},_0x31c340={},_0x31ff5f={'count':0x0,'rows':[]};var _0x28fe9e=_[_0x6d6b('0x35')](db[_0x6d6b('0x36')][_0x6d6b('0x37')],function(_0x3899ac){return{'name':_0x3899ac[_0x6d6b('0x38')],'type':_0x3899ac['type'][_0x6d6b('0x39')]};});_0x31c340[_0x6d6b('0x3a')]=_[_0x6d6b('0x35')](_0x28fe9e,'name');_0x31c340[_0x6d6b('0x3b')]=_[_0x6d6b('0x3c')](_0x27e447[_0x6d6b('0x3b')]);_0x31c340[_0x6d6b('0x3d')]=_[_0x6d6b('0x3e')](_0x31c340[_0x6d6b('0x3a')],_0x31c340['query']);_0xa068de[_0x6d6b('0x3f')]=_['intersection'](_0x31c340['model'],qs[_0x6d6b('0x40')](_0x27e447['query'][_0x6d6b('0x40')]));_0xa068de[_0x6d6b('0x3f')]=_0xa068de[_0x6d6b('0x3f')][_0x6d6b('0x41')]?_0xa068de[_0x6d6b('0x3f')]:_0x31c340[_0x6d6b('0x3a')];if(!_0x27e447['query']['hasOwnProperty'](_0x6d6b('0x42'))){_0xa068de['limit']=qs[_0x6d6b('0x2d')](_0x27e447[_0x6d6b('0x3b')]['limit']);_0xa068de[_0x6d6b('0x2c')]=qs[_0x6d6b('0x2c')](_0x27e447[_0x6d6b('0x3b')][_0x6d6b('0x2c')]);}_0xa068de['order']=qs[_0x6d6b('0x43')](_0x27e447['query']['sort']);_0xa068de[_0x6d6b('0x44')]=qs[_0x6d6b('0x3d')](_[_0x6d6b('0x45')](_0x27e447[_0x6d6b('0x3b')],_0x31c340['filters']),_0x28fe9e);if(_0x27e447[_0x6d6b('0x3b')]['filter']){_0xa068de[_0x6d6b('0x44')]=_[_0x6d6b('0x46')](_0xa068de['where'],{'$or':_[_0x6d6b('0x35')](_0x28fe9e,function(_0x4ff879){if(_0x4ff879[_0x6d6b('0x47')]!=='VIRTUAL'){var _0x49daf3={};_0x49daf3[_0x4ff879[_0x6d6b('0x32')]]={'$like':'%'+_0x27e447[_0x6d6b('0x3b')][_0x6d6b('0x48')]+'%'};return _0x49daf3;}})});}_0xa068de=_[_0x6d6b('0x46')]({},_0xa068de,_0x27e447['options']);var _0x3e1a7a={'where':_0xa068de[_0x6d6b('0x44')]};return db['FreshsalesConfiguration'][_0x6d6b('0x2b')](_0x3e1a7a)[_0x6d6b('0x1d')](function(_0x42a8bb){_0x31ff5f[_0x6d6b('0x2b')]=_0x42a8bb;if(_0x27e447[_0x6d6b('0x3b')][_0x6d6b('0x49')]){_0xa068de['include']=[{'all':!![]}];}return db[_0x6d6b('0x36')][_0x6d6b('0x4a')](_0xa068de);})['then'](function(_0x2d304b){_0x31ff5f[_0x6d6b('0x4b')]=_0x2d304b;return _0x31ff5f;})[_0x6d6b('0x1d')](respondWithFilteredResult(_0x4fe236,_0xa068de))[_0x6d6b('0x27')](handleError(_0x4fe236,null));};exports['show']=function(_0x4a5d21,_0x5bd4eb){var _0x5e11fe={'raw':![],'where':{'id':_0x4a5d21[_0x6d6b('0x4c')]['id']}},_0x565bdd={};_0x565bdd['model']=_[_0x6d6b('0x3c')](db['FreshsalesConfiguration'][_0x6d6b('0x37')]);_0x565bdd[_0x6d6b('0x3b')]=_[_0x6d6b('0x3c')](_0x4a5d21[_0x6d6b('0x3b')]);_0x565bdd[_0x6d6b('0x3d')]=_[_0x6d6b('0x3e')](_0x565bdd[_0x6d6b('0x3a')],_0x565bdd[_0x6d6b('0x3b')]);_0x5e11fe['attributes']=_[_0x6d6b('0x3e')](_0x565bdd['model'],qs[_0x6d6b('0x40')](_0x4a5d21[_0x6d6b('0x3b')][_0x6d6b('0x40')]));_0x5e11fe['attributes']=_0x5e11fe[_0x6d6b('0x3f')][_0x6d6b('0x41')]?_0x5e11fe['attributes']:_0x565bdd[_0x6d6b('0x3a')];if(_0x4a5d21[_0x6d6b('0x3b')][_0x6d6b('0x49')]){_0x5e11fe[_0x6d6b('0x4d')]=[{'all':!![]}];}_0x5e11fe=_[_0x6d6b('0x46')]({},_0x5e11fe,_0x4a5d21[_0x6d6b('0x4e')]);return db[_0x6d6b('0x36')][_0x6d6b('0x4f')](_0x5e11fe)[_0x6d6b('0x1d')](handleEntityNotFound(_0x5bd4eb,null))[_0x6d6b('0x1d')](respondWithResult(_0x5bd4eb,null))['catch'](handleError(_0x5bd4eb,null));};exports[_0x6d6b('0x50')]=function(_0x2fd0a4,_0x350fb){return db[_0x6d6b('0x36')]['create'](_0x2fd0a4['body'],{})[_0x6d6b('0x1d')](respondWithResult(_0x350fb,0xc9))['catch'](handleError(_0x350fb,null));};exports[_0x6d6b('0x30')]=function(_0x494bb1,_0x50a576){if(_0x494bb1[_0x6d6b('0x51')]['id']){delete _0x494bb1['body']['id'];}return db[_0x6d6b('0x36')][_0x6d6b('0x4f')]({'where':{'id':_0x494bb1[_0x6d6b('0x4c')]['id']}})[_0x6d6b('0x1d')](handleEntityNotFound(_0x50a576,null))[_0x6d6b('0x1d')](saveUpdates(_0x494bb1[_0x6d6b('0x51')],null))[_0x6d6b('0x1d')](respondWithResult(_0x50a576,null))[_0x6d6b('0x27')](handleError(_0x50a576,null));};exports[_0x6d6b('0x31')]=function(_0x8cd003,_0x35e488){return db[_0x6d6b('0x36')][_0x6d6b('0x4f')]({'where':{'id':_0x8cd003['params']['id']}})[_0x6d6b('0x1d')](handleEntityNotFound(_0x35e488,null))[_0x6d6b('0x1d')](removeEntity(_0x35e488,null))[_0x6d6b('0x27')](handleError(_0x35e488,null));};exports[_0x6d6b('0x52')]=function(_0x62c834,_0x1752fb,_0x4def9b){var _0x2e8a3f={};var _0x5e7fae={};var _0x44abdd;var _0x199df0;return db['FreshsalesConfiguration'][_0x6d6b('0x53')]({'where':{'id':_0x62c834[_0x6d6b('0x4c')]['id']}})[_0x6d6b('0x1d')](handleEntityNotFound(_0x1752fb,null))[_0x6d6b('0x1d')](function(_0x340717){if(_0x340717){_0x44abdd=_0x340717;_0x5e7fae[_0x6d6b('0x3a')]=_[_0x6d6b('0x3c')](db['FreshsalesField'][_0x6d6b('0x37')]);_0x5e7fae['query']=_[_0x6d6b('0x3c')](_0x62c834['query']);_0x5e7fae[_0x6d6b('0x3d')]=_[_0x6d6b('0x3e')](_0x5e7fae[_0x6d6b('0x3a')],_0x5e7fae[_0x6d6b('0x3b')]);_0x2e8a3f[_0x6d6b('0x3f')]=_[_0x6d6b('0x3e')](_0x5e7fae['model'],qs['fields'](_0x62c834['query'][_0x6d6b('0x40')]));_0x2e8a3f[_0x6d6b('0x3f')]=_0x2e8a3f[_0x6d6b('0x3f')][_0x6d6b('0x41')]?_0x2e8a3f[_0x6d6b('0x3f')]:_0x5e7fae[_0x6d6b('0x3a')];_0x2e8a3f['order']=qs['sort'](_0x62c834[_0x6d6b('0x3b')][_0x6d6b('0x43')]);_0x2e8a3f[_0x6d6b('0x44')]=qs[_0x6d6b('0x3d')](_[_0x6d6b('0x45')](_0x62c834[_0x6d6b('0x3b')],_0x5e7fae[_0x6d6b('0x3d')]));if(_0x62c834[_0x6d6b('0x3b')]['filter']){_0x2e8a3f[_0x6d6b('0x44')]=_[_0x6d6b('0x46')](_0x2e8a3f[_0x6d6b('0x44')],{'$or':_[_0x6d6b('0x35')](_0x2e8a3f[_0x6d6b('0x3f')],function(_0x1b944f){var _0x1ff9bb={};_0x1ff9bb[_0x1b944f]={'$like':'%'+_0x62c834['query'][_0x6d6b('0x48')]+'%'};return _0x1ff9bb;})});}_0x2e8a3f=_['merge']({},_0x2e8a3f,_0x62c834['options']);return _0x44abdd['getSubjects'](_0x2e8a3f);}})[_0x6d6b('0x1d')](function(_0x10f18e){if(_0x10f18e){_0x199df0=_0x10f18e[_0x6d6b('0x41')];if(!_0x62c834['query']['hasOwnProperty'](_0x6d6b('0x42'))){_0x2e8a3f[_0x6d6b('0x2d')]=qs[_0x6d6b('0x2d')](_0x62c834[_0x6d6b('0x3b')]['limit']);_0x2e8a3f[_0x6d6b('0x2c')]=qs[_0x6d6b('0x2c')](_0x62c834[_0x6d6b('0x3b')][_0x6d6b('0x2c')]);}return _0x44abdd[_0x6d6b('0x52')](_0x2e8a3f);}})['then'](function(_0x17d64c){if(_0x17d64c){return _0x17d64c?{'count':_0x199df0,'rows':_0x17d64c}:null;}})['then'](respondWithResult(_0x1752fb,null))[_0x6d6b('0x27')](handleError(_0x1752fb,null));};exports[_0x6d6b('0x54')]=function(_0x4438ac,_0x32eb62,_0x2acd68){var _0x5730a0={};var _0x1aaa7f={};var _0x4e1a8d;var _0x2c1eef;return db[_0x6d6b('0x36')][_0x6d6b('0x53')]({'where':{'id':_0x4438ac[_0x6d6b('0x4c')]['id']}})[_0x6d6b('0x1d')](handleEntityNotFound(_0x32eb62,null))[_0x6d6b('0x1d')](function(_0x2908ff){if(_0x2908ff){_0x4e1a8d=_0x2908ff;_0x1aaa7f[_0x6d6b('0x3a')]=_[_0x6d6b('0x3c')](db[_0x6d6b('0x55')][_0x6d6b('0x37')]);_0x1aaa7f[_0x6d6b('0x3b')]=_[_0x6d6b('0x3c')](_0x4438ac[_0x6d6b('0x3b')]);_0x1aaa7f['filters']=_[_0x6d6b('0x3e')](_0x1aaa7f[_0x6d6b('0x3a')],_0x1aaa7f[_0x6d6b('0x3b')]);_0x5730a0[_0x6d6b('0x3f')]=_[_0x6d6b('0x3e')](_0x1aaa7f[_0x6d6b('0x3a')],qs[_0x6d6b('0x40')](_0x4438ac[_0x6d6b('0x3b')][_0x6d6b('0x40')]));_0x5730a0[_0x6d6b('0x3f')]=_0x5730a0[_0x6d6b('0x3f')][_0x6d6b('0x41')]?_0x5730a0[_0x6d6b('0x3f')]:_0x1aaa7f[_0x6d6b('0x3a')];_0x5730a0[_0x6d6b('0x56')]=qs[_0x6d6b('0x43')](_0x4438ac[_0x6d6b('0x3b')][_0x6d6b('0x43')]);_0x5730a0[_0x6d6b('0x44')]=qs[_0x6d6b('0x3d')](_[_0x6d6b('0x45')](_0x4438ac[_0x6d6b('0x3b')],_0x1aaa7f['filters']));if(_0x4438ac[_0x6d6b('0x3b')]['filter']){_0x5730a0['where']=_[_0x6d6b('0x46')](_0x5730a0[_0x6d6b('0x44')],{'$or':_[_0x6d6b('0x35')](_0x5730a0[_0x6d6b('0x3f')],function(_0x2896cc){var _0x1c7396={};_0x1c7396[_0x2896cc]={'$like':'%'+_0x4438ac['query'][_0x6d6b('0x48')]+'%'};return _0x1c7396;})});}_0x5730a0=_[_0x6d6b('0x46')]({},_0x5730a0,_0x4438ac['options']);return _0x4e1a8d[_0x6d6b('0x54')](_0x5730a0);}})['then'](function(_0x2017e6){if(_0x2017e6){_0x2c1eef=_0x2017e6['length'];if(!_0x4438ac[_0x6d6b('0x3b')][_0x6d6b('0x57')](_0x6d6b('0x42'))){_0x5730a0['limit']=qs[_0x6d6b('0x2d')](_0x4438ac[_0x6d6b('0x3b')][_0x6d6b('0x2d')]);_0x5730a0[_0x6d6b('0x2c')]=qs[_0x6d6b('0x2c')](_0x4438ac[_0x6d6b('0x3b')][_0x6d6b('0x2c')]);}return _0x4e1a8d[_0x6d6b('0x54')](_0x5730a0);}})[_0x6d6b('0x1d')](function(_0x51572b){if(_0x51572b){return _0x51572b?{'count':_0x2c1eef,'rows':_0x51572b}:null;}})[_0x6d6b('0x1d')](respondWithResult(_0x32eb62,null))[_0x6d6b('0x27')](handleError(_0x32eb62,null));};exports[_0x6d6b('0x58')]=function(_0x5a0cb3,_0x145464,_0x45d838){var _0x410cef={};var _0x4007ff={};var _0x3a3441;var _0x2f2928;return db[_0x6d6b('0x36')][_0x6d6b('0x53')]({'where':{'id':_0x5a0cb3[_0x6d6b('0x4c')]['id']}})[_0x6d6b('0x1d')](handleEntityNotFound(_0x145464,null))[_0x6d6b('0x1d')](function(_0x797ea0){if(_0x797ea0){_0x3a3441=_0x797ea0;_0x4007ff[_0x6d6b('0x3a')]=_[_0x6d6b('0x3c')](db[_0x6d6b('0x55')][_0x6d6b('0x37')]);_0x4007ff[_0x6d6b('0x3b')]=_[_0x6d6b('0x3c')](_0x5a0cb3[_0x6d6b('0x3b')]);_0x4007ff[_0x6d6b('0x3d')]=_[_0x6d6b('0x3e')](_0x4007ff['model'],_0x4007ff[_0x6d6b('0x3b')]);_0x410cef[_0x6d6b('0x3f')]=_['intersection'](_0x4007ff['model'],qs['fields'](_0x5a0cb3[_0x6d6b('0x3b')][_0x6d6b('0x40')]));_0x410cef['attributes']=_0x410cef[_0x6d6b('0x3f')][_0x6d6b('0x41')]?_0x410cef[_0x6d6b('0x3f')]:_0x4007ff[_0x6d6b('0x3a')];_0x410cef[_0x6d6b('0x56')]=qs[_0x6d6b('0x43')](_0x5a0cb3[_0x6d6b('0x3b')]['sort']);_0x410cef['where']=qs['filters'](_[_0x6d6b('0x45')](_0x5a0cb3['query'],_0x4007ff[_0x6d6b('0x3d')]));if(_0x5a0cb3[_0x6d6b('0x3b')][_0x6d6b('0x48')]){_0x410cef[_0x6d6b('0x44')]=_[_0x6d6b('0x46')](_0x410cef[_0x6d6b('0x44')],{'$or':_[_0x6d6b('0x35')](_0x410cef[_0x6d6b('0x3f')],function(_0x15f670){var _0x58f221={};_0x58f221[_0x15f670]={'$like':'%'+_0x5a0cb3[_0x6d6b('0x3b')][_0x6d6b('0x48')]+'%'};return _0x58f221;})});}_0x410cef=_['merge']({},_0x410cef,_0x5a0cb3[_0x6d6b('0x4e')]);return _0x3a3441[_0x6d6b('0x58')](_0x410cef);}})[_0x6d6b('0x1d')](function(_0x53f6f6){if(_0x53f6f6){_0x2f2928=_0x53f6f6[_0x6d6b('0x41')];if(!_0x5a0cb3[_0x6d6b('0x3b')][_0x6d6b('0x57')](_0x6d6b('0x42'))){_0x410cef[_0x6d6b('0x2d')]=qs[_0x6d6b('0x2d')](_0x5a0cb3[_0x6d6b('0x3b')]['limit']);_0x410cef[_0x6d6b('0x2c')]=qs[_0x6d6b('0x2c')](_0x5a0cb3[_0x6d6b('0x3b')][_0x6d6b('0x2c')]);}return _0x3a3441['getFields'](_0x410cef);}})[_0x6d6b('0x1d')](function(_0x722514){if(_0x722514){return _0x722514?{'count':_0x2f2928,'rows':_0x722514}:null;}})[_0x6d6b('0x1d')](respondWithResult(_0x145464,null))[_0x6d6b('0x27')](handleError(_0x145464,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index e95c658..9620880 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 _0x3526=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util'];(function(_0x157622,_0x5804b0){var _0x356fa0=function(_0x48dbe3){while(--_0x48dbe3){_0x157622['push'](_0x157622['shift']());}};_0x356fa0(++_0x5804b0);}(_0x3526,0x1db));var _0x6352=function(_0x415944,_0x3db698){_0x415944=_0x415944-0x0;var _0x4d082f=_0x3526[_0x415944];return _0x4d082f;};'use strict';var _=require('lodash');var util=require(_0x6352('0x0'));var logger=require(_0x6352('0x1'))(_0x6352('0x2'));var moment=require(_0x6352('0x3'));var BPromise=require(_0x6352('0x4'));var rp=require(_0x6352('0x5'));var fs=require('fs');var path=require(_0x6352('0x6'));var rimraf=require(_0x6352('0x7'));var config=require(_0x6352('0x8'));var attributes=require(_0x6352('0x9'));module[_0x6352('0xa')]=function(_0x11a73f,_0x3d5035){return _0x11a73f[_0x6352('0xb')](_0x6352('0xc'),attributes,{'tableName':_0x6352('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf632=['api','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x1b8496,_0xebbb5a){var _0x523c6a=function(_0x599632){while(--_0x599632){_0x1b8496['push'](_0x1b8496['shift']());}};_0x523c6a(++_0xebbb5a);}(_0xf632,0xf9));var _0x2f63=function(_0x3989a0,_0x5d9522){_0x3989a0=_0x3989a0-0x0;var _0x42a815=_0xf632[_0x3989a0];return _0x42a815;};'use strict';var _=require(_0x2f63('0x0'));var util=require(_0x2f63('0x1'));var logger=require(_0x2f63('0x2'))(_0x2f63('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f63('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2f63('0x5'));var config=require(_0x2f63('0x6'));var attributes=require(_0x2f63('0x7'));module[_0x2f63('0x8')]=function(_0x5df351,_0x2ad5c1){return _0x5df351[_0x2f63('0x9')](_0x2f63('0xa'),attributes,{'tableName':_0x2f63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index df42877..d6d7428 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 _0x6931=['info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x6931,0xa5));var _0x1693=function(_0x328cb4,_0x32bf93){_0x328cb4=_0x328cb4-0x0;var _0x490eb2=_0x6931[_0x328cb4];return _0x490eb2;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1693('0x2'));var fs=require('fs');var Redis=require(_0x1693('0x3'));var db=require(_0x1693('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1693('0x5'))(_0x1693('0x6'));var config=require(_0x1693('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1693('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3594e0,_0x45aa35,_0x328cfc){return new BPromise(function(_0x2ab0a0,_0x31bff8){return client[_0x1693('0x9')](_0x3594e0,_0x328cfc)[_0x1693('0xa')](function(_0x391134){logger[_0x1693('0xb')](_0x1693('0xc'),_0x45aa35,_0x1693('0xd'));logger[_0x1693('0xe')](_0x1693('0xf'),_0x45aa35,_0x1693('0xd'),JSON[_0x1693('0x10')](_0x391134));if(_0x391134[_0x1693('0x11')]){if(_0x391134['error'][_0x1693('0x12')]===0x1f4){logger['error'](_0x1693('0xc'),_0x45aa35,_0x391134[_0x1693('0x11')]['message']);return _0x31bff8(_0x391134[_0x1693('0x11')][_0x1693('0x13')]);}logger[_0x1693('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x45aa35,_0x391134[_0x1693('0x11')][_0x1693('0x13')]);return _0x2ab0a0(_0x391134[_0x1693('0x11')][_0x1693('0x13')]);}else{logger[_0x1693('0xb')](_0x1693('0xc'),_0x45aa35,_0x1693('0xd'));_0x2ab0a0(_0x391134[_0x1693('0x14')][_0x1693('0x13')]);}})[_0x1693('0x15')](function(_0x59cbff){logger[_0x1693('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x45aa35,_0x59cbff);_0x31bff8(_0x59cbff);});});} \ No newline at end of file +var _0xa062=['http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client'];(function(_0x54f00c,_0x3a710c){var _0x4cf068=function(_0x1173f1){while(--_0x1173f1){_0x54f00c['push'](_0x54f00c['shift']());}};_0x4cf068(++_0x3a710c);}(_0xa062,0x101));var _0x2a06=function(_0x2fa9da,_0x2fb5ee){_0x2fa9da=_0x2fa9da-0x0;var _0x5ae45b=_0xa062[_0x2fa9da];return _0x5ae45b;};'use strict';var _=require(_0x2a06('0x0'));var util=require(_0x2a06('0x1'));var moment=require(_0x2a06('0x2'));var BPromise=require('bluebird');var rs=require(_0x2a06('0x3'));var fs=require('fs');var Redis=require(_0x2a06('0x4'));var db=require(_0x2a06('0x5'))['db'];var utils=require(_0x2a06('0x6'));var logger=require('../../config/logger')(_0x2a06('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2a06('0x8')][_0x2a06('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3626b6,_0x3e8a5b,_0x49ad9b){return new BPromise(function(_0x448892,_0x5da16b){return client[_0x2a06('0xa')](_0x3626b6,_0x49ad9b)[_0x2a06('0xb')](function(_0x4ed6fc){logger[_0x2a06('0xc')](_0x2a06('0xd'),_0x3e8a5b,_0x2a06('0xe'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x3e8a5b,'request\x20sent',JSON['stringify'](_0x4ed6fc));if(_0x4ed6fc[_0x2a06('0xf')]){if(_0x4ed6fc[_0x2a06('0xf')]['code']===0x1f4){logger[_0x2a06('0xf')](_0x2a06('0xd'),_0x3e8a5b,_0x4ed6fc[_0x2a06('0xf')][_0x2a06('0x10')]);return _0x5da16b(_0x4ed6fc[_0x2a06('0xf')][_0x2a06('0x10')]);}logger[_0x2a06('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3e8a5b,_0x4ed6fc['error'][_0x2a06('0x10')]);return _0x448892(_0x4ed6fc[_0x2a06('0xf')]['message']);}else{logger[_0x2a06('0xc')](_0x2a06('0xd'),_0x3e8a5b,_0x2a06('0xe'));_0x448892(_0x4ed6fc[_0x2a06('0x11')][_0x2a06('0x10')]);}})[_0x2a06('0x12')](function(_0x1a3263){logger[_0x2a06('0xf')](_0x2a06('0xd'),_0x3e8a5b,_0x1a3263);_0x5da16b(_0x1a3263);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 9c9e4c8..f354da9 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 _0x6a31=['update','destroy','exports','multer','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x246e29,_0x5f2ca6){var _0x4b73e8=function(_0x386abf){while(--_0x386abf){_0x246e29['push'](_0x246e29['shift']());}};_0x4b73e8(++_0x5f2ca6);}(_0x6a31,0x1b3));var _0x16a3=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x6a31[_0x5317b5];return _0x3b7ce2;};'use strict';var multer=require(_0x16a3('0x0'));var util=require('util');var path=require(_0x16a3('0x1'));var timeout=require(_0x16a3('0x2'));var express=require(_0x16a3('0x3'));var router=express[_0x16a3('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x16a3('0x5'));var controller=require('./intFreshsalesField.controller');router[_0x16a3('0x6')]('/',auth[_0x16a3('0x7')](),controller['index']);router[_0x16a3('0x6')](_0x16a3('0x8'),auth[_0x16a3('0x7')](),controller[_0x16a3('0x9')]);router[_0x16a3('0xa')]('/',auth['isAuthenticated'](),controller[_0x16a3('0xb')]);router[_0x16a3('0xc')]('/:id',auth[_0x16a3('0x7')](),controller[_0x16a3('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x16a3('0xe')]);module[_0x16a3('0xf')]=router; \ No newline at end of file +var _0x4225=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1c83d2,_0x59739c){var _0x25fa1c=function(_0x274167){while(--_0x274167){_0x1c83d2['push'](_0x1c83d2['shift']());}};_0x25fa1c(++_0x59739c);}(_0x4225,0xb0));var _0x5422=function(_0x53e2b9,_0x34242f){_0x53e2b9=_0x53e2b9-0x0;var _0x23c9a4=_0x4225[_0x53e2b9];return _0x23c9a4;};'use strict';var multer=require(_0x5422('0x0'));var util=require(_0x5422('0x1'));var path=require(_0x5422('0x2'));var timeout=require(_0x5422('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x5422('0x4'));var interaction=require(_0x5422('0x5'));var config=require(_0x5422('0x6'));var controller=require(_0x5422('0x7'));router[_0x5422('0x8')]('/',auth[_0x5422('0x9')](),controller['index']);router['get']('/:id',auth[_0x5422('0x9')](),controller[_0x5422('0xa')]);router[_0x5422('0xb')]('/',auth['isAuthenticated'](),controller[_0x5422('0xc')]);router[_0x5422('0xd')](_0x5422('0xe'),auth['isAuthenticated'](),controller[_0x5422('0xf')]);router['delete'](_0x5422('0xe'),auth[_0x5422('0x9')](),controller[_0x5422('0x10')]);module[_0x5422('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index c10b40e..68fb304 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 _0x249c=['ENUM','string','keyValue','STRING','variable','customVariable','BOOLEAN','sequelize','exports'];(function(_0x104b5d,_0x283c0e){var _0x968e23=function(_0x1605f1){while(--_0x1605f1){_0x104b5d['push'](_0x104b5d['shift']());}};_0x968e23(++_0x283c0e);}(_0x249c,0x181));var _0xc249=function(_0x585ee5,_0x1c9dba){_0x585ee5=_0x585ee5-0x0;var _0x470808=_0x249c[_0x585ee5];return _0x470808;};'use strict';var Sequelize=require(_0xc249('0x0'));module[_0xc249('0x1')]={'type':{'type':Sequelize[_0xc249('0x2')](_0xc249('0x3'),'variable','customVariable',_0xc249('0x4')),'defaultValue':_0xc249('0x3')},'content':{'type':Sequelize[_0xc249('0x5')]},'key':{'type':Sequelize[_0xc249('0x5')]},'keyType':{'type':Sequelize[_0xc249('0x2')](_0xc249('0x3'),_0xc249('0x6'),_0xc249('0x7'))},'keyContent':{'type':Sequelize[_0xc249('0x5')]},'idField':{'type':Sequelize[_0xc249('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc249('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc249('0x5')]}}; \ No newline at end of file +var _0xa7dc=['variable','keyValue','string','STRING','customVariable','sequelize','exports','ENUM'];(function(_0x14c7b3,_0x4677b7){var _0x1518ef=function(_0x3bc379){while(--_0x3bc379){_0x14c7b3['push'](_0x14c7b3['shift']());}};_0x1518ef(++_0x4677b7);}(_0xa7dc,0x11d));var _0xca7d=function(_0x12f9f4,_0x9e1d15){_0x12f9f4=_0x12f9f4-0x0;var _0x6fe60b=_0xa7dc[_0x12f9f4];return _0x6fe60b;};'use strict';var Sequelize=require(_0xca7d('0x0'));module[_0xca7d('0x1')]={'type':{'type':Sequelize[_0xca7d('0x2')]('string',_0xca7d('0x3'),'customVariable',_0xca7d('0x4')),'defaultValue':_0xca7d('0x5')},'content':{'type':Sequelize[_0xca7d('0x6')]},'key':{'type':Sequelize[_0xca7d('0x6')]},'keyType':{'type':Sequelize[_0xca7d('0x2')](_0xca7d('0x5'),_0xca7d('0x3'),_0xca7d('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xca7d('0x6')]},'nameField':{'type':Sequelize[_0xca7d('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xca7d('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index d974b8d..821728f 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 _0x9011=['html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','update','destroy','error','name','send','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','then','includeAll','include','FreshsalesField','rows','catch','show','params','find','body'];(function(_0x19bbc9,_0x7fd097){var _0x51ab3f=function(_0xbd01cb){while(--_0xbd01cb){_0x19bbc9['push'](_0x19bbc9['shift']());}};_0x51ab3f(++_0x7fd097);}(_0x9011,0xc9));var _0x1901=function(_0x3c7199,_0x269c46){_0x3c7199=_0x3c7199-0x0;var _0x5a55b6=_0x9011[_0x3c7199];return _0x5a55b6;};'use strict';var pdf=require(_0x1901('0x0'));var emlformat=require(_0x1901('0x1'));var rimraf=require(_0x1901('0x2'));var zipdir=require(_0x1901('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1901('0x4'));var moment=require(_0x1901('0x5'));var BPromise=require(_0x1901('0x6'));var Mustache=require(_0x1901('0x7'));var util=require(_0x1901('0x8'));var path=require(_0x1901('0x9'));var sox=require(_0x1901('0xa'));var csv=require(_0x1901('0xb'));var ejs=require(_0x1901('0xc'));var fs=require('fs');var _=require(_0x1901('0xd'));var squel=require(_0x1901('0xe'));var crypto=require('crypto');var jsforce=require(_0x1901('0xf'));var deskjs=require(_0x1901('0x10'));var toCsv=require(_0x1901('0xb'));var querystring=require(_0x1901('0x11'));var Papa=require(_0x1901('0x12'));var Redis=require(_0x1901('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1901('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1901('0x15'));var logger=require(_0x1901('0x16'))('api');var utils=require(_0x1901('0x17'));var config=require(_0x1901('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b439d,_0x53a345){_0x53a345=_0x53a345||0xcc;return function(_0x1896cd){if(_0x1896cd){return _0x2b439d['sendStatus'](_0x53a345);}return _0x2b439d[_0x1901('0x19')](_0x53a345)[_0x1901('0x1a')]();};}function respondWithResult(_0x462919,_0x4aba18){_0x4aba18=_0x4aba18||0xc8;return function(_0x3caa80){if(_0x3caa80){return _0x462919['status'](_0x4aba18)[_0x1901('0x1b')](_0x3caa80);}};}function respondWithFilteredResult(_0x2cce08,_0x27909c){return function(_0x25e555){if(_0x25e555){var _0x2fbab1=_0x25e555[_0x1901('0x1c')],_0x4c5839=_0x27909c[_0x1901('0x1d')],_0x4bdec1=_0x27909c[_0x1901('0x1d')]+_0x27909c[_0x1901('0x1e')],_0x540059;if(_0x4bdec1>=_0x2fbab1){_0x4bdec1=_0x2fbab1;_0x540059=0xc8;}else{_0x540059=0xce;}_0x2cce08[_0x1901('0x19')](_0x540059);return _0x2cce08[_0x1901('0x1f')](_0x1901('0x20'),_0x4c5839+'-'+_0x4bdec1+'/'+_0x2fbab1)[_0x1901('0x1b')](_0x25e555);}return null;};}function patchUpdates(_0x24f600){return function(_0x3bf4cc){try{jsonpatch['apply'](_0x3bf4cc,_0x24f600,!![]);}catch(_0x26d8d8){return BPromise['reject'](_0x26d8d8);}return _0x3bf4cc['save']();};}function saveUpdates(_0x1cd7d3,_0x3a4b40){return function(_0x20df3b){if(_0x20df3b){return _0x20df3b[_0x1901('0x21')](_0x1cd7d3)['then'](function(_0x51f0ff){return _0x51f0ff;});}return null;};}function removeEntity(_0x51bf4f,_0xa815e5){return function(_0x358f52){if(_0x358f52){return _0x358f52[_0x1901('0x22')]()['then'](function(){_0x51bf4f[_0x1901('0x19')](0xcc)[_0x1901('0x1a')]();});}};}function handleEntityNotFound(_0x31c6e5,_0xb23bee){return function(_0x31833c){if(!_0x31833c){_0x31c6e5['sendStatus'](0x194);}return _0x31833c;};}function handleError(_0x3e9f86,_0x44ad92){_0x44ad92=_0x44ad92||0x1f4;return function(_0x2a23ef){logger[_0x1901('0x23')](_0x2a23ef['stack']);if(_0x2a23ef['name']){delete _0x2a23ef[_0x1901('0x24')];}_0x3e9f86[_0x1901('0x19')](_0x44ad92)[_0x1901('0x25')](_0x2a23ef);};}exports['index']=function(_0x1e8321,_0x4011ba){var _0x58ead7={},_0x5911af={},_0x455b3b={'count':0x0,'rows':[]};var _0x479cd8=_['map'](db['FreshsalesField'][_0x1901('0x26')],function(_0x95c32a){return{'name':_0x95c32a[_0x1901('0x27')],'type':_0x95c32a['type']['key']};});_0x5911af['model']=_[_0x1901('0x28')](_0x479cd8,_0x1901('0x24'));_0x5911af[_0x1901('0x29')]=_[_0x1901('0x2a')](_0x1e8321[_0x1901('0x29')]);_0x5911af[_0x1901('0x2b')]=_[_0x1901('0x2c')](_0x5911af[_0x1901('0x2d')],_0x5911af[_0x1901('0x29')]);_0x58ead7[_0x1901('0x2e')]=_[_0x1901('0x2c')](_0x5911af[_0x1901('0x2d')],qs[_0x1901('0x2f')](_0x1e8321[_0x1901('0x29')][_0x1901('0x2f')]));_0x58ead7[_0x1901('0x2e')]=_0x58ead7['attributes'][_0x1901('0x30')]?_0x58ead7[_0x1901('0x2e')]:_0x5911af[_0x1901('0x2d')];if(!_0x1e8321[_0x1901('0x29')][_0x1901('0x31')](_0x1901('0x32'))){_0x58ead7['limit']=qs[_0x1901('0x1e')](_0x1e8321['query'][_0x1901('0x1e')]);_0x58ead7[_0x1901('0x1d')]=qs[_0x1901('0x1d')](_0x1e8321[_0x1901('0x29')][_0x1901('0x1d')]);}_0x58ead7[_0x1901('0x33')]=qs[_0x1901('0x34')](_0x1e8321[_0x1901('0x29')]['sort']);_0x58ead7[_0x1901('0x35')]=qs[_0x1901('0x2b')](_['pick'](_0x1e8321['query'],_0x5911af[_0x1901('0x2b')]),_0x479cd8);if(_0x1e8321[_0x1901('0x29')]['filter']){_0x58ead7[_0x1901('0x35')]=_['merge'](_0x58ead7[_0x1901('0x35')],{'$or':_[_0x1901('0x28')](_0x479cd8,function(_0x246cdd){if(_0x246cdd['type']!=='VIRTUAL'){var _0x40d38b={};_0x40d38b[_0x246cdd[_0x1901('0x24')]]={'$like':'%'+_0x1e8321[_0x1901('0x29')][_0x1901('0x36')]+'%'};return _0x40d38b;}})});}_0x58ead7=_[_0x1901('0x37')]({},_0x58ead7,_0x1e8321[_0x1901('0x38')]);var _0x5b9486={'where':_0x58ead7[_0x1901('0x35')]};return db['FreshsalesField'][_0x1901('0x1c')](_0x5b9486)[_0x1901('0x39')](function(_0x5549f1){_0x455b3b[_0x1901('0x1c')]=_0x5549f1;if(_0x1e8321['query'][_0x1901('0x3a')]){_0x58ead7[_0x1901('0x3b')]=[{'all':!![]}];}return db[_0x1901('0x3c')]['findAll'](_0x58ead7);})['then'](function(_0x976b3b){_0x455b3b[_0x1901('0x3d')]=_0x976b3b;return _0x455b3b;})[_0x1901('0x39')](respondWithFilteredResult(_0x4011ba,_0x58ead7))[_0x1901('0x3e')](handleError(_0x4011ba,null));};exports[_0x1901('0x3f')]=function(_0x4d59de,_0x470acf){var _0x4079f0={'raw':!![],'where':{'id':_0x4d59de[_0x1901('0x40')]['id']}},_0x1b82ef={};_0x1b82ef[_0x1901('0x2d')]=_[_0x1901('0x2a')](db[_0x1901('0x3c')][_0x1901('0x26')]);_0x1b82ef[_0x1901('0x29')]=_[_0x1901('0x2a')](_0x4d59de[_0x1901('0x29')]);_0x1b82ef[_0x1901('0x2b')]=_['intersection'](_0x1b82ef[_0x1901('0x2d')],_0x1b82ef[_0x1901('0x29')]);_0x4079f0['attributes']=_[_0x1901('0x2c')](_0x1b82ef[_0x1901('0x2d')],qs['fields'](_0x4d59de['query'][_0x1901('0x2f')]));_0x4079f0[_0x1901('0x2e')]=_0x4079f0[_0x1901('0x2e')][_0x1901('0x30')]?_0x4079f0['attributes']:_0x1b82ef[_0x1901('0x2d')];if(_0x4d59de[_0x1901('0x29')][_0x1901('0x3a')]){_0x4079f0[_0x1901('0x3b')]=[{'all':!![]}];}_0x4079f0=_[_0x1901('0x37')]({},_0x4079f0,_0x4d59de[_0x1901('0x38')]);return db[_0x1901('0x3c')][_0x1901('0x41')](_0x4079f0)[_0x1901('0x39')](handleEntityNotFound(_0x470acf,null))[_0x1901('0x39')](respondWithResult(_0x470acf,null))[_0x1901('0x3e')](handleError(_0x470acf,null));};exports['create']=function(_0x2b278e,_0x4cf5d9){return db[_0x1901('0x3c')]['create'](_0x2b278e[_0x1901('0x42')],{})[_0x1901('0x39')](respondWithResult(_0x4cf5d9,0xc9))['catch'](handleError(_0x4cf5d9,null));};exports['update']=function(_0x4a58e0,_0x2be8e1){if(_0x4a58e0['body']['id']){delete _0x4a58e0[_0x1901('0x42')]['id'];}return db['FreshsalesField'][_0x1901('0x41')]({'where':{'id':_0x4a58e0[_0x1901('0x40')]['id']}})[_0x1901('0x39')](handleEntityNotFound(_0x2be8e1,null))[_0x1901('0x39')](saveUpdates(_0x4a58e0[_0x1901('0x42')],null))[_0x1901('0x39')](respondWithResult(_0x2be8e1,null))[_0x1901('0x3e')](handleError(_0x2be8e1,null));};exports[_0x1901('0x22')]=function(_0x3cc6f3,_0x1a56c0){return db[_0x1901('0x3c')][_0x1901('0x41')]({'where':{'id':_0x3cc6f3[_0x1901('0x40')]['id']}})['then'](handleEntityNotFound(_0x1a56c0,null))[_0x1901('0x39')](removeEntity(_0x1a56c0,null))['catch'](handleError(_0x1a56c0,null));}; \ No newline at end of file +var _0xee8e=['filter','where','merge','options','count','includeAll','FreshsalesField','findAll','rows','catch','show','params','length','find','create','body','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','sendStatus','status','offset','json','apply','save','update','then','end','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick'];(function(_0x8bd61c,_0xf97fe1){var _0x276049=function(_0x951647){while(--_0x951647){_0x8bd61c['push'](_0x8bd61c['shift']());}};_0x276049(++_0xf97fe1);}(_0xee8e,0x184));var _0xeee8=function(_0x154189,_0x1cfc9d){_0x154189=_0x154189-0x0;var _0x138bbc=_0xee8e[_0x154189];return _0x138bbc;};'use strict';var pdf=require(_0xeee8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeee8('0x1'));var zipdir=require(_0xeee8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeee8('0x3'));var moment=require(_0xeee8('0x4'));var BPromise=require(_0xeee8('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeee8('0x6'));var sox=require(_0xeee8('0x7'));var csv=require(_0xeee8('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeee8('0x9'));var squel=require(_0xeee8('0xa'));var crypto=require(_0xeee8('0xb'));var jsforce=require(_0xeee8('0xc'));var deskjs=require(_0xeee8('0xd'));var toCsv=require(_0xeee8('0x8'));var querystring=require(_0xeee8('0xe'));var Papa=require('papaparse');var Redis=require(_0xeee8('0xf'));var authService=require(_0xeee8('0x10'));var qs=require(_0xeee8('0x11'));var as=require(_0xeee8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a6b4e,_0x524c00){_0x524c00=_0x524c00||0xcc;return function(_0xef2439){if(_0xef2439){return _0x4a6b4e[_0xeee8('0x13')](_0x524c00);}return _0x4a6b4e[_0xeee8('0x14')](_0x524c00)['end']();};}function respondWithResult(_0x4f7d11,_0x2228f6){_0x2228f6=_0x2228f6||0xc8;return function(_0x43141b){if(_0x43141b){return _0x4f7d11[_0xeee8('0x14')](_0x2228f6)['json'](_0x43141b);}};}function respondWithFilteredResult(_0x12bd54,_0x37423b){return function(_0x496ddd){if(_0x496ddd){var _0x3bbefe=_0x496ddd['count'],_0x4e7a17=_0x37423b[_0xeee8('0x15')],_0x417866=_0x37423b[_0xeee8('0x15')]+_0x37423b['limit'],_0x51abdc;if(_0x417866>=_0x3bbefe){_0x417866=_0x3bbefe;_0x51abdc=0xc8;}else{_0x51abdc=0xce;}_0x12bd54[_0xeee8('0x14')](_0x51abdc);return _0x12bd54['set']('Content-Range',_0x4e7a17+'-'+_0x417866+'/'+_0x3bbefe)[_0xeee8('0x16')](_0x496ddd);}return null;};}function patchUpdates(_0xdc97b4){return function(_0x3ef47c){try{jsonpatch[_0xeee8('0x17')](_0x3ef47c,_0xdc97b4,!![]);}catch(_0x497c3f){return BPromise['reject'](_0x497c3f);}return _0x3ef47c[_0xeee8('0x18')]();};}function saveUpdates(_0x5d920a,_0x25ee7c){return function(_0x182388){if(_0x182388){return _0x182388[_0xeee8('0x19')](_0x5d920a)[_0xeee8('0x1a')](function(_0x29d085){return _0x29d085;});}return null;};}function removeEntity(_0x1a52d5,_0x347d53){return function(_0x528cb0){if(_0x528cb0){return _0x528cb0['destroy']()[_0xeee8('0x1a')](function(){_0x1a52d5['status'](0xcc)[_0xeee8('0x1b')]();});}};}function handleEntityNotFound(_0x88f7f7,_0x3d8b64){return function(_0x200314){if(!_0x200314){_0x88f7f7[_0xeee8('0x13')](0x194);}return _0x200314;};}function handleError(_0x57c901,_0xa0a511){_0xa0a511=_0xa0a511||0x1f4;return function(_0x1b2db4){logger['error'](_0x1b2db4[_0xeee8('0x1c')]);if(_0x1b2db4[_0xeee8('0x1d')]){delete _0x1b2db4[_0xeee8('0x1d')];}_0x57c901['status'](_0xa0a511)['send'](_0x1b2db4);};}exports[_0xeee8('0x1e')]=function(_0x49d92b,_0x417ca9){var _0x431dc3={},_0x189286={},_0x4dd490={'count':0x0,'rows':[]};var _0x565a14=_[_0xeee8('0x1f')](db['FreshsalesField'][_0xeee8('0x20')],function(_0x9ae9f7){return{'name':_0x9ae9f7[_0xeee8('0x21')],'type':_0x9ae9f7['type'][_0xeee8('0x22')]};});_0x189286[_0xeee8('0x23')]=_['map'](_0x565a14,_0xeee8('0x1d'));_0x189286[_0xeee8('0x24')]=_[_0xeee8('0x25')](_0x49d92b[_0xeee8('0x24')]);_0x189286[_0xeee8('0x26')]=_['intersection'](_0x189286[_0xeee8('0x23')],_0x189286[_0xeee8('0x24')]);_0x431dc3[_0xeee8('0x27')]=_[_0xeee8('0x28')](_0x189286[_0xeee8('0x23')],qs[_0xeee8('0x29')](_0x49d92b[_0xeee8('0x24')]['fields']));_0x431dc3[_0xeee8('0x27')]=_0x431dc3[_0xeee8('0x27')]['length']?_0x431dc3['attributes']:_0x189286[_0xeee8('0x23')];if(!_0x49d92b[_0xeee8('0x24')][_0xeee8('0x2a')](_0xeee8('0x2b'))){_0x431dc3['limit']=qs['limit'](_0x49d92b[_0xeee8('0x24')]['limit']);_0x431dc3[_0xeee8('0x15')]=qs[_0xeee8('0x15')](_0x49d92b[_0xeee8('0x24')][_0xeee8('0x15')]);}_0x431dc3['order']=qs[_0xeee8('0x2c')](_0x49d92b['query'][_0xeee8('0x2c')]);_0x431dc3['where']=qs['filters'](_[_0xeee8('0x2d')](_0x49d92b[_0xeee8('0x24')],_0x189286['filters']),_0x565a14);if(_0x49d92b['query'][_0xeee8('0x2e')]){_0x431dc3[_0xeee8('0x2f')]=_['merge'](_0x431dc3[_0xeee8('0x2f')],{'$or':_[_0xeee8('0x1f')](_0x565a14,function(_0xa38f61){if(_0xa38f61['type']!=='VIRTUAL'){var _0x148285={};_0x148285[_0xa38f61[_0xeee8('0x1d')]]={'$like':'%'+_0x49d92b[_0xeee8('0x24')][_0xeee8('0x2e')]+'%'};return _0x148285;}})});}_0x431dc3=_[_0xeee8('0x30')]({},_0x431dc3,_0x49d92b[_0xeee8('0x31')]);var _0x317cf8={'where':_0x431dc3[_0xeee8('0x2f')]};return db['FreshsalesField'][_0xeee8('0x32')](_0x317cf8)[_0xeee8('0x1a')](function(_0x35803c){_0x4dd490[_0xeee8('0x32')]=_0x35803c;if(_0x49d92b[_0xeee8('0x24')][_0xeee8('0x33')]){_0x431dc3['include']=[{'all':!![]}];}return db[_0xeee8('0x34')][_0xeee8('0x35')](_0x431dc3);})[_0xeee8('0x1a')](function(_0x30687d){_0x4dd490[_0xeee8('0x36')]=_0x30687d;return _0x4dd490;})['then'](respondWithFilteredResult(_0x417ca9,_0x431dc3))[_0xeee8('0x37')](handleError(_0x417ca9,null));};exports[_0xeee8('0x38')]=function(_0x163ea2,_0x1a55f2){var _0x425fb7={'raw':!![],'where':{'id':_0x163ea2[_0xeee8('0x39')]['id']}},_0x3c2237={};_0x3c2237[_0xeee8('0x23')]=_['keys'](db[_0xeee8('0x34')]['rawAttributes']);_0x3c2237[_0xeee8('0x24')]=_['keys'](_0x163ea2[_0xeee8('0x24')]);_0x3c2237[_0xeee8('0x26')]=_[_0xeee8('0x28')](_0x3c2237[_0xeee8('0x23')],_0x3c2237['query']);_0x425fb7[_0xeee8('0x27')]=_[_0xeee8('0x28')](_0x3c2237[_0xeee8('0x23')],qs['fields'](_0x163ea2[_0xeee8('0x24')]['fields']));_0x425fb7[_0xeee8('0x27')]=_0x425fb7[_0xeee8('0x27')][_0xeee8('0x3a')]?_0x425fb7[_0xeee8('0x27')]:_0x3c2237[_0xeee8('0x23')];if(_0x163ea2[_0xeee8('0x24')][_0xeee8('0x33')]){_0x425fb7['include']=[{'all':!![]}];}_0x425fb7=_[_0xeee8('0x30')]({},_0x425fb7,_0x163ea2[_0xeee8('0x31')]);return db['FreshsalesField'][_0xeee8('0x3b')](_0x425fb7)['then'](handleEntityNotFound(_0x1a55f2,null))[_0xeee8('0x1a')](respondWithResult(_0x1a55f2,null))[_0xeee8('0x37')](handleError(_0x1a55f2,null));};exports[_0xeee8('0x3c')]=function(_0x31a35c,_0x1958ca){return db[_0xeee8('0x34')][_0xeee8('0x3c')](_0x31a35c[_0xeee8('0x3d')],{})['then'](respondWithResult(_0x1958ca,0xc9))['catch'](handleError(_0x1958ca,null));};exports['update']=function(_0x21acdb,_0x5ce965){if(_0x21acdb[_0xeee8('0x3d')]['id']){delete _0x21acdb[_0xeee8('0x3d')]['id'];}return db[_0xeee8('0x34')][_0xeee8('0x3b')]({'where':{'id':_0x21acdb['params']['id']}})['then'](handleEntityNotFound(_0x5ce965,null))[_0xeee8('0x1a')](saveUpdates(_0x21acdb[_0xeee8('0x3d')],null))['then'](respondWithResult(_0x5ce965,null))[_0xeee8('0x37')](handleError(_0x5ce965,null));};exports['destroy']=function(_0xb5ee4e,_0x3366ff){return db[_0xeee8('0x34')][_0xeee8('0x3b')]({'where':{'id':_0xb5ee4e[_0xeee8('0x39')]['id']}})[_0xeee8('0x1a')](handleEntityNotFound(_0x3366ff,null))[_0xeee8('0x1a')](removeEntity(_0x3366ff,null))['catch'](handleError(_0x3366ff,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index fc70516..bea1f6d 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 _0x84e1=['int_freshsales_fields','freshsales_unique_index','idField','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x152040,_0x25b029){var _0x28d908=function(_0x343d64){while(--_0x343d64){_0x152040['push'](_0x152040['shift']());}};_0x28d908(++_0x25b029);}(_0x84e1,0x1df));var _0x184e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x84e1[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x184e('0x0'));var util=require('util');var logger=require(_0x184e('0x1'))(_0x184e('0x2'));var moment=require(_0x184e('0x3'));var BPromise=require(_0x184e('0x4'));var rp=require(_0x184e('0x5'));var fs=require('fs');var path=require(_0x184e('0x6'));var rimraf=require(_0x184e('0x7'));var config=require(_0x184e('0x8'));var attributes=require('./intFreshsalesField.attributes');module[_0x184e('0x9')]=function(_0x3f72ec,_0x448f75){return _0x3f72ec[_0x184e('0xa')]('FreshsalesField',attributes,{'tableName':_0x184e('0xb'),'paranoid':![],'indexes':[{'name':_0x184e('0xc'),'fields':[_0x184e('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x87a9=['../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0xb9ee29,_0x399214){var _0x1ec693=function(_0x34a58b){while(--_0x34a58b){_0xb9ee29['push'](_0xb9ee29['shift']());}};_0x1ec693(++_0x399214);}(_0x87a9,0x126));var _0x987a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x87a9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x987a('0x0'))('api');var moment=require(_0x987a('0x1'));var BPromise=require(_0x987a('0x2'));var rp=require(_0x987a('0x3'));var fs=require('fs');var path=require(_0x987a('0x4'));var rimraf=require(_0x987a('0x5'));var config=require(_0x987a('0x6'));var attributes=require(_0x987a('0x7'));module[_0x987a('0x8')]=function(_0x54314c,_0x4bcc1b){return _0x54314c[_0x987a('0x9')](_0x987a('0xa'),attributes,{'tableName':_0x987a('0xb'),'paranoid':![],'indexes':[{'name':_0x987a('0xc'),'fields':[_0x987a('0xd'),_0x987a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index b60e051..123d119 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 _0x52c4=['jayson/promise','client','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x52c4,0x1b1));var _0x452c=function(_0x529d48,_0x1cf60b){_0x529d48=_0x529d48-0x0;var _0x34f1d9=_0x52c4[_0x529d48];return _0x34f1d9;};'use strict';var _=require(_0x452c('0x0'));var util=require(_0x452c('0x1'));var moment=require(_0x452c('0x2'));var BPromise=require(_0x452c('0x3'));var rs=require(_0x452c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x452c('0x5'));var logger=require(_0x452c('0x6'))(_0x452c('0x7'));var config=require('../../config/environment');var jayson=require(_0x452c('0x8'));var client=jayson[_0x452c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b4519,_0x5b752e,_0x1c683d){return new BPromise(function(_0x12bac8,_0x3a3ebc){return client[_0x452c('0xa')](_0x3b4519,_0x1c683d)[_0x452c('0xb')](function(_0x46a9dd){logger[_0x452c('0xc')](_0x452c('0xd'),_0x5b752e,_0x452c('0xe'));logger[_0x452c('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x5b752e,_0x452c('0xe'),JSON[_0x452c('0x10')](_0x46a9dd));if(_0x46a9dd[_0x452c('0x11')]){if(_0x46a9dd[_0x452c('0x11')][_0x452c('0x12')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x5b752e,_0x46a9dd[_0x452c('0x11')][_0x452c('0x13')]);return _0x3a3ebc(_0x46a9dd['error'][_0x452c('0x13')]);}logger[_0x452c('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x5b752e,_0x46a9dd[_0x452c('0x11')][_0x452c('0x13')]);return _0x12bac8(_0x46a9dd['error'][_0x452c('0x13')]);}else{logger['info'](_0x452c('0xd'),_0x5b752e,_0x452c('0xe'));_0x12bac8(_0x46a9dd['result'][_0x452c('0x13')]);}})[_0x452c('0x14')](function(_0x3e949e){logger[_0x452c('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x5b752e,_0x3e949e);_0x3a3ebc(_0x3e949e);});});} \ No newline at end of file +var _0xe52b=['FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','debug'];(function(_0x48b52c,_0x3ed170){var _0x1897cb=function(_0xce5803){while(--_0xce5803){_0x48b52c['push'](_0x48b52c['shift']());}};_0x1897cb(++_0x3ed170);}(_0xe52b,0xc2));var _0xbe52=function(_0x4e8c49,_0x4b9a75){_0x4e8c49=_0x4e8c49-0x0;var _0x43e71d=_0xe52b[_0x4e8c49];return _0x43e71d;};'use strict';var _=require(_0xbe52('0x0'));var util=require(_0xbe52('0x1'));var moment=require('moment');var BPromise=require(_0xbe52('0x2'));var rs=require(_0xbe52('0x3'));var fs=require('fs');var Redis=require(_0xbe52('0x4'));var db=require(_0xbe52('0x5'))['db'];var utils=require(_0xbe52('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe52('0x7'));var jayson=require(_0xbe52('0x8'));var client=jayson[_0xbe52('0x9')][_0xbe52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fb26b,_0x5e88dd,_0x2d9b3a){return new BPromise(function(_0x2c54ca,_0x4ddd34){return client[_0xbe52('0xb')](_0x4fb26b,_0x2d9b3a)[_0xbe52('0xc')](function(_0xd6feb1){logger[_0xbe52('0xd')](_0xbe52('0xe'),_0x5e88dd,'request\x20sent');logger[_0xbe52('0xf')](_0xbe52('0x10'),_0x5e88dd,_0xbe52('0x11'),JSON['stringify'](_0xd6feb1));if(_0xd6feb1[_0xbe52('0x12')]){if(_0xd6feb1[_0xbe52('0x12')]['code']===0x1f4){logger[_0xbe52('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x5e88dd,_0xd6feb1[_0xbe52('0x12')]['message']);return _0x4ddd34(_0xd6feb1[_0xbe52('0x12')][_0xbe52('0x13')]);}logger['error'](_0xbe52('0xe'),_0x5e88dd,_0xd6feb1[_0xbe52('0x12')]['message']);return _0x2c54ca(_0xd6feb1[_0xbe52('0x12')]['message']);}else{logger[_0xbe52('0xd')](_0xbe52('0xe'),_0x5e88dd,'request\x20sent');_0x2c54ca(_0xd6feb1[_0xbe52('0x14')]['message']);}})['catch'](function(_0x2a4595){logger[_0xbe52('0x12')](_0xbe52('0xe'),_0x5e88dd,_0x2a4595);_0x4ddd34(_0x2a4595);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 6b39aa8..a401691 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 _0x98a8=['./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x98a8,0x12c));var _0x898a=function(_0x5c433b,_0x3f76c5){_0x5c433b=_0x5c433b-0x0;var _0x511f8e=_0x98a8[_0x5c433b];return _0x511f8e;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router['get'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0xd')]);router['get'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0xf')]);router[_0x898a('0x9')](_0x898a('0x10'),auth[_0x898a('0xa')](),controller[_0x898a('0x11')]);router[_0x898a('0x12')]('/',auth[_0x898a('0xa')](),controller['create']);router[_0x898a('0x12')]('/:id/configurations',auth[_0x898a('0xa')](),controller['addConfiguration']);router[_0x898a('0x13')](_0x898a('0xc'),auth[_0x898a('0xa')](),controller['update']);router['delete']('/:id',auth[_0x898a('0xa')](),controller[_0x898a('0x14')]);module[_0x898a('0x15')]=router; \ No newline at end of file +var _0xdc8c=['/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations'];(function(_0x40afbc,_0x2c0e71){var _0x11d3f3=function(_0x13b9e0){while(--_0x13b9e0){_0x40afbc['push'](_0x40afbc['shift']());}};_0x11d3f3(++_0x2c0e71);}(_0xdc8c,0xd9));var _0xcdc8=function(_0x3d3fa2,_0x104433){_0x3d3fa2=_0x3d3fa2-0x0;var _0x556091=_0xdc8c[_0x3d3fa2];return _0x556091;};'use strict';var multer=require(_0xcdc8('0x0'));var util=require(_0xcdc8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcdc8('0x2'));var router=express['Router']();var auth=require(_0xcdc8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcdc8('0x4'));var controller=require(_0xcdc8('0x5'));router[_0xcdc8('0x6')]('/',auth['isAuthenticated'](),controller[_0xcdc8('0x7')]);router[_0xcdc8('0x6')](_0xcdc8('0x8'),auth[_0xcdc8('0x9')](),controller[_0xcdc8('0xa')]);router[_0xcdc8('0x6')](_0xcdc8('0xb'),auth[_0xcdc8('0x9')](),controller[_0xcdc8('0xc')]);router[_0xcdc8('0x6')](_0xcdc8('0xd'),auth['isAuthenticated'](),controller[_0xcdc8('0xe')]);router[_0xcdc8('0xf')]('/',auth['isAuthenticated'](),controller[_0xcdc8('0x10')]);router[_0xcdc8('0xf')](_0xcdc8('0xb'),auth[_0xcdc8('0x9')](),controller[_0xcdc8('0x11')]);router[_0xcdc8('0x12')](_0xcdc8('0x8'),auth[_0xcdc8('0x9')](),controller[_0xcdc8('0x13')]);router[_0xcdc8('0x14')](_0xcdc8('0x8'),auth[_0xcdc8('0x9')](),controller[_0xcdc8('0x15')]);module[_0xcdc8('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 16c366f..b1b8f3e 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 _0x1cb9=['username','ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x3e00ef,_0x5e49bf){var _0x5e714c=function(_0x37c1ca){while(--_0x37c1ca){_0x3e00ef['push'](_0x3e00ef['shift']());}};_0x5e714c(++_0x5e49bf);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2cafe4,_0x5a0b35){_0x2cafe4=_0x2cafe4-0x0;var _0x102ce7=_0x1cb9[_0x2cafe4];return _0x102ce7;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x91cb('0x1')]},'description':{'type':Sequelize[_0x91cb('0x1')]},'username':{'type':Sequelize[_0x91cb('0x1')],'unique':_0x91cb('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x91cb('0x1')]},'clientId':{'type':Sequelize[_0x91cb('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x91cb('0x1')]},'serverUrl':{'type':Sequelize[_0x91cb('0x1')]},'type':{'type':Sequelize[_0x91cb('0x3')](_0x91cb('0x4'),_0x91cb('0x5')),'defaultValue':_0x91cb('0x4')}}; \ No newline at end of file +var _0xe14b=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe14b,0x93));var _0xbe14=function(_0x8dce61,_0x5c72ec){_0x8dce61=_0x8dce61-0x0;var _0x25f12e=_0xe14b[_0x8dce61];return _0x25f12e;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xbe14('0x2')],'unique':_0xbe14('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xbe14('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xbe14('0x2')]},'serverUrl':{'type':Sequelize[_0xbe14('0x2')]},'type':{'type':Sequelize[_0xbe14('0x4')](_0xbe14('0x5'),_0xbe14('0x6')),'defaultValue':_0xbe14('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 9b5871a..a8f5cc0 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 _0xa12a=['reject','save','update','status','end','sendStatus','stack','send','index','map','rawAttributes','name','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','merge','options','SalesforceAccount','includeAll','include','findAll','rows','show','params','keys','find','create','body','destroy','getConfigurations','findOne','SalesforceConfiguration','order','AccountId','Subjects','getSubjects','channel','SalesforceField','Descriptions','Task','remoteUri','clientId','clientSecret','username','password','slice','substring','lastIndexOf','Connection','concat','isNil','ticketType','sobject','describe','CallDisposition','CallType','IsArchived','Type','Case','Reason','Status','Priority','SuppliedName','remove','includes','picklistValues','label','value','boolean','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','jsforce','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','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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','result','catch','json','count','offset','apply'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0xa12a,0x1de));var _0xaa12=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa12a[_0x311c35];return _0x5cc50c;};'use strict';var pdf=require(_0xaa12('0x0'));var emlformat=require(_0xaa12('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xaa12('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa12('0x3'));var moment=require(_0xaa12('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaa12('0x5'));var util=require('util');var path=require(_0xaa12('0x6'));var sox=require(_0xaa12('0x7'));var csv=require('to-csv');var ejs=require(_0xaa12('0x8'));var fs=require('fs');var _=require(_0xaa12('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaa12('0xa'));var deskjs=require(_0xaa12('0xb'));var toCsv=require('to-csv');var querystring=require(_0xaa12('0xc'));var Papa=require(_0xaa12('0xd'));var Redis=require(_0xaa12('0xe'));var authService=require(_0xaa12('0xf'));var qs=require(_0xaa12('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa12('0x11'));var logger=require(_0xaa12('0x12'))(_0xaa12('0x13'));var utils=require(_0xaa12('0x14'));var config=require(_0xaa12('0x15'));var db=require(_0xaa12('0x16'))['db'];var integrations=require(_0xaa12('0x17'));var jayson=require(_0xaa12('0x18'));var client=jayson[_0xaa12('0x19')][_0xaa12('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x381737,_0xbfabd5,_0x3e9e74){if(_0x3e9e74){var _0x5d0905=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d0905[_0xaa12('0x1b')](_0xbfabd5)){return _0x381737;}else{throw new db[(_0xaa12('0x1c'))][(_0xaa12('0x1d'))](_0xaa12('0x1e'));}}else{return _0x381737;}}function respondWithRpcPromise(_0x2e271d,_0x436026,_0x372b8e,_0x520e25){return new BPromise(function(_0x5d7ef2,_0x1d0139){var _0xf36b50=_0x520e25||client;return _0xf36b50[_0xaa12('0x1f')](_0x2e271d,_0x372b8e)[_0xaa12('0x20')](function(_0x3b5022){logger[_0xaa12('0x21')]('SalesforceAccount,\x20%s,\x20%s',_0x436026,_0xaa12('0x22'));logger[_0xaa12('0x23')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x436026,_0xaa12('0x22'),JSON[_0xaa12('0x24')](_0x3b5022));if(_0x3b5022[_0xaa12('0x25')]){if(_0x3b5022[_0xaa12('0x25')]['code']===0x1f4){logger['error'](_0xaa12('0x26'),_0x436026,_0x3b5022[_0xaa12('0x25')]['message']);return _0x1d0139(_0x3b5022[_0xaa12('0x25')][_0xaa12('0x27')]);}logger[_0xaa12('0x25')](_0xaa12('0x26'),_0x436026,_0x3b5022[_0xaa12('0x25')]['message']);return _0x5d7ef2(_0x3b5022[_0xaa12('0x25')]['message']);}else{logger[_0xaa12('0x21')]('SalesforceAccount,\x20%s,\x20%s',_0x436026,_0xaa12('0x22'));_0x5d7ef2(_0x3b5022[_0xaa12('0x28')][_0xaa12('0x27')]);}})[_0xaa12('0x29')](function(_0x9e76d5){logger[_0xaa12('0x25')](_0xaa12('0x26'),_0x436026,_0x9e76d5);_0x1d0139(_0x9e76d5);});});}function respondWithStatusCode(_0x29cbd5,_0x3754e0){_0x3754e0=_0x3754e0||0xcc;return function(_0x3f134c){if(_0x3f134c){return _0x29cbd5['sendStatus'](_0x3754e0);}return _0x29cbd5['status'](_0x3754e0)['end']();};}function respondWithResult(_0x3a966c,_0x314cfe){_0x314cfe=_0x314cfe||0xc8;return function(_0x42d6da){if(_0x42d6da){return _0x3a966c['status'](_0x314cfe)[_0xaa12('0x2a')](_0x42d6da);}};}function respondWithFilteredResult(_0x519ec6,_0x257ffa){return function(_0x578151){if(_0x578151){var _0x90b43d=_0x578151[_0xaa12('0x2b')],_0x409d52=_0x257ffa[_0xaa12('0x2c')],_0x32636e=_0x257ffa[_0xaa12('0x2c')]+_0x257ffa['limit'],_0x9d8c1f;if(_0x32636e>=_0x90b43d){_0x32636e=_0x90b43d;_0x9d8c1f=0xc8;}else{_0x9d8c1f=0xce;}_0x519ec6['status'](_0x9d8c1f);return _0x519ec6['set']('Content-Range',_0x409d52+'-'+_0x32636e+'/'+_0x90b43d)['json'](_0x578151);}return null;};}function patchUpdates(_0x3e1a2b){return function(_0x595f76){try{jsonpatch[_0xaa12('0x2d')](_0x595f76,_0x3e1a2b,!![]);}catch(_0x33b998){return BPromise[_0xaa12('0x2e')](_0x33b998);}return _0x595f76[_0xaa12('0x2f')]();};}function saveUpdates(_0x1cd540,_0x5db808){return function(_0x3baa63){if(_0x3baa63){return _0x3baa63[_0xaa12('0x30')](_0x1cd540)['then'](function(_0x113976){return _0x113976;});}return null;};}function removeEntity(_0x31381e,_0x574ace){return function(_0x281573){if(_0x281573){return _0x281573['destroy']()[_0xaa12('0x20')](function(){_0x31381e[_0xaa12('0x31')](0xcc)[_0xaa12('0x32')]();});}};}function handleEntityNotFound(_0x233e7a,_0xa1e031){return function(_0x3804af){if(!_0x3804af){_0x233e7a[_0xaa12('0x33')](0x194);}return _0x3804af;};}function handleError(_0x584753,_0x34781a){_0x34781a=_0x34781a||0x1f4;return function(_0x5ad91e){logger[_0xaa12('0x25')](_0x5ad91e[_0xaa12('0x34')]);if(_0x5ad91e['name']){delete _0x5ad91e['name'];}_0x584753[_0xaa12('0x31')](_0x34781a)[_0xaa12('0x35')](_0x5ad91e);};}exports[_0xaa12('0x36')]=function(_0x29e7f1,_0x5caa49){var _0x4e5ff2={},_0x46572f={},_0x46bd88={'count':0x0,'rows':[]};var _0x14b1b7=_[_0xaa12('0x37')](db['SalesforceAccount'][_0xaa12('0x38')],function(_0x4417dd){return{'name':_0x4417dd['fieldName'],'type':_0x4417dd['type']['key']};});_0x46572f['model']=_[_0xaa12('0x37')](_0x14b1b7,_0xaa12('0x39'));_0x46572f[_0xaa12('0x3a')]=_['keys'](_0x29e7f1[_0xaa12('0x3a')]);_0x46572f[_0xaa12('0x3b')]=_['intersection'](_0x46572f[_0xaa12('0x3c')],_0x46572f[_0xaa12('0x3a')]);_0x4e5ff2[_0xaa12('0x3d')]=_[_0xaa12('0x3e')](_0x46572f[_0xaa12('0x3c')],qs[_0xaa12('0x3f')](_0x29e7f1[_0xaa12('0x3a')][_0xaa12('0x3f')]));_0x4e5ff2[_0xaa12('0x3d')]=_0x4e5ff2['attributes'][_0xaa12('0x40')]?_0x4e5ff2[_0xaa12('0x3d')]:_0x46572f[_0xaa12('0x3c')];if(!_0x29e7f1[_0xaa12('0x3a')][_0xaa12('0x41')](_0xaa12('0x42'))){_0x4e5ff2[_0xaa12('0x43')]=qs[_0xaa12('0x43')](_0x29e7f1[_0xaa12('0x3a')][_0xaa12('0x43')]);_0x4e5ff2['offset']=qs[_0xaa12('0x2c')](_0x29e7f1[_0xaa12('0x3a')][_0xaa12('0x2c')]);}_0x4e5ff2['order']=qs['sort'](_0x29e7f1[_0xaa12('0x3a')][_0xaa12('0x44')]);_0x4e5ff2[_0xaa12('0x45')]=qs[_0xaa12('0x3b')](_[_0xaa12('0x46')](_0x29e7f1[_0xaa12('0x3a')],_0x46572f['filters']),_0x14b1b7);if(_0x29e7f1['query'][_0xaa12('0x47')]){_0x4e5ff2['where']=_['merge'](_0x4e5ff2[_0xaa12('0x45')],{'$or':_[_0xaa12('0x37')](_0x14b1b7,function(_0x1dfc42){if(_0x1dfc42[_0xaa12('0x48')]!=='VIRTUAL'){var _0x384914={};_0x384914[_0x1dfc42['name']]={'$like':'%'+_0x29e7f1['query']['filter']+'%'};return _0x384914;}})});}_0x4e5ff2=_[_0xaa12('0x49')]({},_0x4e5ff2,_0x29e7f1[_0xaa12('0x4a')]);var _0x2a83fb={'where':_0x4e5ff2[_0xaa12('0x45')]};return db[_0xaa12('0x4b')]['count'](_0x2a83fb)[_0xaa12('0x20')](function(_0xe17815){_0x46bd88[_0xaa12('0x2b')]=_0xe17815;if(_0x29e7f1['query'][_0xaa12('0x4c')]){_0x4e5ff2[_0xaa12('0x4d')]=[{'all':!![]}];}return db[_0xaa12('0x4b')][_0xaa12('0x4e')](_0x4e5ff2);})[_0xaa12('0x20')](function(_0x447099){_0x46bd88[_0xaa12('0x4f')]=_0x447099;return _0x46bd88;})[_0xaa12('0x20')](respondWithFilteredResult(_0x5caa49,_0x4e5ff2))['catch'](handleError(_0x5caa49,null));};exports[_0xaa12('0x50')]=function(_0x2dce5b,_0x1f7d10){var _0x117897={'raw':![],'where':{'id':_0x2dce5b[_0xaa12('0x51')]['id']}},_0x5e824f={};_0x5e824f[_0xaa12('0x3c')]=_[_0xaa12('0x52')](db['SalesforceAccount'][_0xaa12('0x38')]);_0x5e824f[_0xaa12('0x3a')]=_[_0xaa12('0x52')](_0x2dce5b[_0xaa12('0x3a')]);_0x5e824f[_0xaa12('0x3b')]=_[_0xaa12('0x3e')](_0x5e824f[_0xaa12('0x3c')],_0x5e824f['query']);_0x117897[_0xaa12('0x3d')]=_['intersection'](_0x5e824f[_0xaa12('0x3c')],qs[_0xaa12('0x3f')](_0x2dce5b[_0xaa12('0x3a')][_0xaa12('0x3f')]));_0x117897[_0xaa12('0x3d')]=_0x117897[_0xaa12('0x3d')]['length']?_0x117897[_0xaa12('0x3d')]:_0x5e824f[_0xaa12('0x3c')];if(_0x2dce5b[_0xaa12('0x3a')][_0xaa12('0x4c')]){_0x117897[_0xaa12('0x4d')]=[{'all':!![]}];}_0x117897=_[_0xaa12('0x49')]({},_0x117897,_0x2dce5b[_0xaa12('0x4a')]);return db[_0xaa12('0x4b')][_0xaa12('0x53')](_0x117897)[_0xaa12('0x20')](handleEntityNotFound(_0x1f7d10,null))['then'](respondWithResult(_0x1f7d10,null))[_0xaa12('0x29')](handleError(_0x1f7d10,null));};exports[_0xaa12('0x54')]=function(_0x4747b5,_0x14b26a){return db[_0xaa12('0x4b')][_0xaa12('0x54')](_0x4747b5[_0xaa12('0x55')],{})['then'](respondWithResult(_0x14b26a,0xc9))[_0xaa12('0x29')](handleError(_0x14b26a,null));};exports[_0xaa12('0x30')]=function(_0x2639ce,_0x7966b9){if(_0x2639ce[_0xaa12('0x55')]['id']){delete _0x2639ce[_0xaa12('0x55')]['id'];}return db['SalesforceAccount'][_0xaa12('0x53')]({'where':{'id':_0x2639ce[_0xaa12('0x51')]['id']}})['then'](handleEntityNotFound(_0x7966b9,null))[_0xaa12('0x20')](saveUpdates(_0x2639ce[_0xaa12('0x55')],null))[_0xaa12('0x20')](respondWithResult(_0x7966b9,null))[_0xaa12('0x29')](handleError(_0x7966b9,null));};exports[_0xaa12('0x56')]=function(_0x3508c0,_0xae3cef){return db[_0xaa12('0x4b')][_0xaa12('0x53')]({'where':{'id':_0x3508c0[_0xaa12('0x51')]['id']}})[_0xaa12('0x20')](handleEntityNotFound(_0xae3cef,null))['then'](removeEntity(_0xae3cef,null))[_0xaa12('0x29')](handleError(_0xae3cef,null));};exports[_0xaa12('0x57')]=function(_0x2e5127,_0x25c376,_0x383b62){var _0x145bdd={};var _0x25ca19={};var _0x6342a9;var _0x2ad1e5;return db[_0xaa12('0x4b')][_0xaa12('0x58')]({'where':{'id':_0x2e5127['params']['id']}})['then'](handleEntityNotFound(_0x25c376,null))[_0xaa12('0x20')](function(_0xb7cec9){if(_0xb7cec9){_0x6342a9=_0xb7cec9;_0x25ca19[_0xaa12('0x3c')]=_[_0xaa12('0x52')](db[_0xaa12('0x59')][_0xaa12('0x38')]);_0x25ca19[_0xaa12('0x3a')]=_[_0xaa12('0x52')](_0x2e5127[_0xaa12('0x3a')]);_0x25ca19['filters']=_[_0xaa12('0x3e')](_0x25ca19[_0xaa12('0x3c')],_0x25ca19[_0xaa12('0x3a')]);_0x145bdd[_0xaa12('0x3d')]=_[_0xaa12('0x3e')](_0x25ca19[_0xaa12('0x3c')],qs[_0xaa12('0x3f')](_0x2e5127['query'][_0xaa12('0x3f')]));_0x145bdd[_0xaa12('0x3d')]=_0x145bdd['attributes']['length']?_0x145bdd[_0xaa12('0x3d')]:_0x25ca19[_0xaa12('0x3c')];_0x145bdd[_0xaa12('0x5a')]=qs['sort'](_0x2e5127[_0xaa12('0x3a')][_0xaa12('0x44')]);_0x145bdd[_0xaa12('0x45')]=qs['filters'](_[_0xaa12('0x46')](_0x2e5127[_0xaa12('0x3a')],_0x25ca19[_0xaa12('0x3b')]));if(_0x2e5127[_0xaa12('0x3a')][_0xaa12('0x47')]){_0x145bdd['where']=_[_0xaa12('0x49')](_0x145bdd[_0xaa12('0x45')],{'$or':_[_0xaa12('0x37')](_0x145bdd[_0xaa12('0x3d')],function(_0x5124e8){var _0x4ea0a3={};_0x4ea0a3[_0x5124e8]={'$like':'%'+_0x2e5127[_0xaa12('0x3a')][_0xaa12('0x47')]+'%'};return _0x4ea0a3;})});}_0x145bdd=_[_0xaa12('0x49')]({},_0x145bdd,_0x2e5127[_0xaa12('0x4a')]);return _0x6342a9[_0xaa12('0x57')](_0x145bdd);}})[_0xaa12('0x20')](function(_0x479db3){if(_0x479db3){_0x2ad1e5=_0x479db3[_0xaa12('0x40')];if(!_0x2e5127['query'][_0xaa12('0x41')](_0xaa12('0x42'))){_0x145bdd['limit']=qs[_0xaa12('0x43')](_0x2e5127['query'][_0xaa12('0x43')]);_0x145bdd[_0xaa12('0x2c')]=qs[_0xaa12('0x2c')](_0x2e5127['query'][_0xaa12('0x2c')]);}return _0x6342a9[_0xaa12('0x57')](_0x145bdd);}})[_0xaa12('0x20')](function(_0x467c77){if(_0x467c77){return _0x467c77?{'count':_0x2ad1e5,'rows':_0x467c77}:null;}})['then'](respondWithResult(_0x25c376,null))[_0xaa12('0x29')](handleError(_0x25c376,null));};exports['addConfiguration']=function(_0x1745f9,_0x3d030a,_0x515726){if(_0x1745f9[_0xaa12('0x55')]['id']){delete _0x1745f9['body']['id'];}return db[_0xaa12('0x4b')]['findOne']({'where':{'id':_0x1745f9[_0xaa12('0x51')]['id']}})[_0xaa12('0x20')](handleEntityNotFound(_0x3d030a,null))[_0xaa12('0x20')](function(_0x10ffe9){if(_0x10ffe9){_0x1745f9['body'][_0xaa12('0x5b')]=_0x10ffe9['id'];_0x1745f9['body'][_0xaa12('0x5c')]=integrations[_0xaa12('0x5d')](_0x1745f9[_0xaa12('0x55')][_0xaa12('0x5e')],_0x1745f9['body'][_0xaa12('0x48')]);_0x1745f9[_0xaa12('0x55')]['Descriptions']=integrations['getDescriptions'](_0x1745f9[_0xaa12('0x55')][_0xaa12('0x5e')],_0x1745f9['body']['type']);return db[_0xaa12('0x59')][_0xaa12('0x54')](_0x1745f9[_0xaa12('0x55')],{'include':[{'model':db[_0xaa12('0x5f')],'as':_0xaa12('0x5c')},{'model':db[_0xaa12('0x5f')],'as':_0xaa12('0x60')}]});}return null;})[_0xaa12('0x20')](respondWithResult(_0x3d030a,null))['catch'](handleError(_0x3d030a,null));};exports['getFields']=function(_0x581c89,_0x45c7dd,_0x45b22d){var _0x5ebc1e;var _0x433028='';var _0x3afd95=_0xaa12('0x61');return db[_0xaa12('0x4b')][_0xaa12('0x58')]({'where':{'id':_0x581c89[_0xaa12('0x51')]['id']},'attributes':['id',_0xaa12('0x62'),_0xaa12('0x63'),_0xaa12('0x64'),_0xaa12('0x65'),_0xaa12('0x66'),'securityToken']})['then'](handleEntityNotFound(_0x45c7dd,null))[_0xaa12('0x20')](function(_0x334ca9){if(_0x334ca9){_0x433028=_0x334ca9['remoteUri'];var _0x49da61=_0x433028[_0xaa12('0x67')](-0x1);if(_0x49da61==='/'){_0x433028=_0x433028[_0xaa12('0x68')](0x0,_0x433028[_0xaa12('0x69')](_0x49da61));}_0x5ebc1e=new jsforce[(_0xaa12('0x6a'))]({'oauth2':{'loginUrl':_0x433028,'clientId':_0x334ca9[_0xaa12('0x63')],'clientSecret':_0x334ca9[_0xaa12('0x64')]}});return _0x5ebc1e['login'](_0x334ca9[_0xaa12('0x65')],_0x334ca9[_0xaa12('0x66')][_0xaa12('0x6b')](_0x334ca9['securityToken']));}})[_0xaa12('0x20')](function(_0x3d8a8f){if(_0x3d8a8f){if(!_[_0xaa12('0x6c')](_0x581c89[_0xaa12('0x3a')][_0xaa12('0x6d')])){_0x3afd95=_0x581c89[_0xaa12('0x3a')][_0xaa12('0x6d')];}return _0x5ebc1e[_0xaa12('0x6e')](_0x3afd95)[_0xaa12('0x6f')]();}})['then'](function(_0x2f94b7){var _0x5c068e=[_0xaa12('0x70'),'CallDurationInSeconds','CallObject',_0xaa12('0x71'),_0xaa12('0x72'),'Priority','Status',_0xaa12('0x73')];if(!_['isNil'](_0x581c89[_0xaa12('0x3a')][_0xaa12('0x6d')])&&_0x581c89[_0xaa12('0x3a')][_0xaa12('0x6d')]===_0xaa12('0x74')){_0x5c068e=[_0xaa12('0x73'),'Origin',_0xaa12('0x75'),_0xaa12('0x76'),_0xaa12('0x77'),'IsEscalated',_0xaa12('0x78'),'SuppliedCompany'];}if(_0x2f94b7){_[_0xaa12('0x79')](_0x2f94b7[_0xaa12('0x3f')],function(_0x2db248){return _0x2db248['custom']===![]&&!_0x5c068e[_0xaa12('0x7a')](_0x2db248['name']);});return{'count':_0x2f94b7[_0xaa12('0x3f')]['length'],'rows':_[_0xaa12('0x37')](_0x2f94b7[_0xaa12('0x3f')],function(_0x329998){return{'id':_0x329998['name'],'name':_0x329998['label'],'custom':_0x329998['custom'],'options':_0x329998[_0xaa12('0x7b')][_0xaa12('0x40')]>0x0?_[_0xaa12('0x37')](_0x329998[_0xaa12('0x7b')],function(_0x3c3636){return{'name':_0x3c3636[_0xaa12('0x7c')],'value':_0x3c3636[_0xaa12('0x7d')]};}):_0x329998[_0xaa12('0x48')]==_0xaa12('0x7e')?[{'name':'True','value':'true'},{'name':_0xaa12('0x7f'),'value':_0xaa12('0x80')}]:[]};})};}})['then'](respondWithResult(_0x45c7dd,null))['catch'](function(_0x8148dc){var _0x47a872=_0x581c89[_0xaa12('0x3a')][_0xaa12('0x1b')]?0x1f4:_0x8148dc[_0xaa12('0x81')]||0x1f4;logger[_0xaa12('0x25')](_0xaa12('0x82'),'getFields',_0x47a872,JSON[_0xaa12('0x24')](_0x8148dc));delete _0x8148dc[_0xaa12('0x39')];if(_0x47a872===0x191){_0x47a872=0x190;}_0x45c7dd['status'](_0x47a872)[_0xaa12('0x35')](_0x581c89[_0xaa12('0x3a')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x8148dc[_0xaa12('0x81')]}:_0x8148dc);});}; \ No newline at end of file +var _0x7db6=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','getConfigurations','findOne','addConfiguration','AccountId','getSubjects','channel','getDescriptions','SalesforceConfiguration','SalesforceField','Task','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','login','concat','isNil','ticketType','describe','CallDisposition','CallDurationInSeconds','CallType','IsArchived','Status','Type','Origin','Reason','Priority','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues','true','False','false','statusCode','getFields','stringify','Wrong\x20credentials','html-pdf','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','stack','name','send','index','map','SalesforceAccount','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x1ad41d,_0x1e8af9){var _0x2899f7=function(_0x3f514f){while(--_0x3f514f){_0x1ad41d['push'](_0x1ad41d['shift']());}};_0x2899f7(++_0x1e8af9);}(_0x7db6,0x14c));var _0x67db=function(_0x38ac0c,_0x5b11ec){_0x38ac0c=_0x38ac0c-0x0;var _0x173e56=_0x7db6[_0x38ac0c];return _0x173e56;};'use strict';var pdf=require(_0x67db('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x67db('0x1'));var Mustache=require(_0x67db('0x2'));var util=require(_0x67db('0x3'));var path=require(_0x67db('0x4'));var sox=require(_0x67db('0x5'));var csv=require(_0x67db('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x67db('0x7'));var squel=require(_0x67db('0x8'));var crypto=require(_0x67db('0x9'));var jsforce=require(_0x67db('0xa'));var deskjs=require(_0x67db('0xb'));var toCsv=require(_0x67db('0x6'));var querystring=require(_0x67db('0xc'));var Papa=require(_0x67db('0xd'));var Redis=require(_0x67db('0xe'));var authService=require(_0x67db('0xf'));var qs=require(_0x67db('0x10'));var as=require(_0x67db('0x11'));var hardwareService=require(_0x67db('0x12'));var logger=require('../../config/logger')(_0x67db('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x67db('0x14'));var jayson=require(_0x67db('0x15'));var client=jayson[_0x67db('0x16')][_0x67db('0x17')]({'port':0x232a});function checkPasswordPattern(_0x2d3855,_0x367ceb,_0x2e5f64){if(_0x2e5f64){var _0xa1ff36=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa1ff36[_0x67db('0x18')](_0x367ceb)){return _0x2d3855;}else{throw new db['Sequelize'][(_0x67db('0x19'))](_0x67db('0x1a'));}}else{return _0x2d3855;}}function respondWithRpcPromise(_0x490184,_0x1f97b4,_0x1216a5,_0x3d28ef){return new BPromise(function(_0x401eaa,_0x157c9e){var _0x366261=_0x3d28ef||client;return _0x366261[_0x67db('0x1b')](_0x490184,_0x1216a5)['then'](function(_0x43fbb3){logger[_0x67db('0x1c')](_0x67db('0x1d'),_0x1f97b4,_0x67db('0x1e'));logger[_0x67db('0x1f')](_0x67db('0x20'),_0x1f97b4,'request\x20sent',JSON['stringify'](_0x43fbb3));if(_0x43fbb3['error']){if(_0x43fbb3[_0x67db('0x21')][_0x67db('0x22')]===0x1f4){logger[_0x67db('0x21')](_0x67db('0x1d'),_0x1f97b4,_0x43fbb3[_0x67db('0x21')][_0x67db('0x23')]);return _0x157c9e(_0x43fbb3[_0x67db('0x21')][_0x67db('0x23')]);}logger['error'](_0x67db('0x1d'),_0x1f97b4,_0x43fbb3[_0x67db('0x21')][_0x67db('0x23')]);return _0x401eaa(_0x43fbb3[_0x67db('0x21')][_0x67db('0x23')]);}else{logger[_0x67db('0x1c')]('SalesforceAccount,\x20%s,\x20%s',_0x1f97b4,_0x67db('0x1e'));_0x401eaa(_0x43fbb3[_0x67db('0x24')]['message']);}})['catch'](function(_0x241292){logger[_0x67db('0x21')](_0x67db('0x1d'),_0x1f97b4,_0x241292);_0x157c9e(_0x241292);});});}function respondWithStatusCode(_0x296e94,_0xc22252){_0xc22252=_0xc22252||0xcc;return function(_0x29f79a){if(_0x29f79a){return _0x296e94[_0x67db('0x25')](_0xc22252);}return _0x296e94[_0x67db('0x26')](_0xc22252)[_0x67db('0x27')]();};}function respondWithResult(_0x484572,_0x43d6fe){_0x43d6fe=_0x43d6fe||0xc8;return function(_0x11104c){if(_0x11104c){return _0x484572[_0x67db('0x26')](_0x43d6fe)[_0x67db('0x28')](_0x11104c);}};}function respondWithFilteredResult(_0x5f22dd,_0x198a2f){return function(_0x4706a7){if(_0x4706a7){var _0x576e03=_0x4706a7[_0x67db('0x29')],_0xca40c4=_0x198a2f[_0x67db('0x2a')],_0x52477f=_0x198a2f[_0x67db('0x2a')]+_0x198a2f[_0x67db('0x2b')],_0x1f6d0c;if(_0x52477f>=_0x576e03){_0x52477f=_0x576e03;_0x1f6d0c=0xc8;}else{_0x1f6d0c=0xce;}_0x5f22dd[_0x67db('0x26')](_0x1f6d0c);return _0x5f22dd['set']('Content-Range',_0xca40c4+'-'+_0x52477f+'/'+_0x576e03)['json'](_0x4706a7);}return null;};}function patchUpdates(_0x424ad2){return function(_0x3c9b6a){try{jsonpatch[_0x67db('0x2c')](_0x3c9b6a,_0x424ad2,!![]);}catch(_0x5bd28b){return BPromise[_0x67db('0x2d')](_0x5bd28b);}return _0x3c9b6a[_0x67db('0x2e')]();};}function saveUpdates(_0x5839ac,_0x5cbfff){return function(_0x3a2574){if(_0x3a2574){return _0x3a2574[_0x67db('0x2f')](_0x5839ac)[_0x67db('0x30')](function(_0x1c9a5e){return _0x1c9a5e;});}return null;};}function removeEntity(_0xd1c44d,_0xf3dcc2){return function(_0x17d19a){if(_0x17d19a){return _0x17d19a[_0x67db('0x31')]()['then'](function(){_0xd1c44d[_0x67db('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51c825,_0x36cf1d){return function(_0x43fa81){if(!_0x43fa81){_0x51c825[_0x67db('0x25')](0x194);}return _0x43fa81;};}function handleError(_0x388823,_0x516bea){_0x516bea=_0x516bea||0x1f4;return function(_0x24fb99){logger[_0x67db('0x21')](_0x24fb99[_0x67db('0x32')]);if(_0x24fb99[_0x67db('0x33')]){delete _0x24fb99[_0x67db('0x33')];}_0x388823[_0x67db('0x26')](_0x516bea)[_0x67db('0x34')](_0x24fb99);};}exports[_0x67db('0x35')]=function(_0x161702,_0x4c1ce4){var _0x3a5c3c={},_0xadedee={},_0x36976f={'count':0x0,'rows':[]};var _0x5bfb3f=_[_0x67db('0x36')](db[_0x67db('0x37')][_0x67db('0x38')],function(_0x66b22b){return{'name':_0x66b22b['fieldName'],'type':_0x66b22b[_0x67db('0x39')][_0x67db('0x3a')]};});_0xadedee[_0x67db('0x3b')]=_[_0x67db('0x36')](_0x5bfb3f,_0x67db('0x33'));_0xadedee[_0x67db('0x3c')]=_['keys'](_0x161702['query']);_0xadedee[_0x67db('0x3d')]=_['intersection'](_0xadedee[_0x67db('0x3b')],_0xadedee['query']);_0x3a5c3c[_0x67db('0x3e')]=_[_0x67db('0x3f')](_0xadedee[_0x67db('0x3b')],qs[_0x67db('0x40')](_0x161702['query']['fields']));_0x3a5c3c[_0x67db('0x3e')]=_0x3a5c3c[_0x67db('0x3e')][_0x67db('0x41')]?_0x3a5c3c[_0x67db('0x3e')]:_0xadedee[_0x67db('0x3b')];if(!_0x161702['query'][_0x67db('0x42')](_0x67db('0x43'))){_0x3a5c3c[_0x67db('0x2b')]=qs[_0x67db('0x2b')](_0x161702[_0x67db('0x3c')]['limit']);_0x3a5c3c[_0x67db('0x2a')]=qs['offset'](_0x161702[_0x67db('0x3c')][_0x67db('0x2a')]);}_0x3a5c3c[_0x67db('0x44')]=qs[_0x67db('0x45')](_0x161702[_0x67db('0x3c')][_0x67db('0x45')]);_0x3a5c3c[_0x67db('0x46')]=qs[_0x67db('0x3d')](_[_0x67db('0x47')](_0x161702[_0x67db('0x3c')],_0xadedee[_0x67db('0x3d')]),_0x5bfb3f);if(_0x161702[_0x67db('0x3c')][_0x67db('0x48')]){_0x3a5c3c[_0x67db('0x46')]=_[_0x67db('0x49')](_0x3a5c3c[_0x67db('0x46')],{'$or':_['map'](_0x5bfb3f,function(_0x2cb00e){if(_0x2cb00e['type']!==_0x67db('0x4a')){var _0x39978b={};_0x39978b[_0x2cb00e[_0x67db('0x33')]]={'$like':'%'+_0x161702[_0x67db('0x3c')][_0x67db('0x48')]+'%'};return _0x39978b;}})});}_0x3a5c3c=_[_0x67db('0x49')]({},_0x3a5c3c,_0x161702[_0x67db('0x4b')]);var _0x26bb15={'where':_0x3a5c3c[_0x67db('0x46')]};return db['SalesforceAccount']['count'](_0x26bb15)[_0x67db('0x30')](function(_0x57e03a){_0x36976f[_0x67db('0x29')]=_0x57e03a;if(_0x161702[_0x67db('0x3c')][_0x67db('0x4c')]){_0x3a5c3c[_0x67db('0x4d')]=[{'all':!![]}];}return db[_0x67db('0x37')][_0x67db('0x4e')](_0x3a5c3c);})[_0x67db('0x30')](function(_0x349e5e){_0x36976f[_0x67db('0x4f')]=_0x349e5e;return _0x36976f;})[_0x67db('0x30')](respondWithFilteredResult(_0x4c1ce4,_0x3a5c3c))[_0x67db('0x50')](handleError(_0x4c1ce4,null));};exports[_0x67db('0x51')]=function(_0x487433,_0x52dcf0){var _0x5eaef2={'raw':![],'where':{'id':_0x487433[_0x67db('0x52')]['id']}},_0x912bd1={};_0x912bd1[_0x67db('0x3b')]=_['keys'](db[_0x67db('0x37')][_0x67db('0x38')]);_0x912bd1[_0x67db('0x3c')]=_[_0x67db('0x53')](_0x487433[_0x67db('0x3c')]);_0x912bd1[_0x67db('0x3d')]=_[_0x67db('0x3f')](_0x912bd1[_0x67db('0x3b')],_0x912bd1[_0x67db('0x3c')]);_0x5eaef2[_0x67db('0x3e')]=_['intersection'](_0x912bd1['model'],qs['fields'](_0x487433[_0x67db('0x3c')][_0x67db('0x40')]));_0x5eaef2[_0x67db('0x3e')]=_0x5eaef2[_0x67db('0x3e')][_0x67db('0x41')]?_0x5eaef2[_0x67db('0x3e')]:_0x912bd1[_0x67db('0x3b')];if(_0x487433[_0x67db('0x3c')]['includeAll']){_0x5eaef2[_0x67db('0x4d')]=[{'all':!![]}];}_0x5eaef2=_['merge']({},_0x5eaef2,_0x487433[_0x67db('0x4b')]);return db[_0x67db('0x37')]['find'](_0x5eaef2)['then'](handleEntityNotFound(_0x52dcf0,null))[_0x67db('0x30')](respondWithResult(_0x52dcf0,null))[_0x67db('0x50')](handleError(_0x52dcf0,null));};exports[_0x67db('0x54')]=function(_0x3ce540,_0x2aac70){return db[_0x67db('0x37')][_0x67db('0x54')](_0x3ce540[_0x67db('0x55')],{})[_0x67db('0x30')](respondWithResult(_0x2aac70,0xc9))['catch'](handleError(_0x2aac70,null));};exports[_0x67db('0x2f')]=function(_0x44347c,_0x41d67d){if(_0x44347c[_0x67db('0x55')]['id']){delete _0x44347c['body']['id'];}return db[_0x67db('0x37')][_0x67db('0x56')]({'where':{'id':_0x44347c[_0x67db('0x52')]['id']}})[_0x67db('0x30')](handleEntityNotFound(_0x41d67d,null))['then'](saveUpdates(_0x44347c[_0x67db('0x55')],null))[_0x67db('0x30')](respondWithResult(_0x41d67d,null))['catch'](handleError(_0x41d67d,null));};exports[_0x67db('0x31')]=function(_0x21479e,_0x3459d9){return db[_0x67db('0x37')][_0x67db('0x56')]({'where':{'id':_0x21479e[_0x67db('0x52')]['id']}})['then'](handleEntityNotFound(_0x3459d9,null))[_0x67db('0x30')](removeEntity(_0x3459d9,null))['catch'](handleError(_0x3459d9,null));};exports[_0x67db('0x57')]=function(_0x5b508f,_0x2c8d0b,_0x2df005){var _0x46f01b={};var _0x5cff91={};var _0x169ed4;var _0x4b4901;return db['SalesforceAccount'][_0x67db('0x58')]({'where':{'id':_0x5b508f['params']['id']}})['then'](handleEntityNotFound(_0x2c8d0b,null))['then'](function(_0x1836b7){if(_0x1836b7){_0x169ed4=_0x1836b7;_0x5cff91[_0x67db('0x3b')]=_[_0x67db('0x53')](db['SalesforceConfiguration'][_0x67db('0x38')]);_0x5cff91[_0x67db('0x3c')]=_[_0x67db('0x53')](_0x5b508f['query']);_0x5cff91['filters']=_[_0x67db('0x3f')](_0x5cff91[_0x67db('0x3b')],_0x5cff91[_0x67db('0x3c')]);_0x46f01b[_0x67db('0x3e')]=_[_0x67db('0x3f')](_0x5cff91['model'],qs[_0x67db('0x40')](_0x5b508f['query']['fields']));_0x46f01b[_0x67db('0x3e')]=_0x46f01b['attributes'][_0x67db('0x41')]?_0x46f01b['attributes']:_0x5cff91[_0x67db('0x3b')];_0x46f01b['order']=qs[_0x67db('0x45')](_0x5b508f[_0x67db('0x3c')]['sort']);_0x46f01b[_0x67db('0x46')]=qs[_0x67db('0x3d')](_[_0x67db('0x47')](_0x5b508f[_0x67db('0x3c')],_0x5cff91[_0x67db('0x3d')]));if(_0x5b508f['query']['filter']){_0x46f01b[_0x67db('0x46')]=_[_0x67db('0x49')](_0x46f01b[_0x67db('0x46')],{'$or':_[_0x67db('0x36')](_0x46f01b[_0x67db('0x3e')],function(_0x45ea94){var _0x30bba2={};_0x30bba2[_0x45ea94]={'$like':'%'+_0x5b508f[_0x67db('0x3c')][_0x67db('0x48')]+'%'};return _0x30bba2;})});}_0x46f01b=_[_0x67db('0x49')]({},_0x46f01b,_0x5b508f[_0x67db('0x4b')]);return _0x169ed4[_0x67db('0x57')](_0x46f01b);}})[_0x67db('0x30')](function(_0x10fecb){if(_0x10fecb){_0x4b4901=_0x10fecb[_0x67db('0x41')];if(!_0x5b508f['query']['hasOwnProperty'](_0x67db('0x43'))){_0x46f01b[_0x67db('0x2b')]=qs[_0x67db('0x2b')](_0x5b508f[_0x67db('0x3c')][_0x67db('0x2b')]);_0x46f01b['offset']=qs['offset'](_0x5b508f[_0x67db('0x3c')][_0x67db('0x2a')]);}return _0x169ed4['getConfigurations'](_0x46f01b);}})[_0x67db('0x30')](function(_0x5ae076){if(_0x5ae076){return _0x5ae076?{'count':_0x4b4901,'rows':_0x5ae076}:null;}})['then'](respondWithResult(_0x2c8d0b,null))[_0x67db('0x50')](handleError(_0x2c8d0b,null));};exports[_0x67db('0x59')]=function(_0x3bebde,_0x4ea93a,_0x1923a3){if(_0x3bebde['body']['id']){delete _0x3bebde['body']['id'];}return db['SalesforceAccount'][_0x67db('0x58')]({'where':{'id':_0x3bebde['params']['id']}})['then'](handleEntityNotFound(_0x4ea93a,null))[_0x67db('0x30')](function(_0x218a5d){if(_0x218a5d){_0x3bebde[_0x67db('0x55')][_0x67db('0x5a')]=_0x218a5d['id'];_0x3bebde[_0x67db('0x55')]['Subjects']=integrations[_0x67db('0x5b')](_0x3bebde['body'][_0x67db('0x5c')],_0x3bebde[_0x67db('0x55')][_0x67db('0x39')]);_0x3bebde[_0x67db('0x55')]['Descriptions']=integrations[_0x67db('0x5d')](_0x3bebde['body'][_0x67db('0x5c')],_0x3bebde[_0x67db('0x55')]['type']);return db[_0x67db('0x5e')][_0x67db('0x54')](_0x3bebde[_0x67db('0x55')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x67db('0x5f')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4ea93a,null))[_0x67db('0x50')](handleError(_0x4ea93a,null));};exports['getFields']=function(_0x19df7d,_0x46c48e,_0x1cccd6){var _0x1b7a46;var _0x5d0f6b='';var _0x49f4b0=_0x67db('0x60');return db[_0x67db('0x37')][_0x67db('0x58')]({'where':{'id':_0x19df7d[_0x67db('0x52')]['id']},'attributes':['id','remoteUri',_0x67db('0x61'),_0x67db('0x62'),_0x67db('0x63'),_0x67db('0x64'),_0x67db('0x65')]})[_0x67db('0x30')](handleEntityNotFound(_0x46c48e,null))[_0x67db('0x30')](function(_0x51fde1){if(_0x51fde1){_0x5d0f6b=_0x51fde1['remoteUri'];var _0x1914c0=_0x5d0f6b[_0x67db('0x66')](-0x1);if(_0x1914c0==='/'){_0x5d0f6b=_0x5d0f6b[_0x67db('0x67')](0x0,_0x5d0f6b[_0x67db('0x68')](_0x1914c0));}_0x1b7a46=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5d0f6b,'clientId':_0x51fde1[_0x67db('0x61')],'clientSecret':_0x51fde1[_0x67db('0x62')]}});return _0x1b7a46[_0x67db('0x69')](_0x51fde1[_0x67db('0x63')],_0x51fde1['password'][_0x67db('0x6a')](_0x51fde1[_0x67db('0x65')]));}})[_0x67db('0x30')](function(_0x12cfce){if(_0x12cfce){if(!_[_0x67db('0x6b')](_0x19df7d['query'][_0x67db('0x6c')])){_0x49f4b0=_0x19df7d[_0x67db('0x3c')][_0x67db('0x6c')];}return _0x1b7a46['sobject'](_0x49f4b0)[_0x67db('0x6d')]();}})['then'](function(_0x50bcd4){var _0x485d82=[_0x67db('0x6e'),_0x67db('0x6f'),'CallObject',_0x67db('0x70'),_0x67db('0x71'),'Priority',_0x67db('0x72'),_0x67db('0x73')];if(!_['isNil'](_0x19df7d[_0x67db('0x3c')]['ticketType'])&&_0x19df7d[_0x67db('0x3c')][_0x67db('0x6c')]==='Case'){_0x485d82=[_0x67db('0x73'),_0x67db('0x74'),_0x67db('0x75'),_0x67db('0x72'),_0x67db('0x76'),_0x67db('0x77'),_0x67db('0x78'),_0x67db('0x79')];}if(_0x50bcd4){_[_0x67db('0x7a')](_0x50bcd4[_0x67db('0x40')],function(_0x329eee){return _0x329eee[_0x67db('0x7b')]===![]&&!_0x485d82[_0x67db('0x7c')](_0x329eee[_0x67db('0x33')]);});return{'count':_0x50bcd4[_0x67db('0x40')]['length'],'rows':_['map'](_0x50bcd4[_0x67db('0x40')],function(_0x14570f){return{'id':_0x14570f[_0x67db('0x33')],'name':_0x14570f[_0x67db('0x7d')],'custom':_0x14570f[_0x67db('0x7b')],'options':_0x14570f[_0x67db('0x7e')][_0x67db('0x41')]>0x0?_[_0x67db('0x36')](_0x14570f['picklistValues'],function(_0x2b6452){return{'name':_0x2b6452[_0x67db('0x7d')],'value':_0x2b6452['value']};}):_0x14570f[_0x67db('0x39')]=='boolean'?[{'name':'True','value':_0x67db('0x7f')},{'name':_0x67db('0x80'),'value':_0x67db('0x81')}]:[]};})};}})[_0x67db('0x30')](respondWithResult(_0x46c48e,null))[_0x67db('0x50')](function(_0x266fe0){var _0x5ece64=_0x19df7d[_0x67db('0x3c')]['test']?0x1f4:_0x266fe0[_0x67db('0x82')]||0x1f4;logger[_0x67db('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0x67db('0x83'),_0x5ece64,JSON[_0x67db('0x84')](_0x266fe0));delete _0x266fe0[_0x67db('0x33')];if(_0x5ece64===0x191){_0x5ece64=0x190;}_0x46c48e[_0x67db('0x26')](_0x5ece64)[_0x67db('0x34')](_0x19df7d[_0x67db('0x3c')][_0x67db('0x18')]?{'message':_0x67db('0x85'),'statusCode':_0x266fe0[_0x67db('0x82')]}:_0x266fe0);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 53142a8..f2e2c8f 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 _0x4f71=['api','moment','bluebird','request-promise','rimraf','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','../../config/logger'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0x4f71,0x6d));var _0x14f7=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x4f71[_0x4709c0];return _0x13348b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x14f7('0x0'))(_0x14f7('0x1'));var moment=require(_0x14f7('0x2'));var BPromise=require(_0x14f7('0x3'));var rp=require(_0x14f7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x14f7('0x5'));var config=require('../../config/environment');var attributes=require(_0x14f7('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x14f7('0x7')]=function(_0x2b2874,_0x24b398){return _0x2b2874[_0x14f7('0x8')](_0x14f7('0x9'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67be=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x1e6136,_0x15dd13){var _0x162584=function(_0x134c48){while(--_0x134c48){_0x1e6136['push'](_0x1e6136['shift']());}};_0x162584(++_0x15dd13);}(_0x67be,0x181));var _0xe67b=function(_0x1e099e,_0x312966){_0x1e099e=_0x1e099e-0x0;var _0x561385=_0x67be[_0x1e099e];return _0x561385;};'use strict';var _=require(_0xe67b('0x0'));var util=require(_0xe67b('0x1'));var logger=require(_0xe67b('0x2'))(_0xe67b('0x3'));var moment=require(_0xe67b('0x4'));var BPromise=require(_0xe67b('0x5'));var rp=require(_0xe67b('0x6'));var fs=require('fs');var path=require(_0xe67b('0x7'));var rimraf=require(_0xe67b('0x8'));var config=require(_0xe67b('0x9'));var attributes=require(_0xe67b('0xa'));var integrations=require(_0xe67b('0xb'));module[_0xe67b('0xc')]=function(_0x4f86fb,_0x2593b6){return _0x4f86fb['define'](_0xe67b('0xd'),attributes,{'tableName':_0xe67b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index b1fe2ea..4e91f89 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 _0x5c12=['request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','info','options','raw','attributes','include','map','model','GetSalesforceAccount','catch','ShowSalesforceAccount','SalesforceAccount','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x508c32,_0x42027c){var _0x265274=function(_0x53ea22){while(--_0x53ea22){_0x508c32['push'](_0x508c32['shift']());}};_0x265274(++_0x42027c);}(_0x5c12,0x188));var _0x25c1=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x5c12[_0x2b9b7f];return _0x4ed19a;};'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']('SalesforceAccount,\x20%s,\x20%s',_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x24981c(_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);}else{logger[_0x25c1('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x4ab674,_0x25c1('0xe'));_0x24981c(_0xf8363f['result']['message']);}})['catch'](function(_0x284712){logger[_0x25c1('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x4ab674,_0x284712);_0x3b69ba(_0x284712);});});}exports['GetSalesforceAccount']=function(_0x61a29f){var _0x4c0d49=this;return new Promise(function(_0x7175d4,_0x23a418){return db['SalesforceAccount']['findAll']({'raw':_0x61a29f['options']?_0x61a29f[_0x25c1('0x14')][_0x25c1('0x15')]===undefined?!![]:![]:!![],'where':_0x61a29f[_0x25c1('0x14')]?_0x61a29f[_0x25c1('0x14')]['where']||null:null,'attributes':_0x61a29f[_0x25c1('0x14')]?_0x61a29f[_0x25c1('0x14')][_0x25c1('0x16')]||null:null,'limit':_0x61a29f[_0x25c1('0x14')]?_0x61a29f['options']['limit']||null:null,'include':_0x61a29f[_0x25c1('0x14')]?_0x61a29f[_0x25c1('0x14')][_0x25c1('0x17')]?_[_0x25c1('0x18')](_0x61a29f[_0x25c1('0x14')][_0x25c1('0x17')],function(_0x2ba595){return{'model':db[_0x2ba595[_0x25c1('0x19')]],'as':_0x2ba595['as'],'attributes':_0x2ba595[_0x25c1('0x16')],'include':_0x2ba595[_0x25c1('0x17')]?_[_0x25c1('0x18')](_0x2ba595[_0x25c1('0x17')],function(_0x399d72){return{'model':db[_0x399d72['model']],'as':_0x399d72['as'],'attributes':_0x399d72[_0x25c1('0x16')],'include':_0x399d72[_0x25c1('0x17')]?_[_0x25c1('0x18')](_0x399d72[_0x25c1('0x17')],function(_0x21fdb8){return{'model':db[_0x21fdb8[_0x25c1('0x19')]],'as':_0x21fdb8['as'],'attributes':_0x21fdb8['attributes']};}):[]};}):[]};}):[]:[]})[_0x25c1('0xc')](function(_0x428ce8){logger[_0x25c1('0x13')](_0x25c1('0x1a'),_0x61a29f);logger[_0x25c1('0xf')](_0x25c1('0x1a'),_0x61a29f,JSON['stringify'](_0x428ce8));_0x7175d4(_0x428ce8);})[_0x25c1('0x1b')](function(_0x478f1e){logger[_0x25c1('0x11')](_0x25c1('0x1a'),_0x478f1e[_0x25c1('0x12')],_0x61a29f);_0x23a418(_0x4c0d49[_0x25c1('0x11')](0x1f4,_0x478f1e[_0x25c1('0x12')]));});});};exports[_0x25c1('0x1c')]=function(_0x1fd4e3){var _0x23f2f6=this;return new Promise(function(_0x402f32,_0x4d9882){return db[_0x25c1('0x1d')]['find']({'raw':_0x1fd4e3['options']?_0x1fd4e3[_0x25c1('0x14')][_0x25c1('0x15')]===undefined?!![]:![]:!![],'where':_0x1fd4e3['options']?_0x1fd4e3[_0x25c1('0x14')]['where']||null:null,'attributes':_0x1fd4e3[_0x25c1('0x14')]?_0x1fd4e3['options'][_0x25c1('0x16')]||null:null,'include':_0x1fd4e3[_0x25c1('0x14')]?_0x1fd4e3[_0x25c1('0x14')][_0x25c1('0x17')]?_[_0x25c1('0x18')](_0x1fd4e3[_0x25c1('0x14')][_0x25c1('0x17')],function(_0x167477){return{'model':db[_0x167477['model']],'as':_0x167477['as'],'attributes':_0x167477[_0x25c1('0x16')],'include':_0x167477['include']?_[_0x25c1('0x18')](_0x167477['include'],function(_0x439056){return{'model':db[_0x439056[_0x25c1('0x19')]],'as':_0x439056['as'],'attributes':_0x439056[_0x25c1('0x16')],'include':_0x439056[_0x25c1('0x17')]?_[_0x25c1('0x18')](_0x439056[_0x25c1('0x17')],function(_0x35e632){return{'model':db[_0x35e632[_0x25c1('0x19')]],'as':_0x35e632['as'],'attributes':_0x35e632[_0x25c1('0x16')]};}):[]};}):[]};}):[]:[]})[_0x25c1('0xc')](function(_0x26ed98){logger[_0x25c1('0x13')](_0x25c1('0x1c'),_0x1fd4e3);logger[_0x25c1('0xf')](_0x25c1('0x1c'),_0x1fd4e3,JSON[_0x25c1('0x1e')](_0x26ed98));_0x402f32(_0x26ed98);})[_0x25c1('0x1b')](function(_0x30b1d7){logger[_0x25c1('0x11')](_0x25c1('0x1c'),_0x30b1d7['message'],_0x1fd4e3);_0x4d9882(_0x23f2f6[_0x25c1('0x11')](0x1f4,_0x30b1d7[_0x25c1('0x12')]));});});}; \ No newline at end of file +var _0xedd9=['attributes','limit','map','include','model','ShowSalesforceAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','raw','options'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xedd9,0xfc));var _0x9edd=function(_0x27f1a0,_0x351e9d){_0x27f1a0=_0x27f1a0-0x0;var _0x10183f=_0xedd9[_0x27f1a0];return _0x10183f;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});}exports[_0x9edd('0x17')]=function(_0x40ba32){var _0x4d8f33=this;return new Promise(function(_0x43dc70,_0x5d879c){return db[_0x9edd('0x18')][_0x9edd('0x19')]({'raw':_0x40ba32['options']?_0x40ba32['options'][_0x9edd('0x1a')]===undefined?!![]:![]:!![],'where':_0x40ba32['options']?_0x40ba32[_0x9edd('0x1b')]['where']||null:null,'attributes':_0x40ba32['options']?_0x40ba32[_0x9edd('0x1b')][_0x9edd('0x1c')]||null:null,'limit':_0x40ba32['options']?_0x40ba32['options'][_0x9edd('0x1d')]||null:null,'include':_0x40ba32[_0x9edd('0x1b')]?_0x40ba32[_0x9edd('0x1b')]['include']?_[_0x9edd('0x1e')](_0x40ba32[_0x9edd('0x1b')][_0x9edd('0x1f')],function(_0x2ca65f){return{'model':db[_0x2ca65f[_0x9edd('0x20')]],'as':_0x2ca65f['as'],'attributes':_0x2ca65f['attributes'],'include':_0x2ca65f[_0x9edd('0x1f')]?_[_0x9edd('0x1e')](_0x2ca65f[_0x9edd('0x1f')],function(_0x2f9f86){return{'model':db[_0x2f9f86[_0x9edd('0x20')]],'as':_0x2f9f86['as'],'attributes':_0x2f9f86['attributes'],'include':_0x2f9f86['include']?_[_0x9edd('0x1e')](_0x2f9f86[_0x9edd('0x1f')],function(_0x8d67aa){return{'model':db[_0x8d67aa[_0x9edd('0x20')]],'as':_0x8d67aa['as'],'attributes':_0x8d67aa[_0x9edd('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57a2cc){logger[_0x9edd('0xe')](_0x9edd('0x17'),_0x40ba32);logger[_0x9edd('0x10')]('GetSalesforceAccount',_0x40ba32,JSON[_0x9edd('0x11')](_0x57a2cc));_0x43dc70(_0x57a2cc);})[_0x9edd('0x16')](function(_0x2ae8dd){logger[_0x9edd('0x12')]('GetSalesforceAccount',_0x2ae8dd[_0x9edd('0x15')],_0x40ba32);_0x5d879c(_0x4d8f33[_0x9edd('0x12')](0x1f4,_0x2ae8dd[_0x9edd('0x15')]));});});};exports[_0x9edd('0x21')]=function(_0xbbf08f){var _0x42e664=this;return new Promise(function(_0x209aba,_0x1fba7b){return db[_0x9edd('0x18')][_0x9edd('0x22')]({'raw':_0xbbf08f[_0x9edd('0x1b')]?_0xbbf08f[_0x9edd('0x1b')][_0x9edd('0x1a')]===undefined?!![]:![]:!![],'where':_0xbbf08f[_0x9edd('0x1b')]?_0xbbf08f[_0x9edd('0x1b')]['where']||null:null,'attributes':_0xbbf08f[_0x9edd('0x1b')]?_0xbbf08f[_0x9edd('0x1b')][_0x9edd('0x1c')]||null:null,'include':_0xbbf08f['options']?_0xbbf08f[_0x9edd('0x1b')][_0x9edd('0x1f')]?_[_0x9edd('0x1e')](_0xbbf08f[_0x9edd('0x1b')][_0x9edd('0x1f')],function(_0x2bc4ed){return{'model':db[_0x2bc4ed[_0x9edd('0x20')]],'as':_0x2bc4ed['as'],'attributes':_0x2bc4ed[_0x9edd('0x1c')],'include':_0x2bc4ed[_0x9edd('0x1f')]?_[_0x9edd('0x1e')](_0x2bc4ed[_0x9edd('0x1f')],function(_0x42c1d9){return{'model':db[_0x42c1d9[_0x9edd('0x20')]],'as':_0x42c1d9['as'],'attributes':_0x42c1d9[_0x9edd('0x1c')],'include':_0x42c1d9['include']?_[_0x9edd('0x1e')](_0x42c1d9['include'],function(_0x968303){return{'model':db[_0x968303[_0x9edd('0x20')]],'as':_0x968303['as'],'attributes':_0x968303[_0x9edd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9edd('0xd')](function(_0x16770e){logger['info'](_0x9edd('0x21'),_0xbbf08f);logger[_0x9edd('0x10')](_0x9edd('0x21'),_0xbbf08f,JSON[_0x9edd('0x11')](_0x16770e));_0x209aba(_0x16770e);})[_0x9edd('0x16')](function(_0x337e6c){logger[_0x9edd('0x12')](_0x9edd('0x21'),_0x337e6c[_0x9edd('0x15')],_0xbbf08f);_0x1fba7b(_0x42e664[_0x9edd('0x12')](0x1f4,_0x337e6c['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 01c259b..45e2269 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 _0x38b5=['../../config/environment','./intSalesforceConfiguration.controller','isAuthenticated','get','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x38b5,0x175));var _0x538b=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0x38b5[_0x4b03c9];return _0x161ba2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x538b('0x0'));var timeout=require(_0x538b('0x1'));var express=require(_0x538b('0x2'));var router=express[_0x538b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x538b('0x4'));var config=require(_0x538b('0x5'));var controller=require(_0x538b('0x6'));router['get']('/',auth[_0x538b('0x7')](),controller['index']);router[_0x538b('0x8')](_0x538b('0x9'),auth[_0x538b('0x7')](),controller['show']);router[_0x538b('0x8')](_0x538b('0xa'),auth[_0x538b('0x7')](),controller[_0x538b('0xb')]);router[_0x538b('0x8')](_0x538b('0xc'),auth[_0x538b('0x7')](),controller[_0x538b('0xd')]);router[_0x538b('0x8')](_0x538b('0xe'),auth['isAuthenticated'](),controller[_0x538b('0xf')]);router[_0x538b('0x10')]('/',auth[_0x538b('0x7')](),controller[_0x538b('0x11')]);router['put'](_0x538b('0x9'),auth[_0x538b('0x7')](),controller[_0x538b('0x12')]);router[_0x538b('0x13')](_0x538b('0x9'),auth[_0x538b('0x7')](),controller['destroy']);module[_0x538b('0x14')]=router; \ No newline at end of file +var _0x90a7=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./intSalesforceConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x90a7,0xf6));var _0x790a=function(_0x1bafc9,_0x20bf61){_0x1bafc9=_0x1bafc9-0x0;var _0xd073c0=_0x90a7[_0x1bafc9];return _0xd073c0;};'use strict';var multer=require(_0x790a('0x0'));var util=require(_0x790a('0x1'));var path=require(_0x790a('0x2'));var timeout=require(_0x790a('0x3'));var express=require(_0x790a('0x4'));var router=express['Router']();var auth=require(_0x790a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x790a('0x6'));router['get']('/',auth[_0x790a('0x7')](),controller[_0x790a('0x8')]);router[_0x790a('0x9')](_0x790a('0xa'),auth['isAuthenticated'](),controller[_0x790a('0xb')]);router[_0x790a('0x9')](_0x790a('0xc'),auth[_0x790a('0x7')](),controller[_0x790a('0xd')]);router[_0x790a('0x9')](_0x790a('0xe'),auth['isAuthenticated'](),controller[_0x790a('0xf')]);router[_0x790a('0x9')](_0x790a('0x10'),auth[_0x790a('0x7')](),controller['getDescriptions']);router['post']('/',auth[_0x790a('0x7')](),controller[_0x790a('0x11')]);router['put'](_0x790a('0xa'),auth['isAuthenticated'](),controller[_0x790a('0x12')]);router[_0x790a('0x13')](_0x790a('0xa'),auth[_0x790a('0x7')](),controller[_0x790a('0x14')]);module[_0x790a('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index f8642d1..fed2941 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 _0x49c8=['contact_lead','lead','sequelize','exports','STRING','ENUM','Case','Task','contact'];(function(_0x167ba2,_0x4e532b){var _0x4f8521=function(_0x173ded){while(--_0x173ded){_0x167ba2['push'](_0x167ba2['shift']());}};_0x4f8521(++_0x4e532b);}(_0x49c8,0x1b2));var _0x849c=function(_0x24bb02,_0x4b5be5){_0x24bb02=_0x24bb02-0x0;var _0x429c94=_0x49c8[_0x24bb02];return _0x429c94;};'use strict';var Sequelize=require(_0x849c('0x0'));module[_0x849c('0x1')]={'name':{'type':Sequelize[_0x849c('0x2')]},'description':{'type':Sequelize[_0x849c('0x2')]},'ticketType':{'type':Sequelize[_0x849c('0x3')]('Task',_0x849c('0x4')),'defaultValue':_0x849c('0x5')},'moduleSearch':{'type':Sequelize[_0x849c('0x3')]('contact_lead',_0x849c('0x6'),'lead'),'defaultValue':_0x849c('0x7')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0x849c('0x6'),_0x849c('0x8')),'defaultValue':_0x849c('0x8')}}; \ No newline at end of file +var _0x3a62=['contact','sequelize','exports','STRING','ENUM','Task','lead','contact_lead','nothing'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x3a62,0x133));var _0x23a6=function(_0x5619df,_0x4af126){_0x5619df=_0x5619df-0x0;var _0x4b6246=_0x3a62[_0x5619df];return _0x4b6246;};'use strict';var Sequelize=require(_0x23a6('0x0'));module[_0x23a6('0x1')]={'name':{'type':Sequelize[_0x23a6('0x2')]},'description':{'type':Sequelize[_0x23a6('0x2')]},'ticketType':{'type':Sequelize[_0x23a6('0x3')](_0x23a6('0x4'),'Case'),'defaultValue':_0x23a6('0x4')},'moduleSearch':{'type':Sequelize[_0x23a6('0x3')]('contact_lead','contact',_0x23a6('0x5')),'defaultValue':_0x23a6('0x6')},'moduleCreate':{'type':Sequelize[_0x23a6('0x3')](_0x23a6('0x7'),_0x23a6('0x8'),_0x23a6('0x5')),'defaultValue':_0x23a6('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 2a4b9a4..b6881b6 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 _0x00bb=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','SalesforceConfiguration','findAll','rows','length','find','create','body','params','getFields','findOne','SalesforceField','order','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','message','catch','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','end','stack','name','send','index','map'];(function(_0x1b0a70,_0x1d116b){var _0x525828=function(_0x3dc8ac){while(--_0x3dc8ac){_0x1b0a70['push'](_0x1b0a70['shift']());}};_0x525828(++_0x1d116b);}(_0x00bb,0x1d8));var _0xb00b=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x00bb[_0x491a7f];return _0x3d8f44;};'use strict';var pdf=require(_0xb00b('0x0'));var emlformat=require(_0xb00b('0x1'));var rimraf=require(_0xb00b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb00b('0x3'));var rp=require('request-promise');var moment=require(_0xb00b('0x4'));var BPromise=require(_0xb00b('0x5'));var Mustache=require('mustache');var util=require(_0xb00b('0x6'));var path=require(_0xb00b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xb00b('0x14'));var client=jayson[_0xb00b('0x15')][_0xb00b('0x16')]({'port':0x232a});function checkPasswordPattern(_0x466b9b,_0xef5d52,_0x1f1c1d){if(_0x1f1c1d){var _0x4ada81=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ada81[_0xb00b('0x17')](_0xef5d52)){return _0x466b9b;}else{throw new db[(_0xb00b('0x18'))]['ValidationError'](_0xb00b('0x19'));}}else{return _0x466b9b;}}function respondWithRpcPromise(_0x1084a6,_0x540b79,_0x5da36b,_0x9b471e){return new BPromise(function(_0x4dcd45,_0x51d136){var _0x1f9c78=_0x9b471e||client;return _0x1f9c78[_0xb00b('0x1a')](_0x1084a6,_0x5da36b)[_0xb00b('0x1b')](function(_0xbb72fc){logger['info'](_0xb00b('0x1c'),_0x540b79,'request\x20sent');logger[_0xb00b('0x1d')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x540b79,_0xb00b('0x1e'),JSON['stringify'](_0xbb72fc));if(_0xbb72fc[_0xb00b('0x1f')]){if(_0xbb72fc[_0xb00b('0x1f')]['code']===0x1f4){logger['error'](_0xb00b('0x1c'),_0x540b79,_0xbb72fc['error'][_0xb00b('0x20')]);return _0x51d136(_0xbb72fc[_0xb00b('0x1f')][_0xb00b('0x20')]);}logger[_0xb00b('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s',_0x540b79,_0xbb72fc[_0xb00b('0x1f')]['message']);return _0x4dcd45(_0xbb72fc[_0xb00b('0x1f')][_0xb00b('0x20')]);}else{logger['info'](_0xb00b('0x1c'),_0x540b79,_0xb00b('0x1e'));_0x4dcd45(_0xbb72fc['result'][_0xb00b('0x20')]);}})[_0xb00b('0x21')](function(_0x5568bb){logger[_0xb00b('0x1f')](_0xb00b('0x1c'),_0x540b79,_0x5568bb);_0x51d136(_0x5568bb);});});}function respondWithStatusCode(_0x3c9500,_0x8caadf){_0x8caadf=_0x8caadf||0xcc;return function(_0x520e55){if(_0x520e55){return _0x3c9500['sendStatus'](_0x8caadf);}return _0x3c9500[_0xb00b('0x22')](_0x8caadf)['end']();};}function respondWithResult(_0x550587,_0x4a635e){_0x4a635e=_0x4a635e||0xc8;return function(_0x16ac55){if(_0x16ac55){return _0x550587[_0xb00b('0x22')](_0x4a635e)[_0xb00b('0x23')](_0x16ac55);}};}function respondWithFilteredResult(_0x3825af,_0x1f14fa){return function(_0x197379){if(_0x197379){var _0x15d3b9=_0x197379[_0xb00b('0x24')],_0x4a8d2b=_0x1f14fa[_0xb00b('0x25')],_0x22c22d=_0x1f14fa[_0xb00b('0x25')]+_0x1f14fa['limit'],_0x503c9c;if(_0x22c22d>=_0x15d3b9){_0x22c22d=_0x15d3b9;_0x503c9c=0xc8;}else{_0x503c9c=0xce;}_0x3825af[_0xb00b('0x22')](_0x503c9c);return _0x3825af[_0xb00b('0x26')](_0xb00b('0x27'),_0x4a8d2b+'-'+_0x22c22d+'/'+_0x15d3b9)[_0xb00b('0x23')](_0x197379);}return null;};}function patchUpdates(_0x303625){return function(_0x2b9824){try{jsonpatch[_0xb00b('0x28')](_0x2b9824,_0x303625,!![]);}catch(_0x7c56e7){return BPromise[_0xb00b('0x29')](_0x7c56e7);}return _0x2b9824['save']();};}function saveUpdates(_0x2b5f41,_0x44918d){return function(_0x49078d){if(_0x49078d){return _0x49078d[_0xb00b('0x2a')](_0x2b5f41)[_0xb00b('0x1b')](function(_0x5a5e5a){return _0x5a5e5a;});}return null;};}function removeEntity(_0x456241,_0x4d2ee5){return function(_0x20e1c9){if(_0x20e1c9){return _0x20e1c9[_0xb00b('0x2b')]()[_0xb00b('0x1b')](function(){_0x456241[_0xb00b('0x22')](0xcc)[_0xb00b('0x2c')]();});}};}function handleEntityNotFound(_0x1436ad,_0x17f613){return function(_0x594840){if(!_0x594840){_0x1436ad['sendStatus'](0x194);}return _0x594840;};}function handleError(_0x5b04c2,_0x347e73){_0x347e73=_0x347e73||0x1f4;return function(_0xc21102){logger[_0xb00b('0x1f')](_0xc21102[_0xb00b('0x2d')]);if(_0xc21102['name']){delete _0xc21102[_0xb00b('0x2e')];}_0x5b04c2[_0xb00b('0x22')](_0x347e73)[_0xb00b('0x2f')](_0xc21102);};}exports[_0xb00b('0x30')]=function(_0x261c80,_0x39da49){var _0x8785ec={},_0x3302ac={},_0x5efc18={'count':0x0,'rows':[]};var _0x55451e=_[_0xb00b('0x31')](db['SalesforceConfiguration'][_0xb00b('0x32')],function(_0x1c5400){return{'name':_0x1c5400[_0xb00b('0x33')],'type':_0x1c5400[_0xb00b('0x34')][_0xb00b('0x35')]};});_0x3302ac[_0xb00b('0x36')]=_[_0xb00b('0x31')](_0x55451e,'name');_0x3302ac[_0xb00b('0x37')]=_[_0xb00b('0x38')](_0x261c80[_0xb00b('0x37')]);_0x3302ac[_0xb00b('0x39')]=_[_0xb00b('0x3a')](_0x3302ac[_0xb00b('0x36')],_0x3302ac['query']);_0x8785ec[_0xb00b('0x3b')]=_[_0xb00b('0x3a')](_0x3302ac['model'],qs[_0xb00b('0x3c')](_0x261c80[_0xb00b('0x37')][_0xb00b('0x3c')]));_0x8785ec[_0xb00b('0x3b')]=_0x8785ec[_0xb00b('0x3b')]['length']?_0x8785ec[_0xb00b('0x3b')]:_0x3302ac[_0xb00b('0x36')];if(!_0x261c80[_0xb00b('0x37')][_0xb00b('0x3d')]('nolimit')){_0x8785ec['limit']=qs[_0xb00b('0x3e')](_0x261c80[_0xb00b('0x37')][_0xb00b('0x3e')]);_0x8785ec[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x261c80[_0xb00b('0x37')][_0xb00b('0x25')]);}_0x8785ec['order']=qs[_0xb00b('0x3f')](_0x261c80[_0xb00b('0x37')][_0xb00b('0x3f')]);_0x8785ec[_0xb00b('0x40')]=qs[_0xb00b('0x39')](_[_0xb00b('0x41')](_0x261c80[_0xb00b('0x37')],_0x3302ac[_0xb00b('0x39')]),_0x55451e);if(_0x261c80[_0xb00b('0x37')][_0xb00b('0x42')]){_0x8785ec[_0xb00b('0x40')]=_[_0xb00b('0x43')](_0x8785ec['where'],{'$or':_[_0xb00b('0x31')](_0x55451e,function(_0x35a0ba){if(_0x35a0ba[_0xb00b('0x34')]!==_0xb00b('0x44')){var _0x10b136={};_0x10b136[_0x35a0ba[_0xb00b('0x2e')]]={'$like':'%'+_0x261c80[_0xb00b('0x37')][_0xb00b('0x42')]+'%'};return _0x10b136;}})});}_0x8785ec=_[_0xb00b('0x43')]({},_0x8785ec,_0x261c80[_0xb00b('0x45')]);var _0x1eec12={'where':_0x8785ec[_0xb00b('0x40')]};return db['SalesforceConfiguration']['count'](_0x1eec12)['then'](function(_0x3f8f60){_0x5efc18[_0xb00b('0x24')]=_0x3f8f60;if(_0x261c80['query'][_0xb00b('0x46')]){_0x8785ec[_0xb00b('0x47')]=[{'all':!![]}];}return db[_0xb00b('0x48')][_0xb00b('0x49')](_0x8785ec);})['then'](function(_0x58e9cb){_0x5efc18[_0xb00b('0x4a')]=_0x58e9cb;return _0x5efc18;})[_0xb00b('0x1b')](respondWithFilteredResult(_0x39da49,_0x8785ec))['catch'](handleError(_0x39da49,null));};exports['show']=function(_0x154759,_0x3a205d){var _0x4e0be4={'raw':![],'where':{'id':_0x154759['params']['id']}},_0x2228e9={};_0x2228e9['model']=_['keys'](db[_0xb00b('0x48')]['rawAttributes']);_0x2228e9[_0xb00b('0x37')]=_[_0xb00b('0x38')](_0x154759[_0xb00b('0x37')]);_0x2228e9[_0xb00b('0x39')]=_[_0xb00b('0x3a')](_0x2228e9[_0xb00b('0x36')],_0x2228e9['query']);_0x4e0be4['attributes']=_[_0xb00b('0x3a')](_0x2228e9[_0xb00b('0x36')],qs['fields'](_0x154759[_0xb00b('0x37')][_0xb00b('0x3c')]));_0x4e0be4['attributes']=_0x4e0be4[_0xb00b('0x3b')][_0xb00b('0x4b')]?_0x4e0be4[_0xb00b('0x3b')]:_0x2228e9['model'];if(_0x154759['query'][_0xb00b('0x46')]){_0x4e0be4[_0xb00b('0x47')]=[{'all':!![]}];}_0x4e0be4=_[_0xb00b('0x43')]({},_0x4e0be4,_0x154759[_0xb00b('0x45')]);return db['SalesforceConfiguration'][_0xb00b('0x4c')](_0x4e0be4)[_0xb00b('0x1b')](handleEntityNotFound(_0x3a205d,null))['then'](respondWithResult(_0x3a205d,null))['catch'](handleError(_0x3a205d,null));};exports[_0xb00b('0x4d')]=function(_0x524b05,_0x1ab196){return db[_0xb00b('0x48')][_0xb00b('0x4d')](_0x524b05[_0xb00b('0x4e')],{})[_0xb00b('0x1b')](respondWithResult(_0x1ab196,0xc9))[_0xb00b('0x21')](handleError(_0x1ab196,null));};exports['update']=function(_0x5d52a5,_0x51c9e3){if(_0x5d52a5[_0xb00b('0x4e')]['id']){delete _0x5d52a5[_0xb00b('0x4e')]['id'];}return db[_0xb00b('0x48')]['find']({'where':{'id':_0x5d52a5[_0xb00b('0x4f')]['id']}})[_0xb00b('0x1b')](handleEntityNotFound(_0x51c9e3,null))[_0xb00b('0x1b')](saveUpdates(_0x5d52a5['body'],null))[_0xb00b('0x1b')](respondWithResult(_0x51c9e3,null))[_0xb00b('0x21')](handleError(_0x51c9e3,null));};exports[_0xb00b('0x2b')]=function(_0x385029,_0x131848){return db[_0xb00b('0x48')][_0xb00b('0x4c')]({'where':{'id':_0x385029[_0xb00b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x131848,null))[_0xb00b('0x1b')](removeEntity(_0x131848,null))[_0xb00b('0x21')](handleError(_0x131848,null));};exports[_0xb00b('0x50')]=function(_0x4a22dd,_0x237419,_0x24a8a2){var _0x309799={};var _0x2b7148={};var _0x1ad387;var _0x4bfe0b;return db[_0xb00b('0x48')][_0xb00b('0x51')]({'where':{'id':_0x4a22dd[_0xb00b('0x4f')]['id']}})[_0xb00b('0x1b')](handleEntityNotFound(_0x237419,null))['then'](function(_0x32b9fe){if(_0x32b9fe){_0x1ad387=_0x32b9fe;_0x2b7148[_0xb00b('0x36')]=_[_0xb00b('0x38')](db[_0xb00b('0x52')][_0xb00b('0x32')]);_0x2b7148[_0xb00b('0x37')]=_[_0xb00b('0x38')](_0x4a22dd['query']);_0x2b7148[_0xb00b('0x39')]=_['intersection'](_0x2b7148[_0xb00b('0x36')],_0x2b7148['query']);_0x309799[_0xb00b('0x3b')]=_['intersection'](_0x2b7148[_0xb00b('0x36')],qs['fields'](_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x3c')]));_0x309799[_0xb00b('0x3b')]=_0x309799['attributes']['length']?_0x309799['attributes']:_0x2b7148[_0xb00b('0x36')];_0x309799[_0xb00b('0x53')]=qs[_0xb00b('0x3f')](_0x4a22dd['query'][_0xb00b('0x3f')]);_0x309799[_0xb00b('0x40')]=qs[_0xb00b('0x39')](_[_0xb00b('0x41')](_0x4a22dd[_0xb00b('0x37')],_0x2b7148['filters']));if(_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x42')]){_0x309799['where']=_[_0xb00b('0x43')](_0x309799[_0xb00b('0x40')],{'$or':_[_0xb00b('0x31')](_0x309799['attributes'],function(_0x4e8b85){var _0x359669={};_0x359669[_0x4e8b85]={'$like':'%'+_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x42')]+'%'};return _0x359669;})});}_0x309799=_['merge']({},_0x309799,_0x4a22dd['options']);return _0x1ad387['getFields'](_0x309799);}})['then'](function(_0xc695f){if(_0xc695f){_0x4bfe0b=_0xc695f['length'];if(!_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x3d')]('nolimit')){_0x309799[_0xb00b('0x3e')]=qs[_0xb00b('0x3e')](_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x3e')]);_0x309799[_0xb00b('0x25')]=qs['offset'](_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x25')]);}return _0x1ad387[_0xb00b('0x50')](_0x309799);}})[_0xb00b('0x1b')](function(_0x8e7e4e){if(_0x8e7e4e){return _0x8e7e4e?{'count':_0x4bfe0b,'rows':_0x8e7e4e}:null;}})[_0xb00b('0x1b')](respondWithResult(_0x237419,null))[_0xb00b('0x21')](handleError(_0x237419,null));};exports['getSubjects']=function(_0x27b3ae,_0x258d0b,_0xe6188b){var _0x328f72={};var _0x109f56={};var _0x432b68;var _0x3f010a;return db[_0xb00b('0x48')]['findOne']({'where':{'id':_0x27b3ae[_0xb00b('0x4f')]['id']}})[_0xb00b('0x1b')](handleEntityNotFound(_0x258d0b,null))[_0xb00b('0x1b')](function(_0x3e6a79){if(_0x3e6a79){_0x432b68=_0x3e6a79;_0x109f56[_0xb00b('0x36')]=_[_0xb00b('0x38')](db[_0xb00b('0x52')][_0xb00b('0x32')]);_0x109f56['query']=_[_0xb00b('0x38')](_0x27b3ae[_0xb00b('0x37')]);_0x109f56[_0xb00b('0x39')]=_[_0xb00b('0x3a')](_0x109f56[_0xb00b('0x36')],_0x109f56[_0xb00b('0x37')]);_0x328f72[_0xb00b('0x3b')]=_['intersection'](_0x109f56[_0xb00b('0x36')],qs[_0xb00b('0x3c')](_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x3c')]));_0x328f72[_0xb00b('0x3b')]=_0x328f72[_0xb00b('0x3b')]['length']?_0x328f72[_0xb00b('0x3b')]:_0x109f56['model'];_0x328f72[_0xb00b('0x53')]=qs['sort'](_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x3f')]);_0x328f72[_0xb00b('0x40')]=qs['filters'](_['pick'](_0x27b3ae[_0xb00b('0x37')],_0x109f56[_0xb00b('0x39')]));if(_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x42')]){_0x328f72[_0xb00b('0x40')]=_[_0xb00b('0x43')](_0x328f72[_0xb00b('0x40')],{'$or':_[_0xb00b('0x31')](_0x328f72[_0xb00b('0x3b')],function(_0x25bef6){var _0x257430={};_0x257430[_0x25bef6]={'$like':'%'+_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x42')]+'%'};return _0x257430;})});}_0x328f72=_[_0xb00b('0x43')]({},_0x328f72,_0x27b3ae['options']);return _0x432b68['getSubjects'](_0x328f72);}})[_0xb00b('0x1b')](function(_0x180008){if(_0x180008){_0x3f010a=_0x180008['length'];if(!_0x27b3ae['query'][_0xb00b('0x3d')](_0xb00b('0x54'))){_0x328f72[_0xb00b('0x3e')]=qs['limit'](_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x3e')]);_0x328f72[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x25')]);}return _0x432b68[_0xb00b('0x55')](_0x328f72);}})['then'](function(_0x4168cf){if(_0x4168cf){return _0x4168cf?{'count':_0x3f010a,'rows':_0x4168cf}:null;}})['then'](respondWithResult(_0x258d0b,null))[_0xb00b('0x21')](handleError(_0x258d0b,null));};exports[_0xb00b('0x56')]=function(_0x545dfd,_0xcef063,_0x1099cb){var _0xe80a21={};var _0x263f0b={};var _0x410d68;var _0x4434fa;return db[_0xb00b('0x48')][_0xb00b('0x51')]({'where':{'id':_0x545dfd[_0xb00b('0x4f')]['id']}})[_0xb00b('0x1b')](handleEntityNotFound(_0xcef063,null))[_0xb00b('0x1b')](function(_0x3893df){if(_0x3893df){_0x410d68=_0x3893df;_0x263f0b['model']=_[_0xb00b('0x38')](db[_0xb00b('0x52')][_0xb00b('0x32')]);_0x263f0b[_0xb00b('0x37')]=_['keys'](_0x545dfd[_0xb00b('0x37')]);_0x263f0b[_0xb00b('0x39')]=_[_0xb00b('0x3a')](_0x263f0b[_0xb00b('0x36')],_0x263f0b[_0xb00b('0x37')]);_0xe80a21['attributes']=_[_0xb00b('0x3a')](_0x263f0b[_0xb00b('0x36')],qs[_0xb00b('0x3c')](_0x545dfd[_0xb00b('0x37')]['fields']));_0xe80a21[_0xb00b('0x3b')]=_0xe80a21['attributes'][_0xb00b('0x4b')]?_0xe80a21[_0xb00b('0x3b')]:_0x263f0b[_0xb00b('0x36')];_0xe80a21[_0xb00b('0x53')]=qs[_0xb00b('0x3f')](_0x545dfd[_0xb00b('0x37')][_0xb00b('0x3f')]);_0xe80a21[_0xb00b('0x40')]=qs[_0xb00b('0x39')](_[_0xb00b('0x41')](_0x545dfd[_0xb00b('0x37')],_0x263f0b['filters']));if(_0x545dfd[_0xb00b('0x37')][_0xb00b('0x42')]){_0xe80a21[_0xb00b('0x40')]=_[_0xb00b('0x43')](_0xe80a21['where'],{'$or':_[_0xb00b('0x31')](_0xe80a21[_0xb00b('0x3b')],function(_0x4b5508){var _0x5c1aaa={};_0x5c1aaa[_0x4b5508]={'$like':'%'+_0x545dfd['query'][_0xb00b('0x42')]+'%'};return _0x5c1aaa;})});}_0xe80a21=_[_0xb00b('0x43')]({},_0xe80a21,_0x545dfd[_0xb00b('0x45')]);return _0x410d68['getDescriptions'](_0xe80a21);}})[_0xb00b('0x1b')](function(_0x296be0){if(_0x296be0){_0x4434fa=_0x296be0[_0xb00b('0x4b')];if(!_0x545dfd[_0xb00b('0x37')][_0xb00b('0x3d')](_0xb00b('0x54'))){_0xe80a21[_0xb00b('0x3e')]=qs[_0xb00b('0x3e')](_0x545dfd[_0xb00b('0x37')]['limit']);_0xe80a21['offset']=qs[_0xb00b('0x25')](_0x545dfd[_0xb00b('0x37')][_0xb00b('0x25')]);}return _0x410d68[_0xb00b('0x56')](_0xe80a21);}})['then'](function(_0x62f47){if(_0x62f47){return _0x62f47?{'count':_0x4434fa,'rows':_0x62f47}:null;}})[_0xb00b('0x1b')](respondWithResult(_0xcef063,null))['catch'](handleError(_0xcef063,null));}; \ No newline at end of file +var _0x40d4=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','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~!@#$%^&-_=+[{]}.','request','then','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','fields','length','model','limit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','params','find','create','body','getFields','findOne','hasOwnProperty','nolimit','getSubjects','SalesforceField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2cad09,_0x2cf75c){var _0x374d40=function(_0x5650e7){while(--_0x5650e7){_0x2cad09['push'](_0x2cad09['shift']());}};_0x374d40(++_0x2cf75c);}(_0x40d4,0x16c));var _0x440d=function(_0xf4de16,_0x4866b5){_0xf4de16=_0xf4de16-0x0;var _0x6d2e7=_0x40d4[_0xf4de16];return _0x6d2e7;};'use strict';var pdf=require(_0x440d('0x0'));var emlformat=require(_0x440d('0x1'));var rimraf=require(_0x440d('0x2'));var zipdir=require(_0x440d('0x3'));var jsonpatch=require(_0x440d('0x4'));var rp=require(_0x440d('0x5'));var moment=require(_0x440d('0x6'));var BPromise=require(_0x440d('0x7'));var Mustache=require(_0x440d('0x8'));var util=require(_0x440d('0x9'));var path=require('path');var sox=require(_0x440d('0xa'));var csv=require(_0x440d('0xb'));var ejs=require(_0x440d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x440d('0xd'));var toCsv=require(_0x440d('0xb'));var querystring=require(_0x440d('0xe'));var Papa=require(_0x440d('0xf'));var Redis=require(_0x440d('0x10'));var authService=require(_0x440d('0x11'));var qs=require(_0x440d('0x12'));var as=require(_0x440d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x440d('0x14'))(_0x440d('0x15'));var utils=require(_0x440d('0x16'));var config=require(_0x440d('0x17'));var db=require(_0x440d('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x440d('0x19')][_0x440d('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x446420,_0x3aa15e,_0x159780){if(_0x159780){var _0x12b02b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x12b02b[_0x440d('0x1b')](_0x3aa15e)){return _0x446420;}else{throw new db[(_0x440d('0x1c'))][(_0x440d('0x1d'))](_0x440d('0x1e'));}}else{return _0x446420;}}function respondWithRpcPromise(_0xe838d1,_0x31dccc,_0x48e9d3,_0xeac57b){return new BPromise(function(_0x23628b,_0x49f47b){var _0xd861bc=_0xeac57b||client;return _0xd861bc[_0x440d('0x1f')](_0xe838d1,_0x48e9d3)[_0x440d('0x20')](function(_0x720013){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x31dccc,_0x440d('0x21'));logger['debug'](_0x440d('0x22'),_0x31dccc,_0x440d('0x21'),JSON[_0x440d('0x23')](_0x720013));if(_0x720013['error']){if(_0x720013[_0x440d('0x24')]['code']===0x1f4){logger['error'](_0x440d('0x25'),_0x31dccc,_0x720013[_0x440d('0x24')][_0x440d('0x26')]);return _0x49f47b(_0x720013[_0x440d('0x24')][_0x440d('0x26')]);}logger[_0x440d('0x24')]('SalesforceConfiguration,\x20%s,\x20%s',_0x31dccc,_0x720013[_0x440d('0x24')]['message']);return _0x23628b(_0x720013[_0x440d('0x24')]['message']);}else{logger[_0x440d('0x27')](_0x440d('0x25'),_0x31dccc,_0x440d('0x21'));_0x23628b(_0x720013[_0x440d('0x28')]['message']);}})[_0x440d('0x29')](function(_0x5c2f5a){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x31dccc,_0x5c2f5a);_0x49f47b(_0x5c2f5a);});});}function respondWithStatusCode(_0x558f05,_0x5e4931){_0x5e4931=_0x5e4931||0xcc;return function(_0x57adb0){if(_0x57adb0){return _0x558f05[_0x440d('0x2a')](_0x5e4931);}return _0x558f05[_0x440d('0x2b')](_0x5e4931)[_0x440d('0x2c')]();};}function respondWithResult(_0x418774,_0x5404fd){_0x5404fd=_0x5404fd||0xc8;return function(_0x4241ec){if(_0x4241ec){return _0x418774['status'](_0x5404fd)[_0x440d('0x2d')](_0x4241ec);}};}function respondWithFilteredResult(_0x14f260,_0x4f88de){return function(_0x20ce7f){if(_0x20ce7f){var _0x4867da=_0x20ce7f[_0x440d('0x2e')],_0x6b0f3=_0x4f88de[_0x440d('0x2f')],_0x591704=_0x4f88de[_0x440d('0x2f')]+_0x4f88de['limit'],_0x5972dd;if(_0x591704>=_0x4867da){_0x591704=_0x4867da;_0x5972dd=0xc8;}else{_0x5972dd=0xce;}_0x14f260['status'](_0x5972dd);return _0x14f260[_0x440d('0x30')](_0x440d('0x31'),_0x6b0f3+'-'+_0x591704+'/'+_0x4867da)['json'](_0x20ce7f);}return null;};}function patchUpdates(_0x13ec3f){return function(_0x1b70b2){try{jsonpatch[_0x440d('0x32')](_0x1b70b2,_0x13ec3f,!![]);}catch(_0x13c4f6){return BPromise[_0x440d('0x33')](_0x13c4f6);}return _0x1b70b2[_0x440d('0x34')]();};}function saveUpdates(_0x53f26a,_0x40222d){return function(_0x3fa735){if(_0x3fa735){return _0x3fa735[_0x440d('0x35')](_0x53f26a)[_0x440d('0x20')](function(_0x5ef231){return _0x5ef231;});}return null;};}function removeEntity(_0x117cc4,_0x3ba8f8){return function(_0x52e2a1){if(_0x52e2a1){return _0x52e2a1[_0x440d('0x36')]()[_0x440d('0x20')](function(){_0x117cc4[_0x440d('0x2b')](0xcc)[_0x440d('0x2c')]();});}};}function handleEntityNotFound(_0x419de6,_0xf302b3){return function(_0x201f26){if(!_0x201f26){_0x419de6['sendStatus'](0x194);}return _0x201f26;};}function handleError(_0x3a6c56,_0x212125){_0x212125=_0x212125||0x1f4;return function(_0x5f34ba){logger[_0x440d('0x24')](_0x5f34ba[_0x440d('0x37')]);if(_0x5f34ba[_0x440d('0x38')]){delete _0x5f34ba[_0x440d('0x38')];}_0x3a6c56['status'](_0x212125)[_0x440d('0x39')](_0x5f34ba);};}exports[_0x440d('0x3a')]=function(_0x4330e6,_0x3f47c7){var _0x10d7f6={},_0x18ebfa={},_0x43b77c={'count':0x0,'rows':[]};var _0x5187b2=_['map'](db[_0x440d('0x3b')][_0x440d('0x3c')],function(_0x10969a){return{'name':_0x10969a[_0x440d('0x3d')],'type':_0x10969a[_0x440d('0x3e')][_0x440d('0x3f')]};});_0x18ebfa['model']=_[_0x440d('0x40')](_0x5187b2,_0x440d('0x38'));_0x18ebfa[_0x440d('0x41')]=_[_0x440d('0x42')](_0x4330e6[_0x440d('0x41')]);_0x18ebfa[_0x440d('0x43')]=_[_0x440d('0x44')](_0x18ebfa['model'],_0x18ebfa[_0x440d('0x41')]);_0x10d7f6[_0x440d('0x45')]=_[_0x440d('0x44')](_0x18ebfa['model'],qs[_0x440d('0x46')](_0x4330e6[_0x440d('0x41')][_0x440d('0x46')]));_0x10d7f6[_0x440d('0x45')]=_0x10d7f6[_0x440d('0x45')][_0x440d('0x47')]?_0x10d7f6[_0x440d('0x45')]:_0x18ebfa[_0x440d('0x48')];if(!_0x4330e6[_0x440d('0x41')]['hasOwnProperty']('nolimit')){_0x10d7f6['limit']=qs[_0x440d('0x49')](_0x4330e6[_0x440d('0x41')][_0x440d('0x49')]);_0x10d7f6[_0x440d('0x2f')]=qs[_0x440d('0x2f')](_0x4330e6['query'][_0x440d('0x2f')]);}_0x10d7f6[_0x440d('0x4a')]=qs[_0x440d('0x4b')](_0x4330e6[_0x440d('0x41')][_0x440d('0x4b')]);_0x10d7f6['where']=qs[_0x440d('0x43')](_[_0x440d('0x4c')](_0x4330e6[_0x440d('0x41')],_0x18ebfa[_0x440d('0x43')]),_0x5187b2);if(_0x4330e6[_0x440d('0x41')][_0x440d('0x4d')]){_0x10d7f6[_0x440d('0x4e')]=_[_0x440d('0x4f')](_0x10d7f6['where'],{'$or':_[_0x440d('0x40')](_0x5187b2,function(_0xfc9670){if(_0xfc9670[_0x440d('0x3e')]!=='VIRTUAL'){var _0x5cbcda={};_0x5cbcda[_0xfc9670[_0x440d('0x38')]]={'$like':'%'+_0x4330e6[_0x440d('0x41')][_0x440d('0x4d')]+'%'};return _0x5cbcda;}})});}_0x10d7f6=_[_0x440d('0x4f')]({},_0x10d7f6,_0x4330e6[_0x440d('0x50')]);var _0x48a8ce={'where':_0x10d7f6[_0x440d('0x4e')]};return db[_0x440d('0x3b')][_0x440d('0x2e')](_0x48a8ce)['then'](function(_0x33c0a1){_0x43b77c[_0x440d('0x2e')]=_0x33c0a1;if(_0x4330e6['query'][_0x440d('0x51')]){_0x10d7f6[_0x440d('0x52')]=[{'all':!![]}];}return db[_0x440d('0x3b')][_0x440d('0x53')](_0x10d7f6);})['then'](function(_0x57b8c8){_0x43b77c[_0x440d('0x54')]=_0x57b8c8;return _0x43b77c;})[_0x440d('0x20')](respondWithFilteredResult(_0x3f47c7,_0x10d7f6))[_0x440d('0x29')](handleError(_0x3f47c7,null));};exports['show']=function(_0x228dbf,_0x47ebdb){var _0x3f34df={'raw':![],'where':{'id':_0x228dbf[_0x440d('0x55')]['id']}},_0x3cf029={};_0x3cf029['model']=_[_0x440d('0x42')](db[_0x440d('0x3b')][_0x440d('0x3c')]);_0x3cf029[_0x440d('0x41')]=_['keys'](_0x228dbf[_0x440d('0x41')]);_0x3cf029[_0x440d('0x43')]=_[_0x440d('0x44')](_0x3cf029['model'],_0x3cf029[_0x440d('0x41')]);_0x3f34df[_0x440d('0x45')]=_[_0x440d('0x44')](_0x3cf029[_0x440d('0x48')],qs['fields'](_0x228dbf[_0x440d('0x41')][_0x440d('0x46')]));_0x3f34df['attributes']=_0x3f34df[_0x440d('0x45')][_0x440d('0x47')]?_0x3f34df['attributes']:_0x3cf029[_0x440d('0x48')];if(_0x228dbf[_0x440d('0x41')][_0x440d('0x51')]){_0x3f34df['include']=[{'all':!![]}];}_0x3f34df=_[_0x440d('0x4f')]({},_0x3f34df,_0x228dbf['options']);return db[_0x440d('0x3b')][_0x440d('0x56')](_0x3f34df)[_0x440d('0x20')](handleEntityNotFound(_0x47ebdb,null))['then'](respondWithResult(_0x47ebdb,null))[_0x440d('0x29')](handleError(_0x47ebdb,null));};exports[_0x440d('0x57')]=function(_0x21773d,_0x4fe4a3){return db[_0x440d('0x3b')][_0x440d('0x57')](_0x21773d[_0x440d('0x58')],{})[_0x440d('0x20')](respondWithResult(_0x4fe4a3,0xc9))[_0x440d('0x29')](handleError(_0x4fe4a3,null));};exports[_0x440d('0x35')]=function(_0x1b03b6,_0x1715fe){if(_0x1b03b6[_0x440d('0x58')]['id']){delete _0x1b03b6[_0x440d('0x58')]['id'];}return db['SalesforceConfiguration'][_0x440d('0x56')]({'where':{'id':_0x1b03b6[_0x440d('0x55')]['id']}})[_0x440d('0x20')](handleEntityNotFound(_0x1715fe,null))[_0x440d('0x20')](saveUpdates(_0x1b03b6[_0x440d('0x58')],null))['then'](respondWithResult(_0x1715fe,null))[_0x440d('0x29')](handleError(_0x1715fe,null));};exports[_0x440d('0x36')]=function(_0x20bf69,_0x51c8e9){return db[_0x440d('0x3b')]['find']({'where':{'id':_0x20bf69['params']['id']}})['then'](handleEntityNotFound(_0x51c8e9,null))['then'](removeEntity(_0x51c8e9,null))[_0x440d('0x29')](handleError(_0x51c8e9,null));};exports[_0x440d('0x59')]=function(_0x2fe5c8,_0x59241b,_0x5cf8e7){var _0x4aabb3={};var _0x2e1a83={};var _0x1f2be1;var _0x34b94d;return db[_0x440d('0x3b')][_0x440d('0x5a')]({'where':{'id':_0x2fe5c8[_0x440d('0x55')]['id']}})[_0x440d('0x20')](handleEntityNotFound(_0x59241b,null))[_0x440d('0x20')](function(_0x4484a1){if(_0x4484a1){_0x1f2be1=_0x4484a1;_0x2e1a83[_0x440d('0x48')]=_[_0x440d('0x42')](db['SalesforceField'][_0x440d('0x3c')]);_0x2e1a83['query']=_[_0x440d('0x42')](_0x2fe5c8['query']);_0x2e1a83[_0x440d('0x43')]=_[_0x440d('0x44')](_0x2e1a83[_0x440d('0x48')],_0x2e1a83[_0x440d('0x41')]);_0x4aabb3[_0x440d('0x45')]=_['intersection'](_0x2e1a83['model'],qs[_0x440d('0x46')](_0x2fe5c8[_0x440d('0x41')]['fields']));_0x4aabb3['attributes']=_0x4aabb3[_0x440d('0x45')][_0x440d('0x47')]?_0x4aabb3[_0x440d('0x45')]:_0x2e1a83[_0x440d('0x48')];_0x4aabb3['order']=qs[_0x440d('0x4b')](_0x2fe5c8['query'][_0x440d('0x4b')]);_0x4aabb3[_0x440d('0x4e')]=qs['filters'](_[_0x440d('0x4c')](_0x2fe5c8[_0x440d('0x41')],_0x2e1a83[_0x440d('0x43')]));if(_0x2fe5c8[_0x440d('0x41')][_0x440d('0x4d')]){_0x4aabb3[_0x440d('0x4e')]=_[_0x440d('0x4f')](_0x4aabb3[_0x440d('0x4e')],{'$or':_[_0x440d('0x40')](_0x4aabb3['attributes'],function(_0x2a0ac5){var _0x446c52={};_0x446c52[_0x2a0ac5]={'$like':'%'+_0x2fe5c8[_0x440d('0x41')][_0x440d('0x4d')]+'%'};return _0x446c52;})});}_0x4aabb3=_['merge']({},_0x4aabb3,_0x2fe5c8[_0x440d('0x50')]);return _0x1f2be1[_0x440d('0x59')](_0x4aabb3);}})[_0x440d('0x20')](function(_0x39543b){if(_0x39543b){_0x34b94d=_0x39543b[_0x440d('0x47')];if(!_0x2fe5c8[_0x440d('0x41')][_0x440d('0x5b')](_0x440d('0x5c'))){_0x4aabb3['limit']=qs[_0x440d('0x49')](_0x2fe5c8[_0x440d('0x41')][_0x440d('0x49')]);_0x4aabb3[_0x440d('0x2f')]=qs[_0x440d('0x2f')](_0x2fe5c8[_0x440d('0x41')][_0x440d('0x2f')]);}return _0x1f2be1[_0x440d('0x59')](_0x4aabb3);}})[_0x440d('0x20')](function(_0x40eeb4){if(_0x40eeb4){return _0x40eeb4?{'count':_0x34b94d,'rows':_0x40eeb4}:null;}})['then'](respondWithResult(_0x59241b,null))[_0x440d('0x29')](handleError(_0x59241b,null));};exports[_0x440d('0x5d')]=function(_0x30f2b7,_0x2a0463,_0x9a01b7){var _0x592d68={};var _0x49ee61={};var _0x549562;var _0x559408;return db[_0x440d('0x3b')][_0x440d('0x5a')]({'where':{'id':_0x30f2b7[_0x440d('0x55')]['id']}})[_0x440d('0x20')](handleEntityNotFound(_0x2a0463,null))[_0x440d('0x20')](function(_0x327621){if(_0x327621){_0x549562=_0x327621;_0x49ee61[_0x440d('0x48')]=_['keys'](db[_0x440d('0x5e')][_0x440d('0x3c')]);_0x49ee61[_0x440d('0x41')]=_[_0x440d('0x42')](_0x30f2b7['query']);_0x49ee61[_0x440d('0x43')]=_[_0x440d('0x44')](_0x49ee61['model'],_0x49ee61['query']);_0x592d68[_0x440d('0x45')]=_['intersection'](_0x49ee61['model'],qs[_0x440d('0x46')](_0x30f2b7['query'][_0x440d('0x46')]));_0x592d68[_0x440d('0x45')]=_0x592d68[_0x440d('0x45')][_0x440d('0x47')]?_0x592d68[_0x440d('0x45')]:_0x49ee61[_0x440d('0x48')];_0x592d68['order']=qs['sort'](_0x30f2b7['query']['sort']);_0x592d68['where']=qs[_0x440d('0x43')](_['pick'](_0x30f2b7[_0x440d('0x41')],_0x49ee61['filters']));if(_0x30f2b7['query'][_0x440d('0x4d')]){_0x592d68['where']=_['merge'](_0x592d68[_0x440d('0x4e')],{'$or':_[_0x440d('0x40')](_0x592d68[_0x440d('0x45')],function(_0x1ee9c0){var _0x510f9a={};_0x510f9a[_0x1ee9c0]={'$like':'%'+_0x30f2b7[_0x440d('0x41')]['filter']+'%'};return _0x510f9a;})});}_0x592d68=_[_0x440d('0x4f')]({},_0x592d68,_0x30f2b7[_0x440d('0x50')]);return _0x549562[_0x440d('0x5d')](_0x592d68);}})[_0x440d('0x20')](function(_0x5ecb98){if(_0x5ecb98){_0x559408=_0x5ecb98[_0x440d('0x47')];if(!_0x30f2b7[_0x440d('0x41')][_0x440d('0x5b')](_0x440d('0x5c'))){_0x592d68['limit']=qs[_0x440d('0x49')](_0x30f2b7[_0x440d('0x41')][_0x440d('0x49')]);_0x592d68[_0x440d('0x2f')]=qs['offset'](_0x30f2b7['query'][_0x440d('0x2f')]);}return _0x549562[_0x440d('0x5d')](_0x592d68);}})[_0x440d('0x20')](function(_0x100a6e){if(_0x100a6e){return _0x100a6e?{'count':_0x559408,'rows':_0x100a6e}:null;}})['then'](respondWithResult(_0x2a0463,null))['catch'](handleError(_0x2a0463,null));};exports[_0x440d('0x5f')]=function(_0x227f33,_0xdbd66d,_0x91a92d){var _0x195940={};var _0x256310={};var _0x54fd36;var _0x46dfbf;return db[_0x440d('0x3b')][_0x440d('0x5a')]({'where':{'id':_0x227f33[_0x440d('0x55')]['id']}})['then'](handleEntityNotFound(_0xdbd66d,null))[_0x440d('0x20')](function(_0xfbd1f8){if(_0xfbd1f8){_0x54fd36=_0xfbd1f8;_0x256310['model']=_[_0x440d('0x42')](db[_0x440d('0x5e')][_0x440d('0x3c')]);_0x256310[_0x440d('0x41')]=_[_0x440d('0x42')](_0x227f33[_0x440d('0x41')]);_0x256310[_0x440d('0x43')]=_[_0x440d('0x44')](_0x256310[_0x440d('0x48')],_0x256310[_0x440d('0x41')]);_0x195940[_0x440d('0x45')]=_['intersection'](_0x256310['model'],qs[_0x440d('0x46')](_0x227f33[_0x440d('0x41')][_0x440d('0x46')]));_0x195940[_0x440d('0x45')]=_0x195940[_0x440d('0x45')][_0x440d('0x47')]?_0x195940['attributes']:_0x256310[_0x440d('0x48')];_0x195940[_0x440d('0x4a')]=qs[_0x440d('0x4b')](_0x227f33[_0x440d('0x41')]['sort']);_0x195940['where']=qs[_0x440d('0x43')](_[_0x440d('0x4c')](_0x227f33[_0x440d('0x41')],_0x256310[_0x440d('0x43')]));if(_0x227f33[_0x440d('0x41')][_0x440d('0x4d')]){_0x195940['where']=_[_0x440d('0x4f')](_0x195940[_0x440d('0x4e')],{'$or':_[_0x440d('0x40')](_0x195940['attributes'],function(_0x3abba0){var _0x438447={};_0x438447[_0x3abba0]={'$like':'%'+_0x227f33[_0x440d('0x41')][_0x440d('0x4d')]+'%'};return _0x438447;})});}_0x195940=_[_0x440d('0x4f')]({},_0x195940,_0x227f33[_0x440d('0x50')]);return _0x54fd36['getDescriptions'](_0x195940);}})[_0x440d('0x20')](function(_0x2168ff){if(_0x2168ff){_0x46dfbf=_0x2168ff['length'];if(!_0x227f33[_0x440d('0x41')][_0x440d('0x5b')](_0x440d('0x5c'))){_0x195940[_0x440d('0x49')]=qs['limit'](_0x227f33[_0x440d('0x41')]['limit']);_0x195940[_0x440d('0x2f')]=qs[_0x440d('0x2f')](_0x227f33['query'][_0x440d('0x2f')]);}return _0x54fd36[_0x440d('0x5f')](_0x195940);}})[_0x440d('0x20')](function(_0x22e17d){if(_0x22e17d){return _0x22e17d?{'count':_0x46dfbf,'rows':_0x22e17d}:null;}})[_0x440d('0x20')](respondWithResult(_0xdbd66d,null))[_0x440d('0x29')](handleError(_0xdbd66d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 6962b76..796cd83 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 _0x811d=['exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x432dfe,_0x11c8f9){var _0x1e311c=function(_0xf2ae21){while(--_0xf2ae21){_0x432dfe['push'](_0x432dfe['shift']());}};_0x1e311c(++_0x11c8f9);}(_0x811d,0x154));var _0xd811=function(_0x9cc4e7,_0x20f89d){_0x9cc4e7=_0x9cc4e7-0x0;var _0x238dbd=_0x811d[_0x9cc4e7];return _0x238dbd;};'use strict';var _=require(_0xd811('0x0'));var util=require(_0xd811('0x1'));var logger=require(_0xd811('0x2'))(_0xd811('0x3'));var moment=require(_0xd811('0x4'));var BPromise=require('bluebird');var rp=require(_0xd811('0x5'));var fs=require('fs');var path=require(_0xd811('0x6'));var rimraf=require(_0xd811('0x7'));var config=require(_0xd811('0x8'));var attributes=require(_0xd811('0x9'));module[_0xd811('0xa')]=function(_0xbe42d5,_0x352ce6){return _0xbe42d5[_0xd811('0xb')](_0xd811('0xc'),attributes,{'tableName':_0xd811('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5c3=['bluebird','request-promise','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','../../config/logger','moment'];(function(_0x5ab1de,_0x23fd18){var _0x929299=function(_0x54a9e5){while(--_0x54a9e5){_0x5ab1de['push'](_0x5ab1de['shift']());}};_0x929299(++_0x23fd18);}(_0xe5c3,0x1de));var _0x3e5c=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xe5c3[_0x1c546c];return _0x2cc384;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3e5c('0x0'))('api');var moment=require(_0x3e5c('0x1'));var BPromise=require(_0x3e5c('0x2'));var rp=require(_0x3e5c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3e5c('0x4'));module[_0x3e5c('0x5')]=function(_0x4660b5,_0x4b7b20){return _0x4660b5[_0x3e5c('0x6')]('SalesforceConfiguration',attributes,{'tableName':_0x3e5c('0x7'),'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 57322bd..c12c815 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 _0x187f=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x17531a,_0x4119d3){var _0x3a3050=function(_0x5ab9af){while(--_0x5ab9af){_0x17531a['push'](_0x17531a['shift']());}};_0x3a3050(++_0x4119d3);}(_0x187f,0x185));var _0xf187=function(_0x5a134b,_0x198640){_0x5a134b=_0x5a134b-0x0;var _0x4622bf=_0x187f[_0x5a134b];return _0x4622bf;};'use strict';var _=require(_0xf187('0x0'));var util=require(_0xf187('0x1'));var moment=require(_0xf187('0x2'));var BPromise=require(_0xf187('0x3'));var rs=require(_0xf187('0x4'));var fs=require('fs');var Redis=require(_0xf187('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf187('0x6'));var logger=require(_0xf187('0x7'))('rpc');var config=require(_0xf187('0x8'));var jayson=require(_0xf187('0x9'));var client=jayson[_0xf187('0xa')][_0xf187('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51ca39,_0x1f2c3b,_0x5e99fd){return new BPromise(function(_0x31d448,_0x227ed7){return client[_0xf187('0xc')](_0x51ca39,_0x5e99fd)[_0xf187('0xd')](function(_0xfe7c47){logger[_0xf187('0xe')](_0xf187('0xf'),_0x1f2c3b,_0xf187('0x10'));logger[_0xf187('0x11')](_0xf187('0x12'),_0x1f2c3b,_0xf187('0x10'),JSON[_0xf187('0x13')](_0xfe7c47));if(_0xfe7c47[_0xf187('0x14')]){if(_0xfe7c47[_0xf187('0x14')][_0xf187('0x15')]===0x1f4){logger[_0xf187('0x14')](_0xf187('0xf'),_0x1f2c3b,_0xfe7c47[_0xf187('0x14')][_0xf187('0x16')]);return _0x227ed7(_0xfe7c47[_0xf187('0x14')][_0xf187('0x16')]);}logger[_0xf187('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1f2c3b,_0xfe7c47[_0xf187('0x14')]['message']);return _0x31d448(_0xfe7c47[_0xf187('0x14')][_0xf187('0x16')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x1f2c3b,_0xf187('0x10'));_0x31d448(_0xfe7c47['result'][_0xf187('0x16')]);}})[_0xf187('0x17')](function(_0x35c3f0){logger['error'](_0xf187('0xf'),_0x1f2c3b,_0x35c3f0);_0x227ed7(_0x35c3f0);});});} \ No newline at end of file +var _0xf8c5=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring'];(function(_0x265e0e,_0x38b2bb){var _0x518157=function(_0x1e3eab){while(--_0x1e3eab){_0x265e0e['push'](_0x265e0e['shift']());}};_0x518157(++_0x38b2bb);}(_0xf8c5,0x176));var _0x5f8c=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xf8c5[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x5f8c('0x0'));var util=require(_0x5f8c('0x1'));var moment=require(_0x5f8c('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f8c('0x3'));var fs=require('fs');var Redis=require(_0x5f8c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f8c('0x5'));var logger=require(_0x5f8c('0x6'))(_0x5f8c('0x7'));var config=require('../../config/environment');var jayson=require(_0x5f8c('0x8'));var client=jayson[_0x5f8c('0x9')][_0x5f8c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x577d1b,_0x5d488e,_0x215fd1){return new BPromise(function(_0x3784a8,_0x9a9ce9){return client['request'](_0x577d1b,_0x215fd1)[_0x5f8c('0xb')](function(_0x39deda){logger[_0x5f8c('0xc')](_0x5f8c('0xd'),_0x5d488e,_0x5f8c('0xe'));logger[_0x5f8c('0xf')](_0x5f8c('0x10'),_0x5d488e,_0x5f8c('0xe'),JSON[_0x5f8c('0x11')](_0x39deda));if(_0x39deda[_0x5f8c('0x12')]){if(_0x39deda[_0x5f8c('0x12')][_0x5f8c('0x13')]===0x1f4){logger['error'](_0x5f8c('0xd'),_0x5d488e,_0x39deda['error']['message']);return _0x9a9ce9(_0x39deda[_0x5f8c('0x12')][_0x5f8c('0x14')]);}logger[_0x5f8c('0x12')](_0x5f8c('0xd'),_0x5d488e,_0x39deda['error'][_0x5f8c('0x14')]);return _0x3784a8(_0x39deda[_0x5f8c('0x12')]['message']);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x5d488e,'request\x20sent');_0x3784a8(_0x39deda['result'][_0x5f8c('0x14')]);}})['catch'](function(_0x579621){logger[_0x5f8c('0x12')](_0x5f8c('0xd'),_0x5d488e,_0x579621);_0x9a9ce9(_0x579621);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 91eb569..aa150a8 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 _0x2bd8=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0x2bd8,0x130));var _0x82bd=function(_0x745a6a,_0x3e56e4){_0x745a6a=_0x745a6a-0x0;var _0x43e01f=_0x2bd8[_0x745a6a];return _0x43e01f;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var auth=require(_0x82bd('0x5'));var interaction=require(_0x82bd('0x6'));var config=require(_0x82bd('0x7'));var controller=require('./intSalesforceField.controller');router[_0x82bd('0x8')]('/',auth[_0x82bd('0x9')](),controller[_0x82bd('0xa')]);router['get'](_0x82bd('0xb'),auth[_0x82bd('0x9')](),controller[_0x82bd('0xc')]);router[_0x82bd('0xd')]('/',auth['isAuthenticated'](),controller[_0x82bd('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x82bd('0xf')]);router['delete']('/:id',auth[_0x82bd('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x82c4=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x1d16c0,_0x5c30b4){var _0xb017b3=function(_0x59a2b8){while(--_0x59a2b8){_0x1d16c0['push'](_0x1d16c0['shift']());}};_0xb017b3(++_0x5c30b4);}(_0x82c4,0x1ca));var _0x482c=function(_0x2795dd,_0x157893){_0x2795dd=_0x2795dd-0x0;var _0x30f875=_0x82c4[_0x2795dd];return _0x30f875;};'use strict';var multer=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var path=require(_0x482c('0x2'));var timeout=require(_0x482c('0x3'));var express=require(_0x482c('0x4'));var router=express[_0x482c('0x5')]();var auth=require(_0x482c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x482c('0x7'));var controller=require('./intSalesforceField.controller');router[_0x482c('0x8')]('/',auth['isAuthenticated'](),controller[_0x482c('0x9')]);router['get'](_0x482c('0xa'),auth[_0x482c('0xb')](),controller[_0x482c('0xc')]);router[_0x482c('0xd')]('/',auth[_0x482c('0xb')](),controller['create']);router[_0x482c('0xe')](_0x482c('0xa'),auth[_0x482c('0xb')](),controller[_0x482c('0xf')]);router[_0x482c('0x10')](_0x482c('0xa'),auth['isAuthenticated'](),controller[_0x482c('0x11')]);module[_0x482c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 62260b4..a55b658 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 _0x876b=['keyValue','string','STRING','customVariable','sequelize','exports','ENUM','variable'];(function(_0xb22d55,_0x3547d8){var _0x21a223=function(_0x4e5a33){while(--_0x4e5a33){_0xb22d55['push'](_0xb22d55['shift']());}};_0x21a223(++_0x3547d8);}(_0x876b,0x144));var _0xb876=function(_0x2a1b85,_0x37ba15){_0x2a1b85=_0x2a1b85-0x0;var _0xb2a07f=_0x876b[_0x2a1b85];return _0xb2a07f;};'use strict';var Sequelize=require(_0xb876('0x0'));module[_0xb876('0x1')]={'type':{'type':Sequelize[_0xb876('0x2')]('string',_0xb876('0x3'),'customVariable',_0xb876('0x4')),'defaultValue':_0xb876('0x5')},'content':{'type':Sequelize[_0xb876('0x6')]},'key':{'type':Sequelize[_0xb876('0x6')]},'keyType':{'type':Sequelize[_0xb876('0x2')]('string',_0xb876('0x3'),_0xb876('0x7'))},'keyContent':{'type':Sequelize[_0xb876('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xb876('0x6')]}}; \ No newline at end of file +var _0x7c4e=['customVariable','sequelize','exports','ENUM','string','variable','STRING'];(function(_0x264abd,_0x5025c4){var _0x228cfb=function(_0x45c9fd){while(--_0x45c9fd){_0x264abd['push'](_0x264abd['shift']());}};_0x228cfb(++_0x5025c4);}(_0x7c4e,0x6a));var _0xe7c4=function(_0x2513ad,_0x5c7ac8){_0x2513ad=_0x2513ad-0x0;var _0x14a6c3=_0x7c4e[_0x2513ad];return _0x14a6c3;};'use strict';var Sequelize=require(_0xe7c4('0x0'));module[_0xe7c4('0x1')]={'type':{'type':Sequelize[_0xe7c4('0x2')](_0xe7c4('0x3'),_0xe7c4('0x4'),'customVariable','keyValue'),'defaultValue':_0xe7c4('0x3')},'content':{'type':Sequelize[_0xe7c4('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe7c4('0x2')]('string',_0xe7c4('0x4'),_0xe7c4('0x6'))},'keyContent':{'type':Sequelize[_0xe7c4('0x5')]},'idField':{'type':Sequelize[_0xe7c4('0x5')]},'variableName':{'type':Sequelize[_0xe7c4('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 1eb1dcc..226fea5 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 _0x4e6a=['stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','rows','catch','show','params','intersection','length','options','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','update','then','destroy','error'];(function(_0x39f7b2,_0xda64e3){var _0x86bc34=function(_0x293a8b){while(--_0x293a8b){_0x39f7b2['push'](_0x39f7b2['shift']());}};_0x86bc34(++_0xda64e3);}(_0x4e6a,0xfb));var _0xa4e6=function(_0x3e478d,_0x5987b0){_0x3e478d=_0x3e478d-0x0;var _0x4139f5=_0x4e6a[_0x3e478d];return _0x4139f5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa4e6('0x0'));var rimraf=require(_0xa4e6('0x1'));var zipdir=require(_0xa4e6('0x2'));var jsonpatch=require(_0xa4e6('0x3'));var rp=require(_0xa4e6('0x4'));var moment=require(_0xa4e6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa4e6('0x6'));var util=require(_0xa4e6('0x7'));var path=require(_0xa4e6('0x8'));var sox=require(_0xa4e6('0x9'));var csv=require(_0xa4e6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa4e6('0xb'));var crypto=require(_0xa4e6('0xc'));var jsforce=require(_0xa4e6('0xd'));var deskjs=require(_0xa4e6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa4e6('0xf'));var Papa=require(_0xa4e6('0x10'));var Redis=require(_0xa4e6('0x11'));var authService=require(_0xa4e6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa4e6('0x13'));var hardwareService=require(_0xa4e6('0x14'));var logger=require(_0xa4e6('0x15'))(_0xa4e6('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa4e6('0x17'))['db'];function respondWithStatusCode(_0x2b2223,_0x5f380a){_0x5f380a=_0x5f380a||0xcc;return function(_0x4bb3ca){if(_0x4bb3ca){return _0x2b2223[_0xa4e6('0x18')](_0x5f380a);}return _0x2b2223[_0xa4e6('0x19')](_0x5f380a)[_0xa4e6('0x1a')]();};}function respondWithResult(_0x824234,_0x139cd5){_0x139cd5=_0x139cd5||0xc8;return function(_0x2d6f39){if(_0x2d6f39){return _0x824234[_0xa4e6('0x19')](_0x139cd5)['json'](_0x2d6f39);}};}function respondWithFilteredResult(_0x3cfc0d,_0x1a463f){return function(_0x319c23){if(_0x319c23){var _0x8348c8=_0x319c23[_0xa4e6('0x1b')],_0xd639b=_0x1a463f[_0xa4e6('0x1c')],_0x46f28e=_0x1a463f[_0xa4e6('0x1c')]+_0x1a463f[_0xa4e6('0x1d')],_0x480d37;if(_0x46f28e>=_0x8348c8){_0x46f28e=_0x8348c8;_0x480d37=0xc8;}else{_0x480d37=0xce;}_0x3cfc0d[_0xa4e6('0x19')](_0x480d37);return _0x3cfc0d['set'](_0xa4e6('0x1e'),_0xd639b+'-'+_0x46f28e+'/'+_0x8348c8)[_0xa4e6('0x1f')](_0x319c23);}return null;};}function patchUpdates(_0x2ca3a0){return function(_0x416523){try{jsonpatch['apply'](_0x416523,_0x2ca3a0,!![]);}catch(_0x15d6c6){return BPromise[_0xa4e6('0x20')](_0x15d6c6);}return _0x416523['save']();};}function saveUpdates(_0x4276d2,_0x30a15c){return function(_0x372ee9){if(_0x372ee9){return _0x372ee9[_0xa4e6('0x21')](_0x4276d2)[_0xa4e6('0x22')](function(_0x2c4013){return _0x2c4013;});}return null;};}function removeEntity(_0x49ae64,_0x177260){return function(_0x3964c5){if(_0x3964c5){return _0x3964c5[_0xa4e6('0x23')]()[_0xa4e6('0x22')](function(){_0x49ae64[_0xa4e6('0x19')](0xcc)[_0xa4e6('0x1a')]();});}};}function handleEntityNotFound(_0x15479f,_0x21775f){return function(_0xe87e47){if(!_0xe87e47){_0x15479f[_0xa4e6('0x18')](0x194);}return _0xe87e47;};}function handleError(_0x53c129,_0x27223b){_0x27223b=_0x27223b||0x1f4;return function(_0x4a24b6){logger[_0xa4e6('0x24')](_0x4a24b6[_0xa4e6('0x25')]);if(_0x4a24b6[_0xa4e6('0x26')]){delete _0x4a24b6[_0xa4e6('0x26')];}_0x53c129['status'](_0x27223b)[_0xa4e6('0x27')](_0x4a24b6);};}exports[_0xa4e6('0x28')]=function(_0x6b1bc9,_0x264700){var _0x3fd675={},_0x2546c7={},_0x467ba4={'count':0x0,'rows':[]};var _0x4c6d0a=_[_0xa4e6('0x29')](db[_0xa4e6('0x2a')][_0xa4e6('0x2b')],function(_0x1a397d){return{'name':_0x1a397d[_0xa4e6('0x2c')],'type':_0x1a397d[_0xa4e6('0x2d')]['key']};});_0x2546c7['model']=_[_0xa4e6('0x29')](_0x4c6d0a,_0xa4e6('0x26'));_0x2546c7[_0xa4e6('0x2e')]=_[_0xa4e6('0x2f')](_0x6b1bc9[_0xa4e6('0x2e')]);_0x2546c7[_0xa4e6('0x30')]=_['intersection'](_0x2546c7[_0xa4e6('0x31')],_0x2546c7[_0xa4e6('0x2e')]);_0x3fd675[_0xa4e6('0x32')]=_['intersection'](_0x2546c7[_0xa4e6('0x31')],qs[_0xa4e6('0x33')](_0x6b1bc9[_0xa4e6('0x2e')]['fields']));_0x3fd675[_0xa4e6('0x32')]=_0x3fd675['attributes']['length']?_0x3fd675[_0xa4e6('0x32')]:_0x2546c7['model'];if(!_0x6b1bc9['query'][_0xa4e6('0x34')](_0xa4e6('0x35'))){_0x3fd675[_0xa4e6('0x1d')]=qs[_0xa4e6('0x1d')](_0x6b1bc9[_0xa4e6('0x2e')][_0xa4e6('0x1d')]);_0x3fd675[_0xa4e6('0x1c')]=qs[_0xa4e6('0x1c')](_0x6b1bc9['query'][_0xa4e6('0x1c')]);}_0x3fd675[_0xa4e6('0x36')]=qs[_0xa4e6('0x37')](_0x6b1bc9[_0xa4e6('0x2e')][_0xa4e6('0x37')]);_0x3fd675['where']=qs['filters'](_[_0xa4e6('0x38')](_0x6b1bc9['query'],_0x2546c7[_0xa4e6('0x30')]),_0x4c6d0a);if(_0x6b1bc9[_0xa4e6('0x2e')][_0xa4e6('0x39')]){_0x3fd675['where']=_[_0xa4e6('0x3a')](_0x3fd675[_0xa4e6('0x3b')],{'$or':_[_0xa4e6('0x29')](_0x4c6d0a,function(_0x12be1c){if(_0x12be1c['type']!==_0xa4e6('0x3c')){var _0x163907={};_0x163907[_0x12be1c[_0xa4e6('0x26')]]={'$like':'%'+_0x6b1bc9['query']['filter']+'%'};return _0x163907;}})});}_0x3fd675=_[_0xa4e6('0x3a')]({},_0x3fd675,_0x6b1bc9['options']);var _0x116a51={'where':_0x3fd675['where']};return db[_0xa4e6('0x2a')]['count'](_0x116a51)[_0xa4e6('0x22')](function(_0x240a89){_0x467ba4[_0xa4e6('0x1b')]=_0x240a89;if(_0x6b1bc9['query'][_0xa4e6('0x3d')]){_0x3fd675[_0xa4e6('0x3e')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x3fd675);})[_0xa4e6('0x22')](function(_0x3294ff){_0x467ba4[_0xa4e6('0x3f')]=_0x3294ff;return _0x467ba4;})['then'](respondWithFilteredResult(_0x264700,_0x3fd675))[_0xa4e6('0x40')](handleError(_0x264700,null));};exports[_0xa4e6('0x41')]=function(_0x1bc381,_0xa8792){var _0x2540bd={'raw':!![],'where':{'id':_0x1bc381[_0xa4e6('0x42')]['id']}},_0x47406c={};_0x47406c[_0xa4e6('0x31')]=_[_0xa4e6('0x2f')](db[_0xa4e6('0x2a')][_0xa4e6('0x2b')]);_0x47406c[_0xa4e6('0x2e')]=_[_0xa4e6('0x2f')](_0x1bc381['query']);_0x47406c[_0xa4e6('0x30')]=_[_0xa4e6('0x43')](_0x47406c[_0xa4e6('0x31')],_0x47406c[_0xa4e6('0x2e')]);_0x2540bd[_0xa4e6('0x32')]=_[_0xa4e6('0x43')](_0x47406c['model'],qs[_0xa4e6('0x33')](_0x1bc381[_0xa4e6('0x2e')][_0xa4e6('0x33')]));_0x2540bd[_0xa4e6('0x32')]=_0x2540bd[_0xa4e6('0x32')][_0xa4e6('0x44')]?_0x2540bd[_0xa4e6('0x32')]:_0x47406c[_0xa4e6('0x31')];if(_0x1bc381[_0xa4e6('0x2e')][_0xa4e6('0x3d')]){_0x2540bd['include']=[{'all':!![]}];}_0x2540bd=_[_0xa4e6('0x3a')]({},_0x2540bd,_0x1bc381[_0xa4e6('0x45')]);return db['SalesforceField'][_0xa4e6('0x46')](_0x2540bd)[_0xa4e6('0x22')](handleEntityNotFound(_0xa8792,null))[_0xa4e6('0x22')](respondWithResult(_0xa8792,null))[_0xa4e6('0x40')](handleError(_0xa8792,null));};exports['create']=function(_0x4084ec,_0x342b26){return db['SalesforceField']['create'](_0x4084ec[_0xa4e6('0x47')],{})['then'](respondWithResult(_0x342b26,0xc9))[_0xa4e6('0x40')](handleError(_0x342b26,null));};exports['update']=function(_0xa3e75e,_0x5da098){if(_0xa3e75e['body']['id']){delete _0xa3e75e[_0xa4e6('0x47')]['id'];}return db[_0xa4e6('0x2a')]['find']({'where':{'id':_0xa3e75e[_0xa4e6('0x42')]['id']}})[_0xa4e6('0x22')](handleEntityNotFound(_0x5da098,null))[_0xa4e6('0x22')](saveUpdates(_0xa3e75e[_0xa4e6('0x47')],null))[_0xa4e6('0x22')](respondWithResult(_0x5da098,null))['catch'](handleError(_0x5da098,null));};exports[_0xa4e6('0x23')]=function(_0x59f3b5,_0x460137){return db[_0xa4e6('0x2a')][_0xa4e6('0x46')]({'where':{'id':_0x59f3b5[_0xa4e6('0x42')]['id']}})['then'](handleEntityNotFound(_0x460137,null))[_0xa4e6('0x22')](removeEntity(_0x460137,null))['catch'](handleError(_0x460137,null));}; \ No newline at end of file +var _0x6c1e=['params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','SalesforceField','rawAttributes','fieldName','type','key','map','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x6c1e,0xe2));var _0xe6c1=function(_0xfd7cb3,_0x7f7744){_0xfd7cb3=_0xfd7cb3-0x0;var _0x4a7f70=_0x6c1e[_0xfd7cb3];return _0x4a7f70;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe6c1('0x0'));var rimraf=require(_0xe6c1('0x1'));var zipdir=require(_0xe6c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe6c1('0x3'));var moment=require(_0xe6c1('0x4'));var BPromise=require(_0xe6c1('0x5'));var Mustache=require(_0xe6c1('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe6c1('0x7'));var csv=require(_0xe6c1('0x8'));var ejs=require(_0xe6c1('0x9'));var fs=require('fs');var _=require(_0xe6c1('0xa'));var squel=require(_0xe6c1('0xb'));var crypto=require('crypto');var jsforce=require(_0xe6c1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe6c1('0x8'));var querystring=require(_0xe6c1('0xd'));var Papa=require(_0xe6c1('0xe'));var Redis=require('ioredis');var authService=require(_0xe6c1('0xf'));var qs=require(_0xe6c1('0x10'));var as=require(_0xe6c1('0x11'));var hardwareService=require(_0xe6c1('0x12'));var logger=require(_0xe6c1('0x13'))(_0xe6c1('0x14'));var utils=require(_0xe6c1('0x15'));var config=require(_0xe6c1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x145abd,_0x18706c){_0x18706c=_0x18706c||0xcc;return function(_0x297545){if(_0x297545){return _0x145abd[_0xe6c1('0x17')](_0x18706c);}return _0x145abd['status'](_0x18706c)[_0xe6c1('0x18')]();};}function respondWithResult(_0x179691,_0x546bf2){_0x546bf2=_0x546bf2||0xc8;return function(_0x44183d){if(_0x44183d){return _0x179691[_0xe6c1('0x19')](_0x546bf2)['json'](_0x44183d);}};}function respondWithFilteredResult(_0x30764b,_0x28cbfb){return function(_0x2e7454){if(_0x2e7454){var _0x20b566=_0x2e7454[_0xe6c1('0x1a')],_0xddcc31=_0x28cbfb[_0xe6c1('0x1b')],_0x3af69c=_0x28cbfb['offset']+_0x28cbfb[_0xe6c1('0x1c')],_0xdce7b3;if(_0x3af69c>=_0x20b566){_0x3af69c=_0x20b566;_0xdce7b3=0xc8;}else{_0xdce7b3=0xce;}_0x30764b[_0xe6c1('0x19')](_0xdce7b3);return _0x30764b[_0xe6c1('0x1d')]('Content-Range',_0xddcc31+'-'+_0x3af69c+'/'+_0x20b566)[_0xe6c1('0x1e')](_0x2e7454);}return null;};}function patchUpdates(_0x45c414){return function(_0x36cc83){try{jsonpatch[_0xe6c1('0x1f')](_0x36cc83,_0x45c414,!![]);}catch(_0x5709e0){return BPromise[_0xe6c1('0x20')](_0x5709e0);}return _0x36cc83[_0xe6c1('0x21')]();};}function saveUpdates(_0x5535f7,_0x1e8774){return function(_0x45ee2b){if(_0x45ee2b){return _0x45ee2b[_0xe6c1('0x22')](_0x5535f7)[_0xe6c1('0x23')](function(_0x368d70){return _0x368d70;});}return null;};}function removeEntity(_0x27357b,_0x49d02b){return function(_0x38e45f){if(_0x38e45f){return _0x38e45f[_0xe6c1('0x24')]()[_0xe6c1('0x23')](function(){_0x27357b[_0xe6c1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x473cba,_0x24c22a){return function(_0x25dc9a){if(!_0x25dc9a){_0x473cba[_0xe6c1('0x17')](0x194);}return _0x25dc9a;};}function handleError(_0xee4b5c,_0x9898c){_0x9898c=_0x9898c||0x1f4;return function(_0x5292df){logger[_0xe6c1('0x25')](_0x5292df[_0xe6c1('0x26')]);if(_0x5292df[_0xe6c1('0x27')]){delete _0x5292df[_0xe6c1('0x27')];}_0xee4b5c[_0xe6c1('0x19')](_0x9898c)['send'](_0x5292df);};}exports['index']=function(_0x5a60fb,_0x1e524a){var _0xbd83ec={},_0x181485={},_0x3b2f18={'count':0x0,'rows':[]};var _0x467438=_['map'](db[_0xe6c1('0x28')][_0xe6c1('0x29')],function(_0x383239){return{'name':_0x383239[_0xe6c1('0x2a')],'type':_0x383239[_0xe6c1('0x2b')][_0xe6c1('0x2c')]};});_0x181485['model']=_[_0xe6c1('0x2d')](_0x467438,'name');_0x181485[_0xe6c1('0x2e')]=_[_0xe6c1('0x2f')](_0x5a60fb[_0xe6c1('0x2e')]);_0x181485[_0xe6c1('0x30')]=_['intersection'](_0x181485['model'],_0x181485['query']);_0xbd83ec[_0xe6c1('0x31')]=_[_0xe6c1('0x32')](_0x181485[_0xe6c1('0x33')],qs[_0xe6c1('0x34')](_0x5a60fb[_0xe6c1('0x2e')][_0xe6c1('0x34')]));_0xbd83ec[_0xe6c1('0x31')]=_0xbd83ec[_0xe6c1('0x31')][_0xe6c1('0x35')]?_0xbd83ec[_0xe6c1('0x31')]:_0x181485[_0xe6c1('0x33')];if(!_0x5a60fb[_0xe6c1('0x2e')][_0xe6c1('0x36')](_0xe6c1('0x37'))){_0xbd83ec['limit']=qs['limit'](_0x5a60fb['query'][_0xe6c1('0x1c')]);_0xbd83ec[_0xe6c1('0x1b')]=qs[_0xe6c1('0x1b')](_0x5a60fb['query'][_0xe6c1('0x1b')]);}_0xbd83ec[_0xe6c1('0x38')]=qs[_0xe6c1('0x39')](_0x5a60fb[_0xe6c1('0x2e')]['sort']);_0xbd83ec['where']=qs['filters'](_[_0xe6c1('0x3a')](_0x5a60fb[_0xe6c1('0x2e')],_0x181485['filters']),_0x467438);if(_0x5a60fb[_0xe6c1('0x2e')][_0xe6c1('0x3b')]){_0xbd83ec[_0xe6c1('0x3c')]=_['merge'](_0xbd83ec[_0xe6c1('0x3c')],{'$or':_['map'](_0x467438,function(_0x355730){if(_0x355730[_0xe6c1('0x2b')]!==_0xe6c1('0x3d')){var _0x32912c={};_0x32912c[_0x355730[_0xe6c1('0x27')]]={'$like':'%'+_0x5a60fb[_0xe6c1('0x2e')][_0xe6c1('0x3b')]+'%'};return _0x32912c;}})});}_0xbd83ec=_[_0xe6c1('0x3e')]({},_0xbd83ec,_0x5a60fb[_0xe6c1('0x3f')]);var _0x1c4a38={'where':_0xbd83ec[_0xe6c1('0x3c')]};return db[_0xe6c1('0x28')][_0xe6c1('0x1a')](_0x1c4a38)['then'](function(_0x872fc3){_0x3b2f18[_0xe6c1('0x1a')]=_0x872fc3;if(_0x5a60fb['query'][_0xe6c1('0x40')]){_0xbd83ec[_0xe6c1('0x41')]=[{'all':!![]}];}return db['SalesforceField'][_0xe6c1('0x42')](_0xbd83ec);})[_0xe6c1('0x23')](function(_0x5e14d8){_0x3b2f18[_0xe6c1('0x43')]=_0x5e14d8;return _0x3b2f18;})[_0xe6c1('0x23')](respondWithFilteredResult(_0x1e524a,_0xbd83ec))[_0xe6c1('0x44')](handleError(_0x1e524a,null));};exports[_0xe6c1('0x45')]=function(_0x32c9c4,_0xfaf839){var _0x65cd36={'raw':!![],'where':{'id':_0x32c9c4[_0xe6c1('0x46')]['id']}},_0x157a01={};_0x157a01['model']=_[_0xe6c1('0x2f')](db[_0xe6c1('0x28')][_0xe6c1('0x29')]);_0x157a01[_0xe6c1('0x2e')]=_[_0xe6c1('0x2f')](_0x32c9c4[_0xe6c1('0x2e')]);_0x157a01[_0xe6c1('0x30')]=_[_0xe6c1('0x32')](_0x157a01[_0xe6c1('0x33')],_0x157a01['query']);_0x65cd36[_0xe6c1('0x31')]=_[_0xe6c1('0x32')](_0x157a01['model'],qs[_0xe6c1('0x34')](_0x32c9c4['query'][_0xe6c1('0x34')]));_0x65cd36['attributes']=_0x65cd36[_0xe6c1('0x31')]['length']?_0x65cd36[_0xe6c1('0x31')]:_0x157a01[_0xe6c1('0x33')];if(_0x32c9c4[_0xe6c1('0x2e')]['includeAll']){_0x65cd36['include']=[{'all':!![]}];}_0x65cd36=_[_0xe6c1('0x3e')]({},_0x65cd36,_0x32c9c4[_0xe6c1('0x3f')]);return db[_0xe6c1('0x28')][_0xe6c1('0x47')](_0x65cd36)[_0xe6c1('0x23')](handleEntityNotFound(_0xfaf839,null))[_0xe6c1('0x23')](respondWithResult(_0xfaf839,null))['catch'](handleError(_0xfaf839,null));};exports['create']=function(_0x70c314,_0x15e9df){return db[_0xe6c1('0x28')][_0xe6c1('0x48')](_0x70c314[_0xe6c1('0x49')],{})[_0xe6c1('0x23')](respondWithResult(_0x15e9df,0xc9))[_0xe6c1('0x44')](handleError(_0x15e9df,null));};exports[_0xe6c1('0x22')]=function(_0x54bba9,_0x5940bc){if(_0x54bba9[_0xe6c1('0x49')]['id']){delete _0x54bba9[_0xe6c1('0x49')]['id'];}return db[_0xe6c1('0x28')]['find']({'where':{'id':_0x54bba9[_0xe6c1('0x46')]['id']}})[_0xe6c1('0x23')](handleEntityNotFound(_0x5940bc,null))[_0xe6c1('0x23')](saveUpdates(_0x54bba9[_0xe6c1('0x49')],null))[_0xe6c1('0x23')](respondWithResult(_0x5940bc,null))[_0xe6c1('0x44')](handleError(_0x5940bc,null));};exports[_0xe6c1('0x24')]=function(_0x22af02,_0x42a14e){return db[_0xe6c1('0x28')]['find']({'where':{'id':_0x22af02[_0xe6c1('0x46')]['id']}})['then'](handleEntityNotFound(_0x42a14e,null))[_0xe6c1('0x23')](removeEntity(_0x42a14e,null))[_0xe6c1('0x44')](handleError(_0x42a14e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 79a793e..17a30f6 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 _0x1d24=['util','../../config/logger','bluebird','request-promise','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash'];(function(_0x3ba8d9,_0x3feb41){var _0x57a03c=function(_0x29872e){while(--_0x29872e){_0x3ba8d9['push'](_0x3ba8d9['shift']());}};_0x57a03c(++_0x3feb41);}(_0x1d24,0xa7));var _0x41d2=function(_0x1ff58e,_0x59883f){_0x1ff58e=_0x1ff58e-0x0;var _0x365452=_0x1d24[_0x1ff58e];return _0x365452;};'use strict';var _=require(_0x41d2('0x0'));var util=require(_0x41d2('0x1'));var logger=require(_0x41d2('0x2'))('api');var moment=require('moment');var BPromise=require(_0x41d2('0x3'));var rp=require(_0x41d2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x41d2('0x5')]=function(_0xba2a2,_0x405058){return _0xba2a2[_0x41d2('0x6')](_0x41d2('0x7'),attributes,{'tableName':_0x41d2('0x8'),'paranoid':![],'indexes':[{'name':_0x41d2('0x9'),'fields':[_0x41d2('0xa'),_0x41d2('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a46=['path','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0x4a46,0x18e));var _0x64a4=function(_0x442041,_0x3ddbdf){_0x442041=_0x442041-0x0;var _0x22dcf8=_0x4a46[_0x442041];return _0x22dcf8;};'use strict';var _=require(_0x64a4('0x0'));var util=require(_0x64a4('0x1'));var logger=require(_0x64a4('0x2'))(_0x64a4('0x3'));var moment=require(_0x64a4('0x4'));var BPromise=require(_0x64a4('0x5'));var rp=require(_0x64a4('0x6'));var fs=require('fs');var path=require(_0x64a4('0x7'));var rimraf=require('rimraf');var config=require(_0x64a4('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0x64a4('0x9')]=function(_0x4b0134,_0x6daf0c){return _0x4b0134[_0x64a4('0xa')](_0x64a4('0xb'),attributes,{'tableName':_0x64a4('0xc'),'paranoid':![],'indexes':[{'name':_0x64a4('0xd'),'fields':['idField',_0x64a4('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 aeb0b5f..4b4f35d 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 _0x9bde=['code','message','SalesforceField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x1e6104,_0x282f09){var _0x223e8c=function(_0x44413e){while(--_0x44413e){_0x1e6104['push'](_0x1e6104['shift']());}};_0x223e8c(++_0x282f09);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4cfccc,_0x292494){_0x4cfccc=_0x4cfccc-0x0;var _0x5ac57a=_0x9bde[_0x4cfccc];return _0x5ac57a;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('SalesforceField,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0x70e0=['code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x11c3f9,_0x1d3349){var _0x23a7f3=function(_0x484f25){while(--_0x484f25){_0x11c3f9['push'](_0x11c3f9['shift']());}};_0x23a7f3(++_0x1d3349);}(_0x70e0,0x17b));var _0x070e=function(_0x3f1483,_0x12ba34){_0x3f1483=_0x3f1483-0x0;var _0x2cd114=_0x70e0[_0x3f1483];return _0x2cd114;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('SalesforceField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('SalesforceField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 2364cc4..2f359b1 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 _0x28a2=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x228a('0x0'));var util=require(_0x228a('0x1'));var path=require(_0x228a('0x2'));var timeout=require(_0x228a('0x3'));var express=require(_0x228a('0x4'));var router=express[_0x228a('0x5')]();var auth=require(_0x228a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x228a('0x7'));var controller=require('./intServicenowAccount.controller');router[_0x228a('0x8')]('/',auth[_0x228a('0x9')](),controller[_0x228a('0xa')]);router[_0x228a('0x8')](_0x228a('0xb'),auth['isAuthenticated'](),controller[_0x228a('0xc')]);router[_0x228a('0x8')](_0x228a('0xd'),auth[_0x228a('0x9')](),controller['getConfigurations']);router[_0x228a('0x8')](_0x228a('0xe'),auth[_0x228a('0x9')](),controller[_0x228a('0xf')]);router[_0x228a('0x10')]('/',auth[_0x228a('0x9')](),controller[_0x228a('0x11')]);router[_0x228a('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x228a('0x12')](_0x228a('0xb'),auth[_0x228a('0x9')](),controller[_0x228a('0x13')]);router[_0x228a('0x14')]('/:id',auth[_0x228a('0x9')](),controller[_0x228a('0x15')]);module[_0x228a('0x16')]=router; \ No newline at end of file +var _0xe008=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xe008,0x14f));var _0x8e00=function(_0x3ab0b7,_0x14f89e){_0x3ab0b7=_0x3ab0b7-0x0;var _0xe5006c=_0xe008[_0x3ab0b7];return _0xe5006c;};'use strict';var multer=require('multer');var util=require(_0x8e00('0x0'));var path=require(_0x8e00('0x1'));var timeout=require(_0x8e00('0x2'));var express=require(_0x8e00('0x3'));var router=express[_0x8e00('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8e00('0x5'));var config=require(_0x8e00('0x6'));var controller=require('./intServicenowAccount.controller');router[_0x8e00('0x7')]('/',auth[_0x8e00('0x8')](),controller['index']);router[_0x8e00('0x7')](_0x8e00('0x9'),auth[_0x8e00('0x8')](),controller[_0x8e00('0xa')]);router[_0x8e00('0x7')]('/:id/configurations',auth[_0x8e00('0x8')](),controller[_0x8e00('0xb')]);router[_0x8e00('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8e00('0xc')]);router[_0x8e00('0xd')]('/',auth['isAuthenticated'](),controller[_0x8e00('0xe')]);router['post'](_0x8e00('0xf'),auth['isAuthenticated'](),controller[_0x8e00('0x10')]);router[_0x8e00('0x11')]('/:id',auth[_0x8e00('0x8')](),controller[_0x8e00('0x12')]);router[_0x8e00('0x13')](_0x8e00('0x9'),auth[_0x8e00('0x8')](),controller[_0x8e00('0x14')]);module[_0x8e00('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 055a0be..03bcf66 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 _0xb9af=['remoteUri','sequelize','exports','STRING','username'];(function(_0x27d737,_0x5e1f8d){var _0x58cc73=function(_0x165063){while(--_0x165063){_0x27d737['push'](_0x27d737['shift']());}};_0x58cc73(++_0x5e1f8d);}(_0xb9af,0x88));var _0xfb9a=function(_0x1b9e19,_0xdf140d){_0x1b9e19=_0x1b9e19-0x0;var _0x4a0036=_0xb9af[_0x1b9e19];return _0x4a0036;};'use strict';var Sequelize=require(_0xfb9a('0x0'));module[_0xfb9a('0x1')]={'name':{'type':Sequelize[_0xfb9a('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfb9a('0x2')],'unique':_0xfb9a('0x3')},'password':{'type':Sequelize[_0xfb9a('0x2')]},'email':{'type':Sequelize[_0xfb9a('0x2')]},'remoteUri':{'type':Sequelize[_0xfb9a('0x2')],'unique':_0xfb9a('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfb2c=['sequelize','exports','STRING','username'];(function(_0x497d67,_0x592fad){var _0x24573=function(_0x2e4668){while(--_0x2e4668){_0x497d67['push'](_0x497d67['shift']());}};_0x24573(++_0x592fad);}(_0xfb2c,0xac));var _0xcfb2=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xfb2c[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0xcfb2('0x0'));module[_0xcfb2('0x1')]={'name':{'type':Sequelize[_0xcfb2('0x2')]},'description':{'type':Sequelize[_0xcfb2('0x2')]},'username':{'type':Sequelize[_0xcfb2('0x2')],'unique':_0xcfb2('0x3')},'password':{'type':Sequelize[_0xcfb2('0x2')]},'email':{'type':Sequelize[_0xcfb2('0x2')]},'remoteUri':{'type':Sequelize[_0xcfb2('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xcfb2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 51072e2..cca552d 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 _0xa1a5=['cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','subcategory','work_notes','short_description','close_code','correlation_display','delivery_task','assignment_group','additional_assignee_list','description','sys_class_name','closed_by','parent_incident','sys_id','reopened_by','urgency','problem_id','company','activity_due','sla_due','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','location','username','password','email','remoteUri','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','remove','includes','forEach','label','push','assign','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','all','statusCode','Wrong\x20credentials','boolean','false','value','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','count','offset','set','reject','update','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','length','find','create','body','getConfigurations','ServicenowConfiguration','findOne','Subjects','channel','Descriptions','ServicenowField','getFields','made_sla','notify','incident_state','severity','category','parent','upon_reject','sys_updated_on','hold_reason','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at'];(function(_0xd1a5ff,_0x267b33){var _0x2aa281=function(_0x190d47){while(--_0x190d47){_0xd1a5ff['push'](_0xd1a5ff['shift']());}};_0x2aa281(++_0x267b33);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0x2d7e7d,_0x893947){_0x2d7e7d=_0x2d7e7d-0x0;var _0x17be49=_0xa1a5[_0x2d7e7d];return _0x17be49;};'use strict';var pdf=require(_0x5a1a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5a1a('0x1'));var zipdir=require(_0x5a1a('0x2'));var jsonpatch=require(_0x5a1a('0x3'));var rp=require(_0x5a1a('0x4'));var moment=require(_0x5a1a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5a1a('0x6'));var util=require(_0x5a1a('0x7'));var path=require(_0x5a1a('0x8'));var sox=require(_0x5a1a('0x9'));var csv=require(_0x5a1a('0xa'));var ejs=require(_0x5a1a('0xb'));var fs=require('fs');var _=require(_0x5a1a('0xc'));var squel=require('squel');var crypto=require(_0x5a1a('0xd'));var jsforce=require(_0x5a1a('0xe'));var deskjs=require(_0x5a1a('0xf'));var toCsv=require(_0x5a1a('0xa'));var querystring=require(_0x5a1a('0x10'));var Papa=require(_0x5a1a('0x11'));var Redis=require(_0x5a1a('0x12'));var authService=require(_0x5a1a('0x13'));var qs=require(_0x5a1a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a1a('0x15'));var logger=require(_0x5a1a('0x16'))(_0x5a1a('0x17'));var utils=require('../../config/utils');var config=require(_0x5a1a('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x5a1a('0x19')][_0x5a1a('0x1a')]({'port':0x232a});function checkPasswordPattern(_0xf10cf6,_0x1406bd,_0x567c65){if(_0x567c65){var _0x1e3b92=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e3b92[_0x5a1a('0x1b')](_0x1406bd)){return _0xf10cf6;}else{throw new db['Sequelize'][(_0x5a1a('0x1c'))](_0x5a1a('0x1d'));}}else{return _0xf10cf6;}}function respondWithRpcPromise(_0x53f996,_0x51d31f,_0x262379,_0x2aa155){return new BPromise(function(_0x3cfb8c,_0x1580fe){var _0x3d0432=_0x2aa155||client;return _0x3d0432[_0x5a1a('0x1e')](_0x53f996,_0x262379)[_0x5a1a('0x1f')](function(_0x2e8e89){logger['info'](_0x5a1a('0x20'),_0x51d31f,_0x5a1a('0x21'));logger[_0x5a1a('0x22')](_0x5a1a('0x23'),_0x51d31f,_0x5a1a('0x21'),JSON[_0x5a1a('0x24')](_0x2e8e89));if(_0x2e8e89[_0x5a1a('0x25')]){if(_0x2e8e89[_0x5a1a('0x25')][_0x5a1a('0x26')]===0x1f4){logger[_0x5a1a('0x25')](_0x5a1a('0x20'),_0x51d31f,_0x2e8e89[_0x5a1a('0x25')]['message']);return _0x1580fe(_0x2e8e89['error'][_0x5a1a('0x27')]);}logger['error'](_0x5a1a('0x20'),_0x51d31f,_0x2e8e89[_0x5a1a('0x25')][_0x5a1a('0x27')]);return _0x3cfb8c(_0x2e8e89[_0x5a1a('0x25')][_0x5a1a('0x27')]);}else{logger[_0x5a1a('0x28')]('ServicenowAccount,\x20%s,\x20%s',_0x51d31f,_0x5a1a('0x21'));_0x3cfb8c(_0x2e8e89[_0x5a1a('0x29')][_0x5a1a('0x27')]);}})[_0x5a1a('0x2a')](function(_0x542f2a){logger['error'](_0x5a1a('0x20'),_0x51d31f,_0x542f2a);_0x1580fe(_0x542f2a);});});}function respondWithStatusCode(_0x4249b2,_0x244832){_0x244832=_0x244832||0xcc;return function(_0x5cc6ad){if(_0x5cc6ad){return _0x4249b2[_0x5a1a('0x2b')](_0x244832);}return _0x4249b2['status'](_0x244832)[_0x5a1a('0x2c')]();};}function respondWithResult(_0x34ba90,_0x23debc){_0x23debc=_0x23debc||0xc8;return function(_0x163e8e){if(_0x163e8e){return _0x34ba90[_0x5a1a('0x2d')](_0x23debc)[_0x5a1a('0x2e')](_0x163e8e);}};}function respondWithFilteredResult(_0x2ffcd7,_0x267e0c){return function(_0x3bc406){if(_0x3bc406){var _0x53f2bb=_0x3bc406[_0x5a1a('0x2f')],_0x477a11=_0x267e0c[_0x5a1a('0x30')],_0x50832f=_0x267e0c[_0x5a1a('0x30')]+_0x267e0c['limit'],_0x19a0dd;if(_0x50832f>=_0x53f2bb){_0x50832f=_0x53f2bb;_0x19a0dd=0xc8;}else{_0x19a0dd=0xce;}_0x2ffcd7[_0x5a1a('0x2d')](_0x19a0dd);return _0x2ffcd7[_0x5a1a('0x31')]('Content-Range',_0x477a11+'-'+_0x50832f+'/'+_0x53f2bb)['json'](_0x3bc406);}return null;};}function patchUpdates(_0x30d25a){return function(_0x570d7b){try{jsonpatch['apply'](_0x570d7b,_0x30d25a,!![]);}catch(_0x2b02c8){return BPromise[_0x5a1a('0x32')](_0x2b02c8);}return _0x570d7b['save']();};}function saveUpdates(_0x5c3668,_0x4b51d0){return function(_0x3ce404){if(_0x3ce404){return _0x3ce404[_0x5a1a('0x33')](_0x5c3668)['then'](function(_0x591f6d){return _0x591f6d;});}return null;};}function removeEntity(_0xe3b0a8,_0x4c75c0){return function(_0xd836a8){if(_0xd836a8){return _0xd836a8[_0x5a1a('0x34')]()['then'](function(){_0xe3b0a8[_0x5a1a('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x512a65,_0x3ea4dc){return function(_0x1ff066){if(!_0x1ff066){_0x512a65[_0x5a1a('0x2b')](0x194);}return _0x1ff066;};}function handleError(_0x96602b,_0x5bc365){_0x5bc365=_0x5bc365||0x1f4;return function(_0x24e3dd){logger['error'](_0x24e3dd[_0x5a1a('0x35')]);if(_0x24e3dd[_0x5a1a('0x36')]){delete _0x24e3dd[_0x5a1a('0x36')];}_0x96602b[_0x5a1a('0x2d')](_0x5bc365)[_0x5a1a('0x37')](_0x24e3dd);};}exports[_0x5a1a('0x38')]=function(_0x541e20,_0x4e9d26){var _0x2036d0={},_0x18df27={},_0x30f7c8={'count':0x0,'rows':[]};var _0x8530ad=_[_0x5a1a('0x39')](db[_0x5a1a('0x3a')][_0x5a1a('0x3b')],function(_0x27252c){return{'name':_0x27252c[_0x5a1a('0x3c')],'type':_0x27252c[_0x5a1a('0x3d')][_0x5a1a('0x3e')]};});_0x18df27[_0x5a1a('0x3f')]=_[_0x5a1a('0x39')](_0x8530ad,'name');_0x18df27['query']=_[_0x5a1a('0x40')](_0x541e20[_0x5a1a('0x41')]);_0x18df27[_0x5a1a('0x42')]=_[_0x5a1a('0x43')](_0x18df27['model'],_0x18df27['query']);_0x2036d0[_0x5a1a('0x44')]=_[_0x5a1a('0x43')](_0x18df27[_0x5a1a('0x3f')],qs['fields'](_0x541e20[_0x5a1a('0x41')][_0x5a1a('0x45')]));_0x2036d0[_0x5a1a('0x44')]=_0x2036d0[_0x5a1a('0x44')]['length']?_0x2036d0[_0x5a1a('0x44')]:_0x18df27[_0x5a1a('0x3f')];if(!_0x541e20[_0x5a1a('0x41')][_0x5a1a('0x46')](_0x5a1a('0x47'))){_0x2036d0['limit']=qs[_0x5a1a('0x48')](_0x541e20['query'][_0x5a1a('0x48')]);_0x2036d0[_0x5a1a('0x30')]=qs['offset'](_0x541e20[_0x5a1a('0x41')][_0x5a1a('0x30')]);}_0x2036d0[_0x5a1a('0x49')]=qs[_0x5a1a('0x4a')](_0x541e20[_0x5a1a('0x41')][_0x5a1a('0x4a')]);_0x2036d0[_0x5a1a('0x4b')]=qs[_0x5a1a('0x42')](_[_0x5a1a('0x4c')](_0x541e20[_0x5a1a('0x41')],_0x18df27[_0x5a1a('0x42')]),_0x8530ad);if(_0x541e20[_0x5a1a('0x41')]['filter']){_0x2036d0[_0x5a1a('0x4b')]=_[_0x5a1a('0x4d')](_0x2036d0[_0x5a1a('0x4b')],{'$or':_[_0x5a1a('0x39')](_0x8530ad,function(_0x126755){if(_0x126755[_0x5a1a('0x3d')]!==_0x5a1a('0x4e')){var _0x4af89b={};_0x4af89b[_0x126755[_0x5a1a('0x36')]]={'$like':'%'+_0x541e20[_0x5a1a('0x41')][_0x5a1a('0x4f')]+'%'};return _0x4af89b;}})});}_0x2036d0=_[_0x5a1a('0x4d')]({},_0x2036d0,_0x541e20[_0x5a1a('0x50')]);var _0x51a15d={'where':_0x2036d0[_0x5a1a('0x4b')]};return db[_0x5a1a('0x3a')][_0x5a1a('0x2f')](_0x51a15d)[_0x5a1a('0x1f')](function(_0x57cd79){_0x30f7c8[_0x5a1a('0x2f')]=_0x57cd79;if(_0x541e20['query'][_0x5a1a('0x51')]){_0x2036d0[_0x5a1a('0x52')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x2036d0);})[_0x5a1a('0x1f')](function(_0x1171a0){_0x30f7c8[_0x5a1a('0x53')]=_0x1171a0;return _0x30f7c8;})[_0x5a1a('0x1f')](respondWithFilteredResult(_0x4e9d26,_0x2036d0))['catch'](handleError(_0x4e9d26,null));};exports[_0x5a1a('0x54')]=function(_0x18f6ee,_0x5753a8){var _0x78d918={'raw':![],'where':{'id':_0x18f6ee[_0x5a1a('0x55')]['id']}},_0x3bd470={};_0x3bd470[_0x5a1a('0x3f')]=_['keys'](db['ServicenowAccount']['rawAttributes']);_0x3bd470[_0x5a1a('0x41')]=_[_0x5a1a('0x40')](_0x18f6ee[_0x5a1a('0x41')]);_0x3bd470['filters']=_[_0x5a1a('0x43')](_0x3bd470[_0x5a1a('0x3f')],_0x3bd470[_0x5a1a('0x41')]);_0x78d918['attributes']=_[_0x5a1a('0x43')](_0x3bd470[_0x5a1a('0x3f')],qs['fields'](_0x18f6ee[_0x5a1a('0x41')][_0x5a1a('0x45')]));_0x78d918[_0x5a1a('0x44')]=_0x78d918[_0x5a1a('0x44')][_0x5a1a('0x56')]?_0x78d918['attributes']:_0x3bd470[_0x5a1a('0x3f')];if(_0x18f6ee[_0x5a1a('0x41')]['includeAll']){_0x78d918[_0x5a1a('0x52')]=[{'all':!![]}];}_0x78d918=_[_0x5a1a('0x4d')]({},_0x78d918,_0x18f6ee[_0x5a1a('0x50')]);return db[_0x5a1a('0x3a')][_0x5a1a('0x57')](_0x78d918)['then'](handleEntityNotFound(_0x5753a8,null))[_0x5a1a('0x1f')](respondWithResult(_0x5753a8,null))[_0x5a1a('0x2a')](handleError(_0x5753a8,null));};exports[_0x5a1a('0x58')]=function(_0x1ec8eb,_0x3cb16d){return db['ServicenowAccount']['create'](_0x1ec8eb[_0x5a1a('0x59')],{})[_0x5a1a('0x1f')](respondWithResult(_0x3cb16d,0xc9))[_0x5a1a('0x2a')](handleError(_0x3cb16d,null));};exports[_0x5a1a('0x33')]=function(_0x1704ea,_0x10c8a7){if(_0x1704ea[_0x5a1a('0x59')]['id']){delete _0x1704ea[_0x5a1a('0x59')]['id'];}return db[_0x5a1a('0x3a')][_0x5a1a('0x57')]({'where':{'id':_0x1704ea[_0x5a1a('0x55')]['id']}})[_0x5a1a('0x1f')](handleEntityNotFound(_0x10c8a7,null))[_0x5a1a('0x1f')](saveUpdates(_0x1704ea[_0x5a1a('0x59')],null))[_0x5a1a('0x1f')](respondWithResult(_0x10c8a7,null))['catch'](handleError(_0x10c8a7,null));};exports['destroy']=function(_0x4bd666,_0x2e486c){return db[_0x5a1a('0x3a')][_0x5a1a('0x57')]({'where':{'id':_0x4bd666['params']['id']}})['then'](handleEntityNotFound(_0x2e486c,null))[_0x5a1a('0x1f')](removeEntity(_0x2e486c,null))[_0x5a1a('0x2a')](handleError(_0x2e486c,null));};exports[_0x5a1a('0x5a')]=function(_0x189aeb,_0x51652c,_0x2dfd27){var _0x2afacc={};var _0x401609={};var _0x49afa9;var _0x324b1c;return db[_0x5a1a('0x3a')]['findOne']({'where':{'id':_0x189aeb[_0x5a1a('0x55')]['id']}})[_0x5a1a('0x1f')](handleEntityNotFound(_0x51652c,null))['then'](function(_0x3cca72){if(_0x3cca72){_0x49afa9=_0x3cca72;_0x401609[_0x5a1a('0x3f')]=_[_0x5a1a('0x40')](db[_0x5a1a('0x5b')]['rawAttributes']);_0x401609[_0x5a1a('0x41')]=_['keys'](_0x189aeb['query']);_0x401609['filters']=_[_0x5a1a('0x43')](_0x401609['model'],_0x401609[_0x5a1a('0x41')]);_0x2afacc[_0x5a1a('0x44')]=_[_0x5a1a('0x43')](_0x401609[_0x5a1a('0x3f')],qs[_0x5a1a('0x45')](_0x189aeb[_0x5a1a('0x41')][_0x5a1a('0x45')]));_0x2afacc[_0x5a1a('0x44')]=_0x2afacc[_0x5a1a('0x44')][_0x5a1a('0x56')]?_0x2afacc[_0x5a1a('0x44')]:_0x401609['model'];_0x2afacc[_0x5a1a('0x49')]=qs['sort'](_0x189aeb[_0x5a1a('0x41')]['sort']);_0x2afacc[_0x5a1a('0x4b')]=qs[_0x5a1a('0x42')](_['pick'](_0x189aeb[_0x5a1a('0x41')],_0x401609[_0x5a1a('0x42')]));if(_0x189aeb[_0x5a1a('0x41')][_0x5a1a('0x4f')]){_0x2afacc[_0x5a1a('0x4b')]=_[_0x5a1a('0x4d')](_0x2afacc[_0x5a1a('0x4b')],{'$or':_[_0x5a1a('0x39')](_0x2afacc['attributes'],function(_0x141e43){var _0x4eadaa={};_0x4eadaa[_0x141e43]={'$like':'%'+_0x189aeb['query'][_0x5a1a('0x4f')]+'%'};return _0x4eadaa;})});}_0x2afacc=_[_0x5a1a('0x4d')]({},_0x2afacc,_0x189aeb[_0x5a1a('0x50')]);return _0x49afa9['getConfigurations'](_0x2afacc);}})[_0x5a1a('0x1f')](function(_0x375838){if(_0x375838){_0x324b1c=_0x375838[_0x5a1a('0x56')];if(!_0x189aeb[_0x5a1a('0x41')]['hasOwnProperty'](_0x5a1a('0x47'))){_0x2afacc[_0x5a1a('0x48')]=qs[_0x5a1a('0x48')](_0x189aeb[_0x5a1a('0x41')][_0x5a1a('0x48')]);_0x2afacc['offset']=qs['offset'](_0x189aeb['query']['offset']);}return _0x49afa9[_0x5a1a('0x5a')](_0x2afacc);}})[_0x5a1a('0x1f')](function(_0x35ae8a){if(_0x35ae8a){return _0x35ae8a?{'count':_0x324b1c,'rows':_0x35ae8a}:null;}})[_0x5a1a('0x1f')](respondWithResult(_0x51652c,null))[_0x5a1a('0x2a')](handleError(_0x51652c,null));};exports['addConfiguration']=function(_0x490283,_0x5f27c5,_0x128264){if(_0x490283[_0x5a1a('0x59')]['id']){delete _0x490283[_0x5a1a('0x59')]['id'];}return db[_0x5a1a('0x3a')][_0x5a1a('0x5c')]({'where':{'id':_0x490283['params']['id']}})[_0x5a1a('0x1f')](handleEntityNotFound(_0x5f27c5,null))['then'](function(_0x48b9a2){if(_0x48b9a2){_0x490283[_0x5a1a('0x59')]['AccountId']=_0x48b9a2['id'];_0x490283[_0x5a1a('0x59')][_0x5a1a('0x5d')]=integrations['getSubjects'](_0x490283[_0x5a1a('0x59')][_0x5a1a('0x5e')],_0x490283[_0x5a1a('0x59')][_0x5a1a('0x3d')]);_0x490283['body'][_0x5a1a('0x5f')]=integrations['getDescriptions'](_0x490283['body']['channel'],_0x490283[_0x5a1a('0x59')][_0x5a1a('0x3d')]);return db[_0x5a1a('0x5b')][_0x5a1a('0x58')](_0x490283['body'],{'include':[{'model':db[_0x5a1a('0x60')],'as':_0x5a1a('0x5d')},{'model':db[_0x5a1a('0x60')],'as':_0x5a1a('0x5f')}]});}return null;})[_0x5a1a('0x1f')](respondWithResult(_0x5f27c5,null))[_0x5a1a('0x2a')](handleError(_0x5f27c5,null));};exports[_0x5a1a('0x61')]=function(_0x5a60af,_0x4cbfaa,_0x249d44){var _0x2f7543=[_0x5a1a('0x62'),'hold_reason','knowledge','subcategory','close_code',_0x5a1a('0x63'),_0x5a1a('0x64'),_0x5a1a('0x65'),_0x5a1a('0x66')];var _0x3bf30a=[_0x5a1a('0x67'),_0x5a1a('0x62'),'caused_by','watch_list',_0x5a1a('0x68'),_0x5a1a('0x69'),'child_incidents',_0x5a1a('0x6a'),'approval_history',_0x5a1a('0x6b'),_0x5a1a('0x6c'),_0x5a1a('0x6d'),_0x5a1a('0x6e'),'user_input',_0x5a1a('0x6f'),_0x5a1a('0x70'),_0x5a1a('0x71'),_0x5a1a('0x72'),_0x5a1a('0x73'),_0x5a1a('0x49'),_0x5a1a('0x74'),_0x5a1a('0x75'),_0x5a1a('0x76'),'delivery_plan',_0x5a1a('0x77'),_0x5a1a('0x78'),_0x5a1a('0x79'),_0x5a1a('0x7a'),_0x5a1a('0x7b'),_0x5a1a('0x7c'),_0x5a1a('0x7d'),_0x5a1a('0x7e'),'expected_start',_0x5a1a('0x7f'),_0x5a1a('0x80'),_0x5a1a('0x81'),_0x5a1a('0x82'),_0x5a1a('0x83'),_0x5a1a('0x84'),_0x5a1a('0x85'),'approval_set',_0x5a1a('0x86'),_0x5a1a('0x87'),_0x5a1a('0x88'),_0x5a1a('0x89'),_0x5a1a('0x8a'),_0x5a1a('0x8b'),'work_start',_0x5a1a('0x8c'),'business_stc',_0x5a1a('0x8d'),_0x5a1a('0x8e'),'calendar_duration',_0x5a1a('0x63'),_0x5a1a('0x8f'),'close_notes',_0x5a1a('0x90'),'follow_up',_0x5a1a('0x91'),_0x5a1a('0x92'),'contact_type',_0x5a1a('0x93'),_0x5a1a('0x64'),_0x5a1a('0x94'),_0x5a1a('0x95'),_0x5a1a('0x96'),'reassignment_count',_0x5a1a('0x97'),'assigned_to','severity','comments',_0x5a1a('0x98'),_0x5a1a('0x99'),_0x5a1a('0x9a'),_0x5a1a('0x9b'),'sys_mod_count',_0x5a1a('0x9c'),_0x5a1a('0x9d'),_0x5a1a('0x9e'),_0x5a1a('0x9f'),'correlation_id',_0x5a1a('0xa0'),'category'];var _0x193d73='';var _0x14ad76='';var _0x5cd286=[];var _0x5d079e='';var _0x4d1c56='';var _0x465317=[];var _0x3b0229='';var _0x592274='';var _0x2903a1={};var _0x71822b='';return db[_0x5a1a('0x3a')][_0x5a1a('0x5c')]({'where':{'id':_0x5a60af[_0x5a1a('0x55')]['id']},'attributes':['id',_0x5a1a('0xa1'),_0x5a1a('0xa2'),_0x5a1a('0xa3'),_0x5a1a('0xa4'),'serverUrl']})[_0x5a1a('0x1f')](handleEntityNotFound(_0x4cbfaa,null))[_0x5a1a('0x1f')](function(_0x233f31){if(_0x233f31){_0x71822b=_0x233f31[_0x5a1a('0xa4')];var _0x30ad9e=_0x71822b['slice'](-0x1);if(_0x30ad9e==='/'){_0x71822b=_0x71822b['substring'](0x0,_0x71822b['lastIndexOf'](_0x30ad9e));}_0x592274=util[_0x5a1a('0xa5')](_0x5a1a('0xa6'),_0x71822b);_0x3b0229=util['format'](_0x5a1a('0xa7'),_0x71822b);_0x2903a1={'user':_0x233f31[_0x5a1a('0xa1')],'pass':_0x233f31[_0x5a1a('0xa2')]};var _0x562b83={'method':_0x5a1a('0xa8'),'uri':_0x592274+_0x5a1a('0xa9'),'auth':_0x2903a1,'json':!![]};return rp(_0x562b83);}})[_0x5a1a('0x1f')](function(_0x2061c3){if(_0x2061c3['result'][_0x5a1a('0x56')]>0x0){_0x193d73=_0x2061c3[_0x5a1a('0x29')];}console[_0x5a1a('0xaa')](_0x5a1a('0xab'),_0x193d73);_0x465317=[];_0x14ad76=Object['assign']([],_0x193d73);_[_0x5a1a('0xac')](_0x14ad76,function(_0xe0acb9){return!_0x2f7543[_0x5a1a('0xad')](_0xe0acb9[_0x5a1a('0x36')]);});_0x14ad76[_0x5a1a('0xae')](function(_0x2c5a1e){var _0x4ecf61=createFieldObject(_0x3b0229,_0x2903a1,_0x2c5a1e['internalType'],_0x2c5a1e[_0x5a1a('0x36')],_0x2c5a1e[_0x5a1a('0xaf')],![]);_0x465317[_0x5a1a('0xb0')](_0x4ecf61);});return Promise['all'](_0x465317);})[_0x5a1a('0x1f')](function(_0x412f20){_0x5cd286=_0x412f20;_0x5d079e=Object[_0x5a1a('0xb1')]([],_0x193d73);console[_0x5a1a('0xaa')]('TCL:\x20_object',_0x193d73);_[_0x5a1a('0xac')](_0x5d079e,function(_0x5ac3a0){return _0x3bf30a[_0x5a1a('0xad')](_0x5ac3a0[_0x5a1a('0x36')]);});console['log'](_0x5a1a('0xb2'),_0x5d079e);_0x465317=[];_0x5d079e[_0x5a1a('0xae')](function(_0x2bcdc4){var _0x5e5c06=createFieldObject(_0x3b0229,_0x2903a1,_0x2bcdc4[_0x5a1a('0xb3')],_0x2bcdc4['name'],_0x2bcdc4['label'],!![]);_0x465317['push'](_0x5e5c06);});return Promise[_0x5a1a('0xb4')](_0x465317);})[_0x5a1a('0x1f')](function(_0x2f2644){_0x4d1c56=_0x2f2644;var _0x583248=_0x5cd286['concat'](_0x4d1c56);return{'count':_0x583248['length'],'rows':_0x583248};})[_0x5a1a('0x1f')](respondWithResult(_0x4cbfaa,null))[_0x5a1a('0x2a')](function(_0x5d16b5){console[_0x5a1a('0xaa')]('ServiceNow\x20error:\x20'+_0x5d16b5);var _0x565957=_0x5a60af[_0x5a1a('0x41')][_0x5a1a('0x1b')]?0x1f4:_0x5d16b5[_0x5a1a('0xb5')]||0x1f4;logger[_0x5a1a('0x25')](_0x5d16b5[_0x5a1a('0x35')]);delete _0x5d16b5[_0x5a1a('0x36')];if(_0x565957===0x191){_0x565957=0x190;}_0x4cbfaa['status'](_0x565957)[_0x5a1a('0x37')](_0x5a60af[_0x5a1a('0x41')][_0x5a1a('0x1b')]?{'message':_0x5a1a('0xb6'),'statusCode':_0x5d16b5[_0x5a1a('0xb5')]}:_0x5d16b5);});};function createFieldObject(_0x1f5247,_0x4eb2d1,_0x24e83a,_0x2ce7bd,_0x20e78c,_0x3af227){return new Promise(function(_0x25faed,_0x8dcd22){var _0x4484da={'id':_0x2ce7bd,'name':_0x20e78c,'custom':_0x3af227};if(_0x24e83a===_0x5a1a('0xb7')){_0x4484da['options']=[{'name':'True','value':'true'},{'name':'False','value':_0x5a1a('0xb8')}];_0x25faed(_0x4484da);}else{var _0x384031={'method':_0x5a1a('0xa8'),'uri':_0x1f5247+'sys_choice?sysparm_query=name=incident^element='+_0x2ce7bd,'auth':_0x4eb2d1,'json':!![]};return rp(_0x384031)[_0x5a1a('0x1f')](function(_0x2c2431){var _0x7b428a=[];if(_0x2c2431[_0x5a1a('0x29')]['length']>0x0){_0x2c2431['result'][_0x5a1a('0xae')](function(_0x47fcb6){if(_0x47fcb6['inactive']===_0x5a1a('0xb8')){var _0x2ff29e={'name':_0x47fcb6[_0x5a1a('0xaf')],'value':_0x47fcb6[_0x5a1a('0xb9')]};_0x7b428a[_0x5a1a('0xb0')](_0x2ff29e);}});}_0x4484da['options']=_0x7b428a;if(_0x4484da['options'][_0x5a1a('0x56')]>0x0){_0x25faed(_0x4484da);}else{if(_0x3af227==![]){_0x25faed();}else{_0x25faed(_0x4484da);}}});}});} \ No newline at end of file +var _0xb808=['hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','ServicenowConfiguration','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','close_code','notify','severity','category','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','sys_updated_by','opened_by','sys_created_by','knowledge','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','business_duration','group_list','work_end','reopened_time','resolved_at','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','reopened_by','incident_state','urgency','problem_id','reassignment_count','activity_due','sla_due','comments_and_work_notes','due_date','escalation','upon_approval','correlation_id','username','password','email','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','log','incident\x20table\x20objects','includes','forEach','internalType','label','push','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','statusCode','stack','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','false','value','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','json','count','offset','status','Content-Range','apply','reject','save','update','destroy','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb808,0x12d));var _0x8b80=function(_0x3845a4,_0x28e208){_0x3845a4=_0x3845a4-0x0;var _0x2d0ff4=_0xb808[_0x3845a4];return _0x2d0ff4;};'use strict';var pdf=require(_0x8b80('0x0'));var emlformat=require(_0x8b80('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8b80('0x2'));var rp=require(_0x8b80('0x3'));var moment=require(_0x8b80('0x4'));var BPromise=require(_0x8b80('0x5'));var Mustache=require(_0x8b80('0x6'));var util=require(_0x8b80('0x7'));var path=require(_0x8b80('0x8'));var sox=require(_0x8b80('0x9'));var csv=require(_0x8b80('0xa'));var ejs=require(_0x8b80('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8b80('0xc'));var jsforce=require(_0x8b80('0xd'));var deskjs=require(_0x8b80('0xe'));var toCsv=require(_0x8b80('0xa'));var querystring=require(_0x8b80('0xf'));var Papa=require('papaparse');var Redis=require(_0x8b80('0x10'));var authService=require(_0x8b80('0x11'));var qs=require(_0x8b80('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b80('0x13'));var logger=require('../../config/logger')(_0x8b80('0x14'));var utils=require(_0x8b80('0x15'));var config=require(_0x8b80('0x16'));var db=require(_0x8b80('0x17'))['db'];var integrations=require(_0x8b80('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x8b80('0x19')][_0x8b80('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5828a7,_0x3b9d37,_0x36678c){if(_0x36678c){var _0x193c08=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x193c08[_0x8b80('0x1b')](_0x3b9d37)){return _0x5828a7;}else{throw new db['Sequelize'][(_0x8b80('0x1c'))](_0x8b80('0x1d'));}}else{return _0x5828a7;}}function respondWithRpcPromise(_0x26096f,_0x2864e2,_0x3cdfd9,_0x11c309){return new BPromise(function(_0x482921,_0x1d5d4e){var _0x703664=_0x11c309||client;return _0x703664[_0x8b80('0x1e')](_0x26096f,_0x3cdfd9)[_0x8b80('0x1f')](function(_0x4630c0){logger[_0x8b80('0x20')]('ServicenowAccount,\x20%s,\x20%s',_0x2864e2,_0x8b80('0x21'));logger[_0x8b80('0x22')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x2864e2,_0x8b80('0x21'),JSON[_0x8b80('0x23')](_0x4630c0));if(_0x4630c0[_0x8b80('0x24')]){if(_0x4630c0[_0x8b80('0x24')][_0x8b80('0x25')]===0x1f4){logger[_0x8b80('0x24')](_0x8b80('0x26'),_0x2864e2,_0x4630c0[_0x8b80('0x24')][_0x8b80('0x27')]);return _0x1d5d4e(_0x4630c0[_0x8b80('0x24')][_0x8b80('0x27')]);}logger['error'](_0x8b80('0x26'),_0x2864e2,_0x4630c0[_0x8b80('0x24')][_0x8b80('0x27')]);return _0x482921(_0x4630c0[_0x8b80('0x24')]['message']);}else{logger[_0x8b80('0x20')](_0x8b80('0x26'),_0x2864e2,_0x8b80('0x21'));_0x482921(_0x4630c0[_0x8b80('0x28')][_0x8b80('0x27')]);}})[_0x8b80('0x29')](function(_0x2d76ee){logger[_0x8b80('0x24')](_0x8b80('0x26'),_0x2864e2,_0x2d76ee);_0x1d5d4e(_0x2d76ee);});});}function respondWithStatusCode(_0x55b283,_0x25c40f){_0x25c40f=_0x25c40f||0xcc;return function(_0x2d1250){if(_0x2d1250){return _0x55b283['sendStatus'](_0x25c40f);}return _0x55b283['status'](_0x25c40f)['end']();};}function respondWithResult(_0x1baa3f,_0x3f764f){_0x3f764f=_0x3f764f||0xc8;return function(_0x339e19){if(_0x339e19){return _0x1baa3f['status'](_0x3f764f)[_0x8b80('0x2a')](_0x339e19);}};}function respondWithFilteredResult(_0x4809a0,_0x201d6b){return function(_0x2e5502){if(_0x2e5502){var _0x51d9ac=_0x2e5502[_0x8b80('0x2b')],_0x48ba21=_0x201d6b[_0x8b80('0x2c')],_0x15e232=_0x201d6b[_0x8b80('0x2c')]+_0x201d6b['limit'],_0x731bc4;if(_0x15e232>=_0x51d9ac){_0x15e232=_0x51d9ac;_0x731bc4=0xc8;}else{_0x731bc4=0xce;}_0x4809a0[_0x8b80('0x2d')](_0x731bc4);return _0x4809a0['set'](_0x8b80('0x2e'),_0x48ba21+'-'+_0x15e232+'/'+_0x51d9ac)[_0x8b80('0x2a')](_0x2e5502);}return null;};}function patchUpdates(_0x11e34e){return function(_0x2db6f2){try{jsonpatch[_0x8b80('0x2f')](_0x2db6f2,_0x11e34e,!![]);}catch(_0x2a3fa8){return BPromise[_0x8b80('0x30')](_0x2a3fa8);}return _0x2db6f2[_0x8b80('0x31')]();};}function saveUpdates(_0x50f578,_0x120ac4){return function(_0x541183){if(_0x541183){return _0x541183[_0x8b80('0x32')](_0x50f578)[_0x8b80('0x1f')](function(_0x43c167){return _0x43c167;});}return null;};}function removeEntity(_0x23f297,_0x21af06){return function(_0x20e08f){if(_0x20e08f){return _0x20e08f[_0x8b80('0x33')]()[_0x8b80('0x1f')](function(){_0x23f297[_0x8b80('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b92c9,_0x4d2cc4){return function(_0x359fee){if(!_0x359fee){_0x4b92c9['sendStatus'](0x194);}return _0x359fee;};}function handleError(_0xbd636,_0x58ce41){_0x58ce41=_0x58ce41||0x1f4;return function(_0x5f47df){logger[_0x8b80('0x24')](_0x5f47df['stack']);if(_0x5f47df[_0x8b80('0x34')]){delete _0x5f47df['name'];}_0xbd636[_0x8b80('0x2d')](_0x58ce41)[_0x8b80('0x35')](_0x5f47df);};}exports[_0x8b80('0x36')]=function(_0x5bb88f,_0x8b411f){var _0x692acc={},_0x216fa6={},_0x441681={'count':0x0,'rows':[]};var _0x37b53d=_[_0x8b80('0x37')](db[_0x8b80('0x38')][_0x8b80('0x39')],function(_0x244463){return{'name':_0x244463[_0x8b80('0x3a')],'type':_0x244463[_0x8b80('0x3b')][_0x8b80('0x3c')]};});_0x216fa6[_0x8b80('0x3d')]=_[_0x8b80('0x37')](_0x37b53d,_0x8b80('0x34'));_0x216fa6['query']=_[_0x8b80('0x3e')](_0x5bb88f[_0x8b80('0x3f')]);_0x216fa6[_0x8b80('0x40')]=_[_0x8b80('0x41')](_0x216fa6[_0x8b80('0x3d')],_0x216fa6['query']);_0x692acc[_0x8b80('0x42')]=_[_0x8b80('0x41')](_0x216fa6[_0x8b80('0x3d')],qs[_0x8b80('0x43')](_0x5bb88f[_0x8b80('0x3f')][_0x8b80('0x43')]));_0x692acc['attributes']=_0x692acc[_0x8b80('0x42')][_0x8b80('0x44')]?_0x692acc['attributes']:_0x216fa6['model'];if(!_0x5bb88f['query'][_0x8b80('0x45')](_0x8b80('0x46'))){_0x692acc[_0x8b80('0x47')]=qs[_0x8b80('0x47')](_0x5bb88f['query'][_0x8b80('0x47')]);_0x692acc[_0x8b80('0x2c')]=qs[_0x8b80('0x2c')](_0x5bb88f[_0x8b80('0x3f')][_0x8b80('0x2c')]);}_0x692acc['order']=qs[_0x8b80('0x48')](_0x5bb88f['query'][_0x8b80('0x48')]);_0x692acc[_0x8b80('0x49')]=qs['filters'](_[_0x8b80('0x4a')](_0x5bb88f[_0x8b80('0x3f')],_0x216fa6[_0x8b80('0x40')]),_0x37b53d);if(_0x5bb88f[_0x8b80('0x3f')][_0x8b80('0x4b')]){_0x692acc['where']=_[_0x8b80('0x4c')](_0x692acc[_0x8b80('0x49')],{'$or':_[_0x8b80('0x37')](_0x37b53d,function(_0x4203ec){if(_0x4203ec[_0x8b80('0x3b')]!==_0x8b80('0x4d')){var _0x3bed08={};_0x3bed08[_0x4203ec[_0x8b80('0x34')]]={'$like':'%'+_0x5bb88f[_0x8b80('0x3f')][_0x8b80('0x4b')]+'%'};return _0x3bed08;}})});}_0x692acc=_[_0x8b80('0x4c')]({},_0x692acc,_0x5bb88f[_0x8b80('0x4e')]);var _0x55e89e={'where':_0x692acc[_0x8b80('0x49')]};return db[_0x8b80('0x38')][_0x8b80('0x2b')](_0x55e89e)[_0x8b80('0x1f')](function(_0x224dab){_0x441681[_0x8b80('0x2b')]=_0x224dab;if(_0x5bb88f[_0x8b80('0x3f')][_0x8b80('0x4f')]){_0x692acc[_0x8b80('0x50')]=[{'all':!![]}];}return db[_0x8b80('0x38')][_0x8b80('0x51')](_0x692acc);})[_0x8b80('0x1f')](function(_0x44474b){_0x441681[_0x8b80('0x52')]=_0x44474b;return _0x441681;})[_0x8b80('0x1f')](respondWithFilteredResult(_0x8b411f,_0x692acc))['catch'](handleError(_0x8b411f,null));};exports[_0x8b80('0x53')]=function(_0x5eea97,_0x173c2b){var _0x1c72cc={'raw':![],'where':{'id':_0x5eea97[_0x8b80('0x54')]['id']}},_0x4e5049={};_0x4e5049[_0x8b80('0x3d')]=_[_0x8b80('0x3e')](db[_0x8b80('0x38')][_0x8b80('0x39')]);_0x4e5049['query']=_[_0x8b80('0x3e')](_0x5eea97[_0x8b80('0x3f')]);_0x4e5049['filters']=_['intersection'](_0x4e5049['model'],_0x4e5049[_0x8b80('0x3f')]);_0x1c72cc[_0x8b80('0x42')]=_[_0x8b80('0x41')](_0x4e5049[_0x8b80('0x3d')],qs[_0x8b80('0x43')](_0x5eea97['query'][_0x8b80('0x43')]));_0x1c72cc[_0x8b80('0x42')]=_0x1c72cc[_0x8b80('0x42')][_0x8b80('0x44')]?_0x1c72cc[_0x8b80('0x42')]:_0x4e5049[_0x8b80('0x3d')];if(_0x5eea97['query'][_0x8b80('0x4f')]){_0x1c72cc['include']=[{'all':!![]}];}_0x1c72cc=_[_0x8b80('0x4c')]({},_0x1c72cc,_0x5eea97[_0x8b80('0x4e')]);return db['ServicenowAccount'][_0x8b80('0x55')](_0x1c72cc)[_0x8b80('0x1f')](handleEntityNotFound(_0x173c2b,null))[_0x8b80('0x1f')](respondWithResult(_0x173c2b,null))[_0x8b80('0x29')](handleError(_0x173c2b,null));};exports[_0x8b80('0x56')]=function(_0x47596f,_0x42345e){return db[_0x8b80('0x38')][_0x8b80('0x56')](_0x47596f['body'],{})[_0x8b80('0x1f')](respondWithResult(_0x42345e,0xc9))[_0x8b80('0x29')](handleError(_0x42345e,null));};exports[_0x8b80('0x32')]=function(_0xc2b11a,_0x2a491b){if(_0xc2b11a[_0x8b80('0x57')]['id']){delete _0xc2b11a[_0x8b80('0x57')]['id'];}return db[_0x8b80('0x38')][_0x8b80('0x55')]({'where':{'id':_0xc2b11a[_0x8b80('0x54')]['id']}})[_0x8b80('0x1f')](handleEntityNotFound(_0x2a491b,null))[_0x8b80('0x1f')](saveUpdates(_0xc2b11a[_0x8b80('0x57')],null))['then'](respondWithResult(_0x2a491b,null))[_0x8b80('0x29')](handleError(_0x2a491b,null));};exports[_0x8b80('0x33')]=function(_0x36da39,_0x1afbb9){return db[_0x8b80('0x38')][_0x8b80('0x55')]({'where':{'id':_0x36da39[_0x8b80('0x54')]['id']}})[_0x8b80('0x1f')](handleEntityNotFound(_0x1afbb9,null))['then'](removeEntity(_0x1afbb9,null))[_0x8b80('0x29')](handleError(_0x1afbb9,null));};exports[_0x8b80('0x58')]=function(_0x168a9d,_0x583577,_0x378fba){var _0x23944b={};var _0x2850d2={};var _0x244e9e;var _0x4db214;return db[_0x8b80('0x38')][_0x8b80('0x59')]({'where':{'id':_0x168a9d['params']['id']}})[_0x8b80('0x1f')](handleEntityNotFound(_0x583577,null))['then'](function(_0x3ace98){if(_0x3ace98){_0x244e9e=_0x3ace98;_0x2850d2[_0x8b80('0x3d')]=_[_0x8b80('0x3e')](db[_0x8b80('0x5a')][_0x8b80('0x39')]);_0x2850d2[_0x8b80('0x3f')]=_[_0x8b80('0x3e')](_0x168a9d[_0x8b80('0x3f')]);_0x2850d2['filters']=_[_0x8b80('0x41')](_0x2850d2[_0x8b80('0x3d')],_0x2850d2[_0x8b80('0x3f')]);_0x23944b[_0x8b80('0x42')]=_[_0x8b80('0x41')](_0x2850d2[_0x8b80('0x3d')],qs[_0x8b80('0x43')](_0x168a9d[_0x8b80('0x3f')][_0x8b80('0x43')]));_0x23944b['attributes']=_0x23944b['attributes'][_0x8b80('0x44')]?_0x23944b[_0x8b80('0x42')]:_0x2850d2[_0x8b80('0x3d')];_0x23944b['order']=qs[_0x8b80('0x48')](_0x168a9d[_0x8b80('0x3f')]['sort']);_0x23944b[_0x8b80('0x49')]=qs[_0x8b80('0x40')](_['pick'](_0x168a9d[_0x8b80('0x3f')],_0x2850d2[_0x8b80('0x40')]));if(_0x168a9d[_0x8b80('0x3f')]['filter']){_0x23944b[_0x8b80('0x49')]=_[_0x8b80('0x4c')](_0x23944b[_0x8b80('0x49')],{'$or':_[_0x8b80('0x37')](_0x23944b[_0x8b80('0x42')],function(_0x56c9b6){var _0x20e550={};_0x20e550[_0x56c9b6]={'$like':'%'+_0x168a9d[_0x8b80('0x3f')]['filter']+'%'};return _0x20e550;})});}_0x23944b=_[_0x8b80('0x4c')]({},_0x23944b,_0x168a9d['options']);return _0x244e9e[_0x8b80('0x58')](_0x23944b);}})[_0x8b80('0x1f')](function(_0x20ba6c){if(_0x20ba6c){_0x4db214=_0x20ba6c['length'];if(!_0x168a9d[_0x8b80('0x3f')]['hasOwnProperty']('nolimit')){_0x23944b['limit']=qs[_0x8b80('0x47')](_0x168a9d[_0x8b80('0x3f')][_0x8b80('0x47')]);_0x23944b[_0x8b80('0x2c')]=qs[_0x8b80('0x2c')](_0x168a9d[_0x8b80('0x3f')][_0x8b80('0x2c')]);}return _0x244e9e[_0x8b80('0x58')](_0x23944b);}})[_0x8b80('0x1f')](function(_0x2bbb14){if(_0x2bbb14){return _0x2bbb14?{'count':_0x4db214,'rows':_0x2bbb14}:null;}})[_0x8b80('0x1f')](respondWithResult(_0x583577,null))[_0x8b80('0x29')](handleError(_0x583577,null));};exports['addConfiguration']=function(_0x366cb8,_0x1d0ba2,_0x46c215){if(_0x366cb8[_0x8b80('0x57')]['id']){delete _0x366cb8[_0x8b80('0x57')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x366cb8['params']['id']}})[_0x8b80('0x1f')](handleEntityNotFound(_0x1d0ba2,null))[_0x8b80('0x1f')](function(_0x4a569b){if(_0x4a569b){_0x366cb8[_0x8b80('0x57')]['AccountId']=_0x4a569b['id'];_0x366cb8['body'][_0x8b80('0x5b')]=integrations[_0x8b80('0x5c')](_0x366cb8[_0x8b80('0x57')][_0x8b80('0x5d')],_0x366cb8[_0x8b80('0x57')][_0x8b80('0x3b')]);_0x366cb8[_0x8b80('0x57')]['Descriptions']=integrations[_0x8b80('0x5e')](_0x366cb8[_0x8b80('0x57')][_0x8b80('0x5d')],_0x366cb8[_0x8b80('0x57')][_0x8b80('0x3b')]);return db[_0x8b80('0x5a')]['create'](_0x366cb8[_0x8b80('0x57')],{'include':[{'model':db[_0x8b80('0x5f')],'as':'Subjects'},{'model':db[_0x8b80('0x5f')],'as':_0x8b80('0x60')}]});}return null;})[_0x8b80('0x1f')](respondWithResult(_0x1d0ba2,null))[_0x8b80('0x29')](handleError(_0x1d0ba2,null));};exports[_0x8b80('0x61')]=function(_0x3af64f,_0x4d1622,_0x36767f){var _0x1216dc=['made_sla','hold_reason','knowledge','subcategory',_0x8b80('0x62'),_0x8b80('0x63'),'incident_state',_0x8b80('0x64'),_0x8b80('0x65')];var _0x1b9d1d=['parent',_0x8b80('0x66'),_0x8b80('0x67'),_0x8b80('0x68'),_0x8b80('0x69'),_0x8b80('0x6a'),'child_incidents','hold_reason',_0x8b80('0x6b'),_0x8b80('0x6c'),'resolved_by',_0x8b80('0x6d'),_0x8b80('0x6e'),'user_input','sys_created_on','sys_domain','state',_0x8b80('0x6f'),_0x8b80('0x70'),'order',_0x8b80('0x71'),_0x8b80('0x72'),'cmdb_ci',_0x8b80('0x73'),_0x8b80('0x74'),_0x8b80('0x75'),_0x8b80('0x76'),_0x8b80('0x77'),_0x8b80('0x78'),'sys_domain_path',_0x8b80('0x79'),'time_worked','expected_start','opened_at',_0x8b80('0x7a'),_0x8b80('0x7b'),_0x8b80('0x7c'),_0x8b80('0x7d'),_0x8b80('0x7e'),'caller_id','approval_set','subcategory',_0x8b80('0x7f'),_0x8b80('0x80'),'close_code','correlation_display',_0x8b80('0x81'),_0x8b80('0x82'),_0x8b80('0x83'),_0x8b80('0x84'),'additional_assignee_list',_0x8b80('0x85'),_0x8b80('0x86'),_0x8b80('0x63'),_0x8b80('0x87'),_0x8b80('0x88'),_0x8b80('0x89'),_0x8b80('0x8a'),'parent_incident',_0x8b80('0x8b'),'contact_type',_0x8b80('0x8c'),_0x8b80('0x8d'),_0x8b80('0x8e'),_0x8b80('0x8f'),'company',_0x8b80('0x90'),_0x8b80('0x91'),'assigned_to',_0x8b80('0x64'),'comments',_0x8b80('0x92'),'approval',_0x8b80('0x93'),_0x8b80('0x94'),'sys_mod_count','reopen_count','sys_tags',_0x8b80('0x95'),_0x8b80('0x96'),_0x8b80('0x97'),'location',_0x8b80('0x65')];var _0x28651c='';var _0x5c5a4c='';var _0xa68c43=[];var _0xed8a39='';var _0x2ee70b='';var _0x5f2a66=[];var _0x536ae1='';var _0x2b5a8f='';var _0x2e4920={};var _0x45c99b='';return db[_0x8b80('0x38')]['findOne']({'where':{'id':_0x3af64f[_0x8b80('0x54')]['id']},'attributes':['id',_0x8b80('0x98'),_0x8b80('0x99'),_0x8b80('0x9a'),'remoteUri',_0x8b80('0x9b')]})[_0x8b80('0x1f')](handleEntityNotFound(_0x4d1622,null))['then'](function(_0x2a6944){if(_0x2a6944){_0x45c99b=_0x2a6944['remoteUri'];var _0x4575eb=_0x45c99b[_0x8b80('0x9c')](-0x1);if(_0x4575eb==='/'){_0x45c99b=_0x45c99b[_0x8b80('0x9d')](0x0,_0x45c99b[_0x8b80('0x9e')](_0x4575eb));}_0x2b5a8f=util[_0x8b80('0x9f')](_0x8b80('0xa0'),_0x45c99b);_0x536ae1=util[_0x8b80('0x9f')](_0x8b80('0xa1'),_0x45c99b);_0x2e4920={'user':_0x2a6944['username'],'pass':_0x2a6944[_0x8b80('0x99')]};var _0x3704c8={'method':_0x8b80('0xa2'),'uri':_0x2b5a8f+'incident?sysparm_display_value=all','auth':_0x2e4920,'json':!![]};return rp(_0x3704c8);}})[_0x8b80('0x1f')](function(_0x53f3c5){if(_0x53f3c5[_0x8b80('0x28')][_0x8b80('0x44')]>0x0){_0x28651c=_0x53f3c5[_0x8b80('0x28')];}console[_0x8b80('0xa3')](_0x8b80('0xa4'),_0x28651c);_0x5f2a66=[];_0x5c5a4c=Object['assign']([],_0x28651c);_['remove'](_0x5c5a4c,function(_0xda825a){return!_0x1216dc[_0x8b80('0xa5')](_0xda825a[_0x8b80('0x34')]);});_0x5c5a4c[_0x8b80('0xa6')](function(_0x5e8a81){var _0x45c83f=createFieldObject(_0x536ae1,_0x2e4920,_0x5e8a81[_0x8b80('0xa7')],_0x5e8a81[_0x8b80('0x34')],_0x5e8a81[_0x8b80('0xa8')],![]);_0x5f2a66[_0x8b80('0xa9')](_0x45c83f);});return Promise[_0x8b80('0xaa')](_0x5f2a66);})[_0x8b80('0x1f')](function(_0x3607ba){_0xa68c43=_0x3607ba;_0xed8a39=Object['assign']([],_0x28651c);console[_0x8b80('0xa3')](_0x8b80('0xab'),_0x28651c);_[_0x8b80('0xac')](_0xed8a39,function(_0x55892c){return _0x1b9d1d[_0x8b80('0xa5')](_0x55892c['name']);});console['log'](_0x8b80('0xad'),_0xed8a39);_0x5f2a66=[];_0xed8a39[_0x8b80('0xa6')](function(_0x2182b1){var _0x393518=createFieldObject(_0x536ae1,_0x2e4920,_0x2182b1[_0x8b80('0xa7')],_0x2182b1['name'],_0x2182b1[_0x8b80('0xa8')],!![]);_0x5f2a66[_0x8b80('0xa9')](_0x393518);});return Promise[_0x8b80('0xaa')](_0x5f2a66);})[_0x8b80('0x1f')](function(_0x3cb980){_0x2ee70b=_0x3cb980;var _0x4bc174=_0xa68c43[_0x8b80('0xae')](_0x2ee70b);return{'count':_0x4bc174['length'],'rows':_0x4bc174};})['then'](respondWithResult(_0x4d1622,null))[_0x8b80('0x29')](function(_0x2a2627){console[_0x8b80('0xa3')]('ServiceNow\x20error:\x20'+_0x2a2627);var _0x3aad07=_0x3af64f[_0x8b80('0x3f')][_0x8b80('0x1b')]?0x1f4:_0x2a2627[_0x8b80('0xaf')]||0x1f4;logger[_0x8b80('0x24')](_0x2a2627[_0x8b80('0xb0')]);delete _0x2a2627[_0x8b80('0x34')];if(_0x3aad07===0x191){_0x3aad07=0x190;}_0x4d1622['status'](_0x3aad07)[_0x8b80('0x35')](_0x3af64f[_0x8b80('0x3f')][_0x8b80('0x1b')]?{'message':_0x8b80('0xb1'),'statusCode':_0x2a2627[_0x8b80('0xaf')]}:_0x2a2627);});};function createFieldObject(_0x2257fe,_0x1d3d1a,_0x545152,_0x47822b,_0x5ebb70,_0x3e937e){return new Promise(function(_0xbc3941,_0x19060b){var _0x19fde8={'id':_0x47822b,'name':_0x5ebb70,'custom':_0x3e937e};if(_0x545152===_0x8b80('0xb2')){_0x19fde8[_0x8b80('0x4e')]=[{'name':_0x8b80('0xb3'),'value':_0x8b80('0xb4')},{'name':_0x8b80('0xb5'),'value':'false'}];_0xbc3941(_0x19fde8);}else{var _0x27c409={'method':_0x8b80('0xa2'),'uri':_0x2257fe+_0x8b80('0xb6')+_0x47822b,'auth':_0x1d3d1a,'json':!![]};return rp(_0x27c409)['then'](function(_0x3176c3){var _0x315f52=[];if(_0x3176c3['result']['length']>0x0){_0x3176c3[_0x8b80('0x28')][_0x8b80('0xa6')](function(_0x55e90c){if(_0x55e90c['inactive']===_0x8b80('0xb7')){var _0x3c621c={'name':_0x55e90c[_0x8b80('0xa8')],'value':_0x55e90c[_0x8b80('0xb8')]};_0x315f52[_0x8b80('0xa9')](_0x3c621c);}});}_0x19fde8[_0x8b80('0x4e')]=_0x315f52;if(_0x19fde8[_0x8b80('0x4e')][_0x8b80('0x44')]>0x0){_0xbc3941(_0x19fde8);}else{if(_0x3e937e==![]){_0xbc3941();}else{_0xbc3941(_0x19fde8);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 817adb8..72e82bf 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 _0x0fda=['bluebird','request-promise','path','rimraf','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment'];(function(_0xffbcf2,_0x4e98de){var _0x107616=function(_0x315cba){while(--_0x315cba){_0xffbcf2['push'](_0xffbcf2['shift']());}};_0x107616(++_0x4e98de);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x32bcb6,_0x4453ab){_0x32bcb6=_0x32bcb6-0x0;var _0x5233ed=_0x0fda[_0x32bcb6];return _0x5233ed;};'use strict';var _=require(_0xa0fd('0x0'));var util=require('util');var logger=require(_0xa0fd('0x1'))(_0xa0fd('0x2'));var moment=require(_0xa0fd('0x3'));var BPromise=require(_0xa0fd('0x4'));var rp=require(_0xa0fd('0x5'));var fs=require('fs');var path=require(_0xa0fd('0x6'));var rimraf=require(_0xa0fd('0x7'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xa0fd('0x8'));module['exports']=function(_0x49b3c1,_0x868183){return _0x49b3c1[_0xa0fd('0x9')](_0xa0fd('0xa'),attributes,{'tableName':_0xa0fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e85=['define','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0e85,0x7c));var _0x50e8=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x0e85[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var logger=require('../../config/logger')(_0x50e8('0x2'));var moment=require(_0x50e8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x50e8('0x4'));var config=require('../../config/environment');var attributes=require(_0x50e8('0x5'));var integrations=require(_0x50e8('0x6'));module[_0x50e8('0x7')]=function(_0xfde42,_0x5e8b01){return _0xfde42[_0x50e8('0x8')](_0x50e8('0x9'),attributes,{'tableName':_0x50e8('0xa'),'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 ae15f74..4f9ced9 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 _0x18fb=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowServicenowAccount','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x18fb,0xb4));var _0xb18f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x18fb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb18f('0x0'));var moment=require(_0xb18f('0x1'));var BPromise=require(_0xb18f('0x2'));var rs=require(_0xb18f('0x3'));var fs=require('fs');var Redis=require(_0xb18f('0x4'));var db=require(_0xb18f('0x5'))['db'];var utils=require(_0xb18f('0x6'));var logger=require(_0xb18f('0x7'))(_0xb18f('0x8'));var config=require(_0xb18f('0x9'));var jayson=require(_0xb18f('0xa'));var client=jayson[_0xb18f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b33df,_0x1cfc32,_0x50ce38){return new BPromise(function(_0x1fcebd,_0x45c673){return client['request'](_0x1b33df,_0x50ce38)[_0xb18f('0xc')](function(_0x2e3e58){logger[_0xb18f('0xd')](_0xb18f('0xe'),_0x1cfc32,_0xb18f('0xf'));logger[_0xb18f('0x10')](_0xb18f('0x11'),_0x1cfc32,_0xb18f('0xf'),JSON[_0xb18f('0x12')](_0x2e3e58));if(_0x2e3e58['error']){if(_0x2e3e58[_0xb18f('0x13')]['code']===0x1f4){logger[_0xb18f('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x1cfc32,_0x2e3e58[_0xb18f('0x13')]['message']);return _0x45c673(_0x2e3e58[_0xb18f('0x13')][_0xb18f('0x14')]);}logger[_0xb18f('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x1cfc32,_0x2e3e58[_0xb18f('0x13')][_0xb18f('0x14')]);return _0x1fcebd(_0x2e3e58[_0xb18f('0x13')][_0xb18f('0x14')]);}else{logger[_0xb18f('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x1cfc32,_0xb18f('0xf'));_0x1fcebd(_0x2e3e58[_0xb18f('0x15')][_0xb18f('0x14')]);}})[_0xb18f('0x16')](function(_0x370ca4){logger[_0xb18f('0x13')](_0xb18f('0xe'),_0x1cfc32,_0x370ca4);_0x45c673(_0x370ca4);});});}exports[_0xb18f('0x17')]=function(_0x3ec881){var _0x17533e=this;return new Promise(function(_0x1f7bf4,_0x5497be){return db[_0xb18f('0x18')][_0xb18f('0x19')]({'raw':_0x3ec881['options']?_0x3ec881[_0xb18f('0x1a')][_0xb18f('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ec881['options']?_0x3ec881[_0xb18f('0x1a')][_0xb18f('0x1c')]||null:null,'attributes':_0x3ec881[_0xb18f('0x1a')]?_0x3ec881[_0xb18f('0x1a')][_0xb18f('0x1d')]||null:null,'limit':_0x3ec881['options']?_0x3ec881[_0xb18f('0x1a')][_0xb18f('0x1e')]||null:null,'include':_0x3ec881[_0xb18f('0x1a')]?_0x3ec881[_0xb18f('0x1a')]['include']?_['map'](_0x3ec881[_0xb18f('0x1a')][_0xb18f('0x1f')],function(_0x502965){return{'model':db[_0x502965[_0xb18f('0x20')]],'as':_0x502965['as'],'attributes':_0x502965[_0xb18f('0x1d')],'include':_0x502965['include']?_[_0xb18f('0x21')](_0x502965[_0xb18f('0x1f')],function(_0x317f71){return{'model':db[_0x317f71[_0xb18f('0x20')]],'as':_0x317f71['as'],'attributes':_0x317f71[_0xb18f('0x1d')],'include':_0x317f71['include']?_[_0xb18f('0x21')](_0x317f71[_0xb18f('0x1f')],function(_0x2f5e5a){return{'model':db[_0x2f5e5a[_0xb18f('0x20')]],'as':_0x2f5e5a['as'],'attributes':_0x2f5e5a['attributes']};}):[]};}):[]};}):[]:[]})[_0xb18f('0xc')](function(_0x157de8){logger[_0xb18f('0xd')](_0xb18f('0x17'),_0x3ec881);logger[_0xb18f('0x10')]('GetServicenowAccount',_0x3ec881,JSON[_0xb18f('0x12')](_0x157de8));_0x1f7bf4(_0x157de8);})[_0xb18f('0x16')](function(_0x44529e){logger[_0xb18f('0x13')](_0xb18f('0x17'),_0x44529e['message'],_0x3ec881);_0x5497be(_0x17533e['error'](0x1f4,_0x44529e['message']));});});};exports[_0xb18f('0x22')]=function(_0x3e3e52){var _0x2b4c63=this;return new Promise(function(_0x48008d,_0x44bb99){return db[_0xb18f('0x18')][_0xb18f('0x23')]({'raw':_0x3e3e52[_0xb18f('0x1a')]?_0x3e3e52[_0xb18f('0x1a')][_0xb18f('0x1b')]===undefined?!![]:![]:!![],'where':_0x3e3e52['options']?_0x3e3e52[_0xb18f('0x1a')][_0xb18f('0x1c')]||null:null,'attributes':_0x3e3e52[_0xb18f('0x1a')]?_0x3e3e52[_0xb18f('0x1a')][_0xb18f('0x1d')]||null:null,'include':_0x3e3e52[_0xb18f('0x1a')]?_0x3e3e52[_0xb18f('0x1a')]['include']?_['map'](_0x3e3e52[_0xb18f('0x1a')][_0xb18f('0x1f')],function(_0x25a601){return{'model':db[_0x25a601['model']],'as':_0x25a601['as'],'attributes':_0x25a601[_0xb18f('0x1d')],'include':_0x25a601[_0xb18f('0x1f')]?_[_0xb18f('0x21')](_0x25a601['include'],function(_0x59ddd5){return{'model':db[_0x59ddd5['model']],'as':_0x59ddd5['as'],'attributes':_0x59ddd5['attributes'],'include':_0x59ddd5[_0xb18f('0x1f')]?_[_0xb18f('0x21')](_0x59ddd5[_0xb18f('0x1f')],function(_0x500b90){return{'model':db[_0x500b90['model']],'as':_0x500b90['as'],'attributes':_0x500b90[_0xb18f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28bc73){logger['info'](_0xb18f('0x22'),_0x3e3e52);logger[_0xb18f('0x10')]('ShowServicenowAccount',_0x3e3e52,JSON[_0xb18f('0x12')](_0x28bc73));_0x48008d(_0x28bc73);})['catch'](function(_0x5eb92a){logger[_0xb18f('0x13')](_0xb18f('0x22'),_0x5eb92a['message'],_0x3e3e52);_0x44bb99(_0x2b4c63[_0xb18f('0x13')](0x1f4,_0x5eb92a[_0xb18f('0x14')]));});});}; \ No newline at end of file +var _0xa0e9=['GetServicenowAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowServicenowAccount','ServicenowAccount','find','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x2baed2,_0x4d5fcd){var _0x4f18cf=function(_0xa224ef){while(--_0xa224ef){_0x2baed2['push'](_0x2baed2['shift']());}};_0x4f18cf(++_0x4d5fcd);}(_0xa0e9,0xb8));var _0x9a0e=function(_0x519b55,_0x1597a7){_0x519b55=_0x519b55-0x0;var _0x5baf3d=_0xa0e9[_0x519b55];return _0x5baf3d;};'use strict';var _=require('lodash');var util=require(_0x9a0e('0x0'));var moment=require(_0x9a0e('0x1'));var BPromise=require('bluebird');var rs=require(_0x9a0e('0x2'));var fs=require('fs');var Redis=require(_0x9a0e('0x3'));var db=require(_0x9a0e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a0e('0x5'))(_0x9a0e('0x6'));var config=require(_0x9a0e('0x7'));var jayson=require(_0x9a0e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7fd7,_0x418dcb,_0xb17fac){return new BPromise(function(_0x153007,_0x5c60c1){return client[_0x9a0e('0x9')](_0x1d7fd7,_0xb17fac)[_0x9a0e('0xa')](function(_0x254e89){logger[_0x9a0e('0xb')](_0x9a0e('0xc'),_0x418dcb,_0x9a0e('0xd'));logger[_0x9a0e('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x418dcb,_0x9a0e('0xd'),JSON[_0x9a0e('0xf')](_0x254e89));if(_0x254e89['error']){if(_0x254e89[_0x9a0e('0x10')][_0x9a0e('0x11')]===0x1f4){logger[_0x9a0e('0x10')](_0x9a0e('0xc'),_0x418dcb,_0x254e89[_0x9a0e('0x10')][_0x9a0e('0x12')]);return _0x5c60c1(_0x254e89[_0x9a0e('0x10')][_0x9a0e('0x12')]);}logger[_0x9a0e('0x10')](_0x9a0e('0xc'),_0x418dcb,_0x254e89['error']['message']);return _0x153007(_0x254e89['error']['message']);}else{logger[_0x9a0e('0xb')](_0x9a0e('0xc'),_0x418dcb,_0x9a0e('0xd'));_0x153007(_0x254e89[_0x9a0e('0x13')]['message']);}})['catch'](function(_0x2158d1){logger[_0x9a0e('0x10')](_0x9a0e('0xc'),_0x418dcb,_0x2158d1);_0x5c60c1(_0x2158d1);});});}exports[_0x9a0e('0x14')]=function(_0x24802a){var _0x275ff3=this;return new Promise(function(_0x32964b,_0x55c003){return db['ServicenowAccount'][_0x9a0e('0x15')]({'raw':_0x24802a['options']?_0x24802a[_0x9a0e('0x16')][_0x9a0e('0x17')]===undefined?!![]:![]:!![],'where':_0x24802a[_0x9a0e('0x16')]?_0x24802a[_0x9a0e('0x16')][_0x9a0e('0x18')]||null:null,'attributes':_0x24802a[_0x9a0e('0x16')]?_0x24802a[_0x9a0e('0x16')]['attributes']||null:null,'limit':_0x24802a[_0x9a0e('0x16')]?_0x24802a[_0x9a0e('0x16')][_0x9a0e('0x19')]||null:null,'include':_0x24802a[_0x9a0e('0x16')]?_0x24802a[_0x9a0e('0x16')][_0x9a0e('0x1a')]?_[_0x9a0e('0x1b')](_0x24802a[_0x9a0e('0x16')][_0x9a0e('0x1a')],function(_0x9ba1e3){return{'model':db[_0x9ba1e3[_0x9a0e('0x1c')]],'as':_0x9ba1e3['as'],'attributes':_0x9ba1e3['attributes'],'include':_0x9ba1e3[_0x9a0e('0x1a')]?_[_0x9a0e('0x1b')](_0x9ba1e3[_0x9a0e('0x1a')],function(_0x2b12b5){return{'model':db[_0x2b12b5[_0x9a0e('0x1c')]],'as':_0x2b12b5['as'],'attributes':_0x2b12b5[_0x9a0e('0x1d')],'include':_0x2b12b5['include']?_['map'](_0x2b12b5[_0x9a0e('0x1a')],function(_0xaeb194){return{'model':db[_0xaeb194['model']],'as':_0xaeb194['as'],'attributes':_0xaeb194['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a0e('0xa')](function(_0x2a3330){logger[_0x9a0e('0xb')](_0x9a0e('0x14'),_0x24802a);logger[_0x9a0e('0xe')](_0x9a0e('0x14'),_0x24802a,JSON[_0x9a0e('0xf')](_0x2a3330));_0x32964b(_0x2a3330);})['catch'](function(_0x504141){logger[_0x9a0e('0x10')](_0x9a0e('0x14'),_0x504141['message'],_0x24802a);_0x55c003(_0x275ff3[_0x9a0e('0x10')](0x1f4,_0x504141[_0x9a0e('0x12')]));});});};exports[_0x9a0e('0x1e')]=function(_0x4b4595){var _0x4e826e=this;return new Promise(function(_0x39ae50,_0x444f8e){return db[_0x9a0e('0x1f')][_0x9a0e('0x20')]({'raw':_0x4b4595[_0x9a0e('0x16')]?_0x4b4595[_0x9a0e('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4b4595[_0x9a0e('0x16')]?_0x4b4595[_0x9a0e('0x16')][_0x9a0e('0x18')]||null:null,'attributes':_0x4b4595[_0x9a0e('0x16')]?_0x4b4595[_0x9a0e('0x16')][_0x9a0e('0x1d')]||null:null,'include':_0x4b4595[_0x9a0e('0x16')]?_0x4b4595[_0x9a0e('0x16')][_0x9a0e('0x1a')]?_[_0x9a0e('0x1b')](_0x4b4595['options']['include'],function(_0x2a5bea){return{'model':db[_0x2a5bea[_0x9a0e('0x1c')]],'as':_0x2a5bea['as'],'attributes':_0x2a5bea['attributes'],'include':_0x2a5bea[_0x9a0e('0x1a')]?_['map'](_0x2a5bea[_0x9a0e('0x1a')],function(_0x4929a8){return{'model':db[_0x4929a8['model']],'as':_0x4929a8['as'],'attributes':_0x4929a8[_0x9a0e('0x1d')],'include':_0x4929a8['include']?_[_0x9a0e('0x1b')](_0x4929a8[_0x9a0e('0x1a')],function(_0x364868){return{'model':db[_0x364868['model']],'as':_0x364868['as'],'attributes':_0x364868['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1fb511){logger[_0x9a0e('0xb')]('ShowServicenowAccount',_0x4b4595);logger['debug'](_0x9a0e('0x1e'),_0x4b4595,JSON[_0x9a0e('0xf')](_0x1fb511));_0x39ae50(_0x1fb511);})[_0x9a0e('0x21')](function(_0x4adda7){logger[_0x9a0e('0x10')]('ShowServicenowAccount',_0x4adda7['message'],_0x4b4595);_0x444f8e(_0x4e826e[_0x9a0e('0x10')](0x1f4,_0x4adda7[_0x9a0e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index bae6be2..ee02364 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 _0x94ff=['get','isAuthenticated','index','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','destroy','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller'];(function(_0x13216a,_0x345b37){var _0x2145c9=function(_0x34f56b){while(--_0x34f56b){_0x13216a['push'](_0x13216a['shift']());}};_0x2145c9(++_0x345b37);}(_0x94ff,0x189));var _0xf94f=function(_0xf6f6fd,_0x21d0f5){_0xf6f6fd=_0xf6f6fd-0x0;var _0x430d84=_0x94ff[_0xf6f6fd];return _0x430d84;};'use strict';var multer=require(_0xf94f('0x0'));var util=require(_0xf94f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf94f('0x2')]();var auth=require(_0xf94f('0x3'));var interaction=require(_0xf94f('0x4'));var config=require(_0xf94f('0x5'));var controller=require(_0xf94f('0x6'));router[_0xf94f('0x7')]('/',auth[_0xf94f('0x8')](),controller[_0xf94f('0x9')]);router[_0xf94f('0x7')]('/:id',auth[_0xf94f('0x8')](),controller['show']);router[_0xf94f('0x7')]('/:id/fields',auth[_0xf94f('0x8')](),controller[_0xf94f('0xa')]);router[_0xf94f('0x7')](_0xf94f('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xf94f('0x7')](_0xf94f('0xc'),auth[_0xf94f('0x8')](),controller[_0xf94f('0xd')]);router[_0xf94f('0xe')]('/',auth[_0xf94f('0x8')](),controller[_0xf94f('0xf')]);router[_0xf94f('0x10')](_0xf94f('0x11'),auth[_0xf94f('0x8')](),controller[_0xf94f('0x12')]);router['delete']('/:id',auth[_0xf94f('0x8')](),controller[_0xf94f('0x13')]);module['exports']=router; \ No newline at end of file +var _0xdb89=['path','connect-timeout','express','Router','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','util'];(function(_0x2b9451,_0x4f409f){var _0x3b6a08=function(_0x2a8654){while(--_0x2a8654){_0x2b9451['push'](_0x2b9451['shift']());}};_0x3b6a08(++_0x4f409f);}(_0xdb89,0x1b8));var _0x9db8=function(_0x24f710,_0xee645a){_0x24f710=_0x24f710-0x0;var _0x17ac47=_0xdb89[_0x24f710];return _0x17ac47;};'use strict';var multer=require('multer');var util=require(_0x9db8('0x0'));var path=require(_0x9db8('0x1'));var timeout=require(_0x9db8('0x2'));var express=require(_0x9db8('0x3'));var router=express[_0x9db8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9db8('0x5'));var config=require('../../config/environment');var controller=require(_0x9db8('0x6'));router[_0x9db8('0x7')]('/',auth[_0x9db8('0x8')](),controller[_0x9db8('0x9')]);router[_0x9db8('0x7')](_0x9db8('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x9db8('0xb'),auth[_0x9db8('0x8')](),controller['getFields']);router[_0x9db8('0x7')](_0x9db8('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x9db8('0x7')](_0x9db8('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x9db8('0xe')]('/',auth['isAuthenticated'](),controller[_0x9db8('0xf')]);router[_0x9db8('0x10')](_0x9db8('0xa'),auth[_0x9db8('0x8')](),controller[_0x9db8('0x11')]);router[_0x9db8('0x12')]('/:id',auth[_0x9db8('0x8')](),controller[_0x9db8('0x13')]);module[_0x9db8('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 010b8de..ffeed85 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 _0x50f9=['exports','STRING'];(function(_0x4fecf3,_0x17fdb0){var _0x50161f=function(_0x49b2ad){while(--_0x49b2ad){_0x4fecf3['push'](_0x4fecf3['shift']());}};_0x50161f(++_0x17fdb0);}(_0x50f9,0x148));var _0x950f=function(_0x43042c,_0x48d9f2){_0x43042c=_0x43042c-0x0;var _0x5f55f9=_0x50f9[_0x43042c];return _0x5f55f9;};'use strict';var Sequelize=require('sequelize');module[_0x950f('0x0')]={'name':{'type':Sequelize[_0x950f('0x1')]},'description':{'type':Sequelize[_0x950f('0x1')]}}; \ No newline at end of file +var _0x63bf=['exports','STRING','sequelize'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x63bf,0x1f4));var _0xf63b=function(_0x1c2c4b,_0x232736){_0x1c2c4b=_0x1c2c4b-0x0;var _0x2239e6=_0x63bf[_0x1c2c4b];return _0x2239e6;};'use strict';var Sequelize=require(_0xf63b('0x0'));module[_0xf63b('0x1')]={'name':{'type':Sequelize[_0xf63b('0x2')]},'description':{'type':Sequelize[_0xf63b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index a3a9d44..4a5b3bd 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 _0x9348=['to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','debug','request\x20sent','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','count','offset','set','json','apply','reject','save','destroy','end','name','index','map','ServicenowConfiguration','rawAttributes','type','key','query','keys','attributes','intersection','fields','model','hasOwnProperty','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','options','find','create','body','update','getFields','findOne','nolimit','getSubjects','getDescriptions','ServicenowField','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox'];(function(_0x28b930,_0x19b05f){var _0x112256=function(_0x3b3f61){while(--_0x3b3f61){_0x28b930['push'](_0x28b930['shift']());}};_0x112256(++_0x19b05f);}(_0x9348,0x10d));var _0x8934=function(_0x4766cf,_0x110454){_0x4766cf=_0x4766cf-0x0;var _0x1b0f93=_0x9348[_0x4766cf];return _0x1b0f93;};'use strict';var pdf=require(_0x8934('0x0'));var emlformat=require(_0x8934('0x1'));var rimraf=require(_0x8934('0x2'));var zipdir=require(_0x8934('0x3'));var jsonpatch=require(_0x8934('0x4'));var rp=require('request-promise');var moment=require(_0x8934('0x5'));var BPromise=require(_0x8934('0x6'));var Mustache=require('mustache');var util=require(_0x8934('0x7'));var path=require(_0x8934('0x8'));var sox=require(_0x8934('0x9'));var csv=require(_0x8934('0xa'));var ejs=require(_0x8934('0xb'));var fs=require('fs');var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var db=require(_0x8934('0x17'))['db'];var jayson=require(_0x8934('0x18'));var client=jayson['client'][_0x8934('0x19')]({'port':0x232a});function checkPasswordPattern(_0x108eab,_0x46bca5,_0x1906d0){if(_0x1906d0){var _0xbc487e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xbc487e[_0x8934('0x1a')](_0x46bca5)){return _0x108eab;}else{throw new db['Sequelize'][(_0x8934('0x1b'))](_0x8934('0x1c'));}}else{return _0x108eab;}}function respondWithRpcPromise(_0xdfc97c,_0x94b948,_0x34d4dc,_0x41e6a9){return new BPromise(function(_0x2a5b04,_0x357cf8){var _0x52de6a=_0x41e6a9||client;return _0x52de6a[_0x8934('0x1d')](_0xdfc97c,_0x34d4dc)[_0x8934('0x1e')](function(_0x261c78){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x94b948,'request\x20sent');logger[_0x8934('0x1f')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x94b948,_0x8934('0x20'),JSON[_0x8934('0x21')](_0x261c78));if(_0x261c78[_0x8934('0x22')]){if(_0x261c78[_0x8934('0x22')][_0x8934('0x23')]===0x1f4){logger['error'](_0x8934('0x24'),_0x94b948,_0x261c78['error'][_0x8934('0x25')]);return _0x357cf8(_0x261c78[_0x8934('0x22')][_0x8934('0x25')]);}logger[_0x8934('0x22')](_0x8934('0x24'),_0x94b948,_0x261c78[_0x8934('0x22')][_0x8934('0x25')]);return _0x2a5b04(_0x261c78['error'][_0x8934('0x25')]);}else{logger[_0x8934('0x26')](_0x8934('0x24'),_0x94b948,_0x8934('0x20'));_0x2a5b04(_0x261c78[_0x8934('0x27')]['message']);}})[_0x8934('0x28')](function(_0x1c15c5){logger[_0x8934('0x22')]('ServicenowConfiguration,\x20%s,\x20%s',_0x94b948,_0x1c15c5);_0x357cf8(_0x1c15c5);});});}function respondWithStatusCode(_0x16cfc2,_0x561df2){_0x561df2=_0x561df2||0xcc;return function(_0x14c5f0){if(_0x14c5f0){return _0x16cfc2[_0x8934('0x29')](_0x561df2);}return _0x16cfc2[_0x8934('0x2a')](_0x561df2)['end']();};}function respondWithResult(_0x1fd5eb,_0x15910b){_0x15910b=_0x15910b||0xc8;return function(_0x310454){if(_0x310454){return _0x1fd5eb[_0x8934('0x2a')](_0x15910b)['json'](_0x310454);}};}function respondWithFilteredResult(_0x3db790,_0x249031){return function(_0x358445){if(_0x358445){var _0x3d93c7=_0x358445[_0x8934('0x2b')],_0x44972b=_0x249031[_0x8934('0x2c')],_0x20d448=_0x249031[_0x8934('0x2c')]+_0x249031['limit'],_0x3f328a;if(_0x20d448>=_0x3d93c7){_0x20d448=_0x3d93c7;_0x3f328a=0xc8;}else{_0x3f328a=0xce;}_0x3db790[_0x8934('0x2a')](_0x3f328a);return _0x3db790[_0x8934('0x2d')]('Content-Range',_0x44972b+'-'+_0x20d448+'/'+_0x3d93c7)[_0x8934('0x2e')](_0x358445);}return null;};}function patchUpdates(_0x3d60f9){return function(_0x1a17b5){try{jsonpatch[_0x8934('0x2f')](_0x1a17b5,_0x3d60f9,!![]);}catch(_0x4b3cb9){return BPromise[_0x8934('0x30')](_0x4b3cb9);}return _0x1a17b5[_0x8934('0x31')]();};}function saveUpdates(_0x11844a,_0x1af54b){return function(_0x382d81){if(_0x382d81){return _0x382d81['update'](_0x11844a)[_0x8934('0x1e')](function(_0x59a6bf){return _0x59a6bf;});}return null;};}function removeEntity(_0x5559f1,_0xff95be){return function(_0x2447e6){if(_0x2447e6){return _0x2447e6[_0x8934('0x32')]()[_0x8934('0x1e')](function(){_0x5559f1['status'](0xcc)[_0x8934('0x33')]();});}};}function handleEntityNotFound(_0x22aebe,_0x380d47){return function(_0x1439ef){if(!_0x1439ef){_0x22aebe[_0x8934('0x29')](0x194);}return _0x1439ef;};}function handleError(_0x4cd282,_0x6764f8){_0x6764f8=_0x6764f8||0x1f4;return function(_0x1ea0cd){logger['error'](_0x1ea0cd['stack']);if(_0x1ea0cd[_0x8934('0x34')]){delete _0x1ea0cd[_0x8934('0x34')];}_0x4cd282['status'](_0x6764f8)['send'](_0x1ea0cd);};}exports[_0x8934('0x35')]=function(_0x177a57,_0x2f710a){var _0x207ad4={},_0x834d54={},_0x1c624f={'count':0x0,'rows':[]};var _0x30f8c6=_[_0x8934('0x36')](db[_0x8934('0x37')][_0x8934('0x38')],function(_0x46611c){return{'name':_0x46611c['fieldName'],'type':_0x46611c[_0x8934('0x39')][_0x8934('0x3a')]};});_0x834d54['model']=_[_0x8934('0x36')](_0x30f8c6,_0x8934('0x34'));_0x834d54[_0x8934('0x3b')]=_[_0x8934('0x3c')](_0x177a57[_0x8934('0x3b')]);_0x834d54['filters']=_['intersection'](_0x834d54['model'],_0x834d54[_0x8934('0x3b')]);_0x207ad4[_0x8934('0x3d')]=_[_0x8934('0x3e')](_0x834d54['model'],qs[_0x8934('0x3f')](_0x177a57['query']['fields']));_0x207ad4[_0x8934('0x3d')]=_0x207ad4[_0x8934('0x3d')]['length']?_0x207ad4['attributes']:_0x834d54[_0x8934('0x40')];if(!_0x177a57[_0x8934('0x3b')][_0x8934('0x41')]('nolimit')){_0x207ad4[_0x8934('0x42')]=qs['limit'](_0x177a57[_0x8934('0x3b')]['limit']);_0x207ad4[_0x8934('0x2c')]=qs[_0x8934('0x2c')](_0x177a57[_0x8934('0x3b')]['offset']);}_0x207ad4[_0x8934('0x43')]=qs[_0x8934('0x44')](_0x177a57[_0x8934('0x3b')][_0x8934('0x44')]);_0x207ad4['where']=qs[_0x8934('0x45')](_[_0x8934('0x46')](_0x177a57[_0x8934('0x3b')],_0x834d54[_0x8934('0x45')]),_0x30f8c6);if(_0x177a57[_0x8934('0x3b')][_0x8934('0x47')]){_0x207ad4[_0x8934('0x48')]=_[_0x8934('0x49')](_0x207ad4['where'],{'$or':_['map'](_0x30f8c6,function(_0x510152){if(_0x510152[_0x8934('0x39')]!==_0x8934('0x4a')){var _0x58206c={};_0x58206c[_0x510152[_0x8934('0x34')]]={'$like':'%'+_0x177a57['query'][_0x8934('0x47')]+'%'};return _0x58206c;}})});}_0x207ad4=_[_0x8934('0x49')]({},_0x207ad4,_0x177a57['options']);var _0x3561da={'where':_0x207ad4[_0x8934('0x48')]};return db[_0x8934('0x37')][_0x8934('0x2b')](_0x3561da)['then'](function(_0x2adb63){_0x1c624f[_0x8934('0x2b')]=_0x2adb63;if(_0x177a57['query'][_0x8934('0x4b')]){_0x207ad4[_0x8934('0x4c')]=[{'all':!![]}];}return db[_0x8934('0x37')][_0x8934('0x4d')](_0x207ad4);})[_0x8934('0x1e')](function(_0x419e30){_0x1c624f[_0x8934('0x4e')]=_0x419e30;return _0x1c624f;})[_0x8934('0x1e')](respondWithFilteredResult(_0x2f710a,_0x207ad4))[_0x8934('0x28')](handleError(_0x2f710a,null));};exports[_0x8934('0x4f')]=function(_0x1e2175,_0xe212bc){var _0x2c322d={'raw':![],'where':{'id':_0x1e2175[_0x8934('0x50')]['id']}},_0x2febf5={};_0x2febf5[_0x8934('0x40')]=_[_0x8934('0x3c')](db[_0x8934('0x37')]['rawAttributes']);_0x2febf5[_0x8934('0x3b')]=_[_0x8934('0x3c')](_0x1e2175['query']);_0x2febf5['filters']=_['intersection'](_0x2febf5['model'],_0x2febf5[_0x8934('0x3b')]);_0x2c322d[_0x8934('0x3d')]=_[_0x8934('0x3e')](_0x2febf5['model'],qs['fields'](_0x1e2175[_0x8934('0x3b')]['fields']));_0x2c322d['attributes']=_0x2c322d[_0x8934('0x3d')][_0x8934('0x51')]?_0x2c322d[_0x8934('0x3d')]:_0x2febf5[_0x8934('0x40')];if(_0x1e2175[_0x8934('0x3b')][_0x8934('0x4b')]){_0x2c322d[_0x8934('0x4c')]=[{'all':!![]}];}_0x2c322d=_['merge']({},_0x2c322d,_0x1e2175[_0x8934('0x52')]);return db['ServicenowConfiguration'][_0x8934('0x53')](_0x2c322d)[_0x8934('0x1e')](handleEntityNotFound(_0xe212bc,null))[_0x8934('0x1e')](respondWithResult(_0xe212bc,null))[_0x8934('0x28')](handleError(_0xe212bc,null));};exports[_0x8934('0x54')]=function(_0x265b0a,_0x1f6c5f){return db[_0x8934('0x37')]['create'](_0x265b0a[_0x8934('0x55')],{})[_0x8934('0x1e')](respondWithResult(_0x1f6c5f,0xc9))[_0x8934('0x28')](handleError(_0x1f6c5f,null));};exports[_0x8934('0x56')]=function(_0x2ab06d,_0x5a791a){if(_0x2ab06d[_0x8934('0x55')]['id']){delete _0x2ab06d[_0x8934('0x55')]['id'];}return db[_0x8934('0x37')]['find']({'where':{'id':_0x2ab06d[_0x8934('0x50')]['id']}})[_0x8934('0x1e')](handleEntityNotFound(_0x5a791a,null))[_0x8934('0x1e')](saveUpdates(_0x2ab06d['body'],null))['then'](respondWithResult(_0x5a791a,null))['catch'](handleError(_0x5a791a,null));};exports[_0x8934('0x32')]=function(_0x8e3e85,_0x3aab00){return db['ServicenowConfiguration'][_0x8934('0x53')]({'where':{'id':_0x8e3e85[_0x8934('0x50')]['id']}})['then'](handleEntityNotFound(_0x3aab00,null))['then'](removeEntity(_0x3aab00,null))[_0x8934('0x28')](handleError(_0x3aab00,null));};exports[_0x8934('0x57')]=function(_0x44d892,_0xb9e4ac,_0x4bcf77){var _0x4d2e41={};var _0x4ea19e={};var _0x4a9089;var _0x43933f;return db[_0x8934('0x37')][_0x8934('0x58')]({'where':{'id':_0x44d892[_0x8934('0x50')]['id']}})[_0x8934('0x1e')](handleEntityNotFound(_0xb9e4ac,null))[_0x8934('0x1e')](function(_0x5a487e){if(_0x5a487e){_0x4a9089=_0x5a487e;_0x4ea19e[_0x8934('0x40')]=_[_0x8934('0x3c')](db['ServicenowField'][_0x8934('0x38')]);_0x4ea19e['query']=_[_0x8934('0x3c')](_0x44d892['query']);_0x4ea19e[_0x8934('0x45')]=_[_0x8934('0x3e')](_0x4ea19e[_0x8934('0x40')],_0x4ea19e[_0x8934('0x3b')]);_0x4d2e41[_0x8934('0x3d')]=_[_0x8934('0x3e')](_0x4ea19e[_0x8934('0x40')],qs['fields'](_0x44d892['query'][_0x8934('0x3f')]));_0x4d2e41[_0x8934('0x3d')]=_0x4d2e41[_0x8934('0x3d')][_0x8934('0x51')]?_0x4d2e41[_0x8934('0x3d')]:_0x4ea19e[_0x8934('0x40')];_0x4d2e41[_0x8934('0x43')]=qs[_0x8934('0x44')](_0x44d892[_0x8934('0x3b')][_0x8934('0x44')]);_0x4d2e41[_0x8934('0x48')]=qs[_0x8934('0x45')](_[_0x8934('0x46')](_0x44d892[_0x8934('0x3b')],_0x4ea19e['filters']));if(_0x44d892['query'][_0x8934('0x47')]){_0x4d2e41[_0x8934('0x48')]=_[_0x8934('0x49')](_0x4d2e41[_0x8934('0x48')],{'$or':_[_0x8934('0x36')](_0x4d2e41[_0x8934('0x3d')],function(_0x2f8318){var _0x5ed8ff={};_0x5ed8ff[_0x2f8318]={'$like':'%'+_0x44d892[_0x8934('0x3b')][_0x8934('0x47')]+'%'};return _0x5ed8ff;})});}_0x4d2e41=_['merge']({},_0x4d2e41,_0x44d892[_0x8934('0x52')]);return _0x4a9089['getFields'](_0x4d2e41);}})[_0x8934('0x1e')](function(_0x301967){if(_0x301967){_0x43933f=_0x301967[_0x8934('0x51')];if(!_0x44d892['query'][_0x8934('0x41')](_0x8934('0x59'))){_0x4d2e41['limit']=qs[_0x8934('0x42')](_0x44d892['query'][_0x8934('0x42')]);_0x4d2e41['offset']=qs[_0x8934('0x2c')](_0x44d892[_0x8934('0x3b')][_0x8934('0x2c')]);}return _0x4a9089['getFields'](_0x4d2e41);}})[_0x8934('0x1e')](function(_0xfbad9){if(_0xfbad9){return _0xfbad9?{'count':_0x43933f,'rows':_0xfbad9}:null;}})[_0x8934('0x1e')](respondWithResult(_0xb9e4ac,null))[_0x8934('0x28')](handleError(_0xb9e4ac,null));};exports['getSubjects']=function(_0x378e28,_0x4af42b,_0x10f552){var _0x2571ea={};var _0x14992b={};var _0x18afaa;var _0x5880d0;return db[_0x8934('0x37')][_0x8934('0x58')]({'where':{'id':_0x378e28[_0x8934('0x50')]['id']}})['then'](handleEntityNotFound(_0x4af42b,null))[_0x8934('0x1e')](function(_0xa869e8){if(_0xa869e8){_0x18afaa=_0xa869e8;_0x14992b[_0x8934('0x40')]=_['keys'](db['ServicenowField'][_0x8934('0x38')]);_0x14992b[_0x8934('0x3b')]=_[_0x8934('0x3c')](_0x378e28[_0x8934('0x3b')]);_0x14992b[_0x8934('0x45')]=_[_0x8934('0x3e')](_0x14992b[_0x8934('0x40')],_0x14992b[_0x8934('0x3b')]);_0x2571ea[_0x8934('0x3d')]=_['intersection'](_0x14992b[_0x8934('0x40')],qs[_0x8934('0x3f')](_0x378e28[_0x8934('0x3b')][_0x8934('0x3f')]));_0x2571ea[_0x8934('0x3d')]=_0x2571ea['attributes'][_0x8934('0x51')]?_0x2571ea[_0x8934('0x3d')]:_0x14992b['model'];_0x2571ea[_0x8934('0x43')]=qs['sort'](_0x378e28['query']['sort']);_0x2571ea[_0x8934('0x48')]=qs[_0x8934('0x45')](_[_0x8934('0x46')](_0x378e28['query'],_0x14992b[_0x8934('0x45')]));if(_0x378e28[_0x8934('0x3b')]['filter']){_0x2571ea[_0x8934('0x48')]=_[_0x8934('0x49')](_0x2571ea[_0x8934('0x48')],{'$or':_[_0x8934('0x36')](_0x2571ea[_0x8934('0x3d')],function(_0x324722){var _0x293bb8={};_0x293bb8[_0x324722]={'$like':'%'+_0x378e28[_0x8934('0x3b')][_0x8934('0x47')]+'%'};return _0x293bb8;})});}_0x2571ea=_[_0x8934('0x49')]({},_0x2571ea,_0x378e28['options']);return _0x18afaa[_0x8934('0x5a')](_0x2571ea);}})[_0x8934('0x1e')](function(_0xe9991f){if(_0xe9991f){_0x5880d0=_0xe9991f[_0x8934('0x51')];if(!_0x378e28[_0x8934('0x3b')][_0x8934('0x41')](_0x8934('0x59'))){_0x2571ea['limit']=qs[_0x8934('0x42')](_0x378e28[_0x8934('0x3b')][_0x8934('0x42')]);_0x2571ea[_0x8934('0x2c')]=qs[_0x8934('0x2c')](_0x378e28[_0x8934('0x3b')][_0x8934('0x2c')]);}return _0x18afaa[_0x8934('0x5a')](_0x2571ea);}})[_0x8934('0x1e')](function(_0x52b25e){if(_0x52b25e){return _0x52b25e?{'count':_0x5880d0,'rows':_0x52b25e}:null;}})['then'](respondWithResult(_0x4af42b,null))[_0x8934('0x28')](handleError(_0x4af42b,null));};exports[_0x8934('0x5b')]=function(_0x4faab2,_0x2becdf,_0x258bac){var _0x1ff259={};var _0xba3619={};var _0x25c4ac;var _0x1894ff;return db[_0x8934('0x37')][_0x8934('0x58')]({'where':{'id':_0x4faab2[_0x8934('0x50')]['id']}})[_0x8934('0x1e')](handleEntityNotFound(_0x2becdf,null))[_0x8934('0x1e')](function(_0x556b70){if(_0x556b70){_0x25c4ac=_0x556b70;_0xba3619[_0x8934('0x40')]=_[_0x8934('0x3c')](db[_0x8934('0x5c')]['rawAttributes']);_0xba3619[_0x8934('0x3b')]=_['keys'](_0x4faab2[_0x8934('0x3b')]);_0xba3619[_0x8934('0x45')]=_[_0x8934('0x3e')](_0xba3619[_0x8934('0x40')],_0xba3619['query']);_0x1ff259['attributes']=_[_0x8934('0x3e')](_0xba3619['model'],qs[_0x8934('0x3f')](_0x4faab2[_0x8934('0x3b')][_0x8934('0x3f')]));_0x1ff259[_0x8934('0x3d')]=_0x1ff259['attributes'][_0x8934('0x51')]?_0x1ff259['attributes']:_0xba3619['model'];_0x1ff259['order']=qs['sort'](_0x4faab2[_0x8934('0x3b')][_0x8934('0x44')]);_0x1ff259[_0x8934('0x48')]=qs[_0x8934('0x45')](_[_0x8934('0x46')](_0x4faab2['query'],_0xba3619['filters']));if(_0x4faab2[_0x8934('0x3b')][_0x8934('0x47')]){_0x1ff259[_0x8934('0x48')]=_[_0x8934('0x49')](_0x1ff259[_0x8934('0x48')],{'$or':_[_0x8934('0x36')](_0x1ff259[_0x8934('0x3d')],function(_0x2839dd){var _0x261887={};_0x261887[_0x2839dd]={'$like':'%'+_0x4faab2[_0x8934('0x3b')][_0x8934('0x47')]+'%'};return _0x261887;})});}_0x1ff259=_[_0x8934('0x49')]({},_0x1ff259,_0x4faab2[_0x8934('0x52')]);return _0x25c4ac[_0x8934('0x5b')](_0x1ff259);}})[_0x8934('0x1e')](function(_0x40a47a){if(_0x40a47a){_0x1894ff=_0x40a47a['length'];if(!_0x4faab2['query'][_0x8934('0x41')](_0x8934('0x59'))){_0x1ff259['limit']=qs[_0x8934('0x42')](_0x4faab2[_0x8934('0x3b')][_0x8934('0x42')]);_0x1ff259[_0x8934('0x2c')]=qs[_0x8934('0x2c')](_0x4faab2[_0x8934('0x3b')][_0x8934('0x2c')]);}return _0x25c4ac['getDescriptions'](_0x1ff259);}})[_0x8934('0x1e')](function(_0x5aab65){if(_0x5aab65){return _0x5aab65?{'count':_0x1894ff,'rows':_0x5aab65}:null;}})[_0x8934('0x1e')](respondWithResult(_0x2becdf,null))[_0x8934('0x28')](handleError(_0x2becdf,null));}; \ No newline at end of file +var _0x0bb5=['offset','limit','set','Content-Range','apply','reject','save','destroy','end','stack','index','ServicenowConfiguration','rawAttributes','key','model','map','name','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','body','update','params','find','getFields','findOne','ServicenowField','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','test','Sequelize','ValidationError','then','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','sendStatus','status','json','count'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bb5,0x148));var _0x50bb=function(_0x53fcad,_0x9154e9){_0x53fcad=_0x53fcad-0x0;var _0x8db6f4=_0x0bb5[_0x53fcad];return _0x8db6f4;};'use strict';var pdf=require(_0x50bb('0x0'));var emlformat=require(_0x50bb('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x50bb('0x2'));var rp=require(_0x50bb('0x3'));var moment=require(_0x50bb('0x4'));var BPromise=require(_0x50bb('0x5'));var Mustache=require(_0x50bb('0x6'));var util=require(_0x50bb('0x7'));var path=require(_0x50bb('0x8'));var sox=require(_0x50bb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var db=require(_0x50bb('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x50bb('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x283f04,_0xd8ab27,_0x155864){if(_0x155864){var _0x502250=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x502250[_0x50bb('0x1a')](_0xd8ab27)){return _0x283f04;}else{throw new db[(_0x50bb('0x1b'))][(_0x50bb('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x283f04;}}function respondWithRpcPromise(_0xbbc6a0,_0x5e8478,_0x21befa,_0x3e1a51){return new BPromise(function(_0x253073,_0x42ffab){var _0x908950=_0x3e1a51||client;return _0x908950['request'](_0xbbc6a0,_0x21befa)[_0x50bb('0x1d')](function(_0x174065){logger['info'](_0x50bb('0x1e'),_0x5e8478,'request\x20sent');logger[_0x50bb('0x1f')](_0x50bb('0x20'),_0x5e8478,'request\x20sent',JSON['stringify'](_0x174065));if(_0x174065[_0x50bb('0x21')]){if(_0x174065[_0x50bb('0x21')][_0x50bb('0x22')]===0x1f4){logger[_0x50bb('0x21')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5e8478,_0x174065[_0x50bb('0x21')][_0x50bb('0x23')]);return _0x42ffab(_0x174065[_0x50bb('0x21')]['message']);}logger[_0x50bb('0x21')](_0x50bb('0x1e'),_0x5e8478,_0x174065[_0x50bb('0x21')]['message']);return _0x253073(_0x174065[_0x50bb('0x21')]['message']);}else{logger[_0x50bb('0x24')](_0x50bb('0x1e'),_0x5e8478,_0x50bb('0x25'));_0x253073(_0x174065[_0x50bb('0x26')][_0x50bb('0x23')]);}})[_0x50bb('0x27')](function(_0x4f7f73){logger[_0x50bb('0x21')](_0x50bb('0x1e'),_0x5e8478,_0x4f7f73);_0x42ffab(_0x4f7f73);});});}function respondWithStatusCode(_0x284a76,_0x3462c1){_0x3462c1=_0x3462c1||0xcc;return function(_0x5234d7){if(_0x5234d7){return _0x284a76[_0x50bb('0x28')](_0x3462c1);}return _0x284a76['status'](_0x3462c1)['end']();};}function respondWithResult(_0x2befd9,_0x491632){_0x491632=_0x491632||0xc8;return function(_0x5cfe4b){if(_0x5cfe4b){return _0x2befd9[_0x50bb('0x29')](_0x491632)[_0x50bb('0x2a')](_0x5cfe4b);}};}function respondWithFilteredResult(_0x3004a3,_0x1b74f9){return function(_0x17c158){if(_0x17c158){var _0x269479=_0x17c158[_0x50bb('0x2b')],_0x41a8ad=_0x1b74f9[_0x50bb('0x2c')],_0x41d479=_0x1b74f9[_0x50bb('0x2c')]+_0x1b74f9[_0x50bb('0x2d')],_0x4f7514;if(_0x41d479>=_0x269479){_0x41d479=_0x269479;_0x4f7514=0xc8;}else{_0x4f7514=0xce;}_0x3004a3['status'](_0x4f7514);return _0x3004a3[_0x50bb('0x2e')](_0x50bb('0x2f'),_0x41a8ad+'-'+_0x41d479+'/'+_0x269479)[_0x50bb('0x2a')](_0x17c158);}return null;};}function patchUpdates(_0xb3c3ba){return function(_0x3fd5f6){try{jsonpatch[_0x50bb('0x30')](_0x3fd5f6,_0xb3c3ba,!![]);}catch(_0x51aa81){return BPromise[_0x50bb('0x31')](_0x51aa81);}return _0x3fd5f6[_0x50bb('0x32')]();};}function saveUpdates(_0x3459e5,_0x1c2ee2){return function(_0x210b0d){if(_0x210b0d){return _0x210b0d['update'](_0x3459e5)[_0x50bb('0x1d')](function(_0x3bad07){return _0x3bad07;});}return null;};}function removeEntity(_0x3f4d8e,_0x309f3b){return function(_0x2bea60){if(_0x2bea60){return _0x2bea60[_0x50bb('0x33')]()[_0x50bb('0x1d')](function(){_0x3f4d8e[_0x50bb('0x29')](0xcc)[_0x50bb('0x34')]();});}};}function handleEntityNotFound(_0x1cc4e2,_0x34fa35){return function(_0x53d288){if(!_0x53d288){_0x1cc4e2[_0x50bb('0x28')](0x194);}return _0x53d288;};}function handleError(_0xdb38e1,_0x20a097){_0x20a097=_0x20a097||0x1f4;return function(_0x2bfb54){logger[_0x50bb('0x21')](_0x2bfb54[_0x50bb('0x35')]);if(_0x2bfb54['name']){delete _0x2bfb54['name'];}_0xdb38e1[_0x50bb('0x29')](_0x20a097)['send'](_0x2bfb54);};}exports[_0x50bb('0x36')]=function(_0x1bf25a,_0x3c94ea){var _0x171c6b={},_0x4ba9f9={},_0x48f4de={'count':0x0,'rows':[]};var _0x3a5f09=_['map'](db[_0x50bb('0x37')][_0x50bb('0x38')],function(_0x280e5a){return{'name':_0x280e5a['fieldName'],'type':_0x280e5a['type'][_0x50bb('0x39')]};});_0x4ba9f9[_0x50bb('0x3a')]=_[_0x50bb('0x3b')](_0x3a5f09,_0x50bb('0x3c'));_0x4ba9f9['query']=_[_0x50bb('0x3d')](_0x1bf25a['query']);_0x4ba9f9['filters']=_[_0x50bb('0x3e')](_0x4ba9f9['model'],_0x4ba9f9[_0x50bb('0x3f')]);_0x171c6b[_0x50bb('0x40')]=_[_0x50bb('0x3e')](_0x4ba9f9[_0x50bb('0x3a')],qs[_0x50bb('0x41')](_0x1bf25a[_0x50bb('0x3f')][_0x50bb('0x41')]));_0x171c6b[_0x50bb('0x40')]=_0x171c6b[_0x50bb('0x40')][_0x50bb('0x42')]?_0x171c6b['attributes']:_0x4ba9f9['model'];if(!_0x1bf25a[_0x50bb('0x3f')][_0x50bb('0x43')](_0x50bb('0x44'))){_0x171c6b[_0x50bb('0x2d')]=qs['limit'](_0x1bf25a[_0x50bb('0x3f')]['limit']);_0x171c6b[_0x50bb('0x2c')]=qs[_0x50bb('0x2c')](_0x1bf25a[_0x50bb('0x3f')][_0x50bb('0x2c')]);}_0x171c6b[_0x50bb('0x45')]=qs[_0x50bb('0x46')](_0x1bf25a[_0x50bb('0x3f')][_0x50bb('0x46')]);_0x171c6b[_0x50bb('0x47')]=qs[_0x50bb('0x48')](_[_0x50bb('0x49')](_0x1bf25a[_0x50bb('0x3f')],_0x4ba9f9[_0x50bb('0x48')]),_0x3a5f09);if(_0x1bf25a[_0x50bb('0x3f')][_0x50bb('0x4a')]){_0x171c6b[_0x50bb('0x47')]=_['merge'](_0x171c6b[_0x50bb('0x47')],{'$or':_['map'](_0x3a5f09,function(_0x2a87c1){if(_0x2a87c1[_0x50bb('0x4b')]!==_0x50bb('0x4c')){var _0x4613c8={};_0x4613c8[_0x2a87c1[_0x50bb('0x3c')]]={'$like':'%'+_0x1bf25a[_0x50bb('0x3f')][_0x50bb('0x4a')]+'%'};return _0x4613c8;}})});}_0x171c6b=_[_0x50bb('0x4d')]({},_0x171c6b,_0x1bf25a[_0x50bb('0x4e')]);var _0x3fe267={'where':_0x171c6b[_0x50bb('0x47')]};return db[_0x50bb('0x37')][_0x50bb('0x2b')](_0x3fe267)[_0x50bb('0x1d')](function(_0x5880df){_0x48f4de[_0x50bb('0x2b')]=_0x5880df;if(_0x1bf25a['query'][_0x50bb('0x4f')]){_0x171c6b[_0x50bb('0x50')]=[{'all':!![]}];}return db[_0x50bb('0x37')][_0x50bb('0x51')](_0x171c6b);})[_0x50bb('0x1d')](function(_0x39ac1a){_0x48f4de[_0x50bb('0x52')]=_0x39ac1a;return _0x48f4de;})[_0x50bb('0x1d')](respondWithFilteredResult(_0x3c94ea,_0x171c6b))['catch'](handleError(_0x3c94ea,null));};exports[_0x50bb('0x53')]=function(_0x262a12,_0xf52a22){var _0x13afe2={'raw':![],'where':{'id':_0x262a12['params']['id']}},_0x3659c4={};_0x3659c4[_0x50bb('0x3a')]=_[_0x50bb('0x3d')](db[_0x50bb('0x37')][_0x50bb('0x38')]);_0x3659c4[_0x50bb('0x3f')]=_['keys'](_0x262a12['query']);_0x3659c4[_0x50bb('0x48')]=_['intersection'](_0x3659c4[_0x50bb('0x3a')],_0x3659c4['query']);_0x13afe2[_0x50bb('0x40')]=_[_0x50bb('0x3e')](_0x3659c4[_0x50bb('0x3a')],qs['fields'](_0x262a12[_0x50bb('0x3f')][_0x50bb('0x41')]));_0x13afe2['attributes']=_0x13afe2[_0x50bb('0x40')][_0x50bb('0x42')]?_0x13afe2[_0x50bb('0x40')]:_0x3659c4[_0x50bb('0x3a')];if(_0x262a12['query'][_0x50bb('0x4f')]){_0x13afe2[_0x50bb('0x50')]=[{'all':!![]}];}_0x13afe2=_[_0x50bb('0x4d')]({},_0x13afe2,_0x262a12[_0x50bb('0x4e')]);return db[_0x50bb('0x37')]['find'](_0x13afe2)[_0x50bb('0x1d')](handleEntityNotFound(_0xf52a22,null))['then'](respondWithResult(_0xf52a22,null))[_0x50bb('0x27')](handleError(_0xf52a22,null));};exports['create']=function(_0x52ea86,_0x3f1557){return db['ServicenowConfiguration']['create'](_0x52ea86[_0x50bb('0x54')],{})[_0x50bb('0x1d')](respondWithResult(_0x3f1557,0xc9))[_0x50bb('0x27')](handleError(_0x3f1557,null));};exports[_0x50bb('0x55')]=function(_0x3ef5d8,_0x3b78bd){if(_0x3ef5d8[_0x50bb('0x54')]['id']){delete _0x3ef5d8[_0x50bb('0x54')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x3ef5d8[_0x50bb('0x56')]['id']}})[_0x50bb('0x1d')](handleEntityNotFound(_0x3b78bd,null))[_0x50bb('0x1d')](saveUpdates(_0x3ef5d8[_0x50bb('0x54')],null))[_0x50bb('0x1d')](respondWithResult(_0x3b78bd,null))[_0x50bb('0x27')](handleError(_0x3b78bd,null));};exports[_0x50bb('0x33')]=function(_0x4bf426,_0x3be83b){return db[_0x50bb('0x37')][_0x50bb('0x57')]({'where':{'id':_0x4bf426[_0x50bb('0x56')]['id']}})[_0x50bb('0x1d')](handleEntityNotFound(_0x3be83b,null))['then'](removeEntity(_0x3be83b,null))[_0x50bb('0x27')](handleError(_0x3be83b,null));};exports[_0x50bb('0x58')]=function(_0x1da5cd,_0x507f26,_0x2ba758){var _0x5b20f7={};var _0x261bf5={};var _0x4a5e2d;var _0x596550;return db[_0x50bb('0x37')][_0x50bb('0x59')]({'where':{'id':_0x1da5cd[_0x50bb('0x56')]['id']}})[_0x50bb('0x1d')](handleEntityNotFound(_0x507f26,null))[_0x50bb('0x1d')](function(_0x20e35a){if(_0x20e35a){_0x4a5e2d=_0x20e35a;_0x261bf5[_0x50bb('0x3a')]=_[_0x50bb('0x3d')](db[_0x50bb('0x5a')][_0x50bb('0x38')]);_0x261bf5[_0x50bb('0x3f')]=_['keys'](_0x1da5cd[_0x50bb('0x3f')]);_0x261bf5['filters']=_[_0x50bb('0x3e')](_0x261bf5[_0x50bb('0x3a')],_0x261bf5['query']);_0x5b20f7[_0x50bb('0x40')]=_[_0x50bb('0x3e')](_0x261bf5[_0x50bb('0x3a')],qs[_0x50bb('0x41')](_0x1da5cd[_0x50bb('0x3f')][_0x50bb('0x41')]));_0x5b20f7[_0x50bb('0x40')]=_0x5b20f7[_0x50bb('0x40')]['length']?_0x5b20f7[_0x50bb('0x40')]:_0x261bf5[_0x50bb('0x3a')];_0x5b20f7[_0x50bb('0x45')]=qs['sort'](_0x1da5cd[_0x50bb('0x3f')][_0x50bb('0x46')]);_0x5b20f7[_0x50bb('0x47')]=qs[_0x50bb('0x48')](_[_0x50bb('0x49')](_0x1da5cd[_0x50bb('0x3f')],_0x261bf5['filters']));if(_0x1da5cd[_0x50bb('0x3f')][_0x50bb('0x4a')]){_0x5b20f7[_0x50bb('0x47')]=_[_0x50bb('0x4d')](_0x5b20f7[_0x50bb('0x47')],{'$or':_[_0x50bb('0x3b')](_0x5b20f7['attributes'],function(_0x40257b){var _0xa85833={};_0xa85833[_0x40257b]={'$like':'%'+_0x1da5cd[_0x50bb('0x3f')][_0x50bb('0x4a')]+'%'};return _0xa85833;})});}_0x5b20f7=_[_0x50bb('0x4d')]({},_0x5b20f7,_0x1da5cd[_0x50bb('0x4e')]);return _0x4a5e2d[_0x50bb('0x58')](_0x5b20f7);}})[_0x50bb('0x1d')](function(_0x25f2e7){if(_0x25f2e7){_0x596550=_0x25f2e7['length'];if(!_0x1da5cd[_0x50bb('0x3f')][_0x50bb('0x43')](_0x50bb('0x44'))){_0x5b20f7[_0x50bb('0x2d')]=qs[_0x50bb('0x2d')](_0x1da5cd[_0x50bb('0x3f')][_0x50bb('0x2d')]);_0x5b20f7[_0x50bb('0x2c')]=qs[_0x50bb('0x2c')](_0x1da5cd['query']['offset']);}return _0x4a5e2d['getFields'](_0x5b20f7);}})[_0x50bb('0x1d')](function(_0x5ba597){if(_0x5ba597){return _0x5ba597?{'count':_0x596550,'rows':_0x5ba597}:null;}})['then'](respondWithResult(_0x507f26,null))[_0x50bb('0x27')](handleError(_0x507f26,null));};exports[_0x50bb('0x5b')]=function(_0x18fa23,_0x2c62b1,_0x5e7ccc){var _0x413dd0={};var _0x16a500={};var _0x48bb56;var _0x13310d;return db['ServicenowConfiguration'][_0x50bb('0x59')]({'where':{'id':_0x18fa23[_0x50bb('0x56')]['id']}})['then'](handleEntityNotFound(_0x2c62b1,null))[_0x50bb('0x1d')](function(_0x52c882){if(_0x52c882){_0x48bb56=_0x52c882;_0x16a500[_0x50bb('0x3a')]=_[_0x50bb('0x3d')](db['ServicenowField'][_0x50bb('0x38')]);_0x16a500[_0x50bb('0x3f')]=_[_0x50bb('0x3d')](_0x18fa23['query']);_0x16a500[_0x50bb('0x48')]=_[_0x50bb('0x3e')](_0x16a500[_0x50bb('0x3a')],_0x16a500[_0x50bb('0x3f')]);_0x413dd0['attributes']=_[_0x50bb('0x3e')](_0x16a500[_0x50bb('0x3a')],qs['fields'](_0x18fa23['query'][_0x50bb('0x41')]));_0x413dd0[_0x50bb('0x40')]=_0x413dd0['attributes'][_0x50bb('0x42')]?_0x413dd0[_0x50bb('0x40')]:_0x16a500[_0x50bb('0x3a')];_0x413dd0[_0x50bb('0x45')]=qs[_0x50bb('0x46')](_0x18fa23['query']['sort']);_0x413dd0[_0x50bb('0x47')]=qs[_0x50bb('0x48')](_[_0x50bb('0x49')](_0x18fa23[_0x50bb('0x3f')],_0x16a500['filters']));if(_0x18fa23[_0x50bb('0x3f')]['filter']){_0x413dd0[_0x50bb('0x47')]=_[_0x50bb('0x4d')](_0x413dd0[_0x50bb('0x47')],{'$or':_[_0x50bb('0x3b')](_0x413dd0[_0x50bb('0x40')],function(_0x217170){var _0x3a7ba7={};_0x3a7ba7[_0x217170]={'$like':'%'+_0x18fa23['query'][_0x50bb('0x4a')]+'%'};return _0x3a7ba7;})});}_0x413dd0=_[_0x50bb('0x4d')]({},_0x413dd0,_0x18fa23[_0x50bb('0x4e')]);return _0x48bb56[_0x50bb('0x5b')](_0x413dd0);}})[_0x50bb('0x1d')](function(_0x1817eb){if(_0x1817eb){_0x13310d=_0x1817eb[_0x50bb('0x42')];if(!_0x18fa23['query'][_0x50bb('0x43')](_0x50bb('0x44'))){_0x413dd0[_0x50bb('0x2d')]=qs[_0x50bb('0x2d')](_0x18fa23[_0x50bb('0x3f')]['limit']);_0x413dd0['offset']=qs[_0x50bb('0x2c')](_0x18fa23['query'][_0x50bb('0x2c')]);}return _0x48bb56[_0x50bb('0x5b')](_0x413dd0);}})['then'](function(_0x498b88){if(_0x498b88){return _0x498b88?{'count':_0x13310d,'rows':_0x498b88}:null;}})[_0x50bb('0x1d')](respondWithResult(_0x2c62b1,null))[_0x50bb('0x27')](handleError(_0x2c62b1,null));};exports[_0x50bb('0x5c')]=function(_0x486f34,_0x75dc05,_0x77c26d){var _0x1b88f5={};var _0x104b0d={};var _0x669966;var _0x3a25a4;return db[_0x50bb('0x37')]['findOne']({'where':{'id':_0x486f34['params']['id']}})[_0x50bb('0x1d')](handleEntityNotFound(_0x75dc05,null))[_0x50bb('0x1d')](function(_0x232388){if(_0x232388){_0x669966=_0x232388;_0x104b0d[_0x50bb('0x3a')]=_[_0x50bb('0x3d')](db[_0x50bb('0x5a')][_0x50bb('0x38')]);_0x104b0d[_0x50bb('0x3f')]=_[_0x50bb('0x3d')](_0x486f34[_0x50bb('0x3f')]);_0x104b0d['filters']=_[_0x50bb('0x3e')](_0x104b0d[_0x50bb('0x3a')],_0x104b0d[_0x50bb('0x3f')]);_0x1b88f5[_0x50bb('0x40')]=_[_0x50bb('0x3e')](_0x104b0d[_0x50bb('0x3a')],qs[_0x50bb('0x41')](_0x486f34[_0x50bb('0x3f')][_0x50bb('0x41')]));_0x1b88f5[_0x50bb('0x40')]=_0x1b88f5[_0x50bb('0x40')][_0x50bb('0x42')]?_0x1b88f5[_0x50bb('0x40')]:_0x104b0d[_0x50bb('0x3a')];_0x1b88f5[_0x50bb('0x45')]=qs['sort'](_0x486f34[_0x50bb('0x3f')][_0x50bb('0x46')]);_0x1b88f5[_0x50bb('0x47')]=qs['filters'](_[_0x50bb('0x49')](_0x486f34[_0x50bb('0x3f')],_0x104b0d[_0x50bb('0x48')]));if(_0x486f34[_0x50bb('0x3f')][_0x50bb('0x4a')]){_0x1b88f5[_0x50bb('0x47')]=_[_0x50bb('0x4d')](_0x1b88f5[_0x50bb('0x47')],{'$or':_[_0x50bb('0x3b')](_0x1b88f5[_0x50bb('0x40')],function(_0x4ec601){var _0x353058={};_0x353058[_0x4ec601]={'$like':'%'+_0x486f34[_0x50bb('0x3f')][_0x50bb('0x4a')]+'%'};return _0x353058;})});}_0x1b88f5=_[_0x50bb('0x4d')]({},_0x1b88f5,_0x486f34[_0x50bb('0x4e')]);return _0x669966[_0x50bb('0x5c')](_0x1b88f5);}})[_0x50bb('0x1d')](function(_0x39b247){if(_0x39b247){_0x3a25a4=_0x39b247[_0x50bb('0x42')];if(!_0x486f34[_0x50bb('0x3f')][_0x50bb('0x43')]('nolimit')){_0x1b88f5[_0x50bb('0x2d')]=qs[_0x50bb('0x2d')](_0x486f34[_0x50bb('0x3f')][_0x50bb('0x2d')]);_0x1b88f5[_0x50bb('0x2c')]=qs[_0x50bb('0x2c')](_0x486f34['query'][_0x50bb('0x2c')]);}return _0x669966['getDescriptions'](_0x1b88f5);}})[_0x50bb('0x1d')](function(_0x35edd2){if(_0x35edd2){return _0x35edd2?{'count':_0x3a25a4,'rows':_0x35edd2}:null;}})['then'](respondWithResult(_0x75dc05,null))['catch'](handleError(_0x75dc05,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index c8e4891..1fb6db5 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 _0x49a9=['exports','ServicenowConfiguration','int_servicenow_configurations','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x439740,_0x2687cd){var _0xb1fc75=function(_0x4e4eeb){while(--_0x4e4eeb){_0x439740['push'](_0x439740['shift']());}};_0xb1fc75(++_0x2687cd);}(_0x49a9,0xb3));var _0x949a=function(_0x23b60a,_0x2c6ca0){_0x23b60a=_0x23b60a-0x0;var _0x4604bf=_0x49a9[_0x23b60a];return _0x4604bf;};'use strict';var _=require(_0x949a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x949a('0x1'));var moment=require(_0x949a('0x2'));var BPromise=require(_0x949a('0x3'));var rp=require(_0x949a('0x4'));var fs=require('fs');var path=require(_0x949a('0x5'));var rimraf=require('rimraf');var config=require(_0x949a('0x6'));var attributes=require(_0x949a('0x7'));module[_0x949a('0x8')]=function(_0x3b6d66,_0x59f9fb){return _0x3b6d66['define'](_0x949a('0x9'),attributes,{'tableName':_0x949a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfbd=['request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x5cc556,_0x158710){var _0x12103b=function(_0x13ff4a){while(--_0x13ff4a){_0x5cc556['push'](_0x5cc556['shift']());}};_0x12103b(++_0x158710);}(_0xbfbd,0xcd));var _0xdbfb=function(_0x1b68a4,_0x36aaf0){_0x1b68a4=_0x1b68a4-0x0;var _0x2162da=_0xbfbd[_0x1b68a4];return _0x2162da;};'use strict';var _=require(_0xdbfb('0x0'));var util=require(_0xdbfb('0x1'));var logger=require(_0xdbfb('0x2'))(_0xdbfb('0x3'));var moment=require('moment');var BPromise=require(_0xdbfb('0x4'));var rp=require(_0xdbfb('0x5'));var fs=require('fs');var path=require(_0xdbfb('0x6'));var rimraf=require(_0xdbfb('0x7'));var config=require(_0xdbfb('0x8'));var attributes=require(_0xdbfb('0x9'));module[_0xdbfb('0xa')]=function(_0x4d52ee,_0x49024c){return _0x4d52ee[_0xdbfb('0xb')](_0xdbfb('0xc'),attributes,{'tableName':_0xdbfb('0xd'),'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 353dd02..fc13a79 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 _0x1fe1=['catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x10585f,_0x2b2f81){var _0xde42fa=function(_0x1c363d){while(--_0x1c363d){_0x10585f['push'](_0x10585f['shift']());}};_0xde42fa(++_0x2b2f81);}(_0x1fe1,0xa3));var _0x11fe=function(_0x25ddf2,_0x56fb26){_0x25ddf2=_0x25ddf2-0x0;var _0x8d6da=_0x1fe1[_0x25ddf2];return _0x8d6da;};'use strict';var _=require(_0x11fe('0x0'));var util=require(_0x11fe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x11fe('0x2'));var fs=require('fs');var Redis=require(_0x11fe('0x3'));var db=require(_0x11fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x11fe('0x5'));var config=require('../../config/environment');var jayson=require(_0x11fe('0x6'));var client=jayson[_0x11fe('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4881d7,_0x20af9c,_0x188b3a){return new BPromise(function(_0x4d4be9,_0x5293e2){return client[_0x11fe('0x8')](_0x4881d7,_0x188b3a)['then'](function(_0x4c9223){logger['info'](_0x11fe('0x9'),_0x20af9c,_0x11fe('0xa'));logger[_0x11fe('0xb')](_0x11fe('0xc'),_0x20af9c,_0x11fe('0xa'),JSON['stringify'](_0x4c9223));if(_0x4c9223[_0x11fe('0xd')]){if(_0x4c9223[_0x11fe('0xd')][_0x11fe('0xe')]===0x1f4){logger[_0x11fe('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x20af9c,_0x4c9223[_0x11fe('0xd')][_0x11fe('0xf')]);return _0x5293e2(_0x4c9223[_0x11fe('0xd')]['message']);}logger[_0x11fe('0xd')](_0x11fe('0x9'),_0x20af9c,_0x4c9223[_0x11fe('0xd')][_0x11fe('0xf')]);return _0x4d4be9(_0x4c9223['error'][_0x11fe('0xf')]);}else{logger[_0x11fe('0x10')](_0x11fe('0x9'),_0x20af9c,_0x11fe('0xa'));_0x4d4be9(_0x4c9223['result'][_0x11fe('0xf')]);}})[_0x11fe('0x11')](function(_0x1b7724){logger['error'](_0x11fe('0x9'),_0x20af9c,_0x1b7724);_0x5293e2(_0x1b7724);});});} \ No newline at end of file +var _0xd8cc=['debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x3cfb6c,_0xcb6a0c){var _0x428371=function(_0x516cdb){while(--_0x516cdb){_0x3cfb6c['push'](_0x3cfb6c['shift']());}};_0x428371(++_0xcb6a0c);}(_0xd8cc,0xc0));var _0xcd8c=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xd8cc[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xcd8c('0x0'));var util=require(_0xcd8c('0x1'));var moment=require(_0xcd8c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd8c('0x3'));var db=require(_0xcd8c('0x4'))['db'];var utils=require(_0xcd8c('0x5'));var logger=require(_0xcd8c('0x6'))(_0xcd8c('0x7'));var config=require('../../config/environment');var jayson=require(_0xcd8c('0x8'));var client=jayson[_0xcd8c('0x9')][_0xcd8c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1309cd,_0x4204b9,_0xb5a28f){return new BPromise(function(_0x48fe8d,_0x29793e){return client[_0xcd8c('0xb')](_0x1309cd,_0xb5a28f)[_0xcd8c('0xc')](function(_0x49d0e0){logger[_0xcd8c('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4204b9,_0xcd8c('0xe'));logger[_0xcd8c('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4204b9,_0xcd8c('0xe'),JSON[_0xcd8c('0x10')](_0x49d0e0));if(_0x49d0e0[_0xcd8c('0x11')]){if(_0x49d0e0[_0xcd8c('0x11')][_0xcd8c('0x12')]===0x1f4){logger['error'](_0xcd8c('0x13'),_0x4204b9,_0x49d0e0[_0xcd8c('0x11')][_0xcd8c('0x14')]);return _0x29793e(_0x49d0e0[_0xcd8c('0x11')][_0xcd8c('0x14')]);}logger[_0xcd8c('0x11')](_0xcd8c('0x13'),_0x4204b9,_0x49d0e0[_0xcd8c('0x11')]['message']);return _0x48fe8d(_0x49d0e0[_0xcd8c('0x11')][_0xcd8c('0x14')]);}else{logger[_0xcd8c('0xd')](_0xcd8c('0x13'),_0x4204b9,_0xcd8c('0xe'));_0x48fe8d(_0x49d0e0[_0xcd8c('0x15')][_0xcd8c('0x14')]);}})[_0xcd8c('0x16')](function(_0x4b4171){logger[_0xcd8c('0x11')](_0xcd8c('0x13'),_0x4204b9,_0x4b4171);_0x29793e(_0x4b4171);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 267a6ee..9952e8b 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 _0x8591=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete'];(function(_0x5c0768,_0x22d787){var _0x4587c2=function(_0xe286f6){while(--_0xe286f6){_0x5c0768['push'](_0x5c0768['shift']());}};_0x4587c2(++_0x22d787);}(_0x8591,0x18d));var _0x1859=function(_0x5243bc,_0x1ce110){_0x5243bc=_0x5243bc-0x0;var _0x3d60c9=_0x8591[_0x5243bc];return _0x3d60c9;};'use strict';var multer=require(_0x1859('0x0'));var util=require(_0x1859('0x1'));var path=require(_0x1859('0x2'));var timeout=require(_0x1859('0x3'));var express=require('express');var router=express[_0x1859('0x4')]();var auth=require(_0x1859('0x5'));var interaction=require(_0x1859('0x6'));var config=require(_0x1859('0x7'));var controller=require('./intServicenowField.controller');router[_0x1859('0x8')]('/',auth[_0x1859('0x9')](),controller[_0x1859('0xa')]);router[_0x1859('0x8')](_0x1859('0xb'),auth[_0x1859('0x9')](),controller[_0x1859('0xc')]);router[_0x1859('0xd')]('/',auth['isAuthenticated'](),controller[_0x1859('0xe')]);router['put']('/:id',auth[_0x1859('0x9')](),controller[_0x1859('0xf')]);router[_0x1859('0x10')](_0x1859('0xb'),auth[_0x1859('0x9')](),controller['destroy']);module[_0x1859('0x11')]=router; \ No newline at end of file +var _0x8a1c=['get','/:id','show','post','update','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated'];(function(_0xc7ac75,_0x4002b6){var _0x112c58=function(_0x19bf21){while(--_0x19bf21){_0xc7ac75['push'](_0xc7ac75['shift']());}};_0x112c58(++_0x4002b6);}(_0x8a1c,0x1f3));var _0xc8a1=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8a1c[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xc8a1('0x0'));var util=require('util');var path=require(_0xc8a1('0x1'));var timeout=require(_0xc8a1('0x2'));var express=require('express');var router=express[_0xc8a1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc8a1('0x4'));var config=require(_0xc8a1('0x5'));var controller=require(_0xc8a1('0x6'));router['get']('/',auth[_0xc8a1('0x7')](),controller['index']);router[_0xc8a1('0x8')](_0xc8a1('0x9'),auth[_0xc8a1('0x7')](),controller[_0xc8a1('0xa')]);router[_0xc8a1('0xb')]('/',auth[_0xc8a1('0x7')](),controller['create']);router['put'](_0xc8a1('0x9'),auth[_0xc8a1('0x7')](),controller[_0xc8a1('0xc')]);router['delete'](_0xc8a1('0x9'),auth[_0xc8a1('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index d32d55f..521edc0 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 _0x4889=['string','customVariable','STRING','variable','BOOLEAN','sequelize','ENUM'];(function(_0x31c5e9,_0x30e373){var _0x517a8d=function(_0x7f9a48){while(--_0x7f9a48){_0x31c5e9['push'](_0x31c5e9['shift']());}};_0x517a8d(++_0x30e373);}(_0x4889,0x194));var _0x9488=function(_0x12ddd3,_0x175755){_0x12ddd3=_0x12ddd3-0x0;var _0x116185=_0x4889[_0x12ddd3];return _0x116185;};'use strict';var Sequelize=require(_0x9488('0x0'));module['exports']={'type':{'type':Sequelize[_0x9488('0x1')](_0x9488('0x2'),'variable',_0x9488('0x3'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x9488('0x4')]},'key':{'type':Sequelize[_0x9488('0x4')]},'keyType':{'type':Sequelize[_0x9488('0x1')](_0x9488('0x2'),_0x9488('0x5'),_0x9488('0x3'))},'keyContent':{'type':Sequelize[_0x9488('0x4')]},'idField':{'type':Sequelize[_0x9488('0x4')]},'nameField':{'type':Sequelize[_0x9488('0x4')]},'customField':{'type':Sequelize[_0x9488('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9488('0x4')]}}; \ No newline at end of file +var _0x3dc8=['variable','customVariable','keyValue','STRING','exports','ENUM'];(function(_0x5d07ab,_0x3cab62){var _0x26095a=function(_0x3d6001){while(--_0x3d6001){_0x5d07ab['push'](_0x5d07ab['shift']());}};_0x26095a(++_0x3cab62);}(_0x3dc8,0x148));var _0x83dc=function(_0x303065,_0x131b55){_0x303065=_0x303065-0x0;var _0x26342b=_0x3dc8[_0x303065];return _0x26342b;};'use strict';var Sequelize=require('sequelize');module[_0x83dc('0x0')]={'type':{'type':Sequelize[_0x83dc('0x1')]('string',_0x83dc('0x2'),_0x83dc('0x3'),_0x83dc('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x83dc('0x5')]},'key':{'type':Sequelize[_0x83dc('0x5')]},'keyType':{'type':Sequelize[_0x83dc('0x1')]('string',_0x83dc('0x2'),_0x83dc('0x3'))},'keyContent':{'type':Sequelize[_0x83dc('0x5')]},'idField':{'type':Sequelize[_0x83dc('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x83dc('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index e998597..817770c 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x19bceb,_0x2504ac){var _0x433cc8=function(_0x135c59){while(--_0x135c59){_0x19bceb['push'](_0x19bceb['shift']());}};_0x433cc8(++_0x2504ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x7656b1,_0x1ecbdf){var _0x40be22=function(_0x174446){while(--_0x174446){_0x7656b1['push'](_0x7656b1['shift']());}};_0x40be22(++_0x1ecbdf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index eb38efd..aba9917 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 _0xfb5f=['define','int_servicenow_fields','idField','FieldId','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x1e8a68,_0x144faf){var _0x3d694b=function(_0x525dcd){while(--_0x525dcd){_0x1e8a68['push'](_0x1e8a68['shift']());}};_0x3d694b(++_0x144faf);}(_0xfb5f,0x17e));var _0xffb5=function(_0x16a01f,_0x55915b){_0x16a01f=_0x16a01f-0x0;var _0x3eb2f3=_0xfb5f[_0x16a01f];return _0x3eb2f3;};'use strict';var _=require(_0xffb5('0x0'));var util=require(_0xffb5('0x1'));var logger=require(_0xffb5('0x2'))('api');var moment=require(_0xffb5('0x3'));var BPromise=require('bluebird');var rp=require(_0xffb5('0x4'));var fs=require('fs');var path=require(_0xffb5('0x5'));var rimraf=require(_0xffb5('0x6'));var config=require(_0xffb5('0x7'));var attributes=require(_0xffb5('0x8'));module[_0xffb5('0x9')]=function(_0x5003b3,_0x34751b){return _0x5003b3[_0xffb5('0xa')]('ServicenowField',attributes,{'tableName':_0xffb5('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xffb5('0xc'),_0xffb5('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c3=['servicenow_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowField.attributes','int_servicenow_fields'];(function(_0x17c118,_0xe43d56){var _0x4b4466=function(_0x5eeda3){while(--_0x5eeda3){_0x17c118['push'](_0x17c118['shift']());}};_0x4b4466(++_0xe43d56);}(_0xb4c3,0x161));var _0x3b4c=function(_0x37df60,_0x4f6e96){_0x37df60=_0x37df60-0x0;var _0x522474=_0xb4c3[_0x37df60];return _0x522474;};'use strict';var _=require(_0x3b4c('0x0'));var util=require(_0x3b4c('0x1'));var logger=require(_0x3b4c('0x2'))(_0x3b4c('0x3'));var moment=require(_0x3b4c('0x4'));var BPromise=require(_0x3b4c('0x5'));var rp=require(_0x3b4c('0x6'));var fs=require('fs');var path=require(_0x3b4c('0x7'));var rimraf=require(_0x3b4c('0x8'));var config=require('../../config/environment');var attributes=require(_0x3b4c('0x9'));module['exports']=function(_0x9a2f88,_0x220281){return _0x9a2f88['define']('ServicenowField',attributes,{'tableName':_0x3b4c('0xa'),'paranoid':![],'indexes':[{'name':_0x3b4c('0xb'),'fields':['idField',_0x3b4c('0xc')],'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 f2de316..a327796 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 _0xfe60=['../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x25d4b1,_0x4e896d){var _0x2d51a5=function(_0x9c766){while(--_0x9c766){_0x25d4b1['push'](_0x25d4b1['shift']());}};_0x2d51a5(++_0x4e896d);}(_0xfe60,0x137));var _0x0fe6=function(_0x3ca315,_0x342070){_0x3ca315=_0x3ca315-0x0;var _0x1c346b=_0xfe60[_0x3ca315];return _0x1c346b;};'use strict';var _=require(_0x0fe6('0x0'));var util=require('util');var moment=require(_0x0fe6('0x1'));var BPromise=require('bluebird');var rs=require(_0x0fe6('0x2'));var fs=require('fs');var Redis=require(_0x0fe6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0fe6('0x4'))('rpc');var config=require(_0x0fe6('0x5'));var jayson=require(_0x0fe6('0x6'));var client=jayson['client'][_0x0fe6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xab25d1,_0x15d8bc,_0x549c00){return new BPromise(function(_0x2c44d4,_0x21a506){return client[_0x0fe6('0x8')](_0xab25d1,_0x549c00)[_0x0fe6('0x9')](function(_0x12ab8a){logger[_0x0fe6('0xa')](_0x0fe6('0xb'),_0x15d8bc,'request\x20sent');logger[_0x0fe6('0xc')](_0x0fe6('0xd'),_0x15d8bc,_0x0fe6('0xe'),JSON[_0x0fe6('0xf')](_0x12ab8a));if(_0x12ab8a[_0x0fe6('0x10')]){if(_0x12ab8a[_0x0fe6('0x10')][_0x0fe6('0x11')]===0x1f4){logger[_0x0fe6('0x10')](_0x0fe6('0xb'),_0x15d8bc,_0x12ab8a[_0x0fe6('0x10')][_0x0fe6('0x12')]);return _0x21a506(_0x12ab8a['error'][_0x0fe6('0x12')]);}logger[_0x0fe6('0x10')](_0x0fe6('0xb'),_0x15d8bc,_0x12ab8a[_0x0fe6('0x10')][_0x0fe6('0x12')]);return _0x2c44d4(_0x12ab8a['error'][_0x0fe6('0x12')]);}else{logger[_0x0fe6('0xa')](_0x0fe6('0xb'),_0x15d8bc,'request\x20sent');_0x2c44d4(_0x12ab8a[_0x0fe6('0x13')][_0x0fe6('0x12')]);}})[_0x0fe6('0x14')](function(_0x2e5c9d){logger[_0x0fe6('0x10')](_0x0fe6('0xb'),_0x15d8bc,_0x2e5c9d);_0x21a506(_0x2e5c9d);});});} \ No newline at end of file +var _0xf16f=['request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x4fa202,_0x29ee4e){var _0x52667c=function(_0x3b5f77){while(--_0x3b5f77){_0x4fa202['push'](_0x4fa202['shift']());}};_0x52667c(++_0x29ee4e);}(_0xf16f,0x13e));var _0xff16=function(_0x30f275,_0x161926){_0x30f275=_0x30f275-0x0;var _0xf9da76=_0xf16f[_0x30f275];return _0xf9da76;};'use strict';var _=require(_0xff16('0x0'));var util=require(_0xff16('0x1'));var moment=require(_0xff16('0x2'));var BPromise=require(_0xff16('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff16('0x4'));var db=require(_0xff16('0x5'))['db'];var utils=require(_0xff16('0x6'));var logger=require(_0xff16('0x7'))('rpc');var config=require(_0xff16('0x8'));var jayson=require(_0xff16('0x9'));var client=jayson[_0xff16('0xa')][_0xff16('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4648e6,_0x1c2f5a,_0x5f27c3){return new BPromise(function(_0x36690b,_0xdf0eb3){return client[_0xff16('0xc')](_0x4648e6,_0x5f27c3)['then'](function(_0x34038c){logger[_0xff16('0xd')](_0xff16('0xe'),_0x1c2f5a,_0xff16('0xf'));logger[_0xff16('0x10')](_0xff16('0x11'),_0x1c2f5a,_0xff16('0xf'),JSON[_0xff16('0x12')](_0x34038c));if(_0x34038c[_0xff16('0x13')]){if(_0x34038c[_0xff16('0x13')]['code']===0x1f4){logger[_0xff16('0x13')](_0xff16('0xe'),_0x1c2f5a,_0x34038c[_0xff16('0x13')][_0xff16('0x14')]);return _0xdf0eb3(_0x34038c[_0xff16('0x13')]['message']);}logger[_0xff16('0x13')](_0xff16('0xe'),_0x1c2f5a,_0x34038c['error'][_0xff16('0x14')]);return _0x36690b(_0x34038c[_0xff16('0x13')][_0xff16('0x14')]);}else{logger[_0xff16('0xd')](_0xff16('0xe'),_0x1c2f5a,'request\x20sent');_0x36690b(_0x34038c['result'][_0xff16('0x14')]);}})[_0xff16('0x15')](function(_0x19202d){logger[_0xff16('0x13')](_0xff16('0xe'),_0x1c2f5a,_0x19202d);_0xdf0eb3(_0x19202d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index eeba3d1..c5a1b82 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 _0x5426=['show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated'];(function(_0x4ffc80,_0x231d19){var _0x28dc72=function(_0x181da1){while(--_0x181da1){_0x4ffc80['push'](_0x4ffc80['shift']());}};_0x28dc72(++_0x231d19);}(_0x5426,0x1ea));var _0x6542=function(_0x3001c9,_0x52ed66){_0x3001c9=_0x3001c9-0x0;var _0xce9a5f=_0x5426[_0x3001c9];return _0xce9a5f;};'use strict';var multer=require(_0x6542('0x0'));var util=require(_0x6542('0x1'));var path=require('path');var timeout=require(_0x6542('0x2'));var express=require('express');var router=express[_0x6542('0x3')]();var auth=require(_0x6542('0x4'));var interaction=require(_0x6542('0x5'));var config=require('../../config/environment');var controller=require('./intSugarcrmAccount.controller');router[_0x6542('0x6')]('/',auth['isAuthenticated'](),controller[_0x6542('0x7')]);router[_0x6542('0x6')](_0x6542('0x8'),auth[_0x6542('0x9')](),controller[_0x6542('0xa')]);router[_0x6542('0x6')](_0x6542('0xb'),auth[_0x6542('0x9')](),controller[_0x6542('0xc')]);router[_0x6542('0x6')]('/:id/fields',auth[_0x6542('0x9')](),controller[_0x6542('0xd')]);router[_0x6542('0xe')]('/',auth[_0x6542('0x9')](),controller[_0x6542('0xf')]);router[_0x6542('0xe')]('/:id/configurations',auth[_0x6542('0x9')](),controller[_0x6542('0x10')]);router[_0x6542('0x11')](_0x6542('0x8'),auth[_0x6542('0x9')](),controller['update']);router[_0x6542('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x6542('0x13')]);module['exports']=router; \ No newline at end of file +var _0xfe23=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','/:id','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index'];(function(_0x26a4ea,_0xa72fb8){var _0x1b669e=function(_0x4e8bba){while(--_0x4e8bba){_0x26a4ea['push'](_0x26a4ea['shift']());}};_0x1b669e(++_0xa72fb8);}(_0xfe23,0xa4));var _0x3fe2=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xfe23[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require(_0x3fe2('0x0'));var util=require(_0x3fe2('0x1'));var path=require(_0x3fe2('0x2'));var timeout=require('connect-timeout');var express=require(_0x3fe2('0x3'));var router=express[_0x3fe2('0x4')]();var auth=require(_0x3fe2('0x5'));var interaction=require(_0x3fe2('0x6'));var config=require(_0x3fe2('0x7'));var controller=require(_0x3fe2('0x8'));router[_0x3fe2('0x9')]('/',auth[_0x3fe2('0xa')](),controller[_0x3fe2('0xb')]);router[_0x3fe2('0x9')]('/:id',auth[_0x3fe2('0xa')](),controller[_0x3fe2('0xc')]);router[_0x3fe2('0x9')](_0x3fe2('0xd'),auth['isAuthenticated'](),controller[_0x3fe2('0xe')]);router[_0x3fe2('0x9')](_0x3fe2('0xf'),auth[_0x3fe2('0xa')](),controller[_0x3fe2('0x10')]);router[_0x3fe2('0x11')]('/',auth[_0x3fe2('0xa')](),controller['create']);router['post'](_0x3fe2('0xd'),auth['isAuthenticated'](),controller[_0x3fe2('0x12')]);router['put'](_0x3fe2('0x13'),auth[_0x3fe2('0xa')](),controller['update']);router[_0x3fe2('0x14')](_0x3fe2('0x13'),auth[_0x3fe2('0xa')](),controller[_0x3fe2('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index d34832a..64ae54c 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 _0x27c7=['exports','STRING','username','remoteUri','sequelize'];(function(_0x39e29f,_0x174863){var _0x41827b=function(_0x1e5141){while(--_0x1e5141){_0x39e29f['push'](_0x39e29f['shift']());}};_0x41827b(++_0x174863);}(_0x27c7,0x10d));var _0x727c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x27c7[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x727c('0x0'));module[_0x727c('0x1')]={'name':{'type':Sequelize[_0x727c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x727c('0x2')],'unique':_0x727c('0x3')},'password':{'type':Sequelize[_0x727c('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x727c('0x4')},'serverUrl':{'type':Sequelize[_0x727c('0x2')]}}; \ No newline at end of file +var _0x5590=['STRING','remoteUri','sequelize','exports'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x5590,0x11a));var _0x0559=function(_0x43d992,_0x12542a){_0x43d992=_0x43d992-0x0;var _0x43ae62=_0x5590[_0x43d992];return _0x43ae62;};'use strict';var Sequelize=require(_0x0559('0x0'));module[_0x0559('0x1')]={'name':{'type':Sequelize[_0x0559('0x2')]},'description':{'type':Sequelize[_0x0559('0x2')]},'username':{'type':Sequelize[_0x0559('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0559('0x2')],'unique':_0x0559('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 168057c..e8e633d 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 _0x0550=['remoteUri','slice','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','Password\x20Expired','format','get_module_fields','Calls','values','module_fields','remove','includes','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','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~!@#$%^&-_=+[{]}.','request','then','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','end','json','offset','limit','set','apply','reject','save','update','sendStatus','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','params','merge','create','body','find','destroy','getConfigurations','length','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_type','direction','username','password'];(function(_0x5f79b4,_0x1ab989){var _0x48d4c1=function(_0x7575fe){while(--_0x7575fe){_0x5f79b4['push'](_0x5f79b4['shift']());}};_0x48d4c1(++_0x1ab989);}(_0x0550,0x11f));var _0x0055=function(_0x3e186f,_0x2eb7be){_0x3e186f=_0x3e186f-0x0;var _0x3595bf=_0x0550[_0x3e186f];return _0x3595bf;};'use strict';var pdf=require(_0x0055('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0055('0x1'));var rp=require(_0x0055('0x2'));var moment=require('moment');var BPromise=require(_0x0055('0x3'));var Mustache=require(_0x0055('0x4'));var util=require(_0x0055('0x5'));var path=require(_0x0055('0x6'));var sox=require(_0x0055('0x7'));var csv=require(_0x0055('0x8'));var ejs=require(_0x0055('0x9'));var fs=require('fs');var _=require(_0x0055('0xa'));var squel=require('squel');var crypto=require(_0x0055('0xb'));var jsforce=require(_0x0055('0xc'));var deskjs=require(_0x0055('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0055('0xe'));var Papa=require('papaparse');var Redis=require(_0x0055('0xf'));var authService=require(_0x0055('0x10'));var qs=require(_0x0055('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0055('0x12'));var logger=require(_0x0055('0x13'))(_0x0055('0x14'));var utils=require(_0x0055('0x15'));var config=require('../../config/environment');var db=require(_0x0055('0x16'))['db'];var integrations=require(_0x0055('0x17'));var jayson=require(_0x0055('0x18'));var client=jayson['client'][_0x0055('0x19')]({'port':0x232a});function checkPasswordPattern(_0xd95fa3,_0x297592,_0x26113b){if(_0x26113b){var _0x3377d9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3377d9[_0x0055('0x1a')](_0x297592)){return _0xd95fa3;}else{throw new db[(_0x0055('0x1b'))][(_0x0055('0x1c'))](_0x0055('0x1d'));}}else{return _0xd95fa3;}}function respondWithRpcPromise(_0x125240,_0x4db18a,_0x415fdf,_0x100e16){return new BPromise(function(_0xd1dcc0,_0x725a31){var _0x1e8af1=_0x100e16||client;return _0x1e8af1[_0x0055('0x1e')](_0x125240,_0x415fdf)[_0x0055('0x1f')](function(_0x293b44){logger['info'](_0x0055('0x20'),_0x4db18a,'request\x20sent');logger[_0x0055('0x21')](_0x0055('0x22'),_0x4db18a,'request\x20sent',JSON[_0x0055('0x23')](_0x293b44));if(_0x293b44[_0x0055('0x24')]){if(_0x293b44[_0x0055('0x24')][_0x0055('0x25')]===0x1f4){logger['error'](_0x0055('0x20'),_0x4db18a,_0x293b44['error'][_0x0055('0x26')]);return _0x725a31(_0x293b44[_0x0055('0x24')][_0x0055('0x26')]);}logger[_0x0055('0x24')](_0x0055('0x20'),_0x4db18a,_0x293b44['error'][_0x0055('0x26')]);return _0xd1dcc0(_0x293b44[_0x0055('0x24')][_0x0055('0x26')]);}else{logger[_0x0055('0x27')](_0x0055('0x20'),_0x4db18a,'request\x20sent');_0xd1dcc0(_0x293b44['result'][_0x0055('0x26')]);}})[_0x0055('0x28')](function(_0x1a5540){logger[_0x0055('0x24')](_0x0055('0x20'),_0x4db18a,_0x1a5540);_0x725a31(_0x1a5540);});});}function respondWithStatusCode(_0x32c89e,_0xefb77b){_0xefb77b=_0xefb77b||0xcc;return function(_0x49f838){if(_0x49f838){return _0x32c89e['sendStatus'](_0xefb77b);}return _0x32c89e[_0x0055('0x29')](_0xefb77b)[_0x0055('0x2a')]();};}function respondWithResult(_0x5913ec,_0x3faab0){_0x3faab0=_0x3faab0||0xc8;return function(_0x5d8e44){if(_0x5d8e44){return _0x5913ec[_0x0055('0x29')](_0x3faab0)[_0x0055('0x2b')](_0x5d8e44);}};}function respondWithFilteredResult(_0x5030c4,_0x209277){return function(_0x135c9b){if(_0x135c9b){var _0x4637ec=_0x135c9b['count'],_0x194d57=_0x209277[_0x0055('0x2c')],_0x17c465=_0x209277['offset']+_0x209277[_0x0055('0x2d')],_0x4978c7;if(_0x17c465>=_0x4637ec){_0x17c465=_0x4637ec;_0x4978c7=0xc8;}else{_0x4978c7=0xce;}_0x5030c4[_0x0055('0x29')](_0x4978c7);return _0x5030c4[_0x0055('0x2e')]('Content-Range',_0x194d57+'-'+_0x17c465+'/'+_0x4637ec)[_0x0055('0x2b')](_0x135c9b);}return null;};}function patchUpdates(_0x3c3869){return function(_0x1436b8){try{jsonpatch[_0x0055('0x2f')](_0x1436b8,_0x3c3869,!![]);}catch(_0x477954){return BPromise[_0x0055('0x30')](_0x477954);}return _0x1436b8[_0x0055('0x31')]();};}function saveUpdates(_0xbbc6fe,_0x2ae0e4){return function(_0x1d2eee){if(_0x1d2eee){return _0x1d2eee[_0x0055('0x32')](_0xbbc6fe)[_0x0055('0x1f')](function(_0x56550c){return _0x56550c;});}return null;};}function removeEntity(_0x82a975,_0x4a7017){return function(_0x44b2a3){if(_0x44b2a3){return _0x44b2a3['destroy']()['then'](function(){_0x82a975['status'](0xcc)[_0x0055('0x2a')]();});}};}function handleEntityNotFound(_0x36a0b7,_0x468980){return function(_0x2ecad6){if(!_0x2ecad6){_0x36a0b7[_0x0055('0x33')](0x194);}return _0x2ecad6;};}function handleError(_0x5df552,_0x4ac4e7){_0x4ac4e7=_0x4ac4e7||0x1f4;return function(_0x54f931){logger['error'](_0x54f931[_0x0055('0x34')]);if(_0x54f931[_0x0055('0x35')]){delete _0x54f931[_0x0055('0x35')];}_0x5df552['status'](_0x4ac4e7)[_0x0055('0x36')](_0x54f931);};}exports[_0x0055('0x37')]=function(_0x4a4da8,_0x52024f){var _0x5d7984={},_0x355fc4={},_0x3f6aef={'count':0x0,'rows':[]};var _0x30a1de=_[_0x0055('0x38')](db[_0x0055('0x39')][_0x0055('0x3a')],function(_0x3a0875){return{'name':_0x3a0875[_0x0055('0x3b')],'type':_0x3a0875[_0x0055('0x3c')][_0x0055('0x3d')]};});_0x355fc4[_0x0055('0x3e')]=_['map'](_0x30a1de,_0x0055('0x35'));_0x355fc4['query']=_[_0x0055('0x3f')](_0x4a4da8[_0x0055('0x40')]);_0x355fc4[_0x0055('0x41')]=_[_0x0055('0x42')](_0x355fc4[_0x0055('0x3e')],_0x355fc4[_0x0055('0x40')]);_0x5d7984[_0x0055('0x43')]=_['intersection'](_0x355fc4[_0x0055('0x3e')],qs[_0x0055('0x44')](_0x4a4da8[_0x0055('0x40')][_0x0055('0x44')]));_0x5d7984['attributes']=_0x5d7984['attributes']['length']?_0x5d7984[_0x0055('0x43')]:_0x355fc4[_0x0055('0x3e')];if(!_0x4a4da8[_0x0055('0x40')][_0x0055('0x45')](_0x0055('0x46'))){_0x5d7984[_0x0055('0x2d')]=qs['limit'](_0x4a4da8[_0x0055('0x40')][_0x0055('0x2d')]);_0x5d7984[_0x0055('0x2c')]=qs[_0x0055('0x2c')](_0x4a4da8[_0x0055('0x40')]['offset']);}_0x5d7984[_0x0055('0x47')]=qs[_0x0055('0x48')](_0x4a4da8[_0x0055('0x40')][_0x0055('0x48')]);_0x5d7984['where']=qs[_0x0055('0x41')](_[_0x0055('0x49')](_0x4a4da8['query'],_0x355fc4[_0x0055('0x41')]),_0x30a1de);if(_0x4a4da8[_0x0055('0x40')]['filter']){_0x5d7984['where']=_['merge'](_0x5d7984[_0x0055('0x4a')],{'$or':_[_0x0055('0x38')](_0x30a1de,function(_0x192353){if(_0x192353[_0x0055('0x3c')]!==_0x0055('0x4b')){var _0x255b60={};_0x255b60[_0x192353[_0x0055('0x35')]]={'$like':'%'+_0x4a4da8[_0x0055('0x40')][_0x0055('0x4c')]+'%'};return _0x255b60;}})});}_0x5d7984=_['merge']({},_0x5d7984,_0x4a4da8[_0x0055('0x4d')]);var _0x3158c7={'where':_0x5d7984['where']};return db[_0x0055('0x39')][_0x0055('0x4e')](_0x3158c7)['then'](function(_0x111f0b){_0x3f6aef[_0x0055('0x4e')]=_0x111f0b;if(_0x4a4da8[_0x0055('0x40')][_0x0055('0x4f')]){_0x5d7984[_0x0055('0x50')]=[{'all':!![]}];}return db[_0x0055('0x39')][_0x0055('0x51')](_0x5d7984);})[_0x0055('0x1f')](function(_0x226775){_0x3f6aef[_0x0055('0x52')]=_0x226775;return _0x3f6aef;})[_0x0055('0x1f')](respondWithFilteredResult(_0x52024f,_0x5d7984))['catch'](handleError(_0x52024f,null));};exports['show']=function(_0x4eeccc,_0x44bbdd){var _0x556505={'raw':![],'where':{'id':_0x4eeccc[_0x0055('0x53')]['id']}},_0x5c3296={};_0x5c3296[_0x0055('0x3e')]=_[_0x0055('0x3f')](db[_0x0055('0x39')][_0x0055('0x3a')]);_0x5c3296[_0x0055('0x40')]=_[_0x0055('0x3f')](_0x4eeccc['query']);_0x5c3296[_0x0055('0x41')]=_[_0x0055('0x42')](_0x5c3296[_0x0055('0x3e')],_0x5c3296[_0x0055('0x40')]);_0x556505[_0x0055('0x43')]=_['intersection'](_0x5c3296[_0x0055('0x3e')],qs[_0x0055('0x44')](_0x4eeccc[_0x0055('0x40')][_0x0055('0x44')]));_0x556505[_0x0055('0x43')]=_0x556505[_0x0055('0x43')]['length']?_0x556505['attributes']:_0x5c3296[_0x0055('0x3e')];if(_0x4eeccc['query'][_0x0055('0x4f')]){_0x556505[_0x0055('0x50')]=[{'all':!![]}];}_0x556505=_[_0x0055('0x54')]({},_0x556505,_0x4eeccc[_0x0055('0x4d')]);return db['SugarcrmAccount']['find'](_0x556505)[_0x0055('0x1f')](handleEntityNotFound(_0x44bbdd,null))[_0x0055('0x1f')](respondWithResult(_0x44bbdd,null))['catch'](handleError(_0x44bbdd,null));};exports['create']=function(_0x5a2e0c,_0x2f3272){return db[_0x0055('0x39')][_0x0055('0x55')](_0x5a2e0c[_0x0055('0x56')],{})[_0x0055('0x1f')](respondWithResult(_0x2f3272,0xc9))[_0x0055('0x28')](handleError(_0x2f3272,null));};exports[_0x0055('0x32')]=function(_0x4c2237,_0x434360){if(_0x4c2237['body']['id']){delete _0x4c2237['body']['id'];}return db['SugarcrmAccount'][_0x0055('0x57')]({'where':{'id':_0x4c2237[_0x0055('0x53')]['id']}})[_0x0055('0x1f')](handleEntityNotFound(_0x434360,null))[_0x0055('0x1f')](saveUpdates(_0x4c2237[_0x0055('0x56')],null))[_0x0055('0x1f')](respondWithResult(_0x434360,null))[_0x0055('0x28')](handleError(_0x434360,null));};exports[_0x0055('0x58')]=function(_0x4a8b5b,_0x3a3498){return db[_0x0055('0x39')][_0x0055('0x57')]({'where':{'id':_0x4a8b5b['params']['id']}})[_0x0055('0x1f')](handleEntityNotFound(_0x3a3498,null))['then'](removeEntity(_0x3a3498,null))['catch'](handleError(_0x3a3498,null));};exports[_0x0055('0x59')]=function(_0x4abe1a,_0x2940bb,_0x5ad345){var _0x1e3938={};var _0x43d303={};var _0x459224;var _0x1c0fe7;return db[_0x0055('0x39')]['findOne']({'where':{'id':_0x4abe1a[_0x0055('0x53')]['id']}})[_0x0055('0x1f')](handleEntityNotFound(_0x2940bb,null))[_0x0055('0x1f')](function(_0x4a2e5d){if(_0x4a2e5d){_0x459224=_0x4a2e5d;_0x43d303[_0x0055('0x3e')]=_[_0x0055('0x3f')](db['SugarcrmConfiguration'][_0x0055('0x3a')]);_0x43d303[_0x0055('0x40')]=_[_0x0055('0x3f')](_0x4abe1a[_0x0055('0x40')]);_0x43d303[_0x0055('0x41')]=_[_0x0055('0x42')](_0x43d303[_0x0055('0x3e')],_0x43d303['query']);_0x1e3938[_0x0055('0x43')]=_[_0x0055('0x42')](_0x43d303[_0x0055('0x3e')],qs[_0x0055('0x44')](_0x4abe1a[_0x0055('0x40')]['fields']));_0x1e3938['attributes']=_0x1e3938['attributes'][_0x0055('0x5a')]?_0x1e3938[_0x0055('0x43')]:_0x43d303[_0x0055('0x3e')];_0x1e3938[_0x0055('0x47')]=qs[_0x0055('0x48')](_0x4abe1a[_0x0055('0x40')][_0x0055('0x48')]);_0x1e3938[_0x0055('0x4a')]=qs['filters'](_[_0x0055('0x49')](_0x4abe1a[_0x0055('0x40')],_0x43d303[_0x0055('0x41')]));if(_0x4abe1a[_0x0055('0x40')][_0x0055('0x4c')]){_0x1e3938[_0x0055('0x4a')]=_[_0x0055('0x54')](_0x1e3938[_0x0055('0x4a')],{'$or':_[_0x0055('0x38')](_0x1e3938[_0x0055('0x43')],function(_0x1d4446){var _0x4c18f1={};_0x4c18f1[_0x1d4446]={'$like':'%'+_0x4abe1a[_0x0055('0x40')][_0x0055('0x4c')]+'%'};return _0x4c18f1;})});}_0x1e3938=_[_0x0055('0x54')]({},_0x1e3938,_0x4abe1a[_0x0055('0x4d')]);return _0x459224[_0x0055('0x59')](_0x1e3938);}})['then'](function(_0x45659f){if(_0x45659f){_0x1c0fe7=_0x45659f[_0x0055('0x5a')];if(!_0x4abe1a[_0x0055('0x40')]['hasOwnProperty']('nolimit')){_0x1e3938[_0x0055('0x2d')]=qs[_0x0055('0x2d')](_0x4abe1a[_0x0055('0x40')]['limit']);_0x1e3938[_0x0055('0x2c')]=qs[_0x0055('0x2c')](_0x4abe1a[_0x0055('0x40')][_0x0055('0x2c')]);}return _0x459224[_0x0055('0x59')](_0x1e3938);}})[_0x0055('0x1f')](function(_0x1f1c0f){if(_0x1f1c0f){return _0x1f1c0f?{'count':_0x1c0fe7,'rows':_0x1f1c0f}:null;}})[_0x0055('0x1f')](respondWithResult(_0x2940bb,null))[_0x0055('0x28')](handleError(_0x2940bb,null));};exports[_0x0055('0x5b')]=function(_0x42cc4e,_0x4491d3,_0x498988){if(_0x42cc4e['body']['id']){delete _0x42cc4e[_0x0055('0x56')]['id'];}return db['SugarcrmAccount'][_0x0055('0x5c')]({'where':{'id':_0x42cc4e[_0x0055('0x53')]['id']}})[_0x0055('0x1f')](handleEntityNotFound(_0x4491d3,null))[_0x0055('0x1f')](function(_0x5ad309){if(_0x5ad309){_0x42cc4e[_0x0055('0x56')][_0x0055('0x5d')]=_0x5ad309['id'];_0x42cc4e[_0x0055('0x56')][_0x0055('0x5e')]=integrations[_0x0055('0x5f')](_0x42cc4e[_0x0055('0x56')][_0x0055('0x60')],_0x42cc4e[_0x0055('0x56')][_0x0055('0x3c')]);_0x42cc4e['body'][_0x0055('0x61')]=integrations[_0x0055('0x62')](_0x42cc4e[_0x0055('0x56')][_0x0055('0x60')],_0x42cc4e['body'][_0x0055('0x3c')]);return db[_0x0055('0x63')]['create'](_0x42cc4e[_0x0055('0x56')],{'include':[{'model':db[_0x0055('0x64')],'as':'Subjects'},{'model':db[_0x0055('0x64')],'as':_0x0055('0x61')}]});}return null;})[_0x0055('0x1f')](respondWithResult(_0x4491d3,null))[_0x0055('0x28')](handleError(_0x4491d3,null));};exports[_0x0055('0x65')]=function(_0x2f5b46,_0x16d637,_0xd2f7bc){var _0x1f583b='';var _0x4c3549=['id',_0x0055('0x35'),_0x0055('0x66'),_0x0055('0x67'),_0x0055('0x68'),_0x0055('0x69'),_0x0055('0x6a'),'duration_minutes',_0x0055('0x6b'),_0x0055('0x6c'),'parent_name',_0x0055('0x6d')];return db[_0x0055('0x39')][_0x0055('0x5c')]({'where':{'id':_0x2f5b46['params']['id']},'attributes':['id',_0x0055('0x6e'),_0x0055('0x6f'),_0x0055('0x70')]})[_0x0055('0x1f')](handleEntityNotFound(_0x16d637,null))['then'](function(_0x30423c){if(_0x30423c){_0x1f583b=_0x30423c[_0x0055('0x70')];var _0x54b817=_0x1f583b[_0x0055('0x71')](-0x1);if(_0x54b817==='/'){_0x1f583b=_0x1f583b['substring'](0x0,_0x1f583b[_0x0055('0x72')](_0x54b817));}return rp({'method':_0x0055('0x73'),'uri':util['format'](_0x0055('0x74'),_0x1f583b,_0x0055('0x75')),'json':!![],'form':{'method':_0x0055('0x76'),'input_type':_0x0055('0x77'),'response_type':_0x0055('0x77'),'rest_data':JSON[_0x0055('0x23')]({'user_auth':{'user_name':_0x30423c[_0x0055('0x6e')],'password':_0x30423c['password'],'encryption':_0x0055('0x78')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x17c213){if(_0x17c213&&_0x17c213['name']!=='Invalid\x20Login'&&_0x17c213[_0x0055('0x35')]!==_0x0055('0x79')){return rp({'method':_0x0055('0x73'),'uri':util[_0x0055('0x7a')](_0x0055('0x74'),_0x1f583b,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x0055('0x7b'),'input_type':'JSON','response_type':_0x0055('0x77'),'rest_data':JSON['stringify']({'session':_0x17c213['id'],'module_name':_0x0055('0x7c')})}})['then'](function(_0x1c2c93){if(_0x1c2c93){var _0x2e28ad=_[_0x0055('0x7d')](_0x1c2c93[_0x0055('0x7e')]);_[_0x0055('0x7f')](_0x2e28ad,function(_0x33f206){return _0x4c3549[_0x0055('0x80')](_0x33f206[_0x0055('0x35')]);});return{'count':_0x2e28ad[_0x0055('0x5a')],'rows':_[_0x0055('0x38')](_0x2e28ad,function(_0x2b1a09){return{'id':_0x2b1a09[_0x0055('0x35')],'name':_0x2b1a09[_0x0055('0x81')],'custom':_['endsWith'](_0x2b1a09[_0x0055('0x35')],'_c')?!![]:![],'options':_0x2b1a09[_0x0055('0x4d')]?_[_0x0055('0x38')](_[_0x0055('0x7d')](_0x2b1a09[_0x0055('0x4d')]),function(_0x5d2ca2){return{'name':_0x5d2ca2['value'],'value':_0x5d2ca2[_0x0055('0x35')]};}):[]};})};}})[_0x0055('0x1f')](respondWithResult(_0x16d637,null))[_0x0055('0x28')](function(_0x528dd0){var _0x12bf17=_0x2f5b46[_0x0055('0x40')]['test']?0x1f4:_0x528dd0[_0x0055('0x82')]||0x1f4;logger[_0x0055('0x24')](_0x0055('0x83'),_0x0055('0x65'),_0x12bf17,JSON[_0x0055('0x23')](_0x528dd0));delete _0x528dd0['name'];if(_0x12bf17===0x191){_0x12bf17=0x190;}_0x16d637[_0x0055('0x29')](_0x12bf17)[_0x0055('0x36')](_0x2f5b46[_0x0055('0x40')][_0x0055('0x1a')]?{'message':'Wrong\x20credentials','statusCode':_0x528dd0[_0x0055('0x82')]}:_0x528dd0);});}else{var _0x3d4595=0x1f4;_0x16d637['status'](_0x3d4595)[_0x0055('0x36')]({'message':_0x0055('0x84'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x0aa7=['sendStatus','stack','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','SugarcrmConfiguration','merge','hasOwnProperty','getConfigurations','addConfiguration','findOne','AccountId','channel','getDescriptions','SugarcrmField','Descriptions','created_by','description','date_start','duration_hours','duration_minutes','parent_type','direction','username','remoteUri','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','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~!@#$%^&-_=+[{]}.','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','status','json','count','offset','apply','reject','save','update','end'];(function(_0x2dbc92,_0x166de6){var _0x5dc511=function(_0x674a7){while(--_0x674a7){_0x2dbc92['push'](_0x2dbc92['shift']());}};_0x5dc511(++_0x166de6);}(_0x0aa7,0x150));var _0x70aa=function(_0x539fb2,_0x5b6718){_0x539fb2=_0x539fb2-0x0;var _0x4d583d=_0x0aa7[_0x539fb2];return _0x4d583d;};'use strict';var pdf=require(_0x70aa('0x0'));var emlformat=require(_0x70aa('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x70aa('0x2'));var rp=require(_0x70aa('0x3'));var moment=require(_0x70aa('0x4'));var BPromise=require(_0x70aa('0x5'));var Mustache=require(_0x70aa('0x6'));var util=require(_0x70aa('0x7'));var path=require(_0x70aa('0x8'));var sox=require(_0x70aa('0x9'));var csv=require(_0x70aa('0xa'));var ejs=require(_0x70aa('0xb'));var fs=require('fs');var _=require(_0x70aa('0xc'));var squel=require(_0x70aa('0xd'));var crypto=require(_0x70aa('0xe'));var jsforce=require(_0x70aa('0xf'));var deskjs=require(_0x70aa('0x10'));var toCsv=require('to-csv');var querystring=require(_0x70aa('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x70aa('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70aa('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x70aa('0x14'));var config=require(_0x70aa('0x15'));var db=require(_0x70aa('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x70aa('0x17'));var client=jayson[_0x70aa('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x15fd4d,_0xf81fe4,_0x1e5ef5){if(_0x1e5ef5){var _0x364b95=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x364b95['test'](_0xf81fe4)){return _0x15fd4d;}else{throw new db[(_0x70aa('0x19'))][(_0x70aa('0x1a'))](_0x70aa('0x1b'));}}else{return _0x15fd4d;}}function respondWithRpcPromise(_0x78a779,_0x3ea076,_0x20fcb7,_0xb203b3){return new BPromise(function(_0x26bd7e,_0x478367){var _0x35def5=_0xb203b3||client;return _0x35def5[_0x70aa('0x1c')](_0x78a779,_0x20fcb7)[_0x70aa('0x1d')](function(_0x1baae0){logger['info'](_0x70aa('0x1e'),_0x3ea076,_0x70aa('0x1f'));logger['debug'](_0x70aa('0x20'),_0x3ea076,'request\x20sent',JSON['stringify'](_0x1baae0));if(_0x1baae0[_0x70aa('0x21')]){if(_0x1baae0[_0x70aa('0x21')][_0x70aa('0x22')]===0x1f4){logger[_0x70aa('0x21')](_0x70aa('0x1e'),_0x3ea076,_0x1baae0[_0x70aa('0x21')][_0x70aa('0x23')]);return _0x478367(_0x1baae0['error']['message']);}logger[_0x70aa('0x21')](_0x70aa('0x1e'),_0x3ea076,_0x1baae0['error'][_0x70aa('0x23')]);return _0x26bd7e(_0x1baae0['error'][_0x70aa('0x23')]);}else{logger['info'](_0x70aa('0x1e'),_0x3ea076,_0x70aa('0x1f'));_0x26bd7e(_0x1baae0['result'][_0x70aa('0x23')]);}})['catch'](function(_0x2d7976){logger[_0x70aa('0x21')](_0x70aa('0x1e'),_0x3ea076,_0x2d7976);_0x478367(_0x2d7976);});});}function respondWithStatusCode(_0xe39700,_0x527aaa){_0x527aaa=_0x527aaa||0xcc;return function(_0x304663){if(_0x304663){return _0xe39700['sendStatus'](_0x527aaa);}return _0xe39700[_0x70aa('0x24')](_0x527aaa)['end']();};}function respondWithResult(_0x3979d1,_0x1345f6){_0x1345f6=_0x1345f6||0xc8;return function(_0x438baa){if(_0x438baa){return _0x3979d1[_0x70aa('0x24')](_0x1345f6)[_0x70aa('0x25')](_0x438baa);}};}function respondWithFilteredResult(_0xba8282,_0x4b6565){return function(_0x5f5a75){if(_0x5f5a75){var _0x5061ee=_0x5f5a75[_0x70aa('0x26')],_0x536fe9=_0x4b6565[_0x70aa('0x27')],_0x4116b5=_0x4b6565[_0x70aa('0x27')]+_0x4b6565['limit'],_0x1eca83;if(_0x4116b5>=_0x5061ee){_0x4116b5=_0x5061ee;_0x1eca83=0xc8;}else{_0x1eca83=0xce;}_0xba8282[_0x70aa('0x24')](_0x1eca83);return _0xba8282['set']('Content-Range',_0x536fe9+'-'+_0x4116b5+'/'+_0x5061ee)['json'](_0x5f5a75);}return null;};}function patchUpdates(_0x5d863e){return function(_0x26496f){try{jsonpatch[_0x70aa('0x28')](_0x26496f,_0x5d863e,!![]);}catch(_0xf5b634){return BPromise[_0x70aa('0x29')](_0xf5b634);}return _0x26496f[_0x70aa('0x2a')]();};}function saveUpdates(_0x61fa94,_0x5e7194){return function(_0x52497a){if(_0x52497a){return _0x52497a[_0x70aa('0x2b')](_0x61fa94)['then'](function(_0x545d4d){return _0x545d4d;});}return null;};}function removeEntity(_0x167948,_0x103130){return function(_0x5cf954){if(_0x5cf954){return _0x5cf954['destroy']()[_0x70aa('0x1d')](function(){_0x167948[_0x70aa('0x24')](0xcc)[_0x70aa('0x2c')]();});}};}function handleEntityNotFound(_0x4e5fb4,_0x38bf9d){return function(_0x2888b1){if(!_0x2888b1){_0x4e5fb4[_0x70aa('0x2d')](0x194);}return _0x2888b1;};}function handleError(_0x1d3233,_0x274f49){_0x274f49=_0x274f49||0x1f4;return function(_0x2e79d5){logger['error'](_0x2e79d5[_0x70aa('0x2e')]);if(_0x2e79d5[_0x70aa('0x2f')]){delete _0x2e79d5[_0x70aa('0x2f')];}_0x1d3233[_0x70aa('0x24')](_0x274f49)[_0x70aa('0x30')](_0x2e79d5);};}exports[_0x70aa('0x31')]=function(_0x29bcc6,_0x2949a0){var _0x295771={},_0x4d728d={},_0x35f138={'count':0x0,'rows':[]};var _0x1089c7=_[_0x70aa('0x32')](db[_0x70aa('0x33')][_0x70aa('0x34')],function(_0x3a0015){return{'name':_0x3a0015['fieldName'],'type':_0x3a0015[_0x70aa('0x35')][_0x70aa('0x36')]};});_0x4d728d['model']=_[_0x70aa('0x32')](_0x1089c7,_0x70aa('0x2f'));_0x4d728d[_0x70aa('0x37')]=_[_0x70aa('0x38')](_0x29bcc6['query']);_0x4d728d[_0x70aa('0x39')]=_[_0x70aa('0x3a')](_0x4d728d[_0x70aa('0x3b')],_0x4d728d['query']);_0x295771[_0x70aa('0x3c')]=_['intersection'](_0x4d728d[_0x70aa('0x3b')],qs[_0x70aa('0x3d')](_0x29bcc6[_0x70aa('0x37')]['fields']));_0x295771[_0x70aa('0x3c')]=_0x295771[_0x70aa('0x3c')][_0x70aa('0x3e')]?_0x295771['attributes']:_0x4d728d[_0x70aa('0x3b')];if(!_0x29bcc6[_0x70aa('0x37')]['hasOwnProperty'](_0x70aa('0x3f'))){_0x295771[_0x70aa('0x40')]=qs[_0x70aa('0x40')](_0x29bcc6['query'][_0x70aa('0x40')]);_0x295771[_0x70aa('0x27')]=qs[_0x70aa('0x27')](_0x29bcc6[_0x70aa('0x37')]['offset']);}_0x295771[_0x70aa('0x41')]=qs[_0x70aa('0x42')](_0x29bcc6[_0x70aa('0x37')][_0x70aa('0x42')]);_0x295771[_0x70aa('0x43')]=qs[_0x70aa('0x39')](_[_0x70aa('0x44')](_0x29bcc6[_0x70aa('0x37')],_0x4d728d[_0x70aa('0x39')]),_0x1089c7);if(_0x29bcc6[_0x70aa('0x37')][_0x70aa('0x45')]){_0x295771[_0x70aa('0x43')]=_['merge'](_0x295771[_0x70aa('0x43')],{'$or':_[_0x70aa('0x32')](_0x1089c7,function(_0x2af36e){if(_0x2af36e[_0x70aa('0x35')]!=='VIRTUAL'){var _0x51a653={};_0x51a653[_0x2af36e['name']]={'$like':'%'+_0x29bcc6[_0x70aa('0x37')][_0x70aa('0x45')]+'%'};return _0x51a653;}})});}_0x295771=_['merge']({},_0x295771,_0x29bcc6[_0x70aa('0x46')]);var _0x213d0c={'where':_0x295771[_0x70aa('0x43')]};return db['SugarcrmAccount']['count'](_0x213d0c)[_0x70aa('0x1d')](function(_0x4aec27){_0x35f138[_0x70aa('0x26')]=_0x4aec27;if(_0x29bcc6['query']['includeAll']){_0x295771[_0x70aa('0x47')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x70aa('0x48')](_0x295771);})[_0x70aa('0x1d')](function(_0x11e23b){_0x35f138[_0x70aa('0x49')]=_0x11e23b;return _0x35f138;})[_0x70aa('0x1d')](respondWithFilteredResult(_0x2949a0,_0x295771))[_0x70aa('0x4a')](handleError(_0x2949a0,null));};exports[_0x70aa('0x4b')]=function(_0x5d760b,_0x2b3a79){var _0x392a89={'raw':![],'where':{'id':_0x5d760b[_0x70aa('0x4c')]['id']}},_0x160eb1={};_0x160eb1[_0x70aa('0x3b')]=_[_0x70aa('0x38')](db[_0x70aa('0x33')][_0x70aa('0x34')]);_0x160eb1[_0x70aa('0x37')]=_[_0x70aa('0x38')](_0x5d760b[_0x70aa('0x37')]);_0x160eb1['filters']=_['intersection'](_0x160eb1[_0x70aa('0x3b')],_0x160eb1[_0x70aa('0x37')]);_0x392a89[_0x70aa('0x3c')]=_[_0x70aa('0x3a')](_0x160eb1['model'],qs['fields'](_0x5d760b[_0x70aa('0x37')][_0x70aa('0x3d')]));_0x392a89[_0x70aa('0x3c')]=_0x392a89[_0x70aa('0x3c')][_0x70aa('0x3e')]?_0x392a89['attributes']:_0x160eb1[_0x70aa('0x3b')];if(_0x5d760b[_0x70aa('0x37')][_0x70aa('0x4d')]){_0x392a89[_0x70aa('0x47')]=[{'all':!![]}];}_0x392a89=_['merge']({},_0x392a89,_0x5d760b[_0x70aa('0x46')]);return db[_0x70aa('0x33')][_0x70aa('0x4e')](_0x392a89)[_0x70aa('0x1d')](handleEntityNotFound(_0x2b3a79,null))[_0x70aa('0x1d')](respondWithResult(_0x2b3a79,null))['catch'](handleError(_0x2b3a79,null));};exports[_0x70aa('0x4f')]=function(_0x3899aa,_0x7e5283){return db[_0x70aa('0x33')][_0x70aa('0x4f')](_0x3899aa[_0x70aa('0x50')],{})[_0x70aa('0x1d')](respondWithResult(_0x7e5283,0xc9))['catch'](handleError(_0x7e5283,null));};exports[_0x70aa('0x2b')]=function(_0x5e80e4,_0x1b829d){if(_0x5e80e4['body']['id']){delete _0x5e80e4[_0x70aa('0x50')]['id'];}return db['SugarcrmAccount'][_0x70aa('0x4e')]({'where':{'id':_0x5e80e4[_0x70aa('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b829d,null))[_0x70aa('0x1d')](saveUpdates(_0x5e80e4[_0x70aa('0x50')],null))[_0x70aa('0x1d')](respondWithResult(_0x1b829d,null))[_0x70aa('0x4a')](handleError(_0x1b829d,null));};exports[_0x70aa('0x51')]=function(_0x128080,_0x55e509){return db[_0x70aa('0x33')][_0x70aa('0x4e')]({'where':{'id':_0x128080[_0x70aa('0x4c')]['id']}})[_0x70aa('0x1d')](handleEntityNotFound(_0x55e509,null))[_0x70aa('0x1d')](removeEntity(_0x55e509,null))[_0x70aa('0x4a')](handleError(_0x55e509,null));};exports['getConfigurations']=function(_0x12aa0f,_0x175be9,_0x190314){var _0x188266={};var _0x15bea7={};var _0x3c12c9;var _0x3e6489;return db[_0x70aa('0x33')]['findOne']({'where':{'id':_0x12aa0f['params']['id']}})[_0x70aa('0x1d')](handleEntityNotFound(_0x175be9,null))[_0x70aa('0x1d')](function(_0x2fc9c3){if(_0x2fc9c3){_0x3c12c9=_0x2fc9c3;_0x15bea7[_0x70aa('0x3b')]=_['keys'](db[_0x70aa('0x52')]['rawAttributes']);_0x15bea7[_0x70aa('0x37')]=_[_0x70aa('0x38')](_0x12aa0f['query']);_0x15bea7[_0x70aa('0x39')]=_[_0x70aa('0x3a')](_0x15bea7[_0x70aa('0x3b')],_0x15bea7[_0x70aa('0x37')]);_0x188266['attributes']=_[_0x70aa('0x3a')](_0x15bea7[_0x70aa('0x3b')],qs[_0x70aa('0x3d')](_0x12aa0f[_0x70aa('0x37')][_0x70aa('0x3d')]));_0x188266[_0x70aa('0x3c')]=_0x188266[_0x70aa('0x3c')][_0x70aa('0x3e')]?_0x188266[_0x70aa('0x3c')]:_0x15bea7[_0x70aa('0x3b')];_0x188266[_0x70aa('0x41')]=qs[_0x70aa('0x42')](_0x12aa0f[_0x70aa('0x37')][_0x70aa('0x42')]);_0x188266[_0x70aa('0x43')]=qs[_0x70aa('0x39')](_[_0x70aa('0x44')](_0x12aa0f[_0x70aa('0x37')],_0x15bea7[_0x70aa('0x39')]));if(_0x12aa0f[_0x70aa('0x37')]['filter']){_0x188266['where']=_['merge'](_0x188266[_0x70aa('0x43')],{'$or':_[_0x70aa('0x32')](_0x188266[_0x70aa('0x3c')],function(_0x4fae84){var _0x3c6091={};_0x3c6091[_0x4fae84]={'$like':'%'+_0x12aa0f['query'][_0x70aa('0x45')]+'%'};return _0x3c6091;})});}_0x188266=_[_0x70aa('0x53')]({},_0x188266,_0x12aa0f[_0x70aa('0x46')]);return _0x3c12c9['getConfigurations'](_0x188266);}})['then'](function(_0x5006e7){if(_0x5006e7){_0x3e6489=_0x5006e7['length'];if(!_0x12aa0f['query'][_0x70aa('0x54')](_0x70aa('0x3f'))){_0x188266[_0x70aa('0x40')]=qs[_0x70aa('0x40')](_0x12aa0f[_0x70aa('0x37')][_0x70aa('0x40')]);_0x188266[_0x70aa('0x27')]=qs['offset'](_0x12aa0f[_0x70aa('0x37')]['offset']);}return _0x3c12c9[_0x70aa('0x55')](_0x188266);}})[_0x70aa('0x1d')](function(_0xb57a90){if(_0xb57a90){return _0xb57a90?{'count':_0x3e6489,'rows':_0xb57a90}:null;}})[_0x70aa('0x1d')](respondWithResult(_0x175be9,null))['catch'](handleError(_0x175be9,null));};exports[_0x70aa('0x56')]=function(_0x142deb,_0x2d6104,_0x3ca50f){if(_0x142deb['body']['id']){delete _0x142deb[_0x70aa('0x50')]['id'];}return db[_0x70aa('0x33')][_0x70aa('0x57')]({'where':{'id':_0x142deb[_0x70aa('0x4c')]['id']}})[_0x70aa('0x1d')](handleEntityNotFound(_0x2d6104,null))[_0x70aa('0x1d')](function(_0x15dd6c){if(_0x15dd6c){_0x142deb['body'][_0x70aa('0x58')]=_0x15dd6c['id'];_0x142deb['body']['Subjects']=integrations['getSubjects'](_0x142deb[_0x70aa('0x50')][_0x70aa('0x59')],_0x142deb[_0x70aa('0x50')][_0x70aa('0x35')]);_0x142deb['body']['Descriptions']=integrations[_0x70aa('0x5a')](_0x142deb['body']['channel'],_0x142deb[_0x70aa('0x50')][_0x70aa('0x35')]);return db[_0x70aa('0x52')][_0x70aa('0x4f')](_0x142deb[_0x70aa('0x50')],{'include':[{'model':db[_0x70aa('0x5b')],'as':'Subjects'},{'model':db[_0x70aa('0x5b')],'as':_0x70aa('0x5c')}]});}return null;})[_0x70aa('0x1d')](respondWithResult(_0x2d6104,null))[_0x70aa('0x4a')](handleError(_0x2d6104,null));};exports['getFields']=function(_0x379db6,_0x3e1632,_0x59eee){var _0xd1bb89='';var _0x31e038=['id','name','assigned_user_id',_0x70aa('0x5d'),_0x70aa('0x5e'),_0x70aa('0x5f'),_0x70aa('0x60'),_0x70aa('0x61'),'parent_id',_0x70aa('0x62'),'parent_name',_0x70aa('0x63')];return db[_0x70aa('0x33')][_0x70aa('0x57')]({'where':{'id':_0x379db6['params']['id']},'attributes':['id',_0x70aa('0x64'),'password',_0x70aa('0x65')]})[_0x70aa('0x1d')](handleEntityNotFound(_0x3e1632,null))[_0x70aa('0x1d')](function(_0x2807bc){if(_0x2807bc){_0xd1bb89=_0x2807bc['remoteUri'];var _0x560e0a=_0xd1bb89['slice'](-0x1);if(_0x560e0a==='/'){_0xd1bb89=_0xd1bb89[_0x70aa('0x66')](0x0,_0xd1bb89[_0x70aa('0x67')](_0x560e0a));}return rp({'method':_0x70aa('0x68'),'uri':util['format'](_0x70aa('0x69'),_0xd1bb89,_0x70aa('0x6a')),'json':!![],'form':{'method':_0x70aa('0x6b'),'input_type':_0x70aa('0x6c'),'response_type':_0x70aa('0x6c'),'rest_data':JSON[_0x70aa('0x6d')]({'user_auth':{'user_name':_0x2807bc[_0x70aa('0x64')],'password':_0x2807bc['password'],'encryption':_0x70aa('0x6e')},'application':_0x70aa('0x6f')})}});}})[_0x70aa('0x1d')](function(_0x1d5504){if(_0x1d5504&&_0x1d5504[_0x70aa('0x2f')]!==_0x70aa('0x70')&&_0x1d5504['name']!==_0x70aa('0x71')){return rp({'method':_0x70aa('0x68'),'uri':util['format']('%s%s',_0xd1bb89,_0x70aa('0x6a')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x70aa('0x6c'),'rest_data':JSON['stringify']({'session':_0x1d5504['id'],'module_name':_0x70aa('0x72')})}})[_0x70aa('0x1d')](function(_0x13dc90){if(_0x13dc90){var _0x505020=_[_0x70aa('0x73')](_0x13dc90[_0x70aa('0x74')]);_[_0x70aa('0x75')](_0x505020,function(_0x5971d1){return _0x31e038[_0x70aa('0x76')](_0x5971d1[_0x70aa('0x2f')]);});return{'count':_0x505020['length'],'rows':_[_0x70aa('0x32')](_0x505020,function(_0x330436){return{'id':_0x330436['name'],'name':_0x330436[_0x70aa('0x77')],'custom':_[_0x70aa('0x78')](_0x330436[_0x70aa('0x2f')],'_c')?!![]:![],'options':_0x330436[_0x70aa('0x46')]?_['map'](_[_0x70aa('0x73')](_0x330436[_0x70aa('0x46')]),function(_0x109775){return{'name':_0x109775[_0x70aa('0x79')],'value':_0x109775[_0x70aa('0x2f')]};}):[]};})};}})['then'](respondWithResult(_0x3e1632,null))[_0x70aa('0x4a')](function(_0x197937){var _0x4c20bd=_0x379db6[_0x70aa('0x37')][_0x70aa('0x7a')]?0x1f4:_0x197937[_0x70aa('0x7b')]||0x1f4;logger[_0x70aa('0x21')](_0x70aa('0x7c'),_0x70aa('0x7d'),_0x4c20bd,JSON[_0x70aa('0x6d')](_0x197937));delete _0x197937['name'];if(_0x4c20bd===0x191){_0x4c20bd=0x190;}_0x3e1632[_0x70aa('0x24')](_0x4c20bd)[_0x70aa('0x30')](_0x379db6[_0x70aa('0x37')][_0x70aa('0x7a')]?{'message':_0x70aa('0x7e'),'statusCode':_0x197937[_0x70aa('0x7b')]}:_0x197937);});}else{var _0x4a74ac=0x1f4;_0x3e1632[_0x70aa('0x24')](_0x4a74ac)[_0x70aa('0x30')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 5629dd0..9c93723 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 _0x7ce4=['SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x32e61e,_0x152fdb){var _0x2ec9c4=function(_0x20de32){while(--_0x20de32){_0x32e61e['push'](_0x32e61e['shift']());}};_0x2ec9c4(++_0x152fdb);}(_0x7ce4,0x182));var _0x47ce=function(_0x1ab2fd,_0x1a4c3b){_0x1ab2fd=_0x1ab2fd-0x0;var _0x1e6564=_0x7ce4[_0x1ab2fd];return _0x1e6564;};'use strict';var _=require('lodash');var util=require(_0x47ce('0x0'));var logger=require(_0x47ce('0x1'))('api');var moment=require('moment');var BPromise=require(_0x47ce('0x2'));var rp=require(_0x47ce('0x3'));var fs=require('fs');var path=require(_0x47ce('0x4'));var rimraf=require('rimraf');var config=require(_0x47ce('0x5'));var attributes=require(_0x47ce('0x6'));var integrations=require(_0x47ce('0x7'));module[_0x47ce('0x8')]=function(_0x251635,_0x34f935){return _0x251635[_0x47ce('0x9')](_0x47ce('0xa'),attributes,{'tableName':_0x47ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x899e=['../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x35578c,_0xec2307){var _0x560a92=function(_0x3563c1){while(--_0x3563c1){_0x35578c['push'](_0x35578c['shift']());}};_0x560a92(++_0xec2307);}(_0x899e,0x1cc));var _0xe899=function(_0x2fcfeb,_0x3e1913){_0x2fcfeb=_0x2fcfeb-0x0;var _0x5a3387=_0x899e[_0x2fcfeb];return _0x5a3387;};'use strict';var _=require(_0xe899('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe899('0x1'));var moment=require(_0xe899('0x2'));var BPromise=require('bluebird');var rp=require(_0xe899('0x3'));var fs=require('fs');var path=require(_0xe899('0x4'));var rimraf=require(_0xe899('0x5'));var config=require(_0xe899('0x6'));var attributes=require(_0xe899('0x7'));var integrations=require(_0xe899('0x8'));module[_0xe899('0x9')]=function(_0x46eebd,_0x4e880d){return _0x46eebd[_0xe899('0xa')](_0xe899('0xb'),attributes,{'tableName':_0xe899('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 0593e23..7deb9c2 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 _0x8dc0=['debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','include','map','model','ShowSugarcrmAccount','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','SugarcrmAccount,\x20%s,\x20%s'];(function(_0x231b20,_0x52cb69){var _0x2e0285=function(_0x3c66bb){while(--_0x3c66bb){_0x231b20['push'](_0x231b20['shift']());}};_0x2e0285(++_0x52cb69);}(_0x8dc0,0x1b4));var _0x08dc=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x8dc0[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x08dc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x08dc('0x1'));var rs=require(_0x08dc('0x2'));var fs=require('fs');var Redis=require(_0x08dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x08dc('0x4'));var logger=require(_0x08dc('0x5'))(_0x08dc('0x6'));var config=require(_0x08dc('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x08dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dbf16,_0x3c1078,_0x4037cc){return new BPromise(function(_0x52683c,_0xea4bfa){return client['request'](_0x3dbf16,_0x4037cc)[_0x08dc('0x9')](function(_0x1f3b75){logger[_0x08dc('0xa')](_0x08dc('0xb'),_0x3c1078,'request\x20sent');logger[_0x08dc('0xc')](_0x08dc('0xd'),_0x3c1078,'request\x20sent',JSON[_0x08dc('0xe')](_0x1f3b75));if(_0x1f3b75[_0x08dc('0xf')]){if(_0x1f3b75[_0x08dc('0xf')][_0x08dc('0x10')]===0x1f4){logger[_0x08dc('0xf')](_0x08dc('0xb'),_0x3c1078,_0x1f3b75[_0x08dc('0xf')][_0x08dc('0x11')]);return _0xea4bfa(_0x1f3b75['error']['message']);}logger[_0x08dc('0xf')](_0x08dc('0xb'),_0x3c1078,_0x1f3b75[_0x08dc('0xf')]['message']);return _0x52683c(_0x1f3b75['error']['message']);}else{logger[_0x08dc('0xa')](_0x08dc('0xb'),_0x3c1078,_0x08dc('0x12'));_0x52683c(_0x1f3b75[_0x08dc('0x13')][_0x08dc('0x11')]);}})[_0x08dc('0x14')](function(_0x258130){logger['error'](_0x08dc('0xb'),_0x3c1078,_0x258130);_0xea4bfa(_0x258130);});});}exports[_0x08dc('0x15')]=function(_0x52ec5a){var _0x3d87eb=this;return new Promise(function(_0x301779,_0x149cb5){return db[_0x08dc('0x16')][_0x08dc('0x17')]({'raw':_0x52ec5a[_0x08dc('0x18')]?_0x52ec5a[_0x08dc('0x18')][_0x08dc('0x19')]===undefined?!![]:![]:!![],'where':_0x52ec5a[_0x08dc('0x18')]?_0x52ec5a['options']['where']||null:null,'attributes':_0x52ec5a[_0x08dc('0x18')]?_0x52ec5a[_0x08dc('0x18')][_0x08dc('0x1a')]||null:null,'limit':_0x52ec5a['options']?_0x52ec5a[_0x08dc('0x18')][_0x08dc('0x1b')]||null:null,'include':_0x52ec5a[_0x08dc('0x18')]?_0x52ec5a[_0x08dc('0x18')][_0x08dc('0x1c')]?_['map'](_0x52ec5a[_0x08dc('0x18')][_0x08dc('0x1c')],function(_0x575b05){return{'model':db[_0x575b05['model']],'as':_0x575b05['as'],'attributes':_0x575b05['attributes'],'include':_0x575b05['include']?_[_0x08dc('0x1d')](_0x575b05[_0x08dc('0x1c')],function(_0x358f82){return{'model':db[_0x358f82[_0x08dc('0x1e')]],'as':_0x358f82['as'],'attributes':_0x358f82[_0x08dc('0x1a')],'include':_0x358f82[_0x08dc('0x1c')]?_[_0x08dc('0x1d')](_0x358f82[_0x08dc('0x1c')],function(_0x9d911c){return{'model':db[_0x9d911c['model']],'as':_0x9d911c['as'],'attributes':_0x9d911c[_0x08dc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x08dc('0x9')](function(_0x5d53c0){logger[_0x08dc('0xa')](_0x08dc('0x15'),_0x52ec5a);logger['debug'](_0x08dc('0x15'),_0x52ec5a,JSON[_0x08dc('0xe')](_0x5d53c0));_0x301779(_0x5d53c0);})['catch'](function(_0x515ea3){logger[_0x08dc('0xf')](_0x08dc('0x15'),_0x515ea3[_0x08dc('0x11')],_0x52ec5a);_0x149cb5(_0x3d87eb[_0x08dc('0xf')](0x1f4,_0x515ea3[_0x08dc('0x11')]));});});};exports['ShowSugarcrmAccount']=function(_0x3daa8f){var _0x19a891=this;return new Promise(function(_0x85edbf,_0x48f0a0){return db[_0x08dc('0x16')]['find']({'raw':_0x3daa8f[_0x08dc('0x18')]?_0x3daa8f[_0x08dc('0x18')][_0x08dc('0x19')]===undefined?!![]:![]:!![],'where':_0x3daa8f[_0x08dc('0x18')]?_0x3daa8f[_0x08dc('0x18')]['where']||null:null,'attributes':_0x3daa8f[_0x08dc('0x18')]?_0x3daa8f[_0x08dc('0x18')]['attributes']||null:null,'include':_0x3daa8f[_0x08dc('0x18')]?_0x3daa8f[_0x08dc('0x18')][_0x08dc('0x1c')]?_[_0x08dc('0x1d')](_0x3daa8f[_0x08dc('0x18')][_0x08dc('0x1c')],function(_0x30fe4c){return{'model':db[_0x30fe4c[_0x08dc('0x1e')]],'as':_0x30fe4c['as'],'attributes':_0x30fe4c[_0x08dc('0x1a')],'include':_0x30fe4c[_0x08dc('0x1c')]?_[_0x08dc('0x1d')](_0x30fe4c['include'],function(_0x5c0fc4){return{'model':db[_0x5c0fc4[_0x08dc('0x1e')]],'as':_0x5c0fc4['as'],'attributes':_0x5c0fc4['attributes'],'include':_0x5c0fc4[_0x08dc('0x1c')]?_[_0x08dc('0x1d')](_0x5c0fc4['include'],function(_0x33f474){return{'model':db[_0x33f474[_0x08dc('0x1e')]],'as':_0x33f474['as'],'attributes':_0x33f474[_0x08dc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x08dc('0x9')](function(_0x17c624){logger[_0x08dc('0xa')](_0x08dc('0x1f'),_0x3daa8f);logger[_0x08dc('0xc')]('ShowSugarcrmAccount',_0x3daa8f,JSON[_0x08dc('0xe')](_0x17c624));_0x85edbf(_0x17c624);})[_0x08dc('0x14')](function(_0x22208b){logger['error']('ShowSugarcrmAccount',_0x22208b[_0x08dc('0x11')],_0x3daa8f);_0x48f0a0(_0x19a891[_0x08dc('0xf')](0x1f4,_0x22208b[_0x08dc('0x11')]));});});}; \ No newline at end of file +var _0x9888=['moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','message','SugarcrmAccount,\x20%s,\x20%s','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','include','model','then','stringify','ShowSugarcrmAccount','SugarcrmAccount','find','map','util'];(function(_0x2ace72,_0x814809){var _0x33d102=function(_0x505fd1){while(--_0x505fd1){_0x2ace72['push'](_0x2ace72['shift']());}};_0x33d102(++_0x814809);}(_0x9888,0x87));var _0x8988=function(_0x584695,_0xd1004f){_0x584695=_0x584695-0x0;var _0x2c202c=_0x9888[_0x584695];return _0x2c202c;};'use strict';var _=require('lodash');var util=require(_0x8988('0x0'));var moment=require(_0x8988('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8988('0x2'));var db=require(_0x8988('0x3'))['db'];var utils=require(_0x8988('0x4'));var logger=require('../../config/logger')(_0x8988('0x5'));var config=require(_0x8988('0x6'));var jayson=require(_0x8988('0x7'));var client=jayson[_0x8988('0x8')][_0x8988('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x512599,_0xc3eb0e,_0xeb97d0){return new BPromise(function(_0x50a9b8,_0xd06be4){return client[_0x8988('0xa')](_0x512599,_0xeb97d0)['then'](function(_0x3a8e5e){logger[_0x8988('0xb')]('SugarcrmAccount,\x20%s,\x20%s',_0xc3eb0e,_0x8988('0xc'));logger[_0x8988('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0xc3eb0e,_0x8988('0xc'),JSON['stringify'](_0x3a8e5e));if(_0x3a8e5e['error']){if(_0x3a8e5e[_0x8988('0xe')][_0x8988('0xf')]===0x1f4){logger[_0x8988('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0xc3eb0e,_0x3a8e5e[_0x8988('0xe')]['message']);return _0xd06be4(_0x3a8e5e[_0x8988('0xe')][_0x8988('0x10')]);}logger[_0x8988('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0xc3eb0e,_0x3a8e5e[_0x8988('0xe')][_0x8988('0x10')]);return _0x50a9b8(_0x3a8e5e[_0x8988('0xe')][_0x8988('0x10')]);}else{logger[_0x8988('0xb')](_0x8988('0x11'),_0xc3eb0e,_0x8988('0xc'));_0x50a9b8(_0x3a8e5e['result'][_0x8988('0x10')]);}})[_0x8988('0x12')](function(_0x297c99){logger['error'](_0x8988('0x11'),_0xc3eb0e,_0x297c99);_0xd06be4(_0x297c99);});});}exports[_0x8988('0x13')]=function(_0x312e8a){var _0xb77259=this;return new Promise(function(_0x240437,_0xd69831){return db['SugarcrmAccount'][_0x8988('0x14')]({'raw':_0x312e8a[_0x8988('0x15')]?_0x312e8a[_0x8988('0x15')][_0x8988('0x16')]===undefined?!![]:![]:!![],'where':_0x312e8a[_0x8988('0x15')]?_0x312e8a['options'][_0x8988('0x17')]||null:null,'attributes':_0x312e8a[_0x8988('0x15')]?_0x312e8a[_0x8988('0x15')][_0x8988('0x18')]||null:null,'limit':_0x312e8a['options']?_0x312e8a['options'][_0x8988('0x19')]||null:null,'include':_0x312e8a[_0x8988('0x15')]?_0x312e8a['options'][_0x8988('0x1a')]?_['map'](_0x312e8a[_0x8988('0x15')][_0x8988('0x1a')],function(_0x5bd4f5){return{'model':db[_0x5bd4f5[_0x8988('0x1b')]],'as':_0x5bd4f5['as'],'attributes':_0x5bd4f5[_0x8988('0x18')],'include':_0x5bd4f5[_0x8988('0x1a')]?_['map'](_0x5bd4f5[_0x8988('0x1a')],function(_0x123a4e){return{'model':db[_0x123a4e[_0x8988('0x1b')]],'as':_0x123a4e['as'],'attributes':_0x123a4e['attributes'],'include':_0x123a4e[_0x8988('0x1a')]?_['map'](_0x123a4e[_0x8988('0x1a')],function(_0x26814d){return{'model':db[_0x26814d[_0x8988('0x1b')]],'as':_0x26814d['as'],'attributes':_0x26814d[_0x8988('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8988('0x1c')](function(_0x3155fe){logger[_0x8988('0xb')]('GetSugarcrmAccount',_0x312e8a);logger[_0x8988('0xd')](_0x8988('0x13'),_0x312e8a,JSON[_0x8988('0x1d')](_0x3155fe));_0x240437(_0x3155fe);})[_0x8988('0x12')](function(_0x4841e1){logger[_0x8988('0xe')](_0x8988('0x13'),_0x4841e1[_0x8988('0x10')],_0x312e8a);_0xd69831(_0xb77259['error'](0x1f4,_0x4841e1[_0x8988('0x10')]));});});};exports[_0x8988('0x1e')]=function(_0x114946){var _0x5b3706=this;return new Promise(function(_0x3daccb,_0x1c077d){return db[_0x8988('0x1f')][_0x8988('0x20')]({'raw':_0x114946[_0x8988('0x15')]?_0x114946['options'][_0x8988('0x16')]===undefined?!![]:![]:!![],'where':_0x114946['options']?_0x114946[_0x8988('0x15')][_0x8988('0x17')]||null:null,'attributes':_0x114946[_0x8988('0x15')]?_0x114946[_0x8988('0x15')][_0x8988('0x18')]||null:null,'include':_0x114946['options']?_0x114946[_0x8988('0x15')][_0x8988('0x1a')]?_['map'](_0x114946[_0x8988('0x15')]['include'],function(_0x10cc8c){return{'model':db[_0x10cc8c[_0x8988('0x1b')]],'as':_0x10cc8c['as'],'attributes':_0x10cc8c[_0x8988('0x18')],'include':_0x10cc8c[_0x8988('0x1a')]?_[_0x8988('0x21')](_0x10cc8c[_0x8988('0x1a')],function(_0x322149){return{'model':db[_0x322149[_0x8988('0x1b')]],'as':_0x322149['as'],'attributes':_0x322149[_0x8988('0x18')],'include':_0x322149[_0x8988('0x1a')]?_[_0x8988('0x21')](_0x322149[_0x8988('0x1a')],function(_0x189f9f){return{'model':db[_0x189f9f[_0x8988('0x1b')]],'as':_0x189f9f['as'],'attributes':_0x189f9f[_0x8988('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8988('0x1c')](function(_0x2b8e50){logger[_0x8988('0xb')](_0x8988('0x1e'),_0x114946);logger[_0x8988('0xd')](_0x8988('0x1e'),_0x114946,JSON['stringify'](_0x2b8e50));_0x3daccb(_0x2b8e50);})[_0x8988('0x12')](function(_0x77e58f){logger['error'](_0x8988('0x1e'),_0x77e58f[_0x8988('0x10')],_0x114946);_0x1c077d(_0x5b3706['error'](0x1f4,_0x77e58f[_0x8988('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 5791ab8..b7e3b77 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 _0x6891=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','post'];(function(_0x5358ab,_0x457c75){var _0x4d4faa=function(_0x1db59f){while(--_0x1db59f){_0x5358ab['push'](_0x5358ab['shift']());}};_0x4d4faa(++_0x457c75);}(_0x6891,0xa6));var _0x1689=function(_0x4ca796,_0x10dc47){_0x4ca796=_0x4ca796-0x0;var _0x171f87=_0x6891[_0x4ca796];return _0x171f87;};'use strict';var multer=require(_0x1689('0x0'));var util=require(_0x1689('0x1'));var path=require(_0x1689('0x2'));var timeout=require(_0x1689('0x3'));var express=require(_0x1689('0x4'));var router=express[_0x1689('0x5')]();var auth=require(_0x1689('0x6'));var interaction=require(_0x1689('0x7'));var config=require('../../config/environment');var controller=require(_0x1689('0x8'));router[_0x1689('0x9')]('/',auth[_0x1689('0xa')](),controller[_0x1689('0xb')]);router[_0x1689('0x9')](_0x1689('0xc'),auth[_0x1689('0xa')](),controller[_0x1689('0xd')]);router['get']('/:id/fields',auth[_0x1689('0xa')](),controller[_0x1689('0xe')]);router[_0x1689('0x9')](_0x1689('0xf'),auth[_0x1689('0xa')](),controller[_0x1689('0x10')]);router[_0x1689('0x9')]('/:id/descriptions',auth[_0x1689('0xa')](),controller['getDescriptions']);router[_0x1689('0x11')]('/',auth[_0x1689('0xa')](),controller[_0x1689('0x12')]);router[_0x1689('0x13')]('/:id',auth[_0x1689('0xa')](),controller['update']);router[_0x1689('0x14')](_0x1689('0xc'),auth['isAuthenticated'](),controller[_0x1689('0x15')]);module[_0x1689('0x16')]=router; \ No newline at end of file +var _0xd6af=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields'];(function(_0x1a77a0,_0x2d0929){var _0xa89fe6=function(_0x1905ec){while(--_0x1905ec){_0x1a77a0['push'](_0x1a77a0['shift']());}};_0xa89fe6(++_0x2d0929);}(_0xd6af,0x161));var _0xfd6a=function(_0x35f1de,_0x4dda19){_0x35f1de=_0x35f1de-0x0;var _0x4b66d6=_0xd6af[_0x35f1de];return _0x4b66d6;};'use strict';var multer=require(_0xfd6a('0x0'));var util=require(_0xfd6a('0x1'));var path=require(_0xfd6a('0x2'));var timeout=require(_0xfd6a('0x3'));var express=require(_0xfd6a('0x4'));var router=express[_0xfd6a('0x5')]();var auth=require(_0xfd6a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfd6a('0x7'));var controller=require(_0xfd6a('0x8'));router[_0xfd6a('0x9')]('/',auth[_0xfd6a('0xa')](),controller[_0xfd6a('0xb')]);router['get'](_0xfd6a('0xc'),auth[_0xfd6a('0xa')](),controller['show']);router[_0xfd6a('0x9')](_0xfd6a('0xd'),auth['isAuthenticated'](),controller[_0xfd6a('0xe')]);router[_0xfd6a('0x9')](_0xfd6a('0xf'),auth[_0xfd6a('0xa')](),controller[_0xfd6a('0x10')]);router[_0xfd6a('0x9')](_0xfd6a('0x11'),auth['isAuthenticated'](),controller[_0xfd6a('0x12')]);router['post']('/',auth[_0xfd6a('0xa')](),controller[_0xfd6a('0x13')]);router[_0xfd6a('0x14')](_0xfd6a('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xfd6a('0xc'),auth['isAuthenticated'](),controller[_0xfd6a('0x15')]);module[_0xfd6a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 8a0c84f..b382911 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 _0x4bdb=['sequelize','STRING'];(function(_0x4f5d76,_0x2d0336){var _0x584986=function(_0x387f34){while(--_0x387f34){_0x4f5d76['push'](_0x4f5d76['shift']());}};_0x584986(++_0x2d0336);}(_0x4bdb,0x100));var _0xb4bd=function(_0x371cac,_0x56a206){_0x371cac=_0x371cac-0x0;var _0x2eb17b=_0x4bdb[_0x371cac];return _0x2eb17b;};'use strict';var Sequelize=require(_0xb4bd('0x0'));module['exports']={'name':{'type':Sequelize[_0xb4bd('0x1')]},'description':{'type':Sequelize[_0xb4bd('0x1')]}}; \ No newline at end of file +var _0x47ce=['sequelize','exports','STRING'];(function(_0x2484c6,_0x17dbbd){var _0x3d09a6=function(_0x4fa0a1){while(--_0x4fa0a1){_0x2484c6['push'](_0x2484c6['shift']());}};_0x3d09a6(++_0x17dbbd);}(_0x47ce,0xff));var _0xe47c=function(_0x4dba46,_0x5a2fb6){_0x4dba46=_0x4dba46-0x0;var _0x2af64=_0x47ce[_0x4dba46];return _0x2af64;};'use strict';var Sequelize=require(_0xe47c('0x0'));module[_0xe47c('0x1')]={'name':{'type':Sequelize[_0xe47c('0x2')]},'description':{'type':Sequelize[_0xe47c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 073f4de..87a4a4f 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 _0x8c42=['SugarcrmField','pick','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','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~!@#$%^&-_=+[{]}.','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','params','fields','length','create','body','update','getFields','findOne'];(function(_0x390cdb,_0x4735db){var _0x15c746=function(_0x21db05){while(--_0x21db05){_0x390cdb['push'](_0x390cdb['shift']());}};_0x15c746(++_0x4735db);}(_0x8c42,0x10d));var _0x28c4=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0x8c42[_0xd21fe7];return _0x14d570;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x28c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x28c4('0x1'));var jsonpatch=require(_0x28c4('0x2'));var rp=require(_0x28c4('0x3'));var moment=require('moment');var BPromise=require(_0x28c4('0x4'));var Mustache=require(_0x28c4('0x5'));var util=require('util');var path=require(_0x28c4('0x6'));var sox=require(_0x28c4('0x7'));var csv=require(_0x28c4('0x8'));var ejs=require(_0x28c4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x28c4('0xa'));var crypto=require('crypto');var jsforce=require(_0x28c4('0xb'));var deskjs=require(_0x28c4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x28c4('0xd'));var Papa=require('papaparse');var Redis=require(_0x28c4('0xe'));var authService=require(_0x28c4('0xf'));var qs=require(_0x28c4('0x10'));var as=require(_0x28c4('0x11'));var hardwareService=require(_0x28c4('0x12'));var logger=require(_0x28c4('0x13'))(_0x28c4('0x14'));var utils=require(_0x28c4('0x15'));var config=require('../../config/environment');var db=require(_0x28c4('0x16'))['db'];var jayson=require(_0x28c4('0x17'));var client=jayson[_0x28c4('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x4ffab2,_0x1e939f,_0x4c5345){if(_0x4c5345){var _0x578468=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x578468[_0x28c4('0x19')](_0x1e939f)){return _0x4ffab2;}else{throw new db[(_0x28c4('0x1a'))][(_0x28c4('0x1b'))](_0x28c4('0x1c'));}}else{return _0x4ffab2;}}function respondWithRpcPromise(_0x3c13bf,_0x5567fc,_0x55c847,_0x4f94bd){return new BPromise(function(_0x294654,_0x2f06db){var _0x46d783=_0x4f94bd||client;return _0x46d783['request'](_0x3c13bf,_0x55c847)[_0x28c4('0x1d')](function(_0x36e355){logger[_0x28c4('0x1e')](_0x28c4('0x1f'),_0x5567fc,_0x28c4('0x20'));logger[_0x28c4('0x21')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x5567fc,'request\x20sent',JSON['stringify'](_0x36e355));if(_0x36e355[_0x28c4('0x22')]){if(_0x36e355[_0x28c4('0x22')]['code']===0x1f4){logger[_0x28c4('0x22')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5567fc,_0x36e355[_0x28c4('0x22')][_0x28c4('0x23')]);return _0x2f06db(_0x36e355[_0x28c4('0x22')][_0x28c4('0x23')]);}logger[_0x28c4('0x22')](_0x28c4('0x1f'),_0x5567fc,_0x36e355['error']['message']);return _0x294654(_0x36e355[_0x28c4('0x22')][_0x28c4('0x23')]);}else{logger['info'](_0x28c4('0x1f'),_0x5567fc,_0x28c4('0x20'));_0x294654(_0x36e355['result'][_0x28c4('0x23')]);}})[_0x28c4('0x24')](function(_0x1a53a9){logger[_0x28c4('0x22')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5567fc,_0x1a53a9);_0x2f06db(_0x1a53a9);});});}function respondWithStatusCode(_0x4a5dc1,_0x115bcc){_0x115bcc=_0x115bcc||0xcc;return function(_0x647d6c){if(_0x647d6c){return _0x4a5dc1[_0x28c4('0x25')](_0x115bcc);}return _0x4a5dc1[_0x28c4('0x26')](_0x115bcc)['end']();};}function respondWithResult(_0x1b291d,_0x2d74a6){_0x2d74a6=_0x2d74a6||0xc8;return function(_0x1e7aa1){if(_0x1e7aa1){return _0x1b291d[_0x28c4('0x26')](_0x2d74a6)[_0x28c4('0x27')](_0x1e7aa1);}};}function respondWithFilteredResult(_0x3c32be,_0x186c1e){return function(_0x70b4a){if(_0x70b4a){var _0xb77a21=_0x70b4a[_0x28c4('0x28')],_0x1c8070=_0x186c1e['offset'],_0x4af458=_0x186c1e[_0x28c4('0x29')]+_0x186c1e[_0x28c4('0x2a')],_0x246122;if(_0x4af458>=_0xb77a21){_0x4af458=_0xb77a21;_0x246122=0xc8;}else{_0x246122=0xce;}_0x3c32be[_0x28c4('0x26')](_0x246122);return _0x3c32be[_0x28c4('0x2b')](_0x28c4('0x2c'),_0x1c8070+'-'+_0x4af458+'/'+_0xb77a21)[_0x28c4('0x27')](_0x70b4a);}return null;};}function patchUpdates(_0x2ac08a){return function(_0xeca9e6){try{jsonpatch[_0x28c4('0x2d')](_0xeca9e6,_0x2ac08a,!![]);}catch(_0x3997c9){return BPromise[_0x28c4('0x2e')](_0x3997c9);}return _0xeca9e6[_0x28c4('0x2f')]();};}function saveUpdates(_0x10add6,_0x5b98b0){return function(_0x45f957){if(_0x45f957){return _0x45f957['update'](_0x10add6)[_0x28c4('0x1d')](function(_0x5b137a){return _0x5b137a;});}return null;};}function removeEntity(_0x291f14,_0x30652a){return function(_0x2e719c){if(_0x2e719c){return _0x2e719c[_0x28c4('0x30')]()[_0x28c4('0x1d')](function(){_0x291f14['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d02fe,_0x170eb9){return function(_0x1b1fc5){if(!_0x1b1fc5){_0x3d02fe['sendStatus'](0x194);}return _0x1b1fc5;};}function handleError(_0x40b37e,_0x2444e0){_0x2444e0=_0x2444e0||0x1f4;return function(_0x3be610){logger[_0x28c4('0x22')](_0x3be610[_0x28c4('0x31')]);if(_0x3be610[_0x28c4('0x32')]){delete _0x3be610[_0x28c4('0x32')];}_0x40b37e[_0x28c4('0x26')](_0x2444e0)[_0x28c4('0x33')](_0x3be610);};}exports[_0x28c4('0x34')]=function(_0x574830,_0x708ebf){var _0x3bdd24={},_0xe00593={},_0x55c343={'count':0x0,'rows':[]};var _0x2f7d2b=_[_0x28c4('0x35')](db[_0x28c4('0x36')][_0x28c4('0x37')],function(_0x4fadfd){return{'name':_0x4fadfd['fieldName'],'type':_0x4fadfd[_0x28c4('0x38')][_0x28c4('0x39')]};});_0xe00593[_0x28c4('0x3a')]=_['map'](_0x2f7d2b,_0x28c4('0x32'));_0xe00593[_0x28c4('0x3b')]=_[_0x28c4('0x3c')](_0x574830[_0x28c4('0x3b')]);_0xe00593[_0x28c4('0x3d')]=_['intersection'](_0xe00593[_0x28c4('0x3a')],_0xe00593[_0x28c4('0x3b')]);_0x3bdd24[_0x28c4('0x3e')]=_[_0x28c4('0x3f')](_0xe00593[_0x28c4('0x3a')],qs['fields'](_0x574830['query']['fields']));_0x3bdd24[_0x28c4('0x3e')]=_0x3bdd24[_0x28c4('0x3e')]['length']?_0x3bdd24[_0x28c4('0x3e')]:_0xe00593[_0x28c4('0x3a')];if(!_0x574830[_0x28c4('0x3b')]['hasOwnProperty'](_0x28c4('0x40'))){_0x3bdd24[_0x28c4('0x2a')]=qs[_0x28c4('0x2a')](_0x574830[_0x28c4('0x3b')][_0x28c4('0x2a')]);_0x3bdd24[_0x28c4('0x29')]=qs[_0x28c4('0x29')](_0x574830[_0x28c4('0x3b')]['offset']);}_0x3bdd24[_0x28c4('0x41')]=qs[_0x28c4('0x42')](_0x574830[_0x28c4('0x3b')][_0x28c4('0x42')]);_0x3bdd24[_0x28c4('0x43')]=qs[_0x28c4('0x3d')](_['pick'](_0x574830[_0x28c4('0x3b')],_0xe00593['filters']),_0x2f7d2b);if(_0x574830[_0x28c4('0x3b')][_0x28c4('0x44')]){_0x3bdd24[_0x28c4('0x43')]=_[_0x28c4('0x45')](_0x3bdd24[_0x28c4('0x43')],{'$or':_['map'](_0x2f7d2b,function(_0x21b652){if(_0x21b652['type']!=='VIRTUAL'){var _0x27a426={};_0x27a426[_0x21b652['name']]={'$like':'%'+_0x574830['query']['filter']+'%'};return _0x27a426;}})});}_0x3bdd24=_['merge']({},_0x3bdd24,_0x574830[_0x28c4('0x46')]);var _0x2f6a0e={'where':_0x3bdd24[_0x28c4('0x43')]};return db[_0x28c4('0x36')][_0x28c4('0x28')](_0x2f6a0e)[_0x28c4('0x1d')](function(_0x2f4814){_0x55c343[_0x28c4('0x28')]=_0x2f4814;if(_0x574830[_0x28c4('0x3b')][_0x28c4('0x47')]){_0x3bdd24[_0x28c4('0x48')]=[{'all':!![]}];}return db[_0x28c4('0x36')][_0x28c4('0x49')](_0x3bdd24);})['then'](function(_0x18dab9){_0x55c343[_0x28c4('0x4a')]=_0x18dab9;return _0x55c343;})[_0x28c4('0x1d')](respondWithFilteredResult(_0x708ebf,_0x3bdd24))[_0x28c4('0x24')](handleError(_0x708ebf,null));};exports['show']=function(_0xac8329,_0x5d5084){var _0x59b865={'raw':![],'where':{'id':_0xac8329[_0x28c4('0x4b')]['id']}},_0x3abc2d={};_0x3abc2d[_0x28c4('0x3a')]=_[_0x28c4('0x3c')](db[_0x28c4('0x36')][_0x28c4('0x37')]);_0x3abc2d[_0x28c4('0x3b')]=_[_0x28c4('0x3c')](_0xac8329[_0x28c4('0x3b')]);_0x3abc2d['filters']=_[_0x28c4('0x3f')](_0x3abc2d[_0x28c4('0x3a')],_0x3abc2d[_0x28c4('0x3b')]);_0x59b865[_0x28c4('0x3e')]=_[_0x28c4('0x3f')](_0x3abc2d['model'],qs[_0x28c4('0x4c')](_0xac8329[_0x28c4('0x3b')][_0x28c4('0x4c')]));_0x59b865['attributes']=_0x59b865[_0x28c4('0x3e')][_0x28c4('0x4d')]?_0x59b865['attributes']:_0x3abc2d[_0x28c4('0x3a')];if(_0xac8329[_0x28c4('0x3b')][_0x28c4('0x47')]){_0x59b865[_0x28c4('0x48')]=[{'all':!![]}];}_0x59b865=_['merge']({},_0x59b865,_0xac8329[_0x28c4('0x46')]);return db[_0x28c4('0x36')]['find'](_0x59b865)[_0x28c4('0x1d')](handleEntityNotFound(_0x5d5084,null))[_0x28c4('0x1d')](respondWithResult(_0x5d5084,null))['catch'](handleError(_0x5d5084,null));};exports[_0x28c4('0x4e')]=function(_0x343e8e,_0x42e7da){return db[_0x28c4('0x36')][_0x28c4('0x4e')](_0x343e8e[_0x28c4('0x4f')],{})[_0x28c4('0x1d')](respondWithResult(_0x42e7da,0xc9))[_0x28c4('0x24')](handleError(_0x42e7da,null));};exports[_0x28c4('0x50')]=function(_0x55f474,_0x42804d){if(_0x55f474[_0x28c4('0x4f')]['id']){delete _0x55f474[_0x28c4('0x4f')]['id'];}return db[_0x28c4('0x36')]['find']({'where':{'id':_0x55f474[_0x28c4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x42804d,null))[_0x28c4('0x1d')](saveUpdates(_0x55f474[_0x28c4('0x4f')],null))['then'](respondWithResult(_0x42804d,null))['catch'](handleError(_0x42804d,null));};exports['destroy']=function(_0x1746d9,_0x51e31b){return db[_0x28c4('0x36')]['find']({'where':{'id':_0x1746d9[_0x28c4('0x4b')]['id']}})[_0x28c4('0x1d')](handleEntityNotFound(_0x51e31b,null))[_0x28c4('0x1d')](removeEntity(_0x51e31b,null))['catch'](handleError(_0x51e31b,null));};exports[_0x28c4('0x51')]=function(_0x595a23,_0x30748e,_0x245415){var _0xc1bce3={};var _0x1d4841={};var _0x271eab;var _0x1af2f2;return db['SugarcrmConfiguration'][_0x28c4('0x52')]({'where':{'id':_0x595a23[_0x28c4('0x4b')]['id']}})[_0x28c4('0x1d')](handleEntityNotFound(_0x30748e,null))[_0x28c4('0x1d')](function(_0xda36c){if(_0xda36c){_0x271eab=_0xda36c;_0x1d4841[_0x28c4('0x3a')]=_[_0x28c4('0x3c')](db[_0x28c4('0x53')][_0x28c4('0x37')]);_0x1d4841[_0x28c4('0x3b')]=_[_0x28c4('0x3c')](_0x595a23[_0x28c4('0x3b')]);_0x1d4841[_0x28c4('0x3d')]=_[_0x28c4('0x3f')](_0x1d4841[_0x28c4('0x3a')],_0x1d4841[_0x28c4('0x3b')]);_0xc1bce3[_0x28c4('0x3e')]=_['intersection'](_0x1d4841[_0x28c4('0x3a')],qs[_0x28c4('0x4c')](_0x595a23[_0x28c4('0x3b')]['fields']));_0xc1bce3[_0x28c4('0x3e')]=_0xc1bce3[_0x28c4('0x3e')][_0x28c4('0x4d')]?_0xc1bce3[_0x28c4('0x3e')]:_0x1d4841[_0x28c4('0x3a')];_0xc1bce3[_0x28c4('0x41')]=qs[_0x28c4('0x42')](_0x595a23[_0x28c4('0x3b')]['sort']);_0xc1bce3[_0x28c4('0x43')]=qs[_0x28c4('0x3d')](_[_0x28c4('0x54')](_0x595a23[_0x28c4('0x3b')],_0x1d4841['filters']));if(_0x595a23[_0x28c4('0x3b')][_0x28c4('0x44')]){_0xc1bce3['where']=_[_0x28c4('0x45')](_0xc1bce3['where'],{'$or':_[_0x28c4('0x35')](_0xc1bce3[_0x28c4('0x3e')],function(_0x21e68b){var _0x6c8163={};_0x6c8163[_0x21e68b]={'$like':'%'+_0x595a23[_0x28c4('0x3b')][_0x28c4('0x44')]+'%'};return _0x6c8163;})});}_0xc1bce3=_[_0x28c4('0x45')]({},_0xc1bce3,_0x595a23[_0x28c4('0x46')]);return _0x271eab[_0x28c4('0x51')](_0xc1bce3);}})['then'](function(_0x4c6d5d){if(_0x4c6d5d){_0x1af2f2=_0x4c6d5d[_0x28c4('0x4d')];if(!_0x595a23[_0x28c4('0x3b')][_0x28c4('0x55')]('nolimit')){_0xc1bce3[_0x28c4('0x2a')]=qs[_0x28c4('0x2a')](_0x595a23['query'][_0x28c4('0x2a')]);_0xc1bce3[_0x28c4('0x29')]=qs[_0x28c4('0x29')](_0x595a23[_0x28c4('0x3b')]['offset']);}return _0x271eab[_0x28c4('0x51')](_0xc1bce3);}})['then'](function(_0x88436b){if(_0x88436b){return _0x88436b?{'count':_0x1af2f2,'rows':_0x88436b}:null;}})[_0x28c4('0x1d')](respondWithResult(_0x30748e,null))[_0x28c4('0x24')](handleError(_0x30748e,null));};exports[_0x28c4('0x56')]=function(_0x3bae15,_0x43e3b7,_0x26897d){var _0x548959={};var _0x3c9d46={};var _0x40edef;var _0x2fa799;return db['SugarcrmConfiguration'][_0x28c4('0x52')]({'where':{'id':_0x3bae15[_0x28c4('0x4b')]['id']}})[_0x28c4('0x1d')](handleEntityNotFound(_0x43e3b7,null))['then'](function(_0x385c37){if(_0x385c37){_0x40edef=_0x385c37;_0x3c9d46[_0x28c4('0x3a')]=_[_0x28c4('0x3c')](db['SugarcrmField'][_0x28c4('0x37')]);_0x3c9d46[_0x28c4('0x3b')]=_[_0x28c4('0x3c')](_0x3bae15[_0x28c4('0x3b')]);_0x3c9d46['filters']=_[_0x28c4('0x3f')](_0x3c9d46[_0x28c4('0x3a')],_0x3c9d46[_0x28c4('0x3b')]);_0x548959[_0x28c4('0x3e')]=_[_0x28c4('0x3f')](_0x3c9d46[_0x28c4('0x3a')],qs['fields'](_0x3bae15[_0x28c4('0x3b')][_0x28c4('0x4c')]));_0x548959[_0x28c4('0x3e')]=_0x548959[_0x28c4('0x3e')][_0x28c4('0x4d')]?_0x548959['attributes']:_0x3c9d46['model'];_0x548959[_0x28c4('0x41')]=qs[_0x28c4('0x42')](_0x3bae15[_0x28c4('0x3b')][_0x28c4('0x42')]);_0x548959[_0x28c4('0x43')]=qs[_0x28c4('0x3d')](_[_0x28c4('0x54')](_0x3bae15[_0x28c4('0x3b')],_0x3c9d46['filters']));if(_0x3bae15['query'][_0x28c4('0x44')]){_0x548959[_0x28c4('0x43')]=_[_0x28c4('0x45')](_0x548959[_0x28c4('0x43')],{'$or':_[_0x28c4('0x35')](_0x548959[_0x28c4('0x3e')],function(_0x5518e2){var _0x3a9e27={};_0x3a9e27[_0x5518e2]={'$like':'%'+_0x3bae15[_0x28c4('0x3b')][_0x28c4('0x44')]+'%'};return _0x3a9e27;})});}_0x548959=_[_0x28c4('0x45')]({},_0x548959,_0x3bae15[_0x28c4('0x46')]);return _0x40edef[_0x28c4('0x56')](_0x548959);}})[_0x28c4('0x1d')](function(_0x2b1c6e){if(_0x2b1c6e){_0x2fa799=_0x2b1c6e[_0x28c4('0x4d')];if(!_0x3bae15[_0x28c4('0x3b')][_0x28c4('0x55')](_0x28c4('0x40'))){_0x548959[_0x28c4('0x2a')]=qs[_0x28c4('0x2a')](_0x3bae15['query'][_0x28c4('0x2a')]);_0x548959[_0x28c4('0x29')]=qs[_0x28c4('0x29')](_0x3bae15[_0x28c4('0x3b')]['offset']);}return _0x40edef[_0x28c4('0x56')](_0x548959);}})[_0x28c4('0x1d')](function(_0x1c52e5){if(_0x1c52e5){return _0x1c52e5?{'count':_0x2fa799,'rows':_0x1c52e5}:null;}})['then'](respondWithResult(_0x43e3b7,null))[_0x28c4('0x24')](handleError(_0x43e3b7,null));};exports[_0x28c4('0x57')]=function(_0x488247,_0x3cf833,_0x474362){var _0x6161f4={};var _0x17c45a={};var _0x3200a7;var _0x740940;return db[_0x28c4('0x36')][_0x28c4('0x52')]({'where':{'id':_0x488247[_0x28c4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3cf833,null))['then'](function(_0x2b3373){if(_0x2b3373){_0x3200a7=_0x2b3373;_0x17c45a[_0x28c4('0x3a')]=_[_0x28c4('0x3c')](db[_0x28c4('0x53')][_0x28c4('0x37')]);_0x17c45a[_0x28c4('0x3b')]=_['keys'](_0x488247[_0x28c4('0x3b')]);_0x17c45a['filters']=_[_0x28c4('0x3f')](_0x17c45a[_0x28c4('0x3a')],_0x17c45a[_0x28c4('0x3b')]);_0x6161f4['attributes']=_[_0x28c4('0x3f')](_0x17c45a['model'],qs['fields'](_0x488247[_0x28c4('0x3b')][_0x28c4('0x4c')]));_0x6161f4['attributes']=_0x6161f4['attributes'][_0x28c4('0x4d')]?_0x6161f4[_0x28c4('0x3e')]:_0x17c45a[_0x28c4('0x3a')];_0x6161f4[_0x28c4('0x41')]=qs['sort'](_0x488247[_0x28c4('0x3b')][_0x28c4('0x42')]);_0x6161f4['where']=qs['filters'](_[_0x28c4('0x54')](_0x488247['query'],_0x17c45a['filters']));if(_0x488247['query'][_0x28c4('0x44')]){_0x6161f4[_0x28c4('0x43')]=_[_0x28c4('0x45')](_0x6161f4[_0x28c4('0x43')],{'$or':_[_0x28c4('0x35')](_0x6161f4[_0x28c4('0x3e')],function(_0x4bd435){var _0x2e2e41={};_0x2e2e41[_0x4bd435]={'$like':'%'+_0x488247[_0x28c4('0x3b')][_0x28c4('0x44')]+'%'};return _0x2e2e41;})});}_0x6161f4=_['merge']({},_0x6161f4,_0x488247[_0x28c4('0x46')]);return _0x3200a7[_0x28c4('0x57')](_0x6161f4);}})[_0x28c4('0x1d')](function(_0x1cadb0){if(_0x1cadb0){_0x740940=_0x1cadb0[_0x28c4('0x4d')];if(!_0x488247['query'][_0x28c4('0x55')]('nolimit')){_0x6161f4[_0x28c4('0x2a')]=qs[_0x28c4('0x2a')](_0x488247['query'][_0x28c4('0x2a')]);_0x6161f4[_0x28c4('0x29')]=qs[_0x28c4('0x29')](_0x488247[_0x28c4('0x3b')][_0x28c4('0x29')]);}return _0x3200a7[_0x28c4('0x57')](_0x6161f4);}})[_0x28c4('0x1d')](function(_0xcbf6d1){if(_0xcbf6d1){return _0xcbf6d1?{'count':_0x740940,'rows':_0xcbf6d1}:null;}})[_0x28c4('0x1d')](respondWithResult(_0x3cf833,null))[_0x28c4('0x24')](handleError(_0x3cf833,null));}; \ No newline at end of file +var _0x96b2=['stringify','error','code','message','result','catch','sendStatus','status','end','json','Content-Range','apply','reject','save','update','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','offset','order','pick','filter','where','merge','type','VIRTUAL','SugarcrmConfiguration','count','include','rows','show','includeAll','options','find','create','body','destroy','params','getFields','SugarcrmField','sort','nolimit','getSubjects','findOne','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','http','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~!@#$%^&-_=+[{]}.','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x553050,_0x2e73e9){var _0x4b3fb2=function(_0xe3deac){while(--_0xe3deac){_0x553050['push'](_0x553050['shift']());}};_0x4b3fb2(++_0x2e73e9);}(_0x96b2,0x18e));var _0x296b=function(_0x160034,_0xf332c4){_0x160034=_0x160034-0x0;var _0x56f677=_0x96b2[_0x160034];return _0x56f677;};'use strict';var pdf=require(_0x296b('0x0'));var emlformat=require(_0x296b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x296b('0x2'));var jsonpatch=require(_0x296b('0x3'));var rp=require('request-promise');var moment=require(_0x296b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x296b('0x5'));var path=require(_0x296b('0x6'));var sox=require(_0x296b('0x7'));var csv=require(_0x296b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x296b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x296b('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x296b('0xb'));var Redis=require(_0x296b('0xc'));var authService=require(_0x296b('0xd'));var qs=require(_0x296b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x296b('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x296b('0x10'));var config=require(_0x296b('0x11'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x296b('0x12')]({'port':0x232a});function checkPasswordPattern(_0x42d71c,_0x4ba6bb,_0x215f0b){if(_0x215f0b){var _0x55738c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55738c['test'](_0x4ba6bb)){return _0x42d71c;}else{throw new db['Sequelize'][(_0x296b('0x13'))](_0x296b('0x14'));}}else{return _0x42d71c;}}function respondWithRpcPromise(_0x544418,_0x1d5d9c,_0x5b6532,_0x44bbd0){return new BPromise(function(_0x5059ec,_0x504de2){var _0x4b17ca=_0x44bbd0||client;return _0x4b17ca['request'](_0x544418,_0x5b6532)[_0x296b('0x15')](function(_0xc7d057){logger[_0x296b('0x16')](_0x296b('0x17'),_0x1d5d9c,_0x296b('0x18'));logger[_0x296b('0x19')](_0x296b('0x1a'),_0x1d5d9c,_0x296b('0x18'),JSON[_0x296b('0x1b')](_0xc7d057));if(_0xc7d057[_0x296b('0x1c')]){if(_0xc7d057[_0x296b('0x1c')][_0x296b('0x1d')]===0x1f4){logger[_0x296b('0x1c')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1d5d9c,_0xc7d057[_0x296b('0x1c')]['message']);return _0x504de2(_0xc7d057[_0x296b('0x1c')]['message']);}logger[_0x296b('0x1c')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1d5d9c,_0xc7d057['error'][_0x296b('0x1e')]);return _0x5059ec(_0xc7d057[_0x296b('0x1c')][_0x296b('0x1e')]);}else{logger['info'](_0x296b('0x17'),_0x1d5d9c,'request\x20sent');_0x5059ec(_0xc7d057[_0x296b('0x1f')][_0x296b('0x1e')]);}})[_0x296b('0x20')](function(_0x2c6fad){logger[_0x296b('0x1c')](_0x296b('0x17'),_0x1d5d9c,_0x2c6fad);_0x504de2(_0x2c6fad);});});}function respondWithStatusCode(_0x1bfde7,_0x261262){_0x261262=_0x261262||0xcc;return function(_0x373190){if(_0x373190){return _0x1bfde7[_0x296b('0x21')](_0x261262);}return _0x1bfde7[_0x296b('0x22')](_0x261262)[_0x296b('0x23')]();};}function respondWithResult(_0x66bcb8,_0x1ad077){_0x1ad077=_0x1ad077||0xc8;return function(_0x55859b){if(_0x55859b){return _0x66bcb8[_0x296b('0x22')](_0x1ad077)[_0x296b('0x24')](_0x55859b);}};}function respondWithFilteredResult(_0x1f0e08,_0x23a2b8){return function(_0x5b6a1f){if(_0x5b6a1f){var _0x3b136c=_0x5b6a1f['count'],_0x2f765b=_0x23a2b8['offset'],_0x19b32b=_0x23a2b8['offset']+_0x23a2b8['limit'],_0x541043;if(_0x19b32b>=_0x3b136c){_0x19b32b=_0x3b136c;_0x541043=0xc8;}else{_0x541043=0xce;}_0x1f0e08[_0x296b('0x22')](_0x541043);return _0x1f0e08['set'](_0x296b('0x25'),_0x2f765b+'-'+_0x19b32b+'/'+_0x3b136c)['json'](_0x5b6a1f);}return null;};}function patchUpdates(_0x4b29d2){return function(_0x3826be){try{jsonpatch[_0x296b('0x26')](_0x3826be,_0x4b29d2,!![]);}catch(_0x20556d){return BPromise[_0x296b('0x27')](_0x20556d);}return _0x3826be[_0x296b('0x28')]();};}function saveUpdates(_0xa6503b,_0xdbfbff){return function(_0x520bb1){if(_0x520bb1){return _0x520bb1[_0x296b('0x29')](_0xa6503b)[_0x296b('0x15')](function(_0x1ec8d7){return _0x1ec8d7;});}return null;};}function removeEntity(_0x1cccb3,_0x4fe605){return function(_0x51d11f){if(_0x51d11f){return _0x51d11f['destroy']()['then'](function(){_0x1cccb3['status'](0xcc)[_0x296b('0x23')]();});}};}function handleEntityNotFound(_0x577522,_0x31ceb2){return function(_0x2f89f3){if(!_0x2f89f3){_0x577522[_0x296b('0x21')](0x194);}return _0x2f89f3;};}function handleError(_0x4f8cd6,_0x37ece1){_0x37ece1=_0x37ece1||0x1f4;return function(_0x34f7c7){logger[_0x296b('0x1c')](_0x34f7c7['stack']);if(_0x34f7c7[_0x296b('0x2a')]){delete _0x34f7c7[_0x296b('0x2a')];}_0x4f8cd6[_0x296b('0x22')](_0x37ece1)[_0x296b('0x2b')](_0x34f7c7);};}exports['index']=function(_0x39a3e0,_0x10e198){var _0x11a89a={},_0x58604c={},_0x2b8104={'count':0x0,'rows':[]};var _0x5346de=_['map'](db['SugarcrmConfiguration'][_0x296b('0x2c')],function(_0x368530){return{'name':_0x368530[_0x296b('0x2d')],'type':_0x368530['type'][_0x296b('0x2e')]};});_0x58604c[_0x296b('0x2f')]=_[_0x296b('0x30')](_0x5346de,_0x296b('0x2a'));_0x58604c[_0x296b('0x31')]=_[_0x296b('0x32')](_0x39a3e0['query']);_0x58604c[_0x296b('0x33')]=_[_0x296b('0x34')](_0x58604c[_0x296b('0x2f')],_0x58604c[_0x296b('0x31')]);_0x11a89a[_0x296b('0x35')]=_[_0x296b('0x34')](_0x58604c[_0x296b('0x2f')],qs[_0x296b('0x36')](_0x39a3e0[_0x296b('0x31')][_0x296b('0x36')]));_0x11a89a['attributes']=_0x11a89a[_0x296b('0x35')][_0x296b('0x37')]?_0x11a89a[_0x296b('0x35')]:_0x58604c[_0x296b('0x2f')];if(!_0x39a3e0[_0x296b('0x31')][_0x296b('0x38')]('nolimit')){_0x11a89a['limit']=qs['limit'](_0x39a3e0[_0x296b('0x31')][_0x296b('0x39')]);_0x11a89a[_0x296b('0x3a')]=qs[_0x296b('0x3a')](_0x39a3e0[_0x296b('0x31')]['offset']);}_0x11a89a[_0x296b('0x3b')]=qs['sort'](_0x39a3e0[_0x296b('0x31')]['sort']);_0x11a89a['where']=qs[_0x296b('0x33')](_[_0x296b('0x3c')](_0x39a3e0[_0x296b('0x31')],_0x58604c[_0x296b('0x33')]),_0x5346de);if(_0x39a3e0[_0x296b('0x31')][_0x296b('0x3d')]){_0x11a89a[_0x296b('0x3e')]=_[_0x296b('0x3f')](_0x11a89a['where'],{'$or':_['map'](_0x5346de,function(_0x3bc2d0){if(_0x3bc2d0[_0x296b('0x40')]!==_0x296b('0x41')){var _0x154179={};_0x154179[_0x3bc2d0[_0x296b('0x2a')]]={'$like':'%'+_0x39a3e0[_0x296b('0x31')][_0x296b('0x3d')]+'%'};return _0x154179;}})});}_0x11a89a=_['merge']({},_0x11a89a,_0x39a3e0['options']);var _0x4b7b23={'where':_0x11a89a[_0x296b('0x3e')]};return db[_0x296b('0x42')]['count'](_0x4b7b23)[_0x296b('0x15')](function(_0x56e264){_0x2b8104[_0x296b('0x43')]=_0x56e264;if(_0x39a3e0['query']['includeAll']){_0x11a89a[_0x296b('0x44')]=[{'all':!![]}];}return db[_0x296b('0x42')]['findAll'](_0x11a89a);})[_0x296b('0x15')](function(_0x3f47ce){_0x2b8104[_0x296b('0x45')]=_0x3f47ce;return _0x2b8104;})[_0x296b('0x15')](respondWithFilteredResult(_0x10e198,_0x11a89a))[_0x296b('0x20')](handleError(_0x10e198,null));};exports[_0x296b('0x46')]=function(_0xe8dfc6,_0x3a356c){var _0x1c8054={'raw':![],'where':{'id':_0xe8dfc6['params']['id']}},_0x5ed0d6={};_0x5ed0d6['model']=_['keys'](db[_0x296b('0x42')][_0x296b('0x2c')]);_0x5ed0d6[_0x296b('0x31')]=_['keys'](_0xe8dfc6[_0x296b('0x31')]);_0x5ed0d6[_0x296b('0x33')]=_[_0x296b('0x34')](_0x5ed0d6['model'],_0x5ed0d6[_0x296b('0x31')]);_0x1c8054[_0x296b('0x35')]=_[_0x296b('0x34')](_0x5ed0d6[_0x296b('0x2f')],qs[_0x296b('0x36')](_0xe8dfc6['query'][_0x296b('0x36')]));_0x1c8054[_0x296b('0x35')]=_0x1c8054['attributes']['length']?_0x1c8054[_0x296b('0x35')]:_0x5ed0d6[_0x296b('0x2f')];if(_0xe8dfc6[_0x296b('0x31')][_0x296b('0x47')]){_0x1c8054[_0x296b('0x44')]=[{'all':!![]}];}_0x1c8054=_['merge']({},_0x1c8054,_0xe8dfc6[_0x296b('0x48')]);return db[_0x296b('0x42')][_0x296b('0x49')](_0x1c8054)[_0x296b('0x15')](handleEntityNotFound(_0x3a356c,null))[_0x296b('0x15')](respondWithResult(_0x3a356c,null))[_0x296b('0x20')](handleError(_0x3a356c,null));};exports[_0x296b('0x4a')]=function(_0x4333c4,_0x47f8c4){return db[_0x296b('0x42')][_0x296b('0x4a')](_0x4333c4[_0x296b('0x4b')],{})['then'](respondWithResult(_0x47f8c4,0xc9))[_0x296b('0x20')](handleError(_0x47f8c4,null));};exports[_0x296b('0x29')]=function(_0x300931,_0x1f3345){if(_0x300931[_0x296b('0x4b')]['id']){delete _0x300931[_0x296b('0x4b')]['id'];}return db[_0x296b('0x42')]['find']({'where':{'id':_0x300931['params']['id']}})['then'](handleEntityNotFound(_0x1f3345,null))['then'](saveUpdates(_0x300931[_0x296b('0x4b')],null))['then'](respondWithResult(_0x1f3345,null))[_0x296b('0x20')](handleError(_0x1f3345,null));};exports[_0x296b('0x4c')]=function(_0x5abc44,_0x204323){return db[_0x296b('0x42')][_0x296b('0x49')]({'where':{'id':_0x5abc44[_0x296b('0x4d')]['id']}})[_0x296b('0x15')](handleEntityNotFound(_0x204323,null))['then'](removeEntity(_0x204323,null))['catch'](handleError(_0x204323,null));};exports[_0x296b('0x4e')]=function(_0x48a609,_0x4f7818,_0x1c0635){var _0x26c177={};var _0x5a398f={};var _0x570f1b;var _0x59cc9c;return db[_0x296b('0x42')]['findOne']({'where':{'id':_0x48a609[_0x296b('0x4d')]['id']}})[_0x296b('0x15')](handleEntityNotFound(_0x4f7818,null))[_0x296b('0x15')](function(_0x204e94){if(_0x204e94){_0x570f1b=_0x204e94;_0x5a398f[_0x296b('0x2f')]=_[_0x296b('0x32')](db[_0x296b('0x4f')][_0x296b('0x2c')]);_0x5a398f[_0x296b('0x31')]=_['keys'](_0x48a609[_0x296b('0x31')]);_0x5a398f[_0x296b('0x33')]=_[_0x296b('0x34')](_0x5a398f[_0x296b('0x2f')],_0x5a398f[_0x296b('0x31')]);_0x26c177[_0x296b('0x35')]=_[_0x296b('0x34')](_0x5a398f[_0x296b('0x2f')],qs[_0x296b('0x36')](_0x48a609['query'][_0x296b('0x36')]));_0x26c177[_0x296b('0x35')]=_0x26c177['attributes']['length']?_0x26c177[_0x296b('0x35')]:_0x5a398f[_0x296b('0x2f')];_0x26c177[_0x296b('0x3b')]=qs['sort'](_0x48a609['query'][_0x296b('0x50')]);_0x26c177['where']=qs[_0x296b('0x33')](_['pick'](_0x48a609['query'],_0x5a398f[_0x296b('0x33')]));if(_0x48a609[_0x296b('0x31')][_0x296b('0x3d')]){_0x26c177[_0x296b('0x3e')]=_[_0x296b('0x3f')](_0x26c177[_0x296b('0x3e')],{'$or':_[_0x296b('0x30')](_0x26c177[_0x296b('0x35')],function(_0x30839f){var _0x4b6685={};_0x4b6685[_0x30839f]={'$like':'%'+_0x48a609[_0x296b('0x31')][_0x296b('0x3d')]+'%'};return _0x4b6685;})});}_0x26c177=_['merge']({},_0x26c177,_0x48a609[_0x296b('0x48')]);return _0x570f1b[_0x296b('0x4e')](_0x26c177);}})[_0x296b('0x15')](function(_0x438ec4){if(_0x438ec4){_0x59cc9c=_0x438ec4[_0x296b('0x37')];if(!_0x48a609['query'][_0x296b('0x38')](_0x296b('0x51'))){_0x26c177[_0x296b('0x39')]=qs[_0x296b('0x39')](_0x48a609[_0x296b('0x31')]['limit']);_0x26c177[_0x296b('0x3a')]=qs[_0x296b('0x3a')](_0x48a609[_0x296b('0x31')][_0x296b('0x3a')]);}return _0x570f1b[_0x296b('0x4e')](_0x26c177);}})[_0x296b('0x15')](function(_0x1d8973){if(_0x1d8973){return _0x1d8973?{'count':_0x59cc9c,'rows':_0x1d8973}:null;}})['then'](respondWithResult(_0x4f7818,null))[_0x296b('0x20')](handleError(_0x4f7818,null));};exports[_0x296b('0x52')]=function(_0x4b9344,_0x362e53,_0x2680fd){var _0x7cd7de={};var _0x5b8efd={};var _0x30a978;var _0x235f6e;return db[_0x296b('0x42')][_0x296b('0x53')]({'where':{'id':_0x4b9344[_0x296b('0x4d')]['id']}})[_0x296b('0x15')](handleEntityNotFound(_0x362e53,null))[_0x296b('0x15')](function(_0x455229){if(_0x455229){_0x30a978=_0x455229;_0x5b8efd[_0x296b('0x2f')]=_[_0x296b('0x32')](db[_0x296b('0x4f')][_0x296b('0x2c')]);_0x5b8efd[_0x296b('0x31')]=_[_0x296b('0x32')](_0x4b9344[_0x296b('0x31')]);_0x5b8efd[_0x296b('0x33')]=_[_0x296b('0x34')](_0x5b8efd[_0x296b('0x2f')],_0x5b8efd[_0x296b('0x31')]);_0x7cd7de[_0x296b('0x35')]=_[_0x296b('0x34')](_0x5b8efd[_0x296b('0x2f')],qs['fields'](_0x4b9344['query'][_0x296b('0x36')]));_0x7cd7de[_0x296b('0x35')]=_0x7cd7de['attributes'][_0x296b('0x37')]?_0x7cd7de['attributes']:_0x5b8efd['model'];_0x7cd7de[_0x296b('0x3b')]=qs[_0x296b('0x50')](_0x4b9344[_0x296b('0x31')][_0x296b('0x50')]);_0x7cd7de['where']=qs[_0x296b('0x33')](_[_0x296b('0x3c')](_0x4b9344[_0x296b('0x31')],_0x5b8efd[_0x296b('0x33')]));if(_0x4b9344[_0x296b('0x31')][_0x296b('0x3d')]){_0x7cd7de[_0x296b('0x3e')]=_['merge'](_0x7cd7de[_0x296b('0x3e')],{'$or':_['map'](_0x7cd7de[_0x296b('0x35')],function(_0x64524a){var _0x3b669e={};_0x3b669e[_0x64524a]={'$like':'%'+_0x4b9344[_0x296b('0x31')][_0x296b('0x3d')]+'%'};return _0x3b669e;})});}_0x7cd7de=_[_0x296b('0x3f')]({},_0x7cd7de,_0x4b9344['options']);return _0x30a978[_0x296b('0x52')](_0x7cd7de);}})[_0x296b('0x15')](function(_0x3de523){if(_0x3de523){_0x235f6e=_0x3de523[_0x296b('0x37')];if(!_0x4b9344[_0x296b('0x31')][_0x296b('0x38')](_0x296b('0x51'))){_0x7cd7de[_0x296b('0x39')]=qs[_0x296b('0x39')](_0x4b9344[_0x296b('0x31')][_0x296b('0x39')]);_0x7cd7de[_0x296b('0x3a')]=qs[_0x296b('0x3a')](_0x4b9344[_0x296b('0x31')][_0x296b('0x3a')]);}return _0x30a978[_0x296b('0x52')](_0x7cd7de);}})[_0x296b('0x15')](function(_0x314696){if(_0x314696){return _0x314696?{'count':_0x235f6e,'rows':_0x314696}:null;}})[_0x296b('0x15')](respondWithResult(_0x362e53,null))[_0x296b('0x20')](handleError(_0x362e53,null));};exports[_0x296b('0x54')]=function(_0x263bea,_0x2cc641,_0x24a102){var _0x246a80={};var _0x15735d={};var _0x24373f;var _0x462f61;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x263bea[_0x296b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2cc641,null))['then'](function(_0x2ac4fa){if(_0x2ac4fa){_0x24373f=_0x2ac4fa;_0x15735d[_0x296b('0x2f')]=_[_0x296b('0x32')](db[_0x296b('0x4f')][_0x296b('0x2c')]);_0x15735d[_0x296b('0x31')]=_['keys'](_0x263bea['query']);_0x15735d[_0x296b('0x33')]=_[_0x296b('0x34')](_0x15735d['model'],_0x15735d[_0x296b('0x31')]);_0x246a80[_0x296b('0x35')]=_[_0x296b('0x34')](_0x15735d['model'],qs['fields'](_0x263bea[_0x296b('0x31')][_0x296b('0x36')]));_0x246a80[_0x296b('0x35')]=_0x246a80['attributes'][_0x296b('0x37')]?_0x246a80['attributes']:_0x15735d[_0x296b('0x2f')];_0x246a80[_0x296b('0x3b')]=qs[_0x296b('0x50')](_0x263bea[_0x296b('0x31')][_0x296b('0x50')]);_0x246a80[_0x296b('0x3e')]=qs['filters'](_[_0x296b('0x3c')](_0x263bea[_0x296b('0x31')],_0x15735d['filters']));if(_0x263bea['query'][_0x296b('0x3d')]){_0x246a80['where']=_[_0x296b('0x3f')](_0x246a80[_0x296b('0x3e')],{'$or':_[_0x296b('0x30')](_0x246a80[_0x296b('0x35')],function(_0x3f7ae1){var _0x18506e={};_0x18506e[_0x3f7ae1]={'$like':'%'+_0x263bea[_0x296b('0x31')][_0x296b('0x3d')]+'%'};return _0x18506e;})});}_0x246a80=_[_0x296b('0x3f')]({},_0x246a80,_0x263bea[_0x296b('0x48')]);return _0x24373f[_0x296b('0x54')](_0x246a80);}})['then'](function(_0x41b83e){if(_0x41b83e){_0x462f61=_0x41b83e[_0x296b('0x37')];if(!_0x263bea[_0x296b('0x31')][_0x296b('0x38')](_0x296b('0x51'))){_0x246a80['limit']=qs[_0x296b('0x39')](_0x263bea[_0x296b('0x31')]['limit']);_0x246a80[_0x296b('0x3a')]=qs['offset'](_0x263bea['query']['offset']);}return _0x24373f[_0x296b('0x54')](_0x246a80);}})[_0x296b('0x15')](function(_0xf85f4d){if(_0xf85f4d){return _0xf85f4d?{'count':_0x462f61,'rows':_0xf85f4d}:null;}})[_0x296b('0x15')](respondWithResult(_0x2cc641,null))['catch'](handleError(_0x2cc641,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index da40255..42a6c62 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 _0xa2f4=['define','SugarcrmConfiguration','int_sugarcrm_configurations','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xa2f4,0x173));var _0x4a2f=function(_0xa74d52,_0x430427){_0xa74d52=_0xa74d52-0x0;var _0x1e1247=_0xa2f4[_0xa74d52];return _0x1e1247;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4a2f('0x0'));var BPromise=require(_0x4a2f('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4a2f('0x2'));var config=require(_0x4a2f('0x3'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x4a2f('0x4')]=function(_0x2453da,_0x14e7a3){return _0x2453da[_0x4a2f('0x5')](_0x4a2f('0x6'),attributes,{'tableName':_0x4a2f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc81=['int_sugarcrm_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xcc81,0x1b9));var _0x1cc8=function(_0xeeecab,_0x248080){_0xeeecab=_0xeeecab-0x0;var _0x5925a0=_0xcc81[_0xeeecab];return _0x5925a0;};'use strict';var _=require(_0x1cc8('0x0'));var util=require(_0x1cc8('0x1'));var logger=require('../../config/logger')(_0x1cc8('0x2'));var moment=require(_0x1cc8('0x3'));var BPromise=require(_0x1cc8('0x4'));var rp=require(_0x1cc8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1cc8('0x6'));var config=require(_0x1cc8('0x7'));var attributes=require(_0x1cc8('0x8'));module[_0x1cc8('0x9')]=function(_0x3854cc,_0x7cf698){return _0x3854cc['define']('SugarcrmConfiguration',attributes,{'tableName':_0x1cc8('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 eb76a99..8caa06d 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 _0x7f81=['client','http','request','then','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x52891c,_0x426b26){var _0x183265=function(_0x5c15d7){while(--_0x5c15d7){_0x52891c['push'](_0x52891c['shift']());}};_0x183265(++_0x426b26);}(_0x7f81,0x9e));var _0x17f8=function(_0x81dd6b,_0x23a824){_0x81dd6b=_0x81dd6b-0x0;var _0x7b3bb5=_0x7f81[_0x81dd6b];return _0x7b3bb5;};'use strict';var _=require(_0x17f8('0x0'));var util=require(_0x17f8('0x1'));var moment=require(_0x17f8('0x2'));var BPromise=require(_0x17f8('0x3'));var rs=require(_0x17f8('0x4'));var fs=require('fs');var Redis=require(_0x17f8('0x5'));var db=require(_0x17f8('0x6'))['db'];var utils=require(_0x17f8('0x7'));var logger=require(_0x17f8('0x8'))('rpc');var config=require(_0x17f8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x17f8('0xa')][_0x17f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x447c4f,_0x2341e2,_0x5db24e){return new BPromise(function(_0x814c50,_0x4f63b0){return client[_0x17f8('0xc')](_0x447c4f,_0x5db24e)[_0x17f8('0xd')](function(_0x732b36){logger[_0x17f8('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2341e2,'request\x20sent');logger[_0x17f8('0xf')](_0x17f8('0x10'),_0x2341e2,_0x17f8('0x11'),JSON[_0x17f8('0x12')](_0x732b36));if(_0x732b36[_0x17f8('0x13')]){if(_0x732b36['error'][_0x17f8('0x14')]===0x1f4){logger[_0x17f8('0x13')](_0x17f8('0x15'),_0x2341e2,_0x732b36[_0x17f8('0x13')][_0x17f8('0x16')]);return _0x4f63b0(_0x732b36[_0x17f8('0x13')][_0x17f8('0x16')]);}logger[_0x17f8('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2341e2,_0x732b36[_0x17f8('0x13')]['message']);return _0x814c50(_0x732b36['error'][_0x17f8('0x16')]);}else{logger[_0x17f8('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2341e2,_0x17f8('0x11'));_0x814c50(_0x732b36[_0x17f8('0x17')][_0x17f8('0x16')]);}})['catch'](function(_0x228a8c){logger['error'](_0x17f8('0x15'),_0x2341e2,_0x228a8c);_0x4f63b0(_0x228a8c);});});} \ No newline at end of file +var _0x705a=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x2b11c3,_0x360fc8){var _0x41aa4c=function(_0x1a6631){while(--_0x1a6631){_0x2b11c3['push'](_0x2b11c3['shift']());}};_0x41aa4c(++_0x360fc8);}(_0x705a,0x111));var _0xa705=function(_0x24c0f8,_0x5b60d7){_0x24c0f8=_0x24c0f8-0x0;var _0x37da55=_0x705a[_0x24c0f8];return _0x37da55;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa705('0x0'));var BPromise=require(_0xa705('0x1'));var rs=require(_0xa705('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa705('0x3'))['db'];var utils=require(_0xa705('0x4'));var logger=require(_0xa705('0x5'))('rpc');var config=require(_0xa705('0x6'));var jayson=require(_0xa705('0x7'));var client=jayson[_0xa705('0x8')][_0xa705('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x63ef40,_0x34ec34,_0x185fb6){return new BPromise(function(_0x2fbee7,_0x88ae54){return client['request'](_0x63ef40,_0x185fb6)[_0xa705('0xa')](function(_0x298ae0){logger[_0xa705('0xb')](_0xa705('0xc'),_0x34ec34,_0xa705('0xd'));logger[_0xa705('0xe')](_0xa705('0xf'),_0x34ec34,_0xa705('0xd'),JSON['stringify'](_0x298ae0));if(_0x298ae0[_0xa705('0x10')]){if(_0x298ae0['error'][_0xa705('0x11')]===0x1f4){logger[_0xa705('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x34ec34,_0x298ae0[_0xa705('0x10')][_0xa705('0x12')]);return _0x88ae54(_0x298ae0['error'][_0xa705('0x12')]);}logger[_0xa705('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x34ec34,_0x298ae0[_0xa705('0x10')][_0xa705('0x12')]);return _0x2fbee7(_0x298ae0['error'][_0xa705('0x12')]);}else{logger[_0xa705('0xb')](_0xa705('0xc'),_0x34ec34,_0xa705('0xd'));_0x2fbee7(_0x298ae0[_0xa705('0x13')][_0xa705('0x12')]);}})[_0xa705('0x14')](function(_0x4835df){logger[_0xa705('0x10')](_0xa705('0xc'),_0x34ec34,_0x4835df);_0x88ae54(_0x4835df);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 3a661f1..b2f5ff8 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 _0x0e4e=['path','express','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','multer','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0e4e,0x10e));var _0xe0e4=function(_0x138ed8,_0x394451){_0x138ed8=_0x138ed8-0x0;var _0xa1b00e=_0x0e4e[_0x138ed8];return _0xa1b00e;};'use strict';var multer=require(_0xe0e4('0x0'));var util=require(_0xe0e4('0x1'));var path=require(_0xe0e4('0x2'));var timeout=require('connect-timeout');var express=require(_0xe0e4('0x3'));var router=express['Router']();var auth=require(_0xe0e4('0x4'));var interaction=require(_0xe0e4('0x5'));var config=require('../../config/environment');var controller=require(_0xe0e4('0x6'));router[_0xe0e4('0x7')]('/',auth[_0xe0e4('0x8')](),controller[_0xe0e4('0x9')]);router[_0xe0e4('0x7')](_0xe0e4('0xa'),auth[_0xe0e4('0x8')](),controller[_0xe0e4('0xb')]);router[_0xe0e4('0xc')]('/',auth[_0xe0e4('0x8')](),controller[_0xe0e4('0xd')]);router[_0xe0e4('0xe')]('/:id',auth[_0xe0e4('0x8')](),controller['update']);router[_0xe0e4('0xf')](_0xe0e4('0xa'),auth[_0xe0e4('0x8')](),controller[_0xe0e4('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe95a=['./intSugarcrmField.controller','get','index','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xe95a,0x19a));var _0xae95=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xe95a[_0x13ce0c];return _0x4388fb;};'use strict';var multer=require(_0xae95('0x0'));var util=require(_0xae95('0x1'));var path=require('path');var timeout=require(_0xae95('0x2'));var express=require(_0xae95('0x3'));var router=express[_0xae95('0x4')]();var auth=require(_0xae95('0x5'));var interaction=require(_0xae95('0x6'));var config=require(_0xae95('0x7'));var controller=require(_0xae95('0x8'));router[_0xae95('0x9')]('/',auth['isAuthenticated'](),controller[_0xae95('0xa')]);router['get'](_0xae95('0xb'),auth[_0xae95('0xc')](),controller[_0xae95('0xd')]);router['post']('/',auth[_0xae95('0xc')](),controller['create']);router[_0xae95('0xe')](_0xae95('0xb'),auth[_0xae95('0xc')](),controller[_0xae95('0xf')]);router[_0xae95('0x10')]('/:id',auth[_0xae95('0xc')](),controller[_0xae95('0x11')]);module[_0xae95('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 23889e1..124bac3 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 _0x3c7b=['ENUM','string','variable','STRING','BOOLEAN','sequelize','exports'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x32de24,_0x3bc493){_0x32de24=_0x32de24-0x0;var _0x5a10cf=_0x3c7b[_0x32de24];return _0x5a10cf;};'use strict';var Sequelize=require(_0xb3c7('0x0'));module[_0xb3c7('0x1')]={'type':{'type':Sequelize[_0xb3c7('0x2')](_0xb3c7('0x3'),_0xb3c7('0x4'),'customVariable','keyValue'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb3c7('0x5')]},'keyType':{'type':Sequelize[_0xb3c7('0x2')]('string',_0xb3c7('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xb3c7('0x5')]},'idField':{'type':Sequelize[_0xb3c7('0x5')]},'nameField':{'type':Sequelize[_0xb3c7('0x5')]},'customField':{'type':Sequelize[_0xb3c7('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb3c7('0x5')]}}; \ No newline at end of file +var _0xa630=['variable','keyValue','STRING','ENUM','string','BOOLEAN','sequelize','exports'];(function(_0x4b4b1a,_0x17147d){var _0x318cb9=function(_0x3c6bc7){while(--_0x3c6bc7){_0x4b4b1a['push'](_0x4b4b1a['shift']());}};_0x318cb9(++_0x17147d);}(_0xa630,0xbe));var _0x0a63=function(_0x104d19,_0x551299){_0x104d19=_0x104d19-0x0;var _0x5f19f4=_0xa630[_0x104d19];return _0x5f19f4;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x0a63('0x2'),'customVariable',_0x0a63('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0a63('0x4')]},'key':{'type':Sequelize[_0x0a63('0x4')]},'keyType':{'type':Sequelize[_0x0a63('0x5')](_0x0a63('0x6'),_0x0a63('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x0a63('0x4')]},'idField':{'type':Sequelize[_0x0a63('0x4')]},'nameField':{'type':Sequelize[_0x0a63('0x4')]},'customField':{'type':Sequelize[_0x0a63('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0a63('0x4')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 06081ec..b3760db 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 _0xcbe2=['../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','SugarcrmField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','intersection','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x38b13d,_0x1453e7){var _0x3dd115=function(_0x46dd8e){while(--_0x46dd8e){_0x38b13d['push'](_0x38b13d['shift']());}};_0x3dd115(++_0x1453e7);}(_0xcbe2,0x10b));var _0x2cbe=function(_0x5cd1cf,_0x2ab818){_0x5cd1cf=_0x5cd1cf-0x0;var _0x27074c=_0xcbe2[_0x5cd1cf];return _0x27074c;};'use strict';var pdf=require(_0x2cbe('0x0'));var emlformat=require(_0x2cbe('0x1'));var rimraf=require(_0x2cbe('0x2'));var zipdir=require(_0x2cbe('0x3'));var jsonpatch=require(_0x2cbe('0x4'));var rp=require(_0x2cbe('0x5'));var moment=require(_0x2cbe('0x6'));var BPromise=require(_0x2cbe('0x7'));var Mustache=require(_0x2cbe('0x8'));var util=require(_0x2cbe('0x9'));var path=require(_0x2cbe('0xa'));var sox=require(_0x2cbe('0xb'));var csv=require('to-csv');var ejs=require(_0x2cbe('0xc'));var fs=require('fs');var _=require(_0x2cbe('0xd'));var squel=require(_0x2cbe('0xe'));var crypto=require('crypto');var jsforce=require(_0x2cbe('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2cbe('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2cbe('0x11'));var logger=require(_0x2cbe('0x12'))('api');var utils=require(_0x2cbe('0x13'));var config=require(_0x2cbe('0x14'));var db=require(_0x2cbe('0x15'))['db'];function respondWithStatusCode(_0x256b9d,_0x5c1df5){_0x5c1df5=_0x5c1df5||0xcc;return function(_0x135312){if(_0x135312){return _0x256b9d[_0x2cbe('0x16')](_0x5c1df5);}return _0x256b9d[_0x2cbe('0x17')](_0x5c1df5)['end']();};}function respondWithResult(_0x40a798,_0x43886e){_0x43886e=_0x43886e||0xc8;return function(_0x1c6d06){if(_0x1c6d06){return _0x40a798['status'](_0x43886e)[_0x2cbe('0x18')](_0x1c6d06);}};}function respondWithFilteredResult(_0x50426d,_0x323f11){return function(_0x511bfb){if(_0x511bfb){var _0x44ffa1=_0x511bfb['count'],_0x91a744=_0x323f11[_0x2cbe('0x19')],_0x55205d=_0x323f11[_0x2cbe('0x19')]+_0x323f11['limit'],_0xed98c3;if(_0x55205d>=_0x44ffa1){_0x55205d=_0x44ffa1;_0xed98c3=0xc8;}else{_0xed98c3=0xce;}_0x50426d[_0x2cbe('0x17')](_0xed98c3);return _0x50426d[_0x2cbe('0x1a')](_0x2cbe('0x1b'),_0x91a744+'-'+_0x55205d+'/'+_0x44ffa1)['json'](_0x511bfb);}return null;};}function patchUpdates(_0xdc3ade){return function(_0x588c8e){try{jsonpatch[_0x2cbe('0x1c')](_0x588c8e,_0xdc3ade,!![]);}catch(_0x26add0){return BPromise[_0x2cbe('0x1d')](_0x26add0);}return _0x588c8e[_0x2cbe('0x1e')]();};}function saveUpdates(_0x3ab45d,_0x28f2e5){return function(_0x392d75){if(_0x392d75){return _0x392d75[_0x2cbe('0x1f')](_0x3ab45d)[_0x2cbe('0x20')](function(_0x3f7161){return _0x3f7161;});}return null;};}function removeEntity(_0x2c6a96,_0x2d8d85){return function(_0x25032){if(_0x25032){return _0x25032[_0x2cbe('0x21')]()['then'](function(){_0x2c6a96[_0x2cbe('0x17')](0xcc)[_0x2cbe('0x22')]();});}};}function handleEntityNotFound(_0x5d926c,_0x40095b){return function(_0x593b22){if(!_0x593b22){_0x5d926c[_0x2cbe('0x16')](0x194);}return _0x593b22;};}function handleError(_0x11aab1,_0x1c94b9){_0x1c94b9=_0x1c94b9||0x1f4;return function(_0x3e631a){logger[_0x2cbe('0x23')](_0x3e631a['stack']);if(_0x3e631a[_0x2cbe('0x24')]){delete _0x3e631a[_0x2cbe('0x24')];}_0x11aab1[_0x2cbe('0x17')](_0x1c94b9)[_0x2cbe('0x25')](_0x3e631a);};}exports[_0x2cbe('0x26')]=function(_0x442699,_0x48a1f4){var _0x93dfe3={},_0x3b843d={},_0x2cb49d={'count':0x0,'rows':[]};var _0x345613=_['map'](db[_0x2cbe('0x27')][_0x2cbe('0x28')],function(_0x7502ce){return{'name':_0x7502ce[_0x2cbe('0x29')],'type':_0x7502ce[_0x2cbe('0x2a')]['key']};});_0x3b843d[_0x2cbe('0x2b')]=_['map'](_0x345613,_0x2cbe('0x24'));_0x3b843d[_0x2cbe('0x2c')]=_[_0x2cbe('0x2d')](_0x442699[_0x2cbe('0x2c')]);_0x3b843d[_0x2cbe('0x2e')]=_['intersection'](_0x3b843d[_0x2cbe('0x2b')],_0x3b843d[_0x2cbe('0x2c')]);_0x93dfe3[_0x2cbe('0x2f')]=_['intersection'](_0x3b843d[_0x2cbe('0x2b')],qs[_0x2cbe('0x30')](_0x442699[_0x2cbe('0x2c')][_0x2cbe('0x30')]));_0x93dfe3[_0x2cbe('0x2f')]=_0x93dfe3[_0x2cbe('0x2f')][_0x2cbe('0x31')]?_0x93dfe3[_0x2cbe('0x2f')]:_0x3b843d[_0x2cbe('0x2b')];if(!_0x442699['query'][_0x2cbe('0x32')]('nolimit')){_0x93dfe3[_0x2cbe('0x33')]=qs[_0x2cbe('0x33')](_0x442699['query'][_0x2cbe('0x33')]);_0x93dfe3[_0x2cbe('0x19')]=qs['offset'](_0x442699[_0x2cbe('0x2c')][_0x2cbe('0x19')]);}_0x93dfe3[_0x2cbe('0x34')]=qs[_0x2cbe('0x35')](_0x442699[_0x2cbe('0x2c')][_0x2cbe('0x35')]);_0x93dfe3['where']=qs[_0x2cbe('0x2e')](_[_0x2cbe('0x36')](_0x442699[_0x2cbe('0x2c')],_0x3b843d['filters']),_0x345613);if(_0x442699[_0x2cbe('0x2c')][_0x2cbe('0x37')]){_0x93dfe3[_0x2cbe('0x38')]=_[_0x2cbe('0x39')](_0x93dfe3['where'],{'$or':_['map'](_0x345613,function(_0x3a3bf4){if(_0x3a3bf4[_0x2cbe('0x2a')]!==_0x2cbe('0x3a')){var _0x5e9572={};_0x5e9572[_0x3a3bf4['name']]={'$like':'%'+_0x442699[_0x2cbe('0x2c')][_0x2cbe('0x37')]+'%'};return _0x5e9572;}})});}_0x93dfe3=_[_0x2cbe('0x39')]({},_0x93dfe3,_0x442699[_0x2cbe('0x3b')]);var _0x24894e={'where':_0x93dfe3['where']};return db['SugarcrmField'][_0x2cbe('0x3c')](_0x24894e)['then'](function(_0x351ef5){_0x2cb49d[_0x2cbe('0x3c')]=_0x351ef5;if(_0x442699['query'][_0x2cbe('0x3d')]){_0x93dfe3[_0x2cbe('0x3e')]=[{'all':!![]}];}return db['SugarcrmField'][_0x2cbe('0x3f')](_0x93dfe3);})['then'](function(_0x30ffac){_0x2cb49d[_0x2cbe('0x40')]=_0x30ffac;return _0x2cb49d;})[_0x2cbe('0x20')](respondWithFilteredResult(_0x48a1f4,_0x93dfe3))[_0x2cbe('0x41')](handleError(_0x48a1f4,null));};exports[_0x2cbe('0x42')]=function(_0x2f2819,_0x4eb30f){var _0x3c3297={'raw':!![],'where':{'id':_0x2f2819[_0x2cbe('0x43')]['id']}},_0x14e48c={};_0x14e48c['model']=_['keys'](db['SugarcrmField'][_0x2cbe('0x28')]);_0x14e48c[_0x2cbe('0x2c')]=_['keys'](_0x2f2819[_0x2cbe('0x2c')]);_0x14e48c[_0x2cbe('0x2e')]=_[_0x2cbe('0x44')](_0x14e48c[_0x2cbe('0x2b')],_0x14e48c[_0x2cbe('0x2c')]);_0x3c3297['attributes']=_[_0x2cbe('0x44')](_0x14e48c['model'],qs[_0x2cbe('0x30')](_0x2f2819[_0x2cbe('0x2c')][_0x2cbe('0x30')]));_0x3c3297['attributes']=_0x3c3297[_0x2cbe('0x2f')][_0x2cbe('0x31')]?_0x3c3297[_0x2cbe('0x2f')]:_0x14e48c[_0x2cbe('0x2b')];if(_0x2f2819[_0x2cbe('0x2c')]['includeAll']){_0x3c3297[_0x2cbe('0x3e')]=[{'all':!![]}];}_0x3c3297=_[_0x2cbe('0x39')]({},_0x3c3297,_0x2f2819[_0x2cbe('0x3b')]);return db[_0x2cbe('0x27')]['find'](_0x3c3297)[_0x2cbe('0x20')](handleEntityNotFound(_0x4eb30f,null))[_0x2cbe('0x20')](respondWithResult(_0x4eb30f,null))[_0x2cbe('0x41')](handleError(_0x4eb30f,null));};exports[_0x2cbe('0x45')]=function(_0x41ffb0,_0x516047){return db['SugarcrmField'][_0x2cbe('0x45')](_0x41ffb0['body'],{})[_0x2cbe('0x20')](respondWithResult(_0x516047,0xc9))[_0x2cbe('0x41')](handleError(_0x516047,null));};exports['update']=function(_0x44c016,_0x183faa){if(_0x44c016['body']['id']){delete _0x44c016[_0x2cbe('0x46')]['id'];}return db[_0x2cbe('0x27')][_0x2cbe('0x47')]({'where':{'id':_0x44c016[_0x2cbe('0x43')]['id']}})[_0x2cbe('0x20')](handleEntityNotFound(_0x183faa,null))[_0x2cbe('0x20')](saveUpdates(_0x44c016[_0x2cbe('0x46')],null))[_0x2cbe('0x20')](respondWithResult(_0x183faa,null))[_0x2cbe('0x41')](handleError(_0x183faa,null));};exports[_0x2cbe('0x21')]=function(_0x2d78b3,_0xc4ad1f){return db[_0x2cbe('0x27')][_0x2cbe('0x47')]({'where':{'id':_0x2d78b3['params']['id']}})[_0x2cbe('0x20')](handleEntityNotFound(_0xc4ad1f,null))['then'](removeEntity(_0xc4ad1f,null))['catch'](handleError(_0xc4ad1f,null));}; \ No newline at end of file +var _0xf49f=['then','error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update'];(function(_0x1857d0,_0x6eade0){var _0x3e3c46=function(_0x3915b8){while(--_0x3915b8){_0x1857d0['push'](_0x1857d0['shift']());}};_0x3e3c46(++_0x6eade0);}(_0xf49f,0xff));var _0xff49=function(_0x28e4f2,_0x4dad23){_0x28e4f2=_0x28e4f2-0x0;var _0x4ba25b=_0xf49f[_0x28e4f2];return _0x4ba25b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xff49('0x0'));var rimraf=require(_0xff49('0x1'));var zipdir=require(_0xff49('0x2'));var jsonpatch=require(_0xff49('0x3'));var rp=require(_0xff49('0x4'));var moment=require('moment');var BPromise=require(_0xff49('0x5'));var Mustache=require(_0xff49('0x6'));var util=require(_0xff49('0x7'));var path=require('path');var sox=require(_0xff49('0x8'));var csv=require(_0xff49('0x9'));var ejs=require(_0xff49('0xa'));var fs=require('fs');var _=require(_0xff49('0xb'));var squel=require('squel');var crypto=require(_0xff49('0xc'));var jsforce=require(_0xff49('0xd'));var deskjs=require(_0xff49('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xff49('0xf'));var Redis=require(_0xff49('0x10'));var authService=require(_0xff49('0x11'));var qs=require(_0xff49('0x12'));var as=require(_0xff49('0x13'));var hardwareService=require(_0xff49('0x14'));var logger=require('../../config/logger')(_0xff49('0x15'));var utils=require('../../config/utils');var config=require(_0xff49('0x16'));var db=require(_0xff49('0x17'))['db'];function respondWithStatusCode(_0x3bc796,_0x167f3c){_0x167f3c=_0x167f3c||0xcc;return function(_0x2d2250){if(_0x2d2250){return _0x3bc796[_0xff49('0x18')](_0x167f3c);}return _0x3bc796[_0xff49('0x19')](_0x167f3c)[_0xff49('0x1a')]();};}function respondWithResult(_0x4c4f32,_0x152e5a){_0x152e5a=_0x152e5a||0xc8;return function(_0x352594){if(_0x352594){return _0x4c4f32['status'](_0x152e5a)['json'](_0x352594);}};}function respondWithFilteredResult(_0x5c0928,_0x14fe01){return function(_0x1fb6c4){if(_0x1fb6c4){var _0x514e06=_0x1fb6c4[_0xff49('0x1b')],_0x67e272=_0x14fe01[_0xff49('0x1c')],_0x557567=_0x14fe01['offset']+_0x14fe01[_0xff49('0x1d')],_0x210958;if(_0x557567>=_0x514e06){_0x557567=_0x514e06;_0x210958=0xc8;}else{_0x210958=0xce;}_0x5c0928[_0xff49('0x19')](_0x210958);return _0x5c0928[_0xff49('0x1e')](_0xff49('0x1f'),_0x67e272+'-'+_0x557567+'/'+_0x514e06)[_0xff49('0x20')](_0x1fb6c4);}return null;};}function patchUpdates(_0x13d1ab){return function(_0x35a57d){try{jsonpatch[_0xff49('0x21')](_0x35a57d,_0x13d1ab,!![]);}catch(_0x4c46c8){return BPromise[_0xff49('0x22')](_0x4c46c8);}return _0x35a57d[_0xff49('0x23')]();};}function saveUpdates(_0x469e91,_0x547158){return function(_0x2db5da){if(_0x2db5da){return _0x2db5da[_0xff49('0x24')](_0x469e91)[_0xff49('0x25')](function(_0x2ac561){return _0x2ac561;});}return null;};}function removeEntity(_0x481e92,_0x256243){return function(_0xb23ab6){if(_0xb23ab6){return _0xb23ab6['destroy']()[_0xff49('0x25')](function(){_0x481e92['status'](0xcc)[_0xff49('0x1a')]();});}};}function handleEntityNotFound(_0x21c7d8,_0x3ee18f){return function(_0x4ef45b){if(!_0x4ef45b){_0x21c7d8['sendStatus'](0x194);}return _0x4ef45b;};}function handleError(_0x5cf3da,_0x486c57){_0x486c57=_0x486c57||0x1f4;return function(_0x52e94d){logger[_0xff49('0x26')](_0x52e94d[_0xff49('0x27')]);if(_0x52e94d[_0xff49('0x28')]){delete _0x52e94d['name'];}_0x5cf3da[_0xff49('0x19')](_0x486c57)['send'](_0x52e94d);};}exports[_0xff49('0x29')]=function(_0x29c40f,_0x44c21b){var _0x30d570={},_0x244282={},_0x3983e6={'count':0x0,'rows':[]};var _0x1f49b1=_[_0xff49('0x2a')](db[_0xff49('0x2b')][_0xff49('0x2c')],function(_0x289654){return{'name':_0x289654[_0xff49('0x2d')],'type':_0x289654[_0xff49('0x2e')][_0xff49('0x2f')]};});_0x244282[_0xff49('0x30')]=_[_0xff49('0x2a')](_0x1f49b1,_0xff49('0x28'));_0x244282[_0xff49('0x31')]=_[_0xff49('0x32')](_0x29c40f[_0xff49('0x31')]);_0x244282[_0xff49('0x33')]=_['intersection'](_0x244282[_0xff49('0x30')],_0x244282[_0xff49('0x31')]);_0x30d570[_0xff49('0x34')]=_[_0xff49('0x35')](_0x244282[_0xff49('0x30')],qs[_0xff49('0x36')](_0x29c40f[_0xff49('0x31')][_0xff49('0x36')]));_0x30d570['attributes']=_0x30d570[_0xff49('0x34')][_0xff49('0x37')]?_0x30d570[_0xff49('0x34')]:_0x244282['model'];if(!_0x29c40f[_0xff49('0x31')]['hasOwnProperty'](_0xff49('0x38'))){_0x30d570['limit']=qs[_0xff49('0x1d')](_0x29c40f[_0xff49('0x31')][_0xff49('0x1d')]);_0x30d570[_0xff49('0x1c')]=qs[_0xff49('0x1c')](_0x29c40f[_0xff49('0x31')]['offset']);}_0x30d570[_0xff49('0x39')]=qs[_0xff49('0x3a')](_0x29c40f[_0xff49('0x31')][_0xff49('0x3a')]);_0x30d570[_0xff49('0x3b')]=qs[_0xff49('0x33')](_[_0xff49('0x3c')](_0x29c40f[_0xff49('0x31')],_0x244282[_0xff49('0x33')]),_0x1f49b1);if(_0x29c40f[_0xff49('0x31')][_0xff49('0x3d')]){_0x30d570[_0xff49('0x3b')]=_[_0xff49('0x3e')](_0x30d570[_0xff49('0x3b')],{'$or':_['map'](_0x1f49b1,function(_0x1641f4){if(_0x1641f4[_0xff49('0x2e')]!==_0xff49('0x3f')){var _0x13d86f={};_0x13d86f[_0x1641f4[_0xff49('0x28')]]={'$like':'%'+_0x29c40f[_0xff49('0x31')][_0xff49('0x3d')]+'%'};return _0x13d86f;}})});}_0x30d570=_[_0xff49('0x3e')]({},_0x30d570,_0x29c40f['options']);var _0x5143f3={'where':_0x30d570[_0xff49('0x3b')]};return db['SugarcrmField']['count'](_0x5143f3)[_0xff49('0x25')](function(_0x16b021){_0x3983e6[_0xff49('0x1b')]=_0x16b021;if(_0x29c40f['query'][_0xff49('0x40')]){_0x30d570['include']=[{'all':!![]}];}return db[_0xff49('0x2b')][_0xff49('0x41')](_0x30d570);})[_0xff49('0x25')](function(_0x49f94b){_0x3983e6['rows']=_0x49f94b;return _0x3983e6;})['then'](respondWithFilteredResult(_0x44c21b,_0x30d570))['catch'](handleError(_0x44c21b,null));};exports[_0xff49('0x42')]=function(_0x13d5d0,_0x5eb3e1){var _0x187acc={'raw':!![],'where':{'id':_0x13d5d0[_0xff49('0x43')]['id']}},_0x3df9a6={};_0x3df9a6[_0xff49('0x30')]=_['keys'](db[_0xff49('0x2b')][_0xff49('0x2c')]);_0x3df9a6[_0xff49('0x31')]=_['keys'](_0x13d5d0[_0xff49('0x31')]);_0x3df9a6[_0xff49('0x33')]=_['intersection'](_0x3df9a6['model'],_0x3df9a6[_0xff49('0x31')]);_0x187acc[_0xff49('0x34')]=_[_0xff49('0x35')](_0x3df9a6[_0xff49('0x30')],qs[_0xff49('0x36')](_0x13d5d0[_0xff49('0x31')][_0xff49('0x36')]));_0x187acc[_0xff49('0x34')]=_0x187acc[_0xff49('0x34')][_0xff49('0x37')]?_0x187acc['attributes']:_0x3df9a6[_0xff49('0x30')];if(_0x13d5d0[_0xff49('0x31')][_0xff49('0x40')]){_0x187acc['include']=[{'all':!![]}];}_0x187acc=_[_0xff49('0x3e')]({},_0x187acc,_0x13d5d0[_0xff49('0x44')]);return db[_0xff49('0x2b')][_0xff49('0x45')](_0x187acc)[_0xff49('0x25')](handleEntityNotFound(_0x5eb3e1,null))[_0xff49('0x25')](respondWithResult(_0x5eb3e1,null))[_0xff49('0x46')](handleError(_0x5eb3e1,null));};exports[_0xff49('0x47')]=function(_0x8a9286,_0x6b4a02){return db[_0xff49('0x2b')]['create'](_0x8a9286['body'],{})['then'](respondWithResult(_0x6b4a02,0xc9))[_0xff49('0x46')](handleError(_0x6b4a02,null));};exports['update']=function(_0x329bac,_0x10738b){if(_0x329bac[_0xff49('0x48')]['id']){delete _0x329bac[_0xff49('0x48')]['id'];}return db['SugarcrmField'][_0xff49('0x45')]({'where':{'id':_0x329bac[_0xff49('0x43')]['id']}})[_0xff49('0x25')](handleEntityNotFound(_0x10738b,null))['then'](saveUpdates(_0x329bac['body'],null))['then'](respondWithResult(_0x10738b,null))[_0xff49('0x46')](handleError(_0x10738b,null));};exports['destroy']=function(_0x36cbed,_0x2b8cd7){return db[_0xff49('0x2b')][_0xff49('0x45')]({'where':{'id':_0x36cbed[_0xff49('0x43')]['id']}})[_0xff49('0x25')](handleEntityNotFound(_0x2b8cd7,null))[_0xff49('0x25')](removeEntity(_0x2b8cd7,null))['catch'](handleError(_0x2b8cd7,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index bfc519e..5edb097 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 _0x34ef=['idField','lodash','util','api','moment','request-promise','path','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x34ef,0x105));var _0xf34e=function(_0x338ea6,_0x51f7c7){_0x338ea6=_0x338ea6-0x0;var _0xaaeee5=_0x34ef[_0x338ea6];return _0xaaeee5;};'use strict';var _=require(_0xf34e('0x0'));var util=require(_0xf34e('0x1'));var logger=require('../../config/logger')(_0xf34e('0x2'));var moment=require(_0xf34e('0x3'));var BPromise=require('bluebird');var rp=require(_0xf34e('0x4'));var fs=require('fs');var path=require(_0xf34e('0x5'));var rimraf=require(_0xf34e('0x6'));var config=require('../../config/environment');var attributes=require(_0xf34e('0x7'));module[_0xf34e('0x8')]=function(_0x3d2e83,_0x2d6456){return _0x3d2e83[_0xf34e('0x9')](_0xf34e('0xa'),attributes,{'tableName':_0xf34e('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xf34e('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x71e5=['request-promise','path','exports','define','SugarcrmField','int_sugarcrm_fields','lodash','util','../../config/logger','api','bluebird'];(function(_0x39bf57,_0x3cbdaf){var _0xf5ee77=function(_0x5cd6e6){while(--_0x5cd6e6){_0x39bf57['push'](_0x39bf57['shift']());}};_0xf5ee77(++_0x3cbdaf);}(_0x71e5,0x1a8));var _0x571e=function(_0x5ec61d,_0x36c73c){_0x5ec61d=_0x5ec61d-0x0;var _0x2e0e5c=_0x71e5[_0x5ec61d];return _0x2e0e5c;};'use strict';var _=require(_0x571e('0x0'));var util=require(_0x571e('0x1'));var logger=require(_0x571e('0x2'))(_0x571e('0x3'));var moment=require('moment');var BPromise=require(_0x571e('0x4'));var rp=require(_0x571e('0x5'));var fs=require('fs');var path=require(_0x571e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0x571e('0x7')]=function(_0x303a61,_0x5477c2){return _0x303a61[_0x571e('0x8')](_0x571e('0x9'),attributes,{'tableName':_0x571e('0xa'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index ba1aa42..a2737d5 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x7b3971,_0x478061){var _0x457887=function(_0x3c48c4){while(--_0x3c48c4){_0x7b3971['push'](_0x7b3971['shift']());}};_0x457887(++_0x478061);}(_0x1a85,0x178));var _0x51a8=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0x1a85[_0x506172];return _0x2723c0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0x0b0e=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug'];(function(_0x3818c0,_0x542521){var _0x55ec33=function(_0x2be9ea){while(--_0x2be9ea){_0x3818c0['push'](_0x3818c0['shift']());}};_0x55ec33(++_0x542521);}(_0x0b0e,0x187));var _0xe0b0=function(_0x114bdf,_0x119ada){_0x114bdf=_0x114bdf-0x0;var _0x5658f6=_0x0b0e[_0x114bdf];return _0x5658f6;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 9b090e8..2baa223 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 _0x01b7=['../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4eaf7e,_0x2afb74){var _0x31cb6a=function(_0x1c4708){while(--_0x1c4708){_0x4eaf7e['push'](_0x4eaf7e['shift']());}};_0x31cb6a(++_0x2afb74);}(_0x01b7,0x170));var _0x701b=function(_0x387953,_0x2ef78e){_0x387953=_0x387953-0x0;var _0x325c9c=_0x01b7[_0x387953];return _0x325c9c;};'use strict';var multer=require(_0x701b('0x0'));var util=require(_0x701b('0x1'));var path=require(_0x701b('0x2'));var timeout=require(_0x701b('0x3'));var express=require(_0x701b('0x4'));var router=express[_0x701b('0x5')]();var auth=require(_0x701b('0x6'));var interaction=require(_0x701b('0x7'));var config=require(_0x701b('0x8'));var controller=require(_0x701b('0x9'));router[_0x701b('0xa')]('/',auth[_0x701b('0xb')](),controller[_0x701b('0xc')]);router[_0x701b('0xa')](_0x701b('0xd'),auth[_0x701b('0xb')](),controller[_0x701b('0xe')]);router[_0x701b('0xa')](_0x701b('0xf'),auth[_0x701b('0xb')](),controller[_0x701b('0x10')]);router[_0x701b('0xa')]('/:id/fields',auth[_0x701b('0xb')](),controller[_0x701b('0x11')]);router[_0x701b('0x12')]('/',auth[_0x701b('0xb')](),controller[_0x701b('0x13')]);router[_0x701b('0x12')](_0x701b('0xf'),auth['isAuthenticated'](),controller[_0x701b('0x14')]);router[_0x701b('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x701b('0x16')](_0x701b('0xd'),auth[_0x701b('0xb')](),controller[_0x701b('0x17')]);module[_0x701b('0x18')]=router; \ No newline at end of file +var _0xd2b2=['/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0x310d55,_0x5a3c94){var _0x26b2bf=function(_0x1c4c62){while(--_0x1c4c62){_0x310d55['push'](_0x310d55['shift']());}};_0x26b2bf(++_0x5a3c94);}(_0xd2b2,0x84));var _0x2d2b=function(_0x7810b2,_0xb0a07e){_0x7810b2=_0x7810b2-0x0;var _0x3179dd=_0xd2b2[_0x7810b2];return _0x3179dd;};'use strict';var multer=require(_0x2d2b('0x0'));var util=require('util');var path=require(_0x2d2b('0x1'));var timeout=require('connect-timeout');var express=require(_0x2d2b('0x2'));var router=express[_0x2d2b('0x3')]();var auth=require(_0x2d2b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2d2b('0x5'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x2d2b('0x6')](),controller[_0x2d2b('0x7')]);router['get'](_0x2d2b('0x8'),auth[_0x2d2b('0x6')](),controller[_0x2d2b('0x9')]);router['get'](_0x2d2b('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x2d2b('0xb'),auth[_0x2d2b('0x6')](),controller[_0x2d2b('0xc')]);router[_0x2d2b('0xd')]('/',auth[_0x2d2b('0x6')](),controller[_0x2d2b('0xe')]);router[_0x2d2b('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x2d2b('0xf')]);router[_0x2d2b('0x10')](_0x2d2b('0x8'),auth[_0x2d2b('0x6')](),controller[_0x2d2b('0x11')]);router[_0x2d2b('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2d2b('0x13')]);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 a0bf794..10e1d67 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 _0x587a=['HelpDesk','STRING'];(function(_0x2842b4,_0x2b1b7b){var _0x2b9521=function(_0x3613b8){while(--_0x3613b8){_0x2842b4['push'](_0x2842b4['shift']());}};_0x2b9521(++_0x2b1b7b);}(_0x587a,0xc9));var _0xa587=function(_0x3c0a36,_0x8e2f2b){_0x3c0a36=_0x3c0a36-0x0;var _0x5ac4cb=_0x587a[_0x3c0a36];return _0x5ac4cb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa587('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xa587('0x0')]},'username':{'type':Sequelize[_0xa587('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xa587('0x0')],'allowNull':![],'defaultValue':_0xa587('0x1')},'remoteUri':{'type':Sequelize[_0xa587('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xec15=['exports','STRING','sequelize'];(function(_0x276337,_0x53bb55){var _0x57dc6b=function(_0x5cf0b8){while(--_0x5cf0b8){_0x276337['push'](_0x276337['shift']());}};_0x57dc6b(++_0x53bb55);}(_0xec15,0x19a));var _0x5ec1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec15[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x5ec1('0x0'));module[_0x5ec1('0x1')]={'name':{'type':Sequelize[_0x5ec1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5ec1('0x2')]},'username':{'type':Sequelize[_0x5ec1('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x5ec1('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5ec1('0x2')]},'accessKey':{'type':Sequelize[_0x5ec1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 5d28ac7..b448c94 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 _0xf142=['Sequelize','ValidationError','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','name','index','map','VtigerAccount','rawAttributes','fieldName','type','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','intersection','find','create','body','destroy','getConfigurations','findOne','addConfiguration','Subjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','getFields','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','username','success','login','describe','sessionName','autogenerated','reference','remove','editable','false','cf_','picklistValues','label','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','test'];(function(_0x4a2398,_0x21dd6f){var _0x1c0d02=function(_0x156f41){while(--_0x156f41){_0x4a2398['push'](_0x4a2398['shift']());}};_0x1c0d02(++_0x21dd6f);}(_0xf142,0x15f));var _0x2f14=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xf142[_0x20a558];return _0x53d3f7;};'use strict';var pdf=require(_0x2f14('0x0'));var emlformat=require(_0x2f14('0x1'));var rimraf=require(_0x2f14('0x2'));var zipdir=require(_0x2f14('0x3'));var jsonpatch=require(_0x2f14('0x4'));var rp=require(_0x2f14('0x5'));var moment=require(_0x2f14('0x6'));var BPromise=require(_0x2f14('0x7'));var Mustache=require('mustache');var util=require(_0x2f14('0x8'));var path=require(_0x2f14('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2f14('0xa'));var fs=require('fs');var _=require(_0x2f14('0xb'));var squel=require('squel');var crypto=require(_0x2f14('0xc'));var jsforce=require(_0x2f14('0xd'));var deskjs=require(_0x2f14('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2f14('0xf'));var Papa=require(_0x2f14('0x10'));var Redis=require('ioredis');var authService=require(_0x2f14('0x11'));var qs=require(_0x2f14('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f14('0x13'));var logger=require(_0x2f14('0x14'))('api');var utils=require(_0x2f14('0x15'));var config=require(_0x2f14('0x16'));var db=require(_0x2f14('0x17'))['db'];var integrations=require(_0x2f14('0x18'));var jayson=require(_0x2f14('0x19'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x1bec7b,_0x2bb901,_0x12df3f){if(_0x12df3f){var _0x3412c0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3412c0[_0x2f14('0x1a')](_0x2bb901)){return _0x1bec7b;}else{throw new db[(_0x2f14('0x1b'))][(_0x2f14('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1bec7b;}}function respondWithRpcPromise(_0x1382cd,_0x5a8609,_0x332921,_0x8439dd){return new BPromise(function(_0xe05102,_0x41bd56){var _0x16257d=_0x8439dd||client;return _0x16257d[_0x2f14('0x1d')](_0x1382cd,_0x332921)['then'](function(_0x10a2c8){logger[_0x2f14('0x1e')](_0x2f14('0x1f'),_0x5a8609,_0x2f14('0x20'));logger['debug'](_0x2f14('0x21'),_0x5a8609,_0x2f14('0x20'),JSON[_0x2f14('0x22')](_0x10a2c8));if(_0x10a2c8[_0x2f14('0x23')]){if(_0x10a2c8[_0x2f14('0x23')][_0x2f14('0x24')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x5a8609,_0x10a2c8[_0x2f14('0x23')][_0x2f14('0x25')]);return _0x41bd56(_0x10a2c8[_0x2f14('0x23')][_0x2f14('0x25')]);}logger[_0x2f14('0x23')](_0x2f14('0x1f'),_0x5a8609,_0x10a2c8['error'][_0x2f14('0x25')]);return _0xe05102(_0x10a2c8[_0x2f14('0x23')][_0x2f14('0x25')]);}else{logger[_0x2f14('0x1e')](_0x2f14('0x1f'),_0x5a8609,'request\x20sent');_0xe05102(_0x10a2c8[_0x2f14('0x26')][_0x2f14('0x25')]);}})[_0x2f14('0x27')](function(_0xb69733){logger[_0x2f14('0x23')](_0x2f14('0x1f'),_0x5a8609,_0xb69733);_0x41bd56(_0xb69733);});});}function respondWithStatusCode(_0x58326f,_0x403e74){_0x403e74=_0x403e74||0xcc;return function(_0xccfb3b){if(_0xccfb3b){return _0x58326f[_0x2f14('0x28')](_0x403e74);}return _0x58326f[_0x2f14('0x29')](_0x403e74)[_0x2f14('0x2a')]();};}function respondWithResult(_0x3d2d0a,_0x34401a){_0x34401a=_0x34401a||0xc8;return function(_0x3c0396){if(_0x3c0396){return _0x3d2d0a[_0x2f14('0x29')](_0x34401a)['json'](_0x3c0396);}};}function respondWithFilteredResult(_0x1a1763,_0x21585e){return function(_0xdddc0){if(_0xdddc0){var _0x38c28a=_0xdddc0[_0x2f14('0x2b')],_0x1f152e=_0x21585e['offset'],_0x1a9cfc=_0x21585e[_0x2f14('0x2c')]+_0x21585e[_0x2f14('0x2d')],_0x319714;if(_0x1a9cfc>=_0x38c28a){_0x1a9cfc=_0x38c28a;_0x319714=0xc8;}else{_0x319714=0xce;}_0x1a1763[_0x2f14('0x29')](_0x319714);return _0x1a1763[_0x2f14('0x2e')](_0x2f14('0x2f'),_0x1f152e+'-'+_0x1a9cfc+'/'+_0x38c28a)[_0x2f14('0x30')](_0xdddc0);}return null;};}function patchUpdates(_0x4a05d7){return function(_0x541967){try{jsonpatch[_0x2f14('0x31')](_0x541967,_0x4a05d7,!![]);}catch(_0x317e6b){return BPromise[_0x2f14('0x32')](_0x317e6b);}return _0x541967[_0x2f14('0x33')]();};}function saveUpdates(_0x2b110b,_0x341d04){return function(_0x2c232b){if(_0x2c232b){return _0x2c232b[_0x2f14('0x34')](_0x2b110b)[_0x2f14('0x35')](function(_0x192a63){return _0x192a63;});}return null;};}function removeEntity(_0x20b0b5,_0xca4bd4){return function(_0x1682dc){if(_0x1682dc){return _0x1682dc['destroy']()[_0x2f14('0x35')](function(){_0x20b0b5[_0x2f14('0x29')](0xcc)[_0x2f14('0x2a')]();});}};}function handleEntityNotFound(_0x20e9f0,_0x87b9a0){return function(_0x2f240){if(!_0x2f240){_0x20e9f0[_0x2f14('0x28')](0x194);}return _0x2f240;};}function handleError(_0x50f161,_0x49d386){_0x49d386=_0x49d386||0x1f4;return function(_0x5c81ec){logger[_0x2f14('0x23')](_0x5c81ec['stack']);if(_0x5c81ec[_0x2f14('0x36')]){delete _0x5c81ec['name'];}_0x50f161[_0x2f14('0x29')](_0x49d386)['send'](_0x5c81ec);};}exports[_0x2f14('0x37')]=function(_0x1c4320,_0x4004c5){var _0x5eeb87={},_0x31f201={},_0x17f75c={'count':0x0,'rows':[]};var _0x3e6117=_[_0x2f14('0x38')](db[_0x2f14('0x39')][_0x2f14('0x3a')],function(_0x51185e){return{'name':_0x51185e[_0x2f14('0x3b')],'type':_0x51185e[_0x2f14('0x3c')]['key']};});_0x31f201['model']=_[_0x2f14('0x38')](_0x3e6117,'name');_0x31f201['query']=_[_0x2f14('0x3d')](_0x1c4320[_0x2f14('0x3e')]);_0x31f201[_0x2f14('0x3f')]=_['intersection'](_0x31f201[_0x2f14('0x40')],_0x31f201[_0x2f14('0x3e')]);_0x5eeb87[_0x2f14('0x41')]=_['intersection'](_0x31f201[_0x2f14('0x40')],qs['fields'](_0x1c4320[_0x2f14('0x3e')][_0x2f14('0x42')]));_0x5eeb87[_0x2f14('0x41')]=_0x5eeb87[_0x2f14('0x41')][_0x2f14('0x43')]?_0x5eeb87[_0x2f14('0x41')]:_0x31f201[_0x2f14('0x40')];if(!_0x1c4320['query'][_0x2f14('0x44')](_0x2f14('0x45'))){_0x5eeb87[_0x2f14('0x2d')]=qs[_0x2f14('0x2d')](_0x1c4320[_0x2f14('0x3e')]['limit']);_0x5eeb87['offset']=qs['offset'](_0x1c4320[_0x2f14('0x3e')]['offset']);}_0x5eeb87[_0x2f14('0x46')]=qs[_0x2f14('0x47')](_0x1c4320[_0x2f14('0x3e')][_0x2f14('0x47')]);_0x5eeb87[_0x2f14('0x48')]=qs[_0x2f14('0x3f')](_[_0x2f14('0x49')](_0x1c4320['query'],_0x31f201[_0x2f14('0x3f')]),_0x3e6117);if(_0x1c4320[_0x2f14('0x3e')][_0x2f14('0x4a')]){_0x5eeb87['where']=_[_0x2f14('0x4b')](_0x5eeb87[_0x2f14('0x48')],{'$or':_[_0x2f14('0x38')](_0x3e6117,function(_0x1acd63){if(_0x1acd63['type']!==_0x2f14('0x4c')){var _0x5a9419={};_0x5a9419[_0x1acd63['name']]={'$like':'%'+_0x1c4320['query']['filter']+'%'};return _0x5a9419;}})});}_0x5eeb87=_[_0x2f14('0x4b')]({},_0x5eeb87,_0x1c4320[_0x2f14('0x4d')]);var _0x2b8116={'where':_0x5eeb87[_0x2f14('0x48')]};return db['VtigerAccount'][_0x2f14('0x2b')](_0x2b8116)[_0x2f14('0x35')](function(_0x5189e9){_0x17f75c[_0x2f14('0x2b')]=_0x5189e9;if(_0x1c4320[_0x2f14('0x3e')][_0x2f14('0x4e')]){_0x5eeb87[_0x2f14('0x4f')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x5eeb87);})['then'](function(_0x52bad5){_0x17f75c[_0x2f14('0x50')]=_0x52bad5;return _0x17f75c;})['then'](respondWithFilteredResult(_0x4004c5,_0x5eeb87))[_0x2f14('0x27')](handleError(_0x4004c5,null));};exports['show']=function(_0x1a7b44,_0x5791a0){var _0x499d43={'raw':![],'where':{'id':_0x1a7b44[_0x2f14('0x51')]['id']}},_0x5cb182={};_0x5cb182[_0x2f14('0x40')]=_[_0x2f14('0x3d')](db[_0x2f14('0x39')]['rawAttributes']);_0x5cb182[_0x2f14('0x3e')]=_[_0x2f14('0x3d')](_0x1a7b44[_0x2f14('0x3e')]);_0x5cb182['filters']=_[_0x2f14('0x52')](_0x5cb182[_0x2f14('0x40')],_0x5cb182[_0x2f14('0x3e')]);_0x499d43[_0x2f14('0x41')]=_[_0x2f14('0x52')](_0x5cb182['model'],qs[_0x2f14('0x42')](_0x1a7b44[_0x2f14('0x3e')][_0x2f14('0x42')]));_0x499d43[_0x2f14('0x41')]=_0x499d43['attributes'][_0x2f14('0x43')]?_0x499d43['attributes']:_0x5cb182[_0x2f14('0x40')];if(_0x1a7b44[_0x2f14('0x3e')]['includeAll']){_0x499d43[_0x2f14('0x4f')]=[{'all':!![]}];}_0x499d43=_[_0x2f14('0x4b')]({},_0x499d43,_0x1a7b44['options']);return db[_0x2f14('0x39')][_0x2f14('0x53')](_0x499d43)[_0x2f14('0x35')](handleEntityNotFound(_0x5791a0,null))[_0x2f14('0x35')](respondWithResult(_0x5791a0,null))[_0x2f14('0x27')](handleError(_0x5791a0,null));};exports[_0x2f14('0x54')]=function(_0x593c5c,_0x5ef403){return db[_0x2f14('0x39')]['create'](_0x593c5c[_0x2f14('0x55')],{})[_0x2f14('0x35')](respondWithResult(_0x5ef403,0xc9))[_0x2f14('0x27')](handleError(_0x5ef403,null));};exports['update']=function(_0x8a5825,_0x5ed68b){if(_0x8a5825[_0x2f14('0x55')]['id']){delete _0x8a5825[_0x2f14('0x55')]['id'];}return db[_0x2f14('0x39')][_0x2f14('0x53')]({'where':{'id':_0x8a5825[_0x2f14('0x51')]['id']}})[_0x2f14('0x35')](handleEntityNotFound(_0x5ed68b,null))['then'](saveUpdates(_0x8a5825['body'],null))[_0x2f14('0x35')](respondWithResult(_0x5ed68b,null))['catch'](handleError(_0x5ed68b,null));};exports[_0x2f14('0x56')]=function(_0x5a9963,_0x5a1d62){return db[_0x2f14('0x39')][_0x2f14('0x53')]({'where':{'id':_0x5a9963[_0x2f14('0x51')]['id']}})[_0x2f14('0x35')](handleEntityNotFound(_0x5a1d62,null))[_0x2f14('0x35')](removeEntity(_0x5a1d62,null))[_0x2f14('0x27')](handleError(_0x5a1d62,null));};exports[_0x2f14('0x57')]=function(_0x266edc,_0xe11e27,_0x367ed9){var _0x37f84f={};var _0x598e60={};var _0x49826e;var _0xf4a679;return db[_0x2f14('0x39')][_0x2f14('0x58')]({'where':{'id':_0x266edc[_0x2f14('0x51')]['id']}})[_0x2f14('0x35')](handleEntityNotFound(_0xe11e27,null))['then'](function(_0x128096){if(_0x128096){_0x49826e=_0x128096;_0x598e60[_0x2f14('0x40')]=_['keys'](db['VtigerConfiguration'][_0x2f14('0x3a')]);_0x598e60[_0x2f14('0x3e')]=_['keys'](_0x266edc[_0x2f14('0x3e')]);_0x598e60[_0x2f14('0x3f')]=_[_0x2f14('0x52')](_0x598e60[_0x2f14('0x40')],_0x598e60[_0x2f14('0x3e')]);_0x37f84f[_0x2f14('0x41')]=_['intersection'](_0x598e60[_0x2f14('0x40')],qs['fields'](_0x266edc[_0x2f14('0x3e')][_0x2f14('0x42')]));_0x37f84f[_0x2f14('0x41')]=_0x37f84f['attributes'][_0x2f14('0x43')]?_0x37f84f['attributes']:_0x598e60[_0x2f14('0x40')];_0x37f84f[_0x2f14('0x46')]=qs[_0x2f14('0x47')](_0x266edc[_0x2f14('0x3e')]['sort']);_0x37f84f[_0x2f14('0x48')]=qs[_0x2f14('0x3f')](_[_0x2f14('0x49')](_0x266edc['query'],_0x598e60[_0x2f14('0x3f')]));if(_0x266edc[_0x2f14('0x3e')][_0x2f14('0x4a')]){_0x37f84f['where']=_[_0x2f14('0x4b')](_0x37f84f[_0x2f14('0x48')],{'$or':_[_0x2f14('0x38')](_0x37f84f['attributes'],function(_0x4c634e){var _0x1abd02={};_0x1abd02[_0x4c634e]={'$like':'%'+_0x266edc[_0x2f14('0x3e')][_0x2f14('0x4a')]+'%'};return _0x1abd02;})});}_0x37f84f=_[_0x2f14('0x4b')]({},_0x37f84f,_0x266edc[_0x2f14('0x4d')]);return _0x49826e[_0x2f14('0x57')](_0x37f84f);}})['then'](function(_0x42091b){if(_0x42091b){_0xf4a679=_0x42091b[_0x2f14('0x43')];if(!_0x266edc[_0x2f14('0x3e')]['hasOwnProperty'](_0x2f14('0x45'))){_0x37f84f[_0x2f14('0x2d')]=qs[_0x2f14('0x2d')](_0x266edc[_0x2f14('0x3e')][_0x2f14('0x2d')]);_0x37f84f[_0x2f14('0x2c')]=qs[_0x2f14('0x2c')](_0x266edc[_0x2f14('0x3e')][_0x2f14('0x2c')]);}return _0x49826e[_0x2f14('0x57')](_0x37f84f);}})[_0x2f14('0x35')](function(_0x3b728a){if(_0x3b728a){return _0x3b728a?{'count':_0xf4a679,'rows':_0x3b728a}:null;}})[_0x2f14('0x35')](respondWithResult(_0xe11e27,null))[_0x2f14('0x27')](handleError(_0xe11e27,null));};exports[_0x2f14('0x59')]=function(_0x4af67b,_0xc57732,_0x8239cc){if(_0x4af67b['body']['id']){delete _0x4af67b[_0x2f14('0x55')]['id'];}return db[_0x2f14('0x39')][_0x2f14('0x58')]({'where':{'id':_0x4af67b[_0x2f14('0x51')]['id']}})['then'](handleEntityNotFound(_0xc57732,null))[_0x2f14('0x35')](function(_0xf00a18){if(_0xf00a18){_0x4af67b['body']['AccountId']=_0xf00a18['id'];_0x4af67b[_0x2f14('0x55')][_0x2f14('0x5a')]=integrations['getSubjects'](_0x4af67b[_0x2f14('0x55')][_0x2f14('0x5b')],_0x4af67b['body'][_0x2f14('0x3c')]);_0x4af67b[_0x2f14('0x55')][_0x2f14('0x5c')]=integrations[_0x2f14('0x5d')](_0x4af67b[_0x2f14('0x55')][_0x2f14('0x5b')],_0x4af67b[_0x2f14('0x55')][_0x2f14('0x3c')]);return db[_0x2f14('0x5e')][_0x2f14('0x54')](_0x4af67b['body'],{'include':[{'model':db['VtigerField'],'as':_0x2f14('0x5a')},{'model':db[_0x2f14('0x5f')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xc57732,null))[_0x2f14('0x27')](handleError(_0xc57732,null));};var md5=require('md5');exports[_0x2f14('0x60')]=function(_0x315f37,_0x376ed5,_0x949a27){var _0x53c2e1=null;var _0x4ff015=null;var _0x12d5d8=null;var _0x409f5c=null;var _0x333aa5='';return db[_0x2f14('0x39')]['findOne']({'where':{'id':_0x315f37[_0x2f14('0x51')]['id']},'attributes':['id',_0x2f14('0x36'),'username',_0x2f14('0x61'),_0x2f14('0x62'),_0x2f14('0x63'),_0x2f14('0x64'),_0x2f14('0x65')]})['then'](handleEntityNotFound(_0x376ed5,null))[_0x2f14('0x35')](function(_0x5be4bb){if(_0x5be4bb){_0x53c2e1=_0x5be4bb['username'];_0x4ff015=_0x5be4bb[_0x2f14('0x65')];_0x12d5d8=_0x5be4bb['moduleName'];_0x333aa5=_0x5be4bb[_0x2f14('0x63')];var _0x3931a6=_0x333aa5[_0x2f14('0x66')](-0x1);if(_0x3931a6==='/'){_0x333aa5=_0x333aa5[_0x2f14('0x67')](0x0,_0x333aa5[_0x2f14('0x68')](_0x3931a6));}_0x409f5c=util[_0x2f14('0x69')](_0x2f14('0x6a'),_0x333aa5);var _0x315906={'method':_0x2f14('0x6b'),'uri':_0x409f5c,'qs':{'operation':_0x2f14('0x6c'),'username':_0x5be4bb[_0x2f14('0x6d')]},'json':!![]};return rp(_0x315906);}})[_0x2f14('0x35')](function(_0x406774){if(_0x406774[_0x2f14('0x6e')]){var _0x35b42c={'method':'POST','uri':_0x409f5c,'form':{'operation':_0x2f14('0x6f'),'username':_0x53c2e1,'accessKey':md5(_0x406774[_0x2f14('0x26')]['token']+_0x4ff015)},'json':!![]};return rp(_0x35b42c);}})[_0x2f14('0x35')](function(_0x364eb0){if(_0x364eb0['success']){var _0x369e83={'method':'GET','uri':_0x409f5c,'qs':{'operation':_0x2f14('0x70'),'username':_0x53c2e1,'sessionName':_0x364eb0['result'][_0x2f14('0x71')],'elementType':_0x12d5d8},'json':!![]};return rp(_0x369e83);}})[_0x2f14('0x35')](function(_0x594846){if(_0x594846[_0x2f14('0x6e')]){var _0x4ea53f=[_0x2f14('0x72'),_0x2f14('0x73'),'owner'];_[_0x2f14('0x74')](_0x594846[_0x2f14('0x26')][_0x2f14('0x42')],function(_0x3424b2){return _0x4ea53f['includes'](_0x3424b2[_0x2f14('0x3c')][_0x2f14('0x36')]);});_[_0x2f14('0x74')](_0x594846['result'][_0x2f14('0x42')],function(_0x3f3fd4){return _0x3f3fd4[_0x2f14('0x75')]===_0x2f14('0x76');});return{'count':_0x594846[_0x2f14('0x26')][_0x2f14('0x42')][_0x2f14('0x43')],'rows':_[_0x2f14('0x38')](_0x594846[_0x2f14('0x26')][_0x2f14('0x42')],function(_0x46cf33){return{'id':_0x46cf33[_0x2f14('0x36')],'name':_0x46cf33['label'],'custom':_['startsWith'](_0x46cf33['name'],_0x2f14('0x77'))?!![]:![],'options':_0x46cf33['type'][_0x2f14('0x36')]==='picklist'&&_0x46cf33[_0x2f14('0x3c')]['picklistValues'][_0x2f14('0x43')]>0x0?_['map'](_0x46cf33['type'][_0x2f14('0x78')],function(_0x3e5a0a){return{'name':_0x3e5a0a[_0x2f14('0x79')],'value':_0x3e5a0a['value']};}):[]};})};}})['then'](respondWithResult(_0x376ed5,null))[_0x2f14('0x27')](function(_0x521db5){console['log'](_0x2f14('0x7a')+_0x521db5);var _0x4700d1=_0x315f37[_0x2f14('0x3e')][_0x2f14('0x1a')]?0x1f4:_0x521db5['statusCode']||0x1f4;logger[_0x2f14('0x23')](_0x2f14('0x7b'),_0x2f14('0x60'),_0x4700d1,JSON[_0x2f14('0x22')](_0x521db5));delete _0x521db5['name'];if(_0x4700d1===0x191){_0x4700d1=0x190;}_0x376ed5[_0x2f14('0x29')](_0x4700d1)[_0x2f14('0x7c')](_0x315f37[_0x2f14('0x3e')]['test']?{'message':_0x2f14('0x7d'),'statusCode':_0x521db5['statusCode']}:_0x521db5);});}; \ No newline at end of file +var _0x587b=['fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','VtigerAccount','create','body','find','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','Descriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','format','GET','success','POST','login','token','describe','sessionName','autogenerated','owner','remove','includes','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','save','update','sendStatus','name','send','rawAttributes'];(function(_0x5af794,_0x343b80){var _0x50af02=function(_0x4d844c){while(--_0x4d844c){_0x5af794['push'](_0x5af794['shift']());}};_0x50af02(++_0x343b80);}(_0x587b,0x1bc));var _0xb587=function(_0x43177d,_0x288db1){_0x43177d=_0x43177d-0x0;var _0x2774c3=_0x587b[_0x43177d];return _0x2774c3;};'use strict';var pdf=require(_0xb587('0x0'));var emlformat=require(_0xb587('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb587('0x2'));var jsonpatch=require(_0xb587('0x3'));var rp=require(_0xb587('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb587('0x5'));var util=require(_0xb587('0x6'));var path=require(_0xb587('0x7'));var sox=require(_0xb587('0x8'));var csv=require(_0xb587('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb587('0xa'));var squel=require('squel');var crypto=require(_0xb587('0xb'));var jsforce=require(_0xb587('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb587('0x9'));var querystring=require(_0xb587('0xd'));var Papa=require(_0xb587('0xe'));var Redis=require('ioredis');var authService=require(_0xb587('0xf'));var qs=require(_0xb587('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb587('0x11'));var logger=require(_0xb587('0x12'))(_0xb587('0x13'));var utils=require('../../config/utils');var config=require(_0xb587('0x14'));var db=require(_0xb587('0x15'))['db'];var integrations=require(_0xb587('0x16'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb587('0x17')]({'port':0x232a});function checkPasswordPattern(_0x203c32,_0x35ed5e,_0xb3c547){if(_0xb3c547){var _0x4f013b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4f013b[_0xb587('0x18')](_0x35ed5e)){return _0x203c32;}else{throw new db[(_0xb587('0x19'))]['ValidationError'](_0xb587('0x1a'));}}else{return _0x203c32;}}function respondWithRpcPromise(_0x8d76a6,_0x42f379,_0x433b88,_0x373d7b){return new BPromise(function(_0x20880c,_0x514001){var _0x22b437=_0x373d7b||client;return _0x22b437[_0xb587('0x1b')](_0x8d76a6,_0x433b88)[_0xb587('0x1c')](function(_0x84db5){logger[_0xb587('0x1d')](_0xb587('0x1e'),_0x42f379,_0xb587('0x1f'));logger[_0xb587('0x20')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x42f379,_0xb587('0x1f'),JSON['stringify'](_0x84db5));if(_0x84db5[_0xb587('0x21')]){if(_0x84db5['error'][_0xb587('0x22')]===0x1f4){logger[_0xb587('0x21')](_0xb587('0x1e'),_0x42f379,_0x84db5[_0xb587('0x21')][_0xb587('0x23')]);return _0x514001(_0x84db5['error']['message']);}logger[_0xb587('0x21')](_0xb587('0x1e'),_0x42f379,_0x84db5[_0xb587('0x21')][_0xb587('0x23')]);return _0x20880c(_0x84db5['error']['message']);}else{logger['info'](_0xb587('0x1e'),_0x42f379,_0xb587('0x1f'));_0x20880c(_0x84db5[_0xb587('0x24')]['message']);}})[_0xb587('0x25')](function(_0x2b9037){logger[_0xb587('0x21')]('VtigerAccount,\x20%s,\x20%s',_0x42f379,_0x2b9037);_0x514001(_0x2b9037);});});}function respondWithStatusCode(_0x178e20,_0x59ebd8){_0x59ebd8=_0x59ebd8||0xcc;return function(_0x103e21){if(_0x103e21){return _0x178e20['sendStatus'](_0x59ebd8);}return _0x178e20[_0xb587('0x26')](_0x59ebd8)[_0xb587('0x27')]();};}function respondWithResult(_0x216470,_0x2e65cd){_0x2e65cd=_0x2e65cd||0xc8;return function(_0x13755e){if(_0x13755e){return _0x216470[_0xb587('0x26')](_0x2e65cd)[_0xb587('0x28')](_0x13755e);}};}function respondWithFilteredResult(_0x124d07,_0x3928a1){return function(_0x8b6bae){if(_0x8b6bae){var _0x25c7ee=_0x8b6bae[_0xb587('0x29')],_0x15ce9f=_0x3928a1[_0xb587('0x2a')],_0x523e13=_0x3928a1['offset']+_0x3928a1[_0xb587('0x2b')],_0x4ec8e4;if(_0x523e13>=_0x25c7ee){_0x523e13=_0x25c7ee;_0x4ec8e4=0xc8;}else{_0x4ec8e4=0xce;}_0x124d07[_0xb587('0x26')](_0x4ec8e4);return _0x124d07[_0xb587('0x2c')](_0xb587('0x2d'),_0x15ce9f+'-'+_0x523e13+'/'+_0x25c7ee)[_0xb587('0x28')](_0x8b6bae);}return null;};}function patchUpdates(_0x30dacd){return function(_0x1d0963){try{jsonpatch['apply'](_0x1d0963,_0x30dacd,!![]);}catch(_0x3a3bcc){return BPromise['reject'](_0x3a3bcc);}return _0x1d0963[_0xb587('0x2e')]();};}function saveUpdates(_0x1942ce,_0x2a29f1){return function(_0x4b4cef){if(_0x4b4cef){return _0x4b4cef[_0xb587('0x2f')](_0x1942ce)['then'](function(_0x190621){return _0x190621;});}return null;};}function removeEntity(_0x30dddd,_0x29cb4b){return function(_0x150f11){if(_0x150f11){return _0x150f11['destroy']()[_0xb587('0x1c')](function(){_0x30dddd[_0xb587('0x26')](0xcc)[_0xb587('0x27')]();});}};}function handleEntityNotFound(_0x438f68,_0x43e43f){return function(_0x5e919e){if(!_0x5e919e){_0x438f68[_0xb587('0x30')](0x194);}return _0x5e919e;};}function handleError(_0x29e02b,_0x81c0fe){_0x81c0fe=_0x81c0fe||0x1f4;return function(_0x220a61){logger[_0xb587('0x21')](_0x220a61['stack']);if(_0x220a61[_0xb587('0x31')]){delete _0x220a61[_0xb587('0x31')];}_0x29e02b[_0xb587('0x26')](_0x81c0fe)[_0xb587('0x32')](_0x220a61);};}exports['index']=function(_0xc56376,_0x4f5931){var _0x3846fd={},_0x17357b={},_0x446507={'count':0x0,'rows':[]};var _0x5e713f=_['map'](db['VtigerAccount'][_0xb587('0x33')],function(_0xce5a55){return{'name':_0xce5a55[_0xb587('0x34')],'type':_0xce5a55[_0xb587('0x35')]['key']};});_0x17357b[_0xb587('0x36')]=_['map'](_0x5e713f,_0xb587('0x31'));_0x17357b['query']=_[_0xb587('0x37')](_0xc56376['query']);_0x17357b[_0xb587('0x38')]=_[_0xb587('0x39')](_0x17357b[_0xb587('0x36')],_0x17357b[_0xb587('0x3a')]);_0x3846fd[_0xb587('0x3b')]=_[_0xb587('0x39')](_0x17357b[_0xb587('0x36')],qs[_0xb587('0x3c')](_0xc56376['query'][_0xb587('0x3c')]));_0x3846fd[_0xb587('0x3b')]=_0x3846fd[_0xb587('0x3b')][_0xb587('0x3d')]?_0x3846fd[_0xb587('0x3b')]:_0x17357b['model'];if(!_0xc56376['query'][_0xb587('0x3e')](_0xb587('0x3f'))){_0x3846fd['limit']=qs[_0xb587('0x2b')](_0xc56376['query'][_0xb587('0x2b')]);_0x3846fd[_0xb587('0x2a')]=qs['offset'](_0xc56376[_0xb587('0x3a')][_0xb587('0x2a')]);}_0x3846fd[_0xb587('0x40')]=qs[_0xb587('0x41')](_0xc56376[_0xb587('0x3a')][_0xb587('0x41')]);_0x3846fd[_0xb587('0x42')]=qs['filters'](_[_0xb587('0x43')](_0xc56376[_0xb587('0x3a')],_0x17357b[_0xb587('0x38')]),_0x5e713f);if(_0xc56376['query'][_0xb587('0x44')]){_0x3846fd[_0xb587('0x42')]=_['merge'](_0x3846fd['where'],{'$or':_[_0xb587('0x45')](_0x5e713f,function(_0x391bb5){if(_0x391bb5[_0xb587('0x35')]!==_0xb587('0x46')){var _0x1603d3={};_0x1603d3[_0x391bb5[_0xb587('0x31')]]={'$like':'%'+_0xc56376['query'][_0xb587('0x44')]+'%'};return _0x1603d3;}})});}_0x3846fd=_[_0xb587('0x47')]({},_0x3846fd,_0xc56376[_0xb587('0x48')]);var _0x4c8da3={'where':_0x3846fd[_0xb587('0x42')]};return db['VtigerAccount'][_0xb587('0x29')](_0x4c8da3)['then'](function(_0x4dacb2){_0x446507[_0xb587('0x29')]=_0x4dacb2;if(_0xc56376[_0xb587('0x3a')][_0xb587('0x49')]){_0x3846fd[_0xb587('0x4a')]=[{'all':!![]}];}return db['VtigerAccount'][_0xb587('0x4b')](_0x3846fd);})[_0xb587('0x1c')](function(_0x3c8024){_0x446507[_0xb587('0x4c')]=_0x3c8024;return _0x446507;})[_0xb587('0x1c')](respondWithFilteredResult(_0x4f5931,_0x3846fd))[_0xb587('0x25')](handleError(_0x4f5931,null));};exports[_0xb587('0x4d')]=function(_0x22a4ea,_0x2760a5){var _0x1d3edd={'raw':![],'where':{'id':_0x22a4ea[_0xb587('0x4e')]['id']}},_0x54a8ce={};_0x54a8ce[_0xb587('0x36')]=_[_0xb587('0x37')](db['VtigerAccount'][_0xb587('0x33')]);_0x54a8ce['query']=_[_0xb587('0x37')](_0x22a4ea[_0xb587('0x3a')]);_0x54a8ce['filters']=_[_0xb587('0x39')](_0x54a8ce[_0xb587('0x36')],_0x54a8ce[_0xb587('0x3a')]);_0x1d3edd[_0xb587('0x3b')]=_['intersection'](_0x54a8ce[_0xb587('0x36')],qs[_0xb587('0x3c')](_0x22a4ea['query'][_0xb587('0x3c')]));_0x1d3edd[_0xb587('0x3b')]=_0x1d3edd[_0xb587('0x3b')][_0xb587('0x3d')]?_0x1d3edd[_0xb587('0x3b')]:_0x54a8ce[_0xb587('0x36')];if(_0x22a4ea[_0xb587('0x3a')]['includeAll']){_0x1d3edd['include']=[{'all':!![]}];}_0x1d3edd=_[_0xb587('0x47')]({},_0x1d3edd,_0x22a4ea[_0xb587('0x48')]);return db[_0xb587('0x4f')]['find'](_0x1d3edd)['then'](handleEntityNotFound(_0x2760a5,null))[_0xb587('0x1c')](respondWithResult(_0x2760a5,null))[_0xb587('0x25')](handleError(_0x2760a5,null));};exports['create']=function(_0xca30a3,_0x2c0a7d){return db[_0xb587('0x4f')][_0xb587('0x50')](_0xca30a3[_0xb587('0x51')],{})[_0xb587('0x1c')](respondWithResult(_0x2c0a7d,0xc9))[_0xb587('0x25')](handleError(_0x2c0a7d,null));};exports['update']=function(_0x3123b7,_0x512aca){if(_0x3123b7[_0xb587('0x51')]['id']){delete _0x3123b7['body']['id'];}return db['VtigerAccount'][_0xb587('0x52')]({'where':{'id':_0x3123b7[_0xb587('0x4e')]['id']}})[_0xb587('0x1c')](handleEntityNotFound(_0x512aca,null))[_0xb587('0x1c')](saveUpdates(_0x3123b7['body'],null))[_0xb587('0x1c')](respondWithResult(_0x512aca,null))['catch'](handleError(_0x512aca,null));};exports['destroy']=function(_0x1a7feb,_0x2be4d6){return db[_0xb587('0x4f')][_0xb587('0x52')]({'where':{'id':_0x1a7feb[_0xb587('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2be4d6,null))[_0xb587('0x1c')](removeEntity(_0x2be4d6,null))[_0xb587('0x25')](handleError(_0x2be4d6,null));};exports[_0xb587('0x53')]=function(_0x55071b,_0x1614f4,_0x2a1335){var _0x251313={};var _0x409d9c={};var _0x52e3a7;var _0x4a5d8b;return db['VtigerAccount'][_0xb587('0x54')]({'where':{'id':_0x55071b[_0xb587('0x4e')]['id']}})[_0xb587('0x1c')](handleEntityNotFound(_0x1614f4,null))[_0xb587('0x1c')](function(_0x28cb4a){if(_0x28cb4a){_0x52e3a7=_0x28cb4a;_0x409d9c[_0xb587('0x36')]=_['keys'](db[_0xb587('0x55')][_0xb587('0x33')]);_0x409d9c[_0xb587('0x3a')]=_['keys'](_0x55071b[_0xb587('0x3a')]);_0x409d9c[_0xb587('0x38')]=_[_0xb587('0x39')](_0x409d9c[_0xb587('0x36')],_0x409d9c['query']);_0x251313['attributes']=_[_0xb587('0x39')](_0x409d9c[_0xb587('0x36')],qs[_0xb587('0x3c')](_0x55071b[_0xb587('0x3a')][_0xb587('0x3c')]));_0x251313[_0xb587('0x3b')]=_0x251313['attributes']['length']?_0x251313[_0xb587('0x3b')]:_0x409d9c[_0xb587('0x36')];_0x251313[_0xb587('0x40')]=qs[_0xb587('0x41')](_0x55071b[_0xb587('0x3a')]['sort']);_0x251313['where']=qs['filters'](_[_0xb587('0x43')](_0x55071b[_0xb587('0x3a')],_0x409d9c[_0xb587('0x38')]));if(_0x55071b[_0xb587('0x3a')]['filter']){_0x251313[_0xb587('0x42')]=_['merge'](_0x251313[_0xb587('0x42')],{'$or':_['map'](_0x251313[_0xb587('0x3b')],function(_0x57bdc4){var _0x2066c0={};_0x2066c0[_0x57bdc4]={'$like':'%'+_0x55071b[_0xb587('0x3a')][_0xb587('0x44')]+'%'};return _0x2066c0;})});}_0x251313=_[_0xb587('0x47')]({},_0x251313,_0x55071b[_0xb587('0x48')]);return _0x52e3a7[_0xb587('0x53')](_0x251313);}})['then'](function(_0x1276ce){if(_0x1276ce){_0x4a5d8b=_0x1276ce[_0xb587('0x3d')];if(!_0x55071b[_0xb587('0x3a')]['hasOwnProperty'](_0xb587('0x3f'))){_0x251313['limit']=qs[_0xb587('0x2b')](_0x55071b['query'][_0xb587('0x2b')]);_0x251313[_0xb587('0x2a')]=qs[_0xb587('0x2a')](_0x55071b[_0xb587('0x3a')][_0xb587('0x2a')]);}return _0x52e3a7[_0xb587('0x53')](_0x251313);}})[_0xb587('0x1c')](function(_0x1490ce){if(_0x1490ce){return _0x1490ce?{'count':_0x4a5d8b,'rows':_0x1490ce}:null;}})[_0xb587('0x1c')](respondWithResult(_0x1614f4,null))[_0xb587('0x25')](handleError(_0x1614f4,null));};exports[_0xb587('0x56')]=function(_0x40e8a4,_0xcadc58,_0x3e6761){if(_0x40e8a4['body']['id']){delete _0x40e8a4[_0xb587('0x51')]['id'];}return db[_0xb587('0x4f')][_0xb587('0x54')]({'where':{'id':_0x40e8a4[_0xb587('0x4e')]['id']}})['then'](handleEntityNotFound(_0xcadc58,null))[_0xb587('0x1c')](function(_0x39ed49){if(_0x39ed49){_0x40e8a4[_0xb587('0x51')][_0xb587('0x57')]=_0x39ed49['id'];_0x40e8a4[_0xb587('0x51')][_0xb587('0x58')]=integrations['getSubjects'](_0x40e8a4[_0xb587('0x51')]['channel'],_0x40e8a4[_0xb587('0x51')]['type']);_0x40e8a4[_0xb587('0x51')][_0xb587('0x59')]=integrations['getDescriptions'](_0x40e8a4[_0xb587('0x51')]['channel'],_0x40e8a4[_0xb587('0x51')][_0xb587('0x35')]);return db[_0xb587('0x55')][_0xb587('0x50')](_0x40e8a4[_0xb587('0x51')],{'include':[{'model':db['VtigerField'],'as':_0xb587('0x58')},{'model':db[_0xb587('0x5a')],'as':_0xb587('0x59')}]});}return null;})[_0xb587('0x1c')](respondWithResult(_0xcadc58,null))['catch'](handleError(_0xcadc58,null));};var md5=require(_0xb587('0x5b'));exports[_0xb587('0x5c')]=function(_0x45560b,_0x1a8316,_0x15a2a1){var _0xf876b5=null;var _0x5277f1=null;var _0xb9f2f6=null;var _0x45f6e2=null;var _0x183e44='';return db['VtigerAccount'][_0xb587('0x54')]({'where':{'id':_0x45560b['params']['id']},'attributes':['id',_0xb587('0x31'),_0xb587('0x5d'),_0xb587('0x5e'),_0xb587('0x5f'),_0xb587('0x60'),_0xb587('0x61'),_0xb587('0x62')]})[_0xb587('0x1c')](handleEntityNotFound(_0x1a8316,null))[_0xb587('0x1c')](function(_0xad87a3){if(_0xad87a3){_0xf876b5=_0xad87a3['username'];_0x5277f1=_0xad87a3['accessKey'];_0xb9f2f6=_0xad87a3[_0xb587('0x5f')];_0x183e44=_0xad87a3[_0xb587('0x60')];var _0x1292dd=_0x183e44['slice'](-0x1);if(_0x1292dd==='/'){_0x183e44=_0x183e44[_0xb587('0x63')](0x0,_0x183e44['lastIndexOf'](_0x1292dd));}_0x45f6e2=util[_0xb587('0x64')]('%s/webservice.php',_0x183e44);var _0x2188f1={'method':_0xb587('0x65'),'uri':_0x45f6e2,'qs':{'operation':'getchallenge','username':_0xad87a3['username']},'json':!![]};return rp(_0x2188f1);}})[_0xb587('0x1c')](function(_0x3544d6){if(_0x3544d6[_0xb587('0x66')]){var _0x5088ac={'method':_0xb587('0x67'),'uri':_0x45f6e2,'form':{'operation':_0xb587('0x68'),'username':_0xf876b5,'accessKey':md5(_0x3544d6[_0xb587('0x24')][_0xb587('0x69')]+_0x5277f1)},'json':!![]};return rp(_0x5088ac);}})[_0xb587('0x1c')](function(_0x5cbf5a){if(_0x5cbf5a[_0xb587('0x66')]){var _0x14cbaf={'method':_0xb587('0x65'),'uri':_0x45f6e2,'qs':{'operation':_0xb587('0x6a'),'username':_0xf876b5,'sessionName':_0x5cbf5a['result'][_0xb587('0x6b')],'elementType':_0xb9f2f6},'json':!![]};return rp(_0x14cbaf);}})[_0xb587('0x1c')](function(_0x1f05a7){if(_0x1f05a7[_0xb587('0x66')]){var _0x2592cb=[_0xb587('0x6c'),'reference',_0xb587('0x6d')];_[_0xb587('0x6e')](_0x1f05a7['result'][_0xb587('0x3c')],function(_0x1b2f15){return _0x2592cb[_0xb587('0x6f')](_0x1b2f15[_0xb587('0x35')][_0xb587('0x31')]);});_[_0xb587('0x6e')](_0x1f05a7[_0xb587('0x24')][_0xb587('0x3c')],function(_0x59cda8){return _0x59cda8['editable']==='false';});return{'count':_0x1f05a7[_0xb587('0x24')][_0xb587('0x3c')][_0xb587('0x3d')],'rows':_['map'](_0x1f05a7[_0xb587('0x24')][_0xb587('0x3c')],function(_0x5cce8d){return{'id':_0x5cce8d[_0xb587('0x31')],'name':_0x5cce8d[_0xb587('0x70')],'custom':_[_0xb587('0x71')](_0x5cce8d[_0xb587('0x31')],_0xb587('0x72'))?!![]:![],'options':_0x5cce8d[_0xb587('0x35')][_0xb587('0x31')]===_0xb587('0x73')&&_0x5cce8d[_0xb587('0x35')][_0xb587('0x74')][_0xb587('0x3d')]>0x0?_[_0xb587('0x45')](_0x5cce8d[_0xb587('0x35')]['picklistValues'],function(_0x580f02){return{'name':_0x580f02[_0xb587('0x70')],'value':_0x580f02[_0xb587('0x75')]};}):[]};})};}})[_0xb587('0x1c')](respondWithResult(_0x1a8316,null))['catch'](function(_0x3741b7){console[_0xb587('0x76')](_0xb587('0x77')+_0x3741b7);var _0x4ea634=_0x45560b[_0xb587('0x3a')][_0xb587('0x18')]?0x1f4:_0x3741b7[_0xb587('0x78')]||0x1f4;logger[_0xb587('0x21')](_0xb587('0x79'),_0xb587('0x5c'),_0x4ea634,JSON[_0xb587('0x7a')](_0x3741b7));delete _0x3741b7[_0xb587('0x31')];if(_0x4ea634===0x191){_0x4ea634=0x190;}_0x1a8316['status'](_0x4ea634)[_0xb587('0x32')](_0x45560b[_0xb587('0x3a')][_0xb587('0x18')]?{'message':_0xb587('0x7b'),'statusCode':_0x3741b7[_0xb587('0x78')]}:_0x3741b7);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f578269..a9b93b1 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 _0x0272=['util','api','bluebird','request-promise','path','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0272,0x1cc));var _0x2027=function(_0x47a656,_0x1b104a){_0x47a656=_0x47a656-0x0;var _0x4dc55f=_0x0272[_0x47a656];return _0x4dc55f;};'use strict';var _=require('lodash');var util=require(_0x2027('0x0'));var logger=require('../../config/logger')(_0x2027('0x1'));var moment=require('moment');var BPromise=require(_0x2027('0x2'));var rp=require(_0x2027('0x3'));var fs=require('fs');var path=require(_0x2027('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2027('0x5'));var integrations=require(_0x2027('0x6'));module[_0x2027('0x7')]=function(_0x203bbb,_0x14aee5){return _0x203bbb[_0x2027('0x8')](_0x2027('0x9'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x916c=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util'];(function(_0x1c6e89,_0x395866){var _0xf7dd31=function(_0x4d5a61){while(--_0x4d5a61){_0x1c6e89['push'](_0x1c6e89['shift']());}};_0xf7dd31(++_0x395866);}(_0x916c,0x16a));var _0xc916=function(_0x1d4449,_0x495153){_0x1d4449=_0x1d4449-0x0;var _0x4dcde3=_0x916c[_0x1d4449];return _0x4dcde3;};'use strict';var _=require(_0xc916('0x0'));var util=require(_0xc916('0x1'));var logger=require(_0xc916('0x2'))('api');var moment=require(_0xc916('0x3'));var BPromise=require(_0xc916('0x4'));var rp=require(_0xc916('0x5'));var fs=require('fs');var path=require(_0xc916('0x6'));var rimraf=require(_0xc916('0x7'));var config=require(_0xc916('0x8'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xc916('0x9'));module[_0xc916('0xa')]=function(_0x5712e0,_0xd9bfd8){return _0x5712e0[_0xc916('0xb')](_0xc916('0xc'),attributes,{'tableName':_0xc916('0xd'),'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 0b4eaa0..e2d7f1a 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 _0xced8=['catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowVtigerAccount'];(function(_0x37b67e,_0x2c3ceb){var _0x2072bf=function(_0x4f2d2b){while(--_0x4f2d2b){_0x37b67e['push'](_0x37b67e['shift']());}};_0x2072bf(++_0x2c3ceb);}(_0xced8,0x101));var _0x8ced=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xced8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8ced('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ced('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8ced('0x2'))(_0x8ced('0x3'));var config=require(_0x8ced('0x4'));var jayson=require(_0x8ced('0x5'));var client=jayson[_0x8ced('0x6')][_0x8ced('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x24da09,_0x354d3a,_0x1d945f){return new BPromise(function(_0x4f918d,_0x19a148){return client[_0x8ced('0x8')](_0x24da09,_0x1d945f)[_0x8ced('0x9')](function(_0x3bf14f){logger[_0x8ced('0xa')](_0x8ced('0xb'),_0x354d3a,_0x8ced('0xc'));logger[_0x8ced('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x354d3a,'request\x20sent',JSON[_0x8ced('0xe')](_0x3bf14f));if(_0x3bf14f[_0x8ced('0xf')]){if(_0x3bf14f[_0x8ced('0xf')]['code']===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x354d3a,_0x3bf14f[_0x8ced('0xf')][_0x8ced('0x10')]);return _0x19a148(_0x3bf14f[_0x8ced('0xf')][_0x8ced('0x10')]);}logger[_0x8ced('0xf')](_0x8ced('0xb'),_0x354d3a,_0x3bf14f['error'][_0x8ced('0x10')]);return _0x4f918d(_0x3bf14f[_0x8ced('0xf')]['message']);}else{logger[_0x8ced('0xa')](_0x8ced('0xb'),_0x354d3a,_0x8ced('0xc'));_0x4f918d(_0x3bf14f[_0x8ced('0x11')][_0x8ced('0x10')]);}})['catch'](function(_0x40fbd4){logger[_0x8ced('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x354d3a,_0x40fbd4);_0x19a148(_0x40fbd4);});});}exports[_0x8ced('0x12')]=function(_0x4fafff){var _0x3afe61=this;return new Promise(function(_0x33d132,_0x2a6e42){return db[_0x8ced('0x13')][_0x8ced('0x14')]({'raw':_0x4fafff[_0x8ced('0x15')]?_0x4fafff[_0x8ced('0x15')][_0x8ced('0x16')]===undefined?!![]:![]:!![],'where':_0x4fafff[_0x8ced('0x15')]?_0x4fafff[_0x8ced('0x15')][_0x8ced('0x17')]||null:null,'attributes':_0x4fafff[_0x8ced('0x15')]?_0x4fafff[_0x8ced('0x15')][_0x8ced('0x18')]||null:null,'limit':_0x4fafff['options']?_0x4fafff[_0x8ced('0x15')][_0x8ced('0x19')]||null:null,'include':_0x4fafff[_0x8ced('0x15')]?_0x4fafff[_0x8ced('0x15')][_0x8ced('0x1a')]?_[_0x8ced('0x1b')](_0x4fafff[_0x8ced('0x15')][_0x8ced('0x1a')],function(_0x34e70e){return{'model':db[_0x34e70e[_0x8ced('0x1c')]],'as':_0x34e70e['as'],'attributes':_0x34e70e[_0x8ced('0x18')],'include':_0x34e70e[_0x8ced('0x1a')]?_[_0x8ced('0x1b')](_0x34e70e['include'],function(_0x3c91bb){return{'model':db[_0x3c91bb[_0x8ced('0x1c')]],'as':_0x3c91bb['as'],'attributes':_0x3c91bb[_0x8ced('0x18')],'include':_0x3c91bb[_0x8ced('0x1a')]?_[_0x8ced('0x1b')](_0x3c91bb[_0x8ced('0x1a')],function(_0x393658){return{'model':db[_0x393658[_0x8ced('0x1c')]],'as':_0x393658['as'],'attributes':_0x393658[_0x8ced('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8ced('0x9')](function(_0x67087d){logger[_0x8ced('0xa')]('GetVtigerAccount',_0x4fafff);logger[_0x8ced('0xd')](_0x8ced('0x12'),_0x4fafff,JSON['stringify'](_0x67087d));_0x33d132(_0x67087d);})['catch'](function(_0x346cd9){logger['error'](_0x8ced('0x12'),_0x346cd9[_0x8ced('0x10')],_0x4fafff);_0x2a6e42(_0x3afe61['error'](0x1f4,_0x346cd9[_0x8ced('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x14b919){var _0x506792=this;return new Promise(function(_0x8958c3,_0x48c166){return db[_0x8ced('0x13')][_0x8ced('0x1d')]({'raw':_0x14b919[_0x8ced('0x15')]?_0x14b919['options']['raw']===undefined?!![]:![]:!![],'where':_0x14b919[_0x8ced('0x15')]?_0x14b919[_0x8ced('0x15')][_0x8ced('0x17')]||null:null,'attributes':_0x14b919[_0x8ced('0x15')]?_0x14b919[_0x8ced('0x15')][_0x8ced('0x18')]||null:null,'include':_0x14b919[_0x8ced('0x15')]?_0x14b919[_0x8ced('0x15')][_0x8ced('0x1a')]?_[_0x8ced('0x1b')](_0x14b919[_0x8ced('0x15')][_0x8ced('0x1a')],function(_0x1d36e9){return{'model':db[_0x1d36e9[_0x8ced('0x1c')]],'as':_0x1d36e9['as'],'attributes':_0x1d36e9[_0x8ced('0x18')],'include':_0x1d36e9[_0x8ced('0x1a')]?_[_0x8ced('0x1b')](_0x1d36e9[_0x8ced('0x1a')],function(_0x476db0){return{'model':db[_0x476db0['model']],'as':_0x476db0['as'],'attributes':_0x476db0['attributes'],'include':_0x476db0[_0x8ced('0x1a')]?_[_0x8ced('0x1b')](_0x476db0['include'],function(_0x463e41){return{'model':db[_0x463e41['model']],'as':_0x463e41['as'],'attributes':_0x463e41[_0x8ced('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58b4e6){logger[_0x8ced('0xa')]('ShowVtigerAccount',_0x14b919);logger[_0x8ced('0xd')](_0x8ced('0x1e'),_0x14b919,JSON[_0x8ced('0xe')](_0x58b4e6));_0x8958c3(_0x58b4e6);})[_0x8ced('0x1f')](function(_0x4c68f3){logger['error'](_0x8ced('0x1e'),_0x4c68f3[_0x8ced('0x10')],_0x14b919);_0x48c166(_0x506792[_0x8ced('0xf')](0x1f4,_0x4c68f3[_0x8ced('0x10')]));});});}; \ No newline at end of file +var _0x5b12=['moment','bluebird','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','GetVtigerAccount','catch','ShowVtigerAccount','find','lodash','util'];(function(_0x4fabbe,_0xc514f3){var _0x5510dd=function(_0x1e7d23){while(--_0x1e7d23){_0x4fabbe['push'](_0x4fabbe['shift']());}};_0x5510dd(++_0xc514f3);}(_0x5b12,0x7a));var _0x25b1=function(_0x49b9be,_0x6b04be){_0x49b9be=_0x49b9be-0x0;var _0x424e8c=_0x5b12[_0x49b9be];return _0x424e8c;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));var BPromise=require(_0x25b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x25b1('0x5'));var jayson=require(_0x25b1('0x6'));var client=jayson[_0x25b1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20570e,_0x58a498,_0x4ffe62){return new BPromise(function(_0x53c973,_0x9b623c){return client[_0x25b1('0x8')](_0x20570e,_0x4ffe62)[_0x25b1('0x9')](function(_0x4a7932){logger[_0x25b1('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x58a498,_0x25b1('0xb'));logger[_0x25b1('0xc')](_0x25b1('0xd'),_0x58a498,_0x25b1('0xb'),JSON[_0x25b1('0xe')](_0x4a7932));if(_0x4a7932['error']){if(_0x4a7932['error']['code']===0x1f4){logger[_0x25b1('0xf')](_0x25b1('0x10'),_0x58a498,_0x4a7932[_0x25b1('0xf')]['message']);return _0x9b623c(_0x4a7932['error'][_0x25b1('0x11')]);}logger['error'](_0x25b1('0x10'),_0x58a498,_0x4a7932[_0x25b1('0xf')][_0x25b1('0x11')]);return _0x53c973(_0x4a7932[_0x25b1('0xf')][_0x25b1('0x11')]);}else{logger[_0x25b1('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x58a498,'request\x20sent');_0x53c973(_0x4a7932['result'][_0x25b1('0x11')]);}})['catch'](function(_0x147e03){logger['error'](_0x25b1('0x10'),_0x58a498,_0x147e03);_0x9b623c(_0x147e03);});});}exports['GetVtigerAccount']=function(_0xb49458){var _0x3b22a0=this;return new Promise(function(_0x334e9c,_0x39c80e){return db[_0x25b1('0x12')][_0x25b1('0x13')]({'raw':_0xb49458[_0x25b1('0x14')]?_0xb49458[_0x25b1('0x14')][_0x25b1('0x15')]===undefined?!![]:![]:!![],'where':_0xb49458[_0x25b1('0x14')]?_0xb49458[_0x25b1('0x14')]['where']||null:null,'attributes':_0xb49458['options']?_0xb49458['options'][_0x25b1('0x16')]||null:null,'limit':_0xb49458[_0x25b1('0x14')]?_0xb49458[_0x25b1('0x14')][_0x25b1('0x17')]||null:null,'include':_0xb49458[_0x25b1('0x14')]?_0xb49458[_0x25b1('0x14')][_0x25b1('0x18')]?_[_0x25b1('0x19')](_0xb49458[_0x25b1('0x14')]['include'],function(_0x101d36){return{'model':db[_0x101d36[_0x25b1('0x1a')]],'as':_0x101d36['as'],'attributes':_0x101d36[_0x25b1('0x16')],'include':_0x101d36[_0x25b1('0x18')]?_[_0x25b1('0x19')](_0x101d36[_0x25b1('0x18')],function(_0x5975a9){return{'model':db[_0x5975a9['model']],'as':_0x5975a9['as'],'attributes':_0x5975a9[_0x25b1('0x16')],'include':_0x5975a9[_0x25b1('0x18')]?_[_0x25b1('0x19')](_0x5975a9['include'],function(_0xca78ee){return{'model':db[_0xca78ee[_0x25b1('0x1a')]],'as':_0xca78ee['as'],'attributes':_0xca78ee[_0x25b1('0x16')]};}):[]};}):[]};}):[]:[]})[_0x25b1('0x9')](function(_0x30cfa0){logger[_0x25b1('0xa')](_0x25b1('0x1b'),_0xb49458);logger[_0x25b1('0xc')](_0x25b1('0x1b'),_0xb49458,JSON[_0x25b1('0xe')](_0x30cfa0));_0x334e9c(_0x30cfa0);})[_0x25b1('0x1c')](function(_0x2e4f48){logger[_0x25b1('0xf')]('GetVtigerAccount',_0x2e4f48[_0x25b1('0x11')],_0xb49458);_0x39c80e(_0x3b22a0['error'](0x1f4,_0x2e4f48[_0x25b1('0x11')]));});});};exports[_0x25b1('0x1d')]=function(_0x111e5e){var _0xd9e04b=this;return new Promise(function(_0x4dec18,_0x32f5fa){return db[_0x25b1('0x12')][_0x25b1('0x1e')]({'raw':_0x111e5e[_0x25b1('0x14')]?_0x111e5e['options'][_0x25b1('0x15')]===undefined?!![]:![]:!![],'where':_0x111e5e[_0x25b1('0x14')]?_0x111e5e[_0x25b1('0x14')]['where']||null:null,'attributes':_0x111e5e[_0x25b1('0x14')]?_0x111e5e[_0x25b1('0x14')][_0x25b1('0x16')]||null:null,'include':_0x111e5e[_0x25b1('0x14')]?_0x111e5e[_0x25b1('0x14')][_0x25b1('0x18')]?_[_0x25b1('0x19')](_0x111e5e[_0x25b1('0x14')][_0x25b1('0x18')],function(_0x2f597b){return{'model':db[_0x2f597b['model']],'as':_0x2f597b['as'],'attributes':_0x2f597b[_0x25b1('0x16')],'include':_0x2f597b[_0x25b1('0x18')]?_[_0x25b1('0x19')](_0x2f597b[_0x25b1('0x18')],function(_0x22eef6){return{'model':db[_0x22eef6[_0x25b1('0x1a')]],'as':_0x22eef6['as'],'attributes':_0x22eef6['attributes'],'include':_0x22eef6[_0x25b1('0x18')]?_['map'](_0x22eef6[_0x25b1('0x18')],function(_0x47e7fd){return{'model':db[_0x47e7fd['model']],'as':_0x47e7fd['as'],'attributes':_0x47e7fd[_0x25b1('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10c321){logger[_0x25b1('0xa')](_0x25b1('0x1d'),_0x111e5e);logger[_0x25b1('0xc')](_0x25b1('0x1d'),_0x111e5e,JSON[_0x25b1('0xe')](_0x10c321));_0x4dec18(_0x10c321);})[_0x25b1('0x1c')](function(_0x620b54){logger[_0x25b1('0xf')]('ShowVtigerAccount',_0x620b54['message'],_0x111e5e);_0x32f5fa(_0xd9e04b[_0x25b1('0xf')](0x1f4,_0x620b54[_0x25b1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index e9cd490..3fdfac9 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 _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getDescriptions','post','create'];(function(_0x231645,_0x2e931d){var _0x5a18b3=function(_0x486cf1){while(--_0x486cf1){_0x231645['push'](_0x231645['shift']());}};_0x5a18b3(++_0x2e931d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5d3efd,_0x4128fd){_0x5d3efd=_0x5d3efd-0x0;var _0x53d388=_0x5f2f[_0x5d3efd];return _0x53d388;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['getFields']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getSubjects']);router[_0xf5f2('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0xf')]('/',auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router[_0xf5f2('0x11')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x51aea0,_0x59a64a){var _0x16d968=function(_0x3157f8){while(--_0x3157f8){_0x51aea0['push'](_0x51aea0['shift']());}};_0x16d968(++_0x59a64a);}(_0xb10b,0x12a));var _0xbb10=function(_0x553c2a,_0x592c23){_0x553c2a=_0x553c2a-0x0;var _0x37988b=_0xb10b[_0x553c2a];return _0x37988b;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index b7270e3..1200071 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 _0xf048=['exports','STRING','sequelize'];(function(_0x549f0b,_0x1e2bd0){var _0x499ab1=function(_0x421a2d){while(--_0x421a2d){_0x549f0b['push'](_0x549f0b['shift']());}};_0x499ab1(++_0x1e2bd0);}(_0xf048,0xa4));var _0x8f04=function(_0x3eea30,_0x48a04f){_0x3eea30=_0x3eea30-0x0;var _0x528546=_0xf048[_0x3eea30];return _0x528546;};'use strict';var Sequelize=require(_0x8f04('0x0'));module[_0x8f04('0x1')]={'name':{'type':Sequelize[_0x8f04('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4410=['exports','STRING','sequelize'];(function(_0x5957bb,_0x31d438){var _0x4caa10=function(_0x444211){while(--_0x444211){_0x5957bb['push'](_0x5957bb['shift']());}};_0x4caa10(++_0x31d438);}(_0x4410,0x19d));var _0x0441=function(_0x8abd64,_0x539570){_0x8abd64=_0x8abd64-0x0;var _0xd2511e=_0x4410[_0x8abd64];return _0xd2511e;};'use strict';var Sequelize=require(_0x0441('0x0'));module[_0x0441('0x1')]={'name':{'type':Sequelize[_0x0441('0x2')]},'description':{'type':Sequelize[_0x0441('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 2ef84ac..d3588d3 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 _0x09c2=['offset','limit','set','Content-Range','json','apply','reject','save','update','stack','name','send','index','map','VtigerConfiguration','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','destroy','getFields','findOne','VtigerField','sort','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end'];(function(_0x2e9e48,_0x2f56fb){var _0x1db5c9=function(_0x47fe89){while(--_0x47fe89){_0x2e9e48['push'](_0x2e9e48['shift']());}};_0x1db5c9(++_0x2f56fb);}(_0x09c2,0x158));var _0x209c=function(_0x1c100b,_0x5e17a0){_0x1c100b=_0x1c100b-0x0;var _0x2417fe=_0x09c2[_0x1c100b];return _0x2417fe;};'use strict';var pdf=require(_0x209c('0x0'));var emlformat=require(_0x209c('0x1'));var rimraf=require(_0x209c('0x2'));var zipdir=require(_0x209c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x209c('0x4'));var moment=require('moment');var BPromise=require(_0x209c('0x5'));var Mustache=require(_0x209c('0x6'));var util=require(_0x209c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x209c('0x8'));var ejs=require(_0x209c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x209c('0xa'));var crypto=require(_0x209c('0xb'));var jsforce=require(_0x209c('0xc'));var deskjs=require(_0x209c('0xd'));var toCsv=require(_0x209c('0x8'));var querystring=require('querystring');var Papa=require(_0x209c('0xe'));var Redis=require(_0x209c('0xf'));var authService=require(_0x209c('0x10'));var qs=require(_0x209c('0x11'));var as=require(_0x209c('0x12'));var hardwareService=require(_0x209c('0x13'));var logger=require(_0x209c('0x14'))(_0x209c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x209c('0x16'))['db'];var jayson=require(_0x209c('0x17'));var client=jayson[_0x209c('0x18')][_0x209c('0x19')]({'port':0x232a});function checkPasswordPattern(_0xaef322,_0x273c44,_0x296f0c){if(_0x296f0c){var _0x2a5538=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a5538[_0x209c('0x1a')](_0x273c44)){return _0xaef322;}else{throw new db[(_0x209c('0x1b'))][(_0x209c('0x1c'))](_0x209c('0x1d'));}}else{return _0xaef322;}}function respondWithRpcPromise(_0x514b10,_0x511b01,_0x4895e6,_0xdd5a8e){return new BPromise(function(_0x191e78,_0x421ddc){var _0xca2e47=_0xdd5a8e||client;return _0xca2e47[_0x209c('0x1e')](_0x514b10,_0x4895e6)[_0x209c('0x1f')](function(_0x3a3713){logger[_0x209c('0x20')](_0x209c('0x21'),_0x511b01,_0x209c('0x22'));logger['debug'](_0x209c('0x23'),_0x511b01,_0x209c('0x22'),JSON[_0x209c('0x24')](_0x3a3713));if(_0x3a3713[_0x209c('0x25')]){if(_0x3a3713[_0x209c('0x25')][_0x209c('0x26')]===0x1f4){logger[_0x209c('0x25')](_0x209c('0x21'),_0x511b01,_0x3a3713[_0x209c('0x25')][_0x209c('0x27')]);return _0x421ddc(_0x3a3713['error'][_0x209c('0x27')]);}logger[_0x209c('0x25')](_0x209c('0x21'),_0x511b01,_0x3a3713[_0x209c('0x25')][_0x209c('0x27')]);return _0x191e78(_0x3a3713[_0x209c('0x25')]['message']);}else{logger[_0x209c('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0x511b01,_0x209c('0x22'));_0x191e78(_0x3a3713[_0x209c('0x28')]['message']);}})['catch'](function(_0x4cad34){logger[_0x209c('0x25')](_0x209c('0x21'),_0x511b01,_0x4cad34);_0x421ddc(_0x4cad34);});});}function respondWithStatusCode(_0x1e4b10,_0xced8fc){_0xced8fc=_0xced8fc||0xcc;return function(_0x20d968){if(_0x20d968){return _0x1e4b10[_0x209c('0x29')](_0xced8fc);}return _0x1e4b10[_0x209c('0x2a')](_0xced8fc)[_0x209c('0x2b')]();};}function respondWithResult(_0x3dc6f9,_0x1ed3e8){_0x1ed3e8=_0x1ed3e8||0xc8;return function(_0x455b2e){if(_0x455b2e){return _0x3dc6f9[_0x209c('0x2a')](_0x1ed3e8)['json'](_0x455b2e);}};}function respondWithFilteredResult(_0xae49f7,_0x489b39){return function(_0x2324f9){if(_0x2324f9){var _0x510a6f=_0x2324f9['count'],_0x710864=_0x489b39[_0x209c('0x2c')],_0x221c65=_0x489b39['offset']+_0x489b39[_0x209c('0x2d')],_0x3838fc;if(_0x221c65>=_0x510a6f){_0x221c65=_0x510a6f;_0x3838fc=0xc8;}else{_0x3838fc=0xce;}_0xae49f7[_0x209c('0x2a')](_0x3838fc);return _0xae49f7[_0x209c('0x2e')](_0x209c('0x2f'),_0x710864+'-'+_0x221c65+'/'+_0x510a6f)[_0x209c('0x30')](_0x2324f9);}return null;};}function patchUpdates(_0x219ab5){return function(_0x3e16f3){try{jsonpatch[_0x209c('0x31')](_0x3e16f3,_0x219ab5,!![]);}catch(_0x2f68ea){return BPromise[_0x209c('0x32')](_0x2f68ea);}return _0x3e16f3[_0x209c('0x33')]();};}function saveUpdates(_0x523913,_0x270518){return function(_0x515a5d){if(_0x515a5d){return _0x515a5d[_0x209c('0x34')](_0x523913)['then'](function(_0x3eb183){return _0x3eb183;});}return null;};}function removeEntity(_0x417010,_0x3bc1a6){return function(_0x5c1140){if(_0x5c1140){return _0x5c1140['destroy']()[_0x209c('0x1f')](function(){_0x417010['status'](0xcc)[_0x209c('0x2b')]();});}};}function handleEntityNotFound(_0x140c06,_0x44dee5){return function(_0x337b82){if(!_0x337b82){_0x140c06['sendStatus'](0x194);}return _0x337b82;};}function handleError(_0x37bce9,_0x38b569){_0x38b569=_0x38b569||0x1f4;return function(_0x909544){logger[_0x209c('0x25')](_0x909544[_0x209c('0x35')]);if(_0x909544[_0x209c('0x36')]){delete _0x909544[_0x209c('0x36')];}_0x37bce9[_0x209c('0x2a')](_0x38b569)[_0x209c('0x37')](_0x909544);};}exports[_0x209c('0x38')]=function(_0x11266d,_0x5ef4d8){var _0xed720d={},_0x44b044={},_0x5c86ea={'count':0x0,'rows':[]};var _0x2e189d=_[_0x209c('0x39')](db[_0x209c('0x3a')]['rawAttributes'],function(_0x3c12a4){return{'name':_0x3c12a4[_0x209c('0x3b')],'type':_0x3c12a4['type'][_0x209c('0x3c')]};});_0x44b044['model']=_['map'](_0x2e189d,_0x209c('0x36'));_0x44b044[_0x209c('0x3d')]=_[_0x209c('0x3e')](_0x11266d[_0x209c('0x3d')]);_0x44b044[_0x209c('0x3f')]=_['intersection'](_0x44b044[_0x209c('0x40')],_0x44b044['query']);_0xed720d[_0x209c('0x41')]=_[_0x209c('0x42')](_0x44b044['model'],qs[_0x209c('0x43')](_0x11266d[_0x209c('0x3d')][_0x209c('0x43')]));_0xed720d['attributes']=_0xed720d[_0x209c('0x41')][_0x209c('0x44')]?_0xed720d['attributes']:_0x44b044[_0x209c('0x40')];if(!_0x11266d[_0x209c('0x3d')][_0x209c('0x45')]('nolimit')){_0xed720d[_0x209c('0x2d')]=qs[_0x209c('0x2d')](_0x11266d[_0x209c('0x3d')]['limit']);_0xed720d[_0x209c('0x2c')]=qs[_0x209c('0x2c')](_0x11266d[_0x209c('0x3d')][_0x209c('0x2c')]);}_0xed720d[_0x209c('0x46')]=qs['sort'](_0x11266d[_0x209c('0x3d')]['sort']);_0xed720d[_0x209c('0x47')]=qs['filters'](_[_0x209c('0x48')](_0x11266d['query'],_0x44b044['filters']),_0x2e189d);if(_0x11266d[_0x209c('0x3d')][_0x209c('0x49')]){_0xed720d[_0x209c('0x47')]=_[_0x209c('0x4a')](_0xed720d['where'],{'$or':_[_0x209c('0x39')](_0x2e189d,function(_0x39ed29){if(_0x39ed29[_0x209c('0x4b')]!==_0x209c('0x4c')){var _0x40fd43={};_0x40fd43[_0x39ed29['name']]={'$like':'%'+_0x11266d['query'][_0x209c('0x49')]+'%'};return _0x40fd43;}})});}_0xed720d=_[_0x209c('0x4a')]({},_0xed720d,_0x11266d[_0x209c('0x4d')]);var _0x2b5510={'where':_0xed720d[_0x209c('0x47')]};return db[_0x209c('0x3a')][_0x209c('0x4e')](_0x2b5510)[_0x209c('0x1f')](function(_0x448f56){_0x5c86ea[_0x209c('0x4e')]=_0x448f56;if(_0x11266d['query'][_0x209c('0x4f')]){_0xed720d[_0x209c('0x50')]=[{'all':!![]}];}return db[_0x209c('0x3a')][_0x209c('0x51')](_0xed720d);})[_0x209c('0x1f')](function(_0x5d9bab){_0x5c86ea[_0x209c('0x52')]=_0x5d9bab;return _0x5c86ea;})[_0x209c('0x1f')](respondWithFilteredResult(_0x5ef4d8,_0xed720d))[_0x209c('0x53')](handleError(_0x5ef4d8,null));};exports['show']=function(_0x59d39f,_0x37f52d){var _0x31a414={'raw':![],'where':{'id':_0x59d39f[_0x209c('0x54')]['id']}},_0xa6f580={};_0xa6f580[_0x209c('0x40')]=_[_0x209c('0x3e')](db[_0x209c('0x3a')][_0x209c('0x55')]);_0xa6f580[_0x209c('0x3d')]=_[_0x209c('0x3e')](_0x59d39f['query']);_0xa6f580[_0x209c('0x3f')]=_[_0x209c('0x42')](_0xa6f580[_0x209c('0x40')],_0xa6f580[_0x209c('0x3d')]);_0x31a414[_0x209c('0x41')]=_[_0x209c('0x42')](_0xa6f580[_0x209c('0x40')],qs['fields'](_0x59d39f[_0x209c('0x3d')][_0x209c('0x43')]));_0x31a414[_0x209c('0x41')]=_0x31a414['attributes'][_0x209c('0x44')]?_0x31a414[_0x209c('0x41')]:_0xa6f580[_0x209c('0x40')];if(_0x59d39f[_0x209c('0x3d')][_0x209c('0x4f')]){_0x31a414[_0x209c('0x50')]=[{'all':!![]}];}_0x31a414=_[_0x209c('0x4a')]({},_0x31a414,_0x59d39f[_0x209c('0x4d')]);return db[_0x209c('0x3a')][_0x209c('0x56')](_0x31a414)['then'](handleEntityNotFound(_0x37f52d,null))[_0x209c('0x1f')](respondWithResult(_0x37f52d,null))['catch'](handleError(_0x37f52d,null));};exports[_0x209c('0x57')]=function(_0x4904f5,_0x248c2d){return db['VtigerConfiguration']['create'](_0x4904f5[_0x209c('0x58')],{})[_0x209c('0x1f')](respondWithResult(_0x248c2d,0xc9))[_0x209c('0x53')](handleError(_0x248c2d,null));};exports[_0x209c('0x34')]=function(_0x31b8fe,_0x3941ac){if(_0x31b8fe[_0x209c('0x58')]['id']){delete _0x31b8fe['body']['id'];}return db[_0x209c('0x3a')][_0x209c('0x56')]({'where':{'id':_0x31b8fe[_0x209c('0x54')]['id']}})[_0x209c('0x1f')](handleEntityNotFound(_0x3941ac,null))[_0x209c('0x1f')](saveUpdates(_0x31b8fe['body'],null))[_0x209c('0x1f')](respondWithResult(_0x3941ac,null))[_0x209c('0x53')](handleError(_0x3941ac,null));};exports[_0x209c('0x59')]=function(_0x3172d2,_0x4dbad7){return db[_0x209c('0x3a')][_0x209c('0x56')]({'where':{'id':_0x3172d2[_0x209c('0x54')]['id']}})[_0x209c('0x1f')](handleEntityNotFound(_0x4dbad7,null))[_0x209c('0x1f')](removeEntity(_0x4dbad7,null))[_0x209c('0x53')](handleError(_0x4dbad7,null));};exports[_0x209c('0x5a')]=function(_0x21ebe3,_0x412811,_0x5420e1){var _0x1d8b18={};var _0x4c77bf={};var _0x63869d;var _0x3b509f;return db[_0x209c('0x3a')][_0x209c('0x5b')]({'where':{'id':_0x21ebe3['params']['id']}})[_0x209c('0x1f')](handleEntityNotFound(_0x412811,null))[_0x209c('0x1f')](function(_0x3da483){if(_0x3da483){_0x63869d=_0x3da483;_0x4c77bf[_0x209c('0x40')]=_[_0x209c('0x3e')](db[_0x209c('0x5c')][_0x209c('0x55')]);_0x4c77bf[_0x209c('0x3d')]=_[_0x209c('0x3e')](_0x21ebe3['query']);_0x4c77bf[_0x209c('0x3f')]=_['intersection'](_0x4c77bf[_0x209c('0x40')],_0x4c77bf['query']);_0x1d8b18[_0x209c('0x41')]=_[_0x209c('0x42')](_0x4c77bf[_0x209c('0x40')],qs[_0x209c('0x43')](_0x21ebe3[_0x209c('0x3d')][_0x209c('0x43')]));_0x1d8b18['attributes']=_0x1d8b18[_0x209c('0x41')][_0x209c('0x44')]?_0x1d8b18[_0x209c('0x41')]:_0x4c77bf[_0x209c('0x40')];_0x1d8b18['order']=qs[_0x209c('0x5d')](_0x21ebe3[_0x209c('0x3d')]['sort']);_0x1d8b18[_0x209c('0x47')]=qs['filters'](_[_0x209c('0x48')](_0x21ebe3[_0x209c('0x3d')],_0x4c77bf[_0x209c('0x3f')]));if(_0x21ebe3[_0x209c('0x3d')][_0x209c('0x49')]){_0x1d8b18[_0x209c('0x47')]=_[_0x209c('0x4a')](_0x1d8b18[_0x209c('0x47')],{'$or':_[_0x209c('0x39')](_0x1d8b18['attributes'],function(_0x17946b){var _0x3226a5={};_0x3226a5[_0x17946b]={'$like':'%'+_0x21ebe3['query'][_0x209c('0x49')]+'%'};return _0x3226a5;})});}_0x1d8b18=_[_0x209c('0x4a')]({},_0x1d8b18,_0x21ebe3['options']);return _0x63869d[_0x209c('0x5a')](_0x1d8b18);}})[_0x209c('0x1f')](function(_0x5dc5de){if(_0x5dc5de){_0x3b509f=_0x5dc5de['length'];if(!_0x21ebe3[_0x209c('0x3d')][_0x209c('0x45')](_0x209c('0x5e'))){_0x1d8b18[_0x209c('0x2d')]=qs[_0x209c('0x2d')](_0x21ebe3[_0x209c('0x3d')][_0x209c('0x2d')]);_0x1d8b18[_0x209c('0x2c')]=qs['offset'](_0x21ebe3['query'][_0x209c('0x2c')]);}return _0x63869d[_0x209c('0x5a')](_0x1d8b18);}})[_0x209c('0x1f')](function(_0x49f791){if(_0x49f791){return _0x49f791?{'count':_0x3b509f,'rows':_0x49f791}:null;}})[_0x209c('0x1f')](respondWithResult(_0x412811,null))[_0x209c('0x53')](handleError(_0x412811,null));};exports[_0x209c('0x5f')]=function(_0x254f6d,_0x643eba,_0x1b258a){var _0x192531={};var _0x3e8230={};var _0xbb5470;var _0x3bffdf;return db[_0x209c('0x3a')][_0x209c('0x5b')]({'where':{'id':_0x254f6d[_0x209c('0x54')]['id']}})['then'](handleEntityNotFound(_0x643eba,null))[_0x209c('0x1f')](function(_0x39a68a){if(_0x39a68a){_0xbb5470=_0x39a68a;_0x3e8230[_0x209c('0x40')]=_['keys'](db[_0x209c('0x5c')]['rawAttributes']);_0x3e8230[_0x209c('0x3d')]=_[_0x209c('0x3e')](_0x254f6d[_0x209c('0x3d')]);_0x3e8230[_0x209c('0x3f')]=_[_0x209c('0x42')](_0x3e8230[_0x209c('0x40')],_0x3e8230[_0x209c('0x3d')]);_0x192531['attributes']=_[_0x209c('0x42')](_0x3e8230[_0x209c('0x40')],qs[_0x209c('0x43')](_0x254f6d[_0x209c('0x3d')][_0x209c('0x43')]));_0x192531[_0x209c('0x41')]=_0x192531['attributes']['length']?_0x192531['attributes']:_0x3e8230[_0x209c('0x40')];_0x192531['order']=qs['sort'](_0x254f6d[_0x209c('0x3d')][_0x209c('0x5d')]);_0x192531['where']=qs[_0x209c('0x3f')](_[_0x209c('0x48')](_0x254f6d[_0x209c('0x3d')],_0x3e8230['filters']));if(_0x254f6d[_0x209c('0x3d')]['filter']){_0x192531[_0x209c('0x47')]=_[_0x209c('0x4a')](_0x192531[_0x209c('0x47')],{'$or':_[_0x209c('0x39')](_0x192531[_0x209c('0x41')],function(_0x5550a2){var _0x4344e7={};_0x4344e7[_0x5550a2]={'$like':'%'+_0x254f6d[_0x209c('0x3d')][_0x209c('0x49')]+'%'};return _0x4344e7;})});}_0x192531=_[_0x209c('0x4a')]({},_0x192531,_0x254f6d[_0x209c('0x4d')]);return _0xbb5470[_0x209c('0x5f')](_0x192531);}})['then'](function(_0x2688aa){if(_0x2688aa){_0x3bffdf=_0x2688aa[_0x209c('0x44')];if(!_0x254f6d[_0x209c('0x3d')][_0x209c('0x45')](_0x209c('0x5e'))){_0x192531[_0x209c('0x2d')]=qs[_0x209c('0x2d')](_0x254f6d['query'][_0x209c('0x2d')]);_0x192531[_0x209c('0x2c')]=qs['offset'](_0x254f6d[_0x209c('0x3d')][_0x209c('0x2c')]);}return _0xbb5470[_0x209c('0x5f')](_0x192531);}})['then'](function(_0x3d5a6b){if(_0x3d5a6b){return _0x3d5a6b?{'count':_0x3bffdf,'rows':_0x3d5a6b}:null;}})[_0x209c('0x1f')](respondWithResult(_0x643eba,null))[_0x209c('0x53')](handleError(_0x643eba,null));};exports[_0x209c('0x60')]=function(_0xbe17a5,_0xefb809,_0x31f461){var _0xe312f4={};var _0x153dc3={};var _0x3d8069;var _0x2336e3;return db['VtigerConfiguration'][_0x209c('0x5b')]({'where':{'id':_0xbe17a5[_0x209c('0x54')]['id']}})[_0x209c('0x1f')](handleEntityNotFound(_0xefb809,null))['then'](function(_0x406aa1){if(_0x406aa1){_0x3d8069=_0x406aa1;_0x153dc3[_0x209c('0x40')]=_[_0x209c('0x3e')](db[_0x209c('0x5c')]['rawAttributes']);_0x153dc3[_0x209c('0x3d')]=_[_0x209c('0x3e')](_0xbe17a5[_0x209c('0x3d')]);_0x153dc3[_0x209c('0x3f')]=_[_0x209c('0x42')](_0x153dc3[_0x209c('0x40')],_0x153dc3[_0x209c('0x3d')]);_0xe312f4[_0x209c('0x41')]=_[_0x209c('0x42')](_0x153dc3['model'],qs['fields'](_0xbe17a5[_0x209c('0x3d')][_0x209c('0x43')]));_0xe312f4[_0x209c('0x41')]=_0xe312f4[_0x209c('0x41')][_0x209c('0x44')]?_0xe312f4[_0x209c('0x41')]:_0x153dc3[_0x209c('0x40')];_0xe312f4['order']=qs[_0x209c('0x5d')](_0xbe17a5[_0x209c('0x3d')][_0x209c('0x5d')]);_0xe312f4[_0x209c('0x47')]=qs['filters'](_[_0x209c('0x48')](_0xbe17a5[_0x209c('0x3d')],_0x153dc3[_0x209c('0x3f')]));if(_0xbe17a5[_0x209c('0x3d')]['filter']){_0xe312f4[_0x209c('0x47')]=_[_0x209c('0x4a')](_0xe312f4[_0x209c('0x47')],{'$or':_[_0x209c('0x39')](_0xe312f4[_0x209c('0x41')],function(_0x489a8e){var _0x415013={};_0x415013[_0x489a8e]={'$like':'%'+_0xbe17a5[_0x209c('0x3d')][_0x209c('0x49')]+'%'};return _0x415013;})});}_0xe312f4=_[_0x209c('0x4a')]({},_0xe312f4,_0xbe17a5[_0x209c('0x4d')]);return _0x3d8069[_0x209c('0x60')](_0xe312f4);}})[_0x209c('0x1f')](function(_0x39d40a){if(_0x39d40a){_0x2336e3=_0x39d40a[_0x209c('0x44')];if(!_0xbe17a5[_0x209c('0x3d')][_0x209c('0x45')](_0x209c('0x5e'))){_0xe312f4[_0x209c('0x2d')]=qs[_0x209c('0x2d')](_0xbe17a5[_0x209c('0x3d')][_0x209c('0x2d')]);_0xe312f4[_0x209c('0x2c')]=qs[_0x209c('0x2c')](_0xbe17a5[_0x209c('0x3d')][_0x209c('0x2c')]);}return _0x3d8069[_0x209c('0x60')](_0xe312f4);}})[_0x209c('0x1f')](function(_0x2d24d9){if(_0x2d24d9){return _0x2d24d9?{'count':_0x2336e3,'rows':_0x2d24d9}:null;}})[_0x209c('0x1f')](respondWithResult(_0xefb809,null))['catch'](handleError(_0xefb809,null));}; \ No newline at end of file +var _0x2ab7=['message','result','catch','sendStatus','status','end','count','offset','Content-Range','json','reject','save','destroy','stack','name','send','index','map','VtigerConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','length','create','body','find','getFields','VtigerField','rawAttributes','getSubjects','order','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x395588,_0x136fa0){var _0x44d605=function(_0x47aac3){while(--_0x47aac3){_0x395588['push'](_0x395588['shift']());}};_0x44d605(++_0x136fa0);}(_0x2ab7,0xe7));var _0x72ab=function(_0x415b51,_0x1a29ee){_0x415b51=_0x415b51-0x0;var _0x1dd82c=_0x2ab7[_0x415b51];return _0x1dd82c;};'use strict';var pdf=require(_0x72ab('0x0'));var emlformat=require(_0x72ab('0x1'));var rimraf=require(_0x72ab('0x2'));var zipdir=require(_0x72ab('0x3'));var jsonpatch=require(_0x72ab('0x4'));var rp=require(_0x72ab('0x5'));var moment=require('moment');var BPromise=require(_0x72ab('0x6'));var Mustache=require(_0x72ab('0x7'));var util=require(_0x72ab('0x8'));var path=require(_0x72ab('0x9'));var sox=require('sox');var csv=require(_0x72ab('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x72ab('0xb'));var crypto=require(_0x72ab('0xc'));var jsforce=require(_0x72ab('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x72ab('0xe'));var Papa=require('papaparse');var Redis=require(_0x72ab('0xf'));var authService=require(_0x72ab('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x72ab('0x11'));var hardwareService=require(_0x72ab('0x12'));var logger=require(_0x72ab('0x13'))(_0x72ab('0x14'));var utils=require(_0x72ab('0x15'));var config=require(_0x72ab('0x16'));var db=require(_0x72ab('0x17'))['db'];var jayson=require(_0x72ab('0x18'));var client=jayson[_0x72ab('0x19')][_0x72ab('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x50d19d,_0x5d5b67,_0x1d1ec5){if(_0x1d1ec5){var _0x26d345=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x26d345[_0x72ab('0x1b')](_0x5d5b67)){return _0x50d19d;}else{throw new db['Sequelize']['ValidationError'](_0x72ab('0x1c'));}}else{return _0x50d19d;}}function respondWithRpcPromise(_0x30e029,_0x2a09ee,_0x5ed484,_0x1dbfae){return new BPromise(function(_0x52d0a2,_0x20bb28){var _0x1bf325=_0x1dbfae||client;return _0x1bf325[_0x72ab('0x1d')](_0x30e029,_0x5ed484)[_0x72ab('0x1e')](function(_0x289f0b){logger[_0x72ab('0x1f')](_0x72ab('0x20'),_0x2a09ee,'request\x20sent');logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x2a09ee,_0x72ab('0x21'),JSON['stringify'](_0x289f0b));if(_0x289f0b[_0x72ab('0x22')]){if(_0x289f0b[_0x72ab('0x22')][_0x72ab('0x23')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x2a09ee,_0x289f0b[_0x72ab('0x22')][_0x72ab('0x24')]);return _0x20bb28(_0x289f0b[_0x72ab('0x22')][_0x72ab('0x24')]);}logger[_0x72ab('0x22')](_0x72ab('0x20'),_0x2a09ee,_0x289f0b[_0x72ab('0x22')][_0x72ab('0x24')]);return _0x52d0a2(_0x289f0b[_0x72ab('0x22')]['message']);}else{logger[_0x72ab('0x1f')](_0x72ab('0x20'),_0x2a09ee,_0x72ab('0x21'));_0x52d0a2(_0x289f0b[_0x72ab('0x25')][_0x72ab('0x24')]);}})[_0x72ab('0x26')](function(_0x339d8f){logger[_0x72ab('0x22')](_0x72ab('0x20'),_0x2a09ee,_0x339d8f);_0x20bb28(_0x339d8f);});});}function respondWithStatusCode(_0x10f1df,_0x5df6c2){_0x5df6c2=_0x5df6c2||0xcc;return function(_0x5b10df){if(_0x5b10df){return _0x10f1df[_0x72ab('0x27')](_0x5df6c2);}return _0x10f1df[_0x72ab('0x28')](_0x5df6c2)[_0x72ab('0x29')]();};}function respondWithResult(_0x50b4ef,_0x255202){_0x255202=_0x255202||0xc8;return function(_0x5473b9){if(_0x5473b9){return _0x50b4ef[_0x72ab('0x28')](_0x255202)['json'](_0x5473b9);}};}function respondWithFilteredResult(_0x586d15,_0x1d5f9d){return function(_0x22a4d9){if(_0x22a4d9){var _0x4c77c5=_0x22a4d9[_0x72ab('0x2a')],_0x415e1d=_0x1d5f9d[_0x72ab('0x2b')],_0x18d401=_0x1d5f9d['offset']+_0x1d5f9d['limit'],_0xff3911;if(_0x18d401>=_0x4c77c5){_0x18d401=_0x4c77c5;_0xff3911=0xc8;}else{_0xff3911=0xce;}_0x586d15['status'](_0xff3911);return _0x586d15['set'](_0x72ab('0x2c'),_0x415e1d+'-'+_0x18d401+'/'+_0x4c77c5)[_0x72ab('0x2d')](_0x22a4d9);}return null;};}function patchUpdates(_0x53711b){return function(_0xf0df1f){try{jsonpatch['apply'](_0xf0df1f,_0x53711b,!![]);}catch(_0x52c272){return BPromise[_0x72ab('0x2e')](_0x52c272);}return _0xf0df1f[_0x72ab('0x2f')]();};}function saveUpdates(_0x3c9e2e,_0x4c57cd){return function(_0x14d742){if(_0x14d742){return _0x14d742['update'](_0x3c9e2e)[_0x72ab('0x1e')](function(_0x1c0a62){return _0x1c0a62;});}return null;};}function removeEntity(_0x3368cb,_0x43064b){return function(_0x4279a0){if(_0x4279a0){return _0x4279a0[_0x72ab('0x30')]()[_0x72ab('0x1e')](function(){_0x3368cb[_0x72ab('0x28')](0xcc)[_0x72ab('0x29')]();});}};}function handleEntityNotFound(_0x2ce6e7,_0x43e2f9){return function(_0x56a051){if(!_0x56a051){_0x2ce6e7['sendStatus'](0x194);}return _0x56a051;};}function handleError(_0x2db2c7,_0x530757){_0x530757=_0x530757||0x1f4;return function(_0xc795b3){logger[_0x72ab('0x22')](_0xc795b3[_0x72ab('0x31')]);if(_0xc795b3[_0x72ab('0x32')]){delete _0xc795b3['name'];}_0x2db2c7[_0x72ab('0x28')](_0x530757)[_0x72ab('0x33')](_0xc795b3);};}exports[_0x72ab('0x34')]=function(_0x8991d0,_0x3a7924){var _0x68a58={},_0x360b3f={},_0x24222d={'count':0x0,'rows':[]};var _0x1b2fcb=_[_0x72ab('0x35')](db[_0x72ab('0x36')]['rawAttributes'],function(_0x2b032a){return{'name':_0x2b032a[_0x72ab('0x37')],'type':_0x2b032a[_0x72ab('0x38')][_0x72ab('0x39')]};});_0x360b3f['model']=_[_0x72ab('0x35')](_0x1b2fcb,_0x72ab('0x32'));_0x360b3f[_0x72ab('0x3a')]=_[_0x72ab('0x3b')](_0x8991d0[_0x72ab('0x3a')]);_0x360b3f[_0x72ab('0x3c')]=_[_0x72ab('0x3d')](_0x360b3f[_0x72ab('0x3e')],_0x360b3f[_0x72ab('0x3a')]);_0x68a58[_0x72ab('0x3f')]=_[_0x72ab('0x3d')](_0x360b3f[_0x72ab('0x3e')],qs['fields'](_0x8991d0[_0x72ab('0x3a')][_0x72ab('0x40')]));_0x68a58[_0x72ab('0x3f')]=_0x68a58[_0x72ab('0x3f')]['length']?_0x68a58[_0x72ab('0x3f')]:_0x360b3f[_0x72ab('0x3e')];if(!_0x8991d0[_0x72ab('0x3a')][_0x72ab('0x41')](_0x72ab('0x42'))){_0x68a58[_0x72ab('0x43')]=qs['limit'](_0x8991d0[_0x72ab('0x3a')][_0x72ab('0x43')]);_0x68a58[_0x72ab('0x2b')]=qs['offset'](_0x8991d0[_0x72ab('0x3a')][_0x72ab('0x2b')]);}_0x68a58['order']=qs[_0x72ab('0x44')](_0x8991d0[_0x72ab('0x3a')]['sort']);_0x68a58[_0x72ab('0x45')]=qs[_0x72ab('0x3c')](_[_0x72ab('0x46')](_0x8991d0['query'],_0x360b3f['filters']),_0x1b2fcb);if(_0x8991d0[_0x72ab('0x3a')][_0x72ab('0x47')]){_0x68a58[_0x72ab('0x45')]=_[_0x72ab('0x48')](_0x68a58[_0x72ab('0x45')],{'$or':_[_0x72ab('0x35')](_0x1b2fcb,function(_0x2a4e44){if(_0x2a4e44[_0x72ab('0x38')]!==_0x72ab('0x49')){var _0xbb1ec5={};_0xbb1ec5[_0x2a4e44[_0x72ab('0x32')]]={'$like':'%'+_0x8991d0['query'][_0x72ab('0x47')]+'%'};return _0xbb1ec5;}})});}_0x68a58=_[_0x72ab('0x48')]({},_0x68a58,_0x8991d0[_0x72ab('0x4a')]);var _0x3e8127={'where':_0x68a58[_0x72ab('0x45')]};return db[_0x72ab('0x36')]['count'](_0x3e8127)[_0x72ab('0x1e')](function(_0x56e1f8){_0x24222d[_0x72ab('0x2a')]=_0x56e1f8;if(_0x8991d0[_0x72ab('0x3a')][_0x72ab('0x4b')]){_0x68a58[_0x72ab('0x4c')]=[{'all':!![]}];}return db[_0x72ab('0x36')]['findAll'](_0x68a58);})['then'](function(_0x42bc3d){_0x24222d[_0x72ab('0x4d')]=_0x42bc3d;return _0x24222d;})[_0x72ab('0x1e')](respondWithFilteredResult(_0x3a7924,_0x68a58))[_0x72ab('0x26')](handleError(_0x3a7924,null));};exports['show']=function(_0x1263b3,_0x1bb87b){var _0x4923c2={'raw':![],'where':{'id':_0x1263b3[_0x72ab('0x4e')]['id']}},_0x36f9c0={};_0x36f9c0[_0x72ab('0x3e')]=_[_0x72ab('0x3b')](db[_0x72ab('0x36')]['rawAttributes']);_0x36f9c0[_0x72ab('0x3a')]=_[_0x72ab('0x3b')](_0x1263b3['query']);_0x36f9c0[_0x72ab('0x3c')]=_[_0x72ab('0x3d')](_0x36f9c0['model'],_0x36f9c0[_0x72ab('0x3a')]);_0x4923c2[_0x72ab('0x3f')]=_[_0x72ab('0x3d')](_0x36f9c0['model'],qs[_0x72ab('0x40')](_0x1263b3[_0x72ab('0x3a')][_0x72ab('0x40')]));_0x4923c2[_0x72ab('0x3f')]=_0x4923c2[_0x72ab('0x3f')][_0x72ab('0x4f')]?_0x4923c2['attributes']:_0x36f9c0[_0x72ab('0x3e')];if(_0x1263b3[_0x72ab('0x3a')][_0x72ab('0x4b')]){_0x4923c2[_0x72ab('0x4c')]=[{'all':!![]}];}_0x4923c2=_['merge']({},_0x4923c2,_0x1263b3[_0x72ab('0x4a')]);return db[_0x72ab('0x36')]['find'](_0x4923c2)['then'](handleEntityNotFound(_0x1bb87b,null))[_0x72ab('0x1e')](respondWithResult(_0x1bb87b,null))[_0x72ab('0x26')](handleError(_0x1bb87b,null));};exports[_0x72ab('0x50')]=function(_0x5845cd,_0x38e3ea){return db[_0x72ab('0x36')][_0x72ab('0x50')](_0x5845cd[_0x72ab('0x51')],{})[_0x72ab('0x1e')](respondWithResult(_0x38e3ea,0xc9))[_0x72ab('0x26')](handleError(_0x38e3ea,null));};exports['update']=function(_0x124166,_0x134649){if(_0x124166[_0x72ab('0x51')]['id']){delete _0x124166['body']['id'];}return db[_0x72ab('0x36')][_0x72ab('0x52')]({'where':{'id':_0x124166[_0x72ab('0x4e')]['id']}})[_0x72ab('0x1e')](handleEntityNotFound(_0x134649,null))[_0x72ab('0x1e')](saveUpdates(_0x124166[_0x72ab('0x51')],null))[_0x72ab('0x1e')](respondWithResult(_0x134649,null))[_0x72ab('0x26')](handleError(_0x134649,null));};exports[_0x72ab('0x30')]=function(_0x1e58c6,_0x38949b){return db[_0x72ab('0x36')][_0x72ab('0x52')]({'where':{'id':_0x1e58c6[_0x72ab('0x4e')]['id']}})[_0x72ab('0x1e')](handleEntityNotFound(_0x38949b,null))[_0x72ab('0x1e')](removeEntity(_0x38949b,null))['catch'](handleError(_0x38949b,null));};exports[_0x72ab('0x53')]=function(_0x2be4ee,_0xccf391,_0x5c8f64){var _0x1bebd4={};var _0x1ce448={};var _0xbc04a8;var _0x3c74d8;return db[_0x72ab('0x36')]['findOne']({'where':{'id':_0x2be4ee[_0x72ab('0x4e')]['id']}})[_0x72ab('0x1e')](handleEntityNotFound(_0xccf391,null))[_0x72ab('0x1e')](function(_0x10368b){if(_0x10368b){_0xbc04a8=_0x10368b;_0x1ce448[_0x72ab('0x3e')]=_['keys'](db[_0x72ab('0x54')][_0x72ab('0x55')]);_0x1ce448[_0x72ab('0x3a')]=_['keys'](_0x2be4ee[_0x72ab('0x3a')]);_0x1ce448[_0x72ab('0x3c')]=_['intersection'](_0x1ce448[_0x72ab('0x3e')],_0x1ce448[_0x72ab('0x3a')]);_0x1bebd4[_0x72ab('0x3f')]=_[_0x72ab('0x3d')](_0x1ce448[_0x72ab('0x3e')],qs[_0x72ab('0x40')](_0x2be4ee[_0x72ab('0x3a')]['fields']));_0x1bebd4[_0x72ab('0x3f')]=_0x1bebd4[_0x72ab('0x3f')][_0x72ab('0x4f')]?_0x1bebd4['attributes']:_0x1ce448['model'];_0x1bebd4['order']=qs[_0x72ab('0x44')](_0x2be4ee[_0x72ab('0x3a')]['sort']);_0x1bebd4['where']=qs['filters'](_[_0x72ab('0x46')](_0x2be4ee[_0x72ab('0x3a')],_0x1ce448['filters']));if(_0x2be4ee[_0x72ab('0x3a')][_0x72ab('0x47')]){_0x1bebd4[_0x72ab('0x45')]=_['merge'](_0x1bebd4[_0x72ab('0x45')],{'$or':_['map'](_0x1bebd4[_0x72ab('0x3f')],function(_0x37b110){var _0x558f4b={};_0x558f4b[_0x37b110]={'$like':'%'+_0x2be4ee[_0x72ab('0x3a')][_0x72ab('0x47')]+'%'};return _0x558f4b;})});}_0x1bebd4=_[_0x72ab('0x48')]({},_0x1bebd4,_0x2be4ee['options']);return _0xbc04a8[_0x72ab('0x53')](_0x1bebd4);}})[_0x72ab('0x1e')](function(_0x55b2eb){if(_0x55b2eb){_0x3c74d8=_0x55b2eb[_0x72ab('0x4f')];if(!_0x2be4ee[_0x72ab('0x3a')][_0x72ab('0x41')](_0x72ab('0x42'))){_0x1bebd4[_0x72ab('0x43')]=qs['limit'](_0x2be4ee[_0x72ab('0x3a')][_0x72ab('0x43')]);_0x1bebd4[_0x72ab('0x2b')]=qs[_0x72ab('0x2b')](_0x2be4ee[_0x72ab('0x3a')][_0x72ab('0x2b')]);}return _0xbc04a8[_0x72ab('0x53')](_0x1bebd4);}})[_0x72ab('0x1e')](function(_0x143959){if(_0x143959){return _0x143959?{'count':_0x3c74d8,'rows':_0x143959}:null;}})[_0x72ab('0x1e')](respondWithResult(_0xccf391,null))['catch'](handleError(_0xccf391,null));};exports[_0x72ab('0x56')]=function(_0x4a017c,_0x40d73b,_0x37fc0a){var _0x284f84={};var _0x3fd517={};var _0x67394f;var _0x3c6e97;return db[_0x72ab('0x36')]['findOne']({'where':{'id':_0x4a017c[_0x72ab('0x4e')]['id']}})[_0x72ab('0x1e')](handleEntityNotFound(_0x40d73b,null))[_0x72ab('0x1e')](function(_0x46b61f){if(_0x46b61f){_0x67394f=_0x46b61f;_0x3fd517[_0x72ab('0x3e')]=_[_0x72ab('0x3b')](db['VtigerField']['rawAttributes']);_0x3fd517['query']=_[_0x72ab('0x3b')](_0x4a017c[_0x72ab('0x3a')]);_0x3fd517[_0x72ab('0x3c')]=_[_0x72ab('0x3d')](_0x3fd517[_0x72ab('0x3e')],_0x3fd517[_0x72ab('0x3a')]);_0x284f84[_0x72ab('0x3f')]=_[_0x72ab('0x3d')](_0x3fd517[_0x72ab('0x3e')],qs['fields'](_0x4a017c[_0x72ab('0x3a')][_0x72ab('0x40')]));_0x284f84[_0x72ab('0x3f')]=_0x284f84[_0x72ab('0x3f')]['length']?_0x284f84[_0x72ab('0x3f')]:_0x3fd517[_0x72ab('0x3e')];_0x284f84[_0x72ab('0x57')]=qs[_0x72ab('0x44')](_0x4a017c[_0x72ab('0x3a')][_0x72ab('0x44')]);_0x284f84[_0x72ab('0x45')]=qs[_0x72ab('0x3c')](_[_0x72ab('0x46')](_0x4a017c[_0x72ab('0x3a')],_0x3fd517[_0x72ab('0x3c')]));if(_0x4a017c[_0x72ab('0x3a')][_0x72ab('0x47')]){_0x284f84[_0x72ab('0x45')]=_[_0x72ab('0x48')](_0x284f84[_0x72ab('0x45')],{'$or':_[_0x72ab('0x35')](_0x284f84[_0x72ab('0x3f')],function(_0x131983){var _0x24ad8a={};_0x24ad8a[_0x131983]={'$like':'%'+_0x4a017c[_0x72ab('0x3a')][_0x72ab('0x47')]+'%'};return _0x24ad8a;})});}_0x284f84=_[_0x72ab('0x48')]({},_0x284f84,_0x4a017c[_0x72ab('0x4a')]);return _0x67394f['getSubjects'](_0x284f84);}})[_0x72ab('0x1e')](function(_0x25d7b2){if(_0x25d7b2){_0x3c6e97=_0x25d7b2[_0x72ab('0x4f')];if(!_0x4a017c[_0x72ab('0x3a')]['hasOwnProperty']('nolimit')){_0x284f84['limit']=qs[_0x72ab('0x43')](_0x4a017c[_0x72ab('0x3a')][_0x72ab('0x43')]);_0x284f84[_0x72ab('0x2b')]=qs['offset'](_0x4a017c[_0x72ab('0x3a')][_0x72ab('0x2b')]);}return _0x67394f[_0x72ab('0x56')](_0x284f84);}})[_0x72ab('0x1e')](function(_0x298487){if(_0x298487){return _0x298487?{'count':_0x3c6e97,'rows':_0x298487}:null;}})['then'](respondWithResult(_0x40d73b,null))[_0x72ab('0x26')](handleError(_0x40d73b,null));};exports['getDescriptions']=function(_0x115741,_0xd9d0da,_0xcb3f8b){var _0x24065f={};var _0x33cac0={};var _0x1b06c0;var _0x81d39d;return db[_0x72ab('0x36')]['findOne']({'where':{'id':_0x115741['params']['id']}})['then'](handleEntityNotFound(_0xd9d0da,null))[_0x72ab('0x1e')](function(_0x4acaea){if(_0x4acaea){_0x1b06c0=_0x4acaea;_0x33cac0[_0x72ab('0x3e')]=_[_0x72ab('0x3b')](db[_0x72ab('0x54')][_0x72ab('0x55')]);_0x33cac0[_0x72ab('0x3a')]=_['keys'](_0x115741[_0x72ab('0x3a')]);_0x33cac0[_0x72ab('0x3c')]=_[_0x72ab('0x3d')](_0x33cac0[_0x72ab('0x3e')],_0x33cac0[_0x72ab('0x3a')]);_0x24065f[_0x72ab('0x3f')]=_[_0x72ab('0x3d')](_0x33cac0[_0x72ab('0x3e')],qs[_0x72ab('0x40')](_0x115741[_0x72ab('0x3a')][_0x72ab('0x40')]));_0x24065f[_0x72ab('0x3f')]=_0x24065f[_0x72ab('0x3f')][_0x72ab('0x4f')]?_0x24065f[_0x72ab('0x3f')]:_0x33cac0['model'];_0x24065f[_0x72ab('0x57')]=qs[_0x72ab('0x44')](_0x115741[_0x72ab('0x3a')]['sort']);_0x24065f[_0x72ab('0x45')]=qs[_0x72ab('0x3c')](_[_0x72ab('0x46')](_0x115741[_0x72ab('0x3a')],_0x33cac0[_0x72ab('0x3c')]));if(_0x115741[_0x72ab('0x3a')]['filter']){_0x24065f[_0x72ab('0x45')]=_[_0x72ab('0x48')](_0x24065f[_0x72ab('0x45')],{'$or':_[_0x72ab('0x35')](_0x24065f[_0x72ab('0x3f')],function(_0x4f7125){var _0x1b4984={};_0x1b4984[_0x4f7125]={'$like':'%'+_0x115741[_0x72ab('0x3a')][_0x72ab('0x47')]+'%'};return _0x1b4984;})});}_0x24065f=_[_0x72ab('0x48')]({},_0x24065f,_0x115741[_0x72ab('0x4a')]);return _0x1b06c0[_0x72ab('0x58')](_0x24065f);}})[_0x72ab('0x1e')](function(_0x267f2c){if(_0x267f2c){_0x81d39d=_0x267f2c[_0x72ab('0x4f')];if(!_0x115741[_0x72ab('0x3a')][_0x72ab('0x41')](_0x72ab('0x42'))){_0x24065f['limit']=qs[_0x72ab('0x43')](_0x115741[_0x72ab('0x3a')][_0x72ab('0x43')]);_0x24065f[_0x72ab('0x2b')]=qs['offset'](_0x115741[_0x72ab('0x3a')][_0x72ab('0x2b')]);}return _0x1b06c0['getDescriptions'](_0x24065f);}})[_0x72ab('0x1e')](function(_0x5ad04c){if(_0x5ad04c){return _0x5ad04c?{'count':_0x81d39d,'rows':_0x5ad04c}:null;}})[_0x72ab('0x1e')](respondWithResult(_0xd9d0da,null))[_0x72ab('0x26')](handleError(_0xd9d0da,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index b3e0ab0..57a1cc8 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 _0x79f5=['int_vtiger_configurations','util','api','bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define'];(function(_0x5185ab,_0x2905bf){var _0x15ee46=function(_0x42d4da){while(--_0x42d4da){_0x5185ab['push'](_0x5185ab['shift']());}};_0x15ee46(++_0x2905bf);}(_0x79f5,0x14b));var _0x579f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x79f5[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x579f('0x0'));var logger=require('../../config/logger')(_0x579f('0x1'));var moment=require('moment');var BPromise=require(_0x579f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x579f('0x3'));var rimraf=require(_0x579f('0x4'));var config=require(_0x579f('0x5'));var attributes=require(_0x579f('0x6'));module[_0x579f('0x7')]=function(_0x5920b0,_0x3a6948){return _0x5920b0[_0x579f('0x8')]('VtigerConfiguration',attributes,{'tableName':_0x579f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d8f=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3dc395,_0x307260){var _0x35d039=function(_0x161f88){while(--_0x161f88){_0x3dc395['push'](_0x3dc395['shift']());}};_0x35d039(++_0x307260);}(_0x8d8f,0xc5));var _0xf8d8=function(_0x3d17f5,_0x248c4e){_0x3d17f5=_0x3d17f5-0x0;var _0x3a2dbf=_0x8d8f[_0x3d17f5];return _0x3a2dbf;};'use strict';var _=require(_0xf8d8('0x0'));var util=require('util');var logger=require(_0xf8d8('0x1'))(_0xf8d8('0x2'));var moment=require('moment');var BPromise=require(_0xf8d8('0x3'));var rp=require(_0xf8d8('0x4'));var fs=require('fs');var path=require(_0xf8d8('0x5'));var rimraf=require(_0xf8d8('0x6'));var config=require(_0xf8d8('0x7'));var attributes=require(_0xf8d8('0x8'));module[_0xf8d8('0x9')]=function(_0x54b635,_0x3954e4){return _0x54b635[_0xf8d8('0xa')]('VtigerConfiguration',attributes,{'tableName':_0xf8d8('0xb'),'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 4bfb247..8255e3e 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 _0x0f64=['stringify','error','code','message','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2e67eb,_0x1ada59){var _0x11bf2b=function(_0x9390f3){while(--_0x9390f3){_0x2e67eb['push'](_0x2e67eb['shift']());}};_0x11bf2b(++_0x1ada59);}(_0x0f64,0x1be));var _0x40f6=function(_0xd87a4e,_0x5ad3ae){_0xd87a4e=_0xd87a4e-0x0;var _0x5ed862=_0x0f64[_0xd87a4e];return _0x5ed862;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x40f6('0x0'));var fs=require('fs');var Redis=require(_0x40f6('0x1'));var db=require(_0x40f6('0x2'))['db'];var utils=require(_0x40f6('0x3'));var logger=require(_0x40f6('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x40f6('0x5'));var client=jayson[_0x40f6('0x6')][_0x40f6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5c5189,_0x46f2e6,_0x256135){return new BPromise(function(_0x164fd8,_0x105386){return client[_0x40f6('0x8')](_0x5c5189,_0x256135)['then'](function(_0x141bf4){logger[_0x40f6('0x9')](_0x40f6('0xa'),_0x46f2e6,'request\x20sent');logger[_0x40f6('0xb')](_0x40f6('0xc'),_0x46f2e6,_0x40f6('0xd'),JSON[_0x40f6('0xe')](_0x141bf4));if(_0x141bf4['error']){if(_0x141bf4[_0x40f6('0xf')][_0x40f6('0x10')]===0x1f4){logger[_0x40f6('0xf')](_0x40f6('0xa'),_0x46f2e6,_0x141bf4[_0x40f6('0xf')]['message']);return _0x105386(_0x141bf4['error'][_0x40f6('0x11')]);}logger[_0x40f6('0xf')](_0x40f6('0xa'),_0x46f2e6,_0x141bf4[_0x40f6('0xf')]['message']);return _0x164fd8(_0x141bf4[_0x40f6('0xf')]['message']);}else{logger[_0x40f6('0x9')](_0x40f6('0xa'),_0x46f2e6,'request\x20sent');_0x164fd8(_0x141bf4[_0x40f6('0x12')][_0x40f6('0x11')]);}})[_0x40f6('0x13')](function(_0xf1a207){logger['error'](_0x40f6('0xa'),_0x46f2e6,_0xf1a207);_0x105386(_0xf1a207);});});} \ No newline at end of file +var _0x3655=['rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2c7214,_0x1a0625){var _0x55c7d0=function(_0x2afe89){while(--_0x2afe89){_0x2c7214['push'](_0x2c7214['shift']());}};_0x55c7d0(++_0x1a0625);}(_0x3655,0x9a));var _0x5365=function(_0x50972d,_0x1376a9){_0x50972d=_0x50972d-0x0;var _0x334bb8=_0x3655[_0x50972d];return _0x334bb8;};'use strict';var _=require('lodash');var util=require(_0x5365('0x0'));var moment=require('moment');var BPromise=require(_0x5365('0x1'));var rs=require(_0x5365('0x2'));var fs=require('fs');var Redis=require(_0x5365('0x3'));var db=require(_0x5365('0x4'))['db'];var utils=require(_0x5365('0x5'));var logger=require(_0x5365('0x6'))(_0x5365('0x7'));var config=require(_0x5365('0x8'));var jayson=require(_0x5365('0x9'));var client=jayson[_0x5365('0xa')][_0x5365('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31f93e,_0x20b219,_0xdaa904){return new BPromise(function(_0x4975fe,_0x992845){return client[_0x5365('0xc')](_0x31f93e,_0xdaa904)['then'](function(_0x56f7eb){logger[_0x5365('0xd')](_0x5365('0xe'),_0x20b219,_0x5365('0xf'));logger[_0x5365('0x10')](_0x5365('0x11'),_0x20b219,'request\x20sent',JSON[_0x5365('0x12')](_0x56f7eb));if(_0x56f7eb[_0x5365('0x13')]){if(_0x56f7eb[_0x5365('0x13')][_0x5365('0x14')]===0x1f4){logger[_0x5365('0x13')](_0x5365('0xe'),_0x20b219,_0x56f7eb[_0x5365('0x13')][_0x5365('0x15')]);return _0x992845(_0x56f7eb['error'][_0x5365('0x15')]);}logger[_0x5365('0x13')](_0x5365('0xe'),_0x20b219,_0x56f7eb[_0x5365('0x13')]['message']);return _0x4975fe(_0x56f7eb[_0x5365('0x13')][_0x5365('0x15')]);}else{logger[_0x5365('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x20b219,_0x5365('0xf'));_0x4975fe(_0x56f7eb[_0x5365('0x16')]['message']);}})['catch'](function(_0x3396a9){logger[_0x5365('0x13')](_0x5365('0xe'),_0x20b219,_0x3396a9);_0x992845(_0x3396a9);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 876b34d..ea05ff0 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 _0x6f14=['./intVtigerField.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','util','Router','../../config/environment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6f14,0x75));var _0x46f1=function(_0xb8a206,_0x328cde){_0xb8a206=_0xb8a206-0x0;var _0x49b515=_0x6f14[_0xb8a206];return _0x49b515;};'use strict';var multer=require('multer');var util=require(_0x46f1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x46f1('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x46f1('0x2'));var controller=require(_0x46f1('0x3'));router[_0x46f1('0x4')]('/',auth['isAuthenticated'](),controller[_0x46f1('0x5')]);router[_0x46f1('0x4')](_0x46f1('0x6'),auth[_0x46f1('0x7')](),controller[_0x46f1('0x8')]);router[_0x46f1('0x9')]('/',auth[_0x46f1('0x7')](),controller[_0x46f1('0xa')]);router[_0x46f1('0xb')](_0x46f1('0x6'),auth['isAuthenticated'](),controller['update']);router[_0x46f1('0xc')](_0x46f1('0x6'),auth[_0x46f1('0x7')](),controller[_0x46f1('0xd')]);module[_0x46f1('0xe')]=router; \ No newline at end of file +var _0x0e26=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x130cd3,_0x548317){var _0x2a12c9=function(_0x2929d2){while(--_0x2929d2){_0x130cd3['push'](_0x130cd3['shift']());}};_0x2a12c9(++_0x548317);}(_0x0e26,0x128));var _0x60e2=function(_0x2d0196,_0x56fe4c){_0x2d0196=_0x2d0196-0x0;var _0x4d72f8=_0x0e26[_0x2d0196];return _0x4d72f8;};'use strict';var multer=require(_0x60e2('0x0'));var util=require(_0x60e2('0x1'));var path=require('path');var timeout=require(_0x60e2('0x2'));var express=require(_0x60e2('0x3'));var router=express[_0x60e2('0x4')]();var auth=require(_0x60e2('0x5'));var interaction=require(_0x60e2('0x6'));var config=require(_0x60e2('0x7'));var controller=require(_0x60e2('0x8'));router[_0x60e2('0x9')]('/',auth['isAuthenticated'](),controller[_0x60e2('0xa')]);router[_0x60e2('0x9')](_0x60e2('0xb'),auth[_0x60e2('0xc')](),controller[_0x60e2('0xd')]);router[_0x60e2('0xe')]('/',auth[_0x60e2('0xc')](),controller[_0x60e2('0xf')]);router[_0x60e2('0x10')](_0x60e2('0xb'),auth[_0x60e2('0xc')](),controller['update']);router[_0x60e2('0x11')]('/:id',auth[_0x60e2('0xc')](),controller[_0x60e2('0x12')]);module[_0x60e2('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 fa9bc99..4624ee4 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 _0x79e5=['variable','customVariable','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x5a17e7,_0x528c7e){var _0xb8e1f1=function(_0x2fd92c){while(--_0x2fd92c){_0x5a17e7['push'](_0x5a17e7['shift']());}};_0xb8e1f1(++_0x528c7e);}(_0x79e5,0x170));var _0x579e=function(_0x417dea,_0x58bb10){_0x417dea=_0x417dea-0x0;var _0x110ac4=_0x79e5[_0x417dea];return _0x110ac4;};'use strict';var Sequelize=require(_0x579e('0x0'));module['exports']={'type':{'type':Sequelize[_0x579e('0x1')](_0x579e('0x2'),_0x579e('0x3'),_0x579e('0x4'),'keyValue'),'defaultValue':_0x579e('0x2')},'content':{'type':Sequelize[_0x579e('0x5')]},'key':{'type':Sequelize[_0x579e('0x5')]},'keyType':{'type':Sequelize[_0x579e('0x1')](_0x579e('0x2'),'variable',_0x579e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x579e('0x5')]},'nameField':{'type':Sequelize[_0x579e('0x5')]},'customField':{'type':Sequelize[_0x579e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1413=['keyValue','STRING','exports','ENUM','string','variable'];(function(_0x23cbae,_0x1d2798){var _0xefe6f1=function(_0x27e4cd){while(--_0x27e4cd){_0x23cbae['push'](_0x23cbae['shift']());}};_0xefe6f1(++_0x1d2798);}(_0x1413,0x170));var _0x3141=function(_0xb061f4,_0x70e056){_0xb061f4=_0xb061f4-0x0;var _0x269b11=_0x1413[_0xb061f4];return _0x269b11;};'use strict';var Sequelize=require('sequelize');module[_0x3141('0x0')]={'type':{'type':Sequelize[_0x3141('0x1')](_0x3141('0x2'),_0x3141('0x3'),'customVariable',_0x3141('0x4')),'defaultValue':_0x3141('0x2')},'content':{'type':Sequelize[_0x3141('0x5')]},'key':{'type':Sequelize[_0x3141('0x5')]},'keyType':{'type':Sequelize[_0x3141('0x1')]('string',_0x3141('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x3141('0x5')]},'idField':{'type':Sequelize[_0x3141('0x5')]},'nameField':{'type':Sequelize[_0x3141('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3141('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 6986be2..9a2f1ff 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 _0xb04a=['bluebird','util','path','sox','ejs','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','set','Content-Range','apply','save','destroy','then','end','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','rows','show','params','include','find','catch','create','body','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x556d13,_0xc7e4d6){var _0x410b54=function(_0x761b0e){while(--_0x761b0e){_0x556d13['push'](_0x556d13['shift']());}};_0x410b54(++_0xc7e4d6);}(_0xb04a,0xcf));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xab04('0x0'));var emlformat=require(_0xab04('0x1'));var rimraf=require(_0xab04('0x2'));var zipdir=require(_0xab04('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab04('0x4'));var moment=require(_0xab04('0x5'));var BPromise=require(_0xab04('0x6'));var Mustache=require('mustache');var util=require(_0xab04('0x7'));var path=require(_0xab04('0x8'));var sox=require(_0xab04('0x9'));var csv=require('to-csv');var ejs=require(_0xab04('0xa'));var fs=require('fs');var _=require(_0xab04('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xab04('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xab04('0xd'));var authService=require(_0xab04('0xe'));var qs=require(_0xab04('0xf'));var as=require(_0xab04('0x10'));var hardwareService=require(_0xab04('0x11'));var logger=require(_0xab04('0x12'))(_0xab04('0x13'));var utils=require(_0xab04('0x14'));var config=require(_0xab04('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5032bc,_0x38e003){_0x38e003=_0x38e003||0xcc;return function(_0x3cf546){if(_0x3cf546){return _0x5032bc[_0xab04('0x16')](_0x38e003);}return _0x5032bc[_0xab04('0x17')](_0x38e003)['end']();};}function respondWithResult(_0x9d9ba3,_0x2934bd){_0x2934bd=_0x2934bd||0xc8;return function(_0x5e3471){if(_0x5e3471){return _0x9d9ba3[_0xab04('0x17')](_0x2934bd)[_0xab04('0x18')](_0x5e3471);}};}function respondWithFilteredResult(_0x1acc57,_0x1fb034){return function(_0x2cff48){if(_0x2cff48){var _0x523c51=_0x2cff48[_0xab04('0x19')],_0x3371ed=_0x1fb034[_0xab04('0x1a')],_0x1cc965=_0x1fb034['offset']+_0x1fb034['limit'],_0x3965d6;if(_0x1cc965>=_0x523c51){_0x1cc965=_0x523c51;_0x3965d6=0xc8;}else{_0x3965d6=0xce;}_0x1acc57[_0xab04('0x17')](_0x3965d6);return _0x1acc57[_0xab04('0x1b')](_0xab04('0x1c'),_0x3371ed+'-'+_0x1cc965+'/'+_0x523c51)['json'](_0x2cff48);}return null;};}function patchUpdates(_0x597abc){return function(_0x39cc0d){try{jsonpatch[_0xab04('0x1d')](_0x39cc0d,_0x597abc,!![]);}catch(_0x45bce0){return BPromise['reject'](_0x45bce0);}return _0x39cc0d[_0xab04('0x1e')]();};}function saveUpdates(_0x553ed5,_0x395c6b){return function(_0x2ac32c){if(_0x2ac32c){return _0x2ac32c['update'](_0x553ed5)['then'](function(_0xd9958f){return _0xd9958f;});}return null;};}function removeEntity(_0x8b74c4,_0x5a204c){return function(_0x3f0d72){if(_0x3f0d72){return _0x3f0d72[_0xab04('0x1f')]()[_0xab04('0x20')](function(){_0x8b74c4[_0xab04('0x17')](0xcc)[_0xab04('0x21')]();});}};}function handleEntityNotFound(_0x4c7a19,_0x19fcab){return function(_0x4df287){if(!_0x4df287){_0x4c7a19[_0xab04('0x16')](0x194);}return _0x4df287;};}function handleError(_0x11a7d1,_0x561525){_0x561525=_0x561525||0x1f4;return function(_0x3af4da){logger['error'](_0x3af4da['stack']);if(_0x3af4da['name']){delete _0x3af4da[_0xab04('0x22')];}_0x11a7d1[_0xab04('0x17')](_0x561525)[_0xab04('0x23')](_0x3af4da);};}exports[_0xab04('0x24')]=function(_0x2d9128,_0x4a5124){var _0x59546a={},_0x19f651={},_0x4a4532={'count':0x0,'rows':[]};var _0xb8e7b=_[_0xab04('0x25')](db[_0xab04('0x26')][_0xab04('0x27')],function(_0x331aa9){return{'name':_0x331aa9[_0xab04('0x28')],'type':_0x331aa9['type'][_0xab04('0x29')]};});_0x19f651[_0xab04('0x2a')]=_['map'](_0xb8e7b,_0xab04('0x22'));_0x19f651[_0xab04('0x2b')]=_[_0xab04('0x2c')](_0x2d9128[_0xab04('0x2b')]);_0x19f651[_0xab04('0x2d')]=_[_0xab04('0x2e')](_0x19f651['model'],_0x19f651[_0xab04('0x2b')]);_0x59546a['attributes']=_[_0xab04('0x2e')](_0x19f651[_0xab04('0x2a')],qs[_0xab04('0x2f')](_0x2d9128[_0xab04('0x2b')]['fields']));_0x59546a[_0xab04('0x30')]=_0x59546a['attributes'][_0xab04('0x31')]?_0x59546a[_0xab04('0x30')]:_0x19f651[_0xab04('0x2a')];if(!_0x2d9128[_0xab04('0x2b')][_0xab04('0x32')](_0xab04('0x33'))){_0x59546a[_0xab04('0x34')]=qs['limit'](_0x2d9128['query'][_0xab04('0x34')]);_0x59546a[_0xab04('0x1a')]=qs[_0xab04('0x1a')](_0x2d9128['query'][_0xab04('0x1a')]);}_0x59546a[_0xab04('0x35')]=qs['sort'](_0x2d9128[_0xab04('0x2b')][_0xab04('0x36')]);_0x59546a[_0xab04('0x37')]=qs[_0xab04('0x2d')](_[_0xab04('0x38')](_0x2d9128['query'],_0x19f651[_0xab04('0x2d')]),_0xb8e7b);if(_0x2d9128['query']['filter']){_0x59546a[_0xab04('0x37')]=_[_0xab04('0x39')](_0x59546a[_0xab04('0x37')],{'$or':_[_0xab04('0x25')](_0xb8e7b,function(_0x4ac94a){if(_0x4ac94a[_0xab04('0x3a')]!==_0xab04('0x3b')){var _0x4f8e16={};_0x4f8e16[_0x4ac94a[_0xab04('0x22')]]={'$like':'%'+_0x2d9128[_0xab04('0x2b')]['filter']+'%'};return _0x4f8e16;}})});}_0x59546a=_[_0xab04('0x39')]({},_0x59546a,_0x2d9128[_0xab04('0x3c')]);var _0x977023={'where':_0x59546a['where']};return db[_0xab04('0x26')]['count'](_0x977023)[_0xab04('0x20')](function(_0x4734fd){_0x4a4532[_0xab04('0x19')]=_0x4734fd;if(_0x2d9128[_0xab04('0x2b')][_0xab04('0x3d')]){_0x59546a['include']=[{'all':!![]}];}return db[_0xab04('0x26')]['findAll'](_0x59546a);})[_0xab04('0x20')](function(_0xc66c31){_0x4a4532[_0xab04('0x3e')]=_0xc66c31;return _0x4a4532;})[_0xab04('0x20')](respondWithFilteredResult(_0x4a5124,_0x59546a))['catch'](handleError(_0x4a5124,null));};exports[_0xab04('0x3f')]=function(_0x876b73,_0x10cc40){var _0x5e915d={'raw':!![],'where':{'id':_0x876b73[_0xab04('0x40')]['id']}},_0x42679f={};_0x42679f[_0xab04('0x2a')]=_[_0xab04('0x2c')](db['VtigerField']['rawAttributes']);_0x42679f['query']=_[_0xab04('0x2c')](_0x876b73[_0xab04('0x2b')]);_0x42679f[_0xab04('0x2d')]=_[_0xab04('0x2e')](_0x42679f[_0xab04('0x2a')],_0x42679f[_0xab04('0x2b')]);_0x5e915d[_0xab04('0x30')]=_['intersection'](_0x42679f[_0xab04('0x2a')],qs[_0xab04('0x2f')](_0x876b73[_0xab04('0x2b')]['fields']));_0x5e915d[_0xab04('0x30')]=_0x5e915d['attributes'][_0xab04('0x31')]?_0x5e915d['attributes']:_0x42679f[_0xab04('0x2a')];if(_0x876b73[_0xab04('0x2b')][_0xab04('0x3d')]){_0x5e915d[_0xab04('0x41')]=[{'all':!![]}];}_0x5e915d=_[_0xab04('0x39')]({},_0x5e915d,_0x876b73[_0xab04('0x3c')]);return db['VtigerField'][_0xab04('0x42')](_0x5e915d)[_0xab04('0x20')](handleEntityNotFound(_0x10cc40,null))[_0xab04('0x20')](respondWithResult(_0x10cc40,null))[_0xab04('0x43')](handleError(_0x10cc40,null));};exports[_0xab04('0x44')]=function(_0x529977,_0x3898b3){return db[_0xab04('0x26')][_0xab04('0x44')](_0x529977[_0xab04('0x45')],{})[_0xab04('0x20')](respondWithResult(_0x3898b3,0xc9))[_0xab04('0x43')](handleError(_0x3898b3,null));};exports[_0xab04('0x46')]=function(_0x32cc59,_0x4936b0){if(_0x32cc59['body']['id']){delete _0x32cc59['body']['id'];}return db['VtigerField'][_0xab04('0x42')]({'where':{'id':_0x32cc59['params']['id']}})['then'](handleEntityNotFound(_0x4936b0,null))[_0xab04('0x20')](saveUpdates(_0x32cc59[_0xab04('0x45')],null))['then'](respondWithResult(_0x4936b0,null))['catch'](handleError(_0x4936b0,null));};exports[_0xab04('0x1f')]=function(_0x3ea473,_0x1080e2){return db[_0xab04('0x26')][_0xab04('0x42')]({'where':{'id':_0x3ea473[_0xab04('0x40')]['id']}})['then'](handleEntityNotFound(_0x1080e2,null))[_0xab04('0x20')](removeEntity(_0x1080e2,null))[_0xab04('0x43')](handleError(_0x1080e2,null));}; \ No newline at end of file +var _0x3440=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','save','then','destroy','stack','name','map','VtigerField','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','fields','body','update','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x3440,0x18e));var _0x0344=function(_0x21713d,_0x278400){_0x21713d=_0x21713d-0x0;var _0x91bc26=_0x3440[_0x21713d];return _0x91bc26;};'use strict';var pdf=require(_0x0344('0x0'));var emlformat=require(_0x0344('0x1'));var rimraf=require(_0x0344('0x2'));var zipdir=require(_0x0344('0x3'));var jsonpatch=require(_0x0344('0x4'));var rp=require(_0x0344('0x5'));var moment=require('moment');var BPromise=require(_0x0344('0x6'));var Mustache=require('mustache');var util=require(_0x0344('0x7'));var path=require(_0x0344('0x8'));var sox=require(_0x0344('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0344('0xa'));var squel=require(_0x0344('0xb'));var crypto=require(_0x0344('0xc'));var jsforce=require(_0x0344('0xd'));var deskjs=require(_0x0344('0xe'));var toCsv=require(_0x0344('0xf'));var querystring=require('querystring');var Papa=require(_0x0344('0x10'));var Redis=require('ioredis');var authService=require(_0x0344('0x11'));var qs=require(_0x0344('0x12'));var as=require(_0x0344('0x13'));var hardwareService=require(_0x0344('0x14'));var logger=require(_0x0344('0x15'))('api');var utils=require(_0x0344('0x16'));var config=require(_0x0344('0x17'));var db=require(_0x0344('0x18'))['db'];function respondWithStatusCode(_0x2421df,_0xd721bc){_0xd721bc=_0xd721bc||0xcc;return function(_0x2c8e2f){if(_0x2c8e2f){return _0x2421df[_0x0344('0x19')](_0xd721bc);}return _0x2421df[_0x0344('0x1a')](_0xd721bc)[_0x0344('0x1b')]();};}function respondWithResult(_0x37e000,_0x21b718){_0x21b718=_0x21b718||0xc8;return function(_0x45f1af){if(_0x45f1af){return _0x37e000[_0x0344('0x1a')](_0x21b718)[_0x0344('0x1c')](_0x45f1af);}};}function respondWithFilteredResult(_0x3e8790,_0x548c30){return function(_0x59bad2){if(_0x59bad2){var _0x59e05b=_0x59bad2['count'],_0x397acf=_0x548c30[_0x0344('0x1d')],_0x2d6f46=_0x548c30[_0x0344('0x1d')]+_0x548c30[_0x0344('0x1e')],_0x1efbe2;if(_0x2d6f46>=_0x59e05b){_0x2d6f46=_0x59e05b;_0x1efbe2=0xc8;}else{_0x1efbe2=0xce;}_0x3e8790[_0x0344('0x1a')](_0x1efbe2);return _0x3e8790[_0x0344('0x1f')]('Content-Range',_0x397acf+'-'+_0x2d6f46+'/'+_0x59e05b)[_0x0344('0x1c')](_0x59bad2);}return null;};}function patchUpdates(_0x1cd948){return function(_0x5d30cd){try{jsonpatch[_0x0344('0x20')](_0x5d30cd,_0x1cd948,!![]);}catch(_0x38f0af){return BPromise['reject'](_0x38f0af);}return _0x5d30cd[_0x0344('0x21')]();};}function saveUpdates(_0x50c491,_0x33a1d2){return function(_0x8d2a31){if(_0x8d2a31){return _0x8d2a31['update'](_0x50c491)[_0x0344('0x22')](function(_0x3c5ec8){return _0x3c5ec8;});}return null;};}function removeEntity(_0x30ccef,_0x27512f){return function(_0x474071){if(_0x474071){return _0x474071[_0x0344('0x23')]()[_0x0344('0x22')](function(){_0x30ccef['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x132b1e,_0x65d7ff){return function(_0x3ba572){if(!_0x3ba572){_0x132b1e['sendStatus'](0x194);}return _0x3ba572;};}function handleError(_0x8e74e6,_0x17c58d){_0x17c58d=_0x17c58d||0x1f4;return function(_0x296f47){logger['error'](_0x296f47[_0x0344('0x24')]);if(_0x296f47[_0x0344('0x25')]){delete _0x296f47[_0x0344('0x25')];}_0x8e74e6[_0x0344('0x1a')](_0x17c58d)['send'](_0x296f47);};}exports['index']=function(_0x257250,_0x55af3d){var _0x34689c={},_0x33574b={},_0x21220e={'count':0x0,'rows':[]};var _0x5b5299=_[_0x0344('0x26')](db[_0x0344('0x27')][_0x0344('0x28')],function(_0x46416a){return{'name':_0x46416a['fieldName'],'type':_0x46416a[_0x0344('0x29')][_0x0344('0x2a')]};});_0x33574b[_0x0344('0x2b')]=_[_0x0344('0x26')](_0x5b5299,'name');_0x33574b['query']=_[_0x0344('0x2c')](_0x257250[_0x0344('0x2d')]);_0x33574b[_0x0344('0x2e')]=_[_0x0344('0x2f')](_0x33574b[_0x0344('0x2b')],_0x33574b[_0x0344('0x2d')]);_0x34689c[_0x0344('0x30')]=_[_0x0344('0x2f')](_0x33574b[_0x0344('0x2b')],qs['fields'](_0x257250['query']['fields']));_0x34689c[_0x0344('0x30')]=_0x34689c[_0x0344('0x30')][_0x0344('0x31')]?_0x34689c['attributes']:_0x33574b[_0x0344('0x2b')];if(!_0x257250[_0x0344('0x2d')][_0x0344('0x32')](_0x0344('0x33'))){_0x34689c[_0x0344('0x1e')]=qs['limit'](_0x257250[_0x0344('0x2d')][_0x0344('0x1e')]);_0x34689c[_0x0344('0x1d')]=qs[_0x0344('0x1d')](_0x257250['query']['offset']);}_0x34689c['order']=qs[_0x0344('0x34')](_0x257250['query']['sort']);_0x34689c[_0x0344('0x35')]=qs[_0x0344('0x2e')](_['pick'](_0x257250[_0x0344('0x2d')],_0x33574b[_0x0344('0x2e')]),_0x5b5299);if(_0x257250[_0x0344('0x2d')][_0x0344('0x36')]){_0x34689c['where']=_[_0x0344('0x37')](_0x34689c['where'],{'$or':_[_0x0344('0x26')](_0x5b5299,function(_0x52cfd1){if(_0x52cfd1['type']!==_0x0344('0x38')){var _0x15055e={};_0x15055e[_0x52cfd1[_0x0344('0x25')]]={'$like':'%'+_0x257250['query']['filter']+'%'};return _0x15055e;}})});}_0x34689c=_[_0x0344('0x37')]({},_0x34689c,_0x257250[_0x0344('0x39')]);var _0xeaae47={'where':_0x34689c[_0x0344('0x35')]};return db[_0x0344('0x27')][_0x0344('0x3a')](_0xeaae47)[_0x0344('0x22')](function(_0x10298e){_0x21220e[_0x0344('0x3a')]=_0x10298e;if(_0x257250[_0x0344('0x2d')][_0x0344('0x3b')]){_0x34689c[_0x0344('0x3c')]=[{'all':!![]}];}return db[_0x0344('0x27')][_0x0344('0x3d')](_0x34689c);})[_0x0344('0x22')](function(_0x2937f2){_0x21220e[_0x0344('0x3e')]=_0x2937f2;return _0x21220e;})[_0x0344('0x22')](respondWithFilteredResult(_0x55af3d,_0x34689c))[_0x0344('0x3f')](handleError(_0x55af3d,null));};exports['show']=function(_0x3a61ab,_0x5d7b6d){var _0x6704ba={'raw':!![],'where':{'id':_0x3a61ab[_0x0344('0x40')]['id']}},_0x26ffa7={};_0x26ffa7[_0x0344('0x2b')]=_[_0x0344('0x2c')](db[_0x0344('0x27')][_0x0344('0x28')]);_0x26ffa7['query']=_[_0x0344('0x2c')](_0x3a61ab[_0x0344('0x2d')]);_0x26ffa7[_0x0344('0x2e')]=_[_0x0344('0x2f')](_0x26ffa7[_0x0344('0x2b')],_0x26ffa7[_0x0344('0x2d')]);_0x6704ba[_0x0344('0x30')]=_[_0x0344('0x2f')](_0x26ffa7[_0x0344('0x2b')],qs[_0x0344('0x41')](_0x3a61ab[_0x0344('0x2d')][_0x0344('0x41')]));_0x6704ba[_0x0344('0x30')]=_0x6704ba[_0x0344('0x30')]['length']?_0x6704ba[_0x0344('0x30')]:_0x26ffa7['model'];if(_0x3a61ab['query'][_0x0344('0x3b')]){_0x6704ba['include']=[{'all':!![]}];}_0x6704ba=_[_0x0344('0x37')]({},_0x6704ba,_0x3a61ab[_0x0344('0x39')]);return db['VtigerField']['find'](_0x6704ba)[_0x0344('0x22')](handleEntityNotFound(_0x5d7b6d,null))[_0x0344('0x22')](respondWithResult(_0x5d7b6d,null))[_0x0344('0x3f')](handleError(_0x5d7b6d,null));};exports['create']=function(_0x5d7f45,_0x5cdbc2){return db[_0x0344('0x27')]['create'](_0x5d7f45[_0x0344('0x42')],{})[_0x0344('0x22')](respondWithResult(_0x5cdbc2,0xc9))[_0x0344('0x3f')](handleError(_0x5cdbc2,null));};exports[_0x0344('0x43')]=function(_0x3b8311,_0x27de9f){if(_0x3b8311[_0x0344('0x42')]['id']){delete _0x3b8311[_0x0344('0x42')]['id'];}return db['VtigerField'][_0x0344('0x44')]({'where':{'id':_0x3b8311[_0x0344('0x40')]['id']}})['then'](handleEntityNotFound(_0x27de9f,null))[_0x0344('0x22')](saveUpdates(_0x3b8311[_0x0344('0x42')],null))[_0x0344('0x22')](respondWithResult(_0x27de9f,null))['catch'](handleError(_0x27de9f,null));};exports[_0x0344('0x23')]=function(_0x5d0a9c,_0x31823e){return db[_0x0344('0x27')][_0x0344('0x44')]({'where':{'id':_0x5d0a9c[_0x0344('0x40')]['id']}})['then'](handleEntityNotFound(_0x31823e,null))[_0x0344('0x22')](removeEntity(_0x31823e,null))[_0x0344('0x3f')](handleError(_0x31823e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 0581fc3..02ce50e 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x44029f,_0xb8c7fb){var _0xd99219=function(_0x304c1d){while(--_0x304c1d){_0x44029f['push'](_0x44029f['shift']());}};_0xd99219(++_0xb8c7fb);}(_0x7a54,0x106));var _0x47a5=function(_0x4add8e,_0x456f87){_0x4add8e=_0x4add8e-0x0;var _0x4b76a3=_0x7a54[_0x4add8e];return _0x4b76a3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_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':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 090bce4..67adc59 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 _0xbdfb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0xbdfb,0x1ef));var _0xbbdf=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0xbdfb[_0x35c5a8];return _0x34782c;};'use strict';var _=require(_0xbbdf('0x0'));var util=require(_0xbbdf('0x1'));var moment=require(_0xbbdf('0x2'));var BPromise=require(_0xbbdf('0x3'));var rs=require(_0xbbdf('0x4'));var fs=require('fs');var Redis=require(_0xbbdf('0x5'));var db=require(_0xbbdf('0x6'))['db'];var utils=require(_0xbbdf('0x7'));var logger=require(_0xbbdf('0x8'))(_0xbbdf('0x9'));var config=require('../../config/environment');var jayson=require(_0xbbdf('0xa'));var client=jayson[_0xbbdf('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c930d,_0x17c835,_0x58a929){return new BPromise(function(_0x2f9954,_0x2ae0d8){return client[_0xbbdf('0xc')](_0x3c930d,_0x58a929)[_0xbbdf('0xd')](function(_0x4c1436){logger[_0xbbdf('0xe')](_0xbbdf('0xf'),_0x17c835,'request\x20sent');logger[_0xbbdf('0x10')](_0xbbdf('0x11'),_0x17c835,_0xbbdf('0x12'),JSON[_0xbbdf('0x13')](_0x4c1436));if(_0x4c1436['error']){if(_0x4c1436[_0xbbdf('0x14')][_0xbbdf('0x15')]===0x1f4){logger[_0xbbdf('0x14')]('VtigerField,\x20%s,\x20%s',_0x17c835,_0x4c1436['error']['message']);return _0x2ae0d8(_0x4c1436['error'][_0xbbdf('0x16')]);}logger[_0xbbdf('0x14')](_0xbbdf('0xf'),_0x17c835,_0x4c1436['error'][_0xbbdf('0x16')]);return _0x2f9954(_0x4c1436[_0xbbdf('0x14')][_0xbbdf('0x16')]);}else{logger[_0xbbdf('0xe')](_0xbbdf('0xf'),_0x17c835,'request\x20sent');_0x2f9954(_0x4c1436[_0xbbdf('0x17')][_0xbbdf('0x16')]);}})[_0xbbdf('0x18')](function(_0x547b94){logger['error'](_0xbbdf('0xf'),_0x17c835,_0x547b94);_0x2ae0d8(_0x547b94);});});} \ No newline at end of file +var _0xb78e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird'];(function(_0x3e103d,_0x55790c){var _0x4931bf=function(_0x541250){while(--_0x541250){_0x3e103d['push'](_0x3e103d['shift']());}};_0x4931bf(++_0x55790c);}(_0xb78e,0x1c9));var _0xeb78=function(_0x430eb0,_0x1350aa){_0x430eb0=_0x430eb0-0x0;var _0x1acbfb=_0xb78e[_0x430eb0];return _0x1acbfb;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var moment=require('moment');var BPromise=require(_0xeb78('0x2'));var rs=require(_0xeb78('0x3'));var fs=require('fs');var Redis=require(_0xeb78('0x4'));var db=require(_0xeb78('0x5'))['db'];var utils=require(_0xeb78('0x6'));var logger=require(_0xeb78('0x7'))(_0xeb78('0x8'));var config=require(_0xeb78('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb78('0xa')][_0xeb78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ccc2f,_0x30c884,_0x2b7925){return new BPromise(function(_0x36963f,_0x5259aa){return client['request'](_0x1ccc2f,_0x2b7925)[_0xeb78('0xc')](function(_0x1c941d){logger[_0xeb78('0xd')](_0xeb78('0xe'),_0x30c884,_0xeb78('0xf'));logger[_0xeb78('0x10')](_0xeb78('0x11'),_0x30c884,_0xeb78('0xf'),JSON[_0xeb78('0x12')](_0x1c941d));if(_0x1c941d['error']){if(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x14')]===0x1f4){logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);return _0x5259aa(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);}logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d['error'][_0xeb78('0x15')]);return _0x36963f(_0x1c941d[_0xeb78('0x13')]['message']);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x30c884,_0xeb78('0xf'));_0x36963f(_0x1c941d['result'][_0xeb78('0x15')]);}})[_0xeb78('0x16')](function(_0x49123d){logger[_0xeb78('0x13')]('VtigerField,\x20%s,\x20%s',_0x30c884,_0x49123d);_0x5259aa(_0x49123d);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 569a273..61d0104 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 _0xb088=['update','delete','destroy','exports','multer','util','path','express','Router','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','put'];(function(_0x1f90a6,_0x27b2b4){var _0x231f37=function(_0x5cdfe4){while(--_0x5cdfe4){_0x1f90a6['push'](_0x1f90a6['shift']());}};_0x231f37(++_0x27b2b4);}(_0xb088,0x1a8));var _0x8b08=function(_0x44e760,_0x10f3e0){_0x44e760=_0x44e760-0x0;var _0x15b4bf=_0xb088[_0x44e760];return _0x15b4bf;};'use strict';var multer=require(_0x8b08('0x0'));var util=require(_0x8b08('0x1'));var path=require(_0x8b08('0x2'));var timeout=require('connect-timeout');var express=require(_0x8b08('0x3'));var router=express[_0x8b08('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8b08('0x5'));var controller=require(_0x8b08('0x6'));router[_0x8b08('0x7')]('/',auth[_0x8b08('0x8')](),controller[_0x8b08('0x9')]);router[_0x8b08('0x7')](_0x8b08('0xa'),auth[_0x8b08('0x8')](),controller['show']);router[_0x8b08('0x7')](_0x8b08('0xb'),auth[_0x8b08('0x8')](),controller[_0x8b08('0xc')]);router['get'](_0x8b08('0xd'),auth[_0x8b08('0x8')](),controller['getFields']);router[_0x8b08('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x8b08('0x8')](),controller['addConfiguration']);router[_0x8b08('0xf')](_0x8b08('0xa'),auth[_0x8b08('0x8')](),controller[_0x8b08('0x10')]);router[_0x8b08('0x11')]('/:id',auth[_0x8b08('0x8')](),controller[_0x8b08('0x12')]);module[_0x8b08('0x13')]=router; \ No newline at end of file +var _0x5432=['Router','./intZendeskAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','path','express'];(function(_0xa7764a,_0x5f8085){var _0x360b53=function(_0x1f034c){while(--_0x1f034c){_0xa7764a['push'](_0xa7764a['shift']());}};_0x360b53(++_0x5f8085);}(_0x5432,0x1c5));var _0x2543=function(_0x37be20,_0x48a254){_0x37be20=_0x37be20-0x0;var _0x1e37d5=_0x5432[_0x37be20];return _0x1e37d5;};'use strict';var multer=require(_0x2543('0x0'));var util=require('util');var path=require(_0x2543('0x1'));var timeout=require('connect-timeout');var express=require(_0x2543('0x2'));var router=express[_0x2543('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2543('0x4'));router[_0x2543('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2543('0x5')](_0x2543('0x6'),auth[_0x2543('0x7')](),controller[_0x2543('0x8')]);router[_0x2543('0x5')]('/:id/configurations',auth[_0x2543('0x7')](),controller[_0x2543('0x9')]);router['get'](_0x2543('0xa'),auth[_0x2543('0x7')](),controller['getFields']);router[_0x2543('0xb')]('/',auth[_0x2543('0x7')](),controller[_0x2543('0xc')]);router[_0x2543('0xb')](_0x2543('0xd'),auth[_0x2543('0x7')](),controller[_0x2543('0xe')]);router['put']('/:id',auth[_0x2543('0x7')](),controller[_0x2543('0xf')]);router[_0x2543('0x10')](_0x2543('0x6'),auth[_0x2543('0x7')](),controller[_0x2543('0x11')]);module[_0x2543('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 02acb1e..61b8fa5 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 _0xba29=['username','remoteUri','ENUM','password','token','integrationTab','newTab','exports','STRING'];(function(_0x203b19,_0x257ecf){var _0xfe0d55=function(_0x13cd4c){while(--_0x13cd4c){_0x203b19['push'](_0x203b19['shift']());}};_0xfe0d55(++_0x257ecf);}(_0xba29,0x130));var _0x9ba2=function(_0x23b819,_0x26134a){_0x23b819=_0x23b819-0x0;var _0x4dbf03=_0xba29[_0x23b819];return _0x4dbf03;};'use strict';var Sequelize=require('sequelize');module[_0x9ba2('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9ba2('0x1')]},'username':{'type':Sequelize[_0x9ba2('0x1')],'unique':_0x9ba2('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9ba2('0x1')],'unique':_0x9ba2('0x3')},'authType':{'type':Sequelize[_0x9ba2('0x4')](_0x9ba2('0x5'),_0x9ba2('0x6')),'defaultValue':_0x9ba2('0x5')},'serverUrl':{'type':Sequelize[_0x9ba2('0x1')]},'type':{'type':Sequelize[_0x9ba2('0x4')](_0x9ba2('0x7'),_0x9ba2('0x8')),'defaultValue':_0x9ba2('0x7')}}; \ No newline at end of file +var _0x7d99=['username','remoteUri','ENUM','password','newTab','integrationTab','sequelize','STRING'];(function(_0x2327a1,_0x564269){var _0xfc0c30=function(_0x47dc74){while(--_0x47dc74){_0x2327a1['push'](_0x2327a1['shift']());}};_0xfc0c30(++_0x564269);}(_0x7d99,0x11e));var _0x97d9=function(_0x3df87c,_0x37d311){_0x3df87c=_0x3df87c-0x0;var _0x56b9b8=_0x7d99[_0x3df87c];return _0x56b9b8;};'use strict';var Sequelize=require(_0x97d9('0x0'));module['exports']={'name':{'type':Sequelize[_0x97d9('0x1')]},'description':{'type':Sequelize[_0x97d9('0x1')]},'username':{'type':Sequelize[_0x97d9('0x1')],'unique':_0x97d9('0x2')},'password':{'type':Sequelize[_0x97d9('0x1')]},'token':{'type':Sequelize[_0x97d9('0x1')]},'remoteUri':{'type':Sequelize[_0x97d9('0x1')],'unique':_0x97d9('0x3')},'authType':{'type':Sequelize[_0x97d9('0x4')](_0x97d9('0x5'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x97d9('0x1')]},'type':{'type':Sequelize[_0x97d9('0x4')]('integrationTab',_0x97d9('0x6')),'defaultValue':_0x97d9('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 7879d0f..088f79f 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 _0xd406=['find','getConfigurations','findOne','ZendeskConfiguration','pick','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','ZendeskField','username','password','token','authType','remoteUri','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','description','group','assignee','includes','title','position','system_field_options','statusCode','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','http','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~!@#$%^&-_=+[{]}.','request','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','count','limit','json','apply','save','update','then','destroy','stack','name','send','index','fieldName','type','key','map','query','keys','filters','intersection','model','fields','length','attributes','offset','order','sort','where','filter','merge','options','ZendeskAccount','findAll','params','rawAttributes','includeAll','include','create','body'];(function(_0x3c7999,_0x36868d){var _0x4723b4=function(_0x1cdd19){while(--_0x1cdd19){_0x3c7999['push'](_0x3c7999['shift']());}};_0x4723b4(++_0x36868d);}(_0xd406,0x9f));var _0x6d40=function(_0x3e0c18,_0x4357d9){_0x3e0c18=_0x3e0c18-0x0;var _0x5e2894=_0xd406[_0x3e0c18];return _0x5e2894;};'use strict';var pdf=require(_0x6d40('0x0'));var emlformat=require(_0x6d40('0x1'));var rimraf=require(_0x6d40('0x2'));var zipdir=require(_0x6d40('0x3'));var jsonpatch=require(_0x6d40('0x4'));var rp=require('request-promise');var moment=require(_0x6d40('0x5'));var BPromise=require(_0x6d40('0x6'));var Mustache=require(_0x6d40('0x7'));var util=require(_0x6d40('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x6d40('0x9'));var ejs=require(_0x6d40('0xa'));var fs=require('fs');var _=require(_0x6d40('0xb'));var squel=require('squel');var crypto=require(_0x6d40('0xc'));var jsforce=require(_0x6d40('0xd'));var deskjs=require(_0x6d40('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6d40('0xf'));var Papa=require(_0x6d40('0x10'));var Redis=require(_0x6d40('0x11'));var authService=require(_0x6d40('0x12'));var qs=require(_0x6d40('0x13'));var as=require(_0x6d40('0x14'));var hardwareService=require(_0x6d40('0x15'));var logger=require(_0x6d40('0x16'))(_0x6d40('0x17'));var utils=require(_0x6d40('0x18'));var config=require(_0x6d40('0x19'));var db=require(_0x6d40('0x1a'))['db'];var integrations=require(_0x6d40('0x1b'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6d40('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x575ab4,_0x4e2758,_0x3de6d9){if(_0x3de6d9){var _0x46fb75=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x46fb75['test'](_0x4e2758)){return _0x575ab4;}else{throw new db[(_0x6d40('0x1d'))][(_0x6d40('0x1e'))](_0x6d40('0x1f'));}}else{return _0x575ab4;}}function respondWithRpcPromise(_0xe28220,_0x104b30,_0x52b535,_0x3fc080){return new BPromise(function(_0x58fded,_0x1d6963){var _0x2cbfca=_0x3fc080||client;return _0x2cbfca[_0x6d40('0x20')](_0xe28220,_0x52b535)['then'](function(_0x276a5c){logger[_0x6d40('0x21')](_0x6d40('0x22'),_0x104b30,'request\x20sent');logger[_0x6d40('0x23')](_0x6d40('0x24'),_0x104b30,'request\x20sent',JSON[_0x6d40('0x25')](_0x276a5c));if(_0x276a5c[_0x6d40('0x26')]){if(_0x276a5c[_0x6d40('0x26')][_0x6d40('0x27')]===0x1f4){logger[_0x6d40('0x26')](_0x6d40('0x22'),_0x104b30,_0x276a5c['error']['message']);return _0x1d6963(_0x276a5c[_0x6d40('0x26')][_0x6d40('0x28')]);}logger[_0x6d40('0x26')](_0x6d40('0x22'),_0x104b30,_0x276a5c['error'][_0x6d40('0x28')]);return _0x58fded(_0x276a5c[_0x6d40('0x26')][_0x6d40('0x28')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x104b30,'request\x20sent');_0x58fded(_0x276a5c[_0x6d40('0x29')][_0x6d40('0x28')]);}})[_0x6d40('0x2a')](function(_0x19d070){logger[_0x6d40('0x26')](_0x6d40('0x22'),_0x104b30,_0x19d070);_0x1d6963(_0x19d070);});});}function respondWithStatusCode(_0x4dfab8,_0x35edf0){_0x35edf0=_0x35edf0||0xcc;return function(_0x339c1a){if(_0x339c1a){return _0x4dfab8[_0x6d40('0x2b')](_0x35edf0);}return _0x4dfab8['status'](_0x35edf0)[_0x6d40('0x2c')]();};}function respondWithResult(_0x1e4707,_0x4b8e03){_0x4b8e03=_0x4b8e03||0xc8;return function(_0x11a930){if(_0x11a930){return _0x1e4707[_0x6d40('0x2d')](_0x4b8e03)['json'](_0x11a930);}};}function respondWithFilteredResult(_0x39b9b7,_0x31bb24){return function(_0x3ec5c0){if(_0x3ec5c0){var _0x10b534=_0x3ec5c0[_0x6d40('0x2e')],_0x472809=_0x31bb24['offset'],_0x48d35e=_0x31bb24['offset']+_0x31bb24[_0x6d40('0x2f')],_0x558f93;if(_0x48d35e>=_0x10b534){_0x48d35e=_0x10b534;_0x558f93=0xc8;}else{_0x558f93=0xce;}_0x39b9b7['status'](_0x558f93);return _0x39b9b7['set']('Content-Range',_0x472809+'-'+_0x48d35e+'/'+_0x10b534)[_0x6d40('0x30')](_0x3ec5c0);}return null;};}function patchUpdates(_0x33ca1c){return function(_0x5e1df4){try{jsonpatch[_0x6d40('0x31')](_0x5e1df4,_0x33ca1c,!![]);}catch(_0x21dd40){return BPromise['reject'](_0x21dd40);}return _0x5e1df4[_0x6d40('0x32')]();};}function saveUpdates(_0x18496e,_0x16c478){return function(_0xe63613){if(_0xe63613){return _0xe63613[_0x6d40('0x33')](_0x18496e)[_0x6d40('0x34')](function(_0x2bf099){return _0x2bf099;});}return null;};}function removeEntity(_0x502608,_0x4036c7){return function(_0x13d630){if(_0x13d630){return _0x13d630[_0x6d40('0x35')]()[_0x6d40('0x34')](function(){_0x502608[_0x6d40('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e23ee,_0x82619b){return function(_0x3b4421){if(!_0x3b4421){_0x1e23ee[_0x6d40('0x2b')](0x194);}return _0x3b4421;};}function handleError(_0x5b1b37,_0x1a00be){_0x1a00be=_0x1a00be||0x1f4;return function(_0x23f3a2){logger[_0x6d40('0x26')](_0x23f3a2[_0x6d40('0x36')]);if(_0x23f3a2[_0x6d40('0x37')]){delete _0x23f3a2['name'];}_0x5b1b37[_0x6d40('0x2d')](_0x1a00be)[_0x6d40('0x38')](_0x23f3a2);};}exports[_0x6d40('0x39')]=function(_0x21edab,_0x5916f0){var _0x156a6d={},_0x4fbb05={},_0x5240fb={'count':0x0,'rows':[]};var _0x275c76=_['map'](db['ZendeskAccount']['rawAttributes'],function(_0x255dd6){return{'name':_0x255dd6[_0x6d40('0x3a')],'type':_0x255dd6[_0x6d40('0x3b')][_0x6d40('0x3c')]};});_0x4fbb05['model']=_[_0x6d40('0x3d')](_0x275c76,'name');_0x4fbb05[_0x6d40('0x3e')]=_[_0x6d40('0x3f')](_0x21edab[_0x6d40('0x3e')]);_0x4fbb05[_0x6d40('0x40')]=_[_0x6d40('0x41')](_0x4fbb05[_0x6d40('0x42')],_0x4fbb05[_0x6d40('0x3e')]);_0x156a6d['attributes']=_[_0x6d40('0x41')](_0x4fbb05['model'],qs[_0x6d40('0x43')](_0x21edab['query'][_0x6d40('0x43')]));_0x156a6d['attributes']=_0x156a6d['attributes'][_0x6d40('0x44')]?_0x156a6d[_0x6d40('0x45')]:_0x4fbb05[_0x6d40('0x42')];if(!_0x21edab[_0x6d40('0x3e')]['hasOwnProperty']('nolimit')){_0x156a6d[_0x6d40('0x2f')]=qs[_0x6d40('0x2f')](_0x21edab[_0x6d40('0x3e')][_0x6d40('0x2f')]);_0x156a6d[_0x6d40('0x46')]=qs[_0x6d40('0x46')](_0x21edab[_0x6d40('0x3e')][_0x6d40('0x46')]);}_0x156a6d[_0x6d40('0x47')]=qs[_0x6d40('0x48')](_0x21edab[_0x6d40('0x3e')][_0x6d40('0x48')]);_0x156a6d[_0x6d40('0x49')]=qs[_0x6d40('0x40')](_['pick'](_0x21edab['query'],_0x4fbb05[_0x6d40('0x40')]),_0x275c76);if(_0x21edab['query']['filter']){_0x156a6d[_0x6d40('0x49')]=_['merge'](_0x156a6d[_0x6d40('0x49')],{'$or':_[_0x6d40('0x3d')](_0x275c76,function(_0x52fb29){if(_0x52fb29['type']!=='VIRTUAL'){var _0x4959bc={};_0x4959bc[_0x52fb29['name']]={'$like':'%'+_0x21edab['query'][_0x6d40('0x4a')]+'%'};return _0x4959bc;}})});}_0x156a6d=_[_0x6d40('0x4b')]({},_0x156a6d,_0x21edab[_0x6d40('0x4c')]);var _0x288c83={'where':_0x156a6d[_0x6d40('0x49')]};return db[_0x6d40('0x4d')][_0x6d40('0x2e')](_0x288c83)[_0x6d40('0x34')](function(_0x32aab1){_0x5240fb[_0x6d40('0x2e')]=_0x32aab1;if(_0x21edab[_0x6d40('0x3e')]['includeAll']){_0x156a6d['include']=[{'all':!![]}];}return db[_0x6d40('0x4d')][_0x6d40('0x4e')](_0x156a6d);})['then'](function(_0x3cfbf1){_0x5240fb['rows']=_0x3cfbf1;return _0x5240fb;})[_0x6d40('0x34')](respondWithFilteredResult(_0x5916f0,_0x156a6d))[_0x6d40('0x2a')](handleError(_0x5916f0,null));};exports['show']=function(_0x1bf5a8,_0x4606f8){var _0x1108b5={'raw':![],'where':{'id':_0x1bf5a8[_0x6d40('0x4f')]['id']}},_0x168bdf={};_0x168bdf[_0x6d40('0x42')]=_['keys'](db[_0x6d40('0x4d')][_0x6d40('0x50')]);_0x168bdf[_0x6d40('0x3e')]=_[_0x6d40('0x3f')](_0x1bf5a8[_0x6d40('0x3e')]);_0x168bdf['filters']=_['intersection'](_0x168bdf[_0x6d40('0x42')],_0x168bdf[_0x6d40('0x3e')]);_0x1108b5[_0x6d40('0x45')]=_[_0x6d40('0x41')](_0x168bdf[_0x6d40('0x42')],qs[_0x6d40('0x43')](_0x1bf5a8[_0x6d40('0x3e')][_0x6d40('0x43')]));_0x1108b5[_0x6d40('0x45')]=_0x1108b5[_0x6d40('0x45')][_0x6d40('0x44')]?_0x1108b5[_0x6d40('0x45')]:_0x168bdf['model'];if(_0x1bf5a8[_0x6d40('0x3e')][_0x6d40('0x51')]){_0x1108b5[_0x6d40('0x52')]=[{'all':!![]}];}_0x1108b5=_[_0x6d40('0x4b')]({},_0x1108b5,_0x1bf5a8[_0x6d40('0x4c')]);return db['ZendeskAccount']['find'](_0x1108b5)[_0x6d40('0x34')](handleEntityNotFound(_0x4606f8,null))[_0x6d40('0x34')](respondWithResult(_0x4606f8,null))[_0x6d40('0x2a')](handleError(_0x4606f8,null));};exports[_0x6d40('0x53')]=function(_0x19defd,_0x2c0b36){return db[_0x6d40('0x4d')][_0x6d40('0x53')](_0x19defd[_0x6d40('0x54')],{})[_0x6d40('0x34')](respondWithResult(_0x2c0b36,0xc9))[_0x6d40('0x2a')](handleError(_0x2c0b36,null));};exports[_0x6d40('0x33')]=function(_0x195d2c,_0xdd4490){if(_0x195d2c['body']['id']){delete _0x195d2c['body']['id'];}return db[_0x6d40('0x4d')][_0x6d40('0x55')]({'where':{'id':_0x195d2c[_0x6d40('0x4f')]['id']}})['then'](handleEntityNotFound(_0xdd4490,null))[_0x6d40('0x34')](saveUpdates(_0x195d2c[_0x6d40('0x54')],null))[_0x6d40('0x34')](respondWithResult(_0xdd4490,null))[_0x6d40('0x2a')](handleError(_0xdd4490,null));};exports[_0x6d40('0x35')]=function(_0x310248,_0x236ef2){return db[_0x6d40('0x4d')]['find']({'where':{'id':_0x310248[_0x6d40('0x4f')]['id']}})[_0x6d40('0x34')](handleEntityNotFound(_0x236ef2,null))['then'](removeEntity(_0x236ef2,null))[_0x6d40('0x2a')](handleError(_0x236ef2,null));};exports[_0x6d40('0x56')]=function(_0x34839c,_0x5d7c73,_0x5a2e4e){var _0x2b2de6={};var _0x21a34d={};var _0x35e480;var _0x1aca71;return db[_0x6d40('0x4d')][_0x6d40('0x57')]({'where':{'id':_0x34839c[_0x6d40('0x4f')]['id']}})[_0x6d40('0x34')](handleEntityNotFound(_0x5d7c73,null))[_0x6d40('0x34')](function(_0x222e09){if(_0x222e09){_0x35e480=_0x222e09;_0x21a34d['model']=_[_0x6d40('0x3f')](db[_0x6d40('0x58')]['rawAttributes']);_0x21a34d['query']=_[_0x6d40('0x3f')](_0x34839c['query']);_0x21a34d[_0x6d40('0x40')]=_[_0x6d40('0x41')](_0x21a34d['model'],_0x21a34d[_0x6d40('0x3e')]);_0x2b2de6[_0x6d40('0x45')]=_[_0x6d40('0x41')](_0x21a34d[_0x6d40('0x42')],qs[_0x6d40('0x43')](_0x34839c['query'][_0x6d40('0x43')]));_0x2b2de6['attributes']=_0x2b2de6[_0x6d40('0x45')]['length']?_0x2b2de6['attributes']:_0x21a34d[_0x6d40('0x42')];_0x2b2de6[_0x6d40('0x47')]=qs[_0x6d40('0x48')](_0x34839c['query'][_0x6d40('0x48')]);_0x2b2de6[_0x6d40('0x49')]=qs['filters'](_[_0x6d40('0x59')](_0x34839c[_0x6d40('0x3e')],_0x21a34d[_0x6d40('0x40')]));if(_0x34839c['query'][_0x6d40('0x4a')]){_0x2b2de6[_0x6d40('0x49')]=_[_0x6d40('0x4b')](_0x2b2de6['where'],{'$or':_[_0x6d40('0x3d')](_0x2b2de6[_0x6d40('0x45')],function(_0x3b5419){var _0x57cbb4={};_0x57cbb4[_0x3b5419]={'$like':'%'+_0x34839c[_0x6d40('0x3e')][_0x6d40('0x4a')]+'%'};return _0x57cbb4;})});}_0x2b2de6=_['merge']({},_0x2b2de6,_0x34839c[_0x6d40('0x4c')]);return _0x35e480[_0x6d40('0x56')](_0x2b2de6);}})[_0x6d40('0x34')](function(_0x2cab96){if(_0x2cab96){_0x1aca71=_0x2cab96[_0x6d40('0x44')];if(!_0x34839c[_0x6d40('0x3e')][_0x6d40('0x5a')](_0x6d40('0x5b'))){_0x2b2de6[_0x6d40('0x2f')]=qs[_0x6d40('0x2f')](_0x34839c['query'][_0x6d40('0x2f')]);_0x2b2de6[_0x6d40('0x46')]=qs[_0x6d40('0x46')](_0x34839c[_0x6d40('0x3e')]['offset']);}return _0x35e480[_0x6d40('0x56')](_0x2b2de6);}})[_0x6d40('0x34')](function(_0x41a8a3){if(_0x41a8a3){return _0x41a8a3?{'count':_0x1aca71,'rows':_0x41a8a3}:null;}})[_0x6d40('0x34')](respondWithResult(_0x5d7c73,null))['catch'](handleError(_0x5d7c73,null));};exports[_0x6d40('0x5c')]=function(_0x34eed8,_0x38c3c2,_0x29baea){if(_0x34eed8[_0x6d40('0x54')]['id']){delete _0x34eed8[_0x6d40('0x54')]['id'];}return db[_0x6d40('0x4d')][_0x6d40('0x57')]({'where':{'id':_0x34eed8['params']['id']}})[_0x6d40('0x34')](handleEntityNotFound(_0x38c3c2,null))[_0x6d40('0x34')](function(_0x148eea){if(_0x148eea){_0x34eed8[_0x6d40('0x54')][_0x6d40('0x5d')]=_0x148eea['id'];_0x34eed8['body'][_0x6d40('0x5e')]=integrations['getSubjects'](_0x34eed8[_0x6d40('0x54')][_0x6d40('0x5f')],_0x34eed8[_0x6d40('0x54')][_0x6d40('0x3b')]);_0x34eed8['body'][_0x6d40('0x60')]=integrations['getDescriptions'](_0x34eed8[_0x6d40('0x54')][_0x6d40('0x5f')],_0x34eed8[_0x6d40('0x54')][_0x6d40('0x3b')]);return db[_0x6d40('0x58')]['create'](_0x34eed8[_0x6d40('0x54')],{'include':[{'model':db[_0x6d40('0x61')],'as':_0x6d40('0x5e')},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0x6d40('0x34')](respondWithResult(_0x38c3c2,null))[_0x6d40('0x2a')](handleError(_0x38c3c2,null));};exports['getFields']=function(_0x524c95,_0x3d663b,_0x405602){var _0x55cba3='';return db[_0x6d40('0x4d')]['findOne']({'where':{'id':_0x524c95['params']['id']},'attributes':['id',_0x6d40('0x62'),_0x6d40('0x63'),_0x6d40('0x64'),_0x6d40('0x65'),'remoteUri']})[_0x6d40('0x34')](handleEntityNotFound(_0x3d663b,null))[_0x6d40('0x34')](function(_0x290bbc){if(_0x290bbc){_0x55cba3=_0x290bbc[_0x6d40('0x66')];var _0x42abee=_0x55cba3['slice'](-0x1);if(_0x42abee==='/'){_0x55cba3=_0x55cba3[_0x6d40('0x67')](0x0,_0x55cba3[_0x6d40('0x68')](_0x42abee));}var _0x16292f={'method':'GET','uri':util[_0x6d40('0x69')](_0x6d40('0x6a'),_0x55cba3,_0x6d40('0x6b')),'json':!![]};switch(_0x290bbc['authType']){case'password':_0x16292f[_0x6d40('0x6c')]={'Authorization':util[_0x6d40('0x69')](_0x6d40('0x6d'),new Buffer(util[_0x6d40('0x69')](_0x6d40('0x6e'),_0x290bbc[_0x6d40('0x62')],_0x290bbc[_0x6d40('0x63')]))[_0x6d40('0x6f')]('base64'))};break;case _0x6d40('0x64'):_0x16292f['headers']={'Authorization':util['format'](_0x6d40('0x6d'),new Buffer(util[_0x6d40('0x69')]('%s/token:%s',_0x290bbc[_0x6d40('0x62')],_0x290bbc[_0x6d40('0x64')]))[_0x6d40('0x6f')]('base64'))};break;default:throw new db[(_0x6d40('0x1d'))][(_0x6d40('0x1e'))]('Unknown\x20authentication\x20type');}return rp(_0x16292f);}})['then'](function(_0x4dc10f){if(_0x4dc10f){var _0x173d05=['subject',_0x6d40('0x70'),_0x6d40('0x71'),_0x6d40('0x72')];_['remove'](_0x4dc10f[_0x6d40('0x6b')],function(_0x5c8da5){return _0x173d05[_0x6d40('0x73')](_0x5c8da5[_0x6d40('0x3b')]);});return{'count':_0x4dc10f['ticket_fields'][_0x6d40('0x44')],'rows':_['map'](_0x4dc10f[_0x6d40('0x6b')],function(_0x5ba61e){return{'id':_0x5ba61e['id'],'name':_0x5ba61e['position']>0x7?_0x5ba61e[_0x6d40('0x74')]:_0x5ba61e[_0x6d40('0x3b')],'custom':_0x5ba61e[_0x6d40('0x75')]>0x7?!![]:![],'options':_0x5ba61e[_0x6d40('0x76')]?_0x5ba61e[_0x6d40('0x76')]:_0x5ba61e['custom_field_options']?_0x5ba61e['custom_field_options']:[]};})};}})[_0x6d40('0x34')](respondWithResult(_0x3d663b,null))[_0x6d40('0x2a')](function(_0x22f630){var _0x291440=_0x524c95[_0x6d40('0x3e')]['test']?0x1f4:_0x22f630[_0x6d40('0x77')]||0x1f4;logger[_0x6d40('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x6d40('0x78'),_0x291440,JSON['stringify'](_0x22f630));delete _0x22f630[_0x6d40('0x37')];if(_0x291440===0x191){_0x291440=0x190;}_0x3d663b[_0x6d40('0x2d')](_0x291440)['send'](_0x524c95['query']['test']?{'message':_0x6d40('0x79'),'statusCode':_0x22f630[_0x6d40('0x77')]}:_0x22f630);});}; \ No newline at end of file +var _0xbd90=['GET','authType','headers','format','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Unknown\x20authentication\x20type','description','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','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~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','set','apply','save','update','destroy','name','send','map','ZendeskAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','filter','merge','VIRTUAL','includeAll','findAll','then','params','include','options','create','body','find','getConfigurations','findOne','ZendeskConfiguration','sort','pick','addConfiguration','Subjects','getSubjects','type','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','remoteUri','substring','lastIndexOf'];(function(_0x3a3b4a,_0x49f90d){var _0x49f461=function(_0x371a12){while(--_0x371a12){_0x3a3b4a['push'](_0x3a3b4a['shift']());}};_0x49f461(++_0x49f90d);}(_0xbd90,0x108));var _0x0bd9=function(_0x19cead,_0xad4843){_0x19cead=_0x19cead-0x0;var _0x5082c5=_0xbd90[_0x19cead];return _0x5082c5;};'use strict';var pdf=require(_0x0bd9('0x0'));var emlformat=require(_0x0bd9('0x1'));var rimraf=require(_0x0bd9('0x2'));var zipdir=require(_0x0bd9('0x3'));var jsonpatch=require(_0x0bd9('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0bd9('0x5'));var Mustache=require(_0x0bd9('0x6'));var util=require(_0x0bd9('0x7'));var path=require('path');var sox=require(_0x0bd9('0x8'));var csv=require(_0x0bd9('0x9'));var ejs=require(_0x0bd9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0bd9('0xb'));var crypto=require('crypto');var jsforce=require(_0x0bd9('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0bd9('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0bd9('0xe'));var as=require(_0x0bd9('0xf'));var hardwareService=require(_0x0bd9('0x10'));var logger=require(_0x0bd9('0x11'))(_0x0bd9('0x12'));var utils=require('../../config/utils');var config=require(_0x0bd9('0x13'));var db=require(_0x0bd9('0x14'))['db'];var integrations=require(_0x0bd9('0x15'));var jayson=require(_0x0bd9('0x16'));var client=jayson[_0x0bd9('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x21caf4,_0x614fd,_0x287870){if(_0x287870){var _0xd896e1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xd896e1['test'](_0x614fd)){return _0x21caf4;}else{throw new db[(_0x0bd9('0x18'))][(_0x0bd9('0x19'))](_0x0bd9('0x1a'));}}else{return _0x21caf4;}}function respondWithRpcPromise(_0x3430a1,_0x240945,_0x2b8b31,_0x3b909a){return new BPromise(function(_0x4641aa,_0x5dd4c4){var _0x5c79e6=_0x3b909a||client;return _0x5c79e6[_0x0bd9('0x1b')](_0x3430a1,_0x2b8b31)['then'](function(_0x47c711){logger[_0x0bd9('0x1c')]('ZendeskAccount,\x20%s,\x20%s',_0x240945,_0x0bd9('0x1d'));logger[_0x0bd9('0x1e')](_0x0bd9('0x1f'),_0x240945,'request\x20sent',JSON[_0x0bd9('0x20')](_0x47c711));if(_0x47c711[_0x0bd9('0x21')]){if(_0x47c711[_0x0bd9('0x21')]['code']===0x1f4){logger[_0x0bd9('0x21')](_0x0bd9('0x22'),_0x240945,_0x47c711[_0x0bd9('0x21')][_0x0bd9('0x23')]);return _0x5dd4c4(_0x47c711[_0x0bd9('0x21')][_0x0bd9('0x23')]);}logger[_0x0bd9('0x21')](_0x0bd9('0x22'),_0x240945,_0x47c711[_0x0bd9('0x21')][_0x0bd9('0x23')]);return _0x4641aa(_0x47c711[_0x0bd9('0x21')]['message']);}else{logger[_0x0bd9('0x1c')](_0x0bd9('0x22'),_0x240945,_0x0bd9('0x1d'));_0x4641aa(_0x47c711['result'][_0x0bd9('0x23')]);}})[_0x0bd9('0x24')](function(_0x31221b){logger['error'](_0x0bd9('0x22'),_0x240945,_0x31221b);_0x5dd4c4(_0x31221b);});});}function respondWithStatusCode(_0x5ac889,_0x2d1032){_0x2d1032=_0x2d1032||0xcc;return function(_0x231d4c){if(_0x231d4c){return _0x5ac889[_0x0bd9('0x25')](_0x2d1032);}return _0x5ac889[_0x0bd9('0x26')](_0x2d1032)[_0x0bd9('0x27')]();};}function respondWithResult(_0x2b7d1f,_0x54bb8e){_0x54bb8e=_0x54bb8e||0xc8;return function(_0x1d0b6d){if(_0x1d0b6d){return _0x2b7d1f['status'](_0x54bb8e)[_0x0bd9('0x28')](_0x1d0b6d);}};}function respondWithFilteredResult(_0x2905ec,_0x3cea4c){return function(_0x4c49ee){if(_0x4c49ee){var _0x270575=_0x4c49ee[_0x0bd9('0x29')],_0x350d75=_0x3cea4c['offset'],_0x16b595=_0x3cea4c[_0x0bd9('0x2a')]+_0x3cea4c['limit'],_0x79f036;if(_0x16b595>=_0x270575){_0x16b595=_0x270575;_0x79f036=0xc8;}else{_0x79f036=0xce;}_0x2905ec[_0x0bd9('0x26')](_0x79f036);return _0x2905ec[_0x0bd9('0x2b')]('Content-Range',_0x350d75+'-'+_0x16b595+'/'+_0x270575)[_0x0bd9('0x28')](_0x4c49ee);}return null;};}function patchUpdates(_0x3f97d3){return function(_0xc6a353){try{jsonpatch[_0x0bd9('0x2c')](_0xc6a353,_0x3f97d3,!![]);}catch(_0x4f64e0){return BPromise['reject'](_0x4f64e0);}return _0xc6a353[_0x0bd9('0x2d')]();};}function saveUpdates(_0x589eaa,_0x4e4389){return function(_0x17eccd){if(_0x17eccd){return _0x17eccd[_0x0bd9('0x2e')](_0x589eaa)['then'](function(_0x1c596c){return _0x1c596c;});}return null;};}function removeEntity(_0xa51320,_0x3919c4){return function(_0x17debc){if(_0x17debc){return _0x17debc[_0x0bd9('0x2f')]()['then'](function(){_0xa51320[_0x0bd9('0x26')](0xcc)[_0x0bd9('0x27')]();});}};}function handleEntityNotFound(_0x48a634,_0x5cfc9b){return function(_0x48e9bd){if(!_0x48e9bd){_0x48a634['sendStatus'](0x194);}return _0x48e9bd;};}function handleError(_0x15d29f,_0xe1a0eb){_0xe1a0eb=_0xe1a0eb||0x1f4;return function(_0x146ff7){logger[_0x0bd9('0x21')](_0x146ff7['stack']);if(_0x146ff7[_0x0bd9('0x30')]){delete _0x146ff7[_0x0bd9('0x30')];}_0x15d29f[_0x0bd9('0x26')](_0xe1a0eb)[_0x0bd9('0x31')](_0x146ff7);};}exports['index']=function(_0x910b6d,_0x36b6e5){var _0x535b0e={},_0x16dd9c={},_0x29e0f7={'count':0x0,'rows':[]};var _0x12770a=_[_0x0bd9('0x32')](db[_0x0bd9('0x33')][_0x0bd9('0x34')],function(_0x308b1e){return{'name':_0x308b1e[_0x0bd9('0x35')],'type':_0x308b1e['type'][_0x0bd9('0x36')]};});_0x16dd9c['model']=_['map'](_0x12770a,_0x0bd9('0x30'));_0x16dd9c[_0x0bd9('0x37')]=_[_0x0bd9('0x38')](_0x910b6d[_0x0bd9('0x37')]);_0x16dd9c[_0x0bd9('0x39')]=_[_0x0bd9('0x3a')](_0x16dd9c['model'],_0x16dd9c[_0x0bd9('0x37')]);_0x535b0e['attributes']=_['intersection'](_0x16dd9c[_0x0bd9('0x3b')],qs[_0x0bd9('0x3c')](_0x910b6d[_0x0bd9('0x37')][_0x0bd9('0x3c')]));_0x535b0e[_0x0bd9('0x3d')]=_0x535b0e[_0x0bd9('0x3d')][_0x0bd9('0x3e')]?_0x535b0e[_0x0bd9('0x3d')]:_0x16dd9c[_0x0bd9('0x3b')];if(!_0x910b6d[_0x0bd9('0x37')][_0x0bd9('0x3f')](_0x0bd9('0x40'))){_0x535b0e[_0x0bd9('0x41')]=qs[_0x0bd9('0x41')](_0x910b6d[_0x0bd9('0x37')][_0x0bd9('0x41')]);_0x535b0e[_0x0bd9('0x2a')]=qs['offset'](_0x910b6d[_0x0bd9('0x37')][_0x0bd9('0x2a')]);}_0x535b0e[_0x0bd9('0x42')]=qs['sort'](_0x910b6d['query']['sort']);_0x535b0e[_0x0bd9('0x43')]=qs['filters'](_['pick'](_0x910b6d[_0x0bd9('0x37')],_0x16dd9c[_0x0bd9('0x39')]),_0x12770a);if(_0x910b6d['query'][_0x0bd9('0x44')]){_0x535b0e[_0x0bd9('0x43')]=_[_0x0bd9('0x45')](_0x535b0e[_0x0bd9('0x43')],{'$or':_[_0x0bd9('0x32')](_0x12770a,function(_0x2933de){if(_0x2933de['type']!==_0x0bd9('0x46')){var _0x56ad70={};_0x56ad70[_0x2933de['name']]={'$like':'%'+_0x910b6d[_0x0bd9('0x37')][_0x0bd9('0x44')]+'%'};return _0x56ad70;}})});}_0x535b0e=_[_0x0bd9('0x45')]({},_0x535b0e,_0x910b6d['options']);var _0x532975={'where':_0x535b0e[_0x0bd9('0x43')]};return db[_0x0bd9('0x33')][_0x0bd9('0x29')](_0x532975)['then'](function(_0x1fc839){_0x29e0f7[_0x0bd9('0x29')]=_0x1fc839;if(_0x910b6d[_0x0bd9('0x37')][_0x0bd9('0x47')]){_0x535b0e['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x0bd9('0x48')](_0x535b0e);})[_0x0bd9('0x49')](function(_0x367c0c){_0x29e0f7['rows']=_0x367c0c;return _0x29e0f7;})[_0x0bd9('0x49')](respondWithFilteredResult(_0x36b6e5,_0x535b0e))[_0x0bd9('0x24')](handleError(_0x36b6e5,null));};exports['show']=function(_0x3c508a,_0x32b014){var _0x53e5da={'raw':![],'where':{'id':_0x3c508a[_0x0bd9('0x4a')]['id']}},_0x270679={};_0x270679[_0x0bd9('0x3b')]=_[_0x0bd9('0x38')](db[_0x0bd9('0x33')][_0x0bd9('0x34')]);_0x270679[_0x0bd9('0x37')]=_[_0x0bd9('0x38')](_0x3c508a[_0x0bd9('0x37')]);_0x270679[_0x0bd9('0x39')]=_[_0x0bd9('0x3a')](_0x270679['model'],_0x270679[_0x0bd9('0x37')]);_0x53e5da[_0x0bd9('0x3d')]=_['intersection'](_0x270679[_0x0bd9('0x3b')],qs['fields'](_0x3c508a[_0x0bd9('0x37')][_0x0bd9('0x3c')]));_0x53e5da['attributes']=_0x53e5da[_0x0bd9('0x3d')]['length']?_0x53e5da[_0x0bd9('0x3d')]:_0x270679[_0x0bd9('0x3b')];if(_0x3c508a[_0x0bd9('0x37')][_0x0bd9('0x47')]){_0x53e5da[_0x0bd9('0x4b')]=[{'all':!![]}];}_0x53e5da=_['merge']({},_0x53e5da,_0x3c508a[_0x0bd9('0x4c')]);return db[_0x0bd9('0x33')]['find'](_0x53e5da)[_0x0bd9('0x49')](handleEntityNotFound(_0x32b014,null))[_0x0bd9('0x49')](respondWithResult(_0x32b014,null))['catch'](handleError(_0x32b014,null));};exports['create']=function(_0x154649,_0x439d06){return db[_0x0bd9('0x33')][_0x0bd9('0x4d')](_0x154649[_0x0bd9('0x4e')],{})[_0x0bd9('0x49')](respondWithResult(_0x439d06,0xc9))[_0x0bd9('0x24')](handleError(_0x439d06,null));};exports[_0x0bd9('0x2e')]=function(_0x5090bc,_0x5a40da){if(_0x5090bc[_0x0bd9('0x4e')]['id']){delete _0x5090bc[_0x0bd9('0x4e')]['id'];}return db[_0x0bd9('0x33')][_0x0bd9('0x4f')]({'where':{'id':_0x5090bc[_0x0bd9('0x4a')]['id']}})[_0x0bd9('0x49')](handleEntityNotFound(_0x5a40da,null))[_0x0bd9('0x49')](saveUpdates(_0x5090bc[_0x0bd9('0x4e')],null))['then'](respondWithResult(_0x5a40da,null))[_0x0bd9('0x24')](handleError(_0x5a40da,null));};exports['destroy']=function(_0x25c29a,_0x2e94f1){return db['ZendeskAccount'][_0x0bd9('0x4f')]({'where':{'id':_0x25c29a[_0x0bd9('0x4a')]['id']}})[_0x0bd9('0x49')](handleEntityNotFound(_0x2e94f1,null))[_0x0bd9('0x49')](removeEntity(_0x2e94f1,null))[_0x0bd9('0x24')](handleError(_0x2e94f1,null));};exports[_0x0bd9('0x50')]=function(_0x1217c3,_0x3b77c3,_0x4abeca){var _0x42610c={};var _0x57ce57={};var _0x58eea1;var _0x45dcbe;return db[_0x0bd9('0x33')][_0x0bd9('0x51')]({'where':{'id':_0x1217c3['params']['id']}})['then'](handleEntityNotFound(_0x3b77c3,null))[_0x0bd9('0x49')](function(_0x3ef23b){if(_0x3ef23b){_0x58eea1=_0x3ef23b;_0x57ce57[_0x0bd9('0x3b')]=_[_0x0bd9('0x38')](db[_0x0bd9('0x52')][_0x0bd9('0x34')]);_0x57ce57[_0x0bd9('0x37')]=_[_0x0bd9('0x38')](_0x1217c3[_0x0bd9('0x37')]);_0x57ce57[_0x0bd9('0x39')]=_['intersection'](_0x57ce57[_0x0bd9('0x3b')],_0x57ce57[_0x0bd9('0x37')]);_0x42610c[_0x0bd9('0x3d')]=_[_0x0bd9('0x3a')](_0x57ce57[_0x0bd9('0x3b')],qs[_0x0bd9('0x3c')](_0x1217c3[_0x0bd9('0x37')][_0x0bd9('0x3c')]));_0x42610c[_0x0bd9('0x3d')]=_0x42610c['attributes'][_0x0bd9('0x3e')]?_0x42610c[_0x0bd9('0x3d')]:_0x57ce57[_0x0bd9('0x3b')];_0x42610c[_0x0bd9('0x42')]=qs[_0x0bd9('0x53')](_0x1217c3['query'][_0x0bd9('0x53')]);_0x42610c['where']=qs[_0x0bd9('0x39')](_[_0x0bd9('0x54')](_0x1217c3[_0x0bd9('0x37')],_0x57ce57[_0x0bd9('0x39')]));if(_0x1217c3[_0x0bd9('0x37')][_0x0bd9('0x44')]){_0x42610c[_0x0bd9('0x43')]=_[_0x0bd9('0x45')](_0x42610c[_0x0bd9('0x43')],{'$or':_['map'](_0x42610c[_0x0bd9('0x3d')],function(_0x3b7d99){var _0xf1ef88={};_0xf1ef88[_0x3b7d99]={'$like':'%'+_0x1217c3[_0x0bd9('0x37')][_0x0bd9('0x44')]+'%'};return _0xf1ef88;})});}_0x42610c=_['merge']({},_0x42610c,_0x1217c3[_0x0bd9('0x4c')]);return _0x58eea1[_0x0bd9('0x50')](_0x42610c);}})[_0x0bd9('0x49')](function(_0xa804a4){if(_0xa804a4){_0x45dcbe=_0xa804a4[_0x0bd9('0x3e')];if(!_0x1217c3[_0x0bd9('0x37')]['hasOwnProperty'](_0x0bd9('0x40'))){_0x42610c['limit']=qs[_0x0bd9('0x41')](_0x1217c3[_0x0bd9('0x37')][_0x0bd9('0x41')]);_0x42610c['offset']=qs['offset'](_0x1217c3[_0x0bd9('0x37')][_0x0bd9('0x2a')]);}return _0x58eea1[_0x0bd9('0x50')](_0x42610c);}})[_0x0bd9('0x49')](function(_0x3083a8){if(_0x3083a8){return _0x3083a8?{'count':_0x45dcbe,'rows':_0x3083a8}:null;}})[_0x0bd9('0x49')](respondWithResult(_0x3b77c3,null))[_0x0bd9('0x24')](handleError(_0x3b77c3,null));};exports[_0x0bd9('0x55')]=function(_0x5aadbc,_0x2a187f,_0x138379){if(_0x5aadbc[_0x0bd9('0x4e')]['id']){delete _0x5aadbc[_0x0bd9('0x4e')]['id'];}return db[_0x0bd9('0x33')][_0x0bd9('0x51')]({'where':{'id':_0x5aadbc['params']['id']}})[_0x0bd9('0x49')](handleEntityNotFound(_0x2a187f,null))[_0x0bd9('0x49')](function(_0x4d3e0b){if(_0x4d3e0b){_0x5aadbc[_0x0bd9('0x4e')]['AccountId']=_0x4d3e0b['id'];_0x5aadbc[_0x0bd9('0x4e')][_0x0bd9('0x56')]=integrations[_0x0bd9('0x57')](_0x5aadbc['body']['channel'],_0x5aadbc[_0x0bd9('0x4e')][_0x0bd9('0x58')]);_0x5aadbc[_0x0bd9('0x4e')][_0x0bd9('0x59')]=integrations[_0x0bd9('0x5a')](_0x5aadbc[_0x0bd9('0x4e')]['channel'],_0x5aadbc[_0x0bd9('0x4e')]['type']);return db[_0x0bd9('0x52')][_0x0bd9('0x4d')](_0x5aadbc[_0x0bd9('0x4e')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0x0bd9('0x5b')],'as':'Descriptions'}]});}return null;})[_0x0bd9('0x49')](respondWithResult(_0x2a187f,null))[_0x0bd9('0x24')](handleError(_0x2a187f,null));};exports[_0x0bd9('0x5c')]=function(_0x264431,_0x1d4ffd,_0x5b2716){var _0x2b1aa5='';return db[_0x0bd9('0x33')][_0x0bd9('0x51')]({'where':{'id':_0x264431[_0x0bd9('0x4a')]['id']},'attributes':['id',_0x0bd9('0x5d'),_0x0bd9('0x5e'),_0x0bd9('0x5f'),'authType','remoteUri']})[_0x0bd9('0x49')](handleEntityNotFound(_0x1d4ffd,null))[_0x0bd9('0x49')](function(_0x1748e3){if(_0x1748e3){_0x2b1aa5=_0x1748e3[_0x0bd9('0x60')];var _0x3a36c8=_0x2b1aa5['slice'](-0x1);if(_0x3a36c8==='/'){_0x2b1aa5=_0x2b1aa5[_0x0bd9('0x61')](0x0,_0x2b1aa5[_0x0bd9('0x62')](_0x3a36c8));}var _0x1a6534={'method':_0x0bd9('0x63'),'uri':util['format']('%s/%s',_0x2b1aa5,'ticket_fields'),'json':!![]};switch(_0x1748e3[_0x0bd9('0x64')]){case _0x0bd9('0x5e'):_0x1a6534[_0x0bd9('0x65')]={'Authorization':util[_0x0bd9('0x66')](_0x0bd9('0x67'),new Buffer(util[_0x0bd9('0x66')](_0x0bd9('0x68'),_0x1748e3[_0x0bd9('0x5d')],_0x1748e3[_0x0bd9('0x5e')]))[_0x0bd9('0x69')](_0x0bd9('0x6a')))};break;case _0x0bd9('0x5f'):_0x1a6534[_0x0bd9('0x65')]={'Authorization':util[_0x0bd9('0x66')]('Basic\x20%s',new Buffer(util[_0x0bd9('0x66')](_0x0bd9('0x6b'),_0x1748e3[_0x0bd9('0x5d')],_0x1748e3['token']))[_0x0bd9('0x69')]('base64'))};break;default:throw new db[(_0x0bd9('0x18'))]['ValidationError'](_0x0bd9('0x6c'));}return rp(_0x1a6534);}})[_0x0bd9('0x49')](function(_0x2aeecd){if(_0x2aeecd){var _0x1d02a6=['subject',_0x0bd9('0x6d'),_0x0bd9('0x6e'),_0x0bd9('0x6f')];_[_0x0bd9('0x70')](_0x2aeecd[_0x0bd9('0x71')],function(_0x5d3e12){return _0x1d02a6[_0x0bd9('0x72')](_0x5d3e12['type']);});return{'count':_0x2aeecd['ticket_fields'][_0x0bd9('0x3e')],'rows':_[_0x0bd9('0x32')](_0x2aeecd[_0x0bd9('0x71')],function(_0x1d9bac){return{'id':_0x1d9bac['id'],'name':_0x1d9bac[_0x0bd9('0x73')]>0x7?_0x1d9bac['title']:_0x1d9bac[_0x0bd9('0x58')],'custom':_0x1d9bac[_0x0bd9('0x73')]>0x7?!![]:![],'options':_0x1d9bac[_0x0bd9('0x74')]?_0x1d9bac[_0x0bd9('0x74')]:_0x1d9bac[_0x0bd9('0x75')]?_0x1d9bac['custom_field_options']:[]};})};}})[_0x0bd9('0x49')](respondWithResult(_0x1d4ffd,null))[_0x0bd9('0x24')](function(_0x1712ee){var _0x2ef3cf=_0x264431['query'][_0x0bd9('0x76')]?0x1f4:_0x1712ee[_0x0bd9('0x77')]||0x1f4;logger[_0x0bd9('0x21')](_0x0bd9('0x78'),_0x0bd9('0x5c'),_0x2ef3cf,JSON[_0x0bd9('0x20')](_0x1712ee));delete _0x1712ee[_0x0bd9('0x30')];if(_0x2ef3cf===0x191){_0x2ef3cf=0x190;}_0x1d4ffd[_0x0bd9('0x26')](_0x2ef3cf)['send'](_0x264431[_0x0bd9('0x37')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1712ee[_0x0bd9('0x77')]}:_0x1712ee);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 9c13616..fdd6d92 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 _0x85d3=['bluebird','rimraf','../../config/environment','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment'];(function(_0x3dab96,_0x9ad0af){var _0x377a20=function(_0x30495b){while(--_0x30495b){_0x3dab96['push'](_0x3dab96['shift']());}};_0x377a20(++_0x9ad0af);}(_0x85d3,0x1e0));var _0x385d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x85d3[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x385d('0x0'));var util=require(_0x385d('0x1'));var logger=require('../../config/logger')(_0x385d('0x2'));var moment=require(_0x385d('0x3'));var BPromise=require(_0x385d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x385d('0x5'));var config=require(_0x385d('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x385d('0x7')]=function(_0x2265ff,_0x56c41f){return _0x2265ff[_0x385d('0x8')](_0x385d('0x9'),attributes,{'tableName':_0x385d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc293=['./intZendeskAccount.attributes','define','ZendeskAccount','lodash','api','bluebird','path','rimraf','../../config/environment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc293,0xe4));var _0x3c29=function(_0x47b017,_0x52942d){_0x47b017=_0x47b017-0x0;var _0x485638=_0xc293[_0x47b017];return _0x485638;};'use strict';var _=require(_0x3c29('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3c29('0x1'));var moment=require('moment');var BPromise=require(_0x3c29('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c29('0x3'));var rimraf=require(_0x3c29('0x4'));var config=require(_0x3c29('0x5'));var attributes=require(_0x3c29('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x237dbb,_0x30544b){return _0x237dbb[_0x3c29('0x7')](_0x3c29('0x8'),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 8c8cae5..48f5aad 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 _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x54a37b,_0x26c72f){var _0x51a5e4=function(_0x1557cc){while(--_0x1557cc){_0x54a37b['push'](_0x54a37b['shift']());}};_0x51a5e4(++_0x26c72f);}(_0x757a,0xde));var _0xa757=function(_0x240a37,_0x4917c5){_0x240a37=_0x240a37-0x0;var _0x312eeb=_0x757a[_0x240a37];return _0x312eeb;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll'];(function(_0x46b273,_0x4c62a2){var _0x21e654=function(_0x1c9168){while(--_0x1c9168){_0x46b273['push'](_0x46b273['shift']());}};_0x21e654(++_0x4c62a2);}(_0xe706,0xa3));var _0x6e70=function(_0x4aa350,_0x12a9eb){_0x4aa350=_0x4aa350-0x0;var _0x32a16f=_0xe706[_0x4aa350];return _0x32a16f;};'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']('ZendeskAccount,\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']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['ZendeskAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetZendeskAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index ffbbf31..a785815 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 _0x720f=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','put','update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x720f,0x1a3));var _0xf720=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0x720f[_0x30faec];return _0x29484f;};'use strict';var multer=require(_0xf720('0x0'));var util=require(_0xf720('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf720('0x2'));var router=express['Router']();var auth=require(_0xf720('0x3'));var interaction=require(_0xf720('0x4'));var config=require(_0xf720('0x5'));var controller=require('./intZendeskConfiguration.controller');router[_0xf720('0x6')]('/',auth[_0xf720('0x7')](),controller[_0xf720('0x8')]);router[_0xf720('0x6')](_0xf720('0x9'),auth['isAuthenticated'](),controller[_0xf720('0xa')]);router[_0xf720('0x6')](_0xf720('0xb'),auth[_0xf720('0x7')](),controller[_0xf720('0xc')]);router[_0xf720('0x6')](_0xf720('0xd'),auth[_0xf720('0x7')](),controller[_0xf720('0xe')]);router['get'](_0xf720('0xf'),auth['isAuthenticated'](),controller[_0xf720('0x10')]);router[_0xf720('0x6')](_0xf720('0x11'),auth['isAuthenticated'](),controller[_0xf720('0x12')]);router[_0xf720('0x13')]('/',auth[_0xf720('0x7')](),controller['create']);router[_0xf720('0x13')]('/:id/tags',auth[_0xf720('0x7')](),controller['setTags']);router[_0xf720('0x14')]('/:id',auth[_0xf720('0x7')](),controller[_0xf720('0x15')]);router[_0xf720('0x16')](_0xf720('0x9'),auth[_0xf720('0x7')](),controller[_0xf720('0x17')]);module[_0xf720('0x18')]=router; \ No newline at end of file +var _0xc527=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','update','delete','exports','util','path','express'];(function(_0x58e4dc,_0x2ad584){var _0x34ed81=function(_0x433c65){while(--_0x433c65){_0x58e4dc['push'](_0x58e4dc['shift']());}};_0x34ed81(++_0x2ad584);}(_0xc527,0x1c9));var _0x7c52=function(_0x1fe731,_0x1a46e2){_0x1fe731=_0x1fe731-0x0;var _0x17d2b6=_0xc527[_0x1fe731];return _0x17d2b6;};'use strict';var multer=require('multer');var util=require(_0x7c52('0x0'));var path=require(_0x7c52('0x1'));var timeout=require('connect-timeout');var express=require(_0x7c52('0x2'));var router=express['Router']();var auth=require(_0x7c52('0x3'));var interaction=require(_0x7c52('0x4'));var config=require(_0x7c52('0x5'));var controller=require(_0x7c52('0x6'));router[_0x7c52('0x7')]('/',auth[_0x7c52('0x8')](),controller[_0x7c52('0x9')]);router[_0x7c52('0x7')](_0x7c52('0xa'),auth[_0x7c52('0x8')](),controller['show']);router[_0x7c52('0x7')](_0x7c52('0xb'),auth[_0x7c52('0x8')](),controller[_0x7c52('0xc')]);router[_0x7c52('0x7')](_0x7c52('0xd'),auth[_0x7c52('0x8')](),controller[_0x7c52('0xe')]);router['get'](_0x7c52('0xf'),auth[_0x7c52('0x8')](),controller[_0x7c52('0x10')]);router[_0x7c52('0x7')](_0x7c52('0x11'),auth[_0x7c52('0x8')](),controller[_0x7c52('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7c52('0x13')]);router['post']('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router['put']('/:id',auth[_0x7c52('0x8')](),controller[_0x7c52('0x14')]);router[_0x7c52('0x15')](_0x7c52('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x7c52('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 0b8523f..84894d0 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 _0xdef8=['sequelize','exports','STRING'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xdef8,0x198));var _0x8def=function(_0x544fe0,_0x1d2e77){_0x544fe0=_0x544fe0-0x0;var _0xeedca8=_0xdef8[_0x544fe0];return _0xeedca8;};'use strict';var Sequelize=require(_0x8def('0x0'));module[_0x8def('0x1')]={'name':{'type':Sequelize[_0x8def('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdb0e=['STRING','sequelize','exports'];(function(_0x1c470d,_0x81d66b){var _0x12141b=function(_0x45bfd3){while(--_0x45bfd3){_0x1c470d['push'](_0x1c470d['shift']());}};_0x12141b(++_0x81d66b);}(_0xdb0e,0x64));var _0xedb0=function(_0x73b1cd,_0x176535){_0x73b1cd=_0x73b1cd-0x0;var _0x243426=_0xdb0e[_0x73b1cd];return _0x243426;};'use strict';var Sequelize=require(_0xedb0('0x0'));module[_0xedb0('0x1')]={'name':{'type':Sequelize[_0xedb0('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 4c2ecde..ad66d09 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 _0x5206=['Sequelize','ValidationError','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','show','params','include','options','find','create','body','getFields','ZendeskField','order','hasOwnProperty','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','test'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5206,0xab));var _0x6520=function(_0x43dee2,_0x51f487){_0x43dee2=_0x43dee2-0x0;var _0x2b02b7=_0x5206[_0x43dee2];return _0x2b02b7;};'use strict';var pdf=require(_0x6520('0x0'));var emlformat=require(_0x6520('0x1'));var rimraf=require(_0x6520('0x2'));var zipdir=require(_0x6520('0x3'));var jsonpatch=require(_0x6520('0x4'));var rp=require(_0x6520('0x5'));var moment=require(_0x6520('0x6'));var BPromise=require(_0x6520('0x7'));var Mustache=require('mustache');var util=require(_0x6520('0x8'));var path=require(_0x6520('0x9'));var sox=require(_0x6520('0xa'));var csv=require(_0x6520('0xb'));var ejs=require(_0x6520('0xc'));var fs=require('fs');var _=require(_0x6520('0xd'));var squel=require(_0x6520('0xe'));var crypto=require('crypto');var jsforce=require(_0x6520('0xf'));var deskjs=require(_0x6520('0x10'));var toCsv=require(_0x6520('0xb'));var querystring=require(_0x6520('0x11'));var Papa=require(_0x6520('0x12'));var Redis=require(_0x6520('0x13'));var authService=require(_0x6520('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6520('0x15'));var logger=require(_0x6520('0x16'))(_0x6520('0x17'));var utils=require('../../config/utils');var config=require(_0x6520('0x18'));var db=require(_0x6520('0x19'))['db'];var jayson=require(_0x6520('0x1a'));var client=jayson[_0x6520('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x33bc75,_0x238f94,_0x532af9){if(_0x532af9){var _0x56781d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x56781d[_0x6520('0x1c')](_0x238f94)){return _0x33bc75;}else{throw new db[(_0x6520('0x1d'))][(_0x6520('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x33bc75;}}function respondWithRpcPromise(_0x56d4d2,_0x8c266a,_0x490f75,_0x26dfb7){return new BPromise(function(_0x2d3944,_0x13b410){var _0x216887=_0x26dfb7||client;return _0x216887[_0x6520('0x1f')](_0x56d4d2,_0x490f75)['then'](function(_0x3ecc3d){logger[_0x6520('0x20')](_0x6520('0x21'),_0x8c266a,_0x6520('0x22'));logger[_0x6520('0x23')](_0x6520('0x24'),_0x8c266a,_0x6520('0x22'),JSON[_0x6520('0x25')](_0x3ecc3d));if(_0x3ecc3d[_0x6520('0x26')]){if(_0x3ecc3d[_0x6520('0x26')]['code']===0x1f4){logger[_0x6520('0x26')]('ZendeskConfiguration,\x20%s,\x20%s',_0x8c266a,_0x3ecc3d[_0x6520('0x26')][_0x6520('0x27')]);return _0x13b410(_0x3ecc3d['error'][_0x6520('0x27')]);}logger[_0x6520('0x26')]('ZendeskConfiguration,\x20%s,\x20%s',_0x8c266a,_0x3ecc3d[_0x6520('0x26')][_0x6520('0x27')]);return _0x2d3944(_0x3ecc3d['error']['message']);}else{logger[_0x6520('0x20')](_0x6520('0x21'),_0x8c266a,_0x6520('0x22'));_0x2d3944(_0x3ecc3d[_0x6520('0x28')][_0x6520('0x27')]);}})[_0x6520('0x29')](function(_0x17574a){logger[_0x6520('0x26')](_0x6520('0x21'),_0x8c266a,_0x17574a);_0x13b410(_0x17574a);});});}function respondWithStatusCode(_0x473264,_0x5e8cfe){_0x5e8cfe=_0x5e8cfe||0xcc;return function(_0x12e2f2){if(_0x12e2f2){return _0x473264[_0x6520('0x2a')](_0x5e8cfe);}return _0x473264['status'](_0x5e8cfe)[_0x6520('0x2b')]();};}function respondWithResult(_0x5686aa,_0x85746c){_0x85746c=_0x85746c||0xc8;return function(_0x5d6f95){if(_0x5d6f95){return _0x5686aa[_0x6520('0x2c')](_0x85746c)[_0x6520('0x2d')](_0x5d6f95);}};}function respondWithFilteredResult(_0x5a34db,_0x140686){return function(_0x2f0753){if(_0x2f0753){var _0x3849dd=_0x2f0753[_0x6520('0x2e')],_0xd48a20=_0x140686[_0x6520('0x2f')],_0x30d3b1=_0x140686[_0x6520('0x2f')]+_0x140686[_0x6520('0x30')],_0x560bda;if(_0x30d3b1>=_0x3849dd){_0x30d3b1=_0x3849dd;_0x560bda=0xc8;}else{_0x560bda=0xce;}_0x5a34db[_0x6520('0x2c')](_0x560bda);return _0x5a34db[_0x6520('0x31')](_0x6520('0x32'),_0xd48a20+'-'+_0x30d3b1+'/'+_0x3849dd)[_0x6520('0x2d')](_0x2f0753);}return null;};}function patchUpdates(_0x28f200){return function(_0x22abe9){try{jsonpatch[_0x6520('0x33')](_0x22abe9,_0x28f200,!![]);}catch(_0x7ff09c){return BPromise['reject'](_0x7ff09c);}return _0x22abe9[_0x6520('0x34')]();};}function saveUpdates(_0xb3572f,_0x1c6b59){return function(_0x3f4754){if(_0x3f4754){return _0x3f4754[_0x6520('0x35')](_0xb3572f)[_0x6520('0x36')](function(_0x1098d4){return _0x1098d4;});}return null;};}function removeEntity(_0x4d81e6,_0x423e5d){return function(_0x339aed){if(_0x339aed){return _0x339aed[_0x6520('0x37')]()[_0x6520('0x36')](function(){_0x4d81e6['status'](0xcc)[_0x6520('0x2b')]();});}};}function handleEntityNotFound(_0x12bdb6,_0x27f7e9){return function(_0x1034e9){if(!_0x1034e9){_0x12bdb6[_0x6520('0x2a')](0x194);}return _0x1034e9;};}function handleError(_0x19a4f8,_0x5708cf){_0x5708cf=_0x5708cf||0x1f4;return function(_0x385790){logger[_0x6520('0x26')](_0x385790[_0x6520('0x38')]);if(_0x385790[_0x6520('0x39')]){delete _0x385790['name'];}_0x19a4f8['status'](_0x5708cf)['send'](_0x385790);};}exports[_0x6520('0x3a')]=function(_0x1caa84,_0x5462ec){var _0x593dcf={},_0x2c63ef={},_0x260585={'count':0x0,'rows':[]};var _0x2e4bc3=_['map'](db[_0x6520('0x3b')][_0x6520('0x3c')],function(_0x2a3feb){return{'name':_0x2a3feb[_0x6520('0x3d')],'type':_0x2a3feb[_0x6520('0x3e')][_0x6520('0x3f')]};});_0x2c63ef[_0x6520('0x40')]=_[_0x6520('0x41')](_0x2e4bc3,_0x6520('0x39'));_0x2c63ef[_0x6520('0x42')]=_[_0x6520('0x43')](_0x1caa84[_0x6520('0x42')]);_0x2c63ef[_0x6520('0x44')]=_['intersection'](_0x2c63ef['model'],_0x2c63ef[_0x6520('0x42')]);_0x593dcf[_0x6520('0x45')]=_[_0x6520('0x46')](_0x2c63ef['model'],qs[_0x6520('0x47')](_0x1caa84[_0x6520('0x42')][_0x6520('0x47')]));_0x593dcf[_0x6520('0x45')]=_0x593dcf['attributes'][_0x6520('0x48')]?_0x593dcf['attributes']:_0x2c63ef[_0x6520('0x40')];if(!_0x1caa84[_0x6520('0x42')]['hasOwnProperty'](_0x6520('0x49'))){_0x593dcf[_0x6520('0x30')]=qs['limit'](_0x1caa84[_0x6520('0x42')]['limit']);_0x593dcf[_0x6520('0x2f')]=qs[_0x6520('0x2f')](_0x1caa84[_0x6520('0x42')][_0x6520('0x2f')]);}_0x593dcf['order']=qs[_0x6520('0x4a')](_0x1caa84[_0x6520('0x42')][_0x6520('0x4a')]);_0x593dcf['where']=qs[_0x6520('0x44')](_[_0x6520('0x4b')](_0x1caa84[_0x6520('0x42')],_0x2c63ef[_0x6520('0x44')]),_0x2e4bc3);if(_0x1caa84[_0x6520('0x42')][_0x6520('0x4c')]){_0x593dcf[_0x6520('0x4d')]=_[_0x6520('0x4e')](_0x593dcf[_0x6520('0x4d')],{'$or':_['map'](_0x2e4bc3,function(_0xec5948){if(_0xec5948[_0x6520('0x3e')]!==_0x6520('0x4f')){var _0x30e159={};_0x30e159[_0xec5948[_0x6520('0x39')]]={'$like':'%'+_0x1caa84[_0x6520('0x42')][_0x6520('0x4c')]+'%'};return _0x30e159;}})});}_0x593dcf=_[_0x6520('0x4e')]({},_0x593dcf,_0x1caa84['options']);var _0x3ff530={'where':_0x593dcf['where']};return db[_0x6520('0x3b')][_0x6520('0x2e')](_0x3ff530)[_0x6520('0x36')](function(_0x2b76ed){_0x260585[_0x6520('0x2e')]=_0x2b76ed;if(_0x1caa84['query'][_0x6520('0x50')]){_0x593dcf['include']=[{'all':!![]}];}return db[_0x6520('0x3b')][_0x6520('0x51')](_0x593dcf);})[_0x6520('0x36')](function(_0x3b1c43){_0x260585['rows']=_0x3b1c43;return _0x260585;})[_0x6520('0x36')](respondWithFilteredResult(_0x5462ec,_0x593dcf))[_0x6520('0x29')](handleError(_0x5462ec,null));};exports[_0x6520('0x52')]=function(_0x3ebb1f,_0x216883){var _0xdd7bfa={'raw':![],'where':{'id':_0x3ebb1f[_0x6520('0x53')]['id']}},_0x1cfa63={};_0x1cfa63['model']=_[_0x6520('0x43')](db[_0x6520('0x3b')]['rawAttributes']);_0x1cfa63[_0x6520('0x42')]=_[_0x6520('0x43')](_0x3ebb1f['query']);_0x1cfa63[_0x6520('0x44')]=_[_0x6520('0x46')](_0x1cfa63[_0x6520('0x40')],_0x1cfa63[_0x6520('0x42')]);_0xdd7bfa[_0x6520('0x45')]=_['intersection'](_0x1cfa63[_0x6520('0x40')],qs['fields'](_0x3ebb1f[_0x6520('0x42')][_0x6520('0x47')]));_0xdd7bfa['attributes']=_0xdd7bfa[_0x6520('0x45')][_0x6520('0x48')]?_0xdd7bfa['attributes']:_0x1cfa63[_0x6520('0x40')];if(_0x3ebb1f['query'][_0x6520('0x50')]){_0xdd7bfa[_0x6520('0x54')]=[{'all':!![]}];}_0xdd7bfa=_[_0x6520('0x4e')]({},_0xdd7bfa,_0x3ebb1f[_0x6520('0x55')]);return db[_0x6520('0x3b')][_0x6520('0x56')](_0xdd7bfa)['then'](handleEntityNotFound(_0x216883,null))[_0x6520('0x36')](respondWithResult(_0x216883,null))[_0x6520('0x29')](handleError(_0x216883,null));};exports[_0x6520('0x57')]=function(_0x980748,_0x5a8267){return db[_0x6520('0x3b')][_0x6520('0x57')](_0x980748[_0x6520('0x58')],{})[_0x6520('0x36')](respondWithResult(_0x5a8267,0xc9))[_0x6520('0x29')](handleError(_0x5a8267,null));};exports[_0x6520('0x35')]=function(_0x363357,_0x477f70){if(_0x363357['body']['id']){delete _0x363357[_0x6520('0x58')]['id'];}return db[_0x6520('0x3b')][_0x6520('0x56')]({'where':{'id':_0x363357[_0x6520('0x53')]['id']}})[_0x6520('0x36')](handleEntityNotFound(_0x477f70,null))[_0x6520('0x36')](saveUpdates(_0x363357[_0x6520('0x58')],null))[_0x6520('0x36')](respondWithResult(_0x477f70,null))[_0x6520('0x29')](handleError(_0x477f70,null));};exports[_0x6520('0x37')]=function(_0x3c38d7,_0x5b140c){return db['ZendeskConfiguration']['find']({'where':{'id':_0x3c38d7[_0x6520('0x53')]['id']}})[_0x6520('0x36')](handleEntityNotFound(_0x5b140c,null))[_0x6520('0x36')](removeEntity(_0x5b140c,null))['catch'](handleError(_0x5b140c,null));};exports[_0x6520('0x59')]=function(_0x2ef74f,_0x5138ba,_0x333803){var _0x3f40fc={};var _0x396462={};var _0xc7b2b9;var _0xd150c7;return db[_0x6520('0x3b')]['findOne']({'where':{'id':_0x2ef74f[_0x6520('0x53')]['id']}})[_0x6520('0x36')](handleEntityNotFound(_0x5138ba,null))[_0x6520('0x36')](function(_0x8a7816){if(_0x8a7816){_0xc7b2b9=_0x8a7816;_0x396462[_0x6520('0x40')]=_[_0x6520('0x43')](db[_0x6520('0x5a')]['rawAttributes']);_0x396462[_0x6520('0x42')]=_['keys'](_0x2ef74f[_0x6520('0x42')]);_0x396462[_0x6520('0x44')]=_[_0x6520('0x46')](_0x396462['model'],_0x396462['query']);_0x3f40fc[_0x6520('0x45')]=_[_0x6520('0x46')](_0x396462[_0x6520('0x40')],qs['fields'](_0x2ef74f['query'][_0x6520('0x47')]));_0x3f40fc[_0x6520('0x45')]=_0x3f40fc[_0x6520('0x45')][_0x6520('0x48')]?_0x3f40fc[_0x6520('0x45')]:_0x396462[_0x6520('0x40')];_0x3f40fc[_0x6520('0x5b')]=qs[_0x6520('0x4a')](_0x2ef74f[_0x6520('0x42')][_0x6520('0x4a')]);_0x3f40fc['where']=qs[_0x6520('0x44')](_['pick'](_0x2ef74f[_0x6520('0x42')],_0x396462['filters']));if(_0x2ef74f[_0x6520('0x42')][_0x6520('0x4c')]){_0x3f40fc[_0x6520('0x4d')]=_['merge'](_0x3f40fc[_0x6520('0x4d')],{'$or':_[_0x6520('0x41')](_0x3f40fc[_0x6520('0x45')],function(_0x3f94b7){var _0x573519={};_0x573519[_0x3f94b7]={'$like':'%'+_0x2ef74f['query'][_0x6520('0x4c')]+'%'};return _0x573519;})});}_0x3f40fc=_[_0x6520('0x4e')]({},_0x3f40fc,_0x2ef74f['options']);return _0xc7b2b9[_0x6520('0x59')](_0x3f40fc);}})['then'](function(_0x2b7c88){if(_0x2b7c88){_0xd150c7=_0x2b7c88[_0x6520('0x48')];if(!_0x2ef74f[_0x6520('0x42')][_0x6520('0x5c')](_0x6520('0x49'))){_0x3f40fc[_0x6520('0x30')]=qs['limit'](_0x2ef74f['query'][_0x6520('0x30')]);_0x3f40fc[_0x6520('0x2f')]=qs[_0x6520('0x2f')](_0x2ef74f[_0x6520('0x42')]['offset']);}return _0xc7b2b9['getFields'](_0x3f40fc);}})['then'](function(_0x318780){if(_0x318780){return _0x318780?{'count':_0xd150c7,'rows':_0x318780}:null;}})[_0x6520('0x36')](respondWithResult(_0x5138ba,null))[_0x6520('0x29')](handleError(_0x5138ba,null));};exports[_0x6520('0x5d')]=function(_0x3aae0e,_0x9159a2,_0x140e60){var _0x40701a={};var _0x380a02={};var _0x1afc7e;var _0x15dacc;return db[_0x6520('0x3b')]['findOne']({'where':{'id':_0x3aae0e[_0x6520('0x53')]['id']}})[_0x6520('0x36')](handleEntityNotFound(_0x9159a2,null))['then'](function(_0x529938){if(_0x529938){_0x1afc7e=_0x529938;_0x380a02[_0x6520('0x40')]=_[_0x6520('0x43')](db[_0x6520('0x5a')][_0x6520('0x3c')]);_0x380a02[_0x6520('0x42')]=_['keys'](_0x3aae0e[_0x6520('0x42')]);_0x380a02['filters']=_['intersection'](_0x380a02['model'],_0x380a02['query']);_0x40701a['attributes']=_[_0x6520('0x46')](_0x380a02[_0x6520('0x40')],qs['fields'](_0x3aae0e[_0x6520('0x42')][_0x6520('0x47')]));_0x40701a['attributes']=_0x40701a[_0x6520('0x45')]['length']?_0x40701a[_0x6520('0x45')]:_0x380a02[_0x6520('0x40')];_0x40701a['order']=qs[_0x6520('0x4a')](_0x3aae0e[_0x6520('0x42')]['sort']);_0x40701a[_0x6520('0x4d')]=qs['filters'](_['pick'](_0x3aae0e[_0x6520('0x42')],_0x380a02[_0x6520('0x44')]));if(_0x3aae0e[_0x6520('0x42')][_0x6520('0x4c')]){_0x40701a['where']=_[_0x6520('0x4e')](_0x40701a[_0x6520('0x4d')],{'$or':_['map'](_0x40701a[_0x6520('0x45')],function(_0xe68be4){var _0x28d5c2={};_0x28d5c2[_0xe68be4]={'$like':'%'+_0x3aae0e[_0x6520('0x42')][_0x6520('0x4c')]+'%'};return _0x28d5c2;})});}_0x40701a=_[_0x6520('0x4e')]({},_0x40701a,_0x3aae0e['options']);return _0x1afc7e[_0x6520('0x5d')](_0x40701a);}})['then'](function(_0x1d95cb){if(_0x1d95cb){_0x15dacc=_0x1d95cb[_0x6520('0x48')];if(!_0x3aae0e[_0x6520('0x42')][_0x6520('0x5c')]('nolimit')){_0x40701a[_0x6520('0x30')]=qs[_0x6520('0x30')](_0x3aae0e[_0x6520('0x42')][_0x6520('0x30')]);_0x40701a[_0x6520('0x2f')]=qs[_0x6520('0x2f')](_0x3aae0e[_0x6520('0x42')][_0x6520('0x2f')]);}return _0x1afc7e['getSubjects'](_0x40701a);}})[_0x6520('0x36')](function(_0x86b16f){if(_0x86b16f){return _0x86b16f?{'count':_0x15dacc,'rows':_0x86b16f}:null;}})[_0x6520('0x36')](respondWithResult(_0x9159a2,null))[_0x6520('0x29')](handleError(_0x9159a2,null));};exports[_0x6520('0x5e')]=function(_0x58cbd9,_0x18fd3d,_0x1d98d0){var _0x2499bf={};var _0x3335c9={};var _0x7c0d84;var _0x3cc9d4;return db['ZendeskConfiguration'][_0x6520('0x5f')]({'where':{'id':_0x58cbd9['params']['id']}})[_0x6520('0x36')](handleEntityNotFound(_0x18fd3d,null))['then'](function(_0x5c1912){if(_0x5c1912){_0x7c0d84=_0x5c1912;_0x3335c9['model']=_[_0x6520('0x43')](db[_0x6520('0x5a')][_0x6520('0x3c')]);_0x3335c9[_0x6520('0x42')]=_[_0x6520('0x43')](_0x58cbd9[_0x6520('0x42')]);_0x3335c9[_0x6520('0x44')]=_[_0x6520('0x46')](_0x3335c9[_0x6520('0x40')],_0x3335c9[_0x6520('0x42')]);_0x2499bf[_0x6520('0x45')]=_[_0x6520('0x46')](_0x3335c9[_0x6520('0x40')],qs['fields'](_0x58cbd9['query'][_0x6520('0x47')]));_0x2499bf[_0x6520('0x45')]=_0x2499bf[_0x6520('0x45')]['length']?_0x2499bf[_0x6520('0x45')]:_0x3335c9[_0x6520('0x40')];_0x2499bf['order']=qs[_0x6520('0x4a')](_0x58cbd9[_0x6520('0x42')]['sort']);_0x2499bf[_0x6520('0x4d')]=qs[_0x6520('0x44')](_[_0x6520('0x4b')](_0x58cbd9[_0x6520('0x42')],_0x3335c9[_0x6520('0x44')]));if(_0x58cbd9[_0x6520('0x42')][_0x6520('0x4c')]){_0x2499bf[_0x6520('0x4d')]=_[_0x6520('0x4e')](_0x2499bf[_0x6520('0x4d')],{'$or':_[_0x6520('0x41')](_0x2499bf[_0x6520('0x45')],function(_0x2fba8f){var _0x7a818d={};_0x7a818d[_0x2fba8f]={'$like':'%'+_0x58cbd9[_0x6520('0x42')]['filter']+'%'};return _0x7a818d;})});}_0x2499bf=_[_0x6520('0x4e')]({},_0x2499bf,_0x58cbd9[_0x6520('0x55')]);return _0x7c0d84[_0x6520('0x5e')](_0x2499bf);}})['then'](function(_0x29d404){if(_0x29d404){_0x3cc9d4=_0x29d404[_0x6520('0x48')];if(!_0x58cbd9['query'][_0x6520('0x5c')]('nolimit')){_0x2499bf[_0x6520('0x30')]=qs[_0x6520('0x30')](_0x58cbd9[_0x6520('0x42')][_0x6520('0x30')]);_0x2499bf['offset']=qs[_0x6520('0x2f')](_0x58cbd9[_0x6520('0x42')][_0x6520('0x2f')]);}return _0x7c0d84[_0x6520('0x5e')](_0x2499bf);}})['then'](function(_0x18e865){if(_0x18e865){return _0x18e865?{'count':_0x3cc9d4,'rows':_0x18e865}:null;}})['then'](respondWithResult(_0x18fd3d,null))['catch'](handleError(_0x18fd3d,null));};exports[_0x6520('0x60')]=function(_0x5c25bc,_0x539d4c,_0x3a817c){var _0xc0870e={};var _0x5411d1={};var _0xb548c;var _0x2b8357;return db[_0x6520('0x3b')][_0x6520('0x5f')]({'where':{'id':_0x5c25bc[_0x6520('0x53')]['id']}})[_0x6520('0x36')](handleEntityNotFound(_0x539d4c,null))[_0x6520('0x36')](function(_0x3025fa){if(_0x3025fa){_0xb548c=_0x3025fa;_0x5411d1['model']=_[_0x6520('0x43')](db[_0x6520('0x61')]['rawAttributes']);_0x5411d1[_0x6520('0x42')]=_[_0x6520('0x43')](_0x5c25bc[_0x6520('0x42')]);_0x5411d1[_0x6520('0x44')]=_[_0x6520('0x46')](_0x5411d1['model'],_0x5411d1['query']);_0xc0870e[_0x6520('0x45')]=_[_0x6520('0x46')](_0x5411d1[_0x6520('0x40')],qs[_0x6520('0x47')](_0x5c25bc['query'][_0x6520('0x47')]));_0xc0870e['attributes']=_0xc0870e['attributes'][_0x6520('0x48')]?_0xc0870e[_0x6520('0x45')]:_0x5411d1['model'];_0xc0870e[_0x6520('0x5b')]=qs['sort'](_0x5c25bc[_0x6520('0x42')]['sort']);_0xc0870e[_0x6520('0x4d')]=qs[_0x6520('0x44')](_[_0x6520('0x4b')](_0x5c25bc[_0x6520('0x42')],_0x5411d1[_0x6520('0x44')]));if(_0x5c25bc[_0x6520('0x42')][_0x6520('0x4c')]){_0xc0870e[_0x6520('0x4d')]=_['merge'](_0xc0870e[_0x6520('0x4d')],{'$or':_[_0x6520('0x41')](_0xc0870e['attributes'],function(_0x1886bd){var _0x6cebe7={};_0x6cebe7[_0x1886bd]={'$like':'%'+_0x5c25bc[_0x6520('0x42')][_0x6520('0x4c')]+'%'};return _0x6cebe7;})});}_0xc0870e=_[_0x6520('0x4e')]({},_0xc0870e,_0x5c25bc['options']);return _0xb548c[_0x6520('0x60')](_0xc0870e);}})[_0x6520('0x36')](function(_0x1914ce){if(_0x1914ce){_0x2b8357=_0x1914ce[_0x6520('0x48')];if(!_0x5c25bc[_0x6520('0x42')]['hasOwnProperty'](_0x6520('0x49'))){_0xc0870e['limit']=qs[_0x6520('0x30')](_0x5c25bc['query']['limit']);_0xc0870e['offset']=qs[_0x6520('0x2f')](_0x5c25bc['query'][_0x6520('0x2f')]);}return _0xb548c[_0x6520('0x60')](_0xc0870e);}})['then'](function(_0x14ae2d){if(_0x14ae2d){return _0x14ae2d?{'count':_0x2b8357,'rows':_0x14ae2d}:null;}})[_0x6520('0x36')](respondWithResult(_0x539d4c,null))[_0x6520('0x29')](handleError(_0x539d4c,null));};exports['setTags']=function(_0x51c028,_0x37547,_0x3c5c4b){if(_0x51c028[_0x6520('0x58')]['id']){delete _0x51c028[_0x6520('0x58')]['id'];}return db[_0x6520('0x3b')][_0x6520('0x5f')]({'where':{'id':_0x51c028['params']['id']}})[_0x6520('0x36')](handleEntityNotFound(_0x37547,null))['then'](function(_0x324749){if(_0x324749){return _0x324749[_0x6520('0x62')](_0x51c028[_0x6520('0x58')][_0x6520('0x63')]||[]);}return null;})[_0x6520('0x36')](respondWithResult(_0x37547,null))[_0x6520('0x29')](handleError(_0x37547,null));}; \ No newline at end of file +var _0x7148=['options','includeAll','rows','show','params','rawAttributes','create','body','getFields','findOne','ZendeskField','getSubjects','order','hasOwnProperty','getDescriptions','getTags','Tag','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','ZendeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter'];(function(_0x2a1db6,_0x5bd31a){var _0x41d420=function(_0xbecc83){while(--_0xbecc83){_0x2a1db6['push'](_0x2a1db6['shift']());}};_0x41d420(++_0x5bd31a);}(_0x7148,0x138));var _0x8714=function(_0x3c99a5,_0x297d20){_0x3c99a5=_0x3c99a5-0x0;var _0x2b49b8=_0x7148[_0x3c99a5];return _0x2b49b8;};'use strict';var pdf=require(_0x8714('0x0'));var emlformat=require(_0x8714('0x1'));var rimraf=require(_0x8714('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8714('0x3'));var rp=require(_0x8714('0x4'));var moment=require(_0x8714('0x5'));var BPromise=require(_0x8714('0x6'));var Mustache=require(_0x8714('0x7'));var util=require('util');var path=require(_0x8714('0x8'));var sox=require(_0x8714('0x9'));var csv=require(_0x8714('0xa'));var ejs=require(_0x8714('0xb'));var fs=require('fs');var _=require(_0x8714('0xc'));var squel=require(_0x8714('0xd'));var crypto=require(_0x8714('0xe'));var jsforce=require(_0x8714('0xf'));var deskjs=require(_0x8714('0x10'));var toCsv=require(_0x8714('0xa'));var querystring=require(_0x8714('0x11'));var Papa=require(_0x8714('0x12'));var Redis=require(_0x8714('0x13'));var authService=require(_0x8714('0x14'));var qs=require(_0x8714('0x15'));var as=require(_0x8714('0x16'));var hardwareService=require(_0x8714('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x8714('0x18'));var config=require(_0x8714('0x19'));var db=require(_0x8714('0x1a'))['db'];var jayson=require(_0x8714('0x1b'));var client=jayson[_0x8714('0x1c')][_0x8714('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x3d802e,_0x2aa407,_0x57b703){if(_0x57b703){var _0x29b12a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x29b12a['test'](_0x2aa407)){return _0x3d802e;}else{throw new db[(_0x8714('0x1e'))]['ValidationError'](_0x8714('0x1f'));}}else{return _0x3d802e;}}function respondWithRpcPromise(_0x1a3996,_0x1f78d4,_0x25511d,_0x35147d){return new BPromise(function(_0xb5d2f,_0x50f45b){var _0x445fdf=_0x35147d||client;return _0x445fdf['request'](_0x1a3996,_0x25511d)['then'](function(_0x574292){logger[_0x8714('0x20')](_0x8714('0x21'),_0x1f78d4,_0x8714('0x22'));logger[_0x8714('0x23')](_0x8714('0x24'),_0x1f78d4,_0x8714('0x22'),JSON[_0x8714('0x25')](_0x574292));if(_0x574292[_0x8714('0x26')]){if(_0x574292[_0x8714('0x26')][_0x8714('0x27')]===0x1f4){logger[_0x8714('0x26')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1f78d4,_0x574292[_0x8714('0x26')][_0x8714('0x28')]);return _0x50f45b(_0x574292[_0x8714('0x26')][_0x8714('0x28')]);}logger['error'](_0x8714('0x21'),_0x1f78d4,_0x574292['error'][_0x8714('0x28')]);return _0xb5d2f(_0x574292[_0x8714('0x26')][_0x8714('0x28')]);}else{logger[_0x8714('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1f78d4,_0x8714('0x22'));_0xb5d2f(_0x574292[_0x8714('0x29')][_0x8714('0x28')]);}})[_0x8714('0x2a')](function(_0x3de19d){logger[_0x8714('0x26')](_0x8714('0x21'),_0x1f78d4,_0x3de19d);_0x50f45b(_0x3de19d);});});}function respondWithStatusCode(_0x35c085,_0x50cbae){_0x50cbae=_0x50cbae||0xcc;return function(_0x114040){if(_0x114040){return _0x35c085['sendStatus'](_0x50cbae);}return _0x35c085[_0x8714('0x2b')](_0x50cbae)[_0x8714('0x2c')]();};}function respondWithResult(_0x1e5d90,_0x2f1baf){_0x2f1baf=_0x2f1baf||0xc8;return function(_0x4d5566){if(_0x4d5566){return _0x1e5d90[_0x8714('0x2b')](_0x2f1baf)[_0x8714('0x2d')](_0x4d5566);}};}function respondWithFilteredResult(_0x5deb71,_0x2b7da1){return function(_0x232ea2){if(_0x232ea2){var _0x5f2197=_0x232ea2[_0x8714('0x2e')],_0xdcc2c2=_0x2b7da1[_0x8714('0x2f')],_0x507150=_0x2b7da1[_0x8714('0x2f')]+_0x2b7da1['limit'],_0xccf32b;if(_0x507150>=_0x5f2197){_0x507150=_0x5f2197;_0xccf32b=0xc8;}else{_0xccf32b=0xce;}_0x5deb71[_0x8714('0x2b')](_0xccf32b);return _0x5deb71[_0x8714('0x30')](_0x8714('0x31'),_0xdcc2c2+'-'+_0x507150+'/'+_0x5f2197)[_0x8714('0x2d')](_0x232ea2);}return null;};}function patchUpdates(_0x4e1abd){return function(_0x20d143){try{jsonpatch[_0x8714('0x32')](_0x20d143,_0x4e1abd,!![]);}catch(_0xa3df38){return BPromise['reject'](_0xa3df38);}return _0x20d143[_0x8714('0x33')]();};}function saveUpdates(_0x3529e0,_0x44cd8d){return function(_0x39ec07){if(_0x39ec07){return _0x39ec07[_0x8714('0x34')](_0x3529e0)[_0x8714('0x35')](function(_0x5c80b7){return _0x5c80b7;});}return null;};}function removeEntity(_0x4dd3f8,_0xedc8fe){return function(_0x4c82dd){if(_0x4c82dd){return _0x4c82dd[_0x8714('0x36')]()[_0x8714('0x35')](function(){_0x4dd3f8[_0x8714('0x2b')](0xcc)[_0x8714('0x2c')]();});}};}function handleEntityNotFound(_0x2bdee0,_0x3fa445){return function(_0xdac9){if(!_0xdac9){_0x2bdee0[_0x8714('0x37')](0x194);}return _0xdac9;};}function handleError(_0x4be566,_0xff9829){_0xff9829=_0xff9829||0x1f4;return function(_0x1d28ee){logger['error'](_0x1d28ee['stack']);if(_0x1d28ee[_0x8714('0x38')]){delete _0x1d28ee[_0x8714('0x38')];}_0x4be566[_0x8714('0x2b')](_0xff9829)[_0x8714('0x39')](_0x1d28ee);};}exports[_0x8714('0x3a')]=function(_0x315297,_0xea0679){var _0x439fbf={},_0x3a91c3={},_0x3b9957={'count':0x0,'rows':[]};var _0x2feeb6=_[_0x8714('0x3b')](db[_0x8714('0x3c')]['rawAttributes'],function(_0x2dd11f){return{'name':_0x2dd11f[_0x8714('0x3d')],'type':_0x2dd11f[_0x8714('0x3e')][_0x8714('0x3f')]};});_0x3a91c3[_0x8714('0x40')]=_[_0x8714('0x3b')](_0x2feeb6,'name');_0x3a91c3[_0x8714('0x41')]=_[_0x8714('0x42')](_0x315297[_0x8714('0x41')]);_0x3a91c3[_0x8714('0x43')]=_['intersection'](_0x3a91c3['model'],_0x3a91c3[_0x8714('0x41')]);_0x439fbf['attributes']=_[_0x8714('0x44')](_0x3a91c3[_0x8714('0x40')],qs[_0x8714('0x45')](_0x315297[_0x8714('0x41')][_0x8714('0x45')]));_0x439fbf[_0x8714('0x46')]=_0x439fbf[_0x8714('0x46')][_0x8714('0x47')]?_0x439fbf[_0x8714('0x46')]:_0x3a91c3[_0x8714('0x40')];if(!_0x315297['query']['hasOwnProperty'](_0x8714('0x48'))){_0x439fbf[_0x8714('0x49')]=qs[_0x8714('0x49')](_0x315297['query'][_0x8714('0x49')]);_0x439fbf['offset']=qs[_0x8714('0x2f')](_0x315297[_0x8714('0x41')][_0x8714('0x2f')]);}_0x439fbf['order']=qs[_0x8714('0x4a')](_0x315297[_0x8714('0x41')]['sort']);_0x439fbf[_0x8714('0x4b')]=qs[_0x8714('0x43')](_[_0x8714('0x4c')](_0x315297[_0x8714('0x41')],_0x3a91c3[_0x8714('0x43')]),_0x2feeb6);if(_0x315297[_0x8714('0x41')]['filter']){_0x439fbf['where']=_[_0x8714('0x4d')](_0x439fbf[_0x8714('0x4b')],{'$or':_[_0x8714('0x3b')](_0x2feeb6,function(_0x462bcd){if(_0x462bcd[_0x8714('0x3e')]!==_0x8714('0x4e')){var _0x356045={};_0x356045[_0x462bcd[_0x8714('0x38')]]={'$like':'%'+_0x315297[_0x8714('0x41')][_0x8714('0x4f')]+'%'};return _0x356045;}})});}_0x439fbf=_[_0x8714('0x4d')]({},_0x439fbf,_0x315297[_0x8714('0x50')]);var _0x4597f3={'where':_0x439fbf[_0x8714('0x4b')]};return db[_0x8714('0x3c')][_0x8714('0x2e')](_0x4597f3)[_0x8714('0x35')](function(_0x4e4e7f){_0x3b9957[_0x8714('0x2e')]=_0x4e4e7f;if(_0x315297[_0x8714('0x41')][_0x8714('0x51')]){_0x439fbf['include']=[{'all':!![]}];}return db[_0x8714('0x3c')]['findAll'](_0x439fbf);})['then'](function(_0x5a49f){_0x3b9957[_0x8714('0x52')]=_0x5a49f;return _0x3b9957;})[_0x8714('0x35')](respondWithFilteredResult(_0xea0679,_0x439fbf))[_0x8714('0x2a')](handleError(_0xea0679,null));};exports[_0x8714('0x53')]=function(_0x545c24,_0x277dea){var _0x21c1ba={'raw':![],'where':{'id':_0x545c24[_0x8714('0x54')]['id']}},_0x2f601a={};_0x2f601a[_0x8714('0x40')]=_['keys'](db['ZendeskConfiguration'][_0x8714('0x55')]);_0x2f601a[_0x8714('0x41')]=_[_0x8714('0x42')](_0x545c24[_0x8714('0x41')]);_0x2f601a[_0x8714('0x43')]=_[_0x8714('0x44')](_0x2f601a[_0x8714('0x40')],_0x2f601a[_0x8714('0x41')]);_0x21c1ba[_0x8714('0x46')]=_[_0x8714('0x44')](_0x2f601a['model'],qs[_0x8714('0x45')](_0x545c24['query'][_0x8714('0x45')]));_0x21c1ba['attributes']=_0x21c1ba[_0x8714('0x46')][_0x8714('0x47')]?_0x21c1ba[_0x8714('0x46')]:_0x2f601a['model'];if(_0x545c24['query'][_0x8714('0x51')]){_0x21c1ba['include']=[{'all':!![]}];}_0x21c1ba=_[_0x8714('0x4d')]({},_0x21c1ba,_0x545c24[_0x8714('0x50')]);return db[_0x8714('0x3c')]['find'](_0x21c1ba)[_0x8714('0x35')](handleEntityNotFound(_0x277dea,null))[_0x8714('0x35')](respondWithResult(_0x277dea,null))[_0x8714('0x2a')](handleError(_0x277dea,null));};exports[_0x8714('0x56')]=function(_0x399286,_0x2191d0){return db[_0x8714('0x3c')][_0x8714('0x56')](_0x399286[_0x8714('0x57')],{})[_0x8714('0x35')](respondWithResult(_0x2191d0,0xc9))[_0x8714('0x2a')](handleError(_0x2191d0,null));};exports[_0x8714('0x34')]=function(_0x50cf75,_0x54e016){if(_0x50cf75[_0x8714('0x57')]['id']){delete _0x50cf75['body']['id'];}return db[_0x8714('0x3c')]['find']({'where':{'id':_0x50cf75[_0x8714('0x54')]['id']}})[_0x8714('0x35')](handleEntityNotFound(_0x54e016,null))[_0x8714('0x35')](saveUpdates(_0x50cf75[_0x8714('0x57')],null))[_0x8714('0x35')](respondWithResult(_0x54e016,null))['catch'](handleError(_0x54e016,null));};exports[_0x8714('0x36')]=function(_0x34c010,_0x18326f){return db[_0x8714('0x3c')]['find']({'where':{'id':_0x34c010[_0x8714('0x54')]['id']}})[_0x8714('0x35')](handleEntityNotFound(_0x18326f,null))[_0x8714('0x35')](removeEntity(_0x18326f,null))[_0x8714('0x2a')](handleError(_0x18326f,null));};exports[_0x8714('0x58')]=function(_0xbf1962,_0x4b303a,_0x332da8){var _0x195ab1={};var _0x177ab3={};var _0xed7ce8;var _0x4ff62b;return db[_0x8714('0x3c')][_0x8714('0x59')]({'where':{'id':_0xbf1962[_0x8714('0x54')]['id']}})[_0x8714('0x35')](handleEntityNotFound(_0x4b303a,null))[_0x8714('0x35')](function(_0x42ac09){if(_0x42ac09){_0xed7ce8=_0x42ac09;_0x177ab3[_0x8714('0x40')]=_[_0x8714('0x42')](db[_0x8714('0x5a')][_0x8714('0x55')]);_0x177ab3[_0x8714('0x41')]=_[_0x8714('0x42')](_0xbf1962['query']);_0x177ab3['filters']=_[_0x8714('0x44')](_0x177ab3[_0x8714('0x40')],_0x177ab3['query']);_0x195ab1['attributes']=_[_0x8714('0x44')](_0x177ab3[_0x8714('0x40')],qs[_0x8714('0x45')](_0xbf1962[_0x8714('0x41')][_0x8714('0x45')]));_0x195ab1['attributes']=_0x195ab1['attributes'][_0x8714('0x47')]?_0x195ab1['attributes']:_0x177ab3[_0x8714('0x40')];_0x195ab1['order']=qs[_0x8714('0x4a')](_0xbf1962['query'][_0x8714('0x4a')]);_0x195ab1[_0x8714('0x4b')]=qs[_0x8714('0x43')](_['pick'](_0xbf1962['query'],_0x177ab3[_0x8714('0x43')]));if(_0xbf1962['query']['filter']){_0x195ab1[_0x8714('0x4b')]=_[_0x8714('0x4d')](_0x195ab1[_0x8714('0x4b')],{'$or':_[_0x8714('0x3b')](_0x195ab1[_0x8714('0x46')],function(_0x20d0c8){var _0x5790ea={};_0x5790ea[_0x20d0c8]={'$like':'%'+_0xbf1962[_0x8714('0x41')]['filter']+'%'};return _0x5790ea;})});}_0x195ab1=_[_0x8714('0x4d')]({},_0x195ab1,_0xbf1962['options']);return _0xed7ce8[_0x8714('0x58')](_0x195ab1);}})[_0x8714('0x35')](function(_0x34e9dc){if(_0x34e9dc){_0x4ff62b=_0x34e9dc[_0x8714('0x47')];if(!_0xbf1962[_0x8714('0x41')]['hasOwnProperty'](_0x8714('0x48'))){_0x195ab1['limit']=qs[_0x8714('0x49')](_0xbf1962[_0x8714('0x41')][_0x8714('0x49')]);_0x195ab1[_0x8714('0x2f')]=qs['offset'](_0xbf1962['query'][_0x8714('0x2f')]);}return _0xed7ce8[_0x8714('0x58')](_0x195ab1);}})['then'](function(_0x437151){if(_0x437151){return _0x437151?{'count':_0x4ff62b,'rows':_0x437151}:null;}})[_0x8714('0x35')](respondWithResult(_0x4b303a,null))[_0x8714('0x2a')](handleError(_0x4b303a,null));};exports[_0x8714('0x5b')]=function(_0x3fdd19,_0x2ad46b,_0x37f9f8){var _0x59cd6e={};var _0x44c523={};var _0xddcf34;var _0x1dfdbd;return db['ZendeskConfiguration'][_0x8714('0x59')]({'where':{'id':_0x3fdd19[_0x8714('0x54')]['id']}})[_0x8714('0x35')](handleEntityNotFound(_0x2ad46b,null))[_0x8714('0x35')](function(_0x5c6f69){if(_0x5c6f69){_0xddcf34=_0x5c6f69;_0x44c523['model']=_[_0x8714('0x42')](db[_0x8714('0x5a')][_0x8714('0x55')]);_0x44c523[_0x8714('0x41')]=_[_0x8714('0x42')](_0x3fdd19[_0x8714('0x41')]);_0x44c523[_0x8714('0x43')]=_[_0x8714('0x44')](_0x44c523[_0x8714('0x40')],_0x44c523['query']);_0x59cd6e[_0x8714('0x46')]=_['intersection'](_0x44c523[_0x8714('0x40')],qs[_0x8714('0x45')](_0x3fdd19[_0x8714('0x41')][_0x8714('0x45')]));_0x59cd6e[_0x8714('0x46')]=_0x59cd6e[_0x8714('0x46')]['length']?_0x59cd6e[_0x8714('0x46')]:_0x44c523[_0x8714('0x40')];_0x59cd6e[_0x8714('0x5c')]=qs[_0x8714('0x4a')](_0x3fdd19[_0x8714('0x41')]['sort']);_0x59cd6e[_0x8714('0x4b')]=qs[_0x8714('0x43')](_[_0x8714('0x4c')](_0x3fdd19[_0x8714('0x41')],_0x44c523[_0x8714('0x43')]));if(_0x3fdd19[_0x8714('0x41')][_0x8714('0x4f')]){_0x59cd6e[_0x8714('0x4b')]=_[_0x8714('0x4d')](_0x59cd6e[_0x8714('0x4b')],{'$or':_[_0x8714('0x3b')](_0x59cd6e['attributes'],function(_0x5d918f){var _0x56ebc9={};_0x56ebc9[_0x5d918f]={'$like':'%'+_0x3fdd19[_0x8714('0x41')]['filter']+'%'};return _0x56ebc9;})});}_0x59cd6e=_[_0x8714('0x4d')]({},_0x59cd6e,_0x3fdd19[_0x8714('0x50')]);return _0xddcf34[_0x8714('0x5b')](_0x59cd6e);}})[_0x8714('0x35')](function(_0x59a395){if(_0x59a395){_0x1dfdbd=_0x59a395[_0x8714('0x47')];if(!_0x3fdd19[_0x8714('0x41')][_0x8714('0x5d')]('nolimit')){_0x59cd6e[_0x8714('0x49')]=qs['limit'](_0x3fdd19[_0x8714('0x41')][_0x8714('0x49')]);_0x59cd6e[_0x8714('0x2f')]=qs[_0x8714('0x2f')](_0x3fdd19[_0x8714('0x41')]['offset']);}return _0xddcf34['getSubjects'](_0x59cd6e);}})['then'](function(_0x51f294){if(_0x51f294){return _0x51f294?{'count':_0x1dfdbd,'rows':_0x51f294}:null;}})[_0x8714('0x35')](respondWithResult(_0x2ad46b,null))[_0x8714('0x2a')](handleError(_0x2ad46b,null));};exports[_0x8714('0x5e')]=function(_0xadf989,_0x2e55a1,_0x9cdd65){var _0x2597ad={};var _0x47681e={};var _0x31dccc;var _0x41ca52;return db[_0x8714('0x3c')][_0x8714('0x59')]({'where':{'id':_0xadf989[_0x8714('0x54')]['id']}})[_0x8714('0x35')](handleEntityNotFound(_0x2e55a1,null))['then'](function(_0x190f98){if(_0x190f98){_0x31dccc=_0x190f98;_0x47681e['model']=_['keys'](db[_0x8714('0x5a')]['rawAttributes']);_0x47681e['query']=_[_0x8714('0x42')](_0xadf989[_0x8714('0x41')]);_0x47681e[_0x8714('0x43')]=_['intersection'](_0x47681e[_0x8714('0x40')],_0x47681e[_0x8714('0x41')]);_0x2597ad['attributes']=_[_0x8714('0x44')](_0x47681e[_0x8714('0x40')],qs[_0x8714('0x45')](_0xadf989['query'][_0x8714('0x45')]));_0x2597ad[_0x8714('0x46')]=_0x2597ad[_0x8714('0x46')][_0x8714('0x47')]?_0x2597ad['attributes']:_0x47681e['model'];_0x2597ad[_0x8714('0x5c')]=qs[_0x8714('0x4a')](_0xadf989[_0x8714('0x41')]['sort']);_0x2597ad['where']=qs[_0x8714('0x43')](_['pick'](_0xadf989[_0x8714('0x41')],_0x47681e[_0x8714('0x43')]));if(_0xadf989[_0x8714('0x41')]['filter']){_0x2597ad[_0x8714('0x4b')]=_[_0x8714('0x4d')](_0x2597ad[_0x8714('0x4b')],{'$or':_[_0x8714('0x3b')](_0x2597ad[_0x8714('0x46')],function(_0x3ffac5){var _0x179cf7={};_0x179cf7[_0x3ffac5]={'$like':'%'+_0xadf989[_0x8714('0x41')][_0x8714('0x4f')]+'%'};return _0x179cf7;})});}_0x2597ad=_['merge']({},_0x2597ad,_0xadf989[_0x8714('0x50')]);return _0x31dccc[_0x8714('0x5e')](_0x2597ad);}})[_0x8714('0x35')](function(_0x4f7267){if(_0x4f7267){_0x41ca52=_0x4f7267[_0x8714('0x47')];if(!_0xadf989[_0x8714('0x41')][_0x8714('0x5d')]('nolimit')){_0x2597ad[_0x8714('0x49')]=qs['limit'](_0xadf989['query'][_0x8714('0x49')]);_0x2597ad['offset']=qs['offset'](_0xadf989[_0x8714('0x41')][_0x8714('0x2f')]);}return _0x31dccc[_0x8714('0x5e')](_0x2597ad);}})[_0x8714('0x35')](function(_0x37be04){if(_0x37be04){return _0x37be04?{'count':_0x41ca52,'rows':_0x37be04}:null;}})['then'](respondWithResult(_0x2e55a1,null))[_0x8714('0x2a')](handleError(_0x2e55a1,null));};exports[_0x8714('0x5f')]=function(_0x1bac77,_0x3f0539,_0x48d537){var _0xf0b621={};var _0x5146e2={};var _0xabe54f;var _0x173df7;return db[_0x8714('0x3c')][_0x8714('0x59')]({'where':{'id':_0x1bac77[_0x8714('0x54')]['id']}})[_0x8714('0x35')](handleEntityNotFound(_0x3f0539,null))['then'](function(_0x10b6fb){if(_0x10b6fb){_0xabe54f=_0x10b6fb;_0x5146e2[_0x8714('0x40')]=_['keys'](db[_0x8714('0x60')]['rawAttributes']);_0x5146e2[_0x8714('0x41')]=_[_0x8714('0x42')](_0x1bac77[_0x8714('0x41')]);_0x5146e2[_0x8714('0x43')]=_[_0x8714('0x44')](_0x5146e2['model'],_0x5146e2['query']);_0xf0b621[_0x8714('0x46')]=_[_0x8714('0x44')](_0x5146e2[_0x8714('0x40')],qs['fields'](_0x1bac77[_0x8714('0x41')][_0x8714('0x45')]));_0xf0b621[_0x8714('0x46')]=_0xf0b621[_0x8714('0x46')][_0x8714('0x47')]?_0xf0b621[_0x8714('0x46')]:_0x5146e2[_0x8714('0x40')];_0xf0b621[_0x8714('0x5c')]=qs[_0x8714('0x4a')](_0x1bac77[_0x8714('0x41')][_0x8714('0x4a')]);_0xf0b621[_0x8714('0x4b')]=qs[_0x8714('0x43')](_['pick'](_0x1bac77[_0x8714('0x41')],_0x5146e2['filters']));if(_0x1bac77[_0x8714('0x41')][_0x8714('0x4f')]){_0xf0b621[_0x8714('0x4b')]=_[_0x8714('0x4d')](_0xf0b621['where'],{'$or':_[_0x8714('0x3b')](_0xf0b621['attributes'],function(_0x1d30a6){var _0x288d41={};_0x288d41[_0x1d30a6]={'$like':'%'+_0x1bac77[_0x8714('0x41')][_0x8714('0x4f')]+'%'};return _0x288d41;})});}_0xf0b621=_['merge']({},_0xf0b621,_0x1bac77['options']);return _0xabe54f[_0x8714('0x5f')](_0xf0b621);}})['then'](function(_0x2561b3){if(_0x2561b3){_0x173df7=_0x2561b3[_0x8714('0x47')];if(!_0x1bac77[_0x8714('0x41')][_0x8714('0x5d')](_0x8714('0x48'))){_0xf0b621[_0x8714('0x49')]=qs[_0x8714('0x49')](_0x1bac77[_0x8714('0x41')][_0x8714('0x49')]);_0xf0b621['offset']=qs[_0x8714('0x2f')](_0x1bac77['query']['offset']);}return _0xabe54f[_0x8714('0x5f')](_0xf0b621);}})[_0x8714('0x35')](function(_0x1c206e){if(_0x1c206e){return _0x1c206e?{'count':_0x173df7,'rows':_0x1c206e}:null;}})['then'](respondWithResult(_0x3f0539,null))[_0x8714('0x2a')](handleError(_0x3f0539,null));};exports['setTags']=function(_0x20648d,_0x101f07,_0x5a5996){if(_0x20648d[_0x8714('0x57')]['id']){delete _0x20648d[_0x8714('0x57')]['id'];}return db['ZendeskConfiguration'][_0x8714('0x59')]({'where':{'id':_0x20648d[_0x8714('0x54')]['id']}})[_0x8714('0x35')](handleEntityNotFound(_0x101f07,null))['then'](function(_0x41135f){if(_0x41135f){return _0x41135f['setTags'](_0x20648d[_0x8714('0x57')][_0x8714('0x61')]||[]);}return null;})[_0x8714('0x35')](respondWithResult(_0x101f07,null))[_0x8714('0x2a')](handleError(_0x101f07,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index d24d491..5a0c90d 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 _0xf5d9=['./intZendeskConfiguration.attributes','exports','int_zendesk_configurations','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0xaf15aa,_0x3deec4){var _0x4ae048=function(_0xd06f95){while(--_0xd06f95){_0xaf15aa['push'](_0xaf15aa['shift']());}};_0x4ae048(++_0x3deec4);}(_0xf5d9,0x11a));var _0x9f5d=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xf5d9[_0x20589d];return _0x422de9;};'use strict';var _=require(_0x9f5d('0x0'));var util=require('util');var logger=require(_0x9f5d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9f5d('0x2'));var rp=require(_0x9f5d('0x3'));var fs=require('fs');var path=require(_0x9f5d('0x4'));var rimraf=require(_0x9f5d('0x5'));var config=require('../../config/environment');var attributes=require(_0x9f5d('0x6'));module[_0x9f5d('0x7')]=function(_0x51917a,_0xbc9e){return _0x51917a['define']('ZendeskConfiguration',attributes,{'tableName':_0x9f5d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x103e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','../../config/logger','api'];(function(_0x29ccfc,_0x3ffa7f){var _0x28b806=function(_0x638d90){while(--_0x638d90){_0x29ccfc['push'](_0x29ccfc['shift']());}};_0x28b806(++_0x3ffa7f);}(_0x103e,0x15d));var _0xe103=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x103e[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe103('0x0'))(_0xe103('0x1'));var moment=require(_0xe103('0x2'));var BPromise=require(_0xe103('0x3'));var rp=require(_0xe103('0x4'));var fs=require('fs');var path=require(_0xe103('0x5'));var rimraf=require(_0xe103('0x6'));var config=require(_0xe103('0x7'));var attributes=require(_0xe103('0x8'));module[_0xe103('0x9')]=function(_0x161fcd,_0x5d95c3){return _0x161fcd[_0xe103('0xa')](_0xe103('0xb'),attributes,{'tableName':_0xe103('0xc'),'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 b869ff9..758db7d 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 _0x9db7=['info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','http','then'];(function(_0x587d63,_0x53ffe7){var _0x3fa574=function(_0x28a534){while(--_0x28a534){_0x587d63['push'](_0x587d63['shift']());}};_0x3fa574(++_0x53ffe7);}(_0x9db7,0xa2));var _0x79db=function(_0x4351ae,_0x22081a){_0x4351ae=_0x4351ae-0x0;var _0x849725=_0x9db7[_0x4351ae];return _0x849725;};'use strict';var _=require(_0x79db('0x0'));var util=require('util');var moment=require(_0x79db('0x1'));var BPromise=require(_0x79db('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79db('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x79db('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x79db('0x5'));var client=jayson[_0x79db('0x6')][_0x79db('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x54bed9,_0x24b0ea,_0x30247e){return new BPromise(function(_0x55d7ff,_0x198a19){return client['request'](_0x54bed9,_0x30247e)[_0x79db('0x8')](function(_0x45e176){logger[_0x79db('0x9')](_0x79db('0xa'),_0x24b0ea,_0x79db('0xb'));logger[_0x79db('0xc')](_0x79db('0xd'),_0x24b0ea,_0x79db('0xb'),JSON['stringify'](_0x45e176));if(_0x45e176['error']){if(_0x45e176['error'][_0x79db('0xe')]===0x1f4){logger[_0x79db('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x24b0ea,_0x45e176['error'][_0x79db('0x10')]);return _0x198a19(_0x45e176[_0x79db('0xf')][_0x79db('0x10')]);}logger[_0x79db('0xf')](_0x79db('0xa'),_0x24b0ea,_0x45e176[_0x79db('0xf')][_0x79db('0x10')]);return _0x55d7ff(_0x45e176[_0x79db('0xf')][_0x79db('0x10')]);}else{logger[_0x79db('0x9')](_0x79db('0xa'),_0x24b0ea,_0x79db('0xb'));_0x55d7ff(_0x45e176[_0x79db('0x11')][_0x79db('0x10')]);}})[_0x79db('0x12')](function(_0x261853){logger['error'](_0x79db('0xa'),_0x24b0ea,_0x261853);_0x198a19(_0x261853);});});} \ No newline at end of file +var _0x9679=['result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x9679,0x8e));var _0x9967=function(_0x4872b8,_0x215e93){_0x4872b8=_0x4872b8-0x0;var _0x44f839=_0x9679[_0x4872b8];return _0x44f839;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9967('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9967('0x1'));var db=require(_0x9967('0x2'))['db'];var utils=require(_0x9967('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x9967('0x4'));var jayson=require(_0x9967('0x5'));var client=jayson[_0x9967('0x6')][_0x9967('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x268cd6,_0x2a18dc,_0x2fd223){return new BPromise(function(_0x38fb30,_0x66ff51){return client[_0x9967('0x8')](_0x268cd6,_0x2fd223)[_0x9967('0x9')](function(_0x440dac){logger[_0x9967('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2a18dc,_0x9967('0xb'));logger['debug'](_0x9967('0xc'),_0x2a18dc,_0x9967('0xb'),JSON[_0x9967('0xd')](_0x440dac));if(_0x440dac[_0x9967('0xe')]){if(_0x440dac[_0x9967('0xe')][_0x9967('0xf')]===0x1f4){logger['error'](_0x9967('0x10'),_0x2a18dc,_0x440dac[_0x9967('0xe')][_0x9967('0x11')]);return _0x66ff51(_0x440dac[_0x9967('0xe')][_0x9967('0x11')]);}logger[_0x9967('0xe')](_0x9967('0x10'),_0x2a18dc,_0x440dac[_0x9967('0xe')][_0x9967('0x11')]);return _0x38fb30(_0x440dac[_0x9967('0xe')][_0x9967('0x11')]);}else{logger[_0x9967('0xa')](_0x9967('0x10'),_0x2a18dc,'request\x20sent');_0x38fb30(_0x440dac[_0x9967('0x12')][_0x9967('0x11')]);}})[_0x9967('0x13')](function(_0x137b80){logger[_0x9967('0xe')](_0x9967('0x10'),_0x2a18dc,_0x137b80);_0x66ff51(_0x137b80);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 2bddc46..b6269a0 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 _0xb93d=['../../config/environment','get','index','/:id','isAuthenticated','show','post','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0xb93d,0xaa));var _0xdb93=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0xb93d[_0x2db12b];return _0x20990b;};'use strict';var multer=require('multer');var util=require(_0xdb93('0x0'));var path=require(_0xdb93('0x1'));var timeout=require(_0xdb93('0x2'));var express=require(_0xdb93('0x3'));var router=express[_0xdb93('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdb93('0x5'));var config=require(_0xdb93('0x6'));var controller=require('./intZendeskField.controller');router[_0xdb93('0x7')]('/',auth['isAuthenticated'](),controller[_0xdb93('0x8')]);router[_0xdb93('0x7')](_0xdb93('0x9'),auth[_0xdb93('0xa')](),controller[_0xdb93('0xb')]);router[_0xdb93('0xc')]('/',auth[_0xdb93('0xa')](),controller['create']);router['put'](_0xdb93('0x9'),auth[_0xdb93('0xa')](),controller['update']);router[_0xdb93('0xd')](_0xdb93('0x9'),auth[_0xdb93('0xa')](),controller[_0xdb93('0xe')]);module[_0xdb93('0xf')]=router; \ No newline at end of file +var _0x6b7b=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','index','show','post','isAuthenticated','create','put','/:id','update','delete','destroy'];(function(_0x262f44,_0x3847ba){var _0x33b27c=function(_0x5db154){while(--_0x5db154){_0x262f44['push'](_0x262f44['shift']());}};_0x33b27c(++_0x3847ba);}(_0x6b7b,0x7f));var _0xb6b7=function(_0x257def,_0x5a5067){_0x257def=_0x257def-0x0;var _0x1630e6=_0x6b7b[_0x257def];return _0x1630e6;};'use strict';var multer=require(_0xb6b7('0x0'));var util=require(_0xb6b7('0x1'));var path=require(_0xb6b7('0x2'));var timeout=require(_0xb6b7('0x3'));var express=require(_0xb6b7('0x4'));var router=express[_0xb6b7('0x5')]();var auth=require(_0xb6b7('0x6'));var interaction=require(_0xb6b7('0x7'));var config=require(_0xb6b7('0x8'));var controller=require(_0xb6b7('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xb6b7('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb6b7('0xb')]);router[_0xb6b7('0xc')]('/',auth[_0xb6b7('0xd')](),controller[_0xb6b7('0xe')]);router[_0xb6b7('0xf')](_0xb6b7('0x10'),auth['isAuthenticated'](),controller[_0xb6b7('0x11')]);router[_0xb6b7('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xb6b7('0x13')]);module[_0xb6b7('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 88fd10f..abf87b8 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 _0x7531=['keyValue','string','STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x386e50,_0x53a4c2){var _0x742f55=function(_0x18828c){while(--_0x18828c){_0x386e50['push'](_0x386e50['shift']());}};_0x742f55(++_0x53a4c2);}(_0x7531,0x69));var _0x1753=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7531[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x1753('0x0'));module[_0x1753('0x1')]={'type':{'type':Sequelize[_0x1753('0x2')]('string','variable','customVariable',_0x1753('0x3')),'defaultValue':_0x1753('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1753('0x5')]},'keyType':{'type':Sequelize[_0x1753('0x2')]('string',_0x1753('0x6'),_0x1753('0x7'))},'keyContent':{'type':Sequelize[_0x1753('0x5')]},'idField':{'type':Sequelize[_0x1753('0x5')]},'nameField':{'type':Sequelize[_0x1753('0x5')]},'customField':{'type':Sequelize[_0x1753('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1753('0x5')]}}; \ No newline at end of file +var _0xb8b7=['customVariable','keyValue','string','STRING','ENUM','BOOLEAN'];(function(_0x2340d1,_0x522014){var _0x467e81=function(_0x3ea90f){while(--_0x3ea90f){_0x2340d1['push'](_0x2340d1['shift']());}};_0x467e81(++_0x522014);}(_0xb8b7,0x114));var _0x7b8b=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xb8b7[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x7b8b('0x0'),_0x7b8b('0x1')),'defaultValue':_0x7b8b('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7b8b('0x3')]},'keyType':{'type':Sequelize[_0x7b8b('0x4')]('string','variable',_0x7b8b('0x0'))},'keyContent':{'type':Sequelize[_0x7b8b('0x3')]},'idField':{'type':Sequelize[_0x7b8b('0x3')]},'nameField':{'type':Sequelize[_0x7b8b('0x3')]},'customField':{'type':Sequelize[_0x7b8b('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7b8b('0x3')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 59a0c59..d2d1965 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 _0xd380=['limit','set','reject','save','update','then','stack','name','send','map','ZendeskField','fieldName','type','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset'];(function(_0x1e53ec,_0x4b4182){var _0x15ff6b=function(_0x43ffb6){while(--_0x43ffb6){_0x1e53ec['push'](_0x1e53ec['shift']());}};_0x15ff6b(++_0x4b4182);}(_0xd380,0x1d3));var _0x0d38=function(_0x1061aa,_0x4c3786){_0x1061aa=_0x1061aa-0x0;var _0x1a7f84=_0xd380[_0x1061aa];return _0x1a7f84;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0d38('0x0'));var rimraf=require(_0x0d38('0x1'));var zipdir=require(_0x0d38('0x2'));var jsonpatch=require(_0x0d38('0x3'));var rp=require(_0x0d38('0x4'));var moment=require(_0x0d38('0x5'));var BPromise=require(_0x0d38('0x6'));var Mustache=require(_0x0d38('0x7'));var util=require('util');var path=require(_0x0d38('0x8'));var sox=require(_0x0d38('0x9'));var csv=require(_0x0d38('0xa'));var ejs=require(_0x0d38('0xb'));var fs=require('fs');var _=require(_0x0d38('0xc'));var squel=require(_0x0d38('0xd'));var crypto=require('crypto');var jsforce=require(_0x0d38('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0d38('0xa'));var querystring=require(_0x0d38('0xf'));var Papa=require(_0x0d38('0x10'));var Redis=require(_0x0d38('0x11'));var authService=require(_0x0d38('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0d38('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0d38('0x14'));var utils=require(_0x0d38('0x15'));var config=require(_0x0d38('0x16'));var db=require(_0x0d38('0x17'))['db'];function respondWithStatusCode(_0x22455d,_0x3fd538){_0x3fd538=_0x3fd538||0xcc;return function(_0x4f7f67){if(_0x4f7f67){return _0x22455d[_0x0d38('0x18')](_0x3fd538);}return _0x22455d['status'](_0x3fd538)[_0x0d38('0x19')]();};}function respondWithResult(_0x1048de,_0x549978){_0x549978=_0x549978||0xc8;return function(_0x45ad32){if(_0x45ad32){return _0x1048de[_0x0d38('0x1a')](_0x549978)[_0x0d38('0x1b')](_0x45ad32);}};}function respondWithFilteredResult(_0x6efa6f,_0x5cd245){return function(_0x26c584){if(_0x26c584){var _0x491a98=_0x26c584[_0x0d38('0x1c')],_0x298861=_0x5cd245[_0x0d38('0x1d')],_0x32f136=_0x5cd245[_0x0d38('0x1d')]+_0x5cd245[_0x0d38('0x1e')],_0x8e3dcf;if(_0x32f136>=_0x491a98){_0x32f136=_0x491a98;_0x8e3dcf=0xc8;}else{_0x8e3dcf=0xce;}_0x6efa6f[_0x0d38('0x1a')](_0x8e3dcf);return _0x6efa6f[_0x0d38('0x1f')]('Content-Range',_0x298861+'-'+_0x32f136+'/'+_0x491a98)['json'](_0x26c584);}return null;};}function patchUpdates(_0x369007){return function(_0x371d3c){try{jsonpatch['apply'](_0x371d3c,_0x369007,!![]);}catch(_0x1552f9){return BPromise[_0x0d38('0x20')](_0x1552f9);}return _0x371d3c[_0x0d38('0x21')]();};}function saveUpdates(_0x20ecfc,_0x15879b){return function(_0x574da6){if(_0x574da6){return _0x574da6[_0x0d38('0x22')](_0x20ecfc)[_0x0d38('0x23')](function(_0x352bc1){return _0x352bc1;});}return null;};}function removeEntity(_0x2966e3,_0x11343d){return function(_0x1fe6c7){if(_0x1fe6c7){return _0x1fe6c7['destroy']()['then'](function(){_0x2966e3[_0x0d38('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x473dbf,_0x2dd757){return function(_0x5c21d3){if(!_0x5c21d3){_0x473dbf[_0x0d38('0x18')](0x194);}return _0x5c21d3;};}function handleError(_0x21c5da,_0x32fa14){_0x32fa14=_0x32fa14||0x1f4;return function(_0x3e6a29){logger['error'](_0x3e6a29[_0x0d38('0x24')]);if(_0x3e6a29[_0x0d38('0x25')]){delete _0x3e6a29[_0x0d38('0x25')];}_0x21c5da['status'](_0x32fa14)[_0x0d38('0x26')](_0x3e6a29);};}exports['index']=function(_0x2e2968,_0x3e371a){var _0x6d3109={},_0x571aef={},_0x2b6709={'count':0x0,'rows':[]};var _0x28961c=_[_0x0d38('0x27')](db[_0x0d38('0x28')]['rawAttributes'],function(_0x26af15){return{'name':_0x26af15[_0x0d38('0x29')],'type':_0x26af15[_0x0d38('0x2a')]['key']};});_0x571aef[_0x0d38('0x2b')]=_[_0x0d38('0x27')](_0x28961c,_0x0d38('0x25'));_0x571aef[_0x0d38('0x2c')]=_[_0x0d38('0x2d')](_0x2e2968[_0x0d38('0x2c')]);_0x571aef[_0x0d38('0x2e')]=_['intersection'](_0x571aef[_0x0d38('0x2b')],_0x571aef[_0x0d38('0x2c')]);_0x6d3109[_0x0d38('0x2f')]=_['intersection'](_0x571aef[_0x0d38('0x2b')],qs['fields'](_0x2e2968[_0x0d38('0x2c')][_0x0d38('0x30')]));_0x6d3109[_0x0d38('0x2f')]=_0x6d3109[_0x0d38('0x2f')][_0x0d38('0x31')]?_0x6d3109['attributes']:_0x571aef[_0x0d38('0x2b')];if(!_0x2e2968['query']['hasOwnProperty'](_0x0d38('0x32'))){_0x6d3109['limit']=qs[_0x0d38('0x1e')](_0x2e2968[_0x0d38('0x2c')]['limit']);_0x6d3109[_0x0d38('0x1d')]=qs['offset'](_0x2e2968['query']['offset']);}_0x6d3109[_0x0d38('0x33')]=qs[_0x0d38('0x34')](_0x2e2968[_0x0d38('0x2c')][_0x0d38('0x34')]);_0x6d3109['where']=qs[_0x0d38('0x2e')](_[_0x0d38('0x35')](_0x2e2968[_0x0d38('0x2c')],_0x571aef['filters']),_0x28961c);if(_0x2e2968[_0x0d38('0x2c')][_0x0d38('0x36')]){_0x6d3109['where']=_[_0x0d38('0x37')](_0x6d3109[_0x0d38('0x38')],{'$or':_[_0x0d38('0x27')](_0x28961c,function(_0x1b8a8a){if(_0x1b8a8a[_0x0d38('0x2a')]!==_0x0d38('0x39')){var _0x122af8={};_0x122af8[_0x1b8a8a[_0x0d38('0x25')]]={'$like':'%'+_0x2e2968[_0x0d38('0x2c')]['filter']+'%'};return _0x122af8;}})});}_0x6d3109=_[_0x0d38('0x37')]({},_0x6d3109,_0x2e2968[_0x0d38('0x3a')]);var _0x2a3d97={'where':_0x6d3109[_0x0d38('0x38')]};return db['ZendeskField'][_0x0d38('0x1c')](_0x2a3d97)[_0x0d38('0x23')](function(_0x1be83d){_0x2b6709[_0x0d38('0x1c')]=_0x1be83d;if(_0x2e2968[_0x0d38('0x2c')]['includeAll']){_0x6d3109[_0x0d38('0x3b')]=[{'all':!![]}];}return db[_0x0d38('0x28')][_0x0d38('0x3c')](_0x6d3109);})[_0x0d38('0x23')](function(_0x12f4d5){_0x2b6709[_0x0d38('0x3d')]=_0x12f4d5;return _0x2b6709;})[_0x0d38('0x23')](respondWithFilteredResult(_0x3e371a,_0x6d3109))[_0x0d38('0x3e')](handleError(_0x3e371a,null));};exports[_0x0d38('0x3f')]=function(_0xeecebf,_0x203185){var _0x3c8648={'raw':!![],'where':{'id':_0xeecebf[_0x0d38('0x40')]['id']}},_0x25b6c4={};_0x25b6c4[_0x0d38('0x2b')]=_[_0x0d38('0x2d')](db[_0x0d38('0x28')][_0x0d38('0x41')]);_0x25b6c4[_0x0d38('0x2c')]=_['keys'](_0xeecebf[_0x0d38('0x2c')]);_0x25b6c4[_0x0d38('0x2e')]=_[_0x0d38('0x42')](_0x25b6c4[_0x0d38('0x2b')],_0x25b6c4['query']);_0x3c8648[_0x0d38('0x2f')]=_[_0x0d38('0x42')](_0x25b6c4[_0x0d38('0x2b')],qs[_0x0d38('0x30')](_0xeecebf[_0x0d38('0x2c')][_0x0d38('0x30')]));_0x3c8648[_0x0d38('0x2f')]=_0x3c8648['attributes'][_0x0d38('0x31')]?_0x3c8648[_0x0d38('0x2f')]:_0x25b6c4['model'];if(_0xeecebf[_0x0d38('0x2c')][_0x0d38('0x43')]){_0x3c8648[_0x0d38('0x3b')]=[{'all':!![]}];}_0x3c8648=_[_0x0d38('0x37')]({},_0x3c8648,_0xeecebf[_0x0d38('0x3a')]);return db[_0x0d38('0x28')][_0x0d38('0x44')](_0x3c8648)[_0x0d38('0x23')](handleEntityNotFound(_0x203185,null))[_0x0d38('0x23')](respondWithResult(_0x203185,null))[_0x0d38('0x3e')](handleError(_0x203185,null));};exports[_0x0d38('0x45')]=function(_0x108e58,_0x2c569f){return db[_0x0d38('0x28')][_0x0d38('0x45')](_0x108e58[_0x0d38('0x46')],{})['then'](respondWithResult(_0x2c569f,0xc9))[_0x0d38('0x3e')](handleError(_0x2c569f,null));};exports[_0x0d38('0x22')]=function(_0x1ac08d,_0xa3b09b){if(_0x1ac08d['body']['id']){delete _0x1ac08d[_0x0d38('0x46')]['id'];}return db['ZendeskField'][_0x0d38('0x44')]({'where':{'id':_0x1ac08d['params']['id']}})[_0x0d38('0x23')](handleEntityNotFound(_0xa3b09b,null))[_0x0d38('0x23')](saveUpdates(_0x1ac08d[_0x0d38('0x46')],null))['then'](respondWithResult(_0xa3b09b,null))[_0x0d38('0x3e')](handleError(_0xa3b09b,null));};exports['destroy']=function(_0x125d17,_0x4c8058){return db[_0x0d38('0x28')][_0x0d38('0x44')]({'where':{'id':_0x125d17[_0x0d38('0x40')]['id']}})[_0x0d38('0x23')](handleEntityNotFound(_0x4c8058,null))[_0x0d38('0x23')](removeEntity(_0x4c8058,null))[_0x0d38('0x3e')](handleError(_0x4c8058,null));}; \ No newline at end of file +var _0x5a34=['reject','destroy','error','stack','name','send','index','map','ZendeskField','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','count','includeAll','include','findAll','rows','then','catch','show','params','rawAttributes','options','create','body','update','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x5a34,0x1ec));var _0x45a3=function(_0x5b90e4,_0x58ce18){_0x5b90e4=_0x5b90e4-0x0;var _0x5e6c65=_0x5a34[_0x5b90e4];return _0x5e6c65;};'use strict';var pdf=require(_0x45a3('0x0'));var emlformat=require(_0x45a3('0x1'));var rimraf=require(_0x45a3('0x2'));var zipdir=require(_0x45a3('0x3'));var jsonpatch=require(_0x45a3('0x4'));var rp=require(_0x45a3('0x5'));var moment=require(_0x45a3('0x6'));var BPromise=require(_0x45a3('0x7'));var Mustache=require(_0x45a3('0x8'));var util=require(_0x45a3('0x9'));var path=require('path');var sox=require(_0x45a3('0xa'));var csv=require(_0x45a3('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x45a3('0xc'));var crypto=require('crypto');var jsforce=require(_0x45a3('0xd'));var deskjs=require(_0x45a3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x45a3('0xf'));var Papa=require(_0x45a3('0x10'));var Redis=require(_0x45a3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x45a3('0x12'));var as=require(_0x45a3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45a3('0x14'))('api');var utils=require(_0x45a3('0x15'));var config=require(_0x45a3('0x16'));var db=require(_0x45a3('0x17'))['db'];function respondWithStatusCode(_0x5e6e92,_0x282ee2){_0x282ee2=_0x282ee2||0xcc;return function(_0x4614d0){if(_0x4614d0){return _0x5e6e92[_0x45a3('0x18')](_0x282ee2);}return _0x5e6e92[_0x45a3('0x19')](_0x282ee2)[_0x45a3('0x1a')]();};}function respondWithResult(_0x456768,_0x4cc565){_0x4cc565=_0x4cc565||0xc8;return function(_0x1519e9){if(_0x1519e9){return _0x456768['status'](_0x4cc565)[_0x45a3('0x1b')](_0x1519e9);}};}function respondWithFilteredResult(_0xde112e,_0x219b2f){return function(_0x2a6fb0){if(_0x2a6fb0){var _0x349a8a=_0x2a6fb0['count'],_0x2a0f85=_0x219b2f[_0x45a3('0x1c')],_0x275b96=_0x219b2f['offset']+_0x219b2f[_0x45a3('0x1d')],_0x5bce35;if(_0x275b96>=_0x349a8a){_0x275b96=_0x349a8a;_0x5bce35=0xc8;}else{_0x5bce35=0xce;}_0xde112e['status'](_0x5bce35);return _0xde112e[_0x45a3('0x1e')](_0x45a3('0x1f'),_0x2a0f85+'-'+_0x275b96+'/'+_0x349a8a)['json'](_0x2a6fb0);}return null;};}function patchUpdates(_0x70df95){return function(_0x13e631){try{jsonpatch[_0x45a3('0x20')](_0x13e631,_0x70df95,!![]);}catch(_0xf1784a){return BPromise[_0x45a3('0x21')](_0xf1784a);}return _0x13e631['save']();};}function saveUpdates(_0x8524f3,_0x1e979a){return function(_0x1638d0){if(_0x1638d0){return _0x1638d0['update'](_0x8524f3)['then'](function(_0x1d547d){return _0x1d547d;});}return null;};}function removeEntity(_0x342d91,_0x42d17b){return function(_0x45e8c2){if(_0x45e8c2){return _0x45e8c2[_0x45a3('0x22')]()['then'](function(){_0x342d91[_0x45a3('0x19')](0xcc)[_0x45a3('0x1a')]();});}};}function handleEntityNotFound(_0x36bd52,_0x52aae4){return function(_0x2f76da){if(!_0x2f76da){_0x36bd52[_0x45a3('0x18')](0x194);}return _0x2f76da;};}function handleError(_0x43912b,_0x52b716){_0x52b716=_0x52b716||0x1f4;return function(_0x196ca5){logger[_0x45a3('0x23')](_0x196ca5[_0x45a3('0x24')]);if(_0x196ca5[_0x45a3('0x25')]){delete _0x196ca5[_0x45a3('0x25')];}_0x43912b[_0x45a3('0x19')](_0x52b716)[_0x45a3('0x26')](_0x196ca5);};}exports[_0x45a3('0x27')]=function(_0x4d4d34,_0x1ee644){var _0x548120={},_0xf91705={},_0x572ab1={'count':0x0,'rows':[]};var _0x2a5157=_[_0x45a3('0x28')](db[_0x45a3('0x29')]['rawAttributes'],function(_0x2d3a99){return{'name':_0x2d3a99['fieldName'],'type':_0x2d3a99['type'][_0x45a3('0x2a')]};});_0xf91705['model']=_[_0x45a3('0x28')](_0x2a5157,_0x45a3('0x25'));_0xf91705['query']=_[_0x45a3('0x2b')](_0x4d4d34[_0x45a3('0x2c')]);_0xf91705[_0x45a3('0x2d')]=_[_0x45a3('0x2e')](_0xf91705[_0x45a3('0x2f')],_0xf91705[_0x45a3('0x2c')]);_0x548120[_0x45a3('0x30')]=_[_0x45a3('0x2e')](_0xf91705[_0x45a3('0x2f')],qs[_0x45a3('0x31')](_0x4d4d34['query'][_0x45a3('0x31')]));_0x548120[_0x45a3('0x30')]=_0x548120[_0x45a3('0x30')][_0x45a3('0x32')]?_0x548120[_0x45a3('0x30')]:_0xf91705[_0x45a3('0x2f')];if(!_0x4d4d34['query'][_0x45a3('0x33')](_0x45a3('0x34'))){_0x548120['limit']=qs[_0x45a3('0x1d')](_0x4d4d34[_0x45a3('0x2c')][_0x45a3('0x1d')]);_0x548120[_0x45a3('0x1c')]=qs[_0x45a3('0x1c')](_0x4d4d34[_0x45a3('0x2c')][_0x45a3('0x1c')]);}_0x548120[_0x45a3('0x35')]=qs['sort'](_0x4d4d34[_0x45a3('0x2c')][_0x45a3('0x36')]);_0x548120['where']=qs[_0x45a3('0x2d')](_[_0x45a3('0x37')](_0x4d4d34[_0x45a3('0x2c')],_0xf91705[_0x45a3('0x2d')]),_0x2a5157);if(_0x4d4d34[_0x45a3('0x2c')][_0x45a3('0x38')]){_0x548120[_0x45a3('0x39')]=_[_0x45a3('0x3a')](_0x548120[_0x45a3('0x39')],{'$or':_[_0x45a3('0x28')](_0x2a5157,function(_0x152262){if(_0x152262[_0x45a3('0x3b')]!=='VIRTUAL'){var _0x481d21={};_0x481d21[_0x152262[_0x45a3('0x25')]]={'$like':'%'+_0x4d4d34['query'][_0x45a3('0x38')]+'%'};return _0x481d21;}})});}_0x548120=_[_0x45a3('0x3a')]({},_0x548120,_0x4d4d34['options']);var _0xace473={'where':_0x548120['where']};return db['ZendeskField']['count'](_0xace473)['then'](function(_0x366ab1){_0x572ab1[_0x45a3('0x3c')]=_0x366ab1;if(_0x4d4d34[_0x45a3('0x2c')][_0x45a3('0x3d')]){_0x548120[_0x45a3('0x3e')]=[{'all':!![]}];}return db['ZendeskField'][_0x45a3('0x3f')](_0x548120);})['then'](function(_0x505e0a){_0x572ab1[_0x45a3('0x40')]=_0x505e0a;return _0x572ab1;})[_0x45a3('0x41')](respondWithFilteredResult(_0x1ee644,_0x548120))[_0x45a3('0x42')](handleError(_0x1ee644,null));};exports[_0x45a3('0x43')]=function(_0xed5029,_0x2878e7){var _0x4566fd={'raw':!![],'where':{'id':_0xed5029[_0x45a3('0x44')]['id']}},_0x2eaec2={};_0x2eaec2[_0x45a3('0x2f')]=_[_0x45a3('0x2b')](db[_0x45a3('0x29')][_0x45a3('0x45')]);_0x2eaec2[_0x45a3('0x2c')]=_[_0x45a3('0x2b')](_0xed5029[_0x45a3('0x2c')]);_0x2eaec2['filters']=_[_0x45a3('0x2e')](_0x2eaec2[_0x45a3('0x2f')],_0x2eaec2[_0x45a3('0x2c')]);_0x4566fd[_0x45a3('0x30')]=_[_0x45a3('0x2e')](_0x2eaec2[_0x45a3('0x2f')],qs[_0x45a3('0x31')](_0xed5029['query']['fields']));_0x4566fd['attributes']=_0x4566fd[_0x45a3('0x30')]['length']?_0x4566fd[_0x45a3('0x30')]:_0x2eaec2[_0x45a3('0x2f')];if(_0xed5029[_0x45a3('0x2c')][_0x45a3('0x3d')]){_0x4566fd[_0x45a3('0x3e')]=[{'all':!![]}];}_0x4566fd=_['merge']({},_0x4566fd,_0xed5029[_0x45a3('0x46')]);return db[_0x45a3('0x29')]['find'](_0x4566fd)[_0x45a3('0x41')](handleEntityNotFound(_0x2878e7,null))[_0x45a3('0x41')](respondWithResult(_0x2878e7,null))[_0x45a3('0x42')](handleError(_0x2878e7,null));};exports[_0x45a3('0x47')]=function(_0x52aa18,_0x13d88b){return db[_0x45a3('0x29')][_0x45a3('0x47')](_0x52aa18[_0x45a3('0x48')],{})[_0x45a3('0x41')](respondWithResult(_0x13d88b,0xc9))[_0x45a3('0x42')](handleError(_0x13d88b,null));};exports[_0x45a3('0x49')]=function(_0x231935,_0x2bfb01){if(_0x231935[_0x45a3('0x48')]['id']){delete _0x231935[_0x45a3('0x48')]['id'];}return db[_0x45a3('0x29')][_0x45a3('0x4a')]({'where':{'id':_0x231935[_0x45a3('0x44')]['id']}})['then'](handleEntityNotFound(_0x2bfb01,null))[_0x45a3('0x41')](saveUpdates(_0x231935['body'],null))[_0x45a3('0x41')](respondWithResult(_0x2bfb01,null))[_0x45a3('0x42')](handleError(_0x2bfb01,null));};exports[_0x45a3('0x22')]=function(_0x393545,_0x34a640){return db[_0x45a3('0x29')][_0x45a3('0x4a')]({'where':{'id':_0x393545[_0x45a3('0x44')]['id']}})[_0x45a3('0x41')](handleEntityNotFound(_0x34a640,null))[_0x45a3('0x41')](removeEntity(_0x34a640,null))[_0x45a3('0x42')](handleError(_0x34a640,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 384a3ff..a7f96c1 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 _0x69d3=['moment','bluebird','rimraf','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x69d3,0xda));var _0x369d=function(_0x25b92d,_0x168692){_0x25b92d=_0x25b92d-0x0;var _0x75e703=_0x69d3[_0x25b92d];return _0x75e703;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var logger=require(_0x369d('0x2'))('api');var moment=require(_0x369d('0x3'));var BPromise=require(_0x369d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x369d('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0x369d('0x6')]=function(_0x2f2a53,_0x18c9f1){return _0x2f2a53[_0x369d('0x7')](_0x369d('0x8'),attributes,{'tableName':_0x369d('0x9'),'paranoid':![],'indexes':[{'name':_0x369d('0xa'),'fields':[_0x369d('0xb'),_0x369d('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb58b=['exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','util','../../config/logger','api','bluebird','request-promise','rimraf','./intZendeskField.attributes'];(function(_0x113c9d,_0x471e81){var _0x5e1ec3=function(_0x153479){while(--_0x153479){_0x113c9d['push'](_0x113c9d['shift']());}};_0x5e1ec3(++_0x471e81);}(_0xb58b,0x1f1));var _0xbb58=function(_0x2925a9,_0x4de960){_0x2925a9=_0x2925a9-0x0;var _0x1a380a=_0xb58b[_0x2925a9];return _0x1a380a;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var logger=require(_0xbb58('0x1'))(_0xbb58('0x2'));var moment=require('moment');var BPromise=require(_0xbb58('0x3'));var rp=require(_0xbb58('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb58('0x5'));var config=require('../../config/environment');var attributes=require(_0xbb58('0x6'));module[_0xbb58('0x7')]=function(_0x33fe85,_0x5cf8b1){return _0x33fe85[_0xbb58('0x8')](_0xbb58('0x9'),attributes,{'tableName':_0xbb58('0xa'),'paranoid':![],'indexes':[{'name':_0xbb58('0xb'),'fields':[_0xbb58('0xc'),_0xbb58('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 3bc6513..edf4646 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 _0x3b23=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0xeb54bb,_0x2d8002){var _0x4d430f=function(_0x16bdd3){while(--_0x16bdd3){_0xeb54bb['push'](_0xeb54bb['shift']());}};_0x4d430f(++_0x2d8002);}(_0x3b23,0x8c));var _0x33b2=function(_0x3ebccf,_0x594228){_0x3ebccf=_0x3ebccf-0x0;var _0x37705f=_0x3b23[_0x3ebccf];return _0x37705f;};'use strict';var _=require(_0x33b2('0x0'));var util=require('util');var moment=require(_0x33b2('0x1'));var BPromise=require(_0x33b2('0x2'));var rs=require(_0x33b2('0x3'));var fs=require('fs');var Redis=require(_0x33b2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x33b2('0x5'));var logger=require(_0x33b2('0x6'))(_0x33b2('0x7'));var config=require(_0x33b2('0x8'));var jayson=require(_0x33b2('0x9'));var client=jayson[_0x33b2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f1320,_0x6c6dcc,_0x17fd06){return new BPromise(function(_0x4e2767,_0x5aebea){return client[_0x33b2('0xb')](_0x3f1320,_0x17fd06)[_0x33b2('0xc')](function(_0x5b2f4e){logger[_0x33b2('0xd')]('ZendeskField,\x20%s,\x20%s',_0x6c6dcc,'request\x20sent');logger[_0x33b2('0xe')](_0x33b2('0xf'),_0x6c6dcc,_0x33b2('0x10'),JSON[_0x33b2('0x11')](_0x5b2f4e));if(_0x5b2f4e['error']){if(_0x5b2f4e[_0x33b2('0x12')][_0x33b2('0x13')]===0x1f4){logger[_0x33b2('0x12')](_0x33b2('0x14'),_0x6c6dcc,_0x5b2f4e[_0x33b2('0x12')][_0x33b2('0x15')]);return _0x5aebea(_0x5b2f4e[_0x33b2('0x12')]['message']);}logger[_0x33b2('0x12')](_0x33b2('0x14'),_0x6c6dcc,_0x5b2f4e[_0x33b2('0x12')][_0x33b2('0x15')]);return _0x4e2767(_0x5b2f4e['error']['message']);}else{logger[_0x33b2('0xd')](_0x33b2('0x14'),_0x6c6dcc,_0x33b2('0x10'));_0x4e2767(_0x5b2f4e[_0x33b2('0x16')][_0x33b2('0x15')]);}})[_0x33b2('0x17')](function(_0xcd26e9){logger[_0x33b2('0x12')](_0x33b2('0x14'),_0x6c6dcc,_0xcd26e9);_0x5aebea(_0xcd26e9);});});} \ No newline at end of file +var _0x75d9=['then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x36e8d7,_0x4474dc){var _0x50f768=function(_0xc02a72){while(--_0xc02a72){_0x36e8d7['push'](_0x36e8d7['shift']());}};_0x50f768(++_0x4474dc);}(_0x75d9,0xf1));var _0x975d=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0x75d9[_0x1e6659];return _0x4d16e4;};'use strict';var _=require(_0x975d('0x0'));var util=require(_0x975d('0x1'));var moment=require(_0x975d('0x2'));var BPromise=require(_0x975d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x975d('0x4'))['db'];var utils=require(_0x975d('0x5'));var logger=require('../../config/logger')(_0x975d('0x6'));var config=require(_0x975d('0x7'));var jayson=require(_0x975d('0x8'));var client=jayson[_0x975d('0x9')][_0x975d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d3afd,_0x320420,_0x570687){return new BPromise(function(_0x455e85,_0x370431){return client[_0x975d('0xb')](_0x2d3afd,_0x570687)[_0x975d('0xc')](function(_0x31f3c6){logger[_0x975d('0xd')](_0x975d('0xe'),_0x320420,_0x975d('0xf'));logger[_0x975d('0x10')](_0x975d('0x11'),_0x320420,_0x975d('0xf'),JSON[_0x975d('0x12')](_0x31f3c6));if(_0x31f3c6[_0x975d('0x13')]){if(_0x31f3c6[_0x975d('0x13')][_0x975d('0x14')]===0x1f4){logger['error'](_0x975d('0xe'),_0x320420,_0x31f3c6[_0x975d('0x13')][_0x975d('0x15')]);return _0x370431(_0x31f3c6[_0x975d('0x13')][_0x975d('0x15')]);}logger[_0x975d('0x13')](_0x975d('0xe'),_0x320420,_0x31f3c6['error'][_0x975d('0x15')]);return _0x455e85(_0x31f3c6[_0x975d('0x13')][_0x975d('0x15')]);}else{logger[_0x975d('0xd')](_0x975d('0xe'),_0x320420,_0x975d('0xf'));_0x455e85(_0x31f3c6[_0x975d('0x16')][_0x975d('0x15')]);}})['catch'](function(_0x30e7c2){logger[_0x975d('0x13')](_0x975d('0xe'),_0x320420,_0x30e7c2);_0x370431(_0x30e7c2);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 7d70e08..d33856c 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 _0xe61a=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./intZohoAccount.controller','get'];(function(_0x2cc8bb,_0x5f2607){var _0x140e40=function(_0x80d96d){while(--_0x80d96d){_0x2cc8bb['push'](_0x2cc8bb['shift']());}};_0x140e40(++_0x5f2607);}(_0xe61a,0xb0));var _0xae61=function(_0x356f1d,_0x202df6){_0x356f1d=_0x356f1d-0x0;var _0x24b7e2=_0xe61a[_0x356f1d];return _0x24b7e2;};'use strict';var multer=require(_0xae61('0x0'));var util=require('util');var path=require(_0xae61('0x1'));var timeout=require(_0xae61('0x2'));var express=require(_0xae61('0x3'));var router=express[_0xae61('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xae61('0x5'));var config=require('../../config/environment');var controller=require(_0xae61('0x6'));router[_0xae61('0x7')]('/',auth[_0xae61('0x8')](),controller[_0xae61('0x9')]);router[_0xae61('0x7')](_0xae61('0xa'),auth[_0xae61('0x8')](),controller[_0xae61('0xb')]);router[_0xae61('0x7')](_0xae61('0xc'),auth[_0xae61('0x8')](),controller[_0xae61('0xd')]);router[_0xae61('0x7')]('/:id/fields',auth[_0xae61('0x8')](),controller[_0xae61('0xe')]);router[_0xae61('0xf')]('/',auth[_0xae61('0x8')](),controller[_0xae61('0x10')]);router[_0xae61('0xf')](_0xae61('0xc'),auth[_0xae61('0x8')](),controller[_0xae61('0x11')]);router[_0xae61('0x12')](_0xae61('0xa'),auth[_0xae61('0x8')](),controller[_0xae61('0x13')]);router[_0xae61('0x14')](_0xae61('0xa'),auth[_0xae61('0x8')](),controller[_0xae61('0x15')]);module[_0xae61('0x16')]=router; \ No newline at end of file +var _0xcaa1=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','delete','exports','util','connect-timeout','express'];(function(_0x1f5ab3,_0x2d2473){var _0x2bd0d7=function(_0x41c41b){while(--_0x41c41b){_0x1f5ab3['push'](_0x1f5ab3['shift']());}};_0x2bd0d7(++_0x2d2473);}(_0xcaa1,0x1bf));var _0x1caa=function(_0x425770,_0x1b6905){_0x425770=_0x425770-0x0;var _0x11e174=_0xcaa1[_0x425770];return _0x11e174;};'use strict';var multer=require('multer');var util=require(_0x1caa('0x0'));var path=require('path');var timeout=require(_0x1caa('0x1'));var express=require(_0x1caa('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1caa('0x3'));var config=require(_0x1caa('0x4'));var controller=require(_0x1caa('0x5'));router[_0x1caa('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1caa('0x6')](_0x1caa('0x7'),auth[_0x1caa('0x8')](),controller['show']);router[_0x1caa('0x6')](_0x1caa('0x9'),auth[_0x1caa('0x8')](),controller[_0x1caa('0xa')]);router['get'](_0x1caa('0xb'),auth[_0x1caa('0x8')](),controller['getFields']);router[_0x1caa('0xc')]('/',auth[_0x1caa('0x8')](),controller[_0x1caa('0xd')]);router[_0x1caa('0xc')](_0x1caa('0x9'),auth[_0x1caa('0x8')](),controller[_0x1caa('0xe')]);router['put'](_0x1caa('0x7'),auth[_0x1caa('0x8')](),controller[_0x1caa('0xf')]);router[_0x1caa('0x10')](_0x1caa('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x1caa('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 9a34ea1..576d853 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 _0x56fa=['exports','STRING'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0x56fa,0x12e));var _0xa56f=function(_0x68f2a0,_0xc6b752){_0x68f2a0=_0x68f2a0-0x0;var _0x1671e9=_0x56fa[_0x68f2a0];return _0x1671e9;};'use strict';var Sequelize=require('sequelize');module[_0xa56f('0x0')]={'name':{'type':Sequelize[_0xa56f('0x1')]},'description':{'type':Sequelize[_0xa56f('0x1')]},'host':{'type':Sequelize[_0xa56f('0x1')]},'zone':{'type':Sequelize[_0xa56f('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xa56f('0x1')]},'serverUrl':{'type':Sequelize[_0xa56f('0x1')]},'code':{'type':Sequelize[_0xa56f('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5f65=['STRING','sequelize','exports'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0x5f65,0xd9));var _0x55f6=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x5f65[_0x12fc8d];return _0x3f9d04;};'use strict';var Sequelize=require(_0x55f6('0x0'));module[_0x55f6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x55f6('0x2')]},'host':{'type':Sequelize[_0x55f6('0x2')]},'zone':{'type':Sequelize[_0x55f6('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x55f6('0x2')]},'serverUrl':{'type':Sequelize[_0x55f6('0x2')]},'code':{'type':Sequelize[_0x55f6('0x2')]},'refreshToken':{'type':Sequelize[_0x55f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 210203a..3939bbe 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 _0x928f=['WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','display_label','custom_field','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','destroy','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','show','params','create','body','find','findOne','keys','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','clientSecret','serverUrl','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x928f,0x98));var _0xf928=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x928f[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xf928('0x0'));var emlformat=require(_0xf928('0x1'));var rimraf=require(_0xf928('0x2'));var zipdir=require(_0xf928('0x3'));var jsonpatch=require(_0xf928('0x4'));var rp=require(_0xf928('0x5'));var moment=require(_0xf928('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xf928('0x7'));var util=require(_0xf928('0x8'));var path=require(_0xf928('0x9'));var sox=require(_0xf928('0xa'));var csv=require(_0xf928('0xb'));var ejs=require(_0xf928('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf928('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf928('0xe'));var toCsv=require(_0xf928('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf928('0xf'));var authService=require(_0xf928('0x10'));var qs=require(_0xf928('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf928('0x12'));var logger=require(_0xf928('0x13'))(_0xf928('0x14'));var utils=require(_0xf928('0x15'));var config=require(_0xf928('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf928('0x17'));var jayson=require(_0xf928('0x18'));var client=jayson[_0xf928('0x19')][_0xf928('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x107db1,_0x38fe32,_0xb8a245){if(_0xb8a245){var _0x148773=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x148773[_0xf928('0x1b')](_0x38fe32)){return _0x107db1;}else{throw new db['Sequelize']['ValidationError'](_0xf928('0x1c'));}}else{return _0x107db1;}}function respondWithRpcPromise(_0x44a500,_0x732b89,_0x170eb3,_0x4ab410){return new BPromise(function(_0x1179ee,_0xe64c0e){var _0x14fc7f=_0x4ab410||client;return _0x14fc7f[_0xf928('0x1d')](_0x44a500,_0x170eb3)[_0xf928('0x1e')](function(_0x2fb472){logger[_0xf928('0x1f')]('ZohoAccount,\x20%s,\x20%s',_0x732b89,_0xf928('0x20'));logger['debug'](_0xf928('0x21'),_0x732b89,_0xf928('0x20'),JSON[_0xf928('0x22')](_0x2fb472));if(_0x2fb472[_0xf928('0x23')]){if(_0x2fb472['error'][_0xf928('0x24')]===0x1f4){logger['error'](_0xf928('0x25'),_0x732b89,_0x2fb472[_0xf928('0x23')][_0xf928('0x26')]);return _0xe64c0e(_0x2fb472[_0xf928('0x23')][_0xf928('0x26')]);}logger['error'](_0xf928('0x25'),_0x732b89,_0x2fb472[_0xf928('0x23')]['message']);return _0x1179ee(_0x2fb472[_0xf928('0x23')][_0xf928('0x26')]);}else{logger[_0xf928('0x1f')](_0xf928('0x25'),_0x732b89,_0xf928('0x20'));_0x1179ee(_0x2fb472[_0xf928('0x27')][_0xf928('0x26')]);}})[_0xf928('0x28')](function(_0x312f8b){logger[_0xf928('0x23')]('ZohoAccount,\x20%s,\x20%s',_0x732b89,_0x312f8b);_0xe64c0e(_0x312f8b);});});}function respondWithStatusCode(_0x2f7cd3,_0x13386b){_0x13386b=_0x13386b||0xcc;return function(_0x501f33){if(_0x501f33){return _0x2f7cd3[_0xf928('0x29')](_0x13386b);}return _0x2f7cd3[_0xf928('0x2a')](_0x13386b)[_0xf928('0x2b')]();};}function respondWithResult(_0x9a1ec1,_0x3e2b2c){_0x3e2b2c=_0x3e2b2c||0xc8;return function(_0x4b76ab){if(_0x4b76ab){return _0x9a1ec1['status'](_0x3e2b2c)[_0xf928('0x2c')](_0x4b76ab);}};}function respondWithFilteredResult(_0x445b81,_0x39511e){return function(_0x27e9a9){if(_0x27e9a9){var _0x112c1c=_0x27e9a9['count'],_0x4680bd=_0x39511e[_0xf928('0x2d')],_0x3c3a30=_0x39511e[_0xf928('0x2d')]+_0x39511e['limit'],_0x37389f;if(_0x3c3a30>=_0x112c1c){_0x3c3a30=_0x112c1c;_0x37389f=0xc8;}else{_0x37389f=0xce;}_0x445b81[_0xf928('0x2a')](_0x37389f);return _0x445b81[_0xf928('0x2e')](_0xf928('0x2f'),_0x4680bd+'-'+_0x3c3a30+'/'+_0x112c1c)[_0xf928('0x2c')](_0x27e9a9);}return null;};}function patchUpdates(_0x36b626){return function(_0x561b17){try{jsonpatch[_0xf928('0x30')](_0x561b17,_0x36b626,!![]);}catch(_0xf6a18b){return BPromise['reject'](_0xf6a18b);}return _0x561b17[_0xf928('0x31')]();};}function saveUpdates(_0x1bb598,_0x384e46){return function(_0xf1afd5){if(_0xf1afd5){return _0xf1afd5[_0xf928('0x32')](_0x1bb598)[_0xf928('0x1e')](function(_0x35b61e){return _0x35b61e;});}return null;};}function removeEntity(_0x2fbecc,_0x4a8b35){return function(_0x42b45f){if(_0x42b45f){return _0x42b45f[_0xf928('0x33')]()[_0xf928('0x1e')](function(){_0x2fbecc[_0xf928('0x2a')](0xcc)[_0xf928('0x2b')]();});}};}function handleEntityNotFound(_0x157d97,_0x397acc){return function(_0x47bb1a){if(!_0x47bb1a){_0x157d97[_0xf928('0x29')](0x194);}return _0x47bb1a;};}function handleError(_0x451065,_0x7b716f){_0x7b716f=_0x7b716f||0x1f4;return function(_0x3c200c){logger['error'](_0x3c200c['stack']);if(_0x3c200c['name']){delete _0x3c200c[_0xf928('0x34')];}_0x451065[_0xf928('0x2a')](_0x7b716f)[_0xf928('0x35')](_0x3c200c);};}exports[_0xf928('0x36')]=function(_0x50bc8c,_0x3f865f){var _0x386f35={},_0xf03576={},_0x5d8309={'count':0x0,'rows':[]};var _0x393c5c=_[_0xf928('0x37')](db[_0xf928('0x38')][_0xf928('0x39')],function(_0x463863){return{'name':_0x463863[_0xf928('0x3a')],'type':_0x463863[_0xf928('0x3b')]['key']};});_0xf03576[_0xf928('0x3c')]=_[_0xf928('0x37')](_0x393c5c,_0xf928('0x34'));_0xf03576['query']=_['keys'](_0x50bc8c[_0xf928('0x3d')]);_0xf03576['filters']=_[_0xf928('0x3e')](_0xf03576[_0xf928('0x3c')],_0xf03576[_0xf928('0x3d')]);_0x386f35[_0xf928('0x3f')]=_[_0xf928('0x3e')](_0xf03576[_0xf928('0x3c')],qs[_0xf928('0x40')](_0x50bc8c[_0xf928('0x3d')]['fields']));_0x386f35[_0xf928('0x3f')]=_0x386f35['attributes'][_0xf928('0x41')]?_0x386f35['attributes']:_0xf03576[_0xf928('0x3c')];if(!_0x50bc8c['query']['hasOwnProperty'](_0xf928('0x42'))){_0x386f35[_0xf928('0x43')]=qs['limit'](_0x50bc8c[_0xf928('0x3d')][_0xf928('0x43')]);_0x386f35[_0xf928('0x2d')]=qs[_0xf928('0x2d')](_0x50bc8c[_0xf928('0x3d')][_0xf928('0x2d')]);}_0x386f35[_0xf928('0x44')]=qs[_0xf928('0x45')](_0x50bc8c[_0xf928('0x3d')]['sort']);_0x386f35['where']=qs[_0xf928('0x46')](_[_0xf928('0x47')](_0x50bc8c[_0xf928('0x3d')],_0xf03576[_0xf928('0x46')]),_0x393c5c);if(_0x50bc8c['query'][_0xf928('0x48')]){_0x386f35[_0xf928('0x49')]=_[_0xf928('0x4a')](_0x386f35[_0xf928('0x49')],{'$or':_[_0xf928('0x37')](_0x393c5c,function(_0x169240){if(_0x169240[_0xf928('0x3b')]!==_0xf928('0x4b')){var _0x3c8e02={};_0x3c8e02[_0x169240['name']]={'$like':'%'+_0x50bc8c[_0xf928('0x3d')][_0xf928('0x48')]+'%'};return _0x3c8e02;}})});}_0x386f35=_[_0xf928('0x4a')]({},_0x386f35,_0x50bc8c[_0xf928('0x4c')]);var _0x1f1df2={'where':_0x386f35['where']};return db[_0xf928('0x38')][_0xf928('0x4d')](_0x1f1df2)[_0xf928('0x1e')](function(_0x12dc2d){_0x5d8309[_0xf928('0x4d')]=_0x12dc2d;if(_0x50bc8c[_0xf928('0x3d')]['includeAll']){_0x386f35[_0xf928('0x4e')]=[{'all':!![]}];}return db['ZohoAccount'][_0xf928('0x4f')](_0x386f35);})[_0xf928('0x1e')](function(_0x2f59fe){_0x5d8309[_0xf928('0x50')]=_0x2f59fe;return _0x5d8309;})['then'](respondWithFilteredResult(_0x3f865f,_0x386f35))[_0xf928('0x28')](handleError(_0x3f865f,null));};exports[_0xf928('0x51')]=function(_0xd74b19,_0x3912c9){var _0x47b282={'raw':![],'where':{'id':_0xd74b19[_0xf928('0x52')]['id']}},_0x289a76={};_0x289a76['model']=_['keys'](db[_0xf928('0x38')][_0xf928('0x39')]);_0x289a76[_0xf928('0x3d')]=_['keys'](_0xd74b19[_0xf928('0x3d')]);_0x289a76['filters']=_[_0xf928('0x3e')](_0x289a76['model'],_0x289a76['query']);_0x47b282[_0xf928('0x3f')]=_[_0xf928('0x3e')](_0x289a76[_0xf928('0x3c')],qs[_0xf928('0x40')](_0xd74b19[_0xf928('0x3d')][_0xf928('0x40')]));_0x47b282[_0xf928('0x3f')]=_0x47b282[_0xf928('0x3f')]['length']?_0x47b282[_0xf928('0x3f')]:_0x289a76[_0xf928('0x3c')];if(_0xd74b19[_0xf928('0x3d')]['includeAll']){_0x47b282[_0xf928('0x4e')]=[{'all':!![]}];}_0x47b282=_[_0xf928('0x4a')]({},_0x47b282,_0xd74b19[_0xf928('0x4c')]);return db['ZohoAccount']['find'](_0x47b282)[_0xf928('0x1e')](handleEntityNotFound(_0x3912c9,null))[_0xf928('0x1e')](respondWithResult(_0x3912c9,null))[_0xf928('0x28')](handleError(_0x3912c9,null));};exports[_0xf928('0x53')]=function(_0x2efd45,_0x226031){return db[_0xf928('0x38')][_0xf928('0x53')](_0x2efd45[_0xf928('0x54')],{})['then'](respondWithResult(_0x226031,0xc9))['catch'](handleError(_0x226031,null));};exports['update']=function(_0x595149,_0x4a7013){if(_0x595149['body']['id']){delete _0x595149[_0xf928('0x54')]['id'];}return db[_0xf928('0x38')][_0xf928('0x55')]({'where':{'id':_0x595149['params']['id']}})['then'](handleEntityNotFound(_0x4a7013,null))['then'](saveUpdates(_0x595149[_0xf928('0x54')],null))['then'](respondWithResult(_0x4a7013,null))[_0xf928('0x28')](handleError(_0x4a7013,null));};exports[_0xf928('0x33')]=function(_0x4d7c9e,_0x11e13b){return db['ZohoAccount']['find']({'where':{'id':_0x4d7c9e[_0xf928('0x52')]['id']}})[_0xf928('0x1e')](handleEntityNotFound(_0x11e13b,null))[_0xf928('0x1e')](removeEntity(_0x11e13b,null))[_0xf928('0x28')](handleError(_0x11e13b,null));};exports['getConfigurations']=function(_0x595138,_0x35a23e,_0xfa67d7){var _0x2ac66c={};var _0x3f4cdb={};var _0x182da2;var _0x29387c;return db['ZohoAccount'][_0xf928('0x56')]({'where':{'id':_0x595138[_0xf928('0x52')]['id']}})[_0xf928('0x1e')](handleEntityNotFound(_0x35a23e,null))['then'](function(_0x1f9a95){if(_0x1f9a95){_0x182da2=_0x1f9a95;_0x3f4cdb[_0xf928('0x3c')]=_[_0xf928('0x57')](db['ZohoConfiguration']['rawAttributes']);_0x3f4cdb['query']=_['keys'](_0x595138[_0xf928('0x3d')]);_0x3f4cdb[_0xf928('0x46')]=_[_0xf928('0x3e')](_0x3f4cdb[_0xf928('0x3c')],_0x3f4cdb[_0xf928('0x3d')]);_0x2ac66c[_0xf928('0x3f')]=_['intersection'](_0x3f4cdb[_0xf928('0x3c')],qs[_0xf928('0x40')](_0x595138[_0xf928('0x3d')]['fields']));_0x2ac66c[_0xf928('0x3f')]=_0x2ac66c['attributes'][_0xf928('0x41')]?_0x2ac66c['attributes']:_0x3f4cdb[_0xf928('0x3c')];_0x2ac66c[_0xf928('0x44')]=qs[_0xf928('0x45')](_0x595138['query'][_0xf928('0x45')]);_0x2ac66c['where']=qs[_0xf928('0x46')](_[_0xf928('0x47')](_0x595138['query'],_0x3f4cdb[_0xf928('0x46')]));if(_0x595138[_0xf928('0x3d')]['filter']){_0x2ac66c[_0xf928('0x49')]=_[_0xf928('0x4a')](_0x2ac66c[_0xf928('0x49')],{'$or':_['map'](_0x2ac66c[_0xf928('0x3f')],function(_0x47afb0){var _0x1caa64={};_0x1caa64[_0x47afb0]={'$like':'%'+_0x595138[_0xf928('0x3d')][_0xf928('0x48')]+'%'};return _0x1caa64;})});}_0x2ac66c=_[_0xf928('0x4a')]({},_0x2ac66c,_0x595138[_0xf928('0x4c')]);return _0x182da2['getConfigurations'](_0x2ac66c);}})[_0xf928('0x1e')](function(_0x19cf00){if(_0x19cf00){_0x29387c=_0x19cf00[_0xf928('0x41')];if(!_0x595138[_0xf928('0x3d')][_0xf928('0x58')](_0xf928('0x42'))){_0x2ac66c[_0xf928('0x43')]=qs[_0xf928('0x43')](_0x595138['query'][_0xf928('0x43')]);_0x2ac66c[_0xf928('0x2d')]=qs[_0xf928('0x2d')](_0x595138[_0xf928('0x3d')][_0xf928('0x2d')]);}return _0x182da2['getConfigurations'](_0x2ac66c);}})[_0xf928('0x1e')](function(_0x162915){if(_0x162915){return _0x162915?{'count':_0x29387c,'rows':_0x162915}:null;}})[_0xf928('0x1e')](respondWithResult(_0x35a23e,null))[_0xf928('0x28')](handleError(_0x35a23e,null));};exports[_0xf928('0x59')]=function(_0x46b4b2,_0x4f2c3d,_0x4f0bde){if(_0x46b4b2[_0xf928('0x54')]['id']){delete _0x46b4b2[_0xf928('0x54')]['id'];}return db[_0xf928('0x38')]['findOne']({'where':{'id':_0x46b4b2[_0xf928('0x52')]['id']}})[_0xf928('0x1e')](handleEntityNotFound(_0x4f2c3d,null))[_0xf928('0x1e')](function(_0x2f7fbf){if(_0x2f7fbf){_0x46b4b2[_0xf928('0x54')][_0xf928('0x5a')]=_0x2f7fbf['id'];_0x46b4b2[_0xf928('0x54')][_0xf928('0x5b')]=integrations[_0xf928('0x5c')](_0x46b4b2[_0xf928('0x54')][_0xf928('0x5d')],_0x46b4b2[_0xf928('0x54')][_0xf928('0x3b')]);_0x46b4b2['body'][_0xf928('0x5e')]=integrations['getDescriptions'](_0x46b4b2[_0xf928('0x54')][_0xf928('0x5d')],_0x46b4b2[_0xf928('0x54')][_0xf928('0x3b')]);return db[_0xf928('0x5f')][_0xf928('0x53')](_0x46b4b2['body'],{'include':[{'model':db[_0xf928('0x60')],'as':_0xf928('0x5b')},{'model':db[_0xf928('0x60')],'as':_0xf928('0x5e')}]});}return null;})['then'](respondWithResult(_0x4f2c3d,null))[_0xf928('0x28')](handleError(_0x4f2c3d,null));};function getAccessToken(_0x2401f6){return new Promise(function(_0xef6a2,_0x253221){var _0x5caa6c;switch(_0x2401f6[_0xf928('0x61')]){case'US':_0x5caa6c=_0xf928('0x62');break;case'AU':_0x5caa6c='https://accounts.zoho.com.au';break;case'EU':_0x5caa6c=_0xf928('0x63');break;case'IN':_0x5caa6c=_0xf928('0x64');break;case'CN':_0x5caa6c=_0xf928('0x65');break;default:_0x5caa6c=_0xf928('0x63');break;}var _0x4c0b96={'method':_0xf928('0x66'),'uri':_0x5caa6c+'/oauth/v2/token','qs':{'refresh_token':_0x2401f6[_0xf928('0x67')],'client_id':_0x2401f6['clientId'],'client_secret':_0x2401f6['clientSecret'],'grant_type':_0xf928('0x68')},'json':!![]};return rp(_0x4c0b96)[_0xf928('0x1e')](function(_0x354a40){if(_0x354a40[_0xf928('0x69')]){_0xef6a2(_0x354a40['access_token']);}else{_0x253221(_0xf928('0x6a'));}})['catch'](function(_0x245c5f){_0x253221(_0x245c5f);});});}exports[_0xf928('0x6b')]=function(_0x3d702b,_0x1fe897,_0x47d582){var _0x1a7bc8,_0x160c4f,_0x1a6769,_0x116d9e,_0x5e1f2c;return db[_0xf928('0x38')][_0xf928('0x56')]({'where':{'id':_0x3d702b[_0xf928('0x52')]['id']},'attributes':['id',_0xf928('0x6c'),_0xf928('0x61'),_0xf928('0x6d'),_0xf928('0x6e'),_0xf928('0x6f'),_0xf928('0x24'),_0xf928('0x67')]})[_0xf928('0x1e')](handleEntityNotFound(_0x1fe897,null))[_0xf928('0x1e')](function(_0x420e9f){_0x5e1f2c=_0x420e9f;_0x1a7bc8=_0x5e1f2c['host'];_0x160c4f=_0x1a7bc8==='zoho.eu'?'eu':_0xf928('0x70');_0x1a6769=_0x5e1f2c[_0xf928('0x6f')];var _0x3c4f47=_0x1a6769[_0xf928('0x71')](-0x1);if(_0x3c4f47==='/'||_0x3c4f47==='\x5c'||_0x3c4f47===':'){_0x1a6769=_0x1a6769[_0xf928('0x72')](0x0,_0x1a6769[_0xf928('0x73')](_0x3c4f47));}if(!_0x5e1f2c[_0xf928('0x67')]){throw new Error(_0xf928('0x74'));}return getAccessToken(_0x5e1f2c);})[_0xf928('0x1e')](function(_0x59d879){if(_0x59d879){return rp({'method':'GET','uri':util[_0xf928('0x75')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x160c4f),'qs':{'module':_0xf928('0x76')},'headers':{'Authorization':_0xf928('0x77')+_0x59d879},'json':!![]});}})[_0xf928('0x1e')](function(_0x445471){if(_0x445471){if(_0x445471['response']&&_0x445471[_0xf928('0x78')]['error']){throw new Error(_0x445471[_0xf928('0x78')][_0xf928('0x23')][_0xf928('0x26')]);}var _0x4642b5=[];var _0xa20c6a=[];var _0x3e780a=[_0xf928('0x79'),_0xf928('0x7a'),_0xf928('0x7b'),_0xf928('0x7c'),_0xf928('0x7d'),_0xf928('0x7e'),_0xf928('0x7f'),'Call_Type'];_0xa20c6a=_[_0xf928('0x80')](_0x445471[_0xf928('0x40')],function(_0x5a7b84){return _0x3e780a[_0xf928('0x81')](_0x5a7b84[_0xf928('0x82')]);});for(var _0x98624d=0x0;_0x98624d<_0xa20c6a[_0xf928('0x41')];_0x98624d++){if(_0xa20c6a[_0x98624d][_0xf928('0x83')]===![]){_0x4642b5['push']({'id':_0xa20c6a[_0x98624d]['id'],'name':_0xa20c6a[_0x98624d][_0xf928('0x84')],'custom':_0xa20c6a[_0x98624d][_0xf928('0x85')],'options':_0xa20c6a[_0x98624d]['data_type']==='picklist'&&_0xa20c6a[_0x98624d][_0xf928('0x86')][_0xf928('0x41')]>-0x1?_['map'](_0xa20c6a[_0x98624d]['pick_list_values'],function(_0x156db8){return{'name':_0x156db8,'value':_0x156db8};}):[]});}}return{'count':_0x4642b5[_0xf928('0x41')],'rows':_0x4642b5};}else{return{'count':0x0,'rows':[]};}})[_0xf928('0x1e')](respondWithResult(_0x1fe897,null))[_0xf928('0x28')](function(_0x20c929){var _0x2b247c=_0x3d702b[_0xf928('0x3d')]['test']?0x1f4:_0x20c929[_0xf928('0x87')]||0x1f4;logger[_0xf928('0x23')](_0xf928('0x88'),_0xf928('0x6b'),_0x2b247c,JSON[_0xf928('0x22')](_0x20c929));delete _0x20c929[_0xf928('0x34')];if(_0x2b247c===0x191){_0x2b247c=0x190;}_0x1fe897[_0xf928('0x2a')](_0x2b247c)['send'](_0x3d702b[_0xf928('0x3d')][_0xf928('0x1b')]?{'message':_0xf928('0x89'),'statusCode':_0x20c929[_0xf928('0x87')]}:_0x20c929);});}; \ No newline at end of file +var _0xbebb=['https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','zoho.eu','com','serverUrl','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Result','Call_Type','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','destroy','end','name','send','index','map','ZohoAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','find','create','body','update','getConfigurations','findOne','pick','addConfiguration','getSubjects','channel','type','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x1bc0ae,_0x439dfe){var _0x501104=function(_0x2ade0d){while(--_0x2ade0d){_0x1bc0ae['push'](_0x1bc0ae['shift']());}};_0x501104(++_0x439dfe);}(_0xbebb,0xae));var _0xbbeb=function(_0xdd7bb,_0x5ebf0f){_0xdd7bb=_0xdd7bb-0x0;var _0x1ac917=_0xbebb[_0xdd7bb];return _0x1ac917;};'use strict';var pdf=require(_0xbbeb('0x0'));var emlformat=require(_0xbbeb('0x1'));var rimraf=require(_0xbbeb('0x2'));var zipdir=require(_0xbbeb('0x3'));var jsonpatch=require(_0xbbeb('0x4'));var rp=require(_0xbbeb('0x5'));var moment=require(_0xbbeb('0x6'));var BPromise=require(_0xbbeb('0x7'));var Mustache=require(_0xbbeb('0x8'));var util=require(_0xbbeb('0x9'));var path=require(_0xbbeb('0xa'));var sox=require(_0xbbeb('0xb'));var csv=require(_0xbbeb('0xc'));var ejs=require(_0xbbeb('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbbeb('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbbeb('0xf'));var toCsv=require(_0xbbeb('0xc'));var querystring=require('querystring');var Papa=require(_0xbbeb('0x10'));var Redis=require(_0xbbeb('0x11'));var authService=require(_0xbbeb('0x12'));var qs=require(_0xbbeb('0x13'));var as=require(_0xbbeb('0x14'));var hardwareService=require(_0xbbeb('0x15'));var logger=require(_0xbbeb('0x16'))(_0xbbeb('0x17'));var utils=require(_0xbbeb('0x18'));var config=require(_0xbbeb('0x19'));var db=require(_0xbbeb('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xbbeb('0x1b'));var client=jayson[_0xbbeb('0x1c')][_0xbbeb('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x23249c,_0x1ef2bd,_0x4e9861){if(_0x4e9861){var _0x2045d8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2045d8[_0xbbeb('0x1e')](_0x1ef2bd)){return _0x23249c;}else{throw new db['Sequelize'][(_0xbbeb('0x1f'))](_0xbbeb('0x20'));}}else{return _0x23249c;}}function respondWithRpcPromise(_0x37b587,_0x46f880,_0x4b0fea,_0x52c820){return new BPromise(function(_0x2b338b,_0x27f250){var _0x57014d=_0x52c820||client;return _0x57014d[_0xbbeb('0x21')](_0x37b587,_0x4b0fea)[_0xbbeb('0x22')](function(_0x5a46db){logger[_0xbbeb('0x23')]('ZohoAccount,\x20%s,\x20%s',_0x46f880,_0xbbeb('0x24'));logger['debug'](_0xbbeb('0x25'),_0x46f880,_0xbbeb('0x24'),JSON[_0xbbeb('0x26')](_0x5a46db));if(_0x5a46db[_0xbbeb('0x27')]){if(_0x5a46db['error'][_0xbbeb('0x28')]===0x1f4){logger[_0xbbeb('0x27')]('ZohoAccount,\x20%s,\x20%s',_0x46f880,_0x5a46db[_0xbbeb('0x27')][_0xbbeb('0x29')]);return _0x27f250(_0x5a46db[_0xbbeb('0x27')]['message']);}logger[_0xbbeb('0x27')](_0xbbeb('0x2a'),_0x46f880,_0x5a46db['error'][_0xbbeb('0x29')]);return _0x2b338b(_0x5a46db[_0xbbeb('0x27')]['message']);}else{logger[_0xbbeb('0x23')]('ZohoAccount,\x20%s,\x20%s',_0x46f880,_0xbbeb('0x24'));_0x2b338b(_0x5a46db[_0xbbeb('0x2b')][_0xbbeb('0x29')]);}})[_0xbbeb('0x2c')](function(_0x5c2848){logger['error'](_0xbbeb('0x2a'),_0x46f880,_0x5c2848);_0x27f250(_0x5c2848);});});}function respondWithStatusCode(_0x6131eb,_0x30e67f){_0x30e67f=_0x30e67f||0xcc;return function(_0x289441){if(_0x289441){return _0x6131eb[_0xbbeb('0x2d')](_0x30e67f);}return _0x6131eb['status'](_0x30e67f)['end']();};}function respondWithResult(_0x34f20d,_0x572848){_0x572848=_0x572848||0xc8;return function(_0x26c612){if(_0x26c612){return _0x34f20d[_0xbbeb('0x2e')](_0x572848)[_0xbbeb('0x2f')](_0x26c612);}};}function respondWithFilteredResult(_0x28b951,_0x2b76a8){return function(_0x310b2c){if(_0x310b2c){var _0x2581eb=_0x310b2c['count'],_0x190042=_0x2b76a8[_0xbbeb('0x30')],_0x16d0dc=_0x2b76a8['offset']+_0x2b76a8[_0xbbeb('0x31')],_0x17f213;if(_0x16d0dc>=_0x2581eb){_0x16d0dc=_0x2581eb;_0x17f213=0xc8;}else{_0x17f213=0xce;}_0x28b951[_0xbbeb('0x2e')](_0x17f213);return _0x28b951[_0xbbeb('0x32')](_0xbbeb('0x33'),_0x190042+'-'+_0x16d0dc+'/'+_0x2581eb)[_0xbbeb('0x2f')](_0x310b2c);}return null;};}function patchUpdates(_0x5c48e2){return function(_0x985471){try{jsonpatch[_0xbbeb('0x34')](_0x985471,_0x5c48e2,!![]);}catch(_0x974869){return BPromise[_0xbbeb('0x35')](_0x974869);}return _0x985471[_0xbbeb('0x36')]();};}function saveUpdates(_0x3a41ad,_0x5a2a98){return function(_0x141249){if(_0x141249){return _0x141249['update'](_0x3a41ad)['then'](function(_0x2212eb){return _0x2212eb;});}return null;};}function removeEntity(_0x2aecc2,_0x12a61b){return function(_0xbbdb55){if(_0xbbdb55){return _0xbbdb55[_0xbbeb('0x37')]()[_0xbbeb('0x22')](function(){_0x2aecc2['status'](0xcc)[_0xbbeb('0x38')]();});}};}function handleEntityNotFound(_0x11492d,_0xcbd69b){return function(_0x5d2a0f){if(!_0x5d2a0f){_0x11492d[_0xbbeb('0x2d')](0x194);}return _0x5d2a0f;};}function handleError(_0x26b088,_0x1fdc4d){_0x1fdc4d=_0x1fdc4d||0x1f4;return function(_0x2461fc){logger[_0xbbeb('0x27')](_0x2461fc['stack']);if(_0x2461fc[_0xbbeb('0x39')]){delete _0x2461fc[_0xbbeb('0x39')];}_0x26b088[_0xbbeb('0x2e')](_0x1fdc4d)[_0xbbeb('0x3a')](_0x2461fc);};}exports[_0xbbeb('0x3b')]=function(_0x4230c6,_0x20c860){var _0x2e565e={},_0x9eb42d={},_0x569e35={'count':0x0,'rows':[]};var _0x150802=_[_0xbbeb('0x3c')](db[_0xbbeb('0x3d')][_0xbbeb('0x3e')],function(_0x4428b4){return{'name':_0x4428b4[_0xbbeb('0x3f')],'type':_0x4428b4['type']['key']};});_0x9eb42d[_0xbbeb('0x40')]=_[_0xbbeb('0x3c')](_0x150802,_0xbbeb('0x39'));_0x9eb42d[_0xbbeb('0x41')]=_[_0xbbeb('0x42')](_0x4230c6['query']);_0x9eb42d[_0xbbeb('0x43')]=_['intersection'](_0x9eb42d[_0xbbeb('0x40')],_0x9eb42d[_0xbbeb('0x41')]);_0x2e565e['attributes']=_[_0xbbeb('0x44')](_0x9eb42d[_0xbbeb('0x40')],qs[_0xbbeb('0x45')](_0x4230c6['query'][_0xbbeb('0x45')]));_0x2e565e[_0xbbeb('0x46')]=_0x2e565e[_0xbbeb('0x46')][_0xbbeb('0x47')]?_0x2e565e[_0xbbeb('0x46')]:_0x9eb42d[_0xbbeb('0x40')];if(!_0x4230c6[_0xbbeb('0x41')]['hasOwnProperty'](_0xbbeb('0x48'))){_0x2e565e[_0xbbeb('0x31')]=qs['limit'](_0x4230c6['query'][_0xbbeb('0x31')]);_0x2e565e['offset']=qs[_0xbbeb('0x30')](_0x4230c6[_0xbbeb('0x41')][_0xbbeb('0x30')]);}_0x2e565e[_0xbbeb('0x49')]=qs['sort'](_0x4230c6['query'][_0xbbeb('0x4a')]);_0x2e565e['where']=qs[_0xbbeb('0x43')](_['pick'](_0x4230c6[_0xbbeb('0x41')],_0x9eb42d[_0xbbeb('0x43')]),_0x150802);if(_0x4230c6['query'][_0xbbeb('0x4b')]){_0x2e565e[_0xbbeb('0x4c')]=_[_0xbbeb('0x4d')](_0x2e565e[_0xbbeb('0x4c')],{'$or':_[_0xbbeb('0x3c')](_0x150802,function(_0x4e1707){if(_0x4e1707['type']!==_0xbbeb('0x4e')){var _0x40a13e={};_0x40a13e[_0x4e1707[_0xbbeb('0x39')]]={'$like':'%'+_0x4230c6[_0xbbeb('0x41')]['filter']+'%'};return _0x40a13e;}})});}_0x2e565e=_[_0xbbeb('0x4d')]({},_0x2e565e,_0x4230c6[_0xbbeb('0x4f')]);var _0x46ecfc={'where':_0x2e565e[_0xbbeb('0x4c')]};return db[_0xbbeb('0x3d')][_0xbbeb('0x50')](_0x46ecfc)['then'](function(_0x5733b1){_0x569e35['count']=_0x5733b1;if(_0x4230c6['query'][_0xbbeb('0x51')]){_0x2e565e[_0xbbeb('0x52')]=[{'all':!![]}];}return db[_0xbbeb('0x3d')]['findAll'](_0x2e565e);})[_0xbbeb('0x22')](function(_0x431ecf){_0x569e35[_0xbbeb('0x53')]=_0x431ecf;return _0x569e35;})['then'](respondWithFilteredResult(_0x20c860,_0x2e565e))[_0xbbeb('0x2c')](handleError(_0x20c860,null));};exports[_0xbbeb('0x54')]=function(_0xcd8354,_0x1df53a){var _0x15fa21={'raw':![],'where':{'id':_0xcd8354[_0xbbeb('0x55')]['id']}},_0x34acbc={};_0x34acbc[_0xbbeb('0x40')]=_[_0xbbeb('0x42')](db[_0xbbeb('0x3d')]['rawAttributes']);_0x34acbc[_0xbbeb('0x41')]=_[_0xbbeb('0x42')](_0xcd8354[_0xbbeb('0x41')]);_0x34acbc[_0xbbeb('0x43')]=_['intersection'](_0x34acbc[_0xbbeb('0x40')],_0x34acbc[_0xbbeb('0x41')]);_0x15fa21[_0xbbeb('0x46')]=_[_0xbbeb('0x44')](_0x34acbc[_0xbbeb('0x40')],qs['fields'](_0xcd8354[_0xbbeb('0x41')][_0xbbeb('0x45')]));_0x15fa21[_0xbbeb('0x46')]=_0x15fa21[_0xbbeb('0x46')][_0xbbeb('0x47')]?_0x15fa21[_0xbbeb('0x46')]:_0x34acbc[_0xbbeb('0x40')];if(_0xcd8354['query'][_0xbbeb('0x51')]){_0x15fa21[_0xbbeb('0x52')]=[{'all':!![]}];}_0x15fa21=_[_0xbbeb('0x4d')]({},_0x15fa21,_0xcd8354[_0xbbeb('0x4f')]);return db[_0xbbeb('0x3d')][_0xbbeb('0x56')](_0x15fa21)['then'](handleEntityNotFound(_0x1df53a,null))[_0xbbeb('0x22')](respondWithResult(_0x1df53a,null))['catch'](handleError(_0x1df53a,null));};exports[_0xbbeb('0x57')]=function(_0x1c6c6c,_0x257fb8){return db['ZohoAccount'][_0xbbeb('0x57')](_0x1c6c6c[_0xbbeb('0x58')],{})[_0xbbeb('0x22')](respondWithResult(_0x257fb8,0xc9))[_0xbbeb('0x2c')](handleError(_0x257fb8,null));};exports[_0xbbeb('0x59')]=function(_0x3e1d38,_0x45d09c){if(_0x3e1d38[_0xbbeb('0x58')]['id']){delete _0x3e1d38['body']['id'];}return db[_0xbbeb('0x3d')][_0xbbeb('0x56')]({'where':{'id':_0x3e1d38[_0xbbeb('0x55')]['id']}})[_0xbbeb('0x22')](handleEntityNotFound(_0x45d09c,null))[_0xbbeb('0x22')](saveUpdates(_0x3e1d38[_0xbbeb('0x58')],null))[_0xbbeb('0x22')](respondWithResult(_0x45d09c,null))[_0xbbeb('0x2c')](handleError(_0x45d09c,null));};exports['destroy']=function(_0x5cb8a0,_0x1592e3){return db[_0xbbeb('0x3d')][_0xbbeb('0x56')]({'where':{'id':_0x5cb8a0[_0xbbeb('0x55')]['id']}})[_0xbbeb('0x22')](handleEntityNotFound(_0x1592e3,null))[_0xbbeb('0x22')](removeEntity(_0x1592e3,null))[_0xbbeb('0x2c')](handleError(_0x1592e3,null));};exports[_0xbbeb('0x5a')]=function(_0x1221cb,_0x40e72e,_0x18037e){var _0x5c250a={};var _0x2cbe2b={};var _0x496f14;var _0x2d6d96;return db[_0xbbeb('0x3d')][_0xbbeb('0x5b')]({'where':{'id':_0x1221cb[_0xbbeb('0x55')]['id']}})[_0xbbeb('0x22')](handleEntityNotFound(_0x40e72e,null))['then'](function(_0xe161ac){if(_0xe161ac){_0x496f14=_0xe161ac;_0x2cbe2b[_0xbbeb('0x40')]=_['keys'](db['ZohoConfiguration'][_0xbbeb('0x3e')]);_0x2cbe2b['query']=_[_0xbbeb('0x42')](_0x1221cb[_0xbbeb('0x41')]);_0x2cbe2b[_0xbbeb('0x43')]=_[_0xbbeb('0x44')](_0x2cbe2b['model'],_0x2cbe2b[_0xbbeb('0x41')]);_0x5c250a[_0xbbeb('0x46')]=_['intersection'](_0x2cbe2b[_0xbbeb('0x40')],qs['fields'](_0x1221cb['query']['fields']));_0x5c250a['attributes']=_0x5c250a[_0xbbeb('0x46')][_0xbbeb('0x47')]?_0x5c250a[_0xbbeb('0x46')]:_0x2cbe2b[_0xbbeb('0x40')];_0x5c250a[_0xbbeb('0x49')]=qs[_0xbbeb('0x4a')](_0x1221cb[_0xbbeb('0x41')][_0xbbeb('0x4a')]);_0x5c250a[_0xbbeb('0x4c')]=qs[_0xbbeb('0x43')](_[_0xbbeb('0x5c')](_0x1221cb[_0xbbeb('0x41')],_0x2cbe2b['filters']));if(_0x1221cb[_0xbbeb('0x41')][_0xbbeb('0x4b')]){_0x5c250a[_0xbbeb('0x4c')]=_[_0xbbeb('0x4d')](_0x5c250a['where'],{'$or':_[_0xbbeb('0x3c')](_0x5c250a['attributes'],function(_0x268928){var _0x24afac={};_0x24afac[_0x268928]={'$like':'%'+_0x1221cb['query'][_0xbbeb('0x4b')]+'%'};return _0x24afac;})});}_0x5c250a=_[_0xbbeb('0x4d')]({},_0x5c250a,_0x1221cb['options']);return _0x496f14[_0xbbeb('0x5a')](_0x5c250a);}})[_0xbbeb('0x22')](function(_0x1f1811){if(_0x1f1811){_0x2d6d96=_0x1f1811[_0xbbeb('0x47')];if(!_0x1221cb[_0xbbeb('0x41')]['hasOwnProperty'](_0xbbeb('0x48'))){_0x5c250a[_0xbbeb('0x31')]=qs[_0xbbeb('0x31')](_0x1221cb[_0xbbeb('0x41')][_0xbbeb('0x31')]);_0x5c250a[_0xbbeb('0x30')]=qs[_0xbbeb('0x30')](_0x1221cb[_0xbbeb('0x41')][_0xbbeb('0x30')]);}return _0x496f14[_0xbbeb('0x5a')](_0x5c250a);}})[_0xbbeb('0x22')](function(_0x35e975){if(_0x35e975){return _0x35e975?{'count':_0x2d6d96,'rows':_0x35e975}:null;}})[_0xbbeb('0x22')](respondWithResult(_0x40e72e,null))[_0xbbeb('0x2c')](handleError(_0x40e72e,null));};exports[_0xbbeb('0x5d')]=function(_0x125f53,_0xbf0791,_0x40730f){if(_0x125f53[_0xbbeb('0x58')]['id']){delete _0x125f53['body']['id'];}return db[_0xbbeb('0x3d')]['findOne']({'where':{'id':_0x125f53[_0xbbeb('0x55')]['id']}})[_0xbbeb('0x22')](handleEntityNotFound(_0xbf0791,null))[_0xbbeb('0x22')](function(_0x1a6ddd){if(_0x1a6ddd){_0x125f53[_0xbbeb('0x58')]['AccountId']=_0x1a6ddd['id'];_0x125f53[_0xbbeb('0x58')]['Subjects']=integrations[_0xbbeb('0x5e')](_0x125f53[_0xbbeb('0x58')][_0xbbeb('0x5f')],_0x125f53[_0xbbeb('0x58')][_0xbbeb('0x60')]);_0x125f53[_0xbbeb('0x58')][_0xbbeb('0x61')]=integrations['getDescriptions'](_0x125f53[_0xbbeb('0x58')][_0xbbeb('0x5f')],_0x125f53['body'][_0xbbeb('0x60')]);return db['ZohoConfiguration'][_0xbbeb('0x57')](_0x125f53[_0xbbeb('0x58')],{'include':[{'model':db[_0xbbeb('0x62')],'as':'Subjects'},{'model':db[_0xbbeb('0x62')],'as':_0xbbeb('0x61')}]});}return null;})['then'](respondWithResult(_0xbf0791,null))[_0xbbeb('0x2c')](handleError(_0xbf0791,null));};function getAccessToken(_0x10caaa){return new Promise(function(_0x36e864,_0x1ccbb5){var _0x3df7b3;switch(_0x10caaa[_0xbbeb('0x63')]){case'US':_0x3df7b3=_0xbbeb('0x64');break;case'AU':_0x3df7b3=_0xbbeb('0x65');break;case'EU':_0x3df7b3=_0xbbeb('0x66');break;case'IN':_0x3df7b3=_0xbbeb('0x67');break;case'CN':_0x3df7b3='https://accounts.zoho.com.cn';break;default:_0x3df7b3='https://accounts.zoho.eu';break;}var _0x144e1a={'method':_0xbbeb('0x68'),'uri':_0x3df7b3+'/oauth/v2/token','qs':{'refresh_token':_0x10caaa[_0xbbeb('0x69')],'client_id':_0x10caaa[_0xbbeb('0x6a')],'client_secret':_0x10caaa[_0xbbeb('0x6b')],'grant_type':_0xbbeb('0x6c')},'json':!![]};return rp(_0x144e1a)['then'](function(_0x52a077){if(_0x52a077[_0xbbeb('0x6d')]){_0x36e864(_0x52a077['access_token']);}else{_0x1ccbb5('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xbbeb('0x2c')](function(_0x372633){_0x1ccbb5(_0x372633);});});}exports[_0xbbeb('0x6e')]=function(_0x42a9cd,_0x1188b9,_0x623f30){var _0x22f22a,_0x3b30da,_0x43cb6f,_0x2d7f73,_0x5ab0f8;return db['ZohoAccount'][_0xbbeb('0x5b')]({'where':{'id':_0x42a9cd['params']['id']},'attributes':['id',_0xbbeb('0x6f'),'zone',_0xbbeb('0x6a'),_0xbbeb('0x6b'),'serverUrl','code','refreshToken']})[_0xbbeb('0x22')](handleEntityNotFound(_0x1188b9,null))[_0xbbeb('0x22')](function(_0x215a1d){_0x5ab0f8=_0x215a1d;_0x22f22a=_0x5ab0f8[_0xbbeb('0x6f')];_0x3b30da=_0x22f22a===_0xbbeb('0x70')?'eu':_0xbbeb('0x71');_0x43cb6f=_0x5ab0f8[_0xbbeb('0x72')];var _0x2f2675=_0x43cb6f[_0xbbeb('0x73')](-0x1);if(_0x2f2675==='/'||_0x2f2675==='\x5c'||_0x2f2675===':'){_0x43cb6f=_0x43cb6f[_0xbbeb('0x74')](0x0,_0x43cb6f['lastIndexOf'](_0x2f2675));}if(!_0x5ab0f8[_0xbbeb('0x69')]){throw new Error(_0xbbeb('0x75'));}return getAccessToken(_0x5ab0f8);})[_0xbbeb('0x22')](function(_0x447b7f){if(_0x447b7f){return rp({'method':_0xbbeb('0x76'),'uri':util[_0xbbeb('0x77')](_0xbbeb('0x78'),_0x3b30da),'qs':{'module':'Calls'},'headers':{'Authorization':_0xbbeb('0x79')+_0x447b7f},'json':!![]});}})[_0xbbeb('0x22')](function(_0x236fab){if(_0x236fab){if(_0x236fab['response']&&_0x236fab[_0xbbeb('0x7a')]['error']){throw new Error(_0x236fab[_0xbbeb('0x7a')][_0xbbeb('0x27')]['message']);}var _0x2ebedc=[];var _0x3397ec=[];var _0x5ab650=[_0xbbeb('0x7b'),_0xbbeb('0x7c'),_0xbbeb('0x7d'),_0xbbeb('0x7e'),'Call_Duration',_0xbbeb('0x7f'),'Call_Start_Time',_0xbbeb('0x80')];_0x3397ec=_['remove'](_0x236fab[_0xbbeb('0x45')],function(_0x455cb3){return _0x5ab650['includes'](_0x455cb3[_0xbbeb('0x81')]);});for(var _0x5e52a7=0x0;_0x5e52a7<_0x3397ec[_0xbbeb('0x47')];_0x5e52a7++){if(_0x3397ec[_0x5e52a7][_0xbbeb('0x82')]===![]){_0x2ebedc[_0xbbeb('0x83')]({'id':_0x3397ec[_0x5e52a7]['id'],'name':_0x3397ec[_0x5e52a7][_0xbbeb('0x84')],'custom':_0x3397ec[_0x5e52a7][_0xbbeb('0x85')],'options':_0x3397ec[_0x5e52a7]['data_type']===_0xbbeb('0x86')&&_0x3397ec[_0x5e52a7][_0xbbeb('0x87')]['length']>-0x1?_['map'](_0x3397ec[_0x5e52a7]['pick_list_values'],function(_0x496330){return{'name':_0x496330,'value':_0x496330};}):[]});}}return{'count':_0x2ebedc[_0xbbeb('0x47')],'rows':_0x2ebedc};}else{return{'count':0x0,'rows':[]};}})[_0xbbeb('0x22')](respondWithResult(_0x1188b9,null))[_0xbbeb('0x2c')](function(_0x2d2535){var _0x16ca38=_0x42a9cd[_0xbbeb('0x41')][_0xbbeb('0x1e')]?0x1f4:_0x2d2535[_0xbbeb('0x88')]||0x1f4;logger[_0xbbeb('0x27')](_0xbbeb('0x89'),'getFields',_0x16ca38,JSON[_0xbbeb('0x26')](_0x2d2535));delete _0x2d2535[_0xbbeb('0x39')];if(_0x16ca38===0x191){_0x16ca38=0x190;}_0x1188b9[_0xbbeb('0x2e')](_0x16ca38)[_0xbbeb('0x3a')](_0x42a9cd['query'][_0xbbeb('0x1e')]?{'message':'Wrong\x20credentials','statusCode':_0x2d2535[_0xbbeb('0x88')]}:_0x2d2535);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 59abc2e..920c8ba 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 _0xa79d=['ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','substring','lastIndexOf','https://accounts.zoho.in','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','serverUrl','clientId','slice','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','clientSecret','code','then','refresh_token','refreshToken','info','format'];(function(_0x3e6bd3,_0x78f1c7){var _0x3ce206=function(_0x269914){while(--_0x269914){_0x3e6bd3['push'](_0x3e6bd3['shift']());}};_0x3ce206(++_0x78f1c7);}(_0xa79d,0x91));var _0xda79=function(_0x8dcf90,_0x454917){_0x8dcf90=_0x8dcf90-0x0;var _0x577a07=_0xa79d[_0x8dcf90];return _0x577a07;};'use strict';var _=require(_0xda79('0x0'));var util=require(_0xda79('0x1'));var logger=require(_0xda79('0x2'))('api');var moment=require(_0xda79('0x3'));var BPromise=require(_0xda79('0x4'));var rp=require(_0xda79('0x5'));var fs=require('fs');var path=require(_0xda79('0x6'));var rimraf=require(_0xda79('0x7'));var config=require(_0xda79('0x8'));var attributes=require(_0xda79('0x9'));var integrations=require(_0xda79('0xa'));module[_0xda79('0xb')]=function(_0x5be673,_0x3ed1e1){return _0x5be673[_0xda79('0xc')]('ZohoAccount',attributes,{'tableName':_0xda79('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x139301,_0x3af1c5,_0x37d275){if(_0x139301[_0xda79('0xe')]('zone')||_0x139301[_0xda79('0xe')](_0xda79('0xf'))||_0x139301[_0xda79('0xe')](_0xda79('0x10'))||_0x139301[_0xda79('0xe')]('clientSecret')||_0x139301[_0xda79('0xe')]('code')||_0x139301[_0xda79('0xe')]('host')){var _0x1ad4d5,_0xde70f5;_0x1ad4d5=_0x139301[_0xda79('0xf')];var _0x58f060=_0x1ad4d5[_0xda79('0x11')](-0x1);if(_0x58f060==='/'||_0x58f060==='\x5c'||_0x58f060===':'){_0x1ad4d5=_0x1ad4d5['substring'](0x0,_0x1ad4d5['lastIndexOf'](_0x58f060));}switch(_0x139301[_0xda79('0x12')]){case'US':_0xde70f5=_0xda79('0x13');break;case'AU':_0xde70f5=_0xda79('0x14');break;case'IN':_0xde70f5='https://accounts.zoho.in';break;case'CN':_0xde70f5=_0xda79('0x15');break;default:_0xde70f5=_0xda79('0x16');break;}var _0x2b928a={'method':_0xda79('0x17'),'uri':_0xde70f5+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x139301[_0xda79('0x10')],'client_secret':_0x139301[_0xda79('0x18')],'redirect_uri':_0x139301[_0xda79('0xf')],'code':_0x139301[_0xda79('0x19')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x2b928a)[_0xda79('0x1a')](function(_0xa162ab){var _0x250295=JSON['parse'](_0xa162ab);if(_0x250295[_0xda79('0x1b')]){_0x139301[_0xda79('0x1c')]=_0x250295[_0xda79('0x1b')];logger[_0xda79('0x1d')](util[_0xda79('0x1e')](_0xda79('0x1f'),_0x139301[_0xda79('0x20')],_0x139301['id']));}else{logger[_0xda79('0x21')](util[_0xda79('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x139301[_0xda79('0x20')],_0x139301['id']),util[_0xda79('0x22')](_0x250295,{'showHidden':![],'depth':null}));}return _0x37d275(null,_0x3af1c5);})[_0xda79('0x23')](function(_0x49bbdd){logger[_0xda79('0x21')](util[_0xda79('0x1e')](_0xda79('0x24'),_0x139301[_0xda79('0x20')],_0x139301['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x37d275(_0x49bbdd);});}else{return _0x37d275(null,_0x3af1c5);}},'beforeUpdate':function(_0x599455,_0x3b5d43,_0x8d8e66){if(_0x599455[_0xda79('0xe')](_0xda79('0x12'))||_0x599455['changed'](_0xda79('0xf'))||_0x599455[_0xda79('0xe')]('clientId')||_0x599455['changed'](_0xda79('0x18'))||_0x599455['changed'](_0xda79('0x19'))||_0x599455['changed']('host')){var _0x32bb90,_0x5f592e;_0x32bb90=_0x599455[_0xda79('0xf')];var _0x16a51b=_0x32bb90['slice'](-0x1);if(_0x16a51b==='/'||_0x16a51b==='\x5c'||_0x16a51b===':'){_0x32bb90=_0x32bb90[_0xda79('0x25')](0x0,_0x32bb90[_0xda79('0x26')](_0x16a51b));}switch(_0x599455['zone']){case'US':_0x5f592e='https://accounts.zoho.com';break;case'AU':_0x5f592e=_0xda79('0x14');break;case'IN':_0x5f592e=_0xda79('0x27');break;case'CN':_0x5f592e=_0xda79('0x15');break;default:_0x5f592e=_0xda79('0x16');break;}var _0xdfa01f={'method':_0xda79('0x17'),'uri':_0x5f592e+_0xda79('0x28'),'form':{'grant_type':_0xda79('0x29'),'client_id':_0x599455[_0xda79('0x10')],'client_secret':_0x599455[_0xda79('0x18')],'redirect_uri':_0x599455['serverUrl'],'code':_0x599455['code']},'headers':{'Content-Type':_0xda79('0x2a')}};return rp(_0xdfa01f)[_0xda79('0x1a')](function(_0xbc6655){var _0x4035f8=JSON[_0xda79('0x2b')](_0xbc6655);if(_0x4035f8[_0xda79('0x1b')]){_0x599455[_0xda79('0x1c')]=_0x4035f8[_0xda79('0x1b')];logger[_0xda79('0x1d')](util['format'](_0xda79('0x1f'),_0x599455['name'],_0x599455['id']));}else{logger[_0xda79('0x21')](util[_0xda79('0x1e')](_0xda79('0x24'),_0x599455[_0xda79('0x20')],_0x599455['id']),util['inspect'](_0x4035f8,{'showHidden':![],'depth':null}));}return _0x8d8e66(null,_0x3b5d43);})['catch'](function(_0x3b3851){logger['error'](util[_0xda79('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x599455['name'],_0x599455['id']),util[_0xda79('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x8d8e66(_0x3b3851);});}else{return _0x8d8e66(null,_0x3b5d43);}}}});}; \ No newline at end of file +var _0x9b10=['catch','lodash','api','moment','bluebird','request-promise','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','substring','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','slice','lastIndexOf','https://accounts.zoho.com.au','refreshToken'];(function(_0x111344,_0x2d1d08){var _0x149208=function(_0x219853){while(--_0x219853){_0x111344['push'](_0x111344['shift']());}};_0x149208(++_0x2d1d08);}(_0x9b10,0x1ed));var _0x09b1=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9b10[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x09b1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x09b1('0x1'));var moment=require(_0x09b1('0x2'));var BPromise=require(_0x09b1('0x3'));var rp=require(_0x09b1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x09b1('0x5'));var attributes=require(_0x09b1('0x6'));var integrations=require(_0x09b1('0x7'));module['exports']=function(_0x545ce2,_0x3f158d){return _0x545ce2[_0x09b1('0x8')](_0x09b1('0x9'),attributes,{'tableName':_0x09b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x37a8cb,_0x5490f5,_0x50b96f){if(_0x37a8cb[_0x09b1('0xb')](_0x09b1('0xc'))||_0x37a8cb[_0x09b1('0xb')](_0x09b1('0xd'))||_0x37a8cb[_0x09b1('0xb')](_0x09b1('0xe'))||_0x37a8cb['changed'](_0x09b1('0xf'))||_0x37a8cb[_0x09b1('0xb')](_0x09b1('0x10'))||_0x37a8cb[_0x09b1('0xb')](_0x09b1('0x11'))){var _0x419db7,_0x20ab55;_0x419db7=_0x37a8cb[_0x09b1('0xd')];var _0x312e2f=_0x419db7['slice'](-0x1);if(_0x312e2f==='/'||_0x312e2f==='\x5c'||_0x312e2f===':'){_0x419db7=_0x419db7[_0x09b1('0x12')](0x0,_0x419db7['lastIndexOf'](_0x312e2f));}switch(_0x37a8cb[_0x09b1('0xc')]){case'US':_0x20ab55='https://accounts.zoho.com';break;case'AU':_0x20ab55='https://accounts.zoho.com.au';break;case'IN':_0x20ab55=_0x09b1('0x13');break;case'CN':_0x20ab55=_0x09b1('0x14');break;default:_0x20ab55=_0x09b1('0x15');break;}var _0x5e6263={'method':_0x09b1('0x16'),'uri':_0x20ab55+_0x09b1('0x17'),'form':{'grant_type':_0x09b1('0x18'),'client_id':_0x37a8cb[_0x09b1('0xe')],'client_secret':_0x37a8cb['clientSecret'],'redirect_uri':_0x37a8cb['serverUrl'],'code':_0x37a8cb[_0x09b1('0x10')]},'headers':{'Content-Type':_0x09b1('0x19')}};return rp(_0x5e6263)[_0x09b1('0x1a')](function(_0x5bfc0a){var _0x4edd9e=JSON[_0x09b1('0x1b')](_0x5bfc0a);if(_0x4edd9e['refresh_token']){_0x37a8cb['refreshToken']=_0x4edd9e[_0x09b1('0x1c')];logger[_0x09b1('0x1d')](util[_0x09b1('0x1e')](_0x09b1('0x1f'),_0x37a8cb[_0x09b1('0x20')],_0x37a8cb['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x37a8cb['name'],_0x37a8cb['id']),util[_0x09b1('0x21')](_0x4edd9e,{'showHidden':![],'depth':null}));}return _0x50b96f(null,_0x5490f5);})['catch'](function(_0x306a44){logger[_0x09b1('0x22')](util[_0x09b1('0x1e')](_0x09b1('0x23'),_0x37a8cb[_0x09b1('0x20')],_0x37a8cb['id']),util[_0x09b1('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x50b96f(_0x306a44);});}else{return _0x50b96f(null,_0x5490f5);}},'beforeUpdate':function(_0x2ec405,_0x1f234a,_0x88b03a){if(_0x2ec405['changed'](_0x09b1('0xc'))||_0x2ec405[_0x09b1('0xb')](_0x09b1('0xd'))||_0x2ec405['changed'](_0x09b1('0xe'))||_0x2ec405['changed'](_0x09b1('0xf'))||_0x2ec405['changed'](_0x09b1('0x10'))||_0x2ec405[_0x09b1('0xb')]('host')){var _0x5330cf,_0xf1ab09;_0x5330cf=_0x2ec405['serverUrl'];var _0x3e0334=_0x5330cf[_0x09b1('0x24')](-0x1);if(_0x3e0334==='/'||_0x3e0334==='\x5c'||_0x3e0334===':'){_0x5330cf=_0x5330cf[_0x09b1('0x12')](0x0,_0x5330cf[_0x09b1('0x25')](_0x3e0334));}switch(_0x2ec405[_0x09b1('0xc')]){case'US':_0xf1ab09='https://accounts.zoho.com';break;case'AU':_0xf1ab09=_0x09b1('0x26');break;case'IN':_0xf1ab09=_0x09b1('0x13');break;case'CN':_0xf1ab09=_0x09b1('0x14');break;default:_0xf1ab09=_0x09b1('0x15');break;}var _0x18d48c={'method':'POST','uri':_0xf1ab09+_0x09b1('0x17'),'form':{'grant_type':_0x09b1('0x18'),'client_id':_0x2ec405[_0x09b1('0xe')],'client_secret':_0x2ec405['clientSecret'],'redirect_uri':_0x2ec405[_0x09b1('0xd')],'code':_0x2ec405[_0x09b1('0x10')]},'headers':{'Content-Type':_0x09b1('0x19')}};return rp(_0x18d48c)['then'](function(_0x276c60){var _0x19d50c=JSON[_0x09b1('0x1b')](_0x276c60);if(_0x19d50c[_0x09b1('0x1c')]){_0x2ec405[_0x09b1('0x27')]=_0x19d50c['refresh_token'];logger[_0x09b1('0x1d')](util[_0x09b1('0x1e')](_0x09b1('0x1f'),_0x2ec405[_0x09b1('0x20')],_0x2ec405['id']));}else{logger[_0x09b1('0x22')](util[_0x09b1('0x1e')](_0x09b1('0x23'),_0x2ec405[_0x09b1('0x20')],_0x2ec405['id']),util[_0x09b1('0x21')](_0x19d50c,{'showHidden':![],'depth':null}));}return _0x88b03a(null,_0x1f234a);})[_0x09b1('0x28')](function(_0x297553){logger[_0x09b1('0x22')](util[_0x09b1('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2ec405[_0x09b1('0x20')],_0x2ec405['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x88b03a(_0x297553);});}else{return _0x88b03a(null,_0x1f234a);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 0a55126..5b0a706 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 _0x7079=['stringify','error','code','message','result','catch','findAll','options','where','limit','include','model','attributes','map','GetZohoAccount','debug','ShowZohoAccount','ZohoAccount','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x2768ef,_0x48686f){var _0x3fb4fb=function(_0x183339){while(--_0x183339){_0x2768ef['push'](_0x2768ef['shift']());}};_0x3fb4fb(++_0x48686f);}(_0x7079,0x14e));var _0x9707=function(_0x1d857e,_0x2e006d){_0x1d857e=_0x1d857e-0x0;var _0x41d34c=_0x7079[_0x1d857e];return _0x41d34c;};'use strict';var _=require(_0x9707('0x0'));var util=require('util');var moment=require(_0x9707('0x1'));var BPromise=require(_0x9707('0x2'));var rs=require(_0x9707('0x3'));var fs=require('fs');var Redis=require(_0x9707('0x4'));var db=require(_0x9707('0x5'))['db'];var utils=require(_0x9707('0x6'));var logger=require(_0x9707('0x7'))(_0x9707('0x8'));var config=require('../../config/environment');var jayson=require(_0x9707('0x9'));var client=jayson[_0x9707('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d26f2,_0x4ac88c,_0x557ed9){return new BPromise(function(_0x1e0c56,_0x489e8a){return client[_0x9707('0xb')](_0x3d26f2,_0x557ed9)[_0x9707('0xc')](function(_0x45da54){logger[_0x9707('0xd')](_0x9707('0xe'),_0x4ac88c,'request\x20sent');logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x4ac88c,_0x9707('0xf'),JSON[_0x9707('0x10')](_0x45da54));if(_0x45da54['error']){if(_0x45da54[_0x9707('0x11')][_0x9707('0x12')]===0x1f4){logger[_0x9707('0x11')](_0x9707('0xe'),_0x4ac88c,_0x45da54[_0x9707('0x11')][_0x9707('0x13')]);return _0x489e8a(_0x45da54[_0x9707('0x11')]['message']);}logger[_0x9707('0x11')](_0x9707('0xe'),_0x4ac88c,_0x45da54['error'][_0x9707('0x13')]);return _0x1e0c56(_0x45da54[_0x9707('0x11')][_0x9707('0x13')]);}else{logger['info'](_0x9707('0xe'),_0x4ac88c,_0x9707('0xf'));_0x1e0c56(_0x45da54[_0x9707('0x14')]['message']);}})[_0x9707('0x15')](function(_0x1d1b1c){logger[_0x9707('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x4ac88c,_0x1d1b1c);_0x489e8a(_0x1d1b1c);});});}exports['GetZohoAccount']=function(_0x357fc1){var _0x2bce98=this;return new Promise(function(_0x13e648,_0x54f015){return db['ZohoAccount'][_0x9707('0x16')]({'raw':_0x357fc1[_0x9707('0x17')]?_0x357fc1[_0x9707('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x357fc1[_0x9707('0x17')]?_0x357fc1[_0x9707('0x17')][_0x9707('0x18')]||null:null,'attributes':_0x357fc1['options']?_0x357fc1[_0x9707('0x17')]['attributes']||null:null,'limit':_0x357fc1[_0x9707('0x17')]?_0x357fc1['options'][_0x9707('0x19')]||null:null,'include':_0x357fc1[_0x9707('0x17')]?_0x357fc1['options'][_0x9707('0x1a')]?_['map'](_0x357fc1['options'][_0x9707('0x1a')],function(_0x601f11){return{'model':db[_0x601f11[_0x9707('0x1b')]],'as':_0x601f11['as'],'attributes':_0x601f11[_0x9707('0x1c')],'include':_0x601f11[_0x9707('0x1a')]?_['map'](_0x601f11['include'],function(_0x5d44b5){return{'model':db[_0x5d44b5[_0x9707('0x1b')]],'as':_0x5d44b5['as'],'attributes':_0x5d44b5[_0x9707('0x1c')],'include':_0x5d44b5['include']?_[_0x9707('0x1d')](_0x5d44b5['include'],function(_0x3e27a9){return{'model':db[_0x3e27a9['model']],'as':_0x3e27a9['as'],'attributes':_0x3e27a9[_0x9707('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9707('0xc')](function(_0x1f1fb7){logger[_0x9707('0xd')](_0x9707('0x1e'),_0x357fc1);logger[_0x9707('0x1f')](_0x9707('0x1e'),_0x357fc1,JSON[_0x9707('0x10')](_0x1f1fb7));_0x13e648(_0x1f1fb7);})[_0x9707('0x15')](function(_0x1d6fe2){logger[_0x9707('0x11')]('GetZohoAccount',_0x1d6fe2[_0x9707('0x13')],_0x357fc1);_0x54f015(_0x2bce98[_0x9707('0x11')](0x1f4,_0x1d6fe2['message']));});});};exports[_0x9707('0x20')]=function(_0x213f84){var _0x250583=this;return new Promise(function(_0x58a9f9,_0xb4649c){return db[_0x9707('0x21')]['find']({'raw':_0x213f84[_0x9707('0x17')]?_0x213f84[_0x9707('0x17')][_0x9707('0x22')]===undefined?!![]:![]:!![],'where':_0x213f84[_0x9707('0x17')]?_0x213f84[_0x9707('0x17')][_0x9707('0x18')]||null:null,'attributes':_0x213f84['options']?_0x213f84['options'][_0x9707('0x1c')]||null:null,'include':_0x213f84[_0x9707('0x17')]?_0x213f84[_0x9707('0x17')][_0x9707('0x1a')]?_[_0x9707('0x1d')](_0x213f84[_0x9707('0x17')][_0x9707('0x1a')],function(_0x349eb0){return{'model':db[_0x349eb0[_0x9707('0x1b')]],'as':_0x349eb0['as'],'attributes':_0x349eb0['attributes'],'include':_0x349eb0[_0x9707('0x1a')]?_[_0x9707('0x1d')](_0x349eb0['include'],function(_0x228779){return{'model':db[_0x228779[_0x9707('0x1b')]],'as':_0x228779['as'],'attributes':_0x228779['attributes'],'include':_0x228779[_0x9707('0x1a')]?_['map'](_0x228779[_0x9707('0x1a')],function(_0x203630){return{'model':db[_0x203630['model']],'as':_0x203630['as'],'attributes':_0x203630[_0x9707('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49fd80){logger[_0x9707('0xd')]('ShowZohoAccount',_0x213f84);logger[_0x9707('0x1f')]('ShowZohoAccount',_0x213f84,JSON['stringify'](_0x49fd80));_0x58a9f9(_0x49fd80);})['catch'](function(_0x1044e9){logger[_0x9707('0x11')](_0x9707('0x20'),_0x1044e9['message'],_0x213f84);_0xb4649c(_0x250583['error'](0x1f4,_0x1044e9[_0x9707('0x13')]));});});}; \ No newline at end of file +var _0x8bf1=['then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowZohoAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x3a641d,_0x3b7e86){var _0x3c6f61=function(_0x13beac){while(--_0x13beac){_0x3a641d['push'](_0x3a641d['shift']());}};_0x3c6f61(++_0x3b7e86);}(_0x8bf1,0x65));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x18bf('0x0'));var util=require('util');var moment=require(_0x18bf('0x1'));var BPromise=require(_0x18bf('0x2'));var rs=require(_0x18bf('0x3'));var fs=require('fs');var Redis=require(_0x18bf('0x4'));var db=require(_0x18bf('0x5'))['db'];var utils=require(_0x18bf('0x6'));var logger=require(_0x18bf('0x7'))('rpc');var config=require(_0x18bf('0x8'));var jayson=require(_0x18bf('0x9'));var client=jayson[_0x18bf('0xa')][_0x18bf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c9ff4,_0x11f704,_0x19d1d0){return new BPromise(function(_0x17c07f,_0x377d53){return client[_0x18bf('0xc')](_0x5c9ff4,_0x19d1d0)[_0x18bf('0xd')](function(_0x4aba20){logger[_0x18bf('0xe')](_0x18bf('0xf'),_0x11f704,'request\x20sent');logger[_0x18bf('0x10')](_0x18bf('0x11'),_0x11f704,_0x18bf('0x12'),JSON[_0x18bf('0x13')](_0x4aba20));if(_0x4aba20[_0x18bf('0x14')]){if(_0x4aba20[_0x18bf('0x14')][_0x18bf('0x15')]===0x1f4){logger[_0x18bf('0x14')](_0x18bf('0xf'),_0x11f704,_0x4aba20['error'][_0x18bf('0x16')]);return _0x377d53(_0x4aba20[_0x18bf('0x14')]['message']);}logger[_0x18bf('0x14')](_0x18bf('0xf'),_0x11f704,_0x4aba20[_0x18bf('0x14')]['message']);return _0x17c07f(_0x4aba20[_0x18bf('0x14')]['message']);}else{logger[_0x18bf('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x11f704,_0x18bf('0x12'));_0x17c07f(_0x4aba20[_0x18bf('0x17')][_0x18bf('0x16')]);}})[_0x18bf('0x18')](function(_0x5d72a5){logger[_0x18bf('0x14')](_0x18bf('0xf'),_0x11f704,_0x5d72a5);_0x377d53(_0x5d72a5);});});}exports[_0x18bf('0x19')]=function(_0x29424c){var _0x331456=this;return new Promise(function(_0x33c1a4,_0x4207f4){return db[_0x18bf('0x1a')][_0x18bf('0x1b')]({'raw':_0x29424c[_0x18bf('0x1c')]?_0x29424c[_0x18bf('0x1c')][_0x18bf('0x1d')]===undefined?!![]:![]:!![],'where':_0x29424c[_0x18bf('0x1c')]?_0x29424c[_0x18bf('0x1c')][_0x18bf('0x1e')]||null:null,'attributes':_0x29424c[_0x18bf('0x1c')]?_0x29424c['options'][_0x18bf('0x1f')]||null:null,'limit':_0x29424c[_0x18bf('0x1c')]?_0x29424c[_0x18bf('0x1c')][_0x18bf('0x20')]||null:null,'include':_0x29424c[_0x18bf('0x1c')]?_0x29424c[_0x18bf('0x1c')][_0x18bf('0x21')]?_['map'](_0x29424c[_0x18bf('0x1c')]['include'],function(_0x214a89){return{'model':db[_0x214a89[_0x18bf('0x22')]],'as':_0x214a89['as'],'attributes':_0x214a89[_0x18bf('0x1f')],'include':_0x214a89[_0x18bf('0x21')]?_[_0x18bf('0x23')](_0x214a89[_0x18bf('0x21')],function(_0xf88e2c){return{'model':db[_0xf88e2c['model']],'as':_0xf88e2c['as'],'attributes':_0xf88e2c[_0x18bf('0x1f')],'include':_0xf88e2c[_0x18bf('0x21')]?_[_0x18bf('0x23')](_0xf88e2c[_0x18bf('0x21')],function(_0x146233){return{'model':db[_0x146233[_0x18bf('0x22')]],'as':_0x146233['as'],'attributes':_0x146233[_0x18bf('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x18bf('0xd')](function(_0x45ca23){logger[_0x18bf('0xe')](_0x18bf('0x19'),_0x29424c);logger[_0x18bf('0x10')](_0x18bf('0x19'),_0x29424c,JSON[_0x18bf('0x13')](_0x45ca23));_0x33c1a4(_0x45ca23);})[_0x18bf('0x18')](function(_0x5185d0){logger['error'](_0x18bf('0x19'),_0x5185d0[_0x18bf('0x16')],_0x29424c);_0x4207f4(_0x331456[_0x18bf('0x14')](0x1f4,_0x5185d0[_0x18bf('0x16')]));});});};exports[_0x18bf('0x24')]=function(_0x2e6990){var _0x42c159=this;return new Promise(function(_0x5151b1,_0x5cc257){return db[_0x18bf('0x1a')][_0x18bf('0x25')]({'raw':_0x2e6990[_0x18bf('0x1c')]?_0x2e6990[_0x18bf('0x1c')][_0x18bf('0x1d')]===undefined?!![]:![]:!![],'where':_0x2e6990['options']?_0x2e6990[_0x18bf('0x1c')]['where']||null:null,'attributes':_0x2e6990['options']?_0x2e6990[_0x18bf('0x1c')][_0x18bf('0x1f')]||null:null,'include':_0x2e6990[_0x18bf('0x1c')]?_0x2e6990[_0x18bf('0x1c')][_0x18bf('0x21')]?_[_0x18bf('0x23')](_0x2e6990['options'][_0x18bf('0x21')],function(_0x1324a0){return{'model':db[_0x1324a0[_0x18bf('0x22')]],'as':_0x1324a0['as'],'attributes':_0x1324a0[_0x18bf('0x1f')],'include':_0x1324a0['include']?_[_0x18bf('0x23')](_0x1324a0[_0x18bf('0x21')],function(_0x56a2d4){return{'model':db[_0x56a2d4[_0x18bf('0x22')]],'as':_0x56a2d4['as'],'attributes':_0x56a2d4[_0x18bf('0x1f')],'include':_0x56a2d4[_0x18bf('0x21')]?_[_0x18bf('0x23')](_0x56a2d4[_0x18bf('0x21')],function(_0x594e8e){return{'model':db[_0x594e8e[_0x18bf('0x22')]],'as':_0x594e8e['as'],'attributes':_0x594e8e[_0x18bf('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4269e2){logger[_0x18bf('0xe')](_0x18bf('0x24'),_0x2e6990);logger[_0x18bf('0x10')](_0x18bf('0x24'),_0x2e6990,JSON['stringify'](_0x4269e2));_0x5151b1(_0x4269e2);})['catch'](function(_0x42648e){logger[_0x18bf('0x14')](_0x18bf('0x24'),_0x42648e[_0x18bf('0x16')],_0x2e6990);_0x5cc257(_0x42c159[_0x18bf('0x14')](0x1f4,_0x42648e['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 536f333..fa8e072 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 _0xfbac=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./intZohoConfiguration.controller','get','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','/:id'];(function(_0x41eba1,_0x1cc7fe){var _0xd16b20=function(_0x8ff61c){while(--_0x8ff61c){_0x41eba1['push'](_0x41eba1['shift']());}};_0xd16b20(++_0x1cc7fe);}(_0xfbac,0x167));var _0xcfba=function(_0x262c91,_0x1c16d1){_0x262c91=_0x262c91-0x0;var _0x272a75=_0xfbac[_0x262c91];return _0x272a75;};'use strict';var multer=require('multer');var util=require(_0xcfba('0x0'));var path=require(_0xcfba('0x1'));var timeout=require(_0xcfba('0x2'));var express=require(_0xcfba('0x3'));var router=express[_0xcfba('0x4')]();var auth=require(_0xcfba('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcfba('0x6'));router[_0xcfba('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcfba('0x7')]('/:id',auth[_0xcfba('0x8')](),controller['show']);router[_0xcfba('0x7')](_0xcfba('0x9'),auth['isAuthenticated'](),controller[_0xcfba('0xa')]);router[_0xcfba('0x7')](_0xcfba('0xb'),auth[_0xcfba('0x8')](),controller[_0xcfba('0xc')]);router[_0xcfba('0x7')](_0xcfba('0xd'),auth[_0xcfba('0x8')](),controller[_0xcfba('0xe')]);router[_0xcfba('0xf')]('/',auth[_0xcfba('0x8')](),controller[_0xcfba('0x10')]);router['put']('/:id',auth[_0xcfba('0x8')](),controller[_0xcfba('0x11')]);router['delete'](_0xcfba('0x12'),auth[_0xcfba('0x8')](),controller[_0xcfba('0x13')]);module[_0xcfba('0x14')]=router; \ No newline at end of file +var _0x3360=['./intZohoConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getDescriptions','post','create','/:id','update','delete','destroy','exports','multer','util','Router','../../config/environment'];(function(_0x50eac1,_0x22003d){var _0x51770c=function(_0x1db69b){while(--_0x1db69b){_0x50eac1['push'](_0x50eac1['shift']());}};_0x51770c(++_0x22003d);}(_0x3360,0x1d7));var _0x0336=function(_0x59139b,_0x2d3dac){_0x59139b=_0x59139b-0x0;var _0x28afa4=_0x3360[_0x59139b];return _0x28afa4;};'use strict';var multer=require(_0x0336('0x0'));var util=require(_0x0336('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0336('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0336('0x3'));var controller=require(_0x0336('0x4'));router[_0x0336('0x5')]('/',auth[_0x0336('0x6')](),controller[_0x0336('0x7')]);router['get']('/:id',auth[_0x0336('0x6')](),controller[_0x0336('0x8')]);router[_0x0336('0x5')](_0x0336('0x9'),auth[_0x0336('0x6')](),controller['getFields']);router[_0x0336('0x5')](_0x0336('0xa'),auth[_0x0336('0x6')](),controller['getSubjects']);router[_0x0336('0x5')]('/:id/descriptions',auth[_0x0336('0x6')](),controller[_0x0336('0xb')]);router[_0x0336('0xc')]('/',auth[_0x0336('0x6')](),controller[_0x0336('0xd')]);router['put'](_0x0336('0xe'),auth[_0x0336('0x6')](),controller[_0x0336('0xf')]);router[_0x0336('0x10')](_0x0336('0xe'),auth['isAuthenticated'](),controller[_0x0336('0x11')]);module[_0x0336('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 597527a..bf2cc23 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 _0x337c=['ENUM','contact','lead','contact_lead','STRING','exports'];(function(_0x10ddf7,_0x1d8946){var _0x4f5fa8=function(_0x2a4e57){while(--_0x2a4e57){_0x10ddf7['push'](_0x10ddf7['shift']());}};_0x4f5fa8(++_0x1d8946);}(_0x337c,0x185));var _0xc337=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x337c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc337('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xc337('0x1')]('lead',_0xc337('0x2'),'nothing'),'defaultValue':_0xc337('0x3')},'moduleSearch':{'type':Sequelize[_0xc337('0x1')](_0xc337('0x4'),_0xc337('0x2'),_0xc337('0x3')),'defaultValue':_0xc337('0x4')},'description':{'type':Sequelize[_0xc337('0x5')]}}; \ No newline at end of file +var _0xf081=['STRING','ENUM','contact','nothing','lead','contact_lead','exports'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xf081,0x1b1));var _0x1f08=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xf081[_0x9dfc10];return _0x4f938a;};'use strict';var Sequelize=require('sequelize');module[_0x1f08('0x0')]={'name':{'type':Sequelize[_0x1f08('0x1')]},'moduleCreate':{'type':Sequelize[_0x1f08('0x2')]('lead',_0x1f08('0x3'),_0x1f08('0x4')),'defaultValue':_0x1f08('0x5')},'moduleSearch':{'type':Sequelize[_0x1f08('0x2')](_0x1f08('0x6'),_0x1f08('0x3'),_0x1f08('0x5')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x1f08('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index f4d31e0..7b40f0d 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 _0xae45=['name','index','map','ZohoConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','ZohoField','getFields','nolimit','getSubjects','findOne','getDescriptions','html-pdf','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae45,0x1a4));var _0x5ae4=function(_0x2c368a,_0x44de88){_0x2c368a=_0x2c368a-0x0;var _0x556d55=_0xae45[_0x2c368a];return _0x556d55;};'use strict';var pdf=require(_0x5ae4('0x0'));var emlformat=require(_0x5ae4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5ae4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ae4('0x3'));var moment=require(_0x5ae4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5ae4('0x5'));var path=require(_0x5ae4('0x6'));var sox=require(_0x5ae4('0x7'));var csv=require(_0x5ae4('0x8'));var ejs=require(_0x5ae4('0x9'));var fs=require('fs');var _=require(_0x5ae4('0xa'));var squel=require(_0x5ae4('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5ae4('0xc'));var toCsv=require(_0x5ae4('0x8'));var querystring=require(_0x5ae4('0xd'));var Papa=require(_0x5ae4('0xe'));var Redis=require(_0x5ae4('0xf'));var authService=require(_0x5ae4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5ae4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ae4('0x12'))(_0x5ae4('0x13'));var utils=require(_0x5ae4('0x14'));var config=require(_0x5ae4('0x15'));var db=require(_0x5ae4('0x16'))['db'];var jayson=require(_0x5ae4('0x17'));var client=jayson[_0x5ae4('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x3c8e0d,_0x340bbf,_0x1b7bc9){if(_0x1b7bc9){var _0x3997f0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3997f0[_0x5ae4('0x19')](_0x340bbf)){return _0x3c8e0d;}else{throw new db[(_0x5ae4('0x1a'))][(_0x5ae4('0x1b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3c8e0d;}}function respondWithRpcPromise(_0x64ddc9,_0x26abeb,_0x19e53f,_0x4ad993){return new BPromise(function(_0x35acf9,_0x52d20c){var _0x37df54=_0x4ad993||client;return _0x37df54[_0x5ae4('0x1c')](_0x64ddc9,_0x19e53f)[_0x5ae4('0x1d')](function(_0x2a02d6){logger[_0x5ae4('0x1e')](_0x5ae4('0x1f'),_0x26abeb,_0x5ae4('0x20'));logger[_0x5ae4('0x21')](_0x5ae4('0x22'),_0x26abeb,_0x5ae4('0x20'),JSON[_0x5ae4('0x23')](_0x2a02d6));if(_0x2a02d6[_0x5ae4('0x24')]){if(_0x2a02d6[_0x5ae4('0x24')][_0x5ae4('0x25')]===0x1f4){logger[_0x5ae4('0x24')](_0x5ae4('0x1f'),_0x26abeb,_0x2a02d6['error'][_0x5ae4('0x26')]);return _0x52d20c(_0x2a02d6[_0x5ae4('0x24')][_0x5ae4('0x26')]);}logger[_0x5ae4('0x24')](_0x5ae4('0x1f'),_0x26abeb,_0x2a02d6[_0x5ae4('0x24')][_0x5ae4('0x26')]);return _0x35acf9(_0x2a02d6[_0x5ae4('0x24')][_0x5ae4('0x26')]);}else{logger['info'](_0x5ae4('0x1f'),_0x26abeb,_0x5ae4('0x20'));_0x35acf9(_0x2a02d6[_0x5ae4('0x27')][_0x5ae4('0x26')]);}})[_0x5ae4('0x28')](function(_0x1cf548){logger[_0x5ae4('0x24')](_0x5ae4('0x1f'),_0x26abeb,_0x1cf548);_0x52d20c(_0x1cf548);});});}function respondWithStatusCode(_0x43b49d,_0x40bd4b){_0x40bd4b=_0x40bd4b||0xcc;return function(_0x48d282){if(_0x48d282){return _0x43b49d[_0x5ae4('0x29')](_0x40bd4b);}return _0x43b49d[_0x5ae4('0x2a')](_0x40bd4b)[_0x5ae4('0x2b')]();};}function respondWithResult(_0x58b490,_0x407851){_0x407851=_0x407851||0xc8;return function(_0x56c3ed){if(_0x56c3ed){return _0x58b490['status'](_0x407851)[_0x5ae4('0x2c')](_0x56c3ed);}};}function respondWithFilteredResult(_0x1a34e5,_0x2b90ae){return function(_0x4c4c57){if(_0x4c4c57){var _0x4d2b6c=_0x4c4c57[_0x5ae4('0x2d')],_0x5533a7=_0x2b90ae[_0x5ae4('0x2e')],_0x5c0a3a=_0x2b90ae['offset']+_0x2b90ae[_0x5ae4('0x2f')],_0x25fcb3;if(_0x5c0a3a>=_0x4d2b6c){_0x5c0a3a=_0x4d2b6c;_0x25fcb3=0xc8;}else{_0x25fcb3=0xce;}_0x1a34e5['status'](_0x25fcb3);return _0x1a34e5[_0x5ae4('0x30')]('Content-Range',_0x5533a7+'-'+_0x5c0a3a+'/'+_0x4d2b6c)['json'](_0x4c4c57);}return null;};}function patchUpdates(_0x41c0aa){return function(_0x56b7db){try{jsonpatch[_0x5ae4('0x31')](_0x56b7db,_0x41c0aa,!![]);}catch(_0x6e12ec){return BPromise[_0x5ae4('0x32')](_0x6e12ec);}return _0x56b7db[_0x5ae4('0x33')]();};}function saveUpdates(_0x4798de,_0x3d939d){return function(_0x42ef34){if(_0x42ef34){return _0x42ef34[_0x5ae4('0x34')](_0x4798de)['then'](function(_0x16abea){return _0x16abea;});}return null;};}function removeEntity(_0x491ad5,_0x6f7ad6){return function(_0x41364c){if(_0x41364c){return _0x41364c[_0x5ae4('0x35')]()[_0x5ae4('0x1d')](function(){_0x491ad5[_0x5ae4('0x2a')](0xcc)[_0x5ae4('0x2b')]();});}};}function handleEntityNotFound(_0x1832f3,_0x2b2805){return function(_0x3efd63){if(!_0x3efd63){_0x1832f3[_0x5ae4('0x29')](0x194);}return _0x3efd63;};}function handleError(_0x5e46a1,_0x463f2e){_0x463f2e=_0x463f2e||0x1f4;return function(_0x57ce15){logger[_0x5ae4('0x24')](_0x57ce15[_0x5ae4('0x36')]);if(_0x57ce15[_0x5ae4('0x37')]){delete _0x57ce15['name'];}_0x5e46a1[_0x5ae4('0x2a')](_0x463f2e)['send'](_0x57ce15);};}exports[_0x5ae4('0x38')]=function(_0x30edd2,_0x148f24){var _0x41a749={},_0x210951={},_0x26dc9d={'count':0x0,'rows':[]};var _0x23c649=_[_0x5ae4('0x39')](db[_0x5ae4('0x3a')]['rawAttributes'],function(_0x6ecfa3){return{'name':_0x6ecfa3[_0x5ae4('0x3b')],'type':_0x6ecfa3[_0x5ae4('0x3c')][_0x5ae4('0x3d')]};});_0x210951[_0x5ae4('0x3e')]=_[_0x5ae4('0x39')](_0x23c649,_0x5ae4('0x37'));_0x210951[_0x5ae4('0x3f')]=_[_0x5ae4('0x40')](_0x30edd2[_0x5ae4('0x3f')]);_0x210951[_0x5ae4('0x41')]=_[_0x5ae4('0x42')](_0x210951[_0x5ae4('0x3e')],_0x210951['query']);_0x41a749[_0x5ae4('0x43')]=_[_0x5ae4('0x42')](_0x210951['model'],qs['fields'](_0x30edd2[_0x5ae4('0x3f')][_0x5ae4('0x44')]));_0x41a749[_0x5ae4('0x43')]=_0x41a749[_0x5ae4('0x43')][_0x5ae4('0x45')]?_0x41a749[_0x5ae4('0x43')]:_0x210951[_0x5ae4('0x3e')];if(!_0x30edd2['query'][_0x5ae4('0x46')]('nolimit')){_0x41a749[_0x5ae4('0x2f')]=qs[_0x5ae4('0x2f')](_0x30edd2[_0x5ae4('0x3f')][_0x5ae4('0x2f')]);_0x41a749['offset']=qs[_0x5ae4('0x2e')](_0x30edd2[_0x5ae4('0x3f')]['offset']);}_0x41a749[_0x5ae4('0x47')]=qs[_0x5ae4('0x48')](_0x30edd2[_0x5ae4('0x3f')][_0x5ae4('0x48')]);_0x41a749[_0x5ae4('0x49')]=qs[_0x5ae4('0x41')](_[_0x5ae4('0x4a')](_0x30edd2['query'],_0x210951['filters']),_0x23c649);if(_0x30edd2['query'][_0x5ae4('0x4b')]){_0x41a749[_0x5ae4('0x49')]=_[_0x5ae4('0x4c')](_0x41a749[_0x5ae4('0x49')],{'$or':_[_0x5ae4('0x39')](_0x23c649,function(_0x3c32bc){if(_0x3c32bc[_0x5ae4('0x3c')]!==_0x5ae4('0x4d')){var _0x26f228={};_0x26f228[_0x3c32bc[_0x5ae4('0x37')]]={'$like':'%'+_0x30edd2[_0x5ae4('0x3f')][_0x5ae4('0x4b')]+'%'};return _0x26f228;}})});}_0x41a749=_[_0x5ae4('0x4c')]({},_0x41a749,_0x30edd2['options']);var _0x20036b={'where':_0x41a749[_0x5ae4('0x49')]};return db[_0x5ae4('0x3a')]['count'](_0x20036b)['then'](function(_0x215c89){_0x26dc9d[_0x5ae4('0x2d')]=_0x215c89;if(_0x30edd2[_0x5ae4('0x3f')][_0x5ae4('0x4e')]){_0x41a749[_0x5ae4('0x4f')]=[{'all':!![]}];}return db[_0x5ae4('0x3a')][_0x5ae4('0x50')](_0x41a749);})[_0x5ae4('0x1d')](function(_0x275122){_0x26dc9d[_0x5ae4('0x51')]=_0x275122;return _0x26dc9d;})[_0x5ae4('0x1d')](respondWithFilteredResult(_0x148f24,_0x41a749))[_0x5ae4('0x28')](handleError(_0x148f24,null));};exports[_0x5ae4('0x52')]=function(_0x31004c,_0x185399){var _0x4bddc1={'raw':![],'where':{'id':_0x31004c[_0x5ae4('0x53')]['id']}},_0x252c9f={};_0x252c9f[_0x5ae4('0x3e')]=_['keys'](db[_0x5ae4('0x3a')][_0x5ae4('0x54')]);_0x252c9f['query']=_[_0x5ae4('0x40')](_0x31004c[_0x5ae4('0x3f')]);_0x252c9f['filters']=_[_0x5ae4('0x42')](_0x252c9f[_0x5ae4('0x3e')],_0x252c9f[_0x5ae4('0x3f')]);_0x4bddc1[_0x5ae4('0x43')]=_[_0x5ae4('0x42')](_0x252c9f[_0x5ae4('0x3e')],qs[_0x5ae4('0x44')](_0x31004c[_0x5ae4('0x3f')][_0x5ae4('0x44')]));_0x4bddc1[_0x5ae4('0x43')]=_0x4bddc1[_0x5ae4('0x43')][_0x5ae4('0x45')]?_0x4bddc1[_0x5ae4('0x43')]:_0x252c9f[_0x5ae4('0x3e')];if(_0x31004c[_0x5ae4('0x3f')][_0x5ae4('0x4e')]){_0x4bddc1[_0x5ae4('0x4f')]=[{'all':!![]}];}_0x4bddc1=_[_0x5ae4('0x4c')]({},_0x4bddc1,_0x31004c[_0x5ae4('0x55')]);return db['ZohoConfiguration'][_0x5ae4('0x56')](_0x4bddc1)[_0x5ae4('0x1d')](handleEntityNotFound(_0x185399,null))[_0x5ae4('0x1d')](respondWithResult(_0x185399,null))[_0x5ae4('0x28')](handleError(_0x185399,null));};exports[_0x5ae4('0x57')]=function(_0x560c7f,_0x5d6ef1){return db['ZohoConfiguration'][_0x5ae4('0x57')](_0x560c7f[_0x5ae4('0x58')],{})[_0x5ae4('0x1d')](respondWithResult(_0x5d6ef1,0xc9))[_0x5ae4('0x28')](handleError(_0x5d6ef1,null));};exports[_0x5ae4('0x34')]=function(_0x413bbe,_0x5db9f8){if(_0x413bbe[_0x5ae4('0x58')]['id']){delete _0x413bbe['body']['id'];}return db[_0x5ae4('0x3a')]['find']({'where':{'id':_0x413bbe[_0x5ae4('0x53')]['id']}})[_0x5ae4('0x1d')](handleEntityNotFound(_0x5db9f8,null))['then'](saveUpdates(_0x413bbe['body'],null))[_0x5ae4('0x1d')](respondWithResult(_0x5db9f8,null))[_0x5ae4('0x28')](handleError(_0x5db9f8,null));};exports[_0x5ae4('0x35')]=function(_0x2b04f6,_0x4c81e9){return db[_0x5ae4('0x3a')][_0x5ae4('0x56')]({'where':{'id':_0x2b04f6[_0x5ae4('0x53')]['id']}})[_0x5ae4('0x1d')](handleEntityNotFound(_0x4c81e9,null))['then'](removeEntity(_0x4c81e9,null))[_0x5ae4('0x28')](handleError(_0x4c81e9,null));};exports['getFields']=function(_0x5c9a8c,_0x18f4b9,_0x1e7956){var _0xf08d6d={};var _0x32623a={};var _0xa6af0d;var _0x3f64d5;return db[_0x5ae4('0x3a')]['findOne']({'where':{'id':_0x5c9a8c[_0x5ae4('0x53')]['id']}})[_0x5ae4('0x1d')](handleEntityNotFound(_0x18f4b9,null))[_0x5ae4('0x1d')](function(_0xf74c86){if(_0xf74c86){_0xa6af0d=_0xf74c86;_0x32623a[_0x5ae4('0x3e')]=_[_0x5ae4('0x40')](db[_0x5ae4('0x59')][_0x5ae4('0x54')]);_0x32623a[_0x5ae4('0x3f')]=_[_0x5ae4('0x40')](_0x5c9a8c[_0x5ae4('0x3f')]);_0x32623a[_0x5ae4('0x41')]=_[_0x5ae4('0x42')](_0x32623a[_0x5ae4('0x3e')],_0x32623a['query']);_0xf08d6d['attributes']=_[_0x5ae4('0x42')](_0x32623a[_0x5ae4('0x3e')],qs[_0x5ae4('0x44')](_0x5c9a8c[_0x5ae4('0x3f')]['fields']));_0xf08d6d[_0x5ae4('0x43')]=_0xf08d6d[_0x5ae4('0x43')][_0x5ae4('0x45')]?_0xf08d6d[_0x5ae4('0x43')]:_0x32623a['model'];_0xf08d6d[_0x5ae4('0x47')]=qs[_0x5ae4('0x48')](_0x5c9a8c[_0x5ae4('0x3f')][_0x5ae4('0x48')]);_0xf08d6d['where']=qs['filters'](_[_0x5ae4('0x4a')](_0x5c9a8c['query'],_0x32623a[_0x5ae4('0x41')]));if(_0x5c9a8c[_0x5ae4('0x3f')][_0x5ae4('0x4b')]){_0xf08d6d[_0x5ae4('0x49')]=_[_0x5ae4('0x4c')](_0xf08d6d[_0x5ae4('0x49')],{'$or':_[_0x5ae4('0x39')](_0xf08d6d[_0x5ae4('0x43')],function(_0x53f437){var _0xa04a09={};_0xa04a09[_0x53f437]={'$like':'%'+_0x5c9a8c[_0x5ae4('0x3f')][_0x5ae4('0x4b')]+'%'};return _0xa04a09;})});}_0xf08d6d=_[_0x5ae4('0x4c')]({},_0xf08d6d,_0x5c9a8c['options']);return _0xa6af0d[_0x5ae4('0x5a')](_0xf08d6d);}})['then'](function(_0x3d3cb7){if(_0x3d3cb7){_0x3f64d5=_0x3d3cb7['length'];if(!_0x5c9a8c[_0x5ae4('0x3f')]['hasOwnProperty'](_0x5ae4('0x5b'))){_0xf08d6d[_0x5ae4('0x2f')]=qs[_0x5ae4('0x2f')](_0x5c9a8c[_0x5ae4('0x3f')][_0x5ae4('0x2f')]);_0xf08d6d['offset']=qs[_0x5ae4('0x2e')](_0x5c9a8c[_0x5ae4('0x3f')][_0x5ae4('0x2e')]);}return _0xa6af0d[_0x5ae4('0x5a')](_0xf08d6d);}})['then'](function(_0x226a7f){if(_0x226a7f){return _0x226a7f?{'count':_0x3f64d5,'rows':_0x226a7f}:null;}})[_0x5ae4('0x1d')](respondWithResult(_0x18f4b9,null))[_0x5ae4('0x28')](handleError(_0x18f4b9,null));};exports[_0x5ae4('0x5c')]=function(_0x179649,_0x3955cb,_0x53e7c0){var _0xa374e6={};var _0x29fd91={};var _0x1720c1;var _0x288104;return db[_0x5ae4('0x3a')][_0x5ae4('0x5d')]({'where':{'id':_0x179649[_0x5ae4('0x53')]['id']}})[_0x5ae4('0x1d')](handleEntityNotFound(_0x3955cb,null))[_0x5ae4('0x1d')](function(_0x1e7497){if(_0x1e7497){_0x1720c1=_0x1e7497;_0x29fd91['model']=_[_0x5ae4('0x40')](db[_0x5ae4('0x59')]['rawAttributes']);_0x29fd91[_0x5ae4('0x3f')]=_[_0x5ae4('0x40')](_0x179649['query']);_0x29fd91[_0x5ae4('0x41')]=_[_0x5ae4('0x42')](_0x29fd91[_0x5ae4('0x3e')],_0x29fd91['query']);_0xa374e6[_0x5ae4('0x43')]=_[_0x5ae4('0x42')](_0x29fd91[_0x5ae4('0x3e')],qs[_0x5ae4('0x44')](_0x179649[_0x5ae4('0x3f')]['fields']));_0xa374e6[_0x5ae4('0x43')]=_0xa374e6[_0x5ae4('0x43')][_0x5ae4('0x45')]?_0xa374e6['attributes']:_0x29fd91[_0x5ae4('0x3e')];_0xa374e6['order']=qs[_0x5ae4('0x48')](_0x179649['query'][_0x5ae4('0x48')]);_0xa374e6[_0x5ae4('0x49')]=qs[_0x5ae4('0x41')](_[_0x5ae4('0x4a')](_0x179649[_0x5ae4('0x3f')],_0x29fd91['filters']));if(_0x179649[_0x5ae4('0x3f')]['filter']){_0xa374e6[_0x5ae4('0x49')]=_['merge'](_0xa374e6[_0x5ae4('0x49')],{'$or':_['map'](_0xa374e6['attributes'],function(_0x34e9c2){var _0x297610={};_0x297610[_0x34e9c2]={'$like':'%'+_0x179649[_0x5ae4('0x3f')]['filter']+'%'};return _0x297610;})});}_0xa374e6=_[_0x5ae4('0x4c')]({},_0xa374e6,_0x179649['options']);return _0x1720c1[_0x5ae4('0x5c')](_0xa374e6);}})[_0x5ae4('0x1d')](function(_0x2eee9a){if(_0x2eee9a){_0x288104=_0x2eee9a[_0x5ae4('0x45')];if(!_0x179649[_0x5ae4('0x3f')]['hasOwnProperty']('nolimit')){_0xa374e6[_0x5ae4('0x2f')]=qs[_0x5ae4('0x2f')](_0x179649[_0x5ae4('0x3f')][_0x5ae4('0x2f')]);_0xa374e6[_0x5ae4('0x2e')]=qs[_0x5ae4('0x2e')](_0x179649[_0x5ae4('0x3f')]['offset']);}return _0x1720c1[_0x5ae4('0x5c')](_0xa374e6);}})[_0x5ae4('0x1d')](function(_0xafb4d3){if(_0xafb4d3){return _0xafb4d3?{'count':_0x288104,'rows':_0xafb4d3}:null;}})[_0x5ae4('0x1d')](respondWithResult(_0x3955cb,null))[_0x5ae4('0x28')](handleError(_0x3955cb,null));};exports['getDescriptions']=function(_0x32981a,_0x37b05d,_0x57729a){var _0x21e9ba={};var _0x4efd46={};var _0x13a8bc;var _0x235303;return db[_0x5ae4('0x3a')][_0x5ae4('0x5d')]({'where':{'id':_0x32981a[_0x5ae4('0x53')]['id']}})[_0x5ae4('0x1d')](handleEntityNotFound(_0x37b05d,null))[_0x5ae4('0x1d')](function(_0x3d516a){if(_0x3d516a){_0x13a8bc=_0x3d516a;_0x4efd46['model']=_[_0x5ae4('0x40')](db['ZohoField'][_0x5ae4('0x54')]);_0x4efd46[_0x5ae4('0x3f')]=_[_0x5ae4('0x40')](_0x32981a[_0x5ae4('0x3f')]);_0x4efd46[_0x5ae4('0x41')]=_[_0x5ae4('0x42')](_0x4efd46['model'],_0x4efd46[_0x5ae4('0x3f')]);_0x21e9ba[_0x5ae4('0x43')]=_[_0x5ae4('0x42')](_0x4efd46[_0x5ae4('0x3e')],qs['fields'](_0x32981a[_0x5ae4('0x3f')][_0x5ae4('0x44')]));_0x21e9ba[_0x5ae4('0x43')]=_0x21e9ba['attributes'][_0x5ae4('0x45')]?_0x21e9ba[_0x5ae4('0x43')]:_0x4efd46[_0x5ae4('0x3e')];_0x21e9ba[_0x5ae4('0x47')]=qs[_0x5ae4('0x48')](_0x32981a[_0x5ae4('0x3f')]['sort']);_0x21e9ba[_0x5ae4('0x49')]=qs['filters'](_[_0x5ae4('0x4a')](_0x32981a[_0x5ae4('0x3f')],_0x4efd46[_0x5ae4('0x41')]));if(_0x32981a[_0x5ae4('0x3f')][_0x5ae4('0x4b')]){_0x21e9ba[_0x5ae4('0x49')]=_['merge'](_0x21e9ba[_0x5ae4('0x49')],{'$or':_[_0x5ae4('0x39')](_0x21e9ba[_0x5ae4('0x43')],function(_0x119f9f){var _0x1d6817={};_0x1d6817[_0x119f9f]={'$like':'%'+_0x32981a[_0x5ae4('0x3f')][_0x5ae4('0x4b')]+'%'};return _0x1d6817;})});}_0x21e9ba=_[_0x5ae4('0x4c')]({},_0x21e9ba,_0x32981a['options']);return _0x13a8bc[_0x5ae4('0x5e')](_0x21e9ba);}})['then'](function(_0x18fbc1){if(_0x18fbc1){_0x235303=_0x18fbc1['length'];if(!_0x32981a[_0x5ae4('0x3f')][_0x5ae4('0x46')](_0x5ae4('0x5b'))){_0x21e9ba['limit']=qs[_0x5ae4('0x2f')](_0x32981a['query'][_0x5ae4('0x2f')]);_0x21e9ba['offset']=qs['offset'](_0x32981a[_0x5ae4('0x3f')][_0x5ae4('0x2e')]);}return _0x13a8bc[_0x5ae4('0x5e')](_0x21e9ba);}})[_0x5ae4('0x1d')](function(_0x3bf17e){if(_0x3bf17e){return _0x3bf17e?{'count':_0x235303,'rows':_0x3bf17e}:null;}})[_0x5ae4('0x1d')](respondWithResult(_0x37b05d,null))[_0x5ae4('0x28')](handleError(_0x37b05d,null));}; \ No newline at end of file +var _0xd98a=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','ValidationError','then','info','request\x20sent','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','ZohoConfiguration','findAll','rows','show','params','find','create','body','getFields','ZohoField','nolimit','getSubjects','getDescriptions','findOne','html-pdf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','squel'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd98a,0xa8));var _0xad98=function(_0xaf9d89,_0x488464){_0xaf9d89=_0xaf9d89-0x0;var _0x2c1625=_0xd98a[_0xaf9d89];return _0x2c1625;};'use strict';var pdf=require(_0xad98('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xad98('0x1'));var jsonpatch=require(_0xad98('0x2'));var rp=require('request-promise');var moment=require(_0xad98('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xad98('0x4'));var util=require(_0xad98('0x5'));var path=require(_0xad98('0x6'));var sox=require(_0xad98('0x7'));var csv=require(_0xad98('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xad98('0x9'));var crypto=require(_0xad98('0xa'));var jsforce=require(_0xad98('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xad98('0x8'));var querystring=require(_0xad98('0xc'));var Papa=require(_0xad98('0xd'));var Redis=require(_0xad98('0xe'));var authService=require(_0xad98('0xf'));var qs=require(_0xad98('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad98('0x11'));var logger=require(_0xad98('0x12'))(_0xad98('0x13'));var utils=require(_0xad98('0x14'));var config=require('../../config/environment');var db=require(_0xad98('0x15'))['db'];var jayson=require(_0xad98('0x16'));var client=jayson[_0xad98('0x17')][_0xad98('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2e7492,_0x5966b3,_0x5bff9){if(_0x5bff9){var _0x12ffe1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x12ffe1[_0xad98('0x19')](_0x5966b3)){return _0x2e7492;}else{throw new db['Sequelize'][(_0xad98('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2e7492;}}function respondWithRpcPromise(_0x384489,_0x52fbd1,_0x1b4cb3,_0x2b0ca8){return new BPromise(function(_0x54e751,_0x2666c1){var _0x2aa8e2=_0x2b0ca8||client;return _0x2aa8e2['request'](_0x384489,_0x1b4cb3)[_0xad98('0x1b')](function(_0x586407){logger[_0xad98('0x1c')]('ZohoConfiguration,\x20%s,\x20%s',_0x52fbd1,'request\x20sent');logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x52fbd1,_0xad98('0x1d'),JSON[_0xad98('0x1e')](_0x586407));if(_0x586407[_0xad98('0x1f')]){if(_0x586407[_0xad98('0x1f')][_0xad98('0x20')]===0x1f4){logger['error'](_0xad98('0x21'),_0x52fbd1,_0x586407[_0xad98('0x1f')][_0xad98('0x22')]);return _0x2666c1(_0x586407[_0xad98('0x1f')][_0xad98('0x22')]);}logger[_0xad98('0x1f')](_0xad98('0x21'),_0x52fbd1,_0x586407[_0xad98('0x1f')][_0xad98('0x22')]);return _0x54e751(_0x586407[_0xad98('0x1f')]['message']);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x52fbd1,_0xad98('0x1d'));_0x54e751(_0x586407['result'][_0xad98('0x22')]);}})[_0xad98('0x23')](function(_0x41e8e8){logger['error'](_0xad98('0x21'),_0x52fbd1,_0x41e8e8);_0x2666c1(_0x41e8e8);});});}function respondWithStatusCode(_0x1fde12,_0x20776c){_0x20776c=_0x20776c||0xcc;return function(_0x4a41be){if(_0x4a41be){return _0x1fde12[_0xad98('0x24')](_0x20776c);}return _0x1fde12[_0xad98('0x25')](_0x20776c)[_0xad98('0x26')]();};}function respondWithResult(_0x506395,_0x45df99){_0x45df99=_0x45df99||0xc8;return function(_0x10a76a){if(_0x10a76a){return _0x506395[_0xad98('0x25')](_0x45df99)[_0xad98('0x27')](_0x10a76a);}};}function respondWithFilteredResult(_0x4a9ece,_0x251248){return function(_0x17cabb){if(_0x17cabb){var _0x15cf58=_0x17cabb[_0xad98('0x28')],_0x3bb096=_0x251248[_0xad98('0x29')],_0x2571f0=_0x251248[_0xad98('0x29')]+_0x251248[_0xad98('0x2a')],_0x21642f;if(_0x2571f0>=_0x15cf58){_0x2571f0=_0x15cf58;_0x21642f=0xc8;}else{_0x21642f=0xce;}_0x4a9ece[_0xad98('0x25')](_0x21642f);return _0x4a9ece[_0xad98('0x2b')]('Content-Range',_0x3bb096+'-'+_0x2571f0+'/'+_0x15cf58)['json'](_0x17cabb);}return null;};}function patchUpdates(_0x5bc6e0){return function(_0x324a8f){try{jsonpatch['apply'](_0x324a8f,_0x5bc6e0,!![]);}catch(_0x2d2e9a){return BPromise[_0xad98('0x2c')](_0x2d2e9a);}return _0x324a8f[_0xad98('0x2d')]();};}function saveUpdates(_0x9a5c03,_0x106586){return function(_0x2a6d40){if(_0x2a6d40){return _0x2a6d40[_0xad98('0x2e')](_0x9a5c03)[_0xad98('0x1b')](function(_0x38e465){return _0x38e465;});}return null;};}function removeEntity(_0x4193aa,_0x21835e){return function(_0x5e6428){if(_0x5e6428){return _0x5e6428[_0xad98('0x2f')]()['then'](function(){_0x4193aa[_0xad98('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48416a,_0x152c14){return function(_0x4a0cf5){if(!_0x4a0cf5){_0x48416a['sendStatus'](0x194);}return _0x4a0cf5;};}function handleError(_0x1981e9,_0x491d7e){_0x491d7e=_0x491d7e||0x1f4;return function(_0x5db06d){logger[_0xad98('0x1f')](_0x5db06d[_0xad98('0x30')]);if(_0x5db06d[_0xad98('0x31')]){delete _0x5db06d[_0xad98('0x31')];}_0x1981e9[_0xad98('0x25')](_0x491d7e)[_0xad98('0x32')](_0x5db06d);};}exports[_0xad98('0x33')]=function(_0x1518b3,_0x39dbc8){var _0x11c6bd={},_0x2a396d={},_0x31c988={'count':0x0,'rows':[]};var _0x1e7424=_[_0xad98('0x34')](db['ZohoConfiguration'][_0xad98('0x35')],function(_0x41d0c2){return{'name':_0x41d0c2[_0xad98('0x36')],'type':_0x41d0c2[_0xad98('0x37')][_0xad98('0x38')]};});_0x2a396d[_0xad98('0x39')]=_[_0xad98('0x34')](_0x1e7424,'name');_0x2a396d[_0xad98('0x3a')]=_[_0xad98('0x3b')](_0x1518b3['query']);_0x2a396d[_0xad98('0x3c')]=_[_0xad98('0x3d')](_0x2a396d[_0xad98('0x39')],_0x2a396d[_0xad98('0x3a')]);_0x11c6bd['attributes']=_[_0xad98('0x3d')](_0x2a396d[_0xad98('0x39')],qs[_0xad98('0x3e')](_0x1518b3[_0xad98('0x3a')]['fields']));_0x11c6bd[_0xad98('0x3f')]=_0x11c6bd[_0xad98('0x3f')][_0xad98('0x40')]?_0x11c6bd[_0xad98('0x3f')]:_0x2a396d[_0xad98('0x39')];if(!_0x1518b3[_0xad98('0x3a')][_0xad98('0x41')]('nolimit')){_0x11c6bd['limit']=qs[_0xad98('0x2a')](_0x1518b3[_0xad98('0x3a')][_0xad98('0x2a')]);_0x11c6bd['offset']=qs[_0xad98('0x29')](_0x1518b3['query'][_0xad98('0x29')]);}_0x11c6bd[_0xad98('0x42')]=qs[_0xad98('0x43')](_0x1518b3[_0xad98('0x3a')][_0xad98('0x43')]);_0x11c6bd[_0xad98('0x44')]=qs[_0xad98('0x3c')](_[_0xad98('0x45')](_0x1518b3[_0xad98('0x3a')],_0x2a396d[_0xad98('0x3c')]),_0x1e7424);if(_0x1518b3[_0xad98('0x3a')][_0xad98('0x46')]){_0x11c6bd[_0xad98('0x44')]=_['merge'](_0x11c6bd[_0xad98('0x44')],{'$or':_[_0xad98('0x34')](_0x1e7424,function(_0x3fb937){if(_0x3fb937[_0xad98('0x37')]!=='VIRTUAL'){var _0x272879={};_0x272879[_0x3fb937[_0xad98('0x31')]]={'$like':'%'+_0x1518b3[_0xad98('0x3a')]['filter']+'%'};return _0x272879;}})});}_0x11c6bd=_[_0xad98('0x47')]({},_0x11c6bd,_0x1518b3[_0xad98('0x48')]);var _0x438e68={'where':_0x11c6bd['where']};return db['ZohoConfiguration'][_0xad98('0x28')](_0x438e68)['then'](function(_0x4d79c4){_0x31c988[_0xad98('0x28')]=_0x4d79c4;if(_0x1518b3[_0xad98('0x3a')][_0xad98('0x49')]){_0x11c6bd[_0xad98('0x4a')]=[{'all':!![]}];}return db[_0xad98('0x4b')][_0xad98('0x4c')](_0x11c6bd);})[_0xad98('0x1b')](function(_0x533051){_0x31c988[_0xad98('0x4d')]=_0x533051;return _0x31c988;})[_0xad98('0x1b')](respondWithFilteredResult(_0x39dbc8,_0x11c6bd))['catch'](handleError(_0x39dbc8,null));};exports[_0xad98('0x4e')]=function(_0x11f1c8,_0x32044a){var _0x3c7429={'raw':![],'where':{'id':_0x11f1c8[_0xad98('0x4f')]['id']}},_0x54c1e1={};_0x54c1e1[_0xad98('0x39')]=_[_0xad98('0x3b')](db[_0xad98('0x4b')]['rawAttributes']);_0x54c1e1[_0xad98('0x3a')]=_[_0xad98('0x3b')](_0x11f1c8['query']);_0x54c1e1[_0xad98('0x3c')]=_[_0xad98('0x3d')](_0x54c1e1[_0xad98('0x39')],_0x54c1e1[_0xad98('0x3a')]);_0x3c7429[_0xad98('0x3f')]=_[_0xad98('0x3d')](_0x54c1e1[_0xad98('0x39')],qs[_0xad98('0x3e')](_0x11f1c8[_0xad98('0x3a')][_0xad98('0x3e')]));_0x3c7429['attributes']=_0x3c7429[_0xad98('0x3f')][_0xad98('0x40')]?_0x3c7429['attributes']:_0x54c1e1[_0xad98('0x39')];if(_0x11f1c8[_0xad98('0x3a')][_0xad98('0x49')]){_0x3c7429[_0xad98('0x4a')]=[{'all':!![]}];}_0x3c7429=_['merge']({},_0x3c7429,_0x11f1c8[_0xad98('0x48')]);return db['ZohoConfiguration'][_0xad98('0x50')](_0x3c7429)[_0xad98('0x1b')](handleEntityNotFound(_0x32044a,null))[_0xad98('0x1b')](respondWithResult(_0x32044a,null))[_0xad98('0x23')](handleError(_0x32044a,null));};exports['create']=function(_0x56d3bb,_0x5e01ed){return db[_0xad98('0x4b')][_0xad98('0x51')](_0x56d3bb['body'],{})[_0xad98('0x1b')](respondWithResult(_0x5e01ed,0xc9))['catch'](handleError(_0x5e01ed,null));};exports[_0xad98('0x2e')]=function(_0x36bdbe,_0x432b2a){if(_0x36bdbe[_0xad98('0x52')]['id']){delete _0x36bdbe[_0xad98('0x52')]['id'];}return db[_0xad98('0x4b')][_0xad98('0x50')]({'where':{'id':_0x36bdbe[_0xad98('0x4f')]['id']}})[_0xad98('0x1b')](handleEntityNotFound(_0x432b2a,null))['then'](saveUpdates(_0x36bdbe['body'],null))['then'](respondWithResult(_0x432b2a,null))[_0xad98('0x23')](handleError(_0x432b2a,null));};exports[_0xad98('0x2f')]=function(_0x1fdba2,_0x8b6869){return db[_0xad98('0x4b')][_0xad98('0x50')]({'where':{'id':_0x1fdba2[_0xad98('0x4f')]['id']}})[_0xad98('0x1b')](handleEntityNotFound(_0x8b6869,null))['then'](removeEntity(_0x8b6869,null))[_0xad98('0x23')](handleError(_0x8b6869,null));};exports[_0xad98('0x53')]=function(_0x1f024c,_0x177683,_0x5c4e9e){var _0x5e12aa={};var _0x4ee7cd={};var _0x3aae7a;var _0x3f5b88;return db[_0xad98('0x4b')]['findOne']({'where':{'id':_0x1f024c[_0xad98('0x4f')]['id']}})['then'](handleEntityNotFound(_0x177683,null))[_0xad98('0x1b')](function(_0x4de564){if(_0x4de564){_0x3aae7a=_0x4de564;_0x4ee7cd[_0xad98('0x39')]=_['keys'](db[_0xad98('0x54')][_0xad98('0x35')]);_0x4ee7cd['query']=_[_0xad98('0x3b')](_0x1f024c[_0xad98('0x3a')]);_0x4ee7cd['filters']=_['intersection'](_0x4ee7cd['model'],_0x4ee7cd[_0xad98('0x3a')]);_0x5e12aa[_0xad98('0x3f')]=_[_0xad98('0x3d')](_0x4ee7cd[_0xad98('0x39')],qs[_0xad98('0x3e')](_0x1f024c['query']['fields']));_0x5e12aa[_0xad98('0x3f')]=_0x5e12aa[_0xad98('0x3f')][_0xad98('0x40')]?_0x5e12aa[_0xad98('0x3f')]:_0x4ee7cd[_0xad98('0x39')];_0x5e12aa['order']=qs['sort'](_0x1f024c['query']['sort']);_0x5e12aa[_0xad98('0x44')]=qs[_0xad98('0x3c')](_[_0xad98('0x45')](_0x1f024c[_0xad98('0x3a')],_0x4ee7cd['filters']));if(_0x1f024c[_0xad98('0x3a')]['filter']){_0x5e12aa[_0xad98('0x44')]=_[_0xad98('0x47')](_0x5e12aa[_0xad98('0x44')],{'$or':_[_0xad98('0x34')](_0x5e12aa['attributes'],function(_0x8d5753){var _0x3b7e1f={};_0x3b7e1f[_0x8d5753]={'$like':'%'+_0x1f024c['query']['filter']+'%'};return _0x3b7e1f;})});}_0x5e12aa=_[_0xad98('0x47')]({},_0x5e12aa,_0x1f024c[_0xad98('0x48')]);return _0x3aae7a['getFields'](_0x5e12aa);}})[_0xad98('0x1b')](function(_0x3c1fd5){if(_0x3c1fd5){_0x3f5b88=_0x3c1fd5[_0xad98('0x40')];if(!_0x1f024c[_0xad98('0x3a')]['hasOwnProperty'](_0xad98('0x55'))){_0x5e12aa[_0xad98('0x2a')]=qs['limit'](_0x1f024c[_0xad98('0x3a')][_0xad98('0x2a')]);_0x5e12aa[_0xad98('0x29')]=qs[_0xad98('0x29')](_0x1f024c[_0xad98('0x3a')][_0xad98('0x29')]);}return _0x3aae7a[_0xad98('0x53')](_0x5e12aa);}})['then'](function(_0x20196e){if(_0x20196e){return _0x20196e?{'count':_0x3f5b88,'rows':_0x20196e}:null;}})[_0xad98('0x1b')](respondWithResult(_0x177683,null))[_0xad98('0x23')](handleError(_0x177683,null));};exports[_0xad98('0x56')]=function(_0x14349d,_0x40a3df,_0x1bea5e){var _0x101475={};var _0x387aae={};var _0x208fa1;var _0x4e668d;return db[_0xad98('0x4b')]['findOne']({'where':{'id':_0x14349d['params']['id']}})[_0xad98('0x1b')](handleEntityNotFound(_0x40a3df,null))['then'](function(_0xd1b9e6){if(_0xd1b9e6){_0x208fa1=_0xd1b9e6;_0x387aae[_0xad98('0x39')]=_[_0xad98('0x3b')](db[_0xad98('0x54')][_0xad98('0x35')]);_0x387aae[_0xad98('0x3a')]=_[_0xad98('0x3b')](_0x14349d[_0xad98('0x3a')]);_0x387aae['filters']=_['intersection'](_0x387aae['model'],_0x387aae['query']);_0x101475[_0xad98('0x3f')]=_['intersection'](_0x387aae[_0xad98('0x39')],qs[_0xad98('0x3e')](_0x14349d['query'][_0xad98('0x3e')]));_0x101475[_0xad98('0x3f')]=_0x101475[_0xad98('0x3f')][_0xad98('0x40')]?_0x101475[_0xad98('0x3f')]:_0x387aae['model'];_0x101475[_0xad98('0x42')]=qs[_0xad98('0x43')](_0x14349d[_0xad98('0x3a')][_0xad98('0x43')]);_0x101475[_0xad98('0x44')]=qs[_0xad98('0x3c')](_[_0xad98('0x45')](_0x14349d[_0xad98('0x3a')],_0x387aae[_0xad98('0x3c')]));if(_0x14349d[_0xad98('0x3a')]['filter']){_0x101475['where']=_[_0xad98('0x47')](_0x101475[_0xad98('0x44')],{'$or':_[_0xad98('0x34')](_0x101475['attributes'],function(_0x299dec){var _0x89b9d2={};_0x89b9d2[_0x299dec]={'$like':'%'+_0x14349d[_0xad98('0x3a')][_0xad98('0x46')]+'%'};return _0x89b9d2;})});}_0x101475=_['merge']({},_0x101475,_0x14349d[_0xad98('0x48')]);return _0x208fa1[_0xad98('0x56')](_0x101475);}})[_0xad98('0x1b')](function(_0x1f39e5){if(_0x1f39e5){_0x4e668d=_0x1f39e5[_0xad98('0x40')];if(!_0x14349d[_0xad98('0x3a')][_0xad98('0x41')]('nolimit')){_0x101475[_0xad98('0x2a')]=qs[_0xad98('0x2a')](_0x14349d[_0xad98('0x3a')][_0xad98('0x2a')]);_0x101475[_0xad98('0x29')]=qs[_0xad98('0x29')](_0x14349d[_0xad98('0x3a')][_0xad98('0x29')]);}return _0x208fa1['getSubjects'](_0x101475);}})[_0xad98('0x1b')](function(_0x2c1f4a){if(_0x2c1f4a){return _0x2c1f4a?{'count':_0x4e668d,'rows':_0x2c1f4a}:null;}})[_0xad98('0x1b')](respondWithResult(_0x40a3df,null))[_0xad98('0x23')](handleError(_0x40a3df,null));};exports[_0xad98('0x57')]=function(_0x41e979,_0x26a5c2,_0xca60ba){var _0x2cc209={};var _0x5de136={};var _0x19ba99;var _0x260963;return db[_0xad98('0x4b')][_0xad98('0x58')]({'where':{'id':_0x41e979[_0xad98('0x4f')]['id']}})[_0xad98('0x1b')](handleEntityNotFound(_0x26a5c2,null))[_0xad98('0x1b')](function(_0x394013){if(_0x394013){_0x19ba99=_0x394013;_0x5de136[_0xad98('0x39')]=_[_0xad98('0x3b')](db[_0xad98('0x54')][_0xad98('0x35')]);_0x5de136[_0xad98('0x3a')]=_[_0xad98('0x3b')](_0x41e979['query']);_0x5de136[_0xad98('0x3c')]=_[_0xad98('0x3d')](_0x5de136['model'],_0x5de136[_0xad98('0x3a')]);_0x2cc209[_0xad98('0x3f')]=_[_0xad98('0x3d')](_0x5de136[_0xad98('0x39')],qs['fields'](_0x41e979[_0xad98('0x3a')][_0xad98('0x3e')]));_0x2cc209['attributes']=_0x2cc209[_0xad98('0x3f')]['length']?_0x2cc209['attributes']:_0x5de136[_0xad98('0x39')];_0x2cc209[_0xad98('0x42')]=qs['sort'](_0x41e979['query']['sort']);_0x2cc209['where']=qs['filters'](_[_0xad98('0x45')](_0x41e979[_0xad98('0x3a')],_0x5de136['filters']));if(_0x41e979[_0xad98('0x3a')][_0xad98('0x46')]){_0x2cc209[_0xad98('0x44')]=_[_0xad98('0x47')](_0x2cc209[_0xad98('0x44')],{'$or':_['map'](_0x2cc209['attributes'],function(_0x3b799e){var _0x503e85={};_0x503e85[_0x3b799e]={'$like':'%'+_0x41e979[_0xad98('0x3a')]['filter']+'%'};return _0x503e85;})});}_0x2cc209=_[_0xad98('0x47')]({},_0x2cc209,_0x41e979[_0xad98('0x48')]);return _0x19ba99[_0xad98('0x57')](_0x2cc209);}})[_0xad98('0x1b')](function(_0x2cb523){if(_0x2cb523){_0x260963=_0x2cb523[_0xad98('0x40')];if(!_0x41e979[_0xad98('0x3a')][_0xad98('0x41')]('nolimit')){_0x2cc209[_0xad98('0x2a')]=qs[_0xad98('0x2a')](_0x41e979[_0xad98('0x3a')][_0xad98('0x2a')]);_0x2cc209[_0xad98('0x29')]=qs[_0xad98('0x29')](_0x41e979[_0xad98('0x3a')][_0xad98('0x29')]);}return _0x19ba99[_0xad98('0x57')](_0x2cc209);}})['then'](function(_0x375648){if(_0x375648){return _0x375648?{'count':_0x260963,'rows':_0x375648}:null;}})[_0xad98('0x1b')](respondWithResult(_0x26a5c2,null))[_0xad98('0x23')](handleError(_0x26a5c2,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 2134687..f26da47 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 _0x6679=['define','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','exports'];(function(_0x13b05c,_0x3b34ba){var _0x367978=function(_0x30f197){while(--_0x30f197){_0x13b05c['push'](_0x13b05c['shift']());}};_0x367978(++_0x3b34ba);}(_0x6679,0x160));var _0x9667=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0x6679[_0xfb0281];return _0x408dd3;};'use strict';var _=require(_0x9667('0x0'));var util=require(_0x9667('0x1'));var logger=require(_0x9667('0x2'))(_0x9667('0x3'));var moment=require(_0x9667('0x4'));var BPromise=require(_0x9667('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9667('0x6'));var attributes=require('./intZohoConfiguration.attributes');module[_0x9667('0x7')]=function(_0x2da6a3,_0x3b9fdd){return _0x2da6a3[_0x9667('0x8')]('ZohoConfiguration',attributes,{'tableName':_0x9667('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d54=['define','ZohoConfiguration','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x4b136a,_0xa8310c){var _0x51a36b=function(_0x35970e){while(--_0x35970e){_0x4b136a['push'](_0x4b136a['shift']());}};_0x51a36b(++_0xa8310c);}(_0x3d54,0x66));var _0x43d5=function(_0x20fcc6,_0x56b060){_0x20fcc6=_0x20fcc6-0x0;var _0x4621c2=_0x3d54[_0x20fcc6];return _0x4621c2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x43d5('0x0'));var moment=require(_0x43d5('0x1'));var BPromise=require(_0x43d5('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x43d5('0x3'));var rimraf=require(_0x43d5('0x4'));var config=require(_0x43d5('0x5'));var attributes=require(_0x43d5('0x6'));module[_0x43d5('0x7')]=function(_0x68e689,_0x15ff8d){return _0x68e689[_0x43d5('0x8')](_0x43d5('0x9'),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 8dbd063..b7d156c 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 _0x6ad0=['jayson/promise','client','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3420ef,_0x4880d4){var _0x264283=function(_0x526054){while(--_0x526054){_0x3420ef['push'](_0x3420ef['shift']());}};_0x264283(++_0x4880d4);}(_0x6ad0,0x1db));var _0x06ad=function(_0x56f854,_0x1760d0){_0x56f854=_0x56f854-0x0;var _0x582d6c=_0x6ad0[_0x56f854];return _0x582d6c;};'use strict';var _=require(_0x06ad('0x0'));var util=require('util');var moment=require(_0x06ad('0x1'));var BPromise=require(_0x06ad('0x2'));var rs=require(_0x06ad('0x3'));var fs=require('fs');var Redis=require(_0x06ad('0x4'));var db=require(_0x06ad('0x5'))['db'];var utils=require(_0x06ad('0x6'));var logger=require('../../config/logger')(_0x06ad('0x7'));var config=require(_0x06ad('0x8'));var jayson=require(_0x06ad('0x9'));var client=jayson[_0x06ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbdfe08,_0x127eb0,_0x1bc9b4){return new BPromise(function(_0x28ff0d,_0x255fb3){return client['request'](_0xbdfe08,_0x1bc9b4)[_0x06ad('0xb')](function(_0x555230){logger[_0x06ad('0xc')](_0x06ad('0xd'),_0x127eb0,_0x06ad('0xe'));logger[_0x06ad('0xf')](_0x06ad('0x10'),_0x127eb0,_0x06ad('0xe'),JSON['stringify'](_0x555230));if(_0x555230[_0x06ad('0x11')]){if(_0x555230[_0x06ad('0x11')][_0x06ad('0x12')]===0x1f4){logger['error'](_0x06ad('0xd'),_0x127eb0,_0x555230[_0x06ad('0x11')][_0x06ad('0x13')]);return _0x255fb3(_0x555230[_0x06ad('0x11')][_0x06ad('0x13')]);}logger['error'](_0x06ad('0xd'),_0x127eb0,_0x555230['error'][_0x06ad('0x13')]);return _0x28ff0d(_0x555230[_0x06ad('0x11')][_0x06ad('0x13')]);}else{logger[_0x06ad('0xc')](_0x06ad('0xd'),_0x127eb0,_0x06ad('0xe'));_0x28ff0d(_0x555230[_0x06ad('0x14')]['message']);}})[_0x06ad('0x15')](function(_0x2ded5b){logger[_0x06ad('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x127eb0,_0x2ded5b);_0x255fb3(_0x2ded5b);});});} \ No newline at end of file +var _0x7546=['request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s'];(function(_0x5651a8,_0x115321){var _0x4f03d7=function(_0x591143){while(--_0x591143){_0x5651a8['push'](_0x5651a8['shift']());}};_0x4f03d7(++_0x115321);}(_0x7546,0x105));var _0x6754=function(_0x3a0b45,_0x362dea){_0x3a0b45=_0x3a0b45-0x0;var _0x4aedfb=_0x7546[_0x3a0b45];return _0x4aedfb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6754('0x0'));var BPromise=require(_0x6754('0x1'));var rs=require(_0x6754('0x2'));var fs=require('fs');var Redis=require(_0x6754('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6754('0x4'));var config=require(_0x6754('0x5'));var jayson=require(_0x6754('0x6'));var client=jayson[_0x6754('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c76c3,_0x5f4ef6,_0xb7f5dd){return new BPromise(function(_0x1188c1,_0x11c9f3){return client[_0x6754('0x8')](_0x1c76c3,_0xb7f5dd)[_0x6754('0x9')](function(_0x4788de){logger[_0x6754('0xa')](_0x6754('0xb'),_0x5f4ef6,_0x6754('0xc'));logger[_0x6754('0xd')](_0x6754('0xe'),_0x5f4ef6,_0x6754('0xc'),JSON[_0x6754('0xf')](_0x4788de));if(_0x4788de['error']){if(_0x4788de[_0x6754('0x10')][_0x6754('0x11')]===0x1f4){logger[_0x6754('0x10')](_0x6754('0xb'),_0x5f4ef6,_0x4788de[_0x6754('0x10')][_0x6754('0x12')]);return _0x11c9f3(_0x4788de[_0x6754('0x10')][_0x6754('0x12')]);}logger[_0x6754('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x5f4ef6,_0x4788de[_0x6754('0x10')][_0x6754('0x12')]);return _0x1188c1(_0x4788de[_0x6754('0x10')][_0x6754('0x12')]);}else{logger[_0x6754('0xa')](_0x6754('0xb'),_0x5f4ef6,'request\x20sent');_0x1188c1(_0x4788de[_0x6754('0x13')][_0x6754('0x12')]);}})[_0x6754('0x14')](function(_0x1fe4ec){logger[_0x6754('0x10')](_0x6754('0xb'),_0x5f4ef6,_0x1fe4ec);_0x11c9f3(_0x1fe4ec);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 0a1095c..8229f15 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 _0x9582=['show','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id'];(function(_0x155ffe,_0x5ccf1c){var _0x25af60=function(_0x2a0bd4){while(--_0x2a0bd4){_0x155ffe['push'](_0x155ffe['shift']());}};_0x25af60(++_0x5ccf1c);}(_0x9582,0x95));var _0x2958=function(_0x1c9ab7,_0x2d92bc){_0x1c9ab7=_0x1c9ab7-0x0;var _0x3dab14=_0x9582[_0x1c9ab7];return _0x3dab14;};'use strict';var multer=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var path=require(_0x2958('0x2'));var timeout=require(_0x2958('0x3'));var express=require(_0x2958('0x4'));var router=express[_0x2958('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2958('0x6'));var config=require(_0x2958('0x7'));var controller=require(_0x2958('0x8'));router[_0x2958('0x9')]('/',auth[_0x2958('0xa')](),controller[_0x2958('0xb')]);router[_0x2958('0x9')](_0x2958('0xc'),auth[_0x2958('0xa')](),controller[_0x2958('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2958('0xe')]);router['put'](_0x2958('0xc'),auth['isAuthenticated'](),controller[_0x2958('0xf')]);router['delete'](_0x2958('0xc'),auth[_0x2958('0xa')](),controller[_0x2958('0x10')]);module[_0x2958('0x11')]=router; \ No newline at end of file +var _0xdd4f=['Router','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','post','create','put','update','destroy','exports','multer','express'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x1c7e8a,_0x44bda3){_0x1c7e8a=_0x1c7e8a-0x0;var _0x396a48=_0xdd4f[_0x1c7e8a];return _0x396a48;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xfdd4('0x3'));var config=require(_0xfdd4('0x4'));var controller=require(_0xfdd4('0x5'));router['get']('/',auth[_0xfdd4('0x6')](),controller[_0xfdd4('0x7')]);router[_0xfdd4('0x8')](_0xfdd4('0x9'),auth[_0xfdd4('0x6')](),controller['show']);router[_0xfdd4('0xa')]('/',auth['isAuthenticated'](),controller[_0xfdd4('0xb')]);router[_0xfdd4('0xc')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xd')]);router['delete'](_0xfdd4('0x9'),auth[_0xfdd4('0x6')](),controller[_0xfdd4('0xe')]);module[_0xfdd4('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 57e8cea..c744e72 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 _0x6315=['variable','customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x4e0359,_0x205155){var _0x450f0a=function(_0x2056c6){while(--_0x2056c6){_0x4e0359['push'](_0x4e0359['shift']());}};_0x450f0a(++_0x205155);}(_0x6315,0x65));var _0x5631=function(_0x1a2cb4,_0x44d131){_0x1a2cb4=_0x1a2cb4-0x0;var _0x3bccf2=_0x6315[_0x1a2cb4];return _0x3bccf2;};'use strict';var Sequelize=require('sequelize');module[_0x5631('0x0')]={'type':{'type':Sequelize[_0x5631('0x1')](_0x5631('0x2'),_0x5631('0x3'),_0x5631('0x4'),_0x5631('0x5')),'defaultValue':_0x5631('0x2')},'content':{'type':Sequelize[_0x5631('0x6')]},'key':{'type':Sequelize[_0x5631('0x6')]},'keyType':{'type':Sequelize[_0x5631('0x1')](_0x5631('0x2'),'variable',_0x5631('0x4'))},'keyContent':{'type':Sequelize[_0x5631('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5631('0x6')]},'customField':{'type':Sequelize[_0x5631('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5631('0x6')]}}; \ No newline at end of file +var _0xbdb0=['variable','customVariable','keyValue','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x449e31,_0x8139a4){var _0x217e4f=function(_0x43652f){while(--_0x43652f){_0x449e31['push'](_0x449e31['shift']());}};_0x217e4f(++_0x8139a4);}(_0xbdb0,0x189));var _0x0bdb=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0xbdb0[_0x427352];return _0x23e0e6;};'use strict';var Sequelize=require(_0x0bdb('0x0'));module[_0x0bdb('0x1')]={'type':{'type':Sequelize[_0x0bdb('0x2')]('string',_0x0bdb('0x3'),_0x0bdb('0x4'),_0x0bdb('0x5')),'defaultValue':_0x0bdb('0x6')},'content':{'type':Sequelize[_0x0bdb('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0bdb('0x2')]('string',_0x0bdb('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x0bdb('0x7')]},'idField':{'type':Sequelize[_0x0bdb('0x7')]},'nameField':{'type':Sequelize[_0x0bdb('0x7')]},'customField':{'type':Sequelize[_0x0bdb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0bdb('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 838851e..ca5f777 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x538f42,_0x52088a){var _0x1dd4a3=function(_0x3a89b5){while(--_0x3a89b5){_0x538f42['push'](_0x538f42['shift']());}};_0x1dd4a3(++_0x52088a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x5860a3,_0x33b78a){var _0x1b193b=function(_0x4fe13e){while(--_0x4fe13e){_0x5860a3['push'](_0x5860a3['shift']());}};_0x1b193b(++_0x33b78a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 2267a29..b79e4b5 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 _0x0df4=['request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash','util','moment','bluebird'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x0df4,0x1cd));var _0x40df=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x0df4[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x40df('0x0'));var util=require(_0x40df('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x40df('0x2'));var BPromise=require(_0x40df('0x3'));var rp=require(_0x40df('0x4'));var fs=require('fs');var path=require(_0x40df('0x5'));var rimraf=require(_0x40df('0x6'));var config=require(_0x40df('0x7'));var attributes=require(_0x40df('0x8'));module[_0x40df('0x9')]=function(_0x971546,_0x21efec){return _0x971546[_0x40df('0xa')](_0x40df('0xb'),attributes,{'tableName':_0x40df('0xc'),'paranoid':![],'indexes':[{'name':_0x40df('0xd'),'fields':['idField',_0x40df('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1228=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','lodash'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1228,0xe3));var _0x8122=function(_0x1cb279,_0x5481b8){_0x1cb279=_0x1cb279-0x0;var _0x592903=_0x1228[_0x1cb279];return _0x592903;};'use strict';var _=require(_0x8122('0x0'));var util=require(_0x8122('0x1'));var logger=require(_0x8122('0x2'))('api');var moment=require(_0x8122('0x3'));var BPromise=require(_0x8122('0x4'));var rp=require(_0x8122('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8122('0x6'));var attributes=require(_0x8122('0x7'));module['exports']=function(_0x278ca0,_0x4f977c){return _0x278ca0[_0x8122('0x8')](_0x8122('0x9'),attributes,{'tableName':_0x8122('0xa'),'paranoid':![],'indexes':[{'name':_0x8122('0xb'),'fields':['idField','FieldId'],'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 388aa1c..144f7d3 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 _0x9a19=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1622a0,_0x2b55a9){var _0x2a2308=function(_0x38d05b){while(--_0x38d05b){_0x1622a0['push'](_0x1622a0['shift']());}};_0x2a2308(++_0x2b55a9);}(_0x9a19,0x114));var _0x99a1=function(_0x85d5a8,_0x1977be){_0x85d5a8=_0x85d5a8-0x0;var _0x20479b=_0x9a19[_0x85d5a8];return _0x20479b;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var moment=require(_0x99a1('0x2'));var BPromise=require('bluebird');var rs=require(_0x99a1('0x3'));var fs=require('fs');var Redis=require(_0x99a1('0x4'));var db=require(_0x99a1('0x5'))['db'];var utils=require(_0x99a1('0x6'));var logger=require(_0x99a1('0x7'))(_0x99a1('0x8'));var config=require(_0x99a1('0x9'));var jayson=require(_0x99a1('0xa'));var client=jayson[_0x99a1('0xb')][_0x99a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x65045d,_0x523b9e,_0x4d2a5c){return new BPromise(function(_0x5aa6c2,_0x56f50){return client[_0x99a1('0xd')](_0x65045d,_0x4d2a5c)['then'](function(_0x5874fc){logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));logger[_0x99a1('0x11')](_0x99a1('0x12'),_0x523b9e,'request\x20sent',JSON[_0x99a1('0x13')](_0x5874fc));if(_0x5874fc[_0x99a1('0x14')]){if(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x15')]===0x1f4){logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x56f50(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);}logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x5aa6c2(_0x5874fc[_0x99a1('0x14')]['message']);}else{logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));_0x5aa6c2(_0x5874fc[_0x99a1('0x17')][_0x99a1('0x16')]);}})[_0x99a1('0x18')](function(_0x1ca878){logger['error']('ZohoField,\x20%s,\x20%s',_0x523b9e,_0x1ca878);_0x56f50(_0x1ca878);});});} \ No newline at end of file +var _0xac31=['code','ZohoField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x380ebb,_0x58bffe){var _0x216f70=function(_0xd4c9f3){while(--_0xd4c9f3){_0x380ebb['push'](_0x380ebb['shift']());}};_0x216f70(++_0x58bffe);}(_0xac31,0xca));var _0x1ac3=function(_0x2b42c9,_0x12e9ea){_0x2b42c9=_0x2b42c9-0x0;var _0x4dbcd0=_0xac31[_0x2b42c9];return _0x4dbcd0;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bf9b1,_0x1be223,_0x157604){return new BPromise(function(_0x57893c,_0x2d17de){return client['request'](_0x2bf9b1,_0x157604)[_0x1ac3('0xb')](function(_0x40b64c){logger[_0x1ac3('0xc')]('ZohoField,\x20%s,\x20%s',_0x1be223,_0x1ac3('0xd'));logger[_0x1ac3('0xe')](_0x1ac3('0xf'),_0x1be223,_0x1ac3('0xd'),JSON[_0x1ac3('0x10')](_0x40b64c));if(_0x40b64c[_0x1ac3('0x11')]){if(_0x40b64c['error'][_0x1ac3('0x12')]===0x1f4){logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c[_0x1ac3('0x11')]['message']);return _0x2d17de(_0x40b64c[_0x1ac3('0x11')][_0x1ac3('0x14')]);}logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c['error'][_0x1ac3('0x14')]);return _0x57893c(_0x40b64c[_0x1ac3('0x11')]['message']);}else{logger[_0x1ac3('0xc')](_0x1ac3('0x13'),_0x1be223,_0x1ac3('0xd'));_0x57893c(_0x40b64c['result'][_0x1ac3('0x14')]);}})[_0x1ac3('0x15')](function(_0x23e6e9){logger['error'](_0x1ac3('0x13'),_0x1be223,_0x23e6e9);_0x2d17de(_0x23e6e9);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 0a7f3c4..3a1f199 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 _0x3e29=['multer','util','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0xb5ecca,_0x5a889f){var _0x3f88d7=function(_0x2b44c1){while(--_0x2b44c1){_0xb5ecca['push'](_0xb5ecca['shift']());}};_0x3f88d7(++_0x5a889f);}(_0x3e29,0x93));var _0x93e2=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3e29[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x93e2('0x0'));var util=require(_0x93e2('0x1'));var path=require(_0x93e2('0x2'));var timeout=require('connect-timeout');var express=require(_0x93e2('0x3'));var router=express[_0x93e2('0x4')]();var auth=require(_0x93e2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x93e2('0x6'));module['exports']=router; \ No newline at end of file +var _0x12bf=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x319261,_0x2b165a){var _0x4a5cc9=function(_0x54149b){while(--_0x54149b){_0x319261['push'](_0x319261['shift']());}};_0x4a5cc9(++_0x2b165a);}(_0x12bf,0x14d));var _0xf12b=function(_0x127ff6,_0x477d07){_0x127ff6=_0x127ff6-0x0;var _0x515d2c=_0x12bf[_0x127ff6];return _0x515d2c;};'use strict';var multer=require(_0xf12b('0x0'));var util=require(_0xf12b('0x1'));var path=require(_0xf12b('0x2'));var timeout=require(_0xf12b('0x3'));var express=require(_0xf12b('0x4'));var router=express[_0xf12b('0x5')]();var auth=require(_0xf12b('0x6'));var interaction=require(_0xf12b('0x7'));var config=require(_0xf12b('0x8'));module[_0xf12b('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 609f633..b491242 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 _0x41f7=['STRING','unique_name_and_version','app.js','BOOLEAN','state','sequelize'];(function(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0x41f7,0xfb));var _0x741f=function(_0x50f0b1,_0x30a751){_0x50f0b1=_0x50f0b1-0x0;var _0x256b15=_0x41f7[_0x50f0b1];return _0x256b15;};'use strict';var Sequelize=require(_0x741f('0x0'));module['exports']={'name':{'type':Sequelize[_0x741f('0x1')],'allowNull':![],'unique':_0x741f('0x2')},'version':{'type':Sequelize[_0x741f('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x741f('0x1')],'defaultValue':_0x741f('0x3')},'filename':{'type':Sequelize[_0x741f('0x1')]},'path':{'type':Sequelize[_0x741f('0x1')]},'type':{'type':Sequelize[_0x741f('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x741f('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x741f('0x1')]},'logo':{'type':Sequelize[_0x741f('0x1')]},'state':{'type':Sequelize[_0x741f('0x1')],'unique':_0x741f('0x5')},'description':{'type':Sequelize[_0x741f('0x1')]},'title':{'type':Sequelize[_0x741f('0x1')]},'remoteUri':{'type':Sequelize[_0x741f('0x1')]},'link':{'type':Sequelize[_0x741f('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xab2e=['unique_name_and_version','STRING','state','exports'];(function(_0x4bb2b9,_0x459c78){var _0x40e2a2=function(_0x19a26c){while(--_0x19a26c){_0x4bb2b9['push'](_0x4bb2b9['shift']());}};_0x40e2a2(++_0x459c78);}(_0xab2e,0x113));var _0xeab2=function(_0x204730,_0x6d7eca){_0x204730=_0x204730-0x0;var _0x541b0c=_0xab2e[_0x204730];return _0x541b0c;};'use strict';var Sequelize=require('sequelize');module[_0xeab2('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xeab2('0x1')},'version':{'type':Sequelize[_0xeab2('0x2')],'allowNull':![],'unique':_0xeab2('0x1')},'main':{'type':Sequelize[_0xeab2('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xeab2('0x2')]},'path':{'type':Sequelize[_0xeab2('0x2')]},'type':{'type':Sequelize[_0xeab2('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xeab2('0x2')]},'state':{'type':Sequelize[_0xeab2('0x2')],'unique':_0xeab2('0x3')},'description':{'type':Sequelize[_0xeab2('0x2')]},'title':{'type':Sequelize[_0xeab2('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xeab2('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 e3e34c4..8fb7527 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 _0x9cfc=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Integration','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','type','VIRTUAL','merge','includeAll','include','rows','catch','params','keys','rawAttributes','find','create','body','html-pdf','eml-format','rimraf'];(function(_0x3ae2ae,_0x8b07d5){var _0x3bfef2=function(_0x196c3c){while(--_0x196c3c){_0x3ae2ae['push'](_0x3ae2ae['shift']());}};_0x3bfef2(++_0x8b07d5);}(_0x9cfc,0xd8));var _0xc9cf=function(_0x29388a,_0x2b6ece){_0x29388a=_0x29388a-0x0;var _0x38b145=_0x9cfc[_0x29388a];return _0x38b145;};'use strict';var pdf=require(_0xc9cf('0x0'));var emlformat=require(_0xc9cf('0x1'));var rimraf=require(_0xc9cf('0x2'));var zipdir=require(_0xc9cf('0x3'));var jsonpatch=require(_0xc9cf('0x4'));var rp=require(_0xc9cf('0x5'));var moment=require(_0xc9cf('0x6'));var BPromise=require(_0xc9cf('0x7'));var Mustache=require(_0xc9cf('0x8'));var util=require(_0xc9cf('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xc9cf('0xa'));var ejs=require(_0xc9cf('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc9cf('0xc'));var jsforce=require(_0xc9cf('0xd'));var deskjs=require(_0xc9cf('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc9cf('0xf'));var authService=require(_0xc9cf('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc9cf('0x11'));var hardwareService=require(_0xc9cf('0x12'));var logger=require(_0xc9cf('0x13'))(_0xc9cf('0x14'));var utils=require(_0xc9cf('0x15'));var config=require(_0xc9cf('0x16'));var db=require(_0xc9cf('0x17'))['db'];function respondWithStatusCode(_0x1859d2,_0x33df84){_0x33df84=_0x33df84||0xcc;return function(_0x4164eb){if(_0x4164eb){return _0x1859d2[_0xc9cf('0x18')](_0x33df84);}return _0x1859d2['status'](_0x33df84)['end']();};}function respondWithResult(_0x597785,_0x28d929){_0x28d929=_0x28d929||0xc8;return function(_0x581f17){if(_0x581f17){return _0x597785[_0xc9cf('0x19')](_0x28d929)[_0xc9cf('0x1a')](_0x581f17);}};}function respondWithFilteredResult(_0x517edb,_0x11b1c1){return function(_0x317ddc){if(_0x317ddc){var _0x1c8e1f=_0x317ddc[_0xc9cf('0x1b')],_0x3d6444=_0x11b1c1[_0xc9cf('0x1c')],_0x618e22=_0x11b1c1['offset']+_0x11b1c1['limit'],_0x4d870c;if(_0x618e22>=_0x1c8e1f){_0x618e22=_0x1c8e1f;_0x4d870c=0xc8;}else{_0x4d870c=0xce;}_0x517edb[_0xc9cf('0x19')](_0x4d870c);return _0x517edb[_0xc9cf('0x1d')](_0xc9cf('0x1e'),_0x3d6444+'-'+_0x618e22+'/'+_0x1c8e1f)[_0xc9cf('0x1a')](_0x317ddc);}return null;};}function patchUpdates(_0x15a6da){return function(_0x449b2c){try{jsonpatch['apply'](_0x449b2c,_0x15a6da,!![]);}catch(_0x3aeb0b){return BPromise[_0xc9cf('0x1f')](_0x3aeb0b);}return _0x449b2c[_0xc9cf('0x20')]();};}function saveUpdates(_0x1096f0,_0x1338b2){return function(_0x5295e8){if(_0x5295e8){return _0x5295e8[_0xc9cf('0x21')](_0x1096f0)[_0xc9cf('0x22')](function(_0x1906fd){return _0x1906fd;});}return null;};}function removeEntity(_0x3580dc,_0x2f03f5){return function(_0x5707d9){if(_0x5707d9){return _0x5707d9[_0xc9cf('0x23')]()[_0xc9cf('0x22')](function(){_0x3580dc[_0xc9cf('0x19')](0xcc)[_0xc9cf('0x24')]();});}};}function handleEntityNotFound(_0x26421d,_0xbb5844){return function(_0x1a9e39){if(!_0x1a9e39){_0x26421d[_0xc9cf('0x18')](0x194);}return _0x1a9e39;};}function handleError(_0x66c99f,_0x401fb8){_0x401fb8=_0x401fb8||0x1f4;return function(_0x21fb64){logger[_0xc9cf('0x25')](_0x21fb64[_0xc9cf('0x26')]);if(_0x21fb64[_0xc9cf('0x27')]){delete _0x21fb64[_0xc9cf('0x27')];}_0x66c99f[_0xc9cf('0x19')](_0x401fb8)[_0xc9cf('0x28')](_0x21fb64);};}exports[_0xc9cf('0x29')]=function(_0x2d19fa,_0x32e3c3){var _0x4798ad={},_0x522e17={},_0x2ffcc0={'count':0x0,'rows':[]};var _0x2c934f=_[_0xc9cf('0x2a')](db[_0xc9cf('0x2b')]['rawAttributes'],function(_0x308b87){return{'name':_0x308b87[_0xc9cf('0x2c')],'type':_0x308b87['type'][_0xc9cf('0x2d')]};});_0x522e17[_0xc9cf('0x2e')]=_[_0xc9cf('0x2a')](_0x2c934f,_0xc9cf('0x27'));_0x522e17[_0xc9cf('0x2f')]=_['keys'](_0x2d19fa['query']);_0x522e17[_0xc9cf('0x30')]=_[_0xc9cf('0x31')](_0x522e17['model'],_0x522e17[_0xc9cf('0x2f')]);_0x4798ad[_0xc9cf('0x32')]=_[_0xc9cf('0x31')](_0x522e17[_0xc9cf('0x2e')],qs[_0xc9cf('0x33')](_0x2d19fa[_0xc9cf('0x2f')][_0xc9cf('0x33')]));_0x4798ad[_0xc9cf('0x32')]=_0x4798ad[_0xc9cf('0x32')][_0xc9cf('0x34')]?_0x4798ad['attributes']:_0x522e17[_0xc9cf('0x2e')];if(!_0x2d19fa[_0xc9cf('0x2f')][_0xc9cf('0x35')](_0xc9cf('0x36'))){_0x4798ad['limit']=qs[_0xc9cf('0x37')](_0x2d19fa[_0xc9cf('0x2f')]['limit']);_0x4798ad[_0xc9cf('0x1c')]=qs['offset'](_0x2d19fa[_0xc9cf('0x2f')][_0xc9cf('0x1c')]);}_0x4798ad[_0xc9cf('0x38')]=qs[_0xc9cf('0x39')](_0x2d19fa['query']['sort']);_0x4798ad[_0xc9cf('0x3a')]=qs[_0xc9cf('0x30')](_['pick'](_0x2d19fa[_0xc9cf('0x2f')],_0x522e17[_0xc9cf('0x30')]),_0x2c934f);if(_0x2d19fa[_0xc9cf('0x2f')][_0xc9cf('0x3b')]){_0x4798ad[_0xc9cf('0x3a')]=_['merge'](_0x4798ad['where'],{'$or':_[_0xc9cf('0x2a')](_0x2c934f,function(_0x379da7){if(_0x379da7[_0xc9cf('0x3c')]!==_0xc9cf('0x3d')){var _0x3a2a35={};_0x3a2a35[_0x379da7[_0xc9cf('0x27')]]={'$like':'%'+_0x2d19fa[_0xc9cf('0x2f')][_0xc9cf('0x3b')]+'%'};return _0x3a2a35;}})});}_0x4798ad=_[_0xc9cf('0x3e')]({},_0x4798ad,_0x2d19fa['options']);var _0x5cae72={'where':_0x4798ad[_0xc9cf('0x3a')]};return db[_0xc9cf('0x2b')][_0xc9cf('0x1b')](_0x5cae72)['then'](function(_0x298158){_0x2ffcc0[_0xc9cf('0x1b')]=_0x298158;if(_0x2d19fa['query'][_0xc9cf('0x3f')]){_0x4798ad[_0xc9cf('0x40')]=[{'all':!![]}];}return db[_0xc9cf('0x2b')]['findAll'](_0x4798ad);})[_0xc9cf('0x22')](function(_0x440b57){_0x2ffcc0[_0xc9cf('0x41')]=_0x440b57;return _0x2ffcc0;})[_0xc9cf('0x22')](respondWithFilteredResult(_0x32e3c3,_0x4798ad))[_0xc9cf('0x42')](handleError(_0x32e3c3,null));};exports['show']=function(_0x8547fb,_0x53ff0d){var _0x2b8d75={'raw':![],'where':{'id':_0x8547fb[_0xc9cf('0x43')]['id']}},_0x3c7d65={};_0x3c7d65[_0xc9cf('0x2e')]=_[_0xc9cf('0x44')](db[_0xc9cf('0x2b')][_0xc9cf('0x45')]);_0x3c7d65[_0xc9cf('0x2f')]=_[_0xc9cf('0x44')](_0x8547fb[_0xc9cf('0x2f')]);_0x3c7d65[_0xc9cf('0x30')]=_[_0xc9cf('0x31')](_0x3c7d65['model'],_0x3c7d65['query']);_0x2b8d75['attributes']=_[_0xc9cf('0x31')](_0x3c7d65[_0xc9cf('0x2e')],qs[_0xc9cf('0x33')](_0x8547fb[_0xc9cf('0x2f')][_0xc9cf('0x33')]));_0x2b8d75[_0xc9cf('0x32')]=_0x2b8d75[_0xc9cf('0x32')][_0xc9cf('0x34')]?_0x2b8d75['attributes']:_0x3c7d65[_0xc9cf('0x2e')];if(_0x8547fb[_0xc9cf('0x2f')][_0xc9cf('0x3f')]){_0x2b8d75[_0xc9cf('0x40')]=[{'all':!![]}];}_0x2b8d75=_[_0xc9cf('0x3e')]({},_0x2b8d75,_0x8547fb['options']);return db['Integration'][_0xc9cf('0x46')](_0x2b8d75)['then'](handleEntityNotFound(_0x53ff0d,null))[_0xc9cf('0x22')](respondWithResult(_0x53ff0d,null))['catch'](handleError(_0x53ff0d,null));};exports[_0xc9cf('0x47')]=function(_0x79f1ca,_0x31d1de){return db[_0xc9cf('0x2b')]['create'](_0x79f1ca[_0xc9cf('0x48')],{})['then'](respondWithResult(_0x31d1de,0xc9))[_0xc9cf('0x42')](handleError(_0x31d1de,null));};exports['update']=function(_0x5161b6,_0x433b68){if(_0x5161b6[_0xc9cf('0x48')]['id']){delete _0x5161b6[_0xc9cf('0x48')]['id'];}return db[_0xc9cf('0x2b')]['find']({'where':{'id':_0x5161b6['params']['id']}})['then'](handleEntityNotFound(_0x433b68,null))[_0xc9cf('0x22')](saveUpdates(_0x5161b6[_0xc9cf('0x48')],null))[_0xc9cf('0x22')](respondWithResult(_0x433b68,null))[_0xc9cf('0x42')](handleError(_0x433b68,null));};exports['destroy']=function(_0x273a05,_0x4c1b69){return db['Integration'][_0xc9cf('0x46')]({'where':{'id':_0x273a05[_0xc9cf('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c1b69,null))['then'](removeEntity(_0x4c1b69,null))[_0xc9cf('0x42')](handleError(_0x4c1b69,null));}; \ No newline at end of file +var _0x66bc=['show','params','find','body','eml-format','rimraf','request-promise','bluebird','mustache','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','Integration','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch'];(function(_0x4cd154,_0x5c0a9f){var _0x587894=function(_0x116cc8){while(--_0x116cc8){_0x4cd154['push'](_0x4cd154['shift']());}};_0x587894(++_0x5c0a9f);}(_0x66bc,0x1ae));var _0xc66b=function(_0x25d3a7,_0x4c6e0a){_0x25d3a7=_0x25d3a7-0x0;var _0x2acc8d=_0x66bc[_0x25d3a7];return _0x2acc8d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc66b('0x0'));var rimraf=require(_0xc66b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc66b('0x2'));var moment=require('moment');var BPromise=require(_0xc66b('0x3'));var Mustache=require(_0xc66b('0x4'));var util=require('util');var path=require(_0xc66b('0x5'));var sox=require('sox');var csv=require(_0xc66b('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc66b('0x7'));var squel=require(_0xc66b('0x8'));var crypto=require(_0xc66b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc66b('0xa'));var toCsv=require(_0xc66b('0x6'));var querystring=require(_0xc66b('0xb'));var Papa=require(_0xc66b('0xc'));var Redis=require(_0xc66b('0xd'));var authService=require(_0xc66b('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc66b('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xc66b('0x10'));var config=require(_0xc66b('0x11'));var db=require(_0xc66b('0x12'))['db'];function respondWithStatusCode(_0x5e241e,_0x399943){_0x399943=_0x399943||0xcc;return function(_0x1a68c4){if(_0x1a68c4){return _0x5e241e[_0xc66b('0x13')](_0x399943);}return _0x5e241e['status'](_0x399943)[_0xc66b('0x14')]();};}function respondWithResult(_0x3fd1d4,_0x22df07){_0x22df07=_0x22df07||0xc8;return function(_0x4ed5c6){if(_0x4ed5c6){return _0x3fd1d4['status'](_0x22df07)[_0xc66b('0x15')](_0x4ed5c6);}};}function respondWithFilteredResult(_0x12345,_0x19208f){return function(_0x41638f){if(_0x41638f){var _0x39b441=_0x41638f['count'],_0x162172=_0x19208f[_0xc66b('0x16')],_0x2bc665=_0x19208f[_0xc66b('0x16')]+_0x19208f[_0xc66b('0x17')],_0x47ee51;if(_0x2bc665>=_0x39b441){_0x2bc665=_0x39b441;_0x47ee51=0xc8;}else{_0x47ee51=0xce;}_0x12345[_0xc66b('0x18')](_0x47ee51);return _0x12345[_0xc66b('0x19')](_0xc66b('0x1a'),_0x162172+'-'+_0x2bc665+'/'+_0x39b441)[_0xc66b('0x15')](_0x41638f);}return null;};}function patchUpdates(_0x37f167){return function(_0xa975f9){try{jsonpatch[_0xc66b('0x1b')](_0xa975f9,_0x37f167,!![]);}catch(_0x367e89){return BPromise[_0xc66b('0x1c')](_0x367e89);}return _0xa975f9[_0xc66b('0x1d')]();};}function saveUpdates(_0x140663,_0x256298){return function(_0x178f88){if(_0x178f88){return _0x178f88[_0xc66b('0x1e')](_0x140663)[_0xc66b('0x1f')](function(_0x5138d3){return _0x5138d3;});}return null;};}function removeEntity(_0x25dd46,_0x40eff2){return function(_0x5dd85b){if(_0x5dd85b){return _0x5dd85b[_0xc66b('0x20')]()[_0xc66b('0x1f')](function(){_0x25dd46[_0xc66b('0x18')](0xcc)[_0xc66b('0x14')]();});}};}function handleEntityNotFound(_0x365c1e,_0x4e57d3){return function(_0x15987b){if(!_0x15987b){_0x365c1e[_0xc66b('0x13')](0x194);}return _0x15987b;};}function handleError(_0x2a7bb1,_0x90c2c9){_0x90c2c9=_0x90c2c9||0x1f4;return function(_0x33e188){logger[_0xc66b('0x21')](_0x33e188[_0xc66b('0x22')]);if(_0x33e188['name']){delete _0x33e188['name'];}_0x2a7bb1[_0xc66b('0x18')](_0x90c2c9)[_0xc66b('0x23')](_0x33e188);};}exports[_0xc66b('0x24')]=function(_0x20901c,_0x20bd9c){var _0x23d92e={},_0x5dc74c={},_0x1c26bf={'count':0x0,'rows':[]};var _0x9e5c4c=_['map'](db[_0xc66b('0x25')][_0xc66b('0x26')],function(_0x7e08e4){return{'name':_0x7e08e4[_0xc66b('0x27')],'type':_0x7e08e4[_0xc66b('0x28')][_0xc66b('0x29')]};});_0x5dc74c[_0xc66b('0x2a')]=_[_0xc66b('0x2b')](_0x9e5c4c,_0xc66b('0x2c'));_0x5dc74c[_0xc66b('0x2d')]=_[_0xc66b('0x2e')](_0x20901c[_0xc66b('0x2d')]);_0x5dc74c[_0xc66b('0x2f')]=_[_0xc66b('0x30')](_0x5dc74c[_0xc66b('0x2a')],_0x5dc74c[_0xc66b('0x2d')]);_0x23d92e['attributes']=_[_0xc66b('0x30')](_0x5dc74c[_0xc66b('0x2a')],qs['fields'](_0x20901c['query'][_0xc66b('0x31')]));_0x23d92e[_0xc66b('0x32')]=_0x23d92e['attributes'][_0xc66b('0x33')]?_0x23d92e[_0xc66b('0x32')]:_0x5dc74c[_0xc66b('0x2a')];if(!_0x20901c[_0xc66b('0x2d')]['hasOwnProperty'](_0xc66b('0x34'))){_0x23d92e[_0xc66b('0x17')]=qs[_0xc66b('0x17')](_0x20901c['query'][_0xc66b('0x17')]);_0x23d92e['offset']=qs['offset'](_0x20901c[_0xc66b('0x2d')]['offset']);}_0x23d92e[_0xc66b('0x35')]=qs[_0xc66b('0x36')](_0x20901c[_0xc66b('0x2d')][_0xc66b('0x36')]);_0x23d92e[_0xc66b('0x37')]=qs[_0xc66b('0x2f')](_[_0xc66b('0x38')](_0x20901c[_0xc66b('0x2d')],_0x5dc74c[_0xc66b('0x2f')]),_0x9e5c4c);if(_0x20901c[_0xc66b('0x2d')]['filter']){_0x23d92e['where']=_['merge'](_0x23d92e[_0xc66b('0x37')],{'$or':_[_0xc66b('0x2b')](_0x9e5c4c,function(_0x34192a){if(_0x34192a[_0xc66b('0x28')]!==_0xc66b('0x39')){var _0x39976d={};_0x39976d[_0x34192a['name']]={'$like':'%'+_0x20901c[_0xc66b('0x2d')][_0xc66b('0x3a')]+'%'};return _0x39976d;}})});}_0x23d92e=_[_0xc66b('0x3b')]({},_0x23d92e,_0x20901c[_0xc66b('0x3c')]);var _0x1b58de={'where':_0x23d92e[_0xc66b('0x37')]};return db['Integration'][_0xc66b('0x3d')](_0x1b58de)['then'](function(_0x5d9ad9){_0x1c26bf[_0xc66b('0x3d')]=_0x5d9ad9;if(_0x20901c[_0xc66b('0x2d')][_0xc66b('0x3e')]){_0x23d92e[_0xc66b('0x3f')]=[{'all':!![]}];}return db['Integration'][_0xc66b('0x40')](_0x23d92e);})[_0xc66b('0x1f')](function(_0x309ffc){_0x1c26bf[_0xc66b('0x41')]=_0x309ffc;return _0x1c26bf;})[_0xc66b('0x1f')](respondWithFilteredResult(_0x20bd9c,_0x23d92e))[_0xc66b('0x42')](handleError(_0x20bd9c,null));};exports[_0xc66b('0x43')]=function(_0xb12229,_0x4e5fc1){var _0x263db8={'raw':![],'where':{'id':_0xb12229[_0xc66b('0x44')]['id']}},_0x44a3d9={};_0x44a3d9[_0xc66b('0x2a')]=_[_0xc66b('0x2e')](db[_0xc66b('0x25')]['rawAttributes']);_0x44a3d9[_0xc66b('0x2d')]=_[_0xc66b('0x2e')](_0xb12229[_0xc66b('0x2d')]);_0x44a3d9[_0xc66b('0x2f')]=_['intersection'](_0x44a3d9[_0xc66b('0x2a')],_0x44a3d9[_0xc66b('0x2d')]);_0x263db8[_0xc66b('0x32')]=_[_0xc66b('0x30')](_0x44a3d9[_0xc66b('0x2a')],qs[_0xc66b('0x31')](_0xb12229['query']['fields']));_0x263db8[_0xc66b('0x32')]=_0x263db8[_0xc66b('0x32')]['length']?_0x263db8[_0xc66b('0x32')]:_0x44a3d9[_0xc66b('0x2a')];if(_0xb12229[_0xc66b('0x2d')][_0xc66b('0x3e')]){_0x263db8[_0xc66b('0x3f')]=[{'all':!![]}];}_0x263db8=_['merge']({},_0x263db8,_0xb12229[_0xc66b('0x3c')]);return db[_0xc66b('0x25')][_0xc66b('0x45')](_0x263db8)[_0xc66b('0x1f')](handleEntityNotFound(_0x4e5fc1,null))['then'](respondWithResult(_0x4e5fc1,null))[_0xc66b('0x42')](handleError(_0x4e5fc1,null));};exports['create']=function(_0x3f28fe,_0x46af2a){return db[_0xc66b('0x25')]['create'](_0x3f28fe[_0xc66b('0x46')],{})[_0xc66b('0x1f')](respondWithResult(_0x46af2a,0xc9))['catch'](handleError(_0x46af2a,null));};exports['update']=function(_0x1ba899,_0x3bc44f){if(_0x1ba899[_0xc66b('0x46')]['id']){delete _0x1ba899[_0xc66b('0x46')]['id'];}return db[_0xc66b('0x25')][_0xc66b('0x45')]({'where':{'id':_0x1ba899[_0xc66b('0x44')]['id']}})[_0xc66b('0x1f')](handleEntityNotFound(_0x3bc44f,null))['then'](saveUpdates(_0x1ba899[_0xc66b('0x46')],null))[_0xc66b('0x1f')](respondWithResult(_0x3bc44f,null))[_0xc66b('0x42')](handleError(_0x3bc44f,null));};exports['destroy']=function(_0x74b492,_0x51d6c1){return db[_0xc66b('0x25')][_0xc66b('0x45')]({'where':{'id':_0x74b492[_0xc66b('0x44')]['id']}})['then'](handleEntityNotFound(_0x51d6c1,null))['then'](removeEntity(_0x51d6c1,null))[_0xc66b('0x42')](handleError(_0x51d6c1,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 6c0966c..485bc60 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 _0xf1d5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','integrations'];(function(_0x319412,_0x3e5995){var _0x2d78b3=function(_0x295ed6){while(--_0x295ed6){_0x319412['push'](_0x319412['shift']());}};_0x2d78b3(++_0x3e5995);}(_0xf1d5,0xcc));var _0x5f1d=function(_0x26d803,_0x240f8e){_0x26d803=_0x26d803-0x0;var _0x265ee9=_0xf1d5[_0x26d803];return _0x265ee9;};'use strict';var _=require(_0x5f1d('0x0'));var util=require(_0x5f1d('0x1'));var logger=require(_0x5f1d('0x2'))(_0x5f1d('0x3'));var moment=require(_0x5f1d('0x4'));var BPromise=require(_0x5f1d('0x5'));var rp=require(_0x5f1d('0x6'));var fs=require('fs');var path=require(_0x5f1d('0x7'));var rimraf=require(_0x5f1d('0x8'));var config=require(_0x5f1d('0x9'));var attributes=require(_0x5f1d('0xa'));module['exports']=function(_0x425a88,_0x174fd9){return _0x425a88['define']('Integration',attributes,{'tableName':_0x5f1d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e92=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./integration.attributes','exports','define','Integration'];(function(_0x234318,_0xf22f31){var _0x1ab719=function(_0x10a0b1){while(--_0x10a0b1){_0x234318['push'](_0x234318['shift']());}};_0x1ab719(++_0xf22f31);}(_0x6e92,0x84));var _0x26e9=function(_0x181728,_0x471cc4){_0x181728=_0x181728-0x0;var _0x3525db=_0x6e92[_0x181728];return _0x3525db;};'use strict';var _=require(_0x26e9('0x0'));var util=require(_0x26e9('0x1'));var logger=require('../../config/logger')(_0x26e9('0x2'));var moment=require(_0x26e9('0x3'));var BPromise=require(_0x26e9('0x4'));var rp=require(_0x26e9('0x5'));var fs=require('fs');var path=require(_0x26e9('0x6'));var rimraf=require('rimraf');var config=require(_0x26e9('0x7'));var attributes=require(_0x26e9('0x8'));module[_0x26e9('0x9')]=function(_0x29940e,_0x44d6c4){return _0x29940e[_0x26e9('0xa')](_0x26e9('0xb'),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 12d6a82..35d6022 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 _0x40cb=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x20bf1c,_0x3ac561){var _0x32671c=function(_0x355699){while(--_0x355699){_0x20bf1c['push'](_0x20bf1c['shift']());}};_0x32671c(++_0x3ac561);}(_0x40cb,0x108));var _0xb40c=function(_0x3fb39f,_0x483b9c){_0x3fb39f=_0x3fb39f-0x0;var _0x5bfa31=_0x40cb[_0x3fb39f];return _0x5bfa31;};'use strict';var _=require(_0xb40c('0x0'));var util=require(_0xb40c('0x1'));var moment=require(_0xb40c('0x2'));var BPromise=require(_0xb40c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb40c('0x4'));var db=require(_0xb40c('0x5'))['db'];var utils=require(_0xb40c('0x6'));var logger=require(_0xb40c('0x7'))('rpc');var config=require(_0xb40c('0x8'));var jayson=require(_0xb40c('0x9'));var client=jayson['client'][_0xb40c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb9fba5,_0x198379,_0x3f0e0e){return new BPromise(function(_0x345f54,_0x389402){return client[_0xb40c('0xb')](_0xb9fba5,_0x3f0e0e)['then'](function(_0x9e3634){logger['info'](_0xb40c('0xc'),_0x198379,_0xb40c('0xd'));logger[_0xb40c('0xe')](_0xb40c('0xf'),_0x198379,_0xb40c('0xd'),JSON[_0xb40c('0x10')](_0x9e3634));if(_0x9e3634[_0xb40c('0x11')]){if(_0x9e3634[_0xb40c('0x11')]['code']===0x1f4){logger[_0xb40c('0x11')]('Integration,\x20%s,\x20%s',_0x198379,_0x9e3634['error'][_0xb40c('0x12')]);return _0x389402(_0x9e3634[_0xb40c('0x11')]['message']);}logger[_0xb40c('0x11')](_0xb40c('0xc'),_0x198379,_0x9e3634[_0xb40c('0x11')][_0xb40c('0x12')]);return _0x345f54(_0x9e3634[_0xb40c('0x11')]['message']);}else{logger[_0xb40c('0x13')](_0xb40c('0xc'),_0x198379,_0xb40c('0xd'));_0x345f54(_0x9e3634[_0xb40c('0x14')][_0xb40c('0x12')]);}})[_0xb40c('0x15')](function(_0x43c4e6){logger[_0xb40c('0x11')]('Integration,\x20%s,\x20%s',_0x198379,_0x43c4e6);_0x389402(_0x43c4e6);});});} \ No newline at end of file +var _0x370d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x3c013a,_0x3ee6ab){var _0x373dca=function(_0x1ccff5){while(--_0x1ccff5){_0x3c013a['push'](_0x3c013a['shift']());}};_0x373dca(++_0x3ee6ab);}(_0x370d,0x194));var _0xd370=function(_0x4705c0,_0x20a434){_0x4705c0=_0x4705c0-0x0;var _0x4b730b=_0x370d[_0x4705c0];return _0x4b730b;};'use strict';var _=require(_0xd370('0x0'));var util=require('util');var moment=require(_0xd370('0x1'));var BPromise=require('bluebird');var rs=require(_0xd370('0x2'));var fs=require('fs');var Redis=require(_0xd370('0x3'));var db=require(_0xd370('0x4'))['db'];var utils=require(_0xd370('0x5'));var logger=require(_0xd370('0x6'))(_0xd370('0x7'));var config=require(_0xd370('0x8'));var jayson=require(_0xd370('0x9'));var client=jayson[_0xd370('0xa')][_0xd370('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13c22a,_0x1f748d,_0x5b7ca5){return new BPromise(function(_0x3b7eb0,_0x4d2b15){return client[_0xd370('0xc')](_0x13c22a,_0x5b7ca5)[_0xd370('0xd')](function(_0x72611d){logger[_0xd370('0xe')](_0xd370('0xf'),_0x1f748d,_0xd370('0x10'));logger[_0xd370('0x11')]('Integration,\x20%s,\x20%s,\x20%s',_0x1f748d,_0xd370('0x10'),JSON[_0xd370('0x12')](_0x72611d));if(_0x72611d[_0xd370('0x13')]){if(_0x72611d[_0xd370('0x13')][_0xd370('0x14')]===0x1f4){logger[_0xd370('0x13')]('Integration,\x20%s,\x20%s',_0x1f748d,_0x72611d[_0xd370('0x13')][_0xd370('0x15')]);return _0x4d2b15(_0x72611d[_0xd370('0x13')][_0xd370('0x15')]);}logger[_0xd370('0x13')]('Integration,\x20%s,\x20%s',_0x1f748d,_0x72611d[_0xd370('0x13')][_0xd370('0x15')]);return _0x3b7eb0(_0x72611d[_0xd370('0x13')][_0xd370('0x15')]);}else{logger['info'](_0xd370('0xf'),_0x1f748d,_0xd370('0x10'));_0x3b7eb0(_0x72611d[_0xd370('0x16')][_0xd370('0x15')]);}})[_0xd370('0x17')](function(_0x1ed21b){logger['error'](_0xd370('0xf'),_0x1f748d,_0x1ed21b);_0x4d2b15(_0x1ed21b);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index efd0302..bb5400f 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 _0xd5c5=['destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','/:id','create','put','update','delete'];(function(_0x48390e,_0x47416c){var _0x31000c=function(_0x4aae37){while(--_0x4aae37){_0x48390e['push'](_0x48390e['shift']());}};_0x31000c(++_0x47416c);}(_0xd5c5,0x6d));var _0x5d5c=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xd5c5[_0x39d544];return _0x5a5ff2;};'use strict';var multer=require('multer');var util=require(_0x5d5c('0x0'));var path=require(_0x5d5c('0x1'));var timeout=require(_0x5d5c('0x2'));var express=require('express');var router=express[_0x5d5c('0x3')]();var auth=require(_0x5d5c('0x4'));var interaction=require(_0x5d5c('0x5'));var config=require(_0x5d5c('0x6'));var controller=require(_0x5d5c('0x7'));router[_0x5d5c('0x8')]('/',auth[_0x5d5c('0x9')](),controller[_0x5d5c('0xa')]);router[_0x5d5c('0x8')](_0x5d5c('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x5d5c('0x8')](_0x5d5c('0xc'),auth[_0x5d5c('0x9')](),controller['show']);router['post']('/',auth[_0x5d5c('0x9')](),controller[_0x5d5c('0xd')]);router[_0x5d5c('0xe')](_0x5d5c('0xc'),auth[_0x5d5c('0x9')](),controller[_0x5d5c('0xf')]);router[_0x5d5c('0x10')](_0x5d5c('0xc'),auth[_0x5d5c('0x9')](),controller[_0x5d5c('0x11')]);module['exports']=router; \ No newline at end of file +var _0xed56=['multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','describe','show','post','create','put','update','delete','/:id','destroy'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0xed56,0x169));var _0x6ed5=function(_0x34913c,_0x26a18a){_0x34913c=_0x34913c-0x0;var _0x274149=_0xed56[_0x34913c];return _0x274149;};'use strict';var multer=require(_0x6ed5('0x0'));var util=require(_0x6ed5('0x1'));var path=require(_0x6ed5('0x2'));var timeout=require(_0x6ed5('0x3'));var express=require(_0x6ed5('0x4'));var router=express['Router']();var auth=require(_0x6ed5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6ed5('0x6'));var controller=require(_0x6ed5('0x7'));router['get']('/',auth[_0x6ed5('0x8')](),controller[_0x6ed5('0x9')]);router['get']('/describe',auth[_0x6ed5('0x8')](),controller[_0x6ed5('0xa')]);router['get']('/:id',auth[_0x6ed5('0x8')](),controller[_0x6ed5('0xb')]);router[_0x6ed5('0xc')]('/',auth[_0x6ed5('0x8')](),controller[_0x6ed5('0xd')]);router[_0x6ed5('0xe')]('/:id',auth[_0x6ed5('0x8')](),controller[_0x6ed5('0xf')]);router[_0x6ed5('0x10')](_0x6ed5('0x11'),auth[_0x6ed5('0x8')](),controller[_0x6ed5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 2a2b02d..c7d7565 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 _0x9a19=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','RECEIVED','exports'];(function(_0x3f42e3,_0x1b870c){var _0x22d509=function(_0x440430){while(--_0x440430){_0x3f42e3['push'](_0x3f42e3['shift']());}};_0x22d509(++_0x1b870c);}(_0x9a19,0x147));var _0x99a1=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0x9a19[_0x3e0b8f];return _0x22f742;};'use strict';var Sequelize=require('sequelize');module[_0x99a1('0x0')]={'integration':{'type':Sequelize[_0x99a1('0x1')]},'eventChannel':{'type':Sequelize[_0x99a1('0x1')]},'exitStatus':{'type':Sequelize[_0x99a1('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x99a1('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x99a1('0x1')]},'calleridname':{'type':Sequelize[_0x99a1('0x1')]},'queue':{'type':Sequelize[_0x99a1('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x99a1('0x3')]},'agentconnectAt':{'type':Sequelize[_0x99a1('0x3')]},'holdtime':{'type':Sequelize[_0x99a1('0x2')]},'agentcomplete':{'type':Sequelize[_0x99a1('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x99a1('0x3')]},'talktime':{'type':Sequelize[_0x99a1('0x2')]},'agentacw':{'type':Sequelize[_0x99a1('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x99a1('0x2')]},'reason':{'type':Sequelize[_0x99a1('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x99a1('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x99a1('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x99a1('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x99a1('0x1')]},'connectedlinenum':{'type':Sequelize[_0x99a1('0x1')]},'connectedlinename':{'type':Sequelize[_0x99a1('0x1')]},'language':{'type':Sequelize[_0x99a1('0x1')]},'accountcode':{'type':Sequelize[_0x99a1('0x1')]},'context':{'type':Sequelize[_0x99a1('0x1')]},'exten':{'type':Sequelize[_0x99a1('0x1')]},'priority':{'type':Sequelize[_0x99a1('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x99a1('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x99a1('0x1')]},'destcalleridnum':{'type':Sequelize[_0x99a1('0x1')]},'destcalleridname':{'type':Sequelize[_0x99a1('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x99a1('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x99a1('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x99a1('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x99a1('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x99a1('0x1')]},'subject':{'type':Sequelize[_0x99a1('0x1')]},'from':{'type':Sequelize[_0x99a1('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x99a1('0x1')]},'attachment':{'type':Sequelize[_0x99a1('0x5')]},'html':{'type':Sequelize[_0x99a1('0x5')]},'text':{'type':Sequelize[_0x99a1('0x5')]},'status':{'type':Sequelize[_0x99a1('0x6')]('SENT','SENDING',_0x99a1('0x7'),'FAILED')},'url':{'type':Sequelize[_0x99a1('0x1')]},'app':{'type':Sequelize[_0x99a1('0x1')]},'appdata':{'type':Sequelize[_0x99a1('0x1')]},'projectId':{'type':Sequelize[_0x99a1('0x2')]}}; \ No newline at end of file +var _0xa8ce=['INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize','STRING'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xa8ce,0xa8));var _0xea8c=function(_0x39d9c2,_0x47e6ee){_0x39d9c2=_0x39d9c2-0x0;var _0xc752e9=_0xa8ce[_0x39d9c2];return _0xc752e9;};'use strict';var Sequelize=require(_0xea8c('0x0'));module['exports']={'integration':{'type':Sequelize[_0xea8c('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xea8c('0x1')]},'integrationId':{'type':Sequelize[_0xea8c('0x2')]},'contacts':{'type':Sequelize[_0xea8c('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xea8c('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xea8c('0x1')]},'membername':{'type':Sequelize[_0xea8c('0x1')]},'agentcalledAt':{'type':Sequelize[_0xea8c('0x3')]},'agentconnectAt':{'type':Sequelize[_0xea8c('0x3')]},'holdtime':{'type':Sequelize[_0xea8c('0x2')]},'agentcomplete':{'type':Sequelize[_0xea8c('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xea8c('0x3')]},'talktime':{'type':Sequelize[_0xea8c('0x2')]},'agentacw':{'type':Sequelize[_0xea8c('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xea8c('0x2')]},'reason':{'type':Sequelize[_0xea8c('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xea8c('0x3')]},'agentdump':{'type':Sequelize[_0xea8c('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xea8c('0x3')]},'lastevent':{'type':Sequelize[_0xea8c('0x1')]},'channel':{'type':Sequelize[_0xea8c('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xea8c('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xea8c('0x1')]},'accountcode':{'type':Sequelize[_0xea8c('0x1')]},'context':{'type':Sequelize[_0xea8c('0x1')]},'exten':{'type':Sequelize[_0xea8c('0x1')]},'priority':{'type':Sequelize[_0xea8c('0x1')]},'destchannel':{'type':Sequelize[_0xea8c('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xea8c('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xea8c('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xea8c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xea8c('0x1')]},'destlanguage':{'type':Sequelize[_0xea8c('0x1')]},'destaccountcode':{'type':Sequelize[_0xea8c('0x1')]},'destcontext':{'type':Sequelize[_0xea8c('0x1')]},'destexten':{'type':Sequelize[_0xea8c('0x1')]},'destpriority':{'type':Sequelize[_0xea8c('0x1')]},'destuniqueid':{'type':Sequelize[_0xea8c('0x1')]},'messageId':{'type':Sequelize[_0xea8c('0x1')]},'inReplyTo':{'type':Sequelize[_0xea8c('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xea8c('0x1')]},'to':{'type':Sequelize[_0xea8c('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xea8c('0x5')]},'status':{'type':Sequelize['ENUM'](_0xea8c('0x6'),_0xea8c('0x7'),_0xea8c('0x8'),_0xea8c('0x9'))},'url':{'type':Sequelize[_0xea8c('0x1')]},'app':{'type':Sequelize[_0xea8c('0x1')]},'appdata':{'type':Sequelize[_0xea8c('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 7dc35af..7ef2105 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 _0x937d=['sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','send','index','IntegrationReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','ejs','squel','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/environment','../../mysqldb'];(function(_0x22cac3,_0x441011){var _0x4712a9=function(_0x472dff){while(--_0x472dff){_0x22cac3['push'](_0x22cac3['shift']());}};_0x4712a9(++_0x441011);}(_0x937d,0x1ee));var _0xd937=function(_0x584852,_0x3dda2c){_0x584852=_0x584852-0x0;var _0x46e21b=_0x937d[_0x584852];return _0x46e21b;};'use strict';var pdf=require(_0xd937('0x0'));var emlformat=require(_0xd937('0x1'));var rimraf=require(_0xd937('0x2'));var zipdir=require(_0xd937('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd937('0x4'));var moment=require('moment');var BPromise=require(_0xd937('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd937('0x6'));var sox=require(_0xd937('0x7'));var csv=require('to-csv');var ejs=require(_0xd937('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd937('0x9'));var crypto=require('crypto');var jsforce=require(_0xd937('0xa'));var deskjs=require(_0xd937('0xb'));var toCsv=require(_0xd937('0xc'));var querystring=require(_0xd937('0xd'));var Papa=require('papaparse');var Redis=require(_0xd937('0xe'));var authService=require(_0xd937('0xf'));var qs=require(_0xd937('0x10'));var as=require(_0xd937('0x11'));var hardwareService=require(_0xd937('0x12'));var logger=require(_0xd937('0x13'))(_0xd937('0x14'));var utils=require(_0xd937('0x15'));var config=require(_0xd937('0x16'));var db=require(_0xd937('0x17'))['db'];function respondWithStatusCode(_0x10631b,_0x1d184a){_0x1d184a=_0x1d184a||0xcc;return function(_0x4bf78a){if(_0x4bf78a){return _0x10631b[_0xd937('0x18')](_0x1d184a);}return _0x10631b[_0xd937('0x19')](_0x1d184a)['end']();};}function respondWithResult(_0x4e61cf,_0x5be01a){_0x5be01a=_0x5be01a||0xc8;return function(_0x217f35){if(_0x217f35){return _0x4e61cf[_0xd937('0x19')](_0x5be01a)['json'](_0x217f35);}};}function respondWithFilteredResult(_0x444246,_0x46b939){return function(_0x4d4834){if(_0x4d4834){var _0x3cfd15=_0x4d4834['count'],_0x8bff78=_0x46b939[_0xd937('0x1a')],_0x5b3c09=_0x46b939[_0xd937('0x1a')]+_0x46b939[_0xd937('0x1b')],_0x456f84;if(_0x5b3c09>=_0x3cfd15){_0x5b3c09=_0x3cfd15;_0x456f84=0xc8;}else{_0x456f84=0xce;}_0x444246[_0xd937('0x19')](_0x456f84);return _0x444246[_0xd937('0x1c')](_0xd937('0x1d'),_0x8bff78+'-'+_0x5b3c09+'/'+_0x3cfd15)[_0xd937('0x1e')](_0x4d4834);}return null;};}function patchUpdates(_0x58472a){return function(_0x36dcff){try{jsonpatch[_0xd937('0x1f')](_0x36dcff,_0x58472a,!![]);}catch(_0x2291bb){return BPromise[_0xd937('0x20')](_0x2291bb);}return _0x36dcff[_0xd937('0x21')]();};}function saveUpdates(_0x484a13,_0x319f2f){return function(_0x4425de){if(_0x4425de){return _0x4425de[_0xd937('0x22')](_0x484a13)[_0xd937('0x23')](function(_0x70fe36){return _0x70fe36;});}return null;};}function removeEntity(_0x510782,_0x5e4bba){return function(_0x1f23d3){if(_0x1f23d3){return _0x1f23d3[_0xd937('0x24')]()[_0xd937('0x23')](function(){_0x510782[_0xd937('0x19')](0xcc)[_0xd937('0x25')]();});}};}function handleEntityNotFound(_0x523f52,_0x887710){return function(_0x297f44){if(!_0x297f44){_0x523f52[_0xd937('0x18')](0x194);}return _0x297f44;};}function handleError(_0x1fe2e1,_0x22a425){_0x22a425=_0x22a425||0x1f4;return function(_0x1b57a9){logger[_0xd937('0x26')](_0x1b57a9['stack']);if(_0x1b57a9[_0xd937('0x27')]){delete _0x1b57a9[_0xd937('0x27')];}_0x1fe2e1[_0xd937('0x19')](_0x22a425)[_0xd937('0x28')](_0x1b57a9);};}exports[_0xd937('0x29')]=function(_0x47de83,_0x139d3c){var _0x379dbc={},_0x2a5f4c={},_0x4f1517={'count':0x0,'rows':[]};var _0x332eb4=_['map'](db[_0xd937('0x2a')]['rawAttributes'],function(_0x5f0a5d){return{'name':_0x5f0a5d[_0xd937('0x2b')],'type':_0x5f0a5d[_0xd937('0x2c')][_0xd937('0x2d')]};});_0x2a5f4c[_0xd937('0x2e')]=_[_0xd937('0x2f')](_0x332eb4,_0xd937('0x27'));_0x2a5f4c[_0xd937('0x30')]=_[_0xd937('0x31')](_0x47de83[_0xd937('0x30')]);_0x2a5f4c[_0xd937('0x32')]=_[_0xd937('0x33')](_0x2a5f4c[_0xd937('0x2e')],_0x2a5f4c[_0xd937('0x30')]);_0x379dbc[_0xd937('0x34')]=_[_0xd937('0x33')](_0x2a5f4c[_0xd937('0x2e')],qs[_0xd937('0x35')](_0x47de83[_0xd937('0x30')][_0xd937('0x35')]));_0x379dbc[_0xd937('0x34')]=_0x379dbc['attributes']['length']?_0x379dbc[_0xd937('0x34')]:_0x2a5f4c['model'];if(!_0x47de83[_0xd937('0x30')]['hasOwnProperty'](_0xd937('0x36'))){_0x379dbc[_0xd937('0x1b')]=qs[_0xd937('0x1b')](_0x47de83[_0xd937('0x30')][_0xd937('0x1b')]);_0x379dbc[_0xd937('0x1a')]=qs[_0xd937('0x1a')](_0x47de83[_0xd937('0x30')][_0xd937('0x1a')]);}_0x379dbc[_0xd937('0x37')]=qs[_0xd937('0x38')](_0x47de83[_0xd937('0x30')]['sort']);_0x379dbc[_0xd937('0x39')]=qs[_0xd937('0x32')](_[_0xd937('0x3a')](_0x47de83['query'],_0x2a5f4c['filters']),_0x332eb4);if(_0x47de83[_0xd937('0x30')][_0xd937('0x3b')]){_0x379dbc[_0xd937('0x39')]=_[_0xd937('0x3c')](_0x379dbc[_0xd937('0x39')],{'$or':_[_0xd937('0x2f')](_0x332eb4,function(_0x3a6330){if(_0x3a6330[_0xd937('0x2c')]!==_0xd937('0x3d')){var _0x526c4d={};_0x526c4d[_0x3a6330[_0xd937('0x27')]]={'$like':'%'+_0x47de83['query']['filter']+'%'};return _0x526c4d;}})});}_0x379dbc=_[_0xd937('0x3c')]({},_0x379dbc,_0x47de83[_0xd937('0x3e')]);var _0x2c8f41={'where':_0x379dbc[_0xd937('0x39')]};return db['IntegrationReport']['count'](_0x2c8f41)[_0xd937('0x23')](function(_0x256c0d){_0x4f1517['count']=_0x256c0d;if(_0x47de83[_0xd937('0x30')]['includeAll']){_0x379dbc[_0xd937('0x3f')]=[{'all':!![]}];}return db[_0xd937('0x2a')][_0xd937('0x40')](_0x379dbc);})[_0xd937('0x23')](function(_0x4b11c4){_0x4f1517[_0xd937('0x41')]=_0x4b11c4;return _0x4f1517;})[_0xd937('0x23')](respondWithFilteredResult(_0x139d3c,_0x379dbc))[_0xd937('0x42')](handleError(_0x139d3c,null));};exports[_0xd937('0x43')]=function(_0x1260a6,_0x236ba2){var _0xb27867={'raw':![],'where':{'id':_0x1260a6[_0xd937('0x44')]['id']}},_0x173852={};_0x173852[_0xd937('0x2e')]=_[_0xd937('0x31')](db[_0xd937('0x2a')]['rawAttributes']);_0x173852[_0xd937('0x30')]=_[_0xd937('0x31')](_0x1260a6[_0xd937('0x30')]);_0x173852[_0xd937('0x32')]=_[_0xd937('0x33')](_0x173852['model'],_0x173852[_0xd937('0x30')]);_0xb27867[_0xd937('0x34')]=_['intersection'](_0x173852[_0xd937('0x2e')],qs['fields'](_0x1260a6[_0xd937('0x30')][_0xd937('0x35')]));_0xb27867[_0xd937('0x34')]=_0xb27867[_0xd937('0x34')][_0xd937('0x45')]?_0xb27867[_0xd937('0x34')]:_0x173852[_0xd937('0x2e')];if(_0x1260a6[_0xd937('0x30')]['includeAll']){_0xb27867['include']=[{'all':!![]}];}_0xb27867=_['merge']({},_0xb27867,_0x1260a6[_0xd937('0x3e')]);return db[_0xd937('0x2a')][_0xd937('0x46')](_0xb27867)[_0xd937('0x23')](handleEntityNotFound(_0x236ba2,null))[_0xd937('0x23')](respondWithResult(_0x236ba2,null))[_0xd937('0x42')](handleError(_0x236ba2,null));};exports['create']=function(_0x4c13e6,_0x8f5b68){return db[_0xd937('0x2a')][_0xd937('0x47')](_0x4c13e6[_0xd937('0x48')],{})[_0xd937('0x23')](respondWithResult(_0x8f5b68,0xc9))[_0xd937('0x42')](handleError(_0x8f5b68,null));};exports[_0xd937('0x22')]=function(_0x317c44,_0x4b2022){if(_0x317c44['body']['id']){delete _0x317c44[_0xd937('0x48')]['id'];}return db[_0xd937('0x2a')][_0xd937('0x46')]({'where':{'id':_0x317c44[_0xd937('0x44')]['id']}})[_0xd937('0x23')](handleEntityNotFound(_0x4b2022,null))[_0xd937('0x23')](saveUpdates(_0x317c44['body'],null))[_0xd937('0x23')](respondWithResult(_0x4b2022,null))[_0xd937('0x42')](handleError(_0x4b2022,null));};exports['destroy']=function(_0x33c92d,_0x38ab6b){return db['IntegrationReport'][_0xd937('0x46')]({'where':{'id':_0x33c92d[_0xd937('0x44')]['id']}})[_0xd937('0x23')](handleEntityNotFound(_0x38ab6b,null))['then'](removeEntity(_0x38ab6b,null))[_0xd937('0x42')](handleError(_0x38ab6b,null));};exports[_0xd937('0x49')]=function(_0x46e863,_0x3d3853){return db['IntegrationReport']['describe']()[_0xd937('0x23')](respondWithResult(_0x3d3853,null))[_0xd937('0x42')](handleError(_0x3d3853,null));}; \ No newline at end of file +var _0x9624=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','save','update','then','destroy','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','fields','options','catch','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x41fb98,_0x470189){var _0x4b0044=function(_0xf8b2ec){while(--_0xf8b2ec){_0x41fb98['push'](_0x41fb98['shift']());}};_0x4b0044(++_0x470189);}(_0x9624,0xcf));var _0x4962=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9624[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x4962('0x0'));var emlformat=require(_0x4962('0x1'));var rimraf=require(_0x4962('0x2'));var zipdir=require(_0x4962('0x3'));var jsonpatch=require(_0x4962('0x4'));var rp=require(_0x4962('0x5'));var moment=require(_0x4962('0x6'));var BPromise=require(_0x4962('0x7'));var Mustache=require(_0x4962('0x8'));var util=require(_0x4962('0x9'));var path=require(_0x4962('0xa'));var sox=require(_0x4962('0xb'));var csv=require(_0x4962('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4962('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4962('0xe'));var toCsv=require(_0x4962('0xc'));var querystring=require(_0x4962('0xf'));var Papa=require(_0x4962('0x10'));var Redis=require(_0x4962('0x11'));var authService=require(_0x4962('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4962('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4962('0x14'))(_0x4962('0x15'));var utils=require(_0x4962('0x16'));var config=require(_0x4962('0x17'));var db=require(_0x4962('0x18'))['db'];function respondWithStatusCode(_0xd0d1c4,_0x4b083d){_0x4b083d=_0x4b083d||0xcc;return function(_0x1d07a9){if(_0x1d07a9){return _0xd0d1c4[_0x4962('0x19')](_0x4b083d);}return _0xd0d1c4[_0x4962('0x1a')](_0x4b083d)[_0x4962('0x1b')]();};}function respondWithResult(_0x397088,_0x2bec72){_0x2bec72=_0x2bec72||0xc8;return function(_0x35b58f){if(_0x35b58f){return _0x397088['status'](_0x2bec72)[_0x4962('0x1c')](_0x35b58f);}};}function respondWithFilteredResult(_0x15ae00,_0x97531e){return function(_0x2a4ae1){if(_0x2a4ae1){var _0x129cdb=_0x2a4ae1[_0x4962('0x1d')],_0x27a5d8=_0x97531e[_0x4962('0x1e')],_0x5d3fc7=_0x97531e[_0x4962('0x1e')]+_0x97531e['limit'],_0x24c298;if(_0x5d3fc7>=_0x129cdb){_0x5d3fc7=_0x129cdb;_0x24c298=0xc8;}else{_0x24c298=0xce;}_0x15ae00[_0x4962('0x1a')](_0x24c298);return _0x15ae00['set'](_0x4962('0x1f'),_0x27a5d8+'-'+_0x5d3fc7+'/'+_0x129cdb)['json'](_0x2a4ae1);}return null;};}function patchUpdates(_0x165a15){return function(_0xd8312e){try{jsonpatch['apply'](_0xd8312e,_0x165a15,!![]);}catch(_0x22bf87){return BPromise['reject'](_0x22bf87);}return _0xd8312e[_0x4962('0x20')]();};}function saveUpdates(_0x31862d,_0x2a37e6){return function(_0x3f68fb){if(_0x3f68fb){return _0x3f68fb[_0x4962('0x21')](_0x31862d)[_0x4962('0x22')](function(_0x546b84){return _0x546b84;});}return null;};}function removeEntity(_0x203dd7,_0x4248a1){return function(_0x3d0adf){if(_0x3d0adf){return _0x3d0adf[_0x4962('0x23')]()['then'](function(){_0x203dd7[_0x4962('0x1a')](0xcc)[_0x4962('0x1b')]();});}};}function handleEntityNotFound(_0x41c014,_0x543168){return function(_0x290e05){if(!_0x290e05){_0x41c014[_0x4962('0x19')](0x194);}return _0x290e05;};}function handleError(_0x2b9235,_0x2a8df3){_0x2a8df3=_0x2a8df3||0x1f4;return function(_0x25dd23){logger[_0x4962('0x24')](_0x25dd23[_0x4962('0x25')]);if(_0x25dd23[_0x4962('0x26')]){delete _0x25dd23[_0x4962('0x26')];}_0x2b9235[_0x4962('0x1a')](_0x2a8df3)[_0x4962('0x27')](_0x25dd23);};}exports['index']=function(_0x45bf97,_0x4beae8){var _0x590562={},_0x3985ea={},_0x3cead3={'count':0x0,'rows':[]};var _0x5a415c=_[_0x4962('0x28')](db[_0x4962('0x29')][_0x4962('0x2a')],function(_0x2e944c){return{'name':_0x2e944c[_0x4962('0x2b')],'type':_0x2e944c['type'][_0x4962('0x2c')]};});_0x3985ea['model']=_[_0x4962('0x28')](_0x5a415c,_0x4962('0x26'));_0x3985ea[_0x4962('0x2d')]=_[_0x4962('0x2e')](_0x45bf97[_0x4962('0x2d')]);_0x3985ea[_0x4962('0x2f')]=_[_0x4962('0x30')](_0x3985ea[_0x4962('0x31')],_0x3985ea[_0x4962('0x2d')]);_0x590562[_0x4962('0x32')]=_['intersection'](_0x3985ea[_0x4962('0x31')],qs['fields'](_0x45bf97[_0x4962('0x2d')]['fields']));_0x590562['attributes']=_0x590562[_0x4962('0x32')][_0x4962('0x33')]?_0x590562['attributes']:_0x3985ea['model'];if(!_0x45bf97[_0x4962('0x2d')][_0x4962('0x34')](_0x4962('0x35'))){_0x590562['limit']=qs[_0x4962('0x36')](_0x45bf97[_0x4962('0x2d')][_0x4962('0x36')]);_0x590562[_0x4962('0x1e')]=qs['offset'](_0x45bf97['query'][_0x4962('0x1e')]);}_0x590562[_0x4962('0x37')]=qs[_0x4962('0x38')](_0x45bf97['query'][_0x4962('0x38')]);_0x590562[_0x4962('0x39')]=qs[_0x4962('0x2f')](_[_0x4962('0x3a')](_0x45bf97['query'],_0x3985ea[_0x4962('0x2f')]),_0x5a415c);if(_0x45bf97[_0x4962('0x2d')][_0x4962('0x3b')]){_0x590562[_0x4962('0x39')]=_[_0x4962('0x3c')](_0x590562[_0x4962('0x39')],{'$or':_[_0x4962('0x28')](_0x5a415c,function(_0x5bd1f5){if(_0x5bd1f5[_0x4962('0x3d')]!==_0x4962('0x3e')){var _0x16782a={};_0x16782a[_0x5bd1f5[_0x4962('0x26')]]={'$like':'%'+_0x45bf97['query'][_0x4962('0x3b')]+'%'};return _0x16782a;}})});}_0x590562=_['merge']({},_0x590562,_0x45bf97['options']);var _0x47acdd={'where':_0x590562[_0x4962('0x39')]};return db[_0x4962('0x29')][_0x4962('0x1d')](_0x47acdd)['then'](function(_0xc788e8){_0x3cead3[_0x4962('0x1d')]=_0xc788e8;if(_0x45bf97[_0x4962('0x2d')][_0x4962('0x3f')]){_0x590562[_0x4962('0x40')]=[{'all':!![]}];}return db[_0x4962('0x29')][_0x4962('0x41')](_0x590562);})[_0x4962('0x22')](function(_0x1cae1c){_0x3cead3[_0x4962('0x42')]=_0x1cae1c;return _0x3cead3;})[_0x4962('0x22')](respondWithFilteredResult(_0x4beae8,_0x590562))['catch'](handleError(_0x4beae8,null));};exports[_0x4962('0x43')]=function(_0xcaae5f,_0x58db10){var _0x3b8a3c={'raw':![],'where':{'id':_0xcaae5f['params']['id']}},_0x3cba45={};_0x3cba45[_0x4962('0x31')]=_[_0x4962('0x2e')](db[_0x4962('0x29')][_0x4962('0x2a')]);_0x3cba45[_0x4962('0x2d')]=_[_0x4962('0x2e')](_0xcaae5f[_0x4962('0x2d')]);_0x3cba45[_0x4962('0x2f')]=_['intersection'](_0x3cba45[_0x4962('0x31')],_0x3cba45[_0x4962('0x2d')]);_0x3b8a3c['attributes']=_[_0x4962('0x30')](_0x3cba45[_0x4962('0x31')],qs[_0x4962('0x44')](_0xcaae5f[_0x4962('0x2d')]['fields']));_0x3b8a3c[_0x4962('0x32')]=_0x3b8a3c[_0x4962('0x32')][_0x4962('0x33')]?_0x3b8a3c[_0x4962('0x32')]:_0x3cba45[_0x4962('0x31')];if(_0xcaae5f[_0x4962('0x2d')][_0x4962('0x3f')]){_0x3b8a3c['include']=[{'all':!![]}];}_0x3b8a3c=_[_0x4962('0x3c')]({},_0x3b8a3c,_0xcaae5f[_0x4962('0x45')]);return db['IntegrationReport']['find'](_0x3b8a3c)[_0x4962('0x22')](handleEntityNotFound(_0x58db10,null))[_0x4962('0x22')](respondWithResult(_0x58db10,null))[_0x4962('0x46')](handleError(_0x58db10,null));};exports[_0x4962('0x47')]=function(_0x1ed907,_0x15cca1){return db[_0x4962('0x29')][_0x4962('0x47')](_0x1ed907[_0x4962('0x48')],{})[_0x4962('0x22')](respondWithResult(_0x15cca1,0xc9))[_0x4962('0x46')](handleError(_0x15cca1,null));};exports[_0x4962('0x21')]=function(_0x30a95f,_0x4bf16f){if(_0x30a95f[_0x4962('0x48')]['id']){delete _0x30a95f[_0x4962('0x48')]['id'];}return db[_0x4962('0x29')][_0x4962('0x49')]({'where':{'id':_0x30a95f['params']['id']}})[_0x4962('0x22')](handleEntityNotFound(_0x4bf16f,null))[_0x4962('0x22')](saveUpdates(_0x30a95f[_0x4962('0x48')],null))['then'](respondWithResult(_0x4bf16f,null))[_0x4962('0x46')](handleError(_0x4bf16f,null));};exports['destroy']=function(_0x343729,_0x47288f){return db['IntegrationReport'][_0x4962('0x49')]({'where':{'id':_0x343729[_0x4962('0x4a')]['id']}})[_0x4962('0x22')](handleEntityNotFound(_0x47288f,null))[_0x4962('0x22')](removeEntity(_0x47288f,null))[_0x4962('0x46')](handleError(_0x47288f,null));};exports['describe']=function(_0x4859ea,_0x53397e){return db['IntegrationReport'][_0x4962('0x4b')]()[_0x4962('0x22')](respondWithResult(_0x53397e,null))['catch'](handleError(_0x53397e,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 669ee01..f72d162 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 _0xed10=['./integrationReport.attributes','define','IntegrationReport','lodash','util','../../config/logger','bluebird','path','../../config/environment'];(function(_0x19ad3b,_0x34c323){var _0x4937dd=function(_0x475edf){while(--_0x475edf){_0x19ad3b['push'](_0x19ad3b['shift']());}};_0x4937dd(++_0x34c323);}(_0xed10,0x1a1));var _0x0ed1=function(_0x17c938,_0x557096){_0x17c938=_0x17c938-0x0;var _0x2d22b2=_0xed10[_0x17c938];return _0x2d22b2;};'use strict';var _=require(_0x0ed1('0x0'));var util=require(_0x0ed1('0x1'));var logger=require(_0x0ed1('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0ed1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ed1('0x4'));var rimraf=require('rimraf');var config=require(_0x0ed1('0x5'));var attributes=require(_0x0ed1('0x6'));module['exports']=function(_0x3b40ca,_0xf4cb4f){return _0x3b40ca[_0x0ed1('0x7')](_0x0ed1('0x8'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeeaa=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','define','report_integration','util'];(function(_0x146b5d,_0xc66e6){var _0x3df57c=function(_0x260639){while(--_0x260639){_0x146b5d['push'](_0x146b5d['shift']());}};_0x3df57c(++_0xc66e6);}(_0xeeaa,0x15d));var _0xaeea=function(_0x1ffc86,_0x453406){_0x1ffc86=_0x1ffc86-0x0;var _0x11aea1=_0xeeaa[_0x1ffc86];return _0x11aea1;};'use strict';var _=require('lodash');var util=require(_0xaeea('0x0'));var logger=require(_0xaeea('0x1'))(_0xaeea('0x2'));var moment=require('moment');var BPromise=require(_0xaeea('0x3'));var rp=require(_0xaeea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaeea('0x5'));var config=require(_0xaeea('0x6'));var attributes=require(_0xaeea('0x7'));module['exports']=function(_0x1e5db2,_0x56cf72){return _0x1e5db2[_0xaeea('0x8')]('IntegrationReport',attributes,{'tableName':_0xaeea('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 eca46ca..014829f 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 _0x0713=['IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\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(_0x41b923,_0x1693cb){var _0x45a11b=function(_0x219d52){while(--_0x219d52){_0x41b923['push'](_0x41b923['shift']());}};_0x45a11b(++_0x1693cb);}(_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')]('IntegrationReport,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('IntegrationReport,\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')]('IntegrationReport,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x5eb8=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x201517,_0x15f488){var _0x6d1254=function(_0x4758a2){while(--_0x4758a2){_0x201517['push'](_0x201517['shift']());}};_0x6d1254(++_0x15f488);}(_0x5eb8,0xb0));var _0x85eb=function(_0x299784,_0xb0918f){_0x299784=_0x299784-0x0;var _0x5ab008=_0x5eb8[_0x299784];return _0x5ab008;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index c9c3c51..7162a47 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 _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./interval.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0xe')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller['addInterval']);router[_0x7995('0xe')](_0x7995('0x10'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0x34e8=['./interval.controller','get','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1e00d0,_0x380c3b){var _0x35d81c=function(_0x5c89f9){while(--_0x5c89f9){_0x1e00d0['push'](_0x1e00d0['shift']());}};_0x35d81c(++_0x380c3b);}(_0x34e8,0x12c));var _0x834e=function(_0x679bd7,_0x5174cf){_0x679bd7=_0x679bd7-0x0;var _0x2118cb=_0x34e8[_0x679bd7];return _0x2118cb;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0xe')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0xe')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router['put'](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['update']);router[_0x834e('0x14')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller[_0x834e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index c715e93..bc61d98 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 _0x5c40=['STRING','exports'];(function(_0x3db9b0,_0x1083a0){var _0x5ef723=function(_0x3a9f80){while(--_0x3a9f80){_0x3db9b0['push'](_0x3db9b0['shift']());}};_0x5ef723(++_0x1083a0);}(_0x5c40,0xe7));var _0x05c4=function(_0x1b4898,_0x365bd3){_0x1b4898=_0x1b4898-0x0;var _0x2dbcb7=_0x5c40[_0x1b4898];return _0x2dbcb7;};'use strict';var Sequelize=require('sequelize');module[_0x05c4('0x0')]={'name':{'type':Sequelize[_0x05c4('0x1')]},'description':{'type':Sequelize[_0x05c4('0x1')]},'interval':{'type':Sequelize[_0x05c4('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xd721=['STRING','sequelize','exports'];(function(_0x11614b,_0x48c02b){var _0x5a4c67=function(_0x54e6f5){while(--_0x54e6f5){_0x11614b['push'](_0x11614b['shift']());}};_0x5a4c67(++_0x48c02b);}(_0xd721,0xd3));var _0x1d72=function(_0x4de8b1,_0x4a5111){_0x4de8b1=_0x4de8b1-0x0;var _0xd94733=_0xd721[_0x4de8b1];return _0xd94733;};'use strict';var Sequelize=require(_0x1d72('0x0'));module[_0x1d72('0x1')]={'name':{'type':Sequelize[_0x1d72('0x2')]},'description':{'type':Sequelize[_0x1d72('0x2')]},'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 e18076e..ddbb5c8 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 _0xe3a1=['update','destroy','then','get','Intervals','error','stack','name','send','map','Interval','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','intersection','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','addInterval','IntervalId','getIntervals','findOne','pick','addIntervals','sequelize','findAll','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','count','offset','limit','set','apply'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xe3a1,0x1e9));var _0x1e3a=function(_0x2b7c75,_0x3a5fbf){_0x2b7c75=_0x2b7c75-0x0;var _0x6bb470=_0xe3a1[_0x2b7c75];return _0x6bb470;};'use strict';var pdf=require(_0x1e3a('0x0'));var emlformat=require(_0x1e3a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1e3a('0x2'));var rp=require(_0x1e3a('0x3'));var moment=require(_0x1e3a('0x4'));var BPromise=require(_0x1e3a('0x5'));var Mustache=require(_0x1e3a('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1e3a('0x7'));var fs=require('fs');var _=require(_0x1e3a('0x8'));var squel=require(_0x1e3a('0x9'));var crypto=require(_0x1e3a('0xa'));var jsforce=require(_0x1e3a('0xb'));var deskjs=require(_0x1e3a('0xc'));var toCsv=require(_0x1e3a('0xd'));var querystring=require('querystring');var Papa=require(_0x1e3a('0xe'));var Redis=require(_0x1e3a('0xf'));var authService=require(_0x1e3a('0x10'));var qs=require(_0x1e3a('0x11'));var as=require(_0x1e3a('0x12'));var hardwareService=require(_0x1e3a('0x13'));var logger=require(_0x1e3a('0x14'))('api');var utils=require(_0x1e3a('0x15'));var config=require('../../config/environment');var db=require(_0x1e3a('0x16'))['db'];var extensions=require(_0x1e3a('0x17'));function respondWithStatusCode(_0x4b5a99,_0x566e58){_0x566e58=_0x566e58||0xcc;return function(_0x42b7e0){if(_0x42b7e0){return _0x4b5a99[_0x1e3a('0x18')](_0x566e58);}return _0x4b5a99[_0x1e3a('0x19')](_0x566e58)[_0x1e3a('0x1a')]();};}function respondWithResult(_0x1e1964,_0xd953e8){_0xd953e8=_0xd953e8||0xc8;return function(_0x51b255){if(_0x51b255){return _0x1e1964[_0x1e3a('0x19')](_0xd953e8)[_0x1e3a('0x1b')](_0x51b255);}};}function respondWithFilteredResult(_0x41765e,_0x108598){return function(_0x36e231){if(_0x36e231){var _0x36c106=_0x36e231[_0x1e3a('0x1c')],_0xc0799c=_0x108598[_0x1e3a('0x1d')],_0x783e71=_0x108598[_0x1e3a('0x1d')]+_0x108598[_0x1e3a('0x1e')],_0x10fa23;if(_0x783e71>=_0x36c106){_0x783e71=_0x36c106;_0x10fa23=0xc8;}else{_0x10fa23=0xce;}_0x41765e[_0x1e3a('0x19')](_0x10fa23);return _0x41765e[_0x1e3a('0x1f')]('Content-Range',_0xc0799c+'-'+_0x783e71+'/'+_0x36c106)[_0x1e3a('0x1b')](_0x36e231);}return null;};}function patchUpdates(_0x152b04){return function(_0x3aaf20){try{jsonpatch[_0x1e3a('0x20')](_0x3aaf20,_0x152b04,!![]);}catch(_0x19f96b){return BPromise['reject'](_0x19f96b);}return _0x3aaf20['save']();};}function saveUpdates(_0x4adb83,_0x574e37){return function(_0x39954d){if(_0x39954d){return _0x39954d[_0x1e3a('0x21')](_0x4adb83)['then'](function(_0x29b2b4){return _0x29b2b4;});}return null;};}function removeEntity(_0xb113fa,_0x3215d7){return function(_0xcea5ca){if(_0xcea5ca){return _0xcea5ca[_0x1e3a('0x22')]()[_0x1e3a('0x23')](function(){var _0x4b6e4f=_0xcea5ca[_0x1e3a('0x24')]({'plain':!![]});var _0x3b7d61=_0x1e3a('0x25');return db['UserProfileResource'][_0x1e3a('0x22')]({'where':{'type':_0x3b7d61,'resourceId':_0x4b6e4f['id']}})[_0x1e3a('0x23')](function(){return _0xcea5ca;});})[_0x1e3a('0x23')](function(){_0xb113fa[_0x1e3a('0x19')](0xcc)[_0x1e3a('0x1a')]();});}};}function handleEntityNotFound(_0x19bf99,_0xd382ae){return function(_0x1fd2a0){if(!_0x1fd2a0){_0x19bf99[_0x1e3a('0x18')](0x194);}return _0x1fd2a0;};}function handleError(_0x3341bc,_0x530a06){_0x530a06=_0x530a06||0x1f4;return function(_0xb867c3){logger[_0x1e3a('0x26')](_0xb867c3[_0x1e3a('0x27')]);if(_0xb867c3['name']){delete _0xb867c3[_0x1e3a('0x28')];}_0x3341bc[_0x1e3a('0x19')](_0x530a06)[_0x1e3a('0x29')](_0xb867c3);};}exports['index']=function(_0x3126b4,_0xdbda3b){var _0x3e42b9={},_0x362fff={},_0x358b13={'count':0x0,'rows':[]};var _0x53dc2a=_[_0x1e3a('0x2a')](db[_0x1e3a('0x2b')][_0x1e3a('0x2c')],function(_0x14073f){return{'name':_0x14073f[_0x1e3a('0x2d')],'type':_0x14073f[_0x1e3a('0x2e')][_0x1e3a('0x2f')]};});_0x362fff['model']=_[_0x1e3a('0x2a')](_0x53dc2a,'name');_0x362fff[_0x1e3a('0x30')]=_[_0x1e3a('0x31')](_0x3126b4[_0x1e3a('0x30')]);_0x362fff[_0x1e3a('0x32')]=_['intersection'](_0x362fff[_0x1e3a('0x33')],_0x362fff['query']);_0x3e42b9[_0x1e3a('0x34')]=_['intersection'](_0x362fff[_0x1e3a('0x33')],qs[_0x1e3a('0x35')](_0x3126b4[_0x1e3a('0x30')][_0x1e3a('0x35')]));_0x3e42b9[_0x1e3a('0x34')]=_0x3e42b9[_0x1e3a('0x34')]['length']?_0x3e42b9[_0x1e3a('0x34')]:_0x362fff['model'];if(!_0x3126b4[_0x1e3a('0x30')][_0x1e3a('0x36')](_0x1e3a('0x37'))){_0x3e42b9[_0x1e3a('0x1e')]=qs[_0x1e3a('0x1e')](_0x3126b4[_0x1e3a('0x30')][_0x1e3a('0x1e')]);_0x3e42b9[_0x1e3a('0x1d')]=qs[_0x1e3a('0x1d')](_0x3126b4[_0x1e3a('0x30')][_0x1e3a('0x1d')]);}_0x3e42b9[_0x1e3a('0x38')]=qs['sort'](_0x3126b4['query'][_0x1e3a('0x39')]);_0x3e42b9[_0x1e3a('0x3a')]=qs[_0x1e3a('0x32')](_['pick'](_0x3126b4[_0x1e3a('0x30')],_0x362fff[_0x1e3a('0x32')]),_0x53dc2a);if(_0x3126b4[_0x1e3a('0x30')][_0x1e3a('0x3b')]){_0x3e42b9['where']=_[_0x1e3a('0x3c')](_0x3e42b9['where'],{'$or':_[_0x1e3a('0x2a')](_0x53dc2a,function(_0x45951d){if(_0x45951d['type']!==_0x1e3a('0x3d')){var _0x20a7c4={};_0x20a7c4[_0x45951d[_0x1e3a('0x28')]]={'$like':'%'+_0x3126b4[_0x1e3a('0x30')][_0x1e3a('0x3b')]+'%'};return _0x20a7c4;}})});}_0x3e42b9=_[_0x1e3a('0x3c')]({},_0x3e42b9,_0x3126b4['options']);var _0x548df5={'where':_0x3e42b9[_0x1e3a('0x3a')]};return db[_0x1e3a('0x2b')][_0x1e3a('0x1c')](_0x548df5)[_0x1e3a('0x23')](function(_0x1e492){_0x358b13[_0x1e3a('0x1c')]=_0x1e492;if(_0x3126b4[_0x1e3a('0x30')][_0x1e3a('0x3e')]){_0x3e42b9[_0x1e3a('0x3f')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x3e42b9);})[_0x1e3a('0x23')](function(_0x379b4b){_0x358b13[_0x1e3a('0x40')]=_0x379b4b;return _0x358b13;})[_0x1e3a('0x23')](respondWithFilteredResult(_0xdbda3b,_0x3e42b9))[_0x1e3a('0x41')](handleError(_0xdbda3b,null));};exports[_0x1e3a('0x42')]=function(_0x272332,_0x5bbf2f){var _0x387141={'raw':!![],'where':{'id':_0x272332[_0x1e3a('0x43')]['id']}},_0x1488d8={};_0x1488d8[_0x1e3a('0x33')]=_[_0x1e3a('0x31')](db['Interval']['rawAttributes']);_0x1488d8['query']=_[_0x1e3a('0x31')](_0x272332[_0x1e3a('0x30')]);_0x1488d8[_0x1e3a('0x32')]=_[_0x1e3a('0x44')](_0x1488d8[_0x1e3a('0x33')],_0x1488d8[_0x1e3a('0x30')]);_0x387141[_0x1e3a('0x34')]=_[_0x1e3a('0x44')](_0x1488d8[_0x1e3a('0x33')],qs[_0x1e3a('0x35')](_0x272332['query'][_0x1e3a('0x35')]));_0x387141[_0x1e3a('0x34')]=_0x387141[_0x1e3a('0x34')][_0x1e3a('0x45')]?_0x387141[_0x1e3a('0x34')]:_0x1488d8[_0x1e3a('0x33')];if(_0x272332[_0x1e3a('0x30')][_0x1e3a('0x3e')]){_0x387141[_0x1e3a('0x3f')]=[{'all':!![]}];}_0x387141=_[_0x1e3a('0x3c')]({},_0x387141,_0x272332[_0x1e3a('0x46')]);return db[_0x1e3a('0x2b')][_0x1e3a('0x47')](_0x387141)[_0x1e3a('0x23')](handleEntityNotFound(_0x5bbf2f,null))[_0x1e3a('0x23')](respondWithResult(_0x5bbf2f,null))['catch'](handleError(_0x5bbf2f,null));};exports['create']=function(_0x206171,_0xfc8c5c){return db[_0x1e3a('0x2b')][_0x1e3a('0x48')](_0x206171[_0x1e3a('0x49')],{})['then'](function(_0x4d88c7){var _0x4f74c7=_0x206171[_0x1e3a('0x4a')][_0x1e3a('0x24')]({'plain':!![]});if(!_0x4f74c7)throw new Error(_0x1e3a('0x4b'));if(_0x4f74c7['role']==='user'){var _0x43139d=_0x4d88c7[_0x1e3a('0x24')]({'plain':!![]});var _0x262bce=_0x1e3a('0x25');return db[_0x1e3a('0x4c')][_0x1e3a('0x47')]({'where':{'name':_0x262bce,'userProfileId':_0x4f74c7[_0x1e3a('0x4d')]},'raw':!![]})[_0x1e3a('0x23')](function(_0x873fac){if(_0x873fac&&_0x873fac['autoAssociation']===0x0){return db[_0x1e3a('0x4e')][_0x1e3a('0x48')]({'name':_0x43139d[_0x1e3a('0x28')],'resourceId':_0x43139d['id'],'type':_0x873fac[_0x1e3a('0x28')],'sectionId':_0x873fac['id']},{})[_0x1e3a('0x23')](function(){return _0x4d88c7;});}else{return _0x4d88c7;}})[_0x1e3a('0x41')](function(_0x207d92){logger[_0x1e3a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x207d92);throw _0x207d92;});}return _0x4d88c7;})[_0x1e3a('0x23')](respondWithResult(_0xfc8c5c,0xc9))[_0x1e3a('0x41')](handleError(_0xfc8c5c,null));};exports[_0x1e3a('0x21')]=function(_0x2989e7,_0x2e5d4d){if(_0x2989e7['body']['id']){delete _0x2989e7[_0x1e3a('0x49')]['id'];}return db[_0x1e3a('0x2b')]['find']({'where':{'id':_0x2989e7[_0x1e3a('0x43')]['id']}})[_0x1e3a('0x23')](handleEntityNotFound(_0x2e5d4d,null))[_0x1e3a('0x23')](saveUpdates(_0x2989e7[_0x1e3a('0x49')],null))[_0x1e3a('0x23')](respondWithResult(_0x2e5d4d,null))[_0x1e3a('0x41')](handleError(_0x2e5d4d,null));};exports[_0x1e3a('0x22')]=function(_0x45abe2,_0x5beb99){return db[_0x1e3a('0x2b')][_0x1e3a('0x47')]({'where':{'id':_0x45abe2[_0x1e3a('0x43')]['id']}})[_0x1e3a('0x23')](handleEntityNotFound(_0x5beb99,null))[_0x1e3a('0x23')](removeEntity(_0x5beb99,null))[_0x1e3a('0x41')](handleError(_0x5beb99,null));};exports[_0x1e3a('0x4f')]=function(_0x52eae4,_0x9238e6,_0x4c8e1a){if(_0x52eae4[_0x1e3a('0x49')]['id']){delete _0x52eae4[_0x1e3a('0x49')]['id'];}return db['Interval'][_0x1e3a('0x47')]({'where':{'id':_0x52eae4[_0x1e3a('0x43')]['id']}})[_0x1e3a('0x23')](handleEntityNotFound(_0x9238e6,null))[_0x1e3a('0x23')](function(_0x464b3f){if(_0x464b3f){_0x52eae4[_0x1e3a('0x49')][_0x1e3a('0x50')]=_0x464b3f['id'];return db[_0x1e3a('0x2b')]['create'](_0x52eae4[_0x1e3a('0x49')]);}})[_0x1e3a('0x23')](respondWithResult(_0x9238e6,null))[_0x1e3a('0x41')](handleError(_0x9238e6,null));};exports[_0x1e3a('0x51')]=function(_0x245151,_0x816ae9,_0xdabcee){var _0x1189e4={};var _0x2978f4={};var _0x8f203;var _0x6bf66c;return db[_0x1e3a('0x2b')][_0x1e3a('0x52')]({'where':{'id':_0x245151[_0x1e3a('0x43')]['id']}})[_0x1e3a('0x23')](handleEntityNotFound(_0x816ae9,null))['then'](function(_0x176f0c){if(_0x176f0c){_0x8f203=_0x176f0c;_0x2978f4['model']=_[_0x1e3a('0x31')](db[_0x1e3a('0x2b')][_0x1e3a('0x2c')]);_0x2978f4[_0x1e3a('0x30')]=_[_0x1e3a('0x31')](_0x245151[_0x1e3a('0x30')]);_0x2978f4[_0x1e3a('0x32')]=_[_0x1e3a('0x44')](_0x2978f4[_0x1e3a('0x33')],_0x2978f4[_0x1e3a('0x30')]);_0x1189e4[_0x1e3a('0x34')]=_[_0x1e3a('0x44')](_0x2978f4[_0x1e3a('0x33')],qs[_0x1e3a('0x35')](_0x245151['query']['fields']));_0x1189e4[_0x1e3a('0x34')]=_0x1189e4['attributes'][_0x1e3a('0x45')]?_0x1189e4[_0x1e3a('0x34')]:_0x2978f4[_0x1e3a('0x33')];_0x1189e4[_0x1e3a('0x38')]=qs[_0x1e3a('0x39')](_0x245151[_0x1e3a('0x30')][_0x1e3a('0x39')]);_0x1189e4[_0x1e3a('0x3a')]=qs[_0x1e3a('0x32')](_[_0x1e3a('0x53')](_0x245151[_0x1e3a('0x30')],_0x2978f4[_0x1e3a('0x32')]));if(_0x245151[_0x1e3a('0x30')][_0x1e3a('0x3b')]){_0x1189e4[_0x1e3a('0x3a')]=_[_0x1e3a('0x3c')](_0x1189e4[_0x1e3a('0x3a')],{'$or':_[_0x1e3a('0x2a')](_0x1189e4['attributes'],function(_0x15ad57){var _0x4c763f={};_0x4c763f[_0x15ad57]={'$like':'%'+_0x245151['query'][_0x1e3a('0x3b')]+'%'};return _0x4c763f;})});}_0x1189e4=_['merge']({},_0x1189e4,_0x245151[_0x1e3a('0x46')]);return _0x8f203[_0x1e3a('0x51')](_0x1189e4);}})[_0x1e3a('0x23')](function(_0x4ca139){if(_0x4ca139){_0x6bf66c=_0x4ca139['length'];if(!_0x245151['query'][_0x1e3a('0x36')](_0x1e3a('0x37'))){_0x1189e4[_0x1e3a('0x1e')]=qs[_0x1e3a('0x1e')](_0x245151[_0x1e3a('0x30')]['limit']);_0x1189e4['offset']=qs['offset'](_0x245151[_0x1e3a('0x30')][_0x1e3a('0x1d')]);}return _0x8f203[_0x1e3a('0x51')](_0x1189e4);}})['then'](function(_0x451137){if(_0x451137){return _0x451137?{'count':_0x6bf66c,'rows':_0x451137}:null;}})['then'](respondWithResult(_0x816ae9,null))[_0x1e3a('0x41')](handleError(_0x816ae9,null));};exports[_0x1e3a('0x54')]=function(_0x56b30f,_0xc574f5,_0x331d0f){return db[_0x1e3a('0x2b')][_0x1e3a('0x52')]({'where':{'id':_0x56b30f[_0x1e3a('0x43')]['id']}})[_0x1e3a('0x23')](handleEntityNotFound(_0xc574f5,null))[_0x1e3a('0x23')](function(_0x37f95d){if(_0x37f95d){return db[_0x1e3a('0x55')]['transaction'](function(_0x2a0574){return db[_0x1e3a('0x2b')][_0x1e3a('0x22')]({'where':{'IntervalId':_0x56b30f[_0x1e3a('0x43')]['id']},'transaction':_0x2a0574})[_0x1e3a('0x23')](function(_0x3bc24c){var _0x324c07=_[_0x1e3a('0x2a')](_0x56b30f[_0x1e3a('0x49')],function(_0x4d1cb6){delete _0x4d1cb6['id'];_0x4d1cb6[_0x1e3a('0x50')]=_0x56b30f[_0x1e3a('0x43')]['id'];return _0x4d1cb6;});return db[_0x1e3a('0x2b')]['bulkCreate'](_0x324c07,{'transaction':_0x2a0574});});})[_0x1e3a('0x23')](function(){return db[_0x1e3a('0x2b')][_0x1e3a('0x56')]({'where':{'IntervalId':_0x56b30f[_0x1e3a('0x43')]['id']}});});}})[_0x1e3a('0x23')](respondWithResult(_0xc574f5,null))[_0x1e3a('0x41')](handleError(_0xc574f5,null));}; \ No newline at end of file +var _0x1141=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','end','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','error','send','map','Interval','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','catch','show','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','getIntervals','findOne','nolimit','addIntervals','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x2335d4,_0x3a59eb){var _0x505dd1=function(_0x1a2905){while(--_0x1a2905){_0x2335d4['push'](_0x2335d4['shift']());}};_0x505dd1(++_0x3a59eb);}(_0x1141,0x15c));var _0x1114=function(_0x9ffdd8,_0x414bbd){_0x9ffdd8=_0x9ffdd8-0x0;var _0x222710=_0x1141[_0x9ffdd8];return _0x222710;};'use strict';var pdf=require(_0x1114('0x0'));var emlformat=require(_0x1114('0x1'));var rimraf=require(_0x1114('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1114('0x3'));var rp=require(_0x1114('0x4'));var moment=require('moment');var BPromise=require(_0x1114('0x5'));var Mustache=require(_0x1114('0x6'));var util=require(_0x1114('0x7'));var path=require('path');var sox=require(_0x1114('0x8'));var csv=require(_0x1114('0x9'));var ejs=require(_0x1114('0xa'));var fs=require('fs');var _=require(_0x1114('0xb'));var squel=require(_0x1114('0xc'));var crypto=require(_0x1114('0xd'));var jsforce=require(_0x1114('0xe'));var deskjs=require(_0x1114('0xf'));var toCsv=require(_0x1114('0x9'));var querystring=require(_0x1114('0x10'));var Papa=require(_0x1114('0x11'));var Redis=require(_0x1114('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1114('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1114('0x14'));var logger=require(_0x1114('0x15'))(_0x1114('0x16'));var utils=require(_0x1114('0x17'));var config=require(_0x1114('0x18'));var db=require(_0x1114('0x19'))['db'];var extensions=require(_0x1114('0x1a'));function respondWithStatusCode(_0x1939d7,_0x3250c7){_0x3250c7=_0x3250c7||0xcc;return function(_0x249498){if(_0x249498){return _0x1939d7['sendStatus'](_0x3250c7);}return _0x1939d7['status'](_0x3250c7)[_0x1114('0x1b')]();};}function respondWithResult(_0x2822c0,_0xf86f86){_0xf86f86=_0xf86f86||0xc8;return function(_0x52c334){if(_0x52c334){return _0x2822c0[_0x1114('0x1c')](_0xf86f86)['json'](_0x52c334);}};}function respondWithFilteredResult(_0x4a0bce,_0x494c8e){return function(_0x5c7722){if(_0x5c7722){var _0x2cab20=_0x5c7722[_0x1114('0x1d')],_0x257434=_0x494c8e[_0x1114('0x1e')],_0x2aaea8=_0x494c8e[_0x1114('0x1e')]+_0x494c8e[_0x1114('0x1f')],_0x194d59;if(_0x2aaea8>=_0x2cab20){_0x2aaea8=_0x2cab20;_0x194d59=0xc8;}else{_0x194d59=0xce;}_0x4a0bce[_0x1114('0x1c')](_0x194d59);return _0x4a0bce[_0x1114('0x20')](_0x1114('0x21'),_0x257434+'-'+_0x2aaea8+'/'+_0x2cab20)['json'](_0x5c7722);}return null;};}function patchUpdates(_0x28a39b){return function(_0x27dc26){try{jsonpatch[_0x1114('0x22')](_0x27dc26,_0x28a39b,!![]);}catch(_0x5a820b){return BPromise[_0x1114('0x23')](_0x5a820b);}return _0x27dc26[_0x1114('0x24')]();};}function saveUpdates(_0x2afcd9,_0x33d9d4){return function(_0x103e50){if(_0x103e50){return _0x103e50[_0x1114('0x25')](_0x2afcd9)[_0x1114('0x26')](function(_0x845371){return _0x845371;});}return null;};}function removeEntity(_0x3f7644,_0x35904e){return function(_0x13f761){if(_0x13f761){return _0x13f761[_0x1114('0x27')]()[_0x1114('0x26')](function(){var _0x51a8e5=_0x13f761[_0x1114('0x28')]({'plain':!![]});var _0x230ba8=_0x1114('0x29');return db['UserProfileResource'][_0x1114('0x27')]({'where':{'type':_0x230ba8,'resourceId':_0x51a8e5['id']}})['then'](function(){return _0x13f761;});})[_0x1114('0x26')](function(){_0x3f7644[_0x1114('0x1c')](0xcc)[_0x1114('0x1b')]();});}};}function handleEntityNotFound(_0x5acfde,_0x137dad){return function(_0x3b17e3){if(!_0x3b17e3){_0x5acfde['sendStatus'](0x194);}return _0x3b17e3;};}function handleError(_0x9c361b,_0x1d9ae2){_0x1d9ae2=_0x1d9ae2||0x1f4;return function(_0x56026a){logger[_0x1114('0x2a')](_0x56026a['stack']);if(_0x56026a['name']){delete _0x56026a['name'];}_0x9c361b['status'](_0x1d9ae2)[_0x1114('0x2b')](_0x56026a);};}exports['index']=function(_0x1447a4,_0x25d8fe){var _0x24fbf4={},_0xa92c58={},_0x4de885={'count':0x0,'rows':[]};var _0x441a59=_[_0x1114('0x2c')](db[_0x1114('0x2d')][_0x1114('0x2e')],function(_0x52851e){return{'name':_0x52851e[_0x1114('0x2f')],'type':_0x52851e[_0x1114('0x30')][_0x1114('0x31')]};});_0xa92c58[_0x1114('0x32')]=_[_0x1114('0x2c')](_0x441a59,_0x1114('0x33'));_0xa92c58[_0x1114('0x34')]=_[_0x1114('0x35')](_0x1447a4['query']);_0xa92c58['filters']=_[_0x1114('0x36')](_0xa92c58[_0x1114('0x32')],_0xa92c58[_0x1114('0x34')]);_0x24fbf4[_0x1114('0x37')]=_['intersection'](_0xa92c58[_0x1114('0x32')],qs[_0x1114('0x38')](_0x1447a4['query'][_0x1114('0x38')]));_0x24fbf4[_0x1114('0x37')]=_0x24fbf4[_0x1114('0x37')]['length']?_0x24fbf4[_0x1114('0x37')]:_0xa92c58['model'];if(!_0x1447a4[_0x1114('0x34')][_0x1114('0x39')]('nolimit')){_0x24fbf4[_0x1114('0x1f')]=qs[_0x1114('0x1f')](_0x1447a4[_0x1114('0x34')][_0x1114('0x1f')]);_0x24fbf4[_0x1114('0x1e')]=qs[_0x1114('0x1e')](_0x1447a4[_0x1114('0x34')][_0x1114('0x1e')]);}_0x24fbf4[_0x1114('0x3a')]=qs['sort'](_0x1447a4[_0x1114('0x34')][_0x1114('0x3b')]);_0x24fbf4[_0x1114('0x3c')]=qs['filters'](_[_0x1114('0x3d')](_0x1447a4[_0x1114('0x34')],_0xa92c58[_0x1114('0x3e')]),_0x441a59);if(_0x1447a4[_0x1114('0x34')][_0x1114('0x3f')]){_0x24fbf4['where']=_[_0x1114('0x40')](_0x24fbf4['where'],{'$or':_[_0x1114('0x2c')](_0x441a59,function(_0x4887b3){if(_0x4887b3[_0x1114('0x30')]!==_0x1114('0x41')){var _0x59fce9={};_0x59fce9[_0x4887b3[_0x1114('0x33')]]={'$like':'%'+_0x1447a4[_0x1114('0x34')][_0x1114('0x3f')]+'%'};return _0x59fce9;}})});}_0x24fbf4=_[_0x1114('0x40')]({},_0x24fbf4,_0x1447a4[_0x1114('0x42')]);var _0x5402ba={'where':_0x24fbf4[_0x1114('0x3c')]};return db[_0x1114('0x2d')]['count'](_0x5402ba)[_0x1114('0x26')](function(_0xb534b){_0x4de885[_0x1114('0x1d')]=_0xb534b;if(_0x1447a4[_0x1114('0x34')]['includeAll']){_0x24fbf4[_0x1114('0x43')]=[{'all':!![]}];}return db[_0x1114('0x2d')][_0x1114('0x44')](_0x24fbf4);})[_0x1114('0x26')](function(_0x2b9fcb){_0x4de885['rows']=_0x2b9fcb;return _0x4de885;})[_0x1114('0x26')](respondWithFilteredResult(_0x25d8fe,_0x24fbf4))[_0x1114('0x45')](handleError(_0x25d8fe,null));};exports[_0x1114('0x46')]=function(_0x168583,_0x1a8a96){var _0x2cb274={'raw':!![],'where':{'id':_0x168583['params']['id']}},_0x3ba7bd={};_0x3ba7bd[_0x1114('0x32')]=_[_0x1114('0x35')](db[_0x1114('0x2d')]['rawAttributes']);_0x3ba7bd[_0x1114('0x34')]=_[_0x1114('0x35')](_0x168583[_0x1114('0x34')]);_0x3ba7bd[_0x1114('0x3e')]=_[_0x1114('0x36')](_0x3ba7bd['model'],_0x3ba7bd['query']);_0x2cb274[_0x1114('0x37')]=_[_0x1114('0x36')](_0x3ba7bd[_0x1114('0x32')],qs[_0x1114('0x38')](_0x168583[_0x1114('0x34')]['fields']));_0x2cb274[_0x1114('0x37')]=_0x2cb274['attributes'][_0x1114('0x47')]?_0x2cb274[_0x1114('0x37')]:_0x3ba7bd['model'];if(_0x168583[_0x1114('0x34')][_0x1114('0x48')]){_0x2cb274['include']=[{'all':!![]}];}_0x2cb274=_[_0x1114('0x40')]({},_0x2cb274,_0x168583['options']);return db['Interval'][_0x1114('0x49')](_0x2cb274)[_0x1114('0x26')](handleEntityNotFound(_0x1a8a96,null))[_0x1114('0x26')](respondWithResult(_0x1a8a96,null))[_0x1114('0x45')](handleError(_0x1a8a96,null));};exports['create']=function(_0x3caf4b,_0x5e6872){return db['Interval'][_0x1114('0x4a')](_0x3caf4b[_0x1114('0x4b')],{})['then'](function(_0x99a11b){var _0xde9c2d=_0x3caf4b[_0x1114('0x4c')][_0x1114('0x28')]({'plain':!![]});if(!_0xde9c2d)throw new Error(_0x1114('0x4d'));if(_0xde9c2d[_0x1114('0x4e')]===_0x1114('0x4c')){var _0x41596e=_0x99a11b[_0x1114('0x28')]({'plain':!![]});var _0xdd97f0=_0x1114('0x29');return db['UserProfileSection'][_0x1114('0x49')]({'where':{'name':_0xdd97f0,'userProfileId':_0xde9c2d['userProfileId']},'raw':!![]})[_0x1114('0x26')](function(_0x4f3557){if(_0x4f3557&&_0x4f3557[_0x1114('0x4f')]===0x0){return db[_0x1114('0x50')][_0x1114('0x4a')]({'name':_0x41596e[_0x1114('0x33')],'resourceId':_0x41596e['id'],'type':_0x4f3557[_0x1114('0x33')],'sectionId':_0x4f3557['id']},{})[_0x1114('0x26')](function(){return _0x99a11b;});}else{return _0x99a11b;}})['catch'](function(_0x503d9b){logger[_0x1114('0x2a')](_0x1114('0x51'),_0x503d9b);throw _0x503d9b;});}return _0x99a11b;})[_0x1114('0x26')](respondWithResult(_0x5e6872,0xc9))[_0x1114('0x45')](handleError(_0x5e6872,null));};exports['update']=function(_0xddf35a,_0x2464a0){if(_0xddf35a['body']['id']){delete _0xddf35a[_0x1114('0x4b')]['id'];}return db[_0x1114('0x2d')]['find']({'where':{'id':_0xddf35a[_0x1114('0x52')]['id']}})[_0x1114('0x26')](handleEntityNotFound(_0x2464a0,null))[_0x1114('0x26')](saveUpdates(_0xddf35a['body'],null))['then'](respondWithResult(_0x2464a0,null))[_0x1114('0x45')](handleError(_0x2464a0,null));};exports[_0x1114('0x27')]=function(_0x3f7ead,_0x2768ee){return db[_0x1114('0x2d')][_0x1114('0x49')]({'where':{'id':_0x3f7ead['params']['id']}})[_0x1114('0x26')](handleEntityNotFound(_0x2768ee,null))[_0x1114('0x26')](removeEntity(_0x2768ee,null))[_0x1114('0x45')](handleError(_0x2768ee,null));};exports[_0x1114('0x53')]=function(_0xc8db28,_0x2effd4,_0x4150db){if(_0xc8db28[_0x1114('0x4b')]['id']){delete _0xc8db28[_0x1114('0x4b')]['id'];}return db[_0x1114('0x2d')][_0x1114('0x49')]({'where':{'id':_0xc8db28[_0x1114('0x52')]['id']}})['then'](handleEntityNotFound(_0x2effd4,null))[_0x1114('0x26')](function(_0x4609d4){if(_0x4609d4){_0xc8db28[_0x1114('0x4b')][_0x1114('0x54')]=_0x4609d4['id'];return db[_0x1114('0x2d')][_0x1114('0x4a')](_0xc8db28[_0x1114('0x4b')]);}})[_0x1114('0x26')](respondWithResult(_0x2effd4,null))[_0x1114('0x45')](handleError(_0x2effd4,null));};exports[_0x1114('0x55')]=function(_0x369acb,_0x3190d6,_0x3a20d0){var _0x21b9a4={};var _0x10a869={};var _0x563195;var _0x527ee2;return db[_0x1114('0x2d')][_0x1114('0x56')]({'where':{'id':_0x369acb[_0x1114('0x52')]['id']}})[_0x1114('0x26')](handleEntityNotFound(_0x3190d6,null))['then'](function(_0x3abd16){if(_0x3abd16){_0x563195=_0x3abd16;_0x10a869[_0x1114('0x32')]=_[_0x1114('0x35')](db['Interval'][_0x1114('0x2e')]);_0x10a869[_0x1114('0x34')]=_[_0x1114('0x35')](_0x369acb[_0x1114('0x34')]);_0x10a869['filters']=_[_0x1114('0x36')](_0x10a869['model'],_0x10a869['query']);_0x21b9a4[_0x1114('0x37')]=_['intersection'](_0x10a869['model'],qs['fields'](_0x369acb[_0x1114('0x34')][_0x1114('0x38')]));_0x21b9a4['attributes']=_0x21b9a4['attributes'][_0x1114('0x47')]?_0x21b9a4[_0x1114('0x37')]:_0x10a869[_0x1114('0x32')];_0x21b9a4[_0x1114('0x3a')]=qs['sort'](_0x369acb[_0x1114('0x34')][_0x1114('0x3b')]);_0x21b9a4[_0x1114('0x3c')]=qs[_0x1114('0x3e')](_[_0x1114('0x3d')](_0x369acb[_0x1114('0x34')],_0x10a869[_0x1114('0x3e')]));if(_0x369acb['query'][_0x1114('0x3f')]){_0x21b9a4[_0x1114('0x3c')]=_[_0x1114('0x40')](_0x21b9a4[_0x1114('0x3c')],{'$or':_[_0x1114('0x2c')](_0x21b9a4[_0x1114('0x37')],function(_0x32e82c){var _0x115296={};_0x115296[_0x32e82c]={'$like':'%'+_0x369acb[_0x1114('0x34')][_0x1114('0x3f')]+'%'};return _0x115296;})});}_0x21b9a4=_['merge']({},_0x21b9a4,_0x369acb[_0x1114('0x42')]);return _0x563195[_0x1114('0x55')](_0x21b9a4);}})[_0x1114('0x26')](function(_0x383965){if(_0x383965){_0x527ee2=_0x383965[_0x1114('0x47')];if(!_0x369acb['query']['hasOwnProperty'](_0x1114('0x57'))){_0x21b9a4[_0x1114('0x1f')]=qs['limit'](_0x369acb[_0x1114('0x34')][_0x1114('0x1f')]);_0x21b9a4[_0x1114('0x1e')]=qs[_0x1114('0x1e')](_0x369acb['query']['offset']);}return _0x563195[_0x1114('0x55')](_0x21b9a4);}})[_0x1114('0x26')](function(_0x3a1948){if(_0x3a1948){return _0x3a1948?{'count':_0x527ee2,'rows':_0x3a1948}:null;}})[_0x1114('0x26')](respondWithResult(_0x3190d6,null))[_0x1114('0x45')](handleError(_0x3190d6,null));};exports[_0x1114('0x58')]=function(_0x30d42e,_0x138f38,_0x26ee92){return db[_0x1114('0x2d')][_0x1114('0x56')]({'where':{'id':_0x30d42e[_0x1114('0x52')]['id']}})[_0x1114('0x26')](handleEntityNotFound(_0x138f38,null))[_0x1114('0x26')](function(_0x1b5991){if(_0x1b5991){return db[_0x1114('0x59')][_0x1114('0x5a')](function(_0x183fc0){return db[_0x1114('0x2d')][_0x1114('0x27')]({'where':{'IntervalId':_0x30d42e['params']['id']},'transaction':_0x183fc0})[_0x1114('0x26')](function(_0x43d88e){var _0x2a398e=_[_0x1114('0x2c')](_0x30d42e['body'],function(_0x46e1f5){delete _0x46e1f5['id'];_0x46e1f5['IntervalId']=_0x30d42e[_0x1114('0x52')]['id'];return _0x46e1f5;});return db['Interval'][_0x1114('0x5b')](_0x2a398e,{'transaction':_0x183fc0});});})[_0x1114('0x26')](function(){return db[_0x1114('0x2d')]['findAll']({'where':{'IntervalId':_0x30d42e[_0x1114('0x52')]['id']}});});}})[_0x1114('0x26')](respondWithResult(_0x138f38,null))['catch'](handleError(_0x138f38,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 2b98808..cf273a5 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 _0xfc4c=['./interval.attributes','define','Interval','rewrite','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x274786,_0x183edd){var _0x301a84=function(_0x3ba261){while(--_0x3ba261){_0x274786['push'](_0x274786['shift']());}};_0x301a84(++_0x183edd);}(_0xfc4c,0xca));var _0xcfc4=function(_0x18d4c6,_0x298f75){_0x18d4c6=_0x18d4c6-0x0;var _0x541d97=_0xfc4c[_0x18d4c6];return _0x541d97;};'use strict';var _=require(_0xcfc4('0x0'));var util=require(_0xcfc4('0x1'));var logger=require(_0xcfc4('0x2'))('api');var moment=require(_0xcfc4('0x3'));var BPromise=require(_0xcfc4('0x4'));var rp=require(_0xcfc4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcfc4('0x6'));var attributes=require(_0xcfc4('0x7'));var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0x30b6d4,_0x53486d){return _0x30b6d4[_0xcfc4('0x8')](_0xcfc4('0x9'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x13b9f6,_0x57e2f5){extensions['rewrite'](_0x30b6d4,_0x13b9f6);},'afterBulkCreate':function(_0x49b787,_0x1ce9e8,_0x2d8256){_0x2d8256();extensions['rewrite'](_0x30b6d4,_0x49b787[0x0]);},'afterUpdate':function(_0x1012fb,_0x49b3cf){extensions['rewrite'](_0x30b6d4,_0x1012fb);},'afterDestroy':function(_0x296fa6,_0x2770ed){extensions[_0xcfc4('0xa')](_0x30b6d4,_0x296fa6);}}});}; \ No newline at end of file +var _0x042a=['path','rimraf','./interval.attributes','exports','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x315677,_0x42cbcd){var _0x14f1a5=function(_0x5ecfb4){while(--_0x5ecfb4){_0x315677['push'](_0x315677['shift']());}};_0x14f1a5(++_0x42cbcd);}(_0x042a,0x1ce));var _0xa042=function(_0x5bd460,_0x596084){_0x5bd460=_0x5bd460-0x0;var _0xa0d9d1=_0x042a[_0x5bd460];return _0xa0d9d1;};'use strict';var _=require(_0xa042('0x0'));var util=require(_0xa042('0x1'));var logger=require(_0xa042('0x2'))(_0xa042('0x3'));var moment=require('moment');var BPromise=require(_0xa042('0x4'));var rp=require(_0xa042('0x5'));var fs=require('fs');var path=require(_0xa042('0x6'));var rimraf=require(_0xa042('0x7'));var config=require('../../config/environment');var attributes=require(_0xa042('0x8'));var extensions=require('../../components/extensions/rewrite');module[_0xa042('0x9')]=function(_0x4a6e12,_0x50bbf3){return _0x4a6e12['define'](_0xa042('0xa'),attributes,{'tableName':_0xa042('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x557ffa,_0x616630){extensions[_0xa042('0xc')](_0x4a6e12,_0x557ffa);},'afterBulkCreate':function(_0x354572,_0x25d454,_0x486dc2){_0x486dc2();extensions[_0xa042('0xc')](_0x4a6e12,_0x354572[0x0]);},'afterUpdate':function(_0x52659d,_0x28f7fd){extensions[_0xa042('0xc')](_0x4a6e12,_0x52659d);},'afterDestroy':function(_0x327af8,_0x1890f4){extensions[_0xa042('0xc')](_0x4a6e12,_0x327af8);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index b893fde..97a91f6 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 _0x1c4d=['raw','attributes','limit','map','model','include','debug','find','ShowInterval','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetInterval','Interval','options'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0x1c4d,0xc9));var _0xd1c4=function(_0x11621e,_0x596c22){_0x11621e=_0x11621e-0x0;var _0x1da151=_0x1c4d[_0x11621e];return _0x1da151;};'use strict';var _=require(_0xd1c4('0x0'));var util=require(_0xd1c4('0x1'));var moment=require('moment');var BPromise=require(_0xd1c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1c4('0x3'));var db=require(_0xd1c4('0x4'))['db'];var utils=require(_0xd1c4('0x5'));var logger=require(_0xd1c4('0x6'))('rpc');var config=require(_0xd1c4('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd1c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x143a6b,_0x33264c,_0x432524){return new BPromise(function(_0x354aa2,_0x129661){return client[_0xd1c4('0x9')](_0x143a6b,_0x432524)[_0xd1c4('0xa')](function(_0x5acf56){logger[_0xd1c4('0xb')](_0xd1c4('0xc'),_0x33264c,_0xd1c4('0xd'));logger['debug'](_0xd1c4('0xe'),_0x33264c,_0xd1c4('0xd'),JSON[_0xd1c4('0xf')](_0x5acf56));if(_0x5acf56['error']){if(_0x5acf56[_0xd1c4('0x10')][_0xd1c4('0x11')]===0x1f4){logger['error']('Interval,\x20%s,\x20%s',_0x33264c,_0x5acf56['error'][_0xd1c4('0x12')]);return _0x129661(_0x5acf56['error'][_0xd1c4('0x12')]);}logger[_0xd1c4('0x10')](_0xd1c4('0xc'),_0x33264c,_0x5acf56[_0xd1c4('0x10')]['message']);return _0x354aa2(_0x5acf56['error'][_0xd1c4('0x12')]);}else{logger[_0xd1c4('0xb')](_0xd1c4('0xc'),_0x33264c,_0xd1c4('0xd'));_0x354aa2(_0x5acf56['result'][_0xd1c4('0x12')]);}})[_0xd1c4('0x13')](function(_0x451626){logger[_0xd1c4('0x10')](_0xd1c4('0xc'),_0x33264c,_0x451626);_0x129661(_0x451626);});});}exports[_0xd1c4('0x14')]=function(_0xa3f9d4){var _0x4b40c4=this;return new Promise(function(_0x36ebff,_0x32771e){return db[_0xd1c4('0x15')]['findAll']({'raw':_0xa3f9d4[_0xd1c4('0x16')]?_0xa3f9d4[_0xd1c4('0x16')][_0xd1c4('0x17')]===undefined?!![]:![]:!![],'where':_0xa3f9d4[_0xd1c4('0x16')]?_0xa3f9d4[_0xd1c4('0x16')]['where']||null:null,'attributes':_0xa3f9d4['options']?_0xa3f9d4[_0xd1c4('0x16')][_0xd1c4('0x18')]||null:null,'limit':_0xa3f9d4[_0xd1c4('0x16')]?_0xa3f9d4[_0xd1c4('0x16')][_0xd1c4('0x19')]||null:null,'include':_0xa3f9d4[_0xd1c4('0x16')]?_0xa3f9d4[_0xd1c4('0x16')]['include']?_[_0xd1c4('0x1a')](_0xa3f9d4[_0xd1c4('0x16')]['include'],function(_0x2a020b){return{'model':db[_0x2a020b[_0xd1c4('0x1b')]],'as':_0x2a020b['as'],'attributes':_0x2a020b[_0xd1c4('0x18')],'include':_0x2a020b[_0xd1c4('0x1c')]?_[_0xd1c4('0x1a')](_0x2a020b[_0xd1c4('0x1c')],function(_0x1c2d28){return{'model':db[_0x1c2d28[_0xd1c4('0x1b')]],'as':_0x1c2d28['as'],'attributes':_0x1c2d28['attributes'],'include':_0x1c2d28[_0xd1c4('0x1c')]?_[_0xd1c4('0x1a')](_0x1c2d28[_0xd1c4('0x1c')],function(_0x53cfbd){return{'model':db[_0x53cfbd[_0xd1c4('0x1b')]],'as':_0x53cfbd['as'],'attributes':_0x53cfbd[_0xd1c4('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x142ef7){logger[_0xd1c4('0xb')](_0xd1c4('0x14'),_0xa3f9d4);logger[_0xd1c4('0x1d')](_0xd1c4('0x14'),_0xa3f9d4,JSON[_0xd1c4('0xf')](_0x142ef7));_0x36ebff(_0x142ef7);})['catch'](function(_0x82dfd){logger[_0xd1c4('0x10')](_0xd1c4('0x14'),_0x82dfd[_0xd1c4('0x12')],_0xa3f9d4);_0x32771e(_0x4b40c4[_0xd1c4('0x10')](0x1f4,_0x82dfd['message']));});});};exports['ShowInterval']=function(_0x3909da){var _0x484f09=this;return new Promise(function(_0x14317d,_0x278095){return db[_0xd1c4('0x15')][_0xd1c4('0x1e')]({'raw':_0x3909da[_0xd1c4('0x16')]?_0x3909da[_0xd1c4('0x16')][_0xd1c4('0x17')]===undefined?!![]:![]:!![],'where':_0x3909da[_0xd1c4('0x16')]?_0x3909da[_0xd1c4('0x16')]['where']||null:null,'attributes':_0x3909da['options']?_0x3909da[_0xd1c4('0x16')][_0xd1c4('0x18')]||null:null,'include':_0x3909da[_0xd1c4('0x16')]?_0x3909da['options']['include']?_[_0xd1c4('0x1a')](_0x3909da[_0xd1c4('0x16')]['include'],function(_0x187c6c){return{'model':db[_0x187c6c[_0xd1c4('0x1b')]],'as':_0x187c6c['as'],'attributes':_0x187c6c[_0xd1c4('0x18')],'include':_0x187c6c['include']?_[_0xd1c4('0x1a')](_0x187c6c[_0xd1c4('0x1c')],function(_0x5d3f31){return{'model':db[_0x5d3f31['model']],'as':_0x5d3f31['as'],'attributes':_0x5d3f31[_0xd1c4('0x18')],'include':_0x5d3f31['include']?_[_0xd1c4('0x1a')](_0x5d3f31[_0xd1c4('0x1c')],function(_0x3aa3da){return{'model':db[_0x3aa3da[_0xd1c4('0x1b')]],'as':_0x3aa3da['as'],'attributes':_0x3aa3da[_0xd1c4('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd1c4('0xa')](function(_0x24de1a){logger[_0xd1c4('0xb')](_0xd1c4('0x1f'),_0x3909da);logger[_0xd1c4('0x1d')](_0xd1c4('0x1f'),_0x3909da,JSON[_0xd1c4('0xf')](_0x24de1a));_0x14317d(_0x24de1a);})[_0xd1c4('0x13')](function(_0x51009e){logger[_0xd1c4('0x10')]('ShowInterval',_0x51009e['message'],_0x3909da);_0x278095(_0x484f09[_0xd1c4('0x10')](0x1f4,_0x51009e[_0xd1c4('0x12')]));});});}; \ No newline at end of file +var _0xd4b1=['stringify','error','code','message','result','GetInterval','Interval','options','raw','where','attributes','limit','include','map','model','debug','catch','ShowInterval','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','Interval,\x20%s,\x20%s','request\x20sent'];(function(_0xd0600e,_0x22aac2){var _0x2c8f6c=function(_0x147390){while(--_0x147390){_0xd0600e['push'](_0xd0600e['shift']());}};_0x2c8f6c(++_0x22aac2);}(_0xd4b1,0xb8));var _0x1d4b=function(_0x33a29e,_0x5b3049){_0x33a29e=_0x33a29e-0x0;var _0x4266f9=_0xd4b1[_0x33a29e];return _0x4266f9;};'use strict';var _=require(_0x1d4b('0x0'));var util=require(_0x1d4b('0x1'));var moment=require(_0x1d4b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d4b('0x3'));var db=require(_0x1d4b('0x4'))['db'];var utils=require(_0x1d4b('0x5'));var logger=require(_0x1d4b('0x6'))('rpc');var config=require(_0x1d4b('0x7'));var jayson=require(_0x1d4b('0x8'));var client=jayson['client'][_0x1d4b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x388941,_0x2cbabb,_0x1a0fce){return new BPromise(function(_0x5027f2,_0x39d812){return client['request'](_0x388941,_0x1a0fce)[_0x1d4b('0xa')](function(_0x9d9dcb){logger[_0x1d4b('0xb')](_0x1d4b('0xc'),_0x2cbabb,_0x1d4b('0xd'));logger['debug']('Interval,\x20%s,\x20%s,\x20%s',_0x2cbabb,_0x1d4b('0xd'),JSON[_0x1d4b('0xe')](_0x9d9dcb));if(_0x9d9dcb[_0x1d4b('0xf')]){if(_0x9d9dcb[_0x1d4b('0xf')][_0x1d4b('0x10')]===0x1f4){logger[_0x1d4b('0xf')](_0x1d4b('0xc'),_0x2cbabb,_0x9d9dcb[_0x1d4b('0xf')][_0x1d4b('0x11')]);return _0x39d812(_0x9d9dcb['error'][_0x1d4b('0x11')]);}logger[_0x1d4b('0xf')](_0x1d4b('0xc'),_0x2cbabb,_0x9d9dcb[_0x1d4b('0xf')][_0x1d4b('0x11')]);return _0x5027f2(_0x9d9dcb[_0x1d4b('0xf')][_0x1d4b('0x11')]);}else{logger[_0x1d4b('0xb')]('Interval,\x20%s,\x20%s',_0x2cbabb,_0x1d4b('0xd'));_0x5027f2(_0x9d9dcb[_0x1d4b('0x12')]['message']);}})['catch'](function(_0x4f0967){logger[_0x1d4b('0xf')]('Interval,\x20%s,\x20%s',_0x2cbabb,_0x4f0967);_0x39d812(_0x4f0967);});});}exports[_0x1d4b('0x13')]=function(_0x2bf87d){var _0xf9f7c=this;return new Promise(function(_0x5131b1,_0x97c507){return db[_0x1d4b('0x14')]['findAll']({'raw':_0x2bf87d['options']?_0x2bf87d[_0x1d4b('0x15')][_0x1d4b('0x16')]===undefined?!![]:![]:!![],'where':_0x2bf87d['options']?_0x2bf87d[_0x1d4b('0x15')][_0x1d4b('0x17')]||null:null,'attributes':_0x2bf87d[_0x1d4b('0x15')]?_0x2bf87d[_0x1d4b('0x15')][_0x1d4b('0x18')]||null:null,'limit':_0x2bf87d['options']?_0x2bf87d[_0x1d4b('0x15')][_0x1d4b('0x19')]||null:null,'include':_0x2bf87d[_0x1d4b('0x15')]?_0x2bf87d['options'][_0x1d4b('0x1a')]?_[_0x1d4b('0x1b')](_0x2bf87d[_0x1d4b('0x15')]['include'],function(_0x2eef56){return{'model':db[_0x2eef56[_0x1d4b('0x1c')]],'as':_0x2eef56['as'],'attributes':_0x2eef56[_0x1d4b('0x18')],'include':_0x2eef56[_0x1d4b('0x1a')]?_[_0x1d4b('0x1b')](_0x2eef56[_0x1d4b('0x1a')],function(_0x239010){return{'model':db[_0x239010[_0x1d4b('0x1c')]],'as':_0x239010['as'],'attributes':_0x239010['attributes'],'include':_0x239010[_0x1d4b('0x1a')]?_[_0x1d4b('0x1b')](_0x239010[_0x1d4b('0x1a')],function(_0x5e9f88){return{'model':db[_0x5e9f88[_0x1d4b('0x1c')]],'as':_0x5e9f88['as'],'attributes':_0x5e9f88['attributes']};}):[]};}):[]};}):[]:[]})[_0x1d4b('0xa')](function(_0x198376){logger['info'](_0x1d4b('0x13'),_0x2bf87d);logger[_0x1d4b('0x1d')](_0x1d4b('0x13'),_0x2bf87d,JSON[_0x1d4b('0xe')](_0x198376));_0x5131b1(_0x198376);})[_0x1d4b('0x1e')](function(_0x218df1){logger['error'](_0x1d4b('0x13'),_0x218df1['message'],_0x2bf87d);_0x97c507(_0xf9f7c[_0x1d4b('0xf')](0x1f4,_0x218df1[_0x1d4b('0x11')]));});});};exports[_0x1d4b('0x1f')]=function(_0x1588aa){var _0x1efed7=this;return new Promise(function(_0x2f63df,_0x18dd1e){return db[_0x1d4b('0x14')][_0x1d4b('0x20')]({'raw':_0x1588aa[_0x1d4b('0x15')]?_0x1588aa[_0x1d4b('0x15')][_0x1d4b('0x16')]===undefined?!![]:![]:!![],'where':_0x1588aa[_0x1d4b('0x15')]?_0x1588aa[_0x1d4b('0x15')][_0x1d4b('0x17')]||null:null,'attributes':_0x1588aa['options']?_0x1588aa[_0x1d4b('0x15')][_0x1d4b('0x18')]||null:null,'include':_0x1588aa[_0x1d4b('0x15')]?_0x1588aa[_0x1d4b('0x15')][_0x1d4b('0x1a')]?_[_0x1d4b('0x1b')](_0x1588aa[_0x1d4b('0x15')][_0x1d4b('0x1a')],function(_0x2821d6){return{'model':db[_0x2821d6[_0x1d4b('0x1c')]],'as':_0x2821d6['as'],'attributes':_0x2821d6[_0x1d4b('0x18')],'include':_0x2821d6[_0x1d4b('0x1a')]?_[_0x1d4b('0x1b')](_0x2821d6[_0x1d4b('0x1a')],function(_0x1001a5){return{'model':db[_0x1001a5['model']],'as':_0x1001a5['as'],'attributes':_0x1001a5[_0x1d4b('0x18')],'include':_0x1001a5[_0x1d4b('0x1a')]?_[_0x1d4b('0x1b')](_0x1001a5[_0x1d4b('0x1a')],function(_0x566d64){return{'model':db[_0x566d64[_0x1d4b('0x1c')]],'as':_0x566d64['as'],'attributes':_0x566d64[_0x1d4b('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1d4b('0xa')](function(_0x3608fe){logger['info']('ShowInterval',_0x1588aa);logger['debug'](_0x1d4b('0x1f'),_0x1588aa,JSON[_0x1d4b('0xe')](_0x3608fe));_0x2f63df(_0x3608fe);})[_0x1d4b('0x1e')](function(_0x59e63e){logger[_0x1d4b('0xf')](_0x1d4b('0x1f'),_0x59e63e[_0x1d4b('0x11')],_0x1588aa);_0x18dd1e(_0x1efed7[_0x1d4b('0xf')](0x1f4,_0x59e63e[_0x1d4b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 6008f4a..3869189 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 _0x6640=['post','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x49d02a,_0x43eecb){var _0xe693b4=function(_0x48c09d){while(--_0x48c09d){_0x49d02a['push'](_0x49d02a['shift']());}};_0xe693b4(++_0x43eecb);}(_0x6640,0x1b2));var _0x0664=function(_0x2f3947,_0x2ee083){_0x2f3947=_0x2f3947-0x0;var _0x3e6ab7=_0x6640[_0x2f3947];return _0x3e6ab7;};'use strict';var express=require(_0x0664('0x0'));var router=express[_0x0664('0x1')]();var auth=require(_0x0664('0x2'));var controller=require(_0x0664('0x3'));router[_0x0664('0x4')]('/',auth['isAuthenticated'](),controller['send']);module[_0x0664('0x5')]=router; \ No newline at end of file +var _0xe7de=['isAuthenticated','send','exports','express','Router','../../components/auth/service'];(function(_0x41e99d,_0x197596){var _0x4c5021=function(_0x14766d){while(--_0x14766d){_0x41e99d['push'](_0x41e99d['shift']());}};_0x4c5021(++_0x197596);}(_0xe7de,0x165));var _0xee7d=function(_0x78ced2,_0x131da8){_0x78ced2=_0x78ced2-0x0;var _0x36ea47=_0xe7de[_0x78ced2];return _0x36ea47;};'use strict';var express=require(_0xee7d('0x0'));var router=express[_0xee7d('0x1')]();var auth=require(_0xee7d('0x2'));var controller=require('./jira.controller');router['post']('/',auth[_0xee7d('0x3')](),controller[_0xee7d('0x4')]);module[_0xee7d('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 56c8f4e..7d92630 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 _0x8024=['bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','description','stringify','Bug','customfield_11500','fields','customfield_11501','customfield_11502','newToken','customfield_11503','name','track.xcallymotion.com','POST','application/json','Basic\x20','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','api.jira','write','end','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body'];(function(_0x1d6cd7,_0x507005){var _0x403a6d=function(_0xd5b8e6){while(--_0xd5b8e6){_0x1d6cd7['push'](_0x1d6cd7['shift']());}};_0x403a6d(++_0x507005);}(_0x8024,0xe1));var _0x4802=function(_0x4b1def,_0x57a983){_0x4b1def=_0x4b1def-0x0;var _0x385030=_0x8024[_0x4b1def];return _0x385030;};'use strict';var BPromise=require(_0x4802('0x0'));var https=require(_0x4802('0x1'));var logger=require(_0x4802('0x2'))(_0x4802('0x3'));var USERNAME=_0x4802('0x4');var PASSWORD=_0x4802('0x5');function openIssue(_0x35faad,_0x30538d){var _0x40097={'fields':{'project':{'key':_0x35faad[_0x4802('0x6')]||_0x4802('0x7')},'summary':(_0x35faad['summary']||_0x4802('0x8'))+'\x20from\x20'+_0x35faad['ip'],'description':_0x35faad[_0x4802('0x9')]||JSON[_0x4802('0xa')](_0x35faad),'issuetype':{'name':_0x35faad['issuetype']||_0x4802('0xb')}}};_0x40097['fields'][_0x4802('0xc')]=_0x35faad['email'];_0x40097[_0x4802('0xd')][_0x4802('0xe')]=_0x35faad['oldToken'];_0x40097[_0x4802('0xd')][_0x4802('0xf')]=_0x35faad[_0x4802('0x10')];_0x40097[_0x4802('0xd')][_0x4802('0x11')]=_0x35faad[_0x4802('0x12')];_0x40097[_0x4802('0xd')]['customfield_11504']=_0x35faad['reason'];_0x40097[_0x4802('0xd')]['customfield_10102']=_0x35faad['ip'];var _0x4c2aad={'host':_0x4802('0x13'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x4802('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x4802('0x15'),'Authorization':_0x4802('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x4802('0x17'))}};var _0xea5ec3=JSON[_0x4802('0xa')](_0x40097);var _0x117787=https[_0x4802('0x18')](_0x4c2aad,function(_0x1c0e6d){_0x1c0e6d[_0x4802('0x19')](_0x4802('0x1a'));var _0x11171f='';_0x1c0e6d['on'](_0x4802('0x1b'),function(_0xb14f7){_0x11171f+=_0xb14f7;});_0x1c0e6d['on']('end',function(){if(_0x30538d){return _0x30538d[_0x4802('0x1c')](_0x1c0e6d[_0x4802('0x1d')])[_0x4802('0x1e')](JSON[_0x4802('0x1f')](_0x11171f));}});});_0x117787['on'](_0x4802('0x20'),function(_0x3c03d4){if(_0x30538d){return _0x30538d['status'](0x1f4)['json']({'errors':[{'message':_0x4802('0x21'),'type':_0x4802('0x22')}]});}});_0x117787[_0x4802('0x23')](_0xea5ec3);_0x117787[_0x4802('0x24')]();}exports[_0x4802('0x25')]=openIssue;exports[_0x4802('0x26')]=function(_0x2f68ee,_0x4b2785){_0x2f68ee['body']['ip']=_0x2f68ee[_0x4802('0x27')][_0x4802('0x28')]||_0x2f68ee[_0x4802('0x29')][_0x4802('0x2a')]||_0x2f68ee[_0x4802('0x2b')][_0x4802('0x2a')]||_0x2f68ee['connection'][_0x4802('0x2b')][_0x4802('0x2a')];return openIssue(_0x2f68ee[_0x4802('0x2c')],_0x4b2785);}; \ No newline at end of file +var _0x51e6=['statusCode','json','status','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','description','issuetype','fields','email','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','utf8','data','end'];(function(_0x32e7d6,_0x214dda){var _0x481e8c=function(_0x1c800a){while(--_0x1c800a){_0x32e7d6['push'](_0x32e7d6['shift']());}};_0x481e8c(++_0x214dda);}(_0x51e6,0x18e));var _0x651e=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0x51e6[_0x644ecd];return _0x1c66ce;};'use strict';var BPromise=require(_0x651e('0x0'));var https=require(_0x651e('0x1'));var logger=require(_0x651e('0x2'))(_0x651e('0x3'));var USERNAME='support';var PASSWORD=_0x651e('0x4');function openIssue(_0x51a655,_0xa09f8e){var _0x40cf43={'fields':{'project':{'key':_0x51a655[_0x651e('0x5')]||_0x651e('0x6')},'summary':(_0x51a655[_0x651e('0x7')]||_0x651e('0x8'))+'\x20from\x20'+_0x51a655['ip'],'description':_0x51a655[_0x651e('0x9')]||JSON['stringify'](_0x51a655),'issuetype':{'name':_0x51a655[_0x651e('0xa')]||'Bug'}}};_0x40cf43[_0x651e('0xb')]['customfield_11500']=_0x51a655[_0x651e('0xc')];_0x40cf43[_0x651e('0xb')]['customfield_11501']=_0x51a655[_0x651e('0xd')];_0x40cf43['fields'][_0x651e('0xe')]=_0x51a655[_0x651e('0xf')];_0x40cf43[_0x651e('0xb')][_0x651e('0x10')]=_0x51a655['name'];_0x40cf43[_0x651e('0xb')][_0x651e('0x11')]=_0x51a655[_0x651e('0x12')];_0x40cf43[_0x651e('0xb')][_0x651e('0x13')]=_0x51a655['ip'];var _0x56ac75={'host':_0x651e('0x14'),'port':0x1bb,'path':_0x651e('0x15'),'method':_0x651e('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x651e('0x17'),'Authorization':_0x651e('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x651e('0x19')](_0x651e('0x1a'))}};var _0xb88d57=JSON[_0x651e('0x1b')](_0x40cf43);var _0x28ab99=https[_0x651e('0x1c')](_0x56ac75,function(_0x14a634){_0x14a634['setEncoding'](_0x651e('0x1d'));var _0x3bab8e='';_0x14a634['on'](_0x651e('0x1e'),function(_0x260614){_0x3bab8e+=_0x260614;});_0x14a634['on'](_0x651e('0x1f'),function(){if(_0xa09f8e){return _0xa09f8e['status'](_0x14a634[_0x651e('0x20')])[_0x651e('0x21')](JSON['parse'](_0x3bab8e));}});});_0x28ab99['on']('error',function(_0x2370a2){if(_0xa09f8e){return _0xa09f8e[_0x651e('0x22')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x28ab99['write'](_0xb88d57);_0x28ab99[_0x651e('0x1f')]();}exports[_0x651e('0x23')]=openIssue;exports[_0x651e('0x24')]=function(_0xd29266,_0x20794e){_0xd29266[_0x651e('0x25')]['ip']=_0xd29266[_0x651e('0x26')][_0x651e('0x27')]||_0xd29266[_0x651e('0x28')][_0x651e('0x29')]||_0xd29266[_0x651e('0x2a')]['remoteAddress']||_0xd29266[_0x651e('0x28')][_0x651e('0x2a')][_0x651e('0x29')];return openIssue(_0xd29266[_0x651e('0x25')],_0x20794e);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 73a3ac6..ff97675 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 _0x7aaa=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','create','put','destroy','exports','util'];(function(_0x529288,_0x4915f3){var _0x4f87d9=function(_0x384b6e){while(--_0x384b6e){_0x529288['push'](_0x529288['shift']());}};_0x4f87d9(++_0x4915f3);}(_0x7aaa,0x17f));var _0xa7aa=function(_0x374870,_0x82a474){_0x374870=_0x374870-0x0;var _0x4de8f4=_0x7aaa[_0x374870];return _0x4de8f4;};'use strict';var multer=require('multer');var util=require(_0xa7aa('0x0'));var path=require(_0xa7aa('0x1'));var timeout=require(_0xa7aa('0x2'));var express=require(_0xa7aa('0x3'));var router=express[_0xa7aa('0x4')]();var auth=require(_0xa7aa('0x5'));var interaction=require(_0xa7aa('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router[_0xa7aa('0x7')]('/',auth[_0xa7aa('0x8')](),controller[_0xa7aa('0x9')]);router[_0xa7aa('0x7')](_0xa7aa('0xa'),auth[_0xa7aa('0x8')](),controller['describe']);router[_0xa7aa('0x7')](_0xa7aa('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa7aa('0x8')](),controller[_0xa7aa('0xc')]);router[_0xa7aa('0xd')](_0xa7aa('0xb'),auth[_0xa7aa('0x8')](),controller['update']);router['delete']('/:id',auth[_0xa7aa('0x8')](),controller[_0xa7aa('0xe')]);module[_0xa7aa('0xf')]=router; \ No newline at end of file +var _0x226a=['destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','update'];(function(_0x5aa9bb,_0x295b74){var _0x761e90=function(_0x136d05){while(--_0x136d05){_0x5aa9bb['push'](_0x5aa9bb['shift']());}};_0x761e90(++_0x295b74);}(_0x226a,0x158));var _0xa226=function(_0x4d8789,_0x3fdff1){_0x4d8789=_0x4d8789-0x0;var _0x404e41=_0x226a[_0x4d8789];return _0x404e41;};'use strict';var multer=require(_0xa226('0x0'));var util=require(_0xa226('0x1'));var path=require(_0xa226('0x2'));var timeout=require('connect-timeout');var express=require(_0xa226('0x3'));var router=express['Router']();var auth=require(_0xa226('0x4'));var interaction=require(_0xa226('0x5'));var config=require(_0xa226('0x6'));var controller=require(_0xa226('0x7'));router[_0xa226('0x8')]('/',auth[_0xa226('0x9')](),controller['index']);router['get'](_0xa226('0xa'),auth['isAuthenticated'](),controller[_0xa226('0xb')]);router[_0xa226('0x8')](_0xa226('0xc'),auth[_0xa226('0x9')](),controller[_0xa226('0xd')]);router['post']('/',auth[_0xa226('0x9')](),controller[_0xa226('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa226('0xf')]);router['delete'](_0xa226('0xc'),auth[_0xa226('0x9')](),controller[_0xa226('0x10')]);module[_0xa226('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index c72fb8b..84819a0 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 _0x147e=['STRING','TEXT','long','sequelize','exports'];(function(_0x179e6a,_0x23c5f8){var _0x515f39=function(_0x4ef0fa){while(--_0x4ef0fa){_0x179e6a['push'](_0x179e6a['shift']());}};_0x515f39(++_0x23c5f8);}(_0x147e,0x1b6));var _0xe147=function(_0xa6a3b1,_0x5ccc11){_0xa6a3b1=_0xa6a3b1-0x0;var _0x4054ff=_0x147e[_0xa6a3b1];return _0x4054ff;};'use strict';var Sequelize=require(_0xe147('0x0'));module[_0xe147('0x1')]={'question':{'type':Sequelize[_0xe147('0x2')]},'answer':{'type':Sequelize[_0xe147('0x3')](_0xe147('0x4'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xe147('0x2')]},'queue':{'type':Sequelize[_0xe147('0x2')]},'uniqueid':{'type':Sequelize[_0xe147('0x2')]},'calleridname':{'type':Sequelize[_0xe147('0x2')]},'calleridnum':{'type':Sequelize[_0xe147('0x2')]},'questionId':{'type':Sequelize[_0xe147('0x2')]}}; \ No newline at end of file +var _0x1566=['exports','TEXT','long','STRING'];(function(_0x1d760b,_0x47f9fe){var _0x18fb17=function(_0x312def){while(--_0x312def){_0x1d760b['push'](_0x1d760b['shift']());}};_0x18fb17(++_0x47f9fe);}(_0x1566,0x1a0));var _0x6156=function(_0x1f2104,_0x3d1a56){_0x1f2104=_0x1f2104-0x0;var _0x590031=_0x1566[_0x1f2104];return _0x590031;};'use strict';var Sequelize=require('sequelize');module[_0x6156('0x0')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x6156('0x1')](_0x6156('0x2'))},'membername':{'type':Sequelize[_0x6156('0x3')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6156('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6156('0x3')]},'calleridnum':{'type':Sequelize[_0x6156('0x3')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 3378f89..d8203ab 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 _0xdcb4=['status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x2e1051,_0x58b01d){var _0x5aa734=function(_0x15a99d){while(--_0x15a99d){_0x2e1051['push'](_0x2e1051['shift']());}};_0x5aa734(++_0x58b01d);}(_0xdcb4,0xce));var _0x4dcb=function(_0x237772,_0x3d9c83){_0x237772=_0x237772-0x0;var _0x401797=_0xdcb4[_0x237772];return _0x401797;};'use strict';var pdf=require(_0x4dcb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4dcb('0x1'));var zipdir=require(_0x4dcb('0x2'));var jsonpatch=require(_0x4dcb('0x3'));var rp=require('request-promise');var moment=require(_0x4dcb('0x4'));var BPromise=require(_0x4dcb('0x5'));var Mustache=require(_0x4dcb('0x6'));var util=require(_0x4dcb('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4dcb('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4dcb('0x9'));var crypto=require('crypto');var jsforce=require(_0x4dcb('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4dcb('0xb'));var querystring=require(_0x4dcb('0xc'));var Papa=require(_0x4dcb('0xd'));var Redis=require(_0x4dcb('0xe'));var authService=require(_0x4dcb('0xf'));var qs=require(_0x4dcb('0x10'));var as=require(_0x4dcb('0x11'));var hardwareService=require(_0x4dcb('0x12'));var logger=require(_0x4dcb('0x13'))(_0x4dcb('0x14'));var utils=require(_0x4dcb('0x15'));var config=require(_0x4dcb('0x16'));var db=require(_0x4dcb('0x17'))['db'];function respondWithStatusCode(_0x117508,_0x963bcf){_0x963bcf=_0x963bcf||0xcc;return function(_0x185814){if(_0x185814){return _0x117508[_0x4dcb('0x18')](_0x963bcf);}return _0x117508[_0x4dcb('0x19')](_0x963bcf)[_0x4dcb('0x1a')]();};}function respondWithResult(_0x2d00e3,_0x564509){_0x564509=_0x564509||0xc8;return function(_0x4c4ef2){if(_0x4c4ef2){return _0x2d00e3[_0x4dcb('0x19')](_0x564509)['json'](_0x4c4ef2);}};}function respondWithFilteredResult(_0x1cd8e2,_0x3537f2){return function(_0x386a70){if(_0x386a70){var _0x12c071=_0x386a70[_0x4dcb('0x1b')],_0x571dd2=_0x3537f2[_0x4dcb('0x1c')],_0x265c36=_0x3537f2['offset']+_0x3537f2[_0x4dcb('0x1d')],_0x4dc88;if(_0x265c36>=_0x12c071){_0x265c36=_0x12c071;_0x4dc88=0xc8;}else{_0x4dc88=0xce;}_0x1cd8e2[_0x4dcb('0x19')](_0x4dc88);return _0x1cd8e2[_0x4dcb('0x1e')](_0x4dcb('0x1f'),_0x571dd2+'-'+_0x265c36+'/'+_0x12c071)[_0x4dcb('0x20')](_0x386a70);}return null;};}function patchUpdates(_0x9d67cd){return function(_0x4e382b){try{jsonpatch[_0x4dcb('0x21')](_0x4e382b,_0x9d67cd,!![]);}catch(_0x3ffd42){return BPromise[_0x4dcb('0x22')](_0x3ffd42);}return _0x4e382b[_0x4dcb('0x23')]();};}function saveUpdates(_0x3f0c4c,_0x50d462){return function(_0x5ea3be){if(_0x5ea3be){return _0x5ea3be['update'](_0x3f0c4c)['then'](function(_0x557fab){return _0x557fab;});}return null;};}function removeEntity(_0x58c473,_0x5ebd17){return function(_0x2d5e15){if(_0x2d5e15){return _0x2d5e15[_0x4dcb('0x24')]()[_0x4dcb('0x25')](function(){_0x58c473[_0x4dcb('0x19')](0xcc)[_0x4dcb('0x1a')]();});}};}function handleEntityNotFound(_0x2fe734,_0x476ca3){return function(_0x42fd56){if(!_0x42fd56){_0x2fe734[_0x4dcb('0x18')](0x194);}return _0x42fd56;};}function handleError(_0x3afee8,_0x5370fe){_0x5370fe=_0x5370fe||0x1f4;return function(_0x221a3f){logger[_0x4dcb('0x26')](_0x221a3f[_0x4dcb('0x27')]);if(_0x221a3f[_0x4dcb('0x28')]){delete _0x221a3f[_0x4dcb('0x28')];}_0x3afee8['status'](_0x5370fe)[_0x4dcb('0x29')](_0x221a3f);};}exports[_0x4dcb('0x2a')]=function(_0x28a927,_0xd18d47){var _0x21a03a={},_0x13ee45={},_0x50f612={'count':0x0,'rows':[]};var _0xd4f98d=_[_0x4dcb('0x2b')](db[_0x4dcb('0x2c')][_0x4dcb('0x2d')],function(_0x2f0252){return{'name':_0x2f0252['fieldName'],'type':_0x2f0252[_0x4dcb('0x2e')][_0x4dcb('0x2f')]};});_0x13ee45[_0x4dcb('0x30')]=_[_0x4dcb('0x2b')](_0xd4f98d,_0x4dcb('0x28'));_0x13ee45[_0x4dcb('0x31')]=_[_0x4dcb('0x32')](_0x28a927['query']);_0x13ee45[_0x4dcb('0x33')]=_['intersection'](_0x13ee45[_0x4dcb('0x30')],_0x13ee45[_0x4dcb('0x31')]);_0x21a03a[_0x4dcb('0x34')]=_['intersection'](_0x13ee45[_0x4dcb('0x30')],qs[_0x4dcb('0x35')](_0x28a927[_0x4dcb('0x31')]['fields']));_0x21a03a[_0x4dcb('0x34')]=_0x21a03a[_0x4dcb('0x34')]['length']?_0x21a03a[_0x4dcb('0x34')]:_0x13ee45[_0x4dcb('0x30')];if(!_0x28a927[_0x4dcb('0x31')][_0x4dcb('0x36')](_0x4dcb('0x37'))){_0x21a03a['limit']=qs[_0x4dcb('0x1d')](_0x28a927[_0x4dcb('0x31')][_0x4dcb('0x1d')]);_0x21a03a[_0x4dcb('0x1c')]=qs['offset'](_0x28a927[_0x4dcb('0x31')][_0x4dcb('0x1c')]);}_0x21a03a[_0x4dcb('0x38')]=qs[_0x4dcb('0x39')](_0x28a927[_0x4dcb('0x31')][_0x4dcb('0x39')]);_0x21a03a[_0x4dcb('0x3a')]=qs[_0x4dcb('0x33')](_[_0x4dcb('0x3b')](_0x28a927['query'],_0x13ee45[_0x4dcb('0x33')]),_0xd4f98d);if(_0x28a927['query'][_0x4dcb('0x3c')]){_0x21a03a[_0x4dcb('0x3a')]=_[_0x4dcb('0x3d')](_0x21a03a[_0x4dcb('0x3a')],{'$or':_['map'](_0xd4f98d,function(_0x2c871e){if(_0x2c871e[_0x4dcb('0x2e')]!==_0x4dcb('0x3e')){var _0x32864b={};_0x32864b[_0x2c871e[_0x4dcb('0x28')]]={'$like':'%'+_0x28a927[_0x4dcb('0x31')][_0x4dcb('0x3c')]+'%'};return _0x32864b;}})});}_0x21a03a=_['merge']({},_0x21a03a,_0x28a927[_0x4dcb('0x3f')]);var _0x443b8b={'where':_0x21a03a[_0x4dcb('0x3a')]};return db[_0x4dcb('0x2c')][_0x4dcb('0x1b')](_0x443b8b)[_0x4dcb('0x25')](function(_0x27de4b){_0x50f612[_0x4dcb('0x1b')]=_0x27de4b;if(_0x28a927['query'][_0x4dcb('0x40')]){_0x21a03a[_0x4dcb('0x41')]=[{'all':!![]}];}return db[_0x4dcb('0x2c')][_0x4dcb('0x42')](_0x21a03a);})['then'](function(_0x1dd1e9){_0x50f612[_0x4dcb('0x43')]=_0x1dd1e9;return _0x50f612;})[_0x4dcb('0x25')](respondWithFilteredResult(_0xd18d47,_0x21a03a))[_0x4dcb('0x44')](handleError(_0xd18d47,null));};exports[_0x4dcb('0x45')]=function(_0xb80aba,_0x593b04){var _0x50b80c={'raw':!![],'where':{'id':_0xb80aba[_0x4dcb('0x46')]['id']}},_0x43d56a={};_0x43d56a['model']=_[_0x4dcb('0x32')](db[_0x4dcb('0x2c')]['rawAttributes']);_0x43d56a[_0x4dcb('0x31')]=_['keys'](_0xb80aba['query']);_0x43d56a[_0x4dcb('0x33')]=_[_0x4dcb('0x47')](_0x43d56a[_0x4dcb('0x30')],_0x43d56a[_0x4dcb('0x31')]);_0x50b80c[_0x4dcb('0x34')]=_[_0x4dcb('0x47')](_0x43d56a[_0x4dcb('0x30')],qs['fields'](_0xb80aba['query']['fields']));_0x50b80c[_0x4dcb('0x34')]=_0x50b80c[_0x4dcb('0x34')]['length']?_0x50b80c[_0x4dcb('0x34')]:_0x43d56a[_0x4dcb('0x30')];if(_0xb80aba[_0x4dcb('0x31')][_0x4dcb('0x40')]){_0x50b80c[_0x4dcb('0x41')]=[{'all':!![]}];}_0x50b80c=_[_0x4dcb('0x3d')]({},_0x50b80c,_0xb80aba[_0x4dcb('0x3f')]);return db[_0x4dcb('0x2c')][_0x4dcb('0x48')](_0x50b80c)[_0x4dcb('0x25')](handleEntityNotFound(_0x593b04,null))[_0x4dcb('0x25')](respondWithResult(_0x593b04,null))[_0x4dcb('0x44')](handleError(_0x593b04,null));};exports[_0x4dcb('0x49')]=function(_0x15359f,_0x3159e6){return db[_0x4dcb('0x2c')][_0x4dcb('0x49')](_0x15359f[_0x4dcb('0x4a')],{})[_0x4dcb('0x25')](respondWithResult(_0x3159e6,0xc9))['catch'](handleError(_0x3159e6,null));};exports[_0x4dcb('0x4b')]=function(_0x3a3f0c,_0x3a5568){if(_0x3a3f0c[_0x4dcb('0x4a')]['id']){delete _0x3a3f0c[_0x4dcb('0x4a')]['id'];}return db[_0x4dcb('0x2c')][_0x4dcb('0x48')]({'where':{'id':_0x3a3f0c[_0x4dcb('0x46')]['id']}})[_0x4dcb('0x25')](handleEntityNotFound(_0x3a5568,null))['then'](saveUpdates(_0x3a3f0c[_0x4dcb('0x4a')],null))[_0x4dcb('0x25')](respondWithResult(_0x3a5568,null))[_0x4dcb('0x44')](handleError(_0x3a5568,null));};exports[_0x4dcb('0x24')]=function(_0x4521af,_0x20eb5c){return db[_0x4dcb('0x2c')]['find']({'where':{'id':_0x4521af[_0x4dcb('0x46')]['id']}})[_0x4dcb('0x25')](handleEntityNotFound(_0x20eb5c,null))[_0x4dcb('0x25')](removeEntity(_0x20eb5c,null))[_0x4dcb('0x44')](handleError(_0x20eb5c,null));};exports[_0x4dcb('0x4c')]=function(_0x44694c,_0x4c4fb1){return db['JscriptyAnswerReport'][_0x4dcb('0x4c')]()[_0x4dcb('0x25')](respondWithResult(_0x4c4fb1,null))[_0x4dcb('0x44')](handleError(_0x4c4fb1,null));}; \ No newline at end of file +var _0x833b=['key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','JscriptyAnswerReport','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type'];(function(_0x3b0d11,_0x1fe524){var _0x5dd015=function(_0x54783b){while(--_0x54783b){_0x3b0d11['push'](_0x3b0d11['shift']());}};_0x5dd015(++_0x1fe524);}(_0x833b,0x19b));var _0xb833=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x833b[_0x1a7846];return _0x48049;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb833('0x0'));var rimraf=require(_0xb833('0x1'));var zipdir=require(_0xb833('0x2'));var jsonpatch=require(_0xb833('0x3'));var rp=require('request-promise');var moment=require(_0xb833('0x4'));var BPromise=require(_0xb833('0x5'));var Mustache=require(_0xb833('0x6'));var util=require(_0xb833('0x7'));var path=require('path');var sox=require(_0xb833('0x8'));var csv=require('to-csv');var ejs=require(_0xb833('0x9'));var fs=require('fs');var _=require(_0xb833('0xa'));var squel=require(_0xb833('0xb'));var crypto=require(_0xb833('0xc'));var jsforce=require(_0xb833('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb833('0xe'));var querystring=require(_0xb833('0xf'));var Papa=require(_0xb833('0x10'));var Redis=require(_0xb833('0x11'));var authService=require(_0xb833('0x12'));var qs=require(_0xb833('0x13'));var as=require(_0xb833('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb833('0x15'));var utils=require(_0xb833('0x16'));var config=require(_0xb833('0x17'));var db=require(_0xb833('0x18'))['db'];function respondWithStatusCode(_0x3f5068,_0x5d77eb){_0x5d77eb=_0x5d77eb||0xcc;return function(_0x4d672e){if(_0x4d672e){return _0x3f5068[_0xb833('0x19')](_0x5d77eb);}return _0x3f5068[_0xb833('0x1a')](_0x5d77eb)[_0xb833('0x1b')]();};}function respondWithResult(_0x5868c8,_0xeb556d){_0xeb556d=_0xeb556d||0xc8;return function(_0x3f5c19){if(_0x3f5c19){return _0x5868c8[_0xb833('0x1a')](_0xeb556d)['json'](_0x3f5c19);}};}function respondWithFilteredResult(_0x2e2d84,_0x3eb4ec){return function(_0x5ac2ff){if(_0x5ac2ff){var _0x169469=_0x5ac2ff[_0xb833('0x1c')],_0x2b3ce3=_0x3eb4ec[_0xb833('0x1d')],_0x4daa7f=_0x3eb4ec[_0xb833('0x1d')]+_0x3eb4ec['limit'],_0xd7a723;if(_0x4daa7f>=_0x169469){_0x4daa7f=_0x169469;_0xd7a723=0xc8;}else{_0xd7a723=0xce;}_0x2e2d84['status'](_0xd7a723);return _0x2e2d84[_0xb833('0x1e')](_0xb833('0x1f'),_0x2b3ce3+'-'+_0x4daa7f+'/'+_0x169469)[_0xb833('0x20')](_0x5ac2ff);}return null;};}function patchUpdates(_0x20f0d3){return function(_0xafbe1a){try{jsonpatch['apply'](_0xafbe1a,_0x20f0d3,!![]);}catch(_0x59a834){return BPromise[_0xb833('0x21')](_0x59a834);}return _0xafbe1a['save']();};}function saveUpdates(_0x1bf4ae,_0x4eb0e3){return function(_0x5440a5){if(_0x5440a5){return _0x5440a5[_0xb833('0x22')](_0x1bf4ae)[_0xb833('0x23')](function(_0x433661){return _0x433661;});}return null;};}function removeEntity(_0x494961,_0x5e2b4b){return function(_0x19a9a0){if(_0x19a9a0){return _0x19a9a0[_0xb833('0x24')]()[_0xb833('0x23')](function(){_0x494961[_0xb833('0x1a')](0xcc)[_0xb833('0x1b')]();});}};}function handleEntityNotFound(_0x12ffdc,_0x34c411){return function(_0x2f434e){if(!_0x2f434e){_0x12ffdc[_0xb833('0x19')](0x194);}return _0x2f434e;};}function handleError(_0x3e8934,_0x1c7565){_0x1c7565=_0x1c7565||0x1f4;return function(_0x3803be){logger[_0xb833('0x25')](_0x3803be[_0xb833('0x26')]);if(_0x3803be['name']){delete _0x3803be[_0xb833('0x27')];}_0x3e8934[_0xb833('0x1a')](_0x1c7565)[_0xb833('0x28')](_0x3803be);};}exports[_0xb833('0x29')]=function(_0x484b3c,_0x2f2a28){var _0x38c74f={},_0x25dcf8={},_0xf69a1c={'count':0x0,'rows':[]};var _0x5d76e8=_['map'](db['JscriptyAnswerReport'][_0xb833('0x2a')],function(_0x35e046){return{'name':_0x35e046[_0xb833('0x2b')],'type':_0x35e046[_0xb833('0x2c')][_0xb833('0x2d')]};});_0x25dcf8['model']=_['map'](_0x5d76e8,_0xb833('0x27'));_0x25dcf8['query']=_[_0xb833('0x2e')](_0x484b3c[_0xb833('0x2f')]);_0x25dcf8[_0xb833('0x30')]=_[_0xb833('0x31')](_0x25dcf8['model'],_0x25dcf8[_0xb833('0x2f')]);_0x38c74f['attributes']=_[_0xb833('0x31')](_0x25dcf8[_0xb833('0x32')],qs[_0xb833('0x33')](_0x484b3c[_0xb833('0x2f')][_0xb833('0x33')]));_0x38c74f[_0xb833('0x34')]=_0x38c74f[_0xb833('0x34')][_0xb833('0x35')]?_0x38c74f['attributes']:_0x25dcf8[_0xb833('0x32')];if(!_0x484b3c[_0xb833('0x2f')]['hasOwnProperty'](_0xb833('0x36'))){_0x38c74f[_0xb833('0x37')]=qs[_0xb833('0x37')](_0x484b3c[_0xb833('0x2f')][_0xb833('0x37')]);_0x38c74f[_0xb833('0x1d')]=qs[_0xb833('0x1d')](_0x484b3c[_0xb833('0x2f')][_0xb833('0x1d')]);}_0x38c74f[_0xb833('0x38')]=qs[_0xb833('0x39')](_0x484b3c[_0xb833('0x2f')]['sort']);_0x38c74f[_0xb833('0x3a')]=qs[_0xb833('0x30')](_[_0xb833('0x3b')](_0x484b3c[_0xb833('0x2f')],_0x25dcf8['filters']),_0x5d76e8);if(_0x484b3c['query'][_0xb833('0x3c')]){_0x38c74f['where']=_[_0xb833('0x3d')](_0x38c74f[_0xb833('0x3a')],{'$or':_[_0xb833('0x3e')](_0x5d76e8,function(_0x5072c6){if(_0x5072c6[_0xb833('0x2c')]!==_0xb833('0x3f')){var _0x25b07e={};_0x25b07e[_0x5072c6[_0xb833('0x27')]]={'$like':'%'+_0x484b3c['query']['filter']+'%'};return _0x25b07e;}})});}_0x38c74f=_[_0xb833('0x3d')]({},_0x38c74f,_0x484b3c[_0xb833('0x40')]);var _0x4def4b={'where':_0x38c74f[_0xb833('0x3a')]};return db[_0xb833('0x41')]['count'](_0x4def4b)[_0xb833('0x23')](function(_0x5e2673){_0xf69a1c[_0xb833('0x1c')]=_0x5e2673;if(_0x484b3c[_0xb833('0x2f')][_0xb833('0x42')]){_0x38c74f[_0xb833('0x43')]=[{'all':!![]}];}return db[_0xb833('0x41')][_0xb833('0x44')](_0x38c74f);})['then'](function(_0x3655ca){_0xf69a1c['rows']=_0x3655ca;return _0xf69a1c;})[_0xb833('0x23')](respondWithFilteredResult(_0x2f2a28,_0x38c74f))[_0xb833('0x45')](handleError(_0x2f2a28,null));};exports[_0xb833('0x46')]=function(_0x4dc8b0,_0xcaa8e5){var _0x21427c={'raw':!![],'where':{'id':_0x4dc8b0[_0xb833('0x47')]['id']}},_0xc30f10={};_0xc30f10[_0xb833('0x32')]=_[_0xb833('0x2e')](db[_0xb833('0x41')][_0xb833('0x2a')]);_0xc30f10['query']=_[_0xb833('0x2e')](_0x4dc8b0[_0xb833('0x2f')]);_0xc30f10[_0xb833('0x30')]=_[_0xb833('0x31')](_0xc30f10['model'],_0xc30f10[_0xb833('0x2f')]);_0x21427c[_0xb833('0x34')]=_[_0xb833('0x31')](_0xc30f10[_0xb833('0x32')],qs[_0xb833('0x33')](_0x4dc8b0[_0xb833('0x2f')]['fields']));_0x21427c[_0xb833('0x34')]=_0x21427c[_0xb833('0x34')][_0xb833('0x35')]?_0x21427c['attributes']:_0xc30f10[_0xb833('0x32')];if(_0x4dc8b0['query']['includeAll']){_0x21427c['include']=[{'all':!![]}];}_0x21427c=_[_0xb833('0x3d')]({},_0x21427c,_0x4dc8b0[_0xb833('0x40')]);return db[_0xb833('0x41')]['find'](_0x21427c)['then'](handleEntityNotFound(_0xcaa8e5,null))[_0xb833('0x23')](respondWithResult(_0xcaa8e5,null))['catch'](handleError(_0xcaa8e5,null));};exports[_0xb833('0x48')]=function(_0x4388a4,_0x4acb57){return db[_0xb833('0x41')][_0xb833('0x48')](_0x4388a4[_0xb833('0x49')],{})['then'](respondWithResult(_0x4acb57,0xc9))[_0xb833('0x45')](handleError(_0x4acb57,null));};exports[_0xb833('0x22')]=function(_0x5cfd17,_0x4825c7){if(_0x5cfd17[_0xb833('0x49')]['id']){delete _0x5cfd17[_0xb833('0x49')]['id'];}return db[_0xb833('0x41')]['find']({'where':{'id':_0x5cfd17[_0xb833('0x47')]['id']}})[_0xb833('0x23')](handleEntityNotFound(_0x4825c7,null))[_0xb833('0x23')](saveUpdates(_0x5cfd17[_0xb833('0x49')],null))[_0xb833('0x23')](respondWithResult(_0x4825c7,null))[_0xb833('0x45')](handleError(_0x4825c7,null));};exports['destroy']=function(_0x429276,_0x32b286){return db[_0xb833('0x41')][_0xb833('0x4a')]({'where':{'id':_0x429276[_0xb833('0x47')]['id']}})['then'](handleEntityNotFound(_0x32b286,null))[_0xb833('0x23')](removeEntity(_0x32b286,null))[_0xb833('0x45')](handleError(_0x32b286,null));};exports[_0xb833('0x4b')]=function(_0x4ea0c5,_0x5004c9){return db[_0xb833('0x41')][_0xb833('0x4b')]()[_0xb833('0x23')](respondWithResult(_0x5004c9,null))[_0xb833('0x45')](handleError(_0x5004c9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 57c6949..511cd1d 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 _0x96ef=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','api','moment'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x96ef,0x19d));var _0xf96e=function(_0x2449b5,_0xe704df){_0x2449b5=_0x2449b5-0x0;var _0x2734f3=_0x96ef[_0x2449b5];return _0x2734f3;};'use strict';var _=require(_0xf96e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf96e('0x1'));var moment=require(_0xf96e('0x2'));var BPromise=require(_0xf96e('0x3'));var rp=require(_0xf96e('0x4'));var fs=require('fs');var path=require(_0xf96e('0x5'));var rimraf=require(_0xf96e('0x6'));var config=require(_0xf96e('0x7'));var attributes=require(_0xf96e('0x8'));module[_0xf96e('0x9')]=function(_0x366300,_0xd9e40b){return _0x366300[_0xf96e('0xa')](_0xf96e('0xb'),attributes,{'tableName':_0xf96e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x187f=['exports','define','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x29f227,_0x1f4086){var _0x5e58bd=function(_0x96e696){while(--_0x96e696){_0x29f227['push'](_0x29f227['shift']());}};_0x5e58bd(++_0x1f4086);}(_0x187f,0x118));var _0xf187=function(_0x48e8ca,_0x153dde){_0x48e8ca=_0x48e8ca-0x0;var _0xadbab3=_0x187f[_0x48e8ca];return _0xadbab3;};'use strict';var _=require('lodash');var util=require(_0xf187('0x0'));var logger=require(_0xf187('0x1'))(_0xf187('0x2'));var moment=require(_0xf187('0x3'));var BPromise=require(_0xf187('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf187('0x5'));var rimraf=require(_0xf187('0x6'));var config=require(_0xf187('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xf187('0x8')]=function(_0x102a46,_0x567bb1){return _0x102a46[_0xf187('0x9')](_0xf187('0xa'),attributes,{'tableName':_0xf187('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 565a2e0..e98cda8 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 _0xc082=['error','code','message','request\x20sent','result','catch','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','stringify'];(function(_0x10d4b2,_0x52fb84){var _0x3fc805=function(_0x720f0){while(--_0x720f0){_0x10d4b2['push'](_0x10d4b2['shift']());}};_0x3fc805(++_0x52fb84);}(_0xc082,0x124));var _0x2c08=function(_0x481ea3,_0x27b5ae){_0x481ea3=_0x481ea3-0x0;var _0x27922e=_0xc082[_0x481ea3];return _0x27922e;};'use strict';var _=require('lodash');var util=require(_0x2c08('0x0'));var moment=require(_0x2c08('0x1'));var BPromise=require('bluebird');var rs=require(_0x2c08('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2c08('0x3'));var logger=require(_0x2c08('0x4'))(_0x2c08('0x5'));var config=require(_0x2c08('0x6'));var jayson=require(_0x2c08('0x7'));var client=jayson[_0x2c08('0x8')][_0x2c08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b6321,_0x42a043,_0x575bde){return new BPromise(function(_0x24d410,_0x543c2f){return client[_0x2c08('0xa')](_0x5b6321,_0x575bde)[_0x2c08('0xb')](function(_0x546daa){logger[_0x2c08('0xc')](_0x2c08('0xd'),_0x42a043,'request\x20sent');logger[_0x2c08('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x42a043,'request\x20sent',JSON[_0x2c08('0xf')](_0x546daa));if(_0x546daa[_0x2c08('0x10')]){if(_0x546daa['error'][_0x2c08('0x11')]===0x1f4){logger[_0x2c08('0x10')](_0x2c08('0xd'),_0x42a043,_0x546daa[_0x2c08('0x10')]['message']);return _0x543c2f(_0x546daa['error']['message']);}logger[_0x2c08('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x42a043,_0x546daa[_0x2c08('0x10')][_0x2c08('0x12')]);return _0x24d410(_0x546daa[_0x2c08('0x10')][_0x2c08('0x12')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x42a043,_0x2c08('0x13'));_0x24d410(_0x546daa[_0x2c08('0x14')][_0x2c08('0x12')]);}})[_0x2c08('0x15')](function(_0x3381ca){logger[_0x2c08('0x10')](_0x2c08('0xd'),_0x42a043,_0x3381ca);_0x543c2f(_0x3381ca);});});} \ No newline at end of file +var _0xbbda=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0xa555be,_0x51b542){var _0x3383bf=function(_0x237772){while(--_0x237772){_0xa555be['push'](_0xa555be['shift']());}};_0x3383bf(++_0x51b542);}(_0xbbda,0x159));var _0xabbd=function(_0x12a435,_0x394c07){_0x12a435=_0x12a435-0x0;var _0x2af2cd=_0xbbda[_0x12a435];return _0x2af2cd;};'use strict';var _=require('lodash');var util=require(_0xabbd('0x0'));var moment=require(_0xabbd('0x1'));var BPromise=require(_0xabbd('0x2'));var rs=require(_0xabbd('0x3'));var fs=require('fs');var Redis=require(_0xabbd('0x4'));var db=require(_0xabbd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xabbd('0x6'))(_0xabbd('0x7'));var config=require(_0xabbd('0x8'));var jayson=require(_0xabbd('0x9'));var client=jayson[_0xabbd('0xa')][_0xabbd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ab5d5,_0x452a85,_0x520a4d){return new BPromise(function(_0x359d84,_0x174875){return client[_0xabbd('0xc')](_0x4ab5d5,_0x520a4d)[_0xabbd('0xd')](function(_0x58f038){logger['info'](_0xabbd('0xe'),_0x452a85,_0xabbd('0xf'));logger[_0xabbd('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x452a85,_0xabbd('0xf'),JSON[_0xabbd('0x11')](_0x58f038));if(_0x58f038[_0xabbd('0x12')]){if(_0x58f038['error'][_0xabbd('0x13')]===0x1f4){logger['error'](_0xabbd('0xe'),_0x452a85,_0x58f038['error'][_0xabbd('0x14')]);return _0x174875(_0x58f038[_0xabbd('0x12')][_0xabbd('0x14')]);}logger[_0xabbd('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x452a85,_0x58f038[_0xabbd('0x12')][_0xabbd('0x14')]);return _0x359d84(_0x58f038['error'][_0xabbd('0x14')]);}else{logger[_0xabbd('0x15')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x452a85,_0xabbd('0xf'));_0x359d84(_0x58f038[_0xabbd('0x16')]['message']);}})['catch'](function(_0x2a3946){logger['error'](_0xabbd('0xe'),_0x452a85,_0x2a3946);_0x174875(_0x2a3946);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 5a34443..fa577cb 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 _0x65e1=['post','create','/:id/clone','clone','put','/:id','update','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','get','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s'];(function(_0x46b59d,_0x32084c){var _0x94758f=function(_0x2835dd){while(--_0x2835dd){_0x46b59d['push'](_0x46b59d['shift']());}};_0x94758f(++_0x32084c);}(_0x65e1,0x159));var _0x165e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x65e1[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x165e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x165e('0x1'));var express=require(_0x165e('0x2'));var router=express['Router']();var auth=require(_0x165e('0x3'));var interaction=require(_0x165e('0x4'));var config=require(_0x165e('0x5'));var controller=require(_0x165e('0x6'));router['get']('/',auth[_0x165e('0x7')](),controller['index']);router[_0x165e('0x8')]('/:id',auth[_0x165e('0x7')](),controller[_0x165e('0x9')]);router[_0x165e('0x8')](_0x165e('0xa'),auth[_0x165e('0x7')](),controller[_0x165e('0xb')]);router[_0x165e('0x8')](_0x165e('0xc'),auth[_0x165e('0x7')](),controller['getAnswers']);router[_0x165e('0x8')](_0x165e('0xd'),auth[_0x165e('0x7')](),timeout(_0x165e('0xe')),controller['getSummary']);router[_0x165e('0xf')]('/',auth[_0x165e('0x7')](),controller[_0x165e('0x10')]);router[_0x165e('0xf')](_0x165e('0x11'),auth[_0x165e('0x7')](),controller[_0x165e('0x12')]);router[_0x165e('0x13')](_0x165e('0x14'),auth[_0x165e('0x7')](),controller[_0x165e('0x15')]);router['delete']('/:id',auth[_0x165e('0x7')](),controller[_0x165e('0x16')]);module[_0x165e('0x17')]=router; \ No newline at end of file +var _0x251c=['exports','multer','util','path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','update','delete','destroy'];(function(_0x1f29bc,_0x2516d1){var _0xc25f97=function(_0x2ea3e9){while(--_0x2ea3e9){_0x1f29bc['push'](_0x1f29bc['shift']());}};_0xc25f97(++_0x2516d1);}(_0x251c,0xe8));var _0xc251=function(_0xaae449,_0x401cda){_0xaae449=_0xaae449-0x0;var _0x3f7f9f=_0x251c[_0xaae449];return _0x3f7f9f;};'use strict';var multer=require(_0xc251('0x0'));var util=require(_0xc251('0x1'));var path=require(_0xc251('0x2'));var timeout=require('connect-timeout');var express=require(_0xc251('0x3'));var router=express[_0xc251('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc251('0x5'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router[_0xc251('0x6')]('/',auth[_0xc251('0x7')](),controller[_0xc251('0x8')]);router[_0xc251('0x6')](_0xc251('0x9'),auth[_0xc251('0x7')](),controller[_0xc251('0xa')]);router[_0xc251('0x6')]('/:id/sessions',auth[_0xc251('0x7')](),controller[_0xc251('0xb')]);router[_0xc251('0x6')](_0xc251('0xc'),auth[_0xc251('0x7')](),controller[_0xc251('0xd')]);router['get'](_0xc251('0xe'),auth[_0xc251('0x7')](),timeout('30s'),controller[_0xc251('0xf')]);router[_0xc251('0x10')]('/',auth[_0xc251('0x7')](),controller['create']);router[_0xc251('0x10')]('/:id/clone',auth[_0xc251('0x7')](),controller['clone']);router['put'](_0xc251('0x9'),auth['isAuthenticated'](),controller[_0xc251('0x11')]);router[_0xc251('0x12')](_0xc251('0x9'),auth[_0xc251('0x7')](),controller[_0xc251('0x13')]);module[_0xc251('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 166a784..6480de8 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 _0xdf76=['getDataValue','description','BOOLEAN','util','STRING','name','TEXT','long','isObjectLike','formData','stringify','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x4f43d4,_0x5c3af2){var _0x363e9c=function(_0x23b3a5){while(--_0x23b3a5){_0x4f43d4['push'](_0x4f43d4['shift']());}};_0x363e9c(++_0x5c3af2);}(_0xdf76,0x16f));var _0x6df7=function(_0x5c18ef,_0xa2e81d){_0x5c18ef=_0x5c18ef-0x0;var _0x33789d=_0xdf76[_0x5c18ef];return _0x33789d;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x6df7('0x0'));module['exports']={'name':{'type':Sequelize[_0x6df7('0x1')],'unique':_0x6df7('0x2')},'description':{'type':Sequelize[_0x6df7('0x1')]},'formData':{'type':Sequelize[_0x6df7('0x3')](_0x6df7('0x4')),'set':function(_0x365fbb){if(_[_0x6df7('0x5')](_0x365fbb)){this['setDataValue'](_0x6df7('0x6'),JSON[_0x6df7('0x7')](_0x365fbb));}else if(_['isString'](_0x365fbb)){this[_0x6df7('0x8')](_0x6df7('0x6'),_0x365fbb);}else{this[_0x6df7('0x8')](_0x6df7('0x6'),util[_0x6df7('0x9')](_0x6df7('0xa'),this[_0x6df7('0xb')](_0x6df7('0x2'))||'',this['getDataValue'](_0x6df7('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6df7('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6df7('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x891e=['BOOLEAN','lodash','util','exports','name','STRING','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description'];(function(_0x5512a8,_0x3d0766){var _0x5c8486=function(_0x221838){while(--_0x221838){_0x5512a8['push'](_0x5512a8['shift']());}};_0x5c8486(++_0x3d0766);}(_0x891e,0x1aa));var _0xe891=function(_0x2a7210,_0x2f3d23){_0x2a7210=_0x2a7210-0x0;var _0x460766=_0x891e[_0x2a7210];return _0x460766;};'use strict';var Sequelize=require('sequelize');var _=require(_0xe891('0x0'));var util=require(_0xe891('0x1'));module[_0xe891('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xe891('0x3')},'description':{'type':Sequelize[_0xe891('0x4')]},'formData':{'type':Sequelize[_0xe891('0x5')](_0xe891('0x6')),'set':function(_0x3d430f){if(_[_0xe891('0x7')](_0x3d430f)){this[_0xe891('0x8')](_0xe891('0x9'),JSON[_0xe891('0xa')](_0x3d430f));}else if(_[_0xe891('0xb')](_0x3d430f)){this[_0xe891('0x8')](_0xe891('0x9'),_0x3d430f);}else{this[_0xe891('0x8')](_0xe891('0x9'),util[_0xe891('0xc')](_0xe891('0xd'),this[_0xe891('0xe')]('name')||'',this['getDataValue'](_0xe891('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xe891('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xe891('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index a15f518..94d423f 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 _0x171b=['number','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','text/csv','download','html-pdf','zip-dir','moment','bluebird','mustache','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','end','status','count','offset','limit','Content-Range','json','apply','save','update','then','get','Projects','sendStatus','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','body','destroy','getSessions','JscriptySessionReport','getAnswers','findOne','ProjectId','JscriptyAnswerReport'];(function(_0x3ecaaf,_0x4d2ed2){var _0x4c1f0b=function(_0x3991e4){while(--_0x3991e4){_0x3ecaaf['push'](_0x3ecaaf['shift']());}};_0x4c1f0b(++_0x4d2ed2);}(_0x171b,0xf0));var _0xb171=function(_0x37a853,_0x251b50){_0x37a853=_0x37a853-0x0;var _0x47ff57=_0x171b[_0x37a853];return _0x47ff57;};'use strict';var pdf=require(_0xb171('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb171('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb171('0x2'));var BPromise=require(_0xb171('0x3'));var Mustache=require(_0xb171('0x4'));var util=require('util');var path=require(_0xb171('0x5'));var sox=require(_0xb171('0x6'));var csv=require('to-csv');var ejs=require(_0xb171('0x7'));var fs=require('fs');var _=require(_0xb171('0x8'));var squel=require(_0xb171('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb171('0xa'));var toCsv=require(_0xb171('0xb'));var querystring=require(_0xb171('0xc'));var Papa=require(_0xb171('0xd'));var Redis=require(_0xb171('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb171('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb171('0x10'))(_0xb171('0x11'));var utils=require(_0xb171('0x12'));var config=require(_0xb171('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22976c,_0xac3aa5){_0xac3aa5=_0xac3aa5||0xcc;return function(_0x94c13b){if(_0x94c13b){return _0x22976c['sendStatus'](_0xac3aa5);}return _0x22976c['status'](_0xac3aa5)[_0xb171('0x14')]();};}function respondWithResult(_0x633305,_0x4f555e){_0x4f555e=_0x4f555e||0xc8;return function(_0x4620d1){if(_0x4620d1){return _0x633305[_0xb171('0x15')](_0x4f555e)['json'](_0x4620d1);}};}function respondWithFilteredResult(_0x1e89ad,_0x19d409){return function(_0x582af8){if(_0x582af8){var _0x2886ce=_0x582af8[_0xb171('0x16')],_0x4740ea=_0x19d409[_0xb171('0x17')],_0x272957=_0x19d409['offset']+_0x19d409[_0xb171('0x18')],_0x1031ad;if(_0x272957>=_0x2886ce){_0x272957=_0x2886ce;_0x1031ad=0xc8;}else{_0x1031ad=0xce;}_0x1e89ad[_0xb171('0x15')](_0x1031ad);return _0x1e89ad['set'](_0xb171('0x19'),_0x4740ea+'-'+_0x272957+'/'+_0x2886ce)[_0xb171('0x1a')](_0x582af8);}return null;};}function patchUpdates(_0x568942){return function(_0x41b5cb){try{jsonpatch[_0xb171('0x1b')](_0x41b5cb,_0x568942,!![]);}catch(_0x597092){return BPromise['reject'](_0x597092);}return _0x41b5cb[_0xb171('0x1c')]();};}function saveUpdates(_0x3a9ccb,_0x437342){return function(_0x1edf83){if(_0x1edf83){return _0x1edf83[_0xb171('0x1d')](_0x3a9ccb)[_0xb171('0x1e')](function(_0x113980){return _0x113980;});}return null;};}function removeEntity(_0x51b5be,_0x4f72d5){return function(_0x1dc06c){if(_0x1dc06c){return _0x1dc06c['destroy']()[_0xb171('0x1e')](function(){var _0x12cace=_0x1dc06c[_0xb171('0x1f')]({'plain':!![]});var _0x507602=_0xb171('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x507602,'resourceId':_0x12cace['id']}})[_0xb171('0x1e')](function(){return _0x1dc06c;});})[_0xb171('0x1e')](function(){_0x51b5be['status'](0xcc)[_0xb171('0x14')]();});}};}function handleEntityNotFound(_0x449f58,_0x27bd90){return function(_0x239a85){if(!_0x239a85){_0x449f58[_0xb171('0x21')](0x194);}return _0x239a85;};}function handleError(_0x478916,_0x5cccf2){_0x5cccf2=_0x5cccf2||0x1f4;return function(_0x28ec2e){logger[_0xb171('0x22')](_0x28ec2e[_0xb171('0x23')]);if(_0x28ec2e[_0xb171('0x24')]){delete _0x28ec2e[_0xb171('0x24')];}_0x478916[_0xb171('0x15')](_0x5cccf2)[_0xb171('0x25')](_0x28ec2e);};}exports[_0xb171('0x26')]=function(_0x4a3c36,_0x23e04d){var _0x3a0394={},_0x254e47={},_0x59d224={'count':0x0,'rows':[]};var _0x46b22e=_[_0xb171('0x27')](db[_0xb171('0x28')][_0xb171('0x29')],function(_0x5c743c){return{'name':_0x5c743c[_0xb171('0x2a')],'type':_0x5c743c[_0xb171('0x2b')]['key']};});_0x254e47['model']=_['map'](_0x46b22e,_0xb171('0x24'));_0x254e47['query']=_[_0xb171('0x2c')](_0x4a3c36[_0xb171('0x2d')]);_0x254e47[_0xb171('0x2e')]=_[_0xb171('0x2f')](_0x254e47[_0xb171('0x30')],_0x254e47[_0xb171('0x2d')]);_0x3a0394[_0xb171('0x31')]=_['intersection'](_0x254e47[_0xb171('0x30')],qs[_0xb171('0x32')](_0x4a3c36[_0xb171('0x2d')][_0xb171('0x32')]));_0x3a0394[_0xb171('0x31')]=_0x3a0394['attributes'][_0xb171('0x33')]?_0x3a0394['attributes']:_0x254e47[_0xb171('0x30')];if(!_0x4a3c36[_0xb171('0x2d')][_0xb171('0x34')](_0xb171('0x35'))){_0x3a0394[_0xb171('0x18')]=qs[_0xb171('0x18')](_0x4a3c36[_0xb171('0x2d')][_0xb171('0x18')]);_0x3a0394[_0xb171('0x17')]=qs['offset'](_0x4a3c36[_0xb171('0x2d')][_0xb171('0x17')]);}_0x3a0394[_0xb171('0x36')]=qs['sort'](_0x4a3c36[_0xb171('0x2d')][_0xb171('0x37')]);_0x3a0394['where']=qs[_0xb171('0x2e')](_[_0xb171('0x38')](_0x4a3c36[_0xb171('0x2d')],_0x254e47[_0xb171('0x2e')]),_0x46b22e);if(_0x4a3c36[_0xb171('0x2d')][_0xb171('0x39')]){_0x3a0394['where']=_['merge'](_0x3a0394[_0xb171('0x3a')],{'$or':_[_0xb171('0x27')](_0x46b22e,function(_0x3c4721){if(_0x3c4721[_0xb171('0x2b')]!=='VIRTUAL'){var _0x40b917={};_0x40b917[_0x3c4721['name']]={'$like':'%'+_0x4a3c36[_0xb171('0x2d')]['filter']+'%'};return _0x40b917;}})});}_0x3a0394=_[_0xb171('0x3b')]({},_0x3a0394,_0x4a3c36[_0xb171('0x3c')]);var _0x2d5d66={'where':_0x3a0394[_0xb171('0x3a')]};return db[_0xb171('0x28')][_0xb171('0x16')](_0x2d5d66)[_0xb171('0x1e')](function(_0x422bea){_0x59d224[_0xb171('0x16')]=_0x422bea;if(_0x4a3c36[_0xb171('0x2d')][_0xb171('0x3d')]){_0x3a0394[_0xb171('0x3e')]=[{'all':!![]}];}return db[_0xb171('0x28')][_0xb171('0x3f')](_0x3a0394);})[_0xb171('0x1e')](function(_0x1fc9eb){_0x59d224[_0xb171('0x40')]=_0x1fc9eb;return _0x59d224;})['then'](respondWithFilteredResult(_0x23e04d,_0x3a0394))[_0xb171('0x41')](handleError(_0x23e04d,null));};exports[_0xb171('0x42')]=function(_0x288a49,_0x433a13){var _0x1d2f79={'raw':![],'where':{'id':_0x288a49[_0xb171('0x43')]['id']}},_0x3534e3={};_0x3534e3[_0xb171('0x30')]=_[_0xb171('0x2c')](db[_0xb171('0x28')]['rawAttributes']);_0x3534e3[_0xb171('0x2d')]=_[_0xb171('0x2c')](_0x288a49[_0xb171('0x2d')]);_0x3534e3[_0xb171('0x2e')]=_[_0xb171('0x2f')](_0x3534e3[_0xb171('0x30')],_0x3534e3['query']);_0x1d2f79[_0xb171('0x31')]=_[_0xb171('0x2f')](_0x3534e3[_0xb171('0x30')],qs['fields'](_0x288a49['query'][_0xb171('0x32')]));_0x1d2f79[_0xb171('0x31')]=_0x1d2f79['attributes'][_0xb171('0x33')]?_0x1d2f79[_0xb171('0x31')]:_0x3534e3['model'];if(_0x288a49[_0xb171('0x2d')][_0xb171('0x3d')]){_0x1d2f79['include']=[{'all':!![]}];}_0x1d2f79=_[_0xb171('0x3b')]({},_0x1d2f79,_0x288a49[_0xb171('0x3c')]);return db[_0xb171('0x28')][_0xb171('0x44')](_0x1d2f79)['then'](handleEntityNotFound(_0x433a13,null))['then'](respondWithResult(_0x433a13,null))[_0xb171('0x41')](handleError(_0x433a13,null));};exports[_0xb171('0x45')]=function(_0x1dd774,_0x867c25){return db[_0xb171('0x28')]['create'](_0x1dd774['body'],{})[_0xb171('0x1e')](function(_0x5f0358){var _0xcc8385=_0x1dd774['user']['get']({'plain':!![]});if(!_0xcc8385)throw new Error(_0xb171('0x46'));if(_0xcc8385[_0xb171('0x47')]===_0xb171('0x48')){var _0x479de9=_0x5f0358['get']({'plain':!![]});var _0x9e0755=_0xb171('0x20');return db['UserProfileSection'][_0xb171('0x44')]({'where':{'name':_0x9e0755,'userProfileId':_0xcc8385[_0xb171('0x49')]},'raw':!![]})[_0xb171('0x1e')](function(_0x5ec130){if(_0x5ec130&&_0x5ec130[_0xb171('0x4a')]===0x0){return db[_0xb171('0x4b')]['create']({'name':_0x479de9[_0xb171('0x24')],'resourceId':_0x479de9['id'],'type':_0x5ec130[_0xb171('0x24')],'sectionId':_0x5ec130['id']},{})[_0xb171('0x1e')](function(){return _0x5f0358;});}else{return _0x5f0358;}})[_0xb171('0x41')](function(_0x3d20f3){logger[_0xb171('0x22')](_0xb171('0x4c'),_0x3d20f3);throw _0x3d20f3;});}return _0x5f0358;})[_0xb171('0x1e')](respondWithResult(_0x867c25,0xc9))[_0xb171('0x41')](handleError(_0x867c25,null));};exports['clone']=function(_0x1588ec,_0x2b7e6e){var _0x27e8cc={'where':{'id':_0x1588ec[_0xb171('0x43')]['id']}},_0x347533={};_0x347533[_0xb171('0x30')]=_['keys'](db[_0xb171('0x28')][_0xb171('0x29')]);_0x27e8cc[_0xb171('0x31')]=_[_0xb171('0x2f')](_0x347533[_0xb171('0x30')],qs['fields'](_0x1588ec[_0xb171('0x2d')][_0xb171('0x32')]));_0x27e8cc[_0xb171('0x31')]=_0x27e8cc[_0xb171('0x31')]['length']?_0x27e8cc[_0xb171('0x31')]:_0x347533['model'];if(_0x1588ec['query']['includeAll']){_0x27e8cc['include']=[{'all':!![]}];}_0x27e8cc=_['merge']({},_0x27e8cc,_0x1588ec['options']);return db[_0xb171('0x28')][_0xb171('0x44')](_0x27e8cc)[_0xb171('0x1e')](handleEntityNotFound(_0x2b7e6e,null))[_0xb171('0x1e')](function(_0x48eb33){if(_0x48eb33){var _0x5c08d7=_0x48eb33[_0xb171('0x1f')]({'plain':!![]});_0x5c08d7=qs['omit'](_0x5c08d7,['id',_0xb171('0x4d'),_0xb171('0x4e')]);_0x1588ec[_0xb171('0x4f')]=_['omit'](_0x1588ec['body'],['id',_0xb171('0x4d'),'updatedAt']);return db[_0xb171('0x28')][_0xb171('0x45')](_[_0xb171('0x3b')](_0x5c08d7,_0x1588ec['body']),{'include':_0x1588ec[_0xb171('0x2d')]['includeAll']?[{'all':!![]}]:undefined})[_0xb171('0x1e')](function(_0x412e41){var _0x5290de=_0x1588ec['user'][_0xb171('0x1f')]({'plain':!![]});if(!_0x5290de)throw new Error(_0xb171('0x46'));if(_0x5290de[_0xb171('0x47')]==='user'){var _0x4daf95=_0x412e41['get']({'plain':!![]});var _0x477504='Projects';return db['UserProfileSection'][_0xb171('0x44')]({'where':{'name':_0x477504,'userProfileId':_0x5290de['userProfileId']},'raw':!![]})['then'](function(_0x384a9e){if(_0x384a9e&&_0x384a9e[_0xb171('0x4a')]===0x0){return db[_0xb171('0x4b')][_0xb171('0x45')]({'name':_0x4daf95[_0xb171('0x24')],'resourceId':_0x4daf95['id'],'type':_0x384a9e[_0xb171('0x24')],'sectionId':_0x384a9e['id']},{})[_0xb171('0x1e')](function(){return _0x412e41;});}else{return _0x412e41;}})[_0xb171('0x41')](function(_0x5122f4){logger[_0xb171('0x22')](_0xb171('0x4c'),_0x5122f4);throw _0x5122f4;});}return _0x412e41;});}})['then'](respondWithResult(_0x2b7e6e,0xc9))[_0xb171('0x41')](handleError(_0x2b7e6e,null));};exports[_0xb171('0x1d')]=function(_0x52c44f,_0x11adb6){if(_0x52c44f[_0xb171('0x4f')]['id']){delete _0x52c44f[_0xb171('0x4f')]['id'];}return db['JscriptyProject'][_0xb171('0x44')]({'where':{'id':_0x52c44f[_0xb171('0x43')]['id']}})[_0xb171('0x1e')](handleEntityNotFound(_0x11adb6,null))[_0xb171('0x1e')](saveUpdates(_0x52c44f['body'],null))[_0xb171('0x1e')](respondWithResult(_0x11adb6,null))[_0xb171('0x41')](handleError(_0x11adb6,null));};exports[_0xb171('0x50')]=function(_0x470fa5,_0x52f38d){return db[_0xb171('0x28')]['find']({'where':{'id':_0x470fa5[_0xb171('0x43')]['id']}})[_0xb171('0x1e')](handleEntityNotFound(_0x52f38d,null))['then'](removeEntity(_0x52f38d,null))[_0xb171('0x41')](handleError(_0x52f38d,null));};exports[_0xb171('0x51')]=function(_0x49ffbc,_0x301eee,_0x111ecc){var _0x2fd386={'raw':!![],'where':{}};var _0x38d5ee={};var _0x3d7101={'count':0x0,'rows':[]};return db[_0xb171('0x28')]['findOne']({'where':{'id':_0x49ffbc[_0xb171('0x43')]['id']}})['then'](handleEntityNotFound(_0x301eee,null))[_0xb171('0x1e')](function(_0x27ce76){if(_0x27ce76){_0x38d5ee[_0xb171('0x30')]=_[_0xb171('0x2c')](db['JscriptySessionReport'][_0xb171('0x29')]);_0x38d5ee[_0xb171('0x2d')]=_[_0xb171('0x2c')](_0x49ffbc[_0xb171('0x2d')]);_0x38d5ee['filters']=_[_0xb171('0x2f')](_0x38d5ee[_0xb171('0x30')],_0x38d5ee[_0xb171('0x2d')]);_0x2fd386[_0xb171('0x31')]=_[_0xb171('0x2f')](_0x38d5ee[_0xb171('0x30')],qs['fields'](_0x49ffbc['query'][_0xb171('0x32')]));_0x2fd386[_0xb171('0x31')]=_0x2fd386[_0xb171('0x31')]['length']?_0x2fd386['attributes']:_0x38d5ee['model'];if(!_0x49ffbc[_0xb171('0x2d')][_0xb171('0x34')]('nolimit')){_0x2fd386[_0xb171('0x18')]=qs[_0xb171('0x18')](_0x49ffbc['query']['limit']);_0x2fd386['offset']=qs['offset'](_0x49ffbc['query']['offset']);}_0x2fd386[_0xb171('0x36')]=qs[_0xb171('0x37')](_0x49ffbc[_0xb171('0x2d')]['sort']);_0x2fd386['where']=qs[_0xb171('0x2e')](_[_0xb171('0x38')](_0x49ffbc[_0xb171('0x2d')],_0x38d5ee[_0xb171('0x2e')]));_0x2fd386[_0xb171('0x3a')]['ProjectId']=_0x27ce76['id'];if(_0x49ffbc[_0xb171('0x2d')][_0xb171('0x39')]){_0x2fd386['where']=_['merge'](_0x2fd386[_0xb171('0x3a')],{'$or':_[_0xb171('0x27')](_0x2fd386['attributes'],function(_0x496b8d){var _0x5a5074={};_0x5a5074[_0x496b8d]={'$like':'%'+_0x49ffbc['query'][_0xb171('0x39')]+'%'};return _0x5a5074;})});}_0x2fd386=_[_0xb171('0x3b')]({},_0x2fd386,_0x49ffbc[_0xb171('0x3c')]);return db[_0xb171('0x52')][_0xb171('0x16')]({'where':_0x2fd386[_0xb171('0x3a')]})[_0xb171('0x1e')](function(_0x3f7588){_0x3d7101[_0xb171('0x16')]=_0x3f7588;if(_0x49ffbc['query'][_0xb171('0x3d')]){_0x2fd386[_0xb171('0x3e')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x2fd386);})[_0xb171('0x1e')](function(_0x189a9c){_0x3d7101[_0xb171('0x40')]=_0x189a9c;return _0x3d7101;});}})[_0xb171('0x1e')](respondWithFilteredResult(_0x301eee,_0x2fd386))[_0xb171('0x41')](handleError(_0x301eee,null));};exports[_0xb171('0x53')]=function(_0x1aa3b7,_0x5982d0,_0x100602){var _0xecf9c4={'raw':!![],'where':{}};var _0x1b44bd={};var _0x1db5a7={'count':0x0,'rows':[]};return db[_0xb171('0x28')][_0xb171('0x54')]({'where':{'id':_0x1aa3b7['params']['id']}})[_0xb171('0x1e')](handleEntityNotFound(_0x5982d0,null))[_0xb171('0x1e')](function(_0x1151af){if(_0x1151af){_0x1b44bd['model']=_[_0xb171('0x2c')](db['JscriptyAnswerReport']['rawAttributes']);_0x1b44bd['query']=_[_0xb171('0x2c')](_0x1aa3b7[_0xb171('0x2d')]);_0x1b44bd['filters']=_[_0xb171('0x2f')](_0x1b44bd[_0xb171('0x30')],_0x1b44bd[_0xb171('0x2d')]);_0xecf9c4[_0xb171('0x31')]=_['intersection'](_0x1b44bd['model'],qs['fields'](_0x1aa3b7[_0xb171('0x2d')][_0xb171('0x32')]));_0xecf9c4[_0xb171('0x31')]=_0xecf9c4[_0xb171('0x31')][_0xb171('0x33')]?_0xecf9c4[_0xb171('0x31')]:_0x1b44bd[_0xb171('0x30')];if(!_0x1aa3b7[_0xb171('0x2d')][_0xb171('0x34')](_0xb171('0x35'))){_0xecf9c4[_0xb171('0x18')]=qs[_0xb171('0x18')](_0x1aa3b7[_0xb171('0x2d')][_0xb171('0x18')]);_0xecf9c4[_0xb171('0x17')]=qs[_0xb171('0x17')](_0x1aa3b7[_0xb171('0x2d')][_0xb171('0x17')]);}_0xecf9c4[_0xb171('0x36')]=qs[_0xb171('0x37')](_0x1aa3b7[_0xb171('0x2d')][_0xb171('0x37')]);_0xecf9c4[_0xb171('0x3a')]=qs['filters'](_[_0xb171('0x38')](_0x1aa3b7[_0xb171('0x2d')],_0x1b44bd['filters']));_0xecf9c4['where'][_0xb171('0x55')]=_0x1151af['id'];if(_0x1aa3b7[_0xb171('0x2d')][_0xb171('0x39')]){_0xecf9c4[_0xb171('0x3a')]=_['merge'](_0xecf9c4['where'],{'$or':_[_0xb171('0x27')](_0xecf9c4['attributes'],function(_0x36a480){var _0x93c75f={};_0x93c75f[_0x36a480]={'$like':'%'+_0x1aa3b7[_0xb171('0x2d')]['filter']+'%'};return _0x93c75f;})});}_0xecf9c4=_[_0xb171('0x3b')]({},_0xecf9c4,_0x1aa3b7['options']);return db['JscriptyAnswerReport'][_0xb171('0x16')]({'where':_0xecf9c4[_0xb171('0x3a')]})[_0xb171('0x1e')](function(_0x498781){_0x1db5a7[_0xb171('0x16')]=_0x498781;if(_0x1aa3b7[_0xb171('0x2d')]['includeAll']){_0xecf9c4[_0xb171('0x3e')]=[{'all':!![]}];}return db[_0xb171('0x56')][_0xb171('0x3f')](_0xecf9c4);})[_0xb171('0x1e')](function(_0x1a9586){_0x1db5a7['rows']=_0x1a9586;return _0x1db5a7;});}})[_0xb171('0x1e')](respondWithFilteredResult(_0x5982d0,_0xecf9c4))[_0xb171('0x41')](handleError(_0x5982d0,null));};function char(_0x4b6d91){return _0xb171('0x57')===typeof _0x4b6d91?String['fromCharCode'][_0xb171('0x1b')](null,arguments):_0x4b6d91;}function needsEncapsulation(_0x51a3d4){return!!_0x51a3d4&&(_0x51a3d4['toString']()[_0xb171('0x58')](char(0xd))>=0x0||_0x51a3d4[_0xb171('0x59')]()[_0xb171('0x58')](char(0xa))>=0x0||_0x51a3d4['toString']()[_0xb171('0x58')](char(0x2c))>=0x0||_0x51a3d4[_0xb171('0x59')]()[_0xb171('0x58')](char(0x22))>=0x0);}function encapsulate(_0x557fe0){var _0x2d8552=char(0x22),_0x567d5f='\x5c'+char(0x22),_0x75dd41=_0x557fe0['toString']()[_0xb171('0x5a')](new RegExp(_0x2d8552,'g'),_0x567d5f);return _0x2d8552+_0x75dd41+_0x2d8552;}exports[_0xb171('0x5b')]=function(_0x1f294d,_0x333a62,_0x3a78b7){var _0x416f0a,_0x2d1097;var _0x9dcc69={'where':{'ProjectId':_0x1f294d[_0xb171('0x43')]['id']}};if(_0x1f294d[_0xb171('0x2d')][_0xb171('0x5c')]){_0x9dcc69[_0xb171('0x3a')][_0xb171('0x5d')]=JSON[_0xb171('0x5e')](_0x1f294d['query'][_0xb171('0x5c')]);}return db['JscriptySessionReport'][_0xb171('0x3f')](_0x9dcc69)[_0xb171('0x1e')](handleEntityNotFound(_0x333a62,null))[_0xb171('0x1e')](function(_0xce00a6){if(_0xce00a6){_0x416f0a=_0xce00a6;return db[_0xb171('0x5f')][_0xb171('0x3f')]({'where':{'SessionId':{'$in':_[_0xb171('0x27')](_0x416f0a,'id')},'ProjectId':_0x1f294d[_0xb171('0x43')]['id']},'order':'-createdAt'});}})[_0xb171('0x1e')](handleEntityNotFound(_0x333a62,null))['then'](function(_0x222700){if(_0x222700){_0x2d1097=_0x222700;var _0x340951={};for(var _0x19a13f=0x0,_0x51eb60=_0x2d1097['length'];_0x19a13f<_0x51eb60;_0x19a13f++){if(!_0x340951['hasOwnProperty'](_0x2d1097[_0x19a13f]['questionId'])){_0x340951[_0x2d1097[_0x19a13f][_0xb171('0x60')]]=needsEncapsulation(_0x2d1097[_0x19a13f]['question'])?encapsulate(_0x2d1097[_0x19a13f][_0xb171('0x61')]):_0x2d1097[_0x19a13f][_0xb171('0x61')];}}var _0x29e99e=[],_0x478020={};for(var _0x3dd487=0x0,_0x441e19=_0x416f0a[_0xb171('0x33')];_0x3dd487<_0x441e19;_0x3dd487++){_0x478020={'ProjectId':_0x1f294d[_0xb171('0x43')]['id'],'SessionId':_0x416f0a[_0x3dd487]['id'],'StartTime':moment(_0x416f0a[_0x3dd487][_0xb171('0x5d')])[_0xb171('0x62')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x56f5ad=0x0,_0x29714d=_0x2d1097[_0xb171('0x33')];_0x56f5ad<_0x29714d;_0x56f5ad++){if(_0x2d1097[_0x56f5ad][_0xb171('0x63')]==_0x416f0a[_0x3dd487]['id']&&_0x340951['hasOwnProperty'](_0x2d1097[_0x56f5ad][_0xb171('0x60')])){_0x478020[_0x340951[_0x2d1097[_0x56f5ad][_0xb171('0x60')]]]=_0x2d1097[_0x56f5ad][_0xb171('0x64')];}}for(var _0x5f04de in _0x340951){if(!_0x478020[_0xb171('0x34')](_0x340951[_0x5f04de])){_0x478020[_0x340951[_0x5f04de]]=null;}}_0x29e99e[_0xb171('0x65')](_0x478020);}return _0x29e99e;}})[_0xb171('0x1e')](function(_0x2f5b89){if(!_['isEmpty'](_0x2f5b89)){var _0x7d4e9a=toCsv(_0x2f5b89);var _0x2d2553=Date[_0xb171('0x66')]();fs[_0xb171('0x67')](util[_0xb171('0x62')](_0xb171('0x68'),_0x1f294d[_0xb171('0x43')]['id'],_0x2d2553),_0x7d4e9a);_0x333a62[_0xb171('0x69')](_0xb171('0x6a'),'attachment;\x20filename='+util[_0xb171('0x62')]('Jscripty_Project_%d_Summary_%s.csv',_0x1f294d[_0xb171('0x43')]['id'],_0x2d2553));_0x333a62[_0xb171('0x69')]('Content-type',_0xb171('0x6b'));return _0x333a62[_0xb171('0x6c')](util['format'](_0xb171('0x68'),_0x1f294d[_0xb171('0x43')]['id'],_0x2d2553));}else{return _0x333a62[_0xb171('0x21')](0xcc);}})[_0xb171('0x41')](handleError(_0x333a62,null));}; \ No newline at end of file +var _0x854a=['../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','reject','then','Projects','destroy','error','stack','name','send','JscriptyProject','rawAttributes','fieldName','model','map','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','fields','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','autoAssociation','update','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs'];(function(_0x4ee06d,_0xaa5cf){var _0x97c3f1=function(_0x5a9928){while(--_0x5a9928){_0x4ee06d['push'](_0x4ee06d['shift']());}};_0x97c3f1(++_0xaa5cf);}(_0x854a,0x1c1));var _0xa854=function(_0x43cc0b,_0x1307d6){_0x43cc0b=_0x43cc0b-0x0;var _0xddddf=_0x854a[_0x43cc0b];return _0xddddf;};'use strict';var pdf=require(_0xa854('0x0'));var emlformat=require(_0xa854('0x1'));var rimraf=require(_0xa854('0x2'));var zipdir=require(_0xa854('0x3'));var jsonpatch=require(_0xa854('0x4'));var rp=require(_0xa854('0x5'));var moment=require(_0xa854('0x6'));var BPromise=require(_0xa854('0x7'));var Mustache=require('mustache');var util=require(_0xa854('0x8'));var path=require(_0xa854('0x9'));var sox=require(_0xa854('0xa'));var csv=require(_0xa854('0xb'));var ejs=require(_0xa854('0xc'));var fs=require('fs');var _=require(_0xa854('0xd'));var squel=require(_0xa854('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa854('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa854('0x10'));var Redis=require(_0xa854('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa854('0x12'));var as=require(_0xa854('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa854('0x14'));var utils=require('../../config/utils');var config=require(_0xa854('0x15'));var db=require(_0xa854('0x16'))['db'];function respondWithStatusCode(_0x39dd03,_0x13d142){_0x13d142=_0x13d142||0xcc;return function(_0xba29d6){if(_0xba29d6){return _0x39dd03[_0xa854('0x17')](_0x13d142);}return _0x39dd03[_0xa854('0x18')](_0x13d142)[_0xa854('0x19')]();};}function respondWithResult(_0x1ae7d2,_0x3f2ac7){_0x3f2ac7=_0x3f2ac7||0xc8;return function(_0xb83c18){if(_0xb83c18){return _0x1ae7d2[_0xa854('0x18')](_0x3f2ac7)[_0xa854('0x1a')](_0xb83c18);}};}function respondWithFilteredResult(_0x1b7fac,_0x3ef65b){return function(_0x2e0a54){if(_0x2e0a54){var _0xc095a7=_0x2e0a54[_0xa854('0x1b')],_0x3f5a06=_0x3ef65b['offset'],_0x33ef33=_0x3ef65b['offset']+_0x3ef65b[_0xa854('0x1c')],_0xaac5b4;if(_0x33ef33>=_0xc095a7){_0x33ef33=_0xc095a7;_0xaac5b4=0xc8;}else{_0xaac5b4=0xce;}_0x1b7fac[_0xa854('0x18')](_0xaac5b4);return _0x1b7fac[_0xa854('0x1d')](_0xa854('0x1e'),_0x3f5a06+'-'+_0x33ef33+'/'+_0xc095a7)[_0xa854('0x1a')](_0x2e0a54);}return null;};}function patchUpdates(_0x2276f4){return function(_0x43e405){try{jsonpatch['apply'](_0x43e405,_0x2276f4,!![]);}catch(_0x1d96e4){return BPromise[_0xa854('0x1f')](_0x1d96e4);}return _0x43e405['save']();};}function saveUpdates(_0x2c743f,_0x37559e){return function(_0x5ef47b){if(_0x5ef47b){return _0x5ef47b['update'](_0x2c743f)[_0xa854('0x20')](function(_0xed8b61){return _0xed8b61;});}return null;};}function removeEntity(_0x4906ef,_0x4c9b72){return function(_0x3d2d07){if(_0x3d2d07){return _0x3d2d07['destroy']()[_0xa854('0x20')](function(){var _0x2864c5=_0x3d2d07['get']({'plain':!![]});var _0x331d89=_0xa854('0x21');return db['UserProfileResource'][_0xa854('0x22')]({'where':{'type':_0x331d89,'resourceId':_0x2864c5['id']}})[_0xa854('0x20')](function(){return _0x3d2d07;});})[_0xa854('0x20')](function(){_0x4906ef[_0xa854('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x261d4a,_0x575d2e){return function(_0x5c754e){if(!_0x5c754e){_0x261d4a[_0xa854('0x17')](0x194);}return _0x5c754e;};}function handleError(_0x537bd5,_0x526951){_0x526951=_0x526951||0x1f4;return function(_0x5cfd44){logger[_0xa854('0x23')](_0x5cfd44[_0xa854('0x24')]);if(_0x5cfd44['name']){delete _0x5cfd44[_0xa854('0x25')];}_0x537bd5[_0xa854('0x18')](_0x526951)[_0xa854('0x26')](_0x5cfd44);};}exports['index']=function(_0x1342a8,_0x5da471){var _0x55bd1b={},_0x98e481={},_0x849a4d={'count':0x0,'rows':[]};var _0xd4a795=_['map'](db[_0xa854('0x27')][_0xa854('0x28')],function(_0x34903a){return{'name':_0x34903a[_0xa854('0x29')],'type':_0x34903a['type']['key']};});_0x98e481[_0xa854('0x2a')]=_[_0xa854('0x2b')](_0xd4a795,_0xa854('0x25'));_0x98e481[_0xa854('0x2c')]=_[_0xa854('0x2d')](_0x1342a8[_0xa854('0x2c')]);_0x98e481[_0xa854('0x2e')]=_['intersection'](_0x98e481[_0xa854('0x2a')],_0x98e481[_0xa854('0x2c')]);_0x55bd1b[_0xa854('0x2f')]=_[_0xa854('0x30')](_0x98e481[_0xa854('0x2a')],qs['fields'](_0x1342a8[_0xa854('0x2c')]['fields']));_0x55bd1b[_0xa854('0x2f')]=_0x55bd1b[_0xa854('0x2f')][_0xa854('0x31')]?_0x55bd1b[_0xa854('0x2f')]:_0x98e481[_0xa854('0x2a')];if(!_0x1342a8[_0xa854('0x2c')][_0xa854('0x32')](_0xa854('0x33'))){_0x55bd1b[_0xa854('0x1c')]=qs[_0xa854('0x1c')](_0x1342a8[_0xa854('0x2c')]['limit']);_0x55bd1b[_0xa854('0x34')]=qs['offset'](_0x1342a8[_0xa854('0x2c')][_0xa854('0x34')]);}_0x55bd1b[_0xa854('0x35')]=qs[_0xa854('0x36')](_0x1342a8['query'][_0xa854('0x36')]);_0x55bd1b[_0xa854('0x37')]=qs[_0xa854('0x2e')](_[_0xa854('0x38')](_0x1342a8[_0xa854('0x2c')],_0x98e481['filters']),_0xd4a795);if(_0x1342a8['query'][_0xa854('0x39')]){_0x55bd1b[_0xa854('0x37')]=_[_0xa854('0x3a')](_0x55bd1b[_0xa854('0x37')],{'$or':_['map'](_0xd4a795,function(_0x5b8236){if(_0x5b8236[_0xa854('0x3b')]!==_0xa854('0x3c')){var _0x529cd8={};_0x529cd8[_0x5b8236['name']]={'$like':'%'+_0x1342a8['query']['filter']+'%'};return _0x529cd8;}})});}_0x55bd1b=_[_0xa854('0x3a')]({},_0x55bd1b,_0x1342a8['options']);var _0x38d4ef={'where':_0x55bd1b[_0xa854('0x37')]};return db[_0xa854('0x27')][_0xa854('0x1b')](_0x38d4ef)[_0xa854('0x20')](function(_0x5b80ec){_0x849a4d[_0xa854('0x1b')]=_0x5b80ec;if(_0x1342a8[_0xa854('0x2c')][_0xa854('0x3d')]){_0x55bd1b[_0xa854('0x3e')]=[{'all':!![]}];}return db[_0xa854('0x27')][_0xa854('0x3f')](_0x55bd1b);})['then'](function(_0x3c7469){_0x849a4d[_0xa854('0x40')]=_0x3c7469;return _0x849a4d;})['then'](respondWithFilteredResult(_0x5da471,_0x55bd1b))[_0xa854('0x41')](handleError(_0x5da471,null));};exports['show']=function(_0x277c2d,_0x45f814){var _0x2ff957={'raw':![],'where':{'id':_0x277c2d[_0xa854('0x42')]['id']}},_0x49953c={};_0x49953c[_0xa854('0x2a')]=_[_0xa854('0x2d')](db[_0xa854('0x27')][_0xa854('0x28')]);_0x49953c['query']=_[_0xa854('0x2d')](_0x277c2d[_0xa854('0x2c')]);_0x49953c[_0xa854('0x2e')]=_[_0xa854('0x30')](_0x49953c[_0xa854('0x2a')],_0x49953c[_0xa854('0x2c')]);_0x2ff957[_0xa854('0x2f')]=_['intersection'](_0x49953c['model'],qs[_0xa854('0x43')](_0x277c2d[_0xa854('0x2c')][_0xa854('0x43')]));_0x2ff957[_0xa854('0x2f')]=_0x2ff957[_0xa854('0x2f')]['length']?_0x2ff957[_0xa854('0x2f')]:_0x49953c[_0xa854('0x2a')];if(_0x277c2d['query'][_0xa854('0x3d')]){_0x2ff957[_0xa854('0x3e')]=[{'all':!![]}];}_0x2ff957=_[_0xa854('0x3a')]({},_0x2ff957,_0x277c2d[_0xa854('0x44')]);return db[_0xa854('0x27')][_0xa854('0x45')](_0x2ff957)[_0xa854('0x20')](handleEntityNotFound(_0x45f814,null))[_0xa854('0x20')](respondWithResult(_0x45f814,null))[_0xa854('0x41')](handleError(_0x45f814,null));};exports[_0xa854('0x46')]=function(_0x2495ad,_0x254f9c){return db[_0xa854('0x27')]['create'](_0x2495ad[_0xa854('0x47')],{})['then'](function(_0x55c22f){var _0x3ce94d=_0x2495ad[_0xa854('0x48')][_0xa854('0x49')]({'plain':!![]});if(!_0x3ce94d)throw new Error(_0xa854('0x4a'));if(_0x3ce94d[_0xa854('0x4b')]===_0xa854('0x48')){var _0x306554=_0x55c22f[_0xa854('0x49')]({'plain':!![]});var _0x1a5f84=_0xa854('0x21');return db[_0xa854('0x4c')][_0xa854('0x45')]({'where':{'name':_0x1a5f84,'userProfileId':_0x3ce94d[_0xa854('0x4d')]},'raw':!![]})['then'](function(_0x1c9641){if(_0x1c9641&&_0x1c9641['autoAssociation']===0x0){return db[_0xa854('0x4e')][_0xa854('0x46')]({'name':_0x306554[_0xa854('0x25')],'resourceId':_0x306554['id'],'type':_0x1c9641[_0xa854('0x25')],'sectionId':_0x1c9641['id']},{})[_0xa854('0x20')](function(){return _0x55c22f;});}else{return _0x55c22f;}})[_0xa854('0x41')](function(_0x52f635){logger[_0xa854('0x23')](_0xa854('0x4f'),_0x52f635);throw _0x52f635;});}return _0x55c22f;})[_0xa854('0x20')](respondWithResult(_0x254f9c,0xc9))[_0xa854('0x41')](handleError(_0x254f9c,null));};exports[_0xa854('0x50')]=function(_0x3ed4b5,_0x539af2){var _0x5443de={'where':{'id':_0x3ed4b5['params']['id']}},_0x13894d={};_0x13894d[_0xa854('0x2a')]=_['keys'](db[_0xa854('0x27')]['rawAttributes']);_0x5443de[_0xa854('0x2f')]=_[_0xa854('0x30')](_0x13894d[_0xa854('0x2a')],qs[_0xa854('0x43')](_0x3ed4b5[_0xa854('0x2c')][_0xa854('0x43')]));_0x5443de[_0xa854('0x2f')]=_0x5443de[_0xa854('0x2f')]['length']?_0x5443de[_0xa854('0x2f')]:_0x13894d[_0xa854('0x2a')];if(_0x3ed4b5[_0xa854('0x2c')][_0xa854('0x3d')]){_0x5443de[_0xa854('0x3e')]=[{'all':!![]}];}_0x5443de=_[_0xa854('0x3a')]({},_0x5443de,_0x3ed4b5[_0xa854('0x44')]);return db[_0xa854('0x27')][_0xa854('0x45')](_0x5443de)['then'](handleEntityNotFound(_0x539af2,null))[_0xa854('0x20')](function(_0x35a9a9){if(_0x35a9a9){var _0x1e294a=_0x35a9a9[_0xa854('0x49')]({'plain':!![]});_0x1e294a=qs['omit'](_0x1e294a,['id',_0xa854('0x51'),_0xa854('0x52')]);_0x3ed4b5['body']=_[_0xa854('0x53')](_0x3ed4b5[_0xa854('0x47')],['id',_0xa854('0x51'),'updatedAt']);return db['JscriptyProject']['create'](_['merge'](_0x1e294a,_0x3ed4b5[_0xa854('0x47')]),{'include':_0x3ed4b5[_0xa854('0x2c')][_0xa854('0x3d')]?[{'all':!![]}]:undefined})[_0xa854('0x20')](function(_0x50e426){var _0x4a09e1=_0x3ed4b5['user'][_0xa854('0x49')]({'plain':!![]});if(!_0x4a09e1)throw new Error(_0xa854('0x4a'));if(_0x4a09e1[_0xa854('0x4b')]==='user'){var _0x1af64c=_0x50e426[_0xa854('0x49')]({'plain':!![]});var _0x4d9381=_0xa854('0x21');return db['UserProfileSection'][_0xa854('0x45')]({'where':{'name':_0x4d9381,'userProfileId':_0x4a09e1[_0xa854('0x4d')]},'raw':!![]})[_0xa854('0x20')](function(_0x3f07f6){if(_0x3f07f6&&_0x3f07f6[_0xa854('0x54')]===0x0){return db[_0xa854('0x4e')][_0xa854('0x46')]({'name':_0x1af64c[_0xa854('0x25')],'resourceId':_0x1af64c['id'],'type':_0x3f07f6[_0xa854('0x25')],'sectionId':_0x3f07f6['id']},{})[_0xa854('0x20')](function(){return _0x50e426;});}else{return _0x50e426;}})[_0xa854('0x41')](function(_0x6a6f80){logger['error'](_0xa854('0x4f'),_0x6a6f80);throw _0x6a6f80;});}return _0x50e426;});}})[_0xa854('0x20')](respondWithResult(_0x539af2,0xc9))[_0xa854('0x41')](handleError(_0x539af2,null));};exports[_0xa854('0x55')]=function(_0x25d88c,_0x2f1699){if(_0x25d88c[_0xa854('0x47')]['id']){delete _0x25d88c[_0xa854('0x47')]['id'];}return db[_0xa854('0x27')][_0xa854('0x45')]({'where':{'id':_0x25d88c[_0xa854('0x42')]['id']}})[_0xa854('0x20')](handleEntityNotFound(_0x2f1699,null))[_0xa854('0x20')](saveUpdates(_0x25d88c['body'],null))[_0xa854('0x20')](respondWithResult(_0x2f1699,null))['catch'](handleError(_0x2f1699,null));};exports['destroy']=function(_0x1000a4,_0x4489dc){return db['JscriptyProject']['find']({'where':{'id':_0x1000a4[_0xa854('0x42')]['id']}})[_0xa854('0x20')](handleEntityNotFound(_0x4489dc,null))[_0xa854('0x20')](removeEntity(_0x4489dc,null))[_0xa854('0x41')](handleError(_0x4489dc,null));};exports['getSessions']=function(_0xb26067,_0x48c841,_0x4f0780){var _0x338813={'raw':!![],'where':{}};var _0x417e5d={};var _0x20a622={'count':0x0,'rows':[]};return db[_0xa854('0x27')][_0xa854('0x56')]({'where':{'id':_0xb26067[_0xa854('0x42')]['id']}})[_0xa854('0x20')](handleEntityNotFound(_0x48c841,null))['then'](function(_0x5e347a){if(_0x5e347a){_0x417e5d['model']=_[_0xa854('0x2d')](db[_0xa854('0x57')]['rawAttributes']);_0x417e5d[_0xa854('0x2c')]=_[_0xa854('0x2d')](_0xb26067[_0xa854('0x2c')]);_0x417e5d[_0xa854('0x2e')]=_[_0xa854('0x30')](_0x417e5d['model'],_0x417e5d['query']);_0x338813['attributes']=_[_0xa854('0x30')](_0x417e5d[_0xa854('0x2a')],qs[_0xa854('0x43')](_0xb26067[_0xa854('0x2c')][_0xa854('0x43')]));_0x338813['attributes']=_0x338813['attributes'][_0xa854('0x31')]?_0x338813['attributes']:_0x417e5d[_0xa854('0x2a')];if(!_0xb26067[_0xa854('0x2c')]['hasOwnProperty']('nolimit')){_0x338813['limit']=qs[_0xa854('0x1c')](_0xb26067['query']['limit']);_0x338813[_0xa854('0x34')]=qs[_0xa854('0x34')](_0xb26067[_0xa854('0x2c')]['offset']);}_0x338813[_0xa854('0x35')]=qs[_0xa854('0x36')](_0xb26067['query']['sort']);_0x338813[_0xa854('0x37')]=qs[_0xa854('0x2e')](_[_0xa854('0x38')](_0xb26067[_0xa854('0x2c')],_0x417e5d[_0xa854('0x2e')]));_0x338813[_0xa854('0x37')][_0xa854('0x58')]=_0x5e347a['id'];if(_0xb26067['query'][_0xa854('0x39')]){_0x338813[_0xa854('0x37')]=_[_0xa854('0x3a')](_0x338813[_0xa854('0x37')],{'$or':_['map'](_0x338813[_0xa854('0x2f')],function(_0x36eb45){var _0x10a02b={};_0x10a02b[_0x36eb45]={'$like':'%'+_0xb26067[_0xa854('0x2c')][_0xa854('0x39')]+'%'};return _0x10a02b;})});}_0x338813=_[_0xa854('0x3a')]({},_0x338813,_0xb26067['options']);return db[_0xa854('0x57')][_0xa854('0x1b')]({'where':_0x338813[_0xa854('0x37')]})[_0xa854('0x20')](function(_0x23ea34){_0x20a622[_0xa854('0x1b')]=_0x23ea34;if(_0xb26067['query'][_0xa854('0x3d')]){_0x338813[_0xa854('0x3e')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x338813);})[_0xa854('0x20')](function(_0x2effcb){_0x20a622['rows']=_0x2effcb;return _0x20a622;});}})[_0xa854('0x20')](respondWithFilteredResult(_0x48c841,_0x338813))[_0xa854('0x41')](handleError(_0x48c841,null));};exports[_0xa854('0x59')]=function(_0x298564,_0x2931a0,_0x3c582d){var _0x12b558={'raw':!![],'where':{}};var _0x21afdb={};var _0x466b6c={'count':0x0,'rows':[]};return db[_0xa854('0x27')][_0xa854('0x56')]({'where':{'id':_0x298564[_0xa854('0x42')]['id']}})[_0xa854('0x20')](handleEntityNotFound(_0x2931a0,null))[_0xa854('0x20')](function(_0xc741b6){if(_0xc741b6){_0x21afdb[_0xa854('0x2a')]=_[_0xa854('0x2d')](db[_0xa854('0x5a')]['rawAttributes']);_0x21afdb[_0xa854('0x2c')]=_[_0xa854('0x2d')](_0x298564[_0xa854('0x2c')]);_0x21afdb['filters']=_[_0xa854('0x30')](_0x21afdb[_0xa854('0x2a')],_0x21afdb[_0xa854('0x2c')]);_0x12b558[_0xa854('0x2f')]=_['intersection'](_0x21afdb['model'],qs[_0xa854('0x43')](_0x298564[_0xa854('0x2c')]['fields']));_0x12b558[_0xa854('0x2f')]=_0x12b558['attributes']['length']?_0x12b558[_0xa854('0x2f')]:_0x21afdb[_0xa854('0x2a')];if(!_0x298564[_0xa854('0x2c')][_0xa854('0x32')](_0xa854('0x33'))){_0x12b558[_0xa854('0x1c')]=qs[_0xa854('0x1c')](_0x298564['query'][_0xa854('0x1c')]);_0x12b558[_0xa854('0x34')]=qs['offset'](_0x298564[_0xa854('0x2c')][_0xa854('0x34')]);}_0x12b558[_0xa854('0x35')]=qs[_0xa854('0x36')](_0x298564[_0xa854('0x2c')][_0xa854('0x36')]);_0x12b558[_0xa854('0x37')]=qs[_0xa854('0x2e')](_[_0xa854('0x38')](_0x298564[_0xa854('0x2c')],_0x21afdb[_0xa854('0x2e')]));_0x12b558[_0xa854('0x37')][_0xa854('0x58')]=_0xc741b6['id'];if(_0x298564['query']['filter']){_0x12b558['where']=_[_0xa854('0x3a')](_0x12b558[_0xa854('0x37')],{'$or':_[_0xa854('0x2b')](_0x12b558['attributes'],function(_0x2c073c){var _0x19e087={};_0x19e087[_0x2c073c]={'$like':'%'+_0x298564['query'][_0xa854('0x39')]+'%'};return _0x19e087;})});}_0x12b558=_[_0xa854('0x3a')]({},_0x12b558,_0x298564[_0xa854('0x44')]);return db['JscriptyAnswerReport']['count']({'where':_0x12b558[_0xa854('0x37')]})[_0xa854('0x20')](function(_0xf3b009){_0x466b6c[_0xa854('0x1b')]=_0xf3b009;if(_0x298564[_0xa854('0x2c')][_0xa854('0x3d')]){_0x12b558['include']=[{'all':!![]}];}return db[_0xa854('0x5a')]['findAll'](_0x12b558);})[_0xa854('0x20')](function(_0x2ce1a0){_0x466b6c[_0xa854('0x40')]=_0x2ce1a0;return _0x466b6c;});}})[_0xa854('0x20')](respondWithFilteredResult(_0x2931a0,_0x12b558))['catch'](handleError(_0x2931a0,null));};function char(_0x3d9203){return _0xa854('0x5b')===typeof _0x3d9203?String[_0xa854('0x5c')]['apply'](null,arguments):_0x3d9203;}function needsEncapsulation(_0x545685){return!!_0x545685&&(_0x545685[_0xa854('0x5d')]()[_0xa854('0x5e')](char(0xd))>=0x0||_0x545685['toString']()[_0xa854('0x5e')](char(0xa))>=0x0||_0x545685[_0xa854('0x5d')]()['indexOf'](char(0x2c))>=0x0||_0x545685[_0xa854('0x5d')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x26a431){var _0x4d3ded=char(0x22),_0x48a59a='\x5c'+char(0x22),_0x428f29=_0x26a431[_0xa854('0x5d')]()[_0xa854('0x5f')](new RegExp(_0x4d3ded,'g'),_0x48a59a);return _0x4d3ded+_0x428f29+_0x4d3ded;}exports[_0xa854('0x60')]=function(_0x360168,_0x508804,_0x51f309){var _0x4c58d5,_0x5d65b6;var _0x55b4db={'where':{'ProjectId':_0x360168[_0xa854('0x42')]['id']}};if(_0x360168[_0xa854('0x2c')][_0xa854('0x61')]){_0x55b4db[_0xa854('0x37')]['starttime']=JSON['parse'](_0x360168[_0xa854('0x2c')]['startTime']);}return db[_0xa854('0x57')]['findAll'](_0x55b4db)[_0xa854('0x20')](handleEntityNotFound(_0x508804,null))[_0xa854('0x20')](function(_0x425fd3){if(_0x425fd3){_0x4c58d5=_0x425fd3;return db[_0xa854('0x62')][_0xa854('0x3f')]({'where':{'SessionId':{'$in':_[_0xa854('0x2b')](_0x4c58d5,'id')},'ProjectId':_0x360168[_0xa854('0x42')]['id']},'order':_0xa854('0x63')});}})[_0xa854('0x20')](handleEntityNotFound(_0x508804,null))[_0xa854('0x20')](function(_0x598f0f){if(_0x598f0f){_0x5d65b6=_0x598f0f;var _0x319444={};for(var _0x3d9567=0x0,_0x339ec7=_0x5d65b6[_0xa854('0x31')];_0x3d9567<_0x339ec7;_0x3d9567++){if(!_0x319444[_0xa854('0x32')](_0x5d65b6[_0x3d9567][_0xa854('0x64')])){_0x319444[_0x5d65b6[_0x3d9567][_0xa854('0x64')]]=needsEncapsulation(_0x5d65b6[_0x3d9567][_0xa854('0x65')])?encapsulate(_0x5d65b6[_0x3d9567]['question']):_0x5d65b6[_0x3d9567][_0xa854('0x65')];}}var _0x2751c1=[],_0xb49e68={};for(var _0xc93316=0x0,_0x3069c0=_0x4c58d5[_0xa854('0x31')];_0xc93316<_0x3069c0;_0xc93316++){_0xb49e68={'ProjectId':_0x360168[_0xa854('0x42')]['id'],'SessionId':_0x4c58d5[_0xc93316]['id'],'StartTime':moment(_0x4c58d5[_0xc93316][_0xa854('0x66')])[_0xa854('0x67')](_0xa854('0x68'))};for(var _0x3b7c3b=0x0,_0x48cb87=_0x5d65b6[_0xa854('0x31')];_0x3b7c3b<_0x48cb87;_0x3b7c3b++){if(_0x5d65b6[_0x3b7c3b][_0xa854('0x69')]==_0x4c58d5[_0xc93316]['id']&&_0x319444[_0xa854('0x32')](_0x5d65b6[_0x3b7c3b]['questionId'])){_0xb49e68[_0x319444[_0x5d65b6[_0x3b7c3b][_0xa854('0x64')]]]=_0x5d65b6[_0x3b7c3b][_0xa854('0x6a')];}}for(var _0x2a3add in _0x319444){if(!_0xb49e68[_0xa854('0x32')](_0x319444[_0x2a3add])){_0xb49e68[_0x319444[_0x2a3add]]=null;}}_0x2751c1[_0xa854('0x6b')](_0xb49e68);}return _0x2751c1;}})[_0xa854('0x20')](function(_0x3dcbee){if(!_[_0xa854('0x6c')](_0x3dcbee)){var _0x9195c0=toCsv(_0x3dcbee);var _0x2d7cd5=Date[_0xa854('0x6d')]();fs[_0xa854('0x6e')](util['format'](_0xa854('0x6f'),_0x360168[_0xa854('0x42')]['id'],_0x2d7cd5),_0x9195c0);_0x508804[_0xa854('0x70')](_0xa854('0x71'),_0xa854('0x72')+util[_0xa854('0x67')](_0xa854('0x73'),_0x360168['params']['id'],_0x2d7cd5));_0x508804['setHeader'](_0xa854('0x74'),'text/csv');return _0x508804['download'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x360168[_0xa854('0x42')]['id'],_0x2d7cd5));}else{return _0x508804[_0xa854('0x17')](0xcc);}})[_0xa854('0x41')](handleError(_0x508804,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index e342dc4..0d8c24f 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 _0x9ccd=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util'];(function(_0x4b0dfb,_0x287611){var _0x267274=function(_0x284ec0){while(--_0x284ec0){_0x4b0dfb['push'](_0x4b0dfb['shift']());}};_0x267274(++_0x287611);}(_0x9ccd,0x178));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd9cc('0x0'));var util=require(_0xd9cc('0x1'));var logger=require(_0xd9cc('0x2'))(_0xd9cc('0x3'));var moment=require(_0xd9cc('0x4'));var BPromise=require(_0xd9cc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9cc('0x6'));var rimraf=require(_0xd9cc('0x7'));var config=require(_0xd9cc('0x8'));var attributes=require(_0xd9cc('0x9'));module[_0xd9cc('0xa')]=function(_0x347c8e,_0x36def9){return _0x347c8e[_0xd9cc('0xb')](_0xd9cc('0xc'),attributes,{'tableName':_0xd9cc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f83=['exports','define','JscriptyProject','jscripty_projects','lodash','util','moment','bluebird','rimraf','../../config/environment','./jscriptyProject.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2f83,0x1a6));var _0x32f8=function(_0x5ff464,_0x5038d7){_0x5ff464=_0x5ff464-0x0;var _0x347182=_0x2f83[_0x5ff464];return _0x347182;};'use strict';var _=require(_0x32f8('0x0'));var util=require(_0x32f8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x32f8('0x2'));var BPromise=require(_0x32f8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x32f8('0x4'));var config=require(_0x32f8('0x5'));var attributes=require(_0x32f8('0x6'));module[_0x32f8('0x7')]=function(_0x42778d,_0x54d58a){return _0x42778d[_0x32f8('0x8')](_0x32f8('0x9'),attributes,{'tableName':_0x32f8('0xa'),'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 2d62c32..a4b8e68 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 _0x4c81=['code','message','info','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error'];(function(_0x5ac98,_0x416c55){var _0x1ca820=function(_0x35ef27){while(--_0x35ef27){_0x5ac98['push'](_0x5ac98['shift']());}};_0x1ca820(++_0x416c55);}(_0x4c81,0xf3));var _0x14c8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4c81[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x14c8('0x0'));var BPromise=require(_0x14c8('0x1'));var rs=require(_0x14c8('0x2'));var fs=require('fs');var Redis=require(_0x14c8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x14c8('0x4'));var logger=require(_0x14c8('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x14c8('0x6'));var client=jayson['client'][_0x14c8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f7f49,_0x2fb54a,_0x24e0d){return new BPromise(function(_0x5d7063,_0x40bc98){return client['request'](_0x2f7f49,_0x24e0d)['then'](function(_0x38ce1c){logger['info'](_0x14c8('0x8'),_0x2fb54a,_0x14c8('0x9'));logger[_0x14c8('0xa')](_0x14c8('0xb'),_0x2fb54a,_0x14c8('0x9'),JSON['stringify'](_0x38ce1c));if(_0x38ce1c[_0x14c8('0xc')]){if(_0x38ce1c['error'][_0x14c8('0xd')]===0x1f4){logger[_0x14c8('0xc')](_0x14c8('0x8'),_0x2fb54a,_0x38ce1c[_0x14c8('0xc')][_0x14c8('0xe')]);return _0x40bc98(_0x38ce1c[_0x14c8('0xc')][_0x14c8('0xe')]);}logger[_0x14c8('0xc')](_0x14c8('0x8'),_0x2fb54a,_0x38ce1c[_0x14c8('0xc')][_0x14c8('0xe')]);return _0x5d7063(_0x38ce1c['error']['message']);}else{logger[_0x14c8('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2fb54a,'request\x20sent');_0x5d7063(_0x38ce1c['result']['message']);}})['catch'](function(_0xc0be05){logger['error'](_0x14c8('0x8'),_0x2fb54a,_0xc0be05);_0x40bc98(_0xc0be05);});});} \ No newline at end of file +var _0x89f7=['client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x45ed73,_0x335024){var _0x261086=function(_0x104218){while(--_0x104218){_0x45ed73['push'](_0x45ed73['shift']());}};_0x261086(++_0x335024);}(_0x89f7,0x1bf));var _0x789f=function(_0x16e0c8,_0x4861eb){_0x16e0c8=_0x16e0c8-0x0;var _0xe4b5af=_0x89f7[_0x16e0c8];return _0xe4b5af;};'use strict';var _=require(_0x789f('0x0'));var util=require(_0x789f('0x1'));var moment=require(_0x789f('0x2'));var BPromise=require(_0x789f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x789f('0x4'));var db=require(_0x789f('0x5'))['db'];var utils=require(_0x789f('0x6'));var logger=require('../../config/logger')(_0x789f('0x7'));var config=require(_0x789f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x789f('0x9')][_0x789f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37b8af,_0x379284,_0x2d1dc7){return new BPromise(function(_0xdae920,_0xba30b6){return client[_0x789f('0xb')](_0x37b8af,_0x2d1dc7)[_0x789f('0xc')](function(_0x2f4874){logger[_0x789f('0xd')](_0x789f('0xe'),_0x379284,'request\x20sent');logger[_0x789f('0xf')](_0x789f('0x10'),_0x379284,_0x789f('0x11'),JSON[_0x789f('0x12')](_0x2f4874));if(_0x2f4874['error']){if(_0x2f4874[_0x789f('0x13')][_0x789f('0x14')]===0x1f4){logger[_0x789f('0x13')](_0x789f('0xe'),_0x379284,_0x2f4874[_0x789f('0x13')][_0x789f('0x15')]);return _0xba30b6(_0x2f4874['error']['message']);}logger['error'](_0x789f('0xe'),_0x379284,_0x2f4874[_0x789f('0x13')]['message']);return _0xdae920(_0x2f4874[_0x789f('0x13')][_0x789f('0x15')]);}else{logger[_0x789f('0xd')](_0x789f('0xe'),_0x379284,_0x789f('0x11'));_0xdae920(_0x2f4874[_0x789f('0x16')][_0x789f('0x15')]);}})[_0x789f('0x17')](function(_0x1ccb03){logger[_0x789f('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x379284,_0x1ccb03);_0xba30b6(_0x1ccb03);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 288130b..78a78c9 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 _0x1db1=['./jscriptyQuestionReport.controller','get','isAuthenticated','describe','/:id','show','post','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1db1,0x9b));var _0x11db=function(_0x4ee4ee,_0x418fdd){_0x4ee4ee=_0x4ee4ee-0x0;var _0x16aeed=_0x1db1[_0x4ee4ee];return _0x16aeed;};'use strict';var multer=require(_0x11db('0x0'));var util=require('util');var path=require(_0x11db('0x1'));var timeout=require(_0x11db('0x2'));var express=require(_0x11db('0x3'));var router=express[_0x11db('0x4')]();var auth=require(_0x11db('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x11db('0x6'));var controller=require(_0x11db('0x7'));router[_0x11db('0x8')]('/',auth[_0x11db('0x9')](),controller['index']);router[_0x11db('0x8')]('/describe',auth[_0x11db('0x9')](),controller[_0x11db('0xa')]);router[_0x11db('0x8')](_0x11db('0xb'),auth[_0x11db('0x9')](),controller[_0x11db('0xc')]);router[_0x11db('0xd')]('/',auth[_0x11db('0x9')](),controller['create']);router[_0x11db('0xe')](_0x11db('0xb'),auth[_0x11db('0x9')](),controller['update']);router[_0x11db('0xf')]('/:id',auth[_0x11db('0x9')](),controller[_0x11db('0x10')]);module[_0x11db('0x11')]=router; \ No newline at end of file +var _0x9783=['get','isAuthenticated','/describe','show','post','create','put','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller'];(function(_0x30aa56,_0x44acdf){var _0x17acc8=function(_0x1ea674){while(--_0x1ea674){_0x30aa56['push'](_0x30aa56['shift']());}};_0x17acc8(++_0x44acdf);}(_0x9783,0x77));var _0x3978=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9783[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3978('0x0'));var util=require(_0x3978('0x1'));var path=require('path');var timeout=require(_0x3978('0x2'));var express=require('express');var router=express[_0x3978('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3978('0x4'));var config=require(_0x3978('0x5'));var controller=require(_0x3978('0x6'));router[_0x3978('0x7')]('/',auth[_0x3978('0x8')](),controller['index']);router[_0x3978('0x7')](_0x3978('0x9'),auth[_0x3978('0x8')](),controller['describe']);router[_0x3978('0x7')]('/:id',auth[_0x3978('0x8')](),controller[_0x3978('0xa')]);router[_0x3978('0xb')]('/',auth[_0x3978('0x8')](),controller[_0x3978('0xc')]);router[_0x3978('0xd')]('/:id',auth[_0x3978('0x8')](),controller['update']);router[_0x3978('0xe')](_0x3978('0xf'),auth['isAuthenticated'](),controller[_0x3978('0x10')]);module[_0x3978('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index e9d12da..2b83fff 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 _0xbeaf=['TEXT','sequelize','STRING'];(function(_0x296453,_0x219c2a){var _0x37b596=function(_0x4d818e){while(--_0x4d818e){_0x296453['push'](_0x296453['shift']());}};_0x37b596(++_0x219c2a);}(_0xbeaf,0xc4));var _0xfbea=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xbeaf[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0xfbea('0x0'));module['exports']={'question':{'type':Sequelize[_0xfbea('0x1')]},'answer':{'type':Sequelize[_0xfbea('0x2')]('long')},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfbea('0x1')]},'calleridname':{'type':Sequelize[_0xfbea('0x1')]},'calleridnum':{'type':Sequelize[_0xfbea('0x1')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x46bd=['STRING','long','sequelize','exports'];(function(_0x23938e,_0x336a93){var _0x58f72a=function(_0x5a8964){while(--_0x5a8964){_0x23938e['push'](_0x23938e['shift']());}};_0x58f72a(++_0x336a93);}(_0x46bd,0x1c2));var _0xd46b=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x46bd[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require(_0xd46b('0x0'));module[_0xd46b('0x1')]={'question':{'type':Sequelize[_0xd46b('0x2')]},'answer':{'type':Sequelize['TEXT'](_0xd46b('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xd46b('0x2')]},'uniqueid':{'type':Sequelize[_0xd46b('0x2')]},'calleridname':{'type':Sequelize[_0xd46b('0x2')]},'calleridnum':{'type':Sequelize[_0xd46b('0x2')]},'questionId':{'type':Sequelize[_0xd46b('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index ec548d1..dc249db 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 _0x0dc4=['bluebird','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','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','Content-Range','apply','update','then','error','stack','name','map','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','JscriptyQuestionReport','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment'];(function(_0x43f155,_0x3c637e){var _0x45edba=function(_0x18431c){while(--_0x18431c){_0x43f155['push'](_0x43f155['shift']());}};_0x45edba(++_0x3c637e);}(_0x0dc4,0x159));var _0x40dc=function(_0x414648,_0x34a290){_0x414648=_0x414648-0x0;var _0x3fae7=_0x0dc4[_0x414648];return _0x3fae7;};'use strict';var pdf=require(_0x40dc('0x0'));var emlformat=require(_0x40dc('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x40dc('0x2'));var rp=require(_0x40dc('0x3'));var moment=require(_0x40dc('0x4'));var BPromise=require(_0x40dc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x40dc('0x6'));var sox=require(_0x40dc('0x7'));var csv=require('to-csv');var ejs=require(_0x40dc('0x8'));var fs=require('fs');var _=require(_0x40dc('0x9'));var squel=require(_0x40dc('0xa'));var crypto=require(_0x40dc('0xb'));var jsforce=require(_0x40dc('0xc'));var deskjs=require(_0x40dc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x40dc('0xe'));var Papa=require(_0x40dc('0xf'));var Redis=require(_0x40dc('0x10'));var authService=require(_0x40dc('0x11'));var qs=require(_0x40dc('0x12'));var as=require(_0x40dc('0x13'));var hardwareService=require(_0x40dc('0x14'));var logger=require(_0x40dc('0x15'))('api');var utils=require(_0x40dc('0x16'));var config=require(_0x40dc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xed3c34,_0x63ab06){_0x63ab06=_0x63ab06||0xcc;return function(_0x5059fc){if(_0x5059fc){return _0xed3c34[_0x40dc('0x18')](_0x63ab06);}return _0xed3c34[_0x40dc('0x19')](_0x63ab06)[_0x40dc('0x1a')]();};}function respondWithResult(_0x1ad346,_0x146dcb){_0x146dcb=_0x146dcb||0xc8;return function(_0x139695){if(_0x139695){return _0x1ad346[_0x40dc('0x19')](_0x146dcb)['json'](_0x139695);}};}function respondWithFilteredResult(_0x29ae9,_0x71638f){return function(_0x2d54b3){if(_0x2d54b3){var _0x25b628=_0x2d54b3[_0x40dc('0x1b')],_0x23d182=_0x71638f[_0x40dc('0x1c')],_0x372e4c=_0x71638f[_0x40dc('0x1c')]+_0x71638f[_0x40dc('0x1d')],_0x503c1d;if(_0x372e4c>=_0x25b628){_0x372e4c=_0x25b628;_0x503c1d=0xc8;}else{_0x503c1d=0xce;}_0x29ae9['status'](_0x503c1d);return _0x29ae9['set'](_0x40dc('0x1e'),_0x23d182+'-'+_0x372e4c+'/'+_0x25b628)['json'](_0x2d54b3);}return null;};}function patchUpdates(_0x598a3c){return function(_0x4202f5){try{jsonpatch[_0x40dc('0x1f')](_0x4202f5,_0x598a3c,!![]);}catch(_0x55a5b3){return BPromise['reject'](_0x55a5b3);}return _0x4202f5['save']();};}function saveUpdates(_0x1ac019,_0x273256){return function(_0x3c00b2){if(_0x3c00b2){return _0x3c00b2[_0x40dc('0x20')](_0x1ac019)[_0x40dc('0x21')](function(_0x4584dd){return _0x4584dd;});}return null;};}function removeEntity(_0x30ab74,_0x2cdb3a){return function(_0xa9bc6e){if(_0xa9bc6e){return _0xa9bc6e['destroy']()['then'](function(){_0x30ab74['status'](0xcc)[_0x40dc('0x1a')]();});}};}function handleEntityNotFound(_0xcc52a4,_0x447acb){return function(_0x3b0fb8){if(!_0x3b0fb8){_0xcc52a4[_0x40dc('0x18')](0x194);}return _0x3b0fb8;};}function handleError(_0x2532a2,_0x313be0){_0x313be0=_0x313be0||0x1f4;return function(_0x22861c){logger[_0x40dc('0x22')](_0x22861c[_0x40dc('0x23')]);if(_0x22861c[_0x40dc('0x24')]){delete _0x22861c[_0x40dc('0x24')];}_0x2532a2[_0x40dc('0x19')](_0x313be0)['send'](_0x22861c);};}exports['index']=function(_0xf6a192,_0x2ba0b1){var _0x37812d={},_0x4b1a49={},_0x17c36f={'count':0x0,'rows':[]};var _0x4b3aeb=_[_0x40dc('0x25')](db['JscriptyQuestionReport'][_0x40dc('0x26')],function(_0x496df4){return{'name':_0x496df4['fieldName'],'type':_0x496df4[_0x40dc('0x27')][_0x40dc('0x28')]};});_0x4b1a49[_0x40dc('0x29')]=_['map'](_0x4b3aeb,_0x40dc('0x24'));_0x4b1a49['query']=_[_0x40dc('0x2a')](_0xf6a192[_0x40dc('0x2b')]);_0x4b1a49['filters']=_[_0x40dc('0x2c')](_0x4b1a49[_0x40dc('0x29')],_0x4b1a49['query']);_0x37812d['attributes']=_[_0x40dc('0x2c')](_0x4b1a49[_0x40dc('0x29')],qs[_0x40dc('0x2d')](_0xf6a192[_0x40dc('0x2b')][_0x40dc('0x2d')]));_0x37812d[_0x40dc('0x2e')]=_0x37812d[_0x40dc('0x2e')][_0x40dc('0x2f')]?_0x37812d['attributes']:_0x4b1a49[_0x40dc('0x29')];if(!_0xf6a192[_0x40dc('0x2b')]['hasOwnProperty'](_0x40dc('0x30'))){_0x37812d[_0x40dc('0x1d')]=qs[_0x40dc('0x1d')](_0xf6a192[_0x40dc('0x2b')][_0x40dc('0x1d')]);_0x37812d[_0x40dc('0x1c')]=qs[_0x40dc('0x1c')](_0xf6a192['query'][_0x40dc('0x1c')]);}_0x37812d[_0x40dc('0x31')]=qs[_0x40dc('0x32')](_0xf6a192['query'][_0x40dc('0x32')]);_0x37812d[_0x40dc('0x33')]=qs[_0x40dc('0x34')](_[_0x40dc('0x35')](_0xf6a192[_0x40dc('0x2b')],_0x4b1a49['filters']),_0x4b3aeb);if(_0xf6a192[_0x40dc('0x2b')][_0x40dc('0x36')]){_0x37812d[_0x40dc('0x33')]=_[_0x40dc('0x37')](_0x37812d[_0x40dc('0x33')],{'$or':_['map'](_0x4b3aeb,function(_0x1bac3e){if(_0x1bac3e[_0x40dc('0x27')]!==_0x40dc('0x38')){var _0x8ab8fb={};_0x8ab8fb[_0x1bac3e['name']]={'$like':'%'+_0xf6a192['query']['filter']+'%'};return _0x8ab8fb;}})});}_0x37812d=_[_0x40dc('0x37')]({},_0x37812d,_0xf6a192['options']);var _0xac5e0d={'where':_0x37812d[_0x40dc('0x33')]};return db[_0x40dc('0x39')][_0x40dc('0x1b')](_0xac5e0d)[_0x40dc('0x21')](function(_0x5e264f){_0x17c36f['count']=_0x5e264f;if(_0xf6a192[_0x40dc('0x2b')]['includeAll']){_0x37812d[_0x40dc('0x3a')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x40dc('0x3b')](_0x37812d);})[_0x40dc('0x21')](function(_0x24b2f4){_0x17c36f[_0x40dc('0x3c')]=_0x24b2f4;return _0x17c36f;})[_0x40dc('0x21')](respondWithFilteredResult(_0x2ba0b1,_0x37812d))[_0x40dc('0x3d')](handleError(_0x2ba0b1,null));};exports[_0x40dc('0x3e')]=function(_0x169407,_0x3a6cff){var _0x10353f={'raw':!![],'where':{'id':_0x169407[_0x40dc('0x3f')]['id']}},_0x1655b3={};_0x1655b3[_0x40dc('0x29')]=_[_0x40dc('0x2a')](db[_0x40dc('0x39')][_0x40dc('0x26')]);_0x1655b3[_0x40dc('0x2b')]=_[_0x40dc('0x2a')](_0x169407[_0x40dc('0x2b')]);_0x1655b3['filters']=_[_0x40dc('0x2c')](_0x1655b3['model'],_0x1655b3[_0x40dc('0x2b')]);_0x10353f[_0x40dc('0x2e')]=_['intersection'](_0x1655b3[_0x40dc('0x29')],qs[_0x40dc('0x2d')](_0x169407[_0x40dc('0x2b')][_0x40dc('0x2d')]));_0x10353f[_0x40dc('0x2e')]=_0x10353f[_0x40dc('0x2e')][_0x40dc('0x2f')]?_0x10353f[_0x40dc('0x2e')]:_0x1655b3[_0x40dc('0x29')];if(_0x169407['query'][_0x40dc('0x40')]){_0x10353f[_0x40dc('0x3a')]=[{'all':!![]}];}_0x10353f=_[_0x40dc('0x37')]({},_0x10353f,_0x169407[_0x40dc('0x41')]);return db[_0x40dc('0x39')]['find'](_0x10353f)[_0x40dc('0x21')](handleEntityNotFound(_0x3a6cff,null))[_0x40dc('0x21')](respondWithResult(_0x3a6cff,null))['catch'](handleError(_0x3a6cff,null));};exports['create']=function(_0x22b934,_0x4e85ab){return db[_0x40dc('0x39')][_0x40dc('0x42')](_0x22b934['body'],{})[_0x40dc('0x21')](respondWithResult(_0x4e85ab,0xc9))[_0x40dc('0x3d')](handleError(_0x4e85ab,null));};exports[_0x40dc('0x20')]=function(_0x48c383,_0x4fa423){if(_0x48c383[_0x40dc('0x43')]['id']){delete _0x48c383[_0x40dc('0x43')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x48c383['params']['id']}})[_0x40dc('0x21')](handleEntityNotFound(_0x4fa423,null))['then'](saveUpdates(_0x48c383['body'],null))[_0x40dc('0x21')](respondWithResult(_0x4fa423,null))[_0x40dc('0x3d')](handleError(_0x4fa423,null));};exports['destroy']=function(_0x32bd88,_0x5c2e40){return db['JscriptyQuestionReport'][_0x40dc('0x44')]({'where':{'id':_0x32bd88['params']['id']}})['then'](handleEntityNotFound(_0x5c2e40,null))[_0x40dc('0x21')](removeEntity(_0x5c2e40,null))['catch'](handleError(_0x5c2e40,null));};exports[_0x40dc('0x45')]=function(_0x3fc35d,_0x104ef9){return db[_0x40dc('0x39')][_0x40dc('0x45')]()[_0x40dc('0x21')](respondWithResult(_0x104ef9,null))[_0x40dc('0x3d')](handleError(_0x104ef9,null));}; \ No newline at end of file +var _0x6b89=['error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','show','length','merge','find','catch','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','util','path','sox','lodash','squel','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x6b89,0x134));var _0x96b8=function(_0x31fec,_0x466405){_0x31fec=_0x31fec-0x0;var _0x336520=_0x6b89[_0x31fec];return _0x336520;};'use strict';var pdf=require(_0x96b8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x96b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x96b8('0x2'));var rp=require(_0x96b8('0x3'));var moment=require(_0x96b8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x96b8('0x5'));var path=require(_0x96b8('0x6'));var sox=require(_0x96b8('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x96b8('0x8'));var squel=require(_0x96b8('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x96b8('0xa'));var querystring=require(_0x96b8('0xb'));var Papa=require('papaparse');var Redis=require(_0x96b8('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x96b8('0xd'));var hardwareService=require(_0x96b8('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x96b8('0xf'));var config=require(_0x96b8('0x10'));var db=require(_0x96b8('0x11'))['db'];function respondWithStatusCode(_0x16f935,_0xab20b5){_0xab20b5=_0xab20b5||0xcc;return function(_0x56dfec){if(_0x56dfec){return _0x16f935[_0x96b8('0x12')](_0xab20b5);}return _0x16f935[_0x96b8('0x13')](_0xab20b5)['end']();};}function respondWithResult(_0xb4bb6a,_0x2d6e4c){_0x2d6e4c=_0x2d6e4c||0xc8;return function(_0x16508c){if(_0x16508c){return _0xb4bb6a['status'](_0x2d6e4c)['json'](_0x16508c);}};}function respondWithFilteredResult(_0x5ba624,_0x5a6133){return function(_0x2d13ba){if(_0x2d13ba){var _0x4e66f0=_0x2d13ba['count'],_0x502b72=_0x5a6133['offset'],_0x2bb22e=_0x5a6133[_0x96b8('0x14')]+_0x5a6133[_0x96b8('0x15')],_0x4e0613;if(_0x2bb22e>=_0x4e66f0){_0x2bb22e=_0x4e66f0;_0x4e0613=0xc8;}else{_0x4e0613=0xce;}_0x5ba624[_0x96b8('0x13')](_0x4e0613);return _0x5ba624[_0x96b8('0x16')](_0x96b8('0x17'),_0x502b72+'-'+_0x2bb22e+'/'+_0x4e66f0)[_0x96b8('0x18')](_0x2d13ba);}return null;};}function patchUpdates(_0x3fc673){return function(_0x407d91){try{jsonpatch[_0x96b8('0x19')](_0x407d91,_0x3fc673,!![]);}catch(_0x18f1a5){return BPromise[_0x96b8('0x1a')](_0x18f1a5);}return _0x407d91[_0x96b8('0x1b')]();};}function saveUpdates(_0x4bfe5f,_0x2ac0ae){return function(_0x8d1cb){if(_0x8d1cb){return _0x8d1cb[_0x96b8('0x1c')](_0x4bfe5f)[_0x96b8('0x1d')](function(_0x44f0ac){return _0x44f0ac;});}return null;};}function removeEntity(_0x2b7b76,_0x190c26){return function(_0x4bbc5a){if(_0x4bbc5a){return _0x4bbc5a[_0x96b8('0x1e')]()['then'](function(){_0x2b7b76[_0x96b8('0x13')](0xcc)[_0x96b8('0x1f')]();});}};}function handleEntityNotFound(_0x2df903,_0x1ad618){return function(_0x1f84c5){if(!_0x1f84c5){_0x2df903[_0x96b8('0x12')](0x194);}return _0x1f84c5;};}function handleError(_0x464075,_0x4cbd48){_0x4cbd48=_0x4cbd48||0x1f4;return function(_0xf00974){logger[_0x96b8('0x20')](_0xf00974[_0x96b8('0x21')]);if(_0xf00974[_0x96b8('0x22')]){delete _0xf00974[_0x96b8('0x22')];}_0x464075[_0x96b8('0x13')](_0x4cbd48)['send'](_0xf00974);};}exports[_0x96b8('0x23')]=function(_0x266a83,_0x6ae774){var _0x1b2d7b={},_0x51a6f0={},_0x107e9b={'count':0x0,'rows':[]};var _0x22cf33=_[_0x96b8('0x24')](db[_0x96b8('0x25')][_0x96b8('0x26')],function(_0x2fe470){return{'name':_0x2fe470['fieldName'],'type':_0x2fe470[_0x96b8('0x27')][_0x96b8('0x28')]};});_0x51a6f0[_0x96b8('0x29')]=_[_0x96b8('0x24')](_0x22cf33,'name');_0x51a6f0[_0x96b8('0x2a')]=_[_0x96b8('0x2b')](_0x266a83[_0x96b8('0x2a')]);_0x51a6f0[_0x96b8('0x2c')]=_[_0x96b8('0x2d')](_0x51a6f0['model'],_0x51a6f0[_0x96b8('0x2a')]);_0x1b2d7b[_0x96b8('0x2e')]=_[_0x96b8('0x2d')](_0x51a6f0[_0x96b8('0x29')],qs[_0x96b8('0x2f')](_0x266a83[_0x96b8('0x2a')][_0x96b8('0x2f')]));_0x1b2d7b[_0x96b8('0x2e')]=_0x1b2d7b[_0x96b8('0x2e')]['length']?_0x1b2d7b['attributes']:_0x51a6f0[_0x96b8('0x29')];if(!_0x266a83['query']['hasOwnProperty'](_0x96b8('0x30'))){_0x1b2d7b[_0x96b8('0x15')]=qs[_0x96b8('0x15')](_0x266a83['query'][_0x96b8('0x15')]);_0x1b2d7b[_0x96b8('0x14')]=qs[_0x96b8('0x14')](_0x266a83[_0x96b8('0x2a')][_0x96b8('0x14')]);}_0x1b2d7b['order']=qs[_0x96b8('0x31')](_0x266a83[_0x96b8('0x2a')][_0x96b8('0x31')]);_0x1b2d7b[_0x96b8('0x32')]=qs[_0x96b8('0x2c')](_[_0x96b8('0x33')](_0x266a83[_0x96b8('0x2a')],_0x51a6f0[_0x96b8('0x2c')]),_0x22cf33);if(_0x266a83[_0x96b8('0x2a')][_0x96b8('0x34')]){_0x1b2d7b['where']=_['merge'](_0x1b2d7b[_0x96b8('0x32')],{'$or':_[_0x96b8('0x24')](_0x22cf33,function(_0xe8aa2b){if(_0xe8aa2b['type']!==_0x96b8('0x35')){var _0x267380={};_0x267380[_0xe8aa2b['name']]={'$like':'%'+_0x266a83[_0x96b8('0x2a')][_0x96b8('0x34')]+'%'};return _0x267380;}})});}_0x1b2d7b=_['merge']({},_0x1b2d7b,_0x266a83[_0x96b8('0x36')]);var _0x517194={'where':_0x1b2d7b[_0x96b8('0x32')]};return db[_0x96b8('0x25')][_0x96b8('0x37')](_0x517194)[_0x96b8('0x1d')](function(_0x180e5b){_0x107e9b[_0x96b8('0x37')]=_0x180e5b;if(_0x266a83[_0x96b8('0x2a')][_0x96b8('0x38')]){_0x1b2d7b[_0x96b8('0x39')]=[{'all':!![]}];}return db[_0x96b8('0x25')][_0x96b8('0x3a')](_0x1b2d7b);})[_0x96b8('0x1d')](function(_0x2b3813){_0x107e9b[_0x96b8('0x3b')]=_0x2b3813;return _0x107e9b;})[_0x96b8('0x1d')](respondWithFilteredResult(_0x6ae774,_0x1b2d7b))['catch'](handleError(_0x6ae774,null));};exports[_0x96b8('0x3c')]=function(_0x40ad15,_0x55fd23){var _0xebc436={'raw':!![],'where':{'id':_0x40ad15['params']['id']}},_0x1d996c={};_0x1d996c['model']=_[_0x96b8('0x2b')](db[_0x96b8('0x25')]['rawAttributes']);_0x1d996c[_0x96b8('0x2a')]=_[_0x96b8('0x2b')](_0x40ad15[_0x96b8('0x2a')]);_0x1d996c[_0x96b8('0x2c')]=_[_0x96b8('0x2d')](_0x1d996c[_0x96b8('0x29')],_0x1d996c[_0x96b8('0x2a')]);_0xebc436[_0x96b8('0x2e')]=_[_0x96b8('0x2d')](_0x1d996c[_0x96b8('0x29')],qs[_0x96b8('0x2f')](_0x40ad15[_0x96b8('0x2a')][_0x96b8('0x2f')]));_0xebc436['attributes']=_0xebc436[_0x96b8('0x2e')][_0x96b8('0x3d')]?_0xebc436[_0x96b8('0x2e')]:_0x1d996c[_0x96b8('0x29')];if(_0x40ad15[_0x96b8('0x2a')][_0x96b8('0x38')]){_0xebc436['include']=[{'all':!![]}];}_0xebc436=_[_0x96b8('0x3e')]({},_0xebc436,_0x40ad15[_0x96b8('0x36')]);return db[_0x96b8('0x25')][_0x96b8('0x3f')](_0xebc436)[_0x96b8('0x1d')](handleEntityNotFound(_0x55fd23,null))[_0x96b8('0x1d')](respondWithResult(_0x55fd23,null))[_0x96b8('0x40')](handleError(_0x55fd23,null));};exports[_0x96b8('0x41')]=function(_0x2d5daf,_0x3ba808){return db['JscriptyQuestionReport'][_0x96b8('0x41')](_0x2d5daf[_0x96b8('0x42')],{})['then'](respondWithResult(_0x3ba808,0xc9))[_0x96b8('0x40')](handleError(_0x3ba808,null));};exports[_0x96b8('0x1c')]=function(_0x2e44e2,_0x1086f5){if(_0x2e44e2[_0x96b8('0x42')]['id']){delete _0x2e44e2[_0x96b8('0x42')]['id'];}return db[_0x96b8('0x25')][_0x96b8('0x3f')]({'where':{'id':_0x2e44e2['params']['id']}})['then'](handleEntityNotFound(_0x1086f5,null))[_0x96b8('0x1d')](saveUpdates(_0x2e44e2['body'],null))[_0x96b8('0x1d')](respondWithResult(_0x1086f5,null))[_0x96b8('0x40')](handleError(_0x1086f5,null));};exports[_0x96b8('0x1e')]=function(_0x541dd2,_0x1d5219){return db[_0x96b8('0x25')][_0x96b8('0x3f')]({'where':{'id':_0x541dd2['params']['id']}})['then'](handleEntityNotFound(_0x1d5219,null))['then'](removeEntity(_0x1d5219,null))[_0x96b8('0x40')](handleError(_0x1d5219,null));};exports[_0x96b8('0x43')]=function(_0x39cf86,_0x21b98a){return db[_0x96b8('0x25')][_0x96b8('0x43')]()[_0x96b8('0x1d')](respondWithResult(_0x21b98a,null))[_0x96b8('0x40')](handleError(_0x21b98a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 14ccc62..c87a34e 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 _0xf5ac=['exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5ac,0x12f));var _0xcf5a=function(_0xaabba8,_0x41f1a1){_0xaabba8=_0xaabba8-0x0;var _0x46c00c=_0xf5ac[_0xaabba8];return _0x46c00c;};'use strict';var _=require(_0xcf5a('0x0'));var util=require('util');var logger=require(_0xcf5a('0x1'))(_0xcf5a('0x2'));var moment=require(_0xcf5a('0x3'));var BPromise=require(_0xcf5a('0x4'));var rp=require(_0xcf5a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf5a('0x6'));var config=require(_0xcf5a('0x7'));var attributes=require(_0xcf5a('0x8'));module[_0xcf5a('0x9')]=function(_0x3f4040,_0x8d93f1){return _0x3f4040[_0xcf5a('0xa')](_0xcf5a('0xb'),attributes,{'tableName':_0xcf5a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10ef=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions'];(function(_0x497813,_0x2d3352){var _0x31ed39=function(_0x52d8e7){while(--_0x52d8e7){_0x497813['push'](_0x497813['shift']());}};_0x31ed39(++_0x2d3352);}(_0x10ef,0x1bc));var _0xf10e=function(_0x1699af,_0x465c4f){_0x1699af=_0x1699af-0x0;var _0x10089d=_0x10ef[_0x1699af];return _0x10089d;};'use strict';var _=require(_0xf10e('0x0'));var util=require(_0xf10e('0x1'));var logger=require(_0xf10e('0x2'))(_0xf10e('0x3'));var moment=require(_0xf10e('0x4'));var BPromise=require(_0xf10e('0x5'));var rp=require(_0xf10e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf10e('0x7'));var config=require('../../config/environment');var attributes=require(_0xf10e('0x8'));module[_0xf10e('0x9')]=function(_0x5eb009,_0x13763e){return _0x5eb009[_0xf10e('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0xf10e('0xb'),'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 3f74f53..3fc913e 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 _0xdf9b=['catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x1b1e22,_0x58d359){var _0x584652=function(_0x1c17ec){while(--_0x1c17ec){_0x1b1e22['push'](_0x1b1e22['shift']());}};_0x584652(++_0x58d359);}(_0xdf9b,0x1e5));var _0xbdf9=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xdf9b[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require('lodash');var util=require(_0xbdf9('0x0'));var moment=require('moment');var BPromise=require(_0xbdf9('0x1'));var rs=require(_0xbdf9('0x2'));var fs=require('fs');var Redis=require(_0xbdf9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbdf9('0x4'));var logger=require(_0xbdf9('0x5'))(_0xbdf9('0x6'));var config=require(_0xbdf9('0x7'));var jayson=require(_0xbdf9('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1bb540,_0x5c521c,_0x5d8c11){return new BPromise(function(_0x1f7e99,_0x1df87e){return client[_0xbdf9('0x9')](_0x1bb540,_0x5d8c11)[_0xbdf9('0xa')](function(_0x4ddedd){logger['info'](_0xbdf9('0xb'),_0x5c521c,_0xbdf9('0xc'));logger[_0xbdf9('0xd')](_0xbdf9('0xe'),_0x5c521c,'request\x20sent',JSON[_0xbdf9('0xf')](_0x4ddedd));if(_0x4ddedd[_0xbdf9('0x10')]){if(_0x4ddedd[_0xbdf9('0x10')][_0xbdf9('0x11')]===0x1f4){logger[_0xbdf9('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5c521c,_0x4ddedd[_0xbdf9('0x10')][_0xbdf9('0x12')]);return _0x1df87e(_0x4ddedd[_0xbdf9('0x10')][_0xbdf9('0x12')]);}logger[_0xbdf9('0x10')](_0xbdf9('0xb'),_0x5c521c,_0x4ddedd[_0xbdf9('0x10')][_0xbdf9('0x12')]);return _0x1f7e99(_0x4ddedd[_0xbdf9('0x10')]['message']);}else{logger[_0xbdf9('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5c521c,_0xbdf9('0xc'));_0x1f7e99(_0x4ddedd[_0xbdf9('0x14')][_0xbdf9('0x12')]);}})[_0xbdf9('0x15')](function(_0x34e31a){logger[_0xbdf9('0x10')](_0xbdf9('0xb'),_0x5c521c,_0x34e31a);_0x1df87e(_0x34e31a);});});} \ No newline at end of file +var _0x15af=['info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then'];(function(_0x4c92db,_0x3da920){var _0x4f2019=function(_0x41464b){while(--_0x41464b){_0x4c92db['push'](_0x4c92db['shift']());}};_0x4f2019(++_0x3da920);}(_0x15af,0x7d));var _0xf15a=function(_0x5b8310,_0x77ea6f){_0x5b8310=_0x5b8310-0x0;var _0xd3ebc1=_0x15af[_0x5b8310];return _0xd3ebc1;};'use strict';var _=require(_0xf15a('0x0'));var util=require(_0xf15a('0x1'));var moment=require(_0xf15a('0x2'));var BPromise=require(_0xf15a('0x3'));var rs=require(_0xf15a('0x4'));var fs=require('fs');var Redis=require(_0xf15a('0x5'));var db=require(_0xf15a('0x6'))['db'];var utils=require(_0xf15a('0x7'));var logger=require(_0xf15a('0x8'))(_0xf15a('0x9'));var config=require(_0xf15a('0xa'));var jayson=require(_0xf15a('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5401c7,_0x1ff726,_0x4e3a97){return new BPromise(function(_0x10d965,_0x141caf){return client['request'](_0x5401c7,_0x4e3a97)[_0xf15a('0xc')](function(_0x532a4f){logger[_0xf15a('0xd')](_0xf15a('0xe'),_0x1ff726,'request\x20sent');logger[_0xf15a('0xf')](_0xf15a('0x10'),_0x1ff726,'request\x20sent',JSON[_0xf15a('0x11')](_0x532a4f));if(_0x532a4f[_0xf15a('0x12')]){if(_0x532a4f[_0xf15a('0x12')][_0xf15a('0x13')]===0x1f4){logger[_0xf15a('0x12')](_0xf15a('0xe'),_0x1ff726,_0x532a4f['error'][_0xf15a('0x14')]);return _0x141caf(_0x532a4f[_0xf15a('0x12')][_0xf15a('0x14')]);}logger['error'](_0xf15a('0xe'),_0x1ff726,_0x532a4f['error'][_0xf15a('0x14')]);return _0x10d965(_0x532a4f['error']['message']);}else{logger[_0xf15a('0xd')](_0xf15a('0xe'),_0x1ff726,_0xf15a('0x15'));_0x10d965(_0x532a4f['result'][_0xf15a('0x14')]);}})[_0xf15a('0x16')](function(_0xea45e1){logger[_0xf15a('0x12')](_0xf15a('0xe'),_0x1ff726,_0xea45e1);_0x141caf(_0xea45e1);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 4132674..58ec286 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 _0xb90d=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','update','delete','destroy','util','path'];(function(_0x170201,_0x749e5c){var _0x470cea=function(_0x4ec50a){while(--_0x4ec50a){_0x170201['push'](_0x170201['shift']());}};_0x470cea(++_0x749e5c);}(_0xb90d,0x17a));var _0xdb90=function(_0x47c5bf,_0x45977e){_0x47c5bf=_0x47c5bf-0x0;var _0x11b779=_0xb90d[_0x47c5bf];return _0x11b779;};'use strict';var multer=require('multer');var util=require(_0xdb90('0x0'));var path=require(_0xdb90('0x1'));var timeout=require(_0xdb90('0x2'));var express=require(_0xdb90('0x3'));var router=express[_0xdb90('0x4')]();var auth=require(_0xdb90('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdb90('0x6'));var controller=require(_0xdb90('0x7'));router[_0xdb90('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdb90('0x8')](_0xdb90('0x9'),auth[_0xdb90('0xa')](),controller[_0xdb90('0xb')]);router['get'](_0xdb90('0xc'),auth[_0xdb90('0xa')](),controller[_0xdb90('0xd')]);router['get'](_0xdb90('0xe'),auth[_0xdb90('0xa')](),controller[_0xdb90('0xf')]);router[_0xdb90('0x10')]('/',auth[_0xdb90('0xa')](),controller['create']);router['put']('/:id',auth[_0xdb90('0xa')](),controller[_0xdb90('0x11')]);router[_0xdb90('0x12')](_0xdb90('0xc'),auth[_0xdb90('0xa')](),controller[_0xdb90('0x13')]);module['exports']=router; \ No newline at end of file +var _0xca8d=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','show','getQuestions','post','create','put','/:id','update'];(function(_0x21bcc3,_0x587f1a){var _0x137507=function(_0x326983){while(--_0x326983){_0x21bcc3['push'](_0x21bcc3['shift']());}};_0x137507(++_0x587f1a);}(_0xca8d,0x172));var _0xdca8=function(_0x317497,_0x2d6cf7){_0x317497=_0x317497-0x0;var _0x3445b0=_0xca8d[_0x317497];return _0x3445b0;};'use strict';var multer=require(_0xdca8('0x0'));var util=require(_0xdca8('0x1'));var path=require(_0xdca8('0x2'));var timeout=require(_0xdca8('0x3'));var express=require(_0xdca8('0x4'));var router=express[_0xdca8('0x5')]();var auth=require(_0xdca8('0x6'));var interaction=require(_0xdca8('0x7'));var config=require(_0xdca8('0x8'));var controller=require(_0xdca8('0x9'));router[_0xdca8('0xa')]('/',auth[_0xdca8('0xb')](),controller['index']);router[_0xdca8('0xa')](_0xdca8('0xc'),auth[_0xdca8('0xb')](),controller[_0xdca8('0xd')]);router[_0xdca8('0xa')]('/:id',auth[_0xdca8('0xb')](),controller[_0xdca8('0xe')]);router[_0xdca8('0xa')]('/:id/questions',auth[_0xdca8('0xb')](),controller[_0xdca8('0xf')]);router[_0xdca8('0x10')]('/',auth[_0xdca8('0xb')](),controller[_0xdca8('0x11')]);router[_0xdca8('0x12')](_0xdca8('0x13'),auth[_0xdca8('0xb')](),controller[_0xdca8('0x14')]);router['delete']('/:id',auth[_0xdca8('0xb')](),controller[_0xdca8('0x15')]);module[_0xdca8('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 c160a3d..53d3f7e 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 _0xf64e=['DATE','setDataValue','starttime','endtime','format','STRING','BOOLEAN','moment','sequelize'];(function(_0x44de27,_0x331359){var _0x5246de=function(_0x3dcde6){while(--_0x3dcde6){_0x44de27['push'](_0x44de27['shift']());}};_0x5246de(++_0x331359);}(_0xf64e,0x1c9));var _0xef64=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xf64e[_0x40a045];return _0x1a687c;};'use strict';var moment=require(_0xef64('0x0'));var Sequelize=require(_0xef64('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xef64('0x2')],'set':function(_0x1b2949){this[_0xef64('0x3')](_0xef64('0x4'),_0x1b2949);this[_0xef64('0x3')](_0xef64('0x5'),moment()[_0xef64('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xef64('0x2')]},'membername':{'type':Sequelize[_0xef64('0x7')]},'projectname':{'type':Sequelize[_0xef64('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xef64('0x7')]},'calleridname':{'type':Sequelize[_0xef64('0x7')]},'calleridnum':{'type':Sequelize[_0xef64('0x7')]},'completed':{'type':Sequelize[_0xef64('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x9cea=['sequelize','exports','DATE','starttime','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment'];(function(_0x3870d6,_0x505167){var _0x2f3462=function(_0x524931){while(--_0x524931){_0x3870d6['push'](_0x3870d6['shift']());}};_0x2f3462(++_0x505167);}(_0x9cea,0x135));var _0xa9ce=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x9cea[_0x487b0c];return _0x1adbdc;};'use strict';var moment=require(_0xa9ce('0x0'));var Sequelize=require(_0xa9ce('0x1'));module[_0xa9ce('0x2')]={'starttime':{'type':Sequelize[_0xa9ce('0x3')],'set':function(_0x234250){this['setDataValue'](_0xa9ce('0x4'),_0x234250);this[_0xa9ce('0x5')](_0xa9ce('0x6'),moment()[_0xa9ce('0x7')](_0xa9ce('0x8')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xa9ce('0x9')]},'projectname':{'type':Sequelize[_0xa9ce('0x9')]},'queue':{'type':Sequelize[_0xa9ce('0x9')]},'uniqueid':{'type':Sequelize[_0xa9ce('0x9')]},'calleridname':{'type':Sequelize[_0xa9ce('0x9')]},'calleridnum':{'type':Sequelize[_0xa9ce('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 924675d..ce19e39 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 _0x5d23=['merge','VIRTUAL','JscriptySessionReport','includeAll','include','rows','catch','show','params','fields','options','create','body','find','findOne','JscriptyQuestionReport','hasOwnProperty','SessionId','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','length','attributes','order','sort','pick','filters','filter','where'];(function(_0x126305,_0x263e67){var _0x1e0eea=function(_0x53865f){while(--_0x53865f){_0x126305['push'](_0x126305['shift']());}};_0x1e0eea(++_0x263e67);}(_0x5d23,0x198));var _0x35d2=function(_0x5abb5b,_0x1d56ee){_0x5abb5b=_0x5abb5b-0x0;var _0x23c6f7=_0x5d23[_0x5abb5b];return _0x23c6f7;};'use strict';var pdf=require(_0x35d2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x35d2('0x1'));var jsonpatch=require(_0x35d2('0x2'));var rp=require(_0x35d2('0x3'));var moment=require(_0x35d2('0x4'));var BPromise=require(_0x35d2('0x5'));var Mustache=require('mustache');var util=require(_0x35d2('0x6'));var path=require(_0x35d2('0x7'));var sox=require(_0x35d2('0x8'));var csv=require('to-csv');var ejs=require(_0x35d2('0x9'));var fs=require('fs');var _=require(_0x35d2('0xa'));var squel=require(_0x35d2('0xb'));var crypto=require(_0x35d2('0xc'));var jsforce=require(_0x35d2('0xd'));var deskjs=require(_0x35d2('0xe'));var toCsv=require(_0x35d2('0xf'));var querystring=require(_0x35d2('0x10'));var Papa=require(_0x35d2('0x11'));var Redis=require(_0x35d2('0x12'));var authService=require(_0x35d2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x35d2('0x14'));var hardwareService=require(_0x35d2('0x15'));var logger=require(_0x35d2('0x16'))(_0x35d2('0x17'));var utils=require('../../config/utils');var config=require(_0x35d2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa0202,_0xccef7){_0xccef7=_0xccef7||0xcc;return function(_0xf05ca3){if(_0xf05ca3){return _0xa0202[_0x35d2('0x19')](_0xccef7);}return _0xa0202[_0x35d2('0x1a')](_0xccef7)['end']();};}function respondWithResult(_0x309af7,_0x356aa9){_0x356aa9=_0x356aa9||0xc8;return function(_0x100071){if(_0x100071){return _0x309af7[_0x35d2('0x1a')](_0x356aa9)[_0x35d2('0x1b')](_0x100071);}};}function respondWithFilteredResult(_0x56f5e1,_0x1dc065){return function(_0xed8c2a){if(_0xed8c2a){var _0x455df3=_0xed8c2a[_0x35d2('0x1c')],_0xfdc5d8=_0x1dc065[_0x35d2('0x1d')],_0x40f96b=_0x1dc065[_0x35d2('0x1d')]+_0x1dc065[_0x35d2('0x1e')],_0x4fe56e;if(_0x40f96b>=_0x455df3){_0x40f96b=_0x455df3;_0x4fe56e=0xc8;}else{_0x4fe56e=0xce;}_0x56f5e1[_0x35d2('0x1a')](_0x4fe56e);return _0x56f5e1[_0x35d2('0x1f')]('Content-Range',_0xfdc5d8+'-'+_0x40f96b+'/'+_0x455df3)['json'](_0xed8c2a);}return null;};}function patchUpdates(_0x4f4a8f){return function(_0x1e4577){try{jsonpatch[_0x35d2('0x20')](_0x1e4577,_0x4f4a8f,!![]);}catch(_0x53fc60){return BPromise[_0x35d2('0x21')](_0x53fc60);}return _0x1e4577[_0x35d2('0x22')]();};}function saveUpdates(_0x539b26,_0x2cbb75){return function(_0x447401){if(_0x447401){return _0x447401[_0x35d2('0x23')](_0x539b26)['then'](function(_0x1e1f7c){return _0x1e1f7c;});}return null;};}function removeEntity(_0x1e5471,_0x5929d8){return function(_0x2e40b0){if(_0x2e40b0){return _0x2e40b0[_0x35d2('0x24')]()[_0x35d2('0x25')](function(){_0x1e5471[_0x35d2('0x1a')](0xcc)[_0x35d2('0x26')]();});}};}function handleEntityNotFound(_0x438550,_0x8def0a){return function(_0x4bec0f){if(!_0x4bec0f){_0x438550[_0x35d2('0x19')](0x194);}return _0x4bec0f;};}function handleError(_0x8d1e4e,_0x4d8045){_0x4d8045=_0x4d8045||0x1f4;return function(_0x315e8d){logger[_0x35d2('0x27')](_0x315e8d[_0x35d2('0x28')]);if(_0x315e8d[_0x35d2('0x29')]){delete _0x315e8d[_0x35d2('0x29')];}_0x8d1e4e[_0x35d2('0x1a')](_0x4d8045)['send'](_0x315e8d);};}exports[_0x35d2('0x2a')]=function(_0x425395,_0x65c0c5){var _0x3b21ee={},_0x5e7353={},_0x4d2416={'count':0x0,'rows':[]};var _0x178015=_[_0x35d2('0x2b')](db['JscriptySessionReport'][_0x35d2('0x2c')],function(_0x4ab83e){return{'name':_0x4ab83e[_0x35d2('0x2d')],'type':_0x4ab83e[_0x35d2('0x2e')][_0x35d2('0x2f')]};});_0x5e7353[_0x35d2('0x30')]=_[_0x35d2('0x2b')](_0x178015,_0x35d2('0x29'));_0x5e7353[_0x35d2('0x31')]=_[_0x35d2('0x32')](_0x425395['query']);_0x5e7353['filters']=_[_0x35d2('0x33')](_0x5e7353[_0x35d2('0x30')],_0x5e7353['query']);_0x3b21ee['attributes']=_[_0x35d2('0x33')](_0x5e7353[_0x35d2('0x30')],qs['fields'](_0x425395[_0x35d2('0x31')]['fields']));_0x3b21ee['attributes']=_0x3b21ee['attributes'][_0x35d2('0x34')]?_0x3b21ee[_0x35d2('0x35')]:_0x5e7353[_0x35d2('0x30')];if(!_0x425395[_0x35d2('0x31')]['hasOwnProperty']('nolimit')){_0x3b21ee[_0x35d2('0x1e')]=qs[_0x35d2('0x1e')](_0x425395[_0x35d2('0x31')][_0x35d2('0x1e')]);_0x3b21ee[_0x35d2('0x1d')]=qs[_0x35d2('0x1d')](_0x425395[_0x35d2('0x31')][_0x35d2('0x1d')]);}_0x3b21ee[_0x35d2('0x36')]=qs['sort'](_0x425395[_0x35d2('0x31')][_0x35d2('0x37')]);_0x3b21ee['where']=qs['filters'](_[_0x35d2('0x38')](_0x425395['query'],_0x5e7353[_0x35d2('0x39')]),_0x178015);if(_0x425395[_0x35d2('0x31')][_0x35d2('0x3a')]){_0x3b21ee[_0x35d2('0x3b')]=_[_0x35d2('0x3c')](_0x3b21ee[_0x35d2('0x3b')],{'$or':_['map'](_0x178015,function(_0x2fa1db){if(_0x2fa1db[_0x35d2('0x2e')]!==_0x35d2('0x3d')){var _0x1f8a04={};_0x1f8a04[_0x2fa1db['name']]={'$like':'%'+_0x425395[_0x35d2('0x31')]['filter']+'%'};return _0x1f8a04;}})});}_0x3b21ee=_['merge']({},_0x3b21ee,_0x425395['options']);var _0x60deb6={'where':_0x3b21ee['where']};return db[_0x35d2('0x3e')][_0x35d2('0x1c')](_0x60deb6)[_0x35d2('0x25')](function(_0x393421){_0x4d2416['count']=_0x393421;if(_0x425395[_0x35d2('0x31')][_0x35d2('0x3f')]){_0x3b21ee[_0x35d2('0x40')]=[{'all':!![]}];}return db[_0x35d2('0x3e')]['findAll'](_0x3b21ee);})[_0x35d2('0x25')](function(_0x365b44){_0x4d2416[_0x35d2('0x41')]=_0x365b44;return _0x4d2416;})[_0x35d2('0x25')](respondWithFilteredResult(_0x65c0c5,_0x3b21ee))[_0x35d2('0x42')](handleError(_0x65c0c5,null));};exports[_0x35d2('0x43')]=function(_0x1efd08,_0x110176){var _0xc38c1f={'raw':!![],'where':{'id':_0x1efd08[_0x35d2('0x44')]['id']}},_0x22d390={};_0x22d390['model']=_[_0x35d2('0x32')](db['JscriptySessionReport'][_0x35d2('0x2c')]);_0x22d390[_0x35d2('0x31')]=_['keys'](_0x1efd08['query']);_0x22d390['filters']=_[_0x35d2('0x33')](_0x22d390[_0x35d2('0x30')],_0x22d390[_0x35d2('0x31')]);_0xc38c1f[_0x35d2('0x35')]=_[_0x35d2('0x33')](_0x22d390[_0x35d2('0x30')],qs[_0x35d2('0x45')](_0x1efd08['query'][_0x35d2('0x45')]));_0xc38c1f[_0x35d2('0x35')]=_0xc38c1f[_0x35d2('0x35')][_0x35d2('0x34')]?_0xc38c1f[_0x35d2('0x35')]:_0x22d390['model'];if(_0x1efd08[_0x35d2('0x31')][_0x35d2('0x3f')]){_0xc38c1f[_0x35d2('0x40')]=[{'all':!![]}];}_0xc38c1f=_['merge']({},_0xc38c1f,_0x1efd08[_0x35d2('0x46')]);return db[_0x35d2('0x3e')]['find'](_0xc38c1f)['then'](handleEntityNotFound(_0x110176,null))['then'](respondWithResult(_0x110176,null))[_0x35d2('0x42')](handleError(_0x110176,null));};exports[_0x35d2('0x47')]=function(_0x1977cf,_0x35e715){return db[_0x35d2('0x3e')][_0x35d2('0x47')](_0x1977cf[_0x35d2('0x48')],{})['then'](respondWithResult(_0x35e715,0xc9))[_0x35d2('0x42')](handleError(_0x35e715,null));};exports['update']=function(_0x4cce26,_0x545d60){if(_0x4cce26[_0x35d2('0x48')]['id']){delete _0x4cce26[_0x35d2('0x48')]['id'];}return db[_0x35d2('0x3e')][_0x35d2('0x49')]({'where':{'id':_0x4cce26[_0x35d2('0x44')]['id']}})[_0x35d2('0x25')](handleEntityNotFound(_0x545d60,null))[_0x35d2('0x25')](saveUpdates(_0x4cce26[_0x35d2('0x48')],null))[_0x35d2('0x25')](respondWithResult(_0x545d60,null))[_0x35d2('0x42')](handleError(_0x545d60,null));};exports[_0x35d2('0x24')]=function(_0x47fee2,_0x2f3689){return db[_0x35d2('0x3e')][_0x35d2('0x49')]({'where':{'id':_0x47fee2[_0x35d2('0x44')]['id']}})[_0x35d2('0x25')](handleEntityNotFound(_0x2f3689,null))[_0x35d2('0x25')](removeEntity(_0x2f3689,null))[_0x35d2('0x42')](handleError(_0x2f3689,null));};exports['describe']=function(_0x4d4168,_0x3f6e30){return db[_0x35d2('0x3e')]['describe']()[_0x35d2('0x25')](respondWithResult(_0x3f6e30,null))[_0x35d2('0x42')](handleError(_0x3f6e30,null));};exports['getQuestions']=function(_0x144574,_0xd50546,_0x4326e4){var _0x32be6e={'raw':!![],'where':{}};var _0x2d957e={};var _0x382fc8={'count':0x0,'rows':[]};return db[_0x35d2('0x3e')][_0x35d2('0x4a')]({'where':{'id':_0x144574[_0x35d2('0x44')]['id']}})[_0x35d2('0x25')](handleEntityNotFound(_0xd50546,null))[_0x35d2('0x25')](function(_0x34c958){if(_0x34c958){_0x2d957e['model']=_[_0x35d2('0x32')](db[_0x35d2('0x4b')][_0x35d2('0x2c')]);_0x2d957e[_0x35d2('0x31')]=_[_0x35d2('0x32')](_0x144574[_0x35d2('0x31')]);_0x2d957e[_0x35d2('0x39')]=_['intersection'](_0x2d957e[_0x35d2('0x30')],_0x2d957e[_0x35d2('0x31')]);_0x32be6e[_0x35d2('0x35')]=_[_0x35d2('0x33')](_0x2d957e[_0x35d2('0x30')],qs[_0x35d2('0x45')](_0x144574[_0x35d2('0x31')][_0x35d2('0x45')]));_0x32be6e['attributes']=_0x32be6e[_0x35d2('0x35')][_0x35d2('0x34')]?_0x32be6e['attributes']:_0x2d957e['model'];if(!_0x144574[_0x35d2('0x31')][_0x35d2('0x4c')]('nolimit')){_0x32be6e[_0x35d2('0x1e')]=qs[_0x35d2('0x1e')](_0x144574[_0x35d2('0x31')]['limit']);_0x32be6e[_0x35d2('0x1d')]=qs[_0x35d2('0x1d')](_0x144574[_0x35d2('0x31')]['offset']);}_0x32be6e[_0x35d2('0x36')]=qs[_0x35d2('0x37')](_0x144574[_0x35d2('0x31')][_0x35d2('0x37')]);_0x32be6e[_0x35d2('0x3b')]=qs[_0x35d2('0x39')](_[_0x35d2('0x38')](_0x144574[_0x35d2('0x31')],_0x2d957e[_0x35d2('0x39')]));_0x32be6e[_0x35d2('0x3b')][_0x35d2('0x4d')]=_0x34c958['id'];if(_0x144574[_0x35d2('0x31')]['filter']){_0x32be6e[_0x35d2('0x3b')]=_[_0x35d2('0x3c')](_0x32be6e[_0x35d2('0x3b')],{'$or':_[_0x35d2('0x2b')](_0x32be6e[_0x35d2('0x35')],function(_0x36f3e4){var _0x130a6a={};_0x130a6a[_0x36f3e4]={'$like':'%'+_0x144574[_0x35d2('0x31')]['filter']+'%'};return _0x130a6a;})});}_0x32be6e=_[_0x35d2('0x3c')]({},_0x32be6e,_0x144574['options']);return db[_0x35d2('0x4b')][_0x35d2('0x1c')]({'where':_0x32be6e['where']})['then'](function(_0x1698c0){_0x382fc8[_0x35d2('0x1c')]=_0x1698c0;if(_0x144574[_0x35d2('0x31')][_0x35d2('0x3f')]){_0x32be6e[_0x35d2('0x40')]=[{'all':!![]}];}return db[_0x35d2('0x4b')]['findAll'](_0x32be6e);})[_0x35d2('0x25')](function(_0xfd037e){_0x382fc8['rows']=_0xfd037e;return _0x382fc8;});}})[_0x35d2('0x25')](respondWithFilteredResult(_0xd50546,_0x32be6e))[_0x35d2('0x42')](handleError(_0xd50546,null));}; \ No newline at end of file +var _0xe82e=['find','create','body','update','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','end','json','offset','limit','set','Content-Range','apply','save','then','destroy','status','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','catch','params','length'];(function(_0x52b5f6,_0x334368){var _0x250383=function(_0x298738){while(--_0x298738){_0x52b5f6['push'](_0x52b5f6['shift']());}};_0x250383(++_0x334368);}(_0xe82e,0x9f));var _0xee82=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xe82e[_0x164eca];return _0x2ce562;};'use strict';var pdf=require(_0xee82('0x0'));var emlformat=require(_0xee82('0x1'));var rimraf=require(_0xee82('0x2'));var zipdir=require(_0xee82('0x3'));var jsonpatch=require(_0xee82('0x4'));var rp=require('request-promise');var moment=require(_0xee82('0x5'));var BPromise=require(_0xee82('0x6'));var Mustache=require(_0xee82('0x7'));var util=require(_0xee82('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xee82('0x9'));var squel=require('squel');var crypto=require(_0xee82('0xa'));var jsforce=require(_0xee82('0xb'));var deskjs=require(_0xee82('0xc'));var toCsv=require('to-csv');var querystring=require(_0xee82('0xd'));var Papa=require('papaparse');var Redis=require(_0xee82('0xe'));var authService=require(_0xee82('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xee82('0x10'));var hardwareService=require(_0xee82('0x11'));var logger=require(_0xee82('0x12'))('api');var utils=require(_0xee82('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e28eb,_0xb16541){_0xb16541=_0xb16541||0xcc;return function(_0x1f2794){if(_0x1f2794){return _0x2e28eb[_0xee82('0x14')](_0xb16541);}return _0x2e28eb['status'](_0xb16541)[_0xee82('0x15')]();};}function respondWithResult(_0x406f23,_0x1177a7){_0x1177a7=_0x1177a7||0xc8;return function(_0x2c25f3){if(_0x2c25f3){return _0x406f23['status'](_0x1177a7)[_0xee82('0x16')](_0x2c25f3);}};}function respondWithFilteredResult(_0xf1048d,_0x46a108){return function(_0x11d016){if(_0x11d016){var _0x393886=_0x11d016['count'],_0x24da68=_0x46a108[_0xee82('0x17')],_0x388f62=_0x46a108[_0xee82('0x17')]+_0x46a108[_0xee82('0x18')],_0x478f91;if(_0x388f62>=_0x393886){_0x388f62=_0x393886;_0x478f91=0xc8;}else{_0x478f91=0xce;}_0xf1048d['status'](_0x478f91);return _0xf1048d[_0xee82('0x19')](_0xee82('0x1a'),_0x24da68+'-'+_0x388f62+'/'+_0x393886)[_0xee82('0x16')](_0x11d016);}return null;};}function patchUpdates(_0x9d1edb){return function(_0x5b95f0){try{jsonpatch[_0xee82('0x1b')](_0x5b95f0,_0x9d1edb,!![]);}catch(_0x3f980f){return BPromise['reject'](_0x3f980f);}return _0x5b95f0[_0xee82('0x1c')]();};}function saveUpdates(_0x200f16,_0x339268){return function(_0x5da258){if(_0x5da258){return _0x5da258['update'](_0x200f16)[_0xee82('0x1d')](function(_0x28c8ed){return _0x28c8ed;});}return null;};}function removeEntity(_0x284552,_0x30adf7){return function(_0x27b81e){if(_0x27b81e){return _0x27b81e[_0xee82('0x1e')]()[_0xee82('0x1d')](function(){_0x284552[_0xee82('0x1f')](0xcc)[_0xee82('0x15')]();});}};}function handleEntityNotFound(_0x9eb8c4,_0x29e19f){return function(_0x501e20){if(!_0x501e20){_0x9eb8c4[_0xee82('0x14')](0x194);}return _0x501e20;};}function handleError(_0x221a7f,_0x2dde63){_0x2dde63=_0x2dde63||0x1f4;return function(_0x3d6eac){logger[_0xee82('0x20')](_0x3d6eac[_0xee82('0x21')]);if(_0x3d6eac[_0xee82('0x22')]){delete _0x3d6eac[_0xee82('0x22')];}_0x221a7f[_0xee82('0x1f')](_0x2dde63)[_0xee82('0x23')](_0x3d6eac);};}exports[_0xee82('0x24')]=function(_0x35ac72,_0x2e1df3){var _0x167c11={},_0xceda07={},_0x230f09={'count':0x0,'rows':[]};var _0x2fa716=_[_0xee82('0x25')](db[_0xee82('0x26')][_0xee82('0x27')],function(_0x403800){return{'name':_0x403800[_0xee82('0x28')],'type':_0x403800[_0xee82('0x29')][_0xee82('0x2a')]};});_0xceda07['model']=_[_0xee82('0x25')](_0x2fa716,_0xee82('0x22'));_0xceda07[_0xee82('0x2b')]=_[_0xee82('0x2c')](_0x35ac72[_0xee82('0x2b')]);_0xceda07[_0xee82('0x2d')]=_[_0xee82('0x2e')](_0xceda07[_0xee82('0x2f')],_0xceda07[_0xee82('0x2b')]);_0x167c11['attributes']=_['intersection'](_0xceda07[_0xee82('0x2f')],qs[_0xee82('0x30')](_0x35ac72[_0xee82('0x2b')][_0xee82('0x30')]));_0x167c11['attributes']=_0x167c11[_0xee82('0x31')]['length']?_0x167c11[_0xee82('0x31')]:_0xceda07[_0xee82('0x2f')];if(!_0x35ac72[_0xee82('0x2b')][_0xee82('0x32')](_0xee82('0x33'))){_0x167c11[_0xee82('0x18')]=qs[_0xee82('0x18')](_0x35ac72[_0xee82('0x2b')][_0xee82('0x18')]);_0x167c11[_0xee82('0x17')]=qs['offset'](_0x35ac72[_0xee82('0x2b')][_0xee82('0x17')]);}_0x167c11[_0xee82('0x34')]=qs[_0xee82('0x35')](_0x35ac72['query'][_0xee82('0x35')]);_0x167c11['where']=qs[_0xee82('0x2d')](_[_0xee82('0x36')](_0x35ac72['query'],_0xceda07[_0xee82('0x2d')]),_0x2fa716);if(_0x35ac72[_0xee82('0x2b')][_0xee82('0x37')]){_0x167c11[_0xee82('0x38')]=_[_0xee82('0x39')](_0x167c11[_0xee82('0x38')],{'$or':_['map'](_0x2fa716,function(_0x3d1515){if(_0x3d1515[_0xee82('0x29')]!==_0xee82('0x3a')){var _0x25ce77={};_0x25ce77[_0x3d1515[_0xee82('0x22')]]={'$like':'%'+_0x35ac72[_0xee82('0x2b')][_0xee82('0x37')]+'%'};return _0x25ce77;}})});}_0x167c11=_['merge']({},_0x167c11,_0x35ac72[_0xee82('0x3b')]);var _0x519211={'where':_0x167c11[_0xee82('0x38')]};return db[_0xee82('0x26')][_0xee82('0x3c')](_0x519211)[_0xee82('0x1d')](function(_0x32e124){_0x230f09['count']=_0x32e124;if(_0x35ac72[_0xee82('0x2b')][_0xee82('0x3d')]){_0x167c11['include']=[{'all':!![]}];}return db[_0xee82('0x26')][_0xee82('0x3e')](_0x167c11);})[_0xee82('0x1d')](function(_0xc566f1){_0x230f09['rows']=_0xc566f1;return _0x230f09;})[_0xee82('0x1d')](respondWithFilteredResult(_0x2e1df3,_0x167c11))[_0xee82('0x3f')](handleError(_0x2e1df3,null));};exports['show']=function(_0x487a62,_0x115b18){var _0x51cd33={'raw':!![],'where':{'id':_0x487a62[_0xee82('0x40')]['id']}},_0xb2af50={};_0xb2af50[_0xee82('0x2f')]=_[_0xee82('0x2c')](db[_0xee82('0x26')][_0xee82('0x27')]);_0xb2af50[_0xee82('0x2b')]=_[_0xee82('0x2c')](_0x487a62['query']);_0xb2af50[_0xee82('0x2d')]=_[_0xee82('0x2e')](_0xb2af50[_0xee82('0x2f')],_0xb2af50[_0xee82('0x2b')]);_0x51cd33[_0xee82('0x31')]=_[_0xee82('0x2e')](_0xb2af50[_0xee82('0x2f')],qs[_0xee82('0x30')](_0x487a62[_0xee82('0x2b')][_0xee82('0x30')]));_0x51cd33[_0xee82('0x31')]=_0x51cd33[_0xee82('0x31')][_0xee82('0x41')]?_0x51cd33[_0xee82('0x31')]:_0xb2af50[_0xee82('0x2f')];if(_0x487a62[_0xee82('0x2b')][_0xee82('0x3d')]){_0x51cd33['include']=[{'all':!![]}];}_0x51cd33=_[_0xee82('0x39')]({},_0x51cd33,_0x487a62['options']);return db[_0xee82('0x26')][_0xee82('0x42')](_0x51cd33)[_0xee82('0x1d')](handleEntityNotFound(_0x115b18,null))['then'](respondWithResult(_0x115b18,null))[_0xee82('0x3f')](handleError(_0x115b18,null));};exports[_0xee82('0x43')]=function(_0x28fbb4,_0x535e0c){return db[_0xee82('0x26')][_0xee82('0x43')](_0x28fbb4[_0xee82('0x44')],{})[_0xee82('0x1d')](respondWithResult(_0x535e0c,0xc9))[_0xee82('0x3f')](handleError(_0x535e0c,null));};exports[_0xee82('0x45')]=function(_0x25e66c,_0x5586c8){if(_0x25e66c[_0xee82('0x44')]['id']){delete _0x25e66c[_0xee82('0x44')]['id'];}return db[_0xee82('0x26')][_0xee82('0x42')]({'where':{'id':_0x25e66c[_0xee82('0x40')]['id']}})[_0xee82('0x1d')](handleEntityNotFound(_0x5586c8,null))[_0xee82('0x1d')](saveUpdates(_0x25e66c[_0xee82('0x44')],null))[_0xee82('0x1d')](respondWithResult(_0x5586c8,null))[_0xee82('0x3f')](handleError(_0x5586c8,null));};exports[_0xee82('0x1e')]=function(_0xaff9a,_0x172496){return db[_0xee82('0x26')]['find']({'where':{'id':_0xaff9a['params']['id']}})[_0xee82('0x1d')](handleEntityNotFound(_0x172496,null))[_0xee82('0x1d')](removeEntity(_0x172496,null))[_0xee82('0x3f')](handleError(_0x172496,null));};exports['describe']=function(_0x44c654,_0xed79f6){return db[_0xee82('0x26')][_0xee82('0x46')]()[_0xee82('0x1d')](respondWithResult(_0xed79f6,null))[_0xee82('0x3f')](handleError(_0xed79f6,null));};exports[_0xee82('0x47')]=function(_0x313ade,_0x509b14,_0x3d8093){var _0x4a8765={'raw':!![],'where':{}};var _0x51b3f4={};var _0x5a2807={'count':0x0,'rows':[]};return db[_0xee82('0x26')][_0xee82('0x48')]({'where':{'id':_0x313ade['params']['id']}})[_0xee82('0x1d')](handleEntityNotFound(_0x509b14,null))[_0xee82('0x1d')](function(_0x249618){if(_0x249618){_0x51b3f4['model']=_[_0xee82('0x2c')](db[_0xee82('0x49')][_0xee82('0x27')]);_0x51b3f4['query']=_['keys'](_0x313ade[_0xee82('0x2b')]);_0x51b3f4['filters']=_[_0xee82('0x2e')](_0x51b3f4[_0xee82('0x2f')],_0x51b3f4[_0xee82('0x2b')]);_0x4a8765[_0xee82('0x31')]=_[_0xee82('0x2e')](_0x51b3f4[_0xee82('0x2f')],qs[_0xee82('0x30')](_0x313ade[_0xee82('0x2b')][_0xee82('0x30')]));_0x4a8765[_0xee82('0x31')]=_0x4a8765[_0xee82('0x31')][_0xee82('0x41')]?_0x4a8765[_0xee82('0x31')]:_0x51b3f4[_0xee82('0x2f')];if(!_0x313ade[_0xee82('0x2b')]['hasOwnProperty']('nolimit')){_0x4a8765[_0xee82('0x18')]=qs[_0xee82('0x18')](_0x313ade[_0xee82('0x2b')][_0xee82('0x18')]);_0x4a8765[_0xee82('0x17')]=qs['offset'](_0x313ade[_0xee82('0x2b')][_0xee82('0x17')]);}_0x4a8765['order']=qs['sort'](_0x313ade[_0xee82('0x2b')][_0xee82('0x35')]);_0x4a8765[_0xee82('0x38')]=qs[_0xee82('0x2d')](_[_0xee82('0x36')](_0x313ade[_0xee82('0x2b')],_0x51b3f4[_0xee82('0x2d')]));_0x4a8765[_0xee82('0x38')][_0xee82('0x4a')]=_0x249618['id'];if(_0x313ade[_0xee82('0x2b')][_0xee82('0x37')]){_0x4a8765['where']=_[_0xee82('0x39')](_0x4a8765[_0xee82('0x38')],{'$or':_[_0xee82('0x25')](_0x4a8765['attributes'],function(_0x496a55){var _0x115d76={};_0x115d76[_0x496a55]={'$like':'%'+_0x313ade[_0xee82('0x2b')]['filter']+'%'};return _0x115d76;})});}_0x4a8765=_[_0xee82('0x39')]({},_0x4a8765,_0x313ade[_0xee82('0x3b')]);return db[_0xee82('0x49')][_0xee82('0x3c')]({'where':_0x4a8765[_0xee82('0x38')]})[_0xee82('0x1d')](function(_0x379e9b){_0x5a2807[_0xee82('0x3c')]=_0x379e9b;if(_0x313ade['query']['includeAll']){_0x4a8765['include']=[{'all':!![]}];}return db[_0xee82('0x49')][_0xee82('0x3e')](_0x4a8765);})[_0xee82('0x1d')](function(_0x10f871){_0x5a2807['rows']=_0x10f871;return _0x5a2807;});}})['then'](respondWithFilteredResult(_0x509b14,_0x4a8765))[_0xee82('0x3f')](handleError(_0x509b14,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 7c2961a..a4a1ee0 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 _0x71a3=['bluebird','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment'];(function(_0x4cf6fe,_0x328c3d){var _0x1544b9=function(_0x2fe888){while(--_0x2fe888){_0x4cf6fe['push'](_0x4cf6fe['shift']());}};_0x1544b9(++_0x328c3d);}(_0x71a3,0x6b));var _0x371a=function(_0x259b9f,_0x22dda9){_0x259b9f=_0x259b9f-0x0;var _0x280d13=_0x71a3[_0x259b9f];return _0x280d13;};'use strict';var _=require(_0x371a('0x0'));var util=require(_0x371a('0x1'));var logger=require(_0x371a('0x2'))(_0x371a('0x3'));var moment=require(_0x371a('0x4'));var BPromise=require(_0x371a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x371a('0x6'));var rimraf=require(_0x371a('0x7'));var config=require(_0x371a('0x8'));var attributes=require(_0x371a('0x9'));module[_0x371a('0xa')]=function(_0x2eec71,_0x141969){return _0x2eec71[_0x371a('0xb')](_0x371a('0xc'),attributes,{'tableName':_0x371a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2406=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports'];(function(_0x3723a0,_0x53924c){var _0x366390=function(_0x384834){while(--_0x384834){_0x3723a0['push'](_0x3723a0['shift']());}};_0x366390(++_0x53924c);}(_0x2406,0x1a7));var _0x6240=function(_0x57c55f,_0x5f36c0){_0x57c55f=_0x57c55f-0x0;var _0x4e49cf=_0x2406[_0x57c55f];return _0x4e49cf;};'use strict';var _=require(_0x6240('0x0'));var util=require(_0x6240('0x1'));var logger=require('../../config/logger')(_0x6240('0x2'));var moment=require('moment');var BPromise=require(_0x6240('0x3'));var rp=require(_0x6240('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6240('0x5'));var config=require(_0x6240('0x6'));var attributes=require(_0x6240('0x7'));module[_0x6240('0x8')]=function(_0x365056,_0xf6571e){return _0x365056[_0x6240('0x9')](_0x6240('0xa'),attributes,{'tableName':_0x6240('0xb'),'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 e1db082..4ff8d85 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 _0x45b6=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x5efdc0,_0x2f7a64){var _0x377ab5=function(_0x3aa1ec){while(--_0x3aa1ec){_0x5efdc0['push'](_0x5efdc0['shift']());}};_0x377ab5(++_0x2f7a64);}(_0x45b6,0xf3));var _0x645b=function(_0x499009,_0x76d2c){_0x499009=_0x499009-0x0;var _0x413967=_0x45b6[_0x499009];return _0x413967;};'use strict';var _=require(_0x645b('0x0'));var util=require(_0x645b('0x1'));var moment=require(_0x645b('0x2'));var BPromise=require(_0x645b('0x3'));var rs=require(_0x645b('0x4'));var fs=require('fs');var Redis=require(_0x645b('0x5'));var db=require(_0x645b('0x6'))['db'];var utils=require(_0x645b('0x7'));var logger=require(_0x645b('0x8'))(_0x645b('0x9'));var config=require(_0x645b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x645b('0xb')][_0x645b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41d652,_0x51b2fa,_0x233df7){return new BPromise(function(_0x31bdce,_0x5d6e80){return client[_0x645b('0xd')](_0x41d652,_0x233df7)[_0x645b('0xe')](function(_0x30522d){logger[_0x645b('0xf')](_0x645b('0x10'),_0x51b2fa,_0x645b('0x11'));logger[_0x645b('0x12')](_0x645b('0x13'),_0x51b2fa,_0x645b('0x11'),JSON[_0x645b('0x14')](_0x30522d));if(_0x30522d[_0x645b('0x15')]){if(_0x30522d[_0x645b('0x15')][_0x645b('0x16')]===0x1f4){logger[_0x645b('0x15')](_0x645b('0x10'),_0x51b2fa,_0x30522d[_0x645b('0x15')][_0x645b('0x17')]);return _0x5d6e80(_0x30522d[_0x645b('0x15')][_0x645b('0x17')]);}logger['error'](_0x645b('0x10'),_0x51b2fa,_0x30522d[_0x645b('0x15')]['message']);return _0x31bdce(_0x30522d[_0x645b('0x15')][_0x645b('0x17')]);}else{logger[_0x645b('0xf')](_0x645b('0x10'),_0x51b2fa,'request\x20sent');_0x31bdce(_0x30522d[_0x645b('0x18')][_0x645b('0x17')]);}})[_0x645b('0x19')](function(_0x4638ea){logger[_0x645b('0x15')]('JscriptySessionReport,\x20%s,\x20%s',_0x51b2fa,_0x4638ea);_0x5d6e80(_0x4638ea);});});} \ No newline at end of file +var _0xe62f=['JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then'];(function(_0x37596a,_0xeaf59b){var _0x40228a=function(_0x101746){while(--_0x101746){_0x37596a['push'](_0x37596a['shift']());}};_0x40228a(++_0xeaf59b);}(_0xe62f,0xc5));var _0xfe62=function(_0x1899b0,_0xac9c3f){_0x1899b0=_0x1899b0-0x0;var _0x3a6e08=_0xe62f[_0x1899b0];return _0x3a6e08;};'use strict';var _=require(_0xfe62('0x0'));var util=require(_0xfe62('0x1'));var moment=require(_0xfe62('0x2'));var BPromise=require(_0xfe62('0x3'));var rs=require(_0xfe62('0x4'));var fs=require('fs');var Redis=require(_0xfe62('0x5'));var db=require(_0xfe62('0x6'))['db'];var utils=require(_0xfe62('0x7'));var logger=require(_0xfe62('0x8'))(_0xfe62('0x9'));var config=require('../../config/environment');var jayson=require(_0xfe62('0xa'));var client=jayson['client'][_0xfe62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c75c6,_0x454224,_0x4dd064){return new BPromise(function(_0x3daf70,_0xac3e49){return client['request'](_0x1c75c6,_0x4dd064)[_0xfe62('0xc')](function(_0x49b8db){logger['info'](_0xfe62('0xd'),_0x454224,_0xfe62('0xe'));logger['debug'](_0xfe62('0xf'),_0x454224,_0xfe62('0xe'),JSON[_0xfe62('0x10')](_0x49b8db));if(_0x49b8db[_0xfe62('0x11')]){if(_0x49b8db[_0xfe62('0x11')][_0xfe62('0x12')]===0x1f4){logger[_0xfe62('0x11')](_0xfe62('0xd'),_0x454224,_0x49b8db[_0xfe62('0x11')][_0xfe62('0x13')]);return _0xac3e49(_0x49b8db['error'][_0xfe62('0x13')]);}logger[_0xfe62('0x11')](_0xfe62('0xd'),_0x454224,_0x49b8db['error'][_0xfe62('0x13')]);return _0x3daf70(_0x49b8db[_0xfe62('0x11')][_0xfe62('0x13')]);}else{logger[_0xfe62('0x14')](_0xfe62('0xd'),_0x454224,_0xfe62('0xe'));_0x3daf70(_0x49b8db['result'][_0xfe62('0x13')]);}})['catch'](function(_0x9ad72c){logger[_0xfe62('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x454224,_0x9ad72c);_0xac3e49(_0x9ad72c);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 6957414..bdab5ee 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 _0x1665=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','exports','path','connect-timeout'];(function(_0x57782a,_0x30e0a6){var _0x124418=function(_0x554095){while(--_0x554095){_0x57782a['push'](_0x57782a['shift']());}};_0x124418(++_0x30e0a6);}(_0x1665,0x11c));var _0x5166=function(_0x5d68ba,_0x33be44){_0x5d68ba=_0x5d68ba-0x0;var _0x17cee3=_0x1665[_0x5d68ba];return _0x17cee3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5166('0x0'));var timeout=require(_0x5166('0x1'));var express=require(_0x5166('0x2'));var router=express['Router']();var auth=require(_0x5166('0x3'));var interaction=require(_0x5166('0x4'));var config=require(_0x5166('0x5'));var controller=require(_0x5166('0x6'));router[_0x5166('0x7')]('/',controller[_0x5166('0x8')]);router[_0x5166('0x9')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x5166('0xa')]=router; \ No newline at end of file +var _0xf877=['connect-timeout','express','Router','../../components/interaction/service','get','put','isAuthenticated','update','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf877,0x165));var _0x7f87=function(_0x3038e1,_0x173e70){_0x3038e1=_0x3038e1-0x0;var _0x1dba97=_0xf877[_0x3038e1];return _0x1dba97;};'use strict';var multer=require(_0x7f87('0x0'));var util=require(_0x7f87('0x1'));var path=require(_0x7f87('0x2'));var timeout=require(_0x7f87('0x3'));var express=require(_0x7f87('0x4'));var router=express[_0x7f87('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7f87('0x6'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0x7f87('0x7')]('/',controller['index']);router[_0x7f87('0x8')]('/:id',auth[_0x7f87('0x9')](),controller[_0x7f87('0xa')]);module[_0x7f87('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 92da2d7..0b509b2 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 _0x46ed=['sequelize','exports','STRING','INTEGER'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0x46ed,0x168));var _0xd46e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x46ed[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xd46e('0x2')]},'data2':{'type':Sequelize[_0xd46e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xd46e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','INTEGER'];(function(_0x18df9d,_0x5bd89b){var _0x234e39=function(_0x2d6322){while(--_0x2d6322){_0x18df9d['push'](_0x18df9d['shift']());}};_0x234e39(++_0x5bd89b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x5fc3[_0x4a7631];return _0x1a5a6f;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x35fc('0x2')]},'data2':{'type':Sequelize[_0x35fc('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x35fc('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 61ebfd5..aa94735 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 _0x40a0=['count','offset','set','Content-Range','json','apply','reject','then','error','stack','name','send','../../config/license/util','index','keys','License','query','filters','intersection','attributes','model','fields','length','merge','options','catch','update','body','find','params','checkLicense','demo','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','end','status'];(function(_0x3822cc,_0xee35cd){var _0x374962=function(_0x5df436){while(--_0x5df436){_0x3822cc['push'](_0x3822cc['shift']());}};_0x374962(++_0xee35cd);}(_0x40a0,0x1f4));var _0x040a=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0x40a0[_0x1deb72];return _0x18bbdf;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x040a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x040a('0x1'));var util=require(_0x040a('0x2'));var path=require(_0x040a('0x3'));var sox=require(_0x040a('0x4'));var csv=require(_0x040a('0x5'));var ejs=require(_0x040a('0x6'));var fs=require('fs');var _=require(_0x040a('0x7'));var squel=require('squel');var crypto=require(_0x040a('0x8'));var jsforce=require(_0x040a('0x9'));var deskjs=require(_0x040a('0xa'));var toCsv=require(_0x040a('0x5'));var querystring=require('querystring');var Papa=require(_0x040a('0xb'));var Redis=require(_0x040a('0xc'));var authService=require(_0x040a('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x040a('0xe'));var hardwareService=require(_0x040a('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x040a('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4aa794,_0x23a9ba){_0x23a9ba=_0x23a9ba||0xcc;return function(_0x33a3ae){if(_0x33a3ae){return _0x4aa794[_0x040a('0x11')](_0x23a9ba);}return _0x4aa794['status'](_0x23a9ba)[_0x040a('0x12')]();};}function respondWithResult(_0x2230c2,_0x407628){_0x407628=_0x407628||0xc8;return function(_0x510dad){if(_0x510dad){return _0x2230c2[_0x040a('0x13')](_0x407628)['json'](_0x510dad);}};}function respondWithFilteredResult(_0x4bf833,_0x402dca){return function(_0x8b5eae){if(_0x8b5eae){var _0x2bf838=_0x8b5eae[_0x040a('0x14')],_0x4e02c8=_0x402dca[_0x040a('0x15')],_0x78bf92=_0x402dca[_0x040a('0x15')]+_0x402dca['limit'],_0x131b28;if(_0x78bf92>=_0x2bf838){_0x78bf92=_0x2bf838;_0x131b28=0xc8;}else{_0x131b28=0xce;}_0x4bf833[_0x040a('0x13')](_0x131b28);return _0x4bf833[_0x040a('0x16')](_0x040a('0x17'),_0x4e02c8+'-'+_0x78bf92+'/'+_0x2bf838)[_0x040a('0x18')](_0x8b5eae);}return null;};}function patchUpdates(_0x5b2bff){return function(_0x2a43e5){try{jsonpatch[_0x040a('0x19')](_0x2a43e5,_0x5b2bff,!![]);}catch(_0x467ae5){return BPromise[_0x040a('0x1a')](_0x467ae5);}return _0x2a43e5['save']();};}function saveUpdates(_0x3e23ab,_0x17d404){return function(_0x1b8bf9){if(_0x1b8bf9){return _0x1b8bf9['update'](_0x3e23ab)[_0x040a('0x1b')](function(_0x463d08){return _0x463d08;});}return null;};}function removeEntity(_0x3eb8a8,_0x1748f4){return function(_0x39d6a7){if(_0x39d6a7){return _0x39d6a7['destroy']()[_0x040a('0x1b')](function(){_0x3eb8a8['status'](0xcc)[_0x040a('0x12')]();});}};}function handleEntityNotFound(_0x1cc21e,_0x34de3d){return function(_0x5731aa){if(!_0x5731aa){_0x1cc21e['sendStatus'](0x194);}return _0x5731aa;};}function handleError(_0x3f65de,_0x576d7c){_0x576d7c=_0x576d7c||0x1f4;return function(_0x24669f){logger[_0x040a('0x1c')](_0x24669f[_0x040a('0x1d')]);if(_0x24669f[_0x040a('0x1e')]){delete _0x24669f[_0x040a('0x1e')];}_0x3f65de[_0x040a('0x13')](_0x576d7c)[_0x040a('0x1f')](_0x24669f);};}var utilLicense=require(_0x040a('0x20'));exports[_0x040a('0x21')]=function(_0x572c76,_0x462dc3){var _0x566b47={'raw':!![],'where':{'id':0x1}},_0x57677d={};_0x57677d['model']=_[_0x040a('0x22')](db[_0x040a('0x23')]['rawAttributes']);_0x57677d['query']=_[_0x040a('0x22')](_0x572c76[_0x040a('0x24')]);_0x57677d[_0x040a('0x25')]=_[_0x040a('0x26')](_0x57677d['model'],_0x57677d['query']);_0x566b47[_0x040a('0x27')]=_[_0x040a('0x26')](_0x57677d[_0x040a('0x28')],qs[_0x040a('0x29')](_0x572c76[_0x040a('0x24')][_0x040a('0x29')]));_0x566b47[_0x040a('0x27')]=_0x566b47[_0x040a('0x27')][_0x040a('0x2a')]?_0x566b47[_0x040a('0x27')]:_0x57677d[_0x040a('0x28')];_0x566b47=_[_0x040a('0x2b')]({},_0x566b47,_0x572c76[_0x040a('0x2c')]);return utilLicense['getLicense'](_0x566b47)[_0x040a('0x1b')](respondWithResult(_0x462dc3,null))[_0x040a('0x2d')](handleError(_0x462dc3,null));};exports[_0x040a('0x2e')]=function(_0x53270d,_0x22c184){if(_0x53270d[_0x040a('0x2f')]['id']){delete _0x53270d[_0x040a('0x2f')]['id'];}return db[_0x040a('0x23')][_0x040a('0x30')]({'where':{'id':_0x53270d[_0x040a('0x31')]['id']}})[_0x040a('0x1b')](handleEntityNotFound(_0x22c184,null))[_0x040a('0x1b')](function(_0x34f764){var _0x210070=_0x34f764['get']({'plain':!![]});return utilLicense[_0x040a('0x32')](_0x210070,_0x53270d[_0x040a('0x2f')]['key']);})[_0x040a('0x1b')](function(_0x469349){if(!_0x469349[_0x040a('0x33')]){return saveUpdates(_0x53270d[_0x040a('0x2f')],null);}return _0x469349;})[_0x040a('0x1b')](respondWithResult(_0x22c184,null))['catch'](handleError(_0x22c184,null));}; \ No newline at end of file +var _0xe923=['find','checkLicense','key','demo','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','lodash','squel','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','update','destroy','then','error','stack','name','send','../../config/license/util','index','keys','License','rawAttributes','query','filters','intersection','model','attributes','fields','merge','options','getLicense','catch','body'];(function(_0xc398fb,_0x568bd1){var _0x43076e=function(_0x2a7572){while(--_0x2a7572){_0xc398fb['push'](_0xc398fb['shift']());}};_0x43076e(++_0x568bd1);}(_0xe923,0x6e));var _0x3e92=function(_0x49ebed,_0x2ed245){_0x49ebed=_0x49ebed-0x0;var _0x247194=_0xe923[_0x49ebed];return _0x247194;};'use strict';var pdf=require(_0x3e92('0x0'));var emlformat=require(_0x3e92('0x1'));var rimraf=require(_0x3e92('0x2'));var zipdir=require(_0x3e92('0x3'));var jsonpatch=require(_0x3e92('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3e92('0x5'));var util=require(_0x3e92('0x6'));var path=require(_0x3e92('0x7'));var sox=require(_0x3e92('0x8'));var csv=require(_0x3e92('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3e92('0xa'));var squel=require(_0x3e92('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3e92('0x9'));var querystring=require('querystring');var Papa=require(_0x3e92('0xc'));var Redis=require(_0x3e92('0xd'));var authService=require(_0x3e92('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e92('0xf'));var logger=require(_0x3e92('0x10'))(_0x3e92('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x3e92('0x12'))['db'];function respondWithStatusCode(_0x2f4438,_0x3cf5fb){_0x3cf5fb=_0x3cf5fb||0xcc;return function(_0x18e3ff){if(_0x18e3ff){return _0x2f4438[_0x3e92('0x13')](_0x3cf5fb);}return _0x2f4438['status'](_0x3cf5fb)[_0x3e92('0x14')]();};}function respondWithResult(_0x10a4c7,_0x468caf){_0x468caf=_0x468caf||0xc8;return function(_0x164ea8){if(_0x164ea8){return _0x10a4c7[_0x3e92('0x15')](_0x468caf)[_0x3e92('0x16')](_0x164ea8);}};}function respondWithFilteredResult(_0x1beecc,_0x42eabb){return function(_0x222689){if(_0x222689){var _0x38b84e=_0x222689[_0x3e92('0x17')],_0x3c5e1c=_0x42eabb[_0x3e92('0x18')],_0x4471c5=_0x42eabb[_0x3e92('0x18')]+_0x42eabb['limit'],_0xb16940;if(_0x4471c5>=_0x38b84e){_0x4471c5=_0x38b84e;_0xb16940=0xc8;}else{_0xb16940=0xce;}_0x1beecc[_0x3e92('0x15')](_0xb16940);return _0x1beecc['set'](_0x3e92('0x19'),_0x3c5e1c+'-'+_0x4471c5+'/'+_0x38b84e)[_0x3e92('0x16')](_0x222689);}return null;};}function patchUpdates(_0x9fafa3){return function(_0x2ad528){try{jsonpatch['apply'](_0x2ad528,_0x9fafa3,!![]);}catch(_0x217ca4){return BPromise['reject'](_0x217ca4);}return _0x2ad528['save']();};}function saveUpdates(_0x15471c,_0x45fca3){return function(_0x5cd6b2){if(_0x5cd6b2){return _0x5cd6b2[_0x3e92('0x1a')](_0x15471c)['then'](function(_0x479dc0){return _0x479dc0;});}return null;};}function removeEntity(_0x4f6836,_0xdf124f){return function(_0x52b0d4){if(_0x52b0d4){return _0x52b0d4[_0x3e92('0x1b')]()[_0x3e92('0x1c')](function(){_0x4f6836['status'](0xcc)[_0x3e92('0x14')]();});}};}function handleEntityNotFound(_0x865919,_0x551a71){return function(_0x1d2e9e){if(!_0x1d2e9e){_0x865919['sendStatus'](0x194);}return _0x1d2e9e;};}function handleError(_0x524afc,_0x15c320){_0x15c320=_0x15c320||0x1f4;return function(_0x4591a7){logger[_0x3e92('0x1d')](_0x4591a7[_0x3e92('0x1e')]);if(_0x4591a7['name']){delete _0x4591a7[_0x3e92('0x1f')];}_0x524afc['status'](_0x15c320)[_0x3e92('0x20')](_0x4591a7);};}var utilLicense=require(_0x3e92('0x21'));exports[_0x3e92('0x22')]=function(_0x2f5899,_0x50f192){var _0x5b88ca={'raw':!![],'where':{'id':0x1}},_0xab382a={};_0xab382a['model']=_[_0x3e92('0x23')](db[_0x3e92('0x24')][_0x3e92('0x25')]);_0xab382a[_0x3e92('0x26')]=_[_0x3e92('0x23')](_0x2f5899[_0x3e92('0x26')]);_0xab382a[_0x3e92('0x27')]=_[_0x3e92('0x28')](_0xab382a[_0x3e92('0x29')],_0xab382a[_0x3e92('0x26')]);_0x5b88ca[_0x3e92('0x2a')]=_['intersection'](_0xab382a[_0x3e92('0x29')],qs['fields'](_0x2f5899['query'][_0x3e92('0x2b')]));_0x5b88ca[_0x3e92('0x2a')]=_0x5b88ca[_0x3e92('0x2a')]['length']?_0x5b88ca[_0x3e92('0x2a')]:_0xab382a[_0x3e92('0x29')];_0x5b88ca=_[_0x3e92('0x2c')]({},_0x5b88ca,_0x2f5899[_0x3e92('0x2d')]);return utilLicense[_0x3e92('0x2e')](_0x5b88ca)[_0x3e92('0x1c')](respondWithResult(_0x50f192,null))[_0x3e92('0x2f')](handleError(_0x50f192,null));};exports[_0x3e92('0x1a')]=function(_0x4dede5,_0x530702){if(_0x4dede5[_0x3e92('0x30')]['id']){delete _0x4dede5[_0x3e92('0x30')]['id'];}return db[_0x3e92('0x24')][_0x3e92('0x31')]({'where':{'id':_0x4dede5['params']['id']}})[_0x3e92('0x1c')](handleEntityNotFound(_0x530702,null))['then'](function(_0x48d21f){var _0x1a0b87=_0x48d21f['get']({'plain':!![]});return utilLicense[_0x3e92('0x32')](_0x1a0b87,_0x4dede5[_0x3e92('0x30')][_0x3e92('0x33')]);})['then'](function(_0x5b3934){if(!_0x5b3934[_0x3e92('0x34')]){return saveUpdates(_0x4dede5[_0x3e92('0x30')],null);}return _0x5b3934;})[_0x3e92('0x1c')](respondWithResult(_0x530702,null))['catch'](handleError(_0x530702,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index db024e5..5f8674d 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 _0x9abf=['util','../../config/logger','request-promise','rimraf','../../config/environment','./license.attributes','exports','License','lodash'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0x9abf,0xd7));var _0xf9ab=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9abf[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xf9ab('0x0'));var util=require(_0xf9ab('0x1'));var logger=require(_0xf9ab('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf9ab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9ab('0x4'));var config=require(_0xf9ab('0x5'));var attributes=require(_0xf9ab('0x6'));module[_0xf9ab('0x7')]=function(_0x4ee567,_0x415cc5){return _0x4ee567['define'](_0xf9ab('0x8'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfa1=['moment','bluebird','request-promise','path','./license.attributes','exports','License','license','util','../../config/logger','api'];(function(_0x470f24,_0x2436a9){var _0x2c6fc8=function(_0x3ef190){while(--_0x3ef190){_0x470f24['push'](_0x470f24['shift']());}};_0x2c6fc8(++_0x2436a9);}(_0xbfa1,0xfa));var _0x1bfa=function(_0x330808,_0x255ddd){_0x330808=_0x330808-0x0;var _0x15c446=_0xbfa1[_0x330808];return _0x15c446;};'use strict';var _=require('lodash');var util=require(_0x1bfa('0x0'));var logger=require(_0x1bfa('0x1'))(_0x1bfa('0x2'));var moment=require(_0x1bfa('0x3'));var BPromise=require(_0x1bfa('0x4'));var rp=require(_0x1bfa('0x5'));var fs=require('fs');var path=require(_0x1bfa('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1bfa('0x7'));module[_0x1bfa('0x8')]=function(_0x92e087,_0x50b924){return _0x92e087['define'](_0x1bfa('0x9'),attributes,{'tableName':_0x1bfa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 74d01bc..9c8e93b 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 _0x83e1=['ioredis','../../config/logger','rpc','http','request','info','License,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x47e332,_0x24bae2){var _0x7ed711=function(_0x25b80a){while(--_0x25b80a){_0x47e332['push'](_0x47e332['shift']());}};_0x7ed711(++_0x24bae2);}(_0x83e1,0x1ad));var _0x183e=function(_0xfbbae2,_0x119555){_0xfbbae2=_0xfbbae2-0x0;var _0x2a2543=_0x83e1[_0xfbbae2];return _0x2a2543;};'use strict';var _=require(_0x183e('0x0'));var util=require(_0x183e('0x1'));var moment=require('moment');var BPromise=require(_0x183e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x183e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x183e('0x4'))(_0x183e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x183e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xab00d2,_0x14bea7,_0x4ee4bc){return new BPromise(function(_0x8e55be,_0x15be67){return client[_0x183e('0x7')](_0xab00d2,_0x4ee4bc)['then'](function(_0x11f0e9){logger[_0x183e('0x8')](_0x183e('0x9'),_0x14bea7,'request\x20sent');logger[_0x183e('0xa')]('License,\x20%s,\x20%s,\x20%s',_0x14bea7,_0x183e('0xb'),JSON[_0x183e('0xc')](_0x11f0e9));if(_0x11f0e9[_0x183e('0xd')]){if(_0x11f0e9[_0x183e('0xd')][_0x183e('0xe')]===0x1f4){logger[_0x183e('0xd')](_0x183e('0x9'),_0x14bea7,_0x11f0e9['error']['message']);return _0x15be67(_0x11f0e9['error'][_0x183e('0xf')]);}logger[_0x183e('0xd')](_0x183e('0x9'),_0x14bea7,_0x11f0e9['error'][_0x183e('0xf')]);return _0x8e55be(_0x11f0e9[_0x183e('0xd')][_0x183e('0xf')]);}else{logger['info'](_0x183e('0x9'),_0x14bea7,_0x183e('0xb'));_0x8e55be(_0x11f0e9[_0x183e('0x10')][_0x183e('0xf')]);}})[_0x183e('0x11')](function(_0x13e5d9){logger[_0x183e('0xd')](_0x183e('0x9'),_0x14bea7,_0x13e5d9);_0x15be67(_0x13e5d9);});});} \ No newline at end of file +var _0xd3a8=['code','error','message','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s'];(function(_0x4fd824,_0x4fdd53){var _0x3299a1=function(_0x22955f){while(--_0x22955f){_0x4fd824['push'](_0x4fd824['shift']());}};_0x3299a1(++_0x4fdd53);}(_0xd3a8,0x135));var _0x8d3a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd3a8[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x8d3a('0x0'));var util=require('util');var moment=require(_0x8d3a('0x1'));var BPromise=require(_0x8d3a('0x2'));var rs=require(_0x8d3a('0x3'));var fs=require('fs');var Redis=require(_0x8d3a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d3a('0x5'));var logger=require(_0x8d3a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8d3a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x588567,_0x179258,_0x19cd3e){return new BPromise(function(_0x28b131,_0x40bc92){return client[_0x8d3a('0x8')](_0x588567,_0x19cd3e)[_0x8d3a('0x9')](function(_0x3cd3e3){logger[_0x8d3a('0xa')](_0x8d3a('0xb'),_0x179258,_0x8d3a('0xc'));logger[_0x8d3a('0xd')](_0x8d3a('0xe'),_0x179258,_0x8d3a('0xc'),JSON['stringify'](_0x3cd3e3));if(_0x3cd3e3['error']){if(_0x3cd3e3['error'][_0x8d3a('0xf')]===0x1f4){logger[_0x8d3a('0x10')](_0x8d3a('0xb'),_0x179258,_0x3cd3e3[_0x8d3a('0x10')][_0x8d3a('0x11')]);return _0x40bc92(_0x3cd3e3[_0x8d3a('0x10')]['message']);}logger[_0x8d3a('0x10')](_0x8d3a('0xb'),_0x179258,_0x3cd3e3['error']['message']);return _0x28b131(_0x3cd3e3[_0x8d3a('0x10')]['message']);}else{logger[_0x8d3a('0xa')](_0x8d3a('0xb'),_0x179258,_0x8d3a('0xc'));_0x28b131(_0x3cd3e3['result'][_0x8d3a('0x11')]);}})['catch'](function(_0x10d8af){logger['error'](_0x8d3a('0xb'),_0x179258,_0x10d8af);_0x40bc92(_0x10d8af);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index af14c17..7607126 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 _0x8b79=['addImap','addSmtp','addInteraction','/:id/send','send','put','/:id','update','delete','removeDispositions','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create'];(function(_0x3901d9,_0x58ffb2){var _0x507d4c=function(_0x423aaa){while(--_0x423aaa){_0x3901d9['push'](_0x3901d9['shift']());}};_0x507d4c(++_0x58ffb2);}(_0x8b79,0xcf));var _0x98b7=function(_0x438905,_0xe36a96){_0x438905=_0x438905-0x0;var _0x346959=_0x8b79[_0x438905];return _0x346959;};'use strict';var multer=require(_0x98b7('0x0'));var util=require(_0x98b7('0x1'));var path=require('path');var timeout=require(_0x98b7('0x2'));var express=require(_0x98b7('0x3'));var router=express[_0x98b7('0x4')]();var auth=require(_0x98b7('0x5'));var interaction=require(_0x98b7('0x6'));var config=require(_0x98b7('0x7'));var controller=require(_0x98b7('0x8'));router[_0x98b7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x98b7('0x9')](_0x98b7('0xa'),auth[_0x98b7('0xb')](),controller[_0x98b7('0xc')]);router[_0x98b7('0x9')]('/:id',auth[_0x98b7('0xb')](),controller[_0x98b7('0xd')]);router['get'](_0x98b7('0xe'),auth['isAuthenticated'](),controller[_0x98b7('0xf')]);router[_0x98b7('0x9')](_0x98b7('0x10'),auth[_0x98b7('0xb')](),controller[_0x98b7('0x11')]);router[_0x98b7('0x9')](_0x98b7('0x12'),auth[_0x98b7('0xb')](),controller[_0x98b7('0x13')]);router['get']('/:id/out_servers',auth[_0x98b7('0xb')](),controller[_0x98b7('0x14')]);router[_0x98b7('0x9')](_0x98b7('0x15'),auth[_0x98b7('0xb')](),controller[_0x98b7('0x16')]);router[_0x98b7('0x9')](_0x98b7('0x17'),auth[_0x98b7('0xb')](),controller[_0x98b7('0x18')]);router[_0x98b7('0x9')]('/:id/messages',auth[_0x98b7('0xb')](),controller[_0x98b7('0x19')]);router['get']('/:id/verify',auth[_0x98b7('0xb')](),controller[_0x98b7('0x1a')]);router[_0x98b7('0x9')](_0x98b7('0x1b'),auth[_0x98b7('0xb')](),controller[_0x98b7('0x1c')]);router[_0x98b7('0x1d')]('/:id/dispositions',auth[_0x98b7('0xb')](),controller[_0x98b7('0x1e')]);router[_0x98b7('0x1d')](_0x98b7('0x10'),auth[_0x98b7('0xb')](),controller[_0x98b7('0x1f')]);router[_0x98b7('0x1d')]('/',auth[_0x98b7('0xb')](),controller[_0x98b7('0x20')]);router['post'](_0x98b7('0x12'),auth['isAuthenticated'](),controller[_0x98b7('0x21')]);router[_0x98b7('0x1d')]('/:id/out_servers',auth[_0x98b7('0xb')](),controller[_0x98b7('0x22')]);router[_0x98b7('0x1d')](_0x98b7('0x15'),auth['isAuthenticated'](),controller[_0x98b7('0x23')]);router[_0x98b7('0x1d')](_0x98b7('0x17'),auth[_0x98b7('0xb')](),controller['addApplications']);router['post'](_0x98b7('0x24'),auth[_0x98b7('0xb')](),controller[_0x98b7('0x25')]);router[_0x98b7('0x1d')](_0x98b7('0x1b'),auth['isAuthenticated'](),controller['addAgents']);router[_0x98b7('0x26')](_0x98b7('0x27'),auth[_0x98b7('0xb')](),controller[_0x98b7('0x28')]);router[_0x98b7('0x29')](_0x98b7('0xe'),auth['isAuthenticated'](),controller[_0x98b7('0x2a')]);router[_0x98b7('0x29')](_0x98b7('0x10'),auth[_0x98b7('0xb')](),controller['removeAnswers']);router[_0x98b7('0x29')]('/:id/in_servers',auth[_0x98b7('0xb')](),controller[_0x98b7('0x2b')]);router[_0x98b7('0x29')]('/:id/out_servers',auth[_0x98b7('0xb')](),controller[_0x98b7('0x2c')]);router[_0x98b7('0x29')](_0x98b7('0x27'),auth[_0x98b7('0xb')](),controller[_0x98b7('0x2d')]);router['delete'](_0x98b7('0x1b'),auth['isAuthenticated'](),controller[_0x98b7('0x2e')]);module[_0x98b7('0x2f')]=router; \ No newline at end of file +var _0x0998=['/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addDisposition','create','/:id/in_servers','addImap','addInteraction','addApplications','/:id/send','send','update','delete','removeDispositions','removeImap','removeSmtp','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','getImap'];(function(_0x4849f6,_0x104836){var _0x1a3dcd=function(_0x494d3c){while(--_0x494d3c){_0x4849f6['push'](_0x4849f6['shift']());}};_0x1a3dcd(++_0x104836);}(_0x0998,0x1a8));var _0x8099=function(_0x253837,_0x43c6e2){_0x253837=_0x253837-0x0;var _0x280bab=_0x0998[_0x253837];return _0x280bab;};'use strict';var multer=require(_0x8099('0x0'));var util=require('util');var path=require(_0x8099('0x1'));var timeout=require(_0x8099('0x2'));var express=require('express');var router=express[_0x8099('0x3')]();var auth=require(_0x8099('0x4'));var interaction=require(_0x8099('0x5'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0x8099('0x6')]('/',auth['isAuthenticated'](),controller[_0x8099('0x7')]);router[_0x8099('0x6')](_0x8099('0x8'),auth[_0x8099('0x9')](),controller[_0x8099('0xa')]);router[_0x8099('0x6')](_0x8099('0xb'),auth[_0x8099('0x9')](),controller['show']);router[_0x8099('0x6')]('/:id/dispositions',auth[_0x8099('0x9')](),controller[_0x8099('0xc')]);router[_0x8099('0x6')](_0x8099('0xd'),auth[_0x8099('0x9')](),controller[_0x8099('0xe')]);router[_0x8099('0x6')]('/:id/in_servers',auth[_0x8099('0x9')](),controller[_0x8099('0xf')]);router[_0x8099('0x6')](_0x8099('0x10'),auth[_0x8099('0x9')](),controller[_0x8099('0x11')]);router[_0x8099('0x6')](_0x8099('0x12'),auth[_0x8099('0x9')](),controller[_0x8099('0x13')]);router[_0x8099('0x6')](_0x8099('0x14'),auth[_0x8099('0x9')](),controller['getApplications']);router[_0x8099('0x6')](_0x8099('0x15'),auth[_0x8099('0x9')](),controller[_0x8099('0x16')]);router[_0x8099('0x6')](_0x8099('0x17'),auth[_0x8099('0x9')](),controller[_0x8099('0x18')]);router[_0x8099('0x6')](_0x8099('0x19'),auth[_0x8099('0x9')](),controller[_0x8099('0x1a')]);router[_0x8099('0x1b')](_0x8099('0x1c'),auth['isAuthenticated'](),controller[_0x8099('0x1d')]);router['post'](_0x8099('0xd'),auth[_0x8099('0x9')](),controller['addAnswer']);router[_0x8099('0x1b')]('/',auth[_0x8099('0x9')](),controller[_0x8099('0x1e')]);router[_0x8099('0x1b')](_0x8099('0x1f'),auth[_0x8099('0x9')](),controller[_0x8099('0x20')]);router[_0x8099('0x1b')](_0x8099('0x10'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x8099('0x1b')](_0x8099('0x12'),auth[_0x8099('0x9')](),controller[_0x8099('0x21')]);router[_0x8099('0x1b')](_0x8099('0x14'),auth[_0x8099('0x9')](),controller[_0x8099('0x22')]);router['post'](_0x8099('0x23'),auth[_0x8099('0x9')](),controller[_0x8099('0x24')]);router[_0x8099('0x1b')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x8099('0xb'),auth[_0x8099('0x9')](),controller[_0x8099('0x25')]);router[_0x8099('0x26')](_0x8099('0x1c'),auth[_0x8099('0x9')](),controller[_0x8099('0x27')]);router[_0x8099('0x26')](_0x8099('0xd'),auth[_0x8099('0x9')](),controller['removeAnswers']);router['delete']('/:id/in_servers',auth[_0x8099('0x9')](),controller[_0x8099('0x28')]);router[_0x8099('0x26')]('/:id/out_servers',auth[_0x8099('0x9')](),controller[_0x8099('0x29')]);router[_0x8099('0x26')](_0x8099('0xb'),auth[_0x8099('0x9')](),controller['destroy']);router[_0x8099('0x26')](_0x8099('0x19'),auth[_0x8099('0x9')](),controller[_0x8099('0x2a')]);module[_0x8099('0x2b')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index bf7b8aa..685f8b8 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 _0x8004=['mandatoryDisposition','exports','STRING','BOOLEAN','TEXT','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}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x315aea,_0x318a80){var _0x4a4bdb=function(_0x7c049c){while(--_0x7c049c){_0x315aea['push'](_0x315aea['shift']());}};_0x4a4bdb(++_0x318a80);}(_0x8004,0x1bd));var _0x4800=function(_0xd4a945,_0x18a746){_0xd4a945=_0xd4a945-0x0;var _0x3bae98=_0x8004[_0xd4a945];return _0x3bae98;};'use strict';var Sequelize=require('sequelize');module[_0x4800('0x0')]={'description':{'type':Sequelize[_0x4800('0x1')]},'name':{'type':Sequelize[_0x4800('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x4800('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x4800('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x4800('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x4800('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x4800('0x1')],'allowNull':![],'defaultValue':_0x4800('0x4')},'fontSize':{'type':Sequelize[_0x4800('0x5')](0x2)[_0x4800('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x4800('0x3')],'defaultValue':function(){return _0x4800('0x7');}},'notificationSound':{'type':Sequelize[_0x4800('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4800('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4800('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4800('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4800('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4800('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4800('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4800('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4800('0x2')],'defaultValue':![],'comment':_0x4800('0x8'),'set':function(_0x32fc5f){if(!_0x32fc5f)this[_0x4800('0x9')](_0x4800('0xa'),null);this['setDataValue'](_0x4800('0xb'),_0x32fc5f);}}}; \ No newline at end of file +var _0xb16c=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0x5b3112,_0x3a346a){var _0x7696a8=function(_0x31bca2){while(--_0x31bca2){_0x5b3112['push'](_0x5b3112['shift']());}};_0x7696a8(++_0x3a346a);}(_0xb16c,0xf0));var _0xcb16=function(_0x146317,_0x3388e1){_0x146317=_0x146317-0x0;var _0x6f0e41=_0xb16c[_0x146317];return _0x6f0e41;};'use strict';var Sequelize=require(_0xcb16('0x0'));module[_0xcb16('0x1')]={'description':{'type':Sequelize[_0xcb16('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xcb16('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xcb16('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xcb16('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xcb16('0x2')],'allowNull':![],'defaultValue':_0xcb16('0x4')},'fontSize':{'type':Sequelize[_0xcb16('0x5')](0x2)[_0xcb16('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xcb16('0x7')],'defaultValue':function(){return _0xcb16('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcb16('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcb16('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcb16('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcb16('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcb16('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcb16('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcb16('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xcb16('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xcb16('0x3')],'defaultValue':![],'comment':_0xcb16('0xa'),'set':function(_0x9ccb93){if(!_0x9ccb93)this['setDataValue'](_0xcb16('0xb'),null);this['setDataValue'](_0xcb16('0xc'),_0x9ccb93);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 53a8246..02cead6 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 _0x2490=['findAndCountAll','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','auth','secure','List\x20not\x20found','messageId','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','destroy','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','error','code','MailAccount,\x20%s,\x20%s','message','result','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','get','sendStatus','send','index','MailServerIn','Imap','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','includeAll','include','rows','catch','show','params','MailServerOut','Smtp','keys','merge','options','find','body','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','findAll','removeAnswers','create','email','ListId','isNil','active','description','cservice','cauthentication','user','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','transaction','MailApplication','bulkCreate'];(function(_0x25780e,_0xdb32b1){var _0x5ad091=function(_0xff8474){while(--_0xff8474){_0x25780e['push'](_0x25780e['shift']());}};_0x5ad091(++_0xdb32b1);}(_0x2490,0xed));var _0x0249=function(_0x296188,_0x5c0906){_0x296188=_0x296188-0x0;var _0x35b9b2=_0x2490[_0x296188];return _0x35b9b2;};'use strict';var pdf=require(_0x0249('0x0'));var emlformat=require(_0x0249('0x1'));var rimraf=require(_0x0249('0x2'));var zipdir=require(_0x0249('0x3'));var jsonpatch=require(_0x0249('0x4'));var rp=require(_0x0249('0x5'));var moment=require('moment');var BPromise=require(_0x0249('0x6'));var Mustache=require(_0x0249('0x7'));var util=require(_0x0249('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x0249('0x9'));var ejs=require(_0x0249('0xa'));var fs=require('fs');var _=require(_0x0249('0xb'));var squel=require(_0x0249('0xc'));var crypto=require(_0x0249('0xd'));var jsforce=require(_0x0249('0xe'));var deskjs=require(_0x0249('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0249('0x10'));var Papa=require(_0x0249('0x11'));var Redis=require(_0x0249('0x12'));var authService=require(_0x0249('0x13'));var qs=require(_0x0249('0x14'));var as=require(_0x0249('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0249('0x16'))(_0x0249('0x17'));var utils=require(_0x0249('0x18'));var config=require(_0x0249('0x19'));var db=require(_0x0249('0x1a'))['db'];config[_0x0249('0x1b')]=_[_0x0249('0x1c')](config[_0x0249('0x1b')],{'host':_0x0249('0x1d'),'port':0x18eb});var socket=require(_0x0249('0x1e'))(new Redis(config[_0x0249('0x1b')]));require(_0x0249('0x1f'))[_0x0249('0x20')](socket);var jayson=require(_0x0249('0x21'));var client=jayson[_0x0249('0x22')][_0x0249('0x23')]({'port':0x232b});function checkPasswordPattern(_0x5ce9b1,_0x5d3477,_0xa66b4e){if(_0xa66b4e){var _0x41be54=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41be54['test'](_0x5d3477)){return _0x5ce9b1;}else{throw new db[(_0x0249('0x24'))][(_0x0249('0x25'))](_0x0249('0x26'));}}else{return _0x5ce9b1;}}function respondWithRpcPromise(_0x2ebaa2,_0x4778e0,_0x381200,_0x9e28ab){return new BPromise(function(_0x362328,_0x2ca2b4){var _0x26bff6=_0x9e28ab||client;return _0x26bff6[_0x0249('0x27')](_0x2ebaa2,_0x381200)['then'](function(_0x2976fc){logger[_0x0249('0x28')]('MailAccount,\x20%s,\x20%s',_0x4778e0,_0x0249('0x29'));logger[_0x0249('0x2a')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x4778e0,_0x0249('0x29'),JSON['stringify'](_0x2976fc));if(_0x2976fc[_0x0249('0x2b')]){if(_0x2976fc[_0x0249('0x2b')][_0x0249('0x2c')]===0x1f4){logger[_0x0249('0x2b')](_0x0249('0x2d'),_0x4778e0,_0x2976fc[_0x0249('0x2b')][_0x0249('0x2e')]);return _0x2ca2b4(_0x2976fc['error'][_0x0249('0x2e')]);}logger[_0x0249('0x2b')](_0x0249('0x2d'),_0x4778e0,_0x2976fc['error']['message']);return _0x362328(_0x2976fc[_0x0249('0x2b')][_0x0249('0x2e')]);}else{logger['info'](_0x0249('0x2d'),_0x4778e0,'request\x20sent');_0x362328(_0x2976fc[_0x0249('0x2f')]['message']);}})['catch'](function(_0xcdf297){logger['error'](_0x0249('0x2d'),_0x4778e0,_0xcdf297);_0x2ca2b4(_0xcdf297);});});}function respondWithStatusCode(_0x431d7f,_0x275ead){_0x275ead=_0x275ead||0xcc;return function(_0x14607f){if(_0x14607f){return _0x431d7f['sendStatus'](_0x275ead);}return _0x431d7f['status'](_0x275ead)[_0x0249('0x30')]();};}function respondWithResult(_0x41cd23,_0x1aa988){_0x1aa988=_0x1aa988||0xc8;return function(_0x28f97a){if(_0x28f97a){return _0x41cd23[_0x0249('0x31')](_0x1aa988)[_0x0249('0x32')](_0x28f97a);}};}function respondWithFilteredResult(_0x5d364d,_0x2eebff){return function(_0x4b0ed5){if(_0x4b0ed5){var _0x34c528=_0x4b0ed5[_0x0249('0x33')],_0x3f3237=_0x2eebff[_0x0249('0x34')],_0x30d48c=_0x2eebff['offset']+_0x2eebff['limit'],_0x40a218;if(_0x30d48c>=_0x34c528){_0x30d48c=_0x34c528;_0x40a218=0xc8;}else{_0x40a218=0xce;}_0x5d364d[_0x0249('0x31')](_0x40a218);return _0x5d364d[_0x0249('0x35')](_0x0249('0x36'),_0x3f3237+'-'+_0x30d48c+'/'+_0x34c528)[_0x0249('0x32')](_0x4b0ed5);}return null;};}function patchUpdates(_0xcb7328){return function(_0x36e8b6){try{jsonpatch[_0x0249('0x37')](_0x36e8b6,_0xcb7328,!![]);}catch(_0x15b164){return BPromise[_0x0249('0x38')](_0x15b164);}return _0x36e8b6[_0x0249('0x39')]();};}function saveUpdates(_0x5104b7,_0x3a7faf){return function(_0xf79c02){if(_0xf79c02){return _0xf79c02[_0x0249('0x3a')](_0x5104b7)[_0x0249('0x3b')](function(_0x3c773c){return _0x3c773c;});}return null;};}function removeEntity(_0x474de5,_0x3b1b05){return function(_0x298ff5){if(_0x298ff5){return _0x298ff5['destroy']()['then'](function(){var _0x345709=_0x298ff5[_0x0249('0x3c')]({'plain':!![]});var _0x2a9bc3='MailAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x2a9bc3,'resourceId':_0x345709['id']}})[_0x0249('0x3b')](function(){return _0x298ff5;});})[_0x0249('0x3b')](function(){_0x474de5['status'](0xcc)[_0x0249('0x30')]();});}};}function handleEntityNotFound(_0x376600,_0x2d3ab7){return function(_0xd8f57a){if(!_0xd8f57a){_0x376600[_0x0249('0x3d')](0x194);}return _0xd8f57a;};}function handleError(_0xa56e5a,_0x3c4af2){_0x3c4af2=_0x3c4af2||0x1f4;return function(_0x2df364){logger[_0x0249('0x2b')](_0x2df364['stack']);if(_0x2df364['name']){delete _0x2df364['name'];}_0xa56e5a[_0x0249('0x31')](_0x3c4af2)[_0x0249('0x3e')](_0x2df364);};}exports[_0x0249('0x3f')]=function(_0x6523a0,_0x5042ee){var _0x1ed5d7={'include':[{'model':db[_0x0249('0x40')],'as':_0x0249('0x41')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x0249('0x42')],'as':_0x0249('0x43')}]},_0x4e89e3={},_0x3a81fd={'count':0x0,'rows':[]};var _0x39fc04=_[_0x0249('0x44')](db[_0x0249('0x45')][_0x0249('0x46')],function(_0x4049f7){return{'name':_0x4049f7[_0x0249('0x47')],'type':_0x4049f7['type'][_0x0249('0x48')]};});_0x4e89e3['model']=_[_0x0249('0x44')](_0x39fc04,_0x0249('0x49'));_0x4e89e3[_0x0249('0x4a')]=_['keys'](_0x6523a0[_0x0249('0x4a')]);_0x4e89e3[_0x0249('0x4b')]=_[_0x0249('0x4c')](_0x4e89e3[_0x0249('0x4d')],_0x4e89e3[_0x0249('0x4a')]);_0x1ed5d7[_0x0249('0x4e')]=_['intersection'](_0x4e89e3[_0x0249('0x4d')],qs[_0x0249('0x4f')](_0x6523a0[_0x0249('0x4a')]['fields']));_0x1ed5d7[_0x0249('0x4e')]=_0x1ed5d7[_0x0249('0x4e')][_0x0249('0x50')]?_0x1ed5d7[_0x0249('0x4e')]:_0x4e89e3[_0x0249('0x4d')];if(!_0x6523a0[_0x0249('0x4a')][_0x0249('0x51')](_0x0249('0x52'))){_0x1ed5d7['limit']=qs[_0x0249('0x53')](_0x6523a0[_0x0249('0x4a')]['limit']);_0x1ed5d7[_0x0249('0x34')]=qs['offset'](_0x6523a0[_0x0249('0x4a')][_0x0249('0x34')]);}_0x1ed5d7[_0x0249('0x54')]=qs[_0x0249('0x55')](_0x6523a0[_0x0249('0x4a')][_0x0249('0x55')]);_0x1ed5d7[_0x0249('0x56')]=qs[_0x0249('0x4b')](_['pick'](_0x6523a0[_0x0249('0x4a')],_0x4e89e3[_0x0249('0x4b')]),_0x39fc04);if(_0x6523a0[_0x0249('0x4a')][_0x0249('0x57')]){_0x1ed5d7['where']=_['merge'](_0x1ed5d7[_0x0249('0x56')],{'$or':_['map'](_0x39fc04,function(_0x3ec53c){if(_0x3ec53c['type']!==_0x0249('0x58')){var _0x4ed43e={};_0x4ed43e[_0x3ec53c[_0x0249('0x49')]]={'$like':'%'+_0x6523a0[_0x0249('0x4a')][_0x0249('0x57')]+'%'};return _0x4ed43e;}})});}_0x1ed5d7=_['merge']({},_0x1ed5d7,_0x6523a0['options']);var _0x41473d={'where':_0x1ed5d7[_0x0249('0x56')]};return db[_0x0249('0x45')][_0x0249('0x33')](_0x41473d)[_0x0249('0x3b')](function(_0x23ce86){_0x3a81fd['count']=_0x23ce86;if(_0x6523a0[_0x0249('0x4a')][_0x0249('0x59')]){_0x1ed5d7[_0x0249('0x5a')]=[{'all':!![]}];}return db[_0x0249('0x45')]['findAll'](_0x1ed5d7);})['then'](function(_0xa08855){_0x3a81fd[_0x0249('0x5b')]=_0xa08855;return _0x3a81fd;})['then'](respondWithFilteredResult(_0x5042ee,_0x1ed5d7))[_0x0249('0x5c')](handleError(_0x5042ee,null));};exports[_0x0249('0x5d')]=function(_0x1d05f9,_0x4c0b49){var _0x1f12f3={'raw':![],'where':{'id':_0x1d05f9[_0x0249('0x5e')]['id']},'include':[{'model':db[_0x0249('0x40')],'as':_0x0249('0x41')},{'model':db[_0x0249('0x5f')],'as':_0x0249('0x60')},{'model':db['Pause'],'as':_0x0249('0x43')}]},_0x2af50a={};_0x2af50a[_0x0249('0x4d')]=_[_0x0249('0x61')](db[_0x0249('0x45')][_0x0249('0x46')]);_0x2af50a[_0x0249('0x4a')]=_[_0x0249('0x61')](_0x1d05f9[_0x0249('0x4a')]);_0x2af50a[_0x0249('0x4b')]=_['intersection'](_0x2af50a[_0x0249('0x4d')],_0x2af50a[_0x0249('0x4a')]);_0x1f12f3[_0x0249('0x4e')]=_[_0x0249('0x4c')](_0x2af50a[_0x0249('0x4d')],qs[_0x0249('0x4f')](_0x1d05f9[_0x0249('0x4a')][_0x0249('0x4f')]));_0x1f12f3[_0x0249('0x4e')]=_0x1f12f3[_0x0249('0x4e')][_0x0249('0x50')]?_0x1f12f3[_0x0249('0x4e')]:_0x2af50a[_0x0249('0x4d')];if(_0x1d05f9[_0x0249('0x4a')][_0x0249('0x59')]){_0x1f12f3[_0x0249('0x5a')]=[{'all':!![]}];}_0x1f12f3=_[_0x0249('0x62')]({},_0x1f12f3,_0x1d05f9[_0x0249('0x63')]);return db[_0x0249('0x45')][_0x0249('0x64')](_0x1f12f3)[_0x0249('0x3b')](handleEntityNotFound(_0x4c0b49,null))['then'](respondWithResult(_0x4c0b49,null))[_0x0249('0x5c')](handleError(_0x4c0b49,null));};exports[_0x0249('0x3a')]=function(_0x22587b,_0x4602e3){if(_0x22587b[_0x0249('0x65')]['id']){delete _0x22587b[_0x0249('0x65')]['id'];}return db[_0x0249('0x45')]['find']({'where':{'id':_0x22587b[_0x0249('0x5e')]['id']},'include':[{'model':db[_0x0249('0x40')],'as':_0x0249('0x41')},{'model':db['MailServerOut'],'as':_0x0249('0x60')},{'model':db[_0x0249('0x42')],'as':_0x0249('0x43')}]})[_0x0249('0x3b')](handleEntityNotFound(_0x4602e3,null))['then'](saveUpdates(_0x22587b[_0x0249('0x65')],null))[_0x0249('0x3b')](function(_0xf83eb3){if(_0xf83eb3&&_0x22587b[_0x0249('0x65')][_0x0249('0x41')]){return db[_0x0249('0x40')][_0x0249('0x3a')](_0x22587b[_0x0249('0x65')][_0x0249('0x41')],{'where':{'MailAccountId':_0xf83eb3['id']}})[_0x0249('0x3b')](function(){return _0xf83eb3;});}return _0xf83eb3;})[_0x0249('0x3b')](function(_0x172c5d){if(_0x172c5d&&_0x22587b[_0x0249('0x65')][_0x0249('0x60')]){return db[_0x0249('0x5f')][_0x0249('0x3a')](_0x22587b[_0x0249('0x65')]['Smtp'],{'where':{'MailAccountId':_0x172c5d['id']}})['then'](function(){return _0x172c5d;});}return _0x172c5d;})[_0x0249('0x3b')](respondWithResult(_0x4602e3,null))[_0x0249('0x5c')](handleError(_0x4602e3,null));};exports[_0x0249('0x66')]=function(_0x36934c,_0x12f462){return db['MailAccount'][_0x0249('0x66')]()[_0x0249('0x3b')](respondWithResult(_0x12f462,null))[_0x0249('0x5c')](handleError(_0x12f462,null));};exports[_0x0249('0x67')]=function(_0x424747,_0x17325e,_0x38df32){if(_0x424747[_0x0249('0x65')]['id']){delete _0x424747[_0x0249('0x65')]['id'];}return db[_0x0249('0x45')]['find']({'where':{'id':_0x424747['params']['id']}})[_0x0249('0x3b')](handleEntityNotFound(_0x17325e,null))[_0x0249('0x3b')](function(_0x1ae802){if(_0x1ae802){_0x424747['body'][_0x0249('0x68')]=_0x1ae802['id'];return db[_0x0249('0x69')]['create'](_0x424747['body']);}})[_0x0249('0x3b')](respondWithResult(_0x17325e,null))['catch'](handleError(_0x17325e,null));};exports[_0x0249('0x6a')]=function(_0x37ca0c,_0x42bf5b,_0x153cdb){var _0x337779={'raw':![],'where':{}};var _0x9120f3={};var _0x5ca761={'count':0x0,'rows':[]};return db[_0x0249('0x45')][_0x0249('0x6b')]({'where':{'id':_0x37ca0c[_0x0249('0x5e')]['id']}})[_0x0249('0x3b')](handleEntityNotFound(_0x42bf5b,null))[_0x0249('0x3b')](function(_0x5c37e0){if(_0x5c37e0){_0x9120f3[_0x0249('0x4d')]=_[_0x0249('0x61')](db['Disposition'][_0x0249('0x46')]);_0x9120f3[_0x0249('0x4a')]=_[_0x0249('0x61')](_0x37ca0c[_0x0249('0x4a')]);_0x9120f3[_0x0249('0x4b')]=_[_0x0249('0x4c')](_0x9120f3['model'],_0x9120f3['query']);_0x337779[_0x0249('0x4e')]=_[_0x0249('0x4c')](_0x9120f3[_0x0249('0x4d')],qs[_0x0249('0x4f')](_0x37ca0c[_0x0249('0x4a')]['fields']));_0x337779[_0x0249('0x4e')]=_0x337779[_0x0249('0x4e')][_0x0249('0x50')]?_0x337779[_0x0249('0x4e')]:_0x9120f3[_0x0249('0x4d')];if(!_0x37ca0c[_0x0249('0x4a')][_0x0249('0x51')](_0x0249('0x52'))){_0x337779['limit']=qs[_0x0249('0x53')](_0x37ca0c['query'][_0x0249('0x53')]);_0x337779[_0x0249('0x34')]=qs[_0x0249('0x34')](_0x37ca0c['query'][_0x0249('0x34')]);}_0x337779['order']=qs[_0x0249('0x55')](_0x37ca0c[_0x0249('0x4a')][_0x0249('0x55')]);_0x337779[_0x0249('0x56')]=qs[_0x0249('0x4b')](_['pick'](_0x37ca0c[_0x0249('0x4a')],_0x9120f3[_0x0249('0x4b')]));_0x337779[_0x0249('0x56')][_0x0249('0x68')]=_0x5c37e0['id'];if(_0x37ca0c[_0x0249('0x4a')]['filter']){_0x337779[_0x0249('0x56')]=_[_0x0249('0x62')](_0x337779['where'],{'$or':_['map'](_0x337779[_0x0249('0x4e')],function(_0x57b820){var _0x5991ae={};_0x5991ae[_0x57b820]={'$like':'%'+_0x37ca0c[_0x0249('0x4a')]['filter']+'%'};return _0x5991ae;})});}_0x337779=_['merge']({},_0x337779,_0x37ca0c[_0x0249('0x63')]);return db[_0x0249('0x69')][_0x0249('0x33')]({'where':_0x337779[_0x0249('0x56')]})['then'](function(_0x148563){_0x5ca761['count']=_0x148563;if(_0x37ca0c[_0x0249('0x4a')][_0x0249('0x59')]){_0x337779[_0x0249('0x5a')]=[{'all':!![]}];}return db[_0x0249('0x69')]['findAll'](_0x337779);})[_0x0249('0x3b')](function(_0x211244){_0x5ca761[_0x0249('0x5b')]=_0x211244;return _0x5ca761;});}})[_0x0249('0x3b')](respondWithFilteredResult(_0x42bf5b,_0x337779))['catch'](handleError(_0x42bf5b,null));};exports[_0x0249('0x6c')]=function(_0x3d43d9,_0x42ca79,_0x506612){return db[_0x0249('0x45')][_0x0249('0x64')]({'where':{'id':_0x3d43d9['params']['id']}})[_0x0249('0x3b')](handleEntityNotFound(_0x42ca79,null))[_0x0249('0x3b')](function(_0x3eb209){if(_0x3eb209){return _0x3eb209['removeDispositions'](_0x3d43d9[_0x0249('0x4a')][_0x0249('0x6d')]);}})[_0x0249('0x3b')](respondWithStatusCode(_0x42ca79,null))[_0x0249('0x5c')](handleError(_0x42ca79,null));};exports[_0x0249('0x6e')]=function(_0x50e563,_0x372146,_0x426dd1){if(_0x50e563[_0x0249('0x65')]['id']){delete _0x50e563['body']['id'];}return db[_0x0249('0x45')][_0x0249('0x64')]({'where':{'id':_0x50e563['params']['id']}})[_0x0249('0x3b')](handleEntityNotFound(_0x372146,null))[_0x0249('0x3b')](function(_0x352453){if(_0x352453){_0x50e563['body']['MailAccountId']=_0x352453['id'];return db[_0x0249('0x6f')]['create'](_0x50e563[_0x0249('0x65')]);}})['then'](respondWithResult(_0x372146,null))[_0x0249('0x5c')](handleError(_0x372146,null));};exports[_0x0249('0x70')]=function(_0x2f196a,_0x29a189,_0x262561){var _0x2d5da1={'raw':![],'where':{}};var _0x1181ed={};var _0x2e3dbe={'count':0x0,'rows':[]};return db[_0x0249('0x45')][_0x0249('0x6b')]({'where':{'id':_0x2f196a[_0x0249('0x5e')]['id']}})[_0x0249('0x3b')](handleEntityNotFound(_0x29a189,null))[_0x0249('0x3b')](function(_0x145b59){if(_0x145b59){_0x1181ed['model']=_[_0x0249('0x61')](db[_0x0249('0x6f')][_0x0249('0x46')]);_0x1181ed[_0x0249('0x4a')]=_['keys'](_0x2f196a[_0x0249('0x4a')]);_0x1181ed['filters']=_[_0x0249('0x4c')](_0x1181ed['model'],_0x1181ed[_0x0249('0x4a')]);_0x2d5da1['attributes']=_[_0x0249('0x4c')](_0x1181ed[_0x0249('0x4d')],qs[_0x0249('0x4f')](_0x2f196a[_0x0249('0x4a')][_0x0249('0x4f')]));_0x2d5da1[_0x0249('0x4e')]=_0x2d5da1[_0x0249('0x4e')][_0x0249('0x50')]?_0x2d5da1[_0x0249('0x4e')]:_0x1181ed[_0x0249('0x4d')];if(!_0x2f196a['query'][_0x0249('0x51')]('nolimit')){_0x2d5da1[_0x0249('0x53')]=qs[_0x0249('0x53')](_0x2f196a[_0x0249('0x4a')][_0x0249('0x53')]);_0x2d5da1[_0x0249('0x34')]=qs[_0x0249('0x34')](_0x2f196a[_0x0249('0x4a')][_0x0249('0x34')]);}_0x2d5da1[_0x0249('0x54')]=qs['sort'](_0x2f196a[_0x0249('0x4a')]['sort']);_0x2d5da1[_0x0249('0x56')]=qs[_0x0249('0x4b')](_[_0x0249('0x71')](_0x2f196a[_0x0249('0x4a')],_0x1181ed[_0x0249('0x4b')]));_0x2d5da1[_0x0249('0x56')][_0x0249('0x68')]=_0x145b59['id'];if(_0x2f196a[_0x0249('0x4a')]['filter']){_0x2d5da1[_0x0249('0x56')]=_[_0x0249('0x62')](_0x2d5da1[_0x0249('0x56')],{'$or':_[_0x0249('0x44')](_0x2d5da1[_0x0249('0x4e')],function(_0x977323){var _0x2b9603={};_0x2b9603[_0x977323]={'$like':'%'+_0x2f196a[_0x0249('0x4a')][_0x0249('0x57')]+'%'};return _0x2b9603;})});}_0x2d5da1=_[_0x0249('0x62')]({},_0x2d5da1,_0x2f196a[_0x0249('0x63')]);return db[_0x0249('0x6f')][_0x0249('0x33')]({'where':_0x2d5da1['where']})[_0x0249('0x3b')](function(_0xccccd8){_0x2e3dbe[_0x0249('0x33')]=_0xccccd8;if(_0x2f196a[_0x0249('0x4a')]['includeAll']){_0x2d5da1[_0x0249('0x5a')]=[{'all':!![]}];}return db[_0x0249('0x6f')][_0x0249('0x72')](_0x2d5da1);})[_0x0249('0x3b')](function(_0x2d6eb4){_0x2e3dbe['rows']=_0x2d6eb4;return _0x2e3dbe;});}})['then'](respondWithFilteredResult(_0x29a189,_0x2d5da1))['catch'](handleError(_0x29a189,null));};exports[_0x0249('0x73')]=function(_0x1e7295,_0x33d048,_0x44083f){return db['MailAccount'][_0x0249('0x64')]({'where':{'id':_0x1e7295[_0x0249('0x5e')]['id']}})['then'](handleEntityNotFound(_0x33d048,null))[_0x0249('0x3b')](function(_0x29b30a){if(_0x29b30a){return _0x29b30a['removeAnswers'](_0x1e7295[_0x0249('0x4a')][_0x0249('0x6d')]);}})['then'](respondWithStatusCode(_0x33d048,null))[_0x0249('0x5c')](handleError(_0x33d048,null));};exports[_0x0249('0x74')]=function(_0x469512,_0x592f14){var _0xa41d62={'name':_0x469512[_0x0249('0x65')][_0x0249('0x49')],'key':_0x469512[_0x0249('0x65')][_0x0249('0x48')],'email':_0x469512[_0x0249('0x65')][_0x0249('0x75')],'ListId':_0x469512[_0x0249('0x65')][_0x0249('0x76')],'active':!_[_0x0249('0x77')](_0x469512[_0x0249('0x65')][_0x0249('0x78')])?_0x469512[_0x0249('0x65')]['active']:!![],'description':_0x469512[_0x0249('0x65')][_0x0249('0x79')]||null,'Imap':{},'Smtp':{}};if(_[_0x0249('0x77')](_0x469512['body'][_0x0249('0x7a')])){if(_0x469512[_0x0249('0x65')][_0x0249('0x7b')]){_0xa41d62['Imap']['user']=_0xa41d62['Smtp'][_0x0249('0x7c')]=_0x469512['body']['cuser'];_0xa41d62['Imap'][_0x0249('0x7d')]=_0xa41d62[_0x0249('0x60')][_0x0249('0x7e')]=_0x469512[_0x0249('0x65')][_0x0249('0x7f')];}else{_0xa41d62[_0x0249('0x41')][_0x0249('0x80')]=_0xa41d62[_0x0249('0x60')][_0x0249('0x80')]=![];}_0xa41d62[_0x0249('0x41')][_0x0249('0x81')]=_0x469512[_0x0249('0x65')][_0x0249('0x41')][_0x0249('0x81')];_0xa41d62[_0x0249('0x41')][_0x0249('0x82')]=_0x469512[_0x0249('0x65')][_0x0249('0x41')][_0x0249('0x82')];_0xa41d62['Smtp'][_0x0249('0x81')]=_0x469512[_0x0249('0x65')][_0x0249('0x60')][_0x0249('0x81')];_0xa41d62[_0x0249('0x60')][_0x0249('0x82')]=_0x469512[_0x0249('0x65')][_0x0249('0x60')][_0x0249('0x82')];}else{_0xa41d62[_0x0249('0x41')][_0x0249('0x83')]=_0xa41d62[_0x0249('0x60')]['service']=_0x469512[_0x0249('0x65')]['cservice'];_0xa41d62[_0x0249('0x41')][_0x0249('0x7c')]=_0xa41d62[_0x0249('0x60')][_0x0249('0x7c')]=_0x469512[_0x0249('0x65')]['cuser'];_0xa41d62[_0x0249('0x41')]['password']=_0xa41d62[_0x0249('0x60')][_0x0249('0x7e')]=_0x469512[_0x0249('0x65')][_0x0249('0x7f')];}return db[_0x0249('0x45')][_0x0249('0x74')](_0xa41d62,{'include':[{'model':db['MailServerOut'],'as':_0x0249('0x60')},{'model':db[_0x0249('0x40')],'as':'Imap'}]})[_0x0249('0x3b')](function(_0x2daf9b){var _0x341eab=_0x469512[_0x0249('0x7c')]['get']({'plain':!![]});if(!_0x341eab)throw new Error(_0x0249('0x84'));if(_0x341eab[_0x0249('0x85')]===_0x0249('0x7c')){var _0x510384=_0x2daf9b['get']({'plain':!![]});return db[_0x0249('0x86')][_0x0249('0x64')]({'where':{'name':_0x0249('0x87'),'userProfileId':_0x341eab[_0x0249('0x88')]},'raw':!![]})[_0x0249('0x3b')](function(_0xfe6a49){if(_0xfe6a49&&_0xfe6a49['autoAssociation']===0x0){return db[_0x0249('0x89')][_0x0249('0x74')]({'name':_0x510384[_0x0249('0x49')],'resourceId':_0x510384['id'],'type':_0xfe6a49[_0x0249('0x49')],'sectionId':_0xfe6a49['id']},{})[_0x0249('0x3b')](function(){return _0x2daf9b;});}else{return _0x2daf9b;}})[_0x0249('0x5c')](function(_0x3b7924){logger['error'](_0x0249('0x8a'),_0x3b7924);throw _0x3b7924;});}return _0x2daf9b;})[_0x0249('0x3b')](respondWithResult(_0x592f14,0xc9))[_0x0249('0x5c')](handleError(_0x592f14,null));};exports['getImap']=function(_0x452676,_0x175599,_0x141de8){return db[_0x0249('0x45')]['findOne']({'where':{'id':_0x452676[_0x0249('0x5e')]['id']}})['then'](handleEntityNotFound(_0x175599,null))['then'](function(_0x36fee3){if(_0x36fee3){return _0x36fee3[_0x0249('0x8b')]();}return null;})['then'](respondWithResult(_0x175599,null))[_0x0249('0x5c')](handleError(_0x175599,null));};exports[_0x0249('0x8c')]=function(_0x19424c,_0xe865de,_0x2b200a){if(_0x19424c[_0x0249('0x65')]['id']){delete _0x19424c[_0x0249('0x65')]['id'];}return db[_0x0249('0x45')][_0x0249('0x64')]({'where':{'id':_0x19424c[_0x0249('0x5e')]['id']}})[_0x0249('0x3b')](handleEntityNotFound(_0xe865de,null))[_0x0249('0x3b')](function(_0x3f8c1e){if(_0x3f8c1e){_0x19424c[_0x0249('0x65')][_0x0249('0x68')]=_0x3f8c1e['id'];return db[_0x0249('0x40')][_0x0249('0x74')](_0x19424c[_0x0249('0x65')]);}})[_0x0249('0x3b')](respondWithResult(_0xe865de,null))[_0x0249('0x5c')](handleError(_0xe865de,null));};exports[_0x0249('0x8d')]=function(_0x1e2b12,_0x1e679d,_0x327f61){return db[_0x0249('0x45')][_0x0249('0x6b')]({'where':{'id':_0x1e2b12[_0x0249('0x5e')]['id']}})[_0x0249('0x3b')](handleEntityNotFound(_0x1e679d,null))[_0x0249('0x3b')](function(_0x1d239d){if(_0x1d239d){return _0x1d239d[_0x0249('0x8e')](null);}return null;})['then'](respondWithStatusCode(_0x1e679d,null))[_0x0249('0x5c')](handleError(_0x1e679d,null));};exports[_0x0249('0x8f')]=function(_0x2960a3,_0x29603d,_0x7945a){return db[_0x0249('0x45')][_0x0249('0x6b')]({'where':{'id':_0x2960a3[_0x0249('0x5e')]['id']}})['then'](handleEntityNotFound(_0x29603d,null))[_0x0249('0x3b')](function(_0x32be5d){if(_0x32be5d){return _0x32be5d[_0x0249('0x8f')]();}return null;})[_0x0249('0x3b')](respondWithResult(_0x29603d,null))[_0x0249('0x5c')](handleError(_0x29603d,null));};exports[_0x0249('0x90')]=function(_0x134b00,_0x15967d,_0xea990f){if(_0x134b00[_0x0249('0x65')]['id']){delete _0x134b00['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x134b00[_0x0249('0x5e')]['id']}})[_0x0249('0x3b')](handleEntityNotFound(_0x15967d,null))[_0x0249('0x3b')](function(_0x148d89){if(_0x148d89){_0x134b00['body'][_0x0249('0x68')]=_0x148d89['id'];return db[_0x0249('0x5f')][_0x0249('0x74')](_0x134b00[_0x0249('0x65')]);}})[_0x0249('0x3b')](respondWithResult(_0x15967d,null))[_0x0249('0x5c')](handleError(_0x15967d,null));};exports[_0x0249('0x91')]=function(_0x43846b,_0x2ee82c,_0x42caeb){return db[_0x0249('0x45')][_0x0249('0x6b')]({'where':{'id':_0x43846b[_0x0249('0x5e')]['id']}})[_0x0249('0x3b')](handleEntityNotFound(_0x2ee82c,null))[_0x0249('0x3b')](function(_0x3c91c5){if(_0x3c91c5){return _0x3c91c5[_0x0249('0x92')](null);}return null;})[_0x0249('0x3b')](respondWithStatusCode(_0x2ee82c,null))[_0x0249('0x5c')](handleError(_0x2ee82c,null));};exports[_0x0249('0x93')]=function(_0x3d675b,_0x2b3e59,_0x1c5da2){return db[_0x0249('0x94')]['find']({'where':{'id':_0x3d675b[_0x0249('0x5e')]['id']}})[_0x0249('0x3b')](handleEntityNotFound(_0x2b3e59,null))[_0x0249('0x3b')](function(_0x219b0b){if(_0x219b0b){return _0x219b0b[_0x0249('0x93')](_0x3d675b[_0x0249('0x65')][_0x0249('0x6d')],_[_0x0249('0x95')](_0x3d675b[_0x0249('0x65')],[_0x0249('0x6d'),'id'])||{});}})[_0x0249('0x3b')](respondWithResult(_0x2b3e59,null))['catch'](handleError(_0x2b3e59,null));};exports[_0x0249('0x96')]=function(_0x4485b5,_0x23b2cd,_0x3a1d7c){var _0x14f887={'raw':![],'where':{}};var _0x1fb09d={};var _0x4996f4={'count':0x0,'rows':[]};return db[_0x0249('0x45')][_0x0249('0x6b')]({'where':{'id':_0x4485b5['params']['id']}})[_0x0249('0x3b')](handleEntityNotFound(_0x23b2cd,null))[_0x0249('0x3b')](function(_0x5d76e1){if(_0x5d76e1){_0x1fb09d['model']=_[_0x0249('0x61')](db['MailInteraction']['rawAttributes']);_0x1fb09d[_0x0249('0x4a')]=_[_0x0249('0x61')](_0x4485b5[_0x0249('0x4a')]);_0x1fb09d['filters']=_['intersection'](_0x1fb09d[_0x0249('0x4d')],_0x1fb09d[_0x0249('0x4a')]);_0x14f887['attributes']=_[_0x0249('0x4c')](_0x1fb09d[_0x0249('0x4d')],qs['fields'](_0x4485b5[_0x0249('0x4a')][_0x0249('0x4f')]));_0x14f887['attributes']=_0x14f887['attributes'][_0x0249('0x50')]?_0x14f887[_0x0249('0x4e')]:_0x1fb09d[_0x0249('0x4d')];if(!_0x4485b5[_0x0249('0x4a')][_0x0249('0x51')](_0x0249('0x52'))){_0x14f887['limit']=qs['limit'](_0x4485b5[_0x0249('0x4a')][_0x0249('0x53')]);_0x14f887['offset']=qs[_0x0249('0x34')](_0x4485b5[_0x0249('0x4a')][_0x0249('0x34')]);}_0x14f887['order']=qs[_0x0249('0x55')](_0x4485b5[_0x0249('0x4a')][_0x0249('0x55')]);_0x14f887['where']=qs[_0x0249('0x4b')](_[_0x0249('0x71')](_0x4485b5[_0x0249('0x4a')],_0x1fb09d[_0x0249('0x4b')]));_0x14f887[_0x0249('0x56')]['MailAccountId']=_0x5d76e1['id'];if(_0x4485b5[_0x0249('0x4a')][_0x0249('0x57')]){_0x14f887[_0x0249('0x56')]=_[_0x0249('0x62')](_0x14f887[_0x0249('0x56')],{'$or':_['map'](_0x14f887[_0x0249('0x4e')],function(_0xcf4304){var _0x24fedd={};_0x24fedd[_0xcf4304]={'$like':'%'+_0x4485b5[_0x0249('0x4a')][_0x0249('0x57')]+'%'};return _0x24fedd;})});}_0x14f887=_[_0x0249('0x62')]({},_0x14f887,_0x4485b5[_0x0249('0x63')]);return db[_0x0249('0x94')][_0x0249('0x33')]({'where':_0x14f887[_0x0249('0x56')]})[_0x0249('0x3b')](function(_0x512b68){_0x4996f4[_0x0249('0x33')]=_0x512b68;if(_0x4485b5[_0x0249('0x4a')][_0x0249('0x59')]){_0x14f887['include']=[{'model':db[_0x0249('0x97')],'as':'Contact','required':![]},{'model':db[_0x0249('0x98')],'as':_0x0249('0x99'),'attributes':[_0x0249('0x49'),_0x0249('0x9a'),_0x0249('0x9b')],'required':![]},{'model':db[_0x0249('0x9c')],'as':_0x0249('0x9d'),'attributes':['id',_0x0249('0x49'),'color'],'where':_0x4485b5['query'][_0x0249('0x9e')]?{'id':_0x4485b5['query'][_0x0249('0x9e')]}:undefined,'required':_0x4485b5[_0x0249('0x4a')][_0x0249('0x9e')]?!![]:![]}];}return db[_0x0249('0x94')]['findAll'](_0x14f887);})['then'](function(_0x417335){_0x4996f4['rows']=_0x417335;return _0x4996f4;});}})[_0x0249('0x3b')](respondWithFilteredResult(_0x23b2cd,_0x14f887))['catch'](handleError(_0x23b2cd,null));};exports[_0x0249('0x9f')]=function(_0x3dff49,_0x212d4f,_0x280a9a){return db[_0x0249('0x45')]['findOne']({'where':{'id':_0x3dff49['params']['id']}})['then'](handleEntityNotFound(_0x212d4f,null))[_0x0249('0x3b')](function(_0x4aff08){if(_0x4aff08){return db['sequelize'][_0x0249('0xa0')](function(_0x2b0216){return db[_0x0249('0xa1')]['destroy']({'where':{'MailAccountId':_0x3dff49[_0x0249('0x5e')]['id']},'transaction':_0x2b0216})[_0x0249('0x3b')](function(_0x4f9f74){var _0x48575c=_[_0x0249('0x44')](_0x3dff49['body'],function(_0x51a041){_0x51a041[_0x0249('0x68')]=_0x3dff49[_0x0249('0x5e')]['id'];return _0x51a041;});return db['MailApplication'][_0x0249('0xa2')](_0x48575c,{'transaction':_0x2b0216});});})[_0x0249('0x3b')](function(){return db[_0x0249('0xa1')][_0x0249('0xa3')]({'where':{'MailAccountId':_0x3dff49[_0x0249('0x5e')]['id']},'order':'priority'});});}})[_0x0249('0x3b')](respondWithResult(_0x212d4f,null))[_0x0249('0x5c')](handleError(_0x212d4f,null));};exports[_0x0249('0xa4')]=function(_0xffa274,_0x2634b1,_0x26d43f){var _0x2a4b01={};var _0x5baec4={};var _0x293c16;var _0x3a8620;return db[_0x0249('0x45')][_0x0249('0x6b')]({'where':{'id':_0xffa274[_0x0249('0x5e')]['id']}})[_0x0249('0x3b')](handleEntityNotFound(_0x2634b1,null))[_0x0249('0x3b')](function(_0x8c8c72){if(_0x8c8c72){_0x293c16=_0x8c8c72;_0x5baec4[_0x0249('0x4d')]=_[_0x0249('0x61')](db['MailApplication'][_0x0249('0x46')]);_0x5baec4['query']=_['keys'](_0xffa274[_0x0249('0x4a')]);_0x5baec4['filters']=_['intersection'](_0x5baec4[_0x0249('0x4d')],_0x5baec4['query']);_0x2a4b01['attributes']=_[_0x0249('0x4c')](_0x5baec4[_0x0249('0x4d')],qs[_0x0249('0x4f')](_0xffa274[_0x0249('0x4a')][_0x0249('0x4f')]));_0x2a4b01[_0x0249('0x4e')]=_0x2a4b01[_0x0249('0x4e')][_0x0249('0x50')]?_0x2a4b01[_0x0249('0x4e')]:_0x5baec4[_0x0249('0x4d')];_0x2a4b01[_0x0249('0x54')]=qs[_0x0249('0x55')](_0xffa274[_0x0249('0x4a')][_0x0249('0x55')]);_0x2a4b01[_0x0249('0x56')]=qs['filters'](_[_0x0249('0x71')](_0xffa274[_0x0249('0x4a')],_0x5baec4[_0x0249('0x4b')]));if(_0xffa274['query'][_0x0249('0x57')]){_0x2a4b01[_0x0249('0x56')]=_['merge'](_0x2a4b01['where'],{'$or':_[_0x0249('0x44')](_0x2a4b01[_0x0249('0x4e')],function(_0x3c4d0a){var _0x2ffcb5={};_0x2ffcb5[_0x3c4d0a]={'$like':'%'+_0xffa274[_0x0249('0x4a')][_0x0249('0x57')]+'%'};return _0x2ffcb5;})});}_0x2a4b01=_['merge']({},_0x2a4b01,_0xffa274['options']);return _0x293c16['getApplications'](_0x2a4b01);}})[_0x0249('0x3b')](function(_0x633f7c){if(_0x633f7c){_0x3a8620=_0x633f7c['length'];if(!_0xffa274[_0x0249('0x4a')][_0x0249('0x51')]('nolimit')){_0x2a4b01[_0x0249('0x53')]=qs[_0x0249('0x53')](_0xffa274[_0x0249('0x4a')][_0x0249('0x53')]);_0x2a4b01['offset']=qs[_0x0249('0x34')](_0xffa274['query'][_0x0249('0x34')]);}return _0x293c16[_0x0249('0xa4')](_0x2a4b01);}})[_0x0249('0x3b')](function(_0x263c8f){if(_0x263c8f){return _0x263c8f?{'count':_0x3a8620,'rows':_0x263c8f}:null;}})[_0x0249('0x3b')](respondWithResult(_0x2634b1,null))['catch'](handleError(_0x2634b1,null));};exports[_0x0249('0xa5')]=function(_0x39888e,_0x2e2b74,_0x365a00){var _0x5c5d46={'raw':!![],'where':{}};var _0x28bb49={};var _0x6dd0f9={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x39888e['params']['id']}})[_0x0249('0x3b')](handleEntityNotFound(_0x2e2b74,null))['then'](function(_0x57e3ac){if(_0x57e3ac){_0x28bb49[_0x0249('0x4d')]=_[_0x0249('0x61')](db[_0x0249('0xa6')][_0x0249('0x46')]);_0x28bb49[_0x0249('0x4a')]=_['keys'](_0x39888e[_0x0249('0x4a')]);_0x28bb49[_0x0249('0x4b')]=_[_0x0249('0x4c')](_0x28bb49[_0x0249('0x4d')],_0x28bb49['query']);_0x5c5d46[_0x0249('0x4e')]=_[_0x0249('0x4c')](_0x28bb49[_0x0249('0x4d')],qs[_0x0249('0x4f')](_0x39888e[_0x0249('0x4a')][_0x0249('0x4f')]));_0x5c5d46['attributes']=_0x5c5d46[_0x0249('0x4e')][_0x0249('0x50')]?_0x5c5d46[_0x0249('0x4e')]:_0x28bb49[_0x0249('0x4d')];if(!_0x39888e[_0x0249('0x4a')]['hasOwnProperty'](_0x0249('0x52'))){_0x5c5d46[_0x0249('0x53')]=qs[_0x0249('0x53')](_0x39888e[_0x0249('0x4a')][_0x0249('0x53')]);_0x5c5d46['offset']=qs[_0x0249('0x34')](_0x39888e[_0x0249('0x4a')][_0x0249('0x34')]);}_0x5c5d46['order']=qs['sort'](_0x39888e[_0x0249('0x4a')][_0x0249('0x55')]);_0x5c5d46[_0x0249('0x56')]=qs[_0x0249('0x4b')](_[_0x0249('0x71')](_0x39888e['query'],_0x28bb49['filters']));_0x5c5d46[_0x0249('0x56')]['MailAccountId']=_0x57e3ac['id'];if(_0x39888e[_0x0249('0x4a')][_0x0249('0x57')]){_0x5c5d46[_0x0249('0x56')]=_['merge'](_0x5c5d46[_0x0249('0x56')],{'$or':_[_0x0249('0x44')](_0x5c5d46[_0x0249('0x4e')],function(_0x4b0292){var _0x5ebcf5={};_0x5ebcf5[_0x4b0292]={'$like':'%'+_0x39888e[_0x0249('0x4a')][_0x0249('0x57')]+'%'};return _0x5ebcf5;})});}if(_0x39888e[_0x0249('0x4a')][_0x0249('0xa7')]){var _0x1800b8=_0x39888e[_0x0249('0x4a')][_0x0249('0xa7')]['split'](',');var _0x393239={};_0x393239[_0x1800b8[0x0]]={'$gte':moment(_0x1800b8[0x1])[_0x0249('0xa8')](_0x0249('0xa9'))};_0x5c5d46['where']=_[_0x0249('0x62')](_0x5c5d46[_0x0249('0x56')],_0x393239);}_0x5c5d46=_[_0x0249('0x62')]({},_0x5c5d46,_0x39888e[_0x0249('0x63')]);return db[_0x0249('0xa6')][_0x0249('0x33')]({'where':_0x5c5d46['where']})['then'](function(_0x2b0885){_0x6dd0f9[_0x0249('0x33')]=_0x2b0885;if(_0x39888e[_0x0249('0x4a')][_0x0249('0x59')]){_0x5c5d46[_0x0249('0x5a')]=[{'all':!![]}];}return db['MailMessage'][_0x0249('0x72')](_0x5c5d46);})[_0x0249('0x3b')](function(_0xb882df){_0x6dd0f9['rows']=_0xb882df;return _0x6dd0f9;});}})[_0x0249('0x3b')](respondWithFilteredResult(_0x2e2b74,_0x5c5d46))['catch'](handleError(_0x2e2b74,null));};exports[_0x0249('0x3e')]=function(_0xb02368,_0x37c92a,_0x32aa82){var _0x594b93,_0x35fb04={},_0x1c44c6;if(_0xb02368[_0x0249('0x65')]['to']){_0x1c44c6=_0xb02368['body']['to']['split'](',')[0x0];}return db[_0x0249('0x45')]['find']({'where':{'id':_0xb02368[_0x0249('0x5e')]['id']},'include':[{'model':db[_0x0249('0xaa')],'as':_0x0249('0xab'),'include':[{'model':db['CmContact'],'as':_0x0249('0xac'),'where':{'email':_0x1c44c6},'limit':0x1,'order':[['updatedAt',_0x0249('0xad')]]}]},{'model':db[_0x0249('0x5f')],'as':'Smtp','raw':!![]}]})[_0x0249('0x3b')](handleEntityNotFound(_0x37c92a,null))['then'](function(_0x40ee6e){if(_0x40ee6e){_0x594b93=_0x40ee6e;if(_0x40ee6e[_0x0249('0x60')]){if(_['isNil'](_0xb02368[_0x0249('0x65')][_0x0249('0xae')])){_0xb02368[_0x0249('0x65')][_0x0249('0xae')]=util[_0x0249('0xa8')](_0x0249('0xaf'),_0x40ee6e['name'],_0x40ee6e[_0x0249('0x75')]||_0x40ee6e[_0x0249('0x60')]['user']);}if(_0xb02368[_0x0249('0x65')][_0x0249('0xb0')]&&_0xb02368[_0x0249('0x65')][_0x0249('0xb0')][_0x0249('0x50')]){for(var _0x206e69=0x0;_0x206e69<_0xb02368[_0x0249('0x65')][_0x0249('0xb0')][_0x0249('0x50')];_0x206e69+=0x1){_0xb02368[_0x0249('0x65')][_0x0249('0xb0')][_0x206e69]={'filename':_0xb02368[_0x0249('0x65')][_0x0249('0xb0')][_0x206e69][_0x0249('0x49')],'path':path['join'](config[_0x0249('0xb1')],_0x0249('0xb2'),_0xb02368[_0x0249('0x65')][_0x0249('0xb0')][_0x206e69][_0x0249('0xb3')])};}}var _0x2e3a73={'tls':{'rejectUnauthorized':![]}};if(_[_0x0249('0x77')](_0x40ee6e['Smtp'][_0x0249('0x83')])){if(_0x40ee6e['Smtp'][_0x0249('0x80')]){_0x2e3a73[_0x0249('0xb4')]={'user':_0x40ee6e[_0x0249('0x60')][_0x0249('0x7c')],'pass':_0x40ee6e[_0x0249('0x60')][_0x0249('0x7e')]};}_0x2e3a73[_0x0249('0x81')]=_0x40ee6e['Smtp']['host'];_0x2e3a73[_0x0249('0x82')]=_0x40ee6e[_0x0249('0x60')][_0x0249('0x82')];_0x2e3a73[_0x0249('0xb5')]=_0x40ee6e['Smtp'][_0x0249('0xb5')];}else{_0x2e3a73[_0x0249('0x83')]=_0x40ee6e[_0x0249('0x60')][_0x0249('0x83')];_0x2e3a73[_0x0249('0xb4')]={'user':_0x40ee6e[_0x0249('0x60')][_0x0249('0x7c')],'pass':_0x40ee6e[_0x0249('0x60')][_0x0249('0x7e')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x2e3a73,'message':_0xb02368[_0x0249('0x65')]});}else{throw new Error(_0x0249('0xb6'));}}})['then'](function(_0x491954){if(_0x491954){_0x35fb04=_0x491954;if(_0x594b93[_0x0249('0xab')]){if(_0x594b93[_0x0249('0xab')][_0x0249('0xac')][_0x0249('0x50')]){return _0x594b93[_0x0249('0xab')][_0x0249('0xac')][0x0];}else{return db[_0x0249('0x97')]['create'](_[_0x0249('0x1c')](_0xb02368[_0x0249('0x65')],{'firstName':_0xb02368[_0x0249('0x65')]['to'],'email':_0xb02368[_0x0249('0x65')]['to'],'phone':_0xb02368[_0x0249('0x65')]['to'],'ListId':_0x594b93[_0x0249('0x76')]}));}}else{throw new Error(_0x0249('0xb6'));}}})[_0x0249('0x3b')](function(_0x3bbd0f){if(_0x3bbd0f){var _0x31ec09={'UserId':_0xb02368['user']['id'],'ContactId':_0x3bbd0f['id'],'MailAccountId':_0x594b93['id'],'inReplyTo':_0x35fb04[_0x0249('0xb7')],'to':_0xb02368['body'][_0x0249('0xae')],'cc':_0xb02368[_0x0249('0x65')]['cc'],'subject':_0xb02368[_0x0249('0x65')]['subject'],'attach':_0xb02368[_0x0249('0x65')][_0x0249('0xb8')],'firstMsgDirection':_0x0249('0xb9'),'lastMsgAt':moment()['format'](_0x0249('0xa9')),'lastMsgDirection':'out','lastMsgBody':_0xb02368[_0x0249('0x65')][_0x0249('0x65')],'Messages':[_['merge'](_0xb02368[_0x0249('0x65')],{'messageId':_0x35fb04[_0x0249('0xb7')],'sentAt':moment()[_0x0249('0xa8')](_0x0249('0xa9')),'read':!![],'MailAccountId':_0x594b93['id'],'UserId':_0xb02368[_0x0249('0x7c')]['id'],'ContactId':_0x3bbd0f['id']})]};if(_0xb02368[_0x0249('0x65')][_0x0249('0xba')]){_0x31ec09=_[_0x0249('0x62')](_0x31ec09,_0xb02368['body'][_0x0249('0xba')]);}return db[_0x0249('0x94')][_0x0249('0x74')](_0x31ec09,{'include':[{'model':db[_0x0249('0xa6')],'as':_0x0249('0xbb')}]});}})[_0x0249('0x3b')](respondWithResult(_0x37c92a,null))[_0x0249('0x5c')](handleError(_0x37c92a,null));};exports[_0x0249('0xbc')]=function(_0x393941,_0x190146,_0x54b526){return db[_0x0249('0x45')][_0x0249('0x64')]({'where':{'id':_0x393941[_0x0249('0x5e')]['id']},'include':[{'model':db[_0x0249('0x5f')],'as':_0x0249('0x60'),'raw':!![]}]})[_0x0249('0x3b')](handleEntityNotFound(_0x190146,null))[_0x0249('0x3b')](function(_0x36eb95){if(_0x36eb95&&_0x36eb95[_0x0249('0x60')]){var _0x440875={'id':_0x36eb95['id'],'tls':{'rejectUnauthorized':![]}};if(_0x36eb95[_0x0249('0x60')][_0x0249('0x83')]){_0x440875['service']=_0x36eb95[_0x0249('0x60')][_0x0249('0x83')];}else{_0x440875[_0x0249('0x81')]=_0x36eb95[_0x0249('0x60')][_0x0249('0x81')];_0x440875['port']=_0x36eb95[_0x0249('0x60')][_0x0249('0x82')];_0x440875[_0x0249('0xb5')]=_0x36eb95[_0x0249('0x60')]['secure'];}if(_0x36eb95['Smtp'][_0x0249('0x80')]){_0x440875[_0x0249('0xb4')]={'user':_0x36eb95[_0x0249('0x60')]['user'],'pass':_0x36eb95[_0x0249('0x60')][_0x0249('0x7e')]};}return respondWithRpcPromise(_0x0249('0xbd'),_0x0249('0xbc'),{'account':_0x440875});}})[_0x0249('0x3b')](respondWithResult(_0x190146,null))[_0x0249('0x5c')](handleError(_0x190146,null));};exports[_0x0249('0xbe')]=function(_0x2c212b,_0x331941){return db[_0x0249('0x45')]['find']({'where':{'id':_0x2c212b[_0x0249('0x5e')]['id']}})[_0x0249('0x3b')](handleEntityNotFound(_0x331941,null))[_0x0249('0x3b')](function(_0x3e3222){if(_0x3e3222&&_0x3e3222[_0x0249('0x83')]){throw new db[(_0x0249('0x24'))][(_0x0249('0x25'))](_0x0249('0xbf'));}return _0x3e3222;})[_0x0249('0x3b')](removeEntity(_0x331941,null))['catch'](handleError(_0x331941,null));};exports[_0x0249('0xc0')]=function(_0x55bf2a,_0x4eb297,_0x560897){return db['MailAccount'][_0x0249('0x64')]({'where':{'id':_0x55bf2a[_0x0249('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4eb297,null))['then'](function(_0x116624){if(_0x116624){return _0x116624[_0x0249('0xc0')](_0x55bf2a[_0x0249('0x65')]['ids'],_[_0x0249('0x95')](_0x55bf2a[_0x0249('0x65')],['ids','id'])||{})[_0x0249('0xc1')](function(_0x3dd04f){for(var _0x5072d4=0x0;_0x5072d4<_0x55bf2a[_0x0249('0x65')][_0x0249('0x6d')]['length'];_0x5072d4+=0x1){socket['emit'](_0x0249('0xc2'),{'UserId':_0x55bf2a[_0x0249('0x65')][_0x0249('0x6d')][_0x5072d4],'MailAccountId':_0x55bf2a[_0x0249('0x5e')]['id']});}return _0x3dd04f;});}})[_0x0249('0x3b')](respondWithResult(_0x4eb297,null))[_0x0249('0x5c')](handleError(_0x4eb297,null));};exports[_0x0249('0xc3')]=function(_0x5982aa,_0x203b58,_0x3423a9){return db[_0x0249('0x45')][_0x0249('0x64')]({'where':{'id':_0x5982aa['params']['id']}})[_0x0249('0x3b')](handleEntityNotFound(_0x203b58,null))['then'](function(_0x101c31){if(_0x101c31){return _0x101c31[_0x0249('0xc3')](_0x5982aa[_0x0249('0x4a')]['ids'])[_0x0249('0x3b')](function(){if(_[_0x0249('0xc4')](_0x5982aa[_0x0249('0x4a')][_0x0249('0x6d')])){for(var _0x4881dc=0x0;_0x4881dc<_0x5982aa[_0x0249('0x4a')]['ids'][_0x0249('0x50')];_0x4881dc+=0x1){socket[_0x0249('0xc5')](_0x0249('0xc6'),{'UserId':Number(_0x5982aa[_0x0249('0x4a')]['ids'][_0x4881dc]),'MailAccountId':Number(_0x5982aa['params']['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x5982aa[_0x0249('0x4a')][_0x0249('0x6d')]),'MailAccountId':Number(_0x5982aa[_0x0249('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x203b58,null))[_0x0249('0x5c')](handleError(_0x203b58,null));};exports['getAgents']=function(_0x4a480b,_0x5b0499,_0x53acd1){var _0x526b06={};var _0x515af0={};var _0x5d677d;var _0x9ad09d;return db[_0x0249('0x45')][_0x0249('0x6b')]({'where':{'id':_0x4a480b['params']['id']}})['then'](handleEntityNotFound(_0x5b0499,null))[_0x0249('0x3b')](function(_0x4d68fa){if(_0x4d68fa){_0x5d677d=_0x4d68fa;_0x515af0[_0x0249('0x4d')]=_[_0x0249('0x61')](db[_0x0249('0x98')][_0x0249('0x46')]);_0x515af0['query']=_['keys'](_0x4a480b[_0x0249('0x4a')]);_0x515af0[_0x0249('0x4b')]=_[_0x0249('0x4c')](_0x515af0[_0x0249('0x4d')],_0x515af0['query']);_0x526b06[_0x0249('0x4e')]=_['intersection'](_0x515af0[_0x0249('0x4d')],qs['fields'](_0x4a480b[_0x0249('0x4a')][_0x0249('0x4f')]));_0x526b06['attributes']=_0x526b06[_0x0249('0x4e')][_0x0249('0x50')]?_0x526b06['attributes']:_0x515af0['model'];_0x526b06[_0x0249('0x54')]=qs[_0x0249('0x55')](_0x4a480b[_0x0249('0x4a')][_0x0249('0x55')]);_0x526b06['where']=qs[_0x0249('0x4b')](_[_0x0249('0x71')](_0x4a480b[_0x0249('0x4a')],_0x515af0[_0x0249('0x4b')]));if(_0x4a480b['query']['filter']){_0x526b06['where']=_[_0x0249('0x62')](_0x526b06[_0x0249('0x56')],{'$or':_['map'](_0x526b06[_0x0249('0x4e')],function(_0x18f398){var _0x108696={};_0x108696[_0x18f398]={'$like':'%'+_0x4a480b['query']['filter']+'%'};return _0x108696;})});}_0x526b06=_['merge']({},_0x526b06,_0x4a480b['options']);return _0x5d677d[_0x0249('0xc7')](_0x526b06);}})['then'](function(_0x299a29){if(_0x299a29){_0x9ad09d=_0x299a29[_0x0249('0x50')];if(!_0x4a480b[_0x0249('0x4a')]['hasOwnProperty'](_0x0249('0x52'))){_0x526b06[_0x0249('0x53')]=qs[_0x0249('0x53')](_0x4a480b['query']['limit']);_0x526b06[_0x0249('0x34')]=qs[_0x0249('0x34')](_0x4a480b[_0x0249('0x4a')]['offset']);}return _0x5d677d[_0x0249('0xc7')](_0x526b06);}})[_0x0249('0x3b')](function(_0x357376){if(_0x357376){return _0x357376?{'count':_0x9ad09d,'rows':_0x357376}:null;}})['then'](respondWithResult(_0x5b0499,null))['catch'](handleError(_0x5b0499,null));}; \ No newline at end of file +var _0x2e9b=['order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','Imap','intersection','fields','find','body','addDisposition','create','getDispositions','Disposition','MailAccountId','removeDispositions','ids','addAnswer','findOne','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','includeAll','CmContact','Contact','User','Owner','fullname','Tags','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','verifySmtp','addAgents','spread','emit','userMailAccount:save','removeAgents','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./mailAccount.socket','register','jayson/promise','client','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~!@#$%^&-_=+[{]}.','request','then','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','MailAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','update','destroy','get','UserProfileResource','stack','name','index','MailServerIn','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','length','hasOwnProperty','nolimit'];(function(_0x45ec0b,_0x260c5d){var _0x99a3d8=function(_0x524391){while(--_0x524391){_0x45ec0b['push'](_0x45ec0b['shift']());}};_0x99a3d8(++_0x260c5d);}(_0x2e9b,0x131));var _0xb2e9=function(_0x2d6714,_0x12f5e8){_0x2d6714=_0x2d6714-0x0;var _0xc99dac=_0x2e9b[_0x2d6714];return _0xc99dac;};'use strict';var pdf=require(_0xb2e9('0x0'));var emlformat=require(_0xb2e9('0x1'));var rimraf=require(_0xb2e9('0x2'));var zipdir=require(_0xb2e9('0x3'));var jsonpatch=require(_0xb2e9('0x4'));var rp=require(_0xb2e9('0x5'));var moment=require(_0xb2e9('0x6'));var BPromise=require(_0xb2e9('0x7'));var Mustache=require('mustache');var util=require(_0xb2e9('0x8'));var path=require(_0xb2e9('0x9'));var sox=require('sox');var csv=require(_0xb2e9('0xa'));var ejs=require(_0xb2e9('0xb'));var fs=require('fs');var _=require(_0xb2e9('0xc'));var squel=require('squel');var crypto=require(_0xb2e9('0xd'));var jsforce=require(_0xb2e9('0xe'));var deskjs=require(_0xb2e9('0xf'));var toCsv=require(_0xb2e9('0xa'));var querystring=require('querystring');var Papa=require(_0xb2e9('0x10'));var Redis=require(_0xb2e9('0x11'));var authService=require(_0xb2e9('0x12'));var qs=require(_0xb2e9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb2e9('0x14'));var logger=require(_0xb2e9('0x15'))(_0xb2e9('0x16'));var utils=require(_0xb2e9('0x17'));var config=require('../../config/environment');var db=require(_0xb2e9('0x18'))['db'];config['redis']=_[_0xb2e9('0x19')](config['redis'],{'host':_0xb2e9('0x1a'),'port':0x18eb});var socket=require(_0xb2e9('0x1b'))(new Redis(config[_0xb2e9('0x1c')]));require(_0xb2e9('0x1d'))[_0xb2e9('0x1e')](socket);var jayson=require(_0xb2e9('0x1f'));var client=jayson[_0xb2e9('0x20')]['http']({'port':0x232b});function checkPasswordPattern(_0x218c20,_0x38eb19,_0xaa068b){if(_0xaa068b){var _0x518c8f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x518c8f['test'](_0x38eb19)){return _0x218c20;}else{throw new db[(_0xb2e9('0x21'))][(_0xb2e9('0x22'))](_0xb2e9('0x23'));}}else{return _0x218c20;}}function respondWithRpcPromise(_0x2df67f,_0x47c915,_0x923788,_0xd0a547){return new BPromise(function(_0x23ff5c,_0x5a20ee){var _0x5e5e14=_0xd0a547||client;return _0x5e5e14[_0xb2e9('0x24')](_0x2df67f,_0x923788)[_0xb2e9('0x25')](function(_0x1b7b7e){logger['info']('MailAccount,\x20%s,\x20%s',_0x47c915,_0xb2e9('0x26'));logger['debug'](_0xb2e9('0x27'),_0x47c915,_0xb2e9('0x26'),JSON['stringify'](_0x1b7b7e));if(_0x1b7b7e[_0xb2e9('0x28')]){if(_0x1b7b7e[_0xb2e9('0x28')][_0xb2e9('0x29')]===0x1f4){logger[_0xb2e9('0x28')]('MailAccount,\x20%s,\x20%s',_0x47c915,_0x1b7b7e[_0xb2e9('0x28')][_0xb2e9('0x2a')]);return _0x5a20ee(_0x1b7b7e['error']['message']);}logger[_0xb2e9('0x28')](_0xb2e9('0x2b'),_0x47c915,_0x1b7b7e[_0xb2e9('0x28')][_0xb2e9('0x2a')]);return _0x23ff5c(_0x1b7b7e[_0xb2e9('0x28')][_0xb2e9('0x2a')]);}else{logger['info'](_0xb2e9('0x2b'),_0x47c915,_0xb2e9('0x26'));_0x23ff5c(_0x1b7b7e[_0xb2e9('0x2c')][_0xb2e9('0x2a')]);}})[_0xb2e9('0x2d')](function(_0x4dbc95){logger['error'](_0xb2e9('0x2b'),_0x47c915,_0x4dbc95);_0x5a20ee(_0x4dbc95);});});}function respondWithStatusCode(_0x2a621f,_0x136921){_0x136921=_0x136921||0xcc;return function(_0x5971f6){if(_0x5971f6){return _0x2a621f[_0xb2e9('0x2e')](_0x136921);}return _0x2a621f[_0xb2e9('0x2f')](_0x136921)[_0xb2e9('0x30')]();};}function respondWithResult(_0x1f1e15,_0x5ce8dc){_0x5ce8dc=_0x5ce8dc||0xc8;return function(_0x3b0600){if(_0x3b0600){return _0x1f1e15[_0xb2e9('0x2f')](_0x5ce8dc)['json'](_0x3b0600);}};}function respondWithFilteredResult(_0x49b9be,_0x3be9c5){return function(_0x1d32f2){if(_0x1d32f2){var _0x20ed2c=_0x1d32f2[_0xb2e9('0x31')],_0x468bfa=_0x3be9c5[_0xb2e9('0x32')],_0x4d135a=_0x3be9c5[_0xb2e9('0x32')]+_0x3be9c5[_0xb2e9('0x33')],_0x1d87fb;if(_0x4d135a>=_0x20ed2c){_0x4d135a=_0x20ed2c;_0x1d87fb=0xc8;}else{_0x1d87fb=0xce;}_0x49b9be[_0xb2e9('0x2f')](_0x1d87fb);return _0x49b9be['set'](_0xb2e9('0x34'),_0x468bfa+'-'+_0x4d135a+'/'+_0x20ed2c)['json'](_0x1d32f2);}return null;};}function patchUpdates(_0x3de031){return function(_0x2fbbb2){try{jsonpatch[_0xb2e9('0x35')](_0x2fbbb2,_0x3de031,!![]);}catch(_0x4e1e3b){return BPromise[_0xb2e9('0x36')](_0x4e1e3b);}return _0x2fbbb2['save']();};}function saveUpdates(_0x30484f,_0x53904b){return function(_0x5ad1f5){if(_0x5ad1f5){return _0x5ad1f5[_0xb2e9('0x37')](_0x30484f)['then'](function(_0x5aec4c){return _0x5aec4c;});}return null;};}function removeEntity(_0x5a7fce,_0x11983b){return function(_0x51bceb){if(_0x51bceb){return _0x51bceb[_0xb2e9('0x38')]()[_0xb2e9('0x25')](function(){var _0x98373=_0x51bceb[_0xb2e9('0x39')]({'plain':!![]});var _0x18540e='MailAccounts';return db[_0xb2e9('0x3a')][_0xb2e9('0x38')]({'where':{'type':_0x18540e,'resourceId':_0x98373['id']}})[_0xb2e9('0x25')](function(){return _0x51bceb;});})['then'](function(){_0x5a7fce['status'](0xcc)[_0xb2e9('0x30')]();});}};}function handleEntityNotFound(_0x105c2b,_0x59446f){return function(_0x2607d4){if(!_0x2607d4){_0x105c2b[_0xb2e9('0x2e')](0x194);}return _0x2607d4;};}function handleError(_0x393474,_0x53b3b3){_0x53b3b3=_0x53b3b3||0x1f4;return function(_0x45bbf4){logger['error'](_0x45bbf4[_0xb2e9('0x3b')]);if(_0x45bbf4[_0xb2e9('0x3c')]){delete _0x45bbf4[_0xb2e9('0x3c')];}_0x393474[_0xb2e9('0x2f')](_0x53b3b3)['send'](_0x45bbf4);};}exports[_0xb2e9('0x3d')]=function(_0x482a8c,_0x45436a){var _0x277fc9={'include':[{'model':db[_0xb2e9('0x3e')],'as':'Imap'},{'model':db[_0xb2e9('0x3f')],'as':_0xb2e9('0x40')},{'model':db[_0xb2e9('0x41')],'as':_0xb2e9('0x42')}]},_0x536596={},_0x4e98b8={'count':0x0,'rows':[]};var _0x2d2a8e=_[_0xb2e9('0x43')](db[_0xb2e9('0x44')][_0xb2e9('0x45')],function(_0x523888){return{'name':_0x523888[_0xb2e9('0x46')],'type':_0x523888[_0xb2e9('0x47')][_0xb2e9('0x48')]};});_0x536596['model']=_[_0xb2e9('0x43')](_0x2d2a8e,_0xb2e9('0x3c'));_0x536596[_0xb2e9('0x49')]=_[_0xb2e9('0x4a')](_0x482a8c[_0xb2e9('0x49')]);_0x536596[_0xb2e9('0x4b')]=_['intersection'](_0x536596[_0xb2e9('0x4c')],_0x536596['query']);_0x277fc9[_0xb2e9('0x4d')]=_['intersection'](_0x536596['model'],qs['fields'](_0x482a8c[_0xb2e9('0x49')]['fields']));_0x277fc9['attributes']=_0x277fc9[_0xb2e9('0x4d')][_0xb2e9('0x4e')]?_0x277fc9[_0xb2e9('0x4d')]:_0x536596['model'];if(!_0x482a8c['query'][_0xb2e9('0x4f')](_0xb2e9('0x50'))){_0x277fc9[_0xb2e9('0x33')]=qs[_0xb2e9('0x33')](_0x482a8c[_0xb2e9('0x49')][_0xb2e9('0x33')]);_0x277fc9['offset']=qs[_0xb2e9('0x32')](_0x482a8c['query']['offset']);}_0x277fc9[_0xb2e9('0x51')]=qs[_0xb2e9('0x52')](_0x482a8c[_0xb2e9('0x49')][_0xb2e9('0x52')]);_0x277fc9[_0xb2e9('0x53')]=qs[_0xb2e9('0x4b')](_[_0xb2e9('0x54')](_0x482a8c[_0xb2e9('0x49')],_0x536596['filters']),_0x2d2a8e);if(_0x482a8c[_0xb2e9('0x49')]['filter']){_0x277fc9[_0xb2e9('0x53')]=_[_0xb2e9('0x55')](_0x277fc9[_0xb2e9('0x53')],{'$or':_[_0xb2e9('0x43')](_0x2d2a8e,function(_0x5c05db){if(_0x5c05db[_0xb2e9('0x47')]!==_0xb2e9('0x56')){var _0x4b0247={};_0x4b0247[_0x5c05db[_0xb2e9('0x3c')]]={'$like':'%'+_0x482a8c[_0xb2e9('0x49')][_0xb2e9('0x57')]+'%'};return _0x4b0247;}})});}_0x277fc9=_['merge']({},_0x277fc9,_0x482a8c[_0xb2e9('0x58')]);var _0x5caa44={'where':_0x277fc9[_0xb2e9('0x53')]};return db[_0xb2e9('0x44')][_0xb2e9('0x31')](_0x5caa44)[_0xb2e9('0x25')](function(_0x121212){_0x4e98b8['count']=_0x121212;if(_0x482a8c[_0xb2e9('0x49')]['includeAll']){_0x277fc9[_0xb2e9('0x59')]=[{'all':!![]}];}return db[_0xb2e9('0x44')][_0xb2e9('0x5a')](_0x277fc9);})[_0xb2e9('0x25')](function(_0x4291c5){_0x4e98b8[_0xb2e9('0x5b')]=_0x4291c5;return _0x4e98b8;})[_0xb2e9('0x25')](respondWithFilteredResult(_0x45436a,_0x277fc9))[_0xb2e9('0x2d')](handleError(_0x45436a,null));};exports[_0xb2e9('0x5c')]=function(_0x4bc0af,_0x2f1b2a){var _0x5116ac={'raw':![],'where':{'id':_0x4bc0af[_0xb2e9('0x5d')]['id']},'include':[{'model':db[_0xb2e9('0x3e')],'as':_0xb2e9('0x5e')},{'model':db['MailServerOut'],'as':_0xb2e9('0x40')},{'model':db[_0xb2e9('0x41')],'as':_0xb2e9('0x42')}]},_0x2b9a3b={};_0x2b9a3b[_0xb2e9('0x4c')]=_[_0xb2e9('0x4a')](db[_0xb2e9('0x44')][_0xb2e9('0x45')]);_0x2b9a3b[_0xb2e9('0x49')]=_[_0xb2e9('0x4a')](_0x4bc0af[_0xb2e9('0x49')]);_0x2b9a3b['filters']=_[_0xb2e9('0x5f')](_0x2b9a3b['model'],_0x2b9a3b['query']);_0x5116ac[_0xb2e9('0x4d')]=_[_0xb2e9('0x5f')](_0x2b9a3b['model'],qs[_0xb2e9('0x60')](_0x4bc0af[_0xb2e9('0x49')]['fields']));_0x5116ac[_0xb2e9('0x4d')]=_0x5116ac[_0xb2e9('0x4d')][_0xb2e9('0x4e')]?_0x5116ac[_0xb2e9('0x4d')]:_0x2b9a3b['model'];if(_0x4bc0af['query']['includeAll']){_0x5116ac[_0xb2e9('0x59')]=[{'all':!![]}];}_0x5116ac=_[_0xb2e9('0x55')]({},_0x5116ac,_0x4bc0af[_0xb2e9('0x58')]);return db[_0xb2e9('0x44')][_0xb2e9('0x61')](_0x5116ac)[_0xb2e9('0x25')](handleEntityNotFound(_0x2f1b2a,null))[_0xb2e9('0x25')](respondWithResult(_0x2f1b2a,null))['catch'](handleError(_0x2f1b2a,null));};exports['update']=function(_0x59b1b8,_0x2fc116){if(_0x59b1b8[_0xb2e9('0x62')]['id']){delete _0x59b1b8[_0xb2e9('0x62')]['id'];}return db[_0xb2e9('0x44')]['find']({'where':{'id':_0x59b1b8[_0xb2e9('0x5d')]['id']},'include':[{'model':db[_0xb2e9('0x3e')],'as':_0xb2e9('0x5e')},{'model':db[_0xb2e9('0x3f')],'as':_0xb2e9('0x40')},{'model':db[_0xb2e9('0x41')],'as':_0xb2e9('0x42')}]})[_0xb2e9('0x25')](handleEntityNotFound(_0x2fc116,null))[_0xb2e9('0x25')](saveUpdates(_0x59b1b8['body'],null))[_0xb2e9('0x25')](function(_0xbc6fdd){if(_0xbc6fdd&&_0x59b1b8['body'][_0xb2e9('0x5e')]){return db['MailServerIn']['update'](_0x59b1b8[_0xb2e9('0x62')][_0xb2e9('0x5e')],{'where':{'MailAccountId':_0xbc6fdd['id']}})[_0xb2e9('0x25')](function(){return _0xbc6fdd;});}return _0xbc6fdd;})[_0xb2e9('0x25')](function(_0x2ab5d6){if(_0x2ab5d6&&_0x59b1b8[_0xb2e9('0x62')]['Smtp']){return db[_0xb2e9('0x3f')][_0xb2e9('0x37')](_0x59b1b8[_0xb2e9('0x62')][_0xb2e9('0x40')],{'where':{'MailAccountId':_0x2ab5d6['id']}})['then'](function(){return _0x2ab5d6;});}return _0x2ab5d6;})['then'](respondWithResult(_0x2fc116,null))[_0xb2e9('0x2d')](handleError(_0x2fc116,null));};exports['describe']=function(_0x433fea,_0x104eb6){return db['MailAccount']['describe']()[_0xb2e9('0x25')](respondWithResult(_0x104eb6,null))[_0xb2e9('0x2d')](handleError(_0x104eb6,null));};exports[_0xb2e9('0x63')]=function(_0x12f0b2,_0x550c1d,_0x3dd09a){if(_0x12f0b2[_0xb2e9('0x62')]['id']){delete _0x12f0b2[_0xb2e9('0x62')]['id'];}return db[_0xb2e9('0x44')]['find']({'where':{'id':_0x12f0b2[_0xb2e9('0x5d')]['id']}})[_0xb2e9('0x25')](handleEntityNotFound(_0x550c1d,null))[_0xb2e9('0x25')](function(_0x590a71){if(_0x590a71){_0x12f0b2['body']['MailAccountId']=_0x590a71['id'];return db['Disposition'][_0xb2e9('0x64')](_0x12f0b2[_0xb2e9('0x62')]);}})[_0xb2e9('0x25')](respondWithResult(_0x550c1d,null))[_0xb2e9('0x2d')](handleError(_0x550c1d,null));};exports[_0xb2e9('0x65')]=function(_0x16819f,_0x1bda73,_0x45ba7b){var _0x1083a6={'raw':![],'where':{}};var _0x15e081={};var _0x102d03={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x16819f[_0xb2e9('0x5d')]['id']}})[_0xb2e9('0x25')](handleEntityNotFound(_0x1bda73,null))[_0xb2e9('0x25')](function(_0x5c2ca8){if(_0x5c2ca8){_0x15e081[_0xb2e9('0x4c')]=_[_0xb2e9('0x4a')](db[_0xb2e9('0x66')][_0xb2e9('0x45')]);_0x15e081[_0xb2e9('0x49')]=_[_0xb2e9('0x4a')](_0x16819f['query']);_0x15e081[_0xb2e9('0x4b')]=_[_0xb2e9('0x5f')](_0x15e081['model'],_0x15e081[_0xb2e9('0x49')]);_0x1083a6['attributes']=_[_0xb2e9('0x5f')](_0x15e081['model'],qs[_0xb2e9('0x60')](_0x16819f[_0xb2e9('0x49')][_0xb2e9('0x60')]));_0x1083a6[_0xb2e9('0x4d')]=_0x1083a6[_0xb2e9('0x4d')][_0xb2e9('0x4e')]?_0x1083a6[_0xb2e9('0x4d')]:_0x15e081[_0xb2e9('0x4c')];if(!_0x16819f['query'][_0xb2e9('0x4f')](_0xb2e9('0x50'))){_0x1083a6[_0xb2e9('0x33')]=qs[_0xb2e9('0x33')](_0x16819f[_0xb2e9('0x49')][_0xb2e9('0x33')]);_0x1083a6[_0xb2e9('0x32')]=qs[_0xb2e9('0x32')](_0x16819f['query']['offset']);}_0x1083a6[_0xb2e9('0x51')]=qs[_0xb2e9('0x52')](_0x16819f[_0xb2e9('0x49')]['sort']);_0x1083a6[_0xb2e9('0x53')]=qs[_0xb2e9('0x4b')](_['pick'](_0x16819f[_0xb2e9('0x49')],_0x15e081[_0xb2e9('0x4b')]));_0x1083a6['where'][_0xb2e9('0x67')]=_0x5c2ca8['id'];if(_0x16819f[_0xb2e9('0x49')]['filter']){_0x1083a6[_0xb2e9('0x53')]=_[_0xb2e9('0x55')](_0x1083a6[_0xb2e9('0x53')],{'$or':_[_0xb2e9('0x43')](_0x1083a6[_0xb2e9('0x4d')],function(_0x41acc4){var _0x4ceb64={};_0x4ceb64[_0x41acc4]={'$like':'%'+_0x16819f[_0xb2e9('0x49')][_0xb2e9('0x57')]+'%'};return _0x4ceb64;})});}_0x1083a6=_['merge']({},_0x1083a6,_0x16819f['options']);return db[_0xb2e9('0x66')][_0xb2e9('0x31')]({'where':_0x1083a6[_0xb2e9('0x53')]})[_0xb2e9('0x25')](function(_0x1003f2){_0x102d03[_0xb2e9('0x31')]=_0x1003f2;if(_0x16819f[_0xb2e9('0x49')]['includeAll']){_0x1083a6[_0xb2e9('0x59')]=[{'all':!![]}];}return db['Disposition'][_0xb2e9('0x5a')](_0x1083a6);})['then'](function(_0x31f86b){_0x102d03['rows']=_0x31f86b;return _0x102d03;});}})[_0xb2e9('0x25')](respondWithFilteredResult(_0x1bda73,_0x1083a6))[_0xb2e9('0x2d')](handleError(_0x1bda73,null));};exports[_0xb2e9('0x68')]=function(_0x20ddd9,_0x4c5c56,_0x134d4e){return db['MailAccount'][_0xb2e9('0x61')]({'where':{'id':_0x20ddd9[_0xb2e9('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4c5c56,null))[_0xb2e9('0x25')](function(_0x50e916){if(_0x50e916){return _0x50e916['removeDispositions'](_0x20ddd9[_0xb2e9('0x49')][_0xb2e9('0x69')]);}})['then'](respondWithStatusCode(_0x4c5c56,null))[_0xb2e9('0x2d')](handleError(_0x4c5c56,null));};exports[_0xb2e9('0x6a')]=function(_0x3f9f4c,_0x2b7dcd,_0x5f6f41){if(_0x3f9f4c['body']['id']){delete _0x3f9f4c[_0xb2e9('0x62')]['id'];}return db[_0xb2e9('0x44')]['find']({'where':{'id':_0x3f9f4c[_0xb2e9('0x5d')]['id']}})[_0xb2e9('0x25')](handleEntityNotFound(_0x2b7dcd,null))['then'](function(_0x408ae8){if(_0x408ae8){_0x3f9f4c[_0xb2e9('0x62')][_0xb2e9('0x67')]=_0x408ae8['id'];return db['CannedAnswer'][_0xb2e9('0x64')](_0x3f9f4c[_0xb2e9('0x62')]);}})[_0xb2e9('0x25')](respondWithResult(_0x2b7dcd,null))[_0xb2e9('0x2d')](handleError(_0x2b7dcd,null));};exports['getAnswers']=function(_0x33b8db,_0x293722,_0xca1a14){var _0x52957b={'raw':![],'where':{}};var _0x501bc3={};var _0x1af8ff={'count':0x0,'rows':[]};return db[_0xb2e9('0x44')][_0xb2e9('0x6b')]({'where':{'id':_0x33b8db[_0xb2e9('0x5d')]['id']}})['then'](handleEntityNotFound(_0x293722,null))[_0xb2e9('0x25')](function(_0x3fa646){if(_0x3fa646){_0x501bc3[_0xb2e9('0x4c')]=_['keys'](db['CannedAnswer'][_0xb2e9('0x45')]);_0x501bc3[_0xb2e9('0x49')]=_[_0xb2e9('0x4a')](_0x33b8db['query']);_0x501bc3['filters']=_[_0xb2e9('0x5f')](_0x501bc3[_0xb2e9('0x4c')],_0x501bc3[_0xb2e9('0x49')]);_0x52957b[_0xb2e9('0x4d')]=_['intersection'](_0x501bc3[_0xb2e9('0x4c')],qs['fields'](_0x33b8db[_0xb2e9('0x49')][_0xb2e9('0x60')]));_0x52957b[_0xb2e9('0x4d')]=_0x52957b['attributes'][_0xb2e9('0x4e')]?_0x52957b[_0xb2e9('0x4d')]:_0x501bc3[_0xb2e9('0x4c')];if(!_0x33b8db[_0xb2e9('0x49')]['hasOwnProperty'](_0xb2e9('0x50'))){_0x52957b[_0xb2e9('0x33')]=qs[_0xb2e9('0x33')](_0x33b8db[_0xb2e9('0x49')][_0xb2e9('0x33')]);_0x52957b[_0xb2e9('0x32')]=qs[_0xb2e9('0x32')](_0x33b8db['query'][_0xb2e9('0x32')]);}_0x52957b[_0xb2e9('0x51')]=qs[_0xb2e9('0x52')](_0x33b8db[_0xb2e9('0x49')]['sort']);_0x52957b['where']=qs[_0xb2e9('0x4b')](_[_0xb2e9('0x54')](_0x33b8db['query'],_0x501bc3[_0xb2e9('0x4b')]));_0x52957b[_0xb2e9('0x53')][_0xb2e9('0x67')]=_0x3fa646['id'];if(_0x33b8db[_0xb2e9('0x49')][_0xb2e9('0x57')]){_0x52957b[_0xb2e9('0x53')]=_['merge'](_0x52957b['where'],{'$or':_[_0xb2e9('0x43')](_0x52957b[_0xb2e9('0x4d')],function(_0x5e9beb){var _0x274ac5={};_0x274ac5[_0x5e9beb]={'$like':'%'+_0x33b8db[_0xb2e9('0x49')][_0xb2e9('0x57')]+'%'};return _0x274ac5;})});}_0x52957b=_[_0xb2e9('0x55')]({},_0x52957b,_0x33b8db[_0xb2e9('0x58')]);return db[_0xb2e9('0x6c')][_0xb2e9('0x31')]({'where':_0x52957b[_0xb2e9('0x53')]})[_0xb2e9('0x25')](function(_0xba6049){_0x1af8ff['count']=_0xba6049;if(_0x33b8db[_0xb2e9('0x49')]['includeAll']){_0x52957b['include']=[{'all':!![]}];}return db[_0xb2e9('0x6c')][_0xb2e9('0x5a')](_0x52957b);})[_0xb2e9('0x25')](function(_0x557118){_0x1af8ff[_0xb2e9('0x5b')]=_0x557118;return _0x1af8ff;});}})[_0xb2e9('0x25')](respondWithFilteredResult(_0x293722,_0x52957b))[_0xb2e9('0x2d')](handleError(_0x293722,null));};exports[_0xb2e9('0x6d')]=function(_0x21fe28,_0x4bfaad,_0x1b814f){return db['MailAccount'][_0xb2e9('0x61')]({'where':{'id':_0x21fe28[_0xb2e9('0x5d')]['id']}})[_0xb2e9('0x25')](handleEntityNotFound(_0x4bfaad,null))[_0xb2e9('0x25')](function(_0x249ef5){if(_0x249ef5){return _0x249ef5[_0xb2e9('0x6d')](_0x21fe28[_0xb2e9('0x49')][_0xb2e9('0x69')]);}})[_0xb2e9('0x25')](respondWithStatusCode(_0x4bfaad,null))[_0xb2e9('0x2d')](handleError(_0x4bfaad,null));};exports[_0xb2e9('0x64')]=function(_0x597594,_0x5aebf0){var _0x46bd04={'name':_0x597594[_0xb2e9('0x62')][_0xb2e9('0x3c')],'key':_0x597594[_0xb2e9('0x62')][_0xb2e9('0x48')],'email':_0x597594[_0xb2e9('0x62')][_0xb2e9('0x6e')],'ListId':_0x597594['body'][_0xb2e9('0x6f')],'active':!_[_0xb2e9('0x70')](_0x597594[_0xb2e9('0x62')]['active'])?_0x597594['body'][_0xb2e9('0x71')]:!![],'description':_0x597594[_0xb2e9('0x62')][_0xb2e9('0x72')]||null,'Imap':{},'Smtp':{}};if(_[_0xb2e9('0x70')](_0x597594[_0xb2e9('0x62')][_0xb2e9('0x73')])){if(_0x597594['body'][_0xb2e9('0x74')]){_0x46bd04[_0xb2e9('0x5e')][_0xb2e9('0x75')]=_0x46bd04['Smtp'][_0xb2e9('0x75')]=_0x597594['body'][_0xb2e9('0x76')];_0x46bd04[_0xb2e9('0x5e')][_0xb2e9('0x77')]=_0x46bd04[_0xb2e9('0x40')][_0xb2e9('0x78')]=_0x597594[_0xb2e9('0x62')][_0xb2e9('0x79')];}else{_0x46bd04[_0xb2e9('0x5e')][_0xb2e9('0x7a')]=_0x46bd04[_0xb2e9('0x40')][_0xb2e9('0x7a')]=![];}_0x46bd04[_0xb2e9('0x5e')][_0xb2e9('0x7b')]=_0x597594['body'][_0xb2e9('0x5e')][_0xb2e9('0x7b')];_0x46bd04[_0xb2e9('0x5e')][_0xb2e9('0x7c')]=_0x597594[_0xb2e9('0x62')][_0xb2e9('0x5e')][_0xb2e9('0x7c')];_0x46bd04['Smtp'][_0xb2e9('0x7b')]=_0x597594['body']['Smtp'][_0xb2e9('0x7b')];_0x46bd04[_0xb2e9('0x40')][_0xb2e9('0x7c')]=_0x597594[_0xb2e9('0x62')][_0xb2e9('0x40')][_0xb2e9('0x7c')];}else{_0x46bd04['Imap'][_0xb2e9('0x7d')]=_0x46bd04[_0xb2e9('0x40')][_0xb2e9('0x7d')]=_0x597594[_0xb2e9('0x62')][_0xb2e9('0x73')];_0x46bd04[_0xb2e9('0x5e')]['user']=_0x46bd04['Smtp'][_0xb2e9('0x75')]=_0x597594[_0xb2e9('0x62')][_0xb2e9('0x76')];_0x46bd04[_0xb2e9('0x5e')][_0xb2e9('0x77')]=_0x46bd04[_0xb2e9('0x40')][_0xb2e9('0x78')]=_0x597594[_0xb2e9('0x62')][_0xb2e9('0x79')];}return db['MailAccount'][_0xb2e9('0x64')](_0x46bd04,{'include':[{'model':db[_0xb2e9('0x3f')],'as':'Smtp'},{'model':db[_0xb2e9('0x3e')],'as':'Imap'}]})['then'](function(_0x23b6a0){var _0x17e4f4=_0x597594[_0xb2e9('0x75')][_0xb2e9('0x39')]({'plain':!![]});if(!_0x17e4f4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17e4f4[_0xb2e9('0x7e')]===_0xb2e9('0x75')){var _0x4b4646=_0x23b6a0[_0xb2e9('0x39')]({'plain':!![]});return db[_0xb2e9('0x7f')][_0xb2e9('0x61')]({'where':{'name':_0xb2e9('0x80'),'userProfileId':_0x17e4f4[_0xb2e9('0x81')]},'raw':!![]})[_0xb2e9('0x25')](function(_0x165433){if(_0x165433&&_0x165433[_0xb2e9('0x82')]===0x0){return db[_0xb2e9('0x3a')][_0xb2e9('0x64')]({'name':_0x4b4646[_0xb2e9('0x3c')],'resourceId':_0x4b4646['id'],'type':_0x165433[_0xb2e9('0x3c')],'sectionId':_0x165433['id']},{})[_0xb2e9('0x25')](function(){return _0x23b6a0;});}else{return _0x23b6a0;}})[_0xb2e9('0x2d')](function(_0x2d2d1c){logger[_0xb2e9('0x28')](_0xb2e9('0x83'),_0x2d2d1c);throw _0x2d2d1c;});}return _0x23b6a0;})['then'](respondWithResult(_0x5aebf0,0xc9))[_0xb2e9('0x2d')](handleError(_0x5aebf0,null));};exports['getImap']=function(_0x4e7c4e,_0x2a4652,_0xf30a37){return db[_0xb2e9('0x44')]['findOne']({'where':{'id':_0x4e7c4e[_0xb2e9('0x5d')]['id']}})[_0xb2e9('0x25')](handleEntityNotFound(_0x2a4652,null))[_0xb2e9('0x25')](function(_0x58c3a0){if(_0x58c3a0){return _0x58c3a0[_0xb2e9('0x84')]();}return null;})[_0xb2e9('0x25')](respondWithResult(_0x2a4652,null))[_0xb2e9('0x2d')](handleError(_0x2a4652,null));};exports[_0xb2e9('0x85')]=function(_0x22bad8,_0x5de770,_0xd25f92){if(_0x22bad8[_0xb2e9('0x62')]['id']){delete _0x22bad8[_0xb2e9('0x62')]['id'];}return db[_0xb2e9('0x44')][_0xb2e9('0x61')]({'where':{'id':_0x22bad8[_0xb2e9('0x5d')]['id']}})[_0xb2e9('0x25')](handleEntityNotFound(_0x5de770,null))[_0xb2e9('0x25')](function(_0x3ecae0){if(_0x3ecae0){_0x22bad8[_0xb2e9('0x62')][_0xb2e9('0x67')]=_0x3ecae0['id'];return db['MailServerIn'][_0xb2e9('0x64')](_0x22bad8[_0xb2e9('0x62')]);}})[_0xb2e9('0x25')](respondWithResult(_0x5de770,null))['catch'](handleError(_0x5de770,null));};exports[_0xb2e9('0x86')]=function(_0x5aedb2,_0x5cc7da,_0x284172){return db[_0xb2e9('0x44')][_0xb2e9('0x6b')]({'where':{'id':_0x5aedb2['params']['id']}})['then'](handleEntityNotFound(_0x5cc7da,null))['then'](function(_0x37a006){if(_0x37a006){return _0x37a006[_0xb2e9('0x87')](null);}return null;})[_0xb2e9('0x25')](respondWithStatusCode(_0x5cc7da,null))['catch'](handleError(_0x5cc7da,null));};exports[_0xb2e9('0x88')]=function(_0x148b16,_0x296dca,_0x7329c7){return db[_0xb2e9('0x44')][_0xb2e9('0x6b')]({'where':{'id':_0x148b16[_0xb2e9('0x5d')]['id']}})[_0xb2e9('0x25')](handleEntityNotFound(_0x296dca,null))[_0xb2e9('0x25')](function(_0x268983){if(_0x268983){return _0x268983[_0xb2e9('0x88')]();}return null;})[_0xb2e9('0x25')](respondWithResult(_0x296dca,null))['catch'](handleError(_0x296dca,null));};exports[_0xb2e9('0x89')]=function(_0x475ada,_0x2f4152,_0xce5c4b){if(_0x475ada[_0xb2e9('0x62')]['id']){delete _0x475ada['body']['id'];}return db['MailAccount'][_0xb2e9('0x61')]({'where':{'id':_0x475ada[_0xb2e9('0x5d')]['id']}})[_0xb2e9('0x25')](handleEntityNotFound(_0x2f4152,null))[_0xb2e9('0x25')](function(_0x275b4f){if(_0x275b4f){_0x475ada[_0xb2e9('0x62')][_0xb2e9('0x67')]=_0x275b4f['id'];return db['MailServerOut'][_0xb2e9('0x64')](_0x475ada[_0xb2e9('0x62')]);}})[_0xb2e9('0x25')](respondWithResult(_0x2f4152,null))['catch'](handleError(_0x2f4152,null));};exports[_0xb2e9('0x8a')]=function(_0x25dac1,_0x58ea22,_0x44430b){return db[_0xb2e9('0x44')][_0xb2e9('0x6b')]({'where':{'id':_0x25dac1[_0xb2e9('0x5d')]['id']}})[_0xb2e9('0x25')](handleEntityNotFound(_0x58ea22,null))[_0xb2e9('0x25')](function(_0x58d5e7){if(_0x58d5e7){return _0x58d5e7[_0xb2e9('0x8b')](null);}return null;})[_0xb2e9('0x25')](respondWithStatusCode(_0x58ea22,null))[_0xb2e9('0x2d')](handleError(_0x58ea22,null));};exports['addInteraction']=function(_0x4c3eee,_0x2fe26f,_0x310ba4){return db[_0xb2e9('0x8c')][_0xb2e9('0x61')]({'where':{'id':_0x4c3eee[_0xb2e9('0x5d')]['id']}})[_0xb2e9('0x25')](handleEntityNotFound(_0x2fe26f,null))[_0xb2e9('0x25')](function(_0x35f7cc){if(_0x35f7cc){return _0x35f7cc[_0xb2e9('0x8d')](_0x4c3eee['body']['ids'],_[_0xb2e9('0x8e')](_0x4c3eee[_0xb2e9('0x62')],[_0xb2e9('0x69'),'id'])||{});}})[_0xb2e9('0x25')](respondWithResult(_0x2fe26f,null))[_0xb2e9('0x2d')](handleError(_0x2fe26f,null));};exports[_0xb2e9('0x8f')]=function(_0x1aedba,_0x579ac3,_0x2d6fd1){var _0x43d9d6={'raw':![],'where':{}};var _0x5461c4={};var _0x25f118={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1aedba['params']['id']}})['then'](handleEntityNotFound(_0x579ac3,null))[_0xb2e9('0x25')](function(_0x2fd7b5){if(_0x2fd7b5){_0x5461c4['model']=_['keys'](db['MailInteraction'][_0xb2e9('0x45')]);_0x5461c4[_0xb2e9('0x49')]=_[_0xb2e9('0x4a')](_0x1aedba[_0xb2e9('0x49')]);_0x5461c4[_0xb2e9('0x4b')]=_[_0xb2e9('0x5f')](_0x5461c4['model'],_0x5461c4[_0xb2e9('0x49')]);_0x43d9d6[_0xb2e9('0x4d')]=_[_0xb2e9('0x5f')](_0x5461c4['model'],qs[_0xb2e9('0x60')](_0x1aedba[_0xb2e9('0x49')][_0xb2e9('0x60')]));_0x43d9d6[_0xb2e9('0x4d')]=_0x43d9d6[_0xb2e9('0x4d')][_0xb2e9('0x4e')]?_0x43d9d6['attributes']:_0x5461c4[_0xb2e9('0x4c')];if(!_0x1aedba[_0xb2e9('0x49')][_0xb2e9('0x4f')]('nolimit')){_0x43d9d6[_0xb2e9('0x33')]=qs[_0xb2e9('0x33')](_0x1aedba[_0xb2e9('0x49')]['limit']);_0x43d9d6[_0xb2e9('0x32')]=qs['offset'](_0x1aedba[_0xb2e9('0x49')]['offset']);}_0x43d9d6['order']=qs[_0xb2e9('0x52')](_0x1aedba[_0xb2e9('0x49')]['sort']);_0x43d9d6[_0xb2e9('0x53')]=qs[_0xb2e9('0x4b')](_['pick'](_0x1aedba[_0xb2e9('0x49')],_0x5461c4[_0xb2e9('0x4b')]));_0x43d9d6['where'][_0xb2e9('0x67')]=_0x2fd7b5['id'];if(_0x1aedba[_0xb2e9('0x49')][_0xb2e9('0x57')]){_0x43d9d6[_0xb2e9('0x53')]=_[_0xb2e9('0x55')](_0x43d9d6[_0xb2e9('0x53')],{'$or':_[_0xb2e9('0x43')](_0x43d9d6[_0xb2e9('0x4d')],function(_0x11a1ad){var _0x4de8eb={};_0x4de8eb[_0x11a1ad]={'$like':'%'+_0x1aedba[_0xb2e9('0x49')][_0xb2e9('0x57')]+'%'};return _0x4de8eb;})});}_0x43d9d6=_[_0xb2e9('0x55')]({},_0x43d9d6,_0x1aedba[_0xb2e9('0x58')]);return db[_0xb2e9('0x8c')][_0xb2e9('0x31')]({'where':_0x43d9d6[_0xb2e9('0x53')]})[_0xb2e9('0x25')](function(_0x367a67){_0x25f118[_0xb2e9('0x31')]=_0x367a67;if(_0x1aedba['query'][_0xb2e9('0x90')]){_0x43d9d6['include']=[{'model':db[_0xb2e9('0x91')],'as':_0xb2e9('0x92'),'required':![]},{'model':db[_0xb2e9('0x93')],'as':_0xb2e9('0x94'),'attributes':[_0xb2e9('0x3c'),_0xb2e9('0x95'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xb2e9('0x96'),'attributes':['id',_0xb2e9('0x3c'),'color'],'where':_0x1aedba['query'][_0xb2e9('0x97')]?{'id':_0x1aedba[_0xb2e9('0x49')][_0xb2e9('0x97')]}:undefined,'required':_0x1aedba[_0xb2e9('0x49')][_0xb2e9('0x97')]?!![]:![]}];}return db['MailInteraction'][_0xb2e9('0x5a')](_0x43d9d6);})[_0xb2e9('0x25')](function(_0x32b66a){_0x25f118['rows']=_0x32b66a;return _0x25f118;});}})[_0xb2e9('0x25')](respondWithFilteredResult(_0x579ac3,_0x43d9d6))[_0xb2e9('0x2d')](handleError(_0x579ac3,null));};exports[_0xb2e9('0x98')]=function(_0x17251e,_0x1f987b,_0x1508a8){return db[_0xb2e9('0x44')][_0xb2e9('0x6b')]({'where':{'id':_0x17251e['params']['id']}})[_0xb2e9('0x25')](handleEntityNotFound(_0x1f987b,null))[_0xb2e9('0x25')](function(_0x1c4d38){if(_0x1c4d38){return db[_0xb2e9('0x99')][_0xb2e9('0x9a')](function(_0x3a9c97){return db[_0xb2e9('0x9b')][_0xb2e9('0x38')]({'where':{'MailAccountId':_0x17251e[_0xb2e9('0x5d')]['id']},'transaction':_0x3a9c97})[_0xb2e9('0x25')](function(_0x32054c){var _0x5c148e=_[_0xb2e9('0x43')](_0x17251e[_0xb2e9('0x62')],function(_0x127383){_0x127383[_0xb2e9('0x67')]=_0x17251e[_0xb2e9('0x5d')]['id'];return _0x127383;});return db['MailApplication'][_0xb2e9('0x9c')](_0x5c148e,{'transaction':_0x3a9c97});});})[_0xb2e9('0x25')](function(){return db['MailApplication'][_0xb2e9('0x9d')]({'where':{'MailAccountId':_0x17251e[_0xb2e9('0x5d')]['id']},'order':_0xb2e9('0x9e')});});}})[_0xb2e9('0x25')](respondWithResult(_0x1f987b,null))['catch'](handleError(_0x1f987b,null));};exports[_0xb2e9('0x9f')]=function(_0x29c90c,_0x473892,_0x28ffaf){var _0x4a3265={};var _0x15151e={};var _0x4f20df;var _0x3d6dcd;return db['MailAccount'][_0xb2e9('0x6b')]({'where':{'id':_0x29c90c[_0xb2e9('0x5d')]['id']}})[_0xb2e9('0x25')](handleEntityNotFound(_0x473892,null))['then'](function(_0x56b3fd){if(_0x56b3fd){_0x4f20df=_0x56b3fd;_0x15151e[_0xb2e9('0x4c')]=_[_0xb2e9('0x4a')](db['MailApplication'][_0xb2e9('0x45')]);_0x15151e[_0xb2e9('0x49')]=_[_0xb2e9('0x4a')](_0x29c90c['query']);_0x15151e[_0xb2e9('0x4b')]=_[_0xb2e9('0x5f')](_0x15151e['model'],_0x15151e[_0xb2e9('0x49')]);_0x4a3265['attributes']=_['intersection'](_0x15151e[_0xb2e9('0x4c')],qs[_0xb2e9('0x60')](_0x29c90c[_0xb2e9('0x49')][_0xb2e9('0x60')]));_0x4a3265['attributes']=_0x4a3265[_0xb2e9('0x4d')][_0xb2e9('0x4e')]?_0x4a3265[_0xb2e9('0x4d')]:_0x15151e[_0xb2e9('0x4c')];_0x4a3265['order']=qs[_0xb2e9('0x52')](_0x29c90c[_0xb2e9('0x49')][_0xb2e9('0x52')]);_0x4a3265[_0xb2e9('0x53')]=qs[_0xb2e9('0x4b')](_[_0xb2e9('0x54')](_0x29c90c[_0xb2e9('0x49')],_0x15151e[_0xb2e9('0x4b')]));if(_0x29c90c[_0xb2e9('0x49')][_0xb2e9('0x57')]){_0x4a3265[_0xb2e9('0x53')]=_['merge'](_0x4a3265[_0xb2e9('0x53')],{'$or':_[_0xb2e9('0x43')](_0x4a3265[_0xb2e9('0x4d')],function(_0x12344c){var _0x5d1931={};_0x5d1931[_0x12344c]={'$like':'%'+_0x29c90c[_0xb2e9('0x49')][_0xb2e9('0x57')]+'%'};return _0x5d1931;})});}_0x4a3265=_[_0xb2e9('0x55')]({},_0x4a3265,_0x29c90c[_0xb2e9('0x58')]);return _0x4f20df[_0xb2e9('0x9f')](_0x4a3265);}})[_0xb2e9('0x25')](function(_0x1c580e){if(_0x1c580e){_0x3d6dcd=_0x1c580e[_0xb2e9('0x4e')];if(!_0x29c90c['query'][_0xb2e9('0x4f')](_0xb2e9('0x50'))){_0x4a3265[_0xb2e9('0x33')]=qs[_0xb2e9('0x33')](_0x29c90c[_0xb2e9('0x49')][_0xb2e9('0x33')]);_0x4a3265[_0xb2e9('0x32')]=qs['offset'](_0x29c90c[_0xb2e9('0x49')]['offset']);}return _0x4f20df[_0xb2e9('0x9f')](_0x4a3265);}})[_0xb2e9('0x25')](function(_0x4c6ec2){if(_0x4c6ec2){return _0x4c6ec2?{'count':_0x3d6dcd,'rows':_0x4c6ec2}:null;}})['then'](respondWithResult(_0x473892,null))[_0xb2e9('0x2d')](handleError(_0x473892,null));};exports['getMessages']=function(_0x1a4d41,_0x5dba28,_0x5b7496){var _0x158428={'raw':!![],'where':{}};var _0x139e43={};var _0x1a700a={'count':0x0,'rows':[]};return db[_0xb2e9('0x44')][_0xb2e9('0x6b')]({'where':{'id':_0x1a4d41['params']['id']}})[_0xb2e9('0x25')](handleEntityNotFound(_0x5dba28,null))[_0xb2e9('0x25')](function(_0x26c90f){if(_0x26c90f){_0x139e43[_0xb2e9('0x4c')]=_[_0xb2e9('0x4a')](db[_0xb2e9('0xa0')][_0xb2e9('0x45')]);_0x139e43[_0xb2e9('0x49')]=_[_0xb2e9('0x4a')](_0x1a4d41[_0xb2e9('0x49')]);_0x139e43[_0xb2e9('0x4b')]=_[_0xb2e9('0x5f')](_0x139e43[_0xb2e9('0x4c')],_0x139e43[_0xb2e9('0x49')]);_0x158428[_0xb2e9('0x4d')]=_[_0xb2e9('0x5f')](_0x139e43['model'],qs[_0xb2e9('0x60')](_0x1a4d41[_0xb2e9('0x49')][_0xb2e9('0x60')]));_0x158428[_0xb2e9('0x4d')]=_0x158428[_0xb2e9('0x4d')]['length']?_0x158428[_0xb2e9('0x4d')]:_0x139e43[_0xb2e9('0x4c')];if(!_0x1a4d41['query'][_0xb2e9('0x4f')](_0xb2e9('0x50'))){_0x158428['limit']=qs['limit'](_0x1a4d41[_0xb2e9('0x49')][_0xb2e9('0x33')]);_0x158428[_0xb2e9('0x32')]=qs[_0xb2e9('0x32')](_0x1a4d41[_0xb2e9('0x49')][_0xb2e9('0x32')]);}_0x158428[_0xb2e9('0x51')]=qs[_0xb2e9('0x52')](_0x1a4d41[_0xb2e9('0x49')]['sort']);_0x158428[_0xb2e9('0x53')]=qs[_0xb2e9('0x4b')](_[_0xb2e9('0x54')](_0x1a4d41['query'],_0x139e43[_0xb2e9('0x4b')]));_0x158428['where'][_0xb2e9('0x67')]=_0x26c90f['id'];if(_0x1a4d41[_0xb2e9('0x49')][_0xb2e9('0x57')]){_0x158428[_0xb2e9('0x53')]=_[_0xb2e9('0x55')](_0x158428[_0xb2e9('0x53')],{'$or':_[_0xb2e9('0x43')](_0x158428[_0xb2e9('0x4d')],function(_0x1e053e){var _0x5b3c70={};_0x5b3c70[_0x1e053e]={'$like':'%'+_0x1a4d41['query'][_0xb2e9('0x57')]+'%'};return _0x5b3c70;})});}if(_0x1a4d41[_0xb2e9('0x49')][_0xb2e9('0xa1')]){var _0x153dd8=_0x1a4d41[_0xb2e9('0x49')]['$gte'][_0xb2e9('0xa2')](',');var _0x5d7eba={};_0x5d7eba[_0x153dd8[0x0]]={'$gte':moment(_0x153dd8[0x1])[_0xb2e9('0xa3')](_0xb2e9('0xa4'))};_0x158428[_0xb2e9('0x53')]=_[_0xb2e9('0x55')](_0x158428['where'],_0x5d7eba);}_0x158428=_['merge']({},_0x158428,_0x1a4d41[_0xb2e9('0x58')]);return db[_0xb2e9('0xa0')][_0xb2e9('0x31')]({'where':_0x158428[_0xb2e9('0x53')]})['then'](function(_0x401604){_0x1a700a['count']=_0x401604;if(_0x1a4d41['query'][_0xb2e9('0x90')]){_0x158428[_0xb2e9('0x59')]=[{'all':!![]}];}return db[_0xb2e9('0xa0')][_0xb2e9('0x5a')](_0x158428);})['then'](function(_0x2ddd3d){_0x1a700a[_0xb2e9('0x5b')]=_0x2ddd3d;return _0x1a700a;});}})[_0xb2e9('0x25')](respondWithFilteredResult(_0x5dba28,_0x158428))[_0xb2e9('0x2d')](handleError(_0x5dba28,null));};exports['send']=function(_0x84b67a,_0x45098b,_0x37f92d){var _0x421ba9,_0x12f1c8={},_0x74c11d;if(_0x84b67a[_0xb2e9('0x62')]['to']){_0x74c11d=_0x84b67a[_0xb2e9('0x62')]['to'][_0xb2e9('0xa2')](',')[0x0];}return db[_0xb2e9('0x44')][_0xb2e9('0x61')]({'where':{'id':_0x84b67a[_0xb2e9('0x5d')]['id']},'include':[{'model':db[_0xb2e9('0xa5')],'as':_0xb2e9('0xa6'),'include':[{'model':db[_0xb2e9('0x91')],'as':_0xb2e9('0xa7'),'where':{'email':_0x74c11d},'limit':0x1,'order':[[_0xb2e9('0xa8'),_0xb2e9('0xa9')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0xb2e9('0x25')](handleEntityNotFound(_0x45098b,null))['then'](function(_0x3ec365){if(_0x3ec365){_0x421ba9=_0x3ec365;if(_0x3ec365[_0xb2e9('0x40')]){if(_[_0xb2e9('0x70')](_0x84b67a[_0xb2e9('0x62')][_0xb2e9('0xaa')])){_0x84b67a[_0xb2e9('0x62')]['from']=util[_0xb2e9('0xa3')](_0xb2e9('0xab'),_0x3ec365[_0xb2e9('0x3c')],_0x3ec365[_0xb2e9('0x6e')]||_0x3ec365[_0xb2e9('0x40')]['user']);}if(_0x84b67a[_0xb2e9('0x62')][_0xb2e9('0xac')]&&_0x84b67a[_0xb2e9('0x62')][_0xb2e9('0xac')][_0xb2e9('0x4e')]){for(var _0x981150=0x0;_0x981150<_0x84b67a[_0xb2e9('0x62')][_0xb2e9('0xac')][_0xb2e9('0x4e')];_0x981150+=0x1){_0x84b67a[_0xb2e9('0x62')]['attachments'][_0x981150]={'filename':_0x84b67a[_0xb2e9('0x62')][_0xb2e9('0xac')][_0x981150][_0xb2e9('0x3c')],'path':path[_0xb2e9('0xad')](config[_0xb2e9('0xae')],'server/files/attachments',_0x84b67a[_0xb2e9('0x62')][_0xb2e9('0xac')][_0x981150][_0xb2e9('0xaf')])};}}var _0x133ed3={'tls':{'rejectUnauthorized':![]}};if(_[_0xb2e9('0x70')](_0x3ec365[_0xb2e9('0x40')][_0xb2e9('0x7d')])){if(_0x3ec365['Smtp']['authentication']){_0x133ed3[_0xb2e9('0xb0')]={'user':_0x3ec365[_0xb2e9('0x40')][_0xb2e9('0x75')],'pass':_0x3ec365['Smtp'][_0xb2e9('0x78')]};}_0x133ed3[_0xb2e9('0x7b')]=_0x3ec365[_0xb2e9('0x40')][_0xb2e9('0x7b')];_0x133ed3[_0xb2e9('0x7c')]=_0x3ec365['Smtp'][_0xb2e9('0x7c')];_0x133ed3['secure']=_0x3ec365['Smtp'][_0xb2e9('0xb1')];}else{_0x133ed3['service']=_0x3ec365[_0xb2e9('0x40')]['service'];_0x133ed3[_0xb2e9('0xb0')]={'user':_0x3ec365[_0xb2e9('0x40')][_0xb2e9('0x75')],'pass':_0x3ec365[_0xb2e9('0x40')][_0xb2e9('0x78')]};}return respondWithRpcPromise(_0xb2e9('0xb2'),_0xb2e9('0xb3'),{'account':_0x133ed3,'message':_0x84b67a[_0xb2e9('0x62')]});}else{throw new Error(_0xb2e9('0xb4'));}}})['then'](function(_0x576ff7){if(_0x576ff7){_0x12f1c8=_0x576ff7;if(_0x421ba9['List']){if(_0x421ba9[_0xb2e9('0xa6')][_0xb2e9('0xa7')][_0xb2e9('0x4e')]){return _0x421ba9[_0xb2e9('0xa6')]['Contacts'][0x0];}else{return db[_0xb2e9('0x91')][_0xb2e9('0x64')](_[_0xb2e9('0x19')](_0x84b67a[_0xb2e9('0x62')],{'firstName':_0x84b67a['body']['to'],'email':_0x84b67a['body']['to'],'phone':_0x84b67a[_0xb2e9('0x62')]['to'],'ListId':_0x421ba9[_0xb2e9('0x6f')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0xb2e9('0x25')](function(_0x1b5adc){if(_0x1b5adc){var _0x50fa22={'UserId':_0x84b67a['user']['id'],'ContactId':_0x1b5adc['id'],'MailAccountId':_0x421ba9['id'],'inReplyTo':_0x12f1c8[_0xb2e9('0xb5')],'to':_0x84b67a[_0xb2e9('0x62')][_0xb2e9('0xaa')],'cc':_0x84b67a[_0xb2e9('0x62')]['cc'],'subject':_0x84b67a[_0xb2e9('0x62')][_0xb2e9('0xb6')],'attach':_0x84b67a[_0xb2e9('0x62')][_0xb2e9('0xb7')],'firstMsgDirection':_0xb2e9('0xb8'),'lastMsgAt':moment()['format'](_0xb2e9('0xa4')),'lastMsgDirection':_0xb2e9('0xb8'),'lastMsgBody':_0x84b67a[_0xb2e9('0x62')][_0xb2e9('0x62')],'Messages':[_[_0xb2e9('0x55')](_0x84b67a[_0xb2e9('0x62')],{'messageId':_0x12f1c8[_0xb2e9('0xb5')],'sentAt':moment()[_0xb2e9('0xa3')](_0xb2e9('0xa4')),'read':!![],'MailAccountId':_0x421ba9['id'],'UserId':_0x84b67a['user']['id'],'ContactId':_0x1b5adc['id']})]};if(_0x84b67a[_0xb2e9('0x62')][_0xb2e9('0xb9')]){_0x50fa22=_['merge'](_0x50fa22,_0x84b67a[_0xb2e9('0x62')][_0xb2e9('0xb9')]);}return db[_0xb2e9('0x8c')][_0xb2e9('0x64')](_0x50fa22,{'include':[{'model':db[_0xb2e9('0xa0')],'as':'Messages'}]});}})[_0xb2e9('0x25')](respondWithResult(_0x45098b,null))[_0xb2e9('0x2d')](handleError(_0x45098b,null));};exports[_0xb2e9('0xba')]=function(_0x2a8f26,_0x44481f,_0x5616d1){return db[_0xb2e9('0x44')][_0xb2e9('0x61')]({'where':{'id':_0x2a8f26['params']['id']},'include':[{'model':db[_0xb2e9('0x3f')],'as':_0xb2e9('0x40'),'raw':!![]}]})[_0xb2e9('0x25')](handleEntityNotFound(_0x44481f,null))[_0xb2e9('0x25')](function(_0x3cd78c){if(_0x3cd78c&&_0x3cd78c['Smtp']){var _0x559235={'id':_0x3cd78c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3cd78c[_0xb2e9('0x40')][_0xb2e9('0x7d')]){_0x559235['service']=_0x3cd78c[_0xb2e9('0x40')][_0xb2e9('0x7d')];}else{_0x559235[_0xb2e9('0x7b')]=_0x3cd78c['Smtp'][_0xb2e9('0x7b')];_0x559235[_0xb2e9('0x7c')]=_0x3cd78c[_0xb2e9('0x40')][_0xb2e9('0x7c')];_0x559235[_0xb2e9('0xb1')]=_0x3cd78c['Smtp']['secure'];}if(_0x3cd78c['Smtp'][_0xb2e9('0x7a')]){_0x559235[_0xb2e9('0xb0')]={'user':_0x3cd78c[_0xb2e9('0x40')][_0xb2e9('0x75')],'pass':_0x3cd78c['Smtp'][_0xb2e9('0x78')]};}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x559235});}})[_0xb2e9('0x25')](respondWithResult(_0x44481f,null))[_0xb2e9('0x2d')](handleError(_0x44481f,null));};exports[_0xb2e9('0x38')]=function(_0x52afe7,_0x5c55fd){return db[_0xb2e9('0x44')][_0xb2e9('0x61')]({'where':{'id':_0x52afe7[_0xb2e9('0x5d')]['id']}})[_0xb2e9('0x25')](handleEntityNotFound(_0x5c55fd,null))['then'](function(_0x9a2651){if(_0x9a2651&&_0x9a2651[_0xb2e9('0x7d')]){throw new db['Sequelize']['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x9a2651;})[_0xb2e9('0x25')](removeEntity(_0x5c55fd,null))[_0xb2e9('0x2d')](handleError(_0x5c55fd,null));};exports['addAgents']=function(_0x18f997,_0x159849,_0x5b2ec6){return db[_0xb2e9('0x44')][_0xb2e9('0x61')]({'where':{'id':_0x18f997['params']['id']}})[_0xb2e9('0x25')](handleEntityNotFound(_0x159849,null))['then'](function(_0x1a36ac){if(_0x1a36ac){return _0x1a36ac[_0xb2e9('0xbb')](_0x18f997[_0xb2e9('0x62')][_0xb2e9('0x69')],_[_0xb2e9('0x8e')](_0x18f997[_0xb2e9('0x62')],['ids','id'])||{})[_0xb2e9('0xbc')](function(_0x2cd300){for(var _0x48d8da=0x0;_0x48d8da<_0x18f997[_0xb2e9('0x62')][_0xb2e9('0x69')]['length'];_0x48d8da+=0x1){socket[_0xb2e9('0xbd')](_0xb2e9('0xbe'),{'UserId':_0x18f997[_0xb2e9('0x62')]['ids'][_0x48d8da],'MailAccountId':_0x18f997['params']['id']});}return _0x2cd300;});}})[_0xb2e9('0x25')](respondWithResult(_0x159849,null))[_0xb2e9('0x2d')](handleError(_0x159849,null));};exports[_0xb2e9('0xbf')]=function(_0x564cb6,_0x281eaa,_0x544025){return db['MailAccount']['find']({'where':{'id':_0x564cb6[_0xb2e9('0x5d')]['id']}})[_0xb2e9('0x25')](handleEntityNotFound(_0x281eaa,null))[_0xb2e9('0x25')](function(_0x535928){if(_0x535928){return _0x535928[_0xb2e9('0xbf')](_0x564cb6['query']['ids'])['then'](function(){if(_['isArray'](_0x564cb6[_0xb2e9('0x49')][_0xb2e9('0x69')])){for(var _0x3fcef7=0x0;_0x3fcef7<_0x564cb6[_0xb2e9('0x49')][_0xb2e9('0x69')]['length'];_0x3fcef7+=0x1){socket[_0xb2e9('0xbd')]('userMailAccount:remove',{'UserId':Number(_0x564cb6[_0xb2e9('0x49')]['ids'][_0x3fcef7]),'MailAccountId':Number(_0x564cb6['params']['id'])});}}else{socket[_0xb2e9('0xbd')]('userMailAccount:remove',{'UserId':Number(_0x564cb6[_0xb2e9('0x49')][_0xb2e9('0x69')]),'MailAccountId':Number(_0x564cb6[_0xb2e9('0x5d')]['id'])});}});}})[_0xb2e9('0x25')](respondWithStatusCode(_0x281eaa,null))[_0xb2e9('0x2d')](handleError(_0x281eaa,null));};exports['getAgents']=function(_0x5085e6,_0x5d5c5e,_0x156970){var _0xba7d6a={};var _0x2deec8={};var _0x2360d3;var _0x34f958;return db[_0xb2e9('0x44')]['findOne']({'where':{'id':_0x5085e6[_0xb2e9('0x5d')]['id']}})[_0xb2e9('0x25')](handleEntityNotFound(_0x5d5c5e,null))[_0xb2e9('0x25')](function(_0x2ed0bf){if(_0x2ed0bf){_0x2360d3=_0x2ed0bf;_0x2deec8['model']=_[_0xb2e9('0x4a')](db[_0xb2e9('0x93')][_0xb2e9('0x45')]);_0x2deec8[_0xb2e9('0x49')]=_[_0xb2e9('0x4a')](_0x5085e6[_0xb2e9('0x49')]);_0x2deec8['filters']=_['intersection'](_0x2deec8[_0xb2e9('0x4c')],_0x2deec8['query']);_0xba7d6a['attributes']=_[_0xb2e9('0x5f')](_0x2deec8[_0xb2e9('0x4c')],qs[_0xb2e9('0x60')](_0x5085e6[_0xb2e9('0x49')][_0xb2e9('0x60')]));_0xba7d6a[_0xb2e9('0x4d')]=_0xba7d6a[_0xb2e9('0x4d')][_0xb2e9('0x4e')]?_0xba7d6a[_0xb2e9('0x4d')]:_0x2deec8[_0xb2e9('0x4c')];_0xba7d6a['order']=qs['sort'](_0x5085e6['query']['sort']);_0xba7d6a[_0xb2e9('0x53')]=qs[_0xb2e9('0x4b')](_['pick'](_0x5085e6[_0xb2e9('0x49')],_0x2deec8[_0xb2e9('0x4b')]));if(_0x5085e6[_0xb2e9('0x49')][_0xb2e9('0x57')]){_0xba7d6a['where']=_['merge'](_0xba7d6a[_0xb2e9('0x53')],{'$or':_[_0xb2e9('0x43')](_0xba7d6a[_0xb2e9('0x4d')],function(_0x408951){var _0x5c3a54={};_0x5c3a54[_0x408951]={'$like':'%'+_0x5085e6[_0xb2e9('0x49')][_0xb2e9('0x57')]+'%'};return _0x5c3a54;})});}_0xba7d6a=_['merge']({},_0xba7d6a,_0x5085e6[_0xb2e9('0x58')]);return _0x2360d3[_0xb2e9('0xc0')](_0xba7d6a);}})[_0xb2e9('0x25')](function(_0x31d3f1){if(_0x31d3f1){_0x34f958=_0x31d3f1[_0xb2e9('0x4e')];if(!_0x5085e6[_0xb2e9('0x49')][_0xb2e9('0x4f')](_0xb2e9('0x50'))){_0xba7d6a[_0xb2e9('0x33')]=qs[_0xb2e9('0x33')](_0x5085e6[_0xb2e9('0x49')]['limit']);_0xba7d6a[_0xb2e9('0x32')]=qs['offset'](_0x5085e6[_0xb2e9('0x49')]['offset']);}return _0x2360d3['getAgents'](_0xba7d6a);}})[_0xb2e9('0x25')](function(_0x239420){if(_0x239420){return _0x239420?{'count':_0x34f958,'rows':_0x239420}:null;}})[_0xb2e9('0x25')](respondWithResult(_0x5d5c5e,null))['catch'](handleError(_0x5d5c5e,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 526c566..c043107 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 _0x20fc=['emit','hasOwnProperty','hook','exports','events','MailAccount','setMaxListeners','save','update','remove'];(function(_0x4b3583,_0x25627c){var _0x25968a=function(_0xf6ca7){while(--_0xf6ca7){_0x4b3583['push'](_0x4b3583['shift']());}};_0x25968a(++_0x25627c);}(_0x20fc,0x112));var _0xc20f=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0x20fc[_0x1e2080];return _0x260111;};'use strict';var EventEmitter=require(_0xc20f('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xc20f('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xc20f('0x2')](0x0);var events={'afterCreate':_0xc20f('0x3'),'afterUpdate':_0xc20f('0x4'),'afterDestroy':_0xc20f('0x5')};function emitEvent(_0x556eec){return function(_0x54a697,_0x1d7834,_0x5c9d58){MailAccountEvents[_0xc20f('0x6')](_0x556eec+':'+_0x54a697['id'],_0x54a697);MailAccountEvents['emit'](_0x556eec,_0x54a697);_0x5c9d58(null);};}for(var e in events){if(events[_0xc20f('0x7')](e)){var event=events[e];MailAccount[_0xc20f('0x8')](e,emitEvent(event));}}module[_0xc20f('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x1909=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove'];(function(_0x424ebf,_0x4c64d3){var _0x4c6aef=function(_0x3e17eb){while(--_0x3e17eb){_0x424ebf['push'](_0x424ebf['shift']());}};_0x4c6aef(++_0x4c64d3);}(_0x1909,0x1b1));var _0x9190=function(_0x58fb0f,_0x257f1f){_0x58fb0f=_0x58fb0f-0x0;var _0x2f2e26=_0x1909[_0x58fb0f];return _0x2f2e26;};'use strict';var EventEmitter=require(_0x9190('0x0'));var MailAccount=require(_0x9190('0x1'))['db'][_0x9190('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9190('0x3')](0x0);var events={'afterCreate':_0x9190('0x4'),'afterUpdate':_0x9190('0x5'),'afterDestroy':_0x9190('0x6')};function emitEvent(_0x394910){return function(_0x5469b9,_0x49dcd2,_0x4d0cc5){MailAccountEvents[_0x9190('0x7')](_0x394910+':'+_0x5469b9['id'],_0x5469b9);MailAccountEvents[_0x9190('0x7')](_0x394910,_0x5469b9);_0x4d0cc5(null);};}for(var e in events){if(events[_0x9190('0x8')](e)){var event=events[e];MailAccount[_0x9190('0x9')](e,emitEvent(event));}}module[_0x9190('0xa')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 005bc47..7eda4cc 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 _0x3b45=['moment','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','mail_accounts','lodash','util','../../config/logger','api'];(function(_0x9ba307,_0x570631){var _0x335d04=function(_0x3125d0){while(--_0x3125d0){_0x9ba307['push'](_0x9ba307['shift']());}};_0x335d04(++_0x570631);}(_0x3b45,0x68));var _0x53b4=function(_0x58d95d,_0xa724f){_0x58d95d=_0x58d95d-0x0;var _0x385ed9=_0x3b45[_0x58d95d];return _0x385ed9;};'use strict';var _=require(_0x53b4('0x0'));var util=require(_0x53b4('0x1'));var logger=require(_0x53b4('0x2'))(_0x53b4('0x3'));var moment=require(_0x53b4('0x4'));var BPromise=require('bluebird');var rp=require(_0x53b4('0x5'));var fs=require('fs');var path=require(_0x53b4('0x6'));var rimraf=require(_0x53b4('0x7'));var config=require(_0x53b4('0x8'));var attributes=require(_0x53b4('0x9'));module[_0x53b4('0xa')]=function(_0x9b222a,_0x4cb96a){return _0x9b222a['define']('MailAccount',attributes,{'tableName':_0x53b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe61a=['MailAccount','mail_accounts','lodash','util','api','bluebird','request-promise','path','../../config/environment','./mailAccount.attributes','define'];(function(_0x40e74c,_0x1883a2){var _0x3a8c6b=function(_0x1a4ae4){while(--_0x1a4ae4){_0x40e74c['push'](_0x40e74c['shift']());}};_0x3a8c6b(++_0x1883a2);}(_0xe61a,0x120));var _0xae61=function(_0x43dc7b,_0x101995){_0x43dc7b=_0x43dc7b-0x0;var _0x42c133=_0xe61a[_0x43dc7b];return _0x42c133;};'use strict';var _=require(_0xae61('0x0'));var util=require(_0xae61('0x1'));var logger=require('../../config/logger')(_0xae61('0x2'));var moment=require('moment');var BPromise=require(_0xae61('0x3'));var rp=require(_0xae61('0x4'));var fs=require('fs');var path=require(_0xae61('0x5'));var rimraf=require('rimraf');var config=require(_0xae61('0x6'));var attributes=require(_0xae61('0x7'));module['exports']=function(_0x4e92f8,_0xb9dcc8){return _0x4e92f8[_0xae61('0x8')](_0xae61('0x9'),attributes,{'tableName':_0xae61('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 a922995..ccfb3c5 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 _0xc560=['push','close','*,*,*,*','ListId','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','format','interaction','attachments','originTo','bcc','Attachment','Attachments','UserId','name','unshift','Start','startRouting','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetMailAccount','MailAccount','findAll','options','where','limit','map','include','model','attributes','ShowMailAccount','raw','NotifyMailAccount','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','body','from','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','find','account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','omit','applications','list','orderBy','priority','asc','autoclose'];(function(_0x4cd39a,_0x26ff7b){var _0x572f07=function(_0x1105f9){while(--_0x1105f9){_0x4cd39a['push'](_0x4cd39a['shift']());}};_0x572f07(++_0x26ff7b);}(_0xc560,0x82));var _0x0c56=function(_0x318e7c,_0x633b02){_0x318e7c=_0x318e7c-0x0;var _0x4bce37=_0xc560[_0x318e7c];return _0x4bce37;};'use strict';var _=require(_0x0c56('0x0'));var util=require('util');var moment=require(_0x0c56('0x1'));var BPromise=require('bluebird');var rs=require(_0x0c56('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0c56('0x3'));var logger=require(_0x0c56('0x4'))(_0x0c56('0x5'));var config=require(_0x0c56('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0c56('0x7')][_0x0c56('0x8')]({'port':0x232c});config[_0x0c56('0x9')]=_[_0x0c56('0xa')](config['redis'],{'host':_0x0c56('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0c56('0x9')]));require(_0x0c56('0xc'))[_0x0c56('0xd')](socket);function respondWithRpcPromise(_0x535444,_0x15979a,_0x41fd41){return new BPromise(function(_0x3651c6,_0x5e80cd){return client[_0x0c56('0xe')](_0x535444,_0x41fd41)[_0x0c56('0xf')](function(_0x2e2bec){logger[_0x0c56('0x10')](_0x0c56('0x11'),_0x15979a,_0x0c56('0x12'));logger[_0x0c56('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x15979a,'request\x20sent',JSON[_0x0c56('0x14')](_0x2e2bec));if(_0x2e2bec[_0x0c56('0x15')]){if(_0x2e2bec[_0x0c56('0x15')][_0x0c56('0x16')]===0x1f4){logger[_0x0c56('0x15')](_0x0c56('0x11'),_0x15979a,_0x2e2bec['error'][_0x0c56('0x17')]);return _0x5e80cd(_0x2e2bec[_0x0c56('0x15')][_0x0c56('0x17')]);}logger[_0x0c56('0x15')](_0x0c56('0x11'),_0x15979a,_0x2e2bec['error'][_0x0c56('0x17')]);return _0x3651c6(_0x2e2bec['error']['message']);}else{logger[_0x0c56('0x10')]('MailAccount,\x20%s,\x20%s',_0x15979a,_0x0c56('0x12'));_0x3651c6(_0x2e2bec['result']['message']);}})[_0x0c56('0x18')](function(_0x11fc53){logger[_0x0c56('0x15')](_0x0c56('0x11'),_0x15979a,_0x11fc53);_0x5e80cd(_0x11fc53);});});}exports[_0x0c56('0x19')]=function(_0x253a86){var _0x34fdee=this;return new Promise(function(_0x3b9e6a,_0x27c230){return db[_0x0c56('0x1a')][_0x0c56('0x1b')]({'raw':_0x253a86[_0x0c56('0x1c')]?_0x253a86['options']['raw']===undefined?!![]:![]:!![],'where':_0x253a86[_0x0c56('0x1c')]?_0x253a86[_0x0c56('0x1c')][_0x0c56('0x1d')]||null:null,'attributes':_0x253a86[_0x0c56('0x1c')]?_0x253a86[_0x0c56('0x1c')]['attributes']||null:null,'limit':_0x253a86[_0x0c56('0x1c')]?_0x253a86[_0x0c56('0x1c')][_0x0c56('0x1e')]||null:null,'include':_0x253a86[_0x0c56('0x1c')]?_0x253a86[_0x0c56('0x1c')]['include']?_[_0x0c56('0x1f')](_0x253a86['options'][_0x0c56('0x20')],function(_0x499949){return{'model':db[_0x499949[_0x0c56('0x21')]],'as':_0x499949['as'],'attributes':_0x499949[_0x0c56('0x22')],'include':_0x499949[_0x0c56('0x20')]?_[_0x0c56('0x1f')](_0x499949[_0x0c56('0x20')],function(_0x5189e4){return{'model':db[_0x5189e4[_0x0c56('0x21')]],'as':_0x5189e4['as'],'attributes':_0x5189e4['attributes'],'include':_0x5189e4[_0x0c56('0x20')]?_[_0x0c56('0x1f')](_0x5189e4['include'],function(_0x23fd09){return{'model':db[_0x23fd09['model']],'as':_0x23fd09['as'],'attributes':_0x23fd09[_0x0c56('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0c56('0xf')](function(_0x45b095){logger[_0x0c56('0x10')](_0x0c56('0x19'),_0x253a86);logger[_0x0c56('0x13')](_0x0c56('0x19'),_0x253a86,JSON[_0x0c56('0x14')](_0x45b095));_0x3b9e6a(_0x45b095);})['catch'](function(_0x1b3262){logger[_0x0c56('0x15')]('GetMailAccount',_0x1b3262[_0x0c56('0x17')],_0x253a86);_0x27c230(_0x34fdee[_0x0c56('0x15')](0x1f4,_0x1b3262[_0x0c56('0x17')]));});});};exports[_0x0c56('0x23')]=function(_0x5c5a41){var _0x130278=this;return new Promise(function(_0x10442e,_0x5ef030){return db[_0x0c56('0x1a')]['find']({'raw':_0x5c5a41[_0x0c56('0x1c')]?_0x5c5a41[_0x0c56('0x1c')][_0x0c56('0x24')]===undefined?!![]:![]:!![],'where':_0x5c5a41[_0x0c56('0x1c')]?_0x5c5a41[_0x0c56('0x1c')][_0x0c56('0x1d')]||null:null,'attributes':_0x5c5a41['options']?_0x5c5a41[_0x0c56('0x1c')][_0x0c56('0x22')]||null:null,'include':_0x5c5a41['options']?_0x5c5a41[_0x0c56('0x1c')][_0x0c56('0x20')]?_[_0x0c56('0x1f')](_0x5c5a41[_0x0c56('0x1c')][_0x0c56('0x20')],function(_0x682cf7){return{'model':db[_0x682cf7[_0x0c56('0x21')]],'as':_0x682cf7['as'],'attributes':_0x682cf7[_0x0c56('0x22')],'include':_0x682cf7[_0x0c56('0x20')]?_[_0x0c56('0x1f')](_0x682cf7[_0x0c56('0x20')],function(_0x54e7dc){return{'model':db[_0x54e7dc['model']],'as':_0x54e7dc['as'],'attributes':_0x54e7dc[_0x0c56('0x22')],'include':_0x54e7dc[_0x0c56('0x20')]?_[_0x0c56('0x1f')](_0x54e7dc[_0x0c56('0x20')],function(_0x5b6d54){return{'model':db[_0x5b6d54[_0x0c56('0x21')]],'as':_0x5b6d54['as'],'attributes':_0x5b6d54['attributes']};}):[]};}):[]};}):[]:[]})[_0x0c56('0xf')](function(_0x5e259e){logger['info'](_0x0c56('0x23'),_0x5c5a41);logger[_0x0c56('0x13')]('ShowMailAccount',_0x5c5a41,JSON['stringify'](_0x5e259e));_0x10442e(_0x5e259e);})[_0x0c56('0x18')](function(_0x4ec3bf){logger[_0x0c56('0x15')](_0x0c56('0x23'),_0x4ec3bf[_0x0c56('0x17')],_0x5c5a41);_0x5ef030(_0x130278[_0x0c56('0x15')](0x1f4,_0x4ec3bf[_0x0c56('0x17')]));});});};exports[_0x0c56('0x25')]=function(_0x4208cc){var _0x4fd945=this;return new Promise(function(_0x25effb,_0x8cff3a){var _0x2e33b2={'body':_0x4208cc['body'],'channel':'mail'};var _0x455a2e=_[_0x0c56('0x26')](_[_0x0c56('0x27')](db[_0x0c56('0x28')][_0x0c56('0x29')]),['createdAt',_0x0c56('0x2a'),_0x0c56('0x2b'),'ListId']);var _0x4e0ac1=![];if(_0x4208cc[_0x0c56('0x2c')]['id']){delete _0x4208cc[_0x0c56('0x2c')]['id'];}if(_['isNil'](_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x2d')])){return _0x8cff3a(_0x4fd945[_0x0c56('0x15')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x0c56('0x2e')](_0x4208cc['body'][_0x0c56('0x2c')])||_0x4208cc['body'][_0x0c56('0x2c')]===''){return _0x8cff3a(_0x4fd945[_0x0c56('0x15')](0x1f4,_0x0c56('0x2f')));}if(_[_0x0c56('0x2e')](_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x30')])){return _0x8cff3a(_0x4fd945[_0x0c56('0x15')](0x1f4,_0x0c56('0x31')+_0x455a2e));}if(!_[_0x0c56('0x32')](_0x455a2e,_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x30')])){return _0x8cff3a(_0x4fd945[_0x0c56('0x15')](0x1f4,_0x0c56('0x33')+_0x455a2e));}var _0x2bfe98={};_0x2bfe98[_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x30')]]=_0x4208cc['body']['from'];return db['MailAccount'][_0x0c56('0x34')]({'where':{'id':_0x4208cc[_0x0c56('0x35')]['id']},'include':[{'model':db['CmList'],'as':_0x0c56('0x36'),'include':[{'model':db['CmContact'],'as':_0x0c56('0x37'),'where':_0x2bfe98,'limit':0x1,'order':[['updatedAt',_0x0c56('0x38')]]}]},{'model':db[_0x0c56('0x39')],'as':_0x0c56('0x3a')},{'model':db[_0x0c56('0x3b')],'as':_0x0c56('0x3c')}]})['then'](function(_0x2aa324){if(_0x2aa324&&_0x2aa324[_0x0c56('0x36')]){var _0x4bb3ab=_0x2aa324['get']({'plain':!![]});_0x2e33b2[_0x0c56('0x35')]=_[_0x0c56('0x3d')](_0x4bb3ab,[_0x0c56('0x3a'),_0x0c56('0x36')]);_0x2e33b2[_0x0c56('0x3e')]=_0x4bb3ab[_0x0c56('0x3a')];_0x2e33b2[_0x0c56('0x3f')]=_0x4bb3ab[_0x0c56('0x36')];_0x2e33b2['applications']=_[_0x0c56('0x40')](_0x2e33b2['applications'],[_0x0c56('0x41')],[_0x0c56('0x42')]);if(_0x2e33b2[_0x0c56('0x35')]&&_0x2e33b2[_0x0c56('0x35')][_0x0c56('0x43')]){_0x2e33b2['applications'][_0x0c56('0x44')]({'id':0x0,'priority':_0x2e33b2[_0x0c56('0x3e')]['length']+0x1,'app':_0x0c56('0x45'),'appdata':'autoclose','interval':_0x0c56('0x46')});}if(_0x2e33b2['account'][_0x0c56('0x3a')]){delete _0x2e33b2[_0x0c56('0x35')][_0x0c56('0x3a')];}if(_0x2e33b2['account']['List']){delete _0x2e33b2['account'][_0x0c56('0x36')];}if(_0x4bb3ab['List']['Contacts']['length']){return _0x4bb3ab[_0x0c56('0x36')]['Contacts'][0x0];}var _0x26e4e0=_[_0x0c56('0xa')](_0x4208cc['body'],{'firstName':_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x2d')],'ListId':_0x4bb3ab[_0x0c56('0x47')]});_0x26e4e0[_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x30')]]=_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x2d')];return db[_0x0c56('0x28')][_0x0c56('0x48')](_0x26e4e0);}else{throw new Error(_0x0c56('0x49'));}})[_0x0c56('0xf')](function(_0x1ba609){_0x2e33b2[_0x0c56('0x4a')]=_0x1ba609;if(_0x1ba609){if(!_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x17')][_0x0c56('0x4b')]){_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x17')]['messageId']=rs[_0x0c56('0x4c')]()+'\x20'+_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x17')][_0x0c56('0x2d')];}var _0x4ae41e={'ContactId':_0x1ba609['id'],'MailAccountId':_0x4208cc[_0x0c56('0x35')]['id'],'inReplyTo':_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x17')][_0x0c56('0x4b')],'to':_0x4208cc[_0x0c56('0x2c')]['message'][_0x0c56('0x2d')],'cc':_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x17')]['cc'],'subject':_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x17')][_0x0c56('0x4d')],'attach':_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x17')][_0x0c56('0x4e')],'lastMsgAt':moment()['format'](_0x0c56('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x2c')]};return db[_0x0c56('0x50')][_0x0c56('0x34')]({'where':{'closed':![],'MailAccountId':_0x4208cc[_0x0c56('0x35')]['id']},'include':[{'model':db[_0x0c56('0x51')],'as':_0x0c56('0x52'),'attributes':[_0x0c56('0x4b')],'where':{'messageId':_0x4208cc[_0x0c56('0x2c')]['message'][_0x0c56('0x53')]}}]})[_0x0c56('0xf')](function(_0x51f636){if(_0x51f636){return[_0x51f636,![]];}return db[_0x0c56('0x50')][_0x0c56('0x48')](_0x4ae41e)[_0x0c56('0xf')](function(_0x20cc0e){return[_0x20cc0e,!![]];});});}else{throw new Error(_0x0c56('0x54'));}})[_0x0c56('0x55')](function(_0x8429e8,_0x517082){if(_0x8429e8){_0x4e0ac1=_0x517082;if(!_0x517082){return _0x8429e8[_0x0c56('0x56')]({'inReplyTo':_0x4208cc[_0x0c56('0x2c')]['message'][_0x0c56('0x4b')],'to':_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x17')][_0x0c56('0x2d')],'cc':_0x4208cc[_0x0c56('0x2c')]['message']['cc'],'subject':_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x17')][_0x0c56('0x4d')],'attach':_0x8429e8[_0x0c56('0x4e')]?_0x8429e8['attach']:_0x4208cc['body'][_0x0c56('0x17')][_0x0c56('0x4e')],'substatus':null,'substatusAt':moment()[_0x0c56('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x0c56('0x57')](_0x0c56('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x2c')]});}else{return _0x8429e8;}}})[_0x0c56('0xf')](function(_0x4c5812){_0x2e33b2[_0x0c56('0x58')]=_0x4c5812['get']({'plain':!![]});_0x2e33b2[_0x0c56('0x58')]['created']=_0x4e0ac1;return db[_0x0c56('0x51')][_0x0c56('0x48')]({'body':_0x4208cc[_0x0c56('0x2c')]['body'],'MailAccountId':_0x4208cc['account']['id'],'MailInteractionId':_0x4c5812['id'],'direction':'in','ContactId':_0x2e33b2[_0x0c56('0x4a')]['id'],'messageId':_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x17')][_0x0c56('0x4b')],'from':_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x17')][_0x0c56('0x2d')],'to':_0x4208cc['body'][_0x0c56('0x17')]['to'],'cc':_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x17')]['cc'],'subject':_0x4208cc[_0x0c56('0x2c')]['message']['subject'],'attach':_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x17')][_0x0c56('0x4e')],'Attachments':_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x17')][_0x0c56('0x59')],'originTo':_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x17')][_0x0c56('0x5a')],'originCc':_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x17')]['originCc'],'bcc':_0x4208cc[_0x0c56('0x2c')][_0x0c56('0x17')][_0x0c56('0x5b')]},{'include':[{'model':db[_0x0c56('0x5c')],'as':_0x0c56('0x5d')}]});})[_0x0c56('0xf')](function(_0xb3f2af){_0x2e33b2[_0x0c56('0x17')]=_0xb3f2af;if(_0x2e33b2['interaction'][_0x0c56('0x5e')]){return db['User'][_0x0c56('0x34')]({'attributes':['id',_0x0c56('0x5f')],'where':{'id':_0x2e33b2['interaction'][_0x0c56('0x5e')]}})[_0x0c56('0xf')](function(_0x328b1f){if(_0x328b1f){_0x2e33b2[_0x0c56('0x3e')][_0x0c56('0x60')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x328b1f['name']+','+(_0x2e33b2['account']['waitForTheAssignedAgent']||0xa),'interval':_0x0c56('0x46')});}return respondWithRpcPromise(_0x0c56('0x61'),_0x0c56('0x62'),_0x2e33b2);});}return respondWithRpcPromise(_0x0c56('0x61'),_0x0c56('0x62'),_0x2e33b2);})[_0x0c56('0xf')](function(_0x33aedf){_0x25effb(_0x33aedf);})['catch'](function(_0x3f8cb2){_0x8cff3a(_0x4fd945[_0x0c56('0x15')](0x1f4,_0x3f8cb2['message']));});});}; \ No newline at end of file +var _0x8130=['Applications','MailServerOut','Smtp','get','omit','applications','orderBy','asc','autoclose','push','*,*,*,*','length','create','List\x20not\x20found','contact','messageId','generate','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','update','subject','interaction','attachments','originTo','originCc','Attachment','Attachments','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetMailAccount','findAll','options','raw','where','map','include','model','attributes','catch','ShowMailAccount','NotifyMailAccount','mail','difference','CmContact','rawAttributes','createdAt','CompanyId','ListId','body','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','MailAccount','find','account','CmList','List','updatedAt','DESC','MailApplication'];(function(_0x1928bf,_0x56a9ad){var _0x457ee9=function(_0x435a33){while(--_0x435a33){_0x1928bf['push'](_0x1928bf['shift']());}};_0x457ee9(++_0x56a9ad);}(_0x8130,0x146));var _0x0813=function(_0x58c890,_0x3af20f){_0x58c890=_0x58c890-0x0;var _0x3dda38=_0x8130[_0x58c890];return _0x3dda38;};'use strict';var _=require(_0x0813('0x0'));var util=require(_0x0813('0x1'));var moment=require('moment');var BPromise=require(_0x0813('0x2'));var rs=require(_0x0813('0x3'));var fs=require('fs');var Redis=require(_0x0813('0x4'));var db=require(_0x0813('0x5'))['db'];var utils=require(_0x0813('0x6'));var logger=require(_0x0813('0x7'))('rpc');var config=require(_0x0813('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0813('0x9')]({'port':0x232c});config[_0x0813('0xa')]=_[_0x0813('0xb')](config[_0x0813('0xa')],{'host':_0x0813('0xc'),'port':0x18eb});var socket=require(_0x0813('0xd'))(new Redis(config[_0x0813('0xa')]));require('./mailAccount.socket')[_0x0813('0xe')](socket);function respondWithRpcPromise(_0x1815be,_0x251ca8,_0x5a9c5e){return new BPromise(function(_0x5550c8,_0x15f8d6){return client['request'](_0x1815be,_0x5a9c5e)[_0x0813('0xf')](function(_0x5b54ec){logger[_0x0813('0x10')](_0x0813('0x11'),_0x251ca8,_0x0813('0x12'));logger[_0x0813('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x251ca8,'request\x20sent',JSON[_0x0813('0x14')](_0x5b54ec));if(_0x5b54ec[_0x0813('0x15')]){if(_0x5b54ec['error'][_0x0813('0x16')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x251ca8,_0x5b54ec[_0x0813('0x15')][_0x0813('0x17')]);return _0x15f8d6(_0x5b54ec['error'][_0x0813('0x17')]);}logger['error'](_0x0813('0x11'),_0x251ca8,_0x5b54ec[_0x0813('0x15')][_0x0813('0x17')]);return _0x5550c8(_0x5b54ec[_0x0813('0x15')][_0x0813('0x17')]);}else{logger[_0x0813('0x10')](_0x0813('0x11'),_0x251ca8,_0x0813('0x12'));_0x5550c8(_0x5b54ec['result'][_0x0813('0x17')]);}})['catch'](function(_0x112720){logger[_0x0813('0x15')]('MailAccount,\x20%s,\x20%s',_0x251ca8,_0x112720);_0x15f8d6(_0x112720);});});}exports[_0x0813('0x18')]=function(_0x3639fc){var _0x4945df=this;return new Promise(function(_0x1ee739,_0x334741){return db['MailAccount'][_0x0813('0x19')]({'raw':_0x3639fc[_0x0813('0x1a')]?_0x3639fc[_0x0813('0x1a')][_0x0813('0x1b')]===undefined?!![]:![]:!![],'where':_0x3639fc[_0x0813('0x1a')]?_0x3639fc['options'][_0x0813('0x1c')]||null:null,'attributes':_0x3639fc[_0x0813('0x1a')]?_0x3639fc[_0x0813('0x1a')]['attributes']||null:null,'limit':_0x3639fc[_0x0813('0x1a')]?_0x3639fc['options']['limit']||null:null,'include':_0x3639fc[_0x0813('0x1a')]?_0x3639fc['options']['include']?_[_0x0813('0x1d')](_0x3639fc[_0x0813('0x1a')][_0x0813('0x1e')],function(_0x2f8849){return{'model':db[_0x2f8849[_0x0813('0x1f')]],'as':_0x2f8849['as'],'attributes':_0x2f8849[_0x0813('0x20')],'include':_0x2f8849[_0x0813('0x1e')]?_[_0x0813('0x1d')](_0x2f8849['include'],function(_0x1c76b0){return{'model':db[_0x1c76b0[_0x0813('0x1f')]],'as':_0x1c76b0['as'],'attributes':_0x1c76b0[_0x0813('0x20')],'include':_0x1c76b0[_0x0813('0x1e')]?_[_0x0813('0x1d')](_0x1c76b0[_0x0813('0x1e')],function(_0x55e115){return{'model':db[_0x55e115[_0x0813('0x1f')]],'as':_0x55e115['as'],'attributes':_0x55e115[_0x0813('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54bf5d){logger[_0x0813('0x10')](_0x0813('0x18'),_0x3639fc);logger[_0x0813('0x13')](_0x0813('0x18'),_0x3639fc,JSON[_0x0813('0x14')](_0x54bf5d));_0x1ee739(_0x54bf5d);})[_0x0813('0x21')](function(_0x5eba65){logger[_0x0813('0x15')](_0x0813('0x18'),_0x5eba65['message'],_0x3639fc);_0x334741(_0x4945df['error'](0x1f4,_0x5eba65[_0x0813('0x17')]));});});};exports[_0x0813('0x22')]=function(_0x3134bb){var _0x4e303b=this;return new Promise(function(_0x200ffa,_0x206313){return db['MailAccount']['find']({'raw':_0x3134bb[_0x0813('0x1a')]?_0x3134bb[_0x0813('0x1a')][_0x0813('0x1b')]===undefined?!![]:![]:!![],'where':_0x3134bb[_0x0813('0x1a')]?_0x3134bb['options'][_0x0813('0x1c')]||null:null,'attributes':_0x3134bb[_0x0813('0x1a')]?_0x3134bb[_0x0813('0x1a')][_0x0813('0x20')]||null:null,'include':_0x3134bb['options']?_0x3134bb['options'][_0x0813('0x1e')]?_[_0x0813('0x1d')](_0x3134bb[_0x0813('0x1a')]['include'],function(_0x2c902d){return{'model':db[_0x2c902d[_0x0813('0x1f')]],'as':_0x2c902d['as'],'attributes':_0x2c902d[_0x0813('0x20')],'include':_0x2c902d['include']?_['map'](_0x2c902d[_0x0813('0x1e')],function(_0x296565){return{'model':db[_0x296565[_0x0813('0x1f')]],'as':_0x296565['as'],'attributes':_0x296565[_0x0813('0x20')],'include':_0x296565[_0x0813('0x1e')]?_[_0x0813('0x1d')](_0x296565['include'],function(_0x18d162){return{'model':db[_0x18d162['model']],'as':_0x18d162['as'],'attributes':_0x18d162['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1cdb40){logger[_0x0813('0x10')]('ShowMailAccount',_0x3134bb);logger['debug'](_0x0813('0x22'),_0x3134bb,JSON[_0x0813('0x14')](_0x1cdb40));_0x200ffa(_0x1cdb40);})[_0x0813('0x21')](function(_0x45a1d7){logger[_0x0813('0x15')](_0x0813('0x22'),_0x45a1d7[_0x0813('0x17')],_0x3134bb);_0x206313(_0x4e303b[_0x0813('0x15')](0x1f4,_0x45a1d7[_0x0813('0x17')]));});});};exports[_0x0813('0x23')]=function(_0x54b271){var _0x4c4f29=this;return new Promise(function(_0x5af8be,_0x23036d){var _0xee399={'body':_0x54b271['body'],'channel':_0x0813('0x24')};var _0x15b4aa=_[_0x0813('0x25')](_['keys'](db[_0x0813('0x26')][_0x0813('0x27')]),[_0x0813('0x28'),'updatedAt',_0x0813('0x29'),_0x0813('0x2a')]);var _0x2931da=![];if(_0x54b271['body']['id']){delete _0x54b271[_0x0813('0x2b')]['id'];}if(_[_0x0813('0x2c')](_0x54b271['body'][_0x0813('0x2d')])){return _0x23036d(_0x4c4f29[_0x0813('0x15')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x0813('0x2c')](_0x54b271['body'][_0x0813('0x2b')])||_0x54b271[_0x0813('0x2b')][_0x0813('0x2b')]===''){return _0x23036d(_0x4c4f29['error'](0x1f4,_0x0813('0x2e')));}if(_['isNil'](_0x54b271[_0x0813('0x2b')][_0x0813('0x2f')])){return _0x23036d(_0x4c4f29[_0x0813('0x15')](0x1f4,_0x0813('0x30')+_0x15b4aa));}if(!_[_0x0813('0x31')](_0x15b4aa,_0x54b271[_0x0813('0x2b')]['mapKey'])){return _0x23036d(_0x4c4f29[_0x0813('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x15b4aa));}var _0x182154={};_0x182154[_0x54b271['body']['mapKey']]=_0x54b271['body'][_0x0813('0x2d')];return db[_0x0813('0x32')][_0x0813('0x33')]({'where':{'id':_0x54b271[_0x0813('0x34')]['id']},'include':[{'model':db[_0x0813('0x35')],'as':_0x0813('0x36'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x182154,'limit':0x1,'order':[[_0x0813('0x37'),_0x0813('0x38')]]}]},{'model':db[_0x0813('0x39')],'as':_0x0813('0x3a')},{'model':db[_0x0813('0x3b')],'as':_0x0813('0x3c')}]})[_0x0813('0xf')](function(_0x436819){if(_0x436819&&_0x436819['List']){var _0x405529=_0x436819[_0x0813('0x3d')]({'plain':!![]});_0xee399[_0x0813('0x34')]=_[_0x0813('0x3e')](_0x405529,[_0x0813('0x3a'),_0x0813('0x36')]);_0xee399['applications']=_0x405529[_0x0813('0x3a')];_0xee399['list']=_0x405529[_0x0813('0x36')];_0xee399[_0x0813('0x3f')]=_[_0x0813('0x40')](_0xee399[_0x0813('0x3f')],['priority'],[_0x0813('0x41')]);if(_0xee399[_0x0813('0x34')]&&_0xee399[_0x0813('0x34')][_0x0813('0x42')]){_0xee399['applications'][_0x0813('0x43')]({'id':0x0,'priority':_0xee399[_0x0813('0x3f')]['length']+0x1,'app':'close','appdata':_0x0813('0x42'),'interval':_0x0813('0x44')});}if(_0xee399[_0x0813('0x34')]['Applications']){delete _0xee399['account']['Applications'];}if(_0xee399['account'][_0x0813('0x36')]){delete _0xee399[_0x0813('0x34')][_0x0813('0x36')];}if(_0x405529[_0x0813('0x36')]['Contacts'][_0x0813('0x45')]){return _0x405529[_0x0813('0x36')]['Contacts'][0x0];}var _0x50047d=_[_0x0813('0xb')](_0x54b271['body'],{'firstName':_0x54b271[_0x0813('0x2b')][_0x0813('0x2d')],'ListId':_0x405529[_0x0813('0x2a')]});_0x50047d[_0x54b271['body'][_0x0813('0x2f')]]=_0x54b271[_0x0813('0x2b')][_0x0813('0x2d')];return db[_0x0813('0x26')][_0x0813('0x46')](_0x50047d);}else{throw new Error(_0x0813('0x47'));}})['then'](function(_0x50733e){_0xee399[_0x0813('0x48')]=_0x50733e;if(_0x50733e){if(!_0x54b271[_0x0813('0x2b')][_0x0813('0x17')][_0x0813('0x49')]){_0x54b271['body'][_0x0813('0x17')]['messageId']=rs[_0x0813('0x4a')]()+'\x20'+_0x54b271[_0x0813('0x2b')][_0x0813('0x17')][_0x0813('0x2d')];}var _0x19b183={'ContactId':_0x50733e['id'],'MailAccountId':_0x54b271[_0x0813('0x34')]['id'],'inReplyTo':_0x54b271[_0x0813('0x2b')][_0x0813('0x17')]['messageId'],'to':_0x54b271[_0x0813('0x2b')][_0x0813('0x17')][_0x0813('0x2d')],'cc':_0x54b271[_0x0813('0x2b')][_0x0813('0x17')]['cc'],'subject':_0x54b271[_0x0813('0x2b')][_0x0813('0x17')]['subject'],'attach':_0x54b271[_0x0813('0x2b')][_0x0813('0x17')][_0x0813('0x4b')],'lastMsgAt':moment()['format'](_0x0813('0x4c')),'lastMsgDirection':'in','lastMsgBody':_0x54b271[_0x0813('0x2b')][_0x0813('0x2b')]};return db[_0x0813('0x4d')][_0x0813('0x33')]({'where':{'closed':![],'MailAccountId':_0x54b271[_0x0813('0x34')]['id']},'include':[{'model':db[_0x0813('0x4e')],'as':_0x0813('0x4f'),'attributes':[_0x0813('0x49')],'where':{'messageId':_0x54b271[_0x0813('0x2b')][_0x0813('0x17')]['inReplyTo']}}]})[_0x0813('0xf')](function(_0x26045c){if(_0x26045c){return[_0x26045c,![]];}return db['MailInteraction'][_0x0813('0x46')](_0x19b183)['then'](function(_0x477844){return[_0x477844,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x523fbe,_0x24eab3){if(_0x523fbe){_0x2931da=_0x24eab3;if(!_0x24eab3){return _0x523fbe[_0x0813('0x50')]({'inReplyTo':_0x54b271[_0x0813('0x2b')]['message'][_0x0813('0x49')],'to':_0x54b271['body']['message'][_0x0813('0x2d')],'cc':_0x54b271['body'][_0x0813('0x17')]['cc'],'subject':_0x54b271[_0x0813('0x2b')][_0x0813('0x17')][_0x0813('0x51')],'attach':_0x523fbe[_0x0813('0x4b')]?_0x523fbe[_0x0813('0x4b')]:_0x54b271[_0x0813('0x2b')][_0x0813('0x17')][_0x0813('0x4b')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x0813('0x4c')),'lastMsgDirection':'in','lastMsgBody':_0x54b271[_0x0813('0x2b')][_0x0813('0x2b')]});}else{return _0x523fbe;}}})[_0x0813('0xf')](function(_0x33c215){_0xee399['interaction']=_0x33c215['get']({'plain':!![]});_0xee399[_0x0813('0x52')]['created']=_0x2931da;return db[_0x0813('0x4e')]['create']({'body':_0x54b271[_0x0813('0x2b')][_0x0813('0x2b')],'MailAccountId':_0x54b271['account']['id'],'MailInteractionId':_0x33c215['id'],'direction':'in','ContactId':_0xee399['contact']['id'],'messageId':_0x54b271[_0x0813('0x2b')][_0x0813('0x17')][_0x0813('0x49')],'from':_0x54b271['body'][_0x0813('0x17')][_0x0813('0x2d')],'to':_0x54b271['body'][_0x0813('0x17')]['to'],'cc':_0x54b271[_0x0813('0x2b')]['message']['cc'],'subject':_0x54b271[_0x0813('0x2b')][_0x0813('0x17')][_0x0813('0x51')],'attach':_0x54b271['body'][_0x0813('0x17')][_0x0813('0x4b')],'Attachments':_0x54b271['body'][_0x0813('0x17')][_0x0813('0x53')],'originTo':_0x54b271[_0x0813('0x2b')][_0x0813('0x17')][_0x0813('0x54')],'originCc':_0x54b271[_0x0813('0x2b')]['message'][_0x0813('0x55')],'bcc':_0x54b271[_0x0813('0x2b')]['message']['bcc']},{'include':[{'model':db[_0x0813('0x56')],'as':_0x0813('0x57')}]});})[_0x0813('0xf')](function(_0xbbf167){_0xee399['message']=_0xbbf167;if(_0xee399['interaction'][_0x0813('0x58')]){return db[_0x0813('0x59')][_0x0813('0x33')]({'attributes':['id','name'],'where':{'id':_0xee399[_0x0813('0x52')][_0x0813('0x58')]}})[_0x0813('0xf')](function(_0x361cf5){if(_0x361cf5){_0xee399['applications'][_0x0813('0x5a')]({'id':0x0,'priority':0x0,'app':_0x0813('0x5b'),'appdata':_0x361cf5[_0x0813('0x5c')]+','+(_0xee399[_0x0813('0x34')][_0x0813('0x5d')]||0xa),'interval':_0x0813('0x44')});}return respondWithRpcPromise(_0x0813('0x5e'),_0x0813('0x5f'),_0xee399);});}return respondWithRpcPromise(_0x0813('0x5e'),_0x0813('0x5f'),_0xee399);})[_0x0813('0xf')](function(_0x154b23){_0x5af8be(_0x154b23);})[_0x0813('0x21')](function(_0x21afd0){_0x23036d(_0x4c4f29[_0x0813('0x15')](0x1f4,_0x21afd0[_0x0813('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 15c8543..e8b0973 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 _0xab36=['length','mailAccount:','./mailAccount.events','save','remove','update','emit','removeListener','register'];(function(_0xca44ba,_0x352815){var _0x32a9d5=function(_0x521e9a){while(--_0x521e9a){_0xca44ba['push'](_0xca44ba['shift']());}};_0x32a9d5(++_0x352815);}(_0xab36,0x1df));var _0x6ab3=function(_0x356ae7,_0xcf9194){_0x356ae7=_0x356ae7-0x0;var _0x5ba77e=_0xab36[_0x356ae7];return _0x5ba77e;};'use strict';var MailAccountEvents=require(_0x6ab3('0x0'));var events=[_0x6ab3('0x1'),_0x6ab3('0x2'),_0x6ab3('0x3')];function createListener(_0x1c0328,_0x5455d5){return function(_0x3a5441){_0x5455d5[_0x6ab3('0x4')](_0x1c0328,_0x3a5441);};}function removeListener(_0x31433e,_0x5a5152){return function(){MailAccountEvents[_0x6ab3('0x5')](_0x31433e,_0x5a5152);};}exports[_0x6ab3('0x6')]=function(_0x40810a){for(var _0x8a9495=0x0,_0x33fc2a=events[_0x6ab3('0x7')];_0x8a9495<_0x33fc2a;_0x8a9495++){var _0x4ba5e3=events[_0x8a9495];var _0x2a9076=createListener(_0x6ab3('0x8')+_0x4ba5e3,_0x40810a);MailAccountEvents['on'](_0x4ba5e3,_0x2a9076);}}; \ No newline at end of file +var _0xfcbe=['mailAccount:','save','remove','update'];(function(_0x277180,_0x4e9546){var _0x1f25fb=function(_0x5d1b77){while(--_0x5d1b77){_0x277180['push'](_0x277180['shift']());}};_0x1f25fb(++_0x4e9546);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x3b35ee,_0x13fe51){_0x3b35ee=_0x3b35ee-0x0;var _0x1d4617=_0xfcbe[_0x3b35ee];return _0x1d4617;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xefcb('0x0'),_0xefcb('0x1'),_0xefcb('0x2')];function createListener(_0x1d029d,_0x752292){return function(_0x11e156){_0x752292['emit'](_0x1d029d,_0x11e156);};}function removeListener(_0xbfb8c6,_0x14f3b5){return function(){MailAccountEvents['removeListener'](_0xbfb8c6,_0x14f3b5);};}exports['register']=function(_0x50dcde){for(var _0x3f322c=0x0,_0x4e15ab=events['length'];_0x3f322c<_0x4e15ab;_0x3f322c++){var _0x4697fe=events[_0x3f322c];var _0x55cad2=createListener(_0xefcb('0x3')+_0x4697fe,_0x50dcde);MailAccountEvents['on'](_0x4697fe,_0x55cad2);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 803e202..648afc7 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 _0x76dc=['../../config/environment','/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x76dc,0x1f2));var _0xc76d=function(_0x7960ae,_0x49d992){_0x7960ae=_0x7960ae-0x0;var _0x1619d7=_0x76dc[_0x7960ae];return _0x1619d7;};'use strict';var multer=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var path=require(_0xc76d('0x2'));var timeout=require(_0xc76d('0x3'));var express=require('express');var router=express[_0xc76d('0x4')]();var auth=require(_0xc76d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc76d('0x6'));var controller=require('./mailApplication.controller');router['get'](_0xc76d('0x7'),auth[_0xc76d('0x8')](),controller[_0xc76d('0x9')]);router['put']('/:id',auth[_0xc76d('0x8')](),controller[_0xc76d('0xa')]);router[_0xc76d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xc76d('0xc')]);module[_0xc76d('0xd')]=router; \ No newline at end of file +var _0x7072=['put','update','delete','exports','util','path','connect-timeout','express','Router','../../config/environment','get','/:id','isAuthenticated','show'];(function(_0x5c73ca,_0x4c3521){var _0x27e5da=function(_0x18d131){while(--_0x18d131){_0x5c73ca['push'](_0x5c73ca['shift']());}};_0x27e5da(++_0x4c3521);}(_0x7072,0x138));var _0x2707=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x7072[_0x3511d3];return _0x5d6321;};'use strict';var multer=require('multer');var util=require(_0x2707('0x0'));var path=require(_0x2707('0x1'));var timeout=require(_0x2707('0x2'));var express=require(_0x2707('0x3'));var router=express[_0x2707('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2707('0x5'));var controller=require('./mailApplication.controller');router[_0x2707('0x6')](_0x2707('0x7'),auth[_0x2707('0x8')](),controller[_0x2707('0x9')]);router[_0x2707('0xa')](_0x2707('0x7'),auth[_0x2707('0x8')](),controller[_0x2707('0xb')]);router[_0x2707('0xc')](_0x2707('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x2707('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 47ef11a..e9a3881 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 _0xa85a=['exports','INTEGER','noop','TEXT','STRING','sequelize'];(function(_0x18e7e5,_0x5ad463){var _0x30c78a=function(_0x473e33){while(--_0x473e33){_0x18e7e5['push'](_0x18e7e5['shift']());}};_0x30c78a(++_0x5ad463);}(_0xa85a,0x1df));var _0xaa85=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xa85a[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require(_0xaa85('0x0'));module[_0xaa85('0x1')]={'priority':{'type':Sequelize[_0xaa85('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaa85('0x3')},'appdata':{'type':Sequelize[_0xaa85('0x4')]()},'description':{'type':Sequelize[_0xaa85('0x5')]},'interval':{'type':Sequelize[_0xaa85('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x14a5=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x3fe6df,_0x5a04d4){var _0x372a0e=function(_0x144b98){while(--_0x144b98){_0x3fe6df['push'](_0x3fe6df['shift']());}};_0x372a0e(++_0x5a04d4);}(_0x14a5,0x176));var _0x514a=function(_0xd90d90,_0x2db30f){_0xd90d90=_0xd90d90-0x0;var _0x431bdb=_0x14a5[_0xd90d90];return _0x431bdb;};'use strict';var Sequelize=require(_0x514a('0x0'));module[_0x514a('0x1')]={'priority':{'type':Sequelize[_0x514a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x514a('0x3')],'allowNull':![],'defaultValue':_0x514a('0x4')},'appdata':{'type':Sequelize[_0x514a('0x5')]()},'description':{'type':Sequelize[_0x514a('0x3')]},'interval':{'type':Sequelize[_0x514a('0x3')],'defaultValue':_0x514a('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 4da945c..79e0998 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 _0x6f47=['offset','limit','set','Content-Range','json','apply','reject','save','then','end','stack','send','show','model','query','keys','filters','attributes','intersection','fields','length','includeAll','include','merge','options','MailApplication','find','body','catch','destroy','params','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count'];(function(_0x1a4b04,_0x3b7fe1){var _0x2f794e=function(_0xbf55ce){while(--_0xbf55ce){_0x1a4b04['push'](_0x1a4b04['shift']());}};_0x2f794e(++_0x3b7fe1);}(_0x6f47,0xc7));var _0x76f4=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x6f47[_0x1d24eb];return _0x1dc576;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x76f4('0x0'));var rimraf=require(_0x76f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x76f4('0x2'));var rp=require('request-promise');var moment=require(_0x76f4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x76f4('0x4'));var util=require(_0x76f4('0x5'));var path=require(_0x76f4('0x6'));var sox=require(_0x76f4('0x7'));var csv=require('to-csv');var ejs=require(_0x76f4('0x8'));var fs=require('fs');var _=require(_0x76f4('0x9'));var squel=require(_0x76f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x76f4('0xb'));var deskjs=require(_0x76f4('0xc'));var toCsv=require(_0x76f4('0xd'));var querystring=require(_0x76f4('0xe'));var Papa=require(_0x76f4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76f4('0x10'));var as=require(_0x76f4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76f4('0x12'));var utils=require(_0x76f4('0x13'));var config=require(_0x76f4('0x14'));var db=require(_0x76f4('0x15'))['db'];function respondWithStatusCode(_0x1aee7f,_0xafd21e){_0xafd21e=_0xafd21e||0xcc;return function(_0xf7e347){if(_0xf7e347){return _0x1aee7f[_0x76f4('0x16')](_0xafd21e);}return _0x1aee7f[_0x76f4('0x17')](_0xafd21e)['end']();};}function respondWithResult(_0x41ba00,_0x30dabf){_0x30dabf=_0x30dabf||0xc8;return function(_0x5da1ff){if(_0x5da1ff){return _0x41ba00['status'](_0x30dabf)['json'](_0x5da1ff);}};}function respondWithFilteredResult(_0x1d7755,_0x3dd240){return function(_0x979946){if(_0x979946){var _0x40252d=_0x979946[_0x76f4('0x18')],_0x3d8f5a=_0x3dd240[_0x76f4('0x19')],_0x2b5e23=_0x3dd240[_0x76f4('0x19')]+_0x3dd240[_0x76f4('0x1a')],_0x46ba51;if(_0x2b5e23>=_0x40252d){_0x2b5e23=_0x40252d;_0x46ba51=0xc8;}else{_0x46ba51=0xce;}_0x1d7755[_0x76f4('0x17')](_0x46ba51);return _0x1d7755[_0x76f4('0x1b')](_0x76f4('0x1c'),_0x3d8f5a+'-'+_0x2b5e23+'/'+_0x40252d)[_0x76f4('0x1d')](_0x979946);}return null;};}function patchUpdates(_0x397360){return function(_0xfedbe4){try{jsonpatch[_0x76f4('0x1e')](_0xfedbe4,_0x397360,!![]);}catch(_0x435534){return BPromise[_0x76f4('0x1f')](_0x435534);}return _0xfedbe4[_0x76f4('0x20')]();};}function saveUpdates(_0x285232,_0x5bf3d5){return function(_0x262937){if(_0x262937){return _0x262937['update'](_0x285232)[_0x76f4('0x21')](function(_0x24ecac){return _0x24ecac;});}return null;};}function removeEntity(_0xf8f722,_0x517c00){return function(_0x567f2a){if(_0x567f2a){return _0x567f2a['destroy']()[_0x76f4('0x21')](function(){_0xf8f722[_0x76f4('0x17')](0xcc)[_0x76f4('0x22')]();});}};}function handleEntityNotFound(_0x2b6d51,_0x42ef70){return function(_0x4786c9){if(!_0x4786c9){_0x2b6d51[_0x76f4('0x16')](0x194);}return _0x4786c9;};}function handleError(_0x4dac8e,_0x504aa8){_0x504aa8=_0x504aa8||0x1f4;return function(_0x3794fa){logger['error'](_0x3794fa[_0x76f4('0x23')]);if(_0x3794fa['name']){delete _0x3794fa['name'];}_0x4dac8e['status'](_0x504aa8)[_0x76f4('0x24')](_0x3794fa);};}exports[_0x76f4('0x25')]=function(_0xd368a2,_0x1d1fe6){var _0x13d219={'raw':!![],'where':{'id':_0xd368a2['params']['id']}},_0x447dbc={};_0x447dbc[_0x76f4('0x26')]=_['keys'](db['MailApplication']['rawAttributes']);_0x447dbc[_0x76f4('0x27')]=_[_0x76f4('0x28')](_0xd368a2[_0x76f4('0x27')]);_0x447dbc[_0x76f4('0x29')]=_['intersection'](_0x447dbc[_0x76f4('0x26')],_0x447dbc['query']);_0x13d219[_0x76f4('0x2a')]=_[_0x76f4('0x2b')](_0x447dbc[_0x76f4('0x26')],qs[_0x76f4('0x2c')](_0xd368a2[_0x76f4('0x27')]['fields']));_0x13d219['attributes']=_0x13d219[_0x76f4('0x2a')][_0x76f4('0x2d')]?_0x13d219[_0x76f4('0x2a')]:_0x447dbc[_0x76f4('0x26')];if(_0xd368a2[_0x76f4('0x27')][_0x76f4('0x2e')]){_0x13d219[_0x76f4('0x2f')]=[{'all':!![]}];}_0x13d219=_[_0x76f4('0x30')]({},_0x13d219,_0xd368a2[_0x76f4('0x31')]);return db[_0x76f4('0x32')][_0x76f4('0x33')](_0x13d219)[_0x76f4('0x21')](handleEntityNotFound(_0x1d1fe6,null))['then'](respondWithResult(_0x1d1fe6,null))['catch'](handleError(_0x1d1fe6,null));};exports['update']=function(_0x573d1c,_0x390795){if(_0x573d1c[_0x76f4('0x34')]['id']){delete _0x573d1c[_0x76f4('0x34')]['id'];}return db[_0x76f4('0x32')][_0x76f4('0x33')]({'where':{'id':_0x573d1c['params']['id']}})[_0x76f4('0x21')](handleEntityNotFound(_0x390795,null))[_0x76f4('0x21')](saveUpdates(_0x573d1c[_0x76f4('0x34')],null))[_0x76f4('0x21')](respondWithResult(_0x390795,null))[_0x76f4('0x35')](handleError(_0x390795,null));};exports[_0x76f4('0x36')]=function(_0xb806cc,_0x28d9d6){return db[_0x76f4('0x32')][_0x76f4('0x33')]({'where':{'id':_0xb806cc[_0x76f4('0x37')]['id']}})[_0x76f4('0x21')](handleEntityNotFound(_0x28d9d6,null))[_0x76f4('0x21')](removeEntity(_0x28d9d6,null))[_0x76f4('0x35')](handleError(_0x28d9d6,null));}; \ No newline at end of file +var _0xf433=['json','offset','limit','set','apply','save','update','then','destroy','end','error','stack','name','send','show','params','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','MailApplication','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xf433,0x198));var _0x3f43=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf433[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3f43('0x0'));var rimraf=require(_0x3f43('0x1'));var zipdir=require(_0x3f43('0x2'));var jsonpatch=require(_0x3f43('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3f43('0x4'));var Mustache=require('mustache');var util=require(_0x3f43('0x5'));var path=require(_0x3f43('0x6'));var sox=require(_0x3f43('0x7'));var csv=require('to-csv');var ejs=require(_0x3f43('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3f43('0x9'));var crypto=require(_0x3f43('0xa'));var jsforce=require(_0x3f43('0xb'));var deskjs=require(_0x3f43('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3f43('0xd'));var Papa=require(_0x3f43('0xe'));var Redis=require(_0x3f43('0xf'));var authService=require(_0x3f43('0x10'));var qs=require(_0x3f43('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f43('0x12'));var logger=require(_0x3f43('0x13'))(_0x3f43('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x3f43('0x15'))['db'];function respondWithStatusCode(_0x7e5f70,_0x5d1876){_0x5d1876=_0x5d1876||0xcc;return function(_0x4b348e){if(_0x4b348e){return _0x7e5f70[_0x3f43('0x16')](_0x5d1876);}return _0x7e5f70[_0x3f43('0x17')](_0x5d1876)['end']();};}function respondWithResult(_0x4e0f11,_0x5a2ba7){_0x5a2ba7=_0x5a2ba7||0xc8;return function(_0x25497e){if(_0x25497e){return _0x4e0f11[_0x3f43('0x17')](_0x5a2ba7)[_0x3f43('0x18')](_0x25497e);}};}function respondWithFilteredResult(_0x3cdbdd,_0x434f5f){return function(_0x4f9900){if(_0x4f9900){var _0x5d22fb=_0x4f9900['count'],_0x3af512=_0x434f5f[_0x3f43('0x19')],_0x5090fb=_0x434f5f['offset']+_0x434f5f[_0x3f43('0x1a')],_0x4a2d58;if(_0x5090fb>=_0x5d22fb){_0x5090fb=_0x5d22fb;_0x4a2d58=0xc8;}else{_0x4a2d58=0xce;}_0x3cdbdd[_0x3f43('0x17')](_0x4a2d58);return _0x3cdbdd[_0x3f43('0x1b')]('Content-Range',_0x3af512+'-'+_0x5090fb+'/'+_0x5d22fb)['json'](_0x4f9900);}return null;};}function patchUpdates(_0x3368f2){return function(_0x3c96f3){try{jsonpatch[_0x3f43('0x1c')](_0x3c96f3,_0x3368f2,!![]);}catch(_0x121958){return BPromise['reject'](_0x121958);}return _0x3c96f3[_0x3f43('0x1d')]();};}function saveUpdates(_0x470b3f,_0x2f5d0f){return function(_0x15b542){if(_0x15b542){return _0x15b542[_0x3f43('0x1e')](_0x470b3f)[_0x3f43('0x1f')](function(_0x509207){return _0x509207;});}return null;};}function removeEntity(_0x594ad8,_0x18e93e){return function(_0x114393){if(_0x114393){return _0x114393[_0x3f43('0x20')]()[_0x3f43('0x1f')](function(){_0x594ad8[_0x3f43('0x17')](0xcc)[_0x3f43('0x21')]();});}};}function handleEntityNotFound(_0x3eade1,_0x3682f5){return function(_0x1f33df){if(!_0x1f33df){_0x3eade1[_0x3f43('0x16')](0x194);}return _0x1f33df;};}function handleError(_0x37dcd3,_0x35ee0f){_0x35ee0f=_0x35ee0f||0x1f4;return function(_0x2b6887){logger[_0x3f43('0x22')](_0x2b6887[_0x3f43('0x23')]);if(_0x2b6887[_0x3f43('0x24')]){delete _0x2b6887['name'];}_0x37dcd3['status'](_0x35ee0f)[_0x3f43('0x25')](_0x2b6887);};}exports[_0x3f43('0x26')]=function(_0x122be7,_0x1e6d1a){var _0x192883={'raw':!![],'where':{'id':_0x122be7[_0x3f43('0x27')]['id']}},_0x5bc304={};_0x5bc304['model']=_[_0x3f43('0x28')](db['MailApplication'][_0x3f43('0x29')]);_0x5bc304['query']=_[_0x3f43('0x28')](_0x122be7[_0x3f43('0x2a')]);_0x5bc304[_0x3f43('0x2b')]=_[_0x3f43('0x2c')](_0x5bc304[_0x3f43('0x2d')],_0x5bc304['query']);_0x192883[_0x3f43('0x2e')]=_[_0x3f43('0x2c')](_0x5bc304['model'],qs[_0x3f43('0x2f')](_0x122be7['query']['fields']));_0x192883['attributes']=_0x192883['attributes'][_0x3f43('0x30')]?_0x192883[_0x3f43('0x2e')]:_0x5bc304[_0x3f43('0x2d')];if(_0x122be7[_0x3f43('0x2a')]['includeAll']){_0x192883['include']=[{'all':!![]}];}_0x192883=_[_0x3f43('0x31')]({},_0x192883,_0x122be7['options']);return db[_0x3f43('0x32')][_0x3f43('0x33')](_0x192883)[_0x3f43('0x1f')](handleEntityNotFound(_0x1e6d1a,null))[_0x3f43('0x1f')](respondWithResult(_0x1e6d1a,null))[_0x3f43('0x34')](handleError(_0x1e6d1a,null));};exports[_0x3f43('0x1e')]=function(_0x42d23f,_0x99a513){if(_0x42d23f['body']['id']){delete _0x42d23f[_0x3f43('0x35')]['id'];}return db[_0x3f43('0x32')]['find']({'where':{'id':_0x42d23f[_0x3f43('0x27')]['id']}})[_0x3f43('0x1f')](handleEntityNotFound(_0x99a513,null))[_0x3f43('0x1f')](saveUpdates(_0x42d23f[_0x3f43('0x35')],null))[_0x3f43('0x1f')](respondWithResult(_0x99a513,null))['catch'](handleError(_0x99a513,null));};exports[_0x3f43('0x20')]=function(_0x21c849,_0x2d0817){return db[_0x3f43('0x32')][_0x3f43('0x33')]({'where':{'id':_0x21c849[_0x3f43('0x27')]['id']}})[_0x3f43('0x1f')](handleEntityNotFound(_0x2d0817,null))[_0x3f43('0x1f')](removeEntity(_0x2d0817,null))[_0x3f43('0x34')](handleError(_0x2d0817,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 550541f..ddc14e3 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 _0xf65d=['mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','exports','define'];(function(_0x3aa8e4,_0x3f7415){var _0x5b931a=function(_0x4ccdc9){while(--_0x4ccdc9){_0x3aa8e4['push'](_0x3aa8e4['shift']());}};_0x5b931a(++_0x3f7415);}(_0xf65d,0x9f));var _0xdf65=function(_0x7bc63a,_0x26422a){_0x7bc63a=_0x7bc63a-0x0;var _0xed898e=_0xf65d[_0x7bc63a];return _0xed898e;};'use strict';var _=require(_0xdf65('0x0'));var util=require('util');var logger=require(_0xdf65('0x1'))(_0xdf65('0x2'));var moment=require(_0xdf65('0x3'));var BPromise=require(_0xdf65('0x4'));var rp=require(_0xdf65('0x5'));var fs=require('fs');var path=require(_0xdf65('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0xdf65('0x7')]=function(_0x4ac44a,_0x254ddf){return _0x4ac44a[_0xdf65('0x8')]('MailApplication',attributes,{'tableName':_0xdf65('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdf65('0xa'),'collate':_0xdf65('0xb')});}; \ No newline at end of file +var _0x2f68=['exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailApplication.attributes'];(function(_0x50b7be,_0x5d0284){var _0x59e111=function(_0x2b0546){while(--_0x2b0546){_0x50b7be['push'](_0x50b7be['shift']());}};_0x59e111(++_0x5d0284);}(_0x2f68,0x12b));var _0x82f6=function(_0x533204,_0x2494b7){_0x533204=_0x533204-0x0;var _0x5f0501=_0x2f68[_0x533204];return _0x5f0501;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var logger=require(_0x82f6('0x1'))(_0x82f6('0x2'));var moment=require(_0x82f6('0x3'));var BPromise=require(_0x82f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82f6('0x5'));var rimraf=require(_0x82f6('0x6'));var config=require(_0x82f6('0x7'));var attributes=require(_0x82f6('0x8'));module[_0x82f6('0x9')]=function(_0x5ba356,_0x5d37fe){return _0x5ba356[_0x82f6('0xa')]('MailApplication',attributes,{'tableName':_0x82f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x82f6('0xc'),'collate':_0x82f6('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 5759751..5be4b36 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 _0x3eb0=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','MailApplication','update','options','raw','where','attributes','UpdateMailApplication','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x382ae4,_0x20adb0){var _0x441514=function(_0x6c555){while(--_0x6c555){_0x382ae4['push'](_0x382ae4['shift']());}};_0x441514(++_0x20adb0);}(_0x3eb0,0x18d));var _0x03eb=function(_0x47156b,_0xa94e46){_0x47156b=_0x47156b-0x0;var _0x5dce2c=_0x3eb0[_0x47156b];return _0x5dce2c;};'use strict';var _=require(_0x03eb('0x0'));var util=require(_0x03eb('0x1'));var moment=require(_0x03eb('0x2'));var BPromise=require(_0x03eb('0x3'));var rs=require(_0x03eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x03eb('0x5'))['db'];var utils=require(_0x03eb('0x6'));var logger=require(_0x03eb('0x7'))('rpc');var config=require(_0x03eb('0x8'));var jayson=require(_0x03eb('0x9'));var client=jayson[_0x03eb('0xa')][_0x03eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f4e6a,_0x5a3bbf,_0x44fb24){return new BPromise(function(_0x55cc1a,_0x49022c){return client[_0x03eb('0xc')](_0x1f4e6a,_0x44fb24)[_0x03eb('0xd')](function(_0x321264){logger[_0x03eb('0xe')]('MailApplication,\x20%s,\x20%s',_0x5a3bbf,_0x03eb('0xf'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x5a3bbf,_0x03eb('0xf'),JSON[_0x03eb('0x10')](_0x321264));if(_0x321264[_0x03eb('0x11')]){if(_0x321264['error'][_0x03eb('0x12')]===0x1f4){logger[_0x03eb('0x11')](_0x03eb('0x13'),_0x5a3bbf,_0x321264[_0x03eb('0x11')]['message']);return _0x49022c(_0x321264[_0x03eb('0x11')][_0x03eb('0x14')]);}logger[_0x03eb('0x11')](_0x03eb('0x13'),_0x5a3bbf,_0x321264[_0x03eb('0x11')][_0x03eb('0x14')]);return _0x55cc1a(_0x321264[_0x03eb('0x11')][_0x03eb('0x14')]);}else{logger[_0x03eb('0xe')](_0x03eb('0x13'),_0x5a3bbf,_0x03eb('0xf'));_0x55cc1a(_0x321264[_0x03eb('0x15')][_0x03eb('0x14')]);}})['catch'](function(_0x2d84df){logger[_0x03eb('0x11')](_0x03eb('0x13'),_0x5a3bbf,_0x2d84df);_0x49022c(_0x2d84df);});});}exports['UpdateMailApplication']=function(_0x39b9de){var _0x2e192d=this;return new Promise(function(_0x21fee7,_0x302cb2){return db[_0x03eb('0x16')][_0x03eb('0x17')](_0x39b9de['body'],{'raw':_0x39b9de[_0x03eb('0x18')]?_0x39b9de[_0x03eb('0x18')][_0x03eb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39b9de[_0x03eb('0x18')]?_0x39b9de[_0x03eb('0x18')][_0x03eb('0x1a')]||null:null,'attributes':_0x39b9de['options']?_0x39b9de['options'][_0x03eb('0x1b')]||null:null,'limit':_0x39b9de[_0x03eb('0x18')]?_0x39b9de[_0x03eb('0x18')]['limit']||null:null})['then'](function(_0x3dc8f9){logger[_0x03eb('0xe')](_0x03eb('0x1c'),_0x39b9de);logger[_0x03eb('0x1d')]('UpdateMailApplication',_0x39b9de,JSON[_0x03eb('0x10')](_0x3dc8f9));_0x21fee7(_0x3dc8f9);})[_0x03eb('0x1e')](function(_0x42fb60){logger[_0x03eb('0x11')](_0x03eb('0x1c'),_0x42fb60[_0x03eb('0x14')],_0x39b9de);_0x302cb2(_0x2e192d[_0x03eb('0x11')](0x1f4,_0x42fb60[_0x03eb('0x14')]));});});}; \ No newline at end of file +var _0xd61a=['message','result','catch','update','body','options','where','attributes','limit','UpdateMailApplication','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2aee2f,_0xad9887){var _0x19337f=function(_0x2e62d){while(--_0x2e62d){_0x2aee2f['push'](_0x2aee2f['shift']());}};_0x19337f(++_0xad9887);}(_0xd61a,0xa5));var _0xad61=function(_0x491ec2,_0x540c00){_0x491ec2=_0x491ec2-0x0;var _0x1748db=_0xd61a[_0x491ec2];return _0x1748db;};'use strict';var _=require(_0xad61('0x0'));var util=require(_0xad61('0x1'));var moment=require(_0xad61('0x2'));var BPromise=require(_0xad61('0x3'));var rs=require(_0xad61('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad61('0x5'))['db'];var utils=require(_0xad61('0x6'));var logger=require(_0xad61('0x7'))(_0xad61('0x8'));var config=require(_0xad61('0x9'));var jayson=require(_0xad61('0xa'));var client=jayson[_0xad61('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x115e85,_0x25568d,_0x2c0c09){return new BPromise(function(_0x2235b4,_0x5e3331){return client[_0xad61('0xc')](_0x115e85,_0x2c0c09)[_0xad61('0xd')](function(_0x598faf){logger[_0xad61('0xe')](_0xad61('0xf'),_0x25568d,_0xad61('0x10'));logger[_0xad61('0x11')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x25568d,'request\x20sent',JSON[_0xad61('0x12')](_0x598faf));if(_0x598faf[_0xad61('0x13')]){if(_0x598faf[_0xad61('0x13')][_0xad61('0x14')]===0x1f4){logger[_0xad61('0x13')](_0xad61('0xf'),_0x25568d,_0x598faf[_0xad61('0x13')][_0xad61('0x15')]);return _0x5e3331(_0x598faf[_0xad61('0x13')][_0xad61('0x15')]);}logger[_0xad61('0x13')]('MailApplication,\x20%s,\x20%s',_0x25568d,_0x598faf['error'][_0xad61('0x15')]);return _0x2235b4(_0x598faf[_0xad61('0x13')]['message']);}else{logger[_0xad61('0xe')](_0xad61('0xf'),_0x25568d,'request\x20sent');_0x2235b4(_0x598faf[_0xad61('0x16')][_0xad61('0x15')]);}})[_0xad61('0x17')](function(_0x3ff6cd){logger[_0xad61('0x13')](_0xad61('0xf'),_0x25568d,_0x3ff6cd);_0x5e3331(_0x3ff6cd);});});}exports['UpdateMailApplication']=function(_0x2a3166){var _0x1b3e93=this;return new Promise(function(_0x1e14c1,_0x51d02){return db['MailApplication'][_0xad61('0x18')](_0x2a3166[_0xad61('0x19')],{'raw':_0x2a3166['options']?_0x2a3166[_0xad61('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a3166[_0xad61('0x1a')]?_0x2a3166['options'][_0xad61('0x1b')]||null:null,'attributes':_0x2a3166[_0xad61('0x1a')]?_0x2a3166['options'][_0xad61('0x1c')]||null:null,'limit':_0x2a3166[_0xad61('0x1a')]?_0x2a3166[_0xad61('0x1a')][_0xad61('0x1d')]||null:null})[_0xad61('0xd')](function(_0x43ce1b){logger['info']('UpdateMailApplication',_0x2a3166);logger[_0xad61('0x11')](_0xad61('0x1e'),_0x2a3166,JSON[_0xad61('0x12')](_0x43ce1b));_0x1e14c1(_0x43ce1b);})['catch'](function(_0x1f55ff){logger[_0xad61('0x13')]('UpdateMailApplication',_0x1f55ff[_0xad61('0x15')],_0x2a3166);_0x51d02(_0x1b3e93[_0xad61('0x13')](0x1f4,_0x1f55ff['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 8fcafc2..2be296d 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 _0x6068=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','isAuthenticated','index','get','/describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','util','path'];(function(_0x2e5a4c,_0xe67887){var _0x37edc6=function(_0x33e406){while(--_0x33e406){_0x2e5a4c['push'](_0x2e5a4c['shift']());}};_0x37edc6(++_0xe67887);}(_0x6068,0x134));var _0x8606=function(_0x6d76e8,_0x3a5b96){_0x6d76e8=_0x6d76e8-0x0;var _0x10a933=_0x6068[_0x6d76e8];return _0x10a933;};'use strict';var multer=require('multer');var util=require(_0x8606('0x0'));var path=require(_0x8606('0x1'));var timeout=require(_0x8606('0x2'));var express=require(_0x8606('0x3'));var router=express[_0x8606('0x4')]();var auth=require(_0x8606('0x5'));var interaction=require(_0x8606('0x6'));var config=require(_0x8606('0x7'));var controller=require(_0x8606('0x8'));router['get']('/',auth[_0x8606('0x9')](),controller[_0x8606('0xa')]);router[_0x8606('0xb')](_0x8606('0xc'),auth[_0x8606('0x9')](),controller['describe']);router['get'](_0x8606('0xd'),auth[_0x8606('0x9')](),controller['show']);router['get'](_0x8606('0xe'),auth[_0x8606('0x9')](),controller[_0x8606('0xf')]);router[_0x8606('0xb')](_0x8606('0x10'),auth[_0x8606('0x9')](),controller[_0x8606('0x11')]);router[_0x8606('0x12')]('/',auth[_0x8606('0x9')](),controller[_0x8606('0x13')]);router[_0x8606('0x12')]('/:id/messages',auth[_0x8606('0x9')](),controller[_0x8606('0x14')]);router[_0x8606('0x12')](_0x8606('0x15'),auth[_0x8606('0x9')](),interaction[_0x8606('0x16')](_0x8606('0x17'),'mailinteraction:addtags'),controller[_0x8606('0x18')]);router[_0x8606('0x19')](_0x8606('0xd'),auth[_0x8606('0x9')](),interaction[_0x8606('0x16')](_0x8606('0x17'),_0x8606('0x1a')),controller[_0x8606('0x1b')]);router[_0x8606('0x1c')](_0x8606('0xd'),auth['isAuthenticated'](),interaction[_0x8606('0x16')](_0x8606('0x17'),_0x8606('0x1d')),controller['destroy']);router[_0x8606('0x1c')](_0x8606('0x15'),auth[_0x8606('0x9')](),controller[_0x8606('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xf228=['mailinteraction:update','delete','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','mail','mailinteraction:addtags','put','/:id','tracked'];(function(_0x2aee2f,_0xad9887){var _0x19337f=function(_0x2e62d){while(--_0x2e62d){_0x2aee2f['push'](_0x2aee2f['shift']());}};_0x19337f(++_0xad9887);}(_0xf228,0x1a9));var _0x8f22=function(_0x4c6edb,_0x46fdaf){_0x4c6edb=_0x4c6edb-0x0;var _0x3a185a=_0xf228[_0x4c6edb];return _0x3a185a;};'use strict';var multer=require(_0x8f22('0x0'));var util=require(_0x8f22('0x1'));var path=require('path');var timeout=require(_0x8f22('0x2'));var express=require(_0x8f22('0x3'));var router=express[_0x8f22('0x4')]();var auth=require(_0x8f22('0x5'));var interaction=require(_0x8f22('0x6'));var config=require(_0x8f22('0x7'));var controller=require('./mailInteraction.controller');router['get']('/',auth[_0x8f22('0x8')](),controller['index']);router[_0x8f22('0x9')](_0x8f22('0xa'),auth['isAuthenticated'](),controller[_0x8f22('0xb')]);router[_0x8f22('0x9')]('/:id',auth[_0x8f22('0x8')](),controller[_0x8f22('0xc')]);router[_0x8f22('0x9')](_0x8f22('0xd'),auth[_0x8f22('0x8')](),controller[_0x8f22('0xe')]);router[_0x8f22('0x9')](_0x8f22('0xf'),auth['isAuthenticated'](),controller[_0x8f22('0x10')]);router[_0x8f22('0x11')]('/',auth[_0x8f22('0x8')](),controller['create']);router[_0x8f22('0x11')]('/:id/messages',auth[_0x8f22('0x8')](),controller[_0x8f22('0x12')]);router[_0x8f22('0x11')](_0x8f22('0x13'),auth[_0x8f22('0x8')](),interaction['tracked'](_0x8f22('0x14'),_0x8f22('0x15')),controller['addTags']);router[_0x8f22('0x16')](_0x8f22('0x17'),auth['isAuthenticated'](),interaction[_0x8f22('0x18')](_0x8f22('0x14'),_0x8f22('0x19')),controller['update']);router[_0x8f22('0x1a')](_0x8f22('0x17'),auth[_0x8f22('0x8')](),interaction[_0x8f22('0x18')]('mail','mailinteraction:destroy'),controller[_0x8f22('0x1b')]);router['delete'](_0x8f22('0x13'),auth['isAuthenticated'](),controller[_0x8f22('0x1c')]);module[_0x8f22('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index f6d9c90..21541c7 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 _0x41d9=['ENUM','out','sequelize','iconv','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0xc569f3,_0x485552){var _0x152849=function(_0x4f619f){while(--_0x4f619f){_0xc569f3['push'](_0xc569f3['shift']());}};_0x152849(++_0x485552);}(_0x41d9,0xd1));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x941d('0x0'));var iconv=require(_0x941d('0x1'));module['exports']={'closed':{'type':Sequelize[_0x941d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x941d('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x941d('0x4')]},'inReplyTo':{'type':Sequelize[_0x941d('0x4')](0x1fe)},'to':{'type':Sequelize[_0x941d('0x4')]},'cc':{'type':Sequelize[_0x941d('0x5')](_0x941d('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x941d('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x941d('0x3')]},'substatus':{'type':Sequelize[_0x941d('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x941d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x941d('0x7')]('in',_0x941d('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x941d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x941d('0x7')]('in',_0x941d('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x941d('0x5')](_0x941d('0x6'))},'lastMsgText':{'type':Sequelize[_0x941d('0x5')](_0x941d('0x6'))}}; \ No newline at end of file +var _0x7d2a=['DATE','STRING','TEXT','out','ENUM','sequelize','BOOLEAN'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7d2a,0x171));var _0xa7d2=function(_0x2d07b2,_0x3979e6){_0x2d07b2=_0x2d07b2-0x0;var _0x492ae7=_0x7d2a[_0x2d07b2];return _0x492ae7;};'use strict';var Sequelize=require(_0xa7d2('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0xa7d2('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa7d2('0x2')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa7d2('0x3')]},'inReplyTo':{'type':Sequelize[_0xa7d2('0x3')](0x1fe)},'to':{'type':Sequelize[_0xa7d2('0x3')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xa7d2('0x4')]()},'attach':{'type':Sequelize[_0xa7d2('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xa7d2('0x2')]},'substatus':{'type':Sequelize[_0xa7d2('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xa7d2('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa7d2('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa7d2('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa7d2('0x6')]('in',_0xa7d2('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xa7d2('0x4')]('long')},'lastMsgText':{'type':Sequelize['TEXT']('long')}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 08c60f8..feb0ab2 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','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','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x2757e6,_0x31c1b8){var _0x52d739=function(_0x471dae){while(--_0x471dae){_0x2757e6['push'](_0x2757e6['shift']());}};_0x52d739(++_0x31c1b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file +var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','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','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x51c209,_0x5a76c4){var _0x4078f1=function(_0x5c9fbc){while(--_0x5c9fbc){_0x51c209['push'](_0x51c209['shift']());}};_0x4078f1(++_0x5a76c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 88a6023..a15ef78 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 _0xd278=['emit','hasOwnProperty','hook','../../mysqldb','MailInteraction','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x2002b3,_0x11e91c){var _0x2756f0=function(_0x4bf0b3){while(--_0x4bf0b3){_0x2002b3['push'](_0x2002b3['shift']());}};_0x2756f0(++_0x11e91c);}(_0xd278,0xb7));var _0x8d27=function(_0x5119fb,_0x234d77){_0x5119fb=_0x5119fb-0x0;var _0x271a98=_0xd278[_0x5119fb];return _0x271a98;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x8d27('0x0'))['db'][_0x8d27('0x1')];var MailMessage=require(_0x8d27('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x8d27('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8d27('0x3'),'afterDestroy':_0x8d27('0x4')};function emitEvent(_0x1101c9){return function(_0x2dd1cd,_0x1f586c,_0x3cd1ff){_0x2dd1cd[_0x8d27('0x5')]({'attributes':['id'],'raw':!![]})[_0x8d27('0x6')](function(_0x267eb8){_0x2dd1cd[_0x8d27('0x7')](_0x8d27('0x8'),_0x267eb8[_0x8d27('0x9')](function(_0x48b1b1){return{'id':_0x48b1b1['id']};}));return MailMessage[_0x8d27('0xa')]({'where':{'MailInteractionId':_0x2dd1cd['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x349a99){_0x2dd1cd['setDataValue'](_0x8d27('0xb'),_0x349a99['length']);MailInteractionEvents[_0x8d27('0xc')](_0x1101c9+':'+_0x2dd1cd['id'],_0x2dd1cd);MailInteractionEvents[_0x8d27('0xc')](_0x1101c9,_0x2dd1cd);_0x3cd1ff(null);})['catch'](_0x3cd1ff(null));};}for(var e in events){if(events[_0x8d27('0xd')](e)){var event=events[e];MailInteraction[_0x8d27('0xe')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xebc5=['MailMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb'];(function(_0x4206f5,_0x21f338){var _0xa29cf3=function(_0x2d35d7){while(--_0x2d35d7){_0x4206f5['push'](_0x4206f5['shift']());}};_0xa29cf3(++_0x21f338);}(_0xebc5,0x7d));var _0x5ebc=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xebc5[_0x273c39];return _0x46d6b5;};'use strict';var EventEmitter=require(_0x5ebc('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x5ebc('0x1')];var MailMessage=require(_0x5ebc('0x2'))['db'][_0x5ebc('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5ebc('0x4')](0x0);var events={'afterCreate':_0x5ebc('0x5'),'afterUpdate':_0x5ebc('0x6'),'afterDestroy':_0x5ebc('0x7')};function emitEvent(_0x29a939){return function(_0x417ba0,_0x37af0d,_0x321562){_0x417ba0['getUsers']({'attributes':['id'],'raw':!![]})[_0x5ebc('0x8')](function(_0x4bd83d){_0x417ba0[_0x5ebc('0x9')](_0x5ebc('0xa'),_0x4bd83d['map'](function(_0x239b18){return{'id':_0x239b18['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x417ba0['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1bcf46){_0x417ba0[_0x5ebc('0x9')](_0x5ebc('0xb'),_0x1bcf46[_0x5ebc('0xc')]);MailInteractionEvents['emit'](_0x29a939+':'+_0x417ba0['id'],_0x417ba0);MailInteractionEvents['emit'](_0x29a939,_0x417ba0);_0x321562(null);})['catch'](_0x321562(null));};}for(var e in events){if(events[_0x5ebc('0xd')](e)){var event=events[e];MailInteraction[_0x5ebc('0xe')](e,emitEvent(event));}}module[_0x5ebc('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 386869b..e75cc61 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 _0x466f=['closedAt','changed','substatusAt','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','rimraf','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed'];(function(_0xcad71d,_0x522acc){var _0x313709=function(_0x50ab0e){while(--_0x50ab0e){_0xcad71d['push'](_0xcad71d['shift']());}};_0x313709(++_0x522acc);}(_0x466f,0x76));var _0xf466=function(_0x13df66,_0x721231){_0x13df66=_0x13df66-0x0;var _0x50a6cf=_0x466f[_0x13df66];return _0x50a6cf;};'use strict';var _=require(_0xf466('0x0'));var util=require('util');var logger=require(_0xf466('0x1'))(_0xf466('0x2'));var moment=require(_0xf466('0x3'));var BPromise=require('bluebird');var rp=require(_0xf466('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf466('0x5'));var config=require('../../config/environment');var attributes=require(_0xf466('0x6'));module[_0xf466('0x7')]=function(_0x2cc25a,_0x59c855){return _0x2cc25a[_0xf466('0x8')]('MailInteraction',attributes,{'tableName':_0xf466('0x9'),'paranoid':![],'indexes':[{'name':_0xf466('0xa'),'fields':[_0xf466('0xb'),'to'],'type':_0xf466('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1a2b0a,_0x10d47c,_0x79c3c7){if(_0x1a2b0a[_0xf466('0xd')]){_0x1a2b0a['substatusAt']=moment()[_0xf466('0xe')](_0xf466('0xf'));}if(_0x1a2b0a[_0xf466('0x10')]){_0x1a2b0a[_0xf466('0x11')]=moment()['format'](_0xf466('0xf'));}_0x79c3c7(null,_0x10d47c);},'beforeUpdate':function(_0x2ca08f,_0x485b9b,_0x18b29b){if(_0x2ca08f[_0xf466('0x12')](_0xf466('0xd'))){_0x2ca08f[_0xf466('0x13')]=_0x2ca08f[_0xf466('0xd')]?moment()[_0xf466('0xe')](_0xf466('0xf')):null;}if(_0x2ca08f[_0xf466('0x12')](_0xf466('0x10'))){_0x2ca08f[_0xf466('0x11')]=moment()[_0xf466('0xe')](_0xf466('0xf'));_0x2ca08f['substatus']=null;_0x2ca08f['substatusAt']=null;}_0x18b29b(null,_0x2ca08f);},'afterUpdate':function(_0x61b693,_0x2f819f,_0x438513){var _0x30a625=_0x2cc25a['models'];var _0x5c2d34=_0x61b693[_0xf466('0x14')]({'plain':!![]});if(_0x5c2d34[_0xf466('0x10')]){return _0x30a625[_0xf466('0x15')][_0xf466('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x5c2d34['id']}})[_0xf466('0x17')](function(){_0x438513();})[_0xf466('0x18')](function(_0x3f9f11){_0x438513(_0x3f9f11);});}else{_0x438513();}}},'charset':_0xf466('0x19'),'collate':_0xf466('0x1a')});}; \ No newline at end of file +var _0x2121=['FULLTEXT','substatus','substatusAt','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x2121,0x1b4));var _0x1212=function(_0x56e6c1,_0x1446ac){_0x56e6c1=_0x56e6c1-0x0;var _0x54621d=_0x2121[_0x56e6c1];return _0x54621d;};'use strict';var _=require(_0x1212('0x0'));var util=require(_0x1212('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1212('0x2'));var BPromise=require(_0x1212('0x3'));var rp=require(_0x1212('0x4'));var fs=require('fs');var path=require(_0x1212('0x5'));var rimraf=require(_0x1212('0x6'));var config=require('../../config/environment');var attributes=require(_0x1212('0x7'));module['exports']=function(_0x7b16ef,_0x452116){return _0x7b16ef[_0x1212('0x8')](_0x1212('0x9'),attributes,{'tableName':_0x1212('0xa'),'paranoid':![],'indexes':[{'name':_0x1212('0xb'),'fields':['subject','to'],'type':_0x1212('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x29b23f,_0x434d23,_0x9ce2c5){if(_0x29b23f[_0x1212('0xd')]){_0x29b23f[_0x1212('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x29b23f[_0x1212('0xf')]){_0x29b23f[_0x1212('0x10')]=moment()[_0x1212('0x11')](_0x1212('0x12'));}_0x9ce2c5(null,_0x434d23);},'beforeUpdate':function(_0x5790fa,_0x18cf87,_0x3cb42e){if(_0x5790fa[_0x1212('0x13')](_0x1212('0xd'))){_0x5790fa[_0x1212('0xe')]=_0x5790fa[_0x1212('0xd')]?moment()[_0x1212('0x11')](_0x1212('0x12')):null;}if(_0x5790fa[_0x1212('0x13')](_0x1212('0xf'))){_0x5790fa[_0x1212('0x10')]=moment()[_0x1212('0x11')](_0x1212('0x12'));_0x5790fa[_0x1212('0xd')]=null;_0x5790fa[_0x1212('0xe')]=null;}_0x3cb42e(null,_0x5790fa);},'afterUpdate':function(_0x5cc246,_0x568870,_0x54ae52){var _0x3cfe21=_0x7b16ef[_0x1212('0x14')];var _0x768995=_0x5cc246[_0x1212('0x15')]({'plain':!![]});if(_0x768995[_0x1212('0xf')]){return _0x3cfe21[_0x1212('0x16')][_0x1212('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x768995['id']}})[_0x1212('0x18')](function(){_0x54ae52();})[_0x1212('0x19')](function(_0x52128f){_0x54ae52(_0x52128f);});}else{_0x54ae52();}}},'charset':_0x1212('0x1a'),'collate':_0x1212('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 18ac5e0..7607003 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 _0x4b07=['catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','ids','omit','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','localhost','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5f13cd,_0x3daaf8){var _0x827cb7=function(_0x4b658d){while(--_0x4b658d){_0x5f13cd['push'](_0x5f13cd['shift']());}};_0x827cb7(++_0x3daaf8);}(_0x4b07,0x1d6));var _0x74b0=function(_0x5e5eb2,_0x37fbbb){_0x5e5eb2=_0x5e5eb2-0x0;var _0x11e69d=_0x4b07[_0x5e5eb2];return _0x11e69d;};'use strict';var _=require('lodash');var util=require(_0x74b0('0x0'));var moment=require(_0x74b0('0x1'));var BPromise=require('bluebird');var rs=require(_0x74b0('0x2'));var fs=require('fs');var Redis=require(_0x74b0('0x3'));var db=require(_0x74b0('0x4'))['db'];var utils=require(_0x74b0('0x5'));var logger=require('../../config/logger')(_0x74b0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x74b0('0x7')]({'port':0x232a});config[_0x74b0('0x8')]=_['defaults'](config['redis'],{'host':_0x74b0('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x74b0('0x8')]));require(_0x74b0('0xa'))[_0x74b0('0xb')](socket);function respondWithRpcPromise(_0x419fab,_0x3a516c,_0x462a84){return new BPromise(function(_0x2382cd,_0x1c1af8){return client[_0x74b0('0xc')](_0x419fab,_0x462a84)[_0x74b0('0xd')](function(_0x2907a8){logger[_0x74b0('0xe')](_0x74b0('0xf'),_0x3a516c,_0x74b0('0x10'));logger[_0x74b0('0x11')](_0x74b0('0x12'),_0x3a516c,'request\x20sent',JSON[_0x74b0('0x13')](_0x2907a8));if(_0x2907a8[_0x74b0('0x14')]){if(_0x2907a8['error'][_0x74b0('0x15')]===0x1f4){logger['error'](_0x74b0('0xf'),_0x3a516c,_0x2907a8[_0x74b0('0x14')]['message']);return _0x1c1af8(_0x2907a8[_0x74b0('0x14')]['message']);}logger[_0x74b0('0x14')]('MailInteraction,\x20%s,\x20%s',_0x3a516c,_0x2907a8[_0x74b0('0x14')]['message']);return _0x2382cd(_0x2907a8[_0x74b0('0x14')][_0x74b0('0x16')]);}else{logger[_0x74b0('0xe')](_0x74b0('0xf'),_0x3a516c,_0x74b0('0x10'));_0x2382cd(_0x2907a8[_0x74b0('0x17')][_0x74b0('0x16')]);}})[_0x74b0('0x18')](function(_0x4a2c60){logger['error']('MailInteraction,\x20%s,\x20%s',_0x3a516c,_0x4a2c60);_0x1c1af8(_0x4a2c60);});});}exports[_0x74b0('0x19')]=function(_0x4b8893){var _0xf313bc=this;return new Promise(function(_0x41f602,_0xc17e43){return db[_0x74b0('0x1a')]['update'](_0x4b8893[_0x74b0('0x1b')],{'raw':_0x4b8893[_0x74b0('0x1c')]?_0x4b8893[_0x74b0('0x1c')][_0x74b0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b8893['options']?_0x4b8893[_0x74b0('0x1c')][_0x74b0('0x1e')]||null:null,'attributes':_0x4b8893[_0x74b0('0x1c')]?_0x4b8893[_0x74b0('0x1c')][_0x74b0('0x1f')]||null:null,'limit':_0x4b8893[_0x74b0('0x1c')]?_0x4b8893[_0x74b0('0x1c')][_0x74b0('0x20')]||null:null})[_0x74b0('0xd')](function(_0x54e2fd){logger[_0x74b0('0xe')]('UpdateMailInteraction',_0x4b8893);logger['debug'](_0x74b0('0x19'),_0x4b8893,JSON[_0x74b0('0x13')](_0x54e2fd));_0x41f602(_0x54e2fd);})[_0x74b0('0x18')](function(_0x4e78e1){logger[_0x74b0('0x14')](_0x74b0('0x19'),_0x4e78e1[_0x74b0('0x16')],_0x4b8893);_0xc17e43(_0xf313bc[_0x74b0('0x14')](0x1f4,_0x4e78e1['message']));});});};exports[_0x74b0('0x21')]=function(_0x3b84f0){return new Promise(function(_0x2d061b,_0x2163f4){return db[_0x74b0('0x1a')][_0x74b0('0x22')]({'where':_0x3b84f0['options']?_0x3b84f0[_0x74b0('0x1c')]['where']||null:null})[_0x74b0('0xd')](function(_0x3465dc){if(_0x3465dc){return _0x3465dc['addTags'](_0x3b84f0[_0x74b0('0x1b')][_0x74b0('0x23')],_[_0x74b0('0x24')](_0x3b84f0['body'],['ids','id'])||{});}})['spread'](function(_0x11640a){logger[_0x74b0('0xe')]('AddTags',_0x3b84f0);logger[_0x74b0('0x11')](_0x74b0('0x25'),_0x3b84f0,JSON[_0x74b0('0x13')](_0x11640a));_0x2d061b(_0x11640a);})[_0x74b0('0x18')](function(_0x3b338c){logger[_0x74b0('0x14')]('AddTags',_0x3b338c[_0x74b0('0x16')],_0x3b84f0);_0x2163f4(_this[_0x74b0('0x14')](0x1f4,_0x3b338c[_0x74b0('0x16')]));});});}; \ No newline at end of file +var _0x280f=['message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2f5a30,_0x4fe51e){var _0xf074dd=function(_0x2ed134){while(--_0x2ed134){_0x2f5a30['push'](_0x2f5a30['shift']());}};_0xf074dd(++_0x4fe51e);}(_0x280f,0xe2));var _0xf280=function(_0x2b305c,_0x5ae303){_0x2b305c=_0x2b305c-0x0;var _0x5d8c85=_0x280f[_0x2b305c];return _0x5d8c85;};'use strict';var _=require(_0xf280('0x0'));var util=require('util');var moment=require(_0xf280('0x1'));var BPromise=require(_0xf280('0x2'));var rs=require(_0xf280('0x3'));var fs=require('fs');var Redis=require(_0xf280('0x4'));var db=require(_0xf280('0x5'))['db'];var utils=require(_0xf280('0x6'));var logger=require(_0xf280('0x7'))('rpc');var config=require(_0xf280('0x8'));var jayson=require(_0xf280('0x9'));var client=jayson[_0xf280('0xa')][_0xf280('0xb')]({'port':0x232a});config[_0xf280('0xc')]=_['defaults'](config[_0xf280('0xc')],{'host':_0xf280('0xd'),'port':0x18eb});var socket=require(_0xf280('0xe'))(new Redis(config[_0xf280('0xc')]));require(_0xf280('0xf'))[_0xf280('0x10')](socket);function respondWithRpcPromise(_0x5360c3,_0x2447c6,_0x3d13c5){return new BPromise(function(_0x1f580a,_0x3e58af){return client[_0xf280('0x11')](_0x5360c3,_0x3d13c5)[_0xf280('0x12')](function(_0x10ccbe){logger[_0xf280('0x13')](_0xf280('0x14'),_0x2447c6,_0xf280('0x15'));logger[_0xf280('0x16')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x2447c6,_0xf280('0x15'),JSON[_0xf280('0x17')](_0x10ccbe));if(_0x10ccbe[_0xf280('0x18')]){if(_0x10ccbe[_0xf280('0x18')][_0xf280('0x19')]===0x1f4){logger[_0xf280('0x18')]('MailInteraction,\x20%s,\x20%s',_0x2447c6,_0x10ccbe[_0xf280('0x18')][_0xf280('0x1a')]);return _0x3e58af(_0x10ccbe[_0xf280('0x18')][_0xf280('0x1a')]);}logger[_0xf280('0x18')](_0xf280('0x14'),_0x2447c6,_0x10ccbe[_0xf280('0x18')]['message']);return _0x1f580a(_0x10ccbe['error']['message']);}else{logger[_0xf280('0x13')]('MailInteraction,\x20%s,\x20%s',_0x2447c6,_0xf280('0x15'));_0x1f580a(_0x10ccbe['result'][_0xf280('0x1a')]);}})[_0xf280('0x1b')](function(_0x5328ae){logger[_0xf280('0x18')]('MailInteraction,\x20%s,\x20%s',_0x2447c6,_0x5328ae);_0x3e58af(_0x5328ae);});});}exports[_0xf280('0x1c')]=function(_0x26c705){var _0x114364=this;return new Promise(function(_0x21e99b,_0x11db7d){return db[_0xf280('0x1d')][_0xf280('0x1e')](_0x26c705[_0xf280('0x1f')],{'raw':_0x26c705[_0xf280('0x20')]?_0x26c705['options'][_0xf280('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26c705[_0xf280('0x20')]?_0x26c705[_0xf280('0x20')][_0xf280('0x22')]||null:null,'attributes':_0x26c705[_0xf280('0x20')]?_0x26c705[_0xf280('0x20')][_0xf280('0x23')]||null:null,'limit':_0x26c705[_0xf280('0x20')]?_0x26c705['options'][_0xf280('0x24')]||null:null})[_0xf280('0x12')](function(_0x7fbee){logger[_0xf280('0x13')](_0xf280('0x1c'),_0x26c705);logger[_0xf280('0x16')](_0xf280('0x1c'),_0x26c705,JSON[_0xf280('0x17')](_0x7fbee));_0x21e99b(_0x7fbee);})['catch'](function(_0x368b24){logger[_0xf280('0x18')](_0xf280('0x1c'),_0x368b24[_0xf280('0x1a')],_0x26c705);_0x11db7d(_0x114364['error'](0x1f4,_0x368b24['message']));});});};exports['AddTagsToMailInteraction']=function(_0x4e2e5a){return new Promise(function(_0x5a82f6,_0x3da40e){return db[_0xf280('0x1d')][_0xf280('0x25')]({'where':_0x4e2e5a[_0xf280('0x20')]?_0x4e2e5a['options'][_0xf280('0x22')]||null:null})['then'](function(_0x990284){if(_0x990284){return _0x990284[_0xf280('0x26')](_0x4e2e5a['body'][_0xf280('0x27')],_[_0xf280('0x28')](_0x4e2e5a[_0xf280('0x1f')],[_0xf280('0x27'),'id'])||{});}})['spread'](function(_0x2cd704){logger[_0xf280('0x13')](_0xf280('0x29'),_0x4e2e5a);logger[_0xf280('0x16')](_0xf280('0x29'),_0x4e2e5a,JSON[_0xf280('0x17')](_0x2cd704));_0x5a82f6(_0x2cd704);})[_0xf280('0x1b')](function(_0x151e25){logger['error'](_0xf280('0x29'),_0x151e25[_0xf280('0x1a')],_0x4e2e5a);_0x3da40e(_this[_0xf280('0x18')](0x1f4,_0x151e25[_0xf280('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 7bb6031..b7ea2da 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 _0xd171=['length','./mailInteraction.events','save','remove','removeListener'];(function(_0x5a9f24,_0x2d1583){var _0x5a79d6=function(_0x3df3cc){while(--_0x3df3cc){_0x5a9f24['push'](_0x5a9f24['shift']());}};_0x5a79d6(++_0x2d1583);}(_0xd171,0x114));var _0x1d17=function(_0x5a12ff,_0x2e18db){_0x5a12ff=_0x5a12ff-0x0;var _0x285f8d=_0xd171[_0x5a12ff];return _0x285f8d;};'use strict';var MailInteractionEvents=require(_0x1d17('0x0'));var events=[_0x1d17('0x1'),_0x1d17('0x2'),'update'];function createListener(_0xc8e739,_0x3fce36){return function(_0x158027){_0x3fce36['emit'](_0xc8e739,_0x158027);};}function removeListener(_0x2b03d5,_0x364af0){return function(){MailInteractionEvents[_0x1d17('0x3')](_0x2b03d5,_0x364af0);};}exports['register']=function(_0xce96e6){for(var _0xc09492=0x0,_0x16626c=events[_0x1d17('0x4')];_0xc09492<_0x16626c;_0xc09492++){var _0xd1c284=events[_0xc09492];var _0x190983=createListener('mailInteraction:'+_0xd1c284,_0xce96e6);MailInteractionEvents['on'](_0xd1c284,_0x190983);}}; \ No newline at end of file +var _0xc4e4=['removeListener','register','length','mailInteraction:','save','emit'];(function(_0xd36719,_0x228dcf){var _0x15e767=function(_0x23e581){while(--_0x23e581){_0xd36719['push'](_0xd36719['shift']());}};_0x15e767(++_0x228dcf);}(_0xc4e4,0x1e4));var _0x4c4e=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xc4e4[_0x3b0731];return _0x4204d7;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x4c4e('0x0'),'remove','update'];function createListener(_0x2fbc62,_0x32cb07){return function(_0x5e45e2){_0x32cb07[_0x4c4e('0x1')](_0x2fbc62,_0x5e45e2);};}function removeListener(_0x279b2e,_0x595938){return function(){MailInteractionEvents[_0x4c4e('0x2')](_0x279b2e,_0x595938);};}exports[_0x4c4e('0x3')]=function(_0x2cd38c){for(var _0x2f0f10=0x0,_0x4d9c33=events[_0x4c4e('0x4')];_0x2f0f10<_0x4d9c33;_0x2f0f10++){var _0xbeef2b=events[_0x2f0f10];var _0x214283=createListener(_0x4c4e('0x5')+_0xbeef2b,_0x2cd38c);MailInteractionEvents['on'](_0xbeef2b,_0x214283);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index c4fed59..e316b6a 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 _0x00bb=['/:id','/:id/download','download','post','mail','update','put','/:id/accept','/:id/reject','reject','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','/describe','isAuthenticated','describe'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x00bb[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var auth=require(_0xb00b('0x4'));var interaction=require(_0xb00b('0x5'));var config=require('../../config/environment');var controller=require(_0xb00b('0x6'));router[_0xb00b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb00b('0x8'),auth[_0xb00b('0x9')](),controller[_0xb00b('0xa')]);router[_0xb00b('0x7')](_0xb00b('0xb'),auth[_0xb00b('0x9')](),controller['show']);router['get'](_0xb00b('0xc'),auth[_0xb00b('0x9')](),controller[_0xb00b('0xd')]);router[_0xb00b('0xe')]('/',auth[_0xb00b('0x9')](),interaction['tracked'](_0xb00b('0xf'),'mailmessage:create'),controller['create']);router['put'](_0xb00b('0xb'),auth[_0xb00b('0x9')](),controller[_0xb00b('0x10')]);router[_0xb00b('0x11')](_0xb00b('0x12'),auth[_0xb00b('0x9')](),controller['accept']);router[_0xb00b('0x11')](_0xb00b('0x13'),auth['isAuthenticated'](),controller[_0xb00b('0x14')]);router[_0xb00b('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xb00b('0x16')]);module['exports']=router; \ No newline at end of file +var _0x55ca=['get','isAuthenticated','index','/describe','describe','show','download','post','tracked','mail','mailmessage:create','create','put','/:id','/:id/reject','reject','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./mailMessage.controller'];(function(_0x46afee,_0x182791){var _0x421a81=function(_0x3c825d){while(--_0x3c825d){_0x46afee['push'](_0x46afee['shift']());}};_0x421a81(++_0x182791);}(_0x55ca,0x126));var _0xa55c=function(_0x1bad8a,_0x4a160f){_0x1bad8a=_0x1bad8a-0x0;var _0xfa3b6b=_0x55ca[_0x1bad8a];return _0xfa3b6b;};'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 auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['get']('/:id/download',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')]('/',auth[_0xa55c('0x7')](),interaction[_0xa55c('0xe')](_0xa55c('0xf'),_0xa55c('0x10')),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth['isAuthenticated'](),controller['update']);router[_0xa55c('0x12')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0xa55c('0x12')](_0xa55c('0x14'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x15')]);router[_0xa55c('0x16')](_0xa55c('0x13'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);module[_0xa55c('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 3512d22..f2a1ede 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 _0xd2f5=['INTEGER','BOOLEAN','sequelize','lodash','exports','TEXT','ENUM','out','STRING','long'];(function(_0x17950e,_0x201b3f){var _0x1c611f=function(_0x5ad800){while(--_0x5ad800){_0x17950e['push'](_0x17950e['shift']());}};_0x1c611f(++_0x201b3f);}(_0xd2f5,0x12e));var _0x5d2f=function(_0x216b12,_0x2e2980){_0x216b12=_0x216b12-0x0;var _0x33fe24=_0xd2f5[_0x216b12];return _0x33fe24;};'use strict';var Sequelize=require(_0x5d2f('0x0'));var _=require(_0x5d2f('0x1'));module[_0x5d2f('0x2')]={'body':{'type':Sequelize[_0x5d2f('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5d2f('0x3')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5d2f('0x4')]('in',_0x5d2f('0x5')),'defaultValue':_0x5d2f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x5d2f('0x6')]},'to':{'type':Sequelize[_0x5d2f('0x3')](_0x5d2f('0x7'))},'cc':{'type':Sequelize['TEXT'](_0x5d2f('0x7'))},'bcc':{'type':Sequelize[_0x5d2f('0x3')](_0x5d2f('0x7'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x5d2f('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5d2f('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x5d2f('0x3')](_0x5d2f('0x7'))},'originCc':{'type':Sequelize['TEXT']('long')}}; \ No newline at end of file +var _0x8374=['sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8374,0x174));var _0x4837=function(_0x12c1bf,_0x31fbf4){_0x12c1bf=_0x12c1bf-0x0;var _0xf82def=_0x8374[_0x12c1bf];return _0xf82def;};'use strict';var Sequelize=require(_0x4837('0x0'));var _=require(_0x4837('0x1'));module[_0x4837('0x2')]={'body':{'type':Sequelize[_0x4837('0x3')](_0x4837('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4837('0x3')](_0x4837('0x5'))},'read':{'type':Sequelize[_0x4837('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4837('0x7')]('in',_0x4837('0x8')),'defaultValue':_0x4837('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4837('0x9')](0x1fe)},'from':{'type':Sequelize[_0x4837('0x9')]},'to':{'type':Sequelize[_0x4837('0x3')]('long')},'cc':{'type':Sequelize[_0x4837('0x3')]('long')},'bcc':{'type':Sequelize[_0x4837('0x3')](_0x4837('0x4'))},'subject':{'type':Sequelize[_0x4837('0x3')]},'sentAt':{'type':Sequelize[_0x4837('0xa')]},'attach':{'type':Sequelize[_0x4837('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4837('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x4837('0xa')]},'originTo':{'type':Sequelize[_0x4837('0x3')](_0x4837('0x4'))},'originCc':{'type':Sequelize[_0x4837('0x3')]('long')}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 89a4b7a..fa973d5 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 _0x6bac=['writeFileSync','log','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','client','http','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','set','apply','save','update','then','destroy','stack','name','send','MailMessage','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','rows','catch','include','find','body','params','describe','create','direction','secret','MailAccount','findOne','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','auth','user','pass','attachments','join','server/files/attachments','basename','List','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','readAt','UserId','Contact','MailInteraction','MailInteractionId','interaction','get','role','null','AcceptMessage','acceptMessage','manual','interface','channel','EventManager','reject','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','event','rejectmessage','download','unix','server','tmp','root','files','message-%s.eml','from','bcc','subject','Attachments','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','type','readFileSync','build'];(function(_0xd99874,_0x331c26){var _0x36e63b=function(_0xbe6468){while(--_0xbe6468){_0xd99874['push'](_0xd99874['shift']());}};_0x36e63b(++_0x331c26);}(_0x6bac,0xa5));var _0xc6ba=function(_0x40203,_0x3bc69e){_0x40203=_0x40203-0x0;var _0x3c214e=_0x6bac[_0x40203];return _0x3c214e;};'use strict';var pdf=require(_0xc6ba('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc6ba('0x1'));var zipdir=require(_0xc6ba('0x2'));var jsonpatch=require(_0xc6ba('0x3'));var rp=require(_0xc6ba('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc6ba('0x5'));var path=require(_0xc6ba('0x6'));var sox=require('sox');var csv=require(_0xc6ba('0x7'));var ejs=require(_0xc6ba('0x8'));var fs=require('fs');var _=require(_0xc6ba('0x9'));var squel=require(_0xc6ba('0xa'));var crypto=require(_0xc6ba('0xb'));var jsforce=require(_0xc6ba('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc6ba('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6ba('0xe'));var logger=require(_0xc6ba('0xf'))(_0xc6ba('0x10'));var utils=require(_0xc6ba('0x11'));var config=require(_0xc6ba('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc6ba('0x13')](config[_0xc6ba('0x14')],{'host':_0xc6ba('0x15'),'port':0x18eb});var socket=require(_0xc6ba('0x16'))(new Redis(config[_0xc6ba('0x14')]));require('./mailMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xc6ba('0x17')][_0xc6ba('0x18')]({'port':0x232c});var client9003=jayson[_0xc6ba('0x17')][_0xc6ba('0x18')]({'port':0x232b});var client9002=jayson[_0xc6ba('0x17')][_0xc6ba('0x18')]({'port':0x232a});function checkPasswordPattern(_0x1be8ef,_0x1856ce,_0x5c1a16){if(_0x5c1a16){var _0x52c811=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x52c811['test'](_0x1856ce)){return _0x1be8ef;}else{throw new db['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~!@#$%^&-_=+[{]}.');}}else{return _0x1be8ef;}}function respondWithRpcPromise(_0x171eca,_0x15a135,_0x58f4c3,_0x485086){return new BPromise(function(_0x38162d,_0x5d1f4e){var _0x125655=_0x485086||client;return _0x125655[_0xc6ba('0x19')](_0x171eca,_0x58f4c3)['then'](function(_0x3936e2){logger[_0xc6ba('0x1a')]('MailMessage,\x20%s,\x20%s',_0x15a135,_0xc6ba('0x1b'));logger[_0xc6ba('0x1c')](_0xc6ba('0x1d'),_0x15a135,_0xc6ba('0x1b'),JSON[_0xc6ba('0x1e')](_0x3936e2));if(_0x3936e2[_0xc6ba('0x1f')]){if(_0x3936e2[_0xc6ba('0x1f')][_0xc6ba('0x20')]===0x1f4){logger[_0xc6ba('0x1f')](_0xc6ba('0x21'),_0x15a135,_0x3936e2[_0xc6ba('0x1f')][_0xc6ba('0x22')]);return _0x5d1f4e(_0x3936e2[_0xc6ba('0x1f')][_0xc6ba('0x22')]);}logger[_0xc6ba('0x1f')]('MailMessage,\x20%s,\x20%s',_0x15a135,_0x3936e2[_0xc6ba('0x1f')][_0xc6ba('0x22')]);return _0x38162d(_0x3936e2[_0xc6ba('0x1f')][_0xc6ba('0x22')]);}else{logger[_0xc6ba('0x1a')](_0xc6ba('0x21'),_0x15a135,'request\x20sent');_0x38162d(_0x3936e2[_0xc6ba('0x23')][_0xc6ba('0x22')]);}})['catch'](function(_0x1f2d1a){logger[_0xc6ba('0x1f')]('MailMessage,\x20%s,\x20%s',_0x15a135,_0x1f2d1a);_0x5d1f4e(_0x1f2d1a);});});}function respondWithStatusCode(_0x2f60e9,_0x5037bd){_0x5037bd=_0x5037bd||0xcc;return function(_0x3fea76){if(_0x3fea76){return _0x2f60e9[_0xc6ba('0x24')](_0x5037bd);}return _0x2f60e9[_0xc6ba('0x25')](_0x5037bd)[_0xc6ba('0x26')]();};}function respondWithResult(_0x5ac5dd,_0x4fe380){_0x4fe380=_0x4fe380||0xc8;return function(_0x258441){if(_0x258441){return _0x5ac5dd['status'](_0x4fe380)[_0xc6ba('0x27')](_0x258441);}};}function respondWithFilteredResult(_0x5d5ebe,_0x3ffa66){return function(_0x1181ca){if(_0x1181ca){var _0x4cf6fb=_0x1181ca[_0xc6ba('0x28')],_0xa079a=_0x3ffa66[_0xc6ba('0x29')],_0x325c59=_0x3ffa66[_0xc6ba('0x29')]+_0x3ffa66['limit'],_0x1b5819;if(_0x325c59>=_0x4cf6fb){_0x325c59=_0x4cf6fb;_0x1b5819=0xc8;}else{_0x1b5819=0xce;}_0x5d5ebe[_0xc6ba('0x25')](_0x1b5819);return _0x5d5ebe[_0xc6ba('0x2a')]('Content-Range',_0xa079a+'-'+_0x325c59+'/'+_0x4cf6fb)[_0xc6ba('0x27')](_0x1181ca);}return null;};}function patchUpdates(_0x1e0ae7){return function(_0x59acfb){try{jsonpatch[_0xc6ba('0x2b')](_0x59acfb,_0x1e0ae7,!![]);}catch(_0x136c3c){return BPromise['reject'](_0x136c3c);}return _0x59acfb[_0xc6ba('0x2c')]();};}function saveUpdates(_0x1f19ac,_0x438ba0){return function(_0x2ed6f6){if(_0x2ed6f6){return _0x2ed6f6[_0xc6ba('0x2d')](_0x1f19ac)[_0xc6ba('0x2e')](function(_0x582a4e){return _0x582a4e;});}return null;};}function removeEntity(_0x3b6c15,_0x1518cc){return function(_0x355eca){if(_0x355eca){return _0x355eca[_0xc6ba('0x2f')]()[_0xc6ba('0x2e')](function(){_0x3b6c15[_0xc6ba('0x25')](0xcc)[_0xc6ba('0x26')]();});}};}function handleEntityNotFound(_0x3ee1c3,_0x2e2a63){return function(_0x62ace){if(!_0x62ace){_0x3ee1c3[_0xc6ba('0x24')](0x194);}return _0x62ace;};}function handleError(_0x14c131,_0x7d8990){_0x7d8990=_0x7d8990||0x1f4;return function(_0x2d3a51){logger['error'](_0x2d3a51[_0xc6ba('0x30')]);if(_0x2d3a51[_0xc6ba('0x31')]){delete _0x2d3a51[_0xc6ba('0x31')];}_0x14c131['status'](_0x7d8990)[_0xc6ba('0x32')](_0x2d3a51);};}exports['index']=function(_0x1abd24,_0x52ce31){var _0x16bc58={},_0x57d2fb={},_0x7e786f={'count':0x0,'rows':[]};var _0x4b1d2f=_['map'](db[_0xc6ba('0x33')][_0xc6ba('0x34')],function(_0x253ebd){return{'name':_0x253ebd[_0xc6ba('0x35')],'type':_0x253ebd['type'][_0xc6ba('0x36')]};});_0x57d2fb[_0xc6ba('0x37')]=_[_0xc6ba('0x38')](_0x4b1d2f,_0xc6ba('0x31'));_0x57d2fb[_0xc6ba('0x39')]=_[_0xc6ba('0x3a')](_0x1abd24[_0xc6ba('0x39')]);_0x57d2fb['filters']=_[_0xc6ba('0x3b')](_0x57d2fb[_0xc6ba('0x37')],_0x57d2fb[_0xc6ba('0x39')]);_0x16bc58[_0xc6ba('0x3c')]=_[_0xc6ba('0x3b')](_0x57d2fb['model'],qs['fields'](_0x1abd24[_0xc6ba('0x39')][_0xc6ba('0x3d')]));_0x16bc58['attributes']=_0x16bc58[_0xc6ba('0x3c')][_0xc6ba('0x3e')]?_0x16bc58[_0xc6ba('0x3c')]:_0x57d2fb[_0xc6ba('0x37')];if(!_0x1abd24[_0xc6ba('0x39')][_0xc6ba('0x3f')]('nolimit')){_0x16bc58['limit']=qs[_0xc6ba('0x40')](_0x1abd24[_0xc6ba('0x39')][_0xc6ba('0x40')]);_0x16bc58['offset']=qs['offset'](_0x1abd24[_0xc6ba('0x39')][_0xc6ba('0x29')]);}_0x16bc58[_0xc6ba('0x41')]=qs[_0xc6ba('0x42')](_0x1abd24[_0xc6ba('0x39')]['sort']);_0x16bc58[_0xc6ba('0x43')]=qs[_0xc6ba('0x44')](_[_0xc6ba('0x45')](_0x1abd24[_0xc6ba('0x39')],_0x57d2fb[_0xc6ba('0x44')]),_0x4b1d2f);if(_0x1abd24[_0xc6ba('0x39')][_0xc6ba('0x46')]){_0x16bc58[_0xc6ba('0x43')]=_['merge'](_0x16bc58[_0xc6ba('0x43')],{'$or':_[_0xc6ba('0x38')](_0x4b1d2f,function(_0x842647){if(_0x842647['type']!==_0xc6ba('0x47')){var _0x25f7ab={};_0x25f7ab[_0x842647[_0xc6ba('0x31')]]={'$like':'%'+_0x1abd24['query']['filter']+'%'};return _0x25f7ab;}})});}_0x16bc58=_[_0xc6ba('0x48')]({},_0x16bc58,_0x1abd24[_0xc6ba('0x49')]);var _0x56add1={'where':_0x16bc58[_0xc6ba('0x43')]};return db[_0xc6ba('0x33')][_0xc6ba('0x28')](_0x56add1)[_0xc6ba('0x2e')](function(_0x43d16d){_0x7e786f[_0xc6ba('0x28')]=_0x43d16d;if(_0x1abd24[_0xc6ba('0x39')][_0xc6ba('0x4a')]){_0x16bc58['include']=[{'all':!![]}];}return db[_0xc6ba('0x33')]['findAll'](_0x16bc58);})[_0xc6ba('0x2e')](function(_0x40f5e1){_0x7e786f[_0xc6ba('0x4b')]=_0x40f5e1;return _0x7e786f;})[_0xc6ba('0x2e')](respondWithFilteredResult(_0x52ce31,_0x16bc58))[_0xc6ba('0x4c')](handleError(_0x52ce31,null));};exports['show']=function(_0x5252f7,_0x5f151c){var _0x47a4ee={'raw':!![],'where':{'id':_0x5252f7['params']['id']}},_0x2c71f7={};_0x2c71f7[_0xc6ba('0x37')]=_[_0xc6ba('0x3a')](db[_0xc6ba('0x33')][_0xc6ba('0x34')]);_0x2c71f7['query']=_['keys'](_0x5252f7[_0xc6ba('0x39')]);_0x2c71f7[_0xc6ba('0x44')]=_['intersection'](_0x2c71f7[_0xc6ba('0x37')],_0x2c71f7[_0xc6ba('0x39')]);_0x47a4ee[_0xc6ba('0x3c')]=_['intersection'](_0x2c71f7[_0xc6ba('0x37')],qs['fields'](_0x5252f7[_0xc6ba('0x39')][_0xc6ba('0x3d')]));_0x47a4ee[_0xc6ba('0x3c')]=_0x47a4ee[_0xc6ba('0x3c')]['length']?_0x47a4ee[_0xc6ba('0x3c')]:_0x2c71f7['model'];if(_0x5252f7[_0xc6ba('0x39')]['includeAll']){_0x47a4ee[_0xc6ba('0x4d')]=[{'all':!![]}];}_0x47a4ee=_[_0xc6ba('0x48')]({},_0x47a4ee,_0x5252f7['options']);return db[_0xc6ba('0x33')][_0xc6ba('0x4e')](_0x47a4ee)[_0xc6ba('0x2e')](handleEntityNotFound(_0x5f151c,null))[_0xc6ba('0x2e')](respondWithResult(_0x5f151c,null))[_0xc6ba('0x4c')](handleError(_0x5f151c,null));};exports[_0xc6ba('0x2d')]=function(_0x3303a8,_0x25284d){if(_0x3303a8['body']['id']){delete _0x3303a8[_0xc6ba('0x4f')]['id'];}return db[_0xc6ba('0x33')][_0xc6ba('0x4e')]({'where':{'id':_0x3303a8[_0xc6ba('0x50')]['id']}})[_0xc6ba('0x2e')](handleEntityNotFound(_0x25284d,null))['then'](saveUpdates(_0x3303a8[_0xc6ba('0x4f')],null))[_0xc6ba('0x2e')](respondWithResult(_0x25284d,null))[_0xc6ba('0x4c')](handleError(_0x25284d,null));};exports[_0xc6ba('0x2f')]=function(_0x17d9f1,_0x2020c3){return db[_0xc6ba('0x33')][_0xc6ba('0x4e')]({'where':{'id':_0x17d9f1[_0xc6ba('0x50')]['id']}})[_0xc6ba('0x2e')](handleEntityNotFound(_0x2020c3,null))['then'](removeEntity(_0x2020c3,null))['catch'](handleError(_0x2020c3,null));};exports[_0xc6ba('0x51')]=function(_0x5c7f26,_0x10a749){return db[_0xc6ba('0x33')][_0xc6ba('0x51')]()[_0xc6ba('0x2e')](respondWithResult(_0x10a749,null))[_0xc6ba('0x4c')](handleError(_0x10a749,null));};exports[_0xc6ba('0x52')]=function(_0x499ab2,_0x2a5ce6){return db[_0xc6ba('0x33')][_0xc6ba('0x52')](_0x499ab2[_0xc6ba('0x4f')])[_0xc6ba('0x2e')](function(_0x17a144){if(_0x17a144){if(_0x17a144[_0xc6ba('0x53')]==='out'&&!_0x17a144[_0xc6ba('0x54')]){var _0x2ca5c0,_0xff669a,_0x50239b;if(_0x499ab2[_0xc6ba('0x4f')]['to']){_0xff669a=_0x499ab2[_0xc6ba('0x4f')]['to']['split'](',')[0x0];}return db[_0xc6ba('0x55')][_0xc6ba('0x56')]({'where':{'id':_0x17a144['MailAccountId']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xc6ba('0x57')],'as':_0xc6ba('0x58'),'where':{'email':_0xff669a},'limit':0x1,'order':[[_0xc6ba('0x59'),_0xc6ba('0x5a')]]}]},{'model':db[_0xc6ba('0x5b')],'as':'Smtp','raw':!![]}]})['then'](function(_0x478af3){_0x2ca5c0=_0x478af3;if(_0x2ca5c0&&_0x2ca5c0[_0xc6ba('0x5c')]){var _0x15750d={'tls':{'rejectUnauthorized':![]}};if(_[_0xc6ba('0x5d')](_0x2ca5c0[_0xc6ba('0x5c')][_0xc6ba('0x5e')])){_0x15750d[_0xc6ba('0x5f')]=_0x2ca5c0['Smtp'][_0xc6ba('0x5f')];_0x15750d[_0xc6ba('0x60')]=_0x2ca5c0[_0xc6ba('0x5c')][_0xc6ba('0x60')];_0x15750d['secure']=_0x2ca5c0[_0xc6ba('0x5c')][_0xc6ba('0x61')];if(_0x2ca5c0[_0xc6ba('0x5c')]['authentication']){_0x15750d[_0xc6ba('0x62')]={'user':_0x2ca5c0[_0xc6ba('0x5c')][_0xc6ba('0x63')],'pass':_0x2ca5c0['Smtp']['pass']};}}else{_0x15750d[_0xc6ba('0x5e')]=_0x2ca5c0[_0xc6ba('0x5c')][_0xc6ba('0x5e')];_0x15750d[_0xc6ba('0x62')]={'user':_0x2ca5c0['Smtp'][_0xc6ba('0x63')],'pass':_0x2ca5c0[_0xc6ba('0x5c')][_0xc6ba('0x64')]};_0x15750d[_0xc6ba('0x61')]=_0x2ca5c0['Smtp'][_0xc6ba('0x61')];}if(_0x499ab2[_0xc6ba('0x4f')]['attachments']&&_0x499ab2[_0xc6ba('0x4f')]['attachments'][_0xc6ba('0x3e')]){for(var _0x109005=0x0;_0x109005<_0x499ab2[_0xc6ba('0x4f')]['attachments'][_0xc6ba('0x3e')];_0x109005+=0x1){_0x499ab2[_0xc6ba('0x4f')][_0xc6ba('0x65')][_0x109005]={'filename':_0x499ab2['body'][_0xc6ba('0x65')][_0x109005][_0xc6ba('0x31')],'path':path[_0xc6ba('0x66')](config['root'],_0xc6ba('0x67'),_0x499ab2['body'][_0xc6ba('0x65')][_0x109005][_0xc6ba('0x68')])};}}_0x50239b={'account':_0x15750d,'message':_0x499ab2[_0xc6ba('0x4f')]};return;}})[_0xc6ba('0x2e')](function(){if(_0x2ca5c0[_0xc6ba('0x69')]){if(_0x2ca5c0[_0xc6ba('0x69')][_0xc6ba('0x58')][_0xc6ba('0x3e')]){return _0x2ca5c0[_0xc6ba('0x69')][_0xc6ba('0x58')][0x0];}else{return db['CmContact'][_0xc6ba('0x52')](_[_0xc6ba('0x13')](_0x499ab2[_0xc6ba('0x4f')],{'firstName':_0x499ab2[_0xc6ba('0x4f')]['to'],'email':_0x499ab2['body']['to'],'phone':_0x499ab2['body']['to'],'ListId':_0x2ca5c0['ListId']}));}}else{throw new Error(_0xc6ba('0x6a'));}})[_0xc6ba('0x2e')](function(){if(_0x50239b){return respondWithRpcPromise(_0xc6ba('0x6b'),_0xc6ba('0x6c'),_0x50239b,client9003)['then'](function(_0x1381de){return _0x17a144['update']({'read':!![],'messageId':_0x1381de['messageId'],'sentAt':moment()[_0xc6ba('0x6d')](_0xc6ba('0x6e'))});})[_0xc6ba('0x4c')](function(_0x4ee31e){logger['error']('%s',JSON[_0xc6ba('0x1e')](_0x4ee31e));return _0x17a144;});}return _0x17a144;});}return _0x17a144;}})['then'](respondWithResult(_0x2a5ce6,0xc9))[_0xc6ba('0x4c')](handleError(_0x2a5ce6,null));};var interaction_log=require(_0xc6ba('0xf'))(_0xc6ba('0x6f'));exports[_0xc6ba('0x70')]=function(_0x36849b,_0x247c11,_0x436745){var _0x1b1cf4={'channel':_0xc6ba('0x71')};if(_0x36849b['body']['id']){delete _0x36849b[_0xc6ba('0x4f')]['id'];}_0x36849b[_0xc6ba('0x4f')][_0xc6ba('0x72')]=!![];_0x36849b[_0xc6ba('0x4f')][_0xc6ba('0x73')]=moment()[_0xc6ba('0x6d')](_0xc6ba('0x6e'));_0x36849b[_0xc6ba('0x4f')][_0xc6ba('0x74')]=_0x36849b[_0xc6ba('0x4f')][_0xc6ba('0x74')]||_0x36849b[_0xc6ba('0x63')]['id'];return db['MailMessage'][_0xc6ba('0x4e')]({'where':{'id':_0x36849b['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xc6ba('0x75')}]})[_0xc6ba('0x2e')](handleEntityNotFound(_0x247c11,null))[_0xc6ba('0x2e')](saveUpdates(_0x36849b[_0xc6ba('0x4f')],null))['then'](function(_0x1a0845){if(_0x1a0845){_0x1b1cf4[_0xc6ba('0x22')]=_0x1a0845['get']({'plain':!![]});return db[_0xc6ba('0x76')][_0xc6ba('0x4e')]({'where':{'id':_0x1a0845[_0xc6ba('0x77')]}});}return null;})['then'](handleEntityNotFound(_0x247c11,null))[_0xc6ba('0x2e')](function(_0x271d3d){if(_0x271d3d){return _0x271d3d['update']({'UserId':_0x36849b['body'][_0xc6ba('0x74')],'read1stAt':_[_0xc6ba('0x5d')](_0x271d3d['read1stAt'])?moment()[_0xc6ba('0x6d')](_0xc6ba('0x6e')):undefined});}return null;})[_0xc6ba('0x2e')](function(_0xf0c802){if(_0xf0c802){_0x1b1cf4[_0xc6ba('0x78')]=_0xf0c802[_0xc6ba('0x79')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x36849b[_0xc6ba('0x63')]['id'],_0x36849b[_0xc6ba('0x63')][_0xc6ba('0x31')],_0x36849b[_0xc6ba('0x63')][_0xc6ba('0x7a')],_0x1b1cf4[_0xc6ba('0x78')]['id'],_0x36849b[_0xc6ba('0x4f')]?JSON['stringify'](_0x36849b['body']):_0xc6ba('0x7b'));return respondWithRpcPromise(_0xc6ba('0x7c'),_0xc6ba('0x7d'),_0x1b1cf4);}return null;})[_0xc6ba('0x2e')](function(_0x45be79){if(_0x45be79){if(_0x36849b[_0xc6ba('0x4f')][_0xc6ba('0x7e')]){_0x1b1cf4['message'][_0xc6ba('0x7f')]=util[_0xc6ba('0x6d')]('SIP/%s',_0x36849b[_0xc6ba('0x63')][_0xc6ba('0x31')]);_0x1b1cf4[_0xc6ba('0x22')][_0xc6ba('0x80')]=_0x1b1cf4[_0xc6ba('0x80')];_0x1b1cf4['message']['event']=_0xc6ba('0x70');return respondWithRpcPromise(_0xc6ba('0x81'),_0xc6ba('0x81'),{'event':'acceptmessage','message':_0x1b1cf4[_0xc6ba('0x22')]},client9002)[_0xc6ba('0x2e')](function(){return _0x1b1cf4;});}return _0x1b1cf4;}return null;})[_0xc6ba('0x2e')](respondWithResult(_0x247c11,null))[_0xc6ba('0x4c')](handleError(_0x247c11,null));};var interaction_log=require(_0xc6ba('0xf'))(_0xc6ba('0x6f'));exports[_0xc6ba('0x82')]=function(_0x48353d,_0x27234b,_0x2662bd){var _0xafb2ef={'agent':{},'channel':_0xc6ba('0x71')};if(_0x48353d[_0xc6ba('0x4f')]['id']){delete _0x48353d['body']['id'];}_0x48353d[_0xc6ba('0x4f')][_0xc6ba('0x74')]=_0x48353d[_0xc6ba('0x4f')][_0xc6ba('0x74')]||_0x48353d[_0xc6ba('0x63')]['id'];_0xafb2ef[_0xc6ba('0x83')]['id']=_0x48353d[_0xc6ba('0x4f')][_0xc6ba('0x74')];return db[_0xc6ba('0x33')][_0xc6ba('0x4e')]({'where':{'id':_0x48353d[_0xc6ba('0x50')]['id'],'UserId':null}})[_0xc6ba('0x2e')](handleEntityNotFound(_0x27234b,null))[_0xc6ba('0x2e')](function(_0x5c51e6){if(_0x5c51e6){_0xafb2ef['message']=_0x5c51e6[_0xc6ba('0x79')]({'plain':!![]});return db[_0xc6ba('0x76')][_0xc6ba('0x4e')]({'where':{'id':_0x5c51e6[_0xc6ba('0x77')]}});}return null;})[_0xc6ba('0x2e')](handleEntityNotFound(_0x27234b,null))[_0xc6ba('0x2e')](function(_0xe7e165){if(_0xe7e165){_0xafb2ef[_0xc6ba('0x78')]=_0xe7e165[_0xc6ba('0x79')]({'plain':!![]});interaction_log[_0xc6ba('0x1a')](_0xc6ba('0x84'),_0x48353d[_0xc6ba('0x63')]['id'],_0x48353d[_0xc6ba('0x63')][_0xc6ba('0x31')],_0x48353d[_0xc6ba('0x63')][_0xc6ba('0x7a')],_0xafb2ef[_0xc6ba('0x78')]['id'],_0x48353d[_0xc6ba('0x4f')]?JSON['stringify'](_0x48353d[_0xc6ba('0x4f')]):_0xc6ba('0x7b'));return respondWithRpcPromise(_0xc6ba('0x85'),_0xc6ba('0x86'),_0xafb2ef);}return null;})[_0xc6ba('0x2e')](function(_0x9ea9aa){if(_0x9ea9aa){_0x9ea9aa[_0xc6ba('0x22')][_0xc6ba('0x7f')]=util['format'](_0xc6ba('0x87'),_0x48353d[_0xc6ba('0x63')]['name']);_0x9ea9aa[_0xc6ba('0x22')][_0xc6ba('0x80')]=_0xafb2ef[_0xc6ba('0x80')];_0x9ea9aa[_0xc6ba('0x22')][_0xc6ba('0x88')]=_0xc6ba('0x82');respondWithRpcPromise(_0xc6ba('0x81'),_0xc6ba('0x81'),{'event':_0xc6ba('0x89'),'message':_0x9ea9aa[_0xc6ba('0x22')]},client9002);return _0xafb2ef;}return null;})[_0xc6ba('0x2e')](respondWithResult(_0x27234b,null))['catch'](handleError(_0x27234b,null));};exports[_0xc6ba('0x8a')]=function(_0x3bcd31,_0x3222e0){var _0x2e17d4=moment()[_0xc6ba('0x8b')]()['toString']();var _0x11811a=path[_0xc6ba('0x66')](config['root'],_0xc6ba('0x8c'),'files',_0xc6ba('0x8d'));var _0x2e0116=path[_0xc6ba('0x66')](config[_0xc6ba('0x8e')],_0xc6ba('0x8c'),_0xc6ba('0x8f'),'attachments');var _0x1711ab=util[_0xc6ba('0x6d')](_0xc6ba('0x90'),_0x2e17d4);return db[_0xc6ba('0x33')]['find']({'where':{'id':_0x3bcd31[_0xc6ba('0x50')]['id']},'attributes':['id',_0xc6ba('0x4f'),_0xc6ba('0x91'),'to','cc',_0xc6ba('0x92'),_0xc6ba('0x93'),'createdAt'],'include':_0x3bcd31['query'][_0xc6ba('0x65')]?[{'model':db['Attachment'],'as':_0xc6ba('0x94')}]:undefined})[_0xc6ba('0x2e')](handleEntityNotFound(_0x3222e0,null))['then'](function(_0x179643){if(_0x179643){var _0x580978=_0x179643;var _0x18ddf9={'from':_0x580978[_0xc6ba('0x91')],'to':_0x580978['to'],'subject':_0x580978[_0xc6ba('0x93')],'html':_0x580978[_0xc6ba('0x4f')],'headers':{'Date':moment(_0x580978[_0xc6ba('0x95')])[_0xc6ba('0x6d')](_0xc6ba('0x96'))},'attachments':[]};if(_0x179643['cc']){_0x18ddf9[_0xc6ba('0x97')]['Cc']=_0x179643['cc'];}if(_0x179643[_0xc6ba('0x92')]){_0x18ddf9[_0xc6ba('0x97')][_0xc6ba('0x98')]=_0x179643[_0xc6ba('0x92')];}return new BPromise(function(_0x218f97,_0x5eab98){if(_0x179643[_0xc6ba('0x94')]){for(var _0x21f2d5=0x0;_0x21f2d5<_0x179643[_0xc6ba('0x94')][_0xc6ba('0x3e')];_0x21f2d5++){var _0xd3d069=_0x179643[_0xc6ba('0x94')][_0x21f2d5];var _0x4d62f1=path['join'](_0x2e0116,_0xd3d069['basename']);if(fs[_0xc6ba('0x99')](_0x4d62f1)){_0x18ddf9[_0xc6ba('0x65')]['push']({'name':_0xd3d069[_0xc6ba('0x31')],'contentType':_0xd3d069[_0xc6ba('0x9a')],'data':fs[_0xc6ba('0x9b')](_0x4d62f1)});}}}emlformat[_0xc6ba('0x9c')](_0x18ddf9,function(_0x183588,_0x5e5aca){if(_0x183588)return _0x5eab98(_0x183588);fs[_0xc6ba('0x9d')](path['join'](_0x11811a,_0x1711ab),_0x5e5aca);return _0x218f97(_0x5e5aca);});});}})[_0xc6ba('0x2e')](function(_0x18c136){if(_0x18c136){return _0x3222e0[_0xc6ba('0x8a')](path[_0xc6ba('0x66')](_0x11811a,_0x1711ab),_0x1711ab,function(_0x503f55){if(_0x503f55){console[_0xc6ba('0x9e')](_0xc6ba('0x9f'),_0x503f55);}else{fs[_0xc6ba('0xa0')](path[_0xc6ba('0x66')](_0x11811a,_0x1711ab));}});}})[_0xc6ba('0x4c')](handleError(_0x3222e0,null));}; \ No newline at end of file +var _0xa049=['update','destroy','stack','name','send','index','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','MailMessage','includeAll','include','rows','show','params','catch','body','find','describe','create','direction','out','secret','findOne','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','host','port','secure','authentication','user','pass','service','auth','attachments','join','root','basename','List','defaults','ListId','List\x20not\x20found','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','readAt','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','null','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','role','RejectMessage','reject','rejectmessage','unix','toString','server','files','message-%s.eml','bcc','subject','createdAt','Attachment','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','build','download','log','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','http','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save'];(function(_0x24bd94,_0x10c190){var _0x3d043b=function(_0x16adf8){while(--_0x16adf8){_0x24bd94['push'](_0x24bd94['shift']());}};_0x3d043b(++_0x10c190);}(_0xa049,0x1db));var _0x9a04=function(_0x3f889c,_0x1c16af){_0x3f889c=_0x3f889c-0x0;var _0x5edf2a=_0xa049[_0x3f889c];return _0x5edf2a;};'use strict';var pdf=require(_0x9a04('0x0'));var emlformat=require(_0x9a04('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9a04('0x2'));var jsonpatch=require(_0x9a04('0x3'));var rp=require(_0x9a04('0x4'));var moment=require(_0x9a04('0x5'));var BPromise=require(_0x9a04('0x6'));var Mustache=require(_0x9a04('0x7'));var util=require(_0x9a04('0x8'));var path=require(_0x9a04('0x9'));var sox=require(_0x9a04('0xa'));var csv=require('to-csv');var ejs=require(_0x9a04('0xb'));var fs=require('fs');var _=require(_0x9a04('0xc'));var squel=require('squel');var crypto=require(_0x9a04('0xd'));var jsforce=require(_0x9a04('0xe'));var deskjs=require(_0x9a04('0xf'));var toCsv=require(_0x9a04('0x10'));var querystring=require(_0x9a04('0x11'));var Papa=require(_0x9a04('0x12'));var Redis=require('ioredis');var authService=require(_0x9a04('0x13'));var qs=require(_0x9a04('0x14'));var as=require(_0x9a04('0x15'));var hardwareService=require(_0x9a04('0x16'));var logger=require(_0x9a04('0x17'))(_0x9a04('0x18'));var utils=require('../../config/utils');var config=require(_0x9a04('0x19'));var db=require(_0x9a04('0x1a'))['db'];config[_0x9a04('0x1b')]=_['defaults'](config[_0x9a04('0x1b')],{'host':_0x9a04('0x1c'),'port':0x18eb});var socket=require(_0x9a04('0x1d'))(new Redis(config[_0x9a04('0x1b')]));require(_0x9a04('0x1e'))['register'](socket);var jayson=require(_0x9a04('0x1f'));var client=jayson['client'][_0x9a04('0x20')]({'port':0x232c});var client9003=jayson[_0x9a04('0x21')]['http']({'port':0x232b});var client9002=jayson[_0x9a04('0x21')][_0x9a04('0x20')]({'port':0x232a});function checkPasswordPattern(_0x549aeb,_0x8637bb,_0x3dda79){if(_0x3dda79){var _0x17f482=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x17f482[_0x9a04('0x22')](_0x8637bb)){return _0x549aeb;}else{throw new db[(_0x9a04('0x23'))]['ValidationError'](_0x9a04('0x24'));}}else{return _0x549aeb;}}function respondWithRpcPromise(_0x27e434,_0x39512c,_0x29fd7d,_0x436c71){return new BPromise(function(_0x7d83d7,_0xb7c3d6){var _0x551347=_0x436c71||client;return _0x551347['request'](_0x27e434,_0x29fd7d)[_0x9a04('0x25')](function(_0xcf690){logger[_0x9a04('0x26')](_0x9a04('0x27'),_0x39512c,_0x9a04('0x28'));logger[_0x9a04('0x29')](_0x9a04('0x2a'),_0x39512c,_0x9a04('0x28'),JSON[_0x9a04('0x2b')](_0xcf690));if(_0xcf690[_0x9a04('0x2c')]){if(_0xcf690['error'][_0x9a04('0x2d')]===0x1f4){logger[_0x9a04('0x2c')]('MailMessage,\x20%s,\x20%s',_0x39512c,_0xcf690[_0x9a04('0x2c')][_0x9a04('0x2e')]);return _0xb7c3d6(_0xcf690[_0x9a04('0x2c')]['message']);}logger[_0x9a04('0x2c')]('MailMessage,\x20%s,\x20%s',_0x39512c,_0xcf690[_0x9a04('0x2c')][_0x9a04('0x2e')]);return _0x7d83d7(_0xcf690['error'][_0x9a04('0x2e')]);}else{logger[_0x9a04('0x26')](_0x9a04('0x27'),_0x39512c,_0x9a04('0x28'));_0x7d83d7(_0xcf690[_0x9a04('0x2f')][_0x9a04('0x2e')]);}})['catch'](function(_0x5879ee){logger[_0x9a04('0x2c')](_0x9a04('0x27'),_0x39512c,_0x5879ee);_0xb7c3d6(_0x5879ee);});});}function respondWithStatusCode(_0xb3bb0a,_0x9a977c){_0x9a977c=_0x9a977c||0xcc;return function(_0x2e9243){if(_0x2e9243){return _0xb3bb0a[_0x9a04('0x30')](_0x9a977c);}return _0xb3bb0a[_0x9a04('0x31')](_0x9a977c)[_0x9a04('0x32')]();};}function respondWithResult(_0xa0354f,_0x505432){_0x505432=_0x505432||0xc8;return function(_0xce8658){if(_0xce8658){return _0xa0354f[_0x9a04('0x31')](_0x505432)[_0x9a04('0x33')](_0xce8658);}};}function respondWithFilteredResult(_0x40872a,_0x236055){return function(_0x33fb43){if(_0x33fb43){var _0x237a50=_0x33fb43[_0x9a04('0x34')],_0x137fb3=_0x236055[_0x9a04('0x35')],_0x3f6b2d=_0x236055[_0x9a04('0x35')]+_0x236055[_0x9a04('0x36')],_0x161482;if(_0x3f6b2d>=_0x237a50){_0x3f6b2d=_0x237a50;_0x161482=0xc8;}else{_0x161482=0xce;}_0x40872a[_0x9a04('0x31')](_0x161482);return _0x40872a[_0x9a04('0x37')](_0x9a04('0x38'),_0x137fb3+'-'+_0x3f6b2d+'/'+_0x237a50)[_0x9a04('0x33')](_0x33fb43);}return null;};}function patchUpdates(_0x3759a3){return function(_0x91d47b){try{jsonpatch[_0x9a04('0x39')](_0x91d47b,_0x3759a3,!![]);}catch(_0x2a0c0b){return BPromise['reject'](_0x2a0c0b);}return _0x91d47b[_0x9a04('0x3a')]();};}function saveUpdates(_0x20263a,_0xb93d26){return function(_0x116582){if(_0x116582){return _0x116582[_0x9a04('0x3b')](_0x20263a)['then'](function(_0x4e63e6){return _0x4e63e6;});}return null;};}function removeEntity(_0x5d0170,_0x431d75){return function(_0x213369){if(_0x213369){return _0x213369[_0x9a04('0x3c')]()[_0x9a04('0x25')](function(){_0x5d0170[_0x9a04('0x31')](0xcc)[_0x9a04('0x32')]();});}};}function handleEntityNotFound(_0x31f417,_0xf4ecca){return function(_0x2f30e3){if(!_0x2f30e3){_0x31f417[_0x9a04('0x30')](0x194);}return _0x2f30e3;};}function handleError(_0x3fbe9e,_0x111d59){_0x111d59=_0x111d59||0x1f4;return function(_0x5c325e){logger['error'](_0x5c325e[_0x9a04('0x3d')]);if(_0x5c325e[_0x9a04('0x3e')]){delete _0x5c325e[_0x9a04('0x3e')];}_0x3fbe9e[_0x9a04('0x31')](_0x111d59)[_0x9a04('0x3f')](_0x5c325e);};}exports[_0x9a04('0x40')]=function(_0x4c9767,_0xa6777f){var _0x55f0ab={},_0xe09087={},_0xb9addf={'count':0x0,'rows':[]};var _0x515969=_['map'](db['MailMessage'][_0x9a04('0x41')],function(_0x1b1e21){return{'name':_0x1b1e21[_0x9a04('0x42')],'type':_0x1b1e21['type'][_0x9a04('0x43')]};});_0xe09087['model']=_['map'](_0x515969,_0x9a04('0x3e'));_0xe09087[_0x9a04('0x44')]=_[_0x9a04('0x45')](_0x4c9767['query']);_0xe09087[_0x9a04('0x46')]=_[_0x9a04('0x47')](_0xe09087[_0x9a04('0x48')],_0xe09087[_0x9a04('0x44')]);_0x55f0ab[_0x9a04('0x49')]=_[_0x9a04('0x47')](_0xe09087[_0x9a04('0x48')],qs[_0x9a04('0x4a')](_0x4c9767[_0x9a04('0x44')]['fields']));_0x55f0ab['attributes']=_0x55f0ab[_0x9a04('0x49')][_0x9a04('0x4b')]?_0x55f0ab['attributes']:_0xe09087[_0x9a04('0x48')];if(!_0x4c9767[_0x9a04('0x44')][_0x9a04('0x4c')](_0x9a04('0x4d'))){_0x55f0ab['limit']=qs[_0x9a04('0x36')](_0x4c9767[_0x9a04('0x44')][_0x9a04('0x36')]);_0x55f0ab[_0x9a04('0x35')]=qs[_0x9a04('0x35')](_0x4c9767[_0x9a04('0x44')][_0x9a04('0x35')]);}_0x55f0ab[_0x9a04('0x4e')]=qs[_0x9a04('0x4f')](_0x4c9767['query'][_0x9a04('0x4f')]);_0x55f0ab[_0x9a04('0x50')]=qs[_0x9a04('0x46')](_[_0x9a04('0x51')](_0x4c9767[_0x9a04('0x44')],_0xe09087[_0x9a04('0x46')]),_0x515969);if(_0x4c9767['query'][_0x9a04('0x52')]){_0x55f0ab['where']=_['merge'](_0x55f0ab['where'],{'$or':_[_0x9a04('0x53')](_0x515969,function(_0x5897e9){if(_0x5897e9[_0x9a04('0x54')]!==_0x9a04('0x55')){var _0x386e6d={};_0x386e6d[_0x5897e9['name']]={'$like':'%'+_0x4c9767[_0x9a04('0x44')][_0x9a04('0x52')]+'%'};return _0x386e6d;}})});}_0x55f0ab=_[_0x9a04('0x56')]({},_0x55f0ab,_0x4c9767[_0x9a04('0x57')]);var _0x251656={'where':_0x55f0ab['where']};return db[_0x9a04('0x58')]['count'](_0x251656)['then'](function(_0x54af4c){_0xb9addf['count']=_0x54af4c;if(_0x4c9767[_0x9a04('0x44')][_0x9a04('0x59')]){_0x55f0ab[_0x9a04('0x5a')]=[{'all':!![]}];}return db[_0x9a04('0x58')]['findAll'](_0x55f0ab);})[_0x9a04('0x25')](function(_0x3c84ab){_0xb9addf[_0x9a04('0x5b')]=_0x3c84ab;return _0xb9addf;})[_0x9a04('0x25')](respondWithFilteredResult(_0xa6777f,_0x55f0ab))['catch'](handleError(_0xa6777f,null));};exports[_0x9a04('0x5c')]=function(_0x1272ac,_0x18fc19){var _0x5e2bf5={'raw':!![],'where':{'id':_0x1272ac[_0x9a04('0x5d')]['id']}},_0x2ac0eb={};_0x2ac0eb[_0x9a04('0x48')]=_['keys'](db[_0x9a04('0x58')][_0x9a04('0x41')]);_0x2ac0eb[_0x9a04('0x44')]=_['keys'](_0x1272ac['query']);_0x2ac0eb[_0x9a04('0x46')]=_[_0x9a04('0x47')](_0x2ac0eb['model'],_0x2ac0eb[_0x9a04('0x44')]);_0x5e2bf5[_0x9a04('0x49')]=_['intersection'](_0x2ac0eb[_0x9a04('0x48')],qs[_0x9a04('0x4a')](_0x1272ac[_0x9a04('0x44')][_0x9a04('0x4a')]));_0x5e2bf5[_0x9a04('0x49')]=_0x5e2bf5[_0x9a04('0x49')][_0x9a04('0x4b')]?_0x5e2bf5[_0x9a04('0x49')]:_0x2ac0eb[_0x9a04('0x48')];if(_0x1272ac[_0x9a04('0x44')][_0x9a04('0x59')]){_0x5e2bf5[_0x9a04('0x5a')]=[{'all':!![]}];}_0x5e2bf5=_['merge']({},_0x5e2bf5,_0x1272ac[_0x9a04('0x57')]);return db[_0x9a04('0x58')]['find'](_0x5e2bf5)[_0x9a04('0x25')](handleEntityNotFound(_0x18fc19,null))[_0x9a04('0x25')](respondWithResult(_0x18fc19,null))[_0x9a04('0x5e')](handleError(_0x18fc19,null));};exports[_0x9a04('0x3b')]=function(_0x5bfd01,_0x40d9d2){if(_0x5bfd01['body']['id']){delete _0x5bfd01[_0x9a04('0x5f')]['id'];}return db[_0x9a04('0x58')][_0x9a04('0x60')]({'where':{'id':_0x5bfd01[_0x9a04('0x5d')]['id']}})[_0x9a04('0x25')](handleEntityNotFound(_0x40d9d2,null))[_0x9a04('0x25')](saveUpdates(_0x5bfd01[_0x9a04('0x5f')],null))[_0x9a04('0x25')](respondWithResult(_0x40d9d2,null))[_0x9a04('0x5e')](handleError(_0x40d9d2,null));};exports['destroy']=function(_0x3df3d0,_0x4cad23){return db[_0x9a04('0x58')][_0x9a04('0x60')]({'where':{'id':_0x3df3d0[_0x9a04('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4cad23,null))[_0x9a04('0x25')](removeEntity(_0x4cad23,null))['catch'](handleError(_0x4cad23,null));};exports[_0x9a04('0x61')]=function(_0x73ae5c,_0x295450){return db[_0x9a04('0x58')][_0x9a04('0x61')]()[_0x9a04('0x25')](respondWithResult(_0x295450,null))['catch'](handleError(_0x295450,null));};exports[_0x9a04('0x62')]=function(_0x50c9cd,_0x5e31e8){return db[_0x9a04('0x58')]['create'](_0x50c9cd[_0x9a04('0x5f')])[_0x9a04('0x25')](function(_0x5150ac){if(_0x5150ac){if(_0x5150ac[_0x9a04('0x63')]===_0x9a04('0x64')&&!_0x5150ac[_0x9a04('0x65')]){var _0x46698f,_0x281587,_0x110f46;if(_0x50c9cd['body']['to']){_0x281587=_0x50c9cd[_0x9a04('0x5f')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x9a04('0x66')]({'where':{'id':_0x5150ac['MailAccountId']},'include':[{'model':db[_0x9a04('0x67')],'as':'List','include':[{'model':db[_0x9a04('0x68')],'as':_0x9a04('0x69'),'where':{'email':_0x281587},'limit':0x1,'order':[[_0x9a04('0x6a'),_0x9a04('0x6b')]]}]},{'model':db[_0x9a04('0x6c')],'as':_0x9a04('0x6d'),'raw':!![]}]})[_0x9a04('0x25')](function(_0x14e950){_0x46698f=_0x14e950;if(_0x46698f&&_0x46698f[_0x9a04('0x6d')]){var _0x2d72d8={'tls':{'rejectUnauthorized':![]}};if(_[_0x9a04('0x6e')](_0x46698f['Smtp']['service'])){_0x2d72d8[_0x9a04('0x6f')]=_0x46698f['Smtp'][_0x9a04('0x6f')];_0x2d72d8[_0x9a04('0x70')]=_0x46698f['Smtp'][_0x9a04('0x70')];_0x2d72d8[_0x9a04('0x71')]=_0x46698f[_0x9a04('0x6d')][_0x9a04('0x71')];if(_0x46698f[_0x9a04('0x6d')][_0x9a04('0x72')]){_0x2d72d8['auth']={'user':_0x46698f[_0x9a04('0x6d')][_0x9a04('0x73')],'pass':_0x46698f[_0x9a04('0x6d')][_0x9a04('0x74')]};}}else{_0x2d72d8[_0x9a04('0x75')]=_0x46698f[_0x9a04('0x6d')][_0x9a04('0x75')];_0x2d72d8[_0x9a04('0x76')]={'user':_0x46698f[_0x9a04('0x6d')][_0x9a04('0x73')],'pass':_0x46698f[_0x9a04('0x6d')][_0x9a04('0x74')]};_0x2d72d8[_0x9a04('0x71')]=_0x46698f[_0x9a04('0x6d')][_0x9a04('0x71')];}if(_0x50c9cd['body']['attachments']&&_0x50c9cd['body']['attachments'][_0x9a04('0x4b')]){for(var _0x435af5=0x0;_0x435af5<_0x50c9cd[_0x9a04('0x5f')]['attachments'][_0x9a04('0x4b')];_0x435af5+=0x1){_0x50c9cd[_0x9a04('0x5f')][_0x9a04('0x77')][_0x435af5]={'filename':_0x50c9cd[_0x9a04('0x5f')][_0x9a04('0x77')][_0x435af5][_0x9a04('0x3e')],'path':path[_0x9a04('0x78')](config[_0x9a04('0x79')],'server/files/attachments',_0x50c9cd[_0x9a04('0x5f')][_0x9a04('0x77')][_0x435af5][_0x9a04('0x7a')])};}}_0x110f46={'account':_0x2d72d8,'message':_0x50c9cd[_0x9a04('0x5f')]};return;}})['then'](function(){if(_0x46698f[_0x9a04('0x7b')]){if(_0x46698f[_0x9a04('0x7b')][_0x9a04('0x69')]['length']){return _0x46698f[_0x9a04('0x7b')]['Contacts'][0x0];}else{return db['CmContact'][_0x9a04('0x62')](_[_0x9a04('0x7c')](_0x50c9cd[_0x9a04('0x5f')],{'firstName':_0x50c9cd[_0x9a04('0x5f')]['to'],'email':_0x50c9cd[_0x9a04('0x5f')]['to'],'phone':_0x50c9cd[_0x9a04('0x5f')]['to'],'ListId':_0x46698f[_0x9a04('0x7d')]}));}}else{throw new Error(_0x9a04('0x7e'));}})[_0x9a04('0x25')](function(){if(_0x110f46){return respondWithRpcPromise('SendMail','sendMail',_0x110f46,client9003)[_0x9a04('0x25')](function(_0x5f537c){return _0x5150ac['update']({'read':!![],'messageId':_0x5f537c[_0x9a04('0x7f')],'sentAt':moment()[_0x9a04('0x80')](_0x9a04('0x81'))});})[_0x9a04('0x5e')](function(_0x5ad308){logger['error']('%s',JSON['stringify'](_0x5ad308));return _0x5150ac;});}return _0x5150ac;});}return _0x5150ac;}})[_0x9a04('0x25')](respondWithResult(_0x5e31e8,0xc9))['catch'](handleError(_0x5e31e8,null));};var interaction_log=require('../../config/logger')(_0x9a04('0x82'));exports[_0x9a04('0x83')]=function(_0x51a752,_0x5232ee,_0x195033){var _0x96ff49={'channel':_0x9a04('0x84')};if(_0x51a752[_0x9a04('0x5f')]['id']){delete _0x51a752['body']['id'];}_0x51a752['body'][_0x9a04('0x85')]=!![];_0x51a752[_0x9a04('0x5f')][_0x9a04('0x86')]=moment()[_0x9a04('0x80')](_0x9a04('0x81'));_0x51a752[_0x9a04('0x5f')][_0x9a04('0x87')]=_0x51a752[_0x9a04('0x5f')][_0x9a04('0x87')]||_0x51a752[_0x9a04('0x73')]['id'];return db[_0x9a04('0x58')][_0x9a04('0x60')]({'where':{'id':_0x51a752['params']['id'],'UserId':null},'include':[{'model':db[_0x9a04('0x68')],'as':_0x9a04('0x88')}]})[_0x9a04('0x25')](handleEntityNotFound(_0x5232ee,null))[_0x9a04('0x25')](saveUpdates(_0x51a752['body'],null))[_0x9a04('0x25')](function(_0x27af37){if(_0x27af37){_0x96ff49[_0x9a04('0x2e')]=_0x27af37[_0x9a04('0x89')]({'plain':!![]});return db[_0x9a04('0x8a')][_0x9a04('0x60')]({'where':{'id':_0x27af37[_0x9a04('0x8b')]}});}return null;})[_0x9a04('0x25')](handleEntityNotFound(_0x5232ee,null))[_0x9a04('0x25')](function(_0x1a7c8c){if(_0x1a7c8c){return _0x1a7c8c[_0x9a04('0x3b')]({'UserId':_0x51a752[_0x9a04('0x5f')]['UserId'],'read1stAt':_[_0x9a04('0x6e')](_0x1a7c8c[_0x9a04('0x8c')])?moment()[_0x9a04('0x80')](_0x9a04('0x81')):undefined});}return null;})[_0x9a04('0x25')](function(_0x846209){if(_0x846209){_0x96ff49[_0x9a04('0x8d')]=_0x846209[_0x9a04('0x89')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x51a752[_0x9a04('0x73')]['id'],_0x51a752['user'][_0x9a04('0x3e')],_0x51a752[_0x9a04('0x73')]['role'],_0x96ff49['interaction']['id'],_0x51a752['body']?JSON[_0x9a04('0x2b')](_0x51a752[_0x9a04('0x5f')]):_0x9a04('0x8e'));return respondWithRpcPromise('AcceptMessage',_0x9a04('0x8f'),_0x96ff49);}return null;})[_0x9a04('0x25')](function(_0x4d36ee){if(_0x4d36ee){if(_0x51a752[_0x9a04('0x5f')][_0x9a04('0x90')]){_0x96ff49[_0x9a04('0x2e')][_0x9a04('0x91')]=util[_0x9a04('0x80')](_0x9a04('0x92'),_0x51a752['user']['name']);_0x96ff49[_0x9a04('0x2e')][_0x9a04('0x93')]=_0x96ff49['channel'];_0x96ff49[_0x9a04('0x2e')][_0x9a04('0x94')]=_0x9a04('0x83');return respondWithRpcPromise(_0x9a04('0x95'),'EventManager',{'event':_0x9a04('0x96'),'message':_0x96ff49[_0x9a04('0x2e')]},client9002)['then'](function(){return _0x96ff49;});}return _0x96ff49;}return null;})[_0x9a04('0x25')](respondWithResult(_0x5232ee,null))['catch'](handleError(_0x5232ee,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports['reject']=function(_0x329557,_0x16e023,_0x7dfccd){var _0x580bf5={'agent':{},'channel':_0x9a04('0x84')};if(_0x329557[_0x9a04('0x5f')]['id']){delete _0x329557['body']['id'];}_0x329557['body'][_0x9a04('0x87')]=_0x329557[_0x9a04('0x5f')]['UserId']||_0x329557[_0x9a04('0x73')]['id'];_0x580bf5[_0x9a04('0x97')]['id']=_0x329557[_0x9a04('0x5f')][_0x9a04('0x87')];return db[_0x9a04('0x58')][_0x9a04('0x60')]({'where':{'id':_0x329557['params']['id'],'UserId':null}})[_0x9a04('0x25')](handleEntityNotFound(_0x16e023,null))['then'](function(_0x1a4985){if(_0x1a4985){_0x580bf5['message']=_0x1a4985[_0x9a04('0x89')]({'plain':!![]});return db[_0x9a04('0x8a')]['find']({'where':{'id':_0x1a4985['MailInteractionId']}});}return null;})[_0x9a04('0x25')](handleEntityNotFound(_0x16e023,null))[_0x9a04('0x25')](function(_0x19ce8d){if(_0x19ce8d){_0x580bf5['interaction']=_0x19ce8d[_0x9a04('0x89')]({'plain':!![]});interaction_log[_0x9a04('0x26')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x329557['user']['id'],_0x329557[_0x9a04('0x73')][_0x9a04('0x3e')],_0x329557[_0x9a04('0x73')][_0x9a04('0x98')],_0x580bf5['interaction']['id'],_0x329557[_0x9a04('0x5f')]?JSON[_0x9a04('0x2b')](_0x329557['body']):_0x9a04('0x8e'));return respondWithRpcPromise(_0x9a04('0x99'),'rejectMessage',_0x580bf5);}return null;})[_0x9a04('0x25')](function(_0x193285){if(_0x193285){_0x193285[_0x9a04('0x2e')][_0x9a04('0x91')]=util['format']('SIP/%s',_0x329557[_0x9a04('0x73')][_0x9a04('0x3e')]);_0x193285[_0x9a04('0x2e')][_0x9a04('0x93')]=_0x580bf5['channel'];_0x193285[_0x9a04('0x2e')][_0x9a04('0x94')]=_0x9a04('0x9a');respondWithRpcPromise(_0x9a04('0x95'),_0x9a04('0x95'),{'event':_0x9a04('0x9b'),'message':_0x193285[_0x9a04('0x2e')]},client9002);return _0x580bf5;}return null;})[_0x9a04('0x25')](respondWithResult(_0x16e023,null))[_0x9a04('0x5e')](handleError(_0x16e023,null));};exports['download']=function(_0x15c3d3,_0x6534fb){var _0x5b5048=moment()[_0x9a04('0x9c')]()[_0x9a04('0x9d')]();var _0x5ae167=path[_0x9a04('0x78')](config[_0x9a04('0x79')],_0x9a04('0x9e'),_0x9a04('0x9f'),'tmp');var _0x2273da=path[_0x9a04('0x78')](config[_0x9a04('0x79')],'server',_0x9a04('0x9f'),_0x9a04('0x77'));var _0x408f81=util['format'](_0x9a04('0xa0'),_0x5b5048);return db[_0x9a04('0x58')][_0x9a04('0x60')]({'where':{'id':_0x15c3d3[_0x9a04('0x5d')]['id']},'attributes':['id',_0x9a04('0x5f'),'from','to','cc',_0x9a04('0xa1'),_0x9a04('0xa2'),_0x9a04('0xa3')],'include':_0x15c3d3[_0x9a04('0x44')][_0x9a04('0x77')]?[{'model':db[_0x9a04('0xa4')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x6534fb,null))[_0x9a04('0x25')](function(_0x50bae2){if(_0x50bae2){var _0x35bd81=_0x50bae2;var _0x6e0e8b={'from':_0x35bd81[_0x9a04('0xa5')],'to':_0x35bd81['to'],'subject':_0x35bd81[_0x9a04('0xa2')],'html':_0x35bd81['body'],'headers':{'Date':moment(_0x35bd81[_0x9a04('0xa3')])[_0x9a04('0x80')](_0x9a04('0xa6'))},'attachments':[]};if(_0x50bae2['cc']){_0x6e0e8b[_0x9a04('0xa7')]['Cc']=_0x50bae2['cc'];}if(_0x50bae2[_0x9a04('0xa1')]){_0x6e0e8b[_0x9a04('0xa7')][_0x9a04('0xa8')]=_0x50bae2['bcc'];}return new BPromise(function(_0x3b13b3,_0x2f3092){if(_0x50bae2[_0x9a04('0xa9')]){for(var _0x40ed41=0x0;_0x40ed41<_0x50bae2[_0x9a04('0xa9')][_0x9a04('0x4b')];_0x40ed41++){var _0x3deddb=_0x50bae2['Attachments'][_0x40ed41];var _0xa2db1=path[_0x9a04('0x78')](_0x2273da,_0x3deddb['basename']);if(fs[_0x9a04('0xaa')](_0xa2db1)){_0x6e0e8b[_0x9a04('0x77')][_0x9a04('0xab')]({'name':_0x3deddb[_0x9a04('0x3e')],'contentType':_0x3deddb[_0x9a04('0x54')],'data':fs[_0x9a04('0xac')](_0xa2db1)});}}}emlformat[_0x9a04('0xad')](_0x6e0e8b,function(_0x2fc7b2,_0x47ec9d){if(_0x2fc7b2)return _0x2f3092(_0x2fc7b2);fs['writeFileSync'](path[_0x9a04('0x78')](_0x5ae167,_0x408f81),_0x47ec9d);return _0x3b13b3(_0x47ec9d);});});}})[_0x9a04('0x25')](function(_0x31f66a){if(_0x31f66a){return _0x6534fb[_0x9a04('0xae')](path[_0x9a04('0x78')](_0x5ae167,_0x408f81),_0x408f81,function(_0x2d3aff){if(_0x2d3aff){console[_0x9a04('0xaf')](_0x9a04('0xb0'),_0x2d3aff);}else{fs[_0x9a04('0xb1')](path[_0x9a04('0x78')](_0x5ae167,_0x408f81));}});}})[_0x9a04('0x5e')](handleError(_0x6534fb,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 66ecfbb..e181964 100644 --- a/server/api/mailMessage/mailMessage.events.js +++ b/server/api/mailMessage/mailMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x262b=['MailMessage','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0x262b,0x7c));var _0xb262=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x262b[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xb262('0x0'));var MailMessage=require(_0xb262('0x1'))['db'][_0xb262('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xb262('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb262('0x4'),'afterDestroy':'remove'};function emitEvent(_0x34deb3){return function(_0xe96e81,_0x4659ed,_0x57e717){MailMessageEvents['emit'](_0x34deb3+':'+_0xe96e81['id'],_0xe96e81);MailMessageEvents[_0xb262('0x5')](_0x34deb3,_0xe96e81);_0x57e717(null);};}for(var e in events){if(events[_0xb262('0x6')](e)){var event=events[e];MailMessage[_0xb262('0x7')](e,emitEvent(event));}}module[_0xb262('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x0c2a=['update','remove','emit','hasOwnProperty','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x51d62c,_0xc247e2){var _0x3f08ab=function(_0x526c77){while(--_0x526c77){_0x51d62c['push'](_0x51d62c['shift']());}};_0x3f08ab(++_0xc247e2);}(_0x0c2a,0x11b));var _0xa0c2=function(_0x188d72,_0x4ebe6d){_0x188d72=_0x188d72-0x0;var _0x59eab0=_0x0c2a[_0x188d72];return _0x59eab0;};'use strict';var EventEmitter=require(_0xa0c2('0x0'));var MailMessage=require(_0xa0c2('0x1'))['db'][_0xa0c2('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xa0c2('0x3')](0x0);var events={'afterCreate':_0xa0c2('0x4'),'afterUpdate':_0xa0c2('0x5'),'afterDestroy':_0xa0c2('0x6')};function emitEvent(_0x3513d3){return function(_0x5da242,_0x47f3cc,_0x1411dc){MailMessageEvents['emit'](_0x3513d3+':'+_0x5da242['id'],_0x5da242);MailMessageEvents[_0xa0c2('0x7')](_0x3513d3,_0x5da242);_0x1411dc(null);};}for(var e in events){if(events[_0xa0c2('0x8')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 32c2b2e..75d80b2 100644 --- a/server/api/mailMessage/mailMessage.model.js +++ b/server/api/mailMessage/mailMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2583=['messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','get','direction','toLowerCase','out','secret','findOne','MailInteractionId','then','createdAt','catch','error','utf8mb4','lodash','util','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages'];(function(_0x54af96,_0x521baf){var _0x4a61a4=function(_0x490aa8){while(--_0x490aa8){_0x54af96['push'](_0x54af96['shift']());}};_0x4a61a4(++_0x521baf);}(_0x2583,0x1b3));var _0x3258=function(_0x5dd1e8,_0x4a106e){_0x5dd1e8=_0x5dd1e8-0x0;var _0x3a413a=_0x2583[_0x5dd1e8];return _0x3a413a;};'use strict';var _=require(_0x3258('0x0'));var util=require(_0x3258('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3258('0x2'));var BPromise=require(_0x3258('0x3'));var rp=require(_0x3258('0x4'));var htmlToText=require(_0x3258('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3258('0x6'));var config=require(_0x3258('0x7'));var attributes=require(_0x3258('0x8'));module[_0x3258('0x9')]=function(_0x136bb0,_0x782e51){return _0x136bb0[_0x3258('0xa')](_0x3258('0xb'),attributes,{'tableName':_0x3258('0xc'),'paranoid':![],'indexes':[{'name':_0x3258('0xd'),'fields':['messageId']},{'name':_0x3258('0xe'),'fields':[_0x3258('0xf'),_0x3258('0x10')],'type':_0x3258('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x276117,_0x53e91a,_0x34290b){if(_0x276117[_0x3258('0x12')]){_0x276117[_0x3258('0xf')]=htmlToText['fromString'](_0x276117['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x34290b(null,_0x53e91a);},'afterCreate':function(_0x1232a5,_0x30ecaf,_0x19509e){var _0x37ad44=_0x136bb0[_0x3258('0x13')];var _0x6af766=_0x1232a5[_0x3258('0x14')]({'plain':!![]});if(_0x6af766[_0x3258('0x15')][_0x3258('0x16')]()==='in'||_0x6af766[_0x3258('0x15')][_0x3258('0x16')]()===_0x3258('0x17')&&!_0x6af766[_0x3258('0x18')]&&!_['isNil'](_0x6af766['UserId'])){_0x37ad44['MailInteraction'][_0x3258('0x19')]({'where':{'id':_0x6af766[_0x3258('0x1a')]}})[_0x3258('0x1b')](function(_0x2b0050){if(_0x2b0050){_0x2b0050['update']({'lastMsgAt':_0x6af766[_0x3258('0x1c')],'lastMsgDirection':_0x6af766[_0x3258('0x15')][_0x3258('0x16')](),'lastMsgBody':_0x6af766[_0x3258('0x12')]});}})[_0x3258('0x1d')](function(_0x12ac3c){console[_0x3258('0x1e')](_0x12ac3c);});}_0x19509e();}},'charset':_0x3258('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6dc5=['UserId','findOne','MailInteractionId','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','FULLTEXT','body','get','direction','toLowerCase','out','secret','isNil'];(function(_0x203d6c,_0x40857d){var _0xcbf00f=function(_0x4e6d8a){while(--_0x4e6d8a){_0x203d6c['push'](_0x203d6c['shift']());}};_0xcbf00f(++_0x40857d);}(_0x6dc5,0xc8));var _0x56dc=function(_0x3daa48,_0x1127d0){_0x3daa48=_0x3daa48-0x0;var _0xe63407=_0x6dc5[_0x3daa48];return _0xe63407;};'use strict';var _=require(_0x56dc('0x0'));var util=require(_0x56dc('0x1'));var logger=require('../../config/logger')(_0x56dc('0x2'));var moment=require(_0x56dc('0x3'));var BPromise=require(_0x56dc('0x4'));var rp=require(_0x56dc('0x5'));var htmlToText=require(_0x56dc('0x6'));var fs=require('fs');var path=require(_0x56dc('0x7'));var rimraf=require(_0x56dc('0x8'));var config=require(_0x56dc('0x9'));var attributes=require('./mailMessage.attributes');module[_0x56dc('0xa')]=function(_0x624e35,_0x734ad0){return _0x624e35[_0x56dc('0xb')](_0x56dc('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x56dc('0xd'),'fields':['messageId']},{'name':_0x56dc('0xe'),'fields':[_0x56dc('0xf'),'subject'],'type':_0x56dc('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5c5595,_0x1241dd,_0x3dc207){if(_0x5c5595[_0x56dc('0x11')]){_0x5c5595[_0x56dc('0xf')]=htmlToText['fromString'](_0x5c5595[_0x56dc('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3dc207(null,_0x1241dd);},'afterCreate':function(_0x4ffe1e,_0x5d673b,_0x24677f){var _0x5085c2=_0x624e35['models'];var _0x5df228=_0x4ffe1e[_0x56dc('0x12')]({'plain':!![]});if(_0x5df228[_0x56dc('0x13')][_0x56dc('0x14')]()==='in'||_0x5df228[_0x56dc('0x13')][_0x56dc('0x14')]()===_0x56dc('0x15')&&!_0x5df228[_0x56dc('0x16')]&&!_[_0x56dc('0x17')](_0x5df228[_0x56dc('0x18')])){_0x5085c2['MailInteraction'][_0x56dc('0x19')]({'where':{'id':_0x5df228[_0x56dc('0x1a')]}})[_0x56dc('0x1b')](function(_0x4735ad){if(_0x4735ad){_0x4735ad['update']({'lastMsgAt':_0x5df228[_0x56dc('0x1c')],'lastMsgDirection':_0x5df228[_0x56dc('0x13')][_0x56dc('0x14')](),'lastMsgBody':_0x5df228[_0x56dc('0x11')]});}})[_0x56dc('0x1d')](function(_0x3b1986){console['error'](_0x3b1986);});}_0x24677f();}},'charset':_0x56dc('0x1e'),'collate':_0x56dc('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 5882205..ea36287 100644 --- a/server/api/mailMessage/mailMessage.rpc.js +++ b/server/api/mailMessage/mailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc48=['../../config/utils','../../config/logger','../../config/environment','redis','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','MailMessage','create','body','options','raw','CreateMailMessage','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x4d09d3,_0x57b3fb){var _0x3452f9=function(_0x2c77fa){while(--_0x2c77fa){_0x4d09d3['push'](_0x4d09d3['shift']());}};_0x3452f9(++_0x57b3fb);}(_0xbc48,0x111));var _0x8bc4=function(_0x15726e,_0x36ab1d){_0x15726e=_0x15726e-0x0;var _0x34df3d=_0xbc48[_0x15726e];return _0x34df3d;};'use strict';var _=require(_0x8bc4('0x0'));var util=require(_0x8bc4('0x1'));var moment=require(_0x8bc4('0x2'));var BPromise=require(_0x8bc4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bc4('0x4'));var db=require(_0x8bc4('0x5'))['db'];var utils=require(_0x8bc4('0x6'));var logger=require(_0x8bc4('0x7'))('rpc');var config=require(_0x8bc4('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x8bc4('0x9')]=_['defaults'](config['redis'],{'host':_0x8bc4('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8bc4('0x9')]));require(_0x8bc4('0xb'))[_0x8bc4('0xc')](socket);function respondWithRpcPromise(_0x14a71c,_0x5bc9b4,_0x1595b2){return new BPromise(function(_0x98fbd1,_0x19ed4c){return client[_0x8bc4('0xd')](_0x14a71c,_0x1595b2)[_0x8bc4('0xe')](function(_0x36d582){logger[_0x8bc4('0xf')](_0x8bc4('0x10'),_0x5bc9b4,_0x8bc4('0x11'));logger[_0x8bc4('0x12')](_0x8bc4('0x13'),_0x5bc9b4,_0x8bc4('0x11'),JSON[_0x8bc4('0x14')](_0x36d582));if(_0x36d582[_0x8bc4('0x15')]){if(_0x36d582[_0x8bc4('0x15')]['code']===0x1f4){logger[_0x8bc4('0x15')](_0x8bc4('0x10'),_0x5bc9b4,_0x36d582[_0x8bc4('0x15')][_0x8bc4('0x16')]);return _0x19ed4c(_0x36d582[_0x8bc4('0x15')][_0x8bc4('0x16')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x5bc9b4,_0x36d582['error'][_0x8bc4('0x16')]);return _0x98fbd1(_0x36d582['error'][_0x8bc4('0x16')]);}else{logger[_0x8bc4('0xf')](_0x8bc4('0x10'),_0x5bc9b4,'request\x20sent');_0x98fbd1(_0x36d582[_0x8bc4('0x17')][_0x8bc4('0x16')]);}})['catch'](function(_0x1c8d5b){logger['error'](_0x8bc4('0x10'),_0x5bc9b4,_0x1c8d5b);_0x19ed4c(_0x1c8d5b);});});}exports['CreateMailMessage']=function(_0x5c3835){var _0x1da3d7=this;return new Promise(function(_0x2602c6,_0x415598){return db[_0x8bc4('0x18')][_0x8bc4('0x19')](_0x5c3835[_0x8bc4('0x1a')],{'raw':_0x5c3835[_0x8bc4('0x1b')]?_0x5c3835[_0x8bc4('0x1b')][_0x8bc4('0x1c')]===undefined?!![]:![]:!![]})[_0x8bc4('0xe')](function(_0x148fda){logger['info'](_0x8bc4('0x1d'),_0x5c3835);logger[_0x8bc4('0x12')](_0x8bc4('0x1d'),_0x5c3835,JSON['stringify'](_0x148fda));_0x2602c6(_0x148fda);})[_0x8bc4('0x1e')](function(_0x247eb8){logger['error'](_0x8bc4('0x1d'),_0x247eb8[_0x8bc4('0x16')],_0x5c3835);_0x415598(_0x1da3d7[_0x8bc4('0x15')](0x1f4,_0x247eb8['message']));});});}; \ No newline at end of file +var _0xc949=['defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailMessage','create','body','options','raw','CreateMailMessage','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x356767,_0x10314e){var _0xbe0619=function(_0x37580c){while(--_0x37580c){_0x356767['push'](_0x356767['shift']());}};_0xbe0619(++_0x10314e);}(_0xc949,0x181));var _0x9c94=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xc949[_0x5d80de];return _0x1c7556;};'use strict';var _=require(_0x9c94('0x0'));var util=require('util');var moment=require(_0x9c94('0x1'));var BPromise=require(_0x9c94('0x2'));var rs=require(_0x9c94('0x3'));var fs=require('fs');var Redis=require(_0x9c94('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c94('0x5'));var logger=require(_0x9c94('0x6'))('rpc');var config=require(_0x9c94('0x7'));var jayson=require(_0x9c94('0x8'));var client=jayson[_0x9c94('0x9')][_0x9c94('0xa')]({'port':0x232a});config['redis']=_[_0x9c94('0xb')](config[_0x9c94('0xc')],{'host':_0x9c94('0xd'),'port':0x18eb});var socket=require(_0x9c94('0xe'))(new Redis(config[_0x9c94('0xc')]));require(_0x9c94('0xf'))[_0x9c94('0x10')](socket);function respondWithRpcPromise(_0x454b16,_0x417063,_0x3287f8){return new BPromise(function(_0x5775c9,_0x3dc850){return client[_0x9c94('0x11')](_0x454b16,_0x3287f8)[_0x9c94('0x12')](function(_0x20fc5a){logger[_0x9c94('0x13')](_0x9c94('0x14'),_0x417063,_0x9c94('0x15'));logger[_0x9c94('0x16')](_0x9c94('0x17'),_0x417063,_0x9c94('0x15'),JSON[_0x9c94('0x18')](_0x20fc5a));if(_0x20fc5a[_0x9c94('0x19')]){if(_0x20fc5a[_0x9c94('0x19')][_0x9c94('0x1a')]===0x1f4){logger['error'](_0x9c94('0x14'),_0x417063,_0x20fc5a['error'][_0x9c94('0x1b')]);return _0x3dc850(_0x20fc5a[_0x9c94('0x19')]['message']);}logger[_0x9c94('0x19')]('MailMessage,\x20%s,\x20%s',_0x417063,_0x20fc5a['error'][_0x9c94('0x1b')]);return _0x5775c9(_0x20fc5a['error'][_0x9c94('0x1b')]);}else{logger[_0x9c94('0x13')]('MailMessage,\x20%s,\x20%s',_0x417063,_0x9c94('0x15'));_0x5775c9(_0x20fc5a[_0x9c94('0x1c')][_0x9c94('0x1b')]);}})[_0x9c94('0x1d')](function(_0x16ef2c){logger[_0x9c94('0x19')](_0x9c94('0x14'),_0x417063,_0x16ef2c);_0x3dc850(_0x16ef2c);});});}exports['CreateMailMessage']=function(_0x2c9736){var _0x39e336=this;return new Promise(function(_0x4e2569,_0x141801){return db[_0x9c94('0x1e')][_0x9c94('0x1f')](_0x2c9736[_0x9c94('0x20')],{'raw':_0x2c9736[_0x9c94('0x21')]?_0x2c9736[_0x9c94('0x21')][_0x9c94('0x22')]===undefined?!![]:![]:!![]})[_0x9c94('0x12')](function(_0x8fe4fb){logger[_0x9c94('0x13')](_0x9c94('0x23'),_0x2c9736);logger[_0x9c94('0x16')](_0x9c94('0x23'),_0x2c9736,JSON[_0x9c94('0x18')](_0x8fe4fb));_0x4e2569(_0x8fe4fb);})['catch'](function(_0x1f3b14){logger[_0x9c94('0x19')]('CreateMailMessage',_0x1f3b14[_0x9c94('0x1b')],_0x2c9736);_0x141801(_0x39e336[_0x9c94('0x19')](0x1f4,_0x1f3b14[_0x9c94('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 4f80963..2ebf437 100644 --- a/server/api/mailMessage/mailMessage.socket.js +++ b/server/api/mailMessage/mailMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b6d=['emit','removeListener','register','length','mailMessage:','save','remove','update'];(function(_0x411868,_0x2aee9c){var _0x5f1682=function(_0x1651c0){while(--_0x1651c0){_0x411868['push'](_0x411868['shift']());}};_0x5f1682(++_0x2aee9c);}(_0x9b6d,0x105));var _0xd9b6=function(_0x18dcc1,_0x439f7e){_0x18dcc1=_0x18dcc1-0x0;var _0x33f5ec=_0x9b6d[_0x18dcc1];return _0x33f5ec;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xd9b6('0x0'),_0xd9b6('0x1'),_0xd9b6('0x2')];function createListener(_0x267c69,_0x2dedf4){return function(_0x455d78){_0x2dedf4[_0xd9b6('0x3')](_0x267c69,_0x455d78);};}function removeListener(_0xbd3d3b,_0x3e9fde){return function(){MailMessageEvents[_0xd9b6('0x4')](_0xbd3d3b,_0x3e9fde);};}exports[_0xd9b6('0x5')]=function(_0x5724e3){for(var _0x2d38ce=0x0,_0x344ba0=events[_0xd9b6('0x6')];_0x2d38ce<_0x344ba0;_0x2d38ce++){var _0x34ccf1=events[_0x2d38ce];var _0x5c6054=createListener(_0xd9b6('0x7')+_0x34ccf1,_0x5724e3);MailMessageEvents['on'](_0x34ccf1,_0x5c6054);}}; \ No newline at end of file +var _0x26ed=['./mailMessage.events','remove','update','emit','removeListener','register','length','mailMessage:'];(function(_0x3d15a3,_0x5af28a){var _0x42a590=function(_0x5565cc){while(--_0x5565cc){_0x3d15a3['push'](_0x3d15a3['shift']());}};_0x42a590(++_0x5af28a);}(_0x26ed,0x1f0));var _0xd26e=function(_0x102243,_0x2b4dde){_0x102243=_0x102243-0x0;var _0x1d302c=_0x26ed[_0x102243];return _0x1d302c;};'use strict';var MailMessageEvents=require(_0xd26e('0x0'));var events=['save',_0xd26e('0x1'),_0xd26e('0x2')];function createListener(_0x4b4db0,_0x2746a7){return function(_0x308f35){_0x2746a7[_0xd26e('0x3')](_0x4b4db0,_0x308f35);};}function removeListener(_0xeb9824,_0x139f0e){return function(){MailMessageEvents[_0xd26e('0x4')](_0xeb9824,_0x139f0e);};}exports[_0xd26e('0x5')]=function(_0x260b31){for(var _0x4b94f3=0x0,_0x8a8e71=events[_0xd26e('0x6')];_0x4b94f3<_0x8a8e71;_0x4b94f3++){var _0x2b12ae=events[_0x4b94f3];var _0x2bca8d=createListener(_0xd26e('0x7')+_0x2b12ae,_0x260b31);MailMessageEvents['on'](_0x2b12ae,_0x2bca8d);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index cc5cf3c..48d3a6e 100644 --- a/server/api/mailQueue/index.js +++ b/server/api/mailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28c1=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x39440e,_0x55c567){var _0xd3c2a4=function(_0x45cc29){while(--_0x45cc29){_0x39440e['push'](_0x39440e['shift']());}};_0xd3c2a4(++_0x55c567);}(_0x28c1,0x1b3));var _0x128c=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x28c1[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require('multer');var util=require(_0x128c('0x0'));var path=require(_0x128c('0x1'));var timeout=require('connect-timeout');var express=require(_0x128c('0x2'));var router=express['Router']();var auth=require(_0x128c('0x3'));var interaction=require(_0x128c('0x4'));var config=require(_0x128c('0x5'));var controller=require(_0x128c('0x6'));router[_0x128c('0x7')]('/',auth[_0x128c('0x8')](),controller[_0x128c('0x9')]);router[_0x128c('0x7')](_0x128c('0xa'),auth[_0x128c('0x8')](),controller[_0x128c('0xb')]);router[_0x128c('0x7')](_0x128c('0xc'),auth[_0x128c('0x8')](),controller[_0x128c('0xd')]);router[_0x128c('0x7')]('/:id/members',auth[_0x128c('0x8')](),controller[_0x128c('0xe')]);router[_0x128c('0x7')](_0x128c('0xf'),auth[_0x128c('0x8')](),controller[_0x128c('0x10')]);router[_0x128c('0x7')](_0x128c('0x11'),auth['isAuthenticated'](),controller[_0x128c('0x12')]);router[_0x128c('0x13')]('/',auth[_0x128c('0x8')](),controller[_0x128c('0x14')]);router['post'](_0x128c('0xf'),auth['isAuthenticated'](),controller[_0x128c('0x15')]);router[_0x128c('0x13')](_0x128c('0x11'),auth[_0x128c('0x8')](),controller[_0x128c('0x16')]);router['put'](_0x128c('0xc'),auth[_0x128c('0x8')](),controller[_0x128c('0x17')]);router[_0x128c('0x18')](_0x128c('0xc'),auth['isAuthenticated'](),controller[_0x128c('0x19')]);router[_0x128c('0x18')](_0x128c('0xf'),auth['isAuthenticated'](),controller[_0x128c('0x1a')]);router[_0x128c('0x18')](_0x128c('0x11'),auth[_0x128c('0x8')](),controller[_0x128c('0x1b')]);module[_0x128c('0x1c')]=router; \ No newline at end of file +var _0xa2f5=['put','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','post','/:id/teams','addTeams'];(function(_0x55b610,_0x4d286c){var _0x32dc71=function(_0x670c78){while(--_0x670c78){_0x55b610['push'](_0x55b610['shift']());}};_0x32dc71(++_0x4d286c);}(_0xa2f5,0x128));var _0x5a2f=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa2f5[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x5a2f('0x0'));var util=require('util');var path=require(_0x5a2f('0x1'));var timeout=require(_0x5a2f('0x2'));var express=require(_0x5a2f('0x3'));var router=express[_0x5a2f('0x4')]();var auth=require(_0x5a2f('0x5'));var interaction=require(_0x5a2f('0x6'));var config=require(_0x5a2f('0x7'));var controller=require(_0x5a2f('0x8'));router[_0x5a2f('0x9')]('/',auth['isAuthenticated'](),controller[_0x5a2f('0xa')]);router[_0x5a2f('0x9')](_0x5a2f('0xb'),auth[_0x5a2f('0xc')](),controller[_0x5a2f('0xd')]);router['get'](_0x5a2f('0xe'),auth[_0x5a2f('0xc')](),controller[_0x5a2f('0xf')]);router[_0x5a2f('0x9')](_0x5a2f('0x10'),auth[_0x5a2f('0xc')](),controller[_0x5a2f('0x11')]);router[_0x5a2f('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5a2f('0x12')]);router['get'](_0x5a2f('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x5a2f('0x14')]('/',auth[_0x5a2f('0xc')](),controller['create']);router[_0x5a2f('0x14')](_0x5a2f('0x15'),auth[_0x5a2f('0xc')](),controller[_0x5a2f('0x16')]);router['post']('/:id/users',auth[_0x5a2f('0xc')](),controller['addAgents']);router[_0x5a2f('0x17')]('/:id',auth[_0x5a2f('0xc')](),controller[_0x5a2f('0x18')]);router[_0x5a2f('0x19')](_0x5a2f('0xe'),auth['isAuthenticated'](),controller[_0x5a2f('0x1a')]);router[_0x5a2f('0x19')](_0x5a2f('0x15'),auth[_0x5a2f('0xc')](),controller['removeTeams']);router[_0x5a2f('0x19')](_0x5a2f('0x13'),auth[_0x5a2f('0xc')](),controller[_0x5a2f('0x1b')]);module[_0x5a2f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 91bc450..d274717 100644 --- a/server/api/mailQueue/mailQueue.attributes.js +++ b/server/api/mailQueue/mailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb9a=['roundrobin','sequelize','STRING','INTEGER','beepall'];(function(_0x45a866,_0x108f7a){var _0x20fd22=function(_0x2c874b){while(--_0x2c874b){_0x45a866['push'](_0x45a866['shift']());}};_0x20fd22(++_0x108f7a);}(_0xdb9a,0xce));var _0xadb9=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdb9a[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xadb9('0x0'));module['exports']={'name':{'type':Sequelize[_0xadb9('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xadb9('0x1')]},'timeout':{'type':Sequelize[_0xadb9('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xadb9('0x3'),_0xadb9('0x4'))}}; \ No newline at end of file +var _0x2133=['rrmemory','beepall','roundrobin','exports','STRING','name'];(function(_0x109843,_0x44f9b8){var _0x4ae361=function(_0x57b4de){while(--_0x57b4de){_0x109843['push'](_0x109843['shift']());}};_0x4ae361(++_0x44f9b8);}(_0x2133,0x1d1));var _0x3213=function(_0x2b269d,_0x237a39){_0x2b269d=_0x2b269d-0x0;var _0x19b98d=_0x2133[_0x2b269d];return _0x19b98d;};'use strict';var Sequelize=require('sequelize');module[_0x3213('0x0')]={'name':{'type':Sequelize[_0x3213('0x1')],'unique':_0x3213('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3213('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3213('0x3'),_0x3213('0x4'),_0x3213('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 8b23748..9e301b0 100644 --- a/server/api/mailQueue/mailQueue.controller.js +++ b/server/api/mailQueue/mailQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x86f1=['filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','MailQueueId','map','findAndCountAll','UserId','updatedAt','createdAt','rows','format','mailPause','getTeams','Team','order','addTeams','ids','User','voicePause','flatMap','Agents','sequelize','transaction','each','forEach','userMailQueue:save','removeTeams','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeAgents','userMailQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','./mailQueue.socket','register','sendStatus','end','status','count','offset','set','Content-Range','reject','save','then','destroy','get','MailQueues','UserProfileResource','error','name','send','index','MailQueue','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','nolimit','limit','sort','where','pick'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0x86f1,0x1e9));var _0x186f=function(_0x4c94fb,_0x531311){_0x4c94fb=_0x4c94fb-0x0;var _0x3704ad=_0x86f1[_0x4c94fb];return _0x3704ad;};'use strict';var pdf=require(_0x186f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x186f('0x1'));var zipdir=require(_0x186f('0x2'));var jsonpatch=require(_0x186f('0x3'));var rp=require(_0x186f('0x4'));var moment=require(_0x186f('0x5'));var BPromise=require(_0x186f('0x6'));var Mustache=require(_0x186f('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x186f('0x8'));var ejs=require(_0x186f('0x9'));var fs=require('fs');var _=require(_0x186f('0xa'));var squel=require(_0x186f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x186f('0x8'));var querystring=require(_0x186f('0xc'));var Papa=require(_0x186f('0xd'));var Redis=require(_0x186f('0xe'));var authService=require(_0x186f('0xf'));var qs=require(_0x186f('0x10'));var as=require(_0x186f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x186f('0x12'))(_0x186f('0x13'));var utils=require(_0x186f('0x14'));var config=require(_0x186f('0x15'));var db=require(_0x186f('0x16'))['db'];config[_0x186f('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x186f('0x18'))[_0x186f('0x19')](socket);function respondWithStatusCode(_0x19491d,_0x22aa81){_0x22aa81=_0x22aa81||0xcc;return function(_0x54774f){if(_0x54774f){return _0x19491d[_0x186f('0x1a')](_0x22aa81);}return _0x19491d['status'](_0x22aa81)[_0x186f('0x1b')]();};}function respondWithResult(_0x38757d,_0x20e2b1){_0x20e2b1=_0x20e2b1||0xc8;return function(_0x588947){if(_0x588947){return _0x38757d[_0x186f('0x1c')](_0x20e2b1)['json'](_0x588947);}};}function respondWithFilteredResult(_0xcd35ed,_0x54cd7e){return function(_0x37cc2a){if(_0x37cc2a){var _0x3ea323=_0x37cc2a[_0x186f('0x1d')],_0x54fab3=_0x54cd7e[_0x186f('0x1e')],_0x14da0d=_0x54cd7e[_0x186f('0x1e')]+_0x54cd7e['limit'],_0x228722;if(_0x14da0d>=_0x3ea323){_0x14da0d=_0x3ea323;_0x228722=0xc8;}else{_0x228722=0xce;}_0xcd35ed[_0x186f('0x1c')](_0x228722);return _0xcd35ed[_0x186f('0x1f')](_0x186f('0x20'),_0x54fab3+'-'+_0x14da0d+'/'+_0x3ea323)['json'](_0x37cc2a);}return null;};}function patchUpdates(_0x4cc313){return function(_0x35ea04){try{jsonpatch['apply'](_0x35ea04,_0x4cc313,!![]);}catch(_0x20af84){return BPromise[_0x186f('0x21')](_0x20af84);}return _0x35ea04[_0x186f('0x22')]();};}function saveUpdates(_0xd7c634,_0x51b7e7){return function(_0x414501){if(_0x414501){return _0x414501['update'](_0xd7c634)[_0x186f('0x23')](function(_0x1b65d3){return _0x1b65d3;});}return null;};}function removeEntity(_0x3ea564,_0x96a132){return function(_0x16c588){if(_0x16c588){return _0x16c588[_0x186f('0x24')]()[_0x186f('0x23')](function(){var _0x2ba921=_0x16c588[_0x186f('0x25')]({'plain':!![]});var _0x4de5ce=_0x186f('0x26');return db[_0x186f('0x27')][_0x186f('0x24')]({'where':{'type':_0x4de5ce,'resourceId':_0x2ba921['id']}})[_0x186f('0x23')](function(){return _0x16c588;});})[_0x186f('0x23')](function(){_0x3ea564[_0x186f('0x1c')](0xcc)[_0x186f('0x1b')]();});}};}function handleEntityNotFound(_0x207dc0,_0x1d6f32){return function(_0x193576){if(!_0x193576){_0x207dc0[_0x186f('0x1a')](0x194);}return _0x193576;};}function handleError(_0x383e53,_0x1e36fd){_0x1e36fd=_0x1e36fd||0x1f4;return function(_0x24befe){logger[_0x186f('0x28')](_0x24befe['stack']);if(_0x24befe[_0x186f('0x29')]){delete _0x24befe['name'];}_0x383e53['status'](_0x1e36fd)[_0x186f('0x2a')](_0x24befe);};}exports[_0x186f('0x2b')]=function(_0xb36ce1,_0x9a5c1e){var _0x14bf81={},_0x326620={},_0x90159b={'count':0x0,'rows':[]};var _0xc8b5da=_['map'](db[_0x186f('0x2c')][_0x186f('0x2d')],function(_0x5bea7c){return{'name':_0x5bea7c[_0x186f('0x2e')],'type':_0x5bea7c['type'][_0x186f('0x2f')]};});_0x326620[_0x186f('0x30')]=_['map'](_0xc8b5da,_0x186f('0x29'));_0x326620['query']=_[_0x186f('0x31')](_0xb36ce1[_0x186f('0x32')]);_0x326620['filters']=_['intersection'](_0x326620[_0x186f('0x30')],_0x326620[_0x186f('0x32')]);_0x14bf81['attributes']=_[_0x186f('0x33')](_0x326620[_0x186f('0x30')],qs[_0x186f('0x34')](_0xb36ce1[_0x186f('0x32')][_0x186f('0x34')]));_0x14bf81[_0x186f('0x35')]=_0x14bf81[_0x186f('0x35')]['length']?_0x14bf81[_0x186f('0x35')]:_0x326620[_0x186f('0x30')];if(!_0xb36ce1['query']['hasOwnProperty'](_0x186f('0x36'))){_0x14bf81[_0x186f('0x37')]=qs[_0x186f('0x37')](_0xb36ce1[_0x186f('0x32')][_0x186f('0x37')]);_0x14bf81[_0x186f('0x1e')]=qs[_0x186f('0x1e')](_0xb36ce1['query'][_0x186f('0x1e')]);}_0x14bf81['order']=qs[_0x186f('0x38')](_0xb36ce1[_0x186f('0x32')][_0x186f('0x38')]);_0x14bf81[_0x186f('0x39')]=qs['filters'](_[_0x186f('0x3a')](_0xb36ce1[_0x186f('0x32')],_0x326620[_0x186f('0x3b')]),_0xc8b5da);if(_0xb36ce1[_0x186f('0x32')][_0x186f('0x3c')]){_0x14bf81['where']=_['merge'](_0x14bf81[_0x186f('0x39')],{'$or':_['map'](_0xc8b5da,function(_0x27ae69){if(_0x27ae69['type']!==_0x186f('0x3d')){var _0x11ba98={};_0x11ba98[_0x27ae69[_0x186f('0x29')]]={'$like':'%'+_0xb36ce1[_0x186f('0x32')]['filter']+'%'};return _0x11ba98;}})});}_0x14bf81=_[_0x186f('0x3e')]({},_0x14bf81,_0xb36ce1[_0x186f('0x3f')]);var _0x125df1={'where':_0x14bf81[_0x186f('0x39')]};return db[_0x186f('0x2c')][_0x186f('0x1d')](_0x125df1)['then'](function(_0x3c15e5){_0x90159b[_0x186f('0x1d')]=_0x3c15e5;if(_0xb36ce1[_0x186f('0x32')][_0x186f('0x40')]){_0x14bf81[_0x186f('0x41')]=[{'all':!![]}];}return db[_0x186f('0x2c')][_0x186f('0x42')](_0x14bf81);})[_0x186f('0x23')](function(_0x240467){_0x90159b['rows']=_0x240467;return _0x90159b;})[_0x186f('0x23')](respondWithFilteredResult(_0x9a5c1e,_0x14bf81))[_0x186f('0x43')](handleError(_0x9a5c1e,null));};exports[_0x186f('0x44')]=function(_0x34d8b1,_0x33bff3){var _0x30029d={'raw':!![],'where':{'id':_0x34d8b1[_0x186f('0x45')]['id']}},_0x4a89aa={};_0x4a89aa[_0x186f('0x30')]=_[_0x186f('0x31')](db[_0x186f('0x2c')][_0x186f('0x2d')]);_0x4a89aa[_0x186f('0x32')]=_[_0x186f('0x31')](_0x34d8b1[_0x186f('0x32')]);_0x4a89aa[_0x186f('0x3b')]=_[_0x186f('0x33')](_0x4a89aa['model'],_0x4a89aa['query']);_0x30029d[_0x186f('0x35')]=_[_0x186f('0x33')](_0x4a89aa['model'],qs[_0x186f('0x34')](_0x34d8b1[_0x186f('0x32')][_0x186f('0x34')]));_0x30029d[_0x186f('0x35')]=_0x30029d[_0x186f('0x35')][_0x186f('0x46')]?_0x30029d[_0x186f('0x35')]:_0x4a89aa['model'];if(_0x34d8b1[_0x186f('0x32')][_0x186f('0x40')]){_0x30029d[_0x186f('0x41')]=[{'all':!![]}];}_0x30029d=_[_0x186f('0x3e')]({},_0x30029d,_0x34d8b1[_0x186f('0x3f')]);return db['MailQueue'][_0x186f('0x47')](_0x30029d)[_0x186f('0x23')](handleEntityNotFound(_0x33bff3,null))[_0x186f('0x23')](respondWithResult(_0x33bff3,null))[_0x186f('0x43')](handleError(_0x33bff3,null));};exports['create']=function(_0x5e0548,_0x49782a){return db[_0x186f('0x2c')][_0x186f('0x48')](_0x5e0548[_0x186f('0x49')],{})[_0x186f('0x23')](function(_0x284b2c){var _0xf6dce=_0x5e0548['user']['get']({'plain':!![]});if(!_0xf6dce)throw new Error(_0x186f('0x4a'));if(_0xf6dce[_0x186f('0x4b')]===_0x186f('0x4c')){var _0x80907c=_0x284b2c[_0x186f('0x25')]({'plain':!![]});var _0x2da4cd=_0x186f('0x26');return db['UserProfileSection'][_0x186f('0x47')]({'where':{'name':_0x2da4cd,'userProfileId':_0xf6dce[_0x186f('0x4d')]},'raw':!![]})[_0x186f('0x23')](function(_0x35c737){if(_0x35c737&&_0x35c737['autoAssociation']===0x0){return db[_0x186f('0x27')][_0x186f('0x48')]({'name':_0x80907c['name'],'resourceId':_0x80907c['id'],'type':_0x35c737[_0x186f('0x29')],'sectionId':_0x35c737['id']},{})['then'](function(){return _0x284b2c;});}else{return _0x284b2c;}})[_0x186f('0x43')](function(_0x33484a){logger[_0x186f('0x28')](_0x186f('0x4e'),_0x33484a);throw _0x33484a;});}return _0x284b2c;})[_0x186f('0x23')](respondWithResult(_0x49782a,0xc9))[_0x186f('0x43')](handleError(_0x49782a,null));};exports[_0x186f('0x4f')]=function(_0xa80de6,_0x2b2444){if(_0xa80de6[_0x186f('0x49')]['id']){delete _0xa80de6[_0x186f('0x49')]['id'];}return db[_0x186f('0x2c')][_0x186f('0x47')]({'where':{'id':_0xa80de6['params']['id']}})[_0x186f('0x23')](handleEntityNotFound(_0x2b2444,null))[_0x186f('0x23')](saveUpdates(_0xa80de6['body'],null))[_0x186f('0x23')](respondWithResult(_0x2b2444,null))['catch'](handleError(_0x2b2444,null));};exports[_0x186f('0x24')]=function(_0x3fc7e4,_0x411158){return db[_0x186f('0x2c')][_0x186f('0x47')]({'where':{'id':_0x3fc7e4[_0x186f('0x45')]['id']}})['then'](handleEntityNotFound(_0x411158,null))[_0x186f('0x23')](removeEntity(_0x411158,null))[_0x186f('0x43')](handleError(_0x411158,null));};exports['describe']=function(_0x196e19,_0x36e614){return db[_0x186f('0x2c')][_0x186f('0x50')]()[_0x186f('0x23')](respondWithResult(_0x36e614,null))[_0x186f('0x43')](handleError(_0x36e614,null));};exports[_0x186f('0x51')]=function(_0x3a9116,_0x4e03c8,_0x2cc615){var _0xb728c3={'raw':!![],'where':{}},_0x41cde9={},_0x246d8e;return db[_0x186f('0x2c')][_0x186f('0x52')]({'where':{'id':_0x3a9116[_0x186f('0x45')]['id']}})[_0x186f('0x23')](handleEntityNotFound(_0x4e03c8,null))['then'](function(_0x1a3e55){if(_0x1a3e55){_0x246d8e=_0x1a3e55[_0x186f('0x25')]({'plain':!![]});_0x41cde9[_0x186f('0x30')]=_['keys'](db[_0x186f('0x53')][_0x186f('0x2d')]);_0x41cde9['query']=_[_0x186f('0x31')](_0x3a9116[_0x186f('0x32')]);_0x41cde9[_0x186f('0x3b')]=_[_0x186f('0x33')](_0x41cde9[_0x186f('0x30')],_0x41cde9[_0x186f('0x32')]);_0xb728c3['attributes']=_[_0x186f('0x33')](_0x41cde9[_0x186f('0x30')],qs[_0x186f('0x34')](_0x3a9116[_0x186f('0x32')]['fields']));_0xb728c3[_0x186f('0x35')]=_0xb728c3[_0x186f('0x35')][_0x186f('0x46')]?_0xb728c3[_0x186f('0x35')]:_0x41cde9[_0x186f('0x30')];if(!_0x3a9116[_0x186f('0x32')][_0x186f('0x54')](_0x186f('0x36'))){_0xb728c3[_0x186f('0x37')]=qs[_0x186f('0x37')](_0x3a9116[_0x186f('0x32')]['limit']);_0xb728c3[_0x186f('0x1e')]=qs[_0x186f('0x1e')](_0x3a9116['query'][_0x186f('0x1e')]);}_0xb728c3['order']=qs['sort'](_0x3a9116[_0x186f('0x32')][_0x186f('0x38')]);_0xb728c3[_0x186f('0x39')]=qs[_0x186f('0x3b')](_['pick'](_0x3a9116['query'],_0x41cde9[_0x186f('0x3b')]));_0xb728c3[_0x186f('0x39')][_0x186f('0x55')]=_0x1a3e55['id'];if(_0x3a9116[_0x186f('0x32')][_0x186f('0x3c')]){_0xb728c3[_0x186f('0x39')]=_['merge'](_0xb728c3[_0x186f('0x39')],{'$or':_[_0x186f('0x56')](_0xb728c3[_0x186f('0x35')],function(_0x424619){var _0x28420f={};_0x28420f[_0x424619]={'$like':'%'+_0x3a9116[_0x186f('0x32')]['filter']+'%'};return _0x28420f;})});}_0xb728c3=_[_0x186f('0x3e')]({},_0xb728c3,_0x3a9116['options']);return db[_0x186f('0x53')][_0x186f('0x42')](_0xb728c3);}})[_0x186f('0x23')](function(_0x579fae){if(_0x579fae){return db['User'][_0x186f('0x57')]({'where':{'id':_['map'](_0x579fae,_0x186f('0x58')),'role':'agent'},'attributes':['id',_0x186f('0x29'),'mailPause',_0x186f('0x59'),_0x186f('0x5a')]});}})['then'](function(_0xc66426){if(_0xc66426){return{'count':_0xc66426['count'],'rows':_[_0x186f('0x56')](_0xc66426[_0x186f('0x5b')],function(_0x38cbbc){return{'membername':_0x38cbbc['name'],'UserId':_0x38cbbc['id'],'queue_name':_0x246d8e[_0x186f('0x29')],'MailQueueId':_0x246d8e['id'],'interface':util[_0x186f('0x5c')]('%s/%s','SIP',_0x38cbbc[_0x186f('0x29')]),'penalty':0x0,'paused':_0x38cbbc[_0x186f('0x5d')],'createdAt':_0x38cbbc[_0x186f('0x5a')],'updatedAt':_0x38cbbc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x186f('0x23')](respondWithFilteredResult(_0x4e03c8,_0xb728c3))[_0x186f('0x43')](handleError(_0x4e03c8,null));};exports[_0x186f('0x5e')]=function(_0x5ab664,_0x2ac01f,_0x3ac508){var _0x102ae8={};var _0x1613a0={};var _0x31265a;var _0x29ea99;return db['MailQueue'][_0x186f('0x52')]({'where':{'id':_0x5ab664['params']['id']}})[_0x186f('0x23')](handleEntityNotFound(_0x2ac01f,null))[_0x186f('0x23')](function(_0x325d7f){if(_0x325d7f){_0x31265a=_0x325d7f;_0x1613a0[_0x186f('0x30')]=_[_0x186f('0x31')](db[_0x186f('0x5f')][_0x186f('0x2d')]);_0x1613a0[_0x186f('0x32')]=_[_0x186f('0x31')](_0x5ab664[_0x186f('0x32')]);_0x1613a0[_0x186f('0x3b')]=_[_0x186f('0x33')](_0x1613a0['model'],_0x1613a0['query']);_0x102ae8[_0x186f('0x35')]=_['intersection'](_0x1613a0[_0x186f('0x30')],qs[_0x186f('0x34')](_0x5ab664[_0x186f('0x32')][_0x186f('0x34')]));_0x102ae8[_0x186f('0x35')]=_0x102ae8[_0x186f('0x35')][_0x186f('0x46')]?_0x102ae8[_0x186f('0x35')]:_0x1613a0[_0x186f('0x30')];_0x102ae8[_0x186f('0x60')]=qs[_0x186f('0x38')](_0x5ab664['query']['sort']);_0x102ae8['where']=qs[_0x186f('0x3b')](_[_0x186f('0x3a')](_0x5ab664[_0x186f('0x32')],_0x1613a0['filters']));if(_0x5ab664[_0x186f('0x32')][_0x186f('0x3c')]){_0x102ae8[_0x186f('0x39')]=_['merge'](_0x102ae8['where'],{'$or':_[_0x186f('0x56')](_0x102ae8[_0x186f('0x35')],function(_0x34c05f){var _0x278a3e={};_0x278a3e[_0x34c05f]={'$like':'%'+_0x5ab664[_0x186f('0x32')][_0x186f('0x3c')]+'%'};return _0x278a3e;})});}_0x102ae8=_[_0x186f('0x3e')]({},_0x102ae8,_0x5ab664[_0x186f('0x3f')]);return _0x31265a[_0x186f('0x5e')](_0x102ae8);}})[_0x186f('0x23')](function(_0x1a5aba){if(_0x1a5aba){_0x29ea99=_0x1a5aba['length'];if(!_0x5ab664['query'][_0x186f('0x54')](_0x186f('0x36'))){_0x102ae8[_0x186f('0x37')]=qs[_0x186f('0x37')](_0x5ab664[_0x186f('0x32')]['limit']);_0x102ae8['offset']=qs[_0x186f('0x1e')](_0x5ab664[_0x186f('0x32')][_0x186f('0x1e')]);}return _0x31265a[_0x186f('0x5e')](_0x102ae8);}})[_0x186f('0x23')](function(_0x2c8a2b){if(_0x2c8a2b){return _0x2c8a2b?{'count':_0x29ea99,'rows':_0x2c8a2b}:null;}})[_0x186f('0x23')](respondWithResult(_0x2ac01f,null))[_0x186f('0x43')](handleError(_0x2ac01f,null));};exports[_0x186f('0x61')]=function(_0x4051b5,_0x29d94b,_0xc20ab){var _0x914293=_0x4051b5[_0x186f('0x49')][_0x186f('0x62')];return db[_0x186f('0x5f')][_0x186f('0x42')]({'where':{'id':_0x914293},'attributes':['id'],'include':[{'model':db[_0x186f('0x63')],'as':'Agents','attributes':['id',_0x186f('0x29'),'online',_0x186f('0x64'),'interface'],'raw':!![]}]})[_0x186f('0x23')](function(_0x3d08b9){if(_0x3d08b9){var _0x4fc31f=_[_0x186f('0x65')](_0x3d08b9,function(_0xe58b5c){var _0x321a8c=_0xe58b5c['get']({'plain':!![]});return _0x321a8c[_0x186f('0x66')];});return db[_0x186f('0x2c')][_0x186f('0x47')]({'where':{'id':_0x4051b5[_0x186f('0x45')]['id']}})[_0x186f('0x23')](function(_0x582236){return db[_0x186f('0x67')][_0x186f('0x68')](function(_0x5430b8){return _0x582236[_0x186f('0x61')](_0x914293,{'transaction':_0x5430b8})[_0x186f('0x23')](function(){return BPromise[_0x186f('0x69')](_0x4fc31f,function(_0x629a04){return db[_0x186f('0x53')]['findOrCreate']({'where':{'UserId':_0x629a04['id'],'MailQueueId':_0x4051b5[_0x186f('0x45')]['id']},'transaction':_0x5430b8});});})[_0x186f('0x23')](function(){_0x4fc31f[_0x186f('0x6a')](function(_0x49a142){socket['emit'](_0x186f('0x6b'),{'UserId':_0x49a142['id'],'MailQueueId':_0x582236['id']});});});});});}})[_0x186f('0x23')](respondWithStatusCode(_0x29d94b,null))[_0x186f('0x43')](handleError(_0x29d94b,null));};exports[_0x186f('0x6c')]=function(_0x46a426,_0x1fe8a2,_0x1d418a){return db[_0x186f('0x5f')][_0x186f('0x42')]({'where':{'id':_0x46a426[_0x186f('0x32')][_0x186f('0x62')]},'attributes':['id'],'include':[{'model':db[_0x186f('0x63')],'as':_0x186f('0x66'),'attributes':['id'],'raw':!![]}]})[_0x186f('0x23')](handleEntityNotFound(_0x1fe8a2,null))[_0x186f('0x23')](function(_0x409a5a){var _0xab38df=_[_0x186f('0x56')](_0x409a5a,'id');var _0x567281=[];var _0x383865=[];var _0xf1f6cf=squel['select']();_0xf1f6cf[_0x186f('0x6d')](_0x186f('0x6e'))[_0x186f('0x6f')](_0x186f('0x70'),'tq')[_0x186f('0x71')](_0x186f('0x72'),'ut',_0x186f('0x73'))['where'](_0x186f('0x74'),_0x46a426[_0x186f('0x45')]['id']);for(var _0x5103b6=0x0;_0x5103b6<_0x409a5a['length'];_0x5103b6+=0x1){let _0x55ea5c=_0x409a5a[_0x5103b6];for(var _0x15b2c4=0x0;_0x15b2c4<_0x55ea5c[_0x186f('0x66')][_0x186f('0x46')];_0x15b2c4+=0x1){let _0x355046=_0x55ea5c[_0x186f('0x66')][_0x15b2c4];var _0x5d99a5=_0xf1f6cf[_0x186f('0x75')]();_0x5d99a5[_0x186f('0x39')](_0x186f('0x76'),_0x355046['id']);_0x383865[_0x186f('0x77')](db[_0x186f('0x67')]['query'](_0x5d99a5[_0x186f('0x78')](),{'type':db['sequelize'][_0x186f('0x79')][_0x186f('0x7a')]})[_0x186f('0x23')](function(_0x1f93fb){if(_0x1f93fb[_0x186f('0x46')]===0x1){return _0x355046['id'];}else{var _0x56de97=_[_0x186f('0x7b')](_[_0x186f('0x56')](_0x1f93fb,_0x186f('0x7c')),function(_0x2144ba){return _[_0x186f('0x7d')](_0xab38df,_0x2144ba);});if(_0x56de97){return _0x355046['id'];}}}));}}return BPromise[_0x186f('0x7e')](_0x383865)[_0x186f('0x23')](function(_0x4d168b){_0x567281=_(_0x567281)[_0x186f('0x7f')](_0x4d168b)['compact']()[_0x186f('0x80')]();return db[_0x186f('0x2c')][_0x186f('0x47')]({'where':{'id':_0x46a426[_0x186f('0x45')]['id']}})[_0x186f('0x23')](function(_0x1ec7df){return db['sequelize']['transaction'](function(_0x1fd7cb){return _0x1ec7df[_0x186f('0x6c')](_0x46a426[_0x186f('0x32')]['ids'],{'transaction':_0x1fd7cb})['then'](function(){if(!_['isEmpty'](_0x567281)){return _0x1ec7df[_0x186f('0x81')](_0x567281,{'transaction':_0x1fd7cb});}})[_0x186f('0x23')](function(){_0x567281[_0x186f('0x6a')](function(_0xefcb0b){socket['emit'](_0x186f('0x82'),{'UserId':_0xefcb0b,'MailQueueId':_0x1ec7df['id']});});});});});});})[_0x186f('0x23')](respondWithStatusCode(_0x1fe8a2,null))[_0x186f('0x43')](handleError(_0x1fe8a2,null));};exports[_0x186f('0x83')]=function(_0x1f8067,_0x404f16,_0x286dcc){return db[_0x186f('0x2c')][_0x186f('0x47')]({'where':{'id':_0x1f8067[_0x186f('0x45')]['id']}})[_0x186f('0x23')](handleEntityNotFound(_0x404f16,null))[_0x186f('0x23')](function(_0xbe5372){if(_0xbe5372){return _0xbe5372['addAgents'](_0x1f8067['body'][_0x186f('0x62')],_[_0x186f('0x84')](_0x1f8067['body'],[_0x186f('0x62'),'id'])||{})[_0x186f('0x85')](function(_0x594430){for(var _0x35c6bd=0x0;_0x35c6bd<_0x1f8067['body'][_0x186f('0x62')][_0x186f('0x46')];_0x35c6bd+=0x1){socket[_0x186f('0x86')](_0x186f('0x6b'),{'UserId':_0x1f8067[_0x186f('0x49')][_0x186f('0x62')][_0x35c6bd],'MailQueueId':_0x1f8067['params']['id']});}return _0x594430;});}})[_0x186f('0x23')](respondWithResult(_0x404f16,null))['catch'](handleError(_0x404f16,null));};exports['removeAgents']=function(_0x3babfe,_0x16bd67,_0x8d768c){return db[_0x186f('0x2c')][_0x186f('0x47')]({'where':{'id':_0x3babfe[_0x186f('0x45')]['id']}})[_0x186f('0x23')](handleEntityNotFound(_0x16bd67,null))[_0x186f('0x23')](function(_0x1b8127){if(_0x1b8127){return _0x1b8127[_0x186f('0x81')](_0x3babfe[_0x186f('0x32')][_0x186f('0x62')])[_0x186f('0x23')](function(){if(_[_0x186f('0x87')](_0x3babfe[_0x186f('0x32')][_0x186f('0x62')])){for(var _0x345bf4=0x0;_0x345bf4<_0x3babfe[_0x186f('0x32')]['ids']['length'];_0x345bf4+=0x1){socket[_0x186f('0x86')](_0x186f('0x82'),{'UserId':Number(_0x3babfe['query'][_0x186f('0x62')][_0x345bf4]),'MailQueueId':Number(_0x3babfe[_0x186f('0x45')]['id'])});}}else{socket[_0x186f('0x86')](_0x186f('0x82'),{'UserId':Number(_0x3babfe['query'][_0x186f('0x62')]),'MailQueueId':Number(_0x3babfe[_0x186f('0x45')]['id'])});}});}})[_0x186f('0x23')](respondWithStatusCode(_0x16bd67,null))['catch'](handleError(_0x16bd67,null));};exports[_0x186f('0x88')]=function(_0x21f995,_0x636185,_0x4d2823){var _0x3dcd6c={};var _0x417b8a={};var _0x59533d;var _0x11161d;return db[_0x186f('0x2c')][_0x186f('0x52')]({'where':{'id':_0x21f995[_0x186f('0x45')]['id']}})['then'](handleEntityNotFound(_0x636185,null))[_0x186f('0x23')](function(_0x5dcc79){if(_0x5dcc79){_0x59533d=_0x5dcc79;_0x417b8a[_0x186f('0x30')]=_[_0x186f('0x31')](db['User'][_0x186f('0x2d')]);_0x417b8a[_0x186f('0x32')]=_['keys'](_0x21f995['query']);_0x417b8a['filters']=_['intersection'](_0x417b8a[_0x186f('0x30')],_0x417b8a['query']);_0x3dcd6c[_0x186f('0x35')]=_[_0x186f('0x33')](_0x417b8a['model'],qs['fields'](_0x21f995['query'][_0x186f('0x34')]));_0x3dcd6c[_0x186f('0x35')]=_0x3dcd6c[_0x186f('0x35')]['length']?_0x3dcd6c[_0x186f('0x35')]:_0x417b8a['model'];_0x3dcd6c[_0x186f('0x60')]=qs['sort'](_0x21f995[_0x186f('0x32')][_0x186f('0x38')]);_0x3dcd6c[_0x186f('0x39')]=qs[_0x186f('0x3b')](_[_0x186f('0x3a')](_0x21f995[_0x186f('0x32')],_0x417b8a['filters']));if(_0x21f995[_0x186f('0x32')][_0x186f('0x3c')]){_0x3dcd6c[_0x186f('0x39')]=_[_0x186f('0x3e')](_0x3dcd6c[_0x186f('0x39')],{'$or':_[_0x186f('0x56')](_0x3dcd6c[_0x186f('0x35')],function(_0x791ba5){var _0x44ec59={};_0x44ec59[_0x791ba5]={'$like':'%'+_0x21f995['query']['filter']+'%'};return _0x44ec59;})});}_0x3dcd6c=_[_0x186f('0x3e')]({},_0x3dcd6c,_0x21f995['options']);return _0x59533d[_0x186f('0x88')](_0x3dcd6c);}})[_0x186f('0x23')](function(_0x2bfbed){if(_0x2bfbed){_0x11161d=_0x2bfbed['length'];if(!_0x21f995[_0x186f('0x32')][_0x186f('0x54')](_0x186f('0x36'))){_0x3dcd6c['limit']=qs['limit'](_0x21f995[_0x186f('0x32')][_0x186f('0x37')]);_0x3dcd6c[_0x186f('0x1e')]=qs[_0x186f('0x1e')](_0x21f995[_0x186f('0x32')][_0x186f('0x1e')]);}return _0x59533d[_0x186f('0x88')](_0x3dcd6c);}})[_0x186f('0x23')](function(_0x5dd082){if(_0x5dd082){return _0x5dd082?{'count':_0x11161d,'rows':_0x5dd082}:null;}})[_0x186f('0x23')](respondWithResult(_0x636185,null))['catch'](handleError(_0x636185,null));}; \ No newline at end of file +var _0x24de=['bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','destroy','UserProfileResource','end','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','findAll','rows','catch','show','params','length','include','options','find','create','body','get','MailQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserMailQueue','hasOwnProperty','order','MailQueueId','findAndCountAll','UserId','agent','mailPause','createdAt','format','%s/%s','updatedAt','findOne','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','removeTeams','User','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','SELECT','TeamId','includes','all','union','compact','value','transaction','removeAgents','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x531b1e,_0x301978){var _0x1208b6=function(_0x3af74a){while(--_0x3af74a){_0x531b1e['push'](_0x531b1e['shift']());}};_0x1208b6(++_0x301978);}(_0x24de,0x19b));var _0xe24d=function(_0x6bb91e,_0x2491da){_0x6bb91e=_0x6bb91e-0x0;var _0x5bc507=_0x24de[_0x6bb91e];return _0x5bc507;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe24d('0x0'));var rimraf=require(_0xe24d('0x1'));var zipdir=require(_0xe24d('0x2'));var jsonpatch=require(_0xe24d('0x3'));var rp=require(_0xe24d('0x4'));var moment=require(_0xe24d('0x5'));var BPromise=require(_0xe24d('0x6'));var Mustache=require('mustache');var util=require(_0xe24d('0x7'));var path=require(_0xe24d('0x8'));var sox=require(_0xe24d('0x9'));var csv=require(_0xe24d('0xa'));var ejs=require(_0xe24d('0xb'));var fs=require('fs');var _=require(_0xe24d('0xc'));var squel=require(_0xe24d('0xd'));var crypto=require(_0xe24d('0xe'));var jsforce=require(_0xe24d('0xf'));var deskjs=require(_0xe24d('0x10'));var toCsv=require(_0xe24d('0xa'));var querystring=require(_0xe24d('0x11'));var Papa=require(_0xe24d('0x12'));var Redis=require(_0xe24d('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe24d('0x14'));var logger=require(_0xe24d('0x15'))(_0xe24d('0x16'));var utils=require(_0xe24d('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xe24d('0x18')](config[_0xe24d('0x19')],{'host':_0xe24d('0x1a'),'port':0x18eb});var socket=require(_0xe24d('0x1b'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xe24d('0x1c')](socket);function respondWithStatusCode(_0x5a322e,_0x24c097){_0x24c097=_0x24c097||0xcc;return function(_0x1a504e){if(_0x1a504e){return _0x5a322e[_0xe24d('0x1d')](_0x24c097);}return _0x5a322e[_0xe24d('0x1e')](_0x24c097)['end']();};}function respondWithResult(_0x1dc3ad,_0x425f05){_0x425f05=_0x425f05||0xc8;return function(_0x334d05){if(_0x334d05){return _0x1dc3ad[_0xe24d('0x1e')](_0x425f05)[_0xe24d('0x1f')](_0x334d05);}};}function respondWithFilteredResult(_0x1f89be,_0xf7eca6){return function(_0x2db94a){if(_0x2db94a){var _0x2b619e=_0x2db94a[_0xe24d('0x20')],_0x2b6a4c=_0xf7eca6[_0xe24d('0x21')],_0x32e27b=_0xf7eca6[_0xe24d('0x21')]+_0xf7eca6[_0xe24d('0x22')],_0x479b9c;if(_0x32e27b>=_0x2b619e){_0x32e27b=_0x2b619e;_0x479b9c=0xc8;}else{_0x479b9c=0xce;}_0x1f89be['status'](_0x479b9c);return _0x1f89be[_0xe24d('0x23')]('Content-Range',_0x2b6a4c+'-'+_0x32e27b+'/'+_0x2b619e)['json'](_0x2db94a);}return null;};}function patchUpdates(_0x1b6d59){return function(_0x3ec961){try{jsonpatch[_0xe24d('0x24')](_0x3ec961,_0x1b6d59,!![]);}catch(_0x1c7ab2){return BPromise['reject'](_0x1c7ab2);}return _0x3ec961[_0xe24d('0x25')]();};}function saveUpdates(_0x23c4d1,_0x4d9358){return function(_0x40eb38){if(_0x40eb38){return _0x40eb38[_0xe24d('0x26')](_0x23c4d1)[_0xe24d('0x27')](function(_0x4b4150){return _0x4b4150;});}return null;};}function removeEntity(_0x1fbcca,_0x53bbd3){return function(_0xa13226){if(_0xa13226){return _0xa13226[_0xe24d('0x28')]()[_0xe24d('0x27')](function(){var _0x474cc2=_0xa13226['get']({'plain':!![]});var _0x58e9f4='MailQueues';return db[_0xe24d('0x29')][_0xe24d('0x28')]({'where':{'type':_0x58e9f4,'resourceId':_0x474cc2['id']}})[_0xe24d('0x27')](function(){return _0xa13226;});})[_0xe24d('0x27')](function(){_0x1fbcca[_0xe24d('0x1e')](0xcc)[_0xe24d('0x2a')]();});}};}function handleEntityNotFound(_0x5cef6f,_0x5cc404){return function(_0x49a29e){if(!_0x49a29e){_0x5cef6f[_0xe24d('0x1d')](0x194);}return _0x49a29e;};}function handleError(_0x47837e,_0x136a83){_0x136a83=_0x136a83||0x1f4;return function(_0x4d1971){logger[_0xe24d('0x2b')](_0x4d1971[_0xe24d('0x2c')]);if(_0x4d1971[_0xe24d('0x2d')]){delete _0x4d1971['name'];}_0x47837e[_0xe24d('0x1e')](_0x136a83)[_0xe24d('0x2e')](_0x4d1971);};}exports[_0xe24d('0x2f')]=function(_0x3020ee,_0x210557){var _0x1875a2={},_0x400bca={},_0x525bfc={'count':0x0,'rows':[]};var _0x38f49f=_[_0xe24d('0x30')](db[_0xe24d('0x31')][_0xe24d('0x32')],function(_0x4de8ea){return{'name':_0x4de8ea[_0xe24d('0x33')],'type':_0x4de8ea['type'][_0xe24d('0x34')]};});_0x400bca[_0xe24d('0x35')]=_[_0xe24d('0x30')](_0x38f49f,_0xe24d('0x2d'));_0x400bca[_0xe24d('0x36')]=_[_0xe24d('0x37')](_0x3020ee[_0xe24d('0x36')]);_0x400bca[_0xe24d('0x38')]=_[_0xe24d('0x39')](_0x400bca[_0xe24d('0x35')],_0x400bca[_0xe24d('0x36')]);_0x1875a2[_0xe24d('0x3a')]=_[_0xe24d('0x39')](_0x400bca[_0xe24d('0x35')],qs[_0xe24d('0x3b')](_0x3020ee[_0xe24d('0x36')][_0xe24d('0x3b')]));_0x1875a2[_0xe24d('0x3a')]=_0x1875a2[_0xe24d('0x3a')]['length']?_0x1875a2['attributes']:_0x400bca[_0xe24d('0x35')];if(!_0x3020ee['query']['hasOwnProperty'](_0xe24d('0x3c'))){_0x1875a2[_0xe24d('0x22')]=qs[_0xe24d('0x22')](_0x3020ee[_0xe24d('0x36')]['limit']);_0x1875a2['offset']=qs[_0xe24d('0x21')](_0x3020ee['query'][_0xe24d('0x21')]);}_0x1875a2['order']=qs[_0xe24d('0x3d')](_0x3020ee[_0xe24d('0x36')][_0xe24d('0x3d')]);_0x1875a2[_0xe24d('0x3e')]=qs[_0xe24d('0x38')](_[_0xe24d('0x3f')](_0x3020ee[_0xe24d('0x36')],_0x400bca[_0xe24d('0x38')]),_0x38f49f);if(_0x3020ee[_0xe24d('0x36')]['filter']){_0x1875a2[_0xe24d('0x3e')]=_[_0xe24d('0x40')](_0x1875a2[_0xe24d('0x3e')],{'$or':_['map'](_0x38f49f,function(_0x5a8cda){if(_0x5a8cda[_0xe24d('0x41')]!==_0xe24d('0x42')){var _0x4d5824={};_0x4d5824[_0x5a8cda[_0xe24d('0x2d')]]={'$like':'%'+_0x3020ee[_0xe24d('0x36')][_0xe24d('0x43')]+'%'};return _0x4d5824;}})});}_0x1875a2=_[_0xe24d('0x40')]({},_0x1875a2,_0x3020ee['options']);var _0x4b9e60={'where':_0x1875a2['where']};return db['MailQueue'][_0xe24d('0x20')](_0x4b9e60)[_0xe24d('0x27')](function(_0x452295){_0x525bfc['count']=_0x452295;if(_0x3020ee[_0xe24d('0x36')]['includeAll']){_0x1875a2['include']=[{'all':!![]}];}return db[_0xe24d('0x31')][_0xe24d('0x44')](_0x1875a2);})[_0xe24d('0x27')](function(_0x1df405){_0x525bfc[_0xe24d('0x45')]=_0x1df405;return _0x525bfc;})[_0xe24d('0x27')](respondWithFilteredResult(_0x210557,_0x1875a2))[_0xe24d('0x46')](handleError(_0x210557,null));};exports[_0xe24d('0x47')]=function(_0x356303,_0x251455){var _0x6bbb72={'raw':!![],'where':{'id':_0x356303[_0xe24d('0x48')]['id']}},_0x26587b={};_0x26587b[_0xe24d('0x35')]=_['keys'](db[_0xe24d('0x31')][_0xe24d('0x32')]);_0x26587b[_0xe24d('0x36')]=_['keys'](_0x356303['query']);_0x26587b[_0xe24d('0x38')]=_[_0xe24d('0x39')](_0x26587b[_0xe24d('0x35')],_0x26587b[_0xe24d('0x36')]);_0x6bbb72[_0xe24d('0x3a')]=_[_0xe24d('0x39')](_0x26587b[_0xe24d('0x35')],qs['fields'](_0x356303[_0xe24d('0x36')][_0xe24d('0x3b')]));_0x6bbb72[_0xe24d('0x3a')]=_0x6bbb72[_0xe24d('0x3a')][_0xe24d('0x49')]?_0x6bbb72[_0xe24d('0x3a')]:_0x26587b[_0xe24d('0x35')];if(_0x356303[_0xe24d('0x36')]['includeAll']){_0x6bbb72[_0xe24d('0x4a')]=[{'all':!![]}];}_0x6bbb72=_[_0xe24d('0x40')]({},_0x6bbb72,_0x356303[_0xe24d('0x4b')]);return db[_0xe24d('0x31')][_0xe24d('0x4c')](_0x6bbb72)['then'](handleEntityNotFound(_0x251455,null))['then'](respondWithResult(_0x251455,null))[_0xe24d('0x46')](handleError(_0x251455,null));};exports['create']=function(_0x5c9da8,_0x37ddb4){return db['MailQueue'][_0xe24d('0x4d')](_0x5c9da8[_0xe24d('0x4e')],{})['then'](function(_0x2097ac){var _0x482e1f=_0x5c9da8['user'][_0xe24d('0x4f')]({'plain':!![]});if(!_0x482e1f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482e1f['role']==='user'){var _0x3da938=_0x2097ac['get']({'plain':!![]});var _0x19ac1b=_0xe24d('0x50');return db[_0xe24d('0x51')]['find']({'where':{'name':_0x19ac1b,'userProfileId':_0x482e1f[_0xe24d('0x52')]},'raw':!![]})['then'](function(_0x2c027f){if(_0x2c027f&&_0x2c027f[_0xe24d('0x53')]===0x0){return db[_0xe24d('0x29')]['create']({'name':_0x3da938[_0xe24d('0x2d')],'resourceId':_0x3da938['id'],'type':_0x2c027f['name'],'sectionId':_0x2c027f['id']},{})[_0xe24d('0x27')](function(){return _0x2097ac;});}else{return _0x2097ac;}})[_0xe24d('0x46')](function(_0x1a6419){logger['error'](_0xe24d('0x54'),_0x1a6419);throw _0x1a6419;});}return _0x2097ac;})[_0xe24d('0x27')](respondWithResult(_0x37ddb4,0xc9))[_0xe24d('0x46')](handleError(_0x37ddb4,null));};exports['update']=function(_0x586f0a,_0x21ad05){if(_0x586f0a[_0xe24d('0x4e')]['id']){delete _0x586f0a[_0xe24d('0x4e')]['id'];}return db['MailQueue'][_0xe24d('0x4c')]({'where':{'id':_0x586f0a[_0xe24d('0x48')]['id']}})['then'](handleEntityNotFound(_0x21ad05,null))['then'](saveUpdates(_0x586f0a['body'],null))[_0xe24d('0x27')](respondWithResult(_0x21ad05,null))[_0xe24d('0x46')](handleError(_0x21ad05,null));};exports[_0xe24d('0x28')]=function(_0x20172d,_0x3002e3){return db[_0xe24d('0x31')]['find']({'where':{'id':_0x20172d[_0xe24d('0x48')]['id']}})[_0xe24d('0x27')](handleEntityNotFound(_0x3002e3,null))[_0xe24d('0x27')](removeEntity(_0x3002e3,null))[_0xe24d('0x46')](handleError(_0x3002e3,null));};exports[_0xe24d('0x55')]=function(_0x4278c0,_0x3d1a02){return db[_0xe24d('0x31')][_0xe24d('0x55')]()[_0xe24d('0x27')](respondWithResult(_0x3d1a02,null))[_0xe24d('0x46')](handleError(_0x3d1a02,null));};exports['getMembers']=function(_0x332d68,_0x1c9e6f,_0x2c852c){var _0x1a879f={'raw':!![],'where':{}},_0x51073e={},_0x478fbf;return db[_0xe24d('0x31')]['findOne']({'where':{'id':_0x332d68[_0xe24d('0x48')]['id']}})[_0xe24d('0x27')](handleEntityNotFound(_0x1c9e6f,null))['then'](function(_0x998c94){if(_0x998c94){_0x478fbf=_0x998c94[_0xe24d('0x4f')]({'plain':!![]});_0x51073e[_0xe24d('0x35')]=_['keys'](db[_0xe24d('0x56')][_0xe24d('0x32')]);_0x51073e[_0xe24d('0x36')]=_['keys'](_0x332d68['query']);_0x51073e[_0xe24d('0x38')]=_['intersection'](_0x51073e[_0xe24d('0x35')],_0x51073e[_0xe24d('0x36')]);_0x1a879f['attributes']=_['intersection'](_0x51073e[_0xe24d('0x35')],qs[_0xe24d('0x3b')](_0x332d68[_0xe24d('0x36')][_0xe24d('0x3b')]));_0x1a879f[_0xe24d('0x3a')]=_0x1a879f[_0xe24d('0x3a')][_0xe24d('0x49')]?_0x1a879f[_0xe24d('0x3a')]:_0x51073e[_0xe24d('0x35')];if(!_0x332d68[_0xe24d('0x36')][_0xe24d('0x57')]('nolimit')){_0x1a879f['limit']=qs[_0xe24d('0x22')](_0x332d68[_0xe24d('0x36')][_0xe24d('0x22')]);_0x1a879f[_0xe24d('0x21')]=qs[_0xe24d('0x21')](_0x332d68[_0xe24d('0x36')][_0xe24d('0x21')]);}_0x1a879f[_0xe24d('0x58')]=qs['sort'](_0x332d68[_0xe24d('0x36')]['sort']);_0x1a879f[_0xe24d('0x3e')]=qs[_0xe24d('0x38')](_[_0xe24d('0x3f')](_0x332d68['query'],_0x51073e[_0xe24d('0x38')]));_0x1a879f['where'][_0xe24d('0x59')]=_0x998c94['id'];if(_0x332d68[_0xe24d('0x36')][_0xe24d('0x43')]){_0x1a879f[_0xe24d('0x3e')]=_[_0xe24d('0x40')](_0x1a879f[_0xe24d('0x3e')],{'$or':_[_0xe24d('0x30')](_0x1a879f[_0xe24d('0x3a')],function(_0x3ac016){var _0x7ddcd1={};_0x7ddcd1[_0x3ac016]={'$like':'%'+_0x332d68['query'][_0xe24d('0x43')]+'%'};return _0x7ddcd1;})});}_0x1a879f=_[_0xe24d('0x40')]({},_0x1a879f,_0x332d68[_0xe24d('0x4b')]);return db[_0xe24d('0x56')][_0xe24d('0x44')](_0x1a879f);}})[_0xe24d('0x27')](function(_0x5c7f37){if(_0x5c7f37){return db['User'][_0xe24d('0x5a')]({'where':{'id':_['map'](_0x5c7f37,_0xe24d('0x5b')),'role':_0xe24d('0x5c')},'attributes':['id',_0xe24d('0x2d'),_0xe24d('0x5d'),'updatedAt',_0xe24d('0x5e')]});}})[_0xe24d('0x27')](function(_0x104ba5){if(_0x104ba5){return{'count':_0x104ba5[_0xe24d('0x20')],'rows':_[_0xe24d('0x30')](_0x104ba5['rows'],function(_0x4fd28d){return{'membername':_0x4fd28d['name'],'UserId':_0x4fd28d['id'],'queue_name':_0x478fbf[_0xe24d('0x2d')],'MailQueueId':_0x478fbf['id'],'interface':util[_0xe24d('0x5f')](_0xe24d('0x60'),'SIP',_0x4fd28d[_0xe24d('0x2d')]),'penalty':0x0,'paused':_0x4fd28d[_0xe24d('0x5d')],'createdAt':_0x4fd28d[_0xe24d('0x5e')],'updatedAt':_0x4fd28d[_0xe24d('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe24d('0x27')](respondWithFilteredResult(_0x1c9e6f,_0x1a879f))['catch'](handleError(_0x1c9e6f,null));};exports['getTeams']=function(_0x30a351,_0x5bd5e9,_0x1d0c3b){var _0x11aa18={};var _0x178c6f={};var _0x42367e;var _0x5c67c0;return db[_0xe24d('0x31')][_0xe24d('0x62')]({'where':{'id':_0x30a351[_0xe24d('0x48')]['id']}})[_0xe24d('0x27')](handleEntityNotFound(_0x5bd5e9,null))[_0xe24d('0x27')](function(_0x25fa71){if(_0x25fa71){_0x42367e=_0x25fa71;_0x178c6f['model']=_[_0xe24d('0x37')](db[_0xe24d('0x63')][_0xe24d('0x32')]);_0x178c6f[_0xe24d('0x36')]=_[_0xe24d('0x37')](_0x30a351['query']);_0x178c6f[_0xe24d('0x38')]=_[_0xe24d('0x39')](_0x178c6f['model'],_0x178c6f[_0xe24d('0x36')]);_0x11aa18[_0xe24d('0x3a')]=_[_0xe24d('0x39')](_0x178c6f[_0xe24d('0x35')],qs[_0xe24d('0x3b')](_0x30a351[_0xe24d('0x36')][_0xe24d('0x3b')]));_0x11aa18[_0xe24d('0x3a')]=_0x11aa18[_0xe24d('0x3a')][_0xe24d('0x49')]?_0x11aa18[_0xe24d('0x3a')]:_0x178c6f[_0xe24d('0x35')];_0x11aa18['order']=qs[_0xe24d('0x3d')](_0x30a351[_0xe24d('0x36')][_0xe24d('0x3d')]);_0x11aa18[_0xe24d('0x3e')]=qs[_0xe24d('0x38')](_[_0xe24d('0x3f')](_0x30a351[_0xe24d('0x36')],_0x178c6f[_0xe24d('0x38')]));if(_0x30a351[_0xe24d('0x36')][_0xe24d('0x43')]){_0x11aa18['where']=_[_0xe24d('0x40')](_0x11aa18[_0xe24d('0x3e')],{'$or':_['map'](_0x11aa18[_0xe24d('0x3a')],function(_0x4e9c0c){var _0x1592f1={};_0x1592f1[_0x4e9c0c]={'$like':'%'+_0x30a351['query'][_0xe24d('0x43')]+'%'};return _0x1592f1;})});}_0x11aa18=_[_0xe24d('0x40')]({},_0x11aa18,_0x30a351[_0xe24d('0x4b')]);return _0x42367e['getTeams'](_0x11aa18);}})[_0xe24d('0x27')](function(_0x40221d){if(_0x40221d){_0x5c67c0=_0x40221d[_0xe24d('0x49')];if(!_0x30a351[_0xe24d('0x36')][_0xe24d('0x57')]('nolimit')){_0x11aa18['limit']=qs[_0xe24d('0x22')](_0x30a351[_0xe24d('0x36')][_0xe24d('0x22')]);_0x11aa18[_0xe24d('0x21')]=qs[_0xe24d('0x21')](_0x30a351[_0xe24d('0x36')]['offset']);}return _0x42367e[_0xe24d('0x64')](_0x11aa18);}})['then'](function(_0x2917d1){if(_0x2917d1){return _0x2917d1?{'count':_0x5c67c0,'rows':_0x2917d1}:null;}})[_0xe24d('0x27')](respondWithResult(_0x5bd5e9,null))[_0xe24d('0x46')](handleError(_0x5bd5e9,null));};exports[_0xe24d('0x65')]=function(_0x315224,_0x2eb2e2,_0x1dde32){var _0x104782=_0x315224[_0xe24d('0x4e')][_0xe24d('0x66')];return db['Team'][_0xe24d('0x44')]({'where':{'id':_0x104782},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe24d('0x67'),'attributes':['id',_0xe24d('0x2d'),_0xe24d('0x68'),_0xe24d('0x69'),_0xe24d('0x6a')],'raw':!![]}]})[_0xe24d('0x27')](function(_0x11e3a0){if(_0x11e3a0){var _0x476bf8=_[_0xe24d('0x6b')](_0x11e3a0,function(_0x4e75ff){var _0x3b1795=_0x4e75ff[_0xe24d('0x4f')]({'plain':!![]});return _0x3b1795[_0xe24d('0x67')];});return db[_0xe24d('0x31')][_0xe24d('0x4c')]({'where':{'id':_0x315224[_0xe24d('0x48')]['id']}})[_0xe24d('0x27')](function(_0x4b9b44){return db['sequelize']['transaction'](function(_0x151850){return _0x4b9b44[_0xe24d('0x65')](_0x104782,{'transaction':_0x151850})[_0xe24d('0x27')](function(){return BPromise['each'](_0x476bf8,function(_0x18e417){return db[_0xe24d('0x56')][_0xe24d('0x6c')]({'where':{'UserId':_0x18e417['id'],'MailQueueId':_0x315224[_0xe24d('0x48')]['id']},'transaction':_0x151850});});})[_0xe24d('0x27')](function(){_0x476bf8[_0xe24d('0x6d')](function(_0x150c46){socket[_0xe24d('0x6e')]('userMailQueue:save',{'UserId':_0x150c46['id'],'MailQueueId':_0x4b9b44['id']});});});});});}})['then'](respondWithStatusCode(_0x2eb2e2,null))[_0xe24d('0x46')](handleError(_0x2eb2e2,null));};exports[_0xe24d('0x6f')]=function(_0x4b5535,_0x553adc,_0x267d9b){return db['Team'][_0xe24d('0x44')]({'where':{'id':_0x4b5535[_0xe24d('0x36')][_0xe24d('0x66')]},'attributes':['id'],'include':[{'model':db[_0xe24d('0x70')],'as':_0xe24d('0x67'),'attributes':['id'],'raw':!![]}]})[_0xe24d('0x27')](handleEntityNotFound(_0x553adc,null))['then'](function(_0x50c557){var _0x900248=_[_0xe24d('0x30')](_0x50c557,'id');var _0x25eeb2=[];var _0x159f07=[];var _0x2b5628=squel[_0xe24d('0x71')]();_0x2b5628[_0xe24d('0x72')](_0xe24d('0x73'))[_0xe24d('0x74')]('team_has_mail_queues','tq')[_0xe24d('0x75')]('user_has_teams','ut',_0xe24d('0x76'))[_0xe24d('0x3e')](_0xe24d('0x77'),_0x4b5535[_0xe24d('0x48')]['id']);for(var _0x49de90=0x0;_0x49de90<_0x50c557[_0xe24d('0x49')];_0x49de90+=0x1){let _0x21c15b=_0x50c557[_0x49de90];for(var _0x275bc9=0x0;_0x275bc9<_0x21c15b[_0xe24d('0x67')][_0xe24d('0x49')];_0x275bc9+=0x1){let _0x9fd0bf=_0x21c15b[_0xe24d('0x67')][_0x275bc9];var _0x34cac7=_0x2b5628[_0xe24d('0x78')]();_0x34cac7[_0xe24d('0x3e')](_0xe24d('0x79'),_0x9fd0bf['id']);_0x159f07[_0xe24d('0x7a')](db[_0xe24d('0x7b')][_0xe24d('0x36')](_0x34cac7['toString'](),{'type':db[_0xe24d('0x7b')]['QueryTypes'][_0xe24d('0x7c')]})['then'](function(_0x2cd673){if(_0x2cd673[_0xe24d('0x49')]===0x1){return _0x9fd0bf['id'];}else{var _0x137150=_['every'](_[_0xe24d('0x30')](_0x2cd673,_0xe24d('0x7d')),function(_0x37e70d){return _[_0xe24d('0x7e')](_0x900248,_0x37e70d);});if(_0x137150){return _0x9fd0bf['id'];}}}));}}return BPromise[_0xe24d('0x7f')](_0x159f07)[_0xe24d('0x27')](function(_0x39d0d5){_0x25eeb2=_(_0x25eeb2)[_0xe24d('0x80')](_0x39d0d5)[_0xe24d('0x81')]()[_0xe24d('0x82')]();return db[_0xe24d('0x31')][_0xe24d('0x4c')]({'where':{'id':_0x4b5535['params']['id']}})['then'](function(_0x327a4e){return db['sequelize'][_0xe24d('0x83')](function(_0x3156fb){return _0x327a4e[_0xe24d('0x6f')](_0x4b5535[_0xe24d('0x36')][_0xe24d('0x66')],{'transaction':_0x3156fb})[_0xe24d('0x27')](function(){if(!_['isEmpty'](_0x25eeb2)){return _0x327a4e[_0xe24d('0x84')](_0x25eeb2,{'transaction':_0x3156fb});}})[_0xe24d('0x27')](function(){_0x25eeb2[_0xe24d('0x6d')](function(_0x55adb7){socket['emit'](_0xe24d('0x85'),{'UserId':_0x55adb7,'MailQueueId':_0x327a4e['id']});});});});});});})[_0xe24d('0x27')](respondWithStatusCode(_0x553adc,null))[_0xe24d('0x46')](handleError(_0x553adc,null));};exports[_0xe24d('0x86')]=function(_0x302098,_0x35904e,_0x1ca22e){return db[_0xe24d('0x31')]['find']({'where':{'id':_0x302098[_0xe24d('0x48')]['id']}})['then'](handleEntityNotFound(_0x35904e,null))[_0xe24d('0x27')](function(_0x3b7175){if(_0x3b7175){return _0x3b7175[_0xe24d('0x86')](_0x302098[_0xe24d('0x4e')]['ids'],_[_0xe24d('0x87')](_0x302098[_0xe24d('0x4e')],[_0xe24d('0x66'),'id'])||{})[_0xe24d('0x88')](function(_0xf40f2c){for(var _0x1c955d=0x0;_0x1c955d<_0x302098[_0xe24d('0x4e')][_0xe24d('0x66')][_0xe24d('0x49')];_0x1c955d+=0x1){socket[_0xe24d('0x6e')](_0xe24d('0x89'),{'UserId':_0x302098[_0xe24d('0x4e')][_0xe24d('0x66')][_0x1c955d],'MailQueueId':_0x302098['params']['id']});}return _0xf40f2c;});}})[_0xe24d('0x27')](respondWithResult(_0x35904e,null))['catch'](handleError(_0x35904e,null));};exports[_0xe24d('0x84')]=function(_0x2f941f,_0x3a4270,_0x2e400f){return db[_0xe24d('0x31')]['find']({'where':{'id':_0x2f941f[_0xe24d('0x48')]['id']}})[_0xe24d('0x27')](handleEntityNotFound(_0x3a4270,null))[_0xe24d('0x27')](function(_0x1ebd27){if(_0x1ebd27){return _0x1ebd27['removeAgents'](_0x2f941f[_0xe24d('0x36')]['ids'])[_0xe24d('0x27')](function(){if(_['isArray'](_0x2f941f[_0xe24d('0x36')]['ids'])){for(var _0x269f57=0x0;_0x269f57<_0x2f941f['query'][_0xe24d('0x66')][_0xe24d('0x49')];_0x269f57+=0x1){socket['emit'](_0xe24d('0x85'),{'UserId':Number(_0x2f941f[_0xe24d('0x36')][_0xe24d('0x66')][_0x269f57]),'MailQueueId':Number(_0x2f941f[_0xe24d('0x48')]['id'])});}}else{socket[_0xe24d('0x6e')](_0xe24d('0x85'),{'UserId':Number(_0x2f941f['query'][_0xe24d('0x66')]),'MailQueueId':Number(_0x2f941f[_0xe24d('0x48')]['id'])});}});}})[_0xe24d('0x27')](respondWithStatusCode(_0x3a4270,null))[_0xe24d('0x46')](handleError(_0x3a4270,null));};exports[_0xe24d('0x8a')]=function(_0x6f0320,_0x8fdbe2,_0xf8d604){var _0x3d5c73={};var _0x3508a5={};var _0x2059d9;var _0x4576a0;return db[_0xe24d('0x31')][_0xe24d('0x62')]({'where':{'id':_0x6f0320[_0xe24d('0x48')]['id']}})[_0xe24d('0x27')](handleEntityNotFound(_0x8fdbe2,null))[_0xe24d('0x27')](function(_0x3bfeaa){if(_0x3bfeaa){_0x2059d9=_0x3bfeaa;_0x3508a5[_0xe24d('0x35')]=_[_0xe24d('0x37')](db['User'][_0xe24d('0x32')]);_0x3508a5[_0xe24d('0x36')]=_[_0xe24d('0x37')](_0x6f0320[_0xe24d('0x36')]);_0x3508a5['filters']=_[_0xe24d('0x39')](_0x3508a5[_0xe24d('0x35')],_0x3508a5[_0xe24d('0x36')]);_0x3d5c73[_0xe24d('0x3a')]=_[_0xe24d('0x39')](_0x3508a5[_0xe24d('0x35')],qs['fields'](_0x6f0320['query']['fields']));_0x3d5c73[_0xe24d('0x3a')]=_0x3d5c73['attributes'][_0xe24d('0x49')]?_0x3d5c73['attributes']:_0x3508a5['model'];_0x3d5c73[_0xe24d('0x58')]=qs[_0xe24d('0x3d')](_0x6f0320[_0xe24d('0x36')][_0xe24d('0x3d')]);_0x3d5c73[_0xe24d('0x3e')]=qs[_0xe24d('0x38')](_['pick'](_0x6f0320['query'],_0x3508a5[_0xe24d('0x38')]));if(_0x6f0320[_0xe24d('0x36')][_0xe24d('0x43')]){_0x3d5c73[_0xe24d('0x3e')]=_[_0xe24d('0x40')](_0x3d5c73[_0xe24d('0x3e')],{'$or':_[_0xe24d('0x30')](_0x3d5c73[_0xe24d('0x3a')],function(_0x60117){var _0x5da1db={};_0x5da1db[_0x60117]={'$like':'%'+_0x6f0320[_0xe24d('0x36')][_0xe24d('0x43')]+'%'};return _0x5da1db;})});}_0x3d5c73=_[_0xe24d('0x40')]({},_0x3d5c73,_0x6f0320[_0xe24d('0x4b')]);return _0x2059d9[_0xe24d('0x8a')](_0x3d5c73);}})[_0xe24d('0x27')](function(_0x5dd00a){if(_0x5dd00a){_0x4576a0=_0x5dd00a[_0xe24d('0x49')];if(!_0x6f0320[_0xe24d('0x36')][_0xe24d('0x57')](_0xe24d('0x3c'))){_0x3d5c73['limit']=qs[_0xe24d('0x22')](_0x6f0320[_0xe24d('0x36')][_0xe24d('0x22')]);_0x3d5c73[_0xe24d('0x21')]=qs[_0xe24d('0x21')](_0x6f0320[_0xe24d('0x36')][_0xe24d('0x21')]);}return _0x2059d9[_0xe24d('0x8a')](_0x3d5c73);}})[_0xe24d('0x27')](function(_0x2c7985){if(_0x2c7985){return _0x2c7985?{'count':_0x4576a0,'rows':_0x2c7985}:null;}})[_0xe24d('0x27')](respondWithResult(_0x8fdbe2,null))[_0xe24d('0x46')](handleError(_0x8fdbe2,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 6e0ad57..7f0674c 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 _0x1b97=['emit','hasOwnProperty','exports','events','../../mysqldb','MailQueue','setMaxListeners','update','remove'];(function(_0xd6035b,_0x526e93){var _0x53eca2=function(_0x10cd50){while(--_0x10cd50){_0xd6035b['push'](_0xd6035b['shift']());}};_0x53eca2(++_0x526e93);}(_0x1b97,0x81));var _0x71b9=function(_0xa2e58a,_0x28e38f){_0xa2e58a=_0xa2e58a-0x0;var _0x25dadc=_0x1b97[_0xa2e58a];return _0x25dadc;};'use strict';var EventEmitter=require(_0x71b9('0x0'));var MailQueue=require(_0x71b9('0x1'))['db'][_0x71b9('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x71b9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x71b9('0x4'),'afterDestroy':_0x71b9('0x5')};function emitEvent(_0x2164a6){return function(_0x5705d0,_0x38c656,_0x3d01de){MailQueueEvents[_0x71b9('0x6')](_0x2164a6+':'+_0x5705d0['id'],_0x5705d0);MailQueueEvents[_0x71b9('0x6')](_0x2164a6,_0x5705d0);_0x3d01de(null);};}for(var e in events){if(events[_0x71b9('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x71b9('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x575a=['hasOwnProperty','hook','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit'];(function(_0x32904d,_0x28b13c){var _0x252bd9=function(_0x39276f){while(--_0x39276f){_0x32904d['push'](_0x32904d['shift']());}};_0x252bd9(++_0x28b13c);}(_0x575a,0xfc));var _0xa575=function(_0x401a4d,_0x4bb835){_0x401a4d=_0x401a4d-0x0;var _0x1faaff=_0x575a[_0x401a4d];return _0x1faaff;};'use strict';var EventEmitter=require(_0xa575('0x0'));var MailQueue=require(_0xa575('0x1'))['db'][_0xa575('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xa575('0x3')](0x0);var events={'afterCreate':_0xa575('0x4'),'afterUpdate':_0xa575('0x5'),'afterDestroy':_0xa575('0x6')};function emitEvent(_0x3da3b5){return function(_0x5df59a,_0x2b9da5,_0x49d867){MailQueueEvents[_0xa575('0x7')](_0x3da3b5+':'+_0x5df59a['id'],_0x5df59a);MailQueueEvents[_0xa575('0x7')](_0x3da3b5,_0x5df59a);_0x49d867(null);};}for(var e in events){if(events[_0xa575('0x8')](e)){var event=events[e];MailQueue[_0xa575('0x9')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 463bb1c..ce11340 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 _0xdabf=['moment','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api'];(function(_0x27be66,_0x487933){var _0x1031d2=function(_0x5267f1){while(--_0x5267f1){_0x27be66['push'](_0x27be66['shift']());}};_0x1031d2(++_0x487933);}(_0xdabf,0x106));var _0xfdab=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xdabf[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0xfdab('0x0'));var util=require(_0xfdab('0x1'));var logger=require(_0xfdab('0x2'))(_0xfdab('0x3'));var moment=require(_0xfdab('0x4'));var BPromise=require('bluebird');var rp=require(_0xfdab('0x5'));var fs=require('fs');var path=require(_0xfdab('0x6'));var rimraf=require(_0xfdab('0x7'));var config=require(_0xfdab('0x8'));var attributes=require(_0xfdab('0x9'));module[_0xfdab('0xa')]=function(_0x301604,_0x1c355f){return _0x301604[_0xfdab('0xb')](_0xfdab('0xc'),attributes,{'tableName':_0xfdab('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f34=['../../config/environment','./mailQueue.attributes','exports','MailQueue','api','moment','bluebird','request-promise','path'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0x3f34,0x136));var _0x43f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f34[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x43f3('0x0'));var moment=require(_0x43f3('0x1'));var BPromise=require(_0x43f3('0x2'));var rp=require(_0x43f3('0x3'));var fs=require('fs');var path=require(_0x43f3('0x4'));var rimraf=require('rimraf');var config=require(_0x43f3('0x5'));var attributes=require(_0x43f3('0x6'));module[_0x43f3('0x7')]=function(_0x21702a,_0xb157a1){return _0x21702a['define'](_0x43f3('0x8'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 06d0b50..a6fd512 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 _0x4d57=['MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','limit','map','include','model','attributes','info','ShowMailQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','socket.io-emitter','./mailQueue.socket','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2bda14,_0x4fab1b){var _0xb5dd49=function(_0x1da71e){while(--_0x1da71e){_0x2bda14['push'](_0x2bda14['shift']());}};_0xb5dd49(++_0x4fab1b);}(_0x4d57,0x82));var _0x74d5=function(_0x369565,_0x123f75){_0x369565=_0x369565-0x0;var _0x3cfe83=_0x4d57[_0x369565];return _0x3cfe83;};'use strict';var _=require(_0x74d5('0x0'));var util=require(_0x74d5('0x1'));var moment=require(_0x74d5('0x2'));var BPromise=require('bluebird');var rs=require(_0x74d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74d5('0x4'))['db'];var utils=require(_0x74d5('0x5'));var logger=require(_0x74d5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x74d5('0x7'));var client=jayson[_0x74d5('0x8')][_0x74d5('0x9')]({'port':0x232a});config['redis']=_[_0x74d5('0xa')](config[_0x74d5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x74d5('0xc'))(new Redis(config[_0x74d5('0xb')]));require(_0x74d5('0xd'))['register'](socket);function respondWithRpcPromise(_0x4ab203,_0x212d90,_0x2f728c){return new BPromise(function(_0x35326b,_0x233dfc){return client['request'](_0x4ab203,_0x2f728c)[_0x74d5('0xe')](function(_0x1c1d55){logger['info'](_0x74d5('0xf'),_0x212d90,_0x74d5('0x10'));logger[_0x74d5('0x11')](_0x74d5('0x12'),_0x212d90,_0x74d5('0x10'),JSON[_0x74d5('0x13')](_0x1c1d55));if(_0x1c1d55[_0x74d5('0x14')]){if(_0x1c1d55[_0x74d5('0x14')][_0x74d5('0x15')]===0x1f4){logger[_0x74d5('0x14')](_0x74d5('0xf'),_0x212d90,_0x1c1d55[_0x74d5('0x14')][_0x74d5('0x16')]);return _0x233dfc(_0x1c1d55[_0x74d5('0x14')][_0x74d5('0x16')]);}logger[_0x74d5('0x14')](_0x74d5('0xf'),_0x212d90,_0x1c1d55[_0x74d5('0x14')][_0x74d5('0x16')]);return _0x35326b(_0x1c1d55[_0x74d5('0x14')][_0x74d5('0x16')]);}else{logger['info'](_0x74d5('0xf'),_0x212d90,'request\x20sent');_0x35326b(_0x1c1d55['result'][_0x74d5('0x16')]);}})[_0x74d5('0x17')](function(_0x3ee9b2){logger['error'](_0x74d5('0xf'),_0x212d90,_0x3ee9b2);_0x233dfc(_0x3ee9b2);});});}exports[_0x74d5('0x18')]=function(_0x3ff3d7){var _0x2db0c8=this;return new Promise(function(_0x235deb,_0x1114cb){return db[_0x74d5('0x19')][_0x74d5('0x1a')]({'raw':_0x3ff3d7[_0x74d5('0x1b')]?_0x3ff3d7[_0x74d5('0x1b')][_0x74d5('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ff3d7['options']?_0x3ff3d7['options'][_0x74d5('0x1d')]||null:null,'attributes':_0x3ff3d7['options']?_0x3ff3d7[_0x74d5('0x1b')]['attributes']||null:null,'limit':_0x3ff3d7[_0x74d5('0x1b')]?_0x3ff3d7[_0x74d5('0x1b')][_0x74d5('0x1e')]||null:null,'include':_0x3ff3d7['options']?_0x3ff3d7[_0x74d5('0x1b')]['include']?_[_0x74d5('0x1f')](_0x3ff3d7[_0x74d5('0x1b')][_0x74d5('0x20')],function(_0x774478){return{'model':db[_0x774478[_0x74d5('0x21')]],'as':_0x774478['as'],'attributes':_0x774478[_0x74d5('0x22')],'include':_0x774478['include']?_['map'](_0x774478[_0x74d5('0x20')],function(_0x311396){return{'model':db[_0x311396[_0x74d5('0x21')]],'as':_0x311396['as'],'attributes':_0x311396[_0x74d5('0x22')],'include':_0x311396[_0x74d5('0x20')]?_[_0x74d5('0x1f')](_0x311396[_0x74d5('0x20')],function(_0x501145){return{'model':db[_0x501145[_0x74d5('0x21')]],'as':_0x501145['as'],'attributes':_0x501145[_0x74d5('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f38ef){logger[_0x74d5('0x23')](_0x74d5('0x18'),_0x3ff3d7);logger[_0x74d5('0x11')](_0x74d5('0x18'),_0x3ff3d7,JSON[_0x74d5('0x13')](_0x2f38ef));_0x235deb(_0x2f38ef);})[_0x74d5('0x17')](function(_0x504a64){logger[_0x74d5('0x14')](_0x74d5('0x18'),_0x504a64['message'],_0x3ff3d7);_0x1114cb(_0x2db0c8[_0x74d5('0x14')](0x1f4,_0x504a64[_0x74d5('0x16')]));});});};exports[_0x74d5('0x24')]=function(_0x459099){var _0x4ffad0=this;return new Promise(function(_0x3f4dbd,_0x2dfd51){return db[_0x74d5('0x19')]['find']({'raw':_0x459099[_0x74d5('0x1b')]?_0x459099[_0x74d5('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x459099[_0x74d5('0x1b')]?_0x459099[_0x74d5('0x1b')]['where']||null:null,'attributes':_0x459099[_0x74d5('0x1b')]?_0x459099['options'][_0x74d5('0x22')]||null:null,'include':_0x459099[_0x74d5('0x1b')]?_0x459099[_0x74d5('0x1b')][_0x74d5('0x20')]?_['map'](_0x459099['options']['include'],function(_0x390fc5){return{'model':db[_0x390fc5['model']],'as':_0x390fc5['as'],'attributes':_0x390fc5['attributes'],'include':_0x390fc5[_0x74d5('0x20')]?_[_0x74d5('0x1f')](_0x390fc5[_0x74d5('0x20')],function(_0x38a894){return{'model':db[_0x38a894[_0x74d5('0x21')]],'as':_0x38a894['as'],'attributes':_0x38a894[_0x74d5('0x22')],'include':_0x38a894['include']?_[_0x74d5('0x1f')](_0x38a894[_0x74d5('0x20')],function(_0x595285){return{'model':db[_0x595285[_0x74d5('0x21')]],'as':_0x595285['as'],'attributes':_0x595285[_0x74d5('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3725b8){logger[_0x74d5('0x23')](_0x74d5('0x24'),_0x459099);logger[_0x74d5('0x11')]('ShowMailQueue',_0x459099,JSON[_0x74d5('0x13')](_0x3725b8));_0x3f4dbd(_0x3725b8);})[_0x74d5('0x17')](function(_0xb5b163){logger[_0x74d5('0x14')](_0x74d5('0x24'),_0xb5b163[_0x74d5('0x16')],_0x459099);_0x2dfd51(_0x4ffad0['error'](0x1f4,_0xb5b163['message']));});});}; \ No newline at end of file +var _0x63e6=['attributes','include','map','model','ShowMailQueue','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./mailQueue.socket','request','then','info','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x63e6,0xf0));var _0x663e=function(_0x1cb22e,_0x4656c7){_0x1cb22e=_0x1cb22e-0x0;var _0x360094=_0x63e6[_0x1cb22e];return _0x360094;};'use strict';var _=require(_0x663e('0x0'));var util=require(_0x663e('0x1'));var moment=require(_0x663e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x663e('0x3'));var db=require(_0x663e('0x4'))['db'];var utils=require(_0x663e('0x5'));var logger=require(_0x663e('0x6'))(_0x663e('0x7'));var config=require(_0x663e('0x8'));var jayson=require(_0x663e('0x9'));var client=jayson[_0x663e('0xa')]['http']({'port':0x232a});config['redis']=_[_0x663e('0xb')](config[_0x663e('0xc')],{'host':_0x663e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x663e('0xe'))['register'](socket);function respondWithRpcPromise(_0x31aef8,_0x5257ff,_0x276ead){return new BPromise(function(_0x17ad18,_0x3acfac){return client[_0x663e('0xf')](_0x31aef8,_0x276ead)[_0x663e('0x10')](function(_0x37c76a){logger[_0x663e('0x11')]('MailQueue,\x20%s,\x20%s',_0x5257ff,'request\x20sent');logger[_0x663e('0x12')](_0x663e('0x13'),_0x5257ff,_0x663e('0x14'),JSON[_0x663e('0x15')](_0x37c76a));if(_0x37c76a[_0x663e('0x16')]){if(_0x37c76a[_0x663e('0x16')]['code']===0x1f4){logger[_0x663e('0x16')](_0x663e('0x17'),_0x5257ff,_0x37c76a[_0x663e('0x16')][_0x663e('0x18')]);return _0x3acfac(_0x37c76a[_0x663e('0x16')][_0x663e('0x18')]);}logger[_0x663e('0x16')]('MailQueue,\x20%s,\x20%s',_0x5257ff,_0x37c76a[_0x663e('0x16')][_0x663e('0x18')]);return _0x17ad18(_0x37c76a[_0x663e('0x16')][_0x663e('0x18')]);}else{logger[_0x663e('0x11')](_0x663e('0x17'),_0x5257ff,_0x663e('0x14'));_0x17ad18(_0x37c76a[_0x663e('0x19')][_0x663e('0x18')]);}})[_0x663e('0x1a')](function(_0x38186e){logger['error'](_0x663e('0x17'),_0x5257ff,_0x38186e);_0x3acfac(_0x38186e);});});}exports[_0x663e('0x1b')]=function(_0x2d02f4){var _0x41f1b1=this;return new Promise(function(_0x3c0243,_0x5d7c88){return db[_0x663e('0x1c')][_0x663e('0x1d')]({'raw':_0x2d02f4[_0x663e('0x1e')]?_0x2d02f4[_0x663e('0x1e')][_0x663e('0x1f')]===undefined?!![]:![]:!![],'where':_0x2d02f4['options']?_0x2d02f4[_0x663e('0x1e')][_0x663e('0x20')]||null:null,'attributes':_0x2d02f4[_0x663e('0x1e')]?_0x2d02f4[_0x663e('0x1e')][_0x663e('0x21')]||null:null,'limit':_0x2d02f4[_0x663e('0x1e')]?_0x2d02f4[_0x663e('0x1e')]['limit']||null:null,'include':_0x2d02f4[_0x663e('0x1e')]?_0x2d02f4['options'][_0x663e('0x22')]?_[_0x663e('0x23')](_0x2d02f4[_0x663e('0x1e')][_0x663e('0x22')],function(_0x373e2f){return{'model':db[_0x373e2f['model']],'as':_0x373e2f['as'],'attributes':_0x373e2f['attributes'],'include':_0x373e2f[_0x663e('0x22')]?_['map'](_0x373e2f[_0x663e('0x22')],function(_0x57a4bc){return{'model':db[_0x57a4bc[_0x663e('0x24')]],'as':_0x57a4bc['as'],'attributes':_0x57a4bc[_0x663e('0x21')],'include':_0x57a4bc[_0x663e('0x22')]?_[_0x663e('0x23')](_0x57a4bc[_0x663e('0x22')],function(_0x15152d){return{'model':db[_0x15152d['model']],'as':_0x15152d['as'],'attributes':_0x15152d[_0x663e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x663e('0x10')](function(_0x36027a){logger[_0x663e('0x11')]('GetMailQueue',_0x2d02f4);logger[_0x663e('0x12')](_0x663e('0x1b'),_0x2d02f4,JSON[_0x663e('0x15')](_0x36027a));_0x3c0243(_0x36027a);})[_0x663e('0x1a')](function(_0x1aaccf){logger[_0x663e('0x16')](_0x663e('0x1b'),_0x1aaccf['message'],_0x2d02f4);_0x5d7c88(_0x41f1b1[_0x663e('0x16')](0x1f4,_0x1aaccf[_0x663e('0x18')]));});});};exports[_0x663e('0x25')]=function(_0x3143b4){var _0x427e1d=this;return new Promise(function(_0x5e7594,_0x276606){return db['MailQueue'][_0x663e('0x26')]({'raw':_0x3143b4[_0x663e('0x1e')]?_0x3143b4[_0x663e('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3143b4[_0x663e('0x1e')]?_0x3143b4['options'][_0x663e('0x20')]||null:null,'attributes':_0x3143b4[_0x663e('0x1e')]?_0x3143b4['options'][_0x663e('0x21')]||null:null,'include':_0x3143b4[_0x663e('0x1e')]?_0x3143b4[_0x663e('0x1e')][_0x663e('0x22')]?_[_0x663e('0x23')](_0x3143b4[_0x663e('0x1e')][_0x663e('0x22')],function(_0x588f1f){return{'model':db[_0x588f1f[_0x663e('0x24')]],'as':_0x588f1f['as'],'attributes':_0x588f1f[_0x663e('0x21')],'include':_0x588f1f[_0x663e('0x22')]?_[_0x663e('0x23')](_0x588f1f['include'],function(_0x15deb6){return{'model':db[_0x15deb6[_0x663e('0x24')]],'as':_0x15deb6['as'],'attributes':_0x15deb6[_0x663e('0x21')],'include':_0x15deb6['include']?_[_0x663e('0x23')](_0x15deb6[_0x663e('0x22')],function(_0x52fa03){return{'model':db[_0x52fa03[_0x663e('0x24')]],'as':_0x52fa03['as'],'attributes':_0x52fa03[_0x663e('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x133035){logger[_0x663e('0x11')](_0x663e('0x25'),_0x3143b4);logger['debug']('ShowMailQueue',_0x3143b4,JSON[_0x663e('0x15')](_0x133035));_0x5e7594(_0x133035);})[_0x663e('0x1a')](function(_0x2ae842){logger[_0x663e('0x16')](_0x663e('0x25'),_0x2ae842[_0x663e('0x18')],_0x3143b4);_0x276606(_0x427e1d[_0x663e('0x16')](0x1f4,_0x2ae842[_0x663e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 87cf00d..214e5cd 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 _0x71ea=['length','mailQueue:','./mailQueue.events','save','remove','update','emit','register'];(function(_0xd895be,_0x16957d){var _0x4cc1c=function(_0x14bff2){while(--_0x14bff2){_0xd895be['push'](_0xd895be['shift']());}};_0x4cc1c(++_0x16957d);}(_0x71ea,0x72));var _0xa71e=function(_0x5df5fa,_0x119f8c){_0x5df5fa=_0x5df5fa-0x0;var _0x54337d=_0x71ea[_0x5df5fa];return _0x54337d;};'use strict';var MailQueueEvents=require(_0xa71e('0x0'));var events=[_0xa71e('0x1'),_0xa71e('0x2'),_0xa71e('0x3')];function createListener(_0x24d380,_0x3e03e8){return function(_0x373a08){_0x3e03e8[_0xa71e('0x4')](_0x24d380,_0x373a08);};}function removeListener(_0x3fd3e9,_0x4bdefa){return function(){MailQueueEvents['removeListener'](_0x3fd3e9,_0x4bdefa);};}exports[_0xa71e('0x5')]=function(_0x21c164){for(var _0x11d0db=0x0,_0x1e0482=events[_0xa71e('0x6')];_0x11d0db<_0x1e0482;_0x11d0db++){var _0x4316f4=events[_0x11d0db];var _0x571742=createListener(_0xa71e('0x7')+_0x4316f4,_0x21c164);MailQueueEvents['on'](_0x4316f4,_0x571742);}}; \ No newline at end of file +var _0xc514=['./mailQueue.events','save','remove','update','removeListener','register','length','mailQueue:'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc514,0x1e0));var _0x4c51=function(_0x45e647,_0x2c482c){_0x45e647=_0x45e647-0x0;var _0x2deace=_0xc514[_0x45e647];return _0x2deace;};'use strict';var MailQueueEvents=require(_0x4c51('0x0'));var events=[_0x4c51('0x1'),_0x4c51('0x2'),_0x4c51('0x3')];function createListener(_0x577c2c,_0x1eeeee){return function(_0x1ecdd7){_0x1eeeee['emit'](_0x577c2c,_0x1ecdd7);};}function removeListener(_0x16b347,_0x588b2d){return function(){MailQueueEvents[_0x4c51('0x4')](_0x16b347,_0x588b2d);};}exports[_0x4c51('0x5')]=function(_0x593231){for(var _0x4740a1=0x0,_0x34565d=events[_0x4c51('0x6')];_0x4740a1<_0x34565d;_0x4740a1++){var _0x1243fd=events[_0x4740a1];var _0x44bf65=createListener(_0x4c51('0x7')+_0x1243fd,_0x593231);MailQueueEvents['on'](_0x1243fd,_0x44bf65);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index f4d963e..c9a982d 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 _0x2ce3=['post','create','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x123961,_0x20e03c){var _0x506efb=function(_0x1d427b){while(--_0x1d427b){_0x123961['push'](_0x123961['shift']());}};_0x506efb(++_0x20e03c);}(_0x2ce3,0x8b));var _0x32ce=function(_0x3b9031,_0x41c719){_0x3b9031=_0x3b9031-0x0;var _0x3b7a8d=_0x2ce3[_0x3b9031];return _0x3b7a8d;};'use strict';var multer=require(_0x32ce('0x0'));var util=require(_0x32ce('0x1'));var path=require(_0x32ce('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x32ce('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x32ce('0x4'));var config=require(_0x32ce('0x5'));var controller=require(_0x32ce('0x6'));router[_0x32ce('0x7')]('/',auth[_0x32ce('0x8')](),controller[_0x32ce('0x9')]);router[_0x32ce('0x7')](_0x32ce('0xa'),auth['isAuthenticated'](),controller[_0x32ce('0xb')]);router['get'](_0x32ce('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x32ce('0xd')]('/',auth[_0x32ce('0x8')](),controller[_0x32ce('0xe')]);router[_0x32ce('0xf')](_0x32ce('0xc'),auth['isAuthenticated'](),controller[_0x32ce('0x10')]);router[_0x32ce('0x11')](_0x32ce('0xc'),auth[_0x32ce('0x8')](),controller['destroy']);module[_0x32ce('0x12')]=router; \ No newline at end of file +var _0xce54=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update'];(function(_0x4bf5f6,_0x44e324){var _0x21c97e=function(_0x4485a9){while(--_0x4485a9){_0x4bf5f6['push'](_0x4bf5f6['shift']());}};_0x21c97e(++_0x44e324);}(_0xce54,0xf3));var _0x4ce5=function(_0x27433d,_0x135606){_0x27433d=_0x27433d-0x0;var _0xd11881=_0xce54[_0x27433d];return _0xd11881;};'use strict';var multer=require('multer');var util=require(_0x4ce5('0x0'));var path=require(_0x4ce5('0x1'));var timeout=require(_0x4ce5('0x2'));var express=require(_0x4ce5('0x3'));var router=express[_0x4ce5('0x4')]();var auth=require(_0x4ce5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4ce5('0x6'));var controller=require('./mailQueueReport.controller');router[_0x4ce5('0x7')]('/',auth[_0x4ce5('0x8')](),controller[_0x4ce5('0x9')]);router['get'](_0x4ce5('0xa'),auth[_0x4ce5('0x8')](),controller[_0x4ce5('0xb')]);router[_0x4ce5('0x7')](_0x4ce5('0xc'),auth['isAuthenticated'](),controller[_0x4ce5('0xd')]);router['post']('/',auth[_0x4ce5('0x8')](),controller[_0x4ce5('0xe')]);router[_0x4ce5('0xf')](_0x4ce5('0xc'),auth[_0x4ce5('0x8')](),controller[_0x4ce5('0x10')]);router[_0x4ce5('0x11')](_0x4ce5('0xc'),auth[_0x4ce5('0x8')](),controller[_0x4ce5('0x12')]);module[_0x4ce5('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 fb90964..c709ba3 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 _0xc3a2=['sequelize','STRING','DATE','moment'];(function(_0x118355,_0x201311){var _0x32f7ea=function(_0x4fd55b){while(--_0x4fd55b){_0x118355['push'](_0x118355['shift']());}};_0x32f7ea(++_0x201311);}(_0xc3a2,0xcb));var _0x2c3a=function(_0x2c0348,_0x390cf4){_0x2c0348=_0x2c0348-0x0;var _0x4be38c=_0xc3a2[_0x2c0348];return _0x4be38c;};'use strict';var moment=require(_0x2c3a('0x0'));var Sequelize=require(_0x2c3a('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x2c3a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2c3a('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x2c3a('0x3')]},'acceptAt':{'type':Sequelize[_0x2c3a('0x3')]},'exitAt':{'type':Sequelize[_0x2c3a('0x3')]},'reason':{'type':Sequelize[_0x2c3a('0x2')]}}; \ No newline at end of file +var _0xc675=['moment','sequelize','exports','STRING','DATE'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc675,0x14a));var _0x5c67=function(_0x597153,_0x5f3f56){_0x597153=_0x597153-0x0;var _0x5a3453=_0xc675[_0x597153];return _0x5a3453;};'use strict';var moment=require(_0x5c67('0x0'));var Sequelize=require(_0x5c67('0x1'));module[_0x5c67('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5c67('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5c67('0x4')]},'acceptAt':{'type':Sequelize[_0x5c67('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5c67('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 40b2d43..9840254 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 _0x5178=['pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','then','destroy','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x3bdc6e,_0x2745ea){var _0xa94735=function(_0x58a01d){while(--_0x58a01d){_0x3bdc6e['push'](_0x3bdc6e['shift']());}};_0xa94735(++_0x2745ea);}(_0x5178,0x171));var _0x8517=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5178[_0x3b380d];return _0x54502b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8517('0x0'));var rimraf=require(_0x8517('0x1'));var zipdir=require(_0x8517('0x2'));var jsonpatch=require(_0x8517('0x3'));var rp=require(_0x8517('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8517('0x5'));var util=require(_0x8517('0x6'));var path=require('path');var sox=require(_0x8517('0x7'));var csv=require('to-csv');var ejs=require(_0x8517('0x8'));var fs=require('fs');var _=require(_0x8517('0x9'));var squel=require(_0x8517('0xa'));var crypto=require(_0x8517('0xb'));var jsforce=require(_0x8517('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8517('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8517('0xe'));var authService=require(_0x8517('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8517('0x10'));var hardwareService=require(_0x8517('0x11'));var logger=require(_0x8517('0x12'))(_0x8517('0x13'));var utils=require(_0x8517('0x14'));var config=require(_0x8517('0x15'));var db=require(_0x8517('0x16'))['db'];function respondWithStatusCode(_0x12388f,_0x4b9768){_0x4b9768=_0x4b9768||0xcc;return function(_0x9c57de){if(_0x9c57de){return _0x12388f[_0x8517('0x17')](_0x4b9768);}return _0x12388f[_0x8517('0x18')](_0x4b9768)[_0x8517('0x19')]();};}function respondWithResult(_0x284a05,_0x49eba7){_0x49eba7=_0x49eba7||0xc8;return function(_0x385219){if(_0x385219){return _0x284a05[_0x8517('0x18')](_0x49eba7)[_0x8517('0x1a')](_0x385219);}};}function respondWithFilteredResult(_0x100280,_0x411d29){return function(_0x18a984){if(_0x18a984){var _0x260a15=_0x18a984[_0x8517('0x1b')],_0x30cea1=_0x411d29[_0x8517('0x1c')],_0x504a92=_0x411d29['offset']+_0x411d29[_0x8517('0x1d')],_0x2953dd;if(_0x504a92>=_0x260a15){_0x504a92=_0x260a15;_0x2953dd=0xc8;}else{_0x2953dd=0xce;}_0x100280[_0x8517('0x18')](_0x2953dd);return _0x100280[_0x8517('0x1e')](_0x8517('0x1f'),_0x30cea1+'-'+_0x504a92+'/'+_0x260a15)[_0x8517('0x1a')](_0x18a984);}return null;};}function patchUpdates(_0x24ca7e){return function(_0x1bfbc1){try{jsonpatch['apply'](_0x1bfbc1,_0x24ca7e,!![]);}catch(_0xd37bf1){return BPromise['reject'](_0xd37bf1);}return _0x1bfbc1['save']();};}function saveUpdates(_0x23f7d2,_0x157bea){return function(_0xf35d95){if(_0xf35d95){return _0xf35d95[_0x8517('0x20')](_0x23f7d2)[_0x8517('0x21')](function(_0xdfde16){return _0xdfde16;});}return null;};}function removeEntity(_0x512458,_0x4b145f){return function(_0x2dd1df){if(_0x2dd1df){return _0x2dd1df[_0x8517('0x22')]()[_0x8517('0x21')](function(){_0x512458[_0x8517('0x18')](0xcc)[_0x8517('0x19')]();});}};}function handleEntityNotFound(_0x2e6e47,_0x5f02ee){return function(_0x181500){if(!_0x181500){_0x2e6e47[_0x8517('0x17')](0x194);}return _0x181500;};}function handleError(_0x5578f0,_0x7f4cf8){_0x7f4cf8=_0x7f4cf8||0x1f4;return function(_0x2febd5){logger[_0x8517('0x23')](_0x2febd5['stack']);if(_0x2febd5[_0x8517('0x24')]){delete _0x2febd5['name'];}_0x5578f0[_0x8517('0x18')](_0x7f4cf8)[_0x8517('0x25')](_0x2febd5);};}exports[_0x8517('0x26')]=function(_0x2b0c19,_0x238f2c){var _0x300e3f={},_0x481ceb={},_0x39764e={'count':0x0,'rows':[]};var _0x51d516=_[_0x8517('0x27')](db[_0x8517('0x28')][_0x8517('0x29')],function(_0x355aa6){return{'name':_0x355aa6[_0x8517('0x2a')],'type':_0x355aa6[_0x8517('0x2b')]['key']};});_0x481ceb[_0x8517('0x2c')]=_['map'](_0x51d516,_0x8517('0x24'));_0x481ceb[_0x8517('0x2d')]=_[_0x8517('0x2e')](_0x2b0c19[_0x8517('0x2d')]);_0x481ceb[_0x8517('0x2f')]=_[_0x8517('0x30')](_0x481ceb[_0x8517('0x2c')],_0x481ceb[_0x8517('0x2d')]);_0x300e3f[_0x8517('0x31')]=_['intersection'](_0x481ceb[_0x8517('0x2c')],qs[_0x8517('0x32')](_0x2b0c19[_0x8517('0x2d')]['fields']));_0x300e3f['attributes']=_0x300e3f['attributes'][_0x8517('0x33')]?_0x300e3f[_0x8517('0x31')]:_0x481ceb[_0x8517('0x2c')];if(!_0x2b0c19[_0x8517('0x2d')][_0x8517('0x34')](_0x8517('0x35'))){_0x300e3f['limit']=qs[_0x8517('0x1d')](_0x2b0c19[_0x8517('0x2d')][_0x8517('0x1d')]);_0x300e3f['offset']=qs[_0x8517('0x1c')](_0x2b0c19['query'][_0x8517('0x1c')]);}_0x300e3f[_0x8517('0x36')]=qs['sort'](_0x2b0c19['query'][_0x8517('0x37')]);_0x300e3f[_0x8517('0x38')]=qs[_0x8517('0x2f')](_[_0x8517('0x39')](_0x2b0c19['query'],_0x481ceb['filters']),_0x51d516);if(_0x2b0c19[_0x8517('0x2d')][_0x8517('0x3a')]){_0x300e3f[_0x8517('0x38')]=_['merge'](_0x300e3f[_0x8517('0x38')],{'$or':_[_0x8517('0x27')](_0x51d516,function(_0x4afa5b){if(_0x4afa5b[_0x8517('0x2b')]!==_0x8517('0x3b')){var _0x15e5f0={};_0x15e5f0[_0x4afa5b[_0x8517('0x24')]]={'$like':'%'+_0x2b0c19['query'][_0x8517('0x3a')]+'%'};return _0x15e5f0;}})});}_0x300e3f=_[_0x8517('0x3c')]({},_0x300e3f,_0x2b0c19[_0x8517('0x3d')]);var _0x36ff78={'where':_0x300e3f[_0x8517('0x38')]};return db[_0x8517('0x28')][_0x8517('0x1b')](_0x36ff78)[_0x8517('0x21')](function(_0x3f338a){_0x39764e[_0x8517('0x1b')]=_0x3f338a;if(_0x2b0c19[_0x8517('0x2d')][_0x8517('0x3e')]){_0x300e3f[_0x8517('0x3f')]=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x300e3f);})[_0x8517('0x21')](function(_0x24a74b){_0x39764e[_0x8517('0x40')]=_0x24a74b;return _0x39764e;})[_0x8517('0x21')](respondWithFilteredResult(_0x238f2c,_0x300e3f))[_0x8517('0x41')](handleError(_0x238f2c,null));};exports['show']=function(_0x2456c9,_0x5a35cd){var _0x531ca7={'raw':!![],'where':{'id':_0x2456c9[_0x8517('0x42')]['id']}},_0x1472f3={};_0x1472f3[_0x8517('0x2c')]=_[_0x8517('0x2e')](db['MailQueueReport'][_0x8517('0x29')]);_0x1472f3[_0x8517('0x2d')]=_['keys'](_0x2456c9[_0x8517('0x2d')]);_0x1472f3[_0x8517('0x2f')]=_[_0x8517('0x30')](_0x1472f3['model'],_0x1472f3[_0x8517('0x2d')]);_0x531ca7[_0x8517('0x31')]=_[_0x8517('0x30')](_0x1472f3[_0x8517('0x2c')],qs[_0x8517('0x32')](_0x2456c9[_0x8517('0x2d')][_0x8517('0x32')]));_0x531ca7['attributes']=_0x531ca7[_0x8517('0x31')][_0x8517('0x33')]?_0x531ca7['attributes']:_0x1472f3[_0x8517('0x2c')];if(_0x2456c9[_0x8517('0x2d')][_0x8517('0x3e')]){_0x531ca7[_0x8517('0x3f')]=[{'all':!![]}];}_0x531ca7=_[_0x8517('0x3c')]({},_0x531ca7,_0x2456c9[_0x8517('0x3d')]);return db['MailQueueReport'][_0x8517('0x43')](_0x531ca7)[_0x8517('0x21')](handleEntityNotFound(_0x5a35cd,null))[_0x8517('0x21')](respondWithResult(_0x5a35cd,null))['catch'](handleError(_0x5a35cd,null));};exports[_0x8517('0x44')]=function(_0x197480,_0x56d08b){return db[_0x8517('0x28')][_0x8517('0x44')](_0x197480['body'],{})['then'](respondWithResult(_0x56d08b,0xc9))['catch'](handleError(_0x56d08b,null));};exports[_0x8517('0x20')]=function(_0x250a14,_0x4ec257){if(_0x250a14[_0x8517('0x45')]['id']){delete _0x250a14['body']['id'];}return db['MailQueueReport'][_0x8517('0x43')]({'where':{'id':_0x250a14[_0x8517('0x42')]['id']}})[_0x8517('0x21')](handleEntityNotFound(_0x4ec257,null))[_0x8517('0x21')](saveUpdates(_0x250a14['body'],null))[_0x8517('0x21')](respondWithResult(_0x4ec257,null))[_0x8517('0x41')](handleError(_0x4ec257,null));};exports[_0x8517('0x22')]=function(_0x5a6812,_0x15102f){return db[_0x8517('0x28')][_0x8517('0x43')]({'where':{'id':_0x5a6812[_0x8517('0x42')]['id']}})[_0x8517('0x21')](handleEntityNotFound(_0x15102f,null))[_0x8517('0x21')](removeEntity(_0x15102f,null))[_0x8517('0x41')](handleError(_0x15102f,null));};exports['describe']=function(_0x3a5adb,_0x5a8724){return db['MailQueueReport'][_0x8517('0x46')]()[_0x8517('0x21')](respondWithResult(_0x5a8724,null))[_0x8517('0x41')](handleError(_0x5a8724,null));}; \ No newline at end of file +var _0xee14=['show','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','MailQueueReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x1cc3a9,_0x3f3ffb){var _0x564d21=function(_0x1c828a){while(--_0x1c828a){_0x1cc3a9['push'](_0x1cc3a9['shift']());}};_0x564d21(++_0x3f3ffb);}(_0xee14,0x13a));var _0x4ee1=function(_0x87debf,_0x41bfe9){_0x87debf=_0x87debf-0x0;var _0x22c75a=_0xee14[_0x87debf];return _0x22c75a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4ee1('0x0'));var zipdir=require(_0x4ee1('0x1'));var jsonpatch=require(_0x4ee1('0x2'));var rp=require(_0x4ee1('0x3'));var moment=require(_0x4ee1('0x4'));var BPromise=require(_0x4ee1('0x5'));var Mustache=require(_0x4ee1('0x6'));var util=require(_0x4ee1('0x7'));var path=require(_0x4ee1('0x8'));var sox=require('sox');var csv=require(_0x4ee1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4ee1('0xa'));var squel=require(_0x4ee1('0xb'));var crypto=require(_0x4ee1('0xc'));var jsforce=require(_0x4ee1('0xd'));var deskjs=require(_0x4ee1('0xe'));var toCsv=require(_0x4ee1('0x9'));var querystring=require('querystring');var Papa=require(_0x4ee1('0xf'));var Redis=require(_0x4ee1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4ee1('0x11'));var as=require(_0x4ee1('0x12'));var hardwareService=require(_0x4ee1('0x13'));var logger=require(_0x4ee1('0x14'))('api');var utils=require(_0x4ee1('0x15'));var config=require(_0x4ee1('0x16'));var db=require(_0x4ee1('0x17'))['db'];function respondWithStatusCode(_0x2d5d3c,_0x2f864e){_0x2f864e=_0x2f864e||0xcc;return function(_0x174427){if(_0x174427){return _0x2d5d3c['sendStatus'](_0x2f864e);}return _0x2d5d3c[_0x4ee1('0x18')](_0x2f864e)[_0x4ee1('0x19')]();};}function respondWithResult(_0x1096a5,_0x24a915){_0x24a915=_0x24a915||0xc8;return function(_0x46d2c2){if(_0x46d2c2){return _0x1096a5[_0x4ee1('0x18')](_0x24a915)[_0x4ee1('0x1a')](_0x46d2c2);}};}function respondWithFilteredResult(_0x359bab,_0xb7eafd){return function(_0x4e3490){if(_0x4e3490){var _0x2f9194=_0x4e3490[_0x4ee1('0x1b')],_0x38008f=_0xb7eafd[_0x4ee1('0x1c')],_0x34651b=_0xb7eafd[_0x4ee1('0x1c')]+_0xb7eafd[_0x4ee1('0x1d')],_0x1b1e0e;if(_0x34651b>=_0x2f9194){_0x34651b=_0x2f9194;_0x1b1e0e=0xc8;}else{_0x1b1e0e=0xce;}_0x359bab[_0x4ee1('0x18')](_0x1b1e0e);return _0x359bab[_0x4ee1('0x1e')](_0x4ee1('0x1f'),_0x38008f+'-'+_0x34651b+'/'+_0x2f9194)['json'](_0x4e3490);}return null;};}function patchUpdates(_0x236215){return function(_0x3db827){try{jsonpatch[_0x4ee1('0x20')](_0x3db827,_0x236215,!![]);}catch(_0x1034fb){return BPromise[_0x4ee1('0x21')](_0x1034fb);}return _0x3db827[_0x4ee1('0x22')]();};}function saveUpdates(_0x48a959,_0x8a631f){return function(_0x333e96){if(_0x333e96){return _0x333e96[_0x4ee1('0x23')](_0x48a959)[_0x4ee1('0x24')](function(_0x160a26){return _0x160a26;});}return null;};}function removeEntity(_0x224b54,_0x328f21){return function(_0x40fd98){if(_0x40fd98){return _0x40fd98[_0x4ee1('0x25')]()[_0x4ee1('0x24')](function(){_0x224b54['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14110c,_0x459e2e){return function(_0xaf87e7){if(!_0xaf87e7){_0x14110c[_0x4ee1('0x26')](0x194);}return _0xaf87e7;};}function handleError(_0x1e9a50,_0x28efdc){_0x28efdc=_0x28efdc||0x1f4;return function(_0x57d45d){logger['error'](_0x57d45d[_0x4ee1('0x27')]);if(_0x57d45d[_0x4ee1('0x28')]){delete _0x57d45d['name'];}_0x1e9a50[_0x4ee1('0x18')](_0x28efdc)[_0x4ee1('0x29')](_0x57d45d);};}exports[_0x4ee1('0x2a')]=function(_0x215949,_0x2d699c){var _0x3c7b2a={},_0x45bd0d={},_0x56c4d3={'count':0x0,'rows':[]};var _0x1f7b74=_['map'](db[_0x4ee1('0x2b')]['rawAttributes'],function(_0x3dc870){return{'name':_0x3dc870[_0x4ee1('0x2c')],'type':_0x3dc870[_0x4ee1('0x2d')][_0x4ee1('0x2e')]};});_0x45bd0d[_0x4ee1('0x2f')]=_['map'](_0x1f7b74,_0x4ee1('0x28'));_0x45bd0d['query']=_[_0x4ee1('0x30')](_0x215949[_0x4ee1('0x31')]);_0x45bd0d[_0x4ee1('0x32')]=_[_0x4ee1('0x33')](_0x45bd0d[_0x4ee1('0x2f')],_0x45bd0d['query']);_0x3c7b2a[_0x4ee1('0x34')]=_[_0x4ee1('0x33')](_0x45bd0d[_0x4ee1('0x2f')],qs[_0x4ee1('0x35')](_0x215949[_0x4ee1('0x31')][_0x4ee1('0x35')]));_0x3c7b2a['attributes']=_0x3c7b2a['attributes'][_0x4ee1('0x36')]?_0x3c7b2a[_0x4ee1('0x34')]:_0x45bd0d[_0x4ee1('0x2f')];if(!_0x215949['query'][_0x4ee1('0x37')](_0x4ee1('0x38'))){_0x3c7b2a[_0x4ee1('0x1d')]=qs[_0x4ee1('0x1d')](_0x215949[_0x4ee1('0x31')][_0x4ee1('0x1d')]);_0x3c7b2a[_0x4ee1('0x1c')]=qs[_0x4ee1('0x1c')](_0x215949[_0x4ee1('0x31')][_0x4ee1('0x1c')]);}_0x3c7b2a[_0x4ee1('0x39')]=qs[_0x4ee1('0x3a')](_0x215949[_0x4ee1('0x31')]['sort']);_0x3c7b2a[_0x4ee1('0x3b')]=qs[_0x4ee1('0x32')](_[_0x4ee1('0x3c')](_0x215949['query'],_0x45bd0d['filters']),_0x1f7b74);if(_0x215949[_0x4ee1('0x31')][_0x4ee1('0x3d')]){_0x3c7b2a[_0x4ee1('0x3b')]=_[_0x4ee1('0x3e')](_0x3c7b2a['where'],{'$or':_[_0x4ee1('0x3f')](_0x1f7b74,function(_0x2ed16f){if(_0x2ed16f[_0x4ee1('0x2d')]!==_0x4ee1('0x40')){var _0x2653c4={};_0x2653c4[_0x2ed16f[_0x4ee1('0x28')]]={'$like':'%'+_0x215949[_0x4ee1('0x31')][_0x4ee1('0x3d')]+'%'};return _0x2653c4;}})});}_0x3c7b2a=_['merge']({},_0x3c7b2a,_0x215949[_0x4ee1('0x41')]);var _0x1116b4={'where':_0x3c7b2a[_0x4ee1('0x3b')]};return db[_0x4ee1('0x2b')][_0x4ee1('0x1b')](_0x1116b4)[_0x4ee1('0x24')](function(_0x543b2e){_0x56c4d3[_0x4ee1('0x1b')]=_0x543b2e;if(_0x215949[_0x4ee1('0x31')][_0x4ee1('0x42')]){_0x3c7b2a[_0x4ee1('0x43')]=[{'all':!![]}];}return db[_0x4ee1('0x2b')][_0x4ee1('0x44')](_0x3c7b2a);})[_0x4ee1('0x24')](function(_0xaac883){_0x56c4d3[_0x4ee1('0x45')]=_0xaac883;return _0x56c4d3;})[_0x4ee1('0x24')](respondWithFilteredResult(_0x2d699c,_0x3c7b2a))[_0x4ee1('0x46')](handleError(_0x2d699c,null));};exports[_0x4ee1('0x47')]=function(_0x34fc7a,_0x51fd40){var _0x3b3bed={'raw':!![],'where':{'id':_0x34fc7a['params']['id']}},_0x40a3e3={};_0x40a3e3[_0x4ee1('0x2f')]=_['keys'](db[_0x4ee1('0x2b')]['rawAttributes']);_0x40a3e3[_0x4ee1('0x31')]=_[_0x4ee1('0x30')](_0x34fc7a['query']);_0x40a3e3[_0x4ee1('0x32')]=_[_0x4ee1('0x33')](_0x40a3e3[_0x4ee1('0x2f')],_0x40a3e3[_0x4ee1('0x31')]);_0x3b3bed['attributes']=_[_0x4ee1('0x33')](_0x40a3e3[_0x4ee1('0x2f')],qs[_0x4ee1('0x35')](_0x34fc7a['query']['fields']));_0x3b3bed[_0x4ee1('0x34')]=_0x3b3bed[_0x4ee1('0x34')][_0x4ee1('0x36')]?_0x3b3bed[_0x4ee1('0x34')]:_0x40a3e3[_0x4ee1('0x2f')];if(_0x34fc7a['query']['includeAll']){_0x3b3bed[_0x4ee1('0x43')]=[{'all':!![]}];}_0x3b3bed=_[_0x4ee1('0x3e')]({},_0x3b3bed,_0x34fc7a[_0x4ee1('0x41')]);return db[_0x4ee1('0x2b')]['find'](_0x3b3bed)[_0x4ee1('0x24')](handleEntityNotFound(_0x51fd40,null))[_0x4ee1('0x24')](respondWithResult(_0x51fd40,null))['catch'](handleError(_0x51fd40,null));};exports[_0x4ee1('0x48')]=function(_0x16dc20,_0x21edeb){return db[_0x4ee1('0x2b')][_0x4ee1('0x48')](_0x16dc20[_0x4ee1('0x49')],{})[_0x4ee1('0x24')](respondWithResult(_0x21edeb,0xc9))[_0x4ee1('0x46')](handleError(_0x21edeb,null));};exports[_0x4ee1('0x23')]=function(_0x4ebb28,_0x49b667){if(_0x4ebb28[_0x4ee1('0x49')]['id']){delete _0x4ebb28[_0x4ee1('0x49')]['id'];}return db[_0x4ee1('0x2b')][_0x4ee1('0x4a')]({'where':{'id':_0x4ebb28['params']['id']}})[_0x4ee1('0x24')](handleEntityNotFound(_0x49b667,null))[_0x4ee1('0x24')](saveUpdates(_0x4ebb28[_0x4ee1('0x49')],null))[_0x4ee1('0x24')](respondWithResult(_0x49b667,null))[_0x4ee1('0x46')](handleError(_0x49b667,null));};exports['destroy']=function(_0x1c71ba,_0x4ae560){return db[_0x4ee1('0x2b')]['find']({'where':{'id':_0x1c71ba[_0x4ee1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4ae560,null))[_0x4ee1('0x24')](removeEntity(_0x4ae560,null))['catch'](handleError(_0x4ae560,null));};exports[_0x4ee1('0x4c')]=function(_0x480796,_0xd19964){return db['MailQueueReport'][_0x4ee1('0x4c')]()[_0x4ee1('0x24')](respondWithResult(_0xd19964,null))[_0x4ee1('0x46')](handleError(_0xd19964,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 3e131ad..4049a7a 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 _0x0a12=['util','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','report_mail_queue'];(function(_0x177c55,_0x148cf2){var _0x42f0f6=function(_0x10cadc){while(--_0x10cadc){_0x177c55['push'](_0x177c55['shift']());}};_0x42f0f6(++_0x148cf2);}(_0x0a12,0xb8));var _0x20a1=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x0a12[_0x38537f];return _0x141e23;};'use strict';var _=require('lodash');var util=require(_0x20a1('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x20a1('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20a1('0x2'));var rimraf=require(_0x20a1('0x3'));var config=require(_0x20a1('0x4'));var attributes=require(_0x20a1('0x5'));module[_0x20a1('0x6')]=function(_0x2e0ad3,_0x1fedd2){return _0x2e0ad3['define']('MailQueueReport',attributes,{'tableName':_0x20a1('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x757c=['./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x556a3f,_0x32376b){var _0x1b0f18=function(_0x314932){while(--_0x314932){_0x556a3f['push'](_0x556a3f['shift']());}};_0x1b0f18(++_0x32376b);}(_0x757c,0xc9));var _0xc757=function(_0xf74bbd,_0x34560a){_0xf74bbd=_0xf74bbd-0x0;var _0x444a2d=_0x757c[_0xf74bbd];return _0x444a2d;};'use strict';var _=require(_0xc757('0x0'));var util=require(_0xc757('0x1'));var logger=require('../../config/logger')(_0xc757('0x2'));var moment=require(_0xc757('0x3'));var BPromise=require(_0xc757('0x4'));var rp=require(_0xc757('0x5'));var fs=require('fs');var path=require(_0xc757('0x6'));var rimraf=require(_0xc757('0x7'));var config=require(_0xc757('0x8'));var attributes=require(_0xc757('0x9'));module[_0xc757('0xa')]=function(_0x29cb3a,_0x4f15ef){return _0x29cb3a[_0xc757('0xb')](_0xc757('0xc'),attributes,{'tableName':_0xc757('0xd'),'paranoid':![],'indexes':[{'name':_0xc757('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index f223ebf..84d29a2 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 _0xfdbd=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateMailQueueReport','MailQueueReport','create','body','options','UpdateMailQueueReport','update','raw','where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2a7de0,_0x2d0bde){var _0x4b1604=function(_0x4d46e1){while(--_0x4d46e1){_0x2a7de0['push'](_0x2a7de0['shift']());}};_0x4b1604(++_0x2d0bde);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0xfdbd[_0x3a04ab];return _0x4bff6d;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var moment=require(_0xdfdb('0x2'));var BPromise=require(_0xdfdb('0x3'));var rs=require(_0xdfdb('0x4'));var fs=require('fs');var Redis=require(_0xdfdb('0x5'));var db=require(_0xdfdb('0x6'))['db'];var utils=require(_0xdfdb('0x7'));var logger=require(_0xdfdb('0x8'))('rpc');var config=require(_0xdfdb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdfdb('0xa')][_0xdfdb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x489f19,_0x556dc0,_0x590b5d){return new BPromise(function(_0x188508,_0xf72a24){return client['request'](_0x489f19,_0x590b5d)[_0xdfdb('0xc')](function(_0x444c19){logger[_0xdfdb('0xd')](_0xdfdb('0xe'),_0x556dc0,_0xdfdb('0xf'));logger[_0xdfdb('0x10')](_0xdfdb('0x11'),_0x556dc0,'request\x20sent',JSON[_0xdfdb('0x12')](_0x444c19));if(_0x444c19[_0xdfdb('0x13')]){if(_0x444c19['error'][_0xdfdb('0x14')]===0x1f4){logger[_0xdfdb('0x13')](_0xdfdb('0xe'),_0x556dc0,_0x444c19[_0xdfdb('0x13')][_0xdfdb('0x15')]);return _0xf72a24(_0x444c19[_0xdfdb('0x13')][_0xdfdb('0x15')]);}logger[_0xdfdb('0x13')]('MailQueueReport,\x20%s,\x20%s',_0x556dc0,_0x444c19['error'][_0xdfdb('0x15')]);return _0x188508(_0x444c19['error'][_0xdfdb('0x15')]);}else{logger[_0xdfdb('0xd')](_0xdfdb('0xe'),_0x556dc0,_0xdfdb('0xf'));_0x188508(_0x444c19[_0xdfdb('0x16')][_0xdfdb('0x15')]);}})['catch'](function(_0x4fd3d5){logger[_0xdfdb('0x13')](_0xdfdb('0xe'),_0x556dc0,_0x4fd3d5);_0xf72a24(_0x4fd3d5);});});}exports[_0xdfdb('0x17')]=function(_0x55ab5a){var _0x3eb100=this;return new Promise(function(_0xb677b1,_0x467653){return db[_0xdfdb('0x18')][_0xdfdb('0x19')](_0x55ab5a[_0xdfdb('0x1a')],{'raw':_0x55ab5a[_0xdfdb('0x1b')]?_0x55ab5a[_0xdfdb('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xdfdb('0xc')](function(_0xb7417c){logger[_0xdfdb('0xd')]('CreateMailQueueReport',_0x55ab5a);logger[_0xdfdb('0x10')](_0xdfdb('0x17'),_0x55ab5a,JSON[_0xdfdb('0x12')](_0xb7417c));_0xb677b1(_0xb7417c);})['catch'](function(_0x280e53){logger[_0xdfdb('0x13')](_0xdfdb('0x17'),_0x280e53['message'],_0x55ab5a);_0x467653(_0x3eb100[_0xdfdb('0x13')](0x1f4,_0x280e53['message']));});});};exports[_0xdfdb('0x1c')]=function(_0x145350){var _0x1fa2f3=this;return new Promise(function(_0x2a560c,_0x4f69cf){return db[_0xdfdb('0x18')][_0xdfdb('0x1d')](_0x145350[_0xdfdb('0x1a')],{'raw':_0x145350[_0xdfdb('0x1b')]?_0x145350[_0xdfdb('0x1b')][_0xdfdb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x145350['options']?_0x145350[_0xdfdb('0x1b')][_0xdfdb('0x1f')]||null:null,'attributes':_0x145350[_0xdfdb('0x1b')]?_0x145350['options'][_0xdfdb('0x20')]||null:null,'limit':_0x145350['options']?_0x145350[_0xdfdb('0x1b')][_0xdfdb('0x21')]||null:null})[_0xdfdb('0xc')](function(_0x513fa0){logger['info'](_0xdfdb('0x1c'),_0x145350);logger[_0xdfdb('0x10')](_0xdfdb('0x1c'),_0x145350,JSON[_0xdfdb('0x12')](_0x513fa0));_0x2a560c(_0x513fa0);})[_0xdfdb('0x22')](function(_0x165f72){logger['error'](_0xdfdb('0x1c'),_0x165f72[_0xdfdb('0x15')],_0x145350);_0x4f69cf(_0x1fa2f3[_0xdfdb('0x13')](0x1f4,_0x165f72[_0xdfdb('0x15')]));});});}; \ No newline at end of file +var _0x187d=['MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','then','UpdateMailQueueReport','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info'];(function(_0x53f337,_0x47383a){var _0x54a96e=function(_0x4728b1){while(--_0x4728b1){_0x53f337['push'](_0x53f337['shift']());}};_0x54a96e(++_0x47383a);}(_0x187d,0x93));var _0xd187=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x187d[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});}exports[_0xd187('0x15')]=function(_0x374fe0){var _0x10d9fd=this;return new Promise(function(_0x21df74,_0x253a7e){return db[_0xd187('0x16')][_0xd187('0x17')](_0x374fe0[_0xd187('0x18')],{'raw':_0x374fe0[_0xd187('0x19')]?_0x374fe0[_0xd187('0x19')][_0xd187('0x1a')]===undefined?!![]:![]:!![]})[_0xd187('0x1b')](function(_0x5204ee){logger[_0xd187('0xc')](_0xd187('0x15'),_0x374fe0);logger[_0xd187('0xf')]('CreateMailQueueReport',_0x374fe0,JSON['stringify'](_0x5204ee));_0x21df74(_0x5204ee);})['catch'](function(_0x435d94){logger[_0xd187('0x12')](_0xd187('0x15'),_0x435d94['message'],_0x374fe0);_0x253a7e(_0x10d9fd[_0xd187('0x12')](0x1f4,_0x435d94['message']));});});};exports[_0xd187('0x1c')]=function(_0x5a7a23){var _0x1047f4=this;return new Promise(function(_0x54f340,_0x4f3879){return db[_0xd187('0x16')]['update'](_0x5a7a23[_0xd187('0x18')],{'raw':_0x5a7a23[_0xd187('0x19')]?_0x5a7a23['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a7a23[_0xd187('0x19')]?_0x5a7a23[_0xd187('0x19')][_0xd187('0x1d')]||null:null,'attributes':_0x5a7a23[_0xd187('0x19')]?_0x5a7a23['options'][_0xd187('0x1e')]||null:null,'limit':_0x5a7a23[_0xd187('0x19')]?_0x5a7a23['options'][_0xd187('0x1f')]||null:null})[_0xd187('0x1b')](function(_0x34febe){logger['info'](_0xd187('0x1c'),_0x5a7a23);logger['debug'](_0xd187('0x1c'),_0x5a7a23,JSON[_0xd187('0x11')](_0x34febe));_0x54f340(_0x34febe);})[_0xd187('0x14')](function(_0x352b66){logger['error'](_0xd187('0x1c'),_0x352b66[_0xd187('0x13')],_0x5a7a23);_0x4f3879(_0x1047f4['error'](0x1f4,_0x352b66['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 12fe2cc..dccb7bf 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 _0xef14=['connect-timeout','express','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x107eb3,_0x8d6929){var _0x3454e7=function(_0x41fe33){while(--_0x41fe33){_0x107eb3['push'](_0x107eb3['shift']());}};_0x3454e7(++_0x8d6929);}(_0xef14,0x107));var _0x4ef1=function(_0x3ce4ef,_0x377be6){_0x3ce4ef=_0x3ce4ef-0x0;var _0xb10a49=_0xef14[_0x3ce4ef];return _0xb10a49;};'use strict';var multer=require(_0x4ef1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4ef1('0x1'));var express=require(_0x4ef1('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4ef1('0x3'));var config=require(_0x4ef1('0x4'));module[_0x4ef1('0x5')]=router; \ No newline at end of file +var _0x8736=['Router','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x8736,0x11b));var _0x6873=function(_0x1b4577,_0x32d48c){_0x1b4577=_0x1b4577-0x0;var _0x3fe727=_0x8736[_0x1b4577];return _0x3fe727;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6873('0x0'));var timeout=require(_0x6873('0x1'));var express=require('express');var router=express[_0x6873('0x2')]();var auth=require(_0x6873('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x6873('0x4')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 8d84e49..6437e15 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 _0x1bfc=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x3b8b03,_0x49ff54){var _0xefe7ae=function(_0x4b57c8){while(--_0x4b57c8){_0x3b8b03['push'](_0x3b8b03['shift']());}};_0xefe7ae(++_0x49ff54);}(_0x1bfc,0xc5));var _0xc1bf=function(_0x2d59f4,_0x42a73b){_0x2d59f4=_0x2d59f4-0x0;var _0x7435aa=_0x1bfc[_0x2d59f4];return _0x7435aa;};'use strict';var Sequelize=require(_0xc1bf('0x0'));module[_0xc1bf('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xc1bf('0x2')]},'authentication':{'type':Sequelize[_0xc1bf('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xc1bf('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xc1bf('0x2')]},'port':{'type':Sequelize[_0xc1bf('0x4')]},'tls':{'type':Sequelize[_0xc1bf('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xc1bf('0x2')],'defaultValue':_0xc1bf('0x5')},'connTimeout':{'type':Sequelize[_0xc1bf('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xc1bf('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xc1bf('0x2')]}}; \ No newline at end of file +var _0xe011=['exports','STRING','BOOLEAN','username','INTEGER','INBOX','sequelize'];(function(_0x1e9f19,_0x434599){var _0x14b631=function(_0x132237){while(--_0x132237){_0x1e9f19['push'](_0x1e9f19['shift']());}};_0x14b631(++_0x434599);}(_0xe011,0x1c6));var _0x1e01=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0xe011[_0x54defc];return _0x1955d3;};'use strict';var Sequelize=require(_0x1e01('0x0'));module[_0x1e01('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x1e01('0x2')]},'authentication':{'type':Sequelize[_0x1e01('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x1e01('0x2')],'unique':_0x1e01('0x4')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x1e01('0x5')]},'tls':{'type':Sequelize[_0x1e01('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x1e01('0x6')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x1e01('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x1e01('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 35fcd89..7ef66bd 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 _0x5eb8=['request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','../../config/logger','api','moment','bluebird'];(function(_0x55cad1,_0x30f329){var _0x2a89e1=function(_0x2c7cb3){while(--_0x2c7cb3){_0x55cad1['push'](_0x55cad1['shift']());}};_0x2a89e1(++_0x30f329);}(_0x5eb8,0xb0));var _0x85eb=function(_0x33ca22,_0xbcc94){_0x33ca22=_0x33ca22-0x0;var _0x1790c3=_0x5eb8[_0x33ca22];return _0x1790c3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x85eb('0x0'))(_0x85eb('0x1'));var moment=require(_0x85eb('0x2'));var BPromise=require(_0x85eb('0x3'));var rp=require(_0x85eb('0x4'));var fs=require('fs');var path=require(_0x85eb('0x5'));var rimraf=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var attributes=require(_0x85eb('0x8'));module[_0x85eb('0x9')]=function(_0x2bf83c,_0x1ba1d8){return _0x2bf83c['define'](_0x85eb('0xa'),attributes,{'tableName':_0x85eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fc2=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','MailServerIn','mail_servers_in','lodash','util'];(function(_0x158e3b,_0x4534b){var _0x551a1d=function(_0x629c21){while(--_0x629c21){_0x158e3b['push'](_0x158e3b['shift']());}};_0x551a1d(++_0x4534b);}(_0x4fc2,0x111));var _0x24fc=function(_0x4d73b1,_0x91ab71){_0x4d73b1=_0x4d73b1-0x0;var _0xe394f9=_0x4fc2[_0x4d73b1];return _0xe394f9;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('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 740842a..1754be7 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 _0x7051=['request\x20sent','debug','stringify','error','code','message','info','result','catch','GetMailServerIn','MailServerIn','options','attributes','limit','include','map','model','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerIn,\x20%s,\x20%s'];(function(_0x2a6d19,_0x5d29d1){var _0x475a31=function(_0x41008e){while(--_0x41008e){_0x2a6d19['push'](_0x2a6d19['shift']());}};_0x475a31(++_0x5d29d1);}(_0x7051,0x91));var _0x1705=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x7051[_0x3b5ad9];return _0x611ae9;};'use strict';var _=require(_0x1705('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1705('0x1'));var rs=require(_0x1705('0x2'));var fs=require('fs');var Redis=require(_0x1705('0x3'));var db=require(_0x1705('0x4'))['db'];var utils=require(_0x1705('0x5'));var logger=require(_0x1705('0x6'))(_0x1705('0x7'));var config=require(_0x1705('0x8'));var jayson=require(_0x1705('0x9'));var client=jayson[_0x1705('0xa')][_0x1705('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37e760,_0x465118,_0x19d990){return new BPromise(function(_0x423775,_0x4333e2){return client[_0x1705('0xc')](_0x37e760,_0x19d990)[_0x1705('0xd')](function(_0x4e8947){logger['info'](_0x1705('0xe'),_0x465118,_0x1705('0xf'));logger[_0x1705('0x10')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x465118,'request\x20sent',JSON[_0x1705('0x11')](_0x4e8947));if(_0x4e8947[_0x1705('0x12')]){if(_0x4e8947[_0x1705('0x12')][_0x1705('0x13')]===0x1f4){logger[_0x1705('0x12')]('MailServerIn,\x20%s,\x20%s',_0x465118,_0x4e8947[_0x1705('0x12')][_0x1705('0x14')]);return _0x4333e2(_0x4e8947[_0x1705('0x12')][_0x1705('0x14')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x465118,_0x4e8947[_0x1705('0x12')][_0x1705('0x14')]);return _0x423775(_0x4e8947['error'][_0x1705('0x14')]);}else{logger[_0x1705('0x15')](_0x1705('0xe'),_0x465118,_0x1705('0xf'));_0x423775(_0x4e8947[_0x1705('0x16')][_0x1705('0x14')]);}})[_0x1705('0x17')](function(_0x5232ed){logger[_0x1705('0x12')](_0x1705('0xe'),_0x465118,_0x5232ed);_0x4333e2(_0x5232ed);});});}exports[_0x1705('0x18')]=function(_0x6d5418){var _0x5c2659=this;return new Promise(function(_0x5c47be,_0x4fb0dc){return db[_0x1705('0x19')]['findAll']({'raw':_0x6d5418[_0x1705('0x1a')]?_0x6d5418[_0x1705('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x6d5418[_0x1705('0x1a')]?_0x6d5418[_0x1705('0x1a')]['where']||null:null,'attributes':_0x6d5418[_0x1705('0x1a')]?_0x6d5418[_0x1705('0x1a')][_0x1705('0x1b')]||null:null,'limit':_0x6d5418[_0x1705('0x1a')]?_0x6d5418[_0x1705('0x1a')][_0x1705('0x1c')]||null:null,'include':_0x6d5418[_0x1705('0x1a')]?_0x6d5418[_0x1705('0x1a')][_0x1705('0x1d')]?_[_0x1705('0x1e')](_0x6d5418[_0x1705('0x1a')]['include'],function(_0x34d730){return{'model':db[_0x34d730[_0x1705('0x1f')]],'as':_0x34d730['as'],'attributes':_0x34d730[_0x1705('0x1b')],'include':_0x34d730[_0x1705('0x1d')]?_['map'](_0x34d730[_0x1705('0x1d')],function(_0x895f88){return{'model':db[_0x895f88[_0x1705('0x1f')]],'as':_0x895f88['as'],'attributes':_0x895f88[_0x1705('0x1b')],'include':_0x895f88[_0x1705('0x1d')]?_[_0x1705('0x1e')](_0x895f88[_0x1705('0x1d')],function(_0x17e0ad){return{'model':db[_0x17e0ad[_0x1705('0x1f')]],'as':_0x17e0ad['as'],'attributes':_0x17e0ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x1705('0xd')](function(_0x4ee41c){logger[_0x1705('0x15')](_0x1705('0x18'),_0x6d5418);logger[_0x1705('0x10')](_0x1705('0x18'),_0x6d5418,JSON[_0x1705('0x11')](_0x4ee41c));_0x5c47be(_0x4ee41c);})[_0x1705('0x17')](function(_0x26fb55){logger[_0x1705('0x12')](_0x1705('0x18'),_0x26fb55[_0x1705('0x14')],_0x6d5418);_0x4fb0dc(_0x5c2659[_0x1705('0x12')](0x1f4,_0x26fb55[_0x1705('0x14')]));});});}; \ No newline at end of file +var _0x51c0=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','MailServerIn','options','where','attributes','limit','include','map','model','then','GetMailServerIn','debug','lodash','util'];(function(_0x8b7e6b,_0x2f54ca){var _0x112651=function(_0x48aa63){while(--_0x48aa63){_0x8b7e6b['push'](_0x8b7e6b['shift']());}};_0x112651(++_0x2f54ca);}(_0x51c0,0x17e));var _0x051c=function(_0x47004d,_0x18432b){_0x47004d=_0x47004d-0x0;var _0x438d6f=_0x51c0[_0x47004d];return _0x438d6f;};'use strict';var _=require(_0x051c('0x0'));var util=require(_0x051c('0x1'));var moment=require(_0x051c('0x2'));var BPromise=require(_0x051c('0x3'));var rs=require(_0x051c('0x4'));var fs=require('fs');var Redis=require(_0x051c('0x5'));var db=require(_0x051c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x051c('0x7'));var config=require(_0x051c('0x8'));var jayson=require(_0x051c('0x9'));var client=jayson[_0x051c('0xa')][_0x051c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfba7c8,_0x3c4f8f,_0x46a372){return new BPromise(function(_0x2bd616,_0xabafba){return client[_0x051c('0xc')](_0xfba7c8,_0x46a372)['then'](function(_0x3488ba){logger[_0x051c('0xd')](_0x051c('0xe'),_0x3c4f8f,_0x051c('0xf'));logger['debug'](_0x051c('0x10'),_0x3c4f8f,_0x051c('0xf'),JSON[_0x051c('0x11')](_0x3488ba));if(_0x3488ba[_0x051c('0x12')]){if(_0x3488ba[_0x051c('0x12')]['code']===0x1f4){logger[_0x051c('0x12')](_0x051c('0xe'),_0x3c4f8f,_0x3488ba['error'][_0x051c('0x13')]);return _0xabafba(_0x3488ba[_0x051c('0x12')]['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x3c4f8f,_0x3488ba[_0x051c('0x12')][_0x051c('0x13')]);return _0x2bd616(_0x3488ba['error']['message']);}else{logger[_0x051c('0xd')](_0x051c('0xe'),_0x3c4f8f,_0x051c('0xf'));_0x2bd616(_0x3488ba['result'][_0x051c('0x13')]);}})[_0x051c('0x14')](function(_0x5319b8){logger['error'](_0x051c('0xe'),_0x3c4f8f,_0x5319b8);_0xabafba(_0x5319b8);});});}exports['GetMailServerIn']=function(_0x4ed7b5){var _0x4fe619=this;return new Promise(function(_0x45b037,_0x19674e){return db[_0x051c('0x15')]['findAll']({'raw':_0x4ed7b5[_0x051c('0x16')]?_0x4ed7b5[_0x051c('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4ed7b5[_0x051c('0x16')]?_0x4ed7b5[_0x051c('0x16')][_0x051c('0x17')]||null:null,'attributes':_0x4ed7b5[_0x051c('0x16')]?_0x4ed7b5[_0x051c('0x16')][_0x051c('0x18')]||null:null,'limit':_0x4ed7b5[_0x051c('0x16')]?_0x4ed7b5['options'][_0x051c('0x19')]||null:null,'include':_0x4ed7b5[_0x051c('0x16')]?_0x4ed7b5['options'][_0x051c('0x1a')]?_[_0x051c('0x1b')](_0x4ed7b5[_0x051c('0x16')][_0x051c('0x1a')],function(_0x5f2e80){return{'model':db[_0x5f2e80[_0x051c('0x1c')]],'as':_0x5f2e80['as'],'attributes':_0x5f2e80['attributes'],'include':_0x5f2e80[_0x051c('0x1a')]?_[_0x051c('0x1b')](_0x5f2e80['include'],function(_0xd88dbc){return{'model':db[_0xd88dbc[_0x051c('0x1c')]],'as':_0xd88dbc['as'],'attributes':_0xd88dbc[_0x051c('0x18')],'include':_0xd88dbc[_0x051c('0x1a')]?_[_0x051c('0x1b')](_0xd88dbc[_0x051c('0x1a')],function(_0x201ddf){return{'model':db[_0x201ddf[_0x051c('0x1c')]],'as':_0x201ddf['as'],'attributes':_0x201ddf[_0x051c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x051c('0x1d')](function(_0x195de3){logger[_0x051c('0xd')](_0x051c('0x1e'),_0x4ed7b5);logger[_0x051c('0x1f')](_0x051c('0x1e'),_0x4ed7b5,JSON['stringify'](_0x195de3));_0x45b037(_0x195de3);})['catch'](function(_0x45a524){logger[_0x051c('0x12')]('GetMailServerIn',_0x45a524[_0x051c('0x13')],_0x4ed7b5);_0x19674e(_0x4fe619[_0x051c('0x12')](0x1f4,_0x45a524['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index dcf6e07..35e4879 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 _0x2ab7=['isAuthenticated','index','get','/:id','show','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller'];(function(_0x493cf9,_0x29d377){var _0x13ddff=function(_0x382c16){while(--_0x382c16){_0x493cf9['push'](_0x493cf9['shift']());}};_0x13ddff(++_0x29d377);}(_0x2ab7,0x14d));var _0x72ab=function(_0x57a342,_0x292014){_0x57a342=_0x57a342-0x0;var _0xc3d159=_0x2ab7[_0x57a342];return _0xc3d159;};'use strict';var multer=require(_0x72ab('0x0'));var util=require(_0x72ab('0x1'));var path=require(_0x72ab('0x2'));var timeout=require('connect-timeout');var express=require(_0x72ab('0x3'));var router=express[_0x72ab('0x4')]();var auth=require(_0x72ab('0x5'));var interaction=require(_0x72ab('0x6'));var config=require(_0x72ab('0x7'));var controller=require(_0x72ab('0x8'));router['get']('/',auth[_0x72ab('0x9')](),controller[_0x72ab('0xa')]);router[_0x72ab('0xb')](_0x72ab('0xc'),auth[_0x72ab('0x9')](),controller[_0x72ab('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x72ab('0xe')]);router['put'](_0x72ab('0xc'),auth[_0x72ab('0x9')](),controller[_0x72ab('0xf')]);router[_0x72ab('0x10')](_0x72ab('0xc'),auth[_0x72ab('0x9')](),controller[_0x72ab('0x11')]);module[_0x72ab('0x12')]=router; \ No newline at end of file +var _0x69ca=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','/:id','post','create','put','update','destroy','exports'];(function(_0x439c68,_0x278f90){var _0x1f4e7a=function(_0x1ddcad){while(--_0x1ddcad){_0x439c68['push'](_0x439c68['shift']());}};_0x1f4e7a(++_0x278f90);}(_0x69ca,0xbb));var _0xa69c=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x69ca[_0x2eb5bc];return _0x51c7b1;};'use strict';var multer=require(_0xa69c('0x0'));var util=require(_0xa69c('0x1'));var path=require(_0xa69c('0x2'));var timeout=require(_0xa69c('0x3'));var express=require('express');var router=express[_0xa69c('0x4')]();var auth=require(_0xa69c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa69c('0x6'));var controller=require(_0xa69c('0x7'));router[_0xa69c('0x8')]('/',auth[_0xa69c('0x9')](),controller['index']);router[_0xa69c('0x8')](_0xa69c('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xa69c('0xb')]('/',auth[_0xa69c('0x9')](),controller[_0xa69c('0xc')]);router[_0xa69c('0xd')](_0xa69c('0xa'),auth[_0xa69c('0x9')](),controller[_0xa69c('0xe')]);router['delete'](_0xa69c('0xa'),auth[_0xa69c('0x9')](),controller[_0xa69c('0xf')]);module[_0xa69c('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 38a97e4..5b731df 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 _0xb934=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x316fc4,_0x169688){var _0x747e63=function(_0xc80796){while(--_0xc80796){_0x316fc4['push'](_0x316fc4['shift']());}};_0x747e63(++_0x169688);}(_0xb934,0x92));var _0x4b93=function(_0xa09635,_0x220d81){_0xa09635=_0xa09635-0x0;var _0x4cdf1a=_0xb934[_0xa09635];return _0x4cdf1a;};'use strict';var Sequelize=require(_0x4b93('0x0'));module[_0x4b93('0x1')]={'description':{'type':Sequelize[_0x4b93('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x4b93('0x2')]},'pass':{'type':Sequelize[_0x4b93('0x2')]},'port':{'type':Sequelize[_0x4b93('0x3')]},'secure':{'type':Sequelize[_0x4b93('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x4b93('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xda19=['BOOLEAN','exports','STRING','INTEGER'];(function(_0xe0359d,_0x118dfb){var _0x486c62=function(_0x33d372){while(--_0x33d372){_0xe0359d['push'](_0xe0359d['shift']());}};_0x486c62(++_0x118dfb);}(_0xda19,0xd5));var _0x9da1=function(_0x21f444,_0x4f7ba5){_0x21f444=_0x21f444-0x0;var _0x16da6e=_0xda19[_0x21f444];return _0x16da6e;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'description':{'type':Sequelize[_0x9da1('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x9da1('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x9da1('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x9da1('0x1')]},'authentication':{'type':Sequelize[_0x9da1('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index d312484..5069f25 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 _0xdb76=['where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','length','includeAll','find','create','catch','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','update','then','stack','name','map','MailServerOut','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0xdb76,0x1f4));var _0x6db7=function(_0x2cc5be,_0x27ee88){_0x2cc5be=_0x2cc5be-0x0;var _0x43a0a6=_0xdb76[_0x2cc5be];return _0x43a0a6;};'use strict';var pdf=require(_0x6db7('0x0'));var emlformat=require(_0x6db7('0x1'));var rimraf=require(_0x6db7('0x2'));var zipdir=require(_0x6db7('0x3'));var jsonpatch=require(_0x6db7('0x4'));var rp=require(_0x6db7('0x5'));var moment=require('moment');var BPromise=require(_0x6db7('0x6'));var Mustache=require(_0x6db7('0x7'));var util=require(_0x6db7('0x8'));var path=require(_0x6db7('0x9'));var sox=require('sox');var csv=require(_0x6db7('0xa'));var ejs=require(_0x6db7('0xb'));var fs=require('fs');var _=require(_0x6db7('0xc'));var squel=require(_0x6db7('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6db7('0xa'));var querystring=require(_0x6db7('0xe'));var Papa=require(_0x6db7('0xf'));var Redis=require(_0x6db7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6db7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6db7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x6db7('0x13'));var config=require(_0x6db7('0x14'));var db=require(_0x6db7('0x15'))['db'];function respondWithStatusCode(_0x5992de,_0x4d394e){_0x4d394e=_0x4d394e||0xcc;return function(_0x306415){if(_0x306415){return _0x5992de[_0x6db7('0x16')](_0x4d394e);}return _0x5992de['status'](_0x4d394e)[_0x6db7('0x17')]();};}function respondWithResult(_0x1f2272,_0x2add9b){_0x2add9b=_0x2add9b||0xc8;return function(_0x139706){if(_0x139706){return _0x1f2272[_0x6db7('0x18')](_0x2add9b)[_0x6db7('0x19')](_0x139706);}};}function respondWithFilteredResult(_0x183ed9,_0x3c22de){return function(_0xc5ef91){if(_0xc5ef91){var _0x4561a5=_0xc5ef91[_0x6db7('0x1a')],_0xa5d277=_0x3c22de[_0x6db7('0x1b')],_0x9179e8=_0x3c22de[_0x6db7('0x1b')]+_0x3c22de['limit'],_0x587326;if(_0x9179e8>=_0x4561a5){_0x9179e8=_0x4561a5;_0x587326=0xc8;}else{_0x587326=0xce;}_0x183ed9[_0x6db7('0x18')](_0x587326);return _0x183ed9[_0x6db7('0x1c')](_0x6db7('0x1d'),_0xa5d277+'-'+_0x9179e8+'/'+_0x4561a5)['json'](_0xc5ef91);}return null;};}function patchUpdates(_0xaeb0b4){return function(_0x565a23){try{jsonpatch[_0x6db7('0x1e')](_0x565a23,_0xaeb0b4,!![]);}catch(_0x3a349f){return BPromise[_0x6db7('0x1f')](_0x3a349f);}return _0x565a23['save']();};}function saveUpdates(_0x47ca76,_0x48f87d){return function(_0x832ffc){if(_0x832ffc){return _0x832ffc[_0x6db7('0x20')](_0x47ca76)[_0x6db7('0x21')](function(_0x2185a8){return _0x2185a8;});}return null;};}function removeEntity(_0x358440,_0x3f7774){return function(_0x141d35){if(_0x141d35){return _0x141d35['destroy']()[_0x6db7('0x21')](function(){_0x358440[_0x6db7('0x18')](0xcc)[_0x6db7('0x17')]();});}};}function handleEntityNotFound(_0x10bcb0,_0x4e24e5){return function(_0x30b004){if(!_0x30b004){_0x10bcb0[_0x6db7('0x16')](0x194);}return _0x30b004;};}function handleError(_0x14fc5a,_0xc7fa82){_0xc7fa82=_0xc7fa82||0x1f4;return function(_0x216d07){logger['error'](_0x216d07[_0x6db7('0x22')]);if(_0x216d07[_0x6db7('0x23')]){delete _0x216d07[_0x6db7('0x23')];}_0x14fc5a[_0x6db7('0x18')](_0xc7fa82)['send'](_0x216d07);};}exports['index']=function(_0x541d44,_0x221eb8){var _0x2a44c1={},_0xf87272={},_0x259505={'count':0x0,'rows':[]};var _0x232507=_[_0x6db7('0x24')](db[_0x6db7('0x25')][_0x6db7('0x26')],function(_0x1b8b1c){return{'name':_0x1b8b1c['fieldName'],'type':_0x1b8b1c[_0x6db7('0x27')][_0x6db7('0x28')]};});_0xf87272[_0x6db7('0x29')]=_[_0x6db7('0x24')](_0x232507,_0x6db7('0x23'));_0xf87272[_0x6db7('0x2a')]=_[_0x6db7('0x2b')](_0x541d44[_0x6db7('0x2a')]);_0xf87272[_0x6db7('0x2c')]=_[_0x6db7('0x2d')](_0xf87272[_0x6db7('0x29')],_0xf87272[_0x6db7('0x2a')]);_0x2a44c1[_0x6db7('0x2e')]=_['intersection'](_0xf87272['model'],qs[_0x6db7('0x2f')](_0x541d44[_0x6db7('0x2a')][_0x6db7('0x2f')]));_0x2a44c1[_0x6db7('0x2e')]=_0x2a44c1[_0x6db7('0x2e')]['length']?_0x2a44c1[_0x6db7('0x2e')]:_0xf87272[_0x6db7('0x29')];if(!_0x541d44[_0x6db7('0x2a')][_0x6db7('0x30')]('nolimit')){_0x2a44c1[_0x6db7('0x31')]=qs['limit'](_0x541d44[_0x6db7('0x2a')][_0x6db7('0x31')]);_0x2a44c1['offset']=qs[_0x6db7('0x1b')](_0x541d44[_0x6db7('0x2a')][_0x6db7('0x1b')]);}_0x2a44c1[_0x6db7('0x32')]=qs['sort'](_0x541d44[_0x6db7('0x2a')][_0x6db7('0x33')]);_0x2a44c1[_0x6db7('0x34')]=qs['filters'](_[_0x6db7('0x35')](_0x541d44[_0x6db7('0x2a')],_0xf87272['filters']),_0x232507);if(_0x541d44[_0x6db7('0x2a')][_0x6db7('0x36')]){_0x2a44c1[_0x6db7('0x34')]=_[_0x6db7('0x37')](_0x2a44c1[_0x6db7('0x34')],{'$or':_[_0x6db7('0x24')](_0x232507,function(_0x513a73){if(_0x513a73[_0x6db7('0x27')]!==_0x6db7('0x38')){var _0x436908={};_0x436908[_0x513a73[_0x6db7('0x23')]]={'$like':'%'+_0x541d44['query']['filter']+'%'};return _0x436908;}})});}_0x2a44c1=_[_0x6db7('0x37')]({},_0x2a44c1,_0x541d44[_0x6db7('0x39')]);var _0x3e5a61={'where':_0x2a44c1['where']};return db['MailServerOut'][_0x6db7('0x1a')](_0x3e5a61)[_0x6db7('0x21')](function(_0x42d5fe){_0x259505['count']=_0x42d5fe;if(_0x541d44['query']['includeAll']){_0x2a44c1[_0x6db7('0x3a')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x2a44c1);})[_0x6db7('0x21')](function(_0x330234){_0x259505[_0x6db7('0x3b')]=_0x330234;return _0x259505;})['then'](respondWithFilteredResult(_0x221eb8,_0x2a44c1))['catch'](handleError(_0x221eb8,null));};exports[_0x6db7('0x3c')]=function(_0x511e36,_0x3006ac){var _0x18456b={'raw':!![],'where':{'id':_0x511e36[_0x6db7('0x3d')]['id']}},_0x220eb2={};_0x220eb2[_0x6db7('0x29')]=_['keys'](db[_0x6db7('0x25')][_0x6db7('0x26')]);_0x220eb2[_0x6db7('0x2a')]=_[_0x6db7('0x2b')](_0x511e36[_0x6db7('0x2a')]);_0x220eb2[_0x6db7('0x2c')]=_[_0x6db7('0x2d')](_0x220eb2[_0x6db7('0x29')],_0x220eb2[_0x6db7('0x2a')]);_0x18456b['attributes']=_[_0x6db7('0x2d')](_0x220eb2[_0x6db7('0x29')],qs['fields'](_0x511e36[_0x6db7('0x2a')]['fields']));_0x18456b[_0x6db7('0x2e')]=_0x18456b[_0x6db7('0x2e')][_0x6db7('0x3e')]?_0x18456b[_0x6db7('0x2e')]:_0x220eb2[_0x6db7('0x29')];if(_0x511e36[_0x6db7('0x2a')][_0x6db7('0x3f')]){_0x18456b[_0x6db7('0x3a')]=[{'all':!![]}];}_0x18456b=_['merge']({},_0x18456b,_0x511e36[_0x6db7('0x39')]);return db[_0x6db7('0x25')][_0x6db7('0x40')](_0x18456b)[_0x6db7('0x21')](handleEntityNotFound(_0x3006ac,null))[_0x6db7('0x21')](respondWithResult(_0x3006ac,null))['catch'](handleError(_0x3006ac,null));};exports[_0x6db7('0x41')]=function(_0x112b6d,_0x213a1f){return db[_0x6db7('0x25')][_0x6db7('0x41')](_0x112b6d['body'],{})[_0x6db7('0x21')](respondWithResult(_0x213a1f,0xc9))[_0x6db7('0x42')](handleError(_0x213a1f,null));};exports[_0x6db7('0x20')]=function(_0x2443ad,_0x1e2e7a){if(_0x2443ad[_0x6db7('0x43')]['id']){delete _0x2443ad[_0x6db7('0x43')]['id'];}return db[_0x6db7('0x25')][_0x6db7('0x40')]({'where':{'id':_0x2443ad[_0x6db7('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1e2e7a,null))[_0x6db7('0x21')](saveUpdates(_0x2443ad[_0x6db7('0x43')],null))[_0x6db7('0x21')](respondWithResult(_0x1e2e7a,null))[_0x6db7('0x42')](handleError(_0x1e2e7a,null));};exports[_0x6db7('0x44')]=function(_0x4b6c8b,_0x3094af){return db['MailServerOut'][_0x6db7('0x40')]({'where':{'id':_0x4b6c8b['params']['id']}})[_0x6db7('0x21')](handleEntityNotFound(_0x3094af,null))[_0x6db7('0x21')](removeEntity(_0x3094af,null))['catch'](handleError(_0x3094af,null));}; \ No newline at end of file +var _0xe34e=['destroy','sendStatus','name','MailServerOut','rawAttributes','fieldName','type','key','model','map','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','end','status','count','offset','limit','Content-Range','json','reject','save','update','then'];(function(_0x557bf4,_0x1f8dad){var _0x2916e2=function(_0x4fef9b){while(--_0x4fef9b){_0x557bf4['push'](_0x557bf4['shift']());}};_0x2916e2(++_0x1f8dad);}(_0xe34e,0x132));var _0xee34=function(_0xfda64b,_0xf36124){_0xfda64b=_0xfda64b-0x0;var _0x17fca6=_0xe34e[_0xfda64b];return _0x17fca6;};'use strict';var pdf=require(_0xee34('0x0'));var emlformat=require(_0xee34('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xee34('0x2'));var jsonpatch=require(_0xee34('0x3'));var rp=require(_0xee34('0x4'));var moment=require(_0xee34('0x5'));var BPromise=require(_0xee34('0x6'));var Mustache=require(_0xee34('0x7'));var util=require(_0xee34('0x8'));var path=require(_0xee34('0x9'));var sox=require('sox');var csv=require(_0xee34('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xee34('0xb'));var squel=require(_0xee34('0xc'));var crypto=require(_0xee34('0xd'));var jsforce=require(_0xee34('0xe'));var deskjs=require(_0xee34('0xf'));var toCsv=require(_0xee34('0xa'));var querystring=require(_0xee34('0x10'));var Papa=require('papaparse');var Redis=require(_0xee34('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xee34('0x12'));var as=require(_0xee34('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee34('0x14'));var utils=require(_0xee34('0x15'));var config=require(_0xee34('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2819bf,_0x44596b){_0x44596b=_0x44596b||0xcc;return function(_0x12d713){if(_0x12d713){return _0x2819bf['sendStatus'](_0x44596b);}return _0x2819bf['status'](_0x44596b)[_0xee34('0x17')]();};}function respondWithResult(_0x3c7abb,_0x400538){_0x400538=_0x400538||0xc8;return function(_0x4cecf3){if(_0x4cecf3){return _0x3c7abb[_0xee34('0x18')](_0x400538)['json'](_0x4cecf3);}};}function respondWithFilteredResult(_0x371c45,_0x3ed07b){return function(_0x13253e){if(_0x13253e){var _0x57a0b2=_0x13253e[_0xee34('0x19')],_0x2da852=_0x3ed07b['offset'],_0x2c1f19=_0x3ed07b[_0xee34('0x1a')]+_0x3ed07b[_0xee34('0x1b')],_0x3455a4;if(_0x2c1f19>=_0x57a0b2){_0x2c1f19=_0x57a0b2;_0x3455a4=0xc8;}else{_0x3455a4=0xce;}_0x371c45[_0xee34('0x18')](_0x3455a4);return _0x371c45['set'](_0xee34('0x1c'),_0x2da852+'-'+_0x2c1f19+'/'+_0x57a0b2)[_0xee34('0x1d')](_0x13253e);}return null;};}function patchUpdates(_0xfdb0c1){return function(_0x56ed58){try{jsonpatch['apply'](_0x56ed58,_0xfdb0c1,!![]);}catch(_0x2d2c24){return BPromise[_0xee34('0x1e')](_0x2d2c24);}return _0x56ed58[_0xee34('0x1f')]();};}function saveUpdates(_0x332ccc,_0x1fdad4){return function(_0x3babec){if(_0x3babec){return _0x3babec[_0xee34('0x20')](_0x332ccc)[_0xee34('0x21')](function(_0xd66e5e){return _0xd66e5e;});}return null;};}function removeEntity(_0x520d9a,_0x158845){return function(_0x267863){if(_0x267863){return _0x267863[_0xee34('0x22')]()[_0xee34('0x21')](function(){_0x520d9a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x495e62,_0x24b072){return function(_0x13cd62){if(!_0x13cd62){_0x495e62[_0xee34('0x23')](0x194);}return _0x13cd62;};}function handleError(_0x5c55c7,_0x43e1d4){_0x43e1d4=_0x43e1d4||0x1f4;return function(_0x5b4520){logger['error'](_0x5b4520['stack']);if(_0x5b4520[_0xee34('0x24')]){delete _0x5b4520[_0xee34('0x24')];}_0x5c55c7[_0xee34('0x18')](_0x43e1d4)['send'](_0x5b4520);};}exports['index']=function(_0x512491,_0x41e8f5){var _0x29b710={},_0x323d66={},_0x2d6280={'count':0x0,'rows':[]};var _0x3637db=_['map'](db[_0xee34('0x25')][_0xee34('0x26')],function(_0x35fc50){return{'name':_0x35fc50[_0xee34('0x27')],'type':_0x35fc50[_0xee34('0x28')][_0xee34('0x29')]};});_0x323d66[_0xee34('0x2a')]=_[_0xee34('0x2b')](_0x3637db,_0xee34('0x24'));_0x323d66['query']=_['keys'](_0x512491['query']);_0x323d66['filters']=_[_0xee34('0x2c')](_0x323d66[_0xee34('0x2a')],_0x323d66[_0xee34('0x2d')]);_0x29b710[_0xee34('0x2e')]=_[_0xee34('0x2c')](_0x323d66['model'],qs[_0xee34('0x2f')](_0x512491['query'][_0xee34('0x2f')]));_0x29b710['attributes']=_0x29b710[_0xee34('0x2e')][_0xee34('0x30')]?_0x29b710[_0xee34('0x2e')]:_0x323d66[_0xee34('0x2a')];if(!_0x512491[_0xee34('0x2d')][_0xee34('0x31')](_0xee34('0x32'))){_0x29b710[_0xee34('0x1b')]=qs[_0xee34('0x1b')](_0x512491[_0xee34('0x2d')][_0xee34('0x1b')]);_0x29b710[_0xee34('0x1a')]=qs['offset'](_0x512491[_0xee34('0x2d')][_0xee34('0x1a')]);}_0x29b710['order']=qs[_0xee34('0x33')](_0x512491[_0xee34('0x2d')][_0xee34('0x33')]);_0x29b710[_0xee34('0x34')]=qs[_0xee34('0x35')](_['pick'](_0x512491[_0xee34('0x2d')],_0x323d66['filters']),_0x3637db);if(_0x512491[_0xee34('0x2d')][_0xee34('0x36')]){_0x29b710[_0xee34('0x34')]=_[_0xee34('0x37')](_0x29b710['where'],{'$or':_['map'](_0x3637db,function(_0x26e30d){if(_0x26e30d[_0xee34('0x28')]!==_0xee34('0x38')){var _0x474355={};_0x474355[_0x26e30d[_0xee34('0x24')]]={'$like':'%'+_0x512491[_0xee34('0x2d')][_0xee34('0x36')]+'%'};return _0x474355;}})});}_0x29b710=_[_0xee34('0x37')]({},_0x29b710,_0x512491[_0xee34('0x39')]);var _0x458803={'where':_0x29b710[_0xee34('0x34')]};return db[_0xee34('0x25')][_0xee34('0x19')](_0x458803)['then'](function(_0x4e276d){_0x2d6280[_0xee34('0x19')]=_0x4e276d;if(_0x512491[_0xee34('0x2d')][_0xee34('0x3a')]){_0x29b710[_0xee34('0x3b')]=[{'all':!![]}];}return db['MailServerOut'][_0xee34('0x3c')](_0x29b710);})[_0xee34('0x21')](function(_0x4ff679){_0x2d6280['rows']=_0x4ff679;return _0x2d6280;})['then'](respondWithFilteredResult(_0x41e8f5,_0x29b710))[_0xee34('0x3d')](handleError(_0x41e8f5,null));};exports[_0xee34('0x3e')]=function(_0x185685,_0x745674){var _0x511ba8={'raw':!![],'where':{'id':_0x185685[_0xee34('0x3f')]['id']}},_0x13cb55={};_0x13cb55[_0xee34('0x2a')]=_[_0xee34('0x40')](db['MailServerOut'][_0xee34('0x26')]);_0x13cb55[_0xee34('0x2d')]=_[_0xee34('0x40')](_0x185685['query']);_0x13cb55[_0xee34('0x35')]=_[_0xee34('0x2c')](_0x13cb55[_0xee34('0x2a')],_0x13cb55['query']);_0x511ba8[_0xee34('0x2e')]=_[_0xee34('0x2c')](_0x13cb55[_0xee34('0x2a')],qs['fields'](_0x185685['query'][_0xee34('0x2f')]));_0x511ba8['attributes']=_0x511ba8[_0xee34('0x2e')][_0xee34('0x30')]?_0x511ba8[_0xee34('0x2e')]:_0x13cb55[_0xee34('0x2a')];if(_0x185685[_0xee34('0x2d')][_0xee34('0x3a')]){_0x511ba8[_0xee34('0x3b')]=[{'all':!![]}];}_0x511ba8=_[_0xee34('0x37')]({},_0x511ba8,_0x185685['options']);return db['MailServerOut']['find'](_0x511ba8)[_0xee34('0x21')](handleEntityNotFound(_0x745674,null))[_0xee34('0x21')](respondWithResult(_0x745674,null))[_0xee34('0x3d')](handleError(_0x745674,null));};exports['create']=function(_0x53d812,_0x53ed31){return db[_0xee34('0x25')][_0xee34('0x41')](_0x53d812['body'],{})[_0xee34('0x21')](respondWithResult(_0x53ed31,0xc9))[_0xee34('0x3d')](handleError(_0x53ed31,null));};exports[_0xee34('0x20')]=function(_0x11628c,_0x11e4c1){if(_0x11628c[_0xee34('0x42')]['id']){delete _0x11628c[_0xee34('0x42')]['id'];}return db[_0xee34('0x25')][_0xee34('0x43')]({'where':{'id':_0x11628c[_0xee34('0x3f')]['id']}})[_0xee34('0x21')](handleEntityNotFound(_0x11e4c1,null))[_0xee34('0x21')](saveUpdates(_0x11628c['body'],null))[_0xee34('0x21')](respondWithResult(_0x11e4c1,null))[_0xee34('0x3d')](handleError(_0x11e4c1,null));};exports['destroy']=function(_0x5f1259,_0x3d1359){return db[_0xee34('0x25')]['find']({'where':{'id':_0x5f1259[_0xee34('0x3f')]['id']}})[_0xee34('0x21')](handleEntityNotFound(_0x3d1359,null))[_0xee34('0x21')](removeEntity(_0x3d1359,null))[_0xee34('0x3d')](handleError(_0x3d1359,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 406c42a..82f71ba 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 _0x4819=['mail_servers_out','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','MailServerOut'];(function(_0x5de4f0,_0x1ba1fc){var _0x5a373a=function(_0x374268){while(--_0x374268){_0x5de4f0['push'](_0x5de4f0['shift']());}};_0x5a373a(++_0x1ba1fc);}(_0x4819,0xcd));var _0x9481=function(_0xa3d9a7,_0x1cf219){_0xa3d9a7=_0xa3d9a7-0x0;var _0x48080a=_0x4819[_0xa3d9a7];return _0x48080a;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2675=['lodash','moment','bluebird','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x319df2,_0x4085fb){var _0x41f9df=function(_0x8b9a53){while(--_0x8b9a53){_0x319df2['push'](_0x319df2['shift']());}};_0x41f9df(++_0x4085fb);}(_0x2675,0x75));var _0x5267=function(_0x422e20,_0x9b34ed){_0x422e20=_0x422e20-0x0;var _0x2bbfed=_0x2675[_0x422e20];return _0x2bbfed;};'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':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 41f5509..8d2ef8f 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 _0xb63e=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x4cbc64,_0x33d398){var _0x5086fc=function(_0x576268){while(--_0x576268){_0x4cbc64['push'](_0x4cbc64['shift']());}};_0x5086fc(++_0x33d398);}(_0xb63e,0x64));var _0xeb63=function(_0x250649,_0x2a8170){_0x250649=_0x250649-0x0;var _0x14a081=_0xb63e[_0x250649];return _0x14a081;};'use strict';var _=require(_0xeb63('0x0'));var util=require('util');var moment=require(_0xeb63('0x1'));var BPromise=require('bluebird');var rs=require(_0xeb63('0x2'));var fs=require('fs');var Redis=require(_0xeb63('0x3'));var db=require(_0xeb63('0x4'))['db'];var utils=require(_0xeb63('0x5'));var logger=require(_0xeb63('0x6'))(_0xeb63('0x7'));var config=require(_0xeb63('0x8'));var jayson=require(_0xeb63('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x160897,_0x515f89,_0x47160a){return new BPromise(function(_0x3e77f3,_0x5dc652){return client['request'](_0x160897,_0x47160a)[_0xeb63('0xa')](function(_0x4da85f){logger[_0xeb63('0xb')](_0xeb63('0xc'),_0x515f89,'request\x20sent');logger['debug'](_0xeb63('0xd'),_0x515f89,_0xeb63('0xe'),JSON[_0xeb63('0xf')](_0x4da85f));if(_0x4da85f['error']){if(_0x4da85f[_0xeb63('0x10')]['code']===0x1f4){logger[_0xeb63('0x10')](_0xeb63('0xc'),_0x515f89,_0x4da85f['error'][_0xeb63('0x11')]);return _0x5dc652(_0x4da85f['error']['message']);}logger[_0xeb63('0x10')](_0xeb63('0xc'),_0x515f89,_0x4da85f[_0xeb63('0x10')][_0xeb63('0x11')]);return _0x3e77f3(_0x4da85f[_0xeb63('0x10')][_0xeb63('0x11')]);}else{logger[_0xeb63('0xb')]('MailServerOut,\x20%s,\x20%s',_0x515f89,_0xeb63('0xe'));_0x3e77f3(_0x4da85f[_0xeb63('0x12')][_0xeb63('0x11')]);}})[_0xeb63('0x13')](function(_0x2cb4dd){logger[_0xeb63('0x10')]('MailServerOut,\x20%s,\x20%s',_0x515f89,_0x2cb4dd);_0x5dc652(_0x2cb4dd);});});} \ No newline at end of file +var _0xa9e5=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3093b2,_0x12813e){var _0x50cd44=function(_0x55ff1e){while(--_0x55ff1e){_0x3093b2['push'](_0x3093b2['shift']());}};_0x50cd44(++_0x12813e);}(_0xa9e5,0xf6));var _0x5a9e=function(_0x410055,_0x2b0f49){_0x410055=_0x410055-0x0;var _0x8c4fb6=_0xa9e5[_0x410055];return _0x8c4fb6;};'use strict';var _=require(_0x5a9e('0x0'));var util=require(_0x5a9e('0x1'));var moment=require(_0x5a9e('0x2'));var BPromise=require(_0x5a9e('0x3'));var rs=require(_0x5a9e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a9e('0x5'))['db'];var utils=require(_0x5a9e('0x6'));var logger=require(_0x5a9e('0x7'))('rpc');var config=require(_0x5a9e('0x8'));var jayson=require(_0x5a9e('0x9'));var client=jayson[_0x5a9e('0xa')][_0x5a9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e9501,_0x5572b6,_0x3b36a1){return new BPromise(function(_0x50e9d1,_0x5ae294){return client[_0x5a9e('0xc')](_0x5e9501,_0x3b36a1)[_0x5a9e('0xd')](function(_0x209ca9){logger[_0x5a9e('0xe')](_0x5a9e('0xf'),_0x5572b6,_0x5a9e('0x10'));logger[_0x5a9e('0x11')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x5572b6,_0x5a9e('0x10'),JSON[_0x5a9e('0x12')](_0x209ca9));if(_0x209ca9[_0x5a9e('0x13')]){if(_0x209ca9[_0x5a9e('0x13')][_0x5a9e('0x14')]===0x1f4){logger[_0x5a9e('0x13')]('MailServerOut,\x20%s,\x20%s',_0x5572b6,_0x209ca9[_0x5a9e('0x13')][_0x5a9e('0x15')]);return _0x5ae294(_0x209ca9[_0x5a9e('0x13')][_0x5a9e('0x15')]);}logger[_0x5a9e('0x13')](_0x5a9e('0xf'),_0x5572b6,_0x209ca9[_0x5a9e('0x13')]['message']);return _0x50e9d1(_0x209ca9[_0x5a9e('0x13')][_0x5a9e('0x15')]);}else{logger[_0x5a9e('0xe')](_0x5a9e('0xf'),_0x5572b6,_0x5a9e('0x10'));_0x50e9d1(_0x209ca9[_0x5a9e('0x16')]['message']);}})[_0x5a9e('0x17')](function(_0x30702e){logger[_0x5a9e('0x13')]('MailServerOut,\x20%s,\x20%s',_0x5572b6,_0x30702e);_0x5ae294(_0x30702e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 855fc9d..deb6fa4 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 _0x5df3=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','/describe','describe','get','/:id','show','post','create','put','update','delete'];(function(_0x3fd204,_0x39cd71){var _0x3de8ef=function(_0x46a6d7){while(--_0x46a6d7){_0x3fd204['push'](_0x3fd204['shift']());}};_0x3de8ef(++_0x39cd71);}(_0x5df3,0x136));var _0x35df=function(_0x1ee477,_0xe2f0a2){_0x1ee477=_0x1ee477-0x0;var _0x33ce18=_0x5df3[_0x1ee477];return _0x33ce18;};'use strict';var multer=require('multer');var util=require(_0x35df('0x0'));var path=require(_0x35df('0x1'));var timeout=require(_0x35df('0x2'));var express=require(_0x35df('0x3'));var router=express[_0x35df('0x4')]();var auth=require(_0x35df('0x5'));var interaction=require(_0x35df('0x6'));var config=require(_0x35df('0x7'));var controller=require(_0x35df('0x8'));router['get']('/',auth[_0x35df('0x9')](),controller['index']);router['get'](_0x35df('0xa'),auth[_0x35df('0x9')](),controller[_0x35df('0xb')]);router[_0x35df('0xc')](_0x35df('0xd'),auth[_0x35df('0x9')](),controller[_0x35df('0xe')]);router[_0x35df('0xf')]('/',auth['isAuthenticated'](),controller[_0x35df('0x10')]);router[_0x35df('0x11')]('/:id',auth[_0x35df('0x9')](),controller[_0x35df('0x12')]);router[_0x35df('0x13')](_0x35df('0xd'),auth[_0x35df('0x9')](),controller[_0x35df('0x14')]);module[_0x35df('0x15')]=router; \ No newline at end of file +var _0x730a=['../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','describe','show','post','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x8d695e,_0x394999){var _0x3d156e=function(_0x38cf6f){while(--_0x38cf6f){_0x8d695e['push'](_0x8d695e['shift']());}};_0x3d156e(++_0x394999);}(_0x730a,0x12d));var _0xa730=function(_0xe695fa,_0x387982){_0xe695fa=_0xe695fa-0x0;var _0x48660b=_0x730a[_0xe695fa];return _0x48660b;};'use strict';var multer=require(_0xa730('0x0'));var util=require(_0xa730('0x1'));var path=require('path');var timeout=require(_0xa730('0x2'));var express=require(_0xa730('0x3'));var router=express[_0xa730('0x4')]();var auth=require(_0xa730('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa730('0x6'));var controller=require(_0xa730('0x7'));router[_0xa730('0x8')]('/',auth[_0xa730('0x9')](),controller['index']);router[_0xa730('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa730('0xa')]);router[_0xa730('0x8')]('/:id',auth[_0xa730('0x9')](),controller[_0xa730('0xb')]);router[_0xa730('0xc')]('/',auth[_0xa730('0x9')](),controller['create']);router[_0xa730('0xd')](_0xa730('0xe'),auth[_0xa730('0x9')](),controller[_0xa730('0xf')]);router[_0xa730('0x10')]('/:id',auth[_0xa730('0x9')](),controller['destroy']);module[_0xa730('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 21860a5..d92b7b3 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 _0x50a5=['exports','sequelize'];(function(_0x15f031,_0x4780eb){var _0x819b53=function(_0xdfa929){while(--_0xdfa929){_0x15f031['push'](_0x15f031['shift']());}};_0x819b53(++_0x4780eb);}(_0x50a5,0xd1));var _0x550a=function(_0x2c7563,_0x339771){_0x2c7563=_0x2c7563-0x0;var _0x5e3c13=_0x50a5[_0x2c7563];return _0x5e3c13;};'use strict';var Sequelize=require(_0x550a('0x0'));module[_0x550a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfb67=['name','sequelize','exports','STRING'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0xfb67,0xdd));var _0x7fb6=function(_0x89d10,_0x3fad8e){_0x89d10=_0x89d10-0x0;var _0x546129=_0xfb67[_0x89d10];return _0x546129;};'use strict';var Sequelize=require(_0x7fb6('0x0'));module[_0x7fb6('0x1')]={'name':{'type':Sequelize[_0x7fb6('0x2')],'unique':_0x7fb6('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7fb6('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index e2a962b..7448021 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 _0x0afa=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','params','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','desk.js'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0afa,0x7b));var _0xa0af=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x0afa[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0xa0af('0x0'));var emlformat=require(_0xa0af('0x1'));var rimraf=require(_0xa0af('0x2'));var zipdir=require(_0xa0af('0x3'));var jsonpatch=require(_0xa0af('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa0af('0x5'));var Mustache=require(_0xa0af('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa0af('0x7'));var ejs=require(_0xa0af('0x8'));var fs=require('fs');var _=require(_0xa0af('0x9'));var squel=require(_0xa0af('0xa'));var crypto=require(_0xa0af('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa0af('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa0af('0xd'));var Papa=require(_0xa0af('0xe'));var Redis=require(_0xa0af('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa0af('0x10'));var as=require(_0xa0af('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa0af('0x12'));var db=require(_0xa0af('0x13'))['db'];function respondWithStatusCode(_0x439b10,_0x8b23d){_0x8b23d=_0x8b23d||0xcc;return function(_0x9a0a80){if(_0x9a0a80){return _0x439b10['sendStatus'](_0x8b23d);}return _0x439b10[_0xa0af('0x14')](_0x8b23d)[_0xa0af('0x15')]();};}function respondWithResult(_0x497c6f,_0x2bb8c7){_0x2bb8c7=_0x2bb8c7||0xc8;return function(_0x31d701){if(_0x31d701){return _0x497c6f[_0xa0af('0x14')](_0x2bb8c7)[_0xa0af('0x16')](_0x31d701);}};}function respondWithFilteredResult(_0x3ec90d,_0x4cc029){return function(_0x5e3e69){if(_0x5e3e69){var _0x2adfe0=_0x5e3e69['count'],_0x5573b2=_0x4cc029[_0xa0af('0x17')],_0x1b3e4d=_0x4cc029['offset']+_0x4cc029['limit'],_0x4fe8c4;if(_0x1b3e4d>=_0x2adfe0){_0x1b3e4d=_0x2adfe0;_0x4fe8c4=0xc8;}else{_0x4fe8c4=0xce;}_0x3ec90d[_0xa0af('0x14')](_0x4fe8c4);return _0x3ec90d[_0xa0af('0x18')](_0xa0af('0x19'),_0x5573b2+'-'+_0x1b3e4d+'/'+_0x2adfe0)[_0xa0af('0x16')](_0x5e3e69);}return null;};}function patchUpdates(_0x5ad9f6){return function(_0x1c1b9c){try{jsonpatch[_0xa0af('0x1a')](_0x1c1b9c,_0x5ad9f6,!![]);}catch(_0x529794){return BPromise[_0xa0af('0x1b')](_0x529794);}return _0x1c1b9c[_0xa0af('0x1c')]();};}function saveUpdates(_0x355b12,_0x2926b3){return function(_0x1a32af){if(_0x1a32af){return _0x1a32af[_0xa0af('0x1d')](_0x355b12)[_0xa0af('0x1e')](function(_0x524b1d){return _0x524b1d;});}return null;};}function removeEntity(_0x264311,_0x349894){return function(_0x1ce4cf){if(_0x1ce4cf){return _0x1ce4cf[_0xa0af('0x1f')]()[_0xa0af('0x1e')](function(){_0x264311[_0xa0af('0x14')](0xcc)[_0xa0af('0x15')]();});}};}function handleEntityNotFound(_0x42d690,_0x4c4723){return function(_0x2c64e4){if(!_0x2c64e4){_0x42d690[_0xa0af('0x20')](0x194);}return _0x2c64e4;};}function handleError(_0x11c177,_0x2ec9cf){_0x2ec9cf=_0x2ec9cf||0x1f4;return function(_0x12f64b){logger['error'](_0x12f64b[_0xa0af('0x21')]);if(_0x12f64b[_0xa0af('0x22')]){delete _0x12f64b[_0xa0af('0x22')];}_0x11c177[_0xa0af('0x14')](_0x2ec9cf)[_0xa0af('0x23')](_0x12f64b);};}exports[_0xa0af('0x24')]=function(_0x4bebc5,_0x14f63f){var _0x25d7ca={},_0x59035e={},_0x240d8a={'count':0x0,'rows':[]};var _0x20e068=_[_0xa0af('0x25')](db[_0xa0af('0x26')][_0xa0af('0x27')],function(_0x1ac66d){return{'name':_0x1ac66d[_0xa0af('0x28')],'type':_0x1ac66d['type'][_0xa0af('0x29')]};});_0x59035e[_0xa0af('0x2a')]=_['map'](_0x20e068,_0xa0af('0x22'));_0x59035e['query']=_[_0xa0af('0x2b')](_0x4bebc5[_0xa0af('0x2c')]);_0x59035e[_0xa0af('0x2d')]=_['intersection'](_0x59035e[_0xa0af('0x2a')],_0x59035e['query']);_0x25d7ca['attributes']=_[_0xa0af('0x2e')](_0x59035e[_0xa0af('0x2a')],qs[_0xa0af('0x2f')](_0x4bebc5[_0xa0af('0x2c')][_0xa0af('0x2f')]));_0x25d7ca[_0xa0af('0x30')]=_0x25d7ca[_0xa0af('0x30')][_0xa0af('0x31')]?_0x25d7ca['attributes']:_0x59035e[_0xa0af('0x2a')];if(!_0x4bebc5['query']['hasOwnProperty'](_0xa0af('0x32'))){_0x25d7ca[_0xa0af('0x33')]=qs['limit'](_0x4bebc5[_0xa0af('0x2c')][_0xa0af('0x33')]);_0x25d7ca[_0xa0af('0x17')]=qs['offset'](_0x4bebc5[_0xa0af('0x2c')]['offset']);}_0x25d7ca[_0xa0af('0x34')]=qs['sort'](_0x4bebc5[_0xa0af('0x2c')]['sort']);_0x25d7ca[_0xa0af('0x35')]=qs[_0xa0af('0x2d')](_[_0xa0af('0x36')](_0x4bebc5[_0xa0af('0x2c')],_0x59035e[_0xa0af('0x2d')]),_0x20e068);if(_0x4bebc5[_0xa0af('0x2c')][_0xa0af('0x37')]){_0x25d7ca['where']=_[_0xa0af('0x38')](_0x25d7ca[_0xa0af('0x35')],{'$or':_[_0xa0af('0x25')](_0x20e068,function(_0x562050){if(_0x562050['type']!==_0xa0af('0x39')){var _0x1dd6e5={};_0x1dd6e5[_0x562050['name']]={'$like':'%'+_0x4bebc5[_0xa0af('0x2c')][_0xa0af('0x37')]+'%'};return _0x1dd6e5;}})});}_0x25d7ca=_[_0xa0af('0x38')]({},_0x25d7ca,_0x4bebc5[_0xa0af('0x3a')]);var _0x53dd7c={'where':_0x25d7ca['where']};return db['MailSubstatus'][_0xa0af('0x3b')](_0x53dd7c)[_0xa0af('0x1e')](function(_0x59528f){_0x240d8a[_0xa0af('0x3b')]=_0x59528f;if(_0x4bebc5[_0xa0af('0x2c')][_0xa0af('0x3c')]){_0x25d7ca['include']=[{'all':!![]}];}return db[_0xa0af('0x26')]['findAll'](_0x25d7ca);})[_0xa0af('0x1e')](function(_0x49a9fb){_0x240d8a[_0xa0af('0x3d')]=_0x49a9fb;return _0x240d8a;})[_0xa0af('0x1e')](respondWithFilteredResult(_0x14f63f,_0x25d7ca))[_0xa0af('0x3e')](handleError(_0x14f63f,null));};exports['show']=function(_0x4c9eca,_0x5ddf27){var _0x2e7155={'raw':!![],'where':{'id':_0x4c9eca[_0xa0af('0x3f')]['id']}},_0x137f24={};_0x137f24[_0xa0af('0x2a')]=_['keys'](db[_0xa0af('0x26')][_0xa0af('0x27')]);_0x137f24[_0xa0af('0x2c')]=_['keys'](_0x4c9eca['query']);_0x137f24[_0xa0af('0x2d')]=_[_0xa0af('0x2e')](_0x137f24[_0xa0af('0x2a')],_0x137f24['query']);_0x2e7155[_0xa0af('0x30')]=_[_0xa0af('0x2e')](_0x137f24[_0xa0af('0x2a')],qs[_0xa0af('0x2f')](_0x4c9eca[_0xa0af('0x2c')]['fields']));_0x2e7155['attributes']=_0x2e7155[_0xa0af('0x30')][_0xa0af('0x31')]?_0x2e7155[_0xa0af('0x30')]:_0x137f24['model'];if(_0x4c9eca['query']['includeAll']){_0x2e7155['include']=[{'all':!![]}];}_0x2e7155=_[_0xa0af('0x38')]({},_0x2e7155,_0x4c9eca[_0xa0af('0x3a')]);return db[_0xa0af('0x26')]['find'](_0x2e7155)['then'](handleEntityNotFound(_0x5ddf27,null))['then'](respondWithResult(_0x5ddf27,null))[_0xa0af('0x3e')](handleError(_0x5ddf27,null));};exports['create']=function(_0x5ee41a,_0x2eef18){return db[_0xa0af('0x26')][_0xa0af('0x40')](_0x5ee41a['body'],{})[_0xa0af('0x1e')](respondWithResult(_0x2eef18,0xc9))[_0xa0af('0x3e')](handleError(_0x2eef18,null));};exports[_0xa0af('0x1d')]=function(_0x1c1539,_0x115c6a){if(_0x1c1539[_0xa0af('0x41')]['id']){delete _0x1c1539[_0xa0af('0x41')]['id'];}return db[_0xa0af('0x26')][_0xa0af('0x42')]({'where':{'id':_0x1c1539[_0xa0af('0x3f')]['id']}})[_0xa0af('0x1e')](handleEntityNotFound(_0x115c6a,null))[_0xa0af('0x1e')](saveUpdates(_0x1c1539['body'],null))['then'](respondWithResult(_0x115c6a,null))[_0xa0af('0x3e')](handleError(_0x115c6a,null));};exports[_0xa0af('0x1f')]=function(_0x550bf4,_0x26f726){return db[_0xa0af('0x26')][_0xa0af('0x42')]({'where':{'id':_0x550bf4['params']['id']}})[_0xa0af('0x1e')](handleEntityNotFound(_0x26f726,null))['then'](removeEntity(_0x26f726,null))[_0xa0af('0x3e')](handleError(_0x26f726,null));};exports['describe']=function(_0x1035ad,_0xe8bb71){return db[_0xa0af('0x26')][_0xa0af('0x43')]()[_0xa0af('0x1e')](respondWithResult(_0xe8bb71,null))['catch'](handleError(_0xe8bb71,null));}; \ No newline at end of file +var _0xe7d5=['count','offset','limit','set','Content-Range','apply','reject','destroy','stack','send','index','map','MailSubstatus','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','then','includeAll','include','findAll','catch','show','params','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json'];(function(_0xd6c8ef,_0x545332){var _0x718cc6=function(_0x4fe004){while(--_0x4fe004){_0xd6c8ef['push'](_0xd6c8ef['shift']());}};_0x718cc6(++_0x545332);}(_0xe7d5,0xc1));var _0x5e7d=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xe7d5[_0x2a6809];return _0x11c371;};'use strict';var pdf=require(_0x5e7d('0x0'));var emlformat=require(_0x5e7d('0x1'));var rimraf=require(_0x5e7d('0x2'));var zipdir=require(_0x5e7d('0x3'));var jsonpatch=require(_0x5e7d('0x4'));var rp=require(_0x5e7d('0x5'));var moment=require(_0x5e7d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5e7d('0x7'));var util=require('util');var path=require(_0x5e7d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5e7d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5e7d('0xa'));var deskjs=require(_0x5e7d('0xb'));var toCsv=require(_0x5e7d('0xc'));var querystring=require(_0x5e7d('0xd'));var Papa=require(_0x5e7d('0xe'));var Redis=require(_0x5e7d('0xf'));var authService=require(_0x5e7d('0x10'));var qs=require(_0x5e7d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e7d('0x12'));var logger=require(_0x5e7d('0x13'))('api');var utils=require(_0x5e7d('0x14'));var config=require('../../config/environment');var db=require(_0x5e7d('0x15'))['db'];function respondWithStatusCode(_0x4dfe17,_0x558cce){_0x558cce=_0x558cce||0xcc;return function(_0xb35077){if(_0xb35077){return _0x4dfe17[_0x5e7d('0x16')](_0x558cce);}return _0x4dfe17[_0x5e7d('0x17')](_0x558cce)[_0x5e7d('0x18')]();};}function respondWithResult(_0x4f1a40,_0x395e66){_0x395e66=_0x395e66||0xc8;return function(_0x573e88){if(_0x573e88){return _0x4f1a40[_0x5e7d('0x17')](_0x395e66)[_0x5e7d('0x19')](_0x573e88);}};}function respondWithFilteredResult(_0x55bb2d,_0x22369c){return function(_0x2f6f33){if(_0x2f6f33){var _0x150818=_0x2f6f33[_0x5e7d('0x1a')],_0x18d7b7=_0x22369c[_0x5e7d('0x1b')],_0x1ed8bd=_0x22369c[_0x5e7d('0x1b')]+_0x22369c[_0x5e7d('0x1c')],_0x4f4e4e;if(_0x1ed8bd>=_0x150818){_0x1ed8bd=_0x150818;_0x4f4e4e=0xc8;}else{_0x4f4e4e=0xce;}_0x55bb2d[_0x5e7d('0x17')](_0x4f4e4e);return _0x55bb2d[_0x5e7d('0x1d')](_0x5e7d('0x1e'),_0x18d7b7+'-'+_0x1ed8bd+'/'+_0x150818)['json'](_0x2f6f33);}return null;};}function patchUpdates(_0xa4cf6e){return function(_0x8ebb6b){try{jsonpatch[_0x5e7d('0x1f')](_0x8ebb6b,_0xa4cf6e,!![]);}catch(_0x4270b2){return BPromise[_0x5e7d('0x20')](_0x4270b2);}return _0x8ebb6b['save']();};}function saveUpdates(_0x1845b6,_0x207f2d){return function(_0x5d17ac){if(_0x5d17ac){return _0x5d17ac['update'](_0x1845b6)['then'](function(_0x148cfb){return _0x148cfb;});}return null;};}function removeEntity(_0x5da502,_0x5be5b1){return function(_0x6a88ff){if(_0x6a88ff){return _0x6a88ff[_0x5e7d('0x21')]()['then'](function(){_0x5da502[_0x5e7d('0x17')](0xcc)[_0x5e7d('0x18')]();});}};}function handleEntityNotFound(_0x2ffdee,_0x1391ef){return function(_0xea603d){if(!_0xea603d){_0x2ffdee[_0x5e7d('0x16')](0x194);}return _0xea603d;};}function handleError(_0x523fe9,_0x237e24){_0x237e24=_0x237e24||0x1f4;return function(_0x29fd67){logger['error'](_0x29fd67[_0x5e7d('0x22')]);if(_0x29fd67['name']){delete _0x29fd67['name'];}_0x523fe9[_0x5e7d('0x17')](_0x237e24)[_0x5e7d('0x23')](_0x29fd67);};}exports[_0x5e7d('0x24')]=function(_0x572762,_0x3b1343){var _0x49bd45={},_0x4e0897={},_0x178352={'count':0x0,'rows':[]};var _0x15c185=_[_0x5e7d('0x25')](db[_0x5e7d('0x26')][_0x5e7d('0x27')],function(_0x31f0ec){return{'name':_0x31f0ec[_0x5e7d('0x28')],'type':_0x31f0ec['type'][_0x5e7d('0x29')]};});_0x4e0897[_0x5e7d('0x2a')]=_[_0x5e7d('0x25')](_0x15c185,_0x5e7d('0x2b'));_0x4e0897[_0x5e7d('0x2c')]=_[_0x5e7d('0x2d')](_0x572762[_0x5e7d('0x2c')]);_0x4e0897[_0x5e7d('0x2e')]=_[_0x5e7d('0x2f')](_0x4e0897[_0x5e7d('0x2a')],_0x4e0897['query']);_0x49bd45[_0x5e7d('0x30')]=_[_0x5e7d('0x2f')](_0x4e0897['model'],qs[_0x5e7d('0x31')](_0x572762[_0x5e7d('0x2c')]['fields']));_0x49bd45['attributes']=_0x49bd45['attributes'][_0x5e7d('0x32')]?_0x49bd45[_0x5e7d('0x30')]:_0x4e0897[_0x5e7d('0x2a')];if(!_0x572762[_0x5e7d('0x2c')][_0x5e7d('0x33')](_0x5e7d('0x34'))){_0x49bd45[_0x5e7d('0x1c')]=qs[_0x5e7d('0x1c')](_0x572762['query'][_0x5e7d('0x1c')]);_0x49bd45[_0x5e7d('0x1b')]=qs[_0x5e7d('0x1b')](_0x572762[_0x5e7d('0x2c')]['offset']);}_0x49bd45[_0x5e7d('0x35')]=qs[_0x5e7d('0x36')](_0x572762[_0x5e7d('0x2c')]['sort']);_0x49bd45[_0x5e7d('0x37')]=qs[_0x5e7d('0x2e')](_[_0x5e7d('0x38')](_0x572762[_0x5e7d('0x2c')],_0x4e0897[_0x5e7d('0x2e')]),_0x15c185);if(_0x572762[_0x5e7d('0x2c')][_0x5e7d('0x39')]){_0x49bd45['where']=_[_0x5e7d('0x3a')](_0x49bd45[_0x5e7d('0x37')],{'$or':_[_0x5e7d('0x25')](_0x15c185,function(_0x1048aa){if(_0x1048aa[_0x5e7d('0x3b')]!==_0x5e7d('0x3c')){var _0x19b748={};_0x19b748[_0x1048aa['name']]={'$like':'%'+_0x572762[_0x5e7d('0x2c')][_0x5e7d('0x39')]+'%'};return _0x19b748;}})});}_0x49bd45=_[_0x5e7d('0x3a')]({},_0x49bd45,_0x572762['options']);var _0x2c9c1e={'where':_0x49bd45[_0x5e7d('0x37')]};return db[_0x5e7d('0x26')]['count'](_0x2c9c1e)[_0x5e7d('0x3d')](function(_0x5f3619){_0x178352['count']=_0x5f3619;if(_0x572762[_0x5e7d('0x2c')][_0x5e7d('0x3e')]){_0x49bd45[_0x5e7d('0x3f')]=[{'all':!![]}];}return db[_0x5e7d('0x26')][_0x5e7d('0x40')](_0x49bd45);})[_0x5e7d('0x3d')](function(_0x9514cd){_0x178352['rows']=_0x9514cd;return _0x178352;})[_0x5e7d('0x3d')](respondWithFilteredResult(_0x3b1343,_0x49bd45))[_0x5e7d('0x41')](handleError(_0x3b1343,null));};exports[_0x5e7d('0x42')]=function(_0x108e4f,_0x20c11a){var _0x1e74d1={'raw':!![],'where':{'id':_0x108e4f[_0x5e7d('0x43')]['id']}},_0x28363f={};_0x28363f[_0x5e7d('0x2a')]=_[_0x5e7d('0x2d')](db['MailSubstatus'][_0x5e7d('0x27')]);_0x28363f[_0x5e7d('0x2c')]=_[_0x5e7d('0x2d')](_0x108e4f[_0x5e7d('0x2c')]);_0x28363f['filters']=_[_0x5e7d('0x2f')](_0x28363f[_0x5e7d('0x2a')],_0x28363f[_0x5e7d('0x2c')]);_0x1e74d1[_0x5e7d('0x30')]=_[_0x5e7d('0x2f')](_0x28363f[_0x5e7d('0x2a')],qs['fields'](_0x108e4f[_0x5e7d('0x2c')][_0x5e7d('0x31')]));_0x1e74d1[_0x5e7d('0x30')]=_0x1e74d1[_0x5e7d('0x30')][_0x5e7d('0x32')]?_0x1e74d1[_0x5e7d('0x30')]:_0x28363f['model'];if(_0x108e4f[_0x5e7d('0x2c')][_0x5e7d('0x3e')]){_0x1e74d1[_0x5e7d('0x3f')]=[{'all':!![]}];}_0x1e74d1=_[_0x5e7d('0x3a')]({},_0x1e74d1,_0x108e4f[_0x5e7d('0x44')]);return db[_0x5e7d('0x26')][_0x5e7d('0x45')](_0x1e74d1)['then'](handleEntityNotFound(_0x20c11a,null))[_0x5e7d('0x3d')](respondWithResult(_0x20c11a,null))['catch'](handleError(_0x20c11a,null));};exports[_0x5e7d('0x46')]=function(_0x430674,_0x43de1d){return db['MailSubstatus'][_0x5e7d('0x46')](_0x430674[_0x5e7d('0x47')],{})[_0x5e7d('0x3d')](respondWithResult(_0x43de1d,0xc9))[_0x5e7d('0x41')](handleError(_0x43de1d,null));};exports['update']=function(_0x2946bc,_0x2220c6){if(_0x2946bc[_0x5e7d('0x47')]['id']){delete _0x2946bc[_0x5e7d('0x47')]['id'];}return db[_0x5e7d('0x26')][_0x5e7d('0x45')]({'where':{'id':_0x2946bc[_0x5e7d('0x43')]['id']}})[_0x5e7d('0x3d')](handleEntityNotFound(_0x2220c6,null))[_0x5e7d('0x3d')](saveUpdates(_0x2946bc[_0x5e7d('0x47')],null))[_0x5e7d('0x3d')](respondWithResult(_0x2220c6,null))[_0x5e7d('0x41')](handleError(_0x2220c6,null));};exports[_0x5e7d('0x21')]=function(_0xcc84dc,_0x26643c){return db[_0x5e7d('0x26')][_0x5e7d('0x45')]({'where':{'id':_0xcc84dc[_0x5e7d('0x43')]['id']}})[_0x5e7d('0x3d')](handleEntityNotFound(_0x26643c,null))[_0x5e7d('0x3d')](removeEntity(_0x26643c,null))[_0x5e7d('0x41')](handleError(_0x26643c,null));};exports[_0x5e7d('0x48')]=function(_0x2f97b2,_0x477bc2){return db[_0x5e7d('0x26')][_0x5e7d('0x48')]()['then'](respondWithResult(_0x477bc2,null))[_0x5e7d('0x41')](handleError(_0x477bc2,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index ac30173..29041be 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 _0x86c0=['path','rimraf','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus','mail_substatuses','lodash','../../config/logger','api','moment','bluebird'];(function(_0x212bf5,_0x165cbd){var _0xfcad21=function(_0x4a4e6e){while(--_0x4a4e6e){_0x212bf5['push'](_0x212bf5['shift']());}};_0xfcad21(++_0x165cbd);}(_0x86c0,0x133));var _0x086c=function(_0x1aa4fd,_0x265057){_0x1aa4fd=_0x1aa4fd-0x0;var _0x289290=_0x86c0[_0x1aa4fd];return _0x289290;};'use strict';var _=require(_0x086c('0x0'));var util=require('util');var logger=require(_0x086c('0x1'))(_0x086c('0x2'));var moment=require(_0x086c('0x3'));var BPromise=require(_0x086c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x086c('0x5'));var rimraf=require(_0x086c('0x6'));var config=require(_0x086c('0x7'));var attributes=require(_0x086c('0x8'));module['exports']=function(_0x3c681a,_0x19e58d){return _0x3c681a[_0x086c('0x9')](_0x086c('0xa'),attributes,{'tableName':_0x086c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1219=['define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailSubstatus.attributes','exports'];(function(_0x30099e,_0x1ee4b2){var _0x474f63=function(_0x26f35a){while(--_0x26f35a){_0x30099e['push'](_0x30099e['shift']());}};_0x474f63(++_0x1ee4b2);}(_0x1219,0x17c));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9121('0x0'));var util=require(_0x9121('0x1'));var logger=require(_0x9121('0x2'))(_0x9121('0x3'));var moment=require(_0x9121('0x4'));var BPromise=require('bluebird');var rp=require(_0x9121('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9121('0x6'));var config=require(_0x9121('0x7'));var attributes=require(_0x9121('0x8'));module[_0x9121('0x9')]=function(_0x420b62,_0x430583){return _0x420b62[_0x9121('0xa')](_0x9121('0xb'),attributes,{'tableName':_0x9121('0xc'),'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 f4b6fe5..84e4a8a 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 _0x4ea3=['MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x4ea3,0x70));var _0x34ea=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4ea3[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40434e,_0x18b461,_0x22b09e){return new BPromise(function(_0x5bec7c,_0x341727){return client[_0x34ea('0xa')](_0x40434e,_0x22b09e)[_0x34ea('0xb')](function(_0x5132c4){logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,'request\x20sent');logger['debug'](_0x34ea('0xe'),_0x18b461,_0x34ea('0xf'),JSON[_0x34ea('0x10')](_0x5132c4));if(_0x5132c4['error']){if(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x12')]===0x1f4){logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);return _0x341727(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')]['message']);return _0x5bec7c(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}else{logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,_0x34ea('0xf'));_0x5bec7c(_0x5132c4['result'][_0x34ea('0x13')]);}})[_0x34ea('0x14')](function(_0x3fa3b0){logger[_0x34ea('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x18b461,_0x3fa3b0);_0x341727(_0x3fa3b0);});});} \ No newline at end of file +var _0xac4a=['MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xac4a,0x13f));var _0xaac4=function(_0xac7c93,_0x436cd0){_0xac7c93=_0xac7c93-0x0;var _0x1e1b2c=_0xac4a[_0xac7c93];return _0x1e1b2c;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 78ebf6d..df7965c 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 _0xc970=['../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xc970,0x1ab));var _0x0c97=function(_0x47b139,_0x4cea51){_0x47b139=_0x47b139-0x0;var _0x547275=_0xc970[_0x47b139];return _0x547275;};'use strict';var multer=require('multer');var util=require(_0x0c97('0x0'));var path=require(_0x0c97('0x1'));var timeout=require(_0x0c97('0x2'));var express=require(_0x0c97('0x3'));var router=express[_0x0c97('0x4')]();var auth=require(_0x0c97('0x5'));var interaction=require(_0x0c97('0x6'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0c97('0x7')](_0x0c97('0x8'),auth[_0x0c97('0x9')](),controller[_0x0c97('0xa')]);router[_0x0c97('0x7')](_0x0c97('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x0c97('0x9')](),controller[_0x0c97('0xc')]);router[_0x0c97('0xd')]('/:id',auth[_0x0c97('0x9')](),controller[_0x0c97('0xe')]);router[_0x0c97('0xf')]('/:id',auth[_0x0c97('0x9')](),controller[_0x0c97('0x10')]);module[_0x0c97('0x11')]=router; \ No newline at end of file +var _0x483a=['create','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post'];(function(_0x27ee1c,_0x5d93b7){var _0x226db3=function(_0x55f2a2){while(--_0x55f2a2){_0x27ee1c['push'](_0x27ee1c['shift']());}};_0x226db3(++_0x5d93b7);}(_0x483a,0x16c));var _0xa483=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x483a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa483('0x0'));var util=require('util');var path=require(_0xa483('0x1'));var timeout=require(_0xa483('0x2'));var express=require(_0xa483('0x3'));var router=express['Router']();var auth=require(_0xa483('0x4'));var interaction=require(_0xa483('0x5'));var config=require(_0xa483('0x6'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0xa483('0x7')](),controller['index']);router[_0xa483('0x8')](_0xa483('0x9'),auth[_0xa483('0x7')](),controller[_0xa483('0xa')]);router[_0xa483('0x8')](_0xa483('0xb'),auth['isAuthenticated'](),controller[_0xa483('0xc')]);router[_0xa483('0xd')]('/',auth[_0xa483('0x7')](),controller[_0xa483('0xe')]);router['put'](_0xa483('0xb'),auth[_0xa483('0x7')](),controller['update']);router[_0xa483('0xf')](_0xa483('0xb'),auth[_0xa483('0x7')](),controller[_0xa483('0x10')]);module[_0xa483('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index a14a056..26c22b7 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 _0x11e8=['NOW','moment','sequelize','STRING','ENUM','account','agent','queue','DATE'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x11e8,0xfd));var _0x811e=function(_0x5bee65,_0x352dc3){_0x5bee65=_0x5bee65-0x0;var _0x298c94=_0x11e8[_0x5bee65];return _0x298c94;};'use strict';var moment=require(_0x811e('0x0'));var Sequelize=require(_0x811e('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x811e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x811e('0x3')](_0x811e('0x4'),_0x811e('0x5'),_0x811e('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x811e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x811e('0x8')]}}; \ No newline at end of file +var _0xcb5a=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM'];(function(_0x5b5ca4,_0x4a8450){var _0x504ec4=function(_0x325768){while(--_0x325768){_0x5b5ca4['push'](_0x5b5ca4['shift']());}};_0x504ec4(++_0x4a8450);}(_0xcb5a,0x113));var _0xacb5=function(_0x588dd2,_0x5c8152){_0x588dd2=_0x588dd2-0x0;var _0x4f208e=_0xcb5a[_0x588dd2];return _0x4f208e;};'use strict';var moment=require(_0xacb5('0x0'));var Sequelize=require(_0xacb5('0x1'));module[_0xacb5('0x2')]={'uniqueid':{'type':Sequelize[_0xacb5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xacb5('0x4')](_0xacb5('0x5'),_0xacb5('0x6'),_0xacb5('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xacb5('0x8')],'allowNull':![],'defaultValue':Sequelize[_0xacb5('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 94d05d4..3aaed10 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 _0x25cf=['name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','update','then','destroy','stack'];(function(_0x1e9e56,_0x34a74a){var _0x5d5e2e=function(_0x4bfcc2){while(--_0x4bfcc2){_0x1e9e56['push'](_0x1e9e56['shift']());}};_0x5d5e2e(++_0x34a74a);}(_0x25cf,0xfe));var _0xf25c=function(_0x850b13,_0x40f8e1){_0x850b13=_0x850b13-0x0;var _0x2fb2f6=_0x25cf[_0x850b13];return _0x2fb2f6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf25c('0x0'));var rimraf=require(_0xf25c('0x1'));var zipdir=require(_0xf25c('0x2'));var jsonpatch=require(_0xf25c('0x3'));var rp=require(_0xf25c('0x4'));var moment=require(_0xf25c('0x5'));var BPromise=require(_0xf25c('0x6'));var Mustache=require(_0xf25c('0x7'));var util=require(_0xf25c('0x8'));var path=require(_0xf25c('0x9'));var sox=require('sox');var csv=require(_0xf25c('0xa'));var ejs=require(_0xf25c('0xb'));var fs=require('fs');var _=require(_0xf25c('0xc'));var squel=require(_0xf25c('0xd'));var crypto=require(_0xf25c('0xe'));var jsforce=require(_0xf25c('0xf'));var deskjs=require(_0xf25c('0x10'));var toCsv=require(_0xf25c('0xa'));var querystring=require(_0xf25c('0x11'));var Papa=require('papaparse');var Redis=require(_0xf25c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf25c('0x13'));var as=require(_0xf25c('0x14'));var hardwareService=require(_0xf25c('0x15'));var logger=require(_0xf25c('0x16'))('api');var utils=require(_0xf25c('0x17'));var config=require('../../config/environment');var db=require(_0xf25c('0x18'))['db'];function respondWithStatusCode(_0x111fe9,_0x58b14d){_0x58b14d=_0x58b14d||0xcc;return function(_0x35508a){if(_0x35508a){return _0x111fe9[_0xf25c('0x19')](_0x58b14d);}return _0x111fe9[_0xf25c('0x1a')](_0x58b14d)[_0xf25c('0x1b')]();};}function respondWithResult(_0x530df2,_0x2c4131){_0x2c4131=_0x2c4131||0xc8;return function(_0x746beb){if(_0x746beb){return _0x530df2[_0xf25c('0x1a')](_0x2c4131)[_0xf25c('0x1c')](_0x746beb);}};}function respondWithFilteredResult(_0xa3e7cf,_0x5d3601){return function(_0x5bbf6f){if(_0x5bbf6f){var _0x1fd44f=_0x5bbf6f[_0xf25c('0x1d')],_0x414290=_0x5d3601['offset'],_0x37c3c3=_0x5d3601[_0xf25c('0x1e')]+_0x5d3601[_0xf25c('0x1f')],_0x101fcf;if(_0x37c3c3>=_0x1fd44f){_0x37c3c3=_0x1fd44f;_0x101fcf=0xc8;}else{_0x101fcf=0xce;}_0xa3e7cf[_0xf25c('0x1a')](_0x101fcf);return _0xa3e7cf['set']('Content-Range',_0x414290+'-'+_0x37c3c3+'/'+_0x1fd44f)[_0xf25c('0x1c')](_0x5bbf6f);}return null;};}function patchUpdates(_0x4a5cb2){return function(_0x2f02f8){try{jsonpatch[_0xf25c('0x20')](_0x2f02f8,_0x4a5cb2,!![]);}catch(_0x54d2e5){return BPromise[_0xf25c('0x21')](_0x54d2e5);}return _0x2f02f8['save']();};}function saveUpdates(_0x7f39da,_0x4e3204){return function(_0x179147){if(_0x179147){return _0x179147[_0xf25c('0x22')](_0x7f39da)[_0xf25c('0x23')](function(_0x292aa4){return _0x292aa4;});}return null;};}function removeEntity(_0x298eee,_0x4b5330){return function(_0x43cd7c){if(_0x43cd7c){return _0x43cd7c[_0xf25c('0x24')]()[_0xf25c('0x23')](function(){_0x298eee['status'](0xcc)[_0xf25c('0x1b')]();});}};}function handleEntityNotFound(_0x58e98e,_0x13dd09){return function(_0x51c325){if(!_0x51c325){_0x58e98e[_0xf25c('0x19')](0x194);}return _0x51c325;};}function handleError(_0x1ce348,_0x2169ca){_0x2169ca=_0x2169ca||0x1f4;return function(_0x3bf04f){logger['error'](_0x3bf04f[_0xf25c('0x25')]);if(_0x3bf04f[_0xf25c('0x26')]){delete _0x3bf04f[_0xf25c('0x26')];}_0x1ce348[_0xf25c('0x1a')](_0x2169ca)[_0xf25c('0x27')](_0x3bf04f);};}exports[_0xf25c('0x28')]=function(_0x455011,_0x11c093){var _0x12c7f8={},_0x5e374a={},_0x223b0e={'count':0x0,'rows':[]};var _0x415039=_[_0xf25c('0x29')](db[_0xf25c('0x2a')][_0xf25c('0x2b')],function(_0x5167bd){return{'name':_0x5167bd[_0xf25c('0x2c')],'type':_0x5167bd[_0xf25c('0x2d')][_0xf25c('0x2e')]};});_0x5e374a[_0xf25c('0x2f')]=_[_0xf25c('0x29')](_0x415039,_0xf25c('0x26'));_0x5e374a['query']=_[_0xf25c('0x30')](_0x455011[_0xf25c('0x31')]);_0x5e374a[_0xf25c('0x32')]=_[_0xf25c('0x33')](_0x5e374a[_0xf25c('0x2f')],_0x5e374a[_0xf25c('0x31')]);_0x12c7f8[_0xf25c('0x34')]=_[_0xf25c('0x33')](_0x5e374a[_0xf25c('0x2f')],qs[_0xf25c('0x35')](_0x455011[_0xf25c('0x31')][_0xf25c('0x35')]));_0x12c7f8[_0xf25c('0x34')]=_0x12c7f8[_0xf25c('0x34')]['length']?_0x12c7f8[_0xf25c('0x34')]:_0x5e374a[_0xf25c('0x2f')];if(!_0x455011[_0xf25c('0x31')][_0xf25c('0x36')]('nolimit')){_0x12c7f8[_0xf25c('0x1f')]=qs[_0xf25c('0x1f')](_0x455011[_0xf25c('0x31')][_0xf25c('0x1f')]);_0x12c7f8[_0xf25c('0x1e')]=qs[_0xf25c('0x1e')](_0x455011[_0xf25c('0x31')][_0xf25c('0x1e')]);}_0x12c7f8[_0xf25c('0x37')]=qs[_0xf25c('0x38')](_0x455011['query'][_0xf25c('0x38')]);_0x12c7f8[_0xf25c('0x39')]=qs[_0xf25c('0x32')](_[_0xf25c('0x3a')](_0x455011[_0xf25c('0x31')],_0x5e374a[_0xf25c('0x32')]),_0x415039);if(_0x455011[_0xf25c('0x31')][_0xf25c('0x3b')]){_0x12c7f8[_0xf25c('0x39')]=_[_0xf25c('0x3c')](_0x12c7f8[_0xf25c('0x39')],{'$or':_[_0xf25c('0x29')](_0x415039,function(_0x599bcd){if(_0x599bcd[_0xf25c('0x2d')]!=='VIRTUAL'){var _0x5947a0={};_0x5947a0[_0x599bcd[_0xf25c('0x26')]]={'$like':'%'+_0x455011[_0xf25c('0x31')][_0xf25c('0x3b')]+'%'};return _0x5947a0;}})});}_0x12c7f8=_[_0xf25c('0x3c')]({},_0x12c7f8,_0x455011[_0xf25c('0x3d')]);var _0x811348={'where':_0x12c7f8[_0xf25c('0x39')]};return db[_0xf25c('0x2a')][_0xf25c('0x1d')](_0x811348)['then'](function(_0x470f90){_0x223b0e[_0xf25c('0x1d')]=_0x470f90;if(_0x455011[_0xf25c('0x31')][_0xf25c('0x3e')]){_0x12c7f8[_0xf25c('0x3f')]=[{'all':!![]}];}return db[_0xf25c('0x2a')][_0xf25c('0x40')](_0x12c7f8);})['then'](function(_0x50a303){_0x223b0e[_0xf25c('0x41')]=_0x50a303;return _0x223b0e;})[_0xf25c('0x23')](respondWithFilteredResult(_0x11c093,_0x12c7f8))[_0xf25c('0x42')](handleError(_0x11c093,null));};exports['show']=function(_0x1ca12a,_0x581e38){var _0x11d93e={'raw':!![],'where':{'id':_0x1ca12a[_0xf25c('0x43')]['id']}},_0x49343e={};_0x49343e[_0xf25c('0x2f')]=_[_0xf25c('0x30')](db['MailTransferReport'][_0xf25c('0x2b')]);_0x49343e[_0xf25c('0x31')]=_[_0xf25c('0x30')](_0x1ca12a['query']);_0x49343e[_0xf25c('0x32')]=_[_0xf25c('0x33')](_0x49343e[_0xf25c('0x2f')],_0x49343e[_0xf25c('0x31')]);_0x11d93e[_0xf25c('0x34')]=_[_0xf25c('0x33')](_0x49343e[_0xf25c('0x2f')],qs[_0xf25c('0x35')](_0x1ca12a[_0xf25c('0x31')]['fields']));_0x11d93e['attributes']=_0x11d93e[_0xf25c('0x34')][_0xf25c('0x44')]?_0x11d93e['attributes']:_0x49343e[_0xf25c('0x2f')];if(_0x1ca12a['query'][_0xf25c('0x3e')]){_0x11d93e[_0xf25c('0x3f')]=[{'all':!![]}];}_0x11d93e=_[_0xf25c('0x3c')]({},_0x11d93e,_0x1ca12a['options']);return db['MailTransferReport'][_0xf25c('0x45')](_0x11d93e)[_0xf25c('0x23')](handleEntityNotFound(_0x581e38,null))[_0xf25c('0x23')](respondWithResult(_0x581e38,null))[_0xf25c('0x42')](handleError(_0x581e38,null));};exports[_0xf25c('0x46')]=function(_0x304722,_0x45bac7){return db[_0xf25c('0x2a')][_0xf25c('0x46')](_0x304722['body'],{})[_0xf25c('0x23')](respondWithResult(_0x45bac7,0xc9))[_0xf25c('0x42')](handleError(_0x45bac7,null));};exports[_0xf25c('0x22')]=function(_0x14f06c,_0x5fa4fc){if(_0x14f06c[_0xf25c('0x47')]['id']){delete _0x14f06c[_0xf25c('0x47')]['id'];}return db[_0xf25c('0x2a')][_0xf25c('0x45')]({'where':{'id':_0x14f06c['params']['id']}})[_0xf25c('0x23')](handleEntityNotFound(_0x5fa4fc,null))['then'](saveUpdates(_0x14f06c[_0xf25c('0x47')],null))[_0xf25c('0x23')](respondWithResult(_0x5fa4fc,null))[_0xf25c('0x42')](handleError(_0x5fa4fc,null));};exports[_0xf25c('0x24')]=function(_0x144c25,_0x11a6b7){return db[_0xf25c('0x2a')][_0xf25c('0x45')]({'where':{'id':_0x144c25[_0xf25c('0x43')]['id']}})[_0xf25c('0x23')](handleEntityNotFound(_0x11a6b7,null))['then'](removeEntity(_0x11a6b7,null))[_0xf25c('0x42')](handleError(_0x11a6b7,null));};exports[_0xf25c('0x48')]=function(_0xcc7799,_0x72edfc){return db['MailTransferReport']['describe']()[_0xf25c('0x23')](respondWithResult(_0x72edfc,null))[_0xf25c('0x42')](handleError(_0x72edfc,null));}; \ No newline at end of file +var _0xe5e2=['json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','send','index','map','MailTransferReport','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','filters','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end'];(function(_0x1dd39d,_0x29c1c8){var _0x3e6247=function(_0x237f84){while(--_0x237f84){_0x1dd39d['push'](_0x1dd39d['shift']());}};_0x3e6247(++_0x29c1c8);}(_0xe5e2,0x163));var _0x2e5e=function(_0x29adba,_0x2a38bf){_0x29adba=_0x29adba-0x0;var _0x42a46f=_0xe5e2[_0x29adba];return _0x42a46f;};'use strict';var pdf=require(_0x2e5e('0x0'));var emlformat=require(_0x2e5e('0x1'));var rimraf=require(_0x2e5e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e5e('0x3'));var rp=require('request-promise');var moment=require(_0x2e5e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2e5e('0x5'));var util=require(_0x2e5e('0x6'));var path=require(_0x2e5e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2e5e('0x8'));var squel=require(_0x2e5e('0x9'));var crypto=require(_0x2e5e('0xa'));var jsforce=require(_0x2e5e('0xb'));var deskjs=require(_0x2e5e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2e5e('0xd'));var Papa=require(_0x2e5e('0xe'));var Redis=require(_0x2e5e('0xf'));var authService=require(_0x2e5e('0x10'));var qs=require(_0x2e5e('0x11'));var as=require(_0x2e5e('0x12'));var hardwareService=require(_0x2e5e('0x13'));var logger=require(_0x2e5e('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2e5e('0x15'))['db'];function respondWithStatusCode(_0x3368ab,_0x378c59){_0x378c59=_0x378c59||0xcc;return function(_0x288917){if(_0x288917){return _0x3368ab[_0x2e5e('0x16')](_0x378c59);}return _0x3368ab[_0x2e5e('0x17')](_0x378c59)[_0x2e5e('0x18')]();};}function respondWithResult(_0x130ee1,_0x4597f0){_0x4597f0=_0x4597f0||0xc8;return function(_0x228d8b){if(_0x228d8b){return _0x130ee1[_0x2e5e('0x17')](_0x4597f0)[_0x2e5e('0x19')](_0x228d8b);}};}function respondWithFilteredResult(_0x436836,_0x56312b){return function(_0x385350){if(_0x385350){var _0x5429ca=_0x385350[_0x2e5e('0x1a')],_0x3a5b8e=_0x56312b[_0x2e5e('0x1b')],_0x343a40=_0x56312b[_0x2e5e('0x1b')]+_0x56312b[_0x2e5e('0x1c')],_0x1fc97a;if(_0x343a40>=_0x5429ca){_0x343a40=_0x5429ca;_0x1fc97a=0xc8;}else{_0x1fc97a=0xce;}_0x436836[_0x2e5e('0x17')](_0x1fc97a);return _0x436836[_0x2e5e('0x1d')](_0x2e5e('0x1e'),_0x3a5b8e+'-'+_0x343a40+'/'+_0x5429ca)[_0x2e5e('0x19')](_0x385350);}return null;};}function patchUpdates(_0x54db3b){return function(_0x29c933){try{jsonpatch[_0x2e5e('0x1f')](_0x29c933,_0x54db3b,!![]);}catch(_0x1d2505){return BPromise[_0x2e5e('0x20')](_0x1d2505);}return _0x29c933[_0x2e5e('0x21')]();};}function saveUpdates(_0x3c52a3,_0x2a5bf9){return function(_0x16757c){if(_0x16757c){return _0x16757c[_0x2e5e('0x22')](_0x3c52a3)['then'](function(_0x308df3){return _0x308df3;});}return null;};}function removeEntity(_0x56146d,_0x40d3b1){return function(_0x1e6a57){if(_0x1e6a57){return _0x1e6a57[_0x2e5e('0x23')]()['then'](function(){_0x56146d[_0x2e5e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x242b56,_0x4db79d){return function(_0x1b223b){if(!_0x1b223b){_0x242b56[_0x2e5e('0x16')](0x194);}return _0x1b223b;};}function handleError(_0x5edbbd,_0x7cda95){_0x7cda95=_0x7cda95||0x1f4;return function(_0x270dde){logger[_0x2e5e('0x24')](_0x270dde[_0x2e5e('0x25')]);if(_0x270dde['name']){delete _0x270dde['name'];}_0x5edbbd[_0x2e5e('0x17')](_0x7cda95)[_0x2e5e('0x26')](_0x270dde);};}exports[_0x2e5e('0x27')]=function(_0x170c53,_0x85b255){var _0x4d5300={},_0x1f8d15={},_0x29dfc3={'count':0x0,'rows':[]};var _0x23ff07=_[_0x2e5e('0x28')](db[_0x2e5e('0x29')]['rawAttributes'],function(_0x21804b){return{'name':_0x21804b[_0x2e5e('0x2a')],'type':_0x21804b[_0x2e5e('0x2b')][_0x2e5e('0x2c')]};});_0x1f8d15[_0x2e5e('0x2d')]=_[_0x2e5e('0x28')](_0x23ff07,_0x2e5e('0x2e'));_0x1f8d15[_0x2e5e('0x2f')]=_[_0x2e5e('0x30')](_0x170c53[_0x2e5e('0x2f')]);_0x1f8d15['filters']=_[_0x2e5e('0x31')](_0x1f8d15['model'],_0x1f8d15['query']);_0x4d5300[_0x2e5e('0x32')]=_[_0x2e5e('0x31')](_0x1f8d15['model'],qs[_0x2e5e('0x33')](_0x170c53[_0x2e5e('0x2f')][_0x2e5e('0x33')]));_0x4d5300[_0x2e5e('0x32')]=_0x4d5300['attributes'][_0x2e5e('0x34')]?_0x4d5300[_0x2e5e('0x32')]:_0x1f8d15[_0x2e5e('0x2d')];if(!_0x170c53[_0x2e5e('0x2f')][_0x2e5e('0x35')](_0x2e5e('0x36'))){_0x4d5300[_0x2e5e('0x1c')]=qs['limit'](_0x170c53[_0x2e5e('0x2f')]['limit']);_0x4d5300[_0x2e5e('0x1b')]=qs[_0x2e5e('0x1b')](_0x170c53[_0x2e5e('0x2f')][_0x2e5e('0x1b')]);}_0x4d5300[_0x2e5e('0x37')]=qs[_0x2e5e('0x38')](_0x170c53['query']['sort']);_0x4d5300['where']=qs['filters'](_[_0x2e5e('0x39')](_0x170c53[_0x2e5e('0x2f')],_0x1f8d15['filters']),_0x23ff07);if(_0x170c53[_0x2e5e('0x2f')][_0x2e5e('0x3a')]){_0x4d5300[_0x2e5e('0x3b')]=_['merge'](_0x4d5300[_0x2e5e('0x3b')],{'$or':_['map'](_0x23ff07,function(_0x3a7daf){if(_0x3a7daf[_0x2e5e('0x2b')]!==_0x2e5e('0x3c')){var _0x2a90c9={};_0x2a90c9[_0x3a7daf[_0x2e5e('0x2e')]]={'$like':'%'+_0x170c53['query'][_0x2e5e('0x3a')]+'%'};return _0x2a90c9;}})});}_0x4d5300=_[_0x2e5e('0x3d')]({},_0x4d5300,_0x170c53['options']);var _0x4e91d={'where':_0x4d5300['where']};return db[_0x2e5e('0x29')][_0x2e5e('0x1a')](_0x4e91d)[_0x2e5e('0x3e')](function(_0x460c41){_0x29dfc3[_0x2e5e('0x1a')]=_0x460c41;if(_0x170c53[_0x2e5e('0x2f')][_0x2e5e('0x3f')]){_0x4d5300[_0x2e5e('0x40')]=[{'all':!![]}];}return db[_0x2e5e('0x29')][_0x2e5e('0x41')](_0x4d5300);})[_0x2e5e('0x3e')](function(_0x3fb1ce){_0x29dfc3[_0x2e5e('0x42')]=_0x3fb1ce;return _0x29dfc3;})[_0x2e5e('0x3e')](respondWithFilteredResult(_0x85b255,_0x4d5300))[_0x2e5e('0x43')](handleError(_0x85b255,null));};exports[_0x2e5e('0x44')]=function(_0x3c1e30,_0x462a42){var _0x1cbb29={'raw':!![],'where':{'id':_0x3c1e30[_0x2e5e('0x45')]['id']}},_0xd6f074={};_0xd6f074[_0x2e5e('0x2d')]=_[_0x2e5e('0x30')](db[_0x2e5e('0x29')][_0x2e5e('0x46')]);_0xd6f074['query']=_['keys'](_0x3c1e30[_0x2e5e('0x2f')]);_0xd6f074[_0x2e5e('0x47')]=_['intersection'](_0xd6f074[_0x2e5e('0x2d')],_0xd6f074[_0x2e5e('0x2f')]);_0x1cbb29['attributes']=_['intersection'](_0xd6f074[_0x2e5e('0x2d')],qs[_0x2e5e('0x33')](_0x3c1e30[_0x2e5e('0x2f')][_0x2e5e('0x33')]));_0x1cbb29[_0x2e5e('0x32')]=_0x1cbb29[_0x2e5e('0x32')][_0x2e5e('0x34')]?_0x1cbb29[_0x2e5e('0x32')]:_0xd6f074[_0x2e5e('0x2d')];if(_0x3c1e30[_0x2e5e('0x2f')]['includeAll']){_0x1cbb29[_0x2e5e('0x40')]=[{'all':!![]}];}_0x1cbb29=_[_0x2e5e('0x3d')]({},_0x1cbb29,_0x3c1e30['options']);return db[_0x2e5e('0x29')][_0x2e5e('0x48')](_0x1cbb29)['then'](handleEntityNotFound(_0x462a42,null))[_0x2e5e('0x3e')](respondWithResult(_0x462a42,null))[_0x2e5e('0x43')](handleError(_0x462a42,null));};exports[_0x2e5e('0x49')]=function(_0x186c16,_0x3ec1ec){return db[_0x2e5e('0x29')]['create'](_0x186c16[_0x2e5e('0x4a')],{})[_0x2e5e('0x3e')](respondWithResult(_0x3ec1ec,0xc9))[_0x2e5e('0x43')](handleError(_0x3ec1ec,null));};exports[_0x2e5e('0x22')]=function(_0x15aeb9,_0x1aa505){if(_0x15aeb9[_0x2e5e('0x4a')]['id']){delete _0x15aeb9[_0x2e5e('0x4a')]['id'];}return db['MailTransferReport'][_0x2e5e('0x48')]({'where':{'id':_0x15aeb9[_0x2e5e('0x45')]['id']}})[_0x2e5e('0x3e')](handleEntityNotFound(_0x1aa505,null))[_0x2e5e('0x3e')](saveUpdates(_0x15aeb9[_0x2e5e('0x4a')],null))[_0x2e5e('0x3e')](respondWithResult(_0x1aa505,null))['catch'](handleError(_0x1aa505,null));};exports[_0x2e5e('0x23')]=function(_0x376df8,_0x300a17){return db[_0x2e5e('0x29')]['find']({'where':{'id':_0x376df8[_0x2e5e('0x45')]['id']}})[_0x2e5e('0x3e')](handleEntityNotFound(_0x300a17,null))[_0x2e5e('0x3e')](removeEntity(_0x300a17,null))['catch'](handleError(_0x300a17,null));};exports[_0x2e5e('0x4b')]=function(_0x4a9f97,_0x4772cb){return db[_0x2e5e('0x29')]['describe']()[_0x2e5e('0x3e')](respondWithResult(_0x4772cb,null))[_0x2e5e('0x43')](handleError(_0x4772cb,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 026d00e..6f7c250 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 _0x1536=['bluebird','request-promise','rimraf','../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','moment'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0x1536,0x71));var _0x6153=function(_0x56d0b9,_0x133019){_0x56d0b9=_0x56d0b9-0x0;var _0x28ba7c=_0x1536[_0x56d0b9];return _0x28ba7c;};'use strict';var _=require('lodash');var util=require(_0x6153('0x0'));var logger=require(_0x6153('0x1'))(_0x6153('0x2'));var moment=require(_0x6153('0x3'));var BPromise=require(_0x6153('0x4'));var rp=require(_0x6153('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6153('0x6'));var config=require(_0x6153('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0x6153('0x8')]=function(_0x2c0d61,_0x2b48a3){return _0x2c0d61[_0x6153('0x9')](_0x6153('0xa'),attributes,{'tableName':_0x6153('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6153('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2101=['api','moment','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x53aa29,_0xe75b6c){var _0x31d460=function(_0x3c96ec){while(--_0x3c96ec){_0x53aa29['push'](_0x53aa29['shift']());}};_0x31d460(++_0xe75b6c);}(_0x2101,0x185));var _0x1210=function(_0x85698d,_0x4cf7e6){_0x85698d=_0x85698d-0x0;var _0x14b44e=_0x2101[_0x85698d];return _0x14b44e;};'use strict';var _=require(_0x1210('0x0'));var util=require(_0x1210('0x1'));var logger=require(_0x1210('0x2'))(_0x1210('0x3'));var moment=require(_0x1210('0x4'));var BPromise=require('bluebird');var rp=require(_0x1210('0x5'));var fs=require('fs');var path=require(_0x1210('0x6'));var rimraf=require(_0x1210('0x7'));var config=require(_0x1210('0x8'));var attributes=require(_0x1210('0x9'));module['exports']=function(_0x5e8162,_0x424aa6){return _0x5e8162[_0x1210('0xa')](_0x1210('0xb'),attributes,{'tableName':_0x1210('0xc'),'paranoid':![],'indexes':[{'name':_0x1210('0xd'),'fields':[_0x1210('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 1443119..80f1598 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 _0xf02a=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0xf02a,0x1b3));var _0xaf02=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0xf02a[_0x5a2d3f];return _0x5c65d8;};'use strict';var _=require(_0xaf02('0x0'));var util=require(_0xaf02('0x1'));var moment=require(_0xaf02('0x2'));var BPromise=require(_0xaf02('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf02('0x4'));var db=require(_0xaf02('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf02('0x6'))(_0xaf02('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf02('0x8'));var client=jayson[_0xaf02('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x434c24,_0x24819b,_0x55fcb4){return new BPromise(function(_0x342272,_0x7dff27){return client[_0xaf02('0xa')](_0x434c24,_0x55fcb4)[_0xaf02('0xb')](function(_0x48e0c9){logger['info'](_0xaf02('0xc'),_0x24819b,_0xaf02('0xd'));logger[_0xaf02('0xe')](_0xaf02('0xf'),_0x24819b,_0xaf02('0xd'),JSON[_0xaf02('0x10')](_0x48e0c9));if(_0x48e0c9[_0xaf02('0x11')]){if(_0x48e0c9[_0xaf02('0x11')][_0xaf02('0x12')]===0x1f4){logger['error'](_0xaf02('0xc'),_0x24819b,_0x48e0c9[_0xaf02('0x11')][_0xaf02('0x13')]);return _0x7dff27(_0x48e0c9[_0xaf02('0x11')]['message']);}logger[_0xaf02('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x24819b,_0x48e0c9[_0xaf02('0x11')][_0xaf02('0x13')]);return _0x342272(_0x48e0c9[_0xaf02('0x11')]['message']);}else{logger[_0xaf02('0x14')](_0xaf02('0xc'),_0x24819b,_0xaf02('0xd'));_0x342272(_0x48e0c9['result'][_0xaf02('0x13')]);}})[_0xaf02('0x15')](function(_0x2478bb){logger['error'](_0xaf02('0xc'),_0x24819b,_0x2478bb);_0x7dff27(_0x2478bb);});});} \ No newline at end of file +var _0x0460=['then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','MailTransferReport,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3ad592,_0x1f624d){var _0x3909d7=function(_0xb1ea41){while(--_0xb1ea41){_0x3ad592['push'](_0x3ad592['shift']());}};_0x3909d7(++_0x1f624d);}(_0x0460,0x17a));var _0x0046=function(_0x4aefc7,_0x28fc4a){_0x4aefc7=_0x4aefc7-0x0;var _0x3471b3=_0x0460[_0x4aefc7];return _0x3471b3;};'use strict';var _=require('lodash');var util=require(_0x0046('0x0'));var moment=require(_0x0046('0x1'));var BPromise=require(_0x0046('0x2'));var rs=require(_0x0046('0x3'));var fs=require('fs');var Redis=require(_0x0046('0x4'));var db=require(_0x0046('0x5'))['db'];var utils=require(_0x0046('0x6'));var logger=require(_0x0046('0x7'))(_0x0046('0x8'));var config=require(_0x0046('0x9'));var jayson=require(_0x0046('0xa'));var client=jayson['client'][_0x0046('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1df572,_0xf3b7d3,_0x82e77c){return new BPromise(function(_0x40cb03,_0x569bf8){return client[_0x0046('0xc')](_0x1df572,_0x82e77c)[_0x0046('0xd')](function(_0x209c82){logger[_0x0046('0xe')]('MailTransferReport,\x20%s,\x20%s',_0xf3b7d3,_0x0046('0xf'));logger[_0x0046('0x10')](_0x0046('0x11'),_0xf3b7d3,_0x0046('0xf'),JSON[_0x0046('0x12')](_0x209c82));if(_0x209c82[_0x0046('0x13')]){if(_0x209c82[_0x0046('0x13')]['code']===0x1f4){logger[_0x0046('0x13')](_0x0046('0x14'),_0xf3b7d3,_0x209c82['error'][_0x0046('0x15')]);return _0x569bf8(_0x209c82[_0x0046('0x13')][_0x0046('0x15')]);}logger[_0x0046('0x13')]('MailTransferReport,\x20%s,\x20%s',_0xf3b7d3,_0x209c82[_0x0046('0x13')][_0x0046('0x15')]);return _0x40cb03(_0x209c82['error']['message']);}else{logger[_0x0046('0xe')]('MailTransferReport,\x20%s,\x20%s',_0xf3b7d3,_0x0046('0xf'));_0x40cb03(_0x209c82[_0x0046('0x16')][_0x0046('0x15')]);}})['catch'](function(_0x52b19d){logger[_0x0046('0x13')](_0x0046('0x14'),_0xf3b7d3,_0x52b19d);_0x569bf8(_0x52b19d);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index d46f562..c2cde2c 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 _0xc387=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','/:id','update','delete','destroy','exports','multer'];(function(_0x55b7bf,_0x300467){var _0x4c6dee=function(_0x2f04e0){while(--_0x2f04e0){_0x55b7bf['push'](_0x55b7bf['shift']());}};_0x4c6dee(++_0x300467);}(_0xc387,0xf6));var _0x7c38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc387[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7c38('0x0'));var util=require(_0x7c38('0x1'));var path=require(_0x7c38('0x2'));var timeout=require(_0x7c38('0x3'));var express=require(_0x7c38('0x4'));var router=express[_0x7c38('0x5')]();var auth=require(_0x7c38('0x6'));var interaction=require(_0x7c38('0x7'));var config=require(_0x7c38('0x8'));var controller=require(_0x7c38('0x9'));router[_0x7c38('0xa')]('/',auth[_0x7c38('0xb')](),controller[_0x7c38('0xc')]);router[_0x7c38('0xa')](_0x7c38('0xd'),auth[_0x7c38('0xb')](),controller['describe']);router[_0x7c38('0xa')](_0x7c38('0xe'),auth[_0x7c38('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7c38('0xe'),auth['isAuthenticated'](),controller[_0x7c38('0xf')]);router[_0x7c38('0x10')](_0x7c38('0xe'),auth[_0x7c38('0xb')](),controller[_0x7c38('0x11')]);module[_0x7c38('0x12')]=router; \ No newline at end of file +var _0x101c=['./memberReport.controller','get','index','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0x101c,0x116));var _0xc101=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0x101c[_0xb0de07];return _0x4633d8;};'use strict';var multer=require(_0xc101('0x0'));var util=require(_0xc101('0x1'));var path=require(_0xc101('0x2'));var timeout=require(_0xc101('0x3'));var express=require(_0xc101('0x4'));var router=express[_0xc101('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc101('0x6'));var controller=require(_0xc101('0x7'));router[_0xc101('0x8')]('/',auth['isAuthenticated'](),controller[_0xc101('0x9')]);router[_0xc101('0x8')]('/describe',auth[_0xc101('0xa')](),controller[_0xc101('0xb')]);router['get'](_0xc101('0xc'),auth[_0xc101('0xa')](),controller[_0xc101('0xd')]);router['post']('/',auth[_0xc101('0xa')](),controller[_0xc101('0xe')]);router[_0xc101('0xf')]('/:id',auth[_0xc101('0xa')](),controller[_0xc101('0x10')]);router[_0xc101('0x11')](_0xc101('0xc'),auth[_0xc101('0xa')](),controller[_0xc101('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 01e8afc..40d98ce 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 _0xddb0=['duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','seconds','exitAt','setDataValue'];(function(_0x50406a,_0x2871ee){var _0xe06568=function(_0xa087a){while(--_0xa087a){_0x50406a['push'](_0x50406a['shift']());}};_0xe06568(++_0x2871ee);}(_0xddb0,0x1b7));var _0x0ddb=function(_0x546e1b,_0x13abe6){_0x546e1b=_0x546e1b-0x0;var _0x30496b=_0xddb0[_0x546e1b];return _0x30496b;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x0ddb('0x0')]={'channel':{'type':Sequelize[_0x0ddb('0x1')]},'membername':{'type':Sequelize[_0x0ddb('0x1')]},'interface':{'type':Sequelize[_0x0ddb('0x1')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x0ddb('0x2')},'duration':{'type':Sequelize[_0x0ddb('0x3')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x0ddb('0x4')],'set':function(_0x285a53){var _0x4a80be=moment(_0x285a53);var _0x45fbf1=moment(this[_0x0ddb('0x5')]('enterAt'));var _0xc0db05=_0x4a80be['diff'](_0x45fbf1,_0x0ddb('0x6'));this['setDataValue'](_0x0ddb('0x7'),_0x285a53);this[_0x0ddb('0x8')](_0x0ddb('0x9'),_0xc0db05||null);}},'data1':{'type':Sequelize[_0x0ddb('0x1')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x0ddb('0x1')],'comment':_0x0ddb('0xa')},'data3':{'type':Sequelize['STRING'],'comment':_0x0ddb('0xb')},'data4':{'type':Sequelize['STRING'],'comment':_0x0ddb('0xc')},'data5':{'type':Sequelize['STRING'],'comment':_0x0ddb('0xd')},'role':{'type':Sequelize[_0x0ddb('0x1')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x0ddb('0x1')]}}; \ No newline at end of file +var _0xa68d=['getDataValue','enterAt','diff','seconds','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x5bf152,_0x2884b3){var _0x5d1230=function(_0x40a921){while(--_0x40a921){_0x5bf152['push'](_0x5bf152['shift']());}};_0x5d1230(++_0x2884b3);}(_0xa68d,0x12a));var _0xda68=function(_0x280012,_0x26e789){_0x280012=_0x280012-0x0;var _0x178406=_0xa68d[_0x280012];return _0x178406;};'use strict';var Sequelize=require(_0xda68('0x0'));var moment=require(_0xda68('0x1'));module[_0xda68('0x2')]={'channel':{'type':Sequelize[_0xda68('0x3')]},'membername':{'type':Sequelize[_0xda68('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xda68('0x3')],'defaultValue':_0xda68('0x4'),'comment':_0xda68('0x5')},'duration':{'type':Sequelize[_0xda68('0x6')]},'enterAt':{'type':Sequelize[_0xda68('0x7')]},'exitAt':{'type':Sequelize[_0xda68('0x7')],'set':function(_0x2c662f){var _0xab96b6=moment(_0x2c662f);var _0x1a7c1b=moment(this[_0xda68('0x8')](_0xda68('0x9')));var _0x2f8051=_0xab96b6[_0xda68('0xa')](_0x1a7c1b,_0xda68('0xb'));this['setDataValue']('exitAt',_0x2c662f);this['setDataValue'](_0xda68('0xc'),_0x2f8051||null);}},'data1':{'type':Sequelize[_0xda68('0x3')],'comment':_0xda68('0xd')},'data2':{'type':Sequelize[_0xda68('0x3')],'comment':_0xda68('0xe')},'data3':{'type':Sequelize['STRING'],'comment':_0xda68('0xf')},'data4':{'type':Sequelize[_0xda68('0x3')],'comment':_0xda68('0x10')},'data5':{'type':Sequelize[_0xda68('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xda68('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 510adee..1b19589 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 _0xf438=['filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','show','includeAll','find','catch','create','update','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','name','send','index','map','MemberReport','rawAttributes','type','key','query','keys'];(function(_0x52c4cb,_0x51d91d){var _0x28be77=function(_0x4cff8a){while(--_0x4cff8a){_0x52c4cb['push'](_0x52c4cb['shift']());}};_0x28be77(++_0x51d91d);}(_0xf438,0x1d0));var _0x8f43=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xf438[_0x4d613c];return _0x301fe3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8f43('0x0'));var rimraf=require(_0x8f43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f43('0x2'));var rp=require(_0x8f43('0x3'));var moment=require(_0x8f43('0x4'));var BPromise=require(_0x8f43('0x5'));var Mustache=require(_0x8f43('0x6'));var util=require('util');var path=require(_0x8f43('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8f43('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8f43('0x9'));var crypto=require(_0x8f43('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8f43('0xb'));var toCsv=require(_0x8f43('0xc'));var querystring=require('querystring');var Papa=require(_0x8f43('0xd'));var Redis=require(_0x8f43('0xe'));var authService=require(_0x8f43('0xf'));var qs=require(_0x8f43('0x10'));var as=require(_0x8f43('0x11'));var hardwareService=require(_0x8f43('0x12'));var logger=require(_0x8f43('0x13'))(_0x8f43('0x14'));var utils=require(_0x8f43('0x15'));var config=require(_0x8f43('0x16'));var db=require(_0x8f43('0x17'))['db'];function respondWithStatusCode(_0x51554e,_0x4b51a1){_0x4b51a1=_0x4b51a1||0xcc;return function(_0x8f665){if(_0x8f665){return _0x51554e[_0x8f43('0x18')](_0x4b51a1);}return _0x51554e[_0x8f43('0x19')](_0x4b51a1)[_0x8f43('0x1a')]();};}function respondWithResult(_0x5885d1,_0x2e5261){_0x2e5261=_0x2e5261||0xc8;return function(_0x347048){if(_0x347048){return _0x5885d1['status'](_0x2e5261)[_0x8f43('0x1b')](_0x347048);}};}function respondWithFilteredResult(_0x57a67d,_0xbc9dbd){return function(_0x29691c){if(_0x29691c){var _0xdafc69=_0x29691c[_0x8f43('0x1c')],_0x1deadb=_0xbc9dbd[_0x8f43('0x1d')],_0x212666=_0xbc9dbd[_0x8f43('0x1d')]+_0xbc9dbd[_0x8f43('0x1e')],_0x57a670;if(_0x212666>=_0xdafc69){_0x212666=_0xdafc69;_0x57a670=0xc8;}else{_0x57a670=0xce;}_0x57a67d[_0x8f43('0x19')](_0x57a670);return _0x57a67d[_0x8f43('0x1f')]('Content-Range',_0x1deadb+'-'+_0x212666+'/'+_0xdafc69)[_0x8f43('0x1b')](_0x29691c);}return null;};}function patchUpdates(_0x27cce0){return function(_0x12a1e4){try{jsonpatch[_0x8f43('0x20')](_0x12a1e4,_0x27cce0,!![]);}catch(_0x4310b4){return BPromise[_0x8f43('0x21')](_0x4310b4);}return _0x12a1e4[_0x8f43('0x22')]();};}function saveUpdates(_0x73f9ba,_0x4ecbc8){return function(_0x5061ff){if(_0x5061ff){return _0x5061ff['update'](_0x73f9ba)[_0x8f43('0x23')](function(_0x5a8bf2){return _0x5a8bf2;});}return null;};}function removeEntity(_0x2c28e3,_0x39c167){return function(_0x54ea42){if(_0x54ea42){return _0x54ea42[_0x8f43('0x24')]()[_0x8f43('0x23')](function(){_0x2c28e3['status'](0xcc)[_0x8f43('0x1a')]();});}};}function handleEntityNotFound(_0x44add3,_0x5f18c6){return function(_0x23795e){if(!_0x23795e){_0x44add3[_0x8f43('0x18')](0x194);}return _0x23795e;};}function handleError(_0x287dc6,_0x270c73){_0x270c73=_0x270c73||0x1f4;return function(_0x503203){logger['error'](_0x503203['stack']);if(_0x503203[_0x8f43('0x25')]){delete _0x503203[_0x8f43('0x25')];}_0x287dc6[_0x8f43('0x19')](_0x270c73)[_0x8f43('0x26')](_0x503203);};}exports[_0x8f43('0x27')]=function(_0x2a8c11,_0x167889){var _0x49d622={},_0x389db6={},_0x4f08f4={'count':0x0,'rows':[]};var _0x2363a6=_[_0x8f43('0x28')](db[_0x8f43('0x29')][_0x8f43('0x2a')],function(_0x2e21bb){return{'name':_0x2e21bb['fieldName'],'type':_0x2e21bb[_0x8f43('0x2b')][_0x8f43('0x2c')]};});_0x389db6['model']=_[_0x8f43('0x28')](_0x2363a6,_0x8f43('0x25'));_0x389db6[_0x8f43('0x2d')]=_[_0x8f43('0x2e')](_0x2a8c11['query']);_0x389db6[_0x8f43('0x2f')]=_['intersection'](_0x389db6['model'],_0x389db6[_0x8f43('0x2d')]);_0x49d622['attributes']=_[_0x8f43('0x30')](_0x389db6[_0x8f43('0x31')],qs[_0x8f43('0x32')](_0x2a8c11[_0x8f43('0x2d')][_0x8f43('0x32')]));_0x49d622[_0x8f43('0x33')]=_0x49d622[_0x8f43('0x33')][_0x8f43('0x34')]?_0x49d622['attributes']:_0x389db6[_0x8f43('0x31')];if(!_0x2a8c11[_0x8f43('0x2d')]['hasOwnProperty'](_0x8f43('0x35'))){_0x49d622[_0x8f43('0x1e')]=qs[_0x8f43('0x1e')](_0x2a8c11['query'][_0x8f43('0x1e')]);_0x49d622[_0x8f43('0x1d')]=qs[_0x8f43('0x1d')](_0x2a8c11[_0x8f43('0x2d')][_0x8f43('0x1d')]);}_0x49d622[_0x8f43('0x36')]=qs['sort'](_0x2a8c11['query'][_0x8f43('0x37')]);_0x49d622[_0x8f43('0x38')]=qs[_0x8f43('0x2f')](_[_0x8f43('0x39')](_0x2a8c11[_0x8f43('0x2d')],_0x389db6[_0x8f43('0x2f')]),_0x2363a6);if(_0x2a8c11['query']['filter']){_0x49d622[_0x8f43('0x38')]=_[_0x8f43('0x3a')](_0x49d622['where'],{'$or':_['map'](_0x2363a6,function(_0x4853d3){if(_0x4853d3[_0x8f43('0x2b')]!==_0x8f43('0x3b')){var _0x554b64={};_0x554b64[_0x4853d3[_0x8f43('0x25')]]={'$like':'%'+_0x2a8c11[_0x8f43('0x2d')][_0x8f43('0x3c')]+'%'};return _0x554b64;}})});}_0x49d622=_[_0x8f43('0x3a')]({},_0x49d622,_0x2a8c11[_0x8f43('0x3d')]);var _0x461c5c={'where':_0x49d622[_0x8f43('0x38')]};return db['MemberReport'][_0x8f43('0x1c')](_0x461c5c)[_0x8f43('0x23')](function(_0x11a896){_0x4f08f4[_0x8f43('0x1c')]=_0x11a896;if(_0x2a8c11[_0x8f43('0x2d')]['includeAll']){_0x49d622[_0x8f43('0x3e')]=[{'all':!![]}];}return db[_0x8f43('0x29')]['findAll'](_0x49d622);})['then'](function(_0x6c8ea2){_0x4f08f4[_0x8f43('0x3f')]=_0x6c8ea2;return _0x4f08f4;})[_0x8f43('0x23')](respondWithFilteredResult(_0x167889,_0x49d622))['catch'](handleError(_0x167889,null));};exports[_0x8f43('0x40')]=function(_0x4fb695,_0x12804f){var _0x692c37={'raw':!![],'where':{'id':_0x4fb695['params']['id']}},_0x11f569={};_0x11f569[_0x8f43('0x31')]=_[_0x8f43('0x2e')](db[_0x8f43('0x29')][_0x8f43('0x2a')]);_0x11f569[_0x8f43('0x2d')]=_['keys'](_0x4fb695['query']);_0x11f569[_0x8f43('0x2f')]=_[_0x8f43('0x30')](_0x11f569[_0x8f43('0x31')],_0x11f569[_0x8f43('0x2d')]);_0x692c37['attributes']=_[_0x8f43('0x30')](_0x11f569['model'],qs[_0x8f43('0x32')](_0x4fb695[_0x8f43('0x2d')][_0x8f43('0x32')]));_0x692c37[_0x8f43('0x33')]=_0x692c37[_0x8f43('0x33')][_0x8f43('0x34')]?_0x692c37[_0x8f43('0x33')]:_0x11f569[_0x8f43('0x31')];if(_0x4fb695[_0x8f43('0x2d')][_0x8f43('0x41')]){_0x692c37['include']=[{'all':!![]}];}_0x692c37=_[_0x8f43('0x3a')]({},_0x692c37,_0x4fb695[_0x8f43('0x3d')]);return db['MemberReport'][_0x8f43('0x42')](_0x692c37)[_0x8f43('0x23')](handleEntityNotFound(_0x12804f,null))[_0x8f43('0x23')](respondWithResult(_0x12804f,null))[_0x8f43('0x43')](handleError(_0x12804f,null));};exports[_0x8f43('0x44')]=function(_0x1021c4,_0x5c2cac){return db['MemberReport']['create'](_0x1021c4['body'],{})[_0x8f43('0x23')](respondWithResult(_0x5c2cac,0xc9))[_0x8f43('0x43')](handleError(_0x5c2cac,null));};exports[_0x8f43('0x45')]=function(_0x1439b9,_0x276041){if(_0x1439b9[_0x8f43('0x46')]['id']){delete _0x1439b9[_0x8f43('0x46')]['id'];}return db[_0x8f43('0x29')][_0x8f43('0x42')]({'where':{'id':_0x1439b9[_0x8f43('0x47')]['id']}})[_0x8f43('0x23')](handleEntityNotFound(_0x276041,null))[_0x8f43('0x23')](saveUpdates(_0x1439b9[_0x8f43('0x46')],null))[_0x8f43('0x23')](respondWithResult(_0x276041,null))[_0x8f43('0x43')](handleError(_0x276041,null));};exports['destroy']=function(_0x284e42,_0x30ab28){return db[_0x8f43('0x29')][_0x8f43('0x42')]({'where':{'id':_0x284e42[_0x8f43('0x47')]['id']}})[_0x8f43('0x23')](handleEntityNotFound(_0x30ab28,null))[_0x8f43('0x23')](removeEntity(_0x30ab28,null))[_0x8f43('0x43')](handleError(_0x30ab28,null));};exports['describe']=function(_0x27205f,_0x280c30){return db['MemberReport'][_0x8f43('0x48')]()[_0x8f43('0x23')](respondWithResult(_0x280c30,null))['catch'](handleError(_0x280c30,null));}; \ No newline at end of file +var _0x49f6=['index','map','rawAttributes','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','MemberReport','includeAll','include','findAll','catch','show','keys','length','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send'];(function(_0x555e07,_0x2d41d4){var _0x2ad74e=function(_0x3c08a3){while(--_0x3c08a3){_0x555e07['push'](_0x555e07['shift']());}};_0x2ad74e(++_0x2d41d4);}(_0x49f6,0xba));var _0x649f=function(_0x32efab,_0x518f7c){_0x32efab=_0x32efab-0x0;var _0x25a998=_0x49f6[_0x32efab];return _0x25a998;};'use strict';var pdf=require(_0x649f('0x0'));var emlformat=require(_0x649f('0x1'));var rimraf=require(_0x649f('0x2'));var zipdir=require(_0x649f('0x3'));var jsonpatch=require(_0x649f('0x4'));var rp=require(_0x649f('0x5'));var moment=require('moment');var BPromise=require(_0x649f('0x6'));var Mustache=require(_0x649f('0x7'));var util=require('util');var path=require(_0x649f('0x8'));var sox=require('sox');var csv=require(_0x649f('0x9'));var ejs=require(_0x649f('0xa'));var fs=require('fs');var _=require(_0x649f('0xb'));var squel=require(_0x649f('0xc'));var crypto=require('crypto');var jsforce=require(_0x649f('0xd'));var deskjs=require(_0x649f('0xe'));var toCsv=require(_0x649f('0x9'));var querystring=require(_0x649f('0xf'));var Papa=require(_0x649f('0x10'));var Redis=require(_0x649f('0x11'));var authService=require(_0x649f('0x12'));var qs=require(_0x649f('0x13'));var as=require(_0x649f('0x14'));var hardwareService=require(_0x649f('0x15'));var logger=require(_0x649f('0x16'))(_0x649f('0x17'));var utils=require(_0x649f('0x18'));var config=require('../../config/environment');var db=require(_0x649f('0x19'))['db'];function respondWithStatusCode(_0x7ef440,_0x340160){_0x340160=_0x340160||0xcc;return function(_0x4c30f1){if(_0x4c30f1){return _0x7ef440[_0x649f('0x1a')](_0x340160);}return _0x7ef440[_0x649f('0x1b')](_0x340160)[_0x649f('0x1c')]();};}function respondWithResult(_0x4ee570,_0x8d0e61){_0x8d0e61=_0x8d0e61||0xc8;return function(_0x1c2703){if(_0x1c2703){return _0x4ee570['status'](_0x8d0e61)[_0x649f('0x1d')](_0x1c2703);}};}function respondWithFilteredResult(_0x46df0d,_0x1bae81){return function(_0xb4ba60){if(_0xb4ba60){var _0xe5e6cb=_0xb4ba60[_0x649f('0x1e')],_0x3b9e5c=_0x1bae81[_0x649f('0x1f')],_0x4ea44d=_0x1bae81[_0x649f('0x1f')]+_0x1bae81['limit'],_0x28ca9d;if(_0x4ea44d>=_0xe5e6cb){_0x4ea44d=_0xe5e6cb;_0x28ca9d=0xc8;}else{_0x28ca9d=0xce;}_0x46df0d[_0x649f('0x1b')](_0x28ca9d);return _0x46df0d[_0x649f('0x20')](_0x649f('0x21'),_0x3b9e5c+'-'+_0x4ea44d+'/'+_0xe5e6cb)[_0x649f('0x1d')](_0xb4ba60);}return null;};}function patchUpdates(_0x2db147){return function(_0x105831){try{jsonpatch[_0x649f('0x22')](_0x105831,_0x2db147,!![]);}catch(_0x1c6b30){return BPromise[_0x649f('0x23')](_0x1c6b30);}return _0x105831['save']();};}function saveUpdates(_0x3a5169,_0x5c0312){return function(_0x438612){if(_0x438612){return _0x438612[_0x649f('0x24')](_0x3a5169)[_0x649f('0x25')](function(_0x1bf930){return _0x1bf930;});}return null;};}function removeEntity(_0x24c300,_0x25173d){return function(_0x3e71a2){if(_0x3e71a2){return _0x3e71a2[_0x649f('0x26')]()[_0x649f('0x25')](function(){_0x24c300['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a35ef,_0x99febd){return function(_0x5a085b){if(!_0x5a085b){_0x2a35ef['sendStatus'](0x194);}return _0x5a085b;};}function handleError(_0x3a894a,_0x37e772){_0x37e772=_0x37e772||0x1f4;return function(_0x3bada2){logger['error'](_0x3bada2[_0x649f('0x27')]);if(_0x3bada2[_0x649f('0x28')]){delete _0x3bada2[_0x649f('0x28')];}_0x3a894a[_0x649f('0x1b')](_0x37e772)[_0x649f('0x29')](_0x3bada2);};}exports[_0x649f('0x2a')]=function(_0x4454bf,_0x157f8b){var _0x1ec504={},_0x1d4754={},_0x5c18e1={'count':0x0,'rows':[]};var _0x2004ba=_[_0x649f('0x2b')](db['MemberReport'][_0x649f('0x2c')],function(_0x2b6507){return{'name':_0x2b6507['fieldName'],'type':_0x2b6507[_0x649f('0x2d')][_0x649f('0x2e')]};});_0x1d4754[_0x649f('0x2f')]=_[_0x649f('0x2b')](_0x2004ba,_0x649f('0x28'));_0x1d4754[_0x649f('0x30')]=_['keys'](_0x4454bf[_0x649f('0x30')]);_0x1d4754['filters']=_['intersection'](_0x1d4754['model'],_0x1d4754['query']);_0x1ec504['attributes']=_[_0x649f('0x31')](_0x1d4754['model'],qs[_0x649f('0x32')](_0x4454bf[_0x649f('0x30')][_0x649f('0x32')]));_0x1ec504[_0x649f('0x33')]=_0x1ec504[_0x649f('0x33')]['length']?_0x1ec504[_0x649f('0x33')]:_0x1d4754[_0x649f('0x2f')];if(!_0x4454bf[_0x649f('0x30')][_0x649f('0x34')](_0x649f('0x35'))){_0x1ec504[_0x649f('0x36')]=qs[_0x649f('0x36')](_0x4454bf['query'][_0x649f('0x36')]);_0x1ec504[_0x649f('0x1f')]=qs[_0x649f('0x1f')](_0x4454bf[_0x649f('0x30')][_0x649f('0x1f')]);}_0x1ec504['order']=qs['sort'](_0x4454bf[_0x649f('0x30')][_0x649f('0x37')]);_0x1ec504[_0x649f('0x38')]=qs[_0x649f('0x39')](_[_0x649f('0x3a')](_0x4454bf[_0x649f('0x30')],_0x1d4754['filters']),_0x2004ba);if(_0x4454bf[_0x649f('0x30')][_0x649f('0x3b')]){_0x1ec504[_0x649f('0x38')]=_[_0x649f('0x3c')](_0x1ec504['where'],{'$or':_[_0x649f('0x2b')](_0x2004ba,function(_0x173606){if(_0x173606[_0x649f('0x2d')]!==_0x649f('0x3d')){var _0x382ab2={};_0x382ab2[_0x173606['name']]={'$like':'%'+_0x4454bf['query']['filter']+'%'};return _0x382ab2;}})});}_0x1ec504=_[_0x649f('0x3c')]({},_0x1ec504,_0x4454bf[_0x649f('0x3e')]);var _0x1cb256={'where':_0x1ec504['where']};return db[_0x649f('0x3f')][_0x649f('0x1e')](_0x1cb256)[_0x649f('0x25')](function(_0x4d71c1){_0x5c18e1['count']=_0x4d71c1;if(_0x4454bf[_0x649f('0x30')][_0x649f('0x40')]){_0x1ec504[_0x649f('0x41')]=[{'all':!![]}];}return db[_0x649f('0x3f')][_0x649f('0x42')](_0x1ec504);})[_0x649f('0x25')](function(_0x554399){_0x5c18e1['rows']=_0x554399;return _0x5c18e1;})['then'](respondWithFilteredResult(_0x157f8b,_0x1ec504))[_0x649f('0x43')](handleError(_0x157f8b,null));};exports[_0x649f('0x44')]=function(_0x5132ce,_0x54716c){var _0x5f1e3={'raw':!![],'where':{'id':_0x5132ce['params']['id']}},_0x3e5036={};_0x3e5036[_0x649f('0x2f')]=_[_0x649f('0x45')](db[_0x649f('0x3f')]['rawAttributes']);_0x3e5036['query']=_[_0x649f('0x45')](_0x5132ce[_0x649f('0x30')]);_0x3e5036[_0x649f('0x39')]=_[_0x649f('0x31')](_0x3e5036['model'],_0x3e5036[_0x649f('0x30')]);_0x5f1e3[_0x649f('0x33')]=_[_0x649f('0x31')](_0x3e5036[_0x649f('0x2f')],qs['fields'](_0x5132ce[_0x649f('0x30')][_0x649f('0x32')]));_0x5f1e3[_0x649f('0x33')]=_0x5f1e3[_0x649f('0x33')][_0x649f('0x46')]?_0x5f1e3[_0x649f('0x33')]:_0x3e5036['model'];if(_0x5132ce['query']['includeAll']){_0x5f1e3[_0x649f('0x41')]=[{'all':!![]}];}_0x5f1e3=_[_0x649f('0x3c')]({},_0x5f1e3,_0x5132ce[_0x649f('0x3e')]);return db[_0x649f('0x3f')]['find'](_0x5f1e3)['then'](handleEntityNotFound(_0x54716c,null))[_0x649f('0x25')](respondWithResult(_0x54716c,null))[_0x649f('0x43')](handleError(_0x54716c,null));};exports[_0x649f('0x47')]=function(_0x5cf3a5,_0x26a81b){return db['MemberReport'][_0x649f('0x47')](_0x5cf3a5[_0x649f('0x48')],{})[_0x649f('0x25')](respondWithResult(_0x26a81b,0xc9))[_0x649f('0x43')](handleError(_0x26a81b,null));};exports[_0x649f('0x24')]=function(_0x142558,_0x344e09){if(_0x142558['body']['id']){delete _0x142558['body']['id'];}return db[_0x649f('0x3f')][_0x649f('0x49')]({'where':{'id':_0x142558[_0x649f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x344e09,null))[_0x649f('0x25')](saveUpdates(_0x142558[_0x649f('0x48')],null))[_0x649f('0x25')](respondWithResult(_0x344e09,null))[_0x649f('0x43')](handleError(_0x344e09,null));};exports[_0x649f('0x26')]=function(_0x220478,_0x242b9a){return db['MemberReport'][_0x649f('0x49')]({'where':{'id':_0x220478[_0x649f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x242b9a,null))[_0x649f('0x25')](removeEntity(_0x242b9a,null))[_0x649f('0x43')](handleError(_0x242b9a,null));};exports[_0x649f('0x4b')]=function(_0x1e828e,_0x585eae){return db['MemberReport'][_0x649f('0x4b')]()[_0x649f('0x25')](respondWithResult(_0x585eae,null))[_0x649f('0x43')](handleError(_0x585eae,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index e9fb7ef..e48427c 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 _0xd67a=['report_member','membername_interface','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport'];(function(_0x544afd,_0x4fbcd7){var _0x7de1e=function(_0x455d27){while(--_0x455d27){_0x544afd['push'](_0x544afd['shift']());}};_0x7de1e(++_0x4fbcd7);}(_0xd67a,0x193));var _0xad67=function(_0x269a96,_0x3c221c){_0x269a96=_0x269a96-0x0;var _0x1c365e=_0xd67a[_0x269a96];return _0x1c365e;};'use strict';var _=require(_0xad67('0x0'));var util=require(_0xad67('0x1'));var logger=require(_0xad67('0x2'))(_0xad67('0x3'));var moment=require(_0xad67('0x4'));var BPromise=require(_0xad67('0x5'));var rp=require(_0xad67('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad67('0x7'));var config=require(_0xad67('0x8'));var attributes=require(_0xad67('0x9'));module[_0xad67('0xa')]=function(_0x3583c3,_0x11cf74){return _0x3583c3[_0xad67('0xb')](_0xad67('0xc'),attributes,{'tableName':_0xad67('0xd'),'paranoid':![],'indexes':[{'name':_0xad67('0xe'),'fields':['membername',_0xad67('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5dac=['moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername','interface','lodash','util','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5dac,0x128));var _0xc5da=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5dac[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xc5da('0x0'));var util=require(_0xc5da('0x1'));var logger=require(_0xc5da('0x2'))(_0xc5da('0x3'));var moment=require(_0xc5da('0x4'));var BPromise=require(_0xc5da('0x5'));var rp=require(_0xc5da('0x6'));var fs=require('fs');var path=require(_0xc5da('0x7'));var rimraf=require('rimraf');var config=require(_0xc5da('0x8'));var attributes=require(_0xc5da('0x9'));module['exports']=function(_0x140284,_0x3e3db9){return _0x140284[_0xc5da('0xa')](_0xc5da('0xb'),attributes,{'tableName':_0xc5da('0xc'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xc5da('0xd'),_0xc5da('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index ba7b9c2..51f838c 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 _0x1d38=['include','attributes','map','model','then','debug','stringify','catch','create','body','CreateMemberReport','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','MemberReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetMemberReport','MemberReport','findAll','options','raw','where','limit'];(function(_0x49491d,_0x4a4e9a){var _0x1d3d84=function(_0xe4d457){while(--_0xe4d457){_0x49491d['push'](_0x49491d['shift']());}};_0x1d3d84(++_0x4a4e9a);}(_0x1d38,0x193));var _0x81d3=function(_0x315732,_0x14a9cb){_0x315732=_0x315732-0x0;var _0x2a33b8=_0x1d38[_0x315732];return _0x2a33b8;};'use strict';var _=require(_0x81d3('0x0'));var util=require(_0x81d3('0x1'));var moment=require(_0x81d3('0x2'));var BPromise=require(_0x81d3('0x3'));var rs=require(_0x81d3('0x4'));var fs=require('fs');var Redis=require(_0x81d3('0x5'));var db=require(_0x81d3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x81d3('0x7'))(_0x81d3('0x8'));var config=require(_0x81d3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x81d3('0xa')][_0x81d3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c1230,_0x265c0c,_0x4369c4){return new BPromise(function(_0x3059f3,_0x127c55){return client['request'](_0x6c1230,_0x4369c4)['then'](function(_0x549268){logger[_0x81d3('0xc')](_0x81d3('0xd'),_0x265c0c,_0x81d3('0xe'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x265c0c,_0x81d3('0xe'),JSON['stringify'](_0x549268));if(_0x549268[_0x81d3('0xf')]){if(_0x549268['error'][_0x81d3('0x10')]===0x1f4){logger[_0x81d3('0xf')](_0x81d3('0xd'),_0x265c0c,_0x549268['error'][_0x81d3('0x11')]);return _0x127c55(_0x549268[_0x81d3('0xf')][_0x81d3('0x11')]);}logger[_0x81d3('0xf')](_0x81d3('0xd'),_0x265c0c,_0x549268[_0x81d3('0xf')][_0x81d3('0x11')]);return _0x3059f3(_0x549268[_0x81d3('0xf')][_0x81d3('0x11')]);}else{logger[_0x81d3('0xc')](_0x81d3('0xd'),_0x265c0c,_0x81d3('0xe'));_0x3059f3(_0x549268[_0x81d3('0x12')][_0x81d3('0x11')]);}})['catch'](function(_0x137db5){logger[_0x81d3('0xf')](_0x81d3('0xd'),_0x265c0c,_0x137db5);_0x127c55(_0x137db5);});});}exports[_0x81d3('0x13')]=function(_0x1e19f8){var _0x145d9e=this;return new Promise(function(_0x38aa38,_0x2eb60c){return db[_0x81d3('0x14')][_0x81d3('0x15')]({'raw':_0x1e19f8[_0x81d3('0x16')]?_0x1e19f8['options'][_0x81d3('0x17')]===undefined?!![]:![]:!![],'where':_0x1e19f8[_0x81d3('0x16')]?_0x1e19f8[_0x81d3('0x16')][_0x81d3('0x18')]||null:null,'attributes':_0x1e19f8[_0x81d3('0x16')]?_0x1e19f8['options']['attributes']||null:null,'limit':_0x1e19f8[_0x81d3('0x16')]?_0x1e19f8[_0x81d3('0x16')][_0x81d3('0x19')]||null:null,'include':_0x1e19f8['options']?_0x1e19f8[_0x81d3('0x16')][_0x81d3('0x1a')]?_['map'](_0x1e19f8[_0x81d3('0x16')][_0x81d3('0x1a')],function(_0x61ff39){return{'model':db[_0x61ff39['model']],'as':_0x61ff39['as'],'attributes':_0x61ff39[_0x81d3('0x1b')],'include':_0x61ff39[_0x81d3('0x1a')]?_['map'](_0x61ff39[_0x81d3('0x1a')],function(_0x102627){return{'model':db[_0x102627['model']],'as':_0x102627['as'],'attributes':_0x102627[_0x81d3('0x1b')],'include':_0x102627[_0x81d3('0x1a')]?_[_0x81d3('0x1c')](_0x102627[_0x81d3('0x1a')],function(_0x3f3563){return{'model':db[_0x3f3563[_0x81d3('0x1d')]],'as':_0x3f3563['as'],'attributes':_0x3f3563[_0x81d3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x81d3('0x1e')](function(_0x1eb462){logger[_0x81d3('0xc')](_0x81d3('0x13'),_0x1e19f8);logger[_0x81d3('0x1f')](_0x81d3('0x13'),_0x1e19f8,JSON[_0x81d3('0x20')](_0x1eb462));_0x38aa38(_0x1eb462);})[_0x81d3('0x21')](function(_0x3a46fd){logger[_0x81d3('0xf')](_0x81d3('0x13'),_0x3a46fd[_0x81d3('0x11')],_0x1e19f8);_0x2eb60c(_0x145d9e[_0x81d3('0xf')](0x1f4,_0x3a46fd[_0x81d3('0x11')]));});});};exports['CreateMemberReport']=function(_0x492cc5){var _0x5c80d8=this;return new Promise(function(_0x1d6050,_0x109fb1){return db[_0x81d3('0x14')][_0x81d3('0x22')](_0x492cc5[_0x81d3('0x23')],{'raw':_0x492cc5[_0x81d3('0x16')]?_0x492cc5[_0x81d3('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x81d3('0x1e')](function(_0x4f4715){logger['info']('CreateMemberReport',_0x492cc5);logger[_0x81d3('0x1f')](_0x81d3('0x24'),_0x492cc5,JSON['stringify'](_0x4f4715));_0x1d6050(_0x4f4715);})[_0x81d3('0x21')](function(_0x161a29){logger[_0x81d3('0xf')](_0x81d3('0x24'),_0x161a29[_0x81d3('0x11')],_0x492cc5);_0x109fb1(_0x5c80d8['error'](0x1f4,_0x161a29[_0x81d3('0x11')]));});});};exports[_0x81d3('0x25')]=function(_0x2e2db6){var _0xe8e378=this;return new Promise(function(_0x5018e6,_0xbb84cb){return db[_0x81d3('0x14')][_0x81d3('0x26')](_0x2e2db6[_0x81d3('0x23')],{'raw':_0x2e2db6[_0x81d3('0x16')]?_0x2e2db6[_0x81d3('0x16')][_0x81d3('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e2db6[_0x81d3('0x16')]?_0x2e2db6[_0x81d3('0x16')][_0x81d3('0x18')]||null:null,'attributes':_0x2e2db6['options']?_0x2e2db6['options']['attributes']||null:null,'limit':_0x2e2db6[_0x81d3('0x16')]?_0x2e2db6[_0x81d3('0x16')][_0x81d3('0x19')]||null:null})[_0x81d3('0x1e')](function(_0x4af55b){logger[_0x81d3('0xc')](_0x81d3('0x25'),_0x2e2db6);logger[_0x81d3('0x1f')](_0x81d3('0x25'),_0x2e2db6,JSON[_0x81d3('0x20')](_0x4af55b));_0x5018e6(_0x4af55b);})['catch'](function(_0x2da053){logger[_0x81d3('0xf')](_0x81d3('0x25'),_0x2da053[_0x81d3('0x11')],_0x2e2db6);_0xbb84cb(_0xe8e378[_0x81d3('0xf')](0x1f4,_0x2da053['message']));});});}; \ No newline at end of file +var _0x6544=['limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetMemberReport','MemberReport','options','raw','where','attributes','include','map','model','CreateMemberReport','create','body','UpdateMemberReport'];(function(_0x485907,_0x47224d){var _0x3ed143=function(_0x12e968){while(--_0x12e968){_0x485907['push'](_0x485907['shift']());}};_0x3ed143(++_0x47224d);}(_0x6544,0x1f0));var _0x4654=function(_0x2f1753,_0x458f6d){_0x2f1753=_0x2f1753-0x0;var _0x56a164=_0x6544[_0x2f1753];return _0x56a164;};'use strict';var _=require(_0x4654('0x0'));var util=require(_0x4654('0x1'));var moment=require(_0x4654('0x2'));var BPromise=require(_0x4654('0x3'));var rs=require(_0x4654('0x4'));var fs=require('fs');var Redis=require(_0x4654('0x5'));var db=require(_0x4654('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4654('0x7'))(_0x4654('0x8'));var config=require(_0x4654('0x9'));var jayson=require(_0x4654('0xa'));var client=jayson[_0x4654('0xb')][_0x4654('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1724db,_0x1a3bb7,_0xad4990){return new BPromise(function(_0x8aee1e,_0x50347a){return client['request'](_0x1724db,_0xad4990)[_0x4654('0xd')](function(_0x4be2d0){logger[_0x4654('0xe')](_0x4654('0xf'),_0x1a3bb7,_0x4654('0x10'));logger[_0x4654('0x11')](_0x4654('0x12'),_0x1a3bb7,_0x4654('0x10'),JSON[_0x4654('0x13')](_0x4be2d0));if(_0x4be2d0['error']){if(_0x4be2d0[_0x4654('0x14')][_0x4654('0x15')]===0x1f4){logger[_0x4654('0x14')](_0x4654('0xf'),_0x1a3bb7,_0x4be2d0[_0x4654('0x14')][_0x4654('0x16')]);return _0x50347a(_0x4be2d0[_0x4654('0x14')][_0x4654('0x16')]);}logger[_0x4654('0x14')](_0x4654('0xf'),_0x1a3bb7,_0x4be2d0[_0x4654('0x14')]['message']);return _0x8aee1e(_0x4be2d0[_0x4654('0x14')]['message']);}else{logger[_0x4654('0xe')](_0x4654('0xf'),_0x1a3bb7,_0x4654('0x10'));_0x8aee1e(_0x4be2d0['result']['message']);}})['catch'](function(_0x5e78b6){logger['error']('MemberReport,\x20%s,\x20%s',_0x1a3bb7,_0x5e78b6);_0x50347a(_0x5e78b6);});});}exports[_0x4654('0x17')]=function(_0x5837c9){var _0x7c7640=this;return new Promise(function(_0x177a1e,_0x488a29){return db[_0x4654('0x18')]['findAll']({'raw':_0x5837c9[_0x4654('0x19')]?_0x5837c9['options'][_0x4654('0x1a')]===undefined?!![]:![]:!![],'where':_0x5837c9['options']?_0x5837c9['options'][_0x4654('0x1b')]||null:null,'attributes':_0x5837c9[_0x4654('0x19')]?_0x5837c9['options'][_0x4654('0x1c')]||null:null,'limit':_0x5837c9[_0x4654('0x19')]?_0x5837c9[_0x4654('0x19')]['limit']||null:null,'include':_0x5837c9[_0x4654('0x19')]?_0x5837c9[_0x4654('0x19')][_0x4654('0x1d')]?_[_0x4654('0x1e')](_0x5837c9['options'][_0x4654('0x1d')],function(_0x283596){return{'model':db[_0x283596[_0x4654('0x1f')]],'as':_0x283596['as'],'attributes':_0x283596[_0x4654('0x1c')],'include':_0x283596['include']?_[_0x4654('0x1e')](_0x283596[_0x4654('0x1d')],function(_0x1d4ffa){return{'model':db[_0x1d4ffa[_0x4654('0x1f')]],'as':_0x1d4ffa['as'],'attributes':_0x1d4ffa[_0x4654('0x1c')],'include':_0x1d4ffa[_0x4654('0x1d')]?_[_0x4654('0x1e')](_0x1d4ffa[_0x4654('0x1d')],function(_0x29e6a8){return{'model':db[_0x29e6a8['model']],'as':_0x29e6a8['as'],'attributes':_0x29e6a8[_0x4654('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4654('0xd')](function(_0x38bd49){logger[_0x4654('0xe')]('GetMemberReport',_0x5837c9);logger[_0x4654('0x11')](_0x4654('0x17'),_0x5837c9,JSON[_0x4654('0x13')](_0x38bd49));_0x177a1e(_0x38bd49);})['catch'](function(_0x392865){logger[_0x4654('0x14')](_0x4654('0x17'),_0x392865[_0x4654('0x16')],_0x5837c9);_0x488a29(_0x7c7640[_0x4654('0x14')](0x1f4,_0x392865['message']));});});};exports[_0x4654('0x20')]=function(_0x59655c){var _0x1fac71=this;return new Promise(function(_0x5de616,_0x5a6eba){return db[_0x4654('0x18')][_0x4654('0x21')](_0x59655c[_0x4654('0x22')],{'raw':_0x59655c[_0x4654('0x19')]?_0x59655c[_0x4654('0x19')][_0x4654('0x1a')]===undefined?!![]:![]:!![]})[_0x4654('0xd')](function(_0x3f7ece){logger[_0x4654('0xe')](_0x4654('0x20'),_0x59655c);logger[_0x4654('0x11')](_0x4654('0x20'),_0x59655c,JSON[_0x4654('0x13')](_0x3f7ece));_0x5de616(_0x3f7ece);})['catch'](function(_0x5e1fc9){logger['error'](_0x4654('0x20'),_0x5e1fc9['message'],_0x59655c);_0x5a6eba(_0x1fac71['error'](0x1f4,_0x5e1fc9[_0x4654('0x16')]));});});};exports[_0x4654('0x23')]=function(_0x580b30){var _0x2def52=this;return new Promise(function(_0x5742d3,_0x234da5){return db[_0x4654('0x18')]['update'](_0x580b30[_0x4654('0x22')],{'raw':_0x580b30[_0x4654('0x19')]?_0x580b30[_0x4654('0x19')][_0x4654('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x580b30[_0x4654('0x19')]?_0x580b30[_0x4654('0x19')][_0x4654('0x1b')]||null:null,'attributes':_0x580b30[_0x4654('0x19')]?_0x580b30[_0x4654('0x19')][_0x4654('0x1c')]||null:null,'limit':_0x580b30[_0x4654('0x19')]?_0x580b30[_0x4654('0x19')][_0x4654('0x24')]||null:null})[_0x4654('0xd')](function(_0x29464f){logger[_0x4654('0xe')]('UpdateMemberReport',_0x580b30);logger[_0x4654('0x11')]('UpdateMemberReport',_0x580b30,JSON['stringify'](_0x29464f));_0x5742d3(_0x29464f);})[_0x4654('0x25')](function(_0x33661b){logger[_0x4654('0x14')]('UpdateMemberReport',_0x33661b[_0x4654('0x16')],_0x580b30);_0x234da5(_0x2def52[_0x4654('0x14')](0x1f4,_0x33661b[_0x4654('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 76f2354..f207a2b 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 _0x3de3=['../../config/environment','get','index','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x133c1d,_0x2b4288){var _0x3f339b=function(_0x3a6d3e){while(--_0x3a6d3e){_0x133c1d['push'](_0x133c1d['shift']());}};_0x3f339b(++_0x2b4288);}(_0x3de3,0x1ce));var _0x33de=function(_0x595926,_0x2faa92){_0x595926=_0x595926-0x0;var _0x22b3de=_0x3de3[_0x595926];return _0x22b3de;};'use strict';var multer=require(_0x33de('0x0'));var util=require('util');var path=require(_0x33de('0x1'));var timeout=require(_0x33de('0x2'));var express=require('express');var router=express[_0x33de('0x3')]();var auth=require(_0x33de('0x4'));var interaction=require(_0x33de('0x5'));var config=require(_0x33de('0x6'));var controller=require('./migration.controller');router[_0x33de('0x7')]('/',controller[_0x33de('0x8')]);module['exports']=router; \ No newline at end of file +var _0x6324=['path','connect-timeout','Router','../../components/interaction/service','./migration.controller','index','exports','multer','util'];(function(_0x149746,_0x5d5c59){var _0x27c559=function(_0x32ae30){while(--_0x32ae30){_0x149746['push'](_0x149746['shift']());}};_0x27c559(++_0x5d5c59);}(_0x6324,0x142));var _0x4632=function(_0x530191,_0x52edef){_0x530191=_0x530191-0x0;var _0x212d5d=_0x6324[_0x530191];return _0x212d5d;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4632('0x5'));var config=require('../../config/environment');var controller=require(_0x4632('0x6'));router['get']('/',controller[_0x4632('0x7')]);module[_0x4632('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 768c3dc..ec023a8 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 _0xeec1=['sequelize','version'];(function(_0x35186c,_0x3410d2){var _0x1835cd=function(_0xa881b){while(--_0xa881b){_0x35186c['push'](_0x35186c['shift']());}};_0x1835cd(++_0x3410d2);}(_0xeec1,0x15a));var _0x1eec=function(_0x1a6cdc,_0x38b0f8){_0x1a6cdc=_0x1a6cdc-0x0;var _0x553c77=_0xeec1[_0x1a6cdc];return _0x553c77;};'use strict';var Sequelize=require(_0x1eec('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x1eec('0x1')}}; \ No newline at end of file +var _0x3d3f=['exports','STRING','version','sequelize'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0x3d3f,0x1d7));var _0xf3d3=function(_0x50c622,_0x5c5d7c){_0x50c622=_0x50c622-0x0;var _0x5cdcc3=_0x3d3f[_0x50c622];return _0x5cdcc3;};'use strict';var Sequelize=require(_0xf3d3('0x0'));module[_0xf3d3('0x1')]={'version':{'type':Sequelize[_0xf3d3('0x2')],'unique':_0xf3d3('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 90ef64e..03cc5e6 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 _0x4b84=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','count','offset','limit','set','Content-Range','reject','save','update','then','status','error','stack','name','index','map','Migration','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','ejs','squel','jsforce','querystring','papaparse','ioredis'];(function(_0x363b81,_0x81e6ca){var _0x1d92fb=function(_0x129644){while(--_0x129644){_0x363b81['push'](_0x363b81['shift']());}};_0x1d92fb(++_0x81e6ca);}(_0x4b84,0x1cc));var _0x44b8=function(_0x56daff,_0xadca9a){_0x56daff=_0x56daff-0x0;var _0x132c82=_0x4b84[_0x56daff];return _0x132c82;};'use strict';var pdf=require(_0x44b8('0x0'));var emlformat=require(_0x44b8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x44b8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x44b8('0x3'));var Mustache=require(_0x44b8('0x4'));var util=require(_0x44b8('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x44b8('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x147529,_0x4301a6){_0x4301a6=_0x4301a6||0xcc;return function(_0x4bcc43){if(_0x4bcc43){return _0x147529[_0x44b8('0x13')](_0x4301a6);}return _0x147529['status'](_0x4301a6)[_0x44b8('0x14')]();};}function respondWithResult(_0x18d642,_0x4df670){_0x4df670=_0x4df670||0xc8;return function(_0x63e8f6){if(_0x63e8f6){return _0x18d642['status'](_0x4df670)['json'](_0x63e8f6);}};}function respondWithFilteredResult(_0x2a3e4c,_0x2af0ad){return function(_0x1722da){if(_0x1722da){var _0x41ab46=_0x1722da[_0x44b8('0x15')],_0x5e52f2=_0x2af0ad['offset'],_0x495c74=_0x2af0ad[_0x44b8('0x16')]+_0x2af0ad[_0x44b8('0x17')],_0x5d6349;if(_0x495c74>=_0x41ab46){_0x495c74=_0x41ab46;_0x5d6349=0xc8;}else{_0x5d6349=0xce;}_0x2a3e4c['status'](_0x5d6349);return _0x2a3e4c[_0x44b8('0x18')](_0x44b8('0x19'),_0x5e52f2+'-'+_0x495c74+'/'+_0x41ab46)['json'](_0x1722da);}return null;};}function patchUpdates(_0x89bc30){return function(_0x3f4688){try{jsonpatch['apply'](_0x3f4688,_0x89bc30,!![]);}catch(_0xcce202){return BPromise[_0x44b8('0x1a')](_0xcce202);}return _0x3f4688[_0x44b8('0x1b')]();};}function saveUpdates(_0x235bdc,_0x102ef9){return function(_0x369c09){if(_0x369c09){return _0x369c09[_0x44b8('0x1c')](_0x235bdc)[_0x44b8('0x1d')](function(_0x429461){return _0x429461;});}return null;};}function removeEntity(_0x1e0f2d,_0x1d642b){return function(_0x14996c){if(_0x14996c){return _0x14996c['destroy']()[_0x44b8('0x1d')](function(){_0x1e0f2d[_0x44b8('0x1e')](0xcc)[_0x44b8('0x14')]();});}};}function handleEntityNotFound(_0x1418db,_0x305a5c){return function(_0x51a34a){if(!_0x51a34a){_0x1418db[_0x44b8('0x13')](0x194);}return _0x51a34a;};}function handleError(_0x54677c,_0x41a922){_0x41a922=_0x41a922||0x1f4;return function(_0x228c81){logger[_0x44b8('0x1f')](_0x228c81[_0x44b8('0x20')]);if(_0x228c81[_0x44b8('0x21')]){delete _0x228c81['name'];}_0x54677c[_0x44b8('0x1e')](_0x41a922)['send'](_0x228c81);};}exports[_0x44b8('0x22')]=function(_0x350482,_0x549a26){var _0x17ac44={},_0x470f49={},_0x2656d7={'count':0x0,'rows':[]};var _0x59c1bf=_[_0x44b8('0x23')](db[_0x44b8('0x24')]['rawAttributes'],function(_0x2e0174){return{'name':_0x2e0174['fieldName'],'type':_0x2e0174[_0x44b8('0x25')]['key']};});_0x470f49['model']=_['map'](_0x59c1bf,_0x44b8('0x21'));_0x470f49[_0x44b8('0x26')]=_[_0x44b8('0x27')](_0x350482[_0x44b8('0x26')]);_0x470f49[_0x44b8('0x28')]=_[_0x44b8('0x29')](_0x470f49[_0x44b8('0x2a')],_0x470f49[_0x44b8('0x26')]);_0x17ac44[_0x44b8('0x2b')]=_[_0x44b8('0x29')](_0x470f49[_0x44b8('0x2a')],qs[_0x44b8('0x2c')](_0x350482[_0x44b8('0x26')]['fields']));_0x17ac44[_0x44b8('0x2b')]=_0x17ac44['attributes'][_0x44b8('0x2d')]?_0x17ac44[_0x44b8('0x2b')]:_0x470f49[_0x44b8('0x2a')];if(!_0x350482[_0x44b8('0x26')][_0x44b8('0x2e')]('nolimit')){_0x17ac44[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x350482[_0x44b8('0x26')][_0x44b8('0x17')]);_0x17ac44[_0x44b8('0x16')]=qs['offset'](_0x350482[_0x44b8('0x26')][_0x44b8('0x16')]);}_0x17ac44[_0x44b8('0x2f')]=qs[_0x44b8('0x30')](_0x350482[_0x44b8('0x26')][_0x44b8('0x30')]);_0x17ac44[_0x44b8('0x31')]=qs[_0x44b8('0x28')](_[_0x44b8('0x32')](_0x350482[_0x44b8('0x26')],_0x470f49[_0x44b8('0x28')]),_0x59c1bf);if(_0x350482[_0x44b8('0x26')][_0x44b8('0x33')]){_0x17ac44[_0x44b8('0x31')]=_[_0x44b8('0x34')](_0x17ac44[_0x44b8('0x31')],{'$or':_[_0x44b8('0x23')](_0x59c1bf,function(_0xeff999){if(_0xeff999[_0x44b8('0x25')]!==_0x44b8('0x35')){var _0x2c02d6={};_0x2c02d6[_0xeff999[_0x44b8('0x21')]]={'$like':'%'+_0x350482['query'][_0x44b8('0x33')]+'%'};return _0x2c02d6;}})});}_0x17ac44=_[_0x44b8('0x34')]({},_0x17ac44,_0x350482['options']);var _0x25688b={'where':_0x17ac44[_0x44b8('0x31')]};return db[_0x44b8('0x24')][_0x44b8('0x15')](_0x25688b)['then'](function(_0x221543){_0x2656d7[_0x44b8('0x15')]=_0x221543;if(_0x350482[_0x44b8('0x26')][_0x44b8('0x36')]){_0x17ac44[_0x44b8('0x37')]=[{'all':!![]}];}return db[_0x44b8('0x24')][_0x44b8('0x38')](_0x17ac44);})[_0x44b8('0x1d')](function(_0x209039){_0x2656d7[_0x44b8('0x39')]=_0x209039;return _0x2656d7;})[_0x44b8('0x1d')](respondWithFilteredResult(_0x549a26,_0x17ac44))[_0x44b8('0x3a')](handleError(_0x549a26,null));}; \ No newline at end of file +var _0x9bde=['index','map','Migration','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','includeAll','include','findAll','rows','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x4ba28f,_0x1c6076){var _0x426382=function(_0x37d6ad){while(--_0x37d6ad){_0x4ba28f['push'](_0x4ba28f['shift']());}};_0x426382(++_0x1c6076);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3ab645,_0x587c50){_0x3ab645=_0x3ab645-0x0;var _0x576519=_0x9bde[_0x3ab645];return _0x576519;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9bd('0x2'));var moment=require(_0xe9bd('0x3'));var BPromise=require(_0xe9bd('0x4'));var Mustache=require(_0xe9bd('0x5'));var util=require(_0xe9bd('0x6'));var path=require(_0xe9bd('0x7'));var sox=require(_0xe9bd('0x8'));var csv=require('to-csv');var ejs=require(_0xe9bd('0x9'));var fs=require('fs');var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0xf'));var querystring=require(_0xe9bd('0x10'));var Papa=require(_0xe9bd('0x11'));var Redis=require(_0xe9bd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x13'));var hardwareService=require(_0xe9bd('0x14'));var logger=require(_0xe9bd('0x15'))('api');var utils=require(_0xe9bd('0x16'));var config=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x141587,_0x5e022a){_0x5e022a=_0x5e022a||0xcc;return function(_0x2c1d98){if(_0x2c1d98){return _0x141587['sendStatus'](_0x5e022a);}return _0x141587[_0xe9bd('0x19')](_0x5e022a)[_0xe9bd('0x1a')]();};}function respondWithResult(_0x3435b4,_0x51109f){_0x51109f=_0x51109f||0xc8;return function(_0x47ba5e){if(_0x47ba5e){return _0x3435b4[_0xe9bd('0x19')](_0x51109f)[_0xe9bd('0x1b')](_0x47ba5e);}};}function respondWithFilteredResult(_0x3a9e5f,_0x46a59b){return function(_0x3360bd){if(_0x3360bd){var _0x389e7b=_0x3360bd[_0xe9bd('0x1c')],_0x45a9f2=_0x46a59b[_0xe9bd('0x1d')],_0x573350=_0x46a59b['offset']+_0x46a59b[_0xe9bd('0x1e')],_0x1d11a0;if(_0x573350>=_0x389e7b){_0x573350=_0x389e7b;_0x1d11a0=0xc8;}else{_0x1d11a0=0xce;}_0x3a9e5f[_0xe9bd('0x19')](_0x1d11a0);return _0x3a9e5f[_0xe9bd('0x1f')](_0xe9bd('0x20'),_0x45a9f2+'-'+_0x573350+'/'+_0x389e7b)['json'](_0x3360bd);}return null;};}function patchUpdates(_0x20ec32){return function(_0x50a5e8){try{jsonpatch[_0xe9bd('0x21')](_0x50a5e8,_0x20ec32,!![]);}catch(_0x55b869){return BPromise[_0xe9bd('0x22')](_0x55b869);}return _0x50a5e8[_0xe9bd('0x23')]();};}function saveUpdates(_0x134c4e,_0x3dda13){return function(_0x1acb82){if(_0x1acb82){return _0x1acb82[_0xe9bd('0x24')](_0x134c4e)[_0xe9bd('0x25')](function(_0x49165b){return _0x49165b;});}return null;};}function removeEntity(_0x133318,_0x28cd17){return function(_0x4ecaf5){if(_0x4ecaf5){return _0x4ecaf5[_0xe9bd('0x26')]()['then'](function(){_0x133318[_0xe9bd('0x19')](0xcc)[_0xe9bd('0x1a')]();});}};}function handleEntityNotFound(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(!_0x5bc4bf){_0x36f8c0[_0xe9bd('0x27')](0x194);}return _0x5bc4bf;};}function handleError(_0x1e3cbb,_0x2c9a57){_0x2c9a57=_0x2c9a57||0x1f4;return function(_0x39b206){logger[_0xe9bd('0x28')](_0x39b206[_0xe9bd('0x29')]);if(_0x39b206[_0xe9bd('0x2a')]){delete _0x39b206[_0xe9bd('0x2a')];}_0x1e3cbb[_0xe9bd('0x19')](_0x2c9a57)['send'](_0x39b206);};}exports[_0xe9bd('0x2b')]=function(_0x38fdfa,_0x5ba1d6){var _0x3b13b7={},_0xc25248={},_0x119672={'count':0x0,'rows':[]};var _0x429055=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')]['rawAttributes'],function(_0x5b7f1d){return{'name':_0x5b7f1d[_0xe9bd('0x2e')],'type':_0x5b7f1d['type'][_0xe9bd('0x2f')]};});_0xc25248[_0xe9bd('0x30')]=_[_0xe9bd('0x2c')](_0x429055,_0xe9bd('0x2a'));_0xc25248[_0xe9bd('0x31')]=_['keys'](_0x38fdfa['query']);_0xc25248[_0xe9bd('0x32')]=_[_0xe9bd('0x33')](_0xc25248[_0xe9bd('0x30')],_0xc25248[_0xe9bd('0x31')]);_0x3b13b7[_0xe9bd('0x34')]=_[_0xe9bd('0x33')](_0xc25248[_0xe9bd('0x30')],qs[_0xe9bd('0x35')](_0x38fdfa[_0xe9bd('0x31')]['fields']));_0x3b13b7[_0xe9bd('0x34')]=_0x3b13b7[_0xe9bd('0x34')][_0xe9bd('0x36')]?_0x3b13b7['attributes']:_0xc25248['model'];if(!_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x37')](_0xe9bd('0x38'))){_0x3b13b7[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x1e')]);_0x3b13b7[_0xe9bd('0x1d')]=qs[_0xe9bd('0x1d')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x1d')]);}_0x3b13b7[_0xe9bd('0x39')]=qs[_0xe9bd('0x3a')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x3a')]);_0x3b13b7[_0xe9bd('0x3b')]=qs[_0xe9bd('0x32')](_[_0xe9bd('0x3c')](_0x38fdfa['query'],_0xc25248[_0xe9bd('0x32')]),_0x429055);if(_0x38fdfa[_0xe9bd('0x31')]['filter']){_0x3b13b7[_0xe9bd('0x3b')]=_[_0xe9bd('0x3d')](_0x3b13b7['where'],{'$or':_['map'](_0x429055,function(_0x2785e6){if(_0x2785e6[_0xe9bd('0x3e')]!=='VIRTUAL'){var _0x2d1289={};_0x2d1289[_0x2785e6[_0xe9bd('0x2a')]]={'$like':'%'+_0x38fdfa[_0xe9bd('0x31')]['filter']+'%'};return _0x2d1289;}})});}_0x3b13b7=_[_0xe9bd('0x3d')]({},_0x3b13b7,_0x38fdfa['options']);var _0x3c8f7e={'where':_0x3b13b7[_0xe9bd('0x3b')]};return db[_0xe9bd('0x2d')][_0xe9bd('0x1c')](_0x3c8f7e)['then'](function(_0x41f2d4){_0x119672[_0xe9bd('0x1c')]=_0x41f2d4;if(_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x3f')]){_0x3b13b7[_0xe9bd('0x40')]=[{'all':!![]}];}return db[_0xe9bd('0x2d')][_0xe9bd('0x41')](_0x3b13b7);})[_0xe9bd('0x25')](function(_0x2b5a71){_0x119672[_0xe9bd('0x42')]=_0x2b5a71;return _0x119672;})['then'](respondWithFilteredResult(_0x5ba1d6,_0x3b13b7))['catch'](handleError(_0x5ba1d6,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 234aefe..cc597a5 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 _0xa7dd=['Migration','migrations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define'];(function(_0x43079b,_0xac1a49){var _0x12bdd2=function(_0xd6e125){while(--_0xd6e125){_0x43079b['push'](_0x43079b['shift']());}};_0x12bdd2(++_0xac1a49);}(_0xa7dd,0x161));var _0xda7d=function(_0x3ab259,_0x386518){_0x3ab259=_0x3ab259-0x0;var _0x22436c=_0xa7dd[_0x3ab259];return _0x22436c;};'use strict';var _=require(_0xda7d('0x0'));var util=require('util');var logger=require(_0xda7d('0x1'))(_0xda7d('0x2'));var moment=require('moment');var BPromise=require(_0xda7d('0x3'));var rp=require(_0xda7d('0x4'));var fs=require('fs');var path=require(_0xda7d('0x5'));var rimraf=require(_0xda7d('0x6'));var config=require(_0xda7d('0x7'));var attributes=require(_0xda7d('0x8'));module[_0xda7d('0x9')]=function(_0x2f33a,_0xb5b621){return _0x2f33a[_0xda7d('0xa')](_0xda7d('0xb'),attributes,{'tableName':_0xda7d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5e0=['define','Migration','migrations','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x563d0d,_0x33bf43){var _0x2126af=function(_0x363f6c){while(--_0x363f6c){_0x563d0d['push'](_0x563d0d['shift']());}};_0x2126af(++_0x33bf43);}(_0xc5e0,0xdb));var _0x0c5e=function(_0x3eb27c,_0x2539ce){_0x3eb27c=_0x3eb27c-0x0;var _0x597c96=_0xc5e0[_0x3eb27c];return _0x597c96;};'use strict';var _=require('lodash');var util=require(_0x0c5e('0x0'));var logger=require(_0x0c5e('0x1'))(_0x0c5e('0x2'));var moment=require(_0x0c5e('0x3'));var BPromise=require(_0x0c5e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c5e('0x5'));var rimraf=require(_0x0c5e('0x6'));var config=require(_0x0c5e('0x7'));var attributes=require('./migration.attributes');module[_0x0c5e('0x8')]=function(_0x37f858,_0x19da97){return _0x37f858[_0x0c5e('0x9')](_0x0c5e('0xa'),attributes,{'tableName':_0x0c5e('0xb'),'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 7254b89..2bc0674 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 _0x693a=['request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http'];(function(_0x45b6da,_0x5eed1b){var _0x456bae=function(_0x35121e){while(--_0x35121e){_0x45b6da['push'](_0x45b6da['shift']());}};_0x456bae(++_0x5eed1b);}(_0x693a,0x1ee));var _0xa693=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0x693a[_0x46cf00];return _0x3974dc;};'use strict';var _=require(_0xa693('0x0'));var util=require(_0xa693('0x1'));var moment=require('moment');var BPromise=require(_0xa693('0x2'));var rs=require(_0xa693('0x3'));var fs=require('fs');var Redis=require(_0xa693('0x4'));var db=require(_0xa693('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa693('0x6'))(_0xa693('0x7'));var config=require('../../config/environment');var jayson=require(_0xa693('0x8'));var client=jayson['client'][_0xa693('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3abc7d,_0x1fa171,_0x1b9a50){return new BPromise(function(_0x23889a,_0x81d415){return client[_0xa693('0xa')](_0x3abc7d,_0x1b9a50)[_0xa693('0xb')](function(_0x2a9942){logger[_0xa693('0xc')](_0xa693('0xd'),_0x1fa171,_0xa693('0xe'));logger['debug'](_0xa693('0xf'),_0x1fa171,_0xa693('0xe'),JSON[_0xa693('0x10')](_0x2a9942));if(_0x2a9942[_0xa693('0x11')]){if(_0x2a9942[_0xa693('0x11')][_0xa693('0x12')]===0x1f4){logger[_0xa693('0x11')](_0xa693('0xd'),_0x1fa171,_0x2a9942[_0xa693('0x11')]['message']);return _0x81d415(_0x2a9942[_0xa693('0x11')][_0xa693('0x13')]);}logger[_0xa693('0x11')](_0xa693('0xd'),_0x1fa171,_0x2a9942['error'][_0xa693('0x13')]);return _0x23889a(_0x2a9942[_0xa693('0x11')][_0xa693('0x13')]);}else{logger[_0xa693('0xc')](_0xa693('0xd'),_0x1fa171,'request\x20sent');_0x23889a(_0x2a9942[_0xa693('0x14')][_0xa693('0x13')]);}})['catch'](function(_0xbffb8d){logger[_0xa693('0x11')](_0xa693('0xd'),_0x1fa171,_0xbffb8d);_0x81d415(_0xbffb8d);});});} \ No newline at end of file +var _0x11ef=['stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x253782,_0x2eab29){var _0x443280=function(_0x43ea7b){while(--_0x43ea7b){_0x253782['push'](_0x253782['shift']());}};_0x443280(++_0x2eab29);}(_0x11ef,0x197));var _0xf11e=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x11ef[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xf11e('0x0'));var util=require(_0xf11e('0x1'));var moment=require(_0xf11e('0x2'));var BPromise=require(_0xf11e('0x3'));var rs=require(_0xf11e('0x4'));var fs=require('fs');var Redis=require(_0xf11e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf11e('0x6'));var logger=require(_0xf11e('0x7'))(_0xf11e('0x8'));var config=require(_0xf11e('0x9'));var jayson=require(_0xf11e('0xa'));var client=jayson['client'][_0xf11e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a778c,_0x43262d,_0x14633b){return new BPromise(function(_0xa241c0,_0xbbc881){return client[_0xf11e('0xc')](_0x2a778c,_0x14633b)[_0xf11e('0xd')](function(_0x1fe93d){logger[_0xf11e('0xe')]('Migration,\x20%s,\x20%s',_0x43262d,_0xf11e('0xf'));logger[_0xf11e('0x10')](_0xf11e('0x11'),_0x43262d,_0xf11e('0xf'),JSON[_0xf11e('0x12')](_0x1fe93d));if(_0x1fe93d[_0xf11e('0x13')]){if(_0x1fe93d['error'][_0xf11e('0x14')]===0x1f4){logger['error'](_0xf11e('0x15'),_0x43262d,_0x1fe93d['error'][_0xf11e('0x16')]);return _0xbbc881(_0x1fe93d[_0xf11e('0x13')][_0xf11e('0x16')]);}logger[_0xf11e('0x13')]('Migration,\x20%s,\x20%s',_0x43262d,_0x1fe93d[_0xf11e('0x13')][_0xf11e('0x16')]);return _0xa241c0(_0x1fe93d[_0xf11e('0x13')][_0xf11e('0x16')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x43262d,_0xf11e('0xf'));_0xa241c0(_0x1fe93d[_0xf11e('0x17')][_0xf11e('0x16')]);}})[_0xf11e('0x18')](function(_0x2db7ac){logger[_0xf11e('0x13')]('Migration,\x20%s,\x20%s',_0x43262d,_0x2db7ac);_0xbbc881(_0x2db7ac);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 937a3b8..ffa25a0 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 _0x1d7b=['./network.controller','get','isAuthenticated','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1ec7fc,_0x195db4){var _0x2b3563=function(_0x41c414){while(--_0x41c414){_0x1ec7fc['push'](_0x1ec7fc['shift']());}};_0x2b3563(++_0x195db4);}(_0x1d7b,0xb9));var _0xb1d7=function(_0x1b7272,_0x483a6a){_0x1b7272=_0x1b7272-0x0;var _0x306bcc=_0x1d7b[_0x1b7272];return _0x306bcc;};'use strict';var multer=require(_0xb1d7('0x0'));var util=require(_0xb1d7('0x1'));var path=require(_0xb1d7('0x2'));var timeout=require(_0xb1d7('0x3'));var express=require(_0xb1d7('0x4'));var router=express[_0xb1d7('0x5')]();var auth=require(_0xb1d7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb1d7('0x7'));router[_0xb1d7('0x8')]('/',auth[_0xb1d7('0x9')](),controller['index']);router['get'](_0xb1d7('0xa'),auth['isAuthenticated'](),controller[_0xb1d7('0xb')]);router['post']('/',auth[_0xb1d7('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb1d7('0xc')]);router[_0xb1d7('0xd')](_0xb1d7('0xa'),auth[_0xb1d7('0x9')](),controller[_0xb1d7('0xe')]);module[_0xb1d7('0xf')]=router; \ No newline at end of file +var _0x366c=['index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated'];(function(_0x4e2afd,_0x246d1c){var _0x39539b=function(_0x7f25f9){while(--_0x7f25f9){_0x4e2afd['push'](_0x4e2afd['shift']());}};_0x39539b(++_0x246d1c);}(_0x366c,0x9d));var _0xc366=function(_0xba4593,_0x54dd00){_0xba4593=_0xba4593-0x0;var _0x149ade=_0x366c[_0xba4593];return _0x149ade;};'use strict';var multer=require(_0xc366('0x0'));var util=require(_0xc366('0x1'));var path=require(_0xc366('0x2'));var timeout=require('connect-timeout');var express=require(_0xc366('0x3'));var router=express[_0xc366('0x4')]();var auth=require(_0xc366('0x5'));var interaction=require(_0xc366('0x6'));var config=require(_0xc366('0x7'));var controller=require(_0xc366('0x8'));router[_0xc366('0x9')]('/',auth[_0xc366('0xa')](),controller[_0xc366('0xb')]);router['get']('/:id',auth[_0xc366('0xa')](),controller[_0xc366('0xc')]);router[_0xc366('0xd')]('/',auth[_0xc366('0xa')](),controller[_0xc366('0xe')]);router[_0xc366('0xf')](_0xc366('0x10'),auth[_0xc366('0xa')](),controller[_0xc366('0x11')]);router[_0xc366('0x12')](_0xc366('0x10'),auth['isAuthenticated'](),controller[_0xc366('0x13')]);module[_0xc366('0x14')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index a838381..49daebb 100644 --- a/server/api/network/network.attributes.js +++ b/server/api/network/network.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x36fe95,_0x341a53){var _0x574798=function(_0xd46e87){while(--_0xd46e87){_0x36fe95['push'](_0x36fe95['shift']());}};_0x574798(++_0x341a53);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x3a1412,_0x404521){var _0x24a2cb=function(_0x52c674){while(--_0x52c674){_0x3a1412['push'](_0x3a1412['shift']());}};_0x24a2cb(++_0x404521);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index bf514f0..fe6e16e 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 _0xde46=['where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','options','find','create','transaction','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','Reload','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','sequelize','/etc/asterisk/stun_xcally.conf','destroy','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','stack','name','send','index','map','Network','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x2730da,_0x1098bd){var _0xfe9991=function(_0x2ea521){while(--_0x2ea521){_0x2730da['push'](_0x2730da['shift']());}};_0xfe9991(++_0x1098bd);}(_0xde46,0x174));var _0x6de4=function(_0x5964bc,_0x375923){_0x5964bc=_0x5964bc-0x0;var _0x5ec43c=_0xde46[_0x5964bc];return _0x5ec43c;};'use strict';var pdf=require(_0x6de4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6de4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6de4('0x2'));var rp=require(_0x6de4('0x3'));var moment=require(_0x6de4('0x4'));var BPromise=require(_0x6de4('0x5'));var Mustache=require(_0x6de4('0x6'));var util=require(_0x6de4('0x7'));var path=require(_0x6de4('0x8'));var sox=require(_0x6de4('0x9'));var csv=require(_0x6de4('0xa'));var ejs=require(_0x6de4('0xb'));var fs=require('fs');var _=require(_0x6de4('0xc'));var squel=require(_0x6de4('0xd'));var crypto=require(_0x6de4('0xe'));var jsforce=require(_0x6de4('0xf'));var deskjs=require(_0x6de4('0x10'));var toCsv=require(_0x6de4('0xa'));var querystring=require(_0x6de4('0x11'));var Papa=require('papaparse');var Redis=require(_0x6de4('0x12'));var authService=require(_0x6de4('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6de4('0x14'));var logger=require(_0x6de4('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x6de4('0x16'));var db=require(_0x6de4('0x17'))['db'];var jayson=require(_0x6de4('0x18'));var client=jayson[_0x6de4('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x51d486,_0x194280,_0xf98e1a){if(_0xf98e1a){var _0x4dfe0e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4dfe0e[_0x6de4('0x1a')](_0x194280)){return _0x51d486;}else{throw new db[(_0x6de4('0x1b'))][(_0x6de4('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x51d486;}}function respondWithRpcPromise(_0x320cca,_0xe6b2e5,_0x531642,_0x4cb023){return new BPromise(function(_0x212aaf,_0x1c734b){var _0x28deea=_0x4cb023||client;return _0x28deea[_0x6de4('0x1d')](_0x320cca,_0x531642)[_0x6de4('0x1e')](function(_0x17f101){logger[_0x6de4('0x1f')](_0x6de4('0x20'),_0xe6b2e5,_0x6de4('0x21'));logger[_0x6de4('0x22')](_0x6de4('0x23'),_0xe6b2e5,'request\x20sent',JSON[_0x6de4('0x24')](_0x17f101));if(_0x17f101[_0x6de4('0x25')]){if(_0x17f101[_0x6de4('0x25')][_0x6de4('0x26')]===0x1f4){logger[_0x6de4('0x25')](_0x6de4('0x20'),_0xe6b2e5,_0x17f101[_0x6de4('0x25')][_0x6de4('0x27')]);return _0x1c734b(_0x17f101[_0x6de4('0x25')][_0x6de4('0x27')]);}logger[_0x6de4('0x25')](_0x6de4('0x20'),_0xe6b2e5,_0x17f101['error'][_0x6de4('0x27')]);return _0x212aaf(_0x17f101[_0x6de4('0x25')][_0x6de4('0x27')]);}else{logger[_0x6de4('0x1f')](_0x6de4('0x20'),_0xe6b2e5,_0x6de4('0x21'));_0x212aaf(_0x17f101[_0x6de4('0x28')][_0x6de4('0x27')]);}})[_0x6de4('0x29')](function(_0x589a3a){logger[_0x6de4('0x25')]('Network,\x20%s,\x20%s',_0xe6b2e5,_0x589a3a);_0x1c734b(_0x589a3a);});});}function respondWithStatusCode(_0x43be21,_0x405614){_0x405614=_0x405614||0xcc;return function(_0x25d904){if(_0x25d904){return _0x43be21[_0x6de4('0x2a')](_0x405614);}return _0x43be21['status'](_0x405614)['end']();};}function respondWithResult(_0x3abc16,_0x8cf29c){_0x8cf29c=_0x8cf29c||0xc8;return function(_0x5c0ad8){if(_0x5c0ad8){return _0x3abc16[_0x6de4('0x2b')](_0x8cf29c)[_0x6de4('0x2c')](_0x5c0ad8);}};}function respondWithFilteredResult(_0x3ae2eb,_0x267e29){return function(_0x205c44){if(_0x205c44){var _0x51ab85=_0x205c44[_0x6de4('0x2d')],_0x21baa9=_0x267e29[_0x6de4('0x2e')],_0x3fa433=_0x267e29[_0x6de4('0x2e')]+_0x267e29[_0x6de4('0x2f')],_0x2baed2;if(_0x3fa433>=_0x51ab85){_0x3fa433=_0x51ab85;_0x2baed2=0xc8;}else{_0x2baed2=0xce;}_0x3ae2eb[_0x6de4('0x2b')](_0x2baed2);return _0x3ae2eb['set'](_0x6de4('0x30'),_0x21baa9+'-'+_0x3fa433+'/'+_0x51ab85)['json'](_0x205c44);}return null;};}function patchUpdates(_0x5490d0){return function(_0x1c75fe){try{jsonpatch[_0x6de4('0x31')](_0x1c75fe,_0x5490d0,!![]);}catch(_0x40fa56){return BPromise[_0x6de4('0x32')](_0x40fa56);}return _0x1c75fe[_0x6de4('0x33')]();};}function saveUpdates(_0x27a934,_0x18b3b0){return function(_0x486acb){if(_0x486acb){return _0x486acb[_0x6de4('0x34')](_0x27a934)['then'](function(_0x11bc1b){return _0x11bc1b;});}return null;};}function removeEntity(_0x2ae3ae,_0x4c526d){return function(_0x28a676){if(_0x28a676){return _0x28a676['destroy']()['then'](function(){_0x2ae3ae[_0x6de4('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d27ee,_0x2b3c6f){return function(_0x5105ef){if(!_0x5105ef){_0x4d27ee['sendStatus'](0x194);}return _0x5105ef;};}function handleError(_0x3140cb,_0x171169){_0x171169=_0x171169||0x1f4;return function(_0x5ab04a){logger['error'](_0x5ab04a[_0x6de4('0x35')]);if(_0x5ab04a[_0x6de4('0x36')]){delete _0x5ab04a['name'];}_0x3140cb[_0x6de4('0x2b')](_0x171169)[_0x6de4('0x37')](_0x5ab04a);};}exports[_0x6de4('0x38')]=function(_0x490bf1,_0x4685){var _0x6860a7={},_0x26e6ca={},_0x4b9491={'count':0x0,'rows':[]};var _0x49cc42=_[_0x6de4('0x39')](db[_0x6de4('0x3a')][_0x6de4('0x3b')],function(_0x25acf3){return{'name':_0x25acf3[_0x6de4('0x3c')],'type':_0x25acf3[_0x6de4('0x3d')]['key']};});_0x26e6ca[_0x6de4('0x3e')]=_[_0x6de4('0x39')](_0x49cc42,'name');_0x26e6ca[_0x6de4('0x3f')]=_[_0x6de4('0x40')](_0x490bf1[_0x6de4('0x3f')]);_0x26e6ca['filters']=_[_0x6de4('0x41')](_0x26e6ca['model'],_0x26e6ca['query']);_0x6860a7[_0x6de4('0x42')]=_[_0x6de4('0x41')](_0x26e6ca[_0x6de4('0x3e')],qs['fields'](_0x490bf1['query'][_0x6de4('0x43')]));_0x6860a7[_0x6de4('0x42')]=_0x6860a7[_0x6de4('0x42')]['length']?_0x6860a7[_0x6de4('0x42')]:_0x26e6ca['model'];if(!_0x490bf1[_0x6de4('0x3f')][_0x6de4('0x44')](_0x6de4('0x45'))){_0x6860a7[_0x6de4('0x2f')]=qs['limit'](_0x490bf1[_0x6de4('0x3f')][_0x6de4('0x2f')]);_0x6860a7[_0x6de4('0x2e')]=qs['offset'](_0x490bf1[_0x6de4('0x3f')][_0x6de4('0x2e')]);}_0x6860a7[_0x6de4('0x46')]=qs[_0x6de4('0x47')](_0x490bf1[_0x6de4('0x3f')][_0x6de4('0x47')]);_0x6860a7[_0x6de4('0x48')]=qs[_0x6de4('0x49')](_[_0x6de4('0x4a')](_0x490bf1['query'],_0x26e6ca['filters']),_0x49cc42);if(_0x490bf1[_0x6de4('0x3f')][_0x6de4('0x4b')]){_0x6860a7[_0x6de4('0x48')]=_['merge'](_0x6860a7[_0x6de4('0x48')],{'$or':_[_0x6de4('0x39')](_0x49cc42,function(_0x454454){if(_0x454454[_0x6de4('0x3d')]!==_0x6de4('0x4c')){var _0x181668={};_0x181668[_0x454454[_0x6de4('0x36')]]={'$like':'%'+_0x490bf1[_0x6de4('0x3f')]['filter']+'%'};return _0x181668;}})});}_0x6860a7=_[_0x6de4('0x4d')]({},_0x6860a7,_0x490bf1['options']);var _0x229d52={'where':_0x6860a7[_0x6de4('0x48')]};return db[_0x6de4('0x3a')][_0x6de4('0x2d')](_0x229d52)[_0x6de4('0x1e')](function(_0xe33ffc){_0x4b9491[_0x6de4('0x2d')]=_0xe33ffc;if(_0x490bf1['query'][_0x6de4('0x4e')]){_0x6860a7[_0x6de4('0x4f')]=[{'all':!![]}];}return db[_0x6de4('0x3a')][_0x6de4('0x50')](_0x6860a7);})[_0x6de4('0x1e')](function(_0x3efe7d){_0x4b9491[_0x6de4('0x51')]=_0x3efe7d;return _0x4b9491;})['then'](respondWithFilteredResult(_0x4685,_0x6860a7))['catch'](handleError(_0x4685,null));};exports[_0x6de4('0x52')]=function(_0x4a85a3,_0x34eaee){var _0x4b960c={'raw':!![],'where':{'id':_0x4a85a3[_0x6de4('0x53')]['id']}},_0x3e10a6={};_0x3e10a6[_0x6de4('0x3e')]=_[_0x6de4('0x40')](db['Network']['rawAttributes']);_0x3e10a6[_0x6de4('0x3f')]=_[_0x6de4('0x40')](_0x4a85a3[_0x6de4('0x3f')]);_0x3e10a6['filters']=_['intersection'](_0x3e10a6['model'],_0x3e10a6[_0x6de4('0x3f')]);_0x4b960c[_0x6de4('0x42')]=_['intersection'](_0x3e10a6[_0x6de4('0x3e')],qs['fields'](_0x4a85a3['query'][_0x6de4('0x43')]));_0x4b960c[_0x6de4('0x42')]=_0x4b960c[_0x6de4('0x42')]['length']?_0x4b960c[_0x6de4('0x42')]:_0x3e10a6['model'];if(_0x4a85a3['query'][_0x6de4('0x4e')]){_0x4b960c[_0x6de4('0x4f')]=[{'all':!![]}];}_0x4b960c=_[_0x6de4('0x4d')]({},_0x4b960c,_0x4a85a3[_0x6de4('0x54')]);return db[_0x6de4('0x3a')][_0x6de4('0x55')](_0x4b960c)['then'](handleEntityNotFound(_0x34eaee,null))[_0x6de4('0x1e')](respondWithResult(_0x34eaee,null))[_0x6de4('0x29')](handleError(_0x34eaee,null));};exports[_0x6de4('0x56')]=function(_0x4403c5,_0x12957e,_0x29a300){var _0x5b5169;return db['sequelize'][_0x6de4('0x57')](function(_0x438bcc){return db[_0x6de4('0x3a')][_0x6de4('0x56')](_0x4403c5[_0x6de4('0x58')],{'raw':!![]})['then'](function(_0x351afe){_0x5b5169=_0x351afe;return db[_0x6de4('0x3a')][_0x6de4('0x50')]({'where':{'type':_0x4403c5['body']['type']},'raw':!![]});})[_0x6de4('0x1e')](function(_0x362410){if(_0x5b5169['type'][_0x6de4('0x59')]()==_0x6de4('0x5a')){var _0x1b01b8=fs[_0x6de4('0x5b')](path[_0x6de4('0x5c')](config[_0x6de4('0x5d')],_0x6de4('0x5e')),_0x6de4('0x5f'));var _0x187cee=ejs['render'](_0x1b01b8,{'networks':_0x362410||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x187cee);return respondWithRpcPromise(_0x6de4('0x60'),'create',{'module':'res_stun_monitor.so'});}else if(_0x5b5169[_0x6de4('0x3d')]['toUpperCase']()==_0x6de4('0x61')){var _0x5da746=fs[_0x6de4('0x5b')](path[_0x6de4('0x5c')](config['root'],_0x6de4('0x62')),'utf8');var _0x3edce2=ejs['render'](_0x5da746,{'networks':_0x362410||[]});fs[_0x6de4('0x63')](_0x6de4('0x64'),_0x3edce2);return respondWithRpcPromise('Reload',_0x6de4('0x56'),{'module':_0x6de4('0x65')});}else{var _0x104333=fs[_0x6de4('0x5b')](path[_0x6de4('0x5c')](config[_0x6de4('0x5d')],_0x6de4('0x66')),_0x6de4('0x5f'));var _0x563a91=ejs[_0x6de4('0x67')](_0x104333,{'networks':_0x362410||[]});fs[_0x6de4('0x63')](util[_0x6de4('0x68')](_0x6de4('0x69'),_0x4403c5['body'][_0x6de4('0x3d')][_0x6de4('0x6a')]()),_0x563a91);return respondWithRpcPromise(_0x6de4('0x60'),_0x6de4('0x56'),{'module':_0x6de4('0x6b')});}return null;})['then'](function(){return _0x5b5169;});})[_0x6de4('0x1e')](respondWithResult(_0x12957e,0xc9))[_0x6de4('0x29')](handleError(_0x12957e,null));};exports[_0x6de4('0x34')]=function(_0x4ed54a,_0x397ae3,_0x2232bf){var _0x25ea6f;return db[_0x6de4('0x6c')][_0x6de4('0x57')](function(_0x4fcc3b){return db[_0x6de4('0x3a')]['find']({'where':{'id':_0x4ed54a[_0x6de4('0x53')]['id']}})['then'](handleEntityNotFound(_0x397ae3,null))[_0x6de4('0x1e')](saveUpdates(_0x4ed54a[_0x6de4('0x58')],null))['then'](function(_0x1e7b36){if(_0x1e7b36){_0x25ea6f=_0x1e7b36;return db['Network'][_0x6de4('0x50')]({'where':{'type':_0x25ea6f[_0x6de4('0x3d')]},'raw':!![]});}return null;})['then'](function(_0x4e2074){if(_0x25ea6f[_0x6de4('0x3d')][_0x6de4('0x59')]()=='STUN'){var _0x3ae833=fs[_0x6de4('0x5b')](path[_0x6de4('0x5c')](config['root'],_0x6de4('0x5e')),_0x6de4('0x5f'));var _0x41ddeb=ejs[_0x6de4('0x67')](_0x3ae833,{'networks':_0x4e2074||[]});fs['writeFileSync'](_0x6de4('0x6d'),_0x41ddeb);return respondWithRpcPromise(_0x6de4('0x60'),_0x6de4('0x34'),{'module':'res_stun_monitor.so'});}else if(_0x25ea6f[_0x6de4('0x3d')][_0x6de4('0x59')]()==_0x6de4('0x61')){var _0x3d3a64=fs['readFileSync'](path[_0x6de4('0x5c')](config[_0x6de4('0x5d')],_0x6de4('0x62')),'utf8');var _0x474e09=ejs[_0x6de4('0x67')](_0x3d3a64,{'networks':_0x4e2074||[]});fs[_0x6de4('0x63')](_0x6de4('0x64'),_0x474e09);return respondWithRpcPromise(_0x6de4('0x60'),_0x6de4('0x34'),{'module':_0x6de4('0x65')});}else{var _0xba5458=fs[_0x6de4('0x5b')](path[_0x6de4('0x5c')](config[_0x6de4('0x5d')],'server/files/templates/network.ejs'),_0x6de4('0x5f'));var _0x229506=ejs['render'](_0xba5458,{'networks':_0x4e2074||[]});fs[_0x6de4('0x63')](util['format'](_0x6de4('0x69'),_0x4ed54a['body']['type']['toLowerCase']()),_0x229506);return respondWithRpcPromise(_0x6de4('0x60'),_0x6de4('0x34'),{'module':_0x6de4('0x6b')});}return null;})[_0x6de4('0x1e')](function(_0x7ae66e){if(_0x7ae66e){return _0x25ea6f;}return null;});})[_0x6de4('0x1e')](respondWithResult(_0x397ae3,null))['catch'](handleError(_0x397ae3,null));};exports[_0x6de4('0x6e')]=function(_0x550046,_0x233079,_0x3e7f27){var _0x368536;return db[_0x6de4('0x3a')][_0x6de4('0x55')]({'where':{'id':_0x550046['params']['id']}})[_0x6de4('0x1e')](function(_0x276e83){_0x368536=_0x276e83;return _0x276e83;})['then'](handleEntityNotFound(_0x233079,null))[_0x6de4('0x1e')](removeEntity(_0x233079,null))[_0x6de4('0x1e')](function(){if(_0x368536){return db[_0x6de4('0x3a')][_0x6de4('0x50')]({'where':{'type':_0x368536['type']},'raw':!![]});}})[_0x6de4('0x1e')](function(_0x144adf){if(_0x368536[_0x6de4('0x3d')][_0x6de4('0x59')]()==_0x6de4('0x5a')){var _0x3d4382=fs['readFileSync'](path[_0x6de4('0x5c')](config[_0x6de4('0x5d')],_0x6de4('0x5e')),_0x6de4('0x5f'));var _0x11e18c=ejs[_0x6de4('0x67')](_0x3d4382,{'networks':_0x144adf||[]});fs[_0x6de4('0x63')](_0x6de4('0x6d'),_0x11e18c);return respondWithRpcPromise(_0x6de4('0x60'),_0x6de4('0x6e'),{'module':'res_stun_monitor.so'});}else if(_0x368536[_0x6de4('0x3d')][_0x6de4('0x59')]()=='TURN'){var _0x2c6eea=fs['readFileSync'](path['join'](config[_0x6de4('0x5d')],_0x6de4('0x62')),_0x6de4('0x5f'));var _0x5b8e8a=ejs[_0x6de4('0x67')](_0x2c6eea,{'networks':_0x144adf||[]});fs['writeFileSync'](_0x6de4('0x64'),_0x5b8e8a);return respondWithRpcPromise('Reload',_0x6de4('0x6e'),{'module':'res_stun_monitor.so'});}else{var _0x205401=fs[_0x6de4('0x5b')](path['join'](config[_0x6de4('0x5d')],_0x6de4('0x66')),_0x6de4('0x5f'));var _0x3c60a9=ejs[_0x6de4('0x67')](_0x205401,{'networks':_0x144adf||[]});fs[_0x6de4('0x63')](util[_0x6de4('0x68')](_0x6de4('0x69'),_0x550046['body'][_0x6de4('0x3d')]['toLowerCase']()),_0x3c60a9);return respondWithRpcPromise(_0x6de4('0x60'),_0x6de4('0x6e'),{'module':_0x6de4('0x6b')});}return null;})[_0x6de4('0x29')](handleError(_0x233079,null));}; \ No newline at end of file +var _0xde78=['request','info','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','request\x20sent','sendStatus','status','end','count','offset','limit','set','json','reject','save','destroy','then','stack','name','send','index','map','Network','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','filter','merge','includeAll','include','findAll','rows','params','options','find','transaction','create','toUpperCase','STUN','readFileSync','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','root','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','body','toLowerCase','chan_sip.so','catch','update','format','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0xde78,0x120));var _0x8de7=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xde78[_0x68c979];return _0x4f0001;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8de7('0x0'));var rimraf=require(_0x8de7('0x1'));var zipdir=require(_0x8de7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8de7('0x3'));var moment=require(_0x8de7('0x4'));var BPromise=require(_0x8de7('0x5'));var Mustache=require(_0x8de7('0x6'));var util=require(_0x8de7('0x7'));var path=require(_0x8de7('0x8'));var sox=require(_0x8de7('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8de7('0xa'));var squel=require('squel');var crypto=require(_0x8de7('0xb'));var jsforce=require(_0x8de7('0xc'));var deskjs=require(_0x8de7('0xd'));var toCsv=require(_0x8de7('0xe'));var querystring=require(_0x8de7('0xf'));var Papa=require(_0x8de7('0x10'));var Redis=require(_0x8de7('0x11'));var authService=require(_0x8de7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8de7('0x13'));var hardwareService=require(_0x8de7('0x14'));var logger=require('../../config/logger')(_0x8de7('0x15'));var utils=require(_0x8de7('0x16'));var config=require(_0x8de7('0x17'));var db=require(_0x8de7('0x18'))['db'];var jayson=require(_0x8de7('0x19'));var client=jayson[_0x8de7('0x1a')][_0x8de7('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x23ccd,_0x15709d,_0x131d40){if(_0x131d40){var _0x50aee4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x50aee4['test'](_0x15709d)){return _0x23ccd;}else{throw new db[(_0x8de7('0x1c'))][(_0x8de7('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x23ccd;}}function respondWithRpcPromise(_0x3e6bde,_0x50109e,_0x3468e7,_0x5a559b){return new BPromise(function(_0x1b4313,_0x5a591d){var _0x202090=_0x5a559b||client;return _0x202090[_0x8de7('0x1e')](_0x3e6bde,_0x3468e7)['then'](function(_0x1f083f){logger[_0x8de7('0x1f')]('Network,\x20%s,\x20%s',_0x50109e,'request\x20sent');logger[_0x8de7('0x20')](_0x8de7('0x21'),_0x50109e,'request\x20sent',JSON[_0x8de7('0x22')](_0x1f083f));if(_0x1f083f['error']){if(_0x1f083f[_0x8de7('0x23')][_0x8de7('0x24')]===0x1f4){logger['error'](_0x8de7('0x25'),_0x50109e,_0x1f083f['error'][_0x8de7('0x26')]);return _0x5a591d(_0x1f083f[_0x8de7('0x23')][_0x8de7('0x26')]);}logger[_0x8de7('0x23')](_0x8de7('0x25'),_0x50109e,_0x1f083f['error'][_0x8de7('0x26')]);return _0x1b4313(_0x1f083f['error'][_0x8de7('0x26')]);}else{logger[_0x8de7('0x1f')]('Network,\x20%s,\x20%s',_0x50109e,_0x8de7('0x27'));_0x1b4313(_0x1f083f['result'][_0x8de7('0x26')]);}})['catch'](function(_0x264976){logger[_0x8de7('0x23')](_0x8de7('0x25'),_0x50109e,_0x264976);_0x5a591d(_0x264976);});});}function respondWithStatusCode(_0x478f19,_0x178341){_0x178341=_0x178341||0xcc;return function(_0x2f5b92){if(_0x2f5b92){return _0x478f19[_0x8de7('0x28')](_0x178341);}return _0x478f19[_0x8de7('0x29')](_0x178341)[_0x8de7('0x2a')]();};}function respondWithResult(_0x14a358,_0x38ca9c){_0x38ca9c=_0x38ca9c||0xc8;return function(_0x45aa54){if(_0x45aa54){return _0x14a358['status'](_0x38ca9c)['json'](_0x45aa54);}};}function respondWithFilteredResult(_0x25ffac,_0xd3a265){return function(_0x1e9e4d){if(_0x1e9e4d){var _0x3cb5e3=_0x1e9e4d[_0x8de7('0x2b')],_0x209f9c=_0xd3a265['offset'],_0x335bd4=_0xd3a265[_0x8de7('0x2c')]+_0xd3a265[_0x8de7('0x2d')],_0x91f4b1;if(_0x335bd4>=_0x3cb5e3){_0x335bd4=_0x3cb5e3;_0x91f4b1=0xc8;}else{_0x91f4b1=0xce;}_0x25ffac[_0x8de7('0x29')](_0x91f4b1);return _0x25ffac[_0x8de7('0x2e')]('Content-Range',_0x209f9c+'-'+_0x335bd4+'/'+_0x3cb5e3)[_0x8de7('0x2f')](_0x1e9e4d);}return null;};}function patchUpdates(_0x41f673){return function(_0xe4d69b){try{jsonpatch['apply'](_0xe4d69b,_0x41f673,!![]);}catch(_0x3577db){return BPromise[_0x8de7('0x30')](_0x3577db);}return _0xe4d69b[_0x8de7('0x31')]();};}function saveUpdates(_0x27e072,_0x3f01b1){return function(_0x494c54){if(_0x494c54){return _0x494c54['update'](_0x27e072)['then'](function(_0xc7d837){return _0xc7d837;});}return null;};}function removeEntity(_0x5c1a36,_0x530455){return function(_0x507873){if(_0x507873){return _0x507873[_0x8de7('0x32')]()[_0x8de7('0x33')](function(){_0x5c1a36[_0x8de7('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x469998,_0x2bd4d6){return function(_0x2d6511){if(!_0x2d6511){_0x469998[_0x8de7('0x28')](0x194);}return _0x2d6511;};}function handleError(_0x11180c,_0x1ac270){_0x1ac270=_0x1ac270||0x1f4;return function(_0xf93d2d){logger['error'](_0xf93d2d[_0x8de7('0x34')]);if(_0xf93d2d[_0x8de7('0x35')]){delete _0xf93d2d[_0x8de7('0x35')];}_0x11180c[_0x8de7('0x29')](_0x1ac270)[_0x8de7('0x36')](_0xf93d2d);};}exports[_0x8de7('0x37')]=function(_0x3e3cd1,_0x1adeda){var _0x2ea780={},_0xe69d7e={},_0x29411c={'count':0x0,'rows':[]};var _0x1560ee=_[_0x8de7('0x38')](db[_0x8de7('0x39')]['rawAttributes'],function(_0x19f471){return{'name':_0x19f471[_0x8de7('0x3a')],'type':_0x19f471[_0x8de7('0x3b')][_0x8de7('0x3c')]};});_0xe69d7e[_0x8de7('0x3d')]=_[_0x8de7('0x38')](_0x1560ee,_0x8de7('0x35'));_0xe69d7e['query']=_[_0x8de7('0x3e')](_0x3e3cd1[_0x8de7('0x3f')]);_0xe69d7e['filters']=_[_0x8de7('0x40')](_0xe69d7e['model'],_0xe69d7e[_0x8de7('0x3f')]);_0x2ea780[_0x8de7('0x41')]=_['intersection'](_0xe69d7e[_0x8de7('0x3d')],qs[_0x8de7('0x42')](_0x3e3cd1[_0x8de7('0x3f')][_0x8de7('0x42')]));_0x2ea780[_0x8de7('0x41')]=_0x2ea780['attributes'][_0x8de7('0x43')]?_0x2ea780[_0x8de7('0x41')]:_0xe69d7e[_0x8de7('0x3d')];if(!_0x3e3cd1[_0x8de7('0x3f')][_0x8de7('0x44')](_0x8de7('0x45'))){_0x2ea780['limit']=qs['limit'](_0x3e3cd1['query'][_0x8de7('0x2d')]);_0x2ea780['offset']=qs[_0x8de7('0x2c')](_0x3e3cd1['query'][_0x8de7('0x2c')]);}_0x2ea780['order']=qs['sort'](_0x3e3cd1[_0x8de7('0x3f')]['sort']);_0x2ea780[_0x8de7('0x46')]=qs[_0x8de7('0x47')](_['pick'](_0x3e3cd1[_0x8de7('0x3f')],_0xe69d7e[_0x8de7('0x47')]),_0x1560ee);if(_0x3e3cd1['query'][_0x8de7('0x48')]){_0x2ea780[_0x8de7('0x46')]=_[_0x8de7('0x49')](_0x2ea780['where'],{'$or':_[_0x8de7('0x38')](_0x1560ee,function(_0x9bb5e0){if(_0x9bb5e0[_0x8de7('0x3b')]!=='VIRTUAL'){var _0x16abbb={};_0x16abbb[_0x9bb5e0[_0x8de7('0x35')]]={'$like':'%'+_0x3e3cd1[_0x8de7('0x3f')]['filter']+'%'};return _0x16abbb;}})});}_0x2ea780=_[_0x8de7('0x49')]({},_0x2ea780,_0x3e3cd1['options']);var _0x299530={'where':_0x2ea780[_0x8de7('0x46')]};return db['Network']['count'](_0x299530)['then'](function(_0x314e13){_0x29411c['count']=_0x314e13;if(_0x3e3cd1['query'][_0x8de7('0x4a')]){_0x2ea780[_0x8de7('0x4b')]=[{'all':!![]}];}return db['Network'][_0x8de7('0x4c')](_0x2ea780);})[_0x8de7('0x33')](function(_0x31b10e){_0x29411c[_0x8de7('0x4d')]=_0x31b10e;return _0x29411c;})[_0x8de7('0x33')](respondWithFilteredResult(_0x1adeda,_0x2ea780))['catch'](handleError(_0x1adeda,null));};exports['show']=function(_0x5748cd,_0x1e1023){var _0x4c7e2c={'raw':!![],'where':{'id':_0x5748cd[_0x8de7('0x4e')]['id']}},_0x1eac3e={};_0x1eac3e[_0x8de7('0x3d')]=_[_0x8de7('0x3e')](db[_0x8de7('0x39')]['rawAttributes']);_0x1eac3e[_0x8de7('0x3f')]=_[_0x8de7('0x3e')](_0x5748cd[_0x8de7('0x3f')]);_0x1eac3e['filters']=_['intersection'](_0x1eac3e[_0x8de7('0x3d')],_0x1eac3e['query']);_0x4c7e2c[_0x8de7('0x41')]=_[_0x8de7('0x40')](_0x1eac3e[_0x8de7('0x3d')],qs['fields'](_0x5748cd['query'][_0x8de7('0x42')]));_0x4c7e2c['attributes']=_0x4c7e2c['attributes'][_0x8de7('0x43')]?_0x4c7e2c[_0x8de7('0x41')]:_0x1eac3e[_0x8de7('0x3d')];if(_0x5748cd[_0x8de7('0x3f')][_0x8de7('0x4a')]){_0x4c7e2c[_0x8de7('0x4b')]=[{'all':!![]}];}_0x4c7e2c=_['merge']({},_0x4c7e2c,_0x5748cd[_0x8de7('0x4f')]);return db[_0x8de7('0x39')][_0x8de7('0x50')](_0x4c7e2c)[_0x8de7('0x33')](handleEntityNotFound(_0x1e1023,null))[_0x8de7('0x33')](respondWithResult(_0x1e1023,null))['catch'](handleError(_0x1e1023,null));};exports['create']=function(_0x1cbc45,_0x160762,_0x259486){var _0x2b8cb4;return db['sequelize'][_0x8de7('0x51')](function(_0x229b59){return db[_0x8de7('0x39')][_0x8de7('0x52')](_0x1cbc45['body'],{'raw':!![]})[_0x8de7('0x33')](function(_0x3ff47d){_0x2b8cb4=_0x3ff47d;return db['Network'][_0x8de7('0x4c')]({'where':{'type':_0x1cbc45['body']['type']},'raw':!![]});})[_0x8de7('0x33')](function(_0x2db4ab){if(_0x2b8cb4[_0x8de7('0x3b')][_0x8de7('0x53')]()==_0x8de7('0x54')){var _0x348f90=fs[_0x8de7('0x55')](path['join'](config['root'],_0x8de7('0x56')),_0x8de7('0x57'));var _0x138043=ejs[_0x8de7('0x58')](_0x348f90,{'networks':_0x2db4ab||[]});fs['writeFileSync'](_0x8de7('0x59'),_0x138043);return respondWithRpcPromise(_0x8de7('0x5a'),'create',{'module':_0x8de7('0x5b')});}else if(_0x2b8cb4['type'][_0x8de7('0x53')]()==_0x8de7('0x5c')){var _0x4b14c1=fs['readFileSync'](path[_0x8de7('0x5d')](config[_0x8de7('0x5e')],_0x8de7('0x5f')),_0x8de7('0x57'));var _0x345dda=ejs[_0x8de7('0x58')](_0x4b14c1,{'networks':_0x2db4ab||[]});fs[_0x8de7('0x60')](_0x8de7('0x61'),_0x345dda);return respondWithRpcPromise('Reload',_0x8de7('0x52'),{'module':_0x8de7('0x5b')});}else{var _0x283ea2=fs[_0x8de7('0x55')](path[_0x8de7('0x5d')](config[_0x8de7('0x5e')],_0x8de7('0x62')),_0x8de7('0x57'));var _0x421da4=ejs['render'](_0x283ea2,{'networks':_0x2db4ab||[]});fs['writeFileSync'](util['format'](_0x8de7('0x63'),_0x1cbc45[_0x8de7('0x64')][_0x8de7('0x3b')][_0x8de7('0x65')]()),_0x421da4);return respondWithRpcPromise('Reload','create',{'module':_0x8de7('0x66')});}return null;})[_0x8de7('0x33')](function(){return _0x2b8cb4;});})[_0x8de7('0x33')](respondWithResult(_0x160762,0xc9))[_0x8de7('0x67')](handleError(_0x160762,null));};exports[_0x8de7('0x68')]=function(_0x1a824b,_0x1b5552,_0x503cb6){var _0x1f06d9;return db['sequelize'][_0x8de7('0x51')](function(_0x2282c0){return db[_0x8de7('0x39')]['find']({'where':{'id':_0x1a824b[_0x8de7('0x4e')]['id']}})[_0x8de7('0x33')](handleEntityNotFound(_0x1b5552,null))[_0x8de7('0x33')](saveUpdates(_0x1a824b['body'],null))['then'](function(_0x3e0a89){if(_0x3e0a89){_0x1f06d9=_0x3e0a89;return db[_0x8de7('0x39')][_0x8de7('0x4c')]({'where':{'type':_0x1f06d9[_0x8de7('0x3b')]},'raw':!![]});}return null;})[_0x8de7('0x33')](function(_0x576fa7){if(_0x1f06d9['type'][_0x8de7('0x53')]()==_0x8de7('0x54')){var _0x100e0f=fs[_0x8de7('0x55')](path[_0x8de7('0x5d')](config[_0x8de7('0x5e')],_0x8de7('0x56')),_0x8de7('0x57'));var _0x1ddf5e=ejs[_0x8de7('0x58')](_0x100e0f,{'networks':_0x576fa7||[]});fs[_0x8de7('0x60')](_0x8de7('0x59'),_0x1ddf5e);return respondWithRpcPromise(_0x8de7('0x5a'),_0x8de7('0x68'),{'module':_0x8de7('0x5b')});}else if(_0x1f06d9[_0x8de7('0x3b')]['toUpperCase']()==_0x8de7('0x5c')){var _0x4eeadc=fs['readFileSync'](path['join'](config[_0x8de7('0x5e')],_0x8de7('0x5f')),_0x8de7('0x57'));var _0xe8ee25=ejs[_0x8de7('0x58')](_0x4eeadc,{'networks':_0x576fa7||[]});fs['writeFileSync'](_0x8de7('0x61'),_0xe8ee25);return respondWithRpcPromise(_0x8de7('0x5a'),_0x8de7('0x68'),{'module':_0x8de7('0x5b')});}else{var _0x153e02=fs[_0x8de7('0x55')](path[_0x8de7('0x5d')](config[_0x8de7('0x5e')],_0x8de7('0x62')),_0x8de7('0x57'));var _0x35acb4=ejs[_0x8de7('0x58')](_0x153e02,{'networks':_0x576fa7||[]});fs[_0x8de7('0x60')](util[_0x8de7('0x69')](_0x8de7('0x63'),_0x1a824b[_0x8de7('0x64')][_0x8de7('0x3b')][_0x8de7('0x65')]()),_0x35acb4);return respondWithRpcPromise(_0x8de7('0x5a'),_0x8de7('0x68'),{'module':_0x8de7('0x66')});}return null;})[_0x8de7('0x33')](function(_0x225ba5){if(_0x225ba5){return _0x1f06d9;}return null;});})[_0x8de7('0x33')](respondWithResult(_0x1b5552,null))['catch'](handleError(_0x1b5552,null));};exports[_0x8de7('0x32')]=function(_0x2d5a56,_0x357a13,_0x2edf23){var _0xb29f26;return db['Network'][_0x8de7('0x50')]({'where':{'id':_0x2d5a56[_0x8de7('0x4e')]['id']}})['then'](function(_0xc125b8){_0xb29f26=_0xc125b8;return _0xc125b8;})[_0x8de7('0x33')](handleEntityNotFound(_0x357a13,null))[_0x8de7('0x33')](removeEntity(_0x357a13,null))['then'](function(){if(_0xb29f26){return db[_0x8de7('0x39')][_0x8de7('0x4c')]({'where':{'type':_0xb29f26[_0x8de7('0x3b')]},'raw':!![]});}})[_0x8de7('0x33')](function(_0x565909){if(_0xb29f26[_0x8de7('0x3b')]['toUpperCase']()=='STUN'){var _0xdc0865=fs[_0x8de7('0x55')](path['join'](config[_0x8de7('0x5e')],_0x8de7('0x56')),_0x8de7('0x57'));var _0x20b6bf=ejs[_0x8de7('0x58')](_0xdc0865,{'networks':_0x565909||[]});fs['writeFileSync'](_0x8de7('0x59'),_0x20b6bf);return respondWithRpcPromise(_0x8de7('0x5a'),_0x8de7('0x32'),{'module':'res_stun_monitor.so'});}else if(_0xb29f26[_0x8de7('0x3b')][_0x8de7('0x53')]()==_0x8de7('0x5c')){var _0xf86496=fs[_0x8de7('0x55')](path[_0x8de7('0x5d')](config[_0x8de7('0x5e')],'server/files/templates/turn_multiple.ejs'),_0x8de7('0x57'));var _0xf6be9b=ejs[_0x8de7('0x58')](_0xf86496,{'networks':_0x565909||[]});fs[_0x8de7('0x60')](_0x8de7('0x61'),_0xf6be9b);return respondWithRpcPromise(_0x8de7('0x5a'),_0x8de7('0x32'),{'module':_0x8de7('0x5b')});}else{var _0x2df4db=fs[_0x8de7('0x55')](path[_0x8de7('0x5d')](config[_0x8de7('0x5e')],_0x8de7('0x62')),_0x8de7('0x57'));var _0x490030=ejs[_0x8de7('0x58')](_0x2df4db,{'networks':_0x565909||[]});fs[_0x8de7('0x60')](util[_0x8de7('0x69')](_0x8de7('0x63'),_0x2d5a56['body']['type']['toLowerCase']()),_0x490030);return respondWithRpcPromise(_0x8de7('0x5a'),_0x8de7('0x32'),{'module':_0x8de7('0x66')});}return null;})[_0x8de7('0x67')](handleError(_0x357a13,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 8c13c9c..7e9b8ee 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 _0xf583=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util'];(function(_0x26b622,_0x237e9e){var _0x58a028=function(_0xde1652){while(--_0xde1652){_0x26b622['push'](_0x26b622['shift']());}};_0x58a028(++_0x237e9e);}(_0xf583,0x1cc));var _0x3f58=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xf583[_0x20589d];return _0x422de9;};'use strict';var _=require(_0x3f58('0x0'));var util=require(_0x3f58('0x1'));var logger=require(_0x3f58('0x2'))(_0x3f58('0x3'));var moment=require('moment');var BPromise=require(_0x3f58('0x4'));var rp=require(_0x3f58('0x5'));var fs=require('fs');var path=require(_0x3f58('0x6'));var rimraf=require(_0x3f58('0x7'));var config=require(_0x3f58('0x8'));var attributes=require(_0x3f58('0x9'));module[_0x3f58('0xa')]=function(_0x1969d3,_0x15f7ac){return _0x1969d3[_0x3f58('0xb')](_0x3f58('0xc'),attributes,{'tableName':_0x3f58('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50f6=['network','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define'];(function(_0x12b936,_0x9930d){var _0x1e4698=function(_0x13d4d1){while(--_0x13d4d1){_0x12b936['push'](_0x12b936['shift']());}};_0x1e4698(++_0x9930d);}(_0x50f6,0x1af));var _0x650f=function(_0x375a22,_0x4c065d){_0x375a22=_0x375a22-0x0;var _0x573d9f=_0x50f6[_0x375a22];return _0x573d9f;};'use strict';var _=require('lodash');var util=require(_0x650f('0x0'));var logger=require(_0x650f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x650f('0x2'));var fs=require('fs');var path=require(_0x650f('0x3'));var rimraf=require(_0x650f('0x4'));var config=require(_0x650f('0x5'));var attributes=require(_0x650f('0x6'));module[_0x650f('0x7')]=function(_0x50ba86,_0x449a45){return _0x50ba86[_0x650f('0x8')]('Network',attributes,{'tableName':_0x650f('0x9'),'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 ba421c9..a4bda46 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 _0x7c48=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','Network,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xee70ee,_0x35b126){var _0x319238=function(_0x2c9eb7){while(--_0x2c9eb7){_0xee70ee['push'](_0xee70ee['shift']());}};_0x319238(++_0x35b126);}(_0x7c48,0x171));var _0x87c4=function(_0x47b8c2,_0x151300){_0x47b8c2=_0x47b8c2-0x0;var _0x4b6b96=_0x7c48[_0x47b8c2];return _0x4b6b96;};'use strict';var _=require(_0x87c4('0x0'));var util=require(_0x87c4('0x1'));var moment=require(_0x87c4('0x2'));var BPromise=require(_0x87c4('0x3'));var rs=require(_0x87c4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87c4('0x5'))['db'];var utils=require(_0x87c4('0x6'));var logger=require(_0x87c4('0x7'))('rpc');var config=require(_0x87c4('0x8'));var jayson=require(_0x87c4('0x9'));var client=jayson['client'][_0x87c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb173a5,_0x2d2d6f,_0x5d853a){return new BPromise(function(_0x455d6c,_0x1d0e62){return client[_0x87c4('0xb')](_0xb173a5,_0x5d853a)[_0x87c4('0xc')](function(_0x470abb){logger[_0x87c4('0xd')]('Network,\x20%s,\x20%s',_0x2d2d6f,_0x87c4('0xe'));logger[_0x87c4('0xf')](_0x87c4('0x10'),_0x2d2d6f,_0x87c4('0xe'),JSON[_0x87c4('0x11')](_0x470abb));if(_0x470abb[_0x87c4('0x12')]){if(_0x470abb[_0x87c4('0x12')]['code']===0x1f4){logger[_0x87c4('0x12')](_0x87c4('0x13'),_0x2d2d6f,_0x470abb[_0x87c4('0x12')]['message']);return _0x1d0e62(_0x470abb['error'][_0x87c4('0x14')]);}logger[_0x87c4('0x12')](_0x87c4('0x13'),_0x2d2d6f,_0x470abb['error'][_0x87c4('0x14')]);return _0x455d6c(_0x470abb[_0x87c4('0x12')]['message']);}else{logger[_0x87c4('0xd')](_0x87c4('0x13'),_0x2d2d6f,'request\x20sent');_0x455d6c(_0x470abb['result'][_0x87c4('0x14')]);}})[_0x87c4('0x15')](function(_0x485713){logger[_0x87c4('0x12')](_0x87c4('0x13'),_0x2d2d6f,_0x485713);_0x1d0e62(_0x485713);});});} \ No newline at end of file +var _0x6cd9=['http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2fd3bc,_0x5a1e11){var _0x1ea703=function(_0x11cdc9){while(--_0x11cdc9){_0x2fd3bc['push'](_0x2fd3bc['shift']());}};_0x1ea703(++_0x5a1e11);}(_0x6cd9,0x1d6));var _0x96cd=function(_0x3a0d7e,_0x33a907){_0x3a0d7e=_0x3a0d7e-0x0;var _0x599649=_0x6cd9[_0x3a0d7e];return _0x599649;};'use strict';var _=require(_0x96cd('0x0'));var util=require(_0x96cd('0x1'));var moment=require(_0x96cd('0x2'));var BPromise=require(_0x96cd('0x3'));var rs=require(_0x96cd('0x4'));var fs=require('fs');var Redis=require(_0x96cd('0x5'));var db=require(_0x96cd('0x6'))['db'];var utils=require(_0x96cd('0x7'));var logger=require(_0x96cd('0x8'))(_0x96cd('0x9'));var config=require(_0x96cd('0xa'));var jayson=require(_0x96cd('0xb'));var client=jayson[_0x96cd('0xc')][_0x96cd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x52117f,_0xc390a7,_0x4a51a3){return new BPromise(function(_0x28ea0b,_0x511f34){return client[_0x96cd('0xe')](_0x52117f,_0x4a51a3)['then'](function(_0x2c6c6e){logger[_0x96cd('0xf')](_0x96cd('0x10'),_0xc390a7,_0x96cd('0x11'));logger[_0x96cd('0x12')]('Network,\x20%s,\x20%s,\x20%s',_0xc390a7,_0x96cd('0x11'),JSON['stringify'](_0x2c6c6e));if(_0x2c6c6e[_0x96cd('0x13')]){if(_0x2c6c6e['error']['code']===0x1f4){logger[_0x96cd('0x13')](_0x96cd('0x10'),_0xc390a7,_0x2c6c6e[_0x96cd('0x13')][_0x96cd('0x14')]);return _0x511f34(_0x2c6c6e[_0x96cd('0x13')][_0x96cd('0x14')]);}logger[_0x96cd('0x13')]('Network,\x20%s,\x20%s',_0xc390a7,_0x2c6c6e[_0x96cd('0x13')]['message']);return _0x28ea0b(_0x2c6c6e[_0x96cd('0x13')][_0x96cd('0x14')]);}else{logger[_0x96cd('0xf')]('Network,\x20%s,\x20%s',_0xc390a7,_0x96cd('0x11'));_0x28ea0b(_0x2c6c6e[_0x96cd('0x15')][_0x96cd('0x14')]);}})[_0x96cd('0x16')](function(_0x12b37b){logger[_0x96cd('0x13')](_0x96cd('0x10'),_0xc390a7,_0x12b37b);_0x511f34(_0x12b37b);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index dd20127..f1b9015 100644 --- a/server/api/notification/index.js +++ b/server/api/notification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e2d=['Router','../../components/interaction/service','../../config/environment','isAuthenticated','sendNotification','exports','multer','util','path','express'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4e2d,0x16e));var _0xd4e2=function(_0x52c6b9,_0x4174f7){_0x52c6b9=_0x52c6b9-0x0;var _0x5157e1=_0x4e2d[_0x52c6b9];return _0x5157e1;};'use strict';var multer=require(_0xd4e2('0x0'));var util=require(_0xd4e2('0x1'));var path=require(_0xd4e2('0x2'));var timeout=require('connect-timeout');var express=require(_0xd4e2('0x3'));var router=express[_0xd4e2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd4e2('0x5'));var config=require(_0xd4e2('0x6'));var controller=require('./notification.controller');router['post']('/',auth[_0xd4e2('0x7')](),controller[_0xd4e2('0x8')]);module[_0xd4e2('0x9')]=router; \ No newline at end of file +var _0x978f=['multer','path','express','Router','../../components/interaction/service','../../config/environment','./notification.controller','isAuthenticated','sendNotification'];(function(_0x59eacf,_0x56ec4a){var _0x5d74f2=function(_0x5476ed){while(--_0x5476ed){_0x59eacf['push'](_0x59eacf['shift']());}};_0x5d74f2(++_0x56ec4a);}(_0x978f,0x75));var _0xf978=function(_0x3517d9,_0x1e6703){_0x3517d9=_0x3517d9-0x0;var _0x29a2f4=_0x978f[_0x3517d9];return _0x29a2f4;};'use strict';var multer=require(_0xf978('0x0'));var util=require('util');var path=require(_0xf978('0x1'));var timeout=require('connect-timeout');var express=require(_0xf978('0x2'));var router=express[_0xf978('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf978('0x4'));var config=require(_0xf978('0x5'));var controller=require(_0xf978('0x6'));router['post']('/',auth[_0xf978('0x7')](),controller[_0xf978('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 702767d..e9e2fa8 100644 --- a/server/api/notification/notification.attributes.js +++ b/server/api/notification/notification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe09d=['STRING','exports','TEXT'];(function(_0x433d99,_0x108a6e){var _0x30117f=function(_0x33730b){while(--_0x33730b){_0x433d99['push'](_0x433d99['shift']());}};_0x30117f(++_0x108a6e);}(_0xe09d,0x12a));var _0xde09=function(_0x175057,_0x509d2c){_0x175057=_0x175057-0x0;var _0x84d644=_0xe09d[_0x175057];return _0x84d644;};'use strict';var Sequelize=require('sequelize');module[_0xde09('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xde09('0x1')]},'recipientsDescription':{'type':Sequelize[_0xde09('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xdd8e=['sequelize','exports','STRING','TEXT','BOOLEAN'];(function(_0xc364a5,_0x3df600){var _0x3599a6=function(_0x28ae65){while(--_0x28ae65){_0xc364a5['push'](_0xc364a5['shift']());}};_0x3599a6(++_0x3df600);}(_0xdd8e,0xc3));var _0xedd8=function(_0x1da09c,_0xe7b37d){_0x1da09c=_0x1da09c-0x0;var _0x34e180=_0xdd8e[_0x1da09c];return _0x34e180;};'use strict';var Sequelize=require(_0xedd8('0x0'));module[_0xedd8('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xedd8('0x2')]},'recipientsId':{'type':Sequelize[_0xedd8('0x3')]},'recipientsDescription':{'type':Sequelize[_0xedd8('0x2')]},'beep':{'type':Sequelize[_0xedd8('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 83326d5..042008c 100644 --- a/server/api/notification/notification.controller.js +++ b/server/api/notification/notification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c40=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','body','hasOwnProperty','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','whatsappqueue','team','user','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','sequelize','transaction','Notification','forEach','recipient','emit','notification:send','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','model','User','ids','queue','replace','Queue','all','union','flatten','getAgents','map','eml-format'];(function(_0x4eac61,_0x4166ca){var _0x5170bf=function(_0x1170c8){while(--_0x1170c8){_0x4eac61['push'](_0x4eac61['shift']());}};_0x5170bf(++_0x4166ca);}(_0x9c40,0x11c));var _0x09c4=function(_0x42258b,_0x2e848c){_0x42258b=_0x42258b-0x0;var _0x4e123f=_0x9c40[_0x42258b];return _0x4e123f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x09c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x09c4('0x1'));var jsonpatch=require(_0x09c4('0x2'));var rp=require(_0x09c4('0x3'));var moment=require(_0x09c4('0x4'));var BPromise=require(_0x09c4('0x5'));var Mustache=require(_0x09c4('0x6'));var util=require(_0x09c4('0x7'));var path=require(_0x09c4('0x8'));var sox=require('sox');var csv=require(_0x09c4('0x9'));var ejs=require(_0x09c4('0xa'));var fs=require('fs');var _=require(_0x09c4('0xb'));var squel=require('squel');var crypto=require(_0x09c4('0xc'));var jsforce=require(_0x09c4('0xd'));var deskjs=require(_0x09c4('0xe'));var toCsv=require(_0x09c4('0x9'));var querystring=require(_0x09c4('0xf'));var Papa=require(_0x09c4('0x10'));var Redis=require('ioredis');var authService=require(_0x09c4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x09c4('0x12'));var hardwareService=require(_0x09c4('0x13'));var logger=require(_0x09c4('0x14'))(_0x09c4('0x15'));var utils=require('../../config/utils');var config=require(_0x09c4('0x16'));var db=require(_0x09c4('0x17'))['db'];config[_0x09c4('0x18')]=_['defaults'](config[_0x09c4('0x18')],{'host':_0x09c4('0x19'),'port':0x18eb});var socket=require(_0x09c4('0x1a'))(new Redis(config[_0x09c4('0x18')]));require('./notification.socket')['register'](socket);function respondWithStatusCode(_0x232b78,_0x28d406){_0x28d406=_0x28d406||0xcc;return function(_0x425912){if(_0x425912){return _0x232b78['sendStatus'](_0x28d406);}return _0x232b78[_0x09c4('0x1b')](_0x28d406)[_0x09c4('0x1c')]();};}function respondWithResult(_0x1b4ca4,_0x55e62f){_0x55e62f=_0x55e62f||0xc8;return function(_0x1557a0){if(_0x1557a0){return _0x1b4ca4[_0x09c4('0x1b')](_0x55e62f)[_0x09c4('0x1d')](_0x1557a0);}};}function respondWithFilteredResult(_0x2c767f,_0x2530d7){return function(_0x412f31){if(_0x412f31){var _0x320f0a=_0x412f31[_0x09c4('0x1e')],_0xbebffc=_0x2530d7[_0x09c4('0x1f')],_0x517048=_0x2530d7[_0x09c4('0x1f')]+_0x2530d7['limit'],_0x150a7b;if(_0x517048>=_0x320f0a){_0x517048=_0x320f0a;_0x150a7b=0xc8;}else{_0x150a7b=0xce;}_0x2c767f['status'](_0x150a7b);return _0x2c767f[_0x09c4('0x20')](_0x09c4('0x21'),_0xbebffc+'-'+_0x517048+'/'+_0x320f0a)[_0x09c4('0x1d')](_0x412f31);}return null;};}function patchUpdates(_0x3a28e0){return function(_0x389978){try{jsonpatch[_0x09c4('0x22')](_0x389978,_0x3a28e0,!![]);}catch(_0x5429de){return BPromise[_0x09c4('0x23')](_0x5429de);}return _0x389978['save']();};}function saveUpdates(_0x1550f6,_0x34e526){return function(_0x3ed165){if(_0x3ed165){return _0x3ed165[_0x09c4('0x24')](_0x1550f6)[_0x09c4('0x25')](function(_0x25d8ab){return _0x25d8ab;});}return null;};}function removeEntity(_0x469932,_0xc055e8){return function(_0x4f6ec9){if(_0x4f6ec9){return _0x4f6ec9['destroy']()[_0x09c4('0x25')](function(){_0x469932[_0x09c4('0x1b')](0xcc)[_0x09c4('0x1c')]();});}};}function handleEntityNotFound(_0x4cb8c1,_0x3ac3e3){return function(_0x445af2){if(!_0x445af2){_0x4cb8c1[_0x09c4('0x26')](0x194);}return _0x445af2;};}function handleError(_0x128300,_0x343af6){_0x343af6=_0x343af6||0x1f4;return function(_0x2207e3){logger[_0x09c4('0x27')](_0x2207e3[_0x09c4('0x28')]);if(_0x2207e3[_0x09c4('0x29')]){delete _0x2207e3[_0x09c4('0x29')];}_0x128300[_0x09c4('0x1b')](_0x343af6)['send'](_0x2207e3);};}exports['sendNotification']=function(_0x4a699f,_0x24d342,_0x340394){if(!_0x4a699f[_0x09c4('0x2a')][_0x09c4('0x2b')]('text')&&!_0x4a699f[_0x09c4('0x2a')][_0x09c4('0x2b')](_0x09c4('0x2c'))){throw new db['Sequelize']['ValidationError'](_0x09c4('0x2d'));}else{if(_0x4a699f[_0x09c4('0x2a')][_0x09c4('0x2b')](_0x09c4('0x2c'))&&!_0x4a699f[_0x09c4('0x2a')][_0x09c4('0x2b')](_0x09c4('0x2e'))){throw new db['Sequelize'][(_0x09c4('0x2f'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x4a699f[_0x09c4('0x2a')][_0x09c4('0x2b')]('recipients')){throw new db[(_0x09c4('0x30'))][(_0x09c4('0x2f'))](_0x09c4('0x31'));}else{try{var _0xbb19ad=JSON[_0x09c4('0x32')](_0x4a699f[_0x09c4('0x2a')][_0x09c4('0x33')]);}catch(_0x2300ae){logger['error'](_0x2300ae);throw new db[(_0x09c4('0x30'))][(_0x09c4('0x2f'))](_0x09c4('0x34'));}var _0x222469=[_0x09c4('0x35'),_0x09c4('0x36'),'mailqueue',_0x09c4('0x37'),'smsqueue','voicequeue',_0x09c4('0x38'),_0x09c4('0x39'),_0x09c4('0x3a')];if(_[_0x09c4('0x3b')](_0xbb19ad,function(_0x2490a4){return!_['includes'](_0x222469,_0x2490a4['model'][_0x09c4('0x3c')]());})){throw new db[(_0x09c4('0x30'))]['ValidationError'](_0x09c4('0x3d'));}}}var _0x231ecf={};_0x231ecf[_0x09c4('0x3e')]=_0x4a699f[_0x09c4('0x2a')][_0x09c4('0x2b')](_0x09c4('0x3e'))?_0x4a699f[_0x09c4('0x2a')][_0x09c4('0x3e')]:_0x4a699f[_0x09c4('0x3a')][_0x09c4('0x3f')];_0x231ecf[_0x09c4('0x40')]=_[_0x09c4('0x41')](_0x4a699f['body'][_0x09c4('0x40')])?null:_0x4a699f[_0x09c4('0x2a')][_0x09c4('0x40')];_0x231ecf[_0x09c4('0x42')]=_0x4a699f[_0x09c4('0x2a')][_0x09c4('0x42')]||![];_0x231ecf['SenderId']=_0x4a699f[_0x09c4('0x3a')]['id'];return getContent(_0x4a699f[_0x09c4('0x2a')])[_0x09c4('0x25')](function(_0x3c1a46){_0x231ecf['body']=_0x3c1a46;return getRecipients(_0xbb19ad);})[_0x09c4('0x25')](function(_0xbe7672){_0x231ecf[_0x09c4('0x43')]=_[_0x09c4('0x44')](_0xbe7672)['join'](',');return db[_0x09c4('0x45')][_0x09c4('0x46')](function(_0x40e6f8){return db[_0x09c4('0x47')]['create'](_0x231ecf,{'raw':!![],'transaction':_0x40e6f8})[_0x09c4('0x25')](function(_0x533c4a){var _0x476d1d={'sender':_0x231ecf['senderName'],'description':_0x231ecf[_0x09c4('0x40')],'content':_0x231ecf[_0x09c4('0x2a')],'beep':_0x231ecf['beep']};_0xbe7672[_0x09c4('0x48')](function(_0xeeaba5){_0x476d1d[_0x09c4('0x49')]=_0xeeaba5;socket[_0x09c4('0x4a')](_0x09c4('0x4b'),_0x476d1d);});return _0x533c4a;});});})[_0x09c4('0x25')](respondWithResult(_0x24d342,0xc9))['catch'](handleError(_0x24d342,null));};function getContent(_0x1236a9){return new BPromise(function(_0x39f406,_0x53629a){if(_0x1236a9[_0x09c4('0x4c')]){_0x39f406(_0x1236a9[_0x09c4('0x4c')]);return;}return db[_0x09c4('0x4d')][_0x09c4('0x4e')]({'attributes':[_0x09c4('0x4f')],'where':{'id':_0x1236a9[_0x09c4('0x2c')]},'raw':!![]})[_0x09c4('0x25')](function(_0x471af2){if(!_0x471af2)throw new db['Sequelize'][(_0x09c4('0x2f'))](_0x09c4('0x50'));var _0xdba0b0=Mustache[_0x09c4('0x51')](_0x471af2[_0x09c4('0x4f')],_0x1236a9[_0x09c4('0x2e')]);_0x39f406(_0xdba0b0);})[_0x09c4('0x52')](function(_0x58872d){_0x53629a(_0x58872d);});});}function getRecipients(_0xbf5f5a){return new BPromise(function(_0x59bedf,_0x131bcb){var _0xa42000=[];var _0x43c365=[];_0xbf5f5a[_0x09c4('0x48')](function(_0x2e8c1a){var _0x1e2a44=_[_0x09c4('0x53')](_0x2e8c1a[_0x09c4('0x54')][_0x09c4('0x3c')]());if(_0x1e2a44===_0x09c4('0x55')){_0xa42000=_['union'](_0xa42000,_0x2e8c1a[_0x09c4('0x56')]);}else{if(_['includes'](_0x1e2a44,_0x09c4('0x57')))_0x1e2a44=_0x1e2a44[_0x09c4('0x58')](_0x09c4('0x57'),_0x09c4('0x59'));_0x2e8c1a[_0x09c4('0x56')][_0x09c4('0x48')](function(_0x24be50){_0x43c365['push'](getAgents(_0x1e2a44,_0x24be50));});}});return BPromise[_0x09c4('0x5a')](_0x43c365)['then'](function(_0x1df3c7){_0xa42000=_[_0x09c4('0x5b')](_0xa42000,_[_0x09c4('0x5c')](_0x1df3c7));_0x59bedf(_0xa42000);})[_0x09c4('0x52')](function(_0x11fad7){_0x131bcb(_0x11fad7);});});}function getAgents(_0x27b605,_0x4cb09d){return new BPromise(function(_0x409d45,_0x2aebc4){return db[_0x27b605][_0x09c4('0x4e')]({'where':{'id':_0x4cb09d}})[_0x09c4('0x25')](function(_0xb2d5fa){return _0xb2d5fa[_0x09c4('0x5d')]({'attributes':['id'],'raw':!![]})[_0x09c4('0x25')](function(_0x2b1360){var _0x5c5c02=_[_0x09c4('0x5e')](_0x2b1360,'id');_0x409d45(_0x5c5c02);});})['catch'](function(_0x2669a9){_0x2aebc4(_0x2669a9);});});} \ No newline at end of file +var _0xb284=['name','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','faxqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','transaction','Notification','create','forEach','recipient','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','union','ids','queue','replace','push','all','flatten','getAgents','map','html-pdf','eml-format','rimraf','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./notification.socket','register','end','status','json','count','offset','limit','set','Content-Range','save','update','then','sendStatus','error','stack'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xb284,0xf3));var _0x4b28=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb284[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x4b28('0x0'));var emlformat=require(_0x4b28('0x1'));var rimraf=require(_0x4b28('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4b28('0x3'));var Mustache=require('mustache');var util=require(_0x4b28('0x4'));var path=require(_0x4b28('0x5'));var sox=require(_0x4b28('0x6'));var csv=require(_0x4b28('0x7'));var ejs=require(_0x4b28('0x8'));var fs=require('fs');var _=require(_0x4b28('0x9'));var squel=require(_0x4b28('0xa'));var crypto=require(_0x4b28('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4b28('0xc'));var toCsv=require(_0x4b28('0x7'));var querystring=require(_0x4b28('0xd'));var Papa=require('papaparse');var Redis=require(_0x4b28('0xe'));var authService=require(_0x4b28('0xf'));var qs=require(_0x4b28('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b28('0x11'))(_0x4b28('0x12'));var utils=require('../../config/utils');var config=require(_0x4b28('0x13'));var db=require(_0x4b28('0x14'))['db'];config['redis']=_['defaults'](config[_0x4b28('0x15')],{'host':_0x4b28('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4b28('0x17'))[_0x4b28('0x18')](socket);function respondWithStatusCode(_0x4e20e7,_0x32e923){_0x32e923=_0x32e923||0xcc;return function(_0x892dda){if(_0x892dda){return _0x4e20e7['sendStatus'](_0x32e923);}return _0x4e20e7['status'](_0x32e923)[_0x4b28('0x19')]();};}function respondWithResult(_0x3b1570,_0x56e199){_0x56e199=_0x56e199||0xc8;return function(_0x179ab1){if(_0x179ab1){return _0x3b1570[_0x4b28('0x1a')](_0x56e199)[_0x4b28('0x1b')](_0x179ab1);}};}function respondWithFilteredResult(_0x50b3c1,_0x5a99dd){return function(_0x33b712){if(_0x33b712){var _0x2df76d=_0x33b712[_0x4b28('0x1c')],_0x3250b9=_0x5a99dd['offset'],_0x49394a=_0x5a99dd[_0x4b28('0x1d')]+_0x5a99dd[_0x4b28('0x1e')],_0x333ba4;if(_0x49394a>=_0x2df76d){_0x49394a=_0x2df76d;_0x333ba4=0xc8;}else{_0x333ba4=0xce;}_0x50b3c1[_0x4b28('0x1a')](_0x333ba4);return _0x50b3c1[_0x4b28('0x1f')](_0x4b28('0x20'),_0x3250b9+'-'+_0x49394a+'/'+_0x2df76d)[_0x4b28('0x1b')](_0x33b712);}return null;};}function patchUpdates(_0x485305){return function(_0x57bcf2){try{jsonpatch['apply'](_0x57bcf2,_0x485305,!![]);}catch(_0x203876){return BPromise['reject'](_0x203876);}return _0x57bcf2[_0x4b28('0x21')]();};}function saveUpdates(_0x1d9aaf,_0x4bf14c){return function(_0x394108){if(_0x394108){return _0x394108[_0x4b28('0x22')](_0x1d9aaf)[_0x4b28('0x23')](function(_0x41dee9){return _0x41dee9;});}return null;};}function removeEntity(_0x2d9844,_0x1d9cf7){return function(_0x34b0cc){if(_0x34b0cc){return _0x34b0cc['destroy']()[_0x4b28('0x23')](function(){_0x2d9844[_0x4b28('0x1a')](0xcc)[_0x4b28('0x19')]();});}};}function handleEntityNotFound(_0xefadf7,_0x4a8d81){return function(_0x154d16){if(!_0x154d16){_0xefadf7[_0x4b28('0x24')](0x194);}return _0x154d16;};}function handleError(_0x4c59b0,_0x3a9a35){_0x3a9a35=_0x3a9a35||0x1f4;return function(_0x22ba6b){logger[_0x4b28('0x25')](_0x22ba6b[_0x4b28('0x26')]);if(_0x22ba6b[_0x4b28('0x27')]){delete _0x22ba6b[_0x4b28('0x27')];}_0x4c59b0[_0x4b28('0x1a')](_0x3a9a35)['send'](_0x22ba6b);};}exports[_0x4b28('0x28')]=function(_0x1e146d,_0x19d441,_0x6698c1){if(!_0x1e146d[_0x4b28('0x29')][_0x4b28('0x2a')](_0x4b28('0x2b'))&&!_0x1e146d[_0x4b28('0x29')]['hasOwnProperty'](_0x4b28('0x2c'))){throw new db[(_0x4b28('0x2d'))][(_0x4b28('0x2e'))](_0x4b28('0x2f'));}else{if(_0x1e146d[_0x4b28('0x29')][_0x4b28('0x2a')](_0x4b28('0x2c'))&&!_0x1e146d[_0x4b28('0x29')][_0x4b28('0x2a')](_0x4b28('0x30'))){throw new db[(_0x4b28('0x2d'))]['ValidationError'](_0x4b28('0x31'));}if(!_0x1e146d[_0x4b28('0x29')][_0x4b28('0x2a')](_0x4b28('0x32'))){throw new db[(_0x4b28('0x2d'))][(_0x4b28('0x2e'))](_0x4b28('0x33'));}else{try{var _0x33c1e5=JSON[_0x4b28('0x34')](_0x1e146d[_0x4b28('0x29')][_0x4b28('0x32')]);}catch(_0x1f69f7){logger['error'](_0x1f69f7);throw new db[(_0x4b28('0x2d'))][(_0x4b28('0x2e'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x8239d5=['chatqueue',_0x4b28('0x35'),'mailqueue',_0x4b28('0x36'),'smsqueue',_0x4b28('0x37'),_0x4b28('0x38'),_0x4b28('0x39'),_0x4b28('0x3a')];if(_[_0x4b28('0x3b')](_0x33c1e5,function(_0x5afc25){return!_[_0x4b28('0x3c')](_0x8239d5,_0x5afc25['model'][_0x4b28('0x3d')]());})){throw new db[(_0x4b28('0x2d'))][(_0x4b28('0x2e'))](_0x4b28('0x3e'));}}}var _0x42837b={};_0x42837b[_0x4b28('0x3f')]=_0x1e146d[_0x4b28('0x29')][_0x4b28('0x2a')](_0x4b28('0x3f'))?_0x1e146d[_0x4b28('0x29')]['senderName']:_0x1e146d[_0x4b28('0x3a')][_0x4b28('0x40')];_0x42837b['recipientsDescription']=_[_0x4b28('0x41')](_0x1e146d[_0x4b28('0x29')][_0x4b28('0x42')])?null:_0x1e146d[_0x4b28('0x29')]['recipientsDescription'];_0x42837b['beep']=_0x1e146d['body'][_0x4b28('0x43')]||![];_0x42837b[_0x4b28('0x44')]=_0x1e146d[_0x4b28('0x3a')]['id'];return getContent(_0x1e146d[_0x4b28('0x29')])[_0x4b28('0x23')](function(_0x1c3305){_0x42837b[_0x4b28('0x29')]=_0x1c3305;return getRecipients(_0x33c1e5);})['then'](function(_0x440b5d){_0x42837b[_0x4b28('0x45')]=_[_0x4b28('0x46')](_0x440b5d)['join'](',');return db[_0x4b28('0x47')][_0x4b28('0x48')](function(_0x40cab3){return db[_0x4b28('0x49')][_0x4b28('0x4a')](_0x42837b,{'raw':!![],'transaction':_0x40cab3})[_0x4b28('0x23')](function(_0x584b69){var _0x4aab3c={'sender':_0x42837b[_0x4b28('0x3f')],'description':_0x42837b[_0x4b28('0x42')],'content':_0x42837b[_0x4b28('0x29')],'beep':_0x42837b[_0x4b28('0x43')]};_0x440b5d[_0x4b28('0x4b')](function(_0x4a4bcf){_0x4aab3c[_0x4b28('0x4c')]=_0x4a4bcf;socket['emit']('notification:send',_0x4aab3c);});return _0x584b69;});});})[_0x4b28('0x23')](respondWithResult(_0x19d441,0xc9))[_0x4b28('0x4d')](handleError(_0x19d441,null));};function getContent(_0x158561){return new BPromise(function(_0x41b64c,_0x2b455b){if(_0x158561[_0x4b28('0x2b')]){_0x41b64c(_0x158561[_0x4b28('0x2b')]);return;}return db[_0x4b28('0x4e')][_0x4b28('0x4f')]({'attributes':[_0x4b28('0x50')],'where':{'id':_0x158561[_0x4b28('0x2c')]},'raw':!![]})[_0x4b28('0x23')](function(_0x487007){if(!_0x487007)throw new db[(_0x4b28('0x2d'))][(_0x4b28('0x2e'))](_0x4b28('0x51'));var _0x1d0c36=Mustache[_0x4b28('0x52')](_0x487007[_0x4b28('0x50')],_0x158561['view']);_0x41b64c(_0x1d0c36);})[_0x4b28('0x4d')](function(_0x40c755){_0x2b455b(_0x40c755);});});}function getRecipients(_0x4b0c0e){return new BPromise(function(_0xfd379a,_0x236b56){var _0x253571=[];var _0x21f6fe=[];_0x4b0c0e[_0x4b28('0x4b')](function(_0x5d8c54){var _0x5505e7=_[_0x4b28('0x53')](_0x5d8c54[_0x4b28('0x54')][_0x4b28('0x3d')]());if(_0x5505e7==='User'){_0x253571=_[_0x4b28('0x55')](_0x253571,_0x5d8c54[_0x4b28('0x56')]);}else{if(_[_0x4b28('0x3c')](_0x5505e7,_0x4b28('0x57')))_0x5505e7=_0x5505e7[_0x4b28('0x58')]('queue','Queue');_0x5d8c54[_0x4b28('0x56')]['forEach'](function(_0x23d099){_0x21f6fe[_0x4b28('0x59')](getAgents(_0x5505e7,_0x23d099));});}});return BPromise[_0x4b28('0x5a')](_0x21f6fe)['then'](function(_0xbc5463){_0x253571=_[_0x4b28('0x55')](_0x253571,_[_0x4b28('0x5b')](_0xbc5463));_0xfd379a(_0x253571);})['catch'](function(_0x3acd7b){_0x236b56(_0x3acd7b);});});}function getAgents(_0x4a12b4,_0x2c9679){return new BPromise(function(_0x3131ba,_0x181644){return db[_0x4a12b4]['findOne']({'where':{'id':_0x2c9679}})[_0x4b28('0x23')](function(_0x2c96e4){return _0x2c96e4[_0x4b28('0x5c')]({'attributes':['id'],'raw':!![]})[_0x4b28('0x23')](function(_0x509191){var _0x61284c=_[_0x4b28('0x5d')](_0x509191,'id');_0x3131ba(_0x61284c);});})[_0x4b28('0x4d')](function(_0x1f0645){_0x181644(_0x1f0645);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index ade6b01..504c04f 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0xf39d2a,_0x22144b){var _0x406ae6=function(_0x32a345){while(--_0x32a345){_0xf39d2a['push'](_0xf39d2a['shift']());}};_0x406ae6(++_0x22144b);}(_0x757a,0xde));var _0xa757=function(_0x560ef0,_0xb9bd32){_0x560ef0=_0x560ef0-0x0;var _0x20e7db=_0x757a[_0x560ef0];return _0x20e7db;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','Notification','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x2032,0xd9));var _0x2203=function(_0x45b8c3,_0x510e71){_0x45b8c3=_0x45b8c3-0x0;var _0x46764f=_0x2032[_0x45b8c3];return _0x46764f;};'use strict';var EventEmitter=require('events');var Notification=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){NotificationEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);NotificationEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Notification[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index b0d819a..d1d7fbd 100644 --- a/server/api/notification/notification.model.js +++ b/server/api/notification/notification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdaa7=['../../config/environment','exports','define','Notification','notifications','utf8mb4','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x596284,_0x1cd02b){var _0x5313c6=function(_0x77db49){while(--_0x77db49){_0x596284['push'](_0x596284['shift']());}};_0x5313c6(++_0x1cd02b);}(_0xdaa7,0x7e));var _0x7daa=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0xdaa7[_0x5581ba];return _0x1e927f;};'use strict';var _=require(_0x7daa('0x0'));var util=require(_0x7daa('0x1'));var logger=require(_0x7daa('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7daa('0x3'));var rp=require(_0x7daa('0x4'));var fs=require('fs');var path=require(_0x7daa('0x5'));var rimraf=require('rimraf');var config=require(_0x7daa('0x6'));var attributes=require('./notification.attributes');module[_0x7daa('0x7')]=function(_0x309b78,_0x497a42){return _0x309b78[_0x7daa('0x8')](_0x7daa('0x9'),attributes,{'tableName':_0x7daa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7daa('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd4a2=['Notification','notifications','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./notification.attributes','exports','define'];(function(_0x42946c,_0x577d97){var _0x5d7687=function(_0x4f7428){while(--_0x4f7428){_0x42946c['push'](_0x42946c['shift']());}};_0x5d7687(++_0x577d97);}(_0xd4a2,0x11b));var _0x2d4a=function(_0x5f4070,_0x3441b2){_0x5f4070=_0x5f4070-0x0;var _0xc9b8a0=_0xd4a2[_0x5f4070];return _0xc9b8a0;};'use strict';var _=require('lodash');var util=require(_0x2d4a('0x0'));var logger=require(_0x2d4a('0x1'))(_0x2d4a('0x2'));var moment=require('moment');var BPromise=require(_0x2d4a('0x3'));var rp=require(_0x2d4a('0x4'));var fs=require('fs');var path=require(_0x2d4a('0x5'));var rimraf=require(_0x2d4a('0x6'));var config=require(_0x2d4a('0x7'));var attributes=require(_0x2d4a('0x8'));module[_0x2d4a('0x9')]=function(_0x49ed43,_0x2e42cd){return _0x49ed43[_0x2d4a('0xa')](_0x2d4a('0xb'),attributes,{'tableName':_0x2d4a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2d4a('0xd')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 051764e..96134a4 100644 --- a/server/api/notification/notification.rpc.js +++ b/server/api/notification/notification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf892=['error','code','Notification,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','request','then','info','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x278b4c,_0x39979f){var _0x1bc853=function(_0x532237){while(--_0x532237){_0x278b4c['push'](_0x278b4c['shift']());}};_0x1bc853(++_0x39979f);}(_0xf892,0xed));var _0x2f89=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0xf892[_0x3c81b5];return _0x5888c4;};'use strict';var _=require('lodash');var util=require(_0x2f89('0x0'));var moment=require(_0x2f89('0x1'));var BPromise=require(_0x2f89('0x2'));var rs=require(_0x2f89('0x3'));var fs=require('fs');var Redis=require(_0x2f89('0x4'));var db=require(_0x2f89('0x5'))['db'];var utils=require(_0x2f89('0x6'));var logger=require(_0x2f89('0x7'))('rpc');var config=require(_0x2f89('0x8'));var jayson=require(_0x2f89('0x9'));var client=jayson[_0x2f89('0xa')]['http']({'port':0x232a});config[_0x2f89('0xb')]=_[_0x2f89('0xc')](config[_0x2f89('0xb')],{'host':_0x2f89('0xd'),'port':0x18eb});var socket=require(_0x2f89('0xe'))(new Redis(config[_0x2f89('0xb')]));require(_0x2f89('0xf'))[_0x2f89('0x10')](socket);function respondWithRpcPromise(_0x2bbb8b,_0x243cf9,_0x34d4ee){return new BPromise(function(_0xf630e8,_0x44bdec){return client[_0x2f89('0x11')](_0x2bbb8b,_0x34d4ee)[_0x2f89('0x12')](function(_0x536e71){logger[_0x2f89('0x13')]('Notification,\x20%s,\x20%s',_0x243cf9,_0x2f89('0x14'));logger[_0x2f89('0x15')](_0x2f89('0x16'),_0x243cf9,'request\x20sent',JSON[_0x2f89('0x17')](_0x536e71));if(_0x536e71[_0x2f89('0x18')]){if(_0x536e71[_0x2f89('0x18')][_0x2f89('0x19')]===0x1f4){logger[_0x2f89('0x18')](_0x2f89('0x1a'),_0x243cf9,_0x536e71[_0x2f89('0x18')][_0x2f89('0x1b')]);return _0x44bdec(_0x536e71[_0x2f89('0x18')][_0x2f89('0x1b')]);}logger[_0x2f89('0x18')](_0x2f89('0x1a'),_0x243cf9,_0x536e71[_0x2f89('0x18')][_0x2f89('0x1b')]);return _0xf630e8(_0x536e71[_0x2f89('0x18')][_0x2f89('0x1b')]);}else{logger[_0x2f89('0x13')]('Notification,\x20%s,\x20%s',_0x243cf9,_0x2f89('0x14'));_0xf630e8(_0x536e71[_0x2f89('0x1c')]['message']);}})['catch'](function(_0x434c4a){logger[_0x2f89('0x18')](_0x2f89('0x1a'),_0x243cf9,_0x434c4a);_0x44bdec(_0x434c4a);});});} \ No newline at end of file +var _0x3271=['../../config/utils','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./notification.socket','then','info','Notification,\x20%s,\x20%s','request\x20sent','Notification,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3271,0xf8));var _0x1327=function(_0x35c14f,_0x9be044){_0x35c14f=_0x35c14f-0x0;var _0x274a9b=_0x3271[_0x35c14f];return _0x274a9b;};'use strict';var _=require(_0x1327('0x0'));var util=require('util');var moment=require(_0x1327('0x1'));var BPromise=require(_0x1327('0x2'));var rs=require(_0x1327('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1327('0x4'))['db'];var utils=require(_0x1327('0x5'));var logger=require('../../config/logger')(_0x1327('0x6'));var config=require(_0x1327('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1327('0x8')]['http']({'port':0x232a});config['redis']=_[_0x1327('0x9')](config[_0x1327('0xa')],{'host':_0x1327('0xb'),'port':0x18eb});var socket=require(_0x1327('0xc'))(new Redis(config[_0x1327('0xa')]));require(_0x1327('0xd'))['register'](socket);function respondWithRpcPromise(_0x5e4450,_0x44c420,_0x1cecd6){return new BPromise(function(_0x236d58,_0x682c6f){return client['request'](_0x5e4450,_0x1cecd6)[_0x1327('0xe')](function(_0x8b55bf){logger[_0x1327('0xf')](_0x1327('0x10'),_0x44c420,_0x1327('0x11'));logger['debug'](_0x1327('0x12'),_0x44c420,_0x1327('0x11'),JSON['stringify'](_0x8b55bf));if(_0x8b55bf[_0x1327('0x13')]){if(_0x8b55bf[_0x1327('0x13')]['code']===0x1f4){logger['error'](_0x1327('0x10'),_0x44c420,_0x8b55bf['error']['message']);return _0x682c6f(_0x8b55bf['error'][_0x1327('0x14')]);}logger[_0x1327('0x13')]('Notification,\x20%s,\x20%s',_0x44c420,_0x8b55bf[_0x1327('0x13')][_0x1327('0x14')]);return _0x236d58(_0x8b55bf[_0x1327('0x13')]['message']);}else{logger[_0x1327('0xf')]('Notification,\x20%s,\x20%s',_0x44c420,_0x1327('0x11'));_0x236d58(_0x8b55bf[_0x1327('0x15')][_0x1327('0x14')]);}})[_0x1327('0x16')](function(_0x997279){logger[_0x1327('0x13')](_0x1327('0x10'),_0x44c420,_0x997279);_0x682c6f(_0x997279);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 0d8694d..24a9620 100644 --- a/server/api/notification/notification.socket.js +++ b/server/api/notification/notification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda91=['remove','update','removeListener','length','notification:','./notification.events'];(function(_0x12897f,_0xfc9fe8){var _0x9df0e7=function(_0x235674){while(--_0x235674){_0x12897f['push'](_0x12897f['shift']());}};_0x9df0e7(++_0xfc9fe8);}(_0xda91,0x1b5));var _0x1da9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xda91[_0x19e35c];return _0x3e1fe8;};'use strict';var NotificationEvents=require(_0x1da9('0x0'));var events=['save',_0x1da9('0x1'),_0x1da9('0x2')];function createListener(_0x54ee7c,_0x382317){return function(_0xbb6c54){_0x382317['emit'](_0x54ee7c,_0xbb6c54);};}function removeListener(_0x2d540d,_0x54f887){return function(){NotificationEvents[_0x1da9('0x3')](_0x2d540d,_0x54f887);};}exports['register']=function(_0x470a0b){for(var _0x3e82c7=0x0,_0x5783df=events[_0x1da9('0x4')];_0x3e82c7<_0x5783df;_0x3e82c7++){var _0x3c62fa=events[_0x3e82c7];var _0x249f13=createListener(_0x1da9('0x5')+_0x3c62fa,_0x470a0b);NotificationEvents['on'](_0x3c62fa,_0x249f13);}}; \ No newline at end of file +var _0x56e6=['notification:','./notification.events','update','removeListener','length'];(function(_0x2f9528,_0x468543){var _0x26b016=function(_0x30f72a){while(--_0x30f72a){_0x2f9528['push'](_0x2f9528['shift']());}};_0x26b016(++_0x468543);}(_0x56e6,0xa6));var _0x656e=function(_0x56739b,_0x2d2cc9){_0x56739b=_0x56739b-0x0;var _0x1c752f=_0x56e6[_0x56739b];return _0x1c752f;};'use strict';var NotificationEvents=require(_0x656e('0x0'));var events=['save','remove',_0x656e('0x1')];function createListener(_0x137fcc,_0x2dd7d8){return function(_0x5daa09){_0x2dd7d8['emit'](_0x137fcc,_0x5daa09);};}function removeListener(_0x4c112f,_0x569f37){return function(){NotificationEvents[_0x656e('0x2')](_0x4c112f,_0x569f37);};}exports['register']=function(_0xc9d730){for(var _0xe2d38e=0x0,_0x2e82b2=events[_0x656e('0x3')];_0xe2d38e<_0x2e82b2;_0xe2d38e++){var _0x44fae9=events[_0xe2d38e];var _0x23db34=createListener(_0x656e('0x4')+_0x44fae9,_0xc9d730);NotificationEvents['on'](_0x44fae9,_0x23db34);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 92a0714..ea6e604 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 _0xadf3=['get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents','create','post','/:id/dispositions','addAnswer','/:id/notify','notify','addApplications','addAgents','send','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xadf3,0x12f));var _0x3adf=function(_0x2cc1df,_0x1b6a0e){_0x2cc1df=_0x2cc1df-0x0;var _0x1437f3=_0xadf3[_0x2cc1df];return _0x1437f3;};'use strict';var multer=require(_0x3adf('0x0'));var util=require(_0x3adf('0x1'));var path=require(_0x3adf('0x2'));var timeout=require(_0x3adf('0x3'));var express=require(_0x3adf('0x4'));var router=express['Router']();var auth=require(_0x3adf('0x5'));var interaction=require(_0x3adf('0x6'));var config=require(_0x3adf('0x7'));var controller=require(_0x3adf('0x8'));router[_0x3adf('0x9')]('/',auth[_0x3adf('0xa')](),controller[_0x3adf('0xb')]);router[_0x3adf('0x9')](_0x3adf('0xc'),auth[_0x3adf('0xa')](),controller[_0x3adf('0xd')]);router['get'](_0x3adf('0xe'),auth[_0x3adf('0xa')](),controller[_0x3adf('0xf')]);router[_0x3adf('0x9')]('/:id/dispositions',auth[_0x3adf('0xa')](),controller[_0x3adf('0x10')]);router['get'](_0x3adf('0x11'),auth[_0x3adf('0xa')](),controller['getAnswers']);router[_0x3adf('0x9')](_0x3adf('0x12'),auth[_0x3adf('0xa')](),controller[_0x3adf('0x13')]);router['get'](_0x3adf('0x14'),auth[_0x3adf('0xa')](),controller['getInteractions']);router[_0x3adf('0x9')](_0x3adf('0x15'),auth[_0x3adf('0xa')](),controller[_0x3adf('0x16')]);router['post']('/',auth[_0x3adf('0xa')](),controller[_0x3adf('0x17')]);router[_0x3adf('0x18')](_0x3adf('0x19'),auth[_0x3adf('0xa')](),controller['addDisposition']);router[_0x3adf('0x18')](_0x3adf('0x11'),auth[_0x3adf('0xa')](),controller[_0x3adf('0x1a')]);router[_0x3adf('0x18')](_0x3adf('0x1b'),controller[_0x3adf('0x1c')]);router[_0x3adf('0x18')]('/:id/applications',auth[_0x3adf('0xa')](),controller[_0x3adf('0x1d')]);router['post'](_0x3adf('0x15'),auth[_0x3adf('0xa')](),controller[_0x3adf('0x1e')]);router['post']('/:id/send',auth[_0x3adf('0xa')](),controller[_0x3adf('0x1f')]);router[_0x3adf('0x20')](_0x3adf('0xe'),auth['isAuthenticated'](),controller[_0x3adf('0x21')]);router[_0x3adf('0x22')]('/:id',auth[_0x3adf('0xa')](),controller[_0x3adf('0x23')]);router[_0x3adf('0x22')](_0x3adf('0x19'),auth[_0x3adf('0xa')](),controller[_0x3adf('0x24')]);router[_0x3adf('0x22')](_0x3adf('0x11'),auth[_0x3adf('0xa')](),controller['removeAnswers']);router[_0x3adf('0x22')](_0x3adf('0x15'),auth[_0x3adf('0xa')](),controller[_0x3adf('0x25')]);module[_0x3adf('0x26')]=router; \ No newline at end of file +var _0x8cd7=['addAgents','/:id/send','send','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/notify','notify'];(function(_0x12e52e,_0x2cdf87){var _0x4e8cec=function(_0x3b5735){while(--_0x3b5735){_0x12e52e['push'](_0x12e52e['shift']());}};_0x4e8cec(++_0x2cdf87);}(_0x8cd7,0x10b));var _0x78cd=function(_0x4706dd,_0x3f32d5){_0x4706dd=_0x4706dd-0x0;var _0xb4a395=_0x8cd7[_0x4706dd];return _0xb4a395;};'use strict';var multer=require(_0x78cd('0x0'));var util=require(_0x78cd('0x1'));var path=require(_0x78cd('0x2'));var timeout=require(_0x78cd('0x3'));var express=require(_0x78cd('0x4'));var router=express[_0x78cd('0x5')]();var auth=require(_0x78cd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x78cd('0x7'));var controller=require(_0x78cd('0x8'));router[_0x78cd('0x9')]('/',auth[_0x78cd('0xa')](),controller[_0x78cd('0xb')]);router[_0x78cd('0x9')](_0x78cd('0xc'),auth[_0x78cd('0xa')](),controller[_0x78cd('0xd')]);router['get'](_0x78cd('0xe'),auth[_0x78cd('0xa')](),controller[_0x78cd('0xf')]);router[_0x78cd('0x9')](_0x78cd('0x10'),auth[_0x78cd('0xa')](),controller[_0x78cd('0x11')]);router[_0x78cd('0x9')](_0x78cd('0x12'),auth[_0x78cd('0xa')](),controller['getAnswers']);router[_0x78cd('0x9')](_0x78cd('0x13'),auth[_0x78cd('0xa')](),controller[_0x78cd('0x14')]);router[_0x78cd('0x9')](_0x78cd('0x15'),auth[_0x78cd('0xa')](),controller[_0x78cd('0x16')]);router[_0x78cd('0x9')](_0x78cd('0x17'),auth[_0x78cd('0xa')](),controller[_0x78cd('0x18')]);router[_0x78cd('0x19')]('/',auth['isAuthenticated'](),controller[_0x78cd('0x1a')]);router[_0x78cd('0x19')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x78cd('0x19')]('/:id/canned_answers',auth[_0x78cd('0xa')](),controller['addAnswer']);router[_0x78cd('0x19')](_0x78cd('0x1b'),controller[_0x78cd('0x1c')]);router[_0x78cd('0x19')](_0x78cd('0x13'),auth[_0x78cd('0xa')](),controller['addApplications']);router[_0x78cd('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x78cd('0x1d')]);router[_0x78cd('0x19')](_0x78cd('0x1e'),auth[_0x78cd('0xa')](),controller[_0x78cd('0x1f')]);router['put'](_0x78cd('0xe'),auth[_0x78cd('0xa')](),controller['update']);router[_0x78cd('0x20')]('/:id',auth[_0x78cd('0xa')](),controller['destroy']);router[_0x78cd('0x20')](_0x78cd('0x10'),auth[_0x78cd('0xa')](),controller[_0x78cd('0x21')]);router[_0x78cd('0x20')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x78cd('0x22')]);router['delete'](_0x78cd('0x17'),auth[_0x78cd('0xa')](),controller[_0x78cd('0x23')]);module[_0x78cd('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 982dfe2..d3b113b 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 _0xc186=['STRING','name','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','exports'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xc186,0x8d));var _0x6c18=function(_0x7a1243,_0x28128e){_0x7a1243=_0x7a1243-0x0;var _0x409fa7=_0xc186[_0x7a1243];return _0x409fa7;};'use strict';var Sequelize=require(_0x6c18('0x0'));var rs=require('randomstring');module[_0x6c18('0x1')]={'name':{'type':Sequelize[_0x6c18('0x2')],'unique':_0x6c18('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6c18('0x2')]},'token':{'type':Sequelize[_0x6c18('0x2')],'defaultValue':function(){return rs[_0x6c18('0x4')]();}},'replyUri':{'type':Sequelize[_0x6c18('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6c18('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6c18('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x6c18('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6c18('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6c18('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6c18('0x2')]},'queueTransfer':{'type':Sequelize[_0x6c18('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6c18('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6c18('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6c18('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6c18('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x6c18('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x6c18('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3fcce0){if(!_0x3fcce0)this[_0x6c18('0x9')]('mandatoryDispositionPauseId',null);this[_0x6c18('0x9')](_0x6c18('0xa'),_0x3fcce0);}}}; \ No newline at end of file +var _0x7a8b=['name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','STRING'];(function(_0xfe5c19,_0x5a41e9){var _0x4082ca=function(_0x1254f2){while(--_0x1254f2){_0xfe5c19['push'](_0xfe5c19['shift']());}};_0x4082ca(++_0x5a41e9);}(_0x7a8b,0xcd));var _0xb7a8=function(_0x4a091c,_0x3448d3){_0x4a091c=_0x4a091c-0x0;var _0x148416=_0x7a8b[_0x4a091c];return _0x148416;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb7a8('0x0'));module[_0xb7a8('0x1')]={'name':{'type':Sequelize[_0xb7a8('0x2')],'unique':_0xb7a8('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xb7a8('0x2')],'defaultValue':function(){return rs[_0xb7a8('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb7a8('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb7a8('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb7a8('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb7a8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb7a8('0x2')]},'queueTransfer':{'type':Sequelize[_0xb7a8('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb7a8('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb7a8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb7a8('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xb7a8('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb7a8('0x9'),'set':function(_0x46b0ef){if(!_0x46b0ef)this['setDataValue'](_0xb7a8('0xa'),null);this[_0xb7a8('0xb')](_0xb7a8('0xc'),_0x46b0ef);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 0ae18e3..f356a2c 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 _0x7077=['Contacts','Applications','account','applications','list','asc','List','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','messageId','interaction','created','autoclose','push','unmanaged','OpenchannelMessage','AttachmentId','unshift','agent','*,*,*,*','startRouting','Start','EventManager','addApplications','sequelize','OpenchannelApplication','bulkCreate','findAndCountAll','priority','getApplications','Contact','User','Owner','fullname','Tag','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','keys','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','OpenchannelAccountId','removeDispositions','addAnswer','getAnswers','CannedAnswer','pick','removeAnswers','ids','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList'];(function(_0x3f0961,_0x34d1ce){var _0x5aabb5=function(_0x219e41){while(--_0x219e41){_0x3f0961['push'](_0x3f0961['shift']());}};_0x5aabb5(++_0x34d1ce);}(_0x7077,0x1a6));var _0x7707=function(_0x14478a,_0x2119d7){_0x14478a=_0x14478a-0x0;var _0x546759=_0x7077[_0x14478a];return _0x546759;};'use strict';var pdf=require(_0x7707('0x0'));var emlformat=require(_0x7707('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7707('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7707('0x3'));var moment=require(_0x7707('0x4'));var BPromise=require(_0x7707('0x5'));var Mustache=require('mustache');var util=require(_0x7707('0x6'));var path=require(_0x7707('0x7'));var sox=require(_0x7707('0x8'));var csv=require(_0x7707('0x9'));var ejs=require(_0x7707('0xa'));var fs=require('fs');var _=require(_0x7707('0xb'));var squel=require(_0x7707('0xc'));var crypto=require(_0x7707('0xd'));var jsforce=require(_0x7707('0xe'));var deskjs=require(_0x7707('0xf'));var toCsv=require(_0x7707('0x9'));var querystring=require(_0x7707('0x10'));var Papa=require('papaparse');var Redis=require(_0x7707('0x11'));var authService=require(_0x7707('0x12'));var qs=require(_0x7707('0x13'));var as=require(_0x7707('0x14'));var hardwareService=require(_0x7707('0x15'));var logger=require(_0x7707('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x7707('0x17'));var db=require(_0x7707('0x18'))['db'];config[_0x7707('0x19')]=_['defaults'](config[_0x7707('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x7707('0x1a'))(new Redis(config[_0x7707('0x19')]));require('./openchannelAccount.socket')[_0x7707('0x1b')](socket);var jayson=require(_0x7707('0x1c'));var client=jayson[_0x7707('0x1d')][_0x7707('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x7707('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x5a5247,_0x2d999a,_0x87c9b3){if(_0x87c9b3){var _0x383924=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x383924[_0x7707('0x1f')](_0x2d999a)){return _0x5a5247;}else{throw new db[(_0x7707('0x20'))][(_0x7707('0x21'))](_0x7707('0x22'));}}else{return _0x5a5247;}}function respondWithRpcPromise(_0x113120,_0x50f2d9,_0x5a43c0,_0x444cd5){return new BPromise(function(_0x4993c4,_0x400263){var _0x5b3e8d=_0x444cd5||client;return _0x5b3e8d[_0x7707('0x23')](_0x113120,_0x5a43c0)['then'](function(_0x45f2a7){logger[_0x7707('0x24')](_0x7707('0x25'),_0x50f2d9,_0x7707('0x26'));logger[_0x7707('0x27')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x50f2d9,_0x7707('0x26'),JSON[_0x7707('0x28')](_0x45f2a7));if(_0x45f2a7['error']){if(_0x45f2a7[_0x7707('0x29')][_0x7707('0x2a')]===0x1f4){logger['error'](_0x7707('0x25'),_0x50f2d9,_0x45f2a7['error'][_0x7707('0x2b')]);return _0x400263(_0x45f2a7['error']['message']);}logger[_0x7707('0x29')](_0x7707('0x25'),_0x50f2d9,_0x45f2a7[_0x7707('0x29')][_0x7707('0x2b')]);return _0x4993c4(_0x45f2a7['error'][_0x7707('0x2b')]);}else{logger[_0x7707('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x50f2d9,_0x7707('0x26'));_0x4993c4(_0x45f2a7[_0x7707('0x2c')][_0x7707('0x2b')]);}})[_0x7707('0x2d')](function(_0x1010fc){logger['error'](_0x7707('0x25'),_0x50f2d9,_0x1010fc);_0x400263(_0x1010fc);});});}function respondWithStatusCode(_0x5a48b4,_0x380b66){_0x380b66=_0x380b66||0xcc;return function(_0x474c9a){if(_0x474c9a){return _0x5a48b4[_0x7707('0x2e')](_0x380b66);}return _0x5a48b4[_0x7707('0x2f')](_0x380b66)[_0x7707('0x30')]();};}function respondWithResult(_0x221077,_0x182ae3){_0x182ae3=_0x182ae3||0xc8;return function(_0x49654f){if(_0x49654f){return _0x221077['status'](_0x182ae3)[_0x7707('0x31')](_0x49654f);}};}function respondWithFilteredResult(_0x7e1aae,_0x3fd3f4){return function(_0x5250c8){if(_0x5250c8){var _0x8b477d=_0x5250c8[_0x7707('0x32')],_0x1d61bf=_0x3fd3f4[_0x7707('0x33')],_0x59db0d=_0x3fd3f4[_0x7707('0x33')]+_0x3fd3f4[_0x7707('0x34')],_0x3d0aac;if(_0x59db0d>=_0x8b477d){_0x59db0d=_0x8b477d;_0x3d0aac=0xc8;}else{_0x3d0aac=0xce;}_0x7e1aae[_0x7707('0x2f')](_0x3d0aac);return _0x7e1aae[_0x7707('0x35')]('Content-Range',_0x1d61bf+'-'+_0x59db0d+'/'+_0x8b477d)[_0x7707('0x31')](_0x5250c8);}return null;};}function patchUpdates(_0x2e4424){return function(_0x5b243d){try{jsonpatch[_0x7707('0x36')](_0x5b243d,_0x2e4424,!![]);}catch(_0x5a3a4c){return BPromise[_0x7707('0x37')](_0x5a3a4c);}return _0x5b243d[_0x7707('0x38')]();};}function saveUpdates(_0x4ca68a,_0x39287a){return function(_0x30b261){if(_0x30b261){return _0x30b261[_0x7707('0x39')](_0x4ca68a)[_0x7707('0x3a')](function(_0x7944b3){return _0x7944b3;});}return null;};}function removeEntity(_0x637699,_0x55ef67){return function(_0xdb1e4f){if(_0xdb1e4f){return _0xdb1e4f[_0x7707('0x3b')]()['then'](function(){var _0x54b75a=_0xdb1e4f[_0x7707('0x3c')]({'plain':!![]});var _0x5348aa='OpenchannelAccounts';return db[_0x7707('0x3d')][_0x7707('0x3b')]({'where':{'type':_0x5348aa,'resourceId':_0x54b75a['id']}})[_0x7707('0x3a')](function(){return _0xdb1e4f;});})[_0x7707('0x3a')](function(){_0x637699[_0x7707('0x2f')](0xcc)[_0x7707('0x30')]();});}};}function handleEntityNotFound(_0x3c80bc,_0x4b3af6){return function(_0x109bd0){if(!_0x109bd0){_0x3c80bc[_0x7707('0x2e')](0x194);}return _0x109bd0;};}function handleError(_0x324323,_0x568ae5){_0x568ae5=_0x568ae5||0x1f4;return function(_0x3dfaea){logger[_0x7707('0x29')](_0x3dfaea[_0x7707('0x3e')]);if(_0x3dfaea[_0x7707('0x3f')]){delete _0x3dfaea[_0x7707('0x3f')];}_0x324323[_0x7707('0x2f')](_0x568ae5)[_0x7707('0x40')](_0x3dfaea);};}exports['index']=function(_0x469488,_0x23f73c){var _0x48b784={'include':[{'model':db[_0x7707('0x41')],'as':_0x7707('0x42')}]},_0x56bd4e={},_0x4da22a={'count':0x0,'rows':[]};var _0x5d1b53=_[_0x7707('0x43')](db[_0x7707('0x44')][_0x7707('0x45')],function(_0x154107){return{'name':_0x154107[_0x7707('0x46')],'type':_0x154107[_0x7707('0x47')][_0x7707('0x48')]};});_0x56bd4e[_0x7707('0x49')]=_[_0x7707('0x43')](_0x5d1b53,_0x7707('0x3f'));_0x56bd4e[_0x7707('0x4a')]=_['keys'](_0x469488[_0x7707('0x4a')]);_0x56bd4e['filters']=_[_0x7707('0x4b')](_0x56bd4e[_0x7707('0x49')],_0x56bd4e[_0x7707('0x4a')]);_0x48b784[_0x7707('0x4c')]=_[_0x7707('0x4b')](_0x56bd4e[_0x7707('0x49')],qs[_0x7707('0x4d')](_0x469488['query'][_0x7707('0x4d')]));_0x48b784['attributes']=_0x48b784[_0x7707('0x4c')][_0x7707('0x4e')]?_0x48b784[_0x7707('0x4c')]:_0x56bd4e['model'];if(!_0x469488[_0x7707('0x4a')][_0x7707('0x4f')]('nolimit')){_0x48b784['limit']=qs['limit'](_0x469488[_0x7707('0x4a')][_0x7707('0x34')]);_0x48b784[_0x7707('0x33')]=qs[_0x7707('0x33')](_0x469488[_0x7707('0x4a')][_0x7707('0x33')]);}_0x48b784[_0x7707('0x50')]=qs[_0x7707('0x51')](_0x469488[_0x7707('0x4a')][_0x7707('0x51')]);_0x48b784[_0x7707('0x52')]=qs['filters'](_['pick'](_0x469488[_0x7707('0x4a')],_0x56bd4e[_0x7707('0x53')]),_0x5d1b53);if(_0x469488['query'][_0x7707('0x54')]){_0x48b784['where']=_['merge'](_0x48b784[_0x7707('0x52')],{'$or':_[_0x7707('0x43')](_0x5d1b53,function(_0x548d80){if(_0x548d80[_0x7707('0x47')]!==_0x7707('0x55')){var _0x38d1db={};_0x38d1db[_0x548d80['name']]={'$like':'%'+_0x469488['query']['filter']+'%'};return _0x38d1db;}})});}_0x48b784=_[_0x7707('0x56')]({},_0x48b784,_0x469488['options']);var _0x2f35c8={'where':_0x48b784['where']};return db['OpenchannelAccount'][_0x7707('0x32')](_0x2f35c8)['then'](function(_0x131cd4){_0x4da22a[_0x7707('0x32')]=_0x131cd4;if(_0x469488[_0x7707('0x4a')][_0x7707('0x57')]){_0x48b784['include']=[{'all':!![]}];}return db[_0x7707('0x44')][_0x7707('0x58')](_0x48b784);})[_0x7707('0x3a')](function(_0x775961){_0x4da22a[_0x7707('0x59')]=_0x775961;return _0x4da22a;})[_0x7707('0x3a')](respondWithFilteredResult(_0x23f73c,_0x48b784))[_0x7707('0x2d')](handleError(_0x23f73c,null));};exports[_0x7707('0x5a')]=function(_0x5d3524,_0x5abfb4){var _0x1a327e={'raw':![],'where':{'id':_0x5d3524[_0x7707('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x14164b={};_0x14164b[_0x7707('0x49')]=_[_0x7707('0x5c')](db[_0x7707('0x44')][_0x7707('0x45')]);_0x14164b[_0x7707('0x4a')]=_[_0x7707('0x5c')](_0x5d3524[_0x7707('0x4a')]);_0x14164b[_0x7707('0x53')]=_['intersection'](_0x14164b[_0x7707('0x49')],_0x14164b[_0x7707('0x4a')]);_0x1a327e[_0x7707('0x4c')]=_[_0x7707('0x4b')](_0x14164b[_0x7707('0x49')],qs[_0x7707('0x4d')](_0x5d3524[_0x7707('0x4a')][_0x7707('0x4d')]));_0x1a327e[_0x7707('0x4c')]=_0x1a327e[_0x7707('0x4c')]['length']?_0x1a327e['attributes']:_0x14164b[_0x7707('0x49')];if(_0x5d3524[_0x7707('0x4a')][_0x7707('0x57')]){_0x1a327e[_0x7707('0x5d')]=[{'all':!![]}];}_0x1a327e=_[_0x7707('0x56')]({},_0x1a327e,_0x5d3524[_0x7707('0x5e')]);return db['OpenchannelAccount'][_0x7707('0x5f')](_0x1a327e)['then'](handleEntityNotFound(_0x5abfb4,null))[_0x7707('0x3a')](respondWithResult(_0x5abfb4,null))[_0x7707('0x2d')](handleError(_0x5abfb4,null));};exports['create']=function(_0x1c0d3b,_0x586e44){return db[_0x7707('0x44')][_0x7707('0x60')](_0x1c0d3b[_0x7707('0x61')],{})[_0x7707('0x3a')](function(_0x40bd3e){var _0x42270e=_0x1c0d3b[_0x7707('0x62')]['get']({'plain':!![]});if(!_0x42270e)throw new Error(_0x7707('0x63'));if(_0x42270e[_0x7707('0x64')]===_0x7707('0x62')){var _0x36daa5=_0x40bd3e[_0x7707('0x3c')]({'plain':!![]});var _0xa19840=_0x7707('0x65');return db[_0x7707('0x66')]['find']({'where':{'name':_0xa19840,'userProfileId':_0x42270e['userProfileId']},'raw':!![]})['then'](function(_0x26c5a9){if(_0x26c5a9&&_0x26c5a9[_0x7707('0x67')]===0x0){return db[_0x7707('0x3d')][_0x7707('0x60')]({'name':_0x36daa5[_0x7707('0x3f')],'resourceId':_0x36daa5['id'],'type':_0x26c5a9[_0x7707('0x3f')],'sectionId':_0x26c5a9['id']},{})[_0x7707('0x3a')](function(){return _0x40bd3e;});}else{return _0x40bd3e;}})['catch'](function(_0x274920){logger['error'](_0x7707('0x68'),_0x274920);throw _0x274920;});}return _0x40bd3e;})[_0x7707('0x3a')](respondWithResult(_0x586e44,0xc9))[_0x7707('0x2d')](handleError(_0x586e44,null));};exports[_0x7707('0x39')]=function(_0x46689b,_0x21438c){if(_0x46689b[_0x7707('0x61')]['id']){delete _0x46689b[_0x7707('0x61')]['id'];}return db[_0x7707('0x44')]['find']({'where':{'id':_0x46689b[_0x7707('0x5b')]['id']},'include':[{'model':db[_0x7707('0x41')],'as':_0x7707('0x42')}]})[_0x7707('0x3a')](handleEntityNotFound(_0x21438c,null))[_0x7707('0x3a')](saveUpdates(_0x46689b[_0x7707('0x61')],null))[_0x7707('0x3a')](respondWithResult(_0x21438c,null))[_0x7707('0x2d')](handleError(_0x21438c,null));};exports[_0x7707('0x3b')]=function(_0x5eed58,_0x4cbd83){return db['OpenchannelAccount']['find']({'where':{'id':_0x5eed58[_0x7707('0x5b')]['id']}})[_0x7707('0x3a')](handleEntityNotFound(_0x4cbd83,null))[_0x7707('0x3a')](removeEntity(_0x4cbd83,null))[_0x7707('0x2d')](handleError(_0x4cbd83,null));};exports[_0x7707('0x69')]=function(_0x5cb4e7,_0x4b3276){return db['OpenchannelAccount'][_0x7707('0x69')]()['then'](respondWithResult(_0x4b3276,null))[_0x7707('0x2d')](handleError(_0x4b3276,null));};exports[_0x7707('0x6a')]=function(_0x49525f,_0x530940,_0x4e3237){if(_0x49525f[_0x7707('0x61')]['id']){delete _0x49525f[_0x7707('0x61')]['id'];}return db['OpenchannelAccount'][_0x7707('0x5f')]({'where':{'id':_0x49525f[_0x7707('0x5b')]['id']}})['then'](handleEntityNotFound(_0x530940,null))[_0x7707('0x3a')](function(_0x46f41f){if(_0x46f41f){_0x49525f[_0x7707('0x61')]['OpnechannelAccountId']=_0x46f41f['id'];return db[_0x7707('0x6b')][_0x7707('0x60')](_0x49525f[_0x7707('0x61')]);}})['then'](respondWithResult(_0x530940,null))[_0x7707('0x2d')](handleError(_0x530940,null));};exports[_0x7707('0x6c')]=function(_0x264853,_0x2c0def,_0x15b178){var _0x4eb8b1={'raw':![],'where':{}};var _0x27800f={};var _0x5e1835={'count':0x0,'rows':[]};return db[_0x7707('0x44')][_0x7707('0x6d')]({'where':{'id':_0x264853[_0x7707('0x5b')]['id']}})[_0x7707('0x3a')](handleEntityNotFound(_0x2c0def,null))[_0x7707('0x3a')](function(_0x3554f6){if(_0x3554f6){_0x27800f[_0x7707('0x49')]=_[_0x7707('0x5c')](db['Disposition'][_0x7707('0x45')]);_0x27800f[_0x7707('0x4a')]=_[_0x7707('0x5c')](_0x264853[_0x7707('0x4a')]);_0x27800f[_0x7707('0x53')]=_['intersection'](_0x27800f['model'],_0x27800f['query']);_0x4eb8b1[_0x7707('0x4c')]=_[_0x7707('0x4b')](_0x27800f['model'],qs['fields'](_0x264853['query'][_0x7707('0x4d')]));_0x4eb8b1[_0x7707('0x4c')]=_0x4eb8b1[_0x7707('0x4c')][_0x7707('0x4e')]?_0x4eb8b1[_0x7707('0x4c')]:_0x27800f[_0x7707('0x49')];if(!_0x264853['query']['hasOwnProperty'](_0x7707('0x6e'))){_0x4eb8b1[_0x7707('0x34')]=qs[_0x7707('0x34')](_0x264853['query']['limit']);_0x4eb8b1[_0x7707('0x33')]=qs[_0x7707('0x33')](_0x264853[_0x7707('0x4a')][_0x7707('0x33')]);}_0x4eb8b1[_0x7707('0x50')]=qs['sort'](_0x264853['query'][_0x7707('0x51')]);_0x4eb8b1[_0x7707('0x52')]=qs[_0x7707('0x53')](_['pick'](_0x264853[_0x7707('0x4a')],_0x27800f[_0x7707('0x53')]));_0x4eb8b1['where'][_0x7707('0x6f')]=_0x3554f6['id'];if(_0x264853[_0x7707('0x4a')]['filter']){_0x4eb8b1[_0x7707('0x52')]=_['merge'](_0x4eb8b1[_0x7707('0x52')],{'$or':_['map'](_0x4eb8b1[_0x7707('0x4c')],function(_0x281b19){var _0x57d299={};_0x57d299[_0x281b19]={'$like':'%'+_0x264853[_0x7707('0x4a')][_0x7707('0x54')]+'%'};return _0x57d299;})});}_0x4eb8b1=_[_0x7707('0x56')]({},_0x4eb8b1,_0x264853['options']);return db[_0x7707('0x6b')][_0x7707('0x32')]({'where':_0x4eb8b1[_0x7707('0x52')]})[_0x7707('0x3a')](function(_0x3c822a){_0x5e1835[_0x7707('0x32')]=_0x3c822a;if(_0x264853[_0x7707('0x4a')][_0x7707('0x57')]){_0x4eb8b1[_0x7707('0x5d')]=[{'all':!![]}];}return db[_0x7707('0x6b')][_0x7707('0x58')](_0x4eb8b1);})[_0x7707('0x3a')](function(_0x5be386){_0x5e1835['rows']=_0x5be386;return _0x5e1835;});}})[_0x7707('0x3a')](respondWithFilteredResult(_0x2c0def,_0x4eb8b1))[_0x7707('0x2d')](handleError(_0x2c0def,null));};exports[_0x7707('0x70')]=function(_0x2d1e49,_0x5d8b3a,_0x82a3df){return db[_0x7707('0x44')][_0x7707('0x5f')]({'where':{'id':_0x2d1e49['params']['id']}})[_0x7707('0x3a')](handleEntityNotFound(_0x5d8b3a,null))[_0x7707('0x3a')](function(_0x430a62){if(_0x430a62){return _0x430a62[_0x7707('0x70')](_0x2d1e49[_0x7707('0x4a')]['ids']);}})[_0x7707('0x3a')](respondWithStatusCode(_0x5d8b3a,null))[_0x7707('0x2d')](handleError(_0x5d8b3a,null));};exports[_0x7707('0x71')]=function(_0x525278,_0x2df38f,_0x41ffce){if(_0x525278['body']['id']){delete _0x525278[_0x7707('0x61')]['id'];}return db[_0x7707('0x44')]['find']({'where':{'id':_0x525278[_0x7707('0x5b')]['id']}})[_0x7707('0x3a')](handleEntityNotFound(_0x2df38f,null))[_0x7707('0x3a')](function(_0x36f67a){if(_0x36f67a){_0x525278['body'][_0x7707('0x6f')]=_0x36f67a['id'];return db['CannedAnswer'][_0x7707('0x60')](_0x525278['body']);}})[_0x7707('0x3a')](respondWithResult(_0x2df38f,null))[_0x7707('0x2d')](handleError(_0x2df38f,null));};exports[_0x7707('0x72')]=function(_0x29a70f,_0x400df4,_0x244395){var _0x2a83a0={'raw':![],'where':{}};var _0x23c2f7={};var _0x2c547c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x7707('0x6d')]({'where':{'id':_0x29a70f['params']['id']}})['then'](handleEntityNotFound(_0x400df4,null))[_0x7707('0x3a')](function(_0x49c99f){if(_0x49c99f){_0x23c2f7[_0x7707('0x49')]=_[_0x7707('0x5c')](db[_0x7707('0x73')][_0x7707('0x45')]);_0x23c2f7[_0x7707('0x4a')]=_[_0x7707('0x5c')](_0x29a70f[_0x7707('0x4a')]);_0x23c2f7['filters']=_[_0x7707('0x4b')](_0x23c2f7[_0x7707('0x49')],_0x23c2f7['query']);_0x2a83a0['attributes']=_[_0x7707('0x4b')](_0x23c2f7[_0x7707('0x49')],qs[_0x7707('0x4d')](_0x29a70f['query']['fields']));_0x2a83a0[_0x7707('0x4c')]=_0x2a83a0[_0x7707('0x4c')][_0x7707('0x4e')]?_0x2a83a0[_0x7707('0x4c')]:_0x23c2f7[_0x7707('0x49')];if(!_0x29a70f['query'][_0x7707('0x4f')](_0x7707('0x6e'))){_0x2a83a0[_0x7707('0x34')]=qs['limit'](_0x29a70f[_0x7707('0x4a')][_0x7707('0x34')]);_0x2a83a0[_0x7707('0x33')]=qs[_0x7707('0x33')](_0x29a70f[_0x7707('0x4a')][_0x7707('0x33')]);}_0x2a83a0[_0x7707('0x50')]=qs['sort'](_0x29a70f[_0x7707('0x4a')]['sort']);_0x2a83a0['where']=qs['filters'](_[_0x7707('0x74')](_0x29a70f['query'],_0x23c2f7['filters']));_0x2a83a0[_0x7707('0x52')][_0x7707('0x6f')]=_0x49c99f['id'];if(_0x29a70f[_0x7707('0x4a')]['filter']){_0x2a83a0[_0x7707('0x52')]=_[_0x7707('0x56')](_0x2a83a0[_0x7707('0x52')],{'$or':_[_0x7707('0x43')](_0x2a83a0[_0x7707('0x4c')],function(_0x3ffda8){var _0x4953a6={};_0x4953a6[_0x3ffda8]={'$like':'%'+_0x29a70f[_0x7707('0x4a')]['filter']+'%'};return _0x4953a6;})});}_0x2a83a0=_[_0x7707('0x56')]({},_0x2a83a0,_0x29a70f[_0x7707('0x5e')]);return db[_0x7707('0x73')][_0x7707('0x32')]({'where':_0x2a83a0[_0x7707('0x52')]})['then'](function(_0x52182d){_0x2c547c['count']=_0x52182d;if(_0x29a70f['query'][_0x7707('0x57')]){_0x2a83a0[_0x7707('0x5d')]=[{'all':!![]}];}return db[_0x7707('0x73')][_0x7707('0x58')](_0x2a83a0);})[_0x7707('0x3a')](function(_0x24b358){_0x2c547c[_0x7707('0x59')]=_0x24b358;return _0x2c547c;});}})[_0x7707('0x3a')](respondWithFilteredResult(_0x400df4,_0x2a83a0))['catch'](handleError(_0x400df4,null));};exports[_0x7707('0x75')]=function(_0x5ab5c2,_0x1884db,_0x235798){return db['OpenchannelAccount'][_0x7707('0x5f')]({'where':{'id':_0x5ab5c2[_0x7707('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1884db,null))[_0x7707('0x3a')](function(_0x339f7d){if(_0x339f7d){return _0x339f7d[_0x7707('0x75')](_0x5ab5c2[_0x7707('0x4a')][_0x7707('0x76')]);}})['then'](respondWithStatusCode(_0x1884db,null))['catch'](handleError(_0x1884db,null));};exports['notify']=function(_0x84d35f,_0x1452c7,_0x563d97){var _0x21c98d={'body':_0x84d35f[_0x7707('0x61')],'channel':'openchannel'};var _0x4c0447=[];var _0x28bbe8=[];var _0x68a6c9={};var _0x2280d7=![];return db[_0x7707('0x77')][_0x7707('0x69')]()[_0x7707('0x3a')](function(_0x25a829){if(!_0x25a829){throw new db[(_0x7707('0x20'))]['ValidationError'](_0x7707('0x78'));}_0x4c0447=_[_0x7707('0x79')](_['keys'](_0x25a829),[_0x7707('0x7a'),'updatedAt']);_0x28bbe8=_[_0x7707('0x79')](_[_0x7707('0x5c')](_0x25a829),[_0x7707('0x7a'),_0x7707('0x7b'),'CompanyId',_0x7707('0x7c')]);if(_0x84d35f['body']['id']){delete _0x84d35f[_0x7707('0x61')]['id'];}if(_[_0x7707('0x7d')](_0x84d35f[_0x7707('0x61')][_0x7707('0x7e')])){throw new db[(_0x7707('0x20'))][(_0x7707('0x21'))](_0x7707('0x7f'));}if(_['isNil'](_0x84d35f[_0x7707('0x61')][_0x7707('0x61')])||_0x84d35f[_0x7707('0x61')][_0x7707('0x61')]===''){throw new db[(_0x7707('0x20'))]['ValidationError'](_0x7707('0x80'));}if(_[_0x7707('0x7d')](_0x84d35f[_0x7707('0x61')]['mapKey'])){throw new db[(_0x7707('0x20'))][(_0x7707('0x21'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x28bbe8);}if(!_[_0x7707('0x81')](_0x28bbe8,_0x84d35f[_0x7707('0x61')][_0x7707('0x82')])){throw new db[(_0x7707('0x20'))][(_0x7707('0x21'))](_0x7707('0x83')+_0x28bbe8);}_0x68a6c9[_0x84d35f[_0x7707('0x61')][_0x7707('0x82')]]=_0x84d35f[_0x7707('0x61')][_0x7707('0x7e')];})[_0x7707('0x3a')](function(){return db[_0x7707('0x44')][_0x7707('0x5f')]({'where':{'id':_0x84d35f['params']['id']},'include':[{'model':db[_0x7707('0x84')],'as':'List','include':[{'model':db['CmContact'],'as':_0x7707('0x85'),'where':_0x68a6c9,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x7707('0x86')}]});})[_0x7707('0x3a')](handleEntityNotFound(_0x1452c7,null))[_0x7707('0x3a')](function(_0x4a895e){if(_0x4a895e&&_0x4a895e['List']){_0x21c98d[_0x7707('0x87')]=_0x4a895e;_0x21c98d[_0x7707('0x88')]=_0x4a895e['Applications'];_0x21c98d[_0x7707('0x89')]=_0x4a895e['List'];_0x21c98d['applications']=_['orderBy'](_0x21c98d[_0x7707('0x88')],['priority'],[_0x7707('0x8a')]);if(_0x21c98d[_0x7707('0x87')][_0x7707('0x86')]){delete _0x21c98d[_0x7707('0x87')][_0x7707('0x86')];}if(_0x21c98d[_0x7707('0x87')][_0x7707('0x8b')]&&_0x21c98d[_0x7707('0x87')][_0x7707('0x8b')][_0x7707('0x85')][_0x7707('0x4e')]){return _0x21c98d[_0x7707('0x87')][_0x7707('0x8b')][_0x7707('0x85')][0x0];}var _0x1bff23=_[_0x7707('0x8c')](_0x84d35f['body'],{'firstName':_0x84d35f[_0x7707('0x61')][_0x7707('0x7e')],'ListId':_0x4a895e['ListId']});_0x1bff23[_0x84d35f[_0x7707('0x61')]['mapKey']]=_0x84d35f[_0x7707('0x61')][_0x7707('0x7e')];return db[_0x7707('0x77')]['create'](_0x1bff23,{'fields':_0x4c0447,'raw':!![]});}})[_0x7707('0x3a')](handleEntityNotFound(_0x1452c7,null))['then'](function(_0x117c19){_0x21c98d[_0x7707('0x8d')]=_0x117c19;if(_0x117c19){var _0x31d9b6={'ContactId':_0x117c19['id'],'OpenchannelAccountId':_0x84d35f[_0x7707('0x5b')]['id'],'from':(_0x117c19[_0x7707('0x8e')]||'')+'\x20'+(_0x117c19[_0x7707('0x8f')]||'')};var _0x48833d={'OpenchannelAccountId':_0x84d35f[_0x7707('0x5b')]['id'],'closed':![]};if(_0x84d35f[_0x7707('0x61')][_0x7707('0x90')]){_0x48833d[_0x7707('0x90')]=_0x84d35f[_0x7707('0x61')][_0x7707('0x90')];return db[_0x7707('0x91')][_0x7707('0x5f')]({'where':_0x48833d})[_0x7707('0x3a')](function(_0x2e8e32){if(_0x2e8e32){return[_0x2e8e32,![]];}_0x31d9b6[_0x7707('0x90')]=_0x84d35f[_0x7707('0x61')][_0x7707('0x90')];_0x31d9b6[_0x7707('0x92')]=_0x84d35f[_0x7707('0x61')][_0x7707('0x92')];return db['OpenchannelInteraction'][_0x7707('0x60')](_0x31d9b6)['then'](function(_0x222b59){return[_0x222b59,!![]];});});}else{_0x48833d[_0x7707('0x90')]=null;}_0x48833d['ContactId']=_0x117c19['id'];return db[_0x7707('0x91')]['find']({'where':_0x48833d})[_0x7707('0x3a')](function(_0x3098de){if(_0x3098de){return[_0x3098de,![]];}return db['OpenchannelInteraction'][_0x7707('0x60')](_0x31d9b6)[_0x7707('0x3a')](function(_0x1028d8){return[_0x1028d8,!![]];});});}})['spread'](function(_0x446289,_0x22293e){if(_0x446289){_0x2280d7=_0x22293e;if(!_0x22293e){var _0x88069={'from':(_0x21c98d['contact']['firstName']||'')+'\x20'+(_0x21c98d[_0x7707('0x8d')]['lastName']||'')};if(_0x84d35f[_0x7707('0x61')]['threadId']&&_0x84d35f[_0x7707('0x61')][_0x7707('0x93')]&&_0x84d35f[_0x7707('0x61')]['threadId']!=_0x84d35f[_0x7707('0x61')][_0x7707('0x93')]){_0x88069[_0x7707('0x90')]=_0x84d35f[_0x7707('0x61')][_0x7707('0x93')];}return _0x446289['update'](_0x88069);}else{return _0x446289;}}})['then'](function(_0x456cab){_0x21c98d['interaction']=_0x456cab['get']({'plain':!![]});_0x21c98d[_0x7707('0x94')][_0x7707('0x95')]=_0x2280d7;if(_0x21c98d[_0x7707('0x94')][_0x7707('0x95')]){if(_0x21c98d['account'][_0x7707('0x96')]){_0x21c98d[_0x7707('0x88')][_0x7707('0x97')]({'id':0x0,'priority':_0x21c98d[_0x7707('0x88')][_0x7707('0x4e')]+0x1,'app':'close','appdata':_0x7707('0x98'),'interval':'*,*,*,*'});}}return db[_0x7707('0x99')][_0x7707('0x60')]({'body':_0x84d35f[_0x7707('0x61')][_0x7707('0x61')],'OpenchannelAccountId':_0x84d35f[_0x7707('0x5b')]['id'],'OpenchannelInteractionId':_0x456cab['id'],'direction':'in','ContactId':_0x21c98d['contact']['id'],'AttachmentId':_0x84d35f['body'][_0x7707('0x9a')]});})['then'](function(_0x2ab1b8){_0x21c98d[_0x7707('0x2b')]=_0x2ab1b8;if(_0x21c98d[_0x7707('0x94')]['UserId']){return db['User']['find']({'attributes':['id',_0x7707('0x3f')],'where':{'id':_0x21c98d['interaction']['UserId']}})[_0x7707('0x3a')](function(_0x391a38){if(_0x391a38){_0x21c98d[_0x7707('0x88')][_0x7707('0x9b')]({'id':0x0,'priority':0x0,'app':_0x7707('0x9c'),'appdata':_0x391a38[_0x7707('0x3f')]+','+(_0x21c98d[_0x7707('0x87')]['waitForTheAssignedAgent']||0xa),'interval':_0x7707('0x9d')});_0x21c98d['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0x7707('0x9e'),_0x21c98d);});}return respondWithRpcPromise(_0x7707('0x9f'),_0x7707('0x9e'),_0x21c98d);})[_0x7707('0x3a')](function(_0x1bbb7e){respondWithRpcPromise(_0x7707('0xa0'),'EventManager',{'event':'notify','message':_0x1bbb7e},client9002);return _0x1bbb7e;})[_0x7707('0x3a')](respondWithResult(_0x1452c7,null))[_0x7707('0x2d')](handleError(_0x1452c7,null));};exports[_0x7707('0xa1')]=function(_0x4cb86e,_0x25db53,_0x1b5de4){return db[_0x7707('0x44')][_0x7707('0x6d')]({'where':{'id':_0x4cb86e[_0x7707('0x5b')]['id']}})['then'](handleEntityNotFound(_0x25db53,null))['then'](function(_0xb0237e){if(_0xb0237e){return db[_0x7707('0xa2')]['transaction'](function(_0x377a47){return db['OpenchannelApplication'][_0x7707('0x3b')]({'where':{'OpenchannelAccountId':_0x4cb86e['params']['id']},'transaction':_0x377a47})[_0x7707('0x3a')](function(_0x4138d2){var _0x2306fa=_[_0x7707('0x43')](_0x4cb86e[_0x7707('0x61')],function(_0xeb523d){_0xeb523d[_0x7707('0x6f')]=_0x4cb86e[_0x7707('0x5b')]['id'];return _0xeb523d;});return db[_0x7707('0xa3')][_0x7707('0xa4')](_0x2306fa,{'transaction':_0x377a47});});})[_0x7707('0x3a')](function(){return db[_0x7707('0xa3')][_0x7707('0xa5')]({'where':{'OpenchannelAccountId':_0x4cb86e[_0x7707('0x5b')]['id']},'order':_0x7707('0xa6')});});}})[_0x7707('0x3a')](respondWithResult(_0x25db53,null))['catch'](handleError(_0x25db53,null));};exports[_0x7707('0xa7')]=function(_0x30ff12,_0xdf0b42,_0x2a1d8d){var _0x49673d={};var _0x34a0d1={};var _0x1f158a;var _0x3cd4d7;return db[_0x7707('0x44')][_0x7707('0x6d')]({'where':{'id':_0x30ff12[_0x7707('0x5b')]['id']}})['then'](handleEntityNotFound(_0xdf0b42,null))['then'](function(_0x39b9cb){if(_0x39b9cb){_0x1f158a=_0x39b9cb;_0x34a0d1['model']=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x34a0d1[_0x7707('0x4a')]=_['keys'](_0x30ff12[_0x7707('0x4a')]);_0x34a0d1[_0x7707('0x53')]=_[_0x7707('0x4b')](_0x34a0d1[_0x7707('0x49')],_0x34a0d1[_0x7707('0x4a')]);_0x49673d['attributes']=_[_0x7707('0x4b')](_0x34a0d1[_0x7707('0x49')],qs[_0x7707('0x4d')](_0x30ff12[_0x7707('0x4a')][_0x7707('0x4d')]));_0x49673d[_0x7707('0x4c')]=_0x49673d[_0x7707('0x4c')][_0x7707('0x4e')]?_0x49673d[_0x7707('0x4c')]:_0x34a0d1['model'];_0x49673d[_0x7707('0x50')]=qs[_0x7707('0x51')](_0x30ff12['query'][_0x7707('0x51')]);_0x49673d[_0x7707('0x52')]=qs[_0x7707('0x53')](_[_0x7707('0x74')](_0x30ff12[_0x7707('0x4a')],_0x34a0d1[_0x7707('0x53')]));if(_0x30ff12[_0x7707('0x4a')]['filter']){_0x49673d[_0x7707('0x52')]=_['merge'](_0x49673d[_0x7707('0x52')],{'$or':_['map'](_0x49673d[_0x7707('0x4c')],function(_0x1dafa3){var _0x41deb8={};_0x41deb8[_0x1dafa3]={'$like':'%'+_0x30ff12[_0x7707('0x4a')][_0x7707('0x54')]+'%'};return _0x41deb8;})});}_0x49673d=_[_0x7707('0x56')]({},_0x49673d,_0x30ff12[_0x7707('0x5e')]);return _0x1f158a[_0x7707('0xa7')](_0x49673d);}})[_0x7707('0x3a')](function(_0x29ee8e){if(_0x29ee8e){_0x3cd4d7=_0x29ee8e[_0x7707('0x4e')];if(!_0x30ff12['query']['hasOwnProperty'](_0x7707('0x6e'))){_0x49673d[_0x7707('0x34')]=qs[_0x7707('0x34')](_0x30ff12[_0x7707('0x4a')][_0x7707('0x34')]);_0x49673d[_0x7707('0x33')]=qs['offset'](_0x30ff12[_0x7707('0x4a')][_0x7707('0x33')]);}return _0x1f158a[_0x7707('0xa7')](_0x49673d);}})['then'](function(_0x31f058){if(_0x31f058){return _0x31f058?{'count':_0x3cd4d7,'rows':_0x31f058}:null;}})[_0x7707('0x3a')](respondWithResult(_0xdf0b42,null))[_0x7707('0x2d')](handleError(_0xdf0b42,null));};exports['getInteractions']=function(_0x4703aa,_0x2d27fa,_0x5ace53){var _0x7d9c7d={'raw':![],'where':{}};var _0x5ab536={};var _0x5124f1={'count':0x0,'rows':[]};return db[_0x7707('0x44')]['findOne']({'where':{'id':_0x4703aa[_0x7707('0x5b')]['id']}})[_0x7707('0x3a')](handleEntityNotFound(_0x2d27fa,null))[_0x7707('0x3a')](function(_0x104e13){if(_0x104e13){_0x5ab536['model']=_[_0x7707('0x5c')](db[_0x7707('0x91')][_0x7707('0x45')]);_0x5ab536[_0x7707('0x4a')]=_[_0x7707('0x5c')](_0x4703aa[_0x7707('0x4a')]);_0x5ab536[_0x7707('0x53')]=_[_0x7707('0x4b')](_0x5ab536[_0x7707('0x49')],_0x5ab536['query']);_0x7d9c7d[_0x7707('0x4c')]=_[_0x7707('0x4b')](_0x5ab536[_0x7707('0x49')],qs['fields'](_0x4703aa['query'][_0x7707('0x4d')]));_0x7d9c7d[_0x7707('0x4c')]=_0x7d9c7d['attributes'][_0x7707('0x4e')]?_0x7d9c7d[_0x7707('0x4c')]:_0x5ab536[_0x7707('0x49')];if(!_0x4703aa[_0x7707('0x4a')][_0x7707('0x4f')](_0x7707('0x6e'))){_0x7d9c7d['limit']=qs['limit'](_0x4703aa[_0x7707('0x4a')][_0x7707('0x34')]);_0x7d9c7d[_0x7707('0x33')]=qs[_0x7707('0x33')](_0x4703aa[_0x7707('0x4a')]['offset']);}_0x7d9c7d['order']=qs[_0x7707('0x51')](_0x4703aa['query'][_0x7707('0x51')]);_0x7d9c7d[_0x7707('0x52')]=qs['filters'](_[_0x7707('0x74')](_0x4703aa[_0x7707('0x4a')],_0x5ab536[_0x7707('0x53')]));_0x7d9c7d[_0x7707('0x52')][_0x7707('0x6f')]=_0x104e13['id'];if(_0x4703aa[_0x7707('0x4a')][_0x7707('0x54')]){_0x7d9c7d[_0x7707('0x52')]=_[_0x7707('0x56')](_0x7d9c7d[_0x7707('0x52')],{'$or':_[_0x7707('0x43')](_0x7d9c7d[_0x7707('0x4c')],function(_0xe33eec){var _0x5801bd={};_0x5801bd[_0xe33eec]={'$like':'%'+_0x4703aa[_0x7707('0x4a')][_0x7707('0x54')]+'%'};return _0x5801bd;})});}_0x7d9c7d=_[_0x7707('0x56')]({},_0x7d9c7d,_0x4703aa[_0x7707('0x5e')]);return db[_0x7707('0x91')]['count']({'where':_0x7d9c7d[_0x7707('0x52')]})[_0x7707('0x3a')](function(_0x14483e){_0x5124f1['count']=_0x14483e;if(_0x4703aa[_0x7707('0x4a')]['includeAll']){_0x7d9c7d[_0x7707('0x5d')]=[{'model':db[_0x7707('0x77')],'as':_0x7707('0xa8'),'required':![]},{'model':db[_0x7707('0xa9')],'as':_0x7707('0xaa'),'attributes':[_0x7707('0x3f'),_0x7707('0xab'),'internal'],'required':![]},{'model':db[_0x7707('0xac')],'as':'Tags','attributes':['id','name','color'],'where':_0x4703aa[_0x7707('0x4a')][_0x7707('0xad')]?{'id':_0x4703aa[_0x7707('0x4a')][_0x7707('0xad')]}:undefined,'required':_0x4703aa[_0x7707('0x4a')][_0x7707('0xad')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x7707('0x58')](_0x7d9c7d);})[_0x7707('0x3a')](function(_0x31ae61){_0x5124f1['rows']=_0x31ae61;return _0x5124f1;});}})[_0x7707('0x3a')](respondWithFilteredResult(_0x2d27fa,_0x7d9c7d))[_0x7707('0x2d')](handleError(_0x2d27fa,null));};exports[_0x7707('0xae')]=function(_0xff2e7e,_0x12e4ea,_0x24551d){return db[_0x7707('0x44')][_0x7707('0x5f')]({'where':{'id':_0xff2e7e[_0x7707('0x5b')]['id']}})['then'](handleEntityNotFound(_0x12e4ea,null))[_0x7707('0x3a')](function(_0x43cd1a){if(_0x43cd1a){return _0x43cd1a['addAgents'](_0xff2e7e['body']['ids'],_[_0x7707('0xaf')](_0xff2e7e['body'],[_0x7707('0x76'),'id'])||{})[_0x7707('0xb0')](function(_0x5c6eed){for(var _0x1feab1=0x0;_0x1feab1<_0xff2e7e['body'][_0x7707('0x76')]['length'];_0x1feab1+=0x1){socket[_0x7707('0xb1')](_0x7707('0xb2'),{'UserId':_0xff2e7e[_0x7707('0x61')][_0x7707('0x76')][_0x1feab1],'OpenchannelAccountId':_0xff2e7e[_0x7707('0x5b')]['id']});}return _0x5c6eed;});}})[_0x7707('0x3a')](respondWithResult(_0x12e4ea,null))[_0x7707('0x2d')](handleError(_0x12e4ea,null));};exports[_0x7707('0xb3')]=function(_0x40b7dd,_0x3c5f0c,_0x3eabb2){return db['OpenchannelAccount'][_0x7707('0x5f')]({'where':{'id':_0x40b7dd[_0x7707('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3c5f0c,null))[_0x7707('0x3a')](function(_0x309453){if(_0x309453){return _0x309453[_0x7707('0xb3')](_0x40b7dd[_0x7707('0x4a')]['ids'])[_0x7707('0x3a')](function(){if(_['isArray'](_0x40b7dd[_0x7707('0x4a')][_0x7707('0x76')])){for(var _0x4aaa2a=0x0;_0x4aaa2a<_0x40b7dd['query'][_0x7707('0x76')][_0x7707('0x4e')];_0x4aaa2a+=0x1){socket['emit'](_0x7707('0xb4'),{'UserId':Number(_0x40b7dd[_0x7707('0x4a')][_0x7707('0x76')][_0x4aaa2a]),'OpenchannelAccountId':Number(_0x40b7dd[_0x7707('0x5b')]['id'])});}}else{socket['emit'](_0x7707('0xb4'),{'UserId':Number(_0x40b7dd[_0x7707('0x4a')][_0x7707('0x76')]),'OpenchannelAccountId':Number(_0x40b7dd[_0x7707('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x3c5f0c,null))[_0x7707('0x2d')](handleError(_0x3c5f0c,null));};exports[_0x7707('0xb5')]=function(_0xfa1c13,_0x154273,_0x1538b4){var _0x10cb71={};var _0x173946={};var _0x4eec14;var _0x30f0cf;return db[_0x7707('0x44')]['findOne']({'where':{'id':_0xfa1c13[_0x7707('0x5b')]['id']}})['then'](handleEntityNotFound(_0x154273,null))[_0x7707('0x3a')](function(_0x55428a){if(_0x55428a){_0x4eec14=_0x55428a;_0x173946[_0x7707('0x49')]=_[_0x7707('0x5c')](db[_0x7707('0xa9')][_0x7707('0x45')]);_0x173946[_0x7707('0x4a')]=_[_0x7707('0x5c')](_0xfa1c13[_0x7707('0x4a')]);_0x173946['filters']=_[_0x7707('0x4b')](_0x173946[_0x7707('0x49')],_0x173946[_0x7707('0x4a')]);_0x10cb71[_0x7707('0x4c')]=_['intersection'](_0x173946[_0x7707('0x49')],qs[_0x7707('0x4d')](_0xfa1c13[_0x7707('0x4a')][_0x7707('0x4d')]));_0x10cb71['attributes']=_0x10cb71['attributes'][_0x7707('0x4e')]?_0x10cb71['attributes']:_0x173946[_0x7707('0x49')];_0x10cb71[_0x7707('0x50')]=qs[_0x7707('0x51')](_0xfa1c13['query']['sort']);_0x10cb71['where']=qs[_0x7707('0x53')](_[_0x7707('0x74')](_0xfa1c13[_0x7707('0x4a')],_0x173946['filters']));if(_0xfa1c13[_0x7707('0x4a')][_0x7707('0x54')]){_0x10cb71[_0x7707('0x52')]=_['merge'](_0x10cb71[_0x7707('0x52')],{'$or':_[_0x7707('0x43')](_0x10cb71[_0x7707('0x4c')],function(_0x3ede7c){var _0x46ed94={};_0x46ed94[_0x3ede7c]={'$like':'%'+_0xfa1c13[_0x7707('0x4a')][_0x7707('0x54')]+'%'};return _0x46ed94;})});}_0x10cb71=_[_0x7707('0x56')]({},_0x10cb71,_0xfa1c13[_0x7707('0x5e')]);return _0x4eec14[_0x7707('0xb5')](_0x10cb71);}})[_0x7707('0x3a')](function(_0x1852fe){if(_0x1852fe){_0x30f0cf=_0x1852fe[_0x7707('0x4e')];if(!_0xfa1c13['query']['hasOwnProperty'](_0x7707('0x6e'))){_0x10cb71[_0x7707('0x34')]=qs[_0x7707('0x34')](_0xfa1c13['query']['limit']);_0x10cb71[_0x7707('0x33')]=qs[_0x7707('0x33')](_0xfa1c13[_0x7707('0x4a')][_0x7707('0x33')]);}return _0x4eec14['getAgents'](_0x10cb71);}})[_0x7707('0x3a')](function(_0x34af87){if(_0x34af87){return _0x34af87?{'count':_0x30f0cf,'rows':_0x34af87}:null;}})['then'](respondWithResult(_0x154273,null))['catch'](handleError(_0x154273,null));};exports['send']=function(_0xdd0d5a,_0x2b38b1,_0x3c74f2){var _0x5b94ab,_0x33d899,_0x13d8ec;if(_[_0x7707('0x7d')](_0xdd0d5a[_0x7707('0x61')][_0x7707('0x61')])||_0xdd0d5a[_0x7707('0x61')]['body']===''){throw new db[(_0x7707('0x20'))]['ValidationError'](_0x7707('0x80'));}if(_[_0x7707('0x7d')](_0xdd0d5a[_0x7707('0x61')]['to'])){}_0x5b94ab=_0xdd0d5a[_0x7707('0x61')]['to'];return db[_0x7707('0x44')][_0x7707('0x6d')]({'where':{'id':_0xdd0d5a['params']['id']}})[_0x7707('0x3a')](handleEntityNotFound(_0x2b38b1,null))[_0x7707('0x3a')](function(_0x1aeee5){if(_0x1aeee5){return db[_0x7707('0x44')][_0x7707('0x5f')]({'where':{'id':_0x1aeee5['id']},'include':[{'model':db[_0x7707('0x84')],'as':_0x7707('0x8b'),'include':[{'model':db[_0x7707('0x77')],'as':_0x7707('0x85'),'where':{[_0x1aeee5[_0x7707('0x82')]]:_0x5b94ab},'limit':0x1,'order':[[_0x7707('0x7b'),'DESC']]}]}]})[_0x7707('0x3a')](handleEntityNotFound(_0x2b38b1,null))['then'](function(_0x191cee){if(_0x191cee&&_0x191cee[_0x7707('0x8b')]){_0x33d899=_0x191cee[_0x7707('0x3c')]({'plain':!![]});if(_0x33d899[_0x7707('0x8b')]&&_0x33d899[_0x7707('0x8b')][_0x7707('0x85')][_0x7707('0x4e')]){return _0x33d899[_0x7707('0x8b')][_0x7707('0x85')][0x0];}return db[_0x7707('0x77')]['create'](_[_0x7707('0x8c')](_0xdd0d5a[_0x7707('0x61')],{'firstName':_0x5b94ab,[_0x191cee[_0x7707('0x82')]]:_0x5b94ab,'phone':_0x5b94ab,'ListId':_0x33d899[_0x7707('0x7c')]}));}})[_0x7707('0x3a')](handleEntityNotFound(_0x2b38b1,null))[_0x7707('0x3a')](function(_0x20b89f){if(_0x20b89f){_0x13d8ec=_0x20b89f;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x13d8ec['id'],'closed':![],'OpenchannelAccountId':_0x33d899['id']}})[_0x7707('0x3a')](function(_0x549dff){if(_0x549dff){return[_0x549dff,![]];}return db[_0x7707('0x91')][_0x7707('0x60')]({'UserId':_0xdd0d5a['user']['id'],'ContactId':_0x13d8ec['id'],'OpenchannelAccountId':_0x33d899['id'],'lastMsgDirection':_0x7707('0xb6'),'Messages':[_[_0x7707('0x56')](_0xdd0d5a['body'],{'read':![],'body':_0xdd0d5a[_0x7707('0x61')][_0x7707('0x61')],'OpenchannelAccountId':_0x33d899['id'],'UserId':_0xdd0d5a[_0x7707('0x62')]['id'],'ContactId':_0x13d8ec['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x7707('0xb7')}]})[_0x7707('0x3a')](function(_0x49383e){return[_0x49383e,!![]];});});}})[_0x7707('0xb0')](function(_0x936081,_0x43be89){if(_0x43be89){return _0x936081;}return db[_0x7707('0x99')]['create'](_[_0x7707('0x56')](_0xdd0d5a[_0x7707('0x61')],{'read':![],'body':_0xdd0d5a['body'][_0x7707('0x61')],'OpenchannelAccountId':_0x33d899['id'],'OpenchannelInteractionId':_0x936081['id'],'UserId':_0xdd0d5a[_0x7707('0x62')]['id'],'ContactId':_0x13d8ec['id']}))[_0x7707('0x3a')](function(_0x3062df){_0x936081[_0x7707('0xb8')][_0x7707('0xb7')]=[];_0x936081[_0x7707('0xb8')][_0x7707('0xb7')][_0x7707('0x97')](_0x3062df[_0x7707('0xb8')]);return _0x936081;});});}})['then'](respondWithResult(_0x2b38b1,null))[_0x7707('0x2d')](handleError(_0x2b38b1,null));}; \ No newline at end of file +var _0xe31b=['OpenchannelAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','key','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','OpnechannelAccountId','Disposition','OpenchannelAccountId','removeDispositions','ids','addAnswer','findOne','CannedAnswer','pick','rows','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','list','applications','orderBy','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','findAndCountAll','priority','getApplications','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','Messages','dataValues','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelAccount.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','get'];(function(_0x3b7873,_0x2929d3){var _0x41fee8=function(_0x5d3e91){while(--_0x5d3e91){_0x3b7873['push'](_0x3b7873['shift']());}};_0x41fee8(++_0x2929d3);}(_0xe31b,0x86));var _0xbe31=function(_0x1ee293,_0x465cda){_0x1ee293=_0x1ee293-0x0;var _0x161342=_0xe31b[_0x1ee293];return _0x161342;};'use strict';var pdf=require(_0xbe31('0x0'));var emlformat=require(_0xbe31('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe31('0x2'));var rp=require('request-promise');var moment=require(_0xbe31('0x3'));var BPromise=require(_0xbe31('0x4'));var Mustache=require(_0xbe31('0x5'));var util=require(_0xbe31('0x6'));var path=require(_0xbe31('0x7'));var sox=require(_0xbe31('0x8'));var csv=require(_0xbe31('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbe31('0xa'));var jsforce=require(_0xbe31('0xb'));var deskjs=require(_0xbe31('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbe31('0xd'));var Papa=require('papaparse');var Redis=require(_0xbe31('0xe'));var authService=require(_0xbe31('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xbe31('0x10'));var hardwareService=require(_0xbe31('0x11'));var logger=require(_0xbe31('0x12'))('api');var utils=require(_0xbe31('0x13'));var config=require(_0xbe31('0x14'));var db=require(_0xbe31('0x15'))['db'];config['redis']=_[_0xbe31('0x16')](config['redis'],{'host':_0xbe31('0x17'),'port':0x18eb});var socket=require(_0xbe31('0x18'))(new Redis(config[_0xbe31('0x19')]));require(_0xbe31('0x1a'))[_0xbe31('0x1b')](socket);var jayson=require(_0xbe31('0x1c'));var client=jayson[_0xbe31('0x1d')][_0xbe31('0x1e')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x4ed0ac,_0x50885f,_0x4db0fe){if(_0x4db0fe){var _0x59c7ed=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x59c7ed[_0xbe31('0x1f')](_0x50885f)){return _0x4ed0ac;}else{throw new db['Sequelize']['ValidationError'](_0xbe31('0x20'));}}else{return _0x4ed0ac;}}function respondWithRpcPromise(_0x3256a7,_0x191876,_0x3c8355,_0x3c712c){return new BPromise(function(_0x78aa0b,_0x458960){var _0x3904a7=_0x3c712c||client;return _0x3904a7['request'](_0x3256a7,_0x3c8355)[_0xbe31('0x21')](function(_0x528d89){logger['info'](_0xbe31('0x22'),_0x191876,_0xbe31('0x23'));logger[_0xbe31('0x24')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x191876,'request\x20sent',JSON[_0xbe31('0x25')](_0x528d89));if(_0x528d89['error']){if(_0x528d89[_0xbe31('0x26')][_0xbe31('0x27')]===0x1f4){logger[_0xbe31('0x26')](_0xbe31('0x22'),_0x191876,_0x528d89[_0xbe31('0x26')]['message']);return _0x458960(_0x528d89[_0xbe31('0x26')][_0xbe31('0x28')]);}logger[_0xbe31('0x26')](_0xbe31('0x22'),_0x191876,_0x528d89[_0xbe31('0x26')][_0xbe31('0x28')]);return _0x78aa0b(_0x528d89[_0xbe31('0x26')]['message']);}else{logger[_0xbe31('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x191876,'request\x20sent');_0x78aa0b(_0x528d89[_0xbe31('0x2a')][_0xbe31('0x28')]);}})[_0xbe31('0x2b')](function(_0x215b5){logger['error'](_0xbe31('0x22'),_0x191876,_0x215b5);_0x458960(_0x215b5);});});}function respondWithStatusCode(_0x524f1d,_0x7a28b0){_0x7a28b0=_0x7a28b0||0xcc;return function(_0x57f045){if(_0x57f045){return _0x524f1d[_0xbe31('0x2c')](_0x7a28b0);}return _0x524f1d[_0xbe31('0x2d')](_0x7a28b0)[_0xbe31('0x2e')]();};}function respondWithResult(_0x4607bf,_0x15ad05){_0x15ad05=_0x15ad05||0xc8;return function(_0x206e4a){if(_0x206e4a){return _0x4607bf[_0xbe31('0x2d')](_0x15ad05)['json'](_0x206e4a);}};}function respondWithFilteredResult(_0x40df4f,_0x52d3b4){return function(_0xf72da6){if(_0xf72da6){var _0x32cbc5=_0xf72da6[_0xbe31('0x2f')],_0xcf3f1a=_0x52d3b4[_0xbe31('0x30')],_0x8abaec=_0x52d3b4[_0xbe31('0x30')]+_0x52d3b4[_0xbe31('0x31')],_0x1b89b8;if(_0x8abaec>=_0x32cbc5){_0x8abaec=_0x32cbc5;_0x1b89b8=0xc8;}else{_0x1b89b8=0xce;}_0x40df4f['status'](_0x1b89b8);return _0x40df4f[_0xbe31('0x32')](_0xbe31('0x33'),_0xcf3f1a+'-'+_0x8abaec+'/'+_0x32cbc5)[_0xbe31('0x34')](_0xf72da6);}return null;};}function patchUpdates(_0x443e4e){return function(_0x4fcd54){try{jsonpatch[_0xbe31('0x35')](_0x4fcd54,_0x443e4e,!![]);}catch(_0x138d7d){return BPromise[_0xbe31('0x36')](_0x138d7d);}return _0x4fcd54[_0xbe31('0x37')]();};}function saveUpdates(_0x5b2007,_0x43b03a){return function(_0x360344){if(_0x360344){return _0x360344['update'](_0x5b2007)[_0xbe31('0x21')](function(_0xc2d314){return _0xc2d314;});}return null;};}function removeEntity(_0x4addbc,_0x34367f){return function(_0x563712){if(_0x563712){return _0x563712['destroy']()[_0xbe31('0x21')](function(){var _0x1d40fc=_0x563712[_0xbe31('0x38')]({'plain':!![]});var _0x3d4a3f=_0xbe31('0x39');return db[_0xbe31('0x3a')]['destroy']({'where':{'type':_0x3d4a3f,'resourceId':_0x1d40fc['id']}})[_0xbe31('0x21')](function(){return _0x563712;});})[_0xbe31('0x21')](function(){_0x4addbc[_0xbe31('0x2d')](0xcc)[_0xbe31('0x2e')]();});}};}function handleEntityNotFound(_0x42839a,_0x15772f){return function(_0x9474e4){if(!_0x9474e4){_0x42839a[_0xbe31('0x2c')](0x194);}return _0x9474e4;};}function handleError(_0x2b0114,_0x469749){_0x469749=_0x469749||0x1f4;return function(_0x4bfb8e){logger[_0xbe31('0x26')](_0x4bfb8e[_0xbe31('0x3b')]);if(_0x4bfb8e[_0xbe31('0x3c')]){delete _0x4bfb8e['name'];}_0x2b0114['status'](_0x469749)['send'](_0x4bfb8e);};}exports[_0xbe31('0x3d')]=function(_0x16b45b,_0x1faa67){var _0x498f0c={'include':[{'model':db[_0xbe31('0x3e')],'as':_0xbe31('0x3f')}]},_0x2424cf={},_0x40b1f={'count':0x0,'rows':[]};var _0x249925=_[_0xbe31('0x40')](db[_0xbe31('0x41')][_0xbe31('0x42')],function(_0x3cbe73){return{'name':_0x3cbe73[_0xbe31('0x43')],'type':_0x3cbe73['type'][_0xbe31('0x44')]};});_0x2424cf['model']=_[_0xbe31('0x40')](_0x249925,'name');_0x2424cf['query']=_[_0xbe31('0x45')](_0x16b45b['query']);_0x2424cf[_0xbe31('0x46')]=_[_0xbe31('0x47')](_0x2424cf[_0xbe31('0x48')],_0x2424cf['query']);_0x498f0c[_0xbe31('0x49')]=_[_0xbe31('0x47')](_0x2424cf[_0xbe31('0x48')],qs[_0xbe31('0x4a')](_0x16b45b[_0xbe31('0x4b')][_0xbe31('0x4a')]));_0x498f0c['attributes']=_0x498f0c['attributes'][_0xbe31('0x4c')]?_0x498f0c[_0xbe31('0x49')]:_0x2424cf['model'];if(!_0x16b45b['query'][_0xbe31('0x4d')](_0xbe31('0x4e'))){_0x498f0c[_0xbe31('0x31')]=qs[_0xbe31('0x31')](_0x16b45b[_0xbe31('0x4b')][_0xbe31('0x31')]);_0x498f0c[_0xbe31('0x30')]=qs['offset'](_0x16b45b[_0xbe31('0x4b')][_0xbe31('0x30')]);}_0x498f0c[_0xbe31('0x4f')]=qs[_0xbe31('0x50')](_0x16b45b[_0xbe31('0x4b')][_0xbe31('0x50')]);_0x498f0c[_0xbe31('0x51')]=qs[_0xbe31('0x46')](_['pick'](_0x16b45b[_0xbe31('0x4b')],_0x2424cf[_0xbe31('0x46')]),_0x249925);if(_0x16b45b[_0xbe31('0x4b')][_0xbe31('0x52')]){_0x498f0c[_0xbe31('0x51')]=_[_0xbe31('0x53')](_0x498f0c[_0xbe31('0x51')],{'$or':_['map'](_0x249925,function(_0x375204){if(_0x375204[_0xbe31('0x54')]!==_0xbe31('0x55')){var _0x3c6d5b={};_0x3c6d5b[_0x375204[_0xbe31('0x3c')]]={'$like':'%'+_0x16b45b[_0xbe31('0x4b')][_0xbe31('0x52')]+'%'};return _0x3c6d5b;}})});}_0x498f0c=_[_0xbe31('0x53')]({},_0x498f0c,_0x16b45b[_0xbe31('0x56')]);var _0xb964b8={'where':_0x498f0c[_0xbe31('0x51')]};return db['OpenchannelAccount'][_0xbe31('0x2f')](_0xb964b8)[_0xbe31('0x21')](function(_0x4a605c){_0x40b1f[_0xbe31('0x2f')]=_0x4a605c;if(_0x16b45b[_0xbe31('0x4b')][_0xbe31('0x57')]){_0x498f0c[_0xbe31('0x58')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xbe31('0x59')](_0x498f0c);})['then'](function(_0x3dc539){_0x40b1f['rows']=_0x3dc539;return _0x40b1f;})['then'](respondWithFilteredResult(_0x1faa67,_0x498f0c))[_0xbe31('0x2b')](handleError(_0x1faa67,null));};exports[_0xbe31('0x5a')]=function(_0x46f4bf,_0x31cdfc){var _0x5d9634={'raw':![],'where':{'id':_0x46f4bf[_0xbe31('0x5b')]['id']},'include':[{'model':db[_0xbe31('0x3e')],'as':_0xbe31('0x3f')}]},_0x22c7f1={};_0x22c7f1[_0xbe31('0x48')]=_[_0xbe31('0x45')](db[_0xbe31('0x41')][_0xbe31('0x42')]);_0x22c7f1[_0xbe31('0x4b')]=_[_0xbe31('0x45')](_0x46f4bf[_0xbe31('0x4b')]);_0x22c7f1[_0xbe31('0x46')]=_[_0xbe31('0x47')](_0x22c7f1[_0xbe31('0x48')],_0x22c7f1[_0xbe31('0x4b')]);_0x5d9634[_0xbe31('0x49')]=_[_0xbe31('0x47')](_0x22c7f1['model'],qs[_0xbe31('0x4a')](_0x46f4bf['query'][_0xbe31('0x4a')]));_0x5d9634[_0xbe31('0x49')]=_0x5d9634[_0xbe31('0x49')][_0xbe31('0x4c')]?_0x5d9634[_0xbe31('0x49')]:_0x22c7f1['model'];if(_0x46f4bf['query'][_0xbe31('0x57')]){_0x5d9634[_0xbe31('0x58')]=[{'all':!![]}];}_0x5d9634=_[_0xbe31('0x53')]({},_0x5d9634,_0x46f4bf[_0xbe31('0x56')]);return db[_0xbe31('0x41')][_0xbe31('0x5c')](_0x5d9634)[_0xbe31('0x21')](handleEntityNotFound(_0x31cdfc,null))[_0xbe31('0x21')](respondWithResult(_0x31cdfc,null))[_0xbe31('0x2b')](handleError(_0x31cdfc,null));};exports[_0xbe31('0x5d')]=function(_0x1a7c34,_0x58998e){return db[_0xbe31('0x41')][_0xbe31('0x5d')](_0x1a7c34[_0xbe31('0x5e')],{})[_0xbe31('0x21')](function(_0x1a6b86){var _0x565a64=_0x1a7c34[_0xbe31('0x5f')][_0xbe31('0x38')]({'plain':!![]});if(!_0x565a64)throw new Error(_0xbe31('0x60'));if(_0x565a64['role']===_0xbe31('0x5f')){var _0x183e7b=_0x1a6b86['get']({'plain':!![]});var _0x447570=_0xbe31('0x39');return db[_0xbe31('0x61')]['find']({'where':{'name':_0x447570,'userProfileId':_0x565a64[_0xbe31('0x62')]},'raw':!![]})[_0xbe31('0x21')](function(_0xebe587){if(_0xebe587&&_0xebe587[_0xbe31('0x63')]===0x0){return db['UserProfileResource'][_0xbe31('0x5d')]({'name':_0x183e7b[_0xbe31('0x3c')],'resourceId':_0x183e7b['id'],'type':_0xebe587[_0xbe31('0x3c')],'sectionId':_0xebe587['id']},{})['then'](function(){return _0x1a6b86;});}else{return _0x1a6b86;}})[_0xbe31('0x2b')](function(_0x28e76f){logger['error'](_0xbe31('0x64'),_0x28e76f);throw _0x28e76f;});}return _0x1a6b86;})[_0xbe31('0x21')](respondWithResult(_0x58998e,0xc9))[_0xbe31('0x2b')](handleError(_0x58998e,null));};exports[_0xbe31('0x65')]=function(_0x2b4ea2,_0x440195){if(_0x2b4ea2[_0xbe31('0x5e')]['id']){delete _0x2b4ea2[_0xbe31('0x5e')]['id'];}return db['OpenchannelAccount'][_0xbe31('0x5c')]({'where':{'id':_0x2b4ea2['params']['id']},'include':[{'model':db[_0xbe31('0x3e')],'as':_0xbe31('0x3f')}]})[_0xbe31('0x21')](handleEntityNotFound(_0x440195,null))[_0xbe31('0x21')](saveUpdates(_0x2b4ea2[_0xbe31('0x5e')],null))[_0xbe31('0x21')](respondWithResult(_0x440195,null))['catch'](handleError(_0x440195,null));};exports['destroy']=function(_0x1deb28,_0x45f543){return db[_0xbe31('0x41')]['find']({'where':{'id':_0x1deb28[_0xbe31('0x5b')]['id']}})['then'](handleEntityNotFound(_0x45f543,null))['then'](removeEntity(_0x45f543,null))[_0xbe31('0x2b')](handleError(_0x45f543,null));};exports[_0xbe31('0x66')]=function(_0x17b9a3,_0x47b9c4){return db['OpenchannelAccount']['describe']()[_0xbe31('0x21')](respondWithResult(_0x47b9c4,null))['catch'](handleError(_0x47b9c4,null));};exports[_0xbe31('0x67')]=function(_0x4c0cb4,_0x3f3761,_0x5e4c6b){if(_0x4c0cb4[_0xbe31('0x5e')]['id']){delete _0x4c0cb4[_0xbe31('0x5e')]['id'];}return db[_0xbe31('0x41')][_0xbe31('0x5c')]({'where':{'id':_0x4c0cb4['params']['id']}})[_0xbe31('0x21')](handleEntityNotFound(_0x3f3761,null))['then'](function(_0x1dbf22){if(_0x1dbf22){_0x4c0cb4[_0xbe31('0x5e')][_0xbe31('0x68')]=_0x1dbf22['id'];return db['Disposition'][_0xbe31('0x5d')](_0x4c0cb4[_0xbe31('0x5e')]);}})[_0xbe31('0x21')](respondWithResult(_0x3f3761,null))[_0xbe31('0x2b')](handleError(_0x3f3761,null));};exports['getDispositions']=function(_0x19f512,_0x26e1d3,_0x47dced){var _0x2b10e1={'raw':![],'where':{}};var _0x444aa9={};var _0x27e893={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x19f512['params']['id']}})[_0xbe31('0x21')](handleEntityNotFound(_0x26e1d3,null))[_0xbe31('0x21')](function(_0x374781){if(_0x374781){_0x444aa9[_0xbe31('0x48')]=_[_0xbe31('0x45')](db[_0xbe31('0x69')][_0xbe31('0x42')]);_0x444aa9['query']=_[_0xbe31('0x45')](_0x19f512['query']);_0x444aa9['filters']=_['intersection'](_0x444aa9[_0xbe31('0x48')],_0x444aa9[_0xbe31('0x4b')]);_0x2b10e1[_0xbe31('0x49')]=_['intersection'](_0x444aa9[_0xbe31('0x48')],qs[_0xbe31('0x4a')](_0x19f512[_0xbe31('0x4b')]['fields']));_0x2b10e1['attributes']=_0x2b10e1[_0xbe31('0x49')][_0xbe31('0x4c')]?_0x2b10e1['attributes']:_0x444aa9[_0xbe31('0x48')];if(!_0x19f512[_0xbe31('0x4b')][_0xbe31('0x4d')](_0xbe31('0x4e'))){_0x2b10e1[_0xbe31('0x31')]=qs['limit'](_0x19f512[_0xbe31('0x4b')][_0xbe31('0x31')]);_0x2b10e1[_0xbe31('0x30')]=qs['offset'](_0x19f512[_0xbe31('0x4b')][_0xbe31('0x30')]);}_0x2b10e1['order']=qs[_0xbe31('0x50')](_0x19f512['query'][_0xbe31('0x50')]);_0x2b10e1[_0xbe31('0x51')]=qs['filters'](_['pick'](_0x19f512[_0xbe31('0x4b')],_0x444aa9[_0xbe31('0x46')]));_0x2b10e1[_0xbe31('0x51')][_0xbe31('0x6a')]=_0x374781['id'];if(_0x19f512[_0xbe31('0x4b')]['filter']){_0x2b10e1['where']=_[_0xbe31('0x53')](_0x2b10e1[_0xbe31('0x51')],{'$or':_[_0xbe31('0x40')](_0x2b10e1[_0xbe31('0x49')],function(_0x106d0a){var _0x434728={};_0x434728[_0x106d0a]={'$like':'%'+_0x19f512[_0xbe31('0x4b')][_0xbe31('0x52')]+'%'};return _0x434728;})});}_0x2b10e1=_['merge']({},_0x2b10e1,_0x19f512[_0xbe31('0x56')]);return db['Disposition'][_0xbe31('0x2f')]({'where':_0x2b10e1['where']})[_0xbe31('0x21')](function(_0x1ef41a){_0x27e893[_0xbe31('0x2f')]=_0x1ef41a;if(_0x19f512[_0xbe31('0x4b')][_0xbe31('0x57')]){_0x2b10e1[_0xbe31('0x58')]=[{'all':!![]}];}return db[_0xbe31('0x69')][_0xbe31('0x59')](_0x2b10e1);})[_0xbe31('0x21')](function(_0x45364f){_0x27e893['rows']=_0x45364f;return _0x27e893;});}})[_0xbe31('0x21')](respondWithFilteredResult(_0x26e1d3,_0x2b10e1))[_0xbe31('0x2b')](handleError(_0x26e1d3,null));};exports[_0xbe31('0x6b')]=function(_0x36489e,_0x52a16f,_0x147b77){return db[_0xbe31('0x41')]['find']({'where':{'id':_0x36489e[_0xbe31('0x5b')]['id']}})[_0xbe31('0x21')](handleEntityNotFound(_0x52a16f,null))['then'](function(_0x277d99){if(_0x277d99){return _0x277d99[_0xbe31('0x6b')](_0x36489e[_0xbe31('0x4b')][_0xbe31('0x6c')]);}})['then'](respondWithStatusCode(_0x52a16f,null))['catch'](handleError(_0x52a16f,null));};exports[_0xbe31('0x6d')]=function(_0xb56f4b,_0xf3a71c,_0x13169a){if(_0xb56f4b[_0xbe31('0x5e')]['id']){delete _0xb56f4b[_0xbe31('0x5e')]['id'];}return db['OpenchannelAccount'][_0xbe31('0x5c')]({'where':{'id':_0xb56f4b[_0xbe31('0x5b')]['id']}})[_0xbe31('0x21')](handleEntityNotFound(_0xf3a71c,null))[_0xbe31('0x21')](function(_0x3dc53a){if(_0x3dc53a){_0xb56f4b['body']['OpenchannelAccountId']=_0x3dc53a['id'];return db['CannedAnswer'][_0xbe31('0x5d')](_0xb56f4b[_0xbe31('0x5e')]);}})[_0xbe31('0x21')](respondWithResult(_0xf3a71c,null))[_0xbe31('0x2b')](handleError(_0xf3a71c,null));};exports['getAnswers']=function(_0x4dee23,_0x3af6ee,_0x36d45b){var _0x1c5568={'raw':![],'where':{}};var _0x5a85cc={};var _0x4d394a={'count':0x0,'rows':[]};return db[_0xbe31('0x41')][_0xbe31('0x6e')]({'where':{'id':_0x4dee23['params']['id']}})[_0xbe31('0x21')](handleEntityNotFound(_0x3af6ee,null))[_0xbe31('0x21')](function(_0x1a691f){if(_0x1a691f){_0x5a85cc[_0xbe31('0x48')]=_[_0xbe31('0x45')](db[_0xbe31('0x6f')][_0xbe31('0x42')]);_0x5a85cc[_0xbe31('0x4b')]=_[_0xbe31('0x45')](_0x4dee23[_0xbe31('0x4b')]);_0x5a85cc[_0xbe31('0x46')]=_['intersection'](_0x5a85cc['model'],_0x5a85cc[_0xbe31('0x4b')]);_0x1c5568['attributes']=_[_0xbe31('0x47')](_0x5a85cc['model'],qs['fields'](_0x4dee23[_0xbe31('0x4b')][_0xbe31('0x4a')]));_0x1c5568[_0xbe31('0x49')]=_0x1c5568['attributes'][_0xbe31('0x4c')]?_0x1c5568[_0xbe31('0x49')]:_0x5a85cc[_0xbe31('0x48')];if(!_0x4dee23[_0xbe31('0x4b')][_0xbe31('0x4d')](_0xbe31('0x4e'))){_0x1c5568[_0xbe31('0x31')]=qs[_0xbe31('0x31')](_0x4dee23[_0xbe31('0x4b')][_0xbe31('0x31')]);_0x1c5568[_0xbe31('0x30')]=qs[_0xbe31('0x30')](_0x4dee23[_0xbe31('0x4b')][_0xbe31('0x30')]);}_0x1c5568['order']=qs[_0xbe31('0x50')](_0x4dee23[_0xbe31('0x4b')]['sort']);_0x1c5568[_0xbe31('0x51')]=qs[_0xbe31('0x46')](_[_0xbe31('0x70')](_0x4dee23[_0xbe31('0x4b')],_0x5a85cc[_0xbe31('0x46')]));_0x1c5568[_0xbe31('0x51')][_0xbe31('0x6a')]=_0x1a691f['id'];if(_0x4dee23[_0xbe31('0x4b')][_0xbe31('0x52')]){_0x1c5568['where']=_[_0xbe31('0x53')](_0x1c5568[_0xbe31('0x51')],{'$or':_[_0xbe31('0x40')](_0x1c5568[_0xbe31('0x49')],function(_0x5b3ba1){var _0x297f8e={};_0x297f8e[_0x5b3ba1]={'$like':'%'+_0x4dee23[_0xbe31('0x4b')][_0xbe31('0x52')]+'%'};return _0x297f8e;})});}_0x1c5568=_['merge']({},_0x1c5568,_0x4dee23[_0xbe31('0x56')]);return db[_0xbe31('0x6f')][_0xbe31('0x2f')]({'where':_0x1c5568[_0xbe31('0x51')]})[_0xbe31('0x21')](function(_0x1abaac){_0x4d394a[_0xbe31('0x2f')]=_0x1abaac;if(_0x4dee23[_0xbe31('0x4b')][_0xbe31('0x57')]){_0x1c5568[_0xbe31('0x58')]=[{'all':!![]}];}return db[_0xbe31('0x6f')][_0xbe31('0x59')](_0x1c5568);})[_0xbe31('0x21')](function(_0x2e0400){_0x4d394a[_0xbe31('0x71')]=_0x2e0400;return _0x4d394a;});}})[_0xbe31('0x21')](respondWithFilteredResult(_0x3af6ee,_0x1c5568))[_0xbe31('0x2b')](handleError(_0x3af6ee,null));};exports['removeAnswers']=function(_0x28de32,_0x3f828a,_0x4e6db8){return db['OpenchannelAccount']['find']({'where':{'id':_0x28de32[_0xbe31('0x5b')]['id']}})[_0xbe31('0x21')](handleEntityNotFound(_0x3f828a,null))[_0xbe31('0x21')](function(_0x9e3540){if(_0x9e3540){return _0x9e3540[_0xbe31('0x72')](_0x28de32[_0xbe31('0x4b')][_0xbe31('0x6c')]);}})[_0xbe31('0x21')](respondWithStatusCode(_0x3f828a,null))['catch'](handleError(_0x3f828a,null));};exports[_0xbe31('0x73')]=function(_0x21f8bf,_0x57d200,_0x1dd2aa){var _0x2d8a0f={'body':_0x21f8bf['body'],'channel':_0xbe31('0x74')};var _0x14a881=[];var _0x5b18ed=[];var _0x38cca9={};var _0x17a3b0=![];return db['CmContact'][_0xbe31('0x66')]()[_0xbe31('0x21')](function(_0x45b119){if(!_0x45b119){throw new db[(_0xbe31('0x75'))][(_0xbe31('0x76'))](_0xbe31('0x77'));}_0x14a881=_[_0xbe31('0x78')](_[_0xbe31('0x45')](_0x45b119),[_0xbe31('0x79'),_0xbe31('0x7a')]);_0x5b18ed=_[_0xbe31('0x78')](_[_0xbe31('0x45')](_0x45b119),[_0xbe31('0x79'),_0xbe31('0x7a'),'CompanyId',_0xbe31('0x7b')]);if(_0x21f8bf['body']['id']){delete _0x21f8bf[_0xbe31('0x5e')]['id'];}if(_[_0xbe31('0x7c')](_0x21f8bf[_0xbe31('0x5e')][_0xbe31('0x7d')])){throw new db[(_0xbe31('0x75'))][(_0xbe31('0x76'))](_0xbe31('0x7e'));}if(_[_0xbe31('0x7c')](_0x21f8bf[_0xbe31('0x5e')]['body'])||_0x21f8bf[_0xbe31('0x5e')][_0xbe31('0x5e')]===''){throw new db[(_0xbe31('0x75'))][(_0xbe31('0x76'))](_0xbe31('0x7f'));}if(_[_0xbe31('0x7c')](_0x21f8bf[_0xbe31('0x5e')]['mapKey'])){throw new db[(_0xbe31('0x75'))][(_0xbe31('0x76'))](_0xbe31('0x80')+_0x5b18ed);}if(!_[_0xbe31('0x81')](_0x5b18ed,_0x21f8bf['body'][_0xbe31('0x82')])){throw new db[(_0xbe31('0x75'))]['ValidationError'](_0xbe31('0x83')+_0x5b18ed);}_0x38cca9[_0x21f8bf[_0xbe31('0x5e')][_0xbe31('0x82')]]=_0x21f8bf[_0xbe31('0x5e')][_0xbe31('0x7d')];})[_0xbe31('0x21')](function(){return db[_0xbe31('0x41')][_0xbe31('0x5c')]({'where':{'id':_0x21f8bf[_0xbe31('0x5b')]['id']},'include':[{'model':db[_0xbe31('0x84')],'as':_0xbe31('0x85'),'include':[{'model':db[_0xbe31('0x86')],'as':_0xbe31('0x87'),'where':_0x38cca9,'limit':0x1,'order':[[_0xbe31('0x7a'),_0xbe31('0x88')]]}]},{'model':db[_0xbe31('0x89')],'as':_0xbe31('0x8a')}]});})['then'](handleEntityNotFound(_0x57d200,null))[_0xbe31('0x21')](function(_0x37be85){if(_0x37be85&&_0x37be85[_0xbe31('0x85')]){_0x2d8a0f[_0xbe31('0x8b')]=_0x37be85;_0x2d8a0f['applications']=_0x37be85[_0xbe31('0x8a')];_0x2d8a0f[_0xbe31('0x8c')]=_0x37be85['List'];_0x2d8a0f[_0xbe31('0x8d')]=_[_0xbe31('0x8e')](_0x2d8a0f['applications'],['priority'],['asc']);if(_0x2d8a0f[_0xbe31('0x8b')]['Applications']){delete _0x2d8a0f[_0xbe31('0x8b')][_0xbe31('0x8a')];}if(_0x2d8a0f[_0xbe31('0x8b')][_0xbe31('0x85')]&&_0x2d8a0f['account']['List'][_0xbe31('0x87')][_0xbe31('0x4c')]){return _0x2d8a0f[_0xbe31('0x8b')][_0xbe31('0x85')]['Contacts'][0x0];}var _0x609a1f=_[_0xbe31('0x16')](_0x21f8bf[_0xbe31('0x5e')],{'firstName':_0x21f8bf['body'][_0xbe31('0x7d')],'ListId':_0x37be85[_0xbe31('0x7b')]});_0x609a1f[_0x21f8bf['body'][_0xbe31('0x82')]]=_0x21f8bf[_0xbe31('0x5e')][_0xbe31('0x7d')];return db[_0xbe31('0x86')][_0xbe31('0x5d')](_0x609a1f,{'fields':_0x14a881,'raw':!![]});}})[_0xbe31('0x21')](handleEntityNotFound(_0x57d200,null))[_0xbe31('0x21')](function(_0x82d4cc){_0x2d8a0f['contact']=_0x82d4cc;if(_0x82d4cc){var _0x5b201c={'ContactId':_0x82d4cc['id'],'OpenchannelAccountId':_0x21f8bf[_0xbe31('0x5b')]['id'],'from':(_0x82d4cc[_0xbe31('0x8f')]||'')+'\x20'+(_0x82d4cc[_0xbe31('0x90')]||'')};var _0x2adf8b={'OpenchannelAccountId':_0x21f8bf['params']['id'],'closed':![]};if(_0x21f8bf['body'][_0xbe31('0x91')]){_0x2adf8b[_0xbe31('0x91')]=_0x21f8bf[_0xbe31('0x5e')][_0xbe31('0x91')];return db[_0xbe31('0x92')]['find']({'where':_0x2adf8b})[_0xbe31('0x21')](function(_0x36df5d){if(_0x36df5d){return[_0x36df5d,![]];}_0x5b201c[_0xbe31('0x91')]=_0x21f8bf[_0xbe31('0x5e')][_0xbe31('0x91')];_0x5b201c[_0xbe31('0x93')]=_0x21f8bf[_0xbe31('0x5e')][_0xbe31('0x93')];return db[_0xbe31('0x92')]['create'](_0x5b201c)[_0xbe31('0x21')](function(_0xb3ae2b){return[_0xb3ae2b,!![]];});});}else{_0x2adf8b[_0xbe31('0x91')]=null;}_0x2adf8b[_0xbe31('0x94')]=_0x82d4cc['id'];return db[_0xbe31('0x92')][_0xbe31('0x5c')]({'where':_0x2adf8b})[_0xbe31('0x21')](function(_0x257559){if(_0x257559){return[_0x257559,![]];}return db['OpenchannelInteraction'][_0xbe31('0x5d')](_0x5b201c)[_0xbe31('0x21')](function(_0x42bbe9){return[_0x42bbe9,!![]];});});}})[_0xbe31('0x95')](function(_0x57d324,_0x213488){if(_0x57d324){_0x17a3b0=_0x213488;if(!_0x213488){var _0x330572={'from':(_0x2d8a0f[_0xbe31('0x96')][_0xbe31('0x8f')]||'')+'\x20'+(_0x2d8a0f[_0xbe31('0x96')][_0xbe31('0x90')]||'')};if(_0x21f8bf['body']['threadId']&&_0x21f8bf[_0xbe31('0x5e')][_0xbe31('0x97')]&&_0x21f8bf[_0xbe31('0x5e')][_0xbe31('0x91')]!=_0x21f8bf[_0xbe31('0x5e')][_0xbe31('0x97')]){_0x330572[_0xbe31('0x91')]=_0x21f8bf[_0xbe31('0x5e')][_0xbe31('0x97')];}return _0x57d324[_0xbe31('0x65')](_0x330572);}else{return _0x57d324;}}})[_0xbe31('0x21')](function(_0x5802a9){_0x2d8a0f[_0xbe31('0x98')]=_0x5802a9[_0xbe31('0x38')]({'plain':!![]});_0x2d8a0f[_0xbe31('0x98')][_0xbe31('0x99')]=_0x17a3b0;if(_0x2d8a0f['interaction']['created']){if(_0x2d8a0f['account'][_0xbe31('0x9a')]){_0x2d8a0f[_0xbe31('0x8d')][_0xbe31('0x9b')]({'id':0x0,'priority':_0x2d8a0f[_0xbe31('0x8d')][_0xbe31('0x4c')]+0x1,'app':_0xbe31('0x9c'),'appdata':_0xbe31('0x9d'),'interval':_0xbe31('0x9e')});}}return db[_0xbe31('0x9f')]['create']({'body':_0x21f8bf[_0xbe31('0x5e')][_0xbe31('0x5e')],'OpenchannelAccountId':_0x21f8bf['params']['id'],'OpenchannelInteractionId':_0x5802a9['id'],'direction':'in','ContactId':_0x2d8a0f[_0xbe31('0x96')]['id'],'AttachmentId':_0x21f8bf[_0xbe31('0x5e')][_0xbe31('0xa0')]});})[_0xbe31('0x21')](function(_0x1ea752){_0x2d8a0f[_0xbe31('0x28')]=_0x1ea752;if(_0x2d8a0f[_0xbe31('0x98')][_0xbe31('0xa1')]){return db[_0xbe31('0xa2')]['find']({'attributes':['id',_0xbe31('0x3c')],'where':{'id':_0x2d8a0f[_0xbe31('0x98')][_0xbe31('0xa1')]}})[_0xbe31('0x21')](function(_0x494f07){if(_0x494f07){_0x2d8a0f['applications'][_0xbe31('0xa3')]({'id':0x0,'priority':0x0,'app':_0xbe31('0xa4'),'appdata':_0x494f07[_0xbe31('0x3c')]+','+(_0x2d8a0f[_0xbe31('0x8b')]['waitForTheAssignedAgent']||0xa),'interval':_0xbe31('0x9e')});_0x2d8a0f[_0xbe31('0xa5')]=![];}return respondWithRpcPromise(_0xbe31('0xa6'),'startRouting',_0x2d8a0f);});}return respondWithRpcPromise(_0xbe31('0xa6'),_0xbe31('0xa7'),_0x2d8a0f);})[_0xbe31('0x21')](function(_0x3a057a){respondWithRpcPromise('EventManager',_0xbe31('0xa8'),{'event':_0xbe31('0x73'),'message':_0x3a057a},client9002);return _0x3a057a;})['then'](respondWithResult(_0x57d200,null))[_0xbe31('0x2b')](handleError(_0x57d200,null));};exports[_0xbe31('0xa9')]=function(_0x4b6e94,_0x32677a,_0x22cc97){return db[_0xbe31('0x41')]['findOne']({'where':{'id':_0x4b6e94['params']['id']}})[_0xbe31('0x21')](handleEntityNotFound(_0x32677a,null))[_0xbe31('0x21')](function(_0x37eda4){if(_0x37eda4){return db[_0xbe31('0xaa')][_0xbe31('0xab')](function(_0x3a6044){return db[_0xbe31('0x89')]['destroy']({'where':{'OpenchannelAccountId':_0x4b6e94['params']['id']},'transaction':_0x3a6044})[_0xbe31('0x21')](function(_0x405288){var _0x106bfe=_[_0xbe31('0x40')](_0x4b6e94[_0xbe31('0x5e')],function(_0xcfecf1){_0xcfecf1[_0xbe31('0x6a')]=_0x4b6e94[_0xbe31('0x5b')]['id'];return _0xcfecf1;});return db[_0xbe31('0x89')]['bulkCreate'](_0x106bfe,{'transaction':_0x3a6044});});})[_0xbe31('0x21')](function(){return db[_0xbe31('0x89')][_0xbe31('0xac')]({'where':{'OpenchannelAccountId':_0x4b6e94['params']['id']},'order':_0xbe31('0xad')});});}})[_0xbe31('0x21')](respondWithResult(_0x32677a,null))[_0xbe31('0x2b')](handleError(_0x32677a,null));};exports[_0xbe31('0xae')]=function(_0x2a4932,_0x3dd604,_0x5310da){var _0x573ddd={};var _0x12f8c4={};var _0x421273;var _0x4a1c7b;return db[_0xbe31('0x41')][_0xbe31('0x6e')]({'where':{'id':_0x2a4932['params']['id']}})[_0xbe31('0x21')](handleEntityNotFound(_0x3dd604,null))[_0xbe31('0x21')](function(_0x4a9924){if(_0x4a9924){_0x421273=_0x4a9924;_0x12f8c4[_0xbe31('0x48')]=_[_0xbe31('0x45')](db[_0xbe31('0x89')]['rawAttributes']);_0x12f8c4[_0xbe31('0x4b')]=_['keys'](_0x2a4932[_0xbe31('0x4b')]);_0x12f8c4[_0xbe31('0x46')]=_[_0xbe31('0x47')](_0x12f8c4['model'],_0x12f8c4['query']);_0x573ddd['attributes']=_['intersection'](_0x12f8c4[_0xbe31('0x48')],qs[_0xbe31('0x4a')](_0x2a4932[_0xbe31('0x4b')][_0xbe31('0x4a')]));_0x573ddd[_0xbe31('0x49')]=_0x573ddd['attributes']['length']?_0x573ddd['attributes']:_0x12f8c4[_0xbe31('0x48')];_0x573ddd[_0xbe31('0x4f')]=qs[_0xbe31('0x50')](_0x2a4932[_0xbe31('0x4b')][_0xbe31('0x50')]);_0x573ddd[_0xbe31('0x51')]=qs[_0xbe31('0x46')](_['pick'](_0x2a4932[_0xbe31('0x4b')],_0x12f8c4[_0xbe31('0x46')]));if(_0x2a4932[_0xbe31('0x4b')]['filter']){_0x573ddd['where']=_['merge'](_0x573ddd['where'],{'$or':_[_0xbe31('0x40')](_0x573ddd[_0xbe31('0x49')],function(_0x93eed1){var _0xb5c061={};_0xb5c061[_0x93eed1]={'$like':'%'+_0x2a4932['query'][_0xbe31('0x52')]+'%'};return _0xb5c061;})});}_0x573ddd=_[_0xbe31('0x53')]({},_0x573ddd,_0x2a4932['options']);return _0x421273['getApplications'](_0x573ddd);}})[_0xbe31('0x21')](function(_0xa42a19){if(_0xa42a19){_0x4a1c7b=_0xa42a19['length'];if(!_0x2a4932[_0xbe31('0x4b')][_0xbe31('0x4d')](_0xbe31('0x4e'))){_0x573ddd['limit']=qs[_0xbe31('0x31')](_0x2a4932['query'][_0xbe31('0x31')]);_0x573ddd[_0xbe31('0x30')]=qs[_0xbe31('0x30')](_0x2a4932[_0xbe31('0x4b')][_0xbe31('0x30')]);}return _0x421273['getApplications'](_0x573ddd);}})[_0xbe31('0x21')](function(_0x368be7){if(_0x368be7){return _0x368be7?{'count':_0x4a1c7b,'rows':_0x368be7}:null;}})[_0xbe31('0x21')](respondWithResult(_0x3dd604,null))[_0xbe31('0x2b')](handleError(_0x3dd604,null));};exports['getInteractions']=function(_0x1f6e43,_0x58053e,_0x59dbf7){var _0x3af6cd={'raw':![],'where':{}};var _0x17ef90={};var _0x33557d={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xbe31('0x6e')]({'where':{'id':_0x1f6e43[_0xbe31('0x5b')]['id']}})['then'](handleEntityNotFound(_0x58053e,null))[_0xbe31('0x21')](function(_0x2c11b9){if(_0x2c11b9){_0x17ef90[_0xbe31('0x48')]=_[_0xbe31('0x45')](db[_0xbe31('0x92')][_0xbe31('0x42')]);_0x17ef90[_0xbe31('0x4b')]=_['keys'](_0x1f6e43[_0xbe31('0x4b')]);_0x17ef90[_0xbe31('0x46')]=_[_0xbe31('0x47')](_0x17ef90['model'],_0x17ef90['query']);_0x3af6cd[_0xbe31('0x49')]=_[_0xbe31('0x47')](_0x17ef90[_0xbe31('0x48')],qs[_0xbe31('0x4a')](_0x1f6e43[_0xbe31('0x4b')]['fields']));_0x3af6cd['attributes']=_0x3af6cd['attributes'][_0xbe31('0x4c')]?_0x3af6cd['attributes']:_0x17ef90[_0xbe31('0x48')];if(!_0x1f6e43[_0xbe31('0x4b')][_0xbe31('0x4d')](_0xbe31('0x4e'))){_0x3af6cd[_0xbe31('0x31')]=qs[_0xbe31('0x31')](_0x1f6e43[_0xbe31('0x4b')][_0xbe31('0x31')]);_0x3af6cd['offset']=qs[_0xbe31('0x30')](_0x1f6e43['query']['offset']);}_0x3af6cd[_0xbe31('0x4f')]=qs['sort'](_0x1f6e43[_0xbe31('0x4b')][_0xbe31('0x50')]);_0x3af6cd[_0xbe31('0x51')]=qs[_0xbe31('0x46')](_[_0xbe31('0x70')](_0x1f6e43[_0xbe31('0x4b')],_0x17ef90[_0xbe31('0x46')]));_0x3af6cd['where']['OpenchannelAccountId']=_0x2c11b9['id'];if(_0x1f6e43[_0xbe31('0x4b')]['filter']){_0x3af6cd[_0xbe31('0x51')]=_[_0xbe31('0x53')](_0x3af6cd[_0xbe31('0x51')],{'$or':_[_0xbe31('0x40')](_0x3af6cd[_0xbe31('0x49')],function(_0x2bad65){var _0x424c7b={};_0x424c7b[_0x2bad65]={'$like':'%'+_0x1f6e43[_0xbe31('0x4b')][_0xbe31('0x52')]+'%'};return _0x424c7b;})});}_0x3af6cd=_[_0xbe31('0x53')]({},_0x3af6cd,_0x1f6e43[_0xbe31('0x56')]);return db[_0xbe31('0x92')][_0xbe31('0x2f')]({'where':_0x3af6cd[_0xbe31('0x51')]})[_0xbe31('0x21')](function(_0x530bae){_0x33557d['count']=_0x530bae;if(_0x1f6e43[_0xbe31('0x4b')][_0xbe31('0x57')]){_0x3af6cd[_0xbe31('0x58')]=[{'model':db[_0xbe31('0x86')],'as':'Contact','required':![]},{'model':db[_0xbe31('0xa2')],'as':_0xbe31('0xaf'),'attributes':[_0xbe31('0x3c'),_0xbe31('0xb0'),_0xbe31('0xb1')],'required':![]},{'model':db['Tag'],'as':_0xbe31('0xb2'),'attributes':['id','name',_0xbe31('0xb3')],'where':_0x1f6e43[_0xbe31('0x4b')][_0xbe31('0xb4')]?{'id':_0x1f6e43['query'][_0xbe31('0xb4')]}:undefined,'required':_0x1f6e43['query'][_0xbe31('0xb4')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xbe31('0x59')](_0x3af6cd);})['then'](function(_0x66ff8){_0x33557d['rows']=_0x66ff8;return _0x33557d;});}})['then'](respondWithFilteredResult(_0x58053e,_0x3af6cd))[_0xbe31('0x2b')](handleError(_0x58053e,null));};exports[_0xbe31('0xb5')]=function(_0x284d7d,_0x245bf7,_0x4f96e3){return db[_0xbe31('0x41')][_0xbe31('0x5c')]({'where':{'id':_0x284d7d[_0xbe31('0x5b')]['id']}})[_0xbe31('0x21')](handleEntityNotFound(_0x245bf7,null))[_0xbe31('0x21')](function(_0x450d17){if(_0x450d17){return _0x450d17[_0xbe31('0xb5')](_0x284d7d['body']['ids'],_[_0xbe31('0xb6')](_0x284d7d['body'],[_0xbe31('0x6c'),'id'])||{})[_0xbe31('0x95')](function(_0xbf4ea2){for(var _0x55c9af=0x0;_0x55c9af<_0x284d7d[_0xbe31('0x5e')][_0xbe31('0x6c')]['length'];_0x55c9af+=0x1){socket[_0xbe31('0xb7')](_0xbe31('0xb8'),{'UserId':_0x284d7d[_0xbe31('0x5e')][_0xbe31('0x6c')][_0x55c9af],'OpenchannelAccountId':_0x284d7d[_0xbe31('0x5b')]['id']});}return _0xbf4ea2;});}})[_0xbe31('0x21')](respondWithResult(_0x245bf7,null))[_0xbe31('0x2b')](handleError(_0x245bf7,null));};exports[_0xbe31('0xb9')]=function(_0x55da9b,_0x119afa,_0x52aab7){return db[_0xbe31('0x41')]['find']({'where':{'id':_0x55da9b[_0xbe31('0x5b')]['id']}})[_0xbe31('0x21')](handleEntityNotFound(_0x119afa,null))[_0xbe31('0x21')](function(_0x388c07){if(_0x388c07){return _0x388c07[_0xbe31('0xb9')](_0x55da9b[_0xbe31('0x4b')][_0xbe31('0x6c')])['then'](function(){if(_[_0xbe31('0xba')](_0x55da9b[_0xbe31('0x4b')][_0xbe31('0x6c')])){for(var _0x16562b=0x0;_0x16562b<_0x55da9b[_0xbe31('0x4b')][_0xbe31('0x6c')][_0xbe31('0x4c')];_0x16562b+=0x1){socket['emit'](_0xbe31('0xbb'),{'UserId':Number(_0x55da9b['query'][_0xbe31('0x6c')][_0x16562b]),'OpenchannelAccountId':Number(_0x55da9b['params']['id'])});}}else{socket[_0xbe31('0xb7')](_0xbe31('0xbb'),{'UserId':Number(_0x55da9b[_0xbe31('0x4b')][_0xbe31('0x6c')]),'OpenchannelAccountId':Number(_0x55da9b['params']['id'])});}});}})[_0xbe31('0x21')](respondWithStatusCode(_0x119afa,null))[_0xbe31('0x2b')](handleError(_0x119afa,null));};exports['getAgents']=function(_0x569aa4,_0xeebcfc,_0x338e11){var _0x3210a8={};var _0xa609bd={};var _0x16af3b;var _0x3205ba;return db[_0xbe31('0x41')][_0xbe31('0x6e')]({'where':{'id':_0x569aa4[_0xbe31('0x5b')]['id']}})[_0xbe31('0x21')](handleEntityNotFound(_0xeebcfc,null))[_0xbe31('0x21')](function(_0x19a0f8){if(_0x19a0f8){_0x16af3b=_0x19a0f8;_0xa609bd[_0xbe31('0x48')]=_[_0xbe31('0x45')](db[_0xbe31('0xa2')][_0xbe31('0x42')]);_0xa609bd[_0xbe31('0x4b')]=_[_0xbe31('0x45')](_0x569aa4[_0xbe31('0x4b')]);_0xa609bd[_0xbe31('0x46')]=_[_0xbe31('0x47')](_0xa609bd[_0xbe31('0x48')],_0xa609bd['query']);_0x3210a8[_0xbe31('0x49')]=_[_0xbe31('0x47')](_0xa609bd[_0xbe31('0x48')],qs[_0xbe31('0x4a')](_0x569aa4[_0xbe31('0x4b')][_0xbe31('0x4a')]));_0x3210a8[_0xbe31('0x49')]=_0x3210a8[_0xbe31('0x49')][_0xbe31('0x4c')]?_0x3210a8[_0xbe31('0x49')]:_0xa609bd[_0xbe31('0x48')];_0x3210a8[_0xbe31('0x4f')]=qs[_0xbe31('0x50')](_0x569aa4[_0xbe31('0x4b')][_0xbe31('0x50')]);_0x3210a8[_0xbe31('0x51')]=qs[_0xbe31('0x46')](_[_0xbe31('0x70')](_0x569aa4[_0xbe31('0x4b')],_0xa609bd[_0xbe31('0x46')]));if(_0x569aa4['query'][_0xbe31('0x52')]){_0x3210a8[_0xbe31('0x51')]=_[_0xbe31('0x53')](_0x3210a8[_0xbe31('0x51')],{'$or':_[_0xbe31('0x40')](_0x3210a8[_0xbe31('0x49')],function(_0x5688d1){var _0xa6c77a={};_0xa6c77a[_0x5688d1]={'$like':'%'+_0x569aa4[_0xbe31('0x4b')][_0xbe31('0x52')]+'%'};return _0xa6c77a;})});}_0x3210a8=_[_0xbe31('0x53')]({},_0x3210a8,_0x569aa4[_0xbe31('0x56')]);return _0x16af3b[_0xbe31('0xbc')](_0x3210a8);}})[_0xbe31('0x21')](function(_0x11908c){if(_0x11908c){_0x3205ba=_0x11908c[_0xbe31('0x4c')];if(!_0x569aa4[_0xbe31('0x4b')][_0xbe31('0x4d')]('nolimit')){_0x3210a8[_0xbe31('0x31')]=qs[_0xbe31('0x31')](_0x569aa4[_0xbe31('0x4b')][_0xbe31('0x31')]);_0x3210a8[_0xbe31('0x30')]=qs[_0xbe31('0x30')](_0x569aa4[_0xbe31('0x4b')][_0xbe31('0x30')]);}return _0x16af3b[_0xbe31('0xbc')](_0x3210a8);}})[_0xbe31('0x21')](function(_0x3529f3){if(_0x3529f3){return _0x3529f3?{'count':_0x3205ba,'rows':_0x3529f3}:null;}})[_0xbe31('0x21')](respondWithResult(_0xeebcfc,null))['catch'](handleError(_0xeebcfc,null));};exports['send']=function(_0x4ce6bd,_0xda18c9,_0x1267a5){var _0x38a525,_0x132c0e,_0x1677c0;if(_[_0xbe31('0x7c')](_0x4ce6bd[_0xbe31('0x5e')]['body'])||_0x4ce6bd[_0xbe31('0x5e')][_0xbe31('0x5e')]===''){throw new db[(_0xbe31('0x75'))][(_0xbe31('0x76'))](_0xbe31('0x7f'));}if(_[_0xbe31('0x7c')](_0x4ce6bd[_0xbe31('0x5e')]['to'])){}_0x38a525=_0x4ce6bd[_0xbe31('0x5e')]['to'];return db[_0xbe31('0x41')][_0xbe31('0x6e')]({'where':{'id':_0x4ce6bd[_0xbe31('0x5b')]['id']}})[_0xbe31('0x21')](handleEntityNotFound(_0xda18c9,null))[_0xbe31('0x21')](function(_0x10e236){if(_0x10e236){return db[_0xbe31('0x41')][_0xbe31('0x5c')]({'where':{'id':_0x10e236['id']},'include':[{'model':db[_0xbe31('0x84')],'as':_0xbe31('0x85'),'include':[{'model':db[_0xbe31('0x86')],'as':_0xbe31('0x87'),'where':{[_0x10e236['mapKey']]:_0x38a525},'limit':0x1,'order':[['updatedAt',_0xbe31('0x88')]]}]}]})[_0xbe31('0x21')](handleEntityNotFound(_0xda18c9,null))['then'](function(_0x4d2dab){if(_0x4d2dab&&_0x4d2dab[_0xbe31('0x85')]){_0x132c0e=_0x4d2dab['get']({'plain':!![]});if(_0x132c0e[_0xbe31('0x85')]&&_0x132c0e[_0xbe31('0x85')][_0xbe31('0x87')][_0xbe31('0x4c')]){return _0x132c0e['List'][_0xbe31('0x87')][0x0];}return db[_0xbe31('0x86')]['create'](_['defaults'](_0x4ce6bd[_0xbe31('0x5e')],{'firstName':_0x38a525,[_0x4d2dab['mapKey']]:_0x38a525,'phone':_0x38a525,'ListId':_0x132c0e[_0xbe31('0x7b')]}));}})[_0xbe31('0x21')](handleEntityNotFound(_0xda18c9,null))['then'](function(_0x3edfef){if(_0x3edfef){_0x1677c0=_0x3edfef;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x1677c0['id'],'closed':![],'OpenchannelAccountId':_0x132c0e['id']}})[_0xbe31('0x21')](function(_0x6093fe){if(_0x6093fe){return[_0x6093fe,![]];}return db[_0xbe31('0x92')]['create']({'UserId':_0x4ce6bd[_0xbe31('0x5f')]['id'],'ContactId':_0x1677c0['id'],'OpenchannelAccountId':_0x132c0e['id'],'lastMsgDirection':'out','Messages':[_[_0xbe31('0x53')](_0x4ce6bd[_0xbe31('0x5e')],{'read':![],'body':_0x4ce6bd['body'][_0xbe31('0x5e')],'OpenchannelAccountId':_0x132c0e['id'],'UserId':_0x4ce6bd[_0xbe31('0x5f')]['id'],'ContactId':_0x1677c0['id']})]},{'include':[{'model':db[_0xbe31('0x9f')],'as':_0xbe31('0xbd')}]})['then'](function(_0xd1ff5c){return[_0xd1ff5c,!![]];});});}})[_0xbe31('0x95')](function(_0x3f4e27,_0x507181){if(_0x507181){return _0x3f4e27;}return db[_0xbe31('0x9f')][_0xbe31('0x5d')](_['merge'](_0x4ce6bd[_0xbe31('0x5e')],{'read':![],'body':_0x4ce6bd[_0xbe31('0x5e')][_0xbe31('0x5e')],'OpenchannelAccountId':_0x132c0e['id'],'OpenchannelInteractionId':_0x3f4e27['id'],'UserId':_0x4ce6bd[_0xbe31('0x5f')]['id'],'ContactId':_0x1677c0['id']}))[_0xbe31('0x21')](function(_0x54899a){_0x3f4e27[_0xbe31('0xbe')][_0xbe31('0xbd')]=[];_0x3f4e27['dataValues'][_0xbe31('0xbd')][_0xbe31('0x9b')](_0x54899a['dataValues']);return _0x3f4e27;});});}})[_0xbe31('0x21')](respondWithResult(_0xda18c9,null))[_0xbe31('0x2b')](handleError(_0xda18c9,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index eb34b81..4ba9cf0 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 _0xbbbd=['events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x4830fa,_0x6bc819){var _0x2f8d5b=function(_0x17704d){while(--_0x17704d){_0x4830fa['push'](_0x4830fa['shift']());}};_0x2f8d5b(++_0x6bc819);}(_0xbbbd,0x14a));var _0xdbbb=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xbbbd[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0xdbbb('0x0'));var OpenchannelAccount=require(_0xdbbb('0x1'))['db'][_0xdbbb('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xdbbb('0x3')](0x0);var events={'afterCreate':_0xdbbb('0x4'),'afterUpdate':_0xdbbb('0x5'),'afterDestroy':_0xdbbb('0x6')};function emitEvent(_0x1eef5b){return function(_0x5af5c0,_0x1deb52,_0x4c6c78){OpenchannelAccountEvents[_0xdbbb('0x7')](_0x1eef5b+':'+_0x5af5c0['id'],_0x5af5c0);OpenchannelAccountEvents[_0xdbbb('0x7')](_0x1eef5b,_0x5af5c0);_0x4c6c78(null);};}for(var e in events){if(events[_0xdbbb('0x8')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xdbbb('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xc1e4=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xc1e4,0x1bf));var _0x4c1e=function(_0x37a2ce,_0x79fe48){_0x37a2ce=_0x37a2ce-0x0;var _0x201ac3=_0xc1e4[_0x37a2ce];return _0x201ac3;};'use strict';var EventEmitter=require(_0x4c1e('0x0'));var OpenchannelAccount=require(_0x4c1e('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x4c1e('0x2')](0x0);var events={'afterCreate':_0x4c1e('0x3'),'afterUpdate':_0x4c1e('0x4'),'afterDestroy':_0x4c1e('0x5')};function emitEvent(_0x12c8f5){return function(_0x15991e,_0x43ac07,_0x5122f9){OpenchannelAccountEvents[_0x4c1e('0x6')](_0x12c8f5+':'+_0x15991e['id'],_0x15991e);OpenchannelAccountEvents['emit'](_0x12c8f5,_0x15991e);_0x5122f9(null);};}for(var e in events){if(events[_0x4c1e('0x7')](e)){var event=events[e];OpenchannelAccount[_0x4c1e('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index db68697..5593be7 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 _0x4b4a=['OpenchannelAccount','openchannel_accounts','lodash','util','api','moment','bluebird','path','../../config/environment','exports'];(function(_0x301883,_0x5d9868){var _0x25edf5=function(_0x5d2b2a){while(--_0x5d2b2a){_0x301883['push'](_0x301883['shift']());}};_0x25edf5(++_0x5d9868);}(_0x4b4a,0xde));var _0xa4b4=function(_0x512aa7,_0x2be0d9){_0x512aa7=_0x512aa7-0x0;var _0x952539=_0x4b4a[_0x512aa7];return _0x952539;};'use strict';var _=require(_0xa4b4('0x0'));var util=require(_0xa4b4('0x1'));var logger=require('../../config/logger')(_0xa4b4('0x2'));var moment=require(_0xa4b4('0x3'));var BPromise=require(_0xa4b4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa4b4('0x5'));var rimraf=require('rimraf');var config=require(_0xa4b4('0x6'));var attributes=require('./openchannelAccount.attributes');module[_0xa4b4('0x7')]=function(_0x3f2822,_0x1a0e37){return _0x3f2822['define'](_0xa4b4('0x8'),attributes,{'tableName':_0xa4b4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa971=['OpenchannelAccount','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define'];(function(_0x49f666,_0x54b2b1){var _0x3f66af=function(_0x467617){while(--_0x467617){_0x49f666['push'](_0x49f666['shift']());}};_0x3f66af(++_0x54b2b1);}(_0xa971,0xc4));var _0x1a97=function(_0x252617,_0x1ff002){_0x252617=_0x252617-0x0;var _0x401adf=_0xa971[_0x252617];return _0x401adf;};'use strict';var _=require(_0x1a97('0x0'));var util=require(_0x1a97('0x1'));var logger=require('../../config/logger')(_0x1a97('0x2'));var moment=require(_0x1a97('0x3'));var BPromise=require(_0x1a97('0x4'));var rp=require(_0x1a97('0x5'));var fs=require('fs');var path=require(_0x1a97('0x6'));var rimraf=require(_0x1a97('0x7'));var config=require(_0x1a97('0x8'));var attributes=require(_0x1a97('0x9'));module[_0x1a97('0xa')]=function(_0x3f2515,_0x15f12d){return _0x3f2515[_0x1a97('0xb')](_0x1a97('0xc'),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 a2cb49b..00e9a53 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 _0x7342=['debug','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x2e3581,_0x13582a){var _0x1ad521=function(_0x1ab747){while(--_0x1ab747){_0x2e3581['push'](_0x2e3581['shift']());}};_0x1ad521(++_0x13582a);}(_0x7342,0x1b6));var _0x2734=function(_0x36e09b,_0x28004b){_0x36e09b=_0x36e09b-0x0;var _0x35aa7a=_0x7342[_0x36e09b];return _0x35aa7a;};'use strict';var _=require(_0x2734('0x0'));var util=require(_0x2734('0x1'));var moment=require('moment');var BPromise=require(_0x2734('0x2'));var rs=require(_0x2734('0x3'));var fs=require('fs');var Redis=require(_0x2734('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2734('0x5'));var logger=require(_0x2734('0x6'))(_0x2734('0x7'));var config=require('../../config/environment');var jayson=require(_0x2734('0x8'));var client=jayson[_0x2734('0x9')][_0x2734('0xa')]({'port':0x232a});config[_0x2734('0xb')]=_['defaults'](config['redis'],{'host':_0x2734('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2734('0xb')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x1c3167,_0x243bed,_0x332088){return new BPromise(function(_0x4e78ed,_0xb191f9){return client[_0x2734('0xd')](_0x1c3167,_0x332088)[_0x2734('0xe')](function(_0x505c31){logger[_0x2734('0xf')](_0x2734('0x10'),_0x243bed,_0x2734('0x11'));logger[_0x2734('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x243bed,_0x2734('0x11'),JSON[_0x2734('0x13')](_0x505c31));if(_0x505c31[_0x2734('0x14')]){if(_0x505c31[_0x2734('0x14')]['code']===0x1f4){logger[_0x2734('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x243bed,_0x505c31[_0x2734('0x14')]['message']);return _0xb191f9(_0x505c31[_0x2734('0x14')][_0x2734('0x15')]);}logger[_0x2734('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x243bed,_0x505c31[_0x2734('0x14')][_0x2734('0x15')]);return _0x4e78ed(_0x505c31[_0x2734('0x14')][_0x2734('0x15')]);}else{logger[_0x2734('0xf')](_0x2734('0x10'),_0x243bed,_0x2734('0x11'));_0x4e78ed(_0x505c31[_0x2734('0x16')]['message']);}})[_0x2734('0x17')](function(_0x1f3b9e){logger[_0x2734('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x243bed,_0x1f3b9e);_0xb191f9(_0x1f3b9e);});});} \ No newline at end of file +var _0xb242=['info','result','lodash','../../config/utils','../../config/logger','jayson/promise','client','redis','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb242,0x167));var _0x2b24=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0xb242[_0x3cb6dc];return _0x47ec89;};'use strict';var _=require(_0x2b24('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('../../mysqldb')['db'];var utils=require(_0x2b24('0x1'));var logger=require(_0x2b24('0x2'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2b24('0x3'));var client=jayson[_0x2b24('0x4')]['http']({'port':0x232a});config[_0x2b24('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0xb57f2a,_0xae24cb,_0x2a7f9e){return new BPromise(function(_0x98172d,_0x34683e){return client[_0x2b24('0x6')](_0xb57f2a,_0x2a7f9e)[_0x2b24('0x7')](function(_0x495054){logger['info'](_0x2b24('0x8'),_0xae24cb,_0x2b24('0x9'));logger[_0x2b24('0xa')](_0x2b24('0xb'),_0xae24cb,_0x2b24('0x9'),JSON[_0x2b24('0xc')](_0x495054));if(_0x495054[_0x2b24('0xd')]){if(_0x495054[_0x2b24('0xd')]['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0xae24cb,_0x495054['error'][_0x2b24('0xe')]);return _0x34683e(_0x495054[_0x2b24('0xd')]['message']);}logger[_0x2b24('0xd')](_0x2b24('0x8'),_0xae24cb,_0x495054['error'][_0x2b24('0xe')]);return _0x98172d(_0x495054['error']['message']);}else{logger[_0x2b24('0xf')](_0x2b24('0x8'),_0xae24cb,_0x2b24('0x9'));_0x98172d(_0x495054[_0x2b24('0x10')][_0x2b24('0xe')]);}})['catch'](function(_0x33c666){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0xae24cb,_0x33c666);_0x34683e(_0x33c666);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 6f1e78b..0326ea8 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 _0x92a5=['openchannelAccount:','./openchannelAccount.events','save','remove','register'];(function(_0x3e60f6,_0x1f7517){var _0x493a0e=function(_0x4b6c03){while(--_0x4b6c03){_0x3e60f6['push'](_0x3e60f6['shift']());}};_0x493a0e(++_0x1f7517);}(_0x92a5,0x13c));var _0x592a=function(_0x133472,_0x267303){_0x133472=_0x133472-0x0;var _0x40e0bc=_0x92a5[_0x133472];return _0x40e0bc;};'use strict';var OpenchannelAccountEvents=require(_0x592a('0x0'));var events=[_0x592a('0x1'),_0x592a('0x2'),'update'];function createListener(_0x41a5ac,_0x2c9337){return function(_0x30b395){_0x2c9337['emit'](_0x41a5ac,_0x30b395);};}function removeListener(_0x295ee9,_0xa52d30){return function(){OpenchannelAccountEvents['removeListener'](_0x295ee9,_0xa52d30);};}exports[_0x592a('0x3')]=function(_0x324516){for(var _0x45bc8f=0x0,_0x80ea65=events['length'];_0x45bc8f<_0x80ea65;_0x45bc8f++){var _0x491b86=events[_0x45bc8f];var _0x2e4b04=createListener(_0x592a('0x4')+_0x491b86,_0x324516);OpenchannelAccountEvents['on'](_0x491b86,_0x2e4b04);}}; \ No newline at end of file +var _0xdff0=['emit','removeListener','length','openchannelAccount:'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xdff0,0x170));var _0x0dff=function(_0x25df08,_0x276804){_0x25df08=_0x25df08-0x0;var _0x443330=_0xdff0[_0x25df08];return _0x443330;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save','remove','update'];function createListener(_0x1e60c3,_0x42a2af){return function(_0x21c717){_0x42a2af[_0x0dff('0x0')](_0x1e60c3,_0x21c717);};}function removeListener(_0xae708e,_0x2ea7a3){return function(){OpenchannelAccountEvents[_0x0dff('0x1')](_0xae708e,_0x2ea7a3);};}exports['register']=function(_0x1f51a2){for(var _0x4599bb=0x0,_0x125b8e=events[_0x0dff('0x2')];_0x4599bb<_0x125b8e;_0x4599bb++){var _0x14abb2=events[_0x4599bb];var _0x51ffde=createListener(_0x0dff('0x3')+_0x14abb2,_0x1f51a2);OpenchannelAccountEvents['on'](_0x14abb2,_0x51ffde);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index f18c6f1..9dba0d9 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 _0x9047=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','update','delete','destroy','exports','multer','path'];(function(_0x410ddd,_0x47e663){var _0x21b854=function(_0x3c1991){while(--_0x3c1991){_0x410ddd['push'](_0x410ddd['shift']());}};_0x21b854(++_0x47e663);}(_0x9047,0xb9));var _0x7904=function(_0x4a05ba,_0x6d798c){_0x4a05ba=_0x4a05ba-0x0;var _0x57b4a5=_0x9047[_0x4a05ba];return _0x57b4a5;};'use strict';var multer=require(_0x7904('0x0'));var util=require('util');var path=require(_0x7904('0x1'));var timeout=require(_0x7904('0x2'));var express=require(_0x7904('0x3'));var router=express[_0x7904('0x4')]();var auth=require(_0x7904('0x5'));var interaction=require(_0x7904('0x6'));var config=require(_0x7904('0x7'));var controller=require('./openchannelApplication.controller');router[_0x7904('0x8')]('/',auth[_0x7904('0x9')](),controller[_0x7904('0xa')]);router['get'](_0x7904('0xb'),auth[_0x7904('0x9')](),controller['show']);router[_0x7904('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7904('0xb'),auth[_0x7904('0x9')](),controller[_0x7904('0xd')]);router[_0x7904('0xe')](_0x7904('0xb'),auth['isAuthenticated'](),controller[_0x7904('0xf')]);module[_0x7904('0x10')]=router; \ No newline at end of file +var _0xfd7e=['isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','../../components/interaction/service','../../config/environment','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd7e,0x1ca));var _0xefd7=function(_0x3e7dfa,_0x392712){_0x3e7dfa=_0x3e7dfa-0x0;var _0x106974=_0xfd7e[_0x3e7dfa];return _0x106974;};'use strict';var multer=require('multer');var util=require(_0xefd7('0x0'));var path=require('path');var timeout=require(_0xefd7('0x1'));var express=require(_0xefd7('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xefd7('0x3'));var config=require(_0xefd7('0x4'));var controller=require('./openchannelApplication.controller');router[_0xefd7('0x5')]('/',auth[_0xefd7('0x6')](),controller[_0xefd7('0x7')]);router[_0xefd7('0x5')](_0xefd7('0x8'),auth[_0xefd7('0x6')](),controller['show']);router[_0xefd7('0x9')]('/',auth[_0xefd7('0x6')](),controller[_0xefd7('0xa')]);router[_0xefd7('0xb')](_0xefd7('0x8'),auth['isAuthenticated'](),controller[_0xefd7('0xc')]);router[_0xefd7('0xd')](_0xefd7('0x8'),auth[_0xefd7('0x6')](),controller[_0xefd7('0xe')]);module[_0xefd7('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 4cf41c6..d9bfb7d 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 _0x1112=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x4d2169,_0x353eb9){var _0x52e417=function(_0x6df76e){while(--_0x6df76e){_0x4d2169['push'](_0x4d2169['shift']());}};_0x52e417(++_0x353eb9);}(_0x1112,0x174));var _0x2111=function(_0x43576f,_0x1356ed){_0x43576f=_0x43576f-0x0;var _0x4d2466=_0x1112[_0x43576f];return _0x4d2466;};'use strict';var Sequelize=require(_0x2111('0x0'));module[_0x2111('0x1')]={'priority':{'type':Sequelize[_0x2111('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2111('0x3')],'allowNull':![],'defaultValue':_0x2111('0x4')},'appdata':{'type':Sequelize[_0x2111('0x5')]()},'description':{'type':Sequelize[_0x2111('0x3')]},'interval':{'type':Sequelize[_0x2111('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x04c2=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x15a83d,_0xb6113c){var _0x1e083d=function(_0x556957){while(--_0x556957){_0x15a83d['push'](_0x15a83d['shift']());}};_0x1e083d(++_0xb6113c);}(_0x04c2,0x1ec));var _0x204c=function(_0x4da992,_0xed3a63){_0x4da992=_0x4da992-0x0;var _0x4a9456=_0x04c2[_0x4da992];return _0x4a9456;};'use strict';var Sequelize=require(_0x204c('0x0'));module[_0x204c('0x1')]={'priority':{'type':Sequelize[_0x204c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x204c('0x3')],'allowNull':![],'defaultValue':_0x204c('0x4')},'appdata':{'type':Sequelize[_0x204c('0x5')]()},'description':{'type':Sequelize[_0x204c('0x3')]},'interval':{'type':Sequelize[_0x204c('0x3')],'defaultValue':_0x204c('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 5e9947d..de4d457 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 _0xa5d8=['rows','catch','params','intersection','length','create','body','update','find','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','OpenchannelApplication','fieldName','type','map','keys','query','filters','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x763fe8,_0xfff987){var _0x1766f3=function(_0x1adda4){while(--_0x1adda4){_0x763fe8['push'](_0x763fe8['shift']());}};_0x1766f3(++_0xfff987);}(_0xa5d8,0x1b9));var _0x8a5d=function(_0x5896fa,_0x1aef60){_0x5896fa=_0x5896fa-0x0;var _0x2f90eb=_0xa5d8[_0x5896fa];return _0x2f90eb;};'use strict';var pdf=require(_0x8a5d('0x0'));var emlformat=require(_0x8a5d('0x1'));var rimraf=require(_0x8a5d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8a5d('0x3'));var rp=require('request-promise');var moment=require(_0x8a5d('0x4'));var BPromise=require(_0x8a5d('0x5'));var Mustache=require('mustache');var util=require(_0x8a5d('0x6'));var path=require(_0x8a5d('0x7'));var sox=require(_0x8a5d('0x8'));var csv=require(_0x8a5d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8a5d('0xa'));var squel=require(_0x8a5d('0xb'));var crypto=require('crypto');var jsforce=require(_0x8a5d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8a5d('0x9'));var querystring=require(_0x8a5d('0xd'));var Papa=require(_0x8a5d('0xe'));var Redis=require(_0x8a5d('0xf'));var authService=require(_0x8a5d('0x10'));var qs=require(_0x8a5d('0x11'));var as=require(_0x8a5d('0x12'));var hardwareService=require(_0x8a5d('0x13'));var logger=require(_0x8a5d('0x14'))(_0x8a5d('0x15'));var utils=require('../../config/utils');var config=require(_0x8a5d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14c5e0,_0x2af0bd){_0x2af0bd=_0x2af0bd||0xcc;return function(_0x27505e){if(_0x27505e){return _0x14c5e0[_0x8a5d('0x17')](_0x2af0bd);}return _0x14c5e0[_0x8a5d('0x18')](_0x2af0bd)[_0x8a5d('0x19')]();};}function respondWithResult(_0x4fd587,_0x544432){_0x544432=_0x544432||0xc8;return function(_0x5193be){if(_0x5193be){return _0x4fd587[_0x8a5d('0x18')](_0x544432)[_0x8a5d('0x1a')](_0x5193be);}};}function respondWithFilteredResult(_0x3ad4ee,_0x1444b1){return function(_0x3d649f){if(_0x3d649f){var _0x1b838f=_0x3d649f[_0x8a5d('0x1b')],_0xc86ff5=_0x1444b1[_0x8a5d('0x1c')],_0x445680=_0x1444b1['offset']+_0x1444b1[_0x8a5d('0x1d')],_0x5e69df;if(_0x445680>=_0x1b838f){_0x445680=_0x1b838f;_0x5e69df=0xc8;}else{_0x5e69df=0xce;}_0x3ad4ee[_0x8a5d('0x18')](_0x5e69df);return _0x3ad4ee[_0x8a5d('0x1e')](_0x8a5d('0x1f'),_0xc86ff5+'-'+_0x445680+'/'+_0x1b838f)[_0x8a5d('0x1a')](_0x3d649f);}return null;};}function patchUpdates(_0x246a26){return function(_0x1ee1a4){try{jsonpatch[_0x8a5d('0x20')](_0x1ee1a4,_0x246a26,!![]);}catch(_0x258945){return BPromise[_0x8a5d('0x21')](_0x258945);}return _0x1ee1a4['save']();};}function saveUpdates(_0x2ec1c0,_0x4c1b4d){return function(_0x5d6547){if(_0x5d6547){return _0x5d6547['update'](_0x2ec1c0)[_0x8a5d('0x22')](function(_0x4161f9){return _0x4161f9;});}return null;};}function removeEntity(_0x3c0431,_0x5e4aa1){return function(_0x59d19b){if(_0x59d19b){return _0x59d19b[_0x8a5d('0x23')]()[_0x8a5d('0x22')](function(){_0x3c0431[_0x8a5d('0x18')](0xcc)[_0x8a5d('0x19')]();});}};}function handleEntityNotFound(_0x1ee46b,_0x125999){return function(_0x48e650){if(!_0x48e650){_0x1ee46b['sendStatus'](0x194);}return _0x48e650;};}function handleError(_0x13d058,_0x3e05af){_0x3e05af=_0x3e05af||0x1f4;return function(_0xb69726){logger[_0x8a5d('0x24')](_0xb69726[_0x8a5d('0x25')]);if(_0xb69726[_0x8a5d('0x26')]){delete _0xb69726[_0x8a5d('0x26')];}_0x13d058[_0x8a5d('0x18')](_0x3e05af)[_0x8a5d('0x27')](_0xb69726);};}exports[_0x8a5d('0x28')]=function(_0xb1cfa3,_0x4c3467){var _0x59e2ba={},_0x2ae962={},_0x2d8f0e={'count':0x0,'rows':[]};var _0x4cf187=_['map'](db[_0x8a5d('0x29')]['rawAttributes'],function(_0xa00e54){return{'name':_0xa00e54[_0x8a5d('0x2a')],'type':_0xa00e54[_0x8a5d('0x2b')]['key']};});_0x2ae962['model']=_[_0x8a5d('0x2c')](_0x4cf187,'name');_0x2ae962['query']=_[_0x8a5d('0x2d')](_0xb1cfa3[_0x8a5d('0x2e')]);_0x2ae962[_0x8a5d('0x2f')]=_['intersection'](_0x2ae962['model'],_0x2ae962['query']);_0x59e2ba[_0x8a5d('0x30')]=_['intersection'](_0x2ae962[_0x8a5d('0x31')],qs[_0x8a5d('0x32')](_0xb1cfa3[_0x8a5d('0x2e')][_0x8a5d('0x32')]));_0x59e2ba['attributes']=_0x59e2ba['attributes']['length']?_0x59e2ba['attributes']:_0x2ae962['model'];if(!_0xb1cfa3[_0x8a5d('0x2e')][_0x8a5d('0x33')](_0x8a5d('0x34'))){_0x59e2ba[_0x8a5d('0x1d')]=qs[_0x8a5d('0x1d')](_0xb1cfa3[_0x8a5d('0x2e')][_0x8a5d('0x1d')]);_0x59e2ba[_0x8a5d('0x1c')]=qs[_0x8a5d('0x1c')](_0xb1cfa3[_0x8a5d('0x2e')]['offset']);}_0x59e2ba['order']=qs[_0x8a5d('0x35')](_0xb1cfa3[_0x8a5d('0x2e')][_0x8a5d('0x35')]);_0x59e2ba[_0x8a5d('0x36')]=qs[_0x8a5d('0x2f')](_[_0x8a5d('0x37')](_0xb1cfa3[_0x8a5d('0x2e')],_0x2ae962[_0x8a5d('0x2f')]),_0x4cf187);if(_0xb1cfa3[_0x8a5d('0x2e')][_0x8a5d('0x38')]){_0x59e2ba[_0x8a5d('0x36')]=_[_0x8a5d('0x39')](_0x59e2ba['where'],{'$or':_['map'](_0x4cf187,function(_0x5294f8){if(_0x5294f8[_0x8a5d('0x2b')]!==_0x8a5d('0x3a')){var _0x516ba8={};_0x516ba8[_0x5294f8['name']]={'$like':'%'+_0xb1cfa3[_0x8a5d('0x2e')]['filter']+'%'};return _0x516ba8;}})});}_0x59e2ba=_[_0x8a5d('0x39')]({},_0x59e2ba,_0xb1cfa3[_0x8a5d('0x3b')]);var _0x57a024={'where':_0x59e2ba[_0x8a5d('0x36')]};return db['OpenchannelApplication'][_0x8a5d('0x1b')](_0x57a024)['then'](function(_0x24519f){_0x2d8f0e['count']=_0x24519f;if(_0xb1cfa3[_0x8a5d('0x2e')][_0x8a5d('0x3c')]){_0x59e2ba[_0x8a5d('0x3d')]=[{'all':!![]}];}return db[_0x8a5d('0x29')][_0x8a5d('0x3e')](_0x59e2ba);})[_0x8a5d('0x22')](function(_0x456bbb){_0x2d8f0e[_0x8a5d('0x3f')]=_0x456bbb;return _0x2d8f0e;})[_0x8a5d('0x22')](respondWithFilteredResult(_0x4c3467,_0x59e2ba))[_0x8a5d('0x40')](handleError(_0x4c3467,null));};exports['show']=function(_0x3fe969,_0x5bd557){var _0x3a1b02={'raw':!![],'where':{'id':_0x3fe969[_0x8a5d('0x41')]['id']}},_0x358f52={};_0x358f52[_0x8a5d('0x31')]=_[_0x8a5d('0x2d')](db[_0x8a5d('0x29')]['rawAttributes']);_0x358f52[_0x8a5d('0x2e')]=_['keys'](_0x3fe969[_0x8a5d('0x2e')]);_0x358f52[_0x8a5d('0x2f')]=_['intersection'](_0x358f52[_0x8a5d('0x31')],_0x358f52[_0x8a5d('0x2e')]);_0x3a1b02[_0x8a5d('0x30')]=_[_0x8a5d('0x42')](_0x358f52[_0x8a5d('0x31')],qs[_0x8a5d('0x32')](_0x3fe969[_0x8a5d('0x2e')]['fields']));_0x3a1b02[_0x8a5d('0x30')]=_0x3a1b02[_0x8a5d('0x30')][_0x8a5d('0x43')]?_0x3a1b02[_0x8a5d('0x30')]:_0x358f52['model'];if(_0x3fe969[_0x8a5d('0x2e')][_0x8a5d('0x3c')]){_0x3a1b02[_0x8a5d('0x3d')]=[{'all':!![]}];}_0x3a1b02=_[_0x8a5d('0x39')]({},_0x3a1b02,_0x3fe969[_0x8a5d('0x3b')]);return db[_0x8a5d('0x29')]['find'](_0x3a1b02)[_0x8a5d('0x22')](handleEntityNotFound(_0x5bd557,null))[_0x8a5d('0x22')](respondWithResult(_0x5bd557,null))[_0x8a5d('0x40')](handleError(_0x5bd557,null));};exports[_0x8a5d('0x44')]=function(_0x5c4ea8,_0x21cde2){return db['OpenchannelApplication'][_0x8a5d('0x44')](_0x5c4ea8[_0x8a5d('0x45')],{})[_0x8a5d('0x22')](respondWithResult(_0x21cde2,0xc9))['catch'](handleError(_0x21cde2,null));};exports[_0x8a5d('0x46')]=function(_0x4a1a71,_0x5e30a0){if(_0x4a1a71[_0x8a5d('0x45')]['id']){delete _0x4a1a71[_0x8a5d('0x45')]['id'];}return db[_0x8a5d('0x29')][_0x8a5d('0x47')]({'where':{'id':_0x4a1a71[_0x8a5d('0x41')]['id']}})[_0x8a5d('0x22')](handleEntityNotFound(_0x5e30a0,null))['then'](saveUpdates(_0x4a1a71[_0x8a5d('0x45')],null))['then'](respondWithResult(_0x5e30a0,null))[_0x8a5d('0x40')](handleError(_0x5e30a0,null));};exports[_0x8a5d('0x23')]=function(_0x81b748,_0x4e2286){return db[_0x8a5d('0x29')][_0x8a5d('0x47')]({'where':{'id':_0x81b748[_0x8a5d('0x41')]['id']}})[_0x8a5d('0x22')](handleEntityNotFound(_0x4e2286,null))[_0x8a5d('0x22')](removeEntity(_0x4e2286,null))['catch'](handleError(_0x4e2286,null));}; \ No newline at end of file +var _0xcfd1=['update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','rawAttributes','options','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save'];(function(_0x325a84,_0x1648ab){var _0x5bef97=function(_0x114a4e){while(--_0x114a4e){_0x325a84['push'](_0x325a84['shift']());}};_0x5bef97(++_0x1648ab);}(_0xcfd1,0x134));var _0x1cfd=function(_0x11b12d,_0x292ed8){_0x11b12d=_0x11b12d-0x0;var _0x3d1327=_0xcfd1[_0x11b12d];return _0x3d1327;};'use strict';var pdf=require(_0x1cfd('0x0'));var emlformat=require(_0x1cfd('0x1'));var rimraf=require(_0x1cfd('0x2'));var zipdir=require(_0x1cfd('0x3'));var jsonpatch=require(_0x1cfd('0x4'));var rp=require('request-promise');var moment=require(_0x1cfd('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1cfd('0x6'));var path=require(_0x1cfd('0x7'));var sox=require(_0x1cfd('0x8'));var csv=require(_0x1cfd('0x9'));var ejs=require(_0x1cfd('0xa'));var fs=require('fs');var _=require(_0x1cfd('0xb'));var squel=require('squel');var crypto=require(_0x1cfd('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1cfd('0x9'));var querystring=require(_0x1cfd('0xd'));var Papa=require(_0x1cfd('0xe'));var Redis=require(_0x1cfd('0xf'));var authService=require(_0x1cfd('0x10'));var qs=require(_0x1cfd('0x11'));var as=require(_0x1cfd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1cfd('0x13'))(_0x1cfd('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1cfd('0x15'))['db'];function respondWithStatusCode(_0x40a16f,_0x13dd9f){_0x13dd9f=_0x13dd9f||0xcc;return function(_0x25e46c){if(_0x25e46c){return _0x40a16f[_0x1cfd('0x16')](_0x13dd9f);}return _0x40a16f[_0x1cfd('0x17')](_0x13dd9f)[_0x1cfd('0x18')]();};}function respondWithResult(_0x2addb2,_0x587d0b){_0x587d0b=_0x587d0b||0xc8;return function(_0x1d4aa2){if(_0x1d4aa2){return _0x2addb2[_0x1cfd('0x17')](_0x587d0b)['json'](_0x1d4aa2);}};}function respondWithFilteredResult(_0x3fe240,_0x46f8e8){return function(_0xf56273){if(_0xf56273){var _0x163c96=_0xf56273[_0x1cfd('0x19')],_0x4cd580=_0x46f8e8['offset'],_0x1393c9=_0x46f8e8[_0x1cfd('0x1a')]+_0x46f8e8[_0x1cfd('0x1b')],_0x220be3;if(_0x1393c9>=_0x163c96){_0x1393c9=_0x163c96;_0x220be3=0xc8;}else{_0x220be3=0xce;}_0x3fe240[_0x1cfd('0x17')](_0x220be3);return _0x3fe240['set'](_0x1cfd('0x1c'),_0x4cd580+'-'+_0x1393c9+'/'+_0x163c96)['json'](_0xf56273);}return null;};}function patchUpdates(_0x20130b){return function(_0x3d09d7){try{jsonpatch[_0x1cfd('0x1d')](_0x3d09d7,_0x20130b,!![]);}catch(_0x1efadb){return BPromise[_0x1cfd('0x1e')](_0x1efadb);}return _0x3d09d7[_0x1cfd('0x1f')]();};}function saveUpdates(_0x396343,_0x29659d){return function(_0x593b12){if(_0x593b12){return _0x593b12[_0x1cfd('0x20')](_0x396343)[_0x1cfd('0x21')](function(_0x35c99a){return _0x35c99a;});}return null;};}function removeEntity(_0x27aaf6,_0x15bb9b){return function(_0x5dfdaf){if(_0x5dfdaf){return _0x5dfdaf[_0x1cfd('0x22')]()[_0x1cfd('0x21')](function(){_0x27aaf6[_0x1cfd('0x17')](0xcc)[_0x1cfd('0x18')]();});}};}function handleEntityNotFound(_0x221878,_0x5f13d8){return function(_0x248d80){if(!_0x248d80){_0x221878[_0x1cfd('0x16')](0x194);}return _0x248d80;};}function handleError(_0x5f22bf,_0x53fa18){_0x53fa18=_0x53fa18||0x1f4;return function(_0x388f87){logger[_0x1cfd('0x23')](_0x388f87[_0x1cfd('0x24')]);if(_0x388f87[_0x1cfd('0x25')]){delete _0x388f87['name'];}_0x5f22bf[_0x1cfd('0x17')](_0x53fa18)[_0x1cfd('0x26')](_0x388f87);};}exports[_0x1cfd('0x27')]=function(_0x3ea6cc,_0xc41c95){var _0x2526c8={},_0x1d44b7={},_0x3bc958={'count':0x0,'rows':[]};var _0x356517=_[_0x1cfd('0x28')](db[_0x1cfd('0x29')]['rawAttributes'],function(_0x120115){return{'name':_0x120115[_0x1cfd('0x2a')],'type':_0x120115[_0x1cfd('0x2b')][_0x1cfd('0x2c')]};});_0x1d44b7[_0x1cfd('0x2d')]=_[_0x1cfd('0x28')](_0x356517,_0x1cfd('0x25'));_0x1d44b7[_0x1cfd('0x2e')]=_[_0x1cfd('0x2f')](_0x3ea6cc['query']);_0x1d44b7['filters']=_['intersection'](_0x1d44b7[_0x1cfd('0x2d')],_0x1d44b7[_0x1cfd('0x2e')]);_0x2526c8['attributes']=_[_0x1cfd('0x30')](_0x1d44b7['model'],qs[_0x1cfd('0x31')](_0x3ea6cc[_0x1cfd('0x2e')][_0x1cfd('0x31')]));_0x2526c8[_0x1cfd('0x32')]=_0x2526c8[_0x1cfd('0x32')][_0x1cfd('0x33')]?_0x2526c8[_0x1cfd('0x32')]:_0x1d44b7[_0x1cfd('0x2d')];if(!_0x3ea6cc[_0x1cfd('0x2e')]['hasOwnProperty']('nolimit')){_0x2526c8[_0x1cfd('0x1b')]=qs[_0x1cfd('0x1b')](_0x3ea6cc[_0x1cfd('0x2e')][_0x1cfd('0x1b')]);_0x2526c8[_0x1cfd('0x1a')]=qs[_0x1cfd('0x1a')](_0x3ea6cc[_0x1cfd('0x2e')]['offset']);}_0x2526c8['order']=qs[_0x1cfd('0x34')](_0x3ea6cc[_0x1cfd('0x2e')][_0x1cfd('0x34')]);_0x2526c8[_0x1cfd('0x35')]=qs['filters'](_['pick'](_0x3ea6cc[_0x1cfd('0x2e')],_0x1d44b7['filters']),_0x356517);if(_0x3ea6cc[_0x1cfd('0x2e')][_0x1cfd('0x36')]){_0x2526c8[_0x1cfd('0x35')]=_[_0x1cfd('0x37')](_0x2526c8[_0x1cfd('0x35')],{'$or':_['map'](_0x356517,function(_0x3ca953){if(_0x3ca953[_0x1cfd('0x2b')]!==_0x1cfd('0x38')){var _0x124744={};_0x124744[_0x3ca953[_0x1cfd('0x25')]]={'$like':'%'+_0x3ea6cc[_0x1cfd('0x2e')][_0x1cfd('0x36')]+'%'};return _0x124744;}})});}_0x2526c8=_[_0x1cfd('0x37')]({},_0x2526c8,_0x3ea6cc['options']);var _0x1ab5fc={'where':_0x2526c8[_0x1cfd('0x35')]};return db[_0x1cfd('0x29')][_0x1cfd('0x19')](_0x1ab5fc)[_0x1cfd('0x21')](function(_0x2c4a22){_0x3bc958['count']=_0x2c4a22;if(_0x3ea6cc[_0x1cfd('0x2e')][_0x1cfd('0x39')]){_0x2526c8[_0x1cfd('0x3a')]=[{'all':!![]}];}return db[_0x1cfd('0x29')][_0x1cfd('0x3b')](_0x2526c8);})[_0x1cfd('0x21')](function(_0x26c12c){_0x3bc958[_0x1cfd('0x3c')]=_0x26c12c;return _0x3bc958;})['then'](respondWithFilteredResult(_0xc41c95,_0x2526c8))['catch'](handleError(_0xc41c95,null));};exports['show']=function(_0x1d3f49,_0x1273be){var _0x2272ea={'raw':!![],'where':{'id':_0x1d3f49[_0x1cfd('0x3d')]['id']}},_0x5d77ed={};_0x5d77ed[_0x1cfd('0x2d')]=_['keys'](db[_0x1cfd('0x29')][_0x1cfd('0x3e')]);_0x5d77ed[_0x1cfd('0x2e')]=_[_0x1cfd('0x2f')](_0x1d3f49['query']);_0x5d77ed['filters']=_[_0x1cfd('0x30')](_0x5d77ed[_0x1cfd('0x2d')],_0x5d77ed[_0x1cfd('0x2e')]);_0x2272ea[_0x1cfd('0x32')]=_[_0x1cfd('0x30')](_0x5d77ed[_0x1cfd('0x2d')],qs[_0x1cfd('0x31')](_0x1d3f49[_0x1cfd('0x2e')][_0x1cfd('0x31')]));_0x2272ea['attributes']=_0x2272ea[_0x1cfd('0x32')][_0x1cfd('0x33')]?_0x2272ea['attributes']:_0x5d77ed[_0x1cfd('0x2d')];if(_0x1d3f49[_0x1cfd('0x2e')]['includeAll']){_0x2272ea[_0x1cfd('0x3a')]=[{'all':!![]}];}_0x2272ea=_[_0x1cfd('0x37')]({},_0x2272ea,_0x1d3f49[_0x1cfd('0x3f')]);return db[_0x1cfd('0x29')][_0x1cfd('0x40')](_0x2272ea)[_0x1cfd('0x21')](handleEntityNotFound(_0x1273be,null))['then'](respondWithResult(_0x1273be,null))[_0x1cfd('0x41')](handleError(_0x1273be,null));};exports[_0x1cfd('0x42')]=function(_0x523c44,_0x2261a1){return db[_0x1cfd('0x29')][_0x1cfd('0x42')](_0x523c44[_0x1cfd('0x43')],{})[_0x1cfd('0x21')](respondWithResult(_0x2261a1,0xc9))['catch'](handleError(_0x2261a1,null));};exports[_0x1cfd('0x20')]=function(_0x2a0873,_0x555fa1){if(_0x2a0873[_0x1cfd('0x43')]['id']){delete _0x2a0873['body']['id'];}return db['OpenchannelApplication'][_0x1cfd('0x40')]({'where':{'id':_0x2a0873[_0x1cfd('0x3d')]['id']}})[_0x1cfd('0x21')](handleEntityNotFound(_0x555fa1,null))[_0x1cfd('0x21')](saveUpdates(_0x2a0873[_0x1cfd('0x43')],null))[_0x1cfd('0x21')](respondWithResult(_0x555fa1,null))[_0x1cfd('0x41')](handleError(_0x555fa1,null));};exports[_0x1cfd('0x22')]=function(_0x1d1140,_0x103a35){return db[_0x1cfd('0x29')][_0x1cfd('0x40')]({'where':{'id':_0x1d1140['params']['id']}})[_0x1cfd('0x21')](handleEntityNotFound(_0x103a35,null))[_0x1cfd('0x21')](removeEntity(_0x103a35,null))[_0x1cfd('0x41')](handleError(_0x103a35,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index cc7419e..9d394b1 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 _0xd005=['./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x3782c2,_0x2e1007){var _0xa2fd92=function(_0x24d932){while(--_0x24d932){_0x3782c2['push'](_0x3782c2['shift']());}};_0xa2fd92(++_0x2e1007);}(_0xd005,0x1cc));var _0x5d00=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd005[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x5d00('0x0'));var util=require(_0x5d00('0x1'));var logger=require(_0x5d00('0x2'))(_0x5d00('0x3'));var moment=require(_0x5d00('0x4'));var BPromise=require('bluebird');var rp=require(_0x5d00('0x5'));var fs=require('fs');var path=require(_0x5d00('0x6'));var rimraf=require('rimraf');var config=require(_0x5d00('0x7'));var attributes=require(_0x5d00('0x8'));module[_0x5d00('0x9')]=function(_0x11e209,_0x464152){return _0x11e209[_0x5d00('0xa')](_0x5d00('0xb'),attributes,{'tableName':_0x5d00('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8a95=['rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x651f5f,_0x1733b0){var _0xeccb1b=function(_0x22a6bc){while(--_0x22a6bc){_0x651f5f['push'](_0x651f5f['shift']());}};_0xeccb1b(++_0x1733b0);}(_0x8a95,0x165));var _0x58a9=function(_0x61c36f,_0x57f97d){_0x61c36f=_0x61c36f-0x0;var _0x1c29d4=_0x8a95[_0x61c36f];return _0x1c29d4;};'use strict';var _=require(_0x58a9('0x0'));var util=require(_0x58a9('0x1'));var logger=require(_0x58a9('0x2'))('api');var moment=require(_0x58a9('0x3'));var BPromise=require(_0x58a9('0x4'));var rp=require(_0x58a9('0x5'));var fs=require('fs');var path=require(_0x58a9('0x6'));var rimraf=require(_0x58a9('0x7'));var config=require('../../config/environment');var attributes=require(_0x58a9('0x8'));module[_0x58a9('0x9')]=function(_0x4ab563,_0x4a1fbd){return _0x4ab563[_0x58a9('0xa')](_0x58a9('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x58a9('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 2feadfe..affeded 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x4c81ec,_0x3e72a1){var _0x5d215a=function(_0x371bac){while(--_0x371bac){_0x4c81ec['push'](_0x4c81ec['shift']());}};_0x5d215a(++_0x3e72a1);}(_0xb10b,0x12a));var _0xbb10=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0xb10b[_0x422be2];return _0x1b820e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index c0270c7..b996a28 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 _0xf45d=['download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','/:id','removeTags','exports','multer','path','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','getMessages','/:id/download'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xf45d,0x10b));var _0xdf45=function(_0x8d841c,_0x4aebe5){_0x8d841c=_0x8d841c-0x0;var _0xd84cbb=_0xf45d[_0x8d841c];return _0xd84cbb;};'use strict';var multer=require(_0xdf45('0x0'));var util=require('util');var path=require(_0xdf45('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdf45('0x2')]();var auth=require(_0xdf45('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xdf45('0x4'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0xdf45('0x5')](),controller[_0xdf45('0x6')]);router[_0xdf45('0x7')](_0xdf45('0x8'),auth[_0xdf45('0x5')](),controller[_0xdf45('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdf45('0xa')]);router['get']('/:id/messages',auth[_0xdf45('0x5')](),controller[_0xdf45('0xb')]);router[_0xdf45('0x7')](_0xdf45('0xc'),auth[_0xdf45('0x5')](),controller[_0xdf45('0xd')]);router[_0xdf45('0xe')]('/',auth[_0xdf45('0x5')](),controller[_0xdf45('0xf')]);router[_0xdf45('0xe')](_0xdf45('0x10'),auth[_0xdf45('0x5')](),controller[_0xdf45('0x11')]);router[_0xdf45('0xe')](_0xdf45('0x12'),auth['isAuthenticated'](),interaction[_0xdf45('0x13')](_0xdf45('0x14'),_0xdf45('0x15')),controller['addTags']);router[_0xdf45('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0xdf45('0x13')](_0xdf45('0x14'),_0xdf45('0x17')),controller[_0xdf45('0x18')]);router['delete'](_0xdf45('0x19'),auth['isAuthenticated'](),interaction[_0xdf45('0x13')](_0xdf45('0x14'),'openchannelinteraction:destroy'),controller['destroy']);router['delete'](_0xdf45('0x12'),auth[_0xdf45('0x5')](),controller[_0xdf45('0x1a')]);module[_0xdf45('0x1b')]=router; \ No newline at end of file +var _0x8d4f=['/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','openchannelinteraction:destroy','delete','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0x8d4f,0x1b2));var _0xf8d4=function(_0x1d73ab,_0x4db32c){_0x1d73ab=_0x1d73ab-0x0;var _0x2ed1df=_0x8d4f[_0x1d73ab];return _0x2ed1df;};'use strict';var multer=require(_0xf8d4('0x0'));var util=require(_0xf8d4('0x1'));var path=require(_0xf8d4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf8d4('0x3')]();var auth=require(_0xf8d4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf8d4('0x5'));var controller=require(_0xf8d4('0x6'));router[_0xf8d4('0x7')]('/',auth['isAuthenticated'](),controller[_0xf8d4('0x8')]);router[_0xf8d4('0x7')](_0xf8d4('0x9'),auth[_0xf8d4('0xa')](),controller[_0xf8d4('0xb')]);router[_0xf8d4('0x7')](_0xf8d4('0xc'),auth[_0xf8d4('0xa')](),controller[_0xf8d4('0xd')]);router[_0xf8d4('0x7')](_0xf8d4('0xe'),auth['isAuthenticated'](),controller[_0xf8d4('0xf')]);router[_0xf8d4('0x7')](_0xf8d4('0x10'),auth[_0xf8d4('0xa')](),controller[_0xf8d4('0x11')]);router[_0xf8d4('0x12')]('/',auth['isAuthenticated'](),controller[_0xf8d4('0x13')]);router['post'](_0xf8d4('0xe'),auth[_0xf8d4('0xa')](),controller[_0xf8d4('0x14')]);router['post'](_0xf8d4('0x15'),auth[_0xf8d4('0xa')](),interaction[_0xf8d4('0x16')](_0xf8d4('0x17'),_0xf8d4('0x18')),controller[_0xf8d4('0x19')]);router[_0xf8d4('0x1a')](_0xf8d4('0xc'),auth[_0xf8d4('0xa')](),interaction['tracked']('openchannel',_0xf8d4('0x1b')),controller[_0xf8d4('0x1c')]);router['delete'](_0xf8d4('0xc'),auth[_0xf8d4('0xa')](),interaction[_0xf8d4('0x16')](_0xf8d4('0x17'),_0xf8d4('0x1d')),controller['destroy']);router[_0xf8d4('0x1e')](_0xf8d4('0x15'),auth['isAuthenticated'](),controller['removeTags']);module[_0xf8d4('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index d62597c..d2ad4b6 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 _0xe8f2=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe8f2,0x144));var _0x2e8f=function(_0x31cb26,_0x3f2822){_0x31cb26=_0x31cb26-0x0;var _0x23b738=_0xe8f2[_0x31cb26];return _0x23b738;};'use strict';var Sequelize=require(_0x2e8f('0x0'));module[_0x2e8f('0x1')]={'closed':{'type':Sequelize[_0x2e8f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2e8f('0x3')]},'disposition':{'type':Sequelize[_0x2e8f('0x4')]},'note':{'type':Sequelize[_0x2e8f('0x4')]},'read1stAt':{'type':Sequelize[_0x2e8f('0x3')]},'threadId':{'type':Sequelize[_0x2e8f('0x4')]},'externalUrl':{'type':Sequelize[_0x2e8f('0x4')]},'lastMsgAt':{'type':Sequelize[_0x2e8f('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2e8f('0x5')]('in',_0x2e8f('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb4c9=['ENUM','out','BOOLEAN','DATE','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4c9,0x66));var _0x9b4c=function(_0x3c9534,_0x2ad486){_0x3c9534=_0x3c9534-0x0;var _0x5abf96=_0xb4c9[_0x3c9534];return _0x5abf96;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x9b4c('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9b4c('0x1')]},'disposition':{'type':Sequelize[_0x9b4c('0x2')]},'note':{'type':Sequelize[_0x9b4c('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x9b4c('0x2')]},'externalUrl':{'type':Sequelize[_0x9b4c('0x2')]},'lastMsgAt':{'type':Sequelize[_0x9b4c('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x9b4c('0x3')]('in',_0x9b4c('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x9b4c('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 1412d75..02677d2 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 _0x5f7c=['out','System','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','download','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','Users','map','fullname','TagIds','Tags','split','forEach','then','catch','OpenchannelInteraction','rawAttributes','fieldName','type','model','name','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','select','field','color','from','tools_tags','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_messages','openchannel_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','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)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','body','buildExpression','keys','some','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','push','show','includeAll','options','create','params','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','hasOwnProperty','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','count','include','findAll','rows','addTags','spread','emit','openchannelInteractionTags:save','removeTags','unix','root','server','files','join','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Attachment','Messages','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','direction'];(function(_0x569998,_0x361b8d){var _0x2f8256=function(_0x3354f1){while(--_0x3354f1){_0x569998['push'](_0x569998['shift']());}};_0x2f8256(++_0x361b8d);}(_0x5f7c,0xf8));var _0xc5f7=function(_0x3d7ae4,_0x486637){_0x3d7ae4=_0x3d7ae4-0x0;var _0x177486=_0x5f7c[_0x3d7ae4];return _0x177486;};'use strict';var pdf=require(_0xc5f7('0x0'));var emlformat=require(_0xc5f7('0x1'));var rimraf=require(_0xc5f7('0x2'));var zipdir=require(_0xc5f7('0x3'));var jsonpatch=require(_0xc5f7('0x4'));var rp=require(_0xc5f7('0x5'));var moment=require('moment');var BPromise=require(_0xc5f7('0x6'));var Mustache=require(_0xc5f7('0x7'));var util=require(_0xc5f7('0x8'));var path=require('path');var sox=require(_0xc5f7('0x9'));var csv=require(_0xc5f7('0xa'));var ejs=require(_0xc5f7('0xb'));var fs=require('fs');var _=require(_0xc5f7('0xc'));var squel=require(_0xc5f7('0xd'));var crypto=require('crypto');var jsforce=require(_0xc5f7('0xe'));var deskjs=require(_0xc5f7('0xf'));var toCsv=require(_0xc5f7('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc5f7('0x10'));var authService=require(_0xc5f7('0x11'));var qs=require(_0xc5f7('0x12'));var as=require(_0xc5f7('0x13'));var hardwareService=require(_0xc5f7('0x14'));var logger=require(_0xc5f7('0x15'))(_0xc5f7('0x16'));var utils=require(_0xc5f7('0x17'));var config=require(_0xc5f7('0x18'));var db=require(_0xc5f7('0x19'))['db'];config[_0xc5f7('0x1a')]=_[_0xc5f7('0x1b')](config[_0xc5f7('0x1a')],{'host':_0xc5f7('0x1c'),'port':0x18eb});var socket=require(_0xc5f7('0x1d'))(new Redis(config[_0xc5f7('0x1a')]));require('./openchannelInteraction.socket')[_0xc5f7('0x1e')](socket);function respondWithStatusCode(_0x3aad9a,_0x2e904c){_0x2e904c=_0x2e904c||0xcc;return function(_0x13b911){if(_0x13b911){return _0x3aad9a[_0xc5f7('0x1f')](_0x2e904c);}return _0x3aad9a[_0xc5f7('0x20')](_0x2e904c)[_0xc5f7('0x21')]();};}function respondWithResult(_0x48701b,_0x39459b){_0x39459b=_0x39459b||0xc8;return function(_0x595ae8){if(_0x595ae8){return _0x48701b[_0xc5f7('0x20')](_0x39459b)[_0xc5f7('0x22')](_0x595ae8);}};}function respondWithFilteredResult(_0xdbe33d,_0x4decea){return function(_0x116981){if(_0x116981){var _0x483179=_0x116981['count'],_0x2dc55f=_0x4decea['offset'],_0x3b655e=_0x4decea[_0xc5f7('0x23')]+_0x4decea[_0xc5f7('0x24')],_0x500d1a;if(_0x3b655e>=_0x483179){_0x3b655e=_0x483179;_0x500d1a=0xc8;}else{_0x500d1a=0xce;}_0xdbe33d[_0xc5f7('0x20')](_0x500d1a);return _0xdbe33d[_0xc5f7('0x25')](_0xc5f7('0x26'),_0x2dc55f+'-'+_0x3b655e+'/'+_0x483179)[_0xc5f7('0x22')](_0x116981);}return null;};}function patchUpdates(_0x3cb6c9){return function(_0x4f678a){try{jsonpatch[_0xc5f7('0x27')](_0x4f678a,_0x3cb6c9,!![]);}catch(_0x5748e8){return BPromise['reject'](_0x5748e8);}return _0x4f678a[_0xc5f7('0x28')]();};}function saveUpdates(_0x19669f,_0x16366e){return function(_0x2ec634){if(_0x2ec634){return _0x2ec634[_0xc5f7('0x29')](_0x19669f)['then'](function(_0x5a2746){return _0x5a2746;});}return null;};}function removeEntity(_0x3f0cf9,_0x31087f){return function(_0x33b170){if(_0x33b170){return _0x33b170[_0xc5f7('0x2a')]()['then'](function(){_0x3f0cf9[_0xc5f7('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b6706,_0xa84aad){return function(_0x1ac173){if(!_0x1ac173){_0x4b6706[_0xc5f7('0x1f')](0x194);}return _0x1ac173;};}function handleError(_0x4a9f43,_0x2c3cf8){_0x2c3cf8=_0x2c3cf8||0x1f4;return function(_0x2a52e7){logger['error'](_0x2a52e7['stack']);if(_0x2a52e7['name']){delete _0x2a52e7['name'];}_0x4a9f43[_0xc5f7('0x20')](_0x2c3cf8)['send'](_0x2a52e7);};}function getInteractionUsers(_0x528c35,_0x4dd72e){return new BPromise(function(_0x2f157c,_0x55190c){try{if(_0x4dd72e[_0x528c35['id']]){_0x528c35[_0xc5f7('0x2b')]=_[_0xc5f7('0x2c')](_0x4dd72e[_0x528c35['id']],function(_0x363ba6){return{'id':_0x363ba6['id'],'fullname':_0x363ba6[_0xc5f7('0x2d')]};});}}catch(_0x49daa7){_0x55190c(_0x49daa7);}_0x2f157c(_0x528c35);});}function getInteractionTags(_0x5c9690,_0x4c8041){return new BPromise(function(_0x4d680a,_0x240b7e){try{if(_0x5c9690[_0xc5f7('0x2e')]){_0x5c9690[_0xc5f7('0x2f')]=[];_0x5c9690[_0xc5f7('0x2e')][_0xc5f7('0x30')](',')[_0xc5f7('0x31')](function(_0x3731d1){_0x5c9690[_0xc5f7('0x2f')]['push'](_0x4c8041[_0x3731d1]);});}delete _0x5c9690[_0xc5f7('0x2e')];}catch(_0x4a53f7){_0x240b7e(_0x4a53f7);}_0x4d680a(_0x5c9690);});}function updateOpenchannelInteraction(_0x5df037,_0x2af42a,_0xa86fd5){return new BPromise(function(_0x47ec09,_0x315804){return getInteractionUsers(_0x5df037,_0xa86fd5)[_0xc5f7('0x32')](function(_0x3fd5a7){return getInteractionTags(_0x3fd5a7,_0x2af42a);})[_0xc5f7('0x32')](function(_0x1b652b){_0x47ec09(_0x1b652b);})[_0xc5f7('0x33')](function(_0x40c8a9){_0x315804(_0x40c8a9);});});}exports['index']=function(_0x37f6de,_0x1b517e){var _0x4efa30={},_0x4416cc={},_0x33e9ae={'count':0x0,'rows':[]};var _0x5c450b=_['map'](db[_0xc5f7('0x34')][_0xc5f7('0x35')],function(_0x2a1cbd){return{'name':_0x2a1cbd[_0xc5f7('0x36')],'type':_0x2a1cbd[_0xc5f7('0x37')]['key']};});_0x4416cc[_0xc5f7('0x38')]=_[_0xc5f7('0x2c')](_0x5c450b,_0xc5f7('0x39'));_0x4416cc[_0xc5f7('0x3a')]=_['keys'](_0x37f6de[_0xc5f7('0x3a')]);_0x4416cc['filters']=_[_0xc5f7('0x3b')](_0x4416cc[_0xc5f7('0x38')],_0x4416cc[_0xc5f7('0x3a')]);_0x4efa30['attributes']=_[_0xc5f7('0x3b')](_0x4416cc[_0xc5f7('0x38')],qs[_0xc5f7('0x3c')](_0x37f6de[_0xc5f7('0x3a')][_0xc5f7('0x3c')]));_0x4efa30[_0xc5f7('0x3d')]=_0x4efa30['attributes'][_0xc5f7('0x3e')]?_0x4efa30['attributes']:_0x4416cc[_0xc5f7('0x38')];if(!_0x37f6de[_0xc5f7('0x3a')]['hasOwnProperty'](_0xc5f7('0x3f'))){_0x4efa30[_0xc5f7('0x24')]=qs[_0xc5f7('0x24')](_0x37f6de[_0xc5f7('0x3a')][_0xc5f7('0x24')]);_0x4efa30[_0xc5f7('0x23')]=qs[_0xc5f7('0x23')](_0x37f6de[_0xc5f7('0x3a')][_0xc5f7('0x23')]);}_0x4efa30[_0xc5f7('0x40')]=qs[_0xc5f7('0x41')](_0x37f6de[_0xc5f7('0x3a')]['sort']);_0x4efa30[_0xc5f7('0x42')]=qs['filters'](_[_0xc5f7('0x43')](_0x37f6de[_0xc5f7('0x3a')],_0x4416cc[_0xc5f7('0x44')]),_0x5c450b);var _0x3434e4=[];var _0x1d3c8b=squel[_0xc5f7('0x45')]()['field']('id')['field'](_0xc5f7('0x39'))[_0xc5f7('0x46')](_0xc5f7('0x47'))[_0xc5f7('0x48')](_0xc5f7('0x49'));var _0x524c7c=squel[_0xc5f7('0x45')]()[_0xc5f7('0x46')](_0xc5f7('0x4a'))[_0xc5f7('0x46')]('u.fullname')[_0xc5f7('0x46')](_0xc5f7('0x4b'))[_0xc5f7('0x48')](_0xc5f7('0x4c'),'ui')[_0xc5f7('0x4d')](_0xc5f7('0x4e'),'u',_0xc5f7('0x4f'));var _0x4afbd8=squel[_0xc5f7('0x45')]()[_0xc5f7('0x48')](_0xc5f7('0x50'),'i')[_0xc5f7('0x4d')]('cm_contacts','c',_0xc5f7('0x51'))['left_join'](_0xc5f7('0x4e'),'o',_0xc5f7('0x52'))[_0xc5f7('0x4d')]('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')['left_join'](_0xc5f7('0x53'),'me','me.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0xc5f7('0x54'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0xc5f7('0x49'),'t','t.id\x20=\x20it.TagId');var _0x63cfc1=squel[_0xc5f7('0x55')]();var _0x51f75d=[];var _0x3b838b=squel['expr']();var _0x49a50b;if(_0x37f6de[_0xc5f7('0x3a')][_0xc5f7('0x56')]){_0x49a50b=as[_0xc5f7('0x57')](_0x37f6de['query'][_0xc5f7('0x56')]);var _0x105ec5=_0x49a50b[_0xc5f7('0x58')];for(var _0x5ccbf9=0x0;_0x5ccbf9<_0x49a50b[_0xc5f7('0x59')][_0xc5f7('0x3e')];_0x5ccbf9++){var _0x34a8cf=_0x49a50b[_0xc5f7('0x59')][_0x5ccbf9];var _0x142c91='i';var _0x37a562=_['find'](_0x5c450b,[_0xc5f7('0x39'),_0x34a8cf['field']]);if(!_0x37a562){switch(_0x34a8cf[_0xc5f7('0x46')]){case _0xc5f7('0x5a'):if(_0x34a8cf[_0xc5f7('0x5b')]==0x1){_0x4afbd8['having']('`'+_0x34a8cf[_0xc5f7('0x46')]+_0xc5f7('0x5c'));}else{_0x4afbd8[_0xc5f7('0x5d')]('`'+_0x34a8cf[_0xc5f7('0x46')]+_0xc5f7('0x5e'));}break;case _0xc5f7('0x5f'):if(_0x34a8cf[_0xc5f7('0x60')]===_0xc5f7('0x61')){if(_0x34a8cf['value'][_0xc5f7('0x30')]('\x20')[_0xc5f7('0x3e')]>0x1){_0x63cfc1[_0x105ec5](_0xc5f7('0x62'),qs[_0xc5f7('0x63')](_0x34a8cf[_0xc5f7('0x5b')]),null);}else{var _0xe6b509='%'+_0x34a8cf[_0xc5f7('0x5b')]+'%';_0x63cfc1[_0x105ec5](_0xc5f7('0x64'),_0xe6b509,_0xe6b509,_0xe6b509);}}else{_0x37a562=_[_0xc5f7('0x65')](_0x5c450b,[_0xc5f7('0x39'),_0xc5f7('0x66')]);_0x34a8cf[_0xc5f7('0x46')]=_0xc5f7('0x66');_0x19537e=as['buildExpression'](_0x142c91,_0x37a562[_0xc5f7('0x37')],_0x34a8cf);_0x63cfc1[_0x105ec5](_0x19537e[_0xc5f7('0x67')],_0x19537e[_0xc5f7('0x5b')][_0xc5f7('0x68')],_0x19537e[_0xc5f7('0x5b')][_0xc5f7('0x21')]);}break;case _0xc5f7('0x69'):var _0x3ef58c=_0x34a8cf[_0xc5f7('0x5b')]['split'](',')[_0xc5f7('0x2c')](function(_0x128e74){return Number(_0x128e74);});_0x3ef58c['forEach'](function(_0x53cbf5){_0x3b838b['or'](_0xc5f7('0x6a'),'%,'+_0x53cbf5+',%');});_0x51f75d=_[_0xc5f7('0x6b')](_0x51f75d,_0x3ef58c);break;case'User':if(_0x34a8cf['operator']===_0xc5f7('0x61')){_0x63cfc1[_0x105ec5]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x34a8cf['value']+'%',null);}else{_0x37a562=_['find'](_0x5c450b,[_0xc5f7('0x39'),_0xc5f7('0x6c')]);_0x34a8cf[_0xc5f7('0x46')]=_0xc5f7('0x6c');_0x19537e=as['buildExpression'](_0x142c91,_0x37a562[_0xc5f7('0x37')],_0x34a8cf);_0x63cfc1[_0x105ec5](_0x19537e['text'],_0x19537e[_0xc5f7('0x5b')][_0xc5f7('0x68')],_0x19537e['value']['end']);}break;case _0xc5f7('0x6d'):_0x19537e=as[_0xc5f7('0x6e')]('me',null,_0x34a8cf);_0x63cfc1[_0x105ec5](_0x19537e[_0xc5f7('0x67')],_0x19537e[_0xc5f7('0x5b')]['start'],_0x19537e[_0xc5f7('0x5b')][_0xc5f7('0x21')]);break;}}else{var _0x19537e=as[_0xc5f7('0x6e')](_0x142c91,_0x37a562[_0xc5f7('0x37')],_0x34a8cf);_0x63cfc1[_0x105ec5](_0x19537e[_0xc5f7('0x67')],_0x19537e[_0xc5f7('0x5b')][_0xc5f7('0x68')],_0x19537e['value']['end']);}}}else{var _0x153003=_(_0x37f6de[_0xc5f7('0x3a')])[_0xc5f7('0x6f')]()['map'](function(_0x5d43dd){return _[_0xc5f7('0x70')](_0x5c450b,[_0xc5f7('0x39'),_0x5d43dd])?_0x5d43dd:undefined;})['compact']()[_0xc5f7('0x5b')]();if(!_['isEmpty'](_0x153003)){_0x153003[_0xc5f7('0x31')](function(_0x49bd9e){if(_0x49bd9e===_0xc5f7('0x71')){_0x4afbd8[_0xc5f7('0x42')](_0xc5f7('0x72'),[][_0xc5f7('0x73')](_0x37f6de[_0xc5f7('0x3a')][_0x49bd9e]));}else if(_0x49bd9e===_0xc5f7('0x74')){var _0x12c1f6=JSON[_0xc5f7('0x75')](_0x37f6de[_0xc5f7('0x3a')][_0x49bd9e])[_0xc5f7('0x76')];var _0x54dad4=JSON[_0xc5f7('0x75')](_0x37f6de[_0xc5f7('0x3a')][_0x49bd9e])[_0xc5f7('0x77')];_0x4afbd8['where'](_0xc5f7('0x78'),_0x12c1f6,_0x54dad4);}else{if(_0x37f6de[_0xc5f7('0x3a')][_0x49bd9e]==='null'){_0x4afbd8[_0xc5f7('0x42')]('i.'+_0x49bd9e+_0xc5f7('0x79'));}else{_0x4afbd8[_0xc5f7('0x42')]('i.'+_0x49bd9e+'\x20=\x20?',_0x37f6de['query'][_0x49bd9e]);}}});}if(_0x37f6de[_0xc5f7('0x3a')][_0xc5f7('0x7a')]){if(_0x37f6de[_0xc5f7('0x3a')]['read']==0x1){_0x4afbd8[_0xc5f7('0x5d')](_0xc5f7('0x7b'));}else{_0x4afbd8['having'](_0xc5f7('0x7c'));}}if(_0x37f6de['query'][_0xc5f7('0x7d')]){_0x51f75d=_['isArray'](_0x37f6de[_0xc5f7('0x3a')][_0xc5f7('0x7d')])?_0x37f6de[_0xc5f7('0x3a')][_0xc5f7('0x7d')]:new Array(_0x37f6de[_0xc5f7('0x3a')]['tag']);_0x51f75d[_0xc5f7('0x31')](function(_0x3d2322){_0x3b838b['or'](_0xc5f7('0x6a'),'%,'+_0x3d2322+',%');});}if(_0x37f6de['query'][_0xc5f7('0x7e')]){var _0x1f873c=_0x37f6de[_0xc5f7('0x3a')][_0xc5f7('0x7e')][_0xc5f7('0x7f')]('\x5c','\x5c\x5c')[_0xc5f7('0x7f')]('\x27\x27',_0xc5f7('0x80'));if(qs['isNumeric'](_0x1f873c)){_0x63cfc1['or'](_0xc5f7('0x81'),_0x1f873c+'%');}else{_0x63cfc1['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc5f7('0x63')](_0x1f873c))['or'](_0xc5f7('0x82'),_0x1f873c+'%')['or'](_0xc5f7('0x83'),_0x1f873c+'%');}}}_0x4afbd8['where'](_0x63cfc1);_0x4afbd8[_0xc5f7('0x84')](_0xc5f7('0x85'));var _0xa5f3b0={'type':db[_0xc5f7('0x86')]['QueryTypes'][_0xc5f7('0x87')],'raw':!![]};var _0x17926b=_0x4afbd8['clone']();_0x17926b[_0xc5f7('0x46')](_0xc5f7('0x85'));_0x17926b[_0xc5f7('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc5f7('0x5a'));if(_0x4efa30[_0xc5f7('0x40')]){_0x4efa30[_0xc5f7('0x40')][_0xc5f7('0x31')](function(_0x153dac){_0x4afbd8[_0xc5f7('0x40')]('i.'+_0x153dac[0x0],_0x153dac[0x1]===_0xc5f7('0x88')?![]:!![]);});}if(!_[_0xc5f7('0x89')](_0x51f75d)){_0x4afbd8['having'](_0x3b838b);_0x17926b[_0xc5f7('0x42')](_0xc5f7('0x8a'),_0x51f75d);}BPromise[_0xc5f7('0x8b')]()[_0xc5f7('0x32')](function(){if(!_0x49a50b){if(_0x37f6de['query']['OpenchannelAccountId']||_0x37f6de['query'][_0xc5f7('0x8c')])return;_0x17926b['where'](_0xc5f7('0x8d'));_0x4afbd8[_0xc5f7('0x42')](_0xc5f7('0x8d'));return;}return _0x37f6de[_0xc5f7('0x8e')][_0xc5f7('0x8f')]({'attributes':['id'],'raw':!![]})[_0xc5f7('0x32')](function(_0x57186f){if(_[_0xc5f7('0x89')](_0x57186f)){_0x17926b['where']('i.OpenchannelAccountId\x20IS\x20NULL');_0x4afbd8[_0xc5f7('0x42')](_0xc5f7('0x90'));}else{_0x17926b[_0xc5f7('0x42')](_0xc5f7('0x72'),_[_0xc5f7('0x2c')](_0x57186f,'id'));_0x4afbd8[_0xc5f7('0x42')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xc5f7('0x2c')](_0x57186f,'id'));}});})['then'](function(){db[_0xc5f7('0x91')][_0xc5f7('0x3a')](_0x17926b[_0xc5f7('0x92')](),_0xa5f3b0)[_0xc5f7('0x32')](function(_0xce8d7c){_0x33e9ae['count']=_0xce8d7c['length'];if(_0x33e9ae['count']===0x0)return[];return db[_0xc5f7('0x91')][_0xc5f7('0x3a')](_0x1d3c8b[_0xc5f7('0x92')](),_0xa5f3b0)[_0xc5f7('0x32')](function(_0x21cbda){_0x3434e4=_[_0xc5f7('0x93')](_0x21cbda,'id');_0xa5f3b0=_[_0xc5f7('0x94')](_0xa5f3b0,{'model':db[_0xc5f7('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x37f6de['query'][_0xc5f7('0x3c')]){_0x4efa30[_0xc5f7('0x3d')]['forEach'](function(_0x5b17ff){_0x4afbd8[_0xc5f7('0x46')]('i.'+_0x5b17ff);});}else{_0x4afbd8[_0xc5f7('0x46')](_0xc5f7('0x95'),_0xc5f7('0x5a'));_0x4afbd8[_0xc5f7('0x46')](_0xc5f7('0x96'),_0xc5f7('0x97'));_0x4afbd8['field'](_0xc5f7('0x98'),'Account.mandatoryDisposition');_0x4afbd8[_0xc5f7('0x46')]('i.*');_0x4afbd8[_0xc5f7('0x46')](_0xc5f7('0x99'),'Contact.firstName');_0x4afbd8[_0xc5f7('0x46')](_0xc5f7('0x9a'),_0xc5f7('0x9b'));_0x4afbd8[_0xc5f7('0x46')]('c.email',_0xc5f7('0x9c'));_0x4afbd8[_0xc5f7('0x46')](_0xc5f7('0x9d'),_0xc5f7('0x9e'));_0x4afbd8[_0xc5f7('0x46')](_0xc5f7('0x9f'),'Contact.mobile');_0x4afbd8['field'](_0xc5f7('0xa0'),_0xc5f7('0xa1'));_0x4afbd8[_0xc5f7('0x46')](_0xc5f7('0xa2'),'Owner.fullname');_0x4afbd8[_0xc5f7('0x46')]('o.internal',_0xc5f7('0xa3'));_0x4afbd8[_0xc5f7('0x46')](_0xc5f7('0xa4'),_0xc5f7('0x2e'));}if(_0x4efa30[_0xc5f7('0x24')])_0x4afbd8[_0xc5f7('0x24')](_0x4efa30[_0xc5f7('0x24')]);if(_0x4efa30[_0xc5f7('0x23')])_0x4afbd8['offset'](_0x4efa30['offset']);return db[_0xc5f7('0x91')][_0xc5f7('0x3a')](_0x4afbd8['toString'](),_0xa5f3b0);})[_0xc5f7('0x32')](function(_0x23d576){_0x524c7c['where'](_0xc5f7('0xa5'),_[_0xc5f7('0x2c')](_0x23d576,'id'));return db[_0xc5f7('0x91')][_0xc5f7('0x3a')](_0x524c7c['toString'](),_0xa5f3b0)[_0xc5f7('0x32')](function(_0x4cd466){var _0x23e37c=_[_0xc5f7('0xa6')](_0x4cd466,'OpenchannelInteractionId');var _0x333bd2=[];_0x23d576[_0xc5f7('0x31')](function(_0x357c22){_0x333bd2[_0xc5f7('0xa7')](updateOpenchannelInteraction(_0x357c22,_0x3434e4,_0x23e37c));});return BPromise['all'](_0x333bd2);});});})[_0xc5f7('0x32')](function(_0x3c1c79){_0x33e9ae['rows']=_0x3c1c79;return _0x33e9ae;})[_0xc5f7('0x32')](respondWithFilteredResult(_0x1b517e,_0x4efa30));})['catch'](handleError(_0x1b517e,null));};exports[_0xc5f7('0xa8')]=function(_0x74c8fe,_0x32a91e){var _0x1e2602={'raw':![],'where':{'id':_0x74c8fe['params']['id']}},_0x4d411d={};_0x4d411d[_0xc5f7('0x38')]=_[_0xc5f7('0x6f')](db[_0xc5f7('0x34')][_0xc5f7('0x35')]);_0x4d411d[_0xc5f7('0x3a')]=_[_0xc5f7('0x6f')](_0x74c8fe[_0xc5f7('0x3a')]);_0x4d411d[_0xc5f7('0x44')]=_[_0xc5f7('0x3b')](_0x4d411d['model'],_0x4d411d[_0xc5f7('0x3a')]);_0x1e2602['attributes']=_['intersection'](_0x4d411d[_0xc5f7('0x38')],qs[_0xc5f7('0x3c')](_0x74c8fe['query']['fields']));_0x1e2602['attributes']=_0x1e2602[_0xc5f7('0x3d')]['length']?_0x1e2602[_0xc5f7('0x3d')]:_0x4d411d[_0xc5f7('0x38')];if(_0x74c8fe[_0xc5f7('0x3a')][_0xc5f7('0xa9')]){_0x1e2602['include']=[{'all':!![]}];}_0x1e2602=_[_0xc5f7('0x94')]({},_0x1e2602,_0x74c8fe[_0xc5f7('0xaa')]);return db[_0xc5f7('0x34')][_0xc5f7('0x65')](_0x1e2602)[_0xc5f7('0x32')](handleEntityNotFound(_0x32a91e,null))[_0xc5f7('0x32')](respondWithResult(_0x32a91e,null))[_0xc5f7('0x33')](handleError(_0x32a91e,null));};exports[_0xc5f7('0xab')]=function(_0x48f0b1,_0x3edb6e){return db['OpenchannelInteraction'][_0xc5f7('0xab')](_0x48f0b1[_0xc5f7('0x6d')],{})[_0xc5f7('0x32')](respondWithResult(_0x3edb6e,0xc9))[_0xc5f7('0x33')](handleError(_0x3edb6e,null));};exports['update']=function(_0x589a26,_0xedd8c1){if(_0x589a26['body']['id']){delete _0x589a26['body']['id'];}return db[_0xc5f7('0x34')]['find']({'where':{'id':_0x589a26[_0xc5f7('0xac')]['id']}})[_0xc5f7('0x32')](handleEntityNotFound(_0xedd8c1,null))[_0xc5f7('0x32')](saveUpdates(_0x589a26['body'],null))[_0xc5f7('0x32')](respondWithResult(_0xedd8c1,null))[_0xc5f7('0x33')](handleError(_0xedd8c1,null));};exports[_0xc5f7('0x2a')]=function(_0x218de0,_0x42d6cc){return db[_0xc5f7('0x34')]['find']({'where':{'id':_0x218de0[_0xc5f7('0xac')]['id']}})[_0xc5f7('0x32')](handleEntityNotFound(_0x42d6cc,null))[_0xc5f7('0x32')](removeEntity(_0x42d6cc,null))[_0xc5f7('0x33')](handleError(_0x42d6cc,null));};exports['describe']=function(_0x5c1cf1,_0x586af2){return db[_0xc5f7('0x34')][_0xc5f7('0xad')]()[_0xc5f7('0x32')](respondWithResult(_0x586af2,null))[_0xc5f7('0x33')](handleError(_0x586af2,null));};exports[_0xc5f7('0xae')]=function(_0xae14e2,_0x49ed2f,_0x8c375f){return db['OpenchannelMessage'][_0xc5f7('0x65')]({'where':{'id':_0xae14e2[_0xc5f7('0xac')]['id']}})['then'](handleEntityNotFound(_0x49ed2f,null))[_0xc5f7('0x32')](function(_0x534112){if(_0x534112){return _0x534112[_0xc5f7('0xae')](_0xae14e2[_0xc5f7('0x6d')][_0xc5f7('0xaf')],_[_0xc5f7('0xb0')](_0xae14e2[_0xc5f7('0x6d')],['ids','id'])||{});}})[_0xc5f7('0x32')](respondWithResult(_0x49ed2f,null))[_0xc5f7('0x33')](handleError(_0x49ed2f,null));};exports[_0xc5f7('0xb1')]=function(_0x47c3d4,_0x2f844c,_0x204ebd){var _0x4faa91={'raw':![],'where':{}};var _0x1a192e={};var _0x348594={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xc5f7('0xb2')]({'where':{'id':_0x47c3d4[_0xc5f7('0xac')]['id']}})[_0xc5f7('0x32')](handleEntityNotFound(_0x2f844c,null))[_0xc5f7('0x32')](function(_0x235a0e){if(_0x235a0e){_0x1a192e['model']=_[_0xc5f7('0x6f')](db[_0xc5f7('0xb3')]['rawAttributes']);_0x1a192e[_0xc5f7('0x3a')]=_[_0xc5f7('0x6f')](_0x47c3d4['query']);_0x1a192e[_0xc5f7('0x44')]=_[_0xc5f7('0x3b')](_0x1a192e[_0xc5f7('0x38')],_0x1a192e[_0xc5f7('0x3a')]);_0x4faa91[_0xc5f7('0x3d')]=_[_0xc5f7('0x3b')](_0x1a192e[_0xc5f7('0x38')],qs[_0xc5f7('0x3c')](_0x47c3d4['query'][_0xc5f7('0x3c')]));_0x4faa91[_0xc5f7('0x3d')]=_0x4faa91[_0xc5f7('0x3d')][_0xc5f7('0x3e')]?_0x4faa91[_0xc5f7('0x3d')]:_0x1a192e[_0xc5f7('0x38')];if(!_0x47c3d4[_0xc5f7('0x3a')][_0xc5f7('0xb4')]('nolimit')){_0x4faa91[_0xc5f7('0x24')]=qs[_0xc5f7('0x24')](_0x47c3d4[_0xc5f7('0x3a')][_0xc5f7('0x24')]);_0x4faa91['offset']=qs['offset'](_0x47c3d4[_0xc5f7('0x3a')][_0xc5f7('0x23')]);}_0x4faa91['order']=qs['sort'](_0x47c3d4['query']['sort']);_0x4faa91['where']=qs[_0xc5f7('0x44')](_[_0xc5f7('0x43')](_0x47c3d4[_0xc5f7('0x3a')],_0x1a192e[_0xc5f7('0x44')]));_0x4faa91[_0xc5f7('0x42')][_0xc5f7('0xb5')]=_0x235a0e['id'];if(_0x47c3d4[_0xc5f7('0x3a')][_0xc5f7('0x7e')]){_0x4faa91[_0xc5f7('0x42')]=_[_0xc5f7('0x94')](_0x4faa91[_0xc5f7('0x42')],{'$or':_[_0xc5f7('0x2c')](_0x4faa91[_0xc5f7('0x3d')],function(_0x3ebcc9){var _0x530369={};_0x530369[_0x3ebcc9]={'$like':'%'+_0x47c3d4[_0xc5f7('0x3a')][_0xc5f7('0x7e')]+'%'};return _0x530369;})});}if(_0x47c3d4['query'][_0xc5f7('0x76')]){var _0x381617=_0x47c3d4[_0xc5f7('0x3a')][_0xc5f7('0x76')]['split'](',');var _0x1032d4={};_0x1032d4[_0x381617[0x0]]={'$gte':moment(_0x381617[0x1])[_0xc5f7('0xb6')](_0xc5f7('0xb7'))};_0x4faa91[_0xc5f7('0x42')]=_[_0xc5f7('0x94')](_0x4faa91[_0xc5f7('0x42')],_0x1032d4);}_0x4faa91=_[_0xc5f7('0x94')]({},_0x4faa91,_0x47c3d4[_0xc5f7('0xaa')]);return db[_0xc5f7('0xb3')][_0xc5f7('0xb8')]({'where':_0x4faa91['where']})['then'](function(_0x11e1e2){_0x348594['count']=_0x11e1e2;if(_0x47c3d4[_0xc5f7('0x3a')][_0xc5f7('0xa9')]){_0x4faa91[_0xc5f7('0xb9')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xc5f7('0xba')](_0x4faa91);})[_0xc5f7('0x32')](function(_0x4e6391){_0x348594[_0xc5f7('0xbb')]=_0x4e6391;return _0x348594;});}})[_0xc5f7('0x32')](respondWithFilteredResult(_0x2f844c,_0x4faa91))[_0xc5f7('0x33')](handleError(_0x2f844c,null));};exports[_0xc5f7('0xbc')]=function(_0x2781c5,_0xf3311f,_0x36c7d6){return db[_0xc5f7('0x34')][_0xc5f7('0x65')]({'where':{'id':_0x2781c5[_0xc5f7('0xac')]['id']}})['then'](handleEntityNotFound(_0xf3311f,null))[_0xc5f7('0x32')](function(_0x53c949){if(_0x53c949){return _0x53c949['setTags'](_0x2781c5['body'][_0xc5f7('0xaf')],_[_0xc5f7('0xb0')](_0x2781c5[_0xc5f7('0x6d')],['ids','id'])||{})[_0xc5f7('0xbd')](function(){return db['Tag'][_0xc5f7('0xba')]({'attributes':['id',_0xc5f7('0x39'),'color'],'where':{'id':_0x2781c5[_0xc5f7('0x6d')]['ids']}});})[_0xc5f7('0x32')](function(_0x233485){socket[_0xc5f7('0xbe')](_0xc5f7('0xbf'),{'id':Number(_0x2781c5[_0xc5f7('0xac')]['id']),'tags':_0x233485||[]});return{'id':Number(_0x2781c5[_0xc5f7('0xac')]['id']),'tags':_0x233485||[]};});}})[_0xc5f7('0x32')](respondWithResult(_0xf3311f,null))['catch'](handleError(_0xf3311f,null));};exports[_0xc5f7('0xc0')]=function(_0x2e4bda,_0x264cdc,_0x12230d){return db[_0xc5f7('0x34')][_0xc5f7('0x65')]({'where':{'id':_0x2e4bda[_0xc5f7('0xac')]['id']}})[_0xc5f7('0x32')](handleEntityNotFound(_0x264cdc,null))[_0xc5f7('0x32')](function(_0x33d1e1){if(_0x33d1e1){return _0x33d1e1[_0xc5f7('0xc0')](_0x2e4bda[_0xc5f7('0x3a')][_0xc5f7('0xaf')]);}})[_0xc5f7('0x32')](respondWithStatusCode(_0x264cdc,null))[_0xc5f7('0x33')](handleError(_0x264cdc,null));};exports['download']=function(_0x5e465c,_0x5760c8){var _0x272238=moment()[_0xc5f7('0xc1')]()[_0xc5f7('0x92')]();var _0x2d3bd0=path['join'](config[_0xc5f7('0xc2')],_0xc5f7('0xc3'),_0xc5f7('0xc4'),'tmp');var _0x4157bb=path[_0xc5f7('0xc5')](config[_0xc5f7('0xc2')],_0xc5f7('0xc3'),'files','attachments');var _0x4deadd=path[_0xc5f7('0xc5')](_0x2d3bd0,_0x272238);var _0x21ca6f=util[_0xc5f7('0xb6')](_0xc5f7('0xc6'),_0x5e465c['params']['id'],_0x272238);var _0x2cc9ce=path['join'](_0x2d3bd0,_0x21ca6f);var _0x8767cd=[];_0x8767cd['push']({'model':db[_0xc5f7('0xc7')],'as':'User','attributes':['id',_0xc5f7('0x2d')],'raw':!![]});_0x8767cd['push']({'model':db[_0xc5f7('0xc8')],'as':_0xc5f7('0x5f'),'attributes':['id',_0xc5f7('0xc9'),_0xc5f7('0xca')],'raw':!![]});if(_0x5e465c[_0xc5f7('0x3a')]['attachments']){_0x8767cd[_0xc5f7('0xa7')]({'model':db[_0xc5f7('0xcb')],'as':'Attachment','raw':!![]});}var _0x42a250=[{'model':db[_0xc5f7('0xb3')],'as':_0xc5f7('0xcc'),'attributes':['id',_0xc5f7('0x6d'),_0xc5f7('0x74'),'direction',_0xc5f7('0xcd'),_0xc5f7('0x7a')],'include':_0x8767cd}];_0x42a250[_0xc5f7('0xa7')]({'model':db[_0xc5f7('0xce')],'as':_0xc5f7('0xcf'),'attributes':['id',_0xc5f7('0x39')]});_0x42a250[_0xc5f7('0xa7')]({'model':db[_0xc5f7('0xc7')],'as':_0xc5f7('0xd0'),'attributes':['id',_0xc5f7('0x2d')]});return db[_0xc5f7('0x34')][_0xc5f7('0x65')]({'where':{'id':_0x5e465c['params']['id']},'include':_0x42a250})[_0xc5f7('0x32')](handleEntityNotFound(_0x5760c8,null))['then'](function(_0x63f1f4){if(_0x63f1f4){var _0x33c58a=_0x63f1f4[_0xc5f7('0xd1')]({'plain':!![]});fs[_0xc5f7('0xd2')](_0x4deadd);var _0x33fd0a={'format':'A4','border':_0xc5f7('0xd3'),'header':{'height':_0xc5f7('0xd4'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0xc5f7('0xd5'),'contents':{'default':util[_0xc5f7('0xb6')](_0xc5f7('0xd6'),util[_0xc5f7('0xb6')](_0xc5f7('0xd7'),_0xc5f7('0xd8'),_0x33c58a['id']),moment()['format'](_0xc5f7('0xd9'))[_0xc5f7('0x92')]())}}};var _0x5ffa5c={'channel':_0xc5f7('0xd8'),'account':_0x33c58a['Account'][_0xc5f7('0x39')],'agent':_0x33c58a[_0xc5f7('0xd0')]?_0x33c58a[_0xc5f7('0xd0')][_0xc5f7('0x2d')]:'N.A.','createdAt':moment(_0x33c58a[_0xc5f7('0x74')])[_0xc5f7('0xb6')](_0xc5f7('0xb7'))[_0xc5f7('0x92')](),'closedAt':_0x33c58a['closed']?moment(_0x33c58a[_0xc5f7('0xda')])[_0xc5f7('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x33c58a[_0xc5f7('0xdb')],'visibility':_0x33c58a[_0xc5f7('0xdc')]?_0xc5f7('0xdd'):_0xc5f7('0xde'),'messages':_(_0x33c58a[_0xc5f7('0xcc')])[_0xc5f7('0x7e')]({'secret':![]})[_0xc5f7('0x2c')](function(_0x1a0b78){if(_0x1a0b78[_0xc5f7('0xcb')]){var _0x58cf29=path['join'](_0x4157bb,_0x1a0b78[_0xc5f7('0xcb')][_0xc5f7('0xdf')]);if(fs[_0xc5f7('0xe0')](_0x58cf29)){fs[_0xc5f7('0xe1')](_0x58cf29)[_0xc5f7('0xe2')](fs['createWriteStream'](path[_0xc5f7('0xc5')](_0x4deadd,_0x1a0b78['Attachment'][_0xc5f7('0xdf')])));}}return{'date':moment(_0x1a0b78['createdAt'])[_0xc5f7('0xb6')](_0xc5f7('0xb7'))[_0xc5f7('0x92')](),'sender':_0x1a0b78[_0xc5f7('0xe3')]===_0xc5f7('0xe4')?_0x1a0b78[_0xc5f7('0xc7')]?_0x1a0b78[_0xc5f7('0xc7')]['fullname']:_0xc5f7('0xe5'):_0x1a0b78[_0xc5f7('0x5f')][_0xc5f7('0xc9')]+(_0x1a0b78[_0xc5f7('0x5f')][_0xc5f7('0xca')]?'\x20'+_0x1a0b78[_0xc5f7('0x5f')][_0xc5f7('0xca')]:''),'body':_0x1a0b78[_0xc5f7('0xcb')]?_0x1a0b78[_0xc5f7('0xcb')]['basename']:_0x1a0b78[_0xc5f7('0x6d')],'direction':_0x1a0b78[_0xc5f7('0xe3')]==='out'?'A':'C','secret':_0x1a0b78[_0xc5f7('0xcd')],'read':_0x1a0b78[_0xc5f7('0x7a')],'attachment':_0x1a0b78[_0xc5f7('0xcb')]};})[_0xc5f7('0x5b')]()};return ejs[_0xc5f7('0xe6')](path[_0xc5f7('0xc5')](config['root'],_0xc5f7('0xc3'),'views',_0xc5f7('0xe7')),{'interaction':_0x5ffa5c})['then'](function(_0x34b5aa){return new BPromise(function(_0x37658d,_0x47e109){pdf[_0xc5f7('0xab')](_0x34b5aa,_0x33fd0a)[_0xc5f7('0xe8')](path[_0xc5f7('0xc5')](_0x4deadd,_0xc5f7('0xe9')+_0x33c58a['id']+'-'+_0x272238+_0xc5f7('0xea')),function(_0x383211,_0x5df559){if(_0x383211)return _0x47e109(_0x383211);_0x37658d(_0x5df559);});});})[_0xc5f7('0x32')](function(){return new BPromise(function(_0x1d3091,_0x5d97e6){zipdir(_0x4deadd,{'saveTo':_0x2cc9ce},function(_0x5047f7,_0x567648){if(_0x5047f7)return _0x5d97e6(_0x5047f7);return _0x1d3091(_0x567648);});})['then'](function(){return new BPromise(function(_0x10c92c,_0x513f1e){rimraf(_0x4deadd,function(_0x29bdd1){if(_0x29bdd1)_0x513f1e(_0x29bdd1);return _0x10c92c();});});})[_0xc5f7('0x32')](function(){return _0x5760c8[_0xc5f7('0xeb')](_0x2cc9ce,_0x21ca6f,function(_0x189e2b){if(_0x189e2b){console[_0xc5f7('0xec')]('err',_0x189e2b);}else{fs[_0xc5f7('0xed')](_0x2cc9ce);}});});});}else{return _0x5760c8['sendStatus'](0xc8);}})[_0xc5f7('0x33')](handleError(_0x5760c8,null));}; \ No newline at end of file +var _0x23a6=['\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','Public','basename','createReadStream','pipe','createWriteStream','System','out','renderFile','views','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','Users','map','fullname','TagIds','Tags','split','catch','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','select','field','from','tools_tags','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','find','unreadMessages','value','having','`\x20>\x200','operator','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','count','keyBy','merge','OpenchannelInteraction','fields','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','sequelize','push','rows','show','params','includeAll','options','create','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','hasOwnProperty','pick','OpenchannelInteractionId','format','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','transcript-%d-%s.zip','User','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','direction','OpenchannelAccount','Account','Owner','get','10px','40px'];(function(_0x5c0dcb,_0x16cd83){var _0x183a0e=function(_0xfb292d){while(--_0xfb292d){_0x5c0dcb['push'](_0x5c0dcb['shift']());}};_0x183a0e(++_0x16cd83);}(_0x23a6,0xff));var _0x623a=function(_0x11f1cb,_0x12734a){_0x11f1cb=_0x11f1cb-0x0;var _0x3bd0a8=_0x23a6[_0x11f1cb];return _0x3bd0a8;};'use strict';var pdf=require(_0x623a('0x0'));var emlformat=require(_0x623a('0x1'));var rimraf=require(_0x623a('0x2'));var zipdir=require(_0x623a('0x3'));var jsonpatch=require(_0x623a('0x4'));var rp=require(_0x623a('0x5'));var moment=require(_0x623a('0x6'));var BPromise=require(_0x623a('0x7'));var Mustache=require(_0x623a('0x8'));var util=require(_0x623a('0x9'));var path=require(_0x623a('0xa'));var sox=require(_0x623a('0xb'));var csv=require(_0x623a('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x623a('0xd'));var squel=require(_0x623a('0xe'));var crypto=require(_0x623a('0xf'));var jsforce=require(_0x623a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x623a('0xc'));var querystring=require(_0x623a('0x11'));var Papa=require(_0x623a('0x12'));var Redis=require('ioredis');var authService=require(_0x623a('0x13'));var qs=require(_0x623a('0x14'));var as=require(_0x623a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x623a('0x16'));var utils=require(_0x623a('0x17'));var config=require(_0x623a('0x18'));var db=require('../../mysqldb')['db'];config[_0x623a('0x19')]=_[_0x623a('0x1a')](config[_0x623a('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x623a('0x1b'))(new Redis(config[_0x623a('0x19')]));require('./openchannelInteraction.socket')[_0x623a('0x1c')](socket);function respondWithStatusCode(_0x4c4bda,_0x42506a){_0x42506a=_0x42506a||0xcc;return function(_0x64bb58){if(_0x64bb58){return _0x4c4bda[_0x623a('0x1d')](_0x42506a);}return _0x4c4bda[_0x623a('0x1e')](_0x42506a)[_0x623a('0x1f')]();};}function respondWithResult(_0x531ab1,_0xbd012){_0xbd012=_0xbd012||0xc8;return function(_0x3c4b73){if(_0x3c4b73){return _0x531ab1[_0x623a('0x1e')](_0xbd012)[_0x623a('0x20')](_0x3c4b73);}};}function respondWithFilteredResult(_0x36ee5e,_0x27ea50){return function(_0x2b9ea4){if(_0x2b9ea4){var _0x209ee0=_0x2b9ea4['count'],_0x20245a=_0x27ea50[_0x623a('0x21')],_0x554d2e=_0x27ea50['offset']+_0x27ea50[_0x623a('0x22')],_0x48a366;if(_0x554d2e>=_0x209ee0){_0x554d2e=_0x209ee0;_0x48a366=0xc8;}else{_0x48a366=0xce;}_0x36ee5e['status'](_0x48a366);return _0x36ee5e[_0x623a('0x23')](_0x623a('0x24'),_0x20245a+'-'+_0x554d2e+'/'+_0x209ee0)[_0x623a('0x20')](_0x2b9ea4);}return null;};}function patchUpdates(_0x2202d5){return function(_0x471554){try{jsonpatch[_0x623a('0x25')](_0x471554,_0x2202d5,!![]);}catch(_0x4405d0){return BPromise[_0x623a('0x26')](_0x4405d0);}return _0x471554[_0x623a('0x27')]();};}function saveUpdates(_0xa3b863,_0x231c97){return function(_0x450c6e){if(_0x450c6e){return _0x450c6e[_0x623a('0x28')](_0xa3b863)[_0x623a('0x29')](function(_0x1471c1){return _0x1471c1;});}return null;};}function removeEntity(_0x705056,_0x3ea41a){return function(_0x18f6c3){if(_0x18f6c3){return _0x18f6c3[_0x623a('0x2a')]()[_0x623a('0x29')](function(){_0x705056[_0x623a('0x1e')](0xcc)[_0x623a('0x1f')]();});}};}function handleEntityNotFound(_0x38a589,_0x501a4f){return function(_0x248d72){if(!_0x248d72){_0x38a589['sendStatus'](0x194);}return _0x248d72;};}function handleError(_0x44f7b6,_0x3e4715){_0x3e4715=_0x3e4715||0x1f4;return function(_0x477698){logger[_0x623a('0x2b')](_0x477698['stack']);if(_0x477698[_0x623a('0x2c')]){delete _0x477698[_0x623a('0x2c')];}_0x44f7b6[_0x623a('0x1e')](_0x3e4715)['send'](_0x477698);};}function getInteractionUsers(_0x1eed79,_0x5812b5){return new BPromise(function(_0x2b6ed6,_0x5de807){try{if(_0x5812b5[_0x1eed79['id']]){_0x1eed79[_0x623a('0x2d')]=_[_0x623a('0x2e')](_0x5812b5[_0x1eed79['id']],function(_0x57396f){return{'id':_0x57396f['id'],'fullname':_0x57396f[_0x623a('0x2f')]};});}}catch(_0x26a316){_0x5de807(_0x26a316);}_0x2b6ed6(_0x1eed79);});}function getInteractionTags(_0x3ec545,_0x4fde5e){return new BPromise(function(_0x525187,_0x4be20c){try{if(_0x3ec545[_0x623a('0x30')]){_0x3ec545[_0x623a('0x31')]=[];_0x3ec545['TagIds'][_0x623a('0x32')](',')['forEach'](function(_0x1968a2){_0x3ec545[_0x623a('0x31')]['push'](_0x4fde5e[_0x1968a2]);});}delete _0x3ec545[_0x623a('0x30')];}catch(_0x249a48){_0x4be20c(_0x249a48);}_0x525187(_0x3ec545);});}function updateOpenchannelInteraction(_0x17b8b2,_0x24d367,_0x3e7bab){return new BPromise(function(_0x46bb96,_0x105c13){return getInteractionUsers(_0x17b8b2,_0x3e7bab)[_0x623a('0x29')](function(_0x31dcbd){return getInteractionTags(_0x31dcbd,_0x24d367);})[_0x623a('0x29')](function(_0x9f485c){_0x46bb96(_0x9f485c);})[_0x623a('0x33')](function(_0x16f02c){_0x105c13(_0x16f02c);});});}exports['index']=function(_0x1722c8,_0x36a6d8){var _0x47a3ec={},_0x883be={},_0x798229={'count':0x0,'rows':[]};var _0x2e84b8=_[_0x623a('0x2e')](db['OpenchannelInteraction'][_0x623a('0x34')],function(_0x55805e){return{'name':_0x55805e[_0x623a('0x35')],'type':_0x55805e[_0x623a('0x36')]['key']};});_0x883be[_0x623a('0x37')]=_[_0x623a('0x2e')](_0x2e84b8,_0x623a('0x2c'));_0x883be[_0x623a('0x38')]=_[_0x623a('0x39')](_0x1722c8[_0x623a('0x38')]);_0x883be[_0x623a('0x3a')]=_[_0x623a('0x3b')](_0x883be[_0x623a('0x37')],_0x883be[_0x623a('0x38')]);_0x47a3ec['attributes']=_[_0x623a('0x3b')](_0x883be[_0x623a('0x37')],qs['fields'](_0x1722c8[_0x623a('0x38')]['fields']));_0x47a3ec[_0x623a('0x3c')]=_0x47a3ec['attributes']['length']?_0x47a3ec['attributes']:_0x883be['model'];if(!_0x1722c8[_0x623a('0x38')]['hasOwnProperty'](_0x623a('0x3d'))){_0x47a3ec['limit']=qs[_0x623a('0x22')](_0x1722c8[_0x623a('0x38')][_0x623a('0x22')]);_0x47a3ec[_0x623a('0x21')]=qs['offset'](_0x1722c8[_0x623a('0x38')][_0x623a('0x21')]);}_0x47a3ec[_0x623a('0x3e')]=qs[_0x623a('0x3f')](_0x1722c8['query']['sort']);_0x47a3ec[_0x623a('0x40')]=qs[_0x623a('0x3a')](_['pick'](_0x1722c8[_0x623a('0x38')],_0x883be[_0x623a('0x3a')]),_0x2e84b8);var _0x24e0a9=[];var _0x2be299=squel[_0x623a('0x41')]()['field']('id')[_0x623a('0x42')](_0x623a('0x2c'))[_0x623a('0x42')]('color')[_0x623a('0x43')](_0x623a('0x44'));var _0x81e56d=squel[_0x623a('0x41')]()[_0x623a('0x42')](_0x623a('0x45'))[_0x623a('0x42')]('u.fullname')[_0x623a('0x42')](_0x623a('0x46'))[_0x623a('0x43')](_0x623a('0x47'),'ui')['left_join'](_0x623a('0x48'),'u',_0x623a('0x49'));var _0x37390c=squel[_0x623a('0x41')]()['from'](_0x623a('0x4a'),'i')[_0x623a('0x4b')]('cm_contacts','c',_0x623a('0x4c'))['left_join'](_0x623a('0x48'),'o',_0x623a('0x4d'))[_0x623a('0x4b')]('openchannel_accounts','a',_0x623a('0x4e'))[_0x623a('0x4b')]('openchannel_messages','me',_0x623a('0x4f'))[_0x623a('0x4b')](_0x623a('0x50'),'it',_0x623a('0x51'))[_0x623a('0x4b')](_0x623a('0x44'),'t',_0x623a('0x52'));var _0x22197d=squel[_0x623a('0x53')]();var _0x218699=[];var _0x2a6d8c=squel[_0x623a('0x53')]();var _0x2d01b6;if(_0x1722c8[_0x623a('0x38')][_0x623a('0x54')]){_0x2d01b6=as['parseSearch'](_0x1722c8['query']['search']);var _0x5b9896=_0x2d01b6['sqlOperator'];for(var _0x1e9a05=0x0;_0x1e9a05<_0x2d01b6['conditions']['length'];_0x1e9a05++){var _0x481322=_0x2d01b6['conditions'][_0x1e9a05];var _0x2ca8a0='i';var _0x3d51a6=_[_0x623a('0x55')](_0x2e84b8,[_0x623a('0x2c'),_0x481322[_0x623a('0x42')]]);if(!_0x3d51a6){switch(_0x481322[_0x623a('0x42')]){case _0x623a('0x56'):if(_0x481322[_0x623a('0x57')]==0x1){_0x37390c[_0x623a('0x58')]('`'+_0x481322[_0x623a('0x42')]+'`\x20=\x200');}else{_0x37390c['having']('`'+_0x481322[_0x623a('0x42')]+_0x623a('0x59'));}break;case'Contact':if(_0x481322[_0x623a('0x5a')]===_0x623a('0x5b')){if(_0x481322[_0x623a('0x57')][_0x623a('0x32')]('\x20')[_0x623a('0x5c')]>0x1){_0x22197d[_0x5b9896](_0x623a('0x5d'),qs['getFullTextValue'](_0x481322[_0x623a('0x57')]),null);}else{var _0x37b1be='%'+_0x481322[_0x623a('0x57')]+'%';_0x22197d[_0x5b9896]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x37b1be,_0x37b1be,_0x37b1be);}}else{_0x3d51a6=_['find'](_0x2e84b8,[_0x623a('0x2c'),_0x623a('0x5e')]);_0x481322['field']=_0x623a('0x5e');_0x4277cd=as[_0x623a('0x5f')](_0x2ca8a0,_0x3d51a6[_0x623a('0x36')],_0x481322);_0x22197d[_0x5b9896](_0x4277cd['text'],_0x4277cd[_0x623a('0x57')][_0x623a('0x60')],_0x4277cd[_0x623a('0x57')][_0x623a('0x1f')]);}break;case _0x623a('0x61'):var _0x3e3f36=_0x481322[_0x623a('0x57')][_0x623a('0x32')](',')[_0x623a('0x2e')](function(_0x4ef33f){return Number(_0x4ef33f);});_0x3e3f36[_0x623a('0x62')](function(_0x4dba0f){_0x2a6d8c['or'](_0x623a('0x63'),'%,'+_0x4dba0f+',%');});_0x218699=_['union'](_0x218699,_0x3e3f36);break;case'User':if(_0x481322[_0x623a('0x5a')]==='$substring'){_0x22197d[_0x5b9896](_0x623a('0x64'),'%'+_0x481322['value']+'%',null);}else{_0x3d51a6=_['find'](_0x2e84b8,[_0x623a('0x2c'),_0x623a('0x65')]);_0x481322[_0x623a('0x42')]=_0x623a('0x65');_0x4277cd=as[_0x623a('0x5f')](_0x2ca8a0,_0x3d51a6['type'],_0x481322);_0x22197d[_0x5b9896](_0x4277cd[_0x623a('0x66')],_0x4277cd[_0x623a('0x57')]['start'],_0x4277cd[_0x623a('0x57')][_0x623a('0x1f')]);}break;case _0x623a('0x67'):_0x4277cd=as[_0x623a('0x5f')]('me',null,_0x481322);_0x22197d[_0x5b9896](_0x4277cd[_0x623a('0x66')],_0x4277cd['value'][_0x623a('0x60')],_0x4277cd[_0x623a('0x57')][_0x623a('0x1f')]);break;}}else{var _0x4277cd=as[_0x623a('0x5f')](_0x2ca8a0,_0x3d51a6['type'],_0x481322);_0x22197d[_0x5b9896](_0x4277cd[_0x623a('0x66')],_0x4277cd[_0x623a('0x57')][_0x623a('0x60')],_0x4277cd[_0x623a('0x57')][_0x623a('0x1f')]);}}}else{var _0xcb0a0a=_(_0x1722c8[_0x623a('0x38')])[_0x623a('0x39')]()[_0x623a('0x2e')](function(_0x4e53e6){return _[_0x623a('0x68')](_0x2e84b8,[_0x623a('0x2c'),_0x4e53e6])?_0x4e53e6:undefined;})[_0x623a('0x69')]()[_0x623a('0x57')]();if(!_[_0x623a('0x6a')](_0xcb0a0a)){_0xcb0a0a['forEach'](function(_0x489665){if(_0x489665===_0x623a('0x6b')){_0x37390c[_0x623a('0x40')](_0x623a('0x6c'),[][_0x623a('0x6d')](_0x1722c8['query'][_0x489665]));}else if(_0x489665==='createdAt'){var _0x307f1f=JSON['parse'](_0x1722c8['query'][_0x489665])[_0x623a('0x6e')];var _0x40b70c=JSON[_0x623a('0x6f')](_0x1722c8[_0x623a('0x38')][_0x489665])[_0x623a('0x70')];_0x37390c['where'](_0x623a('0x71'),_0x307f1f,_0x40b70c);}else{if(_0x1722c8['query'][_0x489665]===_0x623a('0x72')){_0x37390c[_0x623a('0x40')]('i.'+_0x489665+'\x20IS\x20NULL');}else{_0x37390c[_0x623a('0x40')]('i.'+_0x489665+_0x623a('0x73'),_0x1722c8[_0x623a('0x38')][_0x489665]);}}});}if(_0x1722c8[_0x623a('0x38')]['read']){if(_0x1722c8['query'][_0x623a('0x74')]==0x1){_0x37390c[_0x623a('0x58')](_0x623a('0x75'));}else{_0x37390c[_0x623a('0x58')](_0x623a('0x76'));}}if(_0x1722c8[_0x623a('0x38')]['tag']){_0x218699=_[_0x623a('0x77')](_0x1722c8[_0x623a('0x38')][_0x623a('0x78')])?_0x1722c8[_0x623a('0x38')][_0x623a('0x78')]:new Array(_0x1722c8['query'][_0x623a('0x78')]);_0x218699[_0x623a('0x62')](function(_0x40125e){_0x2a6d8c['or'](_0x623a('0x63'),'%,'+_0x40125e+',%');});}if(_0x1722c8[_0x623a('0x38')][_0x623a('0x79')]){var _0x58a81c=_0x1722c8[_0x623a('0x38')]['filter'][_0x623a('0x7a')]('\x5c','\x5c\x5c')[_0x623a('0x7a')]('\x27\x27',_0x623a('0x7b'));if(qs[_0x623a('0x7c')](_0x58a81c)){_0x22197d['or'](_0x623a('0x7d'),_0x58a81c+'%');}else{_0x22197d['or'](_0x623a('0x7e'),qs[_0x623a('0x7f')](_0x58a81c))['or'](_0x623a('0x80'),_0x58a81c+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x58a81c+'%');}}}_0x37390c[_0x623a('0x40')](_0x22197d);_0x37390c[_0x623a('0x81')]('i.id');var _0x4ac877={'type':db['Sequelize'][_0x623a('0x82')][_0x623a('0x83')],'raw':!![]};var _0x1c13d7=_0x37390c[_0x623a('0x84')]();_0x1c13d7[_0x623a('0x42')](_0x623a('0x85'));_0x1c13d7[_0x623a('0x42')](_0x623a('0x86'),_0x623a('0x56'));if(_0x47a3ec[_0x623a('0x3e')]){_0x47a3ec[_0x623a('0x3e')][_0x623a('0x62')](function(_0x2cb336){_0x37390c['order']('i.'+_0x2cb336[0x0],_0x2cb336[0x1]===_0x623a('0x87')?![]:!![]);});}if(!_[_0x623a('0x6a')](_0x218699)){_0x37390c[_0x623a('0x58')](_0x2a6d8c);_0x1c13d7[_0x623a('0x40')]('t.id\x20IN\x20?',_0x218699);}BPromise['resolve']()[_0x623a('0x29')](function(){if(!_0x2d01b6){if(_0x1722c8[_0x623a('0x38')][_0x623a('0x6b')]||_0x1722c8[_0x623a('0x38')]['journey'])return;_0x1c13d7[_0x623a('0x40')](_0x623a('0x88'));_0x37390c[_0x623a('0x40')](_0x623a('0x88'));return;}return _0x1722c8[_0x623a('0x89')][_0x623a('0x8a')]({'attributes':['id'],'raw':!![]})[_0x623a('0x29')](function(_0x186e5d){if(_[_0x623a('0x6a')](_0x186e5d)){_0x1c13d7[_0x623a('0x40')](_0x623a('0x8b'));_0x37390c[_0x623a('0x40')](_0x623a('0x8b'));}else{_0x1c13d7['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x623a('0x2e')](_0x186e5d,'id'));_0x37390c[_0x623a('0x40')](_0x623a('0x6c'),_[_0x623a('0x2e')](_0x186e5d,'id'));}});})[_0x623a('0x29')](function(){db['sequelize'][_0x623a('0x38')](_0x1c13d7[_0x623a('0x8c')](),_0x4ac877)['then'](function(_0x10487e){_0x798229[_0x623a('0x8d')]=_0x10487e[_0x623a('0x5c')];if(_0x798229[_0x623a('0x8d')]===0x0)return[];return db['sequelize'][_0x623a('0x38')](_0x2be299['toString'](),_0x4ac877)[_0x623a('0x29')](function(_0x45061d){_0x24e0a9=_[_0x623a('0x8e')](_0x45061d,'id');_0x4ac877=_[_0x623a('0x8f')](_0x4ac877,{'model':db[_0x623a('0x90')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1722c8[_0x623a('0x38')][_0x623a('0x91')]){_0x47a3ec[_0x623a('0x3c')][_0x623a('0x62')](function(_0x5bb0b8){_0x37390c['field']('i.'+_0x5bb0b8);});}else{_0x37390c[_0x623a('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x623a('0x56'));_0x37390c[_0x623a('0x42')](_0x623a('0x92'),_0x623a('0x93'));_0x37390c[_0x623a('0x42')](_0x623a('0x94'),_0x623a('0x95'));_0x37390c[_0x623a('0x42')](_0x623a('0x96'));_0x37390c[_0x623a('0x42')](_0x623a('0x97'),_0x623a('0x98'));_0x37390c[_0x623a('0x42')](_0x623a('0x99'),'Contact.lastName');_0x37390c[_0x623a('0x42')]('c.email',_0x623a('0x9a'));_0x37390c[_0x623a('0x42')](_0x623a('0x9b'),_0x623a('0x9c'));_0x37390c[_0x623a('0x42')]('c.mobile',_0x623a('0x9d'));_0x37390c['field'](_0x623a('0x9e'),_0x623a('0x9f'));_0x37390c['field'](_0x623a('0xa0'),_0x623a('0xa1'));_0x37390c['field'](_0x623a('0xa2'),_0x623a('0xa3'));_0x37390c[_0x623a('0x42')](_0x623a('0xa4'),'TagIds');}if(_0x47a3ec[_0x623a('0x22')])_0x37390c[_0x623a('0x22')](_0x47a3ec[_0x623a('0x22')]);if(_0x47a3ec[_0x623a('0x21')])_0x37390c['offset'](_0x47a3ec[_0x623a('0x21')]);return db['sequelize'][_0x623a('0x38')](_0x37390c[_0x623a('0x8c')](),_0x4ac877);})[_0x623a('0x29')](function(_0xcec615){_0x81e56d[_0x623a('0x40')](_0x623a('0xa5'),_[_0x623a('0x2e')](_0xcec615,'id'));return db[_0x623a('0xa6')][_0x623a('0x38')](_0x81e56d[_0x623a('0x8c')](),_0x4ac877)[_0x623a('0x29')](function(_0x5f163c){var _0x3c1ba7=_['groupBy'](_0x5f163c,'OpenchannelInteractionId');var _0x1dfe82=[];_0xcec615['forEach'](function(_0x4e5cda){_0x1dfe82[_0x623a('0xa7')](updateOpenchannelInteraction(_0x4e5cda,_0x24e0a9,_0x3c1ba7));});return BPromise['all'](_0x1dfe82);});});})['then'](function(_0x299cce){_0x798229[_0x623a('0xa8')]=_0x299cce;return _0x798229;})['then'](respondWithFilteredResult(_0x36a6d8,_0x47a3ec));})[_0x623a('0x33')](handleError(_0x36a6d8,null));};exports[_0x623a('0xa9')]=function(_0x33fa17,_0x4f97ed){var _0x1f3aa5={'raw':![],'where':{'id':_0x33fa17[_0x623a('0xaa')]['id']}},_0x52ee35={};_0x52ee35[_0x623a('0x37')]=_[_0x623a('0x39')](db['OpenchannelInteraction'][_0x623a('0x34')]);_0x52ee35[_0x623a('0x38')]=_[_0x623a('0x39')](_0x33fa17[_0x623a('0x38')]);_0x52ee35[_0x623a('0x3a')]=_[_0x623a('0x3b')](_0x52ee35[_0x623a('0x37')],_0x52ee35['query']);_0x1f3aa5[_0x623a('0x3c')]=_[_0x623a('0x3b')](_0x52ee35[_0x623a('0x37')],qs['fields'](_0x33fa17[_0x623a('0x38')][_0x623a('0x91')]));_0x1f3aa5['attributes']=_0x1f3aa5[_0x623a('0x3c')][_0x623a('0x5c')]?_0x1f3aa5[_0x623a('0x3c')]:_0x52ee35[_0x623a('0x37')];if(_0x33fa17[_0x623a('0x38')][_0x623a('0xab')]){_0x1f3aa5['include']=[{'all':!![]}];}_0x1f3aa5=_['merge']({},_0x1f3aa5,_0x33fa17[_0x623a('0xac')]);return db[_0x623a('0x90')]['find'](_0x1f3aa5)[_0x623a('0x29')](handleEntityNotFound(_0x4f97ed,null))[_0x623a('0x29')](respondWithResult(_0x4f97ed,null))[_0x623a('0x33')](handleError(_0x4f97ed,null));};exports[_0x623a('0xad')]=function(_0x2b79ef,_0x70ddcc){return db[_0x623a('0x90')][_0x623a('0xad')](_0x2b79ef[_0x623a('0x67')],{})['then'](respondWithResult(_0x70ddcc,0xc9))[_0x623a('0x33')](handleError(_0x70ddcc,null));};exports[_0x623a('0x28')]=function(_0x1eb45b,_0x3a1412){if(_0x1eb45b[_0x623a('0x67')]['id']){delete _0x1eb45b[_0x623a('0x67')]['id'];}return db[_0x623a('0x90')][_0x623a('0x55')]({'where':{'id':_0x1eb45b[_0x623a('0xaa')]['id']}})[_0x623a('0x29')](handleEntityNotFound(_0x3a1412,null))['then'](saveUpdates(_0x1eb45b['body'],null))[_0x623a('0x29')](respondWithResult(_0x3a1412,null))['catch'](handleError(_0x3a1412,null));};exports[_0x623a('0x2a')]=function(_0x3f8ccb,_0x573f67){return db['OpenchannelInteraction']['find']({'where':{'id':_0x3f8ccb[_0x623a('0xaa')]['id']}})['then'](handleEntityNotFound(_0x573f67,null))['then'](removeEntity(_0x573f67,null))['catch'](handleError(_0x573f67,null));};exports[_0x623a('0xae')]=function(_0x4a6119,_0x5c8ddf){return db['OpenchannelInteraction']['describe']()[_0x623a('0x29')](respondWithResult(_0x5c8ddf,null))[_0x623a('0x33')](handleError(_0x5c8ddf,null));};exports['addMessage']=function(_0x30dc73,_0x180a73,_0x1f7a90){return db['OpenchannelMessage']['find']({'where':{'id':_0x30dc73['params']['id']}})['then'](handleEntityNotFound(_0x180a73,null))[_0x623a('0x29')](function(_0x10e29c){if(_0x10e29c){return _0x10e29c[_0x623a('0xaf')](_0x30dc73[_0x623a('0x67')][_0x623a('0xb0')],_[_0x623a('0xb1')](_0x30dc73['body'],[_0x623a('0xb0'),'id'])||{});}})['then'](respondWithResult(_0x180a73,null))[_0x623a('0x33')](handleError(_0x180a73,null));};exports[_0x623a('0xb2')]=function(_0x332e90,_0x33a48e,_0x32d0b7){var _0x2f10fc={'raw':![],'where':{}};var _0x9acf0c={};var _0x49fdd0={'count':0x0,'rows':[]};return db[_0x623a('0x90')][_0x623a('0xb3')]({'where':{'id':_0x332e90[_0x623a('0xaa')]['id']}})[_0x623a('0x29')](handleEntityNotFound(_0x33a48e,null))[_0x623a('0x29')](function(_0x59d9eb){if(_0x59d9eb){_0x9acf0c[_0x623a('0x37')]=_['keys'](db[_0x623a('0xb4')][_0x623a('0x34')]);_0x9acf0c[_0x623a('0x38')]=_[_0x623a('0x39')](_0x332e90[_0x623a('0x38')]);_0x9acf0c[_0x623a('0x3a')]=_[_0x623a('0x3b')](_0x9acf0c[_0x623a('0x37')],_0x9acf0c[_0x623a('0x38')]);_0x2f10fc[_0x623a('0x3c')]=_[_0x623a('0x3b')](_0x9acf0c[_0x623a('0x37')],qs[_0x623a('0x91')](_0x332e90[_0x623a('0x38')]['fields']));_0x2f10fc[_0x623a('0x3c')]=_0x2f10fc[_0x623a('0x3c')]['length']?_0x2f10fc['attributes']:_0x9acf0c['model'];if(!_0x332e90[_0x623a('0x38')][_0x623a('0xb5')](_0x623a('0x3d'))){_0x2f10fc[_0x623a('0x22')]=qs[_0x623a('0x22')](_0x332e90[_0x623a('0x38')][_0x623a('0x22')]);_0x2f10fc[_0x623a('0x21')]=qs[_0x623a('0x21')](_0x332e90[_0x623a('0x38')][_0x623a('0x21')]);}_0x2f10fc[_0x623a('0x3e')]=qs[_0x623a('0x3f')](_0x332e90['query'][_0x623a('0x3f')]);_0x2f10fc['where']=qs[_0x623a('0x3a')](_[_0x623a('0xb6')](_0x332e90[_0x623a('0x38')],_0x9acf0c[_0x623a('0x3a')]));_0x2f10fc[_0x623a('0x40')][_0x623a('0xb7')]=_0x59d9eb['id'];if(_0x332e90[_0x623a('0x38')][_0x623a('0x79')]){_0x2f10fc[_0x623a('0x40')]=_[_0x623a('0x8f')](_0x2f10fc['where'],{'$or':_[_0x623a('0x2e')](_0x2f10fc['attributes'],function(_0x58ca13){var _0x2b85e0={};_0x2b85e0[_0x58ca13]={'$like':'%'+_0x332e90[_0x623a('0x38')][_0x623a('0x79')]+'%'};return _0x2b85e0;})});}if(_0x332e90[_0x623a('0x38')]['$gte']){var _0x4db0a8=_0x332e90[_0x623a('0x38')]['$gte']['split'](',');var _0x13a5fc={};_0x13a5fc[_0x4db0a8[0x0]]={'$gte':moment(_0x4db0a8[0x1])[_0x623a('0xb8')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2f10fc['where']=_[_0x623a('0x8f')](_0x2f10fc[_0x623a('0x40')],_0x13a5fc);}_0x2f10fc=_[_0x623a('0x8f')]({},_0x2f10fc,_0x332e90[_0x623a('0xac')]);return db[_0x623a('0xb4')][_0x623a('0x8d')]({'where':_0x2f10fc['where']})[_0x623a('0x29')](function(_0xed77bf){_0x49fdd0[_0x623a('0x8d')]=_0xed77bf;if(_0x332e90['query']['includeAll']){_0x2f10fc['include']=[{'all':!![]}];}return db[_0x623a('0xb4')]['findAll'](_0x2f10fc);})[_0x623a('0x29')](function(_0x591662){_0x49fdd0[_0x623a('0xa8')]=_0x591662;return _0x49fdd0;});}})[_0x623a('0x29')](respondWithFilteredResult(_0x33a48e,_0x2f10fc))['catch'](handleError(_0x33a48e,null));};exports[_0x623a('0xb9')]=function(_0x1cbfae,_0x409b53,_0x48f36e){return db[_0x623a('0x90')][_0x623a('0x55')]({'where':{'id':_0x1cbfae[_0x623a('0xaa')]['id']}})['then'](handleEntityNotFound(_0x409b53,null))[_0x623a('0x29')](function(_0x3e4d3b){if(_0x3e4d3b){return _0x3e4d3b[_0x623a('0xba')](_0x1cbfae['body'][_0x623a('0xb0')],_[_0x623a('0xb1')](_0x1cbfae[_0x623a('0x67')],[_0x623a('0xb0'),'id'])||{})[_0x623a('0xbb')](function(){return db[_0x623a('0x61')]['findAll']({'attributes':['id',_0x623a('0x2c'),_0x623a('0xbc')],'where':{'id':_0x1cbfae[_0x623a('0x67')][_0x623a('0xb0')]}});})[_0x623a('0x29')](function(_0x26ac14){socket[_0x623a('0xbd')](_0x623a('0xbe'),{'id':Number(_0x1cbfae[_0x623a('0xaa')]['id']),'tags':_0x26ac14||[]});return{'id':Number(_0x1cbfae[_0x623a('0xaa')]['id']),'tags':_0x26ac14||[]};});}})['then'](respondWithResult(_0x409b53,null))[_0x623a('0x33')](handleError(_0x409b53,null));};exports[_0x623a('0xbf')]=function(_0x282335,_0x587567,_0x56f618){return db[_0x623a('0x90')]['find']({'where':{'id':_0x282335[_0x623a('0xaa')]['id']}})[_0x623a('0x29')](handleEntityNotFound(_0x587567,null))[_0x623a('0x29')](function(_0x550c66){if(_0x550c66){return _0x550c66['removeTags'](_0x282335[_0x623a('0x38')][_0x623a('0xb0')]);}})['then'](respondWithStatusCode(_0x587567,null))['catch'](handleError(_0x587567,null));};exports[_0x623a('0xc0')]=function(_0xd5a253,_0x2dd2a6){var _0x27d721=moment()[_0x623a('0xc1')]()[_0x623a('0x8c')]();var _0x30d59f=path[_0x623a('0xc2')](config['root'],_0x623a('0xc3'),_0x623a('0xc4'),_0x623a('0xc5'));var _0x4ec425=path[_0x623a('0xc2')](config[_0x623a('0xc6')],_0x623a('0xc3'),_0x623a('0xc4'),'attachments');var _0x168149=path['join'](_0x30d59f,_0x27d721);var _0x434472=util[_0x623a('0xb8')](_0x623a('0xc7'),_0xd5a253['params']['id'],_0x27d721);var _0x293eb0=path[_0x623a('0xc2')](_0x30d59f,_0x434472);var _0xed7b11=[];_0xed7b11[_0x623a('0xa7')]({'model':db[_0x623a('0xc8')],'as':_0x623a('0xc8'),'attributes':['id',_0x623a('0x2f')],'raw':!![]});_0xed7b11['push']({'model':db[_0x623a('0xc9')],'as':_0x623a('0xca'),'attributes':['id',_0x623a('0xcb'),_0x623a('0xcc')],'raw':!![]});if(_0xd5a253[_0x623a('0x38')][_0x623a('0xcd')]){_0xed7b11['push']({'model':db[_0x623a('0xce')],'as':_0x623a('0xce'),'raw':!![]});}var _0x31da2a=[{'model':db[_0x623a('0xb4')],'as':_0x623a('0xcf'),'attributes':['id','body','createdAt',_0x623a('0xd0'),'secret',_0x623a('0x74')],'include':_0xed7b11}];_0x31da2a[_0x623a('0xa7')]({'model':db[_0x623a('0xd1')],'as':_0x623a('0xd2'),'attributes':['id',_0x623a('0x2c')]});_0x31da2a[_0x623a('0xa7')]({'model':db['User'],'as':_0x623a('0xd3'),'attributes':['id',_0x623a('0x2f')]});return db['OpenchannelInteraction'][_0x623a('0x55')]({'where':{'id':_0xd5a253[_0x623a('0xaa')]['id']},'include':_0x31da2a})[_0x623a('0x29')](handleEntityNotFound(_0x2dd2a6,null))[_0x623a('0x29')](function(_0x5edce7){if(_0x5edce7){var _0x4569ed=_0x5edce7[_0x623a('0xd4')]({'plain':!![]});fs['mkdirSync'](_0x168149);var _0x17221d={'format':'A4','border':_0x623a('0xd5'),'header':{'height':_0x623a('0xd6'),'contents':{'first':_0x623a('0xd7')}},'footer':{'height':'30px','contents':{'default':util[_0x623a('0xb8')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x623a('0xb8')](_0x623a('0xd8'),_0x623a('0xd9'),_0x4569ed['id']),moment()[_0x623a('0xb8')]('YYYY-MM-DD')[_0x623a('0x8c')]())}}};var _0x4fbe41={'channel':_0x623a('0xd9'),'account':_0x4569ed[_0x623a('0xd2')]['name'],'agent':_0x4569ed[_0x623a('0xd3')]?_0x4569ed[_0x623a('0xd3')][_0x623a('0x2f')]:_0x623a('0xda'),'createdAt':moment(_0x4569ed['createdAt'])[_0x623a('0xb8')](_0x623a('0xdb'))[_0x623a('0x8c')](),'closedAt':_0x4569ed[_0x623a('0xdc')]?moment(_0x4569ed[_0x623a('0xdd')])[_0x623a('0xb8')](_0x623a('0xdb'))[_0x623a('0x8c')]():'','disposition':_0x4569ed['disposition'],'visibility':_0x4569ed['threadId']?_0x623a('0xde'):'Private','messages':_(_0x4569ed['Messages'])[_0x623a('0x79')]({'secret':![]})['map'](function(_0x483260){if(_0x483260[_0x623a('0xce')]){var _0x261a9f=path[_0x623a('0xc2')](_0x4ec425,_0x483260['Attachment'][_0x623a('0xdf')]);if(fs['existsSync'](_0x261a9f)){fs[_0x623a('0xe0')](_0x261a9f)[_0x623a('0xe1')](fs[_0x623a('0xe2')](path[_0x623a('0xc2')](_0x168149,_0x483260[_0x623a('0xce')]['basename'])));}}return{'date':moment(_0x483260['createdAt'])[_0x623a('0xb8')](_0x623a('0xdb'))[_0x623a('0x8c')](),'sender':_0x483260[_0x623a('0xd0')]==='out'?_0x483260[_0x623a('0xc8')]?_0x483260[_0x623a('0xc8')][_0x623a('0x2f')]:_0x623a('0xe3'):_0x483260['Contact']['firstName']+(_0x483260[_0x623a('0xca')][_0x623a('0xcc')]?'\x20'+_0x483260[_0x623a('0xca')]['lastName']:''),'body':_0x483260[_0x623a('0xce')]?_0x483260['Attachment'][_0x623a('0xdf')]:_0x483260[_0x623a('0x67')],'direction':_0x483260['direction']===_0x623a('0xe4')?'A':'C','secret':_0x483260['secret'],'read':_0x483260[_0x623a('0x74')],'attachment':_0x483260[_0x623a('0xce')]};})[_0x623a('0x57')]()};return ejs[_0x623a('0xe5')](path[_0x623a('0xc2')](config[_0x623a('0xc6')],'server',_0x623a('0xe6'),'downloadInteraction.html'),{'interaction':_0x4fbe41})[_0x623a('0x29')](function(_0x3f7aa4){return new BPromise(function(_0x5da766,_0x5768bc){pdf['create'](_0x3f7aa4,_0x17221d)['toFile'](path[_0x623a('0xc2')](_0x168149,_0x623a('0xe7')+_0x4569ed['id']+'-'+_0x27d721+'.pdf'),function(_0x503576,_0xd099e5){if(_0x503576)return _0x5768bc(_0x503576);_0x5da766(_0xd099e5);});});})[_0x623a('0x29')](function(){return new BPromise(function(_0x5df27d,_0x4b85a9){zipdir(_0x168149,{'saveTo':_0x293eb0},function(_0x5759dd,_0x4c8ffe){if(_0x5759dd)return _0x4b85a9(_0x5759dd);return _0x5df27d(_0x4c8ffe);});})[_0x623a('0x29')](function(){return new BPromise(function(_0x563aaf,_0x398cf0){rimraf(_0x168149,function(_0x2368d9){if(_0x2368d9)_0x398cf0(_0x2368d9);return _0x563aaf();});});})[_0x623a('0x29')](function(){return _0x2dd2a6['download'](_0x293eb0,_0x434472,function(_0x4236b9){if(_0x4236b9){console[_0x623a('0xe8')](_0x623a('0xe9'),_0x4236b9);}else{fs[_0x623a('0xea')](_0x293eb0);}});});});}else{return _0x2dd2a6['sendStatus'](0xc8);}})[_0x623a('0x33')](handleError(_0x2dd2a6,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index d2c7f53..6971ab6 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 _0xef8d=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch'];(function(_0x27a3cb,_0x4af597){var _0x54ff38=function(_0x3a82d2){while(--_0x3a82d2){_0x27a3cb['push'](_0x27a3cb['shift']());}};_0x54ff38(++_0x4af597);}(_0xef8d,0x1cb));var _0xdef8=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xef8d[_0x5f309e];return _0x487b5e;};'use strict';var EventEmitter=require(_0xdef8('0x0'));var OpenchannelInteraction=require(_0xdef8('0x1'))['db'][_0xdef8('0x2')];var OpenchannelMessage=require(_0xdef8('0x1'))['db'][_0xdef8('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xdef8('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdef8('0x5'),'afterDestroy':_0xdef8('0x6')};function emitEvent(_0xc03d34){return function(_0x1139e9,_0x550edb,_0x2c9846){_0x1139e9[_0xdef8('0x7')]({'attributes':['id'],'raw':!![]})[_0xdef8('0x8')](function(_0x40eb45){_0x1139e9[_0xdef8('0x9')](_0xdef8('0xa'),_0x40eb45[_0xdef8('0xb')](function(_0x277bfe){return{'id':_0x277bfe['id']};}));return OpenchannelMessage[_0xdef8('0xc')]({'where':{'OpenchannelInteractionId':_0x1139e9['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x42ff91){_0x1139e9['setDataValue']('unreadMessages',_0x42ff91[_0xdef8('0xd')]);OpenchannelInteractionEvents[_0xdef8('0xe')](_0xc03d34+':'+_0x1139e9['id'],_0x1139e9);OpenchannelInteractionEvents[_0xdef8('0xe')](_0xc03d34,_0x1139e9);_0x2c9846(null);})[_0xdef8('0xf')](_0x2c9846(null));};}for(var e in events){if(events[_0xdef8('0x10')](e)){var event=events[e];OpenchannelInteraction[_0xdef8('0x11')](e,emitEvent(event));}}module[_0xdef8('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xeaee=['emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','update','remove','getUsers','then','setDataValue','Users','map','findAll','length'];(function(_0x438fe1,_0x3308d5){var _0x3c8e1b=function(_0x2f8d41){while(--_0x2f8d41){_0x438fe1['push'](_0x438fe1['shift']());}};_0x3c8e1b(++_0x3308d5);}(_0xeaee,0x114));var _0xeeae=function(_0x4e2313,_0x3083d3){_0x4e2313=_0x4e2313-0x0;var _0x1059ef=_0xeaee[_0x4e2313];return _0x1059ef;};'use strict';var EventEmitter=require(_0xeeae('0x0'));var OpenchannelInteraction=require(_0xeeae('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xeeae('0x1'))['db'][_0xeeae('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xeeae('0x3'),'afterDestroy':_0xeeae('0x4')};function emitEvent(_0x5b6ecb){return function(_0x594d88,_0x4e689b,_0x3f3266){_0x594d88[_0xeeae('0x5')]({'attributes':['id'],'raw':!![]})[_0xeeae('0x6')](function(_0x25d9c0){_0x594d88[_0xeeae('0x7')](_0xeeae('0x8'),_0x25d9c0[_0xeeae('0x9')](function(_0x5d2bc2){return{'id':_0x5d2bc2['id']};}));return OpenchannelMessage[_0xeeae('0xa')]({'where':{'OpenchannelInteractionId':_0x594d88['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x424fc7){_0x594d88[_0xeeae('0x7')]('unreadMessages',_0x424fc7[_0xeeae('0xb')]);OpenchannelInteractionEvents['emit'](_0x5b6ecb+':'+_0x594d88['id'],_0x594d88);OpenchannelInteractionEvents[_0xeeae('0xc')](_0x5b6ecb,_0x594d88);_0x3f3266(null);})[_0xeeae('0xd')](_0x3f3266(null));};}for(var e in events){if(events[_0xeeae('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xeeae('0xf')](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 3335788..46e7efd 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 _0x9fd4=['moment','bluebird','request-promise','path','rimraf','exports','define','openchannel_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0xfd5c29,_0x4478cf){var _0x4fc661=function(_0x5d13cb){while(--_0x5d13cb){_0xfd5c29['push'](_0xfd5c29['shift']());}};_0x4fc661(++_0x4478cf);}(_0x9fd4,0x16c));var _0x49fd=function(_0x2ffc98,_0x5a0140){_0x2ffc98=_0x2ffc98-0x0;var _0x1bb50a=_0x9fd4[_0x2ffc98];return _0x1bb50a;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var logger=require(_0x49fd('0x2'))(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var BPromise=require(_0x49fd('0x5'));var rp=require(_0x49fd('0x6'));var fs=require('fs');var path=require(_0x49fd('0x7'));var rimraf=require(_0x49fd('0x8'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0x49fd('0x9')]=function(_0x42fdc7,_0x1bc16e){return _0x42fdc7[_0x49fd('0xa')]('OpenchannelInteraction',attributes,{'tableName':_0x49fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x461ac1,_0x36f605,_0x3bf3fd){if(_0x461ac1[_0x49fd('0xc')]('closed')){_0x461ac1[_0x49fd('0xd')]=moment()[_0x49fd('0xe')](_0x49fd('0xf'));}_0x3bf3fd(null,_0x461ac1);}}});}; \ No newline at end of file +var _0x1670=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise','path','rimraf','exports','define','OpenchannelInteraction','openchannel_interactions'];(function(_0x3d0d2d,_0x8323f5){var _0x59cde7=function(_0xee9bfe){while(--_0xee9bfe){_0x3d0d2d['push'](_0x3d0d2d['shift']());}};_0x59cde7(++_0x8323f5);}(_0x1670,0x9a));var _0x0167=function(_0x391e97,_0x3dad87){_0x391e97=_0x391e97-0x0;var _0x5a8a09=_0x1670[_0x391e97];return _0x5a8a09;};'use strict';var _=require(_0x0167('0x0'));var util=require(_0x0167('0x1'));var logger=require('../../config/logger')(_0x0167('0x2'));var moment=require('moment');var BPromise=require(_0x0167('0x3'));var rp=require(_0x0167('0x4'));var fs=require('fs');var path=require(_0x0167('0x5'));var rimraf=require(_0x0167('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0x0167('0x7')]=function(_0x1ae650,_0x295e51){return _0x1ae650[_0x0167('0x8')](_0x0167('0x9'),attributes,{'tableName':_0x0167('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xcdfc5,_0x416079,_0x5e9ba9){if(_0xcdfc5['changed'](_0x0167('0xb'))){_0xcdfc5[_0x0167('0xc')]=moment()[_0x0167('0xd')](_0x0167('0xe'));}_0x5e9ba9(null,_0xcdfc5);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 6f25d4a..9302806 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 _0xeb41=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0xeb41,0xac));var _0x1eb4=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xeb41[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x1eb4('0x0'));var util=require(_0x1eb4('0x1'));var moment=require(_0x1eb4('0x2'));var BPromise=require(_0x1eb4('0x3'));var rs=require(_0x1eb4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1eb4('0x5'))['db'];var utils=require(_0x1eb4('0x6'));var logger=require('../../config/logger')(_0x1eb4('0x7'));var config=require(_0x1eb4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1eb4('0x9')]({'port':0x232a});config[_0x1eb4('0xa')]=_[_0x1eb4('0xb')](config[_0x1eb4('0xa')],{'host':_0x1eb4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1eb4('0xd'))[_0x1eb4('0xe')](socket);function respondWithRpcPromise(_0x5e557c,_0x1510b2,_0x1ae81c){return new BPromise(function(_0x2b25ec,_0x2357b7){return client[_0x1eb4('0xf')](_0x5e557c,_0x1ae81c)[_0x1eb4('0x10')](function(_0x1dc223){logger[_0x1eb4('0x11')](_0x1eb4('0x12'),_0x1510b2,_0x1eb4('0x13'));logger[_0x1eb4('0x14')](_0x1eb4('0x15'),_0x1510b2,_0x1eb4('0x13'),JSON[_0x1eb4('0x16')](_0x1dc223));if(_0x1dc223['error']){if(_0x1dc223['error'][_0x1eb4('0x17')]===0x1f4){logger[_0x1eb4('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1510b2,_0x1dc223['error'][_0x1eb4('0x19')]);return _0x2357b7(_0x1dc223[_0x1eb4('0x18')]['message']);}logger[_0x1eb4('0x18')](_0x1eb4('0x12'),_0x1510b2,_0x1dc223[_0x1eb4('0x18')][_0x1eb4('0x19')]);return _0x2b25ec(_0x1dc223['error'][_0x1eb4('0x19')]);}else{logger[_0x1eb4('0x11')](_0x1eb4('0x12'),_0x1510b2,'request\x20sent');_0x2b25ec(_0x1dc223[_0x1eb4('0x1a')]['message']);}})[_0x1eb4('0x1b')](function(_0x462ee3){logger[_0x1eb4('0x18')](_0x1eb4('0x12'),_0x1510b2,_0x462ee3);_0x2357b7(_0x462ee3);});});}exports[_0x1eb4('0x1c')]=function(_0x886e6d){var _0x7d8718=this;return new Promise(function(_0x3dcf2a,_0x57006f){return db[_0x1eb4('0x1d')][_0x1eb4('0x1e')](_0x886e6d[_0x1eb4('0x1f')],{'raw':_0x886e6d[_0x1eb4('0x20')]?_0x886e6d[_0x1eb4('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x886e6d['options']?_0x886e6d[_0x1eb4('0x20')][_0x1eb4('0x21')]||null:null,'attributes':_0x886e6d[_0x1eb4('0x20')]?_0x886e6d['options'][_0x1eb4('0x22')]||null:null,'limit':_0x886e6d[_0x1eb4('0x20')]?_0x886e6d[_0x1eb4('0x20')][_0x1eb4('0x23')]||null:null})[_0x1eb4('0x10')](function(_0x545b20){logger[_0x1eb4('0x11')](_0x1eb4('0x1c'),_0x886e6d);logger[_0x1eb4('0x14')](_0x1eb4('0x1c'),_0x886e6d,JSON[_0x1eb4('0x16')](_0x545b20));_0x3dcf2a(_0x545b20);})[_0x1eb4('0x1b')](function(_0x1d050b){logger[_0x1eb4('0x18')](_0x1eb4('0x1c'),_0x1d050b[_0x1eb4('0x19')],_0x886e6d);_0x57006f(_0x7d8718[_0x1eb4('0x18')](0x1f4,_0x1d050b['message']));});});};exports[_0x1eb4('0x24')]=function(_0x5baae1){return new Promise(function(_0x152d79,_0xe892b2){return db[_0x1eb4('0x1d')][_0x1eb4('0x25')]({'where':_0x5baae1[_0x1eb4('0x20')]?_0x5baae1['options'][_0x1eb4('0x21')]||null:null})['then'](function(_0x572204){if(_0x572204){return _0x572204[_0x1eb4('0x26')](_0x5baae1[_0x1eb4('0x1f')][_0x1eb4('0x27')],_[_0x1eb4('0x28')](_0x5baae1[_0x1eb4('0x1f')],[_0x1eb4('0x27'),'id'])||{});}})[_0x1eb4('0x29')](function(_0x50ebfb){logger[_0x1eb4('0x11')]('AddTags',_0x5baae1);logger['debug'](_0x1eb4('0x2a'),_0x5baae1,JSON[_0x1eb4('0x16')](_0x50ebfb));_0x152d79(_0x50ebfb);})[_0x1eb4('0x1b')](function(_0x1fbf20){logger[_0x1eb4('0x18')](_0x1eb4('0x2a'),_0x1fbf20['message'],_0x5baae1);_0xe892b2(_this[_0x1eb4('0x18')](0x1f4,_0x1fbf20[_0x1eb4('0x19')]));});});}; \ No newline at end of file +var _0xb472=['register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','OpenchannelInteraction','update','options','raw','attributes','limit','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','find','where','addTags','body','ids','omit','spread','AddTags','debug','lodash','util','moment','bluebird','../../config/environment','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb472,0x155));var _0x2b47=function(_0x351fdf,_0xf08cf5){_0x351fdf=_0x351fdf-0x0;var _0x126917=_0xb472[_0x351fdf];return _0x126917;};'use strict';var _=require(_0x2b47('0x0'));var util=require(_0x2b47('0x1'));var moment=require(_0x2b47('0x2'));var BPromise=require(_0x2b47('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2b47('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2b47('0x5')]({'port':0x232a});config[_0x2b47('0x6')]=_[_0x2b47('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2b47('0x8'))(new Redis(config[_0x2b47('0x6')]));require(_0x2b47('0x9'))[_0x2b47('0xa')](socket);function respondWithRpcPromise(_0x46de97,_0x122741,_0x38d1d4){return new BPromise(function(_0x4ae8b1,_0x45dce4){return client[_0x2b47('0xb')](_0x46de97,_0x38d1d4)[_0x2b47('0xc')](function(_0x4e6aac){logger[_0x2b47('0xd')](_0x2b47('0xe'),_0x122741,_0x2b47('0xf'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x122741,_0x2b47('0xf'),JSON[_0x2b47('0x10')](_0x4e6aac));if(_0x4e6aac[_0x2b47('0x11')]){if(_0x4e6aac[_0x2b47('0x11')][_0x2b47('0x12')]===0x1f4){logger[_0x2b47('0x11')](_0x2b47('0xe'),_0x122741,_0x4e6aac[_0x2b47('0x11')]['message']);return _0x45dce4(_0x4e6aac[_0x2b47('0x11')][_0x2b47('0x13')]);}logger['error'](_0x2b47('0xe'),_0x122741,_0x4e6aac[_0x2b47('0x11')]['message']);return _0x4ae8b1(_0x4e6aac[_0x2b47('0x11')]['message']);}else{logger['info'](_0x2b47('0xe'),_0x122741,_0x2b47('0xf'));_0x4ae8b1(_0x4e6aac[_0x2b47('0x14')][_0x2b47('0x13')]);}})['catch'](function(_0x979222){logger[_0x2b47('0x11')](_0x2b47('0xe'),_0x122741,_0x979222);_0x45dce4(_0x979222);});});}exports['UpdateOpenchannelInteraction']=function(_0x553c23){var _0x4ea854=this;return new Promise(function(_0x57b30f,_0x727ef0){return db[_0x2b47('0x15')][_0x2b47('0x16')](_0x553c23['body'],{'raw':_0x553c23[_0x2b47('0x17')]?_0x553c23['options'][_0x2b47('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x553c23[_0x2b47('0x17')]?_0x553c23['options']['where']||null:null,'attributes':_0x553c23[_0x2b47('0x17')]?_0x553c23[_0x2b47('0x17')][_0x2b47('0x19')]||null:null,'limit':_0x553c23['options']?_0x553c23['options'][_0x2b47('0x1a')]||null:null})[_0x2b47('0xc')](function(_0x20d53a){logger[_0x2b47('0xd')](_0x2b47('0x1b'),_0x553c23);logger['debug'](_0x2b47('0x1b'),_0x553c23,JSON[_0x2b47('0x10')](_0x20d53a));_0x57b30f(_0x20d53a);})[_0x2b47('0x1c')](function(_0x54410a){logger[_0x2b47('0x11')](_0x2b47('0x1b'),_0x54410a[_0x2b47('0x13')],_0x553c23);_0x727ef0(_0x4ea854[_0x2b47('0x11')](0x1f4,_0x54410a[_0x2b47('0x13')]));});});};exports[_0x2b47('0x1d')]=function(_0x3c9653){return new Promise(function(_0x6d8b81,_0x58e397){return db[_0x2b47('0x15')][_0x2b47('0x1e')]({'where':_0x3c9653['options']?_0x3c9653[_0x2b47('0x17')][_0x2b47('0x1f')]||null:null})[_0x2b47('0xc')](function(_0x306236){if(_0x306236){return _0x306236[_0x2b47('0x20')](_0x3c9653[_0x2b47('0x21')][_0x2b47('0x22')],_[_0x2b47('0x23')](_0x3c9653[_0x2b47('0x21')],[_0x2b47('0x22'),'id'])||{});}})[_0x2b47('0x24')](function(_0x19b88c){logger['info'](_0x2b47('0x25'),_0x3c9653);logger[_0x2b47('0x26')](_0x2b47('0x25'),_0x3c9653,JSON[_0x2b47('0x10')](_0x19b88c));_0x6d8b81(_0x19b88c);})['catch'](function(_0x3adc67){logger[_0x2b47('0x11')]('AddTags',_0x3adc67[_0x2b47('0x13')],_0x3c9653);_0x58e397(_this[_0x2b47('0x11')](0x1f4,_0x3adc67[_0x2b47('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 0557e05..e64b7a1 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 _0x49f9=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0x49f9,0x100));var _0x949f=function(_0x477aab,_0x4d08fd){_0x477aab=_0x477aab-0x0;var _0x2cd294=_0x49f9[_0x477aab];return _0x2cd294;};'use strict';var OpenchannelInteractionEvents=require(_0x949f('0x0'));var events=[_0x949f('0x1'),_0x949f('0x2'),_0x949f('0x3')];function createListener(_0xae1d4a,_0x5e0dc3){return function(_0x41de32){_0x5e0dc3[_0x949f('0x4')](_0xae1d4a,_0x41de32);};}function removeListener(_0x42e0f6,_0x2433af){return function(){OpenchannelInteractionEvents[_0x949f('0x5')](_0x42e0f6,_0x2433af);};}exports[_0x949f('0x6')]=function(_0x4b190d){for(var _0x2436ee=0x0,_0x168da8=events[_0x949f('0x7')];_0x2436ee<_0x168da8;_0x2436ee++){var _0x47486b=events[_0x2436ee];var _0x534da5=createListener(_0x949f('0x8')+_0x47486b,_0x4b190d);OpenchannelInteractionEvents['on'](_0x47486b,_0x534da5);}}; \ No newline at end of file +var _0xc8e4=['./openchannelInteraction.events','save','remove','removeListener','register','openchannelInteraction:'];(function(_0x1ae48a,_0x469f0d){var _0x5dcfd8=function(_0x353779){while(--_0x353779){_0x1ae48a['push'](_0x1ae48a['shift']());}};_0x5dcfd8(++_0x469f0d);}(_0xc8e4,0xf0));var _0x4c8e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc8e4[_0x20a584];return _0x4b41a8;};'use strict';var OpenchannelInteractionEvents=require(_0x4c8e('0x0'));var events=[_0x4c8e('0x1'),_0x4c8e('0x2'),'update'];function createListener(_0xe2fc03,_0x414c18){return function(_0xabb4f4){_0x414c18['emit'](_0xe2fc03,_0xabb4f4);};}function removeListener(_0xfbc4c6,_0x44530b){return function(){OpenchannelInteractionEvents[_0x4c8e('0x3')](_0xfbc4c6,_0x44530b);};}exports[_0x4c8e('0x4')]=function(_0x521f4a){for(var _0x11a7e7=0x0,_0x1e4a76=events['length'];_0x11a7e7<_0x1e4a76;_0x11a7e7++){var _0x2a24c7=events[_0x11a7e7];var _0x4f76b1=createListener(_0x4c8e('0x5')+_0x2a24c7,_0x521f4a);OpenchannelInteractionEvents['on'](_0x2a24c7,_0x4f76b1);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 585aac1..bb62327 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 _0x0091=['post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0xad1c72,_0xad63d3){var _0x177d06=function(_0x1e3bcb){while(--_0x1e3bcb){_0xad1c72['push'](_0xad1c72['shift']());}};_0x177d06(++_0xad63d3);}(_0x0091,0x129));var _0x1009=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0091[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1009('0x0'));var util=require(_0x1009('0x1'));var path=require(_0x1009('0x2'));var timeout=require(_0x1009('0x3'));var express=require(_0x1009('0x4'));var router=express[_0x1009('0x5')]();var auth=require(_0x1009('0x6'));var interaction=require(_0x1009('0x7'));var config=require('../../config/environment');var controller=require(_0x1009('0x8'));router[_0x1009('0x9')]('/',auth[_0x1009('0xa')](),controller[_0x1009('0xb')]);router[_0x1009('0x9')]('/describe',auth[_0x1009('0xa')](),controller[_0x1009('0xc')]);router[_0x1009('0x9')](_0x1009('0xd'),auth[_0x1009('0xa')](),controller[_0x1009('0xe')]);router[_0x1009('0xf')]('/',auth[_0x1009('0xa')](),interaction[_0x1009('0x10')](_0x1009('0x11'),_0x1009('0x12')),controller['create']);router[_0x1009('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x1009('0x14')]);router[_0x1009('0x13')](_0x1009('0x15'),auth[_0x1009('0xa')](),controller[_0x1009('0x16')]);router[_0x1009('0x13')]('/:id/reject',auth['isAuthenticated'](),controller[_0x1009('0x17')]);router[_0x1009('0x18')](_0x1009('0xd'),auth[_0x1009('0xa')](),controller['destroy']);module[_0x1009('0x19')]=router; \ No newline at end of file +var _0xbf1a=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','index','isAuthenticated','get','post','openchannel','create','put','/:id','update','/:id/accept','accept','reject','delete','destroy','multer'];(function(_0x4b6ccc,_0x146dc3){var _0x15e250=function(_0xef70d5){while(--_0xef70d5){_0x4b6ccc['push'](_0x4b6ccc['shift']());}};_0x15e250(++_0x146dc3);}(_0xbf1a,0x1a3));var _0xabf1=function(_0x44a87a,_0x584f7c){_0x44a87a=_0x44a87a-0x0;var _0x5bcfdc=_0xbf1a[_0x44a87a];return _0x5bcfdc;};'use strict';var multer=require(_0xabf1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xabf1('0x1')]();var auth=require(_0xabf1('0x2'));var interaction=require(_0xabf1('0x3'));var config=require(_0xabf1('0x4'));var controller=require(_0xabf1('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xabf1('0x6')]);router['get']('/describe',auth[_0xabf1('0x7')](),controller['describe']);router[_0xabf1('0x8')]('/:id',auth[_0xabf1('0x7')](),controller['show']);router[_0xabf1('0x9')]('/',auth[_0xabf1('0x7')](),interaction['tracked'](_0xabf1('0xa'),'openchannelmessage:create'),controller[_0xabf1('0xb')]);router[_0xabf1('0xc')](_0xabf1('0xd'),auth[_0xabf1('0x7')](),controller[_0xabf1('0xe')]);router[_0xabf1('0xc')](_0xabf1('0xf'),auth[_0xabf1('0x7')](),controller[_0xabf1('0x10')]);router['put']('/:id/reject',auth[_0xabf1('0x7')](),controller[_0xabf1('0x11')]);router[_0xabf1('0x12')](_0xabf1('0xd'),auth[_0xabf1('0x7')](),controller[_0xabf1('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 77eeaae..7d3e543 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 _0x4154=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x554bf7,_0x3b94f8){var _0x27f3b7=function(_0x293579){while(--_0x293579){_0x554bf7['push'](_0x554bf7['shift']());}};_0x27f3b7(++_0x3b94f8);}(_0x4154,0xef));var _0x4415=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0x4154[_0x1526e1];return _0x249a1e;};'use strict';var Sequelize=require(_0x4415('0x0'));module[_0x4415('0x1')]={'body':{'type':Sequelize[_0x4415('0x2')](_0x4415('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4415('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4415('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4415('0x5')]('in',_0x4415('0x6')),'defaultValue':_0x4415('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4415('0x7')]}}; \ No newline at end of file +var _0xfbfb=['TEXT','medium','BOOLEAN','ENUM','out','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbfb,0xe9));var _0xbfbf=function(_0x18627d,_0xc347b4){_0x18627d=_0x18627d-0x0;var _0x49a15f=_0xfbfb[_0x18627d];return _0x49a15f;};'use strict';var Sequelize=require('sequelize');module[_0xbfbf('0x0')]={'body':{'type':Sequelize[_0xbfbf('0x1')](_0xbfbf('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xbfbf('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbfbf('0x4')]('in','out'),'defaultValue':_0xbfbf('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 627cd4c..b5664fe 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 _0x771e=['channel','EventManager','acceptmessage','openchannel-interactions','reject','openchannel','agent','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','SIP/%s','rejectmessage','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','./openchannelMessage.socket','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelMessage,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','save','update','destroy','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','OpenchannelMessage','includeAll','findAll','rows','rawAttributes','fields','include','options','find','create','body','params','describe','accept','readAt','format','UserId','Contact','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','manual','interface'];(function(_0x22dba5,_0x382151){var _0x32d7ec=function(_0x502c28){while(--_0x502c28){_0x22dba5['push'](_0x22dba5['shift']());}};_0x32d7ec(++_0x382151);}(_0x771e,0x107));var _0xe771=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x771e[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0xe771('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe771('0x1'));var zipdir=require(_0xe771('0x2'));var jsonpatch=require(_0xe771('0x3'));var rp=require(_0xe771('0x4'));var moment=require(_0xe771('0x5'));var BPromise=require(_0xe771('0x6'));var Mustache=require('mustache');var util=require(_0xe771('0x7'));var path=require('path');var sox=require(_0xe771('0x8'));var csv=require(_0xe771('0x9'));var ejs=require(_0xe771('0xa'));var fs=require('fs');var _=require(_0xe771('0xb'));var squel=require(_0xe771('0xc'));var crypto=require(_0xe771('0xd'));var jsforce=require(_0xe771('0xe'));var deskjs=require(_0xe771('0xf'));var toCsv=require(_0xe771('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe771('0x10'));var authService=require(_0xe771('0x11'));var qs=require(_0xe771('0x12'));var as=require(_0xe771('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe771('0x14'))(_0xe771('0x15'));var utils=require('../../config/utils');var config=require(_0xe771('0x16'));var db=require('../../mysqldb')['db'];config[_0xe771('0x17')]=_[_0xe771('0x18')](config['redis'],{'host':_0xe771('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe771('0x17')]));require(_0xe771('0x1a'))['register'](socket);var jayson=require(_0xe771('0x1b'));var client=jayson[_0xe771('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xe771('0x1c')][_0xe771('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x6cd13f,_0x54ca28,_0x46f9e8){if(_0x46f9e8){var _0x36ecea=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x36ecea[_0xe771('0x1e')](_0x54ca28)){return _0x6cd13f;}else{throw new db[(_0xe771('0x1f'))][(_0xe771('0x20'))](_0xe771('0x21'));}}else{return _0x6cd13f;}}function respondWithRpcPromise(_0x4d5458,_0x384928,_0xfb7fbe,_0x17fe61){return new BPromise(function(_0x4ba522,_0x2d9b93){var _0x47a768=_0x17fe61||client;return _0x47a768[_0xe771('0x22')](_0x4d5458,_0xfb7fbe)[_0xe771('0x23')](function(_0x17d6c1){logger[_0xe771('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x384928,_0xe771('0x25'));logger[_0xe771('0x26')](_0xe771('0x27'),_0x384928,_0xe771('0x25'),JSON[_0xe771('0x28')](_0x17d6c1));if(_0x17d6c1[_0xe771('0x29')]){if(_0x17d6c1[_0xe771('0x29')][_0xe771('0x2a')]===0x1f4){logger[_0xe771('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x384928,_0x17d6c1[_0xe771('0x29')]['message']);return _0x2d9b93(_0x17d6c1[_0xe771('0x29')][_0xe771('0x2b')]);}logger[_0xe771('0x29')](_0xe771('0x2c'),_0x384928,_0x17d6c1[_0xe771('0x29')][_0xe771('0x2b')]);return _0x4ba522(_0x17d6c1[_0xe771('0x29')]['message']);}else{logger[_0xe771('0x24')](_0xe771('0x2c'),_0x384928,_0xe771('0x25'));_0x4ba522(_0x17d6c1[_0xe771('0x2d')][_0xe771('0x2b')]);}})[_0xe771('0x2e')](function(_0x323131){logger[_0xe771('0x29')](_0xe771('0x2c'),_0x384928,_0x323131);_0x2d9b93(_0x323131);});});}function respondWithStatusCode(_0x2a256a,_0x1cbdec){_0x1cbdec=_0x1cbdec||0xcc;return function(_0x5a4da3){if(_0x5a4da3){return _0x2a256a[_0xe771('0x2f')](_0x1cbdec);}return _0x2a256a[_0xe771('0x30')](_0x1cbdec)[_0xe771('0x31')]();};}function respondWithResult(_0x40bff8,_0x442c11){_0x442c11=_0x442c11||0xc8;return function(_0x4720fa){if(_0x4720fa){return _0x40bff8[_0xe771('0x30')](_0x442c11)[_0xe771('0x32')](_0x4720fa);}};}function respondWithFilteredResult(_0x4ed79b,_0x55b0a0){return function(_0x204f43){if(_0x204f43){var _0x27765b=_0x204f43[_0xe771('0x33')],_0x52e07a=_0x55b0a0[_0xe771('0x34')],_0xadee6e=_0x55b0a0[_0xe771('0x34')]+_0x55b0a0['limit'],_0x4ce25a;if(_0xadee6e>=_0x27765b){_0xadee6e=_0x27765b;_0x4ce25a=0xc8;}else{_0x4ce25a=0xce;}_0x4ed79b[_0xe771('0x30')](_0x4ce25a);return _0x4ed79b['set'](_0xe771('0x35'),_0x52e07a+'-'+_0xadee6e+'/'+_0x27765b)[_0xe771('0x32')](_0x204f43);}return null;};}function patchUpdates(_0x303c31){return function(_0x12dee4){try{jsonpatch[_0xe771('0x36')](_0x12dee4,_0x303c31,!![]);}catch(_0x6ee80f){return BPromise['reject'](_0x6ee80f);}return _0x12dee4[_0xe771('0x37')]();};}function saveUpdates(_0x23967b,_0x439630){return function(_0x348957){if(_0x348957){return _0x348957[_0xe771('0x38')](_0x23967b)[_0xe771('0x23')](function(_0x18578e){return _0x18578e;});}return null;};}function removeEntity(_0xad47b3,_0x50f414){return function(_0x162443){if(_0x162443){return _0x162443[_0xe771('0x39')]()[_0xe771('0x23')](function(){_0xad47b3[_0xe771('0x30')](0xcc)[_0xe771('0x31')]();});}};}function handleEntityNotFound(_0x46fa72,_0x5b4c36){return function(_0x486214){if(!_0x486214){_0x46fa72['sendStatus'](0x194);}return _0x486214;};}function handleError(_0x5b569c,_0x482e21){_0x482e21=_0x482e21||0x1f4;return function(_0x5494b3){logger[_0xe771('0x29')](_0x5494b3[_0xe771('0x3a')]);if(_0x5494b3['name']){delete _0x5494b3[_0xe771('0x3b')];}_0x5b569c[_0xe771('0x30')](_0x482e21)[_0xe771('0x3c')](_0x5494b3);};}exports[_0xe771('0x3d')]=function(_0x2df2d4,_0x382359){var _0x129c52={},_0x1e2e09={},_0x56e6ce={'count':0x0,'rows':[]};var _0x35ac1f=_[_0xe771('0x3e')](db['OpenchannelMessage']['rawAttributes'],function(_0x3aff48){return{'name':_0x3aff48[_0xe771('0x3f')],'type':_0x3aff48[_0xe771('0x40')][_0xe771('0x41')]};});_0x1e2e09['model']=_[_0xe771('0x3e')](_0x35ac1f,_0xe771('0x3b'));_0x1e2e09[_0xe771('0x42')]=_[_0xe771('0x43')](_0x2df2d4[_0xe771('0x42')]);_0x1e2e09[_0xe771('0x44')]=_[_0xe771('0x45')](_0x1e2e09[_0xe771('0x46')],_0x1e2e09['query']);_0x129c52[_0xe771('0x47')]=_['intersection'](_0x1e2e09[_0xe771('0x46')],qs['fields'](_0x2df2d4['query']['fields']));_0x129c52[_0xe771('0x47')]=_0x129c52[_0xe771('0x47')][_0xe771('0x48')]?_0x129c52[_0xe771('0x47')]:_0x1e2e09[_0xe771('0x46')];if(!_0x2df2d4[_0xe771('0x42')][_0xe771('0x49')](_0xe771('0x4a'))){_0x129c52['limit']=qs[_0xe771('0x4b')](_0x2df2d4[_0xe771('0x42')]['limit']);_0x129c52[_0xe771('0x34')]=qs[_0xe771('0x34')](_0x2df2d4['query']['offset']);}_0x129c52['order']=qs[_0xe771('0x4c')](_0x2df2d4['query']['sort']);_0x129c52[_0xe771('0x4d')]=qs[_0xe771('0x44')](_[_0xe771('0x4e')](_0x2df2d4[_0xe771('0x42')],_0x1e2e09[_0xe771('0x44')]),_0x35ac1f);if(_0x2df2d4[_0xe771('0x42')][_0xe771('0x4f')]){_0x129c52[_0xe771('0x4d')]=_['merge'](_0x129c52[_0xe771('0x4d')],{'$or':_['map'](_0x35ac1f,function(_0x4e7abb){if(_0x4e7abb[_0xe771('0x40')]!=='VIRTUAL'){var _0x1fa274={};_0x1fa274[_0x4e7abb[_0xe771('0x3b')]]={'$like':'%'+_0x2df2d4[_0xe771('0x42')][_0xe771('0x4f')]+'%'};return _0x1fa274;}})});}_0x129c52=_[_0xe771('0x50')]({},_0x129c52,_0x2df2d4['options']);var _0x594912={'where':_0x129c52[_0xe771('0x4d')]};return db[_0xe771('0x51')][_0xe771('0x33')](_0x594912)[_0xe771('0x23')](function(_0x3d9903){_0x56e6ce[_0xe771('0x33')]=_0x3d9903;if(_0x2df2d4['query'][_0xe771('0x52')]){_0x129c52['include']=[{'all':!![]}];}return db[_0xe771('0x51')][_0xe771('0x53')](_0x129c52);})[_0xe771('0x23')](function(_0x4701b6){_0x56e6ce[_0xe771('0x54')]=_0x4701b6;return _0x56e6ce;})[_0xe771('0x23')](respondWithFilteredResult(_0x382359,_0x129c52))[_0xe771('0x2e')](handleError(_0x382359,null));};exports['show']=function(_0x3b0ec5,_0x43ca9b){var _0x204e66={'raw':!![],'where':{'id':_0x3b0ec5['params']['id']}},_0x505bb7={};_0x505bb7[_0xe771('0x46')]=_[_0xe771('0x43')](db[_0xe771('0x51')][_0xe771('0x55')]);_0x505bb7['query']=_[_0xe771('0x43')](_0x3b0ec5[_0xe771('0x42')]);_0x505bb7[_0xe771('0x44')]=_['intersection'](_0x505bb7[_0xe771('0x46')],_0x505bb7['query']);_0x204e66[_0xe771('0x47')]=_[_0xe771('0x45')](_0x505bb7['model'],qs[_0xe771('0x56')](_0x3b0ec5[_0xe771('0x42')][_0xe771('0x56')]));_0x204e66[_0xe771('0x47')]=_0x204e66[_0xe771('0x47')]['length']?_0x204e66[_0xe771('0x47')]:_0x505bb7[_0xe771('0x46')];if(_0x3b0ec5[_0xe771('0x42')]['includeAll']){_0x204e66[_0xe771('0x57')]=[{'all':!![]}];}_0x204e66=_[_0xe771('0x50')]({},_0x204e66,_0x3b0ec5[_0xe771('0x58')]);return db[_0xe771('0x51')][_0xe771('0x59')](_0x204e66)[_0xe771('0x23')](handleEntityNotFound(_0x43ca9b,null))[_0xe771('0x23')](respondWithResult(_0x43ca9b,null))['catch'](handleError(_0x43ca9b,null));};exports[_0xe771('0x5a')]=function(_0xe3cf79,_0x20faf0){return db[_0xe771('0x51')][_0xe771('0x5a')](_0xe3cf79[_0xe771('0x5b')],{})[_0xe771('0x23')](respondWithResult(_0x20faf0,0xc9))[_0xe771('0x2e')](handleError(_0x20faf0,null));};exports[_0xe771('0x38')]=function(_0x2a5eaf,_0x4eff98){if(_0x2a5eaf['body']['id']){delete _0x2a5eaf[_0xe771('0x5b')]['id'];}return db[_0xe771('0x51')][_0xe771('0x59')]({'where':{'id':_0x2a5eaf[_0xe771('0x5c')]['id']}})[_0xe771('0x23')](handleEntityNotFound(_0x4eff98,null))[_0xe771('0x23')](saveUpdates(_0x2a5eaf[_0xe771('0x5b')],null))[_0xe771('0x23')](respondWithResult(_0x4eff98,null))[_0xe771('0x2e')](handleError(_0x4eff98,null));};exports['destroy']=function(_0x20170e,_0x469c38){return db[_0xe771('0x51')][_0xe771('0x59')]({'where':{'id':_0x20170e['params']['id']}})[_0xe771('0x23')](handleEntityNotFound(_0x469c38,null))[_0xe771('0x23')](removeEntity(_0x469c38,null))[_0xe771('0x2e')](handleError(_0x469c38,null));};exports[_0xe771('0x5d')]=function(_0x4a63dc,_0x3320d8){return db[_0xe771('0x51')]['describe']()[_0xe771('0x23')](respondWithResult(_0x3320d8,null))[_0xe771('0x2e')](handleError(_0x3320d8,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0xe771('0x5e')]=function(_0x25f03a,_0x3a71f3,_0x47ccea){var _0x245e37={'channel':'openchannel'};if(_0x25f03a[_0xe771('0x5b')]['id']){delete _0x25f03a['body']['id'];}_0x25f03a['body']['read']=!![];_0x25f03a[_0xe771('0x5b')][_0xe771('0x5f')]=moment()[_0xe771('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x25f03a['body'][_0xe771('0x61')]=_0x25f03a['body'][_0xe771('0x61')]||_0x25f03a['user']['id'];return db[_0xe771('0x51')][_0xe771('0x59')]({'where':{'id':_0x25f03a['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xe771('0x62')}]})[_0xe771('0x23')](handleEntityNotFound(_0x3a71f3,null))[_0xe771('0x23')](saveUpdates(_0x25f03a[_0xe771('0x5b')],null))['then'](function(_0x5ee90f){if(_0x5ee90f){_0x245e37[_0xe771('0x2b')]=_0x5ee90f['get']({'plain':!![]});return db['OpenchannelInteraction'][_0xe771('0x59')]({'where':{'id':_0x5ee90f[_0xe771('0x63')]}});}return null;})[_0xe771('0x23')](handleEntityNotFound(_0x3a71f3,null))[_0xe771('0x23')](function(_0x3982a3){if(_0x3982a3){return _0x3982a3['update']({'UserId':_0x25f03a['body']['UserId'],'read1stAt':_[_0xe771('0x64')](_0x3982a3[_0xe771('0x65')])?moment()[_0xe771('0x60')](_0xe771('0x66')):undefined});}return null;})['then'](function(_0xb2b142){if(_0xb2b142){_0x245e37[_0xe771('0x67')]=_0xb2b142[_0xe771('0x68')]({'plain':!![]});interaction_log[_0xe771('0x24')](_0xe771('0x69'),_0x25f03a[_0xe771('0x6a')]['id'],_0x25f03a[_0xe771('0x6a')]['name'],_0x25f03a[_0xe771('0x6a')][_0xe771('0x6b')],_0x245e37['interaction']['id'],_0x25f03a['body']?JSON[_0xe771('0x28')](_0x25f03a[_0xe771('0x5b')]):'null');return respondWithRpcPromise(_0xe771('0x6c'),_0xe771('0x6d'),_0x245e37);}return null;})[_0xe771('0x23')](function(_0x544c85){if(_0x544c85){if(_0x25f03a['body'][_0xe771('0x6e')]){_0x245e37['message'][_0xe771('0x6f')]=util[_0xe771('0x60')]('SIP/%s',_0x25f03a[_0xe771('0x6a')][_0xe771('0x3b')]);_0x245e37[_0xe771('0x2b')]['channel']=_0x245e37[_0xe771('0x70')];_0x245e37[_0xe771('0x2b')]['event']=_0xe771('0x5e');return respondWithRpcPromise('EventManager',_0xe771('0x71'),{'event':_0xe771('0x72'),'message':_0x245e37[_0xe771('0x2b')]},client9002)[_0xe771('0x23')](function(){return _0x245e37;});}return _0x245e37;}return null;})[_0xe771('0x23')](respondWithResult(_0x3a71f3,null))[_0xe771('0x2e')](handleError(_0x3a71f3,null));};var interaction_log=require(_0xe771('0x14'))(_0xe771('0x73'));exports[_0xe771('0x74')]=function(_0x32946,_0x595847,_0x29d3f6){var _0xfea47={'agent':{},'channel':_0xe771('0x75')};if(_0x32946['body']['id']){delete _0x32946[_0xe771('0x5b')]['id'];}_0x32946[_0xe771('0x5b')][_0xe771('0x61')]=_0x32946['body'][_0xe771('0x61')]||_0x32946[_0xe771('0x6a')]['id'];_0xfea47[_0xe771('0x76')]['id']=_0x32946[_0xe771('0x5b')][_0xe771('0x61')];return db[_0xe771('0x51')][_0xe771('0x59')]({'where':{'id':_0x32946['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x595847,null))['then'](function(_0x2f768c){if(_0x2f768c){_0xfea47['message']=_0x2f768c['get']({'plain':!![]});return db[_0xe771('0x77')][_0xe771('0x59')]({'where':{'id':_0x2f768c['OpenchannelInteractionId']}});}return null;})[_0xe771('0x23')](handleEntityNotFound(_0x595847,null))[_0xe771('0x23')](function(_0x74fb22){if(_0x74fb22){_0xfea47[_0xe771('0x67')]=_0x74fb22[_0xe771('0x68')]({'plain':!![]});interaction_log[_0xe771('0x24')](_0xe771('0x78'),_0x32946['user']['id'],_0x32946[_0xe771('0x6a')]['name'],_0x32946[_0xe771('0x6a')][_0xe771('0x6b')],_0xfea47['interaction']['id'],_0x32946[_0xe771('0x5b')]?JSON['stringify'](_0x32946['body']):_0xe771('0x79'));return respondWithRpcPromise('RejectMessage',_0xe771('0x7a'),_0xfea47);}return null;})[_0xe771('0x23')](function(_0x3a8aa4){if(_0x3a8aa4){_0x3a8aa4[_0xe771('0x2b')][_0xe771('0x6f')]=util['format'](_0xe771('0x7b'),_0x32946[_0xe771('0x6a')][_0xe771('0x3b')]);_0x3a8aa4['message'][_0xe771('0x70')]=_0xfea47['channel'];_0x3a8aa4[_0xe771('0x2b')]['event']=_0xe771('0x74');respondWithRpcPromise(_0xe771('0x71'),'EventManager',{'event':_0xe771('0x7c'),'message':_0x3a8aa4[_0xe771('0x2b')]},client9002);return _0xfea47;}return null;})[_0xe771('0x23')](respondWithResult(_0x595847,null))[_0xe771('0x2e')](handleError(_0x595847,null));}; \ No newline at end of file +var _0x11b7=['describe','openchannel-interactions','openchannel','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','OpenchannelInteraction','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','stack','name','send','index','map','OpenchannelMessage','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update'];(function(_0x32e8f2,_0x33cff3){var _0xefd2e6=function(_0x524abd){while(--_0x524abd){_0x32e8f2['push'](_0x32e8f2['shift']());}};_0xefd2e6(++_0x33cff3);}(_0x11b7,0x112));var _0x711b=function(_0x4c7907,_0x24322a){_0x4c7907=_0x4c7907-0x0;var _0xa4c9a2=_0x11b7[_0x4c7907];return _0xa4c9a2;};'use strict';var pdf=require(_0x711b('0x0'));var emlformat=require(_0x711b('0x1'));var rimraf=require(_0x711b('0x2'));var zipdir=require(_0x711b('0x3'));var jsonpatch=require(_0x711b('0x4'));var rp=require('request-promise');var moment=require(_0x711b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x711b('0x6'));var util=require(_0x711b('0x7'));var path=require('path');var sox=require(_0x711b('0x8'));var csv=require(_0x711b('0x9'));var ejs=require(_0x711b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x711b('0xb'));var crypto=require(_0x711b('0xc'));var jsforce=require(_0x711b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x711b('0xe'));var Papa=require(_0x711b('0xf'));var Redis=require(_0x711b('0x10'));var authService=require(_0x711b('0x11'));var qs=require(_0x711b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x711b('0x13'));var logger=require(_0x711b('0x14'))('api');var utils=require(_0x711b('0x15'));var config=require(_0x711b('0x16'));var db=require(_0x711b('0x17'))['db'];config[_0x711b('0x18')]=_[_0x711b('0x19')](config['redis'],{'host':_0x711b('0x1a'),'port':0x18eb});var socket=require(_0x711b('0x1b'))(new Redis(config[_0x711b('0x18')]));require(_0x711b('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x711b('0x1d')][_0x711b('0x1e')]({'port':0x232c});var client9002=jayson[_0x711b('0x1d')][_0x711b('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x236807,_0x2b929a,_0x366d5c){if(_0x366d5c){var _0x3c94f8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3c94f8[_0x711b('0x1f')](_0x2b929a)){return _0x236807;}else{throw new db[(_0x711b('0x20'))][(_0x711b('0x21'))](_0x711b('0x22'));}}else{return _0x236807;}}function respondWithRpcPromise(_0x922b72,_0x6f8636,_0x4a08c3,_0x275e48){return new BPromise(function(_0x38042e,_0xc64aa7){var _0x3417ce=_0x275e48||client;return _0x3417ce[_0x711b('0x23')](_0x922b72,_0x4a08c3)[_0x711b('0x24')](function(_0xbd3687){logger[_0x711b('0x25')](_0x711b('0x26'),_0x6f8636,_0x711b('0x27'));logger['debug'](_0x711b('0x28'),_0x6f8636,'request\x20sent',JSON[_0x711b('0x29')](_0xbd3687));if(_0xbd3687['error']){if(_0xbd3687['error'][_0x711b('0x2a')]===0x1f4){logger[_0x711b('0x2b')](_0x711b('0x26'),_0x6f8636,_0xbd3687[_0x711b('0x2b')][_0x711b('0x2c')]);return _0xc64aa7(_0xbd3687[_0x711b('0x2b')][_0x711b('0x2c')]);}logger[_0x711b('0x2b')](_0x711b('0x26'),_0x6f8636,_0xbd3687[_0x711b('0x2b')][_0x711b('0x2c')]);return _0x38042e(_0xbd3687['error']['message']);}else{logger['info'](_0x711b('0x26'),_0x6f8636,_0x711b('0x27'));_0x38042e(_0xbd3687[_0x711b('0x2d')][_0x711b('0x2c')]);}})['catch'](function(_0x2d0fcb){logger['error'](_0x711b('0x26'),_0x6f8636,_0x2d0fcb);_0xc64aa7(_0x2d0fcb);});});}function respondWithStatusCode(_0x5c2252,_0x3a9c1e){_0x3a9c1e=_0x3a9c1e||0xcc;return function(_0x173a93){if(_0x173a93){return _0x5c2252[_0x711b('0x2e')](_0x3a9c1e);}return _0x5c2252[_0x711b('0x2f')](_0x3a9c1e)[_0x711b('0x30')]();};}function respondWithResult(_0x33d1a6,_0x23d17f){_0x23d17f=_0x23d17f||0xc8;return function(_0x2cf66f){if(_0x2cf66f){return _0x33d1a6['status'](_0x23d17f)[_0x711b('0x31')](_0x2cf66f);}};}function respondWithFilteredResult(_0x3aa094,_0x334af4){return function(_0x520fbf){if(_0x520fbf){var _0x205848=_0x520fbf[_0x711b('0x32')],_0x473c74=_0x334af4[_0x711b('0x33')],_0x588002=_0x334af4['offset']+_0x334af4[_0x711b('0x34')],_0x53bacc;if(_0x588002>=_0x205848){_0x588002=_0x205848;_0x53bacc=0xc8;}else{_0x53bacc=0xce;}_0x3aa094[_0x711b('0x2f')](_0x53bacc);return _0x3aa094[_0x711b('0x35')](_0x711b('0x36'),_0x473c74+'-'+_0x588002+'/'+_0x205848)[_0x711b('0x31')](_0x520fbf);}return null;};}function patchUpdates(_0x5bf380){return function(_0x20c545){try{jsonpatch['apply'](_0x20c545,_0x5bf380,!![]);}catch(_0x272373){return BPromise[_0x711b('0x37')](_0x272373);}return _0x20c545[_0x711b('0x38')]();};}function saveUpdates(_0x8566cd,_0x1022e8){return function(_0x5a219c){if(_0x5a219c){return _0x5a219c['update'](_0x8566cd)[_0x711b('0x24')](function(_0x2a157b){return _0x2a157b;});}return null;};}function removeEntity(_0xfdb5b6,_0x56d95c){return function(_0x3e4109){if(_0x3e4109){return _0x3e4109[_0x711b('0x39')]()[_0x711b('0x24')](function(){_0xfdb5b6[_0x711b('0x2f')](0xcc)[_0x711b('0x30')]();});}};}function handleEntityNotFound(_0x4c5380,_0x331cae){return function(_0x56f43c){if(!_0x56f43c){_0x4c5380[_0x711b('0x2e')](0x194);}return _0x56f43c;};}function handleError(_0x744fea,_0x3056c5){_0x3056c5=_0x3056c5||0x1f4;return function(_0x56d11d){logger[_0x711b('0x2b')](_0x56d11d[_0x711b('0x3a')]);if(_0x56d11d[_0x711b('0x3b')]){delete _0x56d11d[_0x711b('0x3b')];}_0x744fea[_0x711b('0x2f')](_0x3056c5)[_0x711b('0x3c')](_0x56d11d);};}exports[_0x711b('0x3d')]=function(_0xce775b,_0x1dc5cd){var _0x4bf590={},_0x19fb94={},_0x20ce2d={'count':0x0,'rows':[]};var _0x26b672=_[_0x711b('0x3e')](db[_0x711b('0x3f')]['rawAttributes'],function(_0x4685f2){return{'name':_0x4685f2[_0x711b('0x40')],'type':_0x4685f2[_0x711b('0x41')]['key']};});_0x19fb94[_0x711b('0x42')]=_[_0x711b('0x3e')](_0x26b672,_0x711b('0x3b'));_0x19fb94[_0x711b('0x43')]=_[_0x711b('0x44')](_0xce775b['query']);_0x19fb94[_0x711b('0x45')]=_[_0x711b('0x46')](_0x19fb94[_0x711b('0x42')],_0x19fb94['query']);_0x4bf590['attributes']=_['intersection'](_0x19fb94[_0x711b('0x42')],qs['fields'](_0xce775b[_0x711b('0x43')][_0x711b('0x47')]));_0x4bf590[_0x711b('0x48')]=_0x4bf590[_0x711b('0x48')][_0x711b('0x49')]?_0x4bf590[_0x711b('0x48')]:_0x19fb94[_0x711b('0x42')];if(!_0xce775b['query'][_0x711b('0x4a')](_0x711b('0x4b'))){_0x4bf590[_0x711b('0x34')]=qs[_0x711b('0x34')](_0xce775b[_0x711b('0x43')][_0x711b('0x34')]);_0x4bf590[_0x711b('0x33')]=qs[_0x711b('0x33')](_0xce775b[_0x711b('0x43')]['offset']);}_0x4bf590[_0x711b('0x4c')]=qs['sort'](_0xce775b[_0x711b('0x43')][_0x711b('0x4d')]);_0x4bf590[_0x711b('0x4e')]=qs[_0x711b('0x45')](_[_0x711b('0x4f')](_0xce775b[_0x711b('0x43')],_0x19fb94[_0x711b('0x45')]),_0x26b672);if(_0xce775b[_0x711b('0x43')][_0x711b('0x50')]){_0x4bf590['where']=_[_0x711b('0x51')](_0x4bf590[_0x711b('0x4e')],{'$or':_['map'](_0x26b672,function(_0x7e0af2){if(_0x7e0af2[_0x711b('0x41')]!==_0x711b('0x52')){var _0x1e3d11={};_0x1e3d11[_0x7e0af2[_0x711b('0x3b')]]={'$like':'%'+_0xce775b[_0x711b('0x43')][_0x711b('0x50')]+'%'};return _0x1e3d11;}})});}_0x4bf590=_[_0x711b('0x51')]({},_0x4bf590,_0xce775b['options']);var _0x2fc3e2={'where':_0x4bf590[_0x711b('0x4e')]};return db[_0x711b('0x3f')][_0x711b('0x32')](_0x2fc3e2)[_0x711b('0x24')](function(_0x49de1b){_0x20ce2d[_0x711b('0x32')]=_0x49de1b;if(_0xce775b[_0x711b('0x43')][_0x711b('0x53')]){_0x4bf590['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x711b('0x54')](_0x4bf590);})[_0x711b('0x24')](function(_0x4ccba5){_0x20ce2d[_0x711b('0x55')]=_0x4ccba5;return _0x20ce2d;})[_0x711b('0x24')](respondWithFilteredResult(_0x1dc5cd,_0x4bf590))[_0x711b('0x56')](handleError(_0x1dc5cd,null));};exports[_0x711b('0x57')]=function(_0x1d1ab3,_0x52b818){var _0x1e0158={'raw':!![],'where':{'id':_0x1d1ab3[_0x711b('0x58')]['id']}},_0x117e71={};_0x117e71[_0x711b('0x42')]=_[_0x711b('0x44')](db[_0x711b('0x3f')][_0x711b('0x59')]);_0x117e71['query']=_[_0x711b('0x44')](_0x1d1ab3[_0x711b('0x43')]);_0x117e71[_0x711b('0x45')]=_[_0x711b('0x46')](_0x117e71['model'],_0x117e71[_0x711b('0x43')]);_0x1e0158[_0x711b('0x48')]=_[_0x711b('0x46')](_0x117e71[_0x711b('0x42')],qs[_0x711b('0x47')](_0x1d1ab3[_0x711b('0x43')][_0x711b('0x47')]));_0x1e0158[_0x711b('0x48')]=_0x1e0158['attributes']['length']?_0x1e0158[_0x711b('0x48')]:_0x117e71[_0x711b('0x42')];if(_0x1d1ab3[_0x711b('0x43')][_0x711b('0x53')]){_0x1e0158[_0x711b('0x5a')]=[{'all':!![]}];}_0x1e0158=_[_0x711b('0x51')]({},_0x1e0158,_0x1d1ab3['options']);return db[_0x711b('0x3f')][_0x711b('0x5b')](_0x1e0158)[_0x711b('0x24')](handleEntityNotFound(_0x52b818,null))['then'](respondWithResult(_0x52b818,null))[_0x711b('0x56')](handleError(_0x52b818,null));};exports[_0x711b('0x5c')]=function(_0x55fd4e,_0x5b17e2){return db[_0x711b('0x3f')][_0x711b('0x5c')](_0x55fd4e[_0x711b('0x5d')],{})[_0x711b('0x24')](respondWithResult(_0x5b17e2,0xc9))['catch'](handleError(_0x5b17e2,null));};exports[_0x711b('0x5e')]=function(_0x30b00c,_0x2c1e46){if(_0x30b00c[_0x711b('0x5d')]['id']){delete _0x30b00c[_0x711b('0x5d')]['id'];}return db[_0x711b('0x3f')][_0x711b('0x5b')]({'where':{'id':_0x30b00c['params']['id']}})[_0x711b('0x24')](handleEntityNotFound(_0x2c1e46,null))[_0x711b('0x24')](saveUpdates(_0x30b00c[_0x711b('0x5d')],null))['then'](respondWithResult(_0x2c1e46,null))[_0x711b('0x56')](handleError(_0x2c1e46,null));};exports[_0x711b('0x39')]=function(_0x38d3b4,_0x1c1b00){return db[_0x711b('0x3f')][_0x711b('0x5b')]({'where':{'id':_0x38d3b4[_0x711b('0x58')]['id']}})[_0x711b('0x24')](handleEntityNotFound(_0x1c1b00,null))[_0x711b('0x24')](removeEntity(_0x1c1b00,null))[_0x711b('0x56')](handleError(_0x1c1b00,null));};exports[_0x711b('0x5f')]=function(_0x16268c,_0x3881dc){return db['OpenchannelMessage'][_0x711b('0x5f')]()['then'](respondWithResult(_0x3881dc,null))[_0x711b('0x56')](handleError(_0x3881dc,null));};var interaction_log=require(_0x711b('0x14'))(_0x711b('0x60'));exports['accept']=function(_0x1b81a9,_0x435a2b,_0x37bf62){var _0x16cdb0={'channel':_0x711b('0x61')};if(_0x1b81a9[_0x711b('0x5d')]['id']){delete _0x1b81a9[_0x711b('0x5d')]['id'];}_0x1b81a9[_0x711b('0x5d')]['read']=!![];_0x1b81a9[_0x711b('0x5d')][_0x711b('0x62')]=moment()['format'](_0x711b('0x63'));_0x1b81a9[_0x711b('0x5d')]['UserId']=_0x1b81a9[_0x711b('0x5d')][_0x711b('0x64')]||_0x1b81a9[_0x711b('0x65')]['id'];return db[_0x711b('0x3f')][_0x711b('0x5b')]({'where':{'id':_0x1b81a9[_0x711b('0x58')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x711b('0x66')}]})[_0x711b('0x24')](handleEntityNotFound(_0x435a2b,null))['then'](saveUpdates(_0x1b81a9['body'],null))[_0x711b('0x24')](function(_0x5acec5){if(_0x5acec5){_0x16cdb0['message']=_0x5acec5[_0x711b('0x67')]({'plain':!![]});return db[_0x711b('0x68')][_0x711b('0x5b')]({'where':{'id':_0x5acec5['OpenchannelInteractionId']}});}return null;})[_0x711b('0x24')](handleEntityNotFound(_0x435a2b,null))[_0x711b('0x24')](function(_0x21cebe){if(_0x21cebe){return _0x21cebe[_0x711b('0x5e')]({'UserId':_0x1b81a9[_0x711b('0x5d')][_0x711b('0x64')],'read1stAt':_[_0x711b('0x69')](_0x21cebe[_0x711b('0x6a')])?moment()[_0x711b('0x6b')](_0x711b('0x63')):undefined});}return null;})['then'](function(_0x46a93a){if(_0x46a93a){_0x16cdb0[_0x711b('0x6c')]=_0x46a93a[_0x711b('0x67')]({'plain':!![]});interaction_log[_0x711b('0x25')](_0x711b('0x6d'),_0x1b81a9[_0x711b('0x65')]['id'],_0x1b81a9[_0x711b('0x65')][_0x711b('0x3b')],_0x1b81a9[_0x711b('0x65')][_0x711b('0x6e')],_0x16cdb0['interaction']['id'],_0x1b81a9[_0x711b('0x5d')]?JSON[_0x711b('0x29')](_0x1b81a9[_0x711b('0x5d')]):_0x711b('0x6f'));return respondWithRpcPromise('AcceptMessage',_0x711b('0x70'),_0x16cdb0);}return null;})[_0x711b('0x24')](function(_0xaef013){if(_0xaef013){if(_0x1b81a9[_0x711b('0x5d')][_0x711b('0x71')]){_0x16cdb0['message'][_0x711b('0x72')]=util[_0x711b('0x6b')](_0x711b('0x73'),_0x1b81a9[_0x711b('0x65')][_0x711b('0x3b')]);_0x16cdb0[_0x711b('0x2c')][_0x711b('0x74')]=_0x16cdb0[_0x711b('0x74')];_0x16cdb0['message'][_0x711b('0x75')]=_0x711b('0x76');return respondWithRpcPromise(_0x711b('0x77'),'EventManager',{'event':'acceptmessage','message':_0x16cdb0[_0x711b('0x2c')]},client9002)[_0x711b('0x24')](function(){return _0x16cdb0;});}return _0x16cdb0;}return null;})['then'](respondWithResult(_0x435a2b,null))[_0x711b('0x56')](handleError(_0x435a2b,null));};var interaction_log=require(_0x711b('0x14'))(_0x711b('0x60'));exports['reject']=function(_0x19a908,_0x4b0f67,_0x5a8bbc){var _0x4a8859={'agent':{},'channel':_0x711b('0x61')};if(_0x19a908['body']['id']){delete _0x19a908[_0x711b('0x5d')]['id'];}_0x19a908[_0x711b('0x5d')][_0x711b('0x64')]=_0x19a908[_0x711b('0x5d')][_0x711b('0x64')]||_0x19a908['user']['id'];_0x4a8859[_0x711b('0x78')]['id']=_0x19a908[_0x711b('0x5d')][_0x711b('0x64')];return db['OpenchannelMessage'][_0x711b('0x5b')]({'where':{'id':_0x19a908[_0x711b('0x58')]['id'],'UserId':null}})[_0x711b('0x24')](handleEntityNotFound(_0x4b0f67,null))[_0x711b('0x24')](function(_0x3b86c3){if(_0x3b86c3){_0x4a8859[_0x711b('0x2c')]=_0x3b86c3[_0x711b('0x67')]({'plain':!![]});return db[_0x711b('0x68')][_0x711b('0x5b')]({'where':{'id':_0x3b86c3['OpenchannelInteractionId']}});}return null;})[_0x711b('0x24')](handleEntityNotFound(_0x4b0f67,null))[_0x711b('0x24')](function(_0x575bfc){if(_0x575bfc){_0x4a8859[_0x711b('0x6c')]=_0x575bfc[_0x711b('0x67')]({'plain':!![]});interaction_log[_0x711b('0x25')](_0x711b('0x79'),_0x19a908[_0x711b('0x65')]['id'],_0x19a908[_0x711b('0x65')][_0x711b('0x3b')],_0x19a908[_0x711b('0x65')][_0x711b('0x6e')],_0x4a8859[_0x711b('0x6c')]['id'],_0x19a908[_0x711b('0x5d')]?JSON[_0x711b('0x29')](_0x19a908[_0x711b('0x5d')]):_0x711b('0x6f'));return respondWithRpcPromise(_0x711b('0x7a'),'rejectMessage',_0x4a8859);}return null;})[_0x711b('0x24')](function(_0x3fe16a){if(_0x3fe16a){_0x3fe16a[_0x711b('0x2c')][_0x711b('0x72')]=util[_0x711b('0x6b')](_0x711b('0x73'),_0x19a908[_0x711b('0x65')][_0x711b('0x3b')]);_0x3fe16a[_0x711b('0x2c')][_0x711b('0x74')]=_0x4a8859[_0x711b('0x74')];_0x3fe16a[_0x711b('0x2c')][_0x711b('0x75')]=_0x711b('0x37');respondWithRpcPromise(_0x711b('0x77'),'EventManager',{'event':'rejectmessage','message':_0x3fe16a['message']},client9002);return _0x4a8859;}return null;})['then'](respondWithResult(_0x4b0f67,null))[_0x711b('0x56')](handleError(_0x4b0f67,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index c127d7f..b5b0cea 100644 --- a/server/api/openchannelMessage/openchannelMessage.events.js +++ b/server/api/openchannelMessage/openchannelMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2462=['../../mysqldb','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x2462,0x77));var _0x2246=function(_0x503dda,_0x33e4d9){_0x503dda=_0x503dda-0x0;var _0x437184=_0x2462[_0x503dda];return _0x437184;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x2246('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x2246('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2246('0x2'),'afterDestroy':_0x2246('0x3')};function emitEvent(_0x16273c){return function(_0x59be50,_0x25e945,_0x1931e0){OpenchannelMessageEvents[_0x2246('0x4')](_0x16273c+':'+_0x59be50['id'],_0x59be50);OpenchannelMessageEvents[_0x2246('0x4')](_0x16273c,_0x59be50);_0x1931e0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x2246('0x5')](e,emitEvent(event));}}module[_0x2246('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x31af=['hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','update','remove','emit'];(function(_0x2d7f58,_0x4d5c28){var _0x174c16=function(_0x15dcf4){while(--_0x15dcf4){_0x2d7f58['push'](_0x2d7f58['shift']());}};_0x174c16(++_0x4d5c28);}(_0x31af,0x102));var _0xf31a=function(_0x24522c,_0xc24752){_0x24522c=_0x24522c-0x0;var _0x4ebb95=_0x31af[_0x24522c];return _0x4ebb95;};'use strict';var EventEmitter=require(_0xf31a('0x0'));var OpenchannelMessage=require(_0xf31a('0x1'))['db'][_0xf31a('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf31a('0x3'),'afterDestroy':_0xf31a('0x4')};function emitEvent(_0x134449){return function(_0x28d079,_0x2343d0,_0x44febd){OpenchannelMessageEvents[_0xf31a('0x5')](_0x134449+':'+_0x28d079['id'],_0x28d079);OpenchannelMessageEvents[_0xf31a('0x5')](_0x134449,_0x28d079);_0x44febd(null);};}for(var e in events){if(events[_0xf31a('0x6')](e)){var event=events[e];OpenchannelMessage[_0xf31a('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 7abf9d0..4092e8b 100644 --- a/server/api/openchannelMessage/openchannelMessage.model.js +++ b/server/api/openchannelMessage/openchannelMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b77=['method','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','body','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','error','secret','CmContact','describe','find','OpenchannelAccountId','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','omit','Contact','POST'];(function(_0x2b57d7,_0x1ed2f9){var _0x562ce1=function(_0x320fed){while(--_0x320fed){_0x2b57d7['push'](_0x2b57d7['shift']());}};_0x562ce1(++_0x1ed2f9);}(_0x8b77,0xc4));var _0x78b7=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8b77[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x78b7('0x0'));var logger=require('../../config/logger')(_0x78b7('0x1'));var moment=require('moment');var BPromise=require(_0x78b7('0x2'));var rp=require(_0x78b7('0x3'));var fs=require('fs');var path=require(_0x78b7('0x4'));var rimraf=require(_0x78b7('0x5'));var config=require('../../config/environment');var attributes=require(_0x78b7('0x6'));module[_0x78b7('0x7')]=function(_0x5c04ea,_0x348d13){return _0x5c04ea[_0x78b7('0x8')](_0x78b7('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x78b7('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2666fc,_0x379ede,_0x136b74){var _0x38b9c9=_0x5c04ea['models'];var _0x2949f5=_0x2666fc['get']({'plain':!![]});if(_0x2949f5[_0x78b7('0xb')][_0x78b7('0xc')]()==='in'||_0x2949f5['direction'][_0x78b7('0xc')]()===_0x78b7('0xd')&&!_0x2949f5['secret']&&!_[_0x78b7('0xe')](_0x2949f5[_0x78b7('0xf')])){_0x38b9c9[_0x78b7('0x10')][_0x78b7('0x11')]({'where':{'id':_0x2949f5[_0x78b7('0x12')]}})[_0x78b7('0x13')](function(_0xf08eae){if(_0xf08eae){_0xf08eae[_0x78b7('0x14')]({'lastMsgAt':_0x2949f5['createdAt'],'lastMsgDirection':_0x2949f5['direction'][_0x78b7('0xc')]()});}})[_0x78b7('0x15')](function(_0x219a7c){console[_0x78b7('0x16')](_0x219a7c);});}if(_0x2949f5[_0x78b7('0xb')]===_0x78b7('0xd')&&!_0x2949f5[_0x78b7('0x17')]){var _0x2886cd;_0x38b9c9[_0x78b7('0x18')][_0x78b7('0x19')]()[_0x78b7('0x13')](function(_0x1419d4){return _0x38b9c9['OpenchannelAccount'][_0x78b7('0x1a')]({'where':{'id':_0x2949f5[_0x78b7('0x1b')]},'include':[{'model':_0x38b9c9[_0x78b7('0x10')],'as':'Interactions','where':{'id':_0x2949f5['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x38b9c9[_0x78b7('0x18')],'as':'Contact','attributes':_['keys'](_0x1419d4)}]}]});})[_0x78b7('0x13')](function(_0x194096){_0x2886cd=_0x194096['get']({'plain':!![]});if(_0x2886cd&&_0x2886cd[_0x78b7('0x1c')]){logger[_0x78b7('0x1d')](_0x78b7('0x1e'),_0x78b7('0x1f'),util[_0x78b7('0x20')](_0x78b7('0x21'),_0x2949f5['id'],_0x2886cd['replyUri']));if(_0x2886cd[_0x78b7('0x22')]&&_0x2886cd['Interactions'][_0x78b7('0x23')]){_0x2949f5['Interaction']=_[_0x78b7('0x24')](_0x2886cd[_0x78b7('0x22')][0x0],'Contact');_0x2949f5[_0x78b7('0x25')]=_0x2886cd[_0x78b7('0x22')][0x0][_0x78b7('0x25')];}var _0x379ede={'method':_0x78b7('0x26'),'uri':encodeURI(_0x2886cd[_0x78b7('0x1c')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x379ede[_0x78b7('0x27')]){case'GET':_0x379ede['qs']=_0x2949f5;break;case _0x78b7('0x26'):_0x379ede['body']=_0x2949f5;break;}return rp(_0x379ede)['then'](function(_0x1041f9){logger['info'](_0x78b7('0x1e'),_0x78b7('0x1f'),util['format'](_0x78b7('0x28'),_0x2949f5['id'],_0x2886cd['replyUri']));if(_0x1041f9[_0x78b7('0xa')]['threadId']&&_0x1041f9[_0x78b7('0xa')]['threadId']!=_0x2949f5['Interaction'][_0x78b7('0x29')]){return _0x38b9c9['OpenchannelInteraction'][_0x78b7('0x14')]({'threadId':_0x1041f9['body'][_0x78b7('0x29')]},{'logging':!![],'where':{'id':_0x2949f5[_0x78b7('0x2a')]['id']}});}else{return;}})['then'](function(){return _0x2666fc[_0x78b7('0x14')]({'read':!![]});})[_0x78b7('0x15')](function(_0x24594f){logger[_0x78b7('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x78b7('0x1f'),util[_0x78b7('0x2b')](_0x24594f,{'showHidden':![],'depth':null}));_0x136b74();});}else{_0x136b74();}})[_0x78b7('0x2c')](function(){_0x136b74();});}else{_0x136b74();}}},'charset':_0x78b7('0x2d'),'collate':_0x78b7('0x2e')});}; \ No newline at end of file +var _0xd5a0=['catch','error','then','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','replyUri','afterCreate','format','Interaction','omit','POST','method','GET','info','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','findOne','OpenchannelInteractionId','update','createdAt'];(function(_0x34fb0a,_0x1be76e){var _0x17b470=function(_0x5b616c){while(--_0x5b616c){_0x34fb0a['push'](_0x34fb0a['shift']());}};_0x17b470(++_0x1be76e);}(_0xd5a0,0x16f));var _0x0d5a=function(_0x1b39bb,_0xc99414){_0x1b39bb=_0x1b39bb-0x0;var _0x1bf082=_0xd5a0[_0x1b39bb];return _0x1bf082;};'use strict';var _=require(_0x0d5a('0x0'));var util=require(_0x0d5a('0x1'));var logger=require(_0x0d5a('0x2'))(_0x0d5a('0x3'));var moment=require(_0x0d5a('0x4'));var BPromise=require(_0x0d5a('0x5'));var rp=require(_0x0d5a('0x6'));var fs=require('fs');var path=require(_0x0d5a('0x7'));var rimraf=require('rimraf');var config=require(_0x0d5a('0x8'));var attributes=require(_0x0d5a('0x9'));module[_0x0d5a('0xa')]=function(_0x41a466,_0x46d033){return _0x41a466['define']('OpenchannelMessage',attributes,{'tableName':_0x0d5a('0xb'),'paranoid':![],'indexes':[{'name':_0x0d5a('0xc'),'fields':[_0x0d5a('0xd')],'type':_0x0d5a('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f541a,_0x146d47,_0x458e49){var _0x9ae9c2=_0x41a466['models'];var _0x2cf6fb=_0x4f541a[_0x0d5a('0xf')]({'plain':!![]});if(_0x2cf6fb[_0x0d5a('0x10')]['toLowerCase']()==='in'||_0x2cf6fb[_0x0d5a('0x10')][_0x0d5a('0x11')]()==='out'&&!_0x2cf6fb[_0x0d5a('0x12')]&&!_[_0x0d5a('0x13')](_0x2cf6fb[_0x0d5a('0x14')])){_0x9ae9c2['OpenchannelInteraction'][_0x0d5a('0x15')]({'where':{'id':_0x2cf6fb[_0x0d5a('0x16')]}})['then'](function(_0x1b4cd0){if(_0x1b4cd0){_0x1b4cd0[_0x0d5a('0x17')]({'lastMsgAt':_0x2cf6fb[_0x0d5a('0x18')],'lastMsgDirection':_0x2cf6fb[_0x0d5a('0x10')][_0x0d5a('0x11')]()});}})[_0x0d5a('0x19')](function(_0x4e85e8){console[_0x0d5a('0x1a')](_0x4e85e8);});}if(_0x2cf6fb[_0x0d5a('0x10')]==='out'&&!_0x2cf6fb[_0x0d5a('0x12')]){var _0x294856;_0x9ae9c2['CmContact']['describe']()[_0x0d5a('0x1b')](function(_0x1b4b3e){return _0x9ae9c2['OpenchannelAccount'][_0x0d5a('0x1c')]({'where':{'id':_0x2cf6fb[_0x0d5a('0x1d')]},'include':[{'model':_0x9ae9c2[_0x0d5a('0x1e')],'as':_0x0d5a('0x1f'),'where':{'id':_0x2cf6fb[_0x0d5a('0x16')]},'limit':0x1,'include':[{'model':_0x9ae9c2['CmContact'],'as':_0x0d5a('0x20'),'attributes':_[_0x0d5a('0x21')](_0x1b4b3e)}]}]});})[_0x0d5a('0x1b')](function(_0x2842f0){_0x294856=_0x2842f0['get']({'plain':!![]});if(_0x294856&&_0x294856[_0x0d5a('0x22')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x0d5a('0x23'),util[_0x0d5a('0x24')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x2cf6fb['id'],_0x294856[_0x0d5a('0x22')]));if(_0x294856[_0x0d5a('0x1f')]&&_0x294856['Interactions']['length']){_0x2cf6fb[_0x0d5a('0x25')]=_[_0x0d5a('0x26')](_0x294856[_0x0d5a('0x1f')][0x0],'Contact');_0x2cf6fb['Contact']=_0x294856['Interactions'][0x0][_0x0d5a('0x20')];}var _0x146d47={'method':_0x0d5a('0x27'),'uri':encodeURI(_0x294856[_0x0d5a('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x146d47[_0x0d5a('0x28')]){case _0x0d5a('0x29'):_0x146d47['qs']=_0x2cf6fb;break;case _0x0d5a('0x27'):_0x146d47[_0x0d5a('0xd')]=_0x2cf6fb;break;}return rp(_0x146d47)[_0x0d5a('0x1b')](function(_0x42c686){logger[_0x0d5a('0x2a')](_0x0d5a('0x2b'),_0x0d5a('0x23'),util[_0x0d5a('0x24')](_0x0d5a('0x2c'),_0x2cf6fb['id'],_0x294856[_0x0d5a('0x22')]));if(_0x42c686['body'][_0x0d5a('0x2d')]&&_0x42c686[_0x0d5a('0xd')][_0x0d5a('0x2d')]!=_0x2cf6fb['Interaction'][_0x0d5a('0x2d')]){return _0x9ae9c2['OpenchannelInteraction'][_0x0d5a('0x17')]({'threadId':_0x42c686['body'][_0x0d5a('0x2d')]},{'logging':!![],'where':{'id':_0x2cf6fb[_0x0d5a('0x25')]['id']}});}else{return;}})['then'](function(){return _0x4f541a[_0x0d5a('0x17')]({'read':!![]});})[_0x0d5a('0x19')](function(_0x595f1){logger[_0x0d5a('0x1a')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x0d5a('0x2e')](_0x595f1,{'showHidden':![],'depth':null}));_0x458e49();});}else{_0x458e49();}})[_0x0d5a('0x2f')](function(){_0x458e49();});}else{_0x458e49();}}},'charset':_0x0d5a('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 6f72100..1ed71b4 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc21c=['socket.io-emitter','register','info','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','OpenchannelMessage','body','options','then','CreateOpenchannelMessage','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc21c,0x166));var _0xcc21=function(_0x32186b,_0x161074){_0x32186b=_0x32186b-0x0;var _0x354549=_0xc21c[_0x32186b];return _0x354549;};'use strict';var _=require(_0xcc21('0x0'));var util=require(_0xcc21('0x1'));var moment=require('moment');var BPromise=require(_0xcc21('0x2'));var rs=require(_0xcc21('0x3'));var fs=require('fs');var Redis=require(_0xcc21('0x4'));var db=require(_0xcc21('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc21('0x6'))(_0xcc21('0x7'));var config=require(_0xcc21('0x8'));var jayson=require(_0xcc21('0x9'));var client=jayson[_0xcc21('0xa')][_0xcc21('0xb')]({'port':0x232a});config[_0xcc21('0xc')]=_['defaults'](config[_0xcc21('0xc')],{'host':_0xcc21('0xd'),'port':0x18eb});var socket=require(_0xcc21('0xe'))(new Redis(config[_0xcc21('0xc')]));require('./openchannelMessage.socket')[_0xcc21('0xf')](socket);function respondWithRpcPromise(_0x5cade6,_0x412a15,_0x4ecf6a){return new BPromise(function(_0x446165,_0x21c42f){return client['request'](_0x5cade6,_0x4ecf6a)['then'](function(_0x32cd27){logger[_0xcc21('0x10')]('OpenchannelMessage,\x20%s,\x20%s',_0x412a15,_0xcc21('0x11'));logger['debug'](_0xcc21('0x12'),_0x412a15,_0xcc21('0x11'),JSON[_0xcc21('0x13')](_0x32cd27));if(_0x32cd27['error']){if(_0x32cd27[_0xcc21('0x14')]['code']===0x1f4){logger[_0xcc21('0x14')](_0xcc21('0x15'),_0x412a15,_0x32cd27[_0xcc21('0x14')][_0xcc21('0x16')]);return _0x21c42f(_0x32cd27[_0xcc21('0x14')][_0xcc21('0x16')]);}logger[_0xcc21('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x412a15,_0x32cd27['error'][_0xcc21('0x16')]);return _0x446165(_0x32cd27['error'][_0xcc21('0x16')]);}else{logger[_0xcc21('0x10')](_0xcc21('0x15'),_0x412a15,_0xcc21('0x11'));_0x446165(_0x32cd27[_0xcc21('0x17')]['message']);}})[_0xcc21('0x18')](function(_0x2a3056){logger[_0xcc21('0x14')](_0xcc21('0x15'),_0x412a15,_0x2a3056);_0x21c42f(_0x2a3056);});});}exports['CreateOpenchannelMessage']=function(_0x103c5c){var _0xb96492=this;return new Promise(function(_0x399f99,_0x36cf4e){return db[_0xcc21('0x19')]['create'](_0x103c5c[_0xcc21('0x1a')],{'raw':_0x103c5c[_0xcc21('0x1b')]?_0x103c5c['options']['raw']===undefined?!![]:![]:!![]})[_0xcc21('0x1c')](function(_0x597ecf){logger[_0xcc21('0x10')](_0xcc21('0x1d'),_0x103c5c);logger[_0xcc21('0x1e')](_0xcc21('0x1d'),_0x103c5c,JSON[_0xcc21('0x13')](_0x597ecf));_0x399f99(_0x597ecf);})[_0xcc21('0x18')](function(_0x4e16c9){logger[_0xcc21('0x14')]('CreateOpenchannelMessage',_0x4e16c9[_0xcc21('0x16')],_0x103c5c);_0x36cf4e(_0xb96492[_0xcc21('0x14')](0x1f4,_0x4e16c9[_0xcc21('0x16')]));});});}; \ No newline at end of file +var _0x3e0c=['CreateOpenchannelMessage','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','defaults','redis','localhost','request','then','info','request\x20sent','debug','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','OpenchannelMessage','body','options','raw'];(function(_0x2a8000,_0x51c393){var _0x51b4d9=function(_0x542ba7){while(--_0x542ba7){_0x2a8000['push'](_0x2a8000['shift']());}};_0x51b4d9(++_0x51c393);}(_0x3e0c,0x16d));var _0xc3e0=function(_0x442a76,_0x2ad2ff){_0x442a76=_0x442a76-0x0;var _0x474fab=_0x3e0c[_0x442a76];return _0x474fab;};'use strict';var _=require(_0xc3e0('0x0'));var util=require(_0xc3e0('0x1'));var moment=require(_0xc3e0('0x2'));var BPromise=require('bluebird');var rs=require(_0xc3e0('0x3'));var fs=require('fs');var Redis=require(_0xc3e0('0x4'));var db=require(_0xc3e0('0x5'))['db'];var utils=require(_0xc3e0('0x6'));var logger=require(_0xc3e0('0x7'))('rpc');var config=require(_0xc3e0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xc3e0('0x9')](config[_0xc3e0('0xa')],{'host':_0xc3e0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x433fd1,_0x33ed9c,_0xca5897){return new BPromise(function(_0x231293,_0x3f38c5){return client[_0xc3e0('0xc')](_0x433fd1,_0xca5897)[_0xc3e0('0xd')](function(_0x493aaa){logger[_0xc3e0('0xe')]('OpenchannelMessage,\x20%s,\x20%s',_0x33ed9c,_0xc3e0('0xf'));logger[_0xc3e0('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x33ed9c,_0xc3e0('0xf'),JSON['stringify'](_0x493aaa));if(_0x493aaa[_0xc3e0('0x11')]){if(_0x493aaa[_0xc3e0('0x11')][_0xc3e0('0x12')]===0x1f4){logger[_0xc3e0('0x11')](_0xc3e0('0x13'),_0x33ed9c,_0x493aaa[_0xc3e0('0x11')][_0xc3e0('0x14')]);return _0x3f38c5(_0x493aaa['error'][_0xc3e0('0x14')]);}logger[_0xc3e0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x33ed9c,_0x493aaa[_0xc3e0('0x11')][_0xc3e0('0x14')]);return _0x231293(_0x493aaa[_0xc3e0('0x11')][_0xc3e0('0x14')]);}else{logger[_0xc3e0('0xe')](_0xc3e0('0x13'),_0x33ed9c,_0xc3e0('0xf'));_0x231293(_0x493aaa[_0xc3e0('0x15')][_0xc3e0('0x14')]);}})[_0xc3e0('0x16')](function(_0x6b3666){logger[_0xc3e0('0x11')](_0xc3e0('0x13'),_0x33ed9c,_0x6b3666);_0x3f38c5(_0x6b3666);});});}exports['CreateOpenchannelMessage']=function(_0x238f0e){var _0x46b141=this;return new Promise(function(_0x4d1f8a,_0x1c73d1){return db[_0xc3e0('0x17')]['create'](_0x238f0e[_0xc3e0('0x18')],{'raw':_0x238f0e['options']?_0x238f0e[_0xc3e0('0x19')][_0xc3e0('0x1a')]===undefined?!![]:![]:!![]})[_0xc3e0('0xd')](function(_0x572473){logger['info'](_0xc3e0('0x1b'),_0x238f0e);logger['debug'](_0xc3e0('0x1b'),_0x238f0e,JSON['stringify'](_0x572473));_0x4d1f8a(_0x572473);})[_0xc3e0('0x16')](function(_0x294b05){logger['error'](_0xc3e0('0x1b'),_0x294b05['message'],_0x238f0e);_0x1c73d1(_0x46b141[_0xc3e0('0x11')](0x1f4,_0x294b05[_0xc3e0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 86b6449..4a6b360 100644 --- a/server/api/openchannelMessage/openchannelMessage.socket.js +++ b/server/api/openchannelMessage/openchannelMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['removeListener','register','length','openchannelMessage:','remove','update'];(function(_0x582f72,_0x886d8){var _0x4cd5fe=function(_0x4ac1c7){while(--_0x4ac1c7){_0x582f72['push'](_0x582f72['shift']());}};_0x4cd5fe(++_0x886d8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x3071('0x0'),_0x3071('0x1')];function createListener(_0x27405a,_0x305d85){return function(_0x864539){_0x305d85['emit'](_0x27405a,_0x864539);};}function removeListener(_0x2c547f,_0x7b18a4){return function(){OpenchannelMessageEvents[_0x3071('0x2')](_0x2c547f,_0x7b18a4);};}exports[_0x3071('0x3')]=function(_0xabd7b6){for(var _0x41cf76=0x0,_0x1d3dd6=events[_0x3071('0x4')];_0x41cf76<_0x1d3dd6;_0x41cf76++){var _0xbd737f=events[_0x41cf76];var _0x22274c=createListener(_0x3071('0x5')+_0xbd737f,_0xabd7b6);OpenchannelMessageEvents['on'](_0xbd737f,_0x22274c);}}; \ No newline at end of file +var _0xd8b0=['save','emit','./openchannelMessage.events'];(function(_0x5c4d52,_0x40a7e6){var _0x23bc22=function(_0x4d731a){while(--_0x4d731a){_0x5c4d52['push'](_0x5c4d52['shift']());}};_0x23bc22(++_0x40a7e6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var OpenchannelMessageEvents=require(_0x0d8b('0x0'));var events=[_0x0d8b('0x1'),'remove','update'];function createListener(_0x4b72b0,_0x3ff8df){return function(_0x5b9b89){_0x3ff8df[_0x0d8b('0x2')](_0x4b72b0,_0x5b9b89);};}function removeListener(_0x364286,_0x8196ed){return function(){OpenchannelMessageEvents['removeListener'](_0x364286,_0x8196ed);};}exports['register']=function(_0x3f8b6f){for(var _0x227c63=0x0,_0x39f43a=events['length'];_0x227c63<_0x39f43a;_0x227c63++){var _0x413284=events[_0x227c63];var _0x284169=createListener('openchannelMessage:'+_0x413284,_0x3f8b6f);OpenchannelMessageEvents['on'](_0x413284,_0x284169);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 76e4f75..340ef5e 100644 --- a/server/api/openchannelQueue/index.js +++ b/server/api/openchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3468=['addAgents','update','delete','removeTeams','removeAgents','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe','get','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams'];(function(_0xebb27d,_0x439bee){var _0x4850e9=function(_0x21b00d){while(--_0x21b00d){_0xebb27d['push'](_0xebb27d['shift']());}};_0x4850e9(++_0x439bee);}(_0x3468,0x8d));var _0x8346=function(_0x4810da,_0x583e99){_0x4810da=_0x4810da-0x0;var _0x2315cc=_0x3468[_0x4810da];return _0x2315cc;};'use strict';var multer=require(_0x8346('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8346('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x8346('0x2'));var interaction=require(_0x8346('0x3'));var config=require(_0x8346('0x4'));var controller=require('./openchannelQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8346('0x5')]);router['get'](_0x8346('0x6'),auth[_0x8346('0x7')](),controller[_0x8346('0x8')]);router[_0x8346('0x9')](_0x8346('0xa'),auth[_0x8346('0x7')](),controller[_0x8346('0xb')]);router[_0x8346('0x9')](_0x8346('0xc'),auth[_0x8346('0x7')](),controller[_0x8346('0xd')]);router[_0x8346('0x9')](_0x8346('0xe'),auth['isAuthenticated'](),controller[_0x8346('0xf')]);router[_0x8346('0x9')](_0x8346('0x10'),auth[_0x8346('0x7')](),controller[_0x8346('0x11')]);router[_0x8346('0x12')]('/',auth['isAuthenticated'](),controller[_0x8346('0x13')]);router[_0x8346('0x12')](_0x8346('0xe'),auth[_0x8346('0x7')](),controller[_0x8346('0x14')]);router[_0x8346('0x12')](_0x8346('0x10'),auth['isAuthenticated'](),controller[_0x8346('0x15')]);router['put'](_0x8346('0xa'),auth['isAuthenticated'](),controller[_0x8346('0x16')]);router['delete'](_0x8346('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0x8346('0x17')](_0x8346('0xe'),auth['isAuthenticated'](),controller[_0x8346('0x18')]);router[_0x8346('0x17')](_0x8346('0x10'),auth['isAuthenticated'](),controller[_0x8346('0x19')]);module[_0x8346('0x1a')]=router; \ No newline at end of file +var _0xa1aa=['addAgents','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams'];(function(_0x3d5db9,_0x2dbe0a){var _0x3c114c=function(_0x3e0239){while(--_0x3e0239){_0x3d5db9['push'](_0x3d5db9['shift']());}};_0x3c114c(++_0x2dbe0a);}(_0xa1aa,0x88));var _0xaa1a=function(_0x56a3af,_0x33bf1d){_0x56a3af=_0x56a3af-0x0;var _0x1d547d=_0xa1aa[_0x56a3af];return _0x1d547d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaa1a('0x0'));var timeout=require(_0xaa1a('0x1'));var express=require(_0xaa1a('0x2'));var router=express[_0xaa1a('0x3')]();var auth=require(_0xaa1a('0x4'));var interaction=require(_0xaa1a('0x5'));var config=require(_0xaa1a('0x6'));var controller=require('./openchannelQueue.controller');router[_0xaa1a('0x7')]('/',auth[_0xaa1a('0x8')](),controller['index']);router[_0xaa1a('0x7')](_0xaa1a('0x9'),auth[_0xaa1a('0x8')](),controller[_0xaa1a('0xa')]);router[_0xaa1a('0x7')](_0xaa1a('0xb'),auth[_0xaa1a('0x8')](),controller[_0xaa1a('0xc')]);router[_0xaa1a('0x7')]('/:id/members',auth[_0xaa1a('0x8')](),controller['getMembers']);router[_0xaa1a('0x7')](_0xaa1a('0xd'),auth[_0xaa1a('0x8')](),controller[_0xaa1a('0xe')]);router[_0xaa1a('0x7')](_0xaa1a('0xf'),auth[_0xaa1a('0x8')](),controller[_0xaa1a('0x10')]);router[_0xaa1a('0x11')]('/',auth[_0xaa1a('0x8')](),controller[_0xaa1a('0x12')]);router['post']('/:id/teams',auth[_0xaa1a('0x8')](),controller[_0xaa1a('0x13')]);router[_0xaa1a('0x11')](_0xaa1a('0xf'),auth[_0xaa1a('0x8')](),controller[_0xaa1a('0x14')]);router['put'](_0xaa1a('0xb'),auth[_0xaa1a('0x8')](),controller['update']);router[_0xaa1a('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xaa1a('0x16')]);router[_0xaa1a('0x15')](_0xaa1a('0xd'),auth[_0xaa1a('0x8')](),controller[_0xaa1a('0x17')]);router[_0xaa1a('0x15')](_0xaa1a('0xf'),auth[_0xaa1a('0x8')](),controller[_0xaa1a('0x18')]);module[_0xaa1a('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 99200bf..4381421 100644 --- a/server/api/openchannelQueue/openchannelQueue.attributes.js +++ b/server/api/openchannelQueue/openchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f04=['name','INTEGER','rrmemory','roundrobin','exports','STRING'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x0f04,0x1de));var _0x40f0=function(_0x15a6e3,_0x268d8c){_0x15a6e3=_0x15a6e3-0x0;var _0x1d5915=_0x0f04[_0x15a6e3];return _0x1d5915;};'use strict';var Sequelize=require('sequelize');module[_0x40f0('0x0')]={'name':{'type':Sequelize[_0x40f0('0x1')],'unique':_0x40f0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x40f0('0x1')]},'timeout':{'type':Sequelize[_0x40f0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x40f0('0x4'),'beepall',_0x40f0('0x5'))}}; \ No newline at end of file +var _0x032e=['name','INTEGER','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x4bd06e,_0x593701){var _0x85ebb=function(_0x26a7f2){while(--_0x26a7f2){_0x4bd06e['push'](_0x4bd06e['shift']());}};_0x85ebb(++_0x593701);}(_0x032e,0x1cc));var _0xe032=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x032e[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0xe032('0x0')]={'name':{'type':Sequelize[_0xe032('0x1')],'unique':_0xe032('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe032('0x1')]},'timeout':{'type':Sequelize[_0xe032('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe032('0x4'),_0xe032('0x5'),_0xe032('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 6a5a558..61439be 100644 --- a/server/api/openchannelQueue/openchannelQueue.controller.js +++ b/server/api/openchannelQueue/openchannelQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x761b=['getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','OpenchannelQueue','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','OpenchannelQueueId','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','openchannelPause'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x761b,0x1e2));var _0xb761=function(_0x526c9a,_0x571d87){_0x526c9a=_0x526c9a-0x0;var _0x22f2eb=_0x761b[_0x526c9a];return _0x22f2eb;};'use strict';var pdf=require(_0xb761('0x0'));var emlformat=require(_0xb761('0x1'));var rimraf=require(_0xb761('0x2'));var zipdir=require(_0xb761('0x3'));var jsonpatch=require(_0xb761('0x4'));var rp=require(_0xb761('0x5'));var moment=require(_0xb761('0x6'));var BPromise=require(_0xb761('0x7'));var Mustache=require(_0xb761('0x8'));var util=require(_0xb761('0x9'));var path=require(_0xb761('0xa'));var sox=require(_0xb761('0xb'));var csv=require(_0xb761('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb761('0xd'));var squel=require(_0xb761('0xe'));var crypto=require(_0xb761('0xf'));var jsforce=require(_0xb761('0x10'));var deskjs=require(_0xb761('0x11'));var toCsv=require(_0xb761('0xc'));var querystring=require(_0xb761('0x12'));var Papa=require(_0xb761('0x13'));var Redis=require(_0xb761('0x14'));var authService=require(_0xb761('0x15'));var qs=require(_0xb761('0x16'));var as=require(_0xb761('0x17'));var hardwareService=require(_0xb761('0x18'));var logger=require(_0xb761('0x19'))(_0xb761('0x1a'));var utils=require(_0xb761('0x1b'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xb761('0x1c')]=_['defaults'](config[_0xb761('0x1c')],{'host':_0xb761('0x1d'),'port':0x18eb});var socket=require(_0xb761('0x1e'))(new Redis(config[_0xb761('0x1c')]));require(_0xb761('0x1f'))[_0xb761('0x20')](socket);function respondWithStatusCode(_0x13d374,_0x3afa63){_0x3afa63=_0x3afa63||0xcc;return function(_0x33e69e){if(_0x33e69e){return _0x13d374[_0xb761('0x21')](_0x3afa63);}return _0x13d374[_0xb761('0x22')](_0x3afa63)[_0xb761('0x23')]();};}function respondWithResult(_0x1656aa,_0xebb72e){_0xebb72e=_0xebb72e||0xc8;return function(_0x344eca){if(_0x344eca){return _0x1656aa['status'](_0xebb72e)[_0xb761('0x24')](_0x344eca);}};}function respondWithFilteredResult(_0x403af0,_0x48ee71){return function(_0x2443dc){if(_0x2443dc){var _0x1af1ef=_0x2443dc[_0xb761('0x25')],_0x3d5267=_0x48ee71[_0xb761('0x26')],_0x316a1c=_0x48ee71['offset']+_0x48ee71[_0xb761('0x27')],_0x4c6483;if(_0x316a1c>=_0x1af1ef){_0x316a1c=_0x1af1ef;_0x4c6483=0xc8;}else{_0x4c6483=0xce;}_0x403af0[_0xb761('0x22')](_0x4c6483);return _0x403af0['set'](_0xb761('0x28'),_0x3d5267+'-'+_0x316a1c+'/'+_0x1af1ef)[_0xb761('0x24')](_0x2443dc);}return null;};}function patchUpdates(_0x4836e6){return function(_0x250976){try{jsonpatch[_0xb761('0x29')](_0x250976,_0x4836e6,!![]);}catch(_0x1aaa1b){return BPromise[_0xb761('0x2a')](_0x1aaa1b);}return _0x250976[_0xb761('0x2b')]();};}function saveUpdates(_0x231d11,_0x37640b){return function(_0x3f2d41){if(_0x3f2d41){return _0x3f2d41['update'](_0x231d11)[_0xb761('0x2c')](function(_0x125ded){return _0x125ded;});}return null;};}function removeEntity(_0x4ec681,_0x2d6c2f){return function(_0x317e7c){if(_0x317e7c){return _0x317e7c[_0xb761('0x2d')]()['then'](function(){var _0x525a3c=_0x317e7c[_0xb761('0x2e')]({'plain':!![]});var _0x433ff2='OpenchannelQueues';return db['UserProfileResource'][_0xb761('0x2d')]({'where':{'type':_0x433ff2,'resourceId':_0x525a3c['id']}})['then'](function(){return _0x317e7c;});})[_0xb761('0x2c')](function(){_0x4ec681['status'](0xcc)[_0xb761('0x23')]();});}};}function handleEntityNotFound(_0x127676,_0x236b3f){return function(_0x311a39){if(!_0x311a39){_0x127676[_0xb761('0x21')](0x194);}return _0x311a39;};}function handleError(_0x170b18,_0x9e59b9){_0x9e59b9=_0x9e59b9||0x1f4;return function(_0x550963){logger[_0xb761('0x2f')](_0x550963[_0xb761('0x30')]);if(_0x550963[_0xb761('0x31')]){delete _0x550963[_0xb761('0x31')];}_0x170b18[_0xb761('0x22')](_0x9e59b9)['send'](_0x550963);};}exports[_0xb761('0x32')]=function(_0x2d5694,_0x38b8ff){var _0x67f96c={},_0x1bd6e7={},_0x267ef9={'count':0x0,'rows':[]};var _0x520662=_[_0xb761('0x33')](db['OpenchannelQueue'][_0xb761('0x34')],function(_0x3e3b37){return{'name':_0x3e3b37[_0xb761('0x35')],'type':_0x3e3b37[_0xb761('0x36')][_0xb761('0x37')]};});_0x1bd6e7[_0xb761('0x38')]=_[_0xb761('0x33')](_0x520662,_0xb761('0x31'));_0x1bd6e7[_0xb761('0x39')]=_[_0xb761('0x3a')](_0x2d5694['query']);_0x1bd6e7[_0xb761('0x3b')]=_[_0xb761('0x3c')](_0x1bd6e7[_0xb761('0x38')],_0x1bd6e7['query']);_0x67f96c[_0xb761('0x3d')]=_['intersection'](_0x1bd6e7[_0xb761('0x38')],qs['fields'](_0x2d5694[_0xb761('0x39')][_0xb761('0x3e')]));_0x67f96c[_0xb761('0x3d')]=_0x67f96c[_0xb761('0x3d')][_0xb761('0x3f')]?_0x67f96c[_0xb761('0x3d')]:_0x1bd6e7[_0xb761('0x38')];if(!_0x2d5694[_0xb761('0x39')][_0xb761('0x40')]('nolimit')){_0x67f96c[_0xb761('0x27')]=qs[_0xb761('0x27')](_0x2d5694[_0xb761('0x39')][_0xb761('0x27')]);_0x67f96c['offset']=qs[_0xb761('0x26')](_0x2d5694[_0xb761('0x39')][_0xb761('0x26')]);}_0x67f96c[_0xb761('0x41')]=qs[_0xb761('0x42')](_0x2d5694[_0xb761('0x39')][_0xb761('0x42')]);_0x67f96c[_0xb761('0x43')]=qs[_0xb761('0x3b')](_[_0xb761('0x44')](_0x2d5694[_0xb761('0x39')],_0x1bd6e7[_0xb761('0x3b')]),_0x520662);if(_0x2d5694['query'][_0xb761('0x45')]){_0x67f96c[_0xb761('0x43')]=_[_0xb761('0x46')](_0x67f96c[_0xb761('0x43')],{'$or':_[_0xb761('0x33')](_0x520662,function(_0x231a21){if(_0x231a21[_0xb761('0x36')]!==_0xb761('0x47')){var _0x5c09ff={};_0x5c09ff[_0x231a21[_0xb761('0x31')]]={'$like':'%'+_0x2d5694['query'][_0xb761('0x45')]+'%'};return _0x5c09ff;}})});}_0x67f96c=_['merge']({},_0x67f96c,_0x2d5694[_0xb761('0x48')]);var _0x669a3c={'where':_0x67f96c[_0xb761('0x43')]};return db['OpenchannelQueue'][_0xb761('0x25')](_0x669a3c)['then'](function(_0x4bbe57){_0x267ef9[_0xb761('0x25')]=_0x4bbe57;if(_0x2d5694[_0xb761('0x39')][_0xb761('0x49')]){_0x67f96c[_0xb761('0x4a')]=[{'all':!![]}];}return db[_0xb761('0x4b')][_0xb761('0x4c')](_0x67f96c);})[_0xb761('0x2c')](function(_0x34d3c6){_0x267ef9[_0xb761('0x4d')]=_0x34d3c6;return _0x267ef9;})['then'](respondWithFilteredResult(_0x38b8ff,_0x67f96c))['catch'](handleError(_0x38b8ff,null));};exports['show']=function(_0x388e05,_0x2f580b){var _0x2f8fb6={'raw':!![],'where':{'id':_0x388e05[_0xb761('0x4e')]['id']}},_0x37b23b={};_0x37b23b[_0xb761('0x38')]=_[_0xb761('0x3a')](db[_0xb761('0x4b')][_0xb761('0x34')]);_0x37b23b[_0xb761('0x39')]=_[_0xb761('0x3a')](_0x388e05[_0xb761('0x39')]);_0x37b23b[_0xb761('0x3b')]=_[_0xb761('0x3c')](_0x37b23b[_0xb761('0x38')],_0x37b23b[_0xb761('0x39')]);_0x2f8fb6['attributes']=_['intersection'](_0x37b23b['model'],qs[_0xb761('0x3e')](_0x388e05[_0xb761('0x39')][_0xb761('0x3e')]));_0x2f8fb6[_0xb761('0x3d')]=_0x2f8fb6[_0xb761('0x3d')][_0xb761('0x3f')]?_0x2f8fb6[_0xb761('0x3d')]:_0x37b23b[_0xb761('0x38')];if(_0x388e05[_0xb761('0x39')][_0xb761('0x49')]){_0x2f8fb6['include']=[{'all':!![]}];}_0x2f8fb6=_[_0xb761('0x46')]({},_0x2f8fb6,_0x388e05['options']);return db[_0xb761('0x4b')]['find'](_0x2f8fb6)[_0xb761('0x2c')](handleEntityNotFound(_0x2f580b,null))['then'](respondWithResult(_0x2f580b,null))[_0xb761('0x4f')](handleError(_0x2f580b,null));};exports[_0xb761('0x50')]=function(_0x5ecaa5,_0xda526f){return db[_0xb761('0x4b')]['create'](_0x5ecaa5[_0xb761('0x51')],{})[_0xb761('0x2c')](function(_0x58f657){var _0x2e2a41=_0x5ecaa5[_0xb761('0x52')]['get']({'plain':!![]});if(!_0x2e2a41)throw new Error(_0xb761('0x53'));if(_0x2e2a41[_0xb761('0x54')]==='user'){var _0x4c13a1=_0x58f657[_0xb761('0x2e')]({'plain':!![]});var _0x302204=_0xb761('0x55');return db['UserProfileSection'][_0xb761('0x56')]({'where':{'name':_0x302204,'userProfileId':_0x2e2a41[_0xb761('0x57')]},'raw':!![]})[_0xb761('0x2c')](function(_0x5d2146){if(_0x5d2146&&_0x5d2146['autoAssociation']===0x0){return db[_0xb761('0x58')]['create']({'name':_0x4c13a1['name'],'resourceId':_0x4c13a1['id'],'type':_0x5d2146[_0xb761('0x31')],'sectionId':_0x5d2146['id']},{})[_0xb761('0x2c')](function(){return _0x58f657;});}else{return _0x58f657;}})[_0xb761('0x4f')](function(_0xf3efc2){logger[_0xb761('0x2f')](_0xb761('0x59'),_0xf3efc2);throw _0xf3efc2;});}return _0x58f657;})['then'](respondWithResult(_0xda526f,0xc9))['catch'](handleError(_0xda526f,null));};exports[_0xb761('0x5a')]=function(_0x129547,_0x197546){if(_0x129547[_0xb761('0x51')]['id']){delete _0x129547[_0xb761('0x51')]['id'];}return db[_0xb761('0x4b')][_0xb761('0x56')]({'where':{'id':_0x129547[_0xb761('0x4e')]['id']}})[_0xb761('0x2c')](handleEntityNotFound(_0x197546,null))['then'](saveUpdates(_0x129547[_0xb761('0x51')],null))['then'](respondWithResult(_0x197546,null))[_0xb761('0x4f')](handleError(_0x197546,null));};exports['destroy']=function(_0x3d31fb,_0x2e6590){return db[_0xb761('0x4b')][_0xb761('0x56')]({'where':{'id':_0x3d31fb[_0xb761('0x4e')]['id']}})[_0xb761('0x2c')](handleEntityNotFound(_0x2e6590,null))[_0xb761('0x2c')](removeEntity(_0x2e6590,null))['catch'](handleError(_0x2e6590,null));};exports[_0xb761('0x5b')]=function(_0x509e29,_0x3526f7){return db[_0xb761('0x4b')][_0xb761('0x5b')]()[_0xb761('0x2c')](respondWithResult(_0x3526f7,null))[_0xb761('0x4f')](handleError(_0x3526f7,null));};exports[_0xb761('0x5c')]=function(_0xc2e0a7,_0x1a132a,_0x42c2af){var _0x4529e8={'raw':!![],'where':{}},_0x55e99f={},_0x5efec9;return db[_0xb761('0x4b')][_0xb761('0x5d')]({'where':{'id':_0xc2e0a7[_0xb761('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1a132a,null))[_0xb761('0x2c')](function(_0x5c1a69){if(_0x5c1a69){_0x5efec9=_0x5c1a69[_0xb761('0x2e')]({'plain':!![]});_0x55e99f['model']=_['keys'](db[_0xb761('0x5e')][_0xb761('0x34')]);_0x55e99f[_0xb761('0x39')]=_[_0xb761('0x3a')](_0xc2e0a7['query']);_0x55e99f['filters']=_[_0xb761('0x3c')](_0x55e99f['model'],_0x55e99f[_0xb761('0x39')]);_0x4529e8[_0xb761('0x3d')]=_['intersection'](_0x55e99f[_0xb761('0x38')],qs[_0xb761('0x3e')](_0xc2e0a7['query']['fields']));_0x4529e8[_0xb761('0x3d')]=_0x4529e8['attributes'][_0xb761('0x3f')]?_0x4529e8[_0xb761('0x3d')]:_0x55e99f[_0xb761('0x38')];if(!_0xc2e0a7[_0xb761('0x39')]['hasOwnProperty'](_0xb761('0x5f'))){_0x4529e8[_0xb761('0x27')]=qs['limit'](_0xc2e0a7[_0xb761('0x39')]['limit']);_0x4529e8[_0xb761('0x26')]=qs['offset'](_0xc2e0a7[_0xb761('0x39')][_0xb761('0x26')]);}_0x4529e8[_0xb761('0x41')]=qs[_0xb761('0x42')](_0xc2e0a7[_0xb761('0x39')][_0xb761('0x42')]);_0x4529e8[_0xb761('0x43')]=qs['filters'](_[_0xb761('0x44')](_0xc2e0a7[_0xb761('0x39')],_0x55e99f[_0xb761('0x3b')]));_0x4529e8[_0xb761('0x43')][_0xb761('0x60')]=_0x5c1a69['id'];if(_0xc2e0a7[_0xb761('0x39')]['filter']){_0x4529e8['where']=_[_0xb761('0x46')](_0x4529e8[_0xb761('0x43')],{'$or':_[_0xb761('0x33')](_0x4529e8[_0xb761('0x3d')],function(_0x411649){var _0x1a7e73={};_0x1a7e73[_0x411649]={'$like':'%'+_0xc2e0a7[_0xb761('0x39')][_0xb761('0x45')]+'%'};return _0x1a7e73;})});}_0x4529e8=_[_0xb761('0x46')]({},_0x4529e8,_0xc2e0a7[_0xb761('0x48')]);return db[_0xb761('0x5e')][_0xb761('0x4c')](_0x4529e8);}})['then'](function(_0x3f5bc1){if(_0x3f5bc1){return db['User'][_0xb761('0x61')]({'where':{'id':_[_0xb761('0x33')](_0x3f5bc1,_0xb761('0x62')),'role':_0xb761('0x63')},'attributes':['id','name','openchannelPause',_0xb761('0x64'),_0xb761('0x65')]});}})[_0xb761('0x2c')](function(_0x14e883){if(_0x14e883){return{'count':_0x14e883[_0xb761('0x25')],'rows':_['map'](_0x14e883['rows'],function(_0x38afed){return{'membername':_0x38afed[_0xb761('0x31')],'UserId':_0x38afed['id'],'queue_name':_0x5efec9[_0xb761('0x31')],'OpenchannelQueueId':_0x5efec9['id'],'interface':util[_0xb761('0x66')](_0xb761('0x67'),_0xb761('0x68'),_0x38afed[_0xb761('0x31')]),'penalty':0x0,'paused':_0x38afed[_0xb761('0x69')],'createdAt':_0x38afed[_0xb761('0x65')],'updatedAt':_0x38afed[_0xb761('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb761('0x2c')](respondWithFilteredResult(_0x1a132a,_0x4529e8))[_0xb761('0x4f')](handleError(_0x1a132a,null));};exports[_0xb761('0x6a')]=function(_0x293a13,_0x4a4eca,_0x9087b8){var _0x516747={};var _0x41e2aa={};var _0x5a5961;var _0x2e90fb;return db[_0xb761('0x4b')]['findOne']({'where':{'id':_0x293a13[_0xb761('0x4e')]['id']}})[_0xb761('0x2c')](handleEntityNotFound(_0x4a4eca,null))[_0xb761('0x2c')](function(_0x3e35fe){if(_0x3e35fe){_0x5a5961=_0x3e35fe;_0x41e2aa[_0xb761('0x38')]=_['keys'](db[_0xb761('0x6b')]['rawAttributes']);_0x41e2aa[_0xb761('0x39')]=_['keys'](_0x293a13[_0xb761('0x39')]);_0x41e2aa[_0xb761('0x3b')]=_[_0xb761('0x3c')](_0x41e2aa[_0xb761('0x38')],_0x41e2aa[_0xb761('0x39')]);_0x516747[_0xb761('0x3d')]=_[_0xb761('0x3c')](_0x41e2aa['model'],qs[_0xb761('0x3e')](_0x293a13[_0xb761('0x39')]['fields']));_0x516747['attributes']=_0x516747[_0xb761('0x3d')][_0xb761('0x3f')]?_0x516747[_0xb761('0x3d')]:_0x41e2aa[_0xb761('0x38')];_0x516747[_0xb761('0x41')]=qs[_0xb761('0x42')](_0x293a13[_0xb761('0x39')][_0xb761('0x42')]);_0x516747[_0xb761('0x43')]=qs['filters'](_[_0xb761('0x44')](_0x293a13['query'],_0x41e2aa[_0xb761('0x3b')]));if(_0x293a13[_0xb761('0x39')][_0xb761('0x45')]){_0x516747[_0xb761('0x43')]=_[_0xb761('0x46')](_0x516747['where'],{'$or':_[_0xb761('0x33')](_0x516747['attributes'],function(_0x46a38f){var _0x568368={};_0x568368[_0x46a38f]={'$like':'%'+_0x293a13[_0xb761('0x39')]['filter']+'%'};return _0x568368;})});}_0x516747=_[_0xb761('0x46')]({},_0x516747,_0x293a13[_0xb761('0x48')]);return _0x5a5961[_0xb761('0x6a')](_0x516747);}})[_0xb761('0x2c')](function(_0xe771ac){if(_0xe771ac){_0x2e90fb=_0xe771ac[_0xb761('0x3f')];if(!_0x293a13[_0xb761('0x39')]['hasOwnProperty'](_0xb761('0x5f'))){_0x516747[_0xb761('0x27')]=qs[_0xb761('0x27')](_0x293a13[_0xb761('0x39')][_0xb761('0x27')]);_0x516747[_0xb761('0x26')]=qs[_0xb761('0x26')](_0x293a13['query'][_0xb761('0x26')]);}return _0x5a5961[_0xb761('0x6a')](_0x516747);}})[_0xb761('0x2c')](function(_0x368208){if(_0x368208){return _0x368208?{'count':_0x2e90fb,'rows':_0x368208}:null;}})['then'](respondWithResult(_0x4a4eca,null))[_0xb761('0x4f')](handleError(_0x4a4eca,null));};exports[_0xb761('0x6c')]=function(_0x4ca65d,_0x3afb85,_0x570048){var _0x1fabe2=_0x4ca65d[_0xb761('0x51')][_0xb761('0x6d')];return db[_0xb761('0x6b')][_0xb761('0x4c')]({'where':{'id':_0x1fabe2},'attributes':['id'],'include':[{'model':db[_0xb761('0x6e')],'as':_0xb761('0x6f'),'attributes':['id',_0xb761('0x31'),_0xb761('0x70'),_0xb761('0x71'),_0xb761('0x72')],'raw':!![]}]})['then'](function(_0x58509f){if(_0x58509f){var _0x50c18e=_['flatMap'](_0x58509f,function(_0x4725ad){var _0x304525=_0x4725ad[_0xb761('0x2e')]({'plain':!![]});return _0x304525[_0xb761('0x6f')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x4ca65d[_0xb761('0x4e')]['id']}})[_0xb761('0x2c')](function(_0x4423e9){return db[_0xb761('0x73')][_0xb761('0x74')](function(_0x3d888a){return _0x4423e9[_0xb761('0x6c')](_0x1fabe2,{'transaction':_0x3d888a})[_0xb761('0x2c')](function(){return BPromise[_0xb761('0x75')](_0x50c18e,function(_0x28e9d2){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x28e9d2['id'],'OpenchannelQueueId':_0x4ca65d[_0xb761('0x4e')]['id']},'transaction':_0x3d888a});});})['then'](function(){_0x50c18e[_0xb761('0x76')](function(_0x21ebae){socket[_0xb761('0x77')](_0xb761('0x78'),{'UserId':_0x21ebae['id'],'OpenchannelQueueId':_0x4423e9['id']});});});});});}})[_0xb761('0x2c')](respondWithStatusCode(_0x3afb85,null))[_0xb761('0x4f')](handleError(_0x3afb85,null));};exports['removeTeams']=function(_0x438b7e,_0x8d9892,_0x34bd3c){return db[_0xb761('0x6b')][_0xb761('0x4c')]({'where':{'id':_0x438b7e['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xb761('0x6e')],'as':_0xb761('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xb761('0x2c')](handleEntityNotFound(_0x8d9892,null))[_0xb761('0x2c')](function(_0x113069){var _0x3dec84=_['map'](_0x113069,'id');var _0x396cff=[];var _0x2bf904=[];var _0x3cdebd=squel[_0xb761('0x79')]();_0x3cdebd[_0xb761('0x7a')](_0xb761('0x7b'))[_0xb761('0x7c')](_0xb761('0x7d'),'tq')['join'](_0xb761('0x7e'),'ut',_0xb761('0x7f'))[_0xb761('0x43')]('OpenchannelQueueId\x20=\x20?',_0x438b7e[_0xb761('0x4e')]['id']);for(var _0x282d62=0x0;_0x282d62<_0x113069['length'];_0x282d62+=0x1){let _0x575676=_0x113069[_0x282d62];for(var _0xe5380c=0x0;_0xe5380c<_0x575676[_0xb761('0x6f')][_0xb761('0x3f')];_0xe5380c+=0x1){let _0xbd3fc6=_0x575676[_0xb761('0x6f')][_0xe5380c];var _0x2ed54a=_0x3cdebd['clone']();_0x2ed54a[_0xb761('0x43')](_0xb761('0x80'),_0xbd3fc6['id']);_0x2bf904[_0xb761('0x81')](db[_0xb761('0x73')]['query'](_0x2ed54a[_0xb761('0x82')](),{'type':db[_0xb761('0x73')][_0xb761('0x83')][_0xb761('0x84')]})[_0xb761('0x2c')](function(_0x323537){if(_0x323537[_0xb761('0x3f')]===0x1){return _0xbd3fc6['id'];}else{var _0x4ae2fe=_[_0xb761('0x85')](_['map'](_0x323537,_0xb761('0x86')),function(_0x49cfef){return _[_0xb761('0x87')](_0x3dec84,_0x49cfef);});if(_0x4ae2fe){return _0xbd3fc6['id'];}}}));}}return BPromise[_0xb761('0x88')](_0x2bf904)[_0xb761('0x2c')](function(_0x160c9a){_0x396cff=_(_0x396cff)[_0xb761('0x89')](_0x160c9a)[_0xb761('0x8a')]()['value']();return db['OpenchannelQueue']['find']({'where':{'id':_0x438b7e['params']['id']}})[_0xb761('0x2c')](function(_0x543838){return db['sequelize']['transaction'](function(_0x5d4e62){return _0x543838[_0xb761('0x8b')](_0x438b7e[_0xb761('0x39')]['ids'],{'transaction':_0x5d4e62})[_0xb761('0x2c')](function(){if(!_[_0xb761('0x8c')](_0x396cff)){return _0x543838[_0xb761('0x8d')](_0x396cff,{'transaction':_0x5d4e62});}})['then'](function(){_0x396cff[_0xb761('0x76')](function(_0x48b696){socket['emit'](_0xb761('0x8e'),{'UserId':_0x48b696,'OpenchannelQueueId':_0x543838['id']});});});});});});})[_0xb761('0x2c')](respondWithStatusCode(_0x8d9892,null))[_0xb761('0x4f')](handleError(_0x8d9892,null));};exports[_0xb761('0x8f')]=function(_0x20cdb5,_0x27e48d,_0x15eda0){return db['OpenchannelQueue'][_0xb761('0x56')]({'where':{'id':_0x20cdb5[_0xb761('0x4e')]['id']}})[_0xb761('0x2c')](handleEntityNotFound(_0x27e48d,null))[_0xb761('0x2c')](function(_0x1f88e0){if(_0x1f88e0){return _0x1f88e0[_0xb761('0x8f')](_0x20cdb5['body'][_0xb761('0x6d')],_['omit'](_0x20cdb5[_0xb761('0x51')],[_0xb761('0x6d'),'id'])||{})[_0xb761('0x90')](function(_0x281e6c){for(var _0x3090c9=0x0;_0x3090c9<_0x20cdb5[_0xb761('0x51')]['ids']['length'];_0x3090c9+=0x1){socket[_0xb761('0x77')](_0xb761('0x78'),{'UserId':_0x20cdb5[_0xb761('0x51')][_0xb761('0x6d')][_0x3090c9],'OpenchannelQueueId':_0x20cdb5['params']['id']});}return _0x281e6c;});}})['then'](respondWithResult(_0x27e48d,null))[_0xb761('0x4f')](handleError(_0x27e48d,null));};exports[_0xb761('0x8d')]=function(_0x514439,_0x402659,_0x545ede){return db[_0xb761('0x4b')][_0xb761('0x56')]({'where':{'id':_0x514439[_0xb761('0x4e')]['id']}})[_0xb761('0x2c')](handleEntityNotFound(_0x402659,null))[_0xb761('0x2c')](function(_0x2f7f59){if(_0x2f7f59){return _0x2f7f59[_0xb761('0x8d')](_0x514439[_0xb761('0x39')][_0xb761('0x6d')])['then'](function(){if(_[_0xb761('0x91')](_0x514439[_0xb761('0x39')][_0xb761('0x6d')])){for(var _0x44101b=0x0;_0x44101b<_0x514439[_0xb761('0x39')][_0xb761('0x6d')][_0xb761('0x3f')];_0x44101b+=0x1){socket['emit'](_0xb761('0x8e'),{'UserId':Number(_0x514439[_0xb761('0x39')][_0xb761('0x6d')][_0x44101b]),'OpenchannelQueueId':Number(_0x514439['params']['id'])});}}else{socket[_0xb761('0x77')](_0xb761('0x8e'),{'UserId':Number(_0x514439[_0xb761('0x39')]['ids']),'OpenchannelQueueId':Number(_0x514439[_0xb761('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x402659,null))['catch'](handleError(_0x402659,null));};exports[_0xb761('0x92')]=function(_0x3c0472,_0xb5dec0,_0x100147){var _0x382a68={};var _0x2cf4b5={};var _0x335f6a;var _0x55c266;return db['OpenchannelQueue'][_0xb761('0x5d')]({'where':{'id':_0x3c0472[_0xb761('0x4e')]['id']}})['then'](handleEntityNotFound(_0xb5dec0,null))['then'](function(_0x324ea7){if(_0x324ea7){_0x335f6a=_0x324ea7;_0x2cf4b5[_0xb761('0x38')]=_[_0xb761('0x3a')](db[_0xb761('0x6e')][_0xb761('0x34')]);_0x2cf4b5[_0xb761('0x39')]=_[_0xb761('0x3a')](_0x3c0472['query']);_0x2cf4b5[_0xb761('0x3b')]=_['intersection'](_0x2cf4b5['model'],_0x2cf4b5[_0xb761('0x39')]);_0x382a68[_0xb761('0x3d')]=_[_0xb761('0x3c')](_0x2cf4b5[_0xb761('0x38')],qs[_0xb761('0x3e')](_0x3c0472[_0xb761('0x39')][_0xb761('0x3e')]));_0x382a68[_0xb761('0x3d')]=_0x382a68[_0xb761('0x3d')][_0xb761('0x3f')]?_0x382a68[_0xb761('0x3d')]:_0x2cf4b5['model'];_0x382a68[_0xb761('0x41')]=qs[_0xb761('0x42')](_0x3c0472[_0xb761('0x39')][_0xb761('0x42')]);_0x382a68[_0xb761('0x43')]=qs[_0xb761('0x3b')](_[_0xb761('0x44')](_0x3c0472[_0xb761('0x39')],_0x2cf4b5[_0xb761('0x3b')]));if(_0x3c0472[_0xb761('0x39')][_0xb761('0x45')]){_0x382a68[_0xb761('0x43')]=_['merge'](_0x382a68[_0xb761('0x43')],{'$or':_[_0xb761('0x33')](_0x382a68['attributes'],function(_0x45cd9d){var _0x397073={};_0x397073[_0x45cd9d]={'$like':'%'+_0x3c0472[_0xb761('0x39')][_0xb761('0x45')]+'%'};return _0x397073;})});}_0x382a68=_['merge']({},_0x382a68,_0x3c0472[_0xb761('0x48')]);return _0x335f6a[_0xb761('0x92')](_0x382a68);}})[_0xb761('0x2c')](function(_0x15b296){if(_0x15b296){_0x55c266=_0x15b296['length'];if(!_0x3c0472[_0xb761('0x39')]['hasOwnProperty'](_0xb761('0x5f'))){_0x382a68[_0xb761('0x27')]=qs[_0xb761('0x27')](_0x3c0472[_0xb761('0x39')][_0xb761('0x27')]);_0x382a68['offset']=qs[_0xb761('0x26')](_0x3c0472[_0xb761('0x39')][_0xb761('0x26')]);}return _0x335f6a['getAgents'](_0x382a68);}})[_0xb761('0x2c')](function(_0x480b44){if(_0x480b44){return _0x480b44?{'count':_0x55c266,'rows':_0x480b44}:null;}})[_0xb761('0x2c')](respondWithResult(_0xb5dec0,null))[_0xb761('0x4f')](handleError(_0xb5dec0,null));}; \ No newline at end of file +var _0x6097=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','status','end','count','offset','limit','Content-Range','json','save','update','destroy','then','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','index','map','OpenchannelQueue','rawAttributes','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','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','params','describe','getMembers','findOne','keys','UserOpenchannelQueue','OpenchannelQueueId','User','agent','updatedAt','createdAt','rows','format','%s/%s','SIP','openchannelPause','getTeams','addTeams','ids','Team','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','Agents','select','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','compact','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','squel'];(function(_0x41109b,_0x3aa27b){var _0x1ab006=function(_0x2d411d){while(--_0x2d411d){_0x41109b['push'](_0x41109b['shift']());}};_0x1ab006(++_0x3aa27b);}(_0x6097,0x7b));var _0x7609=function(_0x446f11,_0x95cf21){_0x446f11=_0x446f11-0x0;var _0x385cb5=_0x6097[_0x446f11];return _0x385cb5;};'use strict';var pdf=require(_0x7609('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7609('0x1'));var zipdir=require(_0x7609('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7609('0x3'));var BPromise=require(_0x7609('0x4'));var Mustache=require(_0x7609('0x5'));var util=require(_0x7609('0x6'));var path=require('path');var sox=require(_0x7609('0x7'));var csv=require(_0x7609('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7609('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7609('0xa'));var toCsv=require(_0x7609('0x8'));var querystring=require(_0x7609('0xb'));var Papa=require(_0x7609('0xc'));var Redis=require('ioredis');var authService=require(_0x7609('0xd'));var qs=require(_0x7609('0xe'));var as=require(_0x7609('0xf'));var hardwareService=require(_0x7609('0x10'));var logger=require(_0x7609('0x11'))(_0x7609('0x12'));var utils=require(_0x7609('0x13'));var config=require(_0x7609('0x14'));var db=require(_0x7609('0x15'))['db'];config['redis']=_[_0x7609('0x16')](config[_0x7609('0x17')],{'host':_0x7609('0x18'),'port':0x18eb});var socket=require(_0x7609('0x19'))(new Redis(config['redis']));require(_0x7609('0x1a'))['register'](socket);function respondWithStatusCode(_0x37af32,_0x2b28cb){_0x2b28cb=_0x2b28cb||0xcc;return function(_0xbb5edb){if(_0xbb5edb){return _0x37af32['sendStatus'](_0x2b28cb);}return _0x37af32[_0x7609('0x1b')](_0x2b28cb)[_0x7609('0x1c')]();};}function respondWithResult(_0x134b5a,_0xfd77bb){_0xfd77bb=_0xfd77bb||0xc8;return function(_0x4fcc63){if(_0x4fcc63){return _0x134b5a[_0x7609('0x1b')](_0xfd77bb)['json'](_0x4fcc63);}};}function respondWithFilteredResult(_0x1bf6fc,_0x134427){return function(_0x35b0f3){if(_0x35b0f3){var _0x569c66=_0x35b0f3[_0x7609('0x1d')],_0x5d8a0d=_0x134427[_0x7609('0x1e')],_0x3ec4f9=_0x134427[_0x7609('0x1e')]+_0x134427[_0x7609('0x1f')],_0x4989a4;if(_0x3ec4f9>=_0x569c66){_0x3ec4f9=_0x569c66;_0x4989a4=0xc8;}else{_0x4989a4=0xce;}_0x1bf6fc[_0x7609('0x1b')](_0x4989a4);return _0x1bf6fc['set'](_0x7609('0x20'),_0x5d8a0d+'-'+_0x3ec4f9+'/'+_0x569c66)[_0x7609('0x21')](_0x35b0f3);}return null;};}function patchUpdates(_0xf6dbcb){return function(_0x202d8a){try{jsonpatch['apply'](_0x202d8a,_0xf6dbcb,!![]);}catch(_0x1e3dd1){return BPromise['reject'](_0x1e3dd1);}return _0x202d8a[_0x7609('0x22')]();};}function saveUpdates(_0x2f8491,_0xbc67ae){return function(_0x218d3e){if(_0x218d3e){return _0x218d3e[_0x7609('0x23')](_0x2f8491)['then'](function(_0xee7f55){return _0xee7f55;});}return null;};}function removeEntity(_0x3c3673,_0x61934){return function(_0x192006){if(_0x192006){return _0x192006[_0x7609('0x24')]()[_0x7609('0x25')](function(){var _0xac414e=_0x192006['get']({'plain':!![]});var _0x34104c=_0x7609('0x26');return db[_0x7609('0x27')][_0x7609('0x24')]({'where':{'type':_0x34104c,'resourceId':_0xac414e['id']}})[_0x7609('0x25')](function(){return _0x192006;});})[_0x7609('0x25')](function(){_0x3c3673[_0x7609('0x1b')](0xcc)[_0x7609('0x1c')]();});}};}function handleEntityNotFound(_0x28a290,_0x4171ef){return function(_0x15d2e5){if(!_0x15d2e5){_0x28a290[_0x7609('0x28')](0x194);}return _0x15d2e5;};}function handleError(_0x406a69,_0x4b117b){_0x4b117b=_0x4b117b||0x1f4;return function(_0x53bc8b){logger[_0x7609('0x29')](_0x53bc8b[_0x7609('0x2a')]);if(_0x53bc8b[_0x7609('0x2b')]){delete _0x53bc8b['name'];}_0x406a69[_0x7609('0x1b')](_0x4b117b)['send'](_0x53bc8b);};}exports[_0x7609('0x2c')]=function(_0x19f296,_0x1ed8d5){var _0x3073b3={},_0x4bd58a={},_0x3fa99b={'count':0x0,'rows':[]};var _0x2ffe32=_[_0x7609('0x2d')](db[_0x7609('0x2e')][_0x7609('0x2f')],function(_0x30039e){return{'name':_0x30039e['fieldName'],'type':_0x30039e['type'][_0x7609('0x30')]};});_0x4bd58a[_0x7609('0x31')]=_[_0x7609('0x2d')](_0x2ffe32,_0x7609('0x2b'));_0x4bd58a['query']=_['keys'](_0x19f296[_0x7609('0x32')]);_0x4bd58a['filters']=_[_0x7609('0x33')](_0x4bd58a[_0x7609('0x31')],_0x4bd58a[_0x7609('0x32')]);_0x3073b3['attributes']=_['intersection'](_0x4bd58a[_0x7609('0x31')],qs[_0x7609('0x34')](_0x19f296[_0x7609('0x32')]['fields']));_0x3073b3['attributes']=_0x3073b3[_0x7609('0x35')][_0x7609('0x36')]?_0x3073b3[_0x7609('0x35')]:_0x4bd58a[_0x7609('0x31')];if(!_0x19f296['query'][_0x7609('0x37')](_0x7609('0x38'))){_0x3073b3['limit']=qs[_0x7609('0x1f')](_0x19f296['query'][_0x7609('0x1f')]);_0x3073b3[_0x7609('0x1e')]=qs[_0x7609('0x1e')](_0x19f296['query']['offset']);}_0x3073b3[_0x7609('0x39')]=qs[_0x7609('0x3a')](_0x19f296['query'][_0x7609('0x3a')]);_0x3073b3[_0x7609('0x3b')]=qs[_0x7609('0x3c')](_[_0x7609('0x3d')](_0x19f296[_0x7609('0x32')],_0x4bd58a[_0x7609('0x3c')]),_0x2ffe32);if(_0x19f296[_0x7609('0x32')][_0x7609('0x3e')]){_0x3073b3[_0x7609('0x3b')]=_[_0x7609('0x3f')](_0x3073b3[_0x7609('0x3b')],{'$or':_[_0x7609('0x2d')](_0x2ffe32,function(_0x144b2c){if(_0x144b2c[_0x7609('0x40')]!=='VIRTUAL'){var _0x1028db={};_0x1028db[_0x144b2c[_0x7609('0x2b')]]={'$like':'%'+_0x19f296[_0x7609('0x32')][_0x7609('0x3e')]+'%'};return _0x1028db;}})});}_0x3073b3=_[_0x7609('0x3f')]({},_0x3073b3,_0x19f296[_0x7609('0x41')]);var _0x222872={'where':_0x3073b3['where']};return db[_0x7609('0x2e')]['count'](_0x222872)[_0x7609('0x25')](function(_0x47c749){_0x3fa99b[_0x7609('0x1d')]=_0x47c749;if(_0x19f296[_0x7609('0x32')][_0x7609('0x42')]){_0x3073b3[_0x7609('0x43')]=[{'all':!![]}];}return db[_0x7609('0x2e')][_0x7609('0x44')](_0x3073b3);})[_0x7609('0x25')](function(_0x1ce66a){_0x3fa99b['rows']=_0x1ce66a;return _0x3fa99b;})[_0x7609('0x25')](respondWithFilteredResult(_0x1ed8d5,_0x3073b3))[_0x7609('0x45')](handleError(_0x1ed8d5,null));};exports[_0x7609('0x46')]=function(_0x37ce89,_0xae57ca){var _0x4463f1={'raw':!![],'where':{'id':_0x37ce89['params']['id']}},_0x54984d={};_0x54984d['model']=_['keys'](db[_0x7609('0x2e')]['rawAttributes']);_0x54984d[_0x7609('0x32')]=_['keys'](_0x37ce89[_0x7609('0x32')]);_0x54984d[_0x7609('0x3c')]=_[_0x7609('0x33')](_0x54984d[_0x7609('0x31')],_0x54984d[_0x7609('0x32')]);_0x4463f1[_0x7609('0x35')]=_[_0x7609('0x33')](_0x54984d[_0x7609('0x31')],qs[_0x7609('0x34')](_0x37ce89[_0x7609('0x32')]['fields']));_0x4463f1[_0x7609('0x35')]=_0x4463f1['attributes'][_0x7609('0x36')]?_0x4463f1[_0x7609('0x35')]:_0x54984d[_0x7609('0x31')];if(_0x37ce89[_0x7609('0x32')]['includeAll']){_0x4463f1[_0x7609('0x43')]=[{'all':!![]}];}_0x4463f1=_[_0x7609('0x3f')]({},_0x4463f1,_0x37ce89[_0x7609('0x41')]);return db[_0x7609('0x2e')][_0x7609('0x47')](_0x4463f1)[_0x7609('0x25')](handleEntityNotFound(_0xae57ca,null))['then'](respondWithResult(_0xae57ca,null))['catch'](handleError(_0xae57ca,null));};exports[_0x7609('0x48')]=function(_0x1b09f7,_0x438d7d){return db['OpenchannelQueue'][_0x7609('0x48')](_0x1b09f7[_0x7609('0x49')],{})[_0x7609('0x25')](function(_0x4f7bf2){var _0x1afaa3=_0x1b09f7[_0x7609('0x4a')][_0x7609('0x4b')]({'plain':!![]});if(!_0x1afaa3)throw new Error(_0x7609('0x4c'));if(_0x1afaa3[_0x7609('0x4d')]===_0x7609('0x4a')){var _0x7b627c=_0x4f7bf2[_0x7609('0x4b')]({'plain':!![]});var _0x2e7178=_0x7609('0x26');return db[_0x7609('0x4e')][_0x7609('0x47')]({'where':{'name':_0x2e7178,'userProfileId':_0x1afaa3[_0x7609('0x4f')]},'raw':!![]})[_0x7609('0x25')](function(_0x48eacc){if(_0x48eacc&&_0x48eacc[_0x7609('0x50')]===0x0){return db[_0x7609('0x27')]['create']({'name':_0x7b627c['name'],'resourceId':_0x7b627c['id'],'type':_0x48eacc[_0x7609('0x2b')],'sectionId':_0x48eacc['id']},{})[_0x7609('0x25')](function(){return _0x4f7bf2;});}else{return _0x4f7bf2;}})['catch'](function(_0x50847b){logger[_0x7609('0x29')](_0x7609('0x51'),_0x50847b);throw _0x50847b;});}return _0x4f7bf2;})[_0x7609('0x25')](respondWithResult(_0x438d7d,0xc9))['catch'](handleError(_0x438d7d,null));};exports[_0x7609('0x23')]=function(_0x418484,_0x4f6101){if(_0x418484[_0x7609('0x49')]['id']){delete _0x418484[_0x7609('0x49')]['id'];}return db[_0x7609('0x2e')][_0x7609('0x47')]({'where':{'id':_0x418484[_0x7609('0x52')]['id']}})[_0x7609('0x25')](handleEntityNotFound(_0x4f6101,null))[_0x7609('0x25')](saveUpdates(_0x418484[_0x7609('0x49')],null))['then'](respondWithResult(_0x4f6101,null))['catch'](handleError(_0x4f6101,null));};exports[_0x7609('0x24')]=function(_0x2e00b9,_0x462afd){return db['OpenchannelQueue'][_0x7609('0x47')]({'where':{'id':_0x2e00b9[_0x7609('0x52')]['id']}})[_0x7609('0x25')](handleEntityNotFound(_0x462afd,null))['then'](removeEntity(_0x462afd,null))[_0x7609('0x45')](handleError(_0x462afd,null));};exports[_0x7609('0x53')]=function(_0x157c3e,_0x3dc68f){return db[_0x7609('0x2e')][_0x7609('0x53')]()[_0x7609('0x25')](respondWithResult(_0x3dc68f,null))[_0x7609('0x45')](handleError(_0x3dc68f,null));};exports[_0x7609('0x54')]=function(_0x9ff230,_0x438982,_0x4ee89f){var _0x48b1c5={'raw':!![],'where':{}},_0xc30a66={},_0x494ea2;return db[_0x7609('0x2e')][_0x7609('0x55')]({'where':{'id':_0x9ff230[_0x7609('0x52')]['id']}})[_0x7609('0x25')](handleEntityNotFound(_0x438982,null))[_0x7609('0x25')](function(_0x3a04ab){if(_0x3a04ab){_0x494ea2=_0x3a04ab[_0x7609('0x4b')]({'plain':!![]});_0xc30a66[_0x7609('0x31')]=_[_0x7609('0x56')](db[_0x7609('0x57')][_0x7609('0x2f')]);_0xc30a66[_0x7609('0x32')]=_['keys'](_0x9ff230[_0x7609('0x32')]);_0xc30a66[_0x7609('0x3c')]=_[_0x7609('0x33')](_0xc30a66[_0x7609('0x31')],_0xc30a66[_0x7609('0x32')]);_0x48b1c5[_0x7609('0x35')]=_[_0x7609('0x33')](_0xc30a66['model'],qs[_0x7609('0x34')](_0x9ff230[_0x7609('0x32')][_0x7609('0x34')]));_0x48b1c5['attributes']=_0x48b1c5[_0x7609('0x35')][_0x7609('0x36')]?_0x48b1c5[_0x7609('0x35')]:_0xc30a66['model'];if(!_0x9ff230['query'][_0x7609('0x37')](_0x7609('0x38'))){_0x48b1c5['limit']=qs['limit'](_0x9ff230[_0x7609('0x32')][_0x7609('0x1f')]);_0x48b1c5[_0x7609('0x1e')]=qs[_0x7609('0x1e')](_0x9ff230[_0x7609('0x32')][_0x7609('0x1e')]);}_0x48b1c5[_0x7609('0x39')]=qs[_0x7609('0x3a')](_0x9ff230[_0x7609('0x32')][_0x7609('0x3a')]);_0x48b1c5[_0x7609('0x3b')]=qs[_0x7609('0x3c')](_[_0x7609('0x3d')](_0x9ff230[_0x7609('0x32')],_0xc30a66[_0x7609('0x3c')]));_0x48b1c5[_0x7609('0x3b')][_0x7609('0x58')]=_0x3a04ab['id'];if(_0x9ff230[_0x7609('0x32')][_0x7609('0x3e')]){_0x48b1c5[_0x7609('0x3b')]=_['merge'](_0x48b1c5['where'],{'$or':_[_0x7609('0x2d')](_0x48b1c5[_0x7609('0x35')],function(_0x2a1a42){var _0x2bb75e={};_0x2bb75e[_0x2a1a42]={'$like':'%'+_0x9ff230[_0x7609('0x32')][_0x7609('0x3e')]+'%'};return _0x2bb75e;})});}_0x48b1c5=_[_0x7609('0x3f')]({},_0x48b1c5,_0x9ff230[_0x7609('0x41')]);return db[_0x7609('0x57')][_0x7609('0x44')](_0x48b1c5);}})[_0x7609('0x25')](function(_0x3d7906){if(_0x3d7906){return db[_0x7609('0x59')]['findAndCountAll']({'where':{'id':_[_0x7609('0x2d')](_0x3d7906,'UserId'),'role':_0x7609('0x5a')},'attributes':['id',_0x7609('0x2b'),'openchannelPause',_0x7609('0x5b'),_0x7609('0x5c')]});}})[_0x7609('0x25')](function(_0x1eaeed){if(_0x1eaeed){return{'count':_0x1eaeed[_0x7609('0x1d')],'rows':_['map'](_0x1eaeed[_0x7609('0x5d')],function(_0x26f15d){return{'membername':_0x26f15d[_0x7609('0x2b')],'UserId':_0x26f15d['id'],'queue_name':_0x494ea2[_0x7609('0x2b')],'OpenchannelQueueId':_0x494ea2['id'],'interface':util[_0x7609('0x5e')](_0x7609('0x5f'),_0x7609('0x60'),_0x26f15d[_0x7609('0x2b')]),'penalty':0x0,'paused':_0x26f15d[_0x7609('0x61')],'createdAt':_0x26f15d[_0x7609('0x5c')],'updatedAt':_0x26f15d[_0x7609('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x438982,_0x48b1c5))[_0x7609('0x45')](handleError(_0x438982,null));};exports[_0x7609('0x62')]=function(_0x3ad563,_0x95a95f,_0x3a6397){var _0x2d574c={};var _0x1fcd6e={};var _0x67778a;var _0x41e67b;return db[_0x7609('0x2e')][_0x7609('0x55')]({'where':{'id':_0x3ad563[_0x7609('0x52')]['id']}})['then'](handleEntityNotFound(_0x95a95f,null))[_0x7609('0x25')](function(_0x1d62bd){if(_0x1d62bd){_0x67778a=_0x1d62bd;_0x1fcd6e[_0x7609('0x31')]=_[_0x7609('0x56')](db['Team'][_0x7609('0x2f')]);_0x1fcd6e[_0x7609('0x32')]=_['keys'](_0x3ad563[_0x7609('0x32')]);_0x1fcd6e[_0x7609('0x3c')]=_['intersection'](_0x1fcd6e[_0x7609('0x31')],_0x1fcd6e[_0x7609('0x32')]);_0x2d574c[_0x7609('0x35')]=_[_0x7609('0x33')](_0x1fcd6e[_0x7609('0x31')],qs[_0x7609('0x34')](_0x3ad563[_0x7609('0x32')][_0x7609('0x34')]));_0x2d574c[_0x7609('0x35')]=_0x2d574c[_0x7609('0x35')][_0x7609('0x36')]?_0x2d574c[_0x7609('0x35')]:_0x1fcd6e[_0x7609('0x31')];_0x2d574c['order']=qs['sort'](_0x3ad563[_0x7609('0x32')][_0x7609('0x3a')]);_0x2d574c['where']=qs[_0x7609('0x3c')](_[_0x7609('0x3d')](_0x3ad563[_0x7609('0x32')],_0x1fcd6e[_0x7609('0x3c')]));if(_0x3ad563[_0x7609('0x32')][_0x7609('0x3e')]){_0x2d574c[_0x7609('0x3b')]=_['merge'](_0x2d574c[_0x7609('0x3b')],{'$or':_[_0x7609('0x2d')](_0x2d574c[_0x7609('0x35')],function(_0x13f389){var _0x1e29e2={};_0x1e29e2[_0x13f389]={'$like':'%'+_0x3ad563[_0x7609('0x32')][_0x7609('0x3e')]+'%'};return _0x1e29e2;})});}_0x2d574c=_[_0x7609('0x3f')]({},_0x2d574c,_0x3ad563[_0x7609('0x41')]);return _0x67778a[_0x7609('0x62')](_0x2d574c);}})[_0x7609('0x25')](function(_0x3cc407){if(_0x3cc407){_0x41e67b=_0x3cc407[_0x7609('0x36')];if(!_0x3ad563[_0x7609('0x32')][_0x7609('0x37')](_0x7609('0x38'))){_0x2d574c['limit']=qs['limit'](_0x3ad563[_0x7609('0x32')]['limit']);_0x2d574c[_0x7609('0x1e')]=qs[_0x7609('0x1e')](_0x3ad563[_0x7609('0x32')][_0x7609('0x1e')]);}return _0x67778a[_0x7609('0x62')](_0x2d574c);}})[_0x7609('0x25')](function(_0x14853c){if(_0x14853c){return _0x14853c?{'count':_0x41e67b,'rows':_0x14853c}:null;}})['then'](respondWithResult(_0x95a95f,null))['catch'](handleError(_0x95a95f,null));};exports[_0x7609('0x63')]=function(_0x1a3b1f,_0x23e8a6,_0x3dcd6f){var _0x6aa879=_0x1a3b1f['body'][_0x7609('0x64')];return db[_0x7609('0x65')][_0x7609('0x44')]({'where':{'id':_0x6aa879},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x7609('0x2b'),_0x7609('0x66'),_0x7609('0x67'),_0x7609('0x68')],'raw':!![]}]})[_0x7609('0x25')](function(_0x1c7929){if(_0x1c7929){var _0x3345b2=_[_0x7609('0x69')](_0x1c7929,function(_0x5f401e){var _0x169cce=_0x5f401e[_0x7609('0x4b')]({'plain':!![]});return _0x169cce['Agents'];});return db[_0x7609('0x2e')][_0x7609('0x47')]({'where':{'id':_0x1a3b1f[_0x7609('0x52')]['id']}})[_0x7609('0x25')](function(_0x527084){return db[_0x7609('0x6a')][_0x7609('0x6b')](function(_0x13d9f5){return _0x527084[_0x7609('0x63')](_0x6aa879,{'transaction':_0x13d9f5})[_0x7609('0x25')](function(){return BPromise[_0x7609('0x6c')](_0x3345b2,function(_0xd65a5a){return db[_0x7609('0x57')][_0x7609('0x6d')]({'where':{'UserId':_0xd65a5a['id'],'OpenchannelQueueId':_0x1a3b1f[_0x7609('0x52')]['id']},'transaction':_0x13d9f5});});})[_0x7609('0x25')](function(){_0x3345b2['forEach'](function(_0x45bd98){socket[_0x7609('0x6e')](_0x7609('0x6f'),{'UserId':_0x45bd98['id'],'OpenchannelQueueId':_0x527084['id']});});});});});}})[_0x7609('0x25')](respondWithStatusCode(_0x23e8a6,null))[_0x7609('0x45')](handleError(_0x23e8a6,null));};exports[_0x7609('0x70')]=function(_0x4354ca,_0x98db33,_0x5a6568){return db[_0x7609('0x65')][_0x7609('0x44')]({'where':{'id':_0x4354ca['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x7609('0x59')],'as':_0x7609('0x71'),'attributes':['id'],'raw':!![]}]})[_0x7609('0x25')](handleEntityNotFound(_0x98db33,null))[_0x7609('0x25')](function(_0x18bca2){var _0x532872=_[_0x7609('0x2d')](_0x18bca2,'id');var _0x595ddf=[];var _0x360917=[];var _0x382225=squel[_0x7609('0x72')]();_0x382225['field'](_0x7609('0x73'))['from']('team_has_openchannel_queues','tq')['join'](_0x7609('0x74'),'ut',_0x7609('0x75'))[_0x7609('0x3b')]('OpenchannelQueueId\x20=\x20?',_0x4354ca['params']['id']);for(var _0x3c9be9=0x0;_0x3c9be9<_0x18bca2['length'];_0x3c9be9+=0x1){let _0x4e9481=_0x18bca2[_0x3c9be9];for(var _0x482bc1=0x0;_0x482bc1<_0x4e9481[_0x7609('0x71')]['length'];_0x482bc1+=0x1){let _0xf08c6a=_0x4e9481[_0x7609('0x71')][_0x482bc1];var _0x42a785=_0x382225['clone']();_0x42a785[_0x7609('0x3b')](_0x7609('0x76'),_0xf08c6a['id']);_0x360917[_0x7609('0x77')](db[_0x7609('0x6a')][_0x7609('0x32')](_0x42a785['toString'](),{'type':db[_0x7609('0x6a')]['QueryTypes'][_0x7609('0x78')]})[_0x7609('0x25')](function(_0x2255b4){if(_0x2255b4[_0x7609('0x36')]===0x1){return _0xf08c6a['id'];}else{var _0x52a772=_[_0x7609('0x79')](_['map'](_0x2255b4,_0x7609('0x7a')),function(_0x516ae1){return _[_0x7609('0x7b')](_0x532872,_0x516ae1);});if(_0x52a772){return _0xf08c6a['id'];}}}));}}return BPromise['all'](_0x360917)['then'](function(_0x420a57){_0x595ddf=_(_0x595ddf)['union'](_0x420a57)[_0x7609('0x7c')]()['value']();return db[_0x7609('0x2e')][_0x7609('0x47')]({'where':{'id':_0x4354ca['params']['id']}})[_0x7609('0x25')](function(_0x5f2b2){return db[_0x7609('0x6a')]['transaction'](function(_0x2d176c){return _0x5f2b2[_0x7609('0x70')](_0x4354ca[_0x7609('0x32')]['ids'],{'transaction':_0x2d176c})[_0x7609('0x25')](function(){if(!_[_0x7609('0x7d')](_0x595ddf)){return _0x5f2b2[_0x7609('0x7e')](_0x595ddf,{'transaction':_0x2d176c});}})['then'](function(){_0x595ddf[_0x7609('0x7f')](function(_0x43069a){socket[_0x7609('0x6e')](_0x7609('0x80'),{'UserId':_0x43069a,'OpenchannelQueueId':_0x5f2b2['id']});});});});});});})[_0x7609('0x25')](respondWithStatusCode(_0x98db33,null))['catch'](handleError(_0x98db33,null));};exports[_0x7609('0x81')]=function(_0x299089,_0x54c601,_0x578983){return db['OpenchannelQueue']['find']({'where':{'id':_0x299089['params']['id']}})[_0x7609('0x25')](handleEntityNotFound(_0x54c601,null))[_0x7609('0x25')](function(_0x21d3e2){if(_0x21d3e2){return _0x21d3e2[_0x7609('0x81')](_0x299089[_0x7609('0x49')][_0x7609('0x64')],_[_0x7609('0x82')](_0x299089[_0x7609('0x49')],[_0x7609('0x64'),'id'])||{})[_0x7609('0x83')](function(_0x205fdc){for(var _0xae826f=0x0;_0xae826f<_0x299089[_0x7609('0x49')][_0x7609('0x64')]['length'];_0xae826f+=0x1){socket[_0x7609('0x6e')]('userOpenchannelQueue:save',{'UserId':_0x299089[_0x7609('0x49')]['ids'][_0xae826f],'OpenchannelQueueId':_0x299089[_0x7609('0x52')]['id']});}return _0x205fdc;});}})[_0x7609('0x25')](respondWithResult(_0x54c601,null))[_0x7609('0x45')](handleError(_0x54c601,null));};exports[_0x7609('0x7e')]=function(_0x9351a3,_0x48cb18,_0x9e898a){return db[_0x7609('0x2e')][_0x7609('0x47')]({'where':{'id':_0x9351a3['params']['id']}})[_0x7609('0x25')](handleEntityNotFound(_0x48cb18,null))[_0x7609('0x25')](function(_0x243eab){if(_0x243eab){return _0x243eab['removeAgents'](_0x9351a3['query'][_0x7609('0x64')])[_0x7609('0x25')](function(){if(_['isArray'](_0x9351a3[_0x7609('0x32')][_0x7609('0x64')])){for(var _0x27b98e=0x0;_0x27b98e<_0x9351a3[_0x7609('0x32')][_0x7609('0x64')][_0x7609('0x36')];_0x27b98e+=0x1){socket[_0x7609('0x6e')](_0x7609('0x80'),{'UserId':Number(_0x9351a3[_0x7609('0x32')][_0x7609('0x64')][_0x27b98e]),'OpenchannelQueueId':Number(_0x9351a3[_0x7609('0x52')]['id'])});}}else{socket['emit'](_0x7609('0x80'),{'UserId':Number(_0x9351a3[_0x7609('0x32')][_0x7609('0x64')]),'OpenchannelQueueId':Number(_0x9351a3[_0x7609('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x48cb18,null))['catch'](handleError(_0x48cb18,null));};exports[_0x7609('0x84')]=function(_0x20552b,_0x4b98a3,_0x2d6695){var _0x2fa3a1={};var _0x3d3f6b={};var _0x2ae136;var _0x986c9f;return db['OpenchannelQueue'][_0x7609('0x55')]({'where':{'id':_0x20552b[_0x7609('0x52')]['id']}})[_0x7609('0x25')](handleEntityNotFound(_0x4b98a3,null))[_0x7609('0x25')](function(_0x2d1128){if(_0x2d1128){_0x2ae136=_0x2d1128;_0x3d3f6b[_0x7609('0x31')]=_['keys'](db[_0x7609('0x59')]['rawAttributes']);_0x3d3f6b[_0x7609('0x32')]=_[_0x7609('0x56')](_0x20552b[_0x7609('0x32')]);_0x3d3f6b['filters']=_[_0x7609('0x33')](_0x3d3f6b['model'],_0x3d3f6b[_0x7609('0x32')]);_0x2fa3a1[_0x7609('0x35')]=_['intersection'](_0x3d3f6b[_0x7609('0x31')],qs[_0x7609('0x34')](_0x20552b['query'][_0x7609('0x34')]));_0x2fa3a1[_0x7609('0x35')]=_0x2fa3a1[_0x7609('0x35')]['length']?_0x2fa3a1[_0x7609('0x35')]:_0x3d3f6b[_0x7609('0x31')];_0x2fa3a1[_0x7609('0x39')]=qs['sort'](_0x20552b[_0x7609('0x32')][_0x7609('0x3a')]);_0x2fa3a1['where']=qs[_0x7609('0x3c')](_[_0x7609('0x3d')](_0x20552b['query'],_0x3d3f6b[_0x7609('0x3c')]));if(_0x20552b[_0x7609('0x32')][_0x7609('0x3e')]){_0x2fa3a1[_0x7609('0x3b')]=_[_0x7609('0x3f')](_0x2fa3a1[_0x7609('0x3b')],{'$or':_['map'](_0x2fa3a1['attributes'],function(_0x540875){var _0x2b205b={};_0x2b205b[_0x540875]={'$like':'%'+_0x20552b[_0x7609('0x32')][_0x7609('0x3e')]+'%'};return _0x2b205b;})});}_0x2fa3a1=_[_0x7609('0x3f')]({},_0x2fa3a1,_0x20552b[_0x7609('0x41')]);return _0x2ae136[_0x7609('0x84')](_0x2fa3a1);}})['then'](function(_0x3861be){if(_0x3861be){_0x986c9f=_0x3861be[_0x7609('0x36')];if(!_0x20552b[_0x7609('0x32')][_0x7609('0x37')](_0x7609('0x38'))){_0x2fa3a1[_0x7609('0x1f')]=qs[_0x7609('0x1f')](_0x20552b[_0x7609('0x32')][_0x7609('0x1f')]);_0x2fa3a1[_0x7609('0x1e')]=qs[_0x7609('0x1e')](_0x20552b[_0x7609('0x32')]['offset']);}return _0x2ae136[_0x7609('0x84')](_0x2fa3a1);}})[_0x7609('0x25')](function(_0x74e01){if(_0x74e01){return _0x74e01?{'count':_0x986c9f,'rows':_0x74e01}:null;}})['then'](respondWithResult(_0x4b98a3,null))[_0x7609('0x45')](handleError(_0x4b98a3,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index d4bb9e6..9995157 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 _0xad92=['emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove'];(function(_0x5703eb,_0x4ff5fe){var _0x5da3ce=function(_0x586778){while(--_0x586778){_0x5703eb['push'](_0x5703eb['shift']());}};_0x5da3ce(++_0x4ff5fe);}(_0xad92,0x12c));var _0x2ad9=function(_0x140010,_0x4d7233){_0x140010=_0x140010-0x0;var _0x373bb8=_0xad92[_0x140010];return _0x373bb8;};'use strict';var EventEmitter=require(_0x2ad9('0x0'));var OpenchannelQueue=require(_0x2ad9('0x1'))['db'][_0x2ad9('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2ad9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2ad9('0x4'),'afterDestroy':_0x2ad9('0x5')};function emitEvent(_0x55176c){return function(_0x29b69a,_0x495d44,_0x1bcc3e){OpenchannelQueueEvents['emit'](_0x55176c+':'+_0x29b69a['id'],_0x29b69a);OpenchannelQueueEvents[_0x2ad9('0x6')](_0x55176c,_0x29b69a);_0x1bcc3e(null);};}for(var e in events){if(events[_0x2ad9('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x2ad9('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xbdaa=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xbdaa,0x172));var _0xabda=function(_0x536cc5,_0x29d8c0){_0x536cc5=_0x536cc5-0x0;var _0x31cbb7=_0xbdaa[_0x536cc5];return _0x31cbb7;};'use strict';var EventEmitter=require(_0xabda('0x0'));var OpenchannelQueue=require(_0xabda('0x1'))['db'][_0xabda('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xabda('0x3')](0x0);var events={'afterCreate':_0xabda('0x4'),'afterUpdate':_0xabda('0x5'),'afterDestroy':_0xabda('0x6')};function emitEvent(_0x5646d1){return function(_0x418ba6,_0x392ba3,_0xb5e598){OpenchannelQueueEvents[_0xabda('0x7')](_0x5646d1+':'+_0x418ba6['id'],_0x418ba6);OpenchannelQueueEvents[_0xabda('0x7')](_0x5646d1,_0x418ba6);_0xb5e598(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xabda('0x8')](e,emitEvent(event));}}module[_0xabda('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 3f02d6e..13e114a 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 _0xe054=['../../config/environment','define','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x208e83,_0x58b5ff){var _0x295a4b=function(_0x3a1603){while(--_0x3a1603){_0x208e83['push'](_0x208e83['shift']());}};_0x295a4b(++_0x58b5ff);}(_0xe054,0xbf));var _0x4e05=function(_0x1b0cf1,_0x292fcd){_0x1b0cf1=_0x1b0cf1-0x0;var _0x4857e5=_0xe054[_0x1b0cf1];return _0x4857e5;};'use strict';var _=require(_0x4e05('0x0'));var util=require('util');var logger=require(_0x4e05('0x1'))(_0x4e05('0x2'));var moment=require(_0x4e05('0x3'));var BPromise=require('bluebird');var rp=require(_0x4e05('0x4'));var fs=require('fs');var path=require(_0x4e05('0x5'));var rimraf=require(_0x4e05('0x6'));var config=require(_0x4e05('0x7'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x3987c0,_0xcf59e8){return _0x3987c0[_0x4e05('0x8')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17a6=['exports','define','OpenchannelQueue','openchannel_queues','lodash','util','api','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x347ecc,_0x11d621){var _0x4a728d=function(_0x556ca5){while(--_0x556ca5){_0x347ecc['push'](_0x347ecc['shift']());}};_0x4a728d(++_0x11d621);}(_0x17a6,0x64));var _0x617a=function(_0x1f8873,_0x481341){_0x1f8873=_0x1f8873-0x0;var _0x6ac777=_0x17a6[_0x1f8873];return _0x6ac777;};'use strict';var _=require(_0x617a('0x0'));var util=require(_0x617a('0x1'));var logger=require('../../config/logger')(_0x617a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x617a('0x3'));var fs=require('fs');var path=require(_0x617a('0x4'));var rimraf=require(_0x617a('0x5'));var config=require(_0x617a('0x6'));var attributes=require(_0x617a('0x7'));module[_0x617a('0x8')]=function(_0x415439,_0xd891b8){return _0x415439[_0x617a('0x9')](_0x617a('0xa'),attributes,{'tableName':_0x617a('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 cf4a8a4..c9e1bdb 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 _0xbc26=['jayson/promise','client','http','redis','defaults','localhost','./openchannelQueue.socket','register','request','then','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','info','catch','ShowOpenchannelQueue','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xbc26,0x116));var _0x6bc2=function(_0x33ec4c,_0x32a52f){_0x33ec4c=_0x33ec4c-0x0;var _0x2183d9=_0xbc26[_0x33ec4c];return _0x2183d9;};'use strict';var _=require(_0x6bc2('0x0'));var util=require(_0x6bc2('0x1'));var moment=require(_0x6bc2('0x2'));var BPromise=require('bluebird');var rs=require(_0x6bc2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6bc2('0x4'))['db'];var utils=require(_0x6bc2('0x5'));var logger=require(_0x6bc2('0x6'))(_0x6bc2('0x7'));var config=require(_0x6bc2('0x8'));var jayson=require(_0x6bc2('0x9'));var client=jayson[_0x6bc2('0xa')][_0x6bc2('0xb')]({'port':0x232a});config[_0x6bc2('0xc')]=_[_0x6bc2('0xd')](config[_0x6bc2('0xc')],{'host':_0x6bc2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6bc2('0xc')]));require(_0x6bc2('0xf'))[_0x6bc2('0x10')](socket);function respondWithRpcPromise(_0x31c380,_0x3a1d83,_0x1ccbb8){return new BPromise(function(_0xe10b93,_0x958d8){return client[_0x6bc2('0x11')](_0x31c380,_0x1ccbb8)[_0x6bc2('0x12')](function(_0x1152d8){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x3a1d83,_0x6bc2('0x13'));logger[_0x6bc2('0x14')](_0x6bc2('0x15'),_0x3a1d83,_0x6bc2('0x13'),JSON[_0x6bc2('0x16')](_0x1152d8));if(_0x1152d8[_0x6bc2('0x17')]){if(_0x1152d8['error'][_0x6bc2('0x18')]===0x1f4){logger[_0x6bc2('0x17')](_0x6bc2('0x19'),_0x3a1d83,_0x1152d8[_0x6bc2('0x17')][_0x6bc2('0x1a')]);return _0x958d8(_0x1152d8[_0x6bc2('0x17')][_0x6bc2('0x1a')]);}logger[_0x6bc2('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x3a1d83,_0x1152d8[_0x6bc2('0x17')][_0x6bc2('0x1a')]);return _0xe10b93(_0x1152d8[_0x6bc2('0x17')][_0x6bc2('0x1a')]);}else{logger['info'](_0x6bc2('0x19'),_0x3a1d83,'request\x20sent');_0xe10b93(_0x1152d8['result'][_0x6bc2('0x1a')]);}})['catch'](function(_0x4289f9){logger[_0x6bc2('0x17')](_0x6bc2('0x19'),_0x3a1d83,_0x4289f9);_0x958d8(_0x4289f9);});});}exports[_0x6bc2('0x1b')]=function(_0x3b1844){var _0x4050e3=this;return new Promise(function(_0x21423c,_0x40c8cb){return db[_0x6bc2('0x1c')][_0x6bc2('0x1d')]({'raw':_0x3b1844[_0x6bc2('0x1e')]?_0x3b1844['options'][_0x6bc2('0x1f')]===undefined?!![]:![]:!![],'where':_0x3b1844[_0x6bc2('0x1e')]?_0x3b1844[_0x6bc2('0x1e')][_0x6bc2('0x20')]||null:null,'attributes':_0x3b1844[_0x6bc2('0x1e')]?_0x3b1844[_0x6bc2('0x1e')][_0x6bc2('0x21')]||null:null,'limit':_0x3b1844[_0x6bc2('0x1e')]?_0x3b1844['options']['limit']||null:null,'include':_0x3b1844['options']?_0x3b1844[_0x6bc2('0x1e')][_0x6bc2('0x22')]?_[_0x6bc2('0x23')](_0x3b1844['options'][_0x6bc2('0x22')],function(_0x507513){return{'model':db[_0x507513[_0x6bc2('0x24')]],'as':_0x507513['as'],'attributes':_0x507513[_0x6bc2('0x21')],'include':_0x507513['include']?_[_0x6bc2('0x23')](_0x507513[_0x6bc2('0x22')],function(_0x3e911c){return{'model':db[_0x3e911c[_0x6bc2('0x24')]],'as':_0x3e911c['as'],'attributes':_0x3e911c['attributes'],'include':_0x3e911c[_0x6bc2('0x22')]?_[_0x6bc2('0x23')](_0x3e911c[_0x6bc2('0x22')],function(_0x45a532){return{'model':db[_0x45a532[_0x6bc2('0x24')]],'as':_0x45a532['as'],'attributes':_0x45a532[_0x6bc2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6bc2('0x12')](function(_0x5806f6){logger[_0x6bc2('0x25')](_0x6bc2('0x1b'),_0x3b1844);logger[_0x6bc2('0x14')](_0x6bc2('0x1b'),_0x3b1844,JSON[_0x6bc2('0x16')](_0x5806f6));_0x21423c(_0x5806f6);})[_0x6bc2('0x26')](function(_0x417288){logger[_0x6bc2('0x17')](_0x6bc2('0x1b'),_0x417288[_0x6bc2('0x1a')],_0x3b1844);_0x40c8cb(_0x4050e3[_0x6bc2('0x17')](0x1f4,_0x417288[_0x6bc2('0x1a')]));});});};exports[_0x6bc2('0x27')]=function(_0x71c997){var _0x4bed7c=this;return new Promise(function(_0x2c25b9,_0x130018){return db[_0x6bc2('0x1c')][_0x6bc2('0x28')]({'raw':_0x71c997[_0x6bc2('0x1e')]?_0x71c997[_0x6bc2('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x71c997[_0x6bc2('0x1e')]?_0x71c997['options']['where']||null:null,'attributes':_0x71c997[_0x6bc2('0x1e')]?_0x71c997[_0x6bc2('0x1e')][_0x6bc2('0x21')]||null:null,'include':_0x71c997[_0x6bc2('0x1e')]?_0x71c997[_0x6bc2('0x1e')][_0x6bc2('0x22')]?_[_0x6bc2('0x23')](_0x71c997[_0x6bc2('0x1e')][_0x6bc2('0x22')],function(_0x4de7b3){return{'model':db[_0x4de7b3[_0x6bc2('0x24')]],'as':_0x4de7b3['as'],'attributes':_0x4de7b3[_0x6bc2('0x21')],'include':_0x4de7b3['include']?_[_0x6bc2('0x23')](_0x4de7b3[_0x6bc2('0x22')],function(_0x4b1398){return{'model':db[_0x4b1398['model']],'as':_0x4b1398['as'],'attributes':_0x4b1398[_0x6bc2('0x21')],'include':_0x4b1398[_0x6bc2('0x22')]?_['map'](_0x4b1398[_0x6bc2('0x22')],function(_0x816402){return{'model':db[_0x816402[_0x6bc2('0x24')]],'as':_0x816402['as'],'attributes':_0x816402[_0x6bc2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6bc2('0x12')](function(_0x1f9c73){logger[_0x6bc2('0x25')](_0x6bc2('0x27'),_0x71c997);logger[_0x6bc2('0x14')](_0x6bc2('0x27'),_0x71c997,JSON[_0x6bc2('0x16')](_0x1f9c73));_0x2c25b9(_0x1f9c73);})[_0x6bc2('0x26')](function(_0x15b700){logger[_0x6bc2('0x17')](_0x6bc2('0x27'),_0x15b700[_0x6bc2('0x1a')],_0x71c997);_0x130018(_0x4bed7c[_0x6bc2('0x17')](0x1f4,_0x15b700[_0x6bc2('0x1a')]));});});}; \ No newline at end of file +var _0x7f87=['socket.io-emitter','register','request','then','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowOpenchannelQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x7f87,0x1d4));var _0x77f8=function(_0x345424,_0x238f0b){_0x345424=_0x345424-0x0;var _0x4271d6=_0x7f87[_0x345424];return _0x4271d6;};'use strict';var _=require(_0x77f8('0x0'));var util=require(_0x77f8('0x1'));var moment=require('moment');var BPromise=require(_0x77f8('0x2'));var rs=require(_0x77f8('0x3'));var fs=require('fs');var Redis=require(_0x77f8('0x4'));var db=require(_0x77f8('0x5'))['db'];var utils=require(_0x77f8('0x6'));var logger=require(_0x77f8('0x7'))(_0x77f8('0x8'));var config=require(_0x77f8('0x9'));var jayson=require(_0x77f8('0xa'));var client=jayson[_0x77f8('0xb')][_0x77f8('0xc')]({'port':0x232a});config['redis']=_[_0x77f8('0xd')](config[_0x77f8('0xe')],{'host':_0x77f8('0xf'),'port':0x18eb});var socket=require(_0x77f8('0x10'))(new Redis(config[_0x77f8('0xe')]));require('./openchannelQueue.socket')[_0x77f8('0x11')](socket);function respondWithRpcPromise(_0x2cb226,_0x3eba67,_0x3b264a){return new BPromise(function(_0x570d41,_0x3fe959){return client[_0x77f8('0x12')](_0x2cb226,_0x3b264a)[_0x77f8('0x13')](function(_0x69813a){logger[_0x77f8('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x3eba67,'request\x20sent');logger[_0x77f8('0x15')](_0x77f8('0x16'),_0x3eba67,_0x77f8('0x17'),JSON[_0x77f8('0x18')](_0x69813a));if(_0x69813a[_0x77f8('0x19')]){if(_0x69813a[_0x77f8('0x19')][_0x77f8('0x1a')]===0x1f4){logger[_0x77f8('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x3eba67,_0x69813a[_0x77f8('0x19')][_0x77f8('0x1b')]);return _0x3fe959(_0x69813a[_0x77f8('0x19')][_0x77f8('0x1b')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x3eba67,_0x69813a[_0x77f8('0x19')]['message']);return _0x570d41(_0x69813a[_0x77f8('0x19')][_0x77f8('0x1b')]);}else{logger['info'](_0x77f8('0x1c'),_0x3eba67,_0x77f8('0x17'));_0x570d41(_0x69813a[_0x77f8('0x1d')][_0x77f8('0x1b')]);}})['catch'](function(_0x570f59){logger[_0x77f8('0x19')](_0x77f8('0x1c'),_0x3eba67,_0x570f59);_0x3fe959(_0x570f59);});});}exports[_0x77f8('0x1e')]=function(_0x544a59){var _0x2a0dbf=this;return new Promise(function(_0x4f5ff,_0x131e82){return db[_0x77f8('0x1f')][_0x77f8('0x20')]({'raw':_0x544a59[_0x77f8('0x21')]?_0x544a59[_0x77f8('0x21')][_0x77f8('0x22')]===undefined?!![]:![]:!![],'where':_0x544a59[_0x77f8('0x21')]?_0x544a59[_0x77f8('0x21')][_0x77f8('0x23')]||null:null,'attributes':_0x544a59[_0x77f8('0x21')]?_0x544a59['options'][_0x77f8('0x24')]||null:null,'limit':_0x544a59[_0x77f8('0x21')]?_0x544a59['options'][_0x77f8('0x25')]||null:null,'include':_0x544a59[_0x77f8('0x21')]?_0x544a59[_0x77f8('0x21')][_0x77f8('0x26')]?_['map'](_0x544a59['options'][_0x77f8('0x26')],function(_0x458b59){return{'model':db[_0x458b59[_0x77f8('0x27')]],'as':_0x458b59['as'],'attributes':_0x458b59[_0x77f8('0x24')],'include':_0x458b59['include']?_[_0x77f8('0x28')](_0x458b59[_0x77f8('0x26')],function(_0x13091b){return{'model':db[_0x13091b['model']],'as':_0x13091b['as'],'attributes':_0x13091b['attributes'],'include':_0x13091b[_0x77f8('0x26')]?_[_0x77f8('0x28')](_0x13091b[_0x77f8('0x26')],function(_0x4a2496){return{'model':db[_0x4a2496[_0x77f8('0x27')]],'as':_0x4a2496['as'],'attributes':_0x4a2496[_0x77f8('0x24')]};}):[]};}):[]};}):[]:[]})[_0x77f8('0x13')](function(_0x5503d8){logger[_0x77f8('0x14')](_0x77f8('0x1e'),_0x544a59);logger['debug']('GetOpenchannelQueue',_0x544a59,JSON[_0x77f8('0x18')](_0x5503d8));_0x4f5ff(_0x5503d8);})[_0x77f8('0x29')](function(_0x1163bf){logger[_0x77f8('0x19')](_0x77f8('0x1e'),_0x1163bf[_0x77f8('0x1b')],_0x544a59);_0x131e82(_0x2a0dbf[_0x77f8('0x19')](0x1f4,_0x1163bf[_0x77f8('0x1b')]));});});};exports[_0x77f8('0x2a')]=function(_0x5a99f2){var _0x1b461e=this;return new Promise(function(_0x378828,_0x203931){return db['OpenchannelQueue'][_0x77f8('0x2b')]({'raw':_0x5a99f2[_0x77f8('0x21')]?_0x5a99f2[_0x77f8('0x21')][_0x77f8('0x22')]===undefined?!![]:![]:!![],'where':_0x5a99f2[_0x77f8('0x21')]?_0x5a99f2['options'][_0x77f8('0x23')]||null:null,'attributes':_0x5a99f2[_0x77f8('0x21')]?_0x5a99f2[_0x77f8('0x21')][_0x77f8('0x24')]||null:null,'include':_0x5a99f2[_0x77f8('0x21')]?_0x5a99f2[_0x77f8('0x21')]['include']?_[_0x77f8('0x28')](_0x5a99f2[_0x77f8('0x21')][_0x77f8('0x26')],function(_0x5e27d3){return{'model':db[_0x5e27d3[_0x77f8('0x27')]],'as':_0x5e27d3['as'],'attributes':_0x5e27d3[_0x77f8('0x24')],'include':_0x5e27d3[_0x77f8('0x26')]?_[_0x77f8('0x28')](_0x5e27d3[_0x77f8('0x26')],function(_0x27ae2f){return{'model':db[_0x27ae2f['model']],'as':_0x27ae2f['as'],'attributes':_0x27ae2f['attributes'],'include':_0x27ae2f[_0x77f8('0x26')]?_['map'](_0x27ae2f[_0x77f8('0x26')],function(_0x15d81c){return{'model':db[_0x15d81c[_0x77f8('0x27')]],'as':_0x15d81c['as'],'attributes':_0x15d81c[_0x77f8('0x24')]};}):[]};}):[]};}):[]:[]})[_0x77f8('0x13')](function(_0x227801){logger[_0x77f8('0x14')](_0x77f8('0x2a'),_0x5a99f2);logger[_0x77f8('0x15')](_0x77f8('0x2a'),_0x5a99f2,JSON[_0x77f8('0x18')](_0x227801));_0x378828(_0x227801);})[_0x77f8('0x29')](function(_0x58e9c5){logger['error'](_0x77f8('0x2a'),_0x58e9c5[_0x77f8('0x1b')],_0x5a99f2);_0x203931(_0x1b461e['error'](0x1f4,_0x58e9c5[_0x77f8('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 11a529d..c77106b 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 _0x3e2b=['save','emit','removeListener','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x3c093e,_0x125937){var _0x4f01b9=function(_0x10b451){while(--_0x10b451){_0x3c093e['push'](_0x3c093e['shift']());}};_0x4f01b9(++_0x125937);}(_0x3e2b,0x167));var _0xb3e2=function(_0x439918,_0x37a67c){_0x439918=_0x439918-0x0;var _0x845bfa=_0x3e2b[_0x439918];return _0x845bfa;};'use strict';var OpenchannelQueueEvents=require(_0xb3e2('0x0'));var events=[_0xb3e2('0x1'),'remove','update'];function createListener(_0xd7ac1,_0x14bb7e){return function(_0x3d8e56){_0x14bb7e[_0xb3e2('0x2')](_0xd7ac1,_0x3d8e56);};}function removeListener(_0xf49ce9,_0x51fbff){return function(){OpenchannelQueueEvents[_0xb3e2('0x3')](_0xf49ce9,_0x51fbff);};}exports[_0xb3e2('0x4')]=function(_0x2b56ce){for(var _0x253003=0x0,_0x1a8233=events['length'];_0x253003<_0x1a8233;_0x253003++){var _0x34bc01=events[_0x253003];var _0x38d6c1=createListener(_0xb3e2('0x5')+_0x34bc01,_0x2b56ce);OpenchannelQueueEvents['on'](_0x34bc01,_0x38d6c1);}}; \ No newline at end of file +var _0xfe93=['save','remove','emit','removeListener','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe93,0x179));var _0x3fe9=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xfe93[_0x13d07a];return _0x5ee0ee;};'use strict';var OpenchannelQueueEvents=require(_0x3fe9('0x0'));var events=[_0x3fe9('0x1'),_0x3fe9('0x2'),'update'];function createListener(_0x36357f,_0x488115){return function(_0x39f4b6){_0x488115[_0x3fe9('0x3')](_0x36357f,_0x39f4b6);};}function removeListener(_0x458cd2,_0x484b75){return function(){OpenchannelQueueEvents[_0x3fe9('0x4')](_0x458cd2,_0x484b75);};}exports[_0x3fe9('0x5')]=function(_0x5a1d14){for(var _0x6895ac=0x0,_0x5e3f0c=events['length'];_0x6895ac<_0x5e3f0c;_0x6895ac++){var _0x150abb=events[_0x6895ac];var _0x25674e=createListener(_0x3fe9('0x6')+_0x150abb,_0x5a1d14);OpenchannelQueueEvents['on'](_0x150abb,_0x25674e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 2593375..16862e0 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 _0xd5ca=['../../config/environment','./openchannelQueueReport.controller','get','index','describe','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x54f37b,_0x446203){var _0x187c5b=function(_0x44b438){while(--_0x44b438){_0x54f37b['push'](_0x54f37b['shift']());}};_0x187c5b(++_0x446203);}(_0xd5ca,0x1dc));var _0xad5c=function(_0x2a2c4c,_0x8b01d5){_0x2a2c4c=_0x2a2c4c-0x0;var _0x3846b7=_0xd5ca[_0x2a2c4c];return _0x3846b7;};'use strict';var multer=require(_0xad5c('0x0'));var util=require(_0xad5c('0x1'));var path=require(_0xad5c('0x2'));var timeout=require('connect-timeout');var express=require(_0xad5c('0x3'));var router=express[_0xad5c('0x4')]();var auth=require(_0xad5c('0x5'));var interaction=require(_0xad5c('0x6'));var config=require(_0xad5c('0x7'));var controller=require(_0xad5c('0x8'));router[_0xad5c('0x9')]('/',auth['isAuthenticated'](),controller[_0xad5c('0xa')]);router[_0xad5c('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xad5c('0xb')]);router[_0xad5c('0x9')](_0xad5c('0xc'),auth[_0xad5c('0xd')](),controller[_0xad5c('0xe')]);router[_0xad5c('0xf')]('/',auth['isAuthenticated'](),controller[_0xad5c('0x10')]);router['put']('/:id',auth[_0xad5c('0xd')](),controller[_0xad5c('0x11')]);router[_0xad5c('0x12')](_0xad5c('0xc'),auth['isAuthenticated'](),controller[_0xad5c('0x13')]);module[_0xad5c('0x14')]=router; \ No newline at end of file +var _0x7c48=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','/:id','show','create','put','update','destroy','multer','util','connect-timeout','Router'];(function(_0x303054,_0xfbb65a){var _0x3a7287=function(_0x3f0a0d){while(--_0x3f0a0d){_0x303054['push'](_0x303054['shift']());}};_0x3a7287(++_0xfbb65a);}(_0x7c48,0x17c));var _0x87c4=function(_0x339da2,_0x3aa23a){_0x339da2=_0x339da2-0x0;var _0x4c6e10=_0x7c48[_0x339da2];return _0x4c6e10;};'use strict';var multer=require(_0x87c4('0x0'));var util=require(_0x87c4('0x1'));var path=require('path');var timeout=require(_0x87c4('0x2'));var express=require('express');var router=express[_0x87c4('0x3')]();var auth=require(_0x87c4('0x4'));var interaction=require(_0x87c4('0x5'));var config=require(_0x87c4('0x6'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0x87c4('0x7')](),controller['index']);router['get'](_0x87c4('0x8'),auth[_0x87c4('0x7')](),controller[_0x87c4('0x9')]);router['get'](_0x87c4('0xa'),auth[_0x87c4('0x7')](),controller[_0x87c4('0xb')]);router['post']('/',auth[_0x87c4('0x7')](),controller[_0x87c4('0xc')]);router[_0x87c4('0xd')](_0x87c4('0xa'),auth['isAuthenticated'](),controller[_0x87c4('0xe')]);router['delete']('/:id',auth[_0x87c4('0x7')](),controller[_0x87c4('0xf')]);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 5bff9b3..3b7c199 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 _0x6853=['DATE','moment','sequelize','exports','STRING'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0x6853,0x1a0));var _0x3685=function(_0x54a78e,_0x3e0922){_0x54a78e=_0x54a78e-0x0;var _0x52bc01=_0x6853[_0x54a78e];return _0x52bc01;};'use strict';var moment=require(_0x3685('0x0'));var Sequelize=require(_0x3685('0x1'));module[_0x3685('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3685('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3685('0x4')]},'acceptAt':{'type':Sequelize[_0x3685('0x4')]},'exitAt':{'type':Sequelize[_0x3685('0x4')]},'reason':{'type':Sequelize[_0x3685('0x3')]}}; \ No newline at end of file +var _0x5084=['DATE','moment','exports','STRING'];(function(_0x5492e1,_0xd656e0){var _0x1c1ad6=function(_0x564a2c){while(--_0x564a2c){_0x5492e1['push'](_0x5492e1['shift']());}};_0x1c1ad6(++_0xd656e0);}(_0x5084,0x1e9));var _0x4508=function(_0x1c7aba,_0x237177){_0x1c7aba=_0x1c7aba-0x0;var _0x443370=_0x5084[_0x1c7aba];return _0x443370;};'use strict';var moment=require(_0x4508('0x0'));var Sequelize=require('sequelize');module[_0x4508('0x1')]={'uniqueid':{'type':Sequelize[_0x4508('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4508('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4508('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x4508('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index cf995ae..9b96e6f 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 _0xb12a=['rows','show','params','find','catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll'];(function(_0x4a98ea,_0x39dc87){var _0x321bda=function(_0x34c28c){while(--_0x34c28c){_0x4a98ea['push'](_0x4a98ea['shift']());}};_0x321bda(++_0x39dc87);}(_0xb12a,0x145));var _0xab12=function(_0x489794,_0xb84f7d){_0x489794=_0x489794-0x0;var _0x38c737=_0xb12a[_0x489794];return _0x38c737;};'use strict';var pdf=require(_0xab12('0x0'));var emlformat=require(_0xab12('0x1'));var rimraf=require(_0xab12('0x2'));var zipdir=require(_0xab12('0x3'));var jsonpatch=require(_0xab12('0x4'));var rp=require(_0xab12('0x5'));var moment=require(_0xab12('0x6'));var BPromise=require(_0xab12('0x7'));var Mustache=require(_0xab12('0x8'));var util=require(_0xab12('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xab12('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xab12('0xb'));var squel=require('squel');var crypto=require(_0xab12('0xc'));var jsforce=require(_0xab12('0xd'));var deskjs=require(_0xab12('0xe'));var toCsv=require(_0xab12('0xa'));var querystring=require('querystring');var Papa=require(_0xab12('0xf'));var Redis=require(_0xab12('0x10'));var authService=require(_0xab12('0x11'));var qs=require(_0xab12('0x12'));var as=require(_0xab12('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xab12('0x14'))(_0xab12('0x15'));var utils=require(_0xab12('0x16'));var config=require(_0xab12('0x17'));var db=require(_0xab12('0x18'))['db'];function respondWithStatusCode(_0x1d7c98,_0x106553){_0x106553=_0x106553||0xcc;return function(_0x2b7eee){if(_0x2b7eee){return _0x1d7c98[_0xab12('0x19')](_0x106553);}return _0x1d7c98[_0xab12('0x1a')](_0x106553)[_0xab12('0x1b')]();};}function respondWithResult(_0x1b97c1,_0x552b12){_0x552b12=_0x552b12||0xc8;return function(_0x3c2694){if(_0x3c2694){return _0x1b97c1[_0xab12('0x1a')](_0x552b12)[_0xab12('0x1c')](_0x3c2694);}};}function respondWithFilteredResult(_0x1ae9c9,_0x142c6f){return function(_0x583942){if(_0x583942){var _0xd09ecc=_0x583942['count'],_0x18ddfc=_0x142c6f[_0xab12('0x1d')],_0x3040a5=_0x142c6f[_0xab12('0x1d')]+_0x142c6f[_0xab12('0x1e')],_0x3e3517;if(_0x3040a5>=_0xd09ecc){_0x3040a5=_0xd09ecc;_0x3e3517=0xc8;}else{_0x3e3517=0xce;}_0x1ae9c9[_0xab12('0x1a')](_0x3e3517);return _0x1ae9c9[_0xab12('0x1f')]('Content-Range',_0x18ddfc+'-'+_0x3040a5+'/'+_0xd09ecc)['json'](_0x583942);}return null;};}function patchUpdates(_0x3ce2d0){return function(_0x4ff4aa){try{jsonpatch[_0xab12('0x20')](_0x4ff4aa,_0x3ce2d0,!![]);}catch(_0x1bdf68){return BPromise[_0xab12('0x21')](_0x1bdf68);}return _0x4ff4aa[_0xab12('0x22')]();};}function saveUpdates(_0x159db1,_0x5e9c40){return function(_0x3b6ed4){if(_0x3b6ed4){return _0x3b6ed4[_0xab12('0x23')](_0x159db1)[_0xab12('0x24')](function(_0x2c8aa2){return _0x2c8aa2;});}return null;};}function removeEntity(_0x4729e5,_0x1dc964){return function(_0x141a07){if(_0x141a07){return _0x141a07['destroy']()['then'](function(){_0x4729e5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c59e5,_0x26ad57){return function(_0x424815){if(!_0x424815){_0x5c59e5[_0xab12('0x19')](0x194);}return _0x424815;};}function handleError(_0x22e664,_0x48d832){_0x48d832=_0x48d832||0x1f4;return function(_0x18b6c6){logger[_0xab12('0x25')](_0x18b6c6[_0xab12('0x26')]);if(_0x18b6c6[_0xab12('0x27')]){delete _0x18b6c6[_0xab12('0x27')];}_0x22e664['status'](_0x48d832)[_0xab12('0x28')](_0x18b6c6);};}exports[_0xab12('0x29')]=function(_0x4d8f16,_0x377ff1){var _0x4bdd96={},_0x1988b4={},_0xcaad6={'count':0x0,'rows':[]};var _0x3a0566=_['map'](db[_0xab12('0x2a')][_0xab12('0x2b')],function(_0x1a3465){return{'name':_0x1a3465[_0xab12('0x2c')],'type':_0x1a3465['type'][_0xab12('0x2d')]};});_0x1988b4['model']=_[_0xab12('0x2e')](_0x3a0566,_0xab12('0x27'));_0x1988b4[_0xab12('0x2f')]=_[_0xab12('0x30')](_0x4d8f16[_0xab12('0x2f')]);_0x1988b4[_0xab12('0x31')]=_[_0xab12('0x32')](_0x1988b4[_0xab12('0x33')],_0x1988b4[_0xab12('0x2f')]);_0x4bdd96['attributes']=_[_0xab12('0x32')](_0x1988b4[_0xab12('0x33')],qs[_0xab12('0x34')](_0x4d8f16[_0xab12('0x2f')][_0xab12('0x34')]));_0x4bdd96[_0xab12('0x35')]=_0x4bdd96['attributes'][_0xab12('0x36')]?_0x4bdd96[_0xab12('0x35')]:_0x1988b4[_0xab12('0x33')];if(!_0x4d8f16[_0xab12('0x2f')][_0xab12('0x37')](_0xab12('0x38'))){_0x4bdd96['limit']=qs[_0xab12('0x1e')](_0x4d8f16['query'][_0xab12('0x1e')]);_0x4bdd96[_0xab12('0x1d')]=qs[_0xab12('0x1d')](_0x4d8f16[_0xab12('0x2f')][_0xab12('0x1d')]);}_0x4bdd96[_0xab12('0x39')]=qs[_0xab12('0x3a')](_0x4d8f16[_0xab12('0x2f')][_0xab12('0x3a')]);_0x4bdd96[_0xab12('0x3b')]=qs[_0xab12('0x31')](_[_0xab12('0x3c')](_0x4d8f16[_0xab12('0x2f')],_0x1988b4[_0xab12('0x31')]),_0x3a0566);if(_0x4d8f16[_0xab12('0x2f')][_0xab12('0x3d')]){_0x4bdd96[_0xab12('0x3b')]=_[_0xab12('0x3e')](_0x4bdd96[_0xab12('0x3b')],{'$or':_[_0xab12('0x2e')](_0x3a0566,function(_0x169591){if(_0x169591[_0xab12('0x3f')]!==_0xab12('0x40')){var _0x4b615e={};_0x4b615e[_0x169591['name']]={'$like':'%'+_0x4d8f16['query'][_0xab12('0x3d')]+'%'};return _0x4b615e;}})});}_0x4bdd96=_[_0xab12('0x3e')]({},_0x4bdd96,_0x4d8f16[_0xab12('0x41')]);var _0x47c520={'where':_0x4bdd96[_0xab12('0x3b')]};return db[_0xab12('0x2a')][_0xab12('0x42')](_0x47c520)[_0xab12('0x24')](function(_0x34b771){_0xcaad6[_0xab12('0x42')]=_0x34b771;if(_0x4d8f16[_0xab12('0x2f')][_0xab12('0x43')]){_0x4bdd96[_0xab12('0x44')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xab12('0x45')](_0x4bdd96);})[_0xab12('0x24')](function(_0x2df407){_0xcaad6[_0xab12('0x46')]=_0x2df407;return _0xcaad6;})[_0xab12('0x24')](respondWithFilteredResult(_0x377ff1,_0x4bdd96))['catch'](handleError(_0x377ff1,null));};exports[_0xab12('0x47')]=function(_0x430db6,_0x2f78bd){var _0x5ee410={'raw':!![],'where':{'id':_0x430db6[_0xab12('0x48')]['id']}},_0x2cd279={};_0x2cd279[_0xab12('0x33')]=_['keys'](db[_0xab12('0x2a')]['rawAttributes']);_0x2cd279['query']=_['keys'](_0x430db6[_0xab12('0x2f')]);_0x2cd279['filters']=_[_0xab12('0x32')](_0x2cd279[_0xab12('0x33')],_0x2cd279['query']);_0x5ee410[_0xab12('0x35')]=_['intersection'](_0x2cd279[_0xab12('0x33')],qs[_0xab12('0x34')](_0x430db6['query'][_0xab12('0x34')]));_0x5ee410['attributes']=_0x5ee410[_0xab12('0x35')][_0xab12('0x36')]?_0x5ee410[_0xab12('0x35')]:_0x2cd279[_0xab12('0x33')];if(_0x430db6['query']['includeAll']){_0x5ee410[_0xab12('0x44')]=[{'all':!![]}];}_0x5ee410=_[_0xab12('0x3e')]({},_0x5ee410,_0x430db6['options']);return db[_0xab12('0x2a')][_0xab12('0x49')](_0x5ee410)['then'](handleEntityNotFound(_0x2f78bd,null))[_0xab12('0x24')](respondWithResult(_0x2f78bd,null))[_0xab12('0x4a')](handleError(_0x2f78bd,null));};exports[_0xab12('0x4b')]=function(_0x442226,_0x3de648){return db[_0xab12('0x2a')][_0xab12('0x4b')](_0x442226['body'],{})[_0xab12('0x24')](respondWithResult(_0x3de648,0xc9))[_0xab12('0x4a')](handleError(_0x3de648,null));};exports[_0xab12('0x23')]=function(_0x5bbb86,_0x1fb944){if(_0x5bbb86['body']['id']){delete _0x5bbb86[_0xab12('0x4c')]['id'];}return db[_0xab12('0x2a')][_0xab12('0x49')]({'where':{'id':_0x5bbb86[_0xab12('0x48')]['id']}})[_0xab12('0x24')](handleEntityNotFound(_0x1fb944,null))['then'](saveUpdates(_0x5bbb86[_0xab12('0x4c')],null))[_0xab12('0x24')](respondWithResult(_0x1fb944,null))[_0xab12('0x4a')](handleError(_0x1fb944,null));};exports[_0xab12('0x4d')]=function(_0x29f60c,_0x1f71da){return db[_0xab12('0x2a')][_0xab12('0x49')]({'where':{'id':_0x29f60c[_0xab12('0x48')]['id']}})['then'](handleEntityNotFound(_0x1f71da,null))['then'](removeEntity(_0x1f71da,null))['catch'](handleError(_0x1f71da,null));};exports[_0xab12('0x4e')]=function(_0xc7c644,_0x3df6e6){return db[_0xab12('0x2a')]['describe']()[_0xab12('0x24')](respondWithResult(_0x3df6e6,null))[_0xab12('0x4a')](handleError(_0x3df6e6,null));}; \ No newline at end of file +var _0x27eb=['params','keys','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','rows','catch','show'];(function(_0x3b1300,_0xca2df2){var _0x163bd0=function(_0x14ae32){while(--_0x14ae32){_0x3b1300['push'](_0x3b1300['shift']());}};_0x163bd0(++_0xca2df2);}(_0x27eb,0x96));var _0xb27e=function(_0x280ff7,_0x7c9ffb){_0x280ff7=_0x280ff7-0x0;var _0x1845e8=_0x27eb[_0x280ff7];return _0x1845e8;};'use strict';var pdf=require(_0xb27e('0x0'));var emlformat=require(_0xb27e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb27e('0x2'));var jsonpatch=require(_0xb27e('0x3'));var rp=require('request-promise');var moment=require(_0xb27e('0x4'));var BPromise=require(_0xb27e('0x5'));var Mustache=require(_0xb27e('0x6'));var util=require('util');var path=require(_0xb27e('0x7'));var sox=require('sox');var csv=require(_0xb27e('0x8'));var ejs=require(_0xb27e('0x9'));var fs=require('fs');var _=require(_0xb27e('0xa'));var squel=require('squel');var crypto=require(_0xb27e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb27e('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb27e('0xd'));var Papa=require(_0xb27e('0xe'));var Redis=require(_0xb27e('0xf'));var authService=require(_0xb27e('0x10'));var qs=require(_0xb27e('0x11'));var as=require(_0xb27e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb27e('0x13'))(_0xb27e('0x14'));var utils=require('../../config/utils');var config=require(_0xb27e('0x15'));var db=require(_0xb27e('0x16'))['db'];function respondWithStatusCode(_0x10e94d,_0x2af7cb){_0x2af7cb=_0x2af7cb||0xcc;return function(_0x449088){if(_0x449088){return _0x10e94d[_0xb27e('0x17')](_0x2af7cb);}return _0x10e94d[_0xb27e('0x18')](_0x2af7cb)[_0xb27e('0x19')]();};}function respondWithResult(_0x5103e2,_0xeb5ab5){_0xeb5ab5=_0xeb5ab5||0xc8;return function(_0x58103a){if(_0x58103a){return _0x5103e2[_0xb27e('0x18')](_0xeb5ab5)[_0xb27e('0x1a')](_0x58103a);}};}function respondWithFilteredResult(_0x53cf0d,_0x129910){return function(_0x37ddda){if(_0x37ddda){var _0x36f6ef=_0x37ddda['count'],_0x59d0f8=_0x129910['offset'],_0x2fdec8=_0x129910[_0xb27e('0x1b')]+_0x129910['limit'],_0x54237f;if(_0x2fdec8>=_0x36f6ef){_0x2fdec8=_0x36f6ef;_0x54237f=0xc8;}else{_0x54237f=0xce;}_0x53cf0d['status'](_0x54237f);return _0x53cf0d[_0xb27e('0x1c')](_0xb27e('0x1d'),_0x59d0f8+'-'+_0x2fdec8+'/'+_0x36f6ef)[_0xb27e('0x1a')](_0x37ddda);}return null;};}function patchUpdates(_0x51d894){return function(_0x348589){try{jsonpatch[_0xb27e('0x1e')](_0x348589,_0x51d894,!![]);}catch(_0x5d2156){return BPromise['reject'](_0x5d2156);}return _0x348589[_0xb27e('0x1f')]();};}function saveUpdates(_0x3cc065,_0x3d1771){return function(_0x24a816){if(_0x24a816){return _0x24a816[_0xb27e('0x20')](_0x3cc065)[_0xb27e('0x21')](function(_0x53e775){return _0x53e775;});}return null;};}function removeEntity(_0x4822d0,_0x20d5f6){return function(_0x3b95df){if(_0x3b95df){return _0x3b95df[_0xb27e('0x22')]()[_0xb27e('0x21')](function(){_0x4822d0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2da3e2,_0x35edde){return function(_0x415804){if(!_0x415804){_0x2da3e2['sendStatus'](0x194);}return _0x415804;};}function handleError(_0x4e5b7b,_0x5605bd){_0x5605bd=_0x5605bd||0x1f4;return function(_0x212257){logger[_0xb27e('0x23')](_0x212257['stack']);if(_0x212257['name']){delete _0x212257[_0xb27e('0x24')];}_0x4e5b7b[_0xb27e('0x18')](_0x5605bd)[_0xb27e('0x25')](_0x212257);};}exports[_0xb27e('0x26')]=function(_0x2af8b1,_0x3aba9b){var _0x409f7f={},_0x543eef={},_0x49b2be={'count':0x0,'rows':[]};var _0x5bf4bf=_[_0xb27e('0x27')](db[_0xb27e('0x28')][_0xb27e('0x29')],function(_0x48df99){return{'name':_0x48df99['fieldName'],'type':_0x48df99[_0xb27e('0x2a')][_0xb27e('0x2b')]};});_0x543eef[_0xb27e('0x2c')]=_[_0xb27e('0x27')](_0x5bf4bf,'name');_0x543eef['query']=_['keys'](_0x2af8b1[_0xb27e('0x2d')]);_0x543eef[_0xb27e('0x2e')]=_[_0xb27e('0x2f')](_0x543eef['model'],_0x543eef[_0xb27e('0x2d')]);_0x409f7f[_0xb27e('0x30')]=_[_0xb27e('0x2f')](_0x543eef[_0xb27e('0x2c')],qs['fields'](_0x2af8b1[_0xb27e('0x2d')][_0xb27e('0x31')]));_0x409f7f[_0xb27e('0x30')]=_0x409f7f[_0xb27e('0x30')][_0xb27e('0x32')]?_0x409f7f[_0xb27e('0x30')]:_0x543eef['model'];if(!_0x2af8b1[_0xb27e('0x2d')][_0xb27e('0x33')](_0xb27e('0x34'))){_0x409f7f[_0xb27e('0x35')]=qs['limit'](_0x2af8b1[_0xb27e('0x2d')][_0xb27e('0x35')]);_0x409f7f[_0xb27e('0x1b')]=qs[_0xb27e('0x1b')](_0x2af8b1[_0xb27e('0x2d')][_0xb27e('0x1b')]);}_0x409f7f[_0xb27e('0x36')]=qs[_0xb27e('0x37')](_0x2af8b1[_0xb27e('0x2d')]['sort']);_0x409f7f['where']=qs['filters'](_[_0xb27e('0x38')](_0x2af8b1[_0xb27e('0x2d')],_0x543eef[_0xb27e('0x2e')]),_0x5bf4bf);if(_0x2af8b1[_0xb27e('0x2d')][_0xb27e('0x39')]){_0x409f7f['where']=_[_0xb27e('0x3a')](_0x409f7f[_0xb27e('0x3b')],{'$or':_[_0xb27e('0x27')](_0x5bf4bf,function(_0x5617bb){if(_0x5617bb['type']!==_0xb27e('0x3c')){var _0x35156f={};_0x35156f[_0x5617bb[_0xb27e('0x24')]]={'$like':'%'+_0x2af8b1['query']['filter']+'%'};return _0x35156f;}})});}_0x409f7f=_[_0xb27e('0x3a')]({},_0x409f7f,_0x2af8b1['options']);var _0x481d6c={'where':_0x409f7f[_0xb27e('0x3b')]};return db[_0xb27e('0x28')]['count'](_0x481d6c)[_0xb27e('0x21')](function(_0xf9a5){_0x49b2be['count']=_0xf9a5;if(_0x2af8b1[_0xb27e('0x2d')][_0xb27e('0x3d')]){_0x409f7f[_0xb27e('0x3e')]=[{'all':!![]}];}return db[_0xb27e('0x28')]['findAll'](_0x409f7f);})[_0xb27e('0x21')](function(_0x5d1e3){_0x49b2be[_0xb27e('0x3f')]=_0x5d1e3;return _0x49b2be;})[_0xb27e('0x21')](respondWithFilteredResult(_0x3aba9b,_0x409f7f))[_0xb27e('0x40')](handleError(_0x3aba9b,null));};exports[_0xb27e('0x41')]=function(_0x286b8b,_0x4a0673){var _0x48df7a={'raw':!![],'where':{'id':_0x286b8b[_0xb27e('0x42')]['id']}},_0xc8e05a={};_0xc8e05a['model']=_[_0xb27e('0x43')](db[_0xb27e('0x28')][_0xb27e('0x29')]);_0xc8e05a['query']=_[_0xb27e('0x43')](_0x286b8b[_0xb27e('0x2d')]);_0xc8e05a[_0xb27e('0x2e')]=_['intersection'](_0xc8e05a[_0xb27e('0x2c')],_0xc8e05a[_0xb27e('0x2d')]);_0x48df7a[_0xb27e('0x30')]=_[_0xb27e('0x2f')](_0xc8e05a[_0xb27e('0x2c')],qs[_0xb27e('0x31')](_0x286b8b['query'][_0xb27e('0x31')]));_0x48df7a[_0xb27e('0x30')]=_0x48df7a[_0xb27e('0x30')][_0xb27e('0x32')]?_0x48df7a[_0xb27e('0x30')]:_0xc8e05a[_0xb27e('0x2c')];if(_0x286b8b['query'][_0xb27e('0x3d')]){_0x48df7a[_0xb27e('0x3e')]=[{'all':!![]}];}_0x48df7a=_['merge']({},_0x48df7a,_0x286b8b['options']);return db[_0xb27e('0x28')][_0xb27e('0x44')](_0x48df7a)[_0xb27e('0x21')](handleEntityNotFound(_0x4a0673,null))['then'](respondWithResult(_0x4a0673,null))[_0xb27e('0x40')](handleError(_0x4a0673,null));};exports[_0xb27e('0x45')]=function(_0x4e4d12,_0x20c282){return db[_0xb27e('0x28')][_0xb27e('0x45')](_0x4e4d12[_0xb27e('0x46')],{})[_0xb27e('0x21')](respondWithResult(_0x20c282,0xc9))[_0xb27e('0x40')](handleError(_0x20c282,null));};exports['update']=function(_0x45b1d4,_0xacb2ab){if(_0x45b1d4[_0xb27e('0x46')]['id']){delete _0x45b1d4[_0xb27e('0x46')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x45b1d4[_0xb27e('0x42')]['id']}})[_0xb27e('0x21')](handleEntityNotFound(_0xacb2ab,null))[_0xb27e('0x21')](saveUpdates(_0x45b1d4['body'],null))['then'](respondWithResult(_0xacb2ab,null))[_0xb27e('0x40')](handleError(_0xacb2ab,null));};exports[_0xb27e('0x22')]=function(_0x1f03ae,_0x4a3c7f){return db[_0xb27e('0x28')]['find']({'where':{'id':_0x1f03ae[_0xb27e('0x42')]['id']}})['then'](handleEntityNotFound(_0x4a3c7f,null))[_0xb27e('0x21')](removeEntity(_0x4a3c7f,null))[_0xb27e('0x40')](handleError(_0x4a3c7f,null));};exports[_0xb27e('0x47')]=function(_0x1a9139,_0x3653a7){return db[_0xb27e('0x28')]['describe']()['then'](respondWithResult(_0x3653a7,null))[_0xb27e('0x40')](handleError(_0x3653a7,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index bddacf6..c2df965 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 _0x1629=['util','../../config/logger','api','bluebird','rimraf','../../config/environment','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x4f1ee6,_0x3a0ac1){var _0x331ef3=function(_0x2ca0dd){while(--_0x2ca0dd){_0x4f1ee6['push'](_0x4f1ee6['shift']());}};_0x331ef3(++_0x3a0ac1);}(_0x1629,0x1d8));var _0x9162=function(_0x5986cf,_0x467bb3){_0x5986cf=_0x5986cf-0x0;var _0x39af76=_0x1629[_0x5986cf];return _0x39af76;};'use strict';var _=require(_0x9162('0x0'));var util=require(_0x9162('0x1'));var logger=require(_0x9162('0x2'))(_0x9162('0x3'));var moment=require('moment');var BPromise=require(_0x9162('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9162('0x5'));var config=require(_0x9162('0x6'));var attributes=require('./openchannelQueueReport.attributes');module['exports']=function(_0x13368a,_0x1defdd){return _0x13368a[_0x9162('0x7')](_0x9162('0x8'),attributes,{'tableName':_0x9162('0x9'),'paranoid':![],'indexes':[{'name':_0x9162('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ff9=['OpenchannelQueueReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define'];(function(_0x4166ba,_0x228e3e){var _0x4c3456=function(_0x46b7f5){while(--_0x46b7f5){_0x4166ba['push'](_0x4166ba['shift']());}};_0x4c3456(++_0x228e3e);}(_0x8ff9,0x188));var _0x98ff=function(_0x218e85,_0xfa0f5e){_0x218e85=_0x218e85-0x0;var _0x359648=_0x8ff9[_0x218e85];return _0x359648;};'use strict';var _=require(_0x98ff('0x0'));var util=require(_0x98ff('0x1'));var logger=require(_0x98ff('0x2'))('api');var moment=require(_0x98ff('0x3'));var BPromise=require(_0x98ff('0x4'));var rp=require(_0x98ff('0x5'));var fs=require('fs');var path=require(_0x98ff('0x6'));var rimraf=require(_0x98ff('0x7'));var config=require(_0x98ff('0x8'));var attributes=require(_0x98ff('0x9'));module['exports']=function(_0xe3db15,_0x4e61db){return _0xe3db15[_0x98ff('0xa')](_0x98ff('0xb'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0x98ff('0xc'),'fields':[_0x98ff('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 d93fa73..d15b49a 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 _0x47c5=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x459176,_0x53aa66){var _0x42b253=function(_0x526a3d){while(--_0x526a3d){_0x459176['push'](_0x459176['shift']());}};_0x42b253(++_0x53aa66);}(_0x47c5,0x165));var _0x547c=function(_0x267967,_0x3286bd){_0x267967=_0x267967-0x0;var _0x23a111=_0x47c5[_0x267967];return _0x23a111;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});}exports['CreateOpenchannelQueueReport']=function(_0x23fa9e){var _0x199e4f=this;return new Promise(function(_0xeb059e,_0x4a8901){return db[_0x547c('0x18')][_0x547c('0x19')](_0x23fa9e[_0x547c('0x1a')],{'raw':_0x23fa9e['options']?_0x23fa9e[_0x547c('0x1b')][_0x547c('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5453f9){logger[_0x547c('0xd')](_0x547c('0x1d'),_0x23fa9e);logger['debug'](_0x547c('0x1d'),_0x23fa9e,JSON[_0x547c('0x12')](_0x5453f9));_0xeb059e(_0x5453f9);})['catch'](function(_0x2e317a){logger[_0x547c('0x13')](_0x547c('0x1d'),_0x2e317a['message'],_0x23fa9e);_0x4a8901(_0x199e4f[_0x547c('0x13')](0x1f4,_0x2e317a[_0x547c('0x15')]));});});};exports[_0x547c('0x1e')]=function(_0x26823c){var _0x1f3581=this;return new Promise(function(_0x2663bc,_0x2ab2cc){return db[_0x547c('0x18')]['update'](_0x26823c[_0x547c('0x1a')],{'raw':_0x26823c['options']?_0x26823c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26823c['options']?_0x26823c[_0x547c('0x1b')]['where']||null:null,'attributes':_0x26823c[_0x547c('0x1b')]?_0x26823c['options'][_0x547c('0x1f')]||null:null,'limit':_0x26823c['options']?_0x26823c[_0x547c('0x1b')][_0x547c('0x20')]||null:null})[_0x547c('0xc')](function(_0x30a96c){logger[_0x547c('0xd')]('UpdateOpenchannelQueueReport',_0x26823c);logger['debug'](_0x547c('0x1e'),_0x26823c,JSON['stringify'](_0x30a96c));_0x2663bc(_0x30a96c);})[_0x547c('0x17')](function(_0xed2d39){logger[_0x547c('0x13')](_0x547c('0x1e'),_0xed2d39[_0x547c('0x15')],_0x26823c);_0x2ab2cc(_0x1f3581[_0x547c('0x13')](0x1f4,_0xed2d39[_0x547c('0x15')]));});});}; \ No newline at end of file +var _0xf03a=['request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','stringify','catch','UpdateOpenchannelQueueReport','update','raw','where','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x429601,_0x3e37a9){var _0x2882ad=function(_0x39a918){while(--_0x39a918){_0x429601['push'](_0x429601['shift']());}};_0x2882ad(++_0x3e37a9);}(_0xf03a,0x1a0));var _0xaf03=function(_0x21e342,_0x351283){_0x21e342=_0x21e342-0x0;var _0x39783c=_0xf03a[_0x21e342];return _0x39783c;};'use strict';var _=require('lodash');var util=require(_0xaf03('0x0'));var moment=require(_0xaf03('0x1'));var BPromise=require(_0xaf03('0x2'));var rs=require(_0xaf03('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf03('0x4'))['db'];var utils=require(_0xaf03('0x5'));var logger=require('../../config/logger')(_0xaf03('0x6'));var config=require(_0xaf03('0x7'));var jayson=require(_0xaf03('0x8'));var client=jayson[_0xaf03('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d19df,_0x4d947f,_0x1dcf29){return new BPromise(function(_0x467e7c,_0x33a463){return client[_0xaf03('0xa')](_0x2d19df,_0x1dcf29)[_0xaf03('0xb')](function(_0x3a9083){logger['info'](_0xaf03('0xc'),_0x4d947f,_0xaf03('0xd'));logger[_0xaf03('0xe')](_0xaf03('0xf'),_0x4d947f,_0xaf03('0xd'),JSON['stringify'](_0x3a9083));if(_0x3a9083[_0xaf03('0x10')]){if(_0x3a9083[_0xaf03('0x10')][_0xaf03('0x11')]===0x1f4){logger[_0xaf03('0x10')](_0xaf03('0xc'),_0x4d947f,_0x3a9083[_0xaf03('0x10')][_0xaf03('0x12')]);return _0x33a463(_0x3a9083['error']['message']);}logger[_0xaf03('0x10')](_0xaf03('0xc'),_0x4d947f,_0x3a9083[_0xaf03('0x10')]['message']);return _0x467e7c(_0x3a9083['error'][_0xaf03('0x12')]);}else{logger[_0xaf03('0x13')](_0xaf03('0xc'),_0x4d947f,_0xaf03('0xd'));_0x467e7c(_0x3a9083[_0xaf03('0x14')][_0xaf03('0x12')]);}})['catch'](function(_0xcdc24){logger[_0xaf03('0x10')](_0xaf03('0xc'),_0x4d947f,_0xcdc24);_0x33a463(_0xcdc24);});});}exports[_0xaf03('0x15')]=function(_0x24a074){var _0x27e625=this;return new Promise(function(_0x5cede9,_0x4c6323){return db[_0xaf03('0x16')][_0xaf03('0x17')](_0x24a074[_0xaf03('0x18')],{'raw':_0x24a074[_0xaf03('0x19')]?_0x24a074[_0xaf03('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xaf03('0xb')](function(_0x55eca3){logger[_0xaf03('0x13')](_0xaf03('0x15'),_0x24a074);logger[_0xaf03('0xe')](_0xaf03('0x15'),_0x24a074,JSON[_0xaf03('0x1a')](_0x55eca3));_0x5cede9(_0x55eca3);})[_0xaf03('0x1b')](function(_0x230dd7){logger[_0xaf03('0x10')](_0xaf03('0x15'),_0x230dd7[_0xaf03('0x12')],_0x24a074);_0x4c6323(_0x27e625[_0xaf03('0x10')](0x1f4,_0x230dd7['message']));});});};exports[_0xaf03('0x1c')]=function(_0x1ab68b){var _0x2bc68d=this;return new Promise(function(_0x21b865,_0x4ef6cc){return db['OpenchannelQueueReport'][_0xaf03('0x1d')](_0x1ab68b[_0xaf03('0x18')],{'raw':_0x1ab68b['options']?_0x1ab68b[_0xaf03('0x19')][_0xaf03('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ab68b[_0xaf03('0x19')]?_0x1ab68b[_0xaf03('0x19')][_0xaf03('0x1f')]||null:null,'attributes':_0x1ab68b[_0xaf03('0x19')]?_0x1ab68b['options']['attributes']||null:null,'limit':_0x1ab68b[_0xaf03('0x19')]?_0x1ab68b[_0xaf03('0x19')][_0xaf03('0x20')]||null:null})[_0xaf03('0xb')](function(_0x416728){logger[_0xaf03('0x13')](_0xaf03('0x1c'),_0x1ab68b);logger[_0xaf03('0xe')](_0xaf03('0x1c'),_0x1ab68b,JSON[_0xaf03('0x1a')](_0x416728));_0x21b865(_0x416728);})[_0xaf03('0x1b')](function(_0x1d75f5){logger[_0xaf03('0x10')]('UpdateOpenchannelQueueReport',_0x1d75f5[_0xaf03('0x12')],_0x1ab68b);_0x4ef6cc(_0x2bc68d[_0xaf03('0x10')](0x1f4,_0x1d75f5['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 8cd9dda..babc988 100644 --- a/server/api/openchannelTransferReport/index.js +++ b/server/api/openchannelTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 804f7bf..46d11c6 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 _0x2bc0=['agent','queue','NOW','moment','sequelize','exports','account'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x2bc0,0x1f4));var _0x02bc=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2bc0[_0x17d9e3];return _0x14192d;};'use strict';var moment=require(_0x02bc('0x0'));var Sequelize=require(_0x02bc('0x1'));module[_0x02bc('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x02bc('0x3'),_0x02bc('0x4'),'queue'),'allowNull':![],'defaultValue':_0x02bc('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x02bc('0x6')]}}; \ No newline at end of file +var _0x89ea=['ENUM','account','agent','queue','DATE','NOW','moment','exports','STRING'];(function(_0x58a22f,_0x22721e){var _0x239b0e=function(_0x12b39b){while(--_0x12b39b){_0x58a22f['push'](_0x58a22f['shift']());}};_0x239b0e(++_0x22721e);}(_0x89ea,0x189));var _0xa89e=function(_0x11765d,_0x46113b){_0x11765d=_0x11765d-0x0;var _0x389e72=_0x89ea[_0x11765d];return _0x389e72;};'use strict';var moment=require(_0xa89e('0x0'));var Sequelize=require('sequelize');module[_0xa89e('0x1')]={'uniqueid':{'type':Sequelize[_0xa89e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa89e('0x3')](_0xa89e('0x4'),_0xa89e('0x5'),_0xa89e('0x6')),'allowNull':![],'defaultValue':_0xa89e('0x6')},'transferredAt':{'type':Sequelize[_0xa89e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xa89e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c3e3f79..739e8cc 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 _0x07f8=['rows','show','params','keys','rawAttributes','include','find','catch','create','body','update','describe','html-pdf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','reject','then','destroy','end','error','stack','name','index','map','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','OpenchannelTransferReport','includeAll','findAll'];(function(_0x5cabfd,_0x5dea47){var _0x4bc06c=function(_0x4a2fea){while(--_0x4a2fea){_0x5cabfd['push'](_0x5cabfd['shift']());}};_0x4bc06c(++_0x5dea47);}(_0x07f8,0xe1));var _0x807f=function(_0x1a1ed2,_0x309fd2){_0x1a1ed2=_0x1a1ed2-0x0;var _0x5e11d5=_0x07f8[_0x1a1ed2];return _0x5e11d5;};'use strict';var pdf=require(_0x807f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x807f('0x1'));var rp=require('request-promise');var moment=require(_0x807f('0x2'));var BPromise=require(_0x807f('0x3'));var Mustache=require('mustache');var util=require(_0x807f('0x4'));var path=require(_0x807f('0x5'));var sox=require(_0x807f('0x6'));var csv=require(_0x807f('0x7'));var ejs=require(_0x807f('0x8'));var fs=require('fs');var _=require(_0x807f('0x9'));var squel=require(_0x807f('0xa'));var crypto=require(_0x807f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x807f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x807f('0xd'));var Papa=require(_0x807f('0xe'));var Redis=require('ioredis');var authService=require(_0x807f('0xf'));var qs=require(_0x807f('0x10'));var as=require(_0x807f('0x11'));var hardwareService=require(_0x807f('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x807f('0x13'));var config=require(_0x807f('0x14'));var db=require(_0x807f('0x15'))['db'];function respondWithStatusCode(_0x1dfd29,_0x183cba){_0x183cba=_0x183cba||0xcc;return function(_0x552488){if(_0x552488){return _0x1dfd29[_0x807f('0x16')](_0x183cba);}return _0x1dfd29[_0x807f('0x17')](_0x183cba)['end']();};}function respondWithResult(_0x4840fc,_0x647a14){_0x647a14=_0x647a14||0xc8;return function(_0x3773cc){if(_0x3773cc){return _0x4840fc[_0x807f('0x17')](_0x647a14)[_0x807f('0x18')](_0x3773cc);}};}function respondWithFilteredResult(_0x39fed2,_0x29c7da){return function(_0x28e5d9){if(_0x28e5d9){var _0x4a1725=_0x28e5d9[_0x807f('0x19')],_0x23e76d=_0x29c7da[_0x807f('0x1a')],_0x262412=_0x29c7da['offset']+_0x29c7da['limit'],_0x139ca0;if(_0x262412>=_0x4a1725){_0x262412=_0x4a1725;_0x139ca0=0xc8;}else{_0x139ca0=0xce;}_0x39fed2[_0x807f('0x17')](_0x139ca0);return _0x39fed2[_0x807f('0x1b')](_0x807f('0x1c'),_0x23e76d+'-'+_0x262412+'/'+_0x4a1725)[_0x807f('0x18')](_0x28e5d9);}return null;};}function patchUpdates(_0x3ca020){return function(_0x3503a1){try{jsonpatch['apply'](_0x3503a1,_0x3ca020,!![]);}catch(_0x37c62f){return BPromise[_0x807f('0x1d')](_0x37c62f);}return _0x3503a1['save']();};}function saveUpdates(_0x4cc487,_0x5fa06c){return function(_0xb1c112){if(_0xb1c112){return _0xb1c112['update'](_0x4cc487)[_0x807f('0x1e')](function(_0x101fe2){return _0x101fe2;});}return null;};}function removeEntity(_0x2d48ef,_0x55feaf){return function(_0x554434){if(_0x554434){return _0x554434[_0x807f('0x1f')]()[_0x807f('0x1e')](function(){_0x2d48ef[_0x807f('0x17')](0xcc)[_0x807f('0x20')]();});}};}function handleEntityNotFound(_0x48217f,_0x17d464){return function(_0x3f2490){if(!_0x3f2490){_0x48217f[_0x807f('0x16')](0x194);}return _0x3f2490;};}function handleError(_0x44fc32,_0x89474){_0x89474=_0x89474||0x1f4;return function(_0x2dabde){logger[_0x807f('0x21')](_0x2dabde[_0x807f('0x22')]);if(_0x2dabde[_0x807f('0x23')]){delete _0x2dabde[_0x807f('0x23')];}_0x44fc32[_0x807f('0x17')](_0x89474)['send'](_0x2dabde);};}exports[_0x807f('0x24')]=function(_0x52fe5e,_0x4f6148){var _0x1f7bdb={},_0x4ccf85={},_0x4900c3={'count':0x0,'rows':[]};var _0x499ab4=_[_0x807f('0x25')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x5f4891){return{'name':_0x5f4891[_0x807f('0x26')],'type':_0x5f4891['type'][_0x807f('0x27')]};});_0x4ccf85['model']=_['map'](_0x499ab4,_0x807f('0x23'));_0x4ccf85[_0x807f('0x28')]=_['keys'](_0x52fe5e[_0x807f('0x28')]);_0x4ccf85[_0x807f('0x29')]=_[_0x807f('0x2a')](_0x4ccf85[_0x807f('0x2b')],_0x4ccf85[_0x807f('0x28')]);_0x1f7bdb[_0x807f('0x2c')]=_['intersection'](_0x4ccf85[_0x807f('0x2b')],qs[_0x807f('0x2d')](_0x52fe5e[_0x807f('0x28')][_0x807f('0x2d')]));_0x1f7bdb[_0x807f('0x2c')]=_0x1f7bdb[_0x807f('0x2c')][_0x807f('0x2e')]?_0x1f7bdb[_0x807f('0x2c')]:_0x4ccf85[_0x807f('0x2b')];if(!_0x52fe5e[_0x807f('0x28')][_0x807f('0x2f')]('nolimit')){_0x1f7bdb[_0x807f('0x30')]=qs[_0x807f('0x30')](_0x52fe5e['query']['limit']);_0x1f7bdb[_0x807f('0x1a')]=qs[_0x807f('0x1a')](_0x52fe5e['query'][_0x807f('0x1a')]);}_0x1f7bdb[_0x807f('0x31')]=qs[_0x807f('0x32')](_0x52fe5e[_0x807f('0x28')][_0x807f('0x32')]);_0x1f7bdb[_0x807f('0x33')]=qs[_0x807f('0x29')](_[_0x807f('0x34')](_0x52fe5e['query'],_0x4ccf85['filters']),_0x499ab4);if(_0x52fe5e['query'][_0x807f('0x35')]){_0x1f7bdb[_0x807f('0x33')]=_[_0x807f('0x36')](_0x1f7bdb['where'],{'$or':_[_0x807f('0x25')](_0x499ab4,function(_0x2206d3){if(_0x2206d3['type']!=='VIRTUAL'){var _0x4cfde0={};_0x4cfde0[_0x2206d3[_0x807f('0x23')]]={'$like':'%'+_0x52fe5e[_0x807f('0x28')][_0x807f('0x35')]+'%'};return _0x4cfde0;}})});}_0x1f7bdb=_[_0x807f('0x36')]({},_0x1f7bdb,_0x52fe5e[_0x807f('0x37')]);var _0x2dced5={'where':_0x1f7bdb[_0x807f('0x33')]};return db[_0x807f('0x38')][_0x807f('0x19')](_0x2dced5)[_0x807f('0x1e')](function(_0x31ddf5){_0x4900c3['count']=_0x31ddf5;if(_0x52fe5e[_0x807f('0x28')][_0x807f('0x39')]){_0x1f7bdb['include']=[{'all':!![]}];}return db[_0x807f('0x38')][_0x807f('0x3a')](_0x1f7bdb);})[_0x807f('0x1e')](function(_0x1cd4a8){_0x4900c3[_0x807f('0x3b')]=_0x1cd4a8;return _0x4900c3;})[_0x807f('0x1e')](respondWithFilteredResult(_0x4f6148,_0x1f7bdb))['catch'](handleError(_0x4f6148,null));};exports[_0x807f('0x3c')]=function(_0x30db5e,_0x1221a3){var _0x43a8a2={'raw':!![],'where':{'id':_0x30db5e[_0x807f('0x3d')]['id']}},_0x5dbf8f={};_0x5dbf8f[_0x807f('0x2b')]=_[_0x807f('0x3e')](db[_0x807f('0x38')][_0x807f('0x3f')]);_0x5dbf8f[_0x807f('0x28')]=_[_0x807f('0x3e')](_0x30db5e[_0x807f('0x28')]);_0x5dbf8f[_0x807f('0x29')]=_[_0x807f('0x2a')](_0x5dbf8f[_0x807f('0x2b')],_0x5dbf8f['query']);_0x43a8a2[_0x807f('0x2c')]=_[_0x807f('0x2a')](_0x5dbf8f[_0x807f('0x2b')],qs['fields'](_0x30db5e[_0x807f('0x28')][_0x807f('0x2d')]));_0x43a8a2[_0x807f('0x2c')]=_0x43a8a2['attributes']['length']?_0x43a8a2[_0x807f('0x2c')]:_0x5dbf8f['model'];if(_0x30db5e[_0x807f('0x28')]['includeAll']){_0x43a8a2[_0x807f('0x40')]=[{'all':!![]}];}_0x43a8a2=_['merge']({},_0x43a8a2,_0x30db5e[_0x807f('0x37')]);return db[_0x807f('0x38')][_0x807f('0x41')](_0x43a8a2)[_0x807f('0x1e')](handleEntityNotFound(_0x1221a3,null))[_0x807f('0x1e')](respondWithResult(_0x1221a3,null))[_0x807f('0x42')](handleError(_0x1221a3,null));};exports[_0x807f('0x43')]=function(_0x2c6883,_0x5d8366){return db[_0x807f('0x38')]['create'](_0x2c6883[_0x807f('0x44')],{})[_0x807f('0x1e')](respondWithResult(_0x5d8366,0xc9))[_0x807f('0x42')](handleError(_0x5d8366,null));};exports[_0x807f('0x45')]=function(_0x28d8bc,_0x328a37){if(_0x28d8bc[_0x807f('0x44')]['id']){delete _0x28d8bc[_0x807f('0x44')]['id'];}return db[_0x807f('0x38')][_0x807f('0x41')]({'where':{'id':_0x28d8bc[_0x807f('0x3d')]['id']}})[_0x807f('0x1e')](handleEntityNotFound(_0x328a37,null))[_0x807f('0x1e')](saveUpdates(_0x28d8bc[_0x807f('0x44')],null))[_0x807f('0x1e')](respondWithResult(_0x328a37,null))[_0x807f('0x42')](handleError(_0x328a37,null));};exports[_0x807f('0x1f')]=function(_0x329e05,_0x46579c){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x329e05['params']['id']}})[_0x807f('0x1e')](handleEntityNotFound(_0x46579c,null))[_0x807f('0x1e')](removeEntity(_0x46579c,null))['catch'](handleError(_0x46579c,null));};exports[_0x807f('0x46')]=function(_0x582691,_0x1b5c9b){return db[_0x807f('0x38')][_0x807f('0x46')]()['then'](respondWithResult(_0x1b5c9b,null))[_0x807f('0x42')](handleError(_0x1b5c9b,null));}; \ No newline at end of file +var _0x35d5=['findAll','rows','show','length','include','catch','create','body','params','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','merge','where','filter','options','count','includeAll'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x35d5,0x1bb));var _0x535d=function(_0x580d4c,_0x1e54d0){_0x580d4c=_0x580d4c-0x0;var _0x1b206a=_0x35d5[_0x580d4c];return _0x1b206a;};'use strict';var pdf=require(_0x535d('0x0'));var emlformat=require(_0x535d('0x1'));var rimraf=require(_0x535d('0x2'));var zipdir=require(_0x535d('0x3'));var jsonpatch=require(_0x535d('0x4'));var rp=require('request-promise');var moment=require(_0x535d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x535d('0x6'));var util=require('util');var path=require(_0x535d('0x7'));var sox=require(_0x535d('0x8'));var csv=require(_0x535d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x535d('0xa'));var squel=require(_0x535d('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x535d('0xc'));var toCsv=require(_0x535d('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x535d('0xd'));var authService=require(_0x535d('0xe'));var qs=require(_0x535d('0xf'));var as=require(_0x535d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x535d('0x11'))('api');var utils=require(_0x535d('0x12'));var config=require('../../config/environment');var db=require(_0x535d('0x13'))['db'];function respondWithStatusCode(_0x1f499,_0xee7eee){_0xee7eee=_0xee7eee||0xcc;return function(_0x1b7ddf){if(_0x1b7ddf){return _0x1f499[_0x535d('0x14')](_0xee7eee);}return _0x1f499[_0x535d('0x15')](_0xee7eee)['end']();};}function respondWithResult(_0x4f991c,_0x3d39d1){_0x3d39d1=_0x3d39d1||0xc8;return function(_0x5338a){if(_0x5338a){return _0x4f991c['status'](_0x3d39d1)[_0x535d('0x16')](_0x5338a);}};}function respondWithFilteredResult(_0x3e1556,_0x4b39d0){return function(_0x18f8db){if(_0x18f8db){var _0x3de9ff=_0x18f8db['count'],_0x4773fa=_0x4b39d0[_0x535d('0x17')],_0x373eba=_0x4b39d0[_0x535d('0x17')]+_0x4b39d0[_0x535d('0x18')],_0x5256ce;if(_0x373eba>=_0x3de9ff){_0x373eba=_0x3de9ff;_0x5256ce=0xc8;}else{_0x5256ce=0xce;}_0x3e1556['status'](_0x5256ce);return _0x3e1556[_0x535d('0x19')](_0x535d('0x1a'),_0x4773fa+'-'+_0x373eba+'/'+_0x3de9ff)[_0x535d('0x16')](_0x18f8db);}return null;};}function patchUpdates(_0x349709){return function(_0xb2b60f){try{jsonpatch[_0x535d('0x1b')](_0xb2b60f,_0x349709,!![]);}catch(_0x4162cc){return BPromise[_0x535d('0x1c')](_0x4162cc);}return _0xb2b60f['save']();};}function saveUpdates(_0x13437c,_0x147f45){return function(_0x169da4){if(_0x169da4){return _0x169da4[_0x535d('0x1d')](_0x13437c)[_0x535d('0x1e')](function(_0x4e101d){return _0x4e101d;});}return null;};}function removeEntity(_0xfc2aeb,_0x4be38c){return function(_0x31d470){if(_0x31d470){return _0x31d470[_0x535d('0x1f')]()[_0x535d('0x1e')](function(){_0xfc2aeb['status'](0xcc)[_0x535d('0x20')]();});}};}function handleEntityNotFound(_0x1f0a81,_0x33f114){return function(_0x3363d4){if(!_0x3363d4){_0x1f0a81[_0x535d('0x14')](0x194);}return _0x3363d4;};}function handleError(_0x85e827,_0x28ae29){_0x28ae29=_0x28ae29||0x1f4;return function(_0x4dd41c){logger[_0x535d('0x21')](_0x4dd41c[_0x535d('0x22')]);if(_0x4dd41c['name']){delete _0x4dd41c[_0x535d('0x23')];}_0x85e827[_0x535d('0x15')](_0x28ae29)[_0x535d('0x24')](_0x4dd41c);};}exports[_0x535d('0x25')]=function(_0x1d48c8,_0x15f9ef){var _0x382485={},_0x50a151={},_0x53d8bd={'count':0x0,'rows':[]};var _0x340496=_[_0x535d('0x26')](db[_0x535d('0x27')][_0x535d('0x28')],function(_0x1d0bb1){return{'name':_0x1d0bb1[_0x535d('0x29')],'type':_0x1d0bb1[_0x535d('0x2a')][_0x535d('0x2b')]};});_0x50a151['model']=_[_0x535d('0x26')](_0x340496,'name');_0x50a151[_0x535d('0x2c')]=_[_0x535d('0x2d')](_0x1d48c8['query']);_0x50a151[_0x535d('0x2e')]=_[_0x535d('0x2f')](_0x50a151[_0x535d('0x30')],_0x50a151[_0x535d('0x2c')]);_0x382485[_0x535d('0x31')]=_[_0x535d('0x2f')](_0x50a151[_0x535d('0x30')],qs['fields'](_0x1d48c8[_0x535d('0x2c')][_0x535d('0x32')]));_0x382485['attributes']=_0x382485['attributes']['length']?_0x382485['attributes']:_0x50a151[_0x535d('0x30')];if(!_0x1d48c8[_0x535d('0x2c')][_0x535d('0x33')](_0x535d('0x34'))){_0x382485[_0x535d('0x18')]=qs['limit'](_0x1d48c8[_0x535d('0x2c')][_0x535d('0x18')]);_0x382485[_0x535d('0x17')]=qs['offset'](_0x1d48c8[_0x535d('0x2c')][_0x535d('0x17')]);}_0x382485[_0x535d('0x35')]=qs[_0x535d('0x36')](_0x1d48c8['query'][_0x535d('0x36')]);_0x382485['where']=qs[_0x535d('0x2e')](_['pick'](_0x1d48c8[_0x535d('0x2c')],_0x50a151[_0x535d('0x2e')]),_0x340496);if(_0x1d48c8[_0x535d('0x2c')]['filter']){_0x382485['where']=_[_0x535d('0x37')](_0x382485[_0x535d('0x38')],{'$or':_[_0x535d('0x26')](_0x340496,function(_0xf8abce){if(_0xf8abce[_0x535d('0x2a')]!=='VIRTUAL'){var _0x447945={};_0x447945[_0xf8abce['name']]={'$like':'%'+_0x1d48c8[_0x535d('0x2c')][_0x535d('0x39')]+'%'};return _0x447945;}})});}_0x382485=_[_0x535d('0x37')]({},_0x382485,_0x1d48c8[_0x535d('0x3a')]);var _0x4a2192={'where':_0x382485[_0x535d('0x38')]};return db[_0x535d('0x27')][_0x535d('0x3b')](_0x4a2192)[_0x535d('0x1e')](function(_0x215c82){_0x53d8bd[_0x535d('0x3b')]=_0x215c82;if(_0x1d48c8['query'][_0x535d('0x3c')]){_0x382485['include']=[{'all':!![]}];}return db[_0x535d('0x27')][_0x535d('0x3d')](_0x382485);})[_0x535d('0x1e')](function(_0x162d17){_0x53d8bd[_0x535d('0x3e')]=_0x162d17;return _0x53d8bd;})['then'](respondWithFilteredResult(_0x15f9ef,_0x382485))['catch'](handleError(_0x15f9ef,null));};exports[_0x535d('0x3f')]=function(_0x4529aa,_0x2bffc4){var _0x300098={'raw':!![],'where':{'id':_0x4529aa['params']['id']}},_0x28f26e={};_0x28f26e[_0x535d('0x30')]=_[_0x535d('0x2d')](db[_0x535d('0x27')][_0x535d('0x28')]);_0x28f26e[_0x535d('0x2c')]=_[_0x535d('0x2d')](_0x4529aa[_0x535d('0x2c')]);_0x28f26e[_0x535d('0x2e')]=_[_0x535d('0x2f')](_0x28f26e[_0x535d('0x30')],_0x28f26e[_0x535d('0x2c')]);_0x300098[_0x535d('0x31')]=_[_0x535d('0x2f')](_0x28f26e[_0x535d('0x30')],qs[_0x535d('0x32')](_0x4529aa[_0x535d('0x2c')][_0x535d('0x32')]));_0x300098['attributes']=_0x300098[_0x535d('0x31')][_0x535d('0x40')]?_0x300098[_0x535d('0x31')]:_0x28f26e['model'];if(_0x4529aa[_0x535d('0x2c')][_0x535d('0x3c')]){_0x300098[_0x535d('0x41')]=[{'all':!![]}];}_0x300098=_['merge']({},_0x300098,_0x4529aa['options']);return db[_0x535d('0x27')]['find'](_0x300098)[_0x535d('0x1e')](handleEntityNotFound(_0x2bffc4,null))[_0x535d('0x1e')](respondWithResult(_0x2bffc4,null))[_0x535d('0x42')](handleError(_0x2bffc4,null));};exports[_0x535d('0x43')]=function(_0x24a8d8,_0x498a74){return db[_0x535d('0x27')][_0x535d('0x43')](_0x24a8d8[_0x535d('0x44')],{})[_0x535d('0x1e')](respondWithResult(_0x498a74,0xc9))[_0x535d('0x42')](handleError(_0x498a74,null));};exports[_0x535d('0x1d')]=function(_0x533b0f,_0x2dfdeb){if(_0x533b0f['body']['id']){delete _0x533b0f['body']['id'];}return db[_0x535d('0x27')]['find']({'where':{'id':_0x533b0f[_0x535d('0x45')]['id']}})['then'](handleEntityNotFound(_0x2dfdeb,null))[_0x535d('0x1e')](saveUpdates(_0x533b0f[_0x535d('0x44')],null))[_0x535d('0x1e')](respondWithResult(_0x2dfdeb,null))[_0x535d('0x42')](handleError(_0x2dfdeb,null));};exports[_0x535d('0x1f')]=function(_0x2ed6a8,_0x1d2068){return db['OpenchannelTransferReport'][_0x535d('0x46')]({'where':{'id':_0x2ed6a8[_0x535d('0x45')]['id']}})[_0x535d('0x1e')](handleEntityNotFound(_0x1d2068,null))[_0x535d('0x1e')](removeEntity(_0x1d2068,null))['catch'](handleError(_0x1d2068,null));};exports[_0x535d('0x47')]=function(_0x2c93af,_0x1fd8e1){return db['OpenchannelTransferReport'][_0x535d('0x47')]()[_0x535d('0x1e')](respondWithResult(_0x1fd8e1,null))[_0x535d('0x42')](handleError(_0x1fd8e1,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 6991c11..e8dc3d5 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 _0x5eb1=['define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports'];(function(_0x14e27a,_0x3b4136){var _0x288688=function(_0x3d7ab1){while(--_0x3d7ab1){_0x14e27a['push'](_0x14e27a['shift']());}};_0x288688(++_0x3b4136);}(_0x5eb1,0xdc));var _0x15eb=function(_0x5e5c4c,_0x21abba){_0x5e5c4c=_0x5e5c4c-0x0;var _0x176148=_0x5eb1[_0x5e5c4c];return _0x176148;};'use strict';var _=require(_0x15eb('0x0'));var util=require('util');var logger=require(_0x15eb('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x15eb('0x2'));var fs=require('fs');var path=require(_0x15eb('0x3'));var rimraf=require(_0x15eb('0x4'));var config=require(_0x15eb('0x5'));var attributes=require(_0x15eb('0x6'));module[_0x15eb('0x7')]=function(_0x49b176,_0x507c1a){return _0x49b176[_0x15eb('0x8')](_0x15eb('0x9'),attributes,{'tableName':_0x15eb('0xa'),'paranoid':![],'indexes':[{'name':_0x15eb('0xb'),'fields':[_0x15eb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb15b=['./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xb15b,0x10e));var _0xbb15=function(_0x1d87f0,_0x571677){_0x1d87f0=_0x1d87f0-0x0;var _0x1a2fc0=_0xb15b[_0x1d87f0];return _0x1a2fc0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbb15('0x0'))(_0xbb15('0x1'));var moment=require(_0xbb15('0x2'));var BPromise=require('bluebird');var rp=require(_0xbb15('0x3'));var fs=require('fs');var path=require(_0xbb15('0x4'));var rimraf=require(_0xbb15('0x5'));var config=require('../../config/environment');var attributes=require(_0xbb15('0x6'));module[_0xbb15('0x7')]=function(_0x1fc0b1,_0x301892){return _0x1fc0b1[_0xbb15('0x8')](_0xbb15('0x9'),attributes,{'tableName':_0xbb15('0xa'),'paranoid':![],'indexes':[{'name':_0xbb15('0xb'),'fields':[_0xbb15('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 8105fad..bb411c8 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 _0xc2a5=['client','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2eb3db,_0x4a32c0){var _0x358f33=function(_0x1d0588){while(--_0x1d0588){_0x2eb3db['push'](_0x2eb3db['shift']());}};_0x358f33(++_0x4a32c0);}(_0xc2a5,0x14e));var _0x5c2a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc2a5[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x5c2a('0x0'));var util=require(_0x5c2a('0x1'));var moment=require(_0x5c2a('0x2'));var BPromise=require(_0x5c2a('0x3'));var rs=require(_0x5c2a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c2a('0x5'))['db'];var utils=require(_0x5c2a('0x6'));var logger=require(_0x5c2a('0x7'))(_0x5c2a('0x8'));var config=require(_0x5c2a('0x9'));var jayson=require(_0x5c2a('0xa'));var client=jayson[_0x5c2a('0xb')][_0x5c2a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x503c46,_0x454d25,_0x31cbcd){return new BPromise(function(_0x184d2e,_0x34d952){return client['request'](_0x503c46,_0x31cbcd)[_0x5c2a('0xd')](function(_0xebbc5b){logger[_0x5c2a('0xe')](_0x5c2a('0xf'),_0x454d25,_0x5c2a('0x10'));logger[_0x5c2a('0x11')](_0x5c2a('0x12'),_0x454d25,'request\x20sent',JSON['stringify'](_0xebbc5b));if(_0xebbc5b[_0x5c2a('0x13')]){if(_0xebbc5b[_0x5c2a('0x13')]['code']===0x1f4){logger['error'](_0x5c2a('0xf'),_0x454d25,_0xebbc5b[_0x5c2a('0x13')]['message']);return _0x34d952(_0xebbc5b[_0x5c2a('0x13')]['message']);}logger[_0x5c2a('0x13')](_0x5c2a('0xf'),_0x454d25,_0xebbc5b['error']['message']);return _0x184d2e(_0xebbc5b[_0x5c2a('0x13')][_0x5c2a('0x14')]);}else{logger['info'](_0x5c2a('0xf'),_0x454d25,'request\x20sent');_0x184d2e(_0xebbc5b[_0x5c2a('0x15')]['message']);}})[_0x5c2a('0x16')](function(_0x5ad956){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x454d25,_0x5ad956);_0x34d952(_0x5ad956);});});} \ No newline at end of file +var _0x46b7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment'];(function(_0x47ed1a,_0x34e1d8){var _0x23b059=function(_0xed7fa4){while(--_0xed7fa4){_0x47ed1a['push'](_0x47ed1a['shift']());}};_0x23b059(++_0x34e1d8);}(_0x46b7,0xc5));var _0x746b=function(_0x168f66,_0xae32ee){_0x168f66=_0x168f66-0x0;var _0x2271a0=_0x46b7[_0x168f66];return _0x2271a0;};'use strict';var _=require(_0x746b('0x0'));var util=require(_0x746b('0x1'));var moment=require(_0x746b('0x2'));var BPromise=require(_0x746b('0x3'));var rs=require(_0x746b('0x4'));var fs=require('fs');var Redis=require(_0x746b('0x5'));var db=require(_0x746b('0x6'))['db'];var utils=require(_0x746b('0x7'));var logger=require(_0x746b('0x8'))(_0x746b('0x9'));var config=require(_0x746b('0xa'));var jayson=require(_0x746b('0xb'));var client=jayson[_0x746b('0xc')][_0x746b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380317,_0x4a33dd,_0x1f8c1f){return new BPromise(function(_0x15b2ad,_0xcc9ae5){return client[_0x746b('0xe')](_0x380317,_0x1f8c1f)[_0x746b('0xf')](function(_0x4bafd3){logger[_0x746b('0x10')](_0x746b('0x11'),_0x4a33dd,'request\x20sent');logger[_0x746b('0x12')](_0x746b('0x13'),_0x4a33dd,_0x746b('0x14'),JSON[_0x746b('0x15')](_0x4bafd3));if(_0x4bafd3[_0x746b('0x16')]){if(_0x4bafd3[_0x746b('0x16')]['code']===0x1f4){logger[_0x746b('0x16')](_0x746b('0x11'),_0x4a33dd,_0x4bafd3[_0x746b('0x16')]['message']);return _0xcc9ae5(_0x4bafd3[_0x746b('0x16')][_0x746b('0x17')]);}logger[_0x746b('0x16')](_0x746b('0x11'),_0x4a33dd,_0x4bafd3[_0x746b('0x16')]['message']);return _0x15b2ad(_0x4bafd3['error'][_0x746b('0x17')]);}else{logger[_0x746b('0x10')](_0x746b('0x11'),_0x4a33dd,_0x746b('0x14'));_0x15b2ad(_0x4bafd3[_0x746b('0x18')][_0x746b('0x17')]);}})['catch'](function(_0x133791){logger[_0x746b('0x16')](_0x746b('0x11'),_0x4a33dd,_0x133791);_0xcc9ae5(_0x133791);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 004c3df..d9fc75b 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 _0x1660=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util','path'];(function(_0x1ade3c,_0x184876){var _0x521276=function(_0x3317a8){while(--_0x3317a8){_0x1ade3c['push'](_0x1ade3c['shift']());}};_0x521276(++_0x184876);}(_0x1660,0x1c5));var _0x0166=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x1660[_0x243b59];return _0x3e1676;};'use strict';var multer=require(_0x0166('0x0'));var util=require(_0x0166('0x1'));var path=require(_0x0166('0x2'));var timeout=require(_0x0166('0x3'));var express=require(_0x0166('0x4'));var router=express[_0x0166('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0166('0x6'));var config=require(_0x0166('0x7'));var controller=require(_0x0166('0x8'));router[_0x0166('0x9')]('/',auth[_0x0166('0xa')](),controller[_0x0166('0xb')]);router[_0x0166('0x9')](_0x0166('0xc'),auth['isAuthenticated'](),controller[_0x0166('0xd')]);router[_0x0166('0xe')]('/',auth[_0x0166('0xa')](),controller[_0x0166('0xf')]);router['put'](_0x0166('0xc'),auth[_0x0166('0xa')](),controller[_0x0166('0x10')]);router[_0x0166('0x11')](_0x0166('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0166('0x12')]=router; \ No newline at end of file +var _0xe8db=['../../config/environment','./pause.controller','isAuthenticated','index','get','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x40576c,_0x381838){var _0x1f75a2=function(_0x56e513){while(--_0x56e513){_0x40576c['push'](_0x40576c['shift']());}};_0x1f75a2(++_0x381838);}(_0xe8db,0x11a));var _0xbe8d=function(_0x17c8cc,_0x5e5647){_0x17c8cc=_0x17c8cc-0x0;var _0x3db4eb=_0xe8db[_0x17c8cc];return _0x3db4eb;};'use strict';var multer=require(_0xbe8d('0x0'));var util=require(_0xbe8d('0x1'));var path=require(_0xbe8d('0x2'));var timeout=require(_0xbe8d('0x3'));var express=require(_0xbe8d('0x4'));var router=express['Router']();var auth=require(_0xbe8d('0x5'));var interaction=require(_0xbe8d('0x6'));var config=require(_0xbe8d('0x7'));var controller=require(_0xbe8d('0x8'));router['get']('/',auth[_0xbe8d('0x9')](),controller[_0xbe8d('0xa')]);router[_0xbe8d('0xb')]('/:id',auth[_0xbe8d('0x9')](),controller['show']);router['post']('/',auth[_0xbe8d('0x9')](),controller[_0xbe8d('0xc')]);router[_0xbe8d('0xd')](_0xbe8d('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xbe8d('0xe'),auth['isAuthenticated'](),controller[_0xbe8d('0xf')]);module[_0xbe8d('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 2904190..0b558d0 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 _0xc13a=['STRING','exports'];(function(_0x5bc694,_0x568ae1){var _0x22f607=function(_0x411767){while(--_0x411767){_0x5bc694['push'](_0x5bc694['shift']());}};_0x22f607(++_0x568ae1);}(_0xc13a,0xbd));var _0xac13=function(_0x52f9b4,_0x15e681){_0x52f9b4=_0x52f9b4-0x0;var _0x1c7203=_0xc13a[_0x52f9b4];return _0x1c7203;};'use strict';var Sequelize=require('sequelize');module[_0xac13('0x0')]={'name':{'type':Sequelize[_0xac13('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xac13('0x1')]}}; \ No newline at end of file +var _0x66eb=['sequelize','name','STRING'];(function(_0x437724,_0x1dd4d7){var _0x155c04=function(_0x36c223){while(--_0x36c223){_0x437724['push'](_0x437724['shift']());}};_0x155c04(++_0x1dd4d7);}(_0x66eb,0x117));var _0xb66e=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0x66eb[_0x644ecd];return _0x1c66ce;};'use strict';var Sequelize=require(_0xb66e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb66e('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xb66e('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 82d8f59..ebcda9c 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 _0x78f7=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','get','Pauses','UserProfileResource','destroy','error','stack','send','index','map','Pause','rawAttributes','fieldName','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filters','merge','where','type','VIRTUAL','filter','options','show','include','find','catch','create','body'];(function(_0x1497b9,_0x54ade7){var _0x147887=function(_0x4d99b9){while(--_0x4d99b9){_0x1497b9['push'](_0x1497b9['shift']());}};_0x147887(++_0x54ade7);}(_0x78f7,0x1ed));var _0x778f=function(_0x2af59b,_0x126413){_0x2af59b=_0x2af59b-0x0;var _0x3692fc=_0x78f7[_0x2af59b];return _0x3692fc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x778f('0x0'));var rimraf=require(_0x778f('0x1'));var zipdir=require(_0x778f('0x2'));var jsonpatch=require(_0x778f('0x3'));var rp=require(_0x778f('0x4'));var moment=require(_0x778f('0x5'));var BPromise=require(_0x778f('0x6'));var Mustache=require(_0x778f('0x7'));var util=require(_0x778f('0x8'));var path=require(_0x778f('0x9'));var sox=require('sox');var csv=require(_0x778f('0xa'));var ejs=require(_0x778f('0xb'));var fs=require('fs');var _=require(_0x778f('0xc'));var squel=require(_0x778f('0xd'));var crypto=require('crypto');var jsforce=require(_0x778f('0xe'));var deskjs=require(_0x778f('0xf'));var toCsv=require(_0x778f('0xa'));var querystring=require(_0x778f('0x10'));var Papa=require(_0x778f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x778f('0x12'));var as=require(_0x778f('0x13'));var hardwareService=require(_0x778f('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x778f('0x15'));var config=require(_0x778f('0x16'));var db=require(_0x778f('0x17'))['db'];function respondWithStatusCode(_0x29376a,_0x49be7f){_0x49be7f=_0x49be7f||0xcc;return function(_0x136617){if(_0x136617){return _0x29376a[_0x778f('0x18')](_0x49be7f);}return _0x29376a[_0x778f('0x19')](_0x49be7f)[_0x778f('0x1a')]();};}function respondWithResult(_0x55b7e8,_0x589cd5){_0x589cd5=_0x589cd5||0xc8;return function(_0x58c272){if(_0x58c272){return _0x55b7e8[_0x778f('0x19')](_0x589cd5)['json'](_0x58c272);}};}function respondWithFilteredResult(_0x185e6c,_0xbe1149){return function(_0x462bf2){if(_0x462bf2){var _0x109788=_0x462bf2[_0x778f('0x1b')],_0x229d57=_0xbe1149[_0x778f('0x1c')],_0x56828e=_0xbe1149['offset']+_0xbe1149['limit'],_0x27c56b;if(_0x56828e>=_0x109788){_0x56828e=_0x109788;_0x27c56b=0xc8;}else{_0x27c56b=0xce;}_0x185e6c['status'](_0x27c56b);return _0x185e6c[_0x778f('0x1d')](_0x778f('0x1e'),_0x229d57+'-'+_0x56828e+'/'+_0x109788)['json'](_0x462bf2);}return null;};}function patchUpdates(_0x3ba0c5){return function(_0x53ba8b){try{jsonpatch[_0x778f('0x1f')](_0x53ba8b,_0x3ba0c5,!![]);}catch(_0x1b5d5d){return BPromise[_0x778f('0x20')](_0x1b5d5d);}return _0x53ba8b[_0x778f('0x21')]();};}function saveUpdates(_0x2a1ea6,_0x1f2452){return function(_0x5ed3b4){if(_0x5ed3b4){return _0x5ed3b4[_0x778f('0x22')](_0x2a1ea6)[_0x778f('0x23')](function(_0x14e4d1){return _0x14e4d1;});}return null;};}function removeEntity(_0x5ea614,_0x4151d0){return function(_0xbe4435){if(_0xbe4435){return _0xbe4435['destroy']()[_0x778f('0x23')](function(){var _0x774f1c=_0xbe4435[_0x778f('0x24')]({'plain':!![]});var _0x2a4f6f=_0x778f('0x25');return db[_0x778f('0x26')][_0x778f('0x27')]({'where':{'type':_0x2a4f6f,'resourceId':_0x774f1c['id']}})['then'](function(){return _0xbe4435;});})[_0x778f('0x23')](function(){_0x5ea614[_0x778f('0x19')](0xcc)[_0x778f('0x1a')]();});}};}function handleEntityNotFound(_0x1d54f3,_0x5b3397){return function(_0x59a4b6){if(!_0x59a4b6){_0x1d54f3[_0x778f('0x18')](0x194);}return _0x59a4b6;};}function handleError(_0x28e37a,_0x58f3ed){_0x58f3ed=_0x58f3ed||0x1f4;return function(_0x4c0cff){logger[_0x778f('0x28')](_0x4c0cff[_0x778f('0x29')]);if(_0x4c0cff['name']){delete _0x4c0cff['name'];}_0x28e37a['status'](_0x58f3ed)[_0x778f('0x2a')](_0x4c0cff);};}exports[_0x778f('0x2b')]=function(_0x4f8314,_0x4c1697){var _0x3c4747={},_0x31b60a={},_0x2cd8de={'count':0x0,'rows':[]};var _0x4cd416=_[_0x778f('0x2c')](db[_0x778f('0x2d')][_0x778f('0x2e')],function(_0x5e5db1){return{'name':_0x5e5db1[_0x778f('0x2f')],'type':_0x5e5db1['type']['key']};});_0x31b60a[_0x778f('0x30')]=_['map'](_0x4cd416,_0x778f('0x31'));_0x31b60a['query']=_[_0x778f('0x32')](_0x4f8314[_0x778f('0x33')]);_0x31b60a['filters']=_[_0x778f('0x34')](_0x31b60a[_0x778f('0x30')],_0x31b60a['query']);_0x3c4747[_0x778f('0x35')]=_[_0x778f('0x34')](_0x31b60a['model'],qs[_0x778f('0x36')](_0x4f8314[_0x778f('0x33')][_0x778f('0x36')]));_0x3c4747[_0x778f('0x35')]=_0x3c4747[_0x778f('0x35')][_0x778f('0x37')]?_0x3c4747[_0x778f('0x35')]:_0x31b60a[_0x778f('0x30')];if(!_0x4f8314[_0x778f('0x33')][_0x778f('0x38')](_0x778f('0x39'))){_0x3c4747['limit']=qs[_0x778f('0x3a')](_0x4f8314[_0x778f('0x33')][_0x778f('0x3a')]);_0x3c4747[_0x778f('0x1c')]=qs[_0x778f('0x1c')](_0x4f8314[_0x778f('0x33')]['offset']);}_0x3c4747['order']=qs[_0x778f('0x3b')](_0x4f8314['query'][_0x778f('0x3b')]);_0x3c4747['where']=qs['filters'](_[_0x778f('0x3c')](_0x4f8314[_0x778f('0x33')],_0x31b60a[_0x778f('0x3d')]),_0x4cd416);if(_0x4f8314['query']['filter']){_0x3c4747['where']=_[_0x778f('0x3e')](_0x3c4747[_0x778f('0x3f')],{'$or':_[_0x778f('0x2c')](_0x4cd416,function(_0x573ccc){if(_0x573ccc[_0x778f('0x40')]!==_0x778f('0x41')){var _0x190b67={};_0x190b67[_0x573ccc[_0x778f('0x31')]]={'$like':'%'+_0x4f8314[_0x778f('0x33')][_0x778f('0x42')]+'%'};return _0x190b67;}})});}_0x3c4747=_[_0x778f('0x3e')]({},_0x3c4747,_0x4f8314[_0x778f('0x43')]);var _0x272ca5={'where':_0x3c4747[_0x778f('0x3f')]};return db['Pause'][_0x778f('0x1b')](_0x272ca5)[_0x778f('0x23')](function(_0x52dabb){_0x2cd8de['count']=_0x52dabb;if(_0x4f8314[_0x778f('0x33')]['includeAll']){_0x3c4747['include']=[{'all':!![]}];}return db['Pause']['findAll'](_0x3c4747);})[_0x778f('0x23')](function(_0x3420bd){_0x2cd8de['rows']=_0x3420bd;return _0x2cd8de;})[_0x778f('0x23')](respondWithFilteredResult(_0x4c1697,_0x3c4747))['catch'](handleError(_0x4c1697,null));};exports[_0x778f('0x44')]=function(_0x226053,_0x26b7c2){var _0x1e0281={'raw':!![],'where':{'id':_0x226053['params']['id']}},_0x3412ae={};_0x3412ae['model']=_['keys'](db[_0x778f('0x2d')][_0x778f('0x2e')]);_0x3412ae['query']=_[_0x778f('0x32')](_0x226053[_0x778f('0x33')]);_0x3412ae[_0x778f('0x3d')]=_[_0x778f('0x34')](_0x3412ae[_0x778f('0x30')],_0x3412ae['query']);_0x1e0281[_0x778f('0x35')]=_['intersection'](_0x3412ae[_0x778f('0x30')],qs[_0x778f('0x36')](_0x226053[_0x778f('0x33')][_0x778f('0x36')]));_0x1e0281['attributes']=_0x1e0281[_0x778f('0x35')][_0x778f('0x37')]?_0x1e0281[_0x778f('0x35')]:_0x3412ae[_0x778f('0x30')];if(_0x226053['query']['includeAll']){_0x1e0281[_0x778f('0x45')]=[{'all':!![]}];}_0x1e0281=_[_0x778f('0x3e')]({},_0x1e0281,_0x226053['options']);return db['Pause'][_0x778f('0x46')](_0x1e0281)[_0x778f('0x23')](handleEntityNotFound(_0x26b7c2,null))[_0x778f('0x23')](respondWithResult(_0x26b7c2,null))[_0x778f('0x47')](handleError(_0x26b7c2,null));};exports[_0x778f('0x48')]=function(_0x2e6ac2,_0xfb91ec){return db['Pause'][_0x778f('0x48')](_0x2e6ac2[_0x778f('0x49')],{})[_0x778f('0x23')](function(_0x12c026){var _0x5411a6=_0x2e6ac2[_0x778f('0x4a')][_0x778f('0x24')]({'plain':!![]});if(!_0x5411a6)throw new Error(_0x778f('0x4b'));if(_0x5411a6[_0x778f('0x4c')]==='user'){var _0xb84799=_0x12c026[_0x778f('0x24')]({'plain':!![]});var _0x1e04b2=_0x778f('0x25');return db[_0x778f('0x4d')]['find']({'where':{'name':_0x1e04b2,'userProfileId':_0x5411a6[_0x778f('0x4e')]},'raw':!![]})[_0x778f('0x23')](function(_0x1cd77a){if(_0x1cd77a&&_0x1cd77a[_0x778f('0x4f')]===0x0){return db['UserProfileResource'][_0x778f('0x48')]({'name':_0xb84799[_0x778f('0x31')],'resourceId':_0xb84799['id'],'type':_0x1cd77a['name'],'sectionId':_0x1cd77a['id']},{})[_0x778f('0x23')](function(){return _0x12c026;});}else{return _0x12c026;}})['catch'](function(_0x23ba6c){logger[_0x778f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23ba6c);throw _0x23ba6c;});}return _0x12c026;})[_0x778f('0x23')](respondWithResult(_0xfb91ec,0xc9))['catch'](handleError(_0xfb91ec,null));};exports[_0x778f('0x22')]=function(_0x6e5972,_0x57f46c){if(_0x6e5972[_0x778f('0x49')]['id']){delete _0x6e5972[_0x778f('0x49')]['id'];}return db[_0x778f('0x2d')]['find']({'where':{'id':_0x6e5972[_0x778f('0x50')]['id']}})[_0x778f('0x23')](handleEntityNotFound(_0x57f46c,null))[_0x778f('0x23')](saveUpdates(_0x6e5972[_0x778f('0x49')],null))[_0x778f('0x23')](respondWithResult(_0x57f46c,null))[_0x778f('0x47')](handleError(_0x57f46c,null));};exports[_0x778f('0x27')]=function(_0x1c2484,_0x4bb965){return db[_0x778f('0x2d')][_0x778f('0x46')]({'where':{'id':_0x1c2484[_0x778f('0x50')]['id']}})[_0x778f('0x23')](handleEntityNotFound(_0x4bb965,null))['then'](removeEntity(_0x4bb965,null))[_0x778f('0x47')](handleError(_0x4bb965,null));}; \ No newline at end of file +var _0x6acc=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','json','reject','save','then','destroy','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','keys','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x50b750,_0xe5817b){var _0x1b60a8=function(_0x23a6e8){while(--_0x23a6e8){_0x50b750['push'](_0x50b750['shift']());}};_0x1b60a8(++_0xe5817b);}(_0x6acc,0x13f));var _0xc6ac=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x6acc[_0x4ed520];return _0x4415a6;};'use strict';var pdf=require(_0xc6ac('0x0'));var emlformat=require(_0xc6ac('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc6ac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc6ac('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc6ac('0x4'));var util=require(_0xc6ac('0x5'));var path=require(_0xc6ac('0x6'));var sox=require(_0xc6ac('0x7'));var csv=require(_0xc6ac('0x8'));var ejs=require(_0xc6ac('0x9'));var fs=require('fs');var _=require(_0xc6ac('0xa'));var squel=require('squel');var crypto=require(_0xc6ac('0xb'));var jsforce=require(_0xc6ac('0xc'));var deskjs=require(_0xc6ac('0xd'));var toCsv=require(_0xc6ac('0x8'));var querystring=require(_0xc6ac('0xe'));var Papa=require(_0xc6ac('0xf'));var Redis=require(_0xc6ac('0x10'));var authService=require(_0xc6ac('0x11'));var qs=require(_0xc6ac('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6ac('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xc6ac('0x14'));var config=require(_0xc6ac('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x475e05,_0x2fbb81){_0x2fbb81=_0x2fbb81||0xcc;return function(_0x43973f){if(_0x43973f){return _0x475e05[_0xc6ac('0x16')](_0x2fbb81);}return _0x475e05[_0xc6ac('0x17')](_0x2fbb81)[_0xc6ac('0x18')]();};}function respondWithResult(_0x2e6de5,_0x2ff4b3){_0x2ff4b3=_0x2ff4b3||0xc8;return function(_0x2ad5d8){if(_0x2ad5d8){return _0x2e6de5[_0xc6ac('0x17')](_0x2ff4b3)['json'](_0x2ad5d8);}};}function respondWithFilteredResult(_0xb8bdc,_0x5884f3){return function(_0x2d5373){if(_0x2d5373){var _0x3384f1=_0x2d5373[_0xc6ac('0x19')],_0x5a02fb=_0x5884f3[_0xc6ac('0x1a')],_0x3d1495=_0x5884f3[_0xc6ac('0x1a')]+_0x5884f3[_0xc6ac('0x1b')],_0x3fbae2;if(_0x3d1495>=_0x3384f1){_0x3d1495=_0x3384f1;_0x3fbae2=0xc8;}else{_0x3fbae2=0xce;}_0xb8bdc[_0xc6ac('0x17')](_0x3fbae2);return _0xb8bdc[_0xc6ac('0x1c')]('Content-Range',_0x5a02fb+'-'+_0x3d1495+'/'+_0x3384f1)[_0xc6ac('0x1d')](_0x2d5373);}return null;};}function patchUpdates(_0xdee19b){return function(_0x181261){try{jsonpatch['apply'](_0x181261,_0xdee19b,!![]);}catch(_0x52bafd){return BPromise[_0xc6ac('0x1e')](_0x52bafd);}return _0x181261[_0xc6ac('0x1f')]();};}function saveUpdates(_0x2fd086,_0x3b8582){return function(_0x1bc988){if(_0x1bc988){return _0x1bc988['update'](_0x2fd086)[_0xc6ac('0x20')](function(_0x460500){return _0x460500;});}return null;};}function removeEntity(_0xc5a9ef,_0x4330f3){return function(_0x59aa5c){if(_0x59aa5c){return _0x59aa5c[_0xc6ac('0x21')]()[_0xc6ac('0x20')](function(){var _0x57dc55=_0x59aa5c['get']({'plain':!![]});var _0x27984a=_0xc6ac('0x22');return db[_0xc6ac('0x23')][_0xc6ac('0x21')]({'where':{'type':_0x27984a,'resourceId':_0x57dc55['id']}})[_0xc6ac('0x20')](function(){return _0x59aa5c;});})[_0xc6ac('0x20')](function(){_0xc5a9ef[_0xc6ac('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a9855,_0x1f0da6){return function(_0x5cf22){if(!_0x5cf22){_0x4a9855[_0xc6ac('0x16')](0x194);}return _0x5cf22;};}function handleError(_0x14257c,_0x1ec9c1){_0x1ec9c1=_0x1ec9c1||0x1f4;return function(_0x2943d7){logger[_0xc6ac('0x24')](_0x2943d7[_0xc6ac('0x25')]);if(_0x2943d7['name']){delete _0x2943d7[_0xc6ac('0x26')];}_0x14257c[_0xc6ac('0x17')](_0x1ec9c1)[_0xc6ac('0x27')](_0x2943d7);};}exports[_0xc6ac('0x28')]=function(_0x14c403,_0x5c7939){var _0x13b595={},_0x50cf79={},_0x3776ad={'count':0x0,'rows':[]};var _0x360191=_[_0xc6ac('0x29')](db[_0xc6ac('0x2a')][_0xc6ac('0x2b')],function(_0x419273){return{'name':_0x419273[_0xc6ac('0x2c')],'type':_0x419273[_0xc6ac('0x2d')]['key']};});_0x50cf79['model']=_['map'](_0x360191,_0xc6ac('0x26'));_0x50cf79[_0xc6ac('0x2e')]=_['keys'](_0x14c403[_0xc6ac('0x2e')]);_0x50cf79[_0xc6ac('0x2f')]=_[_0xc6ac('0x30')](_0x50cf79[_0xc6ac('0x31')],_0x50cf79['query']);_0x13b595[_0xc6ac('0x32')]=_[_0xc6ac('0x30')](_0x50cf79[_0xc6ac('0x31')],qs[_0xc6ac('0x33')](_0x14c403[_0xc6ac('0x2e')]['fields']));_0x13b595[_0xc6ac('0x32')]=_0x13b595[_0xc6ac('0x32')][_0xc6ac('0x34')]?_0x13b595[_0xc6ac('0x32')]:_0x50cf79[_0xc6ac('0x31')];if(!_0x14c403[_0xc6ac('0x2e')][_0xc6ac('0x35')](_0xc6ac('0x36'))){_0x13b595[_0xc6ac('0x1b')]=qs[_0xc6ac('0x1b')](_0x14c403[_0xc6ac('0x2e')]['limit']);_0x13b595[_0xc6ac('0x1a')]=qs[_0xc6ac('0x1a')](_0x14c403[_0xc6ac('0x2e')]['offset']);}_0x13b595[_0xc6ac('0x37')]=qs['sort'](_0x14c403[_0xc6ac('0x2e')][_0xc6ac('0x38')]);_0x13b595['where']=qs['filters'](_[_0xc6ac('0x39')](_0x14c403[_0xc6ac('0x2e')],_0x50cf79[_0xc6ac('0x2f')]),_0x360191);if(_0x14c403['query']['filter']){_0x13b595[_0xc6ac('0x3a')]=_[_0xc6ac('0x3b')](_0x13b595[_0xc6ac('0x3a')],{'$or':_[_0xc6ac('0x29')](_0x360191,function(_0x5125ec){if(_0x5125ec[_0xc6ac('0x2d')]!==_0xc6ac('0x3c')){var _0x5d009a={};_0x5d009a[_0x5125ec[_0xc6ac('0x26')]]={'$like':'%'+_0x14c403['query'][_0xc6ac('0x3d')]+'%'};return _0x5d009a;}})});}_0x13b595=_[_0xc6ac('0x3b')]({},_0x13b595,_0x14c403['options']);var _0x235e7c={'where':_0x13b595[_0xc6ac('0x3a')]};return db[_0xc6ac('0x2a')]['count'](_0x235e7c)[_0xc6ac('0x20')](function(_0x441e91){_0x3776ad[_0xc6ac('0x19')]=_0x441e91;if(_0x14c403[_0xc6ac('0x2e')][_0xc6ac('0x3e')]){_0x13b595['include']=[{'all':!![]}];}return db['Pause'][_0xc6ac('0x3f')](_0x13b595);})['then'](function(_0x1cba36){_0x3776ad[_0xc6ac('0x40')]=_0x1cba36;return _0x3776ad;})[_0xc6ac('0x20')](respondWithFilteredResult(_0x5c7939,_0x13b595))[_0xc6ac('0x41')](handleError(_0x5c7939,null));};exports[_0xc6ac('0x42')]=function(_0x58aa46,_0x26c189){var _0x5999fe={'raw':!![],'where':{'id':_0x58aa46['params']['id']}},_0x5c1d7e={};_0x5c1d7e[_0xc6ac('0x31')]=_['keys'](db[_0xc6ac('0x2a')][_0xc6ac('0x2b')]);_0x5c1d7e[_0xc6ac('0x2e')]=_[_0xc6ac('0x43')](_0x58aa46[_0xc6ac('0x2e')]);_0x5c1d7e['filters']=_[_0xc6ac('0x30')](_0x5c1d7e['model'],_0x5c1d7e['query']);_0x5999fe[_0xc6ac('0x32')]=_[_0xc6ac('0x30')](_0x5c1d7e[_0xc6ac('0x31')],qs['fields'](_0x58aa46[_0xc6ac('0x2e')][_0xc6ac('0x33')]));_0x5999fe[_0xc6ac('0x32')]=_0x5999fe[_0xc6ac('0x32')]['length']?_0x5999fe[_0xc6ac('0x32')]:_0x5c1d7e[_0xc6ac('0x31')];if(_0x58aa46[_0xc6ac('0x2e')][_0xc6ac('0x3e')]){_0x5999fe[_0xc6ac('0x44')]=[{'all':!![]}];}_0x5999fe=_[_0xc6ac('0x3b')]({},_0x5999fe,_0x58aa46[_0xc6ac('0x45')]);return db['Pause'][_0xc6ac('0x46')](_0x5999fe)[_0xc6ac('0x20')](handleEntityNotFound(_0x26c189,null))[_0xc6ac('0x20')](respondWithResult(_0x26c189,null))['catch'](handleError(_0x26c189,null));};exports[_0xc6ac('0x47')]=function(_0x1de0f3,_0x3bb025){return db[_0xc6ac('0x2a')][_0xc6ac('0x47')](_0x1de0f3[_0xc6ac('0x48')],{})['then'](function(_0x457f1a){var _0xacdcf=_0x1de0f3['user']['get']({'plain':!![]});if(!_0xacdcf)throw new Error(_0xc6ac('0x49'));if(_0xacdcf[_0xc6ac('0x4a')]===_0xc6ac('0x4b')){var _0x3b1392=_0x457f1a[_0xc6ac('0x4c')]({'plain':!![]});var _0x3eabff=_0xc6ac('0x22');return db[_0xc6ac('0x4d')][_0xc6ac('0x46')]({'where':{'name':_0x3eabff,'userProfileId':_0xacdcf[_0xc6ac('0x4e')]},'raw':!![]})['then'](function(_0x22a7a9){if(_0x22a7a9&&_0x22a7a9[_0xc6ac('0x4f')]===0x0){return db[_0xc6ac('0x23')][_0xc6ac('0x47')]({'name':_0x3b1392[_0xc6ac('0x26')],'resourceId':_0x3b1392['id'],'type':_0x22a7a9[_0xc6ac('0x26')],'sectionId':_0x22a7a9['id']},{})['then'](function(){return _0x457f1a;});}else{return _0x457f1a;}})['catch'](function(_0x231932){logger[_0xc6ac('0x24')](_0xc6ac('0x50'),_0x231932);throw _0x231932;});}return _0x457f1a;})[_0xc6ac('0x20')](respondWithResult(_0x3bb025,0xc9))[_0xc6ac('0x41')](handleError(_0x3bb025,null));};exports[_0xc6ac('0x51')]=function(_0x14b2cf,_0x2f70c8){if(_0x14b2cf['body']['id']){delete _0x14b2cf[_0xc6ac('0x48')]['id'];}return db[_0xc6ac('0x2a')]['find']({'where':{'id':_0x14b2cf[_0xc6ac('0x52')]['id']}})[_0xc6ac('0x20')](handleEntityNotFound(_0x2f70c8,null))[_0xc6ac('0x20')](saveUpdates(_0x14b2cf['body'],null))[_0xc6ac('0x20')](respondWithResult(_0x2f70c8,null))['catch'](handleError(_0x2f70c8,null));};exports['destroy']=function(_0x57d002,_0x493d6b){return db[_0xc6ac('0x2a')]['find']({'where':{'id':_0x57d002['params']['id']}})[_0xc6ac('0x20')](handleEntityNotFound(_0x493d6b,null))[_0xc6ac('0x20')](removeEntity(_0x493d6b,null))[_0xc6ac('0x41')](handleError(_0x493d6b,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index f3b01ac..ab55849 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 _0xf9ac=['api','moment','request-promise','rimraf','exports','define','tools_pauses','lodash'];(function(_0x59f73f,_0x2a2f0){var _0x1e02b9=function(_0x17aa5b){while(--_0x17aa5b){_0x59f73f['push'](_0x59f73f['shift']());}};_0x1e02b9(++_0x2a2f0);}(_0xf9ac,0x87));var _0xcf9a=function(_0x3c45c0,_0xe36d53){_0x3c45c0=_0x3c45c0-0x0;var _0x52b091=_0xf9ac[_0x3c45c0];return _0x52b091;};'use strict';var _=require(_0xcf9a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcf9a('0x1'));var moment=require(_0xcf9a('0x2'));var BPromise=require('bluebird');var rp=require(_0xcf9a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf9a('0x4'));var config=require('../../config/environment');var attributes=require('./pause.attributes');module[_0xcf9a('0x5')]=function(_0x3d77c8,_0x158971){return _0x3d77c8[_0xcf9a('0x6')]('Pause',attributes,{'tableName':_0xcf9a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ca7=['exports','Pause','tools_pauses','lodash','util','../../config/logger','moment','bluebird','rimraf','./pause.attributes'];(function(_0x4299e5,_0x1e96de){var _0x207c15=function(_0xc127a0){while(--_0xc127a0){_0x4299e5['push'](_0x4299e5['shift']());}};_0x207c15(++_0x1e96de);}(_0x4ca7,0x1e3));var _0x74ca=function(_0x254925,_0x774541){_0x254925=_0x254925-0x0;var _0x3a018c=_0x4ca7[_0x254925];return _0x3a018c;};'use strict';var _=require(_0x74ca('0x0'));var util=require(_0x74ca('0x1'));var logger=require(_0x74ca('0x2'))('api');var moment=require(_0x74ca('0x3'));var BPromise=require(_0x74ca('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x74ca('0x5'));var config=require('../../config/environment');var attributes=require(_0x74ca('0x6'));module[_0x74ca('0x7')]=function(_0x4bccc5,_0x352e08){return _0x4bccc5['define'](_0x74ca('0x8'),attributes,{'tableName':_0x74ca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index be7ef0a..9fcad0a 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 _0xb575=['stringify','lodash','util','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Pause','find','options','raw','attributes','include','map','model','ShowPause','debug'];(function(_0x301ea6,_0x202cf3){var _0x3bd1ae=function(_0xc27c01){while(--_0xc27c01){_0x301ea6['push'](_0x301ea6['shift']());}};_0x3bd1ae(++_0x202cf3);}(_0xb575,0xda));var _0x5b57=function(_0x5dcf7c,_0x128871){_0x5dcf7c=_0x5dcf7c-0x0;var _0x562255=_0xb575[_0x5dcf7c];return _0x562255;};'use strict';var _=require(_0x5b57('0x0'));var util=require(_0x5b57('0x1'));var moment=require('moment');var BPromise=require(_0x5b57('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b57('0x3'));var logger=require(_0x5b57('0x4'))('rpc');var config=require(_0x5b57('0x5'));var jayson=require(_0x5b57('0x6'));var client=jayson[_0x5b57('0x7')][_0x5b57('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x672beb,_0x5d223d,_0x4232d0){return new BPromise(function(_0x5dd0c7,_0x2f9789){return client[_0x5b57('0x9')](_0x672beb,_0x4232d0)[_0x5b57('0xa')](function(_0x49ce3a){logger[_0x5b57('0xb')](_0x5b57('0xc'),_0x5d223d,_0x5b57('0xd'));logger['debug'](_0x5b57('0xe'),_0x5d223d,_0x5b57('0xd'),JSON['stringify'](_0x49ce3a));if(_0x49ce3a['error']){if(_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x10')]===0x1f4){logger[_0x5b57('0xf')](_0x5b57('0xc'),_0x5d223d,_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x11')]);return _0x2f9789(_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x11')]);}logger[_0x5b57('0xf')](_0x5b57('0xc'),_0x5d223d,_0x49ce3a['error'][_0x5b57('0x11')]);return _0x5dd0c7(_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x11')]);}else{logger['info'](_0x5b57('0xc'),_0x5d223d,_0x5b57('0xd'));_0x5dd0c7(_0x49ce3a[_0x5b57('0x12')][_0x5b57('0x11')]);}})[_0x5b57('0x13')](function(_0x1e7cc0){logger[_0x5b57('0xf')](_0x5b57('0xc'),_0x5d223d,_0x1e7cc0);_0x2f9789(_0x1e7cc0);});});}exports['ShowPause']=function(_0x336db6){var _0x1e316f=this;return new Promise(function(_0x2cb809,_0x137899){return db[_0x5b57('0x14')][_0x5b57('0x15')]({'raw':_0x336db6['options']?_0x336db6[_0x5b57('0x16')][_0x5b57('0x17')]===undefined?!![]:![]:!![],'where':_0x336db6[_0x5b57('0x16')]?_0x336db6[_0x5b57('0x16')]['where']||null:null,'attributes':_0x336db6[_0x5b57('0x16')]?_0x336db6[_0x5b57('0x16')][_0x5b57('0x18')]||null:null,'include':_0x336db6['options']?_0x336db6[_0x5b57('0x16')][_0x5b57('0x19')]?_[_0x5b57('0x1a')](_0x336db6[_0x5b57('0x16')][_0x5b57('0x19')],function(_0x15cf8b){return{'model':db[_0x15cf8b['model']],'as':_0x15cf8b['as'],'attributes':_0x15cf8b[_0x5b57('0x18')],'include':_0x15cf8b['include']?_[_0x5b57('0x1a')](_0x15cf8b[_0x5b57('0x19')],function(_0x5a4961){return{'model':db[_0x5a4961['model']],'as':_0x5a4961['as'],'attributes':_0x5a4961[_0x5b57('0x18')],'include':_0x5a4961['include']?_[_0x5b57('0x1a')](_0x5a4961[_0x5b57('0x19')],function(_0x1ab440){return{'model':db[_0x1ab440[_0x5b57('0x1b')]],'as':_0x1ab440['as'],'attributes':_0x1ab440[_0x5b57('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5b57('0xa')](function(_0x43a231){logger[_0x5b57('0xb')](_0x5b57('0x1c'),_0x336db6);logger[_0x5b57('0x1d')](_0x5b57('0x1c'),_0x336db6,JSON[_0x5b57('0x1e')](_0x43a231));_0x2cb809(_0x43a231);})[_0x5b57('0x13')](function(_0x53c81b){logger[_0x5b57('0xf')](_0x5b57('0x1c'),_0x53c81b[_0x5b57('0x11')],_0x336db6);_0x137899(_0x1e316f['error'](0x1f4,_0x53c81b[_0x5b57('0x11')]));});});}; \ No newline at end of file +var _0xf547=['where','attributes','include','map','model','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','Pause,\x20%s,\x20%s','message','result','catch','ShowPause','find','options','raw'];(function(_0x149210,_0x5bafce){var _0x46b860=function(_0x37e23f){while(--_0x37e23f){_0x149210['push'](_0x149210['shift']());}};_0x46b860(++_0x5bafce);}(_0xf547,0x1b7));var _0x7f54=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xf547[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x7f54('0x0'));var util=require(_0x7f54('0x1'));var moment=require(_0x7f54('0x2'));var BPromise=require('bluebird');var rs=require(_0x7f54('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f54('0x4'))['db'];var utils=require(_0x7f54('0x5'));var logger=require(_0x7f54('0x6'))(_0x7f54('0x7'));var config=require('../../config/environment');var jayson=require(_0x7f54('0x8'));var client=jayson[_0x7f54('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f8583,_0x2b260f,_0x1d449f){return new BPromise(function(_0x7f3055,_0x18c7a9){return client[_0x7f54('0xa')](_0x3f8583,_0x1d449f)[_0x7f54('0xb')](function(_0x183c25){logger[_0x7f54('0xc')]('Pause,\x20%s,\x20%s',_0x2b260f,_0x7f54('0xd'));logger[_0x7f54('0xe')]('Pause,\x20%s,\x20%s,\x20%s',_0x2b260f,_0x7f54('0xd'),JSON[_0x7f54('0xf')](_0x183c25));if(_0x183c25[_0x7f54('0x10')]){if(_0x183c25[_0x7f54('0x10')][_0x7f54('0x11')]===0x1f4){logger[_0x7f54('0x10')](_0x7f54('0x12'),_0x2b260f,_0x183c25[_0x7f54('0x10')][_0x7f54('0x13')]);return _0x18c7a9(_0x183c25[_0x7f54('0x10')][_0x7f54('0x13')]);}logger['error']('Pause,\x20%s,\x20%s',_0x2b260f,_0x183c25[_0x7f54('0x10')][_0x7f54('0x13')]);return _0x7f3055(_0x183c25[_0x7f54('0x10')][_0x7f54('0x13')]);}else{logger[_0x7f54('0xc')](_0x7f54('0x12'),_0x2b260f,'request\x20sent');_0x7f3055(_0x183c25[_0x7f54('0x14')][_0x7f54('0x13')]);}})[_0x7f54('0x15')](function(_0x26cd64){logger['error']('Pause,\x20%s,\x20%s',_0x2b260f,_0x26cd64);_0x18c7a9(_0x26cd64);});});}exports[_0x7f54('0x16')]=function(_0x19d72c){var _0x24b50b=this;return new Promise(function(_0x534e6b,_0xc20eac){return db['Pause'][_0x7f54('0x17')]({'raw':_0x19d72c['options']?_0x19d72c[_0x7f54('0x18')][_0x7f54('0x19')]===undefined?!![]:![]:!![],'where':_0x19d72c['options']?_0x19d72c[_0x7f54('0x18')][_0x7f54('0x1a')]||null:null,'attributes':_0x19d72c[_0x7f54('0x18')]?_0x19d72c[_0x7f54('0x18')][_0x7f54('0x1b')]||null:null,'include':_0x19d72c[_0x7f54('0x18')]?_0x19d72c[_0x7f54('0x18')][_0x7f54('0x1c')]?_[_0x7f54('0x1d')](_0x19d72c[_0x7f54('0x18')]['include'],function(_0x105ddb){return{'model':db[_0x105ddb[_0x7f54('0x1e')]],'as':_0x105ddb['as'],'attributes':_0x105ddb[_0x7f54('0x1b')],'include':_0x105ddb[_0x7f54('0x1c')]?_[_0x7f54('0x1d')](_0x105ddb[_0x7f54('0x1c')],function(_0x374d6c){return{'model':db[_0x374d6c[_0x7f54('0x1e')]],'as':_0x374d6c['as'],'attributes':_0x374d6c['attributes'],'include':_0x374d6c[_0x7f54('0x1c')]?_[_0x7f54('0x1d')](_0x374d6c[_0x7f54('0x1c')],function(_0x3d1001){return{'model':db[_0x3d1001[_0x7f54('0x1e')]],'as':_0x3d1001['as'],'attributes':_0x3d1001['attributes']};}):[]};}):[]};}):[]:[]})[_0x7f54('0xb')](function(_0x2ff83d){logger[_0x7f54('0xc')](_0x7f54('0x16'),_0x19d72c);logger['debug'](_0x7f54('0x16'),_0x19d72c,JSON[_0x7f54('0xf')](_0x2ff83d));_0x534e6b(_0x2ff83d);})['catch'](function(_0x2b764e){logger[_0x7f54('0x10')]('ShowPause',_0x2b764e[_0x7f54('0x13')],_0x19d72c);_0xc20eac(_0x24b50b[_0x7f54('0x10')](0x1f4,_0x2b764e[_0x7f54('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 8685823..5f7c461 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 _0x54bb=['single','file','upload','webhookPost','put','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./plugin.controller','isAuthenticated','get','webhookGet','/:id','show','download','diskStorage','join','root','format','%s-%s%s','extname','now','post'];(function(_0x5632e1,_0x358c21){var _0x31dcb7=function(_0x235533){while(--_0x235533){_0x5632e1['push'](_0x5632e1['shift']());}};_0x31dcb7(++_0x358c21);}(_0x54bb,0x7c));var _0xb54b=function(_0x3fa813,_0x295ac7){_0x3fa813=_0x3fa813-0x0;var _0x3cbab1=_0x54bb[_0x3fa813];return _0x3cbab1;};'use strict';var multer=require(_0xb54b('0x0'));var util=require('util');var path=require(_0xb54b('0x1'));var timeout=require('connect-timeout');var express=require(_0xb54b('0x2'));var router=express[_0xb54b('0x3')]();var auth=require(_0xb54b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb54b('0x5'));var controller=require(_0xb54b('0x6'));router['get']('/',auth[_0xb54b('0x7')](),controller['index']);router[_0xb54b('0x8')]('/webhook',controller[_0xb54b('0x9')]);router['get'](_0xb54b('0xa'),auth[_0xb54b('0x7')](),controller[_0xb54b('0xb')]);router['get']('/:id/download',auth[_0xb54b('0x7')](),controller[_0xb54b('0xc')]);var upload=multer({'storage':multer[_0xb54b('0xd')]({'destination':function(_0x1bd3b4,_0x2d710e,_0x2c795d){_0x2c795d(null,path[_0xb54b('0xe')](config[_0xb54b('0xf')],'server/files/plugins'));},'filename':function(_0x3adc77,_0x4165ff,_0x36bd92){_0x4165ff['originalname']=_0x4165ff['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x36bd92(null,util[_0xb54b('0x10')](_0xb54b('0x11'),path['basename'](_0x4165ff['originalname'],path[_0xb54b('0x12')](_0x4165ff['originalname'])),Date[_0xb54b('0x13')](),path['extname'](_0x4165ff['originalname'])));}})});router[_0xb54b('0x14')]('/',upload[_0xb54b('0x15')](_0xb54b('0x16')),controller[_0xb54b('0x17')]);router[_0xb54b('0x14')]('/webhook',controller[_0xb54b('0x18')]);router[_0xb54b('0x19')](_0xb54b('0xa'),auth[_0xb54b('0x7')](),controller[_0xb54b('0x1a')]);router['delete'](_0xb54b('0xa'),auth['isAuthenticated'](),controller[_0xb54b('0x1b')]);module[_0xb54b('0x1c')]=router; \ No newline at end of file +var _0x018c=['show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated'];(function(_0x5d15cf,_0x5a6b18){var _0x548b03=function(_0x11da90){while(--_0x11da90){_0x5d15cf['push'](_0x5d15cf['shift']());}};_0x548b03(++_0x5a6b18);}(_0x018c,0xda));var _0xc018=function(_0x3254fd,_0x1b71d1){_0x3254fd=_0x3254fd-0x0;var _0xe270c=_0x018c[_0x3254fd];return _0xe270c;};'use strict';var multer=require(_0xc018('0x0'));var util=require(_0xc018('0x1'));var path=require(_0xc018('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc018('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc018('0x4'));var config=require(_0xc018('0x5'));var controller=require(_0xc018('0x6'));router[_0xc018('0x7')]('/',auth['isAuthenticated'](),controller[_0xc018('0x8')]);router[_0xc018('0x7')](_0xc018('0x9'),controller[_0xc018('0xa')]);router[_0xc018('0x7')](_0xc018('0xb'),auth[_0xc018('0xc')](),controller[_0xc018('0xd')]);router[_0xc018('0x7')](_0xc018('0xe'),auth[_0xc018('0xc')](),controller[_0xc018('0xf')]);var upload=multer({'storage':multer[_0xc018('0x10')]({'destination':function(_0x9cb3c2,_0x254baf,_0x2eb514){_0x2eb514(null,path[_0xc018('0x11')](config[_0xc018('0x12')],'server/files/plugins'));},'filename':function(_0x911c9c,_0x590f23,_0x53d2a3){_0x590f23[_0xc018('0x13')]=_0x590f23[_0xc018('0x13')][_0xc018('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x53d2a3(null,util[_0xc018('0x15')](_0xc018('0x16'),path[_0xc018('0x17')](_0x590f23[_0xc018('0x13')],path[_0xc018('0x18')](_0x590f23[_0xc018('0x13')])),Date[_0xc018('0x19')](),path['extname'](_0x590f23[_0xc018('0x13')])));}})});router[_0xc018('0x1a')]('/',upload[_0xc018('0x1b')](_0xc018('0x1c')),controller[_0xc018('0x1d')]);router[_0xc018('0x1a')](_0xc018('0x9'),controller[_0xc018('0x1e')]);router['put']('/:id',auth[_0xc018('0xc')](),controller['update']);router[_0xc018('0x1f')](_0xc018('0xb'),auth[_0xc018('0xc')](),controller['delete']);module[_0xc018('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 03553d9..5ee2b50 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 _0xf864=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','html','script'];(function(_0x5f01ba,_0x4a6b7e){var _0x137168=function(_0x20ef85){while(--_0x20ef85){_0x5f01ba['push'](_0x5f01ba['shift']());}};_0x137168(++_0x4a6b7e);}(_0xf864,0x14d));var _0x4f86=function(_0x4f95cb,_0x280481){_0x4f95cb=_0x4f95cb-0x0;var _0x51f0b9=_0xf864[_0x4f95cb];return _0x51f0b9;};'use strict';var Sequelize=require(_0x4f86('0x0'));module['exports']={'name':{'type':Sequelize[_0x4f86('0x1')]},'type':{'type':Sequelize[_0x4f86('0x2')](_0x4f86('0x3'),_0x4f86('0x4'))},'description':{'type':Sequelize[_0x4f86('0x5')]},'version':{'type':Sequelize[_0x4f86('0x5')]},'path':{'type':Sequelize[_0x4f86('0x1')],'comment':_0x4f86('0x6')},'active':{'type':Sequelize[_0x4f86('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x4f86('0x2')](_0x4f86('0x8'),_0x4f86('0x9'),_0x4f86('0xa'),_0x4f86('0xb')),'defaultValue':'always','comment':_0x4f86('0xc')},'icon':{'type':Sequelize[_0x4f86('0x1')]},'adminUrl':{'type':Sequelize[_0x4f86('0x1')]},'agentUrl':{'type':Sequelize[_0x4f86('0x1')]},'scriptName':{'type':Sequelize[_0x4f86('0x1')]},'scriptPath':{'type':Sequelize[_0x4f86('0x1')]}}; \ No newline at end of file +var _0x2dd8=['STRING','ENUM','html','script','TEXT','BOOLEAN','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize'];(function(_0x175ef7,_0x1ce5c1){var _0x4eba3d=function(_0x412722){while(--_0x412722){_0x175ef7['push'](_0x175ef7['shift']());}};_0x4eba3d(++_0x1ce5c1);}(_0x2dd8,0x83));var _0x82dd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2dd8[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x82dd('0x0'));module['exports']={'name':{'type':Sequelize[_0x82dd('0x1')]},'type':{'type':Sequelize[_0x82dd('0x2')](_0x82dd('0x3'),_0x82dd('0x4'))},'description':{'type':Sequelize[_0x82dd('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x82dd('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x82dd('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x82dd('0x7'),_0x82dd('0x8'),_0x82dd('0x9'),_0x82dd('0xa')),'defaultValue':_0x82dd('0x9'),'comment':_0x82dd('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x82dd('0x1')]},'agentUrl':{'type':Sequelize[_0x82dd('0x1')]},'scriptName':{'type':Sequelize[_0x82dd('0x1')]},'scriptPath':{'type':Sequelize[_0x82dd('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 9801397..fd09d83 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 _0x9c2b=['end','count','offset','set','Content-Range','json','apply','reject','update','then','get','Plugins','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','limit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','rows','catch','show','length','find','root','server/files/plugins','format','%s.zip','basename','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','info','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','some','manifest.json','readFileSync','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','test','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','params','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','statusCode','webhookPost','http://localhost:','content-type','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./plugin.socket','status'];(function(_0x850b3c,_0x597a6b){var _0x4f96ff=function(_0x25f3c5){while(--_0x25f3c5){_0x850b3c['push'](_0x850b3c['shift']());}};_0x4f96ff(++_0x597a6b);}(_0x9c2b,0x8a));var _0xb9c2=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x9c2b[_0x7e2eb0];return _0xd92de4;};'use strict';var pdf=require(_0xb9c2('0x0'));var emlformat=require(_0xb9c2('0x1'));var rimraf=require(_0xb9c2('0x2'));var zipdir=require(_0xb9c2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9c2('0x4'));var moment=require(_0xb9c2('0x5'));var BPromise=require(_0xb9c2('0x6'));var Mustache=require(_0xb9c2('0x7'));var util=require('util');var path=require(_0xb9c2('0x8'));var sox=require(_0xb9c2('0x9'));var csv=require('to-csv');var ejs=require(_0xb9c2('0xa'));var fs=require('fs');var _=require(_0xb9c2('0xb'));var squel=require('squel');var crypto=require(_0xb9c2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb9c2('0xd'));var toCsv=require(_0xb9c2('0xe'));var querystring=require(_0xb9c2('0xf'));var Papa=require(_0xb9c2('0x10'));var extract=require(_0xb9c2('0x11'));var rimraf=require(_0xb9c2('0x2'));var archiver=require(_0xb9c2('0x12'));var Redis=require(_0xb9c2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb9c2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9c2('0x15'));var logger=require(_0xb9c2('0x16'))(_0xb9c2('0x17'));var utils=require(_0xb9c2('0x18'));var config=require(_0xb9c2('0x19'));var db=require('../../mysqldb')['db'];config[_0xb9c2('0x1a')]=_[_0xb9c2('0x1b')](config[_0xb9c2('0x1a')],{'host':_0xb9c2('0x1c'),'port':0x18eb});var socket=require(_0xb9c2('0x1d'))(new Redis(config['redis']));require(_0xb9c2('0x1e'))['register'](socket);function respondWithStatusCode(_0xb273ce,_0x5c9b24){_0x5c9b24=_0x5c9b24||0xcc;return function(_0x28afcb){if(_0x28afcb){return _0xb273ce['sendStatus'](_0x5c9b24);}return _0xb273ce[_0xb9c2('0x1f')](_0x5c9b24)[_0xb9c2('0x20')]();};}function respondWithResult(_0x4adab,_0x4fdf6c){_0x4fdf6c=_0x4fdf6c||0xc8;return function(_0x50f494){if(_0x50f494){return _0x4adab[_0xb9c2('0x1f')](_0x4fdf6c)['json'](_0x50f494);}};}function respondWithFilteredResult(_0x1c88b7,_0x207429){return function(_0x26d562){if(_0x26d562){var _0x573b58=_0x26d562[_0xb9c2('0x21')],_0x50111d=_0x207429[_0xb9c2('0x22')],_0x2dd649=_0x207429[_0xb9c2('0x22')]+_0x207429['limit'],_0x4edb62;if(_0x2dd649>=_0x573b58){_0x2dd649=_0x573b58;_0x4edb62=0xc8;}else{_0x4edb62=0xce;}_0x1c88b7[_0xb9c2('0x1f')](_0x4edb62);return _0x1c88b7[_0xb9c2('0x23')](_0xb9c2('0x24'),_0x50111d+'-'+_0x2dd649+'/'+_0x573b58)[_0xb9c2('0x25')](_0x26d562);}return null;};}function patchUpdates(_0x3f2f41){return function(_0x6b3b9d){try{jsonpatch[_0xb9c2('0x26')](_0x6b3b9d,_0x3f2f41,!![]);}catch(_0x1b826a){return BPromise[_0xb9c2('0x27')](_0x1b826a);}return _0x6b3b9d['save']();};}function saveUpdates(_0xd16409,_0x10fee4){return function(_0x5230e9){if(_0x5230e9){return _0x5230e9[_0xb9c2('0x28')](_0xd16409)['then'](function(_0x5b3b09){return _0x5b3b09;});}return null;};}function removeEntity(_0xf6006d,_0xe7c07e){return function(_0x301252){if(_0x301252){return _0x301252['destroy']()[_0xb9c2('0x29')](function(){var _0x566eb8=_0x301252[_0xb9c2('0x2a')]({'plain':!![]});var _0x7b8779=_0xb9c2('0x2b');return db[_0xb9c2('0x2c')][_0xb9c2('0x2d')]({'where':{'type':_0x7b8779,'resourceId':_0x566eb8['id']}})[_0xb9c2('0x29')](function(){return _0x301252;});})[_0xb9c2('0x29')](function(){_0xf6006d[_0xb9c2('0x1f')](0xcc)[_0xb9c2('0x20')]();});}};}function handleEntityNotFound(_0x461ea4,_0x593d15){return function(_0x4c738){if(!_0x4c738){_0x461ea4[_0xb9c2('0x2e')](0x194);}return _0x4c738;};}function handleError(_0x4361fa,_0x238417){_0x238417=_0x238417||0x1f4;return function(_0x4284a1){logger[_0xb9c2('0x2f')](_0x4284a1[_0xb9c2('0x30')]);if(_0x4284a1[_0xb9c2('0x31')]){delete _0x4284a1[_0xb9c2('0x31')];}_0x4361fa[_0xb9c2('0x1f')](_0x238417)[_0xb9c2('0x32')](_0x4284a1);};}exports[_0xb9c2('0x33')]=function(_0x3a7981,_0x4937fa){var _0x232479={},_0x3e7f19={},_0x27ce8a={'count':0x0,'rows':[]};var _0x4a5403=_[_0xb9c2('0x34')](db[_0xb9c2('0x35')][_0xb9c2('0x36')],function(_0x418e94){return{'name':_0x418e94[_0xb9c2('0x37')],'type':_0x418e94[_0xb9c2('0x38')]['key']};});_0x3e7f19[_0xb9c2('0x39')]=_['map'](_0x4a5403,_0xb9c2('0x31'));_0x3e7f19[_0xb9c2('0x3a')]=_[_0xb9c2('0x3b')](_0x3a7981[_0xb9c2('0x3a')]);_0x3e7f19['filters']=_[_0xb9c2('0x3c')](_0x3e7f19[_0xb9c2('0x39')],_0x3e7f19[_0xb9c2('0x3a')]);_0x232479['attributes']=_[_0xb9c2('0x3c')](_0x3e7f19[_0xb9c2('0x39')],qs[_0xb9c2('0x3d')](_0x3a7981[_0xb9c2('0x3a')][_0xb9c2('0x3d')]));_0x232479['attributes']=_0x232479[_0xb9c2('0x3e')]['length']?_0x232479[_0xb9c2('0x3e')]:_0x3e7f19[_0xb9c2('0x39')];if(!_0x3a7981['query']['hasOwnProperty']('nolimit')){_0x232479[_0xb9c2('0x3f')]=qs[_0xb9c2('0x3f')](_0x3a7981['query'][_0xb9c2('0x3f')]);_0x232479['offset']=qs[_0xb9c2('0x22')](_0x3a7981['query'][_0xb9c2('0x22')]);}_0x232479[_0xb9c2('0x40')]=qs[_0xb9c2('0x41')](_0x3a7981[_0xb9c2('0x3a')][_0xb9c2('0x41')]);_0x232479[_0xb9c2('0x42')]=qs[_0xb9c2('0x43')](_[_0xb9c2('0x44')](_0x3a7981[_0xb9c2('0x3a')],_0x3e7f19['filters']),_0x4a5403);if(_0x3a7981[_0xb9c2('0x3a')]['filter']){_0x232479[_0xb9c2('0x42')]=_[_0xb9c2('0x45')](_0x232479['where'],{'$or':_[_0xb9c2('0x34')](_0x4a5403,function(_0x27e3df){if(_0x27e3df['type']!=='VIRTUAL'){var _0x23bb74={};_0x23bb74[_0x27e3df['name']]={'$like':'%'+_0x3a7981[_0xb9c2('0x3a')][_0xb9c2('0x46')]+'%'};return _0x23bb74;}})});}_0x232479=_['merge']({},_0x232479,_0x3a7981[_0xb9c2('0x47')]);var _0xb67ef9={'where':_0x232479['where']};return db[_0xb9c2('0x35')][_0xb9c2('0x21')](_0xb67ef9)[_0xb9c2('0x29')](function(_0x4e3361){_0x27ce8a[_0xb9c2('0x21')]=_0x4e3361;if(_0x3a7981[_0xb9c2('0x3a')][_0xb9c2('0x48')]){_0x232479[_0xb9c2('0x49')]=[{'all':!![]}];}return db[_0xb9c2('0x35')]['findAll'](_0x232479);})['then'](function(_0xb2cc07){_0x27ce8a[_0xb9c2('0x4a')]=_0xb2cc07;return _0x27ce8a;})[_0xb9c2('0x29')](respondWithFilteredResult(_0x4937fa,_0x232479))[_0xb9c2('0x4b')](handleError(_0x4937fa,null));};exports[_0xb9c2('0x4c')]=function(_0x542b0d,_0x2fac5d){var _0x282000={'raw':!![],'where':{'id':_0x542b0d['params']['id']}},_0x45e08a={};_0x45e08a[_0xb9c2('0x39')]=_[_0xb9c2('0x3b')](db['Plugin'][_0xb9c2('0x36')]);_0x45e08a[_0xb9c2('0x3a')]=_[_0xb9c2('0x3b')](_0x542b0d['query']);_0x45e08a[_0xb9c2('0x43')]=_[_0xb9c2('0x3c')](_0x45e08a[_0xb9c2('0x39')],_0x45e08a['query']);_0x282000[_0xb9c2('0x3e')]=_[_0xb9c2('0x3c')](_0x45e08a[_0xb9c2('0x39')],qs['fields'](_0x542b0d[_0xb9c2('0x3a')][_0xb9c2('0x3d')]));_0x282000[_0xb9c2('0x3e')]=_0x282000[_0xb9c2('0x3e')][_0xb9c2('0x4d')]?_0x282000['attributes']:_0x45e08a[_0xb9c2('0x39')];if(_0x542b0d['query'][_0xb9c2('0x48')]){_0x282000['include']=[{'all':!![]}];}_0x282000=_['merge']({},_0x282000,_0x542b0d[_0xb9c2('0x47')]);return db['Plugin'][_0xb9c2('0x4e')](_0x282000)[_0xb9c2('0x29')](handleEntityNotFound(_0x2fac5d,null))[_0xb9c2('0x29')](respondWithResult(_0x2fac5d,null))['catch'](handleError(_0x2fac5d,null));};exports['download']=function(_0x790f54,_0x49da4e,_0x260d0f){return db['Plugin'][_0xb9c2('0x4e')]({'where':{'id':_0x790f54['params']['id']},'attributes':['name',_0xb9c2('0x8')],'raw':!![]})[_0xb9c2('0x29')](handleEntityNotFound(_0x49da4e,null))['then'](function(_0xcc8043){if(_0xcc8043){var _0x31a740=path['join'](config[_0xb9c2('0x4f')],_0xb9c2('0x50'),util[_0xb9c2('0x51')](_0xb9c2('0x52'),path[_0xb9c2('0x53')](_0xcc8043['path'])));var _0x1765e9=fs['createWriteStream'](_0x31a740);var _0x39ea74=archiver(_0xb9c2('0x54'),{'zlib':{'level':0x9}});_0x39ea74['on'](_0xb9c2('0x55'),function(_0x51122d){if(_0x51122d[_0xb9c2('0x56')]===_0xb9c2('0x57')){logger[_0xb9c2('0x2f')](_0x51122d);}else{throw new db[(_0xb9c2('0x58'))][(_0xb9c2('0x59'))](_0xb9c2('0x5a'));}});_0x39ea74['on'](_0xb9c2('0x2f'),function(_0x16e69f){throw new db['Sequelize'][(_0xb9c2('0x59'))](_0xb9c2('0x5a'));});_0x39ea74[_0xb9c2('0x5b')](_0x1765e9);_0x39ea74[_0xb9c2('0x5c')](_0xb9c2('0x5d'),{'cwd':path[_0xb9c2('0x5e')](config[_0xb9c2('0x4f')],_0xb9c2('0x50'),path[_0xb9c2('0x5f')](_0xcc8043['path'])),'ignore':[path[_0xb9c2('0x5e')](path[_0xb9c2('0x53')](_0xcc8043[_0xb9c2('0x8')]),_0xb9c2('0x60')),path[_0xb9c2('0x5e')](path['basename'](_0xcc8043['path']),_0xb9c2('0x61'))],'nodir':!![]})[_0xb9c2('0x62')]();_0x1765e9['on'](_0xb9c2('0x63'),function(){if(!fs[_0xb9c2('0x64')](_0x31a740)){throw new db[(_0xb9c2('0x58'))][(_0xb9c2('0x59'))]('Plugin\x20not\x20found');}return _0x49da4e[_0xb9c2('0x65')](_0x31a740,util[_0xb9c2('0x51')]('%s.zip',path['basename'](_0xcc8043[_0xb9c2('0x8')])),function(_0x6f2cf){if(_0x6f2cf){throw new db['Sequelize'][(_0xb9c2('0x59'))](_0xb9c2('0x66'));}fs[_0xb9c2('0x67')](_0x31a740);logger['info'](_0xb9c2('0x68'));logger['info'](_0xb9c2('0x69'));});});}return null;})[_0xb9c2('0x4b')](handleError(_0x49da4e,null));};exports[_0xb9c2('0x6a')]=function(_0x3c9500,_0x38bbe9,_0x3b476a){var _0x10e981=path['basename'](_0x3c9500[_0xb9c2('0x6b')][_0xb9c2('0x6c')],path[_0xb9c2('0x6d')](_0x3c9500['file'][_0xb9c2('0x6c')]));var _0x1fc831=path[_0xb9c2('0x5e')](config[_0xb9c2('0x4f')],_0xb9c2('0x50'),_0x3c9500[_0xb9c2('0x6b')][_0xb9c2('0x6c')]);var _0x5ddebd=path[_0xb9c2('0x5e')](config[_0xb9c2('0x4f')],'server/files/plugins',_0x10e981);logger[_0xb9c2('0x6e')]('Plugin\x20upload\x20filepath:\x20%s',_0x1fc831);logger[_0xb9c2('0x6e')](_0xb9c2('0x6f'),_0x5ddebd);try{fs['chmodSync'](_0x1fc831,parseInt(_0xb9c2('0x70'),0x8));extract(_0x1fc831,{'dir':_0x5ddebd},function(_0x205d34){if(_0x205d34){logger[_0xb9c2('0x2f')](_0x205d34);handleError(_0x205d34,!![]);};var _0x23c085=fs[_0xb9c2('0x71')](_0x5ddebd);if(_0x23c085[_0xb9c2('0x4d')]>0x1){removeReferences(_0x1fc831,_0x5ddebd);logger[_0xb9c2('0x2f')](_0xb9c2('0x72'));return _0x3b476a(new Error('Invalid\x20plugin\x20structure'));}var _0x437250=fs['lstatSync'](path[_0xb9c2('0x5e')](_0x5ddebd,_0x23c085[0x0]));if(_0x437250[_0xb9c2('0x73')]()){removeReferences(_0x1fc831,_0x5ddebd);logger[_0xb9c2('0x2f')](_0xb9c2('0x72'));return _0x3b476a(new Error(_0xb9c2('0x72')));}if(_0x437250['isDirectory']()){var _0x178fa0=fs[_0xb9c2('0x71')](path[_0xb9c2('0x5e')](_0x5ddebd,_0x23c085[0x0]));if(_0x178fa0[_0xb9c2('0x4d')]===0x0){removeReferences(_0x1fc831,_0x5ddebd);logger[_0xb9c2('0x2f')](_0xb9c2('0x72'));return _0x3b476a(new Error(_0xb9c2('0x72')));}var _0xb35493=_0x178fa0[_0xb9c2('0x74')](function(_0x3c4da8){return _0x3c4da8===_0xb9c2('0x75');});if(!_0xb35493){return _0x3b476a(new Error('Plugin\x20manifest\x20missing'));}var _0x50fa9d=fs[_0xb9c2('0x76')](path['join'](_0x5ddebd,_0x23c085[0x0],_0xb9c2('0x75')));var _0x540af9=JSON['parse'](_0x50fa9d);if(_0xb9c2('0x77')==typeof _0x540af9[_0xb9c2('0x31')]){return _0x3b476a(new Error(_0xb9c2('0x78')));}if(_0xb9c2('0x77')==typeof _0x540af9[_0xb9c2('0x38')]){return _0x3b476a(new Error(_0xb9c2('0x79')));}if('undefined'==typeof _0x540af9[_0xb9c2('0x7a')]){return _0x3b476a(new Error(_0xb9c2('0x7b')));}if(_0xb9c2('0x77')==typeof _0x540af9[_0xb9c2('0x7c')]){return _0x3b476a(new Error(_0xb9c2('0x7d')));}if(_0x540af9[_0xb9c2('0x38')]===_0xb9c2('0x7e')){if(_0xb9c2('0x77')==typeof _0x540af9[_0xb9c2('0x7c')][_0xb9c2('0x7f')]){return _0x3b476a(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x540af9['parameters'][_0xb9c2('0x7f')][_0xb9c2('0x80')]&&_0xb9c2('0x77')==typeof _0x540af9[_0xb9c2('0x7c')]['views'][_0xb9c2('0x81')]){return _0x3b476a(new Error(_0xb9c2('0x82')));}}else if(_0x540af9[_0xb9c2('0x38')]===_0xb9c2('0x83')){if(_0xb9c2('0x77')==typeof _0x540af9[_0xb9c2('0x7c')][_0xb9c2('0x84')]){return _0x3b476a(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xb9c2('0x77')==typeof _0x540af9['parameters']['scriptPath']){return _0x3b476a(new Error(_0xb9c2('0x85')));}}else{return _0x3b476a(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x50fa70=_0x540af9['name'];var _0x5f39f8=_0x540af9[_0xb9c2('0x86')];var _0x3361cd=_0x540af9[_0xb9c2('0x38')];var _0x1a0a56=_0x540af9[_0xb9c2('0x87')]?_0x540af9['sidebar']:_0xb9c2('0x88');var _0x449732=_0x540af9[_0xb9c2('0x89')]?_0x540af9['icon']:_0xb9c2('0x8a');var _0x4f4f04='';var _0x441e6d='';var _0x151d49='';var _0x20ec14='';var _0x47340e=_0x540af9[_0xb9c2('0x7a')];if(_0x3361cd===_0xb9c2('0x7e')){if(_0xb9c2('0x77')!=typeof _0x540af9[_0xb9c2('0x7c')][_0xb9c2('0x7f')]['admin']){var _0x3d77d3=_0x540af9[_0xb9c2('0x7c')][_0xb9c2('0x7f')][_0xb9c2('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3d77d3)){_0x4f4f04=path[_0xb9c2('0x5e')]('plugins',_0x10e981,_0x23c085[0x0],_0x3d77d3);}else{_0x4f4f04=_0x3d77d3;}}else{logger[_0xb9c2('0x6e')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xb9c2('0x77')!=typeof _0x540af9[_0xb9c2('0x7c')][_0xb9c2('0x7f')][_0xb9c2('0x81')]){var _0x6ab85f=_0x540af9['parameters'][_0xb9c2('0x7f')][_0xb9c2('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x6ab85f)){_0x441e6d=path[_0xb9c2('0x5e')](_0xb9c2('0x8b'),_0x10e981,_0x23c085[0x0],_0x6ab85f);}else{_0x441e6d=_0x6ab85f;}}else{logger['info'](_0xb9c2('0x8c'));}}else if(_0x3361cd===_0xb9c2('0x83')){_0x151d49=_0x540af9[_0xb9c2('0x7c')][_0xb9c2('0x84')];_0x20ec14=_0x540af9[_0xb9c2('0x7c')][_0xb9c2('0x8d')];if(_0xb9c2('0x77')!=typeof _0x540af9['parameters'][_0xb9c2('0x7f')]){if(_0xb9c2('0x77')!=typeof _0x540af9[_0xb9c2('0x7c')][_0xb9c2('0x7f')][_0xb9c2('0x80')]){var _0x3d77d3=_0x540af9['parameters'][_0xb9c2('0x7f')][_0xb9c2('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xb9c2('0x8e')](_0x3d77d3)){_0x4f4f04=path['join'](_0xb9c2('0x8b'),_0x10e981,_0x23c085[0x0],_0x3d77d3);}else{_0x4f4f04=_0x3d77d3;}}if(_0xb9c2('0x77')!=typeof _0x540af9[_0xb9c2('0x7c')][_0xb9c2('0x7f')][_0xb9c2('0x81')]){var _0x6ab85f=_0x540af9['parameters']['views'][_0xb9c2('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xb9c2('0x8e')](_0x6ab85f)){_0x441e6d=path[_0xb9c2('0x5e')](_0xb9c2('0x8b'),_0x10e981,_0x23c085[0x0],_0x6ab85f);}else{_0x441e6d=_0x6ab85f;}}}}var _0x2c2b7f={'name':_0x50fa70,'description':_0x5f39f8,'path':path['join'](_0x10e981,_0x23c085[0x0]),'type':_0x3361cd,'sidebar':_0x1a0a56,'icon':_0x449732,'adminUrl':_0x4f4f04,'agentUrl':_0x441e6d,'scriptName':_0x151d49,'scriptPath':_0x20ec14,'version':_0x47340e};removeReferences(_0x1fc831,null);return db[_0xb9c2('0x35')][_0xb9c2('0x8f')](_0x2c2b7f)[_0xb9c2('0x29')](function(_0x140e15){var _0x14259f={'role':_0x3c9500[_0xb9c2('0x90')][_0xb9c2('0x91')],'userProfileId':_0x3c9500[_0xb9c2('0x90')]['userProfileId']};if(!_0x14259f)throw new Error(_0xb9c2('0x92'));if(_0x14259f[_0xb9c2('0x91')]===_0xb9c2('0x93')){var _0x1191c9=_0x140e15[_0xb9c2('0x2a')]({'plain':!![]});return db[_0xb9c2('0x94')][_0xb9c2('0x4e')]({'where':{'name':_0xb9c2('0x2b'),'userProfileId':_0x14259f[_0xb9c2('0x95')]},'raw':!![]})[_0xb9c2('0x29')](function(_0x1f06bb){if(_0x1f06bb&&_0x1f06bb['autoAssociation']===0x0){return db[_0xb9c2('0x2c')][_0xb9c2('0x8f')]({'name':_0x1191c9[_0xb9c2('0x31')],'resourceId':_0x1191c9['id'],'type':_0x1f06bb[_0xb9c2('0x31')],'sectionId':_0x1f06bb['id']},{})['then'](function(){return _0x140e15;});}else{return _0x140e15;}})['catch'](function(_0x14b805){logger[_0xb9c2('0x2f')](_0xb9c2('0x96'),_0x14b805);throw _0x14b805;});}return _0x140e15;})[_0xb9c2('0x29')](respondWithResult(_0x38bbe9,null))['catch'](handleError(_0x38bbe9,null));}});}catch(_0x4e42b9){_0x38bbe9[_0xb9c2('0x1f')](0x1f4)[_0xb9c2('0x32')](_0x4e42b9);}};function removeReferences(_0x2819eb,_0x4f978b){try{if(_0x2819eb){fs[_0xb9c2('0x67')](_0x2819eb);logger['info'](_0xb9c2('0x97'));}if(_0x4f978b){rimraf(_0x4f978b,function(){});logger[_0xb9c2('0x6e')](_0xb9c2('0x98'));}}catch(_0x11ac4d){logger[_0xb9c2('0x2f')](_0x11ac4d);}}exports[_0xb9c2('0x28')]=function(_0x5333bf,_0x3c7c59,_0x341ff2){return db['Plugin']['find']({'where':{'id':_0x5333bf['params']['id']}})['then'](handleEntityNotFound(_0x3c7c59,null))[_0xb9c2('0x29')](saveUpdates(_0x5333bf[_0xb9c2('0x90')],null))[_0xb9c2('0x29')](respondWithResult(_0x3c7c59,null))[_0xb9c2('0x4b')](handleError(_0x3c7c59,null));};exports[_0xb9c2('0x99')]=function(_0x31c02b,_0x5dea10,_0xf37e32){return db[_0xb9c2('0x35')][_0xb9c2('0x4e')]({'where':{'id':_0x31c02b[_0xb9c2('0x9a')]['id']}})[_0xb9c2('0x29')](function(_0xbef4c3){if(_0xbef4c3){return _0xbef4c3['destroy']();}})[_0xb9c2('0x29')](function(_0x39d993){rimraf(path[_0xb9c2('0x5e')](config[_0xb9c2('0x4f')],'server/files/plugins',path[_0xb9c2('0x5f')](_0x39d993[_0xb9c2('0x8')])),function(){});return _0x39d993;})['then'](handleEntityNotFound(_0x5dea10,null))['then'](respondWithStatusCode(_0x5dea10,null))['catch'](handleError(_0x5dea10,null));};exports[_0xb9c2('0x9b')]=function(_0x31fadd,_0x3a7435,_0x4370c7){return BPromise[_0xb9c2('0x9c')]()[_0xb9c2('0x29')](function(){if(!_0x31fadd['query'][_0xb9c2('0x8')]){throw new Error(_0xb9c2('0x9d'));}if(!_0x31fadd[_0xb9c2('0x3a')][_0xb9c2('0x9e')]){throw new Error(_0xb9c2('0x9f'));}var _0x427bee=_0x31fadd[_0xb9c2('0x3a')][_0xb9c2('0xa0')]?_0x31fadd[_0xb9c2('0x3a')][_0xb9c2('0xa0')]+':'+_0x31fadd[_0xb9c2('0x3a')][_0xb9c2('0x9e')]:'http://localhost:'+_0x31fadd[_0xb9c2('0x3a')]['port'];var _0x4334fd=_0x31fadd[_0xb9c2('0x3a')][_0xb9c2('0x25')]?_0x31fadd[_0xb9c2('0x3a')][_0xb9c2('0x25')]:!![];var _0x542e0a=_0x31fadd['query']['encoding']?_0x31fadd[_0xb9c2('0x3a')][_0xb9c2('0xa1')]:null;var _0x4c07d3={'method':_0x31fadd[_0xb9c2('0xa2')],'uri':util[_0xb9c2('0x51')](_0xb9c2('0xa3'),_0x427bee,_0x31fadd[_0xb9c2('0x3a')][_0xb9c2('0x8')]),'json':_0x4334fd,'resolveWithFullResponse':!![],'encoding':_0x542e0a,'qs':_0x31fadd[_0xb9c2('0x3a')]};if(_0x31fadd[_0xb9c2('0xa4')]){_0x4c07d3['headers']=_0x31fadd[_0xb9c2('0xa4')];if(_0x4c07d3[_0xb9c2('0xa4')]['content-length']){delete _0x4c07d3['headers'][_0xb9c2('0xa5')];}}if(_0x4c07d3[_0xb9c2('0xa4')]['content-type']){delete _0x4c07d3['headers']['content-type'];}return rp(_0x4c07d3);})[_0xb9c2('0x29')](function(_0x3fb83a){if(_0x3fb83a){_0x3a7435['set'](_0x3fb83a[_0xb9c2('0xa4')]);logger['info'](_0x3fb83a[_0xb9c2('0x90')]);if(_['endsWith'](_0x31fadd[_0xb9c2('0x3a')][_0xb9c2('0x8')],_0xb9c2('0x65'))&&_0x3fb83a[_0xb9c2('0xa6')]==0x1f4){return _0x3a7435['sendStatus'](_0x3fb83a[_0xb9c2('0xa6')]);}else{return _0x3a7435['status'](_0x3fb83a[_0xb9c2('0xa6')])[_0xb9c2('0x32')](_0x3fb83a[_0xb9c2('0x90')]);}}else{return _0x3a7435[_0xb9c2('0x2e')](0xc8);}})[_0xb9c2('0x4b')](handleError(_0x3a7435,null));};exports[_0xb9c2('0xa7')]=function(_0xfd6f3f,_0x295e2c,_0x2da5e0){return BPromise[_0xb9c2('0x9c')]()[_0xb9c2('0x29')](function(){if(!_0xfd6f3f[_0xb9c2('0x3a')][_0xb9c2('0x8')]){throw new Error(_0xb9c2('0x9d'));}if(!_0xfd6f3f[_0xb9c2('0x3a')][_0xb9c2('0x9e')]){throw new Error(_0xb9c2('0x9f'));}var _0x52a3de=_0xfd6f3f[_0xb9c2('0x3a')][_0xb9c2('0xa0')]?_0xfd6f3f['query'][_0xb9c2('0xa0')]+':'+_0xfd6f3f[_0xb9c2('0x3a')]['port']:_0xb9c2('0xa8')+_0xfd6f3f[_0xb9c2('0x3a')][_0xb9c2('0x9e')];var _0x5d7414=_0xfd6f3f[_0xb9c2('0x3a')]['json']?_0xfd6f3f['query']['json']:!![];var _0x1d194f=_0xfd6f3f['query'][_0xb9c2('0xa1')]?_0xfd6f3f[_0xb9c2('0x3a')][_0xb9c2('0xa1')]:null;var _0x15dd60={'method':_0xfd6f3f[_0xb9c2('0xa2')],'uri':util[_0xb9c2('0x51')](_0xb9c2('0xa3'),_0x52a3de,_0xfd6f3f[_0xb9c2('0x3a')][_0xb9c2('0x8')]),'json':_0x5d7414,'resolveWithFullResponse':!![],'encoding':_0x1d194f,'body':_0xfd6f3f[_0xb9c2('0x90')]};if(_0xfd6f3f[_0xb9c2('0xa4')]){_0x15dd60[_0xb9c2('0xa4')]=_0xfd6f3f['headers'];if(_0x15dd60['headers'][_0xb9c2('0xa5')]){delete _0x15dd60[_0xb9c2('0xa4')]['content-length'];}}if(_0x15dd60[_0xb9c2('0xa4')][_0xb9c2('0xa9')]){delete _0x15dd60[_0xb9c2('0xa4')][_0xb9c2('0xa9')];}return rp(_0x15dd60);})[_0xb9c2('0x29')](function(_0x13ed47){if(_0x13ed47){_0x295e2c[_0xb9c2('0x23')](_0x13ed47[_0xb9c2('0xa4')]);logger['info'](_0x13ed47[_0xb9c2('0x90')]);return _0x295e2c['status'](_0x13ed47[_0xb9c2('0xa6')])['send'](_0x13ed47[_0xb9c2('0x90')]);}else{return _0x295e2c[_0xb9c2('0x2e')](0xc8);}})[_0xb9c2('0x4b')](handleError(_0x295e2c,null));}; \ No newline at end of file +var _0xc6bf=['upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','lstatSync','isFile','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','description','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','params','delete','dirname','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','json','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','send','http://localhost:','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','jsforce','desk.js','extract-zip','archiver','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','Plugins','stack','name','index','map','Plugin','rawAttributes','type','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','length','find','download','join','root','server/files/plugins','format','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','error','Sequelize','pipe','glob','**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','%s.zip','unlinkSync','info'];(function(_0x3ecec3,_0x406637){var _0x416dd3=function(_0x55d40b){while(--_0x55d40b){_0x3ecec3['push'](_0x3ecec3['shift']());}};_0x416dd3(++_0x406637);}(_0xc6bf,0xe8));var _0xfc6b=function(_0x4322c6,_0x28f126){_0x4322c6=_0x4322c6-0x0;var _0x4e7537=_0xc6bf[_0x4322c6];return _0x4e7537;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfc6b('0x0'));var rimraf=require(_0xfc6b('0x1'));var zipdir=require(_0xfc6b('0x2'));var jsonpatch=require(_0xfc6b('0x3'));var rp=require(_0xfc6b('0x4'));var moment=require(_0xfc6b('0x5'));var BPromise=require(_0xfc6b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfc6b('0x7'));var sox=require('sox');var csv=require(_0xfc6b('0x8'));var ejs=require(_0xfc6b('0x9'));var fs=require('fs');var _=require(_0xfc6b('0xa'));var squel=require(_0xfc6b('0xb'));var crypto=require('crypto');var jsforce=require(_0xfc6b('0xc'));var deskjs=require(_0xfc6b('0xd'));var toCsv=require(_0xfc6b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0xfc6b('0xe'));var rimraf=require(_0xfc6b('0x1'));var archiver=require(_0xfc6b('0xf'));var Redis=require(_0xfc6b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfc6b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfc6b('0x12'));var config=require(_0xfc6b('0x13'));var db=require(_0xfc6b('0x14'))['db'];config[_0xfc6b('0x15')]=_[_0xfc6b('0x16')](config[_0xfc6b('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xfc6b('0x17'))(new Redis(config[_0xfc6b('0x15')]));require(_0xfc6b('0x18'))[_0xfc6b('0x19')](socket);function respondWithStatusCode(_0x78885a,_0xe24593){_0xe24593=_0xe24593||0xcc;return function(_0x5b7b3f){if(_0x5b7b3f){return _0x78885a[_0xfc6b('0x1a')](_0xe24593);}return _0x78885a[_0xfc6b('0x1b')](_0xe24593)[_0xfc6b('0x1c')]();};}function respondWithResult(_0x9e7e2e,_0x321e59){_0x321e59=_0x321e59||0xc8;return function(_0x40745b){if(_0x40745b){return _0x9e7e2e[_0xfc6b('0x1b')](_0x321e59)['json'](_0x40745b);}};}function respondWithFilteredResult(_0xde1833,_0x23dfbe){return function(_0x3aba29){if(_0x3aba29){var _0x4ee7bb=_0x3aba29['count'],_0x5b4c1c=_0x23dfbe[_0xfc6b('0x1d')],_0x53f406=_0x23dfbe[_0xfc6b('0x1d')]+_0x23dfbe[_0xfc6b('0x1e')],_0x45639d;if(_0x53f406>=_0x4ee7bb){_0x53f406=_0x4ee7bb;_0x45639d=0xc8;}else{_0x45639d=0xce;}_0xde1833['status'](_0x45639d);return _0xde1833['set'](_0xfc6b('0x1f'),_0x5b4c1c+'-'+_0x53f406+'/'+_0x4ee7bb)['json'](_0x3aba29);}return null;};}function patchUpdates(_0x2b072e){return function(_0x37b3cd){try{jsonpatch[_0xfc6b('0x20')](_0x37b3cd,_0x2b072e,!![]);}catch(_0x1f0b99){return BPromise[_0xfc6b('0x21')](_0x1f0b99);}return _0x37b3cd[_0xfc6b('0x22')]();};}function saveUpdates(_0x3b70cc,_0x2d358f){return function(_0xc7a815){if(_0xc7a815){return _0xc7a815[_0xfc6b('0x23')](_0x3b70cc)['then'](function(_0x2a6017){return _0x2a6017;});}return null;};}function removeEntity(_0x3c1f40,_0x3b5271){return function(_0x216bd9){if(_0x216bd9){return _0x216bd9[_0xfc6b('0x24')]()[_0xfc6b('0x25')](function(){var _0x3981ce=_0x216bd9[_0xfc6b('0x26')]({'plain':!![]});var _0x1088fc=_0xfc6b('0x27');return db['UserProfileResource'][_0xfc6b('0x24')]({'where':{'type':_0x1088fc,'resourceId':_0x3981ce['id']}})[_0xfc6b('0x25')](function(){return _0x216bd9;});})[_0xfc6b('0x25')](function(){_0x3c1f40[_0xfc6b('0x1b')](0xcc)[_0xfc6b('0x1c')]();});}};}function handleEntityNotFound(_0x477f75,_0x4f962e){return function(_0x3fc18b){if(!_0x3fc18b){_0x477f75[_0xfc6b('0x1a')](0x194);}return _0x3fc18b;};}function handleError(_0x24d356,_0x1c37e8){_0x1c37e8=_0x1c37e8||0x1f4;return function(_0xdfdbd7){logger['error'](_0xdfdbd7[_0xfc6b('0x28')]);if(_0xdfdbd7[_0xfc6b('0x29')]){delete _0xdfdbd7['name'];}_0x24d356['status'](_0x1c37e8)['send'](_0xdfdbd7);};}exports[_0xfc6b('0x2a')]=function(_0xabc940,_0x3d6430){var _0xa1de74={},_0xbbaed8={},_0x21d268={'count':0x0,'rows':[]};var _0xebb664=_[_0xfc6b('0x2b')](db[_0xfc6b('0x2c')][_0xfc6b('0x2d')],function(_0x5a0ed9){return{'name':_0x5a0ed9['fieldName'],'type':_0x5a0ed9[_0xfc6b('0x2e')]['key']};});_0xbbaed8['model']=_[_0xfc6b('0x2b')](_0xebb664,'name');_0xbbaed8[_0xfc6b('0x2f')]=_[_0xfc6b('0x30')](_0xabc940[_0xfc6b('0x2f')]);_0xbbaed8[_0xfc6b('0x31')]=_[_0xfc6b('0x32')](_0xbbaed8['model'],_0xbbaed8['query']);_0xa1de74[_0xfc6b('0x33')]=_['intersection'](_0xbbaed8['model'],qs[_0xfc6b('0x34')](_0xabc940['query'][_0xfc6b('0x34')]));_0xa1de74['attributes']=_0xa1de74[_0xfc6b('0x33')]['length']?_0xa1de74['attributes']:_0xbbaed8[_0xfc6b('0x35')];if(!_0xabc940[_0xfc6b('0x2f')][_0xfc6b('0x36')]('nolimit')){_0xa1de74['limit']=qs[_0xfc6b('0x1e')](_0xabc940['query'][_0xfc6b('0x1e')]);_0xa1de74['offset']=qs[_0xfc6b('0x1d')](_0xabc940['query'][_0xfc6b('0x1d')]);}_0xa1de74['order']=qs['sort'](_0xabc940['query'][_0xfc6b('0x37')]);_0xa1de74[_0xfc6b('0x38')]=qs['filters'](_[_0xfc6b('0x39')](_0xabc940[_0xfc6b('0x2f')],_0xbbaed8['filters']),_0xebb664);if(_0xabc940[_0xfc6b('0x2f')][_0xfc6b('0x3a')]){_0xa1de74[_0xfc6b('0x38')]=_[_0xfc6b('0x3b')](_0xa1de74[_0xfc6b('0x38')],{'$or':_[_0xfc6b('0x2b')](_0xebb664,function(_0x307d2c){if(_0x307d2c[_0xfc6b('0x2e')]!=='VIRTUAL'){var _0x4d48f2={};_0x4d48f2[_0x307d2c[_0xfc6b('0x29')]]={'$like':'%'+_0xabc940['query']['filter']+'%'};return _0x4d48f2;}})});}_0xa1de74=_['merge']({},_0xa1de74,_0xabc940[_0xfc6b('0x3c')]);var _0x28209e={'where':_0xa1de74['where']};return db['Plugin'][_0xfc6b('0x3d')](_0x28209e)['then'](function(_0x1d8e4f){_0x21d268[_0xfc6b('0x3d')]=_0x1d8e4f;if(_0xabc940['query'][_0xfc6b('0x3e')]){_0xa1de74[_0xfc6b('0x3f')]=[{'all':!![]}];}return db[_0xfc6b('0x2c')][_0xfc6b('0x40')](_0xa1de74);})['then'](function(_0x8a73f4){_0x21d268[_0xfc6b('0x41')]=_0x8a73f4;return _0x21d268;})['then'](respondWithFilteredResult(_0x3d6430,_0xa1de74))[_0xfc6b('0x42')](handleError(_0x3d6430,null));};exports['show']=function(_0x2935c9,_0x9cf17c){var _0x4340da={'raw':!![],'where':{'id':_0x2935c9['params']['id']}},_0x211668={};_0x211668['model']=_[_0xfc6b('0x30')](db[_0xfc6b('0x2c')][_0xfc6b('0x2d')]);_0x211668['query']=_[_0xfc6b('0x30')](_0x2935c9[_0xfc6b('0x2f')]);_0x211668[_0xfc6b('0x31')]=_[_0xfc6b('0x32')](_0x211668['model'],_0x211668[_0xfc6b('0x2f')]);_0x4340da[_0xfc6b('0x33')]=_['intersection'](_0x211668[_0xfc6b('0x35')],qs[_0xfc6b('0x34')](_0x2935c9[_0xfc6b('0x2f')]['fields']));_0x4340da['attributes']=_0x4340da[_0xfc6b('0x33')][_0xfc6b('0x43')]?_0x4340da[_0xfc6b('0x33')]:_0x211668[_0xfc6b('0x35')];if(_0x2935c9['query'][_0xfc6b('0x3e')]){_0x4340da[_0xfc6b('0x3f')]=[{'all':!![]}];}_0x4340da=_[_0xfc6b('0x3b')]({},_0x4340da,_0x2935c9['options']);return db['Plugin'][_0xfc6b('0x44')](_0x4340da)[_0xfc6b('0x25')](handleEntityNotFound(_0x9cf17c,null))['then'](respondWithResult(_0x9cf17c,null))['catch'](handleError(_0x9cf17c,null));};exports[_0xfc6b('0x45')]=function(_0x580bd7,_0x324013,_0x4dd147){return db['Plugin']['find']({'where':{'id':_0x580bd7['params']['id']},'attributes':[_0xfc6b('0x29'),_0xfc6b('0x7')],'raw':!![]})[_0xfc6b('0x25')](handleEntityNotFound(_0x324013,null))['then'](function(_0x122f44){if(_0x122f44){var _0x1cafe5=path[_0xfc6b('0x46')](config[_0xfc6b('0x47')],_0xfc6b('0x48'),util[_0xfc6b('0x49')]('%s.zip',path[_0xfc6b('0x4a')](_0x122f44[_0xfc6b('0x7')])));var _0x4e9d8a=fs[_0xfc6b('0x4b')](_0x1cafe5);var _0x175826=archiver(_0xfc6b('0x4c'),{'zlib':{'level':0x9}});_0x175826['on'](_0xfc6b('0x4d'),function(_0x4ee7ff){if(_0x4ee7ff[_0xfc6b('0x4e')]===_0xfc6b('0x4f')){logger['error'](_0x4ee7ff);}else{throw new db['Sequelize'][(_0xfc6b('0x50'))](_0xfc6b('0x51'));}});_0x175826['on'](_0xfc6b('0x52'),function(_0x42b2d1){throw new db[(_0xfc6b('0x53'))][(_0xfc6b('0x50'))](_0xfc6b('0x51'));});_0x175826[_0xfc6b('0x54')](_0x4e9d8a);_0x175826[_0xfc6b('0x55')](_0xfc6b('0x56'),{'cwd':path['join'](config['root'],_0xfc6b('0x48'),path['dirname'](_0x122f44['path'])),'ignore':[path[_0xfc6b('0x46')](path[_0xfc6b('0x4a')](_0x122f44[_0xfc6b('0x7')]),'node_modules/**/*'),path[_0xfc6b('0x46')](path[_0xfc6b('0x4a')](_0x122f44[_0xfc6b('0x7')]),_0xfc6b('0x57'))],'nodir':!![]})[_0xfc6b('0x58')]();_0x4e9d8a['on']('close',function(){if(!fs[_0xfc6b('0x59')](_0x1cafe5)){throw new db[(_0xfc6b('0x53'))][(_0xfc6b('0x50'))](_0xfc6b('0x5a'));}return _0x324013['download'](_0x1cafe5,util[_0xfc6b('0x49')](_0xfc6b('0x5b'),path['basename'](_0x122f44['path'])),function(_0xc9fcd2){if(_0xc9fcd2){throw new db[(_0xfc6b('0x53'))][(_0xfc6b('0x50'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xfc6b('0x5c')](_0x1cafe5);logger[_0xfc6b('0x5d')]('Download\x20completed');logger[_0xfc6b('0x5d')]('Temporary\x20file\x20removed');});});}return null;})[_0xfc6b('0x42')](handleError(_0x324013,null));};exports[_0xfc6b('0x5e')]=function(_0x450a9e,_0x9835ae,_0x4471e0){var _0x36aa57=path['basename'](_0x450a9e[_0xfc6b('0x5f')][_0xfc6b('0x60')],path[_0xfc6b('0x61')](_0x450a9e[_0xfc6b('0x5f')][_0xfc6b('0x60')]));var _0x50daeb=path['join'](config[_0xfc6b('0x47')],_0xfc6b('0x48'),_0x450a9e[_0xfc6b('0x5f')][_0xfc6b('0x60')]);var _0x5243d5=path['join'](config[_0xfc6b('0x47')],'server/files/plugins',_0x36aa57);logger[_0xfc6b('0x5d')](_0xfc6b('0x62'),_0x50daeb);logger['info'](_0xfc6b('0x63'),_0x5243d5);try{fs['chmodSync'](_0x50daeb,parseInt(_0xfc6b('0x64'),0x8));extract(_0x50daeb,{'dir':_0x5243d5},function(_0x3d6d38){if(_0x3d6d38){logger[_0xfc6b('0x52')](_0x3d6d38);handleError(_0x3d6d38,!![]);};var _0x24964a=fs[_0xfc6b('0x65')](_0x5243d5);if(_0x24964a[_0xfc6b('0x43')]>0x1){removeReferences(_0x50daeb,_0x5243d5);logger['error']('Invalid\x20plugin\x20structure');return _0x4471e0(new Error('Invalid\x20plugin\x20structure'));}var _0x3ad0ad=fs[_0xfc6b('0x66')](path['join'](_0x5243d5,_0x24964a[0x0]));if(_0x3ad0ad[_0xfc6b('0x67')]()){removeReferences(_0x50daeb,_0x5243d5);logger[_0xfc6b('0x52')](_0xfc6b('0x68'));return _0x4471e0(new Error(_0xfc6b('0x68')));}if(_0x3ad0ad[_0xfc6b('0x69')]()){var _0x18f127=fs[_0xfc6b('0x65')](path[_0xfc6b('0x46')](_0x5243d5,_0x24964a[0x0]));if(_0x18f127['length']===0x0){removeReferences(_0x50daeb,_0x5243d5);logger[_0xfc6b('0x52')](_0xfc6b('0x68'));return _0x4471e0(new Error(_0xfc6b('0x68')));}var _0x1fb28e=_0x18f127[_0xfc6b('0x6a')](function(_0x3cfe71){return _0x3cfe71===_0xfc6b('0x6b');});if(!_0x1fb28e){return _0x4471e0(new Error('Plugin\x20manifest\x20missing'));}var _0x2d1088=fs[_0xfc6b('0x6c')](path[_0xfc6b('0x46')](_0x5243d5,_0x24964a[0x0],_0xfc6b('0x6b')));var _0x4acbf9=JSON[_0xfc6b('0x6d')](_0x2d1088);if(_0xfc6b('0x6e')==typeof _0x4acbf9[_0xfc6b('0x29')]){return _0x4471e0(new Error(_0xfc6b('0x6f')));}if(_0xfc6b('0x6e')==typeof _0x4acbf9[_0xfc6b('0x2e')]){return _0x4471e0(new Error(_0xfc6b('0x70')));}if('undefined'==typeof _0x4acbf9[_0xfc6b('0x71')]){return _0x4471e0(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xfc6b('0x6e')==typeof _0x4acbf9[_0xfc6b('0x72')]){return _0x4471e0(new Error(_0xfc6b('0x73')));}if(_0x4acbf9[_0xfc6b('0x2e')]===_0xfc6b('0x74')){if(_0xfc6b('0x6e')==typeof _0x4acbf9[_0xfc6b('0x72')]['views']){return _0x4471e0(new Error(_0xfc6b('0x75')));}if('undefined'==typeof _0x4acbf9[_0xfc6b('0x72')][_0xfc6b('0x76')][_0xfc6b('0x77')]&&'undefined'==typeof _0x4acbf9[_0xfc6b('0x72')][_0xfc6b('0x76')][_0xfc6b('0x78')]){return _0x4471e0(new Error(_0xfc6b('0x79')));}}else if(_0x4acbf9['type']===_0xfc6b('0x7a')){if(_0xfc6b('0x6e')==typeof _0x4acbf9[_0xfc6b('0x72')][_0xfc6b('0x7b')]){return _0x4471e0(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x4acbf9[_0xfc6b('0x72')][_0xfc6b('0x7c')]){return _0x4471e0(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x4471e0(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x2e6769=_0x4acbf9[_0xfc6b('0x29')];var _0x1be68d=_0x4acbf9[_0xfc6b('0x7d')];var _0xb96349=_0x4acbf9[_0xfc6b('0x2e')];var _0x37051b=_0x4acbf9[_0xfc6b('0x7e')]?_0x4acbf9[_0xfc6b('0x7e')]:_0xfc6b('0x7f');var _0x3a82e6=_0x4acbf9['icon']?_0x4acbf9[_0xfc6b('0x80')]:_0xfc6b('0x81');var _0x51df97='';var _0x51c902='';var _0xcd711f='';var _0x11da6c='';var _0x5d1f59=_0x4acbf9[_0xfc6b('0x71')];if(_0xb96349===_0xfc6b('0x74')){if(_0xfc6b('0x6e')!=typeof _0x4acbf9['parameters'][_0xfc6b('0x76')]['admin']){var _0x5142c9=_0x4acbf9[_0xfc6b('0x72')][_0xfc6b('0x76')][_0xfc6b('0x77')];if(!/^(f|ht)tps?:\/\//i[_0xfc6b('0x82')](_0x5142c9)){_0x51df97=path[_0xfc6b('0x46')]('plugins',_0x36aa57,_0x24964a[0x0],_0x5142c9);}else{_0x51df97=_0x5142c9;}}else{logger[_0xfc6b('0x5d')](_0xfc6b('0x83'));}if(_0xfc6b('0x6e')!=typeof _0x4acbf9[_0xfc6b('0x72')][_0xfc6b('0x76')][_0xfc6b('0x78')]){var _0x30ece9=_0x4acbf9[_0xfc6b('0x72')]['views'][_0xfc6b('0x78')];if(!/^(f|ht)tps?:\/\//i[_0xfc6b('0x82')](_0x30ece9)){_0x51c902=path[_0xfc6b('0x46')](_0xfc6b('0x84'),_0x36aa57,_0x24964a[0x0],_0x30ece9);}else{_0x51c902=_0x30ece9;}}else{logger['info'](_0xfc6b('0x85'));}}else if(_0xb96349===_0xfc6b('0x7a')){_0xcd711f=_0x4acbf9[_0xfc6b('0x72')]['scriptName'];_0x11da6c=_0x4acbf9['parameters'][_0xfc6b('0x7c')];if(_0xfc6b('0x6e')!=typeof _0x4acbf9[_0xfc6b('0x72')]['views']){if(_0xfc6b('0x6e')!=typeof _0x4acbf9[_0xfc6b('0x72')]['views'][_0xfc6b('0x77')]){var _0x5142c9=_0x4acbf9[_0xfc6b('0x72')][_0xfc6b('0x76')][_0xfc6b('0x77')];if(!/^(f|ht)tps?:\/\//i[_0xfc6b('0x82')](_0x5142c9)){_0x51df97=path['join'](_0xfc6b('0x84'),_0x36aa57,_0x24964a[0x0],_0x5142c9);}else{_0x51df97=_0x5142c9;}}if('undefined'!=typeof _0x4acbf9[_0xfc6b('0x72')][_0xfc6b('0x76')][_0xfc6b('0x78')]){var _0x30ece9=_0x4acbf9[_0xfc6b('0x72')][_0xfc6b('0x76')][_0xfc6b('0x78')];if(!/^(f|ht)tps?:\/\//i['test'](_0x30ece9)){_0x51c902=path[_0xfc6b('0x46')](_0xfc6b('0x84'),_0x36aa57,_0x24964a[0x0],_0x30ece9);}else{_0x51c902=_0x30ece9;}}}}var _0x4dd0c8={'name':_0x2e6769,'description':_0x1be68d,'path':path[_0xfc6b('0x46')](_0x36aa57,_0x24964a[0x0]),'type':_0xb96349,'sidebar':_0x37051b,'icon':_0x3a82e6,'adminUrl':_0x51df97,'agentUrl':_0x51c902,'scriptName':_0xcd711f,'scriptPath':_0x11da6c,'version':_0x5d1f59};removeReferences(_0x50daeb,null);return db[_0xfc6b('0x2c')][_0xfc6b('0x86')](_0x4dd0c8)['then'](function(_0x42621b){var _0x4e017f={'role':_0x450a9e[_0xfc6b('0x87')]['role'],'userProfileId':_0x450a9e[_0xfc6b('0x87')]['userProfileId']};if(!_0x4e017f)throw new Error(_0xfc6b('0x88'));if(_0x4e017f[_0xfc6b('0x89')]===_0xfc6b('0x8a')){var _0x4823e1=_0x42621b[_0xfc6b('0x26')]({'plain':!![]});return db[_0xfc6b('0x8b')]['find']({'where':{'name':_0xfc6b('0x27'),'userProfileId':_0x4e017f['userProfileId']},'raw':!![]})['then'](function(_0x32112a){if(_0x32112a&&_0x32112a[_0xfc6b('0x8c')]===0x0){return db[_0xfc6b('0x8d')][_0xfc6b('0x86')]({'name':_0x4823e1['name'],'resourceId':_0x4823e1['id'],'type':_0x32112a[_0xfc6b('0x29')],'sectionId':_0x32112a['id']},{})[_0xfc6b('0x25')](function(){return _0x42621b;});}else{return _0x42621b;}})[_0xfc6b('0x42')](function(_0x525ee8){logger[_0xfc6b('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x525ee8);throw _0x525ee8;});}return _0x42621b;})[_0xfc6b('0x25')](respondWithResult(_0x9835ae,null))[_0xfc6b('0x42')](handleError(_0x9835ae,null));}});}catch(_0x2cec95){_0x9835ae[_0xfc6b('0x1b')](0x1f4)['send'](_0x2cec95);}};function removeReferences(_0x51f51e,_0x479dea){try{if(_0x51f51e){fs['unlinkSync'](_0x51f51e);logger[_0xfc6b('0x5d')](_0xfc6b('0x8e'));}if(_0x479dea){rimraf(_0x479dea,function(){});logger[_0xfc6b('0x5d')](_0xfc6b('0x8f'));}}catch(_0x20d99b){logger[_0xfc6b('0x52')](_0x20d99b);}}exports['update']=function(_0x50e2f3,_0x3fb5d4,_0x11d59f){return db[_0xfc6b('0x2c')][_0xfc6b('0x44')]({'where':{'id':_0x50e2f3[_0xfc6b('0x90')]['id']}})[_0xfc6b('0x25')](handleEntityNotFound(_0x3fb5d4,null))[_0xfc6b('0x25')](saveUpdates(_0x50e2f3[_0xfc6b('0x87')],null))[_0xfc6b('0x25')](respondWithResult(_0x3fb5d4,null))[_0xfc6b('0x42')](handleError(_0x3fb5d4,null));};exports[_0xfc6b('0x91')]=function(_0x35b8a8,_0x532af2,_0x368eaf){return db[_0xfc6b('0x2c')]['find']({'where':{'id':_0x35b8a8[_0xfc6b('0x90')]['id']}})[_0xfc6b('0x25')](function(_0x3809de){if(_0x3809de){return _0x3809de['destroy']();}})[_0xfc6b('0x25')](function(_0x44525d){rimraf(path[_0xfc6b('0x46')](config['root'],'server/files/plugins',path[_0xfc6b('0x92')](_0x44525d[_0xfc6b('0x7')])),function(){});return _0x44525d;})[_0xfc6b('0x25')](handleEntityNotFound(_0x532af2,null))[_0xfc6b('0x25')](respondWithStatusCode(_0x532af2,null))[_0xfc6b('0x42')](handleError(_0x532af2,null));};exports['webhookGet']=function(_0x5f5d29,_0x4504cd,_0x3948c7){return BPromise[_0xfc6b('0x93')]()['then'](function(){if(!_0x5f5d29['query'][_0xfc6b('0x7')]){throw new Error(_0xfc6b('0x94'));}if(!_0x5f5d29[_0xfc6b('0x2f')][_0xfc6b('0x95')]){throw new Error(_0xfc6b('0x96'));}var _0x14ca0a=_0x5f5d29[_0xfc6b('0x2f')][_0xfc6b('0x97')]?_0x5f5d29[_0xfc6b('0x2f')][_0xfc6b('0x97')]+':'+_0x5f5d29[_0xfc6b('0x2f')][_0xfc6b('0x95')]:'http://localhost:'+_0x5f5d29[_0xfc6b('0x2f')]['port'];var _0x270699=_0x5f5d29[_0xfc6b('0x2f')][_0xfc6b('0x98')]?_0x5f5d29['query']['json']:!![];var _0x1923e0=_0x5f5d29['query'][_0xfc6b('0x99')]?_0x5f5d29[_0xfc6b('0x2f')][_0xfc6b('0x99')]:null;var _0x231715={'method':_0x5f5d29['method'],'uri':util['format'](_0xfc6b('0x9a'),_0x14ca0a,_0x5f5d29['query'][_0xfc6b('0x7')]),'json':_0x270699,'resolveWithFullResponse':!![],'encoding':_0x1923e0,'qs':_0x5f5d29[_0xfc6b('0x2f')]};if(_0x5f5d29[_0xfc6b('0x9b')]){_0x231715[_0xfc6b('0x9b')]=_0x5f5d29[_0xfc6b('0x9b')];if(_0x231715[_0xfc6b('0x9b')][_0xfc6b('0x9c')]){delete _0x231715['headers'][_0xfc6b('0x9c')];}}if(_0x231715[_0xfc6b('0x9b')][_0xfc6b('0x9d')]){delete _0x231715[_0xfc6b('0x9b')]['content-type'];}return rp(_0x231715);})['then'](function(_0x17607a){if(_0x17607a){_0x4504cd['set'](_0x17607a[_0xfc6b('0x9b')]);logger['info'](_0x17607a[_0xfc6b('0x87')]);if(_[_0xfc6b('0x9e')](_0x5f5d29[_0xfc6b('0x2f')][_0xfc6b('0x7')],'download')&&_0x17607a[_0xfc6b('0x9f')]==0x1f4){return _0x4504cd[_0xfc6b('0x1a')](_0x17607a[_0xfc6b('0x9f')]);}else{return _0x4504cd[_0xfc6b('0x1b')](_0x17607a[_0xfc6b('0x9f')])[_0xfc6b('0xa0')](_0x17607a[_0xfc6b('0x87')]);}}else{return _0x4504cd[_0xfc6b('0x1a')](0xc8);}})[_0xfc6b('0x42')](handleError(_0x4504cd,null));};exports['webhookPost']=function(_0x900273,_0x4eabb7,_0x296112){return BPromise[_0xfc6b('0x93')]()[_0xfc6b('0x25')](function(){if(!_0x900273['query'][_0xfc6b('0x7')]){throw new Error(_0xfc6b('0x94'));}if(!_0x900273['query']['port']){throw new Error(_0xfc6b('0x96'));}var _0x5d0a68=_0x900273[_0xfc6b('0x2f')][_0xfc6b('0x97')]?_0x900273[_0xfc6b('0x2f')][_0xfc6b('0x97')]+':'+_0x900273[_0xfc6b('0x2f')][_0xfc6b('0x95')]:_0xfc6b('0xa1')+_0x900273[_0xfc6b('0x2f')][_0xfc6b('0x95')];var _0xb0b1f4=_0x900273['query'][_0xfc6b('0x98')]?_0x900273[_0xfc6b('0x2f')][_0xfc6b('0x98')]:!![];var _0x23edbe=_0x900273['query'][_0xfc6b('0x99')]?_0x900273[_0xfc6b('0x2f')][_0xfc6b('0x99')]:null;var _0x37851b={'method':_0x900273['method'],'uri':util[_0xfc6b('0x49')](_0xfc6b('0x9a'),_0x5d0a68,_0x900273[_0xfc6b('0x2f')][_0xfc6b('0x7')]),'json':_0xb0b1f4,'resolveWithFullResponse':!![],'encoding':_0x23edbe,'body':_0x900273[_0xfc6b('0x87')]};if(_0x900273[_0xfc6b('0x9b')]){_0x37851b[_0xfc6b('0x9b')]=_0x900273[_0xfc6b('0x9b')];if(_0x37851b[_0xfc6b('0x9b')]['content-length']){delete _0x37851b[_0xfc6b('0x9b')][_0xfc6b('0x9c')];}}if(_0x37851b[_0xfc6b('0x9b')][_0xfc6b('0x9d')]){delete _0x37851b['headers'][_0xfc6b('0x9d')];}return rp(_0x37851b);})[_0xfc6b('0x25')](function(_0x5cdfc7){if(_0x5cdfc7){_0x4eabb7[_0xfc6b('0xa2')](_0x5cdfc7[_0xfc6b('0x9b')]);logger[_0xfc6b('0x5d')](_0x5cdfc7[_0xfc6b('0x87')]);return _0x4eabb7[_0xfc6b('0x1b')](_0x5cdfc7[_0xfc6b('0x9f')])[_0xfc6b('0xa0')](_0x5cdfc7[_0xfc6b('0x87')]);}else{return _0x4eabb7[_0xfc6b('0x1a')](0xc8);}})['catch'](handleError(_0x4eabb7,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 0332cdd..13708d4 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 _0xf4f4=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x58b9ad,_0x191729){var _0x5c0da1=function(_0xc1c856){while(--_0xc1c856){_0x58b9ad['push'](_0x58b9ad['shift']());}};_0x5c0da1(++_0x191729);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x2896e8,_0x2f1432){_0x2896e8=_0x2896e8-0x0;var _0x10c308=_0xf4f4[_0x2896e8];return _0x10c308;};'use strict';var EventEmitter=require(_0x4f4f('0x0'));var Plugin=require(_0x4f4f('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x4f4f('0x2')](0x0);var events={'afterCreate':_0x4f4f('0x3'),'afterUpdate':_0x4f4f('0x4'),'afterDestroy':_0x4f4f('0x5')};function emitEvent(_0x228fcf){return function(_0x510b24,_0x5a752b,_0x593952){PluginEvents[_0x4f4f('0x6')](_0x228fcf+':'+_0x510b24['id'],_0x510b24);PluginEvents[_0x4f4f('0x6')](_0x228fcf,_0x510b24);_0x593952(null);};}for(var e in events){if(events[_0x4f4f('0x7')](e)){var event=events[e];Plugin[_0x4f4f('0x8')](e,emitEvent(event));}}module[_0x4f4f('0x9')]=PluginEvents; \ No newline at end of file +var _0x7880=['../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x420bdd,_0x2b12ec){var _0x391979=function(_0x3a55c4){while(--_0x3a55c4){_0x420bdd['push'](_0x420bdd['shift']());}};_0x391979(++_0x2b12ec);}(_0x7880,0x1f4));var _0x0788=function(_0x23785c,_0x1c6e72){_0x23785c=_0x23785c-0x0;var _0x2dc080=_0x7880[_0x23785c];return _0x2dc080;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x0788('0x0'))['db'][_0x0788('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x0788('0x2')](0x0);var events={'afterCreate':_0x0788('0x3'),'afterUpdate':_0x0788('0x4'),'afterDestroy':_0x0788('0x5')};function emitEvent(_0x5c29f7){return function(_0x3925a6,_0x1e0814,_0x317885){PluginEvents[_0x0788('0x6')](_0x5c29f7+':'+_0x3925a6['id'],_0x3925a6);PluginEvents[_0x0788('0x6')](_0x5c29f7,_0x3925a6);_0x317885(null);};}for(var e in events){if(events[_0x0788('0x7')](e)){var event=events[e];Plugin[_0x0788('0x8')](e,emitEvent(event));}}module[_0x0788('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 b2fd02a..bdad68e 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 _0xbd50=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','Plugin','plugins','lodash'];(function(_0x2241ad,_0x3fa404){var _0x3fe045=function(_0x4cee37){while(--_0x4cee37){_0x2241ad['push'](_0x2241ad['shift']());}};_0x3fe045(++_0x3fa404);}(_0xbd50,0x196));var _0x0bd5=function(_0x1ef2fc,_0x228960){_0x1ef2fc=_0x1ef2fc-0x0;var _0x5e0cfa=_0xbd50[_0x1ef2fc];return _0x5e0cfa;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var logger=require(_0x0bd5('0x2'))('api');var moment=require(_0x0bd5('0x3'));var BPromise=require(_0x0bd5('0x4'));var rp=require(_0x0bd5('0x5'));var fs=require('fs');var path=require(_0x0bd5('0x6'));var rimraf=require(_0x0bd5('0x7'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module['exports']=function(_0x376024,_0x2ef1d0){return _0x376024[_0x0bd5('0x8')](_0x0bd5('0x9'),attributes,{'tableName':_0x0bd5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','plugins','lodash','util','api'];(function(_0x5a882b,_0x1a0ed7){var _0x1652de=function(_0x13748c){while(--_0x13748c){_0x5a882b['push'](_0x5a882b['shift']());}};_0x1652de(++_0x1a0ed7);}(_0xa41a,0x6b));var _0xaa41=function(_0x1b8903,_0x1f199f){_0x1b8903=_0x1b8903-0x0;var _0x5e9c98=_0xa41a[_0x1b8903];return _0x5e9c98;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('Plugin',attributes,{'tableName':_0xaa41('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 1022bf8..7a37681 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 _0xdf71=['catch','CreatePlugin','Plugin','create','body','options','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','result'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xdf71,0x1ab));var _0x1df7=function(_0x1863fb,_0x3304d3){_0x1863fb=_0x1863fb-0x0;var _0x3c7735=_0xdf71[_0x1863fb];return _0x3c7735;};'use strict';var _=require(_0x1df7('0x0'));var util=require(_0x1df7('0x1'));var moment=require(_0x1df7('0x2'));var BPromise=require(_0x1df7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1df7('0x4'));var db=require(_0x1df7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x1df7('0x6')]=_[_0x1df7('0x7')](config[_0x1df7('0x6')],{'host':_0x1df7('0x8'),'port':0x18eb});var socket=require(_0x1df7('0x9'))(new Redis(config[_0x1df7('0x6')]));require(_0x1df7('0xa'))[_0x1df7('0xb')](socket);function respondWithRpcPromise(_0x46af2b,_0x585c02,_0x5bcac8){return new BPromise(function(_0x32a8f3,_0x1187a1){return client[_0x1df7('0xc')](_0x46af2b,_0x5bcac8)[_0x1df7('0xd')](function(_0x175260){logger[_0x1df7('0xe')]('Plugin,\x20%s,\x20%s',_0x585c02,_0x1df7('0xf'));logger['debug'](_0x1df7('0x10'),_0x585c02,'request\x20sent',JSON[_0x1df7('0x11')](_0x175260));if(_0x175260[_0x1df7('0x12')]){if(_0x175260[_0x1df7('0x12')][_0x1df7('0x13')]===0x1f4){logger['error'](_0x1df7('0x14'),_0x585c02,_0x175260[_0x1df7('0x12')][_0x1df7('0x15')]);return _0x1187a1(_0x175260['error'][_0x1df7('0x15')]);}logger[_0x1df7('0x12')]('Plugin,\x20%s,\x20%s',_0x585c02,_0x175260['error'][_0x1df7('0x15')]);return _0x32a8f3(_0x175260[_0x1df7('0x12')][_0x1df7('0x15')]);}else{logger[_0x1df7('0xe')](_0x1df7('0x14'),_0x585c02,'request\x20sent');_0x32a8f3(_0x175260[_0x1df7('0x16')][_0x1df7('0x15')]);}})[_0x1df7('0x17')](function(_0x45f305){logger['error'](_0x1df7('0x14'),_0x585c02,_0x45f305);_0x1187a1(_0x45f305);});});}exports[_0x1df7('0x18')]=function(_0x3791e7){var _0x126d05=this;return new Promise(function(_0x5c4be4,_0x54dc2c){return db[_0x1df7('0x19')][_0x1df7('0x1a')](_0x3791e7[_0x1df7('0x1b')],{'raw':_0x3791e7[_0x1df7('0x1c')]?_0x3791e7[_0x1df7('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x1df7('0xd')](function(_0x4cfee5){logger[_0x1df7('0xe')](_0x1df7('0x18'),_0x3791e7);logger[_0x1df7('0x1d')]('CreatePlugin',_0x3791e7,JSON[_0x1df7('0x11')](_0x4cfee5));_0x5c4be4(_0x4cfee5);})[_0x1df7('0x17')](function(_0x1a7aff){logger[_0x1df7('0x12')](_0x1df7('0x18'),_0x1a7aff[_0x1df7('0x15')],_0x3791e7);_0x54dc2c(_0x126d05[_0x1df7('0x12')](0x1f4,_0x1a7aff[_0x1df7('0x15')]));});});}; \ No newline at end of file +var _0x5002=['debug','error','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','then','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent'];(function(_0x26ffba,_0x35c835){var _0x377619=function(_0x55a357){while(--_0x55a357){_0x26ffba['push'](_0x26ffba['shift']());}};_0x377619(++_0x35c835);}(_0x5002,0x16d));var _0x2500=function(_0x3e3255,_0x485196){_0x3e3255=_0x3e3255-0x0;var _0x57368e=_0x5002[_0x3e3255];return _0x57368e;};'use strict';var _=require('lodash');var util=require(_0x2500('0x0'));var moment=require(_0x2500('0x1'));var BPromise=require('bluebird');var rs=require(_0x2500('0x2'));var fs=require('fs');var Redis=require(_0x2500('0x3'));var db=require(_0x2500('0x4'))['db'];var utils=require(_0x2500('0x5'));var logger=require('../../config/logger')(_0x2500('0x6'));var config=require(_0x2500('0x7'));var jayson=require(_0x2500('0x8'));var client=jayson[_0x2500('0x9')][_0x2500('0xa')]({'port':0x232a});config[_0x2500('0xb')]=_[_0x2500('0xc')](config['redis'],{'host':_0x2500('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./plugin.socket')[_0x2500('0xe')](socket);function respondWithRpcPromise(_0x4da661,_0x167314,_0x52b3c9){return new BPromise(function(_0x26f1ab,_0x559d7d){return client[_0x2500('0xf')](_0x4da661,_0x52b3c9)['then'](function(_0x1aee3f){logger[_0x2500('0x10')](_0x2500('0x11'),_0x167314,_0x2500('0x12'));logger[_0x2500('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0x167314,'request\x20sent',JSON['stringify'](_0x1aee3f));if(_0x1aee3f[_0x2500('0x14')]){if(_0x1aee3f[_0x2500('0x14')]['code']===0x1f4){logger['error'](_0x2500('0x11'),_0x167314,_0x1aee3f[_0x2500('0x14')][_0x2500('0x15')]);return _0x559d7d(_0x1aee3f[_0x2500('0x14')][_0x2500('0x15')]);}logger['error'](_0x2500('0x11'),_0x167314,_0x1aee3f['error']['message']);return _0x26f1ab(_0x1aee3f['error'][_0x2500('0x15')]);}else{logger[_0x2500('0x10')](_0x2500('0x11'),_0x167314,_0x2500('0x12'));_0x26f1ab(_0x1aee3f[_0x2500('0x16')][_0x2500('0x15')]);}})[_0x2500('0x17')](function(_0x21279a){logger[_0x2500('0x14')](_0x2500('0x11'),_0x167314,_0x21279a);_0x559d7d(_0x21279a);});});}exports[_0x2500('0x18')]=function(_0x27fa27){var _0x4eb295=this;return new Promise(function(_0x3d2532,_0x18c446){return db[_0x2500('0x19')][_0x2500('0x1a')](_0x27fa27[_0x2500('0x1b')],{'raw':_0x27fa27['options']?_0x27fa27[_0x2500('0x1c')][_0x2500('0x1d')]===undefined?!![]:![]:!![]})[_0x2500('0x1e')](function(_0x2a7413){logger[_0x2500('0x10')](_0x2500('0x18'),_0x27fa27);logger['debug'](_0x2500('0x18'),_0x27fa27,JSON[_0x2500('0x1f')](_0x2a7413));_0x3d2532(_0x2a7413);})[_0x2500('0x17')](function(_0x189b6d){logger['error'](_0x2500('0x18'),_0x189b6d[_0x2500('0x15')],_0x27fa27);_0x18c446(_0x4eb295[_0x2500('0x14')](0x1f4,_0x189b6d[_0x2500('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index a36ca16..0401969 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 _0x8fda=['remove','update','emit','removeListener','register','length','plugin:','./plugin.events','save'];(function(_0x9a7424,_0x1af819){var _0x353c4e=function(_0x4360b9){while(--_0x4360b9){_0x9a7424['push'](_0x9a7424['shift']());}};_0x353c4e(++_0x1af819);}(_0x8fda,0xd6));var _0xa8fd=function(_0x3a7036,_0x4de402){_0x3a7036=_0x3a7036-0x0;var _0x4eae54=_0x8fda[_0x3a7036];return _0x4eae54;};'use strict';var PluginEvents=require(_0xa8fd('0x0'));var events=[_0xa8fd('0x1'),_0xa8fd('0x2'),_0xa8fd('0x3')];function createListener(_0x2b75bc,_0x2b7efa){return function(_0x5f355b){_0x2b7efa[_0xa8fd('0x4')](_0x2b75bc,_0x5f355b);};}function removeListener(_0x5aa106,_0x3ad001){return function(){PluginEvents[_0xa8fd('0x5')](_0x5aa106,_0x3ad001);};}exports[_0xa8fd('0x6')]=function(_0x55f6c8){for(var _0x372fd5=0x0,_0x4d0330=events[_0xa8fd('0x7')];_0x372fd5<_0x4d0330;_0x372fd5++){var _0x1cc222=events[_0x372fd5];var _0x3941d2=createListener(_0xa8fd('0x8')+_0x1cc222,_0x55f6c8);PluginEvents['on'](_0x1cc222,_0x3941d2);}}; \ No newline at end of file +var _0x53eb=['removeListener','register','length','plugin:','./plugin.events','save','emit'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x53eb,0x115));var _0xb53e=function(_0x2428d9,_0x1396a0){_0x2428d9=_0x2428d9-0x0;var _0x9bbda=_0x53eb[_0x2428d9];return _0x9bbda;};'use strict';var PluginEvents=require(_0xb53e('0x0'));var events=[_0xb53e('0x1'),'remove','update'];function createListener(_0x179328,_0x4f09fe){return function(_0x28228f){_0x4f09fe[_0xb53e('0x2')](_0x179328,_0x28228f);};}function removeListener(_0x4ffb02,_0x4058b4){return function(){PluginEvents[_0xb53e('0x3')](_0x4ffb02,_0x4058b4);};}exports[_0xb53e('0x4')]=function(_0x4aeee5){for(var _0x144fde=0x0,_0x3a116b=events[_0xb53e('0x5')];_0x144fde<_0x3a116b;_0x144fde++){var _0x26633f=events[_0x144fde];var _0x3aa191=createListener(_0xb53e('0x6')+_0x26633f,_0x4aeee5);PluginEvents['on'](_0x26633f,_0x3aa191);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index a3e98a4..4f38433 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 _0xa852=['Router','../../components/auth/service','./pm2.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports'];(function(_0x11be9f,_0x4d3a1e){var _0x21b918=function(_0x49bae6){while(--_0x49bae6){_0x11be9f['push'](_0x11be9f['shift']());}};_0x21b918(++_0x4d3a1e);}(_0xa852,0x118));var _0x2a85=function(_0xe17c5c,_0x410d54){_0xe17c5c=_0xe17c5c-0x0;var _0x50b77d=_0xa852[_0xe17c5c];return _0x50b77d;};'use strict';var express=require('express');var router=express[_0x2a85('0x0')]();var auth=require(_0x2a85('0x1'));var controller=require(_0x2a85('0x2'));router[_0x2a85('0x3')]('/',auth['isAuthenticated'](),controller[_0x2a85('0x4')]);router[_0x2a85('0x3')](_0x2a85('0x5'),auth[_0x2a85('0x6')](),controller[_0x2a85('0x7')]);router[_0x2a85('0x8')]('/',auth[_0x2a85('0x6')](),controller['create']);router[_0x2a85('0x9')](_0x2a85('0x5'),auth[_0x2a85('0x6')](),controller[_0x2a85('0xa')]);router[_0x2a85('0xb')](_0x2a85('0x5'),auth[_0x2a85('0x6')](),controller[_0x2a85('0xc')]);module[_0x2a85('0xd')]=router; \ No newline at end of file +var _0x27e4=['destroy','exports','express','Router','../../components/auth/service','./pm2.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x3a780f,_0x3adb71){var _0x128fce=function(_0x54854c){while(--_0x54854c){_0x3a780f['push'](_0x3a780f['shift']());}};_0x128fce(++_0x3adb71);}(_0x27e4,0x152));var _0x427e=function(_0x2637a2,_0x51c25e){_0x2637a2=_0x2637a2-0x0;var _0x2efbef=_0x27e4[_0x2637a2];return _0x2efbef;};'use strict';var express=require(_0x427e('0x0'));var router=express[_0x427e('0x1')]();var auth=require(_0x427e('0x2'));var controller=require(_0x427e('0x3'));router[_0x427e('0x4')]('/',auth['isAuthenticated'](),controller[_0x427e('0x5')]);router[_0x427e('0x4')](_0x427e('0x6'),auth[_0x427e('0x7')](),controller[_0x427e('0x8')]);router[_0x427e('0x9')]('/',auth['isAuthenticated'](),controller[_0x427e('0xa')]);router[_0x427e('0xb')](_0x427e('0x6'),auth['isAuthenticated'](),controller[_0x427e('0xc')]);router[_0x427e('0xd')](_0x427e('0x6'),auth[_0x427e('0x7')](),controller[_0x427e('0xe')]);module[_0x427e('0xf')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 773be15..159b623 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 _0x5578=['api','path','child_process','exec','sendStatus','status','json','stack','name','info','express','motion2','length','then','catch','show','describe','params','create','body','script','cwd','chdir','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','delete','Unknown\x20id','lodash','../../config/pm2'];(function(_0x217859,_0x5b68a8){var _0x4edb32=function(_0x5ce413){while(--_0x5ce413){_0x217859['push'](_0x217859['shift']());}};_0x4edb32(++_0x5b68a8);}(_0x5578,0x67));var _0x8557=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0x5578[_0x1bf809];return _0x1caa4e;};'use strict';var _=require(_0x8557('0x0'));var pm2=require(_0x8557('0x1'));var logger=require('../../config/logger')(_0x8557('0x2'));var path=require(_0x8557('0x3'));var exec=require(_0x8557('0x4'))[_0x8557('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x55cc92,_0x23fc25){return function(_0x343bf1){if(!_0x343bf1){_0x55cc92[_0x8557('0x6')](0x194);;}return _0x343bf1;};}function respondWithResult(_0x9c9297,_0x58a997){_0x58a997=_0x58a997||0xc8;return function(_0x56f81a){if(_0x56f81a){return _0x9c9297[_0x8557('0x7')](_0x58a997)[_0x8557('0x8')](_0x56f81a);}return null;};}function handleError(_0x5e95e5,_0x35d337){_0x35d337=_0x35d337||0x1f4;return function(_0x13cbcc){logger['error'](_0x13cbcc[_0x8557('0x9')]);if(_0x13cbcc[_0x8557('0xa')]){delete _0x13cbcc['name'];}_0x5e95e5[_0x8557('0x7')](_0x35d337)['send'](_0x13cbcc);};}function execChildProcess(){return new BPromise(function(_0x1eca6e,_0x223700){exec('npm\x20install',function(_0x3a1a7e,_0x5dfbc6,_0x33384c){logger[_0x8557('0xb')](_0x5dfbc6);logger[_0x8557('0xb')](_0x33384c);if(_0x3a1a7e){logger['error'](_0x3a1a7e);return _0x223700(_0x3a1a7e);}return _0x1eca6e(_0x5dfbc6);});});}exports['index']=function(_0x2071f6,_0x3ae9e6){return pm2['list']()['then'](function(_0x4b2efe){if(_0x4b2efe){var _0x1e2c99=_['reject'](_0x4b2efe,function(_0x84b267){return _0x84b267['name']===_0x8557('0xc')||_0x84b267[_0x8557('0xa')]===_0x8557('0xd');});return{'rows':_0x1e2c99,'count':_0x1e2c99[_0x8557('0xe')]};}return null;})[_0x8557('0xf')](respondWithResult(_0x3ae9e6,null))[_0x8557('0x10')](handleError(_0x3ae9e6,null));};exports[_0x8557('0x11')]=function(_0x34cb4c,_0x108653){return pm2[_0x8557('0x12')](_0x34cb4c[_0x8557('0x13')]['id'])[_0x8557('0xf')](respondWithResult(_0x108653,null))['then'](handleEntityNotFound(_0x108653,null))[_0x8557('0x10')](handleError(_0x108653,null));};exports[_0x8557('0x14')]=function(_0x2bf594,_0x5768ef){if(_0x2bf594['body'][_0x8557('0xa')]&&_0x2bf594[_0x8557('0x15')][_0x8557('0x16')]){var _0x33fa08=path['join'](__dirname,'../../files/plugins',_0x2bf594[_0x8557('0x15')][_0x8557('0x16')]);var _0x1259dc=process[_0x8557('0x17')]();process[_0x8557('0x18')](path[_0x8557('0x19')](_0x33fa08));return execChildProcess()[_0x8557('0xf')](function(_0x41da57){process[_0x8557('0x18')](_0x1259dc);return pm2[_0x8557('0x1a')]({'name':_0x2bf594['body'][_0x8557('0xa')],'script':_0x33fa08});})[_0x8557('0xf')](function(_0x3116b0){pm2[_0x8557('0x1b')]();return _0x3116b0[0x0];})[_0x8557('0xf')](respondWithResult(_0x5768ef,0xc9))[_0x8557('0x10')](handleError(_0x5768ef,null));}else{return _0x5768ef[_0x8557('0x7')](0x1f4)[_0x8557('0x1c')]({'message':_0x8557('0x1d')});}};exports[_0x8557('0x1e')]=function(_0x184735,_0x35a994){if(_0x184735['body']['id']){delete _0x184735['body']['id'];}var _0x414037={'online':_0x8557('0x1f'),'stopped':'stop'};if(_0x414037[_0x8557('0x20')](_0x184735[_0x8557('0x15')][_0x8557('0x7')])){return pm2[_0x414037[_0x184735['body'][_0x8557('0x7')]]](_0x184735[_0x8557('0x13')]['id'])[_0x8557('0xf')](respondWithResult(_0x35a994,0xc8))[_0x8557('0x10')](handleError(_0x35a994,null));}else{return _0x35a994[_0x8557('0x7')](0x1f4)[_0x8557('0x1c')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x23c57a,_0xce24a5){if(_0x23c57a[_0x8557('0x15')]['id']){delete _0x23c57a[_0x8557('0x15')]['id'];}if(_0x23c57a[_0x8557('0x13')]['id']){return pm2[_0x8557('0x21')](_0x23c57a[_0x8557('0x13')]['id'])[_0x8557('0xf')](function(_0x2759bd){pm2[_0x8557('0x1b')]();return _0x2759bd[0x0];})['then'](respondWithResult(_0xce24a5,null))[_0x8557('0x10')](handleError(_0xce24a5,null));}else{return _0xce24a5[_0x8557('0x7')](0x1f4)[_0x8557('0x1c')]({'message':_0x8557('0x22')});}}; \ No newline at end of file +var _0x9f59=['lodash','../../config/pm2','../../config/logger','child_process','sendStatus','status','json','error','stack','name','send','npm\x20install','info','list','then','express','motion2','catch','show','describe','params','create','body','script','join','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','delete','Unknown\x20id'];(function(_0x3100ef,_0x3d2ca9){var _0x32c8c5=function(_0x4809fa){while(--_0x4809fa){_0x3100ef['push'](_0x3100ef['shift']());}};_0x32c8c5(++_0x3d2ca9);}(_0x9f59,0xbe));var _0x99f5=function(_0x5c83e8,_0x21ae51){_0x5c83e8=_0x5c83e8-0x0;var _0x15fd12=_0x9f59[_0x5c83e8];return _0x15fd12;};'use strict';var _=require(_0x99f5('0x0'));var pm2=require(_0x99f5('0x1'));var logger=require(_0x99f5('0x2'))('api');var path=require('path');var exec=require(_0x99f5('0x3'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x2260f6,_0x27a021){return function(_0x5950bb){if(!_0x5950bb){_0x2260f6[_0x99f5('0x4')](0x194);;}return _0x5950bb;};}function respondWithResult(_0x33b7b6,_0x27a160){_0x27a160=_0x27a160||0xc8;return function(_0x325cea){if(_0x325cea){return _0x33b7b6[_0x99f5('0x5')](_0x27a160)[_0x99f5('0x6')](_0x325cea);}return null;};}function handleError(_0x132b90,_0x5f59b7){_0x5f59b7=_0x5f59b7||0x1f4;return function(_0x389e26){logger[_0x99f5('0x7')](_0x389e26[_0x99f5('0x8')]);if(_0x389e26[_0x99f5('0x9')]){delete _0x389e26[_0x99f5('0x9')];}_0x132b90[_0x99f5('0x5')](_0x5f59b7)[_0x99f5('0xa')](_0x389e26);};}function execChildProcess(){return new BPromise(function(_0x486bc8,_0x418b1d){exec(_0x99f5('0xb'),function(_0x2067db,_0x302a96,_0x58c572){logger[_0x99f5('0xc')](_0x302a96);logger[_0x99f5('0xc')](_0x58c572);if(_0x2067db){logger[_0x99f5('0x7')](_0x2067db);return _0x418b1d(_0x2067db);}return _0x486bc8(_0x302a96);});});}exports['index']=function(_0x20b476,_0x50766a){return pm2[_0x99f5('0xd')]()[_0x99f5('0xe')](function(_0x2e9159){if(_0x2e9159){var _0x374dfb=_['reject'](_0x2e9159,function(_0x51830e){return _0x51830e['name']===_0x99f5('0xf')||_0x51830e[_0x99f5('0x9')]===_0x99f5('0x10');});return{'rows':_0x374dfb,'count':_0x374dfb['length']};}return null;})[_0x99f5('0xe')](respondWithResult(_0x50766a,null))[_0x99f5('0x11')](handleError(_0x50766a,null));};exports[_0x99f5('0x12')]=function(_0x4eed2a,_0x2cc600){return pm2[_0x99f5('0x13')](_0x4eed2a[_0x99f5('0x14')]['id'])[_0x99f5('0xe')](respondWithResult(_0x2cc600,null))[_0x99f5('0xe')](handleEntityNotFound(_0x2cc600,null))[_0x99f5('0x11')](handleError(_0x2cc600,null));};exports[_0x99f5('0x15')]=function(_0x345e02,_0x333c7a){if(_0x345e02[_0x99f5('0x16')][_0x99f5('0x9')]&&_0x345e02['body'][_0x99f5('0x17')]){var _0x4cc95a=path[_0x99f5('0x18')](__dirname,'../../files/plugins',_0x345e02[_0x99f5('0x16')][_0x99f5('0x17')]);var _0x19b62e=process[_0x99f5('0x19')]();process[_0x99f5('0x1a')](path[_0x99f5('0x1b')](_0x4cc95a));return execChildProcess()[_0x99f5('0xe')](function(_0xd2892d){process[_0x99f5('0x1a')](_0x19b62e);return pm2[_0x99f5('0x1c')]({'name':_0x345e02['body']['name'],'script':_0x4cc95a});})[_0x99f5('0xe')](function(_0x1a0710){pm2[_0x99f5('0x1d')]();return _0x1a0710[0x0];})[_0x99f5('0xe')](respondWithResult(_0x333c7a,0xc9))[_0x99f5('0x11')](handleError(_0x333c7a,null));}else{return _0x333c7a[_0x99f5('0x5')](0x1f4)['send']({'message':_0x99f5('0x1e')});}};exports[_0x99f5('0x1f')]=function(_0x55cdd4,_0x521c58){if(_0x55cdd4[_0x99f5('0x16')]['id']){delete _0x55cdd4['body']['id'];}var _0x3de63c={'online':_0x99f5('0x20'),'stopped':_0x99f5('0x21')};if(_0x3de63c[_0x99f5('0x22')](_0x55cdd4[_0x99f5('0x16')][_0x99f5('0x5')])){return pm2[_0x3de63c[_0x55cdd4['body'][_0x99f5('0x5')]]](_0x55cdd4['params']['id'])['then'](respondWithResult(_0x521c58,0xc8))[_0x99f5('0x11')](handleError(_0x521c58,null));}else{return _0x521c58['status'](0x1f4)[_0x99f5('0xa')]({'message':_0x99f5('0x23')});}};exports['destroy']=function(_0x35097c,_0x4868ca){if(_0x35097c[_0x99f5('0x16')]['id']){delete _0x35097c[_0x99f5('0x16')]['id'];}if(_0x35097c['params']['id']){return pm2[_0x99f5('0x24')](_0x35097c[_0x99f5('0x14')]['id'])['then'](function(_0x50f2b0){pm2[_0x99f5('0x1d')]();return _0x50f2b0[0x0];})['then'](respondWithResult(_0x4868ca,null))[_0x99f5('0x11')](handleError(_0x4868ca,null));}else{return _0x4868ca['status'](0x1f4)[_0x99f5('0xa')]({'message':_0x99f5('0x25')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index dff5e79..b5ca4e2 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 _0x8bcc=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x3d9b04,_0x1e851a){var _0x557936=function(_0x3bf3ae){while(--_0x3bf3ae){_0x3d9b04['push'](_0x3d9b04['shift']());}};_0x557936(++_0x1e851a);}(_0x8bcc,0xaa));var _0xc8bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bcc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc8bc('0x0'));var util=require(_0xc8bc('0x1'));var path=require(_0xc8bc('0x2'));var timeout=require(_0xc8bc('0x3'));var express=require(_0xc8bc('0x4'));var router=express[_0xc8bc('0x5')]();var auth=require(_0xc8bc('0x6'));var interaction=require(_0xc8bc('0x7'));var config=require(_0xc8bc('0x8'));module[_0xc8bc('0x9')]=router; \ No newline at end of file +var _0x895d=['../../config/environment','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x895d,0xd9));var _0xd895=function(_0x4c69f9,_0x3e85db){_0x4c69f9=_0x4c69f9-0x0;var _0x1519f4=_0x895d[_0x4c69f9];return _0x1519f4;};'use strict';var multer=require(_0xd895('0x0'));var util=require(_0xd895('0x1'));var path=require(_0xd895('0x2'));var timeout=require(_0xd895('0x3'));var express=require(_0xd895('0x4'));var router=express[_0xd895('0x5')]();var auth=require(_0xd895('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd895('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 24e6609..c6aebce 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 _0xfb4a=['sequelize','exports','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb4a,0x11c));var _0xafb4=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0xfb4a[_0x836465];return _0x2150ea;};'use strict';var Sequelize=require(_0xafb4('0x0'));module[_0xafb4('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xafb4('0x2')]},'scheduledat':{'type':Sequelize[_0xafb4('0x3')]},'uniqueid':{'type':Sequelize[_0xafb4('0x2')]},'starttime':{'type':Sequelize[_0xafb4('0x3')]},'responsetime':{'type':Sequelize[_0xafb4('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xafb4('0x2')]},'campaigntype':{'type':Sequelize[_0xafb4('0x2')]},'membername':{'type':Sequelize[_0xafb4('0x2')]}}; \ No newline at end of file +var _0x2637=['STRING','DATE','INTEGER'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x2637,0x1f4));var _0x7263=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x2637[_0x1762b4];return _0x29beda;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x7263('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x7263('0x1')]},'scheduledat':{'type':Sequelize[_0x7263('0x2')]},'uniqueid':{'type':Sequelize[_0x7263('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x7263('0x2')]},'ringtime':{'type':Sequelize[_0x7263('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x7263('0x1')]},'campaigntype':{'type':Sequelize[_0x7263('0x1')]},'membername':{'type':Sequelize[_0x7263('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index b63aa66..f5ae4c4 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 _0x95e8=['ReportAgentPreview','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define'];(function(_0x4b8938,_0x1e8d85){var _0x196951=function(_0x560dac){while(--_0x560dac){_0x4b8938['push'](_0x4b8938['shift']());}};_0x196951(++_0x1e8d85);}(_0x95e8,0x156));var _0x895e=function(_0x6bb0a0,_0x468b8f){_0x6bb0a0=_0x6bb0a0-0x0;var _0x19dbc5=_0x95e8[_0x6bb0a0];return _0x19dbc5;};'use strict';var _=require('lodash');var util=require(_0x895e('0x0'));var logger=require(_0x895e('0x1'))('api');var moment=require(_0x895e('0x2'));var BPromise=require(_0x895e('0x3'));var rp=require(_0x895e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x895e('0x5'));var config=require(_0x895e('0x6'));var attributes=require(_0x895e('0x7'));module[_0x895e('0x8')]=function(_0x4d7121,_0x23b233){return _0x4d7121[_0x895e('0x9')](_0x895e('0xa'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0db=['rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb0db,0x180));var _0xbb0d=function(_0x5de248,_0x5ed2fa){_0x5de248=_0x5de248-0x0;var _0x264018=_0xb0db[_0x5de248];return _0x264018;};'use strict';var _=require(_0xbb0d('0x0'));var util=require(_0xbb0d('0x1'));var logger=require(_0xbb0d('0x2'))(_0xbb0d('0x3'));var moment=require(_0xbb0d('0x4'));var BPromise=require(_0xbb0d('0x5'));var rp=require(_0xbb0d('0x6'));var fs=require('fs');var path=require(_0xbb0d('0x7'));var rimraf=require(_0xbb0d('0x8'));var config=require(_0xbb0d('0x9'));var attributes=require(_0xbb0d('0xa'));module['exports']=function(_0x410dcf,_0x2cfacd){return _0x410dcf[_0xbb0d('0xb')](_0xbb0d('0xc'),attributes,{'tableName':_0xbb0d('0xd'),'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 3684d85..ebe40fb 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 _0xa1d9=['request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','create','body','options','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5a910e,_0xf5c430){var _0x37f859=function(_0x566036){while(--_0x566036){_0x5a910e['push'](_0x5a910e['shift']());}};_0x37f859(++_0xf5c430);}(_0xa1d9,0x159));var _0x9a1d=function(_0xed9a65,_0x338e59){_0xed9a65=_0xed9a65-0x0;var _0x3f025d=_0xa1d9[_0xed9a65];return _0x3f025d;};'use strict';var _=require('lodash');var util=require(_0x9a1d('0x0'));var moment=require('moment');var BPromise=require(_0x9a1d('0x1'));var rs=require(_0x9a1d('0x2'));var fs=require('fs');var Redis=require(_0x9a1d('0x3'));var db=require(_0x9a1d('0x4'))['db'];var utils=require(_0x9a1d('0x5'));var logger=require(_0x9a1d('0x6'))(_0x9a1d('0x7'));var config=require(_0x9a1d('0x8'));var jayson=require(_0x9a1d('0x9'));var client=jayson[_0x9a1d('0xa')][_0x9a1d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31d61e,_0x5add5c,_0x55ca91){return new BPromise(function(_0x41683b,_0x5f5671){return client[_0x9a1d('0xc')](_0x31d61e,_0x55ca91)[_0x9a1d('0xd')](function(_0x2b6b94){logger[_0x9a1d('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x5add5c,_0x9a1d('0xf'));logger[_0x9a1d('0x10')](_0x9a1d('0x11'),_0x5add5c,_0x9a1d('0xf'),JSON[_0x9a1d('0x12')](_0x2b6b94));if(_0x2b6b94[_0x9a1d('0x13')]){if(_0x2b6b94['error'][_0x9a1d('0x14')]===0x1f4){logger['error'](_0x9a1d('0x15'),_0x5add5c,_0x2b6b94['error'][_0x9a1d('0x16')]);return _0x5f5671(_0x2b6b94['error'][_0x9a1d('0x16')]);}logger[_0x9a1d('0x13')](_0x9a1d('0x15'),_0x5add5c,_0x2b6b94[_0x9a1d('0x13')][_0x9a1d('0x16')]);return _0x41683b(_0x2b6b94[_0x9a1d('0x13')][_0x9a1d('0x16')]);}else{logger[_0x9a1d('0xe')](_0x9a1d('0x15'),_0x5add5c,_0x9a1d('0xf'));_0x41683b(_0x2b6b94[_0x9a1d('0x17')][_0x9a1d('0x16')]);}})[_0x9a1d('0x18')](function(_0x2ca04f){logger['error'](_0x9a1d('0x15'),_0x5add5c,_0x2ca04f);_0x5f5671(_0x2ca04f);});});}exports[_0x9a1d('0x19')]=function(_0x567ca0){var _0x137c6f=this;return new Promise(function(_0x4b5c78,_0x4ac3d2){return db['ReportAgentPreview'][_0x9a1d('0x1a')](_0x567ca0[_0x9a1d('0x1b')],{'raw':_0x567ca0[_0x9a1d('0x1c')]?_0x567ca0[_0x9a1d('0x1c')][_0x9a1d('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3a51fd){logger[_0x9a1d('0xe')](_0x9a1d('0x19'),_0x567ca0);logger[_0x9a1d('0x10')](_0x9a1d('0x19'),_0x567ca0,JSON[_0x9a1d('0x12')](_0x3a51fd));_0x4b5c78(_0x3a51fd);})[_0x9a1d('0x18')](function(_0x5d6233){logger[_0x9a1d('0x13')](_0x9a1d('0x19'),_0x5d6233[_0x9a1d('0x16')],_0x567ca0);_0x4ac3d2(_0x137c6f['error'](0x1f4,_0x5d6233[_0x9a1d('0x16')]));});});}; \ No newline at end of file +var _0x8ab1=['body','options','raw','then','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','request\x20sent','result','CreateReportAgentPreview','ReportAgentPreview','create'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x8ab1,0xd7));var _0x18ab=function(_0x512490,_0x474d3d){_0x512490=_0x512490-0x0;var _0x4cf8e4=_0x8ab1[_0x512490];return _0x4cf8e4;};'use strict';var _=require(_0x18ab('0x0'));var util=require(_0x18ab('0x1'));var moment=require(_0x18ab('0x2'));var BPromise=require(_0x18ab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18ab('0x4'));var db=require(_0x18ab('0x5'))['db'];var utils=require(_0x18ab('0x6'));var logger=require(_0x18ab('0x7'))(_0x18ab('0x8'));var config=require('../../config/environment');var jayson=require(_0x18ab('0x9'));var client=jayson[_0x18ab('0xa')][_0x18ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1126da,_0x5f03d8,_0x29bf07){return new BPromise(function(_0x3d3355,_0x2a0fc2){return client[_0x18ab('0xc')](_0x1126da,_0x29bf07)['then'](function(_0x1aad54){logger[_0x18ab('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x5f03d8,'request\x20sent');logger['debug'](_0x18ab('0xe'),_0x5f03d8,'request\x20sent',JSON[_0x18ab('0xf')](_0x1aad54));if(_0x1aad54[_0x18ab('0x10')]){if(_0x1aad54['error'][_0x18ab('0x11')]===0x1f4){logger['error'](_0x18ab('0x12'),_0x5f03d8,_0x1aad54[_0x18ab('0x10')][_0x18ab('0x13')]);return _0x2a0fc2(_0x1aad54[_0x18ab('0x10')][_0x18ab('0x13')]);}logger[_0x18ab('0x10')](_0x18ab('0x12'),_0x5f03d8,_0x1aad54[_0x18ab('0x10')][_0x18ab('0x13')]);return _0x3d3355(_0x1aad54[_0x18ab('0x10')][_0x18ab('0x13')]);}else{logger[_0x18ab('0xd')](_0x18ab('0x12'),_0x5f03d8,_0x18ab('0x14'));_0x3d3355(_0x1aad54[_0x18ab('0x15')]['message']);}})['catch'](function(_0x34e414){logger[_0x18ab('0x10')](_0x18ab('0x12'),_0x5f03d8,_0x34e414);_0x2a0fc2(_0x34e414);});});}exports[_0x18ab('0x16')]=function(_0x2968ca){var _0x1f1bce=this;return new Promise(function(_0x16f30d,_0x4bb7df){return db[_0x18ab('0x17')][_0x18ab('0x18')](_0x2968ca[_0x18ab('0x19')],{'raw':_0x2968ca['options']?_0x2968ca[_0x18ab('0x1a')][_0x18ab('0x1b')]===undefined?!![]:![]:!![]})[_0x18ab('0x1c')](function(_0x146d4d){logger[_0x18ab('0xd')](_0x18ab('0x16'),_0x2968ca);logger[_0x18ab('0x1d')]('CreateReportAgentPreview',_0x2968ca,JSON['stringify'](_0x146d4d));_0x16f30d(_0x146d4d);})['catch'](function(_0x59cde4){logger[_0x18ab('0x10')](_0x18ab('0x16'),_0x59cde4[_0x18ab('0x13')],_0x2968ca);_0x4bb7df(_0x1f1bce[_0x18ab('0x10')](0x1f4,_0x59cde4[_0x18ab('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index c4788ea..4b7e14d 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 _0x1319=['/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','outbound','/outbound/channels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','agentNotify','exports','util','path','express','Router','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues'];(function(_0x82f586,_0x382c19){var _0x591ec8=function(_0xe5a055){while(--_0xe5a055){_0x82f586['push'](_0x82f586['shift']());}};_0x591ec8(++_0x382c19);}(_0x1319,0x1e0));var _0x9131=function(_0x36018d,_0x153c2a){_0x36018d=_0x36018d-0x0;var _0x17527c=_0x1319[_0x36018d];return _0x17527c;};'use strict';var multer=require('multer');var util=require(_0x9131('0x0'));var path=require(_0x9131('0x1'));var express=require(_0x9131('0x2'));var router=express[_0x9131('0x3')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0x9131('0x4')](_0x9131('0x5'),auth[_0x9131('0x6')](),controller[_0x9131('0x7')]);router['get'](_0x9131('0x8'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x9131('0x4')](_0x9131('0x9'),auth['isAuthenticated'](),controller[_0x9131('0xa')]);router[_0x9131('0x4')](_0x9131('0xb'),auth[_0x9131('0x6')](),controller[_0x9131('0xc')]);router['get'](_0x9131('0xd'),auth[_0x9131('0x6')](),controller[_0x9131('0xe')]);router[_0x9131('0x4')](_0x9131('0xf'),auth['isAuthenticated'](),controller[_0x9131('0x10')]);router['get'](_0x9131('0x11'),auth[_0x9131('0x6')](),controller[_0x9131('0x12')]);router[_0x9131('0x4')](_0x9131('0x13'),auth['isAuthenticated'](),controller['openchannelQueues']);router['get'](_0x9131('0x14'),auth[_0x9131('0x6')](),controller[_0x9131('0x15')]);router[_0x9131('0x4')](_0x9131('0x16'),auth[_0x9131('0x6')](),controller[_0x9131('0x17')]);router[_0x9131('0x4')](_0x9131('0x18'),auth[_0x9131('0x6')](),controller[_0x9131('0x19')]);router[_0x9131('0x4')](_0x9131('0x1a'),auth[_0x9131('0x6')](),controller[_0x9131('0x1b')]);router[_0x9131('0x4')](_0x9131('0x1c'),auth[_0x9131('0x6')](),controller[_0x9131('0x1d')]);router[_0x9131('0x4')](_0x9131('0x1e'),auth['isAuthenticated'](),controller[_0x9131('0x1f')]);router[_0x9131('0x4')](_0x9131('0x20'),auth[_0x9131('0x6')](),controller[_0x9131('0x21')]);router[_0x9131('0x4')](_0x9131('0x22'),auth[_0x9131('0x6')](),controller[_0x9131('0x23')]);router[_0x9131('0x4')](_0x9131('0x24'),auth['isAuthenticated'](),controller[_0x9131('0x25')]);router['get']('/outbound',auth[_0x9131('0x6')](),controller[_0x9131('0x26')]);router[_0x9131('0x4')](_0x9131('0x27'),auth[_0x9131('0x6')](),controller['outboundChannels']);router[_0x9131('0x4')](_0x9131('0x28'),auth[_0x9131('0x6')](),controller[_0x9131('0x29')]);router[_0x9131('0x2a')](_0x9131('0x2b'),auth[_0x9131('0x6')](),controller[_0x9131('0x2c')]);router[_0x9131('0x4')](_0x9131('0x2d'),auth[_0x9131('0x6')](),controller['telephones']);router[_0x9131('0x4')](_0x9131('0x2e'),auth['isAuthenticated'](),controller['trunks']);router['get'](_0x9131('0x2f'),auth['isAuthenticated'](),controller[_0x9131('0x30')]);router[_0x9131('0x4')](_0x9131('0x31'),auth[_0x9131('0x6')](),controller[_0x9131('0x32')]);router[_0x9131('0x4')](_0x9131('0x33'),auth[_0x9131('0x6')](),controller[_0x9131('0x34')]);router[_0x9131('0x4')]('/mail/queues/waitinginteractions',auth[_0x9131('0x6')](),controller[_0x9131('0x35')]);router[_0x9131('0x4')](_0x9131('0x36'),auth[_0x9131('0x6')](),controller['openchannelQueuesWaitingInteractions']);router[_0x9131('0x4')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x9131('0x37')]);router['get'](_0x9131('0x38'),auth['isAuthenticated'](),controller[_0x9131('0x39')]);router[_0x9131('0x4')](_0x9131('0x3a'),auth[_0x9131('0x6')](),controller['faxQueuesWaitingInteractions']);router[_0x9131('0x3b')](_0x9131('0x3c'),auth[_0x9131('0x6')](),controller[_0x9131('0x3d')](_0x9131('0x3e')));router[_0x9131('0x4')](_0x9131('0x3f'),auth[_0x9131('0x6')](),controller[_0x9131('0x40')]);router[_0x9131('0x3b')]('/chat/queues/:id/notify',auth[_0x9131('0x6')](),controller['queueNotify'](_0x9131('0x41')));router['get'](_0x9131('0x42'),auth['isAuthenticated'](),controller[_0x9131('0x43')]);router['post'](_0x9131('0x44'),auth['isAuthenticated'](),controller[_0x9131('0x3d')](_0x9131('0x45')));router[_0x9131('0x4')](_0x9131('0x46'),auth[_0x9131('0x6')](),controller[_0x9131('0x47')]);router['post'](_0x9131('0x48'),auth[_0x9131('0x6')](),controller['queueNotify'](_0x9131('0x49')));router[_0x9131('0x4')]('/openchannel/queues/:id',auth[_0x9131('0x6')](),controller[_0x9131('0x4a')]);router[_0x9131('0x3b')](_0x9131('0x4b'),auth[_0x9131('0x6')](),controller[_0x9131('0x3d')](_0x9131('0x4c')));router[_0x9131('0x3b')](_0x9131('0x4d'),auth[_0x9131('0x6')](),controller[_0x9131('0x3d')](_0x9131('0x4e')));router[_0x9131('0x4')](_0x9131('0x4f'),auth[_0x9131('0x6')](),controller[_0x9131('0x50')]);router[_0x9131('0x4')](_0x9131('0x51'),auth[_0x9131('0x6')](),controller['showWhatsappQueues']);router['post']('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x9131('0x52')]);module[_0x9131('0x53')]=router; \ No newline at end of file +var _0x045b=['post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','outboundChannels','/agents','agents','put','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions'];(function(_0x4572c7,_0x49785c){var _0x573aa1=function(_0x35c846){while(--_0x35c846){_0x4572c7['push'](_0x4572c7['shift']());}};_0x573aa1(++_0x49785c);}(_0x045b,0x150));var _0xb045=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x045b[_0x2235bf];return _0x4c3a64;};'use strict';var multer=require('multer');var util=require(_0xb045('0x0'));var path=require(_0xb045('0x1'));var express=require(_0xb045('0x2'));var router=express['Router']();var auth=require(_0xb045('0x3'));var controller=require(_0xb045('0x4'));router[_0xb045('0x5')](_0xb045('0x6'),auth[_0xb045('0x7')](),controller[_0xb045('0x8')]);router[_0xb045('0x5')](_0xb045('0x9'),auth[_0xb045('0x7')](),controller[_0xb045('0xa')]);router['get'](_0xb045('0xb'),auth[_0xb045('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0xb045('0x5')](_0xb045('0xc'),auth[_0xb045('0x7')](),controller[_0xb045('0xd')]);router[_0xb045('0x5')](_0xb045('0xe'),auth[_0xb045('0x7')](),controller[_0xb045('0xf')]);router[_0xb045('0x5')](_0xb045('0x10'),auth[_0xb045('0x7')](),controller['mailQueues']);router[_0xb045('0x5')](_0xb045('0x11'),auth[_0xb045('0x7')](),controller[_0xb045('0x12')]);router[_0xb045('0x5')]('/openchannel/queues',auth[_0xb045('0x7')](),controller[_0xb045('0x13')]);router[_0xb045('0x5')](_0xb045('0x14'),auth[_0xb045('0x7')](),controller['smsQueues']);router[_0xb045('0x5')]('/whatsapp/queues',auth['isAuthenticated'](),controller[_0xb045('0x15')]);router[_0xb045('0x5')]('/fax/queues',auth[_0xb045('0x7')](),controller[_0xb045('0x16')]);router[_0xb045('0x5')](_0xb045('0x17'),auth[_0xb045('0x7')](),controller['voiceQueuesPreview']);router['get'](_0xb045('0x18'),auth[_0xb045('0x7')](),controller['voiceQueuesChannels']);router[_0xb045('0x5')](_0xb045('0x19'),auth[_0xb045('0x7')](),controller[_0xb045('0x1a')]);router[_0xb045('0x5')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0xb045('0x1b')]);router[_0xb045('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0xb045('0x1c')]);router[_0xb045('0x5')](_0xb045('0x1d'),auth[_0xb045('0x7')](),controller[_0xb045('0x1e')]);router[_0xb045('0x5')](_0xb045('0x1f'),auth[_0xb045('0x7')](),controller[_0xb045('0x20')]);router[_0xb045('0x5')]('/outbound/channels',auth['isAuthenticated'](),controller[_0xb045('0x21')]);router[_0xb045('0x5')](_0xb045('0x22'),auth[_0xb045('0x7')](),controller[_0xb045('0x23')]);router[_0xb045('0x24')]('/agents/:id/capacity',auth[_0xb045('0x7')](),controller[_0xb045('0x25')]);router['get'](_0xb045('0x26'),auth[_0xb045('0x7')](),controller[_0xb045('0x27')]);router['get']('/trunks',auth[_0xb045('0x7')](),controller[_0xb045('0x28')]);router[_0xb045('0x5')](_0xb045('0x29'),auth['isAuthenticated'](),controller[_0xb045('0x2a')]);router[_0xb045('0x5')](_0xb045('0x2b'),auth[_0xb045('0x7')](),controller[_0xb045('0x2c')]);router[_0xb045('0x5')](_0xb045('0x2d'),auth[_0xb045('0x7')](),controller['chatQueuesWaitingInteractions']);router['get'](_0xb045('0x2e'),auth[_0xb045('0x7')](),controller[_0xb045('0x2f')]);router['get']('/openchannel/queues/waitinginteractions',auth[_0xb045('0x7')](),controller[_0xb045('0x30')]);router['get']('/sms/queues/waitinginteractions',auth[_0xb045('0x7')](),controller[_0xb045('0x31')]);router['get'](_0xb045('0x32'),auth[_0xb045('0x7')](),controller[_0xb045('0x33')]);router[_0xb045('0x5')](_0xb045('0x34'),auth[_0xb045('0x7')](),controller[_0xb045('0x35')]);router[_0xb045('0x36')](_0xb045('0x37'),auth[_0xb045('0x7')](),controller[_0xb045('0x38')](_0xb045('0x39')));router['get']('/mail/queues/:id',auth[_0xb045('0x7')](),controller[_0xb045('0x3a')]);router[_0xb045('0x36')](_0xb045('0x3b'),auth['isAuthenticated'](),controller[_0xb045('0x38')]('chat'));router[_0xb045('0x5')](_0xb045('0x3c'),auth['isAuthenticated'](),controller[_0xb045('0x3d')]);router[_0xb045('0x36')](_0xb045('0x3e'),auth[_0xb045('0x7')](),controller[_0xb045('0x38')](_0xb045('0x3f')));router[_0xb045('0x5')]('/fax/queues/:id',auth[_0xb045('0x7')](),controller[_0xb045('0x40')]);router[_0xb045('0x36')](_0xb045('0x41'),auth['isAuthenticated'](),controller[_0xb045('0x38')](_0xb045('0x42')));router[_0xb045('0x5')](_0xb045('0x43'),auth[_0xb045('0x7')](),controller['showOpenchannelQueues']);router[_0xb045('0x36')](_0xb045('0x44'),auth[_0xb045('0x7')](),controller[_0xb045('0x38')](_0xb045('0x45')));router[_0xb045('0x36')](_0xb045('0x46'),auth[_0xb045('0x7')](),controller[_0xb045('0x38')](_0xb045('0x47')));router[_0xb045('0x5')]('/sms/queues/:id',auth[_0xb045('0x7')](),controller[_0xb045('0x48')]);router[_0xb045('0x5')](_0xb045('0x49'),auth[_0xb045('0x7')](),controller[_0xb045('0x4a')]);router[_0xb045('0x36')](_0xb045('0x4b'),auth[_0xb045('0x7')](),controller[_0xb045('0x4c')]);module[_0xb045('0x4d')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index f4f6459..b249315 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 _0xfb16=['QueueId','TransferReport','Start','queueTransferTimeout','agentNotify','channel','capitalize','Agent\x20not\x20found','messageId','create','agentTransferTimeout','*,*,*,*','bluebird','moment','lodash','util','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','catch','voiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','format','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','chat','Website','Account','Queue','findOne','Message','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb16,0xf4));var _0x6fb1=function(_0x5013d4,_0x271f4e){_0x5013d4=_0x5013d4-0x0;var _0xe3f23e=_0xfb16[_0x5013d4];return _0xe3f23e;};'use strict';var BPromise=require(_0x6fb1('0x0'));var moment=require(_0x6fb1('0x1'));var _=require(_0x6fb1('0x2'));var util=require(_0x6fb1('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x6fb1('0x4'))(_0x6fb1('0x5'));var jayson=require(_0x6fb1('0x6'));var amiClient=jayson[_0x6fb1('0x7')]['http']({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x6fb1('0x7')][_0x6fb1('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x2611b5,_0x59efc3,_0x34ec50){return new BPromise(function(_0x2a3ede,_0x54a91f){var _0x428586=_0x34ec50?_0x34ec50:amiClient;return _0x428586[_0x6fb1('0x9')](_0x2611b5,_0x59efc3)[_0x6fb1('0xa')](function(_0x4060a5){if(_0x4060a5['error']){if(_0x4060a5[_0x6fb1('0xb')][_0x6fb1('0xc')]===0x1f4){return _0x54a91f(_0x4060a5[_0x6fb1('0xb')][_0x6fb1('0xd')]);}return _0x2a3ede(_0x4060a5[_0x6fb1('0xb')][_0x6fb1('0xd')]);}else{_0x2a3ede(_0x4060a5['result']);}})['catch'](function(_0x152ffa){_0x54a91f(_0x152ffa);});});}function respondWithResult(_0x2b6d58,_0x34820f){_0x34820f=_0x34820f||0xc8;return function(_0x1a023d){if(_0x1a023d){return _0x2b6d58[_0x6fb1('0xe')](_0x34820f)[_0x6fb1('0xf')](_0x1a023d);}return _0x2b6d58[_0x6fb1('0x10')](0x194);};}function handleError(_0x412859,_0x361cb2){_0x361cb2=_0x361cb2||0x1f4;return function(_0x1d3881){logger['error'](_0x1d3881['stack']);if(_0x1d3881[_0x6fb1('0x11')]){delete _0x1d3881[_0x6fb1('0x11')];}_0x412859['status'](_0x361cb2)[_0x6fb1('0x12')](_0x1d3881);};}function findById(_0x3bd1b8){return function(_0x292d5e){if(!_[_0x6fb1('0x13')](_0x3bd1b8)&&!_['isNil'](_0x292d5e)&&!_['isNil'](_0x292d5e[_0x6fb1('0x14')])){return _[_0x6fb1('0x15')](_0x292d5e[_0x6fb1('0x14')],function(_0x28a22f){return _0x28a22f['id']==_0x3bd1b8;});}return null;};}exports[_0x6fb1('0x16')]=function(_0x1c908b,_0x20c316){return respondWithRpcPromise(_0x6fb1('0x17'),_0x1c908b[_0x6fb1('0x18')])[_0x6fb1('0xa')](respondWithResult(_0x20c316,null))[_0x6fb1('0x19')](handleError(_0x20c316,null));};exports[_0x6fb1('0x1a')]=function(_0x2e3b8d,_0x82e04){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x6fb1('0x1b')](_0x2e3b8d[_0x6fb1('0x18')],_0x2e3b8d[_0x6fb1('0x1c')]))['then'](respondWithResult(_0x82e04,null))[_0x6fb1('0x19')](handleError(_0x82e04,null));};exports[_0x6fb1('0x1d')]=function(_0x1dd928,_0x430cf2){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x6fb1('0x1b')](_0x1dd928[_0x6fb1('0x18')],_0x1dd928[_0x6fb1('0x1c')]))['then'](respondWithResult(_0x430cf2,null))[_0x6fb1('0x19')](handleError(_0x430cf2,null));};exports[_0x6fb1('0x1e')]=function(_0x438dff,_0x12615a){return respondWithRpcPromise(_0x6fb1('0x1f'),_0x438dff['query'])[_0x6fb1('0xa')](respondWithResult(_0x12615a,null))[_0x6fb1('0x19')](handleError(_0x12615a,null));};exports[_0x6fb1('0x20')]=function(_0x4d42a9,_0x3fad77){return respondWithRpcPromise(_0x6fb1('0x1f'),_0x4d42a9[_0x6fb1('0x18')])['then'](findById(_0x4d42a9['params']['id']))[_0x6fb1('0xa')](respondWithResult(_0x3fad77,null))[_0x6fb1('0x19')](handleError(_0x3fad77,null));};exports[_0x6fb1('0x21')]=function(_0x12b6f5,_0x754276){return respondWithRpcPromise(_0x6fb1('0x22'),_[_0x6fb1('0x1b')](_0x12b6f5['query'],_0x12b6f5[_0x6fb1('0x1c')]))[_0x6fb1('0xa')](respondWithResult(_0x754276,null))[_0x6fb1('0x19')](handleError(_0x754276,null));};exports[_0x6fb1('0x23')]=function(_0x3059b6,_0x39a2be){return respondWithRpcPromise('VoiceQueuesChannels',_0x3059b6[_0x6fb1('0x18')])['then'](respondWithResult(_0x39a2be,null))['catch'](handleError(_0x39a2be,null));};exports['voiceQueuesChannel']=function(_0x116219,_0x42d66b){return respondWithRpcPromise(_0x6fb1('0x24'),_[_0x6fb1('0x1b')](_0x116219[_0x6fb1('0x18')],_0x116219[_0x6fb1('0x1c')]))[_0x6fb1('0xa')](respondWithResult(_0x42d66b,null))[_0x6fb1('0x19')](handleError(_0x42d66b,null));};exports[_0x6fb1('0x25')]=function(_0x9be130,_0x363434){return respondWithRpcPromise(_0x6fb1('0x26'),_['merge'](_0x9be130[_0x6fb1('0x18')],_0x9be130[_0x6fb1('0x1c')]))['then'](respondWithResult(_0x363434,null))[_0x6fb1('0x19')](handleError(_0x363434,null));};exports['voiceQueuesChannelRedirect']=function(_0x343e80,_0x46ef99){return respondWithRpcPromise(_0x6fb1('0x27'),_[_0x6fb1('0x1b')](_0x343e80[_0x6fb1('0x18')],_0x343e80[_0x6fb1('0x1c')]))['then'](respondWithResult(_0x46ef99,null))[_0x6fb1('0x19')](handleError(_0x46ef99,null));};exports[_0x6fb1('0x28')]=function(_0x1f2654,_0x5d8a35){return respondWithRpcPromise(_0x6fb1('0x29'),_0x1f2654[_0x6fb1('0x18')])[_0x6fb1('0xa')](respondWithResult(_0x5d8a35,null))[_0x6fb1('0x19')](handleError(_0x5d8a35,null));};exports['outboundChannels']=function(_0x15aff1,_0x27d3f8){return respondWithRpcPromise(_0x6fb1('0x2a'),_0x15aff1[_0x6fb1('0x18')])['then'](respondWithResult(_0x27d3f8,null))[_0x6fb1('0x19')](handleError(_0x27d3f8,null));};exports[_0x6fb1('0x2b')]=function(_0x8bb88e,_0x3cd35b){var _0x2718b7;return respondWithRpcPromise(_0x6fb1('0x2c'),_0x8bb88e[_0x6fb1('0x18')])[_0x6fb1('0xa')](function(_0x4ed4d4){_0x2718b7=_0x4ed4d4;return respondWithRpcPromise(_0x6fb1('0x2c'),_0x8bb88e[_0x6fb1('0x18')],routingClient);})[_0x6fb1('0xa')](function(_0x481297){return _[_0x6fb1('0x1b')]({},_0x481297,_0x2718b7);})[_0x6fb1('0xa')](respondWithResult(_0x3cd35b,null))[_0x6fb1('0x19')](handleError(_0x3cd35b,null));};exports[_0x6fb1('0x2d')]=function(_0x425713,_0xf601aa){if(_0x425713[_0x6fb1('0x2e')]&&_0x425713[_0x6fb1('0x2e')]['interaction']&&_0x425713[_0x6fb1('0x2f')]&&_0x425713[_0x6fb1('0x2f')][_0x6fb1('0x11')]){for(var _0x2333e8 in _0x425713[_0x6fb1('0x2e')]['interaction']){if(_0x425713[_0x6fb1('0x2e')][_0x6fb1('0x30')][_0x6fb1('0x31')](_0x2333e8)){db[_0x6fb1('0x32')][_0x6fb1('0x33')]({'where':{'channel':_0x2333e8,'membername':_0x425713[_0x6fb1('0x2f')]['name'],'type':_0x6fb1('0x34'),'exitAt':null,'uniqueid':_0x425713[_0x6fb1('0x2e')][_0x6fb1('0x30')][_0x2333e8]&&_0x425713[_0x6fb1('0x2e')][_0x6fb1('0x30')][_0x2333e8][_0x6fb1('0x35')]?{'$notIn':_0x425713[_0x6fb1('0x2e')]['interaction'][_0x2333e8]}:{'$ne':null}}})['then'](function(_0x4ae320){var _0x4f79ef=moment()['format'](_0x6fb1('0x36'));for(var _0x495cfb=0x0,_0x538fa3=_0x4ae320[_0x6fb1('0x35')];_0x495cfb<_0x538fa3;_0x495cfb+=0x1){_0x4ae320[_0x495cfb][_0x6fb1('0x37')]({'exitAt':_0x4f79ef});}});for(var _0x264368=0x0;_0x264368<_0x425713['body'][_0x6fb1('0x30')][_0x2333e8][_0x6fb1('0x35')];_0x264368+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x2333e8,'membername':_0x425713[_0x6fb1('0x2f')]['name'],'type':_0x6fb1('0x34'),'uniqueid':_0x425713[_0x6fb1('0x2e')][_0x6fb1('0x30')][_0x2333e8][_0x264368],'exitAt':null},'defaults':{'channel':_0x2333e8,'membername':_0x425713['user'][_0x6fb1('0x11')],'interface':_['isNil'](_0x425713[_0x6fb1('0x2f')]['interface'])?util[_0x6fb1('0x38')](_0x6fb1('0x39'),_0x425713[_0x6fb1('0x2f')][_0x6fb1('0x11')]):_0x425713[_0x6fb1('0x2f')]['interface'],'type':_0x6fb1('0x34'),'enterAt':moment()[_0x6fb1('0x38')](_0x6fb1('0x36')),'role':_0x6fb1('0x3a'),'internal':_0x425713[_0x6fb1('0x2f')][_0x6fb1('0x3b')],'uniqueid':_0x425713[_0x6fb1('0x2e')]['interaction'][_0x2333e8][_0x264368]}});}}}}return respondWithRpcPromise(_0x6fb1('0x3c'),{'id':_0x425713[_0x6fb1('0x1c')]['id'],'capacity':_0x425713[_0x6fb1('0x2e')][_0x6fb1('0x3d')]},routingClient)[_0x6fb1('0xa')](respondWithResult(_0xf601aa,null))[_0x6fb1('0x19')](handleError(_0xf601aa,null));};exports[_0x6fb1('0x3e')]=function(_0x58da40,_0x3bd531){return respondWithRpcPromise(_0x6fb1('0x3f'),_0x58da40[_0x6fb1('0x18')])[_0x6fb1('0xa')](respondWithResult(_0x3bd531,null))[_0x6fb1('0x19')](handleError(_0x3bd531,null));};exports[_0x6fb1('0x40')]=function(_0x4426f0,_0x54bbde){return respondWithRpcPromise(_0x6fb1('0x41'),_0x4426f0[_0x6fb1('0x18')])['then'](respondWithResult(_0x54bbde,null))[_0x6fb1('0x19')](handleError(_0x54bbde,null));};exports['campaigns']=function(_0x551475,_0x7b16e8){return respondWithRpcPromise('Campaigns',_0x551475[_0x6fb1('0x18')])[_0x6fb1('0xa')](respondWithResult(_0x7b16e8,null))['catch'](handleError(_0x7b16e8,null));};exports[_0x6fb1('0x42')]=function(_0x1c0f21,_0x1dfcc0){return respondWithRpcPromise(_0x6fb1('0x43'),_0x1c0f21['query'],routingClient)['then'](respondWithResult(_0x1dfcc0,null))[_0x6fb1('0x19')](handleError(_0x1dfcc0,null));};exports[_0x6fb1('0x44')]=function(_0x4523d0,_0x431e3d){return respondWithRpcPromise(_0x6fb1('0x43'),_0x4523d0[_0x6fb1('0x18')],routingClient)['then'](findById(_0x4523d0[_0x6fb1('0x1c')]['id']))[_0x6fb1('0xa')](respondWithResult(_0x431e3d,null))[_0x6fb1('0x19')](handleError(_0x431e3d,null));};exports[_0x6fb1('0x45')]=function(_0x37332f,_0x9abeb1){return respondWithRpcPromise(_0x6fb1('0x46'),_0x37332f[_0x6fb1('0x18')],routingClient)[_0x6fb1('0xa')](respondWithResult(_0x9abeb1,null))[_0x6fb1('0x19')](handleError(_0x9abeb1,null));};exports['showMailQueues']=function(_0x5c803f,_0x3b0c18){return respondWithRpcPromise(_0x6fb1('0x46'),_0x5c803f[_0x6fb1('0x18')],routingClient)[_0x6fb1('0xa')](findById(_0x5c803f[_0x6fb1('0x1c')]['id']))[_0x6fb1('0xa')](respondWithResult(_0x3b0c18,null))[_0x6fb1('0x19')](handleError(_0x3b0c18,null));};exports[_0x6fb1('0x47')]=function(_0x2368cd,_0x24c2d6){return respondWithRpcPromise(_0x6fb1('0x48'),_0x2368cd[_0x6fb1('0x18')],mailClient)['then'](respondWithResult(_0x24c2d6,null))[_0x6fb1('0x19')](handleError(_0x24c2d6,null));};exports[_0x6fb1('0x49')]=function(_0x1b593b,_0x464d82){return respondWithRpcPromise(_0x6fb1('0x4a'),_0x1b593b[_0x6fb1('0x18')],routingClient)[_0x6fb1('0xa')](respondWithResult(_0x464d82,null))[_0x6fb1('0x19')](handleError(_0x464d82,null));};exports[_0x6fb1('0x4b')]=function(_0x3c6ef7,_0x33f617){return respondWithRpcPromise(_0x6fb1('0x4a'),_0x3c6ef7[_0x6fb1('0x18')],routingClient)['then'](findById(_0x3c6ef7[_0x6fb1('0x1c')]['id']))[_0x6fb1('0xa')](respondWithResult(_0x33f617,null))['catch'](handleError(_0x33f617,null));};exports['smsQueues']=function(_0xfe96a1,_0x539e06){return respondWithRpcPromise('SmsQueues',_0xfe96a1[_0x6fb1('0x18')],routingClient)[_0x6fb1('0xa')](respondWithResult(_0x539e06,null))[_0x6fb1('0x19')](handleError(_0x539e06,null));};exports[_0x6fb1('0x4c')]=function(_0x2b6f29,_0x4eccdb){return respondWithRpcPromise(_0x6fb1('0x4d'),_0x2b6f29[_0x6fb1('0x18')],routingClient)[_0x6fb1('0xa')](findById(_0x2b6f29[_0x6fb1('0x1c')]['id']))['then'](respondWithResult(_0x4eccdb,null))[_0x6fb1('0x19')](handleError(_0x4eccdb,null));};exports[_0x6fb1('0x4e')]=function(_0x1dd8f2,_0x85537b){return respondWithRpcPromise(_0x6fb1('0x4f'),_0x1dd8f2[_0x6fb1('0x18')],routingClient)[_0x6fb1('0xa')](respondWithResult(_0x85537b,null))[_0x6fb1('0x19')](handleError(_0x85537b,null));};exports[_0x6fb1('0x50')]=function(_0x186beb,_0x3844b3){return respondWithRpcPromise('WhatsappQueues',_0x186beb['query'],routingClient)[_0x6fb1('0xa')](findById(_0x186beb[_0x6fb1('0x1c')]['id']))['then'](respondWithResult(_0x3844b3,null))[_0x6fb1('0x19')](handleError(_0x3844b3,null));};exports[_0x6fb1('0x51')]=function(_0x35c1d3,_0x34c954){return respondWithRpcPromise(_0x6fb1('0x52'),_0x35c1d3['query'],routingClient)[_0x6fb1('0xa')](respondWithResult(_0x34c954,null))[_0x6fb1('0x19')](handleError(_0x34c954,null));};exports[_0x6fb1('0x53')]=function(_0x34d3d0,_0x26e0d1){return respondWithRpcPromise(_0x6fb1('0x52'),_0x34d3d0[_0x6fb1('0x18')],routingClient)[_0x6fb1('0xa')](findById(_0x34d3d0[_0x6fb1('0x1c')]['id']))[_0x6fb1('0xa')](respondWithResult(_0x26e0d1,null))[_0x6fb1('0x19')](handleError(_0x26e0d1,null));};exports[_0x6fb1('0x54')]=function(_0x463b65,_0x490201){return respondWithRpcPromise('FaxAccounts',_0x463b65[_0x6fb1('0x18')])[_0x6fb1('0xa')](respondWithResult(_0x490201,null))[_0x6fb1('0x19')](handleError(_0x490201,null));};exports[_0x6fb1('0x55')]=function(_0x2ed872,_0x20672e){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x2ed872['query'],routingClient)[_0x6fb1('0xa')](respondWithResult(_0x20672e,null))[_0x6fb1('0x19')](handleError(_0x20672e,null));};exports['mailQueuesWaitingInteractions']=function(_0x580c6d,_0x6110e8){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x580c6d[_0x6fb1('0x18')],routingClient)[_0x6fb1('0xa')](respondWithResult(_0x6110e8,null))[_0x6fb1('0x19')](handleError(_0x6110e8,null));};exports[_0x6fb1('0x56')]=function(_0x315e60,_0x1e2ce7){return respondWithRpcPromise(_0x6fb1('0x57'),_0x315e60[_0x6fb1('0x18')],routingClient)[_0x6fb1('0xa')](respondWithResult(_0x1e2ce7,null))['catch'](handleError(_0x1e2ce7,null));};exports[_0x6fb1('0x58')]=function(_0x20fc2a,_0x30776e){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x20fc2a[_0x6fb1('0x18')],routingClient)[_0x6fb1('0xa')](respondWithResult(_0x30776e,null))['catch'](handleError(_0x30776e,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x747a6f,_0x19a98f){return respondWithRpcPromise(_0x6fb1('0x59'),_0x747a6f[_0x6fb1('0x18')],routingClient)['then'](respondWithResult(_0x19a98f,null))['catch'](handleError(_0x19a98f,null));};exports['faxQueuesWaitingInteractions']=function(_0x473e72,_0xe7544e){return respondWithRpcPromise(_0x6fb1('0x5a'),_0x473e72[_0x6fb1('0x18')],routingClient)[_0x6fb1('0xa')](respondWithResult(_0xe7544e,null))['catch'](handleError(_0xe7544e,null));};exports['queueNotify']=function(_0x1ace67){return function(_0x369fda,_0x2d6316){var _0x3e3045,_0x487394;var _0x3e202e=_['capitalize'](_0x1ace67);var _0x53daa4=_0x1ace67===_0x6fb1('0x5b')?_0x6fb1('0x5c'):_0x6fb1('0x5d');return db[_0x3e202e+_0x6fb1('0x5e')][_0x6fb1('0x5f')]({'raw':!![],'where':{'id':_0x369fda['params']['id']}})[_0x6fb1('0xa')](function(_0x1eabd7){if(_[_0x6fb1('0x13')](_0x1eabd7)){throw new Error(_0x3e202e+'\x20Queue\x20not\x20found');}_0x3e3045=_0x1eabd7;return db[_0x3e202e+_0x6fb1('0x60')][_0x6fb1('0x5f')]({'where':{'id':_0x369fda['body']['messageId']},'include':[{'model':db[_0x3e202e+_0x6fb1('0x61')],'as':_0x6fb1('0x61')},{'model':db[_0x3e202e+_0x53daa4],'as':_0x6fb1('0x5d')}]});})[_0x6fb1('0xa')](function(_0x58c178){if(_['isNil'](_0x58c178)){throw new Error(_0x3e202e+_0x6fb1('0x62'));}_0x487394=_0x58c178;return _0x58c178[_0x6fb1('0x63')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6fb1('0xa')](function(){var _0x41327c={'uniqueid':_0x1ace67+'.'+_0x487394['id']+'.'+_0x487394[_0x6fb1('0x61')]['id'],'FromUserId':_0x369fda['user']['id'],'type':_0x6fb1('0x64')};_0x41327c[_0x3e202e+_0x6fb1('0x65')]=_0x487394['id'];_0x41327c[_0x3e202e+_0x6fb1('0x66')]=_0x487394[_0x6fb1('0x61')]['id'];_0x41327c[_0x6fb1('0x67')+_0x3e202e+_0x53daa4+'Id']=_0x487394[_0x6fb1('0x5d')]['id'];_0x41327c['To'+_0x3e202e+_0x6fb1('0x68')]=_0x3e3045['id'];return db[_0x3e202e+_0x6fb1('0x69')]['create'](_0x41327c);})[_0x6fb1('0xa')](function(){return respondWithRpcPromise(_0x6fb1('0x6a'),{'channel':_0x1ace67,'interaction':_0x487394['Interaction'],'message':_0x487394,'account':_0x487394[_0x6fb1('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6fb1('0x64'),'appdata':_0x3e3045[_0x6fb1('0x11')]+','+(_0x487394[_0x6fb1('0x5d')][_0x6fb1('0x6b')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x6fb1('0xa')](respondWithResult(_0x2d6316,null))[_0x6fb1('0x19')](handleError(_0x2d6316,null));};};exports[_0x6fb1('0x6c')]=function(_0x40dc36,_0x28f8ce){var _0x88d902,_0x1e4f03;if(_[_0x6fb1('0x13')](_0x40dc36[_0x6fb1('0x2e')][_0x6fb1('0x6d')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x366f1d=_0x40dc36[_0x6fb1('0x2e')]['channel'];var _0x1c9a03=_[_0x6fb1('0x6e')](_0x366f1d);var _0x2d86d1=_0x366f1d==='chat'?_0x6fb1('0x5c'):_0x6fb1('0x5d');return db['User'][_0x6fb1('0x5f')]({'raw':!![],'where':{'id':_0x40dc36[_0x6fb1('0x1c')]['id'],'role':'agent'}})['then'](function(_0x3095bf){if(_['isNil'](_0x3095bf)){throw new Error(_0x6fb1('0x6f'));}_0x88d902=_0x3095bf;return db[_0x1c9a03+_0x6fb1('0x60')][_0x6fb1('0x5f')]({'where':{'id':_0x40dc36['body'][_0x6fb1('0x70')]},'include':[{'model':db[_0x1c9a03+_0x6fb1('0x61')],'as':_0x6fb1('0x61')},{'model':db[_0x1c9a03+_0x2d86d1],'as':'Account'}]});})['then'](function(_0x54b6eb){if(_[_0x6fb1('0x13')](_0x54b6eb)){throw new Error(_0x1c9a03+_0x6fb1('0x62'));}_0x1e4f03=_0x54b6eb;return _0x54b6eb[_0x6fb1('0x63')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6fb1('0xa')](function(){var _0x4a7aac={'uniqueid':_0x366f1d+'.'+_0x1e4f03['id']+'.'+_0x1e4f03[_0x6fb1('0x61')]['id'],'FromUserId':_0x40dc36[_0x6fb1('0x2f')]['id'],'type':_0x6fb1('0x64'),'ToUserId':_0x88d902['id']};_0x4a7aac[_0x1c9a03+'MessageId']=_0x1e4f03['id'];_0x4a7aac[_0x1c9a03+_0x6fb1('0x66')]=_0x1e4f03[_0x6fb1('0x61')]['id'];_0x4a7aac[_0x6fb1('0x67')+_0x1c9a03+_0x2d86d1+'Id']=_0x1e4f03['Account']['id'];return db[_0x1c9a03+_0x6fb1('0x69')][_0x6fb1('0x71')](_0x4a7aac);})[_0x6fb1('0xa')](function(){return respondWithRpcPromise(_0x6fb1('0x6a'),{'channel':_0x366f1d,'interaction':_0x1e4f03[_0x6fb1('0x61')],'message':_0x1e4f03,'account':_0x1e4f03[_0x6fb1('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6fb1('0x3a'),'appdata':_0x88d902[_0x6fb1('0x11')]+','+(_0x1e4f03[_0x6fb1('0x5d')][_0x6fb1('0x72')]||0x12c),'interval':_0x6fb1('0x73')}]},routingClient);})[_0x6fb1('0xa')](respondWithResult(_0x28f8ce,null))[_0x6fb1('0x19')](handleError(_0x28f8ce,null));}; \ No newline at end of file +var _0xb22d=['bluebird','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','code','error','message','result','catch','status','name','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','agents','Agents','agentCapacity','body','interaction','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','user','interface','SIP/%s','format','AgentCapacity','telephones','Telephones','trunks','chatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','channel','User','Agent\x20not\x20found','messageId','agent','agentTransferTimeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb22d,0x75));var _0xdb22=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0xb22d[_0xa990b7];return _0x52c99c;};'use strict';var BPromise=require(_0xdb22('0x0'));var moment=require('moment');var _=require(_0xdb22('0x1'));var util=require(_0xdb22('0x2'));var db=require(_0xdb22('0x3'))['db'];var logger=require(_0xdb22('0x4'))(_0xdb22('0x5'));var jayson=require(_0xdb22('0x6'));var amiClient=jayson[_0xdb22('0x7')]['http']({'port':0x232a});var mailClient=jayson['client'][_0xdb22('0x8')]({'port':0x232b});var routingClient=jayson[_0xdb22('0x7')][_0xdb22('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x88b49a,_0x2c4adf,_0x1b32ba){return new BPromise(function(_0xa404bd,_0x4a4f5f){var _0x3bf795=_0x1b32ba?_0x1b32ba:amiClient;return _0x3bf795[_0xdb22('0x9')](_0x88b49a,_0x2c4adf)[_0xdb22('0xa')](function(_0x349d64){if(_0x349d64['error']){if(_0x349d64['error'][_0xdb22('0xb')]===0x1f4){return _0x4a4f5f(_0x349d64[_0xdb22('0xc')]['message']);}return _0xa404bd(_0x349d64[_0xdb22('0xc')][_0xdb22('0xd')]);}else{_0xa404bd(_0x349d64[_0xdb22('0xe')]);}})[_0xdb22('0xf')](function(_0x484b78){_0x4a4f5f(_0x484b78);});});}function respondWithResult(_0x19223c,_0x482b89){_0x482b89=_0x482b89||0xc8;return function(_0x59fd3e){if(_0x59fd3e){return _0x19223c[_0xdb22('0x10')](_0x482b89)['json'](_0x59fd3e);}return _0x19223c['sendStatus'](0x194);};}function handleError(_0x1d24b2,_0x38e452){_0x38e452=_0x38e452||0x1f4;return function(_0x1aa765){logger[_0xdb22('0xc')](_0x1aa765['stack']);if(_0x1aa765[_0xdb22('0x11')]){delete _0x1aa765[_0xdb22('0x11')];}_0x1d24b2[_0xdb22('0x10')](_0x38e452)['send'](_0x1aa765);};}function findById(_0x8e750f){return function(_0x510371){if(!_[_0xdb22('0x12')](_0x8e750f)&&!_[_0xdb22('0x12')](_0x510371)&&!_['isNil'](_0x510371[_0xdb22('0x13')])){return _[_0xdb22('0x14')](_0x510371[_0xdb22('0x13')],function(_0x35fcf8){return _0x35fcf8['id']==_0x8e750f;});}return null;};}exports[_0xdb22('0x15')]=function(_0x26469e,_0x696f3f){return respondWithRpcPromise(_0xdb22('0x16'),_0x26469e[_0xdb22('0x17')])['then'](respondWithResult(_0x696f3f,null))['catch'](handleError(_0x696f3f,null));};exports[_0xdb22('0x18')]=function(_0x36ba75,_0x462de8){return respondWithRpcPromise(_0xdb22('0x19'),_['merge'](_0x36ba75['query'],_0x36ba75[_0xdb22('0x1a')]))[_0xdb22('0xa')](respondWithResult(_0x462de8,null))[_0xdb22('0xf')](handleError(_0x462de8,null));};exports[_0xdb22('0x1b')]=function(_0x87d44b,_0x48b3c5){return respondWithRpcPromise(_0xdb22('0x1c'),_[_0xdb22('0x1d')](_0x87d44b[_0xdb22('0x17')],_0x87d44b[_0xdb22('0x1a')]))[_0xdb22('0xa')](respondWithResult(_0x48b3c5,null))[_0xdb22('0xf')](handleError(_0x48b3c5,null));};exports['voiceQueues']=function(_0x3653b4,_0x48e66e){return respondWithRpcPromise(_0xdb22('0x1e'),_0x3653b4[_0xdb22('0x17')])[_0xdb22('0xa')](respondWithResult(_0x48e66e,null))[_0xdb22('0xf')](handleError(_0x48e66e,null));};exports[_0xdb22('0x1f')]=function(_0x59ddae,_0x53bda8){return respondWithRpcPromise(_0xdb22('0x1e'),_0x59ddae[_0xdb22('0x17')])[_0xdb22('0xa')](findById(_0x59ddae[_0xdb22('0x1a')]['id']))[_0xdb22('0xa')](respondWithResult(_0x53bda8,null))['catch'](handleError(_0x53bda8,null));};exports['voiceQueuesPreview']=function(_0x4d1fbc,_0x5b2579){return respondWithRpcPromise(_0xdb22('0x20'),_['merge'](_0x4d1fbc[_0xdb22('0x17')],_0x4d1fbc[_0xdb22('0x1a')]))[_0xdb22('0xa')](respondWithResult(_0x5b2579,null))[_0xdb22('0xf')](handleError(_0x5b2579,null));};exports[_0xdb22('0x21')]=function(_0x46fffd,_0x4bbf36){return respondWithRpcPromise(_0xdb22('0x22'),_0x46fffd[_0xdb22('0x17')])['then'](respondWithResult(_0x4bbf36,null))[_0xdb22('0xf')](handleError(_0x4bbf36,null));};exports[_0xdb22('0x23')]=function(_0x577e7d,_0x1dd2c7){return respondWithRpcPromise(_0xdb22('0x24'),_[_0xdb22('0x1d')](_0x577e7d[_0xdb22('0x17')],_0x577e7d[_0xdb22('0x1a')]))[_0xdb22('0xa')](respondWithResult(_0x1dd2c7,null))[_0xdb22('0xf')](handleError(_0x1dd2c7,null));};exports['voiceQueuesChannelHangup']=function(_0x33bddb,_0x2aefd6){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x33bddb[_0xdb22('0x17')],_0x33bddb[_0xdb22('0x1a')]))[_0xdb22('0xa')](respondWithResult(_0x2aefd6,null))[_0xdb22('0xf')](handleError(_0x2aefd6,null));};exports[_0xdb22('0x25')]=function(_0x2718a3,_0x3fbca3){return respondWithRpcPromise(_0xdb22('0x26'),_[_0xdb22('0x1d')](_0x2718a3['query'],_0x2718a3['params']))[_0xdb22('0xa')](respondWithResult(_0x3fbca3,null))[_0xdb22('0xf')](handleError(_0x3fbca3,null));};exports['outbound']=function(_0x2cb625,_0x18634e){return respondWithRpcPromise(_0xdb22('0x27'),_0x2cb625['query'])[_0xdb22('0xa')](respondWithResult(_0x18634e,null))[_0xdb22('0xf')](handleError(_0x18634e,null));};exports[_0xdb22('0x28')]=function(_0xeeca0f,_0x3d8440){return respondWithRpcPromise('OutboundChannels',_0xeeca0f[_0xdb22('0x17')])[_0xdb22('0xa')](respondWithResult(_0x3d8440,null))[_0xdb22('0xf')](handleError(_0x3d8440,null));};exports[_0xdb22('0x29')]=function(_0xb4bdd8,_0x7dcea9){var _0x6353cf;return respondWithRpcPromise('Agents',_0xb4bdd8['query'])[_0xdb22('0xa')](function(_0x5d19b8){_0x6353cf=_0x5d19b8;return respondWithRpcPromise(_0xdb22('0x2a'),_0xb4bdd8['query'],routingClient);})[_0xdb22('0xa')](function(_0x1407a2){return _[_0xdb22('0x1d')]({},_0x1407a2,_0x6353cf);})[_0xdb22('0xa')](respondWithResult(_0x7dcea9,null))[_0xdb22('0xf')](handleError(_0x7dcea9,null));};exports[_0xdb22('0x2b')]=function(_0x44d532,_0xfc9445){if(_0x44d532[_0xdb22('0x2c')]&&_0x44d532[_0xdb22('0x2c')][_0xdb22('0x2d')]&&_0x44d532['user']&&_0x44d532['user'][_0xdb22('0x11')]){for(var _0x46799a in _0x44d532['body']['interaction']){if(_0x44d532['body']['interaction']['hasOwnProperty'](_0x46799a)){db[_0xdb22('0x2e')][_0xdb22('0x2f')]({'where':{'channel':_0x46799a,'membername':_0x44d532['user'][_0xdb22('0x11')],'type':_0xdb22('0x30'),'exitAt':null,'uniqueid':_0x44d532[_0xdb22('0x2c')][_0xdb22('0x2d')][_0x46799a]&&_0x44d532[_0xdb22('0x2c')]['interaction'][_0x46799a][_0xdb22('0x31')]?{'$notIn':_0x44d532[_0xdb22('0x2c')]['interaction'][_0x46799a]}:{'$ne':null}}})[_0xdb22('0xa')](function(_0x2e201a){var _0x59966f=moment()['format'](_0xdb22('0x32'));for(var _0x234ec4=0x0,_0x5dabf4=_0x2e201a[_0xdb22('0x31')];_0x234ec4<_0x5dabf4;_0x234ec4+=0x1){_0x2e201a[_0x234ec4][_0xdb22('0x33')]({'exitAt':_0x59966f});}});for(var _0x4dabce=0x0;_0x4dabce<_0x44d532['body'][_0xdb22('0x2d')][_0x46799a][_0xdb22('0x31')];_0x4dabce+=0x1){db[_0xdb22('0x2e')][_0xdb22('0x34')]({'where':{'channel':_0x46799a,'membername':_0x44d532[_0xdb22('0x35')][_0xdb22('0x11')],'type':_0xdb22('0x30'),'uniqueid':_0x44d532[_0xdb22('0x2c')][_0xdb22('0x2d')][_0x46799a][_0x4dabce],'exitAt':null},'defaults':{'channel':_0x46799a,'membername':_0x44d532[_0xdb22('0x35')]['name'],'interface':_[_0xdb22('0x12')](_0x44d532[_0xdb22('0x35')][_0xdb22('0x36')])?util['format'](_0xdb22('0x37'),_0x44d532['user'][_0xdb22('0x11')]):_0x44d532['user']['interface'],'type':'INTERACTION','enterAt':moment()[_0xdb22('0x38')](_0xdb22('0x32')),'role':'agent','internal':_0x44d532[_0xdb22('0x35')]['internal'],'uniqueid':_0x44d532[_0xdb22('0x2c')][_0xdb22('0x2d')][_0x46799a][_0x4dabce]}});}}}}return respondWithRpcPromise(_0xdb22('0x39'),{'id':_0x44d532[_0xdb22('0x1a')]['id'],'capacity':_0x44d532['body']['capacity']},routingClient)[_0xdb22('0xa')](respondWithResult(_0xfc9445,null))['catch'](handleError(_0xfc9445,null));};exports[_0xdb22('0x3a')]=function(_0x49d33b,_0x363030){return respondWithRpcPromise(_0xdb22('0x3b'),_0x49d33b['query'])[_0xdb22('0xa')](respondWithResult(_0x363030,null))[_0xdb22('0xf')](handleError(_0x363030,null));};exports[_0xdb22('0x3c')]=function(_0x38a08b,_0x1c3fbd){return respondWithRpcPromise('Trunks',_0x38a08b[_0xdb22('0x17')])['then'](respondWithResult(_0x1c3fbd,null))[_0xdb22('0xf')](handleError(_0x1c3fbd,null));};exports['campaigns']=function(_0x1c7a81,_0x8f18c2){return respondWithRpcPromise('Campaigns',_0x1c7a81['query'])[_0xdb22('0xa')](respondWithResult(_0x8f18c2,null))['catch'](handleError(_0x8f18c2,null));};exports[_0xdb22('0x3d')]=function(_0x4617b0,_0xcaef92){return respondWithRpcPromise('ChatQueues',_0x4617b0[_0xdb22('0x17')],routingClient)[_0xdb22('0xa')](respondWithResult(_0xcaef92,null))[_0xdb22('0xf')](handleError(_0xcaef92,null));};exports[_0xdb22('0x3e')]=function(_0x182116,_0xb3bbaa){return respondWithRpcPromise('ChatQueues',_0x182116[_0xdb22('0x17')],routingClient)[_0xdb22('0xa')](findById(_0x182116[_0xdb22('0x1a')]['id']))[_0xdb22('0xa')](respondWithResult(_0xb3bbaa,null))[_0xdb22('0xf')](handleError(_0xb3bbaa,null));};exports['mailQueues']=function(_0x2afe90,_0x5974ac){return respondWithRpcPromise(_0xdb22('0x3f'),_0x2afe90['query'],routingClient)['then'](respondWithResult(_0x5974ac,null))[_0xdb22('0xf')](handleError(_0x5974ac,null));};exports[_0xdb22('0x40')]=function(_0x4ff0dd,_0x42e11e){return respondWithRpcPromise('MailQueues',_0x4ff0dd[_0xdb22('0x17')],routingClient)[_0xdb22('0xa')](findById(_0x4ff0dd[_0xdb22('0x1a')]['id']))[_0xdb22('0xa')](respondWithResult(_0x42e11e,null))[_0xdb22('0xf')](handleError(_0x42e11e,null));};exports[_0xdb22('0x41')]=function(_0xe3383,_0x3f0f01){return respondWithRpcPromise(_0xdb22('0x42'),_0xe3383[_0xdb22('0x17')],mailClient)[_0xdb22('0xa')](respondWithResult(_0x3f0f01,null))[_0xdb22('0xf')](handleError(_0x3f0f01,null));};exports[_0xdb22('0x43')]=function(_0x67f56d,_0x1f65b3){return respondWithRpcPromise(_0xdb22('0x44'),_0x67f56d['query'],routingClient)[_0xdb22('0xa')](respondWithResult(_0x1f65b3,null))[_0xdb22('0xf')](handleError(_0x1f65b3,null));};exports[_0xdb22('0x45')]=function(_0x596320,_0x23b746){return respondWithRpcPromise(_0xdb22('0x44'),_0x596320[_0xdb22('0x17')],routingClient)[_0xdb22('0xa')](findById(_0x596320[_0xdb22('0x1a')]['id']))[_0xdb22('0xa')](respondWithResult(_0x23b746,null))[_0xdb22('0xf')](handleError(_0x23b746,null));};exports[_0xdb22('0x46')]=function(_0x3e4129,_0x324fbc){return respondWithRpcPromise('SmsQueues',_0x3e4129['query'],routingClient)[_0xdb22('0xa')](respondWithResult(_0x324fbc,null))['catch'](handleError(_0x324fbc,null));};exports[_0xdb22('0x47')]=function(_0x4d6ec7,_0x3867f5){return respondWithRpcPromise('SmsQueues',_0x4d6ec7[_0xdb22('0x17')],routingClient)['then'](findById(_0x4d6ec7[_0xdb22('0x1a')]['id']))[_0xdb22('0xa')](respondWithResult(_0x3867f5,null))['catch'](handleError(_0x3867f5,null));};exports['whatsappQueues']=function(_0x208351,_0x4b9e07){return respondWithRpcPromise(_0xdb22('0x48'),_0x208351[_0xdb22('0x17')],routingClient)[_0xdb22('0xa')](respondWithResult(_0x4b9e07,null))['catch'](handleError(_0x4b9e07,null));};exports[_0xdb22('0x49')]=function(_0xfa5e8b,_0x4df033){return respondWithRpcPromise(_0xdb22('0x48'),_0xfa5e8b[_0xdb22('0x17')],routingClient)[_0xdb22('0xa')](findById(_0xfa5e8b[_0xdb22('0x1a')]['id']))[_0xdb22('0xa')](respondWithResult(_0x4df033,null))[_0xdb22('0xf')](handleError(_0x4df033,null));};exports[_0xdb22('0x4a')]=function(_0x3d6a51,_0x780e00){return respondWithRpcPromise(_0xdb22('0x4b'),_0x3d6a51[_0xdb22('0x17')],routingClient)[_0xdb22('0xa')](respondWithResult(_0x780e00,null))[_0xdb22('0xf')](handleError(_0x780e00,null));};exports[_0xdb22('0x4c')]=function(_0x5c112c,_0x390346){return respondWithRpcPromise(_0xdb22('0x4b'),_0x5c112c['query'],routingClient)['then'](findById(_0x5c112c[_0xdb22('0x1a')]['id']))[_0xdb22('0xa')](respondWithResult(_0x390346,null))[_0xdb22('0xf')](handleError(_0x390346,null));};exports[_0xdb22('0x4d')]=function(_0x14753d,_0x1d1b1f){return respondWithRpcPromise('FaxAccounts',_0x14753d[_0xdb22('0x17')])[_0xdb22('0xa')](respondWithResult(_0x1d1b1f,null))[_0xdb22('0xf')](handleError(_0x1d1b1f,null));};exports[_0xdb22('0x4e')]=function(_0x417d8c,_0x2ee2fd){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x417d8c['query'],routingClient)[_0xdb22('0xa')](respondWithResult(_0x2ee2fd,null))[_0xdb22('0xf')](handleError(_0x2ee2fd,null));};exports[_0xdb22('0x4f')]=function(_0x2ce9db,_0x2c10d9){return respondWithRpcPromise(_0xdb22('0x50'),_0x2ce9db[_0xdb22('0x17')],routingClient)[_0xdb22('0xa')](respondWithResult(_0x2c10d9,null))['catch'](handleError(_0x2c10d9,null));};exports[_0xdb22('0x51')]=function(_0x4b9284,_0xc4af69){return respondWithRpcPromise(_0xdb22('0x52'),_0x4b9284['query'],routingClient)[_0xdb22('0xa')](respondWithResult(_0xc4af69,null))[_0xdb22('0xf')](handleError(_0xc4af69,null));};exports[_0xdb22('0x53')]=function(_0x11ddbd,_0x3a337e){return respondWithRpcPromise(_0xdb22('0x54'),_0x11ddbd[_0xdb22('0x17')],routingClient)[_0xdb22('0xa')](respondWithResult(_0x3a337e,null))['catch'](handleError(_0x3a337e,null));};exports[_0xdb22('0x55')]=function(_0xd157a3,_0x1ffe8b){return respondWithRpcPromise(_0xdb22('0x56'),_0xd157a3[_0xdb22('0x17')],routingClient)[_0xdb22('0xa')](respondWithResult(_0x1ffe8b,null))[_0xdb22('0xf')](handleError(_0x1ffe8b,null));};exports[_0xdb22('0x57')]=function(_0x427df8,_0x3ea41f){return respondWithRpcPromise(_0xdb22('0x58'),_0x427df8[_0xdb22('0x17')],routingClient)[_0xdb22('0xa')](respondWithResult(_0x3ea41f,null))['catch'](handleError(_0x3ea41f,null));};exports[_0xdb22('0x59')]=function(_0x15236c){return function(_0x2daa10,_0x2fd968){var _0x568f16,_0x9eb57d;var _0x3da55e=_[_0xdb22('0x5a')](_0x15236c);var _0x1c1180=_0x15236c===_0xdb22('0x5b')?_0xdb22('0x5c'):'Account';return db[_0x3da55e+_0xdb22('0x5d')]['findOne']({'raw':!![],'where':{'id':_0x2daa10[_0xdb22('0x1a')]['id']}})[_0xdb22('0xa')](function(_0x36e9d4){if(_[_0xdb22('0x12')](_0x36e9d4)){throw new Error(_0x3da55e+_0xdb22('0x5e'));}_0x568f16=_0x36e9d4;return db[_0x3da55e+_0xdb22('0x5f')][_0xdb22('0x60')]({'where':{'id':_0x2daa10[_0xdb22('0x2c')]['messageId']},'include':[{'model':db[_0x3da55e+_0xdb22('0x61')],'as':_0xdb22('0x61')},{'model':db[_0x3da55e+_0x1c1180],'as':_0xdb22('0x62')}]});})[_0xdb22('0xa')](function(_0x424ad9){if(_[_0xdb22('0x12')](_0x424ad9)){throw new Error(_0x3da55e+_0xdb22('0x63'));}_0x9eb57d=_0x424ad9;return _0x424ad9[_0xdb22('0x64')]({'read':0x0,'readAt':null,'UserId':null});})[_0xdb22('0xa')](function(){var _0x216a00={'uniqueid':_0x15236c+'.'+_0x9eb57d['id']+'.'+_0x9eb57d[_0xdb22('0x61')]['id'],'FromUserId':_0x2daa10[_0xdb22('0x35')]['id'],'type':_0xdb22('0x65')};_0x216a00[_0x3da55e+_0xdb22('0x66')]=_0x9eb57d['id'];_0x216a00[_0x3da55e+_0xdb22('0x67')]=_0x9eb57d[_0xdb22('0x61')]['id'];_0x216a00[_0xdb22('0x68')+_0x3da55e+_0x1c1180+'Id']=_0x9eb57d['Account']['id'];_0x216a00['To'+_0x3da55e+_0xdb22('0x69')]=_0x568f16['id'];return db[_0x3da55e+_0xdb22('0x6a')][_0xdb22('0x6b')](_0x216a00);})[_0xdb22('0xa')](function(){return respondWithRpcPromise(_0xdb22('0x6c'),{'channel':_0x15236c,'interaction':_0x9eb57d[_0xdb22('0x61')],'message':_0x9eb57d,'account':_0x9eb57d[_0xdb22('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0xdb22('0x65'),'appdata':_0x568f16[_0xdb22('0x11')]+','+(_0x9eb57d[_0xdb22('0x62')][_0xdb22('0x6d')]||0x12c),'interval':_0xdb22('0x6e')}]},routingClient);})[_0xdb22('0xa')](respondWithResult(_0x2fd968,null))['catch'](handleError(_0x2fd968,null));};};exports['agentNotify']=function(_0x362fd1,_0x432150){var _0x285fb4,_0x45f131;if(_[_0xdb22('0x12')](_0x362fd1['body'][_0xdb22('0x6f')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x11c9f0=_0x362fd1[_0xdb22('0x2c')]['channel'];var _0x392e41=_[_0xdb22('0x5a')](_0x11c9f0);var _0x52474d=_0x11c9f0===_0xdb22('0x5b')?_0xdb22('0x5c'):_0xdb22('0x62');return db[_0xdb22('0x70')][_0xdb22('0x60')]({'raw':!![],'where':{'id':_0x362fd1[_0xdb22('0x1a')]['id'],'role':'agent'}})[_0xdb22('0xa')](function(_0x55425b){if(_[_0xdb22('0x12')](_0x55425b)){throw new Error(_0xdb22('0x71'));}_0x285fb4=_0x55425b;return db[_0x392e41+'Message'][_0xdb22('0x60')]({'where':{'id':_0x362fd1[_0xdb22('0x2c')][_0xdb22('0x72')]},'include':[{'model':db[_0x392e41+_0xdb22('0x61')],'as':_0xdb22('0x61')},{'model':db[_0x392e41+_0x52474d],'as':_0xdb22('0x62')}]});})[_0xdb22('0xa')](function(_0x697a0c){if(_[_0xdb22('0x12')](_0x697a0c)){throw new Error(_0x392e41+_0xdb22('0x63'));}_0x45f131=_0x697a0c;return _0x697a0c[_0xdb22('0x64')]({'read':0x0,'readAt':null,'UserId':null});})[_0xdb22('0xa')](function(){var _0x114b61={'uniqueid':_0x11c9f0+'.'+_0x45f131['id']+'.'+_0x45f131[_0xdb22('0x61')]['id'],'FromUserId':_0x362fd1[_0xdb22('0x35')]['id'],'type':_0xdb22('0x65'),'ToUserId':_0x285fb4['id']};_0x114b61[_0x392e41+'MessageId']=_0x45f131['id'];_0x114b61[_0x392e41+_0xdb22('0x67')]=_0x45f131['Interaction']['id'];_0x114b61[_0xdb22('0x68')+_0x392e41+_0x52474d+'Id']=_0x45f131[_0xdb22('0x62')]['id'];return db[_0x392e41+'TransferReport'][_0xdb22('0x6b')](_0x114b61);})[_0xdb22('0xa')](function(){return respondWithRpcPromise(_0xdb22('0x6c'),{'channel':_0x11c9f0,'interaction':_0x45f131[_0xdb22('0x61')],'message':_0x45f131,'account':_0x45f131[_0xdb22('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0xdb22('0x73'),'appdata':_0x285fb4[_0xdb22('0x11')]+','+(_0x45f131[_0xdb22('0x62')][_0xdb22('0x74')]||0x12c),'interval':_0xdb22('0x6e')}]},routingClient);})[_0xdb22('0xa')](respondWithResult(_0x432150,null))[_0xdb22('0xf')](handleError(_0x432150,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 0147773..268e898 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 _0x64ac=['destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id','/:id/run','run','put','update','delete'];(function(_0x4b1a02,_0x5bcc52){var _0x11cae8=function(_0x2e5906){while(--_0x2e5906){_0x4b1a02['push'](_0x4b1a02['shift']());}};_0x11cae8(++_0x5bcc52);}(_0x64ac,0xce));var _0xc64a=function(_0x2ddd36,_0x4dcd8e){_0x2ddd36=_0x2ddd36-0x0;var _0x2109e7=_0x64ac[_0x2ddd36];return _0x2109e7;};'use strict';var multer=require(_0xc64a('0x0'));var util=require(_0xc64a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc64a('0x2')]();var auth=require(_0xc64a('0x3'));var interaction=require(_0xc64a('0x4'));var config=require(_0xc64a('0x5'));var controller=require(_0xc64a('0x6'));router[_0xc64a('0x7')]('/',auth[_0xc64a('0x8')](),controller['index']);router[_0xc64a('0x7')](_0xc64a('0x9'),auth[_0xc64a('0x8')](),controller['show']);router[_0xc64a('0x7')](_0xc64a('0xa'),auth[_0xc64a('0x8')](),controller[_0xc64a('0xb')]);router['post']('/',auth[_0xc64a('0x8')](),controller['create']);router[_0xc64a('0xc')](_0xc64a('0x9'),auth['isAuthenticated'](),controller[_0xc64a('0xd')]);router[_0xc64a('0xe')]('/:id',auth[_0xc64a('0x8')](),controller[_0xc64a('0xf')]);module[_0xc64a('0x10')]=router; \ No newline at end of file +var _0x3e4c=['update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','/:id','show','run','post','isAuthenticated','create','put'];(function(_0x47b7c9,_0x3848b2){var _0x435aaf=function(_0x3befc4){while(--_0x3befc4){_0x47b7c9['push'](_0x47b7c9['shift']());}};_0x435aaf(++_0x3848b2);}(_0x3e4c,0x157));var _0xc3e4=function(_0x3d5b98,_0x5a02fb){_0x3d5b98=_0x3d5b98-0x0;var _0x4be4df=_0x3e4c[_0x3d5b98];return _0x4be4df;};'use strict';var multer=require(_0xc3e4('0x0'));var util=require(_0xc3e4('0x1'));var path=require('path');var timeout=require(_0xc3e4('0x2'));var express=require(_0xc3e4('0x3'));var router=express['Router']();var auth=require(_0xc3e4('0x4'));var interaction=require(_0xc3e4('0x5'));var config=require(_0xc3e4('0x6'));var controller=require(_0xc3e4('0x7'));router[_0xc3e4('0x8')]('/',auth['isAuthenticated'](),controller[_0xc3e4('0x9')]);router['get'](_0xc3e4('0xa'),auth['isAuthenticated'](),controller[_0xc3e4('0xb')]);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0xc3e4('0xc')]);router[_0xc3e4('0xd')]('/',auth[_0xc3e4('0xe')](),controller[_0xc3e4('0xf')]);router[_0xc3e4('0x10')]('/:id',auth[_0xc3e4('0xe')](),controller[_0xc3e4('0x11')]);router[_0xc3e4('0x12')](_0xc3e4('0xa'),auth[_0xc3e4('0xe')](),controller['destroy']);module[_0xc3e4('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 1b723c9..4cd5b22 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 _0x9fd4=['custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years','quarters','months','weeks','hours','minutes','days','ENUM','csv','xlsx'];(function(_0x182ccb,_0x2c0bba){var _0x51b581=function(_0x2db152){while(--_0x2db152){_0x182ccb['push'](_0x182ccb['shift']());}};_0x51b581(++_0x2c0bba);}(_0x9fd4,0x16c));var _0x49fd=function(_0x4135e7,_0x14f68b){_0x4135e7=_0x4135e7-0x0;var _0x3032f9=_0x9fd4[_0x4135e7];return _0x3032f9;};'use strict';var Sequelize=require(_0x49fd('0x0'));module[_0x49fd('0x1')]={'name':{'type':Sequelize[_0x49fd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x49fd('0x2')]},'active':{'type':Sequelize[_0x49fd('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x49fd('0x2')],'allowNull':![],'defaultValue':_0x49fd('0x4')},'startAt':{'type':Sequelize[_0x49fd('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x49fd('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x49fd('0x6'),_0x49fd('0x7'),_0x49fd('0x8'),_0x49fd('0x9'),'days',_0x49fd('0xa'),_0x49fd('0xb')),'allowNull':![],'defaultValue':_0x49fd('0xc')},'output':{'type':Sequelize[_0x49fd('0xd')](_0x49fd('0xe'),'pdf',_0x49fd('0xf')),'allowNull':![],'defaultValue':_0x49fd('0xe')},'type':{'type':Sequelize[_0x49fd('0xd')](_0x49fd('0x10'),_0x49fd('0x11')),'allowNull':![],'defaultValue':_0x49fd('0x10')},'sendMail':{'type':Sequelize[_0x49fd('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x49fd('0x12')]},'bcc':{'type':Sequelize[_0x49fd('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x49fd('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7046=['sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','days','pdf','xlsx','csv','custom','default','BOOLEAN','TEXT'];(function(_0x40c5d9,_0x2be0d2){var _0x2660c0=function(_0x5d3ca0){while(--_0x5d3ca0){_0x40c5d9['push'](_0x40c5d9['shift']());}};_0x2660c0(++_0x2be0d2);}(_0x7046,0x144));var _0x6704=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7046[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x6704('0x0'));module[_0x6704('0x1')]={'name':{'type':Sequelize[_0x6704('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6704('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x6704('0x2')],'allowNull':![],'defaultValue':_0x6704('0x3')},'startAt':{'type':Sequelize[_0x6704('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x6704('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x6704('0x6')](_0x6704('0x7'),_0x6704('0x8'),_0x6704('0x9'),'weeks',_0x6704('0xa'),'hours','minutes'),'allowNull':![],'defaultValue':_0x6704('0xa')},'output':{'type':Sequelize['ENUM']('csv',_0x6704('0xb'),_0x6704('0xc')),'allowNull':![],'defaultValue':_0x6704('0xd')},'type':{'type':Sequelize[_0x6704('0x6')](_0x6704('0xe'),_0x6704('0xf')),'allowNull':![],'defaultValue':_0x6704('0xe')},'sendMail':{'type':Sequelize[_0x6704('0x10')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x6704('0x11')]},'bcc':{'type':Sequelize[_0x6704('0x11')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index c4849c9..d9c432a 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 _0x7c91=['error','name','send','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','run','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','then','Scheduler','UserProfileResource'];(function(_0x226e73,_0x2d90e2){var _0x51edf7=function(_0x5cbd5b){while(--_0x5cbd5b){_0x226e73['push'](_0x226e73['shift']());}};_0x51edf7(++_0x2d90e2);}(_0x7c91,0x119));var _0x17c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c91[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x17c9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x17c9('0x1'));var zipdir=require(_0x17c9('0x2'));var jsonpatch=require(_0x17c9('0x3'));var rp=require(_0x17c9('0x4'));var moment=require(_0x17c9('0x5'));var BPromise=require(_0x17c9('0x6'));var Mustache=require('mustache');var util=require(_0x17c9('0x7'));var path=require(_0x17c9('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x17c9('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x17c9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x17c9('0xb'));var toCsv=require(_0x17c9('0xc'));var querystring=require(_0x17c9('0xd'));var Papa=require('papaparse');var Redis=require(_0x17c9('0xe'));var authService=require(_0x17c9('0xf'));var qs=require(_0x17c9('0x10'));var as=require(_0x17c9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x17c9('0x12'))('api');var utils=require(_0x17c9('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4eea79,_0x50874c){_0x50874c=_0x50874c||0xcc;return function(_0x73f59a){if(_0x73f59a){return _0x4eea79[_0x17c9('0x14')](_0x50874c);}return _0x4eea79[_0x17c9('0x15')](_0x50874c)[_0x17c9('0x16')]();};}function respondWithResult(_0x5f266b,_0x4f1282){_0x4f1282=_0x4f1282||0xc8;return function(_0x3778d9){if(_0x3778d9){return _0x5f266b[_0x17c9('0x15')](_0x4f1282)[_0x17c9('0x17')](_0x3778d9);}};}function respondWithFilteredResult(_0x2f4e4a,_0x2ced28){return function(_0x313803){if(_0x313803){var _0x277496=_0x313803['count'],_0x38b36c=_0x2ced28['offset'],_0xf18c7=_0x2ced28[_0x17c9('0x18')]+_0x2ced28[_0x17c9('0x19')],_0x7deddd;if(_0xf18c7>=_0x277496){_0xf18c7=_0x277496;_0x7deddd=0xc8;}else{_0x7deddd=0xce;}_0x2f4e4a[_0x17c9('0x15')](_0x7deddd);return _0x2f4e4a[_0x17c9('0x1a')]('Content-Range',_0x38b36c+'-'+_0xf18c7+'/'+_0x277496)[_0x17c9('0x17')](_0x313803);}return null;};}function patchUpdates(_0x4d5161){return function(_0x21d98a){try{jsonpatch[_0x17c9('0x1b')](_0x21d98a,_0x4d5161,!![]);}catch(_0x3034a3){return BPromise[_0x17c9('0x1c')](_0x3034a3);}return _0x21d98a[_0x17c9('0x1d')]();};}function saveUpdates(_0x3deff8,_0x24e296){return function(_0x29c8ea){if(_0x29c8ea){return _0x29c8ea[_0x17c9('0x1e')](_0x3deff8)['then'](function(_0x8fd4c9){return _0x8fd4c9;});}return null;};}function removeEntity(_0xffbf84,_0x528410){return function(_0x67b61f){if(_0x67b61f){return _0x67b61f[_0x17c9('0x1f')]()[_0x17c9('0x20')](function(){var _0x435574=_0x67b61f['get']({'plain':!![]});var _0x23db5a=_0x17c9('0x21');return db[_0x17c9('0x22')][_0x17c9('0x1f')]({'where':{'type':_0x23db5a,'resourceId':_0x435574['id']}})[_0x17c9('0x20')](function(){return _0x67b61f;});})['then'](function(){_0xffbf84[_0x17c9('0x15')](0xcc)[_0x17c9('0x16')]();});}};}function handleEntityNotFound(_0x4aada5,_0x3dfac9){return function(_0x38d40d){if(!_0x38d40d){_0x4aada5[_0x17c9('0x14')](0x194);}return _0x38d40d;};}function handleError(_0x32a377,_0x4a0cd1){_0x4a0cd1=_0x4a0cd1||0x1f4;return function(_0x2ee5b4){logger[_0x17c9('0x23')](_0x2ee5b4['stack']);if(_0x2ee5b4['name']){delete _0x2ee5b4[_0x17c9('0x24')];}_0x32a377[_0x17c9('0x15')](_0x4a0cd1)[_0x17c9('0x25')](_0x2ee5b4);};}exports['index']=function(_0x222aac,_0x60b0d){var _0x52b513={},_0x28e3b0={},_0x50904c={'count':0x0,'rows':[]};var _0x9a0011=_[_0x17c9('0x26')](db[_0x17c9('0x27')][_0x17c9('0x28')],function(_0x299595){return{'name':_0x299595[_0x17c9('0x29')],'type':_0x299595[_0x17c9('0x2a')][_0x17c9('0x2b')]};});_0x28e3b0[_0x17c9('0x2c')]=_[_0x17c9('0x26')](_0x9a0011,_0x17c9('0x24'));_0x28e3b0[_0x17c9('0x2d')]=_[_0x17c9('0x2e')](_0x222aac['query']);_0x28e3b0['filters']=_[_0x17c9('0x2f')](_0x28e3b0[_0x17c9('0x2c')],_0x28e3b0[_0x17c9('0x2d')]);_0x52b513[_0x17c9('0x30')]=_['intersection'](_0x28e3b0[_0x17c9('0x2c')],qs[_0x17c9('0x31')](_0x222aac[_0x17c9('0x2d')]['fields']));_0x52b513[_0x17c9('0x30')]=_0x52b513[_0x17c9('0x30')][_0x17c9('0x32')]?_0x52b513[_0x17c9('0x30')]:_0x28e3b0[_0x17c9('0x2c')];if(!_0x222aac[_0x17c9('0x2d')]['hasOwnProperty'](_0x17c9('0x33'))){_0x52b513[_0x17c9('0x19')]=qs[_0x17c9('0x19')](_0x222aac[_0x17c9('0x2d')][_0x17c9('0x19')]);_0x52b513[_0x17c9('0x18')]=qs[_0x17c9('0x18')](_0x222aac['query']['offset']);}_0x52b513[_0x17c9('0x34')]=qs[_0x17c9('0x35')](_0x222aac[_0x17c9('0x2d')][_0x17c9('0x35')]);_0x52b513[_0x17c9('0x36')]=qs[_0x17c9('0x37')](_['pick'](_0x222aac[_0x17c9('0x2d')],_0x28e3b0[_0x17c9('0x37')]),_0x9a0011);if(_0x222aac[_0x17c9('0x2d')]['filter']){_0x52b513[_0x17c9('0x36')]=_[_0x17c9('0x38')](_0x52b513[_0x17c9('0x36')],{'$or':_[_0x17c9('0x26')](_0x9a0011,function(_0x2e052e){if(_0x2e052e[_0x17c9('0x2a')]!==_0x17c9('0x39')){var _0x5b8d60={};_0x5b8d60[_0x2e052e[_0x17c9('0x24')]]={'$like':'%'+_0x222aac[_0x17c9('0x2d')][_0x17c9('0x3a')]+'%'};return _0x5b8d60;}})});}_0x52b513=_['merge']({},_0x52b513,_0x222aac[_0x17c9('0x3b')]);var _0x154b0c={'where':_0x52b513[_0x17c9('0x36')]};return db['Schedule'][_0x17c9('0x3c')](_0x154b0c)[_0x17c9('0x20')](function(_0x9af3de){_0x50904c[_0x17c9('0x3c')]=_0x9af3de;if(_0x222aac[_0x17c9('0x2d')][_0x17c9('0x3d')]){_0x52b513[_0x17c9('0x3e')]=[{'all':!![]}];}return db[_0x17c9('0x27')][_0x17c9('0x3f')](_0x52b513);})[_0x17c9('0x20')](function(_0x261e88){_0x50904c[_0x17c9('0x40')]=_0x261e88;return _0x50904c;})['then'](respondWithFilteredResult(_0x60b0d,_0x52b513))[_0x17c9('0x41')](handleError(_0x60b0d,null));};exports[_0x17c9('0x42')]=function(_0x2177d0,_0x42005b){var _0x2d95d6={'raw':![],'where':{'id':_0x2177d0[_0x17c9('0x43')]['id']}},_0x8dee77={};_0x8dee77[_0x17c9('0x2c')]=_[_0x17c9('0x2e')](db[_0x17c9('0x27')][_0x17c9('0x28')]);_0x8dee77[_0x17c9('0x2d')]=_['keys'](_0x2177d0[_0x17c9('0x2d')]);_0x8dee77[_0x17c9('0x37')]=_[_0x17c9('0x2f')](_0x8dee77[_0x17c9('0x2c')],_0x8dee77[_0x17c9('0x2d')]);_0x2d95d6['attributes']=_['intersection'](_0x8dee77['model'],qs[_0x17c9('0x31')](_0x2177d0[_0x17c9('0x2d')][_0x17c9('0x31')]));_0x2d95d6[_0x17c9('0x30')]=_0x2d95d6[_0x17c9('0x30')][_0x17c9('0x32')]?_0x2d95d6['attributes']:_0x8dee77[_0x17c9('0x2c')];if(_0x2177d0['query'][_0x17c9('0x3d')]){_0x2d95d6['include']=[{'all':!![]}];}_0x2d95d6=_['merge']({},_0x2d95d6,_0x2177d0[_0x17c9('0x3b')]);return db[_0x17c9('0x27')][_0x17c9('0x44')](_0x2d95d6)[_0x17c9('0x20')](handleEntityNotFound(_0x42005b,null))['then'](respondWithResult(_0x42005b,null))[_0x17c9('0x41')](handleError(_0x42005b,null));};exports[_0x17c9('0x45')]=function(_0x19ce5e,_0xa52bb){return db['Schedule'][_0x17c9('0x45')](_0x19ce5e[_0x17c9('0x46')],{})['then'](function(_0x36ec24){var _0x48b7a=_0x19ce5e[_0x17c9('0x47')][_0x17c9('0x48')]({'plain':!![]});if(!_0x48b7a)throw new Error(_0x17c9('0x49'));if(_0x48b7a[_0x17c9('0x4a')]===_0x17c9('0x47')){var _0x2c8f35=_0x36ec24[_0x17c9('0x48')]({'plain':!![]});var _0x49eaca=_0x17c9('0x21');return db[_0x17c9('0x4b')][_0x17c9('0x44')]({'where':{'name':_0x49eaca,'userProfileId':_0x48b7a[_0x17c9('0x4c')]},'raw':!![]})['then'](function(_0xd81da8){if(_0xd81da8&&_0xd81da8[_0x17c9('0x4d')]===0x0){return db[_0x17c9('0x22')]['create']({'name':_0x2c8f35[_0x17c9('0x24')],'resourceId':_0x2c8f35['id'],'type':_0xd81da8['name'],'sectionId':_0xd81da8['id']},{})['then'](function(){return _0x36ec24;});}else{return _0x36ec24;}})[_0x17c9('0x41')](function(_0x305a8c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x305a8c);throw _0x305a8c;});}return _0x36ec24;})['then'](respondWithResult(_0xa52bb,0xc9))[_0x17c9('0x41')](handleError(_0xa52bb,null));};exports['update']=function(_0x154bde,_0x47f916){if(_0x154bde[_0x17c9('0x46')]['id']){delete _0x154bde[_0x17c9('0x46')]['id'];}return db[_0x17c9('0x27')][_0x17c9('0x44')]({'where':{'id':_0x154bde[_0x17c9('0x43')]['id']}})[_0x17c9('0x20')](handleEntityNotFound(_0x47f916,null))[_0x17c9('0x20')](saveUpdates(_0x154bde[_0x17c9('0x46')],null))[_0x17c9('0x20')](respondWithResult(_0x47f916,null))[_0x17c9('0x41')](handleError(_0x47f916,null));};exports[_0x17c9('0x1f')]=function(_0x3716bb,_0x1e2508){return db[_0x17c9('0x27')][_0x17c9('0x44')]({'where':{'id':_0x3716bb[_0x17c9('0x43')]['id']}})[_0x17c9('0x20')](handleEntityNotFound(_0x1e2508,null))[_0x17c9('0x20')](removeEntity(_0x1e2508,null))[_0x17c9('0x41')](handleError(_0x1e2508,null));};exports[_0x17c9('0x4e')]=function(_0x57f4d3,_0x3cb5d8,_0x3dd369){var _0x282de0=require('../../config/schedule');return db[_0x17c9('0x27')]['find']({'where':{'id':_0x57f4d3[_0x17c9('0x43')]['id']},'raw':!![]})[_0x17c9('0x20')](handleEntityNotFound(_0x3cb5d8,null))[_0x17c9('0x20')](function(){_0x282de0[_0x17c9('0x4e')](_0x57f4d3[_0x17c9('0x43')]['id']);})[_0x17c9('0x20')](respondWithStatusCode(_0x3cb5d8,null))[_0x17c9('0x41')](handleError(_0x3cb5d8,null));}; \ No newline at end of file +var _0x2904=['mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Scheduler','end','stack','name','send','index','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','Schedule','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5676b6,_0x237ac9){var _0x5891b9=function(_0x278038){while(--_0x278038){_0x5676b6['push'](_0x5676b6['shift']());}};_0x5891b9(++_0x237ac9);}(_0x2904,0xf1));var _0x4290=function(_0x2cfed5,_0x47ef93){_0x2cfed5=_0x2cfed5-0x0;var _0x40659f=_0x2904[_0x2cfed5];return _0x40659f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4290('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4290('0x1'));var jsonpatch=require(_0x4290('0x2'));var rp=require(_0x4290('0x3'));var moment=require(_0x4290('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4290('0x5'));var util=require(_0x4290('0x6'));var path=require(_0x4290('0x7'));var sox=require('sox');var csv=require(_0x4290('0x8'));var ejs=require(_0x4290('0x9'));var fs=require('fs');var _=require(_0x4290('0xa'));var squel=require(_0x4290('0xb'));var crypto=require(_0x4290('0xc'));var jsforce=require(_0x4290('0xd'));var deskjs=require(_0x4290('0xe'));var toCsv=require(_0x4290('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4290('0xf'));var qs=require(_0x4290('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4290('0x11'));var logger=require(_0x4290('0x12'))(_0x4290('0x13'));var utils=require(_0x4290('0x14'));var config=require(_0x4290('0x15'));var db=require(_0x4290('0x16'))['db'];function respondWithStatusCode(_0x5284e8,_0x70e02d){_0x70e02d=_0x70e02d||0xcc;return function(_0x456d3b){if(_0x456d3b){return _0x5284e8[_0x4290('0x17')](_0x70e02d);}return _0x5284e8[_0x4290('0x18')](_0x70e02d)['end']();};}function respondWithResult(_0xdccdff,_0x2e70df){_0x2e70df=_0x2e70df||0xc8;return function(_0x319b87){if(_0x319b87){return _0xdccdff[_0x4290('0x18')](_0x2e70df)[_0x4290('0x19')](_0x319b87);}};}function respondWithFilteredResult(_0x13faa1,_0x1fc3bb){return function(_0x40fdcd){if(_0x40fdcd){var _0xec2367=_0x40fdcd[_0x4290('0x1a')],_0x151f9a=_0x1fc3bb['offset'],_0x3954a0=_0x1fc3bb[_0x4290('0x1b')]+_0x1fc3bb[_0x4290('0x1c')],_0x4b3555;if(_0x3954a0>=_0xec2367){_0x3954a0=_0xec2367;_0x4b3555=0xc8;}else{_0x4b3555=0xce;}_0x13faa1[_0x4290('0x18')](_0x4b3555);return _0x13faa1[_0x4290('0x1d')](_0x4290('0x1e'),_0x151f9a+'-'+_0x3954a0+'/'+_0xec2367)[_0x4290('0x19')](_0x40fdcd);}return null;};}function patchUpdates(_0x5c220a){return function(_0x431f0a){try{jsonpatch[_0x4290('0x1f')](_0x431f0a,_0x5c220a,!![]);}catch(_0x7a0c00){return BPromise[_0x4290('0x20')](_0x7a0c00);}return _0x431f0a[_0x4290('0x21')]();};}function saveUpdates(_0x5bec63,_0x6d9816){return function(_0x249e6a){if(_0x249e6a){return _0x249e6a[_0x4290('0x22')](_0x5bec63)['then'](function(_0x45cbbe){return _0x45cbbe;});}return null;};}function removeEntity(_0x309cf6,_0x298705){return function(_0x495708){if(_0x495708){return _0x495708[_0x4290('0x23')]()[_0x4290('0x24')](function(){var _0x9311f4=_0x495708[_0x4290('0x25')]({'plain':!![]});var _0x2636ff=_0x4290('0x26');return db['UserProfileResource'][_0x4290('0x23')]({'where':{'type':_0x2636ff,'resourceId':_0x9311f4['id']}})[_0x4290('0x24')](function(){return _0x495708;});})[_0x4290('0x24')](function(){_0x309cf6[_0x4290('0x18')](0xcc)[_0x4290('0x27')]();});}};}function handleEntityNotFound(_0x40ffa7,_0x1f102a){return function(_0x5a97bd){if(!_0x5a97bd){_0x40ffa7[_0x4290('0x17')](0x194);}return _0x5a97bd;};}function handleError(_0x22f548,_0x25050b){_0x25050b=_0x25050b||0x1f4;return function(_0x53ff58){logger['error'](_0x53ff58[_0x4290('0x28')]);if(_0x53ff58[_0x4290('0x29')]){delete _0x53ff58[_0x4290('0x29')];}_0x22f548[_0x4290('0x18')](_0x25050b)[_0x4290('0x2a')](_0x53ff58);};}exports[_0x4290('0x2b')]=function(_0x3fa30d,_0x4becb4){var _0x20e1ff={},_0x5a299b={},_0x4d600f={'count':0x0,'rows':[]};var _0x437e6f=_['map'](db['Schedule']['rawAttributes'],function(_0x5d1892){return{'name':_0x5d1892['fieldName'],'type':_0x5d1892[_0x4290('0x2c')][_0x4290('0x2d')]};});_0x5a299b[_0x4290('0x2e')]=_[_0x4290('0x2f')](_0x437e6f,_0x4290('0x29'));_0x5a299b[_0x4290('0x30')]=_[_0x4290('0x31')](_0x3fa30d[_0x4290('0x30')]);_0x5a299b['filters']=_[_0x4290('0x32')](_0x5a299b[_0x4290('0x2e')],_0x5a299b[_0x4290('0x30')]);_0x20e1ff[_0x4290('0x33')]=_[_0x4290('0x32')](_0x5a299b['model'],qs[_0x4290('0x34')](_0x3fa30d[_0x4290('0x30')]['fields']));_0x20e1ff[_0x4290('0x33')]=_0x20e1ff[_0x4290('0x33')][_0x4290('0x35')]?_0x20e1ff[_0x4290('0x33')]:_0x5a299b[_0x4290('0x2e')];if(!_0x3fa30d[_0x4290('0x30')][_0x4290('0x36')](_0x4290('0x37'))){_0x20e1ff['limit']=qs[_0x4290('0x1c')](_0x3fa30d[_0x4290('0x30')][_0x4290('0x1c')]);_0x20e1ff['offset']=qs[_0x4290('0x1b')](_0x3fa30d[_0x4290('0x30')][_0x4290('0x1b')]);}_0x20e1ff['order']=qs['sort'](_0x3fa30d[_0x4290('0x30')][_0x4290('0x38')]);_0x20e1ff[_0x4290('0x39')]=qs[_0x4290('0x3a')](_[_0x4290('0x3b')](_0x3fa30d[_0x4290('0x30')],_0x5a299b['filters']),_0x437e6f);if(_0x3fa30d[_0x4290('0x30')][_0x4290('0x3c')]){_0x20e1ff[_0x4290('0x39')]=_[_0x4290('0x3d')](_0x20e1ff[_0x4290('0x39')],{'$or':_[_0x4290('0x2f')](_0x437e6f,function(_0x169573){if(_0x169573[_0x4290('0x2c')]!==_0x4290('0x3e')){var _0x3e37f5={};_0x3e37f5[_0x169573['name']]={'$like':'%'+_0x3fa30d['query'][_0x4290('0x3c')]+'%'};return _0x3e37f5;}})});}_0x20e1ff=_[_0x4290('0x3d')]({},_0x20e1ff,_0x3fa30d[_0x4290('0x3f')]);var _0x32b50b={'where':_0x20e1ff['where']};return db[_0x4290('0x40')][_0x4290('0x1a')](_0x32b50b)[_0x4290('0x24')](function(_0x55b0d3){_0x4d600f['count']=_0x55b0d3;if(_0x3fa30d[_0x4290('0x30')][_0x4290('0x41')]){_0x20e1ff[_0x4290('0x42')]=[{'all':!![]}];}return db['Schedule'][_0x4290('0x43')](_0x20e1ff);})[_0x4290('0x24')](function(_0x2f552e){_0x4d600f['rows']=_0x2f552e;return _0x4d600f;})[_0x4290('0x24')](respondWithFilteredResult(_0x4becb4,_0x20e1ff))[_0x4290('0x44')](handleError(_0x4becb4,null));};exports[_0x4290('0x45')]=function(_0x25aabf,_0x1bd8d8){var _0x38be53={'raw':![],'where':{'id':_0x25aabf[_0x4290('0x46')]['id']}},_0x2a70bd={};_0x2a70bd[_0x4290('0x2e')]=_['keys'](db[_0x4290('0x40')][_0x4290('0x47')]);_0x2a70bd[_0x4290('0x30')]=_[_0x4290('0x31')](_0x25aabf[_0x4290('0x30')]);_0x2a70bd['filters']=_['intersection'](_0x2a70bd['model'],_0x2a70bd[_0x4290('0x30')]);_0x38be53[_0x4290('0x33')]=_[_0x4290('0x32')](_0x2a70bd[_0x4290('0x2e')],qs['fields'](_0x25aabf[_0x4290('0x30')][_0x4290('0x34')]));_0x38be53[_0x4290('0x33')]=_0x38be53[_0x4290('0x33')][_0x4290('0x35')]?_0x38be53['attributes']:_0x2a70bd[_0x4290('0x2e')];if(_0x25aabf[_0x4290('0x30')][_0x4290('0x41')]){_0x38be53[_0x4290('0x42')]=[{'all':!![]}];}_0x38be53=_[_0x4290('0x3d')]({},_0x38be53,_0x25aabf[_0x4290('0x3f')]);return db[_0x4290('0x40')][_0x4290('0x48')](_0x38be53)[_0x4290('0x24')](handleEntityNotFound(_0x1bd8d8,null))[_0x4290('0x24')](respondWithResult(_0x1bd8d8,null))[_0x4290('0x44')](handleError(_0x1bd8d8,null));};exports[_0x4290('0x49')]=function(_0x10585e,_0x30dab8){return db[_0x4290('0x40')][_0x4290('0x49')](_0x10585e['body'],{})['then'](function(_0x4c16bd){var _0x413a02=_0x10585e['user'][_0x4290('0x25')]({'plain':!![]});if(!_0x413a02)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x413a02[_0x4290('0x4a')]==='user'){var _0x13eb7b=_0x4c16bd[_0x4290('0x25')]({'plain':!![]});var _0xcaa42f=_0x4290('0x26');return db['UserProfileSection']['find']({'where':{'name':_0xcaa42f,'userProfileId':_0x413a02[_0x4290('0x4b')]},'raw':!![]})['then'](function(_0x5d8935){if(_0x5d8935&&_0x5d8935[_0x4290('0x4c')]===0x0){return db[_0x4290('0x4d')][_0x4290('0x49')]({'name':_0x13eb7b[_0x4290('0x29')],'resourceId':_0x13eb7b['id'],'type':_0x5d8935[_0x4290('0x29')],'sectionId':_0x5d8935['id']},{})['then'](function(){return _0x4c16bd;});}else{return _0x4c16bd;}})[_0x4290('0x44')](function(_0x40f45d){logger['error'](_0x4290('0x4e'),_0x40f45d);throw _0x40f45d;});}return _0x4c16bd;})[_0x4290('0x24')](respondWithResult(_0x30dab8,0xc9))[_0x4290('0x44')](handleError(_0x30dab8,null));};exports['update']=function(_0x518d63,_0x54d9d2){if(_0x518d63[_0x4290('0x4f')]['id']){delete _0x518d63[_0x4290('0x4f')]['id'];}return db['Schedule'][_0x4290('0x48')]({'where':{'id':_0x518d63[_0x4290('0x46')]['id']}})[_0x4290('0x24')](handleEntityNotFound(_0x54d9d2,null))[_0x4290('0x24')](saveUpdates(_0x518d63[_0x4290('0x4f')],null))['then'](respondWithResult(_0x54d9d2,null))[_0x4290('0x44')](handleError(_0x54d9d2,null));};exports['destroy']=function(_0x33668c,_0xa726e9){return db[_0x4290('0x40')][_0x4290('0x48')]({'where':{'id':_0x33668c['params']['id']}})[_0x4290('0x24')](handleEntityNotFound(_0xa726e9,null))[_0x4290('0x24')](removeEntity(_0xa726e9,null))[_0x4290('0x44')](handleError(_0xa726e9,null));};exports[_0x4290('0x50')]=function(_0x3a4827,_0x416072,_0x58a2ab){var _0x4c75a3=require(_0x4290('0x51'));return db[_0x4290('0x40')]['find']({'where':{'id':_0x3a4827['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x416072,null))[_0x4290('0x24')](function(){_0x4c75a3[_0x4290('0x50')](_0x3a4827[_0x4290('0x46')]['id']);})[_0x4290('0x24')](respondWithStatusCode(_0x416072,null))[_0x4290('0x44')](handleError(_0x416072,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index d148393..caa3e14 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 _0x37df=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./schedule.attributes','Schedule','tools_schedules'];(function(_0x5c4bf7,_0x265f35){var _0x57b8c9=function(_0x5091d3){while(--_0x5091d3){_0x5c4bf7['push'](_0x5c4bf7['shift']());}};_0x57b8c9(++_0x265f35);}(_0x37df,0xa8));var _0xf37d=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0x37df[_0x54ccd7];return _0x4e667b;};'use strict';var _=require(_0xf37d('0x0'));var util=require(_0xf37d('0x1'));var logger=require(_0xf37d('0x2'))(_0xf37d('0x3'));var moment=require(_0xf37d('0x4'));var BPromise=require(_0xf37d('0x5'));var rp=require(_0xf37d('0x6'));var fs=require('fs');var path=require(_0xf37d('0x7'));var rimraf=require(_0xf37d('0x8'));var config=require('../../config/environment');var attributes=require(_0xf37d('0x9'));module['exports']=function(_0x3f1e2c,_0x241fc7){return _0x3f1e2c['define'](_0xf37d('0xa'),attributes,{'tableName':_0xf37d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85e5=['path','rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','lodash','util','bluebird'];(function(_0x5e7fe0,_0x48f825){var _0x4a38d6=function(_0x1d5a28){while(--_0x1d5a28){_0x5e7fe0['push'](_0x5e7fe0['shift']());}};_0x4a38d6(++_0x48f825);}(_0x85e5,0x1f1));var _0x585e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x85e5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x585e('0x0'));var util=require(_0x585e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x585e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x585e('0x3'));var rimraf=require(_0x585e('0x4'));var config=require(_0x585e('0x5'));var attributes=require(_0x585e('0x6'));module[_0x585e('0x7')]=function(_0xb82be3,_0x37871b){return _0xb82be3[_0x585e('0x8')]('Schedule',attributes,{'tableName':_0x585e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index b831f90..30e3d4c 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 _0xc349=['lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','result','catch'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xc349,0x1a2));var _0x9c34=function(_0x447d82,_0xc7eba3){_0x447d82=_0x447d82-0x0;var _0x41d429=_0xc349[_0x447d82];return _0x41d429;};'use strict';var _=require(_0x9c34('0x0'));var util=require(_0x9c34('0x1'));var moment=require(_0x9c34('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c34('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c34('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c34('0x5'))('rpc');var config=require(_0x9c34('0x6'));var jayson=require(_0x9c34('0x7'));var client=jayson[_0x9c34('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a234c,_0x25bfe5,_0x50e84b){return new BPromise(function(_0xfc6bf1,_0x35ad6b){return client[_0x9c34('0x9')](_0x1a234c,_0x50e84b)[_0x9c34('0xa')](function(_0x143b56){logger[_0x9c34('0xb')]('Schedule,\x20%s,\x20%s',_0x25bfe5,_0x9c34('0xc'));logger[_0x9c34('0xd')](_0x9c34('0xe'),_0x25bfe5,'request\x20sent',JSON[_0x9c34('0xf')](_0x143b56));if(_0x143b56['error']){if(_0x143b56[_0x9c34('0x10')][_0x9c34('0x11')]===0x1f4){logger['error'](_0x9c34('0x12'),_0x25bfe5,_0x143b56['error'][_0x9c34('0x13')]);return _0x35ad6b(_0x143b56[_0x9c34('0x10')][_0x9c34('0x13')]);}logger['error'](_0x9c34('0x12'),_0x25bfe5,_0x143b56[_0x9c34('0x10')][_0x9c34('0x13')]);return _0xfc6bf1(_0x143b56[_0x9c34('0x10')][_0x9c34('0x13')]);}else{logger[_0x9c34('0xb')](_0x9c34('0x12'),_0x25bfe5,'request\x20sent');_0xfc6bf1(_0x143b56[_0x9c34('0x14')][_0x9c34('0x13')]);}})[_0x9c34('0x15')](function(_0x3370c5){logger[_0x9c34('0x10')](_0x9c34('0x12'),_0x25bfe5,_0x3370c5);_0x35ad6b(_0x3370c5);});});} \ No newline at end of file +var _0x4828=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Schedule,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4828,0xfa));var _0x8482=function(_0x4b485b,_0x509ebd){_0x4b485b=_0x4b485b-0x0;var _0xd3281f=_0x4828[_0x4b485b];return _0xd3281f;};'use strict';var _=require(_0x8482('0x0'));var util=require(_0x8482('0x1'));var moment=require('moment');var BPromise=require(_0x8482('0x2'));var rs=require(_0x8482('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8482('0x4'))['db'];var utils=require(_0x8482('0x5'));var logger=require('../../config/logger')(_0x8482('0x6'));var config=require(_0x8482('0x7'));var jayson=require(_0x8482('0x8'));var client=jayson['client'][_0x8482('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ca0d6,_0x5f4f1d,_0x1c99ce){return new BPromise(function(_0x39a820,_0x3581d3){return client[_0x8482('0xa')](_0x2ca0d6,_0x1c99ce)[_0x8482('0xb')](function(_0x4f200c){logger[_0x8482('0xc')](_0x8482('0xd'),_0x5f4f1d,_0x8482('0xe'));logger[_0x8482('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x5f4f1d,_0x8482('0xe'),JSON[_0x8482('0x10')](_0x4f200c));if(_0x4f200c[_0x8482('0x11')]){if(_0x4f200c[_0x8482('0x11')][_0x8482('0x12')]===0x1f4){logger[_0x8482('0x11')](_0x8482('0xd'),_0x5f4f1d,_0x4f200c[_0x8482('0x11')][_0x8482('0x13')]);return _0x3581d3(_0x4f200c[_0x8482('0x11')][_0x8482('0x13')]);}logger[_0x8482('0x11')](_0x8482('0xd'),_0x5f4f1d,_0x4f200c[_0x8482('0x11')][_0x8482('0x13')]);return _0x39a820(_0x4f200c[_0x8482('0x11')][_0x8482('0x13')]);}else{logger[_0x8482('0xc')]('Schedule,\x20%s,\x20%s',_0x5f4f1d,_0x8482('0xe'));_0x39a820(_0x4f200c[_0x8482('0x14')]['message']);}})[_0x8482('0x15')](function(_0x183339){logger[_0x8482('0x11')](_0x8482('0xd'),_0x5f4f1d,_0x183339);_0x3581d3(_0x183339);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 60ffecb..e28a80a 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 _0xd43c=['put','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','create'];(function(_0x207304,_0x4e669d){var _0x48179b=function(_0x3f31fe){while(--_0x3f31fe){_0x207304['push'](_0x207304['shift']());}};_0x48179b(++_0x4e669d);}(_0xd43c,0x6d));var _0xcd43=function(_0xc1ad9e,_0x237afb){_0xc1ad9e=_0xc1ad9e-0x0;var _0x167ab4=_0xd43c[_0xc1ad9e];return _0x167ab4;};'use strict';var multer=require(_0xcd43('0x0'));var util=require(_0xcd43('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcd43('0x2'));var router=express[_0xcd43('0x3')]();var auth=require(_0xcd43('0x4'));var interaction=require(_0xcd43('0x5'));var config=require(_0xcd43('0x6'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0xcd43('0x7')](),controller[_0xcd43('0x8')]);router[_0xcd43('0x9')](_0xcd43('0xa'),auth[_0xcd43('0x7')](),controller[_0xcd43('0xb')]);router[_0xcd43('0x9')](_0xcd43('0xc'),auth[_0xcd43('0x7')](),controller[_0xcd43('0xd')]);router[_0xcd43('0x9')](_0xcd43('0xe'),auth[_0xcd43('0x7')](),controller[_0xcd43('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcd43('0x10')]);router[_0xcd43('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xcd43('0x12')](_0xcd43('0xc'),auth[_0xcd43('0x7')](),controller[_0xcd43('0x13')]);module[_0xcd43('0x14')]=router; \ No newline at end of file +var _0x183e=['download','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id/download'];(function(_0x57f3c7,_0x4b1c07){var _0x308d28=function(_0x29642a){while(--_0x29642a){_0x57f3c7['push'](_0x57f3c7['shift']());}};_0x308d28(++_0x4b1c07);}(_0x183e,0x94));var _0xe183=function(_0x4b9df8,_0x280303){_0x4b9df8=_0x4b9df8-0x0;var _0x46fe17=_0x183e[_0x4b9df8];return _0x46fe17;};'use strict';var multer=require(_0xe183('0x0'));var util=require(_0xe183('0x1'));var path=require(_0xe183('0x2'));var timeout=require(_0xe183('0x3'));var express=require(_0xe183('0x4'));var router=express['Router']();var auth=require(_0xe183('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0xe183('0x6')]('/',auth[_0xe183('0x7')](),controller[_0xe183('0x8')]);router[_0xe183('0x6')](_0xe183('0x9'),auth[_0xe183('0x7')](),controller[_0xe183('0xa')]);router['get']('/:id',auth[_0xe183('0x7')](),controller['show']);router[_0xe183('0x6')](_0xe183('0xb'),auth[_0xe183('0x7')](),controller[_0xe183('0xc')]);router[_0xe183('0xd')]('/',auth[_0xe183('0x7')](),controller[_0xe183('0xe')]);router[_0xe183('0xf')](_0xe183('0x10'),auth['isAuthenticated'](),controller[_0xe183('0x11')]);router['delete'](_0xe183('0x10'),auth[_0xe183('0x7')](),controller[_0xe183('0x12')]);module[_0xe183('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 01da0f3..5137489 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 _0x0e85=['../../config/environment','exports','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','getDataValue','createdAt','toString','updatedAt','sequelize','moment'];(function(_0x1b4c52,_0x284c79){var _0xfc7094=function(_0xc324e1){while(--_0xc324e1){_0x1b4c52['push'](_0x1b4c52['shift']());}};_0xfc7094(++_0x284c79);}(_0x0e85,0x7c));var _0x50e8=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x0e85[_0x17928f];return _0x500b63;};'use strict';var Sequelize=require(_0x50e8('0x0'));var moment=require(_0x50e8('0x1'));var path=require('path');var config=require(_0x50e8('0x2'));module[_0x50e8('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('value')?path[_0x50e8('0x4')](this['getDataValue'](_0x50e8('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x50e8('0x6')]},'channel':{'type':Sequelize[_0x50e8('0x6')]},'value':{'type':Sequelize[_0x50e8('0x6')],'set':function(_0x5e8b01){var _0x3ce904=_0x5e8b01[_0x50e8('0x7')](/\\/g,'/');this[_0x50e8('0x8')](_0x50e8('0x5'),_0x3ce904);}},'rating':{'type':Sequelize[_0x50e8('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x50e8('0x9')],'set':function(_0x5825f5){this[_0x50e8('0x8')](_0x50e8('0xa'),moment()[_0x50e8('0xb')](_0x5825f5,'ms'));this[_0x50e8('0x8')](_0x50e8('0xc'),moment());this[_0x50e8('0x8')](_0x50e8('0xd'),_0x5825f5);}},'startedAt':{'type':Sequelize[_0x50e8('0xe')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0x50e8('0xf')](_0x50e8('0x10'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x50e8('0x11')](_0x50e8('0xc')))[_0x50e8('0xf')](_0x50e8('0x10'))['toString']();}},'createdAt':{'type':Sequelize[_0x50e8('0xe')],'get':function(){return moment(this[_0x50e8('0x11')](_0x50e8('0x12')))['format']('MM-DD-YYYY\x20HH:mm')[_0x50e8('0x13')]();}},'updatedAt':{'type':Sequelize[_0x50e8('0xe')],'get':function(){return moment(this[_0x50e8('0x11')](_0x50e8('0x14')))[_0x50e8('0xf')](_0x50e8('0x10'))['toString']();}}}; \ No newline at end of file +var _0x6aa7=['../../config/environment','exports','VIRTUAL','value','extname','getDataValue','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','format','updatedAt','toString','sequelize','path'];(function(_0x13bdf8,_0x171d46){var _0x4f5424=function(_0x2febb3){while(--_0x2febb3){_0x13bdf8['push'](_0x13bdf8['shift']());}};_0x4f5424(++_0x171d46);}(_0x6aa7,0x178));var _0x76aa=function(_0x35f9bc,_0x4cad46){_0x35f9bc=_0x35f9bc-0x0;var _0x381c0c=_0x6aa7[_0x35f9bc];return _0x381c0c;};'use strict';var Sequelize=require(_0x76aa('0x0'));var moment=require('moment');var path=require(_0x76aa('0x1'));var config=require(_0x76aa('0x2'));module[_0x76aa('0x3')]={'format':{'type':Sequelize[_0x76aa('0x4')],'get':function(){return this['getDataValue'](_0x76aa('0x5'))?path[_0x76aa('0x6')](this[_0x76aa('0x7')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x76aa('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x32dee5){var _0x36d12b=_0x32dee5[_0x76aa('0x9')](/\\/g,'/');this['setDataValue'](_0x76aa('0x5'),_0x36d12b);}},'rating':{'type':Sequelize[_0x76aa('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x76aa('0xa')],'set':function(_0x557d69){this[_0x76aa('0xb')](_0x76aa('0xc'),moment()[_0x76aa('0xd')](_0x557d69,'ms'));this[_0x76aa('0xb')](_0x76aa('0xe'),moment());this[_0x76aa('0xb')](_0x76aa('0xf'),_0x557d69);}},'startedAt':{'type':Sequelize[_0x76aa('0x10')],'get':function(){return moment(this[_0x76aa('0x7')](_0x76aa('0xc')))['format'](_0x76aa('0x11'))['toString']();}},'closedAt':{'type':Sequelize[_0x76aa('0x10')],'get':function(){return moment(this[_0x76aa('0x7')](_0x76aa('0xe')))[_0x76aa('0x12')](_0x76aa('0x11'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x76aa('0x7')]('createdAt'))[_0x76aa('0x12')](_0x76aa('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0x76aa('0x10')],'get':function(){return moment(this['getDataValue'](_0x76aa('0x13')))['format'](_0x76aa('0x11'))[_0x76aa('0x14')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 18799ee..71f7710 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 _0xb38e=['map','ScreenRecording','fieldName','model','format','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','findAll','catch','show','rawAttributes','length','include','find','create','body','update','duration','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','message','send','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','destroy','then','name','index'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb38e,0xa7));var _0xeb38=function(_0x1da7e3,_0x11a332){_0x1da7e3=_0x1da7e3-0x0;var _0x3abd7f=_0xb38e[_0x1da7e3];return _0x3abd7f;};'use strict';var pdf=require(_0xeb38('0x0'));var emlformat=require(_0xeb38('0x1'));var rimraf=require(_0xeb38('0x2'));var zipdir=require(_0xeb38('0x3'));var jsonpatch=require(_0xeb38('0x4'));var rp=require(_0xeb38('0x5'));var moment=require(_0xeb38('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xeb38('0x7'));var util=require(_0xeb38('0x8'));var path=require('path');var sox=require(_0xeb38('0x9'));var csv=require(_0xeb38('0xa'));var ejs=require(_0xeb38('0xb'));var fs=require('fs');var _=require(_0xeb38('0xc'));var squel=require('squel');var crypto=require(_0xeb38('0xd'));var jsforce=require(_0xeb38('0xe'));var deskjs=require(_0xeb38('0xf'));var toCsv=require(_0xeb38('0xa'));var querystring=require('querystring');var Papa=require(_0xeb38('0x10'));var Redis=require(_0xeb38('0x11'));var authService=require(_0xeb38('0x12'));var qs=require(_0xeb38('0x13'));var as=require(_0xeb38('0x14'));var hardwareService=require(_0xeb38('0x15'));var logger=require(_0xeb38('0x16'))('api');var utils=require(_0xeb38('0x17'));var config=require('../../config/environment');var db=require(_0xeb38('0x18'))['db'];function respondWithStatusCode(_0x43fdd5,_0x5c0713){_0x5c0713=_0x5c0713||0xcc;return function(_0x3cadca){if(_0x3cadca){return _0x43fdd5[_0xeb38('0x19')](_0x5c0713);}return _0x43fdd5[_0xeb38('0x1a')](_0x5c0713)[_0xeb38('0x1b')]();};}function respondWithResult(_0x6bc43d,_0x12db29){_0x12db29=_0x12db29||0xc8;return function(_0x4d765f){if(_0x4d765f){return _0x6bc43d[_0xeb38('0x1a')](_0x12db29)[_0xeb38('0x1c')](_0x4d765f);}};}function respondWithFilteredResult(_0x283672,_0x1dcd10){return function(_0x1eee62){if(_0x1eee62){var _0x1ea41f=_0x1eee62[_0xeb38('0x1d')],_0xe35d7c=_0x1dcd10[_0xeb38('0x1e')],_0x47d595=_0x1dcd10['offset']+_0x1dcd10[_0xeb38('0x1f')],_0x444f54;if(_0x47d595>=_0x1ea41f){_0x47d595=_0x1ea41f;_0x444f54=0xc8;}else{_0x444f54=0xce;}_0x283672['status'](_0x444f54);return _0x283672['set'](_0xeb38('0x20'),_0xe35d7c+'-'+_0x47d595+'/'+_0x1ea41f)[_0xeb38('0x1c')](_0x1eee62);}return null;};}function patchUpdates(_0x95a29){return function(_0x4be34e){try{jsonpatch['apply'](_0x4be34e,_0x95a29,!![]);}catch(_0x3f8ed1){return BPromise[_0xeb38('0x21')](_0x3f8ed1);}return _0x4be34e[_0xeb38('0x22')]();};}function saveUpdates(_0x46885c,_0x1493c4){return function(_0x5f086e){if(_0x5f086e){return _0x5f086e['update'](_0x46885c)['then'](function(_0x2d8fa4){return _0x2d8fa4;});}return null;};}function removeEntity(_0x3525b8,_0x504957){return function(_0x24e2b5){if(_0x24e2b5){return _0x24e2b5[_0xeb38('0x23')]()[_0xeb38('0x24')](function(){_0x3525b8['status'](0xcc)[_0xeb38('0x1b')]();});}};}function handleEntityNotFound(_0x39bcbf,_0x8863c6){return function(_0x292d48){if(!_0x292d48){_0x39bcbf[_0xeb38('0x19')](0x194);}return _0x292d48;};}function handleError(_0xf672a6,_0x4220dd){_0x4220dd=_0x4220dd||0x1f4;return function(_0x5ab55b){logger['error'](_0x5ab55b['stack']);if(_0x5ab55b[_0xeb38('0x25')]){delete _0x5ab55b[_0xeb38('0x25')];}_0xf672a6[_0xeb38('0x1a')](_0x4220dd)['send'](_0x5ab55b);};}exports[_0xeb38('0x26')]=function(_0x22a9b0,_0x2122d2){var _0x6fa93f={},_0x20a96b={},_0x10bce8={'count':0x0,'rows':[]};var _0x39317f=_[_0xeb38('0x27')](db[_0xeb38('0x28')]['rawAttributes'],function(_0x4a669c){return{'name':_0x4a669c[_0xeb38('0x29')],'type':_0x4a669c['type']['key']};});_0x20a96b[_0xeb38('0x2a')]=_['differenceBy'](_['map'](_0x39317f,_0xeb38('0x25')),[_0xeb38('0x2b')]);_0x20a96b[_0xeb38('0x2c')]=_[_0xeb38('0x2d')](_0x22a9b0[_0xeb38('0x2c')]);_0x20a96b[_0xeb38('0x2e')]=_['intersection'](_0x20a96b['model'],_0x20a96b[_0xeb38('0x2c')]);_0x6fa93f['attributes']=_[_0xeb38('0x2f')](_0x20a96b[_0xeb38('0x2a')],qs[_0xeb38('0x30')](_0x22a9b0[_0xeb38('0x2c')][_0xeb38('0x30')]));_0x6fa93f[_0xeb38('0x31')]=_0x6fa93f['attributes']['length']?_0x6fa93f['attributes']:_0x20a96b[_0xeb38('0x2a')];if(!_0x22a9b0[_0xeb38('0x2c')][_0xeb38('0x32')]('nolimit')){_0x6fa93f[_0xeb38('0x1f')]=qs[_0xeb38('0x1f')](_0x22a9b0['query'][_0xeb38('0x1f')]);_0x6fa93f[_0xeb38('0x1e')]=qs[_0xeb38('0x1e')](_0x22a9b0[_0xeb38('0x2c')][_0xeb38('0x1e')]);}_0x6fa93f[_0xeb38('0x33')]=qs[_0xeb38('0x34')](_0x22a9b0[_0xeb38('0x2c')]['sort']);_0x6fa93f['where']=qs[_0xeb38('0x2e')](_[_0xeb38('0x35')](_0x22a9b0[_0xeb38('0x2c')],_0x20a96b[_0xeb38('0x2e')]),_0x39317f);if(_0x22a9b0[_0xeb38('0x2c')][_0xeb38('0x36')]){_0x6fa93f[_0xeb38('0x37')]=_[_0xeb38('0x38')](_0x6fa93f['where'],{'$or':_['map'](_0x39317f,function(_0x13e157){if(_0x13e157[_0xeb38('0x39')]!==_0xeb38('0x3a')){var _0x5b04a3={};_0x5b04a3[_0x13e157[_0xeb38('0x25')]]={'$like':'%'+_0x22a9b0[_0xeb38('0x2c')][_0xeb38('0x36')]+'%'};return _0x5b04a3;}})});}_0x6fa93f=_[_0xeb38('0x38')]({},_0x6fa93f,_0x22a9b0['options']);var _0xd03ed9={'where':_0x6fa93f[_0xeb38('0x37')]};return db['ScreenRecording']['count'](_0xd03ed9)[_0xeb38('0x24')](function(_0x12f967){_0x10bce8['count']=_0x12f967;if(_0x22a9b0[_0xeb38('0x2c')][_0xeb38('0x3b')]){_0x6fa93f['include']=[{'all':!![]}];}return db['ScreenRecording'][_0xeb38('0x3c')](_0x6fa93f);})[_0xeb38('0x24')](function(_0x8a57a7){_0x10bce8['rows']=_0x8a57a7;return _0x10bce8;})[_0xeb38('0x24')](respondWithFilteredResult(_0x2122d2,_0x6fa93f))[_0xeb38('0x3d')](handleError(_0x2122d2,null));};exports[_0xeb38('0x3e')]=function(_0x514ce0,_0x36f7c7){var _0x2a62e9={'raw':![],'where':{'id':_0x514ce0['params']['id']}},_0x389430={};_0x389430[_0xeb38('0x2a')]=_[_0xeb38('0x2d')](db[_0xeb38('0x28')][_0xeb38('0x3f')]);_0x389430['query']=_[_0xeb38('0x2d')](_0x514ce0['query']);_0x389430[_0xeb38('0x2e')]=_[_0xeb38('0x2f')](_0x389430[_0xeb38('0x2a')],_0x389430[_0xeb38('0x2c')]);_0x2a62e9[_0xeb38('0x31')]=_[_0xeb38('0x2f')](_0x389430[_0xeb38('0x2a')],qs[_0xeb38('0x30')](_0x514ce0[_0xeb38('0x2c')][_0xeb38('0x30')]));_0x2a62e9[_0xeb38('0x31')]=_0x2a62e9['attributes'][_0xeb38('0x40')]?_0x2a62e9['attributes']:_0x389430[_0xeb38('0x2a')];if(_0x514ce0[_0xeb38('0x2c')][_0xeb38('0x3b')]){_0x2a62e9[_0xeb38('0x41')]=[{'all':!![]}];}_0x2a62e9=_[_0xeb38('0x38')]({},_0x2a62e9,_0x514ce0['options']);return db[_0xeb38('0x28')][_0xeb38('0x42')](_0x2a62e9)[_0xeb38('0x24')](handleEntityNotFound(_0x36f7c7,null))[_0xeb38('0x24')](respondWithResult(_0x36f7c7,null))[_0xeb38('0x3d')](handleError(_0x36f7c7,null));};exports[_0xeb38('0x43')]=function(_0x685c06,_0x4fd357){return db['ScreenRecording']['create'](_0x685c06[_0xeb38('0x44')],{})[_0xeb38('0x24')](respondWithResult(_0x4fd357,0xc9))['catch'](handleError(_0x4fd357,null));};exports[_0xeb38('0x45')]=function(_0x13344a,_0x409a0a){if(_0x13344a[_0xeb38('0x44')]['id']){delete _0x13344a[_0xeb38('0x44')]['id'];}delete _0x13344a['body'][_0xeb38('0x46')];delete _0x13344a[_0xeb38('0x44')][_0xeb38('0x47')];delete _0x13344a[_0xeb38('0x44')][_0xeb38('0x48')];delete _0x13344a['body'][_0xeb38('0x49')];return db[_0xeb38('0x28')][_0xeb38('0x42')]({'where':{'id':_0x13344a[_0xeb38('0x4a')]['id']}})[_0xeb38('0x24')](handleEntityNotFound(_0x409a0a,null))[_0xeb38('0x24')](saveUpdates(_0x13344a[_0xeb38('0x44')],null))[_0xeb38('0x24')](respondWithResult(_0x409a0a,null))[_0xeb38('0x3d')](handleError(_0x409a0a,null));};exports[_0xeb38('0x4b')]=function(_0xb96836,_0x1605d2){return db['ScreenRecording'][_0xeb38('0x4b')]()[_0xeb38('0x24')](respondWithResult(_0x1605d2,null))[_0xeb38('0x3d')](handleError(_0x1605d2,null));};exports[_0xeb38('0x4c')]=function(_0x54c669,_0x345e4d,_0x2025a5){var _0x5ee8c3=require(_0xeb38('0x4d'));var _0x14d87c=![];var _0x12935d={};if(_0x54c669[_0xeb38('0x2c')][_0xeb38('0x39')]&&_0x54c669[_0xeb38('0x2c')]['type']===_0xeb38('0x4e')){_0x12935d[_0xeb38('0x4e')]=_0x54c669[_0xeb38('0x4a')]['id'];}else{_0x12935d['id']=_0x54c669[_0xeb38('0x4a')]['id'];}return db[_0xeb38('0x28')]['find']({'where':_0x12935d,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x345e4d,null))[_0xeb38('0x24')](function(_0x846bef){if(_0x846bef){var _0x16520c=path[_0xeb38('0x4f')](config[_0xeb38('0x50')],'server/files/screen_recordings',_0x846bef[_0xeb38('0x49')]);var _0x474d93=util['format'](_0xeb38('0x51'),_0x16520c);if(fs[_0xeb38('0x52')](_0x474d93)){_0x14d87c=!![];return _0x5ee8c3[_0xeb38('0x53')](_0x474d93,_0x16520c,config[_0xeb38('0x54')][_0xeb38('0x55')])[_0xeb38('0x24')](function(){return _0x846bef;});}return _0x846bef;}})[_0xeb38('0x24')](function(_0x4cce0b){if(_0x4cce0b){var _0x4e9d55=path[_0xeb38('0x4f')](config['root'],_0xeb38('0x56'),_0x4cce0b[_0xeb38('0x49')]);if(!fs[_0xeb38('0x52')](_0x4e9d55)){throw new db[(_0xeb38('0x57'))][(_0xeb38('0x58'))](_0xeb38('0x59'));}if(_0x4cce0b['filename']){return _0x345e4d['download'](_0x4e9d55,_0x4cce0b[_0xeb38('0x5a')]+path[_0xeb38('0x5b')](_0x4e9d55),function(){if(_0x14d87c){fs['unlink'](_0x4e9d55);}});}else{return _0x345e4d[_0xeb38('0x4c')](_0x4e9d55,function(_0x26205b){if(_0x14d87c){fs['unlink'](_0x4e9d55);}});}}})['catch'](function(_0x50a94b){if(_0x50a94b[_0xeb38('0x5c')]===_0xeb38('0x59')){_0x345e4d['status'](0x194)[_0xeb38('0x5d')](_0xeb38('0x5e'));}else{return handleError(_0x345e4d,null);}});};exports[_0xeb38('0x23')]=function(_0x2273a4,_0x36fef2){return db[_0xeb38('0x28')][_0xeb38('0x42')]({'where':{'id':_0x2273a4[_0xeb38('0x4a')]['id']}})[_0xeb38('0x24')](function(_0x31dc46){if(!_0x31dc46)throw new ReferenceError(_0xeb38('0x5f'));return _0x31dc46;})[_0xeb38('0x24')](function(_0x2f62bf){var _0x459e4c=path[_0xeb38('0x4f')](config[_0xeb38('0x50')],_0xeb38('0x56'),_0x2f62bf[_0xeb38('0x49')]);logger[_0xeb38('0x60')](_0xeb38('0x61'),_0x459e4c);if(!_['isNil'](_0x2f62bf['value'])&&fs[_0xeb38('0x52')](_0x459e4c)){logger['info'](_0xeb38('0x62')+_0x459e4c+_0xeb38('0x63'));fs[_0xeb38('0x64')](_0x459e4c);}_0x459e4c=_0x459e4c+_0xeb38('0x65');if(!_[_0xeb38('0x66')](_0x2f62bf[_0xeb38('0x49')])&&fs[_0xeb38('0x52')](_0x459e4c)){logger['info'](_0xeb38('0x62')+_0x459e4c+_0xeb38('0x63'));fs[_0xeb38('0x64')](_0x459e4c);}return _0x2f62bf;})['then'](function(_0x5d9438){if(!_0x5d9438)throw new InternalError();return _0x5d9438[_0xeb38('0x23')]();})[_0xeb38('0x24')](function(){_0x36fef2['status'](0xcc)[_0xeb38('0x1b')]();})[_0xeb38('0x3d')](handleError(_0x36fef2,null));}; \ No newline at end of file +var _0x1b4d=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','model','differenceBy','format','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','type','uniqueid','join','root','server/files/screen_recordings','existsSync','decryptFile','recording','filename','unlink','message','ScreenRecording\x20not\x20found','send','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0x1b4d,0x123));var _0xd1b4=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x1b4d[_0xbb091];return _0x467a04;};'use strict';var pdf=require(_0xd1b4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd1b4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1b4('0x2'));var rp=require(_0xd1b4('0x3'));var moment=require(_0xd1b4('0x4'));var BPromise=require(_0xd1b4('0x5'));var Mustache=require(_0xd1b4('0x6'));var util=require(_0xd1b4('0x7'));var path=require(_0xd1b4('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd1b4('0x9'));var fs=require('fs');var _=require(_0xd1b4('0xa'));var squel=require(_0xd1b4('0xb'));var crypto=require(_0xd1b4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd1b4('0xd'));var toCsv=require(_0xd1b4('0xe'));var querystring=require(_0xd1b4('0xf'));var Papa=require('papaparse');var Redis=require(_0xd1b4('0x10'));var authService=require(_0xd1b4('0x11'));var qs=require(_0xd1b4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd1b4('0x13'));var logger=require(_0xd1b4('0x14'))(_0xd1b4('0x15'));var utils=require(_0xd1b4('0x16'));var config=require(_0xd1b4('0x17'));var db=require(_0xd1b4('0x18'))['db'];function respondWithStatusCode(_0x2857d2,_0x57ddbd){_0x57ddbd=_0x57ddbd||0xcc;return function(_0x50d6cd){if(_0x50d6cd){return _0x2857d2[_0xd1b4('0x19')](_0x57ddbd);}return _0x2857d2[_0xd1b4('0x1a')](_0x57ddbd)[_0xd1b4('0x1b')]();};}function respondWithResult(_0x41c2bc,_0x10cb84){_0x10cb84=_0x10cb84||0xc8;return function(_0x44c16e){if(_0x44c16e){return _0x41c2bc[_0xd1b4('0x1a')](_0x10cb84)[_0xd1b4('0x1c')](_0x44c16e);}};}function respondWithFilteredResult(_0x116c4b,_0x1fc177){return function(_0x28c859){if(_0x28c859){var _0x474a96=_0x28c859[_0xd1b4('0x1d')],_0x4ebeec=_0x1fc177[_0xd1b4('0x1e')],_0x548aee=_0x1fc177[_0xd1b4('0x1e')]+_0x1fc177[_0xd1b4('0x1f')],_0x53f63e;if(_0x548aee>=_0x474a96){_0x548aee=_0x474a96;_0x53f63e=0xc8;}else{_0x53f63e=0xce;}_0x116c4b[_0xd1b4('0x1a')](_0x53f63e);return _0x116c4b[_0xd1b4('0x20')](_0xd1b4('0x21'),_0x4ebeec+'-'+_0x548aee+'/'+_0x474a96)[_0xd1b4('0x1c')](_0x28c859);}return null;};}function patchUpdates(_0x31e86b){return function(_0x1cd34f){try{jsonpatch[_0xd1b4('0x22')](_0x1cd34f,_0x31e86b,!![]);}catch(_0xb4f171){return BPromise[_0xd1b4('0x23')](_0xb4f171);}return _0x1cd34f[_0xd1b4('0x24')]();};}function saveUpdates(_0x405c8e,_0x949519){return function(_0x8b4f71){if(_0x8b4f71){return _0x8b4f71[_0xd1b4('0x25')](_0x405c8e)['then'](function(_0x272939){return _0x272939;});}return null;};}function removeEntity(_0x186712,_0x331c58){return function(_0x2a7706){if(_0x2a7706){return _0x2a7706[_0xd1b4('0x26')]()[_0xd1b4('0x27')](function(){_0x186712[_0xd1b4('0x1a')](0xcc)[_0xd1b4('0x1b')]();});}};}function handleEntityNotFound(_0x527913,_0x166e63){return function(_0x4a9743){if(!_0x4a9743){_0x527913[_0xd1b4('0x19')](0x194);}return _0x4a9743;};}function handleError(_0x53e4b3,_0x1185b4){_0x1185b4=_0x1185b4||0x1f4;return function(_0x1e2757){logger['error'](_0x1e2757[_0xd1b4('0x28')]);if(_0x1e2757[_0xd1b4('0x29')]){delete _0x1e2757[_0xd1b4('0x29')];}_0x53e4b3[_0xd1b4('0x1a')](_0x1185b4)['send'](_0x1e2757);};}exports[_0xd1b4('0x2a')]=function(_0x103df3,_0x78c334){var _0x4b9dbc={},_0xf5bc54={},_0x47e6ca={'count':0x0,'rows':[]};var _0x5079bc=_[_0xd1b4('0x2b')](db[_0xd1b4('0x2c')][_0xd1b4('0x2d')],function(_0x53a75c){return{'name':_0x53a75c[_0xd1b4('0x2e')],'type':_0x53a75c['type']['key']};});_0xf5bc54[_0xd1b4('0x2f')]=_[_0xd1b4('0x30')](_[_0xd1b4('0x2b')](_0x5079bc,_0xd1b4('0x29')),[_0xd1b4('0x31')]);_0xf5bc54['query']=_[_0xd1b4('0x32')](_0x103df3[_0xd1b4('0x33')]);_0xf5bc54[_0xd1b4('0x34')]=_['intersection'](_0xf5bc54[_0xd1b4('0x2f')],_0xf5bc54['query']);_0x4b9dbc[_0xd1b4('0x35')]=_[_0xd1b4('0x36')](_0xf5bc54[_0xd1b4('0x2f')],qs[_0xd1b4('0x37')](_0x103df3[_0xd1b4('0x33')]['fields']));_0x4b9dbc['attributes']=_0x4b9dbc[_0xd1b4('0x35')][_0xd1b4('0x38')]?_0x4b9dbc[_0xd1b4('0x35')]:_0xf5bc54[_0xd1b4('0x2f')];if(!_0x103df3[_0xd1b4('0x33')][_0xd1b4('0x39')](_0xd1b4('0x3a'))){_0x4b9dbc[_0xd1b4('0x1f')]=qs['limit'](_0x103df3[_0xd1b4('0x33')][_0xd1b4('0x1f')]);_0x4b9dbc[_0xd1b4('0x1e')]=qs[_0xd1b4('0x1e')](_0x103df3[_0xd1b4('0x33')]['offset']);}_0x4b9dbc[_0xd1b4('0x3b')]=qs[_0xd1b4('0x3c')](_0x103df3[_0xd1b4('0x33')]['sort']);_0x4b9dbc[_0xd1b4('0x3d')]=qs[_0xd1b4('0x34')](_[_0xd1b4('0x3e')](_0x103df3[_0xd1b4('0x33')],_0xf5bc54[_0xd1b4('0x34')]),_0x5079bc);if(_0x103df3[_0xd1b4('0x33')][_0xd1b4('0x3f')]){_0x4b9dbc['where']=_[_0xd1b4('0x40')](_0x4b9dbc[_0xd1b4('0x3d')],{'$or':_['map'](_0x5079bc,function(_0x56517f){if(_0x56517f['type']!==_0xd1b4('0x41')){var _0x50ad12={};_0x50ad12[_0x56517f['name']]={'$like':'%'+_0x103df3[_0xd1b4('0x33')][_0xd1b4('0x3f')]+'%'};return _0x50ad12;}})});}_0x4b9dbc=_['merge']({},_0x4b9dbc,_0x103df3[_0xd1b4('0x42')]);var _0x1f47ee={'where':_0x4b9dbc['where']};return db[_0xd1b4('0x2c')]['count'](_0x1f47ee)['then'](function(_0x50ee46){_0x47e6ca[_0xd1b4('0x1d')]=_0x50ee46;if(_0x103df3[_0xd1b4('0x33')][_0xd1b4('0x43')]){_0x4b9dbc[_0xd1b4('0x44')]=[{'all':!![]}];}return db[_0xd1b4('0x2c')][_0xd1b4('0x45')](_0x4b9dbc);})[_0xd1b4('0x27')](function(_0x36ed02){_0x47e6ca[_0xd1b4('0x46')]=_0x36ed02;return _0x47e6ca;})[_0xd1b4('0x27')](respondWithFilteredResult(_0x78c334,_0x4b9dbc))[_0xd1b4('0x47')](handleError(_0x78c334,null));};exports[_0xd1b4('0x48')]=function(_0x1672bc,_0x360a69){var _0xdf396e={'raw':![],'where':{'id':_0x1672bc[_0xd1b4('0x49')]['id']}},_0x3d937f={};_0x3d937f['model']=_[_0xd1b4('0x32')](db[_0xd1b4('0x2c')][_0xd1b4('0x2d')]);_0x3d937f[_0xd1b4('0x33')]=_['keys'](_0x1672bc['query']);_0x3d937f[_0xd1b4('0x34')]=_['intersection'](_0x3d937f[_0xd1b4('0x2f')],_0x3d937f[_0xd1b4('0x33')]);_0xdf396e[_0xd1b4('0x35')]=_[_0xd1b4('0x36')](_0x3d937f[_0xd1b4('0x2f')],qs[_0xd1b4('0x37')](_0x1672bc[_0xd1b4('0x33')][_0xd1b4('0x37')]));_0xdf396e[_0xd1b4('0x35')]=_0xdf396e[_0xd1b4('0x35')][_0xd1b4('0x38')]?_0xdf396e[_0xd1b4('0x35')]:_0x3d937f[_0xd1b4('0x2f')];if(_0x1672bc[_0xd1b4('0x33')][_0xd1b4('0x43')]){_0xdf396e[_0xd1b4('0x44')]=[{'all':!![]}];}_0xdf396e=_[_0xd1b4('0x40')]({},_0xdf396e,_0x1672bc['options']);return db[_0xd1b4('0x2c')][_0xd1b4('0x4a')](_0xdf396e)['then'](handleEntityNotFound(_0x360a69,null))[_0xd1b4('0x27')](respondWithResult(_0x360a69,null))['catch'](handleError(_0x360a69,null));};exports['create']=function(_0x133bff,_0x570e96){return db[_0xd1b4('0x2c')]['create'](_0x133bff['body'],{})[_0xd1b4('0x27')](respondWithResult(_0x570e96,0xc9))[_0xd1b4('0x47')](handleError(_0x570e96,null));};exports[_0xd1b4('0x25')]=function(_0x3e11d3,_0x53e23d){if(_0x3e11d3[_0xd1b4('0x4b')]['id']){delete _0x3e11d3[_0xd1b4('0x4b')]['id'];}delete _0x3e11d3['body'][_0xd1b4('0x4c')];delete _0x3e11d3['body'][_0xd1b4('0x4d')];delete _0x3e11d3[_0xd1b4('0x4b')][_0xd1b4('0x4e')];delete _0x3e11d3[_0xd1b4('0x4b')][_0xd1b4('0x4f')];return db[_0xd1b4('0x2c')][_0xd1b4('0x4a')]({'where':{'id':_0x3e11d3[_0xd1b4('0x49')]['id']}})[_0xd1b4('0x27')](handleEntityNotFound(_0x53e23d,null))[_0xd1b4('0x27')](saveUpdates(_0x3e11d3['body'],null))[_0xd1b4('0x27')](respondWithResult(_0x53e23d,null))[_0xd1b4('0x47')](handleError(_0x53e23d,null));};exports['describe']=function(_0x1300e0,_0xff18f0){return db['ScreenRecording'][_0xd1b4('0x50')]()[_0xd1b4('0x27')](respondWithResult(_0xff18f0,null))[_0xd1b4('0x47')](handleError(_0xff18f0,null));};exports[_0xd1b4('0x51')]=function(_0x112574,_0x4eb93f,_0x3b2d80){var _0x40c14a=require(_0xd1b4('0x52'));var _0x46c0fd=![];var _0x32981e={};if(_0x112574['query'][_0xd1b4('0x53')]&&_0x112574[_0xd1b4('0x33')][_0xd1b4('0x53')]===_0xd1b4('0x54')){_0x32981e[_0xd1b4('0x54')]=_0x112574['params']['id'];}else{_0x32981e['id']=_0x112574['params']['id'];}return db[_0xd1b4('0x2c')][_0xd1b4('0x4a')]({'where':_0x32981e,'attributes':['id',_0xd1b4('0x4f')],'raw':!![]})[_0xd1b4('0x27')](handleEntityNotFound(_0x4eb93f,null))['then'](function(_0x3abdf3){if(_0x3abdf3){var _0x189d0b=path[_0xd1b4('0x55')](config[_0xd1b4('0x56')],_0xd1b4('0x57'),_0x3abdf3[_0xd1b4('0x4f')]);var _0x47b72c=util[_0xd1b4('0x31')]('%s.cypher',_0x189d0b);if(fs[_0xd1b4('0x58')](_0x47b72c)){_0x46c0fd=!![];return _0x40c14a[_0xd1b4('0x59')](_0x47b72c,_0x189d0b,config['secrets'][_0xd1b4('0x5a')])[_0xd1b4('0x27')](function(){return _0x3abdf3;});}return _0x3abdf3;}})['then'](function(_0x3b170d){if(_0x3b170d){var _0x3fa1e8=path[_0xd1b4('0x55')](config[_0xd1b4('0x56')],'server/files/screen_recordings',_0x3b170d[_0xd1b4('0x4f')]);if(!fs[_0xd1b4('0x58')](_0x3fa1e8)){throw new db['Sequelize']['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x3b170d[_0xd1b4('0x5b')]){return _0x4eb93f[_0xd1b4('0x51')](_0x3fa1e8,_0x3b170d['filename']+path['extname'](_0x3fa1e8),function(){if(_0x46c0fd){fs[_0xd1b4('0x5c')](_0x3fa1e8);}});}else{return _0x4eb93f[_0xd1b4('0x51')](_0x3fa1e8,function(_0x177d31){if(_0x46c0fd){fs[_0xd1b4('0x5c')](_0x3fa1e8);}});}}})['catch'](function(_0x4edd52){if(_0x4edd52[_0xd1b4('0x5d')]===_0xd1b4('0x5e')){_0x4eb93f[_0xd1b4('0x1a')](0x194)[_0xd1b4('0x5f')](_0xd1b4('0x60'));}else{return handleError(_0x4eb93f,null);}});};exports['destroy']=function(_0x2201f0,_0x368a0d){return db[_0xd1b4('0x2c')][_0xd1b4('0x4a')]({'where':{'id':_0x2201f0[_0xd1b4('0x49')]['id']}})[_0xd1b4('0x27')](function(_0x374df5){if(!_0x374df5)throw new ReferenceError(_0xd1b4('0x61'));return _0x374df5;})['then'](function(_0x43f6bf){var _0x86f160=path[_0xd1b4('0x55')](config[_0xd1b4('0x56')],'server/files/screen_recordings',_0x43f6bf['value']);logger[_0xd1b4('0x62')](_0xd1b4('0x63'),_0x86f160);if(!_[_0xd1b4('0x64')](_0x43f6bf[_0xd1b4('0x4f')])&&fs[_0xd1b4('0x58')](_0x86f160)){logger[_0xd1b4('0x62')]('File:\x20\x22'+_0x86f160+_0xd1b4('0x65'));fs[_0xd1b4('0x66')](_0x86f160);}_0x86f160=_0x86f160+_0xd1b4('0x67');if(!_['isNil'](_0x43f6bf[_0xd1b4('0x4f')])&&fs['existsSync'](_0x86f160)){logger['info']('File:\x20\x22'+_0x86f160+_0xd1b4('0x65'));fs[_0xd1b4('0x66')](_0x86f160);}return _0x43f6bf;})['then'](function(_0x397278){if(!_0x397278)throw new InternalError();return _0x397278['destroy']();})[_0xd1b4('0x27')](function(){_0x368a0d[_0xd1b4('0x1a')](0xcc)[_0xd1b4('0x1b')]();})[_0xd1b4('0x47')](handleError(_0x368a0d,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 5355309..a7e4b51 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 _0x9f90=['api','moment','bluebird','./screenRecording.attributes','ScreenRecording','interactionid'];(function(_0x3fb3d3,_0x434d9e){var _0x4c6fd9=function(_0x2a21a0){while(--_0x2a21a0){_0x3fb3d3['push'](_0x3fb3d3['shift']());}};_0x4c6fd9(++_0x434d9e);}(_0x9f90,0x186));var _0x09f9=function(_0x1f9ad2,_0x53cbd5){_0x1f9ad2=_0x1f9ad2-0x0;var _0x3fbefa=_0x9f90[_0x1f9ad2];return _0x3fbefa;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x09f9('0x0'));var moment=require(_0x09f9('0x1'));var BPromise=require(_0x09f9('0x2'));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(_0x09f9('0x3'));module['exports']=function(_0x23b10f,_0x38ab93){return _0x23b10f['define'](_0x09f9('0x4'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x09f9('0x5'),'fields':[_0x09f9('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda6b=['bluebird','request-promise','path','./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid','lodash','util','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xda6b,0xce));var _0xbda6=function(_0x5e5a32,_0x315bc2){_0x5e5a32=_0x5e5a32-0x0;var _0x36bb0c=_0xda6b[_0x5e5a32];return _0x36bb0c;};'use strict';var _=require(_0xbda6('0x0'));var util=require(_0xbda6('0x1'));var logger=require('../../config/logger')(_0xbda6('0x2'));var moment=require('moment');var BPromise=require(_0xbda6('0x3'));var rp=require(_0xbda6('0x4'));var fs=require('fs');var path=require(_0xbda6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbda6('0x6'));module['exports']=function(_0x6b6f12,_0x7422db){return _0x6b6f12[_0xbda6('0x7')](_0xbda6('0x8'),attributes,{'tableName':_0xbda6('0x9'),'paranoid':![],'indexes':[{'name':_0xbda6('0xa'),'fields':[_0xbda6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 88c7c18..5525119 100644 --- a/server/api/screenRecording/screenRecording.rpc.js +++ b/server/api/screenRecording/screenRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xdf3636,_0xdf2f4){var _0x32bf78=function(_0x6c9ad9){while(--_0x6c9ad9){_0xdf3636['push'](_0xdf3636['shift']());}};_0x32bf78(++_0xdf2f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x19132b,_0x1e6bc1){var _0x29bd77=function(_0x1babb7){while(--_0x1babb7){_0x19132b['push'](_0x19132b['shift']());}};_0x29bd77(++_0x1e6bc1);}(_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);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index e2d3901..9e79900 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 _0xbb9d=['exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/favicon','diskStorage','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','file','join','root','logologin','single','preferred','/:id/preferred','addPreferred','favicon','addFavicon','put','isAuthenticated','update'];(function(_0x2a0c3a,_0x458540){var _0x116fbf=function(_0x287ecc){while(--_0x287ecc){_0x2a0c3a['push'](_0x2a0c3a['shift']());}};_0x116fbf(++_0x458540);}(_0xbb9d,0x73));var _0xdbb9=function(_0x1fa1b2,_0x1eea8f){_0x1fa1b2=_0x1fa1b2-0x0;var _0x57929a=_0xbb9d[_0x1fa1b2];return _0x57929a;};'use strict';var multer=require('multer');var util=require(_0xdbb9('0x0'));var path=require(_0xdbb9('0x1'));var timeout=require(_0xdbb9('0x2'));var express=require(_0xdbb9('0x3'));var router=express['Router']();var auth=require(_0xdbb9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdbb9('0x5'));var controller=require('./setting.controller');router[_0xdbb9('0x6')]('/',auth['isAuthenticated'](),controller[_0xdbb9('0x7')]);router[_0xdbb9('0x6')](_0xdbb9('0x8'),controller['show']);router[_0xdbb9('0x6')](_0xdbb9('0x9'),controller[_0xdbb9('0xa')]);router['get'](_0xdbb9('0xb'),controller[_0xdbb9('0xc')]);router[_0xdbb9('0x6')](_0xdbb9('0xd'),controller[_0xdbb9('0xe')]);router['get']('/:id/preferred',controller['getPreferred']);router[_0xdbb9('0x6')](_0xdbb9('0xf'),controller['getFavicon']);var upload=multer({'storage':multer[_0xdbb9('0x10')]({'destination':function(_0x435719,_0x35e239,_0x56c2be){_0x56c2be(null,path['join'](config['root'],_0xdbb9('0x11')));},'filename':function(_0x5dd6bc,_0x1d27af,_0x57ac78){_0x57ac78(null,util[_0xdbb9('0x12')](_0xdbb9('0x13'),_0xdbb9('0x14'),path[_0xdbb9('0x15')](_0x1d27af[_0xdbb9('0x16')])));}})});router[_0xdbb9('0x17')](_0xdbb9('0x9'),upload['single'](_0xdbb9('0x18')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x104f0b,_0x4e6d9a,_0x89b7f4){_0x89b7f4(null,path[_0xdbb9('0x19')](config[_0xdbb9('0x1a')],_0xdbb9('0x11')));},'filename':function(_0x2352ec,_0x499774,_0x2b0e99){_0x2b0e99(null,util[_0xdbb9('0x12')](_0xdbb9('0x13'),_0xdbb9('0x1b'),path[_0xdbb9('0x15')](_0x499774[_0xdbb9('0x16')])));}})});router[_0xdbb9('0x17')](_0xdbb9('0xb'),upload[_0xdbb9('0x1c')](_0xdbb9('0x18')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xdbb9('0x10')]({'destination':function(_0x1859cd,_0x489c62,_0x3710d0){_0x3710d0(null,path[_0xdbb9('0x19')](config[_0xdbb9('0x1a')],_0xdbb9('0x11')));},'filename':function(_0x52ddc5,_0x3be80b,_0x5256a6){_0x5256a6(null,util[_0xdbb9('0x12')](_0xdbb9('0x13'),_0xdbb9('0x1d'),path[_0xdbb9('0x15')](_0x3be80b[_0xdbb9('0x16')])));}})});router['post'](_0xdbb9('0x1e'),upload['single'](_0xdbb9('0x18')),controller[_0xdbb9('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x79fc3d,_0x8b5989,_0xa72d9a){_0xa72d9a(null,path[_0xdbb9('0x19')](config[_0xdbb9('0x1a')],_0xdbb9('0x11')));},'filename':function(_0x6e986e,_0x458517,_0x1251cf){_0x1251cf(null,util[_0xdbb9('0x12')](_0xdbb9('0x13'),_0xdbb9('0x20'),path['extname'](_0x458517['originalname'])));}})});router[_0xdbb9('0x17')](_0xdbb9('0xf'),upload[_0xdbb9('0x1c')](_0xdbb9('0x18')),controller[_0xdbb9('0x21')]);router[_0xdbb9('0x22')](_0xdbb9('0x8'),auth[_0xdbb9('0x23')](),controller[_0xdbb9('0x24')]);module[_0xdbb9('0x25')]=router; \ No newline at end of file +var _0x3cb8=['format','%s%s','logo','extname','originalname','post','/:id/logo','single','logologin','addLogoLogin','preferred','file','addPreferred','favicon','addFavicon','isAuthenticated','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','getLogo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/'];(function(_0xa1b852,_0x17d875){var _0x2ae8e4=function(_0x2b765e){while(--_0x2b765e){_0xa1b852['push'](_0xa1b852['shift']());}};_0x2ae8e4(++_0x17d875);}(_0x3cb8,0x138));var _0x83cb=function(_0x22a754,_0x542e8a){_0x22a754=_0x22a754-0x0;var _0x218614=_0x3cb8[_0x22a754];return _0x218614;};'use strict';var multer=require(_0x83cb('0x0'));var util=require('util');var path=require(_0x83cb('0x1'));var timeout=require(_0x83cb('0x2'));var express=require(_0x83cb('0x3'));var router=express[_0x83cb('0x4')]();var auth=require(_0x83cb('0x5'));var interaction=require(_0x83cb('0x6'));var config=require(_0x83cb('0x7'));var controller=require('./setting.controller');router[_0x83cb('0x8')]('/',auth['isAuthenticated'](),controller[_0x83cb('0x9')]);router['get'](_0x83cb('0xa'),controller[_0x83cb('0xb')]);router['get']('/:id/logo',controller[_0x83cb('0xc')]);router['get'](_0x83cb('0xd'),controller['getLogoLogin']);router[_0x83cb('0x8')](_0x83cb('0xe'),controller[_0x83cb('0xf')]);router[_0x83cb('0x8')](_0x83cb('0x10'),controller[_0x83cb('0x11')]);router[_0x83cb('0x8')](_0x83cb('0x12'),controller[_0x83cb('0x13')]);var upload=multer({'storage':multer[_0x83cb('0x14')]({'destination':function(_0x2906c3,_0x584723,_0x522d8b){_0x522d8b(null,path[_0x83cb('0x15')](config[_0x83cb('0x16')],_0x83cb('0x17')));},'filename':function(_0x5a0812,_0x39c7bf,_0x304be9){_0x304be9(null,util[_0x83cb('0x18')](_0x83cb('0x19'),_0x83cb('0x1a'),path[_0x83cb('0x1b')](_0x39c7bf[_0x83cb('0x1c')])));}})});router[_0x83cb('0x1d')](_0x83cb('0x1e'),upload[_0x83cb('0x1f')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x83cb('0x14')]({'destination':function(_0x4c78b4,_0x48dcef,_0x2ed06e){_0x2ed06e(null,path['join'](config[_0x83cb('0x16')],_0x83cb('0x17')));},'filename':function(_0x5622f0,_0x3b94d9,_0x5bbedc){_0x5bbedc(null,util[_0x83cb('0x18')]('%s%s',_0x83cb('0x20'),path[_0x83cb('0x1b')](_0x3b94d9[_0x83cb('0x1c')])));}})});router[_0x83cb('0x1d')](_0x83cb('0xd'),upload[_0x83cb('0x1f')]('file'),controller[_0x83cb('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x47a8a5,_0x45fd40,_0x50f54b){_0x50f54b(null,path['join'](config[_0x83cb('0x16')],_0x83cb('0x17')));},'filename':function(_0x39c89d,_0x21d65c,_0x109964){_0x109964(null,util[_0x83cb('0x18')](_0x83cb('0x19'),_0x83cb('0x22'),path[_0x83cb('0x1b')](_0x21d65c[_0x83cb('0x1c')])));}})});router[_0x83cb('0x1d')](_0x83cb('0x10'),upload['single'](_0x83cb('0x23')),controller[_0x83cb('0x24')]);var upload=multer({'storage':multer[_0x83cb('0x14')]({'destination':function(_0x5419d8,_0xca8cf9,_0x1103aa){_0x1103aa(null,path[_0x83cb('0x15')](config[_0x83cb('0x16')],'server/files/images/logos/'));},'filename':function(_0x408cd5,_0x172966,_0x47a55d){_0x47a55d(null,util['format']('%s%s',_0x83cb('0x25'),path[_0x83cb('0x1b')](_0x172966['originalname'])));}})});router[_0x83cb('0x1d')]('/:id/favicon',upload[_0x83cb('0x1f')](_0x83cb('0x23')),controller[_0x83cb('0x26')]);router['put'](_0x83cb('0xa'),auth[_0x83cb('0x27')](),controller[_0x83cb('0x28')]);module[_0x83cb('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 8a3b80a..cddab6d 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 _0x70bb=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports','INTEGER','min_internal','STRING'];(function(_0x2c9f67,_0x885cd0){var _0x55a589=function(_0x3b9fbb){while(--_0x3b9fbb){_0x2c9f67['push'](_0x2c9f67['shift']());}};_0x55a589(++_0x885cd0);}(_0x70bb,0xb8));var _0xb70b=function(_0x4874c2,_0x3ce845){_0x4874c2=_0x4874c2-0x0;var _0x3cdd3e=_0x70bb[_0x4874c2];return _0x3cdd3e;};'use strict';var Sequelize=require(_0xb70b('0x0'));module[_0xb70b('0x1')]={'min_internal':{'type':Sequelize[_0xb70b('0x2')](0xb),'unique':_0xb70b('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xb70b('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xb70b('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xb70b('0x4')],'defaultValue':_0xb70b('0x5')},'logo':{'type':Sequelize[_0xb70b('0x4')]},'defaultLogo':{'type':Sequelize[_0xb70b('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xb70b('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xb70b('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xb70b('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xb70b('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xb70b('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xb70b('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xb70b('0x4')]},'turnpassword':{'type':Sequelize[_0xb70b('0x4')]},'pageTitle':{'type':Sequelize[_0xb70b('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xb70b('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xb70b('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xb70b('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xb70b('0x4')],'defaultValue':_0xb70b('0x7')},'enableEmailPreview':{'type':Sequelize[_0xb70b('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xb70b('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xb70b('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xb70b('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xb70b('0x4')],'defaultValue':_0xb70b('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xb70b('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xb70b('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xb70b('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xb70b('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xb70b('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xb70b('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xb70b('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xb70b('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xb70b('0x4')]},'sentiment':{'type':Sequelize[_0xb70b('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xb70b('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xb70b('0x2')]},'sentimentRegion':{'type':Sequelize[_0xb70b('0x4')]},'language':{'type':Sequelize[_0xb70b('0x4')]},'bucket':{'type':Sequelize[_0xb70b('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6da7=['alternate','sequelize','exports','INTEGER','min_internal','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml'];(function(_0x546501,_0x3ea628){var _0x3c000f=function(_0x508015){while(--_0x508015){_0x546501['push'](_0x546501['shift']());}};_0x3c000f(++_0x3ea628);}(_0x6da7,0xf9));var _0x76da=function(_0x132643,_0x586027){_0x132643=_0x132643-0x0;var _0x47310a=_0x6da7[_0x132643];return _0x47310a;};'use strict';var Sequelize=require(_0x76da('0x0'));module[_0x76da('0x1')]={'min_internal':{'type':Sequelize[_0x76da('0x2')](0xb),'unique':_0x76da('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x76da('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x76da('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x76da('0x4')]},'defaultLogo':{'type':Sequelize[_0x76da('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x76da('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x76da('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x76da('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x76da('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x76da('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x76da('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x76da('0x4')]},'turnaddr':{'type':Sequelize[_0x76da('0x4')]},'turnusername':{'type':Sequelize[_0x76da('0x4')]},'turnpassword':{'type':Sequelize[_0x76da('0x4')]},'pageTitle':{'type':Sequelize[_0x76da('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x76da('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x76da('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x76da('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x76da('0x4')],'defaultValue':_0x76da('0x6')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x76da('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x76da('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x76da('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x76da('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x76da('0x4')],'defaultValue':_0x76da('0x7')},'chatTimeout':{'type':Sequelize[_0x76da('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x76da('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x76da('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x76da('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x76da('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x76da('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x76da('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x76da('0x4')]},'defaultFavicon':{'type':Sequelize[_0x76da('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x76da('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x76da('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x76da('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x76da('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x76da('0x2')]},'sentimentRegion':{'type':Sequelize[_0x76da('0x4')]},'language':{'type':Sequelize[_0x76da('0x4')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x76da('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index e0af7ff..16213d9 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 _0x7cc6=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','stack','name','send','map','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','Setting','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','body','addLogo','file','filename','logo','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','defaultFavicon','existsSync','join','root','toLower','default','default_logo.svg','upperFirst','\x20not\x20found','download','getLogoLogin','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','default_loginLogo.svg','custom','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x276b06,_0x367a25){var _0x5d8066=function(_0x554dad){while(--_0x554dad){_0x276b06['push'](_0x276b06['shift']());}};_0x5d8066(++_0x367a25);}(_0x7cc6,0x1d4));var _0x67cc=function(_0x139c6a,_0x2c3c43){_0x139c6a=_0x139c6a-0x0;var _0xc05bd8=_0x7cc6[_0x139c6a];return _0xc05bd8;};'use strict';var pdf=require(_0x67cc('0x0'));var emlformat=require(_0x67cc('0x1'));var rimraf=require(_0x67cc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x67cc('0x3'));var moment=require('moment');var BPromise=require(_0x67cc('0x4'));var Mustache=require('mustache');var util=require(_0x67cc('0x5'));var path=require(_0x67cc('0x6'));var sox=require(_0x67cc('0x7'));var csv=require(_0x67cc('0x8'));var ejs=require(_0x67cc('0x9'));var fs=require('fs');var _=require(_0x67cc('0xa'));var squel=require(_0x67cc('0xb'));var crypto=require(_0x67cc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x67cc('0xd'));var toCsv=require(_0x67cc('0x8'));var querystring=require(_0x67cc('0xe'));var Papa=require(_0x67cc('0xf'));var Redis=require(_0x67cc('0x10'));var authService=require(_0x67cc('0x11'));var qs=require(_0x67cc('0x12'));var as=require(_0x67cc('0x13'));var hardwareService=require(_0x67cc('0x14'));var logger=require(_0x67cc('0x15'))(_0x67cc('0x16'));var utils=require(_0x67cc('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x67cc('0x18'));var client=jayson[_0x67cc('0x19')][_0x67cc('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5b7e17,_0x5dd40d,_0x48046c){if(_0x48046c){var _0x1146ec=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1146ec['test'](_0x5dd40d)){return _0x5b7e17;}else{throw new db[(_0x67cc('0x1b'))][(_0x67cc('0x1c'))](_0x67cc('0x1d'));}}else{return _0x5b7e17;}}function respondWithRpcPromise(_0x295684,_0x3e980c,_0x49e282,_0x354752){return new BPromise(function(_0x19e7d1,_0x550c96){var _0x597005=_0x354752||client;return _0x597005[_0x67cc('0x1e')](_0x295684,_0x49e282)[_0x67cc('0x1f')](function(_0x596598){logger[_0x67cc('0x20')](_0x67cc('0x21'),_0x3e980c,_0x67cc('0x22'));logger[_0x67cc('0x23')]('Setting,\x20%s,\x20%s,\x20%s',_0x3e980c,_0x67cc('0x22'),JSON[_0x67cc('0x24')](_0x596598));if(_0x596598[_0x67cc('0x25')]){if(_0x596598['error'][_0x67cc('0x26')]===0x1f4){logger['error'](_0x67cc('0x21'),_0x3e980c,_0x596598[_0x67cc('0x25')][_0x67cc('0x27')]);return _0x550c96(_0x596598[_0x67cc('0x25')][_0x67cc('0x27')]);}logger[_0x67cc('0x25')](_0x67cc('0x21'),_0x3e980c,_0x596598[_0x67cc('0x25')]['message']);return _0x19e7d1(_0x596598[_0x67cc('0x25')]['message']);}else{logger[_0x67cc('0x20')]('Setting,\x20%s,\x20%s',_0x3e980c,'request\x20sent');_0x19e7d1(_0x596598['result'][_0x67cc('0x27')]);}})['catch'](function(_0x1a8c26){logger[_0x67cc('0x25')](_0x67cc('0x21'),_0x3e980c,_0x1a8c26);_0x550c96(_0x1a8c26);});});}function respondWithStatusCode(_0x3ad825,_0x2d72be){_0x2d72be=_0x2d72be||0xcc;return function(_0x14d444){if(_0x14d444){return _0x3ad825[_0x67cc('0x28')](_0x2d72be);}return _0x3ad825[_0x67cc('0x29')](_0x2d72be)[_0x67cc('0x2a')]();};}function respondWithResult(_0x174f9a,_0x43fafa){_0x43fafa=_0x43fafa||0xc8;return function(_0x1a620e){if(_0x1a620e){return _0x174f9a[_0x67cc('0x29')](_0x43fafa)[_0x67cc('0x2b')](_0x1a620e);}};}function respondWithFilteredResult(_0x1f6954,_0x2f7a67){return function(_0x22a811){if(_0x22a811){var _0x1634a5=_0x22a811[_0x67cc('0x2c')],_0x30469d=_0x2f7a67['offset'],_0x4c278e=_0x2f7a67[_0x67cc('0x2d')]+_0x2f7a67[_0x67cc('0x2e')],_0x53dba4;if(_0x4c278e>=_0x1634a5){_0x4c278e=_0x1634a5;_0x53dba4=0xc8;}else{_0x53dba4=0xce;}_0x1f6954[_0x67cc('0x29')](_0x53dba4);return _0x1f6954[_0x67cc('0x2f')](_0x67cc('0x30'),_0x30469d+'-'+_0x4c278e+'/'+_0x1634a5)[_0x67cc('0x2b')](_0x22a811);}return null;};}function patchUpdates(_0x14355){return function(_0x4ef920){try{jsonpatch[_0x67cc('0x31')](_0x4ef920,_0x14355,!![]);}catch(_0x5e1063){return BPromise['reject'](_0x5e1063);}return _0x4ef920['save']();};}function saveUpdates(_0x38fe7c,_0x3b84ca){return function(_0x496dab){if(_0x496dab){return _0x496dab[_0x67cc('0x32')](_0x38fe7c)[_0x67cc('0x1f')](function(_0x12c6b6){return _0x12c6b6;});}return null;};}function removeEntity(_0x4f17bf,_0x455d27){return function(_0xbcf466){if(_0xbcf466){return _0xbcf466[_0x67cc('0x33')]()['then'](function(){_0x4f17bf[_0x67cc('0x29')](0xcc)[_0x67cc('0x2a')]();});}};}function handleEntityNotFound(_0x8d03fc,_0x2b27ec){return function(_0x3dd308){if(!_0x3dd308){_0x8d03fc[_0x67cc('0x28')](0x194);}return _0x3dd308;};}function handleError(_0x450491,_0x211517){_0x211517=_0x211517||0x1f4;return function(_0x2a738c){logger['error'](_0x2a738c[_0x67cc('0x34')]);if(_0x2a738c[_0x67cc('0x35')]){delete _0x2a738c[_0x67cc('0x35')];}_0x450491['status'](_0x211517)[_0x67cc('0x36')](_0x2a738c);};}exports['index']=function(_0x4da879,_0x23f08c){var _0x12f7b3={},_0x121d34={},_0x5a1444={'count':0x0,'rows':[]};var _0xc8de1a=_[_0x67cc('0x37')](db['Setting']['rawAttributes'],function(_0x44ce9a){return{'name':_0x44ce9a[_0x67cc('0x38')],'type':_0x44ce9a[_0x67cc('0x39')]['key']};});_0x121d34[_0x67cc('0x3a')]=_[_0x67cc('0x37')](_0xc8de1a,'name');_0x121d34[_0x67cc('0x3b')]=_[_0x67cc('0x3c')](_0x4da879[_0x67cc('0x3b')]);_0x121d34[_0x67cc('0x3d')]=_['intersection'](_0x121d34[_0x67cc('0x3a')],_0x121d34['query']);_0x12f7b3[_0x67cc('0x3e')]=_[_0x67cc('0x3f')](_0x121d34[_0x67cc('0x3a')],qs[_0x67cc('0x40')](_0x4da879[_0x67cc('0x3b')][_0x67cc('0x40')]));_0x12f7b3['attributes']=_0x12f7b3[_0x67cc('0x3e')][_0x67cc('0x41')]?_0x12f7b3[_0x67cc('0x3e')]:_0x121d34['model'];if(!_0x4da879[_0x67cc('0x3b')][_0x67cc('0x42')](_0x67cc('0x43'))){_0x12f7b3[_0x67cc('0x2e')]=qs[_0x67cc('0x2e')](_0x4da879[_0x67cc('0x3b')][_0x67cc('0x2e')]);_0x12f7b3[_0x67cc('0x2d')]=qs[_0x67cc('0x2d')](_0x4da879['query']['offset']);}_0x12f7b3[_0x67cc('0x44')]=qs['sort'](_0x4da879['query'][_0x67cc('0x45')]);_0x12f7b3[_0x67cc('0x46')]=qs[_0x67cc('0x3d')](_[_0x67cc('0x47')](_0x4da879[_0x67cc('0x3b')],_0x121d34[_0x67cc('0x3d')]),_0xc8de1a);if(_0x4da879[_0x67cc('0x3b')][_0x67cc('0x48')]){_0x12f7b3[_0x67cc('0x46')]=_['merge'](_0x12f7b3[_0x67cc('0x46')],{'$or':_[_0x67cc('0x37')](_0xc8de1a,function(_0x474ef1){if(_0x474ef1[_0x67cc('0x39')]!==_0x67cc('0x49')){var _0x2dd8b4={};_0x2dd8b4[_0x474ef1[_0x67cc('0x35')]]={'$like':'%'+_0x4da879[_0x67cc('0x3b')][_0x67cc('0x48')]+'%'};return _0x2dd8b4;}})});}_0x12f7b3=_[_0x67cc('0x4a')]({},_0x12f7b3,_0x4da879['options']);var _0x4ab0f4={'where':_0x12f7b3[_0x67cc('0x46')]};return db[_0x67cc('0x4b')][_0x67cc('0x2c')](_0x4ab0f4)['then'](function(_0x260f52){_0x5a1444[_0x67cc('0x2c')]=_0x260f52;if(_0x4da879['query'][_0x67cc('0x4c')]){_0x12f7b3[_0x67cc('0x4d')]=[{'all':!![]}];}return db[_0x67cc('0x4b')][_0x67cc('0x4e')](_0x12f7b3);})[_0x67cc('0x1f')](function(_0x1304ca){_0x5a1444[_0x67cc('0x4f')]=_0x1304ca;return _0x5a1444;})[_0x67cc('0x1f')](respondWithFilteredResult(_0x23f08c,_0x12f7b3))['catch'](handleError(_0x23f08c,null));};exports[_0x67cc('0x50')]=function(_0x1cb3f8,_0x512f09){var _0x5c88e3={'raw':![],'where':{'id':_0x1cb3f8[_0x67cc('0x51')]['id']}},_0x23325b={};_0x23325b[_0x67cc('0x3a')]=_[_0x67cc('0x3c')](db['Setting'][_0x67cc('0x52')]);_0x23325b['query']=_[_0x67cc('0x3c')](_0x1cb3f8[_0x67cc('0x3b')]);_0x23325b[_0x67cc('0x3d')]=_['intersection'](_0x23325b[_0x67cc('0x3a')],_0x23325b[_0x67cc('0x3b')]);_0x5c88e3['attributes']=_[_0x67cc('0x3f')](_0x23325b[_0x67cc('0x3a')],qs[_0x67cc('0x40')](_0x1cb3f8[_0x67cc('0x3b')]['fields']));_0x5c88e3['attributes']=_0x5c88e3[_0x67cc('0x3e')][_0x67cc('0x41')]?_0x5c88e3[_0x67cc('0x3e')]:_0x23325b[_0x67cc('0x3a')];if(_0x1cb3f8[_0x67cc('0x3b')][_0x67cc('0x4c')]){_0x5c88e3['include']=[{'all':!![]}];}_0x5c88e3=_[_0x67cc('0x4a')]({},_0x5c88e3,_0x1cb3f8['options']);return db[_0x67cc('0x4b')][_0x67cc('0x53')](_0x5c88e3)['then'](handleEntityNotFound(_0x512f09,null))[_0x67cc('0x1f')](respondWithResult(_0x512f09,null))[_0x67cc('0x54')](handleError(_0x512f09,null));};exports[_0x67cc('0x32')]=function(_0x41272a,_0xe86227){if(_0x41272a[_0x67cc('0x55')]['id']){delete _0x41272a[_0x67cc('0x55')]['id'];}return db['Setting']['find']({'where':{'id':_0x41272a['params']['id']}})[_0x67cc('0x1f')](handleEntityNotFound(_0xe86227,null))[_0x67cc('0x1f')](saveUpdates(_0x41272a['body'],null))[_0x67cc('0x1f')](respondWithResult(_0xe86227,null))[_0x67cc('0x54')](handleError(_0xe86227,null));};exports[_0x67cc('0x56')]=function(_0x6e018f,_0x2c7419,_0x29219a){if(_0x6e018f[_0x67cc('0x57')]&&_0x6e018f[_0x67cc('0x57')][_0x67cc('0x58')]){_0x6e018f['body'][_0x67cc('0x59')]=_0x6e018f[_0x67cc('0x57')][_0x67cc('0x58')];}return db[_0x67cc('0x4b')][_0x67cc('0x53')]({'where':{'id':_0x6e018f[_0x67cc('0x51')]['id']}})[_0x67cc('0x1f')](handleEntityNotFound(_0x2c7419,null))[_0x67cc('0x1f')](saveUpdates(_0x6e018f[_0x67cc('0x55')],null))[_0x67cc('0x1f')](respondWithResult(_0x2c7419,null))[_0x67cc('0x54')](handleError(_0x2c7419,null));};exports['addLogoLogin']=function(_0x188d59,_0x48abe6,_0xecd24f){if(_0x188d59[_0x67cc('0x57')]&&_0x188d59[_0x67cc('0x57')][_0x67cc('0x58')]){_0x188d59[_0x67cc('0x55')][_0x67cc('0x5a')]=_0x188d59['file'][_0x67cc('0x58')];}return db[_0x67cc('0x4b')][_0x67cc('0x53')]({'where':{'id':_0x188d59[_0x67cc('0x51')]['id']}})[_0x67cc('0x1f')](handleEntityNotFound(_0x48abe6,null))[_0x67cc('0x1f')](saveUpdates(_0x188d59[_0x67cc('0x55')],null))[_0x67cc('0x1f')](respondWithResult(_0x48abe6,null))[_0x67cc('0x54')](handleError(_0x48abe6,null));};var utilLicense=require(_0x67cc('0x5b'));exports[_0x67cc('0x5c')]=function(_0x2656fd,_0x2f34e5,_0x2eca54){var _0x285338=_0x67cc('0x5d');var _0x3890ec={'custom':![]};return utilLicense[_0x67cc('0x5e')]()[_0x67cc('0x1f')](function(_0x36e70d){if(_0x36e70d){_0x3890ec=_0x36e70d;}return db[_0x67cc('0x4b')]['find']({'where':{'id':_0x2656fd[_0x67cc('0x51')]['id']},'attributes':[_0x67cc('0x59'),_0x67cc('0x5a'),_0x67cc('0x5f'),'favicon','defaultLogo','defaultLoginLogo','defaultPreferred',_0x67cc('0x60')],'raw':!![]});})[_0x67cc('0x1f')](handleEntityNotFound(_0x2f34e5,null))[_0x67cc('0x1f')](function(_0xf33427){if(_0xf33427){var _0x291b58=_0xf33427[_0x67cc('0x59')]&&fs[_0x67cc('0x61')](path[_0x67cc('0x62')](config[_0x67cc('0x63')],_0x285338,_['toLower'](_0xf33427[_0x67cc('0x59')])))?path[_0x67cc('0x62')](config['root'],_0x285338,_[_0x67cc('0x64')](_0xf33427[_0x67cc('0x59')])):path[_0x67cc('0x62')](config[_0x67cc('0x63')],_0x285338,_[_0x67cc('0x64')]('default_logo.svg'));var _0x3b7e57=_0x67cc('0x65')+_['upperFirst'](_0x67cc('0x59'));if(_0xf33427[_0x3b7e57]||!_0x3890ec['custom']){_0x291b58=path[_0x67cc('0x62')](config['root'],_0x285338,_[_0x67cc('0x64')](_0x67cc('0x66')));}if(!fs[_0x67cc('0x61')](_0x291b58)){throw new db['Sequelize'][(_0x67cc('0x1c'))](_[_0x67cc('0x67')](_0x67cc('0x59'))+_0x67cc('0x68'));}return _0x2f34e5[_0x67cc('0x69')](_0x291b58);}})[_0x67cc('0x54')](handleError(_0x2f34e5,null));};var utilLicense=require(_0x67cc('0x5b'));exports[_0x67cc('0x6a')]=function(_0x26975c,_0x1bb196,_0x49abf7){var _0x1f5698=_0x67cc('0x5d');var _0x11ffdc={'custom':![]};return utilLicense[_0x67cc('0x5e')]()[_0x67cc('0x1f')](function(_0x4b0418){if(_0x4b0418){_0x11ffdc=_0x4b0418;}return db['Setting'][_0x67cc('0x53')]({'where':{'id':_0x26975c['params']['id']},'attributes':[_0x67cc('0x59'),_0x67cc('0x5a'),_0x67cc('0x5f'),_0x67cc('0x6b'),_0x67cc('0x6c'),_0x67cc('0x6d'),_0x67cc('0x6e'),_0x67cc('0x60')],'raw':!![]});})[_0x67cc('0x1f')](handleEntityNotFound(_0x1bb196,null))[_0x67cc('0x1f')](function(_0x3ea426){if(_0x3ea426){var _0x134778=_0x3ea426['loginLogo']&&fs[_0x67cc('0x61')](path[_0x67cc('0x62')](config[_0x67cc('0x63')],_0x1f5698,_[_0x67cc('0x64')](_0x3ea426[_0x67cc('0x5a')])))?path['join'](config[_0x67cc('0x63')],_0x1f5698,_[_0x67cc('0x64')](_0x3ea426[_0x67cc('0x5a')])):path[_0x67cc('0x62')](config['root'],_0x1f5698,_[_0x67cc('0x64')](_0x67cc('0x6f')));var _0x52b391=_0x67cc('0x65')+_[_0x67cc('0x67')](_0x67cc('0x5a'));if(_0x3ea426[_0x52b391]||!_0x11ffdc[_0x67cc('0x70')]){_0x134778=path[_0x67cc('0x62')](config[_0x67cc('0x63')],_0x1f5698,_[_0x67cc('0x64')](_0x67cc('0x6f')));}if(!fs[_0x67cc('0x61')](_0x134778)){throw new db[(_0x67cc('0x1b'))][(_0x67cc('0x1c'))](_[_0x67cc('0x67')]('loginLogo')+'\x20not\x20found');}return _0x1bb196['download'](_0x134778);}})['catch'](handleError(_0x1bb196,null));};exports['gdpr']=function(_0xf68f41,_0x44f76d){return db[_0x67cc('0x4b')]['find']({'where':{'id':_0xf68f41[_0x67cc('0x51')]['id']},'attributes':[_0x67cc('0x71')]})[_0x67cc('0x1f')](respondWithResult(_0x44f76d,null))[_0x67cc('0x54')](handleError(_0x44f76d,null));};exports[_0x67cc('0x72')]=function(_0x2df8ab,_0xd27cf9,_0x911883){if(_0x2df8ab[_0x67cc('0x57')]&&_0x2df8ab['file'][_0x67cc('0x58')]){_0x2df8ab['body'][_0x67cc('0x5f')]=_0x2df8ab[_0x67cc('0x57')][_0x67cc('0x58')];}return db[_0x67cc('0x4b')]['find']({'where':{'id':_0x2df8ab[_0x67cc('0x51')]['id']}})[_0x67cc('0x1f')](handleEntityNotFound(_0xd27cf9,null))[_0x67cc('0x1f')](saveUpdates(_0x2df8ab['body'],null))[_0x67cc('0x1f')](respondWithResult(_0xd27cf9,null))[_0x67cc('0x54')](handleError(_0xd27cf9,null));};var utilLicense=require(_0x67cc('0x5b'));exports[_0x67cc('0x73')]=function(_0x3b863e,_0xff03f8,_0x550c94){var _0x1d0925=_0x67cc('0x5d');var _0x460456={'custom':![]};return utilLicense[_0x67cc('0x5e')]()[_0x67cc('0x1f')](function(_0xaf399c){if(_0xaf399c){_0x460456=_0xaf399c;}return db[_0x67cc('0x4b')]['find']({'where':{'id':_0x3b863e[_0x67cc('0x51')]['id']},'attributes':['logo',_0x67cc('0x5a'),_0x67cc('0x5f'),_0x67cc('0x6b'),_0x67cc('0x6c'),_0x67cc('0x6d'),'defaultPreferred',_0x67cc('0x60')],'raw':!![]});})[_0x67cc('0x1f')](handleEntityNotFound(_0xff03f8,null))[_0x67cc('0x1f')](function(_0x404525){if(_0x404525){var _0x20e6db=_0x404525[_0x67cc('0x5f')]&&fs[_0x67cc('0x61')](path['join'](config[_0x67cc('0x63')],_0x1d0925,_[_0x67cc('0x64')](_0x404525[_0x67cc('0x5f')])))?path[_0x67cc('0x62')](config[_0x67cc('0x63')],_0x1d0925,_[_0x67cc('0x64')](_0x404525['preferred'])):path[_0x67cc('0x62')](config[_0x67cc('0x63')],_0x1d0925,_[_0x67cc('0x64')](_0x67cc('0x74')));var _0x387845=_0x67cc('0x65')+_['upperFirst'](_0x67cc('0x5f'));if(_0x404525[_0x387845]||!_0x460456[_0x67cc('0x70')]||!_0x460456[_0x67cc('0x5f')]){_0x20e6db=path[_0x67cc('0x62')](config[_0x67cc('0x63')],_0x1d0925,_[_0x67cc('0x64')](_0x67cc('0x74')));}if(!fs[_0x67cc('0x61')](_0x20e6db)){throw new db[(_0x67cc('0x1b'))][(_0x67cc('0x1c'))](_[_0x67cc('0x67')](_0x67cc('0x5f'))+_0x67cc('0x68'));}return _0xff03f8[_0x67cc('0x69')](_0x20e6db);}})['catch'](handleError(_0xff03f8,null));};exports[_0x67cc('0x75')]=function(_0x5e8b06,_0x194d1b,_0x3bbdb5){if(_0x5e8b06[_0x67cc('0x57')]&&_0x5e8b06[_0x67cc('0x57')]['filename']){_0x5e8b06[_0x67cc('0x55')]['favicon']=_0x5e8b06[_0x67cc('0x57')]['filename'];}return db[_0x67cc('0x4b')][_0x67cc('0x53')]({'where':{'id':_0x5e8b06[_0x67cc('0x51')]['id']}})['then'](handleEntityNotFound(_0x194d1b,null))[_0x67cc('0x1f')](saveUpdates(_0x5e8b06[_0x67cc('0x55')],null))[_0x67cc('0x1f')](respondWithResult(_0x194d1b,null))[_0x67cc('0x54')](handleError(_0x194d1b,null));};var utilLicense=require(_0x67cc('0x5b'));exports[_0x67cc('0x76')]=function(_0x3c07e2,_0x4fc076,_0x5c7d8b){var _0x27625b=_0x67cc('0x5d');var _0x14bcb6={'custom':![]};return utilLicense[_0x67cc('0x5e')]()[_0x67cc('0x1f')](function(_0x57b134){if(_0x57b134){_0x14bcb6=_0x57b134;}return db[_0x67cc('0x4b')]['find']({'where':{'id':_0x3c07e2[_0x67cc('0x51')]['id']},'attributes':['logo',_0x67cc('0x5a'),_0x67cc('0x5f'),_0x67cc('0x6b'),_0x67cc('0x6c'),_0x67cc('0x6d'),_0x67cc('0x6e'),_0x67cc('0x60')],'raw':!![]});})[_0x67cc('0x1f')](handleEntityNotFound(_0x4fc076,null))[_0x67cc('0x1f')](function(_0x400133){if(_0x400133){var _0x2c9d80=_0x400133[_0x67cc('0x6b')]&&fs[_0x67cc('0x61')](path[_0x67cc('0x62')](config[_0x67cc('0x63')],_0x27625b,_[_0x67cc('0x64')](_0x400133[_0x67cc('0x6b')])))?path[_0x67cc('0x62')](config[_0x67cc('0x63')],_0x27625b,_[_0x67cc('0x64')](_0x400133['favicon'])):path[_0x67cc('0x62')](config[_0x67cc('0x63')],_0x27625b,_[_0x67cc('0x64')](_0x67cc('0x77')));var _0xe56a81='default'+_[_0x67cc('0x67')]('favicon');if(_0x400133[_0xe56a81]||!_0x14bcb6['custom']){_0x2c9d80=path['join'](config[_0x67cc('0x63')],_0x27625b,_[_0x67cc('0x64')](_0x67cc('0x77')));}if(!fs[_0x67cc('0x61')](_0x2c9d80)){throw new db[(_0x67cc('0x1b'))][(_0x67cc('0x1c'))](_[_0x67cc('0x67')](_0x67cc('0x6b'))+'\x20not\x20found');}return _0x4fc076[_0x67cc('0x69')](_0x2c9d80);}})[_0x67cc('0x54')](handleError(_0x4fc076,null));}; \ No newline at end of file +var _0xfb23=['Content-Range','apply','save','update','stack','name','index','Setting','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','params','fields','length','body','addLogo','file','filename','logo','addLogoLogin','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','getLogoLogin','loginLogo','defaultFavicon','default_loginLogo.svg','download','gdpr','find','addPreferred','getPreferred','defaultLogo','default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','html-pdf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','Setting,\x20%s,\x20%s','result','catch','sendStatus','status','json','count','limit','set'];(function(_0x404303,_0xcf6dee){var _0x2bb9e5=function(_0x3a2e12){while(--_0x3a2e12){_0x404303['push'](_0x404303['shift']());}};_0x2bb9e5(++_0xcf6dee);}(_0xfb23,0xbf));var _0x3fb2=function(_0x15305a,_0x203b15){_0x15305a=_0x15305a-0x0;var _0x5319c2=_0xfb23[_0x15305a];return _0x5319c2;};'use strict';var pdf=require(_0x3fb2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3fb2('0x1'));var rp=require('request-promise');var moment=require(_0x3fb2('0x2'));var BPromise=require(_0x3fb2('0x3'));var Mustache=require(_0x3fb2('0x4'));var util=require(_0x3fb2('0x5'));var path=require('path');var sox=require(_0x3fb2('0x6'));var csv=require('to-csv');var ejs=require(_0x3fb2('0x7'));var fs=require('fs');var _=require(_0x3fb2('0x8'));var squel=require(_0x3fb2('0x9'));var crypto=require(_0x3fb2('0xa'));var jsforce=require(_0x3fb2('0xb'));var deskjs=require(_0x3fb2('0xc'));var toCsv=require(_0x3fb2('0xd'));var querystring=require(_0x3fb2('0xe'));var Papa=require(_0x3fb2('0xf'));var Redis=require(_0x3fb2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3fb2('0x11'));var as=require(_0x3fb2('0x12'));var hardwareService=require(_0x3fb2('0x13'));var logger=require(_0x3fb2('0x14'))('api');var utils=require(_0x3fb2('0x15'));var config=require(_0x3fb2('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3fb2('0x17'));var client=jayson[_0x3fb2('0x18')][_0x3fb2('0x19')]({'port':0x232a});function checkPasswordPattern(_0x34c677,_0x213025,_0x575464){if(_0x575464){var _0x2e58a1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e58a1[_0x3fb2('0x1a')](_0x213025)){return _0x34c677;}else{throw new db[(_0x3fb2('0x1b'))][(_0x3fb2('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x34c677;}}function respondWithRpcPromise(_0x1da681,_0x37dcf6,_0x1db582,_0x563938){return new BPromise(function(_0x435b2a,_0x17e042){var _0x553c78=_0x563938||client;return _0x553c78[_0x3fb2('0x1d')](_0x1da681,_0x1db582)[_0x3fb2('0x1e')](function(_0x530249){logger[_0x3fb2('0x1f')]('Setting,\x20%s,\x20%s',_0x37dcf6,_0x3fb2('0x20'));logger[_0x3fb2('0x21')](_0x3fb2('0x22'),_0x37dcf6,_0x3fb2('0x20'),JSON['stringify'](_0x530249));if(_0x530249[_0x3fb2('0x23')]){if(_0x530249[_0x3fb2('0x23')][_0x3fb2('0x24')]===0x1f4){logger[_0x3fb2('0x23')]('Setting,\x20%s,\x20%s',_0x37dcf6,_0x530249[_0x3fb2('0x23')]['message']);return _0x17e042(_0x530249[_0x3fb2('0x23')][_0x3fb2('0x25')]);}logger[_0x3fb2('0x23')](_0x3fb2('0x26'),_0x37dcf6,_0x530249['error'][_0x3fb2('0x25')]);return _0x435b2a(_0x530249[_0x3fb2('0x23')][_0x3fb2('0x25')]);}else{logger[_0x3fb2('0x1f')](_0x3fb2('0x26'),_0x37dcf6,_0x3fb2('0x20'));_0x435b2a(_0x530249[_0x3fb2('0x27')][_0x3fb2('0x25')]);}})[_0x3fb2('0x28')](function(_0x403d28){logger[_0x3fb2('0x23')](_0x3fb2('0x26'),_0x37dcf6,_0x403d28);_0x17e042(_0x403d28);});});}function respondWithStatusCode(_0xef3e10,_0x3a44f2){_0x3a44f2=_0x3a44f2||0xcc;return function(_0x19fde7){if(_0x19fde7){return _0xef3e10[_0x3fb2('0x29')](_0x3a44f2);}return _0xef3e10[_0x3fb2('0x2a')](_0x3a44f2)['end']();};}function respondWithResult(_0x17c8d4,_0x40f365){_0x40f365=_0x40f365||0xc8;return function(_0x291c75){if(_0x291c75){return _0x17c8d4[_0x3fb2('0x2a')](_0x40f365)[_0x3fb2('0x2b')](_0x291c75);}};}function respondWithFilteredResult(_0x46445b,_0x435baa){return function(_0x219295){if(_0x219295){var _0x14f966=_0x219295[_0x3fb2('0x2c')],_0x58ce51=_0x435baa['offset'],_0x409f8f=_0x435baa['offset']+_0x435baa[_0x3fb2('0x2d')],_0x3adbcf;if(_0x409f8f>=_0x14f966){_0x409f8f=_0x14f966;_0x3adbcf=0xc8;}else{_0x3adbcf=0xce;}_0x46445b['status'](_0x3adbcf);return _0x46445b[_0x3fb2('0x2e')](_0x3fb2('0x2f'),_0x58ce51+'-'+_0x409f8f+'/'+_0x14f966)[_0x3fb2('0x2b')](_0x219295);}return null;};}function patchUpdates(_0x44a467){return function(_0x291c7c){try{jsonpatch[_0x3fb2('0x30')](_0x291c7c,_0x44a467,!![]);}catch(_0x40e622){return BPromise['reject'](_0x40e622);}return _0x291c7c[_0x3fb2('0x31')]();};}function saveUpdates(_0x5f3c58,_0x136a85){return function(_0x453314){if(_0x453314){return _0x453314[_0x3fb2('0x32')](_0x5f3c58)[_0x3fb2('0x1e')](function(_0x54b2e1){return _0x54b2e1;});}return null;};}function removeEntity(_0x4dadb4,_0x798669){return function(_0x2b1ccf){if(_0x2b1ccf){return _0x2b1ccf['destroy']()[_0x3fb2('0x1e')](function(){_0x4dadb4[_0x3fb2('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f89f8,_0x13a19a){return function(_0x5d3465){if(!_0x5d3465){_0x4f89f8[_0x3fb2('0x29')](0x194);}return _0x5d3465;};}function handleError(_0x3d541c,_0x1d5a4d){_0x1d5a4d=_0x1d5a4d||0x1f4;return function(_0x23cd5d){logger[_0x3fb2('0x23')](_0x23cd5d[_0x3fb2('0x33')]);if(_0x23cd5d[_0x3fb2('0x34')]){delete _0x23cd5d[_0x3fb2('0x34')];}_0x3d541c[_0x3fb2('0x2a')](_0x1d5a4d)['send'](_0x23cd5d);};}exports[_0x3fb2('0x35')]=function(_0x1d55f9,_0x270902){var _0x165be1={},_0x1f4335={},_0x107386={'count':0x0,'rows':[]};var _0x26ad9b=_['map'](db[_0x3fb2('0x36')][_0x3fb2('0x37')],function(_0x3c6be2){return{'name':_0x3c6be2[_0x3fb2('0x38')],'type':_0x3c6be2['type'][_0x3fb2('0x39')]};});_0x1f4335[_0x3fb2('0x3a')]=_[_0x3fb2('0x3b')](_0x26ad9b,_0x3fb2('0x34'));_0x1f4335[_0x3fb2('0x3c')]=_[_0x3fb2('0x3d')](_0x1d55f9[_0x3fb2('0x3c')]);_0x1f4335[_0x3fb2('0x3e')]=_[_0x3fb2('0x3f')](_0x1f4335['model'],_0x1f4335[_0x3fb2('0x3c')]);_0x165be1[_0x3fb2('0x40')]=_[_0x3fb2('0x3f')](_0x1f4335[_0x3fb2('0x3a')],qs['fields'](_0x1d55f9['query']['fields']));_0x165be1[_0x3fb2('0x40')]=_0x165be1[_0x3fb2('0x40')]['length']?_0x165be1[_0x3fb2('0x40')]:_0x1f4335[_0x3fb2('0x3a')];if(!_0x1d55f9[_0x3fb2('0x3c')][_0x3fb2('0x41')](_0x3fb2('0x42'))){_0x165be1[_0x3fb2('0x2d')]=qs[_0x3fb2('0x2d')](_0x1d55f9['query'][_0x3fb2('0x2d')]);_0x165be1['offset']=qs['offset'](_0x1d55f9[_0x3fb2('0x3c')][_0x3fb2('0x43')]);}_0x165be1[_0x3fb2('0x44')]=qs[_0x3fb2('0x45')](_0x1d55f9[_0x3fb2('0x3c')][_0x3fb2('0x45')]);_0x165be1['where']=qs[_0x3fb2('0x3e')](_[_0x3fb2('0x46')](_0x1d55f9[_0x3fb2('0x3c')],_0x1f4335['filters']),_0x26ad9b);if(_0x1d55f9[_0x3fb2('0x3c')][_0x3fb2('0x47')]){_0x165be1[_0x3fb2('0x48')]=_[_0x3fb2('0x49')](_0x165be1[_0x3fb2('0x48')],{'$or':_[_0x3fb2('0x3b')](_0x26ad9b,function(_0x1e84dd){if(_0x1e84dd['type']!==_0x3fb2('0x4a')){var _0x4e6ed9={};_0x4e6ed9[_0x1e84dd[_0x3fb2('0x34')]]={'$like':'%'+_0x1d55f9['query'][_0x3fb2('0x47')]+'%'};return _0x4e6ed9;}})});}_0x165be1=_[_0x3fb2('0x49')]({},_0x165be1,_0x1d55f9[_0x3fb2('0x4b')]);var _0x581c11={'where':_0x165be1['where']};return db['Setting'][_0x3fb2('0x2c')](_0x581c11)[_0x3fb2('0x1e')](function(_0x53b53b){_0x107386['count']=_0x53b53b;if(_0x1d55f9[_0x3fb2('0x3c')][_0x3fb2('0x4c')]){_0x165be1[_0x3fb2('0x4d')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x165be1);})['then'](function(_0x5c97cd){_0x107386[_0x3fb2('0x4e')]=_0x5c97cd;return _0x107386;})[_0x3fb2('0x1e')](respondWithFilteredResult(_0x270902,_0x165be1))['catch'](handleError(_0x270902,null));};exports['show']=function(_0x1b7890,_0x59ad2b){var _0x396950={'raw':![],'where':{'id':_0x1b7890[_0x3fb2('0x4f')]['id']}},_0x193282={};_0x193282[_0x3fb2('0x3a')]=_['keys'](db[_0x3fb2('0x36')][_0x3fb2('0x37')]);_0x193282[_0x3fb2('0x3c')]=_[_0x3fb2('0x3d')](_0x1b7890[_0x3fb2('0x3c')]);_0x193282[_0x3fb2('0x3e')]=_[_0x3fb2('0x3f')](_0x193282['model'],_0x193282['query']);_0x396950[_0x3fb2('0x40')]=_[_0x3fb2('0x3f')](_0x193282[_0x3fb2('0x3a')],qs[_0x3fb2('0x50')](_0x1b7890['query'][_0x3fb2('0x50')]));_0x396950['attributes']=_0x396950[_0x3fb2('0x40')][_0x3fb2('0x51')]?_0x396950[_0x3fb2('0x40')]:_0x193282['model'];if(_0x1b7890[_0x3fb2('0x3c')]['includeAll']){_0x396950[_0x3fb2('0x4d')]=[{'all':!![]}];}_0x396950=_[_0x3fb2('0x49')]({},_0x396950,_0x1b7890['options']);return db['Setting']['find'](_0x396950)[_0x3fb2('0x1e')](handleEntityNotFound(_0x59ad2b,null))[_0x3fb2('0x1e')](respondWithResult(_0x59ad2b,null))[_0x3fb2('0x28')](handleError(_0x59ad2b,null));};exports[_0x3fb2('0x32')]=function(_0x2d32e8,_0x3f3248){if(_0x2d32e8[_0x3fb2('0x52')]['id']){delete _0x2d32e8['body']['id'];}return db['Setting']['find']({'where':{'id':_0x2d32e8[_0x3fb2('0x4f')]['id']}})[_0x3fb2('0x1e')](handleEntityNotFound(_0x3f3248,null))[_0x3fb2('0x1e')](saveUpdates(_0x2d32e8[_0x3fb2('0x52')],null))[_0x3fb2('0x1e')](respondWithResult(_0x3f3248,null))[_0x3fb2('0x28')](handleError(_0x3f3248,null));};exports[_0x3fb2('0x53')]=function(_0x4be848,_0x4fc795,_0x2f8c14){if(_0x4be848[_0x3fb2('0x54')]&&_0x4be848[_0x3fb2('0x54')][_0x3fb2('0x55')]){_0x4be848[_0x3fb2('0x52')][_0x3fb2('0x56')]=_0x4be848[_0x3fb2('0x54')][_0x3fb2('0x55')];}return db[_0x3fb2('0x36')]['find']({'where':{'id':_0x4be848[_0x3fb2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4fc795,null))[_0x3fb2('0x1e')](saveUpdates(_0x4be848[_0x3fb2('0x52')],null))[_0x3fb2('0x1e')](respondWithResult(_0x4fc795,null))['catch'](handleError(_0x4fc795,null));};exports[_0x3fb2('0x57')]=function(_0x2fe152,_0x31e80d,_0x5e5f17){if(_0x2fe152[_0x3fb2('0x54')]&&_0x2fe152[_0x3fb2('0x54')][_0x3fb2('0x55')]){_0x2fe152['body']['loginLogo']=_0x2fe152[_0x3fb2('0x54')][_0x3fb2('0x55')];}return db[_0x3fb2('0x36')]['find']({'where':{'id':_0x2fe152[_0x3fb2('0x4f')]['id']}})[_0x3fb2('0x1e')](handleEntityNotFound(_0x31e80d,null))['then'](saveUpdates(_0x2fe152['body'],null))[_0x3fb2('0x1e')](respondWithResult(_0x31e80d,null))[_0x3fb2('0x28')](handleError(_0x31e80d,null));};var utilLicense=require(_0x3fb2('0x58'));exports[_0x3fb2('0x59')]=function(_0x29af0c,_0x473059,_0x20820c){var _0x95e4cb=_0x3fb2('0x5a');var _0xb03048={'custom':![]};return utilLicense[_0x3fb2('0x5b')]()[_0x3fb2('0x1e')](function(_0x4e6f03){if(_0x4e6f03){_0xb03048=_0x4e6f03;}return db[_0x3fb2('0x36')]['find']({'where':{'id':_0x29af0c['params']['id']},'attributes':[_0x3fb2('0x56'),'loginLogo',_0x3fb2('0x5c'),_0x3fb2('0x5d'),'defaultLogo',_0x3fb2('0x5e'),_0x3fb2('0x5f'),'defaultFavicon'],'raw':!![]});})[_0x3fb2('0x1e')](handleEntityNotFound(_0x473059,null))[_0x3fb2('0x1e')](function(_0x15687f){if(_0x15687f){var _0x4f3487=_0x15687f[_0x3fb2('0x56')]&&fs[_0x3fb2('0x60')](path[_0x3fb2('0x61')](config[_0x3fb2('0x62')],_0x95e4cb,_[_0x3fb2('0x63')](_0x15687f[_0x3fb2('0x56')])))?path[_0x3fb2('0x61')](config[_0x3fb2('0x62')],_0x95e4cb,_[_0x3fb2('0x63')](_0x15687f[_0x3fb2('0x56')])):path[_0x3fb2('0x61')](config[_0x3fb2('0x62')],_0x95e4cb,_[_0x3fb2('0x63')](_0x3fb2('0x64')));var _0x3f582f=_0x3fb2('0x65')+_[_0x3fb2('0x66')](_0x3fb2('0x56'));if(_0x15687f[_0x3f582f]||!_0xb03048[_0x3fb2('0x67')]){_0x4f3487=path['join'](config[_0x3fb2('0x62')],_0x95e4cb,_['toLower'](_0x3fb2('0x64')));}if(!fs[_0x3fb2('0x60')](_0x4f3487)){throw new db[(_0x3fb2('0x1b'))]['ValidationError'](_[_0x3fb2('0x66')]('logo')+'\x20not\x20found');}return _0x473059['download'](_0x4f3487);}})[_0x3fb2('0x28')](handleError(_0x473059,null));};var utilLicense=require(_0x3fb2('0x58'));exports[_0x3fb2('0x68')]=function(_0x2008c2,_0x542041,_0x11d7df){var _0x3d61a3=_0x3fb2('0x5a');var _0x7b4b1={'custom':![]};return utilLicense['getLicense']()[_0x3fb2('0x1e')](function(_0x530283){if(_0x530283){_0x7b4b1=_0x530283;}return db[_0x3fb2('0x36')]['find']({'where':{'id':_0x2008c2['params']['id']},'attributes':[_0x3fb2('0x56'),_0x3fb2('0x69'),'preferred',_0x3fb2('0x5d'),'defaultLogo',_0x3fb2('0x5e'),_0x3fb2('0x5f'),_0x3fb2('0x6a')],'raw':!![]});})[_0x3fb2('0x1e')](handleEntityNotFound(_0x542041,null))[_0x3fb2('0x1e')](function(_0x58044a){if(_0x58044a){var _0x4e3b19=_0x58044a[_0x3fb2('0x69')]&&fs['existsSync'](path[_0x3fb2('0x61')](config[_0x3fb2('0x62')],_0x3d61a3,_[_0x3fb2('0x63')](_0x58044a[_0x3fb2('0x69')])))?path['join'](config[_0x3fb2('0x62')],_0x3d61a3,_[_0x3fb2('0x63')](_0x58044a[_0x3fb2('0x69')])):path['join'](config[_0x3fb2('0x62')],_0x3d61a3,_[_0x3fb2('0x63')](_0x3fb2('0x6b')));var _0x4cb5cd='default'+_[_0x3fb2('0x66')]('loginLogo');if(_0x58044a[_0x4cb5cd]||!_0x7b4b1['custom']){_0x4e3b19=path[_0x3fb2('0x61')](config[_0x3fb2('0x62')],_0x3d61a3,_[_0x3fb2('0x63')](_0x3fb2('0x6b')));}if(!fs[_0x3fb2('0x60')](_0x4e3b19)){throw new db[(_0x3fb2('0x1b'))][(_0x3fb2('0x1c'))](_[_0x3fb2('0x66')](_0x3fb2('0x69'))+'\x20not\x20found');}return _0x542041[_0x3fb2('0x6c')](_0x4e3b19);}})['catch'](handleError(_0x542041,null));};exports[_0x3fb2('0x6d')]=function(_0x21dcfb,_0x2ed38b){return db[_0x3fb2('0x36')][_0x3fb2('0x6e')]({'where':{'id':_0x21dcfb[_0x3fb2('0x4f')]['id']},'attributes':['securePassword']})[_0x3fb2('0x1e')](respondWithResult(_0x2ed38b,null))[_0x3fb2('0x28')](handleError(_0x2ed38b,null));};exports[_0x3fb2('0x6f')]=function(_0x20484c,_0x3abd03,_0x2f70ec){if(_0x20484c[_0x3fb2('0x54')]&&_0x20484c[_0x3fb2('0x54')]['filename']){_0x20484c['body'][_0x3fb2('0x5c')]=_0x20484c[_0x3fb2('0x54')][_0x3fb2('0x55')];}return db[_0x3fb2('0x36')][_0x3fb2('0x6e')]({'where':{'id':_0x20484c[_0x3fb2('0x4f')]['id']}})[_0x3fb2('0x1e')](handleEntityNotFound(_0x3abd03,null))[_0x3fb2('0x1e')](saveUpdates(_0x20484c[_0x3fb2('0x52')],null))[_0x3fb2('0x1e')](respondWithResult(_0x3abd03,null))[_0x3fb2('0x28')](handleError(_0x3abd03,null));};var utilLicense=require('../../config/license/util');exports[_0x3fb2('0x70')]=function(_0x1710ed,_0x3ae29f,_0x48e6f1){var _0xfe4ed9=_0x3fb2('0x5a');var _0xe3c637={'custom':![]};return utilLicense[_0x3fb2('0x5b')]()[_0x3fb2('0x1e')](function(_0xed1623){if(_0xed1623){_0xe3c637=_0xed1623;}return db[_0x3fb2('0x36')][_0x3fb2('0x6e')]({'where':{'id':_0x1710ed[_0x3fb2('0x4f')]['id']},'attributes':[_0x3fb2('0x56'),_0x3fb2('0x69'),_0x3fb2('0x5c'),_0x3fb2('0x5d'),_0x3fb2('0x71'),_0x3fb2('0x5e'),'defaultPreferred',_0x3fb2('0x6a')],'raw':!![]});})[_0x3fb2('0x1e')](handleEntityNotFound(_0x3ae29f,null))['then'](function(_0x1d8a13){if(_0x1d8a13){var _0x327b0e=_0x1d8a13['preferred']&&fs[_0x3fb2('0x60')](path[_0x3fb2('0x61')](config[_0x3fb2('0x62')],_0xfe4ed9,_['toLower'](_0x1d8a13[_0x3fb2('0x5c')])))?path[_0x3fb2('0x61')](config['root'],_0xfe4ed9,_[_0x3fb2('0x63')](_0x1d8a13['preferred'])):path[_0x3fb2('0x61')](config[_0x3fb2('0x62')],_0xfe4ed9,_[_0x3fb2('0x63')](_0x3fb2('0x72')));var _0x476305=_0x3fb2('0x65')+_[_0x3fb2('0x66')](_0x3fb2('0x5c'));if(_0x1d8a13[_0x476305]||!_0xe3c637[_0x3fb2('0x67')]||!_0xe3c637[_0x3fb2('0x5c')]){_0x327b0e=path[_0x3fb2('0x61')](config[_0x3fb2('0x62')],_0xfe4ed9,_[_0x3fb2('0x63')](_0x3fb2('0x72')));}if(!fs[_0x3fb2('0x60')](_0x327b0e)){throw new db['Sequelize'][(_0x3fb2('0x1c'))](_[_0x3fb2('0x66')](_0x3fb2('0x5c'))+_0x3fb2('0x73'));}return _0x3ae29f['download'](_0x327b0e);}})[_0x3fb2('0x28')](handleError(_0x3ae29f,null));};exports[_0x3fb2('0x74')]=function(_0x2e2df7,_0x39a96d,_0x47a0d3){if(_0x2e2df7[_0x3fb2('0x54')]&&_0x2e2df7['file'][_0x3fb2('0x55')]){_0x2e2df7[_0x3fb2('0x52')][_0x3fb2('0x5d')]=_0x2e2df7['file'][_0x3fb2('0x55')];}return db[_0x3fb2('0x36')][_0x3fb2('0x6e')]({'where':{'id':_0x2e2df7[_0x3fb2('0x4f')]['id']}})[_0x3fb2('0x1e')](handleEntityNotFound(_0x39a96d,null))[_0x3fb2('0x1e')](saveUpdates(_0x2e2df7[_0x3fb2('0x52')],null))[_0x3fb2('0x1e')](respondWithResult(_0x39a96d,null))[_0x3fb2('0x28')](handleError(_0x39a96d,null));};var utilLicense=require('../../config/license/util');exports[_0x3fb2('0x75')]=function(_0x21dff2,_0xb2a035,_0x6343b2){var _0x382547=_0x3fb2('0x5a');var _0x56eef0={'custom':![]};return utilLicense[_0x3fb2('0x5b')]()[_0x3fb2('0x1e')](function(_0x5d71d8){if(_0x5d71d8){_0x56eef0=_0x5d71d8;}return db[_0x3fb2('0x36')][_0x3fb2('0x6e')]({'where':{'id':_0x21dff2[_0x3fb2('0x4f')]['id']},'attributes':[_0x3fb2('0x56'),'loginLogo',_0x3fb2('0x5c'),'favicon',_0x3fb2('0x71'),_0x3fb2('0x5e'),_0x3fb2('0x5f'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0xb2a035,null))[_0x3fb2('0x1e')](function(_0x33247f){if(_0x33247f){var _0x1e6033=_0x33247f[_0x3fb2('0x5d')]&&fs['existsSync'](path[_0x3fb2('0x61')](config['root'],_0x382547,_['toLower'](_0x33247f[_0x3fb2('0x5d')])))?path[_0x3fb2('0x61')](config[_0x3fb2('0x62')],_0x382547,_['toLower'](_0x33247f[_0x3fb2('0x5d')])):path[_0x3fb2('0x61')](config[_0x3fb2('0x62')],_0x382547,_['toLower'](_0x3fb2('0x76')));var _0x5a5f90=_0x3fb2('0x65')+_[_0x3fb2('0x66')](_0x3fb2('0x5d'));if(_0x33247f[_0x5a5f90]||!_0x56eef0[_0x3fb2('0x67')]){_0x1e6033=path[_0x3fb2('0x61')](config[_0x3fb2('0x62')],_0x382547,_[_0x3fb2('0x63')](_0x3fb2('0x76')));}if(!fs[_0x3fb2('0x60')](_0x1e6033)){throw new db[(_0x3fb2('0x1b'))][(_0x3fb2('0x1c'))](_[_0x3fb2('0x66')](_0x3fb2('0x5d'))+_0x3fb2('0x73'));}return _0xb2a035['download'](_0x1e6033);}})[_0x3fb2('0x28')](handleError(_0xb2a035,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index f008bc9..6cf0b09 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 _0xa293=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Setting','settings','lodash'];(function(_0x1c7a76,_0x3b6ac2){var _0x59f3f8=function(_0x4635b8){while(--_0x4635b8){_0x1c7a76['push'](_0x1c7a76['shift']());}};_0x59f3f8(++_0x3b6ac2);}(_0xa293,0x117));var _0x3a29=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xa293[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x3a29('0x0'));var util=require(_0x3a29('0x1'));var logger=require(_0x3a29('0x2'))(_0x3a29('0x3'));var moment=require(_0x3a29('0x4'));var BPromise=require(_0x3a29('0x5'));var rp=require(_0x3a29('0x6'));var fs=require('fs');var path=require(_0x3a29('0x7'));var rimraf=require(_0x3a29('0x8'));var config=require(_0x3a29('0x9'));var attributes=require('./setting.attributes');module[_0x3a29('0xa')]=function(_0x404307,_0x2336cc){return _0x404307[_0x3a29('0xb')](_0x3a29('0xc'),attributes,{'tableName':_0x3a29('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9da=['rimraf','../../config/environment','exports','define','Setting','settings','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb9da,0x7b));var _0xab9d=function(_0x2af160,_0x765b1){_0x2af160=_0x2af160-0x0;var _0x439d67=_0xb9da[_0x2af160];return _0x439d67;};'use strict';var _=require(_0xab9d('0x0'));var util=require(_0xab9d('0x1'));var logger=require(_0xab9d('0x2'))('api');var moment=require(_0xab9d('0x3'));var BPromise=require(_0xab9d('0x4'));var rp=require(_0xab9d('0x5'));var fs=require('fs');var path=require(_0xab9d('0x6'));var rimraf=require(_0xab9d('0x7'));var config=require(_0xab9d('0x8'));var attributes=require('./setting.attributes');module[_0xab9d('0x9')]=function(_0x531e9a,_0x35a8b9){return _0x531e9a[_0xab9d('0xa')](_0xab9d('0xb'),attributes,{'tableName':_0xab9d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index dc9f387..8f86e7a 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 _0x4b47=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','Setting,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x115b95,_0xa1f8b9){var _0x460b3d=function(_0x510c02){while(--_0x510c02){_0x115b95['push'](_0x115b95['shift']());}};_0x460b3d(++_0xa1f8b9);}(_0x4b47,0x91));var _0x74b4=function(_0x55dbd0,_0x341a80){_0x55dbd0=_0x55dbd0-0x0;var _0xda1a93=_0x4b47[_0x55dbd0];return _0xda1a93;};'use strict';var _=require(_0x74b4('0x0'));var util=require(_0x74b4('0x1'));var moment=require(_0x74b4('0x2'));var BPromise=require(_0x74b4('0x3'));var rs=require(_0x74b4('0x4'));var fs=require('fs');var Redis=require(_0x74b4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x74b4('0x6'));var logger=require(_0x74b4('0x7'))(_0x74b4('0x8'));var config=require(_0x74b4('0x9'));var jayson=require(_0x74b4('0xa'));var client=jayson[_0x74b4('0xb')][_0x74b4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1bf98f,_0x3226e4,_0x504f2d){return new BPromise(function(_0xd6fc85,_0x13102f){return client[_0x74b4('0xd')](_0x1bf98f,_0x504f2d)[_0x74b4('0xe')](function(_0x222f7b){logger[_0x74b4('0xf')]('Setting,\x20%s,\x20%s',_0x3226e4,_0x74b4('0x10'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x3226e4,'request\x20sent',JSON[_0x74b4('0x11')](_0x222f7b));if(_0x222f7b[_0x74b4('0x12')]){if(_0x222f7b[_0x74b4('0x12')]['code']===0x1f4){logger['error'](_0x74b4('0x13'),_0x3226e4,_0x222f7b[_0x74b4('0x12')][_0x74b4('0x14')]);return _0x13102f(_0x222f7b[_0x74b4('0x12')][_0x74b4('0x14')]);}logger['error'](_0x74b4('0x13'),_0x3226e4,_0x222f7b['error']['message']);return _0xd6fc85(_0x222f7b[_0x74b4('0x12')][_0x74b4('0x14')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x3226e4,_0x74b4('0x10'));_0xd6fc85(_0x222f7b[_0x74b4('0x15')][_0x74b4('0x14')]);}})['catch'](function(_0x183b2c){logger[_0x74b4('0x12')](_0x74b4('0x13'),_0x3226e4,_0x183b2c);_0x13102f(_0x183b2c);});});} \ No newline at end of file +var _0x9177=['info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x6032a8,_0x89e2fb){var _0x3df9d6=function(_0x4ac795){while(--_0x4ac795){_0x6032a8['push'](_0x6032a8['shift']());}};_0x3df9d6(++_0x89e2fb);}(_0x9177,0xc6));var _0x7917=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x9177[_0x2a7b8e];return _0x29b5c8;};'use strict';var _=require(_0x7917('0x0'));var util=require('util');var moment=require(_0x7917('0x1'));var BPromise=require(_0x7917('0x2'));var rs=require(_0x7917('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7917('0x4'));var logger=require('../../config/logger')(_0x7917('0x5'));var config=require(_0x7917('0x6'));var jayson=require(_0x7917('0x7'));var client=jayson['client'][_0x7917('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x256f58,_0x2e8632,_0x446a28){return new BPromise(function(_0x59353d,_0x3debf6){return client[_0x7917('0x9')](_0x256f58,_0x446a28)[_0x7917('0xa')](function(_0x43ba5f){logger[_0x7917('0xb')](_0x7917('0xc'),_0x2e8632,'request\x20sent');logger[_0x7917('0xd')](_0x7917('0xe'),_0x2e8632,'request\x20sent',JSON['stringify'](_0x43ba5f));if(_0x43ba5f[_0x7917('0xf')]){if(_0x43ba5f[_0x7917('0xf')][_0x7917('0x10')]===0x1f4){logger[_0x7917('0xf')]('Setting,\x20%s,\x20%s',_0x2e8632,_0x43ba5f[_0x7917('0xf')][_0x7917('0x11')]);return _0x3debf6(_0x43ba5f[_0x7917('0xf')][_0x7917('0x11')]);}logger['error'](_0x7917('0xc'),_0x2e8632,_0x43ba5f[_0x7917('0xf')]['message']);return _0x59353d(_0x43ba5f[_0x7917('0xf')]['message']);}else{logger[_0x7917('0xb')](_0x7917('0xc'),_0x2e8632,'request\x20sent');_0x59353d(_0x43ba5f['result'][_0x7917('0x11')]);}})[_0x7917('0x12')](function(_0x4ecd42){logger[_0x7917('0xf')](_0x7917('0xc'),_0x2e8632,_0x4ecd42);_0x3debf6(_0x4ecd42);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d0504f4..18439fd 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 _0xc3bc=['/:id/notify','notify','/:id/applications','addApplications','/:id/send','status','/:id/users','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','create','/:id/dispositions','addAnswer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc3bc,0x10b));var _0xcc3b=function(_0x2ac756,_0x33408b){_0x2ac756=_0x2ac756-0x0;var _0xa621fb=_0xc3bc[_0x2ac756];return _0xa621fb;};'use strict';var multer=require(_0xcc3b('0x0'));var util=require('util');var path=require(_0xcc3b('0x1'));var timeout=require(_0xcc3b('0x2'));var express=require(_0xcc3b('0x3'));var router=express[_0xcc3b('0x4')]();var auth=require(_0xcc3b('0x5'));var interaction=require(_0xcc3b('0x6'));var config=require(_0xcc3b('0x7'));var controller=require(_0xcc3b('0x8'));router[_0xcc3b('0x9')]('/',auth['isAuthenticated'](),controller[_0xcc3b('0xa')]);router[_0xcc3b('0x9')](_0xcc3b('0xb'),auth[_0xcc3b('0xc')](),controller[_0xcc3b('0xd')]);router[_0xcc3b('0x9')](_0xcc3b('0xe'),auth[_0xcc3b('0xc')](),controller['show']);router[_0xcc3b('0x9')]('/:id/dispositions',auth[_0xcc3b('0xc')](),controller['getDispositions']);router['get'](_0xcc3b('0xf'),auth['isAuthenticated'](),controller[_0xcc3b('0x10')]);router[_0xcc3b('0x9')]('/:id/applications',auth[_0xcc3b('0xc')](),controller[_0xcc3b('0x11')]);router['get'](_0xcc3b('0x12'),auth[_0xcc3b('0xc')](),controller[_0xcc3b('0x13')]);router[_0xcc3b('0x9')](_0xcc3b('0x14'),controller[_0xcc3b('0x15')]);router['get']('/:id/users',auth[_0xcc3b('0xc')](),controller[_0xcc3b('0x16')]);router[_0xcc3b('0x17')]('/',auth[_0xcc3b('0xc')](),controller[_0xcc3b('0x18')]);router[_0xcc3b('0x17')](_0xcc3b('0x19'),auth[_0xcc3b('0xc')](),controller['addDisposition']);router[_0xcc3b('0x17')](_0xcc3b('0xf'),auth[_0xcc3b('0xc')](),controller[_0xcc3b('0x1a')]);router[_0xcc3b('0x17')](_0xcc3b('0x1b'),controller[_0xcc3b('0x1c')]);router[_0xcc3b('0x17')](_0xcc3b('0x1d'),auth[_0xcc3b('0xc')](),controller[_0xcc3b('0x1e')]);router[_0xcc3b('0x17')](_0xcc3b('0x1f'),auth[_0xcc3b('0xc')](),controller['send']);router[_0xcc3b('0x17')]('/:id/status',controller[_0xcc3b('0x20')]);router[_0xcc3b('0x17')](_0xcc3b('0x21'),auth[_0xcc3b('0xc')](),controller[_0xcc3b('0x22')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xcc3b('0x23')]);router[_0xcc3b('0x24')](_0xcc3b('0xe'),auth[_0xcc3b('0xc')](),controller[_0xcc3b('0x25')]);router['delete'](_0xcc3b('0x19'),auth['isAuthenticated'](),controller[_0xcc3b('0x26')]);router[_0xcc3b('0x24')](_0xcc3b('0xf'),auth[_0xcc3b('0xc')](),controller[_0xcc3b('0x27')]);router[_0xcc3b('0x24')]('/:id/users',auth[_0xcc3b('0xc')](),controller[_0xcc3b('0x28')]);module[_0xcc3b('0x29')]=router; \ No newline at end of file +var _0xef6c=['/:id','get','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','/:id/status','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','/:id/applications','/:id/send','send','status','addAgents','put','delete','destroy','removeAnswers','removeAgents','multer','util','path','Router','../../config/environment','./smsAccount.controller','isAuthenticated','index','/describe','describe'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xef6c,0x10e));var _0xcef6=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xef6c[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require(_0xcef6('0x0'));var util=require(_0xcef6('0x1'));var path=require(_0xcef6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcef6('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcef6('0x4'));var controller=require(_0xcef6('0x5'));router['get']('/',auth[_0xcef6('0x6')](),controller[_0xcef6('0x7')]);router['get'](_0xcef6('0x8'),auth[_0xcef6('0x6')](),controller[_0xcef6('0x9')]);router['get'](_0xcef6('0xa'),auth[_0xcef6('0x6')](),controller['show']);router[_0xcef6('0xb')](_0xcef6('0xc'),auth[_0xcef6('0x6')](),controller[_0xcef6('0xd')]);router[_0xcef6('0xb')](_0xcef6('0xe'),auth[_0xcef6('0x6')](),controller[_0xcef6('0xf')]);router[_0xcef6('0xb')]('/:id/applications',auth[_0xcef6('0x6')](),controller[_0xcef6('0x10')]);router[_0xcef6('0xb')](_0xcef6('0x11'),auth[_0xcef6('0x6')](),controller['getInteractions']);router[_0xcef6('0xb')](_0xcef6('0x12'),controller['statusGet']);router[_0xcef6('0xb')](_0xcef6('0x13'),auth['isAuthenticated'](),controller[_0xcef6('0x14')]);router[_0xcef6('0x15')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xcef6('0x16')]);router[_0xcef6('0x15')](_0xcef6('0xe'),auth[_0xcef6('0x6')](),controller[_0xcef6('0x17')]);router[_0xcef6('0x15')](_0xcef6('0x18'),controller['notify']);router[_0xcef6('0x15')](_0xcef6('0x19'),auth[_0xcef6('0x6')](),controller['addApplications']);router['post'](_0xcef6('0x1a'),auth[_0xcef6('0x6')](),controller[_0xcef6('0x1b')]);router[_0xcef6('0x15')](_0xcef6('0x12'),controller[_0xcef6('0x1c')]);router[_0xcef6('0x15')](_0xcef6('0x13'),auth[_0xcef6('0x6')](),controller[_0xcef6('0x1d')]);router[_0xcef6('0x1e')](_0xcef6('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xcef6('0x1f')](_0xcef6('0xa'),auth[_0xcef6('0x6')](),controller[_0xcef6('0x20')]);router[_0xcef6('0x1f')](_0xcef6('0xc'),auth[_0xcef6('0x6')](),controller['removeDispositions']);router[_0xcef6('0x1f')](_0xcef6('0xe'),auth['isAuthenticated'](),controller[_0xcef6('0x21')]);router[_0xcef6('0x1f')](_0xcef6('0x13'),auth[_0xcef6('0x6')](),controller[_0xcef6('0x22')]);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 3bea0f5..b92b463 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 _0x6b26=['csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','plivo','clickatell'];(function(_0x1e6478,_0x31004c){var _0x42108c=function(_0x55441b){while(--_0x55441b){_0x1e6478['push'](_0x1e6478['shift']());}};_0x42108c(++_0x31004c);}(_0x6b26,0x113));var _0x66b2=function(_0x1d7b49,_0x3048f6){_0x1d7b49=_0x1d7b49-0x0;var _0x41a035=_0x6b26[_0x1d7b49];return _0x41a035;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x66b2('0x0'));module[_0x66b2('0x1')]={'name':{'type':Sequelize[_0x66b2('0x2')],'unique':_0x66b2('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x66b2('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x66b2('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x66b2('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x66b2('0x5')](_0x66b2('0x6'),_0x66b2('0x7'),_0x66b2('0x8'),'clicksend',_0x66b2('0x9'),_0x66b2('0xa'),_0x66b2('0xb'),_0x66b2('0xc'),_0x66b2('0xd'))},'accountSid':{'type':Sequelize[_0x66b2('0x2')]},'authId':{'type':Sequelize[_0x66b2('0x2')]},'authToken':{'type':Sequelize[_0x66b2('0x2')]},'smsMethod':{'type':Sequelize[_0x66b2('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x66b2('0x2')]},'apiKey':{'type':Sequelize[_0x66b2('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x66b2('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x66b2('0x2')]},'notificationTemplate':{'type':Sequelize[_0x66b2('0xf')],'defaultValue':function(){return _0x66b2('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x66b2('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x66b2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x66b2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x66b2('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x66b2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x66b2('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x66b2('0x11')],'comment':_0x66b2('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x43fa7c){if(!_0x43fa7c)this[_0x66b2('0x13')](_0x66b2('0x14'),null);this[_0x66b2('0x13')](_0x66b2('0x15'),_0x43fa7c);}}}; \ No newline at end of file +var _0xe9d8=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','STRING','name','generate','ENUM','twilio','skebby','connectel','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9d8,0xe8));var _0x8e9d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe9d8[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8e9d('0x0'));module['exports']={'name':{'type':Sequelize[_0x8e9d('0x1')],'unique':_0x8e9d('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x8e9d('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x8e9d('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x8e9d('0x1')],'defaultValue':function(){return rs[_0x8e9d('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8e9d('0x4')](_0x8e9d('0x5'),_0x8e9d('0x6'),_0x8e9d('0x7'),'clicksend',_0x8e9d('0x8'),_0x8e9d('0x9'),_0x8e9d('0xa'),_0x8e9d('0xb'),_0x8e9d('0xc'))},'accountSid':{'type':Sequelize[_0x8e9d('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x8e9d('0x1')]},'smsMethod':{'type':Sequelize[_0x8e9d('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x8e9d('0x1')]},'password':{'type':Sequelize[_0x8e9d('0x1')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x8e9d('0x1')]},'deliveryReport':{'type':Sequelize[_0x8e9d('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x8e9d('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x8e9d('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8e9d('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8e9d('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8e9d('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8e9d('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8e9d('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8e9d('0xf')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8e9d('0xd')],'defaultValue':![],'comment':_0x8e9d('0x10'),'set':function(_0x1a88d5){if(!_0x1a88d5)this[_0x8e9d('0x11')](_0x8e9d('0x12'),null);this[_0x8e9d('0x11')]('mandatoryDisposition',_0x1a88d5);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 746e82e..3b2d319 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 _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x3311ae,_0x362cee){var _0x107949=function(_0x2082a3){while(--_0x2082a3){_0x3311ae['push'](_0x3311ae['shift']());}};_0x107949(++_0x362cee);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');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 db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file +var _0x7a54=['findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','spread','dataValues','push','log','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','limit','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','user','role','SmsAccounts','UserProfileSection','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','SmsApplication','Applications','account','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','From','Body','messageId','skebby','from','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','intelepeer','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','Contacts','contact','SmsInteraction','interaction','applications','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','addApplications','sequelize','bulkCreate'];(function(_0x2d4eef,_0x4962aa){var _0x506eba=function(_0x38041f){while(--_0x38041f){_0x2d4eef['push'](_0x2d4eef['shift']());}};_0x506eba(++_0x4962aa);}(_0x7a54,0x106));var _0x47a5=function(_0x31b2da,_0x5748e5){_0x31b2da=_0x31b2da-0x0;var _0x4ba56a=_0x7a54[_0x31b2da];return _0x4ba56a;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');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 db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);var jayson=require(_0x47a5('0x1a'));var client=jayson[_0x47a5('0x1b')][_0x47a5('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x190faa,_0x4e99a8,_0x362359){if(_0x362359){var _0x11faf5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11faf5[_0x47a5('0x1d')](_0x4e99a8)){return _0x190faa;}else{throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x190faa;}}function respondWithRpcPromise(_0x549de3,_0x138bc0,_0x4b966e,_0x5247fd){return new BPromise(function(_0x423a81,_0xaf70a6){var _0x2ce454=_0x5247fd||client;return _0x2ce454[_0x47a5('0x20')](_0x549de3,_0x4b966e)[_0x47a5('0x21')](function(_0x12b98e){logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,_0x47a5('0x24'));logger['debug'](_0x47a5('0x25'),_0x138bc0,_0x47a5('0x24'),JSON['stringify'](_0x12b98e));if(_0x12b98e[_0x47a5('0x26')]){if(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x27')]===0x1f4){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);return _0xaf70a6(_0x12b98e[_0x47a5('0x26')]['message']);}logger[_0x47a5('0x26')](_0x47a5('0x23'),_0x138bc0,_0x12b98e['error'][_0x47a5('0x28')]);return _0x423a81(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);}else{logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,'request\x20sent');_0x423a81(_0x12b98e['result'][_0x47a5('0x28')]);}})['catch'](function(_0x1ea9c8){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x1ea9c8);_0xaf70a6(_0x1ea9c8);});});}function respondWithStatusCode(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0xcc;return function(_0x1dac65){if(_0x1dac65){return _0x378208[_0x47a5('0x29')](_0x36ad34);}return _0x378208[_0x47a5('0x2a')](_0x36ad34)[_0x47a5('0x2b')]();};}function respondWithResult(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0xc8;return function(_0x361bfa){if(_0x361bfa){return _0x136b14[_0x47a5('0x2a')](_0x16631f)[_0x47a5('0x2c')](_0x361bfa);}};}function respondWithFilteredResult(_0x3ad507,_0x528582){return function(_0x243210){if(_0x243210){var _0x51833b=_0x243210['count'],_0x2ef875=_0x528582[_0x47a5('0x2d')],_0x9ac908=_0x528582[_0x47a5('0x2d')]+_0x528582[_0x47a5('0x2e')],_0x16901f;if(_0x9ac908>=_0x51833b){_0x9ac908=_0x51833b;_0x16901f=0xc8;}else{_0x16901f=0xce;}_0x3ad507[_0x47a5('0x2a')](_0x16901f);return _0x3ad507['set']('Content-Range',_0x2ef875+'-'+_0x9ac908+'/'+_0x51833b)[_0x47a5('0x2c')](_0x243210);}return null;};}function patchUpdates(_0xfb5ddb){return function(_0x5bd7eb){try{jsonpatch['apply'](_0x5bd7eb,_0xfb5ddb,!![]);}catch(_0x836303){return BPromise[_0x47a5('0x2f')](_0x836303);}return _0x5bd7eb['save']();};}function saveUpdates(_0x42f70c,_0x53119b){return function(_0x122ed6){if(_0x122ed6){return _0x122ed6[_0x47a5('0x30')](_0x42f70c)['then'](function(_0x4843c0){return _0x4843c0;});}return null;};}function removeEntity(_0x274e34,_0x5910bb){return function(_0x403028){if(_0x403028){return _0x403028[_0x47a5('0x31')]()[_0x47a5('0x21')](function(){var _0x52749b=_0x403028[_0x47a5('0x32')]({'plain':!![]});var _0x50c086='SmsAccounts';return db[_0x47a5('0x33')]['destroy']({'where':{'type':_0x50c086,'resourceId':_0x52749b['id']}})[_0x47a5('0x21')](function(){return _0x403028;});})['then'](function(){_0x274e34[_0x47a5('0x2a')](0xcc)[_0x47a5('0x2b')]();});}};}function handleEntityNotFound(_0x38c8d4,_0x199698){return function(_0x36add5){if(!_0x36add5){_0x38c8d4[_0x47a5('0x29')](0x194);}return _0x36add5;};}function handleError(_0xee582c,_0x452be5){_0x452be5=_0x452be5||0x1f4;return function(_0x1a0d23){logger['error'](_0x1a0d23[_0x47a5('0x34')]);if(_0x1a0d23[_0x47a5('0x35')]){delete _0x1a0d23['name'];}_0xee582c[_0x47a5('0x2a')](_0x452be5)[_0x47a5('0x36')](_0x1a0d23);};}exports[_0x47a5('0x37')]=function(_0x49c4b5,_0x101f70){var _0x10f660={'include':[{'model':db[_0x47a5('0x38')],'as':'mandatoryDispositionPause'}]},_0x596097={},_0x2ebba0={'count':0x0,'rows':[]};var _0x55c5eb=_['map'](db[_0x47a5('0x39')]['rawAttributes'],function(_0x9b5eaf){return{'name':_0x9b5eaf[_0x47a5('0x3a')],'type':_0x9b5eaf[_0x47a5('0x3b')][_0x47a5('0x3c')]};});_0x596097[_0x47a5('0x3d')]=_[_0x47a5('0x3e')](_0x55c5eb,_0x47a5('0x35'));_0x596097[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x49c4b5[_0x47a5('0x3f')]);_0x596097[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],_0x596097['query']);_0x10f660[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x49c4b5['query'][_0x47a5('0x44')]));_0x10f660['attributes']=_0x10f660['attributes']['length']?_0x10f660['attributes']:_0x596097[_0x47a5('0x3d')];if(!_0x49c4b5['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x10f660[_0x47a5('0x2e')]=qs['limit'](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x10f660['offset']=qs['offset'](_0x49c4b5[_0x47a5('0x3f')]['offset']);}_0x10f660[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x10f660[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x49c4b5[_0x47a5('0x3f')],_0x596097[_0x47a5('0x41')]),_0x55c5eb);if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x4b')]){_0x10f660[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x10f660[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x55c5eb,function(_0x3a2b38){if(_0x3a2b38['type']!==_0x47a5('0x4d')){var _0x23bb04={};_0x23bb04[_0x3a2b38['name']]={'$like':'%'+_0x49c4b5['query'][_0x47a5('0x4b')]+'%'};return _0x23bb04;}})});}_0x10f660=_['merge']({},_0x10f660,_0x49c4b5[_0x47a5('0x4e')]);var _0xd93e37={'where':_0x10f660['where']};return db['SmsAccount'][_0x47a5('0x4f')](_0xd93e37)['then'](function(_0x2d147c){_0x2ebba0[_0x47a5('0x4f')]=_0x2d147c;if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x10f660[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x39')][_0x47a5('0x52')](_0x10f660);})['then'](function(_0x48a0ef){_0x2ebba0[_0x47a5('0x53')]=_0x48a0ef;return _0x2ebba0;})[_0x47a5('0x21')](respondWithFilteredResult(_0x101f70,_0x10f660))[_0x47a5('0x54')](handleError(_0x101f70,null));};exports[_0x47a5('0x55')]=function(_0x2c7020,_0x2c0c86){var _0x249de5={'raw':![],'where':{'id':_0x2c7020[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]},_0x492cf7={};_0x492cf7['model']=_[_0x47a5('0x40')](db['SmsAccount'][_0x47a5('0x58')]);_0x492cf7[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x2c7020[_0x47a5('0x3f')]);_0x492cf7['filters']=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],_0x492cf7[_0x47a5('0x3f')]);_0x249de5[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x2c7020['query'][_0x47a5('0x44')]));_0x249de5[_0x47a5('0x43')]=_0x249de5[_0x47a5('0x43')][_0x47a5('0x59')]?_0x249de5[_0x47a5('0x43')]:_0x492cf7[_0x47a5('0x3d')];if(_0x2c7020['query'][_0x47a5('0x50')]){_0x249de5[_0x47a5('0x51')]=[{'all':!![]}];}_0x249de5=_[_0x47a5('0x4c')]({},_0x249de5,_0x2c7020['options']);return db[_0x47a5('0x39')][_0x47a5('0x5a')](_0x249de5)[_0x47a5('0x21')](handleEntityNotFound(_0x2c0c86,null))['then'](respondWithResult(_0x2c0c86,null))['catch'](handleError(_0x2c0c86,null));};exports[_0x47a5('0x5b')]=function(_0x376e1d,_0x4fa1da){return db['SmsAccount'][_0x47a5('0x5b')](_0x376e1d['body'],{})[_0x47a5('0x21')](function(_0x5d383d){var _0x482de6=_0x376e1d[_0x47a5('0x5c')][_0x47a5('0x32')]({'plain':!![]});if(!_0x482de6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482de6[_0x47a5('0x5d')]===_0x47a5('0x5c')){var _0x4b706a=_0x5d383d['get']({'plain':!![]});var _0x16b4fd=_0x47a5('0x5e');return db[_0x47a5('0x5f')][_0x47a5('0x5a')]({'where':{'name':_0x16b4fd,'userProfileId':_0x482de6['userProfileId']},'raw':!![]})[_0x47a5('0x21')](function(_0x2b4255){if(_0x2b4255&&_0x2b4255[_0x47a5('0x60')]===0x0){return db['UserProfileResource'][_0x47a5('0x5b')]({'name':_0x4b706a['name'],'resourceId':_0x4b706a['id'],'type':_0x2b4255[_0x47a5('0x35')],'sectionId':_0x2b4255['id']},{})[_0x47a5('0x21')](function(){return _0x5d383d;});}else{return _0x5d383d;}})[_0x47a5('0x54')](function(_0x1c485b){logger[_0x47a5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c485b);throw _0x1c485b;});}return _0x5d383d;})[_0x47a5('0x21')](respondWithResult(_0x4fa1da,0xc9))['catch'](handleError(_0x4fa1da,null));};exports['update']=function(_0x5eb150,_0x4f8564){if(_0x5eb150[_0x47a5('0x61')]['id']){delete _0x5eb150[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')]['find']({'where':{'id':_0x5eb150['params']['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x4f8564,null))[_0x47a5('0x21')](saveUpdates(_0x5eb150[_0x47a5('0x61')],null))['then'](respondWithResult(_0x4f8564,null))[_0x47a5('0x54')](handleError(_0x4f8564,null));};exports['destroy']=function(_0x22c886,_0x274d31){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x22c886[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x274d31,null))[_0x47a5('0x21')](removeEntity(_0x274d31,null))[_0x47a5('0x54')](handleError(_0x274d31,null));};exports[_0x47a5('0x62')]=function(_0x35cca8,_0x3ac38c){return db['SmsAccount'][_0x47a5('0x62')]()[_0x47a5('0x21')](respondWithResult(_0x3ac38c,null))[_0x47a5('0x54')](handleError(_0x3ac38c,null));};exports[_0x47a5('0x63')]=function(_0x396cb0,_0x4bbe14,_0xbec033){if(_0x396cb0[_0x47a5('0x61')]['id']){delete _0x396cb0[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x396cb0[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4bbe14,null))[_0x47a5('0x21')](function(_0x350af8){if(_0x350af8){_0x396cb0[_0x47a5('0x61')][_0x47a5('0x64')]=_0x350af8['id'];return db[_0x47a5('0x65')][_0x47a5('0x5b')](_0x396cb0[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x4bbe14,null))['catch'](handleError(_0x4bbe14,null));};exports[_0x47a5('0x66')]=function(_0x284fb8,_0x30504e,_0x4b42f3){var _0x37ac59={'raw':![],'where':{}};var _0x2e46af={};var _0x36c67={'count':0x0,'rows':[]};return db[_0x47a5('0x39')]['findOne']({'where':{'id':_0x284fb8[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x30504e,null))[_0x47a5('0x21')](function(_0x487e21){if(_0x487e21){_0x2e46af[_0x47a5('0x3d')]=_['keys'](db[_0x47a5('0x65')][_0x47a5('0x58')]);_0x2e46af[_0x47a5('0x3f')]=_['keys'](_0x284fb8['query']);_0x2e46af['filters']=_[_0x47a5('0x42')](_0x2e46af[_0x47a5('0x3d')],_0x2e46af[_0x47a5('0x3f')]);_0x37ac59[_0x47a5('0x43')]=_['intersection'](_0x2e46af[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x37ac59[_0x47a5('0x43')]=_0x37ac59[_0x47a5('0x43')][_0x47a5('0x59')]?_0x37ac59[_0x47a5('0x43')]:_0x2e46af[_0x47a5('0x3d')];if(!_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x45')](_0x47a5('0x46'))){_0x37ac59['limit']=qs[_0x47a5('0x2e')](_0x284fb8['query'][_0x47a5('0x2e')]);_0x37ac59[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x37ac59[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x37ac59[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x284fb8[_0x47a5('0x3f')],_0x2e46af[_0x47a5('0x41')]));_0x37ac59[_0x47a5('0x49')]['SmsAccountId']=_0x487e21['id'];if(_0x284fb8['query']['filter']){_0x37ac59['where']=_[_0x47a5('0x4c')](_0x37ac59[_0x47a5('0x49')],{'$or':_['map'](_0x37ac59[_0x47a5('0x43')],function(_0x44dda2){var _0x1baa5a={};_0x1baa5a[_0x44dda2]={'$like':'%'+_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1baa5a;})});}_0x37ac59=_[_0x47a5('0x4c')]({},_0x37ac59,_0x284fb8[_0x47a5('0x4e')]);return db[_0x47a5('0x65')][_0x47a5('0x4f')]({'where':_0x37ac59[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x5e5f16){_0x36c67[_0x47a5('0x4f')]=_0x5e5f16;if(_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x37ac59['include']=[{'all':!![]}];}return db[_0x47a5('0x65')][_0x47a5('0x52')](_0x37ac59);})[_0x47a5('0x21')](function(_0x5d41d8){_0x36c67[_0x47a5('0x53')]=_0x5d41d8;return _0x36c67;});}})['then'](respondWithFilteredResult(_0x30504e,_0x37ac59))['catch'](handleError(_0x30504e,null));};exports[_0x47a5('0x67')]=function(_0x292d9c,_0x277486,_0x27333e){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x292d9c['params']['id']}})['then'](handleEntityNotFound(_0x277486,null))[_0x47a5('0x21')](function(_0x4f2361){if(_0x4f2361){return _0x4f2361[_0x47a5('0x67')](_0x292d9c[_0x47a5('0x3f')][_0x47a5('0x68')]);}})[_0x47a5('0x21')](respondWithStatusCode(_0x277486,null))['catch'](handleError(_0x277486,null));};exports[_0x47a5('0x69')]=function(_0x550bde,_0x5f3a04,_0x139c79){if(_0x550bde[_0x47a5('0x61')]['id']){delete _0x550bde['body']['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x550bde[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x5f3a04,null))[_0x47a5('0x21')](function(_0x578e27){if(_0x578e27){_0x550bde[_0x47a5('0x61')][_0x47a5('0x64')]=_0x578e27['id'];return db[_0x47a5('0x6a')]['create'](_0x550bde[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x5f3a04,null))[_0x47a5('0x54')](handleError(_0x5f3a04,null));};exports['getAnswers']=function(_0x3525e7,_0x4f2fbb,_0x3c012b){var _0x491bb4={'raw':![],'where':{}};var _0x135d2e={};var _0x20d8bd={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x3525e7['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4f2fbb,null))[_0x47a5('0x21')](function(_0x23c393){if(_0x23c393){_0x135d2e[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db['CannedAnswer']['rawAttributes']);_0x135d2e[_0x47a5('0x3f')]=_['keys'](_0x3525e7[_0x47a5('0x3f')]);_0x135d2e[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x135d2e['model'],_0x135d2e[_0x47a5('0x3f')]);_0x491bb4[_0x47a5('0x43')]=_['intersection'](_0x135d2e[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x491bb4['attributes']=_0x491bb4['attributes'][_0x47a5('0x59')]?_0x491bb4[_0x47a5('0x43')]:_0x135d2e['model'];if(!_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x45')]('nolimit')){_0x491bb4[_0x47a5('0x2e')]=qs[_0x47a5('0x2e')](_0x3525e7[_0x47a5('0x3f')]['limit']);_0x491bb4[_0x47a5('0x2d')]=qs['offset'](_0x3525e7[_0x47a5('0x3f')]['offset']);}_0x491bb4[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x3525e7['query'][_0x47a5('0x48')]);_0x491bb4['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x3525e7[_0x47a5('0x3f')],_0x135d2e[_0x47a5('0x41')]));_0x491bb4['where'][_0x47a5('0x64')]=_0x23c393['id'];if(_0x3525e7['query']['filter']){_0x491bb4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x491bb4[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x491bb4[_0x47a5('0x43')],function(_0x5b1f5e){var _0x1522a6={};_0x1522a6[_0x5b1f5e]={'$like':'%'+_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1522a6;})});}_0x491bb4=_[_0x47a5('0x4c')]({},_0x491bb4,_0x3525e7['options']);return db[_0x47a5('0x6a')]['count']({'where':_0x491bb4[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x3f93f0){_0x20d8bd[_0x47a5('0x4f')]=_0x3f93f0;if(_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x491bb4[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x6a')][_0x47a5('0x52')](_0x491bb4);})['then'](function(_0x36796e){_0x20d8bd[_0x47a5('0x53')]=_0x36796e;return _0x20d8bd;});}})['then'](respondWithFilteredResult(_0x4f2fbb,_0x491bb4))[_0x47a5('0x54')](handleError(_0x4f2fbb,null));};exports[_0x47a5('0x6c')]=function(_0x6d6a5,_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x6d6a5['params']['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x21')](function(_0x17f82d){if(_0x17f82d){return _0x17f82d['removeAnswers'](_0x6d6a5[_0x47a5('0x3f')][_0x47a5('0x68')]);}})['then'](respondWithStatusCode(_0x5b85cd,null))[_0x47a5('0x54')](handleError(_0x5b85cd,null));};exports[_0x47a5('0x6d')]=function(_0x109805,_0x70c8a6,_0x364bb0){var _0x1371e4={'channel':'sms'};var _0x4c9894=[];var _0x5bd86e=[];var _0x133b7a={};return db[_0x47a5('0x39')]['find']({'where':{'id':_0x109805[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x6e')],'as':_0x47a5('0x6f')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x5084d6){_0x1371e4[_0x47a5('0x70')]=_0x5084d6;_0x1371e4['applications']=_['orderBy'](_0x5084d6['Applications'],[_0x47a5('0x71')],['asc']);if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x6f')]){delete _0x1371e4[_0x47a5('0x70')]['Applications'];}return db[_0x47a5('0x72')][_0x47a5('0x62')]();})[_0x47a5('0x21')](function(_0x121750){if(!_0x121750){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x73'));}_0x4c9894=_[_0x47a5('0x74')](_['keys'](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76')]);_0x5bd86e=_[_0x47a5('0x74')](_[_0x47a5('0x40')](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76'),'CompanyId',_0x47a5('0x77')]);_0x1371e4[_0x47a5('0x61')]={'mapKey':'mobile'};if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){switch(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){case'twilio':_0x1371e4['body']['from']=_0x109805['body'][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x79')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['MessageSid'];break;case _0x47a5('0x7b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['sender'];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body']['text'];break;case _0x47a5('0x7d'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805[_0x47a5('0x61')][_0x47a5('0x28')];break;case'clicksend':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x61')];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7e')];break;case _0x47a5('0x7f'):_0x1371e4['body'][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x80')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x81')];break;case _0x47a5('0x82'):_0x1371e4['body'][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['results'][0x0][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0]['text'];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0][_0x47a5('0x7a')];break;case _0x47a5('0x84'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805['body'][_0x47a5('0x85')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x86')][_0x47a5('0x28')];break;case _0x47a5('0x87'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x88')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805['body'][_0x47a5('0x89')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x8a')];break;case _0x47a5('0x8b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805['body'][_0x47a5('0x7c')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')]['message'];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['refid'];break;}}if(_0x1371e4[_0x47a5('0x61')]['id']){delete _0x1371e4[_0x47a5('0x61')]['id'];}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')]['from'])){throw new db[(_0x47a5('0x1e'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x1371e4[_0x47a5('0x61')]['body'])||_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8d'));}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8f')+_0x5bd86e);}if(!_[_0x47a5('0x90')](_0x5bd86e,_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x91')+_0x5bd86e);}_0x133b7a[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db[_0x47a5('0x92')]['find']({'where':{'id':_0x1371e4[_0x47a5('0x70')]['ListId']},'include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':_0x133b7a,'limit':0x1,'order':[[_0x47a5('0x76'),'DESC']]}]});})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x14771b){if(_0x14771b){_0x1371e4['list']=_['omit'](_0x14771b,[_0x47a5('0x93')]);if(_0x14771b[_0x47a5('0x93')][_0x47a5('0x59')]){return _0x14771b[_0x47a5('0x93')][0x0];}var _0x204bd6=_['defaults'](_0x1371e4[_0x47a5('0x61')],{'firstName':_0x1371e4['body'][_0x47a5('0x7c')],'ListId':_0x14771b['id']});_0x204bd6[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db['CmContact'][_0x47a5('0x5b')](_0x204bd6,{'fields':_0x4c9894,'raw':!![]});}})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x4339d4){if(_0x4339d4){_0x1371e4[_0x47a5('0x94')]=_0x4339d4;var _0x36a44c={'ContactId':_0x4339d4['id'],'phone':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')],'SmsAccountId':_0x109805[_0x47a5('0x56')]['id']};var _0x481bc3={'ContactId':_0x4339d4['id'],'SmsAccountId':_0x109805['params']['id'],'closed':![]};return db[_0x47a5('0x95')]['find']({'where':_0x481bc3})[_0x47a5('0x21')](function(_0x2d0b67){if(_0x2d0b67){return[_0x2d0b67,![]];}return db[_0x47a5('0x95')]['create'](_0x36a44c)[_0x47a5('0x21')](function(_0x26d629){return[_0x26d629,!![]];});});}})['spread'](function(_0xcb6714,_0x51f6cf){_0x1371e4[_0x47a5('0x96')]=_0xcb6714[_0x47a5('0x32')]({'plain':!![]});_0x1371e4[_0x47a5('0x96')]['created']=![];if(_0x51f6cf){if(_0x1371e4['account']['autoclose']){_0x1371e4['applications']['push']({'id':0x0,'priority':_0x1371e4[_0x47a5('0x97')]['length']+0x1,'app':_0x47a5('0x98'),'appdata':_0x47a5('0x99'),'interval':'*,*,*,*'});}_0x1371e4['interaction']['created']=!![];}return db[_0x47a5('0x9a')]['create']({'phone':_0x1371e4['body']['from'],'messageId':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')],'body':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')],'SmsAccountId':_0x109805['params']['id'],'SmsInteractionId':_0xcb6714['id'],'direction':'in','ContactId':_0xcb6714[_0x47a5('0x9b')],'AttachmentId':_0x1371e4['body'][_0x47a5('0x9c')]});})['then'](function(_0x2de924){_0x1371e4[_0x47a5('0x28')]=_0x2de924;if(_0x1371e4[_0x47a5('0x96')]['UserId']){return db[_0x47a5('0x9d')][_0x47a5('0x5a')]({'attributes':['id',_0x47a5('0x35')],'where':{'id':_0x1371e4[_0x47a5('0x96')]['UserId']}})[_0x47a5('0x21')](function(_0x9a7edc){if(_0x9a7edc){_0x1371e4[_0x47a5('0x97')][_0x47a5('0x9e')]({'id':0x0,'priority':0x0,'app':_0x47a5('0x9f'),'appdata':_0x9a7edc[_0x47a5('0x35')]+','+(_0x1371e4['account'][_0x47a5('0xa0')]||0xa),'interval':_0x47a5('0xa1')});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);})[_0x47a5('0x21')](function(_0x2697df){if(_0x2697df){var _0x408887=0xc8;var _0x34fde3=_0x47a5('0xa4');logger[_0x47a5('0x22')](_0x47a5('0x25'),_0x34fde3,_0x408887,_0x47a5('0xa5'));logger[_0x47a5('0xa6')](_0x47a5('0xa7'),_0x34fde3,_0x408887,_0x47a5('0xa5'),JSON['stringify'](_0x2697df));if(_0x1371e4[_0x47a5('0x70')]['type']==='twilio'){return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0xa8')](_0x47a5('0xa9'),'text/xml')[_0x47a5('0x36')](_0x47a5('0xaa'));}else{return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0x2c')](_0x2697df);}}})[_0x47a5('0x54')](handleError(_0x70c8a6,null));};exports[_0x47a5('0xab')]=function(_0x1b1f86,_0x46cb3a,_0x176e71){return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1b1f86[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x46cb3a,null))['then'](function(_0x4aad5f){if(_0x4aad5f){return db[_0x47a5('0xac')]['transaction'](function(_0x249339){return db[_0x47a5('0x6e')][_0x47a5('0x31')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'transaction':_0x249339})[_0x47a5('0x21')](function(_0x3708ea){var _0x583b37=_[_0x47a5('0x3e')](_0x1b1f86[_0x47a5('0x61')],function(_0x380eca){_0x380eca['SmsAccountId']=_0x1b1f86[_0x47a5('0x56')]['id'];return _0x380eca;});return db[_0x47a5('0x6e')][_0x47a5('0xad')](_0x583b37,{'transaction':_0x249339});});})[_0x47a5('0x21')](function(){return db[_0x47a5('0x6e')][_0x47a5('0xae')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'order':_0x47a5('0x71')});});}})[_0x47a5('0x21')](respondWithResult(_0x46cb3a,null))[_0x47a5('0x54')](handleError(_0x46cb3a,null));};exports[_0x47a5('0xaf')]=function(_0x40b7a5,_0x28e998,_0x2ac386){var _0x578983={};var _0x3f7fdc={};var _0x272cd0;var _0x150cff;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x40b7a5[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x28e998,null))['then'](function(_0x185104){if(_0x185104){_0x272cd0=_0x185104;_0x3f7fdc['model']=_[_0x47a5('0x40')](db[_0x47a5('0x6e')][_0x47a5('0x58')]);_0x3f7fdc[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x40b7a5[_0x47a5('0x3f')]);_0x3f7fdc[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],_0x3f7fdc[_0x47a5('0x3f')]);_0x578983[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],qs[_0x47a5('0x44')](_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x578983[_0x47a5('0x43')]=_0x578983['attributes'][_0x47a5('0x59')]?_0x578983[_0x47a5('0x43')]:_0x3f7fdc[_0x47a5('0x3d')];_0x578983[_0x47a5('0x47')]=qs['sort'](_0x40b7a5[_0x47a5('0x3f')]['sort']);_0x578983['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x40b7a5[_0x47a5('0x3f')],_0x3f7fdc[_0x47a5('0x41')]));if(_0x40b7a5['query'][_0x47a5('0x4b')]){_0x578983[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x578983[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x578983[_0x47a5('0x43')],function(_0x5eae8d){var _0x1da268={};_0x1da268[_0x5eae8d]={'$like':'%'+_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1da268;})});}_0x578983=_[_0x47a5('0x4c')]({},_0x578983,_0x40b7a5[_0x47a5('0x4e')]);return _0x272cd0['getApplications'](_0x578983);}})[_0x47a5('0x21')](function(_0x4c7627){if(_0x4c7627){_0x150cff=_0x4c7627[_0x47a5('0x59')];if(!_0x40b7a5['query'][_0x47a5('0x45')]('nolimit')){_0x578983['limit']=qs[_0x47a5('0x2e')](_0x40b7a5[_0x47a5('0x3f')]['limit']);_0x578983[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x40b7a5['query'][_0x47a5('0x2d')]);}return _0x272cd0[_0x47a5('0xaf')](_0x578983);}})[_0x47a5('0x21')](function(_0x508622){if(_0x508622){return _0x508622?{'count':_0x150cff,'rows':_0x508622}:null;}})[_0x47a5('0x21')](respondWithResult(_0x28e998,null))[_0x47a5('0x54')](handleError(_0x28e998,null));};exports[_0x47a5('0xb0')]=function(_0x30b0f9,_0x37721c,_0x53cc9e){var _0x5973d4={'raw':![],'where':{}};var _0x2678cb={};var _0x56808d={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x30b0f9['params']['id']}})['then'](handleEntityNotFound(_0x37721c,null))[_0x47a5('0x21')](function(_0x4997bc){if(_0x4997bc){_0x2678cb[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x95')][_0x47a5('0x58')]);_0x2678cb[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x30b0f9[_0x47a5('0x3f')]);_0x2678cb['filters']=_[_0x47a5('0x42')](_0x2678cb['model'],_0x2678cb[_0x47a5('0x3f')]);_0x5973d4[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x2678cb[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x5973d4[_0x47a5('0x43')]=_0x5973d4[_0x47a5('0x43')][_0x47a5('0x59')]?_0x5973d4[_0x47a5('0x43')]:_0x2678cb[_0x47a5('0x3d')];if(!_0x30b0f9['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x5973d4[_0x47a5('0x2e')]=qs['limit'](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x5973d4[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x5973d4['order']=qs[_0x47a5('0x48')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x5973d4[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x30b0f9[_0x47a5('0x3f')],_0x2678cb[_0x47a5('0x41')]));_0x5973d4[_0x47a5('0x49')][_0x47a5('0x64')]=_0x4997bc['id'];if(_0x30b0f9['query']['filter']){_0x5973d4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x5973d4[_0x47a5('0x49')],{'$or':_['map'](_0x5973d4[_0x47a5('0x43')],function(_0x50b7fc){var _0x522345={};_0x522345[_0x50b7fc]={'$like':'%'+_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x522345;})});}_0x5973d4=_[_0x47a5('0x4c')]({},_0x5973d4,_0x30b0f9[_0x47a5('0x4e')]);return db['SmsInteraction'][_0x47a5('0x4f')]({'where':_0x5973d4[_0x47a5('0x49')]})['then'](function(_0x59ba59){_0x56808d['count']=_0x59ba59;if(_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x5973d4[_0x47a5('0x51')]=[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0xb1'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x47a5('0x35'),_0x47a5('0xb2'),_0x47a5('0xb3')],'required':![]},{'model':db[_0x47a5('0xb4')],'as':'Tags','attributes':['id',_0x47a5('0x35'),_0x47a5('0xb5')],'where':_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0xb6')]?{'id':_0x30b0f9['query']['tag']}:undefined,'required':_0x30b0f9['query'][_0x47a5('0xb6')]?!![]:![]}];}return db[_0x47a5('0x95')][_0x47a5('0x52')](_0x5973d4);})[_0x47a5('0x21')](function(_0x242006){_0x56808d[_0x47a5('0x53')]=_0x242006;return _0x56808d;});}})[_0x47a5('0x21')](respondWithFilteredResult(_0x37721c,_0x5973d4))[_0x47a5('0x54')](handleError(_0x37721c,null));};exports[_0x47a5('0x36')]=function(_0x5b48d0,_0x40fe75,_0x7b5348){var _0x50b482,_0x34ff37,_0x2bbf95;if(_[_0x47a5('0x8c')](_0x5b48d0[_0x47a5('0x61')]['body'])||_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47a5('0x8c')](_0x5b48d0['body']['to'])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0xb7'));}_0x50b482=_0x5b48d0[_0x47a5('0x61')]['to'];return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x5b48d0[_0x47a5('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':{'mobile':_0x50b482},'limit':0x1,'order':[[_0x47a5('0x76'),_0x47a5('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x40fe75,null))['then'](function(_0x3222e4){if(_0x3222e4&&_0x3222e4['List']){_0x34ff37=_0x3222e4[_0x47a5('0x32')]({'plain':!![]});if(_0x34ff37['List']&&_0x34ff37[_0x47a5('0xb9')]['Contacts'][_0x47a5('0x59')]){return _0x34ff37[_0x47a5('0xb9')][_0x47a5('0x93')][0x0];}return db[_0x47a5('0x72')][_0x47a5('0x5b')](_[_0x47a5('0x16')](_0x5b48d0[_0x47a5('0x61')],{'firstName':_0x50b482,'mobile':_0x50b482,'phone':_0x50b482,'ListId':_0x34ff37[_0x47a5('0x77')]}));}})['then'](handleEntityNotFound(_0x40fe75,null))[_0x47a5('0x21')](function(_0x4394f0){if(_0x4394f0){_0x2bbf95=_0x4394f0;return db['SmsInteraction'][_0x47a5('0x5a')]({'where':{'ContactId':_0x2bbf95['id'],'closed':![],'SmsAccountId':_0x34ff37['id']}})[_0x47a5('0x21')](function(_0x54f283){if(_0x54f283){return[_0x54f283,![]];}return db['SmsInteraction'][_0x47a5('0x5b')]({'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id'],'SmsAccountId':_0x34ff37['id'],'phone':_0x50b482,'firstMsgDirection':_0x47a5('0xba'),'Messages':[_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0['body'][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'UserId':_0x5b48d0[_0x47a5('0x5c')]['id'],'ContactId':_0x2bbf95['id']})]},{'include':[{'model':db[_0x47a5('0x9a')],'as':_0x47a5('0xbb')}]})[_0x47a5('0x21')](function(_0x454609){return[_0x454609,!![]];});});}})[_0x47a5('0xbc')](function(_0x5c4301,_0x2bc0d8){if(_0x2bc0d8){return _0x5c4301;}return db[_0x47a5('0x9a')][_0x47a5('0x5b')](_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'SmsInteractionId':_0x5c4301['id'],'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id']}))['then'](function(_0x11d87b){_0x5c4301[_0x47a5('0xbd')][_0x47a5('0xbb')]=[];_0x5c4301['dataValues']['Messages'][_0x47a5('0xbe')](_0x11d87b[_0x47a5('0xbd')]);return _0x5c4301;});})[_0x47a5('0x21')](respondWithResult(_0x40fe75,null))[_0x47a5('0x54')](handleError(_0x40fe75,null));};exports[_0x47a5('0x2a')]=function(_0x4121c1,_0x2e0add,_0x58e85b){if(_0x4121c1[_0x47a5('0x61')]['id']){delete _0x4121c1[_0x47a5('0x61')]['id'];}console[_0x47a5('0xbf')]('endpoint\x20/status\x20POST\x20/',_0x4121c1[_0x47a5('0x61')]);var _0x611b40,_0x144bc9,_0x278b42;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x4121c1[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x9ced85){if(_0x9ced85){_0x278b42=_0x9ced85;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),'received\x20delivery\x20report\x20from',_0x9ced85[_0x47a5('0x3b')],util['inspect'](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));switch(_0x9ced85['type']){case _0x47a5('0x7b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc0')]&&_0x4121c1['body'][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1['body'][_0x47a5('0x2a')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['skebby_dispatch_id']}});}break;case _0x47a5('0x7d'):if(_0x4121c1['body']['requestid']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc2')]}});}break;case _0x47a5('0xc3'):if(_0x4121c1['body']['message_id']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')];return db[_0x47a5('0x9a')]['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0x7e')]}});}break;case _0x47a5('0x82'):var _0x50ff41=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x50ff41[_0x47a5('0x7a')]&&_0x50ff41['status'][_0x47a5('0xc5')]===_0x47a5('0xc6')){_0x144bc9=_0x50ff41[_0x47a5('0x2a')]['groupName'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x50ff41[_0x47a5('0x7a')]}});}break;case _0x47a5('0x87'):if(_0x4121c1[_0x47a5('0x61')]['messageId']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['messageId']}});}break;case _0x47a5('0x8b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc7')]&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')]['status'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x4ebe30){if(_0x4ebe30){_0x611b40=_0x4ebe30;switch(_0x278b42[_0x47a5('0x3b')]){case _0x47a5('0x7b'):if(_0x144bc9===_0x47a5('0xc6')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x7d'):if(_0x144bc9==='1'){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc9')]&&_0x144bc9>=0xc8&&_0x144bc9<=0xce){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xc3'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x82'):var _0x2cc493=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x2cc493[_0x47a5('0x2a')][_0x47a5('0xc5')]===_0x47a5('0xc6')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),'infobip',util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x144bc9==_0x47a5('0xca')||_0x144bc9==_0x47a5('0xcb')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),'status',_0x47a5('0x87'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x8b'):if(_0x144bc9===_0x47a5('0xcc')||_0x144bc9===_0x47a5('0xcd')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x8b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x611b40;}})[_0x47a5('0x21')](respondWithResult(_0x2e0add,null))[_0x47a5('0x54')](handleError(_0x2e0add,null));};exports[_0x47a5('0xce')]=function(_0x138b92,_0x232c36,_0x25954e){var _0x277061,_0x3917e0,_0x1c7695;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x138b92[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x46b82a){if(_0x46b82a){_0x1c7695=_0x46b82a;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xcf'),_0x46b82a[_0x47a5('0x3b')],util[_0x47a5('0xc8')](_0x138b92['query'],{'showHidden':![],'depth':null}));switch(_0x46b82a[_0x47a5('0x3b')]){case'csc':if(_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]&&_0x138b92['query'][_0x47a5('0xd1')]){_0x3917e0=_0x138b92['query'][_0x47a5('0xd1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x9a2f87){if(_0x9a2f87){_0x277061=_0x9a2f87;switch(_0x1c7695[_0x47a5('0x3b')]){case'csc':if(_0x3917e0==='2'||_0x3917e0==='6'){return _0x277061['update']({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),'csc',util[_0x47a5('0xc8')](_0x138b92[_0x47a5('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x277061;}})[_0x47a5('0x21')](respondWithResult(_0x232c36,null))['catch'](handleError(_0x232c36,null));};exports[_0x47a5('0xd2')]=function(_0x3136f9,_0x3ecc43,_0xf4b1df){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x3136f9['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x3ecc43,null))[_0x47a5('0x21')](function(_0xdc5eac){if(_0xdc5eac){return _0xdc5eac[_0x47a5('0xd2')](_0x3136f9['body'][_0x47a5('0x68')],_[_0x47a5('0xd3')](_0x3136f9[_0x47a5('0x61')],[_0x47a5('0x68'),'id'])||{})[_0x47a5('0xbc')](function(_0x4c2b0c){for(var _0xbe3a38=0x0;_0xbe3a38<_0x3136f9[_0x47a5('0x61')][_0x47a5('0x68')][_0x47a5('0x59')];_0xbe3a38+=0x1){socket[_0x47a5('0xd4')](_0x47a5('0xd5'),{'UserId':_0x3136f9['body'][_0x47a5('0x68')][_0xbe3a38],'SmsAccountId':_0x3136f9[_0x47a5('0x56')]['id']});}return _0x4c2b0c;});}})['then'](respondWithResult(_0x3ecc43,null))['catch'](handleError(_0x3ecc43,null));};exports[_0x47a5('0xd6')]=function(_0x32d299,_0x20d99b,_0x3964f8){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x32d299['params']['id']}})['then'](handleEntityNotFound(_0x20d99b,null))[_0x47a5('0x21')](function(_0xa3a516){if(_0xa3a516){return _0xa3a516['removeAgents'](_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')])['then'](function(){if(_[_0x47a5('0xd7')](_0x32d299['query']['ids'])){for(var _0x4aeaff=0x0;_0x4aeaff<_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')][_0x47a5('0x59')];_0x4aeaff+=0x1){socket['emit'](_0x47a5('0xd8'),{'UserId':Number(_0x32d299['query'][_0x47a5('0x68')][_0x4aeaff]),'SmsAccountId':Number(_0x32d299['params']['id'])});}}else{socket[_0x47a5('0xd4')](_0x47a5('0xd8'),{'UserId':Number(_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')]),'SmsAccountId':Number(_0x32d299[_0x47a5('0x56')]['id'])});}});}})[_0x47a5('0x21')](respondWithStatusCode(_0x20d99b,null))[_0x47a5('0x54')](handleError(_0x20d99b,null));};exports[_0x47a5('0xd9')]=function(_0x1396c2,_0x5c9091,_0x4f1e24){var _0x24c88e={};var _0xa859a={};var _0x5270cc;var _0x2a0f45;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1396c2[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x5c9091,null))[_0x47a5('0x21')](function(_0x969d4b){if(_0x969d4b){_0x5270cc=_0x969d4b;_0xa859a[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x9d')]['rawAttributes']);_0xa859a['query']=_['keys'](_0x1396c2['query']);_0xa859a[_0x47a5('0x41')]=_['intersection'](_0xa859a[_0x47a5('0x3d')],_0xa859a[_0x47a5('0x3f')]);_0x24c88e['attributes']=_[_0x47a5('0x42')](_0xa859a[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x24c88e[_0x47a5('0x43')]=_0x24c88e['attributes'][_0x47a5('0x59')]?_0x24c88e[_0x47a5('0x43')]:_0xa859a['model'];_0x24c88e[_0x47a5('0x47')]=qs['sort'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x24c88e[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x1396c2[_0x47a5('0x3f')],_0xa859a[_0x47a5('0x41')]));if(_0x1396c2['query'][_0x47a5('0x4b')]){_0x24c88e[_0x47a5('0x49')]=_['merge'](_0x24c88e[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x24c88e['attributes'],function(_0x14c968){var _0x5a7920={};_0x5a7920[_0x14c968]={'$like':'%'+_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x5a7920;})});}_0x24c88e=_[_0x47a5('0x4c')]({},_0x24c88e,_0x1396c2[_0x47a5('0x4e')]);return _0x5270cc[_0x47a5('0xd9')](_0x24c88e);}})['then'](function(_0x4b8b65){if(_0x4b8b65){_0x2a0f45=_0x4b8b65[_0x47a5('0x59')];if(!_0x1396c2['query']['hasOwnProperty']('nolimit')){_0x24c88e[_0x47a5('0x2e')]=qs['limit'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x24c88e[_0x47a5('0x2d')]=qs['offset'](_0x1396c2['query'][_0x47a5('0x2d')]);}return _0x5270cc['getAgents'](_0x24c88e);}})['then'](function(_0xe87e6e){if(_0xe87e6e){return _0xe87e6e?{'count':_0x2a0f45,'rows':_0xe87e6e}:null;}})['then'](respondWithResult(_0x5c9091,null))['catch'](handleError(_0x5c9091,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 38a844d..e8f5e32 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 _0x60bb=['update','emit','hasOwnProperty','events','../../mysqldb','save'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x60bb,0x105));var _0xb60b=function(_0x3d13bb,_0x262a54){_0x3d13bb=_0x3d13bb-0x0;var _0x4b5a1b=_0x60bb[_0x3d13bb];return _0x4b5a1b;};'use strict';var EventEmitter=require(_0xb60b('0x0'));var SmsAccount=require(_0xb60b('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb60b('0x2'),'afterUpdate':_0xb60b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x33295c){return function(_0x827282,_0xb587e2,_0x114db7){SmsAccountEvents[_0xb60b('0x4')](_0x33295c+':'+_0x827282['id'],_0x827282);SmsAccountEvents['emit'](_0x33295c,_0x827282);_0x114db7(null);};}for(var e in events){if(events[_0xb60b('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x1f24=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2ac351,_0x43ee6c){var _0x25e8fd=function(_0x5011c1){while(--_0x5011c1){_0x2ac351['push'](_0x2ac351['shift']());}};_0x25e8fd(++_0x43ee6c);}(_0x1f24,0x12f));var _0x41f2=function(_0x2f5257,_0x3011d3){_0x2f5257=_0x2f5257-0x0;var _0x42f9c2=_0x1f24[_0x2f5257];return _0x42f9c2;};'use strict';var EventEmitter=require(_0x41f2('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x41f2('0x1')](0x0);var events={'afterCreate':_0x41f2('0x2'),'afterUpdate':'update','afterDestroy':_0x41f2('0x3')};function emitEvent(_0x5f54b2){return function(_0x2589f0,_0x4bde4a,_0x332055){SmsAccountEvents[_0x41f2('0x4')](_0x5f54b2+':'+_0x2589f0['id'],_0x2589f0);SmsAccountEvents[_0x41f2('0x4')](_0x5f54b2,_0x2589f0);_0x332055(null);};}for(var e in events){if(events[_0x41f2('0x5')](e)){var event=events[e];SmsAccount[_0x41f2('0x6')](e,emitEvent(event));}}module[_0x41f2('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 23513d8..0e0fd24 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 _0x0cdf=['sms_accounts','lodash','util','api','request-promise','path','rimraf','./smsAccount.attributes','exports'];(function(_0x2fd719,_0xa1c429){var _0x3fcc83=function(_0x8e31fa){while(--_0x8e31fa){_0x2fd719['push'](_0x2fd719['shift']());}};_0x3fcc83(++_0xa1c429);}(_0x0cdf,0x1b1));var _0xf0cd=function(_0x526c62,_0x1848af){_0x526c62=_0x526c62-0x0;var _0x23e196=_0x0cdf[_0x526c62];return _0x23e196;};'use strict';var _=require(_0xf0cd('0x0'));var util=require(_0xf0cd('0x1'));var logger=require('../../config/logger')(_0xf0cd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf0cd('0x3'));var fs=require('fs');var path=require(_0xf0cd('0x4'));var rimraf=require(_0xf0cd('0x5'));var config=require('../../config/environment');var attributes=require(_0xf0cd('0x6'));module[_0xf0cd('0x7')]=function(_0x11ab14,_0x44c18f){return _0x11ab14['define']('SmsAccount',attributes,{'tableName':_0xf0cd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ae8=['request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','lodash','api'];(function(_0x4fc25b,_0x229b7e){var _0x588631=function(_0x50ebc3){while(--_0x50ebc3){_0x4fc25b['push'](_0x4fc25b['shift']());}};_0x588631(++_0x229b7e);}(_0x5ae8,0x193));var _0x85ae=function(_0x301efe,_0x338d14){_0x301efe=_0x301efe-0x0;var _0x5d44c3=_0x5ae8[_0x301efe];return _0x5d44c3;};'use strict';var _=require(_0x85ae('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x85ae('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x85ae('0x2'));var fs=require('fs');var path=require(_0x85ae('0x3'));var rimraf=require(_0x85ae('0x4'));var config=require(_0x85ae('0x5'));var attributes=require(_0x85ae('0x6'));module[_0x85ae('0x7')]=function(_0x183501,_0x45c98c){return _0x183501['define'](_0x85ae('0x8'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 381b124..9aab520 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 _0xe282=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','map','model'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe282,0xd8));var _0x2e28=function(_0x443db5,_0x48666f){_0x443db5=_0x443db5-0x0;var _0x572abb=_0xe282[_0x443db5];return _0x572abb;};'use strict';var _=require(_0x2e28('0x0'));var util=require(_0x2e28('0x1'));var moment=require(_0x2e28('0x2'));var BPromise=require(_0x2e28('0x3'));var rs=require(_0x2e28('0x4'));var fs=require('fs');var Redis=require(_0x2e28('0x5'));var db=require(_0x2e28('0x6'))['db'];var utils=require(_0x2e28('0x7'));var logger=require(_0x2e28('0x8'))(_0x2e28('0x9'));var config=require(_0x2e28('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2e28('0xb')]['http']({'port':0x232a});config[_0x2e28('0xc')]=_['defaults'](config[_0x2e28('0xc')],{'host':_0x2e28('0xd'),'port':0x18eb});var socket=require(_0x2e28('0xe'))(new Redis(config['redis']));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x18e69a,_0x576491,_0x41e589){return new BPromise(function(_0x535c05,_0x584a53){return client[_0x2e28('0xf')](_0x18e69a,_0x41e589)[_0x2e28('0x10')](function(_0x65bc4d){logger['info'](_0x2e28('0x11'),_0x576491,_0x2e28('0x12'));logger[_0x2e28('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x576491,_0x2e28('0x12'),JSON[_0x2e28('0x14')](_0x65bc4d));if(_0x65bc4d[_0x2e28('0x15')]){if(_0x65bc4d['error'][_0x2e28('0x16')]===0x1f4){logger['error'](_0x2e28('0x11'),_0x576491,_0x65bc4d['error'][_0x2e28('0x17')]);return _0x584a53(_0x65bc4d[_0x2e28('0x15')][_0x2e28('0x17')]);}logger[_0x2e28('0x15')](_0x2e28('0x11'),_0x576491,_0x65bc4d[_0x2e28('0x15')]['message']);return _0x535c05(_0x65bc4d['error'][_0x2e28('0x17')]);}else{logger[_0x2e28('0x18')](_0x2e28('0x11'),_0x576491,'request\x20sent');_0x535c05(_0x65bc4d[_0x2e28('0x19')][_0x2e28('0x17')]);}})[_0x2e28('0x1a')](function(_0x4bcaf9){logger[_0x2e28('0x15')]('SmsAccount,\x20%s,\x20%s',_0x576491,_0x4bcaf9);_0x584a53(_0x4bcaf9);});});}exports[_0x2e28('0x1b')]=function(_0x48059c){var _0x5daf55=this;return new Promise(function(_0x104d6b,_0x2b42e0){return db[_0x2e28('0x1c')][_0x2e28('0x1d')]({'raw':_0x48059c[_0x2e28('0x1e')]?_0x48059c[_0x2e28('0x1e')][_0x2e28('0x1f')]===undefined?!![]:![]:!![],'where':_0x48059c[_0x2e28('0x1e')]?_0x48059c['options']['where']||null:null,'attributes':_0x48059c['options']?_0x48059c['options'][_0x2e28('0x20')]||null:null,'include':_0x48059c[_0x2e28('0x1e')]?_0x48059c[_0x2e28('0x1e')][_0x2e28('0x21')]?_[_0x2e28('0x22')](_0x48059c[_0x2e28('0x1e')]['include'],function(_0x4f67e8){return{'model':db[_0x4f67e8[_0x2e28('0x23')]],'as':_0x4f67e8['as'],'attributes':_0x4f67e8[_0x2e28('0x20')],'include':_0x4f67e8[_0x2e28('0x21')]?_[_0x2e28('0x22')](_0x4f67e8[_0x2e28('0x21')],function(_0x21fc75){return{'model':db[_0x21fc75[_0x2e28('0x23')]],'as':_0x21fc75['as'],'attributes':_0x21fc75['attributes'],'include':_0x21fc75[_0x2e28('0x21')]?_['map'](_0x21fc75[_0x2e28('0x21')],function(_0x13a219){return{'model':db[_0x13a219[_0x2e28('0x23')]],'as':_0x13a219['as'],'attributes':_0x13a219['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x439bb8){logger['info']('ShowSmsAccount',_0x48059c);logger[_0x2e28('0x13')](_0x2e28('0x1b'),_0x48059c,JSON[_0x2e28('0x14')](_0x439bb8));_0x104d6b(_0x439bb8);})[_0x2e28('0x1a')](function(_0xad1f7c){logger[_0x2e28('0x15')](_0x2e28('0x1b'),_0xad1f7c[_0x2e28('0x17')],_0x48059c);_0x2b42e0(_0x5daf55[_0x2e28('0x15')](0x1f4,_0xad1f7c[_0x2e28('0x17')]));});});}; \ No newline at end of file +var _0x971d=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./smsAccount.socket','register','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','map','model','then','lodash','util'];(function(_0x1e416d,_0x4dea6b){var _0x342e15=function(_0x57fcac){while(--_0x57fcac){_0x1e416d['push'](_0x1e416d['shift']());}};_0x342e15(++_0x4dea6b);}(_0x971d,0x12e));var _0xd971=function(_0x3be5a2,_0x320835){_0x3be5a2=_0x3be5a2-0x0;var _0x4cfc9f=_0x971d[_0x3be5a2];return _0x4cfc9f;};'use strict';var _=require(_0xd971('0x0'));var util=require(_0xd971('0x1'));var moment=require(_0xd971('0x2'));var BPromise=require(_0xd971('0x3'));var rs=require(_0xd971('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd971('0x5'))['db'];var utils=require(_0xd971('0x6'));var logger=require('../../config/logger')(_0xd971('0x7'));var config=require(_0xd971('0x8'));var jayson=require(_0xd971('0x9'));var client=jayson[_0xd971('0xa')]['http']({'port':0x232a});config[_0xd971('0xb')]=_[_0xd971('0xc')](config['redis'],{'host':_0xd971('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd971('0xb')]));require(_0xd971('0xe'))[_0xd971('0xf')](socket);function respondWithRpcPromise(_0x9fe132,_0x1e9e00,_0x58beab){return new BPromise(function(_0x3fea94,_0x337ecf){return client[_0xd971('0x10')](_0x9fe132,_0x58beab)['then'](function(_0x291160){logger[_0xd971('0x11')](_0xd971('0x12'),_0x1e9e00,_0xd971('0x13'));logger[_0xd971('0x14')](_0xd971('0x15'),_0x1e9e00,_0xd971('0x13'),JSON[_0xd971('0x16')](_0x291160));if(_0x291160[_0xd971('0x17')]){if(_0x291160[_0xd971('0x17')][_0xd971('0x18')]===0x1f4){logger[_0xd971('0x17')]('SmsAccount,\x20%s,\x20%s',_0x1e9e00,_0x291160['error'][_0xd971('0x19')]);return _0x337ecf(_0x291160[_0xd971('0x17')][_0xd971('0x19')]);}logger[_0xd971('0x17')](_0xd971('0x12'),_0x1e9e00,_0x291160[_0xd971('0x17')][_0xd971('0x19')]);return _0x3fea94(_0x291160[_0xd971('0x17')][_0xd971('0x19')]);}else{logger[_0xd971('0x11')](_0xd971('0x12'),_0x1e9e00,_0xd971('0x13'));_0x3fea94(_0x291160[_0xd971('0x1a')][_0xd971('0x19')]);}})[_0xd971('0x1b')](function(_0x3b809b){logger['error'](_0xd971('0x12'),_0x1e9e00,_0x3b809b);_0x337ecf(_0x3b809b);});});}exports[_0xd971('0x1c')]=function(_0x185aec){var _0x42bf6b=this;return new Promise(function(_0x33ac16,_0x52a021){return db[_0xd971('0x1d')][_0xd971('0x1e')]({'raw':_0x185aec[_0xd971('0x1f')]?_0x185aec[_0xd971('0x1f')][_0xd971('0x20')]===undefined?!![]:![]:!![],'where':_0x185aec[_0xd971('0x1f')]?_0x185aec['options']['where']||null:null,'attributes':_0x185aec[_0xd971('0x1f')]?_0x185aec['options'][_0xd971('0x21')]||null:null,'include':_0x185aec['options']?_0x185aec[_0xd971('0x1f')][_0xd971('0x22')]?_[_0xd971('0x23')](_0x185aec[_0xd971('0x1f')]['include'],function(_0x4fb24a){return{'model':db[_0x4fb24a[_0xd971('0x24')]],'as':_0x4fb24a['as'],'attributes':_0x4fb24a[_0xd971('0x21')],'include':_0x4fb24a[_0xd971('0x22')]?_['map'](_0x4fb24a[_0xd971('0x22')],function(_0x2be776){return{'model':db[_0x2be776['model']],'as':_0x2be776['as'],'attributes':_0x2be776[_0xd971('0x21')],'include':_0x2be776[_0xd971('0x22')]?_[_0xd971('0x23')](_0x2be776[_0xd971('0x22')],function(_0x1230b3){return{'model':db[_0x1230b3[_0xd971('0x24')]],'as':_0x1230b3['as'],'attributes':_0x1230b3['attributes']};}):[]};}):[]};}):[]:[]})[_0xd971('0x25')](function(_0x416a0e){logger[_0xd971('0x11')](_0xd971('0x1c'),_0x185aec);logger['debug'](_0xd971('0x1c'),_0x185aec,JSON[_0xd971('0x16')](_0x416a0e));_0x33ac16(_0x416a0e);})[_0xd971('0x1b')](function(_0x7447a7){logger[_0xd971('0x17')](_0xd971('0x1c'),_0x7447a7[_0xd971('0x19')],_0x185aec);_0x52a021(_0x42bf6b['error'](0x1f4,_0x7447a7[_0xd971('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 38755af..414014b 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 _0x8ad6=['update','removeListener','register','length','./smsAccount.events','save','remove'];(function(_0x4f2922,_0x407d96){var _0xc22522=function(_0x1670a0){while(--_0x1670a0){_0x4f2922['push'](_0x4f2922['shift']());}};_0xc22522(++_0x407d96);}(_0x8ad6,0x123));var _0x68ad=function(_0x4315a9,_0x220fcb){_0x4315a9=_0x4315a9-0x0;var _0x3fff02=_0x8ad6[_0x4315a9];return _0x3fff02;};'use strict';var SmsAccountEvents=require(_0x68ad('0x0'));var events=[_0x68ad('0x1'),_0x68ad('0x2'),_0x68ad('0x3')];function createListener(_0x42c0ad,_0xc7be51){return function(_0x36205e){_0xc7be51['emit'](_0x42c0ad,_0x36205e);};}function removeListener(_0x24cbb0,_0x15f427){return function(){SmsAccountEvents[_0x68ad('0x4')](_0x24cbb0,_0x15f427);};}exports[_0x68ad('0x5')]=function(_0x5ed17a){for(var _0x49cf7e=0x0,_0x150274=events[_0x68ad('0x6')];_0x49cf7e<_0x150274;_0x49cf7e++){var _0x11a465=events[_0x49cf7e];var _0x4a57b1=createListener('smsAccount:'+_0x11a465,_0x5ed17a);SmsAccountEvents['on'](_0x11a465,_0x4a57b1);}}; \ No newline at end of file +var _0x3f94=['smsAccount:','save','update','removeListener','register','length'];(function(_0x2bd872,_0x5abe9f){var _0x4ae4c7=function(_0x235772){while(--_0x235772){_0x2bd872['push'](_0x2bd872['shift']());}};_0x4ae4c7(++_0x5abe9f);}(_0x3f94,0x11b));var _0x43f9=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x3f94[_0x525c7b];return _0x27b33e;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x43f9('0x0'),'remove',_0x43f9('0x1')];function createListener(_0x30330b,_0xfba290){return function(_0x20d2c1){_0xfba290['emit'](_0x30330b,_0x20d2c1);};}function removeListener(_0x4de60e,_0x536352){return function(){SmsAccountEvents[_0x43f9('0x2')](_0x4de60e,_0x536352);};}exports[_0x43f9('0x3')]=function(_0x15cb08){for(var _0x29a597=0x0,_0x1caa63=events[_0x43f9('0x4')];_0x29a597<_0x1caa63;_0x29a597++){var _0x153799=events[_0x29a597];var _0x18d1da=createListener(_0x43f9('0x5')+_0x153799,_0x15cb08);SmsAccountEvents['on'](_0x153799,_0x18d1da);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index f41dc0c..64fc057 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 _0x662f=['delete','exports','path','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x1a1f5f,_0x10eeff){var _0x3c99eb=function(_0x360319){while(--_0x360319){_0x1a1f5f['push'](_0x1a1f5f['shift']());}};_0x3c99eb(++_0x10eeff);}(_0x662f,0x1ec));var _0xf662=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x662f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf662('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xf662('0x1'));var interaction=require(_0xf662('0x2'));var config=require('../../config/environment');var controller=require(_0xf662('0x3'));router[_0xf662('0x4')]('/',auth[_0xf662('0x5')](),controller[_0xf662('0x6')]);router[_0xf662('0x4')](_0xf662('0x7'),auth[_0xf662('0x5')](),controller['show']);router[_0xf662('0x8')]('/',auth[_0xf662('0x5')](),controller[_0xf662('0x9')]);router[_0xf662('0xa')](_0xf662('0x7'),auth[_0xf662('0x5')](),controller[_0xf662('0xb')]);router[_0xf662('0xc')](_0xf662('0x7'),auth[_0xf662('0x5')](),controller['destroy']);module[_0xf662('0xd')]=router; \ No newline at end of file +var _0xe773=['multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','delete','exports'];(function(_0x4446f2,_0x3a2760){var _0x5be1c7=function(_0x121c65){while(--_0x121c65){_0x4446f2['push'](_0x4446f2['shift']());}};_0x5be1c7(++_0x3a2760);}(_0xe773,0xb0));var _0x3e77=function(_0xed3666,_0x28493a){_0xed3666=_0xed3666-0x0;var _0x2b6fb1=_0xe773[_0xed3666];return _0x2b6fb1;};'use strict';var multer=require(_0x3e77('0x0'));var util=require(_0x3e77('0x1'));var path=require(_0x3e77('0x2'));var timeout=require(_0x3e77('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3e77('0x4'));var config=require(_0x3e77('0x5'));var controller=require('./smsApplication.controller');router[_0x3e77('0x6')]('/',auth['isAuthenticated'](),controller[_0x3e77('0x7')]);router[_0x3e77('0x6')](_0x3e77('0x8'),auth[_0x3e77('0x9')](),controller[_0x3e77('0xa')]);router[_0x3e77('0xb')]('/',auth[_0x3e77('0x9')](),controller[_0x3e77('0xc')]);router[_0x3e77('0xd')](_0x3e77('0x8'),auth[_0x3e77('0x9')](),controller['update']);router[_0x3e77('0xe')]('/:id',auth[_0x3e77('0x9')](),controller['destroy']);module[_0x3e77('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 34f651a..9181a11 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 _0x4c24=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x48f652,_0x516a39){var _0x4e145b=function(_0x34fc6b){while(--_0x34fc6b){_0x48f652['push'](_0x48f652['shift']());}};_0x4e145b(++_0x516a39);}(_0x4c24,0x108));var _0x44c2=function(_0x35ecf7,_0x590733){_0x35ecf7=_0x35ecf7-0x0;var _0x41dc5d=_0x4c24[_0x35ecf7];return _0x41dc5d;};'use strict';var Sequelize=require(_0x44c2('0x0'));module[_0x44c2('0x1')]={'priority':{'type':Sequelize[_0x44c2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x44c2('0x3')],'allowNull':![],'defaultValue':_0x44c2('0x4')},'appdata':{'type':Sequelize[_0x44c2('0x5')]()},'description':{'type':Sequelize[_0x44c2('0x3')]},'interval':{'type':Sequelize[_0x44c2('0x3')],'defaultValue':_0x44c2('0x6')}}; \ No newline at end of file +var _0x6013=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x71bd96,_0x432a78){var _0x355b5e=function(_0x40f2c9){while(--_0x40f2c9){_0x71bd96['push'](_0x71bd96['shift']());}};_0x355b5e(++_0x432a78);}(_0x6013,0x117));var _0x3601=function(_0x12e3f4,_0x4a3923){_0x12e3f4=_0x12e3f4-0x0;var _0x50d9b4=_0x6013[_0x12e3f4];return _0x50d9b4;};'use strict';var Sequelize=require(_0x3601('0x0'));module[_0x3601('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3601('0x2')],'allowNull':![],'defaultValue':_0x3601('0x3')},'appdata':{'type':Sequelize[_0x3601('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3601('0x2')],'defaultValue':_0x3601('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 37c202f..917461e 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 _0x3de3=['count','offset','limit','set','Content-Range','reject','save','update','then','stack','name','send','map','SmsApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','catch','show','params','fields','length','include','find','create','body','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json'];(function(_0x4f57bc,_0x1eff51){var _0x4eab7b=function(_0x8facb){while(--_0x8facb){_0x4f57bc['push'](_0x4f57bc['shift']());}};_0x4eab7b(++_0x1eff51);}(_0x3de3,0x1ce));var _0x33de=function(_0x1d829b,_0x17a43f){_0x1d829b=_0x1d829b-0x0;var _0x1e40fd=_0x3de3[_0x1d829b];return _0x1e40fd;};'use strict';var pdf=require(_0x33de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x33de('0x1'));var zipdir=require(_0x33de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33de('0x3'));var moment=require(_0x33de('0x4'));var BPromise=require(_0x33de('0x5'));var Mustache=require(_0x33de('0x6'));var util=require('util');var path=require(_0x33de('0x7'));var sox=require(_0x33de('0x8'));var csv=require('to-csv');var ejs=require(_0x33de('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x33de('0xa'));var crypto=require(_0x33de('0xb'));var jsforce=require(_0x33de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33de('0xd'));var querystring=require(_0x33de('0xe'));var Papa=require(_0x33de('0xf'));var Redis=require('ioredis');var authService=require(_0x33de('0x10'));var qs=require(_0x33de('0x11'));var as=require(_0x33de('0x12'));var hardwareService=require(_0x33de('0x13'));var logger=require(_0x33de('0x14'))(_0x33de('0x15'));var utils=require(_0x33de('0x16'));var config=require(_0x33de('0x17'));var db=require(_0x33de('0x18'))['db'];function respondWithStatusCode(_0x306efc,_0x27d1d8){_0x27d1d8=_0x27d1d8||0xcc;return function(_0x5170ad){if(_0x5170ad){return _0x306efc[_0x33de('0x19')](_0x27d1d8);}return _0x306efc[_0x33de('0x1a')](_0x27d1d8)['end']();};}function respondWithResult(_0x5392c0,_0x4164ab){_0x4164ab=_0x4164ab||0xc8;return function(_0x22bda8){if(_0x22bda8){return _0x5392c0[_0x33de('0x1a')](_0x4164ab)[_0x33de('0x1b')](_0x22bda8);}};}function respondWithFilteredResult(_0x57aa73,_0x11e6b5){return function(_0x1b1166){if(_0x1b1166){var _0x522ba0=_0x1b1166[_0x33de('0x1c')],_0x4ff69f=_0x11e6b5['offset'],_0x185849=_0x11e6b5[_0x33de('0x1d')]+_0x11e6b5[_0x33de('0x1e')],_0x16c050;if(_0x185849>=_0x522ba0){_0x185849=_0x522ba0;_0x16c050=0xc8;}else{_0x16c050=0xce;}_0x57aa73['status'](_0x16c050);return _0x57aa73[_0x33de('0x1f')](_0x33de('0x20'),_0x4ff69f+'-'+_0x185849+'/'+_0x522ba0)['json'](_0x1b1166);}return null;};}function patchUpdates(_0x5bb74e){return function(_0x1cf3dd){try{jsonpatch['apply'](_0x1cf3dd,_0x5bb74e,!![]);}catch(_0x16255f){return BPromise[_0x33de('0x21')](_0x16255f);}return _0x1cf3dd[_0x33de('0x22')]();};}function saveUpdates(_0x315c9b,_0xc4f1a4){return function(_0x40a8e6){if(_0x40a8e6){return _0x40a8e6[_0x33de('0x23')](_0x315c9b)['then'](function(_0x571086){return _0x571086;});}return null;};}function removeEntity(_0x34e7ef,_0x5af3fa){return function(_0x8acd8d){if(_0x8acd8d){return _0x8acd8d['destroy']()[_0x33de('0x24')](function(){_0x34e7ef[_0x33de('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dbcf2,_0x5cd77e){return function(_0x67d040){if(!_0x67d040){_0x2dbcf2['sendStatus'](0x194);}return _0x67d040;};}function handleError(_0x62743b,_0x24e282){_0x24e282=_0x24e282||0x1f4;return function(_0x1e3c61){logger['error'](_0x1e3c61[_0x33de('0x25')]);if(_0x1e3c61[_0x33de('0x26')]){delete _0x1e3c61[_0x33de('0x26')];}_0x62743b['status'](_0x24e282)[_0x33de('0x27')](_0x1e3c61);};}exports['index']=function(_0x566373,_0x1c8de9){var _0x17c760={},_0x1a870a={},_0x208d0d={'count':0x0,'rows':[]};var _0x44b10e=_[_0x33de('0x28')](db[_0x33de('0x29')][_0x33de('0x2a')],function(_0x59bc3b){return{'name':_0x59bc3b['fieldName'],'type':_0x59bc3b[_0x33de('0x2b')][_0x33de('0x2c')]};});_0x1a870a[_0x33de('0x2d')]=_[_0x33de('0x28')](_0x44b10e,_0x33de('0x26'));_0x1a870a[_0x33de('0x2e')]=_[_0x33de('0x2f')](_0x566373['query']);_0x1a870a[_0x33de('0x30')]=_[_0x33de('0x31')](_0x1a870a[_0x33de('0x2d')],_0x1a870a[_0x33de('0x2e')]);_0x17c760['attributes']=_[_0x33de('0x31')](_0x1a870a[_0x33de('0x2d')],qs['fields'](_0x566373['query']['fields']));_0x17c760[_0x33de('0x32')]=_0x17c760[_0x33de('0x32')]['length']?_0x17c760[_0x33de('0x32')]:_0x1a870a['model'];if(!_0x566373['query'][_0x33de('0x33')](_0x33de('0x34'))){_0x17c760[_0x33de('0x1e')]=qs[_0x33de('0x1e')](_0x566373[_0x33de('0x2e')][_0x33de('0x1e')]);_0x17c760[_0x33de('0x1d')]=qs[_0x33de('0x1d')](_0x566373['query'][_0x33de('0x1d')]);}_0x17c760['order']=qs[_0x33de('0x35')](_0x566373['query']['sort']);_0x17c760[_0x33de('0x36')]=qs[_0x33de('0x30')](_[_0x33de('0x37')](_0x566373[_0x33de('0x2e')],_0x1a870a[_0x33de('0x30')]),_0x44b10e);if(_0x566373[_0x33de('0x2e')]['filter']){_0x17c760[_0x33de('0x36')]=_[_0x33de('0x38')](_0x17c760[_0x33de('0x36')],{'$or':_[_0x33de('0x28')](_0x44b10e,function(_0x3a1398){if(_0x3a1398[_0x33de('0x2b')]!==_0x33de('0x39')){var _0x483c24={};_0x483c24[_0x3a1398[_0x33de('0x26')]]={'$like':'%'+_0x566373[_0x33de('0x2e')][_0x33de('0x3a')]+'%'};return _0x483c24;}})});}_0x17c760=_[_0x33de('0x38')]({},_0x17c760,_0x566373[_0x33de('0x3b')]);var _0x35064e={'where':_0x17c760[_0x33de('0x36')]};return db['SmsApplication'][_0x33de('0x1c')](_0x35064e)[_0x33de('0x24')](function(_0x1071fb){_0x208d0d[_0x33de('0x1c')]=_0x1071fb;if(_0x566373[_0x33de('0x2e')][_0x33de('0x3c')]){_0x17c760['include']=[{'all':!![]}];}return db[_0x33de('0x29')]['findAll'](_0x17c760);})[_0x33de('0x24')](function(_0x66897c){_0x208d0d['rows']=_0x66897c;return _0x208d0d;})[_0x33de('0x24')](respondWithFilteredResult(_0x1c8de9,_0x17c760))[_0x33de('0x3d')](handleError(_0x1c8de9,null));};exports[_0x33de('0x3e')]=function(_0x1de158,_0x127fde){var _0x4251e3={'raw':!![],'where':{'id':_0x1de158[_0x33de('0x3f')]['id']}},_0x22518d={};_0x22518d[_0x33de('0x2d')]=_['keys'](db['SmsApplication'][_0x33de('0x2a')]);_0x22518d[_0x33de('0x2e')]=_[_0x33de('0x2f')](_0x1de158[_0x33de('0x2e')]);_0x22518d['filters']=_[_0x33de('0x31')](_0x22518d['model'],_0x22518d['query']);_0x4251e3[_0x33de('0x32')]=_[_0x33de('0x31')](_0x22518d[_0x33de('0x2d')],qs[_0x33de('0x40')](_0x1de158[_0x33de('0x2e')][_0x33de('0x40')]));_0x4251e3[_0x33de('0x32')]=_0x4251e3['attributes'][_0x33de('0x41')]?_0x4251e3['attributes']:_0x22518d[_0x33de('0x2d')];if(_0x1de158['query'][_0x33de('0x3c')]){_0x4251e3[_0x33de('0x42')]=[{'all':!![]}];}_0x4251e3=_['merge']({},_0x4251e3,_0x1de158[_0x33de('0x3b')]);return db[_0x33de('0x29')][_0x33de('0x43')](_0x4251e3)['then'](handleEntityNotFound(_0x127fde,null))['then'](respondWithResult(_0x127fde,null))[_0x33de('0x3d')](handleError(_0x127fde,null));};exports[_0x33de('0x44')]=function(_0x4bf097,_0x5efc88){return db[_0x33de('0x29')]['create'](_0x4bf097['body'],{})['then'](respondWithResult(_0x5efc88,0xc9))[_0x33de('0x3d')](handleError(_0x5efc88,null));};exports[_0x33de('0x23')]=function(_0x9a816c,_0xce6079){if(_0x9a816c['body']['id']){delete _0x9a816c['body']['id'];}return db[_0x33de('0x29')][_0x33de('0x43')]({'where':{'id':_0x9a816c['params']['id']}})[_0x33de('0x24')](handleEntityNotFound(_0xce6079,null))[_0x33de('0x24')](saveUpdates(_0x9a816c[_0x33de('0x45')],null))[_0x33de('0x24')](respondWithResult(_0xce6079,null))[_0x33de('0x3d')](handleError(_0xce6079,null));};exports['destroy']=function(_0x185e5f,_0x3bf2e3){return db['SmsApplication'][_0x33de('0x43')]({'where':{'id':_0x185e5f[_0x33de('0x3f')]['id']}})[_0x33de('0x24')](handleEntityNotFound(_0x3bf2e3,null))[_0x33de('0x24')](removeEntity(_0x3bf2e3,null))[_0x33de('0x3d')](handleError(_0x3bf2e3,null));}; \ No newline at end of file +var _0xa30a=['body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','apply','update','then','destroy','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','create'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xaa30('0x0'));var emlformat=require(_0xaa30('0x1'));var rimraf=require(_0xaa30('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa30('0x3'));var rp=require(_0xaa30('0x4'));var moment=require(_0xaa30('0x5'));var BPromise=require(_0xaa30('0x6'));var Mustache=require(_0xaa30('0x7'));var util=require(_0xaa30('0x8'));var path=require(_0xaa30('0x9'));var sox=require('sox');var csv=require(_0xaa30('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xa'));var querystring=require(_0xaa30('0xf'));var Papa=require(_0xaa30('0x10'));var Redis=require(_0xaa30('0x11'));var authService=require(_0xaa30('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x13'));var logger=require('../../config/logger')(_0xaa30('0x14'));var utils=require(_0xaa30('0x15'));var config=require(_0xaa30('0x16'));var db=require(_0xaa30('0x17'))['db'];function respondWithStatusCode(_0x589229,_0xec992f){_0xec992f=_0xec992f||0xcc;return function(_0x3de2d1){if(_0x3de2d1){return _0x589229[_0xaa30('0x18')](_0xec992f);}return _0x589229['status'](_0xec992f)[_0xaa30('0x19')]();};}function respondWithResult(_0xdea23a,_0x25c02e){_0x25c02e=_0x25c02e||0xc8;return function(_0x14de74){if(_0x14de74){return _0xdea23a[_0xaa30('0x1a')](_0x25c02e)[_0xaa30('0x1b')](_0x14de74);}};}function respondWithFilteredResult(_0x3240e9,_0x3b8095){return function(_0x2e37af){if(_0x2e37af){var _0xfae724=_0x2e37af['count'],_0x519518=_0x3b8095[_0xaa30('0x1c')],_0x91839d=_0x3b8095[_0xaa30('0x1c')]+_0x3b8095[_0xaa30('0x1d')],_0x591478;if(_0x91839d>=_0xfae724){_0x91839d=_0xfae724;_0x591478=0xc8;}else{_0x591478=0xce;}_0x3240e9['status'](_0x591478);return _0x3240e9['set']('Content-Range',_0x519518+'-'+_0x91839d+'/'+_0xfae724)[_0xaa30('0x1b')](_0x2e37af);}return null;};}function patchUpdates(_0x4acdfa){return function(_0xfb02ab){try{jsonpatch[_0xaa30('0x1e')](_0xfb02ab,_0x4acdfa,!![]);}catch(_0x48561d){return BPromise['reject'](_0x48561d);}return _0xfb02ab['save']();};}function saveUpdates(_0x3cbf92,_0x3e4f1d){return function(_0x61b85){if(_0x61b85){return _0x61b85[_0xaa30('0x1f')](_0x3cbf92)[_0xaa30('0x20')](function(_0x4aacfd){return _0x4aacfd;});}return null;};}function removeEntity(_0x3f6295,_0x24bb25){return function(_0x2e16e7){if(_0x2e16e7){return _0x2e16e7[_0xaa30('0x21')]()[_0xaa30('0x20')](function(){_0x3f6295['status'](0xcc)[_0xaa30('0x19')]();});}};}function handleEntityNotFound(_0x13128a,_0x2fecdd){return function(_0x326f84){if(!_0x326f84){_0x13128a['sendStatus'](0x194);}return _0x326f84;};}function handleError(_0x14d7fa,_0x1be54c){_0x1be54c=_0x1be54c||0x1f4;return function(_0x19ba52){logger[_0xaa30('0x22')](_0x19ba52[_0xaa30('0x23')]);if(_0x19ba52[_0xaa30('0x24')]){delete _0x19ba52['name'];}_0x14d7fa[_0xaa30('0x1a')](_0x1be54c)[_0xaa30('0x25')](_0x19ba52);};}exports['index']=function(_0xb043e4,_0x5b3efb){var _0x2da4da={},_0x33a0c9={},_0x2aabf8={'count':0x0,'rows':[]};var _0xd1eb3a=_[_0xaa30('0x26')](db[_0xaa30('0x27')][_0xaa30('0x28')],function(_0x39f708){return{'name':_0x39f708[_0xaa30('0x29')],'type':_0x39f708[_0xaa30('0x2a')][_0xaa30('0x2b')]};});_0x33a0c9[_0xaa30('0x2c')]=_[_0xaa30('0x26')](_0xd1eb3a,_0xaa30('0x24'));_0x33a0c9[_0xaa30('0x2d')]=_[_0xaa30('0x2e')](_0xb043e4[_0xaa30('0x2d')]);_0x33a0c9[_0xaa30('0x2f')]=_['intersection'](_0x33a0c9[_0xaa30('0x2c')],_0x33a0c9[_0xaa30('0x2d')]);_0x2da4da[_0xaa30('0x30')]=_[_0xaa30('0x31')](_0x33a0c9[_0xaa30('0x2c')],qs[_0xaa30('0x32')](_0xb043e4['query']['fields']));_0x2da4da['attributes']=_0x2da4da[_0xaa30('0x30')][_0xaa30('0x33')]?_0x2da4da[_0xaa30('0x30')]:_0x33a0c9[_0xaa30('0x2c')];if(!_0xb043e4[_0xaa30('0x2d')]['hasOwnProperty']('nolimit')){_0x2da4da[_0xaa30('0x1d')]=qs[_0xaa30('0x1d')](_0xb043e4['query'][_0xaa30('0x1d')]);_0x2da4da['offset']=qs[_0xaa30('0x1c')](_0xb043e4['query'][_0xaa30('0x1c')]);}_0x2da4da[_0xaa30('0x34')]=qs['sort'](_0xb043e4[_0xaa30('0x2d')][_0xaa30('0x35')]);_0x2da4da[_0xaa30('0x36')]=qs[_0xaa30('0x2f')](_[_0xaa30('0x37')](_0xb043e4[_0xaa30('0x2d')],_0x33a0c9['filters']),_0xd1eb3a);if(_0xb043e4[_0xaa30('0x2d')][_0xaa30('0x38')]){_0x2da4da['where']=_[_0xaa30('0x39')](_0x2da4da[_0xaa30('0x36')],{'$or':_[_0xaa30('0x26')](_0xd1eb3a,function(_0x557012){if(_0x557012['type']!==_0xaa30('0x3a')){var _0x21ffb0={};_0x21ffb0[_0x557012[_0xaa30('0x24')]]={'$like':'%'+_0xb043e4[_0xaa30('0x2d')][_0xaa30('0x38')]+'%'};return _0x21ffb0;}})});}_0x2da4da=_[_0xaa30('0x39')]({},_0x2da4da,_0xb043e4['options']);var _0x5ca1b0={'where':_0x2da4da[_0xaa30('0x36')]};return db[_0xaa30('0x27')][_0xaa30('0x3b')](_0x5ca1b0)['then'](function(_0x244bca){_0x2aabf8[_0xaa30('0x3b')]=_0x244bca;if(_0xb043e4[_0xaa30('0x2d')][_0xaa30('0x3c')]){_0x2da4da['include']=[{'all':!![]}];}return db[_0xaa30('0x27')][_0xaa30('0x3d')](_0x2da4da);})[_0xaa30('0x20')](function(_0x480795){_0x2aabf8[_0xaa30('0x3e')]=_0x480795;return _0x2aabf8;})['then'](respondWithFilteredResult(_0x5b3efb,_0x2da4da))[_0xaa30('0x3f')](handleError(_0x5b3efb,null));};exports[_0xaa30('0x40')]=function(_0x22dfa5,_0x7b6a6b){var _0x13f08f={'raw':!![],'where':{'id':_0x22dfa5[_0xaa30('0x41')]['id']}},_0x4478cc={};_0x4478cc[_0xaa30('0x2c')]=_['keys'](db['SmsApplication'][_0xaa30('0x28')]);_0x4478cc['query']=_['keys'](_0x22dfa5['query']);_0x4478cc[_0xaa30('0x2f')]=_['intersection'](_0x4478cc[_0xaa30('0x2c')],_0x4478cc['query']);_0x13f08f[_0xaa30('0x30')]=_[_0xaa30('0x31')](_0x4478cc[_0xaa30('0x2c')],qs[_0xaa30('0x32')](_0x22dfa5[_0xaa30('0x2d')][_0xaa30('0x32')]));_0x13f08f[_0xaa30('0x30')]=_0x13f08f[_0xaa30('0x30')][_0xaa30('0x33')]?_0x13f08f[_0xaa30('0x30')]:_0x4478cc[_0xaa30('0x2c')];if(_0x22dfa5['query'][_0xaa30('0x3c')]){_0x13f08f[_0xaa30('0x42')]=[{'all':!![]}];}_0x13f08f=_[_0xaa30('0x39')]({},_0x13f08f,_0x22dfa5[_0xaa30('0x43')]);return db[_0xaa30('0x27')]['find'](_0x13f08f)['then'](handleEntityNotFound(_0x7b6a6b,null))[_0xaa30('0x20')](respondWithResult(_0x7b6a6b,null))['catch'](handleError(_0x7b6a6b,null));};exports[_0xaa30('0x44')]=function(_0xbf9edd,_0xef3564){return db[_0xaa30('0x27')][_0xaa30('0x44')](_0xbf9edd[_0xaa30('0x45')],{})[_0xaa30('0x20')](respondWithResult(_0xef3564,0xc9))['catch'](handleError(_0xef3564,null));};exports[_0xaa30('0x1f')]=function(_0x6c9da6,_0xfa14bf){if(_0x6c9da6['body']['id']){delete _0x6c9da6[_0xaa30('0x45')]['id'];}return db[_0xaa30('0x27')]['find']({'where':{'id':_0x6c9da6[_0xaa30('0x41')]['id']}})['then'](handleEntityNotFound(_0xfa14bf,null))[_0xaa30('0x20')](saveUpdates(_0x6c9da6['body'],null))['then'](respondWithResult(_0xfa14bf,null))[_0xaa30('0x3f')](handleError(_0xfa14bf,null));};exports['destroy']=function(_0x56389c,_0xf6a737){return db[_0xaa30('0x27')][_0xaa30('0x46')]({'where':{'id':_0x56389c[_0xaa30('0x41')]['id']}})[_0xaa30('0x20')](handleEntityNotFound(_0xf6a737,null))[_0xaa30('0x20')](removeEntity(_0xf6a737,null))['catch'](handleError(_0xf6a737,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 89c13bf..a94a6f0 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 _0x7c2a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x412650,_0xcb9322){var _0x1a5cf4=function(_0x5c5906){while(--_0x5c5906){_0x412650['push'](_0x412650['shift']());}};_0x1a5cf4(++_0xcb9322);}(_0x7c2a,0x1a3));var _0xa7c2=function(_0xe9b7d1,_0x39fc93){_0xe9b7d1=_0xe9b7d1-0x0;var _0xc8d0b1=_0x7c2a[_0xe9b7d1];return _0xc8d0b1;};'use strict';var _=require(_0xa7c2('0x0'));var util=require('util');var logger=require(_0xa7c2('0x1'))(_0xa7c2('0x2'));var moment=require(_0xa7c2('0x3'));var BPromise=require(_0xa7c2('0x4'));var rp=require(_0xa7c2('0x5'));var fs=require('fs');var path=require(_0xa7c2('0x6'));var rimraf=require(_0xa7c2('0x7'));var config=require(_0xa7c2('0x8'));var attributes=require(_0xa7c2('0x9'));module[_0xa7c2('0xa')]=function(_0x3eae11,_0x3252e4){return _0x3eae11['define'](_0xa7c2('0xb'),attributes,{'tableName':_0xa7c2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa7c2('0xd'),'collate':_0xa7c2('0xe')});}; \ No newline at end of file +var _0xfd3e=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x2c1ae7,_0x5412f1){var _0x35f15e=function(_0x9ff10d){while(--_0x9ff10d){_0x2c1ae7['push'](_0x2c1ae7['shift']());}};_0x35f15e(++_0x5412f1);}(_0xfd3e,0x186));var _0xefd3=function(_0x439cb4,_0x43b88a){_0x439cb4=_0x439cb4-0x0;var _0x1c38b9=_0xfd3e[_0x439cb4];return _0x1c38b9;};'use strict';var _=require('lodash');var util=require(_0xefd3('0x0'));var logger=require(_0xefd3('0x1'))(_0xefd3('0x2'));var moment=require(_0xefd3('0x3'));var BPromise=require(_0xefd3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xefd3('0x5'));var rimraf=require(_0xefd3('0x6'));var config=require(_0xefd3('0x7'));var attributes=require('./smsApplication.attributes');module[_0xefd3('0x8')]=function(_0x3ba7fe,_0x5f3f00){return _0x3ba7fe[_0xefd3('0x9')](_0xefd3('0xa'),attributes,{'tableName':_0xefd3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xefd3('0xc'),'collate':_0xefd3('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 4580b30..76bae54 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 _0x10dc=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x151321,_0x437d1a){var _0x152cb6=function(_0x1fd885){while(--_0x1fd885){_0x151321['push'](_0x151321['shift']());}};_0x152cb6(++_0x437d1a);}(_0x10dc,0x107));var _0xc10d=function(_0x595c4e,_0x444249){_0x595c4e=_0x595c4e-0x0;var _0x1e224c=_0x10dc[_0x595c4e];return _0x1e224c;};'use strict';var _=require(_0xc10d('0x0'));var util=require(_0xc10d('0x1'));var moment=require('moment');var BPromise=require(_0xc10d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc10d('0x3'));var db=require(_0xc10d('0x4'))['db'];var utils=require(_0xc10d('0x5'));var logger=require(_0xc10d('0x6'))(_0xc10d('0x7'));var config=require(_0xc10d('0x8'));var jayson=require(_0xc10d('0x9'));var client=jayson[_0xc10d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x266240,_0x58c6ec,_0x591e4d){return new BPromise(function(_0x315fff,_0x175e39){return client['request'](_0x266240,_0x591e4d)['then'](function(_0x28b2e9){logger[_0xc10d('0xb')](_0xc10d('0xc'),_0x58c6ec,_0xc10d('0xd'));logger[_0xc10d('0xe')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x58c6ec,'request\x20sent',JSON[_0xc10d('0xf')](_0x28b2e9));if(_0x28b2e9['error']){if(_0x28b2e9[_0xc10d('0x10')]['code']===0x1f4){logger[_0xc10d('0x10')]('SmsApplication,\x20%s,\x20%s',_0x58c6ec,_0x28b2e9[_0xc10d('0x10')][_0xc10d('0x11')]);return _0x175e39(_0x28b2e9[_0xc10d('0x10')][_0xc10d('0x11')]);}logger[_0xc10d('0x10')]('SmsApplication,\x20%s,\x20%s',_0x58c6ec,_0x28b2e9[_0xc10d('0x10')]['message']);return _0x315fff(_0x28b2e9[_0xc10d('0x10')][_0xc10d('0x11')]);}else{logger[_0xc10d('0xb')](_0xc10d('0xc'),_0x58c6ec,_0xc10d('0xd'));_0x315fff(_0x28b2e9[_0xc10d('0x12')][_0xc10d('0x11')]);}})[_0xc10d('0x13')](function(_0x4f6352){logger['error'](_0xc10d('0xc'),_0x58c6ec,_0x4f6352);_0x175e39(_0x4f6352);});});} \ No newline at end of file +var _0x27a8=['client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x8a8a7c,_0x1a7352){var _0x555b7a=function(_0x5633da){while(--_0x5633da){_0x8a8a7c['push'](_0x8a8a7c['shift']());}};_0x555b7a(++_0x1a7352);}(_0x27a8,0x170));var _0x827a=function(_0x19403b,_0x33103c){_0x19403b=_0x19403b-0x0;var _0xc0cf67=_0x27a8[_0x19403b];return _0xc0cf67;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x827a('0x0'));var BPromise=require(_0x827a('0x1'));var rs=require(_0x827a('0x2'));var fs=require('fs');var Redis=require(_0x827a('0x3'));var db=require(_0x827a('0x4'))['db'];var utils=require(_0x827a('0x5'));var logger=require(_0x827a('0x6'))(_0x827a('0x7'));var config=require(_0x827a('0x8'));var jayson=require(_0x827a('0x9'));var client=jayson[_0x827a('0xa')][_0x827a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa0df3c,_0x2b9fe3,_0x2e20da){return new BPromise(function(_0x2bd7f3,_0x36f9aa){return client[_0x827a('0xc')](_0xa0df3c,_0x2e20da)[_0x827a('0xd')](function(_0x32839e){logger[_0x827a('0xe')](_0x827a('0xf'),_0x2b9fe3,_0x827a('0x10'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x2b9fe3,_0x827a('0x10'),JSON[_0x827a('0x11')](_0x32839e));if(_0x32839e[_0x827a('0x12')]){if(_0x32839e['error']['code']===0x1f4){logger[_0x827a('0x12')](_0x827a('0xf'),_0x2b9fe3,_0x32839e['error'][_0x827a('0x13')]);return _0x36f9aa(_0x32839e['error'][_0x827a('0x13')]);}logger[_0x827a('0x12')](_0x827a('0xf'),_0x2b9fe3,_0x32839e['error']['message']);return _0x2bd7f3(_0x32839e[_0x827a('0x12')][_0x827a('0x13')]);}else{logger[_0x827a('0xe')]('SmsApplication,\x20%s,\x20%s',_0x2b9fe3,_0x827a('0x10'));_0x2bd7f3(_0x32839e[_0x827a('0x14')][_0x827a('0x13')]);}})['catch'](function(_0x288ca6){logger[_0x827a('0x12')](_0x827a('0xf'),_0x2b9fe3,_0x288ca6);_0x36f9aa(_0x288ca6);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 9826a68..76f2b69 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 _0x66ee=['download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','/describe','show','/:id/messages','getMessages','/:id/download'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0x66ee,0x85));var _0xe66e=function(_0x15e7aa,_0x23274a){_0x15e7aa=_0x15e7aa-0x0;var _0x5ed3e1=_0x66ee[_0x15e7aa];return _0x5ed3e1;};'use strict';var multer=require(_0xe66e('0x0'));var util=require(_0xe66e('0x1'));var path=require(_0xe66e('0x2'));var timeout=require(_0xe66e('0x3'));var express=require(_0xe66e('0x4'));var router=express['Router']();var auth=require(_0xe66e('0x5'));var interaction=require(_0xe66e('0x6'));var config=require(_0xe66e('0x7'));var controller=require(_0xe66e('0x8'));router['get']('/',auth[_0xe66e('0x9')](),controller[_0xe66e('0xa')]);router[_0xe66e('0xb')](_0xe66e('0xc'),auth[_0xe66e('0x9')](),controller['describe']);router[_0xe66e('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xe66e('0xd')]);router['get'](_0xe66e('0xe'),auth['isAuthenticated'](),controller[_0xe66e('0xf')]);router[_0xe66e('0xb')](_0xe66e('0x10'),auth[_0xe66e('0x9')](),controller[_0xe66e('0x11')]);router[_0xe66e('0x12')]('/',auth[_0xe66e('0x9')](),controller['create']);router[_0xe66e('0x12')](_0xe66e('0xe'),auth['isAuthenticated'](),controller[_0xe66e('0x13')]);router[_0xe66e('0x12')](_0xe66e('0x14'),auth[_0xe66e('0x9')](),interaction[_0xe66e('0x15')](_0xe66e('0x16'),_0xe66e('0x17')),controller[_0xe66e('0x18')]);router['put'](_0xe66e('0x19'),auth['isAuthenticated'](),interaction[_0xe66e('0x15')](_0xe66e('0x16'),_0xe66e('0x1a')),controller[_0xe66e('0x1b')]);router[_0xe66e('0x1c')](_0xe66e('0x19'),auth[_0xe66e('0x9')](),interaction['tracked'](_0xe66e('0x16'),'smsinteraction:destroy'),controller['destroy']);router['delete'](_0xe66e('0x14'),auth[_0xe66e('0x9')](),controller['removeTags']);module[_0xe66e('0x1d')]=router; \ No newline at end of file +var _0xc5b3=['/:id/download','download','post','create','/:id/tags','tracked','smsinteraction:addtags','put','sms','update','delete','smsinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages'];(function(_0x30308f,_0x172499){var _0x1894ce=function(_0x48dd6e){while(--_0x48dd6e){_0x30308f['push'](_0x30308f['shift']());}};_0x1894ce(++_0x172499);}(_0xc5b3,0x1ee));var _0x3c5b=function(_0x195577,_0x5de53a){_0x195577=_0x195577-0x0;var _0x13c367=_0xc5b3[_0x195577];return _0x13c367;};'use strict';var multer=require(_0x3c5b('0x0'));var util=require(_0x3c5b('0x1'));var path=require(_0x3c5b('0x2'));var timeout=require(_0x3c5b('0x3'));var express=require(_0x3c5b('0x4'));var router=express[_0x3c5b('0x5')]();var auth=require(_0x3c5b('0x6'));var interaction=require(_0x3c5b('0x7'));var config=require('../../config/environment');var controller=require(_0x3c5b('0x8'));router[_0x3c5b('0x9')]('/',auth['isAuthenticated'](),controller[_0x3c5b('0xa')]);router['get'](_0x3c5b('0xb'),auth[_0x3c5b('0xc')](),controller[_0x3c5b('0xd')]);router[_0x3c5b('0x9')](_0x3c5b('0xe'),auth[_0x3c5b('0xc')](),controller[_0x3c5b('0xf')]);router['get'](_0x3c5b('0x10'),auth[_0x3c5b('0xc')](),controller[_0x3c5b('0x11')]);router[_0x3c5b('0x9')](_0x3c5b('0x12'),auth['isAuthenticated'](),controller[_0x3c5b('0x13')]);router[_0x3c5b('0x14')]('/',auth[_0x3c5b('0xc')](),controller[_0x3c5b('0x15')]);router[_0x3c5b('0x14')](_0x3c5b('0x10'),auth[_0x3c5b('0xc')](),controller['addMessage']);router[_0x3c5b('0x14')](_0x3c5b('0x16'),auth[_0x3c5b('0xc')](),interaction[_0x3c5b('0x17')]('sms',_0x3c5b('0x18')),controller['addTags']);router[_0x3c5b('0x19')](_0x3c5b('0xe'),auth['isAuthenticated'](),interaction[_0x3c5b('0x17')](_0x3c5b('0x1a'),'smsinteraction:update'),controller[_0x3c5b('0x1b')]);router[_0x3c5b('0x1c')](_0x3c5b('0xe'),auth['isAuthenticated'](),interaction[_0x3c5b('0x17')]('sms',_0x3c5b('0x1d')),controller[_0x3c5b('0x1e')]);router[_0x3c5b('0x1c')](_0x3c5b('0x16'),auth[_0x3c5b('0xc')](),controller[_0x3c5b('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 9fda533..40b5e1d 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 _0xe706=['ENUM','out','sequelize','moment','exports','DATE','STRING'];(function(_0x9326a7,_0x5a7944){var _0x49c0bb=function(_0x8268e1){while(--_0x8268e1){_0x9326a7['push'](_0x9326a7['shift']());}};_0x49c0bb(++_0x5a7944);}(_0xe706,0xa3));var _0x6e70=function(_0x1efc8c,_0x46e5ef){_0x1efc8c=_0x1efc8c-0x0;var _0x2f2ace=_0xe706[_0x1efc8c];return _0x2f2ace;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6e70('0x3')]},'disposition':{'type':Sequelize[_0x6e70('0x4')]},'note':{'type':Sequelize[_0x6e70('0x4')]},'phone':{'type':Sequelize[_0x6e70('0x4')]},'read1stAt':{'type':Sequelize[_0x6e70('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x6e70('0x5')]('in',_0x6e70('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6e70('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6e70('0x5')]('in',_0x6e70('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x757a=['moment','exports','STRING','DATE','ENUM','out'];(function(_0x2c4bc3,_0x34f08b){var _0x31ca59=function(_0x2190f0){while(--_0x2190f0){_0x2c4bc3['push'](_0x2c4bc3['shift']());}};_0x31ca59(++_0x34f08b);}(_0x757a,0xde));var _0xa757=function(_0x1d0020,_0x566f6a){_0x1d0020=_0x1d0020-0x0;var _0x1b3aad=_0x757a[_0x1d0020];return _0x1b3aad;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa757('0x0'));module[_0xa757('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa757('0x2')]},'phone':{'type':Sequelize[_0xa757('0x2')]},'read1stAt':{'type':Sequelize[_0xa757('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa757('0x4')]('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa757('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 4206dc6..405a68a 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 _0x13f6=['o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','rows','show','params','intersection','includeAll','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','smsInteractionTags:save','removeTags','download','unix','join','root','server','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','direction','secret','Account','Owner','mkdirSync','10px','40px','30px','Sms','closed','closedAt','disposition','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','count','offset','set','reject','save','update','then','destroy','stack','name','map','fullname','Tags','TagIds','split','forEach','catch','index','SmsInteraction','rawAttributes','fieldName','key','model','keys','filters','query','attributes','fields','length','nolimit','limit','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','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','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','$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?','find','ContactId','buildExpression','type','text','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax'];(function(_0x2494e7,_0x3ea6e2){var _0x2e9a52=function(_0x53c782){while(--_0x53c782){_0x2494e7['push'](_0x2494e7['shift']());}};_0x2e9a52(++_0x3ea6e2);}(_0x13f6,0x124));var _0x613f=function(_0x26c5b3,_0x5e45d3){_0x26c5b3=_0x26c5b3-0x0;var _0x5ebf44=_0x13f6[_0x26c5b3];return _0x5ebf44;};'use strict';var pdf=require(_0x613f('0x0'));var emlformat=require(_0x613f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x613f('0x2'));var rp=require(_0x613f('0x3'));var moment=require(_0x613f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x613f('0x5'));var util=require(_0x613f('0x6'));var path=require(_0x613f('0x7'));var sox=require('sox');var csv=require(_0x613f('0x8'));var ejs=require(_0x613f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0x8'));var querystring=require(_0x613f('0xb'));var Papa=require(_0x613f('0xc'));var Redis=require('ioredis');var authService=require(_0x613f('0xd'));var qs=require(_0x613f('0xe'));var as=require(_0x613f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x10'))(_0x613f('0x11'));var utils=require(_0x613f('0x12'));var config=require('../../config/environment');var db=require(_0x613f('0x13'))['db'];config[_0x613f('0x14')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x613f('0x15'))(new Redis(config[_0x613f('0x14')]));require(_0x613f('0x16'))[_0x613f('0x17')](socket);function respondWithStatusCode(_0x329fcf,_0x4a6fc){_0x4a6fc=_0x4a6fc||0xcc;return function(_0x305894){if(_0x305894){return _0x329fcf[_0x613f('0x18')](_0x4a6fc);}return _0x329fcf[_0x613f('0x19')](_0x4a6fc)[_0x613f('0x1a')]();};}function respondWithResult(_0x548218,_0x3c9edf){_0x3c9edf=_0x3c9edf||0xc8;return function(_0x5d7c69){if(_0x5d7c69){return _0x548218['status'](_0x3c9edf)[_0x613f('0x1b')](_0x5d7c69);}};}function respondWithFilteredResult(_0x2f244d,_0x544eca){return function(_0x39e417){if(_0x39e417){var _0x4f9dae=_0x39e417[_0x613f('0x1c')],_0x62ebfe=_0x544eca[_0x613f('0x1d')],_0x1e5a11=_0x544eca[_0x613f('0x1d')]+_0x544eca['limit'],_0x431266;if(_0x1e5a11>=_0x4f9dae){_0x1e5a11=_0x4f9dae;_0x431266=0xc8;}else{_0x431266=0xce;}_0x2f244d['status'](_0x431266);return _0x2f244d[_0x613f('0x1e')]('Content-Range',_0x62ebfe+'-'+_0x1e5a11+'/'+_0x4f9dae)['json'](_0x39e417);}return null;};}function patchUpdates(_0x3c9b58){return function(_0x446562){try{jsonpatch['apply'](_0x446562,_0x3c9b58,!![]);}catch(_0x19123f){return BPromise[_0x613f('0x1f')](_0x19123f);}return _0x446562[_0x613f('0x20')]();};}function saveUpdates(_0x48b28a,_0x5401c2){return function(_0x11f5f3){if(_0x11f5f3){return _0x11f5f3[_0x613f('0x21')](_0x48b28a)[_0x613f('0x22')](function(_0x51f376){return _0x51f376;});}return null;};}function removeEntity(_0x41104e,_0x33e0c6){return function(_0x30de90){if(_0x30de90){return _0x30de90[_0x613f('0x23')]()[_0x613f('0x22')](function(){_0x41104e['status'](0xcc)[_0x613f('0x1a')]();});}};}function handleEntityNotFound(_0x204185,_0x51bba1){return function(_0x22035f){if(!_0x22035f){_0x204185[_0x613f('0x18')](0x194);}return _0x22035f;};}function handleError(_0x32e747,_0x4a878d){_0x4a878d=_0x4a878d||0x1f4;return function(_0x53e32b){logger['error'](_0x53e32b[_0x613f('0x24')]);if(_0x53e32b['name']){delete _0x53e32b[_0x613f('0x25')];}_0x32e747[_0x613f('0x19')](_0x4a878d)['send'](_0x53e32b);};}function getInteractionUsers(_0x121241,_0x2551c1){return new BPromise(function(_0x4c8aa1,_0x4cff5d){try{if(_0x2551c1[_0x121241['id']]){_0x121241['Users']=_[_0x613f('0x26')](_0x2551c1[_0x121241['id']],function(_0x7c1a94){return{'id':_0x7c1a94['id'],'fullname':_0x7c1a94[_0x613f('0x27')]};});}}catch(_0x47f4af){_0x4cff5d(_0x47f4af);}_0x4c8aa1(_0x121241);});}function getInteractionTags(_0x23eda8,_0x439478){return new BPromise(function(_0xd335a6,_0x19bb8f){try{if(_0x23eda8['TagIds']){_0x23eda8[_0x613f('0x28')]=[];_0x23eda8[_0x613f('0x29')][_0x613f('0x2a')](',')[_0x613f('0x2b')](function(_0x10fa2b){_0x23eda8[_0x613f('0x28')]['push'](_0x439478[_0x10fa2b]);});}delete _0x23eda8[_0x613f('0x29')];}catch(_0x3575ac){_0x19bb8f(_0x3575ac);}_0xd335a6(_0x23eda8);});}function updateSmsInteraction(_0x314819,_0x4d8b98,_0x21a1d1){return new BPromise(function(_0x4af0de,_0x3df7bf){return getInteractionUsers(_0x314819,_0x21a1d1)[_0x613f('0x22')](function(_0xc8976c){return getInteractionTags(_0xc8976c,_0x4d8b98);})[_0x613f('0x22')](function(_0x2bceaa){_0x4af0de(_0x2bceaa);})[_0x613f('0x2c')](function(_0x589157){_0x3df7bf(_0x589157);});});}exports[_0x613f('0x2d')]=function(_0x34a01b,_0x180b3d){var _0x25b2e4={},_0x477ac9={},_0x47a9f6={'count':0x0,'rows':[]};var _0x59236e=_['map'](db[_0x613f('0x2e')][_0x613f('0x2f')],function(_0x22074f){return{'name':_0x22074f[_0x613f('0x30')],'type':_0x22074f['type'][_0x613f('0x31')]};});_0x477ac9[_0x613f('0x32')]=_['map'](_0x59236e,_0x613f('0x25'));_0x477ac9['query']=_[_0x613f('0x33')](_0x34a01b['query']);_0x477ac9[_0x613f('0x34')]=_['intersection'](_0x477ac9[_0x613f('0x32')],_0x477ac9[_0x613f('0x35')]);_0x25b2e4[_0x613f('0x36')]=_['intersection'](_0x477ac9[_0x613f('0x32')],qs[_0x613f('0x37')](_0x34a01b[_0x613f('0x35')][_0x613f('0x37')]));_0x25b2e4[_0x613f('0x36')]=_0x25b2e4[_0x613f('0x36')][_0x613f('0x38')]?_0x25b2e4[_0x613f('0x36')]:_0x477ac9[_0x613f('0x32')];if(!_0x34a01b[_0x613f('0x35')]['hasOwnProperty'](_0x613f('0x39'))){_0x25b2e4[_0x613f('0x3a')]=qs[_0x613f('0x3a')](_0x34a01b[_0x613f('0x35')][_0x613f('0x3a')]);_0x25b2e4[_0x613f('0x1d')]=qs[_0x613f('0x1d')](_0x34a01b['query'][_0x613f('0x1d')]);}_0x25b2e4[_0x613f('0x3b')]=qs[_0x613f('0x3c')](_0x34a01b[_0x613f('0x35')][_0x613f('0x3c')]);_0x25b2e4[_0x613f('0x3d')]=qs[_0x613f('0x34')](_['pick'](_0x34a01b[_0x613f('0x35')],_0x477ac9[_0x613f('0x34')]),_0x59236e);var _0x3bb605=[];var _0x2f584e=squel[_0x613f('0x3e')]()[_0x613f('0x3f')]('id')[_0x613f('0x3f')](_0x613f('0x25'))[_0x613f('0x3f')](_0x613f('0x40'))[_0x613f('0x41')](_0x613f('0x42'));var _0xdd4918=squel['select']()[_0x613f('0x3f')](_0x613f('0x43'))[_0x613f('0x3f')](_0x613f('0x44'))['field'](_0x613f('0x45'))[_0x613f('0x41')](_0x613f('0x46'),'ui')[_0x613f('0x47')](_0x613f('0x48'),'u',_0x613f('0x49'));var _0x2d1a89=squel[_0x613f('0x3e')]()[_0x613f('0x41')](_0x613f('0x4a'),'i')['left_join']('cm_contacts','c',_0x613f('0x4b'))[_0x613f('0x47')]('users','o',_0x613f('0x4c'))[_0x613f('0x47')](_0x613f('0x4d'),'a',_0x613f('0x4e'))[_0x613f('0x47')](_0x613f('0x4f'),'me',_0x613f('0x50'))[_0x613f('0x47')](_0x613f('0x51'),'it',_0x613f('0x52'))[_0x613f('0x47')](_0x613f('0x42'),'t',_0x613f('0x53'));var _0x17f8e5=squel[_0x613f('0x54')]();var _0x178888=[];var _0x3adc7c=squel[_0x613f('0x54')]();var _0x5a4079;if(_0x34a01b['query'][_0x613f('0x55')]){_0x5a4079=as[_0x613f('0x56')](_0x34a01b['query']['search']);var _0x94968f=_0x5a4079['sqlOperator'];for(var _0x513bf1=0x0;_0x513bf1<_0x5a4079[_0x613f('0x57')][_0x613f('0x38')];_0x513bf1++){var _0x26ba69=_0x5a4079['conditions'][_0x513bf1];var _0x1e3298='i';var _0x150b36=_['find'](_0x59236e,['name',_0x26ba69[_0x613f('0x3f')]]);if(!_0x150b36){switch(_0x26ba69[_0x613f('0x3f')]){case _0x613f('0x58'):if(_0x26ba69[_0x613f('0x59')]==0x1){_0x2d1a89[_0x613f('0x5a')]('`'+_0x26ba69[_0x613f('0x3f')]+_0x613f('0x5b'));}else{_0x2d1a89['having']('`'+_0x26ba69['field']+_0x613f('0x5c'));}break;case'Contact':if(_0x26ba69['operator']===_0x613f('0x5d')){if(_0x26ba69[_0x613f('0x59')][_0x613f('0x2a')]('\x20')['length']>0x1){_0x17f8e5[_0x94968f](_0x613f('0x5e'),qs[_0x613f('0x5f')](_0x26ba69[_0x613f('0x59')]),null);}else{var _0x2f4791='%'+_0x26ba69[_0x613f('0x59')]+'%';_0x17f8e5[_0x94968f](_0x613f('0x60'),_0x2f4791,_0x2f4791,_0x2f4791);}}else{_0x150b36=_[_0x613f('0x61')](_0x59236e,['name',_0x613f('0x62')]);_0x26ba69['field']=_0x613f('0x62');_0x1a1ef2=as[_0x613f('0x63')](_0x1e3298,_0x150b36[_0x613f('0x64')],_0x26ba69);_0x17f8e5[_0x94968f](_0x1a1ef2[_0x613f('0x65')],_0x1a1ef2[_0x613f('0x59')][_0x613f('0x66')],_0x1a1ef2[_0x613f('0x59')][_0x613f('0x1a')]);}break;case _0x613f('0x67'):var _0x49637d=_0x26ba69[_0x613f('0x59')][_0x613f('0x2a')](',')[_0x613f('0x26')](function(_0x54ad8f){return Number(_0x54ad8f);});_0x49637d['forEach'](function(_0x687e56){_0x3adc7c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x687e56+',%');});_0x178888=_[_0x613f('0x68')](_0x178888,_0x49637d);break;case _0x613f('0x69'):if(_0x26ba69[_0x613f('0x6a')]===_0x613f('0x5d')){_0x17f8e5[_0x94968f](_0x613f('0x6b'),'%'+_0x26ba69[_0x613f('0x59')]+'%',null);}else{_0x150b36=_[_0x613f('0x61')](_0x59236e,[_0x613f('0x25'),_0x613f('0x6c')]);_0x26ba69[_0x613f('0x3f')]=_0x613f('0x6c');_0x1a1ef2=as['buildExpression'](_0x1e3298,_0x150b36[_0x613f('0x64')],_0x26ba69);_0x17f8e5[_0x94968f](_0x1a1ef2[_0x613f('0x65')],_0x1a1ef2[_0x613f('0x59')][_0x613f('0x66')],_0x1a1ef2['value'][_0x613f('0x1a')]);}break;case _0x613f('0x6d'):_0x1a1ef2=as['buildExpression']('me',null,_0x26ba69);_0x17f8e5[_0x94968f](_0x1a1ef2['text'],_0x1a1ef2[_0x613f('0x59')]['start'],_0x1a1ef2['value']['end']);break;}}else{var _0x1a1ef2=as['buildExpression'](_0x1e3298,_0x150b36['type'],_0x26ba69);_0x17f8e5[_0x94968f](_0x1a1ef2['text'],_0x1a1ef2[_0x613f('0x59')][_0x613f('0x66')],_0x1a1ef2['value'][_0x613f('0x1a')]);}}}else{var _0x3d218a=_(_0x34a01b[_0x613f('0x35')])[_0x613f('0x33')]()['map'](function(_0x24f25c){return _[_0x613f('0x6e')](_0x59236e,['name',_0x24f25c])?_0x24f25c:undefined;})[_0x613f('0x6f')]()[_0x613f('0x59')]();if(!_[_0x613f('0x70')](_0x3d218a)){_0x3d218a[_0x613f('0x2b')](function(_0x1d28d5){if(_0x1d28d5===_0x613f('0x71')){_0x2d1a89[_0x613f('0x3d')](_0x613f('0x72'),[][_0x613f('0x73')](_0x34a01b[_0x613f('0x35')][_0x1d28d5]));}else if(_0x1d28d5===_0x613f('0x74')){var _0x2e5c06=JSON['parse'](_0x34a01b[_0x613f('0x35')][_0x1d28d5])[_0x613f('0x75')];var _0x3a9ab2=JSON[_0x613f('0x76')](_0x34a01b[_0x613f('0x35')][_0x1d28d5])[_0x613f('0x77')];_0x2d1a89['where'](_0x613f('0x78'),_0x2e5c06,_0x3a9ab2);}else{if(_0x34a01b[_0x613f('0x35')][_0x1d28d5]===_0x613f('0x79')){_0x2d1a89[_0x613f('0x3d')]('i.'+_0x1d28d5+_0x613f('0x7a'));}else{_0x2d1a89[_0x613f('0x3d')]('i.'+_0x1d28d5+'\x20=\x20?',_0x34a01b['query'][_0x1d28d5]);}}});}if(_0x34a01b[_0x613f('0x35')][_0x613f('0x7b')]){if(_0x34a01b[_0x613f('0x35')][_0x613f('0x7b')]==0x1){_0x2d1a89['having'](_0x613f('0x7c'));}else{_0x2d1a89[_0x613f('0x5a')](_0x613f('0x7d'));}}if(_0x34a01b[_0x613f('0x35')]['tag']){_0x178888=_[_0x613f('0x7e')](_0x34a01b[_0x613f('0x35')][_0x613f('0x7f')])?_0x34a01b[_0x613f('0x35')][_0x613f('0x7f')]:new Array(_0x34a01b[_0x613f('0x35')][_0x613f('0x7f')]);_0x178888[_0x613f('0x2b')](function(_0x5dc81a){_0x3adc7c['or'](_0x613f('0x80'),'%,'+_0x5dc81a+',%');});}if(_0x34a01b[_0x613f('0x35')][_0x613f('0x81')]){var _0xc59698=_0x34a01b[_0x613f('0x35')][_0x613f('0x81')][_0x613f('0x82')]('\x5c','\x5c\x5c')[_0x613f('0x82')]('\x27\x27',_0x613f('0x83'));if(qs[_0x613f('0x84')](_0xc59698)){_0x17f8e5['or']('i.id\x20LIKE\x20?',_0xc59698+'%')['or'](_0x613f('0x85'),_0xc59698+'%');}else{_0x17f8e5['or'](_0x613f('0x86'),qs[_0x613f('0x5f')](_0xc59698))['or'](_0x613f('0x87'),_0xc59698+'%');}}}_0x2d1a89[_0x613f('0x3d')](_0x17f8e5);_0x2d1a89[_0x613f('0x88')](_0x613f('0x89'));var _0x2e28a7={'type':db[_0x613f('0x8a')][_0x613f('0x8b')][_0x613f('0x8c')],'raw':!![]};var _0x5d4a48=_0x2d1a89[_0x613f('0x8d')]();_0x5d4a48[_0x613f('0x3f')](_0x613f('0x89'));_0x5d4a48[_0x613f('0x3f')](_0x613f('0x8e'),_0x613f('0x58'));if(_0x25b2e4[_0x613f('0x3b')]){_0x25b2e4[_0x613f('0x3b')][_0x613f('0x2b')](function(_0x2ae55b){_0x2d1a89[_0x613f('0x3b')]('i.'+_0x2ae55b[0x0],_0x2ae55b[0x1]===_0x613f('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0x178888)){_0x2d1a89[_0x613f('0x5a')](_0x3adc7c);_0x5d4a48[_0x613f('0x3d')]('t.id\x20IN\x20?',_0x178888);}BPromise[_0x613f('0x90')]()['then'](function(){if(!_0x5a4079){if(_0x34a01b[_0x613f('0x35')]['SmsAccountId']||_0x34a01b['query'][_0x613f('0x91')])return;_0x5d4a48[_0x613f('0x3d')](_0x613f('0x92'));_0x2d1a89[_0x613f('0x3d')](_0x613f('0x92'));return;}return _0x34a01b[_0x613f('0x93')][_0x613f('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1f2179){if(_[_0x613f('0x70')](_0x1f2179)){_0x5d4a48[_0x613f('0x3d')](_0x613f('0x95'));_0x2d1a89[_0x613f('0x3d')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x5d4a48[_0x613f('0x3d')](_0x613f('0x72'),_['map'](_0x1f2179,'id'));_0x2d1a89[_0x613f('0x3d')](_0x613f('0x72'),_[_0x613f('0x26')](_0x1f2179,'id'));}});})['then'](function(){db['sequelize']['query'](_0x5d4a48[_0x613f('0x96')](),_0x2e28a7)[_0x613f('0x22')](function(_0x574ec4){_0x47a9f6[_0x613f('0x1c')]=_0x574ec4[_0x613f('0x38')];if(_0x47a9f6[_0x613f('0x1c')]===0x0)return[];return db['sequelize'][_0x613f('0x35')](_0x2f584e['toString'](),_0x2e28a7)[_0x613f('0x22')](function(_0x537763){_0x3bb605=_['keyBy'](_0x537763,'id');_0x2e28a7=_[_0x613f('0x97')](_0x2e28a7,{'model':db[_0x613f('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x34a01b[_0x613f('0x35')][_0x613f('0x37')]){_0x25b2e4[_0x613f('0x36')][_0x613f('0x2b')](function(_0x107126){_0x2d1a89[_0x613f('0x3f')]('i.'+_0x107126);});}else{_0x2d1a89[_0x613f('0x3f')](_0x613f('0x8e'),_0x613f('0x58'));_0x2d1a89['field'](_0x613f('0x98'),_0x613f('0x99'));_0x2d1a89[_0x613f('0x3f')](_0x613f('0x9a'),_0x613f('0x9b'));_0x2d1a89[_0x613f('0x3f')](_0x613f('0x9c'));_0x2d1a89['field'](_0x613f('0x9d'),_0x613f('0x9e'));_0x2d1a89[_0x613f('0x3f')](_0x613f('0x9f'),'Contact.lastName');_0x2d1a89[_0x613f('0x3f')](_0x613f('0xa0'),_0x613f('0xa1'));_0x2d1a89[_0x613f('0x3f')](_0x613f('0xa2'),_0x613f('0xa3'));_0x2d1a89['field'](_0x613f('0xa4'),_0x613f('0xa5'));_0x2d1a89['field'](_0x613f('0xa6'),_0x613f('0xa7'));_0x2d1a89[_0x613f('0x3f')](_0x613f('0xa8'),_0x613f('0xa9'));_0x2d1a89['field'](_0x613f('0xaa'),_0x613f('0xab'));_0x2d1a89[_0x613f('0x3f')](_0x613f('0xac'),_0x613f('0x29'));}if(_0x25b2e4[_0x613f('0x3a')])_0x2d1a89['limit'](_0x25b2e4['limit']);if(_0x25b2e4[_0x613f('0x1d')])_0x2d1a89[_0x613f('0x1d')](_0x25b2e4[_0x613f('0x1d')]);return db['sequelize'][_0x613f('0x35')](_0x2d1a89[_0x613f('0x96')](),_0x2e28a7);})[_0x613f('0x22')](function(_0x3f93dc){_0xdd4918['where'](_0x613f('0xad'),_[_0x613f('0x26')](_0x3f93dc,'id'));return db['sequelize']['query'](_0xdd4918['toString'](),_0x2e28a7)[_0x613f('0x22')](function(_0x47f1f0){var _0x2dc994=_[_0x613f('0xae')](_0x47f1f0,_0x613f('0xaf'));var _0x424c12=[];_0x3f93dc['forEach'](function(_0x205b4f){_0x424c12[_0x613f('0xb0')](updateSmsInteraction(_0x205b4f,_0x3bb605,_0x2dc994));});return BPromise[_0x613f('0xb1')](_0x424c12);});});})[_0x613f('0x22')](function(_0x22557a){_0x47a9f6[_0x613f('0xb2')]=_0x22557a;return _0x47a9f6;})[_0x613f('0x22')](respondWithFilteredResult(_0x180b3d,_0x25b2e4));})['catch'](handleError(_0x180b3d,null));};exports[_0x613f('0xb3')]=function(_0x19b150,_0xfa39b5){var _0x58c8f3={'raw':![],'where':{'id':_0x19b150[_0x613f('0xb4')]['id']}},_0x3ada39={};_0x3ada39[_0x613f('0x32')]=_['keys'](db[_0x613f('0x2e')][_0x613f('0x2f')]);_0x3ada39[_0x613f('0x35')]=_[_0x613f('0x33')](_0x19b150[_0x613f('0x35')]);_0x3ada39[_0x613f('0x34')]=_[_0x613f('0xb5')](_0x3ada39[_0x613f('0x32')],_0x3ada39['query']);_0x58c8f3['attributes']=_[_0x613f('0xb5')](_0x3ada39[_0x613f('0x32')],qs[_0x613f('0x37')](_0x19b150[_0x613f('0x35')][_0x613f('0x37')]));_0x58c8f3['attributes']=_0x58c8f3[_0x613f('0x36')]['length']?_0x58c8f3[_0x613f('0x36')]:_0x3ada39[_0x613f('0x32')];if(_0x19b150[_0x613f('0x35')][_0x613f('0xb6')]){_0x58c8f3['include']=[{'all':!![]}];}_0x58c8f3=_[_0x613f('0x97')]({},_0x58c8f3,_0x19b150[_0x613f('0xb7')]);return db['SmsInteraction'][_0x613f('0x61')](_0x58c8f3)['then'](handleEntityNotFound(_0xfa39b5,null))[_0x613f('0x22')](respondWithResult(_0xfa39b5,null))[_0x613f('0x2c')](handleError(_0xfa39b5,null));};exports[_0x613f('0xb8')]=function(_0x152435,_0x1a8012){return db['SmsInteraction'][_0x613f('0xb8')](_0x152435[_0x613f('0x6d')],{})['then'](respondWithResult(_0x1a8012,0xc9))[_0x613f('0x2c')](handleError(_0x1a8012,null));};exports['update']=function(_0x24d0d4,_0x3686c6){if(_0x24d0d4[_0x613f('0x6d')]['id']){delete _0x24d0d4[_0x613f('0x6d')]['id'];}return db[_0x613f('0x2e')][_0x613f('0x61')]({'where':{'id':_0x24d0d4[_0x613f('0xb4')]['id']}})['then'](handleEntityNotFound(_0x3686c6,null))[_0x613f('0x22')](saveUpdates(_0x24d0d4[_0x613f('0x6d')],null))[_0x613f('0x22')](respondWithResult(_0x3686c6,null))[_0x613f('0x2c')](handleError(_0x3686c6,null));};exports[_0x613f('0x23')]=function(_0x6c59d8,_0x13bcb8){return db[_0x613f('0x2e')][_0x613f('0x61')]({'where':{'id':_0x6c59d8[_0x613f('0xb4')]['id']}})['then'](handleEntityNotFound(_0x13bcb8,null))[_0x613f('0x22')](removeEntity(_0x13bcb8,null))[_0x613f('0x2c')](handleError(_0x13bcb8,null));};exports['describe']=function(_0x238a67,_0x379d3e){return db['SmsInteraction'][_0x613f('0xb9')]()[_0x613f('0x22')](respondWithResult(_0x379d3e,null))[_0x613f('0x2c')](handleError(_0x379d3e,null));};exports[_0x613f('0xba')]=function(_0x26883c,_0x30eea1,_0x2b8249){return db[_0x613f('0xbb')][_0x613f('0x61')]({'where':{'id':_0x26883c[_0x613f('0xb4')]['id']}})[_0x613f('0x22')](handleEntityNotFound(_0x30eea1,null))[_0x613f('0x22')](function(_0x2c7de2){if(_0x2c7de2){return _0x2c7de2[_0x613f('0xba')](_0x26883c[_0x613f('0x6d')][_0x613f('0xbc')],_[_0x613f('0xbd')](_0x26883c[_0x613f('0x6d')],[_0x613f('0xbc'),'id'])||{});}})[_0x613f('0x22')](respondWithResult(_0x30eea1,null))['catch'](handleError(_0x30eea1,null));};exports[_0x613f('0xbe')]=function(_0x5d558e,_0xf56397,_0x3d9713){var _0x580a49={'raw':![],'where':{}};var _0x36cd49={};var _0x2c3200={'count':0x0,'rows':[]};return db[_0x613f('0x2e')][_0x613f('0xbf')]({'where':{'id':_0x5d558e[_0x613f('0xb4')]['id']}})[_0x613f('0x22')](handleEntityNotFound(_0xf56397,null))['then'](function(_0xa19ec4){if(_0xa19ec4){_0x36cd49[_0x613f('0x32')]=_['keys'](db[_0x613f('0xbb')][_0x613f('0x2f')]);_0x36cd49[_0x613f('0x35')]=_[_0x613f('0x33')](_0x5d558e[_0x613f('0x35')]);_0x36cd49[_0x613f('0x34')]=_['intersection'](_0x36cd49[_0x613f('0x32')],_0x36cd49[_0x613f('0x35')]);_0x580a49[_0x613f('0x36')]=_[_0x613f('0xb5')](_0x36cd49[_0x613f('0x32')],qs[_0x613f('0x37')](_0x5d558e[_0x613f('0x35')][_0x613f('0x37')]));_0x580a49['attributes']=_0x580a49[_0x613f('0x36')]['length']?_0x580a49['attributes']:_0x36cd49[_0x613f('0x32')];if(!_0x5d558e[_0x613f('0x35')]['hasOwnProperty'](_0x613f('0x39'))){_0x580a49[_0x613f('0x3a')]=qs[_0x613f('0x3a')](_0x5d558e[_0x613f('0x35')][_0x613f('0x3a')]);_0x580a49[_0x613f('0x1d')]=qs[_0x613f('0x1d')](_0x5d558e[_0x613f('0x35')][_0x613f('0x1d')]);}_0x580a49['order']=qs[_0x613f('0x3c')](_0x5d558e['query'][_0x613f('0x3c')]);_0x580a49[_0x613f('0x3d')]=qs['filters'](_[_0x613f('0xc0')](_0x5d558e['query'],_0x36cd49[_0x613f('0x34')]));_0x580a49[_0x613f('0x3d')][_0x613f('0xaf')]=_0xa19ec4['id'];if(_0x5d558e['query'][_0x613f('0x81')]){_0x580a49[_0x613f('0x3d')]=_[_0x613f('0x97')](_0x580a49[_0x613f('0x3d')],{'$or':_[_0x613f('0x26')](_0x580a49[_0x613f('0x36')],function(_0x27a824){var _0x452bd2={};_0x452bd2[_0x27a824]={'$like':'%'+_0x5d558e[_0x613f('0x35')]['filter']+'%'};return _0x452bd2;})});}if(_0x5d558e[_0x613f('0x35')][_0x613f('0x75')]){var _0x164c9a=_0x5d558e['query'][_0x613f('0x75')][_0x613f('0x2a')](',');var _0xcc5140={};_0xcc5140[_0x164c9a[0x0]]={'$gte':moment(_0x164c9a[0x1])[_0x613f('0xc1')](_0x613f('0xc2'))};_0x580a49[_0x613f('0x3d')]=_[_0x613f('0x97')](_0x580a49[_0x613f('0x3d')],_0xcc5140);}_0x580a49=_['merge']({},_0x580a49,_0x5d558e[_0x613f('0xb7')]);return db[_0x613f('0xbb')][_0x613f('0x1c')]({'where':_0x580a49[_0x613f('0x3d')]})[_0x613f('0x22')](function(_0x339e10){_0x2c3200[_0x613f('0x1c')]=_0x339e10;if(_0x5d558e[_0x613f('0x35')]['includeAll']){_0x580a49['include']=[{'all':!![]}];}return db[_0x613f('0xbb')][_0x613f('0xc3')](_0x580a49);})[_0x613f('0x22')](function(_0x4ff04f){_0x2c3200[_0x613f('0xb2')]=_0x4ff04f;return _0x2c3200;});}})[_0x613f('0x22')](respondWithFilteredResult(_0xf56397,_0x580a49))[_0x613f('0x2c')](handleError(_0xf56397,null));};exports['addTags']=function(_0x3571fc,_0x57d05a,_0x54d104){return db[_0x613f('0x2e')][_0x613f('0x61')]({'where':{'id':_0x3571fc['params']['id']}})[_0x613f('0x22')](handleEntityNotFound(_0x57d05a,null))[_0x613f('0x22')](function(_0x55332e){if(_0x55332e){return _0x55332e[_0x613f('0xc4')](_0x3571fc[_0x613f('0x6d')][_0x613f('0xbc')],_[_0x613f('0xbd')](_0x3571fc[_0x613f('0x6d')],['ids','id'])||{})['spread'](function(){return db[_0x613f('0x67')]['findAll']({'attributes':['id',_0x613f('0x25'),'color'],'where':{'id':_0x3571fc[_0x613f('0x6d')]['ids']}});})[_0x613f('0x22')](function(_0x536cd9){socket['emit'](_0x613f('0xc5'),{'id':Number(_0x3571fc[_0x613f('0xb4')]['id']),'tags':_0x536cd9||[]});return{'id':Number(_0x3571fc['params']['id']),'tags':_0x536cd9||[]};});}})[_0x613f('0x22')](respondWithResult(_0x57d05a,null))['catch'](handleError(_0x57d05a,null));};exports['removeTags']=function(_0x4e5f68,_0x3feae2,_0x3def1a){return db[_0x613f('0x2e')]['find']({'where':{'id':_0x4e5f68[_0x613f('0xb4')]['id']}})[_0x613f('0x22')](handleEntityNotFound(_0x3feae2,null))[_0x613f('0x22')](function(_0x576665){if(_0x576665){return _0x576665[_0x613f('0xc6')](_0x4e5f68[_0x613f('0x35')][_0x613f('0xbc')]);}})[_0x613f('0x22')](respondWithStatusCode(_0x3feae2,null))[_0x613f('0x2c')](handleError(_0x3feae2,null));};exports[_0x613f('0xc7')]=function(_0x2cdabf,_0x49f053){var _0x3412a3=moment()[_0x613f('0xc8')]()[_0x613f('0x96')]();var _0x507e12=path[_0x613f('0xc9')](config[_0x613f('0xca')],_0x613f('0xcb'),'files',_0x613f('0xcc'));var _0x15564e=path[_0x613f('0xc9')](config['root'],_0x613f('0xcb'),'files',_0x613f('0xcd'));var _0x172a31=path[_0x613f('0xc9')](_0x507e12,_0x3412a3);var _0x185d2d=util[_0x613f('0xc1')](_0x613f('0xce'),_0x2cdabf[_0x613f('0xb4')]['id'],_0x3412a3);var _0x513294=path['join'](_0x507e12,_0x185d2d);var _0x4dc9a0=[];_0x4dc9a0[_0x613f('0xb0')]({'model':db[_0x613f('0x69')],'as':_0x613f('0x69'),'attributes':['id',_0x613f('0x27')],'raw':!![]});_0x4dc9a0['push']({'model':db['CmContact'],'as':_0x613f('0xcf'),'attributes':['id',_0x613f('0xd0'),_0x613f('0xd1')],'raw':!![]});var _0x2b66fb=[{'model':db[_0x613f('0xbb')],'as':'Messages','attributes':['id','body',_0x613f('0x74'),_0x613f('0xd2'),_0x613f('0xd3'),_0x613f('0x7b')],'include':_0x4dc9a0}];_0x2b66fb[_0x613f('0xb0')]({'model':db['SmsAccount'],'as':_0x613f('0xd4'),'attributes':['id',_0x613f('0x25')]});_0x2b66fb[_0x613f('0xb0')]({'model':db[_0x613f('0x69')],'as':_0x613f('0xd5'),'attributes':['id',_0x613f('0x27')]});return db[_0x613f('0x2e')][_0x613f('0x61')]({'where':{'id':_0x2cdabf[_0x613f('0xb4')]['id']},'include':_0x2b66fb})[_0x613f('0x22')](handleEntityNotFound(_0x49f053,null))[_0x613f('0x22')](function(_0x2df2e9){if(_0x2df2e9){var _0x19b90c=_0x2df2e9['get']({'plain':!![]});fs[_0x613f('0xd6')](_0x172a31);var _0x386460={'format':'A4','border':_0x613f('0xd7'),'header':{'height':_0x613f('0xd8'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x613f('0xd9'),'contents':{'default':util[_0x613f('0xc1')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x613f('0xc1')]('%s\x20#%d',_0x613f('0xda'),_0x19b90c['id']),moment()[_0x613f('0xc1')]('YYYY-MM-DD')['toString']())}}};var _0x203117={'channel':'Sms','account':_0x19b90c['Account'][_0x613f('0x25')],'agent':_0x19b90c[_0x613f('0xd5')]?_0x19b90c['Owner'][_0x613f('0x27')]:'N.A.','createdAt':moment(_0x19b90c[_0x613f('0x74')])['format'](_0x613f('0xc2'))[_0x613f('0x96')](),'closedAt':_0x19b90c[_0x613f('0xdb')]?moment(_0x19b90c[_0x613f('0xdc')])['format'](_0x613f('0xc2'))[_0x613f('0x96')]():'','disposition':_0x19b90c[_0x613f('0xdd')],'messages':_(_0x19b90c['Messages'])['filter']({'secret':![]})['map'](function(_0x43085a){return{'date':moment(_0x43085a['createdAt'])[_0x613f('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')[_0x613f('0x96')](),'sender':_0x43085a[_0x613f('0xd2')]===_0x613f('0xde')?_0x43085a[_0x613f('0x69')]?_0x43085a[_0x613f('0x69')][_0x613f('0x27')]:'System':_0x43085a[_0x613f('0xcf')][_0x613f('0xd0')]+(_0x43085a[_0x613f('0xcf')]['lastName']?'\x20'+_0x43085a[_0x613f('0xcf')]['lastName']:''),'body':_0x43085a[_0x613f('0x6d')],'direction':_0x43085a[_0x613f('0xd2')]===_0x613f('0xde')?'A':'C','secret':_0x43085a['secret'],'read':_0x43085a[_0x613f('0x7b')]};})['value']()};return ejs[_0x613f('0xdf')](path['join'](config[_0x613f('0xca')],_0x613f('0xcb'),_0x613f('0xe0'),_0x613f('0xe1')),{'interaction':_0x203117})['then'](function(_0x361ae6){return new BPromise(function(_0x564c45,_0x26c4ed){pdf[_0x613f('0xb8')](_0x361ae6,_0x386460)[_0x613f('0xe2')](path['join'](_0x172a31,_0x613f('0xe3')+_0x19b90c['id']+'-'+_0x3412a3+_0x613f('0xe4')),function(_0x62cd9d,_0x3b7b3b){if(_0x62cd9d)return _0x26c4ed(_0x62cd9d);_0x564c45(_0x3b7b3b);});});})[_0x613f('0x22')](function(){return new BPromise(function(_0x250558,_0x165a07){zipdir(_0x172a31,{'saveTo':_0x513294},function(_0x179c73,_0x292a88){if(_0x179c73)return _0x165a07(_0x179c73);return _0x250558(_0x292a88);});})[_0x613f('0x22')](function(){return new BPromise(function(_0x483b81,_0x5f52ef){rimraf(_0x172a31,function(_0x1730ce){if(_0x1730ce)_0x5f52ef(_0x1730ce);return _0x483b81();});});})[_0x613f('0x22')](function(){return _0x49f053['download'](_0x513294,_0x185d2d,function(_0x57af05){if(_0x57af05){console['log'](_0x613f('0xe5'),_0x57af05);}else{fs['unlinkSync'](_0x513294);}});});});}else{return _0x49f053['sendStatus'](0xc8);}})[_0x613f('0x2c')](handleError(_0x49f053,null));}; \ No newline at end of file +var _0x750a=['DESC','t.id\x20IN\x20?','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','count','keyBy','merge','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','rows','show','params','includeAll','options','create','update','addMessage','omit','ids','getMessages','findOne','SmsMessage','sort','format','include','addTags','setTags','spread','findAll','smsInteractionTags:save','removeTags','unix','join','root','server','tmp','files','transcript-%d-%s.zip','CmContact','Contact','secret','Owner','get','mkdirSync','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','Account','N.A.','closed','closedAt','disposition','Messages','direction','out','System','firstName','lastName','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','log','unlinkSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./smsInteraction.socket','register','status','end','offset','Content-Range','apply','save','destroy','then','sendStatus','error','name','map','fullname','TagIds','Tags','split','forEach','push','catch','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','filters','select','field','color','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','$substring','getFullTextValue','ContactId','text','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','type','body','some','compact','isEmpty','SmsAccountId','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)'];(function(_0x1eaa8f,_0x3d4146){var _0x7e33e0=function(_0x5a78a9){while(--_0x5a78a9){_0x1eaa8f['push'](_0x1eaa8f['shift']());}};_0x7e33e0(++_0x3d4146);}(_0x750a,0x140));var _0xa750=function(_0x268fa0,_0x1ee87c){_0x268fa0=_0x268fa0-0x0;var _0x54efe0=_0x750a[_0x268fa0];return _0x54efe0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa750('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa750('0x1'));var rp=require(_0xa750('0x2'));var moment=require(_0xa750('0x3'));var BPromise=require(_0xa750('0x4'));var Mustache=require(_0xa750('0x5'));var util=require(_0xa750('0x6'));var path=require(_0xa750('0x7'));var sox=require(_0xa750('0x8'));var csv=require(_0xa750('0x9'));var ejs=require(_0xa750('0xa'));var fs=require('fs');var _=require(_0xa750('0xb'));var squel=require(_0xa750('0xc'));var crypto=require(_0xa750('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa750('0x9'));var querystring=require('querystring');var Papa=require(_0xa750('0xe'));var Redis=require(_0xa750('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa750('0x10'));var as=require(_0xa750('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa750('0x12'));var utils=require('../../config/utils');var config=require(_0xa750('0x13'));var db=require(_0xa750('0x14'))['db'];config['redis']=_[_0xa750('0x15')](config[_0xa750('0x16')],{'host':_0xa750('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa750('0x16')]));require(_0xa750('0x18'))[_0xa750('0x19')](socket);function respondWithStatusCode(_0x24e48a,_0xa66181){_0xa66181=_0xa66181||0xcc;return function(_0x339329){if(_0x339329){return _0x24e48a['sendStatus'](_0xa66181);}return _0x24e48a[_0xa750('0x1a')](_0xa66181)[_0xa750('0x1b')]();};}function respondWithResult(_0x290d46,_0x49fe3b){_0x49fe3b=_0x49fe3b||0xc8;return function(_0x337095){if(_0x337095){return _0x290d46[_0xa750('0x1a')](_0x49fe3b)['json'](_0x337095);}};}function respondWithFilteredResult(_0x4afb05,_0x321eb2){return function(_0x5b1e6b){if(_0x5b1e6b){var _0x433dbd=_0x5b1e6b['count'],_0x1bde87=_0x321eb2['offset'],_0x4f1faa=_0x321eb2[_0xa750('0x1c')]+_0x321eb2['limit'],_0x36dcca;if(_0x4f1faa>=_0x433dbd){_0x4f1faa=_0x433dbd;_0x36dcca=0xc8;}else{_0x36dcca=0xce;}_0x4afb05[_0xa750('0x1a')](_0x36dcca);return _0x4afb05['set'](_0xa750('0x1d'),_0x1bde87+'-'+_0x4f1faa+'/'+_0x433dbd)['json'](_0x5b1e6b);}return null;};}function patchUpdates(_0x3dc7f1){return function(_0x500922){try{jsonpatch[_0xa750('0x1e')](_0x500922,_0x3dc7f1,!![]);}catch(_0x4d1939){return BPromise['reject'](_0x4d1939);}return _0x500922[_0xa750('0x1f')]();};}function saveUpdates(_0x52da84,_0x216fbf){return function(_0x5a9d96){if(_0x5a9d96){return _0x5a9d96['update'](_0x52da84)['then'](function(_0x5d758e){return _0x5d758e;});}return null;};}function removeEntity(_0x15d72f,_0x2ec6c4){return function(_0x2c43ef){if(_0x2c43ef){return _0x2c43ef[_0xa750('0x20')]()[_0xa750('0x21')](function(){_0x15d72f[_0xa750('0x1a')](0xcc)[_0xa750('0x1b')]();});}};}function handleEntityNotFound(_0x7e22ad,_0x3d52b3){return function(_0x94697a){if(!_0x94697a){_0x7e22ad[_0xa750('0x22')](0x194);}return _0x94697a;};}function handleError(_0x27a5eb,_0x31ea63){_0x31ea63=_0x31ea63||0x1f4;return function(_0x3f7d6d){logger[_0xa750('0x23')](_0x3f7d6d['stack']);if(_0x3f7d6d[_0xa750('0x24')]){delete _0x3f7d6d[_0xa750('0x24')];}_0x27a5eb[_0xa750('0x1a')](_0x31ea63)['send'](_0x3f7d6d);};}function getInteractionUsers(_0x35ab53,_0x6ade2b){return new BPromise(function(_0x3270e3,_0x1223d2){try{if(_0x6ade2b[_0x35ab53['id']]){_0x35ab53['Users']=_[_0xa750('0x25')](_0x6ade2b[_0x35ab53['id']],function(_0x34d5e9){return{'id':_0x34d5e9['id'],'fullname':_0x34d5e9[_0xa750('0x26')]};});}}catch(_0x2aef3a){_0x1223d2(_0x2aef3a);}_0x3270e3(_0x35ab53);});}function getInteractionTags(_0x2c5253,_0x59ab33){return new BPromise(function(_0x46cc11,_0x4c2c9e){try{if(_0x2c5253[_0xa750('0x27')]){_0x2c5253[_0xa750('0x28')]=[];_0x2c5253['TagIds'][_0xa750('0x29')](',')[_0xa750('0x2a')](function(_0x5e66fd){_0x2c5253[_0xa750('0x28')][_0xa750('0x2b')](_0x59ab33[_0x5e66fd]);});}delete _0x2c5253[_0xa750('0x27')];}catch(_0x31066b){_0x4c2c9e(_0x31066b);}_0x46cc11(_0x2c5253);});}function updateSmsInteraction(_0x6ec750,_0x549179,_0xdb4a47){return new BPromise(function(_0x52f202,_0x18d040){return getInteractionUsers(_0x6ec750,_0xdb4a47)[_0xa750('0x21')](function(_0x29590f){return getInteractionTags(_0x29590f,_0x549179);})[_0xa750('0x21')](function(_0x556fde){_0x52f202(_0x556fde);})[_0xa750('0x2c')](function(_0xa700fd){_0x18d040(_0xa700fd);});});}exports['index']=function(_0x3f31b5,_0x330710){var _0x280b87={},_0x15b682={},_0x4b13fc={'count':0x0,'rows':[]};var _0xf60128=_['map'](db['SmsInteraction'][_0xa750('0x2d')],function(_0x146cad){return{'name':_0x146cad[_0xa750('0x2e')],'type':_0x146cad['type'][_0xa750('0x2f')]};});_0x15b682[_0xa750('0x30')]=_[_0xa750('0x25')](_0xf60128,'name');_0x15b682[_0xa750('0x31')]=_[_0xa750('0x32')](_0x3f31b5[_0xa750('0x31')]);_0x15b682['filters']=_[_0xa750('0x33')](_0x15b682[_0xa750('0x30')],_0x15b682[_0xa750('0x31')]);_0x280b87['attributes']=_[_0xa750('0x33')](_0x15b682[_0xa750('0x30')],qs[_0xa750('0x34')](_0x3f31b5[_0xa750('0x31')]['fields']));_0x280b87['attributes']=_0x280b87[_0xa750('0x35')][_0xa750('0x36')]?_0x280b87['attributes']:_0x15b682[_0xa750('0x30')];if(!_0x3f31b5[_0xa750('0x31')][_0xa750('0x37')](_0xa750('0x38'))){_0x280b87[_0xa750('0x39')]=qs['limit'](_0x3f31b5[_0xa750('0x31')][_0xa750('0x39')]);_0x280b87[_0xa750('0x1c')]=qs[_0xa750('0x1c')](_0x3f31b5[_0xa750('0x31')][_0xa750('0x1c')]);}_0x280b87[_0xa750('0x3a')]=qs['sort'](_0x3f31b5[_0xa750('0x31')]['sort']);_0x280b87[_0xa750('0x3b')]=qs['filters'](_[_0xa750('0x3c')](_0x3f31b5[_0xa750('0x31')],_0x15b682[_0xa750('0x3d')]),_0xf60128);var _0x1be24e=[];var _0x430d60=squel[_0xa750('0x3e')]()[_0xa750('0x3f')]('id')[_0xa750('0x3f')](_0xa750('0x24'))[_0xa750('0x3f')](_0xa750('0x40'))[_0xa750('0x41')](_0xa750('0x42'));var _0x4607fe=squel[_0xa750('0x3e')]()[_0xa750('0x3f')](_0xa750('0x43'))[_0xa750('0x3f')](_0xa750('0x44'))[_0xa750('0x3f')]('ui.SmsInteractionId')[_0xa750('0x41')](_0xa750('0x45'),'ui')[_0xa750('0x46')](_0xa750('0x47'),'u',_0xa750('0x48'));var _0x3f588a=squel[_0xa750('0x3e')]()[_0xa750('0x41')](_0xa750('0x49'),'i')['left_join'](_0xa750('0x4a'),'c',_0xa750('0x4b'))['left_join'](_0xa750('0x47'),'o',_0xa750('0x4c'))[_0xa750('0x46')](_0xa750('0x4d'),'a',_0xa750('0x4e'))[_0xa750('0x46')](_0xa750('0x4f'),'me',_0xa750('0x50'))[_0xa750('0x46')](_0xa750('0x51'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xa750('0x46')](_0xa750('0x42'),'t','t.id\x20=\x20it.TagId');var _0x93e49f=squel[_0xa750('0x52')]();var _0x3501ee=[];var _0x4a21d6=squel[_0xa750('0x52')]();var _0x3fc623;if(_0x3f31b5[_0xa750('0x31')][_0xa750('0x53')]){_0x3fc623=as['parseSearch'](_0x3f31b5[_0xa750('0x31')][_0xa750('0x53')]);var _0x36af53=_0x3fc623[_0xa750('0x54')];for(var _0x4ce363=0x0;_0x4ce363<_0x3fc623[_0xa750('0x55')][_0xa750('0x36')];_0x4ce363++){var _0x495b28=_0x3fc623[_0xa750('0x55')][_0x4ce363];var _0x556283='i';var _0x419634=_[_0xa750('0x56')](_0xf60128,['name',_0x495b28['field']]);if(!_0x419634){switch(_0x495b28['field']){case _0xa750('0x57'):if(_0x495b28[_0xa750('0x58')]==0x1){_0x3f588a['having']('`'+_0x495b28[_0xa750('0x3f')]+_0xa750('0x59'));}else{_0x3f588a[_0xa750('0x5a')]('`'+_0x495b28['field']+'`\x20>\x200');}break;case'Contact':if(_0x495b28['operator']===_0xa750('0x5b')){if(_0x495b28['value'][_0xa750('0x29')]('\x20')[_0xa750('0x36')]>0x1){_0x93e49f[_0x36af53]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa750('0x5c')](_0x495b28['value']),null);}else{var _0x3e6129='%'+_0x495b28['value']+'%';_0x93e49f[_0x36af53]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3e6129,_0x3e6129,_0x3e6129);}}else{_0x419634=_['find'](_0xf60128,['name',_0xa750('0x5d')]);_0x495b28[_0xa750('0x3f')]='ContactId';_0x32fd6b=as['buildExpression'](_0x556283,_0x419634['type'],_0x495b28);_0x93e49f[_0x36af53](_0x32fd6b[_0xa750('0x5e')],_0x32fd6b[_0xa750('0x58')][_0xa750('0x5f')],_0x32fd6b[_0xa750('0x58')][_0xa750('0x1b')]);}break;case _0xa750('0x60'):var _0x599e7e=_0x495b28['value'][_0xa750('0x29')](',')[_0xa750('0x25')](function(_0x13d729){return Number(_0x13d729);});_0x599e7e[_0xa750('0x2a')](function(_0xa8fe){_0x4a21d6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xa8fe+',%');});_0x3501ee=_[_0xa750('0x61')](_0x3501ee,_0x599e7e);break;case _0xa750('0x62'):if(_0x495b28[_0xa750('0x63')]===_0xa750('0x5b')){_0x93e49f[_0x36af53](_0xa750('0x64'),'%'+_0x495b28[_0xa750('0x58')]+'%',null);}else{_0x419634=_[_0xa750('0x56')](_0xf60128,[_0xa750('0x24'),'UserId']);_0x495b28[_0xa750('0x3f')]=_0xa750('0x65');_0x32fd6b=as[_0xa750('0x66')](_0x556283,_0x419634[_0xa750('0x67')],_0x495b28);_0x93e49f[_0x36af53](_0x32fd6b[_0xa750('0x5e')],_0x32fd6b['value'][_0xa750('0x5f')],_0x32fd6b[_0xa750('0x58')][_0xa750('0x1b')]);}break;case _0xa750('0x68'):_0x32fd6b=as[_0xa750('0x66')]('me',null,_0x495b28);_0x93e49f[_0x36af53](_0x32fd6b[_0xa750('0x5e')],_0x32fd6b[_0xa750('0x58')][_0xa750('0x5f')],_0x32fd6b[_0xa750('0x58')][_0xa750('0x1b')]);break;}}else{var _0x32fd6b=as[_0xa750('0x66')](_0x556283,_0x419634[_0xa750('0x67')],_0x495b28);_0x93e49f[_0x36af53](_0x32fd6b[_0xa750('0x5e')],_0x32fd6b[_0xa750('0x58')][_0xa750('0x5f')],_0x32fd6b['value'][_0xa750('0x1b')]);}}}else{var _0x4ad344=_(_0x3f31b5[_0xa750('0x31')])[_0xa750('0x32')]()[_0xa750('0x25')](function(_0x5845c5){return _[_0xa750('0x69')](_0xf60128,[_0xa750('0x24'),_0x5845c5])?_0x5845c5:undefined;})[_0xa750('0x6a')]()[_0xa750('0x58')]();if(!_[_0xa750('0x6b')](_0x4ad344)){_0x4ad344[_0xa750('0x2a')](function(_0x48fbd0){if(_0x48fbd0===_0xa750('0x6c')){_0x3f588a[_0xa750('0x3b')]('i.SmsAccountId\x20IN\x20?',[][_0xa750('0x6d')](_0x3f31b5[_0xa750('0x31')][_0x48fbd0]));}else if(_0x48fbd0===_0xa750('0x6e')){var _0xe4d85b=JSON[_0xa750('0x6f')](_0x3f31b5[_0xa750('0x31')][_0x48fbd0])[_0xa750('0x70')];var _0xc0b61b=JSON[_0xa750('0x6f')](_0x3f31b5[_0xa750('0x31')][_0x48fbd0])[_0xa750('0x71')];_0x3f588a['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xe4d85b,_0xc0b61b);}else{if(_0x3f31b5[_0xa750('0x31')][_0x48fbd0]===_0xa750('0x72')){_0x3f588a[_0xa750('0x3b')]('i.'+_0x48fbd0+_0xa750('0x73'));}else{_0x3f588a['where']('i.'+_0x48fbd0+_0xa750('0x74'),_0x3f31b5[_0xa750('0x31')][_0x48fbd0]);}}});}if(_0x3f31b5[_0xa750('0x31')][_0xa750('0x75')]){if(_0x3f31b5[_0xa750('0x31')][_0xa750('0x75')]==0x1){_0x3f588a[_0xa750('0x5a')](_0xa750('0x76'));}else{_0x3f588a[_0xa750('0x5a')](_0xa750('0x77'));}}if(_0x3f31b5[_0xa750('0x31')]['tag']){_0x3501ee=_['isArray'](_0x3f31b5[_0xa750('0x31')]['tag'])?_0x3f31b5['query'][_0xa750('0x78')]:new Array(_0x3f31b5[_0xa750('0x31')][_0xa750('0x78')]);_0x3501ee[_0xa750('0x2a')](function(_0x292dab){_0x4a21d6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x292dab+',%');});}if(_0x3f31b5[_0xa750('0x31')][_0xa750('0x79')]){var _0x37cebc=_0x3f31b5[_0xa750('0x31')][_0xa750('0x79')][_0xa750('0x7a')]('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0xa750('0x7b')](_0x37cebc)){_0x93e49f['or'](_0xa750('0x7c'),_0x37cebc+'%')['or'](_0xa750('0x7d'),_0x37cebc+'%');}else{_0x93e49f['or'](_0xa750('0x7e'),qs[_0xa750('0x5c')](_0x37cebc))['or'](_0xa750('0x7f'),_0x37cebc+'%');}}}_0x3f588a[_0xa750('0x3b')](_0x93e49f);_0x3f588a[_0xa750('0x80')]('i.id');var _0x307f1f={'type':db['Sequelize']['QueryTypes'][_0xa750('0x81')],'raw':!![]};var _0x7c3321=_0x3f588a[_0xa750('0x82')]();_0x7c3321[_0xa750('0x3f')]('i.id');_0x7c3321[_0xa750('0x3f')](_0xa750('0x83'),_0xa750('0x57'));if(_0x280b87[_0xa750('0x3a')]){_0x280b87['order'][_0xa750('0x2a')](function(_0x14da66){_0x3f588a[_0xa750('0x3a')]('i.'+_0x14da66[0x0],_0x14da66[0x1]===_0xa750('0x84')?![]:!![]);});}if(!_[_0xa750('0x6b')](_0x3501ee)){_0x3f588a[_0xa750('0x5a')](_0x4a21d6);_0x7c3321[_0xa750('0x3b')](_0xa750('0x85'),_0x3501ee);}BPromise['resolve']()['then'](function(){if(!_0x3fc623){if(_0x3f31b5[_0xa750('0x31')]['SmsAccountId']||_0x3f31b5[_0xa750('0x31')][_0xa750('0x86')])return;_0x7c3321['where'](_0xa750('0x87'));_0x3f588a['where'](_0xa750('0x87'));return;}return _0x3f31b5[_0xa750('0x88')][_0xa750('0x89')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4dc654){if(_[_0xa750('0x6b')](_0x4dc654)){_0x7c3321[_0xa750('0x3b')](_0xa750('0x8a'));_0x3f588a['where']('i.SmsAccountId\x20IS\x20NULL');}else{_0x7c3321['where'](_0xa750('0x8b'),_[_0xa750('0x25')](_0x4dc654,'id'));_0x3f588a['where'](_0xa750('0x8b'),_[_0xa750('0x25')](_0x4dc654,'id'));}});})[_0xa750('0x21')](function(){db[_0xa750('0x8c')][_0xa750('0x31')](_0x7c3321[_0xa750('0x8d')](),_0x307f1f)['then'](function(_0x3c3800){_0x4b13fc[_0xa750('0x8e')]=_0x3c3800[_0xa750('0x36')];if(_0x4b13fc['count']===0x0)return[];return db[_0xa750('0x8c')][_0xa750('0x31')](_0x430d60[_0xa750('0x8d')](),_0x307f1f)[_0xa750('0x21')](function(_0x584fdf){_0x1be24e=_[_0xa750('0x8f')](_0x584fdf,'id');_0x307f1f=_[_0xa750('0x90')](_0x307f1f,{'model':db[_0xa750('0x91')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f31b5['query'][_0xa750('0x34')]){_0x280b87['attributes'][_0xa750('0x2a')](function(_0x2e3b00){_0x3f588a[_0xa750('0x3f')]('i.'+_0x2e3b00);});}else{_0x3f588a[_0xa750('0x3f')](_0xa750('0x83'),'unreadMessages');_0x3f588a[_0xa750('0x3f')](_0xa750('0x92'),_0xa750('0x93'));_0x3f588a[_0xa750('0x3f')](_0xa750('0x94'),'Account.mandatoryDisposition');_0x3f588a[_0xa750('0x3f')](_0xa750('0x95'));_0x3f588a[_0xa750('0x3f')](_0xa750('0x96'),_0xa750('0x97'));_0x3f588a[_0xa750('0x3f')](_0xa750('0x98'),_0xa750('0x99'));_0x3f588a['field']('c.email','Contact.email');_0x3f588a['field'](_0xa750('0x9a'),'Contact.phone');_0x3f588a[_0xa750('0x3f')](_0xa750('0x9b'),_0xa750('0x9c'));_0x3f588a[_0xa750('0x3f')](_0xa750('0x9d'),'Contact.fax');_0x3f588a['field'](_0xa750('0x9e'),_0xa750('0x9f'));_0x3f588a['field'](_0xa750('0xa0'),_0xa750('0xa1'));_0x3f588a[_0xa750('0x3f')](_0xa750('0xa2'),_0xa750('0x27'));}if(_0x280b87[_0xa750('0x39')])_0x3f588a[_0xa750('0x39')](_0x280b87[_0xa750('0x39')]);if(_0x280b87[_0xa750('0x1c')])_0x3f588a[_0xa750('0x1c')](_0x280b87[_0xa750('0x1c')]);return db[_0xa750('0x8c')][_0xa750('0x31')](_0x3f588a[_0xa750('0x8d')](),_0x307f1f);})[_0xa750('0x21')](function(_0x3e28be){_0x4607fe['where']('ui.SmsInteractionId\x20IN\x20?',_[_0xa750('0x25')](_0x3e28be,'id'));return db[_0xa750('0x8c')][_0xa750('0x31')](_0x4607fe[_0xa750('0x8d')](),_0x307f1f)['then'](function(_0x2230d5){var _0x24154c=_[_0xa750('0xa3')](_0x2230d5,_0xa750('0xa4'));var _0x3d2c96=[];_0x3e28be[_0xa750('0x2a')](function(_0x166b93){_0x3d2c96[_0xa750('0x2b')](updateSmsInteraction(_0x166b93,_0x1be24e,_0x24154c));});return BPromise['all'](_0x3d2c96);});});})[_0xa750('0x21')](function(_0x499f19){_0x4b13fc[_0xa750('0xa5')]=_0x499f19;return _0x4b13fc;})[_0xa750('0x21')](respondWithFilteredResult(_0x330710,_0x280b87));})[_0xa750('0x2c')](handleError(_0x330710,null));};exports[_0xa750('0xa6')]=function(_0x20695b,_0x1dd159){var _0x1996c5={'raw':![],'where':{'id':_0x20695b[_0xa750('0xa7')]['id']}},_0x470b75={};_0x470b75[_0xa750('0x30')]=_[_0xa750('0x32')](db[_0xa750('0x91')][_0xa750('0x2d')]);_0x470b75[_0xa750('0x31')]=_[_0xa750('0x32')](_0x20695b[_0xa750('0x31')]);_0x470b75[_0xa750('0x3d')]=_['intersection'](_0x470b75['model'],_0x470b75['query']);_0x1996c5[_0xa750('0x35')]=_[_0xa750('0x33')](_0x470b75[_0xa750('0x30')],qs[_0xa750('0x34')](_0x20695b[_0xa750('0x31')]['fields']));_0x1996c5[_0xa750('0x35')]=_0x1996c5[_0xa750('0x35')][_0xa750('0x36')]?_0x1996c5['attributes']:_0x470b75[_0xa750('0x30')];if(_0x20695b[_0xa750('0x31')][_0xa750('0xa8')]){_0x1996c5['include']=[{'all':!![]}];}_0x1996c5=_[_0xa750('0x90')]({},_0x1996c5,_0x20695b[_0xa750('0xa9')]);return db[_0xa750('0x91')][_0xa750('0x56')](_0x1996c5)['then'](handleEntityNotFound(_0x1dd159,null))[_0xa750('0x21')](respondWithResult(_0x1dd159,null))['catch'](handleError(_0x1dd159,null));};exports['create']=function(_0x2f7ae4,_0x2b5ea9){return db[_0xa750('0x91')][_0xa750('0xaa')](_0x2f7ae4[_0xa750('0x68')],{})[_0xa750('0x21')](respondWithResult(_0x2b5ea9,0xc9))['catch'](handleError(_0x2b5ea9,null));};exports[_0xa750('0xab')]=function(_0x277ba5,_0x1f1d80){if(_0x277ba5['body']['id']){delete _0x277ba5[_0xa750('0x68')]['id'];}return db[_0xa750('0x91')][_0xa750('0x56')]({'where':{'id':_0x277ba5[_0xa750('0xa7')]['id']}})[_0xa750('0x21')](handleEntityNotFound(_0x1f1d80,null))['then'](saveUpdates(_0x277ba5[_0xa750('0x68')],null))[_0xa750('0x21')](respondWithResult(_0x1f1d80,null))[_0xa750('0x2c')](handleError(_0x1f1d80,null));};exports['destroy']=function(_0x483287,_0x2c90f){return db[_0xa750('0x91')][_0xa750('0x56')]({'where':{'id':_0x483287['params']['id']}})[_0xa750('0x21')](handleEntityNotFound(_0x2c90f,null))['then'](removeEntity(_0x2c90f,null))[_0xa750('0x2c')](handleError(_0x2c90f,null));};exports['describe']=function(_0x19930a,_0x2bd42e){return db[_0xa750('0x91')]['describe']()[_0xa750('0x21')](respondWithResult(_0x2bd42e,null))[_0xa750('0x2c')](handleError(_0x2bd42e,null));};exports[_0xa750('0xac')]=function(_0x3f398a,_0x460335,_0x5e8da7){return db['SmsMessage'][_0xa750('0x56')]({'where':{'id':_0x3f398a[_0xa750('0xa7')]['id']}})[_0xa750('0x21')](handleEntityNotFound(_0x460335,null))['then'](function(_0x4597fc){if(_0x4597fc){return _0x4597fc[_0xa750('0xac')](_0x3f398a[_0xa750('0x68')]['ids'],_[_0xa750('0xad')](_0x3f398a[_0xa750('0x68')],[_0xa750('0xae'),'id'])||{});}})[_0xa750('0x21')](respondWithResult(_0x460335,null))[_0xa750('0x2c')](handleError(_0x460335,null));};exports[_0xa750('0xaf')]=function(_0x41b89,_0x349780,_0x2109ca){var _0x2cb562={'raw':![],'where':{}};var _0x226b38={};var _0x2ef536={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xa750('0xb0')]({'where':{'id':_0x41b89[_0xa750('0xa7')]['id']}})['then'](handleEntityNotFound(_0x349780,null))['then'](function(_0x1f1bf9){if(_0x1f1bf9){_0x226b38[_0xa750('0x30')]=_[_0xa750('0x32')](db[_0xa750('0xb1')]['rawAttributes']);_0x226b38[_0xa750('0x31')]=_['keys'](_0x41b89['query']);_0x226b38['filters']=_[_0xa750('0x33')](_0x226b38['model'],_0x226b38[_0xa750('0x31')]);_0x2cb562['attributes']=_[_0xa750('0x33')](_0x226b38['model'],qs[_0xa750('0x34')](_0x41b89[_0xa750('0x31')]['fields']));_0x2cb562[_0xa750('0x35')]=_0x2cb562[_0xa750('0x35')][_0xa750('0x36')]?_0x2cb562[_0xa750('0x35')]:_0x226b38['model'];if(!_0x41b89[_0xa750('0x31')][_0xa750('0x37')](_0xa750('0x38'))){_0x2cb562[_0xa750('0x39')]=qs['limit'](_0x41b89[_0xa750('0x31')]['limit']);_0x2cb562[_0xa750('0x1c')]=qs[_0xa750('0x1c')](_0x41b89[_0xa750('0x31')]['offset']);}_0x2cb562[_0xa750('0x3a')]=qs[_0xa750('0xb2')](_0x41b89[_0xa750('0x31')][_0xa750('0xb2')]);_0x2cb562[_0xa750('0x3b')]=qs[_0xa750('0x3d')](_[_0xa750('0x3c')](_0x41b89[_0xa750('0x31')],_0x226b38[_0xa750('0x3d')]));_0x2cb562[_0xa750('0x3b')][_0xa750('0xa4')]=_0x1f1bf9['id'];if(_0x41b89[_0xa750('0x31')]['filter']){_0x2cb562['where']=_[_0xa750('0x90')](_0x2cb562[_0xa750('0x3b')],{'$or':_[_0xa750('0x25')](_0x2cb562['attributes'],function(_0x159a83){var _0x5e82b5={};_0x5e82b5[_0x159a83]={'$like':'%'+_0x41b89[_0xa750('0x31')][_0xa750('0x79')]+'%'};return _0x5e82b5;})});}if(_0x41b89[_0xa750('0x31')][_0xa750('0x70')]){var _0xa1b365=_0x41b89['query'][_0xa750('0x70')][_0xa750('0x29')](',');var _0x1b918d={};_0x1b918d[_0xa1b365[0x0]]={'$gte':moment(_0xa1b365[0x1])[_0xa750('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2cb562[_0xa750('0x3b')]=_[_0xa750('0x90')](_0x2cb562['where'],_0x1b918d);}_0x2cb562=_[_0xa750('0x90')]({},_0x2cb562,_0x41b89[_0xa750('0xa9')]);return db[_0xa750('0xb1')][_0xa750('0x8e')]({'where':_0x2cb562[_0xa750('0x3b')]})[_0xa750('0x21')](function(_0x4e4c0b){_0x2ef536[_0xa750('0x8e')]=_0x4e4c0b;if(_0x41b89[_0xa750('0x31')][_0xa750('0xa8')]){_0x2cb562[_0xa750('0xb4')]=[{'all':!![]}];}return db[_0xa750('0xb1')]['findAll'](_0x2cb562);})[_0xa750('0x21')](function(_0x5d5753){_0x2ef536[_0xa750('0xa5')]=_0x5d5753;return _0x2ef536;});}})[_0xa750('0x21')](respondWithFilteredResult(_0x349780,_0x2cb562))['catch'](handleError(_0x349780,null));};exports[_0xa750('0xb5')]=function(_0x1b958,_0x26954c,_0x298df1){return db['SmsInteraction'][_0xa750('0x56')]({'where':{'id':_0x1b958[_0xa750('0xa7')]['id']}})['then'](handleEntityNotFound(_0x26954c,null))[_0xa750('0x21')](function(_0x45c579){if(_0x45c579){return _0x45c579[_0xa750('0xb6')](_0x1b958[_0xa750('0x68')]['ids'],_[_0xa750('0xad')](_0x1b958[_0xa750('0x68')],[_0xa750('0xae'),'id'])||{})[_0xa750('0xb7')](function(){return db[_0xa750('0x60')][_0xa750('0xb8')]({'attributes':['id','name','color'],'where':{'id':_0x1b958[_0xa750('0x68')]['ids']}});})[_0xa750('0x21')](function(_0x472f22){socket['emit'](_0xa750('0xb9'),{'id':Number(_0x1b958[_0xa750('0xa7')]['id']),'tags':_0x472f22||[]});return{'id':Number(_0x1b958['params']['id']),'tags':_0x472f22||[]};});}})[_0xa750('0x21')](respondWithResult(_0x26954c,null))[_0xa750('0x2c')](handleError(_0x26954c,null));};exports[_0xa750('0xba')]=function(_0x115541,_0x3734f8,_0x3d92d3){return db['SmsInteraction'][_0xa750('0x56')]({'where':{'id':_0x115541[_0xa750('0xa7')]['id']}})['then'](handleEntityNotFound(_0x3734f8,null))[_0xa750('0x21')](function(_0x4b1794){if(_0x4b1794){return _0x4b1794[_0xa750('0xba')](_0x115541['query'][_0xa750('0xae')]);}})[_0xa750('0x21')](respondWithStatusCode(_0x3734f8,null))[_0xa750('0x2c')](handleError(_0x3734f8,null));};exports['download']=function(_0x221948,_0x2e2c0b){var _0x3f16b8=moment()[_0xa750('0xbb')]()[_0xa750('0x8d')]();var _0x556850=path[_0xa750('0xbc')](config[_0xa750('0xbd')],_0xa750('0xbe'),'files',_0xa750('0xbf'));var _0x133f71=path[_0xa750('0xbc')](config[_0xa750('0xbd')],_0xa750('0xbe'),_0xa750('0xc0'),'attachments');var _0x1d901a=path[_0xa750('0xbc')](_0x556850,_0x3f16b8);var _0x3982dc=util[_0xa750('0xb3')](_0xa750('0xc1'),_0x221948[_0xa750('0xa7')]['id'],_0x3f16b8);var _0x10389f=path[_0xa750('0xbc')](_0x556850,_0x3982dc);var _0x178dd2=[];_0x178dd2[_0xa750('0x2b')]({'model':db['User'],'as':_0xa750('0x62'),'attributes':['id','fullname'],'raw':!![]});_0x178dd2[_0xa750('0x2b')]({'model':db[_0xa750('0xc2')],'as':_0xa750('0xc3'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x57d2a=[{'model':db[_0xa750('0xb1')],'as':'Messages','attributes':['id',_0xa750('0x68'),'createdAt','direction',_0xa750('0xc4'),_0xa750('0x75')],'include':_0x178dd2}];_0x57d2a[_0xa750('0x2b')]({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0xa750('0x24')]});_0x57d2a[_0xa750('0x2b')]({'model':db[_0xa750('0x62')],'as':_0xa750('0xc5'),'attributes':['id',_0xa750('0x26')]});return db[_0xa750('0x91')][_0xa750('0x56')]({'where':{'id':_0x221948[_0xa750('0xa7')]['id']},'include':_0x57d2a})[_0xa750('0x21')](handleEntityNotFound(_0x2e2c0b,null))[_0xa750('0x21')](function(_0x52c65d){if(_0x52c65d){var _0x3298c7=_0x52c65d[_0xa750('0xc6')]({'plain':!![]});fs[_0xa750('0xc7')](_0x1d901a);var _0x11d42b={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0xa750('0xc8')}},'footer':{'height':_0xa750('0xc9'),'contents':{'default':util['format'](_0xa750('0xca'),util['format'](_0xa750('0xcb'),_0xa750('0xcc'),_0x3298c7['id']),moment()[_0xa750('0xb3')](_0xa750('0xcd'))['toString']())}}};var _0x28591b={'channel':_0xa750('0xcc'),'account':_0x3298c7[_0xa750('0xce')]['name'],'agent':_0x3298c7[_0xa750('0xc5')]?_0x3298c7[_0xa750('0xc5')]['fullname']:_0xa750('0xcf'),'createdAt':moment(_0x3298c7[_0xa750('0x6e')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x3298c7[_0xa750('0xd0')]?moment(_0x3298c7[_0xa750('0xd1')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xa750('0x8d')]():'','disposition':_0x3298c7[_0xa750('0xd2')],'messages':_(_0x3298c7[_0xa750('0xd3')])[_0xa750('0x79')]({'secret':![]})[_0xa750('0x25')](function(_0x233566){return{'date':moment(_0x233566[_0xa750('0x6e')])[_0xa750('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x233566[_0xa750('0xd4')]===_0xa750('0xd5')?_0x233566[_0xa750('0x62')]?_0x233566[_0xa750('0x62')][_0xa750('0x26')]:_0xa750('0xd6'):_0x233566[_0xa750('0xc3')][_0xa750('0xd7')]+(_0x233566[_0xa750('0xc3')][_0xa750('0xd8')]?'\x20'+_0x233566[_0xa750('0xc3')][_0xa750('0xd8')]:''),'body':_0x233566[_0xa750('0x68')],'direction':_0x233566['direction']===_0xa750('0xd5')?'A':'C','secret':_0x233566[_0xa750('0xc4')],'read':_0x233566[_0xa750('0x75')]};})[_0xa750('0x58')]()};return ejs[_0xa750('0xd9')](path[_0xa750('0xbc')](config[_0xa750('0xbd')],_0xa750('0xbe'),_0xa750('0xda'),_0xa750('0xdb')),{'interaction':_0x28591b})[_0xa750('0x21')](function(_0xa00e83){return new BPromise(function(_0xedbd5,_0x210f74){pdf[_0xa750('0xaa')](_0xa00e83,_0x11d42b)[_0xa750('0xdc')](path[_0xa750('0xbc')](_0x1d901a,_0xa750('0xdd')+_0x3298c7['id']+'-'+_0x3f16b8+_0xa750('0xde')),function(_0x4b70c1,_0x1ffc25){if(_0x4b70c1)return _0x210f74(_0x4b70c1);_0xedbd5(_0x1ffc25);});});})[_0xa750('0x21')](function(){return new BPromise(function(_0x4759f0,_0x213b80){zipdir(_0x1d901a,{'saveTo':_0x10389f},function(_0x823beb,_0x2da0da){if(_0x823beb)return _0x213b80(_0x823beb);return _0x4759f0(_0x2da0da);});})['then'](function(){return new BPromise(function(_0x19a1b9,_0x1e8fff){rimraf(_0x1d901a,function(_0x182352){if(_0x182352)_0x1e8fff(_0x182352);return _0x19a1b9();});});})[_0xa750('0x21')](function(){return _0x2e2c0b[_0xa750('0xdf')](_0x10389f,_0x3982dc,function(_0x21cb6b){if(_0x21cb6b){console[_0xa750('0xe0')]('err',_0x21cb6b);}else{fs[_0xa750('0xe1')](_0x10389f);}});});});}else{return _0x2e2c0b[_0xa750('0x22')](0xc8);}})[_0xa750('0x2c')](handleError(_0x2e2c0b,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index ed114f0..5c60e05 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 _0xe198=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','then'];(function(_0xa7e635,_0x1d8196){var _0xf7d998=function(_0x4529c7){while(--_0x4529c7){_0xa7e635['push'](_0xa7e635['shift']());}};_0xf7d998(++_0x1d8196);}(_0xe198,0x6f));var _0x8e19=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xe198[_0x16b9ed];return _0x66b1f8;};'use strict';var EventEmitter=require(_0x8e19('0x0'));var SmsInteraction=require(_0x8e19('0x1'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0x8e19('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x8e19('0x3')](0x0);var events={'afterCreate':_0x8e19('0x4'),'afterUpdate':_0x8e19('0x5'),'afterDestroy':_0x8e19('0x6')};function emitEvent(_0x4e3f58){return function(_0x23383d,_0x2f94a8,_0x2fb138){_0x23383d[_0x8e19('0x7')]({'attributes':['id'],'raw':!![]})[_0x8e19('0x8')](function(_0x4db35e){_0x23383d[_0x8e19('0x9')](_0x8e19('0xa'),_0x4db35e[_0x8e19('0xb')](function(_0x1646d4){return{'id':_0x1646d4['id']};}));return SmsMessage[_0x8e19('0xc')]({'where':{'SmsInteractionId':_0x23383d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8e19('0x8')](function(_0x375054){_0x23383d['setDataValue'](_0x8e19('0xd'),_0x375054[_0x8e19('0xe')]);SmsInteractionEvents[_0x8e19('0xf')](_0x4e3f58+':'+_0x23383d['id'],_0x23383d);SmsInteractionEvents[_0x8e19('0xf')](_0x4e3f58,_0x23383d);_0x2fb138(null);})[_0x8e19('0x10')](_0x2fb138(null));};}for(var e in events){if(events[_0x8e19('0x11')](e)){var event=events[e];SmsInteraction[_0x8e19('0x12')](e,emitEvent(event));}}module[_0x8e19('0x13')]=SmsInteractionEvents; \ No newline at end of file +var _0x6c32=['setDataValue','Users','map','findAll','unreadMessages','length','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','then'];(function(_0x53d492,_0x1cc6ad){var _0x4fca24=function(_0x48c254){while(--_0x48c254){_0x53d492['push'](_0x53d492['shift']());}};_0x4fca24(++_0x1cc6ad);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x26c3('0x0'));var SmsInteraction=require(_0x26c3('0x1'))['db'][_0x26c3('0x2')];var SmsMessage=require(_0x26c3('0x1'))['db'][_0x26c3('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x26c3('0x4')](0x0);var events={'afterCreate':_0x26c3('0x5'),'afterUpdate':_0x26c3('0x6'),'afterDestroy':_0x26c3('0x7')};function emitEvent(_0x49d4a1){return function(_0x2bd400,_0x3f7065,_0x15ac36){_0x2bd400['getUsers']({'attributes':['id'],'raw':!![]})[_0x26c3('0x8')](function(_0x5b3a5f){_0x2bd400[_0x26c3('0x9')](_0x26c3('0xa'),_0x5b3a5f[_0x26c3('0xb')](function(_0x1bf208){return{'id':_0x1bf208['id']};}));return SmsMessage[_0x26c3('0xc')]({'where':{'SmsInteractionId':_0x2bd400['id'],'direction':'in','read':![]},'raw':!![]});})[_0x26c3('0x8')](function(_0x155187){_0x2bd400[_0x26c3('0x9')](_0x26c3('0xd'),_0x155187[_0x26c3('0xe')]);SmsInteractionEvents['emit'](_0x49d4a1+':'+_0x2bd400['id'],_0x2bd400);SmsInteractionEvents['emit'](_0x49d4a1,_0x2bd400);_0x15ac36(null);})['catch'](_0x15ac36(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x26c3('0xf')](e,emitEvent(event));}}module[_0x26c3('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 718cba1..7c9b3a8 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 _0x9b83=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9b83,0x190));var _0x39b8=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x9b83[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x39b8('0x0'));var util=require(_0x39b8('0x1'));var logger=require(_0x39b8('0x2'))('api');var moment=require(_0x39b8('0x3'));var BPromise=require('bluebird');var rp=require(_0x39b8('0x4'));var fs=require('fs');var path=require(_0x39b8('0x5'));var rimraf=require(_0x39b8('0x6'));var config=require('../../config/environment');var attributes=require(_0x39b8('0x7'));module[_0x39b8('0x8')]=function(_0x46faa5,_0x2b7106){return _0x46faa5[_0x39b8('0x9')](_0x39b8('0xa'),attributes,{'tableName':_0x39b8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e0345,_0x4604fc,_0x527691){if(_0x4e0345[_0x39b8('0xc')](_0x39b8('0xd'))){_0x4e0345[_0x39b8('0xe')]=moment()['format'](_0x39b8('0xf'));}_0x527691(null,_0x4e0345);}}});}; \ No newline at end of file +var _0x5305=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','lodash','util','../../config/logger'];(function(_0x409fb8,_0x5ab3d3){var _0x278270=function(_0x58849c){while(--_0x58849c){_0x409fb8['push'](_0x409fb8['shift']());}};_0x278270(++_0x5ab3d3);}(_0x5305,0x177));var _0x5530=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5305[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x5530('0x0'));var util=require(_0x5530('0x1'));var logger=require(_0x5530('0x2'))(_0x5530('0x3'));var moment=require(_0x5530('0x4'));var BPromise=require(_0x5530('0x5'));var rp=require(_0x5530('0x6'));var fs=require('fs');var path=require(_0x5530('0x7'));var rimraf=require(_0x5530('0x8'));var config=require(_0x5530('0x9'));var attributes=require(_0x5530('0xa'));module[_0x5530('0xb')]=function(_0x4af4ab,_0x393189){return _0x4af4ab[_0x5530('0xc')](_0x5530('0xd'),attributes,{'tableName':_0x5530('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x362880,_0x12e6f1,_0x76ab3c){if(_0x362880[_0x5530('0xf')](_0x5530('0x10'))){_0x362880[_0x5530('0x11')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x76ab3c(null,_0x362880);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 6f3bc67..f866a47 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 _0x9d0d=['info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','body','options','raw','attributes','limit','UpdateSmsInteraction','SmsInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9d0d,0xc6));var _0xd9d0=function(_0x40c4fd,_0x83d7e3){_0x40c4fd=_0x40c4fd-0x0;var _0x4e6111=_0x9d0d[_0x40c4fd];return _0x4e6111;};'use strict';var _=require(_0xd9d0('0x0'));var util=require(_0xd9d0('0x1'));var moment=require('moment');var BPromise=require(_0xd9d0('0x2'));var rs=require(_0xd9d0('0x3'));var fs=require('fs');var Redis=require(_0xd9d0('0x4'));var db=require(_0xd9d0('0x5'))['db'];var utils=require(_0xd9d0('0x6'));var logger=require('../../config/logger')(_0xd9d0('0x7'));var config=require('../../config/environment');var jayson=require(_0xd9d0('0x8'));var client=jayson[_0xd9d0('0x9')][_0xd9d0('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd9d0('0xb')],{'host':_0xd9d0('0xc'),'port':0x18eb});var socket=require(_0xd9d0('0xd'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0xd9d0('0xe')](socket);function respondWithRpcPromise(_0x433c92,_0x59031a,_0x3b2326){return new BPromise(function(_0x2f2d66,_0x52f775){return client[_0xd9d0('0xf')](_0x433c92,_0x3b2326)[_0xd9d0('0x10')](function(_0x29600b){logger[_0xd9d0('0x11')](_0xd9d0('0x12'),_0x59031a,_0xd9d0('0x13'));logger[_0xd9d0('0x14')](_0xd9d0('0x15'),_0x59031a,'request\x20sent',JSON[_0xd9d0('0x16')](_0x29600b));if(_0x29600b['error']){if(_0x29600b[_0xd9d0('0x17')][_0xd9d0('0x18')]===0x1f4){logger[_0xd9d0('0x17')](_0xd9d0('0x12'),_0x59031a,_0x29600b[_0xd9d0('0x17')]['message']);return _0x52f775(_0x29600b[_0xd9d0('0x17')][_0xd9d0('0x19')]);}logger['error'](_0xd9d0('0x12'),_0x59031a,_0x29600b[_0xd9d0('0x17')][_0xd9d0('0x19')]);return _0x2f2d66(_0x29600b[_0xd9d0('0x17')][_0xd9d0('0x19')]);}else{logger['info'](_0xd9d0('0x12'),_0x59031a,'request\x20sent');_0x2f2d66(_0x29600b[_0xd9d0('0x1a')][_0xd9d0('0x19')]);}})[_0xd9d0('0x1b')](function(_0x1f50ee){logger['error'](_0xd9d0('0x12'),_0x59031a,_0x1f50ee);_0x52f775(_0x1f50ee);});});}exports['UpdateSmsInteraction']=function(_0xfd9aa8){var _0x1e2bb0=this;return new Promise(function(_0x1738b6,_0x2a4d51){return db['SmsInteraction'][_0xd9d0('0x1c')](_0xfd9aa8[_0xd9d0('0x1d')],{'raw':_0xfd9aa8[_0xd9d0('0x1e')]?_0xfd9aa8[_0xd9d0('0x1e')][_0xd9d0('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfd9aa8['options']?_0xfd9aa8['options']['where']||null:null,'attributes':_0xfd9aa8['options']?_0xfd9aa8[_0xd9d0('0x1e')][_0xd9d0('0x20')]||null:null,'limit':_0xfd9aa8['options']?_0xfd9aa8[_0xd9d0('0x1e')][_0xd9d0('0x21')]||null:null})[_0xd9d0('0x10')](function(_0x5d4a5d){logger[_0xd9d0('0x11')]('UpdateSmsInteraction',_0xfd9aa8);logger['debug']('UpdateSmsInteraction',_0xfd9aa8,JSON[_0xd9d0('0x16')](_0x5d4a5d));_0x1738b6(_0x5d4a5d);})[_0xd9d0('0x1b')](function(_0x5e262e){logger[_0xd9d0('0x17')](_0xd9d0('0x22'),_0x5e262e[_0xd9d0('0x19')],_0xfd9aa8);_0x2a4d51(_0x1e2bb0['error'](0x1f4,_0x5e262e[_0xd9d0('0x19')]));});});};exports['AddTagsToSmsInteraction']=function(_0x48d043){return new Promise(function(_0x5dd1b8,_0x3d3afa){return db[_0xd9d0('0x23')][_0xd9d0('0x24')]({'where':_0x48d043[_0xd9d0('0x1e')]?_0x48d043[_0xd9d0('0x1e')][_0xd9d0('0x25')]||null:null})[_0xd9d0('0x10')](function(_0x4e08f8){if(_0x4e08f8){return _0x4e08f8[_0xd9d0('0x26')](_0x48d043[_0xd9d0('0x1d')][_0xd9d0('0x27')],_[_0xd9d0('0x28')](_0x48d043[_0xd9d0('0x1d')],[_0xd9d0('0x27'),'id'])||{});}})[_0xd9d0('0x29')](function(_0x572a47){logger['info'](_0xd9d0('0x2a'),_0x48d043);logger[_0xd9d0('0x14')]('AddTags',_0x48d043,JSON[_0xd9d0('0x16')](_0x572a47));_0x5dd1b8(_0x572a47);})['catch'](function(_0x5dfe92){logger[_0xd9d0('0x17')](_0xd9d0('0x2a'),_0x5dfe92['message'],_0x48d043);_0x3d3afa(_this[_0xd9d0('0x17')](0x1f4,_0x5dfe92['message']));});});}; \ No newline at end of file +var _0x953e=['debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','info','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','then','request\x20sent'];(function(_0xb5c181,_0x8a9337){var _0x24ef84=function(_0x4fb0d1){while(--_0x4fb0d1){_0xb5c181['push'](_0xb5c181['shift']());}};_0x24ef84(++_0x8a9337);}(_0x953e,0x16f));var _0xe953=function(_0x449bc9,_0x3ded7b){_0x449bc9=_0x449bc9-0x0;var _0x4f9370=_0x953e[_0x449bc9];return _0x4f9370;};'use strict';var _=require('lodash');var util=require(_0xe953('0x0'));var moment=require(_0xe953('0x1'));var BPromise=require(_0xe953('0x2'));var rs=require(_0xe953('0x3'));var fs=require('fs');var Redis=require(_0xe953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe953('0x5'));var logger=require(_0xe953('0x6'))(_0xe953('0x7'));var config=require(_0xe953('0x8'));var jayson=require(_0xe953('0x9'));var client=jayson[_0xe953('0xa')][_0xe953('0xb')]({'port':0x232a});config[_0xe953('0xc')]=_[_0xe953('0xd')](config[_0xe953('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe953('0xe'))(new Redis(config[_0xe953('0xc')]));require(_0xe953('0xf'))[_0xe953('0x10')](socket);function respondWithRpcPromise(_0x56bb97,_0x4b94b9,_0x177f0a){return new BPromise(function(_0x32b171,_0x506b3a){return client[_0xe953('0x11')](_0x56bb97,_0x177f0a)[_0xe953('0x12')](function(_0x4d5c07){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x4b94b9,_0xe953('0x13'));logger[_0xe953('0x14')](_0xe953('0x15'),_0x4b94b9,'request\x20sent',JSON[_0xe953('0x16')](_0x4d5c07));if(_0x4d5c07[_0xe953('0x17')]){if(_0x4d5c07[_0xe953('0x17')][_0xe953('0x18')]===0x1f4){logger[_0xe953('0x17')](_0xe953('0x19'),_0x4b94b9,_0x4d5c07['error'][_0xe953('0x1a')]);return _0x506b3a(_0x4d5c07['error'][_0xe953('0x1a')]);}logger[_0xe953('0x17')](_0xe953('0x19'),_0x4b94b9,_0x4d5c07[_0xe953('0x17')]['message']);return _0x32b171(_0x4d5c07['error'][_0xe953('0x1a')]);}else{logger[_0xe953('0x1b')](_0xe953('0x19'),_0x4b94b9,'request\x20sent');_0x32b171(_0x4d5c07['result'][_0xe953('0x1a')]);}})[_0xe953('0x1c')](function(_0x25796c){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x4b94b9,_0x25796c);_0x506b3a(_0x25796c);});});}exports[_0xe953('0x1d')]=function(_0x270b09){var _0x5923c2=this;return new Promise(function(_0x2eb097,_0x43e523){return db[_0xe953('0x1e')]['update'](_0x270b09[_0xe953('0x1f')],{'raw':_0x270b09[_0xe953('0x20')]?_0x270b09[_0xe953('0x20')][_0xe953('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x270b09[_0xe953('0x20')]?_0x270b09[_0xe953('0x20')][_0xe953('0x22')]||null:null,'attributes':_0x270b09[_0xe953('0x20')]?_0x270b09[_0xe953('0x20')][_0xe953('0x23')]||null:null,'limit':_0x270b09[_0xe953('0x20')]?_0x270b09[_0xe953('0x20')][_0xe953('0x24')]||null:null})[_0xe953('0x12')](function(_0x5cf774){logger['info'](_0xe953('0x1d'),_0x270b09);logger[_0xe953('0x14')](_0xe953('0x1d'),_0x270b09,JSON[_0xe953('0x16')](_0x5cf774));_0x2eb097(_0x5cf774);})[_0xe953('0x1c')](function(_0x28f9fa){logger[_0xe953('0x17')]('UpdateSmsInteraction',_0x28f9fa['message'],_0x270b09);_0x43e523(_0x5923c2[_0xe953('0x17')](0x1f4,_0x28f9fa[_0xe953('0x1a')]));});});};exports[_0xe953('0x25')]=function(_0x1e7b8e){return new Promise(function(_0x4c4c62,_0x5d30ef){return db['SmsInteraction'][_0xe953('0x26')]({'where':_0x1e7b8e[_0xe953('0x20')]?_0x1e7b8e['options']['where']||null:null})[_0xe953('0x12')](function(_0x84195a){if(_0x84195a){return _0x84195a[_0xe953('0x27')](_0x1e7b8e[_0xe953('0x1f')][_0xe953('0x28')],_[_0xe953('0x29')](_0x1e7b8e[_0xe953('0x1f')],[_0xe953('0x28'),'id'])||{});}})['spread'](function(_0x3601da){logger[_0xe953('0x1b')](_0xe953('0x2a'),_0x1e7b8e);logger[_0xe953('0x14')](_0xe953('0x2a'),_0x1e7b8e,JSON[_0xe953('0x16')](_0x3601da));_0x4c4c62(_0x3601da);})[_0xe953('0x1c')](function(_0x4d7ad9){logger[_0xe953('0x17')](_0xe953('0x2a'),_0x4d7ad9['message'],_0x1e7b8e);_0x5d30ef(_this[_0xe953('0x17')](0x1f4,_0x4d7ad9['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index c570fa5..753756b 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 _0xbaf0=['removeListener','register','length','smsInteraction:','save','remove','update'];(function(_0x2ac261,_0x4cfb90){var _0x54d962=function(_0x105caf){while(--_0x105caf){_0x2ac261['push'](_0x2ac261['shift']());}};_0x54d962(++_0x4cfb90);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){SmsInteractionEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);SmsInteractionEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x15681c,_0x1de42e){var _0x1cddf6=function(_0x38a706){while(--_0x38a706){_0x15681c['push'](_0x15681c['shift']());}};_0x1cddf6(++_0x1de42e);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c4cae,_0x4f2faf){_0x3c4cae=_0x3c4cae-0x0;var _0x2011e7=_0xb10b[_0x3c4cae];return _0x2011e7;};'use strict';var SmsInteractionEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){SmsInteractionEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);SmsInteractionEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index ddf609b..afb9bdd 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 _0x8382=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','smsmessage:create','create','/:id/status','status','put','update','/:id/reject'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8382,0xb9));var _0x2838=function(_0x18aac9,_0x5024ca){_0x18aac9=_0x18aac9-0x0;var _0x5ac120=_0x8382[_0x18aac9];return _0x5ac120;};'use strict';var multer=require(_0x2838('0x0'));var util=require(_0x2838('0x1'));var path=require(_0x2838('0x2'));var timeout=require(_0x2838('0x3'));var express=require(_0x2838('0x4'));var router=express[_0x2838('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2838('0x6'));var config=require('../../config/environment');var controller=require(_0x2838('0x7'));router['get']('/',auth[_0x2838('0x8')](),controller[_0x2838('0x9')]);router[_0x2838('0xa')](_0x2838('0xb'),auth[_0x2838('0x8')](),controller[_0x2838('0xc')]);router[_0x2838('0xa')](_0x2838('0xd'),auth[_0x2838('0x8')](),controller[_0x2838('0xe')]);router[_0x2838('0xf')]('/',auth[_0x2838('0x8')](),interaction['tracked']('sms',_0x2838('0x10')),controller[_0x2838('0x11')]);router[_0x2838('0xf')](_0x2838('0x12'),controller[_0x2838('0x13')]);router[_0x2838('0x14')](_0x2838('0xd'),auth[_0x2838('0x8')](),controller[_0x2838('0x15')]);router[_0x2838('0x14')]('/:id/accept',auth[_0x2838('0x8')](),controller['accept']);router[_0x2838('0x14')](_0x2838('0x16'),auth[_0x2838('0x8')](),controller['reject']);router[_0x2838('0x17')](_0x2838('0xd'),auth[_0x2838('0x8')](),controller[_0x2838('0x18')]);module[_0x2838('0x19')]=router; \ No newline at end of file +var _0x9f66=['status','put','/:id','update','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post','tracked','sms','create','/:id/status'];(function(_0x478642,_0x2a20ae){var _0xe9840f=function(_0xa58f6d){while(--_0xa58f6d){_0x478642['push'](_0x478642['shift']());}};_0xe9840f(++_0x2a20ae);}(_0x9f66,0xfc));var _0x69f6=function(_0x5cdf5d,_0x616e66){_0x5cdf5d=_0x5cdf5d-0x0;var _0x2b947a=_0x9f66[_0x5cdf5d];return _0x2b947a;};'use strict';var multer=require(_0x69f6('0x0'));var util=require(_0x69f6('0x1'));var path=require(_0x69f6('0x2'));var timeout=require(_0x69f6('0x3'));var express=require(_0x69f6('0x4'));var router=express[_0x69f6('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x69f6('0x6'));var config=require(_0x69f6('0x7'));var controller=require('./smsMessage.controller');router[_0x69f6('0x8')]('/',auth[_0x69f6('0x9')](),controller[_0x69f6('0xa')]);router[_0x69f6('0x8')](_0x69f6('0xb'),auth[_0x69f6('0x9')](),controller[_0x69f6('0xc')]);router[_0x69f6('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x69f6('0xd')]('/',auth['isAuthenticated'](),interaction[_0x69f6('0xe')](_0x69f6('0xf'),'smsmessage:create'),controller[_0x69f6('0x10')]);router['post'](_0x69f6('0x11'),controller[_0x69f6('0x12')]);router[_0x69f6('0x13')](_0x69f6('0x14'),auth[_0x69f6('0x9')](),controller[_0x69f6('0x15')]);router[_0x69f6('0x13')]('/:id/accept',auth[_0x69f6('0x9')](),controller['accept']);router[_0x69f6('0x13')](_0x69f6('0x16'),auth[_0x69f6('0x9')](),controller[_0x69f6('0x17')]);router[_0x69f6('0x18')](_0x69f6('0x14'),auth[_0x69f6('0x9')](),controller[_0x69f6('0x19')]);module[_0x69f6('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index d7bb0df..88605b2 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 _0x502a=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x502a,0x1df));var _0xa502=function(_0x537abe,_0x4c2c0c){_0x537abe=_0x537abe-0x0;var _0x340117=_0x502a[_0x537abe];return _0x340117;};'use strict';var Sequelize=require('sequelize');module[_0xa502('0x0')]={'body':{'type':Sequelize[_0xa502('0x1')](_0xa502('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa502('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa502('0x4')]('in',_0xa502('0x5')),'defaultValue':_0xa502('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa502('0x6')](0xbe)},'phone':{'type':Sequelize[_0xa502('0x6')]},'readAt':{'type':Sequelize[_0xa502('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x688a=['TEXT','BOOLEAN','out','STRING','DATE','sequelize','exports'];(function(_0x608bde,_0x3b6620){var _0x36a795=function(_0x46b814){while(--_0x46b814){_0x608bde['push'](_0x608bde['shift']());}};_0x36a795(++_0x3b6620);}(_0x688a,0x124));var _0xa688=function(_0xcaa3f,_0x4f157c){_0xcaa3f=_0xcaa3f-0x0;var _0x33693a=_0x688a[_0xcaa3f];return _0x33693a;};'use strict';var Sequelize=require(_0xa688('0x0'));module[_0xa688('0x1')]={'body':{'type':Sequelize[_0xa688('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa688('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa688('0x4')),'defaultValue':_0xa688('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xa688('0x5')]},'readAt':{'type':Sequelize[_0xa688('0x6')]},'secret':{'type':Sequelize[_0xa688('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 4df9992..79ecc89 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 _0xbe31=['bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','client','http','ValidationError','request','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','end','status','json','count','set','Content-Range','apply','save','update','destroy','name','send','map','SmsMessage','rawAttributes','type','key','query','keys','model','attributes','intersection','length','hasOwnProperty','limit','offset','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','rows','show','params','fields','include','merge','find','create','body','describe','sms-interactions','sms','readAt','format','UserId','user','CmContact','Contact','get','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','manual','interface','event','accept','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','reject','EventManager','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','sent','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0xfecbdd,_0x15c8eb){var _0x3a36e0=function(_0x59fd21){while(--_0x59fd21){_0xfecbdd['push'](_0xfecbdd['shift']());}};_0x3a36e0(++_0x15c8eb);}(_0xbe31,0x83));var _0x1be3=function(_0x325dea,_0x513a46){_0x325dea=_0x325dea-0x0;var _0x5804db=_0xbe31[_0x325dea];return _0x5804db;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1be3('0x0'));var rimraf=require(_0x1be3('0x1'));var zipdir=require(_0x1be3('0x2'));var jsonpatch=require(_0x1be3('0x3'));var rp=require(_0x1be3('0x4'));var moment=require(_0x1be3('0x5'));var BPromise=require(_0x1be3('0x6'));var Mustache=require(_0x1be3('0x7'));var util=require(_0x1be3('0x8'));var path=require('path');var sox=require(_0x1be3('0x9'));var csv=require('to-csv');var ejs=require(_0x1be3('0xa'));var fs=require('fs');var _=require(_0x1be3('0xb'));var squel=require(_0x1be3('0xc'));var crypto=require(_0x1be3('0xd'));var jsforce=require(_0x1be3('0xe'));var deskjs=require(_0x1be3('0xf'));var toCsv=require(_0x1be3('0x10'));var querystring=require(_0x1be3('0x11'));var Papa=require(_0x1be3('0x12'));var Redis=require(_0x1be3('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1be3('0x14'));var as=require(_0x1be3('0x15'));var hardwareService=require(_0x1be3('0x16'));var logger=require(_0x1be3('0x17'))(_0x1be3('0x18'));var utils=require(_0x1be3('0x19'));var config=require(_0x1be3('0x1a'));var db=require(_0x1be3('0x1b'))['db'];config[_0x1be3('0x1c')]=_['defaults'](config[_0x1be3('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x1be3('0x1d'))(new Redis(config[_0x1be3('0x1c')]));require('./smsMessage.socket')[_0x1be3('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1be3('0x1f')][_0x1be3('0x20')]({'port':0x232c});var client9002=jayson[_0x1be3('0x1f')][_0x1be3('0x20')]({'port':0x232a});function checkPasswordPattern(_0x1156bc,_0x269ac3,_0x567919){if(_0x567919){var _0x53a9d7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x53a9d7['test'](_0x269ac3)){return _0x1156bc;}else{throw new db['Sequelize'][(_0x1be3('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1156bc;}}function respondWithRpcPromise(_0x31754b,_0x6b7edf,_0xaa1d7b,_0x1d0c2b){return new BPromise(function(_0x21668a,_0x298e44){var _0x400035=_0x1d0c2b||client;return _0x400035[_0x1be3('0x22')](_0x31754b,_0xaa1d7b)[_0x1be3('0x23')](function(_0x118b5a){logger[_0x1be3('0x24')](_0x1be3('0x25'),_0x6b7edf,'request\x20sent');logger['debug'](_0x1be3('0x26'),_0x6b7edf,'request\x20sent',JSON[_0x1be3('0x27')](_0x118b5a));if(_0x118b5a[_0x1be3('0x28')]){if(_0x118b5a[_0x1be3('0x28')][_0x1be3('0x29')]===0x1f4){logger[_0x1be3('0x28')](_0x1be3('0x25'),_0x6b7edf,_0x118b5a[_0x1be3('0x28')]['message']);return _0x298e44(_0x118b5a[_0x1be3('0x28')]['message']);}logger[_0x1be3('0x28')](_0x1be3('0x25'),_0x6b7edf,_0x118b5a['error'][_0x1be3('0x2a')]);return _0x21668a(_0x118b5a['error'][_0x1be3('0x2a')]);}else{logger[_0x1be3('0x24')](_0x1be3('0x25'),_0x6b7edf,_0x1be3('0x2b'));_0x21668a(_0x118b5a['result'][_0x1be3('0x2a')]);}})[_0x1be3('0x2c')](function(_0x4c22df){logger[_0x1be3('0x28')](_0x1be3('0x25'),_0x6b7edf,_0x4c22df);_0x298e44(_0x4c22df);});});}function respondWithStatusCode(_0x44da09,_0x200c53){_0x200c53=_0x200c53||0xcc;return function(_0x2ddac8){if(_0x2ddac8){return _0x44da09[_0x1be3('0x2d')](_0x200c53);}return _0x44da09['status'](_0x200c53)[_0x1be3('0x2e')]();};}function respondWithResult(_0x49f0e0,_0x25ed26){_0x25ed26=_0x25ed26||0xc8;return function(_0x4be26f){if(_0x4be26f){return _0x49f0e0[_0x1be3('0x2f')](_0x25ed26)[_0x1be3('0x30')](_0x4be26f);}};}function respondWithFilteredResult(_0x569e40,_0x5426aa){return function(_0x49f780){if(_0x49f780){var _0xf1b90=_0x49f780[_0x1be3('0x31')],_0x33eaa0=_0x5426aa['offset'],_0x274660=_0x5426aa['offset']+_0x5426aa['limit'],_0xc7fb9a;if(_0x274660>=_0xf1b90){_0x274660=_0xf1b90;_0xc7fb9a=0xc8;}else{_0xc7fb9a=0xce;}_0x569e40['status'](_0xc7fb9a);return _0x569e40[_0x1be3('0x32')](_0x1be3('0x33'),_0x33eaa0+'-'+_0x274660+'/'+_0xf1b90)[_0x1be3('0x30')](_0x49f780);}return null;};}function patchUpdates(_0x43bad7){return function(_0x3342af){try{jsonpatch[_0x1be3('0x34')](_0x3342af,_0x43bad7,!![]);}catch(_0x20dd33){return BPromise['reject'](_0x20dd33);}return _0x3342af[_0x1be3('0x35')]();};}function saveUpdates(_0x218f48,_0x3e70cd){return function(_0x42e24c){if(_0x42e24c){return _0x42e24c[_0x1be3('0x36')](_0x218f48)[_0x1be3('0x23')](function(_0x3bfe40){return _0x3bfe40;});}return null;};}function removeEntity(_0x514b9f,_0xd7a1d5){return function(_0x2c47ab){if(_0x2c47ab){return _0x2c47ab[_0x1be3('0x37')]()['then'](function(){_0x514b9f['status'](0xcc)[_0x1be3('0x2e')]();});}};}function handleEntityNotFound(_0x1a437d,_0x32ba37){return function(_0x521ff3){if(!_0x521ff3){_0x1a437d['sendStatus'](0x194);}return _0x521ff3;};}function handleError(_0x482fc8,_0x1ca534){_0x1ca534=_0x1ca534||0x1f4;return function(_0x33c19e){logger[_0x1be3('0x28')](_0x33c19e['stack']);if(_0x33c19e[_0x1be3('0x38')]){delete _0x33c19e['name'];}_0x482fc8[_0x1be3('0x2f')](_0x1ca534)[_0x1be3('0x39')](_0x33c19e);};}exports['index']=function(_0x7c6cc9,_0x16528e){var _0x41725b={},_0x17c56e={},_0x37448d={'count':0x0,'rows':[]};var _0x525ace=_[_0x1be3('0x3a')](db[_0x1be3('0x3b')][_0x1be3('0x3c')],function(_0x5bf0fc){return{'name':_0x5bf0fc['fieldName'],'type':_0x5bf0fc[_0x1be3('0x3d')][_0x1be3('0x3e')]};});_0x17c56e['model']=_[_0x1be3('0x3a')](_0x525ace,'name');_0x17c56e[_0x1be3('0x3f')]=_[_0x1be3('0x40')](_0x7c6cc9['query']);_0x17c56e['filters']=_['intersection'](_0x17c56e[_0x1be3('0x41')],_0x17c56e[_0x1be3('0x3f')]);_0x41725b[_0x1be3('0x42')]=_[_0x1be3('0x43')](_0x17c56e[_0x1be3('0x41')],qs['fields'](_0x7c6cc9[_0x1be3('0x3f')]['fields']));_0x41725b[_0x1be3('0x42')]=_0x41725b[_0x1be3('0x42')][_0x1be3('0x44')]?_0x41725b[_0x1be3('0x42')]:_0x17c56e[_0x1be3('0x41')];if(!_0x7c6cc9['query'][_0x1be3('0x45')]('nolimit')){_0x41725b[_0x1be3('0x46')]=qs[_0x1be3('0x46')](_0x7c6cc9[_0x1be3('0x3f')]['limit']);_0x41725b[_0x1be3('0x47')]=qs[_0x1be3('0x47')](_0x7c6cc9[_0x1be3('0x3f')][_0x1be3('0x47')]);}_0x41725b['order']=qs['sort'](_0x7c6cc9[_0x1be3('0x3f')][_0x1be3('0x48')]);_0x41725b[_0x1be3('0x49')]=qs[_0x1be3('0x4a')](_[_0x1be3('0x4b')](_0x7c6cc9['query'],_0x17c56e[_0x1be3('0x4a')]),_0x525ace);if(_0x7c6cc9['query'][_0x1be3('0x4c')]){_0x41725b[_0x1be3('0x49')]=_['merge'](_0x41725b['where'],{'$or':_[_0x1be3('0x3a')](_0x525ace,function(_0x51520d){if(_0x51520d['type']!==_0x1be3('0x4d')){var _0x377418={};_0x377418[_0x51520d[_0x1be3('0x38')]]={'$like':'%'+_0x7c6cc9[_0x1be3('0x3f')][_0x1be3('0x4c')]+'%'};return _0x377418;}})});}_0x41725b=_['merge']({},_0x41725b,_0x7c6cc9[_0x1be3('0x4e')]);var _0x6727fe={'where':_0x41725b[_0x1be3('0x49')]};return db['SmsMessage'][_0x1be3('0x31')](_0x6727fe)[_0x1be3('0x23')](function(_0x46b128){_0x37448d['count']=_0x46b128;if(_0x7c6cc9[_0x1be3('0x3f')][_0x1be3('0x4f')]){_0x41725b['include']=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x41725b);})['then'](function(_0x112b46){_0x37448d[_0x1be3('0x50')]=_0x112b46;return _0x37448d;})[_0x1be3('0x23')](respondWithFilteredResult(_0x16528e,_0x41725b))[_0x1be3('0x2c')](handleError(_0x16528e,null));};exports[_0x1be3('0x51')]=function(_0x392a61,_0x3db821){var _0xf52e56={'raw':!![],'where':{'id':_0x392a61[_0x1be3('0x52')]['id']}},_0x2f3ac4={};_0x2f3ac4['model']=_[_0x1be3('0x40')](db[_0x1be3('0x3b')][_0x1be3('0x3c')]);_0x2f3ac4[_0x1be3('0x3f')]=_[_0x1be3('0x40')](_0x392a61[_0x1be3('0x3f')]);_0x2f3ac4['filters']=_[_0x1be3('0x43')](_0x2f3ac4['model'],_0x2f3ac4[_0x1be3('0x3f')]);_0xf52e56[_0x1be3('0x42')]=_[_0x1be3('0x43')](_0x2f3ac4[_0x1be3('0x41')],qs['fields'](_0x392a61['query'][_0x1be3('0x53')]));_0xf52e56[_0x1be3('0x42')]=_0xf52e56[_0x1be3('0x42')][_0x1be3('0x44')]?_0xf52e56[_0x1be3('0x42')]:_0x2f3ac4['model'];if(_0x392a61[_0x1be3('0x3f')][_0x1be3('0x4f')]){_0xf52e56[_0x1be3('0x54')]=[{'all':!![]}];}_0xf52e56=_[_0x1be3('0x55')]({},_0xf52e56,_0x392a61[_0x1be3('0x4e')]);return db['SmsMessage'][_0x1be3('0x56')](_0xf52e56)['then'](handleEntityNotFound(_0x3db821,null))[_0x1be3('0x23')](respondWithResult(_0x3db821,null))[_0x1be3('0x2c')](handleError(_0x3db821,null));};exports[_0x1be3('0x57')]=function(_0x5e44a1,_0x48b2db){return db[_0x1be3('0x3b')][_0x1be3('0x57')](_0x5e44a1[_0x1be3('0x58')],{})['then'](respondWithResult(_0x48b2db,0xc9))[_0x1be3('0x2c')](handleError(_0x48b2db,null));};exports[_0x1be3('0x36')]=function(_0x551b95,_0x19c9b8){if(_0x551b95['body']['id']){delete _0x551b95[_0x1be3('0x58')]['id'];}return db[_0x1be3('0x3b')][_0x1be3('0x56')]({'where':{'id':_0x551b95[_0x1be3('0x52')]['id']}})[_0x1be3('0x23')](handleEntityNotFound(_0x19c9b8,null))[_0x1be3('0x23')](saveUpdates(_0x551b95[_0x1be3('0x58')],null))[_0x1be3('0x23')](respondWithResult(_0x19c9b8,null))[_0x1be3('0x2c')](handleError(_0x19c9b8,null));};exports[_0x1be3('0x37')]=function(_0x50206c,_0x2dfcbc){return db[_0x1be3('0x3b')][_0x1be3('0x56')]({'where':{'id':_0x50206c[_0x1be3('0x52')]['id']}})[_0x1be3('0x23')](handleEntityNotFound(_0x2dfcbc,null))[_0x1be3('0x23')](removeEntity(_0x2dfcbc,null))[_0x1be3('0x2c')](handleError(_0x2dfcbc,null));};exports[_0x1be3('0x59')]=function(_0x541509,_0x3219ba){return db[_0x1be3('0x3b')]['describe']()['then'](respondWithResult(_0x3219ba,null))[_0x1be3('0x2c')](handleError(_0x3219ba,null));};var interaction_log=require(_0x1be3('0x17'))(_0x1be3('0x5a'));exports['accept']=function(_0x1fe1a9,_0x793b4f,_0x522f96){var _0x33d7ac={'channel':_0x1be3('0x5b')};if(_0x1fe1a9[_0x1be3('0x58')]['id']){delete _0x1fe1a9[_0x1be3('0x58')]['id'];}_0x1fe1a9['body']['read']=!![];_0x1fe1a9[_0x1be3('0x58')][_0x1be3('0x5c')]=moment()[_0x1be3('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x1fe1a9['body'][_0x1be3('0x5e')]=_0x1fe1a9['body'][_0x1be3('0x5e')]||_0x1fe1a9[_0x1be3('0x5f')]['id'];return db[_0x1be3('0x3b')][_0x1be3('0x56')]({'where':{'id':_0x1fe1a9[_0x1be3('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x1be3('0x60')],'as':_0x1be3('0x61')}]})[_0x1be3('0x23')](handleEntityNotFound(_0x793b4f,null))['then'](saveUpdates(_0x1fe1a9[_0x1be3('0x58')],null))[_0x1be3('0x23')](function(_0x28030d){if(_0x28030d){_0x33d7ac[_0x1be3('0x2a')]=_0x28030d[_0x1be3('0x62')]({'plain':!![]});return db['SmsInteraction'][_0x1be3('0x56')]({'where':{'id':_0x28030d[_0x1be3('0x63')]}});}return null;})[_0x1be3('0x23')](handleEntityNotFound(_0x793b4f,null))[_0x1be3('0x23')](function(_0x7f8918){if(_0x7f8918){return _0x7f8918[_0x1be3('0x36')]({'UserId':_0x1fe1a9[_0x1be3('0x58')][_0x1be3('0x5e')],'read1stAt':_[_0x1be3('0x64')](_0x7f8918[_0x1be3('0x65')])?moment()[_0x1be3('0x5d')](_0x1be3('0x66')):undefined});}return null;})[_0x1be3('0x23')](function(_0x29f516){if(_0x29f516){_0x33d7ac['interaction']=_0x29f516['get']({'plain':!![]});interaction_log[_0x1be3('0x24')](_0x1be3('0x67'),_0x1fe1a9[_0x1be3('0x5f')]['id'],_0x1fe1a9[_0x1be3('0x5f')][_0x1be3('0x38')],_0x1fe1a9[_0x1be3('0x5f')][_0x1be3('0x68')],_0x33d7ac[_0x1be3('0x69')]['id'],_0x1fe1a9[_0x1be3('0x58')]?JSON[_0x1be3('0x27')](_0x1fe1a9[_0x1be3('0x58')]):_0x1be3('0x6a'));return respondWithRpcPromise(_0x1be3('0x6b'),_0x1be3('0x6c'),_0x33d7ac);}return null;})[_0x1be3('0x23')](function(_0x292146){if(_0x292146){if(_0x1fe1a9['body'][_0x1be3('0x6d')]){_0x33d7ac[_0x1be3('0x2a')][_0x1be3('0x6e')]=util['format']('SIP/%s',_0x1fe1a9[_0x1be3('0x5f')][_0x1be3('0x38')]);_0x33d7ac['message']['channel']=_0x33d7ac['channel'];_0x33d7ac[_0x1be3('0x2a')][_0x1be3('0x6f')]=_0x1be3('0x70');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x33d7ac[_0x1be3('0x2a')]},client9002)[_0x1be3('0x23')](function(){return _0x33d7ac;});}return _0x33d7ac;}return null;})['then'](respondWithResult(_0x793b4f,null))[_0x1be3('0x2c')](handleError(_0x793b4f,null));};var interaction_log=require('../../config/logger')(_0x1be3('0x5a'));exports['reject']=function(_0x14b2ce,_0x2c3c76,_0x4b805f){var _0x596055={'agent':{},'channel':_0x1be3('0x5b')};if(_0x14b2ce[_0x1be3('0x58')]['id']){delete _0x14b2ce[_0x1be3('0x58')]['id'];}_0x14b2ce[_0x1be3('0x58')][_0x1be3('0x5e')]=_0x14b2ce[_0x1be3('0x58')]['UserId']||_0x14b2ce['user']['id'];_0x596055[_0x1be3('0x71')]['id']=_0x14b2ce[_0x1be3('0x58')][_0x1be3('0x5e')];return db[_0x1be3('0x3b')]['find']({'where':{'id':_0x14b2ce[_0x1be3('0x52')]['id'],'UserId':null}})[_0x1be3('0x23')](handleEntityNotFound(_0x2c3c76,null))[_0x1be3('0x23')](function(_0x56c170){if(_0x56c170){_0x596055['message']=_0x56c170[_0x1be3('0x62')]({'plain':!![]});return db['SmsInteraction'][_0x1be3('0x56')]({'where':{'id':_0x56c170[_0x1be3('0x63')]}});}return null;})[_0x1be3('0x23')](handleEntityNotFound(_0x2c3c76,null))['then'](function(_0x33851c){if(_0x33851c){_0x596055[_0x1be3('0x69')]=_0x33851c['get']({'plain':!![]});interaction_log[_0x1be3('0x24')](_0x1be3('0x72'),_0x14b2ce[_0x1be3('0x5f')]['id'],_0x14b2ce[_0x1be3('0x5f')][_0x1be3('0x38')],_0x14b2ce[_0x1be3('0x5f')][_0x1be3('0x68')],_0x596055[_0x1be3('0x69')]['id'],_0x14b2ce[_0x1be3('0x58')]?JSON[_0x1be3('0x27')](_0x14b2ce['body']):'null');return respondWithRpcPromise(_0x1be3('0x73'),_0x1be3('0x74'),_0x596055);}return null;})['then'](function(_0x21f004){if(_0x21f004){_0x21f004[_0x1be3('0x2a')][_0x1be3('0x6e')]=util[_0x1be3('0x5d')]('SIP/%s',_0x14b2ce[_0x1be3('0x5f')][_0x1be3('0x38')]);_0x21f004[_0x1be3('0x2a')][_0x1be3('0x75')]=_0x596055[_0x1be3('0x75')];_0x21f004['message']['event']=_0x1be3('0x76');respondWithRpcPromise(_0x1be3('0x77'),_0x1be3('0x77'),{'event':_0x1be3('0x78'),'message':_0x21f004[_0x1be3('0x2a')]},client9002);return _0x596055;}return null;})[_0x1be3('0x23')](respondWithResult(_0x2c3c76,null))[_0x1be3('0x2c')](handleError(_0x2c3c76,null));};exports['status']=function(_0x90e4b8,_0x3550d2,_0xff792){if(_0x90e4b8[_0x1be3('0x58')]['id']){delete _0x90e4b8[_0x1be3('0x58')]['id'];}var _0x2d4c05;return db[_0x1be3('0x3b')][_0x1be3('0x56')]({'where':{'id':_0x90e4b8[_0x1be3('0x52')]['id']}})[_0x1be3('0x23')](handleEntityNotFound(_0x3550d2,null))['then'](function(_0x3ce52d){if(_0x3ce52d){_0x2d4c05=_0x3ce52d;return db[_0x1be3('0x79')][_0x1be3('0x56')]({'where':{'id':_0x3ce52d[_0x1be3('0x7a')]}});}})['then'](handleEntityNotFound(_0x3550d2,null))[_0x1be3('0x23')](function(_0x1bc869){if(_0x1bc869){logger[_0x1be3('0x7b')](_0x1be3('0x26'),_0x1be3('0x2f'),_0x1be3('0x7c'),_0x1bc869[_0x1be3('0x3d')],util[_0x1be3('0x7d')](_0x90e4b8[_0x1be3('0x58')],{'showHidden':![],'depth':null}));switch(_0x1bc869[_0x1be3('0x3d')]){case _0x1be3('0x7e'):if(_0x90e4b8['body'][_0x1be3('0x7f')]&&_0x90e4b8[_0x1be3('0x58')]['MessageSid']===_0x2d4c05['messageId']){return _0x2d4c05[_0x1be3('0x36')]({'read':!![]});}else{logger['error'](_0x1be3('0x80'),_0x1be3('0x2f'),_0x1be3('0x7e'),util[_0x1be3('0x7d')](_0x90e4b8[_0x1be3('0x58')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x90e4b8['body'][_0x1be3('0x81')]&&_0x90e4b8[_0x1be3('0x58')][_0x1be3('0x81')]===_0x2d4c05['messageId']&&_['indexOf']([_0x1be3('0x82'),'delivered'],_0x90e4b8[_0x1be3('0x58')][_0x1be3('0x83')])>=0x0){return _0x2d4c05[_0x1be3('0x36')]({'read':!![]});}else{logger[_0x1be3('0x28')](_0x1be3('0x80'),_0x1be3('0x2f'),_0x1be3('0x84'),util[_0x1be3('0x7d')](_0x90e4b8['body'],{'showHidden':![],'depth':null}));}break;case _0x1be3('0x85'):var _0x41abf1=_0x90e4b8[_0x1be3('0x58')][_0x1be3('0x86')][0x0];if(_0x41abf1[_0x1be3('0x2f')][_0x1be3('0x87')]===_0x1be3('0x88')){return _0x2d4c05[_0x1be3('0x36')]({'read':!![]});}else{logger[_0x1be3('0x28')](_0x1be3('0x80'),_0x1be3('0x2f'),'infobip',util['inspect'](_0x90e4b8[_0x1be3('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x2d4c05;}})[_0x1be3('0x23')](respondWithResult(_0x3550d2,null))[_0x1be3('0x2c')](handleError(_0x3550d2,null));}; \ No newline at end of file +var _0x5825=['../../mysqldb','redis','localhost','./smsMessage.socket','register','client','http','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~!@#$%^&-_=+[{]}.','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','stack','name','send','index','map','SmsMessage','rawAttributes','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','destroy','describe','../../config/logger','sms','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','format','SIP/%s','channel','event','accept','acceptmessage','sms-interactions','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','EventManager','rejectmessage','SmsAccount','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x598f21,_0x122523){var _0x127aab=function(_0x1860b8){while(--_0x1860b8){_0x598f21['push'](_0x598f21['shift']());}};_0x127aab(++_0x122523);}(_0x5825,0x78));var _0x5582=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5825[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x5582('0x0'));var emlformat=require(_0x5582('0x1'));var rimraf=require(_0x5582('0x2'));var zipdir=require(_0x5582('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5582('0x4'));var moment=require('moment');var BPromise=require(_0x5582('0x5'));var Mustache=require(_0x5582('0x6'));var util=require(_0x5582('0x7'));var path=require(_0x5582('0x8'));var sox=require(_0x5582('0x9'));var csv=require(_0x5582('0xa'));var ejs=require(_0x5582('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5582('0xc'));var crypto=require(_0x5582('0xd'));var jsforce=require(_0x5582('0xe'));var deskjs=require(_0x5582('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5582('0x10'));var Papa=require(_0x5582('0x11'));var Redis=require(_0x5582('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5582('0x13'));var as=require(_0x5582('0x14'));var hardwareService=require(_0x5582('0x15'));var logger=require('../../config/logger')(_0x5582('0x16'));var utils=require(_0x5582('0x17'));var config=require('../../config/environment');var db=require(_0x5582('0x18'))['db'];config[_0x5582('0x19')]=_['defaults'](config['redis'],{'host':_0x5582('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5582('0x1b'))[_0x5582('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5582('0x1d')][_0x5582('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x5582('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x439628,_0x4835de,_0x511268){if(_0x511268){var _0xf38ed6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xf38ed6['test'](_0x4835de)){return _0x439628;}else{throw new db[(_0x5582('0x1f'))][(_0x5582('0x20'))](_0x5582('0x21'));}}else{return _0x439628;}}function respondWithRpcPromise(_0xec8f20,_0x1b021a,_0x13810e,_0x31a3de){return new BPromise(function(_0x154fda,_0x563ac0){var _0x907cab=_0x31a3de||client;return _0x907cab[_0x5582('0x22')](_0xec8f20,_0x13810e)[_0x5582('0x23')](function(_0x44fc81){logger['info'](_0x5582('0x24'),_0x1b021a,_0x5582('0x25'));logger[_0x5582('0x26')](_0x5582('0x27'),_0x1b021a,_0x5582('0x25'),JSON[_0x5582('0x28')](_0x44fc81));if(_0x44fc81[_0x5582('0x29')]){if(_0x44fc81[_0x5582('0x29')][_0x5582('0x2a')]===0x1f4){logger['error'](_0x5582('0x24'),_0x1b021a,_0x44fc81['error'][_0x5582('0x2b')]);return _0x563ac0(_0x44fc81['error'][_0x5582('0x2b')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x1b021a,_0x44fc81[_0x5582('0x29')][_0x5582('0x2b')]);return _0x154fda(_0x44fc81[_0x5582('0x29')][_0x5582('0x2b')]);}else{logger[_0x5582('0x2c')](_0x5582('0x24'),_0x1b021a,'request\x20sent');_0x154fda(_0x44fc81[_0x5582('0x2d')]['message']);}})[_0x5582('0x2e')](function(_0x424ac3){logger['error'](_0x5582('0x24'),_0x1b021a,_0x424ac3);_0x563ac0(_0x424ac3);});});}function respondWithStatusCode(_0x5de26b,_0xe67b02){_0xe67b02=_0xe67b02||0xcc;return function(_0x151939){if(_0x151939){return _0x5de26b[_0x5582('0x2f')](_0xe67b02);}return _0x5de26b[_0x5582('0x30')](_0xe67b02)[_0x5582('0x31')]();};}function respondWithResult(_0x37bba3,_0x134d00){_0x134d00=_0x134d00||0xc8;return function(_0x23fc47){if(_0x23fc47){return _0x37bba3[_0x5582('0x30')](_0x134d00)['json'](_0x23fc47);}};}function respondWithFilteredResult(_0x419944,_0x27b16d){return function(_0x357654){if(_0x357654){var _0x2d1dfa=_0x357654[_0x5582('0x32')],_0x17adc5=_0x27b16d['offset'],_0x44083c=_0x27b16d[_0x5582('0x33')]+_0x27b16d[_0x5582('0x34')],_0x1689f2;if(_0x44083c>=_0x2d1dfa){_0x44083c=_0x2d1dfa;_0x1689f2=0xc8;}else{_0x1689f2=0xce;}_0x419944[_0x5582('0x30')](_0x1689f2);return _0x419944[_0x5582('0x35')]('Content-Range',_0x17adc5+'-'+_0x44083c+'/'+_0x2d1dfa)[_0x5582('0x36')](_0x357654);}return null;};}function patchUpdates(_0x314303){return function(_0x5d2c95){try{jsonpatch[_0x5582('0x37')](_0x5d2c95,_0x314303,!![]);}catch(_0x54609a){return BPromise[_0x5582('0x38')](_0x54609a);}return _0x5d2c95[_0x5582('0x39')]();};}function saveUpdates(_0x4add04,_0x2b7507){return function(_0x441260){if(_0x441260){return _0x441260[_0x5582('0x3a')](_0x4add04)[_0x5582('0x23')](function(_0x1e2b52){return _0x1e2b52;});}return null;};}function removeEntity(_0x8fec59,_0xf737ac){return function(_0x50ae46){if(_0x50ae46){return _0x50ae46['destroy']()[_0x5582('0x23')](function(){_0x8fec59[_0x5582('0x30')](0xcc)[_0x5582('0x31')]();});}};}function handleEntityNotFound(_0x54adb1,_0x4b0e09){return function(_0x55a7c2){if(!_0x55a7c2){_0x54adb1['sendStatus'](0x194);}return _0x55a7c2;};}function handleError(_0x458251,_0x3f0a3a){_0x3f0a3a=_0x3f0a3a||0x1f4;return function(_0xc08ef){logger[_0x5582('0x29')](_0xc08ef[_0x5582('0x3b')]);if(_0xc08ef[_0x5582('0x3c')]){delete _0xc08ef['name'];}_0x458251['status'](_0x3f0a3a)[_0x5582('0x3d')](_0xc08ef);};}exports[_0x5582('0x3e')]=function(_0x2dcb8e,_0x31a9a0){var _0x2f0724={},_0x7b7359={},_0x28d7d6={'count':0x0,'rows':[]};var _0x3c1ba2=_[_0x5582('0x3f')](db[_0x5582('0x40')][_0x5582('0x41')],function(_0x5448e2){return{'name':_0x5448e2['fieldName'],'type':_0x5448e2[_0x5582('0x42')]['key']};});_0x7b7359['model']=_[_0x5582('0x3f')](_0x3c1ba2,'name');_0x7b7359[_0x5582('0x43')]=_[_0x5582('0x44')](_0x2dcb8e[_0x5582('0x43')]);_0x7b7359[_0x5582('0x45')]=_[_0x5582('0x46')](_0x7b7359['model'],_0x7b7359[_0x5582('0x43')]);_0x2f0724[_0x5582('0x47')]=_['intersection'](_0x7b7359[_0x5582('0x48')],qs[_0x5582('0x49')](_0x2dcb8e[_0x5582('0x43')]['fields']));_0x2f0724[_0x5582('0x47')]=_0x2f0724[_0x5582('0x47')][_0x5582('0x4a')]?_0x2f0724[_0x5582('0x47')]:_0x7b7359[_0x5582('0x48')];if(!_0x2dcb8e[_0x5582('0x43')][_0x5582('0x4b')](_0x5582('0x4c'))){_0x2f0724[_0x5582('0x34')]=qs['limit'](_0x2dcb8e['query']['limit']);_0x2f0724[_0x5582('0x33')]=qs['offset'](_0x2dcb8e['query']['offset']);}_0x2f0724[_0x5582('0x4d')]=qs[_0x5582('0x4e')](_0x2dcb8e[_0x5582('0x43')][_0x5582('0x4e')]);_0x2f0724[_0x5582('0x4f')]=qs['filters'](_[_0x5582('0x50')](_0x2dcb8e[_0x5582('0x43')],_0x7b7359[_0x5582('0x45')]),_0x3c1ba2);if(_0x2dcb8e[_0x5582('0x43')][_0x5582('0x51')]){_0x2f0724[_0x5582('0x4f')]=_['merge'](_0x2f0724[_0x5582('0x4f')],{'$or':_[_0x5582('0x3f')](_0x3c1ba2,function(_0x4363fe){if(_0x4363fe[_0x5582('0x42')]!==_0x5582('0x52')){var _0x29a58b={};_0x29a58b[_0x4363fe[_0x5582('0x3c')]]={'$like':'%'+_0x2dcb8e[_0x5582('0x43')][_0x5582('0x51')]+'%'};return _0x29a58b;}})});}_0x2f0724=_[_0x5582('0x53')]({},_0x2f0724,_0x2dcb8e[_0x5582('0x54')]);var _0x20047d={'where':_0x2f0724['where']};return db[_0x5582('0x40')][_0x5582('0x32')](_0x20047d)[_0x5582('0x23')](function(_0x399072){_0x28d7d6[_0x5582('0x32')]=_0x399072;if(_0x2dcb8e[_0x5582('0x43')][_0x5582('0x55')]){_0x2f0724['include']=[{'all':!![]}];}return db['SmsMessage'][_0x5582('0x56')](_0x2f0724);})['then'](function(_0x33cc94){_0x28d7d6[_0x5582('0x57')]=_0x33cc94;return _0x28d7d6;})[_0x5582('0x23')](respondWithFilteredResult(_0x31a9a0,_0x2f0724))['catch'](handleError(_0x31a9a0,null));};exports[_0x5582('0x58')]=function(_0x4b9ffe,_0x33b0d6){var _0x5ea23f={'raw':!![],'where':{'id':_0x4b9ffe[_0x5582('0x59')]['id']}},_0x61fb19={};_0x61fb19[_0x5582('0x48')]=_['keys'](db[_0x5582('0x40')][_0x5582('0x41')]);_0x61fb19['query']=_[_0x5582('0x44')](_0x4b9ffe[_0x5582('0x43')]);_0x61fb19[_0x5582('0x45')]=_[_0x5582('0x46')](_0x61fb19['model'],_0x61fb19[_0x5582('0x43')]);_0x5ea23f[_0x5582('0x47')]=_[_0x5582('0x46')](_0x61fb19[_0x5582('0x48')],qs[_0x5582('0x49')](_0x4b9ffe['query']['fields']));_0x5ea23f['attributes']=_0x5ea23f[_0x5582('0x47')]['length']?_0x5ea23f[_0x5582('0x47')]:_0x61fb19['model'];if(_0x4b9ffe[_0x5582('0x43')][_0x5582('0x55')]){_0x5ea23f[_0x5582('0x5a')]=[{'all':!![]}];}_0x5ea23f=_[_0x5582('0x53')]({},_0x5ea23f,_0x4b9ffe[_0x5582('0x54')]);return db[_0x5582('0x40')][_0x5582('0x5b')](_0x5ea23f)[_0x5582('0x23')](handleEntityNotFound(_0x33b0d6,null))[_0x5582('0x23')](respondWithResult(_0x33b0d6,null))[_0x5582('0x2e')](handleError(_0x33b0d6,null));};exports[_0x5582('0x5c')]=function(_0x568215,_0x32a7f4){return db['SmsMessage'][_0x5582('0x5c')](_0x568215[_0x5582('0x5d')],{})[_0x5582('0x23')](respondWithResult(_0x32a7f4,0xc9))[_0x5582('0x2e')](handleError(_0x32a7f4,null));};exports[_0x5582('0x3a')]=function(_0x162880,_0x1a08a8){if(_0x162880[_0x5582('0x5d')]['id']){delete _0x162880[_0x5582('0x5d')]['id'];}return db[_0x5582('0x40')][_0x5582('0x5b')]({'where':{'id':_0x162880['params']['id']}})[_0x5582('0x23')](handleEntityNotFound(_0x1a08a8,null))['then'](saveUpdates(_0x162880['body'],null))[_0x5582('0x23')](respondWithResult(_0x1a08a8,null))[_0x5582('0x2e')](handleError(_0x1a08a8,null));};exports[_0x5582('0x5e')]=function(_0x34834a,_0x484c26){return db[_0x5582('0x40')][_0x5582('0x5b')]({'where':{'id':_0x34834a[_0x5582('0x59')]['id']}})[_0x5582('0x23')](handleEntityNotFound(_0x484c26,null))[_0x5582('0x23')](removeEntity(_0x484c26,null))[_0x5582('0x2e')](handleError(_0x484c26,null));};exports[_0x5582('0x5f')]=function(_0x423692,_0x452d12){return db[_0x5582('0x40')][_0x5582('0x5f')]()[_0x5582('0x23')](respondWithResult(_0x452d12,null))[_0x5582('0x2e')](handleError(_0x452d12,null));};var interaction_log=require(_0x5582('0x60'))('sms-interactions');exports['accept']=function(_0x2e314e,_0x1ef8c8,_0x3e2899){var _0x479627={'channel':_0x5582('0x61')};if(_0x2e314e['body']['id']){delete _0x2e314e[_0x5582('0x5d')]['id'];}_0x2e314e['body']['read']=!![];_0x2e314e['body']['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2e314e[_0x5582('0x5d')][_0x5582('0x62')]=_0x2e314e[_0x5582('0x5d')][_0x5582('0x62')]||_0x2e314e[_0x5582('0x63')]['id'];return db[_0x5582('0x40')][_0x5582('0x5b')]({'where':{'id':_0x2e314e[_0x5582('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x5582('0x64')],'as':_0x5582('0x65')}]})[_0x5582('0x23')](handleEntityNotFound(_0x1ef8c8,null))[_0x5582('0x23')](saveUpdates(_0x2e314e[_0x5582('0x5d')],null))[_0x5582('0x23')](function(_0x49606f){if(_0x49606f){_0x479627[_0x5582('0x2b')]=_0x49606f[_0x5582('0x66')]({'plain':!![]});return db[_0x5582('0x67')]['find']({'where':{'id':_0x49606f[_0x5582('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x1ef8c8,null))[_0x5582('0x23')](function(_0xcf10f5){if(_0xcf10f5){return _0xcf10f5[_0x5582('0x3a')]({'UserId':_0x2e314e['body']['UserId'],'read1stAt':_[_0x5582('0x69')](_0xcf10f5['read1stAt'])?moment()['format'](_0x5582('0x6a')):undefined});}return null;})[_0x5582('0x23')](function(_0x38061e){if(_0x38061e){_0x479627[_0x5582('0x6b')]=_0x38061e['get']({'plain':!![]});interaction_log['info'](_0x5582('0x6c'),_0x2e314e['user']['id'],_0x2e314e['user']['name'],_0x2e314e['user'][_0x5582('0x6d')],_0x479627[_0x5582('0x6b')]['id'],_0x2e314e[_0x5582('0x5d')]?JSON['stringify'](_0x2e314e[_0x5582('0x5d')]):_0x5582('0x6e'));return respondWithRpcPromise(_0x5582('0x6f'),_0x5582('0x70'),_0x479627);}return null;})[_0x5582('0x23')](function(_0x2cd6b2){if(_0x2cd6b2){if(_0x2e314e['body'][_0x5582('0x71')]){_0x479627[_0x5582('0x2b')][_0x5582('0x72')]=util[_0x5582('0x73')](_0x5582('0x74'),_0x2e314e[_0x5582('0x63')]['name']);_0x479627[_0x5582('0x2b')][_0x5582('0x75')]=_0x479627[_0x5582('0x75')];_0x479627[_0x5582('0x2b')][_0x5582('0x76')]=_0x5582('0x77');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x5582('0x78'),'message':_0x479627[_0x5582('0x2b')]},client9002)[_0x5582('0x23')](function(){return _0x479627;});}return _0x479627;}return null;})['then'](respondWithResult(_0x1ef8c8,null))[_0x5582('0x2e')](handleError(_0x1ef8c8,null));};var interaction_log=require(_0x5582('0x60'))(_0x5582('0x79'));exports['reject']=function(_0x2f1e43,_0x4f9a75,_0x57ef54){var _0x75b05b={'agent':{},'channel':'sms'};if(_0x2f1e43['body']['id']){delete _0x2f1e43[_0x5582('0x5d')]['id'];}_0x2f1e43['body'][_0x5582('0x62')]=_0x2f1e43['body'][_0x5582('0x62')]||_0x2f1e43[_0x5582('0x63')]['id'];_0x75b05b[_0x5582('0x7a')]['id']=_0x2f1e43['body'][_0x5582('0x62')];return db['SmsMessage']['find']({'where':{'id':_0x2f1e43[_0x5582('0x59')]['id'],'UserId':null}})[_0x5582('0x23')](handleEntityNotFound(_0x4f9a75,null))['then'](function(_0x5e741c){if(_0x5e741c){_0x75b05b[_0x5582('0x2b')]=_0x5e741c['get']({'plain':!![]});return db[_0x5582('0x67')][_0x5582('0x5b')]({'where':{'id':_0x5e741c[_0x5582('0x68')]}});}return null;})[_0x5582('0x23')](handleEntityNotFound(_0x4f9a75,null))[_0x5582('0x23')](function(_0x2a410b){if(_0x2a410b){_0x75b05b['interaction']=_0x2a410b['get']({'plain':!![]});interaction_log[_0x5582('0x2c')](_0x5582('0x7b'),_0x2f1e43[_0x5582('0x63')]['id'],_0x2f1e43[_0x5582('0x63')][_0x5582('0x3c')],_0x2f1e43['user'][_0x5582('0x6d')],_0x75b05b[_0x5582('0x6b')]['id'],_0x2f1e43[_0x5582('0x5d')]?JSON[_0x5582('0x28')](_0x2f1e43[_0x5582('0x5d')]):'null');return respondWithRpcPromise(_0x5582('0x7c'),'rejectMessage',_0x75b05b);}return null;})[_0x5582('0x23')](function(_0x5a4660){if(_0x5a4660){_0x5a4660[_0x5582('0x2b')][_0x5582('0x72')]=util['format'](_0x5582('0x74'),_0x2f1e43[_0x5582('0x63')][_0x5582('0x3c')]);_0x5a4660[_0x5582('0x2b')]['channel']=_0x75b05b[_0x5582('0x75')];_0x5a4660[_0x5582('0x2b')][_0x5582('0x76')]='reject';respondWithRpcPromise(_0x5582('0x7d'),_0x5582('0x7d'),{'event':_0x5582('0x7e'),'message':_0x5a4660[_0x5582('0x2b')]},client9002);return _0x75b05b;}return null;})[_0x5582('0x23')](respondWithResult(_0x4f9a75,null))['catch'](handleError(_0x4f9a75,null));};exports[_0x5582('0x30')]=function(_0x306542,_0x52f365,_0x3e331a){if(_0x306542['body']['id']){delete _0x306542['body']['id'];}var _0x39786a;return db[_0x5582('0x40')]['find']({'where':{'id':_0x306542['params']['id']}})[_0x5582('0x23')](handleEntityNotFound(_0x52f365,null))[_0x5582('0x23')](function(_0x2135dc){if(_0x2135dc){_0x39786a=_0x2135dc;return db[_0x5582('0x7f')][_0x5582('0x5b')]({'where':{'id':_0x2135dc['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x52f365,null))[_0x5582('0x23')](function(_0x5d1b5b){if(_0x5d1b5b){logger[_0x5582('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5582('0x30'),'received\x20delivery\x20report\x20from',_0x5d1b5b[_0x5582('0x42')],util[_0x5582('0x80')](_0x306542[_0x5582('0x5d')],{'showHidden':![],'depth':null}));switch(_0x5d1b5b[_0x5582('0x42')]){case _0x5582('0x81'):if(_0x306542[_0x5582('0x5d')][_0x5582('0x82')]&&_0x306542[_0x5582('0x5d')][_0x5582('0x82')]===_0x39786a[_0x5582('0x83')]){return _0x39786a[_0x5582('0x3a')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5582('0x30'),_0x5582('0x81'),util[_0x5582('0x80')](_0x306542[_0x5582('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x5582('0x84'):if(_0x306542[_0x5582('0x5d')][_0x5582('0x85')]&&_0x306542['body'][_0x5582('0x85')]===_0x39786a[_0x5582('0x83')]&&_[_0x5582('0x86')]([_0x5582('0x87'),_0x5582('0x88')],_0x306542['body'][_0x5582('0x89')])>=0x0){return _0x39786a['update']({'read':!![]});}else{logger[_0x5582('0x29')](_0x5582('0x8a'),_0x5582('0x30'),_0x5582('0x8b'),util[_0x5582('0x80')](_0x306542[_0x5582('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x5582('0x8c'):var _0x27f224=_0x306542['body'][_0x5582('0x8d')][0x0];if(_0x27f224['status'][_0x5582('0x8e')]===_0x5582('0x8f')){return _0x39786a[_0x5582('0x3a')]({'read':!![]});}else{logger[_0x5582('0x29')](_0x5582('0x8a'),_0x5582('0x30'),'infobip',util[_0x5582('0x80')](_0x306542[_0x5582('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x39786a;}})[_0x5582('0x23')](respondWithResult(_0x52f365,null))[_0x5582('0x2e')](handleError(_0x52f365,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index fb2b420..2c4872d 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 _0x79ec=['SmsMessage','setMaxListeners','save','update','remove','emit','hook','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x79ec,0x8f));var _0xc79e=function(_0x9d9343,_0x494c83){_0x9d9343=_0x9d9343-0x0;var _0x2abcd2=_0x79ec[_0x9d9343];return _0x2abcd2;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xc79e('0x0'))['db'][_0xc79e('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc79e('0x2')](0x0);var events={'afterCreate':_0xc79e('0x3'),'afterUpdate':_0xc79e('0x4'),'afterDestroy':_0xc79e('0x5')};function emitEvent(_0x17bacc){return function(_0x4dd973,_0x472ade,_0x56694b){SmsMessageEvents['emit'](_0x17bacc+':'+_0x4dd973['id'],_0x4dd973);SmsMessageEvents[_0xc79e('0x6')](_0x17bacc,_0x4dd973);_0x56694b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xc79e('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x552e=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x415302,_0x595773){var _0x810824=function(_0x4b9efa){while(--_0x4b9efa){_0x415302['push'](_0x415302['shift']());}};_0x810824(++_0x595773);}(_0x552e,0x7a));var _0xe552=function(_0x2101c0,_0x17db41){_0x2101c0=_0x2101c0-0x0;var _0x37ed14=_0x552e[_0x2101c0];return _0x37ed14;};'use strict';var EventEmitter=require(_0xe552('0x0'));var SmsMessage=require(_0xe552('0x1'))['db'][_0xe552('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe552('0x3')](0x0);var events={'afterCreate':_0xe552('0x4'),'afterUpdate':'update','afterDestroy':_0xe552('0x5')};function emitEvent(_0x625980){return function(_0x225ead,_0x43dff3,_0x205dd3){SmsMessageEvents[_0xe552('0x6')](_0x625980+':'+_0x225ead['id'],_0x225ead);SmsMessageEvents[_0xe552('0x6')](_0x625980,_0x225ead);_0x205dd3(null);};}for(var e in events){if(events[_0xe552('0x7')](e)){var event=events[e];SmsMessage[_0xe552('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index ea5a80f..c416c98 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 _0x1933=['phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','GET','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','read','error','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','toString','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','IBSSO\x20','csc','crypto','login','timestamp','keys','sort','apiKey','createHash','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','catch','SmsAccount','find','type','twilio','accountSid','authToken'];(function(_0x595a44,_0xc4547c){var _0x27f6e1=function(_0x3e88fc){while(--_0x3e88fc){_0x595a44['push'](_0x595a44['shift']());}};_0x27f6e1(++_0xc4547c);}(_0x1933,0x136));var _0x3193=function(_0x22404e,_0x12caeb){_0x22404e=_0x22404e-0x0;var _0x5fc0f8=_0x1933[_0x22404e];return _0x5fc0f8;};'use strict';var _=require(_0x3193('0x0'));var util=require(_0x3193('0x1'));var logger=require('../../config/logger')(_0x3193('0x2'));var moment=require(_0x3193('0x3'));var BPromise=require('bluebird');var rp=require(_0x3193('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3193('0x5'));var config=require('../../config/environment');var attributes=require(_0x3193('0x6'));module[_0x3193('0x7')]=function(_0x54c913,_0xe85107){return _0x54c913[_0x3193('0x8')](_0x3193('0x9'),attributes,{'tableName':_0x3193('0xa'),'paranoid':![],'indexes':[{'name':_0x3193('0xb'),'fields':[_0x3193('0xb')]},{'name':_0x3193('0xc'),'fields':[_0x3193('0xd')],'type':_0x3193('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x100505,_0x1f7f0e,_0x37cc1a){var _0xf5e277=_0x54c913[_0x3193('0xf')];var _0x493f21=_0x100505['get']({'plain':!![]});if(_0x493f21[_0x3193('0x10')][_0x3193('0x11')]()==='in'||_0x493f21[_0x3193('0x10')][_0x3193('0x11')]()===_0x3193('0x12')&&!_0x493f21['secret']&&!_[_0x3193('0x13')](_0x493f21[_0x3193('0x14')])){_0xf5e277[_0x3193('0x15')]['findOne']({'where':{'id':_0x493f21[_0x3193('0x16')]}})[_0x3193('0x17')](function(_0x128feb){if(_0x128feb){_0x128feb[_0x3193('0x18')]({'lastMsgAt':_0x493f21['createdAt'],'lastMsgDirection':_0x493f21[_0x3193('0x10')]['toLowerCase']()});}})[_0x3193('0x19')](function(_0x476fba){console['error'](_0x476fba);});}if(_0x493f21[_0x3193('0x10')]===_0x3193('0x12')&&!_0x493f21['secret']){var _0x11ced5;_0xf5e277[_0x3193('0x1a')][_0x3193('0x1b')]({'where':{'id':_0x493f21['SmsAccountId']},'raw':!![]})['then'](function(_0xa575){_0x11ced5=_0xa575;if(_0x11ced5&&_0x11ced5[_0x3193('0x1c')]){switch(_0x11ced5['type']){case _0x3193('0x1d'):var _0x437040=require(_0x3193('0x1d'));if(_0x11ced5[_0x3193('0x1e')]&&_0x11ced5[_0x3193('0x1f')]&&_0x11ced5[_0x3193('0x20')]){var _0x28351f=new _0x437040(_0x11ced5['accountSid'],_0x11ced5[_0x3193('0x1f')]);_0x28351f[_0x3193('0x21')][_0x3193('0x22')]({'body':_0x493f21['body'],'to':_0x493f21[_0x3193('0x20')],'from':_0x11ced5[_0x3193('0x20')],'statusCallback':_0x11ced5[_0x3193('0x23')]+_0x3193('0x24')+_0x493f21['id']+_0x3193('0x25')+_0x11ced5[_0x3193('0x26')]})[_0x3193('0x17')](function(_0x588419){if(_0x588419['sid']){return _0x100505['update']({'messageId':_0x588419[_0x3193('0x27')]});}})[_0x3193('0x19')](function(_0x2078bf){logger['error'](_0x3193('0x28'),_0x3193('0x29'),_0x3193('0x1d'),util[_0x3193('0x2a')](_0x2078bf,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3193('0x28'),_0x3193('0x29'),_0x3193('0x1d'),_0x3193('0x2b'));}break;case _0x3193('0x2c'):var _0x31c0e5=_0x3193('0x2d');if(_0x11ced5[_0x3193('0x2e')]&&_0x11ced5['password']){var _0xb6d7d2={'recipient':[_0x493f21[_0x3193('0x20')]],'message':_0x493f21[_0x3193('0xd')],'message_type':_0x11ced5[_0x3193('0x2f')]};if(_0x11ced5[_0x3193('0x2f')]&&_0x11ced5['smsMethod']!=='SI'){_0xb6d7d2[_0x3193('0x30')]=_0x11ced5[_0x3193('0x20')];}var _0x250331={'url':_0x31c0e5+_0x3193('0x31')+_0x11ced5[_0x3193('0x2e')]+_0x3193('0x32')+_0x11ced5[_0x3193('0x33')],'method':_0x3193('0x34')};rp(_0x250331)[_0x3193('0x17')](function(_0x4b8190){var _0x40da9d=_0x4b8190[_0x3193('0x35')](';');var _0x453397={'user_key':_0x40da9d[0x0],'session_key':_0x40da9d[0x1]};_0x250331={'url':_0x31c0e5+_0x3193('0x36'),'method':_0x3193('0x37'),'headers':{'user_key':_0x453397[_0x3193('0x38')],'Session_key':_0x453397['session_key']},'json':!![],'body':_0xb6d7d2};return rp(_0x250331);})[_0x3193('0x17')](function(_0x53b9d4){if(_0x53b9d4[_0x3193('0x39')]>=0x1){var _0x21c99f={'messageId':_0x53b9d4[_0x3193('0x3a')]};if(_0x11ced5[_0x3193('0x2f')]!=='GP'||!_0x11ced5[_0x3193('0x3b')]){_0x21c99f[_0x3193('0x3c')]=!![];}return _0x100505['update'](_0x21c99f);}else{return logger['error'](_0x3193('0x28'),_0x3193('0x29'),_0x3193('0x2c'),util[_0x3193('0x2a')](_0x53b9d4,{'showHidden':![],'depth':null}));}})[_0x3193('0x19')](function(_0xed6264){return logger[_0x3193('0x3d')](_0x3193('0x28'),_0x3193('0x29'),_0x3193('0x2c'),util[_0x3193('0x2a')](_0xed6264,{'showHidden':![],'depth':null}));});}else{logger[_0x3193('0x3d')](_0x3193('0x28'),_0x3193('0x29'),'skebby',_0x3193('0x3e'));}break;case _0x3193('0x3f'):if(_0x11ced5[_0x3193('0x1f')]){var _0x538037={'recipient':_0x493f21[_0x3193('0x20')],'message':_0x493f21['body'],'sender':_0x11ced5[_0x3193('0x40')]||_0x11ced5['phone'],'authorization':_0x11ced5[_0x3193('0x1f')]};var _0x1f7f0e={'method':_0x3193('0x37'),'uri':_0x3193('0x41'),'body':_0x538037,'json':!![]};rp(_0x1f7f0e)[_0x3193('0x17')](function(_0x8299dc){var _0x55d17f={'messageId':_0x8299dc[_0x3193('0x42')]};if(!_0x11ced5['deliveryReport']){_0x55d17f[_0x3193('0x3c')]=!![];}return _0x100505['update'](_0x55d17f);})[_0x3193('0x19')](function(_0x5b0736){logger[_0x3193('0x3d')](_0x3193('0x28'),_0x3193('0x29'),_0x3193('0x3f'),util[_0x3193('0x2a')](_0x5b0736,{'showHidden':![],'depth':null}));});}else{logger[_0x3193('0x3d')](_0x3193('0x28'),'afterCreate','connectel',_0x3193('0x43'));}break;case'clicksend':if(_0x11ced5['username']&&_0x11ced5[_0x3193('0x33')]){var _0x538037={'messages':[{'source':_0x3193('0x44'),'to':_0x493f21[_0x3193('0x20')],'body':_0x493f21[_0x3193('0xd')],'from':_0x11ced5[_0x3193('0x40')]||_0x11ced5[_0x3193('0x20')]}]};var _0x57d74b=util[_0x3193('0x45')](_0x3193('0x46'),_0x11ced5[_0x3193('0x2e')],_0x11ced5['password']);var _0x1f7f0e={'method':'POST','uri':_0x3193('0x47'),'body':_0x538037,'headers':{'Authorization':util[_0x3193('0x45')]('Basic\x20%s',new Buffer(_0x57d74b)['toString'](_0x3193('0x48')))},'json':!![]};rp(_0x1f7f0e)[_0x3193('0x17')](function(_0x58f797){if(_0x58f797[_0x3193('0x49')]>=0xc8&&_0x58f797[_0x3193('0x49')]<=0xce){if(_0x58f797[_0x3193('0x4a')]&&_0x58f797[_0x3193('0x4a')][_0x3193('0x4b')]>0x0){var _0x2f60af=_[_0x3193('0x4c')](_0x58f797['data'][_0x3193('0x21')]);var _0xb09a31={'messageId':_0x2f60af[_0x3193('0x4d')]};if(!_0x11ced5[_0x3193('0x3b')]){_0xb09a31[_0x3193('0x3c')]=!![];}return _0x100505[_0x3193('0x18')](_0xb09a31);}else{logger['error'](_0x3193('0x28'),'afterCreate',_0x3193('0x4e'),util[_0x3193('0x2a')](_0x58f797,{'showHidden':![],'depth':null}));}}else{logger[_0x3193('0x3d')](_0x3193('0x28'),_0x3193('0x29'),_0x3193('0x4e'),util[_0x3193('0x2a')](_0x58f797,{'showHidden':![],'depth':null}));}})[_0x3193('0x19')](function(_0x39ad96){logger['error'](_0x3193('0x28'),'afterCreate',_0x3193('0x4e'),util['inspect'](_0x39ad96,{'showHidden':![],'depth':null}));});}else{logger[_0x3193('0x3d')](_0x3193('0x28'),_0x3193('0x29'),_0x3193('0x4e'),_0x3193('0x3e'));}break;case _0x3193('0x4f'):if(_0x11ced5[_0x3193('0x50')]&&_0x11ced5['authToken']){var _0x538037={'dst':_0x493f21[_0x3193('0x20')],'text':_0x493f21[_0x3193('0xd')],'src':_0x11ced5['senderString']||_0x11ced5[_0x3193('0x20')],'url':_0x11ced5[_0x3193('0x23')]+_0x3193('0x24')+_0x493f21['id']+_0x3193('0x25')+_0x11ced5[_0x3193('0x26')]};var _0x57d74b=util[_0x3193('0x45')]('%s:%s',_0x11ced5[_0x3193('0x50')],_0x11ced5[_0x3193('0x1f')]);var _0x1f7f0e={'method':_0x3193('0x37'),'uri':util[_0x3193('0x45')]('https://api.plivo.com/v1/Account/%s/Message/',_0x11ced5[_0x3193('0x50')]),'body':_0x538037,'headers':{'Authorization':util[_0x3193('0x45')]('Basic\x20%s',new Buffer(_0x57d74b)[_0x3193('0x51')](_0x3193('0x48')))},'json':!![]};rp(_0x1f7f0e)[_0x3193('0x17')](function(_0x4445f8){var _0x12c52e={'messageId':_0x4445f8['message_uuid'][0x0]};return _0x100505[_0x3193('0x18')](_0x12c52e);})['catch'](function(_0xae6470){logger[_0x3193('0x3d')](_0x3193('0x28'),_0x3193('0x29'),'plivo',util[_0x3193('0x2a')](_0xae6470,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3193('0x28'),'afterCreate',_0x3193('0x4f'),_0x3193('0x52'));}break;case _0x3193('0x53'):if(_0x11ced5[_0x3193('0x2e')]&&_0x11ced5[_0x3193('0x33')]){if(_0x11ced5[_0x3193('0x54')]){var _0x59bd18={'method':_0x3193('0x37'),'uri':_0x11ced5[_0x3193('0x54')]+'/auth/1/session','body':{'username':_0x11ced5[_0x3193('0x2e')],'password':_0x11ced5[_0x3193('0x33')]},'json':!![]};return rp(_0x59bd18)[_0x3193('0x17')](function(_0x305e82){var _0x401044={'method':'POST','uri':_0x11ced5['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x11ced5['phone'],'destinations':[{'to':_0x493f21['phone']}],'text':_0x493f21['body'],'notifyUrl':_0x11ced5[_0x3193('0x23')]+_0x3193('0x24')+_0x493f21['id']+_0x3193('0x25')+_0x11ced5['token'],'notifyContentType':'application/json','callbackData':_0x11ced5[_0x3193('0x20')]+';'+_0x493f21['body']}]},'headers':{'Authorization':_0x3193('0x55')+_0x305e82[_0x3193('0x26')]},'json':!![]};return rp(_0x401044)['then'](function(_0x522e11){if(_0x522e11['messages']){var _0x4f506b={'messageId':_0x522e11[_0x3193('0x21')][0x0]['messageId']};if(!_0x11ced5[_0x3193('0x3b')]){_0x4f506b['read']=!![];}return _0x100505[_0x3193('0x18')](_0x4f506b);}else{return logger[_0x3193('0x3d')](_0x3193('0x28'),'afterCreate','infobip',util['inspect'](_0x522e11,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x604026){return logger[_0x3193('0x3d')](_0x3193('0x28'),_0x3193('0x29'),'infobip',util['inspect'](_0x604026,{'showHidden':![],'depth':null}));});}else{logger[_0x3193('0x3d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3193('0x29'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0x3193('0x3d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3193('0x29'),_0x3193('0x53'),_0x3193('0x3e'));}break;case _0x3193('0x56'):var _0x40324b=require(_0x3193('0x57'));if(_0x11ced5['apiKey']){var _0x40d26c={};_0x40d26c[_0x3193('0x58')]=_0x11ced5[_0x3193('0x2e')];_0x40d26c[_0x3193('0x20')]=_0x493f21['phone'];_0x40d26c['sender']=_0x11ced5[_0x3193('0x20')];_0x40d26c['text']=_0x493f21[_0x3193('0xd')];_0x40d26c[_0x3193('0x59')]=+new Date();var _0x596a0d='';var _0x1cbfe3='';var _0x2ea0bd=Object[_0x3193('0x5a')](_0x40d26c);_0x2ea0bd[_0x3193('0x5b')]();for(var _0x3e1516=0x0;_0x3e1516<_0x2ea0bd['length'];_0x3e1516++){if(_0x596a0d!=''){_0x596a0d+='&';}_0x596a0d+=_0x2ea0bd[_0x3e1516]+'='+encodeURIComponent(_0x40d26c[_0x2ea0bd[_0x3e1516]]);_0x1cbfe3+=_0x40d26c[_0x2ea0bd[_0x3e1516]];}_0x1cbfe3+=_0x11ced5[_0x3193('0x5c')];_0x1cbfe3=_0x40324b[_0x3193('0x5d')]('md5')['update'](_0x1cbfe3)['digest'](_0x3193('0x5e'));if(_0x596a0d!==''){_0x596a0d+='&';}_0x596a0d+=_0x3193('0x5f')+_0x1cbfe3;var _0x250331={'method':'GET','uri':_0x11ced5[_0x3193('0x54')]+_0x3193('0x60')+_0x596a0d,'json':!![]};return rp(_0x250331)[_0x3193('0x17')](function(_0x5df38c){var _0x56e0e4=Object[_0x3193('0x5a')](_0x5df38c);if(_0x5df38c[_0x56e0e4[0x0]][_0x3193('0x3d')]&&parseInt(_0x5df38c[_0x56e0e4[0x0]][_0x3193('0x3d')])===0x0){var _0x1e1289={'messageId':_0x5df38c[_0x56e0e4[0x0]][_0x3193('0x61')]};if(!_0x11ced5[_0x3193('0x3b')]){_0x1e1289[_0x3193('0x3c')]=!![];}return _0x100505[_0x3193('0x18')](_0x1e1289);}else{return logger[_0x3193('0x3d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3193('0x29'),'csc',util[_0x3193('0x2a')](_0x5df38c[_0x3193('0x3d')],{'showHidden':![],'depth':null}));}})[_0x3193('0x19')](function(_0x62b287){return logger[_0x3193('0x3d')](_0x3193('0x28'),'afterCreate','csc',util['inspect'](_0x62b287,{'showHidden':![],'depth':null}));});}else{logger[_0x3193('0x3d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3193('0x29'),'csc',_0x3193('0x62'));}break;case _0x3193('0x63'):if(_0x11ced5['apiKey']){var _0x4d2087={'method':_0x3193('0x37'),'uri':_0x3193('0x64'),'headers':{'Authorization':_0x11ced5[_0x3193('0x5c')]},'body':{'content':_0x493f21['body'],'to':[_0x493f21[_0x3193('0x20')]],'from':_0x11ced5[_0x3193('0x20')],'binary':![],'clientMessageId':'uuid','charset':_0x3193('0x65')},'json':!![]};rp(_0x4d2087)[_0x3193('0x17')](function(_0x106c64){if(!_0x106c64[_0x3193('0x3d')]){var _0x23017f={'messageId':_0x106c64[_0x3193('0x21')][0x0][_0x3193('0x66')]};if(!_0x11ced5['deliveryReport']){_0x23017f['read']=!![];}return _0x100505[_0x3193('0x18')](_0x23017f);}else{return logger[_0x3193('0x3d')](_0x3193('0x28'),_0x3193('0x29'),'clickatell',util['inspect'](_0x106c64['error'],{'showHidden':![],'depth':null}));}})[_0x3193('0x19')](function(_0x513cc7){return logger[_0x3193('0x3d')](_0x3193('0x28'),_0x3193('0x29'),_0x3193('0x63'),util[_0x3193('0x2a')](_0x513cc7,{'showHidden':![],'depth':null}));});}else{logger[_0x3193('0x3d')](_0x3193('0x28'),_0x3193('0x29'),'clickatell',_0x3193('0x62'));}break;case'intelepeer':if(_0x11ced5[_0x3193('0x5c')]){var _0x3999c0={};var _0x250331={'method':'POST','uri':_0x3193('0x67'),'headers':{'Authorization':_0x3193('0x68')+_0x11ced5[_0x3193('0x5c')],'Content-Type':_0x3193('0x69')},'body':{'from':_0x11ced5[_0x3193('0x20')],'to':_0x493f21[_0x3193('0x20')],'text':_0x493f21['body']},'json':!![]};return rp(_0x250331)[_0x3193('0x17')](function(_0x338785){if(_0x338785['code']==0xca){_0x3999c0['message']=_0x338785;var _0x564643={'method':_0x3193('0x37'),'uri':_0x3193('0x6a'),'headers':{'Authorization':'Bearer\x20'+_0x11ced5['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x3999c0[_0x3193('0x6b')][_0x3193('0x6c')]},'json':!![]};return rp(_0x564643)['then'](function(_0x2a254f){_0x3999c0[_0x3193('0x6d')]=_0x2a254f;var _0x1eb8c6={'messageId':_0x3999c0['message'][_0x3193('0x6c')],'read':!![]};return _0x100505[_0x3193('0x18')](_0x1eb8c6);});}else{return logger[_0x3193('0x3d')](_0x3193('0x28'),_0x3193('0x29'),_0x3193('0x6e'),util[_0x3193('0x2a')](_0x338785,{'showHidden':![],'depth':null}));}})[_0x3193('0x19')](function(_0xcd3128){return logger['error'](_0x3193('0x28'),_0x3193('0x29'),_0x3193('0x6e'),util[_0x3193('0x2a')](_0xcd3128,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x3193('0x28'),'afterCreate',_0x3193('0x6e'),_0x3193('0x6f'));}break;}}})[_0x3193('0x70')](function(){_0x37cc1a();});}else{_0x37cc1a();}}},'charset':'utf8mb4','collate':_0x3193('0x71')});}; \ No newline at end of file +var _0xbdc2=['head','message_id','clickSend','plivo','authId','senderString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','crypto','apiKey','text','keys','sort','length','createHash','md5','digest','hex','GET','/external/get/send.php?','id_sms','csc','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','Missing\x20parameters:\x20apiKey','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','findOne','SmsInteractionId','then','createdAt','error','secret','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','split','POST','session_key','total_sent','internal_order_id','deliveryReport','catch','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/send/','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count'];(function(_0x360c2a,_0x28c3d1){var _0x1eda84=function(_0x240405){while(--_0x240405){_0x360c2a['push'](_0x360c2a['shift']());}};_0x1eda84(++_0x28c3d1);}(_0xbdc2,0xa5));var _0x2bdc=function(_0x15ad95,_0x566009){_0x15ad95=_0x15ad95-0x0;var _0x439717=_0xbdc2[_0x15ad95];return _0x439717;};'use strict';var _=require(_0x2bdc('0x0'));var util=require(_0x2bdc('0x1'));var logger=require('../../config/logger')(_0x2bdc('0x2'));var moment=require(_0x2bdc('0x3'));var BPromise=require(_0x2bdc('0x4'));var rp=require(_0x2bdc('0x5'));var fs=require('fs');var path=require(_0x2bdc('0x6'));var rimraf=require(_0x2bdc('0x7'));var config=require(_0x2bdc('0x8'));var attributes=require('./smsMessage.attributes');module[_0x2bdc('0x9')]=function(_0x3f5e88,_0x37290c){return _0x3f5e88[_0x2bdc('0xa')](_0x2bdc('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x2bdc('0xc'),'fields':['messageId']},{'name':_0x2bdc('0xd'),'fields':[_0x2bdc('0xe')],'type':_0x2bdc('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x29dbf4,_0x315541,_0x41293d){var _0x6bcafa=_0x3f5e88['models'];var _0x24b55f=_0x29dbf4[_0x2bdc('0x10')]({'plain':!![]});if(_0x24b55f[_0x2bdc('0x11')][_0x2bdc('0x12')]()==='in'||_0x24b55f[_0x2bdc('0x11')][_0x2bdc('0x12')]()===_0x2bdc('0x13')&&!_0x24b55f['secret']&&!_[_0x2bdc('0x14')](_0x24b55f[_0x2bdc('0x15')])){_0x6bcafa['SmsInteraction'][_0x2bdc('0x16')]({'where':{'id':_0x24b55f[_0x2bdc('0x17')]}})[_0x2bdc('0x18')](function(_0xda79d8){if(_0xda79d8){_0xda79d8['update']({'lastMsgAt':_0x24b55f[_0x2bdc('0x19')],'lastMsgDirection':_0x24b55f[_0x2bdc('0x11')][_0x2bdc('0x12')]()});}})['catch'](function(_0x49c7aa){console[_0x2bdc('0x1a')](_0x49c7aa);});}if(_0x24b55f[_0x2bdc('0x11')]==='out'&&!_0x24b55f[_0x2bdc('0x1b')]){var _0x1abbaa;_0x6bcafa['SmsAccount'][_0x2bdc('0x1c')]({'where':{'id':_0x24b55f[_0x2bdc('0x1d')]},'raw':!![]})['then'](function(_0x29afcb){_0x1abbaa=_0x29afcb;if(_0x1abbaa&&_0x1abbaa[_0x2bdc('0x1e')]){switch(_0x1abbaa[_0x2bdc('0x1e')]){case _0x2bdc('0x1f'):var _0x59935b=require(_0x2bdc('0x1f'));if(_0x1abbaa[_0x2bdc('0x20')]&&_0x1abbaa[_0x2bdc('0x21')]&&_0x1abbaa[_0x2bdc('0x22')]){var _0x184562=new _0x59935b(_0x1abbaa[_0x2bdc('0x20')],_0x1abbaa[_0x2bdc('0x21')]);_0x184562[_0x2bdc('0x23')][_0x2bdc('0x24')]({'body':_0x24b55f[_0x2bdc('0xe')],'to':_0x24b55f[_0x2bdc('0x22')],'from':_0x1abbaa[_0x2bdc('0x22')],'statusCallback':_0x1abbaa[_0x2bdc('0x25')]+_0x2bdc('0x26')+_0x24b55f['id']+_0x2bdc('0x27')+_0x1abbaa[_0x2bdc('0x28')]})[_0x2bdc('0x18')](function(_0x18f031){if(_0x18f031[_0x2bdc('0x29')]){return _0x29dbf4[_0x2bdc('0x2a')]({'messageId':_0x18f031[_0x2bdc('0x29')]});}})['catch'](function(_0x17eda7){logger[_0x2bdc('0x1a')](_0x2bdc('0x2b'),_0x2bdc('0x2c'),_0x2bdc('0x1f'),util[_0x2bdc('0x2d')](_0x17eda7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2bdc('0x2b'),_0x2bdc('0x2c'),_0x2bdc('0x1f'),_0x2bdc('0x2e'));}break;case _0x2bdc('0x2f'):var _0x40b945=_0x2bdc('0x30');if(_0x1abbaa[_0x2bdc('0x31')]&&_0x1abbaa[_0x2bdc('0x32')]){var _0x59f14e={'recipient':[_0x24b55f[_0x2bdc('0x22')]],'message':_0x24b55f['body'],'message_type':_0x1abbaa[_0x2bdc('0x33')]};if(_0x1abbaa[_0x2bdc('0x33')]&&_0x1abbaa[_0x2bdc('0x33')]!=='SI'){_0x59f14e[_0x2bdc('0x34')]=_0x1abbaa[_0x2bdc('0x22')];}var _0x33a26c={'url':_0x40b945+'login?username='+_0x1abbaa[_0x2bdc('0x31')]+_0x2bdc('0x35')+_0x1abbaa[_0x2bdc('0x32')],'method':'GET'};rp(_0x33a26c)[_0x2bdc('0x18')](function(_0x1c4a9b){var _0x45e2bb=_0x1c4a9b[_0x2bdc('0x36')](';');var _0x225ccc={'user_key':_0x45e2bb[0x0],'session_key':_0x45e2bb[0x1]};_0x33a26c={'url':_0x40b945+'sms','method':_0x2bdc('0x37'),'headers':{'user_key':_0x225ccc['user_key'],'Session_key':_0x225ccc[_0x2bdc('0x38')]},'json':!![],'body':_0x59f14e};return rp(_0x33a26c);})['then'](function(_0x2d60e8){if(_0x2d60e8[_0x2bdc('0x39')]>=0x1){var _0x21ea29={'messageId':_0x2d60e8[_0x2bdc('0x3a')]};if(_0x1abbaa[_0x2bdc('0x33')]!=='GP'||!_0x1abbaa[_0x2bdc('0x3b')]){_0x21ea29['read']=!![];}return _0x29dbf4['update'](_0x21ea29);}else{return logger[_0x2bdc('0x1a')](_0x2bdc('0x2b'),_0x2bdc('0x2c'),_0x2bdc('0x2f'),util[_0x2bdc('0x2d')](_0x2d60e8,{'showHidden':![],'depth':null}));}})[_0x2bdc('0x3c')](function(_0xe2672){return logger[_0x2bdc('0x1a')](_0x2bdc('0x2b'),_0x2bdc('0x2c'),'skebby',util['inspect'](_0xe2672,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2bdc('0x2b'),_0x2bdc('0x2c'),_0x2bdc('0x2f'),_0x2bdc('0x3d'));}break;case _0x2bdc('0x3e'):if(_0x1abbaa[_0x2bdc('0x21')]){var _0x228e91={'recipient':_0x24b55f['phone'],'message':_0x24b55f['body'],'sender':_0x1abbaa['senderString']||_0x1abbaa['phone'],'authorization':_0x1abbaa[_0x2bdc('0x21')]};var _0x315541={'method':_0x2bdc('0x37'),'uri':_0x2bdc('0x3f'),'body':_0x228e91,'json':!![]};rp(_0x315541)[_0x2bdc('0x18')](function(_0x2f9430){var _0x4fc1e4={'messageId':_0x2f9430['requestid']};if(!_0x1abbaa[_0x2bdc('0x3b')]){_0x4fc1e4[_0x2bdc('0x40')]=!![];}return _0x29dbf4[_0x2bdc('0x2a')](_0x4fc1e4);})[_0x2bdc('0x3c')](function(_0x3fdbf5){logger['error'](_0x2bdc('0x2b'),_0x2bdc('0x2c'),_0x2bdc('0x3e'),util['inspect'](_0x3fdbf5,{'showHidden':![],'depth':null}));});}else{logger[_0x2bdc('0x1a')](_0x2bdc('0x2b'),_0x2bdc('0x2c'),_0x2bdc('0x3e'),_0x2bdc('0x41'));}break;case _0x2bdc('0x42'):if(_0x1abbaa[_0x2bdc('0x31')]&&_0x1abbaa[_0x2bdc('0x32')]){var _0x228e91={'messages':[{'source':_0x2bdc('0x43'),'to':_0x24b55f[_0x2bdc('0x22')],'body':_0x24b55f['body'],'from':_0x1abbaa['senderString']||_0x1abbaa[_0x2bdc('0x22')]}]};var _0x163016=util[_0x2bdc('0x44')](_0x2bdc('0x45'),_0x1abbaa['username'],_0x1abbaa[_0x2bdc('0x32')]);var _0x315541={'method':_0x2bdc('0x37'),'uri':_0x2bdc('0x46'),'body':_0x228e91,'headers':{'Authorization':util['format'](_0x2bdc('0x47'),new Buffer(_0x163016)[_0x2bdc('0x48')](_0x2bdc('0x49')))},'json':!![]};rp(_0x315541)[_0x2bdc('0x18')](function(_0x15bbc7){if(_0x15bbc7['http_code']>=0xc8&&_0x15bbc7[_0x2bdc('0x4a')]<=0xce){if(_0x15bbc7[_0x2bdc('0x4b')]&&_0x15bbc7['data'][_0x2bdc('0x4c')]>0x0){var _0xe5769e=_[_0x2bdc('0x4d')](_0x15bbc7[_0x2bdc('0x4b')]['messages']);var _0x1d4471={'messageId':_0xe5769e[_0x2bdc('0x4e')]};if(!_0x1abbaa[_0x2bdc('0x3b')]){_0x1d4471[_0x2bdc('0x40')]=!![];}return _0x29dbf4[_0x2bdc('0x2a')](_0x1d4471);}else{logger[_0x2bdc('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2bdc('0x2c'),_0x2bdc('0x4f'),util[_0x2bdc('0x2d')](_0x15bbc7,{'showHidden':![],'depth':null}));}}else{logger[_0x2bdc('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2bdc('0x2c'),_0x2bdc('0x4f'),util[_0x2bdc('0x2d')](_0x15bbc7,{'showHidden':![],'depth':null}));}})[_0x2bdc('0x3c')](function(_0x448665){logger['error'](_0x2bdc('0x2b'),_0x2bdc('0x2c'),_0x2bdc('0x4f'),util[_0x2bdc('0x2d')](_0x448665,{'showHidden':![],'depth':null}));});}else{logger[_0x2bdc('0x1a')](_0x2bdc('0x2b'),_0x2bdc('0x2c'),_0x2bdc('0x4f'),_0x2bdc('0x3d'));}break;case _0x2bdc('0x50'):if(_0x1abbaa[_0x2bdc('0x51')]&&_0x1abbaa[_0x2bdc('0x21')]){var _0x228e91={'dst':_0x24b55f[_0x2bdc('0x22')],'text':_0x24b55f[_0x2bdc('0xe')],'src':_0x1abbaa[_0x2bdc('0x52')]||_0x1abbaa[_0x2bdc('0x22')],'url':_0x1abbaa[_0x2bdc('0x25')]+'/api/sms/messages/'+_0x24b55f['id']+'/status?token='+_0x1abbaa[_0x2bdc('0x28')]};var _0x163016=util['format']('%s:%s',_0x1abbaa[_0x2bdc('0x51')],_0x1abbaa[_0x2bdc('0x21')]);var _0x315541={'method':_0x2bdc('0x37'),'uri':util[_0x2bdc('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x1abbaa[_0x2bdc('0x51')]),'body':_0x228e91,'headers':{'Authorization':util[_0x2bdc('0x44')](_0x2bdc('0x47'),new Buffer(_0x163016)[_0x2bdc('0x48')](_0x2bdc('0x49')))},'json':!![]};rp(_0x315541)['then'](function(_0x4e8922){var _0xc1aa29={'messageId':_0x4e8922[_0x2bdc('0x53')][0x0]};return _0x29dbf4[_0x2bdc('0x2a')](_0xc1aa29);})[_0x2bdc('0x3c')](function(_0x26df00){logger[_0x2bdc('0x1a')](_0x2bdc('0x2b'),'afterCreate',_0x2bdc('0x50'),util[_0x2bdc('0x2d')](_0x26df00,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2bdc('0x2b'),_0x2bdc('0x2c'),_0x2bdc('0x50'),_0x2bdc('0x54'));}break;case _0x2bdc('0x55'):if(_0x1abbaa[_0x2bdc('0x31')]&&_0x1abbaa[_0x2bdc('0x32')]){if(_0x1abbaa['baseUrl']){var _0x24903b={'method':_0x2bdc('0x37'),'uri':_0x1abbaa[_0x2bdc('0x56')]+_0x2bdc('0x57'),'body':{'username':_0x1abbaa[_0x2bdc('0x31')],'password':_0x1abbaa['password']},'json':!![]};return rp(_0x24903b)['then'](function(_0x252a0a){var _0x939237={'method':_0x2bdc('0x37'),'uri':_0x1abbaa[_0x2bdc('0x56')]+_0x2bdc('0x58'),'body':{'messages':[{'from':_0x1abbaa[_0x2bdc('0x22')],'destinations':[{'to':_0x24b55f['phone']}],'text':_0x24b55f[_0x2bdc('0xe')],'notifyUrl':_0x1abbaa[_0x2bdc('0x25')]+_0x2bdc('0x26')+_0x24b55f['id']+'/status?token='+_0x1abbaa[_0x2bdc('0x28')],'notifyContentType':_0x2bdc('0x59'),'callbackData':_0x1abbaa[_0x2bdc('0x22')]+';'+_0x24b55f['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x252a0a[_0x2bdc('0x28')]},'json':!![]};return rp(_0x939237)[_0x2bdc('0x18')](function(_0x3323a4){if(_0x3323a4[_0x2bdc('0x23')]){var _0x432c01={'messageId':_0x3323a4[_0x2bdc('0x23')][0x0][_0x2bdc('0xc')]};if(!_0x1abbaa[_0x2bdc('0x3b')]){_0x432c01[_0x2bdc('0x40')]=!![];}return _0x29dbf4[_0x2bdc('0x2a')](_0x432c01);}else{return logger[_0x2bdc('0x1a')](_0x2bdc('0x2b'),'afterCreate',_0x2bdc('0x55'),util[_0x2bdc('0x2d')](_0x3323a4,{'showHidden':![],'depth':null}));}});})[_0x2bdc('0x3c')](function(_0x334f10){return logger[_0x2bdc('0x1a')](_0x2bdc('0x2b'),_0x2bdc('0x2c'),'infobip',util[_0x2bdc('0x2d')](_0x334f10,{'showHidden':![],'depth':null}));});}else{logger[_0x2bdc('0x1a')](_0x2bdc('0x2b'),'afterCreate',_0x2bdc('0x55'),_0x2bdc('0x5a'));}}else{logger[_0x2bdc('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',_0x2bdc('0x3d'));}break;case'csc':var _0x3c4f00=require(_0x2bdc('0x5b'));if(_0x1abbaa[_0x2bdc('0x5c')]){var _0x38703e={};_0x38703e['login']=_0x1abbaa[_0x2bdc('0x31')];_0x38703e[_0x2bdc('0x22')]=_0x24b55f['phone'];_0x38703e[_0x2bdc('0x34')]=_0x1abbaa['phone'];_0x38703e[_0x2bdc('0x5d')]=_0x24b55f[_0x2bdc('0xe')];_0x38703e['timestamp']=+new Date();var _0x3988fe='';var _0x4d0f28='';var _0x3e01fb=Object[_0x2bdc('0x5e')](_0x38703e);_0x3e01fb[_0x2bdc('0x5f')]();for(var _0xb7f5e2=0x0;_0xb7f5e2<_0x3e01fb[_0x2bdc('0x60')];_0xb7f5e2++){if(_0x3988fe!=''){_0x3988fe+='&';}_0x3988fe+=_0x3e01fb[_0xb7f5e2]+'='+encodeURIComponent(_0x38703e[_0x3e01fb[_0xb7f5e2]]);_0x4d0f28+=_0x38703e[_0x3e01fb[_0xb7f5e2]];}_0x4d0f28+=_0x1abbaa[_0x2bdc('0x5c')];_0x4d0f28=_0x3c4f00[_0x2bdc('0x61')](_0x2bdc('0x62'))[_0x2bdc('0x2a')](_0x4d0f28)[_0x2bdc('0x63')](_0x2bdc('0x64'));if(_0x3988fe!==''){_0x3988fe+='&';}_0x3988fe+='signature='+_0x4d0f28;var _0x33a26c={'method':_0x2bdc('0x65'),'uri':_0x1abbaa[_0x2bdc('0x56')]+_0x2bdc('0x66')+_0x3988fe,'json':!![]};return rp(_0x33a26c)[_0x2bdc('0x18')](function(_0x77aae1){var _0xfc0af6=Object[_0x2bdc('0x5e')](_0x77aae1);if(_0x77aae1[_0xfc0af6[0x0]][_0x2bdc('0x1a')]&&parseInt(_0x77aae1[_0xfc0af6[0x0]][_0x2bdc('0x1a')])===0x0){var _0x8610b6={'messageId':_0x77aae1[_0xfc0af6[0x0]][_0x2bdc('0x67')]};if(!_0x1abbaa[_0x2bdc('0x3b')]){_0x8610b6['read']=!![];}return _0x29dbf4[_0x2bdc('0x2a')](_0x8610b6);}else{return logger[_0x2bdc('0x1a')](_0x2bdc('0x2b'),_0x2bdc('0x2c'),_0x2bdc('0x68'),util[_0x2bdc('0x2d')](_0x77aae1[_0x2bdc('0x1a')],{'showHidden':![],'depth':null}));}})[_0x2bdc('0x3c')](function(_0x3fc5b4){return logger['error'](_0x2bdc('0x2b'),_0x2bdc('0x2c'),_0x2bdc('0x68'),util[_0x2bdc('0x2d')](_0x3fc5b4,{'showHidden':![],'depth':null}));});}else{logger[_0x2bdc('0x1a')](_0x2bdc('0x2b'),_0x2bdc('0x2c'),_0x2bdc('0x68'),'Missing\x20parameters:\x20apiKey');}break;case _0x2bdc('0x69'):if(_0x1abbaa[_0x2bdc('0x5c')]){var _0x4458f0={'method':_0x2bdc('0x37'),'uri':_0x2bdc('0x6a'),'headers':{'Authorization':_0x1abbaa[_0x2bdc('0x5c')]},'body':{'content':_0x24b55f[_0x2bdc('0xe')],'to':[_0x24b55f[_0x2bdc('0x22')]],'from':_0x1abbaa[_0x2bdc('0x22')],'binary':![],'clientMessageId':_0x2bdc('0x6b'),'charset':'UTF-8'},'json':!![]};rp(_0x4458f0)['then'](function(_0x405e00){if(!_0x405e00['error']){var _0x575496={'messageId':_0x405e00[_0x2bdc('0x23')][0x0][_0x2bdc('0x6c')]};if(!_0x1abbaa[_0x2bdc('0x3b')]){_0x575496[_0x2bdc('0x40')]=!![];}return _0x29dbf4[_0x2bdc('0x2a')](_0x575496);}else{return logger[_0x2bdc('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2bdc('0x2c'),_0x2bdc('0x69'),util['inspect'](_0x405e00[_0x2bdc('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x16814f){return logger[_0x2bdc('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2bdc('0x69'),util['inspect'](_0x16814f,{'showHidden':![],'depth':null}));});}else{logger[_0x2bdc('0x1a')](_0x2bdc('0x2b'),'afterCreate','clickatell',_0x2bdc('0x6d'));}break;case _0x2bdc('0x6e'):if(_0x1abbaa[_0x2bdc('0x5c')]){var _0x5771d0={};var _0x33a26c={'method':_0x2bdc('0x37'),'uri':_0x2bdc('0x6f'),'headers':{'Authorization':_0x2bdc('0x70')+_0x1abbaa[_0x2bdc('0x5c')],'Content-Type':'application/json'},'body':{'from':_0x1abbaa[_0x2bdc('0x22')],'to':_0x24b55f['phone'],'text':_0x24b55f[_0x2bdc('0xe')]},'json':!![]};return rp(_0x33a26c)[_0x2bdc('0x18')](function(_0x49eee2){if(_0x49eee2['code']==0xca){_0x5771d0[_0x2bdc('0x71')]=_0x49eee2;var _0x264be3={'method':_0x2bdc('0x37'),'uri':_0x2bdc('0x72'),'headers':{'Authorization':_0x2bdc('0x70')+_0x1abbaa[_0x2bdc('0x5c')],'Content-Type':_0x2bdc('0x59')},'body':{'refid':_0x5771d0[_0x2bdc('0x71')]['refid']},'json':!![]};return rp(_0x264be3)[_0x2bdc('0x18')](function(_0x228ceb){_0x5771d0[_0x2bdc('0x73')]=_0x228ceb;var _0x527a0d={'messageId':_0x5771d0[_0x2bdc('0x71')][_0x2bdc('0x74')],'read':!![]};return _0x29dbf4[_0x2bdc('0x2a')](_0x527a0d);});}else{return logger[_0x2bdc('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2bdc('0x6e'),util[_0x2bdc('0x2d')](_0x49eee2,{'showHidden':![],'depth':null}));}})[_0x2bdc('0x3c')](function(_0x5a5c7e){return logger['error'](_0x2bdc('0x2b'),'afterCreate',_0x2bdc('0x6e'),util[_0x2bdc('0x2d')](_0x5a5c7e,{'showHidden':![],'depth':null}));});}else{return logger[_0x2bdc('0x1a')](_0x2bdc('0x2b'),_0x2bdc('0x2c'),_0x2bdc('0x6e'),_0x2bdc('0x75'));}break;}}})[_0x2bdc('0x76')](function(){_0x41293d();});}else{_0x41293d();}}},'charset':_0x2bdc('0x77'),'collate':_0x2bdc('0x78')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 3a1ede0..eb55179 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 _0x8603=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','./smsMessage.socket','register','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','then','util','moment','bluebird'];(function(_0x36e115,_0xf5a72){var _0x353fb8=function(_0x3281f8){while(--_0x3281f8){_0x36e115['push'](_0x36e115['shift']());}};_0x353fb8(++_0xf5a72);}(_0x8603,0x190));var _0x3860=function(_0x2f544e,_0x99c662){_0x2f544e=_0x2f544e-0x0;var _0x5d6eaa=_0x8603[_0x2f544e];return _0x5d6eaa;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});config[_0x3860('0x9')]=_[_0x3860('0xa')](config[_0x3860('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3860('0xb'))[_0x3860('0xc')](socket);function respondWithRpcPromise(_0x52c277,_0x2fb169,_0x38737e){return new BPromise(function(_0x5909b8,_0x101263){return client[_0x3860('0xd')](_0x52c277,_0x38737e)['then'](function(_0x365579){logger[_0x3860('0xe')]('SmsMessage,\x20%s,\x20%s',_0x2fb169,_0x3860('0xf'));logger[_0x3860('0x10')](_0x3860('0x11'),_0x2fb169,_0x3860('0xf'),JSON[_0x3860('0x12')](_0x365579));if(_0x365579[_0x3860('0x13')]){if(_0x365579[_0x3860('0x13')][_0x3860('0x14')]===0x1f4){logger[_0x3860('0x13')](_0x3860('0x15'),_0x2fb169,_0x365579['error'][_0x3860('0x16')]);return _0x101263(_0x365579[_0x3860('0x13')][_0x3860('0x16')]);}logger[_0x3860('0x13')](_0x3860('0x15'),_0x2fb169,_0x365579[_0x3860('0x13')][_0x3860('0x16')]);return _0x5909b8(_0x365579[_0x3860('0x13')][_0x3860('0x16')]);}else{logger[_0x3860('0xe')](_0x3860('0x15'),_0x2fb169,_0x3860('0xf'));_0x5909b8(_0x365579['result']['message']);}})[_0x3860('0x17')](function(_0x41ce59){logger[_0x3860('0x13')]('SmsMessage,\x20%s,\x20%s',_0x2fb169,_0x41ce59);_0x101263(_0x41ce59);});});}exports[_0x3860('0x18')]=function(_0x145b26){var _0x22e873=this;return new Promise(function(_0x3af33a,_0x20a5b0){return db[_0x3860('0x19')][_0x3860('0x1a')](_0x145b26[_0x3860('0x1b')],{'raw':_0x145b26[_0x3860('0x1c')]?_0x145b26[_0x3860('0x1c')][_0x3860('0x1d')]===undefined?!![]:![]:!![]})[_0x3860('0x1e')](function(_0x280ea9){logger[_0x3860('0xe')](_0x3860('0x18'),_0x145b26);logger['debug'](_0x3860('0x18'),_0x145b26,JSON[_0x3860('0x12')](_0x280ea9));_0x3af33a(_0x280ea9);})[_0x3860('0x17')](function(_0x301e03){logger[_0x3860('0x13')]('CreateSmsMessage',_0x301e03[_0x3860('0x16')],_0x145b26);_0x20a5b0(_0x22e873['error'](0x1f4,_0x301e03['message']));});});}; \ No newline at end of file +var _0x57ca=['jayson/promise','client','http','redis','defaults','localhost','register','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsMessage','create','body','options','raw','then','info','CreateSmsMessage','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x57ca,0x108));var _0xa57c=function(_0x1a1d05,_0x3537f9){_0x1a1d05=_0x1a1d05-0x0;var _0x43997c=_0x57ca[_0x1a1d05];return _0x43997c;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});config[_0xa57c('0xb')]=_[_0xa57c('0xc')](config[_0xa57c('0xb')],{'host':_0xa57c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa57c('0xb')]));require('./smsMessage.socket')[_0xa57c('0xe')](socket);function respondWithRpcPromise(_0x932dcc,_0x4fa5ed,_0x156bca){return new BPromise(function(_0x51f287,_0x554101){return client[_0xa57c('0xf')](_0x932dcc,_0x156bca)['then'](function(_0x2ed4c6){logger['info'](_0xa57c('0x10'),_0x4fa5ed,_0xa57c('0x11'));logger[_0xa57c('0x12')](_0xa57c('0x13'),_0x4fa5ed,_0xa57c('0x11'),JSON['stringify'](_0x2ed4c6));if(_0x2ed4c6[_0xa57c('0x14')]){if(_0x2ed4c6['error'][_0xa57c('0x15')]===0x1f4){logger[_0xa57c('0x14')](_0xa57c('0x10'),_0x4fa5ed,_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x554101(_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);}logger['error'](_0xa57c('0x10'),_0x4fa5ed,_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x51f287(_0x2ed4c6['error'][_0xa57c('0x16')]);}else{logger['info'](_0xa57c('0x10'),_0x4fa5ed,_0xa57c('0x11'));_0x51f287(_0x2ed4c6[_0xa57c('0x17')][_0xa57c('0x16')]);}})[_0xa57c('0x18')](function(_0x4728f9){logger[_0xa57c('0x14')](_0xa57c('0x10'),_0x4fa5ed,_0x4728f9);_0x554101(_0x4728f9);});});}exports['CreateSmsMessage']=function(_0x8a8856){var _0x4a53ab=this;return new Promise(function(_0x4a35bb,_0x418415){return db[_0xa57c('0x19')][_0xa57c('0x1a')](_0x8a8856[_0xa57c('0x1b')],{'raw':_0x8a8856['options']?_0x8a8856[_0xa57c('0x1c')][_0xa57c('0x1d')]===undefined?!![]:![]:!![]})[_0xa57c('0x1e')](function(_0x2213b2){logger[_0xa57c('0x1f')](_0xa57c('0x20'),_0x8a8856);logger[_0xa57c('0x12')](_0xa57c('0x20'),_0x8a8856,JSON[_0xa57c('0x21')](_0x2213b2));_0x4a35bb(_0x2213b2);})[_0xa57c('0x18')](function(_0x382a26){logger[_0xa57c('0x14')](_0xa57c('0x20'),_0x382a26[_0xa57c('0x16')],_0x8a8856);_0x418415(_0x4a53ab[_0xa57c('0x14')](0x1f4,_0x382a26['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 7ea27f5..c28c5d3 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 _0x5166=['register','length','./smsMessage.events','save','remove','update','emit','removeListener'];(function(_0x27380a,_0x11b4db){var _0x49557d=function(_0x11984a){while(--_0x11984a){_0x27380a['push'](_0x27380a['shift']());}};_0x49557d(++_0x11b4db);}(_0x5166,0x14a));var _0x6516=function(_0x32f1db,_0x305c2e){_0x32f1db=_0x32f1db-0x0;var _0x2ce381=_0x5166[_0x32f1db];return _0x2ce381;};'use strict';var SmsMessageEvents=require(_0x6516('0x0'));var events=[_0x6516('0x1'),_0x6516('0x2'),_0x6516('0x3')];function createListener(_0x9a6241,_0x3b8067){return function(_0x37d168){_0x3b8067[_0x6516('0x4')](_0x9a6241,_0x37d168);};}function removeListener(_0x52e876,_0x457fcc){return function(){SmsMessageEvents[_0x6516('0x5')](_0x52e876,_0x457fcc);};}exports[_0x6516('0x6')]=function(_0x1e39ed){for(var _0x31dfee=0x0,_0x11f03e=events[_0x6516('0x7')];_0x31dfee<_0x11f03e;_0x31dfee++){var _0x6d276f=events[_0x31dfee];var _0x15cae3=createListener('smsMessage:'+_0x6d276f,_0x1e39ed);SmsMessageEvents['on'](_0x6d276f,_0x15cae3);}}; \ No newline at end of file +var _0x709e=['smsMessage:','save','remove','emit','register'];(function(_0xeddc72,_0x19af94){var _0x14e8ba=function(_0x253e3a){while(--_0x253e3a){_0xeddc72['push'](_0xeddc72['shift']());}};_0x14e8ba(++_0x19af94);}(_0x709e,0x1e1));var _0xe709=function(_0x4e7024,_0x102b3d){_0x4e7024=_0x4e7024-0x0;var _0x438502=_0x709e[_0x4e7024];return _0x438502;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xe709('0x0'),_0xe709('0x1'),'update'];function createListener(_0x4302ab,_0x3e7a98){return function(_0x1db344){_0x3e7a98[_0xe709('0x2')](_0x4302ab,_0x1db344);};}function removeListener(_0x546334,_0x548812){return function(){SmsMessageEvents['removeListener'](_0x546334,_0x548812);};}exports[_0xe709('0x3')]=function(_0x507a6f){for(var _0x3797ac=0x0,_0x216a66=events['length'];_0x3797ac<_0x216a66;_0x3797ac++){var _0x3bad9a=events[_0x3797ac];var _0x5d4fe4=createListener(_0xe709('0x4')+_0x3bad9a,_0x507a6f);SmsMessageEvents['on'](_0x3bad9a,_0x5d4fe4);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 6c08e4f..923c57b 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 _0xcf12=['../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','update','delete','destroy','removeTeams','removeAgents','util','connect-timeout','express','Router'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xcf12,0x140));var _0x2cf1=function(_0x57ebfb,_0xbaca42){_0x57ebfb=_0x57ebfb-0x0;var _0x56bc11=_0xcf12[_0x57ebfb];return _0x56bc11;};'use strict';var multer=require('multer');var util=require(_0x2cf1('0x0'));var path=require('path');var timeout=require(_0x2cf1('0x1'));var express=require(_0x2cf1('0x2'));var router=express[_0x2cf1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2cf1('0x4'));var config=require(_0x2cf1('0x5'));var controller=require(_0x2cf1('0x6'));router[_0x2cf1('0x7')]('/',auth[_0x2cf1('0x8')](),controller[_0x2cf1('0x9')]);router[_0x2cf1('0x7')](_0x2cf1('0xa'),auth[_0x2cf1('0x8')](),controller['describe']);router[_0x2cf1('0x7')](_0x2cf1('0xb'),auth[_0x2cf1('0x8')](),controller[_0x2cf1('0xc')]);router[_0x2cf1('0x7')](_0x2cf1('0xd'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x2cf1('0xe'),auth['isAuthenticated'](),controller[_0x2cf1('0xf')]);router[_0x2cf1('0x7')](_0x2cf1('0x10'),auth['isAuthenticated'](),controller[_0x2cf1('0x11')]);router['post']('/',auth[_0x2cf1('0x8')](),controller[_0x2cf1('0x12')]);router[_0x2cf1('0x13')](_0x2cf1('0xe'),auth[_0x2cf1('0x8')](),controller[_0x2cf1('0x14')]);router[_0x2cf1('0x13')](_0x2cf1('0x10'),auth[_0x2cf1('0x8')](),controller['addAgents']);router[_0x2cf1('0x15')](_0x2cf1('0xb'),auth['isAuthenticated'](),controller[_0x2cf1('0x16')]);router[_0x2cf1('0x17')](_0x2cf1('0xb'),auth[_0x2cf1('0x8')](),controller[_0x2cf1('0x18')]);router[_0x2cf1('0x17')](_0x2cf1('0xe'),auth[_0x2cf1('0x8')](),controller[_0x2cf1('0x19')]);router[_0x2cf1('0x17')](_0x2cf1('0x10'),auth['isAuthenticated'](),controller[_0x2cf1('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xfb65=['../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x37298f,_0x1610d0){var _0x450a4d=function(_0x583927){while(--_0x583927){_0x37298f['push'](_0x37298f['shift']());}};_0x450a4d(++_0x1610d0);}(_0xfb65,0x82));var _0x5fb6=function(_0x40d92c,_0x1ca5cf){_0x40d92c=_0x40d92c-0x0;var _0x2422e2=_0xfb65[_0x40d92c];return _0x2422e2;};'use strict';var multer=require('multer');var util=require(_0x5fb6('0x0'));var path=require(_0x5fb6('0x1'));var timeout=require('connect-timeout');var express=require(_0x5fb6('0x2'));var router=express['Router']();var auth=require(_0x5fb6('0x3'));var interaction=require(_0x5fb6('0x4'));var config=require(_0x5fb6('0x5'));var controller=require(_0x5fb6('0x6'));router[_0x5fb6('0x7')]('/',auth[_0x5fb6('0x8')](),controller['index']);router['get'](_0x5fb6('0x9'),auth[_0x5fb6('0x8')](),controller[_0x5fb6('0xa')]);router[_0x5fb6('0x7')]('/:id',auth[_0x5fb6('0x8')](),controller[_0x5fb6('0xb')]);router[_0x5fb6('0x7')](_0x5fb6('0xc'),auth['isAuthenticated'](),controller[_0x5fb6('0xd')]);router[_0x5fb6('0x7')]('/:id/teams',auth[_0x5fb6('0x8')](),controller[_0x5fb6('0xe')]);router[_0x5fb6('0x7')](_0x5fb6('0xf'),auth[_0x5fb6('0x8')](),controller['getAgents']);router[_0x5fb6('0x10')]('/',auth[_0x5fb6('0x8')](),controller[_0x5fb6('0x11')]);router[_0x5fb6('0x10')](_0x5fb6('0x12'),auth[_0x5fb6('0x8')](),controller[_0x5fb6('0x13')]);router[_0x5fb6('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0x5fb6('0x14')]);router[_0x5fb6('0x15')]('/:id',auth[_0x5fb6('0x8')](),controller[_0x5fb6('0x16')]);router[_0x5fb6('0x17')]('/:id',auth[_0x5fb6('0x8')](),controller[_0x5fb6('0x18')]);router[_0x5fb6('0x17')](_0x5fb6('0x12'),auth[_0x5fb6('0x8')](),controller[_0x5fb6('0x19')]);router['delete'](_0x5fb6('0xf'),auth['isAuthenticated'](),controller[_0x5fb6('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index c2f637b..c135cd0 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 _0x6bf4=['beepall','sequelize','exports','STRING','ENUM','rrmemory'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x6bf4,0xb5));var _0x46bf=function(_0x51c66a,_0xf4d2b2){_0x51c66a=_0x51c66a-0x0;var _0x1fc782=_0x6bf4[_0x51c66a];return _0x1fc782;};'use strict';var Sequelize=require(_0x46bf('0x0'));module[_0x46bf('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x46bf('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x46bf('0x3')](_0x46bf('0x4'),_0x46bf('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xb3ca=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','STRING','name'];(function(_0x1f603e,_0x335077){var _0x5ed347=function(_0x220cbb){while(--_0x220cbb){_0x1f603e['push'](_0x1f603e['shift']());}};_0x5ed347(++_0x335077);}(_0xb3ca,0x1bd));var _0xab3c=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0xb3ca[_0x7d62cb];return _0x3a6266;};'use strict';var Sequelize=require(_0xab3c('0x0'));module['exports']={'name':{'type':Sequelize[_0xab3c('0x1')],'unique':_0xab3c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xab3c('0x1')]},'timeout':{'type':Sequelize[_0xab3c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xab3c('0x4')](_0xab3c('0x5'),'beepall',_0xab3c('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index fb3d491..4529034 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 _0xef5c=['then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','SmsQueue','rawAttributes','map','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','order','SmsQueueId','UserSmsQueue','UserId','agent','updatedAt','createdAt','smsPause','getTeams','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','forEach','emit','userSmsQueue:save','Team','User','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','userSmsQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update'];(function(_0x4ba10c,_0x75944c){var _0x2d85f4=function(_0x340375){while(--_0x340375){_0x4ba10c['push'](_0x4ba10c['shift']());}};_0x2d85f4(++_0x75944c);}(_0xef5c,0xe4));var _0xcef5=function(_0x470b00,_0x283c28){_0x470b00=_0x470b00-0x0;var _0x2bb6ba=_0xef5c[_0x470b00];return _0x2bb6ba;};'use strict';var pdf=require(_0xcef5('0x0'));var emlformat=require(_0xcef5('0x1'));var rimraf=require(_0xcef5('0x2'));var zipdir=require(_0xcef5('0x3'));var jsonpatch=require(_0xcef5('0x4'));var rp=require('request-promise');var moment=require(_0xcef5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcef5('0x6'));var util=require('util');var path=require(_0xcef5('0x7'));var sox=require(_0xcef5('0x8'));var csv=require(_0xcef5('0x9'));var ejs=require(_0xcef5('0xa'));var fs=require('fs');var _=require(_0xcef5('0xb'));var squel=require(_0xcef5('0xc'));var crypto=require(_0xcef5('0xd'));var jsforce=require(_0xcef5('0xe'));var deskjs=require(_0xcef5('0xf'));var toCsv=require(_0xcef5('0x9'));var querystring=require(_0xcef5('0x10'));var Papa=require(_0xcef5('0x11'));var Redis=require(_0xcef5('0x12'));var authService=require(_0xcef5('0x13'));var qs=require(_0xcef5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcef5('0x15'));var logger=require(_0xcef5('0x16'))(_0xcef5('0x17'));var utils=require(_0xcef5('0x18'));var config=require(_0xcef5('0x19'));var db=require(_0xcef5('0x1a'))['db'];config[_0xcef5('0x1b')]=_['defaults'](config[_0xcef5('0x1b')],{'host':_0xcef5('0x1c'),'port':0x18eb});var socket=require(_0xcef5('0x1d'))(new Redis(config['redis']));require(_0xcef5('0x1e'))[_0xcef5('0x1f')](socket);function respondWithStatusCode(_0x276816,_0x4e50cb){_0x4e50cb=_0x4e50cb||0xcc;return function(_0x2cd653){if(_0x2cd653){return _0x276816[_0xcef5('0x20')](_0x4e50cb);}return _0x276816[_0xcef5('0x21')](_0x4e50cb)[_0xcef5('0x22')]();};}function respondWithResult(_0x2ad4f4,_0x5ac455){_0x5ac455=_0x5ac455||0xc8;return function(_0x23f0da){if(_0x23f0da){return _0x2ad4f4['status'](_0x5ac455)[_0xcef5('0x23')](_0x23f0da);}};}function respondWithFilteredResult(_0x450111,_0x3d325c){return function(_0xdc2ad0){if(_0xdc2ad0){var _0x3e785a=_0xdc2ad0[_0xcef5('0x24')],_0x441844=_0x3d325c[_0xcef5('0x25')],_0x30bc0d=_0x3d325c['offset']+_0x3d325c[_0xcef5('0x26')],_0x36c121;if(_0x30bc0d>=_0x3e785a){_0x30bc0d=_0x3e785a;_0x36c121=0xc8;}else{_0x36c121=0xce;}_0x450111[_0xcef5('0x21')](_0x36c121);return _0x450111[_0xcef5('0x27')](_0xcef5('0x28'),_0x441844+'-'+_0x30bc0d+'/'+_0x3e785a)[_0xcef5('0x23')](_0xdc2ad0);}return null;};}function patchUpdates(_0x468686){return function(_0x2b6aa3){try{jsonpatch['apply'](_0x2b6aa3,_0x468686,!![]);}catch(_0x7e5814){return BPromise[_0xcef5('0x29')](_0x7e5814);}return _0x2b6aa3[_0xcef5('0x2a')]();};}function saveUpdates(_0x242ab6,_0x4d1cc6){return function(_0x1caadf){if(_0x1caadf){return _0x1caadf[_0xcef5('0x2b')](_0x242ab6)[_0xcef5('0x2c')](function(_0x35ff14){return _0x35ff14;});}return null;};}function removeEntity(_0x14ba9c,_0x5b8ec0){return function(_0x39a6f2){if(_0x39a6f2){return _0x39a6f2[_0xcef5('0x2d')]()[_0xcef5('0x2c')](function(){var _0x2cd20b=_0x39a6f2[_0xcef5('0x2e')]({'plain':!![]});var _0x406148=_0xcef5('0x2f');return db[_0xcef5('0x30')][_0xcef5('0x2d')]({'where':{'type':_0x406148,'resourceId':_0x2cd20b['id']}})[_0xcef5('0x2c')](function(){return _0x39a6f2;});})['then'](function(){_0x14ba9c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ee107,_0x46d09f){return function(_0x3caca0){if(!_0x3caca0){_0x1ee107[_0xcef5('0x20')](0x194);}return _0x3caca0;};}function handleError(_0xb6460a,_0x5d7ac6){_0x5d7ac6=_0x5d7ac6||0x1f4;return function(_0x36a267){logger[_0xcef5('0x31')](_0x36a267[_0xcef5('0x32')]);if(_0x36a267['name']){delete _0x36a267[_0xcef5('0x33')];}_0xb6460a[_0xcef5('0x21')](_0x5d7ac6)[_0xcef5('0x34')](_0x36a267);};}exports['index']=function(_0x36e9f3,_0x332760){var _0x58fe3b={},_0xd5ed92={},_0x2d7c91={'count':0x0,'rows':[]};var _0x5b1b36=_['map'](db[_0xcef5('0x35')][_0xcef5('0x36')],function(_0x19bce5){return{'name':_0x19bce5['fieldName'],'type':_0x19bce5['type']['key']};});_0xd5ed92['model']=_[_0xcef5('0x37')](_0x5b1b36,_0xcef5('0x33'));_0xd5ed92[_0xcef5('0x38')]=_['keys'](_0x36e9f3['query']);_0xd5ed92['filters']=_['intersection'](_0xd5ed92[_0xcef5('0x39')],_0xd5ed92[_0xcef5('0x38')]);_0x58fe3b[_0xcef5('0x3a')]=_[_0xcef5('0x3b')](_0xd5ed92['model'],qs['fields'](_0x36e9f3[_0xcef5('0x38')][_0xcef5('0x3c')]));_0x58fe3b['attributes']=_0x58fe3b[_0xcef5('0x3a')][_0xcef5('0x3d')]?_0x58fe3b[_0xcef5('0x3a')]:_0xd5ed92[_0xcef5('0x39')];if(!_0x36e9f3[_0xcef5('0x38')][_0xcef5('0x3e')](_0xcef5('0x3f'))){_0x58fe3b['limit']=qs[_0xcef5('0x26')](_0x36e9f3[_0xcef5('0x38')][_0xcef5('0x26')]);_0x58fe3b[_0xcef5('0x25')]=qs[_0xcef5('0x25')](_0x36e9f3['query'][_0xcef5('0x25')]);}_0x58fe3b['order']=qs[_0xcef5('0x40')](_0x36e9f3[_0xcef5('0x38')]['sort']);_0x58fe3b[_0xcef5('0x41')]=qs[_0xcef5('0x42')](_[_0xcef5('0x43')](_0x36e9f3['query'],_0xd5ed92[_0xcef5('0x42')]),_0x5b1b36);if(_0x36e9f3[_0xcef5('0x38')][_0xcef5('0x44')]){_0x58fe3b['where']=_['merge'](_0x58fe3b[_0xcef5('0x41')],{'$or':_[_0xcef5('0x37')](_0x5b1b36,function(_0x16964f){if(_0x16964f[_0xcef5('0x45')]!==_0xcef5('0x46')){var _0x310ab0={};_0x310ab0[_0x16964f[_0xcef5('0x33')]]={'$like':'%'+_0x36e9f3[_0xcef5('0x38')][_0xcef5('0x44')]+'%'};return _0x310ab0;}})});}_0x58fe3b=_[_0xcef5('0x47')]({},_0x58fe3b,_0x36e9f3[_0xcef5('0x48')]);var _0x2ddc23={'where':_0x58fe3b[_0xcef5('0x41')]};return db[_0xcef5('0x35')][_0xcef5('0x24')](_0x2ddc23)['then'](function(_0x1f5ca9){_0x2d7c91[_0xcef5('0x24')]=_0x1f5ca9;if(_0x36e9f3['query'][_0xcef5('0x49')]){_0x58fe3b[_0xcef5('0x4a')]=[{'all':!![]}];}return db['SmsQueue'][_0xcef5('0x4b')](_0x58fe3b);})['then'](function(_0x5010b8){_0x2d7c91[_0xcef5('0x4c')]=_0x5010b8;return _0x2d7c91;})[_0xcef5('0x2c')](respondWithFilteredResult(_0x332760,_0x58fe3b))[_0xcef5('0x4d')](handleError(_0x332760,null));};exports[_0xcef5('0x4e')]=function(_0x3c2fb5,_0x52f33c){var _0x51ce82={'raw':!![],'where':{'id':_0x3c2fb5[_0xcef5('0x4f')]['id']}},_0x59c1f4={};_0x59c1f4[_0xcef5('0x39')]=_[_0xcef5('0x50')](db['SmsQueue'][_0xcef5('0x36')]);_0x59c1f4[_0xcef5('0x38')]=_['keys'](_0x3c2fb5['query']);_0x59c1f4[_0xcef5('0x42')]=_[_0xcef5('0x3b')](_0x59c1f4[_0xcef5('0x39')],_0x59c1f4[_0xcef5('0x38')]);_0x51ce82[_0xcef5('0x3a')]=_[_0xcef5('0x3b')](_0x59c1f4[_0xcef5('0x39')],qs[_0xcef5('0x3c')](_0x3c2fb5[_0xcef5('0x38')][_0xcef5('0x3c')]));_0x51ce82[_0xcef5('0x3a')]=_0x51ce82[_0xcef5('0x3a')][_0xcef5('0x3d')]?_0x51ce82['attributes']:_0x59c1f4[_0xcef5('0x39')];if(_0x3c2fb5['query'][_0xcef5('0x49')]){_0x51ce82[_0xcef5('0x4a')]=[{'all':!![]}];}_0x51ce82=_[_0xcef5('0x47')]({},_0x51ce82,_0x3c2fb5[_0xcef5('0x48')]);return db[_0xcef5('0x35')][_0xcef5('0x51')](_0x51ce82)['then'](handleEntityNotFound(_0x52f33c,null))[_0xcef5('0x2c')](respondWithResult(_0x52f33c,null))[_0xcef5('0x4d')](handleError(_0x52f33c,null));};exports[_0xcef5('0x52')]=function(_0x755fd8,_0x4b5351){return db['SmsQueue']['create'](_0x755fd8[_0xcef5('0x53')],{})[_0xcef5('0x2c')](function(_0x749b7d){var _0x263a77=_0x755fd8[_0xcef5('0x54')][_0xcef5('0x2e')]({'plain':!![]});if(!_0x263a77)throw new Error(_0xcef5('0x55'));if(_0x263a77['role']===_0xcef5('0x54')){var _0x27f93c=_0x749b7d[_0xcef5('0x2e')]({'plain':!![]});var _0x5c7a23=_0xcef5('0x2f');return db['UserProfileSection'][_0xcef5('0x51')]({'where':{'name':_0x5c7a23,'userProfileId':_0x263a77['userProfileId']},'raw':!![]})[_0xcef5('0x2c')](function(_0x3635d){if(_0x3635d&&_0x3635d[_0xcef5('0x56')]===0x0){return db['UserProfileResource'][_0xcef5('0x52')]({'name':_0x27f93c[_0xcef5('0x33')],'resourceId':_0x27f93c['id'],'type':_0x3635d[_0xcef5('0x33')],'sectionId':_0x3635d['id']},{})['then'](function(){return _0x749b7d;});}else{return _0x749b7d;}})[_0xcef5('0x4d')](function(_0x1fb55c){logger[_0xcef5('0x31')](_0xcef5('0x57'),_0x1fb55c);throw _0x1fb55c;});}return _0x749b7d;})['then'](respondWithResult(_0x4b5351,0xc9))[_0xcef5('0x4d')](handleError(_0x4b5351,null));};exports[_0xcef5('0x2b')]=function(_0x1289ca,_0x112e59){if(_0x1289ca[_0xcef5('0x53')]['id']){delete _0x1289ca[_0xcef5('0x53')]['id'];}return db[_0xcef5('0x35')]['find']({'where':{'id':_0x1289ca[_0xcef5('0x4f')]['id']}})[_0xcef5('0x2c')](handleEntityNotFound(_0x112e59,null))['then'](saveUpdates(_0x1289ca['body'],null))[_0xcef5('0x2c')](respondWithResult(_0x112e59,null))[_0xcef5('0x4d')](handleError(_0x112e59,null));};exports[_0xcef5('0x2d')]=function(_0x358334,_0x363179){return db['SmsQueue'][_0xcef5('0x51')]({'where':{'id':_0x358334['params']['id']}})[_0xcef5('0x2c')](handleEntityNotFound(_0x363179,null))[_0xcef5('0x2c')](removeEntity(_0x363179,null))[_0xcef5('0x4d')](handleError(_0x363179,null));};exports[_0xcef5('0x58')]=function(_0x4b6638,_0x556fb9){return db['SmsQueue'][_0xcef5('0x58')]()['then'](respondWithResult(_0x556fb9,null))[_0xcef5('0x4d')](handleError(_0x556fb9,null));};exports[_0xcef5('0x59')]=function(_0x30d4bc,_0x5b44d7,_0xfc0691){var _0x460c3d={'raw':!![],'where':{}},_0x4dd26d={},_0x23fdef;return db['SmsQueue'][_0xcef5('0x5a')]({'where':{'id':_0x30d4bc['params']['id']}})[_0xcef5('0x2c')](handleEntityNotFound(_0x5b44d7,null))[_0xcef5('0x2c')](function(_0x570ffd){if(_0x570ffd){_0x23fdef=_0x570ffd[_0xcef5('0x2e')]({'plain':!![]});_0x4dd26d[_0xcef5('0x39')]=_['keys'](db['UserSmsQueue'][_0xcef5('0x36')]);_0x4dd26d[_0xcef5('0x38')]=_['keys'](_0x30d4bc[_0xcef5('0x38')]);_0x4dd26d[_0xcef5('0x42')]=_['intersection'](_0x4dd26d[_0xcef5('0x39')],_0x4dd26d[_0xcef5('0x38')]);_0x460c3d[_0xcef5('0x3a')]=_[_0xcef5('0x3b')](_0x4dd26d[_0xcef5('0x39')],qs[_0xcef5('0x3c')](_0x30d4bc[_0xcef5('0x38')][_0xcef5('0x3c')]));_0x460c3d[_0xcef5('0x3a')]=_0x460c3d[_0xcef5('0x3a')][_0xcef5('0x3d')]?_0x460c3d[_0xcef5('0x3a')]:_0x4dd26d['model'];if(!_0x30d4bc[_0xcef5('0x38')][_0xcef5('0x3e')]('nolimit')){_0x460c3d[_0xcef5('0x26')]=qs[_0xcef5('0x26')](_0x30d4bc['query'][_0xcef5('0x26')]);_0x460c3d['offset']=qs[_0xcef5('0x25')](_0x30d4bc['query'][_0xcef5('0x25')]);}_0x460c3d[_0xcef5('0x5b')]=qs['sort'](_0x30d4bc[_0xcef5('0x38')][_0xcef5('0x40')]);_0x460c3d['where']=qs['filters'](_['pick'](_0x30d4bc[_0xcef5('0x38')],_0x4dd26d[_0xcef5('0x42')]));_0x460c3d[_0xcef5('0x41')][_0xcef5('0x5c')]=_0x570ffd['id'];if(_0x30d4bc[_0xcef5('0x38')][_0xcef5('0x44')]){_0x460c3d[_0xcef5('0x41')]=_[_0xcef5('0x47')](_0x460c3d[_0xcef5('0x41')],{'$or':_['map'](_0x460c3d['attributes'],function(_0x4a8105){var _0x474e53={};_0x474e53[_0x4a8105]={'$like':'%'+_0x30d4bc['query'][_0xcef5('0x44')]+'%'};return _0x474e53;})});}_0x460c3d=_[_0xcef5('0x47')]({},_0x460c3d,_0x30d4bc['options']);return db[_0xcef5('0x5d')][_0xcef5('0x4b')](_0x460c3d);}})['then'](function(_0x1bc9b6){if(_0x1bc9b6){return db['User']['findAndCountAll']({'where':{'id':_[_0xcef5('0x37')](_0x1bc9b6,_0xcef5('0x5e')),'role':_0xcef5('0x5f')},'attributes':['id','name','smsPause',_0xcef5('0x60'),_0xcef5('0x61')]});}})[_0xcef5('0x2c')](function(_0x2bcfdc){if(_0x2bcfdc){return{'count':_0x2bcfdc['count'],'rows':_[_0xcef5('0x37')](_0x2bcfdc['rows'],function(_0x1c90da){return{'membername':_0x1c90da[_0xcef5('0x33')],'UserId':_0x1c90da['id'],'queue_name':_0x23fdef[_0xcef5('0x33')],'SmsQueueId':_0x23fdef['id'],'interface':util['format']('%s/%s','SIP',_0x1c90da[_0xcef5('0x33')]),'penalty':0x0,'paused':_0x1c90da[_0xcef5('0x62')],'createdAt':_0x1c90da['createdAt'],'updatedAt':_0x1c90da['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xcef5('0x2c')](respondWithFilteredResult(_0x5b44d7,_0x460c3d))['catch'](handleError(_0x5b44d7,null));};exports[_0xcef5('0x63')]=function(_0xe06974,_0x1087bb,_0x3bc5d0){var _0x19d2f7={};var _0x193fd2={};var _0x5b2b57;var _0x123ddb;return db[_0xcef5('0x35')][_0xcef5('0x5a')]({'where':{'id':_0xe06974['params']['id']}})['then'](handleEntityNotFound(_0x1087bb,null))[_0xcef5('0x2c')](function(_0x4e0841){if(_0x4e0841){_0x5b2b57=_0x4e0841;_0x193fd2[_0xcef5('0x39')]=_[_0xcef5('0x50')](db['Team'][_0xcef5('0x36')]);_0x193fd2[_0xcef5('0x38')]=_[_0xcef5('0x50')](_0xe06974[_0xcef5('0x38')]);_0x193fd2[_0xcef5('0x42')]=_[_0xcef5('0x3b')](_0x193fd2[_0xcef5('0x39')],_0x193fd2['query']);_0x19d2f7[_0xcef5('0x3a')]=_[_0xcef5('0x3b')](_0x193fd2[_0xcef5('0x39')],qs[_0xcef5('0x3c')](_0xe06974[_0xcef5('0x38')][_0xcef5('0x3c')]));_0x19d2f7[_0xcef5('0x3a')]=_0x19d2f7[_0xcef5('0x3a')][_0xcef5('0x3d')]?_0x19d2f7[_0xcef5('0x3a')]:_0x193fd2['model'];_0x19d2f7['order']=qs[_0xcef5('0x40')](_0xe06974[_0xcef5('0x38')][_0xcef5('0x40')]);_0x19d2f7[_0xcef5('0x41')]=qs[_0xcef5('0x42')](_[_0xcef5('0x43')](_0xe06974[_0xcef5('0x38')],_0x193fd2[_0xcef5('0x42')]));if(_0xe06974[_0xcef5('0x38')]['filter']){_0x19d2f7[_0xcef5('0x41')]=_['merge'](_0x19d2f7[_0xcef5('0x41')],{'$or':_[_0xcef5('0x37')](_0x19d2f7['attributes'],function(_0x38b29f){var _0x20bbe2={};_0x20bbe2[_0x38b29f]={'$like':'%'+_0xe06974[_0xcef5('0x38')]['filter']+'%'};return _0x20bbe2;})});}_0x19d2f7=_[_0xcef5('0x47')]({},_0x19d2f7,_0xe06974[_0xcef5('0x48')]);return _0x5b2b57[_0xcef5('0x63')](_0x19d2f7);}})[_0xcef5('0x2c')](function(_0x38de82){if(_0x38de82){_0x123ddb=_0x38de82[_0xcef5('0x3d')];if(!_0xe06974[_0xcef5('0x38')][_0xcef5('0x3e')](_0xcef5('0x3f'))){_0x19d2f7[_0xcef5('0x26')]=qs[_0xcef5('0x26')](_0xe06974[_0xcef5('0x38')][_0xcef5('0x26')]);_0x19d2f7[_0xcef5('0x25')]=qs['offset'](_0xe06974[_0xcef5('0x38')][_0xcef5('0x25')]);}return _0x5b2b57['getTeams'](_0x19d2f7);}})[_0xcef5('0x2c')](function(_0x1c6ceb){if(_0x1c6ceb){return _0x1c6ceb?{'count':_0x123ddb,'rows':_0x1c6ceb}:null;}})['then'](respondWithResult(_0x1087bb,null))['catch'](handleError(_0x1087bb,null));};exports[_0xcef5('0x64')]=function(_0x4b96fa,_0x43bfa1,_0x200c25){var _0x2b0d6c=_0x4b96fa[_0xcef5('0x53')][_0xcef5('0x65')];return db['Team'][_0xcef5('0x4b')]({'where':{'id':_0x2b0d6c},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xcef5('0x33'),'online',_0xcef5('0x66'),_0xcef5('0x67')],'raw':!![]}]})[_0xcef5('0x2c')](function(_0x28c0fe){if(_0x28c0fe){var _0x51d864=_[_0xcef5('0x68')](_0x28c0fe,function(_0x2ee1f8){var _0x2751a2=_0x2ee1f8[_0xcef5('0x2e')]({'plain':!![]});return _0x2751a2[_0xcef5('0x69')];});return db[_0xcef5('0x35')]['find']({'where':{'id':_0x4b96fa[_0xcef5('0x4f')]['id']}})['then'](function(_0x5ef3b7){return db[_0xcef5('0x6a')][_0xcef5('0x6b')](function(_0x505d9e){return _0x5ef3b7[_0xcef5('0x64')](_0x2b0d6c,{'transaction':_0x505d9e})[_0xcef5('0x2c')](function(){return BPromise['each'](_0x51d864,function(_0x1c693e){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x1c693e['id'],'SmsQueueId':_0x4b96fa[_0xcef5('0x4f')]['id']},'transaction':_0x505d9e});});})[_0xcef5('0x2c')](function(){_0x51d864[_0xcef5('0x6c')](function(_0x27ae92){socket[_0xcef5('0x6d')](_0xcef5('0x6e'),{'UserId':_0x27ae92['id'],'SmsQueueId':_0x5ef3b7['id']});});});});});}})[_0xcef5('0x2c')](respondWithStatusCode(_0x43bfa1,null))[_0xcef5('0x4d')](handleError(_0x43bfa1,null));};exports['removeTeams']=function(_0x29f284,_0x37b5ce,_0x1a967f){return db[_0xcef5('0x6f')][_0xcef5('0x4b')]({'where':{'id':_0x29f284[_0xcef5('0x38')][_0xcef5('0x65')]},'attributes':['id'],'include':[{'model':db[_0xcef5('0x70')],'as':_0xcef5('0x69'),'attributes':['id'],'raw':!![]}]})[_0xcef5('0x2c')](handleEntityNotFound(_0x37b5ce,null))['then'](function(_0x28b6f0){var _0x28de4a=_[_0xcef5('0x37')](_0x28b6f0,'id');var _0x5d6d8b=[];var _0x51cae0=[];var _0x4b23e0=squel['select']();_0x4b23e0[_0xcef5('0x71')]('tq.TeamId')[_0xcef5('0x72')](_0xcef5('0x73'),'tq')[_0xcef5('0x74')](_0xcef5('0x75'),'ut',_0xcef5('0x76'))['where']('SmsQueueId\x20=\x20?',_0x29f284[_0xcef5('0x4f')]['id']);for(var _0x5c6b0d=0x0;_0x5c6b0d<_0x28b6f0[_0xcef5('0x3d')];_0x5c6b0d+=0x1){let _0x4c2fda=_0x28b6f0[_0x5c6b0d];for(var _0x1e551b=0x0;_0x1e551b<_0x4c2fda[_0xcef5('0x69')][_0xcef5('0x3d')];_0x1e551b+=0x1){let _0x2ff5a0=_0x4c2fda[_0xcef5('0x69')][_0x1e551b];var _0x1f0e51=_0x4b23e0[_0xcef5('0x77')]();_0x1f0e51[_0xcef5('0x41')](_0xcef5('0x78'),_0x2ff5a0['id']);_0x51cae0[_0xcef5('0x79')](db[_0xcef5('0x6a')][_0xcef5('0x38')](_0x1f0e51['toString'](),{'type':db[_0xcef5('0x6a')][_0xcef5('0x7a')]['SELECT']})[_0xcef5('0x2c')](function(_0x29c3e3){if(_0x29c3e3[_0xcef5('0x3d')]===0x1){return _0x2ff5a0['id'];}else{var _0x30724a=_['every'](_[_0xcef5('0x37')](_0x29c3e3,_0xcef5('0x7b')),function(_0x86f051){return _[_0xcef5('0x7c')](_0x28de4a,_0x86f051);});if(_0x30724a){return _0x2ff5a0['id'];}}}));}}return BPromise['all'](_0x51cae0)[_0xcef5('0x2c')](function(_0x1e43f1){_0x5d6d8b=_(_0x5d6d8b)[_0xcef5('0x7d')](_0x1e43f1)[_0xcef5('0x7e')]()[_0xcef5('0x7f')]();return db['SmsQueue'][_0xcef5('0x51')]({'where':{'id':_0x29f284[_0xcef5('0x4f')]['id']}})[_0xcef5('0x2c')](function(_0x55ecea){return db['sequelize'][_0xcef5('0x6b')](function(_0x41ca4e){return _0x55ecea[_0xcef5('0x80')](_0x29f284[_0xcef5('0x38')]['ids'],{'transaction':_0x41ca4e})[_0xcef5('0x2c')](function(){if(!_[_0xcef5('0x81')](_0x5d6d8b)){return _0x55ecea[_0xcef5('0x82')](_0x5d6d8b,{'transaction':_0x41ca4e});}})[_0xcef5('0x2c')](function(){_0x5d6d8b['forEach'](function(_0xd0f054){socket[_0xcef5('0x6d')]('userSmsQueue:remove',{'UserId':_0xd0f054,'SmsQueueId':_0x55ecea['id']});});});});});});})[_0xcef5('0x2c')](respondWithStatusCode(_0x37b5ce,null))[_0xcef5('0x4d')](handleError(_0x37b5ce,null));};exports[_0xcef5('0x83')]=function(_0x4553a5,_0x3e9ffc,_0x29fda4){return db[_0xcef5('0x35')][_0xcef5('0x51')]({'where':{'id':_0x4553a5[_0xcef5('0x4f')]['id']}})[_0xcef5('0x2c')](handleEntityNotFound(_0x3e9ffc,null))[_0xcef5('0x2c')](function(_0x89ee48){if(_0x89ee48){return _0x89ee48[_0xcef5('0x83')](_0x4553a5[_0xcef5('0x53')][_0xcef5('0x65')],_[_0xcef5('0x84')](_0x4553a5[_0xcef5('0x53')],[_0xcef5('0x65'),'id'])||{})[_0xcef5('0x85')](function(_0x353351){for(var _0x28ccb7=0x0;_0x28ccb7<_0x4553a5[_0xcef5('0x53')][_0xcef5('0x65')]['length'];_0x28ccb7+=0x1){socket[_0xcef5('0x6d')](_0xcef5('0x6e'),{'UserId':_0x4553a5[_0xcef5('0x53')][_0xcef5('0x65')][_0x28ccb7],'SmsQueueId':_0x4553a5[_0xcef5('0x4f')]['id']});}return _0x353351;});}})[_0xcef5('0x2c')](respondWithResult(_0x3e9ffc,null))[_0xcef5('0x4d')](handleError(_0x3e9ffc,null));};exports['removeAgents']=function(_0x5a6e7c,_0x4c6746,_0x4c811f){return db[_0xcef5('0x35')][_0xcef5('0x51')]({'where':{'id':_0x5a6e7c[_0xcef5('0x4f')]['id']}})[_0xcef5('0x2c')](handleEntityNotFound(_0x4c6746,null))[_0xcef5('0x2c')](function(_0x22aed7){if(_0x22aed7){return _0x22aed7[_0xcef5('0x82')](_0x5a6e7c[_0xcef5('0x38')][_0xcef5('0x65')])[_0xcef5('0x2c')](function(){if(_['isArray'](_0x5a6e7c[_0xcef5('0x38')][_0xcef5('0x65')])){for(var _0x1fdfdf=0x0;_0x1fdfdf<_0x5a6e7c[_0xcef5('0x38')]['ids'][_0xcef5('0x3d')];_0x1fdfdf+=0x1){socket['emit'](_0xcef5('0x86'),{'UserId':Number(_0x5a6e7c[_0xcef5('0x38')]['ids'][_0x1fdfdf]),'SmsQueueId':Number(_0x5a6e7c[_0xcef5('0x4f')]['id'])});}}else{socket[_0xcef5('0x6d')](_0xcef5('0x86'),{'UserId':Number(_0x5a6e7c['query'][_0xcef5('0x65')]),'SmsQueueId':Number(_0x5a6e7c[_0xcef5('0x4f')]['id'])});}});}})[_0xcef5('0x2c')](respondWithStatusCode(_0x4c6746,null))[_0xcef5('0x4d')](handleError(_0x4c6746,null));};exports['getAgents']=function(_0x19e058,_0x321027,_0x6adbe9){var _0xba09b2={};var _0x3bede8={};var _0xd6aae0;var _0x316227;return db[_0xcef5('0x35')]['findOne']({'where':{'id':_0x19e058[_0xcef5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x321027,null))['then'](function(_0x4ba502){if(_0x4ba502){_0xd6aae0=_0x4ba502;_0x3bede8['model']=_[_0xcef5('0x50')](db[_0xcef5('0x70')][_0xcef5('0x36')]);_0x3bede8['query']=_[_0xcef5('0x50')](_0x19e058[_0xcef5('0x38')]);_0x3bede8[_0xcef5('0x42')]=_['intersection'](_0x3bede8[_0xcef5('0x39')],_0x3bede8[_0xcef5('0x38')]);_0xba09b2['attributes']=_[_0xcef5('0x3b')](_0x3bede8[_0xcef5('0x39')],qs[_0xcef5('0x3c')](_0x19e058[_0xcef5('0x38')][_0xcef5('0x3c')]));_0xba09b2[_0xcef5('0x3a')]=_0xba09b2[_0xcef5('0x3a')][_0xcef5('0x3d')]?_0xba09b2[_0xcef5('0x3a')]:_0x3bede8['model'];_0xba09b2[_0xcef5('0x5b')]=qs[_0xcef5('0x40')](_0x19e058[_0xcef5('0x38')][_0xcef5('0x40')]);_0xba09b2['where']=qs['filters'](_[_0xcef5('0x43')](_0x19e058[_0xcef5('0x38')],_0x3bede8[_0xcef5('0x42')]));if(_0x19e058['query'][_0xcef5('0x44')]){_0xba09b2[_0xcef5('0x41')]=_[_0xcef5('0x47')](_0xba09b2[_0xcef5('0x41')],{'$or':_[_0xcef5('0x37')](_0xba09b2['attributes'],function(_0x1be9c5){var _0x2b924d={};_0x2b924d[_0x1be9c5]={'$like':'%'+_0x19e058['query'][_0xcef5('0x44')]+'%'};return _0x2b924d;})});}_0xba09b2=_['merge']({},_0xba09b2,_0x19e058['options']);return _0xd6aae0[_0xcef5('0x87')](_0xba09b2);}})[_0xcef5('0x2c')](function(_0x58d500){if(_0x58d500){_0x316227=_0x58d500[_0xcef5('0x3d')];if(!_0x19e058[_0xcef5('0x38')][_0xcef5('0x3e')](_0xcef5('0x3f'))){_0xba09b2[_0xcef5('0x26')]=qs[_0xcef5('0x26')](_0x19e058[_0xcef5('0x38')]['limit']);_0xba09b2['offset']=qs['offset'](_0x19e058[_0xcef5('0x38')]['offset']);}return _0xd6aae0[_0xcef5('0x87')](_0xba09b2);}})[_0xcef5('0x2c')](function(_0x330d3a){if(_0x330d3a){return _0x330d3a?{'count':_0x316227,'rows':_0x330d3a}:null;}})['then'](respondWithResult(_0x321027,null))[_0xcef5('0x4d')](handleError(_0x321027,null));}; \ No newline at end of file +var _0xb27e=['UserProfileResource','sendStatus','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','User','UserId','agent','updatedAt','createdAt','%s/%s','SIP','smsPause','getTeams','findOne','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','status','json','offset','limit','set','apply','reject','then','destroy','get','SmsQueues'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xb27e,0xef));var _0xeb27=function(_0x2327cb,_0x41c339){_0x2327cb=_0x2327cb-0x0;var _0x1e0488=_0xb27e[_0x2327cb];return _0x1e0488;};'use strict';var pdf=require(_0xeb27('0x0'));var emlformat=require(_0xeb27('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeb27('0x2'));var moment=require(_0xeb27('0x3'));var BPromise=require(_0xeb27('0x4'));var Mustache=require(_0xeb27('0x5'));var util=require('util');var path=require('path');var sox=require(_0xeb27('0x6'));var csv=require(_0xeb27('0x7'));var ejs=require(_0xeb27('0x8'));var fs=require('fs');var _=require(_0xeb27('0x9'));var squel=require(_0xeb27('0xa'));var crypto=require(_0xeb27('0xb'));var jsforce=require(_0xeb27('0xc'));var deskjs=require(_0xeb27('0xd'));var toCsv=require('to-csv');var querystring=require(_0xeb27('0xe'));var Papa=require('papaparse');var Redis=require(_0xeb27('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xeb27('0x10'));var as=require(_0xeb27('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb27('0x12'));var utils=require(_0xeb27('0x13'));var config=require(_0xeb27('0x14'));var db=require('../../mysqldb')['db'];config[_0xeb27('0x15')]=_[_0xeb27('0x16')](config[_0xeb27('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb27('0x17'))(new Redis(config[_0xeb27('0x15')]));require(_0xeb27('0x18'))[_0xeb27('0x19')](socket);function respondWithStatusCode(_0x3300f0,_0x5a91ac){_0x5a91ac=_0x5a91ac||0xcc;return function(_0x2d667b){if(_0x2d667b){return _0x3300f0['sendStatus'](_0x5a91ac);}return _0x3300f0['status'](_0x5a91ac)['end']();};}function respondWithResult(_0x5d1d0c,_0x213a67){_0x213a67=_0x213a67||0xc8;return function(_0x1dbde4){if(_0x1dbde4){return _0x5d1d0c[_0xeb27('0x1a')](_0x213a67)[_0xeb27('0x1b')](_0x1dbde4);}};}function respondWithFilteredResult(_0x1ea41c,_0x178295){return function(_0x360b8d){if(_0x360b8d){var _0x4141c2=_0x360b8d['count'],_0x2b303b=_0x178295['offset'],_0x4efbfc=_0x178295[_0xeb27('0x1c')]+_0x178295[_0xeb27('0x1d')],_0x7bfb63;if(_0x4efbfc>=_0x4141c2){_0x4efbfc=_0x4141c2;_0x7bfb63=0xc8;}else{_0x7bfb63=0xce;}_0x1ea41c[_0xeb27('0x1a')](_0x7bfb63);return _0x1ea41c[_0xeb27('0x1e')]('Content-Range',_0x2b303b+'-'+_0x4efbfc+'/'+_0x4141c2)['json'](_0x360b8d);}return null;};}function patchUpdates(_0x29c51a){return function(_0x108231){try{jsonpatch[_0xeb27('0x1f')](_0x108231,_0x29c51a,!![]);}catch(_0x292552){return BPromise[_0xeb27('0x20')](_0x292552);}return _0x108231['save']();};}function saveUpdates(_0x4e3632,_0x3a825d){return function(_0x4a4d37){if(_0x4a4d37){return _0x4a4d37['update'](_0x4e3632)[_0xeb27('0x21')](function(_0xed6493){return _0xed6493;});}return null;};}function removeEntity(_0x4a4a58,_0x3ea9ae){return function(_0x1433f6){if(_0x1433f6){return _0x1433f6[_0xeb27('0x22')]()['then'](function(){var _0x1442fb=_0x1433f6[_0xeb27('0x23')]({'plain':!![]});var _0x2ebc4e=_0xeb27('0x24');return db[_0xeb27('0x25')][_0xeb27('0x22')]({'where':{'type':_0x2ebc4e,'resourceId':_0x1442fb['id']}})['then'](function(){return _0x1433f6;});})['then'](function(){_0x4a4a58['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x215d48,_0x22793b){return function(_0x4bd403){if(!_0x4bd403){_0x215d48[_0xeb27('0x26')](0x194);}return _0x4bd403;};}function handleError(_0x1159ab,_0xb799a7){_0xb799a7=_0xb799a7||0x1f4;return function(_0x4721df){logger[_0xeb27('0x27')](_0x4721df[_0xeb27('0x28')]);if(_0x4721df[_0xeb27('0x29')]){delete _0x4721df['name'];}_0x1159ab[_0xeb27('0x1a')](_0xb799a7)[_0xeb27('0x2a')](_0x4721df);};}exports[_0xeb27('0x2b')]=function(_0x2e16fc,_0x511a9e){var _0x267493={},_0x4c162a={},_0x4d20e6={'count':0x0,'rows':[]};var _0x4cfd73=_[_0xeb27('0x2c')](db[_0xeb27('0x2d')][_0xeb27('0x2e')],function(_0x5971fa){return{'name':_0x5971fa[_0xeb27('0x2f')],'type':_0x5971fa[_0xeb27('0x30')]['key']};});_0x4c162a['model']=_[_0xeb27('0x2c')](_0x4cfd73,'name');_0x4c162a[_0xeb27('0x31')]=_[_0xeb27('0x32')](_0x2e16fc['query']);_0x4c162a[_0xeb27('0x33')]=_[_0xeb27('0x34')](_0x4c162a[_0xeb27('0x35')],_0x4c162a['query']);_0x267493[_0xeb27('0x36')]=_[_0xeb27('0x34')](_0x4c162a[_0xeb27('0x35')],qs['fields'](_0x2e16fc[_0xeb27('0x31')][_0xeb27('0x37')]));_0x267493['attributes']=_0x267493['attributes'][_0xeb27('0x38')]?_0x267493[_0xeb27('0x36')]:_0x4c162a[_0xeb27('0x35')];if(!_0x2e16fc[_0xeb27('0x31')][_0xeb27('0x39')](_0xeb27('0x3a'))){_0x267493[_0xeb27('0x1d')]=qs[_0xeb27('0x1d')](_0x2e16fc[_0xeb27('0x31')][_0xeb27('0x1d')]);_0x267493['offset']=qs[_0xeb27('0x1c')](_0x2e16fc[_0xeb27('0x31')][_0xeb27('0x1c')]);}_0x267493[_0xeb27('0x3b')]=qs[_0xeb27('0x3c')](_0x2e16fc[_0xeb27('0x31')]['sort']);_0x267493[_0xeb27('0x3d')]=qs['filters'](_[_0xeb27('0x3e')](_0x2e16fc[_0xeb27('0x31')],_0x4c162a[_0xeb27('0x33')]),_0x4cfd73);if(_0x2e16fc[_0xeb27('0x31')][_0xeb27('0x3f')]){_0x267493['where']=_['merge'](_0x267493[_0xeb27('0x3d')],{'$or':_['map'](_0x4cfd73,function(_0x52c2dc){if(_0x52c2dc[_0xeb27('0x30')]!==_0xeb27('0x40')){var _0x5d3f01={};_0x5d3f01[_0x52c2dc[_0xeb27('0x29')]]={'$like':'%'+_0x2e16fc[_0xeb27('0x31')][_0xeb27('0x3f')]+'%'};return _0x5d3f01;}})});}_0x267493=_['merge']({},_0x267493,_0x2e16fc[_0xeb27('0x41')]);var _0x40a8d0={'where':_0x267493[_0xeb27('0x3d')]};return db[_0xeb27('0x2d')][_0xeb27('0x42')](_0x40a8d0)[_0xeb27('0x21')](function(_0x1f3824){_0x4d20e6[_0xeb27('0x42')]=_0x1f3824;if(_0x2e16fc['query'][_0xeb27('0x43')]){_0x267493[_0xeb27('0x44')]=[{'all':!![]}];}return db[_0xeb27('0x2d')][_0xeb27('0x45')](_0x267493);})['then'](function(_0x5238fd){_0x4d20e6[_0xeb27('0x46')]=_0x5238fd;return _0x4d20e6;})[_0xeb27('0x21')](respondWithFilteredResult(_0x511a9e,_0x267493))[_0xeb27('0x47')](handleError(_0x511a9e,null));};exports['show']=function(_0x554484,_0x332e1c){var _0x1b0d1f={'raw':!![],'where':{'id':_0x554484[_0xeb27('0x48')]['id']}},_0x29ad16={};_0x29ad16['model']=_[_0xeb27('0x32')](db[_0xeb27('0x2d')][_0xeb27('0x2e')]);_0x29ad16[_0xeb27('0x31')]=_[_0xeb27('0x32')](_0x554484[_0xeb27('0x31')]);_0x29ad16[_0xeb27('0x33')]=_[_0xeb27('0x34')](_0x29ad16['model'],_0x29ad16[_0xeb27('0x31')]);_0x1b0d1f[_0xeb27('0x36')]=_[_0xeb27('0x34')](_0x29ad16[_0xeb27('0x35')],qs[_0xeb27('0x37')](_0x554484['query'][_0xeb27('0x37')]));_0x1b0d1f[_0xeb27('0x36')]=_0x1b0d1f['attributes'][_0xeb27('0x38')]?_0x1b0d1f[_0xeb27('0x36')]:_0x29ad16[_0xeb27('0x35')];if(_0x554484[_0xeb27('0x31')][_0xeb27('0x43')]){_0x1b0d1f[_0xeb27('0x44')]=[{'all':!![]}];}_0x1b0d1f=_[_0xeb27('0x49')]({},_0x1b0d1f,_0x554484[_0xeb27('0x41')]);return db[_0xeb27('0x2d')][_0xeb27('0x4a')](_0x1b0d1f)[_0xeb27('0x21')](handleEntityNotFound(_0x332e1c,null))[_0xeb27('0x21')](respondWithResult(_0x332e1c,null))[_0xeb27('0x47')](handleError(_0x332e1c,null));};exports['create']=function(_0x4335f5,_0x5c8c79){return db['SmsQueue'][_0xeb27('0x4b')](_0x4335f5[_0xeb27('0x4c')],{})['then'](function(_0x4ece47){var _0x81b7c1=_0x4335f5[_0xeb27('0x4d')][_0xeb27('0x23')]({'plain':!![]});if(!_0x81b7c1)throw new Error(_0xeb27('0x4e'));if(_0x81b7c1[_0xeb27('0x4f')]==='user'){var _0x5d8fcb=_0x4ece47[_0xeb27('0x23')]({'plain':!![]});var _0x339f2b=_0xeb27('0x24');return db['UserProfileSection'][_0xeb27('0x4a')]({'where':{'name':_0x339f2b,'userProfileId':_0x81b7c1['userProfileId']},'raw':!![]})['then'](function(_0x53ec3a){if(_0x53ec3a&&_0x53ec3a[_0xeb27('0x50')]===0x0){return db[_0xeb27('0x25')][_0xeb27('0x4b')]({'name':_0x5d8fcb[_0xeb27('0x29')],'resourceId':_0x5d8fcb['id'],'type':_0x53ec3a[_0xeb27('0x29')],'sectionId':_0x53ec3a['id']},{})[_0xeb27('0x21')](function(){return _0x4ece47;});}else{return _0x4ece47;}})['catch'](function(_0x21a4bf){logger['error'](_0xeb27('0x51'),_0x21a4bf);throw _0x21a4bf;});}return _0x4ece47;})[_0xeb27('0x21')](respondWithResult(_0x5c8c79,0xc9))['catch'](handleError(_0x5c8c79,null));};exports[_0xeb27('0x52')]=function(_0x570af8,_0x153b1d){if(_0x570af8[_0xeb27('0x4c')]['id']){delete _0x570af8['body']['id'];}return db[_0xeb27('0x2d')][_0xeb27('0x4a')]({'where':{'id':_0x570af8[_0xeb27('0x48')]['id']}})[_0xeb27('0x21')](handleEntityNotFound(_0x153b1d,null))[_0xeb27('0x21')](saveUpdates(_0x570af8[_0xeb27('0x4c')],null))[_0xeb27('0x21')](respondWithResult(_0x153b1d,null))[_0xeb27('0x47')](handleError(_0x153b1d,null));};exports['destroy']=function(_0x47a79b,_0x393dfe){return db['SmsQueue']['find']({'where':{'id':_0x47a79b[_0xeb27('0x48')]['id']}})['then'](handleEntityNotFound(_0x393dfe,null))[_0xeb27('0x21')](removeEntity(_0x393dfe,null))[_0xeb27('0x47')](handleError(_0x393dfe,null));};exports[_0xeb27('0x53')]=function(_0x32ba1c,_0x348eae){return db[_0xeb27('0x2d')][_0xeb27('0x53')]()[_0xeb27('0x21')](respondWithResult(_0x348eae,null))[_0xeb27('0x47')](handleError(_0x348eae,null));};exports[_0xeb27('0x54')]=function(_0x59a1bd,_0x25984f,_0x3160f2){var _0x4f29b2={'raw':!![],'where':{}},_0x41f802={},_0x390e2a;return db[_0xeb27('0x2d')]['findOne']({'where':{'id':_0x59a1bd[_0xeb27('0x48')]['id']}})['then'](handleEntityNotFound(_0x25984f,null))[_0xeb27('0x21')](function(_0x923b25){if(_0x923b25){_0x390e2a=_0x923b25['get']({'plain':!![]});_0x41f802['model']=_[_0xeb27('0x32')](db['UserSmsQueue']['rawAttributes']);_0x41f802['query']=_[_0xeb27('0x32')](_0x59a1bd[_0xeb27('0x31')]);_0x41f802[_0xeb27('0x33')]=_['intersection'](_0x41f802[_0xeb27('0x35')],_0x41f802[_0xeb27('0x31')]);_0x4f29b2['attributes']=_[_0xeb27('0x34')](_0x41f802[_0xeb27('0x35')],qs[_0xeb27('0x37')](_0x59a1bd[_0xeb27('0x31')]['fields']));_0x4f29b2[_0xeb27('0x36')]=_0x4f29b2['attributes'][_0xeb27('0x38')]?_0x4f29b2[_0xeb27('0x36')]:_0x41f802[_0xeb27('0x35')];if(!_0x59a1bd['query'][_0xeb27('0x39')]('nolimit')){_0x4f29b2[_0xeb27('0x1d')]=qs[_0xeb27('0x1d')](_0x59a1bd[_0xeb27('0x31')][_0xeb27('0x1d')]);_0x4f29b2['offset']=qs['offset'](_0x59a1bd[_0xeb27('0x31')][_0xeb27('0x1c')]);}_0x4f29b2[_0xeb27('0x3b')]=qs[_0xeb27('0x3c')](_0x59a1bd[_0xeb27('0x31')]['sort']);_0x4f29b2['where']=qs['filters'](_['pick'](_0x59a1bd['query'],_0x41f802[_0xeb27('0x33')]));_0x4f29b2[_0xeb27('0x3d')]['SmsQueueId']=_0x923b25['id'];if(_0x59a1bd[_0xeb27('0x31')][_0xeb27('0x3f')]){_0x4f29b2['where']=_[_0xeb27('0x49')](_0x4f29b2[_0xeb27('0x3d')],{'$or':_[_0xeb27('0x2c')](_0x4f29b2[_0xeb27('0x36')],function(_0x9a2188){var _0x407fc5={};_0x407fc5[_0x9a2188]={'$like':'%'+_0x59a1bd[_0xeb27('0x31')][_0xeb27('0x3f')]+'%'};return _0x407fc5;})});}_0x4f29b2=_['merge']({},_0x4f29b2,_0x59a1bd[_0xeb27('0x41')]);return db['UserSmsQueue'][_0xeb27('0x45')](_0x4f29b2);}})[_0xeb27('0x21')](function(_0x20bd9e){if(_0x20bd9e){return db[_0xeb27('0x55')]['findAndCountAll']({'where':{'id':_[_0xeb27('0x2c')](_0x20bd9e,_0xeb27('0x56')),'role':_0xeb27('0x57')},'attributes':['id','name','smsPause',_0xeb27('0x58'),_0xeb27('0x59')]});}})['then'](function(_0x1a29f6){if(_0x1a29f6){return{'count':_0x1a29f6[_0xeb27('0x42')],'rows':_[_0xeb27('0x2c')](_0x1a29f6[_0xeb27('0x46')],function(_0x4b2ecd){return{'membername':_0x4b2ecd[_0xeb27('0x29')],'UserId':_0x4b2ecd['id'],'queue_name':_0x390e2a[_0xeb27('0x29')],'SmsQueueId':_0x390e2a['id'],'interface':util['format'](_0xeb27('0x5a'),_0xeb27('0x5b'),_0x4b2ecd['name']),'penalty':0x0,'paused':_0x4b2ecd[_0xeb27('0x5c')],'createdAt':_0x4b2ecd['createdAt'],'updatedAt':_0x4b2ecd[_0xeb27('0x58')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x25984f,_0x4f29b2))[_0xeb27('0x47')](handleError(_0x25984f,null));};exports[_0xeb27('0x5d')]=function(_0xf9d86a,_0x8986,_0x1390a1){var _0x1745cf={};var _0x116cb9={};var _0x434792;var _0x6f4204;return db[_0xeb27('0x2d')][_0xeb27('0x5e')]({'where':{'id':_0xf9d86a[_0xeb27('0x48')]['id']}})['then'](handleEntityNotFound(_0x8986,null))[_0xeb27('0x21')](function(_0x3408bc){if(_0x3408bc){_0x434792=_0x3408bc;_0x116cb9[_0xeb27('0x35')]=_[_0xeb27('0x32')](db[_0xeb27('0x5f')][_0xeb27('0x2e')]);_0x116cb9[_0xeb27('0x31')]=_[_0xeb27('0x32')](_0xf9d86a[_0xeb27('0x31')]);_0x116cb9[_0xeb27('0x33')]=_[_0xeb27('0x34')](_0x116cb9[_0xeb27('0x35')],_0x116cb9['query']);_0x1745cf[_0xeb27('0x36')]=_[_0xeb27('0x34')](_0x116cb9[_0xeb27('0x35')],qs[_0xeb27('0x37')](_0xf9d86a['query'][_0xeb27('0x37')]));_0x1745cf['attributes']=_0x1745cf[_0xeb27('0x36')][_0xeb27('0x38')]?_0x1745cf[_0xeb27('0x36')]:_0x116cb9[_0xeb27('0x35')];_0x1745cf['order']=qs[_0xeb27('0x3c')](_0xf9d86a[_0xeb27('0x31')][_0xeb27('0x3c')]);_0x1745cf['where']=qs[_0xeb27('0x33')](_[_0xeb27('0x3e')](_0xf9d86a[_0xeb27('0x31')],_0x116cb9[_0xeb27('0x33')]));if(_0xf9d86a[_0xeb27('0x31')][_0xeb27('0x3f')]){_0x1745cf[_0xeb27('0x3d')]=_[_0xeb27('0x49')](_0x1745cf['where'],{'$or':_['map'](_0x1745cf[_0xeb27('0x36')],function(_0x3b9781){var _0x31b6de={};_0x31b6de[_0x3b9781]={'$like':'%'+_0xf9d86a[_0xeb27('0x31')]['filter']+'%'};return _0x31b6de;})});}_0x1745cf=_[_0xeb27('0x49')]({},_0x1745cf,_0xf9d86a[_0xeb27('0x41')]);return _0x434792[_0xeb27('0x5d')](_0x1745cf);}})[_0xeb27('0x21')](function(_0x1b85fc){if(_0x1b85fc){_0x6f4204=_0x1b85fc['length'];if(!_0xf9d86a[_0xeb27('0x31')]['hasOwnProperty']('nolimit')){_0x1745cf[_0xeb27('0x1d')]=qs[_0xeb27('0x1d')](_0xf9d86a['query']['limit']);_0x1745cf[_0xeb27('0x1c')]=qs['offset'](_0xf9d86a[_0xeb27('0x31')]['offset']);}return _0x434792[_0xeb27('0x5d')](_0x1745cf);}})[_0xeb27('0x21')](function(_0x40380a){if(_0x40380a){return _0x40380a?{'count':_0x6f4204,'rows':_0x40380a}:null;}})[_0xeb27('0x21')](respondWithResult(_0x8986,null))[_0xeb27('0x47')](handleError(_0x8986,null));};exports[_0xeb27('0x60')]=function(_0x57b088,_0xa5e6ee,_0x43ac45){var _0x485898=_0x57b088[_0xeb27('0x4c')][_0xeb27('0x61')];return db[_0xeb27('0x5f')][_0xeb27('0x45')]({'where':{'id':_0x485898},'attributes':['id'],'include':[{'model':db[_0xeb27('0x55')],'as':'Agents','attributes':['id',_0xeb27('0x29'),_0xeb27('0x62'),_0xeb27('0x63'),_0xeb27('0x64')],'raw':!![]}]})['then'](function(_0x29a38e){if(_0x29a38e){var _0x26f23b=_[_0xeb27('0x65')](_0x29a38e,function(_0xb1bd20){var _0x2afc45=_0xb1bd20['get']({'plain':!![]});return _0x2afc45[_0xeb27('0x66')];});return db['SmsQueue'][_0xeb27('0x4a')]({'where':{'id':_0x57b088[_0xeb27('0x48')]['id']}})[_0xeb27('0x21')](function(_0x401b74){return db[_0xeb27('0x67')]['transaction'](function(_0x166873){return _0x401b74[_0xeb27('0x60')](_0x485898,{'transaction':_0x166873})[_0xeb27('0x21')](function(){return BPromise[_0xeb27('0x68')](_0x26f23b,function(_0x2362d0){return db['UserSmsQueue'][_0xeb27('0x69')]({'where':{'UserId':_0x2362d0['id'],'SmsQueueId':_0x57b088[_0xeb27('0x48')]['id']},'transaction':_0x166873});});})[_0xeb27('0x21')](function(){_0x26f23b[_0xeb27('0x6a')](function(_0x31e541){socket[_0xeb27('0x6b')](_0xeb27('0x6c'),{'UserId':_0x31e541['id'],'SmsQueueId':_0x401b74['id']});});});});});}})[_0xeb27('0x21')](respondWithStatusCode(_0xa5e6ee,null))[_0xeb27('0x47')](handleError(_0xa5e6ee,null));};exports[_0xeb27('0x6d')]=function(_0x31365c,_0x1722bb,_0x311a4c){return db[_0xeb27('0x5f')][_0xeb27('0x45')]({'where':{'id':_0x31365c[_0xeb27('0x31')][_0xeb27('0x61')]},'attributes':['id'],'include':[{'model':db[_0xeb27('0x55')],'as':_0xeb27('0x66'),'attributes':['id'],'raw':!![]}]})[_0xeb27('0x21')](handleEntityNotFound(_0x1722bb,null))['then'](function(_0x3cea7a){var _0xe40163=_['map'](_0x3cea7a,'id');var _0x47f3a4=[];var _0x26c11a=[];var _0xb7efb4=squel['select']();_0xb7efb4['field'](_0xeb27('0x6e'))[_0xeb27('0x6f')](_0xeb27('0x70'),'tq')[_0xeb27('0x71')](_0xeb27('0x72'),'ut',_0xeb27('0x73'))['where'](_0xeb27('0x74'),_0x31365c[_0xeb27('0x48')]['id']);for(var _0x519b1e=0x0;_0x519b1e<_0x3cea7a[_0xeb27('0x38')];_0x519b1e+=0x1){let _0x8d8484=_0x3cea7a[_0x519b1e];for(var _0x56b6c6=0x0;_0x56b6c6<_0x8d8484[_0xeb27('0x66')][_0xeb27('0x38')];_0x56b6c6+=0x1){let _0x4bbff8=_0x8d8484[_0xeb27('0x66')][_0x56b6c6];var _0x3f9e5b=_0xb7efb4[_0xeb27('0x75')]();_0x3f9e5b[_0xeb27('0x3d')](_0xeb27('0x76'),_0x4bbff8['id']);_0x26c11a[_0xeb27('0x77')](db[_0xeb27('0x67')]['query'](_0x3f9e5b[_0xeb27('0x78')](),{'type':db[_0xeb27('0x67')][_0xeb27('0x79')][_0xeb27('0x7a')]})[_0xeb27('0x21')](function(_0xb63f6e){if(_0xb63f6e[_0xeb27('0x38')]===0x1){return _0x4bbff8['id'];}else{var _0x3fd907=_[_0xeb27('0x7b')](_['map'](_0xb63f6e,_0xeb27('0x7c')),function(_0x3c71e9){return _[_0xeb27('0x7d')](_0xe40163,_0x3c71e9);});if(_0x3fd907){return _0x4bbff8['id'];}}}));}}return BPromise[_0xeb27('0x7e')](_0x26c11a)['then'](function(_0x377ef2){_0x47f3a4=_(_0x47f3a4)[_0xeb27('0x7f')](_0x377ef2)[_0xeb27('0x80')]()[_0xeb27('0x81')]();return db[_0xeb27('0x2d')][_0xeb27('0x4a')]({'where':{'id':_0x31365c['params']['id']}})[_0xeb27('0x21')](function(_0x5e9e64){return db['sequelize'][_0xeb27('0x82')](function(_0x3a9240){return _0x5e9e64[_0xeb27('0x6d')](_0x31365c[_0xeb27('0x31')][_0xeb27('0x61')],{'transaction':_0x3a9240})[_0xeb27('0x21')](function(){if(!_[_0xeb27('0x83')](_0x47f3a4)){return _0x5e9e64[_0xeb27('0x84')](_0x47f3a4,{'transaction':_0x3a9240});}})[_0xeb27('0x21')](function(){_0x47f3a4[_0xeb27('0x6a')](function(_0x5766f7){socket[_0xeb27('0x6b')](_0xeb27('0x85'),{'UserId':_0x5766f7,'SmsQueueId':_0x5e9e64['id']});});});});});});})['then'](respondWithStatusCode(_0x1722bb,null))[_0xeb27('0x47')](handleError(_0x1722bb,null));};exports[_0xeb27('0x86')]=function(_0x53c7a9,_0x433312,_0x328596){return db[_0xeb27('0x2d')][_0xeb27('0x4a')]({'where':{'id':_0x53c7a9[_0xeb27('0x48')]['id']}})['then'](handleEntityNotFound(_0x433312,null))[_0xeb27('0x21')](function(_0x11b3d8){if(_0x11b3d8){return _0x11b3d8[_0xeb27('0x86')](_0x53c7a9['body'][_0xeb27('0x61')],_[_0xeb27('0x87')](_0x53c7a9[_0xeb27('0x4c')],[_0xeb27('0x61'),'id'])||{})[_0xeb27('0x88')](function(_0x2113eb){for(var _0x227877=0x0;_0x227877<_0x53c7a9[_0xeb27('0x4c')]['ids']['length'];_0x227877+=0x1){socket[_0xeb27('0x6b')]('userSmsQueue:save',{'UserId':_0x53c7a9[_0xeb27('0x4c')][_0xeb27('0x61')][_0x227877],'SmsQueueId':_0x53c7a9[_0xeb27('0x48')]['id']});}return _0x2113eb;});}})['then'](respondWithResult(_0x433312,null))['catch'](handleError(_0x433312,null));};exports[_0xeb27('0x84')]=function(_0x5a455b,_0x5b2cd2,_0x7d4e90){return db[_0xeb27('0x2d')][_0xeb27('0x4a')]({'where':{'id':_0x5a455b['params']['id']}})[_0xeb27('0x21')](handleEntityNotFound(_0x5b2cd2,null))[_0xeb27('0x21')](function(_0xe8bb25){if(_0xe8bb25){return _0xe8bb25[_0xeb27('0x84')](_0x5a455b[_0xeb27('0x31')][_0xeb27('0x61')])[_0xeb27('0x21')](function(){if(_['isArray'](_0x5a455b[_0xeb27('0x31')][_0xeb27('0x61')])){for(var _0x49aed2=0x0;_0x49aed2<_0x5a455b[_0xeb27('0x31')]['ids']['length'];_0x49aed2+=0x1){socket[_0xeb27('0x6b')]('userSmsQueue:remove',{'UserId':Number(_0x5a455b['query'][_0xeb27('0x61')][_0x49aed2]),'SmsQueueId':Number(_0x5a455b[_0xeb27('0x48')]['id'])});}}else{socket[_0xeb27('0x6b')](_0xeb27('0x85'),{'UserId':Number(_0x5a455b['query']['ids']),'SmsQueueId':Number(_0x5a455b[_0xeb27('0x48')]['id'])});}});}})[_0xeb27('0x21')](respondWithStatusCode(_0x5b2cd2,null))[_0xeb27('0x47')](handleError(_0x5b2cd2,null));};exports[_0xeb27('0x89')]=function(_0x391acb,_0x22a69d,_0xca2c1c){var _0x564834={};var _0x3ec54d={};var _0x58094a;var _0x3192b4;return db['SmsQueue'][_0xeb27('0x5e')]({'where':{'id':_0x391acb[_0xeb27('0x48')]['id']}})[_0xeb27('0x21')](handleEntityNotFound(_0x22a69d,null))['then'](function(_0x3e8e2f){if(_0x3e8e2f){_0x58094a=_0x3e8e2f;_0x3ec54d[_0xeb27('0x35')]=_[_0xeb27('0x32')](db[_0xeb27('0x55')]['rawAttributes']);_0x3ec54d[_0xeb27('0x31')]=_[_0xeb27('0x32')](_0x391acb[_0xeb27('0x31')]);_0x3ec54d['filters']=_['intersection'](_0x3ec54d['model'],_0x3ec54d[_0xeb27('0x31')]);_0x564834[_0xeb27('0x36')]=_[_0xeb27('0x34')](_0x3ec54d[_0xeb27('0x35')],qs[_0xeb27('0x37')](_0x391acb[_0xeb27('0x31')]['fields']));_0x564834[_0xeb27('0x36')]=_0x564834['attributes'][_0xeb27('0x38')]?_0x564834[_0xeb27('0x36')]:_0x3ec54d['model'];_0x564834['order']=qs[_0xeb27('0x3c')](_0x391acb[_0xeb27('0x31')][_0xeb27('0x3c')]);_0x564834['where']=qs[_0xeb27('0x33')](_[_0xeb27('0x3e')](_0x391acb[_0xeb27('0x31')],_0x3ec54d[_0xeb27('0x33')]));if(_0x391acb[_0xeb27('0x31')][_0xeb27('0x3f')]){_0x564834[_0xeb27('0x3d')]=_[_0xeb27('0x49')](_0x564834[_0xeb27('0x3d')],{'$or':_['map'](_0x564834[_0xeb27('0x36')],function(_0x365e99){var _0x38b7ee={};_0x38b7ee[_0x365e99]={'$like':'%'+_0x391acb[_0xeb27('0x31')][_0xeb27('0x3f')]+'%'};return _0x38b7ee;})});}_0x564834=_['merge']({},_0x564834,_0x391acb[_0xeb27('0x41')]);return _0x58094a[_0xeb27('0x89')](_0x564834);}})[_0xeb27('0x21')](function(_0x2bff64){if(_0x2bff64){_0x3192b4=_0x2bff64[_0xeb27('0x38')];if(!_0x391acb[_0xeb27('0x31')][_0xeb27('0x39')]('nolimit')){_0x564834[_0xeb27('0x1d')]=qs['limit'](_0x391acb[_0xeb27('0x31')][_0xeb27('0x1d')]);_0x564834['offset']=qs['offset'](_0x391acb[_0xeb27('0x31')]['offset']);}return _0x58094a['getAgents'](_0x564834);}})[_0xeb27('0x21')](function(_0xcb7604){if(_0xcb7604){return _0xcb7604?{'count':_0x3192b4,'rows':_0xcb7604}:null;}})[_0xeb27('0x21')](respondWithResult(_0x22a69d,null))[_0xeb27('0x47')](handleError(_0x22a69d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 05b062f..a8f6a86 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 _0x6916=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsQueue'];(function(_0x139b72,_0x23d6b3){var _0x3ac775=function(_0x2f95e8){while(--_0x2f95e8){_0x139b72['push'](_0x139b72['shift']());}};_0x3ac775(++_0x23d6b3);}(_0x6916,0x1ed));var _0x6691=function(_0x165af2,_0x40b8bb){_0x165af2=_0x165af2-0x0;var _0x3b0975=_0x6916[_0x165af2];return _0x3b0975;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x6691('0x0'))['db'][_0x6691('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x6691('0x2')](0x0);var events={'afterCreate':_0x6691('0x3'),'afterUpdate':'update','afterDestroy':_0x6691('0x4')};function emitEvent(_0x2633df){return function(_0x1b3613,_0x4f5985,_0x5c62f4){SmsQueueEvents[_0x6691('0x5')](_0x2633df+':'+_0x1b3613['id'],_0x1b3613);SmsQueueEvents[_0x6691('0x5')](_0x2633df,_0x1b3613);_0x5c62f4(null);};}for(var e in events){if(events[_0x6691('0x6')](e)){var event=events[e];SmsQueue[_0x6691('0x7')](e,emitEvent(event));}}module[_0x6691('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x9861=['remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update'];(function(_0x33941e,_0x175e48){var _0x55389e=function(_0x601cd3){while(--_0x601cd3){_0x33941e['push'](_0x33941e['shift']());}};_0x55389e(++_0x175e48);}(_0x9861,0x176));var _0x1986=function(_0x390709,_0x427a34){_0x390709=_0x390709-0x0;var _0x361869=_0x9861[_0x390709];return _0x361869;};'use strict';var EventEmitter=require(_0x1986('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1986('0x1')](0x0);var events={'afterCreate':_0x1986('0x2'),'afterUpdate':_0x1986('0x3'),'afterDestroy':_0x1986('0x4')};function emitEvent(_0x2c59a4){return function(_0x44e5c9,_0x5462a7,_0xe033ef){SmsQueueEvents[_0x1986('0x5')](_0x2c59a4+':'+_0x44e5c9['id'],_0x44e5c9);SmsQueueEvents[_0x1986('0x5')](_0x2c59a4,_0x44e5c9);_0xe033ef(null);};}for(var e in events){if(events[_0x1986('0x6')](e)){var event=events[e];SmsQueue[_0x1986('0x7')](e,emitEvent(event));}}module[_0x1986('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index ad44f8a..153ac93 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 _0xebd9=['define','sms_queues','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x587067,_0xcb9dc1){var _0x12f252=function(_0x520470){while(--_0x520470){_0x587067['push'](_0x587067['shift']());}};_0x12f252(++_0xcb9dc1);}(_0xebd9,0x1b0));var _0x9ebd=function(_0x32a41b,_0x47c931){_0x32a41b=_0x32a41b-0x0;var _0x5f029e=_0xebd9[_0x32a41b];return _0x5f029e;};'use strict';var _=require('lodash');var util=require(_0x9ebd('0x0'));var logger=require(_0x9ebd('0x1'))(_0x9ebd('0x2'));var moment=require('moment');var BPromise=require(_0x9ebd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ebd('0x4'));var rimraf=require(_0x9ebd('0x5'));var config=require(_0x9ebd('0x6'));var attributes=require(_0x9ebd('0x7'));module['exports']=function(_0x32ef65,_0x386363){return _0x32ef65[_0x9ebd('0x8')]('SmsQueue',attributes,{'tableName':_0x9ebd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6b3=['api','moment','request-promise','path','../../config/environment','exports','define','SmsQueue','lodash','util','../../config/logger'];(function(_0xd31f31,_0x1cb09f){var _0x20adad=function(_0x24a438){while(--_0x24a438){_0xd31f31['push'](_0xd31f31['shift']());}};_0x20adad(++_0x1cb09f);}(_0xb6b3,0x76));var _0x3b6b=function(_0x36dbb4,_0x7093e){_0x36dbb4=_0x36dbb4-0x0;var _0x3722b3=_0xb6b3[_0x36dbb4];return _0x3722b3;};'use strict';var _=require(_0x3b6b('0x0'));var util=require(_0x3b6b('0x1'));var logger=require(_0x3b6b('0x2'))(_0x3b6b('0x3'));var moment=require(_0x3b6b('0x4'));var BPromise=require('bluebird');var rp=require(_0x3b6b('0x5'));var fs=require('fs');var path=require(_0x3b6b('0x6'));var rimraf=require('rimraf');var config=require(_0x3b6b('0x7'));var attributes=require('./smsQueue.attributes');module[_0x3b6b('0x8')]=function(_0x39f562,_0x41edf7){return _0x39f562[_0x3b6b('0x9')](_0x3b6b('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 51505dc..ee94632 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 _0x4545=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue','options','where','attributes','include','map','model','ShowSmsQueue','SmsQueue','find','raw','lodash','util'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0x4545,0xcb));var _0x5454=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4545[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x5454('0x0'));var util=require(_0x5454('0x1'));var moment=require(_0x5454('0x2'));var BPromise=require(_0x5454('0x3'));var rs=require(_0x5454('0x4'));var fs=require('fs');var Redis=require(_0x5454('0x5'));var db=require(_0x5454('0x6'))['db'];var utils=require(_0x5454('0x7'));var logger=require(_0x5454('0x8'))(_0x5454('0x9'));var config=require(_0x5454('0xa'));var jayson=require(_0x5454('0xb'));var client=jayson[_0x5454('0xc')]['http']({'port':0x232a});config['redis']=_[_0x5454('0xd')](config[_0x5454('0xe')],{'host':_0x5454('0xf'),'port':0x18eb});var socket=require(_0x5454('0x10'))(new Redis(config[_0x5454('0xe')]));require('./smsQueue.socket')[_0x5454('0x11')](socket);function respondWithRpcPromise(_0x3aa477,_0x1ee19f,_0xfedcb0){return new BPromise(function(_0x1bfc87,_0x333b7e){return client[_0x5454('0x12')](_0x3aa477,_0xfedcb0)[_0x5454('0x13')](function(_0x330220){logger[_0x5454('0x14')]('SmsQueue,\x20%s,\x20%s',_0x1ee19f,_0x5454('0x15'));logger[_0x5454('0x16')](_0x5454('0x17'),_0x1ee19f,'request\x20sent',JSON[_0x5454('0x18')](_0x330220));if(_0x330220[_0x5454('0x19')]){if(_0x330220[_0x5454('0x19')]['code']===0x1f4){logger[_0x5454('0x19')](_0x5454('0x1a'),_0x1ee19f,_0x330220['error'][_0x5454('0x1b')]);return _0x333b7e(_0x330220['error'][_0x5454('0x1b')]);}logger['error'](_0x5454('0x1a'),_0x1ee19f,_0x330220['error'][_0x5454('0x1b')]);return _0x1bfc87(_0x330220[_0x5454('0x19')]['message']);}else{logger['info'](_0x5454('0x1a'),_0x1ee19f,_0x5454('0x15'));_0x1bfc87(_0x330220[_0x5454('0x1c')][_0x5454('0x1b')]);}})[_0x5454('0x1d')](function(_0x2ab1fb){logger[_0x5454('0x19')](_0x5454('0x1a'),_0x1ee19f,_0x2ab1fb);_0x333b7e(_0x2ab1fb);});});}exports[_0x5454('0x1e')]=function(_0x2b9189){var _0x3417f5=this;return new Promise(function(_0x6ece25,_0xb6c582){return db['SmsQueue']['findAll']({'raw':_0x2b9189[_0x5454('0x1f')]?_0x2b9189[_0x5454('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2b9189[_0x5454('0x1f')]?_0x2b9189[_0x5454('0x1f')][_0x5454('0x20')]||null:null,'attributes':_0x2b9189[_0x5454('0x1f')]?_0x2b9189[_0x5454('0x1f')][_0x5454('0x21')]||null:null,'limit':_0x2b9189[_0x5454('0x1f')]?_0x2b9189['options']['limit']||null:null,'include':_0x2b9189[_0x5454('0x1f')]?_0x2b9189[_0x5454('0x1f')][_0x5454('0x22')]?_[_0x5454('0x23')](_0x2b9189[_0x5454('0x1f')][_0x5454('0x22')],function(_0x3a8855){return{'model':db[_0x3a8855[_0x5454('0x24')]],'as':_0x3a8855['as'],'attributes':_0x3a8855['attributes'],'include':_0x3a8855[_0x5454('0x22')]?_[_0x5454('0x23')](_0x3a8855['include'],function(_0x26cd55){return{'model':db[_0x26cd55[_0x5454('0x24')]],'as':_0x26cd55['as'],'attributes':_0x26cd55[_0x5454('0x21')],'include':_0x26cd55[_0x5454('0x22')]?_[_0x5454('0x23')](_0x26cd55[_0x5454('0x22')],function(_0x4ecc3f){return{'model':db[_0x4ecc3f['model']],'as':_0x4ecc3f['as'],'attributes':_0x4ecc3f[_0x5454('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5454('0x13')](function(_0x328abe){logger['info']('GetSmsQueue',_0x2b9189);logger[_0x5454('0x16')](_0x5454('0x1e'),_0x2b9189,JSON[_0x5454('0x18')](_0x328abe));_0x6ece25(_0x328abe);})[_0x5454('0x1d')](function(_0x22da31){logger[_0x5454('0x19')]('GetSmsQueue',_0x22da31[_0x5454('0x1b')],_0x2b9189);_0xb6c582(_0x3417f5[_0x5454('0x19')](0x1f4,_0x22da31[_0x5454('0x1b')]));});});};exports[_0x5454('0x25')]=function(_0x474bf8){var _0x4bbe7c=this;return new Promise(function(_0x471a16,_0x17e066){return db[_0x5454('0x26')][_0x5454('0x27')]({'raw':_0x474bf8[_0x5454('0x1f')]?_0x474bf8[_0x5454('0x1f')][_0x5454('0x28')]===undefined?!![]:![]:!![],'where':_0x474bf8[_0x5454('0x1f')]?_0x474bf8[_0x5454('0x1f')]['where']||null:null,'attributes':_0x474bf8[_0x5454('0x1f')]?_0x474bf8[_0x5454('0x1f')]['attributes']||null:null,'include':_0x474bf8['options']?_0x474bf8[_0x5454('0x1f')][_0x5454('0x22')]?_[_0x5454('0x23')](_0x474bf8[_0x5454('0x1f')][_0x5454('0x22')],function(_0x43aa13){return{'model':db[_0x43aa13['model']],'as':_0x43aa13['as'],'attributes':_0x43aa13[_0x5454('0x21')],'include':_0x43aa13['include']?_[_0x5454('0x23')](_0x43aa13[_0x5454('0x22')],function(_0x46081c){return{'model':db[_0x46081c[_0x5454('0x24')]],'as':_0x46081c['as'],'attributes':_0x46081c[_0x5454('0x21')],'include':_0x46081c[_0x5454('0x22')]?_['map'](_0x46081c[_0x5454('0x22')],function(_0x3e2f71){return{'model':db[_0x3e2f71[_0x5454('0x24')]],'as':_0x3e2f71['as'],'attributes':_0x3e2f71['attributes']};}):[]};}):[]};}):[]:[]})[_0x5454('0x13')](function(_0x52a406){logger[_0x5454('0x14')](_0x5454('0x25'),_0x474bf8);logger[_0x5454('0x16')]('ShowSmsQueue',_0x474bf8,JSON['stringify'](_0x52a406));_0x471a16(_0x52a406);})[_0x5454('0x1d')](function(_0x493204){logger[_0x5454('0x19')](_0x5454('0x25'),_0x493204[_0x5454('0x1b')],_0x474bf8);_0x17e066(_0x4bbe7c[_0x5454('0x19')](0x1f4,_0x493204[_0x5454('0x1b')]));});});}; \ No newline at end of file +var _0xfa1e=['message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','include','map','model','stringify','ShowSmsQueue','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','request\x20sent','error','code'];(function(_0x4621fd,_0x40983f){var _0x158174=function(_0x3c42aa){while(--_0x3c42aa){_0x4621fd['push'](_0x4621fd['shift']());}};_0x158174(++_0x40983f);}(_0xfa1e,0xd7));var _0xefa1=function(_0x43d701,_0x4bb2e9){_0x43d701=_0x43d701-0x0;var _0x2ec4c6=_0xfa1e[_0x43d701];return _0x2ec4c6;};'use strict';var _=require(_0xefa1('0x0'));var util=require(_0xefa1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xefa1('0x2'));var fs=require('fs');var Redis=require(_0xefa1('0x3'));var db=require(_0xefa1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xefa1('0x5'))(_0xefa1('0x6'));var config=require(_0xefa1('0x7'));var jayson=require(_0xefa1('0x8'));var client=jayson[_0xefa1('0x9')][_0xefa1('0xa')]({'port':0x232a});config[_0xefa1('0xb')]=_[_0xefa1('0xc')](config[_0xefa1('0xb')],{'host':_0xefa1('0xd'),'port':0x18eb});var socket=require(_0xefa1('0xe'))(new Redis(config[_0xefa1('0xb')]));require(_0xefa1('0xf'))[_0xefa1('0x10')](socket);function respondWithRpcPromise(_0x12631e,_0x154a23,_0x2fcfc5){return new BPromise(function(_0x13c48d,_0x269c12){return client[_0xefa1('0x11')](_0x12631e,_0x2fcfc5)[_0xefa1('0x12')](function(_0x78e4e3){logger[_0xefa1('0x13')](_0xefa1('0x14'),_0x154a23,'request\x20sent');logger[_0xefa1('0x15')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x154a23,_0xefa1('0x16'),JSON['stringify'](_0x78e4e3));if(_0x78e4e3[_0xefa1('0x17')]){if(_0x78e4e3[_0xefa1('0x17')][_0xefa1('0x18')]===0x1f4){logger[_0xefa1('0x17')]('SmsQueue,\x20%s,\x20%s',_0x154a23,_0x78e4e3[_0xefa1('0x17')][_0xefa1('0x19')]);return _0x269c12(_0x78e4e3[_0xefa1('0x17')][_0xefa1('0x19')]);}logger[_0xefa1('0x17')](_0xefa1('0x14'),_0x154a23,_0x78e4e3[_0xefa1('0x17')][_0xefa1('0x19')]);return _0x13c48d(_0x78e4e3[_0xefa1('0x17')][_0xefa1('0x19')]);}else{logger['info'](_0xefa1('0x14'),_0x154a23,'request\x20sent');_0x13c48d(_0x78e4e3[_0xefa1('0x1a')][_0xefa1('0x19')]);}})[_0xefa1('0x1b')](function(_0x45c168){logger[_0xefa1('0x17')](_0xefa1('0x14'),_0x154a23,_0x45c168);_0x269c12(_0x45c168);});});}exports[_0xefa1('0x1c')]=function(_0x1e4d21){var _0x3b04b4=this;return new Promise(function(_0x1eeac9,_0x80df94){return db[_0xefa1('0x1d')][_0xefa1('0x1e')]({'raw':_0x1e4d21[_0xefa1('0x1f')]?_0x1e4d21['options'][_0xefa1('0x20')]===undefined?!![]:![]:!![],'where':_0x1e4d21[_0xefa1('0x1f')]?_0x1e4d21[_0xefa1('0x1f')][_0xefa1('0x21')]||null:null,'attributes':_0x1e4d21[_0xefa1('0x1f')]?_0x1e4d21[_0xefa1('0x1f')][_0xefa1('0x22')]||null:null,'limit':_0x1e4d21[_0xefa1('0x1f')]?_0x1e4d21[_0xefa1('0x1f')]['limit']||null:null,'include':_0x1e4d21[_0xefa1('0x1f')]?_0x1e4d21[_0xefa1('0x1f')][_0xefa1('0x23')]?_[_0xefa1('0x24')](_0x1e4d21['options'][_0xefa1('0x23')],function(_0x361a1d){return{'model':db[_0x361a1d[_0xefa1('0x25')]],'as':_0x361a1d['as'],'attributes':_0x361a1d['attributes'],'include':_0x361a1d[_0xefa1('0x23')]?_[_0xefa1('0x24')](_0x361a1d['include'],function(_0x5af564){return{'model':db[_0x5af564['model']],'as':_0x5af564['as'],'attributes':_0x5af564[_0xefa1('0x22')],'include':_0x5af564[_0xefa1('0x23')]?_[_0xefa1('0x24')](_0x5af564[_0xefa1('0x23')],function(_0x23ae28){return{'model':db[_0x23ae28[_0xefa1('0x25')]],'as':_0x23ae28['as'],'attributes':_0x23ae28[_0xefa1('0x22')]};}):[]};}):[]};}):[]:[]})[_0xefa1('0x12')](function(_0x32ae9f){logger[_0xefa1('0x13')]('GetSmsQueue',_0x1e4d21);logger[_0xefa1('0x15')](_0xefa1('0x1c'),_0x1e4d21,JSON[_0xefa1('0x26')](_0x32ae9f));_0x1eeac9(_0x32ae9f);})[_0xefa1('0x1b')](function(_0x41f029){logger[_0xefa1('0x17')](_0xefa1('0x1c'),_0x41f029[_0xefa1('0x19')],_0x1e4d21);_0x80df94(_0x3b04b4['error'](0x1f4,_0x41f029[_0xefa1('0x19')]));});});};exports[_0xefa1('0x27')]=function(_0x439963){var _0x2df8d6=this;return new Promise(function(_0x59ab42,_0x4480a7){return db['SmsQueue']['find']({'raw':_0x439963[_0xefa1('0x1f')]?_0x439963[_0xefa1('0x1f')][_0xefa1('0x20')]===undefined?!![]:![]:!![],'where':_0x439963[_0xefa1('0x1f')]?_0x439963[_0xefa1('0x1f')]['where']||null:null,'attributes':_0x439963[_0xefa1('0x1f')]?_0x439963['options'][_0xefa1('0x22')]||null:null,'include':_0x439963[_0xefa1('0x1f')]?_0x439963[_0xefa1('0x1f')]['include']?_[_0xefa1('0x24')](_0x439963[_0xefa1('0x1f')]['include'],function(_0x3126c9){return{'model':db[_0x3126c9[_0xefa1('0x25')]],'as':_0x3126c9['as'],'attributes':_0x3126c9[_0xefa1('0x22')],'include':_0x3126c9[_0xefa1('0x23')]?_[_0xefa1('0x24')](_0x3126c9[_0xefa1('0x23')],function(_0xb82c1d){return{'model':db[_0xb82c1d[_0xefa1('0x25')]],'as':_0xb82c1d['as'],'attributes':_0xb82c1d['attributes'],'include':_0xb82c1d[_0xefa1('0x23')]?_['map'](_0xb82c1d[_0xefa1('0x23')],function(_0x1cd5e0){return{'model':db[_0x1cd5e0[_0xefa1('0x25')]],'as':_0x1cd5e0['as'],'attributes':_0x1cd5e0[_0xefa1('0x22')]};}):[]};}):[]};}):[]:[]})[_0xefa1('0x12')](function(_0x31065e){logger['info'](_0xefa1('0x27'),_0x439963);logger[_0xefa1('0x15')](_0xefa1('0x27'),_0x439963,JSON[_0xefa1('0x26')](_0x31065e));_0x59ab42(_0x31065e);})[_0xefa1('0x1b')](function(_0x49f2bd){logger[_0xefa1('0x17')](_0xefa1('0x27'),_0x49f2bd[_0xefa1('0x19')],_0x439963);_0x4480a7(_0x2df8d6[_0xefa1('0x17')](0x1f4,_0x49f2bd[_0xefa1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 1c2d075..5a4b117 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 _0x3276=['removeListener','length','smsQueue:','save','remove','update','emit'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x3276,0x14c));var _0x6327=function(_0x22d843,_0x2c36dc){_0x22d843=_0x22d843-0x0;var _0x8d48ef=_0x3276[_0x22d843];return _0x8d48ef;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x6327('0x0'),_0x6327('0x1'),_0x6327('0x2')];function createListener(_0x34fa27,_0x18476c){return function(_0x1f4a82){_0x18476c[_0x6327('0x3')](_0x34fa27,_0x1f4a82);};}function removeListener(_0x4e5e5a,_0x7f480b){return function(){SmsQueueEvents[_0x6327('0x4')](_0x4e5e5a,_0x7f480b);};}exports['register']=function(_0x4bf69e){for(var _0x3151f0=0x0,_0xc0ec=events[_0x6327('0x5')];_0x3151f0<_0xc0ec;_0x3151f0++){var _0x423ae5=events[_0x3151f0];var _0x4e2fec=createListener(_0x6327('0x6')+_0x423ae5,_0x4bf69e);SmsQueueEvents['on'](_0x423ae5,_0x4e2fec);}}; \ No newline at end of file +var _0xd43b=['emit','removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x1acfb9,_0x52bc80){var _0x1416e3=function(_0x1909d1){while(--_0x1909d1){_0x1acfb9['push'](_0x1acfb9['shift']());}};_0x1416e3(++_0x52bc80);}(_0xd43b,0xd4));var _0xbd43=function(_0x1b055f,_0x7bd379){_0x1b055f=_0x1b055f-0x0;var _0x37999a=_0xd43b[_0x1b055f];return _0x37999a;};'use strict';var SmsQueueEvents=require(_0xbd43('0x0'));var events=[_0xbd43('0x1'),_0xbd43('0x2'),_0xbd43('0x3')];function createListener(_0x1710dd,_0x3d521c){return function(_0x1b8f6){_0x3d521c[_0xbd43('0x4')](_0x1710dd,_0x1b8f6);};}function removeListener(_0x31457b,_0x8fdf3f){return function(){SmsQueueEvents[_0xbd43('0x5')](_0x31457b,_0x8fdf3f);};}exports[_0xbd43('0x6')]=function(_0x5d3fff){for(var _0x3440e5=0x0,_0x2ef3b8=events[_0xbd43('0x7')];_0x3440e5<_0x2ef3b8;_0x3440e5++){var _0x491c48=events[_0x3440e5];var _0x1c783f=createListener(_0xbd43('0x8')+_0x491c48,_0x5d3fff);SmsQueueEvents['on'](_0x491c48,_0x1c783f);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index d61c065..5d57db6 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 _0x00e2=['create','put','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','get','describe','/:id','show'];(function(_0x179b68,_0x339d82){var _0x5e6d69=function(_0x69ff9){while(--_0x69ff9){_0x179b68['push'](_0x179b68['shift']());}};_0x5e6d69(++_0x339d82);}(_0x00e2,0x126));var _0x200e=function(_0x6f3151,_0x406745){_0x6f3151=_0x6f3151-0x0;var _0x305fb8=_0x00e2[_0x6f3151];return _0x305fb8;};'use strict';var multer=require(_0x200e('0x0'));var util=require('util');var path=require(_0x200e('0x1'));var timeout=require(_0x200e('0x2'));var express=require('express');var router=express[_0x200e('0x3')]();var auth=require(_0x200e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x200e('0x5'));var controller=require(_0x200e('0x6'));router['get']('/',auth[_0x200e('0x7')](),controller['index']);router[_0x200e('0x8')]('/describe',auth[_0x200e('0x7')](),controller[_0x200e('0x9')]);router[_0x200e('0x8')](_0x200e('0xa'),auth[_0x200e('0x7')](),controller[_0x200e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x200e('0xc')]);router[_0x200e('0xd')](_0x200e('0xa'),auth['isAuthenticated'](),controller[_0x200e('0xe')]);router['delete'](_0x200e('0xa'),auth[_0x200e('0x7')](),controller[_0x200e('0xf')]);module[_0x200e('0x10')]=router; \ No newline at end of file +var _0x9d03=['/:id','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','get','/describe','describe','show','create','put'];(function(_0xeadc11,_0x27e378){var _0x4257b6=function(_0x38bb40){while(--_0x38bb40){_0xeadc11['push'](_0xeadc11['shift']());}};_0x4257b6(++_0x27e378);}(_0x9d03,0xfa));var _0x39d0=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x9d03[_0x403c20];return _0x2b271a;};'use strict';var multer=require(_0x39d0('0x0'));var util=require(_0x39d0('0x1'));var path=require(_0x39d0('0x2'));var timeout=require(_0x39d0('0x3'));var express=require('express');var router=express[_0x39d0('0x4')]();var auth=require(_0x39d0('0x5'));var interaction=require(_0x39d0('0x6'));var config=require(_0x39d0('0x7'));var controller=require(_0x39d0('0x8'));router['get']('/',auth[_0x39d0('0x9')](),controller['index']);router[_0x39d0('0xa')](_0x39d0('0xb'),auth[_0x39d0('0x9')](),controller[_0x39d0('0xc')]);router['get']('/:id',auth[_0x39d0('0x9')](),controller[_0x39d0('0xd')]);router['post']('/',auth[_0x39d0('0x9')](),controller[_0x39d0('0xe')]);router[_0x39d0('0xf')](_0x39d0('0x10'),auth[_0x39d0('0x9')](),controller['update']);router[_0x39d0('0x11')](_0x39d0('0x10'),auth[_0x39d0('0x9')](),controller['destroy']);module[_0x39d0('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index a3847fe..b0a6510 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 _0x9f9b=['sequelize','STRING','DATE','moment'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x9f9b,0x1c3));var _0xb9f9=function(_0x463cb8,_0x2b9cd7){_0x463cb8=_0x463cb8-0x0;var _0x527b27=_0x9f9b[_0x463cb8];return _0x527b27;};'use strict';var moment=require(_0xb9f9('0x0'));var Sequelize=require(_0xb9f9('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xb9f9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb9f9('0x2')]},'joinAt':{'type':Sequelize[_0xb9f9('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb9f9('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x745f=['STRING','DATE','sequelize'];(function(_0x4f076a,_0x437224){var _0x164c6d=function(_0x5893ec){while(--_0x5893ec){_0x4f076a['push'](_0x4f076a['shift']());}};_0x164c6d(++_0x437224);}(_0x745f,0x167));var _0xf745=function(_0x1283d4,_0x36b6f1){_0x1283d4=_0x1283d4-0x0;var _0x433643=_0x745f[_0x1283d4];return _0x433643;};'use strict';var moment=require('moment');var Sequelize=require(_0xf745('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf745('0x1')]},'joinAt':{'type':Sequelize[_0xf745('0x2')]},'leaveAt':{'type':Sequelize[_0xf745('0x2')]},'acceptAt':{'type':Sequelize[_0xf745('0x2')]},'exitAt':{'type':Sequelize[_0xf745('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 005c6da..aba2c9b 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 _0x9957=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','pick','filter','where','merge','VIRTUAL','options','SmsQueueReport','count','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','describe','html-pdf'];(function(_0x2d90a8,_0x1fad1d){var _0x5dd911=function(_0xd7c848){while(--_0xd7c848){_0x2d90a8['push'](_0x2d90a8['shift']());}};_0x5dd911(++_0x1fad1d);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');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 db=require(_0x7995('0x19'))['db'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){_0x350fd9[_0x7995('0x1b')](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x204507,_0x285437){return function(_0x563799){if(!_0x563799){_0x204507[_0x7995('0x1a')](0x194);}return _0x563799;};}function handleError(_0x475351,_0x472195){_0x472195=_0x472195||0x1f4;return function(_0x59405a){logger[_0x7995('0x26')](_0x59405a[_0x7995('0x27')]);if(_0x59405a[_0x7995('0x28')]){delete _0x59405a[_0x7995('0x28')];}_0x475351[_0x7995('0x1b')](_0x472195)[_0x7995('0x29')](_0x59405a);};}exports['index']=function(_0x47625f,_0x5911c3){var _0x229742={},_0x49bc7e={},_0xf16cc2={'count':0x0,'rows':[]};var _0x132a42=_[_0x7995('0x2a')](db['SmsQueueReport'][_0x7995('0x2b')],function(_0x514445){return{'name':_0x514445[_0x7995('0x2c')],'type':_0x514445[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x49bc7e['model']=_['map'](_0x132a42,'name');_0x49bc7e[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x47625f[_0x7995('0x2f')]);_0x49bc7e[_0x7995('0x31')]=_[_0x7995('0x32')](_0x49bc7e[_0x7995('0x33')],_0x49bc7e['query']);_0x229742['attributes']=_[_0x7995('0x32')](_0x49bc7e['model'],qs[_0x7995('0x34')](_0x47625f[_0x7995('0x2f')][_0x7995('0x34')]));_0x229742[_0x7995('0x35')]=_0x229742[_0x7995('0x35')]['length']?_0x229742[_0x7995('0x35')]:_0x49bc7e[_0x7995('0x33')];if(!_0x47625f['query']['hasOwnProperty']('nolimit')){_0x229742[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x47625f['query'][_0x7995('0x1f')]);_0x229742['offset']=qs[_0x7995('0x1e')](_0x47625f[_0x7995('0x2f')][_0x7995('0x1e')]);}_0x229742['order']=qs['sort'](_0x47625f[_0x7995('0x2f')]['sort']);_0x229742['where']=qs[_0x7995('0x31')](_[_0x7995('0x36')](_0x47625f['query'],_0x49bc7e[_0x7995('0x31')]),_0x132a42);if(_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]){_0x229742[_0x7995('0x38')]=_[_0x7995('0x39')](_0x229742['where'],{'$or':_[_0x7995('0x2a')](_0x132a42,function(_0x242713){if(_0x242713[_0x7995('0x2d')]!==_0x7995('0x3a')){var _0x4b1541={};_0x4b1541[_0x242713[_0x7995('0x28')]]={'$like':'%'+_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]+'%'};return _0x4b1541;}})});}_0x229742=_[_0x7995('0x39')]({},_0x229742,_0x47625f[_0x7995('0x3b')]);var _0x1035dc={'where':_0x229742['where']};return db[_0x7995('0x3c')][_0x7995('0x3d')](_0x1035dc)[_0x7995('0x24')](function(_0x2ea47f){_0xf16cc2[_0x7995('0x3d')]=_0x2ea47f;if(_0x47625f[_0x7995('0x2f')][_0x7995('0x3e')]){_0x229742[_0x7995('0x3f')]=[{'all':!![]}];}return db[_0x7995('0x3c')][_0x7995('0x40')](_0x229742);})[_0x7995('0x24')](function(_0x270d52){_0xf16cc2[_0x7995('0x41')]=_0x270d52;return _0xf16cc2;})['then'](respondWithFilteredResult(_0x5911c3,_0x229742))['catch'](handleError(_0x5911c3,null));};exports[_0x7995('0x42')]=function(_0x7325e8,_0x58523e){var _0x4b0855={'raw':!![],'where':{'id':_0x7325e8['params']['id']}},_0x3f8522={};_0x3f8522['model']=_[_0x7995('0x30')](db[_0x7995('0x3c')][_0x7995('0x2b')]);_0x3f8522['query']=_[_0x7995('0x30')](_0x7325e8['query']);_0x3f8522[_0x7995('0x31')]=_['intersection'](_0x3f8522['model'],_0x3f8522[_0x7995('0x2f')]);_0x4b0855[_0x7995('0x35')]=_[_0x7995('0x32')](_0x3f8522[_0x7995('0x33')],qs['fields'](_0x7325e8[_0x7995('0x2f')][_0x7995('0x34')]));_0x4b0855[_0x7995('0x35')]=_0x4b0855[_0x7995('0x35')]['length']?_0x4b0855['attributes']:_0x3f8522[_0x7995('0x33')];if(_0x7325e8['query'][_0x7995('0x3e')]){_0x4b0855['include']=[{'all':!![]}];}_0x4b0855=_[_0x7995('0x39')]({},_0x4b0855,_0x7325e8['options']);return db[_0x7995('0x3c')][_0x7995('0x43')](_0x4b0855)['then'](handleEntityNotFound(_0x58523e,null))[_0x7995('0x24')](respondWithResult(_0x58523e,null))[_0x7995('0x44')](handleError(_0x58523e,null));};exports[_0x7995('0x45')]=function(_0xb70a51,_0x4c6837){return db[_0x7995('0x3c')][_0x7995('0x45')](_0xb70a51[_0x7995('0x46')],{})['then'](respondWithResult(_0x4c6837,0xc9))[_0x7995('0x44')](handleError(_0x4c6837,null));};exports[_0x7995('0x47')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x46')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3c')][_0x7995('0x43')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x46')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x44')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3c')]['find']({'where':{'id':_0xddf537[_0x7995('0x48')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x49')]=function(_0x1fe77e,_0x12d4b8){return db['SmsQueueReport']['describe']()['then'](respondWithResult(_0x12d4b8,null))[_0x7995('0x44')](handleError(_0x12d4b8,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','pick','filter','where','merge','VIRTUAL','options','SmsQueueReport','count','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','describe','html-pdf'];(function(_0x33f65c,_0x179113){var _0x5b4c00=function(_0x5e5873){while(--_0x5e5873){_0x33f65c['push'](_0x33f65c['shift']());}};_0x5b4c00(++_0x179113);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');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 db=require(_0x7995('0x19'))['db'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){_0x350fd9[_0x7995('0x1b')](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x204507,_0x285437){return function(_0x563799){if(!_0x563799){_0x204507[_0x7995('0x1a')](0x194);}return _0x563799;};}function handleError(_0x475351,_0x472195){_0x472195=_0x472195||0x1f4;return function(_0x59405a){logger[_0x7995('0x26')](_0x59405a[_0x7995('0x27')]);if(_0x59405a[_0x7995('0x28')]){delete _0x59405a[_0x7995('0x28')];}_0x475351[_0x7995('0x1b')](_0x472195)[_0x7995('0x29')](_0x59405a);};}exports['index']=function(_0x47625f,_0x5911c3){var _0x229742={},_0x49bc7e={},_0xf16cc2={'count':0x0,'rows':[]};var _0x132a42=_[_0x7995('0x2a')](db['SmsQueueReport'][_0x7995('0x2b')],function(_0x514445){return{'name':_0x514445[_0x7995('0x2c')],'type':_0x514445[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x49bc7e['model']=_['map'](_0x132a42,'name');_0x49bc7e[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x47625f[_0x7995('0x2f')]);_0x49bc7e[_0x7995('0x31')]=_[_0x7995('0x32')](_0x49bc7e[_0x7995('0x33')],_0x49bc7e['query']);_0x229742['attributes']=_[_0x7995('0x32')](_0x49bc7e['model'],qs[_0x7995('0x34')](_0x47625f[_0x7995('0x2f')][_0x7995('0x34')]));_0x229742[_0x7995('0x35')]=_0x229742[_0x7995('0x35')]['length']?_0x229742[_0x7995('0x35')]:_0x49bc7e[_0x7995('0x33')];if(!_0x47625f['query']['hasOwnProperty']('nolimit')){_0x229742[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x47625f['query'][_0x7995('0x1f')]);_0x229742['offset']=qs[_0x7995('0x1e')](_0x47625f[_0x7995('0x2f')][_0x7995('0x1e')]);}_0x229742['order']=qs['sort'](_0x47625f[_0x7995('0x2f')]['sort']);_0x229742['where']=qs[_0x7995('0x31')](_[_0x7995('0x36')](_0x47625f['query'],_0x49bc7e[_0x7995('0x31')]),_0x132a42);if(_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]){_0x229742[_0x7995('0x38')]=_[_0x7995('0x39')](_0x229742['where'],{'$or':_[_0x7995('0x2a')](_0x132a42,function(_0x242713){if(_0x242713[_0x7995('0x2d')]!==_0x7995('0x3a')){var _0x4b1541={};_0x4b1541[_0x242713[_0x7995('0x28')]]={'$like':'%'+_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]+'%'};return _0x4b1541;}})});}_0x229742=_[_0x7995('0x39')]({},_0x229742,_0x47625f[_0x7995('0x3b')]);var _0x1035dc={'where':_0x229742['where']};return db[_0x7995('0x3c')][_0x7995('0x3d')](_0x1035dc)[_0x7995('0x24')](function(_0x2ea47f){_0xf16cc2[_0x7995('0x3d')]=_0x2ea47f;if(_0x47625f[_0x7995('0x2f')][_0x7995('0x3e')]){_0x229742[_0x7995('0x3f')]=[{'all':!![]}];}return db[_0x7995('0x3c')][_0x7995('0x40')](_0x229742);})[_0x7995('0x24')](function(_0x270d52){_0xf16cc2[_0x7995('0x41')]=_0x270d52;return _0xf16cc2;})['then'](respondWithFilteredResult(_0x5911c3,_0x229742))['catch'](handleError(_0x5911c3,null));};exports[_0x7995('0x42')]=function(_0x7325e8,_0x58523e){var _0x4b0855={'raw':!![],'where':{'id':_0x7325e8['params']['id']}},_0x3f8522={};_0x3f8522['model']=_[_0x7995('0x30')](db[_0x7995('0x3c')][_0x7995('0x2b')]);_0x3f8522['query']=_[_0x7995('0x30')](_0x7325e8['query']);_0x3f8522[_0x7995('0x31')]=_['intersection'](_0x3f8522['model'],_0x3f8522[_0x7995('0x2f')]);_0x4b0855[_0x7995('0x35')]=_[_0x7995('0x32')](_0x3f8522[_0x7995('0x33')],qs['fields'](_0x7325e8[_0x7995('0x2f')][_0x7995('0x34')]));_0x4b0855[_0x7995('0x35')]=_0x4b0855[_0x7995('0x35')]['length']?_0x4b0855['attributes']:_0x3f8522[_0x7995('0x33')];if(_0x7325e8['query'][_0x7995('0x3e')]){_0x4b0855['include']=[{'all':!![]}];}_0x4b0855=_[_0x7995('0x39')]({},_0x4b0855,_0x7325e8['options']);return db[_0x7995('0x3c')][_0x7995('0x43')](_0x4b0855)['then'](handleEntityNotFound(_0x58523e,null))[_0x7995('0x24')](respondWithResult(_0x58523e,null))[_0x7995('0x44')](handleError(_0x58523e,null));};exports[_0x7995('0x45')]=function(_0xb70a51,_0x4c6837){return db[_0x7995('0x3c')][_0x7995('0x45')](_0xb70a51[_0x7995('0x46')],{})['then'](respondWithResult(_0x4c6837,0xc9))[_0x7995('0x44')](handleError(_0x4c6837,null));};exports[_0x7995('0x47')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x46')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3c')][_0x7995('0x43')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x46')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x44')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3c')]['find']({'where':{'id':_0xddf537[_0x7995('0x48')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x49')]=function(_0x1fe77e,_0x12d4b8){return db['SmsQueueReport']['describe']()['then'](respondWithResult(_0x12d4b8,null))[_0x7995('0x44')](handleError(_0x12d4b8,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 7729855..614bfca 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 _0xf875=['moment','request-promise','path','./smsQueueReport.attributes','exports','report_sms_queue','lodash','../../config/logger','api'];(function(_0x352fbf,_0x5d417d){var _0x45784a=function(_0x22a0ff){while(--_0x22a0ff){_0x352fbf['push'](_0x352fbf['shift']());}};_0x45784a(++_0x5d417d);}(_0xf875,0x138));var _0x5f87=function(_0x26caac,_0x45dfdd){_0x26caac=_0x26caac-0x0;var _0xb450=_0xf875[_0x26caac];return _0xb450;};'use strict';var _=require(_0x5f87('0x0'));var util=require('util');var logger=require(_0x5f87('0x1'))(_0x5f87('0x2'));var moment=require(_0x5f87('0x3'));var BPromise=require('bluebird');var rp=require(_0x5f87('0x4'));var fs=require('fs');var path=require(_0x5f87('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5f87('0x6'));module[_0x5f87('0x7')]=function(_0x2753a7,_0x1ae2d8){return _0x2753a7['define']('SmsQueueReport',attributes,{'tableName':_0x5f87('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf306=['bluebird','request-promise','path','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','api'];(function(_0x256f1b,_0x5e97c6){var _0x339576=function(_0x2c4751){while(--_0x2c4751){_0x256f1b['push'](_0x256f1b['shift']());}};_0x339576(++_0x5e97c6);}(_0xf306,0x75));var _0x6f30=function(_0x2f8e23,_0xc115bb){_0x2f8e23=_0x2f8e23-0x0;var _0x179ec2=_0xf306[_0x2f8e23];return _0x179ec2;};'use strict';var _=require(_0x6f30('0x0'));var util=require(_0x6f30('0x1'));var logger=require('../../config/logger')(_0x6f30('0x2'));var moment=require('moment');var BPromise=require(_0x6f30('0x3'));var rp=require(_0x6f30('0x4'));var fs=require('fs');var path=require(_0x6f30('0x5'));var rimraf=require('rimraf');var config=require(_0x6f30('0x6'));var attributes=require(_0x6f30('0x7'));module['exports']=function(_0x5bde3f,_0x45db78){return _0x5bde3f[_0x6f30('0x8')](_0x6f30('0x9'),attributes,{'tableName':_0x6f30('0xa'),'paranoid':![],'indexes':[{'name':_0x6f30('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index a9d8aed..d82111c 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 _0x3158=['util','moment','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','update','attributes','limit'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3158,0x1d0));var _0x8315=function(_0x2f01da,_0x246852){_0x2f01da=_0x2f01da-0x0;var _0x348ce2=_0x3158[_0x2f01da];return _0x348ce2;};'use strict';var _=require('lodash');var util=require(_0x8315('0x0'));var moment=require(_0x8315('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8315('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8315('0x3'));var config=require('../../config/environment');var jayson=require(_0x8315('0x4'));var client=jayson[_0x8315('0x5')][_0x8315('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5c0632,_0x573c2e,_0x167735){return new BPromise(function(_0x14fd6d,_0x22df6b){return client[_0x8315('0x7')](_0x5c0632,_0x167735)[_0x8315('0x8')](function(_0x125126){logger[_0x8315('0x9')](_0x8315('0xa'),_0x573c2e,_0x8315('0xb'));logger[_0x8315('0xc')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x573c2e,_0x8315('0xb'),JSON[_0x8315('0xd')](_0x125126));if(_0x125126[_0x8315('0xe')]){if(_0x125126[_0x8315('0xe')][_0x8315('0xf')]===0x1f4){logger[_0x8315('0xe')](_0x8315('0xa'),_0x573c2e,_0x125126[_0x8315('0xe')][_0x8315('0x10')]);return _0x22df6b(_0x125126[_0x8315('0xe')][_0x8315('0x10')]);}logger['error'](_0x8315('0xa'),_0x573c2e,_0x125126[_0x8315('0xe')][_0x8315('0x10')]);return _0x14fd6d(_0x125126[_0x8315('0xe')][_0x8315('0x10')]);}else{logger[_0x8315('0x9')](_0x8315('0xa'),_0x573c2e,_0x8315('0xb'));_0x14fd6d(_0x125126[_0x8315('0x11')][_0x8315('0x10')]);}})[_0x8315('0x12')](function(_0x88ed0f){logger[_0x8315('0xe')](_0x8315('0xa'),_0x573c2e,_0x88ed0f);_0x22df6b(_0x88ed0f);});});}exports[_0x8315('0x13')]=function(_0x4502e5){var _0x3190bb=this;return new Promise(function(_0x2bb4d7,_0x3ea76c){return db[_0x8315('0x14')][_0x8315('0x15')](_0x4502e5[_0x8315('0x16')],{'raw':_0x4502e5['options']?_0x4502e5[_0x8315('0x17')][_0x8315('0x18')]===undefined?!![]:![]:!![]})[_0x8315('0x8')](function(_0x4e3c78){logger[_0x8315('0x9')](_0x8315('0x13'),_0x4502e5);logger[_0x8315('0xc')]('CreateSmsQueueReport',_0x4502e5,JSON[_0x8315('0xd')](_0x4e3c78));_0x2bb4d7(_0x4e3c78);})['catch'](function(_0x2ea13c){logger[_0x8315('0xe')](_0x8315('0x13'),_0x2ea13c['message'],_0x4502e5);_0x3ea76c(_0x3190bb['error'](0x1f4,_0x2ea13c[_0x8315('0x10')]));});});};exports[_0x8315('0x19')]=function(_0x14f15c){var _0xe58eaf=this;return new Promise(function(_0x30e599,_0x4140c0){return db[_0x8315('0x14')][_0x8315('0x1a')](_0x14f15c[_0x8315('0x16')],{'raw':_0x14f15c['options']?_0x14f15c[_0x8315('0x17')][_0x8315('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14f15c['options']?_0x14f15c['options']['where']||null:null,'attributes':_0x14f15c[_0x8315('0x17')]?_0x14f15c[_0x8315('0x17')][_0x8315('0x1b')]||null:null,'limit':_0x14f15c[_0x8315('0x17')]?_0x14f15c[_0x8315('0x17')][_0x8315('0x1c')]||null:null})[_0x8315('0x8')](function(_0x4a50c9){logger[_0x8315('0x9')](_0x8315('0x19'),_0x14f15c);logger[_0x8315('0xc')](_0x8315('0x19'),_0x14f15c,JSON['stringify'](_0x4a50c9));_0x30e599(_0x4a50c9);})[_0x8315('0x12')](function(_0x4993c2){logger[_0x8315('0xe')](_0x8315('0x19'),_0x4993c2[_0x8315('0x10')],_0x14f15c);_0x4140c0(_0xe58eaf[_0x8315('0xe')](0x1f4,_0x4993c2[_0x8315('0x10')]));});});}; \ No newline at end of file +var _0x833a=['../../config/logger','rpc','jayson/promise','client','http','then','info','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','result','create','options','raw','catch','CreateSmsQueueReport','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2f25ed,_0x3e0622){var _0x19c980=function(_0x2e1e53){while(--_0x2e1e53){_0x2f25ed['push'](_0x2f25ed['shift']());}};_0x19c980(++_0x3e0622);}(_0x833a,0xc0));var _0xa833=function(_0xa12d86,_0x4ecc68){_0xa12d86=_0xa12d86-0x0;var _0x1bf42c=_0x833a[_0xa12d86];return _0x1bf42c;};'use strict';var _=require(_0xa833('0x0'));var util=require(_0xa833('0x1'));var moment=require('moment');var BPromise=require(_0xa833('0x2'));var rs=require(_0xa833('0x3'));var fs=require('fs');var Redis=require(_0xa833('0x4'));var db=require(_0xa833('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa833('0x6'))(_0xa833('0x7'));var config=require('../../config/environment');var jayson=require(_0xa833('0x8'));var client=jayson[_0xa833('0x9')][_0xa833('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c6609,_0x5aba49,_0x42392f){return new BPromise(function(_0x3dfbf9,_0x4b8199){return client['request'](_0x2c6609,_0x42392f)[_0xa833('0xb')](function(_0xa09ffe){logger[_0xa833('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x5aba49,'request\x20sent');logger[_0xa833('0xd')](_0xa833('0xe'),_0x5aba49,_0xa833('0xf'),JSON[_0xa833('0x10')](_0xa09ffe));if(_0xa09ffe[_0xa833('0x11')]){if(_0xa09ffe[_0xa833('0x11')][_0xa833('0x12')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x5aba49,_0xa09ffe['error'][_0xa833('0x13')]);return _0x4b8199(_0xa09ffe[_0xa833('0x11')][_0xa833('0x13')]);}logger[_0xa833('0x11')](_0xa833('0x14'),_0x5aba49,_0xa09ffe[_0xa833('0x11')]['message']);return _0x3dfbf9(_0xa09ffe[_0xa833('0x11')][_0xa833('0x13')]);}else{logger[_0xa833('0xc')](_0xa833('0x14'),_0x5aba49,_0xa833('0xf'));_0x3dfbf9(_0xa09ffe[_0xa833('0x15')]['message']);}})['catch'](function(_0x3027cb){logger['error'](_0xa833('0x14'),_0x5aba49,_0x3027cb);_0x4b8199(_0x3027cb);});});}exports['CreateSmsQueueReport']=function(_0x1a9b4a){var _0xca7238=this;return new Promise(function(_0x3e5bd3,_0x43bb0f){return db['SmsQueueReport'][_0xa833('0x16')](_0x1a9b4a['body'],{'raw':_0x1a9b4a[_0xa833('0x17')]?_0x1a9b4a['options'][_0xa833('0x18')]===undefined?!![]:![]:!![]})[_0xa833('0xb')](function(_0x12f92a){logger[_0xa833('0xc')]('CreateSmsQueueReport',_0x1a9b4a);logger[_0xa833('0xd')]('CreateSmsQueueReport',_0x1a9b4a,JSON[_0xa833('0x10')](_0x12f92a));_0x3e5bd3(_0x12f92a);})[_0xa833('0x19')](function(_0x180733){logger[_0xa833('0x11')](_0xa833('0x1a'),_0x180733[_0xa833('0x13')],_0x1a9b4a);_0x43bb0f(_0xca7238['error'](0x1f4,_0x180733[_0xa833('0x13')]));});});};exports[_0xa833('0x1b')]=function(_0x485ea5){var _0x4e0fa6=this;return new Promise(function(_0x57c7a2,_0x243cbc){return db[_0xa833('0x1c')][_0xa833('0x1d')](_0x485ea5['body'],{'raw':_0x485ea5[_0xa833('0x17')]?_0x485ea5[_0xa833('0x17')][_0xa833('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x485ea5['options']?_0x485ea5[_0xa833('0x17')][_0xa833('0x1e')]||null:null,'attributes':_0x485ea5[_0xa833('0x17')]?_0x485ea5[_0xa833('0x17')][_0xa833('0x1f')]||null:null,'limit':_0x485ea5[_0xa833('0x17')]?_0x485ea5[_0xa833('0x17')][_0xa833('0x20')]||null:null})[_0xa833('0xb')](function(_0x1758be){logger[_0xa833('0xc')](_0xa833('0x1b'),_0x485ea5);logger[_0xa833('0xd')](_0xa833('0x1b'),_0x485ea5,JSON[_0xa833('0x10')](_0x1758be));_0x57c7a2(_0x1758be);})['catch'](function(_0x5af34d){logger['error'](_0xa833('0x1b'),_0x5af34d['message'],_0x485ea5);_0x243cbc(_0x4e0fa6[_0xa833('0x11')](0x1f4,_0x5af34d[_0xa833('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 84b1cb3..4cf5d9f 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 _0xb7e7=['multer','path','express','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x253ccf,_0x2a0b82){var _0x4061da=function(_0x21756d){while(--_0x21756d){_0x253ccf['push'](_0x253ccf['shift']());}};_0x4061da(++_0x2a0b82);}(_0xb7e7,0x121));var _0x7b7e=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xb7e7[_0x24259d];return _0x5a701;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['put'](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);module[_0x7b7e('0x10')]=router; \ No newline at end of file +var _0x0abf=['get','isAuthenticated','index','/describe','describe','/:id','post','create','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../config/environment','./smsTransferReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0abf,0xe8));var _0xf0ab=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0abf[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf0ab('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf0ab('0x4'));var controller=require(_0xf0ab('0x5'));router[_0xf0ab('0x6')]('/',auth[_0xf0ab('0x7')](),controller[_0xf0ab('0x8')]);router[_0xf0ab('0x6')](_0xf0ab('0x9'),auth['isAuthenticated'](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x6')](_0xf0ab('0xb'),auth[_0xf0ab('0x7')](),controller['show']);router[_0xf0ab('0xc')]('/',auth[_0xf0ab('0x7')](),controller[_0xf0ab('0xd')]);router['put']('/:id',auth[_0xf0ab('0x7')](),controller['update']);router[_0xf0ab('0xe')](_0xf0ab('0xb'),auth[_0xf0ab('0x7')](),controller[_0xf0ab('0xf')]);module[_0xf0ab('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 83a6f28..db1ec24 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 _0xbed8=['exports','STRING','ENUM','account','agent','queue','DATE','moment','sequelize'];(function(_0x2556c6,_0x888023){var _0x157af6=function(_0x7070a7){while(--_0x7070a7){_0x2556c6['push'](_0x2556c6['shift']());}};_0x157af6(++_0x888023);}(_0xbed8,0x1c0));var _0x8bed=function(_0x34620e,_0x582015){_0x34620e=_0x34620e-0x0;var _0x3d33cd=_0xbed8[_0x34620e];return _0x3d33cd;};'use strict';var moment=require(_0x8bed('0x0'));var Sequelize=require(_0x8bed('0x1'));module[_0x8bed('0x2')]={'uniqueid':{'type':Sequelize[_0x8bed('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8bed('0x4')](_0x8bed('0x5'),_0x8bed('0x6'),_0x8bed('0x7')),'allowNull':![],'defaultValue':_0x8bed('0x7')},'transferredAt':{'type':Sequelize[_0x8bed('0x8')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xf1a5=['account','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xf1a5,0x194));var _0x5f1a=function(_0x52ac20,_0x5ce35b){_0x52ac20=_0x52ac20-0x0;var _0x42d24f=_0xf1a5[_0x52ac20];return _0x42d24f;};'use strict';var moment=require(_0x5f1a('0x0'));var Sequelize=require(_0x5f1a('0x1'));module[_0x5f1a('0x2')]={'uniqueid':{'type':Sequelize[_0x5f1a('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5f1a('0x4'),'agent',_0x5f1a('0x5')),'allowNull':![],'defaultValue':_0x5f1a('0x5')},'transferredAt':{'type':Sequelize[_0x5f1a('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x5f1a('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 1244b7d..9f0ef77 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 _0xd8b0=['intersection','fields','attributes','length','model','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','SmsTransferReport','count','includeAll','include','findAll','catch','show','params','options','create','body','find','destroy','describe','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys'];(function(_0x2f8448,_0x2c4549){var _0x4e7381=function(_0x357765){while(--_0x357765){_0x2f8448['push'](_0x2f8448['shift']());}};_0x4e7381(++_0x2c4549);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');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('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){_0x33fb87[_0x0d8b('0x17')](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x38efc8,_0x221071){return function(_0x2c64e2){if(!_0x2c64e2){_0x38efc8[_0x0d8b('0x16')](0x194);}return _0x2c64e2;};}function handleError(_0x4562cb,_0x27b695){_0x27b695=_0x27b695||0x1f4;return function(_0x5e5bc3){logger[_0x0d8b('0x23')](_0x5e5bc3[_0x0d8b('0x24')]);if(_0x5e5bc3['name']){delete _0x5e5bc3[_0x0d8b('0x25')];}_0x4562cb['status'](_0x27b695)[_0x0d8b('0x26')](_0x5e5bc3);};}exports[_0x0d8b('0x27')]=function(_0xa2af02,_0x4fe6f9){var _0x59a905={},_0x28f639={},_0x3ef745={'count':0x0,'rows':[]};var _0x4c05ee=_[_0x0d8b('0x28')](db['SmsTransferReport'][_0x0d8b('0x29')],function(_0x4b59e5){return{'name':_0x4b59e5[_0x0d8b('0x2a')],'type':_0x4b59e5['type'][_0x0d8b('0x2b')]};});_0x28f639['model']=_[_0x0d8b('0x28')](_0x4c05ee,'name');_0x28f639[_0x0d8b('0x2c')]=_[_0x0d8b('0x2d')](_0xa2af02[_0x0d8b('0x2c')]);_0x28f639['filters']=_['intersection'](_0x28f639['model'],_0x28f639[_0x0d8b('0x2c')]);_0x59a905['attributes']=_[_0x0d8b('0x2e')](_0x28f639['model'],qs['fields'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x59a905[_0x0d8b('0x30')]=_0x59a905[_0x0d8b('0x30')][_0x0d8b('0x31')]?_0x59a905[_0x0d8b('0x30')]:_0x28f639[_0x0d8b('0x32')];if(!_0xa2af02[_0x0d8b('0x2c')]['hasOwnProperty'](_0x0d8b('0x33'))){_0x59a905[_0x0d8b('0x1b')]=qs['limit'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1b')]);_0x59a905[_0x0d8b('0x1a')]=qs['offset'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}_0x59a905[_0x0d8b('0x34')]=qs[_0x0d8b('0x35')](_0xa2af02[_0x0d8b('0x2c')]['sort']);_0x59a905[_0x0d8b('0x36')]=qs[_0x0d8b('0x37')](_['pick'](_0xa2af02[_0x0d8b('0x2c')],_0x28f639[_0x0d8b('0x37')]),_0x4c05ee);if(_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x59a905[_0x0d8b('0x36')]=_['merge'](_0x59a905['where'],{'$or':_[_0x0d8b('0x28')](_0x4c05ee,function(_0x5c2c04){if(_0x5c2c04['type']!==_0x0d8b('0x39')){var _0x2e279c={};_0x2e279c[_0x5c2c04[_0x0d8b('0x25')]]={'$like':'%'+_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x2e279c;}})});}_0x59a905=_[_0x0d8b('0x3a')]({},_0x59a905,_0xa2af02['options']);var _0x6e5bab={'where':_0x59a905[_0x0d8b('0x36')]};return db[_0x0d8b('0x3b')][_0x0d8b('0x3c')](_0x6e5bab)[_0x0d8b('0x22')](function(_0x1a39ad){_0x3ef745[_0x0d8b('0x3c')]=_0x1a39ad;if(_0xa2af02['query'][_0x0d8b('0x3d')]){_0x59a905[_0x0d8b('0x3e')]=[{'all':!![]}];}return db[_0x0d8b('0x3b')][_0x0d8b('0x3f')](_0x59a905);})['then'](function(_0xe0bf42){_0x3ef745['rows']=_0xe0bf42;return _0x3ef745;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4fe6f9,_0x59a905))[_0x0d8b('0x40')](handleError(_0x4fe6f9,null));};exports[_0x0d8b('0x41')]=function(_0x26ac10,_0x35fa7e){var _0x3e632e={'raw':!![],'where':{'id':_0x26ac10[_0x0d8b('0x42')]['id']}},_0x1ff17d={};_0x1ff17d[_0x0d8b('0x32')]=_[_0x0d8b('0x2d')](db['SmsTransferReport']['rawAttributes']);_0x1ff17d['query']=_['keys'](_0x26ac10['query']);_0x1ff17d[_0x0d8b('0x37')]=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],_0x1ff17d['query']);_0x3e632e['attributes']=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],qs[_0x0d8b('0x2f')](_0x26ac10['query'][_0x0d8b('0x2f')]));_0x3e632e[_0x0d8b('0x30')]=_0x3e632e['attributes']['length']?_0x3e632e[_0x0d8b('0x30')]:_0x1ff17d['model'];if(_0x26ac10[_0x0d8b('0x2c')]['includeAll']){_0x3e632e['include']=[{'all':!![]}];}_0x3e632e=_[_0x0d8b('0x3a')]({},_0x3e632e,_0x26ac10[_0x0d8b('0x43')]);return db['SmsTransferReport']['find'](_0x3e632e)['then'](handleEntityNotFound(_0x35fa7e,null))['then'](respondWithResult(_0x35fa7e,null))[_0x0d8b('0x40')](handleError(_0x35fa7e,null));};exports[_0x0d8b('0x44')]=function(_0xd9d4c3,_0x490eda){return db[_0x0d8b('0x3b')][_0x0d8b('0x44')](_0xd9d4c3[_0x0d8b('0x45')],{})[_0x0d8b('0x22')](respondWithResult(_0x490eda,0xc9))[_0x0d8b('0x40')](handleError(_0x490eda,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x45')]['id']){delete _0x11d22b[_0x0d8b('0x45')]['id'];}return db[_0x0d8b('0x3b')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x45')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x40')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x47')]=function(_0x574b90,_0x371fa0){return db['SmsTransferReport']['find']({'where':{'id':_0x574b90[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x371fa0,null))[_0x0d8b('0x22')](removeEntity(_0x371fa0,null))[_0x0d8b('0x40')](handleError(_0x371fa0,null));};exports['describe']=function(_0x131579,_0x1106d6){return db[_0x0d8b('0x3b')][_0x0d8b('0x48')]()[_0x0d8b('0x22')](respondWithResult(_0x1106d6,null))['catch'](handleError(_0x1106d6,null));}; \ No newline at end of file +var _0x9c44=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsTransferReport','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x26af55,_0x28f762){var _0xc53f15=function(_0xa0f90){while(--_0xa0f90){_0x26af55['push'](_0x26af55['shift']());}};_0xc53f15(++_0x28f762);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){_0x2197d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2263ae,_0x15581b){return function(_0x26c640){if(!_0x26c640){_0x2263ae[_0x49c4('0x14')](0x194);}return _0x26c640;};}function handleError(_0x4811c4,_0x5850f2){_0x5850f2=_0x5850f2||0x1f4;return function(_0x180276){logger[_0x49c4('0x21')](_0x180276['stack']);if(_0x180276[_0x49c4('0x22')]){delete _0x180276[_0x49c4('0x22')];}_0x4811c4[_0x49c4('0x16')](_0x5850f2)[_0x49c4('0x23')](_0x180276);};}exports['index']=function(_0x543ea2,_0x449960){var _0x53c199={},_0x3800b7={},_0x3852b2={'count':0x0,'rows':[]};var _0x3f1708=_[_0x49c4('0x24')](db['SmsTransferReport'][_0x49c4('0x25')],function(_0x2b2793){return{'name':_0x2b2793[_0x49c4('0x26')],'type':_0x2b2793[_0x49c4('0x27')][_0x49c4('0x28')]};});_0x3800b7[_0x49c4('0x29')]=_[_0x49c4('0x24')](_0x3f1708,_0x49c4('0x22'));_0x3800b7[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](_0x543ea2[_0x49c4('0x2a')]);_0x3800b7['filters']=_['intersection'](_0x3800b7['model'],_0x3800b7[_0x49c4('0x2a')]);_0x53c199[_0x49c4('0x2c')]=_[_0x49c4('0x2d')](_0x3800b7[_0x49c4('0x29')],qs[_0x49c4('0x2e')](_0x543ea2['query'][_0x49c4('0x2e')]));_0x53c199[_0x49c4('0x2c')]=_0x53c199[_0x49c4('0x2c')][_0x49c4('0x2f')]?_0x53c199['attributes']:_0x3800b7['model'];if(!_0x543ea2[_0x49c4('0x2a')][_0x49c4('0x30')](_0x49c4('0x31'))){_0x53c199[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x543ea2['query'][_0x49c4('0x1a')]);_0x53c199[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x543ea2['query']['offset']);}_0x53c199[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_0x543ea2[_0x49c4('0x2a')][_0x49c4('0x33')]);_0x53c199[_0x49c4('0x34')]=qs[_0x49c4('0x35')](_[_0x49c4('0x36')](_0x543ea2[_0x49c4('0x2a')],_0x3800b7[_0x49c4('0x35')]),_0x3f1708);if(_0x543ea2['query'][_0x49c4('0x37')]){_0x53c199['where']=_[_0x49c4('0x38')](_0x53c199[_0x49c4('0x34')],{'$or':_[_0x49c4('0x24')](_0x3f1708,function(_0x1c2830){if(_0x1c2830['type']!==_0x49c4('0x39')){var _0x31f3ff={};_0x31f3ff[_0x1c2830[_0x49c4('0x22')]]={'$like':'%'+_0x543ea2['query'][_0x49c4('0x37')]+'%'};return _0x31f3ff;}})});}_0x53c199=_[_0x49c4('0x38')]({},_0x53c199,_0x543ea2[_0x49c4('0x3a')]);var _0x5e5366={'where':_0x53c199[_0x49c4('0x34')]};return db[_0x49c4('0x3b')][_0x49c4('0x18')](_0x5e5366)[_0x49c4('0x20')](function(_0x70e552){_0x3852b2[_0x49c4('0x18')]=_0x70e552;if(_0x543ea2[_0x49c4('0x2a')]['includeAll']){_0x53c199[_0x49c4('0x3c')]=[{'all':!![]}];}return db[_0x49c4('0x3b')][_0x49c4('0x3d')](_0x53c199);})[_0x49c4('0x20')](function(_0x41ad28){_0x3852b2[_0x49c4('0x3e')]=_0x41ad28;return _0x3852b2;})[_0x49c4('0x20')](respondWithFilteredResult(_0x449960,_0x53c199))[_0x49c4('0x3f')](handleError(_0x449960,null));};exports[_0x49c4('0x40')]=function(_0x2668ed,_0x2dffb4){var _0xa3d59e={'raw':!![],'where':{'id':_0x2668ed['params']['id']}},_0x326142={};_0x326142[_0x49c4('0x29')]=_['keys'](db[_0x49c4('0x3b')][_0x49c4('0x25')]);_0x326142[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](_0x2668ed[_0x49c4('0x2a')]);_0x326142[_0x49c4('0x35')]=_['intersection'](_0x326142['model'],_0x326142[_0x49c4('0x2a')]);_0xa3d59e[_0x49c4('0x2c')]=_[_0x49c4('0x2d')](_0x326142[_0x49c4('0x29')],qs['fields'](_0x2668ed[_0x49c4('0x2a')][_0x49c4('0x2e')]));_0xa3d59e[_0x49c4('0x2c')]=_0xa3d59e[_0x49c4('0x2c')][_0x49c4('0x2f')]?_0xa3d59e[_0x49c4('0x2c')]:_0x326142[_0x49c4('0x29')];if(_0x2668ed[_0x49c4('0x2a')][_0x49c4('0x41')]){_0xa3d59e['include']=[{'all':!![]}];}_0xa3d59e=_[_0x49c4('0x38')]({},_0xa3d59e,_0x2668ed['options']);return db[_0x49c4('0x3b')][_0x49c4('0x42')](_0xa3d59e)[_0x49c4('0x20')](handleEntityNotFound(_0x2dffb4,null))[_0x49c4('0x20')](respondWithResult(_0x2dffb4,null))[_0x49c4('0x3f')](handleError(_0x2dffb4,null));};exports['create']=function(_0x592e8e,_0x15b674){return db[_0x49c4('0x3b')][_0x49c4('0x43')](_0x592e8e[_0x49c4('0x44')],{})[_0x49c4('0x20')](respondWithResult(_0x15b674,0xc9))[_0x49c4('0x3f')](handleError(_0x15b674,null));};exports['update']=function(_0x3bac1b,_0x5cfff9){if(_0x3bac1b[_0x49c4('0x44')]['id']){delete _0x3bac1b[_0x49c4('0x44')]['id'];}return db[_0x49c4('0x3b')][_0x49c4('0x42')]({'where':{'id':_0x3bac1b[_0x49c4('0x45')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x5cfff9,null))[_0x49c4('0x20')](saveUpdates(_0x3bac1b['body'],null))[_0x49c4('0x20')](respondWithResult(_0x5cfff9,null))[_0x49c4('0x3f')](handleError(_0x5cfff9,null));};exports['destroy']=function(_0x1e1ac4,_0xaece5f){return db[_0x49c4('0x3b')][_0x49c4('0x42')]({'where':{'id':_0x1e1ac4['params']['id']}})['then'](handleEntityNotFound(_0xaece5f,null))[_0x49c4('0x20')](removeEntity(_0xaece5f,null))['catch'](handleError(_0xaece5f,null));};exports[_0x49c4('0x46')]=function(_0x1f941f,_0x3811b2){return db[_0x49c4('0x3b')][_0x49c4('0x46')]()[_0x49c4('0x20')](respondWithResult(_0x3811b2,null))[_0x49c4('0x3f')](handleError(_0x3811b2,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index ca454db..8226646 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 _0x4fb4=['moment','bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','util','../../config/logger','api'];(function(_0x34e752,_0x32e2a2){var _0x7c6347=function(_0x4db671){while(--_0x4db671){_0x34e752['push'](_0x34e752['shift']());}};_0x7c6347(++_0x32e2a2);}(_0x4fb4,0x190));var _0x44fb=function(_0x773f00,_0x339e9f){_0x773f00=_0x773f00-0x0;var _0x370c5b=_0x4fb4[_0x773f00];return _0x370c5b;};'use strict';var _=require('lodash');var util=require(_0x44fb('0x0'));var logger=require(_0x44fb('0x1'))(_0x44fb('0x2'));var moment=require(_0x44fb('0x3'));var BPromise=require(_0x44fb('0x4'));var rp=require(_0x44fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44fb('0x6'));var config=require(_0x44fb('0x7'));var attributes=require(_0x44fb('0x8'));module[_0x44fb('0x9')]=function(_0x375d33,_0x173e70){return _0x375d33[_0x44fb('0xa')](_0x44fb('0xb'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x44fb('0xc'),'fields':[_0x44fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','util'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0x814b,0x1a2));var _0xb814=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0x814b[_0x5d5bcb];return _0x4ea5eb;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 20e0454..1e4c0c7 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 _0x61ec=['lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x269f82,_0x50b736){var _0x2d49de=function(_0x5b0996){while(--_0x5b0996){_0x269f82['push'](_0x269f82['shift']());}};_0x2d49de(++_0x50b736);}(_0x61ec,0x1e3));var _0xc61e=function(_0x30238f,_0x412246){_0x30238f=_0x30238f-0x0;var _0x5ef732=_0x61ec[_0x30238f];return _0x5ef732;};'use strict';var _=require(_0xc61e('0x0'));var util=require(_0xc61e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc61e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc61e('0x3'))['db'];var utils=require(_0xc61e('0x4'));var logger=require(_0xc61e('0x5'))(_0xc61e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc61e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f0612,_0x5d9f33,_0x3d621f){return new BPromise(function(_0x5532c2,_0x42e7f3){return client[_0xc61e('0x8')](_0x1f0612,_0x3d621f)[_0xc61e('0x9')](function(_0x509de6){logger[_0xc61e('0xa')](_0xc61e('0xb'),_0x5d9f33,'request\x20sent');logger[_0xc61e('0xc')](_0xc61e('0xd'),_0x5d9f33,_0xc61e('0xe'),JSON[_0xc61e('0xf')](_0x509de6));if(_0x509de6[_0xc61e('0x10')]){if(_0x509de6[_0xc61e('0x10')][_0xc61e('0x11')]===0x1f4){logger[_0xc61e('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x5d9f33,_0x509de6['error'][_0xc61e('0x12')]);return _0x42e7f3(_0x509de6[_0xc61e('0x10')][_0xc61e('0x12')]);}logger[_0xc61e('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x5d9f33,_0x509de6[_0xc61e('0x10')][_0xc61e('0x12')]);return _0x5532c2(_0x509de6['error'][_0xc61e('0x12')]);}else{logger[_0xc61e('0xa')](_0xc61e('0xb'),_0x5d9f33,_0xc61e('0xe'));_0x5532c2(_0x509de6[_0xc61e('0x13')][_0xc61e('0x12')]);}})[_0xc61e('0x14')](function(_0x1c8476){logger[_0xc61e('0x10')](_0xc61e('0xb'),_0x5d9f33,_0x1c8476);_0x42e7f3(_0x1c8476);});});} \ No newline at end of file +var _0x1898=['debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x461424,_0x272b7c){var _0x59ae5b=function(_0x59c464){while(--_0x59c464){_0x461424['push'](_0x461424['shift']());}};_0x59ae5b(++_0x272b7c);}(_0x1898,0x105));var _0x8189=function(_0x31054b,_0x1a7de8){_0x31054b=_0x31054b-0x0;var _0x265cca=_0x1898[_0x31054b];return _0x265cca;};'use strict';var _=require(_0x8189('0x0'));var util=require(_0x8189('0x1'));var moment=require(_0x8189('0x2'));var BPromise=require(_0x8189('0x3'));var rs=require(_0x8189('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8189('0x5'))['db'];var utils=require(_0x8189('0x6'));var logger=require(_0x8189('0x7'))(_0x8189('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8189('0x9')][_0x8189('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b7b10,_0x4c4233,_0x2110b7){return new BPromise(function(_0x344bab,_0x5e5f47){return client[_0x8189('0xb')](_0x4b7b10,_0x2110b7)[_0x8189('0xc')](function(_0x9e7fb6){logger['info'](_0x8189('0xd'),_0x4c4233,_0x8189('0xe'));logger[_0x8189('0xf')](_0x8189('0x10'),_0x4c4233,'request\x20sent',JSON[_0x8189('0x11')](_0x9e7fb6));if(_0x9e7fb6[_0x8189('0x12')]){if(_0x9e7fb6[_0x8189('0x12')][_0x8189('0x13')]===0x1f4){logger[_0x8189('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x4c4233,_0x9e7fb6[_0x8189('0x12')]['message']);return _0x5e5f47(_0x9e7fb6[_0x8189('0x12')][_0x8189('0x14')]);}logger[_0x8189('0x12')](_0x8189('0xd'),_0x4c4233,_0x9e7fb6[_0x8189('0x12')][_0x8189('0x14')]);return _0x344bab(_0x9e7fb6[_0x8189('0x12')][_0x8189('0x14')]);}else{logger[_0x8189('0x15')](_0x8189('0xd'),_0x4c4233,_0x8189('0xe'));_0x344bab(_0x9e7fb6['result'][_0x8189('0x14')]);}})[_0x8189('0x16')](function(_0xfedae8){logger[_0x8189('0x12')](_0x8189('0xd'),_0x4c4233,_0xfedae8);_0x5e5f47(_0xfedae8);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 3d21e86..0c52798 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 _0xdc79=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage','join','root','server/files/sounds/original/','replace','format','%s-%s%s','basename','originalname','now','extname','post','single','file','create','put','update'];(function(_0x2c123a,_0x9c4c76){var _0x269c79=function(_0x636ad8){while(--_0x636ad8){_0x2c123a['push'](_0x2c123a['shift']());}};_0x269c79(++_0x9c4c76);}(_0xdc79,0x9b));var _0x9dc7=function(_0x143e07,_0x3b2529){_0x143e07=_0x143e07-0x0;var _0x184047=_0xdc79[_0x143e07];return _0x184047;};'use strict';var multer=require(_0x9dc7('0x0'));var util=require(_0x9dc7('0x1'));var path=require(_0x9dc7('0x2'));var timeout=require('connect-timeout');var express=require(_0x9dc7('0x3'));var router=express[_0x9dc7('0x4')]();var auth=require(_0x9dc7('0x5'));var interaction=require(_0x9dc7('0x6'));var config=require(_0x9dc7('0x7'));var controller=require('./sound.controller');router[_0x9dc7('0x8')]('/',auth[_0x9dc7('0x9')](),controller[_0x9dc7('0xa')]);router['get'](_0x9dc7('0xb'),auth['isAuthenticated'](),controller[_0x9dc7('0xc')]);router['get'](_0x9dc7('0xd'),auth[_0x9dc7('0x9')](),controller['download']);var upload=multer({'storage':multer[_0x9dc7('0xe')]({'destination':function(_0x23d010,_0x16c7a0,_0x1970bd){_0x1970bd(null,path[_0x9dc7('0xf')](config[_0x9dc7('0x10')],_0x9dc7('0x11')));},'filename':function(_0x302018,_0x59d631,_0xb46eb3){_0x59d631['originalname']=_0x59d631['originalname'][_0x9dc7('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xb46eb3(null,util[_0x9dc7('0x13')](_0x9dc7('0x14'),path[_0x9dc7('0x15')](_0x59d631[_0x9dc7('0x16')],path['extname'](_0x59d631[_0x9dc7('0x16')])),Date[_0x9dc7('0x17')](),path[_0x9dc7('0x18')](_0x59d631['originalname'])));}})});router[_0x9dc7('0x19')]('/',upload[_0x9dc7('0x1a')](_0x9dc7('0x1b')),controller[_0x9dc7('0x1c')]);router[_0x9dc7('0x1d')]('/:id',auth[_0x9dc7('0x9')](),controller[_0x9dc7('0x1e')]);router['delete'](_0x9dc7('0xb'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0xd30d=['delete','exports','util','connect-timeout','express','Router','./sound.controller','isAuthenticated','index','get','/:id/download','download','server/files/sounds/original/','originalname','post','file','create','/:id','update'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xd30d,0x145));var _0xdd30=function(_0x38b63e,_0xfe6475){_0x38b63e=_0x38b63e-0x0;var _0x15ca63=_0xd30d[_0x38b63e];return _0x15ca63;};'use strict';var multer=require('multer');var util=require(_0xdd30('0x0'));var path=require('path');var timeout=require(_0xdd30('0x1'));var express=require(_0xdd30('0x2'));var router=express[_0xdd30('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdd30('0x4'));router['get']('/',auth[_0xdd30('0x5')](),controller[_0xdd30('0x6')]);router[_0xdd30('0x7')]('/:id',auth[_0xdd30('0x5')](),controller['show']);router[_0xdd30('0x7')](_0xdd30('0x8'),auth[_0xdd30('0x5')](),controller[_0xdd30('0x9')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x49cfaf,_0xc96726,_0xb8e3d9){_0xb8e3d9(null,path['join'](config['root'],_0xdd30('0xa')));},'filename':function(_0x5a5160,_0x13969d,_0x580432){_0x13969d[_0xdd30('0xb')]=_0x13969d[_0xdd30('0xb')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x580432(null,util['format']('%s-%s%s',path['basename'](_0x13969d[_0xdd30('0xb')],path['extname'](_0x13969d[_0xdd30('0xb')])),Date['now'](),path['extname'](_0x13969d[_0xdd30('0xb')])));}})});router[_0xdd30('0xc')]('/',upload['single'](_0xdd30('0xd')),controller[_0xdd30('0xe')]);router['put'](_0xdd30('0xf'),auth[_0xdd30('0x5')](),controller[_0xdd30('0x10')]);router[_0xdd30('0x11')](_0xdd30('0xf'),auth[_0xdd30('0x5')](),controller[_0xdd30('0x11')]);module[_0xdd30('0x12')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 630671c..0c8279d 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 _0xff61=['name','STRING','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x16170c,_0x43fdea){var _0x422b15=function(_0x45d0c1){while(--_0x45d0c1){_0x16170c['push'](_0x16170c['shift']());}};_0x422b15(++_0x43fdea);}(_0xff61,0x131));var _0x1ff6=function(_0x2bccb0,_0x53d732){_0x2bccb0=_0x2bccb0-0x0;var _0x2efe3e=_0xff61[_0x2bccb0];return _0x2efe3e;};'use strict';var Sequelize=require(_0x1ff6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1ff6('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x1ff6('0x2')]},'display_name':{'type':Sequelize[_0x1ff6('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x1ff6('0x2')]},'original_format':{'type':Sequelize[_0x1ff6('0x2')]},'original_duration':{'type':Sequelize[_0x1ff6('0x3')]},'original_sampleCount':{'type':Sequelize[_0x1ff6('0x4')]},'original_channelCount':{'type':Sequelize[_0x1ff6('0x5')]},'original_bitRate':{'type':Sequelize[_0x1ff6('0x4')]},'original_sampleRate':{'type':Sequelize[_0x1ff6('0x5')]},'converted_format':{'type':Sequelize[_0x1ff6('0x2')]},'converted_duration':{'type':Sequelize[_0x1ff6('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x1ff6('0x5')]},'converted_bitRate':{'type':Sequelize[_0x1ff6('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x1ff6('0x5')]}}; \ No newline at end of file +var _0xc600=['FLOAT','BIGINT','INTEGER','exports','STRING','name'];(function(_0x45ce08,_0x59dcc7){var _0x23dff2=function(_0x1ad0e5){while(--_0x1ad0e5){_0x45ce08['push'](_0x45ce08['shift']());}};_0x23dff2(++_0x59dcc7);}(_0xc600,0x93));var _0x0c60=function(_0x4d0f6b,_0x1f122b){_0x4d0f6b=_0x4d0f6b-0x0;var _0x8d4595=_0xc600[_0x4d0f6b];return _0x8d4595;};'use strict';var Sequelize=require('sequelize');module[_0x0c60('0x0')]={'name':{'type':Sequelize[_0x0c60('0x1')],'unique':_0x0c60('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x0c60('0x1')]},'display_name':{'type':Sequelize[_0x0c60('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x0c60('0x1')]},'original_duration':{'type':Sequelize[_0x0c60('0x3')]},'original_sampleCount':{'type':Sequelize[_0x0c60('0x4')]},'original_channelCount':{'type':Sequelize[_0x0c60('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x0c60('0x5')]},'converted_format':{'type':Sequelize[_0x0c60('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x0c60('0x4')]},'converted_channelCount':{'type':Sequelize[_0x0c60('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x0c60('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 9fbf23b..18b197d 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 _0x3bc2=['create','basename','originalname','extname','file','filename','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','transcode','unlinkSync','src','duration','sampleCount','original_channelCount','channelCount','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_bitRate','bitRate','chmodSync','0777','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','get','Sounds','error','name','send','index','Sound','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','length','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','params','fields','options','find','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','download','format','%s.%s','catch'];(function(_0x2f15f9,_0x125085){var _0x93848d=function(_0x3d5882){while(--_0x3d5882){_0x2f15f9['push'](_0x2f15f9['shift']());}};_0x93848d(++_0x125085);}(_0x3bc2,0x91));var _0x23bc=function(_0x2d7109,_0x50dcb6){_0x2d7109=_0x2d7109-0x0;var _0x43caef=_0x3bc2[_0x2d7109];return _0x43caef;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x23bc('0x0'));var jsonpatch=require(_0x23bc('0x1'));var rp=require(_0x23bc('0x2'));var moment=require(_0x23bc('0x3'));var BPromise=require(_0x23bc('0x4'));var Mustache=require('mustache');var util=require(_0x23bc('0x5'));var path=require(_0x23bc('0x6'));var sox=require(_0x23bc('0x7'));var csv=require(_0x23bc('0x8'));var ejs=require(_0x23bc('0x9'));var fs=require('fs');var _=require(_0x23bc('0xa'));var squel=require(_0x23bc('0xb'));var crypto=require(_0x23bc('0xc'));var jsforce=require(_0x23bc('0xd'));var deskjs=require(_0x23bc('0xe'));var toCsv=require(_0x23bc('0x8'));var querystring=require(_0x23bc('0xf'));var Papa=require(_0x23bc('0x10'));var Redis=require('ioredis');var authService=require(_0x23bc('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x23bc('0x12'));var config=require(_0x23bc('0x13'));var db=require(_0x23bc('0x14'))['db'];function respondWithStatusCode(_0x5c57f7,_0x5b385c){_0x5b385c=_0x5b385c||0xcc;return function(_0x36a32a){if(_0x36a32a){return _0x5c57f7[_0x23bc('0x15')](_0x5b385c);}return _0x5c57f7[_0x23bc('0x16')](_0x5b385c)[_0x23bc('0x17')]();};}function respondWithResult(_0x3de0b5,_0x3818b8){_0x3818b8=_0x3818b8||0xc8;return function(_0x517608){if(_0x517608){return _0x3de0b5[_0x23bc('0x16')](_0x3818b8)[_0x23bc('0x18')](_0x517608);}};}function respondWithFilteredResult(_0x891c3b,_0x5af033){return function(_0x5a751f){if(_0x5a751f){var _0x48877a=_0x5a751f[_0x23bc('0x19')],_0x12778a=_0x5af033[_0x23bc('0x1a')],_0x597542=_0x5af033[_0x23bc('0x1a')]+_0x5af033[_0x23bc('0x1b')],_0x417a39;if(_0x597542>=_0x48877a){_0x597542=_0x48877a;_0x417a39=0xc8;}else{_0x417a39=0xce;}_0x891c3b[_0x23bc('0x16')](_0x417a39);return _0x891c3b[_0x23bc('0x1c')](_0x23bc('0x1d'),_0x12778a+'-'+_0x597542+'/'+_0x48877a)[_0x23bc('0x18')](_0x5a751f);}return null;};}function patchUpdates(_0xe7b601){return function(_0x1df089){try{jsonpatch[_0x23bc('0x1e')](_0x1df089,_0xe7b601,!![]);}catch(_0x419e07){return BPromise[_0x23bc('0x1f')](_0x419e07);}return _0x1df089[_0x23bc('0x20')]();};}function saveUpdates(_0x4309e7,_0x453c0e){return function(_0x26c36c){if(_0x26c36c){return _0x26c36c['update'](_0x4309e7)['then'](function(_0x1e85fc){return _0x1e85fc;});}return null;};}function removeEntity(_0x5ad79c,_0x4348c0){return function(_0x10d2f6){if(_0x10d2f6){return _0x10d2f6[_0x23bc('0x21')]()[_0x23bc('0x22')](function(){var _0x3fbe52=_0x10d2f6[_0x23bc('0x23')]({'plain':!![]});var _0x17f23f=_0x23bc('0x24');return db['UserProfileResource'][_0x23bc('0x21')]({'where':{'type':_0x17f23f,'resourceId':_0x3fbe52['id']}})[_0x23bc('0x22')](function(){return _0x10d2f6;});})['then'](function(){_0x5ad79c[_0x23bc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x573398,_0x26be9f){return function(_0x241d52){if(!_0x241d52){_0x573398[_0x23bc('0x15')](0x194);}return _0x241d52;};}function handleError(_0x128b92,_0x4398f9){_0x4398f9=_0x4398f9||0x1f4;return function(_0x1b6b41){logger[_0x23bc('0x25')](_0x1b6b41['stack']);if(_0x1b6b41[_0x23bc('0x26')]){delete _0x1b6b41[_0x23bc('0x26')];}_0x128b92[_0x23bc('0x16')](_0x4398f9)[_0x23bc('0x27')](_0x1b6b41);};}exports[_0x23bc('0x28')]=function(_0x368023,_0x52dd4c){var _0x584fb0={},_0x202a15={},_0x1714e5={'count':0x0,'rows':[]};var _0x5669d2=_['map'](db[_0x23bc('0x29')][_0x23bc('0x2a')],function(_0x58e74f){return{'name':_0x58e74f[_0x23bc('0x2b')],'type':_0x58e74f[_0x23bc('0x2c')][_0x23bc('0x2d')]};});_0x202a15[_0x23bc('0x2e')]=_[_0x23bc('0x2f')](_0x5669d2,_0x23bc('0x26'));_0x202a15['query']=_[_0x23bc('0x30')](_0x368023[_0x23bc('0x31')]);_0x202a15[_0x23bc('0x32')]=_[_0x23bc('0x33')](_0x202a15[_0x23bc('0x2e')],_0x202a15[_0x23bc('0x31')]);_0x584fb0['attributes']=_[_0x23bc('0x33')](_0x202a15[_0x23bc('0x2e')],qs['fields'](_0x368023[_0x23bc('0x31')]['fields']));_0x584fb0['attributes']=_0x584fb0[_0x23bc('0x34')][_0x23bc('0x35')]?_0x584fb0[_0x23bc('0x34')]:_0x202a15[_0x23bc('0x2e')];if(!_0x368023[_0x23bc('0x31')]['hasOwnProperty']('nolimit')){_0x584fb0[_0x23bc('0x1b')]=qs['limit'](_0x368023[_0x23bc('0x31')]['limit']);_0x584fb0[_0x23bc('0x1a')]=qs[_0x23bc('0x1a')](_0x368023[_0x23bc('0x31')]['offset']);}_0x584fb0['order']=qs[_0x23bc('0x36')](_0x368023[_0x23bc('0x31')][_0x23bc('0x36')]);_0x584fb0['where']=qs['filters'](_['pick'](_0x368023[_0x23bc('0x31')],_0x202a15['filters']),_0x5669d2);if(_0x368023[_0x23bc('0x31')][_0x23bc('0x37')]){_0x584fb0[_0x23bc('0x38')]=_[_0x23bc('0x39')](_0x584fb0[_0x23bc('0x38')],{'$or':_['map'](_0x5669d2,function(_0x15a5a2){if(_0x15a5a2['type']!==_0x23bc('0x3a')){var _0x574571={};_0x574571[_0x15a5a2['name']]={'$like':'%'+_0x368023[_0x23bc('0x31')][_0x23bc('0x37')]+'%'};return _0x574571;}})});}_0x584fb0=_[_0x23bc('0x39')]({},_0x584fb0,_0x368023['options']);var _0x455a85={'where':_0x584fb0[_0x23bc('0x38')]};return db[_0x23bc('0x29')]['count'](_0x455a85)['then'](function(_0x4cb653){_0x1714e5['count']=_0x4cb653;if(_0x368023[_0x23bc('0x31')][_0x23bc('0x3b')]){_0x584fb0[_0x23bc('0x3c')]=[{'all':!![]}];}return db[_0x23bc('0x29')][_0x23bc('0x3d')](_0x584fb0);})[_0x23bc('0x22')](function(_0x198eaa){_0x1714e5[_0x23bc('0x3e')]=_0x198eaa;return _0x1714e5;})['then'](respondWithFilteredResult(_0x52dd4c,_0x584fb0))['catch'](handleError(_0x52dd4c,null));};exports['show']=function(_0x42c001,_0x1dff22){var _0x31c1d0={'raw':!![],'where':{'id':_0x42c001[_0x23bc('0x3f')]['id']}},_0x2c2e52={};_0x2c2e52['model']=_[_0x23bc('0x30')](db[_0x23bc('0x29')][_0x23bc('0x2a')]);_0x2c2e52['query']=_['keys'](_0x42c001['query']);_0x2c2e52['filters']=_['intersection'](_0x2c2e52[_0x23bc('0x2e')],_0x2c2e52[_0x23bc('0x31')]);_0x31c1d0[_0x23bc('0x34')]=_[_0x23bc('0x33')](_0x2c2e52[_0x23bc('0x2e')],qs[_0x23bc('0x40')](_0x42c001['query']['fields']));_0x31c1d0[_0x23bc('0x34')]=_0x31c1d0[_0x23bc('0x34')]['length']?_0x31c1d0[_0x23bc('0x34')]:_0x2c2e52[_0x23bc('0x2e')];if(_0x42c001[_0x23bc('0x31')][_0x23bc('0x3b')]){_0x31c1d0[_0x23bc('0x3c')]=[{'all':!![]}];}_0x31c1d0=_[_0x23bc('0x39')]({},_0x31c1d0,_0x42c001[_0x23bc('0x41')]);return db[_0x23bc('0x29')]['find'](_0x31c1d0)[_0x23bc('0x22')](handleEntityNotFound(_0x1dff22,null))['then'](respondWithResult(_0x1dff22,null))['catch'](handleError(_0x1dff22,null));};exports['download']=function(_0x5c934a,_0x5e2490,_0x623a99){return db[_0x23bc('0x29')][_0x23bc('0x42')]({'where':{'id':_0x5c934a[_0x23bc('0x3f')]['id']},'attributes':[_0x23bc('0x26'),_0x23bc('0x43'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x5e2490,null))[_0x23bc('0x22')](function(_0x4ed0ad){if(_0x4ed0ad){if(!fs[_0x23bc('0x44')](path[_0x23bc('0x45')](config[_0x23bc('0x46')],_0x23bc('0x47'),_0x4ed0ad[_0x23bc('0x43')]+'.'+_0x4ed0ad[_0x23bc('0x48')]))){throw new db[(_0x23bc('0x49'))][(_0x23bc('0x4a'))]('Sound\x20not\x20found');}return _0x5e2490[_0x23bc('0x4b')](path[_0x23bc('0x45')](config[_0x23bc('0x46')],'server/files/sounds/converted',util[_0x23bc('0x4c')]('%s.%s',_0x4ed0ad[_0x23bc('0x43')],_0x4ed0ad[_0x23bc('0x48')])),util[_0x23bc('0x4c')](_0x23bc('0x4d'),_0x4ed0ad[_0x23bc('0x26')],_0x4ed0ad[_0x23bc('0x48')]));}return null;})[_0x23bc('0x4e')](handleError(_0x5e2490,null));};exports[_0x23bc('0x4f')]=function(_0x36e08a,_0x47056f,_0x97e2f4){var _0x896a28={'name':path[_0x23bc('0x50')](_0x36e08a['file'][_0x23bc('0x51')],path[_0x23bc('0x52')](_0x36e08a[_0x23bc('0x53')][_0x23bc('0x51')])),'save_name':path[_0x23bc('0x50')](_0x36e08a[_0x23bc('0x53')][_0x23bc('0x54')],path[_0x23bc('0x52')](_0x36e08a[_0x23bc('0x53')][_0x23bc('0x54')])),'original_format':path[_0x23bc('0x52')](_0x36e08a['file'][_0x23bc('0x51')])['substring'](0x1),'converted_format':'wav'};var _0x3dc4b5=path[_0x23bc('0x45')](config[_0x23bc('0x46')],_0x23bc('0x55'),_0x36e08a[_0x23bc('0x53')]['filename']);var _0x53fb95=path['join'](config['root'],'server/files/sounds/converted',util[_0x23bc('0x4c')](_0x23bc('0x4d'),path[_0x23bc('0x50')](_0x36e08a[_0x23bc('0x53')][_0x23bc('0x54')],path['extname'](_0x36e08a[_0x23bc('0x53')][_0x23bc('0x54')])),_0x896a28[_0x23bc('0x48')]));logger[_0x23bc('0x56')](_0x23bc('0x57'),_0x3dc4b5);logger[_0x23bc('0x56')]('Sound\x20upload\x20destination:\x20%s',_0x53fb95);try{fs['chmodSync'](_0x3dc4b5,parseInt('0777',0x8));var _0xf7c517=sox[_0x23bc('0x58')](_0x3dc4b5,_0x53fb95,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xf7c517['on'](_0x23bc('0x25'),function(_0x2e3974){fs[_0x23bc('0x59')](_0x3dc4b5);_0x47056f[_0x23bc('0x16')](0x1f4)[_0x23bc('0x27')](_0x2e3974);});_0xf7c517['on'](_0x23bc('0x5a'),function(_0xb1eb03){_0x896a28['original_duration']=isNaN(_0xb1eb03['duration'])?null:_0xb1eb03[_0x23bc('0x5b')]*0x3e8;_0x896a28['original_sampleCount']=isNaN(_0xb1eb03[_0x23bc('0x5c')])?null:_0xb1eb03['sampleCount'];_0x896a28[_0x23bc('0x5d')]=isNaN(_0xb1eb03[_0x23bc('0x5e')])?null:_0xb1eb03['channelCount'];_0x896a28['original_bitRate']=isNaN(_0xb1eb03['bitRate'])?null:_0xb1eb03['bitRate'];_0x896a28[_0x23bc('0x5f')]=isNaN(_0xb1eb03['sampleRate'])?null:_0xb1eb03[_0x23bc('0x60')];});_0xf7c517['on'](_0x23bc('0x61'),function(_0x5444db){_0x896a28['converted_duration']=isNaN(_0x5444db[_0x23bc('0x5b')])?null:_0x5444db[_0x23bc('0x5b')]*0x3e8;_0x896a28[_0x23bc('0x62')]=isNaN(_0x5444db[_0x23bc('0x5c')])?null:_0x5444db['sampleCount'];_0x896a28['converted_channelCount']=isNaN(_0x5444db[_0x23bc('0x5e')])?null:_0x5444db[_0x23bc('0x5e')];_0x896a28[_0x23bc('0x63')]=isNaN(_0x5444db[_0x23bc('0x64')])?null:_0x5444db[_0x23bc('0x64')];_0x896a28['converted_sampleRate']=isNaN(_0x5444db[_0x23bc('0x60')])?null:_0x5444db[_0x23bc('0x60')];});_0xf7c517['on'](_0x23bc('0x17'),function(){fs[_0x23bc('0x65')](_0x53fb95,parseInt(_0x23bc('0x66'),0x8));return db[_0x23bc('0x29')]['create'](_0x896a28)[_0x23bc('0x22')](function(_0x352805){var _0x45e9b2={'role':_0x36e08a[_0x23bc('0x67')]['role'],'userProfileId':_0x36e08a['body'][_0x23bc('0x68')]};if(!_0x45e9b2)throw new Error(_0x23bc('0x69'));if(_0x45e9b2[_0x23bc('0x6a')]===_0x23bc('0x6b')){var _0x586515=_0x352805['get']({'plain':!![]});return db['UserProfileSection'][_0x23bc('0x42')]({'where':{'name':_0x23bc('0x24'),'userProfileId':_0x45e9b2['userProfileId']},'raw':!![]})[_0x23bc('0x22')](function(_0x2bf0ca){if(_0x2bf0ca&&_0x2bf0ca['autoAssociation']===0x0){return db['UserProfileResource'][_0x23bc('0x4f')]({'name':_0x586515[_0x23bc('0x26')],'resourceId':_0x586515['id'],'type':_0x2bf0ca['name'],'sectionId':_0x2bf0ca['id']},{})[_0x23bc('0x22')](function(){return _0x352805;});}else{return _0x352805;}})['catch'](function(_0x10e689){logger[_0x23bc('0x25')](_0x23bc('0x6c'),_0x10e689);throw _0x10e689;});}return _0x352805;})[_0x23bc('0x22')](respondWithResult(_0x47056f,null))[_0x23bc('0x4e')](handleError(_0x47056f,null));});_0xf7c517['start']();}catch(_0x133c27){_0x47056f[_0x23bc('0x16')](0x1f4)[_0x23bc('0x27')](_0x133c27);}};exports['update']=function(_0x4e5cc2,_0x51659d,_0x349af2){return db[_0x23bc('0x29')]['find']({'where':{'id':_0x4e5cc2[_0x23bc('0x3f')]['id']}})[_0x23bc('0x22')](handleEntityNotFound(_0x51659d,null))[_0x23bc('0x22')](saveUpdates(_['pick'](_0x4e5cc2[_0x23bc('0x67')],[_0x23bc('0x26'),_0x23bc('0x6d')]),null))[_0x23bc('0x22')](respondWithResult(_0x51659d,null))[_0x23bc('0x4e')](handleError(_0x51659d,null));};exports[_0x23bc('0x6e')]=function(_0x2da9d4,_0x256346,_0x2e2498){return db[_0x23bc('0x29')][_0x23bc('0x42')]({'where':{'id':_0x2da9d4[_0x23bc('0x3f')]['id']}})['then'](function(_0x4463b6){if(_0x4463b6){return _0x4463b6[_0x23bc('0x21')]();}})['then'](function(_0x1820ca){var _0x3a29fc=path['join'](config[_0x23bc('0x46')],_0x23bc('0x55'),util[_0x23bc('0x4c')](_0x23bc('0x4d'),_0x1820ca[_0x23bc('0x43')],_0x1820ca[_0x23bc('0x6f')]));var _0x2fc64d=path[_0x23bc('0x45')](config[_0x23bc('0x46')],_0x23bc('0x47'),util[_0x23bc('0x4c')](_0x23bc('0x4d'),_0x1820ca[_0x23bc('0x43')],_0x1820ca[_0x23bc('0x48')]));fs[_0x23bc('0x59')](_0x3a29fc);fs[_0x23bc('0x59')](_0x2fc64d);return _0x1820ca;})[_0x23bc('0x22')](function(_0x416b4e){if(_0x416b4e){return _0x256346[_0x23bc('0x16')](0xcc)[_0x23bc('0x17')]();}})[_0x23bc('0x22')](handleEntityNotFound(_0x256346,null))[_0x23bc('0x4e')](handleError(_0x256346,null));}; \ No newline at end of file +var _0x0427=['hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','params','length','Sound','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','format','%s.%s','create','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','sampleRate','role','body','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','original_format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','then','get','Sounds','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields'];(function(_0x18d52f,_0x3e0bc5){var _0x459c22=function(_0x30c199){while(--_0x30c199){_0x18d52f['push'](_0x18d52f['shift']());}};_0x459c22(++_0x3e0bc5);}(_0x0427,0x137));var _0x7042=function(_0x5d7b5e,_0x44598b){_0x5d7b5e=_0x5d7b5e-0x0;var _0xb35768=_0x0427[_0x5d7b5e];return _0xb35768;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7042('0x0'));var zipdir=require(_0x7042('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7042('0x2'));var moment=require(_0x7042('0x3'));var BPromise=require(_0x7042('0x4'));var Mustache=require(_0x7042('0x5'));var util=require(_0x7042('0x6'));var path=require(_0x7042('0x7'));var sox=require(_0x7042('0x8'));var csv=require('to-csv');var ejs=require(_0x7042('0x9'));var fs=require('fs');var _=require(_0x7042('0xa'));var squel=require(_0x7042('0xb'));var crypto=require(_0x7042('0xc'));var jsforce=require(_0x7042('0xd'));var deskjs=require(_0x7042('0xe'));var toCsv=require(_0x7042('0xf'));var querystring=require(_0x7042('0x10'));var Papa=require(_0x7042('0x11'));var Redis=require('ioredis');var authService=require(_0x7042('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7042('0x13'));var utils=require('../../config/utils');var config=require(_0x7042('0x14'));var db=require(_0x7042('0x15'))['db'];function respondWithStatusCode(_0x1ee0d0,_0x5629f2){_0x5629f2=_0x5629f2||0xcc;return function(_0x5c06f0){if(_0x5c06f0){return _0x1ee0d0[_0x7042('0x16')](_0x5629f2);}return _0x1ee0d0[_0x7042('0x17')](_0x5629f2)[_0x7042('0x18')]();};}function respondWithResult(_0x275b32,_0x25dfe5){_0x25dfe5=_0x25dfe5||0xc8;return function(_0xee4c2){if(_0xee4c2){return _0x275b32['status'](_0x25dfe5)[_0x7042('0x19')](_0xee4c2);}};}function respondWithFilteredResult(_0x2c0a32,_0x6ed505){return function(_0x5c1ef0){if(_0x5c1ef0){var _0x4c68c4=_0x5c1ef0['count'],_0xc7e44e=_0x6ed505['offset'],_0x4de51e=_0x6ed505[_0x7042('0x1a')]+_0x6ed505[_0x7042('0x1b')],_0x208d0d;if(_0x4de51e>=_0x4c68c4){_0x4de51e=_0x4c68c4;_0x208d0d=0xc8;}else{_0x208d0d=0xce;}_0x2c0a32[_0x7042('0x17')](_0x208d0d);return _0x2c0a32[_0x7042('0x1c')](_0x7042('0x1d'),_0xc7e44e+'-'+_0x4de51e+'/'+_0x4c68c4)['json'](_0x5c1ef0);}return null;};}function patchUpdates(_0x438084){return function(_0x30e2aa){try{jsonpatch[_0x7042('0x1e')](_0x30e2aa,_0x438084,!![]);}catch(_0x39cfbe){return BPromise[_0x7042('0x1f')](_0x39cfbe);}return _0x30e2aa['save']();};}function saveUpdates(_0x462d9c,_0x580f84){return function(_0x363f3c){if(_0x363f3c){return _0x363f3c['update'](_0x462d9c)[_0x7042('0x20')](function(_0x472492){return _0x472492;});}return null;};}function removeEntity(_0x2e2421,_0x456dfc){return function(_0x484c82){if(_0x484c82){return _0x484c82['destroy']()['then'](function(){var _0x62e3d0=_0x484c82[_0x7042('0x21')]({'plain':!![]});var _0x3af8bc=_0x7042('0x22');return db['UserProfileResource'][_0x7042('0x23')]({'where':{'type':_0x3af8bc,'resourceId':_0x62e3d0['id']}})[_0x7042('0x20')](function(){return _0x484c82;});})[_0x7042('0x20')](function(){_0x2e2421[_0x7042('0x17')](0xcc)[_0x7042('0x18')]();});}};}function handleEntityNotFound(_0x54445b,_0xc5fed3){return function(_0x41dc11){if(!_0x41dc11){_0x54445b[_0x7042('0x16')](0x194);}return _0x41dc11;};}function handleError(_0x1a05d1,_0x2e4dbe){_0x2e4dbe=_0x2e4dbe||0x1f4;return function(_0x1cb194){logger[_0x7042('0x24')](_0x1cb194[_0x7042('0x25')]);if(_0x1cb194[_0x7042('0x26')]){delete _0x1cb194[_0x7042('0x26')];}_0x1a05d1[_0x7042('0x17')](_0x2e4dbe)[_0x7042('0x27')](_0x1cb194);};}exports[_0x7042('0x28')]=function(_0x1b6a29,_0x101b89){var _0x3203f3={},_0x477972={},_0xa7461d={'count':0x0,'rows':[]};var _0x370307=_['map'](db['Sound'][_0x7042('0x29')],function(_0x160af6){return{'name':_0x160af6[_0x7042('0x2a')],'type':_0x160af6[_0x7042('0x2b')][_0x7042('0x2c')]};});_0x477972[_0x7042('0x2d')]=_[_0x7042('0x2e')](_0x370307,'name');_0x477972['query']=_[_0x7042('0x2f')](_0x1b6a29[_0x7042('0x30')]);_0x477972['filters']=_[_0x7042('0x31')](_0x477972[_0x7042('0x2d')],_0x477972['query']);_0x3203f3[_0x7042('0x32')]=_[_0x7042('0x31')](_0x477972[_0x7042('0x2d')],qs[_0x7042('0x33')](_0x1b6a29[_0x7042('0x30')]['fields']));_0x3203f3[_0x7042('0x32')]=_0x3203f3['attributes']['length']?_0x3203f3[_0x7042('0x32')]:_0x477972['model'];if(!_0x1b6a29[_0x7042('0x30')][_0x7042('0x34')]('nolimit')){_0x3203f3[_0x7042('0x1b')]=qs['limit'](_0x1b6a29[_0x7042('0x30')][_0x7042('0x1b')]);_0x3203f3[_0x7042('0x1a')]=qs[_0x7042('0x1a')](_0x1b6a29[_0x7042('0x30')][_0x7042('0x1a')]);}_0x3203f3[_0x7042('0x35')]=qs[_0x7042('0x36')](_0x1b6a29[_0x7042('0x30')]['sort']);_0x3203f3[_0x7042('0x37')]=qs[_0x7042('0x38')](_[_0x7042('0x39')](_0x1b6a29['query'],_0x477972['filters']),_0x370307);if(_0x1b6a29[_0x7042('0x30')][_0x7042('0x3a')]){_0x3203f3['where']=_[_0x7042('0x3b')](_0x3203f3[_0x7042('0x37')],{'$or':_[_0x7042('0x2e')](_0x370307,function(_0x9cd929){if(_0x9cd929[_0x7042('0x2b')]!==_0x7042('0x3c')){var _0x228abd={};_0x228abd[_0x9cd929[_0x7042('0x26')]]={'$like':'%'+_0x1b6a29[_0x7042('0x30')][_0x7042('0x3a')]+'%'};return _0x228abd;}})});}_0x3203f3=_[_0x7042('0x3b')]({},_0x3203f3,_0x1b6a29[_0x7042('0x3d')]);var _0x246d62={'where':_0x3203f3['where']};return db['Sound'][_0x7042('0x3e')](_0x246d62)[_0x7042('0x20')](function(_0x2e727d){_0xa7461d[_0x7042('0x3e')]=_0x2e727d;if(_0x1b6a29['query'][_0x7042('0x3f')]){_0x3203f3[_0x7042('0x40')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x3203f3);})[_0x7042('0x20')](function(_0xd4b6){_0xa7461d[_0x7042('0x41')]=_0xd4b6;return _0xa7461d;})[_0x7042('0x20')](respondWithFilteredResult(_0x101b89,_0x3203f3))[_0x7042('0x42')](handleError(_0x101b89,null));};exports['show']=function(_0x5de476,_0x2c8d2a){var _0x3897fc={'raw':!![],'where':{'id':_0x5de476[_0x7042('0x43')]['id']}},_0x4e92d5={};_0x4e92d5[_0x7042('0x2d')]=_[_0x7042('0x2f')](db['Sound']['rawAttributes']);_0x4e92d5[_0x7042('0x30')]=_[_0x7042('0x2f')](_0x5de476[_0x7042('0x30')]);_0x4e92d5['filters']=_[_0x7042('0x31')](_0x4e92d5[_0x7042('0x2d')],_0x4e92d5['query']);_0x3897fc[_0x7042('0x32')]=_[_0x7042('0x31')](_0x4e92d5[_0x7042('0x2d')],qs[_0x7042('0x33')](_0x5de476[_0x7042('0x30')][_0x7042('0x33')]));_0x3897fc[_0x7042('0x32')]=_0x3897fc['attributes'][_0x7042('0x44')]?_0x3897fc[_0x7042('0x32')]:_0x4e92d5['model'];if(_0x5de476[_0x7042('0x30')][_0x7042('0x3f')]){_0x3897fc[_0x7042('0x40')]=[{'all':!![]}];}_0x3897fc=_[_0x7042('0x3b')]({},_0x3897fc,_0x5de476[_0x7042('0x3d')]);return db[_0x7042('0x45')]['find'](_0x3897fc)['then'](handleEntityNotFound(_0x2c8d2a,null))['then'](respondWithResult(_0x2c8d2a,null))[_0x7042('0x42')](handleError(_0x2c8d2a,null));};exports['download']=function(_0x4821d3,_0x15d12d,_0x57911e){return db[_0x7042('0x45')][_0x7042('0x46')]({'where':{'id':_0x4821d3[_0x7042('0x43')]['id']},'attributes':[_0x7042('0x26'),_0x7042('0x47'),_0x7042('0x48')],'raw':!![]})[_0x7042('0x20')](handleEntityNotFound(_0x15d12d,null))[_0x7042('0x20')](function(_0x44b4bb){if(_0x44b4bb){if(!fs[_0x7042('0x49')](path[_0x7042('0x4a')](config[_0x7042('0x4b')],_0x7042('0x4c'),_0x44b4bb['save_name']+'.'+_0x44b4bb[_0x7042('0x48')]))){throw new db[(_0x7042('0x4d'))][(_0x7042('0x4e'))](_0x7042('0x4f'));}return _0x15d12d[_0x7042('0x50')](path[_0x7042('0x4a')](config[_0x7042('0x4b')],_0x7042('0x4c'),util[_0x7042('0x51')](_0x7042('0x52'),_0x44b4bb[_0x7042('0x47')],_0x44b4bb[_0x7042('0x48')])),util[_0x7042('0x51')]('%s.%s',_0x44b4bb[_0x7042('0x26')],_0x44b4bb['converted_format']));}return null;})[_0x7042('0x42')](handleError(_0x15d12d,null));};exports[_0x7042('0x53')]=function(_0x418794,_0x5a0c85,_0x4a4b03){var _0x4199dc={'name':path[_0x7042('0x54')](_0x418794[_0x7042('0x55')][_0x7042('0x56')],path['extname'](_0x418794['file'][_0x7042('0x56')])),'save_name':path[_0x7042('0x54')](_0x418794['file'][_0x7042('0x57')],path[_0x7042('0x58')](_0x418794['file'][_0x7042('0x57')])),'original_format':path[_0x7042('0x58')](_0x418794['file'][_0x7042('0x56')])[_0x7042('0x59')](0x1),'converted_format':_0x7042('0x5a')};var _0x4fad37=path[_0x7042('0x4a')](config[_0x7042('0x4b')],_0x7042('0x5b'),_0x418794[_0x7042('0x55')][_0x7042('0x57')]);var _0x35af12=path[_0x7042('0x4a')](config[_0x7042('0x4b')],_0x7042('0x4c'),util[_0x7042('0x51')](_0x7042('0x52'),path[_0x7042('0x54')](_0x418794['file'][_0x7042('0x57')],path[_0x7042('0x58')](_0x418794[_0x7042('0x55')][_0x7042('0x57')])),_0x4199dc[_0x7042('0x48')]));logger[_0x7042('0x5c')]('Sound\x20upload\x20filepath:\x20%s',_0x4fad37);logger[_0x7042('0x5c')](_0x7042('0x5d'),_0x35af12);try{fs[_0x7042('0x5e')](_0x4fad37,parseInt('0777',0x8));var _0x13fb0e=sox[_0x7042('0x5f')](_0x4fad37,_0x35af12,{'sampleRate':0x1f40,'format':_0x7042('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x13fb0e['on'](_0x7042('0x24'),function(_0x267cdf){fs[_0x7042('0x60')](_0x4fad37);_0x5a0c85[_0x7042('0x17')](0x1f4)[_0x7042('0x27')](_0x267cdf);});_0x13fb0e['on']('src',function(_0x2d7dbc){_0x4199dc[_0x7042('0x61')]=isNaN(_0x2d7dbc[_0x7042('0x62')])?null:_0x2d7dbc[_0x7042('0x62')]*0x3e8;_0x4199dc[_0x7042('0x63')]=isNaN(_0x2d7dbc[_0x7042('0x64')])?null:_0x2d7dbc[_0x7042('0x64')];_0x4199dc['original_channelCount']=isNaN(_0x2d7dbc[_0x7042('0x65')])?null:_0x2d7dbc['channelCount'];_0x4199dc[_0x7042('0x66')]=isNaN(_0x2d7dbc[_0x7042('0x67')])?null:_0x2d7dbc[_0x7042('0x67')];_0x4199dc[_0x7042('0x68')]=isNaN(_0x2d7dbc['sampleRate'])?null:_0x2d7dbc['sampleRate'];});_0x13fb0e['on'](_0x7042('0x69'),function(_0x38a9bf){_0x4199dc['converted_duration']=isNaN(_0x38a9bf[_0x7042('0x62')])?null:_0x38a9bf[_0x7042('0x62')]*0x3e8;_0x4199dc[_0x7042('0x6a')]=isNaN(_0x38a9bf[_0x7042('0x64')])?null:_0x38a9bf[_0x7042('0x64')];_0x4199dc[_0x7042('0x6b')]=isNaN(_0x38a9bf[_0x7042('0x65')])?null:_0x38a9bf[_0x7042('0x65')];_0x4199dc[_0x7042('0x6c')]=isNaN(_0x38a9bf['bitRate'])?null:_0x38a9bf[_0x7042('0x67')];_0x4199dc[_0x7042('0x6d')]=isNaN(_0x38a9bf[_0x7042('0x6e')])?null:_0x38a9bf[_0x7042('0x6e')];});_0x13fb0e['on']('end',function(){fs[_0x7042('0x5e')](_0x35af12,parseInt('0777',0x8));return db[_0x7042('0x45')][_0x7042('0x53')](_0x4199dc)['then'](function(_0x5559dc){var _0x3ca818={'role':_0x418794['body'][_0x7042('0x6f')],'userProfileId':_0x418794[_0x7042('0x70')][_0x7042('0x71')]};if(!_0x3ca818)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ca818['role']==='user'){var _0x1cb796=_0x5559dc[_0x7042('0x21')]({'plain':!![]});return db['UserProfileSection'][_0x7042('0x46')]({'where':{'name':_0x7042('0x22'),'userProfileId':_0x3ca818[_0x7042('0x71')]},'raw':!![]})['then'](function(_0x245201){if(_0x245201&&_0x245201[_0x7042('0x72')]===0x0){return db['UserProfileResource']['create']({'name':_0x1cb796[_0x7042('0x26')],'resourceId':_0x1cb796['id'],'type':_0x245201['name'],'sectionId':_0x245201['id']},{})['then'](function(){return _0x5559dc;});}else{return _0x5559dc;}})[_0x7042('0x42')](function(_0x1d8f86){logger[_0x7042('0x24')](_0x7042('0x73'),_0x1d8f86);throw _0x1d8f86;});}return _0x5559dc;})[_0x7042('0x20')](respondWithResult(_0x5a0c85,null))[_0x7042('0x42')](handleError(_0x5a0c85,null));});_0x13fb0e[_0x7042('0x74')]();}catch(_0x1d8277){_0x5a0c85['status'](0x1f4)['send'](_0x1d8277);}};exports[_0x7042('0x75')]=function(_0x3bba1c,_0x1d1e20,_0x5a5516){return db['Sound'][_0x7042('0x46')]({'where':{'id':_0x3bba1c['params']['id']}})[_0x7042('0x20')](handleEntityNotFound(_0x1d1e20,null))[_0x7042('0x20')](saveUpdates(_[_0x7042('0x39')](_0x3bba1c['body'],[_0x7042('0x26'),_0x7042('0x76')]),null))['then'](respondWithResult(_0x1d1e20,null))[_0x7042('0x42')](handleError(_0x1d1e20,null));};exports[_0x7042('0x77')]=function(_0x48dd58,_0x5d00f9,_0x383379){return db[_0x7042('0x45')]['find']({'where':{'id':_0x48dd58[_0x7042('0x43')]['id']}})[_0x7042('0x20')](function(_0x3e2833){if(_0x3e2833){return _0x3e2833[_0x7042('0x23')]();}})[_0x7042('0x20')](function(_0x8fd4ec){var _0x21c587=path[_0x7042('0x4a')](config[_0x7042('0x4b')],_0x7042('0x5b'),util['format'](_0x7042('0x52'),_0x8fd4ec[_0x7042('0x47')],_0x8fd4ec[_0x7042('0x78')]));var _0x26707e=path['join'](config[_0x7042('0x4b')],_0x7042('0x4c'),util[_0x7042('0x51')](_0x7042('0x52'),_0x8fd4ec['save_name'],_0x8fd4ec[_0x7042('0x48')]));fs[_0x7042('0x60')](_0x21c587);fs[_0x7042('0x60')](_0x26707e);return _0x8fd4ec;})[_0x7042('0x20')](function(_0x42312b){if(_0x42312b){return _0x5d00f9['status'](0xcc)['end']();}})[_0x7042('0x20')](handleEntityNotFound(_0x5d00f9,null))['catch'](handleError(_0x5d00f9,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index d9dceaf..d918804 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 _0x67b3=['Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./sound.attributes','define'];(function(_0x5de195,_0x3ddd9a){var _0x552fbf=function(_0x50b9a7){while(--_0x50b9a7){_0x5de195['push'](_0x5de195['shift']());}};_0x552fbf(++_0x3ddd9a);}(_0x67b3,0x1ca));var _0x367b=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x67b3[_0x381589];return _0x2a075d;};'use strict';var _=require(_0x367b('0x0'));var util=require(_0x367b('0x1'));var logger=require(_0x367b('0x2'))(_0x367b('0x3'));var moment=require(_0x367b('0x4'));var BPromise=require(_0x367b('0x5'));var rp=require(_0x367b('0x6'));var fs=require('fs');var path=require(_0x367b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x367b('0x8'));module['exports']=function(_0xa116e1,_0x17b0b4){return _0xa116e1[_0x367b('0x9')](_0x367b('0xa'),attributes,{'tableName':_0x367b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1133=['tools_sounds','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./sound.attributes','exports','define','Sound'];(function(_0x56bb66,_0x1b1462){var _0x57f9b9=function(_0x3b7bee){while(--_0x3b7bee){_0x56bb66['push'](_0x56bb66['shift']());}};_0x57f9b9(++_0x1b1462);}(_0x1133,0xcd));var _0x3113=function(_0x17b085,_0x5dcd1b){_0x17b085=_0x17b085-0x0;var _0x1adcfe=_0x1133[_0x17b085];return _0x1adcfe;};'use strict';var _=require('lodash');var util=require(_0x3113('0x0'));var logger=require(_0x3113('0x1'))(_0x3113('0x2'));var moment=require(_0x3113('0x3'));var BPromise=require('bluebird');var rp=require(_0x3113('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3113('0x5'));var config=require(_0x3113('0x6'));var attributes=require(_0x3113('0x7'));module[_0x3113('0x8')]=function(_0x599e4f,_0x15407c){return _0x599e4f[_0x3113('0x9')](_0x3113('0xa'),attributes,{'tableName':_0x3113('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 03329ef..6a98a4d 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 _0x92e7=['request\x20sent','debug','stringify','error','code','message','result','Sound','find','options','raw','attributes','include','map','model','catch','ShowSound','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s'];(function(_0x21f7c4,_0x31d376){var _0x3693d6=function(_0x1a6cef){while(--_0x1a6cef){_0x21f7c4['push'](_0x21f7c4['shift']());}};_0x3693d6(++_0x31d376);}(_0x92e7,0xb6));var _0x792e=function(_0x2b07ac,_0x32816a){_0x2b07ac=_0x2b07ac-0x0;var _0x4f9f7e=_0x92e7[_0x2b07ac];return _0x4f9f7e;};'use strict';var _=require('lodash');var util=require(_0x792e('0x0'));var moment=require(_0x792e('0x1'));var BPromise=require('bluebird');var rs=require(_0x792e('0x2'));var fs=require('fs');var Redis=require(_0x792e('0x3'));var db=require(_0x792e('0x4'))['db'];var utils=require(_0x792e('0x5'));var logger=require(_0x792e('0x6'))(_0x792e('0x7'));var config=require(_0x792e('0x8'));var jayson=require(_0x792e('0x9'));var client=jayson[_0x792e('0xa')][_0x792e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x267cf8,_0x52160a,_0x344e96){return new BPromise(function(_0x3d20c4,_0x4912eb){return client[_0x792e('0xc')](_0x267cf8,_0x344e96)[_0x792e('0xd')](function(_0x2d6bb4){logger[_0x792e('0xe')](_0x792e('0xf'),_0x52160a,_0x792e('0x10'));logger[_0x792e('0x11')]('Sound,\x20%s,\x20%s,\x20%s',_0x52160a,_0x792e('0x10'),JSON[_0x792e('0x12')](_0x2d6bb4));if(_0x2d6bb4[_0x792e('0x13')]){if(_0x2d6bb4[_0x792e('0x13')][_0x792e('0x14')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x52160a,_0x2d6bb4['error']['message']);return _0x4912eb(_0x2d6bb4['error'][_0x792e('0x15')]);}logger[_0x792e('0x13')]('Sound,\x20%s,\x20%s',_0x52160a,_0x2d6bb4[_0x792e('0x13')][_0x792e('0x15')]);return _0x3d20c4(_0x2d6bb4[_0x792e('0x13')][_0x792e('0x15')]);}else{logger[_0x792e('0xe')](_0x792e('0xf'),_0x52160a,_0x792e('0x10'));_0x3d20c4(_0x2d6bb4[_0x792e('0x16')]['message']);}})['catch'](function(_0x208eb5){logger['error'](_0x792e('0xf'),_0x52160a,_0x208eb5);_0x4912eb(_0x208eb5);});});}exports['ShowSound']=function(_0x1adc76){var _0x11e6a3=this;return new Promise(function(_0x245d3e,_0x556c15){return db[_0x792e('0x17')][_0x792e('0x18')]({'raw':_0x1adc76[_0x792e('0x19')]?_0x1adc76[_0x792e('0x19')][_0x792e('0x1a')]===undefined?!![]:![]:!![],'where':_0x1adc76[_0x792e('0x19')]?_0x1adc76[_0x792e('0x19')]['where']||null:null,'attributes':_0x1adc76['options']?_0x1adc76[_0x792e('0x19')][_0x792e('0x1b')]||null:null,'include':_0x1adc76['options']?_0x1adc76[_0x792e('0x19')][_0x792e('0x1c')]?_[_0x792e('0x1d')](_0x1adc76[_0x792e('0x19')][_0x792e('0x1c')],function(_0x482869){return{'model':db[_0x482869[_0x792e('0x1e')]],'as':_0x482869['as'],'attributes':_0x482869[_0x792e('0x1b')],'include':_0x482869[_0x792e('0x1c')]?_['map'](_0x482869['include'],function(_0x10e45d){return{'model':db[_0x10e45d[_0x792e('0x1e')]],'as':_0x10e45d['as'],'attributes':_0x10e45d[_0x792e('0x1b')],'include':_0x10e45d['include']?_[_0x792e('0x1d')](_0x10e45d[_0x792e('0x1c')],function(_0x3ca352){return{'model':db[_0x3ca352[_0x792e('0x1e')]],'as':_0x3ca352['as'],'attributes':_0x3ca352['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ead85){logger[_0x792e('0xe')]('ShowSound',_0x1adc76);logger[_0x792e('0x11')]('ShowSound',_0x1adc76,JSON['stringify'](_0x1ead85));_0x245d3e(_0x1ead85);})[_0x792e('0x1f')](function(_0x331b4f){logger['error'](_0x792e('0x20'),_0x331b4f[_0x792e('0x15')],_0x1adc76);_0x556c15(_0x11e6a3[_0x792e('0x13')](0x1f4,_0x331b4f[_0x792e('0x15')]));});});}; \ No newline at end of file +var _0x36ca=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','debug'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x36ca,0x9c));var _0xa36c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x36ca[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0xa36c('0x0'));var moment=require('moment');var BPromise=require(_0xa36c('0x1'));var rs=require(_0xa36c('0x2'));var fs=require('fs');var Redis=require(_0xa36c('0x3'));var db=require(_0xa36c('0x4'))['db'];var utils=require(_0xa36c('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa36c('0x6')][_0xa36c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x13921d,_0x81c1a0,_0x4d6606){return new BPromise(function(_0x8f8497,_0x452da8){return client[_0xa36c('0x8')](_0x13921d,_0x4d6606)[_0xa36c('0x9')](function(_0xf1b0ce){logger['info'](_0xa36c('0xa'),_0x81c1a0,_0xa36c('0xb'));logger['debug'](_0xa36c('0xc'),_0x81c1a0,'request\x20sent',JSON[_0xa36c('0xd')](_0xf1b0ce));if(_0xf1b0ce[_0xa36c('0xe')]){if(_0xf1b0ce['error'][_0xa36c('0xf')]===0x1f4){logger['error'](_0xa36c('0xa'),_0x81c1a0,_0xf1b0ce[_0xa36c('0xe')][_0xa36c('0x10')]);return _0x452da8(_0xf1b0ce['error']['message']);}logger[_0xa36c('0xe')]('Sound,\x20%s,\x20%s',_0x81c1a0,_0xf1b0ce[_0xa36c('0xe')][_0xa36c('0x10')]);return _0x8f8497(_0xf1b0ce['error'][_0xa36c('0x10')]);}else{logger[_0xa36c('0x11')](_0xa36c('0xa'),_0x81c1a0,_0xa36c('0xb'));_0x8f8497(_0xf1b0ce[_0xa36c('0x12')]['message']);}})['catch'](function(_0x47b446){logger[_0xa36c('0xe')]('Sound,\x20%s,\x20%s',_0x81c1a0,_0x47b446);_0x452da8(_0x47b446);});});}exports[_0xa36c('0x13')]=function(_0x3b7d28){var _0xb1dde8=this;return new Promise(function(_0x22edf6,_0x3eff56){return db[_0xa36c('0x14')][_0xa36c('0x15')]({'raw':_0x3b7d28[_0xa36c('0x16')]?_0x3b7d28[_0xa36c('0x16')][_0xa36c('0x17')]===undefined?!![]:![]:!![],'where':_0x3b7d28[_0xa36c('0x16')]?_0x3b7d28[_0xa36c('0x16')][_0xa36c('0x18')]||null:null,'attributes':_0x3b7d28[_0xa36c('0x16')]?_0x3b7d28[_0xa36c('0x16')][_0xa36c('0x19')]||null:null,'include':_0x3b7d28[_0xa36c('0x16')]?_0x3b7d28['options'][_0xa36c('0x1a')]?_[_0xa36c('0x1b')](_0x3b7d28['options'][_0xa36c('0x1a')],function(_0x274d35){return{'model':db[_0x274d35[_0xa36c('0x1c')]],'as':_0x274d35['as'],'attributes':_0x274d35[_0xa36c('0x19')],'include':_0x274d35[_0xa36c('0x1a')]?_[_0xa36c('0x1b')](_0x274d35['include'],function(_0x30dea1){return{'model':db[_0x30dea1[_0xa36c('0x1c')]],'as':_0x30dea1['as'],'attributes':_0x30dea1['attributes'],'include':_0x30dea1['include']?_[_0xa36c('0x1b')](_0x30dea1[_0xa36c('0x1a')],function(_0x3f1d7c){return{'model':db[_0x3f1d7c[_0xa36c('0x1c')]],'as':_0x3f1d7c['as'],'attributes':_0x3f1d7c[_0xa36c('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa36c('0x9')](function(_0x44e15f){logger['info']('ShowSound',_0x3b7d28);logger[_0xa36c('0x1d')](_0xa36c('0x13'),_0x3b7d28,JSON[_0xa36c('0xd')](_0x44e15f));_0x22edf6(_0x44e15f);})[_0xa36c('0x1e')](function(_0x48deda){logger['error'](_0xa36c('0x13'),_0x48deda[_0xa36c('0x10')],_0x3b7d28);_0x3eff56(_0xb1dde8[_0xa36c('0xe')](0x1f4,_0x48deda['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index bb11ee4..9ed8561 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 _0x1f5c=['show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','/:id','isAuthenticated'];(function(_0x570b5d,_0x267462){var _0x2d06be=function(_0x5aff44){while(--_0x5aff44){_0x570b5d['push'](_0x570b5d['shift']());}};_0x2d06be(++_0x267462);}(_0x1f5c,0x97));var _0xc1f5=function(_0x8bd87a,_0x2e837a){_0x8bd87a=_0x8bd87a-0x0;var _0x42e3b4=_0x1f5c[_0x8bd87a];return _0x42e3b4;};'use strict';var multer=require('multer');var util=require(_0xc1f5('0x0'));var path=require(_0xc1f5('0x1'));var timeout=require(_0xc1f5('0x2'));var express=require(_0xc1f5('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc1f5('0x4'));var config=require(_0xc1f5('0x5'));var controller=require(_0xc1f5('0x6'));router[_0xc1f5('0x7')]('/',auth['isAuthenticated'](),controller[_0xc1f5('0x8')]);router[_0xc1f5('0x7')](_0xc1f5('0x9'),auth[_0xc1f5('0xa')](),controller[_0xc1f5('0xb')]);router[_0xc1f5('0xc')]('/',auth[_0xc1f5('0xa')](),controller[_0xc1f5('0xd')]);router[_0xc1f5('0xe')](_0xc1f5('0x9'),auth[_0xc1f5('0xa')](),controller[_0xc1f5('0xf')]);router[_0xc1f5('0x10')](_0xc1f5('0x9'),auth[_0xc1f5('0xa')](),controller[_0xc1f5('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2ca4=['/:id','create','update','delete','exports','multer','express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index'];(function(_0x3a815f,_0x59f8c6){var _0x45201b=function(_0x2d37af){while(--_0x2d37af){_0x3a815f['push'](_0x3a815f['shift']());}};_0x45201b(++_0x59f8c6);}(_0x2ca4,0x101));var _0x42ca=function(_0x18bee8,_0x15e890){_0x18bee8=_0x18bee8-0x0;var _0x4301a9=_0x2ca4[_0x18bee8];return _0x4301a9;};'use strict';var multer=require(_0x42ca('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x42ca('0x1'));var router=express[_0x42ca('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x42ca('0x3'));var config=require(_0x42ca('0x4'));var controller=require(_0x42ca('0x5'));router[_0x42ca('0x6')]('/',auth[_0x42ca('0x7')](),controller[_0x42ca('0x8')]);router[_0x42ca('0x6')](_0x42ca('0x9'),auth[_0x42ca('0x7')](),controller['show']);router['post']('/',auth[_0x42ca('0x7')](),controller[_0x42ca('0xa')]);router['put'](_0x42ca('0x9'),auth[_0x42ca('0x7')](),controller[_0x42ca('0xb')]);router[_0x42ca('0xc')](_0x42ca('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x42ca('0xd')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 6f8f30e..f12b31d 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 _0x9bec=['ENUM','out','exports','STRING','TEXT'];(function(_0x41884d,_0xb43124){var _0x1bbff=function(_0x3c3a4d){while(--_0x3c3a4d){_0x41884d['push'](_0x41884d['shift']());}};_0x1bbff(++_0xb43124);}(_0x9bec,0x1ce));var _0xc9be=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x9bec[_0x500419];return _0x241c1a;};'use strict';var Sequelize=require('sequelize');module[_0xc9be('0x0')]={'uniqueid':{'type':Sequelize[_0xc9be('0x1')]},'body':{'type':Sequelize[_0xc9be('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xc9be('0x3')]('in',_0xc9be('0x4')),'defaultValue':'out','allowNull':![]}}; \ No newline at end of file +var _0xd4ae=['STRING','TEXT','medium','ENUM','out','sequelize','exports'];(function(_0x502eb5,_0x12e4bc){var _0x3cea19=function(_0x2490bf){while(--_0x2490bf){_0x502eb5['push'](_0x502eb5['shift']());}};_0x3cea19(++_0x12e4bc);}(_0xd4ae,0x178));var _0xed4a=function(_0x37512d,_0x44495e){_0x37512d=_0x37512d-0x0;var _0x133f49=_0xd4ae[_0x37512d];return _0x133f49;};'use strict';var Sequelize=require(_0xed4a('0x0'));module[_0xed4a('0x1')]={'uniqueid':{'type':Sequelize[_0xed4a('0x2')]},'body':{'type':Sequelize[_0xed4a('0x3')](_0xed4a('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xed4a('0x5')]('in',_0xed4a('0x6')),'defaultValue':_0xed4a('0x6'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 222808a..a43ba08 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 _0x7f15=['util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','fast-json-patch','request-promise','moment','mustache'];(function(_0x3b16d2,_0x593ee0){var _0x39e56a=function(_0x4a060e){while(--_0x4a060e){_0x3b16d2['push'](_0x3b16d2['shift']());}};_0x39e56a(++_0x593ee0);}(_0x7f15,0x1f4));var _0x57f1=function(_0x537fd9,_0x2c29d1){_0x537fd9=_0x537fd9-0x0;var _0x1b1b5a=_0x7f15[_0x537fd9];return _0x1b1b5a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x57f1('0x0'));var rp=require(_0x57f1('0x1'));var moment=require(_0x57f1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x57f1('0x3'));var util=require(_0x57f1('0x4'));var path=require(_0x57f1('0x5'));var sox=require(_0x57f1('0x6'));var csv=require('to-csv');var ejs=require(_0x57f1('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x57f1('0x8'));var jsforce=require(_0x57f1('0x9'));var deskjs=require(_0x57f1('0xa'));var toCsv=require(_0x57f1('0xb'));var querystring=require('querystring');var Papa=require(_0x57f1('0xc'));var Redis=require(_0x57f1('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x57f1('0xe'));var as=require(_0x57f1('0xf'));var hardwareService=require(_0x57f1('0x10'));var logger=require(_0x57f1('0x11'))(_0x57f1('0x12'));var utils=require(_0x57f1('0x13'));var config=require(_0x57f1('0x14'));var db=require(_0x57f1('0x15'))['db'];function respondWithStatusCode(_0x4e7647,_0x294360){_0x294360=_0x294360||0xcc;return function(_0x52d0f1){if(_0x52d0f1){return _0x4e7647[_0x57f1('0x16')](_0x294360);}return _0x4e7647[_0x57f1('0x17')](_0x294360)[_0x57f1('0x18')]();};}function respondWithResult(_0x3f50e4,_0xae41e5){_0xae41e5=_0xae41e5||0xc8;return function(_0x4cca1f){if(_0x4cca1f){return _0x3f50e4[_0x57f1('0x17')](_0xae41e5)[_0x57f1('0x19')](_0x4cca1f);}};}function respondWithFilteredResult(_0x3bb5da,_0x2d0657){return function(_0x3b23b0){if(_0x3b23b0){var _0x93b413=_0x3b23b0[_0x57f1('0x1a')],_0x45cfb4=_0x2d0657[_0x57f1('0x1b')],_0x4e451d=_0x2d0657[_0x57f1('0x1b')]+_0x2d0657[_0x57f1('0x1c')],_0x47c973;if(_0x4e451d>=_0x93b413){_0x4e451d=_0x93b413;_0x47c973=0xc8;}else{_0x47c973=0xce;}_0x3bb5da[_0x57f1('0x17')](_0x47c973);return _0x3bb5da[_0x57f1('0x1d')](_0x57f1('0x1e'),_0x45cfb4+'-'+_0x4e451d+'/'+_0x93b413)[_0x57f1('0x19')](_0x3b23b0);}return null;};}function patchUpdates(_0x59d7ff){return function(_0x587311){try{jsonpatch[_0x57f1('0x1f')](_0x587311,_0x59d7ff,!![]);}catch(_0x42949d){return BPromise[_0x57f1('0x20')](_0x42949d);}return _0x587311[_0x57f1('0x21')]();};}function saveUpdates(_0x52a419,_0x3d4a35){return function(_0x299ce8){if(_0x299ce8){return _0x299ce8[_0x57f1('0x22')](_0x52a419)[_0x57f1('0x23')](function(_0x5b237d){return _0x5b237d;});}return null;};}function removeEntity(_0x163544,_0x28a637){return function(_0x5afc65){if(_0x5afc65){return _0x5afc65[_0x57f1('0x24')]()[_0x57f1('0x23')](function(){_0x163544['status'](0xcc)[_0x57f1('0x18')]();});}};}function handleEntityNotFound(_0x26560b,_0x1995cc){return function(_0x3e266c){if(!_0x3e266c){_0x26560b[_0x57f1('0x16')](0x194);}return _0x3e266c;};}function handleError(_0x3890db,_0x539a61){_0x539a61=_0x539a61||0x1f4;return function(_0x2f0893){logger[_0x57f1('0x25')](_0x2f0893[_0x57f1('0x26')]);if(_0x2f0893[_0x57f1('0x27')]){delete _0x2f0893[_0x57f1('0x27')];}_0x3890db[_0x57f1('0x17')](_0x539a61)[_0x57f1('0x28')](_0x2f0893);};}exports[_0x57f1('0x29')]=function(_0x5a5d83,_0x36fb50){var _0x41fdd5={},_0x34048c={},_0x138e5c={'count':0x0,'rows':[]};var _0x2bb9ed=_[_0x57f1('0x2a')](db[_0x57f1('0x2b')]['rawAttributes'],function(_0x5d7a1b){return{'name':_0x5d7a1b[_0x57f1('0x2c')],'type':_0x5d7a1b[_0x57f1('0x2d')]['key']};});_0x34048c[_0x57f1('0x2e')]=_[_0x57f1('0x2a')](_0x2bb9ed,_0x57f1('0x27'));_0x34048c[_0x57f1('0x2f')]=_['keys'](_0x5a5d83['query']);_0x34048c[_0x57f1('0x30')]=_['intersection'](_0x34048c[_0x57f1('0x2e')],_0x34048c[_0x57f1('0x2f')]);_0x41fdd5[_0x57f1('0x31')]=_[_0x57f1('0x32')](_0x34048c[_0x57f1('0x2e')],qs[_0x57f1('0x33')](_0x5a5d83[_0x57f1('0x2f')]['fields']));_0x41fdd5[_0x57f1('0x31')]=_0x41fdd5[_0x57f1('0x31')]['length']?_0x41fdd5[_0x57f1('0x31')]:_0x34048c[_0x57f1('0x2e')];if(!_0x5a5d83[_0x57f1('0x2f')][_0x57f1('0x34')](_0x57f1('0x35'))){_0x41fdd5['limit']=qs['limit'](_0x5a5d83[_0x57f1('0x2f')][_0x57f1('0x1c')]);_0x41fdd5[_0x57f1('0x1b')]=qs['offset'](_0x5a5d83[_0x57f1('0x2f')]['offset']);}_0x41fdd5[_0x57f1('0x36')]=qs['sort'](_0x5a5d83[_0x57f1('0x2f')]['sort']);_0x41fdd5[_0x57f1('0x37')]=qs['filters'](_[_0x57f1('0x38')](_0x5a5d83[_0x57f1('0x2f')],_0x34048c[_0x57f1('0x30')]),_0x2bb9ed);if(_0x5a5d83[_0x57f1('0x2f')]['filter']){_0x41fdd5['where']=_['merge'](_0x41fdd5['where'],{'$or':_[_0x57f1('0x2a')](_0x2bb9ed,function(_0x36d7eb){if(_0x36d7eb[_0x57f1('0x2d')]!==_0x57f1('0x39')){var _0x363233={};_0x363233[_0x36d7eb[_0x57f1('0x27')]]={'$like':'%'+_0x5a5d83[_0x57f1('0x2f')]['filter']+'%'};return _0x363233;}})});}_0x41fdd5=_[_0x57f1('0x3a')]({},_0x41fdd5,_0x5a5d83[_0x57f1('0x3b')]);var _0x3a8677={'where':_0x41fdd5[_0x57f1('0x37')]};return db['SquareMessage'][_0x57f1('0x1a')](_0x3a8677)[_0x57f1('0x23')](function(_0x4a850e){_0x138e5c[_0x57f1('0x1a')]=_0x4a850e;if(_0x5a5d83['query'][_0x57f1('0x3c')]){_0x41fdd5[_0x57f1('0x3d')]=[{'all':!![]}];}return db[_0x57f1('0x2b')][_0x57f1('0x3e')](_0x41fdd5);})[_0x57f1('0x23')](function(_0x432a62){_0x138e5c[_0x57f1('0x3f')]=_0x432a62;return _0x138e5c;})[_0x57f1('0x23')](respondWithFilteredResult(_0x36fb50,_0x41fdd5))[_0x57f1('0x40')](handleError(_0x36fb50,null));};exports[_0x57f1('0x41')]=function(_0x17174e,_0x3eb79e){var _0x550d4a={'raw':!![],'where':{'id':_0x17174e[_0x57f1('0x42')]['id']}},_0xa91ac0={};_0xa91ac0[_0x57f1('0x2e')]=_[_0x57f1('0x43')](db['SquareMessage'][_0x57f1('0x44')]);_0xa91ac0[_0x57f1('0x2f')]=_[_0x57f1('0x43')](_0x17174e[_0x57f1('0x2f')]);_0xa91ac0['filters']=_[_0x57f1('0x32')](_0xa91ac0[_0x57f1('0x2e')],_0xa91ac0[_0x57f1('0x2f')]);_0x550d4a[_0x57f1('0x31')]=_[_0x57f1('0x32')](_0xa91ac0[_0x57f1('0x2e')],qs['fields'](_0x17174e[_0x57f1('0x2f')]['fields']));_0x550d4a[_0x57f1('0x31')]=_0x550d4a['attributes']['length']?_0x550d4a[_0x57f1('0x31')]:_0xa91ac0[_0x57f1('0x2e')];if(_0x17174e[_0x57f1('0x2f')][_0x57f1('0x3c')]){_0x550d4a[_0x57f1('0x3d')]=[{'all':!![]}];}_0x550d4a=_['merge']({},_0x550d4a,_0x17174e['options']);return db[_0x57f1('0x2b')][_0x57f1('0x45')](_0x550d4a)['then'](handleEntityNotFound(_0x3eb79e,null))[_0x57f1('0x23')](respondWithResult(_0x3eb79e,null))[_0x57f1('0x40')](handleError(_0x3eb79e,null));};exports[_0x57f1('0x46')]=function(_0x1fcc4b,_0x5b5504){return db[_0x57f1('0x2b')][_0x57f1('0x46')](_0x1fcc4b['body'],{})[_0x57f1('0x23')](respondWithResult(_0x5b5504,0xc9))[_0x57f1('0x40')](handleError(_0x5b5504,null));};exports[_0x57f1('0x22')]=function(_0x30e053,_0x24e185){if(_0x30e053['body']['id']){delete _0x30e053[_0x57f1('0x47')]['id'];}return db[_0x57f1('0x2b')][_0x57f1('0x45')]({'where':{'id':_0x30e053[_0x57f1('0x42')]['id']}})[_0x57f1('0x23')](handleEntityNotFound(_0x24e185,null))[_0x57f1('0x23')](saveUpdates(_0x30e053[_0x57f1('0x47')],null))[_0x57f1('0x23')](respondWithResult(_0x24e185,null))[_0x57f1('0x40')](handleError(_0x24e185,null));};exports[_0x57f1('0x24')]=function(_0x4dc22f,_0x3e7cba){return db[_0x57f1('0x2b')][_0x57f1('0x45')]({'where':{'id':_0x4dc22f[_0x57f1('0x42')]['id']}})[_0x57f1('0x23')](handleEntityNotFound(_0x3e7cba,null))[_0x57f1('0x23')](removeEntity(_0x3e7cba,null))[_0x57f1('0x40')](handleError(_0x3e7cba,null));}; \ No newline at end of file +var _0x5847=['rows','catch','show','model','keys','body','update','find','params','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','destroy','then','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x18d3d2,_0x48809e){var _0x582ee2=function(_0xf047f9){while(--_0xf047f9){_0x18d3d2['push'](_0x18d3d2['shift']());}};_0x582ee2(++_0x48809e);}(_0x5847,0xe1));var _0x7584=function(_0x26960a,_0x4d3445){_0x26960a=_0x26960a-0x0;var _0x2c9a6d=_0x5847[_0x26960a];return _0x2c9a6d;};'use strict';var pdf=require(_0x7584('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7584('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7584('0x2'));var rp=require(_0x7584('0x3'));var moment=require(_0x7584('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7584('0x5'));var util=require(_0x7584('0x6'));var path=require('path');var sox=require(_0x7584('0x7'));var csv=require(_0x7584('0x8'));var ejs=require(_0x7584('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7584('0xa'));var jsforce=require(_0x7584('0xb'));var deskjs=require(_0x7584('0xc'));var toCsv=require(_0x7584('0x8'));var querystring=require(_0x7584('0xd'));var Papa=require(_0x7584('0xe'));var Redis=require(_0x7584('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7584('0x10'));var as=require(_0x7584('0x11'));var hardwareService=require(_0x7584('0x12'));var logger=require(_0x7584('0x13'))(_0x7584('0x14'));var utils=require(_0x7584('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53d5d7,_0x2d7065){_0x2d7065=_0x2d7065||0xcc;return function(_0x332858){if(_0x332858){return _0x53d5d7[_0x7584('0x16')](_0x2d7065);}return _0x53d5d7[_0x7584('0x17')](_0x2d7065)[_0x7584('0x18')]();};}function respondWithResult(_0xb81311,_0x4d0584){_0x4d0584=_0x4d0584||0xc8;return function(_0x1d6313){if(_0x1d6313){return _0xb81311[_0x7584('0x17')](_0x4d0584)['json'](_0x1d6313);}};}function respondWithFilteredResult(_0xaca81d,_0x56c76b){return function(_0x188e96){if(_0x188e96){var _0x247406=_0x188e96[_0x7584('0x19')],_0x51e5e7=_0x56c76b[_0x7584('0x1a')],_0x66824=_0x56c76b['offset']+_0x56c76b[_0x7584('0x1b')],_0x25929b;if(_0x66824>=_0x247406){_0x66824=_0x247406;_0x25929b=0xc8;}else{_0x25929b=0xce;}_0xaca81d[_0x7584('0x17')](_0x25929b);return _0xaca81d[_0x7584('0x1c')](_0x7584('0x1d'),_0x51e5e7+'-'+_0x66824+'/'+_0x247406)[_0x7584('0x1e')](_0x188e96);}return null;};}function patchUpdates(_0x4b4f80){return function(_0xcf7ac3){try{jsonpatch['apply'](_0xcf7ac3,_0x4b4f80,!![]);}catch(_0x50014b){return BPromise['reject'](_0x50014b);}return _0xcf7ac3[_0x7584('0x1f')]();};}function saveUpdates(_0x33a60b,_0x4b6694){return function(_0x2f1f95){if(_0x2f1f95){return _0x2f1f95['update'](_0x33a60b)['then'](function(_0x1be038){return _0x1be038;});}return null;};}function removeEntity(_0x4dc806,_0xe31a15){return function(_0x388788){if(_0x388788){return _0x388788[_0x7584('0x20')]()[_0x7584('0x21')](function(){_0x4dc806[_0x7584('0x17')](0xcc)[_0x7584('0x18')]();});}};}function handleEntityNotFound(_0x834cf,_0xc8de8a){return function(_0x2cd8cc){if(!_0x2cd8cc){_0x834cf[_0x7584('0x16')](0x194);}return _0x2cd8cc;};}function handleError(_0x181182,_0x5a65ed){_0x5a65ed=_0x5a65ed||0x1f4;return function(_0x288da9){logger[_0x7584('0x22')](_0x288da9[_0x7584('0x23')]);if(_0x288da9[_0x7584('0x24')]){delete _0x288da9[_0x7584('0x24')];}_0x181182[_0x7584('0x17')](_0x5a65ed)[_0x7584('0x25')](_0x288da9);};}exports[_0x7584('0x26')]=function(_0x4e4a0f,_0x59b6f3){var _0x2d9724={},_0x5c8732={},_0x1d9584={'count':0x0,'rows':[]};var _0xd33477=_[_0x7584('0x27')](db[_0x7584('0x28')][_0x7584('0x29')],function(_0x3ea4ac){return{'name':_0x3ea4ac[_0x7584('0x2a')],'type':_0x3ea4ac[_0x7584('0x2b')][_0x7584('0x2c')]};});_0x5c8732['model']=_[_0x7584('0x27')](_0xd33477,_0x7584('0x24'));_0x5c8732[_0x7584('0x2d')]=_['keys'](_0x4e4a0f[_0x7584('0x2d')]);_0x5c8732[_0x7584('0x2e')]=_[_0x7584('0x2f')](_0x5c8732['model'],_0x5c8732[_0x7584('0x2d')]);_0x2d9724[_0x7584('0x30')]=_['intersection'](_0x5c8732['model'],qs[_0x7584('0x31')](_0x4e4a0f[_0x7584('0x2d')]['fields']));_0x2d9724[_0x7584('0x30')]=_0x2d9724[_0x7584('0x30')][_0x7584('0x32')]?_0x2d9724[_0x7584('0x30')]:_0x5c8732['model'];if(!_0x4e4a0f[_0x7584('0x2d')][_0x7584('0x33')](_0x7584('0x34'))){_0x2d9724['limit']=qs[_0x7584('0x1b')](_0x4e4a0f['query']['limit']);_0x2d9724[_0x7584('0x1a')]=qs[_0x7584('0x1a')](_0x4e4a0f[_0x7584('0x2d')][_0x7584('0x1a')]);}_0x2d9724['order']=qs[_0x7584('0x35')](_0x4e4a0f[_0x7584('0x2d')][_0x7584('0x35')]);_0x2d9724[_0x7584('0x36')]=qs[_0x7584('0x2e')](_[_0x7584('0x37')](_0x4e4a0f[_0x7584('0x2d')],_0x5c8732['filters']),_0xd33477);if(_0x4e4a0f[_0x7584('0x2d')][_0x7584('0x38')]){_0x2d9724[_0x7584('0x36')]=_[_0x7584('0x39')](_0x2d9724[_0x7584('0x36')],{'$or':_[_0x7584('0x27')](_0xd33477,function(_0x1c2885){if(_0x1c2885[_0x7584('0x2b')]!==_0x7584('0x3a')){var _0x2f41b7={};_0x2f41b7[_0x1c2885[_0x7584('0x24')]]={'$like':'%'+_0x4e4a0f[_0x7584('0x2d')][_0x7584('0x38')]+'%'};return _0x2f41b7;}})});}_0x2d9724=_[_0x7584('0x39')]({},_0x2d9724,_0x4e4a0f[_0x7584('0x3b')]);var _0x3612ae={'where':_0x2d9724['where']};return db[_0x7584('0x28')][_0x7584('0x19')](_0x3612ae)['then'](function(_0x499b18){_0x1d9584[_0x7584('0x19')]=_0x499b18;if(_0x4e4a0f[_0x7584('0x2d')][_0x7584('0x3c')]){_0x2d9724[_0x7584('0x3d')]=[{'all':!![]}];}return db['SquareMessage'][_0x7584('0x3e')](_0x2d9724);})[_0x7584('0x21')](function(_0x236ea3){_0x1d9584[_0x7584('0x3f')]=_0x236ea3;return _0x1d9584;})[_0x7584('0x21')](respondWithFilteredResult(_0x59b6f3,_0x2d9724))[_0x7584('0x40')](handleError(_0x59b6f3,null));};exports[_0x7584('0x41')]=function(_0x58dbbc,_0x426028){var _0x2f4851={'raw':!![],'where':{'id':_0x58dbbc['params']['id']}},_0x495694={};_0x495694[_0x7584('0x42')]=_[_0x7584('0x43')](db['SquareMessage'][_0x7584('0x29')]);_0x495694['query']=_[_0x7584('0x43')](_0x58dbbc[_0x7584('0x2d')]);_0x495694[_0x7584('0x2e')]=_[_0x7584('0x2f')](_0x495694['model'],_0x495694[_0x7584('0x2d')]);_0x2f4851[_0x7584('0x30')]=_[_0x7584('0x2f')](_0x495694['model'],qs['fields'](_0x58dbbc[_0x7584('0x2d')][_0x7584('0x31')]));_0x2f4851['attributes']=_0x2f4851[_0x7584('0x30')][_0x7584('0x32')]?_0x2f4851['attributes']:_0x495694[_0x7584('0x42')];if(_0x58dbbc[_0x7584('0x2d')][_0x7584('0x3c')]){_0x2f4851[_0x7584('0x3d')]=[{'all':!![]}];}_0x2f4851=_[_0x7584('0x39')]({},_0x2f4851,_0x58dbbc[_0x7584('0x3b')]);return db['SquareMessage']['find'](_0x2f4851)[_0x7584('0x21')](handleEntityNotFound(_0x426028,null))['then'](respondWithResult(_0x426028,null))[_0x7584('0x40')](handleError(_0x426028,null));};exports['create']=function(_0x2411a2,_0x2a615f){return db[_0x7584('0x28')]['create'](_0x2411a2[_0x7584('0x44')],{})[_0x7584('0x21')](respondWithResult(_0x2a615f,0xc9))[_0x7584('0x40')](handleError(_0x2a615f,null));};exports[_0x7584('0x45')]=function(_0x5e8761,_0x38a4a7){if(_0x5e8761['body']['id']){delete _0x5e8761[_0x7584('0x44')]['id'];}return db['SquareMessage'][_0x7584('0x46')]({'where':{'id':_0x5e8761[_0x7584('0x47')]['id']}})[_0x7584('0x21')](handleEntityNotFound(_0x38a4a7,null))['then'](saveUpdates(_0x5e8761['body'],null))['then'](respondWithResult(_0x38a4a7,null))[_0x7584('0x40')](handleError(_0x38a4a7,null));};exports[_0x7584('0x20')]=function(_0x596dec,_0x5d5b41){return db['SquareMessage'][_0x7584('0x46')]({'where':{'id':_0x596dec['params']['id']}})[_0x7584('0x21')](handleEntityNotFound(_0x5d5b41,null))[_0x7584('0x21')](removeEntity(_0x5d5b41,null))['catch'](handleError(_0x5d5b41,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index dcdd502..09da8b3 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 _0x834f=['rimraf','./squareMessage.attributes','define','square_messages','lodash','bluebird','request-promise','path'];(function(_0x34fab4,_0x194738){var _0x42fa5c=function(_0x453481){while(--_0x453481){_0x34fab4['push'](_0x34fab4['shift']());}};_0x42fa5c(++_0x194738);}(_0x834f,0x164));var _0xf834=function(_0x57d73f,_0x521098){_0x57d73f=_0x57d73f-0x0;var _0x152e7a=_0x834f[_0x57d73f];return _0x152e7a;};'use strict';var _=require(_0xf834('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf834('0x1'));var rp=require(_0xf834('0x2'));var fs=require('fs');var path=require(_0xf834('0x3'));var rimraf=require(_0xf834('0x4'));var config=require('../../config/environment');var attributes=require(_0xf834('0x5'));module['exports']=function(_0x4fa0d4,_0x23a226){return _0x4fa0d4[_0xf834('0x6')]('SquareMessage',attributes,{'tableName':_0xf834('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18dd=['request-promise','rimraf','../../config/environment','./squareMessage.attributes','SquareMessage','lodash','util','../../config/logger','api','bluebird'];(function(_0x3d1e06,_0x549832){var _0x80e972=function(_0x1ea66a){while(--_0x1ea66a){_0x3d1e06['push'](_0x3d1e06['shift']());}};_0x80e972(++_0x549832);}(_0x18dd,0x11d));var _0xd18d=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x18dd[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xd18d('0x0'));var util=require(_0xd18d('0x1'));var logger=require(_0xd18d('0x2'))(_0xd18d('0x3'));var moment=require('moment');var BPromise=require(_0xd18d('0x4'));var rp=require(_0xd18d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd18d('0x6'));var config=require(_0xd18d('0x7'));var attributes=require(_0xd18d('0x8'));module['exports']=function(_0x15e677,_0x3ec914){return _0x15e677['define'](_0xd18d('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 1e89de9..bda64b1 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 _0x1298=['options','then','info','CreateSquareMessage','stringify','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','request\x20sent','debug','error','SquareMessage,\x20%s,\x20%s','message','SquareMessage','create'];(function(_0x1a3322,_0x3669ac){var _0x1f6280=function(_0x733bf3){while(--_0x733bf3){_0x1a3322['push'](_0x1a3322['shift']());}};_0x1f6280(++_0x3669ac);}(_0x1298,0x19e));var _0x8129=function(_0x23acf5,_0xf877cc){_0x23acf5=_0x23acf5-0x0;var _0x3af0ae=_0x1298[_0x23acf5];return _0x3af0ae;};'use strict';var _=require('lodash');var util=require(_0x8129('0x0'));var moment=require('moment');var BPromise=require(_0x8129('0x1'));var rs=require(_0x8129('0x2'));var fs=require('fs');var Redis=require(_0x8129('0x3'));var db=require(_0x8129('0x4'))['db'];var utils=require(_0x8129('0x5'));var logger=require(_0x8129('0x6'))(_0x8129('0x7'));var config=require('../../config/environment');var jayson=require(_0x8129('0x8'));var client=jayson[_0x8129('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f0a40,_0x1cd6a6,_0x2d07d5){return new BPromise(function(_0x3ff6e0,_0x3d94f8){return client[_0x8129('0xa')](_0x4f0a40,_0x2d07d5)['then'](function(_0x5a0545){logger['info']('SquareMessage,\x20%s,\x20%s',_0x1cd6a6,_0x8129('0xb'));logger[_0x8129('0xc')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x1cd6a6,_0x8129('0xb'),JSON['stringify'](_0x5a0545));if(_0x5a0545['error']){if(_0x5a0545[_0x8129('0xd')]['code']===0x1f4){logger['error'](_0x8129('0xe'),_0x1cd6a6,_0x5a0545[_0x8129('0xd')][_0x8129('0xf')]);return _0x3d94f8(_0x5a0545[_0x8129('0xd')][_0x8129('0xf')]);}logger[_0x8129('0xd')]('SquareMessage,\x20%s,\x20%s',_0x1cd6a6,_0x5a0545['error'][_0x8129('0xf')]);return _0x3ff6e0(_0x5a0545['error'][_0x8129('0xf')]);}else{logger['info'](_0x8129('0xe'),_0x1cd6a6,_0x8129('0xb'));_0x3ff6e0(_0x5a0545['result'][_0x8129('0xf')]);}})['catch'](function(_0x3b15ac){logger[_0x8129('0xd')](_0x8129('0xe'),_0x1cd6a6,_0x3b15ac);_0x3d94f8(_0x3b15ac);});});}exports['CreateSquareMessage']=function(_0x17e742){var _0x1ec668=this;return new Promise(function(_0x21c6c2,_0x1a5940){return db[_0x8129('0x10')][_0x8129('0x11')](_0x17e742['body'],{'raw':_0x17e742['options']?_0x17e742[_0x8129('0x12')]['raw']===undefined?!![]:![]:!![]})[_0x8129('0x13')](function(_0x1b419c){logger[_0x8129('0x14')](_0x8129('0x15'),_0x17e742);logger[_0x8129('0xc')](_0x8129('0x15'),_0x17e742,JSON[_0x8129('0x16')](_0x1b419c));_0x21c6c2(_0x1b419c);})[_0x8129('0x17')](function(_0x4368e2){logger[_0x8129('0xd')]('CreateSquareMessage',_0x4368e2[_0x8129('0xf')],_0x17e742);_0x1a5940(_0x1ec668[_0x8129('0xd')](0x1f4,_0x4368e2[_0x8129('0xf')]));});});}; \ No newline at end of file +var _0xc61d=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','CreateSquareMessage','body','options','raw','then','stringify','catch','lodash'];(function(_0x2cc017,_0x25b198){var _0x509276=function(_0x156ef1){while(--_0x156ef1){_0x2cc017['push'](_0x2cc017['shift']());}};_0x509276(++_0x25b198);}(_0xc61d,0xfb));var _0xdc61=function(_0x5aecbb,_0xd7635){_0x5aecbb=_0x5aecbb-0x0;var _0x4d3523=_0xc61d[_0x5aecbb];return _0x4d3523;};'use strict';var _=require(_0xdc61('0x0'));var util=require(_0xdc61('0x1'));var moment=require(_0xdc61('0x2'));var BPromise=require(_0xdc61('0x3'));var rs=require(_0xdc61('0x4'));var fs=require('fs');var Redis=require(_0xdc61('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc61('0x6'));var logger=require(_0xdc61('0x7'))('rpc');var config=require(_0xdc61('0x8'));var jayson=require(_0xdc61('0x9'));var client=jayson[_0xdc61('0xa')][_0xdc61('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3518fc,_0x84103c,_0x14899f){return new BPromise(function(_0x20bf1e,_0x26eb01){return client[_0xdc61('0xc')](_0x3518fc,_0x14899f)['then'](function(_0x3d38bc){logger[_0xdc61('0xd')](_0xdc61('0xe'),_0x84103c,_0xdc61('0xf'));logger[_0xdc61('0x10')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x84103c,_0xdc61('0xf'),JSON['stringify'](_0x3d38bc));if(_0x3d38bc[_0xdc61('0x11')]){if(_0x3d38bc['error'][_0xdc61('0x12')]===0x1f4){logger[_0xdc61('0x11')](_0xdc61('0xe'),_0x84103c,_0x3d38bc[_0xdc61('0x11')][_0xdc61('0x13')]);return _0x26eb01(_0x3d38bc['error'][_0xdc61('0x13')]);}logger[_0xdc61('0x11')]('SquareMessage,\x20%s,\x20%s',_0x84103c,_0x3d38bc[_0xdc61('0x11')][_0xdc61('0x13')]);return _0x20bf1e(_0x3d38bc[_0xdc61('0x11')][_0xdc61('0x13')]);}else{logger[_0xdc61('0xd')](_0xdc61('0xe'),_0x84103c,_0xdc61('0xf'));_0x20bf1e(_0x3d38bc[_0xdc61('0x14')][_0xdc61('0x13')]);}})['catch'](function(_0x356baf){logger[_0xdc61('0x11')](_0xdc61('0xe'),_0x84103c,_0x356baf);_0x26eb01(_0x356baf);});});}exports[_0xdc61('0x15')]=function(_0x45b7b7){var _0x393205=this;return new Promise(function(_0x2393a4,_0x5dbe97){return db['SquareMessage']['create'](_0x45b7b7[_0xdc61('0x16')],{'raw':_0x45b7b7['options']?_0x45b7b7[_0xdc61('0x17')][_0xdc61('0x18')]===undefined?!![]:![]:!![]})[_0xdc61('0x19')](function(_0x117d13){logger[_0xdc61('0xd')]('CreateSquareMessage',_0x45b7b7);logger[_0xdc61('0x10')](_0xdc61('0x15'),_0x45b7b7,JSON[_0xdc61('0x1a')](_0x117d13));_0x2393a4(_0x117d13);})[_0xdc61('0x1b')](function(_0x32514d){logger['error'](_0xdc61('0x15'),_0x32514d['message'],_0x45b7b7);_0x5dbe97(_0x393205['error'](0x1f4,_0x32514d['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 34fd301..415b499 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 _0xa854=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/test','15s','test'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa854,0x103));var _0x4a85=function(_0x275f68,_0x3ac785){_0x275f68=_0x275f68-0x0;var _0x307628=_0xa854[_0x275f68];return _0x307628;};'use strict';var multer=require(_0x4a85('0x0'));var util=require(_0x4a85('0x1'));var path=require(_0x4a85('0x2'));var timeout=require(_0x4a85('0x3'));var express=require(_0x4a85('0x4'));var router=express['Router']();var auth=require(_0x4a85('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4a85('0x6'));var controller=require('./squareOdbc.controller');router[_0x4a85('0x7')]('/',auth[_0x4a85('0x8')](),controller['index']);router[_0x4a85('0x7')](_0x4a85('0x9'),auth['isAuthenticated'](),controller[_0x4a85('0xa')]);router['get'](_0x4a85('0xb'),auth[_0x4a85('0x8')](),timeout(_0x4a85('0xc')),controller[_0x4a85('0xd')]);router[_0x4a85('0xe')]('/',auth[_0x4a85('0x8')](),controller[_0x4a85('0xf')]);router[_0x4a85('0x10')](_0x4a85('0x9'),auth['isAuthenticated'](),controller[_0x4a85('0x11')]);router[_0x4a85('0x12')](_0x4a85('0x9'),auth[_0x4a85('0x8')](),controller[_0x4a85('0x13')]);module[_0x4a85('0x14')]=router; \ No newline at end of file +var _0x29f0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','15s','test','post','create','put','/:id','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x29f0,0x172));var _0x029f=function(_0x5493a4,_0x311263){_0x5493a4=_0x5493a4-0x0;var _0x4c9d11=_0x29f0[_0x5493a4];return _0x4c9d11;};'use strict';var multer=require(_0x029f('0x0'));var util=require('util');var path=require(_0x029f('0x1'));var timeout=require(_0x029f('0x2'));var express=require(_0x029f('0x3'));var router=express[_0x029f('0x4')]();var auth=require(_0x029f('0x5'));var interaction=require(_0x029f('0x6'));var config=require(_0x029f('0x7'));var controller=require(_0x029f('0x8'));router[_0x029f('0x9')]('/',auth[_0x029f('0xa')](),controller[_0x029f('0xb')]);router[_0x029f('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x029f('0xc')]);router['get'](_0x029f('0xd'),auth[_0x029f('0xa')](),timeout(_0x029f('0xe')),controller[_0x029f('0xf')]);router[_0x029f('0x10')]('/',auth[_0x029f('0xa')](),controller[_0x029f('0x11')]);router[_0x029f('0x12')](_0x029f('0x13'),auth[_0x029f('0xa')](),controller['update']);router['delete']('/:id',auth[_0x029f('0xa')](),controller[_0x029f('0x14')]);module[_0x029f('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 53a091b..d85f33f 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 _0xda3a=['STRING','name','sequelize','exports'];(function(_0x45877d,_0x2d9092){var _0x23511f=function(_0xfcc784){while(--_0xfcc784){_0x45877d['push'](_0x45877d['shift']());}};_0x23511f(++_0x2d9092);}(_0xda3a,0x136));var _0xada3=function(_0x59dac6,_0x4003b9){_0x59dac6=_0x59dac6-0x0;var _0x5ea5d7=_0xda3a[_0x59dac6];return _0x5ea5d7;};'use strict';var Sequelize=require(_0xada3('0x0'));module[_0xada3('0x1')]={'name':{'type':Sequelize[_0xada3('0x2')],'unique':_0xada3('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xada3('0x2')]},'description':{'type':Sequelize[_0xada3('0x2')]}}; \ No newline at end of file +var _0x02a1=['sequelize','exports','STRING','name'];(function(_0x20cf28,_0x324bb8){var _0x4af1e2=function(_0xa6bcb8){while(--_0xa6bcb8){_0x20cf28['push'](_0x20cf28['shift']());}};_0x4af1e2(++_0x324bb8);}(_0x02a1,0x1d0));var _0x102a=function(_0x3a0c5e,_0x4354d5){_0x3a0c5e=_0x3a0c5e-0x0;var _0x28bbc4=_0x02a1[_0x3a0c5e];return _0x28bbc4;};'use strict';var Sequelize=require(_0x102a('0x0'));module[_0x102a('0x1')]={'name':{'type':Sequelize[_0x102a('0x2')],'unique':_0x102a('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x102a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index e76edd7..2feeedb 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 _0x414f=['lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','SquareOdbc','fieldName','type','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','ODBC','UserProfileSection','error','body','test','openSync','dsn','closeSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs'];(function(_0x32f38b,_0x1b4fc7){var _0x15ec9b=function(_0x1331da){while(--_0x1331da){_0x32f38b['push'](_0x32f38b['shift']());}};_0x15ec9b(++_0x1b4fc7);}(_0x414f,0x137));var _0xf414=function(_0x232d32,_0x3ccf6d){_0x232d32=_0x232d32-0x0;var _0x163cf2=_0x414f[_0x232d32];return _0x163cf2;};'use strict';var pdf=require(_0xf414('0x0'));var emlformat=require(_0xf414('0x1'));var rimraf=require(_0xf414('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf414('0x3'));var rp=require(_0xf414('0x4'));var moment=require('moment');var BPromise=require(_0xf414('0x5'));var Mustache=require(_0xf414('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf414('0x7'));var ejs=require(_0xf414('0x8'));var fs=require('fs');var _=require(_0xf414('0x9'));var squel=require('squel');var crypto=require(_0xf414('0xa'));var jsforce=require(_0xf414('0xb'));var deskjs=require(_0xf414('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf414('0xd'));var Papa=require('papaparse');var Redis=require(_0xf414('0xe'));var authService=require(_0xf414('0xf'));var qs=require(_0xf414('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf414('0x11'));var logger=require('../../config/logger')(_0xf414('0x12'));var utils=require(_0xf414('0x13'));var config=require(_0xf414('0x14'));var db=require(_0xf414('0x15'))['db'];function respondWithStatusCode(_0x448225,_0x1f73b1){_0x1f73b1=_0x1f73b1||0xcc;return function(_0x5d8e2b){if(_0x5d8e2b){return _0x448225[_0xf414('0x16')](_0x1f73b1);}return _0x448225[_0xf414('0x17')](_0x1f73b1)[_0xf414('0x18')]();};}function respondWithResult(_0x158eeb,_0x4be1d2){_0x4be1d2=_0x4be1d2||0xc8;return function(_0x175f09){if(_0x175f09){return _0x158eeb[_0xf414('0x17')](_0x4be1d2)[_0xf414('0x19')](_0x175f09);}};}function respondWithFilteredResult(_0x10d05b,_0x3644ff){return function(_0x1430cf){if(_0x1430cf){var _0x13072a=_0x1430cf[_0xf414('0x1a')],_0x3bbf8f=_0x3644ff[_0xf414('0x1b')],_0x26053c=_0x3644ff[_0xf414('0x1b')]+_0x3644ff[_0xf414('0x1c')],_0x34c065;if(_0x26053c>=_0x13072a){_0x26053c=_0x13072a;_0x34c065=0xc8;}else{_0x34c065=0xce;}_0x10d05b[_0xf414('0x17')](_0x34c065);return _0x10d05b[_0xf414('0x1d')](_0xf414('0x1e'),_0x3bbf8f+'-'+_0x26053c+'/'+_0x13072a)[_0xf414('0x19')](_0x1430cf);}return null;};}function patchUpdates(_0x38d56e){return function(_0x104b55){try{jsonpatch[_0xf414('0x1f')](_0x104b55,_0x38d56e,!![]);}catch(_0x407bac){return BPromise[_0xf414('0x20')](_0x407bac);}return _0x104b55['save']();};}function saveUpdates(_0x157633,_0x4b33ef){return function(_0x1be314){if(_0x1be314){return _0x1be314[_0xf414('0x21')](_0x157633)[_0xf414('0x22')](function(_0x16e698){return _0x16e698;});}return null;};}function removeEntity(_0x20fc45,_0x1372ea){return function(_0xbd34f6){if(_0xbd34f6){return _0xbd34f6[_0xf414('0x23')]()[_0xf414('0x22')](function(){var _0x150aef=_0xbd34f6[_0xf414('0x24')]({'plain':!![]});var _0x1f86a5='ODBC';return db[_0xf414('0x25')][_0xf414('0x23')]({'where':{'type':_0x1f86a5,'resourceId':_0x150aef['id']}})[_0xf414('0x22')](function(){return _0xbd34f6;});})[_0xf414('0x22')](function(){_0x20fc45[_0xf414('0x17')](0xcc)[_0xf414('0x18')]();});}};}function handleEntityNotFound(_0x3132ec,_0x3f6b1a){return function(_0x5103aa){if(!_0x5103aa){_0x3132ec[_0xf414('0x16')](0x194);}return _0x5103aa;};}function handleError(_0xc0ebe1,_0x1a4fe3){_0x1a4fe3=_0x1a4fe3||0x1f4;return function(_0x1d6490){logger['error'](_0x1d6490[_0xf414('0x26')]);if(_0x1d6490[_0xf414('0x27')]){delete _0x1d6490[_0xf414('0x27')];}_0xc0ebe1[_0xf414('0x17')](_0x1a4fe3)[_0xf414('0x28')](_0x1d6490);};}exports[_0xf414('0x29')]=function(_0x595332,_0x2a73d){var _0x26d172={},_0x7cc553={},_0x460407={'count':0x0,'rows':[]};var _0xcea772=_[_0xf414('0x2a')](db[_0xf414('0x2b')]['rawAttributes'],function(_0x26a624){return{'name':_0x26a624[_0xf414('0x2c')],'type':_0x26a624[_0xf414('0x2d')]['key']};});_0x7cc553['model']=_['map'](_0xcea772,'name');_0x7cc553[_0xf414('0x2e')]=_[_0xf414('0x2f')](_0x595332[_0xf414('0x2e')]);_0x7cc553[_0xf414('0x30')]=_['intersection'](_0x7cc553[_0xf414('0x31')],_0x7cc553[_0xf414('0x2e')]);_0x26d172[_0xf414('0x32')]=_[_0xf414('0x33')](_0x7cc553[_0xf414('0x31')],qs[_0xf414('0x34')](_0x595332['query'][_0xf414('0x34')]));_0x26d172['attributes']=_0x26d172['attributes']['length']?_0x26d172['attributes']:_0x7cc553[_0xf414('0x31')];if(!_0x595332['query'][_0xf414('0x35')](_0xf414('0x36'))){_0x26d172[_0xf414('0x1c')]=qs[_0xf414('0x1c')](_0x595332['query'][_0xf414('0x1c')]);_0x26d172['offset']=qs['offset'](_0x595332['query']['offset']);}_0x26d172[_0xf414('0x37')]=qs[_0xf414('0x38')](_0x595332['query'][_0xf414('0x38')]);_0x26d172['where']=qs[_0xf414('0x30')](_[_0xf414('0x39')](_0x595332[_0xf414('0x2e')],_0x7cc553['filters']),_0xcea772);if(_0x595332[_0xf414('0x2e')]['filter']){_0x26d172['where']=_[_0xf414('0x3a')](_0x26d172[_0xf414('0x3b')],{'$or':_['map'](_0xcea772,function(_0x1a6b08){if(_0x1a6b08[_0xf414('0x2d')]!==_0xf414('0x3c')){var _0x552277={};_0x552277[_0x1a6b08[_0xf414('0x27')]]={'$like':'%'+_0x595332[_0xf414('0x2e')][_0xf414('0x3d')]+'%'};return _0x552277;}})});}_0x26d172=_['merge']({},_0x26d172,_0x595332[_0xf414('0x3e')]);var _0x4ddae2={'where':_0x26d172[_0xf414('0x3b')]};return db[_0xf414('0x2b')][_0xf414('0x1a')](_0x4ddae2)[_0xf414('0x22')](function(_0x4c862a){_0x460407['count']=_0x4c862a;if(_0x595332[_0xf414('0x2e')][_0xf414('0x3f')]){_0x26d172[_0xf414('0x40')]=[{'all':!![]}];}return db[_0xf414('0x2b')][_0xf414('0x41')](_0x26d172);})[_0xf414('0x22')](function(_0x507c53){_0x460407['rows']=_0x507c53;return _0x460407;})[_0xf414('0x22')](respondWithFilteredResult(_0x2a73d,_0x26d172))[_0xf414('0x42')](handleError(_0x2a73d,null));};exports['show']=function(_0x45571e,_0x51ef7e){var _0x18329a={'raw':!![],'where':{'id':_0x45571e[_0xf414('0x43')]['id']}},_0x293fcb={};_0x293fcb[_0xf414('0x31')]=_[_0xf414('0x2f')](db['SquareOdbc']['rawAttributes']);_0x293fcb[_0xf414('0x2e')]=_[_0xf414('0x2f')](_0x45571e[_0xf414('0x2e')]);_0x293fcb[_0xf414('0x30')]=_[_0xf414('0x33')](_0x293fcb[_0xf414('0x31')],_0x293fcb[_0xf414('0x2e')]);_0x18329a['attributes']=_[_0xf414('0x33')](_0x293fcb[_0xf414('0x31')],qs[_0xf414('0x34')](_0x45571e['query']['fields']));_0x18329a[_0xf414('0x32')]=_0x18329a[_0xf414('0x32')][_0xf414('0x44')]?_0x18329a[_0xf414('0x32')]:_0x293fcb[_0xf414('0x31')];if(_0x45571e[_0xf414('0x2e')][_0xf414('0x3f')]){_0x18329a[_0xf414('0x40')]=[{'all':!![]}];}_0x18329a=_[_0xf414('0x3a')]({},_0x18329a,_0x45571e['options']);return db[_0xf414('0x2b')][_0xf414('0x45')](_0x18329a)[_0xf414('0x22')](handleEntityNotFound(_0x51ef7e,null))[_0xf414('0x22')](respondWithResult(_0x51ef7e,null))[_0xf414('0x42')](handleError(_0x51ef7e,null));};exports[_0xf414('0x46')]=function(_0x35521a,_0x1f1d14){return db[_0xf414('0x2b')][_0xf414('0x46')](_0x35521a['body'],{})['then'](function(_0x2a814c){var _0xb1b7ee=_0x35521a['user'][_0xf414('0x24')]({'plain':!![]});if(!_0xb1b7ee)throw new Error(_0xf414('0x47'));if(_0xb1b7ee['role']==='user'){var _0x4ccc08=_0x2a814c[_0xf414('0x24')]({'plain':!![]});var _0x41aa7a=_0xf414('0x48');return db[_0xf414('0x49')][_0xf414('0x45')]({'where':{'name':_0x41aa7a,'userProfileId':_0xb1b7ee['userProfileId']},'raw':!![]})[_0xf414('0x22')](function(_0x34fce5){if(_0x34fce5&&_0x34fce5['autoAssociation']===0x0){return db[_0xf414('0x25')][_0xf414('0x46')]({'name':_0x4ccc08[_0xf414('0x27')],'resourceId':_0x4ccc08['id'],'type':_0x34fce5[_0xf414('0x27')],'sectionId':_0x34fce5['id']},{})[_0xf414('0x22')](function(){return _0x2a814c;});}else{return _0x2a814c;}})['catch'](function(_0x8784a7){logger[_0xf414('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8784a7);throw _0x8784a7;});}return _0x2a814c;})[_0xf414('0x22')](respondWithResult(_0x1f1d14,0xc9))[_0xf414('0x42')](handleError(_0x1f1d14,null));};exports['update']=function(_0x5d6bf5,_0xdc69f5){if(_0x5d6bf5[_0xf414('0x4b')]['id']){delete _0x5d6bf5['body']['id'];}return db[_0xf414('0x2b')]['find']({'where':{'id':_0x5d6bf5[_0xf414('0x43')]['id']}})[_0xf414('0x22')](handleEntityNotFound(_0xdc69f5,null))[_0xf414('0x22')](saveUpdates(_0x5d6bf5[_0xf414('0x4b')],null))[_0xf414('0x22')](respondWithResult(_0xdc69f5,null))[_0xf414('0x42')](handleError(_0xdc69f5,null));};exports[_0xf414('0x23')]=function(_0x1658ef,_0x5e4ee0){return db[_0xf414('0x2b')][_0xf414('0x45')]({'where':{'id':_0x1658ef['params']['id']}})['then'](handleEntityNotFound(_0x5e4ee0,null))[_0xf414('0x22')](removeEntity(_0x5e4ee0,null))[_0xf414('0x42')](handleError(_0x5e4ee0,null));};exports[_0xf414('0x4c')]=function(_0x514698,_0x35bca1,_0x73b618){var _0x3aaa4e;return db[_0xf414('0x2b')][_0xf414('0x45')]({'where':{'id':_0x514698[_0xf414('0x43')]['id']},'attributes':['id','dsn']})[_0xf414('0x22')](handleEntityNotFound(_0x35bca1,null))[_0xf414('0x22')](function(_0x2a2471){if(_0x2a2471){var _0x12d089=require('odbc')();_0x12d089[_0xf414('0x4d')](_0x2a2471[_0xf414('0x4e')]);_0x12d089[_0xf414('0x4f')]();return _0x2a2471;}})[_0xf414('0x22')](respondWithResult(_0x35bca1,null))[_0xf414('0x42')](handleError(_0x35bca1,null));}; \ No newline at end of file +var _0xa9aa=['save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','SquareOdbc','includeAll','include','findAll','rows','catch','params','find','create','body','user','ODBC','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','eml-format','zip-dir','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject'];(function(_0x369d18,_0x1ae064){var _0x332e02=function(_0x2026ec){while(--_0x2026ec){_0x369d18['push'](_0x369d18['shift']());}};_0x332e02(++_0x1ae064);}(_0xa9aa,0x1be));var _0xaa9a=function(_0x377524,_0xa9b0f3){_0x377524=_0x377524-0x0;var _0xbc041d=_0xa9aa[_0x377524];return _0xbc041d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaa9a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaa9a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa9a('0x2'));var moment=require(_0xaa9a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaa9a('0x4'));var util=require(_0xaa9a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xaa9a('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaa9a('0x7'));var squel=require(_0xaa9a('0x8'));var crypto=require(_0xaa9a('0x9'));var jsforce=require(_0xaa9a('0xa'));var deskjs=require(_0xaa9a('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaa9a('0xc'));var authService=require(_0xaa9a('0xd'));var qs=require(_0xaa9a('0xe'));var as=require(_0xaa9a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xaa9a('0x10'));var db=require(_0xaa9a('0x11'))['db'];function respondWithStatusCode(_0x3a5d3a,_0x594af5){_0x594af5=_0x594af5||0xcc;return function(_0x5d6b77){if(_0x5d6b77){return _0x3a5d3a[_0xaa9a('0x12')](_0x594af5);}return _0x3a5d3a['status'](_0x594af5)['end']();};}function respondWithResult(_0x4d7c3f,_0x4efee8){_0x4efee8=_0x4efee8||0xc8;return function(_0x558e8c){if(_0x558e8c){return _0x4d7c3f[_0xaa9a('0x13')](_0x4efee8)['json'](_0x558e8c);}};}function respondWithFilteredResult(_0x934f3e,_0x1c52b3){return function(_0x2c8ab0){if(_0x2c8ab0){var _0x1516b2=_0x2c8ab0[_0xaa9a('0x14')],_0x1e5fcc=_0x1c52b3[_0xaa9a('0x15')],_0x524d53=_0x1c52b3[_0xaa9a('0x15')]+_0x1c52b3[_0xaa9a('0x16')],_0x66a150;if(_0x524d53>=_0x1516b2){_0x524d53=_0x1516b2;_0x66a150=0xc8;}else{_0x66a150=0xce;}_0x934f3e[_0xaa9a('0x13')](_0x66a150);return _0x934f3e[_0xaa9a('0x17')](_0xaa9a('0x18'),_0x1e5fcc+'-'+_0x524d53+'/'+_0x1516b2)[_0xaa9a('0x19')](_0x2c8ab0);}return null;};}function patchUpdates(_0x428fbf){return function(_0x1aff0c){try{jsonpatch[_0xaa9a('0x1a')](_0x1aff0c,_0x428fbf,!![]);}catch(_0xad69ae){return BPromise[_0xaa9a('0x1b')](_0xad69ae);}return _0x1aff0c[_0xaa9a('0x1c')]();};}function saveUpdates(_0x1bfd6b,_0xd08cdf){return function(_0x2819ac){if(_0x2819ac){return _0x2819ac[_0xaa9a('0x1d')](_0x1bfd6b)[_0xaa9a('0x1e')](function(_0xd12edf){return _0xd12edf;});}return null;};}function removeEntity(_0x2ffe28,_0x5a3745){return function(_0x2a24fc){if(_0x2a24fc){return _0x2a24fc[_0xaa9a('0x1f')]()[_0xaa9a('0x1e')](function(){var _0xfca9af=_0x2a24fc[_0xaa9a('0x20')]({'plain':!![]});var _0x308b26='ODBC';return db[_0xaa9a('0x21')][_0xaa9a('0x1f')]({'where':{'type':_0x308b26,'resourceId':_0xfca9af['id']}})['then'](function(){return _0x2a24fc;});})['then'](function(){_0x2ffe28[_0xaa9a('0x13')](0xcc)[_0xaa9a('0x22')]();});}};}function handleEntityNotFound(_0x539fb2,_0x4edfba){return function(_0x9144){if(!_0x9144){_0x539fb2['sendStatus'](0x194);}return _0x9144;};}function handleError(_0x3d1cf7,_0x18023e){_0x18023e=_0x18023e||0x1f4;return function(_0x109469){logger[_0xaa9a('0x23')](_0x109469[_0xaa9a('0x24')]);if(_0x109469[_0xaa9a('0x25')]){delete _0x109469[_0xaa9a('0x25')];}_0x3d1cf7[_0xaa9a('0x13')](_0x18023e)[_0xaa9a('0x26')](_0x109469);};}exports[_0xaa9a('0x27')]=function(_0x16ec19,_0x466353){var _0x2dcea0={},_0x40e3f8={},_0x1ddd85={'count':0x0,'rows':[]};var _0x2b4871=_[_0xaa9a('0x28')](db['SquareOdbc'][_0xaa9a('0x29')],function(_0x1d687d){return{'name':_0x1d687d[_0xaa9a('0x2a')],'type':_0x1d687d[_0xaa9a('0x2b')]['key']};});_0x40e3f8[_0xaa9a('0x2c')]=_[_0xaa9a('0x28')](_0x2b4871,_0xaa9a('0x25'));_0x40e3f8['query']=_[_0xaa9a('0x2d')](_0x16ec19['query']);_0x40e3f8[_0xaa9a('0x2e')]=_[_0xaa9a('0x2f')](_0x40e3f8['model'],_0x40e3f8[_0xaa9a('0x30')]);_0x2dcea0[_0xaa9a('0x31')]=_[_0xaa9a('0x2f')](_0x40e3f8[_0xaa9a('0x2c')],qs[_0xaa9a('0x32')](_0x16ec19['query']['fields']));_0x2dcea0[_0xaa9a('0x31')]=_0x2dcea0[_0xaa9a('0x31')][_0xaa9a('0x33')]?_0x2dcea0[_0xaa9a('0x31')]:_0x40e3f8[_0xaa9a('0x2c')];if(!_0x16ec19[_0xaa9a('0x30')][_0xaa9a('0x34')](_0xaa9a('0x35'))){_0x2dcea0[_0xaa9a('0x16')]=qs[_0xaa9a('0x16')](_0x16ec19[_0xaa9a('0x30')][_0xaa9a('0x16')]);_0x2dcea0[_0xaa9a('0x15')]=qs[_0xaa9a('0x15')](_0x16ec19[_0xaa9a('0x30')][_0xaa9a('0x15')]);}_0x2dcea0[_0xaa9a('0x36')]=qs[_0xaa9a('0x37')](_0x16ec19[_0xaa9a('0x30')]['sort']);_0x2dcea0[_0xaa9a('0x38')]=qs[_0xaa9a('0x2e')](_['pick'](_0x16ec19[_0xaa9a('0x30')],_0x40e3f8['filters']),_0x2b4871);if(_0x16ec19['query'][_0xaa9a('0x39')]){_0x2dcea0['where']=_[_0xaa9a('0x3a')](_0x2dcea0[_0xaa9a('0x38')],{'$or':_[_0xaa9a('0x28')](_0x2b4871,function(_0x1ea332){if(_0x1ea332[_0xaa9a('0x2b')]!=='VIRTUAL'){var _0x4752e5={};_0x4752e5[_0x1ea332[_0xaa9a('0x25')]]={'$like':'%'+_0x16ec19[_0xaa9a('0x30')]['filter']+'%'};return _0x4752e5;}})});}_0x2dcea0=_[_0xaa9a('0x3a')]({},_0x2dcea0,_0x16ec19[_0xaa9a('0x3b')]);var _0x12d354={'where':_0x2dcea0[_0xaa9a('0x38')]};return db[_0xaa9a('0x3c')][_0xaa9a('0x14')](_0x12d354)[_0xaa9a('0x1e')](function(_0x5cd6b3){_0x1ddd85[_0xaa9a('0x14')]=_0x5cd6b3;if(_0x16ec19['query'][_0xaa9a('0x3d')]){_0x2dcea0[_0xaa9a('0x3e')]=[{'all':!![]}];}return db[_0xaa9a('0x3c')][_0xaa9a('0x3f')](_0x2dcea0);})['then'](function(_0x29b1a3){_0x1ddd85[_0xaa9a('0x40')]=_0x29b1a3;return _0x1ddd85;})['then'](respondWithFilteredResult(_0x466353,_0x2dcea0))[_0xaa9a('0x41')](handleError(_0x466353,null));};exports['show']=function(_0x1d2031,_0x21e58c){var _0x5d4ea6={'raw':!![],'where':{'id':_0x1d2031[_0xaa9a('0x42')]['id']}},_0x42aad5={};_0x42aad5[_0xaa9a('0x2c')]=_['keys'](db['SquareOdbc'][_0xaa9a('0x29')]);_0x42aad5['query']=_[_0xaa9a('0x2d')](_0x1d2031[_0xaa9a('0x30')]);_0x42aad5['filters']=_[_0xaa9a('0x2f')](_0x42aad5[_0xaa9a('0x2c')],_0x42aad5['query']);_0x5d4ea6[_0xaa9a('0x31')]=_['intersection'](_0x42aad5['model'],qs[_0xaa9a('0x32')](_0x1d2031[_0xaa9a('0x30')][_0xaa9a('0x32')]));_0x5d4ea6[_0xaa9a('0x31')]=_0x5d4ea6[_0xaa9a('0x31')]['length']?_0x5d4ea6[_0xaa9a('0x31')]:_0x42aad5[_0xaa9a('0x2c')];if(_0x1d2031[_0xaa9a('0x30')]['includeAll']){_0x5d4ea6['include']=[{'all':!![]}];}_0x5d4ea6=_['merge']({},_0x5d4ea6,_0x1d2031[_0xaa9a('0x3b')]);return db[_0xaa9a('0x3c')][_0xaa9a('0x43')](_0x5d4ea6)['then'](handleEntityNotFound(_0x21e58c,null))[_0xaa9a('0x1e')](respondWithResult(_0x21e58c,null))[_0xaa9a('0x41')](handleError(_0x21e58c,null));};exports[_0xaa9a('0x44')]=function(_0x49082e,_0x2de34d){return db[_0xaa9a('0x3c')][_0xaa9a('0x44')](_0x49082e[_0xaa9a('0x45')],{})[_0xaa9a('0x1e')](function(_0x223037){var _0x23b372=_0x49082e[_0xaa9a('0x46')]['get']({'plain':!![]});if(!_0x23b372)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23b372['role']===_0xaa9a('0x46')){var _0x382b3d=_0x223037[_0xaa9a('0x20')]({'plain':!![]});var _0x3af87a=_0xaa9a('0x47');return db[_0xaa9a('0x48')][_0xaa9a('0x43')]({'where':{'name':_0x3af87a,'userProfileId':_0x23b372[_0xaa9a('0x49')]},'raw':!![]})[_0xaa9a('0x1e')](function(_0x29f89a){if(_0x29f89a&&_0x29f89a[_0xaa9a('0x4a')]===0x0){return db[_0xaa9a('0x21')][_0xaa9a('0x44')]({'name':_0x382b3d[_0xaa9a('0x25')],'resourceId':_0x382b3d['id'],'type':_0x29f89a[_0xaa9a('0x25')],'sectionId':_0x29f89a['id']},{})[_0xaa9a('0x1e')](function(){return _0x223037;});}else{return _0x223037;}})[_0xaa9a('0x41')](function(_0x5f825b){logger[_0xaa9a('0x23')](_0xaa9a('0x4b'),_0x5f825b);throw _0x5f825b;});}return _0x223037;})['then'](respondWithResult(_0x2de34d,0xc9))[_0xaa9a('0x41')](handleError(_0x2de34d,null));};exports[_0xaa9a('0x1d')]=function(_0xe7a308,_0x1e8394){if(_0xe7a308[_0xaa9a('0x45')]['id']){delete _0xe7a308[_0xaa9a('0x45')]['id'];}return db[_0xaa9a('0x3c')][_0xaa9a('0x43')]({'where':{'id':_0xe7a308[_0xaa9a('0x42')]['id']}})[_0xaa9a('0x1e')](handleEntityNotFound(_0x1e8394,null))[_0xaa9a('0x1e')](saveUpdates(_0xe7a308[_0xaa9a('0x45')],null))[_0xaa9a('0x1e')](respondWithResult(_0x1e8394,null))['catch'](handleError(_0x1e8394,null));};exports['destroy']=function(_0x167b03,_0x2dc518){return db[_0xaa9a('0x3c')]['find']({'where':{'id':_0x167b03[_0xaa9a('0x42')]['id']}})[_0xaa9a('0x1e')](handleEntityNotFound(_0x2dc518,null))[_0xaa9a('0x1e')](removeEntity(_0x2dc518,null))[_0xaa9a('0x41')](handleError(_0x2dc518,null));};exports[_0xaa9a('0x4c')]=function(_0x192e81,_0x60233,_0x496b4b){var _0x334c15;return db[_0xaa9a('0x3c')][_0xaa9a('0x43')]({'where':{'id':_0x192e81['params']['id']},'attributes':['id',_0xaa9a('0x4d')]})[_0xaa9a('0x1e')](handleEntityNotFound(_0x60233,null))[_0xaa9a('0x1e')](function(_0x2d4b65){if(_0x2d4b65){var _0xf7133f=require('odbc')();_0xf7133f[_0xaa9a('0x4e')](_0x2d4b65[_0xaa9a('0x4d')]);_0xf7133f['closeSync']();return _0x2d4b65;}})['then'](respondWithResult(_0x60233,null))[_0xaa9a('0x41')](handleError(_0x60233,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index f45c8af..a1d7cf2 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 _0x9632=['rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x9632,0x1b6));var _0x2963=function(_0x5e64a4,_0x204d32){_0x5e64a4=_0x5e64a4-0x0;var _0x47826b=_0x9632[_0x5e64a4];return _0x47826b;};'use strict';var _=require(_0x2963('0x0'));var util=require(_0x2963('0x1'));var logger=require(_0x2963('0x2'))(_0x2963('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2963('0x4'));var fs=require('fs');var path=require(_0x2963('0x5'));var rimraf=require(_0x2963('0x6'));var config=require(_0x2963('0x7'));var attributes=require(_0x2963('0x8'));module['exports']=function(_0xe8413f,_0xaf7422){return _0xe8413f[_0x2963('0x9')](_0x2963('0xa'),attributes,{'tableName':_0x2963('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4f5=['bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','SquareOdbc','square_odbc','lodash','util','api'];(function(_0x5f4f5a,_0x21ef14){var _0x343759=function(_0x213c2e){while(--_0x213c2e){_0x5f4f5a['push'](_0x5f4f5a['shift']());}};_0x343759(++_0x21ef14);}(_0xf4f5,0x89));var _0x5f4f=function(_0x4ddc62,_0x254b55){_0x4ddc62=_0x4ddc62-0x0;var _0x4c9522=_0xf4f5[_0x4ddc62];return _0x4c9522;};'use strict';var _=require(_0x5f4f('0x0'));var util=require(_0x5f4f('0x1'));var logger=require('../../config/logger')(_0x5f4f('0x2'));var moment=require('moment');var BPromise=require(_0x5f4f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f4f('0x4'));var rimraf=require(_0x5f4f('0x5'));var config=require(_0x5f4f('0x6'));var attributes=require(_0x5f4f('0x7'));module['exports']=function(_0x18efa9,_0x5934cd){return _0x18efa9['define'](_0x5f4f('0x8'),attributes,{'tableName':_0x5f4f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 08080b4..2151159 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x10d34b,_0x4fef76){var _0x92b0bf=function(_0x16e291){while(--_0x16e291){_0x10d34b['push'](_0x10d34b['shift']());}};_0x92b0bf(++_0x4fef76);}(_0xe14b,0x93));var _0xbe14=function(_0x4e6d19,_0x3b01b2){_0x4e6d19=_0x4e6d19-0x0;var _0x3c4a56=_0xe14b[_0x4e6d19];return _0x3c4a56;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x2c574e,_0x491053){var _0x1101f7=function(_0x5285c2){while(--_0x5285c2){_0x2c574e['push'](_0x2c574e['shift']());}};_0x1101f7(++_0x491053);}(_0x008c,0x188));var _0xc008=function(_0x4f768a,_0x413685){_0x4f768a=_0x4f768a-0x0;var _0x4ab541=_0x008c[_0x4f768a];return _0x4ab541;};'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')]('SquareOdbc,\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')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 4f47b49..e5dcf8b 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 _0xdd4f=['destroy','removeUsers','multer','express','Router','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','getUsers','post','create','/:id/users','addUsers','put','update','delete'];(function(_0x56d6c6,_0x2af5e4){var _0x3b1faf=function(_0x21d3f2){while(--_0x21d3f2){_0x56d6c6['push'](_0x56d6c6['shift']());}};_0x3b1faf(++_0x2af5e4);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x186eb8,_0x392915){_0x186eb8=_0x186eb8-0x0;var _0x2e83a0=_0xdd4f[_0x186eb8];return _0x2e83a0;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xfdd4('0x3'));var config=require(_0xfdd4('0x4'));var controller=require(_0xfdd4('0x5'));router['get']('/',auth[_0xfdd4('0x6')](),controller[_0xfdd4('0x7')]);router[_0xfdd4('0x8')](_0xfdd4('0x9'),auth[_0xfdd4('0x6')](),controller['show']);router[_0xfdd4('0x8')]('/:id/users',auth[_0xfdd4('0x6')](),controller[_0xfdd4('0xa')]);router[_0xfdd4('0xb')]('/',auth['isAuthenticated'](),controller[_0xfdd4('0xc')]);router['post'](_0xfdd4('0xd'),auth[_0xfdd4('0x6')](),controller[_0xfdd4('0xe')]);router[_0xfdd4('0xf')](_0xfdd4('0x9'),auth[_0xfdd4('0x6')](),controller[_0xfdd4('0x10')]);router[_0xfdd4('0x11')](_0xfdd4('0x9'),auth[_0xfdd4('0x6')](),controller[_0xfdd4('0x12')]);router['delete'](_0xfdd4('0xd'),auth[_0xfdd4('0x6')](),controller[_0xfdd4('0x13')]);module['exports']=router; \ No newline at end of file +var _0x878f=['../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','create','post','addUsers','update','delete','destroy','/:id/users','removeUsers','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x55fc38,_0x19bc7d){var _0x3cd5e4=function(_0x978b3e){while(--_0x978b3e){_0x55fc38['push'](_0x55fc38['shift']());}};_0x3cd5e4(++_0x19bc7d);}(_0x878f,0x173));var _0xf878=function(_0x50c9e0,_0x5a240a){_0x50c9e0=_0x50c9e0-0x0;var _0x5c9fc7=_0x878f[_0x50c9e0];return _0x5c9fc7;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var auth=require(_0xf878('0x5'));var interaction=require(_0xf878('0x6'));var config=require(_0xf878('0x7'));var controller=require(_0xf878('0x8'));router[_0xf878('0x9')]('/',auth[_0xf878('0xa')](),controller['index']);router['get'](_0xf878('0xb'),auth[_0xf878('0xa')](),controller['show']);router['get']('/:id/users',auth[_0xf878('0xa')](),controller['getUsers']);router['post']('/',auth[_0xf878('0xa')](),controller[_0xf878('0xc')]);router[_0xf878('0xd')]('/:id/users',auth[_0xf878('0xa')](),controller[_0xf878('0xe')]);router['put'](_0xf878('0xb'),auth['isAuthenticated'](),controller[_0xf878('0xf')]);router[_0xf878('0x10')](_0xf878('0xb'),auth['isAuthenticated'](),controller[_0xf878('0x11')]);router[_0xf878('0x10')](_0xf878('0x12'),auth['isAuthenticated'](),controller[_0xf878('0x13')]);module[_0xf878('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 12975d3..6a7f14b 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 _0x8c67=['long','preproduction','toString','getDataValue','production','exports','STRING','TEXT','BLOB'];(function(_0x2dc853,_0x507a09){var _0x18d139=function(_0x4fb239){while(--_0x4fb239){_0x2dc853['push'](_0x2dc853['shift']());}};_0x18d139(++_0x507a09);}(_0x8c67,0x1a3));var _0x78c6=function(_0x5d8f8b,_0xbf15cc){_0x5d8f8b=_0x5d8f8b-0x0;var _0x4d4554=_0x8c67[_0x5d8f8b];return _0x4d4554;};'use strict';var Sequelize=require('sequelize');module[_0x78c6('0x0')]={'name':{'type':Sequelize[_0x78c6('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x78c6('0x2')]},'preproduction':{'type':Sequelize[_0x78c6('0x3')](_0x78c6('0x4')),'get':function(){if(this['getDataValue']('preproduction')){return this['getDataValue'](_0x78c6('0x5'))[_0x78c6('0x6')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x78c6('0x4')),'get':function(){if(this[_0x78c6('0x7')](_0x78c6('0x8'))){return this[_0x78c6('0x7')]('production')['toString']('utf8');}}}}; \ No newline at end of file +var _0x8d9d=['STRING','name','BLOB','long','preproduction','getDataValue','toString','utf8','production','sequelize'];(function(_0x8aa09f,_0x153ca9){var _0x5d2cf9=function(_0xccd856){while(--_0xccd856){_0x8aa09f['push'](_0x8aa09f['shift']());}};_0x5d2cf9(++_0x153ca9);}(_0x8d9d,0xef));var _0xd8d9=function(_0x400dbd,_0x27645b){_0x400dbd=_0x400dbd-0x0;var _0x349374=_0x8d9d[_0x400dbd];return _0x349374;};'use strict';var Sequelize=require(_0xd8d9('0x0'));module['exports']={'name':{'type':Sequelize[_0xd8d9('0x1')],'unique':_0xd8d9('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xd8d9('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xd8d9('0x3')](_0xd8d9('0x4')),'get':function(){if(this['getDataValue'](_0xd8d9('0x5'))){return this[_0xd8d9('0x6')](_0xd8d9('0x5'))[_0xd8d9('0x7')](_0xd8d9('0x8'));}}},'production':{'type':Sequelize[_0xd8d9('0x3')](_0xd8d9('0x4')),'get':function(){if(this[_0xd8d9('0x6')](_0xd8d9('0x9'))){return this[_0xd8d9('0x6')](_0xd8d9('0x9'))[_0xd8d9('0x7')](_0xd8d9('0x8'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index d56e63b..5f6af6b 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 _0x4693=['path','ejs','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','redis','defaults','socket.io-emitter','./squareProject.socket','sendStatus','status','json','offset','set','Content-Range','save','then','get','SquareProjects','UserProfileResource','end','error','stack','send','index','map','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','SquareProject','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache'];(function(_0x496380,_0xdf128a){var _0x438e2f=function(_0x15dfb5){while(--_0x15dfb5){_0x496380['push'](_0x496380['shift']());}};_0x438e2f(++_0xdf128a);}(_0x4693,0x119));var _0x3469=function(_0x16ea73,_0x32c546){_0x16ea73=_0x16ea73-0x0;var _0x4f1b09=_0x4693[_0x16ea73];return _0x4f1b09;};'use strict';var pdf=require(_0x3469('0x0'));var emlformat=require(_0x3469('0x1'));var rimraf=require(_0x3469('0x2'));var zipdir=require(_0x3469('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3469('0x4'));var moment=require('moment');var BPromise=require(_0x3469('0x5'));var Mustache=require(_0x3469('0x6'));var util=require('util');var path=require(_0x3469('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3469('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3469('0x9'));var crypto=require(_0x3469('0xa'));var jsforce=require(_0x3469('0xb'));var deskjs=require(_0x3469('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3469('0xd'));var Papa=require(_0x3469('0xe'));var Redis=require(_0x3469('0xf'));var authService=require(_0x3469('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3469('0x11'));var hardwareService=require(_0x3469('0x12'));var logger=require(_0x3469('0x13'))(_0x3469('0x14'));var utils=require(_0x3469('0x15'));var config=require(_0x3469('0x16'));var db=require(_0x3469('0x17'))['db'];config[_0x3469('0x18')]=_[_0x3469('0x19')](config[_0x3469('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x3469('0x1a'))(new Redis(config[_0x3469('0x18')]));require(_0x3469('0x1b'))['register'](socket);function respondWithStatusCode(_0x4576e7,_0x58e107){_0x58e107=_0x58e107||0xcc;return function(_0x15d537){if(_0x15d537){return _0x4576e7[_0x3469('0x1c')](_0x58e107);}return _0x4576e7[_0x3469('0x1d')](_0x58e107)['end']();};}function respondWithResult(_0x32f7d5,_0x280ae9){_0x280ae9=_0x280ae9||0xc8;return function(_0x216a92){if(_0x216a92){return _0x32f7d5[_0x3469('0x1d')](_0x280ae9)[_0x3469('0x1e')](_0x216a92);}};}function respondWithFilteredResult(_0x30486b,_0x524ce2){return function(_0x3efe3f){if(_0x3efe3f){var _0xfefa6c=_0x3efe3f['count'],_0x14f354=_0x524ce2[_0x3469('0x1f')],_0x42b558=_0x524ce2['offset']+_0x524ce2['limit'],_0x373dea;if(_0x42b558>=_0xfefa6c){_0x42b558=_0xfefa6c;_0x373dea=0xc8;}else{_0x373dea=0xce;}_0x30486b[_0x3469('0x1d')](_0x373dea);return _0x30486b[_0x3469('0x20')](_0x3469('0x21'),_0x14f354+'-'+_0x42b558+'/'+_0xfefa6c)[_0x3469('0x1e')](_0x3efe3f);}return null;};}function patchUpdates(_0x21c5ad){return function(_0x37384f){try{jsonpatch['apply'](_0x37384f,_0x21c5ad,!![]);}catch(_0x3151cf){return BPromise['reject'](_0x3151cf);}return _0x37384f[_0x3469('0x22')]();};}function saveUpdates(_0x39d950,_0x1d8620){return function(_0x2b8f1e){if(_0x2b8f1e){return _0x2b8f1e['update'](_0x39d950)[_0x3469('0x23')](function(_0x335a15){return _0x335a15;});}return null;};}function removeEntity(_0x3d404a,_0x2b2602){return function(_0x4522dd){if(_0x4522dd){return _0x4522dd['destroy']()['then'](function(){var _0xd5e23f=_0x4522dd[_0x3469('0x24')]({'plain':!![]});var _0x1f4fbc=_0x3469('0x25');return db[_0x3469('0x26')]['destroy']({'where':{'type':_0x1f4fbc,'resourceId':_0xd5e23f['id']}})[_0x3469('0x23')](function(){return _0x4522dd;});})[_0x3469('0x23')](function(){_0x3d404a[_0x3469('0x1d')](0xcc)[_0x3469('0x27')]();});}};}function handleEntityNotFound(_0x1c2068,_0x335566){return function(_0x1a7734){if(!_0x1a7734){_0x1c2068[_0x3469('0x1c')](0x194);}return _0x1a7734;};}function handleError(_0x10d83e,_0x3382d4){_0x3382d4=_0x3382d4||0x1f4;return function(_0x1704c8){logger[_0x3469('0x28')](_0x1704c8[_0x3469('0x29')]);if(_0x1704c8['name']){delete _0x1704c8['name'];}_0x10d83e['status'](_0x3382d4)[_0x3469('0x2a')](_0x1704c8);};}exports[_0x3469('0x2b')]=function(_0x3572d1,_0x29de18){var _0x1bf601={},_0x42a4e3={},_0x3d144a={'count':0x0,'rows':[]};var _0x2eb925=_[_0x3469('0x2c')](db['SquareProject'][_0x3469('0x2d')],function(_0x4166ba){return{'name':_0x4166ba['fieldName'],'type':_0x4166ba[_0x3469('0x2e')][_0x3469('0x2f')]};});_0x42a4e3['model']=_['map'](_0x2eb925,'name');_0x42a4e3['query']=_[_0x3469('0x30')](_0x3572d1[_0x3469('0x31')]);_0x42a4e3[_0x3469('0x32')]=_[_0x3469('0x33')](_0x42a4e3[_0x3469('0x34')],_0x42a4e3[_0x3469('0x31')]);_0x1bf601['attributes']=_[_0x3469('0x33')](_0x42a4e3[_0x3469('0x34')],qs['fields'](_0x3572d1['query'][_0x3469('0x35')]));_0x1bf601['attributes']=_0x1bf601[_0x3469('0x36')][_0x3469('0x37')]?_0x1bf601['attributes']:_0x42a4e3[_0x3469('0x34')];if(!_0x3572d1[_0x3469('0x31')]['hasOwnProperty'](_0x3469('0x38'))){_0x1bf601['limit']=qs[_0x3469('0x39')](_0x3572d1[_0x3469('0x31')][_0x3469('0x39')]);_0x1bf601[_0x3469('0x1f')]=qs['offset'](_0x3572d1[_0x3469('0x31')][_0x3469('0x1f')]);}_0x1bf601[_0x3469('0x3a')]=qs[_0x3469('0x3b')](_0x3572d1[_0x3469('0x31')][_0x3469('0x3b')]);_0x1bf601[_0x3469('0x3c')]=qs[_0x3469('0x32')](_[_0x3469('0x3d')](_0x3572d1[_0x3469('0x31')],_0x42a4e3['filters']),_0x2eb925);if(_0x3572d1[_0x3469('0x31')][_0x3469('0x3e')]){_0x1bf601[_0x3469('0x3c')]=_[_0x3469('0x3f')](_0x1bf601[_0x3469('0x3c')],{'$or':_[_0x3469('0x2c')](_0x2eb925,function(_0x2521b){if(_0x2521b['type']!==_0x3469('0x40')){var _0x508889={};_0x508889[_0x2521b[_0x3469('0x41')]]={'$like':'%'+_0x3572d1[_0x3469('0x31')][_0x3469('0x3e')]+'%'};return _0x508889;}})});}_0x1bf601=_[_0x3469('0x3f')]({},_0x1bf601,_0x3572d1[_0x3469('0x42')]);var _0x4c89d8={'where':_0x1bf601[_0x3469('0x3c')]};return db[_0x3469('0x43')][_0x3469('0x44')](_0x4c89d8)[_0x3469('0x23')](function(_0x4b59e6){_0x3d144a['count']=_0x4b59e6;if(_0x3572d1['query'][_0x3469('0x45')]){_0x1bf601['include']=[{'all':!![]}];}return db[_0x3469('0x43')][_0x3469('0x46')](_0x1bf601);})[_0x3469('0x23')](function(_0x35b9b7){_0x3d144a[_0x3469('0x47')]=_0x35b9b7;return _0x3d144a;})[_0x3469('0x23')](respondWithFilteredResult(_0x29de18,_0x1bf601))[_0x3469('0x48')](handleError(_0x29de18,null));};exports[_0x3469('0x49')]=function(_0x215bf9,_0x3784d2){var _0x22f148={'raw':![],'where':{'id':_0x215bf9[_0x3469('0x4a')]['id']}},_0x44be3a={};_0x44be3a['model']=_[_0x3469('0x30')](db['SquareProject']['rawAttributes']);_0x44be3a[_0x3469('0x31')]=_[_0x3469('0x30')](_0x215bf9['query']);_0x44be3a[_0x3469('0x32')]=_[_0x3469('0x33')](_0x44be3a[_0x3469('0x34')],_0x44be3a[_0x3469('0x31')]);_0x22f148[_0x3469('0x36')]=_[_0x3469('0x33')](_0x44be3a[_0x3469('0x34')],qs['fields'](_0x215bf9[_0x3469('0x31')][_0x3469('0x35')]));_0x22f148[_0x3469('0x36')]=_0x22f148['attributes'][_0x3469('0x37')]?_0x22f148[_0x3469('0x36')]:_0x44be3a['model'];if(_0x215bf9[_0x3469('0x31')][_0x3469('0x45')]){_0x22f148[_0x3469('0x4b')]=[{'all':!![]}];}_0x22f148=_[_0x3469('0x3f')]({},_0x22f148,_0x215bf9[_0x3469('0x42')]);return db[_0x3469('0x43')][_0x3469('0x4c')](_0x22f148)[_0x3469('0x23')](handleEntityNotFound(_0x3784d2,null))['then'](respondWithResult(_0x3784d2,null))[_0x3469('0x48')](handleError(_0x3784d2,null));};exports[_0x3469('0x4d')]=function(_0xd5e0c3,_0x44bd62){return db[_0x3469('0x43')][_0x3469('0x4d')](_0xd5e0c3[_0x3469('0x4e')],{})[_0x3469('0x23')](function(_0x3d2275){var _0x4b3db8=_0xd5e0c3[_0x3469('0x4f')][_0x3469('0x24')]({'plain':!![]});if(!_0x4b3db8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b3db8['role']==='user'){var _0x2fef5b=_0x3d2275[_0x3469('0x24')]({'plain':!![]});var _0xccf795=_0x3469('0x25');return db[_0x3469('0x50')]['find']({'where':{'name':_0xccf795,'userProfileId':_0x4b3db8[_0x3469('0x51')]},'raw':!![]})[_0x3469('0x23')](function(_0x13f910){if(_0x13f910&&_0x13f910[_0x3469('0x52')]===0x0){return db[_0x3469('0x26')][_0x3469('0x4d')]({'name':_0x2fef5b[_0x3469('0x41')],'resourceId':_0x2fef5b['id'],'type':_0x13f910[_0x3469('0x41')],'sectionId':_0x13f910['id']},{})[_0x3469('0x23')](function(){return _0x3d2275;});}else{return _0x3d2275;}})[_0x3469('0x48')](function(_0x305b05){logger['error'](_0x3469('0x53'),_0x305b05);throw _0x305b05;});}return _0x3d2275;})[_0x3469('0x23')](respondWithResult(_0x44bd62,0xc9))['catch'](handleError(_0x44bd62,null));};exports[_0x3469('0x54')]=function(_0x163103,_0x2333bd){if(_0x163103[_0x3469('0x4e')]['id']){delete _0x163103['body']['id'];}return db['SquareProject']['find']({'where':{'id':_0x163103['params']['id']}})[_0x3469('0x23')](handleEntityNotFound(_0x2333bd,null))[_0x3469('0x23')](saveUpdates(_0x163103[_0x3469('0x4e')],null))['then'](respondWithResult(_0x2333bd,null))[_0x3469('0x48')](handleError(_0x2333bd,null));};exports[_0x3469('0x55')]=function(_0x2e3588,_0x51f61f){return db[_0x3469('0x43')][_0x3469('0x4c')]({'where':{'id':_0x2e3588[_0x3469('0x4a')]['id']}})[_0x3469('0x23')](handleEntityNotFound(_0x51f61f,null))[_0x3469('0x23')](removeEntity(_0x51f61f,null))[_0x3469('0x48')](handleError(_0x51f61f,null));};exports[_0x3469('0x56')]=function(_0x291455,_0x34f46f,_0x36a390){return db['SquareProject']['find']({'where':{'id':_0x291455[_0x3469('0x4a')]['id']}})[_0x3469('0x23')](handleEntityNotFound(_0x34f46f,null))[_0x3469('0x23')](function(_0x1103b5){if(_0x1103b5){return _0x1103b5['addUsers'](_0x291455[_0x3469('0x4e')][_0x3469('0x57')],_['omit'](_0x291455[_0x3469('0x4e')],[_0x3469('0x57'),'id'])||{});}})[_0x3469('0x23')](respondWithResult(_0x34f46f,null))[_0x3469('0x48')](handleError(_0x34f46f,null));};exports[_0x3469('0x58')]=function(_0x3db5b2,_0x11fe8c,_0x4398be){return db[_0x3469('0x43')][_0x3469('0x4c')]({'where':{'id':_0x3db5b2[_0x3469('0x4a')]['id']}})['then'](handleEntityNotFound(_0x11fe8c,null))[_0x3469('0x23')](function(_0x473437){if(_0x473437){return _0x473437['removeUsers'](_0x3db5b2['query'][_0x3469('0x57')])[_0x3469('0x23')](function(){if(_[_0x3469('0x59')](_0x3db5b2[_0x3469('0x31')][_0x3469('0x57')])){for(var _0x34539d=0x0;_0x34539d<_0x3db5b2[_0x3469('0x31')][_0x3469('0x57')]['length'];_0x34539d+=0x1){socket[_0x3469('0x5a')](_0x3469('0x5b'),{'UserId':Number(_0x3db5b2[_0x3469('0x31')][_0x3469('0x57')][_0x34539d]),'SquareProjectId':Number(_0x3db5b2['params']['id'])});}}else{socket[_0x3469('0x5a')]('userSquareProject:remove',{'UserId':Number(_0x3db5b2[_0x3469('0x31')][_0x3469('0x57')]),'SquareProjectId':Number(_0x3db5b2['params']['id'])});}});}})[_0x3469('0x23')](respondWithStatusCode(_0x11fe8c,null))['catch'](handleError(_0x11fe8c,null));};exports[_0x3469('0x5c')]=function(_0x4eb9b4,_0x4134b2,_0x4c2c00){var _0x28fe47={};var _0x1b75ed={};var _0xfa5720;var _0x196304;return db['SquareProject'][_0x3469('0x5d')]({'where':{'id':_0x4eb9b4[_0x3469('0x4a')]['id']}})[_0x3469('0x23')](handleEntityNotFound(_0x4134b2,null))[_0x3469('0x23')](function(_0x19e646){if(_0x19e646){_0xfa5720=_0x19e646;_0x1b75ed[_0x3469('0x34')]=_['keys'](db[_0x3469('0x5e')]['rawAttributes']);_0x1b75ed['query']=_[_0x3469('0x30')](_0x4eb9b4['query']);_0x1b75ed[_0x3469('0x32')]=_['intersection'](_0x1b75ed['model'],_0x1b75ed['query']);_0x28fe47[_0x3469('0x36')]=_['intersection'](_0x1b75ed[_0x3469('0x34')],qs['fields'](_0x4eb9b4[_0x3469('0x31')][_0x3469('0x35')]));_0x28fe47['attributes']=_0x28fe47['attributes'][_0x3469('0x37')]?_0x28fe47['attributes']:_0x1b75ed['model'];_0x28fe47[_0x3469('0x3a')]=qs['sort'](_0x4eb9b4[_0x3469('0x31')][_0x3469('0x3b')]);_0x28fe47['where']=qs[_0x3469('0x32')](_['pick'](_0x4eb9b4[_0x3469('0x31')],_0x1b75ed[_0x3469('0x32')]));if(_0x4eb9b4[_0x3469('0x31')][_0x3469('0x3e')]){_0x28fe47[_0x3469('0x3c')]=_[_0x3469('0x3f')](_0x28fe47[_0x3469('0x3c')],{'$or':_['map'](_0x28fe47['attributes'],function(_0x295e64){var _0x44af0b={};_0x44af0b[_0x295e64]={'$like':'%'+_0x4eb9b4[_0x3469('0x31')]['filter']+'%'};return _0x44af0b;})});}_0x28fe47=_['merge']({},_0x28fe47,_0x4eb9b4[_0x3469('0x42')]);return _0xfa5720[_0x3469('0x5c')](_0x28fe47);}})[_0x3469('0x23')](function(_0x5def81){if(_0x5def81){_0x196304=_0x5def81[_0x3469('0x37')];if(!_0x4eb9b4[_0x3469('0x31')][_0x3469('0x5f')](_0x3469('0x38'))){_0x28fe47[_0x3469('0x39')]=qs[_0x3469('0x39')](_0x4eb9b4[_0x3469('0x31')][_0x3469('0x39')]);_0x28fe47[_0x3469('0x1f')]=qs['offset'](_0x4eb9b4['query']['offset']);}return _0xfa5720[_0x3469('0x5c')](_0x28fe47);}})['then'](function(_0x35296f){if(_0x35296f){return _0x35296f?{'count':_0x196304,'rows':_0x35296f}:null;}})[_0x3469('0x23')](respondWithResult(_0x4134b2,null))[_0x3469('0x48')](handleError(_0x4134b2,null));}; \ No newline at end of file +var _0x27e7=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','pick','options','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','SquareProjects','error','name','send','index','map','SquareProject','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x27e7,0x192));var _0x727e=function(_0x28f33f,_0x40836c){_0x28f33f=_0x28f33f-0x0;var _0x4c76fd=_0x27e7[_0x28f33f];return _0x4c76fd;};'use strict';var pdf=require(_0x727e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x727e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x727e('0x2'));var moment=require(_0x727e('0x3'));var BPromise=require(_0x727e('0x4'));var Mustache=require(_0x727e('0x5'));var util=require(_0x727e('0x6'));var path=require(_0x727e('0x7'));var sox=require(_0x727e('0x8'));var csv=require('to-csv');var ejs=require(_0x727e('0x9'));var fs=require('fs');var _=require(_0x727e('0xa'));var squel=require('squel');var crypto=require(_0x727e('0xb'));var jsforce=require(_0x727e('0xc'));var deskjs=require(_0x727e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x727e('0xe'));var Papa=require(_0x727e('0xf'));var Redis=require('ioredis');var authService=require(_0x727e('0x10'));var qs=require(_0x727e('0x11'));var as=require(_0x727e('0x12'));var hardwareService=require(_0x727e('0x13'));var logger=require(_0x727e('0x14'))('api');var utils=require(_0x727e('0x15'));var config=require(_0x727e('0x16'));var db=require('../../mysqldb')['db'];config[_0x727e('0x17')]=_[_0x727e('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x727e('0x19'))(new Redis(config[_0x727e('0x17')]));require('./squareProject.socket')[_0x727e('0x1a')](socket);function respondWithStatusCode(_0x327606,_0x75781b){_0x75781b=_0x75781b||0xcc;return function(_0x27efc4){if(_0x27efc4){return _0x327606[_0x727e('0x1b')](_0x75781b);}return _0x327606[_0x727e('0x1c')](_0x75781b)[_0x727e('0x1d')]();};}function respondWithResult(_0x345804,_0x49b3c7){_0x49b3c7=_0x49b3c7||0xc8;return function(_0x3e99b4){if(_0x3e99b4){return _0x345804[_0x727e('0x1c')](_0x49b3c7)[_0x727e('0x1e')](_0x3e99b4);}};}function respondWithFilteredResult(_0x79026e,_0x7f1b42){return function(_0x4ad6c3){if(_0x4ad6c3){var _0x11da28=_0x4ad6c3[_0x727e('0x1f')],_0x1f4708=_0x7f1b42['offset'],_0x153a6c=_0x7f1b42[_0x727e('0x20')]+_0x7f1b42[_0x727e('0x21')],_0x2f8017;if(_0x153a6c>=_0x11da28){_0x153a6c=_0x11da28;_0x2f8017=0xc8;}else{_0x2f8017=0xce;}_0x79026e[_0x727e('0x1c')](_0x2f8017);return _0x79026e[_0x727e('0x22')](_0x727e('0x23'),_0x1f4708+'-'+_0x153a6c+'/'+_0x11da28)[_0x727e('0x1e')](_0x4ad6c3);}return null;};}function patchUpdates(_0x31b770){return function(_0x3314c3){try{jsonpatch[_0x727e('0x24')](_0x3314c3,_0x31b770,!![]);}catch(_0x435d1f){return BPromise[_0x727e('0x25')](_0x435d1f);}return _0x3314c3[_0x727e('0x26')]();};}function saveUpdates(_0x20a500,_0x521454){return function(_0x120ea4){if(_0x120ea4){return _0x120ea4[_0x727e('0x27')](_0x20a500)[_0x727e('0x28')](function(_0x519505){return _0x519505;});}return null;};}function removeEntity(_0x1cb2a4,_0xc95794){return function(_0x231f60){if(_0x231f60){return _0x231f60[_0x727e('0x29')]()[_0x727e('0x28')](function(){var _0xc2f2fa=_0x231f60[_0x727e('0x2a')]({'plain':!![]});var _0x4bb940=_0x727e('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x4bb940,'resourceId':_0xc2f2fa['id']}})['then'](function(){return _0x231f60;});})[_0x727e('0x28')](function(){_0x1cb2a4[_0x727e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x408625,_0x7d2ce5){return function(_0x1f85fb){if(!_0x1f85fb){_0x408625[_0x727e('0x1b')](0x194);}return _0x1f85fb;};}function handleError(_0x4fa527,_0x4b1354){_0x4b1354=_0x4b1354||0x1f4;return function(_0x2e6e3c){logger[_0x727e('0x2c')](_0x2e6e3c['stack']);if(_0x2e6e3c['name']){delete _0x2e6e3c[_0x727e('0x2d')];}_0x4fa527['status'](_0x4b1354)[_0x727e('0x2e')](_0x2e6e3c);};}exports[_0x727e('0x2f')]=function(_0x44c634,_0x36dacf){var _0x5b69a6={},_0x1ec337={},_0x225efb={'count':0x0,'rows':[]};var _0x1d908e=_[_0x727e('0x30')](db[_0x727e('0x31')][_0x727e('0x32')],function(_0x11e7ac){return{'name':_0x11e7ac[_0x727e('0x33')],'type':_0x11e7ac['type']['key']};});_0x1ec337['model']=_['map'](_0x1d908e,'name');_0x1ec337['query']=_['keys'](_0x44c634[_0x727e('0x34')]);_0x1ec337[_0x727e('0x35')]=_[_0x727e('0x36')](_0x1ec337[_0x727e('0x37')],_0x1ec337[_0x727e('0x34')]);_0x5b69a6[_0x727e('0x38')]=_[_0x727e('0x36')](_0x1ec337[_0x727e('0x37')],qs['fields'](_0x44c634[_0x727e('0x34')][_0x727e('0x39')]));_0x5b69a6['attributes']=_0x5b69a6['attributes'][_0x727e('0x3a')]?_0x5b69a6[_0x727e('0x38')]:_0x1ec337['model'];if(!_0x44c634[_0x727e('0x34')][_0x727e('0x3b')](_0x727e('0x3c'))){_0x5b69a6[_0x727e('0x21')]=qs[_0x727e('0x21')](_0x44c634[_0x727e('0x34')][_0x727e('0x21')]);_0x5b69a6[_0x727e('0x20')]=qs['offset'](_0x44c634[_0x727e('0x34')][_0x727e('0x20')]);}_0x5b69a6[_0x727e('0x3d')]=qs[_0x727e('0x3e')](_0x44c634[_0x727e('0x34')][_0x727e('0x3e')]);_0x5b69a6[_0x727e('0x3f')]=qs[_0x727e('0x35')](_['pick'](_0x44c634[_0x727e('0x34')],_0x1ec337[_0x727e('0x35')]),_0x1d908e);if(_0x44c634[_0x727e('0x34')][_0x727e('0x40')]){_0x5b69a6['where']=_[_0x727e('0x41')](_0x5b69a6[_0x727e('0x3f')],{'$or':_[_0x727e('0x30')](_0x1d908e,function(_0x192d06){if(_0x192d06['type']!==_0x727e('0x42')){var _0x1d30b3={};_0x1d30b3[_0x192d06['name']]={'$like':'%'+_0x44c634[_0x727e('0x34')][_0x727e('0x40')]+'%'};return _0x1d30b3;}})});}_0x5b69a6=_[_0x727e('0x41')]({},_0x5b69a6,_0x44c634['options']);var _0x19472d={'where':_0x5b69a6[_0x727e('0x3f')]};return db[_0x727e('0x31')][_0x727e('0x1f')](_0x19472d)[_0x727e('0x28')](function(_0x3b7437){_0x225efb['count']=_0x3b7437;if(_0x44c634['query']['includeAll']){_0x5b69a6[_0x727e('0x43')]=[{'all':!![]}];}return db[_0x727e('0x31')][_0x727e('0x44')](_0x5b69a6);})[_0x727e('0x28')](function(_0x2294da){_0x225efb[_0x727e('0x45')]=_0x2294da;return _0x225efb;})['then'](respondWithFilteredResult(_0x36dacf,_0x5b69a6))[_0x727e('0x46')](handleError(_0x36dacf,null));};exports[_0x727e('0x47')]=function(_0x140ff0,_0x1948b2){var _0x83f452={'raw':![],'where':{'id':_0x140ff0[_0x727e('0x48')]['id']}},_0x3a72b5={};_0x3a72b5[_0x727e('0x37')]=_[_0x727e('0x49')](db[_0x727e('0x31')]['rawAttributes']);_0x3a72b5[_0x727e('0x34')]=_['keys'](_0x140ff0[_0x727e('0x34')]);_0x3a72b5[_0x727e('0x35')]=_[_0x727e('0x36')](_0x3a72b5[_0x727e('0x37')],_0x3a72b5[_0x727e('0x34')]);_0x83f452['attributes']=_['intersection'](_0x3a72b5[_0x727e('0x37')],qs[_0x727e('0x39')](_0x140ff0[_0x727e('0x34')][_0x727e('0x39')]));_0x83f452[_0x727e('0x38')]=_0x83f452[_0x727e('0x38')]['length']?_0x83f452['attributes']:_0x3a72b5['model'];if(_0x140ff0['query'][_0x727e('0x4a')]){_0x83f452[_0x727e('0x43')]=[{'all':!![]}];}_0x83f452=_[_0x727e('0x41')]({},_0x83f452,_0x140ff0['options']);return db['SquareProject']['find'](_0x83f452)[_0x727e('0x28')](handleEntityNotFound(_0x1948b2,null))[_0x727e('0x28')](respondWithResult(_0x1948b2,null))[_0x727e('0x46')](handleError(_0x1948b2,null));};exports['create']=function(_0x2d4c09,_0x408bca){return db[_0x727e('0x31')][_0x727e('0x4b')](_0x2d4c09[_0x727e('0x4c')],{})[_0x727e('0x28')](function(_0x30bd1f){var _0x4d23f4=_0x2d4c09[_0x727e('0x4d')]['get']({'plain':!![]});if(!_0x4d23f4)throw new Error(_0x727e('0x4e'));if(_0x4d23f4[_0x727e('0x4f')]===_0x727e('0x4d')){var _0xf9c3f7=_0x30bd1f['get']({'plain':!![]});var _0x15c259='SquareProjects';return db[_0x727e('0x50')][_0x727e('0x51')]({'where':{'name':_0x15c259,'userProfileId':_0x4d23f4[_0x727e('0x52')]},'raw':!![]})['then'](function(_0x310c48){if(_0x310c48&&_0x310c48[_0x727e('0x53')]===0x0){return db[_0x727e('0x54')][_0x727e('0x4b')]({'name':_0xf9c3f7['name'],'resourceId':_0xf9c3f7['id'],'type':_0x310c48[_0x727e('0x2d')],'sectionId':_0x310c48['id']},{})[_0x727e('0x28')](function(){return _0x30bd1f;});}else{return _0x30bd1f;}})[_0x727e('0x46')](function(_0x3ff05e){logger[_0x727e('0x2c')](_0x727e('0x55'),_0x3ff05e);throw _0x3ff05e;});}return _0x30bd1f;})['then'](respondWithResult(_0x408bca,0xc9))[_0x727e('0x46')](handleError(_0x408bca,null));};exports[_0x727e('0x27')]=function(_0x4ae0d5,_0x46aa23){if(_0x4ae0d5[_0x727e('0x4c')]['id']){delete _0x4ae0d5[_0x727e('0x4c')]['id'];}return db['SquareProject'][_0x727e('0x51')]({'where':{'id':_0x4ae0d5['params']['id']}})[_0x727e('0x28')](handleEntityNotFound(_0x46aa23,null))['then'](saveUpdates(_0x4ae0d5[_0x727e('0x4c')],null))[_0x727e('0x28')](respondWithResult(_0x46aa23,null))[_0x727e('0x46')](handleError(_0x46aa23,null));};exports[_0x727e('0x29')]=function(_0x3fea50,_0x478188){return db[_0x727e('0x31')][_0x727e('0x51')]({'where':{'id':_0x3fea50[_0x727e('0x48')]['id']}})['then'](handleEntityNotFound(_0x478188,null))[_0x727e('0x28')](removeEntity(_0x478188,null))[_0x727e('0x46')](handleError(_0x478188,null));};exports['addUsers']=function(_0x10d20e,_0x249102,_0x4a93ef){return db['SquareProject'][_0x727e('0x51')]({'where':{'id':_0x10d20e[_0x727e('0x48')]['id']}})['then'](handleEntityNotFound(_0x249102,null))[_0x727e('0x28')](function(_0x34a1f3){if(_0x34a1f3){return _0x34a1f3[_0x727e('0x56')](_0x10d20e['body'][_0x727e('0x57')],_[_0x727e('0x58')](_0x10d20e[_0x727e('0x4c')],[_0x727e('0x57'),'id'])||{});}})[_0x727e('0x28')](respondWithResult(_0x249102,null))[_0x727e('0x46')](handleError(_0x249102,null));};exports['removeUsers']=function(_0x55d939,_0x5c227e,_0x193f17){return db['SquareProject'][_0x727e('0x51')]({'where':{'id':_0x55d939[_0x727e('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c227e,null))[_0x727e('0x28')](function(_0x14bd23){if(_0x14bd23){return _0x14bd23[_0x727e('0x59')](_0x55d939[_0x727e('0x34')][_0x727e('0x57')])[_0x727e('0x28')](function(){if(_[_0x727e('0x5a')](_0x55d939[_0x727e('0x34')][_0x727e('0x57')])){for(var _0x26c92f=0x0;_0x26c92f<_0x55d939[_0x727e('0x34')]['ids']['length'];_0x26c92f+=0x1){socket[_0x727e('0x5b')](_0x727e('0x5c'),{'UserId':Number(_0x55d939[_0x727e('0x34')][_0x727e('0x57')][_0x26c92f]),'SquareProjectId':Number(_0x55d939[_0x727e('0x48')]['id'])});}}else{socket[_0x727e('0x5b')](_0x727e('0x5c'),{'UserId':Number(_0x55d939['query'][_0x727e('0x57')]),'SquareProjectId':Number(_0x55d939[_0x727e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x5c227e,null))['catch'](handleError(_0x5c227e,null));};exports[_0x727e('0x5d')]=function(_0x1c2c3e,_0x1e5a7d,_0xa3752f){var _0xa146a={};var _0x4d65b0={};var _0x2826a0;var _0x11a841;return db[_0x727e('0x31')]['findOne']({'where':{'id':_0x1c2c3e[_0x727e('0x48')]['id']}})[_0x727e('0x28')](handleEntityNotFound(_0x1e5a7d,null))[_0x727e('0x28')](function(_0xce633a){if(_0xce633a){_0x2826a0=_0xce633a;_0x4d65b0[_0x727e('0x37')]=_[_0x727e('0x49')](db[_0x727e('0x5e')][_0x727e('0x32')]);_0x4d65b0[_0x727e('0x34')]=_['keys'](_0x1c2c3e[_0x727e('0x34')]);_0x4d65b0[_0x727e('0x35')]=_['intersection'](_0x4d65b0[_0x727e('0x37')],_0x4d65b0[_0x727e('0x34')]);_0xa146a[_0x727e('0x38')]=_[_0x727e('0x36')](_0x4d65b0['model'],qs[_0x727e('0x39')](_0x1c2c3e[_0x727e('0x34')][_0x727e('0x39')]));_0xa146a[_0x727e('0x38')]=_0xa146a[_0x727e('0x38')][_0x727e('0x3a')]?_0xa146a['attributes']:_0x4d65b0[_0x727e('0x37')];_0xa146a[_0x727e('0x3d')]=qs['sort'](_0x1c2c3e[_0x727e('0x34')][_0x727e('0x3e')]);_0xa146a['where']=qs[_0x727e('0x35')](_[_0x727e('0x5f')](_0x1c2c3e['query'],_0x4d65b0[_0x727e('0x35')]));if(_0x1c2c3e[_0x727e('0x34')][_0x727e('0x40')]){_0xa146a['where']=_[_0x727e('0x41')](_0xa146a[_0x727e('0x3f')],{'$or':_['map'](_0xa146a['attributes'],function(_0x1499f8){var _0x523d36={};_0x523d36[_0x1499f8]={'$like':'%'+_0x1c2c3e[_0x727e('0x34')][_0x727e('0x40')]+'%'};return _0x523d36;})});}_0xa146a=_[_0x727e('0x41')]({},_0xa146a,_0x1c2c3e[_0x727e('0x60')]);return _0x2826a0['getUsers'](_0xa146a);}})[_0x727e('0x28')](function(_0x56914d){if(_0x56914d){_0x11a841=_0x56914d['length'];if(!_0x1c2c3e[_0x727e('0x34')][_0x727e('0x3b')]('nolimit')){_0xa146a[_0x727e('0x21')]=qs[_0x727e('0x21')](_0x1c2c3e['query'][_0x727e('0x21')]);_0xa146a['offset']=qs[_0x727e('0x20')](_0x1c2c3e['query'][_0x727e('0x20')]);}return _0x2826a0[_0x727e('0x5d')](_0xa146a);}})[_0x727e('0x28')](function(_0x7591f){if(_0x7591f){return _0x7591f?{'count':_0x11a841,'rows':_0x7591f}:null;}})[_0x727e('0x28')](respondWithResult(_0x1e5a7d,null))[_0x727e('0x46')](handleError(_0x1e5a7d,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index b57dc55..fc73686 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 _0x4082=['exports','events','../../mysqldb','SquareProject','save','update','remove','emit','hook'];(function(_0x293b6b,_0x4d944a){var _0x11d7f4=function(_0x2dcc59){while(--_0x2dcc59){_0x293b6b['push'](_0x293b6b['shift']());}};_0x11d7f4(++_0x4d944a);}(_0x4082,0x118));var _0x2408=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x4082[_0x43d11d];return _0x38cd08;};'use strict';var EventEmitter=require(_0x2408('0x0'));var SquareProject=require(_0x2408('0x1'))['db'][_0x2408('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2408('0x3'),'afterUpdate':_0x2408('0x4'),'afterDestroy':_0x2408('0x5')};function emitEvent(_0x1a19a1){return function(_0x12a05c,_0x5e64e4,_0x3abe49){SquareProjectEvents[_0x2408('0x6')](_0x1a19a1+':'+_0x12a05c['id'],_0x12a05c);SquareProjectEvents[_0x2408('0x6')](_0x1a19a1,_0x12a05c);_0x3abe49(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x2408('0x7')](e,emitEvent(event));}}module[_0x2408('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x8fc5=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x708c47,_0x6eaa1f){var _0x52a470=function(_0x14a750){while(--_0x14a750){_0x708c47['push'](_0x708c47['shift']());}};_0x52a470(++_0x6eaa1f);}(_0x8fc5,0x1ca));var _0x58fc=function(_0x59c780,_0x506401){_0x59c780=_0x59c780-0x0;var _0x23d39f=_0x8fc5[_0x59c780];return _0x23d39f;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x58fc('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x58fc('0x1')](0x0);var events={'afterCreate':_0x58fc('0x2'),'afterUpdate':_0x58fc('0x3'),'afterDestroy':_0x58fc('0x4')};function emitEvent(_0x1f107b){return function(_0x4b7bd2,_0x222e07,_0x280a35){SquareProjectEvents['emit'](_0x1f107b+':'+_0x4b7bd2['id'],_0x4b7bd2);SquareProjectEvents[_0x58fc('0x5')](_0x1f107b,_0x4b7bd2);_0x280a35(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x58fc('0x6')](e,emitEvent(event));}}module[_0x58fc('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 0100339..4b69957 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 _0x1635=['lodash','util','moment','bluebird','request-promise','rimraf','./squareProject.attributes','define','SquareProject','square_projects'];(function(_0x18baf4,_0x33086b){var _0x278ed1=function(_0x3ea0a2){while(--_0x3ea0a2){_0x18baf4['push'](_0x18baf4['shift']());}};_0x278ed1(++_0x33086b);}(_0x1635,0x1b8));var _0x5163=function(_0x4bef3c,_0x348f10){_0x4bef3c=_0x4bef3c-0x0;var _0x278946=_0x1635[_0x4bef3c];return _0x278946;};'use strict';var _=require(_0x5163('0x0'));var util=require(_0x5163('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5163('0x2'));var BPromise=require(_0x5163('0x3'));var rp=require(_0x5163('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5163('0x5'));var config=require('../../config/environment');var attributes=require(_0x5163('0x6'));module['exports']=function(_0x102482,_0x2fe534){return _0x102482[_0x5163('0x7')](_0x5163('0x8'),attributes,{'tableName':_0x5163('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7545=['SquareProject','square_projects','../../config/logger','api','path','rimraf','../../config/environment','./squareProject.attributes','exports','define'];(function(_0x49aa7d,_0x5d46d8){var _0xdd0d26=function(_0x159df7){while(--_0x159df7){_0x49aa7d['push'](_0x49aa7d['shift']());}};_0xdd0d26(++_0x5d46d8);}(_0x7545,0x174));var _0x5754=function(_0x478e8f,_0x1e3621){_0x478e8f=_0x478e8f-0x0;var _0x2cbf07=_0x7545[_0x478e8f];return _0x2cbf07;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5754('0x0'))(_0x5754('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5754('0x2'));var rimraf=require(_0x5754('0x3'));var config=require(_0x5754('0x4'));var attributes=require(_0x5754('0x5'));module[_0x5754('0x6')]=function(_0x24658b,_0x1ba8b0){return _0x24658b[_0x5754('0x7')](_0x5754('0x8'),attributes,{'tableName':_0x5754('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index a411988..e1a382e 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 _0x3551=['then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSquareProject','SquareProject','options','raw','where','attributes','model','map','include','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x3551,0x1d0));var _0x1355=function(_0x15214b,_0x3a7ebd){_0x15214b=_0x15214b-0x0;var _0xe42e19=_0x3551[_0x15214b];return _0xe42e19;};'use strict';var _=require(_0x1355('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1355('0x1'));var rs=require(_0x1355('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1355('0x3'))['db'];var utils=require(_0x1355('0x4'));var logger=require(_0x1355('0x5'))(_0x1355('0x6'));var config=require('../../config/environment');var jayson=require(_0x1355('0x7'));var client=jayson[_0x1355('0x8')][_0x1355('0x9')]({'port':0x232a});config[_0x1355('0xa')]=_[_0x1355('0xb')](config[_0x1355('0xa')],{'host':_0x1355('0xc'),'port':0x18eb});var socket=require(_0x1355('0xd'))(new Redis(config[_0x1355('0xa')]));require(_0x1355('0xe'))[_0x1355('0xf')](socket);function respondWithRpcPromise(_0xe16113,_0x24a32e,_0x50e117){return new BPromise(function(_0x1467fd,_0xb5df55){return client[_0x1355('0x10')](_0xe16113,_0x50e117)[_0x1355('0x11')](function(_0x1e7bd4){logger[_0x1355('0x12')](_0x1355('0x13'),_0x24a32e,_0x1355('0x14'));logger[_0x1355('0x15')](_0x1355('0x16'),_0x24a32e,'request\x20sent',JSON['stringify'](_0x1e7bd4));if(_0x1e7bd4[_0x1355('0x17')]){if(_0x1e7bd4[_0x1355('0x17')]['code']===0x1f4){logger[_0x1355('0x17')](_0x1355('0x13'),_0x24a32e,_0x1e7bd4[_0x1355('0x17')][_0x1355('0x18')]);return _0xb5df55(_0x1e7bd4['error'][_0x1355('0x18')]);}logger['error'](_0x1355('0x13'),_0x24a32e,_0x1e7bd4['error'][_0x1355('0x18')]);return _0x1467fd(_0x1e7bd4['error'][_0x1355('0x18')]);}else{logger[_0x1355('0x12')](_0x1355('0x13'),_0x24a32e,_0x1355('0x14'));_0x1467fd(_0x1e7bd4[_0x1355('0x19')][_0x1355('0x18')]);}})[_0x1355('0x1a')](function(_0x31354f){logger['error'](_0x1355('0x13'),_0x24a32e,_0x31354f);_0xb5df55(_0x31354f);});});}exports[_0x1355('0x1b')]=function(_0x10ffa6){var _0x5dd22a=this;return new Promise(function(_0x35fdf2,_0x260539){return db[_0x1355('0x1c')]['find']({'raw':_0x10ffa6['options']?_0x10ffa6[_0x1355('0x1d')][_0x1355('0x1e')]===undefined?!![]:![]:!![],'where':_0x10ffa6['options']?_0x10ffa6[_0x1355('0x1d')][_0x1355('0x1f')]||null:null,'attributes':_0x10ffa6[_0x1355('0x1d')]?_0x10ffa6[_0x1355('0x1d')][_0x1355('0x20')]||null:null,'include':_0x10ffa6[_0x1355('0x1d')]?_0x10ffa6[_0x1355('0x1d')]['include']?_['map'](_0x10ffa6[_0x1355('0x1d')]['include'],function(_0x43476b){return{'model':db[_0x43476b[_0x1355('0x21')]],'as':_0x43476b['as'],'attributes':_0x43476b[_0x1355('0x20')],'include':_0x43476b['include']?_[_0x1355('0x22')](_0x43476b[_0x1355('0x23')],function(_0x30223f){return{'model':db[_0x30223f[_0x1355('0x21')]],'as':_0x30223f['as'],'attributes':_0x30223f['attributes'],'include':_0x30223f[_0x1355('0x23')]?_[_0x1355('0x22')](_0x30223f['include'],function(_0x12cef0){return{'model':db[_0x12cef0[_0x1355('0x21')]],'as':_0x12cef0['as'],'attributes':_0x12cef0[_0x1355('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1516b8){logger['info'](_0x1355('0x1b'),_0x10ffa6);logger['debug'](_0x1355('0x1b'),_0x10ffa6,JSON[_0x1355('0x24')](_0x1516b8));_0x35fdf2(_0x1516b8);})[_0x1355('0x1a')](function(_0x51770f){logger['error']('ShowSquareProject',_0x51770f[_0x1355('0x18')],_0x10ffa6);_0x260539(_0x5dd22a[_0x1355('0x17')](0x1f4,_0x51770f['message']));});});}; \ No newline at end of file +var _0xa833=['./squareProject.socket','register','request','info','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareProject,\x20%s,\x20%s','message','catch','ShowSquareProject','find','options','raw','where','attributes','include','map','model','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x21207a,_0x3d12b6){var _0x4734fd=function(_0x5525a5){while(--_0x5525a5){_0x21207a['push'](_0x21207a['shift']());}};_0x4734fd(++_0x3d12b6);}(_0xa833,0x116));var _0x3a83=function(_0x151151,_0xf2e49){_0x151151=_0x151151-0x0;var _0x484a73=_0xa833[_0x151151];return _0x484a73;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3a83('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a83('0x1'));var db=require(_0x3a83('0x2'))['db'];var utils=require(_0x3a83('0x3'));var logger=require('../../config/logger')(_0x3a83('0x4'));var config=require(_0x3a83('0x5'));var jayson=require(_0x3a83('0x6'));var client=jayson['client'][_0x3a83('0x7')]({'port':0x232a});config[_0x3a83('0x8')]=_[_0x3a83('0x9')](config[_0x3a83('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3a83('0x8')]));require(_0x3a83('0xa'))[_0x3a83('0xb')](socket);function respondWithRpcPromise(_0x20db18,_0x523446,_0x3fc88b){return new BPromise(function(_0x509002,_0x895780){return client[_0x3a83('0xc')](_0x20db18,_0x3fc88b)['then'](function(_0xc96160){logger[_0x3a83('0xd')]('SquareProject,\x20%s,\x20%s',_0x523446,_0x3a83('0xe'));logger[_0x3a83('0xf')](_0x3a83('0x10'),_0x523446,_0x3a83('0xe'),JSON[_0x3a83('0x11')](_0xc96160));if(_0xc96160['error']){if(_0xc96160[_0x3a83('0x12')][_0x3a83('0x13')]===0x1f4){logger[_0x3a83('0x12')](_0x3a83('0x14'),_0x523446,_0xc96160[_0x3a83('0x12')][_0x3a83('0x15')]);return _0x895780(_0xc96160[_0x3a83('0x12')][_0x3a83('0x15')]);}logger[_0x3a83('0x12')](_0x3a83('0x14'),_0x523446,_0xc96160[_0x3a83('0x12')][_0x3a83('0x15')]);return _0x509002(_0xc96160[_0x3a83('0x12')][_0x3a83('0x15')]);}else{logger[_0x3a83('0xd')](_0x3a83('0x14'),_0x523446,'request\x20sent');_0x509002(_0xc96160['result']['message']);}})[_0x3a83('0x16')](function(_0x3f913a){logger[_0x3a83('0x12')](_0x3a83('0x14'),_0x523446,_0x3f913a);_0x895780(_0x3f913a);});});}exports[_0x3a83('0x17')]=function(_0x1a22bb){var _0x5bb880=this;return new Promise(function(_0x4b48ee,_0xb89641){return db['SquareProject'][_0x3a83('0x18')]({'raw':_0x1a22bb[_0x3a83('0x19')]?_0x1a22bb['options'][_0x3a83('0x1a')]===undefined?!![]:![]:!![],'where':_0x1a22bb[_0x3a83('0x19')]?_0x1a22bb[_0x3a83('0x19')][_0x3a83('0x1b')]||null:null,'attributes':_0x1a22bb[_0x3a83('0x19')]?_0x1a22bb[_0x3a83('0x19')][_0x3a83('0x1c')]||null:null,'include':_0x1a22bb[_0x3a83('0x19')]?_0x1a22bb[_0x3a83('0x19')][_0x3a83('0x1d')]?_[_0x3a83('0x1e')](_0x1a22bb[_0x3a83('0x19')]['include'],function(_0x5e375b){return{'model':db[_0x5e375b['model']],'as':_0x5e375b['as'],'attributes':_0x5e375b[_0x3a83('0x1c')],'include':_0x5e375b[_0x3a83('0x1d')]?_[_0x3a83('0x1e')](_0x5e375b['include'],function(_0x327385){return{'model':db[_0x327385[_0x3a83('0x1f')]],'as':_0x327385['as'],'attributes':_0x327385['attributes'],'include':_0x327385[_0x3a83('0x1d')]?_[_0x3a83('0x1e')](_0x327385[_0x3a83('0x1d')],function(_0x4b17a9){return{'model':db[_0x4b17a9[_0x3a83('0x1f')]],'as':_0x4b17a9['as'],'attributes':_0x4b17a9[_0x3a83('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x259e20){logger[_0x3a83('0xd')]('ShowSquareProject',_0x1a22bb);logger[_0x3a83('0xf')]('ShowSquareProject',_0x1a22bb,JSON[_0x3a83('0x11')](_0x259e20));_0x4b48ee(_0x259e20);})[_0x3a83('0x16')](function(_0x1f60d4){logger[_0x3a83('0x12')]('ShowSquareProject',_0x1f60d4['message'],_0x1a22bb);_0xb89641(_0x5bb880[_0x3a83('0x12')](0x1f4,_0x1f60d4[_0x3a83('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 180f96d..856ae2a 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 _0x5d17=['./squareProject.events','save','removeListener','register','length','squareProject:'];(function(_0x5880ca,_0x1353cc){var _0x3fbe52=function(_0x54a8cc){while(--_0x54a8cc){_0x5880ca['push'](_0x5880ca['shift']());}};_0x3fbe52(++_0x1353cc);}(_0x5d17,0x114));var _0x75d1=function(_0x24c57b,_0x2ab0c0){_0x24c57b=_0x24c57b-0x0;var _0x1d0146=_0x5d17[_0x24c57b];return _0x1d0146;};'use strict';var SquareProjectEvents=require(_0x75d1('0x0'));var events=[_0x75d1('0x1'),'remove','update'];function createListener(_0x39c0ec,_0x426717){return function(_0x1c9ba6){_0x426717['emit'](_0x39c0ec,_0x1c9ba6);};}function removeListener(_0x177460,_0x45d03a){return function(){SquareProjectEvents[_0x75d1('0x2')](_0x177460,_0x45d03a);};}exports[_0x75d1('0x3')]=function(_0x56ac0a){for(var _0x458681=0x0,_0x116a51=events[_0x75d1('0x4')];_0x458681<_0x116a51;_0x458681++){var _0x1ee61b=events[_0x458681];var _0x3a9d5e=createListener(_0x75d1('0x5')+_0x1ee61b,_0x56ac0a);SquareProjectEvents['on'](_0x1ee61b,_0x3a9d5e);}}; \ No newline at end of file +var _0xd117=['save','remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x537ec5,_0x1a5669){var _0x1d0379=function(_0x4313c6){while(--_0x4313c6){_0x537ec5['push'](_0x537ec5['shift']());}};_0x1d0379(++_0x1a5669);}(_0xd117,0x182));var _0x7d11=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0xd117[_0x5eaa0b];return _0x28b295;};'use strict';var SquareProjectEvents=require(_0x7d11('0x0'));var events=[_0x7d11('0x1'),_0x7d11('0x2'),_0x7d11('0x3')];function createListener(_0x454387,_0x26e0f0){return function(_0x306ae4){_0x26e0f0[_0x7d11('0x4')](_0x454387,_0x306ae4);};}function removeListener(_0x3c07be,_0x31fcb0){return function(){SquareProjectEvents[_0x7d11('0x5')](_0x3c07be,_0x31fcb0);};}exports[_0x7d11('0x6')]=function(_0x27d7e8){for(var _0x40c3c4=0x0,_0x345602=events[_0x7d11('0x7')];_0x40c3c4<_0x345602;_0x40c3c4++){var _0x47b5e6=events[_0x40c3c4];var _0x3803b5=createListener(_0x7d11('0x8')+_0x47b5e6,_0x27d7e8);SquareProjectEvents['on'](_0x47b5e6,_0x3803b5);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 58cc805..214e874 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 _0x1018=['/:id','isAuthenticated','post','create','put','update','/:id/delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index'];(function(_0x5b4991,_0x1c382c){var _0x8f2aa4=function(_0x37d2c8){while(--_0x37d2c8){_0x5b4991['push'](_0x5b4991['shift']());}};_0x8f2aa4(++_0x1c382c);}(_0x1018,0x139));var _0x8101=function(_0x170f03,_0x3399c7){_0x170f03=_0x170f03-0x0;var _0x17ded9=_0x1018[_0x170f03];return _0x17ded9;};'use strict';var multer=require(_0x8101('0x0'));var util=require('util');var path=require(_0x8101('0x1'));var timeout=require(_0x8101('0x2'));var express=require(_0x8101('0x3'));var router=express['Router']();var auth=require(_0x8101('0x4'));var interaction=require(_0x8101('0x5'));var config=require(_0x8101('0x6'));var controller=require(_0x8101('0x7'));router[_0x8101('0x8')]('/',auth['isAuthenticated'](),controller[_0x8101('0x9')]);router[_0x8101('0x8')](_0x8101('0xa'),auth[_0x8101('0xb')](),controller['show']);router['get']('/:id/download',auth[_0x8101('0xb')](),controller['download']);router[_0x8101('0xc')]('/',auth['isAuthenticated'](),controller[_0x8101('0xd')]);router[_0x8101('0xe')](_0x8101('0xa'),auth[_0x8101('0xb')](),controller[_0x8101('0xf')]);router['delete'](_0x8101('0x10'),auth[_0x8101('0xb')](),controller[_0x8101('0x11')]);module[_0x8101('0x12')]=router; \ No newline at end of file +var _0xa5ea=['index','/:id','show','download','post','put','update','delete','/:id/delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated'];(function(_0x26426e,_0x51fdbd){var _0x19e9db=function(_0x17d1ce){while(--_0x17d1ce){_0x26426e['push'](_0x26426e['shift']());}};_0x19e9db(++_0x51fdbd);}(_0xa5ea,0x14d));var _0xaa5e=function(_0x27bd02,_0x4d78d6){_0x27bd02=_0x27bd02-0x0;var _0x192b4e=_0xa5ea[_0x27bd02];return _0x192b4e;};'use strict';var multer=require(_0xaa5e('0x0'));var util=require(_0xaa5e('0x1'));var path=require(_0xaa5e('0x2'));var timeout=require(_0xaa5e('0x3'));var express=require(_0xaa5e('0x4'));var router=express[_0xaa5e('0x5')]();var auth=require(_0xaa5e('0x6'));var interaction=require(_0xaa5e('0x7'));var config=require(_0xaa5e('0x8'));var controller=require(_0xaa5e('0x9'));router[_0xaa5e('0xa')]('/',auth[_0xaa5e('0xb')](),controller[_0xaa5e('0xc')]);router[_0xaa5e('0xa')](_0xaa5e('0xd'),auth['isAuthenticated'](),controller[_0xaa5e('0xe')]);router[_0xaa5e('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xaa5e('0xf')]);router[_0xaa5e('0x10')]('/',auth[_0xaa5e('0xb')](),controller['create']);router[_0xaa5e('0x11')](_0xaa5e('0xd'),auth[_0xaa5e('0xb')](),controller[_0xaa5e('0x12')]);router[_0xaa5e('0x13')](_0xaa5e('0x14'),auth[_0xaa5e('0xb')](),controller[_0xaa5e('0x15')]);module[_0xaa5e('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 1248e0a..f40fee9 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 _0x75d9=['sequelize','exports','STRING','savePath','substring','lastIndexOf'];(function(_0x2f5abb,_0x55f83b){var _0x21149c=function(_0x37149b){while(--_0x37149b){_0x2f5abb['push'](_0x2f5abb['shift']());}};_0x21149c(++_0x55f83b);}(_0x75d9,0x162));var _0x975d=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x75d9[_0x43b584];return _0x48f27b;};'use strict';var Sequelize=require(_0x975d('0x0'));module[_0x975d('0x1')]={'uniqueid':{'type':Sequelize[_0x975d('0x2')]},'callerid':{'type':Sequelize[_0x975d('0x2')]},'calleridname':{'type':Sequelize[_0x975d('0x2')]},'context':{'type':Sequelize[_0x975d('0x2')]},'extension':{'type':Sequelize[_0x975d('0x2')]},'priority':{'type':Sequelize[_0x975d('0x2')]},'accountcode':{'type':Sequelize[_0x975d('0x2')]},'dnid':{'type':Sequelize[_0x975d('0x2')]},'projectName':{'type':Sequelize[_0x975d('0x2')]},'saveName':{'type':Sequelize[_0x975d('0x2')]},'filename':{'type':Sequelize[_0x975d('0x2')]},'savePath':{'type':Sequelize[_0x975d('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x130e00='';var _0x2051fb=this['getDataValue'](_0x975d('0x3'));if(_0x2051fb){_0x130e00=_0x2051fb[_0x975d('0x4')](_0x2051fb[_0x975d('0x5')]('.'));}return _0x130e00;}}}; \ No newline at end of file +var _0xd7a5=['getDataValue','substring','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x1ce3bd,_0x5b2320){var _0xcd9d0d=function(_0x57f556){while(--_0x57f556){_0x1ce3bd['push'](_0x1ce3bd['shift']());}};_0xcd9d0d(++_0x5b2320);}(_0xd7a5,0x1ad));var _0x5d7a=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xd7a5[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x5d7a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5d7a('0x1')]},'callerid':{'type':Sequelize[_0x5d7a('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5d7a('0x1')]},'extension':{'type':Sequelize[_0x5d7a('0x1')]},'priority':{'type':Sequelize[_0x5d7a('0x1')]},'accountcode':{'type':Sequelize[_0x5d7a('0x1')]},'dnid':{'type':Sequelize[_0x5d7a('0x1')]},'projectName':{'type':Sequelize[_0x5d7a('0x1')]},'saveName':{'type':Sequelize[_0x5d7a('0x1')]},'filename':{'type':Sequelize[_0x5d7a('0x1')]},'savePath':{'type':Sequelize[_0x5d7a('0x1')]},'format':{'type':Sequelize[_0x5d7a('0x2')],'get':function(){var _0x4b0523='';var _0xacf041=this[_0x5d7a('0x3')]('savePath');if(_0xacf041){_0x4b0523=_0xacf041[_0x5d7a('0x4')](_0xacf041[_0x5d7a('0x5')]('.'));}return _0x4b0523;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 25976c7..313d938 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 _0xa1af=['ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','filter','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','uniqueid','filename','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','isNil','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox'];(function(_0x1a4352,_0x5ca878){var _0x15059f=function(_0x3e5bd8){while(--_0x3e5bd8){_0x1a4352['push'](_0x1a4352['shift']());}};_0x15059f(++_0x5ca878);}(_0xa1af,0x125));var _0xfa1a=function(_0x83eaaf,_0x38a1ca){_0x83eaaf=_0x83eaaf-0x0;var _0x420f87=_0xa1af[_0x83eaaf];return _0x420f87;};'use strict';var pdf=require(_0xfa1a('0x0'));var emlformat=require(_0xfa1a('0x1'));var rimraf=require(_0xfa1a('0x2'));var zipdir=require(_0xfa1a('0x3'));var jsonpatch=require(_0xfa1a('0x4'));var rp=require('request-promise');var moment=require(_0xfa1a('0x5'));var BPromise=require(_0xfa1a('0x6'));var Mustache=require('mustache');var util=require(_0xfa1a('0x7'));var path=require(_0xfa1a('0x8'));var sox=require(_0xfa1a('0x9'));var csv=require('to-csv');var ejs=require(_0xfa1a('0xa'));var fs=require('fs');var _=require(_0xfa1a('0xb'));var squel=require(_0xfa1a('0xc'));var crypto=require(_0xfa1a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfa1a('0xe'));var toCsv=require(_0xfa1a('0xf'));var querystring=require(_0xfa1a('0x10'));var Papa=require(_0xfa1a('0x11'));var Redis=require(_0xfa1a('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfa1a('0x13'));var hardwareService=require(_0xfa1a('0x14'));var logger=require(_0xfa1a('0x15'))(_0xfa1a('0x16'));var utils=require(_0xfa1a('0x17'));var config=require(_0xfa1a('0x18'));var db=require(_0xfa1a('0x19'))['db'];function respondWithStatusCode(_0x56675a,_0x5fd0c9){_0x5fd0c9=_0x5fd0c9||0xcc;return function(_0x38f2fc){if(_0x38f2fc){return _0x56675a[_0xfa1a('0x1a')](_0x5fd0c9);}return _0x56675a[_0xfa1a('0x1b')](_0x5fd0c9)[_0xfa1a('0x1c')]();};}function respondWithResult(_0x583de7,_0x45fec2){_0x45fec2=_0x45fec2||0xc8;return function(_0x1c6492){if(_0x1c6492){return _0x583de7['status'](_0x45fec2)[_0xfa1a('0x1d')](_0x1c6492);}};}function respondWithFilteredResult(_0x3a1859,_0x59a8e1){return function(_0x1fa440){if(_0x1fa440){var _0x59d8ea=_0x1fa440[_0xfa1a('0x1e')],_0xbe2472=_0x59a8e1[_0xfa1a('0x1f')],_0x32829c=_0x59a8e1[_0xfa1a('0x1f')]+_0x59a8e1[_0xfa1a('0x20')],_0x335275;if(_0x32829c>=_0x59d8ea){_0x32829c=_0x59d8ea;_0x335275=0xc8;}else{_0x335275=0xce;}_0x3a1859[_0xfa1a('0x1b')](_0x335275);return _0x3a1859[_0xfa1a('0x21')]('Content-Range',_0xbe2472+'-'+_0x32829c+'/'+_0x59d8ea)['json'](_0x1fa440);}return null;};}function patchUpdates(_0x2056fb){return function(_0x4acd9c){try{jsonpatch[_0xfa1a('0x22')](_0x4acd9c,_0x2056fb,!![]);}catch(_0x44aaf5){return BPromise[_0xfa1a('0x23')](_0x44aaf5);}return _0x4acd9c[_0xfa1a('0x24')]();};}function saveUpdates(_0x58f4bb,_0x30ab0c){return function(_0x51f869){if(_0x51f869){return _0x51f869['update'](_0x58f4bb)[_0xfa1a('0x25')](function(_0x572a18){return _0x572a18;});}return null;};}function removeEntity(_0x13c5b8,_0x368629){return function(_0x560d56){if(_0x560d56){return _0x560d56[_0xfa1a('0x26')]()[_0xfa1a('0x25')](function(){_0x13c5b8[_0xfa1a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd1b7ce,_0x4edbdc){return function(_0x39a9ab){if(!_0x39a9ab){_0xd1b7ce['sendStatus'](0x194);}return _0x39a9ab;};}function handleError(_0x28bca9,_0x3f935b){_0x3f935b=_0x3f935b||0x1f4;return function(_0x51b3d6){logger[_0xfa1a('0x27')](_0x51b3d6[_0xfa1a('0x28')]);if(_0x51b3d6[_0xfa1a('0x29')]){delete _0x51b3d6['name'];}_0x28bca9['status'](_0x3f935b)[_0xfa1a('0x2a')](_0x51b3d6);};}exports[_0xfa1a('0x2b')]=function(_0x3b1bca,_0x559a02){var _0x2c8ae7={},_0x3d68f2={},_0x33fdb1={'count':0x0,'rows':[]};var _0x1d9482=_['map'](db[_0xfa1a('0x2c')][_0xfa1a('0x2d')],function(_0x17bbc9){return{'name':_0x17bbc9[_0xfa1a('0x2e')],'type':_0x17bbc9[_0xfa1a('0x2f')][_0xfa1a('0x30')]};});_0x3d68f2[_0xfa1a('0x31')]=_[_0xfa1a('0x32')](_0x1d9482,_0xfa1a('0x29'));_0x3d68f2[_0xfa1a('0x33')]=_[_0xfa1a('0x34')](_0x3b1bca[_0xfa1a('0x33')]);_0x3d68f2[_0xfa1a('0x35')]=_[_0xfa1a('0x36')](_0x3d68f2[_0xfa1a('0x31')],_0x3d68f2[_0xfa1a('0x33')]);_0x2c8ae7['attributes']=_[_0xfa1a('0x36')](_0x3d68f2[_0xfa1a('0x31')],qs['fields'](_0x3b1bca['query']['fields']));_0x2c8ae7[_0xfa1a('0x37')]=_0x2c8ae7['attributes'][_0xfa1a('0x38')]?_0x2c8ae7['attributes']:_0x3d68f2[_0xfa1a('0x31')];if(!_0x3b1bca[_0xfa1a('0x33')][_0xfa1a('0x39')](_0xfa1a('0x3a'))){_0x2c8ae7['limit']=qs['limit'](_0x3b1bca['query']['limit']);_0x2c8ae7[_0xfa1a('0x1f')]=qs[_0xfa1a('0x1f')](_0x3b1bca[_0xfa1a('0x33')][_0xfa1a('0x1f')]);}_0x2c8ae7[_0xfa1a('0x3b')]=qs[_0xfa1a('0x3c')](_0x3b1bca[_0xfa1a('0x33')]['sort']);_0x2c8ae7['where']=qs[_0xfa1a('0x35')](_[_0xfa1a('0x3d')](_0x3b1bca[_0xfa1a('0x33')],_0x3d68f2[_0xfa1a('0x35')]),_0x1d9482);if(_0x3b1bca['query']['filter']){_0x2c8ae7['where']=_[_0xfa1a('0x3e')](_0x2c8ae7[_0xfa1a('0x3f')],{'$or':_['map'](_0x1d9482,function(_0x39b1be){if(_0x39b1be[_0xfa1a('0x2f')]!=='VIRTUAL'){var _0x15c8cd={};_0x15c8cd[_0x39b1be[_0xfa1a('0x29')]]={'$like':'%'+_0x3b1bca[_0xfa1a('0x33')][_0xfa1a('0x40')]+'%'};return _0x15c8cd;}})});}_0x2c8ae7=_['merge']({},_0x2c8ae7,_0x3b1bca[_0xfa1a('0x41')]);var _0x3e4fda={'where':_0x2c8ae7[_0xfa1a('0x3f')]};return db[_0xfa1a('0x2c')]['count'](_0x3e4fda)[_0xfa1a('0x25')](function(_0x13f938){_0x33fdb1['count']=_0x13f938;if(_0x3b1bca['query'][_0xfa1a('0x42')]){_0x2c8ae7[_0xfa1a('0x43')]=[{'all':!![]}];}return db[_0xfa1a('0x2c')][_0xfa1a('0x44')](_0x2c8ae7);})[_0xfa1a('0x25')](function(_0x57bc5b){_0x33fdb1[_0xfa1a('0x45')]=_0x57bc5b;return _0x33fdb1;})[_0xfa1a('0x25')](respondWithFilteredResult(_0x559a02,_0x2c8ae7))[_0xfa1a('0x46')](handleError(_0x559a02,null));};exports['show']=function(_0x145ea4,_0x158538){var _0x707809={'raw':!![],'where':{'id':_0x145ea4[_0xfa1a('0x47')]['id']}},_0x5a9208={};_0x5a9208['model']=_[_0xfa1a('0x34')](db[_0xfa1a('0x2c')]['rawAttributes']);_0x5a9208[_0xfa1a('0x33')]=_[_0xfa1a('0x34')](_0x145ea4['query']);_0x5a9208[_0xfa1a('0x35')]=_[_0xfa1a('0x36')](_0x5a9208['model'],_0x5a9208[_0xfa1a('0x33')]);_0x707809[_0xfa1a('0x37')]=_[_0xfa1a('0x36')](_0x5a9208[_0xfa1a('0x31')],qs[_0xfa1a('0x48')](_0x145ea4[_0xfa1a('0x33')][_0xfa1a('0x48')]));_0x707809[_0xfa1a('0x37')]=_0x707809['attributes'][_0xfa1a('0x38')]?_0x707809['attributes']:_0x5a9208[_0xfa1a('0x31')];if(_0x145ea4[_0xfa1a('0x33')]['includeAll']){_0x707809['include']=[{'all':!![]}];}_0x707809=_[_0xfa1a('0x3e')]({},_0x707809,_0x145ea4['options']);return db[_0xfa1a('0x2c')][_0xfa1a('0x49')](_0x707809)[_0xfa1a('0x25')](handleEntityNotFound(_0x158538,null))[_0xfa1a('0x25')](respondWithResult(_0x158538,null))['catch'](handleError(_0x158538,null));};exports[_0xfa1a('0x4a')]=function(_0x35318d,_0x549047){return db[_0xfa1a('0x2c')][_0xfa1a('0x4a')](_0x35318d['body'],{})['then'](respondWithResult(_0x549047,0xc9))[_0xfa1a('0x46')](handleError(_0x549047,null));};exports['update']=function(_0x30e560,_0x5651b5){if(_0x30e560['body']['id']){delete _0x30e560[_0xfa1a('0x4b')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x30e560['params']['id']}})[_0xfa1a('0x25')](handleEntityNotFound(_0x5651b5,null))[_0xfa1a('0x25')](saveUpdates(_0x30e560[_0xfa1a('0x4b')],null))['then'](respondWithResult(_0x5651b5,null))[_0xfa1a('0x46')](handleError(_0x5651b5,null));};exports['download']=function(_0x4a591a,_0x1f2712,_0x373128){var _0x1784fa=require('../../components/encryptor');var _0x3dadd4=![];var _0x1f8a28={};if(_0x4a591a[_0xfa1a('0x33')][_0xfa1a('0x2f')]&&_0x4a591a['query'][_0xfa1a('0x2f')]===_0xfa1a('0x4c')){_0x1f8a28[_0xfa1a('0x4c')]=_0x4a591a[_0xfa1a('0x47')]['id'];}else{_0x1f8a28['id']=_0x4a591a['params']['id'];}return db[_0xfa1a('0x2c')][_0xfa1a('0x49')]({'where':_0x1f8a28,'attributes':['id','savePath',_0xfa1a('0x4d')],'raw':!![]})[_0xfa1a('0x25')](handleEntityNotFound(_0x1f2712,null))['then'](function(_0x495b2b){if(_0x495b2b){var _0x2f2d7f=_0x495b2b[_0xfa1a('0x4e')];var _0x3afe62=util[_0xfa1a('0x4f')](_0xfa1a('0x50'),_0x2f2d7f);if(fs['existsSync'](_0x3afe62)){_0x3dadd4=!![];return _0x1784fa[_0xfa1a('0x51')](_0x3afe62,_0x2f2d7f,config[_0xfa1a('0x52')][_0xfa1a('0x53')])[_0xfa1a('0x25')](function(){return _0x495b2b;});}return _0x495b2b;}})[_0xfa1a('0x25')](function(_0x1f68aa){if(_0x1f68aa){var _0x4f43f5=_0x1f68aa[_0xfa1a('0x4e')];if(!fs[_0xfa1a('0x54')](_0x4f43f5)){throw new db[(_0xfa1a('0x55'))][(_0xfa1a('0x56'))](_0xfa1a('0x57'));}if(_0x1f68aa[_0xfa1a('0x4d')]){return _0x1f2712[_0xfa1a('0x58')](_0x4f43f5,_0x1f68aa['filename']+path[_0xfa1a('0x59')](_0x4f43f5),function(){if(_0x3dadd4){fs[_0xfa1a('0x5a')](_0x4f43f5);}});}else{return _0x1f2712[_0xfa1a('0x58')](_0x4f43f5,function(_0x20001a){if(_0x3dadd4){fs[_0xfa1a('0x5a')](_0x4f43f5);}});}}})[_0xfa1a('0x46')](function(_0x5e7874){if(_0x5e7874[_0xfa1a('0x5b')]===_0xfa1a('0x57')){_0x1f2712[_0xfa1a('0x1b')](0x194)[_0xfa1a('0x2a')](_0xfa1a('0x5c'));}else{return handleError(_0x1f2712,null);}});};exports[_0xfa1a('0x26')]=function(_0x2d9782,_0x36bff4){return db[_0xfa1a('0x2c')][_0xfa1a('0x49')]({'where':{'id':_0x2d9782[_0xfa1a('0x47')]['id']}})['then'](function(_0x566439){if(!_0x566439)throw new ReferenceError(_0xfa1a('0x5d'));return _0x566439;})[_0xfa1a('0x25')](function(_0x3122b9){var _0xb459ff=_0x3122b9[_0xfa1a('0x4e')];logger[_0xfa1a('0x5e')](_0xfa1a('0x5f'),_0xb459ff);if(!_['isNil'](_0x3122b9[_0xfa1a('0x4e')])&&fs[_0xfa1a('0x54')](_0xb459ff)){logger[_0xfa1a('0x5e')](_0xfa1a('0x60')+_0xb459ff+_0xfa1a('0x61'));fs['unlinkSync'](_0xb459ff);}_0xb459ff=_0xb459ff+_0xfa1a('0x62');if(!_[_0xfa1a('0x63')](_0x3122b9[_0xfa1a('0x4e')])&&fs[_0xfa1a('0x54')](_0xb459ff)){logger[_0xfa1a('0x5e')](_0xfa1a('0x60')+_0xb459ff+_0xfa1a('0x61'));fs[_0xfa1a('0x64')](_0xb459ff);}return _0x3122b9;})[_0xfa1a('0x25')](function(_0x1e45da){if(!_0x1e45da)throw new InternalError();return _0x1e45da[_0xfa1a('0x26')]();})[_0xfa1a('0x25')](function(){_0x36bff4['status'](0xcc)[_0xfa1a('0x1c')]();})[_0xfa1a('0x46')](handleError(_0x36bff4,null));}; \ No newline at end of file +var _0x2bbe=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','offset','limit','status','set','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','include','SquareRecording','findAll','rows','catch','show','keys','includeAll','find','create','body','params','../../components/encryptor','type','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','download','extname','unlink','message','SquareRecording\x20not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x2bbe,0x1dd));var _0xe2bb=function(_0x2e25b6,_0x23fbfa){_0x2e25b6=_0x2e25b6-0x0;var _0x4a134c=_0x2bbe[_0x2e25b6];return _0x4a134c;};'use strict';var pdf=require(_0xe2bb('0x0'));var emlformat=require(_0xe2bb('0x1'));var rimraf=require(_0xe2bb('0x2'));var zipdir=require(_0xe2bb('0x3'));var jsonpatch=require(_0xe2bb('0x4'));var rp=require(_0xe2bb('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe2bb('0x6'));var util=require('util');var path=require(_0xe2bb('0x7'));var sox=require(_0xe2bb('0x8'));var csv=require(_0xe2bb('0x9'));var ejs=require(_0xe2bb('0xa'));var fs=require('fs');var _=require(_0xe2bb('0xb'));var squel=require(_0xe2bb('0xc'));var crypto=require(_0xe2bb('0xd'));var jsforce=require(_0xe2bb('0xe'));var deskjs=require(_0xe2bb('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe2bb('0x10'));var authService=require(_0xe2bb('0x11'));var qs=require(_0xe2bb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe2bb('0x13'));var logger=require('../../config/logger')(_0xe2bb('0x14'));var utils=require(_0xe2bb('0x15'));var config=require(_0xe2bb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fdb27,_0x151361){_0x151361=_0x151361||0xcc;return function(_0x107b61){if(_0x107b61){return _0x2fdb27[_0xe2bb('0x17')](_0x151361);}return _0x2fdb27['status'](_0x151361)[_0xe2bb('0x18')]();};}function respondWithResult(_0x29be85,_0x4ca6f1){_0x4ca6f1=_0x4ca6f1||0xc8;return function(_0x1a87a2){if(_0x1a87a2){return _0x29be85['status'](_0x4ca6f1)['json'](_0x1a87a2);}};}function respondWithFilteredResult(_0x2d2026,_0x36f4b6){return function(_0xb77972){if(_0xb77972){var _0x6f14f3=_0xb77972['count'],_0x510974=_0x36f4b6[_0xe2bb('0x19')],_0x2ec9f5=_0x36f4b6['offset']+_0x36f4b6[_0xe2bb('0x1a')],_0x54c9f9;if(_0x2ec9f5>=_0x6f14f3){_0x2ec9f5=_0x6f14f3;_0x54c9f9=0xc8;}else{_0x54c9f9=0xce;}_0x2d2026[_0xe2bb('0x1b')](_0x54c9f9);return _0x2d2026[_0xe2bb('0x1c')]('Content-Range',_0x510974+'-'+_0x2ec9f5+'/'+_0x6f14f3)[_0xe2bb('0x1d')](_0xb77972);}return null;};}function patchUpdates(_0x38873c){return function(_0x20f40b){try{jsonpatch[_0xe2bb('0x1e')](_0x20f40b,_0x38873c,!![]);}catch(_0x1973c5){return BPromise[_0xe2bb('0x1f')](_0x1973c5);}return _0x20f40b[_0xe2bb('0x20')]();};}function saveUpdates(_0x151fd6,_0x520299){return function(_0x61fc5){if(_0x61fc5){return _0x61fc5['update'](_0x151fd6)[_0xe2bb('0x21')](function(_0x17621d){return _0x17621d;});}return null;};}function removeEntity(_0x2723d8,_0x29c9bb){return function(_0x5b8a08){if(_0x5b8a08){return _0x5b8a08[_0xe2bb('0x22')]()[_0xe2bb('0x21')](function(){_0x2723d8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c17f9,_0x3d4361){return function(_0x407af5){if(!_0x407af5){_0x3c17f9[_0xe2bb('0x17')](0x194);}return _0x407af5;};}function handleError(_0x4ab791,_0x2f87d6){_0x2f87d6=_0x2f87d6||0x1f4;return function(_0xd74081){logger[_0xe2bb('0x23')](_0xd74081[_0xe2bb('0x24')]);if(_0xd74081[_0xe2bb('0x25')]){delete _0xd74081[_0xe2bb('0x25')];}_0x4ab791['status'](_0x2f87d6)[_0xe2bb('0x26')](_0xd74081);};}exports[_0xe2bb('0x27')]=function(_0x30a65f,_0x2a77b2){var _0x30615a={},_0x1c97b8={},_0x4e9a0e={'count':0x0,'rows':[]};var _0xf41c29=_[_0xe2bb('0x28')](db['SquareRecording'][_0xe2bb('0x29')],function(_0x5bb387){return{'name':_0x5bb387['fieldName'],'type':_0x5bb387['type'][_0xe2bb('0x2a')]};});_0x1c97b8['model']=_[_0xe2bb('0x28')](_0xf41c29,_0xe2bb('0x25'));_0x1c97b8[_0xe2bb('0x2b')]=_['keys'](_0x30a65f[_0xe2bb('0x2b')]);_0x1c97b8[_0xe2bb('0x2c')]=_[_0xe2bb('0x2d')](_0x1c97b8[_0xe2bb('0x2e')],_0x1c97b8[_0xe2bb('0x2b')]);_0x30615a[_0xe2bb('0x2f')]=_[_0xe2bb('0x2d')](_0x1c97b8[_0xe2bb('0x2e')],qs[_0xe2bb('0x30')](_0x30a65f[_0xe2bb('0x2b')][_0xe2bb('0x30')]));_0x30615a['attributes']=_0x30615a[_0xe2bb('0x2f')][_0xe2bb('0x31')]?_0x30615a['attributes']:_0x1c97b8[_0xe2bb('0x2e')];if(!_0x30a65f[_0xe2bb('0x2b')][_0xe2bb('0x32')](_0xe2bb('0x33'))){_0x30615a[_0xe2bb('0x1a')]=qs[_0xe2bb('0x1a')](_0x30a65f[_0xe2bb('0x2b')][_0xe2bb('0x1a')]);_0x30615a[_0xe2bb('0x19')]=qs[_0xe2bb('0x19')](_0x30a65f[_0xe2bb('0x2b')][_0xe2bb('0x19')]);}_0x30615a[_0xe2bb('0x34')]=qs[_0xe2bb('0x35')](_0x30a65f[_0xe2bb('0x2b')][_0xe2bb('0x35')]);_0x30615a[_0xe2bb('0x36')]=qs['filters'](_['pick'](_0x30a65f[_0xe2bb('0x2b')],_0x1c97b8[_0xe2bb('0x2c')]),_0xf41c29);if(_0x30a65f['query'][_0xe2bb('0x37')]){_0x30615a[_0xe2bb('0x36')]=_[_0xe2bb('0x38')](_0x30615a[_0xe2bb('0x36')],{'$or':_[_0xe2bb('0x28')](_0xf41c29,function(_0x18800b){if(_0x18800b['type']!=='VIRTUAL'){var _0x3d0708={};_0x3d0708[_0x18800b['name']]={'$like':'%'+_0x30a65f[_0xe2bb('0x2b')]['filter']+'%'};return _0x3d0708;}})});}_0x30615a=_[_0xe2bb('0x38')]({},_0x30615a,_0x30a65f[_0xe2bb('0x39')]);var _0x55a1a3={'where':_0x30615a[_0xe2bb('0x36')]};return db['SquareRecording'][_0xe2bb('0x3a')](_0x55a1a3)[_0xe2bb('0x21')](function(_0x2f29ad){_0x4e9a0e[_0xe2bb('0x3a')]=_0x2f29ad;if(_0x30a65f[_0xe2bb('0x2b')]['includeAll']){_0x30615a[_0xe2bb('0x3b')]=[{'all':!![]}];}return db[_0xe2bb('0x3c')][_0xe2bb('0x3d')](_0x30615a);})['then'](function(_0x79577){_0x4e9a0e[_0xe2bb('0x3e')]=_0x79577;return _0x4e9a0e;})[_0xe2bb('0x21')](respondWithFilteredResult(_0x2a77b2,_0x30615a))[_0xe2bb('0x3f')](handleError(_0x2a77b2,null));};exports[_0xe2bb('0x40')]=function(_0xbc43bb,_0x6fa1b1){var _0x228012={'raw':!![],'where':{'id':_0xbc43bb['params']['id']}},_0x39c2fa={};_0x39c2fa['model']=_[_0xe2bb('0x41')](db[_0xe2bb('0x3c')][_0xe2bb('0x29')]);_0x39c2fa[_0xe2bb('0x2b')]=_[_0xe2bb('0x41')](_0xbc43bb[_0xe2bb('0x2b')]);_0x39c2fa[_0xe2bb('0x2c')]=_['intersection'](_0x39c2fa[_0xe2bb('0x2e')],_0x39c2fa[_0xe2bb('0x2b')]);_0x228012['attributes']=_['intersection'](_0x39c2fa[_0xe2bb('0x2e')],qs[_0xe2bb('0x30')](_0xbc43bb[_0xe2bb('0x2b')][_0xe2bb('0x30')]));_0x228012['attributes']=_0x228012[_0xe2bb('0x2f')][_0xe2bb('0x31')]?_0x228012[_0xe2bb('0x2f')]:_0x39c2fa[_0xe2bb('0x2e')];if(_0xbc43bb[_0xe2bb('0x2b')][_0xe2bb('0x42')]){_0x228012['include']=[{'all':!![]}];}_0x228012=_[_0xe2bb('0x38')]({},_0x228012,_0xbc43bb[_0xe2bb('0x39')]);return db['SquareRecording'][_0xe2bb('0x43')](_0x228012)['then'](handleEntityNotFound(_0x6fa1b1,null))[_0xe2bb('0x21')](respondWithResult(_0x6fa1b1,null))[_0xe2bb('0x3f')](handleError(_0x6fa1b1,null));};exports[_0xe2bb('0x44')]=function(_0x2823e9,_0x19b3c4){return db[_0xe2bb('0x3c')][_0xe2bb('0x44')](_0x2823e9['body'],{})[_0xe2bb('0x21')](respondWithResult(_0x19b3c4,0xc9))[_0xe2bb('0x3f')](handleError(_0x19b3c4,null));};exports['update']=function(_0xe11872,_0x57efa6){if(_0xe11872[_0xe2bb('0x45')]['id']){delete _0xe11872[_0xe2bb('0x45')]['id'];}return db[_0xe2bb('0x3c')][_0xe2bb('0x43')]({'where':{'id':_0xe11872[_0xe2bb('0x46')]['id']}})[_0xe2bb('0x21')](handleEntityNotFound(_0x57efa6,null))[_0xe2bb('0x21')](saveUpdates(_0xe11872[_0xe2bb('0x45')],null))['then'](respondWithResult(_0x57efa6,null))[_0xe2bb('0x3f')](handleError(_0x57efa6,null));};exports['download']=function(_0x52c895,_0x383648,_0x5380d0){var _0x4be7e2=require(_0xe2bb('0x47'));var _0x4bd231=![];var _0x5e5619={};if(_0x52c895['query']['type']&&_0x52c895[_0xe2bb('0x2b')][_0xe2bb('0x48')]===_0xe2bb('0x49')){_0x5e5619[_0xe2bb('0x49')]=_0x52c895[_0xe2bb('0x46')]['id'];}else{_0x5e5619['id']=_0x52c895[_0xe2bb('0x46')]['id'];}return db[_0xe2bb('0x3c')][_0xe2bb('0x43')]({'where':_0x5e5619,'attributes':['id',_0xe2bb('0x4a'),_0xe2bb('0x4b')],'raw':!![]})[_0xe2bb('0x21')](handleEntityNotFound(_0x383648,null))['then'](function(_0x29c802){if(_0x29c802){var _0x3a1b55=_0x29c802[_0xe2bb('0x4a')];var _0x5a103e=util[_0xe2bb('0x4c')](_0xe2bb('0x4d'),_0x3a1b55);if(fs[_0xe2bb('0x4e')](_0x5a103e)){_0x4bd231=!![];return _0x4be7e2[_0xe2bb('0x4f')](_0x5a103e,_0x3a1b55,config[_0xe2bb('0x50')][_0xe2bb('0x51')])[_0xe2bb('0x21')](function(){return _0x29c802;});}return _0x29c802;}})['then'](function(_0x4d5143){if(_0x4d5143){var _0x218cd1=_0x4d5143[_0xe2bb('0x4a')];if(!fs[_0xe2bb('0x4e')](_0x218cd1)){throw new db[(_0xe2bb('0x52'))][(_0xe2bb('0x53'))]('SquareRecording\x20not\x20found');}if(_0x4d5143['filename']){return _0x383648[_0xe2bb('0x54')](_0x218cd1,_0x4d5143[_0xe2bb('0x4b')]+path[_0xe2bb('0x55')](_0x218cd1),function(){if(_0x4bd231){fs[_0xe2bb('0x56')](_0x218cd1);}});}else{return _0x383648[_0xe2bb('0x54')](_0x218cd1,function(_0x4334d2){if(_0x4bd231){fs['unlink'](_0x218cd1);}});}}})[_0xe2bb('0x3f')](function(_0x3840c1){if(_0x3840c1[_0xe2bb('0x57')]===_0xe2bb('0x58')){_0x383648[_0xe2bb('0x1b')](0x194)[_0xe2bb('0x26')]('Not\x20found');}else{return handleError(_0x383648,null);}});};exports['destroy']=function(_0xa27fda,_0x64fdfb){return db['SquareRecording']['find']({'where':{'id':_0xa27fda[_0xe2bb('0x46')]['id']}})[_0xe2bb('0x21')](function(_0x379638){if(!_0x379638)throw new ReferenceError(_0xe2bb('0x59'));return _0x379638;})['then'](function(_0x43ac36){var _0x216377=_0x43ac36[_0xe2bb('0x4a')];logger[_0xe2bb('0x5a')](_0xe2bb('0x5b'),_0x216377);if(!_[_0xe2bb('0x5c')](_0x43ac36[_0xe2bb('0x4a')])&&fs[_0xe2bb('0x4e')](_0x216377)){logger[_0xe2bb('0x5a')](_0xe2bb('0x5d')+_0x216377+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe2bb('0x5e')](_0x216377);}_0x216377=_0x216377+_0xe2bb('0x5f');if(!_['isNil'](_0x43ac36[_0xe2bb('0x4a')])&&fs[_0xe2bb('0x4e')](_0x216377)){logger[_0xe2bb('0x5a')](_0xe2bb('0x5d')+_0x216377+_0xe2bb('0x60'));fs[_0xe2bb('0x5e')](_0x216377);}return _0x43ac36;})[_0xe2bb('0x21')](function(_0x1b7910){if(!_0x1b7910)throw new InternalError();return _0x1b7910['destroy']();})[_0xe2bb('0x21')](function(){_0x64fdfb[_0xe2bb('0x1b')](0xcc)['end']();})[_0xe2bb('0x3f')](handleError(_0x64fdfb,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index a82a88b..0a01527 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 _0x01a6=['rimraf','./squareRecording.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2d7be9,_0x2b9cb3){var _0x5ddc07=function(_0x588c16){while(--_0x588c16){_0x2d7be9['push'](_0x2d7be9['shift']());}};_0x5ddc07(++_0x2b9cb3);}(_0x01a6,0x162));var _0x601a=function(_0x539c93,_0x5ce365){_0x539c93=_0x539c93-0x0;var _0x8346fe=_0x01a6[_0x539c93];return _0x8346fe;};'use strict';var _=require(_0x601a('0x0'));var util=require('util');var logger=require(_0x601a('0x1'))(_0x601a('0x2'));var moment=require(_0x601a('0x3'));var BPromise=require(_0x601a('0x4'));var rp=require(_0x601a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x601a('0x6'));var config=require('../../config/environment');var attributes=require(_0x601a('0x7'));module[_0x601a('0x8')]=function(_0x30df8c,_0x196c77){return _0x30df8c[_0x601a('0x9')]('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e63=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','lodash','util','../../config/logger'];(function(_0xbbe5fe,_0x4a9eb4){var _0x381c5a=function(_0x4b13fd){while(--_0x4b13fd){_0xbbe5fe['push'](_0xbbe5fe['shift']());}};_0x381c5a(++_0x4a9eb4);}(_0x9e63,0x65));var _0x39e6=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x9e63[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x39e6('0x0'));var util=require(_0x39e6('0x1'));var logger=require(_0x39e6('0x2'))('api');var moment=require(_0x39e6('0x3'));var BPromise=require(_0x39e6('0x4'));var rp=require(_0x39e6('0x5'));var fs=require('fs');var path=require(_0x39e6('0x6'));var rimraf=require(_0x39e6('0x7'));var config=require(_0x39e6('0x8'));var attributes=require(_0x39e6('0x9'));module[_0x39e6('0xa')]=function(_0x48f3bb,_0x367e77){return _0x48f3bb[_0x39e6('0xb')](_0x39e6('0xc'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 2529321..072914c 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 _0x0117=['request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareRecording','create','body','options','CreateSquareRecording','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','SquareRecording,\x20%s,\x20%s'];(function(_0x38ac44,_0x38c414){var _0x42e9ae=function(_0x5f261c){while(--_0x5f261c){_0x38ac44['push'](_0x38ac44['shift']());}};_0x42e9ae(++_0x38c414);}(_0x0117,0x152));var _0x7011=function(_0x23ca0b,_0x2c9a47){_0x23ca0b=_0x23ca0b-0x0;var _0x235eb6=_0x0117[_0x23ca0b];return _0x235eb6;};'use strict';var _=require(_0x7011('0x0'));var util=require(_0x7011('0x1'));var moment=require(_0x7011('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7011('0x3'));var db=require(_0x7011('0x4'))['db'];var utils=require(_0x7011('0x5'));var logger=require('../../config/logger')(_0x7011('0x6'));var config=require(_0x7011('0x7'));var jayson=require(_0x7011('0x8'));var client=jayson['client'][_0x7011('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4dc942,_0x31f434,_0x414280){return new BPromise(function(_0x32884e,_0x458b92){return client['request'](_0x4dc942,_0x414280)[_0x7011('0xa')](function(_0x2bbe1c){logger[_0x7011('0xb')](_0x7011('0xc'),_0x31f434,_0x7011('0xd'));logger[_0x7011('0xe')](_0x7011('0xf'),_0x31f434,_0x7011('0xd'),JSON[_0x7011('0x10')](_0x2bbe1c));if(_0x2bbe1c[_0x7011('0x11')]){if(_0x2bbe1c[_0x7011('0x11')][_0x7011('0x12')]===0x1f4){logger[_0x7011('0x11')](_0x7011('0xc'),_0x31f434,_0x2bbe1c['error']['message']);return _0x458b92(_0x2bbe1c['error'][_0x7011('0x13')]);}logger[_0x7011('0x11')]('SquareRecording,\x20%s,\x20%s',_0x31f434,_0x2bbe1c[_0x7011('0x11')]['message']);return _0x32884e(_0x2bbe1c['error']['message']);}else{logger[_0x7011('0xb')]('SquareRecording,\x20%s,\x20%s',_0x31f434,_0x7011('0xd'));_0x32884e(_0x2bbe1c[_0x7011('0x14')][_0x7011('0x13')]);}})['catch'](function(_0x3fc1ad){logger['error']('SquareRecording,\x20%s,\x20%s',_0x31f434,_0x3fc1ad);_0x458b92(_0x3fc1ad);});});}exports['CreateSquareRecording']=function(_0x16f97c){var _0x15abeb=this;return new Promise(function(_0xc4e573,_0x117500){return db[_0x7011('0x15')][_0x7011('0x16')](_0x16f97c[_0x7011('0x17')],{'raw':_0x16f97c[_0x7011('0x18')]?_0x16f97c[_0x7011('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x19c885){logger[_0x7011('0xb')](_0x7011('0x19'),_0x16f97c);logger[_0x7011('0xe')]('CreateSquareRecording',_0x16f97c,JSON[_0x7011('0x10')](_0x19c885));_0xc4e573(_0x19c885);})[_0x7011('0x1a')](function(_0x33248d){logger['error'](_0x7011('0x19'),_0x33248d[_0x7011('0x13')],_0x16f97c);_0x117500(_0x15abeb[_0x7011('0x11')](0x1f4,_0x33248d[_0x7011('0x13')]));});});}; \ No newline at end of file +var _0x99d3=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','SquareRecording','create','body','options','CreateSquareRecording','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x99d3,0xc5));var _0x399d=function(_0x2a1524,_0x59b461){_0x2a1524=_0x2a1524-0x0;var _0x3e3bb8=_0x99d3[_0x2a1524];return _0x3e3bb8;};'use strict';var _=require(_0x399d('0x0'));var util=require(_0x399d('0x1'));var moment=require(_0x399d('0x2'));var BPromise=require(_0x399d('0x3'));var rs=require(_0x399d('0x4'));var fs=require('fs');var Redis=require(_0x399d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x399d('0x6'));var logger=require(_0x399d('0x7'))(_0x399d('0x8'));var config=require(_0x399d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x399d('0xa')][_0x399d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x391129,_0x5a1cf6,_0x28bfb3){return new BPromise(function(_0x33b651,_0x317859){return client[_0x399d('0xc')](_0x391129,_0x28bfb3)[_0x399d('0xd')](function(_0x488c06){logger[_0x399d('0xe')]('SquareRecording,\x20%s,\x20%s',_0x5a1cf6,_0x399d('0xf'));logger[_0x399d('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x5a1cf6,'request\x20sent',JSON[_0x399d('0x11')](_0x488c06));if(_0x488c06[_0x399d('0x12')]){if(_0x488c06[_0x399d('0x12')][_0x399d('0x13')]===0x1f4){logger[_0x399d('0x12')](_0x399d('0x14'),_0x5a1cf6,_0x488c06[_0x399d('0x12')][_0x399d('0x15')]);return _0x317859(_0x488c06[_0x399d('0x12')][_0x399d('0x15')]);}logger['error'](_0x399d('0x14'),_0x5a1cf6,_0x488c06[_0x399d('0x12')]['message']);return _0x33b651(_0x488c06['error'][_0x399d('0x15')]);}else{logger[_0x399d('0xe')]('SquareRecording,\x20%s,\x20%s',_0x5a1cf6,_0x399d('0xf'));_0x33b651(_0x488c06[_0x399d('0x16')][_0x399d('0x15')]);}})['catch'](function(_0x446eac){logger['error'](_0x399d('0x14'),_0x5a1cf6,_0x446eac);_0x317859(_0x446eac);});});}exports['CreateSquareRecording']=function(_0x320aa0){var _0x242890=this;return new Promise(function(_0x15c0f4,_0x29881f){return db[_0x399d('0x17')][_0x399d('0x18')](_0x320aa0[_0x399d('0x19')],{'raw':_0x320aa0[_0x399d('0x1a')]?_0x320aa0[_0x399d('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x239d55){logger[_0x399d('0xe')]('CreateSquareRecording',_0x320aa0);logger[_0x399d('0x10')](_0x399d('0x1b'),_0x320aa0,JSON[_0x399d('0x11')](_0x239d55));_0x15c0f4(_0x239d55);})[_0x399d('0x1c')](function(_0x483668){logger[_0x399d('0x12')](_0x399d('0x1b'),_0x483668[_0x399d('0x15')],_0x320aa0);_0x29881f(_0x242890[_0x399d('0x12')](0x1f4,_0x483668[_0x399d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 642033c..3de6739 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 _0xf9f0=['connect-timeout','express','../../components/auth/service','../../config/environment','./squareReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','destroy','multer','util','path'];(function(_0x44cdd7,_0x369c03){var _0x45f90d=function(_0x573ca7){while(--_0x573ca7){_0x44cdd7['push'](_0x44cdd7['shift']());}};_0x45f90d(++_0x369c03);}(_0xf9f0,0x6f));var _0x0f9f=function(_0x3bbd39,_0x31826c){_0x3bbd39=_0x3bbd39-0x0;var _0x4716a3=_0xf9f0[_0x3bbd39];return _0x4716a3;};'use strict';var multer=require(_0x0f9f('0x0'));var util=require(_0x0f9f('0x1'));var path=require(_0x0f9f('0x2'));var timeout=require(_0x0f9f('0x3'));var express=require(_0x0f9f('0x4'));var router=express['Router']();var auth=require(_0x0f9f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0f9f('0x6'));var controller=require(_0x0f9f('0x7'));router[_0x0f9f('0x8')]('/',auth['isAuthenticated'](),controller[_0x0f9f('0x9')]);router[_0x0f9f('0x8')](_0x0f9f('0xa'),auth[_0x0f9f('0xb')](),controller[_0x0f9f('0xc')]);router[_0x0f9f('0x8')](_0x0f9f('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0f9f('0xe')]('/',auth['isAuthenticated'](),controller[_0x0f9f('0xf')]);router[_0x0f9f('0x10')](_0x0f9f('0xd'),auth[_0x0f9f('0xb')](),controller[_0x0f9f('0x11')]);router['delete'](_0x0f9f('0xd'),auth['isAuthenticated'](),controller[_0x0f9f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3431=['show','post','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','isAuthenticated','index','get','/describe','/:id'];(function(_0x53800a,_0x13e42c){var _0x45ce8c=function(_0x30d5a7){while(--_0x30d5a7){_0x53800a['push'](_0x53800a['shift']());}};_0x45ce8c(++_0x13e42c);}(_0x3431,0x146));var _0x1343=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0x3431[_0x10dbf6];return _0x452147;};'use strict';var multer=require(_0x1343('0x0'));var util=require(_0x1343('0x1'));var path=require(_0x1343('0x2'));var timeout=require(_0x1343('0x3'));var express=require(_0x1343('0x4'));var router=express['Router']();var auth=require(_0x1343('0x5'));var interaction=require(_0x1343('0x6'));var config=require(_0x1343('0x7'));var controller=require(_0x1343('0x8'));router['get']('/',auth[_0x1343('0x9')](),controller[_0x1343('0xa')]);router[_0x1343('0xb')](_0x1343('0xc'),auth[_0x1343('0x9')](),controller['describe']);router[_0x1343('0xb')](_0x1343('0xd'),auth[_0x1343('0x9')](),controller[_0x1343('0xe')]);router[_0x1343('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1343('0x10')](_0x1343('0xd'),auth[_0x1343('0x9')](),controller[_0x1343('0x11')]);router[_0x1343('0x12')](_0x1343('0xd'),auth[_0x1343('0x9')](),controller['destroy']);module[_0x1343('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index f293c3c..e9ccc0f 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 _0x5edf=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x5edf,0x82));var _0xf5ed=function(_0x25ffbf,_0x5d74c4){_0x25ffbf=_0x25ffbf-0x0;var _0x5acae4=_0x5edf[_0x25ffbf];return _0x5acae4;};'use strict';var Sequelize=require(_0xf5ed('0x0'));module[_0xf5ed('0x1')]={'network':{'type':Sequelize[_0xf5ed('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf5ed('0x2')]},'language':{'type':Sequelize[_0xf5ed('0x2')]},'type':{'type':Sequelize[_0xf5ed('0x2')]},'uniqueid':{'type':Sequelize[_0xf5ed('0x2')]},'version':{'type':Sequelize[_0xf5ed('0x2')]},'callerid':{'type':Sequelize[_0xf5ed('0x2')]},'calleridname':{'type':Sequelize[_0xf5ed('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xf5ed('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xf5ed('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf5ed('0x2')]},'extension':{'type':Sequelize[_0xf5ed('0x2')]},'priority':{'type':Sequelize[_0xf5ed('0x2')]},'enhanced':{'type':Sequelize[_0xf5ed('0x2')]},'accountcode':{'type':Sequelize[_0xf5ed('0x2')]},'threadid':{'type':Sequelize[_0xf5ed('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf5ed('0x3')]},'leaveAt':{'type':Sequelize[_0xf5ed('0x3')]},'bot':{'type':Sequelize[_0xf5ed('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x4f5a=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x3812c9,_0x5ddb50){var _0x3cdd8b=function(_0x14e249){while(--_0x14e249){_0x3812c9['push'](_0x3812c9['shift']());}};_0x3cdd8b(++_0x5ddb50);}(_0x4f5a,0xce));var _0xa4f5=function(_0x1c9ef1,_0x5e064f){_0x1c9ef1=_0x1c9ef1-0x0;var _0x421493=_0x4f5a[_0x1c9ef1];return _0x421493;};'use strict';var Sequelize=require(_0xa4f5('0x0'));module['exports']={'network':{'type':Sequelize[_0xa4f5('0x1')]},'network_script':{'type':Sequelize[_0xa4f5('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa4f5('0x1')]},'language':{'type':Sequelize[_0xa4f5('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xa4f5('0x1')]},'callerid':{'type':Sequelize[_0xa4f5('0x1')]},'calleridname':{'type':Sequelize[_0xa4f5('0x1')]},'callingpres':{'type':Sequelize[_0xa4f5('0x1')]},'callingani2':{'type':Sequelize[_0xa4f5('0x1')]},'callington':{'type':Sequelize[_0xa4f5('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xa4f5('0x1')]},'rdnis':{'type':Sequelize[_0xa4f5('0x1')]},'context':{'type':Sequelize[_0xa4f5('0x1')]},'extension':{'type':Sequelize[_0xa4f5('0x1')]},'priority':{'type':Sequelize[_0xa4f5('0x1')]},'enhanced':{'type':Sequelize[_0xa4f5('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xa4f5('0x1')]},'project_name':{'type':Sequelize[_0xa4f5('0x1')]},'joinAt':{'type':Sequelize[_0xa4f5('0x2')]},'leaveAt':{'type':Sequelize[_0xa4f5('0x2')]},'bot':{'type':Sequelize[_0xa4f5('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 51ab971..afb324f 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 _0x60ed=['intersection','fields','length','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','send','index','map','SquareReport','fieldName','key','model','name','query','keys','filters','attributes'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x60ed,0xe1));var _0xd60e=function(_0x2288d3,_0x35ff24){_0x2288d3=_0x2288d3-0x0;var _0x338eb6=_0x60ed[_0x2288d3];return _0x338eb6;};'use strict';var pdf=require(_0xd60e('0x0'));var emlformat=require(_0xd60e('0x1'));var rimraf=require(_0xd60e('0x2'));var zipdir=require(_0xd60e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd60e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd60e('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd60e('0x6'));var csv=require(_0xd60e('0x7'));var ejs=require(_0xd60e('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd60e('0x9'));var crypto=require('crypto');var jsforce=require(_0xd60e('0xa'));var deskjs=require(_0xd60e('0xb'));var toCsv=require(_0xd60e('0x7'));var querystring=require(_0xd60e('0xc'));var Papa=require(_0xd60e('0xd'));var Redis=require('ioredis');var authService=require(_0xd60e('0xe'));var qs=require(_0xd60e('0xf'));var as=require(_0xd60e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd60e('0x11'));var utils=require('../../config/utils');var config=require(_0xd60e('0x12'));var db=require(_0xd60e('0x13'))['db'];function respondWithStatusCode(_0x2bd5db,_0xc32d5c){_0xc32d5c=_0xc32d5c||0xcc;return function(_0x119351){if(_0x119351){return _0x2bd5db['sendStatus'](_0xc32d5c);}return _0x2bd5db[_0xd60e('0x14')](_0xc32d5c)[_0xd60e('0x15')]();};}function respondWithResult(_0xb4546,_0x5bbfd9){_0x5bbfd9=_0x5bbfd9||0xc8;return function(_0x1d524c){if(_0x1d524c){return _0xb4546[_0xd60e('0x14')](_0x5bbfd9)[_0xd60e('0x16')](_0x1d524c);}};}function respondWithFilteredResult(_0x3821f8,_0x1bf627){return function(_0x275293){if(_0x275293){var _0x223f0e=_0x275293[_0xd60e('0x17')],_0x3debd8=_0x1bf627[_0xd60e('0x18')],_0x430bdb=_0x1bf627[_0xd60e('0x18')]+_0x1bf627['limit'],_0x1e1a45;if(_0x430bdb>=_0x223f0e){_0x430bdb=_0x223f0e;_0x1e1a45=0xc8;}else{_0x1e1a45=0xce;}_0x3821f8[_0xd60e('0x14')](_0x1e1a45);return _0x3821f8[_0xd60e('0x19')](_0xd60e('0x1a'),_0x3debd8+'-'+_0x430bdb+'/'+_0x223f0e)[_0xd60e('0x16')](_0x275293);}return null;};}function patchUpdates(_0x20867b){return function(_0x476828){try{jsonpatch[_0xd60e('0x1b')](_0x476828,_0x20867b,!![]);}catch(_0xaa1735){return BPromise[_0xd60e('0x1c')](_0xaa1735);}return _0x476828['save']();};}function saveUpdates(_0x233cdc,_0x1a1c0e){return function(_0x3cb7dc){if(_0x3cb7dc){return _0x3cb7dc[_0xd60e('0x1d')](_0x233cdc)[_0xd60e('0x1e')](function(_0x5254af){return _0x5254af;});}return null;};}function removeEntity(_0x10c8b5,_0x2487cf){return function(_0x1791ad){if(_0x1791ad){return _0x1791ad[_0xd60e('0x1f')]()['then'](function(){_0x10c8b5[_0xd60e('0x14')](0xcc)[_0xd60e('0x15')]();});}};}function handleEntityNotFound(_0xb27421,_0x4158e3){return function(_0x18a40b){if(!_0x18a40b){_0xb27421[_0xd60e('0x20')](0x194);}return _0x18a40b;};}function handleError(_0x709a00,_0x32e2d2){_0x32e2d2=_0x32e2d2||0x1f4;return function(_0x48c686){logger[_0xd60e('0x21')](_0x48c686[_0xd60e('0x22')]);if(_0x48c686['name']){delete _0x48c686['name'];}_0x709a00[_0xd60e('0x14')](_0x32e2d2)[_0xd60e('0x23')](_0x48c686);};}exports[_0xd60e('0x24')]=function(_0x20e335,_0x5b6720){var _0x2583c8={},_0x4b17f0={},_0xc1a802={'count':0x0,'rows':[]};var _0x1f7915=_[_0xd60e('0x25')](db[_0xd60e('0x26')]['rawAttributes'],function(_0x408a0e){return{'name':_0x408a0e[_0xd60e('0x27')],'type':_0x408a0e['type'][_0xd60e('0x28')]};});_0x4b17f0[_0xd60e('0x29')]=_['map'](_0x1f7915,_0xd60e('0x2a'));_0x4b17f0[_0xd60e('0x2b')]=_[_0xd60e('0x2c')](_0x20e335[_0xd60e('0x2b')]);_0x4b17f0[_0xd60e('0x2d')]=_['intersection'](_0x4b17f0[_0xd60e('0x29')],_0x4b17f0[_0xd60e('0x2b')]);_0x2583c8[_0xd60e('0x2e')]=_[_0xd60e('0x2f')](_0x4b17f0[_0xd60e('0x29')],qs[_0xd60e('0x30')](_0x20e335[_0xd60e('0x2b')][_0xd60e('0x30')]));_0x2583c8['attributes']=_0x2583c8[_0xd60e('0x2e')][_0xd60e('0x31')]?_0x2583c8['attributes']:_0x4b17f0[_0xd60e('0x29')];if(!_0x20e335['query']['hasOwnProperty']('nolimit')){_0x2583c8[_0xd60e('0x32')]=qs[_0xd60e('0x32')](_0x20e335[_0xd60e('0x2b')][_0xd60e('0x32')]);_0x2583c8[_0xd60e('0x18')]=qs[_0xd60e('0x18')](_0x20e335[_0xd60e('0x2b')][_0xd60e('0x18')]);}_0x2583c8[_0xd60e('0x33')]=qs['sort'](_0x20e335[_0xd60e('0x2b')][_0xd60e('0x34')]);_0x2583c8[_0xd60e('0x35')]=qs[_0xd60e('0x2d')](_[_0xd60e('0x36')](_0x20e335[_0xd60e('0x2b')],_0x4b17f0[_0xd60e('0x2d')]),_0x1f7915);if(_0x20e335['query']['filter']){_0x2583c8[_0xd60e('0x35')]=_[_0xd60e('0x37')](_0x2583c8[_0xd60e('0x35')],{'$or':_['map'](_0x1f7915,function(_0x24a5ce){if(_0x24a5ce['type']!==_0xd60e('0x38')){var _0x5ebb25={};_0x5ebb25[_0x24a5ce[_0xd60e('0x2a')]]={'$like':'%'+_0x20e335[_0xd60e('0x2b')][_0xd60e('0x39')]+'%'};return _0x5ebb25;}})});}_0x2583c8=_[_0xd60e('0x37')]({},_0x2583c8,_0x20e335[_0xd60e('0x3a')]);var _0xbe3aa6={'where':_0x2583c8[_0xd60e('0x35')]};return db['SquareReport'][_0xd60e('0x17')](_0xbe3aa6)['then'](function(_0x4f1a1d){_0xc1a802[_0xd60e('0x17')]=_0x4f1a1d;if(_0x20e335[_0xd60e('0x2b')][_0xd60e('0x3b')]){_0x2583c8[_0xd60e('0x3c')]=[{'all':!![]}];}return db[_0xd60e('0x26')]['findAll'](_0x2583c8);})[_0xd60e('0x1e')](function(_0xbbea2e){_0xc1a802['rows']=_0xbbea2e;return _0xc1a802;})['then'](respondWithFilteredResult(_0x5b6720,_0x2583c8))[_0xd60e('0x3d')](handleError(_0x5b6720,null));};exports[_0xd60e('0x3e')]=function(_0x33e0a2,_0x499dd1){var _0x53bea8={'raw':!![],'where':{'id':_0x33e0a2[_0xd60e('0x3f')]['id']}},_0x46c950={};_0x46c950[_0xd60e('0x29')]=_[_0xd60e('0x2c')](db[_0xd60e('0x26')]['rawAttributes']);_0x46c950[_0xd60e('0x2b')]=_['keys'](_0x33e0a2['query']);_0x46c950['filters']=_[_0xd60e('0x2f')](_0x46c950[_0xd60e('0x29')],_0x46c950['query']);_0x53bea8[_0xd60e('0x2e')]=_[_0xd60e('0x2f')](_0x46c950[_0xd60e('0x29')],qs[_0xd60e('0x30')](_0x33e0a2[_0xd60e('0x2b')][_0xd60e('0x30')]));_0x53bea8[_0xd60e('0x2e')]=_0x53bea8['attributes']['length']?_0x53bea8[_0xd60e('0x2e')]:_0x46c950[_0xd60e('0x29')];if(_0x33e0a2[_0xd60e('0x2b')][_0xd60e('0x3b')]){_0x53bea8[_0xd60e('0x3c')]=[{'all':!![]}];}_0x53bea8=_['merge']({},_0x53bea8,_0x33e0a2[_0xd60e('0x3a')]);return db[_0xd60e('0x26')][_0xd60e('0x40')](_0x53bea8)[_0xd60e('0x1e')](handleEntityNotFound(_0x499dd1,null))[_0xd60e('0x1e')](respondWithResult(_0x499dd1,null))[_0xd60e('0x3d')](handleError(_0x499dd1,null));};exports['create']=function(_0xea729c,_0x1096e9){return db[_0xd60e('0x26')][_0xd60e('0x41')](_0xea729c[_0xd60e('0x42')],{})[_0xd60e('0x1e')](respondWithResult(_0x1096e9,0xc9))[_0xd60e('0x3d')](handleError(_0x1096e9,null));};exports[_0xd60e('0x1d')]=function(_0x3986c8,_0x153d2c){if(_0x3986c8['body']['id']){delete _0x3986c8[_0xd60e('0x42')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x3986c8[_0xd60e('0x3f')]['id']}})[_0xd60e('0x1e')](handleEntityNotFound(_0x153d2c,null))[_0xd60e('0x1e')](saveUpdates(_0x3986c8['body'],null))[_0xd60e('0x1e')](respondWithResult(_0x153d2c,null))[_0xd60e('0x3d')](handleError(_0x153d2c,null));};exports['destroy']=function(_0x526d17,_0x2acf80){return db[_0xd60e('0x26')][_0xd60e('0x40')]({'where':{'id':_0x526d17[_0xd60e('0x3f')]['id']}})[_0xd60e('0x1e')](handleEntityNotFound(_0x2acf80,null))['then'](removeEntity(_0x2acf80,null))[_0xd60e('0x3d')](handleError(_0x2acf80,null));};exports[_0xd60e('0x43')]=function(_0xd818f1,_0x4e43ef){return db['SquareReport'][_0xd60e('0x43')]()[_0xd60e('0x1e')](respondWithResult(_0x4e43ef,null))[_0xd60e('0x3d')](handleError(_0x4e43ef,null));}; \ No newline at end of file +var _0x0d08=['limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','SquareReport','count','catch','show','params','keys','length','includeAll','include','options','find','create','update','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset'];(function(_0x165491,_0x5448e5){var _0x231940=function(_0x495ecf){while(--_0x495ecf){_0x165491['push'](_0x165491['shift']());}};_0x231940(++_0x5448e5);}(_0x0d08,0x10c));var _0x80d0=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0d08[_0x59ee6f];return _0x4c0979;};'use strict';var pdf=require(_0x80d0('0x0'));var emlformat=require(_0x80d0('0x1'));var rimraf=require(_0x80d0('0x2'));var zipdir=require(_0x80d0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x80d0('0x4'));var moment=require('moment');var BPromise=require(_0x80d0('0x5'));var Mustache=require(_0x80d0('0x6'));var util=require(_0x80d0('0x7'));var path=require(_0x80d0('0x8'));var sox=require(_0x80d0('0x9'));var csv=require(_0x80d0('0xa'));var ejs=require(_0x80d0('0xb'));var fs=require('fs');var _=require(_0x80d0('0xc'));var squel=require(_0x80d0('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x80d0('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x80d0('0xf'));var Redis=require(_0x80d0('0x10'));var authService=require(_0x80d0('0x11'));var qs=require(_0x80d0('0x12'));var as=require(_0x80d0('0x13'));var hardwareService=require(_0x80d0('0x14'));var logger=require(_0x80d0('0x15'))(_0x80d0('0x16'));var utils=require(_0x80d0('0x17'));var config=require('../../config/environment');var db=require(_0x80d0('0x18'))['db'];function respondWithStatusCode(_0x34c339,_0x3d5633){_0x3d5633=_0x3d5633||0xcc;return function(_0x3ed3b9){if(_0x3ed3b9){return _0x34c339['sendStatus'](_0x3d5633);}return _0x34c339[_0x80d0('0x19')](_0x3d5633)['end']();};}function respondWithResult(_0x724855,_0x1c845f){_0x1c845f=_0x1c845f||0xc8;return function(_0x5b7d04){if(_0x5b7d04){return _0x724855['status'](_0x1c845f)[_0x80d0('0x1a')](_0x5b7d04);}};}function respondWithFilteredResult(_0x4164d9,_0x2024ab){return function(_0x5ccc2a){if(_0x5ccc2a){var _0x49a24a=_0x5ccc2a['count'],_0x3d5574=_0x2024ab[_0x80d0('0x1b')],_0x17c108=_0x2024ab[_0x80d0('0x1b')]+_0x2024ab[_0x80d0('0x1c')],_0x5e9b3f;if(_0x17c108>=_0x49a24a){_0x17c108=_0x49a24a;_0x5e9b3f=0xc8;}else{_0x5e9b3f=0xce;}_0x4164d9[_0x80d0('0x19')](_0x5e9b3f);return _0x4164d9[_0x80d0('0x1d')](_0x80d0('0x1e'),_0x3d5574+'-'+_0x17c108+'/'+_0x49a24a)[_0x80d0('0x1a')](_0x5ccc2a);}return null;};}function patchUpdates(_0x981cb7){return function(_0x51761f){try{jsonpatch[_0x80d0('0x1f')](_0x51761f,_0x981cb7,!![]);}catch(_0x599956){return BPromise[_0x80d0('0x20')](_0x599956);}return _0x51761f[_0x80d0('0x21')]();};}function saveUpdates(_0x4b5771,_0x12cc7c){return function(_0x43cf9c){if(_0x43cf9c){return _0x43cf9c['update'](_0x4b5771)[_0x80d0('0x22')](function(_0x7ba117){return _0x7ba117;});}return null;};}function removeEntity(_0x2eb6e2,_0x26c8ce){return function(_0x3bfd13){if(_0x3bfd13){return _0x3bfd13[_0x80d0('0x23')]()['then'](function(){_0x2eb6e2['status'](0xcc)[_0x80d0('0x24')]();});}};}function handleEntityNotFound(_0x623ac5,_0x2b2548){return function(_0x5ad602){if(!_0x5ad602){_0x623ac5['sendStatus'](0x194);}return _0x5ad602;};}function handleError(_0x35ad31,_0x271926){_0x271926=_0x271926||0x1f4;return function(_0x1e6932){logger[_0x80d0('0x25')](_0x1e6932[_0x80d0('0x26')]);if(_0x1e6932[_0x80d0('0x27')]){delete _0x1e6932['name'];}_0x35ad31[_0x80d0('0x19')](_0x271926)[_0x80d0('0x28')](_0x1e6932);};}exports['index']=function(_0x571ec4,_0x11e9be){var _0x38f411={},_0x28aab9={},_0x5ab45d={'count':0x0,'rows':[]};var _0x1a1136=_[_0x80d0('0x29')](db['SquareReport'][_0x80d0('0x2a')],function(_0x2b8875){return{'name':_0x2b8875[_0x80d0('0x2b')],'type':_0x2b8875[_0x80d0('0x2c')][_0x80d0('0x2d')]};});_0x28aab9[_0x80d0('0x2e')]=_[_0x80d0('0x29')](_0x1a1136,'name');_0x28aab9[_0x80d0('0x2f')]=_['keys'](_0x571ec4[_0x80d0('0x2f')]);_0x28aab9[_0x80d0('0x30')]=_[_0x80d0('0x31')](_0x28aab9['model'],_0x28aab9[_0x80d0('0x2f')]);_0x38f411['attributes']=_[_0x80d0('0x31')](_0x28aab9[_0x80d0('0x2e')],qs['fields'](_0x571ec4[_0x80d0('0x2f')][_0x80d0('0x32')]));_0x38f411[_0x80d0('0x33')]=_0x38f411[_0x80d0('0x33')]['length']?_0x38f411['attributes']:_0x28aab9[_0x80d0('0x2e')];if(!_0x571ec4[_0x80d0('0x2f')][_0x80d0('0x34')](_0x80d0('0x35'))){_0x38f411[_0x80d0('0x1c')]=qs[_0x80d0('0x1c')](_0x571ec4[_0x80d0('0x2f')][_0x80d0('0x1c')]);_0x38f411[_0x80d0('0x1b')]=qs[_0x80d0('0x1b')](_0x571ec4[_0x80d0('0x2f')][_0x80d0('0x1b')]);}_0x38f411[_0x80d0('0x36')]=qs[_0x80d0('0x37')](_0x571ec4[_0x80d0('0x2f')][_0x80d0('0x37')]);_0x38f411[_0x80d0('0x38')]=qs[_0x80d0('0x30')](_['pick'](_0x571ec4[_0x80d0('0x2f')],_0x28aab9[_0x80d0('0x30')]),_0x1a1136);if(_0x571ec4['query'][_0x80d0('0x39')]){_0x38f411[_0x80d0('0x38')]=_[_0x80d0('0x3a')](_0x38f411[_0x80d0('0x38')],{'$or':_['map'](_0x1a1136,function(_0x1d9744){if(_0x1d9744[_0x80d0('0x2c')]!==_0x80d0('0x3b')){var _0x17de57={};_0x17de57[_0x1d9744[_0x80d0('0x27')]]={'$like':'%'+_0x571ec4[_0x80d0('0x2f')][_0x80d0('0x39')]+'%'};return _0x17de57;}})});}_0x38f411=_[_0x80d0('0x3a')]({},_0x38f411,_0x571ec4['options']);var _0x20533f={'where':_0x38f411[_0x80d0('0x38')]};return db[_0x80d0('0x3c')][_0x80d0('0x3d')](_0x20533f)[_0x80d0('0x22')](function(_0x55920d){_0x5ab45d[_0x80d0('0x3d')]=_0x55920d;if(_0x571ec4[_0x80d0('0x2f')]['includeAll']){_0x38f411['include']=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x38f411);})[_0x80d0('0x22')](function(_0x2880d4){_0x5ab45d['rows']=_0x2880d4;return _0x5ab45d;})[_0x80d0('0x22')](respondWithFilteredResult(_0x11e9be,_0x38f411))[_0x80d0('0x3e')](handleError(_0x11e9be,null));};exports[_0x80d0('0x3f')]=function(_0x2deca1,_0x581b06){var _0x1e457c={'raw':!![],'where':{'id':_0x2deca1[_0x80d0('0x40')]['id']}},_0x3e3039={};_0x3e3039['model']=_[_0x80d0('0x41')](db[_0x80d0('0x3c')][_0x80d0('0x2a')]);_0x3e3039['query']=_['keys'](_0x2deca1[_0x80d0('0x2f')]);_0x3e3039['filters']=_['intersection'](_0x3e3039['model'],_0x3e3039[_0x80d0('0x2f')]);_0x1e457c[_0x80d0('0x33')]=_[_0x80d0('0x31')](_0x3e3039[_0x80d0('0x2e')],qs[_0x80d0('0x32')](_0x2deca1[_0x80d0('0x2f')][_0x80d0('0x32')]));_0x1e457c[_0x80d0('0x33')]=_0x1e457c[_0x80d0('0x33')][_0x80d0('0x42')]?_0x1e457c[_0x80d0('0x33')]:_0x3e3039['model'];if(_0x2deca1['query'][_0x80d0('0x43')]){_0x1e457c[_0x80d0('0x44')]=[{'all':!![]}];}_0x1e457c=_[_0x80d0('0x3a')]({},_0x1e457c,_0x2deca1[_0x80d0('0x45')]);return db[_0x80d0('0x3c')][_0x80d0('0x46')](_0x1e457c)[_0x80d0('0x22')](handleEntityNotFound(_0x581b06,null))['then'](respondWithResult(_0x581b06,null))['catch'](handleError(_0x581b06,null));};exports[_0x80d0('0x47')]=function(_0x240b4b,_0x5b3c9d){return db['SquareReport'][_0x80d0('0x47')](_0x240b4b['body'],{})['then'](respondWithResult(_0x5b3c9d,0xc9))[_0x80d0('0x3e')](handleError(_0x5b3c9d,null));};exports[_0x80d0('0x48')]=function(_0x2e550a,_0x52c89e){if(_0x2e550a[_0x80d0('0x49')]['id']){delete _0x2e550a[_0x80d0('0x49')]['id'];}return db[_0x80d0('0x3c')][_0x80d0('0x46')]({'where':{'id':_0x2e550a[_0x80d0('0x40')]['id']}})['then'](handleEntityNotFound(_0x52c89e,null))[_0x80d0('0x22')](saveUpdates(_0x2e550a[_0x80d0('0x49')],null))['then'](respondWithResult(_0x52c89e,null))[_0x80d0('0x3e')](handleError(_0x52c89e,null));};exports[_0x80d0('0x23')]=function(_0x14b311,_0x2ecce5){return db['SquareReport']['find']({'where':{'id':_0x14b311[_0x80d0('0x40')]['id']}})[_0x80d0('0x22')](handleEntityNotFound(_0x2ecce5,null))[_0x80d0('0x22')](removeEntity(_0x2ecce5,null))[_0x80d0('0x3e')](handleError(_0x2ecce5,null));};exports['describe']=function(_0x10b5d3,_0x41d114){return db[_0x80d0('0x3c')]['describe']()[_0x80d0('0x22')](respondWithResult(_0x41d114,null))[_0x80d0('0x3e')](handleError(_0x41d114,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 9cfb7ed..36dad3a 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 _0xf9a0=['define','report_square','uid_pname','uniqueid','project_name','leaveAt','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./squareReport.attributes','exports'];(function(_0x137aea,_0x111983){var _0x21957f=function(_0x1a51a6){while(--_0x1a51a6){_0x137aea['push'](_0x137aea['shift']());}};_0x21957f(++_0x111983);}(_0xf9a0,0x92));var _0x0f9a=function(_0x203d64,_0x1ec79c){_0x203d64=_0x203d64-0x0;var _0x462ab3=_0xf9a0[_0x203d64];return _0x462ab3;};'use strict';var _=require('lodash');var util=require(_0x0f9a('0x0'));var logger=require(_0x0f9a('0x1'))('api');var moment=require(_0x0f9a('0x2'));var BPromise=require(_0x0f9a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0f9a('0x4'));var config=require(_0x0f9a('0x5'));var attributes=require(_0x0f9a('0x6'));module[_0x0f9a('0x7')]=function(_0x5682f0,_0x25c05f){return _0x5682f0[_0x0f9a('0x8')]('SquareReport',attributes,{'tableName':_0x0f9a('0x9'),'paranoid':![],'indexes':[{'name':_0x0f9a('0xa'),'fields':[_0x0f9a('0xb'),_0x0f9a('0xc')]},{'name':_0x0f9a('0xd'),'fields':[_0x0f9a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xced5=['./squareReport.attributes','exports','define','SquareReport','report_square','leaveAt','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x45d80c,_0x35c0ff){var _0x449a98=function(_0x1b5ab7){while(--_0x1b5ab7){_0x45d80c['push'](_0x45d80c['shift']());}};_0x449a98(++_0x35c0ff);}(_0xced5,0x114));var _0x5ced=function(_0x497de5,_0x4fd0ca){_0x497de5=_0x497de5-0x0;var _0x19e238=_0xced5[_0x497de5];return _0x19e238;};'use strict';var _=require(_0x5ced('0x0'));var util=require(_0x5ced('0x1'));var logger=require(_0x5ced('0x2'))(_0x5ced('0x3'));var moment=require(_0x5ced('0x4'));var BPromise=require('bluebird');var rp=require(_0x5ced('0x5'));var fs=require('fs');var path=require(_0x5ced('0x6'));var rimraf=require(_0x5ced('0x7'));var config=require(_0x5ced('0x8'));var attributes=require(_0x5ced('0x9'));module[_0x5ced('0xa')]=function(_0x1c5e45,_0x56e7a2){return _0x1c5e45[_0x5ced('0xb')](_0x5ced('0xc'),attributes,{'tableName':_0x5ced('0xd'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid','project_name']},{'name':'leaveAt','fields':[_0x5ced('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 76aff4c..bad01b1 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 _0x4efe=['limit','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','debug','request\x20sent','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','update','where'];(function(_0x2fabd6,_0xcae0ea){var _0x3b5195=function(_0x8e56c1){while(--_0x8e56c1){_0x2fabd6['push'](_0x2fabd6['shift']());}};_0x3b5195(++_0xcae0ea);}(_0x4efe,0x112));var _0xe4ef=function(_0x5c883f,_0x38f092){_0x5c883f=_0x5c883f-0x0;var _0x4210cc=_0x4efe[_0x5c883f];return _0x4210cc;};'use strict';var _=require(_0xe4ef('0x0'));var util=require(_0xe4ef('0x1'));var moment=require(_0xe4ef('0x2'));var BPromise=require(_0xe4ef('0x3'));var rs=require(_0xe4ef('0x4'));var fs=require('fs');var Redis=require(_0xe4ef('0x5'));var db=require(_0xe4ef('0x6'))['db'];var utils=require(_0xe4ef('0x7'));var logger=require(_0xe4ef('0x8'))('rpc');var config=require(_0xe4ef('0x9'));var jayson=require(_0xe4ef('0xa'));var client=jayson['client'][_0xe4ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a90fc,_0x4c367c,_0x58f866){return new BPromise(function(_0x23770a,_0x6c3ebd){return client[_0xe4ef('0xc')](_0x4a90fc,_0x58f866)[_0xe4ef('0xd')](function(_0x238e9c){logger[_0xe4ef('0xe')]('SquareReport,\x20%s,\x20%s',_0x4c367c,'request\x20sent');logger[_0xe4ef('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x4c367c,_0xe4ef('0x10'),JSON[_0xe4ef('0x11')](_0x238e9c));if(_0x238e9c['error']){if(_0x238e9c[_0xe4ef('0x12')][_0xe4ef('0x13')]===0x1f4){logger['error'](_0xe4ef('0x14'),_0x4c367c,_0x238e9c[_0xe4ef('0x12')]['message']);return _0x6c3ebd(_0x238e9c[_0xe4ef('0x12')]['message']);}logger[_0xe4ef('0x12')](_0xe4ef('0x14'),_0x4c367c,_0x238e9c[_0xe4ef('0x12')]['message']);return _0x23770a(_0x238e9c[_0xe4ef('0x12')][_0xe4ef('0x15')]);}else{logger[_0xe4ef('0xe')](_0xe4ef('0x14'),_0x4c367c,'request\x20sent');_0x23770a(_0x238e9c[_0xe4ef('0x16')][_0xe4ef('0x15')]);}})[_0xe4ef('0x17')](function(_0x7cf90c){logger[_0xe4ef('0x12')](_0xe4ef('0x14'),_0x4c367c,_0x7cf90c);_0x6c3ebd(_0x7cf90c);});});}exports[_0xe4ef('0x18')]=function(_0x2eab4c){var _0xe155ad=this;return new Promise(function(_0x3f5292,_0x9f583a){return db[_0xe4ef('0x19')][_0xe4ef('0x1a')](_0x2eab4c[_0xe4ef('0x1b')],{'raw':_0x2eab4c[_0xe4ef('0x1c')]?_0x2eab4c[_0xe4ef('0x1c')][_0xe4ef('0x1d')]===undefined?!![]:![]:!![]})[_0xe4ef('0xd')](function(_0x2f5cf9){logger['info'](_0xe4ef('0x18'),_0x2eab4c);logger[_0xe4ef('0xf')]('CreateSquareReport',_0x2eab4c,JSON[_0xe4ef('0x11')](_0x2f5cf9));_0x3f5292(_0x2f5cf9);})['catch'](function(_0x1aae16){logger[_0xe4ef('0x12')](_0xe4ef('0x18'),_0x1aae16['message'],_0x2eab4c);_0x9f583a(_0xe155ad[_0xe4ef('0x12')](0x1f4,_0x1aae16[_0xe4ef('0x15')]));});});};exports['UpdateSquareReport']=function(_0x1c9503){var _0x2cc345=this;return new Promise(function(_0x528fae,_0x3534d4){return db['SquareReport'][_0xe4ef('0x1e')](_0x1c9503[_0xe4ef('0x1b')],{'raw':_0x1c9503[_0xe4ef('0x1c')]?_0x1c9503[_0xe4ef('0x1c')][_0xe4ef('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c9503[_0xe4ef('0x1c')]?_0x1c9503[_0xe4ef('0x1c')][_0xe4ef('0x1f')]||null:null,'attributes':_0x1c9503[_0xe4ef('0x1c')]?_0x1c9503[_0xe4ef('0x1c')]['attributes']||null:null,'limit':_0x1c9503[_0xe4ef('0x1c')]?_0x1c9503[_0xe4ef('0x1c')][_0xe4ef('0x20')]||null:null})[_0xe4ef('0xd')](function(_0x2f2c3d){logger['info'](_0xe4ef('0x21'),_0x1c9503);logger[_0xe4ef('0xf')](_0xe4ef('0x21'),_0x1c9503,JSON['stringify'](_0x2f2c3d));_0x528fae(_0x2f2c3d);})[_0xe4ef('0x17')](function(_0x518799){logger[_0xe4ef('0x12')](_0xe4ef('0x21'),_0x518799[_0xe4ef('0x15')],_0x1c9503);_0x3534d4(_0x2cc345[_0xe4ef('0x12')](0x1f4,_0x518799[_0xe4ef('0x15')]));});});}; \ No newline at end of file +var _0xb1c5=['where','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SquareReport','create','options','CreateSquareReport','UpdateSquareReport','raw'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xb1c5,0x182));var _0x5b1c=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xb1c5[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require('lodash');var util=require(_0x5b1c('0x0'));var moment=require('moment');var BPromise=require(_0x5b1c('0x1'));var rs=require(_0x5b1c('0x2'));var fs=require('fs');var Redis=require(_0x5b1c('0x3'));var db=require(_0x5b1c('0x4'))['db'];var utils=require(_0x5b1c('0x5'));var logger=require(_0x5b1c('0x6'))(_0x5b1c('0x7'));var config=require(_0x5b1c('0x8'));var jayson=require(_0x5b1c('0x9'));var client=jayson[_0x5b1c('0xa')][_0x5b1c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33b28f,_0x285398,_0x52beab){return new BPromise(function(_0x55a896,_0x34808b){return client[_0x5b1c('0xc')](_0x33b28f,_0x52beab)[_0x5b1c('0xd')](function(_0x35e8dd){logger[_0x5b1c('0xe')](_0x5b1c('0xf'),_0x285398,_0x5b1c('0x10'));logger[_0x5b1c('0x11')](_0x5b1c('0x12'),_0x285398,_0x5b1c('0x10'),JSON[_0x5b1c('0x13')](_0x35e8dd));if(_0x35e8dd['error']){if(_0x35e8dd[_0x5b1c('0x14')][_0x5b1c('0x15')]===0x1f4){logger[_0x5b1c('0x14')](_0x5b1c('0xf'),_0x285398,_0x35e8dd[_0x5b1c('0x14')][_0x5b1c('0x16')]);return _0x34808b(_0x35e8dd[_0x5b1c('0x14')][_0x5b1c('0x16')]);}logger['error'](_0x5b1c('0xf'),_0x285398,_0x35e8dd[_0x5b1c('0x14')][_0x5b1c('0x16')]);return _0x55a896(_0x35e8dd[_0x5b1c('0x14')]['message']);}else{logger['info'](_0x5b1c('0xf'),_0x285398,_0x5b1c('0x10'));_0x55a896(_0x35e8dd['result'][_0x5b1c('0x16')]);}})[_0x5b1c('0x17')](function(_0x2d2a0c){logger[_0x5b1c('0x14')](_0x5b1c('0xf'),_0x285398,_0x2d2a0c);_0x34808b(_0x2d2a0c);});});}exports['CreateSquareReport']=function(_0x55f117){var _0x328be5=this;return new Promise(function(_0x4573fa,_0x172598){return db[_0x5b1c('0x18')][_0x5b1c('0x19')](_0x55f117['body'],{'raw':_0x55f117[_0x5b1c('0x1a')]?_0x55f117[_0x5b1c('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2dacc8){logger[_0x5b1c('0xe')](_0x5b1c('0x1b'),_0x55f117);logger[_0x5b1c('0x11')](_0x5b1c('0x1b'),_0x55f117,JSON[_0x5b1c('0x13')](_0x2dacc8));_0x4573fa(_0x2dacc8);})['catch'](function(_0x3e8e30){logger[_0x5b1c('0x14')](_0x5b1c('0x1b'),_0x3e8e30[_0x5b1c('0x16')],_0x55f117);_0x172598(_0x328be5[_0x5b1c('0x14')](0x1f4,_0x3e8e30[_0x5b1c('0x16')]));});});};exports[_0x5b1c('0x1c')]=function(_0x33cb0f){var _0x5f396d=this;return new Promise(function(_0xb0e04c,_0x2e7a48){return db[_0x5b1c('0x18')]['update'](_0x33cb0f['body'],{'raw':_0x33cb0f[_0x5b1c('0x1a')]?_0x33cb0f[_0x5b1c('0x1a')][_0x5b1c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33cb0f['options']?_0x33cb0f['options'][_0x5b1c('0x1e')]||null:null,'attributes':_0x33cb0f[_0x5b1c('0x1a')]?_0x33cb0f[_0x5b1c('0x1a')]['attributes']||null:null,'limit':_0x33cb0f['options']?_0x33cb0f[_0x5b1c('0x1a')][_0x5b1c('0x1f')]||null:null})['then'](function(_0x29c0ad){logger[_0x5b1c('0xe')](_0x5b1c('0x1c'),_0x33cb0f);logger[_0x5b1c('0x11')]('UpdateSquareReport',_0x33cb0f,JSON[_0x5b1c('0x13')](_0x29c0ad));_0xb0e04c(_0x29c0ad);})[_0x5b1c('0x17')](function(_0x4fb1bc){logger[_0x5b1c('0x14')](_0x5b1c('0x1c'),_0x4fb1bc[_0x5b1c('0x16')],_0x33cb0f);_0x2e7a48(_0x5f396d[_0x5b1c('0x14')](0x1f4,_0x4fb1bc[_0x5b1c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 0d46dcd..7118849 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 _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x4b7faa,_0x588fb){var _0x36d956=function(_0x3e1172){while(--_0x3e1172){_0x4b7faa['push'](_0x4b7faa['shift']());}};_0x36d956(++_0x588fb);}(_0x7a54,0x106));var _0x47a5=function(_0x163d12,_0x44f68b){_0x163d12=_0x163d12-0x0;var _0x4e689c=_0x7a54[_0x163d12];return _0x4e689c;};'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 auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x3d5b2f,_0x308cc3){var _0xb4584a=function(_0x120a7c){while(--_0x120a7c){_0x3d5b2f['push'](_0x3d5b2f['shift']());}};_0xb4584a(++_0x308cc3);}(_0x7a54,0x106));var _0x47a5=function(_0x85637b,_0x54f8ca){_0x85637b=_0x85637b-0x0;var _0x16f213=_0x7a54[_0x85637b];return _0x16f213;};'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 auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index af23ef6..ee8fb43 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 _0xf57a=['exports','STRING','TEXT'];(function(_0x5bcf80,_0x489416){var _0x144f68=function(_0x132a04){while(--_0x132a04){_0x5bcf80['push'](_0x5bcf80['shift']());}};_0x144f68(++_0x489416);}(_0xf57a,0x9c));var _0xaf57=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xf57a[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require('sequelize');module[_0xaf57('0x0')]={'uniqueid':{'type':Sequelize[_0xaf57('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xaf57('0x1')]},'data':{'type':Sequelize[_0xaf57('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xaf57('0x1')]}}; \ No newline at end of file +var _0x2f05=['STRING','TEXT','sequelize'];(function(_0x482bfa,_0x17d203){var _0x50ad97=function(_0x5e42b8){while(--_0x5e42b8){_0x482bfa['push'](_0x482bfa['shift']());}};_0x50ad97(++_0x17d203);}(_0x2f05,0x119));var _0x52f0=function(_0x186f10,_0x3a6b2d){_0x186f10=_0x186f10-0x0;var _0x13a0c1=_0x2f05[_0x186f10];return _0x13a0c1;};'use strict';var Sequelize=require(_0x52f0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x52f0('0x1')]},'node':{'type':Sequelize[_0x52f0('0x1')]},'application':{'type':Sequelize[_0x52f0('0x1')]},'data':{'type':Sequelize[_0x52f0('0x2')]},'project_name':{'type':Sequelize[_0x52f0('0x1')]},'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 9d6d5fc..149bc22 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 _0xc22a=['querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','update','then','destroy','error','name','send','index','map','SquareDetailsReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','show','params','keys','includeAll','include','options','catch','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x3c7c60,_0x465011){var _0x5111fa=function(_0x48d90a){while(--_0x48d90a){_0x3c7c60['push'](_0x3c7c60['shift']());}};_0x5111fa(++_0x465011);}(_0xc22a,0x160));var _0xac22=function(_0x5d55de,_0x4f781f){_0x5d55de=_0x5d55de-0x0;var _0x24138e=_0xc22a[_0x5d55de];return _0x24138e;};'use strict';var pdf=require(_0xac22('0x0'));var emlformat=require(_0xac22('0x1'));var rimraf=require(_0xac22('0x2'));var zipdir=require(_0xac22('0x3'));var jsonpatch=require(_0xac22('0x4'));var rp=require(_0xac22('0x5'));var moment=require(_0xac22('0x6'));var BPromise=require(_0xac22('0x7'));var Mustache=require(_0xac22('0x8'));var util=require(_0xac22('0x9'));var path=require(_0xac22('0xa'));var sox=require(_0xac22('0xb'));var csv=require(_0xac22('0xc'));var ejs=require(_0xac22('0xd'));var fs=require('fs');var _=require(_0xac22('0xe'));var squel=require('squel');var crypto=require(_0xac22('0xf'));var jsforce=require(_0xac22('0x10'));var deskjs=require(_0xac22('0x11'));var toCsv=require(_0xac22('0xc'));var querystring=require(_0xac22('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xac22('0x13'));var qs=require(_0xac22('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xac22('0x15'));var utils=require('../../config/utils');var config=require(_0xac22('0x16'));var db=require(_0xac22('0x17'))['db'];function respondWithStatusCode(_0x1d074a,_0x10ce93){_0x10ce93=_0x10ce93||0xcc;return function(_0x4f446e){if(_0x4f446e){return _0x1d074a[_0xac22('0x18')](_0x10ce93);}return _0x1d074a[_0xac22('0x19')](_0x10ce93)[_0xac22('0x1a')]();};}function respondWithResult(_0x507e12,_0x4f3e1b){_0x4f3e1b=_0x4f3e1b||0xc8;return function(_0x328a5a){if(_0x328a5a){return _0x507e12[_0xac22('0x19')](_0x4f3e1b)['json'](_0x328a5a);}};}function respondWithFilteredResult(_0x29c8c8,_0x45acb7){return function(_0x9229eb){if(_0x9229eb){var _0x2343df=_0x9229eb[_0xac22('0x1b')],_0x33d3c6=_0x45acb7['offset'],_0xa28936=_0x45acb7[_0xac22('0x1c')]+_0x45acb7[_0xac22('0x1d')],_0x318d4b;if(_0xa28936>=_0x2343df){_0xa28936=_0x2343df;_0x318d4b=0xc8;}else{_0x318d4b=0xce;}_0x29c8c8['status'](_0x318d4b);return _0x29c8c8[_0xac22('0x1e')]('Content-Range',_0x33d3c6+'-'+_0xa28936+'/'+_0x2343df)[_0xac22('0x1f')](_0x9229eb);}return null;};}function patchUpdates(_0x41c867){return function(_0x21ab00){try{jsonpatch['apply'](_0x21ab00,_0x41c867,!![]);}catch(_0xe212f4){return BPromise[_0xac22('0x20')](_0xe212f4);}return _0x21ab00[_0xac22('0x21')]();};}function saveUpdates(_0x1ffd0e,_0x5b3422){return function(_0x1a0caa){if(_0x1a0caa){return _0x1a0caa[_0xac22('0x22')](_0x1ffd0e)[_0xac22('0x23')](function(_0x290b06){return _0x290b06;});}return null;};}function removeEntity(_0x450ea3,_0x58d09f){return function(_0x255414){if(_0x255414){return _0x255414[_0xac22('0x24')]()[_0xac22('0x23')](function(){_0x450ea3[_0xac22('0x19')](0xcc)[_0xac22('0x1a')]();});}};}function handleEntityNotFound(_0x163285,_0x2dc4bf){return function(_0x124ea3){if(!_0x124ea3){_0x163285[_0xac22('0x18')](0x194);}return _0x124ea3;};}function handleError(_0x282d0e,_0xf25f4d){_0xf25f4d=_0xf25f4d||0x1f4;return function(_0x14dbb6){logger[_0xac22('0x25')](_0x14dbb6['stack']);if(_0x14dbb6[_0xac22('0x26')]){delete _0x14dbb6[_0xac22('0x26')];}_0x282d0e[_0xac22('0x19')](_0xf25f4d)[_0xac22('0x27')](_0x14dbb6);};}exports[_0xac22('0x28')]=function(_0x13dc3a,_0x596215){var _0x1c23a0={},_0x1c9628={},_0x3d2216={'count':0x0,'rows':[]};var _0x9e3ee1=_[_0xac22('0x29')](db[_0xac22('0x2a')]['rawAttributes'],function(_0x2061c5){return{'name':_0x2061c5[_0xac22('0x2b')],'type':_0x2061c5[_0xac22('0x2c')][_0xac22('0x2d')]};});_0x1c9628[_0xac22('0x2e')]=_[_0xac22('0x29')](_0x9e3ee1,_0xac22('0x26'));_0x1c9628[_0xac22('0x2f')]=_['keys'](_0x13dc3a[_0xac22('0x2f')]);_0x1c9628[_0xac22('0x30')]=_['intersection'](_0x1c9628[_0xac22('0x2e')],_0x1c9628[_0xac22('0x2f')]);_0x1c23a0['attributes']=_[_0xac22('0x31')](_0x1c9628[_0xac22('0x2e')],qs[_0xac22('0x32')](_0x13dc3a[_0xac22('0x2f')][_0xac22('0x32')]));_0x1c23a0[_0xac22('0x33')]=_0x1c23a0[_0xac22('0x33')]['length']?_0x1c23a0[_0xac22('0x33')]:_0x1c9628['model'];if(!_0x13dc3a[_0xac22('0x2f')][_0xac22('0x34')](_0xac22('0x35'))){_0x1c23a0['limit']=qs[_0xac22('0x1d')](_0x13dc3a['query'][_0xac22('0x1d')]);_0x1c23a0[_0xac22('0x1c')]=qs[_0xac22('0x1c')](_0x13dc3a[_0xac22('0x2f')][_0xac22('0x1c')]);}_0x1c23a0[_0xac22('0x36')]=qs[_0xac22('0x37')](_0x13dc3a[_0xac22('0x2f')][_0xac22('0x37')]);_0x1c23a0[_0xac22('0x38')]=qs[_0xac22('0x30')](_[_0xac22('0x39')](_0x13dc3a[_0xac22('0x2f')],_0x1c9628[_0xac22('0x30')]),_0x9e3ee1);if(_0x13dc3a['query'][_0xac22('0x3a')]){_0x1c23a0[_0xac22('0x38')]=_[_0xac22('0x3b')](_0x1c23a0[_0xac22('0x38')],{'$or':_['map'](_0x9e3ee1,function(_0xf67810){if(_0xf67810[_0xac22('0x2c')]!==_0xac22('0x3c')){var _0x2f315b={};_0x2f315b[_0xf67810[_0xac22('0x26')]]={'$like':'%'+_0x13dc3a['query'][_0xac22('0x3a')]+'%'};return _0x2f315b;}})});}_0x1c23a0=_[_0xac22('0x3b')]({},_0x1c23a0,_0x13dc3a['options']);var _0x48b556={'where':_0x1c23a0['where']};return db[_0xac22('0x2a')][_0xac22('0x1b')](_0x48b556)[_0xac22('0x23')](function(_0x3ddf96){_0x3d2216[_0xac22('0x1b')]=_0x3ddf96;if(_0x13dc3a[_0xac22('0x2f')]['includeAll']){_0x1c23a0['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0xac22('0x3d')](_0x1c23a0);})[_0xac22('0x23')](function(_0x4f61cf){_0x3d2216[_0xac22('0x3e')]=_0x4f61cf;return _0x3d2216;})[_0xac22('0x23')](respondWithFilteredResult(_0x596215,_0x1c23a0))['catch'](handleError(_0x596215,null));};exports[_0xac22('0x3f')]=function(_0x469245,_0x203289){var _0x1352dc={'raw':!![],'where':{'id':_0x469245[_0xac22('0x40')]['id']}},_0x1b0da7={};_0x1b0da7[_0xac22('0x2e')]=_[_0xac22('0x41')](db[_0xac22('0x2a')]['rawAttributes']);_0x1b0da7[_0xac22('0x2f')]=_['keys'](_0x469245[_0xac22('0x2f')]);_0x1b0da7[_0xac22('0x30')]=_[_0xac22('0x31')](_0x1b0da7[_0xac22('0x2e')],_0x1b0da7['query']);_0x1352dc[_0xac22('0x33')]=_[_0xac22('0x31')](_0x1b0da7['model'],qs[_0xac22('0x32')](_0x469245[_0xac22('0x2f')][_0xac22('0x32')]));_0x1352dc['attributes']=_0x1352dc[_0xac22('0x33')]['length']?_0x1352dc[_0xac22('0x33')]:_0x1b0da7[_0xac22('0x2e')];if(_0x469245[_0xac22('0x2f')][_0xac22('0x42')]){_0x1352dc[_0xac22('0x43')]=[{'all':!![]}];}_0x1352dc=_[_0xac22('0x3b')]({},_0x1352dc,_0x469245[_0xac22('0x44')]);return db['SquareDetailsReport']['find'](_0x1352dc)['then'](handleEntityNotFound(_0x203289,null))['then'](respondWithResult(_0x203289,null))[_0xac22('0x45')](handleError(_0x203289,null));};exports[_0xac22('0x46')]=function(_0x4aa7d7,_0x448051){return db[_0xac22('0x2a')]['create'](_0x4aa7d7['body'],{})[_0xac22('0x23')](respondWithResult(_0x448051,0xc9))[_0xac22('0x45')](handleError(_0x448051,null));};exports[_0xac22('0x22')]=function(_0xd35ff9,_0x1fe5c8){if(_0xd35ff9[_0xac22('0x47')]['id']){delete _0xd35ff9[_0xac22('0x47')]['id'];}return db[_0xac22('0x2a')][_0xac22('0x48')]({'where':{'id':_0xd35ff9['params']['id']}})[_0xac22('0x23')](handleEntityNotFound(_0x1fe5c8,null))[_0xac22('0x23')](saveUpdates(_0xd35ff9[_0xac22('0x47')],null))[_0xac22('0x23')](respondWithResult(_0x1fe5c8,null))[_0xac22('0x45')](handleError(_0x1fe5c8,null));};exports['destroy']=function(_0x43d75a,_0xffd734){return db['SquareDetailsReport'][_0xac22('0x48')]({'where':{'id':_0x43d75a[_0xac22('0x40')]['id']}})['then'](handleEntityNotFound(_0xffd734,null))[_0xac22('0x23')](removeEntity(_0xffd734,null))['catch'](handleError(_0xffd734,null));};exports[_0xac22('0x49')]=function(_0x51d50b,_0x31d0e6){return db[_0xac22('0x2a')][_0xac22('0x49')]()['then'](respondWithResult(_0x31d0e6,null))[_0xac22('0x45')](handleError(_0x31d0e6,null));}; \ No newline at end of file +var _0x7d50=['filters','pick','where','VIRTUAL','filter','options','includeAll','show','fields','include','merge','create','body','catch','find','params','destroy','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','then','end','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x5ee370,_0x5f2e76){var _0x3c003e=function(_0x428441){while(--_0x428441){_0x5ee370['push'](_0x5ee370['shift']());}};_0x3c003e(++_0x5f2e76);}(_0x7d50,0x17a));var _0x07d5=function(_0x5ba134,_0x1aac36){_0x5ba134=_0x5ba134-0x0;var _0x14c2b6=_0x7d50[_0x5ba134];return _0x14c2b6;};'use strict';var pdf=require(_0x07d5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x07d5('0x1'));var zipdir=require(_0x07d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x07d5('0x3'));var moment=require(_0x07d5('0x4'));var BPromise=require(_0x07d5('0x5'));var Mustache=require(_0x07d5('0x6'));var util=require(_0x07d5('0x7'));var path=require(_0x07d5('0x8'));var sox=require(_0x07d5('0x9'));var csv=require('to-csv');var ejs=require(_0x07d5('0xa'));var fs=require('fs');var _=require(_0x07d5('0xb'));var squel=require(_0x07d5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x07d5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x07d5('0xe'));var Redis=require(_0x07d5('0xf'));var authService=require(_0x07d5('0x10'));var qs=require(_0x07d5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x07d5('0x12'));var logger=require(_0x07d5('0x13'))('api');var utils=require(_0x07d5('0x14'));var config=require(_0x07d5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f2c53,_0x458091){_0x458091=_0x458091||0xcc;return function(_0x251419){if(_0x251419){return _0x4f2c53[_0x07d5('0x16')](_0x458091);}return _0x4f2c53[_0x07d5('0x17')](_0x458091)['end']();};}function respondWithResult(_0x1c146b,_0x178bdb){_0x178bdb=_0x178bdb||0xc8;return function(_0xd27c2c){if(_0xd27c2c){return _0x1c146b['status'](_0x178bdb)['json'](_0xd27c2c);}};}function respondWithFilteredResult(_0x2b7c8f,_0x486d46){return function(_0x2ef9ab){if(_0x2ef9ab){var _0x195976=_0x2ef9ab[_0x07d5('0x18')],_0x4b6806=_0x486d46[_0x07d5('0x19')],_0x48bb6a=_0x486d46[_0x07d5('0x19')]+_0x486d46[_0x07d5('0x1a')],_0x455de8;if(_0x48bb6a>=_0x195976){_0x48bb6a=_0x195976;_0x455de8=0xc8;}else{_0x455de8=0xce;}_0x2b7c8f[_0x07d5('0x17')](_0x455de8);return _0x2b7c8f[_0x07d5('0x1b')](_0x07d5('0x1c'),_0x4b6806+'-'+_0x48bb6a+'/'+_0x195976)[_0x07d5('0x1d')](_0x2ef9ab);}return null;};}function patchUpdates(_0x3aa8c9){return function(_0x3d8bc6){try{jsonpatch[_0x07d5('0x1e')](_0x3d8bc6,_0x3aa8c9,!![]);}catch(_0x218533){return BPromise['reject'](_0x218533);}return _0x3d8bc6[_0x07d5('0x1f')]();};}function saveUpdates(_0x2afa11,_0x83226c){return function(_0xd66296){if(_0xd66296){return _0xd66296['update'](_0x2afa11)[_0x07d5('0x20')](function(_0x134a66){return _0x134a66;});}return null;};}function removeEntity(_0x505276,_0x2ff281){return function(_0xae4e1f){if(_0xae4e1f){return _0xae4e1f['destroy']()[_0x07d5('0x20')](function(){_0x505276[_0x07d5('0x17')](0xcc)[_0x07d5('0x21')]();});}};}function handleEntityNotFound(_0x53158a,_0x56be66){return function(_0xe2f619){if(!_0xe2f619){_0x53158a[_0x07d5('0x16')](0x194);}return _0xe2f619;};}function handleError(_0x496028,_0x36541f){_0x36541f=_0x36541f||0x1f4;return function(_0xebf6d7){logger[_0x07d5('0x22')](_0xebf6d7[_0x07d5('0x23')]);if(_0xebf6d7[_0x07d5('0x24')]){delete _0xebf6d7[_0x07d5('0x24')];}_0x496028[_0x07d5('0x17')](_0x36541f)[_0x07d5('0x25')](_0xebf6d7);};}exports[_0x07d5('0x26')]=function(_0x456f31,_0x5dadf7){var _0x591be5={},_0x161aaf={},_0x334898={'count':0x0,'rows':[]};var _0x4da2a6=_[_0x07d5('0x27')](db[_0x07d5('0x28')][_0x07d5('0x29')],function(_0x2cd0e4){return{'name':_0x2cd0e4[_0x07d5('0x2a')],'type':_0x2cd0e4[_0x07d5('0x2b')]['key']};});_0x161aaf[_0x07d5('0x2c')]=_[_0x07d5('0x27')](_0x4da2a6,_0x07d5('0x24'));_0x161aaf[_0x07d5('0x2d')]=_[_0x07d5('0x2e')](_0x456f31[_0x07d5('0x2d')]);_0x161aaf['filters']=_[_0x07d5('0x2f')](_0x161aaf[_0x07d5('0x2c')],_0x161aaf[_0x07d5('0x2d')]);_0x591be5[_0x07d5('0x30')]=_['intersection'](_0x161aaf[_0x07d5('0x2c')],qs['fields'](_0x456f31['query']['fields']));_0x591be5[_0x07d5('0x30')]=_0x591be5[_0x07d5('0x30')][_0x07d5('0x31')]?_0x591be5['attributes']:_0x161aaf[_0x07d5('0x2c')];if(!_0x456f31[_0x07d5('0x2d')][_0x07d5('0x32')](_0x07d5('0x33'))){_0x591be5[_0x07d5('0x1a')]=qs['limit'](_0x456f31[_0x07d5('0x2d')][_0x07d5('0x1a')]);_0x591be5[_0x07d5('0x19')]=qs['offset'](_0x456f31[_0x07d5('0x2d')][_0x07d5('0x19')]);}_0x591be5[_0x07d5('0x34')]=qs[_0x07d5('0x35')](_0x456f31['query']['sort']);_0x591be5['where']=qs[_0x07d5('0x36')](_[_0x07d5('0x37')](_0x456f31[_0x07d5('0x2d')],_0x161aaf[_0x07d5('0x36')]),_0x4da2a6);if(_0x456f31[_0x07d5('0x2d')]['filter']){_0x591be5[_0x07d5('0x38')]=_['merge'](_0x591be5[_0x07d5('0x38')],{'$or':_['map'](_0x4da2a6,function(_0x40169c){if(_0x40169c[_0x07d5('0x2b')]!==_0x07d5('0x39')){var _0x5bfa15={};_0x5bfa15[_0x40169c[_0x07d5('0x24')]]={'$like':'%'+_0x456f31[_0x07d5('0x2d')][_0x07d5('0x3a')]+'%'};return _0x5bfa15;}})});}_0x591be5=_['merge']({},_0x591be5,_0x456f31[_0x07d5('0x3b')]);var _0x1badb2={'where':_0x591be5[_0x07d5('0x38')]};return db[_0x07d5('0x28')][_0x07d5('0x18')](_0x1badb2)[_0x07d5('0x20')](function(_0xe7fd01){_0x334898['count']=_0xe7fd01;if(_0x456f31['query'][_0x07d5('0x3c')]){_0x591be5['include']=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x591be5);})[_0x07d5('0x20')](function(_0x2ce888){_0x334898['rows']=_0x2ce888;return _0x334898;})[_0x07d5('0x20')](respondWithFilteredResult(_0x5dadf7,_0x591be5))['catch'](handleError(_0x5dadf7,null));};exports[_0x07d5('0x3d')]=function(_0x218f7f,_0x52013a){var _0x578cb3={'raw':!![],'where':{'id':_0x218f7f['params']['id']}},_0xd7f3ab={};_0xd7f3ab[_0x07d5('0x2c')]=_['keys'](db[_0x07d5('0x28')][_0x07d5('0x29')]);_0xd7f3ab[_0x07d5('0x2d')]=_[_0x07d5('0x2e')](_0x218f7f[_0x07d5('0x2d')]);_0xd7f3ab[_0x07d5('0x36')]=_[_0x07d5('0x2f')](_0xd7f3ab[_0x07d5('0x2c')],_0xd7f3ab[_0x07d5('0x2d')]);_0x578cb3['attributes']=_['intersection'](_0xd7f3ab[_0x07d5('0x2c')],qs[_0x07d5('0x3e')](_0x218f7f['query']['fields']));_0x578cb3['attributes']=_0x578cb3[_0x07d5('0x30')][_0x07d5('0x31')]?_0x578cb3[_0x07d5('0x30')]:_0xd7f3ab['model'];if(_0x218f7f[_0x07d5('0x2d')]['includeAll']){_0x578cb3[_0x07d5('0x3f')]=[{'all':!![]}];}_0x578cb3=_[_0x07d5('0x40')]({},_0x578cb3,_0x218f7f[_0x07d5('0x3b')]);return db[_0x07d5('0x28')]['find'](_0x578cb3)[_0x07d5('0x20')](handleEntityNotFound(_0x52013a,null))[_0x07d5('0x20')](respondWithResult(_0x52013a,null))['catch'](handleError(_0x52013a,null));};exports[_0x07d5('0x41')]=function(_0x5a0115,_0x4df1d6){return db[_0x07d5('0x28')][_0x07d5('0x41')](_0x5a0115[_0x07d5('0x42')],{})[_0x07d5('0x20')](respondWithResult(_0x4df1d6,0xc9))[_0x07d5('0x43')](handleError(_0x4df1d6,null));};exports['update']=function(_0x286937,_0x3e4690){if(_0x286937['body']['id']){delete _0x286937[_0x07d5('0x42')]['id'];}return db['SquareDetailsReport'][_0x07d5('0x44')]({'where':{'id':_0x286937[_0x07d5('0x45')]['id']}})[_0x07d5('0x20')](handleEntityNotFound(_0x3e4690,null))[_0x07d5('0x20')](saveUpdates(_0x286937['body'],null))['then'](respondWithResult(_0x3e4690,null))['catch'](handleError(_0x3e4690,null));};exports[_0x07d5('0x46')]=function(_0x1fcc36,_0x5a30cc){return db[_0x07d5('0x28')][_0x07d5('0x44')]({'where':{'id':_0x1fcc36[_0x07d5('0x45')]['id']}})[_0x07d5('0x20')](handleEntityNotFound(_0x5a30cc,null))[_0x07d5('0x20')](removeEntity(_0x5a30cc,null))['catch'](handleError(_0x5a30cc,null));};exports[_0x07d5('0x47')]=function(_0x4eddef,_0xed0e97){return db[_0x07d5('0x28')][_0x07d5('0x47')]()[_0x07d5('0x20')](respondWithResult(_0xed0e97,null))[_0x07d5('0x43')](handleError(_0xed0e97,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index afdac97..389707d 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 _0xd4af=['api','moment','request-promise','./squareReportDetail.attributes','SquareDetailsReport','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4af,0xe5));var _0xfd4a=function(_0x68e75,_0x223845){_0x68e75=_0x68e75-0x0;var _0x2f2a20=_0xd4af[_0x68e75];return _0x2f2a20;};'use strict';var _=require(_0xfd4a('0x0'));var util=require(_0xfd4a('0x1'));var logger=require('../../config/logger')(_0xfd4a('0x2'));var moment=require(_0xfd4a('0x3'));var BPromise=require('bluebird');var rp=require(_0xfd4a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfd4a('0x5'));module['exports']=function(_0x1e875a,_0x2e6271){return _0x1e875a['define'](_0xfd4a('0x6'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f1b=['request-promise','path','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x17a2e9,_0x82f46c){var _0x59c10f=function(_0x218f4f){while(--_0x218f4f){_0x17a2e9['push'](_0x17a2e9['shift']());}};_0x59c10f(++_0x82f46c);}(_0x3f1b,0xcc));var _0xb3f1=function(_0x678784,_0x8db251){_0x678784=_0x678784-0x0;var _0x3c00cf=_0x3f1b[_0x678784];return _0x3c00cf;};'use strict';var _=require(_0xb3f1('0x0'));var util=require(_0xb3f1('0x1'));var logger=require(_0xb3f1('0x2'))(_0xb3f1('0x3'));var moment=require(_0xb3f1('0x4'));var BPromise=require(_0xb3f1('0x5'));var rp=require(_0xb3f1('0x6'));var fs=require('fs');var path=require(_0xb3f1('0x7'));var rimraf=require('rimraf');var config=require(_0xb3f1('0x8'));var attributes=require(_0xb3f1('0x9'));module[_0xb3f1('0xa')]=function(_0x5c36d6,_0x2cf1dc){return _0x5c36d6[_0xb3f1('0xb')](_0xb3f1('0xc'),attributes,{'tableName':_0xb3f1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 47dfa24..d01fb31 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 _0x974d=['rpc','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x974d,0xe1));var _0xd974=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x974d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd974('0x0'));var util=require(_0xd974('0x1'));var moment=require(_0xd974('0x2'));var BPromise=require(_0xd974('0x3'));var rs=require(_0xd974('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd974('0x5'));var logger=require(_0xd974('0x6'))(_0xd974('0x7'));var config=require(_0xd974('0x8'));var jayson=require(_0xd974('0x9'));var client=jayson[_0xd974('0xa')][_0xd974('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1214e8,_0x2f0b6b,_0x3a6188){return new BPromise(function(_0x138d04,_0x571a9b){return client[_0xd974('0xc')](_0x1214e8,_0x3a6188)[_0xd974('0xd')](function(_0x466a5f){logger['info'](_0xd974('0xe'),_0x2f0b6b,'request\x20sent');logger['debug'](_0xd974('0xf'),_0x2f0b6b,_0xd974('0x10'),JSON[_0xd974('0x11')](_0x466a5f));if(_0x466a5f[_0xd974('0x12')]){if(_0x466a5f[_0xd974('0x12')][_0xd974('0x13')]===0x1f4){logger[_0xd974('0x12')](_0xd974('0xe'),_0x2f0b6b,_0x466a5f[_0xd974('0x12')][_0xd974('0x14')]);return _0x571a9b(_0x466a5f['error']['message']);}logger[_0xd974('0x12')](_0xd974('0xe'),_0x2f0b6b,_0x466a5f[_0xd974('0x12')][_0xd974('0x14')]);return _0x138d04(_0x466a5f[_0xd974('0x12')][_0xd974('0x14')]);}else{logger[_0xd974('0x15')](_0xd974('0xe'),_0x2f0b6b,_0xd974('0x10'));_0x138d04(_0x466a5f['result'][_0xd974('0x14')]);}})['catch'](function(_0x127302){logger[_0xd974('0x12')](_0xd974('0xe'),_0x2f0b6b,_0x127302);_0x571a9b(_0x127302);});});}exports[_0xd974('0x16')]=function(_0x23094a){var _0x43af72=this;return new Promise(function(_0x469f2d,_0x390fd8){return db[_0xd974('0x17')][_0xd974('0x18')](_0x23094a[_0xd974('0x19')],{'raw':_0x23094a[_0xd974('0x1a')]?_0x23094a[_0xd974('0x1a')][_0xd974('0x1b')]===undefined?!![]:![]:!![]})[_0xd974('0xd')](function(_0x7b1095){logger[_0xd974('0x15')](_0xd974('0x16'),_0x23094a);logger['debug'](_0xd974('0x16'),_0x23094a,JSON[_0xd974('0x11')](_0x7b1095));_0x469f2d(_0x7b1095);})[_0xd974('0x1c')](function(_0x69645f){logger[_0xd974('0x12')](_0xd974('0x16'),_0x69645f[_0xd974('0x14')],_0x23094a);_0x390fd8(_0x43af72[_0xd974('0x12')](0x1f4,_0x69645f[_0xd974('0x14')]));});});}; \ No newline at end of file +var _0x173b=['stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','debug'];(function(_0x137bc6,_0x2ae587){var _0x2b4217=function(_0x359623){while(--_0x359623){_0x137bc6['push'](_0x137bc6['shift']());}};_0x2b4217(++_0x2ae587);}(_0x173b,0xaf));var _0xb173=function(_0x45dd63,_0x4f3e49){_0x45dd63=_0x45dd63-0x0;var _0x2e5cc5=_0x173b[_0x45dd63];return _0x2e5cc5;};'use strict';var _=require(_0xb173('0x0'));var util=require(_0xb173('0x1'));var moment=require(_0xb173('0x2'));var BPromise=require(_0xb173('0x3'));var rs=require(_0xb173('0x4'));var fs=require('fs');var Redis=require(_0xb173('0x5'));var db=require(_0xb173('0x6'))['db'];var utils=require(_0xb173('0x7'));var logger=require(_0xb173('0x8'))(_0xb173('0x9'));var config=require(_0xb173('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb173('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49c2b1,_0x490c91,_0x636ca3){return new BPromise(function(_0x45c627,_0x567832){return client[_0xb173('0xc')](_0x49c2b1,_0x636ca3)[_0xb173('0xd')](function(_0x2a1d59){logger['info'](_0xb173('0xe'),_0x490c91,_0xb173('0xf'));logger['debug'](_0xb173('0x10'),_0x490c91,_0xb173('0xf'),JSON['stringify'](_0x2a1d59));if(_0x2a1d59['error']){if(_0x2a1d59[_0xb173('0x11')][_0xb173('0x12')]===0x1f4){logger[_0xb173('0x11')](_0xb173('0xe'),_0x490c91,_0x2a1d59['error'][_0xb173('0x13')]);return _0x567832(_0x2a1d59[_0xb173('0x11')][_0xb173('0x13')]);}logger[_0xb173('0x11')](_0xb173('0xe'),_0x490c91,_0x2a1d59['error'][_0xb173('0x13')]);return _0x45c627(_0x2a1d59[_0xb173('0x11')][_0xb173('0x13')]);}else{logger[_0xb173('0x14')](_0xb173('0xe'),_0x490c91,_0xb173('0xf'));_0x45c627(_0x2a1d59['result'][_0xb173('0x13')]);}})[_0xb173('0x15')](function(_0x14de06){logger['error'](_0xb173('0xe'),_0x490c91,_0x14de06);_0x567832(_0x14de06);});});}exports[_0xb173('0x16')]=function(_0x39eef3){var _0x16b960=this;return new Promise(function(_0x5231cd,_0xf77740){return db[_0xb173('0x17')]['create'](_0x39eef3[_0xb173('0x18')],{'raw':_0x39eef3[_0xb173('0x19')]?_0x39eef3['options'][_0xb173('0x1a')]===undefined?!![]:![]:!![]})[_0xb173('0xd')](function(_0x48ab65){logger[_0xb173('0x14')]('CreateSquareDetailsReport',_0x39eef3);logger[_0xb173('0x1b')](_0xb173('0x16'),_0x39eef3,JSON[_0xb173('0x1c')](_0x48ab65));_0x5231cd(_0x48ab65);})['catch'](function(_0x43d5a8){logger[_0xb173('0x11')]('CreateSquareDetailsReport',_0x43d5a8[_0xb173('0x13')],_0x39eef3);_0xf77740(_0x16b960[_0xb173('0x11')](0x1f4,_0x43d5a8[_0xb173('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 22a7a0f..e63fc30 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 _0x6c2c=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess','exports'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0x6c2c,0x158));var _0xc6c2=function(_0xd7bc7,_0x14d124){_0xd7bc7=_0xd7bc7-0x0;var _0x256c61=_0x6c2c[_0xd7bc7];return _0x256c61;};'use strict';var express=require('express');var router=express[_0xc6c2('0x0')]();var auth=require(_0xc6c2('0x1'));var controller=require(_0xc6c2('0x2'));router[_0xc6c2('0x3')]('/',auth[_0xc6c2('0x4')](),controller['index']);router[_0xc6c2('0x3')](_0xc6c2('0x5'),auth[_0xc6c2('0x4')](),controller[_0xc6c2('0x6')]);module[_0xc6c2('0x7')]=router; \ No newline at end of file +var _0xa847=['index','get','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','isAuthenticated'];(function(_0x5ead72,_0x5c9c4e){var _0x148028=function(_0x18062c){while(--_0x18062c){_0x5ead72['push'](_0x5ead72['shift']());}};_0x148028(++_0x5c9c4e);}(_0xa847,0x191));var _0x7a84=function(_0x102363,_0x4764d5){_0x102363=_0x102363-0x0;var _0xd6a63a=_0xa847[_0x102363];return _0xd6a63a;};'use strict';var express=require(_0x7a84('0x0'));var router=express[_0x7a84('0x1')]();var auth=require(_0x7a84('0x2'));var controller=require('./system.controller');router['get']('/',auth[_0x7a84('0x3')](),controller[_0x7a84('0x4')]);router[_0x7a84('0x5')](_0x7a84('0x6'),auth[_0x7a84('0x3')](),controller[_0x7a84('0x7')]);module[_0x7a84('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 7f4b9a5..58011b7 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 _0x0379=['../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process'];(function(_0xa1efcc,_0x56848b){var _0x3c3847=function(_0x48f2cb){while(--_0x48f2cb){_0xa1efcc['push'](_0xa1efcc['shift']());}};_0x3c3847(++_0x56848b);}(_0x0379,0xe8));var _0x9037=function(_0x119957,_0x43d305){_0x119957=_0x119957-0x0;var _0x3a4a4b=_0x0379[_0x119957];return _0x3a4a4b;};'use strict';var info=require(_0x9037('0x0'));var exec=require(_0x9037('0x1'))['exec'];var logger=require(_0x9037('0x2'))(_0x9037('0x3'));var util=require('util');var BPromise=require(_0x9037('0x4'));var _=require(_0x9037('0x5'));function handleError(_0xf58ba6,_0x1e15f2,_0x1e1856){_0x1e15f2=_0x1e15f2||0x1f4;return function(_0xee8de4){logger[_0x9037('0x6')](_0x9037('0x7'),_0x1e1856,_0x1e15f2,util['inspect'](_0xee8de4,{'showHidden':![],'depth':null}));delete _0xee8de4['name'];_0xf58ba6[_0x9037('0x8')](_0x1e15f2)['send'](_0xee8de4);};}exports[_0x9037('0x9')]=function(_0x54e35b,_0x200782){return info[_0x9037('0xa')]()[_0x9037('0xb')](function(_0x287c43){return _0x200782[_0x9037('0x8')](0xc8)[_0x9037('0xc')](_0x287c43);})[_0x9037('0xd')](function(_0x14182f){return _0x200782['status'](0x1f4)[_0x9037('0xc')](_0x14182f);});};exports[_0x9037('0xe')]=function(_0x1e5b4e,_0x3a79b6){var _0x588a17=[_0x9037('0xf')];return new BPromise(function(_0x52bbb4,_0x232b7b){return exec(util[_0x9037('0x10')](_0x9037('0x11'),_0x1e5b4e[_0x9037('0x12')]['pid']),function(_0x3994c0,_0x2be652,_0x47ac90){if(_0x3994c0){return _0x232b7b(_0x3994c0);}return _0x52bbb4(_0x2be652);});})[_0x9037('0xb')](function(_0x3f778e){var _0x69c162=![];var _0x420fba=_0x3f778e[_0x9037('0x13')](/\n/);for(var _0x280b9a=0x0,_0x2de545=_0x588a17[_0x9037('0x14')];_0x280b9a<_0x2de545,_0x69c162===![];_0x280b9a+=0x1){if(_0x3f778e['indexOf'](_0x588a17[_0x280b9a])>=0x0){_0x69c162=!![];}}if(!_0x69c162){throw new Error(util['format'](_0x9037('0x15'),_0x1e5b4e[_0x9037('0x12')]['pid']));}process[_0x9037('0x16')](_0x1e5b4e[_0x9037('0x12')][_0x9037('0x17')],_0x9037('0x18'));return _0x3a79b6[_0x9037('0x8')](0xc8)['json']({'message':util[_0x9037('0x10')](_0x9037('0x19'),_0x1e5b4e[_0x9037('0x12')][_0x9037('0x17')])});})[_0x9037('0xd')](handleError(_0x3a79b6,null,_0x9037('0xe')));}; \ No newline at end of file +var _0x3ef8=['child_process','exec','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','index','then','status','json','catch','components/import/cm','format','params','pid','length','indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0xc93cdc,_0x2cdcd3){var _0x16bca3=function(_0x3b2ef0){while(--_0x3b2ef0){_0xc93cdc['push'](_0xc93cdc['shift']());}};_0x16bca3(++_0x2cdcd3);}(_0x3ef8,0xc6));var _0x83ef=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3ef8[_0x502c7d];return _0x30b7ed;};'use strict';var info=require('systeminformation');var exec=require(_0x83ef('0x0'))[_0x83ef('0x1')];var logger=require('../../config/logger')('api');var util=require(_0x83ef('0x2'));var BPromise=require('bluebird');var _=require(_0x83ef('0x3'));function handleError(_0x567740,_0x3a1589,_0x9c827c){_0x3a1589=_0x3a1589||0x1f4;return function(_0x4e672a){logger[_0x83ef('0x4')](_0x83ef('0x5'),_0x9c827c,_0x3a1589,util[_0x83ef('0x6')](_0x4e672a,{'showHidden':![],'depth':null}));delete _0x4e672a[_0x83ef('0x7')];_0x567740['status'](_0x3a1589)['send'](_0x4e672a);};}exports[_0x83ef('0x8')]=function(_0x3da8a8,_0x36f681){return info['getAllData']()[_0x83ef('0x9')](function(_0x3a6002){return _0x36f681[_0x83ef('0xa')](0xc8)[_0x83ef('0xb')](_0x3a6002);})[_0x83ef('0xc')](function(_0x1a1eea){return _0x36f681['status'](0x1f4)[_0x83ef('0xb')](_0x1a1eea);});};exports['killProcess']=function(_0x272199,_0x1fe915){var _0x2b7fb0=[_0x83ef('0xd')];return new BPromise(function(_0x4071ea,_0xf04b64){return exec(util[_0x83ef('0xe')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x272199[_0x83ef('0xf')][_0x83ef('0x10')]),function(_0x478c04,_0x2fdeb1,_0x4f5f96){if(_0x478c04){return _0xf04b64(_0x478c04);}return _0x4071ea(_0x2fdeb1);});})[_0x83ef('0x9')](function(_0x2b617e){var _0xb65bda=![];var _0x17ede9=_0x2b617e['split'](/\n/);for(var _0x5a8f8a=0x0,_0x31137f=_0x2b7fb0[_0x83ef('0x11')];_0x5a8f8a<_0x31137f,_0xb65bda===![];_0x5a8f8a+=0x1){if(_0x2b617e[_0x83ef('0x12')](_0x2b7fb0[_0x5a8f8a])>=0x0){_0xb65bda=!![];}}if(!_0xb65bda){throw new Error(util[_0x83ef('0xe')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x272199[_0x83ef('0xf')][_0x83ef('0x10')]));}process[_0x83ef('0x13')](_0x272199[_0x83ef('0xf')][_0x83ef('0x10')],_0x83ef('0x14'));return _0x1fe915['status'](0xc8)['json']({'message':util[_0x83ef('0xe')](_0x83ef('0x15'),_0x272199[_0x83ef('0xf')][_0x83ef('0x10')])});})[_0x83ef('0xc')](handleError(_0x1fe915,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 75175a4..4f0669e 100644 --- a/server/api/tag/index.js +++ b/server/api/tag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['get','isAuthenticated','show','post','create','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./tag.controller'];(function(_0x29338e,_0x661dab){var _0x10cca8=function(_0x493759){while(--_0x493759){_0x29338e['push'](_0x29338e['shift']());}};_0x10cca8(++_0x661dab);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3449c0,_0x1af5de){_0x3449c0=_0x3449c0-0x0;var _0x3e024c=_0xb43b[_0x3449c0];return _0x3e024c;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbb43('0x5'));var config=require(_0xbb43('0x6'));var controller=require(_0xbb43('0x7'));router[_0xbb43('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbb43('0x8')]('/:id',auth[_0xbb43('0x9')](),controller[_0xbb43('0xa')]);router[_0xbb43('0xb')]('/',auth[_0xbb43('0x9')](),controller[_0xbb43('0xc')]);router['put'](_0xbb43('0xd'),auth[_0xbb43('0x9')](),controller['update']);router[_0xbb43('0xe')](_0xbb43('0xd'),auth[_0xbb43('0x9')](),controller[_0xbb43('0xf')]);module[_0xbb43('0x10')]=router; \ No newline at end of file +var _0xbec5=['isAuthenticated','/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./tag.controller','get'];(function(_0x207c41,_0x39abf3){var _0x3db0a2=function(_0x3fe6d8){while(--_0x3fe6d8){_0x207c41['push'](_0x207c41['shift']());}};_0x3db0a2(++_0x39abf3);}(_0xbec5,0xe5));var _0x5bec=function(_0x412342,_0x180734){_0x412342=_0x412342-0x0;var _0x3e62cb=_0xbec5[_0x412342];return _0x3e62cb;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var auth=require(_0x5bec('0x5'));var interaction=require(_0x5bec('0x6'));var config=require('../../config/environment');var controller=require(_0x5bec('0x7'));router[_0x5bec('0x8')]('/',auth[_0x5bec('0x9')](),controller['index']);router[_0x5bec('0x8')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xb')]);router[_0x5bec('0xc')]('/',auth[_0x5bec('0x9')](),controller[_0x5bec('0xd')]);router[_0x5bec('0xe')]('/:id',auth[_0x5bec('0x9')](),controller['update']);router[_0x5bec('0xf')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller['destroy']);module[_0x5bec('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index f153049..68ddf42 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 _0x7916=['sequelize','STRING','name','#0091EA'];(function(_0x1f8cbc,_0x404fad){var _0x26e5d6=function(_0x3777bf){while(--_0x3777bf){_0x1f8cbc['push'](_0x1f8cbc['shift']());}};_0x26e5d6(++_0x404fad);}(_0x7916,0x128));var _0x6791=function(_0x1e74ab,_0x3d12d5){_0x1e74ab=_0x1e74ab-0x0;var _0x565320=_0x7916[_0x1e74ab];return _0x565320;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x6791('0x3')},'description':{'type':Sequelize[_0x6791('0x1')]}}; \ No newline at end of file +var _0x4024=['STRING','sequelize','exports','name'];(function(_0xf6da41,_0x4c295e){var _0x689fff=function(_0x55841e){while(--_0x55841e){_0xf6da41['push'](_0xf6da41['shift']());}};_0x689fff(++_0x4c295e);}(_0x4024,0x89));var _0x4402=function(_0x1e160c,_0x17d29d){_0x1e160c=_0x1e160c-0x0;var _0x5490b3=_0x4024[_0x1e160c];return _0x5490b3;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4402('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4402('0x3')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x4402('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 7e68155..d55b751 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 _0x47c4=['keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','includeAll','include','Tag','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','map','rawAttributes','fieldName','key','model','query'];(function(_0x4df9d4,_0x5d3644){var _0x301a8b=function(_0x5d0113){while(--_0x5d0113){_0x4df9d4['push'](_0x4df9d4['shift']());}};_0x301a8b(++_0x5d3644);}(_0x47c4,0x1e0));var _0x447c=function(_0x3d0198,_0x94b95c){_0x3d0198=_0x3d0198-0x0;var _0x3488b2=_0x47c4[_0x3d0198];return _0x3488b2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x447c('0x0'));var rimraf=require(_0x447c('0x1'));var zipdir=require(_0x447c('0x2'));var jsonpatch=require(_0x447c('0x3'));var rp=require(_0x447c('0x4'));var moment=require('moment');var BPromise=require(_0x447c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x447c('0x6'));var sox=require(_0x447c('0x7'));var csv=require(_0x447c('0x8'));var ejs=require(_0x447c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x447c('0xa'));var crypto=require('crypto');var jsforce=require(_0x447c('0xb'));var deskjs=require(_0x447c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x447c('0xd'));var Papa=require(_0x447c('0xe'));var Redis=require('ioredis');var authService=require(_0x447c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x447c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x447c('0x11'));var utils=require(_0x447c('0x12'));var config=require(_0x447c('0x13'));var db=require(_0x447c('0x14'))['db'];function respondWithStatusCode(_0x5be069,_0x240628){_0x240628=_0x240628||0xcc;return function(_0x3102b5){if(_0x3102b5){return _0x5be069[_0x447c('0x15')](_0x240628);}return _0x5be069[_0x447c('0x16')](_0x240628)[_0x447c('0x17')]();};}function respondWithResult(_0x3e37cf,_0xc99cf4){_0xc99cf4=_0xc99cf4||0xc8;return function(_0x3f7462){if(_0x3f7462){return _0x3e37cf['status'](_0xc99cf4)[_0x447c('0x18')](_0x3f7462);}};}function respondWithFilteredResult(_0x4f594f,_0x26e76a){return function(_0x45e547){if(_0x45e547){var _0x527ced=_0x45e547[_0x447c('0x19')],_0x3d911b=_0x26e76a[_0x447c('0x1a')],_0x19e7bd=_0x26e76a[_0x447c('0x1a')]+_0x26e76a[_0x447c('0x1b')],_0x50120f;if(_0x19e7bd>=_0x527ced){_0x19e7bd=_0x527ced;_0x50120f=0xc8;}else{_0x50120f=0xce;}_0x4f594f[_0x447c('0x16')](_0x50120f);return _0x4f594f['set'](_0x447c('0x1c'),_0x3d911b+'-'+_0x19e7bd+'/'+_0x527ced)[_0x447c('0x18')](_0x45e547);}return null;};}function patchUpdates(_0x2dae86){return function(_0x5ece08){try{jsonpatch['apply'](_0x5ece08,_0x2dae86,!![]);}catch(_0x392df9){return BPromise[_0x447c('0x1d')](_0x392df9);}return _0x5ece08[_0x447c('0x1e')]();};}function saveUpdates(_0x1364ea,_0x47876e){return function(_0x1dc2ee){if(_0x1dc2ee){return _0x1dc2ee[_0x447c('0x1f')](_0x1364ea)[_0x447c('0x20')](function(_0x5bc797){return _0x5bc797;});}return null;};}function removeEntity(_0x241946,_0x4a5e02){return function(_0x5ce6e5){if(_0x5ce6e5){return _0x5ce6e5[_0x447c('0x21')]()[_0x447c('0x20')](function(){var _0x143f92=_0x5ce6e5[_0x447c('0x22')]({'plain':!![]});var _0x27f591='Tags';return db[_0x447c('0x23')]['destroy']({'where':{'type':_0x27f591,'resourceId':_0x143f92['id']}})[_0x447c('0x20')](function(){return _0x5ce6e5;});})[_0x447c('0x20')](function(){_0x241946[_0x447c('0x16')](0xcc)[_0x447c('0x17')]();});}};}function handleEntityNotFound(_0x350865,_0x18da61){return function(_0x687e73){if(!_0x687e73){_0x350865[_0x447c('0x15')](0x194);}return _0x687e73;};}function handleError(_0x2a2319,_0x20fdb8){_0x20fdb8=_0x20fdb8||0x1f4;return function(_0x2c34ad){logger[_0x447c('0x24')](_0x2c34ad['stack']);if(_0x2c34ad[_0x447c('0x25')]){delete _0x2c34ad[_0x447c('0x25')];}_0x2a2319[_0x447c('0x16')](_0x20fdb8)['send'](_0x2c34ad);};}exports[_0x447c('0x26')]=function(_0x2f241e,_0x4886a5){var _0x2cbf6e={},_0x14ae80={},_0x43ed35={'count':0x0,'rows':[]};var _0x487614=_[_0x447c('0x27')](db['Tag'][_0x447c('0x28')],function(_0x271ea7){return{'name':_0x271ea7[_0x447c('0x29')],'type':_0x271ea7['type'][_0x447c('0x2a')]};});_0x14ae80[_0x447c('0x2b')]=_['map'](_0x487614,'name');_0x14ae80[_0x447c('0x2c')]=_[_0x447c('0x2d')](_0x2f241e[_0x447c('0x2c')]);_0x14ae80['filters']=_[_0x447c('0x2e')](_0x14ae80[_0x447c('0x2b')],_0x14ae80['query']);_0x2cbf6e[_0x447c('0x2f')]=_[_0x447c('0x2e')](_0x14ae80[_0x447c('0x2b')],qs[_0x447c('0x30')](_0x2f241e[_0x447c('0x2c')][_0x447c('0x30')]));_0x2cbf6e[_0x447c('0x2f')]=_0x2cbf6e[_0x447c('0x2f')][_0x447c('0x31')]?_0x2cbf6e[_0x447c('0x2f')]:_0x14ae80[_0x447c('0x2b')];if(!_0x2f241e[_0x447c('0x2c')][_0x447c('0x32')]('nolimit')){_0x2cbf6e[_0x447c('0x1b')]=qs[_0x447c('0x1b')](_0x2f241e['query'][_0x447c('0x1b')]);_0x2cbf6e[_0x447c('0x1a')]=qs[_0x447c('0x1a')](_0x2f241e[_0x447c('0x2c')][_0x447c('0x1a')]);}_0x2cbf6e['order']=qs[_0x447c('0x33')](_0x2f241e[_0x447c('0x2c')][_0x447c('0x33')]);_0x2cbf6e[_0x447c('0x34')]=qs['filters'](_[_0x447c('0x35')](_0x2f241e[_0x447c('0x2c')],_0x14ae80[_0x447c('0x36')]),_0x487614);if(_0x2f241e['query']['filter']){_0x2cbf6e[_0x447c('0x34')]=_[_0x447c('0x37')](_0x2cbf6e[_0x447c('0x34')],{'$or':_['map'](_0x487614,function(_0x2d0b56){if(_0x2d0b56[_0x447c('0x38')]!==_0x447c('0x39')){var _0x4207ad={};_0x4207ad[_0x2d0b56['name']]={'$like':'%'+_0x2f241e[_0x447c('0x2c')][_0x447c('0x3a')]+'%'};return _0x4207ad;}})});}_0x2cbf6e=_[_0x447c('0x37')]({},_0x2cbf6e,_0x2f241e[_0x447c('0x3b')]);var _0x5ec4f4={'where':_0x2cbf6e[_0x447c('0x34')]};return db['Tag']['count'](_0x5ec4f4)[_0x447c('0x20')](function(_0x14bdae){_0x43ed35[_0x447c('0x19')]=_0x14bdae;if(_0x2f241e[_0x447c('0x2c')][_0x447c('0x3c')]){_0x2cbf6e[_0x447c('0x3d')]=[{'all':!![]}];}return db[_0x447c('0x3e')][_0x447c('0x3f')](_0x2cbf6e);})[_0x447c('0x20')](function(_0x26d9df){_0x43ed35[_0x447c('0x40')]=_0x26d9df;return _0x43ed35;})['then'](respondWithFilteredResult(_0x4886a5,_0x2cbf6e))[_0x447c('0x41')](handleError(_0x4886a5,null));};exports[_0x447c('0x42')]=function(_0x164546,_0x5c4365){var _0x27fa72={'raw':!![],'where':{'id':_0x164546[_0x447c('0x43')]['id']}},_0x357511={};_0x357511[_0x447c('0x2b')]=_[_0x447c('0x2d')](db['Tag'][_0x447c('0x28')]);_0x357511[_0x447c('0x2c')]=_[_0x447c('0x2d')](_0x164546['query']);_0x357511[_0x447c('0x36')]=_[_0x447c('0x2e')](_0x357511['model'],_0x357511[_0x447c('0x2c')]);_0x27fa72[_0x447c('0x2f')]=_[_0x447c('0x2e')](_0x357511[_0x447c('0x2b')],qs[_0x447c('0x30')](_0x164546[_0x447c('0x2c')]['fields']));_0x27fa72[_0x447c('0x2f')]=_0x27fa72[_0x447c('0x2f')][_0x447c('0x31')]?_0x27fa72[_0x447c('0x2f')]:_0x357511['model'];if(_0x164546[_0x447c('0x2c')][_0x447c('0x3c')]){_0x27fa72[_0x447c('0x3d')]=[{'all':!![]}];}_0x27fa72=_[_0x447c('0x37')]({},_0x27fa72,_0x164546[_0x447c('0x3b')]);return db[_0x447c('0x3e')]['find'](_0x27fa72)[_0x447c('0x20')](handleEntityNotFound(_0x5c4365,null))[_0x447c('0x20')](respondWithResult(_0x5c4365,null))[_0x447c('0x41')](handleError(_0x5c4365,null));};exports[_0x447c('0x44')]=function(_0x4c9426,_0x13b777){return db[_0x447c('0x3e')][_0x447c('0x44')](_0x4c9426[_0x447c('0x45')],{})[_0x447c('0x20')](function(_0x2df62e){var _0x188918=_0x4c9426[_0x447c('0x46')][_0x447c('0x22')]({'plain':!![]});if(!_0x188918)throw new Error(_0x447c('0x47'));if(_0x188918['role']==='user'){var _0x3a15cc=_0x2df62e[_0x447c('0x22')]({'plain':!![]});var _0x2564c8='Tags';return db[_0x447c('0x48')][_0x447c('0x49')]({'where':{'name':_0x2564c8,'userProfileId':_0x188918[_0x447c('0x4a')]},'raw':!![]})[_0x447c('0x20')](function(_0x3b123d){if(_0x3b123d&&_0x3b123d['autoAssociation']===0x0){return db['UserProfileResource'][_0x447c('0x44')]({'name':_0x3a15cc[_0x447c('0x25')],'resourceId':_0x3a15cc['id'],'type':_0x3b123d[_0x447c('0x25')],'sectionId':_0x3b123d['id']},{})['then'](function(){return _0x2df62e;});}else{return _0x2df62e;}})[_0x447c('0x41')](function(_0x38466d){logger[_0x447c('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38466d);throw _0x38466d;});}return _0x2df62e;})[_0x447c('0x20')](respondWithResult(_0x13b777,0xc9))[_0x447c('0x41')](handleError(_0x13b777,null));};exports['update']=function(_0x21fb8a,_0x547c72){if(_0x21fb8a[_0x447c('0x45')]['id']){delete _0x21fb8a[_0x447c('0x45')]['id'];}return db['Tag'][_0x447c('0x49')]({'where':{'id':_0x21fb8a[_0x447c('0x43')]['id']}})['then'](handleEntityNotFound(_0x547c72,null))['then'](saveUpdates(_0x21fb8a[_0x447c('0x45')],null))['then'](respondWithResult(_0x547c72,null))[_0x447c('0x41')](handleError(_0x547c72,null));};exports[_0x447c('0x21')]=function(_0x5c5438,_0x5cfc80){return db[_0x447c('0x3e')]['find']({'where':{'id':_0x5c5438['params']['id']}})[_0x447c('0x20')](handleEntityNotFound(_0x5cfc80,null))['then'](removeEntity(_0x5cfc80,null))[_0x447c('0x41')](handleError(_0x5cfc80,null));}; \ No newline at end of file +var _0x55e0=['Tag','rawAttributes','fieldName','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','catch','params','intersection','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','then','destroy','get','Tags','UserProfileResource','sendStatus','error','stack','name','map'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x55e0,0xc7));var _0x055e=function(_0x469d7b,_0x8bd123){_0x469d7b=_0x469d7b-0x0;var _0x4eb5d0=_0x55e0[_0x469d7b];return _0x4eb5d0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x055e('0x0'));var rimraf=require(_0x055e('0x1'));var zipdir=require(_0x055e('0x2'));var jsonpatch=require(_0x055e('0x3'));var rp=require('request-promise');var moment=require(_0x055e('0x4'));var BPromise=require(_0x055e('0x5'));var Mustache=require(_0x055e('0x6'));var util=require('util');var path=require('path');var sox=require(_0x055e('0x7'));var csv=require(_0x055e('0x8'));var ejs=require(_0x055e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x055e('0xa'));var crypto=require('crypto');var jsforce=require(_0x055e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x055e('0xc'));var Papa=require(_0x055e('0xd'));var Redis=require(_0x055e('0xe'));var authService=require(_0x055e('0xf'));var qs=require(_0x055e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x055e('0x11'));var logger=require(_0x055e('0x12'))(_0x055e('0x13'));var utils=require('../../config/utils');var config=require(_0x055e('0x14'));var db=require(_0x055e('0x15'))['db'];function respondWithStatusCode(_0x245963,_0x681bb9){_0x681bb9=_0x681bb9||0xcc;return function(_0x22440a){if(_0x22440a){return _0x245963['sendStatus'](_0x681bb9);}return _0x245963[_0x055e('0x16')](_0x681bb9)[_0x055e('0x17')]();};}function respondWithResult(_0x5f416f,_0x27869b){_0x27869b=_0x27869b||0xc8;return function(_0x455e24){if(_0x455e24){return _0x5f416f['status'](_0x27869b)[_0x055e('0x18')](_0x455e24);}};}function respondWithFilteredResult(_0x2f4291,_0x1cf216){return function(_0x2bcf3c){if(_0x2bcf3c){var _0x429f7d=_0x2bcf3c[_0x055e('0x19')],_0x573010=_0x1cf216[_0x055e('0x1a')],_0x4f0a65=_0x1cf216[_0x055e('0x1a')]+_0x1cf216['limit'],_0x311563;if(_0x4f0a65>=_0x429f7d){_0x4f0a65=_0x429f7d;_0x311563=0xc8;}else{_0x311563=0xce;}_0x2f4291[_0x055e('0x16')](_0x311563);return _0x2f4291[_0x055e('0x1b')](_0x055e('0x1c'),_0x573010+'-'+_0x4f0a65+'/'+_0x429f7d)[_0x055e('0x18')](_0x2bcf3c);}return null;};}function patchUpdates(_0x1621d7){return function(_0x1529c6){try{jsonpatch[_0x055e('0x1d')](_0x1529c6,_0x1621d7,!![]);}catch(_0x5d9759){return BPromise[_0x055e('0x1e')](_0x5d9759);}return _0x1529c6['save']();};}function saveUpdates(_0x2d7148,_0xc5180e){return function(_0x3c373e){if(_0x3c373e){return _0x3c373e['update'](_0x2d7148)[_0x055e('0x1f')](function(_0x200b0b){return _0x200b0b;});}return null;};}function removeEntity(_0x18608d,_0x4ca15e){return function(_0x3acae9){if(_0x3acae9){return _0x3acae9[_0x055e('0x20')]()[_0x055e('0x1f')](function(){var _0x14830b=_0x3acae9[_0x055e('0x21')]({'plain':!![]});var _0x5591fd=_0x055e('0x22');return db[_0x055e('0x23')][_0x055e('0x20')]({'where':{'type':_0x5591fd,'resourceId':_0x14830b['id']}})[_0x055e('0x1f')](function(){return _0x3acae9;});})['then'](function(){_0x18608d[_0x055e('0x16')](0xcc)[_0x055e('0x17')]();});}};}function handleEntityNotFound(_0x2dd22e,_0x167549){return function(_0x5bd500){if(!_0x5bd500){_0x2dd22e[_0x055e('0x24')](0x194);}return _0x5bd500;};}function handleError(_0x15878d,_0x25349c){_0x25349c=_0x25349c||0x1f4;return function(_0x4926f1){logger[_0x055e('0x25')](_0x4926f1[_0x055e('0x26')]);if(_0x4926f1[_0x055e('0x27')]){delete _0x4926f1[_0x055e('0x27')];}_0x15878d[_0x055e('0x16')](_0x25349c)['send'](_0x4926f1);};}exports['index']=function(_0x547691,_0x1df3aa){var _0x3a9688={},_0x44019a={},_0x38e4c2={'count':0x0,'rows':[]};var _0xed9702=_[_0x055e('0x28')](db[_0x055e('0x29')][_0x055e('0x2a')],function(_0xde6dfc){return{'name':_0xde6dfc[_0x055e('0x2b')],'type':_0xde6dfc['type'][_0x055e('0x2c')]};});_0x44019a['model']=_[_0x055e('0x28')](_0xed9702,'name');_0x44019a[_0x055e('0x2d')]=_[_0x055e('0x2e')](_0x547691[_0x055e('0x2d')]);_0x44019a['filters']=_['intersection'](_0x44019a[_0x055e('0x2f')],_0x44019a[_0x055e('0x2d')]);_0x3a9688[_0x055e('0x30')]=_['intersection'](_0x44019a['model'],qs['fields'](_0x547691[_0x055e('0x2d')][_0x055e('0x31')]));_0x3a9688[_0x055e('0x30')]=_0x3a9688[_0x055e('0x30')][_0x055e('0x32')]?_0x3a9688['attributes']:_0x44019a['model'];if(!_0x547691[_0x055e('0x2d')][_0x055e('0x33')](_0x055e('0x34'))){_0x3a9688['limit']=qs[_0x055e('0x35')](_0x547691[_0x055e('0x2d')][_0x055e('0x35')]);_0x3a9688[_0x055e('0x1a')]=qs['offset'](_0x547691['query']['offset']);}_0x3a9688[_0x055e('0x36')]=qs[_0x055e('0x37')](_0x547691[_0x055e('0x2d')][_0x055e('0x37')]);_0x3a9688[_0x055e('0x38')]=qs[_0x055e('0x39')](_[_0x055e('0x3a')](_0x547691[_0x055e('0x2d')],_0x44019a[_0x055e('0x39')]),_0xed9702);if(_0x547691[_0x055e('0x2d')][_0x055e('0x3b')]){_0x3a9688[_0x055e('0x38')]=_[_0x055e('0x3c')](_0x3a9688[_0x055e('0x38')],{'$or':_[_0x055e('0x28')](_0xed9702,function(_0x1f01d8){if(_0x1f01d8[_0x055e('0x3d')]!==_0x055e('0x3e')){var _0x244d91={};_0x244d91[_0x1f01d8[_0x055e('0x27')]]={'$like':'%'+_0x547691[_0x055e('0x2d')]['filter']+'%'};return _0x244d91;}})});}_0x3a9688=_[_0x055e('0x3c')]({},_0x3a9688,_0x547691['options']);var _0x51e681={'where':_0x3a9688[_0x055e('0x38')]};return db[_0x055e('0x29')][_0x055e('0x19')](_0x51e681)[_0x055e('0x1f')](function(_0x44f02c){_0x38e4c2['count']=_0x44f02c;if(_0x547691[_0x055e('0x2d')][_0x055e('0x3f')]){_0x3a9688[_0x055e('0x40')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x3a9688);})[_0x055e('0x1f')](function(_0x36d54b){_0x38e4c2['rows']=_0x36d54b;return _0x38e4c2;})[_0x055e('0x1f')](respondWithFilteredResult(_0x1df3aa,_0x3a9688))[_0x055e('0x41')](handleError(_0x1df3aa,null));};exports['show']=function(_0x57233b,_0x5423ec){var _0x321c6a={'raw':!![],'where':{'id':_0x57233b[_0x055e('0x42')]['id']}},_0x4f6b0b={};_0x4f6b0b[_0x055e('0x2f')]=_[_0x055e('0x2e')](db['Tag'][_0x055e('0x2a')]);_0x4f6b0b[_0x055e('0x2d')]=_[_0x055e('0x2e')](_0x57233b['query']);_0x4f6b0b['filters']=_[_0x055e('0x43')](_0x4f6b0b['model'],_0x4f6b0b[_0x055e('0x2d')]);_0x321c6a[_0x055e('0x30')]=_[_0x055e('0x43')](_0x4f6b0b[_0x055e('0x2f')],qs[_0x055e('0x31')](_0x57233b['query']['fields']));_0x321c6a[_0x055e('0x30')]=_0x321c6a['attributes'][_0x055e('0x32')]?_0x321c6a[_0x055e('0x30')]:_0x4f6b0b[_0x055e('0x2f')];if(_0x57233b['query'][_0x055e('0x3f')]){_0x321c6a[_0x055e('0x40')]=[{'all':!![]}];}_0x321c6a=_[_0x055e('0x3c')]({},_0x321c6a,_0x57233b[_0x055e('0x44')]);return db[_0x055e('0x29')][_0x055e('0x45')](_0x321c6a)[_0x055e('0x1f')](handleEntityNotFound(_0x5423ec,null))[_0x055e('0x1f')](respondWithResult(_0x5423ec,null))[_0x055e('0x41')](handleError(_0x5423ec,null));};exports[_0x055e('0x46')]=function(_0x1af53f,_0x1e0d4a){return db[_0x055e('0x29')][_0x055e('0x46')](_0x1af53f[_0x055e('0x47')],{})[_0x055e('0x1f')](function(_0x312c01){var _0x3829ff=_0x1af53f['user'][_0x055e('0x21')]({'plain':!![]});if(!_0x3829ff)throw new Error(_0x055e('0x48'));if(_0x3829ff[_0x055e('0x49')]===_0x055e('0x4a')){var _0x193dc5=_0x312c01[_0x055e('0x21')]({'plain':!![]});var _0x327202=_0x055e('0x22');return db[_0x055e('0x4b')][_0x055e('0x45')]({'where':{'name':_0x327202,'userProfileId':_0x3829ff[_0x055e('0x4c')]},'raw':!![]})[_0x055e('0x1f')](function(_0x267a4f){if(_0x267a4f&&_0x267a4f[_0x055e('0x4d')]===0x0){return db[_0x055e('0x23')]['create']({'name':_0x193dc5['name'],'resourceId':_0x193dc5['id'],'type':_0x267a4f[_0x055e('0x27')],'sectionId':_0x267a4f['id']},{})[_0x055e('0x1f')](function(){return _0x312c01;});}else{return _0x312c01;}})[_0x055e('0x41')](function(_0x9d4471){logger[_0x055e('0x25')](_0x055e('0x4e'),_0x9d4471);throw _0x9d4471;});}return _0x312c01;})[_0x055e('0x1f')](respondWithResult(_0x1e0d4a,0xc9))[_0x055e('0x41')](handleError(_0x1e0d4a,null));};exports[_0x055e('0x4f')]=function(_0x3f71b9,_0x13ec14){if(_0x3f71b9[_0x055e('0x47')]['id']){delete _0x3f71b9['body']['id'];}return db[_0x055e('0x29')][_0x055e('0x45')]({'where':{'id':_0x3f71b9[_0x055e('0x42')]['id']}})[_0x055e('0x1f')](handleEntityNotFound(_0x13ec14,null))[_0x055e('0x1f')](saveUpdates(_0x3f71b9[_0x055e('0x47')],null))[_0x055e('0x1f')](respondWithResult(_0x13ec14,null))[_0x055e('0x41')](handleError(_0x13ec14,null));};exports[_0x055e('0x20')]=function(_0x40e31c,_0x1e244c){return db[_0x055e('0x29')][_0x055e('0x45')]({'where':{'id':_0x40e31c['params']['id']}})[_0x055e('0x1f')](handleEntityNotFound(_0x1e244c,null))[_0x055e('0x1f')](removeEntity(_0x1e244c,null))['catch'](handleError(_0x1e244c,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 55ba3cc..fd2082e 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 _0x2d03=['../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3a8dc1,_0x2f03b8){var _0x4b3595=function(_0x1c19e7){while(--_0x1c19e7){_0x3a8dc1['push'](_0x3a8dc1['shift']());}};_0x4b3595(++_0x2f03b8);}(_0x2d03,0x17a));var _0x32d0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2d03[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x32d0('0x0'));var util=require('util');var logger=require(_0x32d0('0x1'))('api');var moment=require(_0x32d0('0x2'));var BPromise=require(_0x32d0('0x3'));var rp=require(_0x32d0('0x4'));var fs=require('fs');var path=require(_0x32d0('0x5'));var rimraf=require('rimraf');var config=require(_0x32d0('0x6'));var attributes=require(_0x32d0('0x7'));module[_0x32d0('0x8')]=function(_0x4d7097,_0x4c7de0){return _0x4d7097[_0x32d0('0x9')](_0x32d0('0xa'),attributes,{'tableName':_0x32d0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c6c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','util','../../config/logger','api'];(function(_0x25c9a8,_0x444cdb){var _0x1791ff=function(_0x1ff9f2){while(--_0x1ff9f2){_0x25c9a8['push'](_0x25c9a8['shift']());}};_0x1791ff(++_0x444cdb);}(_0x3c6c,0x1f4));var _0xc3c6=function(_0x3825f5,_0x499c61){_0x3825f5=_0x3825f5-0x0;var _0x596010=_0x3c6c[_0x3825f5];return _0x596010;};'use strict';var _=require(_0xc3c6('0x0'));var util=require(_0xc3c6('0x1'));var logger=require(_0xc3c6('0x2'))(_0xc3c6('0x3'));var moment=require(_0xc3c6('0x4'));var BPromise=require(_0xc3c6('0x5'));var rp=require(_0xc3c6('0x6'));var fs=require('fs');var path=require(_0xc3c6('0x7'));var rimraf=require(_0xc3c6('0x8'));var config=require(_0xc3c6('0x9'));var attributes=require(_0xc3c6('0xa'));module['exports']=function(_0x55b919,_0x5b6d9f){return _0x55b919[_0xc3c6('0xb')](_0xc3c6('0xc'),attributes,{'tableName':_0xc3c6('0xd'),'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 be50e68..7b68056 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 _0x22fb=['Tag,\x20%s,\x20%s,\x20%s','code','message','error','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x13c66f,_0x295593){var _0x301ad9=function(_0x57964b){while(--_0x57964b){_0x13c66f['push'](_0x13c66f['shift']());}};_0x301ad9(++_0x295593);}(_0x22fb,0x192));var _0xb22f=function(_0x18254a,_0x2ef721){_0x18254a=_0x18254a-0x0;var _0x2f11b9=_0x22fb[_0x18254a];return _0x2f11b9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412a95,_0x367d4b,_0x47f61a){return new BPromise(function(_0x34433b,_0x22c509){return client[_0xb22f('0xa')](_0x412a95,_0x47f61a)[_0xb22f('0xb')](function(_0x1a3aae){logger[_0xb22f('0xc')](_0xb22f('0xd'),_0x367d4b,_0xb22f('0xe'));logger[_0xb22f('0xf')](_0xb22f('0x10'),_0x367d4b,_0xb22f('0xe'),JSON['stringify'](_0x1a3aae));if(_0x1a3aae['error']){if(_0x1a3aae['error'][_0xb22f('0x11')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x367d4b,_0x1a3aae['error'][_0xb22f('0x12')]);return _0x22c509(_0x1a3aae[_0xb22f('0x13')][_0xb22f('0x12')]);}logger[_0xb22f('0x13')](_0xb22f('0xd'),_0x367d4b,_0x1a3aae[_0xb22f('0x13')]['message']);return _0x34433b(_0x1a3aae[_0xb22f('0x13')]['message']);}else{logger[_0xb22f('0xc')]('Tag,\x20%s,\x20%s',_0x367d4b,_0xb22f('0xe'));_0x34433b(_0x1a3aae[_0xb22f('0x14')][_0xb22f('0x12')]);}})[_0xb22f('0x15')](function(_0x447eaf){logger['error'](_0xb22f('0xd'),_0x367d4b,_0x447eaf);_0x22c509(_0x447eaf);});});} \ No newline at end of file +var _0x2750=['jayson/promise','http','request','then','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4a3a73,_0x2a1b9d){var _0x53f116=function(_0x154f59){while(--_0x154f59){_0x4a3a73['push'](_0x4a3a73['shift']());}};_0x53f116(++_0x2a1b9d);}(_0x2750,0x13b));var _0x0275=function(_0x3e471d,_0x1e25e7){_0x3e471d=_0x3e471d-0x0;var _0xe3ba6a=_0x2750[_0x3e471d];return _0xe3ba6a;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2421fd,_0x2fa0eb,_0x2e4b5c){return new BPromise(function(_0x4dffd1,_0x1f7c4a){return client[_0x0275('0xc')](_0x2421fd,_0x2e4b5c)[_0x0275('0xd')](function(_0x5e0e4a){logger['info'](_0x0275('0xe'),_0x2fa0eb,'request\x20sent');logger[_0x0275('0xf')](_0x0275('0x10'),_0x2fa0eb,_0x0275('0x11'),JSON[_0x0275('0x12')](_0x5e0e4a));if(_0x5e0e4a[_0x0275('0x13')]){if(_0x5e0e4a['error'][_0x0275('0x14')]===0x1f4){logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a['error']['message']);return _0x1f7c4a(_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);}logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);return _0x4dffd1(_0x5e0e4a['error'][_0x0275('0x15')]);}else{logger[_0x0275('0x16')]('Tag,\x20%s,\x20%s',_0x2fa0eb,_0x0275('0x11'));_0x4dffd1(_0x5e0e4a[_0x0275('0x17')]['message']);}})[_0x0275('0x18')](function(_0x31c76b){logger['error']('Tag,\x20%s,\x20%s',_0x2fa0eb,_0x31c76b);_0x1f7c4a(_0x31c76b);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 0860b27..b5b4f3f 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 _0x894d=['index','show','getQueues','/:id/users','getAgents','post','create','/:id/queues','addQueues','addAgents','delete','/:id','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x34651f,_0x1b07dd){var _0x2d88fe=function(_0x1bc817){while(--_0x1bc817){_0x34651f['push'](_0x34651f['shift']());}};_0x2d88fe(++_0x1b07dd);}(_0x894d,0x186));var _0xd894=function(_0x560544,_0x330ba2){_0x560544=_0x560544-0x0;var _0x180ce7=_0x894d[_0x560544];return _0x180ce7;};'use strict';var multer=require(_0xd894('0x0'));var util=require(_0xd894('0x1'));var path=require(_0xd894('0x2'));var timeout=require(_0xd894('0x3'));var express=require(_0xd894('0x4'));var router=express['Router']();var auth=require(_0xd894('0x5'));var interaction=require(_0xd894('0x6'));var config=require(_0xd894('0x7'));var controller=require('./team.controller');router[_0xd894('0x8')]('/',auth[_0xd894('0x9')](),controller[_0xd894('0xa')]);router[_0xd894('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd894('0xb')]);router['get']('/:id/queues',auth[_0xd894('0x9')](),controller[_0xd894('0xc')]);router[_0xd894('0x8')](_0xd894('0xd'),auth['isAuthenticated'](),controller[_0xd894('0xe')]);router[_0xd894('0xf')]('/',auth[_0xd894('0x9')](),controller[_0xd894('0x10')]);router[_0xd894('0xf')](_0xd894('0x11'),auth[_0xd894('0x9')](),controller[_0xd894('0x12')]);router[_0xd894('0xf')]('/:id/users',auth[_0xd894('0x9')](),controller[_0xd894('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd894('0x14')](_0xd894('0x15'),auth[_0xd894('0x9')](),controller[_0xd894('0x16')]);router['delete'](_0xd894('0x11'),auth[_0xd894('0x9')](),controller['removeQueues']);router[_0xd894('0x14')](_0xd894('0xd'),auth[_0xd894('0x9')](),controller[_0xd894('0x17')]);module[_0xd894('0x18')]=router; \ No newline at end of file +var _0xc694=['destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./team.controller','index','get','isAuthenticated','show','/:id/queues','getQueues','getAgents','post','addQueues','/:id/users','addAgents','put','/:id','update','delete'];(function(_0x4ee251,_0x201902){var _0x297f65=function(_0x39621f){while(--_0x39621f){_0x4ee251['push'](_0x4ee251['shift']());}};_0x297f65(++_0x201902);}(_0xc694,0xca));var _0x4c69=function(_0x4d3a9b,_0x20b47d){_0x4d3a9b=_0x4d3a9b-0x0;var _0x1b5471=_0xc694[_0x4d3a9b];return _0x1b5471;};'use strict';var multer=require(_0x4c69('0x0'));var util=require(_0x4c69('0x1'));var path=require(_0x4c69('0x2'));var timeout=require(_0x4c69('0x3'));var express=require(_0x4c69('0x4'));var router=express[_0x4c69('0x5')]();var auth=require(_0x4c69('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4c69('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4c69('0x8')]);router[_0x4c69('0x9')]('/:id',auth[_0x4c69('0xa')](),controller[_0x4c69('0xb')]);router[_0x4c69('0x9')](_0x4c69('0xc'),auth[_0x4c69('0xa')](),controller[_0x4c69('0xd')]);router[_0x4c69('0x9')]('/:id/users',auth[_0x4c69('0xa')](),controller[_0x4c69('0xe')]);router[_0x4c69('0xf')]('/',auth[_0x4c69('0xa')](),controller['create']);router['post'](_0x4c69('0xc'),auth['isAuthenticated'](),controller[_0x4c69('0x10')]);router[_0x4c69('0xf')](_0x4c69('0x11'),auth[_0x4c69('0xa')](),controller[_0x4c69('0x12')]);router[_0x4c69('0x13')](_0x4c69('0x14'),auth[_0x4c69('0xa')](),controller[_0x4c69('0x15')]);router[_0x4c69('0x16')](_0x4c69('0x14'),auth[_0x4c69('0xa')](),controller[_0x4c69('0x17')]);router[_0x4c69('0x16')](_0x4c69('0xc'),auth[_0x4c69('0xa')](),controller['removeQueues']);router['delete'](_0x4c69('0x11'),auth['isAuthenticated'](),controller[_0x4c69('0x18')]);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 4f7dce7..0814f49 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 _0xb9e2=['name','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb9e2,0x1d5));var _0x2b9e=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0xb9e2[_0x59befa];return _0x1dd63d;};'use strict';var Sequelize=require('sequelize');module[_0x2b9e('0x0')]={'name':{'type':Sequelize[_0x2b9e('0x1')],'allowNull':![],'unique':_0x2b9e('0x2')},'description':{'type':Sequelize[_0x2b9e('0x1')]}}; \ No newline at end of file +var _0xcaa1=['sequelize','exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcaa1,0x1b0));var _0x1caa=function(_0x443835,_0x287972){_0x443835=_0x443835-0x0;var _0xe0a66e=_0xcaa1[_0x443835];return _0xe0a66e;};'use strict';var Sequelize=require(_0x1caa('0x0'));module[_0x1caa('0x1')]={'name':{'type':Sequelize[_0x1caa('0x2')],'allowNull':![],'unique':_0x1caa('0x3')},'description':{'type':Sequelize[_0x1caa('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 667685a..8e5afab 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 _0xd420=['voice','chat','mail','fax','openchannel','whatsapp','removeAgents','UserVoiceQueueRt','userTeam:remove','getAgents','User','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','status','offset','limit','set','Content-Range','json','save','update','destroy','then','Teams','UserProfileResource','sendStatus','error','name','send','index','map','Team','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','keys','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','capitalize','toLowerCase','order','Queues','Unknown\x20channel','ids','removeQueues','remove','addAgents','Voice','Mail','Fax','Openchannel','each','findAll','interface','upsert','isNil','format','SIP/%s','voicePause','spread','emit','userTeam:save'];(function(_0x5d58e3,_0x5dcf8d){var _0x1c56c3=function(_0x171bbd){while(--_0x171bbd){_0x5d58e3['push'](_0x5d58e3['shift']());}};_0x1c56c3(++_0x5dcf8d);}(_0xd420,0x89));var _0x0d42=function(_0x4e8ff8,_0x8822c0){_0x4e8ff8=_0x4e8ff8-0x0;var _0x585e57=_0xd420[_0x4e8ff8];return _0x585e57;};'use strict';var pdf=require(_0x0d42('0x0'));var emlformat=require(_0x0d42('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0d42('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d42('0x3'));var moment=require(_0x0d42('0x4'));var BPromise=require(_0x0d42('0x5'));var Mustache=require(_0x0d42('0x6'));var util=require(_0x0d42('0x7'));var path=require(_0x0d42('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d42('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0d42('0xa'));var crypto=require('crypto');var jsforce=require(_0x0d42('0xb'));var deskjs=require(_0x0d42('0xc'));var toCsv=require(_0x0d42('0xd'));var querystring=require(_0x0d42('0xe'));var Papa=require(_0x0d42('0xf'));var Redis=require(_0x0d42('0x10'));var authService=require(_0x0d42('0x11'));var qs=require(_0x0d42('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d42('0x13'));var logger=require('../../config/logger')(_0x0d42('0x14'));var utils=require(_0x0d42('0x15'));var config=require('../../config/environment');var db=require(_0x0d42('0x16'))['db'];config[_0x0d42('0x17')]=_[_0x0d42('0x18')](config[_0x0d42('0x17')],{'host':_0x0d42('0x19'),'port':0x18eb});var socket=require(_0x0d42('0x1a'))(new Redis(config[_0x0d42('0x17')]));require(_0x0d42('0x1b'))['register'](socket);function respondWithStatusCode(_0x262cab,_0x33877e){_0x33877e=_0x33877e||0xcc;return function(_0x4a4807){if(_0x4a4807){return _0x262cab['sendStatus'](_0x33877e);}return _0x262cab[_0x0d42('0x1c')](_0x33877e)['end']();};}function respondWithResult(_0x1b643e,_0x2a334e){_0x2a334e=_0x2a334e||0xc8;return function(_0x12ba17){if(_0x12ba17){return _0x1b643e[_0x0d42('0x1c')](_0x2a334e)['json'](_0x12ba17);}};}function respondWithFilteredResult(_0x57c024,_0x8253bb){return function(_0x5c59c4){if(_0x5c59c4){var _0x3c8678=_0x5c59c4['count'],_0xe228e9=_0x8253bb[_0x0d42('0x1d')],_0x42ada6=_0x8253bb[_0x0d42('0x1d')]+_0x8253bb[_0x0d42('0x1e')],_0x11f039;if(_0x42ada6>=_0x3c8678){_0x42ada6=_0x3c8678;_0x11f039=0xc8;}else{_0x11f039=0xce;}_0x57c024['status'](_0x11f039);return _0x57c024[_0x0d42('0x1f')](_0x0d42('0x20'),_0xe228e9+'-'+_0x42ada6+'/'+_0x3c8678)[_0x0d42('0x21')](_0x5c59c4);}return null;};}function patchUpdates(_0x59003e){return function(_0x22941b){try{jsonpatch['apply'](_0x22941b,_0x59003e,!![]);}catch(_0xe9dab4){return BPromise['reject'](_0xe9dab4);}return _0x22941b[_0x0d42('0x22')]();};}function saveUpdates(_0x185a35,_0x2584ca){return function(_0x1cab79){if(_0x1cab79){return _0x1cab79[_0x0d42('0x23')](_0x185a35)['then'](function(_0x306cbd){return _0x306cbd;});}return null;};}function removeEntity(_0x96fc00,_0x5adf13){return function(_0x45f49e){if(_0x45f49e){return _0x45f49e[_0x0d42('0x24')]()[_0x0d42('0x25')](function(){var _0x4b208d=_0x45f49e['get']({'plain':!![]});var _0x587c2f=_0x0d42('0x26');return db[_0x0d42('0x27')][_0x0d42('0x24')]({'where':{'type':_0x587c2f,'resourceId':_0x4b208d['id']}})[_0x0d42('0x25')](function(){return _0x45f49e;});})[_0x0d42('0x25')](function(){_0x96fc00[_0x0d42('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c3332,_0x767d8e){return function(_0x644e11){if(!_0x644e11){_0x5c3332[_0x0d42('0x28')](0x194);}return _0x644e11;};}function handleError(_0x25fc7f,_0x161689){_0x161689=_0x161689||0x1f4;return function(_0x55f102){logger[_0x0d42('0x29')](_0x55f102['stack']);if(_0x55f102[_0x0d42('0x2a')]){delete _0x55f102['name'];}_0x25fc7f[_0x0d42('0x1c')](_0x161689)[_0x0d42('0x2b')](_0x55f102);};}exports[_0x0d42('0x2c')]=function(_0x318615,_0x221e88){var _0x10b34e={},_0x15be6b={},_0x3858ab={'count':0x0,'rows':[]};var _0x1ba756=_[_0x0d42('0x2d')](db[_0x0d42('0x2e')][_0x0d42('0x2f')],function(_0x45b978){return{'name':_0x45b978[_0x0d42('0x30')],'type':_0x45b978['type'][_0x0d42('0x31')]};});_0x15be6b['model']=_[_0x0d42('0x2d')](_0x1ba756,'name');_0x15be6b[_0x0d42('0x32')]=_['keys'](_0x318615[_0x0d42('0x32')]);_0x15be6b[_0x0d42('0x33')]=_[_0x0d42('0x34')](_0x15be6b[_0x0d42('0x35')],_0x15be6b[_0x0d42('0x32')]);_0x10b34e['attributes']=_['intersection'](_0x15be6b[_0x0d42('0x35')],qs[_0x0d42('0x36')](_0x318615[_0x0d42('0x32')]['fields']));_0x10b34e['attributes']=_0x10b34e[_0x0d42('0x37')][_0x0d42('0x38')]?_0x10b34e['attributes']:_0x15be6b[_0x0d42('0x35')];if(!_0x318615[_0x0d42('0x32')][_0x0d42('0x39')](_0x0d42('0x3a'))){_0x10b34e[_0x0d42('0x1e')]=qs[_0x0d42('0x1e')](_0x318615[_0x0d42('0x32')][_0x0d42('0x1e')]);_0x10b34e['offset']=qs[_0x0d42('0x1d')](_0x318615[_0x0d42('0x32')]['offset']);}_0x10b34e['order']=qs[_0x0d42('0x3b')](_0x318615['query'][_0x0d42('0x3b')]);_0x10b34e[_0x0d42('0x3c')]=qs['filters'](_[_0x0d42('0x3d')](_0x318615[_0x0d42('0x32')],_0x15be6b['filters']),_0x1ba756);if(_0x318615[_0x0d42('0x32')][_0x0d42('0x3e')]){_0x10b34e['where']=_['merge'](_0x10b34e[_0x0d42('0x3c')],{'$or':_[_0x0d42('0x2d')](_0x1ba756,function(_0x352fb4){if(_0x352fb4[_0x0d42('0x3f')]!==_0x0d42('0x40')){var _0x36413f={};_0x36413f[_0x352fb4[_0x0d42('0x2a')]]={'$like':'%'+_0x318615[_0x0d42('0x32')][_0x0d42('0x3e')]+'%'};return _0x36413f;}})});}_0x10b34e=_['merge']({},_0x10b34e,_0x318615[_0x0d42('0x41')]);var _0x2bb11a={'where':_0x10b34e[_0x0d42('0x3c')]};return db[_0x0d42('0x2e')][_0x0d42('0x42')](_0x2bb11a)[_0x0d42('0x25')](function(_0x28ba3c){_0x3858ab['count']=_0x28ba3c;if(_0x318615[_0x0d42('0x32')][_0x0d42('0x43')]){_0x10b34e[_0x0d42('0x44')]=[{'all':!![]}];}return db['Team']['findAll'](_0x10b34e);})['then'](function(_0x274149){_0x3858ab[_0x0d42('0x45')]=_0x274149;return _0x3858ab;})[_0x0d42('0x25')](respondWithFilteredResult(_0x221e88,_0x10b34e))[_0x0d42('0x46')](handleError(_0x221e88,null));};exports[_0x0d42('0x47')]=function(_0x3b93ab,_0x43c569){var _0xdb6f83={'raw':![],'where':{'id':_0x3b93ab[_0x0d42('0x48')]['id']}},_0x4b9eb3={};_0x4b9eb3['model']=_[_0x0d42('0x49')](db[_0x0d42('0x2e')][_0x0d42('0x2f')]);_0x4b9eb3[_0x0d42('0x32')]=_[_0x0d42('0x49')](_0x3b93ab[_0x0d42('0x32')]);_0x4b9eb3['filters']=_[_0x0d42('0x34')](_0x4b9eb3[_0x0d42('0x35')],_0x4b9eb3[_0x0d42('0x32')]);_0xdb6f83[_0x0d42('0x37')]=_[_0x0d42('0x34')](_0x4b9eb3['model'],qs['fields'](_0x3b93ab['query']['fields']));_0xdb6f83['attributes']=_0xdb6f83[_0x0d42('0x37')][_0x0d42('0x38')]?_0xdb6f83[_0x0d42('0x37')]:_0x4b9eb3['model'];if(_0x3b93ab[_0x0d42('0x32')][_0x0d42('0x43')]){_0xdb6f83[_0x0d42('0x44')]=[{'all':!![]}];}_0xdb6f83=_[_0x0d42('0x4a')]({},_0xdb6f83,_0x3b93ab[_0x0d42('0x41')]);return db['Team'][_0x0d42('0x4b')](_0xdb6f83)[_0x0d42('0x25')](handleEntityNotFound(_0x43c569,null))['then'](respondWithResult(_0x43c569,null))['catch'](handleError(_0x43c569,null));};exports[_0x0d42('0x4c')]=function(_0x446021,_0x16e659){return db['Team'][_0x0d42('0x4c')](_0x446021[_0x0d42('0x4d')],{})[_0x0d42('0x25')](function(_0x1d4fdd){var _0x2aa6d7=_0x446021[_0x0d42('0x4e')]['get']({'plain':!![]});if(!_0x2aa6d7)throw new Error(_0x0d42('0x4f'));if(_0x2aa6d7[_0x0d42('0x50')]===_0x0d42('0x4e')){var _0x5f0709=_0x1d4fdd[_0x0d42('0x51')]({'plain':!![]});var _0x39fe85=_0x0d42('0x26');return db[_0x0d42('0x52')][_0x0d42('0x4b')]({'where':{'name':_0x39fe85,'userProfileId':_0x2aa6d7[_0x0d42('0x53')]},'raw':!![]})[_0x0d42('0x25')](function(_0x38537c){if(_0x38537c&&_0x38537c[_0x0d42('0x54')]===0x0){return db[_0x0d42('0x27')][_0x0d42('0x4c')]({'name':_0x5f0709[_0x0d42('0x2a')],'resourceId':_0x5f0709['id'],'type':_0x38537c[_0x0d42('0x2a')],'sectionId':_0x38537c['id']},{})['then'](function(){return _0x1d4fdd;});}else{return _0x1d4fdd;}})['catch'](function(_0x531844){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x531844);throw _0x531844;});}return _0x1d4fdd;})['then'](respondWithResult(_0x16e659,0xc9))[_0x0d42('0x46')](handleError(_0x16e659,null));};exports[_0x0d42('0x23')]=function(_0x3890a8,_0x28f165){if(_0x3890a8[_0x0d42('0x4d')]['id']){delete _0x3890a8['body']['id'];}return db['Team']['find']({'where':{'id':_0x3890a8[_0x0d42('0x48')]['id']}})['then'](handleEntityNotFound(_0x28f165,null))[_0x0d42('0x25')](saveUpdates(_0x3890a8[_0x0d42('0x4d')],null))['then'](respondWithResult(_0x28f165,null))[_0x0d42('0x46')](handleError(_0x28f165,null));};exports[_0x0d42('0x24')]=function(_0x881af5,_0x735ee6){return db[_0x0d42('0x2e')]['find']({'where':{'id':_0x881af5['params']['id']}})[_0x0d42('0x25')](handleEntityNotFound(_0x735ee6,null))[_0x0d42('0x25')](removeEntity(_0x735ee6,null))[_0x0d42('0x46')](handleError(_0x735ee6,null));};exports[_0x0d42('0x55')]=function(_0x124bfe,_0x4e97b8,_0x54625c){return db[_0x0d42('0x2e')][_0x0d42('0x56')]({'where':{'id':_0x124bfe[_0x0d42('0x48')]['id']}})['then'](handleEntityNotFound(_0x4e97b8,null))[_0x0d42('0x25')](function(_0x3bebaa){if(!_0x124bfe[_0x0d42('0x32')][_0x0d42('0x57')]||!utils[_0x0d42('0x58')](_0x124bfe[_0x0d42('0x32')][_0x0d42('0x57')])){throw new db[(_0x0d42('0x59'))][(_0x0d42('0x5a'))]('Unknown\x20channel');}var _0x40f3ed={};var _0x427153={};_0x427153[_0x0d42('0x35')]=_[_0x0d42('0x49')](db[_[_0x0d42('0x5b')](_0x124bfe[_0x0d42('0x32')]['channel'][_0x0d42('0x5c')]())+'Queue'][_0x0d42('0x2f')]);_0x427153['query']=_[_0x0d42('0x49')](_0x124bfe[_0x0d42('0x32')]);_0x427153[_0x0d42('0x33')]=_[_0x0d42('0x34')](_0x427153['model'],_0x427153[_0x0d42('0x32')]);_0x40f3ed[_0x0d42('0x37')]=_[_0x0d42('0x34')](_0x427153['model'],qs[_0x0d42('0x36')](_0x124bfe['query']['fields']));_0x40f3ed[_0x0d42('0x37')]=_0x40f3ed[_0x0d42('0x37')][_0x0d42('0x38')]?_0x40f3ed[_0x0d42('0x37')]:_0x427153[_0x0d42('0x35')];_0x40f3ed['limit']=qs['limit'](_0x124bfe[_0x0d42('0x32')]['limit']);_0x40f3ed[_0x0d42('0x1d')]=qs[_0x0d42('0x1d')](_0x124bfe['query']['offset']);_0x40f3ed[_0x0d42('0x5d')]=qs[_0x0d42('0x3b')](_0x124bfe[_0x0d42('0x32')][_0x0d42('0x3b')]);_0x40f3ed['where']=qs[_0x0d42('0x33')](_['pick'](_0x124bfe['query'],_0x427153[_0x0d42('0x33')]));_0x40f3ed=_[_0x0d42('0x4a')]({},_0x40f3ed,_0x124bfe['options']);return _0x3bebaa[_0x0d42('0x51')+_[_0x0d42('0x5b')](_0x124bfe[_0x0d42('0x32')][_0x0d42('0x57')][_0x0d42('0x5c')]())+_0x0d42('0x5e')](_0x40f3ed);})['then'](respondWithResult(_0x4e97b8,null))[_0x0d42('0x46')](handleError(_0x4e97b8,null));};exports['addQueues']=function(_0x4a085d,_0x213154,_0x5d90b6){return db[_0x0d42('0x2e')][_0x0d42('0x56')]({'where':{'id':_0x4a085d[_0x0d42('0x48')]['id']}})[_0x0d42('0x25')](function(_0x5f561a){if(_0x5f561a){if(!_0x4a085d[_0x0d42('0x4d')][_0x0d42('0x57')]||!utils[_0x0d42('0x58')](_0x4a085d[_0x0d42('0x4d')]['channel'])){throw new db['Sequelize'][(_0x0d42('0x5a'))](_0x0d42('0x5f'));}return _0x5f561a['add'+_['capitalize'](_0x4a085d['body'][_0x0d42('0x57')][_0x0d42('0x5c')]())+'Queues'](_0x4a085d[_0x0d42('0x4d')][_0x0d42('0x60')]);}return null;})[_0x0d42('0x25')](handleEntityNotFound(_0x213154,null))[_0x0d42('0x25')](respondWithStatusCode(_0x213154,null))[_0x0d42('0x46')](handleError(_0x213154,null));};exports[_0x0d42('0x61')]=function(_0x46810d,_0x345d3f,_0x324bb0){return db[_0x0d42('0x2e')][_0x0d42('0x56')]({'where':{'id':_0x46810d[_0x0d42('0x48')]['id']}})[_0x0d42('0x25')](function(_0xb55261){if(_0xb55261){if(!_0x46810d[_0x0d42('0x32')][_0x0d42('0x57')]||!utils[_0x0d42('0x58')](_0x46810d[_0x0d42('0x32')]['channel'])){throw new db[(_0x0d42('0x59'))][(_0x0d42('0x5a'))](_0x0d42('0x5f'));}return _0xb55261[_0x0d42('0x62')+_['capitalize'](_0x46810d['query'][_0x0d42('0x57')]['toLowerCase']())+_0x0d42('0x5e')](_0x46810d[_0x0d42('0x32')][_0x0d42('0x60')]);}return null;})[_0x0d42('0x25')](handleEntityNotFound(_0x345d3f,null))['then'](respondWithStatusCode(_0x345d3f,null))[_0x0d42('0x46')](handleError(_0x345d3f,null));};exports[_0x0d42('0x63')]=function(_0x3e4690,_0x5893d4,_0x1dbeb6){return db[_0x0d42('0x2e')][_0x0d42('0x4b')]({'where':{'id':_0x3e4690[_0x0d42('0x48')]['id']}})[_0x0d42('0x25')](handleEntityNotFound(_0x5893d4,null))[_0x0d42('0x25')](function(_0x4ca3a6){if(_0x4ca3a6){var _0x546474=[_0x0d42('0x64'),'Chat',_0x0d42('0x65'),'Sms',_0x0d42('0x66'),_0x0d42('0x67'),'Whatsapp'];return BPromise['each'](_0x546474,function(_0x243f28){return _0x4ca3a6[_0x0d42('0x51')+_0x243f28+'Queues']({'attributes':['id',_0x0d42('0x2a')]})[_0x0d42('0x25')](function(_0x1d9a00){return BPromise[_0x0d42('0x68')](_0x1d9a00,function(_0x4ea39d){return _0x4ea39d[_0x0d42('0x63')](_0x3e4690[_0x0d42('0x4d')][_0x0d42('0x60')])['then'](function(){if(_0x243f28==='Voice'){return db['User'][_0x0d42('0x69')]({'where':{'id':_0x3e4690[_0x0d42('0x4d')][_0x0d42('0x60')]},'attributes':['id',_0x0d42('0x2a'),'online','voicePause',_0x0d42('0x6a')],'raw':!![]})[_0x0d42('0x25')](function(_0x93c549){return BPromise[_0x0d42('0x68')](_[_0x0d42('0x3e')](_0x93c549,{'online':0x1}),function(_0x1ba110){return db['UserVoiceQueueRt'][_0x0d42('0x6b')]({'membername':_0x1ba110[_0x0d42('0x2a')],'UserId':_0x1ba110['id'],'queue_name':_0x4ea39d['name'],'VoiceQueueId':_0x4ea39d['id'],'interface':_[_0x0d42('0x6c')](_0x1ba110[_0x0d42('0x6a')])?util[_0x0d42('0x6d')](_0x0d42('0x6e'),_0x1ba110['name']):_0x1ba110['interface'],'paused':_0x1ba110[_0x0d42('0x6f')]||![],'penalty':0x0});});});}});});})['then'](function(){return _0x4ca3a6;});})['then'](function(){return _0x4ca3a6;});}})[_0x0d42('0x25')](function(_0x3a7f99){if(_0x3a7f99){return _0x3a7f99['addAgents'](_0x3e4690['body']['ids'],_['omit'](_0x3e4690[_0x0d42('0x4d')],[_0x0d42('0x60'),'id'])||{})[_0x0d42('0x70')](function(_0x5756c8){for(var _0x43cfcc=0x0;_0x43cfcc<_0x3e4690[_0x0d42('0x4d')][_0x0d42('0x60')][_0x0d42('0x38')];_0x43cfcc+=0x1){socket[_0x0d42('0x71')](_0x0d42('0x72'),{'UserId':_0x3e4690[_0x0d42('0x4d')][_0x0d42('0x60')][_0x43cfcc],'TeamId':_0x3e4690[_0x0d42('0x48')]['id']});}return _0x5756c8;});}})[_0x0d42('0x25')](respondWithResult(_0x5893d4,null))[_0x0d42('0x46')](handleError(_0x5893d4,null));};exports['removeAgents']=function(_0x317705,_0x5e5892,_0x507c46){return db[_0x0d42('0x2e')][_0x0d42('0x4b')]({'where':{'id':_0x317705[_0x0d42('0x48')]['id']}})[_0x0d42('0x25')](handleEntityNotFound(_0x5e5892,null))[_0x0d42('0x25')](function(_0x27c758){if(_0x27c758){return BPromise['each']([_0x0d42('0x73'),_0x0d42('0x74'),_0x0d42('0x75'),'sms',_0x0d42('0x76'),_0x0d42('0x77'),_0x0d42('0x78')],function(_0x517810){return _0x27c758[_0x0d42('0x51')+_[_0x0d42('0x5b')](_0x517810)+_0x0d42('0x5e')]({'attributes':['id',_0x0d42('0x2a')]})[_0x0d42('0x25')](function(_0xc7b8e1){return BPromise[_0x0d42('0x68')](_0xc7b8e1,function(_0x169307){return _0x169307[_0x0d42('0x79')](_0x317705[_0x0d42('0x32')]['ids'])[_0x0d42('0x25')](function(){if(_0x517810===_0x0d42('0x73')){return db[_0x0d42('0x7a')][_0x0d42('0x24')]({'where':{'VoiceQueueId':_0x169307['id'],'UserId':_0x317705[_0x0d42('0x32')][_0x0d42('0x60')]}});}});});})[_0x0d42('0x25')](function(){return _0x27c758;});})[_0x0d42('0x25')](function(){return _0x27c758;});}})['then'](function(_0x42cc8f){if(_0x42cc8f){return _0x42cc8f['removeAgents'](_0x317705[_0x0d42('0x32')][_0x0d42('0x60')])[_0x0d42('0x25')](function(){if(_['isArray'](_0x317705[_0x0d42('0x32')]['ids'])){for(var _0x26f5b2=0x0;_0x26f5b2<_0x317705[_0x0d42('0x32')][_0x0d42('0x60')][_0x0d42('0x38')];_0x26f5b2+=0x1){socket['emit'](_0x0d42('0x7b'),{'UserId':Number(_0x317705['query'][_0x0d42('0x60')][_0x26f5b2]),'TeamId':Number(_0x317705[_0x0d42('0x48')]['id'])});}}else{socket[_0x0d42('0x71')](_0x0d42('0x7b'),{'UserId':Number(_0x317705[_0x0d42('0x32')]['ids']),'TeamId':Number(_0x317705[_0x0d42('0x48')]['id'])});}});}})[_0x0d42('0x25')](respondWithStatusCode(_0x5e5892,null))[_0x0d42('0x46')](handleError(_0x5e5892,null));};exports[_0x0d42('0x7c')]=function(_0x166cdb,_0x1e16cc,_0x1d289b){var _0x1f8af4={};var _0x23c059={};var _0x165ea2;var _0x4d9283;return db[_0x0d42('0x2e')][_0x0d42('0x56')]({'where':{'id':_0x166cdb[_0x0d42('0x48')]['id']}})[_0x0d42('0x25')](handleEntityNotFound(_0x1e16cc,null))[_0x0d42('0x25')](function(_0x5cc056){if(_0x5cc056){_0x165ea2=_0x5cc056;_0x23c059[_0x0d42('0x35')]=_[_0x0d42('0x49')](db[_0x0d42('0x7d')][_0x0d42('0x2f')]);_0x23c059['query']=_[_0x0d42('0x49')](_0x166cdb[_0x0d42('0x32')]);_0x23c059['filters']=_[_0x0d42('0x34')](_0x23c059['model'],_0x23c059[_0x0d42('0x32')]);_0x1f8af4[_0x0d42('0x37')]=_[_0x0d42('0x34')](_0x23c059[_0x0d42('0x35')],qs[_0x0d42('0x36')](_0x166cdb[_0x0d42('0x32')][_0x0d42('0x36')]));_0x1f8af4['attributes']=_0x1f8af4[_0x0d42('0x37')]['length']?_0x1f8af4[_0x0d42('0x37')]:_0x23c059[_0x0d42('0x35')];_0x1f8af4[_0x0d42('0x5d')]=qs[_0x0d42('0x3b')](_0x166cdb[_0x0d42('0x32')]['sort']);_0x1f8af4['where']=qs[_0x0d42('0x33')](_['pick'](_0x166cdb[_0x0d42('0x32')],_0x23c059[_0x0d42('0x33')]));if(_0x166cdb[_0x0d42('0x32')]['filter']){_0x1f8af4['where']=_[_0x0d42('0x4a')](_0x1f8af4[_0x0d42('0x3c')],{'$or':_[_0x0d42('0x2d')](_0x1f8af4[_0x0d42('0x37')],function(_0x415f42){var _0x52b0aa={};_0x52b0aa[_0x415f42]={'$like':'%'+_0x166cdb['query'][_0x0d42('0x3e')]+'%'};return _0x52b0aa;})});}_0x1f8af4=_[_0x0d42('0x4a')]({},_0x1f8af4,_0x166cdb['options']);return _0x165ea2[_0x0d42('0x7c')](_0x1f8af4);}})['then'](function(_0x33c4fb){if(_0x33c4fb){_0x4d9283=_0x33c4fb[_0x0d42('0x38')];if(!_0x166cdb[_0x0d42('0x32')]['hasOwnProperty']('nolimit')){_0x1f8af4['limit']=qs['limit'](_0x166cdb[_0x0d42('0x32')][_0x0d42('0x1e')]);_0x1f8af4['offset']=qs[_0x0d42('0x1d')](_0x166cdb['query'][_0x0d42('0x1d')]);}return _0x165ea2[_0x0d42('0x7c')](_0x1f8af4);}})[_0x0d42('0x25')](function(_0x39681b){if(_0x39681b){return _0x39681b?{'count':_0x4d9283,'rows':_0x39681b}:null;}})[_0x0d42('0x25')](respondWithResult(_0x1e16cc,null))['catch'](handleError(_0x1e16cc,null));}; \ No newline at end of file +var _0x88e8=['nolimit','order','sort','where','pick','merge','VIRTUAL','options','Team','count','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','user','Teams','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','isValidChannel','add','Queues','ids','removeQueues','Sequelize','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','User','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','format','SIP/%s','omit','length','emit','userTeam:save','removeAgents','voice','sms','fax','userTeam:remove','filter','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','./team.socket','register','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','get','UserProfileResource','then','sendStatus','error','stack','name','send','index','fieldName','model','map','query','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x28469e,_0xd2c0c9){var _0x41109e=function(_0x3ce152){while(--_0x3ce152){_0x28469e['push'](_0x28469e['shift']());}};_0x41109e(++_0xd2c0c9);}(_0x88e8,0xc8));var _0x888e=function(_0x3a99f4,_0x2a81c1){_0x3a99f4=_0x3a99f4-0x0;var _0xea0b42=_0x88e8[_0x3a99f4];return _0xea0b42;};'use strict';var pdf=require(_0x888e('0x0'));var emlformat=require(_0x888e('0x1'));var rimraf=require(_0x888e('0x2'));var zipdir=require(_0x888e('0x3'));var jsonpatch=require(_0x888e('0x4'));var rp=require(_0x888e('0x5'));var moment=require(_0x888e('0x6'));var BPromise=require(_0x888e('0x7'));var Mustache=require(_0x888e('0x8'));var util=require(_0x888e('0x9'));var path=require(_0x888e('0xa'));var sox=require(_0x888e('0xb'));var csv=require(_0x888e('0xc'));var ejs=require(_0x888e('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x888e('0xe'));var crypto=require(_0x888e('0xf'));var jsforce=require(_0x888e('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x888e('0x11'));var Papa=require('papaparse');var Redis=require(_0x888e('0x12'));var authService=require(_0x888e('0x13'));var qs=require(_0x888e('0x14'));var as=require(_0x888e('0x15'));var hardwareService=require(_0x888e('0x16'));var logger=require(_0x888e('0x17'))('api');var utils=require(_0x888e('0x18'));var config=require('../../config/environment');var db=require(_0x888e('0x19'))['db'];config[_0x888e('0x1a')]=_[_0x888e('0x1b')](config[_0x888e('0x1a')],{'host':_0x888e('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x888e('0x1a')]));require(_0x888e('0x1d'))[_0x888e('0x1e')](socket);function respondWithStatusCode(_0x5a3e90,_0x5a6274){_0x5a6274=_0x5a6274||0xcc;return function(_0x5e80fc){if(_0x5e80fc){return _0x5a3e90['sendStatus'](_0x5a6274);}return _0x5a3e90[_0x888e('0x1f')](_0x5a6274)[_0x888e('0x20')]();};}function respondWithResult(_0x20716e,_0x590b0e){_0x590b0e=_0x590b0e||0xc8;return function(_0x1b4a92){if(_0x1b4a92){return _0x20716e[_0x888e('0x1f')](_0x590b0e)[_0x888e('0x21')](_0x1b4a92);}};}function respondWithFilteredResult(_0x276f53,_0x371f2d){return function(_0x22e2a3){if(_0x22e2a3){var _0x825cdd=_0x22e2a3['count'],_0x46b60f=_0x371f2d[_0x888e('0x22')],_0x4c04b2=_0x371f2d[_0x888e('0x22')]+_0x371f2d[_0x888e('0x23')],_0x248fd6;if(_0x4c04b2>=_0x825cdd){_0x4c04b2=_0x825cdd;_0x248fd6=0xc8;}else{_0x248fd6=0xce;}_0x276f53['status'](_0x248fd6);return _0x276f53[_0x888e('0x24')](_0x888e('0x25'),_0x46b60f+'-'+_0x4c04b2+'/'+_0x825cdd)[_0x888e('0x21')](_0x22e2a3);}return null;};}function patchUpdates(_0x17c513){return function(_0x4f76f7){try{jsonpatch['apply'](_0x4f76f7,_0x17c513,!![]);}catch(_0x425c62){return BPromise[_0x888e('0x26')](_0x425c62);}return _0x4f76f7[_0x888e('0x27')]();};}function saveUpdates(_0x3d4a9e,_0x4dedda){return function(_0x53e073){if(_0x53e073){return _0x53e073[_0x888e('0x28')](_0x3d4a9e)['then'](function(_0x545676){return _0x545676;});}return null;};}function removeEntity(_0x29e601,_0x3ab9d2){return function(_0x1be16b){if(_0x1be16b){return _0x1be16b[_0x888e('0x29')]()['then'](function(){var _0x465860=_0x1be16b[_0x888e('0x2a')]({'plain':!![]});var _0x2b48e6='Teams';return db[_0x888e('0x2b')][_0x888e('0x29')]({'where':{'type':_0x2b48e6,'resourceId':_0x465860['id']}})[_0x888e('0x2c')](function(){return _0x1be16b;});})['then'](function(){_0x29e601[_0x888e('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33c633,_0x4bec46){return function(_0x56b146){if(!_0x56b146){_0x33c633[_0x888e('0x2d')](0x194);}return _0x56b146;};}function handleError(_0x4d2997,_0x135c7f){_0x135c7f=_0x135c7f||0x1f4;return function(_0x1395f3){logger[_0x888e('0x2e')](_0x1395f3[_0x888e('0x2f')]);if(_0x1395f3[_0x888e('0x30')]){delete _0x1395f3[_0x888e('0x30')];}_0x4d2997['status'](_0x135c7f)[_0x888e('0x31')](_0x1395f3);};}exports[_0x888e('0x32')]=function(_0x3424c9,_0x88e80c){var _0x3029c7={},_0x109b0e={},_0x13f390={'count':0x0,'rows':[]};var _0xcf9cb5=_['map'](db['Team']['rawAttributes'],function(_0x3ad9da){return{'name':_0x3ad9da[_0x888e('0x33')],'type':_0x3ad9da['type']['key']};});_0x109b0e[_0x888e('0x34')]=_[_0x888e('0x35')](_0xcf9cb5,_0x888e('0x30'));_0x109b0e['query']=_['keys'](_0x3424c9[_0x888e('0x36')]);_0x109b0e[_0x888e('0x37')]=_[_0x888e('0x38')](_0x109b0e[_0x888e('0x34')],_0x109b0e[_0x888e('0x36')]);_0x3029c7[_0x888e('0x39')]=_[_0x888e('0x38')](_0x109b0e[_0x888e('0x34')],qs[_0x888e('0x3a')](_0x3424c9[_0x888e('0x36')]['fields']));_0x3029c7['attributes']=_0x3029c7['attributes']['length']?_0x3029c7[_0x888e('0x39')]:_0x109b0e['model'];if(!_0x3424c9[_0x888e('0x36')][_0x888e('0x3b')](_0x888e('0x3c'))){_0x3029c7[_0x888e('0x23')]=qs['limit'](_0x3424c9[_0x888e('0x36')][_0x888e('0x23')]);_0x3029c7[_0x888e('0x22')]=qs[_0x888e('0x22')](_0x3424c9[_0x888e('0x36')]['offset']);}_0x3029c7[_0x888e('0x3d')]=qs[_0x888e('0x3e')](_0x3424c9['query'][_0x888e('0x3e')]);_0x3029c7[_0x888e('0x3f')]=qs[_0x888e('0x37')](_[_0x888e('0x40')](_0x3424c9['query'],_0x109b0e[_0x888e('0x37')]),_0xcf9cb5);if(_0x3424c9[_0x888e('0x36')]['filter']){_0x3029c7[_0x888e('0x3f')]=_[_0x888e('0x41')](_0x3029c7[_0x888e('0x3f')],{'$or':_[_0x888e('0x35')](_0xcf9cb5,function(_0x639d7c){if(_0x639d7c['type']!==_0x888e('0x42')){var _0x175f88={};_0x175f88[_0x639d7c['name']]={'$like':'%'+_0x3424c9['query']['filter']+'%'};return _0x175f88;}})});}_0x3029c7=_[_0x888e('0x41')]({},_0x3029c7,_0x3424c9[_0x888e('0x43')]);var _0x32eb1f={'where':_0x3029c7['where']};return db[_0x888e('0x44')][_0x888e('0x45')](_0x32eb1f)[_0x888e('0x2c')](function(_0x27170e){_0x13f390[_0x888e('0x45')]=_0x27170e;if(_0x3424c9[_0x888e('0x36')][_0x888e('0x46')]){_0x3029c7[_0x888e('0x47')]=[{'all':!![]}];}return db['Team']['findAll'](_0x3029c7);})[_0x888e('0x2c')](function(_0x4c9708){_0x13f390[_0x888e('0x48')]=_0x4c9708;return _0x13f390;})[_0x888e('0x2c')](respondWithFilteredResult(_0x88e80c,_0x3029c7))[_0x888e('0x49')](handleError(_0x88e80c,null));};exports[_0x888e('0x4a')]=function(_0x4f5ad9,_0x594074){var _0x4d51db={'raw':![],'where':{'id':_0x4f5ad9[_0x888e('0x4b')]['id']}},_0x300e37={};_0x300e37[_0x888e('0x34')]=_[_0x888e('0x4c')](db[_0x888e('0x44')][_0x888e('0x4d')]);_0x300e37['query']=_[_0x888e('0x4c')](_0x4f5ad9[_0x888e('0x36')]);_0x300e37[_0x888e('0x37')]=_[_0x888e('0x38')](_0x300e37[_0x888e('0x34')],_0x300e37[_0x888e('0x36')]);_0x4d51db['attributes']=_[_0x888e('0x38')](_0x300e37['model'],qs[_0x888e('0x3a')](_0x4f5ad9[_0x888e('0x36')][_0x888e('0x3a')]));_0x4d51db[_0x888e('0x39')]=_0x4d51db['attributes']['length']?_0x4d51db[_0x888e('0x39')]:_0x300e37[_0x888e('0x34')];if(_0x4f5ad9[_0x888e('0x36')][_0x888e('0x46')]){_0x4d51db[_0x888e('0x47')]=[{'all':!![]}];}_0x4d51db=_[_0x888e('0x41')]({},_0x4d51db,_0x4f5ad9[_0x888e('0x43')]);return db[_0x888e('0x44')][_0x888e('0x4e')](_0x4d51db)[_0x888e('0x2c')](handleEntityNotFound(_0x594074,null))['then'](respondWithResult(_0x594074,null))[_0x888e('0x49')](handleError(_0x594074,null));};exports[_0x888e('0x4f')]=function(_0x157621,_0x2602e9){return db[_0x888e('0x44')][_0x888e('0x4f')](_0x157621[_0x888e('0x50')],{})[_0x888e('0x2c')](function(_0xce5a25){var _0x246a04=_0x157621['user'][_0x888e('0x2a')]({'plain':!![]});if(!_0x246a04)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x246a04['role']===_0x888e('0x51')){var _0x446bb4=_0xce5a25[_0x888e('0x2a')]({'plain':!![]});var _0x5402d7=_0x888e('0x52');return db['UserProfileSection'][_0x888e('0x4e')]({'where':{'name':_0x5402d7,'userProfileId':_0x246a04[_0x888e('0x53')]},'raw':!![]})[_0x888e('0x2c')](function(_0x3a4351){if(_0x3a4351&&_0x3a4351['autoAssociation']===0x0){return db[_0x888e('0x2b')][_0x888e('0x4f')]({'name':_0x446bb4[_0x888e('0x30')],'resourceId':_0x446bb4['id'],'type':_0x3a4351['name'],'sectionId':_0x3a4351['id']},{})[_0x888e('0x2c')](function(){return _0xce5a25;});}else{return _0xce5a25;}})[_0x888e('0x49')](function(_0x40b384){logger[_0x888e('0x2e')](_0x888e('0x54'),_0x40b384);throw _0x40b384;});}return _0xce5a25;})[_0x888e('0x2c')](respondWithResult(_0x2602e9,0xc9))[_0x888e('0x49')](handleError(_0x2602e9,null));};exports[_0x888e('0x28')]=function(_0x377307,_0x42c3e2){if(_0x377307[_0x888e('0x50')]['id']){delete _0x377307['body']['id'];}return db[_0x888e('0x44')][_0x888e('0x4e')]({'where':{'id':_0x377307['params']['id']}})[_0x888e('0x2c')](handleEntityNotFound(_0x42c3e2,null))['then'](saveUpdates(_0x377307[_0x888e('0x50')],null))[_0x888e('0x2c')](respondWithResult(_0x42c3e2,null))[_0x888e('0x49')](handleError(_0x42c3e2,null));};exports[_0x888e('0x29')]=function(_0x4a79a0,_0x212384){return db[_0x888e('0x44')][_0x888e('0x4e')]({'where':{'id':_0x4a79a0[_0x888e('0x4b')]['id']}})[_0x888e('0x2c')](handleEntityNotFound(_0x212384,null))['then'](removeEntity(_0x212384,null))['catch'](handleError(_0x212384,null));};exports[_0x888e('0x55')]=function(_0x1d41e3,_0x278320,_0x354d43){return db[_0x888e('0x44')][_0x888e('0x56')]({'where':{'id':_0x1d41e3[_0x888e('0x4b')]['id']}})[_0x888e('0x2c')](handleEntityNotFound(_0x278320,null))[_0x888e('0x2c')](function(_0x34b66f){if(!_0x1d41e3['query'][_0x888e('0x57')]||!utils['isValidChannel'](_0x1d41e3[_0x888e('0x36')]['channel'])){throw new db['Sequelize'][(_0x888e('0x58'))](_0x888e('0x59'));}var _0x9f7154={};var _0x228a7c={};_0x228a7c['model']=_['keys'](db[_[_0x888e('0x5a')](_0x1d41e3[_0x888e('0x36')][_0x888e('0x57')][_0x888e('0x5b')]())+_0x888e('0x5c')]['rawAttributes']);_0x228a7c[_0x888e('0x36')]=_['keys'](_0x1d41e3[_0x888e('0x36')]);_0x228a7c[_0x888e('0x37')]=_['intersection'](_0x228a7c['model'],_0x228a7c[_0x888e('0x36')]);_0x9f7154['attributes']=_[_0x888e('0x38')](_0x228a7c[_0x888e('0x34')],qs[_0x888e('0x3a')](_0x1d41e3[_0x888e('0x36')][_0x888e('0x3a')]));_0x9f7154[_0x888e('0x39')]=_0x9f7154['attributes']['length']?_0x9f7154['attributes']:_0x228a7c[_0x888e('0x34')];_0x9f7154[_0x888e('0x23')]=qs[_0x888e('0x23')](_0x1d41e3[_0x888e('0x36')][_0x888e('0x23')]);_0x9f7154['offset']=qs[_0x888e('0x22')](_0x1d41e3[_0x888e('0x36')][_0x888e('0x22')]);_0x9f7154[_0x888e('0x3d')]=qs[_0x888e('0x3e')](_0x1d41e3['query'][_0x888e('0x3e')]);_0x9f7154[_0x888e('0x3f')]=qs[_0x888e('0x37')](_['pick'](_0x1d41e3[_0x888e('0x36')],_0x228a7c[_0x888e('0x37')]));_0x9f7154=_[_0x888e('0x41')]({},_0x9f7154,_0x1d41e3[_0x888e('0x43')]);return _0x34b66f['get'+_[_0x888e('0x5a')](_0x1d41e3[_0x888e('0x36')][_0x888e('0x57')][_0x888e('0x5b')]())+'Queues'](_0x9f7154);})[_0x888e('0x2c')](respondWithResult(_0x278320,null))[_0x888e('0x49')](handleError(_0x278320,null));};exports[_0x888e('0x5d')]=function(_0x10ed18,_0x484236,_0x549e65){return db[_0x888e('0x44')][_0x888e('0x56')]({'where':{'id':_0x10ed18['params']['id']}})['then'](function(_0x4af50b){if(_0x4af50b){if(!_0x10ed18[_0x888e('0x50')][_0x888e('0x57')]||!utils[_0x888e('0x5e')](_0x10ed18[_0x888e('0x50')]['channel'])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x4af50b[_0x888e('0x5f')+_['capitalize'](_0x10ed18[_0x888e('0x50')][_0x888e('0x57')][_0x888e('0x5b')]())+_0x888e('0x60')](_0x10ed18[_0x888e('0x50')][_0x888e('0x61')]);}return null;})[_0x888e('0x2c')](handleEntityNotFound(_0x484236,null))[_0x888e('0x2c')](respondWithStatusCode(_0x484236,null))[_0x888e('0x49')](handleError(_0x484236,null));};exports[_0x888e('0x62')]=function(_0x546b0a,_0x20e54c,_0x47f45f){return db[_0x888e('0x44')][_0x888e('0x56')]({'where':{'id':_0x546b0a['params']['id']}})[_0x888e('0x2c')](function(_0x55d551){if(_0x55d551){if(!_0x546b0a[_0x888e('0x36')][_0x888e('0x57')]||!utils[_0x888e('0x5e')](_0x546b0a['query'][_0x888e('0x57')])){throw new db[(_0x888e('0x63'))][(_0x888e('0x58'))]('Unknown\x20channel');}return _0x55d551[_0x888e('0x64')+_['capitalize'](_0x546b0a[_0x888e('0x36')][_0x888e('0x57')][_0x888e('0x5b')]())+_0x888e('0x60')](_0x546b0a[_0x888e('0x36')][_0x888e('0x61')]);}return null;})['then'](handleEntityNotFound(_0x20e54c,null))[_0x888e('0x2c')](respondWithStatusCode(_0x20e54c,null))['catch'](handleError(_0x20e54c,null));};exports[_0x888e('0x65')]=function(_0x4cc5b5,_0x4a247f,_0xee6b42){return db[_0x888e('0x44')][_0x888e('0x4e')]({'where':{'id':_0x4cc5b5[_0x888e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4a247f,null))[_0x888e('0x2c')](function(_0x408459){if(_0x408459){var _0x2056fa=[_0x888e('0x66'),_0x888e('0x67'),_0x888e('0x68'),_0x888e('0x69'),_0x888e('0x6a'),_0x888e('0x6b'),_0x888e('0x6c')];return BPromise[_0x888e('0x6d')](_0x2056fa,function(_0x29ab98){return _0x408459[_0x888e('0x2a')+_0x29ab98+_0x888e('0x60')]({'attributes':['id','name']})['then'](function(_0x104306){return BPromise[_0x888e('0x6d')](_0x104306,function(_0x5ae769){return _0x5ae769[_0x888e('0x65')](_0x4cc5b5[_0x888e('0x50')]['ids'])[_0x888e('0x2c')](function(){if(_0x29ab98===_0x888e('0x66')){return db[_0x888e('0x6e')][_0x888e('0x6f')]({'where':{'id':_0x4cc5b5[_0x888e('0x50')][_0x888e('0x61')]},'attributes':['id',_0x888e('0x30'),_0x888e('0x70'),_0x888e('0x71'),_0x888e('0x72')],'raw':!![]})[_0x888e('0x2c')](function(_0x53873c){return BPromise[_0x888e('0x6d')](_['filter'](_0x53873c,{'online':0x1}),function(_0x477425){return db[_0x888e('0x73')][_0x888e('0x74')]({'membername':_0x477425[_0x888e('0x30')],'UserId':_0x477425['id'],'queue_name':_0x5ae769[_0x888e('0x30')],'VoiceQueueId':_0x5ae769['id'],'interface':_['isNil'](_0x477425['interface'])?util[_0x888e('0x75')](_0x888e('0x76'),_0x477425[_0x888e('0x30')]):_0x477425[_0x888e('0x72')],'paused':_0x477425[_0x888e('0x71')]||![],'penalty':0x0});});});}});});})[_0x888e('0x2c')](function(){return _0x408459;});})[_0x888e('0x2c')](function(){return _0x408459;});}})[_0x888e('0x2c')](function(_0x553f56){if(_0x553f56){return _0x553f56['addAgents'](_0x4cc5b5[_0x888e('0x50')][_0x888e('0x61')],_[_0x888e('0x77')](_0x4cc5b5[_0x888e('0x50')],[_0x888e('0x61'),'id'])||{})['spread'](function(_0x52ed91){for(var _0x3cce53=0x0;_0x3cce53<_0x4cc5b5['body'][_0x888e('0x61')][_0x888e('0x78')];_0x3cce53+=0x1){socket[_0x888e('0x79')](_0x888e('0x7a'),{'UserId':_0x4cc5b5[_0x888e('0x50')][_0x888e('0x61')][_0x3cce53],'TeamId':_0x4cc5b5[_0x888e('0x4b')]['id']});}return _0x52ed91;});}})[_0x888e('0x2c')](respondWithResult(_0x4a247f,null))['catch'](handleError(_0x4a247f,null));};exports[_0x888e('0x7b')]=function(_0x4dec2c,_0x38768f,_0x2d3346){return db['Team'][_0x888e('0x4e')]({'where':{'id':_0x4dec2c[_0x888e('0x4b')]['id']}})[_0x888e('0x2c')](handleEntityNotFound(_0x38768f,null))[_0x888e('0x2c')](function(_0x53fe5b){if(_0x53fe5b){return BPromise['each']([_0x888e('0x7c'),'chat','mail',_0x888e('0x7d'),_0x888e('0x7e'),'openchannel','whatsapp'],function(_0x13b7b1){return _0x53fe5b[_0x888e('0x2a')+_['capitalize'](_0x13b7b1)+_0x888e('0x60')]({'attributes':['id',_0x888e('0x30')]})[_0x888e('0x2c')](function(_0x298911){return BPromise[_0x888e('0x6d')](_0x298911,function(_0x202b52){return _0x202b52[_0x888e('0x7b')](_0x4dec2c[_0x888e('0x36')][_0x888e('0x61')])[_0x888e('0x2c')](function(){if(_0x13b7b1===_0x888e('0x7c')){return db['UserVoiceQueueRt'][_0x888e('0x29')]({'where':{'VoiceQueueId':_0x202b52['id'],'UserId':_0x4dec2c['query'][_0x888e('0x61')]}});}});});})[_0x888e('0x2c')](function(){return _0x53fe5b;});})['then'](function(){return _0x53fe5b;});}})[_0x888e('0x2c')](function(_0x5dd2f2){if(_0x5dd2f2){return _0x5dd2f2[_0x888e('0x7b')](_0x4dec2c[_0x888e('0x36')][_0x888e('0x61')])['then'](function(){if(_['isArray'](_0x4dec2c[_0x888e('0x36')][_0x888e('0x61')])){for(var _0x101683=0x0;_0x101683<_0x4dec2c[_0x888e('0x36')]['ids'][_0x888e('0x78')];_0x101683+=0x1){socket[_0x888e('0x79')](_0x888e('0x7f'),{'UserId':Number(_0x4dec2c['query'][_0x888e('0x61')][_0x101683]),'TeamId':Number(_0x4dec2c[_0x888e('0x4b')]['id'])});}}else{socket[_0x888e('0x79')](_0x888e('0x7f'),{'UserId':Number(_0x4dec2c['query'][_0x888e('0x61')]),'TeamId':Number(_0x4dec2c[_0x888e('0x4b')]['id'])});}});}})[_0x888e('0x2c')](respondWithStatusCode(_0x38768f,null))[_0x888e('0x49')](handleError(_0x38768f,null));};exports['getAgents']=function(_0xd5ed9d,_0x2058cb,_0xe10bef){var _0x45ca45={};var _0x4c5a51={};var _0x46d0b8;var _0xe0ad75;return db[_0x888e('0x44')][_0x888e('0x56')]({'where':{'id':_0xd5ed9d[_0x888e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2058cb,null))[_0x888e('0x2c')](function(_0x3b9f45){if(_0x3b9f45){_0x46d0b8=_0x3b9f45;_0x4c5a51[_0x888e('0x34')]=_[_0x888e('0x4c')](db[_0x888e('0x6e')][_0x888e('0x4d')]);_0x4c5a51[_0x888e('0x36')]=_['keys'](_0xd5ed9d[_0x888e('0x36')]);_0x4c5a51['filters']=_['intersection'](_0x4c5a51['model'],_0x4c5a51[_0x888e('0x36')]);_0x45ca45['attributes']=_[_0x888e('0x38')](_0x4c5a51[_0x888e('0x34')],qs[_0x888e('0x3a')](_0xd5ed9d[_0x888e('0x36')][_0x888e('0x3a')]));_0x45ca45[_0x888e('0x39')]=_0x45ca45[_0x888e('0x39')]['length']?_0x45ca45[_0x888e('0x39')]:_0x4c5a51[_0x888e('0x34')];_0x45ca45[_0x888e('0x3d')]=qs['sort'](_0xd5ed9d['query'][_0x888e('0x3e')]);_0x45ca45[_0x888e('0x3f')]=qs[_0x888e('0x37')](_[_0x888e('0x40')](_0xd5ed9d['query'],_0x4c5a51['filters']));if(_0xd5ed9d['query'][_0x888e('0x80')]){_0x45ca45[_0x888e('0x3f')]=_[_0x888e('0x41')](_0x45ca45[_0x888e('0x3f')],{'$or':_['map'](_0x45ca45[_0x888e('0x39')],function(_0x1c46f5){var _0x4db820={};_0x4db820[_0x1c46f5]={'$like':'%'+_0xd5ed9d[_0x888e('0x36')][_0x888e('0x80')]+'%'};return _0x4db820;})});}_0x45ca45=_['merge']({},_0x45ca45,_0xd5ed9d[_0x888e('0x43')]);return _0x46d0b8[_0x888e('0x81')](_0x45ca45);}})['then'](function(_0x5bb3bd){if(_0x5bb3bd){_0xe0ad75=_0x5bb3bd['length'];if(!_0xd5ed9d[_0x888e('0x36')][_0x888e('0x3b')]('nolimit')){_0x45ca45[_0x888e('0x23')]=qs[_0x888e('0x23')](_0xd5ed9d[_0x888e('0x36')]['limit']);_0x45ca45['offset']=qs['offset'](_0xd5ed9d[_0x888e('0x36')][_0x888e('0x22')]);}return _0x46d0b8[_0x888e('0x81')](_0x45ca45);}})[_0x888e('0x2c')](function(_0x154505){if(_0x154505){return _0x154505?{'count':_0xe0ad75,'rows':_0x154505}:null;}})[_0x888e('0x2c')](respondWithResult(_0x2058cb,null))[_0x888e('0x49')](handleError(_0x2058cb,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index adca010..7bf6864 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 _0xbc21=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x48c584,_0x31953b){var _0x28cbad=function(_0x1bf761){while(--_0x1bf761){_0x48c584['push'](_0x48c584['shift']());}};_0x28cbad(++_0x31953b);}(_0xbc21,0x70));var _0x1bc2=function(_0x41eea7,_0x20246b){_0x41eea7=_0x41eea7-0x0;var _0x2fd9a6=_0xbc21[_0x41eea7];return _0x2fd9a6;};'use strict';var EventEmitter=require(_0x1bc2('0x0'));var Team=require(_0x1bc2('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x1bc2('0x2')](0x0);var events={'afterCreate':_0x1bc2('0x3'),'afterUpdate':_0x1bc2('0x4'),'afterDestroy':_0x1bc2('0x5')};function emitEvent(_0x48ab07){return function(_0x2a65e9,_0x237b92,_0x2fcbc5){TeamEvents[_0x1bc2('0x6')](_0x48ab07+':'+_0x2a65e9['id'],_0x2a65e9);TeamEvents[_0x1bc2('0x6')](_0x48ab07,_0x2a65e9);_0x2fcbc5(null);};}for(var e in events){if(events[_0x1bc2('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x95a3=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x5a54ff,_0x307776){var _0x3341fa=function(_0x5e9d50){while(--_0x5e9d50){_0x5a54ff['push'](_0x5a54ff['shift']());}};_0x3341fa(++_0x307776);}(_0x95a3,0xdc));var _0x395a=function(_0x27898f,_0x160813){_0x27898f=_0x27898f-0x0;var _0x5ebf73=_0x95a3[_0x27898f];return _0x5ebf73;};'use strict';var EventEmitter=require(_0x395a('0x0'));var Team=require(_0x395a('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x395a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x395a('0x3'),'afterDestroy':_0x395a('0x4')};function emitEvent(_0x3f42ce){return function(_0x43526f,_0x4832d3,_0x572564){TeamEvents[_0x395a('0x5')](_0x3f42ce+':'+_0x43526f['id'],_0x43526f);TeamEvents[_0x395a('0x5')](_0x3f42ce,_0x43526f);_0x572564(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x395a('0x6')](e,emitEvent(event));}}module[_0x395a('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 16acf90..c33fc56 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 _0xc0b3=['bluebird','./team.attributes','exports','define','Team','teams','lodash','util','api','moment'];(function(_0x5aa9af,_0x39c3b1){var _0x45a0f4=function(_0x4921a4){while(--_0x4921a4){_0x5aa9af['push'](_0x5aa9af['shift']());}};_0x45a0f4(++_0x39c3b1);}(_0xc0b3,0x7e));var _0x3c0b=function(_0x4860e8,_0x5cbf9c){_0x4860e8=_0x4860e8-0x0;var _0x225e83=_0xc0b3[_0x4860e8];return _0x225e83;};'use strict';var _=require(_0x3c0b('0x0'));var util=require(_0x3c0b('0x1'));var logger=require('../../config/logger')(_0x3c0b('0x2'));var moment=require(_0x3c0b('0x3'));var BPromise=require(_0x3c0b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3c0b('0x5'));module[_0x3c0b('0x6')]=function(_0x1ded3f,_0x192852){return _0x1ded3f[_0x3c0b('0x7')](_0x3c0b('0x8'),attributes,{'tableName':_0x3c0b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe848=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./team.attributes','exports','define','Team'];(function(_0x14feb5,_0x4fea10){var _0x1fc64d=function(_0x4f9fdc){while(--_0x4f9fdc){_0x14feb5['push'](_0x14feb5['shift']());}};_0x1fc64d(++_0x4fea10);}(_0xe848,0x155));var _0x8e84=function(_0x7b2d3f,_0x45f2ee){_0x7b2d3f=_0x7b2d3f-0x0;var _0x3ec598=_0xe848[_0x7b2d3f];return _0x3ec598;};'use strict';var _=require(_0x8e84('0x0'));var util=require(_0x8e84('0x1'));var logger=require(_0x8e84('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8e84('0x3'));var rp=require(_0x8e84('0x4'));var fs=require('fs');var path=require(_0x8e84('0x5'));var rimraf=require(_0x8e84('0x6'));var config=require('../../config/environment');var attributes=require(_0x8e84('0x7'));module[_0x8e84('0x8')]=function(_0x59d699,_0x4b1bb3){return _0x59d699[_0x8e84('0x9')](_0x8e84('0xa'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index ab19bcb..e7cc194 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 _0x0a54=['http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','info','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a54,0x11f));var _0x40a5=function(_0x2b9e8a,_0x7b21d4){_0x2b9e8a=_0x2b9e8a-0x0;var _0x520e67=_0x0a54[_0x2b9e8a];return _0x520e67;};'use strict';var _=require(_0x40a5('0x0'));var util=require(_0x40a5('0x1'));var moment=require(_0x40a5('0x2'));var BPromise=require(_0x40a5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40a5('0x4'))['db'];var utils=require(_0x40a5('0x5'));var logger=require(_0x40a5('0x6'))('rpc');var config=require(_0x40a5('0x7'));var jayson=require(_0x40a5('0x8'));var client=jayson[_0x40a5('0x9')][_0x40a5('0xa')]({'port':0x232a});config[_0x40a5('0xb')]=_[_0x40a5('0xc')](config[_0x40a5('0xb')],{'host':_0x40a5('0xd'),'port':0x18eb});var socket=require(_0x40a5('0xe'))(new Redis(config[_0x40a5('0xb')]));require(_0x40a5('0xf'))[_0x40a5('0x10')](socket);function respondWithRpcPromise(_0x43cbb1,_0xedcf27,_0x277cf5){return new BPromise(function(_0xed4d15,_0x2757dd){return client[_0x40a5('0x11')](_0x43cbb1,_0x277cf5)[_0x40a5('0x12')](function(_0x40af19){logger['info'](_0x40a5('0x13'),_0xedcf27,_0x40a5('0x14'));logger[_0x40a5('0x15')](_0x40a5('0x16'),_0xedcf27,_0x40a5('0x14'),JSON[_0x40a5('0x17')](_0x40af19));if(_0x40af19[_0x40a5('0x18')]){if(_0x40af19[_0x40a5('0x18')]['code']===0x1f4){logger['error'](_0x40a5('0x13'),_0xedcf27,_0x40af19[_0x40a5('0x18')]['message']);return _0x2757dd(_0x40af19[_0x40a5('0x18')]['message']);}logger[_0x40a5('0x18')](_0x40a5('0x13'),_0xedcf27,_0x40af19[_0x40a5('0x18')][_0x40a5('0x19')]);return _0xed4d15(_0x40af19[_0x40a5('0x18')][_0x40a5('0x19')]);}else{logger[_0x40a5('0x1a')](_0x40a5('0x13'),_0xedcf27,_0x40a5('0x14'));_0xed4d15(_0x40af19['result'][_0x40a5('0x19')]);}})['catch'](function(_0x9d1dce){logger[_0x40a5('0x18')](_0x40a5('0x13'),_0xedcf27,_0x9d1dce);_0x2757dd(_0x9d1dce);});});} \ No newline at end of file +var _0xa29e=['Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','defaults','localhost','socket.io-emitter','./team.socket','register','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa29e,0x1a5));var _0xea29=function(_0x43cc69,_0x401eea){_0x43cc69=_0x43cc69-0x0;var _0xde43ae=_0xa29e[_0x43cc69];return _0xde43ae;};'use strict';var _=require(_0xea29('0x0'));var util=require('util');var moment=require(_0xea29('0x1'));var BPromise=require(_0xea29('0x2'));var rs=require(_0xea29('0x3'));var fs=require('fs');var Redis=require(_0xea29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea29('0x5'));var logger=require(_0xea29('0x6'))(_0xea29('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xea29('0x8')]({'port':0x232a});config['redis']=_[_0xea29('0x9')](config['redis'],{'host':_0xea29('0xa'),'port':0x18eb});var socket=require(_0xea29('0xb'))(new Redis(config['redis']));require(_0xea29('0xc'))[_0xea29('0xd')](socket);function respondWithRpcPromise(_0x35a163,_0x4a5d40,_0x205e6c){return new BPromise(function(_0x274bcd,_0x2baa2f){return client['request'](_0x35a163,_0x205e6c)[_0xea29('0xe')](function(_0x2d9d66){logger[_0xea29('0xf')](_0xea29('0x10'),_0x4a5d40,'request\x20sent');logger['debug'](_0xea29('0x11'),_0x4a5d40,_0xea29('0x12'),JSON['stringify'](_0x2d9d66));if(_0x2d9d66['error']){if(_0x2d9d66[_0xea29('0x13')][_0xea29('0x14')]===0x1f4){logger[_0xea29('0x13')](_0xea29('0x10'),_0x4a5d40,_0x2d9d66['error'][_0xea29('0x15')]);return _0x2baa2f(_0x2d9d66[_0xea29('0x13')][_0xea29('0x15')]);}logger[_0xea29('0x13')](_0xea29('0x10'),_0x4a5d40,_0x2d9d66['error'][_0xea29('0x15')]);return _0x274bcd(_0x2d9d66['error']['message']);}else{logger[_0xea29('0xf')](_0xea29('0x10'),_0x4a5d40,_0xea29('0x12'));_0x274bcd(_0x2d9d66['result']['message']);}})[_0xea29('0x16')](function(_0x4fb2ec){logger[_0xea29('0x13')](_0xea29('0x10'),_0x4a5d40,_0x4fb2ec);_0x2baa2f(_0x4fb2ec);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 7630b28..faebbe1 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 _0x4312=['team:','remove','update','emit','removeListener','length'];(function(_0x1e0104,_0x16fc8e){var _0x46982a=function(_0x1dff5b){while(--_0x1dff5b){_0x1e0104['push'](_0x1e0104['shift']());}};_0x46982a(++_0x16fc8e);}(_0x4312,0xaf));var _0x2431=function(_0xa8dc6d,_0x3bdfc2){_0xa8dc6d=_0xa8dc6d-0x0;var _0x141e04=_0x4312[_0xa8dc6d];return _0x141e04;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x2431('0x0'),_0x2431('0x1')];function createListener(_0x4ee745,_0x141309){return function(_0x59a6d3){_0x141309[_0x2431('0x2')](_0x4ee745,_0x59a6d3);};}function removeListener(_0x237ac5,_0x22db34){return function(){TeamEvents[_0x2431('0x3')](_0x237ac5,_0x22db34);};}exports['register']=function(_0x3781eb){for(var _0x54c720=0x0,_0xa2cabe=events[_0x2431('0x4')];_0x54c720<_0xa2cabe;_0x54c720++){var _0x4e2eb2=events[_0x54c720];var _0x9647b4=createListener(_0x2431('0x5')+_0x4e2eb2,_0x3781eb);TeamEvents['on'](_0x4e2eb2,_0x9647b4);}}; \ No newline at end of file +var _0xba0d=['update','removeListener','register','length','./team.events','remove'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xba0d,0x8e));var _0xdba0=function(_0x57fb0e,_0x1dd951){_0x57fb0e=_0x57fb0e-0x0;var _0x1a66d9=_0xba0d[_0x57fb0e];return _0x1a66d9;};'use strict';var TeamEvents=require(_0xdba0('0x0'));var events=['save',_0xdba0('0x1'),_0xdba0('0x2')];function createListener(_0xce5297,_0x5da7bc){return function(_0x139cf3){_0x5da7bc['emit'](_0xce5297,_0x139cf3);};}function removeListener(_0xebb600,_0x426cac){return function(){TeamEvents[_0xdba0('0x3')](_0xebb600,_0x426cac);};}exports[_0xdba0('0x4')]=function(_0x592a53){for(var _0x59e841=0x0,_0x220299=events[_0xdba0('0x5')];_0x59e841<_0x220299;_0x59e841++){var _0x423097=events[_0x59e841];var _0x2c20c4=createListener('team:'+_0x423097,_0x592a53);TeamEvents['on'](_0x423097,_0x2c20c4);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 7b2dd2e..f93d857 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 _0xd29d=['update','destroy','exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','create','put','/:id'];(function(_0x4b6c5d,_0x3cbbdf){var _0x4e4d47=function(_0x311028){while(--_0x311028){_0x4b6c5d['push'](_0x4b6c5d['shift']());}};_0x4e4d47(++_0x3cbbdf);}(_0xd29d,0x1e3));var _0xdd29=function(_0x520407,_0x86e03){_0x520407=_0x520407-0x0;var _0x18aa26=_0xd29d[_0x520407];return _0x18aa26;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdd29('0x0'));var timeout=require('connect-timeout');var express=require(_0xdd29('0x1'));var router=express['Router']();var auth=require(_0xdd29('0x2'));var interaction=require(_0xdd29('0x3'));var config=require(_0xdd29('0x4'));var controller=require(_0xdd29('0x5'));router[_0xdd29('0x6')]('/',auth[_0xdd29('0x7')](),controller[_0xdd29('0x8')]);router[_0xdd29('0x6')]('/:id',auth[_0xdd29('0x7')](),controller['show']);router['post']('/',auth[_0xdd29('0x7')](),controller[_0xdd29('0x9')]);router[_0xdd29('0xa')](_0xdd29('0xb'),auth[_0xdd29('0x7')](),controller[_0xdd29('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xdd29('0xd')]);module[_0xdd29('0xe')]=router; \ No newline at end of file +var _0xf03a=['../../components/interaction/service','./template.controller','isAuthenticated','index','get','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x19c315,_0x2b2e84){var _0x3dc378=function(_0x258022){while(--_0x258022){_0x19c315['push'](_0x19c315['shift']());}};_0x3dc378(++_0x2b2e84);}(_0xf03a,0x80));var _0xaf03=function(_0x4a6017,_0x20f911){_0x4a6017=_0x4a6017-0x0;var _0x23ba65=_0xf03a[_0x4a6017];return _0x23ba65;};'use strict';var multer=require(_0xaf03('0x0'));var util=require(_0xaf03('0x1'));var path=require('path');var timeout=require(_0xaf03('0x2'));var express=require('express');var router=express[_0xaf03('0x3')]();var auth=require(_0xaf03('0x4'));var interaction=require(_0xaf03('0x5'));var config=require('../../config/environment');var controller=require(_0xaf03('0x6'));router['get']('/',auth[_0xaf03('0x7')](),controller[_0xaf03('0x8')]);router[_0xaf03('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xaf03('0xa')]);router[_0xaf03('0xb')]('/',auth[_0xaf03('0x7')](),controller[_0xaf03('0xc')]);router[_0xaf03('0xd')]('/:id',auth[_0xaf03('0x7')](),controller[_0xaf03('0xe')]);router[_0xaf03('0xf')](_0xaf03('0x10'),auth[_0xaf03('0x7')](),controller[_0xaf03('0x11')]);module[_0xaf03('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 0467240..79a09c8 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 _0x5853=['sequelize','exports','STRING','TEXT'];(function(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0x5853,0x8c));var _0x3585=function(_0x284d8f,_0x1afc9e){_0x284d8f=_0x284d8f-0x0;var _0x6acf64=_0x5853[_0x284d8f];return _0x6acf64;};'use strict';var Sequelize=require(_0x3585('0x0'));module[_0x3585('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3585('0x2')]},'html':{'type':Sequelize[_0x3585('0x3')]}}; \ No newline at end of file +var _0xae8c=['STRING','TEXT','exports'];(function(_0x535648,_0x5598d8){var _0x3277b9=function(_0x1f70a7){while(--_0x1f70a7){_0x535648['push'](_0x535648['shift']());}};_0x3277b9(++_0x5598d8);}(_0xae8c,0x14c));var _0xcae8=function(_0x1a8c42,_0x1b04be){_0x1a8c42=_0x1a8c42-0x0;var _0x575c74=_0xae8c[_0x1a8c42];return _0x575c74;};'use strict';var Sequelize=require('sequelize');module[_0xcae8('0x0')]={'name':{'type':Sequelize[_0xcae8('0x1')]},'description':{'type':Sequelize[_0xcae8('0x1')]},'html':{'type':Sequelize[_0xcae8('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 6efd5d5..c818581 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 _0x4cd0=['reject','save','update','destroy','then','get','UserProfileResource','end','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Template','count','include','findAll','rows','catch','includeAll','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','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4cd0,0x81));var _0x04cd=function(_0x1fe909,_0x499365){_0x1fe909=_0x1fe909-0x0;var _0x4b2da4=_0x4cd0[_0x1fe909];return _0x4b2da4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x04cd('0x0'));var zipdir=require(_0x04cd('0x1'));var jsonpatch=require(_0x04cd('0x2'));var rp=require(_0x04cd('0x3'));var moment=require(_0x04cd('0x4'));var BPromise=require(_0x04cd('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x04cd('0x6'));var sox=require(_0x04cd('0x7'));var csv=require(_0x04cd('0x8'));var ejs=require(_0x04cd('0x9'));var fs=require('fs');var _=require(_0x04cd('0xa'));var squel=require(_0x04cd('0xb'));var crypto=require('crypto');var jsforce=require(_0x04cd('0xc'));var deskjs=require(_0x04cd('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x04cd('0xe'));var Redis=require(_0x04cd('0xf'));var authService=require(_0x04cd('0x10'));var qs=require(_0x04cd('0x11'));var as=require(_0x04cd('0x12'));var hardwareService=require(_0x04cd('0x13'));var logger=require('../../config/logger')(_0x04cd('0x14'));var utils=require(_0x04cd('0x15'));var config=require(_0x04cd('0x16'));var db=require(_0x04cd('0x17'))['db'];function respondWithStatusCode(_0x5def42,_0x1a4e5f){_0x1a4e5f=_0x1a4e5f||0xcc;return function(_0x311c42){if(_0x311c42){return _0x5def42['sendStatus'](_0x1a4e5f);}return _0x5def42[_0x04cd('0x18')](_0x1a4e5f)['end']();};}function respondWithResult(_0x1d3d4d,_0x556723){_0x556723=_0x556723||0xc8;return function(_0x387b48){if(_0x387b48){return _0x1d3d4d[_0x04cd('0x18')](_0x556723)[_0x04cd('0x19')](_0x387b48);}};}function respondWithFilteredResult(_0x82c3,_0x2a6fd2){return function(_0x1312ba){if(_0x1312ba){var _0x42694d=_0x1312ba['count'],_0x3fc1a4=_0x2a6fd2[_0x04cd('0x1a')],_0x3e3b0e=_0x2a6fd2[_0x04cd('0x1a')]+_0x2a6fd2[_0x04cd('0x1b')],_0x5365f9;if(_0x3e3b0e>=_0x42694d){_0x3e3b0e=_0x42694d;_0x5365f9=0xc8;}else{_0x5365f9=0xce;}_0x82c3['status'](_0x5365f9);return _0x82c3['set'](_0x04cd('0x1c'),_0x3fc1a4+'-'+_0x3e3b0e+'/'+_0x42694d)[_0x04cd('0x19')](_0x1312ba);}return null;};}function patchUpdates(_0x50a31e){return function(_0x27023a){try{jsonpatch['apply'](_0x27023a,_0x50a31e,!![]);}catch(_0x11595f){return BPromise[_0x04cd('0x1d')](_0x11595f);}return _0x27023a[_0x04cd('0x1e')]();};}function saveUpdates(_0x2b1739,_0x5674bb){return function(_0x3c0b97){if(_0x3c0b97){return _0x3c0b97[_0x04cd('0x1f')](_0x2b1739)['then'](function(_0x164162){return _0x164162;});}return null;};}function removeEntity(_0x1b6ed1,_0x31fb5f){return function(_0x4e8fe0){if(_0x4e8fe0){return _0x4e8fe0[_0x04cd('0x20')]()[_0x04cd('0x21')](function(){var _0x53c2ce=_0x4e8fe0[_0x04cd('0x22')]({'plain':!![]});var _0x3c4b18='Templates';return db[_0x04cd('0x23')]['destroy']({'where':{'type':_0x3c4b18,'resourceId':_0x53c2ce['id']}})['then'](function(){return _0x4e8fe0;});})[_0x04cd('0x21')](function(){_0x1b6ed1[_0x04cd('0x18')](0xcc)[_0x04cd('0x24')]();});}};}function handleEntityNotFound(_0x4579ab,_0x3f7f59){return function(_0x42c99a){if(!_0x42c99a){_0x4579ab['sendStatus'](0x194);}return _0x42c99a;};}function handleError(_0x15f6bc,_0x3c44ee){_0x3c44ee=_0x3c44ee||0x1f4;return function(_0x377204){logger[_0x04cd('0x25')](_0x377204[_0x04cd('0x26')]);if(_0x377204[_0x04cd('0x27')]){delete _0x377204[_0x04cd('0x27')];}_0x15f6bc[_0x04cd('0x18')](_0x3c44ee)[_0x04cd('0x28')](_0x377204);};}exports['index']=function(_0x323890,_0x562315){var _0x363f1d={},_0x2af4c9={},_0x402b1c={'count':0x0,'rows':[]};var _0x31ed2b=_['map'](db['Template'][_0x04cd('0x29')],function(_0x55de81){return{'name':_0x55de81[_0x04cd('0x2a')],'type':_0x55de81[_0x04cd('0x2b')][_0x04cd('0x2c')]};});_0x2af4c9[_0x04cd('0x2d')]=_[_0x04cd('0x2e')](_0x31ed2b,_0x04cd('0x27'));_0x2af4c9[_0x04cd('0x2f')]=_[_0x04cd('0x30')](_0x323890[_0x04cd('0x2f')]);_0x2af4c9['filters']=_['intersection'](_0x2af4c9[_0x04cd('0x2d')],_0x2af4c9[_0x04cd('0x2f')]);_0x363f1d[_0x04cd('0x31')]=_['intersection'](_0x2af4c9[_0x04cd('0x2d')],qs[_0x04cd('0x32')](_0x323890[_0x04cd('0x2f')][_0x04cd('0x32')]));_0x363f1d[_0x04cd('0x31')]=_0x363f1d['attributes'][_0x04cd('0x33')]?_0x363f1d[_0x04cd('0x31')]:_0x2af4c9[_0x04cd('0x2d')];if(!_0x323890[_0x04cd('0x2f')][_0x04cd('0x34')](_0x04cd('0x35'))){_0x363f1d[_0x04cd('0x1b')]=qs[_0x04cd('0x1b')](_0x323890[_0x04cd('0x2f')][_0x04cd('0x1b')]);_0x363f1d[_0x04cd('0x1a')]=qs[_0x04cd('0x1a')](_0x323890['query'][_0x04cd('0x1a')]);}_0x363f1d[_0x04cd('0x36')]=qs['sort'](_0x323890[_0x04cd('0x2f')][_0x04cd('0x37')]);_0x363f1d[_0x04cd('0x38')]=qs['filters'](_[_0x04cd('0x39')](_0x323890[_0x04cd('0x2f')],_0x2af4c9['filters']),_0x31ed2b);if(_0x323890[_0x04cd('0x2f')][_0x04cd('0x3a')]){_0x363f1d['where']=_[_0x04cd('0x3b')](_0x363f1d['where'],{'$or':_[_0x04cd('0x2e')](_0x31ed2b,function(_0x45c6bf){if(_0x45c6bf[_0x04cd('0x2b')]!=='VIRTUAL'){var _0x383236={};_0x383236[_0x45c6bf[_0x04cd('0x27')]]={'$like':'%'+_0x323890[_0x04cd('0x2f')][_0x04cd('0x3a')]+'%'};return _0x383236;}})});}_0x363f1d=_[_0x04cd('0x3b')]({},_0x363f1d,_0x323890[_0x04cd('0x3c')]);var _0x10c1bf={'where':_0x363f1d['where']};return db[_0x04cd('0x3d')][_0x04cd('0x3e')](_0x10c1bf)[_0x04cd('0x21')](function(_0x53e976){_0x402b1c[_0x04cd('0x3e')]=_0x53e976;if(_0x323890['query']['includeAll']){_0x363f1d[_0x04cd('0x3f')]=[{'all':!![]}];}return db['Template'][_0x04cd('0x40')](_0x363f1d);})[_0x04cd('0x21')](function(_0x577a18){_0x402b1c[_0x04cd('0x41')]=_0x577a18;return _0x402b1c;})[_0x04cd('0x21')](respondWithFilteredResult(_0x562315,_0x363f1d))[_0x04cd('0x42')](handleError(_0x562315,null));};exports['show']=function(_0x38724e,_0x38111d){var _0x9076b9={'raw':!![],'where':{'id':_0x38724e['params']['id']}},_0x5125a7={};_0x5125a7['model']=_[_0x04cd('0x30')](db[_0x04cd('0x3d')][_0x04cd('0x29')]);_0x5125a7[_0x04cd('0x2f')]=_[_0x04cd('0x30')](_0x38724e['query']);_0x5125a7['filters']=_['intersection'](_0x5125a7[_0x04cd('0x2d')],_0x5125a7['query']);_0x9076b9[_0x04cd('0x31')]=_['intersection'](_0x5125a7[_0x04cd('0x2d')],qs['fields'](_0x38724e['query'][_0x04cd('0x32')]));_0x9076b9[_0x04cd('0x31')]=_0x9076b9[_0x04cd('0x31')][_0x04cd('0x33')]?_0x9076b9[_0x04cd('0x31')]:_0x5125a7[_0x04cd('0x2d')];if(_0x38724e['query'][_0x04cd('0x43')]){_0x9076b9['include']=[{'all':!![]}];}_0x9076b9=_['merge']({},_0x9076b9,_0x38724e[_0x04cd('0x3c')]);return db[_0x04cd('0x3d')][_0x04cd('0x44')](_0x9076b9)['then'](handleEntityNotFound(_0x38111d,null))['then'](respondWithResult(_0x38111d,null))[_0x04cd('0x42')](handleError(_0x38111d,null));};exports['create']=function(_0x59b26d,_0x161493){return db[_0x04cd('0x3d')][_0x04cd('0x45')](_0x59b26d['body'],{})['then'](function(_0x3d73ea){var _0x191df0=_0x59b26d[_0x04cd('0x46')]['get']({'plain':!![]});if(!_0x191df0)throw new Error(_0x04cd('0x47'));if(_0x191df0[_0x04cd('0x48')]===_0x04cd('0x46')){var _0x15522b=_0x3d73ea[_0x04cd('0x22')]({'plain':!![]});var _0x127182='Templates';return db[_0x04cd('0x49')][_0x04cd('0x44')]({'where':{'name':_0x127182,'userProfileId':_0x191df0[_0x04cd('0x4a')]},'raw':!![]})[_0x04cd('0x21')](function(_0x38c2b9){if(_0x38c2b9&&_0x38c2b9[_0x04cd('0x4b')]===0x0){return db['UserProfileResource'][_0x04cd('0x45')]({'name':_0x15522b[_0x04cd('0x27')],'resourceId':_0x15522b['id'],'type':_0x38c2b9[_0x04cd('0x27')],'sectionId':_0x38c2b9['id']},{})[_0x04cd('0x21')](function(){return _0x3d73ea;});}else{return _0x3d73ea;}})[_0x04cd('0x42')](function(_0x349841){logger[_0x04cd('0x25')](_0x04cd('0x4c'),_0x349841);throw _0x349841;});}return _0x3d73ea;})[_0x04cd('0x21')](respondWithResult(_0x161493,0xc9))[_0x04cd('0x42')](handleError(_0x161493,null));};exports[_0x04cd('0x1f')]=function(_0x2b17d4,_0x2465ae){if(_0x2b17d4[_0x04cd('0x4d')]['id']){delete _0x2b17d4['body']['id'];}return db['Template']['find']({'where':{'id':_0x2b17d4[_0x04cd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2465ae,null))[_0x04cd('0x21')](saveUpdates(_0x2b17d4[_0x04cd('0x4d')],null))[_0x04cd('0x21')](respondWithResult(_0x2465ae,null))['catch'](handleError(_0x2465ae,null));};exports[_0x04cd('0x20')]=function(_0x44c9be,_0x4193a1){return db[_0x04cd('0x3d')][_0x04cd('0x44')]({'where':{'id':_0x44c9be[_0x04cd('0x4e')]['id']}})[_0x04cd('0x21')](handleEntityNotFound(_0x4193a1,null))[_0x04cd('0x21')](removeEntity(_0x4193a1,null))[_0x04cd('0x42')](handleError(_0x4193a1,null));}; \ No newline at end of file +var _0x55dc=['where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','json','count','offset','limit','status','set','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','end','error','stack','send','index','map','Template','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x12f62c,_0x416ebc){var _0x514382=function(_0x1ce7d9){while(--_0x1ce7d9){_0x12f62c['push'](_0x12f62c['shift']());}};_0x514382(++_0x416ebc);}(_0x55dc,0x164));var _0xc55d=function(_0x2c9a4f,_0x3eb168){_0x2c9a4f=_0x2c9a4f-0x0;var _0x1e9d61=_0x55dc[_0x2c9a4f];return _0x1e9d61;};'use strict';var pdf=require(_0xc55d('0x0'));var emlformat=require(_0xc55d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc55d('0x2'));var jsonpatch=require(_0xc55d('0x3'));var rp=require(_0xc55d('0x4'));var moment=require(_0xc55d('0x5'));var BPromise=require(_0xc55d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc55d('0x7'));var sox=require(_0xc55d('0x8'));var csv=require(_0xc55d('0x9'));var ejs=require(_0xc55d('0xa'));var fs=require('fs');var _=require(_0xc55d('0xb'));var squel=require(_0xc55d('0xc'));var crypto=require(_0xc55d('0xd'));var jsforce=require(_0xc55d('0xe'));var deskjs=require(_0xc55d('0xf'));var toCsv=require(_0xc55d('0x9'));var querystring=require('querystring');var Papa=require(_0xc55d('0x10'));var Redis=require(_0xc55d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc55d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc55d('0x13'));var logger=require('../../config/logger')(_0xc55d('0x14'));var utils=require(_0xc55d('0x15'));var config=require(_0xc55d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x240b2e,_0x3c720e){_0x3c720e=_0x3c720e||0xcc;return function(_0x5c3766){if(_0x5c3766){return _0x240b2e[_0xc55d('0x17')](_0x3c720e);}return _0x240b2e['status'](_0x3c720e)['end']();};}function respondWithResult(_0x55b721,_0x429ae5){_0x429ae5=_0x429ae5||0xc8;return function(_0x537f10){if(_0x537f10){return _0x55b721['status'](_0x429ae5)[_0xc55d('0x18')](_0x537f10);}};}function respondWithFilteredResult(_0x4e8a46,_0x216452){return function(_0x4f62a3){if(_0x4f62a3){var _0x4983c2=_0x4f62a3[_0xc55d('0x19')],_0x232d16=_0x216452[_0xc55d('0x1a')],_0x3b6783=_0x216452[_0xc55d('0x1a')]+_0x216452[_0xc55d('0x1b')],_0x6c6fac;if(_0x3b6783>=_0x4983c2){_0x3b6783=_0x4983c2;_0x6c6fac=0xc8;}else{_0x6c6fac=0xce;}_0x4e8a46[_0xc55d('0x1c')](_0x6c6fac);return _0x4e8a46[_0xc55d('0x1d')]('Content-Range',_0x232d16+'-'+_0x3b6783+'/'+_0x4983c2)['json'](_0x4f62a3);}return null;};}function patchUpdates(_0xd67ef4){return function(_0x741f3b){try{jsonpatch[_0xc55d('0x1e')](_0x741f3b,_0xd67ef4,!![]);}catch(_0x1e2ec8){return BPromise[_0xc55d('0x1f')](_0x1e2ec8);}return _0x741f3b[_0xc55d('0x20')]();};}function saveUpdates(_0x3b005c,_0x394da8){return function(_0x542499){if(_0x542499){return _0x542499[_0xc55d('0x21')](_0x3b005c)[_0xc55d('0x22')](function(_0x1e0ca6){return _0x1e0ca6;});}return null;};}function removeEntity(_0x58b0a4,_0x123f69){return function(_0x5f1fae){if(_0x5f1fae){return _0x5f1fae[_0xc55d('0x23')]()[_0xc55d('0x22')](function(){var _0x1896a7=_0x5f1fae[_0xc55d('0x24')]({'plain':!![]});var _0x3c0c76=_0xc55d('0x25');return db[_0xc55d('0x26')]['destroy']({'where':{'type':_0x3c0c76,'resourceId':_0x1896a7['id']}})['then'](function(){return _0x5f1fae;});})[_0xc55d('0x22')](function(){_0x58b0a4[_0xc55d('0x1c')](0xcc)[_0xc55d('0x27')]();});}};}function handleEntityNotFound(_0x276ebb,_0x10e98a){return function(_0x47cc15){if(!_0x47cc15){_0x276ebb['sendStatus'](0x194);}return _0x47cc15;};}function handleError(_0x270499,_0x1bf2f4){_0x1bf2f4=_0x1bf2f4||0x1f4;return function(_0x2df6d0){logger[_0xc55d('0x28')](_0x2df6d0[_0xc55d('0x29')]);if(_0x2df6d0['name']){delete _0x2df6d0['name'];}_0x270499['status'](_0x1bf2f4)[_0xc55d('0x2a')](_0x2df6d0);};}exports[_0xc55d('0x2b')]=function(_0x2c7612,_0x295259){var _0x58df78={},_0x5ad657={},_0x570f4f={'count':0x0,'rows':[]};var _0xfebff8=_[_0xc55d('0x2c')](db[_0xc55d('0x2d')][_0xc55d('0x2e')],function(_0xa2d2e7){return{'name':_0xa2d2e7[_0xc55d('0x2f')],'type':_0xa2d2e7['type']['key']};});_0x5ad657[_0xc55d('0x30')]=_['map'](_0xfebff8,'name');_0x5ad657['query']=_['keys'](_0x2c7612[_0xc55d('0x31')]);_0x5ad657[_0xc55d('0x32')]=_[_0xc55d('0x33')](_0x5ad657['model'],_0x5ad657[_0xc55d('0x31')]);_0x58df78[_0xc55d('0x34')]=_[_0xc55d('0x33')](_0x5ad657[_0xc55d('0x30')],qs['fields'](_0x2c7612['query'][_0xc55d('0x35')]));_0x58df78[_0xc55d('0x34')]=_0x58df78['attributes'][_0xc55d('0x36')]?_0x58df78[_0xc55d('0x34')]:_0x5ad657[_0xc55d('0x30')];if(!_0x2c7612[_0xc55d('0x31')][_0xc55d('0x37')](_0xc55d('0x38'))){_0x58df78[_0xc55d('0x1b')]=qs[_0xc55d('0x1b')](_0x2c7612[_0xc55d('0x31')][_0xc55d('0x1b')]);_0x58df78[_0xc55d('0x1a')]=qs['offset'](_0x2c7612[_0xc55d('0x31')]['offset']);}_0x58df78[_0xc55d('0x39')]=qs[_0xc55d('0x3a')](_0x2c7612[_0xc55d('0x31')][_0xc55d('0x3a')]);_0x58df78[_0xc55d('0x3b')]=qs[_0xc55d('0x32')](_[_0xc55d('0x3c')](_0x2c7612[_0xc55d('0x31')],_0x5ad657[_0xc55d('0x32')]),_0xfebff8);if(_0x2c7612[_0xc55d('0x31')]['filter']){_0x58df78[_0xc55d('0x3b')]=_[_0xc55d('0x3d')](_0x58df78['where'],{'$or':_[_0xc55d('0x2c')](_0xfebff8,function(_0x30f9e7){if(_0x30f9e7[_0xc55d('0x3e')]!==_0xc55d('0x3f')){var _0x2a3473={};_0x2a3473[_0x30f9e7['name']]={'$like':'%'+_0x2c7612['query']['filter']+'%'};return _0x2a3473;}})});}_0x58df78=_[_0xc55d('0x3d')]({},_0x58df78,_0x2c7612[_0xc55d('0x40')]);var _0x73cdc2={'where':_0x58df78[_0xc55d('0x3b')]};return db[_0xc55d('0x2d')][_0xc55d('0x19')](_0x73cdc2)[_0xc55d('0x22')](function(_0x495c84){_0x570f4f['count']=_0x495c84;if(_0x2c7612['query'][_0xc55d('0x41')]){_0x58df78[_0xc55d('0x42')]=[{'all':!![]}];}return db[_0xc55d('0x2d')][_0xc55d('0x43')](_0x58df78);})['then'](function(_0x37b80a){_0x570f4f[_0xc55d('0x44')]=_0x37b80a;return _0x570f4f;})[_0xc55d('0x22')](respondWithFilteredResult(_0x295259,_0x58df78))[_0xc55d('0x45')](handleError(_0x295259,null));};exports[_0xc55d('0x46')]=function(_0x14c285,_0x1b83ff){var _0x2c4891={'raw':!![],'where':{'id':_0x14c285[_0xc55d('0x47')]['id']}},_0xc3ff1f={};_0xc3ff1f[_0xc55d('0x30')]=_[_0xc55d('0x48')](db[_0xc55d('0x2d')][_0xc55d('0x2e')]);_0xc3ff1f[_0xc55d('0x31')]=_[_0xc55d('0x48')](_0x14c285['query']);_0xc3ff1f['filters']=_['intersection'](_0xc3ff1f[_0xc55d('0x30')],_0xc3ff1f[_0xc55d('0x31')]);_0x2c4891[_0xc55d('0x34')]=_[_0xc55d('0x33')](_0xc3ff1f[_0xc55d('0x30')],qs['fields'](_0x14c285[_0xc55d('0x31')]['fields']));_0x2c4891[_0xc55d('0x34')]=_0x2c4891['attributes'][_0xc55d('0x36')]?_0x2c4891['attributes']:_0xc3ff1f[_0xc55d('0x30')];if(_0x14c285['query'][_0xc55d('0x41')]){_0x2c4891[_0xc55d('0x42')]=[{'all':!![]}];}_0x2c4891=_[_0xc55d('0x3d')]({},_0x2c4891,_0x14c285[_0xc55d('0x40')]);return db[_0xc55d('0x2d')][_0xc55d('0x49')](_0x2c4891)['then'](handleEntityNotFound(_0x1b83ff,null))['then'](respondWithResult(_0x1b83ff,null))[_0xc55d('0x45')](handleError(_0x1b83ff,null));};exports[_0xc55d('0x4a')]=function(_0x41ceda,_0x361b75){return db['Template'][_0xc55d('0x4a')](_0x41ceda[_0xc55d('0x4b')],{})['then'](function(_0x3b7091){var _0x1f8bfd=_0x41ceda['user'][_0xc55d('0x24')]({'plain':!![]});if(!_0x1f8bfd)throw new Error(_0xc55d('0x4c'));if(_0x1f8bfd[_0xc55d('0x4d')]===_0xc55d('0x4e')){var _0x5dab8b=_0x3b7091[_0xc55d('0x24')]({'plain':!![]});var _0x4b4013=_0xc55d('0x25');return db[_0xc55d('0x4f')][_0xc55d('0x49')]({'where':{'name':_0x4b4013,'userProfileId':_0x1f8bfd['userProfileId']},'raw':!![]})[_0xc55d('0x22')](function(_0x219d4e){if(_0x219d4e&&_0x219d4e[_0xc55d('0x50')]===0x0){return db[_0xc55d('0x26')]['create']({'name':_0x5dab8b[_0xc55d('0x51')],'resourceId':_0x5dab8b['id'],'type':_0x219d4e[_0xc55d('0x51')],'sectionId':_0x219d4e['id']},{})['then'](function(){return _0x3b7091;});}else{return _0x3b7091;}})[_0xc55d('0x45')](function(_0x33dd84){logger['error'](_0xc55d('0x52'),_0x33dd84);throw _0x33dd84;});}return _0x3b7091;})['then'](respondWithResult(_0x361b75,0xc9))['catch'](handleError(_0x361b75,null));};exports[_0xc55d('0x21')]=function(_0x26c49c,_0x2a76d3){if(_0x26c49c[_0xc55d('0x4b')]['id']){delete _0x26c49c['body']['id'];}return db['Template'][_0xc55d('0x49')]({'where':{'id':_0x26c49c[_0xc55d('0x47')]['id']}})[_0xc55d('0x22')](handleEntityNotFound(_0x2a76d3,null))[_0xc55d('0x22')](saveUpdates(_0x26c49c[_0xc55d('0x4b')],null))[_0xc55d('0x22')](respondWithResult(_0x2a76d3,null))[_0xc55d('0x45')](handleError(_0x2a76d3,null));};exports['destroy']=function(_0x1ebfdd,_0x1c770f){return db[_0xc55d('0x2d')]['find']({'where':{'id':_0x1ebfdd[_0xc55d('0x47')]['id']}})[_0xc55d('0x22')](handleEntityNotFound(_0x1c770f,null))[_0xc55d('0x22')](removeEntity(_0x1c770f,null))[_0xc55d('0x45')](handleError(_0x1c770f,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index a564c95..8afb12e 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 _0x35d1=['rimraf','../../config/environment','./template.attributes','exports','tools_templates','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x35d1,0x1d3));var _0x135d=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x35d1[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x135d('0x0'));var util=require('util');var logger=require(_0x135d('0x1'))(_0x135d('0x2'));var moment=require('moment');var BPromise=require(_0x135d('0x3'));var rp=require(_0x135d('0x4'));var fs=require('fs');var path=require(_0x135d('0x5'));var rimraf=require(_0x135d('0x6'));var config=require(_0x135d('0x7'));var attributes=require(_0x135d('0x8'));module[_0x135d('0x9')]=function(_0x1ca59b,_0x4a5841){return _0x1ca59b['define']('Template',attributes,{'tableName':_0x135d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61df=['../../config/environment','./template.attributes','exports','define','Template','tools_templates','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x463562,_0x508a46){var _0x23eecf=function(_0x208f9f){while(--_0x208f9f){_0x463562['push'](_0x463562['shift']());}};_0x23eecf(++_0x508a46);}(_0x61df,0x162));var _0xf61d=function(_0x48258b,_0x445098){_0x48258b=_0x48258b-0x0;var _0x1b8345=_0x61df[_0x48258b];return _0x1b8345;};'use strict';var _=require('lodash');var util=require(_0xf61d('0x0'));var logger=require(_0xf61d('0x1'))(_0xf61d('0x2'));var moment=require(_0xf61d('0x3'));var BPromise=require('bluebird');var rp=require(_0xf61d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf61d('0x5'));var config=require(_0xf61d('0x6'));var attributes=require(_0xf61d('0x7'));module[_0xf61d('0x8')]=function(_0x1c89f8,_0x4af0f2){return _0x1c89f8[_0xf61d('0x9')](_0xf61d('0xa'),attributes,{'tableName':_0xf61d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 870e0c9..31a6043 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 _0x1ce6=['request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','Template,\x20%s,\x20%s','message','result','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ce6,0x1e2));var _0x61ce=function(_0x2cb318,_0xa517a4){_0x2cb318=_0x2cb318-0x0;var _0x12b0bd=_0x1ce6[_0x2cb318];return _0x12b0bd;};'use strict';var _=require('lodash');var util=require(_0x61ce('0x0'));var moment=require(_0x61ce('0x1'));var BPromise=require(_0x61ce('0x2'));var rs=require(_0x61ce('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61ce('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x61ce('0x5'))(_0x61ce('0x6'));var config=require(_0x61ce('0x7'));var jayson=require(_0x61ce('0x8'));var client=jayson[_0x61ce('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18ebd2,_0x541ace,_0x48cc19){return new BPromise(function(_0x24108,_0x79e7ea){return client[_0x61ce('0xa')](_0x18ebd2,_0x48cc19)[_0x61ce('0xb')](function(_0x75c26c){logger[_0x61ce('0xc')]('Template,\x20%s,\x20%s',_0x541ace,_0x61ce('0xd'));logger[_0x61ce('0xe')](_0x61ce('0xf'),_0x541ace,'request\x20sent',JSON['stringify'](_0x75c26c));if(_0x75c26c['error']){if(_0x75c26c[_0x61ce('0x10')][_0x61ce('0x11')]===0x1f4){logger[_0x61ce('0x10')](_0x61ce('0x12'),_0x541ace,_0x75c26c[_0x61ce('0x10')]['message']);return _0x79e7ea(_0x75c26c[_0x61ce('0x10')]['message']);}logger[_0x61ce('0x10')](_0x61ce('0x12'),_0x541ace,_0x75c26c['error'][_0x61ce('0x13')]);return _0x24108(_0x75c26c[_0x61ce('0x10')][_0x61ce('0x13')]);}else{logger[_0x61ce('0xc')](_0x61ce('0x12'),_0x541ace,_0x61ce('0xd'));_0x24108(_0x75c26c[_0x61ce('0x14')]['message']);}})['catch'](function(_0x1f1127){logger[_0x61ce('0x10')](_0x61ce('0x12'),_0x541ace,_0x1f1127);_0x79e7ea(_0x1f1127);});});}exports[_0x61ce('0x15')]=function(_0x350842){var _0x44e6cd=this;return new Promise(function(_0x363243,_0x4bc794){return db[_0x61ce('0x16')][_0x61ce('0x17')]({'raw':_0x350842[_0x61ce('0x18')]?_0x350842['options'][_0x61ce('0x19')]===undefined?!![]:![]:!![],'where':_0x350842[_0x61ce('0x18')]?_0x350842[_0x61ce('0x18')][_0x61ce('0x1a')]||null:null,'attributes':_0x350842[_0x61ce('0x18')]?_0x350842['options'][_0x61ce('0x1b')]||null:null,'limit':_0x350842[_0x61ce('0x18')]?_0x350842[_0x61ce('0x18')][_0x61ce('0x1c')]||null:null,'include':_0x350842['options']?_0x350842[_0x61ce('0x18')][_0x61ce('0x1d')]?_[_0x61ce('0x1e')](_0x350842['options'][_0x61ce('0x1d')],function(_0x1bbac9){return{'model':db[_0x1bbac9[_0x61ce('0x1f')]],'as':_0x1bbac9['as'],'attributes':_0x1bbac9[_0x61ce('0x1b')],'include':_0x1bbac9[_0x61ce('0x1d')]?_[_0x61ce('0x1e')](_0x1bbac9[_0x61ce('0x1d')],function(_0x3bd7e6){return{'model':db[_0x3bd7e6[_0x61ce('0x1f')]],'as':_0x3bd7e6['as'],'attributes':_0x3bd7e6[_0x61ce('0x1b')],'include':_0x3bd7e6['include']?_[_0x61ce('0x1e')](_0x3bd7e6[_0x61ce('0x1d')],function(_0x14fecd){return{'model':db[_0x14fecd[_0x61ce('0x1f')]],'as':_0x14fecd['as'],'attributes':_0x14fecd[_0x61ce('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x61ce('0xb')](function(_0x590186){logger['info'](_0x61ce('0x15'),_0x350842);logger[_0x61ce('0xe')](_0x61ce('0x15'),_0x350842,JSON[_0x61ce('0x20')](_0x590186));_0x363243(_0x590186);})['catch'](function(_0x2b2ddc){logger[_0x61ce('0x10')](_0x61ce('0x15'),_0x2b2ddc[_0x61ce('0x13')],_0x350842);_0x4bc794(_0x44e6cd['error'](0x1f4,_0x2b2ddc['message']));});});}; \ No newline at end of file +var _0xe1fe=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','result','GetTemplate','Template','findAll','options','raw','where','attributes','include','map','model','stringify','catch','lodash'];(function(_0x43ab28,_0x4b63c1){var _0x1d5c63=function(_0xe9c3b6){while(--_0xe9c3b6){_0x43ab28['push'](_0x43ab28['shift']());}};_0x1d5c63(++_0x4b63c1);}(_0xe1fe,0x1b9));var _0xee1f=function(_0x4c6bf8,_0x549a35){_0x4c6bf8=_0x4c6bf8-0x0;var _0x3b8326=_0xe1fe[_0x4c6bf8];return _0x3b8326;};'use strict';var _=require(_0xee1f('0x0'));var util=require(_0xee1f('0x1'));var moment=require(_0xee1f('0x2'));var BPromise=require(_0xee1f('0x3'));var rs=require(_0xee1f('0x4'));var fs=require('fs');var Redis=require(_0xee1f('0x5'));var db=require(_0xee1f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xee1f('0x7'))(_0xee1f('0x8'));var config=require('../../config/environment');var jayson=require(_0xee1f('0x9'));var client=jayson['client'][_0xee1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea012,_0x558b46,_0x470243){return new BPromise(function(_0x5754f0,_0x4f90f5){return client[_0xee1f('0xb')](_0x4ea012,_0x470243)[_0xee1f('0xc')](function(_0x2ca673){logger[_0xee1f('0xd')](_0xee1f('0xe'),_0x558b46,_0xee1f('0xf'));logger[_0xee1f('0x10')](_0xee1f('0x11'),_0x558b46,_0xee1f('0xf'),JSON['stringify'](_0x2ca673));if(_0x2ca673[_0xee1f('0x12')]){if(_0x2ca673[_0xee1f('0x12')][_0xee1f('0x13')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x558b46,_0x2ca673['error'][_0xee1f('0x14')]);return _0x4f90f5(_0x2ca673[_0xee1f('0x12')][_0xee1f('0x14')]);}logger['error'](_0xee1f('0xe'),_0x558b46,_0x2ca673[_0xee1f('0x12')][_0xee1f('0x14')]);return _0x5754f0(_0x2ca673['error'][_0xee1f('0x14')]);}else{logger[_0xee1f('0xd')]('Template,\x20%s,\x20%s',_0x558b46,_0xee1f('0xf'));_0x5754f0(_0x2ca673[_0xee1f('0x15')][_0xee1f('0x14')]);}})['catch'](function(_0x1a05c0){logger['error']('Template,\x20%s,\x20%s',_0x558b46,_0x1a05c0);_0x4f90f5(_0x1a05c0);});});}exports[_0xee1f('0x16')]=function(_0x2cd4b7){var _0x4a7898=this;return new Promise(function(_0x7d786c,_0x5ce58b){return db[_0xee1f('0x17')][_0xee1f('0x18')]({'raw':_0x2cd4b7[_0xee1f('0x19')]?_0x2cd4b7['options'][_0xee1f('0x1a')]===undefined?!![]:![]:!![],'where':_0x2cd4b7[_0xee1f('0x19')]?_0x2cd4b7[_0xee1f('0x19')][_0xee1f('0x1b')]||null:null,'attributes':_0x2cd4b7[_0xee1f('0x19')]?_0x2cd4b7['options'][_0xee1f('0x1c')]||null:null,'limit':_0x2cd4b7[_0xee1f('0x19')]?_0x2cd4b7[_0xee1f('0x19')]['limit']||null:null,'include':_0x2cd4b7[_0xee1f('0x19')]?_0x2cd4b7[_0xee1f('0x19')][_0xee1f('0x1d')]?_[_0xee1f('0x1e')](_0x2cd4b7['options'][_0xee1f('0x1d')],function(_0x414a58){return{'model':db[_0x414a58['model']],'as':_0x414a58['as'],'attributes':_0x414a58[_0xee1f('0x1c')],'include':_0x414a58['include']?_[_0xee1f('0x1e')](_0x414a58[_0xee1f('0x1d')],function(_0x3c2f22){return{'model':db[_0x3c2f22[_0xee1f('0x1f')]],'as':_0x3c2f22['as'],'attributes':_0x3c2f22[_0xee1f('0x1c')],'include':_0x3c2f22['include']?_[_0xee1f('0x1e')](_0x3c2f22['include'],function(_0x57a6ed){return{'model':db[_0x57a6ed[_0xee1f('0x1f')]],'as':_0x57a6ed['as'],'attributes':_0x57a6ed[_0xee1f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22a152){logger[_0xee1f('0xd')](_0xee1f('0x16'),_0x2cd4b7);logger[_0xee1f('0x10')]('GetTemplate',_0x2cd4b7,JSON[_0xee1f('0x20')](_0x22a152));_0x7d786c(_0x22a152);})[_0xee1f('0x21')](function(_0x240c78){logger[_0xee1f('0x12')](_0xee1f('0x16'),_0x240c78[_0xee1f('0x14')],_0x2cd4b7);_0x5ce58b(_0x4a7898[_0xee1f('0x12')](0x1f4,_0x240c78[_0xee1f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 89181cf..0fc3590 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 _0xd04c=['addAction','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','create','post','/:id/all_conditions','addAllCondition','addAnyCondition'];(function(_0x1934b4,_0x13ad7c){var _0x18acfd=function(_0x40d42f){while(--_0x40d42f){_0x1934b4['push'](_0x1934b4['shift']());}};_0x18acfd(++_0x13ad7c);}(_0xd04c,0x114));var _0xcd04=function(_0x2744c5,_0x3caacd){_0x2744c5=_0x2744c5-0x0;var _0x4d044b=_0xd04c[_0x2744c5];return _0x4d044b;};'use strict';var multer=require('multer');var util=require(_0xcd04('0x0'));var path=require(_0xcd04('0x1'));var timeout=require(_0xcd04('0x2'));var express=require(_0xcd04('0x3'));var router=express[_0xcd04('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcd04('0x5'));var config=require('../../config/environment');var controller=require(_0xcd04('0x6'));router[_0xcd04('0x7')]('/',auth[_0xcd04('0x8')](),controller[_0xcd04('0x9')]);router[_0xcd04('0x7')](_0xcd04('0xa'),auth[_0xcd04('0x8')](),controller[_0xcd04('0xb')]);router[_0xcd04('0x7')]('/:id/all_conditions',auth[_0xcd04('0x8')](),controller[_0xcd04('0xc')]);router['get'](_0xcd04('0xd'),auth[_0xcd04('0x8')](),controller[_0xcd04('0xe')]);router['get'](_0xcd04('0xf'),auth[_0xcd04('0x8')](),controller['getActions']);router['post']('/',auth[_0xcd04('0x8')](),controller[_0xcd04('0x10')]);router[_0xcd04('0x11')](_0xcd04('0x12'),auth[_0xcd04('0x8')](),controller[_0xcd04('0x13')]);router[_0xcd04('0x11')]('/:id/any_conditions',auth[_0xcd04('0x8')](),controller[_0xcd04('0x14')]);router[_0xcd04('0x11')](_0xcd04('0xf'),auth[_0xcd04('0x8')](),controller[_0xcd04('0x15')]);router[_0xcd04('0x16')](_0xcd04('0xa'),auth['isAuthenticated'](),controller[_0xcd04('0x17')]);router[_0xcd04('0x18')](_0xcd04('0xa'),auth[_0xcd04('0x8')](),controller[_0xcd04('0x19')]);module[_0xcd04('0x1a')]=router; \ No newline at end of file +var _0xdcca=['/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','addAllCondition','post','addAction','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions'];(function(_0xd2c332,_0x1b5f38){var _0x4efc6f=function(_0x56d70c){while(--_0x56d70c){_0xd2c332['push'](_0xd2c332['shift']());}};_0x4efc6f(++_0x1b5f38);}(_0xdcca,0x1f2));var _0xadcc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdcca[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xadcc('0x0'));var util=require(_0xadcc('0x1'));var path=require(_0xadcc('0x2'));var timeout=require('connect-timeout');var express=require(_0xadcc('0x3'));var router=express[_0xadcc('0x4')]();var auth=require(_0xadcc('0x5'));var interaction=require(_0xadcc('0x6'));var config=require(_0xadcc('0x7'));var controller=require(_0xadcc('0x8'));router[_0xadcc('0x9')]('/',auth[_0xadcc('0xa')](),controller[_0xadcc('0xb')]);router[_0xadcc('0x9')](_0xadcc('0xc'),auth[_0xadcc('0xa')](),controller['show']);router[_0xadcc('0x9')](_0xadcc('0xd'),auth[_0xadcc('0xa')](),controller[_0xadcc('0xe')]);router[_0xadcc('0x9')](_0xadcc('0xf'),auth[_0xadcc('0xa')](),controller[_0xadcc('0x10')]);router[_0xadcc('0x9')](_0xadcc('0x11'),auth['isAuthenticated'](),controller[_0xadcc('0x12')]);router['post']('/',auth[_0xadcc('0xa')](),controller[_0xadcc('0x13')]);router['post'](_0xadcc('0xd'),auth[_0xadcc('0xa')](),controller[_0xadcc('0x14')]);router[_0xadcc('0x15')](_0xadcc('0xf'),auth[_0xadcc('0xa')](),controller['addAnyCondition']);router[_0xadcc('0x15')]('/:id/actions',auth[_0xadcc('0xa')](),controller[_0xadcc('0x16')]);router[_0xadcc('0x17')](_0xadcc('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xadcc('0x18')](_0xadcc('0xc'),auth[_0xadcc('0xa')](),controller[_0xadcc('0x19')]);module[_0xadcc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 2bf4534..19bd763 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 _0xee50=['STRING','BOOLEAN','sequelize','exports'];(function(_0x37ab4a,_0x158850){var _0x39c270=function(_0x1eefc3){while(--_0x1eefc3){_0x37ab4a['push'](_0x37ab4a['shift']());}};_0x39c270(++_0x158850);}(_0xee50,0x14e));var _0x0ee5=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xee50[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0x0ee5('0x0'));module[_0x0ee5('0x1')]={'name':{'type':Sequelize[_0x0ee5('0x2')]},'channel':{'type':Sequelize[_0x0ee5('0x2')]},'description':{'type':Sequelize[_0x0ee5('0x2')]},'status':{'type':Sequelize[_0x0ee5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x519f=['BOOLEAN','sequelize','STRING'];(function(_0x160e80,_0x52a4f3){var _0x328e25=function(_0x4d48fb){while(--_0x4d48fb){_0x160e80['push'](_0x160e80['shift']());}};_0x328e25(++_0x52a4f3);}(_0x519f,0x1e1));var _0xf519=function(_0x2a5d8f,_0x2339c5){_0x2a5d8f=_0x2a5d8f-0x0;var _0x4bf624=_0x519f[_0x2a5d8f];return _0x4bf624;};'use strict';var Sequelize=require(_0xf519('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf519('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xf519('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 e4b3277..031e76e 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 _0xc353=['keys','intersection','attributes','length','hasOwnProperty','nolimit','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','fields','order','sort','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','save','update','then','destroy','Triggers','error','stack','name','send','index','map','Trigger','rawAttributes','type','key','model','query'];(function(_0x3a71d3,_0x22981b){var _0x309496=function(_0x5542aa){while(--_0x5542aa){_0x3a71d3['push'](_0x3a71d3['shift']());}};_0x309496(++_0x22981b);}(_0xc353,0x199));var _0x3c35=function(_0x29132b,_0xed0f8){_0x29132b=_0x29132b-0x0;var _0x1974e8=_0xc353[_0x29132b];return _0x1974e8;};'use strict';var pdf=require(_0x3c35('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3c35('0x1'));var zipdir=require(_0x3c35('0x2'));var jsonpatch=require(_0x3c35('0x3'));var rp=require(_0x3c35('0x4'));var moment=require(_0x3c35('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3c35('0x6'));var sox=require(_0x3c35('0x7'));var csv=require(_0x3c35('0x8'));var ejs=require(_0x3c35('0x9'));var fs=require('fs');var _=require(_0x3c35('0xa'));var squel=require('squel');var crypto=require(_0x3c35('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3c35('0xc'));var toCsv=require(_0x3c35('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3c35('0xd'));var authService=require(_0x3c35('0xe'));var qs=require(_0x3c35('0xf'));var as=require(_0x3c35('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c35('0x11'))(_0x3c35('0x12'));var utils=require(_0x3c35('0x13'));var config=require(_0x3c35('0x14'));var db=require(_0x3c35('0x15'))['db'];function respondWithStatusCode(_0x418303,_0x2dec36){_0x2dec36=_0x2dec36||0xcc;return function(_0x282a7a){if(_0x282a7a){return _0x418303[_0x3c35('0x16')](_0x2dec36);}return _0x418303['status'](_0x2dec36)['end']();};}function respondWithResult(_0x4ed224,_0xa3268f){_0xa3268f=_0xa3268f||0xc8;return function(_0x262ac6){if(_0x262ac6){return _0x4ed224[_0x3c35('0x17')](_0xa3268f)[_0x3c35('0x18')](_0x262ac6);}};}function respondWithFilteredResult(_0x19ce02,_0x1bc808){return function(_0x43e997){if(_0x43e997){var _0x2de0f2=_0x43e997[_0x3c35('0x19')],_0x42083a=_0x1bc808[_0x3c35('0x1a')],_0x4e051e=_0x1bc808['offset']+_0x1bc808[_0x3c35('0x1b')],_0x2777ec;if(_0x4e051e>=_0x2de0f2){_0x4e051e=_0x2de0f2;_0x2777ec=0xc8;}else{_0x2777ec=0xce;}_0x19ce02['status'](_0x2777ec);return _0x19ce02['set'](_0x3c35('0x1c'),_0x42083a+'-'+_0x4e051e+'/'+_0x2de0f2)['json'](_0x43e997);}return null;};}function patchUpdates(_0x15c8ea){return function(_0xef4ef0){try{jsonpatch['apply'](_0xef4ef0,_0x15c8ea,!![]);}catch(_0x210c7e){return BPromise['reject'](_0x210c7e);}return _0xef4ef0[_0x3c35('0x1d')]();};}function saveUpdates(_0x5553f8,_0x90dcf0){return function(_0x31f0be){if(_0x31f0be){return _0x31f0be[_0x3c35('0x1e')](_0x5553f8)[_0x3c35('0x1f')](function(_0xaa9a22){return _0xaa9a22;});}return null;};}function removeEntity(_0x411764,_0x6bbff6){return function(_0x2fb4cd){if(_0x2fb4cd){return _0x2fb4cd[_0x3c35('0x20')]()['then'](function(){var _0x1347bb=_0x2fb4cd['get']({'plain':!![]});var _0x25ea0d=_0x3c35('0x21');return db['UserProfileResource'][_0x3c35('0x20')]({'where':{'type':_0x25ea0d,'resourceId':_0x1347bb['id']}})[_0x3c35('0x1f')](function(){return _0x2fb4cd;});})[_0x3c35('0x1f')](function(){_0x411764[_0x3c35('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x272f3d,_0x382080){return function(_0x5b019b){if(!_0x5b019b){_0x272f3d['sendStatus'](0x194);}return _0x5b019b;};}function handleError(_0x53eb3b,_0x5af02c){_0x5af02c=_0x5af02c||0x1f4;return function(_0xa2e281){logger[_0x3c35('0x22')](_0xa2e281[_0x3c35('0x23')]);if(_0xa2e281[_0x3c35('0x24')]){delete _0xa2e281[_0x3c35('0x24')];}_0x53eb3b[_0x3c35('0x17')](_0x5af02c)[_0x3c35('0x25')](_0xa2e281);};}exports[_0x3c35('0x26')]=function(_0x49f1b7,_0x4dc672){var _0x555089={},_0x3ce8f3={},_0x5d28ab={'count':0x0,'rows':[]};var _0x3d2d20=_[_0x3c35('0x27')](db[_0x3c35('0x28')][_0x3c35('0x29')],function(_0x382c61){return{'name':_0x382c61['fieldName'],'type':_0x382c61[_0x3c35('0x2a')][_0x3c35('0x2b')]};});_0x3ce8f3[_0x3c35('0x2c')]=_[_0x3c35('0x27')](_0x3d2d20,_0x3c35('0x24'));_0x3ce8f3[_0x3c35('0x2d')]=_[_0x3c35('0x2e')](_0x49f1b7['query']);_0x3ce8f3['filters']=_[_0x3c35('0x2f')](_0x3ce8f3[_0x3c35('0x2c')],_0x3ce8f3[_0x3c35('0x2d')]);_0x555089[_0x3c35('0x30')]=_[_0x3c35('0x2f')](_0x3ce8f3[_0x3c35('0x2c')],qs['fields'](_0x49f1b7['query']['fields']));_0x555089[_0x3c35('0x30')]=_0x555089['attributes'][_0x3c35('0x31')]?_0x555089[_0x3c35('0x30')]:_0x3ce8f3['model'];if(!_0x49f1b7[_0x3c35('0x2d')][_0x3c35('0x32')](_0x3c35('0x33'))){_0x555089['limit']=qs[_0x3c35('0x1b')](_0x49f1b7[_0x3c35('0x2d')][_0x3c35('0x1b')]);_0x555089[_0x3c35('0x1a')]=qs[_0x3c35('0x1a')](_0x49f1b7[_0x3c35('0x2d')]['offset']);}_0x555089['order']=qs['sort'](_0x49f1b7[_0x3c35('0x2d')]['sort']);_0x555089[_0x3c35('0x34')]=qs[_0x3c35('0x35')](_[_0x3c35('0x36')](_0x49f1b7[_0x3c35('0x2d')],_0x3ce8f3[_0x3c35('0x35')]),_0x3d2d20);if(_0x49f1b7[_0x3c35('0x2d')][_0x3c35('0x37')]){_0x555089[_0x3c35('0x34')]=_['merge'](_0x555089[_0x3c35('0x34')],{'$or':_[_0x3c35('0x27')](_0x3d2d20,function(_0x29ef22){if(_0x29ef22[_0x3c35('0x2a')]!==_0x3c35('0x38')){var _0x2631c8={};_0x2631c8[_0x29ef22['name']]={'$like':'%'+_0x49f1b7[_0x3c35('0x2d')][_0x3c35('0x37')]+'%'};return _0x2631c8;}})});}_0x555089=_[_0x3c35('0x39')]({},_0x555089,_0x49f1b7[_0x3c35('0x3a')]);var _0x601752={'where':_0x555089[_0x3c35('0x34')]};return db[_0x3c35('0x28')][_0x3c35('0x19')](_0x601752)[_0x3c35('0x1f')](function(_0x5e63be){_0x5d28ab[_0x3c35('0x19')]=_0x5e63be;if(_0x49f1b7[_0x3c35('0x2d')][_0x3c35('0x3b')]){_0x555089[_0x3c35('0x3c')]=[{'all':!![]}];}return db[_0x3c35('0x28')][_0x3c35('0x3d')](_0x555089);})[_0x3c35('0x1f')](function(_0x26a50c){_0x5d28ab[_0x3c35('0x3e')]=_0x26a50c;return _0x5d28ab;})[_0x3c35('0x1f')](respondWithFilteredResult(_0x4dc672,_0x555089))[_0x3c35('0x3f')](handleError(_0x4dc672,null));};exports['show']=function(_0x933e76,_0x518e39){var _0x33e5a1={'raw':![],'where':{'id':_0x933e76[_0x3c35('0x40')]['id']}},_0x2ef032={};_0x2ef032[_0x3c35('0x2c')]=_['keys'](db[_0x3c35('0x28')][_0x3c35('0x29')]);_0x2ef032[_0x3c35('0x2d')]=_['keys'](_0x933e76[_0x3c35('0x2d')]);_0x2ef032[_0x3c35('0x35')]=_[_0x3c35('0x2f')](_0x2ef032[_0x3c35('0x2c')],_0x2ef032[_0x3c35('0x2d')]);_0x33e5a1[_0x3c35('0x30')]=_['intersection'](_0x2ef032[_0x3c35('0x2c')],qs['fields'](_0x933e76[_0x3c35('0x2d')]['fields']));_0x33e5a1[_0x3c35('0x30')]=_0x33e5a1[_0x3c35('0x30')]['length']?_0x33e5a1[_0x3c35('0x30')]:_0x2ef032['model'];if(_0x933e76['query'][_0x3c35('0x3b')]){_0x33e5a1['include']=[{'all':!![]}];}_0x33e5a1=_[_0x3c35('0x39')]({},_0x33e5a1,_0x933e76['options']);return db[_0x3c35('0x28')][_0x3c35('0x41')](_0x33e5a1)[_0x3c35('0x1f')](handleEntityNotFound(_0x518e39,null))[_0x3c35('0x1f')](respondWithResult(_0x518e39,null))[_0x3c35('0x3f')](handleError(_0x518e39,null));};exports[_0x3c35('0x42')]=function(_0x1541cc,_0x166889){return db[_0x3c35('0x28')][_0x3c35('0x42')](_0x1541cc[_0x3c35('0x43')],{})[_0x3c35('0x1f')](function(_0xb43e27){var _0xe00dbe=_0x1541cc[_0x3c35('0x44')][_0x3c35('0x45')]({'plain':!![]});if(!_0xe00dbe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe00dbe[_0x3c35('0x46')]===_0x3c35('0x44')){var _0x5b841a=_0xb43e27['get']({'plain':!![]});var _0xb787b5=_0x3c35('0x21');return db[_0x3c35('0x47')][_0x3c35('0x41')]({'where':{'name':_0xb787b5,'userProfileId':_0xe00dbe[_0x3c35('0x48')]},'raw':!![]})['then'](function(_0xff28){if(_0xff28&&_0xff28[_0x3c35('0x49')]===0x0){return db[_0x3c35('0x4a')]['create']({'name':_0x5b841a['name'],'resourceId':_0x5b841a['id'],'type':_0xff28[_0x3c35('0x24')],'sectionId':_0xff28['id']},{})[_0x3c35('0x1f')](function(){return _0xb43e27;});}else{return _0xb43e27;}})['catch'](function(_0x34a2bd){logger[_0x3c35('0x22')](_0x3c35('0x4b'),_0x34a2bd);throw _0x34a2bd;});}return _0xb43e27;})[_0x3c35('0x1f')](respondWithResult(_0x166889,0xc9))['catch'](handleError(_0x166889,null));};exports[_0x3c35('0x1e')]=function(_0x4db867,_0x1a4b5c){if(_0x4db867[_0x3c35('0x43')]['id']){delete _0x4db867[_0x3c35('0x43')]['id'];}return db[_0x3c35('0x28')][_0x3c35('0x41')]({'where':{'id':_0x4db867[_0x3c35('0x40')]['id']}})[_0x3c35('0x1f')](handleEntityNotFound(_0x1a4b5c,null))[_0x3c35('0x1f')](saveUpdates(_0x4db867[_0x3c35('0x43')],null))['then'](respondWithResult(_0x1a4b5c,null))['catch'](handleError(_0x1a4b5c,null));};exports['destroy']=function(_0x366b03,_0x7cdac7){return db[_0x3c35('0x28')][_0x3c35('0x41')]({'where':{'id':_0x366b03[_0x3c35('0x40')]['id']}})[_0x3c35('0x1f')](handleEntityNotFound(_0x7cdac7,null))['then'](removeEntity(_0x7cdac7,null))[_0x3c35('0x3f')](handleError(_0x7cdac7,null));};exports[_0x3c35('0x4c')]=function(_0x2f3f5c,_0x119987,_0x34df5d){if(_0x2f3f5c['body']['id']){delete _0x2f3f5c[_0x3c35('0x43')]['id'];}return db[_0x3c35('0x28')][_0x3c35('0x41')]({'where':{'id':_0x2f3f5c['params']['id']}})[_0x3c35('0x1f')](handleEntityNotFound(_0x119987,null))['then'](function(_0x3223c0){if(_0x3223c0){_0x2f3f5c['body'][_0x3c35('0x4d')]=_0x3223c0['id'];return db['Condition'][_0x3c35('0x42')](_0x2f3f5c['body']);}})[_0x3c35('0x1f')](respondWithResult(_0x119987,null))['catch'](handleError(_0x119987,null));};exports[_0x3c35('0x4e')]=function(_0x4d8513,_0x314cf0,_0x4df850){if(_0x4d8513[_0x3c35('0x43')]['id']){delete _0x4d8513[_0x3c35('0x43')]['id'];}return db['Trigger']['find']({'where':{'id':_0x4d8513[_0x3c35('0x40')]['id']}})[_0x3c35('0x1f')](handleEntityNotFound(_0x314cf0,null))[_0x3c35('0x1f')](function(_0x3fdd9b){if(_0x3fdd9b){_0x4d8513[_0x3c35('0x43')][_0x3c35('0x4f')]=_0x3fdd9b['id'];return db[_0x3c35('0x50')][_0x3c35('0x42')](_0x4d8513[_0x3c35('0x43')]);}})[_0x3c35('0x1f')](respondWithResult(_0x314cf0,null))[_0x3c35('0x3f')](handleError(_0x314cf0,null));};exports[_0x3c35('0x51')]=function(_0x1e5420,_0x5c7abe,_0x4cbdc5){var _0x5e718a={};var _0x208ec4={};var _0x29a703;var _0x27596b;return db[_0x3c35('0x28')][_0x3c35('0x52')]({'where':{'id':_0x1e5420[_0x3c35('0x40')]['id']}})['then'](handleEntityNotFound(_0x5c7abe,null))[_0x3c35('0x1f')](function(_0x44c1ec){if(_0x44c1ec){_0x29a703=_0x44c1ec;_0x208ec4[_0x3c35('0x2c')]=_[_0x3c35('0x2e')](db[_0x3c35('0x50')][_0x3c35('0x29')]);_0x208ec4['query']=_[_0x3c35('0x2e')](_0x1e5420[_0x3c35('0x2d')]);_0x208ec4[_0x3c35('0x35')]=_[_0x3c35('0x2f')](_0x208ec4['model'],_0x208ec4[_0x3c35('0x2d')]);_0x5e718a['attributes']=_[_0x3c35('0x2f')](_0x208ec4[_0x3c35('0x2c')],qs['fields'](_0x1e5420[_0x3c35('0x2d')][_0x3c35('0x53')]));_0x5e718a['attributes']=_0x5e718a[_0x3c35('0x30')][_0x3c35('0x31')]?_0x5e718a[_0x3c35('0x30')]:_0x208ec4[_0x3c35('0x2c')];_0x5e718a[_0x3c35('0x54')]=qs[_0x3c35('0x55')](_0x1e5420[_0x3c35('0x2d')][_0x3c35('0x55')]);_0x5e718a[_0x3c35('0x34')]=qs['filters'](_['pick'](_0x1e5420['query'],_0x208ec4[_0x3c35('0x35')]));if(_0x1e5420[_0x3c35('0x2d')]['filter']){_0x5e718a[_0x3c35('0x34')]=_[_0x3c35('0x39')](_0x5e718a[_0x3c35('0x34')],{'$or':_[_0x3c35('0x27')](_0x5e718a[_0x3c35('0x30')],function(_0x2bbd41){var _0x2fc0a7={};_0x2fc0a7[_0x2bbd41]={'$like':'%'+_0x1e5420[_0x3c35('0x2d')][_0x3c35('0x37')]+'%'};return _0x2fc0a7;})});}_0x5e718a=_[_0x3c35('0x39')]({},_0x5e718a,_0x1e5420[_0x3c35('0x3a')]);return _0x29a703[_0x3c35('0x51')](_0x5e718a);}})['then'](function(_0x5889d5){if(_0x5889d5){_0x27596b=_0x5889d5[_0x3c35('0x31')];if(!_0x1e5420['query'][_0x3c35('0x32')](_0x3c35('0x33'))){_0x5e718a['limit']=qs[_0x3c35('0x1b')](_0x1e5420[_0x3c35('0x2d')][_0x3c35('0x1b')]);_0x5e718a[_0x3c35('0x1a')]=qs['offset'](_0x1e5420[_0x3c35('0x2d')][_0x3c35('0x1a')]);}return _0x29a703[_0x3c35('0x51')](_0x5e718a);}})[_0x3c35('0x1f')](function(_0x24163c){if(_0x24163c){return _0x24163c?{'count':_0x27596b,'rows':_0x24163c}:null;}})[_0x3c35('0x1f')](respondWithResult(_0x5c7abe,null))['catch'](handleError(_0x5c7abe,null));};exports['getAnyConditions']=function(_0x48e969,_0x45db2a,_0x2161d4){var _0x13092d={};var _0x1e152c={};var _0x81082e;var _0x173307;return db[_0x3c35('0x28')]['findOne']({'where':{'id':_0x48e969[_0x3c35('0x40')]['id']}})[_0x3c35('0x1f')](handleEntityNotFound(_0x45db2a,null))['then'](function(_0x3dce9d){if(_0x3dce9d){_0x81082e=_0x3dce9d;_0x1e152c[_0x3c35('0x2c')]=_[_0x3c35('0x2e')](db['Condition'][_0x3c35('0x29')]);_0x1e152c['query']=_[_0x3c35('0x2e')](_0x48e969['query']);_0x1e152c[_0x3c35('0x35')]=_[_0x3c35('0x2f')](_0x1e152c[_0x3c35('0x2c')],_0x1e152c[_0x3c35('0x2d')]);_0x13092d[_0x3c35('0x30')]=_[_0x3c35('0x2f')](_0x1e152c[_0x3c35('0x2c')],qs[_0x3c35('0x53')](_0x48e969[_0x3c35('0x2d')][_0x3c35('0x53')]));_0x13092d[_0x3c35('0x30')]=_0x13092d[_0x3c35('0x30')][_0x3c35('0x31')]?_0x13092d[_0x3c35('0x30')]:_0x1e152c['model'];_0x13092d[_0x3c35('0x54')]=qs[_0x3c35('0x55')](_0x48e969[_0x3c35('0x2d')][_0x3c35('0x55')]);_0x13092d[_0x3c35('0x34')]=qs[_0x3c35('0x35')](_[_0x3c35('0x36')](_0x48e969[_0x3c35('0x2d')],_0x1e152c[_0x3c35('0x35')]));if(_0x48e969['query'][_0x3c35('0x37')]){_0x13092d[_0x3c35('0x34')]=_['merge'](_0x13092d[_0x3c35('0x34')],{'$or':_['map'](_0x13092d['attributes'],function(_0x2c084e){var _0x45b04={};_0x45b04[_0x2c084e]={'$like':'%'+_0x48e969[_0x3c35('0x2d')]['filter']+'%'};return _0x45b04;})});}_0x13092d=_['merge']({},_0x13092d,_0x48e969[_0x3c35('0x3a')]);return _0x81082e[_0x3c35('0x56')](_0x13092d);}})[_0x3c35('0x1f')](function(_0x51c191){if(_0x51c191){_0x173307=_0x51c191[_0x3c35('0x31')];if(!_0x48e969[_0x3c35('0x2d')]['hasOwnProperty'](_0x3c35('0x33'))){_0x13092d['limit']=qs[_0x3c35('0x1b')](_0x48e969[_0x3c35('0x2d')][_0x3c35('0x1b')]);_0x13092d[_0x3c35('0x1a')]=qs[_0x3c35('0x1a')](_0x48e969['query']['offset']);}return _0x81082e['getAnyConditions'](_0x13092d);}})[_0x3c35('0x1f')](function(_0x496903){if(_0x496903){return _0x496903?{'count':_0x173307,'rows':_0x496903}:null;}})[_0x3c35('0x1f')](respondWithResult(_0x45db2a,null))[_0x3c35('0x3f')](handleError(_0x45db2a,null));};exports[_0x3c35('0x57')]=function(_0x59ed8b,_0x197be7,_0x4dde1f){if(_0x59ed8b[_0x3c35('0x43')]['id']){delete _0x59ed8b[_0x3c35('0x43')]['id'];}return db['Trigger']['find']({'where':{'id':_0x59ed8b[_0x3c35('0x40')]['id']}})['then'](handleEntityNotFound(_0x197be7,null))[_0x3c35('0x1f')](function(_0x2daec3){if(_0x2daec3){_0x59ed8b[_0x3c35('0x43')][_0x3c35('0x58')]=_0x2daec3['id'];return db[_0x3c35('0x59')][_0x3c35('0x42')](_0x59ed8b['body']);}})['then'](respondWithResult(_0x197be7,null))[_0x3c35('0x3f')](handleError(_0x197be7,null));};exports[_0x3c35('0x5a')]=function(_0x13a15c,_0x48d718,_0x4f836){var _0x274207={};var _0x2069d9={};var _0xc50e1b;var _0x581ce4;return db[_0x3c35('0x28')][_0x3c35('0x52')]({'where':{'id':_0x13a15c['params']['id']}})[_0x3c35('0x1f')](handleEntityNotFound(_0x48d718,null))[_0x3c35('0x1f')](function(_0x21d295){if(_0x21d295){_0xc50e1b=_0x21d295;_0x2069d9['model']=_[_0x3c35('0x2e')](db[_0x3c35('0x59')][_0x3c35('0x29')]);_0x2069d9['query']=_[_0x3c35('0x2e')](_0x13a15c[_0x3c35('0x2d')]);_0x2069d9[_0x3c35('0x35')]=_[_0x3c35('0x2f')](_0x2069d9['model'],_0x2069d9[_0x3c35('0x2d')]);_0x274207['attributes']=_[_0x3c35('0x2f')](_0x2069d9[_0x3c35('0x2c')],qs['fields'](_0x13a15c[_0x3c35('0x2d')]['fields']));_0x274207['attributes']=_0x274207['attributes'][_0x3c35('0x31')]?_0x274207[_0x3c35('0x30')]:_0x2069d9[_0x3c35('0x2c')];_0x274207[_0x3c35('0x54')]=qs[_0x3c35('0x55')](_0x13a15c[_0x3c35('0x2d')][_0x3c35('0x55')]);_0x274207[_0x3c35('0x34')]=qs[_0x3c35('0x35')](_[_0x3c35('0x36')](_0x13a15c['query'],_0x2069d9[_0x3c35('0x35')]));if(_0x13a15c[_0x3c35('0x2d')][_0x3c35('0x37')]){_0x274207[_0x3c35('0x34')]=_[_0x3c35('0x39')](_0x274207[_0x3c35('0x34')],{'$or':_[_0x3c35('0x27')](_0x274207['attributes'],function(_0x46bd25){var _0x4ce3df={};_0x4ce3df[_0x46bd25]={'$like':'%'+_0x13a15c[_0x3c35('0x2d')][_0x3c35('0x37')]+'%'};return _0x4ce3df;})});}_0x274207=_['merge']({},_0x274207,_0x13a15c[_0x3c35('0x3a')]);return _0xc50e1b['getActions'](_0x274207);}})[_0x3c35('0x1f')](function(_0x10e113){if(_0x10e113){_0x581ce4=_0x10e113[_0x3c35('0x31')];if(!_0x13a15c['query'][_0x3c35('0x32')](_0x3c35('0x33'))){_0x274207[_0x3c35('0x1b')]=qs[_0x3c35('0x1b')](_0x13a15c['query'][_0x3c35('0x1b')]);_0x274207[_0x3c35('0x1a')]=qs['offset'](_0x13a15c[_0x3c35('0x2d')][_0x3c35('0x1a')]);}return _0xc50e1b['getActions'](_0x274207);}})[_0x3c35('0x1f')](function(_0x575e21){if(_0x575e21){return _0x575e21?{'count':_0x581ce4,'rows':_0x575e21}:null;}})[_0x3c35('0x1f')](respondWithResult(_0x48d718,null))[_0x3c35('0x3f')](handleError(_0x48d718,null));}; \ No newline at end of file +var _0x628e=['sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','error','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','Trigger','findAll','rows','catch','params','includeAll','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','addAction','getActions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb'];(function(_0x58348a,_0x328563){var _0x19529d=function(_0x3ad3ad){while(--_0x3ad3ad){_0x58348a['push'](_0x58348a['shift']());}};_0x19529d(++_0x328563);}(_0x628e,0x196));var _0xe628=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x628e[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe628('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe628('0x1'));var zipdir=require(_0xe628('0x2'));var jsonpatch=require(_0xe628('0x3'));var rp=require(_0xe628('0x4'));var moment=require('moment');var BPromise=require(_0xe628('0x5'));var Mustache=require('mustache');var util=require(_0xe628('0x6'));var path=require(_0xe628('0x7'));var sox=require('sox');var csv=require(_0xe628('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe628('0x9'));var squel=require(_0xe628('0xa'));var crypto=require(_0xe628('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe628('0x8'));var querystring=require(_0xe628('0xc'));var Papa=require(_0xe628('0xd'));var Redis=require(_0xe628('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe628('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe628('0x10'));var utils=require(_0xe628('0x11'));var config=require('../../config/environment');var db=require(_0xe628('0x12'))['db'];function respondWithStatusCode(_0x2f4bb2,_0xc1bb97){_0xc1bb97=_0xc1bb97||0xcc;return function(_0x3ba908){if(_0x3ba908){return _0x2f4bb2[_0xe628('0x13')](_0xc1bb97);}return _0x2f4bb2[_0xe628('0x14')](_0xc1bb97)[_0xe628('0x15')]();};}function respondWithResult(_0x2cb66c,_0x1ce8d){_0x1ce8d=_0x1ce8d||0xc8;return function(_0x2b0be0){if(_0x2b0be0){return _0x2cb66c[_0xe628('0x14')](_0x1ce8d)['json'](_0x2b0be0);}};}function respondWithFilteredResult(_0x25fbe4,_0x3adc21){return function(_0x1aac61){if(_0x1aac61){var _0x47e50b=_0x1aac61[_0xe628('0x16')],_0x3b32c7=_0x3adc21[_0xe628('0x17')],_0x296923=_0x3adc21[_0xe628('0x17')]+_0x3adc21[_0xe628('0x18')],_0x3b75b0;if(_0x296923>=_0x47e50b){_0x296923=_0x47e50b;_0x3b75b0=0xc8;}else{_0x3b75b0=0xce;}_0x25fbe4['status'](_0x3b75b0);return _0x25fbe4[_0xe628('0x19')](_0xe628('0x1a'),_0x3b32c7+'-'+_0x296923+'/'+_0x47e50b)['json'](_0x1aac61);}return null;};}function patchUpdates(_0x23d2eb){return function(_0x757259){try{jsonpatch[_0xe628('0x1b')](_0x757259,_0x23d2eb,!![]);}catch(_0x5c7b7f){return BPromise[_0xe628('0x1c')](_0x5c7b7f);}return _0x757259[_0xe628('0x1d')]();};}function saveUpdates(_0xbe044e,_0x481e61){return function(_0x3ae8a5){if(_0x3ae8a5){return _0x3ae8a5[_0xe628('0x1e')](_0xbe044e)[_0xe628('0x1f')](function(_0x49e15a){return _0x49e15a;});}return null;};}function removeEntity(_0x531d3d,_0xa46e40){return function(_0x27eacf){if(_0x27eacf){return _0x27eacf[_0xe628('0x20')]()[_0xe628('0x1f')](function(){var _0xfed5f4=_0x27eacf[_0xe628('0x21')]({'plain':!![]});var _0xa0c63e=_0xe628('0x22');return db['UserProfileResource'][_0xe628('0x20')]({'where':{'type':_0xa0c63e,'resourceId':_0xfed5f4['id']}})[_0xe628('0x1f')](function(){return _0x27eacf;});})['then'](function(){_0x531d3d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x284a5a,_0x1cfa3d){return function(_0x285fce){if(!_0x285fce){_0x284a5a[_0xe628('0x13')](0x194);}return _0x285fce;};}function handleError(_0x58baf7,_0x4fe5b1){_0x4fe5b1=_0x4fe5b1||0x1f4;return function(_0x39497c){logger[_0xe628('0x23')](_0x39497c['stack']);if(_0x39497c[_0xe628('0x24')]){delete _0x39497c[_0xe628('0x24')];}_0x58baf7[_0xe628('0x14')](_0x4fe5b1)[_0xe628('0x25')](_0x39497c);};}exports[_0xe628('0x26')]=function(_0x481ccc,_0x39858b){var _0x2dae8e={},_0x199a59={},_0x5082fb={'count':0x0,'rows':[]};var _0x4ed8ed=_[_0xe628('0x27')](db['Trigger'][_0xe628('0x28')],function(_0xd2fce4){return{'name':_0xd2fce4[_0xe628('0x29')],'type':_0xd2fce4['type'][_0xe628('0x2a')]};});_0x199a59[_0xe628('0x2b')]=_['map'](_0x4ed8ed,_0xe628('0x24'));_0x199a59['query']=_[_0xe628('0x2c')](_0x481ccc[_0xe628('0x2d')]);_0x199a59[_0xe628('0x2e')]=_['intersection'](_0x199a59[_0xe628('0x2b')],_0x199a59['query']);_0x2dae8e[_0xe628('0x2f')]=_[_0xe628('0x30')](_0x199a59[_0xe628('0x2b')],qs[_0xe628('0x31')](_0x481ccc[_0xe628('0x2d')][_0xe628('0x31')]));_0x2dae8e['attributes']=_0x2dae8e[_0xe628('0x2f')][_0xe628('0x32')]?_0x2dae8e[_0xe628('0x2f')]:_0x199a59[_0xe628('0x2b')];if(!_0x481ccc[_0xe628('0x2d')][_0xe628('0x33')](_0xe628('0x34'))){_0x2dae8e['limit']=qs['limit'](_0x481ccc['query'][_0xe628('0x18')]);_0x2dae8e[_0xe628('0x17')]=qs['offset'](_0x481ccc[_0xe628('0x2d')][_0xe628('0x17')]);}_0x2dae8e[_0xe628('0x35')]=qs['sort'](_0x481ccc[_0xe628('0x2d')][_0xe628('0x36')]);_0x2dae8e['where']=qs[_0xe628('0x2e')](_[_0xe628('0x37')](_0x481ccc[_0xe628('0x2d')],_0x199a59[_0xe628('0x2e')]),_0x4ed8ed);if(_0x481ccc[_0xe628('0x2d')][_0xe628('0x38')]){_0x2dae8e[_0xe628('0x39')]=_[_0xe628('0x3a')](_0x2dae8e[_0xe628('0x39')],{'$or':_[_0xe628('0x27')](_0x4ed8ed,function(_0x3fc1fe){if(_0x3fc1fe[_0xe628('0x3b')]!=='VIRTUAL'){var _0x323b67={};_0x323b67[_0x3fc1fe['name']]={'$like':'%'+_0x481ccc['query'][_0xe628('0x38')]+'%'};return _0x323b67;}})});}_0x2dae8e=_[_0xe628('0x3a')]({},_0x2dae8e,_0x481ccc[_0xe628('0x3c')]);var _0x2bcdf1={'where':_0x2dae8e[_0xe628('0x39')]};return db['Trigger']['count'](_0x2bcdf1)[_0xe628('0x1f')](function(_0x16ab3a){_0x5082fb[_0xe628('0x16')]=_0x16ab3a;if(_0x481ccc[_0xe628('0x2d')]['includeAll']){_0x2dae8e['include']=[{'all':!![]}];}return db[_0xe628('0x3d')][_0xe628('0x3e')](_0x2dae8e);})['then'](function(_0x212a00){_0x5082fb[_0xe628('0x3f')]=_0x212a00;return _0x5082fb;})[_0xe628('0x1f')](respondWithFilteredResult(_0x39858b,_0x2dae8e))[_0xe628('0x40')](handleError(_0x39858b,null));};exports['show']=function(_0x34859e,_0x5e02bd){var _0x26992e={'raw':![],'where':{'id':_0x34859e[_0xe628('0x41')]['id']}},_0x2fd631={};_0x2fd631['model']=_['keys'](db[_0xe628('0x3d')][_0xe628('0x28')]);_0x2fd631[_0xe628('0x2d')]=_[_0xe628('0x2c')](_0x34859e[_0xe628('0x2d')]);_0x2fd631[_0xe628('0x2e')]=_[_0xe628('0x30')](_0x2fd631[_0xe628('0x2b')],_0x2fd631[_0xe628('0x2d')]);_0x26992e[_0xe628('0x2f')]=_[_0xe628('0x30')](_0x2fd631[_0xe628('0x2b')],qs[_0xe628('0x31')](_0x34859e['query'][_0xe628('0x31')]));_0x26992e[_0xe628('0x2f')]=_0x26992e['attributes'][_0xe628('0x32')]?_0x26992e[_0xe628('0x2f')]:_0x2fd631[_0xe628('0x2b')];if(_0x34859e['query'][_0xe628('0x42')]){_0x26992e[_0xe628('0x43')]=[{'all':!![]}];}_0x26992e=_[_0xe628('0x3a')]({},_0x26992e,_0x34859e[_0xe628('0x3c')]);return db['Trigger'][_0xe628('0x44')](_0x26992e)[_0xe628('0x1f')](handleEntityNotFound(_0x5e02bd,null))[_0xe628('0x1f')](respondWithResult(_0x5e02bd,null))['catch'](handleError(_0x5e02bd,null));};exports['create']=function(_0x2a980d,_0x549ffe){return db[_0xe628('0x3d')]['create'](_0x2a980d[_0xe628('0x45')],{})[_0xe628('0x1f')](function(_0x47e2c4){var _0x543e98=_0x2a980d[_0xe628('0x46')][_0xe628('0x21')]({'plain':!![]});if(!_0x543e98)throw new Error(_0xe628('0x47'));if(_0x543e98[_0xe628('0x48')]===_0xe628('0x46')){var _0x2eb077=_0x47e2c4[_0xe628('0x21')]({'plain':!![]});var _0x170456=_0xe628('0x22');return db[_0xe628('0x49')][_0xe628('0x44')]({'where':{'name':_0x170456,'userProfileId':_0x543e98['userProfileId']},'raw':!![]})['then'](function(_0x371aef){if(_0x371aef&&_0x371aef['autoAssociation']===0x0){return db[_0xe628('0x4a')][_0xe628('0x4b')]({'name':_0x2eb077[_0xe628('0x24')],'resourceId':_0x2eb077['id'],'type':_0x371aef[_0xe628('0x24')],'sectionId':_0x371aef['id']},{})[_0xe628('0x1f')](function(){return _0x47e2c4;});}else{return _0x47e2c4;}})[_0xe628('0x40')](function(_0x2053fc){logger[_0xe628('0x23')](_0xe628('0x4c'),_0x2053fc);throw _0x2053fc;});}return _0x47e2c4;})[_0xe628('0x1f')](respondWithResult(_0x549ffe,0xc9))[_0xe628('0x40')](handleError(_0x549ffe,null));};exports['update']=function(_0xdfe0e7,_0x1b9314){if(_0xdfe0e7[_0xe628('0x45')]['id']){delete _0xdfe0e7[_0xe628('0x45')]['id'];}return db[_0xe628('0x3d')][_0xe628('0x44')]({'where':{'id':_0xdfe0e7[_0xe628('0x41')]['id']}})[_0xe628('0x1f')](handleEntityNotFound(_0x1b9314,null))[_0xe628('0x1f')](saveUpdates(_0xdfe0e7[_0xe628('0x45')],null))[_0xe628('0x1f')](respondWithResult(_0x1b9314,null))[_0xe628('0x40')](handleError(_0x1b9314,null));};exports[_0xe628('0x20')]=function(_0xbcf9,_0x3ee660){return db['Trigger']['find']({'where':{'id':_0xbcf9[_0xe628('0x41')]['id']}})[_0xe628('0x1f')](handleEntityNotFound(_0x3ee660,null))[_0xe628('0x1f')](removeEntity(_0x3ee660,null))[_0xe628('0x40')](handleError(_0x3ee660,null));};exports[_0xe628('0x4d')]=function(_0xcec06f,_0x4c837b,_0x54b74e){if(_0xcec06f[_0xe628('0x45')]['id']){delete _0xcec06f[_0xe628('0x45')]['id'];}return db['Trigger'][_0xe628('0x44')]({'where':{'id':_0xcec06f[_0xe628('0x41')]['id']}})[_0xe628('0x1f')](handleEntityNotFound(_0x4c837b,null))['then'](function(_0x4f1c1d){if(_0x4f1c1d){_0xcec06f['body']['TriggerAllId']=_0x4f1c1d['id'];return db[_0xe628('0x4e')][_0xe628('0x4b')](_0xcec06f[_0xe628('0x45')]);}})[_0xe628('0x1f')](respondWithResult(_0x4c837b,null))[_0xe628('0x40')](handleError(_0x4c837b,null));};exports['addAnyCondition']=function(_0x571d4f,_0x4f78c7,_0x2e682e){if(_0x571d4f[_0xe628('0x45')]['id']){delete _0x571d4f[_0xe628('0x45')]['id'];}return db[_0xe628('0x3d')][_0xe628('0x44')]({'where':{'id':_0x571d4f['params']['id']}})[_0xe628('0x1f')](handleEntityNotFound(_0x4f78c7,null))[_0xe628('0x1f')](function(_0x20d9c2){if(_0x20d9c2){_0x571d4f['body'][_0xe628('0x4f')]=_0x20d9c2['id'];return db[_0xe628('0x4e')]['create'](_0x571d4f[_0xe628('0x45')]);}})['then'](respondWithResult(_0x4f78c7,null))[_0xe628('0x40')](handleError(_0x4f78c7,null));};exports['getAllConditions']=function(_0x19711c,_0x45cbb9,_0x364a9f){var _0x375169={};var _0x4d0ff3={};var _0x2696d6;var _0x2ea3c3;return db['Trigger'][_0xe628('0x50')]({'where':{'id':_0x19711c[_0xe628('0x41')]['id']}})[_0xe628('0x1f')](handleEntityNotFound(_0x45cbb9,null))[_0xe628('0x1f')](function(_0x1cfb2b){if(_0x1cfb2b){_0x2696d6=_0x1cfb2b;_0x4d0ff3['model']=_[_0xe628('0x2c')](db[_0xe628('0x4e')][_0xe628('0x28')]);_0x4d0ff3[_0xe628('0x2d')]=_[_0xe628('0x2c')](_0x19711c['query']);_0x4d0ff3[_0xe628('0x2e')]=_[_0xe628('0x30')](_0x4d0ff3[_0xe628('0x2b')],_0x4d0ff3[_0xe628('0x2d')]);_0x375169[_0xe628('0x2f')]=_['intersection'](_0x4d0ff3[_0xe628('0x2b')],qs[_0xe628('0x31')](_0x19711c[_0xe628('0x2d')][_0xe628('0x31')]));_0x375169['attributes']=_0x375169[_0xe628('0x2f')][_0xe628('0x32')]?_0x375169['attributes']:_0x4d0ff3[_0xe628('0x2b')];_0x375169[_0xe628('0x35')]=qs[_0xe628('0x36')](_0x19711c['query'][_0xe628('0x36')]);_0x375169['where']=qs[_0xe628('0x2e')](_['pick'](_0x19711c[_0xe628('0x2d')],_0x4d0ff3['filters']));if(_0x19711c[_0xe628('0x2d')][_0xe628('0x38')]){_0x375169[_0xe628('0x39')]=_[_0xe628('0x3a')](_0x375169[_0xe628('0x39')],{'$or':_[_0xe628('0x27')](_0x375169['attributes'],function(_0x556f2b){var _0x1fa80d={};_0x1fa80d[_0x556f2b]={'$like':'%'+_0x19711c[_0xe628('0x2d')]['filter']+'%'};return _0x1fa80d;})});}_0x375169=_[_0xe628('0x3a')]({},_0x375169,_0x19711c[_0xe628('0x3c')]);return _0x2696d6['getAllConditions'](_0x375169);}})[_0xe628('0x1f')](function(_0x928bb9){if(_0x928bb9){_0x2ea3c3=_0x928bb9['length'];if(!_0x19711c[_0xe628('0x2d')][_0xe628('0x33')](_0xe628('0x34'))){_0x375169[_0xe628('0x18')]=qs[_0xe628('0x18')](_0x19711c[_0xe628('0x2d')][_0xe628('0x18')]);_0x375169[_0xe628('0x17')]=qs['offset'](_0x19711c[_0xe628('0x2d')][_0xe628('0x17')]);}return _0x2696d6[_0xe628('0x51')](_0x375169);}})[_0xe628('0x1f')](function(_0x207eb3){if(_0x207eb3){return _0x207eb3?{'count':_0x2ea3c3,'rows':_0x207eb3}:null;}})['then'](respondWithResult(_0x45cbb9,null))['catch'](handleError(_0x45cbb9,null));};exports['getAnyConditions']=function(_0x45b39f,_0x25fced,_0x18d3da){var _0xdee25f={};var _0x1c50a2={};var _0x5cdd2a;var _0x498cc8;return db['Trigger'][_0xe628('0x50')]({'where':{'id':_0x45b39f[_0xe628('0x41')]['id']}})[_0xe628('0x1f')](handleEntityNotFound(_0x25fced,null))[_0xe628('0x1f')](function(_0x2f88a4){if(_0x2f88a4){_0x5cdd2a=_0x2f88a4;_0x1c50a2[_0xe628('0x2b')]=_['keys'](db['Condition']['rawAttributes']);_0x1c50a2[_0xe628('0x2d')]=_[_0xe628('0x2c')](_0x45b39f[_0xe628('0x2d')]);_0x1c50a2[_0xe628('0x2e')]=_[_0xe628('0x30')](_0x1c50a2[_0xe628('0x2b')],_0x1c50a2[_0xe628('0x2d')]);_0xdee25f[_0xe628('0x2f')]=_['intersection'](_0x1c50a2[_0xe628('0x2b')],qs[_0xe628('0x31')](_0x45b39f[_0xe628('0x2d')][_0xe628('0x31')]));_0xdee25f[_0xe628('0x2f')]=_0xdee25f[_0xe628('0x2f')][_0xe628('0x32')]?_0xdee25f[_0xe628('0x2f')]:_0x1c50a2[_0xe628('0x2b')];_0xdee25f[_0xe628('0x35')]=qs[_0xe628('0x36')](_0x45b39f[_0xe628('0x2d')][_0xe628('0x36')]);_0xdee25f[_0xe628('0x39')]=qs[_0xe628('0x2e')](_[_0xe628('0x37')](_0x45b39f[_0xe628('0x2d')],_0x1c50a2[_0xe628('0x2e')]));if(_0x45b39f[_0xe628('0x2d')]['filter']){_0xdee25f[_0xe628('0x39')]=_[_0xe628('0x3a')](_0xdee25f[_0xe628('0x39')],{'$or':_[_0xe628('0x27')](_0xdee25f['attributes'],function(_0x12660f){var _0x585cf7={};_0x585cf7[_0x12660f]={'$like':'%'+_0x45b39f[_0xe628('0x2d')][_0xe628('0x38')]+'%'};return _0x585cf7;})});}_0xdee25f=_[_0xe628('0x3a')]({},_0xdee25f,_0x45b39f[_0xe628('0x3c')]);return _0x5cdd2a[_0xe628('0x52')](_0xdee25f);}})[_0xe628('0x1f')](function(_0x5d87ae){if(_0x5d87ae){_0x498cc8=_0x5d87ae[_0xe628('0x32')];if(!_0x45b39f[_0xe628('0x2d')][_0xe628('0x33')](_0xe628('0x34'))){_0xdee25f[_0xe628('0x18')]=qs[_0xe628('0x18')](_0x45b39f[_0xe628('0x2d')][_0xe628('0x18')]);_0xdee25f[_0xe628('0x17')]=qs[_0xe628('0x17')](_0x45b39f['query'][_0xe628('0x17')]);}return _0x5cdd2a[_0xe628('0x52')](_0xdee25f);}})[_0xe628('0x1f')](function(_0x30b9dc){if(_0x30b9dc){return _0x30b9dc?{'count':_0x498cc8,'rows':_0x30b9dc}:null;}})[_0xe628('0x1f')](respondWithResult(_0x25fced,null))[_0xe628('0x40')](handleError(_0x25fced,null));};exports[_0xe628('0x53')]=function(_0x30e9db,_0x15e811,_0x12b2c6){if(_0x30e9db[_0xe628('0x45')]['id']){delete _0x30e9db[_0xe628('0x45')]['id'];}return db[_0xe628('0x3d')][_0xe628('0x44')]({'where':{'id':_0x30e9db[_0xe628('0x41')]['id']}})[_0xe628('0x1f')](handleEntityNotFound(_0x15e811,null))[_0xe628('0x1f')](function(_0x109d1c){if(_0x109d1c){_0x30e9db[_0xe628('0x45')]['TriggerId']=_0x109d1c['id'];return db['Action'][_0xe628('0x4b')](_0x30e9db[_0xe628('0x45')]);}})[_0xe628('0x1f')](respondWithResult(_0x15e811,null))[_0xe628('0x40')](handleError(_0x15e811,null));};exports[_0xe628('0x54')]=function(_0x24cfd4,_0x4be163,_0x521ea1){var _0x51b38d={};var _0x468444={};var _0x56d41a;var _0x27e629;return db[_0xe628('0x3d')][_0xe628('0x50')]({'where':{'id':_0x24cfd4[_0xe628('0x41')]['id']}})[_0xe628('0x1f')](handleEntityNotFound(_0x4be163,null))['then'](function(_0x392e58){if(_0x392e58){_0x56d41a=_0x392e58;_0x468444[_0xe628('0x2b')]=_[_0xe628('0x2c')](db['Action']['rawAttributes']);_0x468444[_0xe628('0x2d')]=_[_0xe628('0x2c')](_0x24cfd4[_0xe628('0x2d')]);_0x468444[_0xe628('0x2e')]=_[_0xe628('0x30')](_0x468444[_0xe628('0x2b')],_0x468444[_0xe628('0x2d')]);_0x51b38d[_0xe628('0x2f')]=_[_0xe628('0x30')](_0x468444[_0xe628('0x2b')],qs[_0xe628('0x31')](_0x24cfd4[_0xe628('0x2d')]['fields']));_0x51b38d[_0xe628('0x2f')]=_0x51b38d[_0xe628('0x2f')][_0xe628('0x32')]?_0x51b38d[_0xe628('0x2f')]:_0x468444[_0xe628('0x2b')];_0x51b38d['order']=qs['sort'](_0x24cfd4['query'][_0xe628('0x36')]);_0x51b38d[_0xe628('0x39')]=qs[_0xe628('0x2e')](_['pick'](_0x24cfd4[_0xe628('0x2d')],_0x468444[_0xe628('0x2e')]));if(_0x24cfd4[_0xe628('0x2d')][_0xe628('0x38')]){_0x51b38d['where']=_[_0xe628('0x3a')](_0x51b38d['where'],{'$or':_['map'](_0x51b38d['attributes'],function(_0x1eb8cd){var _0x324add={};_0x324add[_0x1eb8cd]={'$like':'%'+_0x24cfd4[_0xe628('0x2d')][_0xe628('0x38')]+'%'};return _0x324add;})});}_0x51b38d=_[_0xe628('0x3a')]({},_0x51b38d,_0x24cfd4[_0xe628('0x3c')]);return _0x56d41a[_0xe628('0x54')](_0x51b38d);}})[_0xe628('0x1f')](function(_0xae8366){if(_0xae8366){_0x27e629=_0xae8366['length'];if(!_0x24cfd4[_0xe628('0x2d')][_0xe628('0x33')]('nolimit')){_0x51b38d[_0xe628('0x18')]=qs[_0xe628('0x18')](_0x24cfd4['query'][_0xe628('0x18')]);_0x51b38d['offset']=qs['offset'](_0x24cfd4[_0xe628('0x2d')][_0xe628('0x17')]);}return _0x56d41a[_0xe628('0x54')](_0x51b38d);}})[_0xe628('0x1f')](function(_0x400b7e){if(_0x400b7e){return _0x400b7e?{'count':_0x27e629,'rows':_0x400b7e}:null;}})['then'](respondWithResult(_0x4be163,null))[_0xe628('0x40')](handleError(_0x4be163,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 67ee8bb..dd079fc 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 _0xa509=['../../config/environment','./trigger.attributes','define','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0xa509,0x12f));var _0x9a50=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa509[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x9a50('0x0'));var util=require(_0x9a50('0x1'));var logger=require(_0x9a50('0x2'))(_0x9a50('0x3'));var moment=require('moment');var BPromise=require(_0x9a50('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a50('0x5'));var rimraf=require(_0x9a50('0x6'));var config=require(_0x9a50('0x7'));var attributes=require(_0x9a50('0x8'));module['exports']=function(_0x23fba6,_0x5a7a94){return _0x23fba6[_0x9a50('0x9')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0ba=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','util','../../config/logger'];(function(_0x5b49d4,_0x2cb5ad){var _0x605539=function(_0x1886b2){while(--_0x1886b2){_0x5b49d4['push'](_0x5b49d4['shift']());}};_0x605539(++_0x2cb5ad);}(_0xa0ba,0x1de));var _0xaa0b=function(_0x15ec35,_0x5b9972){_0x15ec35=_0x15ec35-0x0;var _0x937cce=_0xa0ba[_0x15ec35];return _0x937cce;};'use strict';var _=require('lodash');var util=require(_0xaa0b('0x0'));var logger=require(_0xaa0b('0x1'))('api');var moment=require(_0xaa0b('0x2'));var BPromise=require(_0xaa0b('0x3'));var rp=require(_0xaa0b('0x4'));var fs=require('fs');var path=require(_0xaa0b('0x5'));var rimraf=require(_0xaa0b('0x6'));var config=require(_0xaa0b('0x7'));var attributes=require(_0xaa0b('0x8'));module[_0xaa0b('0x9')]=function(_0x170704,_0x31feac){return _0x170704['define'](_0xaa0b('0xa'),attributes,{'tableName':_0xaa0b('0xb'),'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 f5437b8..b11a83a 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 _0xe511=['find','attributes','ShowTrigger','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrigger','Trigger','options','raw','where','include','map','model','then'];(function(_0x49adfe,_0x2fd329){var _0x1d53da=function(_0x4edbdb){while(--_0x4edbdb){_0x49adfe['push'](_0x49adfe['shift']());}};_0x1d53da(++_0x2fd329);}(_0xe511,0x16f));var _0x1e51=function(_0x55595d,_0x62144){_0x55595d=_0x55595d-0x0;var _0x3b0c2e=_0xe511[_0x55595d];return _0x3b0c2e;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var moment=require('moment');var BPromise=require(_0x1e51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e51('0x3'));var db=require(_0x1e51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e51('0x5'))(_0x1e51('0x6'));var config=require(_0x1e51('0x7'));var jayson=require(_0x1e51('0x8'));var client=jayson['client'][_0x1e51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21ed6b,_0x5c4590,_0x4fa2ba){return new BPromise(function(_0x394ad8,_0x133021){return client['request'](_0x21ed6b,_0x4fa2ba)['then'](function(_0x658941){logger[_0x1e51('0xa')](_0x1e51('0xb'),_0x5c4590,_0x1e51('0xc'));logger[_0x1e51('0xd')](_0x1e51('0xe'),_0x5c4590,'request\x20sent',JSON[_0x1e51('0xf')](_0x658941));if(_0x658941[_0x1e51('0x10')]){if(_0x658941[_0x1e51('0x10')][_0x1e51('0x11')]===0x1f4){logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941['error'][_0x1e51('0x12')]);return _0x133021(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);return _0x394ad8(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}else{logger[_0x1e51('0xa')]('Trigger,\x20%s,\x20%s',_0x5c4590,_0x1e51('0xc'));_0x394ad8(_0x658941[_0x1e51('0x13')][_0x1e51('0x12')]);}})['catch'](function(_0xa3b410){logger['error']('Trigger,\x20%s,\x20%s',_0x5c4590,_0xa3b410);_0x133021(_0xa3b410);});});}exports[_0x1e51('0x14')]=function(_0x27dcad){var _0x40ae4c=this;return new Promise(function(_0x4785a5,_0x4d1aae){return db[_0x1e51('0x15')]['findAll']({'raw':_0x27dcad[_0x1e51('0x16')]?_0x27dcad['options'][_0x1e51('0x17')]===undefined?!![]:![]:!![],'where':_0x27dcad[_0x1e51('0x16')]?_0x27dcad[_0x1e51('0x16')][_0x1e51('0x18')]||null:null,'attributes':_0x27dcad['options']?_0x27dcad['options']['attributes']||null:null,'limit':_0x27dcad['options']?_0x27dcad[_0x1e51('0x16')]['limit']||null:null,'include':_0x27dcad[_0x1e51('0x16')]?_0x27dcad[_0x1e51('0x16')][_0x1e51('0x19')]?_[_0x1e51('0x1a')](_0x27dcad[_0x1e51('0x16')][_0x1e51('0x19')],function(_0x270adf){return{'model':db[_0x270adf[_0x1e51('0x1b')]],'as':_0x270adf['as'],'attributes':_0x270adf['attributes'],'include':_0x270adf['include']?_[_0x1e51('0x1a')](_0x270adf[_0x1e51('0x19')],function(_0x2e42b1){return{'model':db[_0x2e42b1[_0x1e51('0x1b')]],'as':_0x2e42b1['as'],'attributes':_0x2e42b1['attributes'],'include':_0x2e42b1['include']?_['map'](_0x2e42b1[_0x1e51('0x19')],function(_0x2a1561){return{'model':db[_0x2a1561[_0x1e51('0x1b')]],'as':_0x2a1561['as'],'attributes':_0x2a1561['attributes']};}):[]};}):[]};}):[]:[]})[_0x1e51('0x1c')](function(_0x49c507){logger['info'](_0x1e51('0x14'),_0x27dcad);logger['debug'](_0x1e51('0x14'),_0x27dcad,JSON[_0x1e51('0xf')](_0x49c507));_0x4785a5(_0x49c507);})['catch'](function(_0x3e6ef2){logger[_0x1e51('0x10')](_0x1e51('0x14'),_0x3e6ef2[_0x1e51('0x12')],_0x27dcad);_0x4d1aae(_0x40ae4c['error'](0x1f4,_0x3e6ef2['message']));});});};exports['ShowTrigger']=function(_0x20eb9b){var _0x288b50=this;return new Promise(function(_0x1ba84a,_0x36dabe){return db[_0x1e51('0x15')][_0x1e51('0x1d')]({'raw':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')][_0x1e51('0x17')]===undefined?!![]:![]:!![],'where':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')]['where']||null:null,'attributes':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')][_0x1e51('0x1e')]||null:null,'include':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')]['include']?_[_0x1e51('0x1a')](_0x20eb9b['options'][_0x1e51('0x19')],function(_0x3fb57e){return{'model':db[_0x3fb57e[_0x1e51('0x1b')]],'as':_0x3fb57e['as'],'attributes':_0x3fb57e['attributes'],'include':_0x3fb57e[_0x1e51('0x19')]?_['map'](_0x3fb57e[_0x1e51('0x19')],function(_0x4e0187){return{'model':db[_0x4e0187['model']],'as':_0x4e0187['as'],'attributes':_0x4e0187[_0x1e51('0x1e')],'include':_0x4e0187[_0x1e51('0x19')]?_[_0x1e51('0x1a')](_0x4e0187['include'],function(_0x42ac30){return{'model':db[_0x42ac30['model']],'as':_0x42ac30['as'],'attributes':_0x42ac30[_0x1e51('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1e51('0x1c')](function(_0x5760ba){logger[_0x1e51('0xa')](_0x1e51('0x1f'),_0x20eb9b);logger[_0x1e51('0xd')](_0x1e51('0x1f'),_0x20eb9b,JSON[_0x1e51('0xf')](_0x5760ba));_0x1ba84a(_0x5760ba);})[_0x1e51('0x20')](function(_0x5c57a6){logger['error'](_0x1e51('0x1f'),_0x5c57a6['message'],_0x20eb9b);_0x36dabe(_0x288b50[_0x1e51('0x10')](0x1f4,_0x5c57a6[_0x1e51('0x12')]));});});}; \ No newline at end of file +var _0xe1e3=['result','GetTrigger','options','raw','where','attributes','limit','include','model','map','debug','catch','find','ShowTrigger','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','info'];(function(_0x3885ea,_0x2f87e8){var _0x548dab=function(_0x4f0c3c){while(--_0x4f0c3c){_0x3885ea['push'](_0x3885ea['shift']());}};_0x548dab(++_0x2f87e8);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x5787d5,_0x2f60b0){_0x5787d5=_0x5787d5-0x0;var _0x293f91=_0xe1e3[_0x5787d5];return _0x293f91;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var moment=require('moment');var BPromise=require(_0x3e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var config=require(_0x3e1e('0x6'));var jayson=require(_0x3e1e('0x7'));var client=jayson[_0x3e1e('0x8')][_0x3e1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55cfba,_0x1574e5,_0x13926d){return new BPromise(function(_0x2f0e12,_0xa67e35){return client[_0x3e1e('0xa')](_0x55cfba,_0x13926d)[_0x3e1e('0xb')](function(_0x5e7d1f){logger['info']('Trigger,\x20%s,\x20%s',_0x1574e5,_0x3e1e('0xc'));logger['debug'](_0x3e1e('0xd'),_0x1574e5,_0x3e1e('0xc'),JSON[_0x3e1e('0xe')](_0x5e7d1f));if(_0x5e7d1f['error']){if(_0x5e7d1f[_0x3e1e('0xf')]['code']===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x1574e5,_0x5e7d1f['error']['message']);return _0xa67e35(_0x5e7d1f[_0x3e1e('0xf')]['message']);}logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x5e7d1f[_0x3e1e('0xf')][_0x3e1e('0x11')]);return _0x2f0e12(_0x5e7d1f['error']['message']);}else{logger[_0x3e1e('0x12')](_0x3e1e('0x10'),_0x1574e5,'request\x20sent');_0x2f0e12(_0x5e7d1f[_0x3e1e('0x13')][_0x3e1e('0x11')]);}})['catch'](function(_0x11c07f){logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x11c07f);_0xa67e35(_0x11c07f);});});}exports[_0x3e1e('0x14')]=function(_0x1d786c){var _0x39eaa7=this;return new Promise(function(_0x791ed8,_0x1c181b){return db['Trigger']['findAll']({'raw':_0x1d786c['options']?_0x1d786c[_0x3e1e('0x15')][_0x3e1e('0x16')]===undefined?!![]:![]:!![],'where':_0x1d786c[_0x3e1e('0x15')]?_0x1d786c['options'][_0x3e1e('0x17')]||null:null,'attributes':_0x1d786c['options']?_0x1d786c[_0x3e1e('0x15')][_0x3e1e('0x18')]||null:null,'limit':_0x1d786c[_0x3e1e('0x15')]?_0x1d786c['options'][_0x3e1e('0x19')]||null:null,'include':_0x1d786c[_0x3e1e('0x15')]?_0x1d786c[_0x3e1e('0x15')]['include']?_['map'](_0x1d786c[_0x3e1e('0x15')][_0x3e1e('0x1a')],function(_0x488f9f){return{'model':db[_0x488f9f[_0x3e1e('0x1b')]],'as':_0x488f9f['as'],'attributes':_0x488f9f[_0x3e1e('0x18')],'include':_0x488f9f[_0x3e1e('0x1a')]?_[_0x3e1e('0x1c')](_0x488f9f[_0x3e1e('0x1a')],function(_0x159212){return{'model':db[_0x159212[_0x3e1e('0x1b')]],'as':_0x159212['as'],'attributes':_0x159212[_0x3e1e('0x18')],'include':_0x159212['include']?_['map'](_0x159212[_0x3e1e('0x1a')],function(_0x541ef1){return{'model':db[_0x541ef1['model']],'as':_0x541ef1['as'],'attributes':_0x541ef1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a33bb){logger[_0x3e1e('0x12')]('GetTrigger',_0x1d786c);logger[_0x3e1e('0x1d')]('GetTrigger',_0x1d786c,JSON[_0x3e1e('0xe')](_0x1a33bb));_0x791ed8(_0x1a33bb);})[_0x3e1e('0x1e')](function(_0x53a6ff){logger[_0x3e1e('0xf')](_0x3e1e('0x14'),_0x53a6ff[_0x3e1e('0x11')],_0x1d786c);_0x1c181b(_0x39eaa7['error'](0x1f4,_0x53a6ff[_0x3e1e('0x11')]));});});};exports['ShowTrigger']=function(_0x591c36){var _0x494c75=this;return new Promise(function(_0x39da8d,_0x5b8f95){return db['Trigger'][_0x3e1e('0x1f')]({'raw':_0x591c36[_0x3e1e('0x15')]?_0x591c36[_0x3e1e('0x15')][_0x3e1e('0x16')]===undefined?!![]:![]:!![],'where':_0x591c36[_0x3e1e('0x15')]?_0x591c36['options']['where']||null:null,'attributes':_0x591c36['options']?_0x591c36['options'][_0x3e1e('0x18')]||null:null,'include':_0x591c36[_0x3e1e('0x15')]?_0x591c36[_0x3e1e('0x15')][_0x3e1e('0x1a')]?_[_0x3e1e('0x1c')](_0x591c36[_0x3e1e('0x15')][_0x3e1e('0x1a')],function(_0x431bd5){return{'model':db[_0x431bd5['model']],'as':_0x431bd5['as'],'attributes':_0x431bd5[_0x3e1e('0x18')],'include':_0x431bd5[_0x3e1e('0x1a')]?_['map'](_0x431bd5[_0x3e1e('0x1a')],function(_0x3f4ef3){return{'model':db[_0x3f4ef3[_0x3e1e('0x1b')]],'as':_0x3f4ef3['as'],'attributes':_0x3f4ef3[_0x3e1e('0x18')],'include':_0x3f4ef3['include']?_['map'](_0x3f4ef3[_0x3e1e('0x1a')],function(_0x332f1e){return{'model':db[_0x332f1e['model']],'as':_0x332f1e['as'],'attributes':_0x332f1e[_0x3e1e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3e1e('0xb')](function(_0x4e9acd){logger[_0x3e1e('0x12')](_0x3e1e('0x20'),_0x591c36);logger[_0x3e1e('0x1d')](_0x3e1e('0x20'),_0x591c36,JSON[_0x3e1e('0xe')](_0x4e9acd));_0x39da8d(_0x4e9acd);})['catch'](function(_0x1da527){logger[_0x3e1e('0xf')](_0x3e1e('0x20'),_0x1da527[_0x3e1e('0x11')],_0x591c36);_0x5b8f95(_0x494c75['error'](0x1f4,_0x1da527[_0x3e1e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 3b6ea8e..9562f88 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 _0x0e85=['connect-timeout','express','../../config/environment','get','isAuthenticated','index','show','post','/:id/clone','clone','create','put','/:id','update','delete','exports','multer','util'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x0e85,0x7c));var _0x50e8=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x0e85[_0xb24a3e];return _0x4038d7;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x50e8('0x4'));var controller=require('./trunk.controller');router[_0x50e8('0x5')]('/',auth[_0x50e8('0x6')](),controller[_0x50e8('0x7')]);router[_0x50e8('0x5')]('/:id',auth[_0x50e8('0x6')](),controller[_0x50e8('0x8')]);router[_0x50e8('0x9')](_0x50e8('0xa'),auth[_0x50e8('0x6')](),controller[_0x50e8('0xb')]);router['post']('/',auth[_0x50e8('0x6')](),controller[_0x50e8('0xc')]);router[_0x50e8('0xd')](_0x50e8('0xe'),auth[_0x50e8('0x6')](),controller[_0x50e8('0xf')]);router[_0x50e8('0x10')](_0x50e8('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x50e8('0x11')]=router; \ No newline at end of file +var _0xbec5=['../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','/:id','show','post','/:id/clone','clone','put','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0xbec5,0xe5));var _0x5bec=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0xbec5[_0xd050c6];return _0x7278a;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var auth=require(_0x5bec('0x5'));var interaction=require(_0x5bec('0x6'));var config=require('../../config/environment');var controller=require(_0x5bec('0x7'));router[_0x5bec('0x8')]('/',auth[_0x5bec('0x9')](),controller['index']);router[_0x5bec('0x8')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xb')]);router[_0x5bec('0xc')](_0x5bec('0xd'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xe')]);router['post']('/',auth[_0x5bec('0x9')](),controller['create']);router[_0x5bec('0xf')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller['update']);router[_0x5bec('0x10')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller['destroy']);module[_0x5bec('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 43ee2b8..420cb4f 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 _0x1424=['PROHIB_FAILED_SCREEN','STRING','setDataValue','transport','join','getDataValue','split','rfc2833','info','yes','nonat','update','outgoing','nat','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','uas','fingerprint','certificate','active','passive','BOOLEAN','sequelize','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0x87c54b,_0x3b8efe){var _0x220b10=function(_0x4ec1cb){while(--_0x4ec1cb){_0x87c54b['push'](_0x87c54b['shift']());}};_0x220b10(++_0x3b8efe);}(_0x1424,0xc3));var _0x4142=function(_0x33bd99,_0xc5f114){_0x33bd99=_0x33bd99-0x0;var _0x2c253c=_0x1424[_0x33bd99];return _0x2c253c;};'use strict';var Sequelize=require(_0x4142('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4142('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4142('0x2')](_0x4142('0x3'),_0x4142('0x4'),'peer'),'allowNull':![],'defaultValue':_0x4142('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4142('0x5')},'callingpres':{'type':Sequelize[_0x4142('0x2')](_0x4142('0x6'),'ALLOWED_PASSED_SCREEN',_0x4142('0x7'),'ALLOWED',_0x4142('0x8'),_0x4142('0x9'),_0x4142('0xa'),'PROHIB')},'deny':{'type':Sequelize[_0x4142('0xb')]},'permit':{'type':Sequelize[_0x4142('0xb')]},'secret':{'type':Sequelize[_0x4142('0xb')]},'md5secret':{'type':Sequelize[_0x4142('0xb')]},'remotesecret':{'type':Sequelize[_0x4142('0xb')]},'transport':{'type':Sequelize[_0x4142('0xb')],'defaultValue':'udp','set':function(_0x33d897){this[_0x4142('0xc')](_0x4142('0xd'),_0x33d897?_0x33d897[_0x4142('0xe')](','):null);},'get':function(){return this[_0x4142('0xf')](_0x4142('0xd'))?this[_0x4142('0xf')](_0x4142('0xd'))[_0x4142('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x4142('0x2')](_0x4142('0x11'),_0x4142('0x12'),'shortinfo','inband','auto'),'defaultValue':_0x4142('0x11')},'directmedia':{'type':Sequelize[_0x4142('0x2')](_0x4142('0x13'),'no',_0x4142('0x14'),_0x4142('0x15'),_0x4142('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4142('0x2')](_0x4142('0x13'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4142('0xb')]},'directmediadeny':{'type':Sequelize[_0x4142('0xb')]},'nat':{'type':Sequelize[_0x4142('0xb')],'defaultValue':'force_rport,comedia','set':function(_0x224fb1){this[_0x4142('0xc')]('nat',_0x224fb1?_0x224fb1[_0x4142('0xe')](','):null);},'get':function(){return this[_0x4142('0xf')](_0x4142('0x17'))?this[_0x4142('0xf')](_0x4142('0x17'))[_0x4142('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x4142('0xb')]},'namedcallgroup':{'type':Sequelize[_0x4142('0xb')]},'pickupgroup':{'type':Sequelize[_0x4142('0xb')]},'namedpickupgroup':{'type':Sequelize[_0x4142('0xb')]},'language':{'type':Sequelize[_0x4142('0xb')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x4142('0xb')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x4142('0xb')],'allowNull':![],'defaultValue':_0x4142('0x18'),'set':function(_0x2d7e29){this[_0x4142('0xc')](_0x4142('0x19'),_0x2d7e29?_0x2d7e29[_0x4142('0xe')](';'):_0x4142('0x18'));},'get':function(){return this[_0x4142('0xf')](_0x4142('0x19'))?this[_0x4142('0xf')]('allow')['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x4142('0x2')](_0x4142('0x13'),'no')},'insecure':{'type':Sequelize[_0x4142('0xb')],'defaultValue':_0x4142('0x1a'),'set':function(_0x3971c0){this['setDataValue'](_0x4142('0x1b'),_0x3971c0?_0x3971c0['join'](','):null);},'get':function(){return this['getDataValue'](_0x4142('0x1b'))?this[_0x4142('0xf')](_0x4142('0x1b'))[_0x4142('0x10')](','):null;},'comment':_0x4142('0x1c')},'trustrpid':{'type':Sequelize['ENUM'](_0x4142('0x13'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4142('0x2')](_0x4142('0x13'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x4142('0x13'),'no',_0x4142('0x1d'))},'promiscredir':{'type':Sequelize[_0x4142('0x2')](_0x4142('0x13'),'no')},'useclientcode':{'type':Sequelize[_0x4142('0x2')](_0x4142('0x13'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x4142('0xb')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x4142('0x1e')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x4142('0x2')](_0x4142('0x13'),'no'),'defaultValue':_0x4142('0x13')},'busylevel':{'type':Sequelize[_0x4142('0x1f')](0xb)},'allowoverlap':{'type':Sequelize[_0x4142('0x2')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x4142('0x13'),'no')},'allowtransfer':{'type':Sequelize[_0x4142('0x2')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x4142('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x4142('0xb')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x4142('0x2')]('yes','no',_0x4142('0x20')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4142('0x1f')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x4142('0x2')](_0x4142('0x13'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x4142('0x2')](_0x4142('0x21'),_0x4142('0x22'),'originate')},'session_expires':{'type':Sequelize[_0x4142('0x1f')](0xb)},'session_minse':{'type':Sequelize[_0x4142('0x1f')](0xb)},'session_refresher':{'type':Sequelize[_0x4142('0x2')]('uac',_0x4142('0x23')),'defaultValue':_0x4142('0x23')},'t38pt_usertpsource':{'type':Sequelize[_0x4142('0xb')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x4142('0xb')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4142('0x1f')](0x5)},'qualify':{'type':Sequelize[_0x4142('0x2')](_0x4142('0x13'),'no'),'defaultValue':_0x4142('0x13')},'keepalive':{'type':Sequelize[_0x4142('0x1f')](0xb)},'defaultip':{'type':Sequelize[_0x4142('0xb')]},'defaultuser':{'type':Sequelize[_0x4142('0xb')]},'rtptimeout':{'type':Sequelize[_0x4142('0x1f')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x4142('0x1f')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x4142('0x1f')](0xb)},'sendrpid':{'type':Sequelize[_0x4142('0x2')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4142('0xb')]},'callbackextension':{'type':Sequelize[_0x4142('0xb')]},'timert1':{'type':Sequelize[_0x4142('0x1f')](0xb)},'timerb':{'type':Sequelize[_0x4142('0x1f')](0xb)},'qualifyfreq':{'type':Sequelize[_0x4142('0x1f')](0xb)},'contactpermit':{'type':Sequelize[_0x4142('0xb')]},'contactdeny':{'type':Sequelize[_0x4142('0xb')]},'contactacl':{'type':Sequelize[_0x4142('0xb')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x4142('0xb')]},'maxforwards':{'type':Sequelize[_0x4142('0x1f')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x4142('0x13'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4142('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0x4142('0x2')](_0x4142('0x13'),'no')},'icesupport':{'type':Sequelize[_0x4142('0x2')](_0x4142('0x13'),'no')},'dtlsenable':{'type':Sequelize[_0x4142('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x4142('0x2')]('yes','no',_0x4142('0x24'),_0x4142('0x25'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x4142('0xb')]},'dtlsprivatekey':{'type':Sequelize[_0x4142('0xb')]},'dtlscipher':{'type':Sequelize[_0x4142('0xb')]},'dtlscafile':{'type':Sequelize[_0x4142('0xb')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0x4142('0x26'),_0x4142('0x27'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4142('0xb')]},'usereqphone':{'type':Sequelize[_0x4142('0x2')](_0x4142('0x13'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4142('0xb')]},'recordofffeature':{'type':Sequelize[_0x4142('0xb')]},'call_limit':{'type':Sequelize[_0x4142('0x1f')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x4142('0x2')](_0x4142('0x13'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x4142('0xb')]},'mohinterpret':{'type':Sequelize[_0x4142('0xb')]},'mohsuggest':{'type':Sequelize[_0x4142('0xb')]},'parkinglot':{'type':Sequelize[_0x4142('0xb')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4142('0xb')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x4142('0x13'),'no','nonat',_0x4142('0x15'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x4142('0xb')]},'otherFields':{'type':Sequelize[_0x4142('0xb')]},'active':{'type':Sequelize[_0x4142('0x28')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x4142('0xb')],'defaultValue':'no'}}; \ No newline at end of file +var _0xe5cf=['fingerprint','certificate','active','passive','actpass','update','update,nonat','sequelize','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED','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','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','setDataValue','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]','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai'];(function(_0x159553,_0x21815e){var _0x36e45e=function(_0x41b4df){while(--_0x41b4df){_0x159553['push'](_0x159553['shift']());}};_0x36e45e(++_0x21815e);}(_0xe5cf,0xc3));var _0xfe5c=function(_0x2ce6e4,_0x2da396){_0x2ce6e4=_0x2ce6e4-0x0;var _0x54d6c8=_0xe5cf[_0x2ce6e4];return _0x54d6c8;};'use strict';var Sequelize=require(_0xfe5c('0x0'));module['exports']={'name':{'type':Sequelize[_0xfe5c('0x1')],'allowNull':![],'unique':_0xfe5c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xfe5c('0x3')](_0xfe5c('0x4'),_0xfe5c('0x5'),_0xfe5c('0x6')),'allowNull':![],'defaultValue':_0xfe5c('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfe5c('0x7')},'callingpres':{'type':Sequelize[_0xfe5c('0x3')](_0xfe5c('0x8'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0xfe5c('0x9'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xfe5c('0xa'),'PROHIB')},'deny':{'type':Sequelize[_0xfe5c('0x1')]},'permit':{'type':Sequelize[_0xfe5c('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xfe5c('0x1')]},'transport':{'type':Sequelize[_0xfe5c('0x1')],'defaultValue':'udp','set':function(_0x4e3123){this['setDataValue'](_0xfe5c('0xb'),_0x4e3123?_0x4e3123[_0xfe5c('0xc')](','):null);},'get':function(){return this[_0xfe5c('0xd')](_0xfe5c('0xb'))?this[_0xfe5c('0xd')]('transport')[_0xfe5c('0xe')](','):null;},'comment':_0xfe5c('0xf')},'dtmfmode':{'type':Sequelize[_0xfe5c('0x3')](_0xfe5c('0x10'),_0xfe5c('0x11'),_0xfe5c('0x12'),_0xfe5c('0x13'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xfe5c('0x3')](_0xfe5c('0x14'),'no',_0xfe5c('0x15'),'update',_0xfe5c('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xfe5c('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xfe5c('0x1')]},'directmediadeny':{'type':Sequelize[_0xfe5c('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xfe5c('0x17'),'set':function(_0x41a154){this['setDataValue'](_0xfe5c('0x18'),_0x41a154?_0x41a154['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0xfe5c('0xd')](_0xfe5c('0x18'))[_0xfe5c('0xe')](','):null;},'comment':_0xfe5c('0x19')},'callgroup':{'type':Sequelize[_0xfe5c('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xfe5c('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xfe5c('0x1')]},'language':{'type':Sequelize[_0xfe5c('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xfe5c('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xfe5c('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xfe5c('0x1')],'allowNull':![],'defaultValue':_0xfe5c('0x1a'),'set':function(_0x1715c2){this[_0xfe5c('0x1b')](_0xfe5c('0x1c'),_0x1715c2?_0x1715c2[_0xfe5c('0xc')](';'):_0xfe5c('0x1a'));},'get':function(){return this[_0xfe5c('0xd')](_0xfe5c('0x1c'))?this[_0xfe5c('0xd')](_0xfe5c('0x1c'))[_0xfe5c('0xe')](';'):null;},'comment':_0xfe5c('0x1d')},'autoframing':{'type':Sequelize[_0xfe5c('0x3')](_0xfe5c('0x14'),'no')},'insecure':{'type':Sequelize[_0xfe5c('0x1')],'defaultValue':'port,invite','set':function(_0x42d5b9){this[_0xfe5c('0x1b')](_0xfe5c('0x1e'),_0x42d5b9?_0x42d5b9[_0xfe5c('0xc')](','):null);},'get':function(){return this[_0xfe5c('0xd')](_0xfe5c('0x1e'))?this['getDataValue'](_0xfe5c('0x1e'))[_0xfe5c('0xe')](','):null;},'comment':_0xfe5c('0x1f')},'trustrpid':{'type':Sequelize['ENUM'](_0xfe5c('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xfe5c('0x14'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xfe5c('0x14'),'no','never')},'promiscredir':{'type':Sequelize[_0xfe5c('0x3')](_0xfe5c('0x14'),'no')},'useclientcode':{'type':Sequelize[_0xfe5c('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0xfe5c('0x20')](0xb)},'setvar':{'type':Sequelize[_0xfe5c('0x1')]},'callerid':{'type':Sequelize[_0xfe5c('0x1')],'defaultValue':_0xfe5c('0x21')},'amaflags':{'type':Sequelize[_0xfe5c('0x1')]},'callcounter':{'type':Sequelize[_0xfe5c('0x3')](_0xfe5c('0x14'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xfe5c('0x20')](0xb)},'allowoverlap':{'type':Sequelize[_0xfe5c('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xfe5c('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xfe5c('0x14'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0xfe5c('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xfe5c('0x3')](_0xfe5c('0x14'),'no',_0xfe5c('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0xfe5c('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0xfe5c('0x23'),_0xfe5c('0x24'),'originate')},'session_expires':{'type':Sequelize[_0xfe5c('0x20')](0xb)},'session_minse':{'type':Sequelize[_0xfe5c('0x20')](0xb)},'session_refresher':{'type':Sequelize[_0xfe5c('0x3')](_0xfe5c('0x25'),_0xfe5c('0x26')),'defaultValue':_0xfe5c('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0xfe5c('0x1')]},'regexten':{'type':Sequelize[_0xfe5c('0x1')]},'fromdomain':{'type':Sequelize[_0xfe5c('0x1')]},'fromuser':{'type':Sequelize[_0xfe5c('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xfe5c('0x3')](_0xfe5c('0x14'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xfe5c('0x20')](0xb)},'defaultip':{'type':Sequelize[_0xfe5c('0x1')]},'defaultuser':{'type':Sequelize[_0xfe5c('0x1')]},'rtptimeout':{'type':Sequelize[_0xfe5c('0x20')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xfe5c('0x20')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0xfe5c('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xfe5c('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xfe5c('0x20')](0xb)},'timerb':{'type':Sequelize[_0xfe5c('0x20')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xfe5c('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xfe5c('0x1')]},'use_q850_reason':{'type':Sequelize[_0xfe5c('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xfe5c('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xfe5c('0x3')](_0xfe5c('0x14'),'no')},'force_avp':{'type':Sequelize[_0xfe5c('0x3')](_0xfe5c('0x14'),'no')},'icesupport':{'type':Sequelize[_0xfe5c('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xfe5c('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xfe5c('0x3')]('yes','no',_0xfe5c('0x28'),_0xfe5c('0x29'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xfe5c('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xfe5c('0x1')]},'dtlscapath':{'type':Sequelize[_0xfe5c('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xfe5c('0x2a'),_0xfe5c('0x2b'),_0xfe5c('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xfe5c('0x3')](_0xfe5c('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xfe5c('0x1')]},'recordofffeature':{'type':Sequelize[_0xfe5c('0x1')]},'call_limit':{'type':Sequelize[_0xfe5c('0x20')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xfe5c('0x3')](_0xfe5c('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0xfe5c('0x3')](_0xfe5c('0x14'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xfe5c('0x1')]},'parkinglot':{'type':Sequelize[_0xfe5c('0x1')]},'description':{'type':Sequelize[_0xfe5c('0x1')]},'host':{'type':Sequelize[_0xfe5c('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xfe5c('0x3')]('yes','no',_0xfe5c('0x15'),_0xfe5c('0x2d'),_0xfe5c('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xfe5c('0x1')]},'otherFields':{'type':Sequelize[_0xfe5c('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xfe5c('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 0d9c5bb..8fdf9f2 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 _0xb74d=['sort','where','pick','merge','type','VIRTUAL','filter','includeAll','rows','params','rawAttributes','find','include','options','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','create','findAll','readFileSync','root','server/files/templates/trunk.ejs','utf8','join','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','userProfileId','autoAssociation','server/files/templates/registry.ejs','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','send','map','Trunk','fieldName','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order'];(function(_0x23924c,_0x575211){var _0x1102f4=function(_0x465140){while(--_0x465140){_0x23924c['push'](_0x23924c['shift']());}};_0x1102f4(++_0x575211);}(_0xb74d,0x16e));var _0xdb74=function(_0x19d24c,_0x62bc50){_0x19d24c=_0x19d24c-0x0;var _0x2fae8d=_0xb74d[_0x19d24c];return _0x2fae8d;};'use strict';var pdf=require(_0xdb74('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdb74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb74('0x2'));var rp=require('request-promise');var moment=require(_0xdb74('0x3'));var BPromise=require(_0xdb74('0x4'));var Mustache=require(_0xdb74('0x5'));var util=require('util');var path=require(_0xdb74('0x6'));var sox=require(_0xdb74('0x7'));var csv=require(_0xdb74('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xdb74('0x9'));var crypto=require('crypto');var jsforce=require(_0xdb74('0xa'));var deskjs=require(_0xdb74('0xb'));var toCsv=require('to-csv');var querystring=require(_0xdb74('0xc'));var Papa=require('papaparse');var Redis=require(_0xdb74('0xd'));var authService=require(_0xdb74('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xdb74('0xf'));var hardwareService=require(_0xdb74('0x10'));var logger=require(_0xdb74('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xdb74('0x12'));var db=require(_0xdb74('0x13'))['db'];var jayson=require(_0xdb74('0x14'));var client=jayson[_0xdb74('0x15')][_0xdb74('0x16')]({'port':0x232a});function checkPasswordPattern(_0x2e44a4,_0x3a159d,_0x101d22){if(_0x101d22){var _0x26ec1a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x26ec1a[_0xdb74('0x17')](_0x3a159d)){return _0x2e44a4;}else{throw new db[(_0xdb74('0x18'))][(_0xdb74('0x19'))](_0xdb74('0x1a'));}}else{return _0x2e44a4;}}function respondWithRpcPromise(_0x49ffcc,_0x3e8f63,_0x3d9d7a,_0x23f848){return new BPromise(function(_0x206b4d,_0x4f3c5b){var _0x582c96=_0x23f848||client;return _0x582c96[_0xdb74('0x1b')](_0x49ffcc,_0x3d9d7a)[_0xdb74('0x1c')](function(_0x507d2f){logger[_0xdb74('0x1d')](_0xdb74('0x1e'),_0x3e8f63,_0xdb74('0x1f'));logger[_0xdb74('0x20')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3e8f63,_0xdb74('0x1f'),JSON[_0xdb74('0x21')](_0x507d2f));if(_0x507d2f[_0xdb74('0x22')]){if(_0x507d2f['error']['code']===0x1f4){logger[_0xdb74('0x22')]('Trunk,\x20%s,\x20%s',_0x3e8f63,_0x507d2f[_0xdb74('0x22')][_0xdb74('0x23')]);return _0x4f3c5b(_0x507d2f[_0xdb74('0x22')][_0xdb74('0x23')]);}logger['error'](_0xdb74('0x1e'),_0x3e8f63,_0x507d2f[_0xdb74('0x22')][_0xdb74('0x23')]);return _0x206b4d(_0x507d2f[_0xdb74('0x22')][_0xdb74('0x23')]);}else{logger['info'](_0xdb74('0x1e'),_0x3e8f63,'request\x20sent');_0x206b4d(_0x507d2f[_0xdb74('0x24')][_0xdb74('0x23')]);}})[_0xdb74('0x25')](function(_0x49296a){logger[_0xdb74('0x22')](_0xdb74('0x1e'),_0x3e8f63,_0x49296a);_0x4f3c5b(_0x49296a);});});}function respondWithStatusCode(_0x429cee,_0x7fffbf){_0x7fffbf=_0x7fffbf||0xcc;return function(_0x2d0049){if(_0x2d0049){return _0x429cee[_0xdb74('0x26')](_0x7fffbf);}return _0x429cee[_0xdb74('0x27')](_0x7fffbf)[_0xdb74('0x28')]();};}function respondWithResult(_0x9d8021,_0x334242){_0x334242=_0x334242||0xc8;return function(_0x602930){if(_0x602930){return _0x9d8021['status'](_0x334242)[_0xdb74('0x29')](_0x602930);}};}function respondWithFilteredResult(_0x367573,_0x423165){return function(_0x2714b2){if(_0x2714b2){var _0x1eea24=_0x2714b2[_0xdb74('0x2a')],_0x3c1b45=_0x423165[_0xdb74('0x2b')],_0xd98810=_0x423165['offset']+_0x423165[_0xdb74('0x2c')],_0x2025c8;if(_0xd98810>=_0x1eea24){_0xd98810=_0x1eea24;_0x2025c8=0xc8;}else{_0x2025c8=0xce;}_0x367573[_0xdb74('0x27')](_0x2025c8);return _0x367573[_0xdb74('0x2d')](_0xdb74('0x2e'),_0x3c1b45+'-'+_0xd98810+'/'+_0x1eea24)[_0xdb74('0x29')](_0x2714b2);}return null;};}function patchUpdates(_0x583422){return function(_0x228b91){try{jsonpatch[_0xdb74('0x2f')](_0x228b91,_0x583422,!![]);}catch(_0x3167ca){return BPromise[_0xdb74('0x30')](_0x3167ca);}return _0x228b91['save']();};}function saveUpdates(_0x338bdd,_0x5c2fca){return function(_0x4e9a26){if(_0x4e9a26){return _0x4e9a26[_0xdb74('0x31')](_0x338bdd)[_0xdb74('0x1c')](function(_0x127f0f){return _0x127f0f;});}return null;};}function removeEntity(_0x1aaa2c,_0x51e0d5){return function(_0x26cc61){if(_0x26cc61){return _0x26cc61[_0xdb74('0x32')]()['then'](function(){var _0x3f1d1d=_0x26cc61[_0xdb74('0x33')]({'plain':!![]});var _0x14bb4e=_0xdb74('0x34');return db[_0xdb74('0x35')][_0xdb74('0x32')]({'where':{'type':_0x14bb4e,'resourceId':_0x3f1d1d['id']}})[_0xdb74('0x1c')](function(){return _0x26cc61;});})[_0xdb74('0x1c')](function(){_0x1aaa2c[_0xdb74('0x27')](0xcc)[_0xdb74('0x28')]();});}};}function handleEntityNotFound(_0x360939,_0x3045a3){return function(_0x122ee8){if(!_0x122ee8){_0x360939['sendStatus'](0x194);}return _0x122ee8;};}function handleError(_0x3b82e1,_0x32efc6){_0x32efc6=_0x32efc6||0x1f4;return function(_0x201841){logger[_0xdb74('0x22')](_0x201841[_0xdb74('0x36')]);if(_0x201841[_0xdb74('0x37')]){delete _0x201841[_0xdb74('0x37')];}_0x3b82e1[_0xdb74('0x27')](_0x32efc6)[_0xdb74('0x38')](_0x201841);};}exports['index']=function(_0x33f3c0,_0x5b1e8f){var _0x30b6e6={},_0x54d384={},_0x885775={'count':0x0,'rows':[]};var _0x3bd152=_[_0xdb74('0x39')](db[_0xdb74('0x3a')]['rawAttributes'],function(_0x38c278){return{'name':_0x38c278[_0xdb74('0x3b')],'type':_0x38c278['type']['key']};});_0x54d384['model']=_[_0xdb74('0x39')](_0x3bd152,'name');_0x54d384['query']=_[_0xdb74('0x3c')](_0x33f3c0[_0xdb74('0x3d')]);_0x54d384[_0xdb74('0x3e')]=_[_0xdb74('0x3f')](_0x54d384['model'],_0x54d384[_0xdb74('0x3d')]);_0x30b6e6['attributes']=_[_0xdb74('0x3f')](_0x54d384[_0xdb74('0x40')],qs[_0xdb74('0x41')](_0x33f3c0[_0xdb74('0x3d')][_0xdb74('0x41')]));_0x30b6e6[_0xdb74('0x42')]=_0x30b6e6[_0xdb74('0x42')][_0xdb74('0x43')]?_0x30b6e6[_0xdb74('0x42')]:_0x54d384['model'];if(!_0x33f3c0['query']['hasOwnProperty'](_0xdb74('0x44'))){_0x30b6e6[_0xdb74('0x2c')]=qs[_0xdb74('0x2c')](_0x33f3c0[_0xdb74('0x3d')]['limit']);_0x30b6e6[_0xdb74('0x2b')]=qs[_0xdb74('0x2b')](_0x33f3c0[_0xdb74('0x3d')][_0xdb74('0x2b')]);}_0x30b6e6[_0xdb74('0x45')]=qs[_0xdb74('0x46')](_0x33f3c0[_0xdb74('0x3d')]['sort']);_0x30b6e6[_0xdb74('0x47')]=qs[_0xdb74('0x3e')](_[_0xdb74('0x48')](_0x33f3c0[_0xdb74('0x3d')],_0x54d384[_0xdb74('0x3e')]),_0x3bd152);if(_0x33f3c0[_0xdb74('0x3d')]['filter']){_0x30b6e6[_0xdb74('0x47')]=_[_0xdb74('0x49')](_0x30b6e6[_0xdb74('0x47')],{'$or':_[_0xdb74('0x39')](_0x3bd152,function(_0x507364){if(_0x507364[_0xdb74('0x4a')]!==_0xdb74('0x4b')){var _0x3f62c2={};_0x3f62c2[_0x507364['name']]={'$like':'%'+_0x33f3c0[_0xdb74('0x3d')][_0xdb74('0x4c')]+'%'};return _0x3f62c2;}})});}_0x30b6e6=_[_0xdb74('0x49')]({},_0x30b6e6,_0x33f3c0['options']);var _0x26cda9={'where':_0x30b6e6[_0xdb74('0x47')]};return db[_0xdb74('0x3a')][_0xdb74('0x2a')](_0x26cda9)[_0xdb74('0x1c')](function(_0x2527ac){_0x885775['count']=_0x2527ac;if(_0x33f3c0[_0xdb74('0x3d')][_0xdb74('0x4d')]){_0x30b6e6['include']=[{'all':!![]}];}return db[_0xdb74('0x3a')]['findAll'](_0x30b6e6);})[_0xdb74('0x1c')](function(_0xb1d718){_0x885775[_0xdb74('0x4e')]=_0xb1d718;return _0x885775;})[_0xdb74('0x1c')](respondWithFilteredResult(_0x5b1e8f,_0x30b6e6))['catch'](handleError(_0x5b1e8f,null));};exports['show']=function(_0x2eff64,_0x514bef){var _0x5826fd={'raw':![],'where':{'id':_0x2eff64[_0xdb74('0x4f')]['id']}},_0x2509b5={};_0x2509b5[_0xdb74('0x40')]=_[_0xdb74('0x3c')](db[_0xdb74('0x3a')][_0xdb74('0x50')]);_0x2509b5[_0xdb74('0x3d')]=_[_0xdb74('0x3c')](_0x2eff64[_0xdb74('0x3d')]);_0x2509b5[_0xdb74('0x3e')]=_['intersection'](_0x2509b5[_0xdb74('0x40')],_0x2509b5[_0xdb74('0x3d')]);_0x5826fd[_0xdb74('0x42')]=_[_0xdb74('0x3f')](_0x2509b5['model'],qs[_0xdb74('0x41')](_0x2eff64['query'][_0xdb74('0x41')]));_0x5826fd[_0xdb74('0x42')]=_0x5826fd[_0xdb74('0x42')][_0xdb74('0x43')]?_0x5826fd[_0xdb74('0x42')]:_0x2509b5[_0xdb74('0x40')];if(_0x2eff64[_0xdb74('0x3d')][_0xdb74('0x4d')]){_0x5826fd['include']=[{'all':!![]}];}_0x5826fd=_[_0xdb74('0x49')]({},_0x5826fd,_0x2eff64['options']);return db[_0xdb74('0x3a')][_0xdb74('0x51')](_0x5826fd)['then'](handleEntityNotFound(_0x514bef,null))[_0xdb74('0x1c')](respondWithResult(_0x514bef,null))['catch'](handleError(_0x514bef,null));};exports['clone']=function(_0x571120,_0x5052ab){var _0x42185b={'where':{'id':_0x571120[_0xdb74('0x4f')]['id']}},_0x17bd18={};_0x17bd18[_0xdb74('0x40')]=_[_0xdb74('0x3c')](db['Trunk'][_0xdb74('0x50')]);_0x42185b['attributes']=_[_0xdb74('0x3f')](_0x17bd18['model'],qs[_0xdb74('0x41')](_0x571120[_0xdb74('0x3d')][_0xdb74('0x41')]));_0x42185b[_0xdb74('0x42')]=_0x42185b[_0xdb74('0x42')][_0xdb74('0x43')]?_0x42185b[_0xdb74('0x42')]:_0x17bd18['model'];if(_0x571120[_0xdb74('0x3d')][_0xdb74('0x4d')]){_0x42185b[_0xdb74('0x52')]=[{'all':!![]}];}_0x42185b=_[_0xdb74('0x49')]({},_0x42185b,_0x571120[_0xdb74('0x53')]);return db[_0xdb74('0x3a')]['find'](_0x42185b)['then'](handleEntityNotFound(_0x5052ab,null))[_0xdb74('0x1c')](function(_0x50b4dd){if(_0x50b4dd){var _0x593703=_0x50b4dd['get']({'plain':!![]});_0x593703=qs['omit'](_0x593703,['id',_0xdb74('0x54'),_0xdb74('0x55')]);_0x571120[_0xdb74('0x56')]=_['omit'](_0x571120[_0xdb74('0x56')],['id','createdAt',_0xdb74('0x55')]);return db[_0xdb74('0x3a')]['create'](_[_0xdb74('0x49')](_0x593703,_0x571120['body']),{'include':_0x571120['query'][_0xdb74('0x4d')]?[{'all':!![]}]:undefined})['then'](function(_0x3e7ed4){var _0x62d16c=_0x571120[_0xdb74('0x57')][_0xdb74('0x33')]({'plain':!![]});if(!_0x62d16c)throw new Error(_0xdb74('0x58'));if(_0x62d16c[_0xdb74('0x59')]===_0xdb74('0x57')){var _0x29bbc0=_0x3e7ed4[_0xdb74('0x33')]({'plain':!![]});var _0x56552f=_0xdb74('0x34');return db[_0xdb74('0x5a')]['find']({'where':{'name':_0x56552f,'userProfileId':_0x62d16c['userProfileId']},'raw':!![]})['then'](function(_0x2363d0){if(_0x2363d0&&_0x2363d0['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x29bbc0[_0xdb74('0x37')],'resourceId':_0x29bbc0['id'],'type':_0x2363d0[_0xdb74('0x37')],'sectionId':_0x2363d0['id']},{})['then'](function(){return _0x3e7ed4;});}else{return _0x3e7ed4;}})[_0xdb74('0x25')](function(_0x3daaeb){logger[_0xdb74('0x22')](_0xdb74('0x5b'),_0x3daaeb);throw _0x3daaeb;});}return _0x3e7ed4;});}})[_0xdb74('0x1c')](respondWithResult(_0x5052ab,0xc9))['catch'](handleError(_0x5052ab,null));};exports[_0xdb74('0x5c')]=function(_0x1d2b8f,_0x3c9d7a,_0x389540){var _0x3f8547;return db[_0xdb74('0x3a')][_0xdb74('0x5c')](_0x1d2b8f['body'],{'raw':!![]})[_0xdb74('0x1c')](function(_0x8f3ad9){_0x3f8547=_0x8f3ad9;return db['Trunk'][_0xdb74('0x5d')]({'raw':!![]});})[_0xdb74('0x1c')](function(_0x497391){var _0x1be4c0=fs[_0xdb74('0x5e')](path['join'](config[_0xdb74('0x5f')],_0xdb74('0x60')),_0xdb74('0x61'));var _0x3ecca6=fs[_0xdb74('0x5e')](path[_0xdb74('0x62')](config[_0xdb74('0x5f')],'server/files/templates/registry.ejs'),_0xdb74('0x61'));var _0x4442fb=ejs[_0xdb74('0x63')](_0x1be4c0,{'trunks':_0x497391||[]});fs[_0xdb74('0x64')](_0xdb74('0x65'),_0x4442fb);if(_0x3f8547[_0xdb74('0x66')]){var _0x1c3200=ejs[_0xdb74('0x63')](_0x3ecca6,{'trunks':_0x497391||[]});fs[_0xdb74('0x64')](_0xdb74('0x67'),_0x1c3200);}})[_0xdb74('0x1c')](function(){return respondWithRpcPromise(_0xdb74('0x68'),_0xdb74('0x5c'),{'module':_0xdb74('0x69')});})[_0xdb74('0x1c')](function(){var _0x2ba278=_0x1d2b8f[_0xdb74('0x57')][_0xdb74('0x33')]({'plain':!![]});if(!_0x2ba278)throw new Error(_0xdb74('0x58'));if(_0x2ba278[_0xdb74('0x59')]===_0xdb74('0x57')){var _0x2d8915=_0x3f8547[_0xdb74('0x33')]({'plain':!![]});return db[_0xdb74('0x5a')][_0xdb74('0x51')]({'where':{'name':_0xdb74('0x34'),'userProfileId':_0x2ba278[_0xdb74('0x6a')]},'raw':!![]})['then'](function(_0x13d9dd){if(_0x13d9dd&&_0x13d9dd[_0xdb74('0x6b')]===0x0){return db['UserProfileResource'][_0xdb74('0x5c')]({'name':_0x2d8915['name'],'resourceId':_0x2d8915['id'],'type':_0x13d9dd[_0xdb74('0x37')],'sectionId':_0x13d9dd['id']},{})['then'](function(){return _0x3f8547;});}else{return _0x3f8547;}})[_0xdb74('0x25')](function(_0x450a38){logger[_0xdb74('0x22')](_0xdb74('0x5b'),_0x450a38);throw _0x450a38;});}return _0x3f8547;})[_0xdb74('0x1c')](respondWithResult(_0x3c9d7a,0xc9))['catch'](handleError(_0x3c9d7a,null));};exports[_0xdb74('0x31')]=function(_0x5737a0,_0x17fd2a,_0x1d0cf3){var _0x2abe75;return db['Trunk'][_0xdb74('0x51')]({'where':{'id':_0x5737a0['params']['id']}})['then'](handleEntityNotFound(_0x17fd2a,null))['then'](saveUpdates(_0x5737a0[_0xdb74('0x56')],null))['then'](function(_0x119698){if(_0x119698){_0x2abe75=_0x119698;return db[_0xdb74('0x3a')][_0xdb74('0x5d')]({'raw':!![]});}})['then'](function(_0x2171c1){if(_0x2171c1){var _0x40c7c8=fs[_0xdb74('0x5e')](path[_0xdb74('0x62')](config[_0xdb74('0x5f')],_0xdb74('0x60')),_0xdb74('0x61'));var _0x55e397=fs['readFileSync'](path[_0xdb74('0x62')](config['root'],_0xdb74('0x6c')),_0xdb74('0x61'));var _0x24c356=ejs['render'](_0x40c7c8,{'trunks':_0x2171c1||[]});fs['writeFileSync'](_0xdb74('0x65'),_0x24c356);var _0xcaabe3=ejs[_0xdb74('0x63')](_0x55e397,{'trunks':_0x2171c1||[]});fs[_0xdb74('0x64')](_0xdb74('0x67'),_0xcaabe3);return respondWithRpcPromise(_0xdb74('0x68'),'update',{'module':'chan_sip.so'});}return null;})[_0xdb74('0x1c')](function(_0x43bda6){if(_0x43bda6){return _0x2abe75;}})[_0xdb74('0x1c')](respondWithResult(_0x17fd2a,null))['catch'](handleError(_0x17fd2a,null));};exports[_0xdb74('0x32')]=function(_0x474c54,_0x5ac565,_0xfd085d){var _0x2eb313;return db[_0xdb74('0x3a')][_0xdb74('0x51')]({'where':{'id':_0x474c54[_0xdb74('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5ac565,null))[_0xdb74('0x1c')](removeEntity(_0x5ac565,null))[_0xdb74('0x1c')](function(){return db[_0xdb74('0x3a')][_0xdb74('0x5d')]({'raw':!![]});})['then'](function(_0xba0330){var _0x25c4b4=fs['readFileSync'](path['join'](config['root'],_0xdb74('0x60')),_0xdb74('0x61'));var _0x474cfa=fs[_0xdb74('0x5e')](path[_0xdb74('0x62')](config[_0xdb74('0x5f')],_0xdb74('0x6c')),'utf8');var _0x9553fc=ejs[_0xdb74('0x63')](_0x25c4b4,{'trunks':_0xba0330});var _0x1fb2af=ejs[_0xdb74('0x63')](_0x474cfa,{'trunks':_0xba0330});fs[_0xdb74('0x64')](_0xdb74('0x65'),_0x9553fc);fs[_0xdb74('0x64')](_0xdb74('0x67'),_0x1fb2af);return respondWithRpcPromise(_0xdb74('0x68'),_0xdb74('0x32'),{'module':_0xdb74('0x69')});})[_0xdb74('0x25')](handleError(_0x5ac565,null));}; \ No newline at end of file +var _0xe5fb=['debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','Trunk,\x20%s,\x20%s','message','info','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Trunks','end','sendStatus','stack','name','index','Trunk','rawAttributes','key','map','keys','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','autoAssociation','server/files/templates/trunk.ejs','Reload','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','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','../../mysqldb','client','http','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~!@#$%^&-_=+[{]}.','request','request\x20sent'];(function(_0x5bce64,_0xcc4936){var _0x20140a=function(_0x338fbd){while(--_0x338fbd){_0x5bce64['push'](_0x5bce64['shift']());}};_0x20140a(++_0xcc4936);}(_0xe5fb,0xce));var _0xbe5f=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0xe5fb[_0x3a8dc1];return _0x4b3595;};'use strict';var pdf=require(_0xbe5f('0x0'));var emlformat=require(_0xbe5f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbe5f('0x2'));var jsonpatch=require(_0xbe5f('0x3'));var rp=require(_0xbe5f('0x4'));var moment=require('moment');var BPromise=require(_0xbe5f('0x5'));var Mustache=require(_0xbe5f('0x6'));var util=require(_0xbe5f('0x7'));var path=require(_0xbe5f('0x8'));var sox=require(_0xbe5f('0x9'));var csv=require('to-csv');var ejs=require(_0xbe5f('0xa'));var fs=require('fs');var _=require(_0xbe5f('0xb'));var squel=require(_0xbe5f('0xc'));var crypto=require(_0xbe5f('0xd'));var jsforce=require(_0xbe5f('0xe'));var deskjs=require(_0xbe5f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbe5f('0x10'));var Papa=require(_0xbe5f('0x11'));var Redis=require(_0xbe5f('0x12'));var authService=require(_0xbe5f('0x13'));var qs=require(_0xbe5f('0x14'));var as=require(_0xbe5f('0x15'));var hardwareService=require(_0xbe5f('0x16'));var logger=require(_0xbe5f('0x17'))(_0xbe5f('0x18'));var utils=require(_0xbe5f('0x19'));var config=require(_0xbe5f('0x1a'));var db=require(_0xbe5f('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xbe5f('0x1c')][_0xbe5f('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x454a41,_0x5880c3,_0x472e01){if(_0x472e01){var _0x30e192=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30e192[_0xbe5f('0x1e')](_0x5880c3)){return _0x454a41;}else{throw new db[(_0xbe5f('0x1f'))][(_0xbe5f('0x20'))](_0xbe5f('0x21'));}}else{return _0x454a41;}}function respondWithRpcPromise(_0x3d9769,_0x10ca16,_0x159fa3,_0x77698b){return new BPromise(function(_0x1b8825,_0x345f65){var _0x159361=_0x77698b||client;return _0x159361[_0xbe5f('0x22')](_0x3d9769,_0x159fa3)['then'](function(_0x490ede){logger['info']('Trunk,\x20%s,\x20%s',_0x10ca16,_0xbe5f('0x23'));logger[_0xbe5f('0x24')](_0xbe5f('0x25'),_0x10ca16,'request\x20sent',JSON['stringify'](_0x490ede));if(_0x490ede['error']){if(_0x490ede[_0xbe5f('0x26')][_0xbe5f('0x27')]===0x1f4){logger[_0xbe5f('0x26')](_0xbe5f('0x28'),_0x10ca16,_0x490ede[_0xbe5f('0x26')][_0xbe5f('0x29')]);return _0x345f65(_0x490ede[_0xbe5f('0x26')]['message']);}logger[_0xbe5f('0x26')](_0xbe5f('0x28'),_0x10ca16,_0x490ede[_0xbe5f('0x26')][_0xbe5f('0x29')]);return _0x1b8825(_0x490ede[_0xbe5f('0x26')][_0xbe5f('0x29')]);}else{logger[_0xbe5f('0x2a')]('Trunk,\x20%s,\x20%s',_0x10ca16,_0xbe5f('0x23'));_0x1b8825(_0x490ede[_0xbe5f('0x2b')]['message']);}})[_0xbe5f('0x2c')](function(_0x393418){logger[_0xbe5f('0x26')](_0xbe5f('0x28'),_0x10ca16,_0x393418);_0x345f65(_0x393418);});});}function respondWithStatusCode(_0x41af0b,_0x30e1d5){_0x30e1d5=_0x30e1d5||0xcc;return function(_0x2d4e89){if(_0x2d4e89){return _0x41af0b['sendStatus'](_0x30e1d5);}return _0x41af0b['status'](_0x30e1d5)['end']();};}function respondWithResult(_0x55e7c5,_0x11946e){_0x11946e=_0x11946e||0xc8;return function(_0xc401a2){if(_0xc401a2){return _0x55e7c5[_0xbe5f('0x2d')](_0x11946e)[_0xbe5f('0x2e')](_0xc401a2);}};}function respondWithFilteredResult(_0x3c8e49,_0x1ca5ef){return function(_0x3990c3){if(_0x3990c3){var _0x228117=_0x3990c3[_0xbe5f('0x2f')],_0x1f3451=_0x1ca5ef[_0xbe5f('0x30')],_0x52ff44=_0x1ca5ef[_0xbe5f('0x30')]+_0x1ca5ef[_0xbe5f('0x31')],_0xfe0ddc;if(_0x52ff44>=_0x228117){_0x52ff44=_0x228117;_0xfe0ddc=0xc8;}else{_0xfe0ddc=0xce;}_0x3c8e49[_0xbe5f('0x2d')](_0xfe0ddc);return _0x3c8e49[_0xbe5f('0x32')](_0xbe5f('0x33'),_0x1f3451+'-'+_0x52ff44+'/'+_0x228117)[_0xbe5f('0x2e')](_0x3990c3);}return null;};}function patchUpdates(_0x3f1167){return function(_0xa1bead){try{jsonpatch[_0xbe5f('0x34')](_0xa1bead,_0x3f1167,!![]);}catch(_0x2354b0){return BPromise[_0xbe5f('0x35')](_0x2354b0);}return _0xa1bead[_0xbe5f('0x36')]();};}function saveUpdates(_0x59a521,_0x589e3d){return function(_0x11e655){if(_0x11e655){return _0x11e655[_0xbe5f('0x37')](_0x59a521)[_0xbe5f('0x38')](function(_0x42f622){return _0x42f622;});}return null;};}function removeEntity(_0x3465c2,_0x812fca){return function(_0x189990){if(_0x189990){return _0x189990[_0xbe5f('0x39')]()[_0xbe5f('0x38')](function(){var _0x36fbf4=_0x189990[_0xbe5f('0x3a')]({'plain':!![]});var _0x5765a1=_0xbe5f('0x3b');return db['UserProfileResource'][_0xbe5f('0x39')]({'where':{'type':_0x5765a1,'resourceId':_0x36fbf4['id']}})[_0xbe5f('0x38')](function(){return _0x189990;});})[_0xbe5f('0x38')](function(){_0x3465c2[_0xbe5f('0x2d')](0xcc)[_0xbe5f('0x3c')]();});}};}function handleEntityNotFound(_0x254b1d,_0x108e25){return function(_0x18da92){if(!_0x18da92){_0x254b1d[_0xbe5f('0x3d')](0x194);}return _0x18da92;};}function handleError(_0xa10ae7,_0x4c569e){_0x4c569e=_0x4c569e||0x1f4;return function(_0x41dfe5){logger[_0xbe5f('0x26')](_0x41dfe5[_0xbe5f('0x3e')]);if(_0x41dfe5[_0xbe5f('0x3f')]){delete _0x41dfe5[_0xbe5f('0x3f')];}_0xa10ae7[_0xbe5f('0x2d')](_0x4c569e)['send'](_0x41dfe5);};}exports[_0xbe5f('0x40')]=function(_0x17741e,_0x57d5b7){var _0x1adeab={},_0x3c7d92={},_0x55a6d1={'count':0x0,'rows':[]};var _0x4e5d07=_['map'](db[_0xbe5f('0x41')][_0xbe5f('0x42')],function(_0x5c3102){return{'name':_0x5c3102['fieldName'],'type':_0x5c3102['type'][_0xbe5f('0x43')]};});_0x3c7d92['model']=_[_0xbe5f('0x44')](_0x4e5d07,'name');_0x3c7d92['query']=_[_0xbe5f('0x45')](_0x17741e[_0xbe5f('0x46')]);_0x3c7d92[_0xbe5f('0x47')]=_[_0xbe5f('0x48')](_0x3c7d92['model'],_0x3c7d92['query']);_0x1adeab['attributes']=_[_0xbe5f('0x48')](_0x3c7d92[_0xbe5f('0x49')],qs[_0xbe5f('0x4a')](_0x17741e[_0xbe5f('0x46')][_0xbe5f('0x4a')]));_0x1adeab['attributes']=_0x1adeab['attributes'][_0xbe5f('0x4b')]?_0x1adeab[_0xbe5f('0x4c')]:_0x3c7d92[_0xbe5f('0x49')];if(!_0x17741e[_0xbe5f('0x46')][_0xbe5f('0x4d')](_0xbe5f('0x4e'))){_0x1adeab[_0xbe5f('0x31')]=qs[_0xbe5f('0x31')](_0x17741e[_0xbe5f('0x46')][_0xbe5f('0x31')]);_0x1adeab['offset']=qs[_0xbe5f('0x30')](_0x17741e[_0xbe5f('0x46')][_0xbe5f('0x30')]);}_0x1adeab[_0xbe5f('0x4f')]=qs[_0xbe5f('0x50')](_0x17741e[_0xbe5f('0x46')][_0xbe5f('0x50')]);_0x1adeab[_0xbe5f('0x51')]=qs['filters'](_[_0xbe5f('0x52')](_0x17741e['query'],_0x3c7d92[_0xbe5f('0x47')]),_0x4e5d07);if(_0x17741e[_0xbe5f('0x46')][_0xbe5f('0x53')]){_0x1adeab[_0xbe5f('0x51')]=_[_0xbe5f('0x54')](_0x1adeab['where'],{'$or':_[_0xbe5f('0x44')](_0x4e5d07,function(_0x3121d6){if(_0x3121d6['type']!==_0xbe5f('0x55')){var _0x344a2f={};_0x344a2f[_0x3121d6[_0xbe5f('0x3f')]]={'$like':'%'+_0x17741e['query']['filter']+'%'};return _0x344a2f;}})});}_0x1adeab=_[_0xbe5f('0x54')]({},_0x1adeab,_0x17741e[_0xbe5f('0x56')]);var _0x2d570f={'where':_0x1adeab[_0xbe5f('0x51')]};return db[_0xbe5f('0x41')][_0xbe5f('0x2f')](_0x2d570f)['then'](function(_0x53a0ab){_0x55a6d1[_0xbe5f('0x2f')]=_0x53a0ab;if(_0x17741e[_0xbe5f('0x46')]['includeAll']){_0x1adeab[_0xbe5f('0x57')]=[{'all':!![]}];}return db[_0xbe5f('0x41')][_0xbe5f('0x58')](_0x1adeab);})[_0xbe5f('0x38')](function(_0x56c2e7){_0x55a6d1[_0xbe5f('0x59')]=_0x56c2e7;return _0x55a6d1;})[_0xbe5f('0x38')](respondWithFilteredResult(_0x57d5b7,_0x1adeab))[_0xbe5f('0x2c')](handleError(_0x57d5b7,null));};exports[_0xbe5f('0x5a')]=function(_0xd9186d,_0x35d4df){var _0x47f0e6={'raw':![],'where':{'id':_0xd9186d[_0xbe5f('0x5b')]['id']}},_0x5b4bf9={};_0x5b4bf9[_0xbe5f('0x49')]=_[_0xbe5f('0x45')](db[_0xbe5f('0x41')][_0xbe5f('0x42')]);_0x5b4bf9[_0xbe5f('0x46')]=_[_0xbe5f('0x45')](_0xd9186d[_0xbe5f('0x46')]);_0x5b4bf9[_0xbe5f('0x47')]=_[_0xbe5f('0x48')](_0x5b4bf9['model'],_0x5b4bf9[_0xbe5f('0x46')]);_0x47f0e6[_0xbe5f('0x4c')]=_[_0xbe5f('0x48')](_0x5b4bf9[_0xbe5f('0x49')],qs[_0xbe5f('0x4a')](_0xd9186d[_0xbe5f('0x46')]['fields']));_0x47f0e6[_0xbe5f('0x4c')]=_0x47f0e6[_0xbe5f('0x4c')][_0xbe5f('0x4b')]?_0x47f0e6[_0xbe5f('0x4c')]:_0x5b4bf9[_0xbe5f('0x49')];if(_0xd9186d[_0xbe5f('0x46')][_0xbe5f('0x5c')]){_0x47f0e6[_0xbe5f('0x57')]=[{'all':!![]}];}_0x47f0e6=_[_0xbe5f('0x54')]({},_0x47f0e6,_0xd9186d[_0xbe5f('0x56')]);return db[_0xbe5f('0x41')][_0xbe5f('0x5d')](_0x47f0e6)[_0xbe5f('0x38')](handleEntityNotFound(_0x35d4df,null))[_0xbe5f('0x38')](respondWithResult(_0x35d4df,null))[_0xbe5f('0x2c')](handleError(_0x35d4df,null));};exports[_0xbe5f('0x5e')]=function(_0x300520,_0x275f67){var _0xbfed39={'where':{'id':_0x300520[_0xbe5f('0x5b')]['id']}},_0x9536fe={};_0x9536fe[_0xbe5f('0x49')]=_['keys'](db[_0xbe5f('0x41')][_0xbe5f('0x42')]);_0xbfed39[_0xbe5f('0x4c')]=_[_0xbe5f('0x48')](_0x9536fe['model'],qs[_0xbe5f('0x4a')](_0x300520[_0xbe5f('0x46')][_0xbe5f('0x4a')]));_0xbfed39[_0xbe5f('0x4c')]=_0xbfed39[_0xbe5f('0x4c')][_0xbe5f('0x4b')]?_0xbfed39[_0xbe5f('0x4c')]:_0x9536fe[_0xbe5f('0x49')];if(_0x300520[_0xbe5f('0x46')]['includeAll']){_0xbfed39[_0xbe5f('0x57')]=[{'all':!![]}];}_0xbfed39=_[_0xbe5f('0x54')]({},_0xbfed39,_0x300520[_0xbe5f('0x56')]);return db[_0xbe5f('0x41')][_0xbe5f('0x5d')](_0xbfed39)[_0xbe5f('0x38')](handleEntityNotFound(_0x275f67,null))['then'](function(_0x339fa6){if(_0x339fa6){var _0x2e3b99=_0x339fa6[_0xbe5f('0x3a')]({'plain':!![]});_0x2e3b99=qs[_0xbe5f('0x5f')](_0x2e3b99,['id',_0xbe5f('0x60'),_0xbe5f('0x61')]);_0x300520['body']=_['omit'](_0x300520[_0xbe5f('0x62')],['id',_0xbe5f('0x60'),'updatedAt']);return db['Trunk']['create'](_['merge'](_0x2e3b99,_0x300520['body']),{'include':_0x300520[_0xbe5f('0x46')][_0xbe5f('0x5c')]?[{'all':!![]}]:undefined})['then'](function(_0x1b8136){var _0x8ebdb1=_0x300520[_0xbe5f('0x63')][_0xbe5f('0x3a')]({'plain':!![]});if(!_0x8ebdb1)throw new Error(_0xbe5f('0x64'));if(_0x8ebdb1[_0xbe5f('0x65')]===_0xbe5f('0x63')){var _0x4480c5=_0x1b8136['get']({'plain':!![]});var _0xbfd242=_0xbe5f('0x3b');return db[_0xbe5f('0x66')][_0xbe5f('0x5d')]({'where':{'name':_0xbfd242,'userProfileId':_0x8ebdb1[_0xbe5f('0x67')]},'raw':!![]})[_0xbe5f('0x38')](function(_0x22d2f5){if(_0x22d2f5&&_0x22d2f5['autoAssociation']===0x0){return db[_0xbe5f('0x68')][_0xbe5f('0x69')]({'name':_0x4480c5[_0xbe5f('0x3f')],'resourceId':_0x4480c5['id'],'type':_0x22d2f5[_0xbe5f('0x3f')],'sectionId':_0x22d2f5['id']},{})[_0xbe5f('0x38')](function(){return _0x1b8136;});}else{return _0x1b8136;}})['catch'](function(_0x15a188){logger[_0xbe5f('0x26')](_0xbe5f('0x6a'),_0x15a188);throw _0x15a188;});}return _0x1b8136;});}})[_0xbe5f('0x38')](respondWithResult(_0x275f67,0xc9))[_0xbe5f('0x2c')](handleError(_0x275f67,null));};exports[_0xbe5f('0x69')]=function(_0x5327b8,_0x1304c8,_0x198f3d){var _0x133339;return db[_0xbe5f('0x41')][_0xbe5f('0x69')](_0x5327b8[_0xbe5f('0x62')],{'raw':!![]})[_0xbe5f('0x38')](function(_0x40b8e0){_0x133339=_0x40b8e0;return db[_0xbe5f('0x41')]['findAll']({'raw':!![]});})[_0xbe5f('0x38')](function(_0x3f1d6b){var _0x2b3c42=fs[_0xbe5f('0x6b')](path[_0xbe5f('0x6c')](config[_0xbe5f('0x6d')],'server/files/templates/trunk.ejs'),_0xbe5f('0x6e'));var _0x3a122a=fs['readFileSync'](path[_0xbe5f('0x6c')](config[_0xbe5f('0x6d')],_0xbe5f('0x6f')),_0xbe5f('0x6e'));var _0x1c80da=ejs[_0xbe5f('0x70')](_0x2b3c42,{'trunks':_0x3f1d6b||[]});fs[_0xbe5f('0x71')](_0xbe5f('0x72'),_0x1c80da);if(_0x133339[_0xbe5f('0x73')]){var _0x3852fe=ejs[_0xbe5f('0x70')](_0x3a122a,{'trunks':_0x3f1d6b||[]});fs['writeFileSync'](_0xbe5f('0x74'),_0x3852fe);}})['then'](function(){return respondWithRpcPromise('Reload',_0xbe5f('0x69'),{'module':_0xbe5f('0x75')});})[_0xbe5f('0x38')](function(){var _0xf46c6e=_0x5327b8['user']['get']({'plain':!![]});if(!_0xf46c6e)throw new Error(_0xbe5f('0x64'));if(_0xf46c6e[_0xbe5f('0x65')]==='user'){var _0x5f435a=_0x133339[_0xbe5f('0x3a')]({'plain':!![]});return db[_0xbe5f('0x66')][_0xbe5f('0x5d')]({'where':{'name':_0xbe5f('0x3b'),'userProfileId':_0xf46c6e['userProfileId']},'raw':!![]})[_0xbe5f('0x38')](function(_0x364476){if(_0x364476&&_0x364476[_0xbe5f('0x76')]===0x0){return db['UserProfileResource']['create']({'name':_0x5f435a['name'],'resourceId':_0x5f435a['id'],'type':_0x364476[_0xbe5f('0x3f')],'sectionId':_0x364476['id']},{})['then'](function(){return _0x133339;});}else{return _0x133339;}})[_0xbe5f('0x2c')](function(_0xa2816){logger[_0xbe5f('0x26')](_0xbe5f('0x6a'),_0xa2816);throw _0xa2816;});}return _0x133339;})[_0xbe5f('0x38')](respondWithResult(_0x1304c8,0xc9))['catch'](handleError(_0x1304c8,null));};exports[_0xbe5f('0x37')]=function(_0x33e506,_0x173f2b,_0xf7b589){var _0x383659;return db[_0xbe5f('0x41')]['find']({'where':{'id':_0x33e506[_0xbe5f('0x5b')]['id']}})[_0xbe5f('0x38')](handleEntityNotFound(_0x173f2b,null))[_0xbe5f('0x38')](saveUpdates(_0x33e506[_0xbe5f('0x62')],null))[_0xbe5f('0x38')](function(_0x4d294e){if(_0x4d294e){_0x383659=_0x4d294e;return db['Trunk'][_0xbe5f('0x58')]({'raw':!![]});}})[_0xbe5f('0x38')](function(_0x59fd19){if(_0x59fd19){var _0x24d21d=fs[_0xbe5f('0x6b')](path[_0xbe5f('0x6c')](config[_0xbe5f('0x6d')],_0xbe5f('0x77')),_0xbe5f('0x6e'));var _0x586a45=fs[_0xbe5f('0x6b')](path[_0xbe5f('0x6c')](config[_0xbe5f('0x6d')],_0xbe5f('0x6f')),'utf8');var _0x5c3984=ejs[_0xbe5f('0x70')](_0x24d21d,{'trunks':_0x59fd19||[]});fs[_0xbe5f('0x71')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5c3984);var _0x246b53=ejs[_0xbe5f('0x70')](_0x586a45,{'trunks':_0x59fd19||[]});fs[_0xbe5f('0x71')](_0xbe5f('0x74'),_0x246b53);return respondWithRpcPromise(_0xbe5f('0x78'),_0xbe5f('0x37'),{'module':_0xbe5f('0x75')});}return null;})[_0xbe5f('0x38')](function(_0xdfc4a7){if(_0xdfc4a7){return _0x383659;}})['then'](respondWithResult(_0x173f2b,null))['catch'](handleError(_0x173f2b,null));};exports[_0xbe5f('0x39')]=function(_0x410791,_0x370ae8,_0x56653c){var _0x5e1f3a;return db[_0xbe5f('0x41')][_0xbe5f('0x5d')]({'where':{'id':_0x410791[_0xbe5f('0x5b')]['id']}})[_0xbe5f('0x38')](handleEntityNotFound(_0x370ae8,null))['then'](removeEntity(_0x370ae8,null))[_0xbe5f('0x38')](function(){return db[_0xbe5f('0x41')][_0xbe5f('0x58')]({'raw':!![]});})[_0xbe5f('0x38')](function(_0x5c8924){var _0x1bb57d=fs[_0xbe5f('0x6b')](path[_0xbe5f('0x6c')](config['root'],_0xbe5f('0x77')),_0xbe5f('0x6e'));var _0x4d003e=fs[_0xbe5f('0x6b')](path['join'](config['root'],_0xbe5f('0x6f')),'utf8');var _0x210dfa=ejs[_0xbe5f('0x70')](_0x1bb57d,{'trunks':_0x5c8924});var _0x5c6192=ejs['render'](_0x4d003e,{'trunks':_0x5c8924});fs[_0xbe5f('0x71')]('/etc/asterisk/sip_xcally_trunks.conf',_0x210dfa);fs['writeFileSync'](_0xbe5f('0x74'),_0x5c6192);return respondWithRpcPromise('Reload','destroy',{'module':_0xbe5f('0x75')});})['catch'](handleError(_0x370ae8,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index fd0b25b..8e05f51 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 _0x2eea=['../../config/logger','bluebird','request-promise','path','rimraf','exports','define','Trunk','tools_trunks','lodash','util'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_0x2eea,0x11c));var _0xa2ee=function(_0xf99659,_0x1ba7ec){_0xf99659=_0xf99659-0x0;var _0x5a6f8d=_0x2eea[_0xf99659];return _0x5a6f8d;};'use strict';var _=require(_0xa2ee('0x0'));var util=require(_0xa2ee('0x1'));var logger=require(_0xa2ee('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa2ee('0x3'));var rp=require(_0xa2ee('0x4'));var fs=require('fs');var path=require(_0xa2ee('0x5'));var rimraf=require(_0xa2ee('0x6'));var config=require('../../config/environment');var attributes=require('./trunk.attributes');module[_0xa2ee('0x7')]=function(_0x166d80,_0x255c28){return _0x166d80[_0xa2ee('0x8')](_0xa2ee('0x9'),attributes,{'tableName':_0xa2ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf351=['define','Trunk','tools_trunks','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0x57e1b3,_0x446c3c){var _0x4a44b0=function(_0x4c1a85){while(--_0x4c1a85){_0x57e1b3['push'](_0x57e1b3['shift']());}};_0x4a44b0(++_0x446c3c);}(_0xf351,0x1b3));var _0x1f35=function(_0x48a96f,_0x530059){_0x48a96f=_0x48a96f-0x0;var _0x3ff3ef=_0xf351[_0x48a96f];return _0x3ff3ef;};'use strict';var _=require(_0x1f35('0x0'));var util=require(_0x1f35('0x1'));var logger=require('../../config/logger')(_0x1f35('0x2'));var moment=require(_0x1f35('0x3'));var BPromise=require('bluebird');var rp=require(_0x1f35('0x4'));var fs=require('fs');var path=require(_0x1f35('0x5'));var rimraf=require(_0x1f35('0x6'));var config=require(_0x1f35('0x7'));var attributes=require(_0x1f35('0x8'));module['exports']=function(_0x4eab8f,_0x2af4b9){return _0x4eab8f[_0x1f35('0x9')](_0x1f35('0xa'),attributes,{'tableName':_0x1f35('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 0a1b95f..c78b75a 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 _0xbaf0=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','model','map','ShowTrunk','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xd46333,_0x1b05c1){var _0x336108=function(_0x4a39ad){while(--_0x4a39ad){_0xd46333['push'](_0xd46333['shift']());}};_0x336108(++_0x1b05c1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Trunk,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetTrunk',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowTrunk',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file +var _0x5f2f=['map','include','model','attributes','then','ShowTrunk','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetTrunk','Trunk','findAll','options','raw','limit'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x5f2f,0x73));var _0xf5f2=function(_0xc999d9,_0x27b678){_0xc999d9=_0xc999d9-0x0;var _0x1e60d1=_0x5f2f[_0xc999d9];return _0x1e60d1;};'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')]('Trunk,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')]({'raw':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options']['where']||null:null,'attributes':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['attributes']||null:null,'limit':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1c')]||null:null,'include':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['include']?_[_0xf5f2('0x1d')](_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x2833fe){return{'model':db[_0x2833fe[_0xf5f2('0x1f')]],'as':_0x2833fe['as'],'attributes':_0x2833fe['attributes'],'include':_0x2833fe['include']?_[_0xf5f2('0x1d')](_0x2833fe[_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x375ca8){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')]('GetTrunk',_0x20fccd,JSON['stringify'](_0x375ca8));_0x4ff59b(_0x375ca8);})[_0xf5f2('0x16')](function(_0x14c829){logger[_0xf5f2('0x11')]('GetTrunk',_0x14c829['message'],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x14c829[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x22')]=function(_0x153924){var _0x1b381e=this;return new Promise(function(_0x54c0c8,_0x52e959){return db[_0xf5f2('0x18')]['find']({'raw':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x23')]||null:null,'attributes':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x20')]||null:null,'include':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x1408b9){return{'model':db[_0x1408b9[_0xf5f2('0x1f')]],'as':_0x1408b9['as'],'attributes':_0x1408b9[_0xf5f2('0x20')],'include':_0x1408b9['include']?_[_0xf5f2('0x1d')](_0x1408b9[_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x46ad4a){logger[_0xf5f2('0xd')]('ShowTrunk',_0x153924);logger[_0xf5f2('0xf')]('ShowTrunk',_0x153924,JSON[_0xf5f2('0x10')](_0x46ad4a));_0x54c0c8(_0x46ad4a);})['catch'](function(_0x46f464){logger[_0xf5f2('0x11')]('ShowTrunk',_0x46f464[_0xf5f2('0x13')],_0x153924);_0x52e959(_0x1b381e[_0xf5f2('0x11')](0x1f4,_0x46f464[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 5f6b41b..9d28f6f 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 _0x7359=['addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/openchannel_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/square_projects','addSquareProjects','createApiKey','/:id','update','put','/:id/password','changePassword','delete','removeQueues','/:id/teams','destroy','removeChatInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','/whoami','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','/create_many','post','addContacts','create','addQueues','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause'];(function(_0x210cac,_0x32a965){var _0x4ad302=function(_0x512fce){while(--_0x512fce){_0x210cac['push'](_0x210cac['shift']());}};_0x4ad302(++_0x32a965);}(_0x7359,0x99));var _0x9735=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7359[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x9735('0x0'));var util=require(_0x9735('0x1'));var path=require(_0x9735('0x2'));var timeout=require(_0x9735('0x3'));var express=require(_0x9735('0x4'));var router=express['Router']();var auth=require(_0x9735('0x5'));var interaction=require(_0x9735('0x6'));var config=require(_0x9735('0x7'));var controller=require(_0x9735('0x8'));router[_0x9735('0x9')]('/',auth['isAuthenticated'](),controller[_0x9735('0xa')]);router[_0x9735('0x9')](_0x9735('0xb'),auth[_0x9735('0xc')](),controller['describe']);router[_0x9735('0x9')](_0x9735('0xd'),auth[_0x9735('0xc')](),controller['whoami']);router[_0x9735('0x9')]('/:id',auth[_0x9735('0xc')](),controller[_0x9735('0xe')]);router['get'](_0x9735('0xf'),controller[_0x9735('0x10')]);router[_0x9735('0x9')](_0x9735('0x11'),auth['isAuthenticated'](),controller[_0x9735('0x12')]);router[_0x9735('0x9')](_0x9735('0x13'),auth[_0x9735('0xc')](),controller[_0x9735('0x14')]);router[_0x9735('0x9')]('/:id/queues_rt',auth[_0x9735('0xc')](),controller[_0x9735('0x15')]);router[_0x9735('0x9')](_0x9735('0x16'),auth[_0x9735('0xc')](),controller[_0x9735('0x17')]);router[_0x9735('0x9')](_0x9735('0x18'),auth[_0x9735('0xc')](),controller[_0x9735('0x19')]);router[_0x9735('0x9')](_0x9735('0x1a'),auth['isAuthenticated'](),controller['getScreenRecordings']);router[_0x9735('0x9')](_0x9735('0x1b'),auth['isAuthenticated'](),controller[_0x9735('0x1c')]);router[_0x9735('0x9')](_0x9735('0x1d'),auth[_0x9735('0xc')](),controller[_0x9735('0x1e')]);router['get']('/:id/mail/interactions',auth[_0x9735('0xc')](),controller['getMailInteractions']);router[_0x9735('0x9')](_0x9735('0x1f'),auth['isAuthenticated'](),controller[_0x9735('0x20')]);router[_0x9735('0x9')](_0x9735('0x21'),auth['isAuthenticated'](),controller[_0x9735('0x22')]);router[_0x9735('0x9')](_0x9735('0x23'),auth[_0x9735('0xc')](),controller[_0x9735('0x24')]);router[_0x9735('0x9')]('/:id/teams',auth[_0x9735('0xc')](),controller[_0x9735('0x25')]);router[_0x9735('0x9')](_0x9735('0x26'),auth[_0x9735('0xc')](),controller['getLists']);router[_0x9735('0x9')](_0x9735('0x27'),auth[_0x9735('0xc')](),controller['getAgents']);router[_0x9735('0x9')](_0x9735('0x28'),auth[_0x9735('0xc')](),controller[_0x9735('0x29')]);router[_0x9735('0x9')](_0x9735('0x2a'),auth[_0x9735('0xc')](),controller[_0x9735('0x2b')]);router['get'](_0x9735('0x2c'),auth['isAuthenticated'](),controller[_0x9735('0x2d')]);router['get'](_0x9735('0x2e'),auth[_0x9735('0xc')](),controller['getOpenchannelAccounts']);router['get'](_0x9735('0x2f'),auth[_0x9735('0xc')](),controller[_0x9735('0x30')]);router[_0x9735('0x9')](_0x9735('0x31'),auth['isAuthenticated'](),controller[_0x9735('0x32')]);router[_0x9735('0x9')](_0x9735('0x33'),auth[_0x9735('0xc')](),controller[_0x9735('0x34')]);router[_0x9735('0x9')]('/:id/square_projects',auth[_0x9735('0xc')](),controller[_0x9735('0x35')]);router[_0x9735('0x9')](_0x9735('0x36'),auth[_0x9735('0xc')](),controller[_0x9735('0x37')]);router[_0x9735('0x9')](_0x9735('0x38'),auth[_0x9735('0xc')](),controller['getApiKey']);router['post'](_0x9735('0x39'),auth[_0x9735('0xc')](),controller['bulkCreate']);router[_0x9735('0x3a')]('/:id/contacts',auth[_0x9735('0xc')](),controller[_0x9735('0x3b')]);router[_0x9735('0x3a')]('/',auth['isAuthenticated'](),controller[_0x9735('0x3c')]);router[_0x9735('0x3a')](_0x9735('0x13'),auth[_0x9735('0xc')](),controller[_0x9735('0x3d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x32d956,_0x202a67,_0x10f75b){_0x10f75b(null,path[_0x9735('0x3e')](config[_0x9735('0x3f')],_0x9735('0x40')));},'filename':function(_0x36118a,_0x47f7cc,_0x59f118){_0x59f118(null,util[_0x9735('0x41')](_0x9735('0x42'),Date[_0x9735('0x43')](),_0x47f7cc[_0x9735('0x44')]));}})});router[_0x9735('0x3a')](_0x9735('0xf'),upload[_0x9735('0x45')](_0x9735('0x46')),controller[_0x9735('0x47')]);router[_0x9735('0x3a')](_0x9735('0x48'),auth['isAuthenticated'](),controller[_0x9735('0x49')]);router[_0x9735('0x3a')](_0x9735('0x4a'),auth[_0x9735('0xc')](),controller[_0x9735('0x4b')]);router[_0x9735('0x3a')](_0x9735('0x4c'),auth[_0x9735('0xc')](),controller['pause']);router[_0x9735('0x3a')](_0x9735('0x4d'),auth[_0x9735('0xc')](),controller[_0x9735('0x4e')]);router['post']('/:id/teams',auth[_0x9735('0xc')](),controller[_0x9735('0x4f')]);router['post'](_0x9735('0x50'),auth[_0x9735('0xc')](),controller[_0x9735('0x51')]);router[_0x9735('0x3a')](_0x9735('0x52'),auth[_0x9735('0xc')](),controller[_0x9735('0x53')]);router[_0x9735('0x3a')](_0x9735('0x54'),auth[_0x9735('0xc')](),controller['addFaxInteractions']);router[_0x9735('0x3a')]('/:id/sms_interactions',auth[_0x9735('0xc')](),controller['addSmsInteractions']);router[_0x9735('0x3a')](_0x9735('0x55'),auth[_0x9735('0xc')](),controller['addOpenchannelInteractions']);router[_0x9735('0x3a')]('/:id/whatsapp_interactions',auth[_0x9735('0xc')](),controller[_0x9735('0x56')]);router[_0x9735('0x3a')](_0x9735('0x2a'),auth[_0x9735('0xc')](),controller[_0x9735('0x57')]);router[_0x9735('0x3a')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x9735('0x58')]);router['post'](_0x9735('0x2e'),auth[_0x9735('0xc')](),controller[_0x9735('0x59')]);router['post'](_0x9735('0x2f'),auth[_0x9735('0xc')](),controller[_0x9735('0x5a')]);router['post'](_0x9735('0x31'),auth[_0x9735('0xc')](),controller['addChatWebsites']);router[_0x9735('0x3a')](_0x9735('0x33'),auth[_0x9735('0xc')](),controller['addWhatsappAccounts']);router['post'](_0x9735('0x5b'),auth[_0x9735('0xc')](),controller[_0x9735('0x5c')]);router[_0x9735('0x3a')](_0x9735('0x38'),auth[_0x9735('0xc')](),controller[_0x9735('0x5d')]);router['put'](_0x9735('0x5e'),auth[_0x9735('0xc')](),controller[_0x9735('0x5f')]);router[_0x9735('0x60')](_0x9735('0x61'),auth[_0x9735('0xc')](),controller[_0x9735('0x62')]);router[_0x9735('0x63')]('/:id/queues',auth['isAuthenticated'](),controller[_0x9735('0x64')]);router[_0x9735('0x63')](_0x9735('0x65'),auth[_0x9735('0xc')](),controller['removeTeams']);router[_0x9735('0x63')](_0x9735('0x5e'),auth[_0x9735('0xc')](),controller[_0x9735('0x66')]);router[_0x9735('0x63')]('/:id/chat_interactions',auth[_0x9735('0xc')](),controller[_0x9735('0x67')]);router[_0x9735('0x63')]('/:id/mail_interactions',auth[_0x9735('0xc')](),controller['removeMailInteractions']);router[_0x9735('0x63')](_0x9735('0x54'),auth[_0x9735('0xc')](),controller[_0x9735('0x68')]);router[_0x9735('0x63')](_0x9735('0x69'),auth['isAuthenticated'](),controller[_0x9735('0x6a')]);router[_0x9735('0x63')]('/:id/openchannel_interactions',auth[_0x9735('0xc')](),controller[_0x9735('0x6b')]);router['delete'](_0x9735('0x6c'),auth[_0x9735('0xc')](),controller['removeWhatsappInteractions']);router['delete'](_0x9735('0x2a'),auth[_0x9735('0xc')](),controller[_0x9735('0x6d')]);router['delete']('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x9735('0x6e')]);router[_0x9735('0x63')](_0x9735('0x2e'),auth[_0x9735('0xc')](),controller['removeOpenchannelAccounts']);router[_0x9735('0x63')](_0x9735('0x2f'),auth[_0x9735('0xc')](),controller[_0x9735('0x6f')]);router[_0x9735('0x63')]('/:id/chat_websites',auth[_0x9735('0xc')](),controller[_0x9735('0x70')]);router['delete'](_0x9735('0x33'),auth['isAuthenticated'](),controller[_0x9735('0x71')]);router[_0x9735('0x63')](_0x9735('0x5b'),auth[_0x9735('0xc')](),controller[_0x9735('0x72')]);router[_0x9735('0x63')]('/:id/api_key',auth[_0x9735('0xc')](),controller[_0x9735('0x73')]);module['exports']=router; \ No newline at end of file +var _0x1bde=['login','/:id/logout','logout','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','/:id/square_projects','/:id/api_key','createApiKey','update','put','/:id/password','changePassword','removeQueues','delete','removeTeams','removeChatInteractions','removeMailInteractions','/:id/sms_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getChatWebsites','/:id/whatsapp_accounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','/create_many','post','addContacts','create','addQueues','diskStorage','root','server/files/images/','now','originalname','single','file','addAvatar','/:id/login'];(function(_0x1e498c,_0x417ed2){var _0x9a25df=function(_0x3454d7){while(--_0x3454d7){_0x1e498c['push'](_0x1e498c['shift']());}};_0x9a25df(++_0x417ed2);}(_0x1bde,0xa2));var _0xe1bd=function(_0x108c01,_0x24dfc7){_0x108c01=_0x108c01-0x0;var _0x249029=_0x1bde[_0x108c01];return _0x249029;};'use strict';var multer=require(_0xe1bd('0x0'));var util=require('util');var path=require(_0xe1bd('0x1'));var timeout=require(_0xe1bd('0x2'));var express=require('express');var router=express[_0xe1bd('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe1bd('0x4'));var config=require(_0xe1bd('0x5'));var controller=require(_0xe1bd('0x6'));router[_0xe1bd('0x7')]('/',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x9')]);router[_0xe1bd('0x7')]('/describe',auth[_0xe1bd('0x8')](),controller['describe']);router[_0xe1bd('0x7')](_0xe1bd('0xa'),auth[_0xe1bd('0x8')](),controller['whoami']);router['get'](_0xe1bd('0xb'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0xc')]);router[_0xe1bd('0x7')](_0xe1bd('0xd'),controller[_0xe1bd('0xe')]);router[_0xe1bd('0x7')](_0xe1bd('0xf'),auth['isAuthenticated'](),controller['getContacts']);router[_0xe1bd('0x7')](_0xe1bd('0x10'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x11')]);router['get'](_0xe1bd('0x12'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x13')]);router[_0xe1bd('0x7')]('/:id/groups',auth[_0xe1bd('0x8')](),controller['getGroups']);router['get']('/:id/recordings',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x14')]);router[_0xe1bd('0x7')](_0xe1bd('0x15'),auth[_0xe1bd('0x8')](),controller['getScreenRecordings']);router[_0xe1bd('0x7')](_0xe1bd('0x16'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x17')]);router[_0xe1bd('0x7')](_0xe1bd('0x18'),auth[_0xe1bd('0x8')](),controller['getOpenchannelInteractions']);router[_0xe1bd('0x7')](_0xe1bd('0x19'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0xe1bd('0x7')](_0xe1bd('0x1a'),auth[_0xe1bd('0x8')](),controller['getSmsInteractions']);router['get'](_0xe1bd('0x1b'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x1c')]);router[_0xe1bd('0x7')](_0xe1bd('0x1d'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x1e')]);router[_0xe1bd('0x7')](_0xe1bd('0x1f'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x20')]);router[_0xe1bd('0x7')]('/:id/lists',auth[_0xe1bd('0x8')](),controller['getLists']);router['get'](_0xe1bd('0x21'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x22')]);router[_0xe1bd('0x7')](_0xe1bd('0x23'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x24')]);router[_0xe1bd('0x7')](_0xe1bd('0x25'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x26')]);router[_0xe1bd('0x7')](_0xe1bd('0x27'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x28')]);router[_0xe1bd('0x7')](_0xe1bd('0x29'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x2a')]);router[_0xe1bd('0x7')](_0xe1bd('0x2b'),auth[_0xe1bd('0x8')](),controller['getSmsAccounts']);router[_0xe1bd('0x7')]('/:id/chat_websites',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x2c')]);router[_0xe1bd('0x7')](_0xe1bd('0x2d'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router[_0xe1bd('0x7')]('/:id/square_projects',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x2e')]);router[_0xe1bd('0x7')](_0xe1bd('0x2f'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x30')]);router['get']('/:id/api_key',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x31')]);router['post'](_0xe1bd('0x32'),auth[_0xe1bd('0x8')](),controller['bulkCreate']);router[_0xe1bd('0x33')](_0xe1bd('0xf'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x34')]);router[_0xe1bd('0x33')]('/',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x35')]);router['post'](_0xe1bd('0x10'),auth['isAuthenticated'](),controller[_0xe1bd('0x36')]);var upload=multer({'storage':multer[_0xe1bd('0x37')]({'destination':function(_0x22f85a,_0xc5c5b2,_0x47d634){_0x47d634(null,path['join'](config[_0xe1bd('0x38')],_0xe1bd('0x39')));},'filename':function(_0x30201f,_0x47dca2,_0x1872ba){_0x1872ba(null,util['format']('%s-%s',Date[_0xe1bd('0x3a')](),_0x47dca2[_0xe1bd('0x3b')]));}})});router[_0xe1bd('0x33')](_0xe1bd('0xd'),upload[_0xe1bd('0x3c')](_0xe1bd('0x3d')),controller[_0xe1bd('0x3e')]);router[_0xe1bd('0x33')](_0xe1bd('0x3f'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x40')]);router[_0xe1bd('0x33')](_0xe1bd('0x41'),auth['isAuthenticated'](),controller[_0xe1bd('0x42')]);router[_0xe1bd('0x33')]('/:id/pause',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x43')]);router['post'](_0xe1bd('0x44'),auth['isAuthenticated'](),controller[_0xe1bd('0x45')]);router[_0xe1bd('0x33')](_0xe1bd('0x1f'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x46')]);router['post'](_0xe1bd('0x47'),auth['isAuthenticated'](),controller[_0xe1bd('0x48')]);router[_0xe1bd('0x33')](_0xe1bd('0x49'),auth['isAuthenticated'](),controller[_0xe1bd('0x4a')]);router[_0xe1bd('0x33')](_0xe1bd('0x4b'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x4c')]);router['post']('/:id/sms_interactions',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x4d')]);router[_0xe1bd('0x33')]('/:id/openchannel_interactions',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x4e')]);router[_0xe1bd('0x33')](_0xe1bd('0x4f'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x50')]);router[_0xe1bd('0x33')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xe1bd('0x51')]);router['post'](_0xe1bd('0x27'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x52')]);router['post'](_0xe1bd('0x29'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x53')]);router[_0xe1bd('0x33')](_0xe1bd('0x2b'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x54')]);router[_0xe1bd('0x33')](_0xe1bd('0x55'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x56')]);router[_0xe1bd('0x33')](_0xe1bd('0x2d'),auth['isAuthenticated'](),controller[_0xe1bd('0x57')]);router[_0xe1bd('0x33')](_0xe1bd('0x58'),auth[_0xe1bd('0x8')](),controller['addSquareProjects']);router[_0xe1bd('0x33')](_0xe1bd('0x59'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x5a')]);router['put'](_0xe1bd('0xb'),auth['isAuthenticated'](),controller[_0xe1bd('0x5b')]);router[_0xe1bd('0x5c')](_0xe1bd('0x5d'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x5e')]);router['delete']('/:id/queues',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x5f')]);router[_0xe1bd('0x60')](_0xe1bd('0x1f'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x61')]);router[_0xe1bd('0x60')](_0xe1bd('0xb'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xe1bd('0x47'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x62')]);router[_0xe1bd('0x60')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xe1bd('0x63')]);router[_0xe1bd('0x60')](_0xe1bd('0x4b'),auth[_0xe1bd('0x8')](),controller['removeFaxInteractions']);router[_0xe1bd('0x60')](_0xe1bd('0x64'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x65')]);router[_0xe1bd('0x60')](_0xe1bd('0x66'),auth['isAuthenticated'](),controller[_0xe1bd('0x67')]);router[_0xe1bd('0x60')](_0xe1bd('0x4f'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x68')]);router[_0xe1bd('0x60')]('/:id/fax_accounts',auth[_0xe1bd('0x8')](),controller['removeFaxAccounts']);router[_0xe1bd('0x60')]('/:id/mail_accounts',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x69')]);router['delete']('/:id/openchannel_accounts',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x6a')]);router[_0xe1bd('0x60')](_0xe1bd('0x2b'),auth['isAuthenticated'](),controller[_0xe1bd('0x6b')]);router[_0xe1bd('0x60')](_0xe1bd('0x55'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x6c')]);router[_0xe1bd('0x60')](_0xe1bd('0x2d'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x6d')]);router[_0xe1bd('0x60')](_0xe1bd('0x58'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x6e')]);router[_0xe1bd('0x60')](_0xe1bd('0x59'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x6f')]);module[_0xe1bd('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index b613bff..ef07af1 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 _0x4dc5=['PROHIB','udp','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','uac','uas','certificate','active','actpass','update,nonat','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlsprivatekey','rtcp_mux','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','STRING','setDataValue','defaultuser','fullname','callerid','format','getDataValue','internal','email','ENUM','admin','user','agent','telephone','local','INTEGER','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0x2b6779,_0xe780af){var _0x153b4a=function(_0x3cc267){while(--_0x3cc267){_0x2b6779['push'](_0x2b6779['shift']());}};_0x153b4a(++_0xe780af);}(_0x4dc5,0x1aa));var _0x54dc=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x4dc5[_0x4b7895];return _0x264180;};'use strict';var Sequelize=require(_0x54dc('0x0'));var moment=require(_0x54dc('0x1'));var util=require(_0x54dc('0x2'));var _=require(_0x54dc('0x3'));module['exports']={'name':{'type':Sequelize[_0x54dc('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x449549){this[_0x54dc('0x5')]('name',_0x449549);this[_0x54dc('0x5')](_0x54dc('0x6'),_0x449549);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x54dc('0x4')],'allowNull':![],'set':function(_0x313485){this['setDataValue'](_0x54dc('0x7'),_0x313485);this['setDataValue'](_0x54dc('0x8'),util[_0x54dc('0x9')]('\x22%s\x22\x20<%s>',_0x313485,this[_0x54dc('0xa')](_0x54dc('0xb'))));}},'alias':{'type':Sequelize[_0x54dc('0x4')]},'email':{'type':Sequelize[_0x54dc('0x4')],'allowNull':![],'unique':_0x54dc('0xc'),'validate':{'isEmail':!![]},'set':function(_0x45a3f4){if(_0x45a3f4){this[_0x54dc('0x5')](_0x54dc('0xc'),_0x45a3f4['toLowerCase']());}}},'role':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0xe'),_0x54dc('0xf'),_0x54dc('0x10'),_0x54dc('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x54dc('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x54dc('0x4')],'defaultValue':_0x54dc('0x12')},'internal':{'type':Sequelize[_0x54dc('0x13')](0xb),'allowNull':![],'unique':_0x54dc('0xb'),'set':function(_0x8c1fff){this[_0x54dc('0x5')](_0x54dc('0xb'),_0x8c1fff);this[_0x54dc('0x5')]('accountcode',_0x8c1fff);this[_0x54dc('0x5')](_0x54dc('0x8'),util[_0x54dc('0x9')](_0x54dc('0x14'),this[_0x54dc('0xa')](_0x54dc('0x7')),_0x8c1fff));}},'salt':{'type':Sequelize[_0x54dc('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x54dc('0x4')]},'address':{'type':Sequelize[_0x54dc('0x4')]},'zipcode':{'type':Sequelize[_0x54dc('0x4')]},'userpic':{'type':Sequelize[_0x54dc('0x4')]},'city':{'type':Sequelize[_0x54dc('0x4')]},'country':{'type':Sequelize[_0x54dc('0x4')]},'online':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x54dc('0x16')]},'voicePause':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x54dc('0x4')],'defaultValue':_0x54dc('0x17')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x54dc('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x54dc('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x54dc('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x54dc('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x54dc('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x54dc('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x54dc('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x54dc('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![],'defaultValue':_0x54dc('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x54dc('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x54dc('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x54dc('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x19'),_0x54dc('0xf'),_0x54dc('0x1a')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![],'defaultValue':_0x54dc('0x1b')},'callingpres':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x1c'),_0x54dc('0x1d'),_0x54dc('0x1e'),_0x54dc('0x1f'),_0x54dc('0x20'),_0x54dc('0x21'),'PROHIB_FAILED_SCREEN',_0x54dc('0x22')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![],'defaultValue':_0x54dc('0x23'),'set':function(_0x25f23d){this[_0x54dc('0x5')]('transport',_0x25f23d?_0x25f23d[_0x54dc('0x24')](','):null);},'get':function(){return this[_0x54dc('0xa')](_0x54dc('0x25'))?this[_0x54dc('0xa')](_0x54dc('0x25'))[_0x54dc('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x27'),_0x54dc('0x28'),_0x54dc('0x29'),_0x54dc('0x2a'),_0x54dc('0x2b')),'allowNull':!![],'defaultValue':_0x54dc('0x27')},'directmedia':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x2c'),'no',_0x54dc('0x2d'),_0x54dc('0x2e'),_0x54dc('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![],'defaultValue':_0x54dc('0x30'),'set':function(_0x29caa1){this['setDataValue'](_0x54dc('0x31'),_0x29caa1?_0x29caa1[_0x54dc('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x54dc('0x31'))?this[_0x54dc('0xa')](_0x54dc('0x31'))[_0x54dc('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x54dc('0x4')]},'namedcallgroup':{'type':Sequelize[_0x54dc('0x4')]},'pickupgroup':{'type':Sequelize[_0x54dc('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x54dc('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x54dc('0x4')]},'disallow':{'type':Sequelize[_0x54dc('0x4')],'allowNull':![],'defaultValue':_0x54dc('0x32')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x54dc('0x33'),'set':function(_0x1a50ac){this[_0x54dc('0x5')]('allow',_0x1a50ac?_0x1a50ac[_0x54dc('0x24')](';'):_0x54dc('0x33'));},'get':function(){return this[_0x54dc('0xa')](_0x54dc('0x34'))?this[_0x54dc('0xa')](_0x54dc('0x34'))['split'](';'):null;},'comment':_0x54dc('0x35')},'autoframing':{'type':Sequelize['ENUM'](_0x54dc('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0xe6e7d1){this[_0x54dc('0x5')](_0x54dc('0x36'),_0xe6e7d1?_0xe6e7d1['join'](','):null);},'get':function(){return this['getDataValue'](_0x54dc('0x36'))?this['getDataValue'](_0x54dc('0x36'))[_0x54dc('0x26')](','):null;},'comment':_0x54dc('0x37')},'trustrpid':{'type':Sequelize['ENUM'](_0x54dc('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x54dc('0x2c'),'no',_0x54dc('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x54dc('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x54dc('0xd')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x54dc('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x54dc('0x39')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x54dc('0x2c')},'busylevel':{'type':Sequelize[_0x54dc('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x54dc('0xd')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x2c'),'no',_0x54dc('0x3a')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x54dc('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x3b'),'refuse',_0x54dc('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x54dc('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x54dc('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x54dc('0x3d'),'uas'),'allowNull':!![],'defaultValue':_0x54dc('0x3e')},'t38pt_usertpsource':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x54dc('0x2c')},'keepalive':{'type':Sequelize[_0x54dc('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x54dc('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x54dc('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x54dc('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x54dc('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x54dc('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x54dc('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x54dc('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x2c'),'no','fingerprint',_0x54dc('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x54dc('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x54dc('0x40'),'passive',_0x54dc('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x54dc('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x54dc('0xd')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x54dc('0xd')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x54dc('0xd')](_0x54dc('0x2c'),'no',_0x54dc('0x2d'),_0x54dc('0x2e'),_0x54dc('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x54dc('0x16')]},'showWebBar':{'type':Sequelize[_0x54dc('0x13')],'defaultValue':0x0,'set':function(_0x3aaf8c){this[_0x54dc('0x5')]('showWebBar',_0x3aaf8c);var _0x47bae8=this[_0x54dc('0x43')]({'plain':!![]});switch(_0x3aaf8c){case 0x0:case 0x1:var _0x3dbd5=_0x47bae8[_0x54dc('0x25')]?_[_0x54dc('0x44')](_0x47bae8[_0x54dc('0x25')])?_0x47bae8[_0x54dc('0x25')][_0x54dc('0x24')]():_0x47bae8['transport']:_0x54dc('0x23');if(_0x3dbd5===_0x54dc('0x45')){_0x3dbd5='udp';}this[_0x54dc('0x5')]('transport',_0x3dbd5);this[_0x54dc('0x5')](_0x54dc('0x46'),'no');this[_0x54dc('0x5')](_0x54dc('0x47'),null);this[_0x54dc('0x5')](_0x54dc('0x48'),null);this[_0x54dc('0x5')](_0x54dc('0x49'),null);this[_0x54dc('0x5')](_0x54dc('0x4a'),null);this[_0x54dc('0x5')](_0x54dc('0x4b'),null);this['setDataValue']('dtlssetup',null);this['setDataValue']('dtlscertfile',null);this['setDataValue'](_0x54dc('0x4c'),null);this['setDataValue'](_0x54dc('0x4d'),'no');break;case 0x2:this[_0x54dc('0x5')](_0x54dc('0x25'),'wss');this[_0x54dc('0x5')](_0x54dc('0x46'),_0x54dc('0x2c'));this[_0x54dc('0x5')](_0x54dc('0x47'),_0x54dc('0x2c'));this['setDataValue'](_0x54dc('0x48'),_0x54dc('0x2c'));this[_0x54dc('0x5')]('icesupport','yes');this[_0x54dc('0x5')](_0x54dc('0x4a'),_0x54dc('0x2c'));this[_0x54dc('0x5')]('dtlsverify','no');this[_0x54dc('0x5')](_0x54dc('0x4e'),_0x54dc('0x41'));this['setDataValue'](_0x54dc('0x4f'),_0x47bae8['dtlscertfile']||_0x54dc('0x50'));this[_0x54dc('0x5')](_0x54dc('0x4c'),_0x47bae8[_0x54dc('0x4c')]||'/etc/pki/tls/private/motion.key');this[_0x54dc('0x5')](_0x54dc('0x4d'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x2d2e08){this[_0x54dc('0x5')](_0x54dc('0x51'),_0x2d2e08?_0x2d2e08[_0x54dc('0x24')](','):[]);},'get':function(){return this[_0x54dc('0xa')](_0x54dc('0x51'))?_[_0x54dc('0x52')](this[_0x54dc('0xa')]('permissions')[_0x54dc('0x26')](','),function(_0x2bce86){return parseInt(_0x2bce86,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x54dc('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x54dc('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x54dc('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x54dc('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x54dc('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x54dc('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x54dc('0x4')]},'passwordResetAt':{'type':Sequelize[_0x54dc('0x16')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x54dc('0x53')],'get':function(){return this[_0x54dc('0xa')](_0x54dc('0x54'))?this[_0x54dc('0xa')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x54dc('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x54dc('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![],'set':function(_0x5ce855){if(typeof _0x5ce855===_0x54dc('0x55')){var _0x1f7211=_0x5ce855==='1'?!![]:_0x5ce855==='0'?![]:_0x5ce855===_0x54dc('0x56')?!![]:_0x5ce855===_0x54dc('0x57')?![]:![];this[_0x54dc('0x5')](_0x54dc('0x58'),_0x1f7211);}else{this['setDataValue']('screenrecording',_0x5ce855);}}},'blocked':{'type':Sequelize[_0x54dc('0x15')],'defaultValue':![],'set':function(_0x13e087){this[_0x54dc('0x5')](_0x54dc('0x59'),_0x13e087);if(_0x13e087===!![]){this['setDataValue'](_0x54dc('0x5a'),moment());this[_0x54dc('0x5')](_0x54dc('0x5b'),0x0);}else{this[_0x54dc('0x5')](_0x54dc('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0x54dc('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x54dc('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7ef1=['internal','email','toLowerCase','ENUM','user','agent','local','INTEGER','accountcode','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','peer','friend','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','update','outgoing','force_rport,comedia','nat','all','allow','insecure','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','nonat','update,nonat','showWebBar','isArray','encryption','force_avp','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','avpf','icesupport','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','blocked','blockedAt','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','callerid','\x22%s\x22\x20<%s>','getDataValue'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7ef1,0xf6));var _0x17ef=function(_0x38ced8,_0x4dbae9){_0x38ced8=_0x38ced8-0x0;var _0x3f2f4a=_0x7ef1[_0x38ced8];return _0x3f2f4a;};'use strict';var Sequelize=require(_0x17ef('0x0'));var moment=require(_0x17ef('0x1'));var util=require(_0x17ef('0x2'));var _=require(_0x17ef('0x3'));module[_0x17ef('0x4')]={'name':{'type':Sequelize[_0x17ef('0x5')],'allowNull':![],'unique':_0x17ef('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x39de2c){this[_0x17ef('0x7')](_0x17ef('0x6'),_0x39de2c);this[_0x17ef('0x7')]('defaultuser',_0x39de2c);},'comment':_0x17ef('0x8')},'fullname':{'type':Sequelize[_0x17ef('0x5')],'allowNull':![],'set':function(_0xb6281e){this[_0x17ef('0x7')]('fullname',_0xb6281e);this[_0x17ef('0x7')](_0x17ef('0x9'),util['format'](_0x17ef('0xa'),_0xb6281e,this[_0x17ef('0xb')](_0x17ef('0xc'))));}},'alias':{'type':Sequelize[_0x17ef('0x5')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x170ea4){if(_0x170ea4){this[_0x17ef('0x7')](_0x17ef('0xd'),_0x170ea4[_0x17ef('0xe')]());}}},'role':{'type':Sequelize[_0x17ef('0xf')]('admin',_0x17ef('0x10'),_0x17ef('0x11'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x17ef('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x17ef('0x5')],'defaultValue':_0x17ef('0x12')},'internal':{'type':Sequelize[_0x17ef('0x13')](0xb),'allowNull':![],'unique':_0x17ef('0xc'),'set':function(_0x5c7bf6){this['setDataValue']('internal',_0x5c7bf6);this['setDataValue'](_0x17ef('0x14'),_0x5c7bf6);this[_0x17ef('0x7')](_0x17ef('0x9'),util[_0x17ef('0x15')](_0x17ef('0xa'),this['getDataValue']('fullname'),_0x5c7bf6));}},'salt':{'type':Sequelize[_0x17ef('0x5')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x17ef('0x5')]},'address':{'type':Sequelize[_0x17ef('0x5')]},'zipcode':{'type':Sequelize[_0x17ef('0x5')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x17ef('0x5')]},'country':{'type':Sequelize[_0x17ef('0x5')]},'online':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x17ef('0x17')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x17ef('0x18')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x17ef('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x17ef('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x17ef('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x17ef('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x17ef('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x17ef('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x17ef('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x17ef('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x17ef('0x19')},'ipaddr':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x17ef('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x17ef('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x17ef('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x17ef('0xf')]('friend',_0x17ef('0x10'),_0x17ef('0x1a')),'allowNull':!![],'defaultValue':_0x17ef('0x1b')},'context':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![],'defaultValue':_0x17ef('0x1c')},'callingpres':{'type':Sequelize[_0x17ef('0xf')]('ALLOWED_NOT_SCREENED',_0x17ef('0x1d'),'ALLOWED_FAILED_SCREEN',_0x17ef('0x1e'),_0x17ef('0x1f'),_0x17ef('0x20'),_0x17ef('0x21'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![],'defaultValue':_0x17ef('0x22'),'set':function(_0x4d3961){this[_0x17ef('0x7')](_0x17ef('0x23'),_0x4d3961?_0x4d3961[_0x17ef('0x24')](','):null);},'get':function(){return this[_0x17ef('0xb')](_0x17ef('0x23'))?this[_0x17ef('0xb')](_0x17ef('0x23'))[_0x17ef('0x25')](','):null;},'comment':_0x17ef('0x26')},'dtmfmode':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x27'),_0x17ef('0x28'),_0x17ef('0x29'),'inband',_0x17ef('0x2a')),'allowNull':!![],'defaultValue':_0x17ef('0x27')},'directmedia':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x2b'),'no','nonat',_0x17ef('0x2c'),_0x17ef('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x17ef('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![],'defaultValue':_0x17ef('0x2e'),'set':function(_0x43c239){this[_0x17ef('0x7')](_0x17ef('0x2f'),_0x43c239?_0x43c239[_0x17ef('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x17ef('0x2f'))?this[_0x17ef('0xb')](_0x17ef('0x2f'))[_0x17ef('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x17ef('0x5')]},'namedcallgroup':{'type':Sequelize[_0x17ef('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x17ef('0x5')]},'language':{'type':Sequelize[_0x17ef('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x17ef('0x5')],'allowNull':![],'defaultValue':_0x17ef('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x50f261){this[_0x17ef('0x7')](_0x17ef('0x31'),_0x50f261?_0x50f261[_0x17ef('0x24')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x17ef('0xb')](_0x17ef('0x31'))?this[_0x17ef('0xb')](_0x17ef('0x31'))[_0x17ef('0x25')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x17ef('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![],'set':function(_0x5ee438){this[_0x17ef('0x7')](_0x17ef('0x32'),_0x5ee438?_0x5ee438[_0x17ef('0x24')](','):null);},'get':function(){return this[_0x17ef('0xb')](_0x17ef('0x32'))?this[_0x17ef('0xb')](_0x17ef('0x32'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x17ef('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x2b'),'no',_0x17ef('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x17ef('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x17ef('0x34')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x17ef('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x17ef('0x2b')},'busylevel':{'type':Sequelize[_0x17ef('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x17ef('0xf')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x17ef('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x2b'),'no',_0x17ef('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x17ef('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x36'),_0x17ef('0x37'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x17ef('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x17ef('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x38'),_0x17ef('0x39')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x2b'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x17ef('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x17ef('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x17ef('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x17ef('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x17ef('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x17ef('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x17ef('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x17ef('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x2b'),'no',_0x17ef('0x3a'),_0x17ef('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x17ef('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x17ef('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x17ef('0xf')]('yes','no',_0x17ef('0x3c'),_0x17ef('0x2c'),_0x17ef('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x17ef('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x17ef('0x17')]},'showWebBar':{'type':Sequelize[_0x17ef('0x13')],'defaultValue':0x0,'set':function(_0x5cf78b){this[_0x17ef('0x7')](_0x17ef('0x3e'),_0x5cf78b);var _0x23d6df=this['get']({'plain':!![]});switch(_0x5cf78b){case 0x0:case 0x1:var _0xf9ae22=_0x23d6df[_0x17ef('0x23')]?_[_0x17ef('0x3f')](_0x23d6df[_0x17ef('0x23')])?_0x23d6df[_0x17ef('0x23')]['join']():_0x23d6df[_0x17ef('0x23')]:_0x17ef('0x22');if(_0xf9ae22==='wss'){_0xf9ae22='udp';}this[_0x17ef('0x7')](_0x17ef('0x23'),_0xf9ae22);this[_0x17ef('0x7')](_0x17ef('0x40'),'no');this[_0x17ef('0x7')]('avpf',null);this[_0x17ef('0x7')](_0x17ef('0x41'),null);this[_0x17ef('0x7')]('icesupport',null);this[_0x17ef('0x7')](_0x17ef('0x42'),null);this[_0x17ef('0x7')]('dtlsverify',null);this['setDataValue'](_0x17ef('0x43'),null);this[_0x17ef('0x7')](_0x17ef('0x44'),null);this[_0x17ef('0x7')](_0x17ef('0x45'),null);this[_0x17ef('0x7')]('rtcp_mux','no');break;case 0x2:this[_0x17ef('0x7')]('transport','wss');this[_0x17ef('0x7')]('encryption',_0x17ef('0x2b'));this['setDataValue'](_0x17ef('0x46'),_0x17ef('0x2b'));this['setDataValue']('force_avp',_0x17ef('0x2b'));this[_0x17ef('0x7')](_0x17ef('0x47'),_0x17ef('0x2b'));this[_0x17ef('0x7')](_0x17ef('0x42'),'yes');this['setDataValue'](_0x17ef('0x48'),'no');this[_0x17ef('0x7')](_0x17ef('0x43'),_0x17ef('0x49'));this['setDataValue'](_0x17ef('0x44'),_0x23d6df['dtlscertfile']||_0x17ef('0x4a'));this[_0x17ef('0x7')](_0x17ef('0x45'),_0x23d6df['dtlsprivatekey']||_0x17ef('0x4b'));this['setDataValue']('rtcp_mux',_0x17ef('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0x17ef('0x4c')],'set':function(_0x21b1e9){this[_0x17ef('0x7')](_0x17ef('0x4d'),_0x21b1e9?_0x21b1e9[_0x17ef('0x24')](','):[]);},'get':function(){return this[_0x17ef('0xb')](_0x17ef('0x4d'))?_[_0x17ef('0x4e')](this[_0x17ef('0xb')](_0x17ef('0x4d'))['split'](','),function(_0x525e93){return parseInt(_0x525e93,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x17ef('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x17ef('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x17ef('0x5')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x17ef('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x17ef('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x17ef('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x17ef('0xf')](_0x17ef('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x17ef('0x5')]},'passwordResetAt':{'type':Sequelize[_0x17ef('0x17')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x17ef('0x4f')],'get':function(){return this[_0x17ef('0xb')](_0x17ef('0x50'))?this['getDataValue'](_0x17ef('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x17ef('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x17ef('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![],'set':function(_0x41aa77){if(typeof _0x41aa77===_0x17ef('0x51')){var _0x57b261=_0x41aa77==='1'?!![]:_0x41aa77==='0'?![]:_0x41aa77===_0x17ef('0x52')?!![]:_0x41aa77===_0x17ef('0x53')?![]:![];this[_0x17ef('0x7')]('screenrecording',_0x57b261);}else{this[_0x17ef('0x7')]('screenrecording',_0x41aa77);}}},'blocked':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![],'set':function(_0x464327){this[_0x17ef('0x7')](_0x17ef('0x54'),_0x464327);if(_0x464327===!![]){this[_0x17ef('0x7')]('blockedAt',moment());this[_0x17ef('0x7')]('loginAttempts',0x0);}else{this[_0x17ef('0x7')](_0x17ef('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x17ef('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x17ef('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x17ef('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index b8a98db..82913de 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 _0x31b3=['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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','User,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','agent','Telephones','telephone','ignore','value','includes','role','find','UserProfileResource','destroy','stack','name','map','User','type','key','model','differenceBy','salt','query','filters','intersection','attributes','length','order','sort','where','pick','merge','VIRTUAL','sequelize','col','filter','options','count','includeAll','include','show','params','rawAttributes','password','keys','fields','bulkCreate','body','describe','addContacts','ids','omit','agent\x20role','../../config/license/util','telephones','isNil','License\x20limit\x20reached','format','count\x20%s:\x20%s','create','internal','min_internal','max','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','102','103','113','110','104','105','106','107','108','109','100','111','114','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Setting','findOne','securePassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','oldPassword','admin','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','online','loginInPause','interface','isValidChannel','Unknown\x20channel','add','toLowerCase','penalty','spread','capitalize','QueueId','Queue:save','voice','VoiceQueue','findAll','push','voicePause','each','UserVoiceQueueRt','upsert','removeQueues','remove','emit','userpic','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','download','existsSync','join','server/files/images/','CmContact','getContacts','hasOwnProperty','Tag','Tags','tag','nolimit','Queue','Queues','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','rows','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','phone','mobile','intrf','SIP/%s','user:forcelogout','headers','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','all','getChannels','LOGIN','device','LOGININPAUSE','concat','isMiddleware','resolve','logout','pause','QueuePause','PAUSE','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','manual','mail','chat','fax','sms','whatsapp','Pause','getTeams','Team','addTeams','getChatQueues','setDataValue','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','Voice','removeTeams','removeAgent','Queue:remove','getLists','CmList','getAgents','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','isArray','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','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','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$gt','$lt','$eq','$not','$notIn','$like','$iLike','$contains','$contained','firstName','lastName','Contact','dialActive','getApiKey','token','No\x20API\x20access\x20key\x20found!','iat','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','html-pdf','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','redis','defaults','localhost','./user.socket','register','jayson/promise','client','test','Sequelize'];(function(_0x134d5e,_0x2a47d8){var _0x1e166a=function(_0x53f10d){while(--_0x53f10d){_0x134d5e['push'](_0x134d5e['shift']());}};_0x1e166a(++_0x2a47d8);}(_0x31b3,0x14a));var _0x331b=function(_0x7a68b8,_0x3b74d7){_0x7a68b8=_0x7a68b8-0x0;var _0x4cfd30=_0x31b3[_0x7a68b8];return _0x4cfd30;};'use strict';var pdf=require(_0x331b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x331b('0x1'));var zipdir=require(_0x331b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x331b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x331b('0x4'));var util=require(_0x331b('0x5'));var path=require(_0x331b('0x6'));var sox=require('sox');var csv=require(_0x331b('0x7'));var ejs=require(_0x331b('0x8'));var fs=require('fs');var _=require(_0x331b('0x9'));var squel=require(_0x331b('0xa'));var crypto=require(_0x331b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x331b('0x7'));var querystring=require(_0x331b('0xc'));var Papa=require(_0x331b('0xd'));var Redis=require(_0x331b('0xe'));var authService=require(_0x331b('0xf'));var qs=require(_0x331b('0x10'));var as=require(_0x331b('0x11'));var hardwareService=require(_0x331b('0x12'));var logger=require('../../config/logger')(_0x331b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x331b('0x14')]=_[_0x331b('0x15')](config[_0x331b('0x14')],{'host':_0x331b('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x331b('0x14')]));require(_0x331b('0x17'))[_0x331b('0x18')](socket);var jayson=require(_0x331b('0x19'));var client=jayson[_0x331b('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x1e98b1,_0x1dcdb4,_0xc540be){if(_0xc540be){var _0x40cdf5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x40cdf5[_0x331b('0x1b')](_0x1dcdb4)){return _0x1e98b1;}else{throw new db[(_0x331b('0x1c'))][(_0x331b('0x1d'))](_0x331b('0x1e'));}}else{return _0x1e98b1;}}function respondWithRpcPromise(_0x20ae11,_0x57eb53,_0x161315,_0x2a33fd){return new BPromise(function(_0x5e4957,_0x352b21){var _0x2aa872=_0x2a33fd||client;return _0x2aa872[_0x331b('0x1f')](_0x20ae11,_0x161315)[_0x331b('0x20')](function(_0x1ec86c){logger[_0x331b('0x21')]('User,\x20%s,\x20%s',_0x57eb53,_0x331b('0x22'));logger[_0x331b('0x23')](_0x331b('0x24'),_0x57eb53,_0x331b('0x22'),JSON[_0x331b('0x25')](_0x1ec86c));if(_0x1ec86c[_0x331b('0x26')]){if(_0x1ec86c[_0x331b('0x26')]['code']===0x1f4){logger[_0x331b('0x26')](_0x331b('0x27'),_0x57eb53,_0x1ec86c[_0x331b('0x26')][_0x331b('0x28')]);return _0x352b21(_0x1ec86c[_0x331b('0x26')][_0x331b('0x28')]);}logger[_0x331b('0x26')]('User,\x20%s,\x20%s',_0x57eb53,_0x1ec86c[_0x331b('0x26')][_0x331b('0x28')]);return _0x5e4957(_0x1ec86c['error']['message']);}else{logger[_0x331b('0x21')]('User,\x20%s,\x20%s',_0x57eb53,_0x331b('0x22'));_0x5e4957(_0x1ec86c[_0x331b('0x29')][_0x331b('0x28')]);}})[_0x331b('0x2a')](function(_0x2bb9f5){logger[_0x331b('0x26')]('User,\x20%s,\x20%s',_0x57eb53,_0x2bb9f5);_0x352b21(_0x2bb9f5);});});}function respondWithStatusCode(_0x52ef3e,_0x28b7a4){_0x28b7a4=_0x28b7a4||0xcc;return function(_0x4c924c){if(_0x4c924c){return _0x52ef3e[_0x331b('0x2b')](_0x28b7a4);}return _0x52ef3e[_0x331b('0x2c')](_0x28b7a4)[_0x331b('0x2d')]();};}function respondWithResult(_0x78f4c4,_0x41c091){_0x41c091=_0x41c091||0xc8;return function(_0x1bbbb0){if(_0x1bbbb0){return _0x78f4c4['status'](_0x41c091)[_0x331b('0x2e')](_0x1bbbb0);}};}function respondWithFilteredResult(_0x330d5f,_0x203aa7){return function(_0x3580e6){if(_0x3580e6){var _0xd9642b=_0x3580e6['count'],_0x3d18cb=_0x203aa7[_0x331b('0x2f')],_0x57deff=_0x203aa7[_0x331b('0x2f')]+_0x203aa7[_0x331b('0x30')],_0x29002e;if(_0x57deff>=_0xd9642b){_0x57deff=_0xd9642b;_0x29002e=0xc8;}else{_0x29002e=0xce;}_0x330d5f[_0x331b('0x2c')](_0x29002e);return _0x330d5f[_0x331b('0x31')](_0x331b('0x32'),_0x3d18cb+'-'+_0x57deff+'/'+_0xd9642b)['json'](_0x3580e6);}return null;};}function patchUpdates(_0x2705d0){return function(_0x3e0fcf){try{jsonpatch[_0x331b('0x33')](_0x3e0fcf,_0x2705d0,!![]);}catch(_0x28729b){return BPromise[_0x331b('0x34')](_0x28729b);}return _0x3e0fcf[_0x331b('0x35')]();};}function saveUpdates(_0x224981,_0x4c7b3c){return function(_0x27de01){if(_0x27de01){return _0x27de01[_0x331b('0x36')](_0x224981)['then'](function(_0xe63e71){return _0xe63e71;});}return null;};}function removeEntity(_0x2e4e50,_0x34a59b){return function(_0x42a114){if(_0x42a114){return _0x42a114['destroy']()['then'](function(){var _0x57c98a=_0x42a114['get']({'plain':!![]});var _0x1bde46=[{'name':'Users','value':'user','ignore':!![]},{'name':'Agents','value':_0x331b('0x37'),'ignore':![]},{'name':_0x331b('0x38'),'value':_0x331b('0x39'),'ignore':![]}];var _0x58b1e2=_(_0x1bde46)['filter'](_0x331b('0x3a'))['map'](_0x331b('0x3b'))['value']();if(_[_0x331b('0x3c')](_0x58b1e2,_0x57c98a[_0x331b('0x3d')])){return;}var _0x460bcb=_[_0x331b('0x3e')](_0x1bde46,[_0x331b('0x3b'),_0x57c98a['role']])['name'];return db[_0x331b('0x3f')][_0x331b('0x40')]({'where':{'type':_0x460bcb,'resourceId':_0x57c98a['id']}})[_0x331b('0x20')](function(){return _0x42a114;});})['then'](function(){_0x2e4e50[_0x331b('0x2c')](0xcc)[_0x331b('0x2d')]();});}};}function handleEntityNotFound(_0x367059,_0xcde83e){return function(_0x54a9fe){if(!_0x54a9fe){_0x367059[_0x331b('0x2b')](0x194);}return _0x54a9fe;};}function handleError(_0x481571,_0x5e9d27){_0x5e9d27=_0x5e9d27||0x1f4;return function(_0x144f34){logger['error'](_0x144f34[_0x331b('0x41')]);if(_0x144f34['name']){delete _0x144f34[_0x331b('0x42')];}_0x481571[_0x331b('0x2c')](_0x5e9d27)['send'](_0x144f34);};}exports['index']=function(_0x499f8f,_0x3c4c08){var _0x159f9b={},_0x42cba4={},_0x212b53={'count':0x0,'rows':[]};var _0x4ba41f=_[_0x331b('0x43')](db[_0x331b('0x44')]['rawAttributes'],function(_0x1d7a10){return{'name':_0x1d7a10['fieldName'],'type':_0x1d7a10[_0x331b('0x45')][_0x331b('0x46')]};});_0x42cba4[_0x331b('0x47')]=_[_0x331b('0x48')](_['map'](_0x4ba41f,_0x331b('0x42')),['password',_0x331b('0x49')]);_0x42cba4[_0x331b('0x4a')]=_['keys'](_0x499f8f['query']);_0x42cba4[_0x331b('0x4b')]=_[_0x331b('0x4c')](_0x42cba4[_0x331b('0x47')],_0x42cba4[_0x331b('0x4a')]);_0x159f9b['attributes']=_['intersection'](_0x42cba4['model'],qs['fields'](_0x499f8f[_0x331b('0x4a')]['fields']));_0x159f9b[_0x331b('0x4d')]=_0x159f9b['attributes'][_0x331b('0x4e')]?_0x159f9b[_0x331b('0x4d')]:_0x42cba4[_0x331b('0x47')];if(!_0x499f8f[_0x331b('0x4a')]['hasOwnProperty']('nolimit')){_0x159f9b['limit']=qs[_0x331b('0x30')](_0x499f8f['query']['limit']);_0x159f9b['offset']=qs[_0x331b('0x2f')](_0x499f8f['query'][_0x331b('0x2f')]);}_0x159f9b[_0x331b('0x4f')]=qs['sort'](_0x499f8f[_0x331b('0x4a')][_0x331b('0x50')]);_0x159f9b[_0x331b('0x51')]=qs['filters'](_[_0x331b('0x52')](_0x499f8f[_0x331b('0x4a')],_0x42cba4[_0x331b('0x4b')]),_0x4ba41f);if(_0x499f8f[_0x331b('0x4a')]['filter']){_0x159f9b[_0x331b('0x51')]=_[_0x331b('0x53')](_0x159f9b['where'],{'$or':_[_0x331b('0x43')](_0x4ba41f,function(_0x5d0751){if(_0x5d0751[_0x331b('0x45')]!==_0x331b('0x54')){return db['sequelize'][_0x331b('0x51')](db['sequelize']['fn']('lower',db[_0x331b('0x55')][_0x331b('0x56')](_0x5d0751['name'])),{'$like':db['sequelize']['fn']('lower','%'+_0x499f8f['query'][_0x331b('0x57')]+'%')});}})});}_0x159f9b=_[_0x331b('0x53')]({},_0x159f9b,_0x499f8f[_0x331b('0x58')]);var _0x30f148={'where':_0x159f9b[_0x331b('0x51')]};return db[_0x331b('0x44')][_0x331b('0x59')](_0x30f148)[_0x331b('0x20')](function(_0x578df2){_0x212b53[_0x331b('0x59')]=_0x578df2;if(_0x499f8f[_0x331b('0x4a')][_0x331b('0x5a')]){_0x159f9b[_0x331b('0x5b')]=[{'all':!![]}];}return db['User']['findAll'](_0x159f9b);})[_0x331b('0x20')](function(_0x52f269){_0x212b53['rows']=_0x52f269;return _0x212b53;})['then'](respondWithFilteredResult(_0x3c4c08,_0x159f9b))[_0x331b('0x2a')](handleError(_0x3c4c08,null));};exports[_0x331b('0x5c')]=function(_0x462ffe,_0x4e32af){var _0x5efdcb={'raw':![],'where':{'id':_0x462ffe[_0x331b('0x5d')]['id']}},_0x39c539={};_0x39c539[_0x331b('0x47')]=_[_0x331b('0x48')](_['keys'](db[_0x331b('0x44')][_0x331b('0x5e')]),[_0x331b('0x5f'),'salt']);_0x39c539['query']=_[_0x331b('0x60')](_0x462ffe[_0x331b('0x4a')]);_0x39c539[_0x331b('0x4b')]=_[_0x331b('0x4c')](_0x39c539[_0x331b('0x47')],_0x39c539[_0x331b('0x4a')]);_0x5efdcb['attributes']=_[_0x331b('0x4c')](_0x39c539['model'],qs[_0x331b('0x61')](_0x462ffe[_0x331b('0x4a')][_0x331b('0x61')]));_0x5efdcb['attributes']=_0x5efdcb[_0x331b('0x4d')][_0x331b('0x4e')]?_0x5efdcb[_0x331b('0x4d')]:_0x39c539[_0x331b('0x47')];if(_0x462ffe['query'][_0x331b('0x5a')]){_0x5efdcb[_0x331b('0x5b')]=[{'all':!![]}];}_0x5efdcb=_[_0x331b('0x53')]({},_0x5efdcb,_0x462ffe[_0x331b('0x58')]);return db['User'][_0x331b('0x3e')](_0x5efdcb)[_0x331b('0x20')](handleEntityNotFound(_0x4e32af,null))['then'](respondWithResult(_0x4e32af,null))[_0x331b('0x2a')](handleError(_0x4e32af,null));};exports['bulkCreate']=function(_0x3c94bf,_0xc4d7b8){return db[_0x331b('0x44')][_0x331b('0x62')](_0x3c94bf['body'],{'raw':![],'individualHooks':!![]})[_0x331b('0x20')](respondWithResult(_0xc4d7b8,0xc9))['catch'](handleError(_0xc4d7b8,null));};exports[_0x331b('0x36')]=function(_0x3c49c0,_0x3450cd){if(_0x3c49c0[_0x331b('0x63')]['id']){delete _0x3c49c0['body']['id'];}delete _0x3c49c0[_0x331b('0x63')][_0x331b('0x3d')];return db[_0x331b('0x44')][_0x331b('0x3e')]({'where':{'id':_0x3c49c0[_0x331b('0x5d')]['id']}})[_0x331b('0x20')](handleEntityNotFound(_0x3450cd,null))['then'](saveUpdates(_0x3c49c0['body'],null))[_0x331b('0x20')](respondWithResult(_0x3450cd,null))[_0x331b('0x2a')](handleError(_0x3450cd,null));};exports[_0x331b('0x64')]=function(_0x1fb576,_0x2efec8){return db[_0x331b('0x44')][_0x331b('0x64')]()[_0x331b('0x20')](respondWithResult(_0x2efec8,null))[_0x331b('0x2a')](handleError(_0x2efec8,null));};exports[_0x331b('0x65')]=function(_0x5990f5,_0x3819a3,_0x1ca5ea){return db[_0x331b('0x44')]['find']({'where':{'id':_0x5990f5[_0x331b('0x5d')]['id']}})[_0x331b('0x20')](handleEntityNotFound(_0x3819a3,null))[_0x331b('0x20')](function(_0xcf17a5){if(_0xcf17a5){return _0xcf17a5[_0x331b('0x65')](_0x5990f5['body'][_0x331b('0x66')],_[_0x331b('0x67')](_0x5990f5[_0x331b('0x63')],[_0x331b('0x66'),'id'])||{});}})[_0x331b('0x20')](respondWithResult(_0x3819a3,null))[_0x331b('0x2a')](handleError(_0x3819a3,null));};var getLicense=function(_0x2c5369){return new BPromise(function(_0x91143,_0x8ed647){var _0x3acffc=0x0;_0x2c5369[_0x331b('0x63')][_0x331b('0x3d')]===_0x331b('0x37')&&_0x91143(_0x331b('0x68'));return db['User'][_0x331b('0x59')]({'where':{'$or':[{'role':_0x2c5369[_0x331b('0x63')][_0x331b('0x3d')]===_0x331b('0x39')?_0x331b('0x39'):['admin','user']}]}})[_0x331b('0x20')](function(_0x5d2455){_0x3acffc=_0x5d2455;return require(_0x331b('0x69'))['getLicense']();})[_0x331b('0x20')](function(_0x130677){var _0x1d3ae7=_0x2c5369[_0x331b('0x63')][_0x331b('0x3d')]===_0x331b('0x39')?_0x331b('0x6a'):'users';if(!_[_0x331b('0x6b')](_0x130677[_0x1d3ae7])&&_0x3acffc>=_0x130677[_0x1d3ae7]){return _0x8ed647({'message':_0x331b('0x6c')});}return _0x91143(util[_0x331b('0x6d')](_0x331b('0x6e'),_0x1d3ae7,_0x3acffc));})['catch'](function(_0xc784a2){return _0x8ed647(_0xc784a2);});});};exports[_0x331b('0x6f')]=function(_0x4bcc8c,_0x21d5cc){return getLicense(_0x4bcc8c)['then'](function(_0x10bdf1){if(!_0x4bcc8c[_0x331b('0x63')][_0x331b('0x70')]){var _0x5ec707;return db['Setting']['findById'](0x1)[_0x331b('0x20')](function(_0x3446bb){return checkPasswordPattern(_0x3446bb,_0x4bcc8c['body']['password'],_0x3446bb['securePassword']);})[_0x331b('0x20')](function(_0x2df18d){_0x5ec707=_0x2df18d[_0x331b('0x71')];return db[_0x331b('0x44')][_0x331b('0x72')]('internal');})[_0x331b('0x20')](function(_0x141b9c){if(_[_0x331b('0x6b')](_0x141b9c)){if(_0x5ec707){_0x4bcc8c[_0x331b('0x63')][_0x331b('0x70')]=_0x5ec707;}else{_0x4bcc8c[_0x331b('0x63')][_0x331b('0x70')]=0x1;}}else{if(_['isNil'](_0x5ec707)||_0x5ec707==_0x141b9c){_0x4bcc8c[_0x331b('0x63')][_0x331b('0x70')]=_0x141b9c+0x1;}else if(_0x5ec707>_0x141b9c){_0x4bcc8c['body'][_0x331b('0x70')]=_0x5ec707;}else{return db[_0x331b('0x55')][_0x331b('0x4a')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x331b('0x55')][_0x331b('0x73')][_0x331b('0x74')]})[_0x331b('0x20')](function(_0x218776){if(_0x218776&&_0x218776[_0x331b('0x4e')]){for(var _0x3db713=0x0,_0x189914=_0x218776[_0x331b('0x4e')];_0x3db713<_0x189914&&_[_0x331b('0x6b')](_0x4bcc8c[_0x331b('0x63')][_0x331b('0x70')]);_0x3db713++){if(_0x5ec707<=_0x218776[_0x3db713][_0x331b('0x75')]){_0x4bcc8c[_0x331b('0x63')][_0x331b('0x70')]=_0x218776[_0x3db713][_0x331b('0x75')];}else if(_0x5ec707>_0x218776[_0x3db713][_0x331b('0x75')]&&_0x5ec707<=_0x218776[_0x3db713]['to']){_0x4bcc8c[_0x331b('0x63')][_0x331b('0x70')]=_0x5ec707;}}}if(_[_0x331b('0x6b')](_0x4bcc8c[_0x331b('0x63')][_0x331b('0x70')])){_0x4bcc8c[_0x331b('0x63')][_0x331b('0x70')]=_0x141b9c+0x1;}});}}});}})['then'](function(){if(_0x4bcc8c['body'][_0x331b('0x76')]){_0x4bcc8c[_0x331b('0x63')][_0x331b('0x77')]=_0x4bcc8c[_0x331b('0x63')][_0x331b('0x70')];_0x4bcc8c['body'][_0x331b('0x78')]={'mailbox':_0x4bcc8c[_0x331b('0x63')][_0x331b('0x70')],'password':_0x4bcc8c[_0x331b('0x63')]['password'],'fullname':_0x4bcc8c[_0x331b('0x63')][_0x331b('0x79')],'email':_0x4bcc8c[_0x331b('0x63')][_0x331b('0x7a')]};}if(_0x4bcc8c[_0x331b('0x63')]&&_0x4bcc8c[_0x331b('0x63')]['role']===_0x331b('0x37')){if(!_0x4bcc8c['body'][_0x331b('0x7b')]){_0x4bcc8c['body'][_0x331b('0x7b')]=['101',_0x331b('0x7c'),_0x331b('0x7d'),_0x331b('0x7e'),_0x331b('0x7f'),_0x331b('0x80'),_0x331b('0x81'),_0x331b('0x82'),_0x331b('0x83'),_0x331b('0x84'),_0x331b('0x85'),_0x331b('0x86'),_0x331b('0x87'),_0x331b('0x88')];}}return db[_0x331b('0x44')][_0x331b('0x6f')](_0x4bcc8c[_0x331b('0x63')],{'include':[{'model':db[_0x331b('0x78')],'as':'VoiceMail'}]});})[_0x331b('0x20')](function(_0x1d9134){if(_0x4bcc8c[_0x331b('0x63')][_0x331b('0x3d')]===_0x331b('0x89'))return _0x1d9134;var _0x3ddb35=_0x4bcc8c[_0x331b('0x89')][_0x331b('0x8a')]({'plain':!![]});if(!_0x3ddb35)throw new Error(_0x331b('0x8b'));if(_0x3ddb35[_0x331b('0x3d')]===_0x331b('0x89')){var _0x42abcf=_0x1d9134[_0x331b('0x8a')]({'plain':!![]});var _0x32503b=[{'name':_0x331b('0x8c'),'value':_0x331b('0x37')},{'name':'Telephones','value':_0x331b('0x39')}];var _0x517396=_['find'](_0x32503b,[_0x331b('0x3b'),_0x42abcf[_0x331b('0x3d')]])[_0x331b('0x42')];return db[_0x331b('0x8d')][_0x331b('0x3e')]({'where':{'name':_0x517396,'userProfileId':_0x3ddb35[_0x331b('0x8e')]},'raw':!![]})[_0x331b('0x20')](function(_0x60e49e){if(_0x60e49e&&_0x60e49e[_0x331b('0x8f')]===0x0){return db[_0x331b('0x3f')][_0x331b('0x6f')]({'name':_0x42abcf[_0x331b('0x42')],'resourceId':_0x42abcf['id'],'type':_0x60e49e[_0x331b('0x42')],'sectionId':_0x60e49e['id']},{})['then'](function(){return _0x1d9134;});}else{return _0x1d9134;}})[_0x331b('0x2a')](function(_0x2e4ce1){logger[_0x331b('0x26')](_0x331b('0x90'),_0x2e4ce1);throw _0x2e4ce1;});}return _0x1d9134;})[_0x331b('0x20')](respondWithResult(_0x21d5cc,0xc9))[_0x331b('0x2a')](handleError(_0x21d5cc,null));};exports['changePassword']=function(_0x24793f,_0x242ff4,_0x2116e8){var _0xe4cc38=![];if(_0x24793f['body']['id']){delete _0x24793f[_0x331b('0x63')]['id'];}return db[_0x331b('0x91')][_0x331b('0x92')]({'attributes':['id',_0x331b('0x93')]})[_0x331b('0x20')](function(_0x6804c9){_0xe4cc38=_0x6804c9['securePassword'];return db[_0x331b('0x44')][_0x331b('0x3e')]({'where':{'id':_0x24793f['params']['id']}});})[_0x331b('0x20')](function(_0x4efbf4){if(_0x4efbf4){if(_0x4efbf4['id']==_0x24793f['user']['id']){if(!_0x24793f['body']['oldPassword']||!_0x24793f[_0x331b('0x63')][_0x331b('0x94')]){throw new db[(_0x331b('0x1c'))][(_0x331b('0x1d'))](_0x331b('0x95'));}if(!_0x4efbf4[_0x331b('0x96')](_0x24793f[_0x331b('0x63')][_0x331b('0x97')])){throw new db[(_0x331b('0x1c'))][(_0x331b('0x1d'))]('Wrong\x20credentials');}if(_0x24793f['body'][_0x331b('0x97')]==_0x24793f[_0x331b('0x63')][_0x331b('0x94')]){throw new db[(_0x331b('0x1c'))][(_0x331b('0x1d'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x4efbf4;}else if(_0x24793f['user'][_0x331b('0x3d')]==_0x331b('0x98')){if(!_0x24793f[_0x331b('0x63')][_0x331b('0x94')]){throw new db[(_0x331b('0x1c'))]['ValidationError'](_0x331b('0x99'));}return _0x4efbf4;}else if(_0x24793f[_0x331b('0x89')][_0x331b('0x3d')]==_0x331b('0x89')){if(!_0x24793f[_0x331b('0x63')][_0x331b('0x94')]){throw new db[(_0x331b('0x1c'))]['ValidationError'](_0x331b('0x99'));}if(_0x4efbf4[_0x331b('0x3d')]!=_0x331b('0x37')){throw new db[(_0x331b('0x1c'))]['ValidationError'](_0x331b('0x9a'));}return _0x4efbf4;}else{throw new db[(_0x331b('0x1c'))][(_0x331b('0x1d'))](_0x331b('0x9a'));}}return null;})[_0x331b('0x20')](handleEntityNotFound(_0x242ff4,null))[_0x331b('0x20')](function(_0x5793ed){return checkPasswordPattern(_0x5793ed,_0x24793f['body'][_0x331b('0x94')],_0xe4cc38);})[_0x331b('0x20')](saveUpdates({'password':_0x24793f[_0x331b('0x63')]['newPassword'],'passwordResetAt':_0x24793f[_0x331b('0x89')]['id']==_0x24793f[_0x331b('0x5d')]['id']?moment():null},null))[_0x331b('0x20')](respondWithResult(_0x242ff4,null))['catch'](handleError(_0x242ff4,null));};exports[_0x331b('0x9b')]=function(_0x1beb6,_0x53d571,_0xfcede9){var _0x3ffc94=_0x1beb6[_0x331b('0x63')][_0x331b('0x9c')];return db[_0x331b('0x44')]['find']({'where':{'id':_0x1beb6['params']['id']},'attributes':['id',_0x331b('0x42'),_0x331b('0x3d'),_0x331b('0x9d'),_0x331b('0x9e'),'voicePause',_0x331b('0x9f')]})[_0x331b('0x20')](handleEntityNotFound(_0x53d571,null))[_0x331b('0x20')](function(_0x42f417){if(_0x42f417){if(!utils[_0x331b('0xa0')](_0x3ffc94)){throw new db[(_0x331b('0x1c'))][(_0x331b('0x1d'))](_0x331b('0xa1'));}return _0x42f417[_0x331b('0xa2')+_['capitalize'](_0x3ffc94[_0x331b('0xa3')]())+'Queues'](_0x1beb6[_0x331b('0x63')][_0x331b('0x66')],{'penalty':_0x1beb6[_0x331b('0x63')][_0x331b('0xa4')]||0x0})[_0x331b('0xa5')](function(_0x1aacac){for(var _0x2af848=0x0;_0x2af848<_0x1beb6[_0x331b('0x63')][_0x331b('0x66')][_0x331b('0x4e')];_0x2af848+=0x1){var _0x4fbbd6={'UserId':_0x1beb6[_0x331b('0x5d')]['id']};_0x4fbbd6[_[_0x331b('0xa6')](_0x3ffc94[_0x331b('0xa3')]())+_0x331b('0xa7')]=_0x1beb6['body']['ids'][_0x2af848];socket['emit'](_0x331b('0x89')+_[_0x331b('0xa6')](_0x3ffc94[_0x331b('0xa3')]())+_0x331b('0xa8'),_0x4fbbd6);}return _0x1aacac;})['then'](function(){if(_0x3ffc94===_0x331b('0xa9')){return db[_0x331b('0xaa')][_0x331b('0xab')]({'where':{'id':_0x1beb6[_0x331b('0x63')][_0x331b('0x66')]||[]},'raw':!![],'attributes':['id',_0x331b('0x42')]});}})[_0x331b('0x20')](function(_0x3d0047){var _0x57b82b=_0x42f417['get']({'plain':!![]});var _0x1e5532=[];if(_0x3ffc94===_0x331b('0xa9')&&_0x57b82b['role']===_0x331b('0x37')&&_0x57b82b[_0x331b('0x9d')]){for(var _0x2a5207=0x0;_0x2a5207<_0x3d0047[_0x331b('0x4e')];_0x2a5207+=0x1){_0x1e5532[_0x331b('0xac')]({'membername':_0x57b82b[_0x331b('0x42')],'UserId':_0x57b82b['id'],'queue_name':_0x3d0047[_0x2a5207][_0x331b('0x42')],'VoiceQueueId':_0x3d0047[_0x2a5207]['id'],'interface':_[_0x331b('0x6b')](_0x57b82b[_0x331b('0x9f')])?util[_0x331b('0x6d')]('SIP/%s',_0x57b82b[_0x331b('0x42')]):_0x57b82b['interface'],'paused':_0x57b82b[_0x331b('0xad')]||![],'penalty':_0x1beb6['body'][_0x331b('0xa4')]||0x0});}return BPromise[_0x331b('0xae')](_0x1e5532,function(_0x43e73f){return db[_0x331b('0xaf')][_0x331b('0xb0')](_0x43e73f);});}return _0x42f417;});}})[_0x331b('0x20')](respondWithStatusCode(_0x53d571,null))[_0x331b('0x2a')](handleError(_0x53d571,null));};exports[_0x331b('0xb1')]=function(_0x3cba42,_0x45d53f,_0x5efdc3){var _0x3e7599;return db[_0x331b('0x44')][_0x331b('0x3e')]({'where':{'id':_0x3cba42['params']['id']},'attributes':['id',_0x331b('0x42'),_0x331b('0x3d')]})[_0x331b('0x20')](handleEntityNotFound(_0x45d53f,null))['then'](function(_0x267faf){if(_0x267faf){_0x3e7599=_0x267faf;if(!_0x3cba42[_0x331b('0x4a')][_0x331b('0x9c')]||!utils[_0x331b('0xa0')](_0x3cba42[_0x331b('0x4a')]['channel'])){throw new db[(_0x331b('0x1c'))][(_0x331b('0x1d'))](_0x331b('0xa1'));}return _0x267faf[_0x331b('0xb2')+_['capitalize'](_0x3cba42[_0x331b('0x4a')][_0x331b('0x9c')][_0x331b('0xa3')]())+'Queues'](_0x3cba42[_0x331b('0x4a')][_0x331b('0x66')]);}})[_0x331b('0x20')](function(_0x4bb293){for(var _0x531414=0x0;_0x531414<_0x3cba42[_0x331b('0x4a')][_0x331b('0x66')][_0x331b('0x4e')];_0x531414+=0x1){var _0x2552d6={'UserId':_0x3cba42[_0x331b('0x5d')]['id']};_0x2552d6[_[_0x331b('0xa6')](_0x3cba42[_0x331b('0x4a')]['channel'][_0x331b('0xa3')]())+'QueueId']=_0x3cba42['query'][_0x331b('0x66')][_0x531414];socket[_0x331b('0xb3')](_0x331b('0x89')+_[_0x331b('0xa6')](_0x3cba42['query'][_0x331b('0x9c')][_0x331b('0xa3')]())+'Queue:remove',_0x2552d6);}return _0x4bb293;})['then'](function(){if(_0x3cba42[_0x331b('0x4a')][_0x331b('0x9c')]==='voice'){return db[_0x331b('0xaf')][_0x331b('0x40')]({'where':{'UserId':_0x3cba42[_0x331b('0x5d')]['id'],'VoiceQueueId':_0x3cba42[_0x331b('0x4a')][_0x331b('0x66')]},'individualHooks':!![]})[_0x331b('0x20')](function(){return _0x3e7599;});}return _0x3e7599;})['then'](respondWithStatusCode(_0x45d53f,null))[_0x331b('0x2a')](handleError(_0x45d53f,null));};exports['addAvatar']=function(_0x1d18f0,_0x402b07,_0x80ac8f){_0x1d18f0['body'][_0x331b('0xb4')]=_0x1d18f0[_0x331b('0xb5')][_0x331b('0xb6')];return db[_0x331b('0x44')][_0x331b('0x3e')]({'where':{'id':_0x1d18f0[_0x331b('0x5d')]['id']}})[_0x331b('0x20')](handleEntityNotFound(_0x402b07,null))['then'](saveUpdates(_0x1d18f0[_0x331b('0x63')],null))[_0x331b('0x20')](respondWithResult(_0x402b07,null))[_0x331b('0x2a')](handleError(_0x402b07,null));};exports[_0x331b('0xb7')]=function(_0x47754a,_0x1801ab,_0x51ff12){var _0x11ac5d=path['join'](config[_0x331b('0xb8')],_0x331b('0xb9'));return db[_0x331b('0x44')][_0x331b('0x3e')]({'where':{'id':_0x47754a[_0x331b('0x5d')]['id']},'attributes':['id',_0x331b('0xb4')],'raw':!![]})['then'](handleEntityNotFound(_0x1801ab,null))[_0x331b('0x20')](function(_0x164be5){if(_0x164be5){if(_[_0x331b('0x6b')](_0x164be5[_0x331b('0xb4')])){return _0x1801ab[_0x331b('0xba')](_0x11ac5d);}else{if(!fs[_0x331b('0xbb')](path[_0x331b('0xbc')](config[_0x331b('0xb8')],_0x331b('0xbd'),_0x164be5['userpic']))){return _0x1801ab['download'](_0x11ac5d);}return _0x1801ab['download'](path[_0x331b('0xbc')](config[_0x331b('0xb8')],_0x331b('0xbd'),_0x164be5[_0x331b('0xb4')]));}}})[_0x331b('0x2a')](handleError(_0x1801ab,null));};exports['getContacts']=function(_0x33f6b1,_0x3d843f,_0x4dd254){var _0xea38f={};var _0x3f004e={};var _0x39dd30;var _0x4fd454;return db[_0x331b('0x44')][_0x331b('0x92')]({'where':{'id':_0x33f6b1[_0x331b('0x5d')]['id']}})[_0x331b('0x20')](handleEntityNotFound(_0x3d843f,null))[_0x331b('0x20')](function(_0x2c6beb){if(_0x2c6beb){_0x39dd30=_0x2c6beb;_0x3f004e['model']=_['keys'](db[_0x331b('0xbe')][_0x331b('0x5e')]);_0x3f004e[_0x331b('0x4a')]=_[_0x331b('0x60')](_0x33f6b1['query']);_0x3f004e[_0x331b('0x4b')]=_[_0x331b('0x4c')](_0x3f004e[_0x331b('0x47')],_0x3f004e[_0x331b('0x4a')]);_0xea38f[_0x331b('0x4d')]=_[_0x331b('0x4c')](_0x3f004e[_0x331b('0x47')],qs[_0x331b('0x61')](_0x33f6b1['query'][_0x331b('0x61')]));_0xea38f['attributes']=_0xea38f[_0x331b('0x4d')][_0x331b('0x4e')]?_0xea38f[_0x331b('0x4d')]:_0x3f004e[_0x331b('0x47')];_0xea38f[_0x331b('0x4f')]=qs[_0x331b('0x50')](_0x33f6b1[_0x331b('0x4a')][_0x331b('0x50')]);_0xea38f[_0x331b('0x51')]=qs[_0x331b('0x4b')](_[_0x331b('0x52')](_0x33f6b1['query'],_0x3f004e['filters']));if(_0x33f6b1[_0x331b('0x4a')][_0x331b('0x57')]){_0xea38f[_0x331b('0x51')]=_[_0x331b('0x53')](_0xea38f[_0x331b('0x51')],{'$or':_[_0x331b('0x43')](_0xea38f[_0x331b('0x4d')],function(_0x2e71bd){var _0x1fbe88={};_0x1fbe88[_0x2e71bd]={'$like':'%'+_0x33f6b1[_0x331b('0x4a')][_0x331b('0x57')]+'%'};return _0x1fbe88;})});}_0xea38f=_[_0x331b('0x53')]({},_0xea38f,_0x33f6b1[_0x331b('0x58')]);return _0x39dd30[_0x331b('0xbf')](_0xea38f);}})[_0x331b('0x20')](function(_0x454e3e){if(_0x454e3e){_0x4fd454=_0x454e3e[_0x331b('0x4e')];if(_0x33f6b1[_0x331b('0x4a')][_0x331b('0xc0')](_0x331b('0x5a'))){_0xea38f[_0x331b('0x5b')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0x331b('0xc1')],'as':_0x331b('0xc2'),'attributes':['id',_0x331b('0x42'),'color'],'where':_0x33f6b1['query'][_0x331b('0xc3')]?{'id':_0x33f6b1[_0x331b('0x4a')][_0x331b('0xc3')]}:undefined,'required':_0x33f6b1[_0x331b('0x4a')][_0x331b('0xc3')]?!![]:![]}];}if(!_0x33f6b1[_0x331b('0x4a')]['hasOwnProperty'](_0x331b('0xc4'))){_0xea38f['limit']=qs['limit'](_0x33f6b1[_0x331b('0x4a')][_0x331b('0x30')]);_0xea38f['offset']=qs[_0x331b('0x2f')](_0x33f6b1[_0x331b('0x4a')][_0x331b('0x2f')]);}return _0x39dd30[_0x331b('0xbf')](_0xea38f);}})[_0x331b('0x20')](function(_0x4a7c5a){if(_0x4a7c5a){return _0x4a7c5a?{'count':_0x4fd454,'rows':_0x4a7c5a}:null;}})[_0x331b('0x20')](respondWithResult(_0x3d843f,null))[_0x331b('0x2a')](handleError(_0x3d843f,null));};exports['getQueues']=function(_0x252385,_0x4c1463,_0x1a5954){var _0x23cc85;var _0x2754cc;var _0x4e6ac8={};var _0x5c9eed;return db[_0x331b('0x44')][_0x331b('0x92')]({'where':{'id':_0x252385[_0x331b('0x5d')]['id']},'attributes':['id',_0x331b('0x42'),_0x331b('0x3d')]})[_0x331b('0x20')](handleEntityNotFound(_0x4c1463,null))[_0x331b('0x20')](function(_0x18286f){if(!utils[_0x331b('0xa0')](_0x252385['query'][_0x331b('0x9c')])){throw new db[(_0x331b('0x1c'))][(_0x331b('0x1d'))](_0x331b('0xa1'));}_0x23cc85=_0x18286f;var _0xb5b650={};_0xb5b650[_0x331b('0x47')]=_[_0x331b('0x60')](db[_[_0x331b('0xa6')](_0x252385['query']['channel'])+_0x331b('0xc5')]['rawAttributes']);_0xb5b650[_0x331b('0x4a')]=_['keys'](_0x252385['query']);_0xb5b650[_0x331b('0x4b')]=_['intersection'](_0xb5b650['model'],_0xb5b650[_0x331b('0x4a')]);_0x4e6ac8[_0x331b('0x4d')]=_[_0x331b('0x4c')](_0xb5b650[_0x331b('0x47')],qs[_0x331b('0x61')](_0x252385[_0x331b('0x4a')][_0x331b('0x61')]));_0x4e6ac8[_0x331b('0x4d')]=_0x4e6ac8[_0x331b('0x4d')]['length']?_0x4e6ac8[_0x331b('0x4d')]:_0xb5b650[_0x331b('0x47')];_0x4e6ac8[_0x331b('0x4f')]=qs[_0x331b('0x50')](_0x252385[_0x331b('0x4a')][_0x331b('0x50')]);_0x4e6ac8[_0x331b('0x51')]=qs['filters'](_[_0x331b('0x52')](_0x252385[_0x331b('0x4a')],_0xb5b650[_0x331b('0x4b')]));if(_0x252385[_0x331b('0x4a')][_0x331b('0x57')]){_0x4e6ac8[_0x331b('0x51')]=_['merge'](_0x4e6ac8[_0x331b('0x51')],{'$or':_[_0x331b('0x43')](_0x4e6ac8[_0x331b('0x4d')],function(_0x441ecb){var _0x3a4926={};_0x3a4926[_0x441ecb]={'$like':'%'+_0x252385['query'][_0x331b('0x57')]+'%'};return _0x3a4926;})});}_0x4e6ac8=_[_0x331b('0x53')]({},_0x4e6ac8,_0x252385[_0x331b('0x58')]);switch(_0x23cc85[_0x331b('0x3d')]){case _0x331b('0x98'):return db[_[_0x331b('0xa6')](_0x252385[_0x331b('0x4a')][_0x331b('0x9c')])+_0x331b('0xc5')][_0x331b('0xab')](_0x4e6ac8);case'user':case _0x331b('0x37'):return _0x23cc85[_0x331b('0x8a')+_[_0x331b('0xa6')](_0x252385['query'][_0x331b('0x9c')])+_0x331b('0xc6')](_0x4e6ac8);default:throw new db[(_0x331b('0x1c'))][(_0x331b('0x1d'))]('Unknown\x20role');}})[_0x331b('0x20')](function(_0x49eb96){_0x5c9eed=_0x49eb96['length'];if(!_0x252385[_0x331b('0x4a')][_0x331b('0xc0')](_0x331b('0xc4'))){_0x4e6ac8[_0x331b('0x30')]=qs[_0x331b('0x30')](_0x252385['query'][_0x331b('0x30')]);_0x4e6ac8[_0x331b('0x2f')]=qs[_0x331b('0x2f')](_0x252385['query']['offset']);}switch(_0x23cc85['role']){case'admin':return db[_['capitalize'](_0x252385['query'][_0x331b('0x9c')])+_0x331b('0xc5')]['findAll'](_0x4e6ac8);case'user':case _0x331b('0x37'):return _0x23cc85[_0x331b('0x8a')+_['capitalize'](_0x252385[_0x331b('0x4a')][_0x331b('0x9c')])+_0x331b('0xc6')](_0x4e6ac8);}})[_0x331b('0x20')](function(_0x5bb514){return{'count':_0x5c9eed,'rows':_0x5bb514};})[_0x331b('0x20')](respondWithResult(_0x4c1463,null))['catch'](handleError(_0x4c1463,null));};exports[_0x331b('0xc7')]=function(_0x3a3c26,_0x3c5130,_0x10a699){var _0x1ebddd={};var _0x53efd1={};var _0x215489;var _0x214f4c;return db['User'][_0x331b('0x92')]({'where':{'id':_0x3a3c26[_0x331b('0x5d')]['id']}})[_0x331b('0x20')](handleEntityNotFound(_0x3c5130,null))[_0x331b('0x20')](function(_0x26c223){if(_0x26c223){_0x215489=_0x26c223;_0x53efd1[_0x331b('0x47')]=_['keys'](db[_0x331b('0xaf')]['rawAttributes']);_0x53efd1[_0x331b('0x4a')]=_[_0x331b('0x60')](_0x3a3c26['query']);_0x53efd1[_0x331b('0x4b')]=_[_0x331b('0x4c')](_0x53efd1['model'],_0x53efd1['query']);_0x1ebddd[_0x331b('0x4d')]=_[_0x331b('0x4c')](_0x53efd1['model'],qs[_0x331b('0x61')](_0x3a3c26[_0x331b('0x4a')][_0x331b('0x61')]));_0x1ebddd[_0x331b('0x4d')]=_0x1ebddd[_0x331b('0x4d')][_0x331b('0x4e')]?_0x1ebddd[_0x331b('0x4d')]:_0x53efd1[_0x331b('0x47')];_0x1ebddd[_0x331b('0x4f')]=qs['sort'](_0x3a3c26['query'][_0x331b('0x50')]);_0x1ebddd[_0x331b('0x51')]=qs['filters'](_[_0x331b('0x52')](_0x3a3c26[_0x331b('0x4a')],_0x53efd1['filters']));if(_0x3a3c26[_0x331b('0x4a')][_0x331b('0x57')]){_0x1ebddd[_0x331b('0x51')]=_[_0x331b('0x53')](_0x1ebddd[_0x331b('0x51')],{'$or':_[_0x331b('0x43')](_0x1ebddd[_0x331b('0x4d')],function(_0x1b207a){var _0x3a27df={};_0x3a27df[_0x1b207a]={'$like':'%'+_0x3a3c26[_0x331b('0x4a')]['filter']+'%'};return _0x3a27df;})});}_0x1ebddd=_[_0x331b('0x53')]({},_0x1ebddd,_0x3a3c26[_0x331b('0x58')]);return _0x215489['getVoiceQueuesRt'](_0x1ebddd);}})['then'](function(_0x1f7ff4){if(_0x1f7ff4){_0x214f4c=_0x1f7ff4[_0x331b('0x4e')];if(!_0x3a3c26[_0x331b('0x4a')][_0x331b('0xc0')](_0x331b('0xc4'))){_0x1ebddd[_0x331b('0x30')]=qs[_0x331b('0x30')](_0x3a3c26['query'][_0x331b('0x30')]);_0x1ebddd['offset']=qs['offset'](_0x3a3c26[_0x331b('0x4a')]['offset']);}return _0x215489['getVoiceQueuesRt'](_0x1ebddd);}})[_0x331b('0x20')](function(_0x2057ea){if(_0x2057ea){return _0x2057ea?{'count':_0x214f4c,'rows':_0x2057ea}:null;}})[_0x331b('0x20')](respondWithResult(_0x3c5130,null))['catch'](handleError(_0x3c5130,null));};exports[_0x331b('0xc8')]=function(_0x23c5f1,_0x2ba786,_0xfd348a){var _0x159e2e={};var _0x1b380d={};var _0x5e8c22;var _0x2d4641;return db[_0x331b('0x44')][_0x331b('0x92')]({'where':{'id':_0x23c5f1['params']['id']}})[_0x331b('0x20')](handleEntityNotFound(_0x2ba786,null))[_0x331b('0x20')](function(_0x5a3bd8){if(_0x5a3bd8){_0x5e8c22=_0x5a3bd8;_0x1b380d[_0x331b('0x47')]=_['keys'](db[_0x331b('0xc9')][_0x331b('0x5e')]);_0x1b380d['query']=_[_0x331b('0x60')](_0x23c5f1[_0x331b('0x4a')]);_0x1b380d['filters']=_['intersection'](_0x1b380d[_0x331b('0x47')],_0x1b380d[_0x331b('0x4a')]);_0x159e2e[_0x331b('0x4d')]=_[_0x331b('0x4c')](_0x1b380d[_0x331b('0x47')],qs[_0x331b('0x61')](_0x23c5f1[_0x331b('0x4a')][_0x331b('0x61')]));_0x159e2e['attributes']=_0x159e2e[_0x331b('0x4d')][_0x331b('0x4e')]?_0x159e2e[_0x331b('0x4d')]:_0x1b380d[_0x331b('0x47')];_0x159e2e[_0x331b('0x4f')]=qs['sort'](_0x23c5f1['query']['sort']);_0x159e2e['where']=qs[_0x331b('0x4b')](_[_0x331b('0x52')](_0x23c5f1['query'],_0x1b380d[_0x331b('0x4b')]));if(_0x23c5f1[_0x331b('0x4a')][_0x331b('0x57')]){_0x159e2e['where']=_[_0x331b('0x53')](_0x159e2e[_0x331b('0x51')],{'$or':_[_0x331b('0x43')](_0x159e2e[_0x331b('0x4d')],function(_0x201983){var _0x4a1dc4={};_0x4a1dc4[_0x201983]={'$like':'%'+_0x23c5f1[_0x331b('0x4a')]['filter']+'%'};return _0x4a1dc4;})});}_0x159e2e=_[_0x331b('0x53')]({},_0x159e2e,_0x23c5f1['options']);return _0x5e8c22[_0x331b('0xc8')](_0x159e2e);}})['then'](function(_0x3338ae){if(_0x3338ae){_0x2d4641=_0x3338ae[_0x331b('0x4e')];if(!_0x23c5f1[_0x331b('0x4a')][_0x331b('0xc0')]('nolimit')){_0x159e2e['limit']=qs['limit'](_0x23c5f1[_0x331b('0x4a')]['limit']);_0x159e2e[_0x331b('0x2f')]=qs[_0x331b('0x2f')](_0x23c5f1['query'][_0x331b('0x2f')]);}return _0x5e8c22[_0x331b('0xc8')](_0x159e2e);}})['then'](function(_0x53271f){if(_0x53271f){return _0x53271f?{'count':_0x2d4641,'rows':_0x53271f}:null;}})[_0x331b('0x20')](respondWithResult(_0x2ba786,null))[_0x331b('0x2a')](handleError(_0x2ba786,null));};exports[_0x331b('0xca')]=function(_0x687f9c,_0x46c90a,_0x469d3d){var _0x17fa16={'raw':!![],'where':{}};var _0x278158={};var _0x47f7f4={'count':0x0,'rows':[]};return db[_0x331b('0x44')]['findOne']({'where':{'id':_0x687f9c[_0x331b('0x5d')]['id']}})[_0x331b('0x20')](handleEntityNotFound(_0x46c90a,null))['then'](function(_0x15a3b9){if(_0x15a3b9){_0x278158[_0x331b('0x47')]=_[_0x331b('0x60')](db['VoiceRecording'][_0x331b('0x5e')]);_0x278158['query']=_[_0x331b('0x60')](_0x687f9c[_0x331b('0x4a')]);_0x278158[_0x331b('0x4b')]=_['intersection'](_0x278158[_0x331b('0x47')],_0x278158['query']);_0x17fa16['attributes']=_[_0x331b('0x4c')](_0x278158[_0x331b('0x47')],qs[_0x331b('0x61')](_0x687f9c[_0x331b('0x4a')][_0x331b('0x61')]));_0x17fa16['attributes']=_0x17fa16[_0x331b('0x4d')][_0x331b('0x4e')]?_0x17fa16[_0x331b('0x4d')]:_0x278158[_0x331b('0x47')];if(!_0x687f9c[_0x331b('0x4a')][_0x331b('0xc0')](_0x331b('0xc4'))){_0x17fa16[_0x331b('0x30')]=qs[_0x331b('0x30')](_0x687f9c[_0x331b('0x4a')][_0x331b('0x30')]);_0x17fa16[_0x331b('0x2f')]=qs['offset'](_0x687f9c[_0x331b('0x4a')][_0x331b('0x2f')]);}_0x17fa16[_0x331b('0x4f')]=qs[_0x331b('0x50')](_0x687f9c[_0x331b('0x4a')][_0x331b('0x50')]);_0x17fa16['where']=qs[_0x331b('0x4b')](_[_0x331b('0x52')](_0x687f9c[_0x331b('0x4a')],_0x278158[_0x331b('0x4b')]));_0x17fa16[_0x331b('0x51')][_0x331b('0xcb')]=_0x15a3b9['id'];if(_0x687f9c[_0x331b('0x4a')][_0x331b('0x57')]){_0x17fa16[_0x331b('0x51')]=_[_0x331b('0x53')](_0x17fa16[_0x331b('0x51')],{'$or':_[_0x331b('0x43')](_0x17fa16['attributes'],function(_0x3fe163){var _0x32259e={};_0x32259e[_0x3fe163]={'$like':'%'+_0x687f9c[_0x331b('0x4a')][_0x331b('0x57')]+'%'};return _0x32259e;})});}_0x17fa16=_['merge']({},_0x17fa16,_0x687f9c['options']);return db[_0x331b('0xcc')][_0x331b('0x59')]({'where':_0x17fa16[_0x331b('0x51')]})['then'](function(_0x6d00cb){_0x47f7f4[_0x331b('0x59')]=_0x6d00cb;if(_0x687f9c[_0x331b('0x4a')][_0x331b('0x5a')]){_0x17fa16[_0x331b('0x5b')]=[{'all':!![]}];}return db[_0x331b('0xcc')][_0x331b('0xab')](_0x17fa16);})[_0x331b('0x20')](function(_0xda6493){_0x47f7f4[_0x331b('0xcd')]=_0xda6493;return _0x47f7f4;});}})['then'](respondWithFilteredResult(_0x46c90a,_0x17fa16))[_0x331b('0x2a')](handleError(_0x46c90a,null));};exports[_0x331b('0xce')]=function(_0x4076da,_0xaef5ef,_0x3864ba){var _0x3d5a94={'raw':!![],'where':{}};var _0x4dce7b={};var _0x15f972={'count':0x0,'rows':[]};return db[_0x331b('0x44')]['findOne']({'where':{'id':_0x4076da[_0x331b('0x5d')]['id']}})['then'](handleEntityNotFound(_0xaef5ef,null))[_0x331b('0x20')](function(_0x29a91c){if(_0x29a91c){_0x4dce7b[_0x331b('0x47')]=_[_0x331b('0x60')](db[_0x331b('0xcf')][_0x331b('0x5e')]);_0x4dce7b[_0x331b('0x4a')]=_['keys'](_0x4076da[_0x331b('0x4a')]);_0x4dce7b[_0x331b('0x4b')]=_[_0x331b('0x4c')](_0x4dce7b[_0x331b('0x47')],_0x4dce7b['query']);_0x3d5a94[_0x331b('0x4d')]=_[_0x331b('0x4c')](_0x4dce7b['model'],qs[_0x331b('0x61')](_0x4076da[_0x331b('0x4a')][_0x331b('0x61')]));_0x3d5a94[_0x331b('0x4d')]=_0x3d5a94['attributes'][_0x331b('0x4e')]?_0x3d5a94['attributes']:_0x4dce7b[_0x331b('0x47')];if(!_0x4076da[_0x331b('0x4a')][_0x331b('0xc0')](_0x331b('0xc4'))){_0x3d5a94['limit']=qs[_0x331b('0x30')](_0x4076da['query'][_0x331b('0x30')]);_0x3d5a94[_0x331b('0x2f')]=qs[_0x331b('0x2f')](_0x4076da[_0x331b('0x4a')][_0x331b('0x2f')]);}_0x3d5a94[_0x331b('0x4f')]=qs[_0x331b('0x50')](_0x4076da[_0x331b('0x4a')][_0x331b('0x50')]);_0x3d5a94[_0x331b('0x51')]=qs[_0x331b('0x4b')](_[_0x331b('0x52')](_0x4076da[_0x331b('0x4a')],_0x4dce7b[_0x331b('0x4b')]));_0x3d5a94[_0x331b('0x51')]['UserId']=_0x29a91c['id'];if(_0x4076da['query'][_0x331b('0x57')]){_0x3d5a94['where']=_[_0x331b('0x53')](_0x3d5a94[_0x331b('0x51')],{'$or':_[_0x331b('0x43')](_0x3d5a94['attributes'],function(_0x354aaa){var _0x59ebbc={};_0x59ebbc[_0x354aaa]={'$like':'%'+_0x4076da[_0x331b('0x4a')]['filter']+'%'};return _0x59ebbc;})});}_0x3d5a94=_[_0x331b('0x53')]({},_0x3d5a94,_0x4076da[_0x331b('0x58')]);return db['ScreenRecording'][_0x331b('0x59')]({'where':_0x3d5a94['where']})['then'](function(_0x5d37f4){_0x15f972[_0x331b('0x59')]=_0x5d37f4;if(_0x4076da['query']['includeAll']){_0x3d5a94['include']=[{'all':!![]}];}return db[_0x331b('0xcf')][_0x331b('0xab')](_0x3d5a94);})[_0x331b('0x20')](function(_0x390cb6){_0x15f972[_0x331b('0xcd')]=_0x390cb6;return _0x15f972;});}})[_0x331b('0x20')](respondWithFilteredResult(_0xaef5ef,_0x3d5a94))['catch'](handleError(_0xaef5ef,null));};exports['getChatInteractions']=function(_0x43e239,_0x88fe40,_0x566a0e){var _0x2134d5={};var _0x46b139={};var _0x4ebaac;var _0x5348ff;return db[_0x331b('0x44')][_0x331b('0x92')]({'where':{'id':_0x43e239[_0x331b('0x5d')]['id']}})['then'](handleEntityNotFound(_0x88fe40,null))['then'](function(_0xeff47d){if(_0xeff47d){_0x4ebaac=_0xeff47d;_0x46b139[_0x331b('0x47')]=_[_0x331b('0x60')](db['ChatInteraction'][_0x331b('0x5e')]);_0x46b139[_0x331b('0x4a')]=_['keys'](_0x43e239[_0x331b('0x4a')]);_0x46b139[_0x331b('0x4b')]=_[_0x331b('0x4c')](_0x46b139[_0x331b('0x47')],_0x46b139[_0x331b('0x4a')]);_0x2134d5[_0x331b('0x4d')]=_[_0x331b('0x4c')](_0x46b139[_0x331b('0x47')],qs[_0x331b('0x61')](_0x43e239[_0x331b('0x4a')][_0x331b('0x61')]));_0x2134d5[_0x331b('0x4d')]=_0x2134d5['attributes'][_0x331b('0x4e')]?_0x2134d5[_0x331b('0x4d')]:_0x46b139['model'];_0x2134d5[_0x331b('0x4f')]=qs['sort'](_0x43e239[_0x331b('0x4a')][_0x331b('0x50')]);_0x2134d5[_0x331b('0x51')]=qs['filters'](_[_0x331b('0x52')](_0x43e239[_0x331b('0x4a')],_0x46b139[_0x331b('0x4b')]));if(_0x43e239['query'][_0x331b('0x57')]){_0x2134d5[_0x331b('0x51')]=_[_0x331b('0x53')](_0x2134d5[_0x331b('0x51')],{'$or':_[_0x331b('0x43')](_0x2134d5[_0x331b('0x4d')],function(_0x3412bb){var _0x5f2a9b={};_0x5f2a9b[_0x3412bb]={'$like':'%'+_0x43e239['query'][_0x331b('0x57')]+'%'};return _0x5f2a9b;})});}_0x2134d5=_[_0x331b('0x53')]({},_0x2134d5,_0x43e239[_0x331b('0x58')]);return _0x4ebaac[_0x331b('0xd0')](_0x2134d5);}})[_0x331b('0x20')](function(_0x3d7c7f){if(_0x3d7c7f){_0x5348ff=_0x3d7c7f[_0x331b('0x4e')];if(!_0x43e239[_0x331b('0x4a')]['hasOwnProperty']('nolimit')){_0x2134d5[_0x331b('0x30')]=qs[_0x331b('0x30')](_0x43e239[_0x331b('0x4a')][_0x331b('0x30')]);_0x2134d5['offset']=qs[_0x331b('0x2f')](_0x43e239[_0x331b('0x4a')][_0x331b('0x2f')]);}return _0x4ebaac[_0x331b('0xd0')](_0x2134d5);}})[_0x331b('0x20')](function(_0x5a08a7){if(_0x5a08a7){return _0x5a08a7?{'count':_0x5348ff,'rows':_0x5a08a7}:null;}})[_0x331b('0x20')](respondWithResult(_0x88fe40,null))[_0x331b('0x2a')](handleError(_0x88fe40,null));};exports[_0x331b('0xd1')]=function(_0x2f4dbc,_0x31c768,_0x447dd4){var _0x2d8af5={};var _0x1b8876={};var _0x4acd4d;var _0x153918;return db[_0x331b('0x44')][_0x331b('0x92')]({'where':{'id':_0x2f4dbc[_0x331b('0x5d')]['id']}})[_0x331b('0x20')](handleEntityNotFound(_0x31c768,null))[_0x331b('0x20')](function(_0x1b1f10){if(_0x1b1f10){_0x4acd4d=_0x1b1f10;_0x1b8876['model']=_[_0x331b('0x60')](db[_0x331b('0xd2')][_0x331b('0x5e')]);_0x1b8876['query']=_[_0x331b('0x60')](_0x2f4dbc[_0x331b('0x4a')]);_0x1b8876[_0x331b('0x4b')]=_[_0x331b('0x4c')](_0x1b8876[_0x331b('0x47')],_0x1b8876['query']);_0x2d8af5[_0x331b('0x4d')]=_[_0x331b('0x4c')](_0x1b8876[_0x331b('0x47')],qs['fields'](_0x2f4dbc[_0x331b('0x4a')][_0x331b('0x61')]));_0x2d8af5['attributes']=_0x2d8af5[_0x331b('0x4d')]['length']?_0x2d8af5[_0x331b('0x4d')]:_0x1b8876[_0x331b('0x47')];_0x2d8af5['order']=qs['sort'](_0x2f4dbc[_0x331b('0x4a')][_0x331b('0x50')]);_0x2d8af5[_0x331b('0x51')]=qs[_0x331b('0x4b')](_[_0x331b('0x52')](_0x2f4dbc[_0x331b('0x4a')],_0x1b8876['filters']));if(_0x2f4dbc['query'][_0x331b('0x57')]){_0x2d8af5['where']=_['merge'](_0x2d8af5[_0x331b('0x51')],{'$or':_['map'](_0x2d8af5[_0x331b('0x4d')],function(_0x173e8c){var _0x361b7c={};_0x361b7c[_0x173e8c]={'$like':'%'+_0x2f4dbc[_0x331b('0x4a')][_0x331b('0x57')]+'%'};return _0x361b7c;})});}_0x2d8af5=_['merge']({},_0x2d8af5,_0x2f4dbc[_0x331b('0x58')]);return _0x4acd4d[_0x331b('0xd1')](_0x2d8af5);}})[_0x331b('0x20')](function(_0x424c2b){if(_0x424c2b){_0x153918=_0x424c2b[_0x331b('0x4e')];if(!_0x2f4dbc['query'][_0x331b('0xc0')](_0x331b('0xc4'))){_0x2d8af5[_0x331b('0x30')]=qs[_0x331b('0x30')](_0x2f4dbc[_0x331b('0x4a')]['limit']);_0x2d8af5['offset']=qs['offset'](_0x2f4dbc[_0x331b('0x4a')][_0x331b('0x2f')]);}return _0x4acd4d[_0x331b('0xd1')](_0x2d8af5);}})[_0x331b('0x20')](function(_0x40d2d4){if(_0x40d2d4){return _0x40d2d4?{'count':_0x153918,'rows':_0x40d2d4}:null;}})[_0x331b('0x20')](respondWithResult(_0x31c768,null))[_0x331b('0x2a')](handleError(_0x31c768,null));};exports['getMailInteractions']=function(_0x3da1dd,_0x23ca3d,_0x114f7f){var _0x2dbf05={'raw':!![],'where':{}};var _0x2c2444={};var _0x156079={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x3da1dd['params']['id']}})[_0x331b('0x20')](handleEntityNotFound(_0x23ca3d,null))['then'](function(_0x5b8c3b){if(_0x5b8c3b){_0x2c2444[_0x331b('0x47')]=_[_0x331b('0x60')](db['MailInteraction'][_0x331b('0x5e')]);_0x2c2444[_0x331b('0x4a')]=_['keys'](_0x3da1dd['query']);_0x2c2444[_0x331b('0x4b')]=_[_0x331b('0x4c')](_0x2c2444[_0x331b('0x47')],_0x2c2444[_0x331b('0x4a')]);_0x2dbf05[_0x331b('0x4d')]=_[_0x331b('0x4c')](_0x2c2444[_0x331b('0x47')],qs[_0x331b('0x61')](_0x3da1dd[_0x331b('0x4a')]['fields']));_0x2dbf05[_0x331b('0x4d')]=_0x2dbf05[_0x331b('0x4d')]['length']?_0x2dbf05['attributes']:_0x2c2444['model'];if(!_0x3da1dd[_0x331b('0x4a')][_0x331b('0xc0')](_0x331b('0xc4'))){_0x2dbf05[_0x331b('0x30')]=qs[_0x331b('0x30')](_0x3da1dd[_0x331b('0x4a')]['limit']);_0x2dbf05[_0x331b('0x2f')]=qs[_0x331b('0x2f')](_0x3da1dd['query'][_0x331b('0x2f')]);}_0x2dbf05[_0x331b('0x4f')]=qs['sort'](_0x3da1dd[_0x331b('0x4a')][_0x331b('0x50')]);_0x2dbf05[_0x331b('0x51')]=qs[_0x331b('0x4b')](_['pick'](_0x3da1dd['query'],_0x2c2444[_0x331b('0x4b')]));_0x2dbf05[_0x331b('0x51')][_0x331b('0xcb')]=_0x5b8c3b['id'];if(_0x3da1dd[_0x331b('0x4a')][_0x331b('0x57')]){_0x2dbf05[_0x331b('0x51')]=_[_0x331b('0x53')](_0x2dbf05[_0x331b('0x51')],{'$or':_[_0x331b('0x43')](_0x2dbf05[_0x331b('0x4d')],function(_0x4d6421){var _0x3ff7a2={};_0x3ff7a2[_0x4d6421]={'$like':'%'+_0x3da1dd[_0x331b('0x4a')]['filter']+'%'};return _0x3ff7a2;})});}_0x2dbf05=_['merge']({},_0x2dbf05,_0x3da1dd[_0x331b('0x58')]);return db[_0x331b('0xd3')]['count']({'where':_0x2dbf05[_0x331b('0x51')]})[_0x331b('0x20')](function(_0x483113){_0x156079['count']=_0x483113;if(_0x3da1dd['query'][_0x331b('0x5a')]){_0x2dbf05[_0x331b('0x5b')]=[{'all':!![]}];}return db['MailInteraction'][_0x331b('0xab')](_0x2dbf05);})[_0x331b('0x20')](function(_0x3106ee){_0x156079[_0x331b('0xcd')]=_0x3106ee;return _0x156079;});}})[_0x331b('0x20')](respondWithFilteredResult(_0x23ca3d,_0x2dbf05))[_0x331b('0x2a')](handleError(_0x23ca3d,null));};exports['getSmsInteractions']=function(_0x100c83,_0x836586,_0x17c045){var _0x171ae5={};var _0x103668={};var _0x297bbb;var _0x51739a;return db[_0x331b('0x44')][_0x331b('0x92')]({'where':{'id':_0x100c83[_0x331b('0x5d')]['id']}})[_0x331b('0x20')](handleEntityNotFound(_0x836586,null))['then'](function(_0x3f4417){if(_0x3f4417){_0x297bbb=_0x3f4417;_0x103668[_0x331b('0x47')]=_['keys'](db['SmsInteraction'][_0x331b('0x5e')]);_0x103668[_0x331b('0x4a')]=_[_0x331b('0x60')](_0x100c83[_0x331b('0x4a')]);_0x103668[_0x331b('0x4b')]=_[_0x331b('0x4c')](_0x103668[_0x331b('0x47')],_0x103668[_0x331b('0x4a')]);_0x171ae5[_0x331b('0x4d')]=_['intersection'](_0x103668[_0x331b('0x47')],qs[_0x331b('0x61')](_0x100c83['query'][_0x331b('0x61')]));_0x171ae5[_0x331b('0x4d')]=_0x171ae5[_0x331b('0x4d')][_0x331b('0x4e')]?_0x171ae5['attributes']:_0x103668[_0x331b('0x47')];_0x171ae5[_0x331b('0x4f')]=qs['sort'](_0x100c83['query']['sort']);_0x171ae5[_0x331b('0x51')]=qs['filters'](_['pick'](_0x100c83[_0x331b('0x4a')],_0x103668[_0x331b('0x4b')]));if(_0x100c83[_0x331b('0x4a')][_0x331b('0x57')]){_0x171ae5['where']=_[_0x331b('0x53')](_0x171ae5[_0x331b('0x51')],{'$or':_[_0x331b('0x43')](_0x171ae5[_0x331b('0x4d')],function(_0x322dba){var _0x349968={};_0x349968[_0x322dba]={'$like':'%'+_0x100c83[_0x331b('0x4a')][_0x331b('0x57')]+'%'};return _0x349968;})});}_0x171ae5=_[_0x331b('0x53')]({},_0x171ae5,_0x100c83['options']);return _0x297bbb[_0x331b('0xd4')](_0x171ae5);}})[_0x331b('0x20')](function(_0x4c9016){if(_0x4c9016){_0x51739a=_0x4c9016['length'];if(!_0x100c83[_0x331b('0x4a')][_0x331b('0xc0')](_0x331b('0xc4'))){_0x171ae5[_0x331b('0x30')]=qs['limit'](_0x100c83[_0x331b('0x4a')][_0x331b('0x30')]);_0x171ae5[_0x331b('0x2f')]=qs[_0x331b('0x2f')](_0x100c83['query']['offset']);}return _0x297bbb['getSmsInteractions'](_0x171ae5);}})[_0x331b('0x20')](function(_0xbb0e0d){if(_0xbb0e0d){return _0xbb0e0d?{'count':_0x51739a,'rows':_0xbb0e0d}:null;}})[_0x331b('0x20')](respondWithResult(_0x836586,null))[_0x331b('0x2a')](handleError(_0x836586,null));};exports['getFaxInteractions']=function(_0x5ee50b,_0x1a0f99,_0x1064c1){var _0x5e8118={};var _0x2b8659={};var _0x4076f3;var _0x35bcf9;return db['User']['findOne']({'where':{'id':_0x5ee50b[_0x331b('0x5d')]['id']}})[_0x331b('0x20')](handleEntityNotFound(_0x1a0f99,null))[_0x331b('0x20')](function(_0x25e8a7){if(_0x25e8a7){_0x4076f3=_0x25e8a7;_0x2b8659['model']=_[_0x331b('0x60')](db['FaxInteraction'][_0x331b('0x5e')]);_0x2b8659['query']=_[_0x331b('0x60')](_0x5ee50b['query']);_0x2b8659[_0x331b('0x4b')]=_['intersection'](_0x2b8659[_0x331b('0x47')],_0x2b8659['query']);_0x5e8118[_0x331b('0x4d')]=_['intersection'](_0x2b8659[_0x331b('0x47')],qs[_0x331b('0x61')](_0x5ee50b[_0x331b('0x4a')][_0x331b('0x61')]));_0x5e8118[_0x331b('0x4d')]=_0x5e8118[_0x331b('0x4d')][_0x331b('0x4e')]?_0x5e8118[_0x331b('0x4d')]:_0x2b8659[_0x331b('0x47')];_0x5e8118[_0x331b('0x4f')]=qs[_0x331b('0x50')](_0x5ee50b[_0x331b('0x4a')]['sort']);_0x5e8118['where']=qs[_0x331b('0x4b')](_['pick'](_0x5ee50b['query'],_0x2b8659[_0x331b('0x4b')]));if(_0x5ee50b[_0x331b('0x4a')][_0x331b('0x57')]){_0x5e8118[_0x331b('0x51')]=_['merge'](_0x5e8118['where'],{'$or':_[_0x331b('0x43')](_0x5e8118[_0x331b('0x4d')],function(_0x1cf252){var _0x2fe8dd={};_0x2fe8dd[_0x1cf252]={'$like':'%'+_0x5ee50b[_0x331b('0x4a')]['filter']+'%'};return _0x2fe8dd;})});}_0x5e8118=_['merge']({},_0x5e8118,_0x5ee50b[_0x331b('0x58')]);return _0x4076f3[_0x331b('0xd5')](_0x5e8118);}})['then'](function(_0xf06e9a){if(_0xf06e9a){_0x35bcf9=_0xf06e9a[_0x331b('0x4e')];if(!_0x5ee50b[_0x331b('0x4a')][_0x331b('0xc0')]('nolimit')){_0x5e8118[_0x331b('0x30')]=qs[_0x331b('0x30')](_0x5ee50b[_0x331b('0x4a')]['limit']);_0x5e8118[_0x331b('0x2f')]=qs[_0x331b('0x2f')](_0x5ee50b[_0x331b('0x4a')][_0x331b('0x2f')]);}return _0x4076f3[_0x331b('0xd5')](_0x5e8118);}})['then'](function(_0x5d0c2d){if(_0x5d0c2d){return _0x5d0c2d?{'count':_0x35bcf9,'rows':_0x5d0c2d}:null;}})['then'](respondWithResult(_0x1a0f99,null))[_0x331b('0x2a')](handleError(_0x1a0f99,null));};exports['getWhatsappInteractions']=function(_0x3229ba,_0x178888,_0x212a7c){var _0x6283bf={};var _0x43b1e7={};var _0x4f4c2e;var _0x52e01f;return db[_0x331b('0x44')]['findOne']({'where':{'id':_0x3229ba[_0x331b('0x5d')]['id']}})['then'](handleEntityNotFound(_0x178888,null))[_0x331b('0x20')](function(_0x450a4f){if(_0x450a4f){_0x4f4c2e=_0x450a4f;_0x43b1e7['model']=_[_0x331b('0x60')](db[_0x331b('0xd6')][_0x331b('0x5e')]);_0x43b1e7[_0x331b('0x4a')]=_['keys'](_0x3229ba[_0x331b('0x4a')]);_0x43b1e7[_0x331b('0x4b')]=_[_0x331b('0x4c')](_0x43b1e7[_0x331b('0x47')],_0x43b1e7['query']);_0x6283bf['attributes']=_[_0x331b('0x4c')](_0x43b1e7[_0x331b('0x47')],qs['fields'](_0x3229ba['query'][_0x331b('0x61')]));_0x6283bf[_0x331b('0x4d')]=_0x6283bf[_0x331b('0x4d')][_0x331b('0x4e')]?_0x6283bf[_0x331b('0x4d')]:_0x43b1e7['model'];_0x6283bf[_0x331b('0x4f')]=qs[_0x331b('0x50')](_0x3229ba[_0x331b('0x4a')][_0x331b('0x50')]);_0x6283bf[_0x331b('0x51')]=qs['filters'](_[_0x331b('0x52')](_0x3229ba['query'],_0x43b1e7[_0x331b('0x4b')]));if(_0x3229ba[_0x331b('0x4a')][_0x331b('0x57')]){_0x6283bf[_0x331b('0x51')]=_[_0x331b('0x53')](_0x6283bf['where'],{'$or':_[_0x331b('0x43')](_0x6283bf[_0x331b('0x4d')],function(_0x46e4f3){var _0x2830c8={};_0x2830c8[_0x46e4f3]={'$like':'%'+_0x3229ba[_0x331b('0x4a')]['filter']+'%'};return _0x2830c8;})});}_0x6283bf=_[_0x331b('0x53')]({},_0x6283bf,_0x3229ba['options']);return _0x4f4c2e[_0x331b('0xd7')](_0x6283bf);}})['then'](function(_0x4ab130){if(_0x4ab130){_0x52e01f=_0x4ab130[_0x331b('0x4e')];if(!_0x3229ba['query'][_0x331b('0xc0')]('nolimit')){_0x6283bf[_0x331b('0x30')]=qs[_0x331b('0x30')](_0x3229ba['query']['limit']);_0x6283bf[_0x331b('0x2f')]=qs[_0x331b('0x2f')](_0x3229ba[_0x331b('0x4a')][_0x331b('0x2f')]);}return _0x4f4c2e[_0x331b('0xd7')](_0x6283bf);}})[_0x331b('0x20')](function(_0x10313c){if(_0x10313c){return _0x10313c?{'count':_0x52e01f,'rows':_0x10313c}:null;}})[_0x331b('0x20')](respondWithResult(_0x178888,null))[_0x331b('0x2a')](handleError(_0x178888,null));};exports['login']=function(_0x2fc148,_0x39ca90,_0x51bc2d){var _0x2928f2;var _0x5327b6;var _0xedfdee;var _0x37f449=!_[_0x331b('0x6b')](_0x2fc148[_0x331b('0x5d')]['id'])?_0x2fc148[_0x331b('0x5d')]['id']:!_[_0x331b('0x6b')](_0x2fc148[_0x331b('0x89')]['id'])?_0x2fc148[_0x331b('0x89')]['id']:null;return db[_0x331b('0x44')][_0x331b('0x3e')]({'where':{'id':_0x37f449,'role':{'$or':[_0x331b('0x98'),_0x331b('0x89'),_0x331b('0x37')]}},'attributes':['id',_0x331b('0x42'),_0x331b('0xd8'),_0x331b('0xd9'),'role',_0x331b('0x70'),_0x331b('0x9e')]})[_0x331b('0x20')](function(_0x1087b0){if(_0x1087b0){if(_0x1087b0[_0x331b('0x3d')]===_0x331b('0x37')){_0x2928f2=_0x1087b0;if(_0x2fc148[_0x331b('0x63')][_0x331b('0x9f')]){_0xedfdee=util['format']('LOCAL/%s@from-sip/n',_0x2928f2[_0x2fc148[_0x331b('0x63')]['interface']]);}else if(_0x2fc148[_0x331b('0x63')][_0x331b('0xda')]){_0xedfdee=util[_0x331b('0x6d')](_0x331b('0xdb'),_0x2fc148[_0x331b('0x63')]['intrf']);}else{_0xedfdee=util[_0x331b('0x6d')]('SIP/%s',_0x2928f2[_0x331b('0x42')]);}socket['to'](util[_0x331b('0x6d')]('user:%s',_0x2928f2[_0x331b('0x42')]))[_0x331b('0xb3')](_0x331b('0xdc'),{'ip':_0x2fc148[_0x331b('0xdd')]['x-forwarded-for']||_0x2fc148[_0x331b('0xde')]['remoteAddress']||_0x2fc148['socket'][_0x331b('0xdf')]||_0x2fc148['connection'][_0x331b('0xe0')][_0x331b('0xdf')]});return db[_0x331b('0xaf')]['destroy']({'where':{'membername':_0x2928f2[_0x331b('0x42')]},'individualHooks':!![]});}}else{throw new db[(_0x331b('0x1c'))][(_0x331b('0x1d'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x2928f2){return _0x2928f2[_0x331b('0xe1')]({'raw':!![]});}})[_0x331b('0x20')](function(_0x10a47d){if(_0x2928f2){var _0xfa6240=[];if(_0x10a47d){_0x5327b6=_0x10a47d;if(_0x5327b6['length']){for(var _0x4139bf=0x0;_0x4139bf<_0x5327b6[_0x331b('0x4e')];_0x4139bf++){_0xfa6240[_0x331b('0xac')]({'membername':_0x2928f2[_0x331b('0x42')],'UserId':_0x2928f2['id'],'queue_name':_0x5327b6[_0x4139bf]['name'],'VoiceQueueId':_0x5327b6[_0x4139bf]['id'],'interface':_0xedfdee,'paused':_0x2928f2['loginInPause']||![],'penalty':_0x5327b6[_0x4139bf][_0x331b('0xe2')]||0x0});}return BPromise[_0x331b('0xae')](_0xfa6240,function(_0x2fd774){return db[_0x331b('0xaf')][_0x331b('0xb0')](_0x2fd774);});}}}})[_0x331b('0x20')](function(){if(_0x2928f2){return db[_0x331b('0xe3')]['findAll']({'where':{'membername':_0x2928f2[_0x331b('0x42')],'exitAt':null}});}})[_0x331b('0x20')](function(_0x51d8f3){if(_0x2928f2){var _0xfad51a=[];_0x51d8f3[_0x331b('0xe4')](function(_0x1b2e2b){_0xfad51a[_0x331b('0xac')](_0x1b2e2b[_0x331b('0x36')]({'exitAt':moment()[_0x331b('0x6d')](_0x331b('0xe5'))}));});return BPromise[_0x331b('0xe6')](_0xfad51a);}})[_0x331b('0x20')](function(){if(_0x2928f2){var _0x2c9d0e=[];var _0x3336a7=[];var _0x31a0e2=utils[_0x331b('0xe7')]();var _0x485d50={'membername':_0x2928f2[_0x331b('0x42')],'interface':_0xedfdee,'enterAt':moment()['format'](_0x331b('0xe5')),'role':_0x2928f2[_0x331b('0x3d')],'internal':_0x2928f2[_0x331b('0x70')]};_0x31a0e2['forEach'](function(_0x4d4818){_0x2c9d0e[_0x331b('0xac')](_[_0x331b('0x53')]({'channel':_0x4d4818,'type':_0x331b('0xe8'),'data1':_0x2fc148[_0x331b('0x63')][_0x331b('0xe9')],'data2':_0xedfdee},_0x485d50));if(_0x2928f2[_0x331b('0x9e')]){_0x3336a7['push'](_[_0x331b('0x53')]({'channel':_0x4d4818,'type':'PAUSE','data1':_0x331b('0xea')},_0x485d50));}});return db[_0x331b('0xe3')][_0x331b('0x62')](_0x2c9d0e[_0x331b('0xeb')](_0x3336a7),{'individualHooks':!![]});}})['then'](function(){if(_0x2928f2){return _0x2928f2[_0x331b('0x36')]({'online':!![],'lastLoginAt':moment()[_0x331b('0x6d')](_0x331b('0xe5')),'voicePause':_0x2928f2['loginInPause']||![],'mailPause':_0x2928f2[_0x331b('0x9e')]||![],'chatPause':_0x2928f2['loginInPause']||![],'faxPause':_0x2928f2[_0x331b('0x9e')]||![],'smsPause':_0x2928f2['loginInPause']||![],'openchannelPause':_0x2928f2[_0x331b('0x9e')]||![],'whatsappPause':_0x2928f2['loginInPause']||![],'pauseType':_0x2928f2[_0x331b('0x9e')]?'LOGININPAUSE':null,'interface':_0xedfdee,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x331b('0x20')](function(_0xf8525e){if(_0x2fc148[_0x331b('0xec')]){return _0x51bc2d();}else{return BPromise[_0x331b('0xed')](_0xf8525e)[_0x331b('0x20')](respondWithResult(_0x39ca90,null));}})[_0x331b('0x2a')](handleError(_0x39ca90,null));};exports[_0x331b('0xee')]=function(_0x96695f,_0xf74c48,_0x1c6566){var _0x32a52a;return db[_0x331b('0x44')]['find']({'where':{'id':_0x96695f['params']['id'],'role':_0x331b('0x37')},'attributes':['id',_0x331b('0x42'),_0x331b('0x3d')]})[_0x331b('0x20')](handleEntityNotFound(_0xf74c48,null))[_0x331b('0x20')](function(_0x288b55){if(_0x288b55){_0x32a52a=_0x288b55;return db[_0x331b('0xaf')][_0x331b('0x40')]({'where':{'membername':_0x32a52a['name']},'individualHooks':!![]});}})[_0x331b('0x20')](function(){return db[_0x331b('0xe3')][_0x331b('0xab')]({'where':{'membername':_0x32a52a[_0x331b('0x42')],'exitAt':null}});})[_0x331b('0x20')](function(_0xe277a0){var _0xa0fd08=[];_0xe277a0[_0x331b('0xe4')](function(_0xfda5aa){_0xa0fd08['push'](_0xfda5aa['update']({'exitAt':moment()['format'](_0x331b('0xe5'))}));});return BPromise[_0x331b('0xe6')](_0xa0fd08);})[_0x331b('0x20')](function(){return _0x32a52a[_0x331b('0x36')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x331b('0x20')](respondWithResult(_0xf74c48,null))[_0x331b('0x2a')](handleError(_0xf74c48,null));};exports[_0x331b('0xef')]=function(_0x2b7134,_0x2e3754,_0x2ce7a4){var _0x45d733;return db['UserVoiceQueueRt'][_0x331b('0x36')]({'paused':0x1},{'where':{'UserId':_0x2b7134[_0x331b('0x5d')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x331b('0x44')][_0x331b('0x3e')]({'where':{'id':_0x2b7134[_0x331b('0x5d')]['id'],'role':_0x331b('0x37')},'attributes':['id',_0x331b('0x42'),'role',_0x331b('0x70'),_0x331b('0x9f')]});})[_0x331b('0x20')](handleEntityNotFound(_0x2e3754,null))[_0x331b('0x20')](function(_0x19bced){if(_0x19bced){_0x45d733=_0x19bced;return respondWithRpcPromise(_0x331b('0xf0'),_0x331b('0xef'),{'id':_0x45d733['id'],'name':_0x45d733[_0x331b('0x42')],'pause':!![]});}})[_0x331b('0x20')](function(){if(_0x45d733){return db[_0x331b('0xe3')][_0x331b('0xab')]({'where':{'membername':_0x45d733[_0x331b('0x42')],'type':_0x331b('0xf1'),'exitAt':null}});}})[_0x331b('0x20')](function(_0x26e511){if(_0x26e511[_0x331b('0x4e')]){var _0x293146=moment()[_0x331b('0x6d')](_0x331b('0xe5'));for(var _0x42ce66=0x0,_0xa626e2=_0x26e511[_0x331b('0x4e')];_0x42ce66<_0xa626e2;_0x42ce66++){_0x26e511[_0x42ce66]['updateAttributes']({'exitAt':_0x293146});}}})[_0x331b('0x20')](function(){var _0xb36993=[];var _0x38c9c0=utils[_0x331b('0xe7')]();_0x38c9c0[_0x331b('0xe4')](function(_0x2fd2b2){_0xb36993[_0x331b('0xac')]({'channel':_0x2fd2b2,'membername':_0x45d733[_0x331b('0x42')],'interface':_[_0x331b('0x6b')](_0x45d733[_0x331b('0x9f')])?util[_0x331b('0x6d')](_0x331b('0xdb'),_0x45d733[_0x331b('0x42')]):_0x45d733['interface'],'type':_0x331b('0xf1'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x2b7134[_0x331b('0x63')][_0x331b('0x45')]||_0x331b('0xf2'),'role':_0x45d733[_0x331b('0x3d')],'internal':_0x45d733[_0x331b('0x70')]});});return db[_0x331b('0xe3')][_0x331b('0x62')](_0xb36993,{'individualHooks':!![]});})[_0x331b('0x20')](function(){return _0x45d733['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2b7134['body']['type']||_0x331b('0xf2'),'lastPauseAt':moment()[_0x331b('0x6d')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x331b('0x20')](respondWithResult(_0x2e3754,null))[_0x331b('0x2a')](handleError(_0x2e3754,null));};exports[_0x331b('0xf3')]=function(_0x4c6b17,_0x5e76a8,_0x2e709f){var _0x2d80f2;return db['User']['find']({'where':{'id':_0x4c6b17['params']['id']},'attributes':['id',_0x331b('0x42'),_0x331b('0x3d'),_0x331b('0xad'),_0x331b('0xf4'),'chatPause',_0x331b('0xf5'),_0x331b('0xf6'),_0x331b('0xf7'),_0x331b('0xf8'),_0x331b('0xf9'),'lastPauseAt']})[_0x331b('0x20')](handleEntityNotFound(_0x5e76a8,null))[_0x331b('0x20')](function(_0x5a1550){if(_0x5a1550){_0x2d80f2=_0x5a1550;if(_0x4c6b17[_0x331b('0x63')][_0x331b('0x9c')]&&!utils[_0x331b('0xa0')](_0x4c6b17['body']['channel'])){throw new db['Sequelize'][(_0x331b('0x1d'))](_0x331b('0xa1'));}switch(_0x4c6b17[_0x331b('0x63')]['channel']){case _0x331b('0xa9'):return respondWithRpcPromise(_0x331b('0xf0'),_0x331b('0xf3'),{'id':_0x2d80f2['id'],'name':_0x2d80f2[_0x331b('0x42')],'pause':![]})[_0x331b('0x20')](function(){return db[_0x331b('0xaf')]['update']({'paused':0x0},{'where':{'UserId':_0x2d80f2['id']},'individualHooks':!![]});})[_0x331b('0x20')](function(){return db[_0x331b('0xe3')][_0x331b('0x3e')]({'where':{'channel':_0x4c6b17[_0x331b('0x63')][_0x331b('0x9c')],'membername':_0x2d80f2[_0x331b('0x42')],'type':_0x331b('0xf1'),'exitAt':null}});})[_0x331b('0x20')](function(_0x14641a){if(_0x14641a){return _0x14641a['update']({'exitAt':moment()['format'](_0x331b('0xe5')),'data2':_0x331b('0xfa')},{'individualHooks':!![]});}return null;})[_0x331b('0x20')](function(){return _0x2d80f2['update']({'voicePause':![]});});case _0x331b('0xfb'):case _0x331b('0xfc'):case _0x331b('0xfd'):case _0x331b('0xfe'):case _0x331b('0xff'):case'openchannel':return db[_0x331b('0xe3')]['find']({'where':{'channel':_0x4c6b17['body'][_0x331b('0x9c')],'membername':_0x2d80f2['name'],'type':'PAUSE','exitAt':null}})[_0x331b('0x20')](function(_0x11cc47){if(_0x11cc47){return _0x11cc47['update']({'exitAt':moment()[_0x331b('0x6d')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x331b('0xfa')},{'individualHooks':!![]});}return null;})[_0x331b('0x20')](function(){var _0x4abb56={};_['set'](_0x4abb56,util['format']('%s%s',_0x4c6b17[_0x331b('0x63')][_0x331b('0x9c')],_0x331b('0x100')),![]);return _0x2d80f2[_0x331b('0x36')](_0x4abb56);});default:return respondWithRpcPromise(_0x331b('0xf0'),'unpause',{'id':_0x2d80f2['id'],'name':_0x2d80f2['name'],'pause':![]})['then'](function(){return db[_0x331b('0xaf')][_0x331b('0x36')]({'paused':0x0},{'where':{'UserId':_0x2d80f2['id']}});})[_0x331b('0x20')](function(){return db[_0x331b('0xe3')][_0x331b('0xab')]({'where':{'membername':_0x2d80f2[_0x331b('0x42')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x101957){var _0x5ca845=[];_0x101957[_0x331b('0xe4')](function(_0x1bc1af){_0x5ca845[_0x331b('0xac')](_0x1bc1af['update']({'exitAt':moment()[_0x331b('0x6d')](_0x331b('0xe5')),'data2':_0x331b('0xfa')}));});return BPromise[_0x331b('0xe6')](_0x5ca845);})[_0x331b('0x20')](function(){return _0x2d80f2[_0x331b('0x36')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x331b('0x20')](respondWithResult(_0x5e76a8,null))[_0x331b('0x2a')](handleError(_0x5e76a8,null));};exports[_0x331b('0x101')]=function(_0x464eaf,_0x1c7571,_0x1a7bd){var _0x115ebd={};var _0xa46b6c={};var _0xafc3ee;var _0x2403d2;return db[_0x331b('0x44')][_0x331b('0x92')]({'where':{'id':_0x464eaf[_0x331b('0x5d')]['id']}})[_0x331b('0x20')](handleEntityNotFound(_0x1c7571,null))[_0x331b('0x20')](function(_0x450471){if(_0x450471){_0xafc3ee=_0x450471;_0xa46b6c['model']=_[_0x331b('0x60')](db[_0x331b('0x102')][_0x331b('0x5e')]);_0xa46b6c[_0x331b('0x4a')]=_[_0x331b('0x60')](_0x464eaf[_0x331b('0x4a')]);_0xa46b6c[_0x331b('0x4b')]=_[_0x331b('0x4c')](_0xa46b6c[_0x331b('0x47')],_0xa46b6c[_0x331b('0x4a')]);_0x115ebd[_0x331b('0x4d')]=_[_0x331b('0x4c')](_0xa46b6c['model'],qs['fields'](_0x464eaf[_0x331b('0x4a')][_0x331b('0x61')]));_0x115ebd['attributes']=_0x115ebd[_0x331b('0x4d')][_0x331b('0x4e')]?_0x115ebd[_0x331b('0x4d')]:_0xa46b6c[_0x331b('0x47')];_0x115ebd[_0x331b('0x4f')]=qs[_0x331b('0x50')](_0x464eaf[_0x331b('0x4a')]['sort']);_0x115ebd[_0x331b('0x51')]=qs[_0x331b('0x4b')](_['pick'](_0x464eaf[_0x331b('0x4a')],_0xa46b6c[_0x331b('0x4b')]));if(_0x464eaf[_0x331b('0x4a')][_0x331b('0x57')]){_0x115ebd['where']=_[_0x331b('0x53')](_0x115ebd[_0x331b('0x51')],{'$or':_['map'](_0x115ebd[_0x331b('0x4d')],function(_0x14c6d9){var _0x5ebdf3={};_0x5ebdf3[_0x14c6d9]={'$like':'%'+_0x464eaf[_0x331b('0x4a')][_0x331b('0x57')]+'%'};return _0x5ebdf3;})});}_0x115ebd=_[_0x331b('0x53')]({},_0x115ebd,_0x464eaf['options']);return _0xafc3ee['getTeams'](_0x115ebd);}})[_0x331b('0x20')](function(_0x267124){if(_0x267124){_0x2403d2=_0x267124['length'];if(!_0x464eaf['query'][_0x331b('0xc0')](_0x331b('0xc4'))){_0x115ebd[_0x331b('0x30')]=qs[_0x331b('0x30')](_0x464eaf[_0x331b('0x4a')]['limit']);_0x115ebd[_0x331b('0x2f')]=qs[_0x331b('0x2f')](_0x464eaf[_0x331b('0x4a')][_0x331b('0x2f')]);}return _0xafc3ee[_0x331b('0x101')](_0x115ebd);}})[_0x331b('0x20')](function(_0x47ed61){if(_0x47ed61){return _0x47ed61?{'count':_0x2403d2,'rows':_0x47ed61}:null;}})[_0x331b('0x20')](respondWithResult(_0x1c7571,null))['catch'](handleError(_0x1c7571,null));};exports['addTeams']=function(_0x2d2a35,_0xa020d4){return db[_0x331b('0x44')][_0x331b('0x3e')]({'where':{'id':_0x2d2a35[_0x331b('0x5d')]['id']}})['then'](handleEntityNotFound(_0xa020d4,null))[_0x331b('0x20')](function(_0x4492f0){if(_0x4492f0){var _0x1c2c18=_0x4492f0[_0x331b('0x8a')]({'plain':!![]});return _0x4492f0[_0x331b('0x103')](_0x2d2a35[_0x331b('0x63')]['ids'],_[_0x331b('0x67')](_0x2d2a35[_0x331b('0x63')],['ids','id'])||{})['then'](function(){for(var _0x25ad1f=0x0;_0x25ad1f<_0x2d2a35[_0x331b('0x63')][_0x331b('0x66')][_0x331b('0x4e')];_0x25ad1f++){var _0x3929d5=[];db[_0x331b('0x102')][_0x331b('0x92')]({'where':{'id':_0x2d2a35['body'][_0x331b('0x66')][_0x25ad1f]}})[_0x331b('0x20')](function(_0xa6943){_0x3929d5[_0x331b('0xac')](_0xa6943[_0x331b('0xe1')]()[_0x331b('0x20')](function(_0x2cf5a6){for(var _0x4a7a75=0x0;_0x4a7a75<_0x2cf5a6['length'];_0x4a7a75++){_0x2cf5a6[_0x4a7a75]['setDataValue'](_0x331b('0x9c'),'Voice');}return _0x2cf5a6;}));_0x3929d5[_0x331b('0xac')](_0xa6943[_0x331b('0x104')]()[_0x331b('0x20')](function(_0x284ab2){for(var _0xef91b2=0x0;_0xef91b2<_0x284ab2[_0x331b('0x4e')];_0xef91b2++){_0x284ab2[_0xef91b2][_0x331b('0x105')](_0x331b('0x9c'),_0x331b('0x106'));}return _0x284ab2;}));_0x3929d5['push'](_0xa6943[_0x331b('0x107')]()[_0x331b('0x20')](function(_0x10ea86){for(var _0x38732a=0x0;_0x38732a<_0x10ea86['length'];_0x38732a++){_0x10ea86[_0x38732a][_0x331b('0x105')](_0x331b('0x9c'),_0x331b('0x108'));}return _0x10ea86;}));_0x3929d5[_0x331b('0xac')](_0xa6943[_0x331b('0x109')]()[_0x331b('0x20')](function(_0x1e8c81){for(var _0x1b149c=0x0;_0x1b149c<_0x1e8c81[_0x331b('0x4e')];_0x1b149c++){_0x1e8c81[_0x1b149c][_0x331b('0x105')]('channel',_0x331b('0x10a'));}return _0x1e8c81;}));_0x3929d5[_0x331b('0xac')](_0xa6943[_0x331b('0x10b')]()['then'](function(_0x1bf75f){for(var _0x1e9403=0x0;_0x1e9403<_0x1bf75f['length'];_0x1e9403++){_0x1bf75f[_0x1e9403][_0x331b('0x105')]('channel',_0x331b('0x10c'));}return _0x1bf75f;}));_0x3929d5[_0x331b('0xac')](_0xa6943[_0x331b('0x10d')]()[_0x331b('0x20')](function(_0x4e2fc4){for(var _0x5246b5=0x0;_0x5246b5<_0x4e2fc4['length'];_0x5246b5++){_0x4e2fc4[_0x5246b5]['setDataValue'](_0x331b('0x9c'),_0x331b('0x10e'));}return _0x4e2fc4;}));_0x3929d5[_0x331b('0xac')](_0xa6943[_0x331b('0x10f')]()['then'](function(_0x22b153){for(var _0x25a712=0x0;_0x25a712<_0x22b153[_0x331b('0x4e')];_0x25a712++){_0x22b153[_0x25a712][_0x331b('0x105')]('channel',_0x331b('0x110'));}return _0x22b153;}));return BPromise[_0x331b('0xe6')](_0x3929d5);})['then'](function(_0x54611e){var _0x2dacd3=_[_0x331b('0x111')](_0x54611e);_0x3929d5=[];return db['sequelize'][_0x331b('0x112')](function(_0x3fd3a6){for(var _0xbf703d=0x0;_0xbf703d<_0x2dacd3['length'];_0xbf703d++){_0x3929d5[_0x331b('0xac')](_0x2dacd3[_0xbf703d][_0x331b('0x113')](_0x1c2c18['id']),{'transaction':_0x3fd3a6});}return BPromise[_0x331b('0xe6')](_0x3929d5)['then'](function(){if(_0x1c2c18[_0x331b('0x9d')]){return BPromise[_0x331b('0xae')](_['filter'](_0x2dacd3,function(_0x36725c){return _0x36725c[_0x331b('0x114')](_0x331b('0x9c'))===_0x331b('0x115');}),function(_0x407772){return db[_0x331b('0xaf')][_0x331b('0xb0')]({'membername':_0x1c2c18[_0x331b('0x42')],'UserId':_0x1c2c18['id'],'queue_name':_0x407772['name'],'VoiceQueueId':_0x407772['id'],'interface':_[_0x331b('0x6b')](_0x1c2c18[_0x331b('0x9f')])?util[_0x331b('0x6d')](_0x331b('0xdb'),_0x1c2c18['name']):_0x1c2c18[_0x331b('0x9f')],'paused':_0x1c2c18['voicePause']||![],'penalty':_0x1c2c18['penalty']},{'transaction':_0x3fd3a6});});}else{return;}})[_0x331b('0x20')](function(){for(var _0x27e7cd=0x0;_0x27e7cd<_0x2dacd3[_0x331b('0x4e')];_0x27e7cd++){var _0x42e61a=_0x2dacd3[_0x27e7cd]['getDataValue'](_0x331b('0x9c'));var _0x52497b=_0x42e61a+_0x331b('0xa7');socket[_0x331b('0xb3')](_0x331b('0x89')+_0x42e61a+'Queue:save',{'UserId':_0x1c2c18['id'],['queueField']:_0x2dacd3[_0x27e7cd]['id']});}});});});}});}})[_0x331b('0x20')](respondWithStatusCode(_0xa020d4,null))[_0x331b('0x2a')](handleError(_0xa020d4,null));};exports['removeTeams']=function(_0x2e70b1,_0x4e8a0b){return db[_0x331b('0x44')][_0x331b('0x92')]({'where':{'id':_0x2e70b1[_0x331b('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4e8a0b,null))[_0x331b('0x20')](function(_0x4c0d33){if(_0x4c0d33){var _0x4a6a19=_0x4c0d33['get']({'plain':!![]});var _0x25c063=_0x2e70b1[_0x331b('0x4a')][_0x331b('0x66')];return _0x4c0d33[_0x331b('0x116')](_0x25c063)[_0x331b('0x20')](function(){for(var _0x260afb=0x0;_0x260afb<_0x25c063[_0x331b('0x4e')];_0x260afb++){var _0x4a2d30=[];db[_0x331b('0x102')]['findOne']({'where':{'id':_0x25c063[_0x260afb]}})[_0x331b('0x20')](function(_0x5eecf9){_0x4a2d30['push'](_0x5eecf9[_0x331b('0xe1')]()[_0x331b('0x20')](function(_0x383c08){for(var _0x3d9fc7=0x0;_0x3d9fc7<_0x383c08[_0x331b('0x4e')];_0x3d9fc7++){_0x383c08[_0x3d9fc7]['setDataValue'](_0x331b('0x9c'),_0x331b('0x115'));}return _0x383c08;}));_0x4a2d30[_0x331b('0xac')](_0x5eecf9[_0x331b('0x104')]()[_0x331b('0x20')](function(_0x8391b2){for(var _0x28c923=0x0;_0x28c923<_0x8391b2['length'];_0x28c923++){_0x8391b2[_0x28c923][_0x331b('0x105')]('channel',_0x331b('0x106'));}return _0x8391b2;}));_0x4a2d30[_0x331b('0xac')](_0x5eecf9[_0x331b('0x107')]()[_0x331b('0x20')](function(_0x2b12e4){for(var _0x4ad7e9=0x0;_0x4ad7e9<_0x2b12e4[_0x331b('0x4e')];_0x4ad7e9++){_0x2b12e4[_0x4ad7e9][_0x331b('0x105')]('channel','Mail');}return _0x2b12e4;}));_0x4a2d30[_0x331b('0xac')](_0x5eecf9[_0x331b('0x109')]()[_0x331b('0x20')](function(_0x3d45ed){for(var _0x52f708=0x0;_0x52f708<_0x3d45ed[_0x331b('0x4e')];_0x52f708++){_0x3d45ed[_0x52f708]['setDataValue'](_0x331b('0x9c'),_0x331b('0x10a'));}return _0x3d45ed;}));_0x4a2d30[_0x331b('0xac')](_0x5eecf9['getWhatsappQueues']()[_0x331b('0x20')](function(_0x43ed90){for(var _0x537801=0x0;_0x537801<_0x43ed90['length'];_0x537801++){_0x43ed90[_0x537801][_0x331b('0x105')](_0x331b('0x9c'),_0x331b('0x10c'));}return _0x43ed90;}));_0x4a2d30['push'](_0x5eecf9[_0x331b('0x10d')]()['then'](function(_0x42073e){for(var _0x12ce7f=0x0;_0x12ce7f<_0x42073e[_0x331b('0x4e')];_0x12ce7f++){_0x42073e[_0x12ce7f][_0x331b('0x105')](_0x331b('0x9c'),_0x331b('0x10e'));}return _0x42073e;}));_0x4a2d30[_0x331b('0xac')](_0x5eecf9['getOpenchannelQueues']()[_0x331b('0x20')](function(_0x55a9d1){for(var _0x2f6a8f=0x0;_0x2f6a8f<_0x55a9d1[_0x331b('0x4e')];_0x2f6a8f++){_0x55a9d1[_0x2f6a8f][_0x331b('0x105')](_0x331b('0x9c'),_0x331b('0x110'));}return _0x55a9d1;}));return BPromise[_0x331b('0xe6')](_0x4a2d30);})['then'](function(_0x3b717a){var _0x4d2e45=_['flatten'](_0x3b717a);_0x4a2d30=[];return db['sequelize'][_0x331b('0x112')](function(_0x35cb44){for(var _0x59c412=0x0;_0x59c412<_0x4d2e45[_0x331b('0x4e')];_0x59c412++){_0x4a2d30[_0x331b('0xac')](_0x4d2e45[_0x59c412][_0x331b('0x117')](_0x4a6a19['id']),{'transaction':_0x35cb44});}return BPromise['all'](_0x4a2d30)[_0x331b('0x20')](function(){if(_0x4a6a19[_0x331b('0x9d')]){return BPromise[_0x331b('0xae')](_['filter'](_0x4d2e45,function(_0x3f7e4c){return _0x3f7e4c[_0x331b('0x114')]('channel')===_0x331b('0x115');}),function(_0x9b1c8f){return db['UserVoiceQueueRt'][_0x331b('0x40')]({'where':{'VoiceQueueId':_0x9b1c8f['id'],'UserId':_0x4a6a19['id']},'transaction':_0x35cb44});});}else{return;}})['then'](function(){for(var _0x34aa79=0x0;_0x34aa79<_0x4d2e45[_0x331b('0x4e')];_0x34aa79++){var _0x451dcd=_0x4d2e45[_0x34aa79][_0x331b('0x114')](_0x331b('0x9c'));var _0x29b0bb=_0x451dcd+_0x331b('0xa7');socket[_0x331b('0xb3')](_0x331b('0x89')+_0x451dcd+_0x331b('0x118'),{'UserId':_0x4a6a19['id'],['queueField']:_0x4d2e45[_0x34aa79]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x4e8a0b,null))[_0x331b('0x2a')](handleError(_0x4e8a0b,null));};exports[_0x331b('0x119')]=function(_0x357c6e,_0x1b7e40,_0x293677){var _0x1c0a73={};var _0x30c9eb={};var _0x553f3a;var _0x7dc551;return db[_0x331b('0x44')][_0x331b('0x92')]({'where':{'id':_0x357c6e[_0x331b('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1b7e40,null))['then'](function(_0x246f86){if(_0x246f86){_0x553f3a=_0x246f86;_0x30c9eb[_0x331b('0x47')]=_['keys'](db[_0x331b('0x11a')][_0x331b('0x5e')]);_0x30c9eb['query']=_[_0x331b('0x60')](_0x357c6e[_0x331b('0x4a')]);_0x30c9eb['filters']=_['intersection'](_0x30c9eb[_0x331b('0x47')],_0x30c9eb[_0x331b('0x4a')]);_0x1c0a73['attributes']=_[_0x331b('0x4c')](_0x30c9eb[_0x331b('0x47')],qs['fields'](_0x357c6e[_0x331b('0x4a')][_0x331b('0x61')]));_0x1c0a73['attributes']=_0x1c0a73[_0x331b('0x4d')][_0x331b('0x4e')]?_0x1c0a73[_0x331b('0x4d')]:_0x30c9eb[_0x331b('0x47')];_0x1c0a73[_0x331b('0x4f')]=qs[_0x331b('0x50')](_0x357c6e[_0x331b('0x4a')]['sort']);_0x1c0a73['where']=qs[_0x331b('0x4b')](_[_0x331b('0x52')](_0x357c6e['query'],_0x30c9eb['filters']));if(_0x357c6e[_0x331b('0x4a')][_0x331b('0x57')]){_0x1c0a73[_0x331b('0x51')]=_[_0x331b('0x53')](_0x1c0a73['where'],{'$or':_['map'](_0x1c0a73[_0x331b('0x4d')],function(_0x323777){var _0x49e9f0={};_0x49e9f0[_0x323777]={'$like':'%'+_0x357c6e[_0x331b('0x4a')][_0x331b('0x57')]+'%'};return _0x49e9f0;})});}_0x1c0a73=_[_0x331b('0x53')]({},_0x1c0a73,_0x357c6e[_0x331b('0x58')]);return _0x553f3a[_0x331b('0x119')](_0x1c0a73);}})[_0x331b('0x20')](function(_0x11cebe){if(_0x11cebe){_0x7dc551=_0x11cebe['length'];if(!_0x357c6e[_0x331b('0x4a')][_0x331b('0xc0')]('nolimit')){_0x1c0a73[_0x331b('0x30')]=qs[_0x331b('0x30')](_0x357c6e[_0x331b('0x4a')][_0x331b('0x30')]);_0x1c0a73[_0x331b('0x2f')]=qs[_0x331b('0x2f')](_0x357c6e['query'][_0x331b('0x2f')]);}return _0x553f3a[_0x331b('0x119')](_0x1c0a73);}})[_0x331b('0x20')](function(_0x4b9f7b){if(_0x4b9f7b){return _0x4b9f7b?{'count':_0x7dc551,'rows':_0x4b9f7b}:null;}})[_0x331b('0x20')](respondWithResult(_0x1b7e40,null))[_0x331b('0x2a')](handleError(_0x1b7e40,null));};exports[_0x331b('0x11b')]=function(_0x3b2545,_0x28b46f,_0x189642){var _0x227ebb={};var _0x27ec3f={};var _0x5ec3c5;var _0x56618e;return db[_0x331b('0x44')][_0x331b('0x92')]({'where':{'id':_0x3b2545['params']['id']}})[_0x331b('0x20')](handleEntityNotFound(_0x28b46f,null))[_0x331b('0x20')](function(_0x5a74f5){if(_0x5a74f5){_0x5ec3c5=_0x5a74f5;_0x27ec3f[_0x331b('0x47')]=_['keys'](db[_0x331b('0x44')][_0x331b('0x5e')]);_0x27ec3f[_0x331b('0x4a')]=_[_0x331b('0x60')](_0x3b2545[_0x331b('0x4a')]);_0x27ec3f[_0x331b('0x4b')]=_[_0x331b('0x4c')](_0x27ec3f[_0x331b('0x47')],_0x27ec3f[_0x331b('0x4a')]);_0x227ebb[_0x331b('0x4d')]=_[_0x331b('0x4c')](_0x27ec3f[_0x331b('0x47')],qs[_0x331b('0x61')](_0x3b2545[_0x331b('0x4a')][_0x331b('0x61')]));_0x227ebb[_0x331b('0x4d')]=_0x227ebb[_0x331b('0x4d')][_0x331b('0x4e')]?_0x227ebb[_0x331b('0x4d')]:_0x27ec3f[_0x331b('0x47')];_0x227ebb[_0x331b('0x4f')]=qs[_0x331b('0x50')](_0x3b2545[_0x331b('0x4a')]['sort']);_0x227ebb[_0x331b('0x51')]=qs[_0x331b('0x4b')](_[_0x331b('0x52')](_0x3b2545['query'],_0x27ec3f[_0x331b('0x4b')]));if(_0x3b2545['query'][_0x331b('0x57')]){_0x227ebb[_0x331b('0x51')]=_[_0x331b('0x53')](_0x227ebb['where'],{'$or':_[_0x331b('0x43')](_0x227ebb[_0x331b('0x4d')],function(_0x24826e){var _0x53d6c1={};_0x53d6c1[_0x24826e]={'$like':'%'+_0x3b2545[_0x331b('0x4a')][_0x331b('0x57')]+'%'};return _0x53d6c1;})});}_0x227ebb[_0x331b('0x47')]=db[_0x331b('0x44')];_0x227ebb['as']=_0x331b('0x8c');_0x227ebb=_[_0x331b('0x53')]({},_0x227ebb,_0x3b2545[_0x331b('0x58')]);return _0x5ec3c5[_0x331b('0xe1')]({'include':[_0x227ebb]});}})[_0x331b('0x20')](function(_0x1b3b28){if(_0x1b3b28){var _0x70eb1d={},_0x253fd5=[],_0x3d60fe=0x0;for(var _0x437a44=0x0;_0x437a44<_0x1b3b28['length'];_0x437a44+=0x1){for(var _0x481e55=0x0,_0x327eda;_0x481e55<_0x1b3b28[_0x437a44]['Agents'][_0x331b('0x4e')];_0x481e55+=0x1){_0x327eda=_0x1b3b28[_0x437a44][_0x331b('0x8c')][_0x481e55][_0x331b('0x8a')]({'plain':!![]});_0x70eb1d[_0x327eda['id']]=_0x327eda;}}_0x70eb1d=_[_0x331b('0x11c')](_0x70eb1d);for(var _0x21da53=qs['offset'](_0x3b2545[_0x331b('0x4a')][_0x331b('0x2f')]);_0x21da53<_0x70eb1d['length']&&_0x253fd5[_0x331b('0x4e')]=_0x50fdcb){_0x331f4d=_0x50fdcb;_0x347e8e=0xc8;}else{_0x347e8e=0xce;}_0x5a3e5a['status'](_0x347e8e);return _0x5a3e5a[_0x89d6('0x33')](_0x89d6('0x34'),_0x2af3d8+'-'+_0x331f4d+'/'+_0x50fdcb)[_0x89d6('0x35')](_0x787ec1);}return null;};}function patchUpdates(_0x34e326){return function(_0x8a9f37){try{jsonpatch['apply'](_0x8a9f37,_0x34e326,!![]);}catch(_0x260b48){return BPromise['reject'](_0x260b48);}return _0x8a9f37[_0x89d6('0x36')]();};}function saveUpdates(_0x54c67e,_0x3dc40a){return function(_0x1b0baf){if(_0x1b0baf){return _0x1b0baf[_0x89d6('0x37')](_0x54c67e)['then'](function(_0x59c89c){return _0x59c89c;});}return null;};}function removeEntity(_0x3b08a4,_0x29d712){return function(_0x52308e){if(_0x52308e){return _0x52308e[_0x89d6('0x38')]()[_0x89d6('0x22')](function(){var _0x2eecbb=_0x52308e['get']({'plain':!![]});var _0x1f056f=[{'name':_0x89d6('0x39'),'value':_0x89d6('0x3a'),'ignore':!![]},{'name':'Agents','value':_0x89d6('0x3b'),'ignore':![]},{'name':_0x89d6('0x3c'),'value':_0x89d6('0x3d'),'ignore':![]}];var _0xeb087b=_(_0x1f056f)[_0x89d6('0x3e')]('ignore')[_0x89d6('0x3f')](_0x89d6('0x40'))[_0x89d6('0x40')]();if(_['includes'](_0xeb087b,_0x2eecbb['role'])){return;}var _0x1683c2=_[_0x89d6('0x41')](_0x1f056f,[_0x89d6('0x40'),_0x2eecbb['role']])[_0x89d6('0x42')];return db[_0x89d6('0x43')][_0x89d6('0x38')]({'where':{'type':_0x1683c2,'resourceId':_0x2eecbb['id']}})['then'](function(){return _0x52308e;});})[_0x89d6('0x22')](function(){_0x3b08a4[_0x89d6('0x2e')](0xcc)[_0x89d6('0x2f')]();});}};}function handleEntityNotFound(_0xb1c70f,_0x51de0f){return function(_0x34f6eb){if(!_0x34f6eb){_0xb1c70f[_0x89d6('0x2d')](0x194);}return _0x34f6eb;};}function handleError(_0x38e03d,_0x29cc07){_0x29cc07=_0x29cc07||0x1f4;return function(_0x5dfab4){logger[_0x89d6('0x27')](_0x5dfab4[_0x89d6('0x44')]);if(_0x5dfab4['name']){delete _0x5dfab4[_0x89d6('0x42')];}_0x38e03d['status'](_0x29cc07)[_0x89d6('0x45')](_0x5dfab4);};}exports[_0x89d6('0x46')]=function(_0x50840f,_0x18db99){var _0xda7097={},_0x34bba0={},_0x45e06b={'count':0x0,'rows':[]};var _0x496b55=_[_0x89d6('0x3f')](db[_0x89d6('0x47')][_0x89d6('0x48')],function(_0x362ba7){return{'name':_0x362ba7[_0x89d6('0x49')],'type':_0x362ba7[_0x89d6('0x4a')]['key']};});_0x34bba0['model']=_[_0x89d6('0x4b')](_[_0x89d6('0x3f')](_0x496b55,'name'),[_0x89d6('0x4c'),_0x89d6('0x4d')]);_0x34bba0['query']=_[_0x89d6('0x4e')](_0x50840f[_0x89d6('0x4f')]);_0x34bba0['filters']=_[_0x89d6('0x50')](_0x34bba0[_0x89d6('0x51')],_0x34bba0[_0x89d6('0x4f')]);_0xda7097['attributes']=_['intersection'](_0x34bba0['model'],qs['fields'](_0x50840f['query'][_0x89d6('0x52')]));_0xda7097[_0x89d6('0x53')]=_0xda7097['attributes']['length']?_0xda7097[_0x89d6('0x53')]:_0x34bba0[_0x89d6('0x51')];if(!_0x50840f['query'][_0x89d6('0x54')]('nolimit')){_0xda7097[_0x89d6('0x32')]=qs[_0x89d6('0x32')](_0x50840f[_0x89d6('0x4f')]['limit']);_0xda7097[_0x89d6('0x31')]=qs[_0x89d6('0x31')](_0x50840f[_0x89d6('0x4f')][_0x89d6('0x31')]);}_0xda7097[_0x89d6('0x55')]=qs[_0x89d6('0x56')](_0x50840f[_0x89d6('0x4f')][_0x89d6('0x56')]);_0xda7097['where']=qs[_0x89d6('0x57')](_[_0x89d6('0x58')](_0x50840f[_0x89d6('0x4f')],_0x34bba0[_0x89d6('0x57')]),_0x496b55);if(_0x50840f['query']['filter']){_0xda7097['where']=_[_0x89d6('0x59')](_0xda7097[_0x89d6('0x5a')],{'$or':_['map'](_0x496b55,function(_0x106782){if(_0x106782[_0x89d6('0x4a')]!==_0x89d6('0x5b')){return db[_0x89d6('0x5c')][_0x89d6('0x5a')](db[_0x89d6('0x5c')]['fn'](_0x89d6('0x5d'),db[_0x89d6('0x5c')][_0x89d6('0x5e')](_0x106782['name'])),{'$like':db[_0x89d6('0x5c')]['fn'](_0x89d6('0x5d'),'%'+_0x50840f[_0x89d6('0x4f')]['filter']+'%')});}})});}_0xda7097=_['merge']({},_0xda7097,_0x50840f[_0x89d6('0x5f')]);var _0x330330={'where':_0xda7097[_0x89d6('0x5a')]};return db['User']['count'](_0x330330)[_0x89d6('0x22')](function(_0x36357f){_0x45e06b[_0x89d6('0x30')]=_0x36357f;if(_0x50840f['query'][_0x89d6('0x60')]){_0xda7097['include']=[{'all':!![]}];}return db['User'][_0x89d6('0x61')](_0xda7097);})[_0x89d6('0x22')](function(_0x1ae40a){_0x45e06b[_0x89d6('0x62')]=_0x1ae40a;return _0x45e06b;})[_0x89d6('0x22')](respondWithFilteredResult(_0x18db99,_0xda7097))[_0x89d6('0x2c')](handleError(_0x18db99,null));};exports[_0x89d6('0x63')]=function(_0x2f5562,_0x191718){var _0xbf8805={'raw':![],'where':{'id':_0x2f5562['params']['id']}},_0x3b79b0={};_0x3b79b0['model']=_[_0x89d6('0x4b')](_[_0x89d6('0x4e')](db[_0x89d6('0x47')][_0x89d6('0x48')]),['password',_0x89d6('0x4d')]);_0x3b79b0[_0x89d6('0x4f')]=_[_0x89d6('0x4e')](_0x2f5562[_0x89d6('0x4f')]);_0x3b79b0[_0x89d6('0x57')]=_[_0x89d6('0x50')](_0x3b79b0[_0x89d6('0x51')],_0x3b79b0[_0x89d6('0x4f')]);_0xbf8805[_0x89d6('0x53')]=_['intersection'](_0x3b79b0[_0x89d6('0x51')],qs[_0x89d6('0x52')](_0x2f5562[_0x89d6('0x4f')][_0x89d6('0x52')]));_0xbf8805['attributes']=_0xbf8805[_0x89d6('0x53')][_0x89d6('0x64')]?_0xbf8805[_0x89d6('0x53')]:_0x3b79b0[_0x89d6('0x51')];if(_0x2f5562[_0x89d6('0x4f')][_0x89d6('0x60')]){_0xbf8805['include']=[{'all':!![]}];}_0xbf8805=_['merge']({},_0xbf8805,_0x2f5562['options']);return db[_0x89d6('0x47')][_0x89d6('0x41')](_0xbf8805)['then'](handleEntityNotFound(_0x191718,null))[_0x89d6('0x22')](respondWithResult(_0x191718,null))['catch'](handleError(_0x191718,null));};exports[_0x89d6('0x65')]=function(_0x57af1e,_0xa232a4){return db[_0x89d6('0x47')][_0x89d6('0x65')](_0x57af1e[_0x89d6('0x66')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xa232a4,0xc9))[_0x89d6('0x2c')](handleError(_0xa232a4,null));};exports['update']=function(_0x566671,_0x5563d7){if(_0x566671['body']['id']){delete _0x566671[_0x89d6('0x66')]['id'];}delete _0x566671[_0x89d6('0x66')][_0x89d6('0x67')];return db[_0x89d6('0x47')][_0x89d6('0x41')]({'where':{'id':_0x566671['params']['id']}})[_0x89d6('0x22')](handleEntityNotFound(_0x5563d7,null))[_0x89d6('0x22')](saveUpdates(_0x566671['body'],null))[_0x89d6('0x22')](respondWithResult(_0x5563d7,null))[_0x89d6('0x2c')](handleError(_0x5563d7,null));};exports['describe']=function(_0x47b24b,_0x26e3a2){return db[_0x89d6('0x47')][_0x89d6('0x68')]()[_0x89d6('0x22')](respondWithResult(_0x26e3a2,null))['catch'](handleError(_0x26e3a2,null));};exports[_0x89d6('0x69')]=function(_0x3adb63,_0x4211ff,_0x557cb0){return db[_0x89d6('0x47')]['find']({'where':{'id':_0x3adb63[_0x89d6('0x6a')]['id']}})['then'](handleEntityNotFound(_0x4211ff,null))[_0x89d6('0x22')](function(_0x27ca57){if(_0x27ca57){return _0x27ca57[_0x89d6('0x69')](_0x3adb63[_0x89d6('0x66')][_0x89d6('0x6b')],_[_0x89d6('0x6c')](_0x3adb63[_0x89d6('0x66')],[_0x89d6('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x4211ff,null))['catch'](handleError(_0x4211ff,null));};var getLicense=function(_0xb07547){return new BPromise(function(_0x3efc7a,_0x519639){var _0x591ed5=0x0;_0xb07547['body']['role']==='agent'&&_0x3efc7a('agent\x20role');return db[_0x89d6('0x47')][_0x89d6('0x30')]({'where':{'$or':[{'role':_0xb07547[_0x89d6('0x66')][_0x89d6('0x67')]===_0x89d6('0x3d')?_0x89d6('0x3d'):[_0x89d6('0x6d'),_0x89d6('0x3a')]}]}})[_0x89d6('0x22')](function(_0x1da36f){_0x591ed5=_0x1da36f;return require(_0x89d6('0x6e'))[_0x89d6('0x6f')]();})[_0x89d6('0x22')](function(_0x115d01){var _0x4f0df4=_0xb07547[_0x89d6('0x66')][_0x89d6('0x67')]===_0x89d6('0x3d')?_0x89d6('0x70'):'users';if(!_[_0x89d6('0x71')](_0x115d01[_0x4f0df4])&&_0x591ed5>=_0x115d01[_0x4f0df4]){return _0x519639({'message':_0x89d6('0x72')});}return _0x3efc7a(util[_0x89d6('0x73')](_0x89d6('0x74'),_0x4f0df4,_0x591ed5));})[_0x89d6('0x2c')](function(_0x97c977){return _0x519639(_0x97c977);});});};exports[_0x89d6('0x75')]=function(_0x2dfbd8,_0x494368){return getLicense(_0x2dfbd8)[_0x89d6('0x22')](function(_0x1137e7){if(!_0x2dfbd8[_0x89d6('0x66')][_0x89d6('0x76')]){var _0x4e122f;return db['Setting'][_0x89d6('0x77')](0x1)[_0x89d6('0x22')](function(_0x267baa){return checkPasswordPattern(_0x267baa,_0x2dfbd8[_0x89d6('0x66')][_0x89d6('0x4c')],_0x267baa[_0x89d6('0x78')]);})[_0x89d6('0x22')](function(_0x1024cf){_0x4e122f=_0x1024cf[_0x89d6('0x79')];return db[_0x89d6('0x47')][_0x89d6('0x7a')](_0x89d6('0x76'));})[_0x89d6('0x22')](function(_0x4861c8){if(_['isNil'](_0x4861c8)){if(_0x4e122f){_0x2dfbd8[_0x89d6('0x66')][_0x89d6('0x76')]=_0x4e122f;}else{_0x2dfbd8['body'][_0x89d6('0x76')]=0x1;}}else{if(_[_0x89d6('0x71')](_0x4e122f)||_0x4e122f==_0x4861c8){_0x2dfbd8[_0x89d6('0x66')][_0x89d6('0x76')]=_0x4861c8+0x1;}else if(_0x4e122f>_0x4861c8){_0x2dfbd8['body'][_0x89d6('0x76')]=_0x4e122f;}else{return db[_0x89d6('0x5c')]['query'](_0x89d6('0x7b'),{'type':db['sequelize'][_0x89d6('0x7c')][_0x89d6('0x7d')]})[_0x89d6('0x22')](function(_0x2f8372){if(_0x2f8372&&_0x2f8372[_0x89d6('0x64')]){for(var _0x3a9798=0x0,_0x570636=_0x2f8372[_0x89d6('0x64')];_0x3a9798<_0x570636&&_[_0x89d6('0x71')](_0x2dfbd8[_0x89d6('0x66')]['internal']);_0x3a9798++){if(_0x4e122f<=_0x2f8372[_0x3a9798][_0x89d6('0x7e')]){_0x2dfbd8[_0x89d6('0x66')][_0x89d6('0x76')]=_0x2f8372[_0x3a9798][_0x89d6('0x7e')];}else if(_0x4e122f>_0x2f8372[_0x3a9798]['from']&&_0x4e122f<=_0x2f8372[_0x3a9798]['to']){_0x2dfbd8[_0x89d6('0x66')][_0x89d6('0x76')]=_0x4e122f;}}}if(_[_0x89d6('0x71')](_0x2dfbd8[_0x89d6('0x66')]['internal'])){_0x2dfbd8['body'][_0x89d6('0x76')]=_0x4861c8+0x1;}});}}});}})[_0x89d6('0x22')](function(){if(_0x2dfbd8[_0x89d6('0x66')][_0x89d6('0x7f')]){_0x2dfbd8[_0x89d6('0x66')][_0x89d6('0x80')]=_0x2dfbd8['body']['internal'];_0x2dfbd8[_0x89d6('0x66')][_0x89d6('0x81')]={'mailbox':_0x2dfbd8[_0x89d6('0x66')][_0x89d6('0x76')],'password':_0x2dfbd8[_0x89d6('0x66')][_0x89d6('0x4c')],'fullname':_0x2dfbd8[_0x89d6('0x66')][_0x89d6('0x82')],'email':_0x2dfbd8[_0x89d6('0x66')][_0x89d6('0x83')]};}if(_0x2dfbd8[_0x89d6('0x66')]&&_0x2dfbd8[_0x89d6('0x66')][_0x89d6('0x67')]===_0x89d6('0x3b')){if(!_0x2dfbd8[_0x89d6('0x66')][_0x89d6('0x84')]){_0x2dfbd8[_0x89d6('0x66')]['permissions']=[_0x89d6('0x85'),_0x89d6('0x86'),_0x89d6('0x87'),_0x89d6('0x88'),_0x89d6('0x89'),'104',_0x89d6('0x8a'),_0x89d6('0x8b'),_0x89d6('0x8c'),'108',_0x89d6('0x8d'),'100','111',_0x89d6('0x8e')];}}return db[_0x89d6('0x47')][_0x89d6('0x75')](_0x2dfbd8[_0x89d6('0x66')],{'include':[{'model':db[_0x89d6('0x81')],'as':_0x89d6('0x81')}]});})['then'](function(_0x5c5cdf){if(_0x2dfbd8['body']['role']===_0x89d6('0x3a'))return _0x5c5cdf;var _0x44980b=_0x2dfbd8[_0x89d6('0x3a')][_0x89d6('0x8f')]({'plain':!![]});if(!_0x44980b)throw new Error(_0x89d6('0x90'));if(_0x44980b[_0x89d6('0x67')]===_0x89d6('0x3a')){var _0x156b92=_0x5c5cdf[_0x89d6('0x8f')]({'plain':!![]});var _0xdd6d0d=[{'name':'Agents','value':_0x89d6('0x3b')},{'name':'Telephones','value':'telephone'}];var _0x1073d5=_[_0x89d6('0x41')](_0xdd6d0d,[_0x89d6('0x40'),_0x156b92[_0x89d6('0x67')]])['name'];return db[_0x89d6('0x91')][_0x89d6('0x41')]({'where':{'name':_0x1073d5,'userProfileId':_0x44980b[_0x89d6('0x92')]},'raw':!![]})[_0x89d6('0x22')](function(_0x1a6d0e){if(_0x1a6d0e&&_0x1a6d0e[_0x89d6('0x93')]===0x0){return db['UserProfileResource']['create']({'name':_0x156b92['name'],'resourceId':_0x156b92['id'],'type':_0x1a6d0e[_0x89d6('0x42')],'sectionId':_0x1a6d0e['id']},{})[_0x89d6('0x22')](function(){return _0x5c5cdf;});}else{return _0x5c5cdf;}})[_0x89d6('0x2c')](function(_0x55a79f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55a79f);throw _0x55a79f;});}return _0x5c5cdf;})[_0x89d6('0x22')](respondWithResult(_0x494368,0xc9))[_0x89d6('0x2c')](handleError(_0x494368,null));};exports[_0x89d6('0x94')]=function(_0x1a16af,_0x17e1aa,_0x5dc1de){var _0x7607ec=![];if(_0x1a16af[_0x89d6('0x66')]['id']){delete _0x1a16af[_0x89d6('0x66')]['id'];}return db['Setting']['findOne']({'attributes':['id',_0x89d6('0x78')]})['then'](function(_0x5e28ce){_0x7607ec=_0x5e28ce[_0x89d6('0x78')];return db[_0x89d6('0x47')]['find']({'where':{'id':_0x1a16af[_0x89d6('0x6a')]['id']}});})['then'](function(_0x264953){if(_0x264953){if(_0x264953['id']==_0x1a16af[_0x89d6('0x3a')]['id']){if(!_0x1a16af[_0x89d6('0x66')][_0x89d6('0x95')]||!_0x1a16af[_0x89d6('0x66')][_0x89d6('0x96')]){throw new db[(_0x89d6('0x1f'))][(_0x89d6('0x20'))](_0x89d6('0x97'));}if(!_0x264953[_0x89d6('0x98')](_0x1a16af['body'][_0x89d6('0x95')])){throw new db[(_0x89d6('0x1f'))][(_0x89d6('0x20'))](_0x89d6('0x99'));}if(_0x1a16af['body'][_0x89d6('0x95')]==_0x1a16af[_0x89d6('0x66')][_0x89d6('0x96')]){throw new db[(_0x89d6('0x1f'))]['ValidationError'](_0x89d6('0x9a'));}return _0x264953;}else if(_0x1a16af[_0x89d6('0x3a')][_0x89d6('0x67')]==_0x89d6('0x6d')){if(!_0x1a16af[_0x89d6('0x66')][_0x89d6('0x96')]){throw new db[(_0x89d6('0x1f'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x264953;}else if(_0x1a16af[_0x89d6('0x3a')][_0x89d6('0x67')]==_0x89d6('0x3a')){if(!_0x1a16af[_0x89d6('0x66')][_0x89d6('0x96')]){throw new db[(_0x89d6('0x1f'))][(_0x89d6('0x20'))](_0x89d6('0x9b'));}if(_0x264953[_0x89d6('0x67')]!=_0x89d6('0x3b')){throw new db[(_0x89d6('0x1f'))][(_0x89d6('0x20'))](_0x89d6('0x9c'));}return _0x264953;}else{throw new db[(_0x89d6('0x1f'))][(_0x89d6('0x20'))](_0x89d6('0x9c'));}}return null;})['then'](handleEntityNotFound(_0x17e1aa,null))[_0x89d6('0x22')](function(_0x55841f){return checkPasswordPattern(_0x55841f,_0x1a16af[_0x89d6('0x66')]['newPassword'],_0x7607ec);})['then'](saveUpdates({'password':_0x1a16af['body'][_0x89d6('0x96')],'passwordResetAt':_0x1a16af['user']['id']==_0x1a16af[_0x89d6('0x6a')]['id']?moment():null},null))[_0x89d6('0x22')](respondWithResult(_0x17e1aa,null))[_0x89d6('0x2c')](handleError(_0x17e1aa,null));};exports[_0x89d6('0x9d')]=function(_0x3d6bb7,_0x2cc54b,_0x317372){var _0x466ace=_0x3d6bb7[_0x89d6('0x66')][_0x89d6('0x9e')];return db[_0x89d6('0x47')]['find']({'where':{'id':_0x3d6bb7[_0x89d6('0x6a')]['id']},'attributes':['id',_0x89d6('0x42'),'role','online',_0x89d6('0x9f'),'voicePause',_0x89d6('0xa0')]})[_0x89d6('0x22')](handleEntityNotFound(_0x2cc54b,null))['then'](function(_0x4d21cc){if(_0x4d21cc){if(!utils[_0x89d6('0xa1')](_0x466ace)){throw new db[(_0x89d6('0x1f'))][(_0x89d6('0x20'))]('Unknown\x20channel');}return _0x4d21cc[_0x89d6('0xa2')+_[_0x89d6('0xa3')](_0x466ace[_0x89d6('0xa4')]())+_0x89d6('0xa5')](_0x3d6bb7[_0x89d6('0x66')]['ids'],{'penalty':_0x3d6bb7[_0x89d6('0x66')][_0x89d6('0xa6')]||0x0})[_0x89d6('0xa7')](function(_0x1c290c){for(var _0x260a60=0x0;_0x260a60<_0x3d6bb7[_0x89d6('0x66')][_0x89d6('0x6b')]['length'];_0x260a60+=0x1){var _0x531197={'UserId':_0x3d6bb7['params']['id']};_0x531197[_[_0x89d6('0xa3')](_0x466ace['toLowerCase']())+_0x89d6('0xa8')]=_0x3d6bb7[_0x89d6('0x66')]['ids'][_0x260a60];socket[_0x89d6('0xa9')](_0x89d6('0x3a')+_[_0x89d6('0xa3')](_0x466ace[_0x89d6('0xa4')]())+_0x89d6('0xaa'),_0x531197);}return _0x1c290c;})['then'](function(){if(_0x466ace==='voice'){return db[_0x89d6('0xab')][_0x89d6('0x61')]({'where':{'id':_0x3d6bb7['body'][_0x89d6('0x6b')]||[]},'raw':!![],'attributes':['id',_0x89d6('0x42')]});}})[_0x89d6('0x22')](function(_0x3b7e6a){var _0xcd487d=_0x4d21cc[_0x89d6('0x8f')]({'plain':!![]});var _0x53d7d7=[];if(_0x466ace==='voice'&&_0xcd487d[_0x89d6('0x67')]===_0x89d6('0x3b')&&_0xcd487d['online']){for(var _0x85ddec=0x0;_0x85ddec<_0x3b7e6a[_0x89d6('0x64')];_0x85ddec+=0x1){_0x53d7d7[_0x89d6('0xac')]({'membername':_0xcd487d[_0x89d6('0x42')],'UserId':_0xcd487d['id'],'queue_name':_0x3b7e6a[_0x85ddec][_0x89d6('0x42')],'VoiceQueueId':_0x3b7e6a[_0x85ddec]['id'],'interface':_[_0x89d6('0x71')](_0xcd487d[_0x89d6('0xa0')])?util['format']('SIP/%s',_0xcd487d[_0x89d6('0x42')]):_0xcd487d[_0x89d6('0xa0')],'paused':_0xcd487d[_0x89d6('0xad')]||![],'penalty':_0x3d6bb7[_0x89d6('0x66')][_0x89d6('0xa6')]||0x0});}return BPromise[_0x89d6('0xae')](_0x53d7d7,function(_0x3bd0d2){return db[_0x89d6('0xaf')]['upsert'](_0x3bd0d2);});}return _0x4d21cc;});}})['then'](respondWithStatusCode(_0x2cc54b,null))[_0x89d6('0x2c')](handleError(_0x2cc54b,null));};exports['removeQueues']=function(_0x58473e,_0x10bfb8,_0x452db2){var _0xd48e95;return db[_0x89d6('0x47')][_0x89d6('0x41')]({'where':{'id':_0x58473e['params']['id']},'attributes':['id',_0x89d6('0x42'),_0x89d6('0x67')]})[_0x89d6('0x22')](handleEntityNotFound(_0x10bfb8,null))['then'](function(_0x82bd5a){if(_0x82bd5a){_0xd48e95=_0x82bd5a;if(!_0x58473e['query'][_0x89d6('0x9e')]||!utils[_0x89d6('0xa1')](_0x58473e['query'][_0x89d6('0x9e')])){throw new db[(_0x89d6('0x1f'))][(_0x89d6('0x20'))](_0x89d6('0xb0'));}return _0x82bd5a['remove'+_[_0x89d6('0xa3')](_0x58473e['query'][_0x89d6('0x9e')][_0x89d6('0xa4')]())+_0x89d6('0xa5')](_0x58473e[_0x89d6('0x4f')][_0x89d6('0x6b')]);}})[_0x89d6('0x22')](function(_0x7a4878){for(var _0x3d43e4=0x0;_0x3d43e4<_0x58473e[_0x89d6('0x4f')]['ids'][_0x89d6('0x64')];_0x3d43e4+=0x1){var _0x22e459={'UserId':_0x58473e[_0x89d6('0x6a')]['id']};_0x22e459[_[_0x89d6('0xa3')](_0x58473e['query']['channel'][_0x89d6('0xa4')]())+_0x89d6('0xa8')]=_0x58473e[_0x89d6('0x4f')][_0x89d6('0x6b')][_0x3d43e4];socket[_0x89d6('0xa9')]('user'+_[_0x89d6('0xa3')](_0x58473e[_0x89d6('0x4f')][_0x89d6('0x9e')][_0x89d6('0xa4')]())+_0x89d6('0xb1'),_0x22e459);}return _0x7a4878;})['then'](function(){if(_0x58473e[_0x89d6('0x4f')]['channel']===_0x89d6('0xb2')){return db[_0x89d6('0xaf')][_0x89d6('0x38')]({'where':{'UserId':_0x58473e['params']['id'],'VoiceQueueId':_0x58473e['query'][_0x89d6('0x6b')]},'individualHooks':!![]})[_0x89d6('0x22')](function(){return _0xd48e95;});}return _0xd48e95;})[_0x89d6('0x22')](respondWithStatusCode(_0x10bfb8,null))['catch'](handleError(_0x10bfb8,null));};exports['addAvatar']=function(_0xf3d28b,_0x3b5f25,_0x5d1d1b){_0xf3d28b['body'][_0x89d6('0xb3')]=_0xf3d28b['file'][_0x89d6('0xb4')];return db['User']['find']({'where':{'id':_0xf3d28b[_0x89d6('0x6a')]['id']}})[_0x89d6('0x22')](handleEntityNotFound(_0x3b5f25,null))[_0x89d6('0x22')](saveUpdates(_0xf3d28b[_0x89d6('0x66')],null))[_0x89d6('0x22')](respondWithResult(_0x3b5f25,null))[_0x89d6('0x2c')](handleError(_0x3b5f25,null));};exports[_0x89d6('0xb5')]=function(_0x53ebb0,_0xb1e65b,_0x3d122a){var _0xecdd88=path['join'](config[_0x89d6('0xb6')],_0x89d6('0xb7'));return db[_0x89d6('0x47')][_0x89d6('0x41')]({'where':{'id':_0x53ebb0[_0x89d6('0x6a')]['id']},'attributes':['id',_0x89d6('0xb3')],'raw':!![]})['then'](handleEntityNotFound(_0xb1e65b,null))[_0x89d6('0x22')](function(_0x292010){if(_0x292010){if(_[_0x89d6('0x71')](_0x292010[_0x89d6('0xb3')])){return _0xb1e65b[_0x89d6('0xb8')](_0xecdd88);}else{if(!fs[_0x89d6('0xb9')](path[_0x89d6('0xba')](config[_0x89d6('0xb6')],_0x89d6('0xbb'),_0x292010['userpic']))){return _0xb1e65b['download'](_0xecdd88);}return _0xb1e65b[_0x89d6('0xb8')](path[_0x89d6('0xba')](config['root'],_0x89d6('0xbb'),_0x292010[_0x89d6('0xb3')]));}}})[_0x89d6('0x2c')](handleError(_0xb1e65b,null));};exports['getContacts']=function(_0x49194a,_0x5f567d,_0x387f2c){var _0x40a3a7={};var _0x8b161={};var _0x558f72;var _0x27f4dc;return db['User'][_0x89d6('0xbc')]({'where':{'id':_0x49194a[_0x89d6('0x6a')]['id']}})[_0x89d6('0x22')](handleEntityNotFound(_0x5f567d,null))['then'](function(_0x21f6ca){if(_0x21f6ca){_0x558f72=_0x21f6ca;_0x8b161[_0x89d6('0x51')]=_[_0x89d6('0x4e')](db[_0x89d6('0xbd')][_0x89d6('0x48')]);_0x8b161[_0x89d6('0x4f')]=_[_0x89d6('0x4e')](_0x49194a[_0x89d6('0x4f')]);_0x8b161[_0x89d6('0x57')]=_['intersection'](_0x8b161['model'],_0x8b161[_0x89d6('0x4f')]);_0x40a3a7[_0x89d6('0x53')]=_[_0x89d6('0x50')](_0x8b161['model'],qs[_0x89d6('0x52')](_0x49194a[_0x89d6('0x4f')][_0x89d6('0x52')]));_0x40a3a7[_0x89d6('0x53')]=_0x40a3a7[_0x89d6('0x53')]['length']?_0x40a3a7[_0x89d6('0x53')]:_0x8b161['model'];_0x40a3a7[_0x89d6('0x55')]=qs[_0x89d6('0x56')](_0x49194a[_0x89d6('0x4f')][_0x89d6('0x56')]);_0x40a3a7['where']=qs[_0x89d6('0x57')](_[_0x89d6('0x58')](_0x49194a[_0x89d6('0x4f')],_0x8b161[_0x89d6('0x57')]));if(_0x49194a[_0x89d6('0x4f')][_0x89d6('0x3e')]){_0x40a3a7[_0x89d6('0x5a')]=_['merge'](_0x40a3a7['where'],{'$or':_[_0x89d6('0x3f')](_0x40a3a7[_0x89d6('0x53')],function(_0x5cfb02){var _0x580bd1={};_0x580bd1[_0x5cfb02]={'$like':'%'+_0x49194a[_0x89d6('0x4f')][_0x89d6('0x3e')]+'%'};return _0x580bd1;})});}_0x40a3a7=_[_0x89d6('0x59')]({},_0x40a3a7,_0x49194a[_0x89d6('0x5f')]);return _0x558f72['getContacts'](_0x40a3a7);}})[_0x89d6('0x22')](function(_0x52bc83){if(_0x52bc83){_0x27f4dc=_0x52bc83[_0x89d6('0x64')];if(_0x49194a[_0x89d6('0x4f')]['hasOwnProperty'](_0x89d6('0x60'))){_0x40a3a7['include']=[{'model':db[_0x89d6('0xbe')],'as':_0x89d6('0xbf'),'required':![]},{'model':db[_0x89d6('0xc0')],'as':'Tags','attributes':['id',_0x89d6('0x42'),'color'],'where':_0x49194a[_0x89d6('0x4f')][_0x89d6('0xc1')]?{'id':_0x49194a[_0x89d6('0x4f')]['tag']}:undefined,'required':_0x49194a[_0x89d6('0x4f')][_0x89d6('0xc1')]?!![]:![]}];}if(!_0x49194a[_0x89d6('0x4f')][_0x89d6('0x54')](_0x89d6('0xc2'))){_0x40a3a7['limit']=qs[_0x89d6('0x32')](_0x49194a[_0x89d6('0x4f')][_0x89d6('0x32')]);_0x40a3a7[_0x89d6('0x31')]=qs[_0x89d6('0x31')](_0x49194a[_0x89d6('0x4f')][_0x89d6('0x31')]);}return _0x558f72[_0x89d6('0xc3')](_0x40a3a7);}})['then'](function(_0x2886f9){if(_0x2886f9){return _0x2886f9?{'count':_0x27f4dc,'rows':_0x2886f9}:null;}})[_0x89d6('0x22')](respondWithResult(_0x5f567d,null))[_0x89d6('0x2c')](handleError(_0x5f567d,null));};exports[_0x89d6('0xc4')]=function(_0x505d43,_0x1016d2,_0x29a3c1){var _0x5bf78a;var _0x4691be;var _0x1e2e0c={};var _0x486f65;return db[_0x89d6('0x47')]['findOne']({'where':{'id':_0x505d43[_0x89d6('0x6a')]['id']},'attributes':['id',_0x89d6('0x42'),_0x89d6('0x67')]})['then'](handleEntityNotFound(_0x1016d2,null))[_0x89d6('0x22')](function(_0x50bf8c){if(!utils['isValidChannel'](_0x505d43[_0x89d6('0x4f')][_0x89d6('0x9e')])){throw new db['Sequelize'][(_0x89d6('0x20'))](_0x89d6('0xb0'));}_0x5bf78a=_0x50bf8c;var _0x2f7e3e={};_0x2f7e3e[_0x89d6('0x51')]=_[_0x89d6('0x4e')](db[_[_0x89d6('0xa3')](_0x505d43[_0x89d6('0x4f')][_0x89d6('0x9e')])+'Queue'][_0x89d6('0x48')]);_0x2f7e3e[_0x89d6('0x4f')]=_[_0x89d6('0x4e')](_0x505d43[_0x89d6('0x4f')]);_0x2f7e3e[_0x89d6('0x57')]=_[_0x89d6('0x50')](_0x2f7e3e[_0x89d6('0x51')],_0x2f7e3e[_0x89d6('0x4f')]);_0x1e2e0c[_0x89d6('0x53')]=_[_0x89d6('0x50')](_0x2f7e3e[_0x89d6('0x51')],qs[_0x89d6('0x52')](_0x505d43['query']['fields']));_0x1e2e0c[_0x89d6('0x53')]=_0x1e2e0c[_0x89d6('0x53')]['length']?_0x1e2e0c['attributes']:_0x2f7e3e[_0x89d6('0x51')];_0x1e2e0c[_0x89d6('0x55')]=qs[_0x89d6('0x56')](_0x505d43['query'][_0x89d6('0x56')]);_0x1e2e0c[_0x89d6('0x5a')]=qs['filters'](_[_0x89d6('0x58')](_0x505d43[_0x89d6('0x4f')],_0x2f7e3e[_0x89d6('0x57')]));if(_0x505d43[_0x89d6('0x4f')][_0x89d6('0x3e')]){_0x1e2e0c[_0x89d6('0x5a')]=_[_0x89d6('0x59')](_0x1e2e0c[_0x89d6('0x5a')],{'$or':_[_0x89d6('0x3f')](_0x1e2e0c['attributes'],function(_0x6df603){var _0x12a3cf={};_0x12a3cf[_0x6df603]={'$like':'%'+_0x505d43[_0x89d6('0x4f')][_0x89d6('0x3e')]+'%'};return _0x12a3cf;})});}_0x1e2e0c=_[_0x89d6('0x59')]({},_0x1e2e0c,_0x505d43['options']);switch(_0x5bf78a[_0x89d6('0x67')]){case _0x89d6('0x6d'):return db[_[_0x89d6('0xa3')](_0x505d43['query'][_0x89d6('0x9e')])+_0x89d6('0xc5')]['findAll'](_0x1e2e0c);case'user':case _0x89d6('0x3b'):return _0x5bf78a[_0x89d6('0x8f')+_[_0x89d6('0xa3')](_0x505d43['query'][_0x89d6('0x9e')])+_0x89d6('0xa5')](_0x1e2e0c);default:throw new db[(_0x89d6('0x1f'))][(_0x89d6('0x20'))](_0x89d6('0xc6'));}})[_0x89d6('0x22')](function(_0x323fbe){_0x486f65=_0x323fbe['length'];if(!_0x505d43[_0x89d6('0x4f')]['hasOwnProperty'](_0x89d6('0xc2'))){_0x1e2e0c[_0x89d6('0x32')]=qs[_0x89d6('0x32')](_0x505d43[_0x89d6('0x4f')]['limit']);_0x1e2e0c[_0x89d6('0x31')]=qs[_0x89d6('0x31')](_0x505d43[_0x89d6('0x4f')][_0x89d6('0x31')]);}switch(_0x5bf78a['role']){case _0x89d6('0x6d'):return db[_['capitalize'](_0x505d43['query']['channel'])+_0x89d6('0xc5')][_0x89d6('0x61')](_0x1e2e0c);case _0x89d6('0x3a'):case _0x89d6('0x3b'):return _0x5bf78a['get'+_[_0x89d6('0xa3')](_0x505d43[_0x89d6('0x4f')]['channel'])+_0x89d6('0xa5')](_0x1e2e0c);}})[_0x89d6('0x22')](function(_0x4fc851){return{'count':_0x486f65,'rows':_0x4fc851};})[_0x89d6('0x22')](respondWithResult(_0x1016d2,null))['catch'](handleError(_0x1016d2,null));};exports[_0x89d6('0xc7')]=function(_0x280d0c,_0x4ed285,_0x325d63){var _0x31b163={};var _0x321b9f={};var _0x4f7532;var _0xe81b25;return db[_0x89d6('0x47')]['findOne']({'where':{'id':_0x280d0c[_0x89d6('0x6a')]['id']}})[_0x89d6('0x22')](handleEntityNotFound(_0x4ed285,null))[_0x89d6('0x22')](function(_0xd09fe4){if(_0xd09fe4){_0x4f7532=_0xd09fe4;_0x321b9f[_0x89d6('0x51')]=_[_0x89d6('0x4e')](db[_0x89d6('0xaf')]['rawAttributes']);_0x321b9f[_0x89d6('0x4f')]=_[_0x89d6('0x4e')](_0x280d0c[_0x89d6('0x4f')]);_0x321b9f[_0x89d6('0x57')]=_['intersection'](_0x321b9f[_0x89d6('0x51')],_0x321b9f[_0x89d6('0x4f')]);_0x31b163[_0x89d6('0x53')]=_[_0x89d6('0x50')](_0x321b9f['model'],qs[_0x89d6('0x52')](_0x280d0c[_0x89d6('0x4f')]['fields']));_0x31b163['attributes']=_0x31b163['attributes']['length']?_0x31b163[_0x89d6('0x53')]:_0x321b9f[_0x89d6('0x51')];_0x31b163[_0x89d6('0x55')]=qs['sort'](_0x280d0c[_0x89d6('0x4f')]['sort']);_0x31b163[_0x89d6('0x5a')]=qs[_0x89d6('0x57')](_[_0x89d6('0x58')](_0x280d0c[_0x89d6('0x4f')],_0x321b9f[_0x89d6('0x57')]));if(_0x280d0c['query']['filter']){_0x31b163[_0x89d6('0x5a')]=_[_0x89d6('0x59')](_0x31b163['where'],{'$or':_[_0x89d6('0x3f')](_0x31b163['attributes'],function(_0x1f0047){var _0x54db05={};_0x54db05[_0x1f0047]={'$like':'%'+_0x280d0c[_0x89d6('0x4f')]['filter']+'%'};return _0x54db05;})});}_0x31b163=_[_0x89d6('0x59')]({},_0x31b163,_0x280d0c[_0x89d6('0x5f')]);return _0x4f7532['getVoiceQueuesRt'](_0x31b163);}})[_0x89d6('0x22')](function(_0x2b62cb){if(_0x2b62cb){_0xe81b25=_0x2b62cb[_0x89d6('0x64')];if(!_0x280d0c[_0x89d6('0x4f')][_0x89d6('0x54')](_0x89d6('0xc2'))){_0x31b163[_0x89d6('0x32')]=qs[_0x89d6('0x32')](_0x280d0c['query']['limit']);_0x31b163[_0x89d6('0x31')]=qs['offset'](_0x280d0c[_0x89d6('0x4f')][_0x89d6('0x31')]);}return _0x4f7532[_0x89d6('0xc7')](_0x31b163);}})[_0x89d6('0x22')](function(_0x1794a8){if(_0x1794a8){return _0x1794a8?{'count':_0xe81b25,'rows':_0x1794a8}:null;}})[_0x89d6('0x22')](respondWithResult(_0x4ed285,null))[_0x89d6('0x2c')](handleError(_0x4ed285,null));};exports[_0x89d6('0xc8')]=function(_0x290358,_0x11847b,_0x1073c7){var _0x4b39ff={};var _0x491925={};var _0x1a498f;var _0x238b96;return db[_0x89d6('0x47')][_0x89d6('0xbc')]({'where':{'id':_0x290358[_0x89d6('0x6a')]['id']}})[_0x89d6('0x22')](handleEntityNotFound(_0x11847b,null))['then'](function(_0x26421c){if(_0x26421c){_0x1a498f=_0x26421c;_0x491925['model']=_[_0x89d6('0x4e')](db[_0x89d6('0xc9')][_0x89d6('0x48')]);_0x491925['query']=_[_0x89d6('0x4e')](_0x290358['query']);_0x491925[_0x89d6('0x57')]=_[_0x89d6('0x50')](_0x491925['model'],_0x491925[_0x89d6('0x4f')]);_0x4b39ff[_0x89d6('0x53')]=_['intersection'](_0x491925[_0x89d6('0x51')],qs[_0x89d6('0x52')](_0x290358[_0x89d6('0x4f')][_0x89d6('0x52')]));_0x4b39ff[_0x89d6('0x53')]=_0x4b39ff[_0x89d6('0x53')][_0x89d6('0x64')]?_0x4b39ff[_0x89d6('0x53')]:_0x491925[_0x89d6('0x51')];_0x4b39ff[_0x89d6('0x55')]=qs[_0x89d6('0x56')](_0x290358[_0x89d6('0x4f')]['sort']);_0x4b39ff[_0x89d6('0x5a')]=qs[_0x89d6('0x57')](_[_0x89d6('0x58')](_0x290358[_0x89d6('0x4f')],_0x491925[_0x89d6('0x57')]));if(_0x290358[_0x89d6('0x4f')][_0x89d6('0x3e')]){_0x4b39ff[_0x89d6('0x5a')]=_['merge'](_0x4b39ff['where'],{'$or':_[_0x89d6('0x3f')](_0x4b39ff[_0x89d6('0x53')],function(_0x40e2c9){var _0x5395c1={};_0x5395c1[_0x40e2c9]={'$like':'%'+_0x290358[_0x89d6('0x4f')]['filter']+'%'};return _0x5395c1;})});}_0x4b39ff=_[_0x89d6('0x59')]({},_0x4b39ff,_0x290358[_0x89d6('0x5f')]);return _0x1a498f[_0x89d6('0xc8')](_0x4b39ff);}})[_0x89d6('0x22')](function(_0x4884cf){if(_0x4884cf){_0x238b96=_0x4884cf['length'];if(!_0x290358[_0x89d6('0x4f')][_0x89d6('0x54')](_0x89d6('0xc2'))){_0x4b39ff['limit']=qs[_0x89d6('0x32')](_0x290358[_0x89d6('0x4f')]['limit']);_0x4b39ff[_0x89d6('0x31')]=qs['offset'](_0x290358[_0x89d6('0x4f')][_0x89d6('0x31')]);}return _0x1a498f[_0x89d6('0xc8')](_0x4b39ff);}})['then'](function(_0xf123b8){if(_0xf123b8){return _0xf123b8?{'count':_0x238b96,'rows':_0xf123b8}:null;}})['then'](respondWithResult(_0x11847b,null))[_0x89d6('0x2c')](handleError(_0x11847b,null));};exports[_0x89d6('0xca')]=function(_0x3ba974,_0x4bd78e,_0x526d6a){var _0x4518b9={'raw':!![],'where':{}};var _0x2a7db3={};var _0x4a1de6={'count':0x0,'rows':[]};return db[_0x89d6('0x47')]['findOne']({'where':{'id':_0x3ba974['params']['id']}})[_0x89d6('0x22')](handleEntityNotFound(_0x4bd78e,null))[_0x89d6('0x22')](function(_0x482e9c){if(_0x482e9c){_0x2a7db3['model']=_[_0x89d6('0x4e')](db[_0x89d6('0xcb')][_0x89d6('0x48')]);_0x2a7db3[_0x89d6('0x4f')]=_['keys'](_0x3ba974[_0x89d6('0x4f')]);_0x2a7db3['filters']=_[_0x89d6('0x50')](_0x2a7db3['model'],_0x2a7db3[_0x89d6('0x4f')]);_0x4518b9[_0x89d6('0x53')]=_[_0x89d6('0x50')](_0x2a7db3[_0x89d6('0x51')],qs[_0x89d6('0x52')](_0x3ba974[_0x89d6('0x4f')][_0x89d6('0x52')]));_0x4518b9[_0x89d6('0x53')]=_0x4518b9[_0x89d6('0x53')][_0x89d6('0x64')]?_0x4518b9[_0x89d6('0x53')]:_0x2a7db3[_0x89d6('0x51')];if(!_0x3ba974[_0x89d6('0x4f')]['hasOwnProperty'](_0x89d6('0xc2'))){_0x4518b9['limit']=qs['limit'](_0x3ba974[_0x89d6('0x4f')][_0x89d6('0x32')]);_0x4518b9[_0x89d6('0x31')]=qs[_0x89d6('0x31')](_0x3ba974[_0x89d6('0x4f')][_0x89d6('0x31')]);}_0x4518b9['order']=qs[_0x89d6('0x56')](_0x3ba974[_0x89d6('0x4f')][_0x89d6('0x56')]);_0x4518b9['where']=qs[_0x89d6('0x57')](_[_0x89d6('0x58')](_0x3ba974[_0x89d6('0x4f')],_0x2a7db3[_0x89d6('0x57')]));_0x4518b9[_0x89d6('0x5a')][_0x89d6('0xcc')]=_0x482e9c['id'];if(_0x3ba974[_0x89d6('0x4f')][_0x89d6('0x3e')]){_0x4518b9['where']=_[_0x89d6('0x59')](_0x4518b9[_0x89d6('0x5a')],{'$or':_[_0x89d6('0x3f')](_0x4518b9[_0x89d6('0x53')],function(_0x22daeb){var _0x558de1={};_0x558de1[_0x22daeb]={'$like':'%'+_0x3ba974[_0x89d6('0x4f')][_0x89d6('0x3e')]+'%'};return _0x558de1;})});}_0x4518b9=_[_0x89d6('0x59')]({},_0x4518b9,_0x3ba974[_0x89d6('0x5f')]);return db[_0x89d6('0xcb')][_0x89d6('0x30')]({'where':_0x4518b9[_0x89d6('0x5a')]})[_0x89d6('0x22')](function(_0x5e072f){_0x4a1de6['count']=_0x5e072f;if(_0x3ba974[_0x89d6('0x4f')][_0x89d6('0x60')]){_0x4518b9[_0x89d6('0xcd')]=[{'all':!![]}];}return db[_0x89d6('0xcb')][_0x89d6('0x61')](_0x4518b9);})[_0x89d6('0x22')](function(_0x1d9e7f){_0x4a1de6[_0x89d6('0x62')]=_0x1d9e7f;return _0x4a1de6;});}})[_0x89d6('0x22')](respondWithFilteredResult(_0x4bd78e,_0x4518b9))[_0x89d6('0x2c')](handleError(_0x4bd78e,null));};exports[_0x89d6('0xce')]=function(_0x38a90d,_0x794523,_0x2a0b7d){var _0x356077={'raw':!![],'where':{}};var _0x56e914={};var _0x1d91f1={'count':0x0,'rows':[]};return db[_0x89d6('0x47')][_0x89d6('0xbc')]({'where':{'id':_0x38a90d[_0x89d6('0x6a')]['id']}})[_0x89d6('0x22')](handleEntityNotFound(_0x794523,null))[_0x89d6('0x22')](function(_0x33869f){if(_0x33869f){_0x56e914[_0x89d6('0x51')]=_[_0x89d6('0x4e')](db['ScreenRecording'][_0x89d6('0x48')]);_0x56e914[_0x89d6('0x4f')]=_[_0x89d6('0x4e')](_0x38a90d[_0x89d6('0x4f')]);_0x56e914[_0x89d6('0x57')]=_[_0x89d6('0x50')](_0x56e914[_0x89d6('0x51')],_0x56e914[_0x89d6('0x4f')]);_0x356077[_0x89d6('0x53')]=_['intersection'](_0x56e914[_0x89d6('0x51')],qs['fields'](_0x38a90d[_0x89d6('0x4f')][_0x89d6('0x52')]));_0x356077[_0x89d6('0x53')]=_0x356077['attributes'][_0x89d6('0x64')]?_0x356077[_0x89d6('0x53')]:_0x56e914[_0x89d6('0x51')];if(!_0x38a90d[_0x89d6('0x4f')][_0x89d6('0x54')](_0x89d6('0xc2'))){_0x356077['limit']=qs[_0x89d6('0x32')](_0x38a90d['query'][_0x89d6('0x32')]);_0x356077[_0x89d6('0x31')]=qs[_0x89d6('0x31')](_0x38a90d[_0x89d6('0x4f')][_0x89d6('0x31')]);}_0x356077[_0x89d6('0x55')]=qs[_0x89d6('0x56')](_0x38a90d['query'][_0x89d6('0x56')]);_0x356077['where']=qs[_0x89d6('0x57')](_[_0x89d6('0x58')](_0x38a90d[_0x89d6('0x4f')],_0x56e914[_0x89d6('0x57')]));_0x356077[_0x89d6('0x5a')][_0x89d6('0xcc')]=_0x33869f['id'];if(_0x38a90d[_0x89d6('0x4f')][_0x89d6('0x3e')]){_0x356077[_0x89d6('0x5a')]=_['merge'](_0x356077[_0x89d6('0x5a')],{'$or':_['map'](_0x356077['attributes'],function(_0x32760d){var _0x9e0cc0={};_0x9e0cc0[_0x32760d]={'$like':'%'+_0x38a90d['query']['filter']+'%'};return _0x9e0cc0;})});}_0x356077=_[_0x89d6('0x59')]({},_0x356077,_0x38a90d['options']);return db['ScreenRecording']['count']({'where':_0x356077['where']})['then'](function(_0x4f2160){_0x1d91f1[_0x89d6('0x30')]=_0x4f2160;if(_0x38a90d[_0x89d6('0x4f')]['includeAll']){_0x356077['include']=[{'all':!![]}];}return db[_0x89d6('0xcf')][_0x89d6('0x61')](_0x356077);})['then'](function(_0x22d388){_0x1d91f1[_0x89d6('0x62')]=_0x22d388;return _0x1d91f1;});}})[_0x89d6('0x22')](respondWithFilteredResult(_0x794523,_0x356077))['catch'](handleError(_0x794523,null));};exports[_0x89d6('0xd0')]=function(_0x5a2114,_0x24f3ec,_0x5ce035){var _0x3fb84f={};var _0x31721a={};var _0x4fe7c9;var _0x2d807c;return db['User'][_0x89d6('0xbc')]({'where':{'id':_0x5a2114[_0x89d6('0x6a')]['id']}})['then'](handleEntityNotFound(_0x24f3ec,null))[_0x89d6('0x22')](function(_0x780902){if(_0x780902){_0x4fe7c9=_0x780902;_0x31721a['model']=_[_0x89d6('0x4e')](db[_0x89d6('0xd1')][_0x89d6('0x48')]);_0x31721a[_0x89d6('0x4f')]=_[_0x89d6('0x4e')](_0x5a2114['query']);_0x31721a[_0x89d6('0x57')]=_[_0x89d6('0x50')](_0x31721a[_0x89d6('0x51')],_0x31721a[_0x89d6('0x4f')]);_0x3fb84f[_0x89d6('0x53')]=_[_0x89d6('0x50')](_0x31721a[_0x89d6('0x51')],qs[_0x89d6('0x52')](_0x5a2114[_0x89d6('0x4f')][_0x89d6('0x52')]));_0x3fb84f['attributes']=_0x3fb84f[_0x89d6('0x53')][_0x89d6('0x64')]?_0x3fb84f['attributes']:_0x31721a['model'];_0x3fb84f[_0x89d6('0x55')]=qs[_0x89d6('0x56')](_0x5a2114[_0x89d6('0x4f')][_0x89d6('0x56')]);_0x3fb84f['where']=qs[_0x89d6('0x57')](_['pick'](_0x5a2114['query'],_0x31721a[_0x89d6('0x57')]));if(_0x5a2114['query'][_0x89d6('0x3e')]){_0x3fb84f['where']=_[_0x89d6('0x59')](_0x3fb84f[_0x89d6('0x5a')],{'$or':_[_0x89d6('0x3f')](_0x3fb84f['attributes'],function(_0x2c132b){var _0x30aeee={};_0x30aeee[_0x2c132b]={'$like':'%'+_0x5a2114[_0x89d6('0x4f')][_0x89d6('0x3e')]+'%'};return _0x30aeee;})});}_0x3fb84f=_[_0x89d6('0x59')]({},_0x3fb84f,_0x5a2114[_0x89d6('0x5f')]);return _0x4fe7c9[_0x89d6('0xd0')](_0x3fb84f);}})[_0x89d6('0x22')](function(_0x534306){if(_0x534306){_0x2d807c=_0x534306['length'];if(!_0x5a2114[_0x89d6('0x4f')][_0x89d6('0x54')](_0x89d6('0xc2'))){_0x3fb84f['limit']=qs[_0x89d6('0x32')](_0x5a2114[_0x89d6('0x4f')][_0x89d6('0x32')]);_0x3fb84f[_0x89d6('0x31')]=qs[_0x89d6('0x31')](_0x5a2114[_0x89d6('0x4f')][_0x89d6('0x31')]);}return _0x4fe7c9[_0x89d6('0xd0')](_0x3fb84f);}})['then'](function(_0x2951c6){if(_0x2951c6){return _0x2951c6?{'count':_0x2d807c,'rows':_0x2951c6}:null;}})[_0x89d6('0x22')](respondWithResult(_0x24f3ec,null))[_0x89d6('0x2c')](handleError(_0x24f3ec,null));};exports[_0x89d6('0xd2')]=function(_0x3ea54c,_0x4000b0,_0xd3bc0e){var _0x19b027={};var _0x116961={};var _0x54a5c9;var _0x4c29a9;return db[_0x89d6('0x47')][_0x89d6('0xbc')]({'where':{'id':_0x3ea54c[_0x89d6('0x6a')]['id']}})[_0x89d6('0x22')](handleEntityNotFound(_0x4000b0,null))[_0x89d6('0x22')](function(_0x3e15ef){if(_0x3e15ef){_0x54a5c9=_0x3e15ef;_0x116961[_0x89d6('0x51')]=_[_0x89d6('0x4e')](db[_0x89d6('0xd3')]['rawAttributes']);_0x116961[_0x89d6('0x4f')]=_[_0x89d6('0x4e')](_0x3ea54c[_0x89d6('0x4f')]);_0x116961['filters']=_['intersection'](_0x116961[_0x89d6('0x51')],_0x116961[_0x89d6('0x4f')]);_0x19b027['attributes']=_[_0x89d6('0x50')](_0x116961[_0x89d6('0x51')],qs[_0x89d6('0x52')](_0x3ea54c['query']['fields']));_0x19b027[_0x89d6('0x53')]=_0x19b027['attributes'][_0x89d6('0x64')]?_0x19b027[_0x89d6('0x53')]:_0x116961[_0x89d6('0x51')];_0x19b027[_0x89d6('0x55')]=qs['sort'](_0x3ea54c[_0x89d6('0x4f')][_0x89d6('0x56')]);_0x19b027['where']=qs[_0x89d6('0x57')](_[_0x89d6('0x58')](_0x3ea54c[_0x89d6('0x4f')],_0x116961[_0x89d6('0x57')]));if(_0x3ea54c[_0x89d6('0x4f')]['filter']){_0x19b027[_0x89d6('0x5a')]=_['merge'](_0x19b027[_0x89d6('0x5a')],{'$or':_[_0x89d6('0x3f')](_0x19b027[_0x89d6('0x53')],function(_0x1c27b4){var _0x5d1f29={};_0x5d1f29[_0x1c27b4]={'$like':'%'+_0x3ea54c['query'][_0x89d6('0x3e')]+'%'};return _0x5d1f29;})});}_0x19b027=_[_0x89d6('0x59')]({},_0x19b027,_0x3ea54c[_0x89d6('0x5f')]);return _0x54a5c9[_0x89d6('0xd2')](_0x19b027);}})[_0x89d6('0x22')](function(_0x37a5b8){if(_0x37a5b8){_0x4c29a9=_0x37a5b8['length'];if(!_0x3ea54c[_0x89d6('0x4f')]['hasOwnProperty'](_0x89d6('0xc2'))){_0x19b027[_0x89d6('0x32')]=qs['limit'](_0x3ea54c[_0x89d6('0x4f')][_0x89d6('0x32')]);_0x19b027[_0x89d6('0x31')]=qs['offset'](_0x3ea54c[_0x89d6('0x4f')][_0x89d6('0x31')]);}return _0x54a5c9[_0x89d6('0xd2')](_0x19b027);}})['then'](function(_0x57fb8e){if(_0x57fb8e){return _0x57fb8e?{'count':_0x4c29a9,'rows':_0x57fb8e}:null;}})['then'](respondWithResult(_0x4000b0,null))[_0x89d6('0x2c')](handleError(_0x4000b0,null));};exports[_0x89d6('0xd4')]=function(_0x44efa2,_0xf4891a,_0x4741e6){var _0x31a385={'raw':!![],'where':{}};var _0x133e8d={};var _0x16bc9c={'count':0x0,'rows':[]};return db[_0x89d6('0x47')]['findOne']({'where':{'id':_0x44efa2[_0x89d6('0x6a')]['id']}})[_0x89d6('0x22')](handleEntityNotFound(_0xf4891a,null))[_0x89d6('0x22')](function(_0x310f38){if(_0x310f38){_0x133e8d[_0x89d6('0x51')]=_[_0x89d6('0x4e')](db[_0x89d6('0xd5')]['rawAttributes']);_0x133e8d[_0x89d6('0x4f')]=_[_0x89d6('0x4e')](_0x44efa2[_0x89d6('0x4f')]);_0x133e8d[_0x89d6('0x57')]=_[_0x89d6('0x50')](_0x133e8d[_0x89d6('0x51')],_0x133e8d[_0x89d6('0x4f')]);_0x31a385['attributes']=_[_0x89d6('0x50')](_0x133e8d[_0x89d6('0x51')],qs[_0x89d6('0x52')](_0x44efa2[_0x89d6('0x4f')][_0x89d6('0x52')]));_0x31a385[_0x89d6('0x53')]=_0x31a385[_0x89d6('0x53')]['length']?_0x31a385['attributes']:_0x133e8d[_0x89d6('0x51')];if(!_0x44efa2['query'][_0x89d6('0x54')](_0x89d6('0xc2'))){_0x31a385[_0x89d6('0x32')]=qs[_0x89d6('0x32')](_0x44efa2['query'][_0x89d6('0x32')]);_0x31a385['offset']=qs[_0x89d6('0x31')](_0x44efa2[_0x89d6('0x4f')][_0x89d6('0x31')]);}_0x31a385[_0x89d6('0x55')]=qs[_0x89d6('0x56')](_0x44efa2[_0x89d6('0x4f')][_0x89d6('0x56')]);_0x31a385[_0x89d6('0x5a')]=qs[_0x89d6('0x57')](_[_0x89d6('0x58')](_0x44efa2[_0x89d6('0x4f')],_0x133e8d[_0x89d6('0x57')]));_0x31a385[_0x89d6('0x5a')][_0x89d6('0xcc')]=_0x310f38['id'];if(_0x44efa2[_0x89d6('0x4f')]['filter']){_0x31a385[_0x89d6('0x5a')]=_[_0x89d6('0x59')](_0x31a385[_0x89d6('0x5a')],{'$or':_[_0x89d6('0x3f')](_0x31a385[_0x89d6('0x53')],function(_0x79d002){var _0x583040={};_0x583040[_0x79d002]={'$like':'%'+_0x44efa2[_0x89d6('0x4f')][_0x89d6('0x3e')]+'%'};return _0x583040;})});}_0x31a385=_[_0x89d6('0x59')]({},_0x31a385,_0x44efa2[_0x89d6('0x5f')]);return db['MailInteraction'][_0x89d6('0x30')]({'where':_0x31a385['where']})['then'](function(_0xbcfcde){_0x16bc9c[_0x89d6('0x30')]=_0xbcfcde;if(_0x44efa2[_0x89d6('0x4f')][_0x89d6('0x60')]){_0x31a385[_0x89d6('0xcd')]=[{'all':!![]}];}return db[_0x89d6('0xd5')]['findAll'](_0x31a385);})[_0x89d6('0x22')](function(_0x9a38ed){_0x16bc9c['rows']=_0x9a38ed;return _0x16bc9c;});}})[_0x89d6('0x22')](respondWithFilteredResult(_0xf4891a,_0x31a385))['catch'](handleError(_0xf4891a,null));};exports[_0x89d6('0xd6')]=function(_0x35a328,_0x50bf28,_0x3d0fa4){var _0x2cbb5d={};var _0x3bf524={};var _0x28900e;var _0x21a1e0;return db[_0x89d6('0x47')][_0x89d6('0xbc')]({'where':{'id':_0x35a328['params']['id']}})[_0x89d6('0x22')](handleEntityNotFound(_0x50bf28,null))[_0x89d6('0x22')](function(_0x55d6ee){if(_0x55d6ee){_0x28900e=_0x55d6ee;_0x3bf524[_0x89d6('0x51')]=_[_0x89d6('0x4e')](db[_0x89d6('0xd7')]['rawAttributes']);_0x3bf524[_0x89d6('0x4f')]=_[_0x89d6('0x4e')](_0x35a328[_0x89d6('0x4f')]);_0x3bf524[_0x89d6('0x57')]=_[_0x89d6('0x50')](_0x3bf524[_0x89d6('0x51')],_0x3bf524['query']);_0x2cbb5d[_0x89d6('0x53')]=_['intersection'](_0x3bf524['model'],qs[_0x89d6('0x52')](_0x35a328[_0x89d6('0x4f')][_0x89d6('0x52')]));_0x2cbb5d[_0x89d6('0x53')]=_0x2cbb5d[_0x89d6('0x53')][_0x89d6('0x64')]?_0x2cbb5d[_0x89d6('0x53')]:_0x3bf524[_0x89d6('0x51')];_0x2cbb5d[_0x89d6('0x55')]=qs[_0x89d6('0x56')](_0x35a328[_0x89d6('0x4f')][_0x89d6('0x56')]);_0x2cbb5d[_0x89d6('0x5a')]=qs[_0x89d6('0x57')](_[_0x89d6('0x58')](_0x35a328[_0x89d6('0x4f')],_0x3bf524[_0x89d6('0x57')]));if(_0x35a328[_0x89d6('0x4f')][_0x89d6('0x3e')]){_0x2cbb5d['where']=_[_0x89d6('0x59')](_0x2cbb5d[_0x89d6('0x5a')],{'$or':_[_0x89d6('0x3f')](_0x2cbb5d[_0x89d6('0x53')],function(_0x3973ee){var _0x85ad5b={};_0x85ad5b[_0x3973ee]={'$like':'%'+_0x35a328[_0x89d6('0x4f')]['filter']+'%'};return _0x85ad5b;})});}_0x2cbb5d=_[_0x89d6('0x59')]({},_0x2cbb5d,_0x35a328[_0x89d6('0x5f')]);return _0x28900e[_0x89d6('0xd6')](_0x2cbb5d);}})[_0x89d6('0x22')](function(_0x165468){if(_0x165468){_0x21a1e0=_0x165468[_0x89d6('0x64')];if(!_0x35a328[_0x89d6('0x4f')]['hasOwnProperty'](_0x89d6('0xc2'))){_0x2cbb5d[_0x89d6('0x32')]=qs['limit'](_0x35a328[_0x89d6('0x4f')][_0x89d6('0x32')]);_0x2cbb5d[_0x89d6('0x31')]=qs[_0x89d6('0x31')](_0x35a328[_0x89d6('0x4f')]['offset']);}return _0x28900e[_0x89d6('0xd6')](_0x2cbb5d);}})[_0x89d6('0x22')](function(_0x5e0717){if(_0x5e0717){return _0x5e0717?{'count':_0x21a1e0,'rows':_0x5e0717}:null;}})[_0x89d6('0x22')](respondWithResult(_0x50bf28,null))[_0x89d6('0x2c')](handleError(_0x50bf28,null));};exports['getFaxInteractions']=function(_0x5e00a5,_0x4ef46e,_0x249771){var _0x42b5b1={};var _0x20f518={};var _0x19b35b;var _0x3d7fe3;return db[_0x89d6('0x47')][_0x89d6('0xbc')]({'where':{'id':_0x5e00a5['params']['id']}})[_0x89d6('0x22')](handleEntityNotFound(_0x4ef46e,null))[_0x89d6('0x22')](function(_0x461c44){if(_0x461c44){_0x19b35b=_0x461c44;_0x20f518['model']=_[_0x89d6('0x4e')](db['FaxInteraction'][_0x89d6('0x48')]);_0x20f518[_0x89d6('0x4f')]=_['keys'](_0x5e00a5[_0x89d6('0x4f')]);_0x20f518[_0x89d6('0x57')]=_[_0x89d6('0x50')](_0x20f518[_0x89d6('0x51')],_0x20f518[_0x89d6('0x4f')]);_0x42b5b1[_0x89d6('0x53')]=_[_0x89d6('0x50')](_0x20f518[_0x89d6('0x51')],qs['fields'](_0x5e00a5[_0x89d6('0x4f')]['fields']));_0x42b5b1[_0x89d6('0x53')]=_0x42b5b1['attributes']['length']?_0x42b5b1[_0x89d6('0x53')]:_0x20f518[_0x89d6('0x51')];_0x42b5b1[_0x89d6('0x55')]=qs[_0x89d6('0x56')](_0x5e00a5[_0x89d6('0x4f')][_0x89d6('0x56')]);_0x42b5b1['where']=qs['filters'](_[_0x89d6('0x58')](_0x5e00a5[_0x89d6('0x4f')],_0x20f518['filters']));if(_0x5e00a5[_0x89d6('0x4f')][_0x89d6('0x3e')]){_0x42b5b1[_0x89d6('0x5a')]=_[_0x89d6('0x59')](_0x42b5b1[_0x89d6('0x5a')],{'$or':_[_0x89d6('0x3f')](_0x42b5b1['attributes'],function(_0x323a18){var _0x54716f={};_0x54716f[_0x323a18]={'$like':'%'+_0x5e00a5[_0x89d6('0x4f')][_0x89d6('0x3e')]+'%'};return _0x54716f;})});}_0x42b5b1=_[_0x89d6('0x59')]({},_0x42b5b1,_0x5e00a5[_0x89d6('0x5f')]);return _0x19b35b[_0x89d6('0xd8')](_0x42b5b1);}})[_0x89d6('0x22')](function(_0xbbf5bf){if(_0xbbf5bf){_0x3d7fe3=_0xbbf5bf['length'];if(!_0x5e00a5[_0x89d6('0x4f')][_0x89d6('0x54')]('nolimit')){_0x42b5b1[_0x89d6('0x32')]=qs[_0x89d6('0x32')](_0x5e00a5[_0x89d6('0x4f')][_0x89d6('0x32')]);_0x42b5b1[_0x89d6('0x31')]=qs[_0x89d6('0x31')](_0x5e00a5[_0x89d6('0x4f')][_0x89d6('0x31')]);}return _0x19b35b[_0x89d6('0xd8')](_0x42b5b1);}})[_0x89d6('0x22')](function(_0x39e544){if(_0x39e544){return _0x39e544?{'count':_0x3d7fe3,'rows':_0x39e544}:null;}})[_0x89d6('0x22')](respondWithResult(_0x4ef46e,null))[_0x89d6('0x2c')](handleError(_0x4ef46e,null));};exports['getWhatsappInteractions']=function(_0x3f253e,_0x5d4476,_0x149b22){var _0x5f3c98={};var _0x8e5c42={};var _0xb81bad;var _0x1ea2e1;return db['User'][_0x89d6('0xbc')]({'where':{'id':_0x3f253e[_0x89d6('0x6a')]['id']}})[_0x89d6('0x22')](handleEntityNotFound(_0x5d4476,null))[_0x89d6('0x22')](function(_0x5bfd2e){if(_0x5bfd2e){_0xb81bad=_0x5bfd2e;_0x8e5c42[_0x89d6('0x51')]=_[_0x89d6('0x4e')](db[_0x89d6('0xd9')][_0x89d6('0x48')]);_0x8e5c42[_0x89d6('0x4f')]=_['keys'](_0x3f253e['query']);_0x8e5c42[_0x89d6('0x57')]=_[_0x89d6('0x50')](_0x8e5c42['model'],_0x8e5c42['query']);_0x5f3c98[_0x89d6('0x53')]=_['intersection'](_0x8e5c42[_0x89d6('0x51')],qs[_0x89d6('0x52')](_0x3f253e[_0x89d6('0x4f')][_0x89d6('0x52')]));_0x5f3c98[_0x89d6('0x53')]=_0x5f3c98['attributes'][_0x89d6('0x64')]?_0x5f3c98['attributes']:_0x8e5c42['model'];_0x5f3c98[_0x89d6('0x55')]=qs[_0x89d6('0x56')](_0x3f253e[_0x89d6('0x4f')][_0x89d6('0x56')]);_0x5f3c98[_0x89d6('0x5a')]=qs[_0x89d6('0x57')](_[_0x89d6('0x58')](_0x3f253e[_0x89d6('0x4f')],_0x8e5c42[_0x89d6('0x57')]));if(_0x3f253e[_0x89d6('0x4f')][_0x89d6('0x3e')]){_0x5f3c98[_0x89d6('0x5a')]=_[_0x89d6('0x59')](_0x5f3c98[_0x89d6('0x5a')],{'$or':_[_0x89d6('0x3f')](_0x5f3c98['attributes'],function(_0x398d32){var _0x7b2544={};_0x7b2544[_0x398d32]={'$like':'%'+_0x3f253e['query'][_0x89d6('0x3e')]+'%'};return _0x7b2544;})});}_0x5f3c98=_['merge']({},_0x5f3c98,_0x3f253e['options']);return _0xb81bad[_0x89d6('0xda')](_0x5f3c98);}})[_0x89d6('0x22')](function(_0x1b4513){if(_0x1b4513){_0x1ea2e1=_0x1b4513[_0x89d6('0x64')];if(!_0x3f253e[_0x89d6('0x4f')][_0x89d6('0x54')](_0x89d6('0xc2'))){_0x5f3c98[_0x89d6('0x32')]=qs[_0x89d6('0x32')](_0x3f253e[_0x89d6('0x4f')][_0x89d6('0x32')]);_0x5f3c98[_0x89d6('0x31')]=qs['offset'](_0x3f253e[_0x89d6('0x4f')][_0x89d6('0x31')]);}return _0xb81bad[_0x89d6('0xda')](_0x5f3c98);}})[_0x89d6('0x22')](function(_0x48f3fb){if(_0x48f3fb){return _0x48f3fb?{'count':_0x1ea2e1,'rows':_0x48f3fb}:null;}})['then'](respondWithResult(_0x5d4476,null))[_0x89d6('0x2c')](handleError(_0x5d4476,null));};exports[_0x89d6('0xdb')]=function(_0x420988,_0x25815d,_0x3b6941){var _0x2f8134;var _0x4c352e;var _0x3ea8d1;var _0x322c68=!_[_0x89d6('0x71')](_0x420988[_0x89d6('0x6a')]['id'])?_0x420988[_0x89d6('0x6a')]['id']:!_[_0x89d6('0x71')](_0x420988[_0x89d6('0x3a')]['id'])?_0x420988[_0x89d6('0x3a')]['id']:null;return db[_0x89d6('0x47')][_0x89d6('0x41')]({'where':{'id':_0x322c68,'role':{'$or':[_0x89d6('0x6d'),_0x89d6('0x3a'),_0x89d6('0x3b')]}},'attributes':['id',_0x89d6('0x42'),_0x89d6('0xdc'),'mobile','role',_0x89d6('0x76'),'loginInPause']})[_0x89d6('0x22')](function(_0x1fceee){if(_0x1fceee){if(_0x1fceee[_0x89d6('0x67')]===_0x89d6('0x3b')){_0x2f8134=_0x1fceee;if(_0x420988[_0x89d6('0x66')][_0x89d6('0xa0')]){_0x3ea8d1=util['format']('LOCAL/%s@from-sip/n',_0x2f8134[_0x420988[_0x89d6('0x66')]['interface']]);}else if(_0x420988['body'][_0x89d6('0xdd')]){_0x3ea8d1=util[_0x89d6('0x73')](_0x89d6('0xde'),_0x420988['body']['intrf']);}else{_0x3ea8d1=util[_0x89d6('0x73')]('SIP/%s',_0x2f8134[_0x89d6('0x42')]);}socket['to'](util[_0x89d6('0x73')](_0x89d6('0xdf'),_0x2f8134['name']))['emit'](_0x89d6('0xe0'),{'ip':_0x420988['headers'][_0x89d6('0xe1')]||_0x420988[_0x89d6('0xe2')][_0x89d6('0xe3')]||_0x420988[_0x89d6('0xe4')][_0x89d6('0xe3')]||_0x420988[_0x89d6('0xe2')][_0x89d6('0xe4')][_0x89d6('0xe3')]});return db[_0x89d6('0xaf')]['destroy']({'where':{'membername':_0x2f8134[_0x89d6('0x42')]},'individualHooks':!![]});}}else{throw new db[(_0x89d6('0x1f'))][(_0x89d6('0x20'))](_0x89d6('0xe5'));}})[_0x89d6('0x22')](function(){if(_0x2f8134){return _0x2f8134['getVoiceQueues']({'raw':!![]});}})[_0x89d6('0x22')](function(_0x789e66){if(_0x2f8134){var _0x220d25=[];if(_0x789e66){_0x4c352e=_0x789e66;if(_0x4c352e[_0x89d6('0x64')]){for(var _0x229312=0x0;_0x229312<_0x4c352e[_0x89d6('0x64')];_0x229312++){_0x220d25['push']({'membername':_0x2f8134[_0x89d6('0x42')],'UserId':_0x2f8134['id'],'queue_name':_0x4c352e[_0x229312][_0x89d6('0x42')],'VoiceQueueId':_0x4c352e[_0x229312]['id'],'interface':_0x3ea8d1,'paused':_0x2f8134[_0x89d6('0x9f')]||![],'penalty':_0x4c352e[_0x229312]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x89d6('0xae')](_0x220d25,function(_0x37c2ff){return db['UserVoiceQueueRt'][_0x89d6('0xe6')](_0x37c2ff);});}}}})[_0x89d6('0x22')](function(){if(_0x2f8134){return db[_0x89d6('0xe7')][_0x89d6('0x61')]({'where':{'membername':_0x2f8134[_0x89d6('0x42')],'exitAt':null}});}})[_0x89d6('0x22')](function(_0x55f422){if(_0x2f8134){var _0x3344f3=[];_0x55f422[_0x89d6('0xe8')](function(_0x1eaa2f){_0x3344f3[_0x89d6('0xac')](_0x1eaa2f[_0x89d6('0x37')]({'exitAt':moment()[_0x89d6('0x73')](_0x89d6('0xe9'))}));});return BPromise['all'](_0x3344f3);}})[_0x89d6('0x22')](function(){if(_0x2f8134){var _0x1a938f=[];var _0x53d940=[];var _0x5d6a79=utils[_0x89d6('0xea')]();var _0x146857={'membername':_0x2f8134[_0x89d6('0x42')],'interface':_0x3ea8d1,'enterAt':moment()[_0x89d6('0x73')](_0x89d6('0xe9')),'role':_0x2f8134['role'],'internal':_0x2f8134[_0x89d6('0x76')]};_0x5d6a79['forEach'](function(_0x13d65b){_0x1a938f[_0x89d6('0xac')](_[_0x89d6('0x59')]({'channel':_0x13d65b,'type':'LOGIN','data1':_0x420988['body'][_0x89d6('0xeb')],'data2':_0x3ea8d1},_0x146857));if(_0x2f8134['loginInPause']){_0x53d940[_0x89d6('0xac')](_[_0x89d6('0x59')]({'channel':_0x13d65b,'type':_0x89d6('0xec'),'data1':_0x89d6('0xed')},_0x146857));}});return db[_0x89d6('0xe7')][_0x89d6('0x65')](_0x1a938f['concat'](_0x53d940),{'individualHooks':!![]});}})['then'](function(){if(_0x2f8134){return _0x2f8134[_0x89d6('0x37')]({'online':!![],'lastLoginAt':moment()[_0x89d6('0x73')](_0x89d6('0xe9')),'voicePause':_0x2f8134[_0x89d6('0x9f')]||![],'mailPause':_0x2f8134[_0x89d6('0x9f')]||![],'chatPause':_0x2f8134[_0x89d6('0x9f')]||![],'faxPause':_0x2f8134[_0x89d6('0x9f')]||![],'smsPause':_0x2f8134[_0x89d6('0x9f')]||![],'openchannelPause':_0x2f8134[_0x89d6('0x9f')]||![],'whatsappPause':_0x2f8134[_0x89d6('0x9f')]||![],'pauseType':_0x2f8134[_0x89d6('0x9f')]?_0x89d6('0xed'):null,'interface':_0x3ea8d1,'lastPauseAt':moment()['format'](_0x89d6('0xe9'))});}})[_0x89d6('0x22')](function(_0x117e7f){if(_0x420988[_0x89d6('0xee')]){return _0x3b6941();}else{return BPromise[_0x89d6('0xef')](_0x117e7f)[_0x89d6('0x22')](respondWithResult(_0x25815d,null));}})['catch'](handleError(_0x25815d,null));};exports[_0x89d6('0xf0')]=function(_0xb9f589,_0x10e5a5,_0x5c22c3){var _0x3be6ca;return db[_0x89d6('0x47')][_0x89d6('0x41')]({'where':{'id':_0xb9f589[_0x89d6('0x6a')]['id'],'role':'agent'},'attributes':['id',_0x89d6('0x42'),_0x89d6('0x67')]})[_0x89d6('0x22')](handleEntityNotFound(_0x10e5a5,null))[_0x89d6('0x22')](function(_0x159039){if(_0x159039){_0x3be6ca=_0x159039;return db[_0x89d6('0xaf')][_0x89d6('0x38')]({'where':{'membername':_0x3be6ca[_0x89d6('0x42')]},'individualHooks':!![]});}})['then'](function(){return db[_0x89d6('0xe7')][_0x89d6('0x61')]({'where':{'membername':_0x3be6ca[_0x89d6('0x42')],'exitAt':null}});})[_0x89d6('0x22')](function(_0x1ad753){var _0x5c6b6f=[];_0x1ad753[_0x89d6('0xe8')](function(_0x210f9e){_0x5c6b6f[_0x89d6('0xac')](_0x210f9e[_0x89d6('0x37')]({'exitAt':moment()[_0x89d6('0x73')](_0x89d6('0xe9'))}));});return BPromise[_0x89d6('0xf1')](_0x5c6b6f);})[_0x89d6('0x22')](function(){return _0x3be6ca[_0x89d6('0x37')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x89d6('0x22')](respondWithResult(_0x10e5a5,null))[_0x89d6('0x2c')](handleError(_0x10e5a5,null));};exports[_0x89d6('0xf2')]=function(_0x373274,_0x35fff1,_0x44ac3f){var _0x352604;return db[_0x89d6('0xaf')][_0x89d6('0x37')]({'paused':0x1},{'where':{'UserId':_0x373274['params']['id']},'individualHooks':!![]})[_0x89d6('0x22')](function(){return db[_0x89d6('0x47')]['find']({'where':{'id':_0x373274[_0x89d6('0x6a')]['id'],'role':_0x89d6('0x3b')},'attributes':['id','name',_0x89d6('0x67'),_0x89d6('0x76'),_0x89d6('0xa0')]});})[_0x89d6('0x22')](handleEntityNotFound(_0x35fff1,null))[_0x89d6('0x22')](function(_0xc6d689){if(_0xc6d689){_0x352604=_0xc6d689;return respondWithRpcPromise(_0x89d6('0xf3'),_0x89d6('0xf2'),{'id':_0x352604['id'],'name':_0x352604['name'],'pause':!![]});}})[_0x89d6('0x22')](function(){if(_0x352604){return db[_0x89d6('0xe7')][_0x89d6('0x61')]({'where':{'membername':_0x352604[_0x89d6('0x42')],'type':_0x89d6('0xec'),'exitAt':null}});}})[_0x89d6('0x22')](function(_0x2d866a){if(_0x2d866a['length']){var _0x3a1833=moment()[_0x89d6('0x73')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x31dab6=0x0,_0x378e79=_0x2d866a[_0x89d6('0x64')];_0x31dab6<_0x378e79;_0x31dab6++){_0x2d866a[_0x31dab6]['updateAttributes']({'exitAt':_0x3a1833});}}})[_0x89d6('0x22')](function(){var _0x18ff52=[];var _0x2f88a1=utils[_0x89d6('0xea')]();_0x2f88a1['forEach'](function(_0x1e7ec1){_0x18ff52[_0x89d6('0xac')]({'channel':_0x1e7ec1,'membername':_0x352604[_0x89d6('0x42')],'interface':_[_0x89d6('0x71')](_0x352604[_0x89d6('0xa0')])?util[_0x89d6('0x73')]('SIP/%s',_0x352604[_0x89d6('0x42')]):_0x352604[_0x89d6('0xa0')],'type':_0x89d6('0xec'),'enterAt':moment()[_0x89d6('0x73')](_0x89d6('0xe9')),'data1':_0x373274[_0x89d6('0x66')][_0x89d6('0x4a')]||_0x89d6('0xf4'),'role':_0x352604[_0x89d6('0x67')],'internal':_0x352604[_0x89d6('0x76')]});});return db[_0x89d6('0xe7')]['bulkCreate'](_0x18ff52,{'individualHooks':!![]});})[_0x89d6('0x22')](function(){return _0x352604[_0x89d6('0x37')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x373274[_0x89d6('0x66')][_0x89d6('0x4a')]||_0x89d6('0xf4'),'lastPauseAt':moment()['format'](_0x89d6('0xe9'))});})['then'](respondWithResult(_0x35fff1,null))[_0x89d6('0x2c')](handleError(_0x35fff1,null));};exports['unpause']=function(_0x510cee,_0x1eda05,_0x1577bb){var _0xa5887c;return db[_0x89d6('0x47')]['find']({'where':{'id':_0x510cee[_0x89d6('0x6a')]['id']},'attributes':['id','name','role',_0x89d6('0xad'),'mailPause',_0x89d6('0xf5'),_0x89d6('0xf6'),_0x89d6('0xf7'),'smsPause',_0x89d6('0xf8'),_0x89d6('0xf9'),_0x89d6('0xfa')]})[_0x89d6('0x22')](handleEntityNotFound(_0x1eda05,null))[_0x89d6('0x22')](function(_0x58719e){if(_0x58719e){_0xa5887c=_0x58719e;if(_0x510cee[_0x89d6('0x66')][_0x89d6('0x9e')]&&!utils[_0x89d6('0xa1')](_0x510cee[_0x89d6('0x66')][_0x89d6('0x9e')])){throw new db[(_0x89d6('0x1f'))][(_0x89d6('0x20'))](_0x89d6('0xb0'));}switch(_0x510cee[_0x89d6('0x66')][_0x89d6('0x9e')]){case _0x89d6('0xb2'):return respondWithRpcPromise(_0x89d6('0xf3'),_0x89d6('0xfb'),{'id':_0xa5887c['id'],'name':_0xa5887c[_0x89d6('0x42')],'pause':![]})[_0x89d6('0x22')](function(){return db['UserVoiceQueueRt'][_0x89d6('0x37')]({'paused':0x0},{'where':{'UserId':_0xa5887c['id']},'individualHooks':!![]});})['then'](function(){return db['MemberReport']['find']({'where':{'channel':_0x510cee[_0x89d6('0x66')][_0x89d6('0x9e')],'membername':_0xa5887c['name'],'type':'PAUSE','exitAt':null}});})[_0x89d6('0x22')](function(_0x4888b0){if(_0x4888b0){return _0x4888b0[_0x89d6('0x37')]({'exitAt':moment()['format'](_0x89d6('0xe9')),'data2':_0x89d6('0xfc')},{'individualHooks':!![]});}return null;})[_0x89d6('0x22')](function(){return _0xa5887c[_0x89d6('0x37')]({'voicePause':![]});});case _0x89d6('0xfd'):case'chat':case'fax':case _0x89d6('0xfe'):case'whatsapp':case _0x89d6('0xff'):return db[_0x89d6('0xe7')][_0x89d6('0x41')]({'where':{'channel':_0x510cee[_0x89d6('0x66')]['channel'],'membername':_0xa5887c['name'],'type':'PAUSE','exitAt':null}})[_0x89d6('0x22')](function(_0x22ad3c){if(_0x22ad3c){return _0x22ad3c[_0x89d6('0x37')]({'exitAt':moment()[_0x89d6('0x73')](_0x89d6('0xe9')),'data2':_0x89d6('0xfc')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x1d59f5={};_[_0x89d6('0x33')](_0x1d59f5,util[_0x89d6('0x73')](_0x89d6('0x100'),_0x510cee[_0x89d6('0x66')]['channel'],_0x89d6('0x101')),![]);return _0xa5887c[_0x89d6('0x37')](_0x1d59f5);});default:return respondWithRpcPromise(_0x89d6('0xf3'),_0x89d6('0xfb'),{'id':_0xa5887c['id'],'name':_0xa5887c[_0x89d6('0x42')],'pause':![]})[_0x89d6('0x22')](function(){return db[_0x89d6('0xaf')][_0x89d6('0x37')]({'paused':0x0},{'where':{'UserId':_0xa5887c['id']}});})[_0x89d6('0x22')](function(){return db[_0x89d6('0xe7')][_0x89d6('0x61')]({'where':{'membername':_0xa5887c[_0x89d6('0x42')],'type':_0x89d6('0xec'),'exitAt':null}});})[_0x89d6('0x22')](function(_0x4ee472){var _0x1cf921=[];_0x4ee472[_0x89d6('0xe8')](function(_0x1d9c88){_0x1cf921[_0x89d6('0xac')](_0x1d9c88['update']({'exitAt':moment()['format'](_0x89d6('0xe9')),'data2':_0x89d6('0xfc')}));});return BPromise['all'](_0x1cf921);})['then'](function(){return _0xa5887c[_0x89d6('0x37')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x1eda05,null))[_0x89d6('0x2c')](handleError(_0x1eda05,null));};exports[_0x89d6('0x102')]=function(_0x11847a,_0x289fdb,_0x97c851){var _0x25a5a9={};var _0x18d989={};var _0x1cbd01;var _0x3110e6;return db[_0x89d6('0x47')][_0x89d6('0xbc')]({'where':{'id':_0x11847a[_0x89d6('0x6a')]['id']}})[_0x89d6('0x22')](handleEntityNotFound(_0x289fdb,null))[_0x89d6('0x22')](function(_0x209d0c){if(_0x209d0c){_0x1cbd01=_0x209d0c;_0x18d989['model']=_[_0x89d6('0x4e')](db[_0x89d6('0x103')][_0x89d6('0x48')]);_0x18d989[_0x89d6('0x4f')]=_[_0x89d6('0x4e')](_0x11847a[_0x89d6('0x4f')]);_0x18d989['filters']=_[_0x89d6('0x50')](_0x18d989[_0x89d6('0x51')],_0x18d989[_0x89d6('0x4f')]);_0x25a5a9[_0x89d6('0x53')]=_[_0x89d6('0x50')](_0x18d989[_0x89d6('0x51')],qs['fields'](_0x11847a[_0x89d6('0x4f')]['fields']));_0x25a5a9[_0x89d6('0x53')]=_0x25a5a9['attributes'][_0x89d6('0x64')]?_0x25a5a9[_0x89d6('0x53')]:_0x18d989[_0x89d6('0x51')];_0x25a5a9['order']=qs[_0x89d6('0x56')](_0x11847a[_0x89d6('0x4f')][_0x89d6('0x56')]);_0x25a5a9[_0x89d6('0x5a')]=qs[_0x89d6('0x57')](_[_0x89d6('0x58')](_0x11847a['query'],_0x18d989[_0x89d6('0x57')]));if(_0x11847a[_0x89d6('0x4f')][_0x89d6('0x3e')]){_0x25a5a9[_0x89d6('0x5a')]=_[_0x89d6('0x59')](_0x25a5a9[_0x89d6('0x5a')],{'$or':_['map'](_0x25a5a9[_0x89d6('0x53')],function(_0xe8abc1){var _0x3dcda0={};_0x3dcda0[_0xe8abc1]={'$like':'%'+_0x11847a[_0x89d6('0x4f')][_0x89d6('0x3e')]+'%'};return _0x3dcda0;})});}_0x25a5a9=_[_0x89d6('0x59')]({},_0x25a5a9,_0x11847a['options']);return _0x1cbd01[_0x89d6('0x102')](_0x25a5a9);}})['then'](function(_0xb96b84){if(_0xb96b84){_0x3110e6=_0xb96b84[_0x89d6('0x64')];if(!_0x11847a['query'][_0x89d6('0x54')](_0x89d6('0xc2'))){_0x25a5a9[_0x89d6('0x32')]=qs[_0x89d6('0x32')](_0x11847a['query']['limit']);_0x25a5a9['offset']=qs['offset'](_0x11847a[_0x89d6('0x4f')][_0x89d6('0x31')]);}return _0x1cbd01[_0x89d6('0x102')](_0x25a5a9);}})[_0x89d6('0x22')](function(_0x537183){if(_0x537183){return _0x537183?{'count':_0x3110e6,'rows':_0x537183}:null;}})[_0x89d6('0x22')](respondWithResult(_0x289fdb,null))['catch'](handleError(_0x289fdb,null));};exports[_0x89d6('0x104')]=function(_0x237ac1,_0x5c9f0f){return db[_0x89d6('0x47')]['find']({'where':{'id':_0x237ac1[_0x89d6('0x6a')]['id']}})[_0x89d6('0x22')](handleEntityNotFound(_0x5c9f0f,null))['then'](function(_0x524d48){if(_0x524d48){var _0x48595b=_0x524d48[_0x89d6('0x8f')]({'plain':!![]});return _0x524d48[_0x89d6('0x104')](_0x237ac1['body'][_0x89d6('0x6b')],_['omit'](_0x237ac1[_0x89d6('0x66')],[_0x89d6('0x6b'),'id'])||{})[_0x89d6('0x22')](function(){for(var _0x4c045a=0x0;_0x4c045a<_0x237ac1[_0x89d6('0x66')]['ids'][_0x89d6('0x64')];_0x4c045a++){var _0x567803=[];db[_0x89d6('0x103')][_0x89d6('0xbc')]({'where':{'id':_0x237ac1[_0x89d6('0x66')][_0x89d6('0x6b')][_0x4c045a]}})[_0x89d6('0x22')](function(_0x721207){_0x567803[_0x89d6('0xac')](_0x721207[_0x89d6('0x105')]()[_0x89d6('0x22')](function(_0x20689c){for(var _0xeaa633=0x0;_0xeaa633<_0x20689c[_0x89d6('0x64')];_0xeaa633++){_0x20689c[_0xeaa633][_0x89d6('0x106')](_0x89d6('0x9e'),_0x89d6('0x107'));}return _0x20689c;}));_0x567803[_0x89d6('0xac')](_0x721207['getChatQueues']()[_0x89d6('0x22')](function(_0x28308b){for(var _0x270585=0x0;_0x270585<_0x28308b[_0x89d6('0x64')];_0x270585++){_0x28308b[_0x270585][_0x89d6('0x106')]('channel',_0x89d6('0x108'));}return _0x28308b;}));_0x567803['push'](_0x721207[_0x89d6('0x109')]()[_0x89d6('0x22')](function(_0x122614){for(var _0x1d4260=0x0;_0x1d4260<_0x122614[_0x89d6('0x64')];_0x1d4260++){_0x122614[_0x1d4260][_0x89d6('0x106')](_0x89d6('0x9e'),_0x89d6('0x10a'));}return _0x122614;}));_0x567803['push'](_0x721207['getSmsQueues']()[_0x89d6('0x22')](function(_0x5f2f35){for(var _0x1f8c14=0x0;_0x1f8c14<_0x5f2f35[_0x89d6('0x64')];_0x1f8c14++){_0x5f2f35[_0x1f8c14][_0x89d6('0x106')](_0x89d6('0x9e'),_0x89d6('0x10b'));}return _0x5f2f35;}));_0x567803[_0x89d6('0xac')](_0x721207[_0x89d6('0x10c')]()[_0x89d6('0x22')](function(_0x36ea62){for(var _0x44a693=0x0;_0x44a693<_0x36ea62['length'];_0x44a693++){_0x36ea62[_0x44a693][_0x89d6('0x106')](_0x89d6('0x9e'),_0x89d6('0x10d'));}return _0x36ea62;}));_0x567803[_0x89d6('0xac')](_0x721207['getFaxQueues']()['then'](function(_0x105163){for(var _0x4efdda=0x0;_0x4efdda<_0x105163[_0x89d6('0x64')];_0x4efdda++){_0x105163[_0x4efdda][_0x89d6('0x106')](_0x89d6('0x9e'),_0x89d6('0x10e'));}return _0x105163;}));_0x567803[_0x89d6('0xac')](_0x721207[_0x89d6('0x10f')]()[_0x89d6('0x22')](function(_0x11c9d1){for(var _0x563709=0x0;_0x563709<_0x11c9d1['length'];_0x563709++){_0x11c9d1[_0x563709]['setDataValue'](_0x89d6('0x9e'),_0x89d6('0x110'));}return _0x11c9d1;}));return BPromise[_0x89d6('0xf1')](_0x567803);})[_0x89d6('0x22')](function(_0x4fed9d){var _0x65acf4=_[_0x89d6('0x111')](_0x4fed9d);_0x567803=[];return db[_0x89d6('0x5c')][_0x89d6('0x112')](function(_0x5de938){for(var _0xdafaf0=0x0;_0xdafaf0<_0x65acf4['length'];_0xdafaf0++){_0x567803[_0x89d6('0xac')](_0x65acf4[_0xdafaf0][_0x89d6('0x113')](_0x48595b['id']),{'transaction':_0x5de938});}return BPromise['all'](_0x567803)['then'](function(){if(_0x48595b[_0x89d6('0x114')]){return BPromise['each'](_['filter'](_0x65acf4,function(_0xf57ee9){return _0xf57ee9[_0x89d6('0x115')](_0x89d6('0x9e'))==='Voice';}),function(_0x382570){return db[_0x89d6('0xaf')]['upsert']({'membername':_0x48595b[_0x89d6('0x42')],'UserId':_0x48595b['id'],'queue_name':_0x382570[_0x89d6('0x42')],'VoiceQueueId':_0x382570['id'],'interface':_[_0x89d6('0x71')](_0x48595b['interface'])?util['format']('SIP/%s',_0x48595b[_0x89d6('0x42')]):_0x48595b[_0x89d6('0xa0')],'paused':_0x48595b[_0x89d6('0xad')]||![],'penalty':_0x48595b['penalty']},{'transaction':_0x5de938});});}else{return;}})[_0x89d6('0x22')](function(){for(var _0x537a1a=0x0;_0x537a1a<_0x65acf4[_0x89d6('0x64')];_0x537a1a++){var _0x5d61a8=_0x65acf4[_0x537a1a][_0x89d6('0x115')](_0x89d6('0x9e'));var _0x4714a0=_0x5d61a8+'QueueId';socket['emit'](_0x89d6('0x3a')+_0x5d61a8+_0x89d6('0xaa'),{'UserId':_0x48595b['id'],['queueField']:_0x65acf4[_0x537a1a]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x5c9f0f,null))[_0x89d6('0x2c')](handleError(_0x5c9f0f,null));};exports[_0x89d6('0x116')]=function(_0x3775ab,_0x5c6289){return db[_0x89d6('0x47')][_0x89d6('0xbc')]({'where':{'id':_0x3775ab[_0x89d6('0x6a')]['id']}})['then'](handleEntityNotFound(_0x5c6289,null))[_0x89d6('0x22')](function(_0x356576){if(_0x356576){var _0xe3af57=_0x356576[_0x89d6('0x8f')]({'plain':!![]});var _0x5784c9=_0x3775ab[_0x89d6('0x4f')][_0x89d6('0x6b')];return _0x356576[_0x89d6('0x116')](_0x5784c9)[_0x89d6('0x22')](function(){for(var _0x20c041=0x0;_0x20c041<_0x5784c9['length'];_0x20c041++){var _0x4a7bed=[];db[_0x89d6('0x103')][_0x89d6('0xbc')]({'where':{'id':_0x5784c9[_0x20c041]}})[_0x89d6('0x22')](function(_0x148971){_0x4a7bed[_0x89d6('0xac')](_0x148971[_0x89d6('0x105')]()[_0x89d6('0x22')](function(_0x45ed85){for(var _0x3825e9=0x0;_0x3825e9<_0x45ed85[_0x89d6('0x64')];_0x3825e9++){_0x45ed85[_0x3825e9][_0x89d6('0x106')](_0x89d6('0x9e'),'Voice');}return _0x45ed85;}));_0x4a7bed[_0x89d6('0xac')](_0x148971['getChatQueues']()['then'](function(_0x3dc01a){for(var _0x34821e=0x0;_0x34821e<_0x3dc01a[_0x89d6('0x64')];_0x34821e++){_0x3dc01a[_0x34821e][_0x89d6('0x106')](_0x89d6('0x9e'),_0x89d6('0x108'));}return _0x3dc01a;}));_0x4a7bed['push'](_0x148971[_0x89d6('0x109')]()['then'](function(_0x2ab648){for(var _0x4a3ddb=0x0;_0x4a3ddb<_0x2ab648[_0x89d6('0x64')];_0x4a3ddb++){_0x2ab648[_0x4a3ddb][_0x89d6('0x106')](_0x89d6('0x9e'),_0x89d6('0x10a'));}return _0x2ab648;}));_0x4a7bed['push'](_0x148971[_0x89d6('0x117')]()['then'](function(_0x40d5a5){for(var _0x46b2b7=0x0;_0x46b2b7<_0x40d5a5['length'];_0x46b2b7++){_0x40d5a5[_0x46b2b7][_0x89d6('0x106')]('channel','Sms');}return _0x40d5a5;}));_0x4a7bed[_0x89d6('0xac')](_0x148971['getWhatsappQueues']()[_0x89d6('0x22')](function(_0xd4db6e){for(var _0x5497d0=0x0;_0x5497d0<_0xd4db6e['length'];_0x5497d0++){_0xd4db6e[_0x5497d0]['setDataValue'](_0x89d6('0x9e'),_0x89d6('0x10d'));}return _0xd4db6e;}));_0x4a7bed[_0x89d6('0xac')](_0x148971[_0x89d6('0x118')]()[_0x89d6('0x22')](function(_0x8f402c){for(var _0x4fdcc9=0x0;_0x4fdcc9<_0x8f402c[_0x89d6('0x64')];_0x4fdcc9++){_0x8f402c[_0x4fdcc9]['setDataValue']('channel',_0x89d6('0x10e'));}return _0x8f402c;}));_0x4a7bed[_0x89d6('0xac')](_0x148971[_0x89d6('0x10f')]()[_0x89d6('0x22')](function(_0x2b7444){for(var _0x7148a7=0x0;_0x7148a7<_0x2b7444['length'];_0x7148a7++){_0x2b7444[_0x7148a7][_0x89d6('0x106')]('channel','Openchannel');}return _0x2b7444;}));return BPromise[_0x89d6('0xf1')](_0x4a7bed);})[_0x89d6('0x22')](function(_0x2717ff){var _0x1e5e1f=_[_0x89d6('0x111')](_0x2717ff);_0x4a7bed=[];return db[_0x89d6('0x5c')]['transaction'](function(_0x1743f0){for(var _0x494382=0x0;_0x494382<_0x1e5e1f['length'];_0x494382++){_0x4a7bed[_0x89d6('0xac')](_0x1e5e1f[_0x494382][_0x89d6('0x119')](_0xe3af57['id']),{'transaction':_0x1743f0});}return BPromise[_0x89d6('0xf1')](_0x4a7bed)[_0x89d6('0x22')](function(){if(_0xe3af57['online']){return BPromise[_0x89d6('0xae')](_[_0x89d6('0x3e')](_0x1e5e1f,function(_0xd7c933){return _0xd7c933[_0x89d6('0x115')](_0x89d6('0x9e'))===_0x89d6('0x107');}),function(_0x2930ba){return db['UserVoiceQueueRt'][_0x89d6('0x38')]({'where':{'VoiceQueueId':_0x2930ba['id'],'UserId':_0xe3af57['id']},'transaction':_0x1743f0});});}else{return;}})[_0x89d6('0x22')](function(){for(var _0x44e079=0x0;_0x44e079<_0x1e5e1f['length'];_0x44e079++){var _0x45900f=_0x1e5e1f[_0x44e079][_0x89d6('0x115')](_0x89d6('0x9e'));var _0x4fcc63=_0x45900f+'QueueId';socket[_0x89d6('0xa9')]('user'+_0x45900f+_0x89d6('0xb1'),{'UserId':_0xe3af57['id'],['queueField']:_0x1e5e1f[_0x44e079]['id']});}});});});}});}})[_0x89d6('0x22')](respondWithStatusCode(_0x5c6289,null))[_0x89d6('0x2c')](handleError(_0x5c6289,null));};exports[_0x89d6('0x11a')]=function(_0x2e5bd6,_0x19c2a9,_0x268ffc){var _0x60c33={};var _0x1a7a1a={};var _0x5d19a8;var _0x134db2;return db[_0x89d6('0x47')][_0x89d6('0xbc')]({'where':{'id':_0x2e5bd6[_0x89d6('0x6a')]['id']}})[_0x89d6('0x22')](handleEntityNotFound(_0x19c2a9,null))[_0x89d6('0x22')](function(_0x1452ab){if(_0x1452ab){_0x5d19a8=_0x1452ab;_0x1a7a1a[_0x89d6('0x51')]=_[_0x89d6('0x4e')](db[_0x89d6('0xbe')][_0x89d6('0x48')]);_0x1a7a1a['query']=_[_0x89d6('0x4e')](_0x2e5bd6['query']);_0x1a7a1a[_0x89d6('0x57')]=_[_0x89d6('0x50')](_0x1a7a1a[_0x89d6('0x51')],_0x1a7a1a[_0x89d6('0x4f')]);_0x60c33[_0x89d6('0x53')]=_[_0x89d6('0x50')](_0x1a7a1a['model'],qs['fields'](_0x2e5bd6[_0x89d6('0x4f')][_0x89d6('0x52')]));_0x60c33[_0x89d6('0x53')]=_0x60c33[_0x89d6('0x53')]['length']?_0x60c33[_0x89d6('0x53')]:_0x1a7a1a[_0x89d6('0x51')];_0x60c33[_0x89d6('0x55')]=qs[_0x89d6('0x56')](_0x2e5bd6[_0x89d6('0x4f')][_0x89d6('0x56')]);_0x60c33[_0x89d6('0x5a')]=qs['filters'](_[_0x89d6('0x58')](_0x2e5bd6[_0x89d6('0x4f')],_0x1a7a1a[_0x89d6('0x57')]));if(_0x2e5bd6[_0x89d6('0x4f')]['filter']){_0x60c33[_0x89d6('0x5a')]=_[_0x89d6('0x59')](_0x60c33[_0x89d6('0x5a')],{'$or':_[_0x89d6('0x3f')](_0x60c33[_0x89d6('0x53')],function(_0x1cb612){var _0x4312c9={};_0x4312c9[_0x1cb612]={'$like':'%'+_0x2e5bd6[_0x89d6('0x4f')][_0x89d6('0x3e')]+'%'};return _0x4312c9;})});}_0x60c33=_[_0x89d6('0x59')]({},_0x60c33,_0x2e5bd6[_0x89d6('0x5f')]);return _0x5d19a8['getLists'](_0x60c33);}})[_0x89d6('0x22')](function(_0x1552b8){if(_0x1552b8){_0x134db2=_0x1552b8[_0x89d6('0x64')];if(!_0x2e5bd6[_0x89d6('0x4f')]['hasOwnProperty'](_0x89d6('0xc2'))){_0x60c33[_0x89d6('0x32')]=qs[_0x89d6('0x32')](_0x2e5bd6[_0x89d6('0x4f')][_0x89d6('0x32')]);_0x60c33[_0x89d6('0x31')]=qs[_0x89d6('0x31')](_0x2e5bd6[_0x89d6('0x4f')][_0x89d6('0x31')]);}return _0x5d19a8[_0x89d6('0x11a')](_0x60c33);}})[_0x89d6('0x22')](function(_0x5e3572){if(_0x5e3572){return _0x5e3572?{'count':_0x134db2,'rows':_0x5e3572}:null;}})[_0x89d6('0x22')](respondWithResult(_0x19c2a9,null))[_0x89d6('0x2c')](handleError(_0x19c2a9,null));};exports['getAgents']=function(_0x40fe13,_0x5f18c8,_0x19e5ae){var _0x460d9f={};var _0x49284d={};var _0x19bdbe;var _0x1bd3b6;return db[_0x89d6('0x47')][_0x89d6('0xbc')]({'where':{'id':_0x40fe13[_0x89d6('0x6a')]['id']}})[_0x89d6('0x22')](handleEntityNotFound(_0x5f18c8,null))['then'](function(_0xf994a3){if(_0xf994a3){_0x19bdbe=_0xf994a3;_0x49284d[_0x89d6('0x51')]=_[_0x89d6('0x4e')](db['User'][_0x89d6('0x48')]);_0x49284d[_0x89d6('0x4f')]=_[_0x89d6('0x4e')](_0x40fe13['query']);_0x49284d[_0x89d6('0x57')]=_[_0x89d6('0x50')](_0x49284d[_0x89d6('0x51')],_0x49284d[_0x89d6('0x4f')]);_0x460d9f['attributes']=_[_0x89d6('0x50')](_0x49284d[_0x89d6('0x51')],qs[_0x89d6('0x52')](_0x40fe13[_0x89d6('0x4f')][_0x89d6('0x52')]));_0x460d9f[_0x89d6('0x53')]=_0x460d9f[_0x89d6('0x53')][_0x89d6('0x64')]?_0x460d9f['attributes']:_0x49284d[_0x89d6('0x51')];_0x460d9f[_0x89d6('0x55')]=qs[_0x89d6('0x56')](_0x40fe13[_0x89d6('0x4f')]['sort']);_0x460d9f[_0x89d6('0x5a')]=qs[_0x89d6('0x57')](_[_0x89d6('0x58')](_0x40fe13[_0x89d6('0x4f')],_0x49284d[_0x89d6('0x57')]));if(_0x40fe13[_0x89d6('0x4f')][_0x89d6('0x3e')]){_0x460d9f['where']=_['merge'](_0x460d9f[_0x89d6('0x5a')],{'$or':_['map'](_0x460d9f[_0x89d6('0x53')],function(_0x50e660){var _0x210355={};_0x210355[_0x50e660]={'$like':'%'+_0x40fe13[_0x89d6('0x4f')]['filter']+'%'};return _0x210355;})});}_0x460d9f[_0x89d6('0x51')]=db[_0x89d6('0x47')];_0x460d9f['as']=_0x89d6('0x11b');_0x460d9f=_[_0x89d6('0x59')]({},_0x460d9f,_0x40fe13['options']);return _0x19bdbe[_0x89d6('0x105')]({'include':[_0x460d9f]});}})[_0x89d6('0x22')](function(_0x24e22a){if(_0x24e22a){var _0x5a7076={},_0x3bc717=[],_0x52a478=0x0;for(var _0x51455d=0x0;_0x51455d<_0x24e22a[_0x89d6('0x64')];_0x51455d+=0x1){for(var _0xdcf80=0x0,_0x3fb224;_0xdcf80<_0x24e22a[_0x51455d]['Agents']['length'];_0xdcf80+=0x1){_0x3fb224=_0x24e22a[_0x51455d][_0x89d6('0x11b')][_0xdcf80]['get']({'plain':!![]});_0x5a7076[_0x3fb224['id']]=_0x3fb224;}}_0x5a7076=_['values'](_0x5a7076);for(var _0x442d6f=qs[_0x89d6('0x31')](_0x40fe13['query'][_0x89d6('0x31')]);_0x442d6f<_0x5a7076[_0x89d6('0x64')]&&_0x3bc717[_0x89d6('0x64')]=_0x3683bf[_0x6098('0x54')]){throw new Error(_0x6098('0x55'));}})[_0x6098('0x11')](function(){if(_0x2b3173){return db[_0x6098('0x2a')][_0x6098('0x4c')]({'where':{'membername':_0x2b3173['name']},'individualHooks':!![]});}})[_0x6098('0x11')](function(){if(_0x2b3173){return _0x2b3173[_0x6098('0x56')]({'raw':!![]});}})[_0x6098('0x11')](function(_0x47973a){if(_0x2b3173){if(_0x47973a){var _0x264331=[];_0x34d39f=_0x47973a;if(_0x34d39f[_0x6098('0x2c')]){for(var _0x35a8c5=0x0;_0x35a8c5<_0x34d39f['length'];_0x35a8c5++){_0x264331['push'](db[_0x6098('0x2a')]['upsert']({'membername':_0x2b3173['name'],'UserId':_0x2b3173['id'],'queue_name':_0x34d39f[_0x35a8c5][_0x6098('0x28')],'VoiceQueueId':_0x34d39f[_0x35a8c5]['id'],'interface':_0x230824,'paused':_0x2b3173['loginInPause']||![],'penalty':_0x34d39f[_0x35a8c5]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x6098('0x4a')](_0x264331);}}}})[_0x6098('0x11')](function(){if(_0x2b3173){return db['MemberReport'][_0x6098('0x1b')]({'where':{'membername':_0x2b3173['name'],'exitAt':null}});}})[_0x6098('0x11')](function(_0x215c02){if(_0x2b3173){if(_0x215c02&&_0x215c02[_0x6098('0x2c')]){var _0x5a4fa9=[];_0x215c02[_0x6098('0x30')](function(_0x2d6e6e){_0x5a4fa9[_0x6098('0x49')](_0x2d6e6e[_0x6098('0x3b')]({'exitAt':moment()[_0x6098('0x2d')](_0x6098('0x34'))}));});return BPromise[_0x6098('0x4a')](_0x5a4fa9);}}})['then'](function(_0x190cd0){if(_0x2b3173){var _0x23af12=[];var _0x3997d0=[];var _0x46e7e8=utils[_0x6098('0x2f')]();var _0x54fafd={'membername':_0x2b3173[_0x6098('0x28')],'interface':_0x230824,'enterAt':moment()[_0x6098('0x2d')](_0x6098('0x34')),'role':_0x2b3173['role'],'internal':_0x2b3173[_0x6098('0x39')]};_0x46e7e8['forEach'](function(_0x41e99a){_0x23af12[_0x6098('0x49')](_[_0x6098('0x57')]({'channel':_0x41e99a,'type':_0x6098('0x58'),'data1':'callysquare','data2':_0x230824},_0x54fafd));if(_0x2b3173[_0x6098('0x59')]){_0x3997d0[_0x6098('0x49')](_[_0x6098('0x57')]({'channel':_0x41e99a,'type':_0x6098('0x33'),'data1':'LOGININPAUSE'},_0x54fafd));}});return db[_0x6098('0x2b')]['bulkCreate'](_0x23af12[_0x6098('0x5a')](_0x3997d0),{'individualHooks':!![]});}})['then'](function(){if(_0x2b3173){return _0x2b3173[_0x6098('0x3b')]({'online':!![],'lastLoginAt':moment()['format'](_0x6098('0x34')),'voicePause':_0x2b3173[_0x6098('0x59')]||![],'mailPause':_0x2b3173[_0x6098('0x59')]||![],'chatPause':_0x2b3173[_0x6098('0x59')]||![],'faxPause':_0x2b3173[_0x6098('0x59')]||![],'smsPause':_0x2b3173['loginInPause']||![],'openchannelPause':_0x2b3173[_0x6098('0x59')]||![],'pauseType':_0x2b3173[_0x6098('0x59')]?_0x6098('0x5b'):null,'lastPauseAt':moment()['format'](_0x6098('0x34')),'interface':_0x230824});}})[_0x6098('0x11')](function(_0x3f7f00){_0x3f8c0f(_0x3f7f00);})[_0x6098('0x24')](function(_0x53d554){_0x266c0f(_0xc79a37[_0x6098('0x16')](0x1f4,_0x53d554[_0x6098('0x17')]));});});}; \ No newline at end of file +var _0x219c=['rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./user.socket','register','request','then','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetUser','User','findAll','options','raw','attributes','limit','include','map','model','ShowUser','find','where','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','body','uniqueid','bulkCreate','type','DEFAULT\x20PAUSE','UnpauseUser','channel','isValidChannel','voice','system','mail','chat','fax','sms','openchannel','set','%s%s','Pause','LogoutUser','findOne','mobile','phone','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','all','merge','LOGIN','LOGININPAUSE','concat','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x41cd5d,_0x381c97){var _0x4a5cec=function(_0x270d00){while(--_0x270d00){_0x41cd5d['push'](_0x41cd5d['shift']());}};_0x4a5cec(++_0x381c97);}(_0x219c,0xbc));var _0xc219=function(_0x36daa7,_0x431951){_0x36daa7=_0x36daa7-0x0;var _0x5c0810=_0x219c[_0x36daa7];return _0x5c0810;};'use strict';var _=require(_0xc219('0x0'));var util=require('util');var moment=require(_0xc219('0x1'));var BPromise=require(_0xc219('0x2'));var rs=require(_0xc219('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc219('0x4'))['db'];var utils=require(_0xc219('0x5'));var logger=require('../../config/logger')(_0xc219('0x6'));var config=require('../../config/environment');var jayson=require(_0xc219('0x7'));var client=jayson[_0xc219('0x8')][_0xc219('0x9')]({'port':0x232a});config['redis']=_[_0xc219('0xa')](config[_0xc219('0xb')],{'host':_0xc219('0xc'),'port':0x18eb});var socket=require(_0xc219('0xd'))(new Redis(config[_0xc219('0xb')]));require(_0xc219('0xe'))[_0xc219('0xf')](socket);function respondWithRpcPromise(_0x585a7a,_0x1cdf84,_0x4ce0d3){return new BPromise(function(_0x55ff53,_0x351c0f){return client[_0xc219('0x10')](_0x585a7a,_0x4ce0d3)[_0xc219('0x11')](function(_0x2bfa52){logger['info'](_0xc219('0x12'),_0x1cdf84,'request\x20sent');logger[_0xc219('0x13')](_0xc219('0x14'),_0x1cdf84,_0xc219('0x15'),JSON[_0xc219('0x16')](_0x2bfa52));if(_0x2bfa52[_0xc219('0x17')]){if(_0x2bfa52[_0xc219('0x17')][_0xc219('0x18')]===0x1f4){logger['error'](_0xc219('0x12'),_0x1cdf84,_0x2bfa52[_0xc219('0x17')][_0xc219('0x19')]);return _0x351c0f(_0x2bfa52[_0xc219('0x17')][_0xc219('0x19')]);}logger['error'](_0xc219('0x12'),_0x1cdf84,_0x2bfa52[_0xc219('0x17')][_0xc219('0x19')]);return _0x55ff53(_0x2bfa52[_0xc219('0x17')][_0xc219('0x19')]);}else{logger[_0xc219('0x1a')]('User,\x20%s,\x20%s',_0x1cdf84,_0xc219('0x15'));_0x55ff53(_0x2bfa52[_0xc219('0x1b')][_0xc219('0x19')]);}})[_0xc219('0x1c')](function(_0x37cf64){logger['error']('User,\x20%s,\x20%s',_0x1cdf84,_0x37cf64);_0x351c0f(_0x37cf64);});});}exports[_0xc219('0x1d')]=function(_0x418562){var _0x2a9cff=this;return new Promise(function(_0x1a9ecd,_0x31d188){return db[_0xc219('0x1e')][_0xc219('0x1f')]({'raw':_0x418562['options']?_0x418562[_0xc219('0x20')][_0xc219('0x21')]===undefined?!![]:![]:!![],'where':_0x418562[_0xc219('0x20')]?_0x418562[_0xc219('0x20')]['where']||null:null,'attributes':_0x418562[_0xc219('0x20')]?_0x418562[_0xc219('0x20')][_0xc219('0x22')]||null:null,'limit':_0x418562[_0xc219('0x20')]?_0x418562['options'][_0xc219('0x23')]||null:null,'include':_0x418562[_0xc219('0x20')]?_0x418562[_0xc219('0x20')][_0xc219('0x24')]?_[_0xc219('0x25')](_0x418562[_0xc219('0x20')][_0xc219('0x24')],function(_0x59f253){return{'model':db[_0x59f253[_0xc219('0x26')]],'as':_0x59f253['as'],'attributes':_0x59f253['attributes'],'include':_0x59f253[_0xc219('0x24')]?_[_0xc219('0x25')](_0x59f253['include'],function(_0x39121f){return{'model':db[_0x39121f[_0xc219('0x26')]],'as':_0x39121f['as'],'attributes':_0x39121f[_0xc219('0x22')],'include':_0x39121f[_0xc219('0x24')]?_[_0xc219('0x25')](_0x39121f[_0xc219('0x24')],function(_0x51cf1e){return{'model':db[_0x51cf1e[_0xc219('0x26')]],'as':_0x51cf1e['as'],'attributes':_0x51cf1e[_0xc219('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc219('0x11')](function(_0x299028){logger[_0xc219('0x1a')]('GetUser',_0x418562);logger[_0xc219('0x13')](_0xc219('0x1d'),_0x418562,JSON[_0xc219('0x16')](_0x299028));_0x1a9ecd(_0x299028);})[_0xc219('0x1c')](function(_0x116723){logger[_0xc219('0x17')](_0xc219('0x1d'),_0x116723[_0xc219('0x19')],_0x418562);_0x31d188(_0x2a9cff[_0xc219('0x17')](0x1f4,_0x116723[_0xc219('0x19')]));});});};exports[_0xc219('0x27')]=function(_0x308f13){var _0x5d700c=this;return new Promise(function(_0x46381c,_0x2d059f){return db[_0xc219('0x1e')][_0xc219('0x28')]({'raw':_0x308f13[_0xc219('0x20')]?_0x308f13['options'][_0xc219('0x21')]===undefined?!![]:![]:!![],'where':_0x308f13[_0xc219('0x20')]?_0x308f13[_0xc219('0x20')]['where']||null:null,'attributes':_0x308f13[_0xc219('0x20')]?_0x308f13['options'][_0xc219('0x22')]||null:null,'include':_0x308f13[_0xc219('0x20')]?_0x308f13[_0xc219('0x20')][_0xc219('0x24')]?_[_0xc219('0x25')](_0x308f13[_0xc219('0x20')]['include'],function(_0xe4dac7){return{'model':db[_0xe4dac7[_0xc219('0x26')]],'as':_0xe4dac7['as'],'attributes':_0xe4dac7[_0xc219('0x22')],'include':_0xe4dac7[_0xc219('0x24')]?_['map'](_0xe4dac7['include'],function(_0x4d06ab){return{'model':db[_0x4d06ab[_0xc219('0x26')]],'as':_0x4d06ab['as'],'attributes':_0x4d06ab['attributes'],'include':_0x4d06ab[_0xc219('0x24')]?_['map'](_0x4d06ab['include'],function(_0x1509f7){return{'model':db[_0x1509f7[_0xc219('0x26')]],'as':_0x1509f7['as'],'attributes':_0x1509f7[_0xc219('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc219('0x11')](function(_0x5f422c){logger[_0xc219('0x1a')]('ShowUser',_0x308f13);logger[_0xc219('0x13')]('ShowUser',_0x308f13,JSON[_0xc219('0x16')](_0x5f422c));_0x46381c(_0x5f422c);})['catch'](function(_0xfa72b0){logger['error'](_0xc219('0x27'),_0xfa72b0[_0xc219('0x19')],_0x308f13);_0x2d059f(_0x5d700c[_0xc219('0x17')](0x1f4,_0xfa72b0['message']));});});};exports['PauseUser']=function(_0x4c720d){var _0x488cec=this;return new Promise(function(_0x3baca4,_0x1fe525){var _0x302d78;return db[_0xc219('0x1e')]['find']({'where':_0x4c720d['options'][_0xc219('0x29')]||{},'attributes':['id',_0xc219('0x2a'),_0xc219('0x2b'),_0xc219('0x2c'),_0xc219('0x2d')]})[_0xc219('0x11')](function(_0x246f76){if(_0x246f76){_0x302d78=_0x246f76;return db[_0xc219('0x2e')][_0xc219('0x2f')]({'paused':0x1},{'where':{'UserId':_0x302d78['id']},'individualHooks':!![]});}})[_0xc219('0x11')](function(){if(_0x302d78){return db[_0xc219('0x30')][_0xc219('0x1f')]({'where':{'membername':_0x302d78[_0xc219('0x2a')],'type':_0xc219('0x31'),'exitAt':null}});}})[_0xc219('0x11')](function(_0x1fbdcf){if(_0x302d78){if(_0x1fbdcf&&_0x1fbdcf[_0xc219('0x32')]){var _0x1e7318=moment()[_0xc219('0x33')](_0xc219('0x34'));for(var _0x3e01e1=0x0,_0x2718f1=_0x1fbdcf[_0xc219('0x32')];_0x3e01e1<_0x2718f1;_0x3e01e1++){_0x1fbdcf[_0x3e01e1][_0xc219('0x35')]({'exitAt':_0x1e7318});}}}})[_0xc219('0x11')](function(){if(_0x302d78){var _0xeae357=[];var _0x3aeaad=utils[_0xc219('0x36')]();_0x3aeaad[_0xc219('0x37')](function(_0x566898){_0xeae357[_0xc219('0x38')]({'channel':_0x566898,'membername':_0x302d78['name'],'interface':_[_0xc219('0x39')](_0x302d78[_0xc219('0x2d')])?util['format'](_0xc219('0x3a'),_0x302d78[_0xc219('0x2a')]):_0x302d78['interface'],'type':'PAUSE','enterAt':moment()[_0xc219('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4c720d['body']['type']||'DEFAULT\x20PAUSE','role':_0x302d78['role'],'internal':_0x302d78['internal'],'uniqueid':_0x4c720d[_0xc219('0x3b')][_0xc219('0x3c')]||null});});return db[_0xc219('0x30')][_0xc219('0x3d')](_0xeae357,{'individualHooks':!![]});}})['then'](function(){if(_0x302d78){return _0x302d78[_0xc219('0x2f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x4c720d[_0xc219('0x3b')][_0xc219('0x3e')]||_0xc219('0x3f'),'lastPauseAt':moment()[_0xc219('0x33')](_0xc219('0x34'))});}})['then'](function(_0x2e2fa2){_0x3baca4(_0x2e2fa2);})[_0xc219('0x1c')](function(_0x2a3023){_0x1fe525(_0x488cec[_0xc219('0x17')](0x1f4,_0x2a3023[_0xc219('0x19')]));});});};exports[_0xc219('0x40')]=function(_0x17fc1d){var _0x378c00=this;return new Promise(function(_0x4603fb,_0x13d306){var _0x415e93;return db[_0xc219('0x1e')]['findOne']({'where':_0x17fc1d[_0xc219('0x20')][_0xc219('0x29')]||{},'attributes':['id',_0xc219('0x2a')]})['then'](function(_0x1522d0){if(_0x1522d0){_0x415e93=_0x1522d0;if(_0x17fc1d[_0xc219('0x3b')][_0xc219('0x41')]&&!utils[_0xc219('0x42')](_0x17fc1d[_0xc219('0x3b')][_0xc219('0x41')])){throw new Error('Unknown\x20channel');}switch(_0x17fc1d[_0xc219('0x3b')][_0xc219('0x41')]){case _0xc219('0x43'):return db[_0xc219('0x2e')]['update']({'paused':0x0},{'where':{'UserId':_0x415e93['id']}})[_0xc219('0x11')](function(){return db[_0xc219('0x30')][_0xc219('0x28')]({'where':{'channel':_0x17fc1d[_0xc219('0x3b')]['channel'],'membername':_0x415e93[_0xc219('0x2a')],'type':_0xc219('0x31'),'exitAt':null}});})[_0xc219('0x11')](function(_0xf7899c){if(_0xf7899c){return _0xf7899c['update']({'exitAt':moment()[_0xc219('0x33')](_0xc219('0x34')),'data2':_0xc219('0x44')},{'individualHooks':!![]});}return null;})[_0xc219('0x11')](function(){return _0x415e93[_0xc219('0x2f')]({'voicePause':![]});});case _0xc219('0x45'):case _0xc219('0x46'):case _0xc219('0x47'):case _0xc219('0x48'):case _0xc219('0x49'):return db[_0xc219('0x30')][_0xc219('0x28')]({'where':{'channel':_0x17fc1d[_0xc219('0x3b')][_0xc219('0x41')],'membername':_0x415e93['name'],'type':_0xc219('0x31'),'exitAt':null}})[_0xc219('0x11')](function(_0x4d95e3){return _0x4d95e3[_0xc219('0x2f')]({'exitAt':moment()['format'](_0xc219('0x34')),'data2':_0xc219('0x44')},{'individualHooks':!![]});})[_0xc219('0x11')](function(){var _0x5b1172={};_[_0xc219('0x4a')](_0x5b1172,util['format'](_0xc219('0x4b'),_0x17fc1d['body'][_0xc219('0x41')],_0xc219('0x4c')),![]);return _0x415e93['update'](_0x5b1172);});default:return db[_0xc219('0x2e')][_0xc219('0x2f')]({'paused':0x0},{'where':{'UserId':_0x415e93['id']}})[_0xc219('0x11')](function(){return db['MemberReport'][_0xc219('0x1f')]({'where':{'membername':_0x415e93[_0xc219('0x2a')],'type':'PAUSE','exitAt':null}});})[_0xc219('0x11')](function(_0x1cd4b1){var _0x4a0a8e=[];_0x1cd4b1[_0xc219('0x37')](function(_0x3e35bb){_0x4a0a8e[_0xc219('0x38')](_0x3e35bb[_0xc219('0x2f')]({'exitAt':moment()[_0xc219('0x33')](_0xc219('0x34')),'data2':'system'}));});return BPromise['all'](_0x4a0a8e);})['then'](function(){return _0x415e93[_0xc219('0x2f')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xc219('0x11')](function(_0x40400f){_0x4603fb(_0x40400f);})['catch'](function(_0x3ecff8){_0x13d306(_0x378c00[_0xc219('0x17')](0x1f4,_0x3ecff8[_0xc219('0x19')]));});});};exports[_0xc219('0x4d')]=function(_0x1ecee4){var _0x271efd=this;return new Promise(function(_0x122408,_0x5b965f){var _0x467f38;return db['User']['findOne']({'where':_0x1ecee4[_0xc219('0x20')]['where']||{},'attributes':['id','name']})[_0xc219('0x11')](function(_0xa8cd86){if(_0xa8cd86){_0x467f38=_0xa8cd86;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x467f38[_0xc219('0x2a')]},'individualHooks':!![]});}})[_0xc219('0x11')](function(){if(_0x467f38){return db[_0xc219('0x30')][_0xc219('0x1f')]({'where':{'membername':_0x467f38[_0xc219('0x2a')],'exitAt':null}});}})[_0xc219('0x11')](function(_0x418751){if(_0x467f38){if(_0x418751&&_0x418751[_0xc219('0x32')]){var _0x2f379a=[];_0x418751['forEach'](function(_0x21251d){_0x2f379a['push'](_0x21251d[_0xc219('0x2f')]({'exitAt':moment()['format'](_0xc219('0x34'))}));});return BPromise['all'](_0x2f379a);}}})['then'](function(){if(_0x467f38){return _0x467f38[_0xc219('0x2f')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xc219('0x11')](function(_0x31f64b){_0x122408(_0x31f64b);})[_0xc219('0x1c')](function(_0x232f6d){_0x5b965f(_0x271efd[_0xc219('0x17')](0x1f4,_0x232f6d[_0xc219('0x19')]));});});};exports['LoginUser']=function(_0x46c3eb){var _0x5a065a=this;return new Promise(function(_0x11abf4,_0x163e1f){var _0x10f105;var _0x5e6288;var _0x292cdc;var _0x23ab17;return db['User'][_0xc219('0x4e')]({'where':_0x46c3eb[_0xc219('0x20')]['where']||{},'attributes':['id',_0xc219('0x2a'),_0xc219('0x2b'),_0xc219('0x4f'),_0xc219('0x50'),'internal','loginInPause',_0xc219('0x2d')]})[_0xc219('0x11')](function(_0x25e6d9){if(_0x25e6d9){_0x10f105=_0x25e6d9;_0x23ab17=_0x46c3eb[_0xc219('0x3b')][_0xc219('0x2d')]?_0x46c3eb[_0xc219('0x3b')][_0xc219('0x2d')]:util['format']('SIP/%s',_0x10f105[_0xc219('0x2a')]);return db[_0xc219('0x1e')][_0xc219('0x51')]({'where':{'role':_0xc219('0x52'),'online':!![],'id':{'$ne':_0x10f105['id']}}});}})[_0xc219('0x11')](function(_0x5eff07){if(_0x5eff07){_0x292cdc=_0x5eff07;return require(_0xc219('0x53'))[_0xc219('0x54')]();}})[_0xc219('0x11')](function(_0x5833e3){if(_0x5833e3&&_0x5833e3[_0xc219('0x55')]&&_0x292cdc>=_0x5833e3['agents']){throw new Error(_0xc219('0x56'));}})[_0xc219('0x11')](function(){if(_0x10f105){return db['UserVoiceQueueRt'][_0xc219('0x57')]({'where':{'membername':_0x10f105[_0xc219('0x2a')]},'individualHooks':!![]});}})[_0xc219('0x11')](function(){if(_0x10f105){return _0x10f105[_0xc219('0x58')]({'raw':!![]});}})[_0xc219('0x11')](function(_0x311e25){if(_0x10f105){if(_0x311e25){var _0x42a603=[];_0x5e6288=_0x311e25;if(_0x5e6288[_0xc219('0x32')]){for(var _0xc7063a=0x0;_0xc7063a<_0x5e6288[_0xc219('0x32')];_0xc7063a++){_0x42a603['push'](db['UserVoiceQueueRt'][_0xc219('0x59')]({'membername':_0x10f105[_0xc219('0x2a')],'UserId':_0x10f105['id'],'queue_name':_0x5e6288[_0xc7063a][_0xc219('0x2a')],'VoiceQueueId':_0x5e6288[_0xc7063a]['id'],'interface':_0x23ab17,'paused':_0x10f105[_0xc219('0x5a')]||![],'penalty':_0x5e6288[_0xc7063a][_0xc219('0x5b')]||0x0}));}return BPromise[_0xc219('0x5c')](_0x42a603);}}}})[_0xc219('0x11')](function(){if(_0x10f105){return db[_0xc219('0x30')][_0xc219('0x1f')]({'where':{'membername':_0x10f105['name'],'exitAt':null}});}})[_0xc219('0x11')](function(_0x430021){if(_0x10f105){if(_0x430021&&_0x430021[_0xc219('0x32')]){var _0x16ff02=[];_0x430021[_0xc219('0x37')](function(_0x364bfb){_0x16ff02[_0xc219('0x38')](_0x364bfb[_0xc219('0x2f')]({'exitAt':moment()[_0xc219('0x33')](_0xc219('0x34'))}));});return BPromise[_0xc219('0x5c')](_0x16ff02);}}})['then'](function(_0x5c56fc){if(_0x10f105){var _0x33e449=[];var _0x4bd1ca=[];var _0x1b1762=utils[_0xc219('0x36')]();var _0x4c9743={'membername':_0x10f105[_0xc219('0x2a')],'interface':_0x23ab17,'enterAt':moment()['format'](_0xc219('0x34')),'role':_0x10f105[_0xc219('0x2b')],'internal':_0x10f105[_0xc219('0x2c')]};_0x1b1762['forEach'](function(_0x105eb6){_0x33e449[_0xc219('0x38')](_[_0xc219('0x5d')]({'channel':_0x105eb6,'type':_0xc219('0x5e'),'data1':'callysquare','data2':_0x23ab17},_0x4c9743));if(_0x10f105['loginInPause']){_0x4bd1ca[_0xc219('0x38')](_[_0xc219('0x5d')]({'channel':_0x105eb6,'type':_0xc219('0x31'),'data1':_0xc219('0x5f')},_0x4c9743));}});return db[_0xc219('0x30')]['bulkCreate'](_0x33e449[_0xc219('0x60')](_0x4bd1ca),{'individualHooks':!![]});}})[_0xc219('0x11')](function(){if(_0x10f105){return _0x10f105['update']({'online':!![],'lastLoginAt':moment()[_0xc219('0x33')](_0xc219('0x34')),'voicePause':_0x10f105[_0xc219('0x5a')]||![],'mailPause':_0x10f105[_0xc219('0x5a')]||![],'chatPause':_0x10f105['loginInPause']||![],'faxPause':_0x10f105[_0xc219('0x5a')]||![],'smsPause':_0x10f105[_0xc219('0x5a')]||![],'openchannelPause':_0x10f105[_0xc219('0x5a')]||![],'pauseType':_0x10f105[_0xc219('0x5a')]?_0xc219('0x5f'):null,'lastPauseAt':moment()[_0xc219('0x33')](_0xc219('0x34')),'interface':_0x23ab17});}})[_0xc219('0x11')](function(_0x46ff18){_0x11abf4(_0x46ff18);})[_0xc219('0x1c')](function(_0x1744d6){_0x163e1f(_0x5a065a[_0xc219('0x17')](0x1f4,_0x1744d6[_0xc219('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 5dd2ce6..d588a0c 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 _0x821a=['length','user:','./user.events','save','remove','emit','removeListener','register'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x821a,0x14a));var _0xa821=function(_0x5a85d3,_0x57197e){_0x5a85d3=_0x5a85d3-0x0;var _0x3c8537=_0x821a[_0x5a85d3];return _0x3c8537;};'use strict';var UserEvents=require(_0xa821('0x0'));var events=[_0xa821('0x1'),_0xa821('0x2'),'update'];function createListener(_0x319a39,_0x1c2045){return function(_0x4cc072){_0x1c2045[_0xa821('0x3')](_0x319a39,_0x4cc072);};}function removeListener(_0x4f3faa,_0x520851){return function(){UserEvents[_0xa821('0x4')](_0x4f3faa,_0x520851);};}exports[_0xa821('0x5')]=function(_0x598046){for(var _0x53e2bb=0x0,_0x1390ce=events[_0xa821('0x6')];_0x53e2bb<_0x1390ce;_0x53e2bb++){var _0x1fc7fe=events[_0x53e2bb];var _0x11f6d7=createListener(_0xa821('0x7')+_0x1fc7fe,_0x598046);UserEvents['on'](_0x1fc7fe,_0x11f6d7);}}; \ No newline at end of file +var _0x1fbc=['removeListener','register','length','./user.events','remove','update','emit'];(function(_0x2c72b8,_0x17de91){var _0x4f3810=function(_0x458acb){while(--_0x458acb){_0x2c72b8['push'](_0x2c72b8['shift']());}};_0x4f3810(++_0x17de91);}(_0x1fbc,0xf8));var _0xc1fb=function(_0x203d7d,_0x41aeae){_0x203d7d=_0x203d7d-0x0;var _0x18e34f=_0x1fbc[_0x203d7d];return _0x18e34f;};'use strict';var UserEvents=require(_0xc1fb('0x0'));var events=['save',_0xc1fb('0x1'),_0xc1fb('0x2')];function createListener(_0xd0c167,_0x595ecf){return function(_0x1484ef){_0x595ecf[_0xc1fb('0x3')](_0xd0c167,_0x1484ef);};}function removeListener(_0x24497b,_0x1e0684){return function(){UserEvents[_0xc1fb('0x4')](_0x24497b,_0x1e0684);};}exports[_0xc1fb('0x5')]=function(_0xf514fe){for(var _0x634d2b=0x0,_0x3ed39f=events[_0xc1fb('0x6')];_0x634d2b<_0x3ed39f;_0x634d2b++){var _0x187428=events[_0x634d2b];var _0x2114ad=createListener('user:'+_0x187428,_0xf514fe);UserEvents['on'](_0x187428,_0x2114ad);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 72d19d4..d2a5ea8 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 _0xf30b=['connect-timeout','Router','../../components/interaction/service','exports','multer','path'];(function(_0x48cd9e,_0x2ba045){var _0x275f2a=function(_0x205298){while(--_0x205298){_0x48cd9e['push'](_0x48cd9e['shift']());}};_0x275f2a(++_0x2ba045);}(_0xf30b,0x172));var _0xbf30=function(_0x5bf7bd,_0x52d967){_0x5bf7bd=_0x5bf7bd-0x0;var _0x4d3227=_0xf30b[_0x5bf7bd];return _0x4d3227;};'use strict';var multer=require(_0xbf30('0x0'));var util=require('util');var path=require(_0xbf30('0x1'));var timeout=require(_0xbf30('0x2'));var express=require('express');var router=express[_0xbf30('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbf30('0x4'));var config=require('../../config/environment');module[_0xbf30('0x5')]=router; \ No newline at end of file +var _0xc672=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xc672,0x13f));var _0x2c67=function(_0x51e096,_0x16aedc){_0x51e096=_0x51e096-0x0;var _0x3242b3=_0xc672[_0x51e096];return _0x3242b3;};'use strict';var multer=require('multer');var util=require(_0x2c67('0x0'));var path=require('path');var timeout=require(_0x2c67('0x1'));var express=require(_0x2c67('0x2'));var router=express[_0x2c67('0x3')]();var auth=require(_0x2c67('0x4'));var interaction=require(_0x2c67('0x5'));var config=require(_0x2c67('0x6'));module[_0x2c67('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 4e584ff..0e61840 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 _0xbaf0=['exports','INTEGER'];(function(_0x5d72da,_0xb7ce32){var _0x43ebe7=function(_0x503755){while(--_0x503755){_0x5d72da['push'](_0x5d72da['shift']());}};_0x43ebe7(++_0xb7ce32);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0xd42b10,_0x55c581){var _0x3b6c9c=function(_0x2a73b8){while(--_0x2a73b8){_0xd42b10['push'](_0xd42b10['shift']());}};_0x3b6c9c(++_0x55c581);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 6b28982..d7430fb 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 _0x2f68=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues','util'];(function(_0x2e954f,_0x282882){var _0x50f90d=function(_0x2492ec){while(--_0x2492ec){_0x2e954f['push'](_0x2e954f['shift']());}};_0x50f90d(++_0x282882);}(_0x2f68,0x12b));var _0x82f6=function(_0x34f150,_0x5845cb){_0x34f150=_0x34f150-0x0;var _0x34ce02=_0x2f68[_0x34f150];return _0x34ce02;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var logger=require(_0x82f6('0x1'))(_0x82f6('0x2'));var moment=require(_0x82f6('0x3'));var BPromise=require(_0x82f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82f6('0x5'));var rimraf=require(_0x82f6('0x6'));var config=require(_0x82f6('0x7'));var attributes=require(_0x82f6('0x8'));module[_0x82f6('0x9')]=function(_0x5ba356,_0x5d37fe){return _0x5ba356[_0x82f6('0xa')]('UserChatQueue',attributes,{'tableName':_0x82f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9901=['bluebird','request-promise','rimraf','exports','define','UserChatQueue','user_has_chat_queues','util','api','moment'];(function(_0x3f1fb5,_0x32729d){var _0x1fe9c2=function(_0x2525e6){while(--_0x2525e6){_0x3f1fb5['push'](_0x3f1fb5['shift']());}};_0x1fe9c2(++_0x32729d);}(_0x9901,0x1bf));var _0x1990=function(_0x10f060,_0x312a7b){_0x10f060=_0x10f060-0x0;var _0x512722=_0x9901[_0x10f060];return _0x512722;};'use strict';var _=require('lodash');var util=require(_0x1990('0x0'));var logger=require('../../config/logger')(_0x1990('0x1'));var moment=require(_0x1990('0x2'));var BPromise=require(_0x1990('0x3'));var rp=require(_0x1990('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1990('0x5'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0x1990('0x6')]=function(_0x55b044,_0x4e8bca){return _0x55b044[_0x1990('0x7')](_0x1990('0x8'),attributes,{'tableName':_0x1990('0x9'),'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 f8c8cd2..dd6caf8 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 _0x83f0=['moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util'];(function(_0x3f7cea,_0x5da434){var _0x566837=function(_0x303f1c){while(--_0x303f1c){_0x3f7cea['push'](_0x3f7cea['shift']());}};_0x566837(++_0x5da434);}(_0x83f0,0xfa));var _0x083f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x83f0[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x083f('0x0'));var util=require(_0x083f('0x1'));var moment=require(_0x083f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x083f('0x3'));var db=require(_0x083f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x083f('0x5'));var config=require(_0x083f('0x6'));var jayson=require(_0x083f('0x7'));var client=jayson['client'][_0x083f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x368ee3,_0x582d25,_0x4140c2){return new BPromise(function(_0x1809e8,_0x50b2f0){return client[_0x083f('0x9')](_0x368ee3,_0x4140c2)[_0x083f('0xa')](function(_0x1df79a){logger[_0x083f('0xb')](_0x083f('0xc'),_0x582d25,_0x083f('0xd'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x582d25,'request\x20sent',JSON['stringify'](_0x1df79a));if(_0x1df79a[_0x083f('0xe')]){if(_0x1df79a[_0x083f('0xe')][_0x083f('0xf')]===0x1f4){logger['error'](_0x083f('0xc'),_0x582d25,_0x1df79a['error'][_0x083f('0x10')]);return _0x50b2f0(_0x1df79a[_0x083f('0xe')][_0x083f('0x10')]);}logger[_0x083f('0xe')](_0x083f('0xc'),_0x582d25,_0x1df79a['error'][_0x083f('0x10')]);return _0x1809e8(_0x1df79a[_0x083f('0xe')][_0x083f('0x10')]);}else{logger[_0x083f('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x582d25,_0x083f('0xd'));_0x1809e8(_0x1df79a['result']['message']);}})[_0x083f('0x11')](function(_0x5c64dc){logger[_0x083f('0xe')](_0x083f('0xc'),_0x582d25,_0x5c64dc);_0x50b2f0(_0x5c64dc);});});} \ No newline at end of file +var _0xe3df=['../../config/environment','jayson/promise','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x209aca,_0xd30ee6){var _0x131d3e=function(_0x360359){while(--_0x360359){_0x209aca['push'](_0x209aca['shift']());}};_0x131d3e(++_0xd30ee6);}(_0xe3df,0x176));var _0xfe3d=function(_0x2a4e25,_0x1cfd8f){_0x2a4e25=_0x2a4e25-0x0;var _0x1b076d=_0xe3df[_0x2a4e25];return _0x1b076d;};'use strict';var _=require('lodash');var util=require(_0xfe3d('0x0'));var moment=require('moment');var BPromise=require(_0xfe3d('0x1'));var rs=require(_0xfe3d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfe3d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe3d('0x4'))(_0xfe3d('0x5'));var config=require(_0xfe3d('0x6'));var jayson=require(_0xfe3d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13ca61,_0xb73962,_0x4e35a7){return new BPromise(function(_0x4cabc9,_0x403f4b){return client[_0xfe3d('0x8')](_0x13ca61,_0x4e35a7)[_0xfe3d('0x9')](function(_0x2acb72){logger[_0xfe3d('0xa')](_0xfe3d('0xb'),_0xb73962,_0xfe3d('0xc'));logger['debug'](_0xfe3d('0xd'),_0xb73962,_0xfe3d('0xc'),JSON['stringify'](_0x2acb72));if(_0x2acb72[_0xfe3d('0xe')]){if(_0x2acb72[_0xfe3d('0xe')][_0xfe3d('0xf')]===0x1f4){logger[_0xfe3d('0xe')]('UserChatQueue,\x20%s,\x20%s',_0xb73962,_0x2acb72[_0xfe3d('0xe')]['message']);return _0x403f4b(_0x2acb72[_0xfe3d('0xe')][_0xfe3d('0x10')]);}logger['error'](_0xfe3d('0xb'),_0xb73962,_0x2acb72[_0xfe3d('0xe')][_0xfe3d('0x10')]);return _0x4cabc9(_0x2acb72[_0xfe3d('0xe')][_0xfe3d('0x10')]);}else{logger[_0xfe3d('0xa')](_0xfe3d('0xb'),_0xb73962,_0xfe3d('0xc'));_0x4cabc9(_0x2acb72[_0xfe3d('0x11')][_0xfe3d('0x10')]);}})[_0xfe3d('0x12')](function(_0x54e876){logger[_0xfe3d('0xe')]('UserChatQueue,\x20%s,\x20%s',_0xb73962,_0x54e876);_0x403f4b(_0x54e876);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 3bd3361..7816af9 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 _0x4db1=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x40b61c,_0x13015c){var _0x29ea9b=function(_0xfcadb6){while(--_0xfcadb6){_0x40b61c['push'](_0x40b61c['shift']());}};_0x29ea9b(++_0x13015c);}(_0x4db1,0x1e9));var _0x14db=function(_0x46a3ff,_0x470b9a){_0x46a3ff=_0x46a3ff-0x0;var _0x404bc2=_0x4db1[_0x46a3ff];return _0x404bc2;};'use strict';var multer=require(_0x14db('0x0'));var util=require(_0x14db('0x1'));var path=require(_0x14db('0x2'));var timeout=require(_0x14db('0x3'));var express=require(_0x14db('0x4'));var router=express[_0x14db('0x5')]();var auth=require(_0x14db('0x6'));var interaction=require(_0x14db('0x7'));var config=require(_0x14db('0x8'));module[_0x14db('0x9')]=router; \ No newline at end of file +var _0x0a86=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout'];(function(_0x5f3309,_0x37871b){var _0xea65ec=function(_0x4fbe43){while(--_0x4fbe43){_0x5f3309['push'](_0x5f3309['shift']());}};_0xea65ec(++_0x37871b);}(_0x0a86,0x19a));var _0x60a8=function(_0x4c432d,_0x435c91){_0x4c432d=_0x4c432d-0x0;var _0x4213b0=_0x0a86[_0x4c432d];return _0x4213b0;};'use strict';var multer=require(_0x60a8('0x0'));var util=require(_0x60a8('0x1'));var path=require('path');var timeout=require(_0x60a8('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x60a8('0x3'));var interaction=require(_0x60a8('0x4'));var config=require(_0x60a8('0x5'));module[_0x60a8('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 4c98799..99d772e 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 _0x9ffd=['INTEGER','STRING','sequelize','exports'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x57adb9,_0x2c717e){_0x57adb9=_0x57adb9-0x0;var _0x3ebb16=_0x9ffd[_0x57adb9];return _0x3ebb16;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'penalty':{'type':Sequelize[_0xd9ff('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xd9ff('0x3')]}}; \ No newline at end of file +var _0x2032=['INTEGER','exports'];(function(_0xdd426f,_0x10f214){var _0x37f28c=function(_0x47cb35){while(--_0x47cb35){_0xdd426f['push'](_0xdd426f['shift']());}};_0x37f28c(++_0x10f214);}(_0x2032,0xd9));var _0x2203=function(_0x183d5f,_0x66970a){_0x183d5f=_0x183d5f-0x0;var _0x51f846=_0x2032[_0x183d5f];return _0x51f846;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'penalty':{'type':Sequelize[_0x2203('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2203('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index a16a229..5b6770f 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 _0x2539=['api','moment','bluebird','path','rimraf','exports','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger'];(function(_0x57d740,_0x50be99){var _0x6607ef=function(_0x908bd0){while(--_0x908bd0){_0x57d740['push'](_0x57d740['shift']());}};_0x6607ef(++_0x50be99);}(_0x2539,0x147));var _0x9253=function(_0xabfdca,_0x46d625){_0xabfdca=_0xabfdca-0x0;var _0x25f4a9=_0x2539[_0xabfdca];return _0x25f4a9;};'use strict';var _=require(_0x9253('0x0'));var util=require(_0x9253('0x1'));var logger=require(_0x9253('0x2'))(_0x9253('0x3'));var moment=require(_0x9253('0x4'));var BPromise=require(_0x9253('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9253('0x6'));var rimraf=require(_0x9253('0x7'));var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0x9253('0x8')]=function(_0x5c3245,_0x100bec){return _0x5c3245['define'](_0x9253('0x9'),attributes,{'tableName':_0x9253('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42f4=['request-promise','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x559f4e,_0x160eab){var _0x126e43=function(_0x45f252){while(--_0x45f252){_0x559f4e['push'](_0x559f4e['shift']());}};_0x126e43(++_0x160eab);}(_0x42f4,0x19d));var _0x442f=function(_0x4b6507,_0x5518b5){_0x4b6507=_0x4b6507-0x0;var _0x2001ec=_0x42f4[_0x4b6507];return _0x2001ec;};'use strict';var _=require(_0x442f('0x0'));var util=require('util');var logger=require(_0x442f('0x1'))(_0x442f('0x2'));var moment=require(_0x442f('0x3'));var BPromise=require(_0x442f('0x4'));var rp=require(_0x442f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x442f('0x6'));module[_0x442f('0x7')]=function(_0x545b7b,_0x3ed622){return _0x545b7b[_0x442f('0x8')](_0x442f('0x9'),attributes,{'tableName':_0x442f('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 863cd04..aecd549 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 _0x7ce8=['error','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2f16ce,_0x26bc1c){var _0x3e88f5=function(_0x41cf57){while(--_0x41cf57){_0x2f16ce['push'](_0x2f16ce['shift']());}};_0x3e88f5(++_0x26bc1c);}(_0x7ce8,0x165));var _0x87ce=function(_0xb7cb72,_0x19d391){_0xb7cb72=_0xb7cb72-0x0;var _0x4b7570=_0x7ce8[_0xb7cb72];return _0x4b7570;};'use strict';var _=require(_0x87ce('0x0'));var util=require(_0x87ce('0x1'));var moment=require(_0x87ce('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87ce('0x3'));var db=require(_0x87ce('0x4'))['db'];var utils=require(_0x87ce('0x5'));var logger=require(_0x87ce('0x6'))(_0x87ce('0x7'));var config=require(_0x87ce('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x87ce('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2903b5,_0x54dbdb,_0x53fa9e){return new BPromise(function(_0x3a9598,_0x43f500){return client[_0x87ce('0xa')](_0x2903b5,_0x53fa9e)[_0x87ce('0xb')](function(_0x36b92a){logger['info'](_0x87ce('0xc'),_0x54dbdb,'request\x20sent');logger[_0x87ce('0xd')](_0x87ce('0xe'),_0x54dbdb,_0x87ce('0xf'),JSON[_0x87ce('0x10')](_0x36b92a));if(_0x36b92a[_0x87ce('0x11')]){if(_0x36b92a[_0x87ce('0x11')]['code']===0x1f4){logger['error'](_0x87ce('0xc'),_0x54dbdb,_0x36b92a[_0x87ce('0x11')][_0x87ce('0x12')]);return _0x43f500(_0x36b92a['error'][_0x87ce('0x12')]);}logger['error'](_0x87ce('0xc'),_0x54dbdb,_0x36b92a[_0x87ce('0x11')][_0x87ce('0x12')]);return _0x3a9598(_0x36b92a[_0x87ce('0x11')][_0x87ce('0x12')]);}else{logger[_0x87ce('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x54dbdb,_0x87ce('0xf'));_0x3a9598(_0x36b92a[_0x87ce('0x14')][_0x87ce('0x12')]);}})[_0x87ce('0x15')](function(_0x4cf8b6){logger[_0x87ce('0x11')](_0x87ce('0xc'),_0x54dbdb,_0x4cf8b6);_0x43f500(_0x4cf8b6);});});} \ No newline at end of file +var _0xb875=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x44ea1b,_0x36bbd3){var _0x239690=function(_0x3ec34b){while(--_0x3ec34b){_0x44ea1b['push'](_0x44ea1b['shift']());}};_0x239690(++_0x36bbd3);}(_0xb875,0x167));var _0x5b87=function(_0x43c69d,_0x1161cf){_0x43c69d=_0x43c69d-0x0;var _0x1fa4fb=_0xb875[_0x43c69d];return _0x1fa4fb;};'use strict';var _=require(_0x5b87('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b87('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b87('0x2'))['db'];var utils=require(_0x5b87('0x3'));var logger=require('../../config/logger')(_0x5b87('0x4'));var config=require(_0x5b87('0x5'));var jayson=require(_0x5b87('0x6'));var client=jayson[_0x5b87('0x7')][_0x5b87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b27af,_0x1fc1a8,_0x46b1bf){return new BPromise(function(_0x1fb944,_0xb2888){return client['request'](_0x5b27af,_0x46b1bf)[_0x5b87('0x9')](function(_0x537f81){logger[_0x5b87('0xa')](_0x5b87('0xb'),_0x1fc1a8,_0x5b87('0xc'));logger[_0x5b87('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1fc1a8,'request\x20sent',JSON[_0x5b87('0xe')](_0x537f81));if(_0x537f81[_0x5b87('0xf')]){if(_0x537f81['error'][_0x5b87('0x10')]===0x1f4){logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x537f81[_0x5b87('0xf')][_0x5b87('0x11')]);return _0xb2888(_0x537f81[_0x5b87('0xf')][_0x5b87('0x11')]);}logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x537f81['error'][_0x5b87('0x11')]);return _0x1fb944(_0x537f81['error'][_0x5b87('0x11')]);}else{logger[_0x5b87('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x1fc1a8,'request\x20sent');_0x1fb944(_0x537f81[_0x5b87('0x12')]['message']);}})[_0x5b87('0x13')](function(_0x175452){logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x175452);_0xb2888(_0x175452);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 56ff89b..571b207 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 _0x4209=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','express'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x4209,0x11c));var _0x9420=function(_0x11c0cb,_0x4476aa){_0x11c0cb=_0x11c0cb-0x0;var _0x3dbf20=_0x4209[_0x11c0cb];return _0x3dbf20;};'use strict';var multer=require(_0x9420('0x0'));var util=require(_0x9420('0x1'));var path=require('path');var timeout=require(_0x9420('0x2'));var express=require(_0x9420('0x3'));var router=express['Router']();var auth=require(_0x9420('0x4'));var interaction=require(_0x9420('0x5'));var config=require(_0x9420('0x6'));module[_0x9420('0x7')]=router; \ No newline at end of file +var _0x1d6c=['../../components/interaction/service','exports','multer','util','express'];(function(_0x34be30,_0x2244d1){var _0x53b00b=function(_0x3bfb3f){while(--_0x3bfb3f){_0x34be30['push'](_0x34be30['shift']());}};_0x53b00b(++_0x2244d1);}(_0x1d6c,0x1f1));var _0xc1d6=function(_0x5e804f,_0xd2ba4){_0x5e804f=_0x5e804f-0x0;var _0x215ac2=_0x1d6c[_0x5e804f];return _0x215ac2;};'use strict';var multer=require(_0xc1d6('0x0'));var util=require(_0xc1d6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc1d6('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc1d6('0x3'));var config=require('../../config/environment');module[_0xc1d6('0x4')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 3193b2c..0b672eb 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x31077c,_0x33ba0e){var _0x3586ac=function(_0x1f5d36){while(--_0x1f5d36){_0x31077c['push'](_0x31077c['shift']());}};_0x3586ac(++_0x33ba0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index b115341..e36fb7e 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','../../config/logger','api'];(function(_0x49d98d,_0x3dfd38){var _0x2c8e2b=function(_0x272bf8){while(--_0x272bf8){_0x49d98d['push'](_0x49d98d['shift']());}};_0x2c8e2b(++_0x3dfd38);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0xb10b,0x12a));var _0xbb10=function(_0x53bf11,_0x3acb5e){_0x53bf11=_0x53bf11-0x0;var _0x3a4f47=_0xb10b[_0x53bf11];return _0x3a4f47;};'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')]('UserMailQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index c1e4ffd..ad57437 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 _0xe585=['rpc','../../config/environment','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x58d4ce,_0x154425){var _0x3c5170=function(_0x235a0a){while(--_0x235a0a){_0x58d4ce['push'](_0x58d4ce['shift']());}};_0x3c5170(++_0x154425);}(_0xe585,0x9a));var _0x5e58=function(_0x4e1f65,_0x3a23ee){_0x4e1f65=_0x4e1f65-0x0;var _0x574f21=_0xe585[_0x4e1f65];return _0x574f21;};'use strict';var _=require(_0x5e58('0x0'));var util=require('util');var moment=require(_0x5e58('0x1'));var BPromise=require('bluebird');var rs=require(_0x5e58('0x2'));var fs=require('fs');var Redis=require(_0x5e58('0x3'));var db=require(_0x5e58('0x4'))['db'];var utils=require(_0x5e58('0x5'));var logger=require(_0x5e58('0x6'))(_0x5e58('0x7'));var config=require(_0x5e58('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5e58('0x9')][_0x5e58('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x351ad4,_0x30f05b,_0x3e8b0f){return new BPromise(function(_0x587424,_0x244ee5){return client[_0x5e58('0xb')](_0x351ad4,_0x3e8b0f)[_0x5e58('0xc')](function(_0x57cf49){logger['info'](_0x5e58('0xd'),_0x30f05b,_0x5e58('0xe'));logger[_0x5e58('0xf')](_0x5e58('0x10'),_0x30f05b,'request\x20sent',JSON['stringify'](_0x57cf49));if(_0x57cf49[_0x5e58('0x11')]){if(_0x57cf49['error'][_0x5e58('0x12')]===0x1f4){logger[_0x5e58('0x11')](_0x5e58('0xd'),_0x30f05b,_0x57cf49[_0x5e58('0x11')][_0x5e58('0x13')]);return _0x244ee5(_0x57cf49[_0x5e58('0x11')][_0x5e58('0x13')]);}logger['error'](_0x5e58('0xd'),_0x30f05b,_0x57cf49[_0x5e58('0x11')][_0x5e58('0x13')]);return _0x587424(_0x57cf49[_0x5e58('0x11')]['message']);}else{logger[_0x5e58('0x14')](_0x5e58('0xd'),_0x30f05b,'request\x20sent');_0x587424(_0x57cf49[_0x5e58('0x15')]['message']);}})[_0x5e58('0x16')](function(_0xdade30){logger['error'](_0x5e58('0xd'),_0x30f05b,_0xdade30);_0x244ee5(_0xdade30);});});} \ No newline at end of file +var _0x5e89=['http','request','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','UserMailQueue,\x20%s,\x20%s','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0xb70897,_0x3df11d){var _0x324286=function(_0xecedc8){while(--_0xecedc8){_0xb70897['push'](_0xb70897['shift']());}};_0x324286(++_0x3df11d);}(_0x5e89,0x19d));var _0x95e8=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5e89[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x95e8('0x0'));var fs=require('fs');var Redis=require(_0x95e8('0x1'));var db=require(_0x95e8('0x2'))['db'];var utils=require(_0x95e8('0x3'));var logger=require(_0x95e8('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x95e8('0x5'));var client=jayson[_0x95e8('0x6')][_0x95e8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3c21c7,_0x5bc956,_0x436f41){return new BPromise(function(_0x3c85dc,_0x58a83e){return client[_0x95e8('0x8')](_0x3c21c7,_0x436f41)[_0x95e8('0x9')](function(_0xfef1ec){logger[_0x95e8('0xa')]('UserMailQueue,\x20%s,\x20%s',_0x5bc956,_0x95e8('0xb'));logger[_0x95e8('0xc')](_0x95e8('0xd'),_0x5bc956,_0x95e8('0xb'),JSON[_0x95e8('0xe')](_0xfef1ec));if(_0xfef1ec[_0x95e8('0xf')]){if(_0xfef1ec['error']['code']===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x5bc956,_0xfef1ec[_0x95e8('0xf')][_0x95e8('0x10')]);return _0x58a83e(_0xfef1ec[_0x95e8('0xf')][_0x95e8('0x10')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x5bc956,_0xfef1ec[_0x95e8('0xf')][_0x95e8('0x10')]);return _0x3c85dc(_0xfef1ec['error'][_0x95e8('0x10')]);}else{logger[_0x95e8('0xa')](_0x95e8('0x11'),_0x5bc956,_0x95e8('0xb'));_0x3c85dc(_0xfef1ec[_0x95e8('0x12')][_0x95e8('0x10')]);}})[_0x95e8('0x13')](function(_0x2d3c12){logger[_0x95e8('0xf')](_0x95e8('0x11'),_0x5bc956,_0x2d3c12);_0x58a83e(_0x2d3c12);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index a0d4b44..f5ed1ae 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 _0x2c35=['../../config/environment','exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x380f48,_0x2ceadb){var _0x171034=function(_0x13cfac){while(--_0x13cfac){_0x380f48['push'](_0x380f48['shift']());}};_0x171034(++_0x2ceadb);}(_0x2c35,0x9a));var _0x52c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c35[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x52c3('0x0'));var util=require(_0x52c3('0x1'));var path=require(_0x52c3('0x2'));var timeout=require('connect-timeout');var express=require(_0x52c3('0x3'));var router=express[_0x52c3('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x52c3('0x5'));var config=require(_0x52c3('0x6'));module[_0x52c3('0x7')]=router; \ No newline at end of file +var _0x4878=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','multer','util'];(function(_0x377fb1,_0x5ee538){var _0x3248e9=function(_0x4e6ed5){while(--_0x4e6ed5){_0x377fb1['push'](_0x377fb1['shift']());}};_0x3248e9(++_0x5ee538);}(_0x4878,0x186));var _0x8487=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4878[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x8487('0x0'));var util=require(_0x8487('0x1'));var path=require('path');var timeout=require(_0x8487('0x2'));var express=require(_0x8487('0x3'));var router=express[_0x8487('0x4')]();var auth=require(_0x8487('0x5'));var interaction=require(_0x8487('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index ad357ed..56ffbc0 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 _0xd8b0=['exports','sequelize'];(function(_0x52ed4d,_0x2da392){var _0x244cdd=function(_0x375cae){while(--_0x375cae){_0x52ed4d['push'](_0x52ed4d['shift']());}};_0x244cdd(++_0x2da392);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index bdeb3a9..add84b2 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 _0x3184=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x324713,_0x10f322){var _0xb6e163=function(_0x56fcd0){while(--_0x56fcd0){_0x324713['push'](_0x324713['shift']());}};_0xb6e163(++_0x10f322);}(_0x3184,0x180));var _0x4318=function(_0x549664,_0x3eda87){_0x549664=_0x549664-0x0;var _0x48a125=_0x3184[_0x549664];return _0x48a125;};'use strict';var _=require(_0x4318('0x0'));var util=require('util');var logger=require(_0x4318('0x1'))(_0x4318('0x2'));var moment=require(_0x4318('0x3'));var BPromise=require(_0x4318('0x4'));var rp=require(_0x4318('0x5'));var fs=require('fs');var path=require(_0x4318('0x6'));var rimraf=require(_0x4318('0x7'));var config=require('../../config/environment');var attributes=require(_0x4318('0x8'));module['exports']=function(_0x44d5d4,_0x1cfdad){return _0x44d5d4[_0x4318('0x9')](_0x4318('0xa'),attributes,{'tableName':_0x4318('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc0f=['../../config/environment','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x1655bb,_0x5a82ae){var _0x5e2020=function(_0x1ccfb4){while(--_0x1ccfb4){_0x1655bb['push'](_0x1655bb['shift']());}};_0x5e2020(++_0x5a82ae);}(_0xdc0f,0x131));var _0xfdc0=function(_0xa223ad,_0x5a574b){_0xa223ad=_0xa223ad-0x0;var _0x306d47=_0xdc0f[_0xa223ad];return _0x306d47;};'use strict';var _=require(_0xfdc0('0x0'));var util=require(_0xfdc0('0x1'));var logger=require('../../config/logger')(_0xfdc0('0x2'));var moment=require('moment');var BPromise=require(_0xfdc0('0x3'));var rp=require(_0xfdc0('0x4'));var fs=require('fs');var path=require(_0xfdc0('0x5'));var rimraf=require(_0xfdc0('0x6'));var config=require(_0xfdc0('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xfdc0('0x8')]=function(_0x1e44cd,_0x1358e4){return _0x1e44cd[_0xfdc0('0x9')](_0xfdc0('0xa'),attributes,{'tableName':_0xfdc0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 3ee5c9c..680c145 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 _0xf439=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','bluebird','ioredis'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xf439,0x1b7));var _0x9f43=function(_0x17e9da,_0xedbafd){_0x17e9da=_0x17e9da-0x0;var _0x21cefd=_0xf439[_0x17e9da];return _0x21cefd;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9f43('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f43('0x1'));var db=require(_0x9f43('0x2'))['db'];var utils=require(_0x9f43('0x3'));var logger=require(_0x9f43('0x4'))(_0x9f43('0x5'));var config=require(_0x9f43('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9f43('0x7')][_0x9f43('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20fb0c,_0x18486c,_0x4267de){return new BPromise(function(_0x2aff00,_0x13f615){return client[_0x9f43('0x9')](_0x20fb0c,_0x4267de)[_0x9f43('0xa')](function(_0x387121){logger[_0x9f43('0xb')](_0x9f43('0xc'),_0x18486c,_0x9f43('0xd'));logger[_0x9f43('0xe')](_0x9f43('0xf'),_0x18486c,_0x9f43('0xd'),JSON[_0x9f43('0x10')](_0x387121));if(_0x387121[_0x9f43('0x11')]){if(_0x387121[_0x9f43('0x11')][_0x9f43('0x12')]===0x1f4){logger['error'](_0x9f43('0xc'),_0x18486c,_0x387121['error'][_0x9f43('0x13')]);return _0x13f615(_0x387121[_0x9f43('0x11')][_0x9f43('0x13')]);}logger[_0x9f43('0x11')](_0x9f43('0xc'),_0x18486c,_0x387121[_0x9f43('0x11')][_0x9f43('0x13')]);return _0x2aff00(_0x387121['error'][_0x9f43('0x13')]);}else{logger['info'](_0x9f43('0xc'),_0x18486c,'request\x20sent');_0x2aff00(_0x387121['result'][_0x9f43('0x13')]);}})[_0x9f43('0x14')](function(_0x190e29){logger['error'](_0x9f43('0xc'),_0x18486c,_0x190e29);_0x13f615(_0x190e29);});});} \ No newline at end of file +var _0x1cd2=['rpc','../../config/environment','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5b077b,_0x50b707){var _0x16faf7=function(_0x41ba83){while(--_0x41ba83){_0x5b077b['push'](_0x5b077b['shift']());}};_0x16faf7(++_0x50b707);}(_0x1cd2,0x149));var _0x21cd=function(_0x345ce7,_0x15791f){_0x345ce7=_0x345ce7-0x0;var _0xbde6bc=_0x1cd2[_0x345ce7];return _0xbde6bc;};'use strict';var _=require(_0x21cd('0x0'));var util=require(_0x21cd('0x1'));var moment=require(_0x21cd('0x2'));var BPromise=require('bluebird');var rs=require(_0x21cd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21cd('0x4'))['db'];var utils=require(_0x21cd('0x5'));var logger=require(_0x21cd('0x6'))(_0x21cd('0x7'));var config=require(_0x21cd('0x8'));var jayson=require(_0x21cd('0x9'));var client=jayson['client'][_0x21cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcb0ecd,_0x547860,_0x1999d4){return new BPromise(function(_0x5f517b,_0x105a17){return client[_0x21cd('0xb')](_0xcb0ecd,_0x1999d4)[_0x21cd('0xc')](function(_0x3c9c92){logger[_0x21cd('0xd')](_0x21cd('0xe'),_0x547860,_0x21cd('0xf'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x547860,_0x21cd('0xf'),JSON['stringify'](_0x3c9c92));if(_0x3c9c92[_0x21cd('0x10')]){if(_0x3c9c92['error'][_0x21cd('0x11')]===0x1f4){logger[_0x21cd('0x10')](_0x21cd('0xe'),_0x547860,_0x3c9c92['error'][_0x21cd('0x12')]);return _0x105a17(_0x3c9c92[_0x21cd('0x10')][_0x21cd('0x12')]);}logger[_0x21cd('0x10')](_0x21cd('0xe'),_0x547860,_0x3c9c92[_0x21cd('0x10')][_0x21cd('0x12')]);return _0x5f517b(_0x3c9c92[_0x21cd('0x10')][_0x21cd('0x12')]);}else{logger['info'](_0x21cd('0xe'),_0x547860,_0x21cd('0xf'));_0x5f517b(_0x3c9c92[_0x21cd('0x13')][_0x21cd('0x12')]);}})[_0x21cd('0x14')](function(_0x20ae0e){logger[_0x21cd('0x10')](_0x21cd('0xe'),_0x547860,_0x20ae0e);_0x105a17(_0x20ae0e);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 5d3946e..f9f5023 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 _0xe601=['removeSections','removeResources','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','create','post','clone','addSections','addResources','put','update','destroy','delete'];(function(_0x301f2a,_0x27c07b){var _0x6d6948=function(_0x5880b1){while(--_0x5880b1){_0x301f2a['push'](_0x301f2a['shift']());}};_0x6d6948(++_0x27c07b);}(_0xe601,0x139));var _0x1e60=function(_0x4e4a83,_0x4b63ce){_0x4e4a83=_0x4e4a83-0x0;var _0x1773ec=_0xe601[_0x4e4a83];return _0x1773ec;};'use strict';var multer=require(_0x1e60('0x0'));var util=require(_0x1e60('0x1'));var path=require(_0x1e60('0x2'));var timeout=require('connect-timeout');var express=require(_0x1e60('0x3'));var router=express[_0x1e60('0x4')]();var auth=require(_0x1e60('0x5'));var interaction=require(_0x1e60('0x6'));var config=require(_0x1e60('0x7'));var controller=require(_0x1e60('0x8'));router[_0x1e60('0x9')]('/',auth[_0x1e60('0xa')](),controller[_0x1e60('0xb')]);router['get'](_0x1e60('0xc'),auth[_0x1e60('0xa')](),controller['describe']);router['get'](_0x1e60('0xd'),auth['isAuthenticated'](),controller[_0x1e60('0xe')]);router['get'](_0x1e60('0xf'),auth['isAuthenticated'](),controller[_0x1e60('0x10')]);router[_0x1e60('0x9')](_0x1e60('0x11'),auth[_0x1e60('0xa')](),controller[_0x1e60('0x12')]);router['post']('/',auth[_0x1e60('0xa')](),controller[_0x1e60('0x13')]);router[_0x1e60('0x14')]('/:id/clone',auth[_0x1e60('0xa')](),controller[_0x1e60('0x15')]);router[_0x1e60('0x14')](_0x1e60('0xf'),auth['isAuthenticated'](),controller[_0x1e60('0x16')]);router[_0x1e60('0x14')](_0x1e60('0x11'),auth[_0x1e60('0xa')](),controller[_0x1e60('0x17')]);router[_0x1e60('0x18')]('/:id',auth[_0x1e60('0xa')](),controller[_0x1e60('0x19')]);router['delete'](_0x1e60('0xd'),auth['isAuthenticated'](),controller[_0x1e60('0x1a')]);router[_0x1e60('0x1b')](_0x1e60('0xf'),auth[_0x1e60('0xa')](),controller[_0x1e60('0x1c')]);router['delete'](_0x1e60('0x11'),auth[_0x1e60('0xa')](),controller[_0x1e60('0x1d')]);module[_0x1e60('0x1e')]=router; \ No newline at end of file +var _0xdc1e=['/describe','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','post','create','addSections','put','update','delete','destroy','removeSections','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0xdc1e,0x1a8));var _0xedc1=function(_0x556d6f,_0x378078){_0x556d6f=_0x556d6f-0x0;var _0x3d3a99=_0xdc1e[_0x556d6f];return _0x3d3a99;};'use strict';var multer=require(_0xedc1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xedc1('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xedc1('0x2'));var interaction=require(_0xedc1('0x3'));var config=require('../../config/environment');var controller=require(_0xedc1('0x4'));router[_0xedc1('0x5')]('/',auth[_0xedc1('0x6')](),controller[_0xedc1('0x7')]);router[_0xedc1('0x5')](_0xedc1('0x8'),auth['isAuthenticated'](),controller[_0xedc1('0x9')]);router[_0xedc1('0x5')](_0xedc1('0xa'),auth[_0xedc1('0x6')](),controller['show']);router['get'](_0xedc1('0xb'),auth['isAuthenticated'](),controller[_0xedc1('0xc')]);router[_0xedc1('0x5')](_0xedc1('0xd'),auth['isAuthenticated'](),controller[_0xedc1('0xe')]);router[_0xedc1('0xf')]('/',auth['isAuthenticated'](),controller[_0xedc1('0x10')]);router['post']('/:id/clone',auth[_0xedc1('0x6')](),controller['clone']);router[_0xedc1('0xf')]('/:id/sections',auth[_0xedc1('0x6')](),controller[_0xedc1('0x11')]);router[_0xedc1('0xf')](_0xedc1('0xd'),auth[_0xedc1('0x6')](),controller['addResources']);router[_0xedc1('0x12')](_0xedc1('0xa'),auth['isAuthenticated'](),controller[_0xedc1('0x13')]);router[_0xedc1('0x14')](_0xedc1('0xa'),auth[_0xedc1('0x6')](),controller[_0xedc1('0x15')]);router[_0xedc1('0x14')]('/:id/sections',auth[_0xedc1('0x6')](),controller[_0xedc1('0x16')]);router[_0xedc1('0x14')]('/:id/resources',auth['isAuthenticated'](),controller['removeResources']);module[_0xedc1('0x17')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 316c110..8e66ab6 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 _0x689b=['sequelize','STRING','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x689b,0x142));var _0xb689=function(_0x1a2b66,_0x181130){_0x1a2b66=_0x1a2b66-0x0;var _0x34911e=_0x689b[_0x1a2b66];return _0x34911e;};'use strict';var Sequelize=require(_0xb689('0x0'));module['exports']={'name':{'type':Sequelize[_0xb689('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x213562){this[_0xb689('0x2')](_0xb689('0x3'),_0x213562?_0x213562[_0xb689('0x4')](''):[]);},'get':function(){return this[_0xb689('0x5')](_0xb689('0x3'))?this[_0xb689('0x5')]('crudPermissions')[_0xb689('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb689('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x63ad=['STRING','crudPermissions','join','getDataValue','split','exports'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0x63ad,0x7d));var _0xd63a=function(_0x5d2861,_0x395fcf){_0x5d2861=_0x5d2861-0x0;var _0x3f8655=_0x63ad[_0x5d2861];return _0x3f8655;};'use strict';var Sequelize=require('sequelize');module[_0xd63a('0x0')]={'name':{'type':Sequelize[_0xd63a('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x5b2473){this['setDataValue'](_0xd63a('0x2'),_0x5b2473?_0x5b2473[_0xd63a('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0xd63a('0x2'))?this[_0xd63a('0x4')](_0xd63a('0x2'))[_0xd63a('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xd63a('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 973cc8b..5a218a9 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 _0x2a25=['find','create','body','clone','get','omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','addSections','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','ignore','union','all','hasOwnProperty','type','key','field','foreignKey','associatedResources','AnalyticExtractedReport','reportType','default','reportId','DefaultReports','CmContact','Tags','color','tag','value','toLowerCase','SquareProject','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','ListId','lists','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','role','agent','telephone','VoiceQueues','queue','inbound','VoiceQueue','outbound','musiconholds','chanspies','voiceprefixes','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','telephones','admin','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','WhatsappAccount','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','offset','limit','Content-Range','json','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','UserProfile','rawAttributes','model','keys','query','filters','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','intersection'];(function(_0x207140,_0x4c6556){var _0x39e8cf=function(_0x16b730){while(--_0x16b730){_0x207140['push'](_0x207140['shift']());}};_0x39e8cf(++_0x4c6556);}(_0x2a25,0xa8));var _0x52a2=function(_0x349180,_0x3ed57a){_0x349180=_0x349180-0x0;var _0xc96bc2=_0x2a25[_0x349180];return _0xc96bc2;};'use strict';var pdf=require(_0x52a2('0x0'));var emlformat=require(_0x52a2('0x1'));var rimraf=require(_0x52a2('0x2'));var zipdir=require(_0x52a2('0x3'));var jsonpatch=require(_0x52a2('0x4'));var rp=require('request-promise');var moment=require(_0x52a2('0x5'));var BPromise=require(_0x52a2('0x6'));var Mustache=require(_0x52a2('0x7'));var util=require(_0x52a2('0x8'));var path=require(_0x52a2('0x9'));var sox=require('sox');var csv=require(_0x52a2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x52a2('0xb'));var crypto=require(_0x52a2('0xc'));var jsforce=require(_0x52a2('0xd'));var deskjs=require(_0x52a2('0xe'));var toCsv=require(_0x52a2('0xa'));var querystring=require(_0x52a2('0xf'));var Papa=require(_0x52a2('0x10'));var Redis=require(_0x52a2('0x11'));var authService=require(_0x52a2('0x12'));var qs=require(_0x52a2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52a2('0x14'));var logger=require(_0x52a2('0x15'))('api');var utils=require(_0x52a2('0x16'));var config=require(_0x52a2('0x17'));var db=require(_0x52a2('0x18'))['db'];config[_0x52a2('0x19')]=_['defaults'](config[_0x52a2('0x19')],{'host':_0x52a2('0x1a'),'port':0x18eb});var socket=require(_0x52a2('0x1b'))(new Redis(config[_0x52a2('0x19')]));require(_0x52a2('0x1c'))['register'](socket);function respondWithStatusCode(_0x529d28,_0x49cc13){_0x49cc13=_0x49cc13||0xcc;return function(_0x77d54a){if(_0x77d54a){return _0x529d28[_0x52a2('0x1d')](_0x49cc13);}return _0x529d28[_0x52a2('0x1e')](_0x49cc13)['end']();};}function respondWithResult(_0x50e7da,_0x1e700e){_0x1e700e=_0x1e700e||0xc8;return function(_0x418cf6){if(_0x418cf6){return _0x50e7da[_0x52a2('0x1e')](_0x1e700e)['json'](_0x418cf6);}};}function respondWithFilteredResult(_0x4b267c,_0x2a31aa){return function(_0x58ddb0){if(_0x58ddb0){var _0x11e969=_0x58ddb0['count'],_0x293af5=_0x2a31aa[_0x52a2('0x1f')],_0x56663f=_0x2a31aa[_0x52a2('0x1f')]+_0x2a31aa[_0x52a2('0x20')],_0xf97854;if(_0x56663f>=_0x11e969){_0x56663f=_0x11e969;_0xf97854=0xc8;}else{_0xf97854=0xce;}_0x4b267c[_0x52a2('0x1e')](_0xf97854);return _0x4b267c['set'](_0x52a2('0x21'),_0x293af5+'-'+_0x56663f+'/'+_0x11e969)[_0x52a2('0x22')](_0x58ddb0);}return null;};}function patchUpdates(_0x2a1ddf){return function(_0x12fd30){try{jsonpatch[_0x52a2('0x23')](_0x12fd30,_0x2a1ddf,!![]);}catch(_0x53d096){return BPromise[_0x52a2('0x24')](_0x53d096);}return _0x12fd30[_0x52a2('0x25')]();};}function saveUpdates(_0x74a2e1,_0x14f87){return function(_0xaf19d3){if(_0xaf19d3){return _0xaf19d3['update'](_0x74a2e1)['then'](function(_0x155b38){return _0x155b38;});}return null;};}function removeEntity(_0x5d8d7b,_0x3f5267){return function(_0x678a0e){if(_0x678a0e){return _0x678a0e[_0x52a2('0x26')]()[_0x52a2('0x27')](function(){_0x5d8d7b['status'](0xcc)[_0x52a2('0x28')]();});}};}function handleEntityNotFound(_0x3916d7,_0x299096){return function(_0x4f5c30){if(!_0x4f5c30){_0x3916d7[_0x52a2('0x1d')](0x194);}return _0x4f5c30;};}function handleError(_0x56e1c7,_0x5a3f3c){_0x5a3f3c=_0x5a3f3c||0x1f4;return function(_0xe7cbbb){logger[_0x52a2('0x29')](_0xe7cbbb[_0x52a2('0x2a')]);if(_0xe7cbbb[_0x52a2('0x2b')]){delete _0xe7cbbb[_0x52a2('0x2b')];}_0x56e1c7[_0x52a2('0x1e')](_0x5a3f3c)[_0x52a2('0x2c')](_0xe7cbbb);};}exports[_0x52a2('0x2d')]=function(_0x35316c,_0x547f37){var _0x10f9a5={},_0x1c556d={},_0x559b31={'count':0x0,'rows':[]};var _0x1fa8bd=_[_0x52a2('0x2e')](db[_0x52a2('0x2f')][_0x52a2('0x30')],function(_0x50498c){return{'name':_0x50498c['fieldName'],'type':_0x50498c['type']['key']};});_0x1c556d[_0x52a2('0x31')]=_[_0x52a2('0x2e')](_0x1fa8bd,_0x52a2('0x2b'));_0x1c556d['query']=_[_0x52a2('0x32')](_0x35316c[_0x52a2('0x33')]);_0x1c556d[_0x52a2('0x34')]=_['intersection'](_0x1c556d[_0x52a2('0x31')],_0x1c556d['query']);_0x10f9a5['attributes']=_['intersection'](_0x1c556d['model'],qs[_0x52a2('0x35')](_0x35316c[_0x52a2('0x33')][_0x52a2('0x35')]));_0x10f9a5[_0x52a2('0x36')]=_0x10f9a5[_0x52a2('0x36')][_0x52a2('0x37')]?_0x10f9a5[_0x52a2('0x36')]:_0x1c556d[_0x52a2('0x31')];if(!_0x35316c[_0x52a2('0x33')]['hasOwnProperty'](_0x52a2('0x38'))){_0x10f9a5['limit']=qs[_0x52a2('0x20')](_0x35316c['query']['limit']);_0x10f9a5[_0x52a2('0x1f')]=qs['offset'](_0x35316c['query']['offset']);}_0x10f9a5[_0x52a2('0x39')]=qs[_0x52a2('0x3a')](_0x35316c['query']['sort']);_0x10f9a5[_0x52a2('0x3b')]=qs[_0x52a2('0x34')](_[_0x52a2('0x3c')](_0x35316c['query'],_0x1c556d['filters']),_0x1fa8bd);if(_0x35316c['query'][_0x52a2('0x3d')]){_0x10f9a5['where']=_[_0x52a2('0x3e')](_0x10f9a5['where'],{'$or':_[_0x52a2('0x2e')](_0x1fa8bd,function(_0xd14555){if(_0xd14555['type']!==_0x52a2('0x3f')){var _0x3cd751={};_0x3cd751[_0xd14555['name']]={'$like':'%'+_0x35316c[_0x52a2('0x33')][_0x52a2('0x3d')]+'%'};return _0x3cd751;}})});}_0x10f9a5=_[_0x52a2('0x3e')]({},_0x10f9a5,_0x35316c[_0x52a2('0x40')]);var _0x2923e9={'where':_0x10f9a5[_0x52a2('0x3b')]};return db[_0x52a2('0x2f')][_0x52a2('0x41')](_0x2923e9)[_0x52a2('0x27')](function(_0x5ca304){_0x559b31[_0x52a2('0x41')]=_0x5ca304;if(_0x35316c[_0x52a2('0x33')][_0x52a2('0x42')]){_0x10f9a5[_0x52a2('0x43')]=[{'all':!![]}];}return db[_0x52a2('0x2f')][_0x52a2('0x44')](_0x10f9a5);})[_0x52a2('0x27')](function(_0x9d27b0){_0x559b31[_0x52a2('0x45')]=_0x9d27b0;return _0x559b31;})[_0x52a2('0x27')](respondWithFilteredResult(_0x547f37,_0x10f9a5))[_0x52a2('0x46')](handleError(_0x547f37,null));};exports['show']=function(_0x34e795,_0x106f6a){var _0x4732de={'raw':![],'where':{'id':_0x34e795[_0x52a2('0x47')]['id']}},_0x137e9e={};_0x137e9e['model']=_[_0x52a2('0x32')](db[_0x52a2('0x2f')]['rawAttributes']);_0x137e9e[_0x52a2('0x33')]=_[_0x52a2('0x32')](_0x34e795[_0x52a2('0x33')]);_0x137e9e['filters']=_[_0x52a2('0x48')](_0x137e9e['model'],_0x137e9e['query']);_0x4732de[_0x52a2('0x36')]=_[_0x52a2('0x48')](_0x137e9e['model'],qs[_0x52a2('0x35')](_0x34e795[_0x52a2('0x33')][_0x52a2('0x35')]));_0x4732de[_0x52a2('0x36')]=_0x4732de[_0x52a2('0x36')][_0x52a2('0x37')]?_0x4732de[_0x52a2('0x36')]:_0x137e9e[_0x52a2('0x31')];if(_0x34e795[_0x52a2('0x33')][_0x52a2('0x42')]){_0x4732de[_0x52a2('0x43')]=[{'all':!![]}];}_0x4732de=_['merge']({},_0x4732de,_0x34e795[_0x52a2('0x40')]);return db[_0x52a2('0x2f')][_0x52a2('0x49')](_0x4732de)[_0x52a2('0x27')](handleEntityNotFound(_0x106f6a,null))[_0x52a2('0x27')](respondWithResult(_0x106f6a,null))[_0x52a2('0x46')](handleError(_0x106f6a,null));};exports[_0x52a2('0x4a')]=function(_0x157d92,_0x47ddb5){return db[_0x52a2('0x2f')]['create'](_0x157d92[_0x52a2('0x4b')],{})[_0x52a2('0x27')](respondWithResult(_0x47ddb5,0xc9))[_0x52a2('0x46')](handleError(_0x47ddb5,null));};exports[_0x52a2('0x4c')]=function(_0x58c7d7,_0x128749){var _0x26f012={'where':{'id':_0x58c7d7[_0x52a2('0x47')]['id']}},_0x371855={};_0x371855[_0x52a2('0x31')]=_[_0x52a2('0x32')](db[_0x52a2('0x2f')]['rawAttributes']);_0x26f012[_0x52a2('0x36')]=_[_0x52a2('0x48')](_0x371855[_0x52a2('0x31')],qs['fields'](_0x58c7d7['query'][_0x52a2('0x35')]));_0x26f012['attributes']=_0x26f012[_0x52a2('0x36')][_0x52a2('0x37')]?_0x26f012[_0x52a2('0x36')]:_0x371855[_0x52a2('0x31')];if(_0x58c7d7[_0x52a2('0x33')][_0x52a2('0x42')]){_0x26f012[_0x52a2('0x43')]=[{'all':!![]}];}_0x26f012=_[_0x52a2('0x3e')]({},_0x26f012,_0x58c7d7[_0x52a2('0x40')]);return db['UserProfile'][_0x52a2('0x49')](_0x26f012)[_0x52a2('0x27')](handleEntityNotFound(_0x128749,null))[_0x52a2('0x27')](function(_0x33cb1b){if(_0x33cb1b){var _0x5ad791=_0x33cb1b[_0x52a2('0x4d')]({'plain':!![]});_0x5ad791=qs[_0x52a2('0x4e')](_0x5ad791,['id',_0x52a2('0x4f'),'updatedAt',_0x52a2('0x50')]);_0x58c7d7[_0x52a2('0x4b')]=_['omit'](_0x58c7d7[_0x52a2('0x4b')],['id',_0x52a2('0x4f'),_0x52a2('0x51')]);return db[_0x52a2('0x52')][_0x52a2('0x53')](function(_0x347b05){return db[_0x52a2('0x2f')]['create'](_['merge'](_0x5ad791,_0x58c7d7[_0x52a2('0x4b')]),{'include':_0x58c7d7[_0x52a2('0x33')][_0x52a2('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x347b05})[_0x52a2('0x27')](function(_0x431036){var _0xbae2bb=_0x431036[_0x52a2('0x4d')]({'plain':!![]});return db[_0x52a2('0x54')][_0x52a2('0x44')]({'where':{'userProfileId':_0x58c7d7[_0x52a2('0x47')]['id']},'raw':!![]})[_0x52a2('0x27')](function(_0x1f0be0){if(_0x1f0be0){return BPromise[_0x52a2('0x55')](_0x1f0be0,function(_0x31f652){return new BPromise(function(_0x1a6e9b,_0xa7da9c){if(_0x31f652[_0x52a2('0x56')]===null||_0x31f652[_0x52a2('0x56')]===0x1)_0x1a6e9b(null);return db[_0x52a2('0x57')]['findAll']({'where':{'sectionId':_0x31f652['id']},'raw':!![]})['then'](function(_0xf0aada){var _0x2376d9=_[_0x52a2('0x2e')](_0xf0aada,function(_0xd43c52){return qs[_0x52a2('0x4e')](_0xd43c52,['id',_0x52a2('0x4f'),_0x52a2('0x51'),_0x52a2('0x58')]);});_0x1a6e9b(_0x2376d9);})[_0x52a2('0x46')](function(_0x29f2a8){_0xa7da9c(_0x29f2a8);});})[_0x52a2('0x27')](function(_0x1ecc86){var _0x2c84e5=qs['omit'](_0x31f652,['id','createdAt',_0x52a2('0x51')]);_0x2c84e5[_0x52a2('0x59')]=_0xbae2bb['id'];if(_0x1ecc86)_0x2c84e5[_0x52a2('0x5a')]=_0x1ecc86;return _0x2c84e5;})['then'](function(_0x4893b0){return db[_0x52a2('0x54')][_0x52a2('0x4a')](_0x4893b0,{'include':[{'model':db[_0x52a2('0x57')],'as':_0x52a2('0x5a')}],'raw':!![],'transaction':_0x347b05});});})[_0x52a2('0x27')](function(){return _0xbae2bb;});}});});});}})[_0x52a2('0x27')](respondWithResult(_0x128749,0xc9))[_0x52a2('0x46')](handleError(_0x128749,null));};exports[_0x52a2('0x5b')]=function(_0x57be1e,_0x1f2b1a){if(_0x57be1e[_0x52a2('0x4b')]['id']){delete _0x57be1e[_0x52a2('0x4b')]['id'];}return db['UserProfile'][_0x52a2('0x49')]({'where':{'id':_0x57be1e[_0x52a2('0x47')]['id']}})[_0x52a2('0x27')](handleEntityNotFound(_0x1f2b1a,null))[_0x52a2('0x27')](saveUpdates(_0x57be1e[_0x52a2('0x4b')],null))[_0x52a2('0x27')](respondWithResult(_0x1f2b1a,null))[_0x52a2('0x46')](handleError(_0x1f2b1a,null));};exports['destroy']=function(_0x57e320,_0x51785f){return db[_0x52a2('0x2f')][_0x52a2('0x49')]({'where':{'id':_0x57e320[_0x52a2('0x47')]['id']}})[_0x52a2('0x27')](handleEntityNotFound(_0x51785f,null))[_0x52a2('0x27')](removeEntity(_0x51785f,null))[_0x52a2('0x46')](handleError(_0x51785f,null));};exports[_0x52a2('0x5c')]=function(_0x6670cd,_0x2d65cf){return db['UserProfile'][_0x52a2('0x5c')]()[_0x52a2('0x27')](respondWithResult(_0x2d65cf,null))[_0x52a2('0x46')](handleError(_0x2d65cf,null));};exports[_0x52a2('0x5d')]=function(_0x1e34dd,_0xbe016e){var _0x1e4269=_0x1e34dd[_0x52a2('0x4b')];return db[_0x52a2('0x2f')][_0x52a2('0x49')]({'where':{'id':_0x1e34dd['params']['id']}})[_0x52a2('0x27')](handleEntityNotFound(_0xbe016e,null))[_0x52a2('0x27')](function(_0x22dee3){if(_0x22dee3){return db[_0x52a2('0x52')][_0x52a2('0x53')](function(_0x1be5bd){return db[_0x52a2('0x54')][_0x52a2('0x26')]({'where':{'userProfileId':_0x1e34dd[_0x52a2('0x47')]['id'],'sectionId':_[_0x52a2('0x2e')](_0x1e4269,function(_0x6e2ac7){return _0x6e2ac7[_0x52a2('0x58')];})},'transaction':_0x1be5bd})[_0x52a2('0x27')](function(){var _0x378965=_[_0x52a2('0x2e')](_0x1e4269,function(_0x4f2992){_0x4f2992[_0x52a2('0x59')]=_0x1e34dd[_0x52a2('0x47')]['id'];return _0x4f2992;});var _0x4b3e20=[];return BPromise[_0x52a2('0x55')](_0x378965,function(_0x581bbf){return db[_0x52a2('0x54')][_0x52a2('0x4a')](_0x581bbf,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x1be5bd})[_0x52a2('0x27')](function(_0x456f3e){_0x4b3e20[_0x52a2('0x5e')](_0x456f3e['get']({'plain':!![]}));});})[_0x52a2('0x27')](function(){return _0x4b3e20;});});});}})[_0x52a2('0x27')](function(_0x216a0d){return _0x216a0d;})[_0x52a2('0x27')](respondWithResult(_0xbe016e,null))[_0x52a2('0x46')](handleError(_0xbe016e,null));};exports[_0x52a2('0x5f')]=function(_0x3547e5,_0x2a19ae){var _0x4d47e8;return db[_0x52a2('0x2f')][_0x52a2('0x49')]({'where':{'id':_0x3547e5[_0x52a2('0x47')]['id']},'attributes':['id',_0x52a2('0x2b')]})[_0x52a2('0x27')](handleEntityNotFound(_0x2a19ae,null))[_0x52a2('0x27')](function(_0x53f363){if(_0x53f363){_0x4d47e8=_0x53f363;return db[_0x52a2('0x54')]['destroy']({'where':{'userProfileId':_0x3547e5[_0x52a2('0x47')]['id'],'sectionId':_0x3547e5['query'][_0x52a2('0x60')]}});}})['then'](function(){return _0x4d47e8;})[_0x52a2('0x27')](respondWithStatusCode(_0x2a19ae,null))[_0x52a2('0x46')](handleError(_0x2a19ae,null));};exports[_0x52a2('0x61')]=function(_0x598327,_0x36706f){var _0x2d6118=[];var _0x3eeb8c=[];return db[_0x52a2('0x54')][_0x52a2('0x44')]({'where':{'userProfileId':_0x598327[_0x52a2('0x47')]['id']},'raw':!![]})[_0x52a2('0x27')](function(_0x51f023){_0x2d6118=_[_0x52a2('0x3d')](_0x51f023,function(_0x4a534d){return _0x4a534d[_0x52a2('0x62')]===0x1||_[_0x52a2('0x63')]([0x3eb,0x709],_0x4a534d[_0x52a2('0x58')]);});if(!_[_0x52a2('0x64')](_0x2d6118)){return _[_0x52a2('0x2e')](_0x2d6118,function(_0x33404e){return _0x33404e[_0x52a2('0x58')];});}else{return;}})['then'](function(_0x1d3868){if(_0x1d3868)_0x3eeb8c=_0x1d3868;if(_[_0x52a2('0x63')](_0x3eeb8c,0x64)){var _0x9227f4=_[_0x52a2('0x49')](_0x2d6118,{'sectionId':0x64});return hasDefaultDashboard(_0x9227f4)['then'](function(_0x4fdf15){return _['map'](_0x2d6118,function(_0x108b24){if(_0x108b24[_0x52a2('0x58')]===0x64){_0x108b24[_0x52a2('0x65')]=_0x4fdf15;}return _0x108b24;});});}else{return;}})['then'](function(_0x405b39){if(_0x405b39)_0x2d6118=_0x405b39;if(_[_0x52a2('0x63')](_0x3eeb8c,0x3eb)){var _0xc544b=_['find'](_0x2d6118,{'sectionId':0x3eb});return getCustomDashboards(_0xc544b)[_0x52a2('0x27')](function(_0x535cf3){return _[_0x52a2('0x2e')](_0x2d6118,function(_0x2d494b){if(_0xc544b['enabled']){if(_0x2d494b['sectionId']===0x3eb){_0x2d494b[_0x52a2('0x65')]=_0x535cf3;}}else{if(_0x2d494b[_0x52a2('0x58')]===0x64){_0x2d494b[_0x52a2('0x65')]=_0x535cf3;}}return _0x2d494b;});});}else{return;}})[_0x52a2('0x27')](function(_0x274e6a){if(_0x274e6a)_0x2d6118=_0x274e6a;if(_[_0x52a2('0x63')](_0x3eeb8c,0x709)){var _0x52d016=_[_0x52a2('0x49')](_0x2d6118,{'sectionId':0x709});return getPlugins(_0x52d016)[_0x52a2('0x27')](function(_0x526834){if(_0x52d016['enabled']){return _['map'](_0x2d6118,function(_0x58c257){if(_0x58c257['sectionId']===0x709){_0x58c257[_0x52a2('0x65')]=_0x526834;}return _0x58c257;});}else{var _0x84cfcf={'sectionId':0x76c,'enabled':0x1,'subsections':_0x526834};var _0x5ca143=_['map'](_0x2d6118);_0x5ca143[_0x52a2('0x5e')](_0x84cfcf);return _0x5ca143;}});}else{return;}})[_0x52a2('0x27')](function(_0x4b7cc8){if(_0x4b7cc8)_0x2d6118=_0x4b7cc8;return _[_0x52a2('0x3d')](_0x2d6118,[_0x52a2('0x62'),0x1]);})['then'](respondWithResult(_0x36706f,null))[_0x52a2('0x46')](handleError(_0x36706f,null));};function hasDefaultDashboard(_0x237cbd){var _0x2c2731=[0x65];return new BPromise(function(_0x28a92c,_0x22f6a1){try{if(_0x237cbd['autoAssociation']){_0x28a92c(_0x2c2731);}else{return db[_0x52a2('0x57')][_0x52a2('0x66')]({'where':{'sectionId':_0x237cbd['id']},'raw':!![]})[_0x52a2('0x27')](function(_0x2d752d){_0x2d752d?_0x28a92c(_0x2c2731):_0x28a92c();});}}catch(_0x724d3e){_0x22f6a1(_0x724d3e);}});}function getCustomDashboards(_0x33dced){var _0x177535=[];return new BPromise(function(_0x3f50ed,_0x1effe1){try{if(_0x33dced['autoAssociation']){return db[_0x52a2('0x67')][_0x52a2('0x44')]({'raw':!![]})['then'](function(_0x1040a1){_0x1040a1[_0x52a2('0x68')](function(_0x8d07e4){_0x177535[_0x52a2('0x5e')](_0x8d07e4['id']+0x1869f);});_0x3f50ed(_0x177535);});}else{return db[_0x52a2('0x57')]['findAll']({'where':{'sectionId':_0x33dced['id']},'raw':!![]})[_0x52a2('0x27')](function(_0x40ecb5){_0x40ecb5[_0x52a2('0x68')](function(_0x3a3dd3){_0x177535[_0x52a2('0x5e')](_0x3a3dd3[_0x52a2('0x69')]+0x1869f);});_0x3f50ed(_0x177535);});}}catch(_0x5ddbaf){_0x1effe1(_0x5ddbaf);}});}function getPlugins(_0x23c602){var _0x33a6fd=[];return new BPromise(function(_0x316009,_0x4959f9){try{if(_0x23c602['autoAssociation']){return db[_0x52a2('0x6a')][_0x52a2('0x44')]({'raw':!![]})[_0x52a2('0x27')](function(_0x46dd46){_0x46dd46[_0x52a2('0x68')](function(_0x3916dc){_0x33a6fd['push'](_0x3916dc['id']+0x15b38);});_0x316009(_0x33a6fd);});}else{return db[_0x52a2('0x57')][_0x52a2('0x44')]({'where':{'sectionId':_0x23c602['id']},'raw':!![]})['then'](function(_0x41c003){_0x41c003[_0x52a2('0x68')](function(_0x3c8daa){_0x33a6fd[_0x52a2('0x5e')](_0x3c8daa['resourceId']+0x15b38);});_0x316009(_0x33a6fd);});}}catch(_0x30a30d){_0x4959f9(_0x30a30d);}});}exports['addResources']=function(_0x5b429e,_0x3b9a9b){return db['UserProfile'][_0x52a2('0x49')]({'where':{'id':_0x5b429e['params']['id']}})[_0x52a2('0x27')](handleEntityNotFound(_0x3b9a9b,null))['then'](function(_0x2e9817){if(_0x2e9817){return db['sequelize'][_0x52a2('0x53')](function(_0x40a96d){return db[_0x52a2('0x54')]['findAll']({'where':{'userProfileId':_0x5b429e['params']['id']},'attributes':['id'],'raw':!![]})[_0x52a2('0x27')](function(_0x1bab6c){if(_0x1bab6c){return db[_0x52a2('0x54')]['destroy']({'where':{'userProfileId':_0x5b429e['params']['id'],'id':_['map'](_0x1bab6c,function(_0x59d771){return _0x59d771['id'];})},'transaction':_0x40a96d});}})[_0x52a2('0x27')](function(_0x2406c7){var _0x4f363e=_[_0x52a2('0x2e')](_0x5b429e[_0x52a2('0x4b')],function(_0x37c9ce){_0x37c9ce[_0x52a2('0x59')]=_0x5b429e[_0x52a2('0x47')]['id'];return _0x37c9ce;});return db[_0x52a2('0x54')][_0x52a2('0x6b')](_0x4f363e,{'raw':!![],'transaction':_0x40a96d});})[_0x52a2('0x27')](function(_0x43d5ae){var _0x151344=_[_0x52a2('0x3d')](_['map'](_0x43d5ae,function(_0x3c5cb0){return _0x3c5cb0[_0x52a2('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x151344){return db[_0x52a2('0x54')]['findAll']({'where':{'userProfileId':_0x5b429e[_0x52a2('0x47')]['id'],'sectionId':_[_0x52a2('0x2e')](_0x151344,function(_0x103ecf){return _0x103ecf['sectionId'];})},'attributes':['id',_0x52a2('0x58')],'raw':!![]})[_0x52a2('0x27')](function(_0x4a4165){var _0x2cd78f=_[_0x52a2('0x2e')](_0x5b429e[_0x52a2('0x4b')],function(_0x2740d5){_0x2740d5[_0x52a2('0x59')]=_0x5b429e[_0x52a2('0x47')]['id'];return _0x2740d5;});return db[_0x52a2('0x57')]['bulkCreate'](_0x2cd78f,{'raw':!![],'transaction':_0x40a96d});});}})[_0x52a2('0x46')](handleError(_0x3b9a9b,null));});}})[_0x52a2('0x27')](function(_0x506f99){var _0xff392e=_[_0x52a2('0x2e')](_0x506f99,function(_0x572a54){return _0x572a54['get']({'plain':!![]});});})[_0x52a2('0x27')](respondWithResult(_0x3b9a9b,null))[_0x52a2('0x46')](handleError(_0x3b9a9b,null));};exports[_0x52a2('0x6c')]=function(_0x59eb3a,_0x42bfd0,_0x3549a0){return db[_0x52a2('0x2f')][_0x52a2('0x49')]({'where':{'id':_0x59eb3a[_0x52a2('0x47')]['id']}})[_0x52a2('0x27')](handleEntityNotFound(_0x42bfd0,null))[_0x52a2('0x27')](function(_0x13cc8c){if(_0x13cc8c){return _0x13cc8c[_0x52a2('0x6c')](_0x59eb3a[_0x52a2('0x33')]['ids']);}})[_0x52a2('0x27')](respondWithStatusCode(_0x42bfd0,null))['catch'](handleError(_0x42bfd0,null));};exports[_0x52a2('0x6d')]=function(_0x33e873,_0x3bd7c8){var _0x575ded={'raw':![],'where':{}};var _0x22e596={};var _0x322cf9={'count':0x0,'rows':[]};var _0x1ab7de=_0x33e873[_0x52a2('0x33')][_0x52a2('0x6e')];if(typeof _0x1ab7de==='undefined'){throw new db[(_0x52a2('0x6f'))][(_0x52a2('0x70'))](_0x52a2('0x71'));}var _0x9fed5e=_0x33e873[_0x52a2('0x33')][_0x52a2('0x72')]||![];var _0x2b73e8=getQueryModels(_0x1ab7de,_0x9fed5e);if(typeof _0x2b73e8[_0x52a2('0x73')]==='undefined'){throw new db['Sequelize']['ValidationError'](_0x52a2('0x74')+_0x1ab7de+'\x27');}var _0x4005f7=[];if(!_[_0x52a2('0x64')](_0x2b73e8[_0x52a2('0x75')])){_0x4005f7=_0x2b73e8[_0x52a2('0x75')];}else{_0x4005f7=[{'name':_0x1ab7de}];}return db[_0x52a2('0x2f')][_0x52a2('0x66')]({'where':{'id':_0x33e873[_0x52a2('0x47')]['id']}})['then'](handleEntityNotFound(_0x3bd7c8,null))[_0x52a2('0x27')](function(_0x2fe972){if(_0x2fe972){var _0x3ac023=[];for(var _0x5a5823=0x0;_0x5a5823<_0x4005f7['length'];_0x5a5823++){_0x3ac023[_0x52a2('0x5e')](db['UserProfileSection'][_0x52a2('0x66')]({'where':{'userProfileId':_0x2fe972['id'],'name':_0x4005f7[_0x5a5823][_0x52a2('0x2b')]},'raw':!![]}));}return BPromise['all'](_0x3ac023);}})[_0x52a2('0x27')](function(_0x1e269a){var _0x37a1af=_[_0x52a2('0x3d')](_0x1e269a,function(_0x38d103){return _0x38d103?_0x38d103:undefined;});var _0xc23700=_[_0x52a2('0x3d')](_0x4005f7,[_0x52a2('0x76'),!![]]);var _0x21efa5=_[_0x52a2('0x64')](_0x37a1af)&&_['isEmpty'](_0xc23700)?null:_[_0x52a2('0x77')](_0xc23700,_0x37a1af);if(_0x21efa5){var _0x5dee46=[];for(var _0x13c1d4=0x0;_0x13c1d4<_0x21efa5[_0x52a2('0x37')];_0x13c1d4++){var _0x758b43=_[_0x52a2('0x49')](_0x4005f7,function(_0x3366c2){return _0x21efa5[_0x13c1d4]?_0x3366c2[_0x52a2('0x2b')]===_0x21efa5[_0x13c1d4][_0x52a2('0x2b')]:null;});if(_0x758b43){if(_0x21efa5[_0x13c1d4][_0x52a2('0x76')]){_0x5dee46['push'](getAllResources(_0x2b73e8[_0x52a2('0x73')],_0x21efa5[_0x13c1d4]));}else{if(!_0x21efa5[_0x13c1d4]['autoAssociation']){_0x5dee46[_0x52a2('0x5e')](getAllowedResources(_0x758b43,_0x21efa5[_0x13c1d4],_0x2b73e8[_0x52a2('0x73')]));}else{if(_0x758b43['model']){_0x5dee46['push'](getAllFilteredResources(_0x758b43,_0x21efa5[_0x13c1d4]));}}}}}return BPromise[_0x52a2('0x78')](_0x5dee46);}else{return null;}})[_0x52a2('0x27')](function(_0x26abbd){var _0x185289=_0x26abbd;var _0x40f7cf=null;if(_0x185289){_0x40f7cf=_0x185289[_0x52a2('0x37')]===0x1?_0x185289[0x0]:null;}if(_0x40f7cf||_0x185289){var _0x4c4fdb=db[_0x2b73e8[_0x52a2('0x73')]][_0x52a2('0x30')];_0x22e596[_0x52a2('0x31')]=_[_0x52a2('0x32')](_0x4c4fdb);_0x22e596[_0x52a2('0x33')]=_[_0x52a2('0x32')](_0x33e873['query']);_0x22e596[_0x52a2('0x34')]=_[_0x52a2('0x48')](_0x22e596[_0x52a2('0x31')],_0x22e596[_0x52a2('0x33')]);_0x575ded[_0x52a2('0x36')]=_[_0x52a2('0x48')](_0x22e596[_0x52a2('0x31')],qs[_0x52a2('0x35')](_0x33e873[_0x52a2('0x33')][_0x52a2('0x35')]));_0x575ded[_0x52a2('0x36')]=_0x575ded['attributes'][_0x52a2('0x37')]?_0x575ded[_0x52a2('0x36')]:_0x22e596['model'];if(!_0x33e873[_0x52a2('0x33')][_0x52a2('0x79')]('nolimit')){_0x575ded['limit']=qs['limit'](_0x33e873[_0x52a2('0x33')][_0x52a2('0x20')]);_0x575ded[_0x52a2('0x1f')]=qs[_0x52a2('0x1f')](_0x33e873[_0x52a2('0x33')]['offset']);}_0x575ded[_0x52a2('0x39')]=qs['sort'](_0x33e873[_0x52a2('0x33')][_0x52a2('0x3a')]);_0x575ded[_0x52a2('0x3b')]=qs[_0x52a2('0x34')](_[_0x52a2('0x3c')](_0x33e873[_0x52a2('0x33')],_0x22e596[_0x52a2('0x34')]));if(_0x33e873[_0x52a2('0x33')][_0x52a2('0x3d')]){_0x575ded[_0x52a2('0x3b')]=_[_0x52a2('0x3e')](_0x575ded['where'],{'$or':_[_0x52a2('0x2e')](_0x4c4fdb,function(_0x4c4812){if(_0x4c4812[_0x52a2('0x7a')][_0x52a2('0x7b')]!==_0x52a2('0x3f')){var _0x334015={};_0x334015[_0x4c4812[_0x52a2('0x7c')]]={'$like':'%'+_0x33e873[_0x52a2('0x33')][_0x52a2('0x3d')]+'%'};return _0x334015;}})});}var _0x4e7796=[];if(_0x40f7cf){var _0x41d5d6=_[_0x52a2('0x49')](_0x4005f7,['name',_0x40f7cf[_0x52a2('0x2b')]]);if(_0x41d5d6[_0x52a2('0x7c')]){var _0x21ae1e={};if(_0x2b73e8[_0x52a2('0x73')]==='AnalyticExtractedReport'){_0x21ae1e[_0x41d5d6[_0x52a2('0x7d')]]=_[_0x52a2('0x2e')](_0x40f7cf[_0x52a2('0x7e')],'id');}else{_0x21ae1e[_0x41d5d6[_0x52a2('0x7d')]]=_0x40f7cf[_0x52a2('0x7e')];}_0x4e7796[_0x52a2('0x5e')](_0x21ae1e);}else{_0x575ded['where']['id']=_0x40f7cf[_0x52a2('0x7e')];}}else{for(var _0x3da57e=0x0;_0x3da57e<_0x185289['length'];_0x3da57e++){var _0x41d5d6=_[_0x52a2('0x49')](_0x4005f7,[_0x52a2('0x2b'),_0x185289[_0x3da57e][_0x52a2('0x2b')]]);if(_0x41d5d6[_0x52a2('0x7c')]){var _0x21ae1e={};_0x21ae1e[_0x41d5d6['foreignKey']]=_0x185289[_0x3da57e][_0x52a2('0x7e')];_0x4e7796['push'](_0x21ae1e);}else{if(!_0x575ded['where']['id'])_0x575ded[_0x52a2('0x3b')]['id']=[];_0x185289[_0x3da57e][_0x52a2('0x7e')]['forEach'](function(_0x2acf15){_0x575ded[_0x52a2('0x3b')]['id'][_0x52a2('0x5e')](_0x2acf15);});}}}if(!_[_0x52a2('0x64')](_0x4e7796)){_0x575ded[_0x52a2('0x3b')]=_[_0x52a2('0x3e')](_0x575ded[_0x52a2('0x3b')],{'$and':{'$or':_0x4e7796}});}_0x575ded=_[_0x52a2('0x3e')]({},_0x575ded,_0x33e873[_0x52a2('0x40')]);if(_0x40f7cf&&!_0x40f7cf[_0x52a2('0x56')]&&_0x2b73e8[_0x52a2('0x73')]===_0x52a2('0x7f')){if(_0x33e873['query']['includeAll']){_0x575ded[_0x52a2('0x43')]=[{'all':!![]}];}return db[_0x2b73e8['childModel']][_0x52a2('0x44')](_0x575ded)['then'](function(_0x559a32){var _0x14da12=[];_0x559a32['forEach'](function(_0x3d3eb2){var _0x486f07;switch(_0x3d3eb2[_0x52a2('0x80')]){case _0x52a2('0x81'):_0x486f07=_['find'](_0x40f7cf[_0x52a2('0x7e')],function(_0x2701b7){return _0x2701b7['id']===_0x3d3eb2[_0x52a2('0x82')]&&_0x2701b7[_0x52a2('0x7a')]===_0x52a2('0x83');});break;case'custom':_0x486f07=_[_0x52a2('0x49')](_0x40f7cf[_0x52a2('0x7e')],function(_0x3f2286){return _0x3f2286['id']===_0x3d3eb2[_0x52a2('0x82')]&&_0x3f2286[_0x52a2('0x7a')]==='CustomReports';});break;}if(_0x486f07)_0x14da12[_0x52a2('0x5e')](_0x3d3eb2);});_0x322cf9[_0x52a2('0x41')]=_0x14da12[_0x52a2('0x37')];_0x322cf9[_0x52a2('0x45')]=_0x14da12;return _0x322cf9;});}else{return db[_0x2b73e8['childModel']][_0x52a2('0x41')]({'where':_0x575ded['where']})[_0x52a2('0x27')](function(_0xd2fe1e){_0x322cf9[_0x52a2('0x41')]=_0xd2fe1e;if(_0x33e873[_0x52a2('0x33')][_0x52a2('0x42')]){if(_0x2b73e8['childModel']===_0x52a2('0x84')){_0x575ded[_0x52a2('0x43')]=[{'model':db['Tag'],'as':_0x52a2('0x85'),'attributes':['id',_0x52a2('0x2b'),_0x52a2('0x86')],'required':_0x33e873['query'][_0x52a2('0x87')]?!![]:![]},{'model':db['Tag'],'as':'ThroughTags','attributes':['id',_0x52a2('0x2b'),'color'],'through':_0x33e873[_0x52a2('0x33')]['tag']?{'attributes':[],'where':{'TagId':_0x33e873['query'][_0x52a2('0x87')]||undefined}}:{},'required':_0x33e873[_0x52a2('0x33')][_0x52a2('0x87')]?!![]:![]}];}else{_0x575ded[_0x52a2('0x43')]=[{'all':!![]}];}}return db[_0x2b73e8['childModel']][_0x52a2('0x44')](_0x575ded);})[_0x52a2('0x27')](function(_0x670ede){_0x322cf9['rows']=_0x670ede;return _0x322cf9;});}}else{return _0x322cf9;}})[_0x52a2('0x27')](respondWithFilteredResult(_0x3bd7c8,_0x575ded))['catch'](handleError(_0x3bd7c8,null));};function getAllResources(_0x59b638,_0x4ca6fc){return new BPromise(function(_0x5a19f0,_0x53e1a7){if(_0x4ca6fc){var _0x55f5d7=_0x4ca6fc['filter']?{[_0x4ca6fc['filter'][_0x52a2('0x7c')]]:_0x4ca6fc[_0x52a2('0x3d')][_0x52a2('0x88')]}:undefined;return db[_0x59b638][_0x52a2('0x44')]({'where':_0x55f5d7,'raw':!![]})[_0x52a2('0x27')](function(_0x1e4dc7){_0x4ca6fc[_0x52a2('0x7e')]=_['map'](_0x1e4dc7,'id');_0x5a19f0(_0x4ca6fc);})['catch'](function(_0x527b12){_0x53e1a7(_0x527b12);});}else{_0x5a19f0(null);}});}function getAllFilteredResources(_0x58e10d,_0x1ed192){return new BPromise(function(_0x50fafa,_0x12605e){var _0x49c21a=_0x58e10d[_0x52a2('0x3d')]?{[_0x58e10d[_0x52a2('0x3d')][_0x52a2('0x7c')]]:_0x58e10d[_0x52a2('0x3d')][_0x52a2('0x88')]}:undefined;return db[_0x58e10d[_0x52a2('0x31')]][_0x52a2('0x44')]({'where':_0x49c21a,'raw':!![]})[_0x52a2('0x27')](function(_0x1d1618){_0x1ed192[_0x52a2('0x7e')]=_[_0x52a2('0x2e')](_0x1d1618,function(_0x418243){return _0x418243['name'];});_0x50fafa(_0x1ed192);})['catch'](function(_0x2cc4f4){_0x12605e(_0x2cc4f4);});});}function getAllowedResources(_0x4ced26,_0x1b55f7,_0x1fc2d8){return new BPromise(function(_0x4b8295,_0x4fbfa1){if(_0x1b55f7){return db['UserProfileResource'][_0x52a2('0x44')]({'where':{'sectionId':_0x1b55f7['id']},'raw':!![]})[_0x52a2('0x27')](function(_0x1055bb){if(_0x4ced26[_0x52a2('0x7c')]&&_0x4ced26[_0x52a2('0x7c')]!=='id'){_0x1b55f7[_0x52a2('0x7e')]=_[_0x52a2('0x2e')](_0x1055bb,function(_0x447637){return _0x447637[_0x4ced26[_0x52a2('0x7c')]];});}else{if(_0x1fc2d8==='AnalyticExtractedReport'){_0x1b55f7[_0x52a2('0x7e')]=_[_0x52a2('0x2e')](_0x1055bb,function(_0x2868bb){return{'id':_0x2868bb['resourceId'],'type':_0x2868bb[_0x52a2('0x7a')]};});}else{_0x1b55f7[_0x52a2('0x7e')]=_[_0x52a2('0x2e')](_0x1055bb,function(_0x127a63){return _0x127a63[_0x52a2('0x69')];});}}_0x4b8295(_0x1b55f7);})[_0x52a2('0x46')](function(_0x46043c){_0x4fbfa1(_0x46043c);});}else{_0x4b8295(null);}});}function getQueryModels(_0x228625,_0x1efb91){var _0x2c6b7f=_0x228625[_0x52a2('0x89')]();var _0x2bc7f9={'childModel':undefined,'parentSections':[]};switch(_0x2c6b7f){case'squareprojects':_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0x8a');break;case'odbc':_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0x8b');break;case _0x52a2('0x8c'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0x8d');_0x2bc7f9[_0x52a2('0x75')]=[{'name':_0x52a2('0x8e'),'field':_0x52a2('0x2b'),'foreignKey':_0x52a2('0x8f')}];break;case _0x52a2('0x90'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0x91');break;case'contacts':_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0x84');_0x2bc7f9[_0x52a2('0x75')]=[{'name':'Lists','field':'id','foreignKey':_0x52a2('0x92')}];break;case _0x52a2('0x93'):_0x2bc7f9[_0x52a2('0x73')]='CmList';break;case _0x52a2('0x94'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0x95');break;case _0x52a2('0x96'):_0x2bc7f9[_0x52a2('0x73')]='CmCustomField';break;case _0x52a2('0x97'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0x98');break;case'chatwebsites':_0x2bc7f9['childModel']=_0x52a2('0x99');break;case _0x52a2('0x9a'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0x9b');break;case _0x52a2('0x9c'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0x9d');break;case'inboundroutes':case _0x52a2('0x9e'):case _0x52a2('0x9f'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xa0');break;case _0x52a2('0xa1'):_0x2bc7f9['childModel']=_0x52a2('0xa2');break;case _0x52a2('0xa3'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xa4');break;case'voicerecordings':_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xa5');_0x2bc7f9[_0x52a2('0x75')]=[{'name':_0x52a2('0xa6'),'field':_0x52a2('0x2b'),'foreignKey':_0x52a2('0xa7'),'model':_0x52a2('0xa8'),'filter':{'field':_0x52a2('0xa9'),'value':[_0x52a2('0xaa')]}},{'name':'Telephones','field':'name','foreignKey':'membername','model':_0x52a2('0xa8'),'filter':{'field':_0x52a2('0xa9'),'value':[_0x52a2('0xab')]}},{'name':_0x52a2('0xac'),'field':_0x52a2('0x2b'),'foreignKey':_0x52a2('0xad'),'model':'VoiceQueue','filter':{'field':_0x52a2('0x7a'),'value':[_0x52a2('0xae')]}},{'name':'QueueCampaigns','field':_0x52a2('0x2b'),'foreignKey':_0x52a2('0xad'),'model':_0x52a2('0xaf'),'filter':{'field':_0x52a2('0x7a'),'value':[_0x52a2('0xb0')]}}];break;case _0x52a2('0xb1'):_0x2bc7f9[_0x52a2('0x73')]='VoiceMusicOnHold';break;case _0x52a2('0xb2'):_0x2bc7f9[_0x52a2('0x73')]='VoiceChanSpy';break;case _0x52a2('0xb3'):_0x2bc7f9[_0x52a2('0x73')]='VoicePrefix';break;case _0x52a2('0xb4'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xb5');break;case'mailqueues':_0x2bc7f9['childModel']=_0x52a2('0xb6');break;case _0x52a2('0xb7'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xb8');break;case _0x52a2('0xb9'):_0x2bc7f9['childModel']='MailSubstatus';break;case'openchannelqueues':_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xba');break;case _0x52a2('0xbb'):_0x2bc7f9[_0x52a2('0x73')]='OpenchannelAccount';break;case _0x52a2('0xbc'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xbd');break;case _0x52a2('0xbe'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xbf');break;case _0x52a2('0xc0'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xc1');break;case _0x52a2('0xc2'):_0x2bc7f9['childModel']='WhatsappAccount';break;case _0x52a2('0xc3'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xc4');break;case _0x52a2('0xc5'):case _0x52a2('0xc6'):_0x2bc7f9[_0x52a2('0x73')]='VoiceQueue';if(_0x1efb91){_0x2bc7f9[_0x52a2('0x75')]=[{'name':_0x52a2('0xac')},{'name':_0x52a2('0xc7')}];}break;case'users':case'agents':case _0x52a2('0xc8'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xa8');if(_0x1efb91){_0x2bc7f9[_0x52a2('0x75')]=[{'name':'Users','filter':{'field':'role','value':[_0x52a2('0xc9'),'user']},'ignore':!![]},{'name':_0x52a2('0xa6')},{'name':'Telephones'}];}break;case _0x52a2('0xca'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xcb');break;case'salesforceaccounts':_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xcc');break;case _0x52a2('0xcd'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xce');break;case _0x52a2('0xcf'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xd0');break;case _0x52a2('0xd1'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xd2');break;case _0x52a2('0xd3'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xd4');break;case _0x52a2('0xd5'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xa8');break;case _0x52a2('0xd6'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xd7');break;case'dispositions':_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xd8');break;case _0x52a2('0xd9'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0x67');break;case _0x52a2('0xda'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xdb');break;case _0x52a2('0xdc'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xdd');break;case _0x52a2('0xde'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xdf');break;case _0x52a2('0xe0'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xe1');break;case _0x52a2('0xe2'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xe3');break;case _0x52a2('0xe4'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xe5');break;case'triggers':_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xe6');break;case _0x52a2('0xe7'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xe8');break;case _0x52a2('0xe9'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xea');break;case _0x52a2('0xeb'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0x6a');break;case _0x52a2('0xec'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0x7f');_0x2bc7f9[_0x52a2('0x75')]=[{'name':_0x52a2('0xed'),'field':'id','foreignKey':_0x52a2('0x82')}];break;case _0x52a2('0xee'):_0x2bc7f9[_0x52a2('0x73')]=_0x52a2('0xef');break;case _0x52a2('0xc2'):_0x2bc7f9['childModel']=_0x52a2('0xf0');break;default:return _0x2bc7f9;}return _0x2bc7f9;} \ No newline at end of file +var _0x3e20=['salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','pauses','Pause','scheduler','Schedule','Sound','templates','Template','trunks','Trunk','Variable','plugins','extractedreports','Reports','metrics','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','squel','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','send','index','UserProfile','rawAttributes','fieldName','key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','get','omit','createdAt','updatedAt','body','sequelize','transaction','autoAssociation','sectionId','userProfileId','Resources','UserProfileSection','UserProfileResource','describe','addSections','each','removeSections','ids','getSections','enabled','includes','subsections','push','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','mergeResources','childModel','ValidationError','Invalid\x20section\x20\x27','isEmpty','parentSections','findOne','all','ignore','union','order','field','AnalyticExtractedReport','associatedResources','foreignKey','reportType','default','reportId','DefaultReports','CustomReports','CmContact','Tags','Tag','ThroughTags','tag','value','toLowerCase','SquareProject','odbc','SquareOdbc','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','whatsappaccounts','WhatsappAccount','voicequeues','queuecampaigns','VoiceQueues','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3e20,0x1ed));var _0x03e2=function(_0x1fab57,_0x1ff1dd){_0x1fab57=_0x1fab57-0x0;var _0x275510=_0x3e20[_0x1fab57];return _0x275510;};'use strict';var pdf=require(_0x03e2('0x0'));var emlformat=require(_0x03e2('0x1'));var rimraf=require(_0x03e2('0x2'));var zipdir=require(_0x03e2('0x3'));var jsonpatch=require(_0x03e2('0x4'));var rp=require(_0x03e2('0x5'));var moment=require('moment');var BPromise=require(_0x03e2('0x6'));var Mustache=require(_0x03e2('0x7'));var util=require('util');var path=require(_0x03e2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x03e2('0x9'));var fs=require('fs');var _=require(_0x03e2('0xa'));var squel=require(_0x03e2('0xb'));var crypto=require(_0x03e2('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x03e2('0xd'));var querystring=require(_0x03e2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x03e2('0xf'));var qs=require(_0x03e2('0x10'));var as=require(_0x03e2('0x11'));var hardwareService=require(_0x03e2('0x12'));var logger=require(_0x03e2('0x13'))('api');var utils=require(_0x03e2('0x14'));var config=require('../../config/environment');var db=require(_0x03e2('0x15'))['db'];config[_0x03e2('0x16')]=_[_0x03e2('0x17')](config[_0x03e2('0x16')],{'host':_0x03e2('0x18'),'port':0x18eb});var socket=require(_0x03e2('0x19'))(new Redis(config[_0x03e2('0x16')]));require('./userProfile.socket')[_0x03e2('0x1a')](socket);function respondWithStatusCode(_0x269616,_0x21607c){_0x21607c=_0x21607c||0xcc;return function(_0x256fb8){if(_0x256fb8){return _0x269616[_0x03e2('0x1b')](_0x21607c);}return _0x269616[_0x03e2('0x1c')](_0x21607c)[_0x03e2('0x1d')]();};}function respondWithResult(_0x29f8fa,_0x2e4457){_0x2e4457=_0x2e4457||0xc8;return function(_0x59130d){if(_0x59130d){return _0x29f8fa['status'](_0x2e4457)[_0x03e2('0x1e')](_0x59130d);}};}function respondWithFilteredResult(_0x13e0e7,_0x4132b6){return function(_0x296a84){if(_0x296a84){var _0x8f3ccc=_0x296a84[_0x03e2('0x1f')],_0x218aa2=_0x4132b6['offset'],_0x4a4a6d=_0x4132b6[_0x03e2('0x20')]+_0x4132b6[_0x03e2('0x21')],_0x40f339;if(_0x4a4a6d>=_0x8f3ccc){_0x4a4a6d=_0x8f3ccc;_0x40f339=0xc8;}else{_0x40f339=0xce;}_0x13e0e7[_0x03e2('0x1c')](_0x40f339);return _0x13e0e7[_0x03e2('0x22')]('Content-Range',_0x218aa2+'-'+_0x4a4a6d+'/'+_0x8f3ccc)['json'](_0x296a84);}return null;};}function patchUpdates(_0x648d4){return function(_0x35531b){try{jsonpatch[_0x03e2('0x23')](_0x35531b,_0x648d4,!![]);}catch(_0x2f8d31){return BPromise['reject'](_0x2f8d31);}return _0x35531b[_0x03e2('0x24')]();};}function saveUpdates(_0x346a4b,_0x1d9ffd){return function(_0x347ede){if(_0x347ede){return _0x347ede[_0x03e2('0x25')](_0x346a4b)[_0x03e2('0x26')](function(_0xd73158){return _0xd73158;});}return null;};}function removeEntity(_0x5198c1,_0x89c8ff){return function(_0x253b6a){if(_0x253b6a){return _0x253b6a[_0x03e2('0x27')]()['then'](function(){_0x5198c1[_0x03e2('0x1c')](0xcc)[_0x03e2('0x1d')]();});}};}function handleEntityNotFound(_0x314b3c,_0x3724f3){return function(_0x20a59e){if(!_0x20a59e){_0x314b3c[_0x03e2('0x1b')](0x194);}return _0x20a59e;};}function handleError(_0x6ec16a,_0xcee079){_0xcee079=_0xcee079||0x1f4;return function(_0x26d62a){logger[_0x03e2('0x28')](_0x26d62a['stack']);if(_0x26d62a['name']){delete _0x26d62a['name'];}_0x6ec16a[_0x03e2('0x1c')](_0xcee079)[_0x03e2('0x29')](_0x26d62a);};}exports[_0x03e2('0x2a')]=function(_0x3ab90a,_0x1d8d08){var _0x26eb25={},_0x4af5d2={},_0x372fe1={'count':0x0,'rows':[]};var _0x336073=_['map'](db[_0x03e2('0x2b')][_0x03e2('0x2c')],function(_0x48a02a){return{'name':_0x48a02a[_0x03e2('0x2d')],'type':_0x48a02a['type'][_0x03e2('0x2e')]};});_0x4af5d2[_0x03e2('0x2f')]=_[_0x03e2('0x30')](_0x336073,_0x03e2('0x31'));_0x4af5d2[_0x03e2('0x32')]=_['keys'](_0x3ab90a[_0x03e2('0x32')]);_0x4af5d2[_0x03e2('0x33')]=_[_0x03e2('0x34')](_0x4af5d2[_0x03e2('0x2f')],_0x4af5d2['query']);_0x26eb25[_0x03e2('0x35')]=_['intersection'](_0x4af5d2[_0x03e2('0x2f')],qs[_0x03e2('0x36')](_0x3ab90a[_0x03e2('0x32')]['fields']));_0x26eb25[_0x03e2('0x35')]=_0x26eb25[_0x03e2('0x35')][_0x03e2('0x37')]?_0x26eb25['attributes']:_0x4af5d2[_0x03e2('0x2f')];if(!_0x3ab90a[_0x03e2('0x32')][_0x03e2('0x38')]('nolimit')){_0x26eb25['limit']=qs[_0x03e2('0x21')](_0x3ab90a[_0x03e2('0x32')]['limit']);_0x26eb25[_0x03e2('0x20')]=qs[_0x03e2('0x20')](_0x3ab90a[_0x03e2('0x32')][_0x03e2('0x20')]);}_0x26eb25['order']=qs[_0x03e2('0x39')](_0x3ab90a[_0x03e2('0x32')]['sort']);_0x26eb25['where']=qs[_0x03e2('0x33')](_[_0x03e2('0x3a')](_0x3ab90a[_0x03e2('0x32')],_0x4af5d2[_0x03e2('0x33')]),_0x336073);if(_0x3ab90a[_0x03e2('0x32')][_0x03e2('0x3b')]){_0x26eb25[_0x03e2('0x3c')]=_[_0x03e2('0x3d')](_0x26eb25[_0x03e2('0x3c')],{'$or':_[_0x03e2('0x30')](_0x336073,function(_0x53d184){if(_0x53d184[_0x03e2('0x3e')]!==_0x03e2('0x3f')){var _0x3ebd3d={};_0x3ebd3d[_0x53d184[_0x03e2('0x31')]]={'$like':'%'+_0x3ab90a['query'][_0x03e2('0x3b')]+'%'};return _0x3ebd3d;}})});}_0x26eb25=_[_0x03e2('0x3d')]({},_0x26eb25,_0x3ab90a[_0x03e2('0x40')]);var _0x18b33f={'where':_0x26eb25[_0x03e2('0x3c')]};return db[_0x03e2('0x2b')]['count'](_0x18b33f)[_0x03e2('0x26')](function(_0x4aa4fa){_0x372fe1[_0x03e2('0x1f')]=_0x4aa4fa;if(_0x3ab90a[_0x03e2('0x32')][_0x03e2('0x41')]){_0x26eb25[_0x03e2('0x42')]=[{'all':!![]}];}return db[_0x03e2('0x2b')][_0x03e2('0x43')](_0x26eb25);})[_0x03e2('0x26')](function(_0x4f6047){_0x372fe1[_0x03e2('0x44')]=_0x4f6047;return _0x372fe1;})[_0x03e2('0x26')](respondWithFilteredResult(_0x1d8d08,_0x26eb25))['catch'](handleError(_0x1d8d08,null));};exports[_0x03e2('0x45')]=function(_0x5b07c5,_0x5a7746){var _0x432d60={'raw':![],'where':{'id':_0x5b07c5[_0x03e2('0x46')]['id']}},_0x302104={};_0x302104[_0x03e2('0x2f')]=_[_0x03e2('0x47')](db[_0x03e2('0x2b')]['rawAttributes']);_0x302104[_0x03e2('0x32')]=_[_0x03e2('0x47')](_0x5b07c5[_0x03e2('0x32')]);_0x302104['filters']=_[_0x03e2('0x34')](_0x302104[_0x03e2('0x2f')],_0x302104[_0x03e2('0x32')]);_0x432d60[_0x03e2('0x35')]=_[_0x03e2('0x34')](_0x302104[_0x03e2('0x2f')],qs[_0x03e2('0x36')](_0x5b07c5[_0x03e2('0x32')][_0x03e2('0x36')]));_0x432d60[_0x03e2('0x35')]=_0x432d60[_0x03e2('0x35')][_0x03e2('0x37')]?_0x432d60[_0x03e2('0x35')]:_0x302104[_0x03e2('0x2f')];if(_0x5b07c5[_0x03e2('0x32')][_0x03e2('0x41')]){_0x432d60[_0x03e2('0x42')]=[{'all':!![]}];}_0x432d60=_['merge']({},_0x432d60,_0x5b07c5['options']);return db[_0x03e2('0x2b')][_0x03e2('0x48')](_0x432d60)[_0x03e2('0x26')](handleEntityNotFound(_0x5a7746,null))['then'](respondWithResult(_0x5a7746,null))[_0x03e2('0x49')](handleError(_0x5a7746,null));};exports[_0x03e2('0x4a')]=function(_0x39438e,_0x38f420){return db[_0x03e2('0x2b')][_0x03e2('0x4a')](_0x39438e['body'],{})[_0x03e2('0x26')](respondWithResult(_0x38f420,0xc9))[_0x03e2('0x49')](handleError(_0x38f420,null));};exports['clone']=function(_0x1945b4,_0x4c1bb4){var _0x227660={'where':{'id':_0x1945b4[_0x03e2('0x46')]['id']}},_0x4d6b49={};_0x4d6b49[_0x03e2('0x2f')]=_[_0x03e2('0x47')](db[_0x03e2('0x2b')][_0x03e2('0x2c')]);_0x227660[_0x03e2('0x35')]=_[_0x03e2('0x34')](_0x4d6b49[_0x03e2('0x2f')],qs[_0x03e2('0x36')](_0x1945b4[_0x03e2('0x32')][_0x03e2('0x36')]));_0x227660[_0x03e2('0x35')]=_0x227660[_0x03e2('0x35')][_0x03e2('0x37')]?_0x227660['attributes']:_0x4d6b49[_0x03e2('0x2f')];if(_0x1945b4[_0x03e2('0x32')]['includeAll']){_0x227660[_0x03e2('0x42')]=[{'all':!![]}];}_0x227660=_[_0x03e2('0x3d')]({},_0x227660,_0x1945b4[_0x03e2('0x40')]);return db[_0x03e2('0x2b')][_0x03e2('0x48')](_0x227660)[_0x03e2('0x26')](handleEntityNotFound(_0x4c1bb4,null))[_0x03e2('0x26')](function(_0x23adfc){if(_0x23adfc){var _0x62de44=_0x23adfc[_0x03e2('0x4b')]({'plain':!![]});_0x62de44=qs[_0x03e2('0x4c')](_0x62de44,['id',_0x03e2('0x4d'),_0x03e2('0x4e'),'crudPermissions']);_0x1945b4['body']=_[_0x03e2('0x4c')](_0x1945b4[_0x03e2('0x4f')],['id',_0x03e2('0x4d'),_0x03e2('0x4e')]);return db[_0x03e2('0x50')][_0x03e2('0x51')](function(_0x39ce87){return db[_0x03e2('0x2b')]['create'](_[_0x03e2('0x3d')](_0x62de44,_0x1945b4[_0x03e2('0x4f')]),{'include':_0x1945b4[_0x03e2('0x32')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x39ce87})['then'](function(_0x2ff7bf){var _0x2dec72=_0x2ff7bf[_0x03e2('0x4b')]({'plain':!![]});return db['UserProfileSection'][_0x03e2('0x43')]({'where':{'userProfileId':_0x1945b4[_0x03e2('0x46')]['id']},'raw':!![]})[_0x03e2('0x26')](function(_0x5b6058){if(_0x5b6058){return BPromise['each'](_0x5b6058,function(_0xd01ae1){return new BPromise(function(_0x2b8845,_0x3c4df2){if(_0xd01ae1[_0x03e2('0x52')]===null||_0xd01ae1['autoAssociation']===0x1)_0x2b8845(null);return db['UserProfileResource'][_0x03e2('0x43')]({'where':{'sectionId':_0xd01ae1['id']},'raw':!![]})[_0x03e2('0x26')](function(_0x43d4bb){var _0x1d2ef1=_[_0x03e2('0x30')](_0x43d4bb,function(_0x5cac97){return qs[_0x03e2('0x4c')](_0x5cac97,['id',_0x03e2('0x4d'),_0x03e2('0x4e'),_0x03e2('0x53')]);});_0x2b8845(_0x1d2ef1);})[_0x03e2('0x49')](function(_0x2f6bb6){_0x3c4df2(_0x2f6bb6);});})[_0x03e2('0x26')](function(_0x7e03a8){var _0x1f2b50=qs[_0x03e2('0x4c')](_0xd01ae1,['id','createdAt','updatedAt']);_0x1f2b50[_0x03e2('0x54')]=_0x2dec72['id'];if(_0x7e03a8)_0x1f2b50[_0x03e2('0x55')]=_0x7e03a8;return _0x1f2b50;})[_0x03e2('0x26')](function(_0x297e2d){return db[_0x03e2('0x56')][_0x03e2('0x4a')](_0x297e2d,{'include':[{'model':db[_0x03e2('0x57')],'as':_0x03e2('0x55')}],'raw':!![],'transaction':_0x39ce87});});})['then'](function(){return _0x2dec72;});}});});});}})[_0x03e2('0x26')](respondWithResult(_0x4c1bb4,0xc9))[_0x03e2('0x49')](handleError(_0x4c1bb4,null));};exports[_0x03e2('0x25')]=function(_0x4bb10c,_0x998015){if(_0x4bb10c['body']['id']){delete _0x4bb10c[_0x03e2('0x4f')]['id'];}return db[_0x03e2('0x2b')][_0x03e2('0x48')]({'where':{'id':_0x4bb10c[_0x03e2('0x46')]['id']}})['then'](handleEntityNotFound(_0x998015,null))['then'](saveUpdates(_0x4bb10c['body'],null))[_0x03e2('0x26')](respondWithResult(_0x998015,null))[_0x03e2('0x49')](handleError(_0x998015,null));};exports[_0x03e2('0x27')]=function(_0x45d42d,_0x3ba188){return db['UserProfile'][_0x03e2('0x48')]({'where':{'id':_0x45d42d['params']['id']}})[_0x03e2('0x26')](handleEntityNotFound(_0x3ba188,null))[_0x03e2('0x26')](removeEntity(_0x3ba188,null))[_0x03e2('0x49')](handleError(_0x3ba188,null));};exports[_0x03e2('0x58')]=function(_0x3f8bf4,_0x565e44){return db[_0x03e2('0x2b')]['describe']()[_0x03e2('0x26')](respondWithResult(_0x565e44,null))[_0x03e2('0x49')](handleError(_0x565e44,null));};exports[_0x03e2('0x59')]=function(_0x12c781,_0x357613){var _0x221fbb=_0x12c781['body'];return db[_0x03e2('0x2b')][_0x03e2('0x48')]({'where':{'id':_0x12c781['params']['id']}})['then'](handleEntityNotFound(_0x357613,null))[_0x03e2('0x26')](function(_0x4f9393){if(_0x4f9393){return db[_0x03e2('0x50')][_0x03e2('0x51')](function(_0x28d918){return db[_0x03e2('0x56')]['destroy']({'where':{'userProfileId':_0x12c781[_0x03e2('0x46')]['id'],'sectionId':_[_0x03e2('0x30')](_0x221fbb,function(_0x7b6719){return _0x7b6719[_0x03e2('0x53')];})},'transaction':_0x28d918})[_0x03e2('0x26')](function(){var _0x5a9d67=_[_0x03e2('0x30')](_0x221fbb,function(_0x5a0998){_0x5a0998[_0x03e2('0x54')]=_0x12c781[_0x03e2('0x46')]['id'];return _0x5a0998;});var _0x4ae2e8=[];return BPromise[_0x03e2('0x5a')](_0x5a9d67,function(_0x167f81){return db[_0x03e2('0x56')][_0x03e2('0x4a')](_0x167f81,{'include':[{'model':db[_0x03e2('0x57')],'as':_0x03e2('0x55')}],'raw':!![],'transaction':_0x28d918})[_0x03e2('0x26')](function(_0x513043){_0x4ae2e8['push'](_0x513043['get']({'plain':!![]}));});})[_0x03e2('0x26')](function(){return _0x4ae2e8;});});});}})[_0x03e2('0x26')](function(_0x37815b){return _0x37815b;})[_0x03e2('0x26')](respondWithResult(_0x357613,null))[_0x03e2('0x49')](handleError(_0x357613,null));};exports[_0x03e2('0x5b')]=function(_0x3174e1,_0x3ee9c3){var _0x47302a;return db[_0x03e2('0x2b')][_0x03e2('0x48')]({'where':{'id':_0x3174e1[_0x03e2('0x46')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x3ee9c3,null))[_0x03e2('0x26')](function(_0x2c9c61){if(_0x2c9c61){_0x47302a=_0x2c9c61;return db['UserProfileSection'][_0x03e2('0x27')]({'where':{'userProfileId':_0x3174e1[_0x03e2('0x46')]['id'],'sectionId':_0x3174e1['query'][_0x03e2('0x5c')]}});}})[_0x03e2('0x26')](function(){return _0x47302a;})[_0x03e2('0x26')](respondWithStatusCode(_0x3ee9c3,null))[_0x03e2('0x49')](handleError(_0x3ee9c3,null));};exports[_0x03e2('0x5d')]=function(_0xa1dec2,_0x4b07dd){var _0x4f1095=[];var _0x4322b0=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0xa1dec2[_0x03e2('0x46')]['id']},'raw':!![]})[_0x03e2('0x26')](function(_0x53bc3e){_0x4f1095=_[_0x03e2('0x3b')](_0x53bc3e,function(_0x39289e){return _0x39289e[_0x03e2('0x5e')]===0x1||_['includes']([0x3eb,0x709],_0x39289e[_0x03e2('0x53')]);});if(!_['isEmpty'](_0x4f1095)){return _[_0x03e2('0x30')](_0x4f1095,function(_0x23960f){return _0x23960f[_0x03e2('0x53')];});}else{return;}})[_0x03e2('0x26')](function(_0x5c0484){if(_0x5c0484)_0x4322b0=_0x5c0484;if(_[_0x03e2('0x5f')](_0x4322b0,0x64)){var _0x5733c1=_[_0x03e2('0x48')](_0x4f1095,{'sectionId':0x64});return hasDefaultDashboard(_0x5733c1)[_0x03e2('0x26')](function(_0x4020b7){return _['map'](_0x4f1095,function(_0x4bf0b1){if(_0x4bf0b1[_0x03e2('0x53')]===0x64){_0x4bf0b1[_0x03e2('0x60')]=_0x4020b7;}return _0x4bf0b1;});});}else{return;}})[_0x03e2('0x26')](function(_0x590e14){if(_0x590e14)_0x4f1095=_0x590e14;if(_[_0x03e2('0x5f')](_0x4322b0,0x3eb)){var _0x5f0b47=_['find'](_0x4f1095,{'sectionId':0x3eb});return getCustomDashboards(_0x5f0b47)[_0x03e2('0x26')](function(_0x102808){return _[_0x03e2('0x30')](_0x4f1095,function(_0x100db9){if(_0x5f0b47[_0x03e2('0x5e')]){if(_0x100db9['sectionId']===0x3eb){_0x100db9[_0x03e2('0x60')]=_0x102808;}}else{if(_0x100db9[_0x03e2('0x53')]===0x64){_0x100db9['subsections']=_0x102808;}}return _0x100db9;});});}else{return;}})[_0x03e2('0x26')](function(_0x507822){if(_0x507822)_0x4f1095=_0x507822;if(_['includes'](_0x4322b0,0x709)){var _0x12d0f8=_[_0x03e2('0x48')](_0x4f1095,{'sectionId':0x709});return getPlugins(_0x12d0f8)[_0x03e2('0x26')](function(_0x11e26a){if(_0x12d0f8[_0x03e2('0x5e')]){return _[_0x03e2('0x30')](_0x4f1095,function(_0x3fa108){if(_0x3fa108['sectionId']===0x709){_0x3fa108[_0x03e2('0x60')]=_0x11e26a;}return _0x3fa108;});}else{var _0x3dd5fd={'sectionId':0x76c,'enabled':0x1,'subsections':_0x11e26a};var _0x16419a=_['map'](_0x4f1095);_0x16419a[_0x03e2('0x61')](_0x3dd5fd);return _0x16419a;}});}else{return;}})[_0x03e2('0x26')](function(_0x3a9c2c){if(_0x3a9c2c)_0x4f1095=_0x3a9c2c;return _[_0x03e2('0x3b')](_0x4f1095,[_0x03e2('0x5e'),0x1]);})['then'](respondWithResult(_0x4b07dd,null))[_0x03e2('0x49')](handleError(_0x4b07dd,null));};function hasDefaultDashboard(_0x36919a){var _0x2fa75d=[0x65];return new BPromise(function(_0x50cdc7,_0x2393fb){try{if(_0x36919a[_0x03e2('0x52')]){_0x50cdc7(_0x2fa75d);}else{return db[_0x03e2('0x57')]['findOne']({'where':{'sectionId':_0x36919a['id']},'raw':!![]})[_0x03e2('0x26')](function(_0xd9e7c0){_0xd9e7c0?_0x50cdc7(_0x2fa75d):_0x50cdc7();});}}catch(_0x54a272){_0x2393fb(_0x54a272);}});}function getCustomDashboards(_0x98c2b1){var _0xc19745=[];return new BPromise(function(_0x476a7a,_0x5a62a3){try{if(_0x98c2b1[_0x03e2('0x52')]){return db[_0x03e2('0x62')]['findAll']({'raw':!![]})[_0x03e2('0x26')](function(_0x4db7f3){_0x4db7f3[_0x03e2('0x63')](function(_0x5f8ae6){_0xc19745[_0x03e2('0x61')](_0x5f8ae6['id']+0x1869f);});_0x476a7a(_0xc19745);});}else{return db[_0x03e2('0x57')][_0x03e2('0x43')]({'where':{'sectionId':_0x98c2b1['id']},'raw':!![]})[_0x03e2('0x26')](function(_0x2ecd68){_0x2ecd68[_0x03e2('0x63')](function(_0x38fd37){_0xc19745[_0x03e2('0x61')](_0x38fd37[_0x03e2('0x64')]+0x1869f);});_0x476a7a(_0xc19745);});}}catch(_0x2b8531){_0x5a62a3(_0x2b8531);}});}function getPlugins(_0x3ad7c1){var _0x4bddf1=[];return new BPromise(function(_0xe97837,_0x20dc19){try{if(_0x3ad7c1[_0x03e2('0x52')]){return db[_0x03e2('0x65')][_0x03e2('0x43')]({'raw':!![]})[_0x03e2('0x26')](function(_0x7b0d1e){_0x7b0d1e['forEach'](function(_0x21b1de){_0x4bddf1[_0x03e2('0x61')](_0x21b1de['id']+0x15b38);});_0xe97837(_0x4bddf1);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x3ad7c1['id']},'raw':!![]})[_0x03e2('0x26')](function(_0x3246d7){_0x3246d7[_0x03e2('0x63')](function(_0x5d6bcc){_0x4bddf1[_0x03e2('0x61')](_0x5d6bcc[_0x03e2('0x64')]+0x15b38);});_0xe97837(_0x4bddf1);});}}catch(_0x4e9d91){_0x20dc19(_0x4e9d91);}});}exports[_0x03e2('0x66')]=function(_0x9b9da1,_0xe07a9f){return db[_0x03e2('0x2b')]['find']({'where':{'id':_0x9b9da1[_0x03e2('0x46')]['id']}})['then'](handleEntityNotFound(_0xe07a9f,null))[_0x03e2('0x26')](function(_0x235423){if(_0x235423){return db[_0x03e2('0x50')][_0x03e2('0x51')](function(_0x4e6550){return db[_0x03e2('0x56')][_0x03e2('0x43')]({'where':{'userProfileId':_0x9b9da1[_0x03e2('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0x03e2('0x26')](function(_0x3a451b){if(_0x3a451b){return db[_0x03e2('0x56')][_0x03e2('0x27')]({'where':{'userProfileId':_0x9b9da1[_0x03e2('0x46')]['id'],'id':_[_0x03e2('0x30')](_0x3a451b,function(_0x1ed6b7){return _0x1ed6b7['id'];})},'transaction':_0x4e6550});}})['then'](function(_0x326bcf){var _0x54cb93=_[_0x03e2('0x30')](_0x9b9da1[_0x03e2('0x4f')],function(_0x4f4c70){_0x4f4c70[_0x03e2('0x54')]=_0x9b9da1['params']['id'];return _0x4f4c70;});return db[_0x03e2('0x56')][_0x03e2('0x67')](_0x54cb93,{'raw':!![],'transaction':_0x4e6550});})[_0x03e2('0x26')](function(_0x4a0301){var _0x141d7b=_[_0x03e2('0x3b')](_[_0x03e2('0x30')](_0x4a0301,function(_0x4b2f16){return _0x4b2f16[_0x03e2('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x141d7b){return db[_0x03e2('0x56')][_0x03e2('0x43')]({'where':{'userProfileId':_0x9b9da1['params']['id'],'sectionId':_[_0x03e2('0x30')](_0x141d7b,function(_0x47cf86){return _0x47cf86[_0x03e2('0x53')];})},'attributes':['id',_0x03e2('0x53')],'raw':!![]})[_0x03e2('0x26')](function(_0x390335){var _0x20aab3=_['map'](_0x9b9da1['body'],function(_0x383043){_0x383043['userProfileId']=_0x9b9da1[_0x03e2('0x46')]['id'];return _0x383043;});return db[_0x03e2('0x57')][_0x03e2('0x67')](_0x20aab3,{'raw':!![],'transaction':_0x4e6550});});}})[_0x03e2('0x49')](handleError(_0xe07a9f,null));});}})['then'](function(_0x51ac82){var _0x318a73=_[_0x03e2('0x30')](_0x51ac82,function(_0x4a71f7){return _0x4a71f7[_0x03e2('0x4b')]({'plain':!![]});});})[_0x03e2('0x26')](respondWithResult(_0xe07a9f,null))['catch'](handleError(_0xe07a9f,null));};exports[_0x03e2('0x68')]=function(_0x4c12ba,_0x40b6c3,_0x58b8b0){return db[_0x03e2('0x2b')][_0x03e2('0x48')]({'where':{'id':_0x4c12ba[_0x03e2('0x46')]['id']}})['then'](handleEntityNotFound(_0x40b6c3,null))[_0x03e2('0x26')](function(_0x534244){if(_0x534244){return _0x534244['removeResources'](_0x4c12ba[_0x03e2('0x32')][_0x03e2('0x5c')]);}})[_0x03e2('0x26')](respondWithStatusCode(_0x40b6c3,null))[_0x03e2('0x49')](handleError(_0x40b6c3,null));};exports[_0x03e2('0x69')]=function(_0x53d105,_0x5e4031){var _0x103cfb={'raw':![],'where':{}};var _0x4c9496={};var _0x2c4e5b={'count':0x0,'rows':[]};var _0x330174=_0x53d105[_0x03e2('0x32')][_0x03e2('0x6a')];if(typeof _0x330174===_0x03e2('0x6b')){throw new db[(_0x03e2('0x6c'))]['ValidationError']('Unknown\x20section');}var _0x3f496b=_0x53d105[_0x03e2('0x32')][_0x03e2('0x6d')]||![];var _0x5e0ed8=getQueryModels(_0x330174,_0x3f496b);if(typeof _0x5e0ed8[_0x03e2('0x6e')]===_0x03e2('0x6b')){throw new db[(_0x03e2('0x6c'))][(_0x03e2('0x6f'))](_0x03e2('0x70')+_0x330174+'\x27');}var _0x1eaaca=[];if(!_[_0x03e2('0x71')](_0x5e0ed8[_0x03e2('0x72')])){_0x1eaaca=_0x5e0ed8[_0x03e2('0x72')];}else{_0x1eaaca=[{'name':_0x330174}];}return db[_0x03e2('0x2b')][_0x03e2('0x73')]({'where':{'id':_0x53d105[_0x03e2('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e4031,null))['then'](function(_0x1fcb27){if(_0x1fcb27){var _0x30c47f=[];for(var _0x36b488=0x0;_0x36b488<_0x1eaaca[_0x03e2('0x37')];_0x36b488++){_0x30c47f['push'](db[_0x03e2('0x56')][_0x03e2('0x73')]({'where':{'userProfileId':_0x1fcb27['id'],'name':_0x1eaaca[_0x36b488][_0x03e2('0x31')]},'raw':!![]}));}return BPromise[_0x03e2('0x74')](_0x30c47f);}})[_0x03e2('0x26')](function(_0x356212){var _0x5243a4=_[_0x03e2('0x3b')](_0x356212,function(_0x70074c){return _0x70074c?_0x70074c:undefined;});var _0x511761=_[_0x03e2('0x3b')](_0x1eaaca,[_0x03e2('0x75'),!![]]);var _0xf1915d=_['isEmpty'](_0x5243a4)&&_[_0x03e2('0x71')](_0x511761)?null:_[_0x03e2('0x76')](_0x511761,_0x5243a4);if(_0xf1915d){var _0x26b62b=[];for(var _0x950455=0x0;_0x950455<_0xf1915d[_0x03e2('0x37')];_0x950455++){var _0x233066=_[_0x03e2('0x48')](_0x1eaaca,function(_0x28e488){return _0xf1915d[_0x950455]?_0x28e488[_0x03e2('0x31')]===_0xf1915d[_0x950455]['name']:null;});if(_0x233066){if(_0xf1915d[_0x950455][_0x03e2('0x75')]){_0x26b62b[_0x03e2('0x61')](getAllResources(_0x5e0ed8['childModel'],_0xf1915d[_0x950455]));}else{if(!_0xf1915d[_0x950455][_0x03e2('0x52')]){_0x26b62b[_0x03e2('0x61')](getAllowedResources(_0x233066,_0xf1915d[_0x950455],_0x5e0ed8[_0x03e2('0x6e')]));}else{if(_0x233066[_0x03e2('0x2f')]){_0x26b62b['push'](getAllFilteredResources(_0x233066,_0xf1915d[_0x950455]));}}}}}return BPromise['all'](_0x26b62b);}else{return null;}})[_0x03e2('0x26')](function(_0x159e54){var _0x21ca62=_0x159e54;var _0x21e807=null;if(_0x21ca62){_0x21e807=_0x21ca62[_0x03e2('0x37')]===0x1?_0x21ca62[0x0]:null;}if(_0x21e807||_0x21ca62){var _0x16d2b0=db[_0x5e0ed8[_0x03e2('0x6e')]][_0x03e2('0x2c')];_0x4c9496[_0x03e2('0x2f')]=_[_0x03e2('0x47')](_0x16d2b0);_0x4c9496['query']=_[_0x03e2('0x47')](_0x53d105[_0x03e2('0x32')]);_0x4c9496[_0x03e2('0x33')]=_[_0x03e2('0x34')](_0x4c9496[_0x03e2('0x2f')],_0x4c9496[_0x03e2('0x32')]);_0x103cfb[_0x03e2('0x35')]=_[_0x03e2('0x34')](_0x4c9496[_0x03e2('0x2f')],qs[_0x03e2('0x36')](_0x53d105[_0x03e2('0x32')][_0x03e2('0x36')]));_0x103cfb['attributes']=_0x103cfb['attributes'][_0x03e2('0x37')]?_0x103cfb[_0x03e2('0x35')]:_0x4c9496['model'];if(!_0x53d105[_0x03e2('0x32')][_0x03e2('0x38')]('nolimit')){_0x103cfb[_0x03e2('0x21')]=qs[_0x03e2('0x21')](_0x53d105['query'][_0x03e2('0x21')]);_0x103cfb[_0x03e2('0x20')]=qs[_0x03e2('0x20')](_0x53d105[_0x03e2('0x32')][_0x03e2('0x20')]);}_0x103cfb[_0x03e2('0x77')]=qs['sort'](_0x53d105[_0x03e2('0x32')]['sort']);_0x103cfb[_0x03e2('0x3c')]=qs['filters'](_['pick'](_0x53d105['query'],_0x4c9496[_0x03e2('0x33')]));if(_0x53d105[_0x03e2('0x32')][_0x03e2('0x3b')]){_0x103cfb[_0x03e2('0x3c')]=_[_0x03e2('0x3d')](_0x103cfb[_0x03e2('0x3c')],{'$or':_[_0x03e2('0x30')](_0x16d2b0,function(_0x156b1a){if(_0x156b1a['type'][_0x03e2('0x2e')]!==_0x03e2('0x3f')){var _0xea0530={};_0xea0530[_0x156b1a[_0x03e2('0x78')]]={'$like':'%'+_0x53d105['query'][_0x03e2('0x3b')]+'%'};return _0xea0530;}})});}var _0x341248=[];if(_0x21e807){var _0x3d7c32=_[_0x03e2('0x48')](_0x1eaaca,[_0x03e2('0x31'),_0x21e807[_0x03e2('0x31')]]);if(_0x3d7c32[_0x03e2('0x78')]){var _0x115a12={};if(_0x5e0ed8[_0x03e2('0x6e')]===_0x03e2('0x79')){_0x115a12[_0x3d7c32['foreignKey']]=_[_0x03e2('0x30')](_0x21e807[_0x03e2('0x7a')],'id');}else{_0x115a12[_0x3d7c32[_0x03e2('0x7b')]]=_0x21e807[_0x03e2('0x7a')];}_0x341248[_0x03e2('0x61')](_0x115a12);}else{_0x103cfb[_0x03e2('0x3c')]['id']=_0x21e807[_0x03e2('0x7a')];}}else{for(var _0x1ea61d=0x0;_0x1ea61d<_0x21ca62['length'];_0x1ea61d++){var _0x3d7c32=_[_0x03e2('0x48')](_0x1eaaca,['name',_0x21ca62[_0x1ea61d][_0x03e2('0x31')]]);if(_0x3d7c32['field']){var _0x115a12={};_0x115a12[_0x3d7c32[_0x03e2('0x7b')]]=_0x21ca62[_0x1ea61d][_0x03e2('0x7a')];_0x341248[_0x03e2('0x61')](_0x115a12);}else{if(!_0x103cfb['where']['id'])_0x103cfb[_0x03e2('0x3c')]['id']=[];_0x21ca62[_0x1ea61d][_0x03e2('0x7a')][_0x03e2('0x63')](function(_0x2474ab){_0x103cfb['where']['id'][_0x03e2('0x61')](_0x2474ab);});}}}if(!_['isEmpty'](_0x341248)){_0x103cfb['where']=_[_0x03e2('0x3d')](_0x103cfb[_0x03e2('0x3c')],{'$and':{'$or':_0x341248}});}_0x103cfb=_[_0x03e2('0x3d')]({},_0x103cfb,_0x53d105[_0x03e2('0x40')]);if(_0x21e807&&!_0x21e807['autoAssociation']&&_0x5e0ed8[_0x03e2('0x6e')]===_0x03e2('0x79')){if(_0x53d105[_0x03e2('0x32')][_0x03e2('0x41')]){_0x103cfb[_0x03e2('0x42')]=[{'all':!![]}];}return db[_0x5e0ed8['childModel']]['findAll'](_0x103cfb)[_0x03e2('0x26')](function(_0x9edc90){var _0x31a76f=[];_0x9edc90['forEach'](function(_0x36a154){var _0x5d2074;switch(_0x36a154[_0x03e2('0x7c')]){case _0x03e2('0x7d'):_0x5d2074=_[_0x03e2('0x48')](_0x21e807[_0x03e2('0x7a')],function(_0x298cb9){return _0x298cb9['id']===_0x36a154[_0x03e2('0x7e')]&&_0x298cb9[_0x03e2('0x3e')]===_0x03e2('0x7f');});break;case'custom':_0x5d2074=_[_0x03e2('0x48')](_0x21e807['associatedResources'],function(_0x540556){return _0x540556['id']===_0x36a154[_0x03e2('0x7e')]&&_0x540556[_0x03e2('0x3e')]===_0x03e2('0x80');});break;}if(_0x5d2074)_0x31a76f[_0x03e2('0x61')](_0x36a154);});_0x2c4e5b[_0x03e2('0x1f')]=_0x31a76f[_0x03e2('0x37')];_0x2c4e5b[_0x03e2('0x44')]=_0x31a76f;return _0x2c4e5b;});}else{return db[_0x5e0ed8[_0x03e2('0x6e')]][_0x03e2('0x1f')]({'where':_0x103cfb[_0x03e2('0x3c')]})[_0x03e2('0x26')](function(_0x393d73){_0x2c4e5b[_0x03e2('0x1f')]=_0x393d73;if(_0x53d105[_0x03e2('0x32')][_0x03e2('0x41')]){if(_0x5e0ed8['childModel']===_0x03e2('0x81')){_0x103cfb[_0x03e2('0x42')]=[{'model':db['Tag'],'as':_0x03e2('0x82'),'attributes':['id','name','color'],'required':_0x53d105[_0x03e2('0x32')]['tag']?!![]:![]},{'model':db[_0x03e2('0x83')],'as':_0x03e2('0x84'),'attributes':['id',_0x03e2('0x31'),'color'],'through':_0x53d105[_0x03e2('0x32')]['tag']?{'attributes':[],'where':{'TagId':_0x53d105['query'][_0x03e2('0x85')]||undefined}}:{},'required':_0x53d105[_0x03e2('0x32')]['tag']?!![]:![]}];}else{_0x103cfb[_0x03e2('0x42')]=[{'all':!![]}];}}return db[_0x5e0ed8[_0x03e2('0x6e')]][_0x03e2('0x43')](_0x103cfb);})[_0x03e2('0x26')](function(_0x1c9dbb){_0x2c4e5b[_0x03e2('0x44')]=_0x1c9dbb;return _0x2c4e5b;});}}else{return _0x2c4e5b;}})[_0x03e2('0x26')](respondWithFilteredResult(_0x5e4031,_0x103cfb))[_0x03e2('0x49')](handleError(_0x5e4031,null));};function getAllResources(_0x44d692,_0x21b234){return new BPromise(function(_0x1c8c44,_0x3b623e){if(_0x21b234){var _0xc0e67d=_0x21b234['filter']?{[_0x21b234[_0x03e2('0x3b')]['field']]:_0x21b234[_0x03e2('0x3b')]['value']}:undefined;return db[_0x44d692]['findAll']({'where':_0xc0e67d,'raw':!![]})[_0x03e2('0x26')](function(_0x3b274f){_0x21b234[_0x03e2('0x7a')]=_[_0x03e2('0x30')](_0x3b274f,'id');_0x1c8c44(_0x21b234);})[_0x03e2('0x49')](function(_0x44ca39){_0x3b623e(_0x44ca39);});}else{_0x1c8c44(null);}});}function getAllFilteredResources(_0x538bf3,_0x220f21){return new BPromise(function(_0x5be8ec,_0x4ab5bd){var _0x27ef23=_0x538bf3[_0x03e2('0x3b')]?{[_0x538bf3[_0x03e2('0x3b')]['field']]:_0x538bf3[_0x03e2('0x3b')][_0x03e2('0x86')]}:undefined;return db[_0x538bf3[_0x03e2('0x2f')]][_0x03e2('0x43')]({'where':_0x27ef23,'raw':!![]})[_0x03e2('0x26')](function(_0x5675ef){_0x220f21[_0x03e2('0x7a')]=_[_0x03e2('0x30')](_0x5675ef,function(_0x2ce358){return _0x2ce358[_0x03e2('0x31')];});_0x5be8ec(_0x220f21);})[_0x03e2('0x49')](function(_0x6ff741){_0x4ab5bd(_0x6ff741);});});}function getAllowedResources(_0x4fe3a9,_0x348475,_0x5979f5){return new BPromise(function(_0x44570c,_0x25fec6){if(_0x348475){return db[_0x03e2('0x57')]['findAll']({'where':{'sectionId':_0x348475['id']},'raw':!![]})[_0x03e2('0x26')](function(_0x550f6e){if(_0x4fe3a9[_0x03e2('0x78')]&&_0x4fe3a9[_0x03e2('0x78')]!=='id'){_0x348475['associatedResources']=_[_0x03e2('0x30')](_0x550f6e,function(_0x595746){return _0x595746[_0x4fe3a9[_0x03e2('0x78')]];});}else{if(_0x5979f5==='AnalyticExtractedReport'){_0x348475[_0x03e2('0x7a')]=_[_0x03e2('0x30')](_0x550f6e,function(_0x2233db){return{'id':_0x2233db[_0x03e2('0x64')],'type':_0x2233db[_0x03e2('0x3e')]};});}else{_0x348475['associatedResources']=_['map'](_0x550f6e,function(_0x3b700b){return _0x3b700b['resourceId'];});}}_0x44570c(_0x348475);})[_0x03e2('0x49')](function(_0x1fc509){_0x25fec6(_0x1fc509);});}else{_0x44570c(null);}});}function getQueryModels(_0x402fa7,_0x19e390){var _0x38f367=_0x402fa7[_0x03e2('0x87')]();var _0x36dca3={'childModel':undefined,'parentSections':[]};switch(_0x38f367){case'squareprojects':_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0x88');break;case _0x03e2('0x89'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0x8a');break;case'squarerecordings':_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0x8b');_0x36dca3['parentSections']=[{'name':_0x03e2('0x8c'),'field':_0x03e2('0x31'),'foreignKey':_0x03e2('0x8d')}];break;case _0x03e2('0x8e'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0x8f');break;case _0x03e2('0x90'):_0x36dca3[_0x03e2('0x6e')]='CmContact';_0x36dca3[_0x03e2('0x72')]=[{'name':_0x03e2('0x91'),'field':'id','foreignKey':_0x03e2('0x92')}];break;case'lists':_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0x93');break;case _0x03e2('0x94'):_0x36dca3['childModel']=_0x03e2('0x95');break;case'globalcustomfields':_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0x96');break;case _0x03e2('0x97'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0x98');break;case'chatwebsites':_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0x99');break;case _0x03e2('0x9a'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0x9b');break;case _0x03e2('0x9c'):_0x36dca3[_0x03e2('0x6e')]='FaxAccount';break;case _0x03e2('0x9d'):case _0x03e2('0x9e'):case _0x03e2('0x9f'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xa0');break;case _0x03e2('0xa1'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xa2');break;case _0x03e2('0xa3'):_0x36dca3['childModel']=_0x03e2('0xa4');break;case _0x03e2('0xa5'):_0x36dca3['childModel']=_0x03e2('0xa6');_0x36dca3[_0x03e2('0x72')]=[{'name':_0x03e2('0xa7'),'field':_0x03e2('0x31'),'foreignKey':_0x03e2('0xa8'),'model':_0x03e2('0xa9'),'filter':{'field':'role','value':[_0x03e2('0xaa')]}},{'name':_0x03e2('0xab'),'field':_0x03e2('0x31'),'foreignKey':_0x03e2('0xa8'),'model':'User','filter':{'field':_0x03e2('0xac'),'value':['telephone']}},{'name':'VoiceQueues','field':'name','foreignKey':_0x03e2('0xad'),'model':_0x03e2('0xae'),'filter':{'field':_0x03e2('0x3e'),'value':[_0x03e2('0xaf')]}},{'name':_0x03e2('0xb0'),'field':'name','foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x03e2('0x3e'),'value':[_0x03e2('0xb1')]}}];break;case _0x03e2('0xb2'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xb3');break;case _0x03e2('0xb4'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xb5');break;case _0x03e2('0xb6'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xb7');break;case _0x03e2('0xb8'):_0x36dca3['childModel']=_0x03e2('0xb9');break;case _0x03e2('0xba'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xbb');break;case _0x03e2('0xbc'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xbd');break;case'mailsubstatuses':_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xbe');break;case'openchannelqueues':_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xbf');break;case _0x03e2('0xc0'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xc1');break;case'smsqueues':_0x36dca3['childModel']=_0x03e2('0xc2');break;case _0x03e2('0xc3'):_0x36dca3[_0x03e2('0x6e')]='SmsAccount';break;case'whatsappqueues':_0x36dca3[_0x03e2('0x6e')]='WhatsappQueue';break;case _0x03e2('0xc4'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xc5');break;case'teams':_0x36dca3[_0x03e2('0x6e')]='Team';break;case _0x03e2('0xc6'):case _0x03e2('0xc7'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xae');if(_0x19e390){_0x36dca3['parentSections']=[{'name':_0x03e2('0xc8')},{'name':_0x03e2('0xb0')}];}break;case _0x03e2('0xc9'):case _0x03e2('0xca'):case _0x03e2('0xcb'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xa9');if(_0x19e390){_0x36dca3[_0x03e2('0x72')]=[{'name':_0x03e2('0xcc'),'filter':{'field':'role','value':[_0x03e2('0xcd'),_0x03e2('0xce')]},'ignore':!![]},{'name':_0x03e2('0xa7')},{'name':'Telephones'}];}break;case _0x03e2('0xcf'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xd0');break;case _0x03e2('0xd1'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xd2');break;case _0x03e2('0xd3'):_0x36dca3['childModel']='FreshdeskAccount';break;case _0x03e2('0xd4'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xd5');break;case'deskaccounts':_0x36dca3[_0x03e2('0x6e')]='DeskAccount';break;case'zohoaccounts':_0x36dca3['childModel']=_0x03e2('0xd6');break;case _0x03e2('0xd7'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xa9');break;case _0x03e2('0xd8'):_0x36dca3['childModel']=_0x03e2('0xd9');break;case'dispositions':_0x36dca3['childModel']=_0x03e2('0xda');break;case _0x03e2('0xdb'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0x62');break;case'intervals':_0x36dca3[_0x03e2('0x6e')]='Interval';break;case _0x03e2('0xdc'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xdd');break;case _0x03e2('0xde'):_0x36dca3['childModel']=_0x03e2('0xdf');break;case'sounds':_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xe0');break;case'tags':_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0x83');break;case _0x03e2('0xe1'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xe2');break;case'triggers':_0x36dca3[_0x03e2('0x6e')]='Trigger';break;case _0x03e2('0xe3'):_0x36dca3['childModel']=_0x03e2('0xe4');break;case'variables':_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0xe5');break;case _0x03e2('0xe6'):_0x36dca3[_0x03e2('0x6e')]=_0x03e2('0x65');break;case _0x03e2('0xe7'):_0x36dca3[_0x03e2('0x6e')]='AnalyticExtractedReport';_0x36dca3[_0x03e2('0x72')]=[{'name':_0x03e2('0xe8'),'field':'id','foreignKey':'reportId'}];break;case _0x03e2('0xe9'):_0x36dca3['childModel']='AnalyticMetric';break;case _0x03e2('0xc4'):_0x36dca3[_0x03e2('0x6e')]='WhatsappAccount';break;default:return _0x36dca3;}return _0x36dca3;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index c77a872..38a6e1b 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 _0x7229=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xf4be5c,_0x165247){var _0x2b9b15=function(_0x5dd527){while(--_0x5dd527){_0xf4be5c['push'](_0xf4be5c['shift']());}};_0x2b9b15(++_0x165247);}(_0x7229,0xe5));var _0x9722=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x7229[_0x20c9b2];return _0x2c6030;};'use strict';var EventEmitter=require(_0x9722('0x0'));var UserProfile=require(_0x9722('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x9722('0x2')](0x0);var events={'afterCreate':_0x9722('0x3'),'afterUpdate':_0x9722('0x4'),'afterDestroy':_0x9722('0x5')};function emitEvent(_0x27af88){return function(_0xcd9688,_0x77ca06,_0x33b748){UserProfileEvents[_0x9722('0x6')](_0x27af88+':'+_0xcd9688['id'],_0xcd9688);UserProfileEvents['emit'](_0x27af88,_0xcd9688);_0x33b748(null);};}for(var e in events){if(events[_0x9722('0x7')](e)){var event=events[e];UserProfile[_0x9722('0x8')](e,emitEvent(event));}}module[_0x9722('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x4ece=['update','remove','emit','hook','exports','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x3dc68d,_0x1c1951){var _0xdf7f94=function(_0x339428){while(--_0x339428){_0x3dc68d['push'](_0x3dc68d['shift']());}};_0xdf7f94(++_0x1c1951);}(_0x4ece,0x8c));var _0xe4ec=function(_0x599b37,_0x345842){_0x599b37=_0x599b37-0x0;var _0x9e1a48=_0x4ece[_0x599b37];return _0x9e1a48;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xe4ec('0x0'))['db'][_0xe4ec('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xe4ec('0x2')](0x0);var events={'afterCreate':_0xe4ec('0x3'),'afterUpdate':_0xe4ec('0x4'),'afterDestroy':_0xe4ec('0x5')};function emitEvent(_0x5de402){return function(_0x964b68,_0x1b0541,_0x133a01){UserProfileEvents[_0xe4ec('0x6')](_0x5de402+':'+_0x964b68['id'],_0x964b68);UserProfileEvents[_0xe4ec('0x6')](_0x5de402,_0x964b68);_0x133a01(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xe4ec('0x7')](e,emitEvent(event));}}module[_0xe4ec('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 20378d5..9f596ba 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 _0x2a45=['define','UserProfile','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0x2a45,0x1ba));var _0x52a4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x2a45[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x52a4('0x0'));var util=require(_0x52a4('0x1'));var logger=require('../../config/logger')(_0x52a4('0x2'));var moment=require('moment');var BPromise=require(_0x52a4('0x3'));var rp=require(_0x52a4('0x4'));var fs=require('fs');var path=require(_0x52a4('0x5'));var rimraf=require(_0x52a4('0x6'));var config=require(_0x52a4('0x7'));var attributes=require('./userProfile.attributes');module[_0x52a4('0x8')]=function(_0x31646d,_0x52344d){return _0x31646d[_0x52a4('0x9')](_0x52a4('0xa'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9ef=['moment','bluebird','../../config/environment','./userProfile.attributes','exports','UserProfile','user_profiles','lodash','../../config/logger','api'];(function(_0x5681e5,_0x4a17a4){var _0x5c343a=function(_0x5c0813){while(--_0x5c0813){_0x5681e5['push'](_0x5681e5['shift']());}};_0x5c343a(++_0x4a17a4);}(_0xf9ef,0x1bf));var _0xff9e=function(_0x457a74,_0x275d56){_0x457a74=_0x457a74-0x0;var _0x2d5d8d=_0xf9ef[_0x457a74];return _0x2d5d8d;};'use strict';var _=require(_0xff9e('0x0'));var util=require('util');var logger=require(_0xff9e('0x1'))(_0xff9e('0x2'));var moment=require(_0xff9e('0x3'));var BPromise=require(_0xff9e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xff9e('0x5'));var attributes=require(_0xff9e('0x6'));module[_0xff9e('0x7')]=function(_0x445cf9,_0x313daa){return _0x445cf9['define'](_0xff9e('0x8'),attributes,{'tableName':_0xff9e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 9a0363d..9216d61 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 _0xeec6=['localhost','socket.io-emitter','./userProfile.socket','register','request','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis'];(function(_0x29d3b9,_0x1f481e){var _0x318457=function(_0x2a6e9d){while(--_0x2a6e9d){_0x29d3b9['push'](_0x29d3b9['shift']());}};_0x318457(++_0x1f481e);}(_0xeec6,0x1c2));var _0x6eec=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0xeec6[_0x564821];return _0x2b604d;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});config['redis']=_[_0x6eec('0xc')](config[_0x6eec('0xd')],{'host':_0x6eec('0xe'),'port':0x18eb});var socket=require(_0x6eec('0xf'))(new Redis(config['redis']));require(_0x6eec('0x10'))[_0x6eec('0x11')](socket);function respondWithRpcPromise(_0x1c774d,_0x49ad4c,_0x595dd4){return new BPromise(function(_0x5e8aba,_0x295cae){return client[_0x6eec('0x12')](_0x1c774d,_0x595dd4)['then'](function(_0x4b8de1){logger[_0x6eec('0x13')]('UserProfile,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));logger[_0x6eec('0x15')](_0x6eec('0x16'),_0x49ad4c,_0x6eec('0x14'),JSON[_0x6eec('0x17')](_0x4b8de1));if(_0x4b8de1['error']){if(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x19')]===0x1f4){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);return _0x295cae(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);}logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1['error'][_0x6eec('0x1b')]);return _0x5e8aba(_0x4b8de1['error'][_0x6eec('0x1b')]);}else{logger[_0x6eec('0x13')]('UserProfile,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));_0x5e8aba(_0x4b8de1[_0x6eec('0x1c')][_0x6eec('0x1b')]);}})['catch'](function(_0x87f3be){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x87f3be);_0x295cae(_0x87f3be);});});} \ No newline at end of file +var _0xeff8=['./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0xb5eca1,_0x10f985){var _0x1f0a3d=function(_0x22cb81){while(--_0x22cb81){_0xb5eca1['push'](_0xb5eca1['shift']());}};_0x1f0a3d(++_0x10f985);}(_0xeff8,0x186));var _0x8eff=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xeff8[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var moment=require('moment');var BPromise=require(_0x8eff('0x2'));var rs=require(_0x8eff('0x3'));var fs=require('fs');var Redis=require(_0x8eff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8eff('0x5'));var logger=require(_0x8eff('0x6'))(_0x8eff('0x7'));var config=require(_0x8eff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8eff('0x9')][_0x8eff('0xa')]({'port':0x232a});config[_0x8eff('0xb')]=_[_0x8eff('0xc')](config['redis'],{'host':_0x8eff('0xd'),'port':0x18eb});var socket=require(_0x8eff('0xe'))(new Redis(config[_0x8eff('0xb')]));require(_0x8eff('0xf'))['register'](socket);function respondWithRpcPromise(_0x56f120,_0x359d62,_0x430b45){return new BPromise(function(_0xb2117e,_0x52d250){return client[_0x8eff('0x10')](_0x56f120,_0x430b45)[_0x8eff('0x11')](function(_0x5172a5){logger[_0x8eff('0x12')](_0x8eff('0x13'),_0x359d62,'request\x20sent');logger['debug'](_0x8eff('0x14'),_0x359d62,_0x8eff('0x15'),JSON[_0x8eff('0x16')](_0x5172a5));if(_0x5172a5[_0x8eff('0x17')]){if(_0x5172a5[_0x8eff('0x17')]['code']===0x1f4){logger[_0x8eff('0x17')](_0x8eff('0x13'),_0x359d62,_0x5172a5[_0x8eff('0x17')][_0x8eff('0x18')]);return _0x52d250(_0x5172a5[_0x8eff('0x17')][_0x8eff('0x18')]);}logger[_0x8eff('0x17')](_0x8eff('0x13'),_0x359d62,_0x5172a5[_0x8eff('0x17')][_0x8eff('0x18')]);return _0xb2117e(_0x5172a5[_0x8eff('0x17')]['message']);}else{logger[_0x8eff('0x12')](_0x8eff('0x13'),_0x359d62,_0x8eff('0x15'));_0xb2117e(_0x5172a5[_0x8eff('0x19')][_0x8eff('0x18')]);}})[_0x8eff('0x1a')](function(_0x38f5ee){logger[_0x8eff('0x17')](_0x8eff('0x13'),_0x359d62,_0x38f5ee);_0x52d250(_0x38f5ee);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 3b00d28..9ad12d5 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 _0x8b60=['removeListener','register','userProfile:','update'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8b60,0x1eb));var _0x08b6=function(_0x12154f,_0x16d139){_0x12154f=_0x12154f-0x0;var _0x23cddb=_0x8b60[_0x12154f];return _0x23cddb;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save','remove',_0x08b6('0x0')];function createListener(_0x12eb47,_0x5cf02e){return function(_0x514b7b){_0x5cf02e['emit'](_0x12eb47,_0x514b7b);};}function removeListener(_0x52e694,_0x4ca95a){return function(){UserProfileEvents[_0x08b6('0x1')](_0x52e694,_0x4ca95a);};}exports[_0x08b6('0x2')]=function(_0x2164df){for(var _0x30a73d=0x0,_0x4199de=events['length'];_0x30a73d<_0x4199de;_0x30a73d++){var _0x3546a1=events[_0x30a73d];var _0x588cba=createListener(_0x08b6('0x3')+_0x3546a1,_0x2164df);UserProfileEvents['on'](_0x3546a1,_0x588cba);}}; \ No newline at end of file +var _0x2766=['save','remove','removeListener','register','length','userProfile:','./userProfile.events'];(function(_0x2bae8e,_0x5aa8fb){var _0x575673=function(_0xf1328f){while(--_0xf1328f){_0x2bae8e['push'](_0x2bae8e['shift']());}};_0x575673(++_0x5aa8fb);}(_0x2766,0x76));var _0x6276=function(_0x38fb0d,_0x52b5db){_0x38fb0d=_0x38fb0d-0x0;var _0x30a5d6=_0x2766[_0x38fb0d];return _0x30a5d6;};'use strict';var UserProfileEvents=require(_0x6276('0x0'));var events=[_0x6276('0x1'),_0x6276('0x2'),'update'];function createListener(_0x563423,_0x1c6d32){return function(_0x121e54){_0x1c6d32['emit'](_0x563423,_0x121e54);};}function removeListener(_0x31f749,_0x24b9fa){return function(){UserProfileEvents[_0x6276('0x3')](_0x31f749,_0x24b9fa);};}exports[_0x6276('0x4')]=function(_0x20a7fb){for(var _0x1de838=0x0,_0xfd986c=events[_0x6276('0x5')];_0x1de838<_0xfd986c;_0x1de838++){var _0xfd3f13=events[_0x1de838];var _0x28b8ca=createListener(_0x6276('0x6')+_0xfd3f13,_0x20a7fb);UserProfileEvents['on'](_0xfd3f13,_0x28b8ca);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index a9623eb..8fcb11a 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 _0x7708=['describe','/:id','post','create','update','delete','destroy','exports','multer','util','connect-timeout','../../config/environment','./userProfileResource.controller','isAuthenticated','get','/describe'];(function(_0x2287e5,_0x3ad5ef){var _0x5ee181=function(_0x3d1a08){while(--_0x3d1a08){_0x2287e5['push'](_0x2287e5['shift']());}};_0x5ee181(++_0x3ad5ef);}(_0x7708,0x188));var _0x8770=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x7708[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8770('0x3'));var controller=require(_0x8770('0x4'));router['get']('/',auth[_0x8770('0x5')](),controller['index']);router[_0x8770('0x6')](_0x8770('0x7'),auth[_0x8770('0x5')](),controller[_0x8770('0x8')]);router[_0x8770('0x6')](_0x8770('0x9'),auth[_0x8770('0x5')](),controller['show']);router[_0x8770('0xa')]('/',auth[_0x8770('0x5')](),controller[_0x8770('0xb')]);router['put'](_0x8770('0x9'),auth[_0x8770('0x5')](),controller[_0x8770('0xc')]);router[_0x8770('0xd')]('/:id',auth[_0x8770('0x5')](),controller[_0x8770('0xe')]);module[_0x8770('0xf')]=router; \ No newline at end of file +var _0x2dca=['path','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','/describe','describe','post','create','/:id','update','destroy','multer','util'];(function(_0x18e815,_0x171312){var _0x3ae01b=function(_0x1b5e55){while(--_0x1b5e55){_0x18e815['push'](_0x18e815['shift']());}};_0x3ae01b(++_0x171312);}(_0x2dca,0xdb));var _0xa2dc=function(_0x344adc,_0x183c37){_0x344adc=_0x344adc-0x0;var _0x4014b2=_0x2dca[_0x344adc];return _0x4014b2;};'use strict';var multer=require(_0xa2dc('0x0'));var util=require(_0xa2dc('0x1'));var path=require(_0xa2dc('0x2'));var timeout=require('connect-timeout');var express=require(_0xa2dc('0x3'));var router=express[_0xa2dc('0x4')]();var auth=require(_0xa2dc('0x5'));var interaction=require(_0xa2dc('0x6'));var config=require('../../config/environment');var controller=require(_0xa2dc('0x7'));router[_0xa2dc('0x8')]('/',auth[_0xa2dc('0x9')](),controller['index']);router[_0xa2dc('0x8')](_0xa2dc('0xa'),auth[_0xa2dc('0x9')](),controller[_0xa2dc('0xb')]);router[_0xa2dc('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa2dc('0xc')]('/',auth[_0xa2dc('0x9')](),controller[_0xa2dc('0xd')]);router['put'](_0xa2dc('0xe'),auth[_0xa2dc('0x9')](),controller[_0xa2dc('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa2dc('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 4fa90a9..fc1da54 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 _0x6fc8=['INTEGER','sequelize','exports','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6fc8,0xe1));var _0x86fc=function(_0x35aaa,_0x1f40fe){_0x35aaa=_0x35aaa-0x0;var _0x59aba3=_0x6fc8[_0x35aaa];return _0x59aba3;};'use strict';var Sequelize=require(_0x86fc('0x0'));module[_0x86fc('0x1')]={'name':{'type':Sequelize[_0x86fc('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x86fc('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x86fc('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xc466=['sequelize','exports','INTEGER','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc466,0xc8));var _0x6c46=function(_0x394155,_0x57a94c){_0x394155=_0x394155-0x0;var _0x2fe993=_0xc466[_0x394155];return _0x2fe993;};'use strict';var Sequelize=require(_0x6c46('0x0'));module[_0x6c46('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6c46('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6c46('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 5fc2947..276ac57 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 _0x008c=['sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','destroy','then','name','send','index','map','UserProfileResource','fieldName','type','key','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x2c0d5b,_0x29f58c){var _0x3d375c=function(_0x3e805d){while(--_0x3e805d){_0x2c0d5b['push'](_0x2c0d5b['shift']());}};_0x3d375c(++_0x29f58c);}(_0x008c,0x188));var _0xc008=function(_0x5b88f1,_0x9555f0){_0x5b88f1=_0x5b88f1-0x0;var _0x41f6c2=_0x008c[_0x5b88f1];return _0x41f6c2;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var db=require(_0xc008('0x16'))['db'];function respondWithStatusCode(_0x2a5b4e,_0x9ffa93){_0x9ffa93=_0x9ffa93||0xcc;return function(_0x1819c6){if(_0x1819c6){return _0x2a5b4e[_0xc008('0x17')](_0x9ffa93);}return _0x2a5b4e['status'](_0x9ffa93)['end']();};}function respondWithResult(_0x33f44c,_0x50c1ab){_0x50c1ab=_0x50c1ab||0xc8;return function(_0x25e13f){if(_0x25e13f){return _0x33f44c[_0xc008('0x18')](_0x50c1ab)[_0xc008('0x19')](_0x25e13f);}};}function respondWithFilteredResult(_0x339ffc,_0x3f0ecf){return function(_0x5ee00b){if(_0x5ee00b){var _0x5e894e=_0x5ee00b[_0xc008('0x1a')],_0x4bd0f4=_0x3f0ecf[_0xc008('0x1b')],_0x11ef38=_0x3f0ecf['offset']+_0x3f0ecf['limit'],_0x15a6ad;if(_0x11ef38>=_0x5e894e){_0x11ef38=_0x5e894e;_0x15a6ad=0xc8;}else{_0x15a6ad=0xce;}_0x339ffc['status'](_0x15a6ad);return _0x339ffc['set'](_0xc008('0x1c'),_0x4bd0f4+'-'+_0x11ef38+'/'+_0x5e894e)[_0xc008('0x19')](_0x5ee00b);}return null;};}function patchUpdates(_0x501137){return function(_0x813397){try{jsonpatch['apply'](_0x813397,_0x501137,!![]);}catch(_0x4bd611){return BPromise['reject'](_0x4bd611);}return _0x813397['save']();};}function saveUpdates(_0x5754a0,_0x4b9726){return function(_0x5560b1){if(_0x5560b1){return _0x5560b1['update'](_0x5754a0)['then'](function(_0x5a58bd){return _0x5a58bd;});}return null;};}function removeEntity(_0x13a263,_0x4777a6){return function(_0x251db2){if(_0x251db2){return _0x251db2[_0xc008('0x1d')]()[_0xc008('0x1e')](function(){_0x13a263[_0xc008('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(!_0x58a6ea){_0x459fd9[_0xc008('0x17')](0x194);}return _0x58a6ea;};}function handleError(_0x36f358,_0x2e3cfb){_0x2e3cfb=_0x2e3cfb||0x1f4;return function(_0x3cb28c){logger['error'](_0x3cb28c['stack']);if(_0x3cb28c['name']){delete _0x3cb28c[_0xc008('0x1f')];}_0x36f358[_0xc008('0x18')](_0x2e3cfb)[_0xc008('0x20')](_0x3cb28c);};}exports[_0xc008('0x21')]=function(_0x5bebd9,_0x5e2aca){var _0x4fce9c={},_0x4adbab={},_0x4caaf4={'count':0x0,'rows':[]};var _0x3865c0=_[_0xc008('0x22')](db[_0xc008('0x23')]['rawAttributes'],function(_0x24c14c){return{'name':_0x24c14c[_0xc008('0x24')],'type':_0x24c14c[_0xc008('0x25')][_0xc008('0x26')]};});_0x4adbab['model']=_[_0xc008('0x22')](_0x3865c0,_0xc008('0x1f'));_0x4adbab['query']=_['keys'](_0x5bebd9['query']);_0x4adbab[_0xc008('0x27')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],_0x4adbab[_0xc008('0x2a')]);_0x4fce9c[_0xc008('0x2b')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],qs[_0xc008('0x2c')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2c')]));_0x4fce9c[_0xc008('0x2b')]=_0x4fce9c[_0xc008('0x2b')]['length']?_0x4fce9c[_0xc008('0x2b')]:_0x4adbab[_0xc008('0x29')];if(!_0x5bebd9['query'][_0xc008('0x2d')](_0xc008('0x2e'))){_0x4fce9c[_0xc008('0x2f')]=qs[_0xc008('0x2f')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2f')]);_0x4fce9c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x5bebd9[_0xc008('0x2a')]['offset']);}_0x4fce9c[_0xc008('0x30')]=qs[_0xc008('0x31')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x31')]);_0x4fce9c[_0xc008('0x32')]=qs[_0xc008('0x27')](_[_0xc008('0x33')](_0x5bebd9['query'],_0x4adbab[_0xc008('0x27')]),_0x3865c0);if(_0x5bebd9[_0xc008('0x2a')]['filter']){_0x4fce9c[_0xc008('0x32')]=_[_0xc008('0x34')](_0x4fce9c['where'],{'$or':_[_0xc008('0x22')](_0x3865c0,function(_0x2e4ae1){if(_0x2e4ae1[_0xc008('0x25')]!=='VIRTUAL'){var _0x53b353={};_0x53b353[_0x2e4ae1['name']]={'$like':'%'+_0x5bebd9[_0xc008('0x2a')]['filter']+'%'};return _0x53b353;}})});}_0x4fce9c=_[_0xc008('0x34')]({},_0x4fce9c,_0x5bebd9[_0xc008('0x35')]);var _0x6a4ccb={'where':_0x4fce9c[_0xc008('0x32')]};return db[_0xc008('0x23')][_0xc008('0x1a')](_0x6a4ccb)[_0xc008('0x1e')](function(_0x35b496){_0x4caaf4[_0xc008('0x1a')]=_0x35b496;if(_0x5bebd9[_0xc008('0x2a')][_0xc008('0x36')]){_0x4fce9c[_0xc008('0x37')]=[{'all':!![]}];}return db[_0xc008('0x23')][_0xc008('0x38')](_0x4fce9c);})['then'](function(_0x3238b4){_0x4caaf4[_0xc008('0x39')]=_0x3238b4;return _0x4caaf4;})[_0xc008('0x1e')](respondWithFilteredResult(_0x5e2aca,_0x4fce9c))[_0xc008('0x3a')](handleError(_0x5e2aca,null));};exports['show']=function(_0x2c4964,_0x15396b){var _0xc8cb91={'raw':![],'where':{'id':_0x2c4964[_0xc008('0x3b')]['id']}},_0x36e7ae={};_0x36e7ae['model']=_[_0xc008('0x3c')](db[_0xc008('0x23')][_0xc008('0x3d')]);_0x36e7ae[_0xc008('0x2a')]=_[_0xc008('0x3c')](_0x2c4964['query']);_0x36e7ae[_0xc008('0x27')]=_[_0xc008('0x28')](_0x36e7ae[_0xc008('0x29')],_0x36e7ae[_0xc008('0x2a')]);_0xc8cb91['attributes']=_[_0xc008('0x28')](_0x36e7ae[_0xc008('0x29')],qs[_0xc008('0x2c')](_0x2c4964['query'][_0xc008('0x2c')]));_0xc8cb91['attributes']=_0xc8cb91[_0xc008('0x2b')]['length']?_0xc8cb91[_0xc008('0x2b')]:_0x36e7ae[_0xc008('0x29')];if(_0x2c4964['query'][_0xc008('0x36')]){_0xc8cb91[_0xc008('0x37')]=[{'all':!![]}];}_0xc8cb91=_[_0xc008('0x34')]({},_0xc8cb91,_0x2c4964['options']);return db[_0xc008('0x23')][_0xc008('0x3e')](_0xc8cb91)[_0xc008('0x1e')](handleEntityNotFound(_0x15396b,null))[_0xc008('0x1e')](respondWithResult(_0x15396b,null))[_0xc008('0x3a')](handleError(_0x15396b,null));};exports[_0xc008('0x3f')]=function(_0x59ca2b,_0x47cafa){return db['UserProfileResource'][_0xc008('0x3f')](_0x59ca2b[_0xc008('0x40')],{})[_0xc008('0x1e')](respondWithResult(_0x47cafa,0xc9))[_0xc008('0x3a')](handleError(_0x47cafa,null));};exports[_0xc008('0x41')]=function(_0x24f6a4,_0x2cf641){if(_0x24f6a4[_0xc008('0x40')]['id']){delete _0x24f6a4['body']['id'];}return db['UserProfileResource']['find']({'where':{'id':_0x24f6a4[_0xc008('0x3b')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x2cf641,null))[_0xc008('0x1e')](saveUpdates(_0x24f6a4['body'],null))[_0xc008('0x1e')](respondWithResult(_0x2cf641,null))[_0xc008('0x3a')](handleError(_0x2cf641,null));};exports[_0xc008('0x1d')]=function(_0x1c2c50,_0x4981b4){return db[_0xc008('0x23')][_0xc008('0x3e')]({'where':{'id':_0x1c2c50[_0xc008('0x3b')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x4981b4,null))[_0xc008('0x1e')](removeEntity(_0x4981b4,null))['catch'](handleError(_0x4981b4,null));};exports['describe']=function(_0x223056,_0x51cb14){return db[_0xc008('0x23')][_0xc008('0x42')]()[_0xc008('0x1e')](respondWithResult(_0x51cb14,null))['catch'](handleError(_0x51cb14,null));}; \ No newline at end of file +var _0xee14=['show','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','UserProfileResource','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x46b5ad,_0x3f3c61){var _0x14084d=function(_0x3aa24b){while(--_0x3aa24b){_0x46b5ad['push'](_0x46b5ad['shift']());}};_0x14084d(++_0x3f3c61);}(_0xee14,0x13a));var _0x4ee1=function(_0x2881d8,_0x3971de){_0x2881d8=_0x2881d8-0x0;var _0x1b0ebc=_0xee14[_0x2881d8];return _0x1b0ebc;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4ee1('0x0'));var zipdir=require(_0x4ee1('0x1'));var jsonpatch=require(_0x4ee1('0x2'));var rp=require(_0x4ee1('0x3'));var moment=require(_0x4ee1('0x4'));var BPromise=require(_0x4ee1('0x5'));var Mustache=require(_0x4ee1('0x6'));var util=require(_0x4ee1('0x7'));var path=require(_0x4ee1('0x8'));var sox=require('sox');var csv=require(_0x4ee1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4ee1('0xa'));var squel=require(_0x4ee1('0xb'));var crypto=require(_0x4ee1('0xc'));var jsforce=require(_0x4ee1('0xd'));var deskjs=require(_0x4ee1('0xe'));var toCsv=require(_0x4ee1('0x9'));var querystring=require('querystring');var Papa=require(_0x4ee1('0xf'));var Redis=require(_0x4ee1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4ee1('0x11'));var as=require(_0x4ee1('0x12'));var hardwareService=require(_0x4ee1('0x13'));var logger=require(_0x4ee1('0x14'))('api');var utils=require(_0x4ee1('0x15'));var config=require(_0x4ee1('0x16'));var db=require(_0x4ee1('0x17'))['db'];function respondWithStatusCode(_0x2d5d3c,_0x2f864e){_0x2f864e=_0x2f864e||0xcc;return function(_0x174427){if(_0x174427){return _0x2d5d3c['sendStatus'](_0x2f864e);}return _0x2d5d3c[_0x4ee1('0x18')](_0x2f864e)[_0x4ee1('0x19')]();};}function respondWithResult(_0x1096a5,_0x24a915){_0x24a915=_0x24a915||0xc8;return function(_0x46d2c2){if(_0x46d2c2){return _0x1096a5[_0x4ee1('0x18')](_0x24a915)[_0x4ee1('0x1a')](_0x46d2c2);}};}function respondWithFilteredResult(_0x359bab,_0xb7eafd){return function(_0x4e3490){if(_0x4e3490){var _0x2f9194=_0x4e3490[_0x4ee1('0x1b')],_0x38008f=_0xb7eafd[_0x4ee1('0x1c')],_0x34651b=_0xb7eafd[_0x4ee1('0x1c')]+_0xb7eafd[_0x4ee1('0x1d')],_0x1b1e0e;if(_0x34651b>=_0x2f9194){_0x34651b=_0x2f9194;_0x1b1e0e=0xc8;}else{_0x1b1e0e=0xce;}_0x359bab[_0x4ee1('0x18')](_0x1b1e0e);return _0x359bab[_0x4ee1('0x1e')](_0x4ee1('0x1f'),_0x38008f+'-'+_0x34651b+'/'+_0x2f9194)['json'](_0x4e3490);}return null;};}function patchUpdates(_0x236215){return function(_0x3db827){try{jsonpatch[_0x4ee1('0x20')](_0x3db827,_0x236215,!![]);}catch(_0x1034fb){return BPromise[_0x4ee1('0x21')](_0x1034fb);}return _0x3db827[_0x4ee1('0x22')]();};}function saveUpdates(_0x48a959,_0x8a631f){return function(_0x333e96){if(_0x333e96){return _0x333e96[_0x4ee1('0x23')](_0x48a959)[_0x4ee1('0x24')](function(_0x160a26){return _0x160a26;});}return null;};}function removeEntity(_0x224b54,_0x328f21){return function(_0x40fd98){if(_0x40fd98){return _0x40fd98[_0x4ee1('0x25')]()[_0x4ee1('0x24')](function(){_0x224b54['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14110c,_0x459e2e){return function(_0xaf87e7){if(!_0xaf87e7){_0x14110c[_0x4ee1('0x26')](0x194);}return _0xaf87e7;};}function handleError(_0x1e9a50,_0x28efdc){_0x28efdc=_0x28efdc||0x1f4;return function(_0x57d45d){logger['error'](_0x57d45d[_0x4ee1('0x27')]);if(_0x57d45d[_0x4ee1('0x28')]){delete _0x57d45d['name'];}_0x1e9a50[_0x4ee1('0x18')](_0x28efdc)[_0x4ee1('0x29')](_0x57d45d);};}exports[_0x4ee1('0x2a')]=function(_0x215949,_0x2d699c){var _0x3c7b2a={},_0x45bd0d={},_0x56c4d3={'count':0x0,'rows':[]};var _0x1f7b74=_['map'](db[_0x4ee1('0x2b')]['rawAttributes'],function(_0x3dc870){return{'name':_0x3dc870[_0x4ee1('0x2c')],'type':_0x3dc870[_0x4ee1('0x2d')][_0x4ee1('0x2e')]};});_0x45bd0d[_0x4ee1('0x2f')]=_['map'](_0x1f7b74,_0x4ee1('0x28'));_0x45bd0d['query']=_[_0x4ee1('0x30')](_0x215949[_0x4ee1('0x31')]);_0x45bd0d[_0x4ee1('0x32')]=_[_0x4ee1('0x33')](_0x45bd0d[_0x4ee1('0x2f')],_0x45bd0d['query']);_0x3c7b2a[_0x4ee1('0x34')]=_[_0x4ee1('0x33')](_0x45bd0d[_0x4ee1('0x2f')],qs[_0x4ee1('0x35')](_0x215949[_0x4ee1('0x31')][_0x4ee1('0x35')]));_0x3c7b2a['attributes']=_0x3c7b2a['attributes'][_0x4ee1('0x36')]?_0x3c7b2a[_0x4ee1('0x34')]:_0x45bd0d[_0x4ee1('0x2f')];if(!_0x215949['query'][_0x4ee1('0x37')](_0x4ee1('0x38'))){_0x3c7b2a[_0x4ee1('0x1d')]=qs[_0x4ee1('0x1d')](_0x215949[_0x4ee1('0x31')][_0x4ee1('0x1d')]);_0x3c7b2a[_0x4ee1('0x1c')]=qs[_0x4ee1('0x1c')](_0x215949[_0x4ee1('0x31')][_0x4ee1('0x1c')]);}_0x3c7b2a[_0x4ee1('0x39')]=qs[_0x4ee1('0x3a')](_0x215949[_0x4ee1('0x31')]['sort']);_0x3c7b2a[_0x4ee1('0x3b')]=qs[_0x4ee1('0x32')](_[_0x4ee1('0x3c')](_0x215949['query'],_0x45bd0d['filters']),_0x1f7b74);if(_0x215949[_0x4ee1('0x31')][_0x4ee1('0x3d')]){_0x3c7b2a[_0x4ee1('0x3b')]=_[_0x4ee1('0x3e')](_0x3c7b2a['where'],{'$or':_[_0x4ee1('0x3f')](_0x1f7b74,function(_0x2ed16f){if(_0x2ed16f[_0x4ee1('0x2d')]!==_0x4ee1('0x40')){var _0x2653c4={};_0x2653c4[_0x2ed16f[_0x4ee1('0x28')]]={'$like':'%'+_0x215949[_0x4ee1('0x31')][_0x4ee1('0x3d')]+'%'};return _0x2653c4;}})});}_0x3c7b2a=_['merge']({},_0x3c7b2a,_0x215949[_0x4ee1('0x41')]);var _0x1116b4={'where':_0x3c7b2a[_0x4ee1('0x3b')]};return db[_0x4ee1('0x2b')][_0x4ee1('0x1b')](_0x1116b4)[_0x4ee1('0x24')](function(_0x543b2e){_0x56c4d3[_0x4ee1('0x1b')]=_0x543b2e;if(_0x215949[_0x4ee1('0x31')][_0x4ee1('0x42')]){_0x3c7b2a[_0x4ee1('0x43')]=[{'all':!![]}];}return db[_0x4ee1('0x2b')][_0x4ee1('0x44')](_0x3c7b2a);})[_0x4ee1('0x24')](function(_0xaac883){_0x56c4d3[_0x4ee1('0x45')]=_0xaac883;return _0x56c4d3;})[_0x4ee1('0x24')](respondWithFilteredResult(_0x2d699c,_0x3c7b2a))[_0x4ee1('0x46')](handleError(_0x2d699c,null));};exports[_0x4ee1('0x47')]=function(_0x34fc7a,_0x51fd40){var _0x3b3bed={'raw':![],'where':{'id':_0x34fc7a['params']['id']}},_0x40a3e3={};_0x40a3e3[_0x4ee1('0x2f')]=_['keys'](db[_0x4ee1('0x2b')]['rawAttributes']);_0x40a3e3[_0x4ee1('0x31')]=_[_0x4ee1('0x30')](_0x34fc7a['query']);_0x40a3e3[_0x4ee1('0x32')]=_[_0x4ee1('0x33')](_0x40a3e3[_0x4ee1('0x2f')],_0x40a3e3[_0x4ee1('0x31')]);_0x3b3bed['attributes']=_[_0x4ee1('0x33')](_0x40a3e3[_0x4ee1('0x2f')],qs[_0x4ee1('0x35')](_0x34fc7a['query']['fields']));_0x3b3bed[_0x4ee1('0x34')]=_0x3b3bed[_0x4ee1('0x34')][_0x4ee1('0x36')]?_0x3b3bed[_0x4ee1('0x34')]:_0x40a3e3[_0x4ee1('0x2f')];if(_0x34fc7a['query']['includeAll']){_0x3b3bed[_0x4ee1('0x43')]=[{'all':!![]}];}_0x3b3bed=_[_0x4ee1('0x3e')]({},_0x3b3bed,_0x34fc7a[_0x4ee1('0x41')]);return db[_0x4ee1('0x2b')]['find'](_0x3b3bed)[_0x4ee1('0x24')](handleEntityNotFound(_0x51fd40,null))[_0x4ee1('0x24')](respondWithResult(_0x51fd40,null))['catch'](handleError(_0x51fd40,null));};exports[_0x4ee1('0x48')]=function(_0x16dc20,_0x21edeb){return db[_0x4ee1('0x2b')][_0x4ee1('0x48')](_0x16dc20[_0x4ee1('0x49')],{})[_0x4ee1('0x24')](respondWithResult(_0x21edeb,0xc9))[_0x4ee1('0x46')](handleError(_0x21edeb,null));};exports[_0x4ee1('0x23')]=function(_0x4ebb28,_0x49b667){if(_0x4ebb28[_0x4ee1('0x49')]['id']){delete _0x4ebb28[_0x4ee1('0x49')]['id'];}return db[_0x4ee1('0x2b')][_0x4ee1('0x4a')]({'where':{'id':_0x4ebb28['params']['id']}})[_0x4ee1('0x24')](handleEntityNotFound(_0x49b667,null))[_0x4ee1('0x24')](saveUpdates(_0x4ebb28[_0x4ee1('0x49')],null))[_0x4ee1('0x24')](respondWithResult(_0x49b667,null))[_0x4ee1('0x46')](handleError(_0x49b667,null));};exports['destroy']=function(_0x1c71ba,_0x4ae560){return db[_0x4ee1('0x2b')]['find']({'where':{'id':_0x1c71ba[_0x4ee1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4ae560,null))[_0x4ee1('0x24')](removeEntity(_0x4ae560,null))['catch'](handleError(_0x4ae560,null));};exports[_0x4ee1('0x4c')]=function(_0x480796,_0xd19964){return db['UserProfileResource'][_0x4ee1('0x4c')]()[_0x4ee1('0x24')](respondWithResult(_0xd19964,null))[_0x4ee1('0x46')](handleError(_0xd19964,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 6886280..edf9d1d 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 _0xaa42=['request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa42,0x1cb));var _0x2aa4=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xaa42[_0x47a349];return _0x18ab75;};'use strict';var _=require(_0x2aa4('0x0'));var util=require('util');var logger=require(_0x2aa4('0x1'))(_0x2aa4('0x2'));var moment=require(_0x2aa4('0x3'));var BPromise=require(_0x2aa4('0x4'));var rp=require(_0x2aa4('0x5'));var fs=require('fs');var path=require(_0x2aa4('0x6'));var rimraf=require(_0x2aa4('0x7'));var config=require(_0x2aa4('0x8'));var attributes=require(_0x2aa4('0x9'));module[_0x2aa4('0xa')]=function(_0x50db70,_0x189d1b){return _0x50db70[_0x2aa4('0xb')]('UserProfileResource',attributes,{'tableName':_0x2aa4('0xc'),'paranoid':![],'indexes':[{'name':_0x2aa4('0xd'),'fields':[_0x2aa4('0xe'),_0x2aa4('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6249=['path','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2fc091,_0x4599e8){var _0x3b31ac=function(_0x5542fd){while(--_0x5542fd){_0x2fc091['push'](_0x2fc091['shift']());}};_0x3b31ac(++_0x4599e8);}(_0x6249,0x108));var _0x9624=function(_0x5486e2,_0x4e2bb3){_0x5486e2=_0x5486e2-0x0;var _0x5cfefe=_0x6249[_0x5486e2];return _0x5cfefe;};'use strict';var _=require(_0x9624('0x0'));var util=require(_0x9624('0x1'));var logger=require(_0x9624('0x2'))('api');var moment=require(_0x9624('0x3'));var BPromise=require(_0x9624('0x4'));var rp=require(_0x9624('0x5'));var fs=require('fs');var path=require(_0x9624('0x6'));var rimraf=require('rimraf');var config=require(_0x9624('0x7'));var attributes=require(_0x9624('0x8'));module[_0x9624('0x9')]=function(_0x13563e,_0x53956f){return _0x13563e[_0x9624('0xa')](_0x9624('0xb'),attributes,{'tableName':_0x9624('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x9624('0xd'),_0x9624('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 416dc92..99017ba 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 _0xdab5=['../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','lodash','util','randomstring'];(function(_0x40a0e2,_0x4e4582){var _0x336f1e=function(_0x44cc2e){while(--_0x44cc2e){_0x40a0e2['push'](_0x40a0e2['shift']());}};_0x336f1e(++_0x4e4582);}(_0xdab5,0x165));var _0x5dab=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdab5[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x5dab('0x0'));var util=require(_0x5dab('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5dab('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5dab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5dab('0x4'))('rpc');var config=require(_0x5dab('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5dab('0x6')][_0x5dab('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x139652,_0x4a9d25,_0x510723){return new BPromise(function(_0x13fab0,_0xd849d2){return client[_0x5dab('0x8')](_0x139652,_0x510723)[_0x5dab('0x9')](function(_0x25f3a5){logger[_0x5dab('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x4a9d25,_0x5dab('0xb'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x4a9d25,'request\x20sent',JSON[_0x5dab('0xc')](_0x25f3a5));if(_0x25f3a5[_0x5dab('0xd')]){if(_0x25f3a5[_0x5dab('0xd')][_0x5dab('0xe')]===0x1f4){logger['error'](_0x5dab('0xf'),_0x4a9d25,_0x25f3a5[_0x5dab('0xd')][_0x5dab('0x10')]);return _0xd849d2(_0x25f3a5['error']['message']);}logger[_0x5dab('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x4a9d25,_0x25f3a5['error'][_0x5dab('0x10')]);return _0x13fab0(_0x25f3a5[_0x5dab('0xd')][_0x5dab('0x10')]);}else{logger[_0x5dab('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x4a9d25,_0x5dab('0xb'));_0x13fab0(_0x25f3a5[_0x5dab('0x11')]['message']);}})['catch'](function(_0x2a0ba2){logger[_0x5dab('0xd')](_0x5dab('0xf'),_0x4a9d25,_0x2a0ba2);_0xd849d2(_0x2a0ba2);});});} \ No newline at end of file +var _0xc06f=['error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x459963,_0x5a366a){var _0xbe84e3=function(_0x358999){while(--_0x358999){_0x459963['push'](_0x459963['shift']());}};_0xbe84e3(++_0x5a366a);}(_0xc06f,0x1a6));var _0xfc06=function(_0x5c26a2,_0x4f3dc1){_0x5c26a2=_0x5c26a2-0x0;var _0x5a93cc=_0xc06f[_0x5c26a2];return _0x5a93cc;};'use strict';var _=require(_0xfc06('0x0'));var util=require('util');var moment=require(_0xfc06('0x1'));var BPromise=require(_0xfc06('0x2'));var rs=require(_0xfc06('0x3'));var fs=require('fs');var Redis=require(_0xfc06('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc06('0x5'));var logger=require(_0xfc06('0x6'))('rpc');var config=require(_0xfc06('0x7'));var jayson=require(_0xfc06('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x6a301c,_0x2437e9,_0xda6740){return new BPromise(function(_0x13d576,_0x5893c0){return client['request'](_0x6a301c,_0xda6740)[_0xfc06('0x9')](function(_0x396a75){logger[_0xfc06('0xa')](_0xfc06('0xb'),_0x2437e9,_0xfc06('0xc'));logger['debug'](_0xfc06('0xd'),_0x2437e9,_0xfc06('0xc'),JSON[_0xfc06('0xe')](_0x396a75));if(_0x396a75[_0xfc06('0xf')]){if(_0x396a75[_0xfc06('0xf')][_0xfc06('0x10')]===0x1f4){logger[_0xfc06('0xf')](_0xfc06('0xb'),_0x2437e9,_0x396a75[_0xfc06('0xf')]['message']);return _0x5893c0(_0x396a75['error'][_0xfc06('0x11')]);}logger['error'](_0xfc06('0xb'),_0x2437e9,_0x396a75[_0xfc06('0xf')]['message']);return _0x13d576(_0x396a75[_0xfc06('0xf')]['message']);}else{logger[_0xfc06('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x2437e9,_0xfc06('0xc'));_0x13d576(_0x396a75[_0xfc06('0x12')][_0xfc06('0x11')]);}})['catch'](function(_0x1309f4){logger[_0xfc06('0xf')](_0xfc06('0xb'),_0x2437e9,_0x1309f4);_0x5893c0(_0x1309f4);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index c80d1eb..741c245 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 _0x757f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x757f,0xee));var _0xf757=function(_0x165fa0,_0x3a25a9){_0x165fa0=_0x165fa0-0x0;var _0x5d58bb=_0x757f[_0x165fa0];return _0x5d58bb;};'use strict';var multer=require(_0xf757('0x0'));var util=require('util');var path=require(_0xf757('0x1'));var timeout=require(_0xf757('0x2'));var express=require(_0xf757('0x3'));var router=express[_0xf757('0x4')]();var auth=require(_0xf757('0x5'));var interaction=require(_0xf757('0x6'));var config=require(_0xf757('0x7'));var controller=require(_0xf757('0x8'));router[_0xf757('0x9')]('/',auth['isAuthenticated'](),controller[_0xf757('0xa')]);router[_0xf757('0x9')](_0xf757('0xb'),auth[_0xf757('0xc')](),controller[_0xf757('0xd')]);router['get']('/:id',auth[_0xf757('0xc')](),controller[_0xf757('0xe')]);router[_0xf757('0xf')]('/',auth[_0xf757('0xc')](),controller['create']);router[_0xf757('0x10')](_0xf757('0x11'),auth[_0xf757('0xc')](),controller[_0xf757('0x12')]);router[_0xf757('0x13')](_0xf757('0x11'),auth[_0xf757('0xc')](),controller[_0xf757('0x14')]);module[_0xf757('0x15')]=router; \ No newline at end of file +var _0x3e25=['../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x392eb9,_0x4f5e5d){var _0x91b016=function(_0x18a8a){while(--_0x18a8a){_0x392eb9['push'](_0x392eb9['shift']());}};_0x91b016(++_0x4f5e5d);}(_0x3e25,0x14f));var _0x53e2=function(_0x4abd94,_0x2dff8f){_0x4abd94=_0x4abd94-0x0;var _0x5ddef0=_0x3e25[_0x4abd94];return _0x5ddef0;};'use strict';var multer=require(_0x53e2('0x0'));var util=require(_0x53e2('0x1'));var path=require(_0x53e2('0x2'));var timeout=require('connect-timeout');var express=require(_0x53e2('0x3'));var router=express['Router']();var auth=require(_0x53e2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x53e2('0x5'));var controller=require(_0x53e2('0x6'));router[_0x53e2('0x7')]('/',auth[_0x53e2('0x8')](),controller[_0x53e2('0x9')]);router[_0x53e2('0x7')](_0x53e2('0xa'),auth[_0x53e2('0x8')](),controller[_0x53e2('0xb')]);router[_0x53e2('0x7')](_0x53e2('0xc'),auth[_0x53e2('0x8')](),controller[_0x53e2('0xd')]);router[_0x53e2('0xe')]('/',auth[_0x53e2('0x8')](),controller[_0x53e2('0xf')]);router[_0x53e2('0x10')](_0x53e2('0xc'),auth['isAuthenticated'](),controller[_0x53e2('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x53e2('0x12')]);module[_0x53e2('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 71d4a14..a63b735 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 _0xd2ea=['split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x58de4a,_0x564dbc){var _0x178820=function(_0x3576ef){while(--_0x3576ef){_0x58de4a['push'](_0x58de4a['shift']());}};_0x178820(++_0x564dbc);}(_0xd2ea,0x15f));var _0xad2e=function(_0x3fbb06,_0x36a9ce){_0x3fbb06=_0x3fbb06-0x0;var _0x500510=_0xd2ea[_0x3fbb06];return _0x500510;};'use strict';var Sequelize=require(_0xad2e('0x0'));module[_0xad2e('0x1')]={'name':{'type':Sequelize[_0xad2e('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xad2e('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xad2e('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xad2e('0x2')],'set':function(_0xcba7cb){this[_0xad2e('0x5')](_0xad2e('0x6'),_0xcba7cb?_0xcba7cb[_0xad2e('0x7')](''):[]);},'get':function(){return this[_0xad2e('0x8')]('crudPermissions')?this[_0xad2e('0x8')](_0xad2e('0x6'))[_0xad2e('0x9')](''):[];}}}; \ No newline at end of file +var _0xae99=['join','getDataValue','sequelize','exports','BOOLEAN','STRING','setDataValue','crudPermissions'];(function(_0x250d7f,_0x451a3c){var _0x1c5785=function(_0x4edd7c){while(--_0x4edd7c){_0x250d7f['push'](_0x250d7f['shift']());}};_0x1c5785(++_0x451a3c);}(_0xae99,0x172));var _0x9ae9=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xae99[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x9ae9('0x0'));module[_0x9ae9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x9ae9('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x9ae9('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x9ae9('0x3')],'set':function(_0x37729f){this[_0x9ae9('0x4')](_0x9ae9('0x5'),_0x37729f?_0x37729f[_0x9ae9('0x6')](''):[]);},'get':function(){return this[_0x9ae9('0x7')]('crudPermissions')?this['getDataValue'](_0x9ae9('0x5'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 0022a3f..b4f2d5c 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 _0x49e5=['desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','map','UserProfileSection','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','options','include','findAll','rows','catch','show','params','includeAll','merge','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel'];(function(_0x202234,_0x53dda1){var _0xa88abf=function(_0x15ce57){while(--_0x15ce57){_0x202234['push'](_0x202234['shift']());}};_0xa88abf(++_0x53dda1);}(_0x49e5,0x196));var _0x549e=function(_0x178604,_0x688861){_0x178604=_0x178604-0x0;var _0x3cf983=_0x49e5[_0x178604];return _0x3cf983;};'use strict';var pdf=require(_0x549e('0x0'));var emlformat=require(_0x549e('0x1'));var rimraf=require(_0x549e('0x2'));var zipdir=require(_0x549e('0x3'));var jsonpatch=require(_0x549e('0x4'));var rp=require(_0x549e('0x5'));var moment=require('moment');var BPromise=require(_0x549e('0x6'));var Mustache=require(_0x549e('0x7'));var util=require(_0x549e('0x8'));var path=require(_0x549e('0x9'));var sox=require(_0x549e('0xa'));var csv=require('to-csv');var ejs=require(_0x549e('0xb'));var fs=require('fs');var _=require(_0x549e('0xc'));var squel=require(_0x549e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x549e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x549e('0xf'));var Papa=require('papaparse');var Redis=require(_0x549e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x549e('0x11'));var as=require(_0x549e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x549e('0x13'));var utils=require('../../config/utils');var config=require(_0x549e('0x14'));var db=require(_0x549e('0x15'))['db'];function respondWithStatusCode(_0x5247c3,_0x34068c){_0x34068c=_0x34068c||0xcc;return function(_0x14e9da){if(_0x14e9da){return _0x5247c3[_0x549e('0x16')](_0x34068c);}return _0x5247c3[_0x549e('0x17')](_0x34068c)['end']();};}function respondWithResult(_0x247d23,_0x1d49f6){_0x1d49f6=_0x1d49f6||0xc8;return function(_0x26d8b4){if(_0x26d8b4){return _0x247d23[_0x549e('0x17')](_0x1d49f6)[_0x549e('0x18')](_0x26d8b4);}};}function respondWithFilteredResult(_0x498794,_0xcc0780){return function(_0x36a2a8){if(_0x36a2a8){var _0x2ff674=_0x36a2a8[_0x549e('0x19')],_0xe12ff9=_0xcc0780['offset'],_0x384e78=_0xcc0780[_0x549e('0x1a')]+_0xcc0780[_0x549e('0x1b')],_0x203137;if(_0x384e78>=_0x2ff674){_0x384e78=_0x2ff674;_0x203137=0xc8;}else{_0x203137=0xce;}_0x498794[_0x549e('0x17')](_0x203137);return _0x498794[_0x549e('0x1c')](_0x549e('0x1d'),_0xe12ff9+'-'+_0x384e78+'/'+_0x2ff674)[_0x549e('0x18')](_0x36a2a8);}return null;};}function patchUpdates(_0x598f70){return function(_0x4f324a){try{jsonpatch[_0x549e('0x1e')](_0x4f324a,_0x598f70,!![]);}catch(_0x1cd251){return BPromise[_0x549e('0x1f')](_0x1cd251);}return _0x4f324a[_0x549e('0x20')]();};}function saveUpdates(_0x139056,_0x1ae932){return function(_0x2360e4){if(_0x2360e4){return _0x2360e4[_0x549e('0x21')](_0x139056)[_0x549e('0x22')](function(_0xc34c0d){return _0xc34c0d;});}return null;};}function removeEntity(_0x1769e2,_0x298f82){return function(_0x6a7dc4){if(_0x6a7dc4){return _0x6a7dc4[_0x549e('0x23')]()[_0x549e('0x22')](function(){_0x1769e2[_0x549e('0x17')](0xcc)[_0x549e('0x24')]();});}};}function handleEntityNotFound(_0x2bcea8,_0x498d50){return function(_0x1b54a9){if(!_0x1b54a9){_0x2bcea8[_0x549e('0x16')](0x194);}return _0x1b54a9;};}function handleError(_0x261a92,_0x36823a){_0x36823a=_0x36823a||0x1f4;return function(_0x318c17){logger['error'](_0x318c17[_0x549e('0x25')]);if(_0x318c17[_0x549e('0x26')]){delete _0x318c17[_0x549e('0x26')];}_0x261a92[_0x549e('0x17')](_0x36823a)[_0x549e('0x27')](_0x318c17);};}exports['index']=function(_0x58104f,_0x413016){var _0x287177={},_0x24d01c={},_0x5205bd={'count':0x0,'rows':[]};var _0x1e6e5d=_[_0x549e('0x28')](db[_0x549e('0x29')][_0x549e('0x2a')],function(_0x2fd80a){return{'name':_0x2fd80a['fieldName'],'type':_0x2fd80a['type'][_0x549e('0x2b')]};});_0x24d01c[_0x549e('0x2c')]=_[_0x549e('0x28')](_0x1e6e5d,_0x549e('0x26'));_0x24d01c[_0x549e('0x2d')]=_[_0x549e('0x2e')](_0x58104f[_0x549e('0x2d')]);_0x24d01c['filters']=_[_0x549e('0x2f')](_0x24d01c[_0x549e('0x2c')],_0x24d01c['query']);_0x287177[_0x549e('0x30')]=_['intersection'](_0x24d01c[_0x549e('0x2c')],qs[_0x549e('0x31')](_0x58104f[_0x549e('0x2d')][_0x549e('0x31')]));_0x287177[_0x549e('0x30')]=_0x287177[_0x549e('0x30')][_0x549e('0x32')]?_0x287177[_0x549e('0x30')]:_0x24d01c[_0x549e('0x2c')];if(!_0x58104f[_0x549e('0x2d')][_0x549e('0x33')]('nolimit')){_0x287177[_0x549e('0x1b')]=qs['limit'](_0x58104f[_0x549e('0x2d')][_0x549e('0x1b')]);_0x287177['offset']=qs['offset'](_0x58104f[_0x549e('0x2d')][_0x549e('0x1a')]);}_0x287177[_0x549e('0x34')]=qs[_0x549e('0x35')](_0x58104f[_0x549e('0x2d')][_0x549e('0x35')]);_0x287177['where']=qs[_0x549e('0x36')](_['pick'](_0x58104f[_0x549e('0x2d')],_0x24d01c[_0x549e('0x36')]),_0x1e6e5d);if(_0x58104f[_0x549e('0x2d')][_0x549e('0x37')]){_0x287177[_0x549e('0x38')]=_['merge'](_0x287177['where'],{'$or':_[_0x549e('0x28')](_0x1e6e5d,function(_0x3706ec){if(_0x3706ec['type']!=='VIRTUAL'){var _0x249f2d={};_0x249f2d[_0x3706ec[_0x549e('0x26')]]={'$like':'%'+_0x58104f['query'][_0x549e('0x37')]+'%'};return _0x249f2d;}})});}_0x287177=_['merge']({},_0x287177,_0x58104f[_0x549e('0x39')]);var _0x6f4d14={'where':_0x287177[_0x549e('0x38')]};return db['UserProfileSection']['count'](_0x6f4d14)['then'](function(_0x578eb2){_0x5205bd[_0x549e('0x19')]=_0x578eb2;if(_0x58104f['query']['includeAll']){_0x287177[_0x549e('0x3a')]=[{'all':!![]}];}return db[_0x549e('0x29')][_0x549e('0x3b')](_0x287177);})[_0x549e('0x22')](function(_0x337cc8){_0x5205bd[_0x549e('0x3c')]=_0x337cc8;return _0x5205bd;})[_0x549e('0x22')](respondWithFilteredResult(_0x413016,_0x287177))[_0x549e('0x3d')](handleError(_0x413016,null));};exports[_0x549e('0x3e')]=function(_0x305f1a,_0x11023d){var _0x1868e6={'raw':![],'where':{'id':_0x305f1a[_0x549e('0x3f')]['id']}},_0x3d40a2={};_0x3d40a2[_0x549e('0x2c')]=_[_0x549e('0x2e')](db[_0x549e('0x29')][_0x549e('0x2a')]);_0x3d40a2['query']=_['keys'](_0x305f1a[_0x549e('0x2d')]);_0x3d40a2[_0x549e('0x36')]=_[_0x549e('0x2f')](_0x3d40a2['model'],_0x3d40a2[_0x549e('0x2d')]);_0x1868e6[_0x549e('0x30')]=_[_0x549e('0x2f')](_0x3d40a2['model'],qs[_0x549e('0x31')](_0x305f1a[_0x549e('0x2d')]['fields']));_0x1868e6[_0x549e('0x30')]=_0x1868e6[_0x549e('0x30')][_0x549e('0x32')]?_0x1868e6['attributes']:_0x3d40a2[_0x549e('0x2c')];if(_0x305f1a[_0x549e('0x2d')][_0x549e('0x40')]){_0x1868e6['include']=[{'all':!![]}];}_0x1868e6=_[_0x549e('0x41')]({},_0x1868e6,_0x305f1a['options']);return db[_0x549e('0x29')][_0x549e('0x42')](_0x1868e6)[_0x549e('0x22')](handleEntityNotFound(_0x11023d,null))[_0x549e('0x22')](respondWithResult(_0x11023d,null))[_0x549e('0x3d')](handleError(_0x11023d,null));};exports[_0x549e('0x43')]=function(_0x4214a7,_0x4cf770){return db[_0x549e('0x29')][_0x549e('0x43')](_0x4214a7[_0x549e('0x44')],{})[_0x549e('0x22')](respondWithResult(_0x4cf770,0xc9))[_0x549e('0x3d')](handleError(_0x4cf770,null));};exports[_0x549e('0x21')]=function(_0x4b497d,_0x46d355){if(_0x4b497d[_0x549e('0x44')]['id']){delete _0x4b497d['body']['id'];}return db['UserProfileSection'][_0x549e('0x42')]({'where':{'id':_0x4b497d[_0x549e('0x3f')]['id']}})[_0x549e('0x22')](handleEntityNotFound(_0x46d355,null))[_0x549e('0x22')](saveUpdates(_0x4b497d[_0x549e('0x44')],null))['then'](respondWithResult(_0x46d355,null))[_0x549e('0x3d')](handleError(_0x46d355,null));};exports['destroy']=function(_0x305fd1,_0x9f494f){return db[_0x549e('0x29')][_0x549e('0x42')]({'where':{'id':_0x305fd1[_0x549e('0x3f')]['id']}})[_0x549e('0x22')](handleEntityNotFound(_0x9f494f,null))[_0x549e('0x22')](removeEntity(_0x9f494f,null))[_0x549e('0x3d')](handleError(_0x9f494f,null));};exports['describe']=function(_0x49b72b,_0x1f8ed0){return db['UserProfileSection'][_0x549e('0x45')]()[_0x549e('0x22')](respondWithResult(_0x1f8ed0,null))[_0x549e('0x3d')](handleError(_0x1f8ed0,null));}; \ No newline at end of file +var _0xe1f0=['find','create','update','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','destroy','then','error','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','UserProfileSection','includeAll','include','rows','catch','show','length'];(function(_0x407d57,_0xc7e784){var _0x16a22b=function(_0xe77910){while(--_0xe77910){_0x407d57['push'](_0x407d57['shift']());}};_0x16a22b(++_0xc7e784);}(_0xe1f0,0x1c2));var _0x0e1f=function(_0x552c52,_0x3e8021){_0x552c52=_0x552c52-0x0;var _0x3a925b=_0xe1f0[_0x552c52];return _0x3a925b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0e1f('0x0'));var rimraf=require(_0x0e1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e1f('0x2'));var rp=require(_0x0e1f('0x3'));var moment=require(_0x0e1f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0e1f('0x5'));var util=require(_0x0e1f('0x6'));var path=require(_0x0e1f('0x7'));var sox=require('sox');var csv=require(_0x0e1f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0e1f('0x9'));var squel=require(_0x0e1f('0xa'));var crypto=require(_0x0e1f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0e1f('0x8'));var querystring=require(_0x0e1f('0xc'));var Papa=require('papaparse');var Redis=require(_0x0e1f('0xd'));var authService=require(_0x0e1f('0xe'));var qs=require(_0x0e1f('0xf'));var as=require(_0x0e1f('0x10'));var hardwareService=require(_0x0e1f('0x11'));var logger=require(_0x0e1f('0x12'))(_0x0e1f('0x13'));var utils=require(_0x0e1f('0x14'));var config=require(_0x0e1f('0x15'));var db=require(_0x0e1f('0x16'))['db'];function respondWithStatusCode(_0x3a6d4d,_0x1c0fe6){_0x1c0fe6=_0x1c0fe6||0xcc;return function(_0x5bef5e){if(_0x5bef5e){return _0x3a6d4d[_0x0e1f('0x17')](_0x1c0fe6);}return _0x3a6d4d[_0x0e1f('0x18')](_0x1c0fe6)[_0x0e1f('0x19')]();};}function respondWithResult(_0x131bd0,_0x19d9af){_0x19d9af=_0x19d9af||0xc8;return function(_0x5164b0){if(_0x5164b0){return _0x131bd0[_0x0e1f('0x18')](_0x19d9af)[_0x0e1f('0x1a')](_0x5164b0);}};}function respondWithFilteredResult(_0x195e86,_0x1db38d){return function(_0x581310){if(_0x581310){var _0x3088a6=_0x581310[_0x0e1f('0x1b')],_0x15940f=_0x1db38d[_0x0e1f('0x1c')],_0x4a7d49=_0x1db38d[_0x0e1f('0x1c')]+_0x1db38d[_0x0e1f('0x1d')],_0x1c9253;if(_0x4a7d49>=_0x3088a6){_0x4a7d49=_0x3088a6;_0x1c9253=0xc8;}else{_0x1c9253=0xce;}_0x195e86[_0x0e1f('0x18')](_0x1c9253);return _0x195e86[_0x0e1f('0x1e')]('Content-Range',_0x15940f+'-'+_0x4a7d49+'/'+_0x3088a6)[_0x0e1f('0x1a')](_0x581310);}return null;};}function patchUpdates(_0x270e7b){return function(_0x35fcbc){try{jsonpatch[_0x0e1f('0x1f')](_0x35fcbc,_0x270e7b,!![]);}catch(_0x3c10bc){return BPromise[_0x0e1f('0x20')](_0x3c10bc);}return _0x35fcbc[_0x0e1f('0x21')]();};}function saveUpdates(_0x572edd,_0x187ba5){return function(_0x5c3159){if(_0x5c3159){return _0x5c3159['update'](_0x572edd)['then'](function(_0x4424d8){return _0x4424d8;});}return null;};}function removeEntity(_0x18b27a,_0x1503ee){return function(_0x58c44b){if(_0x58c44b){return _0x58c44b[_0x0e1f('0x22')]()[_0x0e1f('0x23')](function(){_0x18b27a[_0x0e1f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf6066,_0x103dc5){return function(_0x376e6a){if(!_0x376e6a){_0xf6066[_0x0e1f('0x17')](0x194);}return _0x376e6a;};}function handleError(_0x3bd3e2,_0x1d0820){_0x1d0820=_0x1d0820||0x1f4;return function(_0x177ca1){logger[_0x0e1f('0x24')](_0x177ca1[_0x0e1f('0x25')]);if(_0x177ca1[_0x0e1f('0x26')]){delete _0x177ca1[_0x0e1f('0x26')];}_0x3bd3e2[_0x0e1f('0x18')](_0x1d0820)[_0x0e1f('0x27')](_0x177ca1);};}exports['index']=function(_0x31ef6c,_0x4f8300){var _0x3993ba={},_0x5815cf={},_0xe9f5b0={'count':0x0,'rows':[]};var _0x37937b=_['map'](db['UserProfileSection'][_0x0e1f('0x28')],function(_0x2a551e){return{'name':_0x2a551e[_0x0e1f('0x29')],'type':_0x2a551e[_0x0e1f('0x2a')][_0x0e1f('0x2b')]};});_0x5815cf['model']=_[_0x0e1f('0x2c')](_0x37937b,'name');_0x5815cf[_0x0e1f('0x2d')]=_[_0x0e1f('0x2e')](_0x31ef6c[_0x0e1f('0x2d')]);_0x5815cf[_0x0e1f('0x2f')]=_[_0x0e1f('0x30')](_0x5815cf[_0x0e1f('0x31')],_0x5815cf['query']);_0x3993ba[_0x0e1f('0x32')]=_[_0x0e1f('0x30')](_0x5815cf[_0x0e1f('0x31')],qs[_0x0e1f('0x33')](_0x31ef6c['query']['fields']));_0x3993ba[_0x0e1f('0x32')]=_0x3993ba[_0x0e1f('0x32')]['length']?_0x3993ba[_0x0e1f('0x32')]:_0x5815cf[_0x0e1f('0x31')];if(!_0x31ef6c[_0x0e1f('0x2d')][_0x0e1f('0x34')](_0x0e1f('0x35'))){_0x3993ba[_0x0e1f('0x1d')]=qs[_0x0e1f('0x1d')](_0x31ef6c[_0x0e1f('0x2d')][_0x0e1f('0x1d')]);_0x3993ba[_0x0e1f('0x1c')]=qs[_0x0e1f('0x1c')](_0x31ef6c[_0x0e1f('0x2d')][_0x0e1f('0x1c')]);}_0x3993ba[_0x0e1f('0x36')]=qs[_0x0e1f('0x37')](_0x31ef6c['query'][_0x0e1f('0x37')]);_0x3993ba[_0x0e1f('0x38')]=qs[_0x0e1f('0x2f')](_[_0x0e1f('0x39')](_0x31ef6c[_0x0e1f('0x2d')],_0x5815cf['filters']),_0x37937b);if(_0x31ef6c['query'][_0x0e1f('0x3a')]){_0x3993ba[_0x0e1f('0x38')]=_[_0x0e1f('0x3b')](_0x3993ba[_0x0e1f('0x38')],{'$or':_['map'](_0x37937b,function(_0x17bc66){if(_0x17bc66['type']!==_0x0e1f('0x3c')){var _0x546e22={};_0x546e22[_0x17bc66[_0x0e1f('0x26')]]={'$like':'%'+_0x31ef6c[_0x0e1f('0x2d')][_0x0e1f('0x3a')]+'%'};return _0x546e22;}})});}_0x3993ba=_[_0x0e1f('0x3b')]({},_0x3993ba,_0x31ef6c['options']);var _0x2da7b5={'where':_0x3993ba['where']};return db[_0x0e1f('0x3d')][_0x0e1f('0x1b')](_0x2da7b5)[_0x0e1f('0x23')](function(_0x40e55f){_0xe9f5b0[_0x0e1f('0x1b')]=_0x40e55f;if(_0x31ef6c[_0x0e1f('0x2d')][_0x0e1f('0x3e')]){_0x3993ba[_0x0e1f('0x3f')]=[{'all':!![]}];}return db[_0x0e1f('0x3d')]['findAll'](_0x3993ba);})['then'](function(_0x4ff945){_0xe9f5b0[_0x0e1f('0x40')]=_0x4ff945;return _0xe9f5b0;})[_0x0e1f('0x23')](respondWithFilteredResult(_0x4f8300,_0x3993ba))[_0x0e1f('0x41')](handleError(_0x4f8300,null));};exports[_0x0e1f('0x42')]=function(_0x1d56c1,_0x438a9b){var _0x559a93={'raw':![],'where':{'id':_0x1d56c1['params']['id']}},_0xa92820={};_0xa92820['model']=_['keys'](db[_0x0e1f('0x3d')][_0x0e1f('0x28')]);_0xa92820[_0x0e1f('0x2d')]=_[_0x0e1f('0x2e')](_0x1d56c1[_0x0e1f('0x2d')]);_0xa92820[_0x0e1f('0x2f')]=_[_0x0e1f('0x30')](_0xa92820[_0x0e1f('0x31')],_0xa92820[_0x0e1f('0x2d')]);_0x559a93[_0x0e1f('0x32')]=_['intersection'](_0xa92820['model'],qs[_0x0e1f('0x33')](_0x1d56c1['query'][_0x0e1f('0x33')]));_0x559a93[_0x0e1f('0x32')]=_0x559a93[_0x0e1f('0x32')][_0x0e1f('0x43')]?_0x559a93['attributes']:_0xa92820[_0x0e1f('0x31')];if(_0x1d56c1[_0x0e1f('0x2d')][_0x0e1f('0x3e')]){_0x559a93[_0x0e1f('0x3f')]=[{'all':!![]}];}_0x559a93=_[_0x0e1f('0x3b')]({},_0x559a93,_0x1d56c1['options']);return db['UserProfileSection'][_0x0e1f('0x44')](_0x559a93)[_0x0e1f('0x23')](handleEntityNotFound(_0x438a9b,null))[_0x0e1f('0x23')](respondWithResult(_0x438a9b,null))[_0x0e1f('0x41')](handleError(_0x438a9b,null));};exports[_0x0e1f('0x45')]=function(_0x54d1b1,_0x4cf1db){return db[_0x0e1f('0x3d')]['create'](_0x54d1b1['body'],{})['then'](respondWithResult(_0x4cf1db,0xc9))['catch'](handleError(_0x4cf1db,null));};exports[_0x0e1f('0x46')]=function(_0x3fc5a8,_0x15c251){if(_0x3fc5a8[_0x0e1f('0x47')]['id']){delete _0x3fc5a8[_0x0e1f('0x47')]['id'];}return db[_0x0e1f('0x3d')][_0x0e1f('0x44')]({'where':{'id':_0x3fc5a8['params']['id']}})[_0x0e1f('0x23')](handleEntityNotFound(_0x15c251,null))['then'](saveUpdates(_0x3fc5a8[_0x0e1f('0x47')],null))[_0x0e1f('0x23')](respondWithResult(_0x15c251,null))[_0x0e1f('0x41')](handleError(_0x15c251,null));};exports['destroy']=function(_0x5e2a0e,_0x43b065){return db[_0x0e1f('0x3d')][_0x0e1f('0x44')]({'where':{'id':_0x5e2a0e[_0x0e1f('0x48')]['id']}})[_0x0e1f('0x23')](handleEntityNotFound(_0x43b065,null))[_0x0e1f('0x23')](removeEntity(_0x43b065,null))[_0x0e1f('0x41')](handleError(_0x43b065,null));};exports[_0x0e1f('0x49')]=function(_0x410add,_0x2a396b){return db[_0x0e1f('0x3d')][_0x0e1f('0x49')]()['then'](respondWithResult(_0x2a396b,null))[_0x0e1f('0x41')](handleError(_0x2a396b,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index ced8465..be41faa 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 _0xa1b3=['user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x323201,_0x5563ac){var _0x4d0f01=function(_0x1410bb){while(--_0x1410bb){_0x323201['push'](_0x323201['shift']());}};_0x4d0f01(++_0x5563ac);}(_0xa1b3,0x67));var _0x3a1b=function(_0x5c6816,_0x10cce2){_0x5c6816=_0x5c6816-0x0;var _0x3c9d11=_0xa1b3[_0x5c6816];return _0x3c9d11;};'use strict';var _=require(_0x3a1b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3a1b('0x1'));var moment=require('moment');var BPromise=require(_0x3a1b('0x2'));var rp=require(_0x3a1b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a1b('0x4'));var config=require(_0x3a1b('0x5'));var attributes=require('./userProfileSection.attributes');module[_0x3a1b('0x6')]=function(_0x5ca92e,_0x241d9e){return _0x5ca92e['define']('UserProfileSection',attributes,{'tableName':_0x3a1b('0x7'),'paranoid':![],'indexes':[{'name':_0x3a1b('0x8'),'fields':[_0x3a1b('0x9'),_0x3a1b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x699c=['moment','bluebird','path','rimraf','../../config/environment','exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api'];(function(_0x3eaa42,_0x340128){var _0x2fb1bd=function(_0x1da511){while(--_0x1da511){_0x3eaa42['push'](_0x3eaa42['shift']());}};_0x2fb1bd(++_0x340128);}(_0x699c,0xdd));var _0xc699=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x699c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xc699('0x0'));var util=require(_0xc699('0x1'));var logger=require(_0xc699('0x2'))(_0xc699('0x3'));var moment=require(_0xc699('0x4'));var BPromise=require(_0xc699('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc699('0x6'));var rimraf=require(_0xc699('0x7'));var config=require(_0xc699('0x8'));var attributes=require('./userProfileSection.attributes');module[_0xc699('0x9')]=function(_0x70d882,_0x41f1ae){return _0x70d882['define'](_0xc699('0xa'),attributes,{'tableName':_0xc699('0xb'),'paranoid':![],'indexes':[{'name':_0xc699('0xc'),'fields':[_0xc699('0xd'),_0xc699('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 b7aaae2..8c92727 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 _0x7e00=['bluebird','randomstring','ioredis','../../config/logger','rpc','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','error','code','message','util'];(function(_0x2f52e9,_0xdee19b){var _0x47e1cb=function(_0x5e22cd){while(--_0x5e22cd){_0x2f52e9['push'](_0x2f52e9['shift']());}};_0x47e1cb(++_0xdee19b);}(_0x7e00,0x13a));var _0x07e0=function(_0x1b5ace,_0x310dca){_0x1b5ace=_0x1b5ace-0x0;var _0x1b9982=_0x7e00[_0x1b5ace];return _0x1b9982;};'use strict';var _=require('lodash');var util=require(_0x07e0('0x0'));var moment=require('moment');var BPromise=require(_0x07e0('0x1'));var rs=require(_0x07e0('0x2'));var fs=require('fs');var Redis=require(_0x07e0('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x07e0('0x4'))(_0x07e0('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x07e0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x521a73,_0x4c4570,_0x4320be){return new BPromise(function(_0x3b681a,_0x500dc1){return client[_0x07e0('0x7')](_0x521a73,_0x4320be)['then'](function(_0x302ac5){logger[_0x07e0('0x8')](_0x07e0('0x9'),_0x4c4570,_0x07e0('0xa'));logger[_0x07e0('0xb')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x4c4570,_0x07e0('0xa'),JSON['stringify'](_0x302ac5));if(_0x302ac5['error']){if(_0x302ac5[_0x07e0('0xc')][_0x07e0('0xd')]===0x1f4){logger['error'](_0x07e0('0x9'),_0x4c4570,_0x302ac5['error'][_0x07e0('0xe')]);return _0x500dc1(_0x302ac5[_0x07e0('0xc')][_0x07e0('0xe')]);}logger[_0x07e0('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x4c4570,_0x302ac5[_0x07e0('0xc')]['message']);return _0x3b681a(_0x302ac5[_0x07e0('0xc')]['message']);}else{logger[_0x07e0('0x8')](_0x07e0('0x9'),_0x4c4570,_0x07e0('0xa'));_0x3b681a(_0x302ac5['result'][_0x07e0('0xe')]);}})['catch'](function(_0x338890){logger[_0x07e0('0xc')](_0x07e0('0x9'),_0x4c4570,_0x338890);_0x500dc1(_0x338890);});});} \ No newline at end of file +var _0xa681=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4286e6,_0x5d7408){var _0x49c9f8=function(_0x140720){while(--_0x140720){_0x4286e6['push'](_0x4286e6['shift']());}};_0x49c9f8(++_0x5d7408);}(_0xa681,0x10e));var _0x1a68=function(_0xa12494,_0x27d106){_0xa12494=_0xa12494-0x0;var _0x56b3b7=_0xa681[_0xa12494];return _0x56b3b7;};'use strict';var _=require(_0x1a68('0x0'));var util=require(_0x1a68('0x1'));var moment=require(_0x1a68('0x2'));var BPromise=require(_0x1a68('0x3'));var rs=require(_0x1a68('0x4'));var fs=require('fs');var Redis=require(_0x1a68('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a68('0x6'));var logger=require('../../config/logger')(_0x1a68('0x7'));var config=require(_0x1a68('0x8'));var jayson=require(_0x1a68('0x9'));var client=jayson[_0x1a68('0xa')][_0x1a68('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x272228,_0x18d95f,_0x3fff0a){return new BPromise(function(_0x486cfb,_0xdfecc3){return client[_0x1a68('0xc')](_0x272228,_0x3fff0a)[_0x1a68('0xd')](function(_0x559688){logger[_0x1a68('0xe')](_0x1a68('0xf'),_0x18d95f,'request\x20sent');logger['debug'](_0x1a68('0x10'),_0x18d95f,_0x1a68('0x11'),JSON[_0x1a68('0x12')](_0x559688));if(_0x559688[_0x1a68('0x13')]){if(_0x559688[_0x1a68('0x13')][_0x1a68('0x14')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x18d95f,_0x559688['error'][_0x1a68('0x15')]);return _0xdfecc3(_0x559688[_0x1a68('0x13')][_0x1a68('0x15')]);}logger[_0x1a68('0x13')](_0x1a68('0xf'),_0x18d95f,_0x559688['error'][_0x1a68('0x15')]);return _0x486cfb(_0x559688['error'][_0x1a68('0x15')]);}else{logger[_0x1a68('0xe')](_0x1a68('0xf'),_0x18d95f,_0x1a68('0x11'));_0x486cfb(_0x559688['result'][_0x1a68('0x15')]);}})[_0x1a68('0x16')](function(_0x4d1117){logger[_0x1a68('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x18d95f,_0x4d1117);_0xdfecc3(_0x4d1117);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 72ac9ad..419cbb4 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 _0x9c3e=['util','path','connect-timeout','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x40b50c,_0x1c1f08){var _0x135895=function(_0x238a0f){while(--_0x238a0f){_0x40b50c['push'](_0x40b50c['shift']());}};_0x135895(++_0x1c1f08);}(_0x9c3e,0x1d4));var _0xe9c3=function(_0x15e5a7,_0xc801c9){_0x15e5a7=_0x15e5a7-0x0;var _0x1fd52b=_0x9c3e[_0x15e5a7];return _0x1fd52b;};'use strict';var multer=require(_0xe9c3('0x0'));var util=require(_0xe9c3('0x1'));var path=require(_0xe9c3('0x2'));var timeout=require(_0xe9c3('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xe9c3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe9c3('0x5'));module[_0xe9c3('0x6')]=router; \ No newline at end of file +var _0xc3d7=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','express'];(function(_0x1f1c0f,_0x5afceb){var _0x33d2f2=function(_0x380a38){while(--_0x380a38){_0x1f1c0f['push'](_0x1f1c0f['shift']());}};_0x33d2f2(++_0x5afceb);}(_0xc3d7,0xcd));var _0x7c3d=function(_0x104aa1,_0x1a5a48){_0x104aa1=_0x104aa1-0x0;var _0x1e7981=_0xc3d7[_0x104aa1];return _0x1e7981;};'use strict';var multer=require('multer');var util=require(_0x7c3d('0x0'));var path=require(_0x7c3d('0x1'));var timeout=require('connect-timeout');var express=require(_0x7c3d('0x2'));var router=express[_0x7c3d('0x3')]();var auth=require(_0x7c3d('0x4'));var interaction=require(_0x7c3d('0x5'));var config=require(_0x7c3d('0x6'));module[_0x7c3d('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 ee3c2e9..870f252 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x5ec68e,_0x58b99a){var _0x18e497=function(_0x4666af){while(--_0x4666af){_0x5ec68e['push'](_0x5ec68e['shift']());}};_0x18e497(++_0x58b99a);}(_0xe706,0xa3));var _0x6e70=function(_0x22ca53,_0x30e1a9){_0x22ca53=_0x22ca53-0x0;var _0x80aacf=_0xe706[_0x22ca53];return _0x80aacf;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x50ebc0,_0x143df8){var _0x173b25=function(_0x4e4a55){while(--_0x4e4a55){_0x50ebc0['push'](_0x50ebc0['shift']());}};_0x173b25(++_0x143df8);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 1804a4e..0eeff06 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 _0x9fd1=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','lodash','util'];(function(_0x3b278e,_0xd81595){var _0x4642e5=function(_0x33e3d7){while(--_0x33e3d7){_0x3b278e['push'](_0x3b278e['shift']());}};_0x4642e5(++_0xd81595);}(_0x9fd1,0x82));var _0x19fd=function(_0x609b9a,_0x216c2e){_0x609b9a=_0x609b9a-0x0;var _0x52eac2=_0x9fd1[_0x609b9a];return _0x52eac2;};'use strict';var _=require(_0x19fd('0x0'));var util=require(_0x19fd('0x1'));var logger=require(_0x19fd('0x2'))(_0x19fd('0x3'));var moment=require(_0x19fd('0x4'));var BPromise=require('bluebird');var rp=require(_0x19fd('0x5'));var fs=require('fs');var path=require(_0x19fd('0x6'));var rimraf=require(_0x19fd('0x7'));var config=require(_0x19fd('0x8'));var attributes=require(_0x19fd('0x9'));module['exports']=function(_0x3dfe19,_0x510927){return _0x3dfe19[_0x19fd('0xa')](_0x19fd('0xb'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6202=['request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xb89c2e,_0xe007ab){var _0x2a1a93=function(_0xfa2f32){while(--_0xfa2f32){_0xb89c2e['push'](_0xb89c2e['shift']());}};_0x2a1a93(++_0xe007ab);}(_0x6202,0xe8));var _0x2620=function(_0x503564,_0x55867e){_0x503564=_0x503564-0x0;var _0x4be9fd=_0x6202[_0x503564];return _0x4be9fd;};'use strict';var _=require(_0x2620('0x0'));var util=require(_0x2620('0x1'));var logger=require(_0x2620('0x2'))(_0x2620('0x3'));var moment=require(_0x2620('0x4'));var BPromise=require(_0x2620('0x5'));var rp=require(_0x2620('0x6'));var fs=require('fs');var path=require(_0x2620('0x7'));var rimraf=require(_0x2620('0x8'));var config=require(_0x2620('0x9'));var attributes=require(_0x2620('0xa'));module[_0x2620('0xb')]=function(_0x277cb0,_0x45729f){return _0x277cb0[_0x2620('0xc')]('UserSmsQueue',attributes,{'tableName':_0x2620('0xd'),'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 ece74bb..374284a 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 _0x391b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x292128,_0x37badb){var _0x5d99ca=function(_0x21cac9){while(--_0x21cac9){_0x292128['push'](_0x292128['shift']());}};_0x5d99ca(++_0x37badb);}(_0x391b,0x91));var _0xb391=function(_0x248c90,_0x1ed333){_0x248c90=_0x248c90-0x0;var _0x449036=_0x391b[_0x248c90];return _0x449036;};'use strict';var _=require(_0xb391('0x0'));var util=require(_0xb391('0x1'));var moment=require(_0xb391('0x2'));var BPromise=require(_0xb391('0x3'));var rs=require(_0xb391('0x4'));var fs=require('fs');var Redis=require(_0xb391('0x5'));var db=require(_0xb391('0x6'))['db'];var utils=require(_0xb391('0x7'));var logger=require(_0xb391('0x8'))(_0xb391('0x9'));var config=require(_0xb391('0xa'));var jayson=require(_0xb391('0xb'));var client=jayson[_0xb391('0xc')][_0xb391('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c3fa7,_0x39a281,_0x12ae50){return new BPromise(function(_0x34e209,_0x5b538e){return client[_0xb391('0xe')](_0x4c3fa7,_0x12ae50)[_0xb391('0xf')](function(_0x3204dd){logger[_0xb391('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x39a281,_0xb391('0x11'));logger[_0xb391('0x12')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x39a281,'request\x20sent',JSON[_0xb391('0x13')](_0x3204dd));if(_0x3204dd[_0xb391('0x14')]){if(_0x3204dd[_0xb391('0x14')][_0xb391('0x15')]===0x1f4){logger[_0xb391('0x14')](_0xb391('0x16'),_0x39a281,_0x3204dd[_0xb391('0x14')][_0xb391('0x17')]);return _0x5b538e(_0x3204dd[_0xb391('0x14')][_0xb391('0x17')]);}logger[_0xb391('0x14')](_0xb391('0x16'),_0x39a281,_0x3204dd['error'][_0xb391('0x17')]);return _0x34e209(_0x3204dd[_0xb391('0x14')]['message']);}else{logger[_0xb391('0x10')](_0xb391('0x16'),_0x39a281,_0xb391('0x11'));_0x34e209(_0x3204dd['result'][_0xb391('0x17')]);}})[_0xb391('0x18')](function(_0x73371f){logger[_0xb391('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x39a281,_0x73371f);_0x5b538e(_0x73371f);});});} \ No newline at end of file +var _0x4c06=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x223584,_0x4d0a82){var _0x38adeb=function(_0x2a2452){while(--_0x2a2452){_0x223584['push'](_0x223584['shift']());}};_0x38adeb(++_0x4d0a82);}(_0x4c06,0x145));var _0x64c0=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0x4c06[_0x55677b];return _0x104b88;};'use strict';var _=require(_0x64c0('0x0'));var util=require(_0x64c0('0x1'));var moment=require(_0x64c0('0x2'));var BPromise=require(_0x64c0('0x3'));var rs=require(_0x64c0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64c0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x64c0('0x6'))(_0x64c0('0x7'));var config=require(_0x64c0('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x64c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a346f,_0x45a11b,_0x396564){return new BPromise(function(_0x4fc23e,_0x3cc75b){return client[_0x64c0('0xa')](_0x5a346f,_0x396564)[_0x64c0('0xb')](function(_0x2edf9a){logger[_0x64c0('0xc')](_0x64c0('0xd'),_0x45a11b,_0x64c0('0xe'));logger[_0x64c0('0xf')](_0x64c0('0x10'),_0x45a11b,_0x64c0('0xe'),JSON[_0x64c0('0x11')](_0x2edf9a));if(_0x2edf9a[_0x64c0('0x12')]){if(_0x2edf9a[_0x64c0('0x12')]['code']===0x1f4){logger[_0x64c0('0x12')](_0x64c0('0xd'),_0x45a11b,_0x2edf9a[_0x64c0('0x12')][_0x64c0('0x13')]);return _0x3cc75b(_0x2edf9a[_0x64c0('0x12')][_0x64c0('0x13')]);}logger[_0x64c0('0x12')](_0x64c0('0xd'),_0x45a11b,_0x2edf9a[_0x64c0('0x12')]['message']);return _0x4fc23e(_0x2edf9a['error']['message']);}else{logger[_0x64c0('0xc')](_0x64c0('0xd'),_0x45a11b,_0x64c0('0xe'));_0x4fc23e(_0x2edf9a['result'][_0x64c0('0x13')]);}})['catch'](function(_0x32d2ab){logger[_0x64c0('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x45a11b,_0x32d2ab);_0x3cc75b(_0x32d2ab);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index d1602de..f883b89 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 _0x7a7a=['connect-timeout','../../config/environment','exports'];(function(_0x3e7270,_0x4c8bd0){var _0x54631d=function(_0x5269b1){while(--_0x5269b1){_0x3e7270['push'](_0x3e7270['shift']());}};_0x54631d(++_0x4c8bd0);}(_0x7a7a,0x6c));var _0xa7a7=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x7a7a[_0x22f8ab];return _0x2a70e5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa7a7('0x0'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa7a7('0x1'));module[_0xa7a7('0x2')]=router; \ No newline at end of file +var _0x397a=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout','express'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0x397a,0x1ea));var _0xa397=function(_0x437f9e,_0x433f78){_0x437f9e=_0x437f9e-0x0;var _0x430633=_0x397a[_0x437f9e];return _0x430633;};'use strict';var multer=require(_0xa397('0x0'));var util=require(_0xa397('0x1'));var path=require(_0xa397('0x2'));var timeout=require(_0xa397('0x3'));var express=require(_0xa397('0x4'));var router=express[_0xa397('0x5')]();var auth=require(_0xa397('0x6'));var interaction=require(_0xa397('0x7'));var config=require(_0xa397('0x8'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 2282070..34cf373 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 _0xb10b=['sequelize','INTEGER'];(function(_0xd3c40f,_0x128a13){var _0x27b244=function(_0x596c3e){while(--_0x596c3e){_0xd3c40f['push'](_0xd3c40f['shift']());}};_0x27b244(++_0x128a13);}(_0xb10b,0x12a));var _0xbb10=function(_0x449a38,_0x3f8271){_0x449a38=_0x449a38-0x0;var _0x38a415=_0xb10b[_0x449a38];return _0x38a415;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x16df00,_0x35dbc1){var _0x46e3bf=function(_0x266807){while(--_0x266807){_0x16df00['push'](_0x16df00['shift']());}};_0x46e3bf(++_0x35dbc1);}(_0xb10b,0x12a));var _0xbb10=function(_0x503679,_0x1d99bf){_0x503679=_0x503679-0x0;var _0x2c6c2b=_0xb10b[_0x503679];return _0x2c6c2b;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 3a56227..6d6f1ee 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 _0x56a4=['./userVoiceQueue.attributes','exports','user_has_voice_queues','lodash','util','api','moment','path','rimraf','../../config/environment'];(function(_0x5e2890,_0xa8d609){var _0x483fe4=function(_0x27bf03){while(--_0x27bf03){_0x5e2890['push'](_0x5e2890['shift']());}};_0x483fe4(++_0xa8d609);}(_0x56a4,0x11b));var _0x456a=function(_0x3ad7ad,_0x291a8d){_0x3ad7ad=_0x3ad7ad-0x0;var _0x225a60=_0x56a4[_0x3ad7ad];return _0x225a60;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var logger=require('../../config/logger')(_0x456a('0x2'));var moment=require(_0x456a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x456a('0x4'));var rimraf=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var attributes=require(_0x456a('0x7'));module[_0x456a('0x8')]=function(_0x4b8eec,_0x3b0145){return _0x4b8eec['define']('UserVoiceQueue',attributes,{'tableName':_0x456a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e5=['request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','util','api','moment','bluebird'];(function(_0x5adea1,_0x482267){var _0x203f85=function(_0x2ae55c){while(--_0x2ae55c){_0x5adea1['push'](_0x5adea1['shift']());}};_0x203f85(++_0x482267);}(_0x34e5,0x172));var _0x534e=function(_0xc9f96d,_0x11eae1){_0xc9f96d=_0xc9f96d-0x0;var _0x5a039c=_0x34e5[_0xc9f96d];return _0x5a039c;};'use strict';var _=require('lodash');var util=require(_0x534e('0x0'));var logger=require('../../config/logger')(_0x534e('0x1'));var moment=require(_0x534e('0x2'));var BPromise=require(_0x534e('0x3'));var rp=require(_0x534e('0x4'));var fs=require('fs');var path=require(_0x534e('0x5'));var rimraf=require('rimraf');var config=require(_0x534e('0x6'));var attributes=require(_0x534e('0x7'));module[_0x534e('0x8')]=function(_0x117f0c,_0x436a92){return _0x117f0c[_0x534e('0x9')](_0x534e('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 7d8c5b2..3e63a50 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 _0xecda=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4ffc3c,_0x24e70c){var _0x19c1a0=function(_0xd182c0){while(--_0xd182c0){_0x4ffc3c['push'](_0x4ffc3c['shift']());}};_0x19c1a0(++_0x24e70c);}(_0xecda,0x92));var _0xaecd=function(_0x5afed5,_0x2d0ac9){_0x5afed5=_0x5afed5-0x0;var _0x48938b=_0xecda[_0x5afed5];return _0x48938b;};'use strict';var _=require(_0xaecd('0x0'));var util=require(_0xaecd('0x1'));var moment=require(_0xaecd('0x2'));var BPromise=require(_0xaecd('0x3'));var rs=require(_0xaecd('0x4'));var fs=require('fs');var Redis=require(_0xaecd('0x5'));var db=require(_0xaecd('0x6'))['db'];var utils=require(_0xaecd('0x7'));var logger=require(_0xaecd('0x8'))('rpc');var config=require(_0xaecd('0x9'));var jayson=require(_0xaecd('0xa'));var client=jayson[_0xaecd('0xb')][_0xaecd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a5654,_0x3ca297,_0xe036de){return new BPromise(function(_0xee280b,_0x290f0f){return client[_0xaecd('0xd')](_0x4a5654,_0xe036de)[_0xaecd('0xe')](function(_0x1fbdc9){logger[_0xaecd('0xf')](_0xaecd('0x10'),_0x3ca297,'request\x20sent');logger[_0xaecd('0x11')](_0xaecd('0x12'),_0x3ca297,_0xaecd('0x13'),JSON[_0xaecd('0x14')](_0x1fbdc9));if(_0x1fbdc9['error']){if(_0x1fbdc9['error']['code']===0x1f4){logger[_0xaecd('0x15')](_0xaecd('0x10'),_0x3ca297,_0x1fbdc9[_0xaecd('0x15')][_0xaecd('0x16')]);return _0x290f0f(_0x1fbdc9[_0xaecd('0x15')]['message']);}logger[_0xaecd('0x15')]('UserVoiceQueue,\x20%s,\x20%s',_0x3ca297,_0x1fbdc9[_0xaecd('0x15')][_0xaecd('0x16')]);return _0xee280b(_0x1fbdc9['error']['message']);}else{logger[_0xaecd('0xf')](_0xaecd('0x10'),_0x3ca297,_0xaecd('0x13'));_0xee280b(_0x1fbdc9[_0xaecd('0x17')][_0xaecd('0x16')]);}})[_0xaecd('0x18')](function(_0xca2d0e){logger[_0xaecd('0x15')](_0xaecd('0x10'),_0x3ca297,_0xca2d0e);_0x290f0f(_0xca2d0e);});});} \ No newline at end of file +var _0x3e78=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x50ed64,_0x3a841){var _0x44ebed=function(_0x1f7b8c){while(--_0x1f7b8c){_0x50ed64['push'](_0x50ed64['shift']());}};_0x44ebed(++_0x3a841);}(_0x3e78,0x1d6));var _0x83e7=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x3e78[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x83e7('0x0'));var util=require(_0x83e7('0x1'));var moment=require(_0x83e7('0x2'));var BPromise=require(_0x83e7('0x3'));var rs=require(_0x83e7('0x4'));var fs=require('fs');var Redis=require(_0x83e7('0x5'));var db=require(_0x83e7('0x6'))['db'];var utils=require(_0x83e7('0x7'));var logger=require(_0x83e7('0x8'))(_0x83e7('0x9'));var config=require(_0x83e7('0xa'));var jayson=require(_0x83e7('0xb'));var client=jayson[_0x83e7('0xc')][_0x83e7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x575627,_0x53d660,_0x40131a){return new BPromise(function(_0x5c42af,_0x108be0){return client[_0x83e7('0xe')](_0x575627,_0x40131a)['then'](function(_0x9d835){logger[_0x83e7('0xf')](_0x83e7('0x10'),_0x53d660,_0x83e7('0x11'));logger[_0x83e7('0x12')](_0x83e7('0x13'),_0x53d660,_0x83e7('0x11'),JSON['stringify'](_0x9d835));if(_0x9d835[_0x83e7('0x14')]){if(_0x9d835[_0x83e7('0x14')][_0x83e7('0x15')]===0x1f4){logger[_0x83e7('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x53d660,_0x9d835[_0x83e7('0x14')][_0x83e7('0x16')]);return _0x108be0(_0x9d835[_0x83e7('0x14')][_0x83e7('0x16')]);}logger[_0x83e7('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x53d660,_0x9d835['error'][_0x83e7('0x16')]);return _0x5c42af(_0x9d835['error']['message']);}else{logger[_0x83e7('0xf')](_0x83e7('0x10'),_0x53d660,_0x83e7('0x11'));_0x5c42af(_0x9d835[_0x83e7('0x17')][_0x83e7('0x16')]);}})[_0x83e7('0x18')](function(_0x9866a5){logger[_0x83e7('0x14')](_0x83e7('0x10'),_0x53d660,_0x9866a5);_0x108be0(_0x9866a5);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 7f7a85e..20ba383 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 _0xbad6=['../../config/environment','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4fb927,_0x42f767){var _0x2178ba=function(_0x44f4bd){while(--_0x44f4bd){_0x4fb927['push'](_0x4fb927['shift']());}};_0x2178ba(++_0x42f767);}(_0xbad6,0xa3));var _0x6bad=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbad6[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x6bad('0x0'));var util=require(_0x6bad('0x1'));var path=require(_0x6bad('0x2'));var timeout=require(_0x6bad('0x3'));var express=require(_0x6bad('0x4'));var router=express[_0x6bad('0x5')]();var auth=require(_0x6bad('0x6'));var interaction=require(_0x6bad('0x7'));var config=require(_0x6bad('0x8'));module['exports']=router; \ No newline at end of file +var _0x8b08=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8b08,0x190));var _0x88b0=function(_0x11fc9e,_0x34718e){_0x11fc9e=_0x11fc9e-0x0;var _0x29368e=_0x8b08[_0x11fc9e];return _0x29368e;};'use strict';var multer=require('multer');var util=require(_0x88b0('0x0'));var path=require(_0x88b0('0x1'));var timeout=require(_0x88b0('0x2'));var express=require(_0x88b0('0x3'));var router=express[_0x88b0('0x4')]();var auth=require(_0x88b0('0x5'));var interaction=require(_0x88b0('0x6'));var config=require(_0x88b0('0x7'));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 4fbd6e7..d0b568d 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 _0x1762=['INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','exports'];(function(_0x30e5e9,_0x2849a9){var _0x4ae8ca=function(_0x4abbc0){while(--_0x4abbc0){_0x30e5e9['push'](_0x30e5e9['shift']());}};_0x4ae8ca(++_0x2849a9);}(_0x1762,0x19c));var _0x2176=function(_0x2cb169,_0x38ec0a){_0x2cb169=_0x2cb169-0x0;var _0x54c758=_0x1762[_0x2cb169];return _0x54c758;};'use strict';var Sequelize=require(_0x2176('0x0'));module[_0x2176('0x1')]={'uniqueid':{'type':Sequelize[_0x2176('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x2176('0x3')],'allowNull':![],'comment':_0x2176('0x4')},'UserId':{'type':Sequelize[_0x2176('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2176('0x3')],'allowNull':![],'unique':_0x2176('0x5'),'comment':_0x2176('0x4')},'VoiceQueueId':{'type':Sequelize[_0x2176('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2176('0x5'),'comment':_0x2176('0x4')},'penalty':{'type':Sequelize[_0x2176('0x2')](0xb),'defaultValue':0x0,'comment':_0x2176('0x4')},'paused':{'type':Sequelize[_0x2176('0x2')](0xb),'defaultValue':0x0,'comment':_0x2176('0x4')}}; \ No newline at end of file +var _0x0a19=['queue_interface','INTEGER','sequelize','exports','Required\x20by\x20Asterisk','STRING'];(function(_0x39d39d,_0x5586bd){var _0x577ac3=function(_0x12f9f2){while(--_0x12f9f2){_0x39d39d['push'](_0x39d39d['shift']());}};_0x577ac3(++_0x5586bd);}(_0x0a19,0x158));var _0x90a1=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x0a19[_0x5f309e];return _0x487b5e;};'use strict';var Sequelize=require(_0x90a1('0x0'));module[_0x90a1('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x90a1('0x2')},'membername':{'type':Sequelize[_0x90a1('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x90a1('0x3')],'allowNull':![],'unique':_0x90a1('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x90a1('0x5')],'allowNull':![]},'interface':{'type':Sequelize[_0x90a1('0x3')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x90a1('0x5')](0xb),'defaultValue':0x0,'comment':_0x90a1('0x2')},'paused':{'type':Sequelize[_0x90a1('0x5')](0xb),'defaultValue':0x0,'comment':_0x90a1('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 4511d9b..a743c77 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 _0xc352=['save','update','remove','emit','hasOwnProperty','hook','events','UserVoiceQueueRt','setMaxListeners'];(function(_0x39326d,_0x491e12){var _0x73dad3=function(_0x1378b8){while(--_0x1378b8){_0x39326d['push'](_0x39326d['shift']());}};_0x73dad3(++_0x491e12);}(_0xc352,0x11d));var _0x2c35=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0xc352[_0x2d994d];return _0xd54be4;};'use strict';var EventEmitter=require(_0x2c35('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x2c35('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x2c35('0x2')](0x0);var events={'afterCreate':_0x2c35('0x3'),'afterUpdate':_0x2c35('0x4'),'afterDestroy':_0x2c35('0x5')};function emitEvent(_0x2cb627){return function(_0x25bd03,_0x64008f,_0x7243f7){UserVoiceQueueRtEvents[_0x2c35('0x6')](_0x2cb627+':'+_0x25bd03['id'],_0x25bd03);UserVoiceQueueRtEvents[_0x2c35('0x6')](_0x2cb627,_0x25bd03);_0x7243f7(null);};}for(var e in events){if(events[_0x2c35('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x2c35('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x07ee=['exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove','emit','hook'];(function(_0x3c08ea,_0x419b25){var _0x4b6e51=function(_0x4e53b3){while(--_0x4e53b3){_0x3c08ea['push'](_0x3c08ea['shift']());}};_0x4b6e51(++_0x419b25);}(_0x07ee,0x1cc));var _0xe07e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x07ee[_0x9aada2];return _0x196dff;};'use strict';var EventEmitter=require(_0xe07e('0x0'));var UserVoiceQueueRt=require(_0xe07e('0x1'))['db'][_0xe07e('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xe07e('0x3')](0x0);var events={'afterCreate':_0xe07e('0x4'),'afterUpdate':'update','afterDestroy':_0xe07e('0x5')};function emitEvent(_0x57bc32){return function(_0x182fba,_0x2cb29d,_0x133657){UserVoiceQueueRtEvents[_0xe07e('0x6')](_0x57bc32+':'+_0x182fba['id'],_0x182fba);UserVoiceQueueRtEvents[_0xe07e('0x6')](_0x57bc32,_0x182fba);_0x133657(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xe07e('0x7')](e,emitEvent(event));}}module[_0xe07e('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 0492de1..1c296c5 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 _0xdf19=['moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api'];(function(_0x2abb3b,_0x1308b1){var _0x543c74=function(_0x398089){while(--_0x398089){_0x2abb3b['push'](_0x2abb3b['shift']());}};_0x543c74(++_0x1308b1);}(_0xdf19,0x194));var _0x9df1=function(_0x41216a,_0x53e83d){_0x41216a=_0x41216a-0x0;var _0x122cf1=_0xdf19[_0x41216a];return _0x122cf1;};'use strict';var _=require(_0x9df1('0x0'));var util=require(_0x9df1('0x1'));var logger=require('../../config/logger')(_0x9df1('0x2'));var moment=require(_0x9df1('0x3'));var BPromise=require('bluebird');var rp=require(_0x9df1('0x4'));var fs=require('fs');var path=require(_0x9df1('0x5'));var rimraf=require(_0x9df1('0x6'));var config=require(_0x9df1('0x7'));var attributes=require(_0x9df1('0x8'));module['exports']=function(_0x5a8fbe,_0x405e04){return _0x5a8fbe['define'](_0x9df1('0x9'),attributes,{'tableName':_0x9df1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9f9=['bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','moment'];(function(_0x1e1283,_0x5b87cc){var _0x1ba1c7=function(_0x2c1cb7){while(--_0x2c1cb7){_0x1e1283['push'](_0x1e1283['shift']());}};_0x1ba1c7(++_0x5b87cc);}(_0xc9f9,0xbf));var _0x9c9f=function(_0x25cd6b,_0x3d382c){_0x25cd6b=_0x25cd6b-0x0;var _0x6aad99=_0xc9f9[_0x25cd6b];return _0x6aad99;};'use strict';var _=require(_0x9c9f('0x0'));var util=require(_0x9c9f('0x1'));var logger=require('../../config/logger')(_0x9c9f('0x2'));var moment=require(_0x9c9f('0x3'));var BPromise=require(_0x9c9f('0x4'));var rp=require(_0x9c9f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c9f('0x6'));var config=require(_0x9c9f('0x7'));var attributes=require(_0x9c9f('0x8'));module[_0x9c9f('0x9')]=function(_0xb04a9b,_0xed110e){return _0xb04a9b[_0x9c9f('0xa')](_0x9c9f('0xb'),attributes,{'tableName':_0x9c9f('0xc'),'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 916fd2b..1912a8c 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 _0x61fe=['UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UserVoiceQueueRt','options','sequelize','GetVoiceQueueRtPauses','lodash','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x61fe,0x126));var _0xe61f=function(_0x36e786,_0x595d60){_0x36e786=_0x36e786-0x0;var _0x283345=_0x61fe[_0x36e786];return _0x283345;};'use strict';var _=require(_0xe61f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe61f('0x1'));var rs=require(_0xe61f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe61f('0x3'));var config=require(_0xe61f('0x4'));var jayson=require(_0xe61f('0x5'));var client=jayson[_0xe61f('0x6')][_0xe61f('0x7')]({'port':0x232a});config[_0xe61f('0x8')]=_[_0xe61f('0x9')](config[_0xe61f('0x8')],{'host':_0xe61f('0xa'),'port':0x18eb});var socket=require(_0xe61f('0xb'))(new Redis(config[_0xe61f('0x8')]));require(_0xe61f('0xc'))[_0xe61f('0xd')](socket);function respondWithRpcPromise(_0x35b966,_0x4e6c17,_0x23d1e0){return new BPromise(function(_0x5e3bc2,_0x49186e){return client[_0xe61f('0xe')](_0x35b966,_0x23d1e0)[_0xe61f('0xf')](function(_0x293e2e){logger['info'](_0xe61f('0x10'),_0x4e6c17,_0xe61f('0x11'));logger[_0xe61f('0x12')](_0xe61f('0x13'),_0x4e6c17,_0xe61f('0x11'),JSON[_0xe61f('0x14')](_0x293e2e));if(_0x293e2e['error']){if(_0x293e2e[_0xe61f('0x15')][_0xe61f('0x16')]===0x1f4){logger[_0xe61f('0x15')](_0xe61f('0x10'),_0x4e6c17,_0x293e2e[_0xe61f('0x15')][_0xe61f('0x17')]);return _0x49186e(_0x293e2e[_0xe61f('0x15')][_0xe61f('0x17')]);}logger[_0xe61f('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4e6c17,_0x293e2e['error']['message']);return _0x5e3bc2(_0x293e2e[_0xe61f('0x15')][_0xe61f('0x17')]);}else{logger[_0xe61f('0x18')](_0xe61f('0x10'),_0x4e6c17,_0xe61f('0x11'));_0x5e3bc2(_0x293e2e[_0xe61f('0x19')][_0xe61f('0x17')]);}})[_0xe61f('0x1a')](function(_0x231ce5){logger['error'](_0xe61f('0x10'),_0x4e6c17,_0x231ce5);_0x49186e(_0x231ce5);});});}exports['GetVoiceQueueRtPauses']=function(_0x4aeda9){var _0x272447=this;return new Promise(function(_0x3c6b66,_0x3b4afe){return db[_0xe61f('0x1b')]['findAll']({'raw':_0x4aeda9[_0xe61f('0x1c')]?_0x4aeda9[_0xe61f('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4aeda9[_0xe61f('0x1c')]?_0x4aeda9[_0xe61f('0x1c')]['where']||null:null,'attributes':[[db[_0xe61f('0x1d')]['fn']('COUNT',db[_0xe61f('0x1d')]['fn']('IF',db[_0xe61f('0x1d')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0xe61f('0xf')](function(_0x249e61){logger['info'](_0xe61f('0x1e'),_0x4aeda9);logger[_0xe61f('0x12')](_0xe61f('0x1e'),_0x4aeda9,JSON[_0xe61f('0x14')](_0x249e61));_0x3c6b66(_0x249e61);})[_0xe61f('0x1a')](function(_0x21bdec){logger['error'](_0xe61f('0x1e'),_0x21bdec[_0xe61f('0x17')],_0x4aeda9);_0x3b4afe(_0x272447[_0xe61f('0x15')](0x1f4,_0x21bdec[_0xe61f('0x17')]));});});}; \ No newline at end of file +var _0xc34c=['UserVoiceQueueRt','findAll','options','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses'];(function(_0x59f15d,_0x4c68e0){var _0x1092ce=function(_0x4fc44d){while(--_0x4fc44d){_0x59f15d['push'](_0x59f15d['shift']());}};_0x1092ce(++_0x4c68e0);}(_0xc34c,0x1d0));var _0xcc34=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xc34c[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xcc34('0x0'));var util=require(_0xcc34('0x1'));var moment=require(_0xcc34('0x2'));var BPromise=require(_0xcc34('0x3'));var rs=require(_0xcc34('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcc34('0x5'));var logger=require(_0xcc34('0x6'))(_0xcc34('0x7'));var config=require(_0xcc34('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcc34('0x9')]['http']({'port':0x232a});config[_0xcc34('0xa')]=_[_0xcc34('0xb')](config[_0xcc34('0xa')],{'host':_0xcc34('0xc'),'port':0x18eb});var socket=require(_0xcc34('0xd'))(new Redis(config[_0xcc34('0xa')]));require(_0xcc34('0xe'))[_0xcc34('0xf')](socket);function respondWithRpcPromise(_0x27f655,_0x231159,_0xd1fe1f){return new BPromise(function(_0x4de52b,_0x21d9a6){return client[_0xcc34('0x10')](_0x27f655,_0xd1fe1f)[_0xcc34('0x11')](function(_0x43172a){logger[_0xcc34('0x12')](_0xcc34('0x13'),_0x231159,_0xcc34('0x14'));logger[_0xcc34('0x15')](_0xcc34('0x16'),_0x231159,_0xcc34('0x14'),JSON[_0xcc34('0x17')](_0x43172a));if(_0x43172a[_0xcc34('0x18')]){if(_0x43172a[_0xcc34('0x18')][_0xcc34('0x19')]===0x1f4){logger[_0xcc34('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x231159,_0x43172a[_0xcc34('0x18')][_0xcc34('0x1a')]);return _0x21d9a6(_0x43172a[_0xcc34('0x18')][_0xcc34('0x1a')]);}logger[_0xcc34('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x231159,_0x43172a[_0xcc34('0x18')][_0xcc34('0x1a')]);return _0x4de52b(_0x43172a['error'][_0xcc34('0x1a')]);}else{logger[_0xcc34('0x12')](_0xcc34('0x13'),_0x231159,_0xcc34('0x14'));_0x4de52b(_0x43172a[_0xcc34('0x1b')][_0xcc34('0x1a')]);}})[_0xcc34('0x1c')](function(_0x5aaa37){logger['error'](_0xcc34('0x13'),_0x231159,_0x5aaa37);_0x21d9a6(_0x5aaa37);});});}exports[_0xcc34('0x1d')]=function(_0x34df1d){var _0x24912e=this;return new Promise(function(_0x8701d3,_0x3d2876){return db[_0xcc34('0x1e')][_0xcc34('0x1f')]({'raw':_0x34df1d[_0xcc34('0x20')]?_0x34df1d[_0xcc34('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x34df1d[_0xcc34('0x20')]?_0x34df1d['options'][_0xcc34('0x21')]||null:null,'attributes':[[db[_0xcc34('0x22')]['fn']('COUNT',db[_0xcc34('0x22')]['fn']('IF',db[_0xcc34('0x22')][_0xcc34('0x23')](_0xcc34('0x24')))),_0xcc34('0x25')]]})[_0xcc34('0x11')](function(_0x4a8a9c){logger[_0xcc34('0x12')](_0xcc34('0x1d'),_0x34df1d);logger[_0xcc34('0x15')](_0xcc34('0x1d'),_0x34df1d,JSON[_0xcc34('0x17')](_0x4a8a9c));_0x8701d3(_0x4a8a9c);})[_0xcc34('0x1c')](function(_0x5c7806){logger['error'](_0xcc34('0x1d'),_0x5c7806['message'],_0x34df1d);_0x3d2876(_0x24912e['error'](0x1f4,_0x5c7806[_0xcc34('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index f8ed51d..5f1d71e 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 _0x9553=['./userVoiceQueueRt.events','save','remove','emit','register','userVoiceQueueRt:'];(function(_0x206adf,_0x2ba1a3){var _0x171caa=function(_0x43abe7){while(--_0x43abe7){_0x206adf['push'](_0x206adf['shift']());}};_0x171caa(++_0x2ba1a3);}(_0x9553,0x1aa));var _0x3955=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9553[_0x68c979];return _0x4f0001;};'use strict';var UserVoiceQueueRtEvents=require(_0x3955('0x0'));var events=[_0x3955('0x1'),_0x3955('0x2'),'update'];function createListener(_0x351ff0,_0x17e463){return function(_0xd5e4ef){_0x17e463[_0x3955('0x3')](_0x351ff0,_0xd5e4ef);};}function removeListener(_0x407d1b,_0x2acb81){return function(){UserVoiceQueueRtEvents['removeListener'](_0x407d1b,_0x2acb81);};}exports[_0x3955('0x4')]=function(_0x1ab8bf){for(var _0x5215d6=0x0,_0x466583=events['length'];_0x5215d6<_0x466583;_0x5215d6++){var _0x23d91a=events[_0x5215d6];var _0x144b28=createListener(_0x3955('0x5')+_0x23d91a,_0x1ab8bf);UserVoiceQueueRtEvents['on'](_0x23d91a,_0x144b28);}}; \ No newline at end of file +var _0x51de=['emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update'];(function(_0xd0766b,_0x41056e){var _0x347e13=function(_0x100f9d){while(--_0x100f9d){_0xd0766b['push'](_0xd0766b['shift']());}};_0x347e13(++_0x41056e);}(_0x51de,0x1ec));var _0xe51d=function(_0x428885,_0x436a4e){_0x428885=_0x428885-0x0;var _0x53b4f1=_0x51de[_0x428885];return _0x53b4f1;};'use strict';var UserVoiceQueueRtEvents=require(_0xe51d('0x0'));var events=[_0xe51d('0x1'),_0xe51d('0x2'),_0xe51d('0x3')];function createListener(_0x17a3a6,_0x16a49a){return function(_0x5500b5){_0x16a49a[_0xe51d('0x4')](_0x17a3a6,_0x5500b5);};}function removeListener(_0x59afbe,_0x4d6354){return function(){UserVoiceQueueRtEvents[_0xe51d('0x5')](_0x59afbe,_0x4d6354);};}exports['register']=function(_0x32e83a){for(var _0xcea83e=0x0,_0x3dd06a=events[_0xe51d('0x6')];_0xcea83e<_0x3dd06a;_0xcea83e++){var _0x16912b=events[_0xcea83e];var _0x11e93a=createListener(_0xe51d('0x7')+_0x16912b,_0x32e83a);UserVoiceQueueRtEvents['on'](_0x16912b,_0x11e93a);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index bc97b78..069f128 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 _0x91d8=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','express'];(function(_0x32725b,_0x3448dd){var _0xc31196=function(_0x208d28){while(--_0x208d28){_0x32725b['push'](_0x32725b['shift']());}};_0xc31196(++_0x3448dd);}(_0x91d8,0x171));var _0x891d=function(_0x5b4123,_0x269837){_0x5b4123=_0x5b4123-0x0;var _0x5aeab9=_0x91d8[_0x5b4123];return _0x5aeab9;};'use strict';var multer=require(_0x891d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x891d('0x1'));var router=express[_0x891d('0x2')]();var auth=require(_0x891d('0x3'));var interaction=require(_0x891d('0x4'));var config=require(_0x891d('0x5'));module[_0x891d('0x6')]=router; \ No newline at end of file +var _0xee91=['../../components/interaction/service','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x50c109,_0x525133){var _0x55f476=function(_0x5b135b){while(--_0x5b135b){_0x50c109['push'](_0x50c109['shift']());}};_0x55f476(++_0x525133);}(_0xee91,0x1aa));var _0x1ee9=function(_0x1756dd,_0x4670b4){_0x1756dd=_0x1756dd-0x0;var _0x556afb=_0xee91[_0x1756dd];return _0x556afb;};'use strict';var multer=require(_0x1ee9('0x0'));var util=require('util');var path=require(_0x1ee9('0x1'));var timeout=require(_0x1ee9('0x2'));var express=require(_0x1ee9('0x3'));var router=express[_0x1ee9('0x4')]();var auth=require(_0x1ee9('0x5'));var interaction=require(_0x1ee9('0x6'));var config=require('../../config/environment');module[_0x1ee9('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 7908f00..e37c6f2 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 _0xd8b0=['exports','sequelize'];(function(_0x25bbd6,_0x18f6d3){var _0x3a4c78=function(_0x277579){while(--_0x277579){_0x25bbd6['push'](_0x25bbd6['shift']());}};_0x3a4c78(++_0x18f6d3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 4ea2d9d..60497ab 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 _0xf4f4=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x4f7782,_0x175079){_0x4f7782=_0x4f7782-0x0;var _0x21e9aa=_0xf4f4[_0x4f7782];return _0x21e9aa;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var logger=require('../../config/logger')(_0x4f4f('0x2'));var moment=require(_0x4f4f('0x3'));var BPromise=require(_0x4f4f('0x4'));var rp=require(_0x4f4f('0x5'));var fs=require('fs');var path=require(_0x4f4f('0x6'));var rimraf=require('rimraf');var config=require(_0x4f4f('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x4f4f('0x8')]=function(_0x132d5c,_0x20ee6e){return _0x132d5c[_0x4f4f('0x9')](_0x4f4f('0xa'),attributes,{'tableName':_0x4f4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['UserWhatsappQueue','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','define'];(function(_0x325041,_0x22babc){var _0xf71461=function(_0x4a09f6){while(--_0x4a09f6){_0x325041['push'](_0x325041['shift']());}};_0xf71461(++_0x22babc);}(_0xb7e7,0x121));var _0x7b7e=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xb7e7[_0x369151];return _0x4292d5;};'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':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 281879f..a44c53e 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2cfb38,_0x5efb2d){var _0x5d1e0f=function(_0x55cbfe){while(--_0x55cbfe){_0x2cfb38['push'](_0x2cfb38['shift']());}};_0x5d1e0f(++_0x5efb2d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1d3465,_0x489537){var _0x195b26=function(_0x13c105){while(--_0x13c105){_0x1d3465['push'](_0x1d3465['shift']());}};_0x195b26(++_0x489537);}(_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);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 83c0a85..1b8cc61 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 _0x4f21=['Router','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x40629c,_0x42c2be){var _0xf2a912=function(_0x3f6244){while(--_0x3f6244){_0x40629c['push'](_0x40629c['shift']());}};_0xf2a912(++_0x42c2be);}(_0x4f21,0x172));var _0x14f2=function(_0x58319a,_0x145060){_0x58319a=_0x58319a-0x0;var _0x4cf654=_0x4f21[_0x58319a];return _0x4cf654;};'use strict';var multer=require(_0x14f2('0x0'));var util=require(_0x14f2('0x1'));var path=require(_0x14f2('0x2'));var timeout=require(_0x14f2('0x3'));var express=require(_0x14f2('0x4'));var router=express[_0x14f2('0x5')]();var auth=require(_0x14f2('0x6'));var interaction=require(_0x14f2('0x7'));var config=require('../../config/environment');var controller=require(_0x14f2('0x8'));router[_0x14f2('0x9')]('/',auth[_0x14f2('0xa')](),controller[_0x14f2('0xb')]);router['get']('/:id',auth[_0x14f2('0xa')](),controller['show']);router['post']('/',auth[_0x14f2('0xa')](),controller['create']);router['put'](_0x14f2('0xc'),auth[_0x14f2('0xa')](),controller['update']);router[_0x14f2('0xd')]('/:id',auth[_0x14f2('0xa')](),controller['destroy']);module[_0x14f2('0xe')]=router; \ No newline at end of file +var _0xf066=['put','update','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','post'];(function(_0x743141,_0x43b3d8){var _0x812e79=function(_0x3354f4){while(--_0x3354f4){_0x743141['push'](_0x743141['shift']());}};_0x812e79(++_0x43b3d8);}(_0xf066,0xa7));var _0x6f06=function(_0x581d17,_0x951b0a){_0x581d17=_0x581d17-0x0;var _0x2014bb=_0xf066[_0x581d17];return _0x2014bb;};'use strict';var multer=require(_0x6f06('0x0'));var util=require(_0x6f06('0x1'));var path=require('path');var timeout=require(_0x6f06('0x2'));var express=require(_0x6f06('0x3'));var router=express[_0x6f06('0x4')]();var auth=require(_0x6f06('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6f06('0x6'));var controller=require(_0x6f06('0x7'));router[_0x6f06('0x8')]('/',auth[_0x6f06('0x9')](),controller[_0x6f06('0xa')]);router[_0x6f06('0x8')](_0x6f06('0xb'),auth[_0x6f06('0x9')](),controller['show']);router[_0x6f06('0xc')]('/',auth[_0x6f06('0x9')](),controller['create']);router[_0x6f06('0xd')](_0x6f06('0xb'),auth['isAuthenticated'](),controller[_0x6f06('0xe')]);router['delete']('/:id',auth[_0x6f06('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index e3499e4..aefd65c 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 _0x63af=['exports','STRING','sequelize'];(function(_0x285a14,_0x394a27){var _0x3430cc=function(_0x46d2d7){while(--_0x46d2d7){_0x285a14['push'](_0x285a14['shift']());}};_0x3430cc(++_0x394a27);}(_0x63af,0x16d));var _0xf63a=function(_0x24b53b,_0x57c20d){_0x24b53b=_0x24b53b-0x0;var _0x3b5c00=_0x63af[_0x24b53b];return _0x3b5c00;};'use strict';var Sequelize=require(_0xf63a('0x0'));module[_0xf63a('0x1')]={'name':{'type':Sequelize[_0xf63a('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd208=['STRING','name','exports'];(function(_0xfb604a,_0x1c8d8b){var _0x5dd0b9=function(_0x15cb17){while(--_0x15cb17){_0xfb604a['push'](_0xfb604a['shift']());}};_0x5dd0b9(++_0x1c8d8b);}(_0xd208,0xf5));var _0x8d20=function(_0x36b802,_0x106ec7){_0x36b802=_0x36b802-0x0;var _0xf0cd36=_0xd208[_0x36b802];return _0xf0cd36;};'use strict';var Sequelize=require('sequelize');module[_0x8d20('0x0')]={'name':{'type':Sequelize[_0x8d20('0x1')],'unique':_0x8d20('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8d20('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index eaaf068..4346e87 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 _0x47cd=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','then','destroy','get','Variables','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','Variable','includeAll','include','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource'];(function(_0x3cadbd,_0x12bc43){var _0x296da9=function(_0x3b15fc){while(--_0x3b15fc){_0x3cadbd['push'](_0x3cadbd['shift']());}};_0x296da9(++_0x12bc43);}(_0x47cd,0xf7));var _0xd47c=function(_0xeb9550,_0x11e40d){_0xeb9550=_0xeb9550-0x0;var _0x4fa4ad=_0x47cd[_0xeb9550];return _0x4fa4ad;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd47c('0x0'));var zipdir=require(_0xd47c('0x1'));var jsonpatch=require(_0xd47c('0x2'));var rp=require('request-promise');var moment=require(_0xd47c('0x3'));var BPromise=require(_0xd47c('0x4'));var Mustache=require(_0xd47c('0x5'));var util=require('util');var path=require(_0xd47c('0x6'));var sox=require(_0xd47c('0x7'));var csv=require(_0xd47c('0x8'));var ejs=require(_0xd47c('0x9'));var fs=require('fs');var _=require(_0xd47c('0xa'));var squel=require(_0xd47c('0xb'));var crypto=require(_0xd47c('0xc'));var jsforce=require(_0xd47c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd47c('0x8'));var querystring=require(_0xd47c('0xe'));var Papa=require(_0xd47c('0xf'));var Redis=require(_0xd47c('0x10'));var authService=require(_0xd47c('0x11'));var qs=require(_0xd47c('0x12'));var as=require(_0xd47c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd47c('0x14'));var config=require(_0xd47c('0x15'));var db=require(_0xd47c('0x16'))['db'];function respondWithStatusCode(_0x56d5a4,_0x22afc7){_0x22afc7=_0x22afc7||0xcc;return function(_0x122470){if(_0x122470){return _0x56d5a4[_0xd47c('0x17')](_0x22afc7);}return _0x56d5a4[_0xd47c('0x18')](_0x22afc7)[_0xd47c('0x19')]();};}function respondWithResult(_0x232937,_0x311f6a){_0x311f6a=_0x311f6a||0xc8;return function(_0x2ec2f7){if(_0x2ec2f7){return _0x232937[_0xd47c('0x18')](_0x311f6a)[_0xd47c('0x1a')](_0x2ec2f7);}};}function respondWithFilteredResult(_0x4b2203,_0x3caf9d){return function(_0x3430d7){if(_0x3430d7){var _0x4f427d=_0x3430d7['count'],_0x57a35c=_0x3caf9d['offset'],_0x296c43=_0x3caf9d[_0xd47c('0x1b')]+_0x3caf9d['limit'],_0x3389e0;if(_0x296c43>=_0x4f427d){_0x296c43=_0x4f427d;_0x3389e0=0xc8;}else{_0x3389e0=0xce;}_0x4b2203[_0xd47c('0x18')](_0x3389e0);return _0x4b2203[_0xd47c('0x1c')](_0xd47c('0x1d'),_0x57a35c+'-'+_0x296c43+'/'+_0x4f427d)[_0xd47c('0x1a')](_0x3430d7);}return null;};}function patchUpdates(_0x398d2f){return function(_0x153d42){try{jsonpatch[_0xd47c('0x1e')](_0x153d42,_0x398d2f,!![]);}catch(_0x38b9a9){return BPromise['reject'](_0x38b9a9);}return _0x153d42[_0xd47c('0x1f')]();};}function saveUpdates(_0x21b8d0,_0x44d7a4){return function(_0x26aa8c){if(_0x26aa8c){return _0x26aa8c[_0xd47c('0x20')](_0x21b8d0)[_0xd47c('0x21')](function(_0x2015e6){return _0x2015e6;});}return null;};}function removeEntity(_0x3a3329,_0x4b92b9){return function(_0x32cfcf){if(_0x32cfcf){return _0x32cfcf[_0xd47c('0x22')]()[_0xd47c('0x21')](function(){var _0x1de03f=_0x32cfcf[_0xd47c('0x23')]({'plain':!![]});var _0x1dc744=_0xd47c('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x1dc744,'resourceId':_0x1de03f['id']}})[_0xd47c('0x21')](function(){return _0x32cfcf;});})['then'](function(){_0x3a3329[_0xd47c('0x18')](0xcc)[_0xd47c('0x19')]();});}};}function handleEntityNotFound(_0x591f9a,_0x7ec5a2){return function(_0x364c95){if(!_0x364c95){_0x591f9a[_0xd47c('0x17')](0x194);}return _0x364c95;};}function handleError(_0x4166d0,_0x553da3){_0x553da3=_0x553da3||0x1f4;return function(_0x3d07bc){logger[_0xd47c('0x25')](_0x3d07bc[_0xd47c('0x26')]);if(_0x3d07bc[_0xd47c('0x27')]){delete _0x3d07bc['name'];}_0x4166d0[_0xd47c('0x18')](_0x553da3)[_0xd47c('0x28')](_0x3d07bc);};}exports[_0xd47c('0x29')]=function(_0x4e7e13,_0x4e37da){var _0x407817={},_0xd4d5f6={},_0x4d9404={'count':0x0,'rows':[]};var _0x5c6d21=_[_0xd47c('0x2a')](db['Variable'][_0xd47c('0x2b')],function(_0x559b2c){return{'name':_0x559b2c[_0xd47c('0x2c')],'type':_0x559b2c[_0xd47c('0x2d')][_0xd47c('0x2e')]};});_0xd4d5f6[_0xd47c('0x2f')]=_[_0xd47c('0x2a')](_0x5c6d21,'name');_0xd4d5f6['query']=_['keys'](_0x4e7e13[_0xd47c('0x30')]);_0xd4d5f6[_0xd47c('0x31')]=_[_0xd47c('0x32')](_0xd4d5f6[_0xd47c('0x2f')],_0xd4d5f6[_0xd47c('0x30')]);_0x407817['attributes']=_['intersection'](_0xd4d5f6[_0xd47c('0x2f')],qs[_0xd47c('0x33')](_0x4e7e13['query'][_0xd47c('0x33')]));_0x407817[_0xd47c('0x34')]=_0x407817[_0xd47c('0x34')][_0xd47c('0x35')]?_0x407817[_0xd47c('0x34')]:_0xd4d5f6[_0xd47c('0x2f')];if(!_0x4e7e13[_0xd47c('0x30')][_0xd47c('0x36')](_0xd47c('0x37'))){_0x407817[_0xd47c('0x38')]=qs[_0xd47c('0x38')](_0x4e7e13['query'][_0xd47c('0x38')]);_0x407817[_0xd47c('0x1b')]=qs[_0xd47c('0x1b')](_0x4e7e13[_0xd47c('0x30')]['offset']);}_0x407817[_0xd47c('0x39')]=qs['sort'](_0x4e7e13[_0xd47c('0x30')][_0xd47c('0x3a')]);_0x407817[_0xd47c('0x3b')]=qs['filters'](_['pick'](_0x4e7e13[_0xd47c('0x30')],_0xd4d5f6[_0xd47c('0x31')]),_0x5c6d21);if(_0x4e7e13[_0xd47c('0x30')]['filter']){_0x407817[_0xd47c('0x3b')]=_[_0xd47c('0x3c')](_0x407817[_0xd47c('0x3b')],{'$or':_[_0xd47c('0x2a')](_0x5c6d21,function(_0x4080e2){if(_0x4080e2[_0xd47c('0x2d')]!==_0xd47c('0x3d')){var _0x19e6dd={};_0x19e6dd[_0x4080e2[_0xd47c('0x27')]]={'$like':'%'+_0x4e7e13[_0xd47c('0x30')][_0xd47c('0x3e')]+'%'};return _0x19e6dd;}})});}_0x407817=_[_0xd47c('0x3c')]({},_0x407817,_0x4e7e13[_0xd47c('0x3f')]);var _0x2153a1={'where':_0x407817[_0xd47c('0x3b')]};return db[_0xd47c('0x40')]['count'](_0x2153a1)[_0xd47c('0x21')](function(_0x4fffa0){_0x4d9404['count']=_0x4fffa0;if(_0x4e7e13[_0xd47c('0x30')][_0xd47c('0x41')]){_0x407817[_0xd47c('0x42')]=[{'all':!![]}];}return db[_0xd47c('0x40')]['findAll'](_0x407817);})[_0xd47c('0x21')](function(_0x5cc8fe){_0x4d9404[_0xd47c('0x43')]=_0x5cc8fe;return _0x4d9404;})[_0xd47c('0x21')](respondWithFilteredResult(_0x4e37da,_0x407817))[_0xd47c('0x44')](handleError(_0x4e37da,null));};exports[_0xd47c('0x45')]=function(_0x29bc20,_0x4a6786){var _0x24f9d7={'raw':!![],'where':{'id':_0x29bc20[_0xd47c('0x46')]['id']}},_0x5551d9={};_0x5551d9['model']=_['keys'](db[_0xd47c('0x40')][_0xd47c('0x2b')]);_0x5551d9[_0xd47c('0x30')]=_[_0xd47c('0x47')](_0x29bc20['query']);_0x5551d9[_0xd47c('0x31')]=_['intersection'](_0x5551d9[_0xd47c('0x2f')],_0x5551d9[_0xd47c('0x30')]);_0x24f9d7[_0xd47c('0x34')]=_['intersection'](_0x5551d9['model'],qs[_0xd47c('0x33')](_0x29bc20[_0xd47c('0x30')][_0xd47c('0x33')]));_0x24f9d7[_0xd47c('0x34')]=_0x24f9d7[_0xd47c('0x34')][_0xd47c('0x35')]?_0x24f9d7[_0xd47c('0x34')]:_0x5551d9[_0xd47c('0x2f')];if(_0x29bc20[_0xd47c('0x30')][_0xd47c('0x41')]){_0x24f9d7['include']=[{'all':!![]}];}_0x24f9d7=_[_0xd47c('0x3c')]({},_0x24f9d7,_0x29bc20[_0xd47c('0x3f')]);return db[_0xd47c('0x40')][_0xd47c('0x48')](_0x24f9d7)['then'](handleEntityNotFound(_0x4a6786,null))[_0xd47c('0x21')](respondWithResult(_0x4a6786,null))[_0xd47c('0x44')](handleError(_0x4a6786,null));};exports[_0xd47c('0x49')]=function(_0x47ce57,_0x6d387d){return db[_0xd47c('0x40')][_0xd47c('0x49')](_0x47ce57[_0xd47c('0x4a')],{})['then'](function(_0x282a28){var _0x2dd83e=_0x47ce57[_0xd47c('0x4b')][_0xd47c('0x23')]({'plain':!![]});if(!_0x2dd83e)throw new Error(_0xd47c('0x4c'));if(_0x2dd83e[_0xd47c('0x4d')]==='user'){var _0x89a417=_0x282a28['get']({'plain':!![]});var _0x2d5323='Variables';return db['UserProfileSection'][_0xd47c('0x48')]({'where':{'name':_0x2d5323,'userProfileId':_0x2dd83e[_0xd47c('0x4e')]},'raw':!![]})[_0xd47c('0x21')](function(_0x58024a){if(_0x58024a&&_0x58024a[_0xd47c('0x4f')]===0x0){return db[_0xd47c('0x50')][_0xd47c('0x49')]({'name':_0x89a417[_0xd47c('0x27')],'resourceId':_0x89a417['id'],'type':_0x58024a[_0xd47c('0x27')],'sectionId':_0x58024a['id']},{})[_0xd47c('0x21')](function(){return _0x282a28;});}else{return _0x282a28;}})[_0xd47c('0x44')](function(_0x3aee49){logger[_0xd47c('0x25')](_0xd47c('0x51'),_0x3aee49);throw _0x3aee49;});}return _0x282a28;})[_0xd47c('0x21')](respondWithResult(_0x6d387d,0xc9))[_0xd47c('0x44')](handleError(_0x6d387d,null));};exports[_0xd47c('0x20')]=function(_0x422c28,_0x6c90a9){if(_0x422c28[_0xd47c('0x4a')]['id']){delete _0x422c28[_0xd47c('0x4a')]['id'];}return db[_0xd47c('0x40')]['find']({'where':{'id':_0x422c28['params']['id']}})[_0xd47c('0x21')](handleEntityNotFound(_0x6c90a9,null))[_0xd47c('0x21')](saveUpdates(_0x422c28['body'],null))['then'](respondWithResult(_0x6c90a9,null))[_0xd47c('0x44')](handleError(_0x6c90a9,null));};exports[_0xd47c('0x22')]=function(_0x4bc621,_0x5ec17e){return db[_0xd47c('0x40')][_0xd47c('0x48')]({'where':{'id':_0x4bc621[_0xd47c('0x46')]['id']}})[_0xd47c('0x21')](handleEntityNotFound(_0x5ec17e,null))['then'](removeEntity(_0x5ec17e,null))[_0xd47c('0x44')](handleError(_0x5ec17e,null));}; \ No newline at end of file +var _0x668a=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','Content-Range','reject','save','update','then','destroy','get','Variables','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','options','Variable','count','include','rows','catch','show','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','UserProfileResource','params','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware'];(function(_0x400445,_0x337323){var _0x2b7dd7=function(_0x557904){while(--_0x557904){_0x400445['push'](_0x400445['shift']());}};_0x2b7dd7(++_0x337323);}(_0x668a,0x1c0));var _0xa668=function(_0x4fe0ce,_0x57ee13){_0x4fe0ce=_0x4fe0ce-0x0;var _0x51dc3c=_0x668a[_0x4fe0ce];return _0x51dc3c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa668('0x0'));var rimraf=require(_0xa668('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa668('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa668('0x3'));var Mustache=require(_0xa668('0x4'));var util=require(_0xa668('0x5'));var path=require(_0xa668('0x6'));var sox=require(_0xa668('0x7'));var csv=require('to-csv');var ejs=require(_0xa668('0x8'));var fs=require('fs');var _=require(_0xa668('0x9'));var squel=require(_0xa668('0xa'));var crypto=require(_0xa668('0xb'));var jsforce=require(_0xa668('0xc'));var deskjs=require(_0xa668('0xd'));var toCsv=require(_0xa668('0xe'));var querystring=require(_0xa668('0xf'));var Papa=require(_0xa668('0x10'));var Redis=require(_0xa668('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa668('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa668('0x13'));var logger=require(_0xa668('0x14'))(_0xa668('0x15'));var utils=require(_0xa668('0x16'));var config=require(_0xa668('0x17'));var db=require(_0xa668('0x18'))['db'];function respondWithStatusCode(_0x9a4675,_0x177953){_0x177953=_0x177953||0xcc;return function(_0x553eba){if(_0x553eba){return _0x9a4675['sendStatus'](_0x177953);}return _0x9a4675['status'](_0x177953)[_0xa668('0x19')]();};}function respondWithResult(_0x6bdc0c,_0x356bdf){_0x356bdf=_0x356bdf||0xc8;return function(_0x87d1c5){if(_0x87d1c5){return _0x6bdc0c[_0xa668('0x1a')](_0x356bdf)[_0xa668('0x1b')](_0x87d1c5);}};}function respondWithFilteredResult(_0x4c6781,_0xf2a9bb){return function(_0x1a8393){if(_0x1a8393){var _0x52f5a9=_0x1a8393['count'],_0x2cccc2=_0xf2a9bb[_0xa668('0x1c')],_0x54416e=_0xf2a9bb[_0xa668('0x1c')]+_0xf2a9bb[_0xa668('0x1d')],_0x1f22c0;if(_0x54416e>=_0x52f5a9){_0x54416e=_0x52f5a9;_0x1f22c0=0xc8;}else{_0x1f22c0=0xce;}_0x4c6781[_0xa668('0x1a')](_0x1f22c0);return _0x4c6781['set'](_0xa668('0x1e'),_0x2cccc2+'-'+_0x54416e+'/'+_0x52f5a9)['json'](_0x1a8393);}return null;};}function patchUpdates(_0x3e966e){return function(_0xd669a8){try{jsonpatch['apply'](_0xd669a8,_0x3e966e,!![]);}catch(_0x28c514){return BPromise[_0xa668('0x1f')](_0x28c514);}return _0xd669a8[_0xa668('0x20')]();};}function saveUpdates(_0x1153de,_0x3155d6){return function(_0x395e21){if(_0x395e21){return _0x395e21[_0xa668('0x21')](_0x1153de)[_0xa668('0x22')](function(_0x3afafb){return _0x3afafb;});}return null;};}function removeEntity(_0xe808a,_0xcbe877){return function(_0x46078f){if(_0x46078f){return _0x46078f[_0xa668('0x23')]()['then'](function(){var _0x5e4ef=_0x46078f[_0xa668('0x24')]({'plain':!![]});var _0x2d9e15=_0xa668('0x25');return db['UserProfileResource'][_0xa668('0x23')]({'where':{'type':_0x2d9e15,'resourceId':_0x5e4ef['id']}})[_0xa668('0x22')](function(){return _0x46078f;});})['then'](function(){_0xe808a[_0xa668('0x1a')](0xcc)[_0xa668('0x19')]();});}};}function handleEntityNotFound(_0xb81142,_0x53fc70){return function(_0x1cb5ad){if(!_0x1cb5ad){_0xb81142[_0xa668('0x26')](0x194);}return _0x1cb5ad;};}function handleError(_0x5c9b6e,_0x33f65c){_0x33f65c=_0x33f65c||0x1f4;return function(_0x17e36b){logger[_0xa668('0x27')](_0x17e36b[_0xa668('0x28')]);if(_0x17e36b[_0xa668('0x29')]){delete _0x17e36b[_0xa668('0x29')];}_0x5c9b6e[_0xa668('0x1a')](_0x33f65c)[_0xa668('0x2a')](_0x17e36b);};}exports[_0xa668('0x2b')]=function(_0x515888,_0x435534){var _0x55a52f={},_0x4f5a74={},_0x24e758={'count':0x0,'rows':[]};var _0x1133ba=_[_0xa668('0x2c')](db['Variable'][_0xa668('0x2d')],function(_0x176a16){return{'name':_0x176a16[_0xa668('0x2e')],'type':_0x176a16[_0xa668('0x2f')]['key']};});_0x4f5a74[_0xa668('0x30')]=_[_0xa668('0x2c')](_0x1133ba,_0xa668('0x29'));_0x4f5a74[_0xa668('0x31')]=_[_0xa668('0x32')](_0x515888[_0xa668('0x31')]);_0x4f5a74['filters']=_[_0xa668('0x33')](_0x4f5a74['model'],_0x4f5a74['query']);_0x55a52f['attributes']=_['intersection'](_0x4f5a74[_0xa668('0x30')],qs[_0xa668('0x34')](_0x515888[_0xa668('0x31')][_0xa668('0x34')]));_0x55a52f['attributes']=_0x55a52f[_0xa668('0x35')][_0xa668('0x36')]?_0x55a52f['attributes']:_0x4f5a74[_0xa668('0x30')];if(!_0x515888['query'][_0xa668('0x37')]('nolimit')){_0x55a52f[_0xa668('0x1d')]=qs['limit'](_0x515888['query'][_0xa668('0x1d')]);_0x55a52f[_0xa668('0x1c')]=qs[_0xa668('0x1c')](_0x515888[_0xa668('0x31')][_0xa668('0x1c')]);}_0x55a52f['order']=qs[_0xa668('0x38')](_0x515888[_0xa668('0x31')][_0xa668('0x38')]);_0x55a52f[_0xa668('0x39')]=qs[_0xa668('0x3a')](_[_0xa668('0x3b')](_0x515888[_0xa668('0x31')],_0x4f5a74[_0xa668('0x3a')]),_0x1133ba);if(_0x515888['query'][_0xa668('0x3c')]){_0x55a52f[_0xa668('0x39')]=_['merge'](_0x55a52f['where'],{'$or':_['map'](_0x1133ba,function(_0x51dd52){if(_0x51dd52[_0xa668('0x2f')]!==_0xa668('0x3d')){var _0x51fbff={};_0x51fbff[_0x51dd52['name']]={'$like':'%'+_0x515888[_0xa668('0x31')]['filter']+'%'};return _0x51fbff;}})});}_0x55a52f=_['merge']({},_0x55a52f,_0x515888[_0xa668('0x3e')]);var _0xc20ae2={'where':_0x55a52f['where']};return db[_0xa668('0x3f')][_0xa668('0x40')](_0xc20ae2)[_0xa668('0x22')](function(_0x5bcc6f){_0x24e758[_0xa668('0x40')]=_0x5bcc6f;if(_0x515888[_0xa668('0x31')]['includeAll']){_0x55a52f[_0xa668('0x41')]=[{'all':!![]}];}return db[_0xa668('0x3f')]['findAll'](_0x55a52f);})['then'](function(_0x2b5f0f){_0x24e758[_0xa668('0x42')]=_0x2b5f0f;return _0x24e758;})[_0xa668('0x22')](respondWithFilteredResult(_0x435534,_0x55a52f))[_0xa668('0x43')](handleError(_0x435534,null));};exports[_0xa668('0x44')]=function(_0x5782e6,_0x570fe1){var _0x58020c={'raw':!![],'where':{'id':_0x5782e6['params']['id']}},_0xe4b553={};_0xe4b553[_0xa668('0x30')]=_[_0xa668('0x32')](db[_0xa668('0x3f')]['rawAttributes']);_0xe4b553['query']=_[_0xa668('0x32')](_0x5782e6[_0xa668('0x31')]);_0xe4b553[_0xa668('0x3a')]=_['intersection'](_0xe4b553[_0xa668('0x30')],_0xe4b553[_0xa668('0x31')]);_0x58020c[_0xa668('0x35')]=_[_0xa668('0x33')](_0xe4b553[_0xa668('0x30')],qs[_0xa668('0x34')](_0x5782e6[_0xa668('0x31')][_0xa668('0x34')]));_0x58020c['attributes']=_0x58020c[_0xa668('0x35')][_0xa668('0x36')]?_0x58020c[_0xa668('0x35')]:_0xe4b553[_0xa668('0x30')];if(_0x5782e6[_0xa668('0x31')]['includeAll']){_0x58020c[_0xa668('0x41')]=[{'all':!![]}];}_0x58020c=_[_0xa668('0x45')]({},_0x58020c,_0x5782e6[_0xa668('0x3e')]);return db[_0xa668('0x3f')]['find'](_0x58020c)[_0xa668('0x22')](handleEntityNotFound(_0x570fe1,null))[_0xa668('0x22')](respondWithResult(_0x570fe1,null))[_0xa668('0x43')](handleError(_0x570fe1,null));};exports[_0xa668('0x46')]=function(_0x3f483a,_0x32986c){return db['Variable'][_0xa668('0x46')](_0x3f483a[_0xa668('0x47')],{})[_0xa668('0x22')](function(_0x17f030){var _0x21e0f3=_0x3f483a[_0xa668('0x48')][_0xa668('0x24')]({'plain':!![]});if(!_0x21e0f3)throw new Error(_0xa668('0x49'));if(_0x21e0f3['role']===_0xa668('0x48')){var _0x14f710=_0x17f030[_0xa668('0x24')]({'plain':!![]});var _0x5c21ee='Variables';return db['UserProfileSection'][_0xa668('0x4a')]({'where':{'name':_0x5c21ee,'userProfileId':_0x21e0f3[_0xa668('0x4b')]},'raw':!![]})['then'](function(_0x57e671){if(_0x57e671&&_0x57e671['autoAssociation']===0x0){return db[_0xa668('0x4c')][_0xa668('0x46')]({'name':_0x14f710[_0xa668('0x29')],'resourceId':_0x14f710['id'],'type':_0x57e671['name'],'sectionId':_0x57e671['id']},{})['then'](function(){return _0x17f030;});}else{return _0x17f030;}})[_0xa668('0x43')](function(_0x36c75c){logger[_0xa668('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36c75c);throw _0x36c75c;});}return _0x17f030;})[_0xa668('0x22')](respondWithResult(_0x32986c,0xc9))[_0xa668('0x43')](handleError(_0x32986c,null));};exports['update']=function(_0x2c24cb,_0x3e8d13){if(_0x2c24cb[_0xa668('0x47')]['id']){delete _0x2c24cb[_0xa668('0x47')]['id'];}return db[_0xa668('0x3f')][_0xa668('0x4a')]({'where':{'id':_0x2c24cb['params']['id']}})[_0xa668('0x22')](handleEntityNotFound(_0x3e8d13,null))['then'](saveUpdates(_0x2c24cb[_0xa668('0x47')],null))['then'](respondWithResult(_0x3e8d13,null))[_0xa668('0x43')](handleError(_0x3e8d13,null));};exports[_0xa668('0x23')]=function(_0x234afd,_0x405515){return db[_0xa668('0x3f')]['find']({'where':{'id':_0x234afd[_0xa668('0x4d')]['id']}})[_0xa668('0x22')](handleEntityNotFound(_0x405515,null))[_0xa668('0x22')](removeEntity(_0x405515,null))[_0xa668('0x43')](handleError(_0x405515,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index e8b8baf..dc39e8a 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 _0xb315=['Variable','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./variable.attributes','exports','define'];(function(_0x3839a1,_0x34fd95){var _0x5949d2=function(_0x4bf89d){while(--_0x4bf89d){_0x3839a1['push'](_0x3839a1['shift']());}};_0x5949d2(++_0x34fd95);}(_0xb315,0x6f));var _0x5b31=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xb315[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x5b31('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5b31('0x1'));var moment=require(_0x5b31('0x2'));var BPromise=require(_0x5b31('0x3'));var rp=require(_0x5b31('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b31('0x5'));var config=require(_0x5b31('0x6'));var attributes=require(_0x5b31('0x7'));module[_0x5b31('0x8')]=function(_0x4d95c5,_0x3b7eac){return _0x4d95c5[_0x5b31('0x9')](_0x5b31('0xa'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','Variable','tools_variables','lodash'];(function(_0x440560,_0xedab4e){var _0x4b773c=function(_0x5c6681){while(--_0x5c6681){_0x440560['push'](_0x440560['shift']());}};_0x4b773c(++_0xedab4e);}(_0xaa88,0x137));var _0x8aa8=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0xaa88[_0x559a80];return _0x42f555;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 1026a50..fa12c08 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 _0x3378=['ShowVariable','Variable','find','options','raw','where','map','include','model','attributes','then','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0xb34efd,_0x4237da){var _0x1a8866=function(_0x5ccb9d){while(--_0x5ccb9d){_0xb34efd['push'](_0xb34efd['shift']());}};_0x1a8866(++_0x4237da);}(_0x3378,0x1dc));var _0x8337=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0x3378[_0x310d10];return _0x1fb8af;};'use strict';var _=require(_0x8337('0x0'));var util=require(_0x8337('0x1'));var moment=require(_0x8337('0x2'));var BPromise=require(_0x8337('0x3'));var rs=require(_0x8337('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8337('0x5'));var logger=require('../../config/logger')(_0x8337('0x6'));var config=require(_0x8337('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8337('0x8')][_0x8337('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe43ec6,_0x3c8c0f,_0x30ff73){return new BPromise(function(_0x2d0089,_0x2a2e78){return client['request'](_0xe43ec6,_0x30ff73)['then'](function(_0x2c3861){logger[_0x8337('0xa')](_0x8337('0xb'),_0x3c8c0f,_0x8337('0xc'));logger[_0x8337('0xd')](_0x8337('0xe'),_0x3c8c0f,_0x8337('0xc'),JSON['stringify'](_0x2c3861));if(_0x2c3861[_0x8337('0xf')]){if(_0x2c3861['error'][_0x8337('0x10')]===0x1f4){logger['error'](_0x8337('0xb'),_0x3c8c0f,_0x2c3861['error']['message']);return _0x2a2e78(_0x2c3861[_0x8337('0xf')][_0x8337('0x11')]);}logger[_0x8337('0xf')](_0x8337('0xb'),_0x3c8c0f,_0x2c3861[_0x8337('0xf')][_0x8337('0x11')]);return _0x2d0089(_0x2c3861[_0x8337('0xf')][_0x8337('0x11')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x3c8c0f,_0x8337('0xc'));_0x2d0089(_0x2c3861[_0x8337('0x12')][_0x8337('0x11')]);}})[_0x8337('0x13')](function(_0x43fc68){logger[_0x8337('0xf')](_0x8337('0xb'),_0x3c8c0f,_0x43fc68);_0x2a2e78(_0x43fc68);});});}exports[_0x8337('0x14')]=function(_0x4c83e1){var _0xc8878f=this;return new Promise(function(_0x417a89,_0x34efb6){return db[_0x8337('0x15')][_0x8337('0x16')]({'raw':_0x4c83e1[_0x8337('0x17')]?_0x4c83e1['options'][_0x8337('0x18')]===undefined?!![]:![]:!![],'where':_0x4c83e1[_0x8337('0x17')]?_0x4c83e1['options'][_0x8337('0x19')]||null:null,'attributes':_0x4c83e1['options']?_0x4c83e1[_0x8337('0x17')]['attributes']||null:null,'include':_0x4c83e1[_0x8337('0x17')]?_0x4c83e1['options']['include']?_[_0x8337('0x1a')](_0x4c83e1[_0x8337('0x17')][_0x8337('0x1b')],function(_0x56163d){return{'model':db[_0x56163d[_0x8337('0x1c')]],'as':_0x56163d['as'],'attributes':_0x56163d[_0x8337('0x1d')],'include':_0x56163d[_0x8337('0x1b')]?_[_0x8337('0x1a')](_0x56163d['include'],function(_0x27fbeb){return{'model':db[_0x27fbeb[_0x8337('0x1c')]],'as':_0x27fbeb['as'],'attributes':_0x27fbeb['attributes'],'include':_0x27fbeb[_0x8337('0x1b')]?_['map'](_0x27fbeb['include'],function(_0x1c8f41){return{'model':db[_0x1c8f41[_0x8337('0x1c')]],'as':_0x1c8f41['as'],'attributes':_0x1c8f41[_0x8337('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8337('0x1e')](function(_0x3b4466){logger['info']('ShowVariable',_0x4c83e1);logger[_0x8337('0xd')]('ShowVariable',_0x4c83e1,JSON['stringify'](_0x3b4466));_0x417a89(_0x3b4466);})['catch'](function(_0x491eb1){logger['error']('ShowVariable',_0x491eb1[_0x8337('0x11')],_0x4c83e1);_0x34efb6(_0xc8878f[_0x8337('0xf')](0x1f4,_0x491eb1[_0x8337('0x11')]));});});}; \ No newline at end of file +var _0x5ccd=['message','result','ShowVariable','options','raw','where','attributes','include','map','model','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x492cd1,_0x23ac78){var _0x1a2eba=function(_0x479512){while(--_0x479512){_0x492cd1['push'](_0x492cd1['shift']());}};_0x1a2eba(++_0x23ac78);}(_0x5ccd,0x1cc));var _0xd5cc=function(_0x367ac0,_0x5ddbf7){_0x367ac0=_0x367ac0-0x0;var _0x5c6ea7=_0x5ccd[_0x367ac0];return _0x5c6ea7;};'use strict';var _=require(_0xd5cc('0x0'));var util=require(_0xd5cc('0x1'));var moment=require(_0xd5cc('0x2'));var BPromise=require(_0xd5cc('0x3'));var rs=require(_0xd5cc('0x4'));var fs=require('fs');var Redis=require(_0xd5cc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5cc('0x6'));var logger=require(_0xd5cc('0x7'))(_0xd5cc('0x8'));var config=require(_0xd5cc('0x9'));var jayson=require(_0xd5cc('0xa'));var client=jayson[_0xd5cc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49d5e3,_0x1d5eec,_0x453396){return new BPromise(function(_0x1ef15c,_0x14f41e){return client[_0xd5cc('0xc')](_0x49d5e3,_0x453396)['then'](function(_0x4b92be){logger[_0xd5cc('0xd')](_0xd5cc('0xe'),_0x1d5eec,_0xd5cc('0xf'));logger[_0xd5cc('0x10')]('Variable,\x20%s,\x20%s,\x20%s',_0x1d5eec,'request\x20sent',JSON[_0xd5cc('0x11')](_0x4b92be));if(_0x4b92be['error']){if(_0x4b92be[_0xd5cc('0x12')][_0xd5cc('0x13')]===0x1f4){logger[_0xd5cc('0x12')](_0xd5cc('0xe'),_0x1d5eec,_0x4b92be[_0xd5cc('0x12')][_0xd5cc('0x14')]);return _0x14f41e(_0x4b92be[_0xd5cc('0x12')][_0xd5cc('0x14')]);}logger['error'](_0xd5cc('0xe'),_0x1d5eec,_0x4b92be[_0xd5cc('0x12')][_0xd5cc('0x14')]);return _0x1ef15c(_0x4b92be[_0xd5cc('0x12')]['message']);}else{logger['info'](_0xd5cc('0xe'),_0x1d5eec,_0xd5cc('0xf'));_0x1ef15c(_0x4b92be[_0xd5cc('0x15')][_0xd5cc('0x14')]);}})['catch'](function(_0x3e4891){logger[_0xd5cc('0x12')]('Variable,\x20%s,\x20%s',_0x1d5eec,_0x3e4891);_0x14f41e(_0x3e4891);});});}exports[_0xd5cc('0x16')]=function(_0xefdf23){var _0x1403e5=this;return new Promise(function(_0x45a16d,_0x2739a6){return db['Variable']['find']({'raw':_0xefdf23[_0xd5cc('0x17')]?_0xefdf23[_0xd5cc('0x17')][_0xd5cc('0x18')]===undefined?!![]:![]:!![],'where':_0xefdf23[_0xd5cc('0x17')]?_0xefdf23[_0xd5cc('0x17')][_0xd5cc('0x19')]||null:null,'attributes':_0xefdf23[_0xd5cc('0x17')]?_0xefdf23[_0xd5cc('0x17')][_0xd5cc('0x1a')]||null:null,'include':_0xefdf23[_0xd5cc('0x17')]?_0xefdf23[_0xd5cc('0x17')][_0xd5cc('0x1b')]?_[_0xd5cc('0x1c')](_0xefdf23['options'][_0xd5cc('0x1b')],function(_0x1f3c08){return{'model':db[_0x1f3c08[_0xd5cc('0x1d')]],'as':_0x1f3c08['as'],'attributes':_0x1f3c08[_0xd5cc('0x1a')],'include':_0x1f3c08[_0xd5cc('0x1b')]?_[_0xd5cc('0x1c')](_0x1f3c08[_0xd5cc('0x1b')],function(_0x3e2552){return{'model':db[_0x3e2552['model']],'as':_0x3e2552['as'],'attributes':_0x3e2552[_0xd5cc('0x1a')],'include':_0x3e2552[_0xd5cc('0x1b')]?_[_0xd5cc('0x1c')](_0x3e2552['include'],function(_0x353bea){return{'model':db[_0x353bea[_0xd5cc('0x1d')]],'as':_0x353bea['as'],'attributes':_0x353bea[_0xd5cc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd5cc('0x1e')](function(_0x4588ca){logger[_0xd5cc('0xd')](_0xd5cc('0x16'),_0xefdf23);logger[_0xd5cc('0x10')](_0xd5cc('0x16'),_0xefdf23,JSON[_0xd5cc('0x11')](_0x4588ca));_0x45a16d(_0x4588ca);})[_0xd5cc('0x1f')](function(_0x134ae5){logger['error'](_0xd5cc('0x16'),_0x134ae5['message'],_0xefdf23);_0x2739a6(_0x1403e5[_0xd5cc('0x12')](0x1f4,_0x134ae5[_0xd5cc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 36c253c..69c8d78 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 _0x913c=['Router','./version.controller','get','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','/restart','restart','migrations','exports'];(function(_0x494803,_0x41ecb5){var _0x1a23f0=function(_0x5961cd){while(--_0x5961cd){_0x494803['push'](_0x494803['shift']());}};_0x1a23f0(++_0x41ecb5);}(_0x913c,0x1a0));var _0xc913=function(_0x5d4ed5,_0x5f13ac){_0x5d4ed5=_0x5d4ed5-0x0;var _0x501acb=_0x913c[_0x5d4ed5];return _0x501acb;};'use strict';var express=require('express');var router=express[_0xc913('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xc913('0x1'));router[_0xc913('0x2')]('/',controller['index']);router[_0xc913('0x2')](_0xc913('0x3'),auth[_0xc913('0x4')](),auth['canUpdate'](),controller[_0xc913('0x5')]);router['get'](_0xc913('0x6'),auth[_0xc913('0x4')](),auth[_0xc913('0x7')](),controller[_0xc913('0x8')]);router[_0xc913('0x2')]('/pull',auth[_0xc913('0x4')](),auth['canUpdate'](),controller['pull']);router['get'](_0xc913('0x9'),auth[_0xc913('0x4')](),controller[_0xc913('0xa')]);router['get']('/migrations',controller[_0xc913('0xb')]);module[_0xc913('0xc')]=router; \ No newline at end of file +var _0xcd63=['../../components/auth/service','get','index','/fetch','canUpdate','/reset','isAuthenticated','pull','/restart','restart','/migrations','migrations','exports','Router'];(function(_0x147304,_0x515d91){var _0x380ac4=function(_0x495f4d){while(--_0x495f4d){_0x147304['push'](_0x147304['shift']());}};_0x380ac4(++_0x515d91);}(_0xcd63,0x15d));var _0x3cd6=function(_0x44680a,_0x3868e0){_0x44680a=_0x44680a-0x0;var _0x280c47=_0xcd63[_0x44680a];return _0x280c47;};'use strict';var express=require('express');var router=express[_0x3cd6('0x0')]();var auth=require(_0x3cd6('0x1'));var controller=require('./version.controller');router[_0x3cd6('0x2')]('/',controller[_0x3cd6('0x3')]);router[_0x3cd6('0x2')](_0x3cd6('0x4'),auth['isAuthenticated'](),auth[_0x3cd6('0x5')](),controller['fetch']);router[_0x3cd6('0x2')](_0x3cd6('0x6'),auth[_0x3cd6('0x7')](),auth[_0x3cd6('0x5')](),controller['reset']);router[_0x3cd6('0x2')]('/pull',auth[_0x3cd6('0x7')](),auth[_0x3cd6('0x5')](),controller[_0x3cd6('0x8')]);router[_0x3cd6('0x2')](_0x3cd6('0x9'),auth['isAuthenticated'](),controller[_0x3cd6('0xa')]);router['get'](_0x3cd6('0xb'),controller[_0x3cd6('0xc')]);module[_0x3cd6('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 2707714..9a8b1a0 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 _0xf1c6=['restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','replace','.js','length','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','info','git\x20fetch\x20origin\x20master','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production'];(function(_0x34f470,_0x464db5){var _0x3ac6cd=function(_0x4a72be){while(--_0x4a72be){_0x34f470['push'](_0x34f470['shift']());}};_0x3ac6cd(++_0x464db5);}(_0xf1c6,0xf4));var _0x6f1c=function(_0x1da121,_0x1ad9d4){_0x1da121=_0x1da121-0x0;var _0x431234=_0xf1c6[_0x1da121];return _0x431234;};'use strict';var Umzug=require(_0x6f1c('0x0'));var path=require(_0x6f1c('0x1'));var fs=require('fs');var _=require(_0x6f1c('0x2'));var pkginfo=require(_0x6f1c('0x3'))(module,_0x6f1c('0x4'));var compareVersions=require(_0x6f1c('0x5'));var exec=require(_0x6f1c('0x6'))['exec'];var db=require(_0x6f1c('0x7'))['db'];var config=require(_0x6f1c('0x8'));var pm2=require(_0x6f1c('0x9'));var logger=require(_0x6f1c('0xa'))('update');var git=require('simple-git')(config[_0x6f1c('0xb')]);exports[_0x6f1c('0xc')]=function(_0x3f7b30,_0x2efcb5){var _0x10f531={'current':module[_0x6f1c('0xd')]['version'],'phonebar':0x2};if(_0x3f7b30['query']&&_0x3f7b30[_0x6f1c('0xe')][_0x6f1c('0xf')]){return git[_0x6f1c('0x10')]()[_0x6f1c('0x11')](function(_0x1421aa,_0x2e4fa9){_0x10f531['latest']=(_0x1421aa?module[_0x6f1c('0xd')][_0x6f1c('0x4')]:_0x2e4fa9['latest'])||_0x6f1c('0x12');return _0x2efcb5['status'](0xc8)['json'](_0x10f531);});}else{return _0x2efcb5[_0x6f1c('0x13')](0xc8)[_0x6f1c('0x14')](_0x10f531);}};exports['fetch']=function(_0x523066,_0x4026a5){return git['fetch']([_0x6f1c('0x15'),_0x6f1c('0x16')],function(_0x14c412){if(_0x14c412){logger[_0x6f1c('0x17')](_0x14c412);return _0x4026a5[_0x6f1c('0x13')](0x1f4)[_0x6f1c('0x14')](_0x14c412);}logger[_0x6f1c('0x18')]('git\x20fetch');return _0x4026a5[_0x6f1c('0x13')](0xc8)['json']({'output':_0x6f1c('0x19')});});};exports['reset']=function(_0x1d968f,_0x66103a){return git['reset'](['--hard',_0x6f1c('0x1a')],function(_0x842773){if(_0x842773){logger[_0x6f1c('0x17')](_0x842773);return _0x66103a['status'](0x1f4)[_0x6f1c('0x14')](_0x842773);}logger[_0x6f1c('0x18')](_0x6f1c('0x1b'));return _0x66103a['status'](0xc8)[_0x6f1c('0x14')]({'output':_0x6f1c('0x1c')});});};exports[_0x6f1c('0x1d')]=function(_0x539d59,_0x4101ef){exec(_0x6f1c('0x1e'),function(_0x493b44,_0x20fd66,_0x1f7ac2){logger[_0x6f1c('0x18')](_0x20fd66);logger[_0x6f1c('0x18')](_0x1f7ac2);if(_0x493b44){logger['error'](_0x493b44);return _0x4101ef[_0x6f1c('0x13')](0x1f4)[_0x6f1c('0x14')](_0x493b44);}return _0x4101ef[_0x6f1c('0x13')](0xc8)[_0x6f1c('0x14')]({'output':_0x20fd66});});};exports[_0x6f1c('0x1f')]=function(_0x21fdd4,_0x4970bd){return pm2[_0x6f1c('0x1f')](_0x6f1c('0x20'))[_0x6f1c('0x21')](function(_0xf31eeb){logger[_0x6f1c('0x18')]('pm2\x20restart\x20motion\x20%s',_0xf31eeb);return _0x4970bd[_0x6f1c('0x13')](0xc8)[_0x6f1c('0x14')]({'output':_0x6f1c('0x22')});})[_0x6f1c('0x23')](function(_0x31e829){logger[_0x6f1c('0x17')](_0x31e829);return _0x4970bd['status'](0x1f4)['json'](_0x31e829);});};exports[_0x6f1c('0x24')]=function(_0x2b3732,_0x1b5c9a){var _0x5882bc=fs[_0x6f1c('0x25')](path[_0x6f1c('0x26')](config[_0x6f1c('0xb')],_0x6f1c('0x27'),'migrations'));var _0x127b90=[];for(var _0x11f1f6=0x0;_0x11f1f6<_0x5882bc['length'];_0x11f1f6++){var _0x11ac4b=_0x5882bc[_0x11f1f6][_0x6f1c('0x28')](_0x6f1c('0x29'),'');if(compareVersions(module['exports'][_0x6f1c('0x4')],_0x11ac4b)===-0x1){_0x127b90['push'](_0x11ac4b);}}if(_0x127b90[_0x6f1c('0x2a')]){var _0x2ee3e7=_0x127b90[_0x6f1c('0x2b')](compareVersions);var _0x5e6e02=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x6f1c('0x2c')],'modelName':_0x6f1c('0x2c'),'columnName':_0x6f1c('0x4')},'migrations':{'params':[db[_0x6f1c('0x2d')][_0x6f1c('0x2e')](),db[_0x6f1c('0x2d')][_0x6f1c('0x2f')],function(){throw new Error(_0x6f1c('0x30'));}],'path':path[_0x6f1c('0x26')](config[_0x6f1c('0xb')],_0x6f1c('0x27'),_0x6f1c('0x24')),'pattern':/\.js$/}});_0x5e6e02['up']({'migrations':_[_0x6f1c('0x31')](_0x2ee3e7,function(_0x21be55){return _0x21be55+_0x6f1c('0x29');})})['then'](function(){return _0x1b5c9a[_0x6f1c('0x13')](0xc8)[_0x6f1c('0x14')]({'output':_0x6f1c('0x32')+module[_0x6f1c('0xd')]['version']+_0x6f1c('0x33')+_[_0x6f1c('0x34')](_0x2ee3e7),'migrations':_[_0x6f1c('0x26')](_0x2ee3e7)});})[_0x6f1c('0x23')](function(_0x214842){if(_0x214842 instanceof db[_0x6f1c('0x2d')][_0x6f1c('0x35')]){return _0x1b5c9a['status'](0xc8)[_0x6f1c('0x14')]({'output':_0x6f1c('0x36')});}else{return _0x1b5c9a[_0x6f1c('0x13')](0x1f4)[_0x6f1c('0x14')](_0x214842);}});}else{return _0x1b5c9a[_0x6f1c('0x13')](0xc8)[_0x6f1c('0x14')]({'output':_0x6f1c('0x36')});}}; \ No newline at end of file +var _0x8daf=['exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','info','git\x20fetch','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','server','length','replace','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','last','Database\x20already\x20up-to-date','version','compare-versions'];(function(_0x5a9666,_0x30bc94){var _0x28601f=function(_0x52e447){while(--_0x52e447){_0x5a9666['push'](_0x5a9666['shift']());}};_0x28601f(++_0x30bc94);}(_0x8daf,0x15c));var _0xf8da=function(_0x20534c,_0xe46275){_0x20534c=_0x20534c-0x0;var _0x1925cc=_0x8daf[_0x20534c];return _0x1925cc;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0xf8da('0x0'));var compareVersions=require(_0xf8da('0x1'));var exec=require('child_process')[_0xf8da('0x2')];var db=require(_0xf8da('0x3'))['db'];var config=require(_0xf8da('0x4'));var pm2=require(_0xf8da('0x5'));var logger=require(_0xf8da('0x6'))(_0xf8da('0x7'));var git=require(_0xf8da('0x8'))(config[_0xf8da('0x9')]);exports[_0xf8da('0xa')]=function(_0x585e0c,_0x30bc1d){var _0x4bc1e3={'current':module[_0xf8da('0xb')]['version'],'phonebar':0x2};if(_0x585e0c['query']&&_0x585e0c[_0xf8da('0xc')][_0xf8da('0xd')]){return git[_0xf8da('0xe')]()[_0xf8da('0xf')](function(_0x4463eb,_0x398410){_0x4bc1e3[_0xf8da('0xd')]=(_0x4463eb?module[_0xf8da('0xb')]['version']:_0x398410[_0xf8da('0xd')])||_0xf8da('0x10');return _0x30bc1d[_0xf8da('0x11')](0xc8)[_0xf8da('0x12')](_0x4bc1e3);});}else{return _0x30bc1d['status'](0xc8)[_0xf8da('0x12')](_0x4bc1e3);}};exports['fetch']=function(_0xed96b0,_0x1a93ab){return git[_0xf8da('0xe')]([_0xf8da('0x13'),_0xf8da('0x14')],function(_0x4cbfec){if(_0x4cbfec){logger[_0xf8da('0x15')](_0x4cbfec);return _0x1a93ab[_0xf8da('0x11')](0x1f4)[_0xf8da('0x12')](_0x4cbfec);}logger[_0xf8da('0x16')](_0xf8da('0x17'));return _0x1a93ab[_0xf8da('0x11')](0xc8)[_0xf8da('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xf8da('0x18')]=function(_0x4c1ff1,_0x5dc9db){return git[_0xf8da('0x18')]([_0xf8da('0x19'),'FETCH_HEAD'],function(_0x3e427){if(_0x3e427){logger[_0xf8da('0x15')](_0x3e427);return _0x5dc9db[_0xf8da('0x11')](0x1f4)[_0xf8da('0x12')](_0x3e427);}logger[_0xf8da('0x16')](_0xf8da('0x1a'));return _0x5dc9db[_0xf8da('0x11')](0xc8)[_0xf8da('0x12')]({'output':'git\x20reset\x20--hard'});});};exports[_0xf8da('0x1b')]=function(_0x22adc7,_0x53ad22){exec(_0xf8da('0x1c'),function(_0x5361e7,_0x4ca909,_0x5a295f){logger[_0xf8da('0x16')](_0x4ca909);logger[_0xf8da('0x16')](_0x5a295f);if(_0x5361e7){logger[_0xf8da('0x15')](_0x5361e7);return _0x53ad22[_0xf8da('0x11')](0x1f4)['json'](_0x5361e7);}return _0x53ad22['status'](0xc8)['json']({'output':_0x4ca909});});};exports['restart']=function(_0x2d6dc2,_0x2b513e){return pm2[_0xf8da('0x1d')](_0xf8da('0x1e'))['then'](function(_0x1270d2){logger[_0xf8da('0x16')](_0xf8da('0x1f'),_0x1270d2);return _0x2b513e['status'](0xc8)[_0xf8da('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xf8da('0x20')](function(_0xfe65c0){logger[_0xf8da('0x15')](_0xfe65c0);return _0x2b513e[_0xf8da('0x11')](0x1f4)[_0xf8da('0x12')](_0xfe65c0);});};exports[_0xf8da('0x21')]=function(_0x35544b,_0x424f5d){var _0x51014c=fs[_0xf8da('0x22')](path['join'](config['root'],_0xf8da('0x23'),_0xf8da('0x21')));var _0x16d7e9=[];for(var _0x96c804=0x0;_0x96c804<_0x51014c[_0xf8da('0x24')];_0x96c804++){var _0x587a04=_0x51014c[_0x96c804][_0xf8da('0x25')]('.js','');if(compareVersions(module['exports']['version'],_0x587a04)===-0x1){_0x16d7e9['push'](_0x587a04);}}if(_0x16d7e9['length']){var _0xd1818a=_0x16d7e9['sort'](compareVersions);var _0x3a8917=new Umzug({'storage':_0xf8da('0x26'),'storageOptions':{'model':db[_0xf8da('0x27')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0xf8da('0x26')][_0xf8da('0x28')](),db[_0xf8da('0x26')][_0xf8da('0x29')],function(){throw new Error(_0xf8da('0x2a'));}],'path':path[_0xf8da('0x2b')](config['root'],_0xf8da('0x23'),_0xf8da('0x21')),'pattern':/\.js$/}});_0x3a8917['up']({'migrations':_[_0xf8da('0x2c')](_0xd1818a,function(_0x410904){return _0x410904+_0xf8da('0x2d');})})[_0xf8da('0x2e')](function(){return _0x424f5d['status'](0xc8)[_0xf8da('0x12')]({'output':_0xf8da('0x2f')+module[_0xf8da('0xb')][_0xf8da('0x0')]+'\x20to\x20'+_[_0xf8da('0x30')](_0xd1818a),'migrations':_['join'](_0xd1818a)});})[_0xf8da('0x20')](function(_0x5eafd0){if(_0x5eafd0 instanceof db[_0xf8da('0x26')]['UniqueConstraintError']){return _0x424f5d[_0xf8da('0x11')](0xc8)[_0xf8da('0x12')]({'output':_0xf8da('0x31')});}else{return _0x424f5d[_0xf8da('0x11')](0x1f4)[_0xf8da('0x12')](_0x5eafd0);}});}else{return _0x424f5d[_0xf8da('0x11')](0xc8)['json']({'output':_0xf8da('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 710a301..cca637f 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 _0xa8ad=['put','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','/describe','/:id','show','post','isAuthenticated','create'];(function(_0x8e835a,_0xe19722){var _0x553cdc=function(_0xb0e635){while(--_0xb0e635){_0x8e835a['push'](_0x8e835a['shift']());}};_0x553cdc(++_0xe19722);}(_0xa8ad,0x18f));var _0xda8a=function(_0x56cf0c,_0x14a4b1){_0x56cf0c=_0x56cf0c-0x0;var _0x23a137=_0xa8ad[_0x56cf0c];return _0x23a137;};'use strict';var multer=require(_0xda8a('0x0'));var util=require(_0xda8a('0x1'));var path=require(_0xda8a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xda8a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xda8a('0x4'));var config=require(_0xda8a('0x5'));var controller=require(_0xda8a('0x6'));router[_0xda8a('0x7')]('/',auth['isAuthenticated'](),controller[_0xda8a('0x8')]);router[_0xda8a('0x7')](_0xda8a('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xda8a('0x7')](_0xda8a('0xa'),auth['isAuthenticated'](),controller[_0xda8a('0xb')]);router[_0xda8a('0xc')]('/',auth[_0xda8a('0xd')](),controller[_0xda8a('0xe')]);router[_0xda8a('0xf')](_0xda8a('0xa'),auth[_0xda8a('0xd')](),controller['update']);router[_0xda8a('0x10')](_0xda8a('0xa'),auth[_0xda8a('0xd')](),controller['destroy']);module[_0xda8a('0x11')]=router; \ No newline at end of file +var _0xef4c=['show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x1129d3,_0x10ee1b){var _0x260c28=function(_0x44ef28){while(--_0x44ef28){_0x1129d3['push'](_0x1129d3['shift']());}};_0x260c28(++_0x10ee1b);}(_0xef4c,0x156));var _0xcef4=function(_0x31cda6,_0x1d5b8c){_0x31cda6=_0x31cda6-0x0;var _0x4503d5=_0xef4c[_0x31cda6];return _0x4503d5;};'use strict';var multer=require(_0xcef4('0x0'));var util=require(_0xcef4('0x1'));var path=require(_0xcef4('0x2'));var timeout=require(_0xcef4('0x3'));var express=require(_0xcef4('0x4'));var router=express[_0xcef4('0x5')]();var auth=require(_0xcef4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcef4('0x7'));var controller=require(_0xcef4('0x8'));router[_0xcef4('0x9')]('/',auth['isAuthenticated'](),controller[_0xcef4('0xa')]);router[_0xcef4('0x9')](_0xcef4('0xb'),auth[_0xcef4('0xc')](),controller[_0xcef4('0xd')]);router[_0xcef4('0x9')](_0xcef4('0xe'),auth[_0xcef4('0xc')](),controller[_0xcef4('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcef4('0x10')]);router[_0xcef4('0x11')](_0xcef4('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xcef4('0x12')](_0xcef4('0xe'),auth[_0xcef4('0xc')](),controller[_0xcef4('0x13')]);module[_0xcef4('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 1ae77c8..d439ed8 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 _0x5fd1=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x55add1,_0x2219bf){var _0x36a915=function(_0x2dfd9e){while(--_0x2dfd9e){_0x55add1['push'](_0x55add1['shift']());}};_0x36a915(++_0x2219bf);}(_0x5fd1,0x155));var _0x15fd=function(_0x2bcf0c,_0x262cd0){_0x2bcf0c=_0x2bcf0c-0x0;var _0x480d71=_0x5fd1[_0x2bcf0c];return _0x480d71;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'type':{'type':Sequelize[_0x15fd('0x1')]},'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'calleridnum':{'type':Sequelize[_0x15fd('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x15fd('0x1')]},'membername':{'type':Sequelize[_0x15fd('0x1')]},'agentcalledAt':{'type':Sequelize[_0x15fd('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x15fd('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x15fd('0x2')]},'agentdumpAt':{'type':Sequelize[_0x15fd('0x2')]},'holdtime':{'type':Sequelize[_0x15fd('0x3')]},'agentcomplete':{'type':Sequelize[_0x15fd('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x15fd('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x15fd('0x3')]},'agentacw':{'type':Sequelize[_0x15fd('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x15fd('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x15fd('0x1')]},'channelstate':{'type':Sequelize[_0x15fd('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x15fd('0x1')]},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'context':{'type':Sequelize[_0x15fd('0x1')]},'exten':{'type':Sequelize[_0x15fd('0x1')]},'priority':{'type':Sequelize[_0x15fd('0x1')]},'destchannel':{'type':Sequelize[_0x15fd('0x1')]},'destchannelstate':{'type':Sequelize[_0x15fd('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x15fd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x15fd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x15fd('0x1')]},'destaccountcode':{'type':Sequelize[_0x15fd('0x1')]},'destcontext':{'type':Sequelize[_0x15fd('0x1')]},'destexten':{'type':Sequelize[_0x15fd('0x1')]},'destpriority':{'type':Sequelize[_0x15fd('0x1')]},'destuniqueid':{'type':Sequelize[_0x15fd('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x15fd('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x15fd('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x15fd('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x15fd('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5075=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x3cacaa,_0x5f3412){var _0x21e267=function(_0x2e1139){while(--_0x2e1139){_0x3cacaa['push'](_0x3cacaa['shift']());}};_0x21e267(++_0x5f3412);}(_0x5075,0x73));var _0x5507=function(_0x3ba3c0,_0x129464){_0x3ba3c0=_0x3ba3c0-0x0;var _0x574ae9=_0x5075[_0x3ba3c0];return _0x574ae9;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'type':{'type':Sequelize[_0x5507('0x2')]},'uniqueid':{'type':Sequelize[_0x5507('0x2')]},'calleridnum':{'type':Sequelize[_0x5507('0x2')]},'calleridname':{'type':Sequelize[_0x5507('0x2')]},'queue':{'type':Sequelize[_0x5507('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5507('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5507('0x3')]},'agentconnectAt':{'type':Sequelize[_0x5507('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x5507('0x3')]},'holdtime':{'type':Sequelize[_0x5507('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x5507('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x5507('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x5507('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x5507('0x2')]},'lastevent':{'type':Sequelize[_0x5507('0x2')]},'channel':{'type':Sequelize[_0x5507('0x2')]},'channelstate':{'type':Sequelize[_0x5507('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5507('0x2')]},'connectedlinename':{'type':Sequelize[_0x5507('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5507('0x2')]},'context':{'type':Sequelize[_0x5507('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5507('0x2')]},'destchannel':{'type':Sequelize[_0x5507('0x2')]},'destchannelstate':{'type':Sequelize[_0x5507('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x5507('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5507('0x2')]},'destcalleridname':{'type':Sequelize[_0x5507('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x5507('0x2')]},'destlanguage':{'type':Sequelize[_0x5507('0x2')]},'destaccountcode':{'type':Sequelize[_0x5507('0x2')]},'destcontext':{'type':Sequelize[_0x5507('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5507('0x2')]},'destuniqueid':{'type':Sequelize[_0x5507('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x5507('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x5507('0x2')]},'transfer':{'type':Sequelize[_0x5507('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5507('0x2')],'comment':_0x5507('0x6')},'transferexten':{'type':Sequelize[_0x5507('0x2')]},'transferuniqueid':{'type':Sequelize[_0x5507('0x2')]},'agententerreason':{'type':Sequelize[_0x5507('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 d4a073d..2890823 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 _0x7726=['model','map','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','includeAll','include','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','send','index','VoiceAgentReport','rawAttributes','fieldName','key'];(function(_0x2e3010,_0x380080){var _0x21b9c8=function(_0x399190){while(--_0x399190){_0x2e3010['push'](_0x2e3010['shift']());}};_0x21b9c8(++_0x380080);}(_0x7726,0x178));var _0x6772=function(_0x27b691,_0xb101c3){_0x27b691=_0x27b691-0x0;var _0x1b3881=_0x7726[_0x27b691];return _0x1b3881;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6772('0x0'));var rimraf=require(_0x6772('0x1'));var zipdir=require(_0x6772('0x2'));var jsonpatch=require(_0x6772('0x3'));var rp=require('request-promise');var moment=require(_0x6772('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6772('0x5'));var util=require('util');var path=require(_0x6772('0x6'));var sox=require(_0x6772('0x7'));var csv=require(_0x6772('0x8'));var ejs=require(_0x6772('0x9'));var fs=require('fs');var _=require(_0x6772('0xa'));var squel=require(_0x6772('0xb'));var crypto=require(_0x6772('0xc'));var jsforce=require(_0x6772('0xd'));var deskjs=require(_0x6772('0xe'));var toCsv=require(_0x6772('0x8'));var querystring=require('querystring');var Papa=require(_0x6772('0xf'));var Redis=require(_0x6772('0x10'));var authService=require(_0x6772('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6772('0x12'));var hardwareService=require(_0x6772('0x13'));var logger=require(_0x6772('0x14'))(_0x6772('0x15'));var utils=require(_0x6772('0x16'));var config=require(_0x6772('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x455ce5,_0x22f7a8){_0x22f7a8=_0x22f7a8||0xcc;return function(_0x42ac20){if(_0x42ac20){return _0x455ce5[_0x6772('0x18')](_0x22f7a8);}return _0x455ce5['status'](_0x22f7a8)[_0x6772('0x19')]();};}function respondWithResult(_0xae9cb0,_0x16ffff){_0x16ffff=_0x16ffff||0xc8;return function(_0x497c67){if(_0x497c67){return _0xae9cb0[_0x6772('0x1a')](_0x16ffff)[_0x6772('0x1b')](_0x497c67);}};}function respondWithFilteredResult(_0x78b959,_0x15edee){return function(_0x27ffb2){if(_0x27ffb2){var _0x3c1800=_0x27ffb2[_0x6772('0x1c')],_0x91c8cc=_0x15edee[_0x6772('0x1d')],_0x48904f=_0x15edee['offset']+_0x15edee['limit'],_0x3f7e20;if(_0x48904f>=_0x3c1800){_0x48904f=_0x3c1800;_0x3f7e20=0xc8;}else{_0x3f7e20=0xce;}_0x78b959[_0x6772('0x1a')](_0x3f7e20);return _0x78b959[_0x6772('0x1e')](_0x6772('0x1f'),_0x91c8cc+'-'+_0x48904f+'/'+_0x3c1800)[_0x6772('0x1b')](_0x27ffb2);}return null;};}function patchUpdates(_0x2fc30a){return function(_0x5bf475){try{jsonpatch[_0x6772('0x20')](_0x5bf475,_0x2fc30a,!![]);}catch(_0xa6e7e){return BPromise['reject'](_0xa6e7e);}return _0x5bf475['save']();};}function saveUpdates(_0x5c77e1,_0x58ada9){return function(_0x182162){if(_0x182162){return _0x182162[_0x6772('0x21')](_0x5c77e1)[_0x6772('0x22')](function(_0x548402){return _0x548402;});}return null;};}function removeEntity(_0x5071ca,_0x5d1a1e){return function(_0x27800d){if(_0x27800d){return _0x27800d[_0x6772('0x23')]()[_0x6772('0x22')](function(){_0x5071ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x592dfd,_0x160d08){return function(_0x18b417){if(!_0x18b417){_0x592dfd[_0x6772('0x18')](0x194);}return _0x18b417;};}function handleError(_0x176327,_0x339874){_0x339874=_0x339874||0x1f4;return function(_0x1af393){logger[_0x6772('0x24')](_0x1af393[_0x6772('0x25')]);if(_0x1af393['name']){delete _0x1af393['name'];}_0x176327[_0x6772('0x1a')](_0x339874)[_0x6772('0x26')](_0x1af393);};}exports[_0x6772('0x27')]=function(_0x29b7b4,_0x431e53){var _0x32ee60={},_0x382013={},_0x16b396={'count':0x0,'rows':[]};var _0x4f1b3a=_['map'](db[_0x6772('0x28')][_0x6772('0x29')],function(_0x535454){return{'name':_0x535454[_0x6772('0x2a')],'type':_0x535454['type'][_0x6772('0x2b')]};});_0x382013[_0x6772('0x2c')]=_[_0x6772('0x2d')](_0x4f1b3a,_0x6772('0x2e'));_0x382013[_0x6772('0x2f')]=_[_0x6772('0x30')](_0x29b7b4['query']);_0x382013['filters']=_['intersection'](_0x382013[_0x6772('0x2c')],_0x382013[_0x6772('0x2f')]);_0x32ee60[_0x6772('0x31')]=_[_0x6772('0x32')](_0x382013['model'],qs[_0x6772('0x33')](_0x29b7b4['query']['fields']));_0x32ee60[_0x6772('0x31')]=_0x32ee60['attributes'][_0x6772('0x34')]?_0x32ee60[_0x6772('0x31')]:_0x382013[_0x6772('0x2c')];if(!_0x29b7b4[_0x6772('0x2f')][_0x6772('0x35')](_0x6772('0x36'))){_0x32ee60[_0x6772('0x37')]=qs[_0x6772('0x37')](_0x29b7b4[_0x6772('0x2f')]['limit']);_0x32ee60[_0x6772('0x1d')]=qs['offset'](_0x29b7b4['query'][_0x6772('0x1d')]);}_0x32ee60[_0x6772('0x38')]=qs[_0x6772('0x39')](_0x29b7b4[_0x6772('0x2f')][_0x6772('0x39')]);_0x32ee60[_0x6772('0x3a')]=qs[_0x6772('0x3b')](_['pick'](_0x29b7b4['query'],_0x382013[_0x6772('0x3b')]),_0x4f1b3a);if(_0x29b7b4['query'][_0x6772('0x3c')]){_0x32ee60[_0x6772('0x3a')]=_[_0x6772('0x3d')](_0x32ee60['where'],{'$or':_[_0x6772('0x2d')](_0x4f1b3a,function(_0x281636){if(_0x281636['type']!=='VIRTUAL'){var _0xc2754b={};_0xc2754b[_0x281636[_0x6772('0x2e')]]={'$like':'%'+_0x29b7b4[_0x6772('0x2f')][_0x6772('0x3c')]+'%'};return _0xc2754b;}})});}_0x32ee60=_[_0x6772('0x3d')]({},_0x32ee60,_0x29b7b4['options']);var _0xd12bb8={'where':_0x32ee60['where']};return db['VoiceAgentReport'][_0x6772('0x1c')](_0xd12bb8)['then'](function(_0x17a506){_0x16b396[_0x6772('0x1c')]=_0x17a506;if(_0x29b7b4[_0x6772('0x2f')][_0x6772('0x3e')]){_0x32ee60[_0x6772('0x3f')]=[{'all':!![]}];}return db[_0x6772('0x28')]['findAll'](_0x32ee60);})['then'](function(_0x253816){_0x16b396['rows']=_0x253816;return _0x16b396;})[_0x6772('0x22')](respondWithFilteredResult(_0x431e53,_0x32ee60))['catch'](handleError(_0x431e53,null));};exports['show']=function(_0x3d30e8,_0x968af2){var _0x31ce54={'raw':![],'where':{'id':_0x3d30e8[_0x6772('0x40')]['id']}},_0x48edbf={};_0x48edbf[_0x6772('0x2c')]=_[_0x6772('0x30')](db[_0x6772('0x28')]['rawAttributes']);_0x48edbf[_0x6772('0x2f')]=_['keys'](_0x3d30e8['query']);_0x48edbf[_0x6772('0x3b')]=_['intersection'](_0x48edbf[_0x6772('0x2c')],_0x48edbf['query']);_0x31ce54['attributes']=_[_0x6772('0x32')](_0x48edbf[_0x6772('0x2c')],qs[_0x6772('0x33')](_0x3d30e8[_0x6772('0x2f')]['fields']));_0x31ce54[_0x6772('0x31')]=_0x31ce54['attributes'][_0x6772('0x34')]?_0x31ce54[_0x6772('0x31')]:_0x48edbf[_0x6772('0x2c')];if(_0x3d30e8[_0x6772('0x2f')][_0x6772('0x3e')]){_0x31ce54[_0x6772('0x3f')]=[{'all':!![]}];}_0x31ce54=_[_0x6772('0x3d')]({},_0x31ce54,_0x3d30e8['options']);return db[_0x6772('0x28')][_0x6772('0x41')](_0x31ce54)[_0x6772('0x22')](handleEntityNotFound(_0x968af2,null))[_0x6772('0x22')](respondWithResult(_0x968af2,null))[_0x6772('0x42')](handleError(_0x968af2,null));};exports[_0x6772('0x43')]=function(_0x6e0893,_0x3a550e){return db[_0x6772('0x28')][_0x6772('0x43')](_0x6e0893[_0x6772('0x44')],{})[_0x6772('0x22')](respondWithResult(_0x3a550e,0xc9))['catch'](handleError(_0x3a550e,null));};exports[_0x6772('0x21')]=function(_0x4194d2,_0x23ef83){if(_0x4194d2[_0x6772('0x44')]['id']){delete _0x4194d2[_0x6772('0x44')]['id'];}return db[_0x6772('0x28')]['find']({'where':{'id':_0x4194d2[_0x6772('0x40')]['id']}})[_0x6772('0x22')](handleEntityNotFound(_0x23ef83,null))[_0x6772('0x22')](saveUpdates(_0x4194d2[_0x6772('0x44')],null))[_0x6772('0x22')](respondWithResult(_0x23ef83,null))[_0x6772('0x42')](handleError(_0x23ef83,null));};exports['destroy']=function(_0x544701,_0x1a5ec4){return db['VoiceAgentReport'][_0x6772('0x41')]({'where':{'id':_0x544701[_0x6772('0x40')]['id']}})[_0x6772('0x22')](handleEntityNotFound(_0x1a5ec4,null))[_0x6772('0x22')](removeEntity(_0x1a5ec4,null))[_0x6772('0x42')](handleError(_0x1a5ec4,null));};exports['describe']=function(_0x575425,_0x135dd9){return db['VoiceAgentReport'][_0x6772('0x45')]()[_0x6772('0x22')](respondWithResult(_0x135dd9,null))[_0x6772('0x42')](handleError(_0x135dd9,null));}; \ No newline at end of file +var _0xc400=['apply','reject','update','destroy','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceAgentReport','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xc400,0xc8));var _0x0c40=function(_0x14d0e7,_0x46f05f){_0x14d0e7=_0x14d0e7-0x0;var _0x26ff2f=_0xc400[_0x14d0e7];return _0x26ff2f;};'use strict';var pdf=require(_0x0c40('0x0'));var emlformat=require(_0x0c40('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0c40('0x2'));var rp=require(_0x0c40('0x3'));var moment=require(_0x0c40('0x4'));var BPromise=require(_0x0c40('0x5'));var Mustache=require(_0x0c40('0x6'));var util=require('util');var path=require(_0x0c40('0x7'));var sox=require(_0x0c40('0x8'));var csv=require(_0x0c40('0x9'));var ejs=require(_0x0c40('0xa'));var fs=require('fs');var _=require(_0x0c40('0xb'));var squel=require(_0x0c40('0xc'));var crypto=require(_0x0c40('0xd'));var jsforce=require(_0x0c40('0xe'));var deskjs=require(_0x0c40('0xf'));var toCsv=require(_0x0c40('0x9'));var querystring=require(_0x0c40('0x10'));var Papa=require(_0x0c40('0x11'));var Redis=require(_0x0c40('0x12'));var authService=require(_0x0c40('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0c40('0x14'));var hardwareService=require(_0x0c40('0x15'));var logger=require(_0x0c40('0x16'))(_0x0c40('0x17'));var utils=require(_0x0c40('0x18'));var config=require(_0x0c40('0x19'));var db=require(_0x0c40('0x1a'))['db'];function respondWithStatusCode(_0x334ba8,_0x3daf63){_0x3daf63=_0x3daf63||0xcc;return function(_0xd057ae){if(_0xd057ae){return _0x334ba8['sendStatus'](_0x3daf63);}return _0x334ba8[_0x0c40('0x1b')](_0x3daf63)[_0x0c40('0x1c')]();};}function respondWithResult(_0x1d5def,_0x503460){_0x503460=_0x503460||0xc8;return function(_0x1535b6){if(_0x1535b6){return _0x1d5def[_0x0c40('0x1b')](_0x503460)[_0x0c40('0x1d')](_0x1535b6);}};}function respondWithFilteredResult(_0x3d0fc4,_0x6dfd84){return function(_0x2d689b){if(_0x2d689b){var _0x4a8068=_0x2d689b[_0x0c40('0x1e')],_0x51f74a=_0x6dfd84[_0x0c40('0x1f')],_0x1b11be=_0x6dfd84[_0x0c40('0x1f')]+_0x6dfd84[_0x0c40('0x20')],_0x3e6721;if(_0x1b11be>=_0x4a8068){_0x1b11be=_0x4a8068;_0x3e6721=0xc8;}else{_0x3e6721=0xce;}_0x3d0fc4['status'](_0x3e6721);return _0x3d0fc4['set'](_0x0c40('0x21'),_0x51f74a+'-'+_0x1b11be+'/'+_0x4a8068)[_0x0c40('0x1d')](_0x2d689b);}return null;};}function patchUpdates(_0x4ff1af){return function(_0x383963){try{jsonpatch[_0x0c40('0x22')](_0x383963,_0x4ff1af,!![]);}catch(_0x2562f6){return BPromise[_0x0c40('0x23')](_0x2562f6);}return _0x383963['save']();};}function saveUpdates(_0x2a05a0,_0x4d3c69){return function(_0x137377){if(_0x137377){return _0x137377[_0x0c40('0x24')](_0x2a05a0)['then'](function(_0x4a9b1f){return _0x4a9b1f;});}return null;};}function removeEntity(_0x52e490,_0x228d99){return function(_0x14113b){if(_0x14113b){return _0x14113b[_0x0c40('0x25')]()[_0x0c40('0x26')](function(){_0x52e490['status'](0xcc)[_0x0c40('0x1c')]();});}};}function handleEntityNotFound(_0x211ee5,_0x1cdbd8){return function(_0x594c8a){if(!_0x594c8a){_0x211ee5[_0x0c40('0x27')](0x194);}return _0x594c8a;};}function handleError(_0x580431,_0x6a161e){_0x6a161e=_0x6a161e||0x1f4;return function(_0xe8c6a5){logger['error'](_0xe8c6a5[_0x0c40('0x28')]);if(_0xe8c6a5['name']){delete _0xe8c6a5[_0x0c40('0x29')];}_0x580431[_0x0c40('0x1b')](_0x6a161e)[_0x0c40('0x2a')](_0xe8c6a5);};}exports[_0x0c40('0x2b')]=function(_0x595d26,_0x66dc31){var _0x3f7eda={},_0x5a38ad={},_0x348161={'count':0x0,'rows':[]};var _0x217146=_[_0x0c40('0x2c')](db['VoiceAgentReport'][_0x0c40('0x2d')],function(_0x4c4106){return{'name':_0x4c4106[_0x0c40('0x2e')],'type':_0x4c4106[_0x0c40('0x2f')][_0x0c40('0x30')]};});_0x5a38ad[_0x0c40('0x31')]=_['map'](_0x217146,_0x0c40('0x29'));_0x5a38ad['query']=_[_0x0c40('0x32')](_0x595d26['query']);_0x5a38ad[_0x0c40('0x33')]=_['intersection'](_0x5a38ad[_0x0c40('0x31')],_0x5a38ad[_0x0c40('0x34')]);_0x3f7eda[_0x0c40('0x35')]=_[_0x0c40('0x36')](_0x5a38ad[_0x0c40('0x31')],qs[_0x0c40('0x37')](_0x595d26[_0x0c40('0x34')][_0x0c40('0x37')]));_0x3f7eda[_0x0c40('0x35')]=_0x3f7eda[_0x0c40('0x35')][_0x0c40('0x38')]?_0x3f7eda[_0x0c40('0x35')]:_0x5a38ad['model'];if(!_0x595d26[_0x0c40('0x34')]['hasOwnProperty'](_0x0c40('0x39'))){_0x3f7eda[_0x0c40('0x20')]=qs[_0x0c40('0x20')](_0x595d26[_0x0c40('0x34')][_0x0c40('0x20')]);_0x3f7eda[_0x0c40('0x1f')]=qs[_0x0c40('0x1f')](_0x595d26[_0x0c40('0x34')]['offset']);}_0x3f7eda[_0x0c40('0x3a')]=qs[_0x0c40('0x3b')](_0x595d26[_0x0c40('0x34')][_0x0c40('0x3b')]);_0x3f7eda[_0x0c40('0x3c')]=qs[_0x0c40('0x33')](_[_0x0c40('0x3d')](_0x595d26[_0x0c40('0x34')],_0x5a38ad[_0x0c40('0x33')]),_0x217146);if(_0x595d26['query'][_0x0c40('0x3e')]){_0x3f7eda[_0x0c40('0x3c')]=_[_0x0c40('0x3f')](_0x3f7eda[_0x0c40('0x3c')],{'$or':_[_0x0c40('0x2c')](_0x217146,function(_0x3a4522){if(_0x3a4522[_0x0c40('0x2f')]!==_0x0c40('0x40')){var _0x30fba3={};_0x30fba3[_0x3a4522[_0x0c40('0x29')]]={'$like':'%'+_0x595d26[_0x0c40('0x34')]['filter']+'%'};return _0x30fba3;}})});}_0x3f7eda=_[_0x0c40('0x3f')]({},_0x3f7eda,_0x595d26['options']);var _0x457bfc={'where':_0x3f7eda[_0x0c40('0x3c')]};return db[_0x0c40('0x41')][_0x0c40('0x1e')](_0x457bfc)[_0x0c40('0x26')](function(_0x47ea7a){_0x348161[_0x0c40('0x1e')]=_0x47ea7a;if(_0x595d26[_0x0c40('0x34')][_0x0c40('0x42')]){_0x3f7eda['include']=[{'all':!![]}];}return db[_0x0c40('0x41')][_0x0c40('0x43')](_0x3f7eda);})['then'](function(_0x14def7){_0x348161[_0x0c40('0x44')]=_0x14def7;return _0x348161;})[_0x0c40('0x26')](respondWithFilteredResult(_0x66dc31,_0x3f7eda))[_0x0c40('0x45')](handleError(_0x66dc31,null));};exports[_0x0c40('0x46')]=function(_0x32c3de,_0x21d5a6){var _0x6b2441={'raw':![],'where':{'id':_0x32c3de[_0x0c40('0x47')]['id']}},_0x3bf68d={};_0x3bf68d['model']=_[_0x0c40('0x32')](db[_0x0c40('0x41')][_0x0c40('0x2d')]);_0x3bf68d[_0x0c40('0x34')]=_[_0x0c40('0x32')](_0x32c3de['query']);_0x3bf68d[_0x0c40('0x33')]=_[_0x0c40('0x36')](_0x3bf68d['model'],_0x3bf68d[_0x0c40('0x34')]);_0x6b2441['attributes']=_['intersection'](_0x3bf68d[_0x0c40('0x31')],qs[_0x0c40('0x37')](_0x32c3de['query'][_0x0c40('0x37')]));_0x6b2441[_0x0c40('0x35')]=_0x6b2441[_0x0c40('0x35')]['length']?_0x6b2441['attributes']:_0x3bf68d['model'];if(_0x32c3de[_0x0c40('0x34')]['includeAll']){_0x6b2441[_0x0c40('0x48')]=[{'all':!![]}];}_0x6b2441=_[_0x0c40('0x3f')]({},_0x6b2441,_0x32c3de[_0x0c40('0x49')]);return db[_0x0c40('0x41')][_0x0c40('0x4a')](_0x6b2441)[_0x0c40('0x26')](handleEntityNotFound(_0x21d5a6,null))[_0x0c40('0x26')](respondWithResult(_0x21d5a6,null))[_0x0c40('0x45')](handleError(_0x21d5a6,null));};exports[_0x0c40('0x4b')]=function(_0x1c8ccb,_0x107d45){return db[_0x0c40('0x41')][_0x0c40('0x4b')](_0x1c8ccb[_0x0c40('0x4c')],{})[_0x0c40('0x26')](respondWithResult(_0x107d45,0xc9))[_0x0c40('0x45')](handleError(_0x107d45,null));};exports[_0x0c40('0x24')]=function(_0x1861ff,_0x5ad36e){if(_0x1861ff[_0x0c40('0x4c')]['id']){delete _0x1861ff['body']['id'];}return db[_0x0c40('0x41')][_0x0c40('0x4a')]({'where':{'id':_0x1861ff[_0x0c40('0x47')]['id']}})['then'](handleEntityNotFound(_0x5ad36e,null))['then'](saveUpdates(_0x1861ff['body'],null))['then'](respondWithResult(_0x5ad36e,null))[_0x0c40('0x45')](handleError(_0x5ad36e,null));};exports['destroy']=function(_0x400cf7,_0x4ceb4e){return db[_0x0c40('0x41')]['find']({'where':{'id':_0x400cf7[_0x0c40('0x47')]['id']}})[_0x0c40('0x26')](handleEntityNotFound(_0x4ceb4e,null))[_0x0c40('0x26')](removeEntity(_0x4ceb4e,null))[_0x0c40('0x45')](handleError(_0x4ceb4e,null));};exports['describe']=function(_0x9e25f7,_0x42e517){return db['VoiceAgentReport'][_0x0c40('0x4d')]()[_0x0c40('0x26')](respondWithResult(_0x42e517,null))[_0x0c40('0x45')](handleError(_0x42e517,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 6bd0e21..a2e6f5a 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 _0x1f42=['path','rimraf','./voiceAgentReport.attributes','exports','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x404957,_0x5192a4){var _0x4e0365=function(_0x4f6cd7){while(--_0x4f6cd7){_0x404957['push'](_0x404957['shift']());}};_0x4e0365(++_0x5192a4);}(_0x1f42,0xf5));var _0x21f4=function(_0x593f1a,_0x93102f){_0x593f1a=_0x593f1a-0x0;var _0x1c3c27=_0x1f42[_0x593f1a];return _0x1c3c27;};'use strict';var _=require(_0x21f4('0x0'));var util=require(_0x21f4('0x1'));var logger=require(_0x21f4('0x2'))(_0x21f4('0x3'));var moment=require(_0x21f4('0x4'));var BPromise=require(_0x21f4('0x5'));var rp=require(_0x21f4('0x6'));var fs=require('fs');var path=require(_0x21f4('0x7'));var rimraf=require(_0x21f4('0x8'));var config=require('../../config/environment');var attributes=require(_0x21f4('0x9'));module[_0x21f4('0xa')]=function(_0x301480,_0x44bf8c){return _0x301480['define']('VoiceAgentReport',attributes,{'tableName':_0x21f4('0xb'),'paranoid':![],'indexes':[{'fields':[_0x21f4('0xc'),_0x21f4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbba2=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceAgentReport.attributes','VoiceAgentReport','uniqueid','destuniqueid'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xbba2,0x6c));var _0x2bba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbba2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2bba('0x0'));var util=require(_0x2bba('0x1'));var logger=require(_0x2bba('0x2'))(_0x2bba('0x3'));var moment=require(_0x2bba('0x4'));var BPromise=require(_0x2bba('0x5'));var rp=require(_0x2bba('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2bba('0x7'));var config=require('../../config/environment');var attributes=require(_0x2bba('0x8'));module['exports']=function(_0x17f930,_0xb97d6f){return _0x17f930['define'](_0x2bba('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x2bba('0xa'),_0x2bba('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 5cc0580..986b07e 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 _0xb791=['options','attributes','limit','UpdateVoiceAgentReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','create','body','info','CreateVoiceAgentReport','VoiceAgentReport'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0xb791,0x1e4));var _0x1b79=function(_0x212fcc,_0x1a8867){_0x212fcc=_0x212fcc-0x0;var _0x4d8190=_0xb791[_0x212fcc];return _0x4d8190;};'use strict';var _=require(_0x1b79('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1b79('0x1'));var rs=require(_0x1b79('0x2'));var fs=require('fs');var Redis=require(_0x1b79('0x3'));var db=require(_0x1b79('0x4'))['db'];var utils=require(_0x1b79('0x5'));var logger=require(_0x1b79('0x6'))(_0x1b79('0x7'));var config=require(_0x1b79('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1b79('0x9')][_0x1b79('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5bd99,_0x2549b0,_0x3310b5){return new BPromise(function(_0x466dea,_0x26018c){return client[_0x1b79('0xb')](_0xe5bd99,_0x3310b5)[_0x1b79('0xc')](function(_0x58a729){logger['info'](_0x1b79('0xd'),_0x2549b0,_0x1b79('0xe'));logger[_0x1b79('0xf')](_0x1b79('0x10'),_0x2549b0,_0x1b79('0xe'),JSON[_0x1b79('0x11')](_0x58a729));if(_0x58a729['error']){if(_0x58a729['error'][_0x1b79('0x12')]===0x1f4){logger[_0x1b79('0x13')](_0x1b79('0xd'),_0x2549b0,_0x58a729['error'][_0x1b79('0x14')]);return _0x26018c(_0x58a729['error'][_0x1b79('0x14')]);}logger[_0x1b79('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x2549b0,_0x58a729['error'][_0x1b79('0x14')]);return _0x466dea(_0x58a729[_0x1b79('0x13')][_0x1b79('0x14')]);}else{logger['info'](_0x1b79('0xd'),_0x2549b0,_0x1b79('0xe'));_0x466dea(_0x58a729[_0x1b79('0x15')][_0x1b79('0x14')]);}})[_0x1b79('0x16')](function(_0x4076bd){logger[_0x1b79('0x13')](_0x1b79('0xd'),_0x2549b0,_0x4076bd);_0x26018c(_0x4076bd);});});}exports['CreateVoiceAgentReport']=function(_0x42624c){var _0x48a3e6=this;return new Promise(function(_0x3d7fcf,_0x4ae6d4){return db['VoiceAgentReport'][_0x1b79('0x17')](_0x42624c[_0x1b79('0x18')],{'raw':_0x42624c['options']?_0x42624c['options']['raw']===undefined?!![]:![]:!![]})[_0x1b79('0xc')](function(_0x59a901){logger[_0x1b79('0x19')](_0x1b79('0x1a'),_0x42624c);logger[_0x1b79('0xf')](_0x1b79('0x1a'),_0x42624c,JSON['stringify'](_0x59a901));_0x3d7fcf(_0x59a901);})['catch'](function(_0x54887e){logger[_0x1b79('0x13')]('CreateVoiceAgentReport',_0x54887e[_0x1b79('0x14')],_0x42624c);_0x4ae6d4(_0x48a3e6[_0x1b79('0x13')](0x1f4,_0x54887e[_0x1b79('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x5e3b0b){var _0x41f4dc=this;return new Promise(function(_0x11b2fa,_0x5a4e88){return db[_0x1b79('0x1b')]['update'](_0x5e3b0b[_0x1b79('0x18')],{'raw':_0x5e3b0b['options']?_0x5e3b0b[_0x1b79('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e3b0b[_0x1b79('0x1c')]?_0x5e3b0b[_0x1b79('0x1c')]['where']||null:null,'attributes':_0x5e3b0b['options']?_0x5e3b0b[_0x1b79('0x1c')][_0x1b79('0x1d')]||null:null,'limit':_0x5e3b0b[_0x1b79('0x1c')]?_0x5e3b0b[_0x1b79('0x1c')][_0x1b79('0x1e')]||null:null})[_0x1b79('0xc')](function(_0x3339e6){logger[_0x1b79('0x19')](_0x1b79('0x1f'),_0x5e3b0b);logger[_0x1b79('0xf')](_0x1b79('0x1f'),_0x5e3b0b,JSON[_0x1b79('0x11')](_0x3339e6));_0x11b2fa(_0x3339e6);})[_0x1b79('0x16')](function(_0x1e1d51){logger[_0x1b79('0x13')](_0x1b79('0x1f'),_0x1e1d51[_0x1b79('0x14')],_0x5e3b0b);_0x5a4e88(_0x41f4dc[_0x1b79('0x13')](0x1f4,_0x1e1d51[_0x1b79('0x14')]));});});}; \ No newline at end of file +var _0x011d=['VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','then','stringify','update','where','attributes','UpdateVoiceAgentReport','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x36b07a,_0x241934){var _0x3d6c90=function(_0x601d37){while(--_0x601d37){_0x36b07a['push'](_0x36b07a['shift']());}};_0x3d6c90(++_0x241934);}(_0x011d,0x15d));var _0xd011=function(_0x553f95,_0x1bc68c){_0x553f95=_0x553f95-0x0;var _0x4e795c=_0x011d[_0x553f95];return _0x4e795c;};'use strict';var _=require(_0xd011('0x0'));var util=require(_0xd011('0x1'));var moment=require(_0xd011('0x2'));var BPromise=require(_0xd011('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd011('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd011('0x5'));var config=require(_0xd011('0x6'));var jayson=require(_0xd011('0x7'));var client=jayson[_0xd011('0x8')][_0xd011('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f2a99,_0x520ab1,_0x571b26){return new BPromise(function(_0x5599fa,_0x2f3c8f){return client['request'](_0x2f2a99,_0x571b26)['then'](function(_0x88e17d){logger[_0xd011('0xa')](_0xd011('0xb'),_0x520ab1,_0xd011('0xc'));logger[_0xd011('0xd')](_0xd011('0xe'),_0x520ab1,_0xd011('0xc'),JSON['stringify'](_0x88e17d));if(_0x88e17d[_0xd011('0xf')]){if(_0x88e17d['error']['code']===0x1f4){logger[_0xd011('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x520ab1,_0x88e17d['error'][_0xd011('0x10')]);return _0x2f3c8f(_0x88e17d[_0xd011('0xf')]['message']);}logger[_0xd011('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x520ab1,_0x88e17d[_0xd011('0xf')]['message']);return _0x5599fa(_0x88e17d[_0xd011('0xf')][_0xd011('0x10')]);}else{logger[_0xd011('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x520ab1,_0xd011('0xc'));_0x5599fa(_0x88e17d[_0xd011('0x11')][_0xd011('0x10')]);}})[_0xd011('0x12')](function(_0x4403ad){logger[_0xd011('0xf')](_0xd011('0xb'),_0x520ab1,_0x4403ad);_0x2f3c8f(_0x4403ad);});});}exports[_0xd011('0x13')]=function(_0x218abb){var _0x4ef675=this;return new Promise(function(_0x27a645,_0x3be3e1){return db[_0xd011('0x14')]['create'](_0x218abb[_0xd011('0x15')],{'raw':_0x218abb[_0xd011('0x16')]?_0x218abb[_0xd011('0x16')][_0xd011('0x17')]===undefined?!![]:![]:!![]})[_0xd011('0x18')](function(_0x18289b){logger['info'](_0xd011('0x13'),_0x218abb);logger['debug']('CreateVoiceAgentReport',_0x218abb,JSON[_0xd011('0x19')](_0x18289b));_0x27a645(_0x18289b);})[_0xd011('0x12')](function(_0x2aace1){logger[_0xd011('0xf')](_0xd011('0x13'),_0x2aace1[_0xd011('0x10')],_0x218abb);_0x3be3e1(_0x4ef675[_0xd011('0xf')](0x1f4,_0x2aace1[_0xd011('0x10')]));});});};exports['UpdateVoiceAgentReport']=function(_0xb81d4d){var _0x5e8b29=this;return new Promise(function(_0x4754af,_0x4faf63){return db['VoiceAgentReport'][_0xd011('0x1a')](_0xb81d4d[_0xd011('0x15')],{'raw':_0xb81d4d[_0xd011('0x16')]?_0xb81d4d[_0xd011('0x16')][_0xd011('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb81d4d[_0xd011('0x16')]?_0xb81d4d[_0xd011('0x16')][_0xd011('0x1b')]||null:null,'attributes':_0xb81d4d[_0xd011('0x16')]?_0xb81d4d[_0xd011('0x16')][_0xd011('0x1c')]||null:null,'limit':_0xb81d4d['options']?_0xb81d4d[_0xd011('0x16')]['limit']||null:null})[_0xd011('0x18')](function(_0x3d7cc1){logger[_0xd011('0xa')]('UpdateVoiceAgentReport',_0xb81d4d);logger['debug'](_0xd011('0x1d'),_0xb81d4d,JSON['stringify'](_0x3d7cc1));_0x4754af(_0x3d7cc1);})[_0xd011('0x12')](function(_0x54cfda){logger['error']('UpdateVoiceAgentReport',_0x54cfda[_0xd011('0x10')],_0xb81d4d);_0x4faf63(_0x5e8b29['error'](0x1f4,_0x54cfda[_0xd011('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 8350cc9..0a1edb3 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 _0x0f91=['exports','util','path','connect-timeout','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x0f91,0x71));var _0x10f9=function(_0x4336a6,_0xc235ca){_0x4336a6=_0x4336a6-0x0;var _0x4012f3=_0x0f91[_0x4336a6];return _0x4012f3;};'use strict';var multer=require('multer');var util=require(_0x10f9('0x0'));var path=require(_0x10f9('0x1'));var timeout=require(_0x10f9('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x10f9('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceCallReport.controller');router[_0x10f9('0x4')]('/',auth[_0x10f9('0x5')](),controller[_0x10f9('0x6')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x10f9('0x4')](_0x10f9('0x7'),auth[_0x10f9('0x5')](),controller[_0x10f9('0x8')]);router[_0x10f9('0x9')]('/',auth[_0x10f9('0x5')](),controller[_0x10f9('0xa')]);router[_0x10f9('0xb')](_0x10f9('0x7'),auth[_0x10f9('0x5')](),controller[_0x10f9('0xc')]);router[_0x10f9('0xd')](_0x10f9('0x7'),auth[_0x10f9('0x5')](),controller[_0x10f9('0xe')]);module[_0x10f9('0xf')]=router; \ No newline at end of file +var _0x53b4=['../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','/describe','/:id','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x275d85,_0x5a883e){var _0x3cd754=function(_0x209dee){while(--_0x209dee){_0x275d85['push'](_0x275d85['shift']());}};_0x3cd754(++_0x5a883e);}(_0x53b4,0x162));var _0x453b=function(_0x145016,_0x40ba0b){_0x145016=_0x145016-0x0;var _0x4a57e8=_0x53b4[_0x145016];return _0x4a57e8;};'use strict';var multer=require(_0x453b('0x0'));var util=require(_0x453b('0x1'));var path=require(_0x453b('0x2'));var timeout=require('connect-timeout');var express=require(_0x453b('0x3'));var router=express[_0x453b('0x4')]();var auth=require(_0x453b('0x5'));var interaction=require(_0x453b('0x6'));var config=require(_0x453b('0x7'));var controller=require(_0x453b('0x8'));router['get']('/',auth[_0x453b('0x9')](),controller[_0x453b('0xa')]);router[_0x453b('0xb')](_0x453b('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x453b('0xb')](_0x453b('0xd'),auth[_0x453b('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x453b('0xe')]);router[_0x453b('0xf')](_0x453b('0xd'),auth[_0x453b('0x9')](),controller[_0x453b('0x10')]);router[_0x453b('0x11')]('/:id',auth[_0x453b('0x9')](),controller[_0x453b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index ea7fdf0..41f0105 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 _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x569a45,_0x2da15b){var _0x1a5ef8=function(_0x1389b7){while(--_0x1389b7){_0x569a45['push'](_0x569a45['shift']());}};_0x1a5ef8(++_0x2da15b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'uniqueid':{'type':Sequelize[_0x0a9e('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0a9e('0x3'),'outbound',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'))},'tag':{'type':Sequelize[_0x0a9e('0x2')]},'accountcode':{'type':Sequelize[_0x0a9e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x0a9e('0x2')]},'destinationcontext':{'type':Sequelize[_0x0a9e('0x2')]},'callerid':{'type':Sequelize[_0x0a9e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x0a9e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x0a9e('0x7')]},'answertime':{'type':Sequelize[_0x0a9e('0x7')]},'endtime':{'type':Sequelize[_0x0a9e('0x7')]},'duration':{'type':Sequelize[_0x0a9e('0x8')]},'billableseconds':{'type':Sequelize[_0x0a9e('0x8')]},'mohtime':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0a9e('0x2')]},'prefix':{'type':Sequelize[_0x0a9e('0x2')]},'routeid':{'type':Sequelize[_0x0a9e('0x8')]},'sipcallid':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file +var _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x1407d1,_0x4cc88c){var _0x4e6cbe=function(_0x40b958){while(--_0x40b958){_0x1407d1['push'](_0x1407d1['shift']());}};_0x4e6cbe(++_0x4cc88c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'uniqueid':{'type':Sequelize[_0x0a9e('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0a9e('0x3'),'outbound',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'))},'tag':{'type':Sequelize[_0x0a9e('0x2')]},'accountcode':{'type':Sequelize[_0x0a9e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x0a9e('0x2')]},'destinationcontext':{'type':Sequelize[_0x0a9e('0x2')]},'callerid':{'type':Sequelize[_0x0a9e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x0a9e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x0a9e('0x7')]},'answertime':{'type':Sequelize[_0x0a9e('0x7')]},'endtime':{'type':Sequelize[_0x0a9e('0x7')]},'duration':{'type':Sequelize[_0x0a9e('0x8')]},'billableseconds':{'type':Sequelize[_0x0a9e('0x8')]},'mohtime':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0a9e('0x2')]},'prefix':{'type':Sequelize[_0x0a9e('0x2')]},'routeid':{'type':Sequelize[_0x0a9e('0x8')]},'sipcallid':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 74a6dfa..a1a7ac3 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 _0x3a44=['hasOwnProperty','sort','where','pick','filter','merge','map','options','includeAll','alias','User','findAll','catch','show','params','rawAttributes','include','create','body','find','describe','uniqueid','user','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','VoiceCallReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x19d693,_0x16e5d4){var _0x91a067=function(_0x2c73ca){while(--_0x2c73ca){_0x19d693['push'](_0x19d693['shift']());}};_0x91a067(++_0x16e5d4);}(_0x3a44,0x193));var _0x43a4=function(_0x56bea1,_0x5d952c){_0x56bea1=_0x56bea1-0x0;var _0x2ef6df=_0x3a44[_0x56bea1];return _0x2ef6df;};'use strict';var pdf=require(_0x43a4('0x0'));var emlformat=require(_0x43a4('0x1'));var rimraf=require(_0x43a4('0x2'));var zipdir=require(_0x43a4('0x3'));var jsonpatch=require(_0x43a4('0x4'));var rp=require(_0x43a4('0x5'));var moment=require(_0x43a4('0x6'));var BPromise=require(_0x43a4('0x7'));var Mustache=require('mustache');var util=require(_0x43a4('0x8'));var path=require(_0x43a4('0x9'));var sox=require(_0x43a4('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x43a4('0xb'));var squel=require('squel');var crypto=require(_0x43a4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x43a4('0xd'));var toCsv=require(_0x43a4('0xe'));var querystring=require(_0x43a4('0xf'));var Papa=require(_0x43a4('0x10'));var Redis=require('ioredis');var authService=require(_0x43a4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x43a4('0x12'));var hardwareService=require(_0x43a4('0x13'));var logger=require(_0x43a4('0x14'))(_0x43a4('0x15'));var utils=require(_0x43a4('0x16'));var config=require(_0x43a4('0x17'));var db=require(_0x43a4('0x18'))['db'];function respondWithStatusCode(_0x2755cb,_0x577d14){_0x577d14=_0x577d14||0xcc;return function(_0x1104b9){if(_0x1104b9){return _0x2755cb[_0x43a4('0x19')](_0x577d14);}return _0x2755cb[_0x43a4('0x1a')](_0x577d14)[_0x43a4('0x1b')]();};}function respondWithResult(_0x95f046,_0x57e93f){_0x57e93f=_0x57e93f||0xc8;return function(_0x1c6254){if(_0x1c6254){return _0x95f046[_0x43a4('0x1a')](_0x57e93f)[_0x43a4('0x1c')](_0x1c6254);}};}function respondWithFilteredResult(_0x56a014,_0x467e5a){return function(_0x5b2fee){if(_0x5b2fee){var _0x1bf17d=_0x5b2fee[_0x43a4('0x1d')],_0x5e7667=_0x467e5a['offset'],_0x5ab6cc=_0x467e5a[_0x43a4('0x1e')]+_0x467e5a[_0x43a4('0x1f')],_0x2c73a4;if(_0x5ab6cc>=_0x1bf17d){_0x5ab6cc=_0x1bf17d;_0x2c73a4=0xc8;}else{_0x2c73a4=0xce;}_0x56a014[_0x43a4('0x1a')](_0x2c73a4);return _0x56a014['set'](_0x43a4('0x20'),_0x5e7667+'-'+_0x5ab6cc+'/'+_0x1bf17d)[_0x43a4('0x1c')](_0x5b2fee);}return null;};}function patchUpdates(_0x1d5f59){return function(_0x1c35b3){try{jsonpatch[_0x43a4('0x21')](_0x1c35b3,_0x1d5f59,!![]);}catch(_0x138172){return BPromise[_0x43a4('0x22')](_0x138172);}return _0x1c35b3['save']();};}function saveUpdates(_0x54b0c8,_0x479450){return function(_0x4f99bc){if(_0x4f99bc){return _0x4f99bc[_0x43a4('0x23')](_0x54b0c8)[_0x43a4('0x24')](function(_0xdda834){return _0xdda834;});}return null;};}function removeEntity(_0xec277a,_0x3e3afc){return function(_0x41bc9b){if(_0x41bc9b){return _0x41bc9b[_0x43a4('0x25')]()[_0x43a4('0x24')](function(){_0xec277a['status'](0xcc)[_0x43a4('0x1b')]();});}};}function handleEntityNotFound(_0x307081,_0x5dddc2){return function(_0x5832a8){if(!_0x5832a8){_0x307081[_0x43a4('0x19')](0x194);}return _0x5832a8;};}function handleError(_0x4f57d2,_0xbe53b5){_0xbe53b5=_0xbe53b5||0x1f4;return function(_0x1959b4){logger[_0x43a4('0x26')](_0x1959b4[_0x43a4('0x27')]);if(_0x1959b4[_0x43a4('0x28')]){delete _0x1959b4[_0x43a4('0x28')];}_0x4f57d2[_0x43a4('0x1a')](_0xbe53b5)[_0x43a4('0x29')](_0x1959b4);};}exports['index']=function(_0x2bb3ec,_0x226d9b){var _0x5af509={},_0x423685={},_0x47d18b={'count':0x0,'rows':[]};var _0x568176=_['map'](db[_0x43a4('0x2a')]['rawAttributes'],function(_0x417013){return{'name':_0x417013[_0x43a4('0x2b')],'type':_0x417013[_0x43a4('0x2c')][_0x43a4('0x2d')]};});_0x423685[_0x43a4('0x2e')]=_['map'](_0x568176,_0x43a4('0x28'));_0x423685[_0x43a4('0x2f')]=_[_0x43a4('0x30')](_0x2bb3ec[_0x43a4('0x2f')]);_0x423685[_0x43a4('0x31')]=_[_0x43a4('0x32')](_0x423685['model'],_0x423685[_0x43a4('0x2f')]);_0x5af509[_0x43a4('0x33')]=_[_0x43a4('0x32')](_0x423685['model'],qs[_0x43a4('0x34')](_0x2bb3ec[_0x43a4('0x2f')]['fields']));_0x5af509[_0x43a4('0x33')]=_0x5af509['attributes']['length']?_0x5af509[_0x43a4('0x33')]:_0x423685['model'];if(!_0x2bb3ec[_0x43a4('0x2f')][_0x43a4('0x35')]('nolimit')){_0x5af509[_0x43a4('0x1f')]=qs[_0x43a4('0x1f')](_0x2bb3ec[_0x43a4('0x2f')][_0x43a4('0x1f')]);_0x5af509[_0x43a4('0x1e')]=qs[_0x43a4('0x1e')](_0x2bb3ec['query'][_0x43a4('0x1e')]);}_0x5af509['order']=qs[_0x43a4('0x36')](_0x2bb3ec[_0x43a4('0x2f')][_0x43a4('0x36')]);_0x5af509[_0x43a4('0x37')]=qs[_0x43a4('0x31')](_[_0x43a4('0x38')](_0x2bb3ec[_0x43a4('0x2f')],_0x423685[_0x43a4('0x31')]),_0x568176);if(_0x2bb3ec[_0x43a4('0x2f')][_0x43a4('0x39')]){_0x5af509[_0x43a4('0x37')]=_[_0x43a4('0x3a')](_0x5af509[_0x43a4('0x37')],{'$or':_[_0x43a4('0x3b')](_0x568176,function(_0x43dd7b){if(_0x43dd7b['type']!=='VIRTUAL'){var _0x37611a={};_0x37611a[_0x43dd7b[_0x43a4('0x28')]]={'$like':'%'+_0x2bb3ec[_0x43a4('0x2f')][_0x43a4('0x39')]+'%'};return _0x37611a;}})});}_0x5af509=_[_0x43a4('0x3a')]({},_0x5af509,_0x2bb3ec[_0x43a4('0x3c')]);var _0x319153={'where':_0x5af509[_0x43a4('0x37')]};return db[_0x43a4('0x2a')][_0x43a4('0x1d')](_0x319153)[_0x43a4('0x24')](function(_0x5297d3){_0x47d18b[_0x43a4('0x1d')]=_0x5297d3;if(_0x2bb3ec['query'][_0x43a4('0x3d')]){_0x5af509['include']=[{'attributes':['id',_0x43a4('0x28'),'fullname',_0x43a4('0x3e')],'model':db[_0x43a4('0x3f')],'as':'User'}];}return db[_0x43a4('0x2a')][_0x43a4('0x40')](_0x5af509);})[_0x43a4('0x24')](function(_0x3c2f45){_0x47d18b['rows']=_0x3c2f45;return _0x47d18b;})['then'](respondWithFilteredResult(_0x226d9b,_0x5af509))[_0x43a4('0x41')](handleError(_0x226d9b,null));};exports[_0x43a4('0x42')]=function(_0x31471a,_0x13b60f){var _0x422fbd={'raw':!![],'where':{'id':_0x31471a[_0x43a4('0x43')]['id']}},_0x10b27c={};_0x10b27c[_0x43a4('0x2e')]=_[_0x43a4('0x30')](db[_0x43a4('0x2a')][_0x43a4('0x44')]);_0x10b27c[_0x43a4('0x2f')]=_[_0x43a4('0x30')](_0x31471a[_0x43a4('0x2f')]);_0x10b27c['filters']=_['intersection'](_0x10b27c[_0x43a4('0x2e')],_0x10b27c['query']);_0x422fbd[_0x43a4('0x33')]=_[_0x43a4('0x32')](_0x10b27c[_0x43a4('0x2e')],qs[_0x43a4('0x34')](_0x31471a[_0x43a4('0x2f')]['fields']));_0x422fbd[_0x43a4('0x33')]=_0x422fbd[_0x43a4('0x33')]['length']?_0x422fbd[_0x43a4('0x33')]:_0x10b27c[_0x43a4('0x2e')];if(_0x31471a[_0x43a4('0x2f')][_0x43a4('0x3d')]){_0x422fbd[_0x43a4('0x45')]=[{'all':!![]}];}_0x422fbd=_['merge']({},_0x422fbd,_0x31471a[_0x43a4('0x3c')]);return db[_0x43a4('0x2a')]['find'](_0x422fbd)[_0x43a4('0x24')](handleEntityNotFound(_0x13b60f,null))['then'](respondWithResult(_0x13b60f,null))[_0x43a4('0x41')](handleError(_0x13b60f,null));};exports[_0x43a4('0x46')]=function(_0x57f8ca,_0x47fa5f){return db['VoiceCallReport'][_0x43a4('0x46')](_0x57f8ca[_0x43a4('0x47')],{})[_0x43a4('0x24')](respondWithResult(_0x47fa5f,0xc9))['catch'](handleError(_0x47fa5f,null));};exports[_0x43a4('0x25')]=function(_0x2f61d3,_0x4cd527){return db[_0x43a4('0x2a')][_0x43a4('0x48')]({'where':{'id':_0x2f61d3[_0x43a4('0x43')]['id']}})[_0x43a4('0x24')](handleEntityNotFound(_0x4cd527,null))[_0x43a4('0x24')](removeEntity(_0x4cd527,null))[_0x43a4('0x41')](handleError(_0x4cd527,null));};exports[_0x43a4('0x49')]=function(_0x53af7e,_0x2bb8da){return db[_0x43a4('0x2a')][_0x43a4('0x49')]()[_0x43a4('0x24')](respondWithResult(_0x2bb8da,null))['catch'](handleError(_0x2bb8da,null));};exports[_0x43a4('0x23')]=function(_0x50e8f2,_0x2c8d09){if(_0x50e8f2[_0x43a4('0x47')]['uniqueid']){delete _0x50e8f2[_0x43a4('0x47')][_0x43a4('0x4a')];}return db[_0x43a4('0x2a')][_0x43a4('0x48')]({'where':{'uniqueid':_0x50e8f2[_0x43a4('0x43')]['id'],'UserId':{'$or':[null,_0x50e8f2[_0x43a4('0x4b')]['id']]}}})[_0x43a4('0x24')](handleEntityNotFound(_0x2c8d09,null))['then'](saveUpdates(_0x50e8f2[_0x43a4('0x47')],null))[_0x43a4('0x24')](respondWithResult(_0x2c8d09,null))[_0x43a4('0x41')](handleError(_0x2c8d09,null));}; \ No newline at end of file +var _0xc183=['set','reject','save','then','error','stack','name','index','VoiceCallReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','pick','filter','where','merge','type','options','includeAll','include','fullname','alias','User','findAll','catch','show','params','create','body','destroy','describe','update','uniqueid','find','user','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset'];(function(_0x921571,_0x27c278){var _0x46a14f=function(_0x5e8693){while(--_0x5e8693){_0x921571['push'](_0x921571['shift']());}};_0x46a14f(++_0x27c278);}(_0xc183,0x78));var _0x3c18=function(_0x59808a,_0x2ff513){_0x59808a=_0x59808a-0x0;var _0x150196=_0xc183[_0x59808a];return _0x150196;};'use strict';var pdf=require(_0x3c18('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3c18('0x1'));var jsonpatch=require(_0x3c18('0x2'));var rp=require(_0x3c18('0x3'));var moment=require(_0x3c18('0x4'));var BPromise=require(_0x3c18('0x5'));var Mustache=require('mustache');var util=require(_0x3c18('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3c18('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3c18('0x8'));var squel=require(_0x3c18('0x9'));var crypto=require(_0x3c18('0xa'));var jsforce=require(_0x3c18('0xb'));var deskjs=require(_0x3c18('0xc'));var toCsv=require(_0x3c18('0x7'));var querystring=require('querystring');var Papa=require(_0x3c18('0xd'));var Redis=require(_0x3c18('0xe'));var authService=require(_0x3c18('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3c18('0x10'));var hardwareService=require(_0x3c18('0x11'));var logger=require(_0x3c18('0x12'))('api');var utils=require(_0x3c18('0x13'));var config=require('../../config/environment');var db=require(_0x3c18('0x14'))['db'];function respondWithStatusCode(_0x2afddb,_0x800051){_0x800051=_0x800051||0xcc;return function(_0x56f55f){if(_0x56f55f){return _0x2afddb['sendStatus'](_0x800051);}return _0x2afddb[_0x3c18('0x15')](_0x800051)[_0x3c18('0x16')]();};}function respondWithResult(_0x53a268,_0x49388c){_0x49388c=_0x49388c||0xc8;return function(_0x3d368b){if(_0x3d368b){return _0x53a268[_0x3c18('0x15')](_0x49388c)[_0x3c18('0x17')](_0x3d368b);}};}function respondWithFilteredResult(_0x296afd,_0x1163d1){return function(_0x35ba15){if(_0x35ba15){var _0x45e7c7=_0x35ba15[_0x3c18('0x18')],_0x3d5c5=_0x1163d1[_0x3c18('0x19')],_0x5a468a=_0x1163d1[_0x3c18('0x19')]+_0x1163d1['limit'],_0x22ba8f;if(_0x5a468a>=_0x45e7c7){_0x5a468a=_0x45e7c7;_0x22ba8f=0xc8;}else{_0x22ba8f=0xce;}_0x296afd[_0x3c18('0x15')](_0x22ba8f);return _0x296afd[_0x3c18('0x1a')]('Content-Range',_0x3d5c5+'-'+_0x5a468a+'/'+_0x45e7c7)[_0x3c18('0x17')](_0x35ba15);}return null;};}function patchUpdates(_0x5a8543){return function(_0x2695f6){try{jsonpatch['apply'](_0x2695f6,_0x5a8543,!![]);}catch(_0x30035c){return BPromise[_0x3c18('0x1b')](_0x30035c);}return _0x2695f6[_0x3c18('0x1c')]();};}function saveUpdates(_0x56f07c,_0x4d7bb2){return function(_0x41af56){if(_0x41af56){return _0x41af56['update'](_0x56f07c)['then'](function(_0x5724d3){return _0x5724d3;});}return null;};}function removeEntity(_0x3312ec,_0x358418){return function(_0xe06b35){if(_0xe06b35){return _0xe06b35['destroy']()[_0x3c18('0x1d')](function(){_0x3312ec[_0x3c18('0x15')](0xcc)[_0x3c18('0x16')]();});}};}function handleEntityNotFound(_0x16db8e,_0x5a108f){return function(_0x4e9b7f){if(!_0x4e9b7f){_0x16db8e['sendStatus'](0x194);}return _0x4e9b7f;};}function handleError(_0x2b7707,_0x4a676c){_0x4a676c=_0x4a676c||0x1f4;return function(_0x507075){logger[_0x3c18('0x1e')](_0x507075[_0x3c18('0x1f')]);if(_0x507075[_0x3c18('0x20')]){delete _0x507075['name'];}_0x2b7707[_0x3c18('0x15')](_0x4a676c)['send'](_0x507075);};}exports[_0x3c18('0x21')]=function(_0x3ec4a0,_0x526d75){var _0xd6b436={},_0x3db0fd={},_0x240f6f={'count':0x0,'rows':[]};var _0x50a180=_['map'](db[_0x3c18('0x22')][_0x3c18('0x23')],function(_0xaf943f){return{'name':_0xaf943f[_0x3c18('0x24')],'type':_0xaf943f['type'][_0x3c18('0x25')]};});_0x3db0fd[_0x3c18('0x26')]=_[_0x3c18('0x27')](_0x50a180,_0x3c18('0x20'));_0x3db0fd[_0x3c18('0x28')]=_[_0x3c18('0x29')](_0x3ec4a0['query']);_0x3db0fd[_0x3c18('0x2a')]=_[_0x3c18('0x2b')](_0x3db0fd[_0x3c18('0x26')],_0x3db0fd[_0x3c18('0x28')]);_0xd6b436[_0x3c18('0x2c')]=_[_0x3c18('0x2b')](_0x3db0fd[_0x3c18('0x26')],qs[_0x3c18('0x2d')](_0x3ec4a0['query'][_0x3c18('0x2d')]));_0xd6b436[_0x3c18('0x2c')]=_0xd6b436[_0x3c18('0x2c')][_0x3c18('0x2e')]?_0xd6b436['attributes']:_0x3db0fd[_0x3c18('0x26')];if(!_0x3ec4a0[_0x3c18('0x28')][_0x3c18('0x2f')]('nolimit')){_0xd6b436['limit']=qs[_0x3c18('0x30')](_0x3ec4a0['query'][_0x3c18('0x30')]);_0xd6b436['offset']=qs['offset'](_0x3ec4a0[_0x3c18('0x28')][_0x3c18('0x19')]);}_0xd6b436['order']=qs[_0x3c18('0x31')](_0x3ec4a0[_0x3c18('0x28')]['sort']);_0xd6b436['where']=qs['filters'](_[_0x3c18('0x32')](_0x3ec4a0[_0x3c18('0x28')],_0x3db0fd['filters']),_0x50a180);if(_0x3ec4a0[_0x3c18('0x28')][_0x3c18('0x33')]){_0xd6b436[_0x3c18('0x34')]=_[_0x3c18('0x35')](_0xd6b436[_0x3c18('0x34')],{'$or':_['map'](_0x50a180,function(_0x58ecbc){if(_0x58ecbc[_0x3c18('0x36')]!=='VIRTUAL'){var _0x49cedb={};_0x49cedb[_0x58ecbc['name']]={'$like':'%'+_0x3ec4a0['query'][_0x3c18('0x33')]+'%'};return _0x49cedb;}})});}_0xd6b436=_[_0x3c18('0x35')]({},_0xd6b436,_0x3ec4a0[_0x3c18('0x37')]);var _0xfd09b4={'where':_0xd6b436[_0x3c18('0x34')]};return db['VoiceCallReport'][_0x3c18('0x18')](_0xfd09b4)['then'](function(_0x543591){_0x240f6f[_0x3c18('0x18')]=_0x543591;if(_0x3ec4a0[_0x3c18('0x28')][_0x3c18('0x38')]){_0xd6b436[_0x3c18('0x39')]=[{'attributes':['id',_0x3c18('0x20'),_0x3c18('0x3a'),_0x3c18('0x3b')],'model':db[_0x3c18('0x3c')],'as':_0x3c18('0x3c')}];}return db[_0x3c18('0x22')][_0x3c18('0x3d')](_0xd6b436);})[_0x3c18('0x1d')](function(_0x30fa66){_0x240f6f['rows']=_0x30fa66;return _0x240f6f;})[_0x3c18('0x1d')](respondWithFilteredResult(_0x526d75,_0xd6b436))[_0x3c18('0x3e')](handleError(_0x526d75,null));};exports[_0x3c18('0x3f')]=function(_0x57a223,_0x4562e4){var _0x4403f9={'raw':!![],'where':{'id':_0x57a223[_0x3c18('0x40')]['id']}},_0x1f4d8e={};_0x1f4d8e[_0x3c18('0x26')]=_[_0x3c18('0x29')](db[_0x3c18('0x22')][_0x3c18('0x23')]);_0x1f4d8e['query']=_[_0x3c18('0x29')](_0x57a223[_0x3c18('0x28')]);_0x1f4d8e[_0x3c18('0x2a')]=_[_0x3c18('0x2b')](_0x1f4d8e[_0x3c18('0x26')],_0x1f4d8e[_0x3c18('0x28')]);_0x4403f9[_0x3c18('0x2c')]=_['intersection'](_0x1f4d8e[_0x3c18('0x26')],qs[_0x3c18('0x2d')](_0x57a223['query'][_0x3c18('0x2d')]));_0x4403f9[_0x3c18('0x2c')]=_0x4403f9['attributes'][_0x3c18('0x2e')]?_0x4403f9[_0x3c18('0x2c')]:_0x1f4d8e['model'];if(_0x57a223[_0x3c18('0x28')][_0x3c18('0x38')]){_0x4403f9[_0x3c18('0x39')]=[{'all':!![]}];}_0x4403f9=_[_0x3c18('0x35')]({},_0x4403f9,_0x57a223[_0x3c18('0x37')]);return db['VoiceCallReport']['find'](_0x4403f9)[_0x3c18('0x1d')](handleEntityNotFound(_0x4562e4,null))['then'](respondWithResult(_0x4562e4,null))[_0x3c18('0x3e')](handleError(_0x4562e4,null));};exports[_0x3c18('0x41')]=function(_0x5a50a6,_0x5ae450){return db['VoiceCallReport'][_0x3c18('0x41')](_0x5a50a6[_0x3c18('0x42')],{})['then'](respondWithResult(_0x5ae450,0xc9))[_0x3c18('0x3e')](handleError(_0x5ae450,null));};exports[_0x3c18('0x43')]=function(_0x197ecf,_0x11f783){return db[_0x3c18('0x22')]['find']({'where':{'id':_0x197ecf[_0x3c18('0x40')]['id']}})['then'](handleEntityNotFound(_0x11f783,null))[_0x3c18('0x1d')](removeEntity(_0x11f783,null))[_0x3c18('0x3e')](handleError(_0x11f783,null));};exports[_0x3c18('0x44')]=function(_0x3a71fb,_0x3b5f1f){return db[_0x3c18('0x22')]['describe']()['then'](respondWithResult(_0x3b5f1f,null))[_0x3c18('0x3e')](handleError(_0x3b5f1f,null));};exports[_0x3c18('0x45')]=function(_0x532365,_0x2728ca){if(_0x532365['body'][_0x3c18('0x46')]){delete _0x532365[_0x3c18('0x42')][_0x3c18('0x46')];}return db[_0x3c18('0x22')][_0x3c18('0x47')]({'where':{'uniqueid':_0x532365[_0x3c18('0x40')]['id'],'UserId':{'$or':[null,_0x532365[_0x3c18('0x48')]['id']]}}})['then'](handleEntityNotFound(_0x2728ca,null))['then'](saveUpdates(_0x532365[_0x3c18('0x42')],null))[_0x3c18('0x1d')](respondWithResult(_0x2728ca,null))['catch'](handleError(_0x2728ca,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index cfc4bbb..b1612b9 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 _0x5811=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','report_call','util','../../config/logger'];(function(_0x90626,_0x2129be){var _0x170219=function(_0x3d3b10){while(--_0x3d3b10){_0x90626['push'](_0x90626['shift']());}};_0x170219(++_0x2129be);}(_0x5811,0x1d2));var _0x1581=function(_0x12c34e,_0x39287a){_0x12c34e=_0x12c34e-0x0;var _0x244e88=_0x5811[_0x12c34e];return _0x244e88;};'use strict';var _=require('lodash');var util=require(_0x1581('0x0'));var logger=require(_0x1581('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1581('0x2'));var rp=require(_0x1581('0x3'));var fs=require('fs');var path=require(_0x1581('0x4'));var rimraf=require(_0x1581('0x5'));var config=require(_0x1581('0x6'));var attributes=require(_0x1581('0x7'));module['exports']=function(_0x5c69cd,_0x3a3657){return _0x5c69cd['define']('VoiceCallReport',attributes,{'tableName':_0x1581('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e0b=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x57fe56,_0x48b7a7){var _0x2819a2=function(_0x4e6b9e){while(--_0x4e6b9e){_0x57fe56['push'](_0x57fe56['shift']());}};_0x2819a2(++_0x48b7a7);}(_0x3e0b,0x84));var _0xb3e0=function(_0x5e234e,_0x44dce5){_0x5e234e=_0x5e234e-0x0;var _0x3d096a=_0x3e0b[_0x5e234e];return _0x3d096a;};'use strict';var _=require(_0xb3e0('0x0'));var util=require(_0xb3e0('0x1'));var logger=require(_0xb3e0('0x2'))(_0xb3e0('0x3'));var moment=require(_0xb3e0('0x4'));var BPromise=require(_0xb3e0('0x5'));var rp=require(_0xb3e0('0x6'));var fs=require('fs');var path=require(_0xb3e0('0x7'));var rimraf=require(_0xb3e0('0x8'));var config=require(_0xb3e0('0x9'));var attributes=require(_0xb3e0('0xa'));module[_0xb3e0('0xb')]=function(_0x4fadda,_0x969db8){return _0x4fadda[_0xb3e0('0xc')](_0xb3e0('0xd'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index b5fedcb..a638d47 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 _0x03e4=['util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','GetVoiceCallReport','VoiceCallReport','options','where','limit','include','model','attributes','map','catch','CreateVoiceCallReport','body','raw','UpdateVoiceCallReport','update'];(function(_0x5bed3e,_0x5d7006){var _0x209a9a=function(_0x37ba39){while(--_0x37ba39){_0x5bed3e['push'](_0x5bed3e['shift']());}};_0x209a9a(++_0x5d7006);}(_0x03e4,0xee));var _0x403e=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0x03e4[_0x41b0a8];return _0x3a83d4;};'use strict';var _=require('lodash');var util=require(_0x403e('0x0'));var moment=require(_0x403e('0x1'));var BPromise=require('bluebird');var rs=require(_0x403e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x403e('0x3'));var logger=require(_0x403e('0x4'))(_0x403e('0x5'));var config=require(_0x403e('0x6'));var jayson=require(_0x403e('0x7'));var client=jayson['client'][_0x403e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41b08b,_0x4d246e,_0x1e3813){return new BPromise(function(_0x4bc099,_0x2b4e2b){return client['request'](_0x41b08b,_0x1e3813)[_0x403e('0x9')](function(_0xd61121){logger[_0x403e('0xa')](_0x403e('0xb'),_0x4d246e,'request\x20sent');logger[_0x403e('0xc')](_0x403e('0xd'),_0x4d246e,'request\x20sent',JSON[_0x403e('0xe')](_0xd61121));if(_0xd61121['error']){if(_0xd61121['error']['code']===0x1f4){logger['error'](_0x403e('0xb'),_0x4d246e,_0xd61121[_0x403e('0xf')][_0x403e('0x10')]);return _0x2b4e2b(_0xd61121[_0x403e('0xf')][_0x403e('0x10')]);}logger[_0x403e('0xf')](_0x403e('0xb'),_0x4d246e,_0xd61121[_0x403e('0xf')][_0x403e('0x10')]);return _0x4bc099(_0xd61121['error'][_0x403e('0x10')]);}else{logger[_0x403e('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x4d246e,_0x403e('0x11'));_0x4bc099(_0xd61121[_0x403e('0x12')][_0x403e('0x10')]);}})['catch'](function(_0x76889e){logger[_0x403e('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x4d246e,_0x76889e);_0x2b4e2b(_0x76889e);});});}exports[_0x403e('0x13')]=function(_0xef5f81){var _0x15ab73=this;return new Promise(function(_0x1f48c5,_0x5a94e8){return db[_0x403e('0x14')]['findAll']({'raw':_0xef5f81[_0x403e('0x15')]?_0xef5f81[_0x403e('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0xef5f81['options']?_0xef5f81[_0x403e('0x15')][_0x403e('0x16')]||null:null,'attributes':_0xef5f81[_0x403e('0x15')]?_0xef5f81[_0x403e('0x15')]['attributes']||null:null,'limit':_0xef5f81[_0x403e('0x15')]?_0xef5f81['options'][_0x403e('0x17')]||null:null,'include':_0xef5f81[_0x403e('0x15')]?_0xef5f81[_0x403e('0x15')]['include']?_['map'](_0xef5f81[_0x403e('0x15')][_0x403e('0x18')],function(_0x14a9ce){return{'model':db[_0x14a9ce[_0x403e('0x19')]],'as':_0x14a9ce['as'],'attributes':_0x14a9ce[_0x403e('0x1a')],'include':_0x14a9ce[_0x403e('0x18')]?_['map'](_0x14a9ce[_0x403e('0x18')],function(_0x31626f){return{'model':db[_0x31626f[_0x403e('0x19')]],'as':_0x31626f['as'],'attributes':_0x31626f['attributes'],'include':_0x31626f[_0x403e('0x18')]?_[_0x403e('0x1b')](_0x31626f['include'],function(_0x174ec1){return{'model':db[_0x174ec1['model']],'as':_0x174ec1['as'],'attributes':_0x174ec1['attributes']};}):[]};}):[]};}):[]:[]})[_0x403e('0x9')](function(_0x193e0d){logger[_0x403e('0xa')](_0x403e('0x13'),_0xef5f81);logger[_0x403e('0xc')](_0x403e('0x13'),_0xef5f81,JSON['stringify'](_0x193e0d));_0x1f48c5(_0x193e0d);})[_0x403e('0x1c')](function(_0x12787e){logger['error']('GetVoiceCallReport',_0x12787e[_0x403e('0x10')],_0xef5f81);_0x5a94e8(_0x15ab73[_0x403e('0xf')](0x1f4,_0x12787e[_0x403e('0x10')]));});});};exports[_0x403e('0x1d')]=function(_0x2acbfb){var _0x1f7a15=this;return new Promise(function(_0x1be7d6,_0x37588b){return db['VoiceCallReport']['create'](_0x2acbfb[_0x403e('0x1e')],{'raw':_0x2acbfb[_0x403e('0x15')]?_0x2acbfb['options'][_0x403e('0x1f')]===undefined?!![]:![]:!![]})[_0x403e('0x9')](function(_0x4241d6){logger[_0x403e('0xa')]('CreateVoiceCallReport',_0x2acbfb);logger[_0x403e('0xc')](_0x403e('0x1d'),_0x2acbfb,JSON['stringify'](_0x4241d6));_0x1be7d6(_0x4241d6);})[_0x403e('0x1c')](function(_0xa2b6f5){logger[_0x403e('0xf')](_0x403e('0x1d'),_0xa2b6f5['message'],_0x2acbfb);_0x37588b(_0x1f7a15[_0x403e('0xf')](0x1f4,_0xa2b6f5[_0x403e('0x10')]));});});};exports[_0x403e('0x20')]=function(_0x583823){var _0x49554b=this;return new Promise(function(_0x15364d,_0x22310f){return db[_0x403e('0x14')][_0x403e('0x21')](_0x583823[_0x403e('0x1e')],{'raw':_0x583823[_0x403e('0x15')]?_0x583823[_0x403e('0x15')][_0x403e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x583823[_0x403e('0x15')]?_0x583823[_0x403e('0x15')][_0x403e('0x16')]||null:null,'attributes':_0x583823[_0x403e('0x15')]?_0x583823['options'][_0x403e('0x1a')]||null:null,'limit':_0x583823[_0x403e('0x15')]?_0x583823[_0x403e('0x15')][_0x403e('0x17')]||null:null})[_0x403e('0x9')](function(_0x4d29c8){logger[_0x403e('0xa')](_0x403e('0x20'),_0x583823);logger['debug'](_0x403e('0x20'),_0x583823,JSON[_0x403e('0xe')](_0x4d29c8));_0x15364d(_0x4d29c8);})[_0x403e('0x1c')](function(_0x28b18f){logger[_0x403e('0xf')](_0x403e('0x20'),_0x28b18f[_0x403e('0x10')],_0x583823);_0x22310f(_0x49554b[_0x403e('0xf')](0x1f4,_0x28b18f[_0x403e('0x10')]));});});}; \ No newline at end of file +var _0xd9e2=['info','VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceCallReport','options','raw','where','attributes','limit','include','map','model','debug','catch','CreateVoiceCallReport','VoiceCallReport','body','UpdateVoiceCallReport','update','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1a9343,_0x4fea46){var _0x333daa=function(_0x1d1bc6){while(--_0x1d1bc6){_0x1a9343['push'](_0x1a9343['shift']());}};_0x333daa(++_0x4fea46);}(_0xd9e2,0x67));var _0x2d9e=function(_0x3a13fc,_0xe18194){_0x3a13fc=_0x3a13fc-0x0;var _0x84ea87=_0xd9e2[_0x3a13fc];return _0x84ea87;};'use strict';var _=require(_0x2d9e('0x0'));var util=require(_0x2d9e('0x1'));var moment=require(_0x2d9e('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d9e('0x3'));var fs=require('fs');var Redis=require(_0x2d9e('0x4'));var db=require(_0x2d9e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d9e('0x6'))(_0x2d9e('0x7'));var config=require(_0x2d9e('0x8'));var jayson=require(_0x2d9e('0x9'));var client=jayson[_0x2d9e('0xa')][_0x2d9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bc0a0,_0x2065cf,_0x53039f){return new BPromise(function(_0x2c74da,_0x2668b3){return client[_0x2d9e('0xc')](_0x5bc0a0,_0x53039f)[_0x2d9e('0xd')](function(_0x2e6d54){logger[_0x2d9e('0xe')](_0x2d9e('0xf'),_0x2065cf,'request\x20sent');logger['debug'](_0x2d9e('0x10'),_0x2065cf,_0x2d9e('0x11'),JSON[_0x2d9e('0x12')](_0x2e6d54));if(_0x2e6d54[_0x2d9e('0x13')]){if(_0x2e6d54[_0x2d9e('0x13')][_0x2d9e('0x14')]===0x1f4){logger[_0x2d9e('0x13')](_0x2d9e('0xf'),_0x2065cf,_0x2e6d54['error']['message']);return _0x2668b3(_0x2e6d54['error']['message']);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x2065cf,_0x2e6d54[_0x2d9e('0x13')][_0x2d9e('0x15')]);return _0x2c74da(_0x2e6d54['error']['message']);}else{logger[_0x2d9e('0xe')](_0x2d9e('0xf'),_0x2065cf,_0x2d9e('0x11'));_0x2c74da(_0x2e6d54[_0x2d9e('0x16')][_0x2d9e('0x15')]);}})['catch'](function(_0x2abdfd){logger[_0x2d9e('0x13')](_0x2d9e('0xf'),_0x2065cf,_0x2abdfd);_0x2668b3(_0x2abdfd);});});}exports[_0x2d9e('0x17')]=function(_0x4944e7){var _0x141184=this;return new Promise(function(_0x2b008f,_0x475bca){return db['VoiceCallReport']['findAll']({'raw':_0x4944e7[_0x2d9e('0x18')]?_0x4944e7[_0x2d9e('0x18')][_0x2d9e('0x19')]===undefined?!![]:![]:!![],'where':_0x4944e7[_0x2d9e('0x18')]?_0x4944e7[_0x2d9e('0x18')][_0x2d9e('0x1a')]||null:null,'attributes':_0x4944e7[_0x2d9e('0x18')]?_0x4944e7['options'][_0x2d9e('0x1b')]||null:null,'limit':_0x4944e7[_0x2d9e('0x18')]?_0x4944e7[_0x2d9e('0x18')][_0x2d9e('0x1c')]||null:null,'include':_0x4944e7['options']?_0x4944e7[_0x2d9e('0x18')][_0x2d9e('0x1d')]?_[_0x2d9e('0x1e')](_0x4944e7[_0x2d9e('0x18')][_0x2d9e('0x1d')],function(_0x5c3d32){return{'model':db[_0x5c3d32[_0x2d9e('0x1f')]],'as':_0x5c3d32['as'],'attributes':_0x5c3d32[_0x2d9e('0x1b')],'include':_0x5c3d32['include']?_['map'](_0x5c3d32[_0x2d9e('0x1d')],function(_0x45b8b8){return{'model':db[_0x45b8b8[_0x2d9e('0x1f')]],'as':_0x45b8b8['as'],'attributes':_0x45b8b8[_0x2d9e('0x1b')],'include':_0x45b8b8['include']?_['map'](_0x45b8b8[_0x2d9e('0x1d')],function(_0x62059d){return{'model':db[_0x62059d[_0x2d9e('0x1f')]],'as':_0x62059d['as'],'attributes':_0x62059d[_0x2d9e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2d9e('0xd')](function(_0x48100c){logger[_0x2d9e('0xe')]('GetVoiceCallReport',_0x4944e7);logger[_0x2d9e('0x20')](_0x2d9e('0x17'),_0x4944e7,JSON[_0x2d9e('0x12')](_0x48100c));_0x2b008f(_0x48100c);})[_0x2d9e('0x21')](function(_0x31f1e1){logger['error'](_0x2d9e('0x17'),_0x31f1e1[_0x2d9e('0x15')],_0x4944e7);_0x475bca(_0x141184[_0x2d9e('0x13')](0x1f4,_0x31f1e1[_0x2d9e('0x15')]));});});};exports[_0x2d9e('0x22')]=function(_0x4c1197){var _0x3e79f8=this;return new Promise(function(_0x545b6b,_0x1d7a35){return db[_0x2d9e('0x23')]['create'](_0x4c1197[_0x2d9e('0x24')],{'raw':_0x4c1197[_0x2d9e('0x18')]?_0x4c1197[_0x2d9e('0x18')][_0x2d9e('0x19')]===undefined?!![]:![]:!![]})[_0x2d9e('0xd')](function(_0x5cb414){logger[_0x2d9e('0xe')]('CreateVoiceCallReport',_0x4c1197);logger[_0x2d9e('0x20')]('CreateVoiceCallReport',_0x4c1197,JSON[_0x2d9e('0x12')](_0x5cb414));_0x545b6b(_0x5cb414);})[_0x2d9e('0x21')](function(_0xb9b6bd){logger[_0x2d9e('0x13')]('CreateVoiceCallReport',_0xb9b6bd[_0x2d9e('0x15')],_0x4c1197);_0x1d7a35(_0x3e79f8[_0x2d9e('0x13')](0x1f4,_0xb9b6bd['message']));});});};exports[_0x2d9e('0x25')]=function(_0xfdec5e){var _0x3a98a3=this;return new Promise(function(_0x4b7a6c,_0x31e282){return db[_0x2d9e('0x23')][_0x2d9e('0x26')](_0xfdec5e[_0x2d9e('0x24')],{'raw':_0xfdec5e[_0x2d9e('0x18')]?_0xfdec5e[_0x2d9e('0x18')][_0x2d9e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfdec5e[_0x2d9e('0x18')]?_0xfdec5e[_0x2d9e('0x18')][_0x2d9e('0x1a')]||null:null,'attributes':_0xfdec5e[_0x2d9e('0x18')]?_0xfdec5e[_0x2d9e('0x18')][_0x2d9e('0x1b')]||null:null,'limit':_0xfdec5e[_0x2d9e('0x18')]?_0xfdec5e[_0x2d9e('0x18')][_0x2d9e('0x1c')]||null:null})[_0x2d9e('0xd')](function(_0x47ae11){logger[_0x2d9e('0xe')](_0x2d9e('0x25'),_0xfdec5e);logger[_0x2d9e('0x20')](_0x2d9e('0x25'),_0xfdec5e,JSON[_0x2d9e('0x12')](_0x47ae11));_0x4b7a6c(_0x47ae11);})[_0x2d9e('0x21')](function(_0x106241){logger['error'](_0x2d9e('0x25'),_0x106241[_0x2d9e('0x15')],_0xfdec5e);_0x31e282(_0x3a98a3[_0x2d9e('0x13')](0x1f4,_0x106241['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 63cc1d9..d0d4afc 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 _0xd1e5=['/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','create'];(function(_0x14c358,_0x5b589d){var _0x33f3c6=function(_0x331d21){while(--_0x331d21){_0x14c358['push'](_0x14c358['shift']());}};_0x33f3c6(++_0x5b589d);}(_0xd1e5,0xb4));var _0x5d1e=function(_0x7fd723,_0x33d95d){_0x7fd723=_0x7fd723-0x0;var _0x19defe=_0xd1e5[_0x7fd723];return _0x19defe;};'use strict';var multer=require(_0x5d1e('0x0'));var util=require('util');var path=require(_0x5d1e('0x1'));var timeout=require(_0x5d1e('0x2'));var express=require(_0x5d1e('0x3'));var router=express[_0x5d1e('0x4')]();var auth=require(_0x5d1e('0x5'));var interaction=require(_0x5d1e('0x6'));var config=require(_0x5d1e('0x7'));var controller=require(_0x5d1e('0x8'));router[_0x5d1e('0x9')]('/',auth[_0x5d1e('0xa')](),controller['index']);router[_0x5d1e('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5d1e('0xb')]);router['put'](_0x5d1e('0xc'),auth[_0x5d1e('0xa')](),controller[_0x5d1e('0xd')]);router[_0x5d1e('0xe')](_0x5d1e('0xc'),auth[_0x5d1e('0xa')](),controller['destroy']);module[_0x5d1e('0xf')]=router; \ No newline at end of file +var _0x303f=['express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x13556f,_0x35b410){var _0x43b023=function(_0x128496){while(--_0x128496){_0x13556f['push'](_0x13556f['shift']());}};_0x43b023(++_0x35b410);}(_0x303f,0xbe));var _0xf303=function(_0x9319be,_0x2a770d){_0x9319be=_0x9319be-0x0;var _0x488bb4=_0x303f[_0x9319be];return _0x488bb4;};'use strict';var multer=require(_0xf303('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf303('0x1'));var express=require(_0xf303('0x2'));var router=express[_0xf303('0x3')]();var auth=require(_0xf303('0x4'));var interaction=require(_0xf303('0x5'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0xf303('0x6')]('/',auth[_0xf303('0x7')](),controller[_0xf303('0x8')]);router[_0xf303('0x6')](_0xf303('0x9'),auth[_0xf303('0x7')](),controller['show']);router[_0xf303('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf303('0xb')](_0xf303('0x9'),auth['isAuthenticated'](),controller[_0xf303('0xc')]);router[_0xf303('0xd')](_0xf303('0x9'),auth['isAuthenticated'](),controller[_0xf303('0xe')]);module[_0xf303('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 1d82ec9..9dcbfa4 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 _0x726b=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options','join'];(function(_0xc75723,_0x12694e){var _0x28b693=function(_0x30a916){while(--_0x30a916){_0xc75723['push'](_0xc75723['shift']());}};_0x28b693(++_0x12694e);}(_0x726b,0x1c5));var _0xb726=function(_0x15e40e,_0x2d2e43){_0x15e40e=_0x15e40e-0x0;var _0xfb2528=_0x726b[_0x15e40e];return _0xfb2528;};'use strict';var Sequelize=require(_0xb726('0x0'));module[_0xb726('0x1')]={'name':{'type':Sequelize[_0xb726('0x2')]},'prefix':{'type':Sequelize[_0xb726('0x2')],'unique':_0xb726('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xb726('0x2')],'set':function(_0x48da16){this[_0xb726('0x4')](_0xb726('0x5'),_0x48da16?_0x48da16[_0xb726('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xb726('0x5'))?this[_0xb726('0x7')]('options')[_0xb726('0x8')](''):[];}},'auth':{'type':Sequelize[_0xb726('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0xb726('0x2')]},'record':{'type':Sequelize[_0xb726('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb726('0x2')]},'description':{'type':Sequelize[_0xb726('0x2')]}}; \ No newline at end of file +var _0xe790=['options','getDataValue','split','BOOLEAN','exports','STRING','name','setDataValue'];(function(_0xcb564d,_0x275f90){var _0x4b3aa9=function(_0x5f3a75){while(--_0x5f3a75){_0xcb564d['push'](_0xcb564d['shift']());}};_0x4b3aa9(++_0x275f90);}(_0xe790,0x124));var _0x0e79=function(_0x13a186,_0x3a294b){_0x13a186=_0x13a186-0x0;var _0x55ca3e=_0xe790[_0x13a186];return _0x55ca3e;};'use strict';var Sequelize=require('sequelize');module[_0x0e79('0x0')]={'name':{'type':Sequelize[_0x0e79('0x1')]},'prefix':{'type':Sequelize[_0x0e79('0x1')],'unique':_0x0e79('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x0e79('0x1')],'set':function(_0x589b35){this[_0x0e79('0x3')](_0x0e79('0x4'),_0x589b35?_0x589b35['join'](''):[]);},'get':function(){return this[_0x0e79('0x5')](_0x0e79('0x4'))?this['getDataValue'](_0x0e79('0x4'))[_0x0e79('0x6')](''):[];}},'auth':{'type':Sequelize[_0x0e79('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x0e79('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0e79('0x1')]},'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 98a4704..1fc17dd 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 _0x7345=['end','status','count','offset','limit','set','reject','save','update','then','ChanSpies','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','VoiceChanSpy','include','findAll','catch','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus'];(function(_0x416499,_0x26657b){var _0x1743f8=function(_0x476905){while(--_0x476905){_0x416499['push'](_0x416499['shift']());}};_0x1743f8(++_0x26657b);}(_0x7345,0x86));var _0x5734=function(_0x184a1e,_0x43b374){_0x184a1e=_0x184a1e-0x0;var _0x3d3dbb=_0x7345[_0x184a1e];return _0x3d3dbb;};'use strict';var pdf=require(_0x5734('0x0'));var emlformat=require(_0x5734('0x1'));var rimraf=require(_0x5734('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5734('0x3'));var rp=require('request-promise');var moment=require(_0x5734('0x4'));var BPromise=require(_0x5734('0x5'));var Mustache=require(_0x5734('0x6'));var util=require(_0x5734('0x7'));var path=require(_0x5734('0x8'));var sox=require(_0x5734('0x9'));var csv=require(_0x5734('0xa'));var ejs=require(_0x5734('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5734('0xc'));var crypto=require(_0x5734('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5734('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5734('0xf'));var authService=require(_0x5734('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5734('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5734('0x12'))(_0x5734('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5734('0x14'))['db'];function respondWithStatusCode(_0x4267d2,_0x205b19){_0x205b19=_0x205b19||0xcc;return function(_0x204ffd){if(_0x204ffd){return _0x4267d2[_0x5734('0x15')](_0x205b19);}return _0x4267d2['status'](_0x205b19)[_0x5734('0x16')]();};}function respondWithResult(_0x3bceae,_0x23f64b){_0x23f64b=_0x23f64b||0xc8;return function(_0x122734){if(_0x122734){return _0x3bceae[_0x5734('0x17')](_0x23f64b)['json'](_0x122734);}};}function respondWithFilteredResult(_0x3908e8,_0x1efc01){return function(_0x113b0a){if(_0x113b0a){var _0x4e5039=_0x113b0a[_0x5734('0x18')],_0xf52dae=_0x1efc01[_0x5734('0x19')],_0x5728b7=_0x1efc01['offset']+_0x1efc01[_0x5734('0x1a')],_0x5ef4b5;if(_0x5728b7>=_0x4e5039){_0x5728b7=_0x4e5039;_0x5ef4b5=0xc8;}else{_0x5ef4b5=0xce;}_0x3908e8['status'](_0x5ef4b5);return _0x3908e8[_0x5734('0x1b')]('Content-Range',_0xf52dae+'-'+_0x5728b7+'/'+_0x4e5039)['json'](_0x113b0a);}return null;};}function patchUpdates(_0x1166b9){return function(_0x1d8c08){try{jsonpatch['apply'](_0x1d8c08,_0x1166b9,!![]);}catch(_0x1cbb3b){return BPromise[_0x5734('0x1c')](_0x1cbb3b);}return _0x1d8c08[_0x5734('0x1d')]();};}function saveUpdates(_0x252bb8,_0x4a8502){return function(_0x195ffb){if(_0x195ffb){return _0x195ffb[_0x5734('0x1e')](_0x252bb8)[_0x5734('0x1f')](function(_0x1aeea5){return _0x1aeea5;});}return null;};}function removeEntity(_0x10ea94,_0x10f49d){return function(_0x173e48){if(_0x173e48){return _0x173e48['destroy']()[_0x5734('0x1f')](function(){var _0x31fc81=_0x173e48['get']({'plain':!![]});var _0x2e108b=_0x5734('0x20');return db[_0x5734('0x21')][_0x5734('0x22')]({'where':{'type':_0x2e108b,'resourceId':_0x31fc81['id']}})[_0x5734('0x1f')](function(){return _0x173e48;});})[_0x5734('0x1f')](function(){_0x10ea94[_0x5734('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48e25a,_0x5bd52c){return function(_0x29bbad){if(!_0x29bbad){_0x48e25a[_0x5734('0x15')](0x194);}return _0x29bbad;};}function handleError(_0x3aeb3a,_0x57a695){_0x57a695=_0x57a695||0x1f4;return function(_0x17ea64){logger[_0x5734('0x23')](_0x17ea64[_0x5734('0x24')]);if(_0x17ea64[_0x5734('0x25')]){delete _0x17ea64[_0x5734('0x25')];}_0x3aeb3a[_0x5734('0x17')](_0x57a695)[_0x5734('0x26')](_0x17ea64);};}exports[_0x5734('0x27')]=function(_0x1323b3,_0x711bac){var _0x6ff15a={},_0x6c64d={},_0x32c785={'count':0x0,'rows':[]};var _0x277a75=_[_0x5734('0x28')](db['VoiceChanSpy'][_0x5734('0x29')],function(_0x3de097){return{'name':_0x3de097[_0x5734('0x2a')],'type':_0x3de097['type'][_0x5734('0x2b')]};});_0x6c64d[_0x5734('0x2c')]=_['map'](_0x277a75,_0x5734('0x25'));_0x6c64d[_0x5734('0x2d')]=_['keys'](_0x1323b3[_0x5734('0x2d')]);_0x6c64d[_0x5734('0x2e')]=_[_0x5734('0x2f')](_0x6c64d[_0x5734('0x2c')],_0x6c64d[_0x5734('0x2d')]);_0x6ff15a[_0x5734('0x30')]=_[_0x5734('0x2f')](_0x6c64d[_0x5734('0x2c')],qs[_0x5734('0x31')](_0x1323b3[_0x5734('0x2d')][_0x5734('0x31')]));_0x6ff15a[_0x5734('0x30')]=_0x6ff15a[_0x5734('0x30')][_0x5734('0x32')]?_0x6ff15a[_0x5734('0x30')]:_0x6c64d['model'];if(!_0x1323b3['query'][_0x5734('0x33')](_0x5734('0x34'))){_0x6ff15a[_0x5734('0x1a')]=qs[_0x5734('0x1a')](_0x1323b3[_0x5734('0x2d')][_0x5734('0x1a')]);_0x6ff15a[_0x5734('0x19')]=qs['offset'](_0x1323b3[_0x5734('0x2d')]['offset']);}_0x6ff15a[_0x5734('0x35')]=qs[_0x5734('0x36')](_0x1323b3[_0x5734('0x2d')]['sort']);_0x6ff15a[_0x5734('0x37')]=qs[_0x5734('0x2e')](_[_0x5734('0x38')](_0x1323b3[_0x5734('0x2d')],_0x6c64d[_0x5734('0x2e')]),_0x277a75);if(_0x1323b3[_0x5734('0x2d')][_0x5734('0x39')]){_0x6ff15a[_0x5734('0x37')]=_['merge'](_0x6ff15a[_0x5734('0x37')],{'$or':_['map'](_0x277a75,function(_0x464566){if(_0x464566[_0x5734('0x3a')]!==_0x5734('0x3b')){var _0x337f86={};_0x337f86[_0x464566[_0x5734('0x25')]]={'$like':'%'+_0x1323b3['query']['filter']+'%'};return _0x337f86;}})});}_0x6ff15a=_[_0x5734('0x3c')]({},_0x6ff15a,_0x1323b3[_0x5734('0x3d')]);var _0x2edc2f={'where':_0x6ff15a[_0x5734('0x37')]};return db[_0x5734('0x3e')][_0x5734('0x18')](_0x2edc2f)[_0x5734('0x1f')](function(_0x8070ac){_0x32c785[_0x5734('0x18')]=_0x8070ac;if(_0x1323b3[_0x5734('0x2d')]['includeAll']){_0x6ff15a[_0x5734('0x3f')]=[{'all':!![]}];}return db[_0x5734('0x3e')][_0x5734('0x40')](_0x6ff15a);})[_0x5734('0x1f')](function(_0x2a1c89){_0x32c785['rows']=_0x2a1c89;return _0x32c785;})[_0x5734('0x1f')](respondWithFilteredResult(_0x711bac,_0x6ff15a))[_0x5734('0x41')](handleError(_0x711bac,null));};exports['show']=function(_0x5b902f,_0x843376){var _0x2ea587={'raw':![],'where':{'id':_0x5b902f[_0x5734('0x42')]['id']}},_0x25651a={};_0x25651a[_0x5734('0x2c')]=_['keys'](db['VoiceChanSpy']['rawAttributes']);_0x25651a[_0x5734('0x2d')]=_[_0x5734('0x43')](_0x5b902f['query']);_0x25651a['filters']=_['intersection'](_0x25651a[_0x5734('0x2c')],_0x25651a['query']);_0x2ea587[_0x5734('0x30')]=_[_0x5734('0x2f')](_0x25651a[_0x5734('0x2c')],qs[_0x5734('0x31')](_0x5b902f['query'][_0x5734('0x31')]));_0x2ea587[_0x5734('0x30')]=_0x2ea587[_0x5734('0x30')][_0x5734('0x32')]?_0x2ea587[_0x5734('0x30')]:_0x25651a[_0x5734('0x2c')];if(_0x5b902f[_0x5734('0x2d')][_0x5734('0x44')]){_0x2ea587[_0x5734('0x3f')]=[{'all':!![]}];}_0x2ea587=_[_0x5734('0x3c')]({},_0x2ea587,_0x5b902f[_0x5734('0x3d')]);return db['VoiceChanSpy'][_0x5734('0x45')](_0x2ea587)[_0x5734('0x1f')](handleEntityNotFound(_0x843376,null))[_0x5734('0x1f')](respondWithResult(_0x843376,null))[_0x5734('0x41')](handleError(_0x843376,null));};exports[_0x5734('0x46')]=function(_0x14f91d,_0x11c56c){return db[_0x5734('0x3e')][_0x5734('0x46')](_0x14f91d[_0x5734('0x47')],{})[_0x5734('0x1f')](function(_0x1dbe93){var _0x41a95f=_0x14f91d[_0x5734('0x48')]['get']({'plain':!![]});if(!_0x41a95f)throw new Error(_0x5734('0x49'));if(_0x41a95f['role']==='user'){var _0x12cea4=_0x1dbe93[_0x5734('0x4a')]({'plain':!![]});var _0x22fa1a=_0x5734('0x20');return db['UserProfileSection'][_0x5734('0x45')]({'where':{'name':_0x22fa1a,'userProfileId':_0x41a95f[_0x5734('0x4b')]},'raw':!![]})[_0x5734('0x1f')](function(_0x5a5578){if(_0x5a5578&&_0x5a5578[_0x5734('0x4c')]===0x0){return db['UserProfileResource'][_0x5734('0x46')]({'name':_0x12cea4[_0x5734('0x25')],'resourceId':_0x12cea4['id'],'type':_0x5a5578[_0x5734('0x25')],'sectionId':_0x5a5578['id']},{})[_0x5734('0x1f')](function(){return _0x1dbe93;});}else{return _0x1dbe93;}})['catch'](function(_0x2faec8){logger[_0x5734('0x23')](_0x5734('0x4d'),_0x2faec8);throw _0x2faec8;});}return _0x1dbe93;})[_0x5734('0x1f')](respondWithResult(_0x11c56c,0xc9))[_0x5734('0x41')](handleError(_0x11c56c,null));};exports[_0x5734('0x1e')]=function(_0x2f91a2,_0x2847a5){if(_0x2f91a2[_0x5734('0x47')]['id']){delete _0x2f91a2[_0x5734('0x47')]['id'];}return db['VoiceChanSpy'][_0x5734('0x45')]({'where':{'id':_0x2f91a2[_0x5734('0x42')]['id']}})[_0x5734('0x1f')](handleEntityNotFound(_0x2847a5,null))[_0x5734('0x1f')](saveUpdates(_0x2f91a2[_0x5734('0x47')],null))[_0x5734('0x1f')](respondWithResult(_0x2847a5,null))[_0x5734('0x41')](handleError(_0x2847a5,null));};exports['destroy']=function(_0x1732b8,_0x4152df){return db[_0x5734('0x3e')][_0x5734('0x45')]({'where':{'id':_0x1732b8[_0x5734('0x42')]['id']}})[_0x5734('0x1f')](handleEntityNotFound(_0x4152df,null))[_0x5734('0x1f')](removeEntity(_0x4152df,null))[_0x5734('0x41')](handleError(_0x4152df,null));}; \ No newline at end of file +var _0xd88e=['findAll','catch','show','include','find','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','VoiceChanSpy','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd88e,0x192));var _0xed88=function(_0x9eef7a,_0x3d78cb){_0x9eef7a=_0x9eef7a-0x0;var _0x150fc8=_0xd88e[_0x9eef7a];return _0x150fc8;};'use strict';var pdf=require(_0xed88('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xed88('0x1'));var zipdir=require(_0xed88('0x2'));var jsonpatch=require(_0xed88('0x3'));var rp=require(_0xed88('0x4'));var moment=require(_0xed88('0x5'));var BPromise=require(_0xed88('0x6'));var Mustache=require(_0xed88('0x7'));var util=require(_0xed88('0x8'));var path=require(_0xed88('0x9'));var sox=require(_0xed88('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xed88('0xb'));var crypto=require('crypto');var jsforce=require(_0xed88('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xed88('0xd'));var querystring=require('querystring');var Papa=require(_0xed88('0xe'));var Redis=require(_0xed88('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xed88('0x10'));var as=require(_0xed88('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed88('0x12'))(_0xed88('0x13'));var utils=require('../../config/utils');var config=require(_0xed88('0x14'));var db=require(_0xed88('0x15'))['db'];function respondWithStatusCode(_0x1641a4,_0x4938d8){_0x4938d8=_0x4938d8||0xcc;return function(_0x1b252d){if(_0x1b252d){return _0x1641a4['sendStatus'](_0x4938d8);}return _0x1641a4[_0xed88('0x16')](_0x4938d8)[_0xed88('0x17')]();};}function respondWithResult(_0x4e9853,_0x4c5388){_0x4c5388=_0x4c5388||0xc8;return function(_0xb9b08d){if(_0xb9b08d){return _0x4e9853[_0xed88('0x16')](_0x4c5388)[_0xed88('0x18')](_0xb9b08d);}};}function respondWithFilteredResult(_0x5382cb,_0x4d8da4){return function(_0x3ca985){if(_0x3ca985){var _0x3a4a05=_0x3ca985[_0xed88('0x19')],_0x6f4a1c=_0x4d8da4[_0xed88('0x1a')],_0x4c68f6=_0x4d8da4[_0xed88('0x1a')]+_0x4d8da4[_0xed88('0x1b')],_0x55d288;if(_0x4c68f6>=_0x3a4a05){_0x4c68f6=_0x3a4a05;_0x55d288=0xc8;}else{_0x55d288=0xce;}_0x5382cb[_0xed88('0x16')](_0x55d288);return _0x5382cb[_0xed88('0x1c')](_0xed88('0x1d'),_0x6f4a1c+'-'+_0x4c68f6+'/'+_0x3a4a05)[_0xed88('0x18')](_0x3ca985);}return null;};}function patchUpdates(_0x31e424){return function(_0x592064){try{jsonpatch[_0xed88('0x1e')](_0x592064,_0x31e424,!![]);}catch(_0x278788){return BPromise[_0xed88('0x1f')](_0x278788);}return _0x592064[_0xed88('0x20')]();};}function saveUpdates(_0x13a18c,_0x36c174){return function(_0x59e531){if(_0x59e531){return _0x59e531[_0xed88('0x21')](_0x13a18c)[_0xed88('0x22')](function(_0x4596dd){return _0x4596dd;});}return null;};}function removeEntity(_0x2791d9,_0x1f97a2){return function(_0x2fa920){if(_0x2fa920){return _0x2fa920[_0xed88('0x23')]()['then'](function(){var _0x222229=_0x2fa920[_0xed88('0x24')]({'plain':!![]});var _0xc261fc='ChanSpies';return db[_0xed88('0x25')][_0xed88('0x23')]({'where':{'type':_0xc261fc,'resourceId':_0x222229['id']}})[_0xed88('0x22')](function(){return _0x2fa920;});})[_0xed88('0x22')](function(){_0x2791d9[_0xed88('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e03f3,_0x422ad6){return function(_0x3eee0b){if(!_0x3eee0b){_0x4e03f3['sendStatus'](0x194);}return _0x3eee0b;};}function handleError(_0x281028,_0xc41249){_0xc41249=_0xc41249||0x1f4;return function(_0x863991){logger[_0xed88('0x26')](_0x863991[_0xed88('0x27')]);if(_0x863991[_0xed88('0x28')]){delete _0x863991[_0xed88('0x28')];}_0x281028[_0xed88('0x16')](_0xc41249)[_0xed88('0x29')](_0x863991);};}exports[_0xed88('0x2a')]=function(_0x4c4c88,_0x258179){var _0x5c662c={},_0x5d813e={},_0x542c84={'count':0x0,'rows':[]};var _0x2ba66a=_['map'](db[_0xed88('0x2b')][_0xed88('0x2c')],function(_0x205e0f){return{'name':_0x205e0f['fieldName'],'type':_0x205e0f[_0xed88('0x2d')][_0xed88('0x2e')]};});_0x5d813e[_0xed88('0x2f')]=_[_0xed88('0x30')](_0x2ba66a,_0xed88('0x28'));_0x5d813e[_0xed88('0x31')]=_[_0xed88('0x32')](_0x4c4c88[_0xed88('0x31')]);_0x5d813e['filters']=_[_0xed88('0x33')](_0x5d813e['model'],_0x5d813e[_0xed88('0x31')]);_0x5c662c[_0xed88('0x34')]=_[_0xed88('0x33')](_0x5d813e[_0xed88('0x2f')],qs[_0xed88('0x35')](_0x4c4c88[_0xed88('0x31')][_0xed88('0x35')]));_0x5c662c[_0xed88('0x34')]=_0x5c662c['attributes'][_0xed88('0x36')]?_0x5c662c[_0xed88('0x34')]:_0x5d813e['model'];if(!_0x4c4c88[_0xed88('0x31')][_0xed88('0x37')]('nolimit')){_0x5c662c[_0xed88('0x1b')]=qs['limit'](_0x4c4c88[_0xed88('0x31')][_0xed88('0x1b')]);_0x5c662c[_0xed88('0x1a')]=qs[_0xed88('0x1a')](_0x4c4c88[_0xed88('0x31')][_0xed88('0x1a')]);}_0x5c662c[_0xed88('0x38')]=qs['sort'](_0x4c4c88[_0xed88('0x31')][_0xed88('0x39')]);_0x5c662c[_0xed88('0x3a')]=qs[_0xed88('0x3b')](_[_0xed88('0x3c')](_0x4c4c88[_0xed88('0x31')],_0x5d813e[_0xed88('0x3b')]),_0x2ba66a);if(_0x4c4c88['query'][_0xed88('0x3d')]){_0x5c662c[_0xed88('0x3a')]=_['merge'](_0x5c662c['where'],{'$or':_[_0xed88('0x30')](_0x2ba66a,function(_0x14b4ec){if(_0x14b4ec['type']!==_0xed88('0x3e')){var _0x17340b={};_0x17340b[_0x14b4ec[_0xed88('0x28')]]={'$like':'%'+_0x4c4c88[_0xed88('0x31')][_0xed88('0x3d')]+'%'};return _0x17340b;}})});}_0x5c662c=_[_0xed88('0x3f')]({},_0x5c662c,_0x4c4c88[_0xed88('0x40')]);var _0x23e35f={'where':_0x5c662c[_0xed88('0x3a')]};return db[_0xed88('0x2b')][_0xed88('0x19')](_0x23e35f)[_0xed88('0x22')](function(_0x548f1d){_0x542c84[_0xed88('0x19')]=_0x548f1d;if(_0x4c4c88[_0xed88('0x31')][_0xed88('0x41')]){_0x5c662c['include']=[{'all':!![]}];}return db[_0xed88('0x2b')][_0xed88('0x42')](_0x5c662c);})['then'](function(_0x24dda5){_0x542c84['rows']=_0x24dda5;return _0x542c84;})[_0xed88('0x22')](respondWithFilteredResult(_0x258179,_0x5c662c))[_0xed88('0x43')](handleError(_0x258179,null));};exports[_0xed88('0x44')]=function(_0x597815,_0x2dad72){var _0x53a25a={'raw':![],'where':{'id':_0x597815['params']['id']}},_0x4a12f5={};_0x4a12f5['model']=_[_0xed88('0x32')](db[_0xed88('0x2b')]['rawAttributes']);_0x4a12f5[_0xed88('0x31')]=_['keys'](_0x597815['query']);_0x4a12f5[_0xed88('0x3b')]=_[_0xed88('0x33')](_0x4a12f5['model'],_0x4a12f5[_0xed88('0x31')]);_0x53a25a[_0xed88('0x34')]=_[_0xed88('0x33')](_0x4a12f5[_0xed88('0x2f')],qs[_0xed88('0x35')](_0x597815[_0xed88('0x31')][_0xed88('0x35')]));_0x53a25a[_0xed88('0x34')]=_0x53a25a['attributes'][_0xed88('0x36')]?_0x53a25a['attributes']:_0x4a12f5['model'];if(_0x597815[_0xed88('0x31')][_0xed88('0x41')]){_0x53a25a[_0xed88('0x45')]=[{'all':!![]}];}_0x53a25a=_[_0xed88('0x3f')]({},_0x53a25a,_0x597815['options']);return db['VoiceChanSpy'][_0xed88('0x46')](_0x53a25a)['then'](handleEntityNotFound(_0x2dad72,null))['then'](respondWithResult(_0x2dad72,null))[_0xed88('0x43')](handleError(_0x2dad72,null));};exports[_0xed88('0x47')]=function(_0x2b66af,_0x290aff){return db[_0xed88('0x2b')][_0xed88('0x47')](_0x2b66af[_0xed88('0x48')],{})[_0xed88('0x22')](function(_0x4f6f8d){var _0x2d5c95=_0x2b66af[_0xed88('0x49')]['get']({'plain':!![]});if(!_0x2d5c95)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d5c95['role']==='user'){var _0x1ea5cb=_0x4f6f8d[_0xed88('0x24')]({'plain':!![]});var _0x4778e0='ChanSpies';return db['UserProfileSection'][_0xed88('0x46')]({'where':{'name':_0x4778e0,'userProfileId':_0x2d5c95[_0xed88('0x4a')]},'raw':!![]})['then'](function(_0x2a183a){if(_0x2a183a&&_0x2a183a[_0xed88('0x4b')]===0x0){return db[_0xed88('0x25')]['create']({'name':_0x1ea5cb[_0xed88('0x28')],'resourceId':_0x1ea5cb['id'],'type':_0x2a183a[_0xed88('0x28')],'sectionId':_0x2a183a['id']},{})[_0xed88('0x22')](function(){return _0x4f6f8d;});}else{return _0x4f6f8d;}})[_0xed88('0x43')](function(_0x28470c){logger[_0xed88('0x26')](_0xed88('0x4c'),_0x28470c);throw _0x28470c;});}return _0x4f6f8d;})[_0xed88('0x22')](respondWithResult(_0x290aff,0xc9))[_0xed88('0x43')](handleError(_0x290aff,null));};exports[_0xed88('0x21')]=function(_0x2f0c58,_0x3ccdf9){if(_0x2f0c58[_0xed88('0x48')]['id']){delete _0x2f0c58[_0xed88('0x48')]['id'];}return db[_0xed88('0x2b')][_0xed88('0x46')]({'where':{'id':_0x2f0c58[_0xed88('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3ccdf9,null))[_0xed88('0x22')](saveUpdates(_0x2f0c58[_0xed88('0x48')],null))['then'](respondWithResult(_0x3ccdf9,null))[_0xed88('0x43')](handleError(_0x3ccdf9,null));};exports[_0xed88('0x23')]=function(_0x499668,_0x406736){return db[_0xed88('0x2b')][_0xed88('0x46')]({'where':{'id':_0x499668[_0xed88('0x4d')]['id']}})[_0xed88('0x22')](handleEntityNotFound(_0x406736,null))[_0xed88('0x22')](removeEntity(_0x406736,null))[_0xed88('0x43')](handleError(_0x406736,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 4dfdc05..438f2ea 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 _0x151b=['record','internal','concat','User','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','./voiceChanSpy.attributes','context','from-sip','%s%s','system','push','merge','CDR(type)=%s','chanspy','MixMonitor','format','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','SIP/%s,%s','name','options','join'];(function(_0x24e91d,_0x5d6ffe){var _0x324d8d=function(_0x53a0e0){while(--_0x53a0e0){_0x24e91d['push'](_0x24e91d['shift']());}};_0x324d8d(++_0x5d6ffe);}(_0x151b,0x153));var _0xb151=function(_0x2ec70c,_0x409345){_0x2ec70c=_0x2ec70c-0x0;var _0xc29b59=_0x151b[_0x2ec70c];return _0xc29b59;};'use strict';var _=require(_0xb151('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0xb151('0x1'));var getUserApplications=function(_0x53e601,_0x463ad0,_0x2098a4){var _0x377d3d=0x1;var _0x486d88=[];var _0x4a9d3f={'context':_0x463ad0[_0xb151('0x2')]||_0xb151('0x3'),'exten':util['format'](_0xb151('0x4'),_0x53e601['prefix'],_0x2098a4),'type':_0xb151('0x5'),'isApp':![],'ChanSpyId':_0x53e601['id'],'UserId':_0x463ad0['id']};_0x486d88[_0xb151('0x6')](_[_0xb151('0x7')]({'app':'Set','appdata':util['format'](_0xb151('0x8'),_0xb151('0x9')),'priority':_0x377d3d++},_0x4a9d3f));if(_0x53e601['record']){_0x486d88['push'](_[_0xb151('0x7')]({'app':_0xb151('0xa'),'appdata':util[_0xb151('0xb')](_0xb151('0xc'),_0x53e601[_0xb151('0xd')]),'priority':_0x377d3d++},_0x4a9d3f));}if(_0x53e601[_0xb151('0xe')]){_0x486d88[_0xb151('0x6')](_[_0xb151('0x7')]({'app':_0xb151('0xf'),'appdata':_0x53e601[_0xb151('0x10')],'priority':_0x377d3d++},_0x4a9d3f));}_0x486d88['push'](_[_0xb151('0x7')]({'app':'ChanSpy','appdata':util[_0xb151('0xb')](_0xb151('0x11'),_0x463ad0[_0xb151('0x12')],_0x53e601[_0xb151('0x13')]?_0x53e601['options'][_0xb151('0x14')](''):''),'priority':_0x377d3d++},_0x4a9d3f));if(_0x53e601[_0xb151('0x15')]){_0x486d88[_0xb151('0x6')](_['merge']({'app':'StopMixMonitor','priority':_0x377d3d++},_0x4a9d3f));}return _0x486d88;};var getChanSpyApplications=function(_0x5b2faa,_0x4af1c2){var _0x3ff606=[];for(var _0x4ca435=0x0,_0x251c8d=0x1;_0x4ca435<_0x4af1c2['length'];_0x4ca435++,_0x251c8d=0x1){_0x3ff606=_0x3ff606['concat'](getUserApplications(_0x5b2faa,_0x4af1c2[_0x4ca435],_0x4af1c2[_0x4ca435][_0xb151('0x16')]));if(_0x4af1c2[_0x4ca435][_0xb151('0x16')]!=_0x4af1c2[_0x4ca435][_0xb151('0x12')]){_0x3ff606=_0x3ff606[_0xb151('0x17')](getUserApplications(_0x5b2faa,_0x4af1c2[_0x4ca435],_0x4af1c2[_0x4ca435][_0xb151('0x12')]));}}return _0x3ff606;};var getChanSpyPromise=function(_0xf8a2fe,_0x1e2b38){return new BPromise(function(_0x5525fd,_0xd0fe9a){return _0xf8a2fe[_0xb151('0x18')]['findAll']({'attributes':['id',_0xb151('0x12'),_0xb151('0x16')],'where':{'role':_0xb151('0x19'),'chanspy':!![]},'raw':!![]})[_0xb151('0x1a')](function(_0x2a06c7){if(_0x2a06c7){return _0x5525fd(getChanSpyApplications(_0x1e2b38,_0x2a06c7));}return _0x5525fd([]);})[_0xb151('0x1b')](function(_0x3f375d){_0xd0fe9a(_0x3f375d);});});};module[_0xb151('0x1c')]=function(_0x49c2e,_0x370110){var _0x56a73f=_0x49c2e[_0xb151('0x1d')];return _0x49c2e[_0xb151('0x1e')](_0xb151('0x1f'),attributes,{'tableName':_0xb151('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x724bd7,_0x29652a,_0xd22ee1){return getChanSpyPromise(_0x56a73f,_0x724bd7)[_0xb151('0x1a')](function(_0x31f1a7){if(_0x31f1a7&&_0x31f1a7['length']){return _0x56a73f[_0xb151('0x21')][_0xb151('0x22')](_0x31f1a7);}})[_0xb151('0x1a')](function(){_0xd22ee1();})[_0xb151('0x1b')](function(_0x2d65f8){_0xd22ee1(_0x2d65f8);});},'afterUpdate':function(_0x1c0b04,_0x46f28c,_0x2dc1b4){return _0x56a73f['VoiceExtension'][_0xb151('0x23')]({'where':{'ChanSpyId':_0x1c0b04['id']}})['then'](function(){return getChanSpyPromise(_0x56a73f,_0x1c0b04);})[_0xb151('0x1a')](function(_0x32c933){if(_0x32c933&&_0x32c933['length']){return _0x56a73f[_0xb151('0x21')]['bulkCreate'](_0x32c933);}})[_0xb151('0x1a')](function(){_0x2dc1b4();})[_0xb151('0x1b')](function(_0x4215b7){_0x2dc1b4(_0x4215b7);});},'afterDestroy':function(_0x2f5127,_0x3ed573,_0x444af1){return _0x56a73f[_0xb151('0x21')][_0xb151('0x23')]({'where':{'ChanSpyId':_0x2f5127['id']}})['then'](function(){_0x444af1();})[_0xb151('0x1b')](function(_0x2c920e){_0x444af1(_0x2c920e);});}}});}; \ No newline at end of file +var _0xfb09=['StopMixMonitor','length','internal','concat','User','findAll','agent','then','catch','exports','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','lodash','./voiceChanSpy.attributes','context','from-sip','format','system','CDR(type)=%s','record','push','merge','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options'];(function(_0x531fad,_0x531187){var _0x119d9e=function(_0x53c993){while(--_0x53c993){_0x531fad['push'](_0x531fad['shift']());}};_0x119d9e(++_0x531187);}(_0xfb09,0x97));var _0x9fb0=function(_0x5f6b4a,_0x1a1be0){_0x5f6b4a=_0x5f6b4a-0x0;var _0xb3c7c4=_0xfb09[_0x5f6b4a];return _0xb3c7c4;};'use strict';var _=require(_0x9fb0('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x9fb0('0x1'));var getUserApplications=function(_0x3b22ba,_0x467626,_0x2c5cfa){var _0x2f2d01=0x1;var _0x8bbc8d=[];var _0x22de6d={'context':_0x467626[_0x9fb0('0x2')]||_0x9fb0('0x3'),'exten':util[_0x9fb0('0x4')]('%s%s',_0x3b22ba['prefix'],_0x2c5cfa),'type':_0x9fb0('0x5'),'isApp':![],'ChanSpyId':_0x3b22ba['id'],'UserId':_0x467626['id']};_0x8bbc8d['push'](_['merge']({'app':'Set','appdata':util[_0x9fb0('0x4')](_0x9fb0('0x6'),'chanspy'),'priority':_0x2f2d01++},_0x22de6d));if(_0x3b22ba[_0x9fb0('0x7')]){_0x8bbc8d[_0x9fb0('0x8')](_[_0x9fb0('0x9')]({'app':_0x9fb0('0xa'),'appdata':util[_0x9fb0('0x4')](_0x9fb0('0xb'),_0x3b22ba['recordingFormat']),'priority':_0x2f2d01++},_0x22de6d));}if(_0x3b22ba[_0x9fb0('0xc')]){_0x8bbc8d[_0x9fb0('0x8')](_[_0x9fb0('0x9')]({'app':_0x9fb0('0xd'),'appdata':_0x3b22ba[_0x9fb0('0xe')],'priority':_0x2f2d01++},_0x22de6d));}_0x8bbc8d[_0x9fb0('0x8')](_[_0x9fb0('0x9')]({'app':_0x9fb0('0xf'),'appdata':util[_0x9fb0('0x4')](_0x9fb0('0x10'),_0x467626[_0x9fb0('0x11')],_0x3b22ba[_0x9fb0('0x12')]?_0x3b22ba[_0x9fb0('0x12')]['join'](''):''),'priority':_0x2f2d01++},_0x22de6d));if(_0x3b22ba[_0x9fb0('0x7')]){_0x8bbc8d[_0x9fb0('0x8')](_[_0x9fb0('0x9')]({'app':_0x9fb0('0x13'),'priority':_0x2f2d01++},_0x22de6d));}return _0x8bbc8d;};var getChanSpyApplications=function(_0x2c382c,_0x1d5538){var _0x263793=[];for(var _0x19ae73=0x0,_0x3a2a4c=0x1;_0x19ae73<_0x1d5538[_0x9fb0('0x14')];_0x19ae73++,_0x3a2a4c=0x1){_0x263793=_0x263793['concat'](getUserApplications(_0x2c382c,_0x1d5538[_0x19ae73],_0x1d5538[_0x19ae73]['internal']));if(_0x1d5538[_0x19ae73][_0x9fb0('0x15')]!=_0x1d5538[_0x19ae73][_0x9fb0('0x11')]){_0x263793=_0x263793[_0x9fb0('0x16')](getUserApplications(_0x2c382c,_0x1d5538[_0x19ae73],_0x1d5538[_0x19ae73][_0x9fb0('0x11')]));}}return _0x263793;};var getChanSpyPromise=function(_0x39f828,_0x4ebbd8){return new BPromise(function(_0x25ae7c,_0x31ae8a){return _0x39f828[_0x9fb0('0x17')][_0x9fb0('0x18')]({'attributes':['id',_0x9fb0('0x11'),_0x9fb0('0x15')],'where':{'role':_0x9fb0('0x19'),'chanspy':!![]},'raw':!![]})[_0x9fb0('0x1a')](function(_0x43d011){if(_0x43d011){return _0x25ae7c(getChanSpyApplications(_0x4ebbd8,_0x43d011));}return _0x25ae7c([]);})[_0x9fb0('0x1b')](function(_0x993be3){_0x31ae8a(_0x993be3);});});};module[_0x9fb0('0x1c')]=function(_0xfae60a,_0x3f8053){var _0x539cfe=_0xfae60a['models'];return _0xfae60a[_0x9fb0('0x1d')](_0x9fb0('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1cb76a,_0x5e0028,_0x3c61c4){return getChanSpyPromise(_0x539cfe,_0x1cb76a)['then'](function(_0x22683a){if(_0x22683a&&_0x22683a[_0x9fb0('0x14')]){return _0x539cfe[_0x9fb0('0x1f')][_0x9fb0('0x20')](_0x22683a);}})[_0x9fb0('0x1a')](function(){_0x3c61c4();})[_0x9fb0('0x1b')](function(_0x37b775){_0x3c61c4(_0x37b775);});},'afterUpdate':function(_0x1bb776,_0x31e059,_0x3d7882){return _0x539cfe[_0x9fb0('0x1f')][_0x9fb0('0x21')]({'where':{'ChanSpyId':_0x1bb776['id']}})[_0x9fb0('0x1a')](function(){return getChanSpyPromise(_0x539cfe,_0x1bb776);})[_0x9fb0('0x1a')](function(_0x41aaf1){if(_0x41aaf1&&_0x41aaf1['length']){return _0x539cfe['VoiceExtension'][_0x9fb0('0x20')](_0x41aaf1);}})[_0x9fb0('0x1a')](function(){_0x3d7882();})[_0x9fb0('0x1b')](function(_0x495fbe){_0x3d7882(_0x495fbe);});},'afterDestroy':function(_0x30572e,_0x444bb5,_0x59c514){return _0x539cfe[_0x9fb0('0x1f')][_0x9fb0('0x21')]({'where':{'ChanSpyId':_0x30572e['id']}})[_0x9fb0('0x1a')](function(){_0x59c514();})[_0x9fb0('0x1b')](function(_0x383210){_0x59c514(_0x383210);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 04b5df6..0719cf3 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 _0x8d83=['jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8d83,0x88));var _0x38d8=function(_0x16f660,_0xac3278){_0x16f660=_0x16f660-0x0;var _0x568276=_0x8d83[_0x16f660];return _0x568276;};'use strict';var _=require('lodash');var util=require(_0x38d8('0x0'));var moment=require('moment');var BPromise=require(_0x38d8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x38d8('0x2'));var db=require(_0x38d8('0x3'))['db'];var utils=require(_0x38d8('0x4'));var logger=require(_0x38d8('0x5'))(_0x38d8('0x6'));var config=require(_0x38d8('0x7'));var jayson=require(_0x38d8('0x8'));var client=jayson[_0x38d8('0x9')][_0x38d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6a080d,_0x4ad14a,_0x2aca0c){return new BPromise(function(_0x16cae5,_0x236c17){return client[_0x38d8('0xb')](_0x6a080d,_0x2aca0c)[_0x38d8('0xc')](function(_0x1806e4){logger[_0x38d8('0xd')](_0x38d8('0xe'),_0x4ad14a,_0x38d8('0xf'));logger[_0x38d8('0x10')](_0x38d8('0x11'),_0x4ad14a,_0x38d8('0xf'),JSON[_0x38d8('0x12')](_0x1806e4));if(_0x1806e4[_0x38d8('0x13')]){if(_0x1806e4[_0x38d8('0x13')][_0x38d8('0x14')]===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x4ad14a,_0x1806e4[_0x38d8('0x13')][_0x38d8('0x15')]);return _0x236c17(_0x1806e4['error'][_0x38d8('0x15')]);}logger[_0x38d8('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x4ad14a,_0x1806e4[_0x38d8('0x13')][_0x38d8('0x15')]);return _0x16cae5(_0x1806e4[_0x38d8('0x13')][_0x38d8('0x15')]);}else{logger['info'](_0x38d8('0xe'),_0x4ad14a,_0x38d8('0xf'));_0x16cae5(_0x1806e4[_0x38d8('0x16')][_0x38d8('0x15')]);}})[_0x38d8('0x17')](function(_0x232c74){logger['error'](_0x38d8('0xe'),_0x4ad14a,_0x232c74);_0x236c17(_0x232c74);});});} \ No newline at end of file +var _0x1ec7=['info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message'];(function(_0xfa1875,_0x59857d){var _0x224834=function(_0xd51103){while(--_0xd51103){_0xfa1875['push'](_0xfa1875['shift']());}};_0x224834(++_0x59857d);}(_0x1ec7,0x1a5));var _0x71ec=function(_0x1d5e09,_0xb8077d){_0x1d5e09=_0x1d5e09-0x0;var _0xd46850=_0x1ec7[_0x1d5e09];return _0xd46850;};'use strict';var _=require(_0x71ec('0x0'));var util=require('util');var moment=require(_0x71ec('0x1'));var BPromise=require('bluebird');var rs=require(_0x71ec('0x2'));var fs=require('fs');var Redis=require(_0x71ec('0x3'));var db=require(_0x71ec('0x4'))['db'];var utils=require(_0x71ec('0x5'));var logger=require(_0x71ec('0x6'))('rpc');var config=require(_0x71ec('0x7'));var jayson=require(_0x71ec('0x8'));var client=jayson['client'][_0x71ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x270586,_0x3b14d6,_0x448ceb){return new BPromise(function(_0x1d04e5,_0x56367d){return client['request'](_0x270586,_0x448ceb)[_0x71ec('0xa')](function(_0x4fa19e){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x3b14d6,_0x71ec('0xb'));logger[_0x71ec('0xc')](_0x71ec('0xd'),_0x3b14d6,_0x71ec('0xb'),JSON[_0x71ec('0xe')](_0x4fa19e));if(_0x4fa19e[_0x71ec('0xf')]){if(_0x4fa19e[_0x71ec('0xf')][_0x71ec('0x10')]===0x1f4){logger[_0x71ec('0xf')](_0x71ec('0x11'),_0x3b14d6,_0x4fa19e['error'][_0x71ec('0x12')]);return _0x56367d(_0x4fa19e[_0x71ec('0xf')][_0x71ec('0x12')]);}logger['error'](_0x71ec('0x11'),_0x3b14d6,_0x4fa19e[_0x71ec('0xf')][_0x71ec('0x12')]);return _0x1d04e5(_0x4fa19e[_0x71ec('0xf')][_0x71ec('0x12')]);}else{logger[_0x71ec('0x13')](_0x71ec('0x11'),_0x3b14d6,_0x71ec('0xb'));_0x1d04e5(_0x4fa19e[_0x71ec('0x14')][_0x71ec('0x12')]);}})[_0x71ec('0x15')](function(_0x47b47b){logger[_0x71ec('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x3b14d6,_0x47b47b);_0x56367d(_0x47b47b);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 0d86d33..426b018 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 _0x0334=['../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','/:id','show','post','isAuthenticated','put','update','destroy','exports','multer','path','Router','../../components/auth/service'];(function(_0x405e3a,_0x23939b){var _0x10f4f6=function(_0x2c3f57){while(--_0x2c3f57){_0x405e3a['push'](_0x405e3a['shift']());}};_0x10f4f6(++_0x23939b);}(_0x0334,0x172));var _0x4033=function(_0x47391a,_0x16b841){_0x47391a=_0x47391a-0x0;var _0x10d51c=_0x0334[_0x47391a];return _0x10d51c;};'use strict';var multer=require(_0x4033('0x0'));var util=require('util');var path=require(_0x4033('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4033('0x2')]();var auth=require(_0x4033('0x3'));var interaction=require(_0x4033('0x4'));var config=require(_0x4033('0x5'));var controller=require(_0x4033('0x6'));router[_0x4033('0x7')]('/',auth['isAuthenticated'](),controller[_0x4033('0x8')]);router['get'](_0x4033('0x9'),auth['isAuthenticated'](),controller[_0x4033('0xa')]);router[_0x4033('0xb')]('/',auth[_0x4033('0xc')](),controller['create']);router[_0x4033('0xd')](_0x4033('0x9'),auth[_0x4033('0xc')](),controller[_0x4033('0xe')]);router['delete'](_0x4033('0x9'),auth[_0x4033('0xc')](),controller[_0x4033('0xf')]);module[_0x4033('0x10')]=router; \ No newline at end of file +var _0x5865=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','post','create','put','update','delete','exports','util','path','express'];(function(_0x58532f,_0x150905){var _0x16ca71=function(_0x4bf398){while(--_0x4bf398){_0x58532f['push'](_0x58532f['shift']());}};_0x16ca71(++_0x150905);}(_0x5865,0xfc));var _0x5586=function(_0x45b805,_0x3256b9){_0x45b805=_0x45b805-0x0;var _0x40c931=_0x5865[_0x45b805];return _0x40c931;};'use strict';var multer=require('multer');var util=require(_0x5586('0x0'));var path=require(_0x5586('0x1'));var timeout=require('connect-timeout');var express=require(_0x5586('0x2'));var router=express['Router']();var auth=require(_0x5586('0x3'));var interaction=require(_0x5586('0x4'));var config=require(_0x5586('0x5'));var controller=require('./voiceContext.controller');router['get']('/',auth[_0x5586('0x6')](),controller['index']);router[_0x5586('0x7')](_0x5586('0x8'),auth[_0x5586('0x6')](),controller['show']);router[_0x5586('0x9')]('/',auth['isAuthenticated'](),controller[_0x5586('0xa')]);router[_0x5586('0xb')](_0x5586('0x8'),auth[_0x5586('0x6')](),controller[_0x5586('0xc')]);router[_0x5586('0xd')](_0x5586('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x5586('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 44b00c1..73f311c 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x2e244f,_0x538d7a){var _0x4c9395=function(_0x3d6cc7){while(--_0x3d6cc7){_0x2e244f['push'](_0x2e244f['shift']());}};_0x4c9395(++_0x538d7a);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x470922,_0x4c8d6e){var _0x42684d=function(_0x33c357){while(--_0x33c357){_0x470922['push'](_0x470922['shift']());}};_0x42684d(++_0x4c8d6e);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 336534f..cc46fb6 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 _0x3e74=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','get','Contexts','UserProfileResource','destroy','stack','name','send','map','VoiceContext','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','includeAll','findAll','show','params','include','find','create','join','root','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','readFileSync','server/files/templates/context.ejs','chan_sip.so','render','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','request','then'];(function(_0x33fe8b,_0x3b57df){var _0x2c1199=function(_0x3e2e05){while(--_0x3e2e05){_0x33fe8b['push'](_0x33fe8b['shift']());}};_0x2c1199(++_0x3b57df);}(_0x3e74,0x175));var _0x43e7=function(_0x30b36b,_0x400390){_0x30b36b=_0x30b36b-0x0;var _0x57e0a1=_0x3e74[_0x30b36b];return _0x57e0a1;};'use strict';var pdf=require(_0x43e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x43e7('0x1'));var zipdir=require(_0x43e7('0x2'));var jsonpatch=require(_0x43e7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x43e7('0x4'));var Mustache=require('mustache');var util=require(_0x43e7('0x5'));var path=require(_0x43e7('0x6'));var sox=require(_0x43e7('0x7'));var csv=require(_0x43e7('0x8'));var ejs=require(_0x43e7('0x9'));var fs=require('fs');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('0x8'));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 db=require('../../mysqldb')['db'];var jayson=require(_0x43e7('0x14'));var client=jayson[_0x43e7('0x15')][_0x43e7('0x16')]({'port':0x232a});function checkPasswordPattern(_0x3bb83f,_0x4e008c,_0x583d85){if(_0x583d85){var _0x2fcb36=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2fcb36[_0x43e7('0x17')](_0x4e008c)){return _0x3bb83f;}else{throw new db[(_0x43e7('0x18'))]['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~!@#$%^&-_=+[{]}.');}}else{return _0x3bb83f;}}function respondWithRpcPromise(_0x16849c,_0x14c146,_0x203378,_0x328445){return new BPromise(function(_0x4de324,_0x5c4eaa){var _0xdf16c=_0x328445||client;return _0xdf16c[_0x43e7('0x19')](_0x16849c,_0x203378)[_0x43e7('0x1a')](function(_0x5d346f){logger['info'](_0x43e7('0x1b'),_0x14c146,_0x43e7('0x1c'));logger[_0x43e7('0x1d')](_0x43e7('0x1e'),_0x14c146,_0x43e7('0x1c'),JSON[_0x43e7('0x1f')](_0x5d346f));if(_0x5d346f[_0x43e7('0x20')]){if(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x21')]===0x1f4){logger[_0x43e7('0x20')](_0x43e7('0x1b'),_0x14c146,_0x5d346f[_0x43e7('0x20')]['message']);return _0x5c4eaa(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);}logger['error'](_0x43e7('0x1b'),_0x14c146,_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);return _0x4de324(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);}else{logger[_0x43e7('0x23')]('VoiceContext,\x20%s,\x20%s',_0x14c146,_0x43e7('0x1c'));_0x4de324(_0x5d346f['result']['message']);}})[_0x43e7('0x24')](function(_0x43f4ff){logger['error'](_0x43e7('0x1b'),_0x14c146,_0x43f4ff);_0x5c4eaa(_0x43f4ff);});});}function respondWithStatusCode(_0x4ca5cf,_0x326dab){_0x326dab=_0x326dab||0xcc;return function(_0x5c5e67){if(_0x5c5e67){return _0x4ca5cf[_0x43e7('0x25')](_0x326dab);}return _0x4ca5cf[_0x43e7('0x26')](_0x326dab)[_0x43e7('0x27')]();};}function respondWithResult(_0x405f85,_0x51f4d7){_0x51f4d7=_0x51f4d7||0xc8;return function(_0x52b7b3){if(_0x52b7b3){return _0x405f85[_0x43e7('0x26')](_0x51f4d7)['json'](_0x52b7b3);}};}function respondWithFilteredResult(_0x2dd5f,_0x40dc8f){return function(_0x3565cf){if(_0x3565cf){var _0xb1fc63=_0x3565cf[_0x43e7('0x28')],_0x5087d7=_0x40dc8f[_0x43e7('0x29')],_0x33a1a5=_0x40dc8f[_0x43e7('0x29')]+_0x40dc8f[_0x43e7('0x2a')],_0x4690a6;if(_0x33a1a5>=_0xb1fc63){_0x33a1a5=_0xb1fc63;_0x4690a6=0xc8;}else{_0x4690a6=0xce;}_0x2dd5f[_0x43e7('0x26')](_0x4690a6);return _0x2dd5f[_0x43e7('0x2b')](_0x43e7('0x2c'),_0x5087d7+'-'+_0x33a1a5+'/'+_0xb1fc63)[_0x43e7('0x2d')](_0x3565cf);}return null;};}function patchUpdates(_0x17df44){return function(_0x19725a){try{jsonpatch[_0x43e7('0x2e')](_0x19725a,_0x17df44,!![]);}catch(_0x208706){return BPromise['reject'](_0x208706);}return _0x19725a[_0x43e7('0x2f')]();};}function saveUpdates(_0x44f6b0,_0x3b8f78){return function(_0x183c81){if(_0x183c81){return _0x183c81[_0x43e7('0x30')](_0x44f6b0)['then'](function(_0x1eba65){return _0x1eba65;});}return null;};}function removeEntity(_0x49b83d,_0x30d47e){return function(_0x3f280d){if(_0x3f280d){return _0x3f280d['destroy']()['then'](function(){var _0x5e203f=_0x3f280d[_0x43e7('0x31')]({'plain':!![]});var _0xbe6e28=_0x43e7('0x32');return db[_0x43e7('0x33')][_0x43e7('0x34')]({'where':{'type':_0xbe6e28,'resourceId':_0x5e203f['id']}})[_0x43e7('0x1a')](function(){return _0x3f280d;});})['then'](function(){_0x49b83d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59e5b2,_0x4e8e86){return function(_0x564f0e){if(!_0x564f0e){_0x59e5b2['sendStatus'](0x194);}return _0x564f0e;};}function handleError(_0x14d888,_0x49cda6){_0x49cda6=_0x49cda6||0x1f4;return function(_0x2b4bfd){logger[_0x43e7('0x20')](_0x2b4bfd[_0x43e7('0x35')]);if(_0x2b4bfd[_0x43e7('0x36')]){delete _0x2b4bfd[_0x43e7('0x36')];}_0x14d888[_0x43e7('0x26')](_0x49cda6)[_0x43e7('0x37')](_0x2b4bfd);};}exports['index']=function(_0x5332d9,_0x5d84f4){var _0xfa0474={},_0xfe70e9={},_0x199ff6={'count':0x0,'rows':[]};var _0x16cdba=_[_0x43e7('0x38')](db[_0x43e7('0x39')][_0x43e7('0x3a')],function(_0x2ffd43){return{'name':_0x2ffd43['fieldName'],'type':_0x2ffd43[_0x43e7('0x3b')][_0x43e7('0x3c')]};});_0xfe70e9['model']=_[_0x43e7('0x38')](_0x16cdba,'name');_0xfe70e9[_0x43e7('0x3d')]=_[_0x43e7('0x3e')](_0x5332d9[_0x43e7('0x3d')]);_0xfe70e9[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0xfe70e9[_0x43e7('0x41')],_0xfe70e9['query']);_0xfa0474['attributes']=_[_0x43e7('0x40')](_0xfe70e9[_0x43e7('0x41')],qs[_0x43e7('0x42')](_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x42')]));_0xfa0474['attributes']=_0xfa0474[_0x43e7('0x43')][_0x43e7('0x44')]?_0xfa0474['attributes']:_0xfe70e9[_0x43e7('0x41')];if(!_0x5332d9['query'][_0x43e7('0x45')]('nolimit')){_0xfa0474[_0x43e7('0x2a')]=qs[_0x43e7('0x2a')](_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x2a')]);_0xfa0474['offset']=qs['offset'](_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x29')]);}_0xfa0474[_0x43e7('0x46')]=qs[_0x43e7('0x47')](_0x5332d9['query']['sort']);_0xfa0474['where']=qs[_0x43e7('0x3f')](_['pick'](_0x5332d9[_0x43e7('0x3d')],_0xfe70e9['filters']),_0x16cdba);if(_0x5332d9['query'][_0x43e7('0x48')]){_0xfa0474['where']=_[_0x43e7('0x49')](_0xfa0474[_0x43e7('0x4a')],{'$or':_[_0x43e7('0x38')](_0x16cdba,function(_0x99b9e1){if(_0x99b9e1['type']!==_0x43e7('0x4b')){var _0x2b9046={};_0x2b9046[_0x99b9e1[_0x43e7('0x36')]]={'$like':'%'+_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x48')]+'%'};return _0x2b9046;}})});}_0xfa0474=_[_0x43e7('0x49')]({},_0xfa0474,_0x5332d9['options']);var _0x4930a2={'where':_0xfa0474[_0x43e7('0x4a')]};return db[_0x43e7('0x39')][_0x43e7('0x28')](_0x4930a2)['then'](function(_0x5c1c18){_0x199ff6['count']=_0x5c1c18;if(_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x4c')]){_0xfa0474['include']=[{'all':!![]}];}return db[_0x43e7('0x39')][_0x43e7('0x4d')](_0xfa0474);})[_0x43e7('0x1a')](function(_0x560329){_0x199ff6['rows']=_0x560329;return _0x199ff6;})['then'](respondWithFilteredResult(_0x5d84f4,_0xfa0474))['catch'](handleError(_0x5d84f4,null));};exports[_0x43e7('0x4e')]=function(_0xe955fc,_0x52fea5){var _0x23e7cb={'raw':![],'where':{'id':_0xe955fc[_0x43e7('0x4f')]['id']}},_0x82d32f={};_0x82d32f[_0x43e7('0x41')]=_['keys'](db[_0x43e7('0x39')]['rawAttributes']);_0x82d32f['query']=_[_0x43e7('0x3e')](_0xe955fc[_0x43e7('0x3d')]);_0x82d32f[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0x82d32f[_0x43e7('0x41')],_0x82d32f[_0x43e7('0x3d')]);_0x23e7cb[_0x43e7('0x43')]=_[_0x43e7('0x40')](_0x82d32f[_0x43e7('0x41')],qs[_0x43e7('0x42')](_0xe955fc['query'][_0x43e7('0x42')]));_0x23e7cb[_0x43e7('0x43')]=_0x23e7cb['attributes'][_0x43e7('0x44')]?_0x23e7cb['attributes']:_0x82d32f[_0x43e7('0x41')];if(_0xe955fc[_0x43e7('0x3d')][_0x43e7('0x4c')]){_0x23e7cb[_0x43e7('0x50')]=[{'all':!![]}];}_0x23e7cb=_[_0x43e7('0x49')]({},_0x23e7cb,_0xe955fc['options']);return db['VoiceContext'][_0x43e7('0x51')](_0x23e7cb)[_0x43e7('0x1a')](handleEntityNotFound(_0x52fea5,null))[_0x43e7('0x1a')](respondWithResult(_0x52fea5,null))[_0x43e7('0x24')](handleError(_0x52fea5,null));};exports[_0x43e7('0x52')]=function(_0x25bb44,_0xa47464,_0x44f8a0){var _0x26d86c;return db[_0x43e7('0x39')][_0x43e7('0x52')](_0x25bb44['body'],{'raw':!![]})[_0x43e7('0x1a')](function(_0x2da2f3){_0x26d86c=_0x2da2f3;return db['VoiceContext'][_0x43e7('0x4d')]({'raw':!![]});})[_0x43e7('0x1a')](function(_0x2d0052){var _0x558d54=fs['readFileSync'](path[_0x43e7('0x53')](config[_0x43e7('0x54')],'server/files/templates/context.ejs'),_0x43e7('0x55'));var _0x54506d=ejs['render'](_0x558d54,{'contexts':_0x2d0052||[]});fs[_0x43e7('0x56')](_0x43e7('0x57'),_0x54506d);})[_0x43e7('0x1a')](function(){return respondWithRpcPromise(_0x43e7('0x58'),_0x43e7('0x52'),{'module':'chan_sip.so'});})[_0x43e7('0x1a')](function(){var _0xdb9fbe=_0x25bb44['user'][_0x43e7('0x31')]({'plain':!![]});if(!_0xdb9fbe)throw new Error(_0x43e7('0x59'));if(_0xdb9fbe[_0x43e7('0x5a')]==='user'){var _0x5a4c95=_0x26d86c['get']({'plain':!![]});return db[_0x43e7('0x5b')][_0x43e7('0x51')]({'where':{'name':_0x43e7('0x32'),'userProfileId':_0xdb9fbe[_0x43e7('0x5c')]},'raw':!![]})['then'](function(_0x5a50fc){if(_0x5a50fc&&_0x5a50fc[_0x43e7('0x5d')]===0x0){return db[_0x43e7('0x33')][_0x43e7('0x52')]({'name':_0x5a4c95[_0x43e7('0x36')],'resourceId':_0x5a4c95['id'],'type':_0x5a50fc['name'],'sectionId':_0x5a50fc['id']},{})[_0x43e7('0x1a')](function(){return _0x26d86c;});}else{return _0x26d86c;}})[_0x43e7('0x24')](function(_0x23595c){logger[_0x43e7('0x20')](_0x43e7('0x5e'),_0x23595c);throw _0x23595c;});}return _0x26d86c;})[_0x43e7('0x1a')](respondWithResult(_0xa47464,0xc9))[_0x43e7('0x24')](handleError(_0xa47464,null));};exports[_0x43e7('0x30')]=function(_0x406155,_0x381208,_0x252f00){var _0x57fdfe;return db['VoiceContext'][_0x43e7('0x51')]({'where':{'id':_0x406155['params']['id']}})['then'](handleEntityNotFound(_0x381208,null))['then'](saveUpdates(_0x406155[_0x43e7('0x5f')],null))[_0x43e7('0x1a')](function(_0x5d7b37){if(_0x5d7b37){_0x57fdfe=_0x5d7b37;return db[_0x43e7('0x39')][_0x43e7('0x4d')]({'raw':!![]});}})[_0x43e7('0x1a')](function(_0x537a53){var _0x2b7406=fs[_0x43e7('0x60')](path[_0x43e7('0x53')](config[_0x43e7('0x54')],_0x43e7('0x61')),_0x43e7('0x55'));var _0x1e02fa=ejs['render'](_0x2b7406,{'contexts':_0x537a53||[]});fs[_0x43e7('0x56')](_0x43e7('0x57'),_0x1e02fa);})[_0x43e7('0x1a')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x43e7('0x62')});})['then'](function(){return _0x57fdfe;})['then'](respondWithResult(_0x381208,null))[_0x43e7('0x24')](handleError(_0x381208,null));};exports[_0x43e7('0x34')]=function(_0x5b5833,_0x88c7f,_0x28b21d){var _0x1e2fed;return db[_0x43e7('0x39')][_0x43e7('0x51')]({'where':{'id':_0x5b5833[_0x43e7('0x4f')]['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0x88c7f,null))['then'](removeEntity(_0x88c7f,null))[_0x43e7('0x1a')](function(){return db[_0x43e7('0x39')]['findAll']({'raw':!![]});})[_0x43e7('0x1a')](function(_0x5c2c5f){var _0x26ee52=fs[_0x43e7('0x60')](path[_0x43e7('0x53')](config[_0x43e7('0x54')],'server/files/templates/context.ejs'),_0x43e7('0x55'));var _0x2646c2=ejs[_0x43e7('0x63')](_0x26ee52,{'contexts':_0x5c2c5f});fs['writeFileSync'](_0x43e7('0x57'),_0x2646c2);return respondWithRpcPromise(_0x43e7('0x58'),_0x43e7('0x34'),{'module':_0x43e7('0x62')});})[_0x43e7('0x24')](handleError(_0x88c7f,null));}; \ No newline at end of file +var _0x34e8=['http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','Contexts','sendStatus','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','VoiceContext','includeAll','include','findAll','rows','show','length','create','body','join','root','utf8','render','writeFileSync','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client'];(function(_0x25804f,_0x2875d4){var _0x54c415=function(_0x4891bd){while(--_0x4891bd){_0x25804f['push'](_0x25804f['shift']());}};_0x54c415(++_0x2875d4);}(_0x34e8,0x12c));var _0x834e=function(_0x50b3eb,_0x56087e){_0x50b3eb=_0x50b3eb-0x0;var _0x27540b=_0x34e8[_0x50b3eb];return _0x27540b;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0x10'));var querystring=require(_0x834e('0x11'));var Papa=require(_0x834e('0x12'));var Redis=require(_0x834e('0x13'));var authService=require(_0x834e('0x14'));var qs=require(_0x834e('0x15'));var as=require(_0x834e('0x16'));var hardwareService=require(_0x834e('0x17'));var logger=require(_0x834e('0x18'))(_0x834e('0x19'));var utils=require(_0x834e('0x1a'));var config=require(_0x834e('0x1b'));var db=require(_0x834e('0x1c'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x834e('0x1d')][_0x834e('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x58a27e,_0x23848e,_0x2d95f2){if(_0x2d95f2){var _0x28e659=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28e659[_0x834e('0x1f')](_0x23848e)){return _0x58a27e;}else{throw new db['Sequelize'][(_0x834e('0x20'))](_0x834e('0x21'));}}else{return _0x58a27e;}}function respondWithRpcPromise(_0x57274a,_0x316205,_0x4a9cdc,_0x38a8cd){return new BPromise(function(_0x36d443,_0x478afe){var _0x43ac41=_0x38a8cd||client;return _0x43ac41[_0x834e('0x22')](_0x57274a,_0x4a9cdc)[_0x834e('0x23')](function(_0x50b3f6){logger[_0x834e('0x24')](_0x834e('0x25'),_0x316205,_0x834e('0x26'));logger[_0x834e('0x27')](_0x834e('0x28'),_0x316205,_0x834e('0x26'),JSON[_0x834e('0x29')](_0x50b3f6));if(_0x50b3f6['error']){if(_0x50b3f6[_0x834e('0x2a')][_0x834e('0x2b')]===0x1f4){logger[_0x834e('0x2a')](_0x834e('0x25'),_0x316205,_0x50b3f6['error'][_0x834e('0x2c')]);return _0x478afe(_0x50b3f6[_0x834e('0x2a')]['message']);}logger[_0x834e('0x2a')](_0x834e('0x25'),_0x316205,_0x50b3f6[_0x834e('0x2a')]['message']);return _0x36d443(_0x50b3f6['error'][_0x834e('0x2c')]);}else{logger[_0x834e('0x24')]('VoiceContext,\x20%s,\x20%s',_0x316205,_0x834e('0x26'));_0x36d443(_0x50b3f6[_0x834e('0x2d')]['message']);}})[_0x834e('0x2e')](function(_0x2e1983){logger[_0x834e('0x2a')]('VoiceContext,\x20%s,\x20%s',_0x316205,_0x2e1983);_0x478afe(_0x2e1983);});});}function respondWithStatusCode(_0x24fcf7,_0x3e310f){_0x3e310f=_0x3e310f||0xcc;return function(_0x5e1cc5){if(_0x5e1cc5){return _0x24fcf7['sendStatus'](_0x3e310f);}return _0x24fcf7[_0x834e('0x2f')](_0x3e310f)['end']();};}function respondWithResult(_0x2826ec,_0x3f1b0b){_0x3f1b0b=_0x3f1b0b||0xc8;return function(_0x3db026){if(_0x3db026){return _0x2826ec[_0x834e('0x2f')](_0x3f1b0b)[_0x834e('0x30')](_0x3db026);}};}function respondWithFilteredResult(_0x130cc5,_0x491919){return function(_0x510780){if(_0x510780){var _0x4dc64a=_0x510780[_0x834e('0x31')],_0x58c1d7=_0x491919['offset'],_0x2c7a8d=_0x491919[_0x834e('0x32')]+_0x491919[_0x834e('0x33')],_0x567cea;if(_0x2c7a8d>=_0x4dc64a){_0x2c7a8d=_0x4dc64a;_0x567cea=0xc8;}else{_0x567cea=0xce;}_0x130cc5[_0x834e('0x2f')](_0x567cea);return _0x130cc5[_0x834e('0x34')](_0x834e('0x35'),_0x58c1d7+'-'+_0x2c7a8d+'/'+_0x4dc64a)[_0x834e('0x30')](_0x510780);}return null;};}function patchUpdates(_0x3d149d){return function(_0xfaf716){try{jsonpatch[_0x834e('0x36')](_0xfaf716,_0x3d149d,!![]);}catch(_0x493289){return BPromise[_0x834e('0x37')](_0x493289);}return _0xfaf716['save']();};}function saveUpdates(_0x2c75c2,_0x3787b0){return function(_0x9ab921){if(_0x9ab921){return _0x9ab921[_0x834e('0x38')](_0x2c75c2)[_0x834e('0x23')](function(_0x4689c2){return _0x4689c2;});}return null;};}function removeEntity(_0x4696a1,_0x38cd29){return function(_0x358c31){if(_0x358c31){return _0x358c31[_0x834e('0x39')]()['then'](function(){var _0x2a3c7f=_0x358c31[_0x834e('0x3a')]({'plain':!![]});var _0x24a9df=_0x834e('0x3b');return db['UserProfileResource'][_0x834e('0x39')]({'where':{'type':_0x24a9df,'resourceId':_0x2a3c7f['id']}})[_0x834e('0x23')](function(){return _0x358c31;});})['then'](function(){_0x4696a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e58fa,_0x41bf4d){return function(_0x20c6ae){if(!_0x20c6ae){_0x3e58fa[_0x834e('0x3c')](0x194);}return _0x20c6ae;};}function handleError(_0x339e28,_0x1b76dd){_0x1b76dd=_0x1b76dd||0x1f4;return function(_0x4c2ef6){logger[_0x834e('0x2a')](_0x4c2ef6['stack']);if(_0x4c2ef6[_0x834e('0x3d')]){delete _0x4c2ef6[_0x834e('0x3d')];}_0x339e28['status'](_0x1b76dd)[_0x834e('0x3e')](_0x4c2ef6);};}exports[_0x834e('0x3f')]=function(_0x491c28,_0x481f70){var _0x388711={},_0xd0d43a={},_0x2e9383={'count':0x0,'rows':[]};var _0x130c23=_[_0x834e('0x40')](db['VoiceContext'][_0x834e('0x41')],function(_0x548d1d){return{'name':_0x548d1d['fieldName'],'type':_0x548d1d[_0x834e('0x42')]['key']};});_0xd0d43a[_0x834e('0x43')]=_[_0x834e('0x40')](_0x130c23,_0x834e('0x3d'));_0xd0d43a[_0x834e('0x44')]=_[_0x834e('0x45')](_0x491c28['query']);_0xd0d43a[_0x834e('0x46')]=_[_0x834e('0x47')](_0xd0d43a[_0x834e('0x43')],_0xd0d43a['query']);_0x388711[_0x834e('0x48')]=_[_0x834e('0x47')](_0xd0d43a['model'],qs[_0x834e('0x49')](_0x491c28['query'][_0x834e('0x49')]));_0x388711[_0x834e('0x48')]=_0x388711['attributes']['length']?_0x388711[_0x834e('0x48')]:_0xd0d43a[_0x834e('0x43')];if(!_0x491c28[_0x834e('0x44')][_0x834e('0x4a')](_0x834e('0x4b'))){_0x388711[_0x834e('0x33')]=qs[_0x834e('0x33')](_0x491c28['query'][_0x834e('0x33')]);_0x388711['offset']=qs[_0x834e('0x32')](_0x491c28['query'][_0x834e('0x32')]);}_0x388711['order']=qs[_0x834e('0x4c')](_0x491c28[_0x834e('0x44')]['sort']);_0x388711[_0x834e('0x4d')]=qs[_0x834e('0x46')](_[_0x834e('0x4e')](_0x491c28[_0x834e('0x44')],_0xd0d43a[_0x834e('0x46')]),_0x130c23);if(_0x491c28[_0x834e('0x44')][_0x834e('0x4f')]){_0x388711[_0x834e('0x4d')]=_[_0x834e('0x50')](_0x388711[_0x834e('0x4d')],{'$or':_['map'](_0x130c23,function(_0x3124be){if(_0x3124be[_0x834e('0x42')]!=='VIRTUAL'){var _0x112306={};_0x112306[_0x3124be[_0x834e('0x3d')]]={'$like':'%'+_0x491c28[_0x834e('0x44')][_0x834e('0x4f')]+'%'};return _0x112306;}})});}_0x388711=_[_0x834e('0x50')]({},_0x388711,_0x491c28[_0x834e('0x51')]);var _0x4eab06={'where':_0x388711['where']};return db[_0x834e('0x52')][_0x834e('0x31')](_0x4eab06)[_0x834e('0x23')](function(_0x40ff5a){_0x2e9383[_0x834e('0x31')]=_0x40ff5a;if(_0x491c28[_0x834e('0x44')][_0x834e('0x53')]){_0x388711[_0x834e('0x54')]=[{'all':!![]}];}return db[_0x834e('0x52')][_0x834e('0x55')](_0x388711);})[_0x834e('0x23')](function(_0x385435){_0x2e9383[_0x834e('0x56')]=_0x385435;return _0x2e9383;})[_0x834e('0x23')](respondWithFilteredResult(_0x481f70,_0x388711))[_0x834e('0x2e')](handleError(_0x481f70,null));};exports[_0x834e('0x57')]=function(_0x3df078,_0x32b8f7){var _0x420841={'raw':![],'where':{'id':_0x3df078['params']['id']}},_0x1adf86={};_0x1adf86[_0x834e('0x43')]=_[_0x834e('0x45')](db['VoiceContext'][_0x834e('0x41')]);_0x1adf86[_0x834e('0x44')]=_['keys'](_0x3df078[_0x834e('0x44')]);_0x1adf86[_0x834e('0x46')]=_[_0x834e('0x47')](_0x1adf86[_0x834e('0x43')],_0x1adf86[_0x834e('0x44')]);_0x420841[_0x834e('0x48')]=_[_0x834e('0x47')](_0x1adf86['model'],qs[_0x834e('0x49')](_0x3df078[_0x834e('0x44')][_0x834e('0x49')]));_0x420841[_0x834e('0x48')]=_0x420841[_0x834e('0x48')][_0x834e('0x58')]?_0x420841[_0x834e('0x48')]:_0x1adf86[_0x834e('0x43')];if(_0x3df078['query'][_0x834e('0x53')]){_0x420841['include']=[{'all':!![]}];}_0x420841=_[_0x834e('0x50')]({},_0x420841,_0x3df078['options']);return db[_0x834e('0x52')]['find'](_0x420841)['then'](handleEntityNotFound(_0x32b8f7,null))[_0x834e('0x23')](respondWithResult(_0x32b8f7,null))[_0x834e('0x2e')](handleError(_0x32b8f7,null));};exports['create']=function(_0x5be43d,_0x2c8155,_0x2452b4){var _0x138ed2;return db[_0x834e('0x52')][_0x834e('0x59')](_0x5be43d[_0x834e('0x5a')],{'raw':!![]})[_0x834e('0x23')](function(_0x4273f1){_0x138ed2=_0x4273f1;return db['VoiceContext'][_0x834e('0x55')]({'raw':!![]});})[_0x834e('0x23')](function(_0x5d5ac2){var _0x281342=fs['readFileSync'](path[_0x834e('0x5b')](config[_0x834e('0x5c')],'server/files/templates/context.ejs'),_0x834e('0x5d'));var _0x37ee0e=ejs[_0x834e('0x5e')](_0x281342,{'contexts':_0x5d5ac2||[]});fs[_0x834e('0x5f')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x37ee0e);})[_0x834e('0x23')](function(){return respondWithRpcPromise(_0x834e('0x60'),_0x834e('0x59'),{'module':'chan_sip.so'});})[_0x834e('0x23')](function(){var _0x1fcae9=_0x5be43d[_0x834e('0x61')][_0x834e('0x3a')]({'plain':!![]});if(!_0x1fcae9)throw new Error(_0x834e('0x62'));if(_0x1fcae9[_0x834e('0x63')]===_0x834e('0x61')){var _0x1def00=_0x138ed2[_0x834e('0x3a')]({'plain':!![]});return db[_0x834e('0x64')][_0x834e('0x65')]({'where':{'name':_0x834e('0x3b'),'userProfileId':_0x1fcae9[_0x834e('0x66')]},'raw':!![]})[_0x834e('0x23')](function(_0x460a7a){if(_0x460a7a&&_0x460a7a[_0x834e('0x67')]===0x0){return db[_0x834e('0x68')][_0x834e('0x59')]({'name':_0x1def00[_0x834e('0x3d')],'resourceId':_0x1def00['id'],'type':_0x460a7a[_0x834e('0x3d')],'sectionId':_0x460a7a['id']},{})[_0x834e('0x23')](function(){return _0x138ed2;});}else{return _0x138ed2;}})[_0x834e('0x2e')](function(_0x5c83eb){logger[_0x834e('0x2a')](_0x834e('0x69'),_0x5c83eb);throw _0x5c83eb;});}return _0x138ed2;})[_0x834e('0x23')](respondWithResult(_0x2c8155,0xc9))[_0x834e('0x2e')](handleError(_0x2c8155,null));};exports['update']=function(_0x30faa8,_0x5a9c70,_0x56a152){var _0x2fdb1b;return db[_0x834e('0x52')][_0x834e('0x65')]({'where':{'id':_0x30faa8[_0x834e('0x6a')]['id']}})[_0x834e('0x23')](handleEntityNotFound(_0x5a9c70,null))[_0x834e('0x23')](saveUpdates(_0x30faa8[_0x834e('0x5a')],null))[_0x834e('0x23')](function(_0x525ed3){if(_0x525ed3){_0x2fdb1b=_0x525ed3;return db[_0x834e('0x52')]['findAll']({'raw':!![]});}})[_0x834e('0x23')](function(_0xd35dda){var _0x514fe5=fs['readFileSync'](path[_0x834e('0x5b')](config[_0x834e('0x5c')],_0x834e('0x6b')),_0x834e('0x5d'));var _0x2c41bd=ejs['render'](_0x514fe5,{'contexts':_0xd35dda||[]});fs[_0x834e('0x5f')](_0x834e('0x6c'),_0x2c41bd);})[_0x834e('0x23')](function(){return respondWithRpcPromise(_0x834e('0x60'),_0x834e('0x38'),{'module':_0x834e('0x6d')});})[_0x834e('0x23')](function(){return _0x2fdb1b;})[_0x834e('0x23')](respondWithResult(_0x5a9c70,null))[_0x834e('0x2e')](handleError(_0x5a9c70,null));};exports[_0x834e('0x39')]=function(_0x5b2bf6,_0x1b158b,_0x2e4d80){var _0x42fc96;return db[_0x834e('0x52')]['find']({'where':{'id':_0x5b2bf6[_0x834e('0x6a')]['id']}})['then'](handleEntityNotFound(_0x1b158b,null))['then'](removeEntity(_0x1b158b,null))['then'](function(){return db[_0x834e('0x52')][_0x834e('0x55')]({'raw':!![]});})['then'](function(_0x2645df){var _0x1b200d=fs['readFileSync'](path[_0x834e('0x5b')](config[_0x834e('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x346be5=ejs[_0x834e('0x5e')](_0x1b200d,{'contexts':_0x2645df});fs[_0x834e('0x5f')](_0x834e('0x6c'),_0x346be5);return respondWithRpcPromise(_0x834e('0x60'),'destroy',{'module':_0x834e('0x6d')});})['catch'](handleError(_0x1b158b,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 7c6c65b..0844e02 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 _0xd392=['./voiceContext.attributes','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x5244c1,_0x1d792a){var _0x51f7a0=function(_0x1b12f8){while(--_0x1b12f8){_0x5244c1['push'](_0x5244c1['shift']());}};_0x51f7a0(++_0x1d792a);}(_0xd392,0x1d1));var _0x2d39=function(_0x5aeb24,_0x49ec6a){_0x5aeb24=_0x5aeb24-0x0;var _0x29503b=_0xd392[_0x5aeb24];return _0x29503b;};'use strict';var _=require(_0x2d39('0x0'));var util=require(_0x2d39('0x1'));var logger=require(_0x2d39('0x2'))(_0x2d39('0x3'));var moment=require('moment');var BPromise=require(_0x2d39('0x4'));var rp=require(_0x2d39('0x5'));var fs=require('fs');var path=require(_0x2d39('0x6'));var rimraf=require('rimraf');var config=require(_0x2d39('0x7'));var attributes=require(_0x2d39('0x8'));module['exports']=function(_0x234f4d,_0x98316){return _0x234f4d['define'](_0x2d39('0x9'),attributes,{'tableName':_0x2d39('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x377b=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','voice_contexts','lodash'];(function(_0x32dd49,_0x461c61){var _0x3153cc=function(_0x1ddb25){while(--_0x1ddb25){_0x32dd49['push'](_0x32dd49['shift']());}};_0x3153cc(++_0x461c61);}(_0x377b,0xa9));var _0xb377=function(_0x342a88,_0x39ad88){_0x342a88=_0x342a88-0x0;var _0x58d453=_0x377b[_0x342a88];return _0x58d453;};'use strict';var _=require(_0xb377('0x0'));var util=require(_0xb377('0x1'));var logger=require(_0xb377('0x2'))(_0xb377('0x3'));var moment=require(_0xb377('0x4'));var BPromise=require(_0xb377('0x5'));var rp=require(_0xb377('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb377('0x7'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0xb377('0x8')]=function(_0xc9ece6,_0x2db81d){return _0xc9ece6['define']('VoiceContext',attributes,{'tableName':_0xb377('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 a5aea51..76876f7 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 _0x175e=['client','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0xb8d677,_0x2806bd){var _0x34cd31=function(_0xc53a06){while(--_0xc53a06){_0xb8d677['push'](_0xb8d677['shift']());}};_0x34cd31(++_0x2806bd);}(_0x175e,0x114));var _0xe175=function(_0x57df4e,_0x2acb6d){_0x57df4e=_0x57df4e-0x0;var _0x29f72e=_0x175e[_0x57df4e];return _0x29f72e;};'use strict';var _=require(_0xe175('0x0'));var util=require(_0xe175('0x1'));var moment=require(_0xe175('0x2'));var BPromise=require(_0xe175('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe175('0x4'));var db=require(_0xe175('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe175('0x6'))('rpc');var config=require(_0xe175('0x7'));var jayson=require(_0xe175('0x8'));var client=jayson[_0xe175('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x363218,_0x1d315b,_0x519bd2){return new BPromise(function(_0x137469,_0x4fcbab){return client['request'](_0x363218,_0x519bd2)['then'](function(_0x105262){logger[_0xe175('0xa')]('VoiceContext,\x20%s,\x20%s',_0x1d315b,'request\x20sent');logger[_0xe175('0xb')](_0xe175('0xc'),_0x1d315b,_0xe175('0xd'),JSON['stringify'](_0x105262));if(_0x105262['error']){if(_0x105262[_0xe175('0xe')]['code']===0x1f4){logger['error'](_0xe175('0xf'),_0x1d315b,_0x105262[_0xe175('0xe')]['message']);return _0x4fcbab(_0x105262[_0xe175('0xe')][_0xe175('0x10')]);}logger['error'](_0xe175('0xf'),_0x1d315b,_0x105262[_0xe175('0xe')][_0xe175('0x10')]);return _0x137469(_0x105262[_0xe175('0xe')][_0xe175('0x10')]);}else{logger[_0xe175('0xa')](_0xe175('0xf'),_0x1d315b,_0xe175('0xd'));_0x137469(_0x105262[_0xe175('0x11')][_0xe175('0x10')]);}})[_0xe175('0x12')](function(_0x549864){logger[_0xe175('0xe')](_0xe175('0xf'),_0x1d315b,_0x549864);_0x4fcbab(_0x549864);});});} \ No newline at end of file +var _0x14de=['debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0xd4483d,_0x4b93b0){var _0x32e775=function(_0x16f75b){while(--_0x16f75b){_0xd4483d['push'](_0xd4483d['shift']());}};_0x32e775(++_0x4b93b0);}(_0x14de,0x128));var _0xe14d=function(_0x139201,_0x296837){_0x139201=_0x139201-0x0;var _0x1f4e1c=_0x14de[_0x139201];return _0x1f4e1c;};'use strict';var _=require(_0xe14d('0x0'));var util=require(_0xe14d('0x1'));var moment=require(_0xe14d('0x2'));var BPromise=require(_0xe14d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe14d('0x4'));var db=require(_0xe14d('0x5'))['db'];var utils=require(_0xe14d('0x6'));var logger=require(_0xe14d('0x7'))(_0xe14d('0x8'));var config=require(_0xe14d('0x9'));var jayson=require(_0xe14d('0xa'));var client=jayson[_0xe14d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14114b,_0x424dd5,_0x5d2917){return new BPromise(function(_0x3eade7,_0x84a3a4){return client[_0xe14d('0xc')](_0x14114b,_0x5d2917)[_0xe14d('0xd')](function(_0x5cf035){logger[_0xe14d('0xe')](_0xe14d('0xf'),_0x424dd5,'request\x20sent');logger[_0xe14d('0x10')](_0xe14d('0x11'),_0x424dd5,_0xe14d('0x12'),JSON[_0xe14d('0x13')](_0x5cf035));if(_0x5cf035[_0xe14d('0x14')]){if(_0x5cf035[_0xe14d('0x14')][_0xe14d('0x15')]===0x1f4){logger[_0xe14d('0x14')](_0xe14d('0xf'),_0x424dd5,_0x5cf035[_0xe14d('0x14')][_0xe14d('0x16')]);return _0x84a3a4(_0x5cf035[_0xe14d('0x14')]['message']);}logger[_0xe14d('0x14')](_0xe14d('0xf'),_0x424dd5,_0x5cf035[_0xe14d('0x14')]['message']);return _0x3eade7(_0x5cf035[_0xe14d('0x14')][_0xe14d('0x16')]);}else{logger[_0xe14d('0xe')](_0xe14d('0xf'),_0x424dd5,_0xe14d('0x12'));_0x3eade7(_0x5cf035[_0xe14d('0x17')][_0xe14d('0x16')]);}})['catch'](function(_0x44c8f0){logger[_0xe14d('0x14')](_0xe14d('0xf'),_0x424dd5,_0x44c8f0);_0x84a3a4(_0x44c8f0);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 6bcc90b..58b2025 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 _0x3104=['exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3104,0x85));var _0x4310=function(_0x8b2e94,_0x401aec){_0x8b2e94=_0x8b2e94-0x0;var _0x56c175=_0x3104[_0x8b2e94];return _0x56c175;};'use strict';var multer=require(_0x4310('0x0'));var util=require(_0x4310('0x1'));var path=require(_0x4310('0x2'));var timeout=require('connect-timeout');var express=require(_0x4310('0x3'));var router=express[_0x4310('0x4')]();var auth=require(_0x4310('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4310('0x6'));var controller=require(_0x4310('0x7'));router[_0x4310('0x8')]('/',auth[_0x4310('0x9')](),controller[_0x4310('0xa')]);router[_0x4310('0x8')](_0x4310('0xb'),auth[_0x4310('0x9')](),controller[_0x4310('0xc')]);router[_0x4310('0x8')](_0x4310('0xd'),auth['isAuthenticated'](),controller[_0x4310('0xe')]);router[_0x4310('0xf')]('/',auth['isAuthenticated'](),controller[_0x4310('0x10')]);router[_0x4310('0x11')](_0x4310('0xd'),auth[_0x4310('0x9')](),controller[_0x4310('0x12')]);router[_0x4310('0x13')](_0x4310('0xd'),auth['isAuthenticated'](),controller[_0x4310('0x14')]);module[_0x4310('0x15')]=router; \ No newline at end of file +var _0x37c1=['exports','util','express','Router','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','update','delete'];(function(_0x3cb484,_0x25e280){var _0x53537b=function(_0x14ebdf){while(--_0x14ebdf){_0x3cb484['push'](_0x3cb484['shift']());}};_0x53537b(++_0x25e280);}(_0x37c1,0xa6));var _0x137c=function(_0xf3d3d,_0x18c710){_0xf3d3d=_0xf3d3d-0x0;var _0x1e5511=_0x37c1[_0xf3d3d];return _0x1e5511;};'use strict';var multer=require('multer');var util=require(_0x137c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x137c('0x1'));var router=express[_0x137c('0x2')]();var auth=require(_0x137c('0x3'));var interaction=require(_0x137c('0x4'));var config=require('../../config/environment');var controller=require(_0x137c('0x5'));router[_0x137c('0x6')]('/',auth[_0x137c('0x7')](),controller[_0x137c('0x8')]);router[_0x137c('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x137c('0x9')]);router[_0x137c('0x6')](_0x137c('0xa'),auth[_0x137c('0x7')](),controller[_0x137c('0xb')]);router['post']('/',auth[_0x137c('0x7')](),controller['create']);router['put'](_0x137c('0xa'),auth[_0x137c('0x7')](),controller[_0x137c('0xc')]);router[_0x137c('0xd')](_0x137c('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x137c('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index e82e8da..fdc0511 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 _0xfcff=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xfcff,0x1af));var _0xffcf=function(_0x5564f7,_0x34ed3c){_0x5564f7=_0x5564f7-0x0;var _0x1c2ec8=_0xfcff[_0x5564f7];return _0x1c2ec8;};'use strict';var Sequelize=require(_0xffcf('0x0'));module[_0xffcf('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xffcf('0x2')]},'channelstatedesc':{'type':Sequelize[_0xffcf('0x3')]},'calleridnum':{'type':Sequelize[_0xffcf('0x3')]},'calleridname':{'type':Sequelize[_0xffcf('0x3')]},'connectedlinenum':{'type':Sequelize[_0xffcf('0x3')]},'connectedlinename':{'type':Sequelize[_0xffcf('0x3')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xffcf('0x3')]},'context':{'type':Sequelize[_0xffcf('0x3')]},'exten':{'type':Sequelize[_0xffcf('0x3')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xffcf('0x3')]},'destchannel':{'type':Sequelize[_0xffcf('0x3')]},'destchannelstate':{'type':Sequelize[_0xffcf('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xffcf('0x3')]},'destconnectedlinenum':{'type':Sequelize[_0xffcf('0x3')]},'destconnectedlinename':{'type':Sequelize[_0xffcf('0x3')]},'destlanguage':{'type':Sequelize[_0xffcf('0x3')]},'destaccountcode':{'type':Sequelize[_0xffcf('0x3')]},'destcontext':{'type':Sequelize[_0xffcf('0x3')]},'destexten':{'type':Sequelize[_0xffcf('0x3')]},'destpriority':{'type':Sequelize[_0xffcf('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0xffcf('0x3')]},'dialstring':{'type':Sequelize[_0xffcf('0x3')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xffcf('0x4')]},'answertime':{'type':Sequelize[_0xffcf('0x4')]},'endtime':{'type':Sequelize[_0xffcf('0x4')]},'lastevent':{'type':Sequelize[_0xffcf('0x3')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xffcf('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xffcf('0x2')]},'billableseconds':{'type':Sequelize[_0xffcf('0x2')]}}; \ No newline at end of file +var _0xa32c=['INTEGER','sequelize','exports','STRING','DATE','called,connect,complete'];(function(_0x43d306,_0x55f1f7){var _0x5444c=function(_0x5e4803){while(--_0x5e4803){_0x43d306['push'](_0x43d306['shift']());}};_0x5444c(++_0x55f1f7);}(_0xa32c,0xd3));var _0xca32=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa32c[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xca32('0x0'));module[_0xca32('0x1')]={'privilege':{'type':Sequelize[_0xca32('0x2')]},'channel':{'type':Sequelize[_0xca32('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xca32('0x2')]},'calleridnum':{'type':Sequelize[_0xca32('0x2')]},'calleridname':{'type':Sequelize[_0xca32('0x2')]},'connectedlinenum':{'type':Sequelize[_0xca32('0x2')]},'connectedlinename':{'type':Sequelize[_0xca32('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xca32('0x2')]},'context':{'type':Sequelize[_0xca32('0x2')]},'exten':{'type':Sequelize[_0xca32('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xca32('0x2')]},'linkedid':{'type':Sequelize[_0xca32('0x2')]},'destchannel':{'type':Sequelize[_0xca32('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xca32('0x2')]},'destcalleridnum':{'type':Sequelize[_0xca32('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xca32('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xca32('0x2')]},'destlanguage':{'type':Sequelize[_0xca32('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xca32('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0xca32('0x2')]},'dialstring':{'type':Sequelize[_0xca32('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xca32('0x3')]},'lastevent':{'type':Sequelize[_0xca32('0x2')],'comment':_0xca32('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xca32('0x5')]},'holdtime':{'type':Sequelize[_0xca32('0x5')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 5b97860..6a83f22 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 _0xbb8f=['find','catch','create','body','update','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','then','name','index','VoiceDialReport','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','nolimit','sort','filters','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xbb8f,0x99));var _0xfbb8=function(_0x280652,_0x2e87a4){_0x280652=_0x280652-0x0;var _0x505219=_0xbb8f[_0x280652];return _0x505219;};'use strict';var pdf=require(_0xfbb8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfbb8('0x1'));var zipdir=require(_0xfbb8('0x2'));var jsonpatch=require(_0xfbb8('0x3'));var rp=require(_0xfbb8('0x4'));var moment=require(_0xfbb8('0x5'));var BPromise=require(_0xfbb8('0x6'));var Mustache=require(_0xfbb8('0x7'));var util=require(_0xfbb8('0x8'));var path=require(_0xfbb8('0x9'));var sox=require(_0xfbb8('0xa'));var csv=require(_0xfbb8('0xb'));var ejs=require(_0xfbb8('0xc'));var fs=require('fs');var _=require(_0xfbb8('0xd'));var squel=require(_0xfbb8('0xe'));var crypto=require(_0xfbb8('0xf'));var jsforce=require(_0xfbb8('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfbb8('0x11'));var authService=require(_0xfbb8('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfbb8('0x13'));var logger=require(_0xfbb8('0x14'))(_0xfbb8('0x15'));var utils=require(_0xfbb8('0x16'));var config=require(_0xfbb8('0x17'));var db=require(_0xfbb8('0x18'))['db'];function respondWithStatusCode(_0x36350d,_0x248b3b){_0x248b3b=_0x248b3b||0xcc;return function(_0x38142b){if(_0x38142b){return _0x36350d[_0xfbb8('0x19')](_0x248b3b);}return _0x36350d['status'](_0x248b3b)[_0xfbb8('0x1a')]();};}function respondWithResult(_0x1ca9b0,_0x5859b7){_0x5859b7=_0x5859b7||0xc8;return function(_0x318065){if(_0x318065){return _0x1ca9b0['status'](_0x5859b7)[_0xfbb8('0x1b')](_0x318065);}};}function respondWithFilteredResult(_0x1c66cc,_0x104a71){return function(_0x550db6){if(_0x550db6){var _0x37740b=_0x550db6[_0xfbb8('0x1c')],_0x3ecc3b=_0x104a71[_0xfbb8('0x1d')],_0x140e44=_0x104a71[_0xfbb8('0x1d')]+_0x104a71[_0xfbb8('0x1e')],_0x2b8748;if(_0x140e44>=_0x37740b){_0x140e44=_0x37740b;_0x2b8748=0xc8;}else{_0x2b8748=0xce;}_0x1c66cc[_0xfbb8('0x1f')](_0x2b8748);return _0x1c66cc[_0xfbb8('0x20')]('Content-Range',_0x3ecc3b+'-'+_0x140e44+'/'+_0x37740b)[_0xfbb8('0x1b')](_0x550db6);}return null;};}function patchUpdates(_0x5737f2){return function(_0x5cfc07){try{jsonpatch[_0xfbb8('0x21')](_0x5cfc07,_0x5737f2,!![]);}catch(_0x489908){return BPromise[_0xfbb8('0x22')](_0x489908);}return _0x5cfc07[_0xfbb8('0x23')]();};}function saveUpdates(_0x33bb77,_0x44bfb8){return function(_0x18dd61){if(_0x18dd61){return _0x18dd61['update'](_0x33bb77)[_0xfbb8('0x24')](function(_0x2da122){return _0x2da122;});}return null;};}function removeEntity(_0x5bdca5,_0x2c74a){return function(_0x46c765){if(_0x46c765){return _0x46c765['destroy']()[_0xfbb8('0x24')](function(){_0x5bdca5[_0xfbb8('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b1cee,_0xcf759a){return function(_0xda4a4f){if(!_0xda4a4f){_0x1b1cee[_0xfbb8('0x19')](0x194);}return _0xda4a4f;};}function handleError(_0x45565a,_0x5c4f0e){_0x5c4f0e=_0x5c4f0e||0x1f4;return function(_0x4b74a9){logger['error'](_0x4b74a9['stack']);if(_0x4b74a9['name']){delete _0x4b74a9[_0xfbb8('0x25')];}_0x45565a['status'](_0x5c4f0e)['send'](_0x4b74a9);};}exports[_0xfbb8('0x26')]=function(_0x2e9657,_0x5372eb){var _0x14c32e={},_0x22ecac={},_0x561e76={'count':0x0,'rows':[]};var _0x540161=_['map'](db[_0xfbb8('0x27')][_0xfbb8('0x28')],function(_0x23d4c5){return{'name':_0x23d4c5[_0xfbb8('0x29')],'type':_0x23d4c5['type'][_0xfbb8('0x2a')]};});_0x22ecac[_0xfbb8('0x2b')]=_[_0xfbb8('0x2c')](_0x540161,'name');_0x22ecac[_0xfbb8('0x2d')]=_['keys'](_0x2e9657[_0xfbb8('0x2d')]);_0x22ecac['filters']=_[_0xfbb8('0x2e')](_0x22ecac['model'],_0x22ecac['query']);_0x14c32e[_0xfbb8('0x2f')]=_[_0xfbb8('0x2e')](_0x22ecac['model'],qs[_0xfbb8('0x30')](_0x2e9657['query'][_0xfbb8('0x30')]));_0x14c32e[_0xfbb8('0x2f')]=_0x14c32e[_0xfbb8('0x2f')][_0xfbb8('0x31')]?_0x14c32e[_0xfbb8('0x2f')]:_0x22ecac[_0xfbb8('0x2b')];if(!_0x2e9657[_0xfbb8('0x2d')]['hasOwnProperty'](_0xfbb8('0x32'))){_0x14c32e['limit']=qs[_0xfbb8('0x1e')](_0x2e9657[_0xfbb8('0x2d')]['limit']);_0x14c32e[_0xfbb8('0x1d')]=qs[_0xfbb8('0x1d')](_0x2e9657[_0xfbb8('0x2d')][_0xfbb8('0x1d')]);}_0x14c32e['order']=qs[_0xfbb8('0x33')](_0x2e9657[_0xfbb8('0x2d')][_0xfbb8('0x33')]);_0x14c32e['where']=qs[_0xfbb8('0x34')](_[_0xfbb8('0x35')](_0x2e9657['query'],_0x22ecac['filters']),_0x540161);if(_0x2e9657[_0xfbb8('0x2d')]['filter']){_0x14c32e['where']=_[_0xfbb8('0x36')](_0x14c32e[_0xfbb8('0x37')],{'$or':_[_0xfbb8('0x2c')](_0x540161,function(_0x1c14a3){if(_0x1c14a3['type']!==_0xfbb8('0x38')){var _0x4f56bf={};_0x4f56bf[_0x1c14a3[_0xfbb8('0x25')]]={'$like':'%'+_0x2e9657[_0xfbb8('0x2d')][_0xfbb8('0x39')]+'%'};return _0x4f56bf;}})});}_0x14c32e=_['merge']({},_0x14c32e,_0x2e9657[_0xfbb8('0x3a')]);var _0x11f31c={'where':_0x14c32e[_0xfbb8('0x37')]};return db['VoiceDialReport'][_0xfbb8('0x1c')](_0x11f31c)['then'](function(_0x259e27){_0x561e76[_0xfbb8('0x1c')]=_0x259e27;if(_0x2e9657['query'][_0xfbb8('0x3b')]){_0x14c32e[_0xfbb8('0x3c')]=[{'all':!![]}];}return db[_0xfbb8('0x27')][_0xfbb8('0x3d')](_0x14c32e);})[_0xfbb8('0x24')](function(_0x40817f){_0x561e76[_0xfbb8('0x3e')]=_0x40817f;return _0x561e76;})[_0xfbb8('0x24')](respondWithFilteredResult(_0x5372eb,_0x14c32e))['catch'](handleError(_0x5372eb,null));};exports[_0xfbb8('0x3f')]=function(_0x5a8048,_0x3e631d){var _0x4e6766={'raw':!![],'where':{'id':_0x5a8048[_0xfbb8('0x40')]['id']}},_0xba1eba={};_0xba1eba['model']=_[_0xfbb8('0x41')](db[_0xfbb8('0x27')][_0xfbb8('0x28')]);_0xba1eba[_0xfbb8('0x2d')]=_[_0xfbb8('0x41')](_0x5a8048[_0xfbb8('0x2d')]);_0xba1eba[_0xfbb8('0x34')]=_[_0xfbb8('0x2e')](_0xba1eba[_0xfbb8('0x2b')],_0xba1eba[_0xfbb8('0x2d')]);_0x4e6766[_0xfbb8('0x2f')]=_[_0xfbb8('0x2e')](_0xba1eba[_0xfbb8('0x2b')],qs[_0xfbb8('0x30')](_0x5a8048[_0xfbb8('0x2d')][_0xfbb8('0x30')]));_0x4e6766[_0xfbb8('0x2f')]=_0x4e6766[_0xfbb8('0x2f')]['length']?_0x4e6766['attributes']:_0xba1eba['model'];if(_0x5a8048[_0xfbb8('0x2d')][_0xfbb8('0x3b')]){_0x4e6766[_0xfbb8('0x3c')]=[{'all':!![]}];}_0x4e6766=_[_0xfbb8('0x36')]({},_0x4e6766,_0x5a8048[_0xfbb8('0x3a')]);return db['VoiceDialReport'][_0xfbb8('0x42')](_0x4e6766)['then'](handleEntityNotFound(_0x3e631d,null))['then'](respondWithResult(_0x3e631d,null))[_0xfbb8('0x43')](handleError(_0x3e631d,null));};exports[_0xfbb8('0x44')]=function(_0x4bc9aa,_0x1e50c9){return db[_0xfbb8('0x27')][_0xfbb8('0x44')](_0x4bc9aa[_0xfbb8('0x45')],{})[_0xfbb8('0x24')](respondWithResult(_0x1e50c9,0xc9))[_0xfbb8('0x43')](handleError(_0x1e50c9,null));};exports[_0xfbb8('0x46')]=function(_0x327e5d,_0x14b7ca){if(_0x327e5d['body']['id']){delete _0x327e5d[_0xfbb8('0x45')]['id'];}return db[_0xfbb8('0x27')]['find']({'where':{'id':_0x327e5d[_0xfbb8('0x40')]['id']}})[_0xfbb8('0x24')](handleEntityNotFound(_0x14b7ca,null))[_0xfbb8('0x24')](saveUpdates(_0x327e5d[_0xfbb8('0x45')],null))[_0xfbb8('0x24')](respondWithResult(_0x14b7ca,null))['catch'](handleError(_0x14b7ca,null));};exports[_0xfbb8('0x47')]=function(_0x19a8cf,_0x3e5597){return db[_0xfbb8('0x27')]['find']({'where':{'id':_0x19a8cf[_0xfbb8('0x40')]['id']}})['then'](handleEntityNotFound(_0x3e5597,null))['then'](removeEntity(_0x3e5597,null))[_0xfbb8('0x43')](handleError(_0x3e5597,null));};exports[_0xfbb8('0x48')]=function(_0x240785,_0x3aa4a3){return db['VoiceDialReport']['describe']()[_0xfbb8('0x24')](respondWithResult(_0x3aa4a3,null))[_0xfbb8('0x43')](handleError(_0x3aa4a3,null));}; \ No newline at end of file +var _0xa8fd=['rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','keys','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','then','destroy','stack','name','send','index','VoiceDialReport'];(function(_0x55206d,_0x4c9c9c){var _0x30963e=function(_0x2c10a8){while(--_0x2c10a8){_0x55206d['push'](_0x55206d['shift']());}};_0x30963e(++_0x4c9c9c);}(_0xa8fd,0x17a));var _0xda8f=function(_0x110b0e,_0x2633af){_0x110b0e=_0x110b0e-0x0;var _0x83cf25=_0xa8fd[_0x110b0e];return _0x83cf25;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xda8f('0x0'));var rimraf=require(_0xda8f('0x1'));var zipdir=require(_0xda8f('0x2'));var jsonpatch=require(_0xda8f('0x3'));var rp=require(_0xda8f('0x4'));var moment=require(_0xda8f('0x5'));var BPromise=require(_0xda8f('0x6'));var Mustache=require(_0xda8f('0x7'));var util=require('util');var path=require('path');var sox=require(_0xda8f('0x8'));var csv=require(_0xda8f('0x9'));var ejs=require(_0xda8f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xda8f('0xb'));var toCsv=require(_0xda8f('0x9'));var querystring=require(_0xda8f('0xc'));var Papa=require('papaparse');var Redis=require(_0xda8f('0xd'));var authService=require(_0xda8f('0xe'));var qs=require(_0xda8f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xda8f('0x10'))('api');var utils=require(_0xda8f('0x11'));var config=require(_0xda8f('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x175723,_0x4de42a){_0x4de42a=_0x4de42a||0xcc;return function(_0x1e7969){if(_0x1e7969){return _0x175723[_0xda8f('0x13')](_0x4de42a);}return _0x175723[_0xda8f('0x14')](_0x4de42a)[_0xda8f('0x15')]();};}function respondWithResult(_0x1a8f38,_0x5e6ef7){_0x5e6ef7=_0x5e6ef7||0xc8;return function(_0x203532){if(_0x203532){return _0x1a8f38['status'](_0x5e6ef7)[_0xda8f('0x16')](_0x203532);}};}function respondWithFilteredResult(_0x54d5ce,_0x2b47a9){return function(_0x25eaed){if(_0x25eaed){var _0x43ee2d=_0x25eaed[_0xda8f('0x17')],_0x264488=_0x2b47a9[_0xda8f('0x18')],_0x9dba31=_0x2b47a9[_0xda8f('0x18')]+_0x2b47a9[_0xda8f('0x19')],_0x1d503b;if(_0x9dba31>=_0x43ee2d){_0x9dba31=_0x43ee2d;_0x1d503b=0xc8;}else{_0x1d503b=0xce;}_0x54d5ce[_0xda8f('0x14')](_0x1d503b);return _0x54d5ce['set'](_0xda8f('0x1a'),_0x264488+'-'+_0x9dba31+'/'+_0x43ee2d)['json'](_0x25eaed);}return null;};}function patchUpdates(_0xdb5670){return function(_0x22bdf3){try{jsonpatch[_0xda8f('0x1b')](_0x22bdf3,_0xdb5670,!![]);}catch(_0x5d16bc){return BPromise['reject'](_0x5d16bc);}return _0x22bdf3[_0xda8f('0x1c')]();};}function saveUpdates(_0x546b90,_0x328e38){return function(_0x261358){if(_0x261358){return _0x261358['update'](_0x546b90)[_0xda8f('0x1d')](function(_0x276065){return _0x276065;});}return null;};}function removeEntity(_0x5519ab,_0x4f2976){return function(_0x243c9d){if(_0x243c9d){return _0x243c9d[_0xda8f('0x1e')]()[_0xda8f('0x1d')](function(){_0x5519ab[_0xda8f('0x14')](0xcc)[_0xda8f('0x15')]();});}};}function handleEntityNotFound(_0x3f709c,_0x3c036a){return function(_0x1acd2c){if(!_0x1acd2c){_0x3f709c[_0xda8f('0x13')](0x194);}return _0x1acd2c;};}function handleError(_0x4f9f91,_0x3a683c){_0x3a683c=_0x3a683c||0x1f4;return function(_0x3cdd0b){logger['error'](_0x3cdd0b[_0xda8f('0x1f')]);if(_0x3cdd0b[_0xda8f('0x20')]){delete _0x3cdd0b[_0xda8f('0x20')];}_0x4f9f91['status'](_0x3a683c)[_0xda8f('0x21')](_0x3cdd0b);};}exports[_0xda8f('0x22')]=function(_0x3789b7,_0x3b529c){var _0x5362cb={},_0x2080de={},_0x17d152={'count':0x0,'rows':[]};var _0x245fdd=_['map'](db[_0xda8f('0x23')][_0xda8f('0x24')],function(_0x57bba1){return{'name':_0x57bba1[_0xda8f('0x25')],'type':_0x57bba1[_0xda8f('0x26')][_0xda8f('0x27')]};});_0x2080de[_0xda8f('0x28')]=_[_0xda8f('0x29')](_0x245fdd,_0xda8f('0x20'));_0x2080de[_0xda8f('0x2a')]=_['keys'](_0x3789b7[_0xda8f('0x2a')]);_0x2080de[_0xda8f('0x2b')]=_['intersection'](_0x2080de[_0xda8f('0x28')],_0x2080de[_0xda8f('0x2a')]);_0x5362cb['attributes']=_[_0xda8f('0x2c')](_0x2080de['model'],qs[_0xda8f('0x2d')](_0x3789b7[_0xda8f('0x2a')][_0xda8f('0x2d')]));_0x5362cb[_0xda8f('0x2e')]=_0x5362cb['attributes'][_0xda8f('0x2f')]?_0x5362cb[_0xda8f('0x2e')]:_0x2080de[_0xda8f('0x28')];if(!_0x3789b7[_0xda8f('0x2a')][_0xda8f('0x30')](_0xda8f('0x31'))){_0x5362cb['limit']=qs[_0xda8f('0x19')](_0x3789b7[_0xda8f('0x2a')][_0xda8f('0x19')]);_0x5362cb[_0xda8f('0x18')]=qs['offset'](_0x3789b7[_0xda8f('0x2a')][_0xda8f('0x18')]);}_0x5362cb[_0xda8f('0x32')]=qs[_0xda8f('0x33')](_0x3789b7[_0xda8f('0x2a')][_0xda8f('0x33')]);_0x5362cb[_0xda8f('0x34')]=qs[_0xda8f('0x2b')](_[_0xda8f('0x35')](_0x3789b7['query'],_0x2080de['filters']),_0x245fdd);if(_0x3789b7[_0xda8f('0x2a')]['filter']){_0x5362cb[_0xda8f('0x34')]=_[_0xda8f('0x36')](_0x5362cb['where'],{'$or':_[_0xda8f('0x29')](_0x245fdd,function(_0x113fc2){if(_0x113fc2['type']!==_0xda8f('0x37')){var _0x337442={};_0x337442[_0x113fc2[_0xda8f('0x20')]]={'$like':'%'+_0x3789b7[_0xda8f('0x2a')][_0xda8f('0x38')]+'%'};return _0x337442;}})});}_0x5362cb=_['merge']({},_0x5362cb,_0x3789b7['options']);var _0x53a66f={'where':_0x5362cb[_0xda8f('0x34')]};return db[_0xda8f('0x23')][_0xda8f('0x17')](_0x53a66f)[_0xda8f('0x1d')](function(_0x5781d5){_0x17d152[_0xda8f('0x17')]=_0x5781d5;if(_0x3789b7[_0xda8f('0x2a')][_0xda8f('0x39')]){_0x5362cb[_0xda8f('0x3a')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xda8f('0x3b')](_0x5362cb);})[_0xda8f('0x1d')](function(_0x402500){_0x17d152[_0xda8f('0x3c')]=_0x402500;return _0x17d152;})[_0xda8f('0x1d')](respondWithFilteredResult(_0x3b529c,_0x5362cb))[_0xda8f('0x3d')](handleError(_0x3b529c,null));};exports['show']=function(_0x5beff7,_0x19b793){var _0x3b4cf6={'raw':!![],'where':{'id':_0x5beff7[_0xda8f('0x3e')]['id']}},_0x1a2618={};_0x1a2618[_0xda8f('0x28')]=_[_0xda8f('0x3f')](db[_0xda8f('0x23')][_0xda8f('0x24')]);_0x1a2618[_0xda8f('0x2a')]=_['keys'](_0x5beff7[_0xda8f('0x2a')]);_0x1a2618[_0xda8f('0x2b')]=_[_0xda8f('0x2c')](_0x1a2618[_0xda8f('0x28')],_0x1a2618['query']);_0x3b4cf6['attributes']=_[_0xda8f('0x2c')](_0x1a2618[_0xda8f('0x28')],qs[_0xda8f('0x2d')](_0x5beff7['query'][_0xda8f('0x2d')]));_0x3b4cf6[_0xda8f('0x2e')]=_0x3b4cf6['attributes'][_0xda8f('0x2f')]?_0x3b4cf6[_0xda8f('0x2e')]:_0x1a2618[_0xda8f('0x28')];if(_0x5beff7[_0xda8f('0x2a')][_0xda8f('0x39')]){_0x3b4cf6[_0xda8f('0x3a')]=[{'all':!![]}];}_0x3b4cf6=_[_0xda8f('0x36')]({},_0x3b4cf6,_0x5beff7['options']);return db[_0xda8f('0x23')][_0xda8f('0x40')](_0x3b4cf6)[_0xda8f('0x1d')](handleEntityNotFound(_0x19b793,null))[_0xda8f('0x1d')](respondWithResult(_0x19b793,null))['catch'](handleError(_0x19b793,null));};exports['create']=function(_0x1da0bd,_0x49a48d){return db[_0xda8f('0x23')][_0xda8f('0x41')](_0x1da0bd[_0xda8f('0x42')],{})['then'](respondWithResult(_0x49a48d,0xc9))[_0xda8f('0x3d')](handleError(_0x49a48d,null));};exports[_0xda8f('0x43')]=function(_0x14af57,_0x5021dd){if(_0x14af57['body']['id']){delete _0x14af57[_0xda8f('0x42')]['id'];}return db[_0xda8f('0x23')]['find']({'where':{'id':_0x14af57[_0xda8f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5021dd,null))[_0xda8f('0x1d')](saveUpdates(_0x14af57[_0xda8f('0x42')],null))[_0xda8f('0x1d')](respondWithResult(_0x5021dd,null))[_0xda8f('0x3d')](handleError(_0x5021dd,null));};exports[_0xda8f('0x1e')]=function(_0x5753d3,_0x82b325){return db[_0xda8f('0x23')]['find']({'where':{'id':_0x5753d3[_0xda8f('0x3e')]['id']}})[_0xda8f('0x1d')](handleEntityNotFound(_0x82b325,null))[_0xda8f('0x1d')](removeEntity(_0x82b325,null))[_0xda8f('0x3d')](handleError(_0x82b325,null));};exports[_0xda8f('0x44')]=function(_0x1ed6d1,_0x5a9197){return db[_0xda8f('0x23')]['describe']()['then'](respondWithResult(_0x5a9197,null))[_0xda8f('0x3d')](handleError(_0x5a9197,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 26db15b..117291f 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 _0xf6be=['report_dial','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define'];(function(_0x1b281b,_0x369210){var _0x59aa59=function(_0x3c39b3){while(--_0x3c39b3){_0x1b281b['push'](_0x1b281b['shift']());}};_0x59aa59(++_0x369210);}(_0xf6be,0x137));var _0xef6b=function(_0x543c51,_0xff0084){_0x543c51=_0x543c51-0x0;var _0x360555=_0xf6be[_0x543c51];return _0x360555;};'use strict';var _=require(_0xef6b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xef6b('0x1'));var rp=require(_0xef6b('0x2'));var fs=require('fs');var path=require(_0xef6b('0x3'));var rimraf=require(_0xef6b('0x4'));var config=require(_0xef6b('0x5'));var attributes=require(_0xef6b('0x6'));module[_0xef6b('0x7')]=function(_0x3b3bc0,_0xfbc471){return _0x3b3bc0[_0xef6b('0x8')]('VoiceDialReport',attributes,{'tableName':_0xef6b('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3167=['report_dial','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','exports','define'];(function(_0x3ec333,_0x26bcbe){var _0x15ccb8=function(_0x2c4d0c){while(--_0x2c4d0c){_0x3ec333['push'](_0x3ec333['shift']());}};_0x15ccb8(++_0x26bcbe);}(_0x3167,0x147));var _0x7316=function(_0x103965,_0x1b794e){_0x103965=_0x103965-0x0;var _0x40c90b=_0x3167[_0x103965];return _0x40c90b;};'use strict';var _=require(_0x7316('0x0'));var util=require(_0x7316('0x1'));var logger=require(_0x7316('0x2'))(_0x7316('0x3'));var moment=require('moment');var BPromise=require(_0x7316('0x4'));var rp=require(_0x7316('0x5'));var fs=require('fs');var path=require(_0x7316('0x6'));var rimraf=require(_0x7316('0x7'));var config=require('../../config/environment');var attributes=require(_0x7316('0x8'));module[_0x7316('0x9')]=function(_0x58f624,_0x409ede){return _0x58f624[_0x7316('0xa')]('VoiceDialReport',attributes,{'tableName':_0x7316('0xb'),'paranoid':![],'indexes':[{'fields':[_0x7316('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 929bfdb..7841e4b 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 _0x9491=['options','CreateVoiceDialReport','update','raw','where','attributes','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceDialReport','create','body'];(function(_0x3030a9,_0x3e7be2){var _0x5e6b29=function(_0x4be727){while(--_0x4be727){_0x3030a9['push'](_0x3030a9['shift']());}};_0x5e6b29(++_0x3e7be2);}(_0x9491,0xb6));var _0x1949=function(_0x4b78fa,_0x13b5f4){_0x4b78fa=_0x4b78fa-0x0;var _0x1cb60d=_0x9491[_0x4b78fa];return _0x1cb60d;};'use strict';var _=require(_0x1949('0x0'));var util=require(_0x1949('0x1'));var moment=require(_0x1949('0x2'));var BPromise=require(_0x1949('0x3'));var rs=require(_0x1949('0x4'));var fs=require('fs');var Redis=require(_0x1949('0x5'));var db=require(_0x1949('0x6'))['db'];var utils=require(_0x1949('0x7'));var logger=require(_0x1949('0x8'))(_0x1949('0x9'));var config=require('../../config/environment');var jayson=require(_0x1949('0xa'));var client=jayson['client'][_0x1949('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d39a3,_0x49bc94,_0x28b2b6){return new BPromise(function(_0x3665b6,_0x3c3c17){return client[_0x1949('0xc')](_0x2d39a3,_0x28b2b6)[_0x1949('0xd')](function(_0x69e9cd){logger[_0x1949('0xe')](_0x1949('0xf'),_0x49bc94,_0x1949('0x10'));logger[_0x1949('0x11')](_0x1949('0x12'),_0x49bc94,'request\x20sent',JSON[_0x1949('0x13')](_0x69e9cd));if(_0x69e9cd[_0x1949('0x14')]){if(_0x69e9cd[_0x1949('0x14')][_0x1949('0x15')]===0x1f4){logger[_0x1949('0x14')](_0x1949('0xf'),_0x49bc94,_0x69e9cd['error'][_0x1949('0x16')]);return _0x3c3c17(_0x69e9cd['error']['message']);}logger[_0x1949('0x14')](_0x1949('0xf'),_0x49bc94,_0x69e9cd[_0x1949('0x14')]['message']);return _0x3665b6(_0x69e9cd[_0x1949('0x14')][_0x1949('0x16')]);}else{logger[_0x1949('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x49bc94,'request\x20sent');_0x3665b6(_0x69e9cd[_0x1949('0x17')][_0x1949('0x16')]);}})[_0x1949('0x18')](function(_0x572605){logger[_0x1949('0x14')](_0x1949('0xf'),_0x49bc94,_0x572605);_0x3c3c17(_0x572605);});});}exports['CreateVoiceDialReport']=function(_0x2b8aca){var _0x3f36c7=this;return new Promise(function(_0x2c0ea8,_0x705c90){return db[_0x1949('0x19')][_0x1949('0x1a')](_0x2b8aca[_0x1949('0x1b')],{'raw':_0x2b8aca[_0x1949('0x1c')]?_0x2b8aca[_0x1949('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x1949('0xd')](function(_0x50e662){logger['info'](_0x1949('0x1d'),_0x2b8aca);logger['debug'](_0x1949('0x1d'),_0x2b8aca,JSON[_0x1949('0x13')](_0x50e662));_0x2c0ea8(_0x50e662);})['catch'](function(_0xc38d39){logger['error'](_0x1949('0x1d'),_0xc38d39[_0x1949('0x16')],_0x2b8aca);_0x705c90(_0x3f36c7[_0x1949('0x14')](0x1f4,_0xc38d39[_0x1949('0x16')]));});});};exports['UpdateVoiceDialReport']=function(_0x17a9b6){var _0x58e225=this;return new Promise(function(_0x4035cc,_0x5ae4f3){return db[_0x1949('0x19')][_0x1949('0x1e')](_0x17a9b6['body'],{'raw':_0x17a9b6[_0x1949('0x1c')]?_0x17a9b6['options'][_0x1949('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17a9b6[_0x1949('0x1c')]?_0x17a9b6[_0x1949('0x1c')][_0x1949('0x20')]||null:null,'attributes':_0x17a9b6['options']?_0x17a9b6['options'][_0x1949('0x21')]||null:null,'limit':_0x17a9b6[_0x1949('0x1c')]?_0x17a9b6[_0x1949('0x1c')]['limit']||null:null})['then'](function(_0x5060e7){logger[_0x1949('0xe')]('UpdateVoiceDialReport',_0x17a9b6);logger['debug'](_0x1949('0x22'),_0x17a9b6,JSON[_0x1949('0x13')](_0x5060e7));_0x4035cc(_0x5060e7);})[_0x1949('0x18')](function(_0x2284a7){logger[_0x1949('0x14')](_0x1949('0x22'),_0x2284a7[_0x1949('0x16')],_0x17a9b6);_0x5ae4f3(_0x58e225[_0x1949('0x14')](0x1f4,_0x2284a7['message']));});});}; \ No newline at end of file +var _0xa7dc=['body','options','raw','UpdateVoiceDialReport','update','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceDialReport'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xa7dc,0x11d));var _0xca7d=function(_0x40f1ea,_0x49ad93){_0x40f1ea=_0x40f1ea-0x0;var _0x389000=_0xa7dc[_0x40f1ea];return _0x389000;};'use strict';var _=require(_0xca7d('0x0'));var util=require(_0xca7d('0x1'));var moment=require(_0xca7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xca7d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca7d('0x4'))['db'];var utils=require(_0xca7d('0x5'));var logger=require(_0xca7d('0x6'))(_0xca7d('0x7'));var config=require(_0xca7d('0x8'));var jayson=require(_0xca7d('0x9'));var client=jayson[_0xca7d('0xa')][_0xca7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5073dd,_0x22223d,_0x820afa){return new BPromise(function(_0x4d5bc7,_0x2920bd){return client[_0xca7d('0xc')](_0x5073dd,_0x820afa)[_0xca7d('0xd')](function(_0x5236ce){logger[_0xca7d('0xe')](_0xca7d('0xf'),_0x22223d,_0xca7d('0x10'));logger[_0xca7d('0x11')](_0xca7d('0x12'),_0x22223d,'request\x20sent',JSON[_0xca7d('0x13')](_0x5236ce));if(_0x5236ce['error']){if(_0x5236ce[_0xca7d('0x14')]['code']===0x1f4){logger[_0xca7d('0x14')](_0xca7d('0xf'),_0x22223d,_0x5236ce[_0xca7d('0x14')][_0xca7d('0x15')]);return _0x2920bd(_0x5236ce['error']['message']);}logger['error'](_0xca7d('0xf'),_0x22223d,_0x5236ce[_0xca7d('0x14')][_0xca7d('0x15')]);return _0x4d5bc7(_0x5236ce[_0xca7d('0x14')][_0xca7d('0x15')]);}else{logger[_0xca7d('0xe')](_0xca7d('0xf'),_0x22223d,_0xca7d('0x10'));_0x4d5bc7(_0x5236ce[_0xca7d('0x16')][_0xca7d('0x15')]);}})[_0xca7d('0x17')](function(_0x245c7c){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x22223d,_0x245c7c);_0x2920bd(_0x245c7c);});});}exports[_0xca7d('0x18')]=function(_0x61cc1e){var _0x134e51=this;return new Promise(function(_0x46eac1,_0xdee74e){return db['VoiceDialReport']['create'](_0x61cc1e[_0xca7d('0x19')],{'raw':_0x61cc1e['options']?_0x61cc1e[_0xca7d('0x1a')][_0xca7d('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3e3e8d){logger['info']('CreateVoiceDialReport',_0x61cc1e);logger[_0xca7d('0x11')](_0xca7d('0x18'),_0x61cc1e,JSON[_0xca7d('0x13')](_0x3e3e8d));_0x46eac1(_0x3e3e8d);})[_0xca7d('0x17')](function(_0x5d049b){logger[_0xca7d('0x14')](_0xca7d('0x18'),_0x5d049b[_0xca7d('0x15')],_0x61cc1e);_0xdee74e(_0x134e51[_0xca7d('0x14')](0x1f4,_0x5d049b[_0xca7d('0x15')]));});});};exports[_0xca7d('0x1c')]=function(_0xf4b873){var _0x44e415=this;return new Promise(function(_0x56be0b,_0x1c9a38){return db['VoiceDialReport'][_0xca7d('0x1d')](_0xf4b873[_0xca7d('0x19')],{'raw':_0xf4b873[_0xca7d('0x1a')]?_0xf4b873[_0xca7d('0x1a')][_0xca7d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf4b873[_0xca7d('0x1a')]?_0xf4b873[_0xca7d('0x1a')][_0xca7d('0x1e')]||null:null,'attributes':_0xf4b873[_0xca7d('0x1a')]?_0xf4b873[_0xca7d('0x1a')]['attributes']||null:null,'limit':_0xf4b873[_0xca7d('0x1a')]?_0xf4b873[_0xca7d('0x1a')]['limit']||null:null})[_0xca7d('0xd')](function(_0x5df354){logger['info'](_0xca7d('0x1c'),_0xf4b873);logger['debug'](_0xca7d('0x1c'),_0xf4b873,JSON[_0xca7d('0x13')](_0x5df354));_0x56be0b(_0x5df354);})[_0xca7d('0x17')](function(_0x3071e5){logger[_0xca7d('0x14')](_0xca7d('0x1c'),_0x3071e5['message'],_0xf4b873);_0x1c9a38(_0x44e415[_0xca7d('0x14')](0x1f4,_0x3071e5[_0xca7d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 35af2b0..d3c5a24 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 _0x43c2=['get','index','/:id','isAuthenticated','show','post','create','/:id/applications','addApplications','update','delete','destroy','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller'];(function(_0x340b5b,_0x513ce6){var _0x2111f3=function(_0x3f744f){while(--_0x3f744f){_0x340b5b['push'](_0x340b5b['shift']());}};_0x2111f3(++_0x513ce6);}(_0x43c2,0x13c));var _0x243c=function(_0x3e7258,_0x1a89c1){_0x3e7258=_0x3e7258-0x0;var _0x529af3=_0x43c2[_0x3e7258];return _0x529af3;};'use strict';var multer=require('multer');var util=require(_0x243c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x243c('0x1'));var router=express[_0x243c('0x2')]();var auth=require(_0x243c('0x3'));var interaction=require(_0x243c('0x4'));var config=require(_0x243c('0x5'));var controller=require(_0x243c('0x6'));router[_0x243c('0x7')]('/',auth['isAuthenticated'](),controller[_0x243c('0x8')]);router[_0x243c('0x7')](_0x243c('0x9'),auth[_0x243c('0xa')](),controller[_0x243c('0xb')]);router[_0x243c('0xc')]('/',auth[_0x243c('0xa')](),controller[_0x243c('0xd')]);router[_0x243c('0xc')](_0x243c('0xe'),auth[_0x243c('0xa')](),controller[_0x243c('0xf')]);router['put'](_0x243c('0x9'),auth['isAuthenticated'](),controller[_0x243c('0x10')]);router[_0x243c('0x11')](_0x243c('0x9'),auth[_0x243c('0xa')](),controller[_0x243c('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa8fa=['put','update','delete','destroy','exports','util','path','connect-timeout','Router','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','create','addApplications'];(function(_0x463ae0,_0x144e3d){var _0x1379be=function(_0x5f52cc){while(--_0x5f52cc){_0x463ae0['push'](_0x463ae0['shift']());}};_0x1379be(++_0x144e3d);}(_0xa8fa,0x17b));var _0xaa8f=function(_0xe01d60,_0x340301){_0xe01d60=_0xe01d60-0x0;var _0x46d858=_0xa8fa[_0xe01d60];return _0x46d858;};'use strict';var multer=require('multer');var util=require(_0xaa8f('0x0'));var path=require(_0xaa8f('0x1'));var timeout=require(_0xaa8f('0x2'));var express=require('express');var router=express[_0xaa8f('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaa8f('0x4'));router[_0xaa8f('0x5')]('/',auth[_0xaa8f('0x6')](),controller[_0xaa8f('0x7')]);router[_0xaa8f('0x5')](_0xaa8f('0x8'),auth['isAuthenticated'](),controller[_0xaa8f('0x9')]);router['post']('/',auth[_0xaa8f('0x6')](),controller[_0xaa8f('0xa')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xaa8f('0xb')]);router[_0xaa8f('0xc')](_0xaa8f('0x8'),auth['isAuthenticated'](),controller[_0xaa8f('0xd')]);router[_0xaa8f('0xe')](_0xaa8f('0x8'),auth[_0xaa8f('0x6')](),controller[_0xaa8f('0xf')]);module[_0xaa8f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 435e1e1..e8bae7f 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x5d353e,_0x4fd21b){var _0x37f99e=function(_0x4a9568){while(--_0x4a9568){_0x5d353e['push'](_0x5d353e['shift']());}};_0x37f99e(++_0x4fd21b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x1f9894,_0x11b4fe){var _0xea7ce2=function(_0x251564){while(--_0x251564){_0x1f9894['push'](_0x1f9894['shift']());}};_0xea7ce2(++_0x11b4fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 377d90c..675f747 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 _0x1a85=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','UserProfileResource','stack','name','send','VoiceExtension','rawAttributes','fieldName','keys','filters','intersection','model','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','fields','params','create','body','outbound','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','mandatoryDisposition','addApplications','VoiceExtensionId','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x58e8b5,_0x3ff3cc){var _0x5e6586=function(_0x2ab831){while(--_0x2ab831){_0x58e8b5['push'](_0x58e8b5['shift']());}};_0x5e6586(++_0x3ff3cc);}(_0x1a85,0x178));var _0x51a8=function(_0xc7a0cb,_0x389964){_0xc7a0cb=_0xc7a0cb-0x0;var _0x10ce8e=_0x1a85[_0xc7a0cb];return _0x10ce8e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x51a8('0x0'));var zipdir=require(_0x51a8('0x1'));var jsonpatch=require(_0x51a8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x51a8('0x3'));var Mustache=require(_0x51a8('0x4'));var util=require(_0x51a8('0x5'));var path=require('path');var sox=require(_0x51a8('0x6'));var csv=require('to-csv');var ejs=require(_0x51a8('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var db=require(_0x51a8('0x15'))['db'];config[_0x51a8('0x16')]=_[_0x51a8('0x17')](config[_0x51a8('0x16')],{'host':_0x51a8('0x18'),'port':0x18eb});var socket=require(_0x51a8('0x19'))(new Redis(config[_0x51a8('0x16')]));require('./voiceExtension.socket')[_0x51a8('0x1a')](socket);function respondWithStatusCode(_0x7a4c36,_0xaec066){_0xaec066=_0xaec066||0xcc;return function(_0x50d992){if(_0x50d992){return _0x7a4c36[_0x51a8('0x1b')](_0xaec066);}return _0x7a4c36['status'](_0xaec066)[_0x51a8('0x1c')]();};}function respondWithResult(_0x2b8d37,_0x39cd45){_0x39cd45=_0x39cd45||0xc8;return function(_0x2b0521){if(_0x2b0521){return _0x2b8d37[_0x51a8('0x1d')](_0x39cd45)[_0x51a8('0x1e')](_0x2b0521);}};}function respondWithFilteredResult(_0x1f49ee,_0x516abc){return function(_0x1c2f25){if(_0x1c2f25){var _0x45a433=_0x1c2f25[_0x51a8('0x1f')],_0xd52230=_0x516abc['offset'],_0x23539e=_0x516abc[_0x51a8('0x20')]+_0x516abc[_0x51a8('0x21')],_0x3bc1a2;if(_0x23539e>=_0x45a433){_0x23539e=_0x45a433;_0x3bc1a2=0xc8;}else{_0x3bc1a2=0xce;}_0x1f49ee[_0x51a8('0x1d')](_0x3bc1a2);return _0x1f49ee[_0x51a8('0x22')](_0x51a8('0x23'),_0xd52230+'-'+_0x23539e+'/'+_0x45a433)[_0x51a8('0x1e')](_0x1c2f25);}return null;};}function patchUpdates(_0x28aea0){return function(_0x3bf5b6){try{jsonpatch['apply'](_0x3bf5b6,_0x28aea0,!![]);}catch(_0xf80fa9){return BPromise['reject'](_0xf80fa9);}return _0x3bf5b6[_0x51a8('0x24')]();};}function saveUpdates(_0x12c029,_0x8bda40){return function(_0x3759d6){if(_0x3759d6){return _0x3759d6['update'](_0x12c029)[_0x51a8('0x25')](function(_0x4b9cdd){return _0x4b9cdd;});}return null;};}function removeEntity(_0x47f063,_0x23d26a){return function(_0x52e503){if(_0x52e503){return _0x52e503[_0x51a8('0x26')]()[_0x51a8('0x25')](function(){var _0x20ef8b=_0x52e503[_0x51a8('0x27')]({'plain':!![]});var _0x157554=[{'name':_0x51a8('0x28'),'value':_0x51a8('0x29'),'ignore':![]},{'name':_0x51a8('0x2a'),'value':'outbound','ignore':![]},{'name':_0x51a8('0x2b'),'value':_0x51a8('0x2c'),'ignore':![]}];var _0xca5746=_(_0x157554)[_0x51a8('0x2d')](_0x51a8('0x2e'))[_0x51a8('0x2f')](_0x51a8('0x30'))[_0x51a8('0x30')]();if(_[_0x51a8('0x31')](_0xca5746,_0x20ef8b[_0x51a8('0x32')])){return;}var _0x20c6b5=_[_0x51a8('0x33')](_0x157554,['value',_0x20ef8b[_0x51a8('0x32')]])['name'];return db[_0x51a8('0x34')][_0x51a8('0x26')]({'where':{'type':_0x20c6b5,'resourceId':_0x20ef8b['id']}})[_0x51a8('0x25')](function(){return _0x52e503;});})[_0x51a8('0x25')](function(){_0x47f063[_0x51a8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10c19b,_0x4c67ff){return function(_0x41c4de){if(!_0x41c4de){_0x10c19b[_0x51a8('0x1b')](0x194);}return _0x41c4de;};}function handleError(_0x253a59,_0x4b19c8){_0x4b19c8=_0x4b19c8||0x1f4;return function(_0x2080a1){logger['error'](_0x2080a1[_0x51a8('0x35')]);if(_0x2080a1[_0x51a8('0x36')]){delete _0x2080a1[_0x51a8('0x36')];}_0x253a59[_0x51a8('0x1d')](_0x4b19c8)[_0x51a8('0x37')](_0x2080a1);};}exports['index']=function(_0x1167b8,_0x53b3b6){var _0x9f0e6={},_0x2d977b={},_0x41561a={'count':0x0,'rows':[]};var _0x578fc6=_[_0x51a8('0x2f')](db[_0x51a8('0x38')][_0x51a8('0x39')],function(_0x2429f8){return{'name':_0x2429f8[_0x51a8('0x3a')],'type':_0x2429f8['type']['key']};});_0x2d977b['model']=_[_0x51a8('0x2f')](_0x578fc6,_0x51a8('0x36'));_0x2d977b['query']=_[_0x51a8('0x3b')](_0x1167b8['query']);_0x2d977b[_0x51a8('0x3c')]=_[_0x51a8('0x3d')](_0x2d977b[_0x51a8('0x3e')],_0x2d977b[_0x51a8('0x3f')]);_0x9f0e6[_0x51a8('0x40')]=_[_0x51a8('0x3d')](_0x2d977b['model'],qs['fields'](_0x1167b8[_0x51a8('0x3f')]['fields']));_0x9f0e6['attributes']=_0x9f0e6['attributes'][_0x51a8('0x41')]?_0x9f0e6[_0x51a8('0x40')]:_0x2d977b[_0x51a8('0x3e')];if(!_0x1167b8['query'][_0x51a8('0x42')](_0x51a8('0x43'))){_0x9f0e6[_0x51a8('0x21')]=qs[_0x51a8('0x21')](_0x1167b8['query'][_0x51a8('0x21')]);_0x9f0e6[_0x51a8('0x20')]=qs[_0x51a8('0x20')](_0x1167b8['query'][_0x51a8('0x20')]);}_0x9f0e6['order']=qs[_0x51a8('0x44')](_0x1167b8[_0x51a8('0x3f')][_0x51a8('0x44')]);_0x9f0e6[_0x51a8('0x45')]=qs['filters'](_[_0x51a8('0x46')](_0x1167b8[_0x51a8('0x3f')],_0x2d977b[_0x51a8('0x3c')]),_0x578fc6);if(_0x1167b8[_0x51a8('0x3f')][_0x51a8('0x2d')]){_0x9f0e6[_0x51a8('0x45')]=_[_0x51a8('0x47')](_0x9f0e6[_0x51a8('0x45')],{'$or':_[_0x51a8('0x2f')](_0x578fc6,function(_0x4b8467){if(_0x4b8467[_0x51a8('0x32')]!==_0x51a8('0x48')){var _0x4c7c67={};_0x4c7c67[_0x4b8467['name']]={'$like':'%'+_0x1167b8[_0x51a8('0x3f')][_0x51a8('0x2d')]+'%'};return _0x4c7c67;}})});}_0x9f0e6=_[_0x51a8('0x47')]({},_0x9f0e6,_0x1167b8[_0x51a8('0x49')]);var _0x311574={'where':_0x9f0e6[_0x51a8('0x45')]};return db[_0x51a8('0x38')][_0x51a8('0x1f')](_0x311574)[_0x51a8('0x25')](function(_0x2e80ed){_0x41561a['count']=_0x2e80ed;if(_0x1167b8[_0x51a8('0x3f')][_0x51a8('0x4a')]){_0x9f0e6[_0x51a8('0x4b')]=[{'all':!![]}];}return db[_0x51a8('0x38')][_0x51a8('0x4c')](_0x9f0e6);})[_0x51a8('0x25')](function(_0x579411){_0x41561a[_0x51a8('0x4d')]=_0x579411;return _0x41561a;})['then'](respondWithFilteredResult(_0x53b3b6,_0x9f0e6))[_0x51a8('0x4e')](handleError(_0x53b3b6,null));};exports[_0x51a8('0x4f')]=function(_0xa5d597,_0xc856d1){var _0x246b72={'raw':![],'where':{'id':_0xa5d597['params']['id']}},_0x56d002={};_0x56d002[_0x51a8('0x3e')]=_[_0x51a8('0x3b')](db[_0x51a8('0x38')][_0x51a8('0x39')]);_0x56d002[_0x51a8('0x3f')]=_['keys'](_0xa5d597['query']);_0x56d002[_0x51a8('0x3c')]=_[_0x51a8('0x3d')](_0x56d002[_0x51a8('0x3e')],_0x56d002[_0x51a8('0x3f')]);_0x246b72[_0x51a8('0x40')]=_[_0x51a8('0x3d')](_0x56d002[_0x51a8('0x3e')],qs[_0x51a8('0x50')](_0xa5d597[_0x51a8('0x3f')]['fields']));_0x246b72['attributes']=_0x246b72['attributes'][_0x51a8('0x41')]?_0x246b72[_0x51a8('0x40')]:_0x56d002[_0x51a8('0x3e')];if(_0xa5d597['query'][_0x51a8('0x4a')]){_0x246b72[_0x51a8('0x4b')]=[{'all':!![]}];}_0x246b72=_['merge']({},_0x246b72,_0xa5d597[_0x51a8('0x49')]);return db['VoiceExtension']['find'](_0x246b72)[_0x51a8('0x25')](handleEntityNotFound(_0xc856d1,null))[_0x51a8('0x25')](respondWithResult(_0xc856d1,null))[_0x51a8('0x4e')](handleError(_0xc856d1,null));};exports['destroy']=function(_0x5b5aa5,_0x3a8f1e){return db['VoiceExtension'][_0x51a8('0x33')]({'where':{'id':_0x5b5aa5[_0x51a8('0x51')]['id']}})[_0x51a8('0x25')](handleEntityNotFound(_0x3a8f1e,null))[_0x51a8('0x25')](removeEntity(_0x3a8f1e,null))[_0x51a8('0x4e')](handleError(_0x3a8f1e,null));};exports[_0x51a8('0x52')]=function(_0x2a87e2,_0x406a87){if(_0x2a87e2[_0x51a8('0x53')]['type']===_0x51a8('0x54')&&!_[_0x51a8('0x55')](_0x2a87e2[_0x51a8('0x53')][_0x51a8('0x56')],'_')){_0x2a87e2['body'][_0x51a8('0x56')]='_'['concat'](_0x2a87e2[_0x51a8('0x53')][_0x51a8('0x56')]);}return db['VoiceExtension']['create'](_0x2a87e2[_0x51a8('0x53')],{'raw':![]})[_0x51a8('0x25')](function(_0x165366){var _0x1aaeaf=_0x2a87e2[_0x51a8('0x57')]['get']({'plain':!![]});if(!_0x1aaeaf)throw new Error(_0x51a8('0x58'));if(_0x1aaeaf[_0x51a8('0x59')]===_0x51a8('0x57')){var _0x308d40=_0x165366[_0x51a8('0x27')]({'plain':!![]});var _0x5d44fe=[{'name':_0x51a8('0x28'),'value':_0x51a8('0x29')},{'name':_0x51a8('0x2a'),'value':_0x51a8('0x54')},{'name':_0x51a8('0x2b'),'value':_0x51a8('0x2c')}];var _0x4d2699=_['find'](_0x5d44fe,['value',_0x308d40['type']])[_0x51a8('0x36')];return db[_0x51a8('0x5a')]['find']({'where':{'name':_0x4d2699,'userProfileId':_0x1aaeaf[_0x51a8('0x5b')]},'raw':!![]})['then'](function(_0x41cc00){if(_0x41cc00&&_0x41cc00['autoAssociation']===0x0){return db[_0x51a8('0x34')][_0x51a8('0x52')]({'name':_0x308d40['name'],'resourceId':_0x308d40['id'],'type':_0x41cc00['name'],'sectionId':_0x41cc00['id']},{})['then'](function(){return _0x165366;});}else{return _0x165366;}})[_0x51a8('0x4e')](function(_0x1ead77){logger[_0x51a8('0x5c')](_0x51a8('0x5d'),_0x1ead77);throw _0x1ead77;});}return _0x165366;})[_0x51a8('0x25')](respondWithResult(_0x406a87,0xc9))[_0x51a8('0x4e')](handleError(_0x406a87,null));};exports[_0x51a8('0x5e')]=function(_0x259153,_0x494e11){if(_0x259153[_0x51a8('0x53')]['id']){delete _0x259153[_0x51a8('0x53')]['id'];}return db['VoiceExtension'][_0x51a8('0x33')]({'where':{'id':_0x259153[_0x51a8('0x51')]['id']}})[_0x51a8('0x25')](handleEntityNotFound(_0x494e11,null))[_0x51a8('0x25')](function(_0x2e1250){if(_0x2e1250){return db[_0x51a8('0x38')]['update'](_['pick'](_0x259153[_0x51a8('0x53')],['exten','context','description','recordingFormat','cutdigits',_0x51a8('0x5f')]),{'where':{'context':_0x2e1250['context'],'exten':_0x2e1250[_0x51a8('0x56')]},'individualHooks':!![]})[_0x51a8('0x25')](function(_0x1e7135){return _0x1e7135;});}return null;})[_0x51a8('0x25')](respondWithStatusCode(_0x494e11,null))[_0x51a8('0x4e')](handleError(_0x494e11,null));};exports[_0x51a8('0x60')]=function(_0x28c539,_0xdafa01,_0x4b4740){return db[_0x51a8('0x38')]['findOne']({'where':{'id':_0x28c539[_0x51a8('0x51')]['id']}})[_0x51a8('0x25')](handleEntityNotFound(_0xdafa01,null))[_0x51a8('0x25')](function(_0x522677){if(_0x522677){return db['sequelize']['transaction'](function(_0x10c22e){return db[_0x51a8('0x38')][_0x51a8('0x26')]({'where':{'VoiceExtensionId':_0x28c539[_0x51a8('0x51')]['id']},'transaction':_0x10c22e})[_0x51a8('0x25')](function(_0x1462b4){var _0x351c22=_[_0x51a8('0x2f')](_0x28c539[_0x51a8('0x53')],function(_0x462555){_0x462555[_0x51a8('0x61')]=_0x28c539[_0x51a8('0x51')]['id'];return _0x462555;});return db[_0x51a8('0x38')]['bulkCreate'](_0x351c22,{'transaction':_0x10c22e});});})[_0x51a8('0x25')](function(){return db[_0x51a8('0x38')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x28c539[_0x51a8('0x51')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0xdafa01,null))['catch'](handleError(_0xdafa01,null));}; \ No newline at end of file +var _0x7a54=['then','get','inbound','outbound','internal','filter','ignore','map','value','includes','type','find','UserProfileResource','error','name','index','VoiceExtension','rawAttributes','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','rows','catch','show','params','keys','includeAll','include','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OutboundRoutes','UserProfileSection','userProfileId','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x7a54,0x106));var _0x47a5=function(_0x4cd314,_0x31be39){_0x4cd314=_0x4cd314-0x0;var _0x882ed=_0x7a54[_0x4cd314];return _0x882ed;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');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 db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){var _0x129ce5=_0x28747d[_0x47a5('0x27')]({'plain':!![]});var _0x50bf17=[{'name':'InboundRoutes','value':_0x47a5('0x28'),'ignore':![]},{'name':'OutboundRoutes','value':_0x47a5('0x29'),'ignore':![]},{'name':'InternalRoutes','value':_0x47a5('0x2a'),'ignore':![]}];var _0x378208=_(_0x50bf17)[_0x47a5('0x2b')](_0x47a5('0x2c'))[_0x47a5('0x2d')](_0x47a5('0x2e'))[_0x47a5('0x2e')]();if(_[_0x47a5('0x2f')](_0x378208,_0x129ce5[_0x47a5('0x30')])){return;}var _0x361bfa=_[_0x47a5('0x31')](_0x50bf17,[_0x47a5('0x2e'),_0x129ce5[_0x47a5('0x30')]])['name'];return db[_0x47a5('0x32')]['destroy']({'where':{'type':_0x361bfa,'resourceId':_0x129ce5['id']}})[_0x47a5('0x26')](function(){return _0x28747d;});})[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x256650,_0x625952){return function(_0x39b50b){if(!_0x39b50b){_0x256650[_0x47a5('0x1a')](0x194);}return _0x39b50b;};}function handleError(_0x51cc81,_0x50d875){_0x50d875=_0x50d875||0x1f4;return function(_0x6f9a12){logger[_0x47a5('0x33')](_0x6f9a12['stack']);if(_0x6f9a12['name']){delete _0x6f9a12[_0x47a5('0x34')];}_0x51cc81[_0x47a5('0x1c')](_0x50d875)['send'](_0x6f9a12);};}exports[_0x47a5('0x35')]=function(_0x53119b,_0x122ed6){var _0xd972c={},_0x5c5162={},_0x4843c0={'count':0x0,'rows':[]};var _0x274e34=_['map'](db[_0x47a5('0x36')][_0x47a5('0x37')],function(_0xf269a8){return{'name':_0xf269a8['fieldName'],'type':_0xf269a8[_0x47a5('0x30')]['key']};});_0x5c5162['model']=_[_0x47a5('0x2d')](_0x274e34,'name');_0x5c5162[_0x47a5('0x38')]=_['keys'](_0x53119b[_0x47a5('0x38')]);_0x5c5162[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x5c5162[_0x47a5('0x3b')],_0x5c5162[_0x47a5('0x38')]);_0xd972c[_0x47a5('0x3c')]=_[_0x47a5('0x3a')](_0x5c5162[_0x47a5('0x3b')],qs[_0x47a5('0x3d')](_0x53119b['query'][_0x47a5('0x3d')]));_0xd972c[_0x47a5('0x3c')]=_0xd972c['attributes'][_0x47a5('0x3e')]?_0xd972c[_0x47a5('0x3c')]:_0x5c5162[_0x47a5('0x3b')];if(!_0x53119b['query'][_0x47a5('0x3f')](_0x47a5('0x40'))){_0xd972c['limit']=qs[_0x47a5('0x1f')](_0x53119b[_0x47a5('0x38')]['limit']);_0xd972c['offset']=qs['offset'](_0x53119b[_0x47a5('0x38')]['offset']);}_0xd972c[_0x47a5('0x41')]=qs[_0x47a5('0x42')](_0x53119b[_0x47a5('0x38')][_0x47a5('0x42')]);_0xd972c[_0x47a5('0x43')]=qs[_0x47a5('0x39')](_[_0x47a5('0x44')](_0x53119b[_0x47a5('0x38')],_0x5c5162[_0x47a5('0x39')]),_0x274e34);if(_0x53119b[_0x47a5('0x38')][_0x47a5('0x2b')]){_0xd972c[_0x47a5('0x43')]=_[_0x47a5('0x45')](_0xd972c['where'],{'$or':_[_0x47a5('0x2d')](_0x274e34,function(_0x1c36fa){if(_0x1c36fa[_0x47a5('0x30')]!==_0x47a5('0x46')){var _0x586f4f={};_0x586f4f[_0x1c36fa[_0x47a5('0x34')]]={'$like':'%'+_0x53119b['query']['filter']+'%'};return _0x586f4f;}})});}_0xd972c=_['merge']({},_0xd972c,_0x53119b['options']);var _0x27dd5d={'where':_0xd972c['where']};return db[_0x47a5('0x36')][_0x47a5('0x1d')](_0x27dd5d)[_0x47a5('0x26')](function(_0x494526){_0x4843c0[_0x47a5('0x1d')]=_0x494526;if(_0x53119b[_0x47a5('0x38')]['includeAll']){_0xd972c['include']=[{'all':!![]}];}return db[_0x47a5('0x36')]['findAll'](_0xd972c);})[_0x47a5('0x26')](function(_0x4703b2){_0x4843c0[_0x47a5('0x47')]=_0x4703b2;return _0x4843c0;})[_0x47a5('0x26')](respondWithFilteredResult(_0x122ed6,_0xd972c))[_0x47a5('0x48')](handleError(_0x122ed6,null));};exports[_0x47a5('0x49')]=function(_0x434227,_0x17cc42){var _0xac9c15={'raw':![],'where':{'id':_0x434227[_0x47a5('0x4a')]['id']}},_0x162fa0={};_0x162fa0[_0x47a5('0x3b')]=_[_0x47a5('0x4b')](db[_0x47a5('0x36')][_0x47a5('0x37')]);_0x162fa0[_0x47a5('0x38')]=_['keys'](_0x434227[_0x47a5('0x38')]);_0x162fa0[_0x47a5('0x39')]=_['intersection'](_0x162fa0['model'],_0x162fa0[_0x47a5('0x38')]);_0xac9c15['attributes']=_[_0x47a5('0x3a')](_0x162fa0[_0x47a5('0x3b')],qs['fields'](_0x434227['query'][_0x47a5('0x3d')]));_0xac9c15['attributes']=_0xac9c15[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0xac9c15[_0x47a5('0x3c')]:_0x162fa0[_0x47a5('0x3b')];if(_0x434227[_0x47a5('0x38')][_0x47a5('0x4c')]){_0xac9c15[_0x47a5('0x4d')]=[{'all':!![]}];}_0xac9c15=_['merge']({},_0xac9c15,_0x434227['options']);return db[_0x47a5('0x36')][_0x47a5('0x31')](_0xac9c15)[_0x47a5('0x26')](handleEntityNotFound(_0x17cc42,null))[_0x47a5('0x26')](respondWithResult(_0x17cc42,null))[_0x47a5('0x48')](handleError(_0x17cc42,null));};exports[_0x47a5('0x25')]=function(_0x249de5,_0x492cf7){return db[_0x47a5('0x36')][_0x47a5('0x31')]({'where':{'id':_0x249de5[_0x47a5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x492cf7,null))[_0x47a5('0x26')](removeEntity(_0x492cf7,null))['catch'](handleError(_0x492cf7,null));};exports[_0x47a5('0x4e')]=function(_0xe31817,_0x46e90b){if(_0xe31817[_0x47a5('0x4f')]['type']===_0x47a5('0x29')&&!_[_0x47a5('0x50')](_0xe31817[_0x47a5('0x4f')][_0x47a5('0x51')],'_')){_0xe31817[_0x47a5('0x4f')][_0x47a5('0x51')]='_'[_0x47a5('0x52')](_0xe31817['body'][_0x47a5('0x51')]);}return db[_0x47a5('0x36')][_0x47a5('0x4e')](_0xe31817[_0x47a5('0x4f')],{'raw':![]})[_0x47a5('0x26')](function(_0x1ab0bf){var _0x572233=_0xe31817[_0x47a5('0x53')][_0x47a5('0x27')]({'plain':!![]});if(!_0x572233)throw new Error(_0x47a5('0x54'));if(_0x572233['role']===_0x47a5('0x53')){var _0x3c78b7=_0x1ab0bf[_0x47a5('0x27')]({'plain':!![]});var _0x5d8d4a=[{'name':'InboundRoutes','value':_0x47a5('0x28')},{'name':_0x47a5('0x55'),'value':'outbound'},{'name':'InternalRoutes','value':_0x47a5('0x2a')}];var _0x4d6a82=_[_0x47a5('0x31')](_0x5d8d4a,['value',_0x3c78b7['type']])[_0x47a5('0x34')];return db[_0x47a5('0x56')]['find']({'where':{'name':_0x4d6a82,'userProfileId':_0x572233[_0x47a5('0x57')]},'raw':!![]})[_0x47a5('0x26')](function(_0x4b706a){if(_0x4b706a&&_0x4b706a['autoAssociation']===0x0){return db[_0x47a5('0x32')][_0x47a5('0x4e')]({'name':_0x3c78b7[_0x47a5('0x34')],'resourceId':_0x3c78b7['id'],'type':_0x4b706a[_0x47a5('0x34')],'sectionId':_0x4b706a['id']},{})['then'](function(){return _0x1ab0bf;});}else{return _0x1ab0bf;}})[_0x47a5('0x48')](function(_0x2b4255){logger[_0x47a5('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b4255);throw _0x2b4255;});}return _0x1ab0bf;})[_0x47a5('0x26')](respondWithResult(_0x46e90b,0xc9))['catch'](handleError(_0x46e90b,null));};exports[_0x47a5('0x24')]=function(_0x470da6,_0x943a15){if(_0x470da6[_0x47a5('0x4f')]['id']){delete _0x470da6[_0x47a5('0x4f')]['id'];}return db['VoiceExtension'][_0x47a5('0x31')]({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))['then'](function(_0x4f8564){if(_0x4f8564){return db[_0x47a5('0x36')][_0x47a5('0x24')](_[_0x47a5('0x44')](_0x470da6['body'],['exten',_0x47a5('0x58'),_0x47a5('0x59'),_0x47a5('0x5a'),_0x47a5('0x5b'),_0x47a5('0x5c')]),{'where':{'context':_0x4f8564['context'],'exten':_0x4f8564[_0x47a5('0x51')]},'individualHooks':!![]})['then'](function(_0x22c886){return _0x22c886;});}return null;})[_0x47a5('0x26')](respondWithStatusCode(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports[_0x47a5('0x5d')]=function(_0x345104,_0x132854,_0x3e8274){return db[_0x47a5('0x36')][_0x47a5('0x5e')]({'where':{'id':_0x345104[_0x47a5('0x4a')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x132854,null))['then'](function(_0x2dcc3b){if(_0x2dcc3b){return db[_0x47a5('0x5f')][_0x47a5('0x60')](function(_0x26e7fc){return db[_0x47a5('0x36')]['destroy']({'where':{'VoiceExtensionId':_0x345104[_0x47a5('0x4a')]['id']},'transaction':_0x26e7fc})[_0x47a5('0x26')](function(_0x1224bc){var _0x144aaa=_[_0x47a5('0x2d')](_0x345104[_0x47a5('0x4f')],function(_0x453191){_0x453191[_0x47a5('0x61')]=_0x345104[_0x47a5('0x4a')]['id'];return _0x453191;});return db[_0x47a5('0x36')][_0x47a5('0x62')](_0x144aaa,{'transaction':_0x26e7fc});});})[_0x47a5('0x26')](function(){return db[_0x47a5('0x36')][_0x47a5('0x63')]({'where':{'isApp':!![],'VoiceExtensionId':_0x345104[_0x47a5('0x4a')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x47a5('0x26')](respondWithResult(_0x132854,null))[_0x47a5('0x48')](handleError(_0x132854,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index a5c1fa4..935c660 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 _0x8663=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x2a8f26,_0x46b409){var _0x2e33c1=function(_0x27e518){while(--_0x27e518){_0x2a8f26['push'](_0x2a8f26['shift']());}};_0x2e33c1(++_0x46b409);}(_0x8663,0x156));var _0x3866=function(_0x234987,_0x433dcb){_0x234987=_0x234987-0x0;var _0x27c52d=_0x8663[_0x234987];return _0x27c52d;};'use strict';var EventEmitter=require(_0x3866('0x0'));var VoiceExtension=require(_0x3866('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x3866('0x2')](0x0);var events={'afterCreate':_0x3866('0x3'),'afterUpdate':_0x3866('0x4'),'afterDestroy':'remove'};function emitEvent(_0xc65c99){return function(_0x1b0bf1,_0x39d58b,_0x56e4b5){VoiceExtensionEvents[_0x3866('0x5')](_0xc65c99+':'+_0x1b0bf1['id'],_0x1b0bf1);VoiceExtensionEvents['emit'](_0xc65c99,_0x1b0bf1);_0x56e4b5(null);};}for(var e in events){if(events[_0x3866('0x6')](e)){var event=events[e];VoiceExtension[_0x3866('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xf122=['update','emit','hasOwnProperty','hook','exports','events','VoiceExtension','setMaxListeners','save'];(function(_0x151926,_0x1c66fb){var _0x3a2182=function(_0x88cb4c){while(--_0x88cb4c){_0x151926['push'](_0x151926['shift']());}};_0x3a2182(++_0x1c66fb);}(_0xf122,0x1e2));var _0x2f12=function(_0x978359,_0x5755b9){_0x978359=_0x978359-0x0;var _0x4c1f55=_0xf122[_0x978359];return _0x4c1f55;};'use strict';var EventEmitter=require(_0x2f12('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x2f12('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2f12('0x2')](0x0);var events={'afterCreate':_0x2f12('0x3'),'afterUpdate':_0x2f12('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4473ff){return function(_0xf1b8bb,_0x5af231,_0x307bd8){VoiceExtensionEvents['emit'](_0x4473ff+':'+_0xf1b8bb['id'],_0xf1b8bb);VoiceExtensionEvents[_0x2f12('0x5')](_0x4473ff,_0xf1b8bb);_0x307bd8(null);};}for(var e in events){if(events[_0x2f12('0x6')](e)){var event=events[e];VoiceExtension[_0x2f12('0x7')](e,emitEvent(event));}}module[_0x2f12('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index c751354..228b775 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 _0xf868=['define','VoiceExtension','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./voiceExtension.attributes','exports'];(function(_0x301cea,_0x2c3408){var _0x1638f4=function(_0x24dacc){while(--_0x24dacc){_0x301cea['push'](_0x301cea['shift']());}};_0x1638f4(++_0x2c3408);}(_0xf868,0x7b));var _0x8f86=function(_0x6fdb57,_0x38d2a0){_0x6fdb57=_0x6fdb57-0x0;var _0x4b032a=_0xf868[_0x6fdb57];return _0x4b032a;};'use strict';var _=require(_0x8f86('0x0'));var util=require(_0x8f86('0x1'));var logger=require(_0x8f86('0x2'))('api');var moment=require(_0x8f86('0x3'));var BPromise=require(_0x8f86('0x4'));var rp=require(_0x8f86('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8f86('0x6'));var attributes=require(_0x8f86('0x7'));module[_0x8f86('0x8')]=function(_0x25b623,_0x13dd89){return _0x25b623[_0x8f86('0x9')](_0x8f86('0xa'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3201=['rimraf','../../config/environment','exports','define','VoiceExtension','voice_extensions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x3201,0x126));var _0x1320=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3201[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x1320('0x0'));var util=require(_0x1320('0x1'));var logger=require(_0x1320('0x2'))(_0x1320('0x3'));var moment=require(_0x1320('0x4'));var BPromise=require(_0x1320('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1320('0x6'));var config=require(_0x1320('0x7'));var attributes=require('./voiceExtension.attributes');module[_0x1320('0x8')]=function(_0x412ac6,_0x3bf0ee){return _0x412ac6[_0x1320('0x9')](_0x1320('0xa'),attributes,{'tableName':_0x1320('0xb'),'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 c711894..9a920b8 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 _0x9028=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voiceExtension.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','GetVoiceExtension','findAll','options','raw','attributes','limit','map','include','model','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x22bee0,_0x412ecb){var _0x2d295b=function(_0x59d4b5){while(--_0x59d4b5){_0x22bee0['push'](_0x22bee0['shift']());}};_0x2d295b(++_0x412ecb);}(_0x9028,0x11c));var _0x8902=function(_0x12d68d,_0x7e469a){_0x12d68d=_0x12d68d-0x0;var _0x41060d=_0x9028[_0x12d68d];return _0x41060d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8902('0x0'));var BPromise=require(_0x8902('0x1'));var rs=require(_0x8902('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8902('0x3'))['db'];var utils=require(_0x8902('0x4'));var logger=require(_0x8902('0x5'))(_0x8902('0x6'));var config=require(_0x8902('0x7'));var jayson=require(_0x8902('0x8'));var client=jayson[_0x8902('0x9')]['http']({'port':0x232a});config[_0x8902('0xa')]=_[_0x8902('0xb')](config[_0x8902('0xa')],{'host':_0x8902('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8902('0xa')]));require(_0x8902('0xd'))[_0x8902('0xe')](socket);function respondWithRpcPromise(_0x43383a,_0x15ccd2,_0x52b9f3){return new BPromise(function(_0x2f67a6,_0x13e1bd){return client[_0x8902('0xf')](_0x43383a,_0x52b9f3)[_0x8902('0x10')](function(_0x8eb31f){logger[_0x8902('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x15ccd2,_0x8902('0x12'));logger[_0x8902('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x15ccd2,_0x8902('0x12'),JSON[_0x8902('0x14')](_0x8eb31f));if(_0x8eb31f['error']){if(_0x8eb31f[_0x8902('0x15')][_0x8902('0x16')]===0x1f4){logger['error'](_0x8902('0x17'),_0x15ccd2,_0x8eb31f['error'][_0x8902('0x18')]);return _0x13e1bd(_0x8eb31f[_0x8902('0x15')][_0x8902('0x18')]);}logger[_0x8902('0x15')](_0x8902('0x17'),_0x15ccd2,_0x8eb31f[_0x8902('0x15')][_0x8902('0x18')]);return _0x2f67a6(_0x8eb31f['error']['message']);}else{logger[_0x8902('0x11')](_0x8902('0x17'),_0x15ccd2,_0x8902('0x12'));_0x2f67a6(_0x8eb31f[_0x8902('0x19')][_0x8902('0x18')]);}})['catch'](function(_0x33c9ea){logger[_0x8902('0x15')](_0x8902('0x17'),_0x15ccd2,_0x33c9ea);_0x13e1bd(_0x33c9ea);});});}exports[_0x8902('0x1a')]=function(_0x108708){var _0x3a23bc=this;return new Promise(function(_0x8b1822,_0x201b88){return db['VoiceExtension'][_0x8902('0x1b')]({'raw':_0x108708[_0x8902('0x1c')]?_0x108708[_0x8902('0x1c')][_0x8902('0x1d')]===undefined?!![]:![]:!![],'where':_0x108708[_0x8902('0x1c')]?_0x108708[_0x8902('0x1c')]['where']||null:null,'attributes':_0x108708[_0x8902('0x1c')]?_0x108708[_0x8902('0x1c')][_0x8902('0x1e')]||null:null,'limit':_0x108708[_0x8902('0x1c')]?_0x108708[_0x8902('0x1c')][_0x8902('0x1f')]||null:null,'include':_0x108708[_0x8902('0x1c')]?_0x108708[_0x8902('0x1c')]['include']?_[_0x8902('0x20')](_0x108708[_0x8902('0x1c')][_0x8902('0x21')],function(_0x1fea15){return{'model':db[_0x1fea15[_0x8902('0x22')]],'as':_0x1fea15['as'],'attributes':_0x1fea15[_0x8902('0x1e')],'include':_0x1fea15[_0x8902('0x21')]?_[_0x8902('0x20')](_0x1fea15[_0x8902('0x21')],function(_0x5984bd){return{'model':db[_0x5984bd[_0x8902('0x22')]],'as':_0x5984bd['as'],'attributes':_0x5984bd[_0x8902('0x1e')],'include':_0x5984bd[_0x8902('0x21')]?_[_0x8902('0x20')](_0x5984bd['include'],function(_0x4391fa){return{'model':db[_0x4391fa['model']],'as':_0x4391fa['as'],'attributes':_0x4391fa[_0x8902('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8902('0x10')](function(_0x356b96){logger[_0x8902('0x11')]('GetVoiceExtension',_0x108708);logger[_0x8902('0x13')](_0x8902('0x1a'),_0x108708,JSON[_0x8902('0x14')](_0x356b96));_0x8b1822(_0x356b96);})[_0x8902('0x23')](function(_0x5248e2){logger['error']('GetVoiceExtension',_0x5248e2['message'],_0x108708);_0x201b88(_0x3a23bc['error'](0x1f4,_0x5248e2[_0x8902('0x18')]));});});}; \ No newline at end of file +var _0x4d57=['raw','attributes','limit','map','include','model','then','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x4d57,0x9b));var _0x74d5=function(_0x1a9acf,_0x437210){_0x1a9acf=_0x1a9acf-0x0;var _0x1855db=_0x4d57[_0x1a9acf];return _0x1855db;};'use strict';var _=require(_0x74d5('0x0'));var util=require(_0x74d5('0x1'));var moment=require(_0x74d5('0x2'));var BPromise=require('bluebird');var rs=require(_0x74d5('0x3'));var fs=require('fs');var Redis=require(_0x74d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x74d5('0x5'));var logger=require('../../config/logger')(_0x74d5('0x6'));var config=require(_0x74d5('0x7'));var jayson=require(_0x74d5('0x8'));var client=jayson['client'][_0x74d5('0x9')]({'port':0x232a});config[_0x74d5('0xa')]=_[_0x74d5('0xb')](config[_0x74d5('0xa')],{'host':_0x74d5('0xc'),'port':0x18eb});var socket=require(_0x74d5('0xd'))(new Redis(config[_0x74d5('0xa')]));require(_0x74d5('0xe'))['register'](socket);function respondWithRpcPromise(_0x4254d8,_0x17bf8a,_0xae3e80){return new BPromise(function(_0x1f05d9,_0x43e35b){return client['request'](_0x4254d8,_0xae3e80)['then'](function(_0x1d909f){logger['info'](_0x74d5('0xf'),_0x17bf8a,_0x74d5('0x10'));logger[_0x74d5('0x11')](_0x74d5('0x12'),_0x17bf8a,'request\x20sent',JSON[_0x74d5('0x13')](_0x1d909f));if(_0x1d909f[_0x74d5('0x14')]){if(_0x1d909f[_0x74d5('0x14')][_0x74d5('0x15')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x17bf8a,_0x1d909f[_0x74d5('0x14')][_0x74d5('0x16')]);return _0x43e35b(_0x1d909f[_0x74d5('0x14')][_0x74d5('0x16')]);}logger['error'](_0x74d5('0xf'),_0x17bf8a,_0x1d909f[_0x74d5('0x14')][_0x74d5('0x16')]);return _0x1f05d9(_0x1d909f[_0x74d5('0x14')][_0x74d5('0x16')]);}else{logger[_0x74d5('0x17')](_0x74d5('0xf'),_0x17bf8a,_0x74d5('0x10'));_0x1f05d9(_0x1d909f[_0x74d5('0x18')][_0x74d5('0x16')]);}})[_0x74d5('0x19')](function(_0x1c903f){logger[_0x74d5('0x14')](_0x74d5('0xf'),_0x17bf8a,_0x1c903f);_0x43e35b(_0x1c903f);});});}exports[_0x74d5('0x1a')]=function(_0x4eeb0b){var _0x401852=this;return new Promise(function(_0x21b245,_0x4b4198){return db[_0x74d5('0x1b')][_0x74d5('0x1c')]({'raw':_0x4eeb0b[_0x74d5('0x1d')]?_0x4eeb0b[_0x74d5('0x1d')][_0x74d5('0x1e')]===undefined?!![]:![]:!![],'where':_0x4eeb0b['options']?_0x4eeb0b['options']['where']||null:null,'attributes':_0x4eeb0b['options']?_0x4eeb0b[_0x74d5('0x1d')][_0x74d5('0x1f')]||null:null,'limit':_0x4eeb0b[_0x74d5('0x1d')]?_0x4eeb0b[_0x74d5('0x1d')][_0x74d5('0x20')]||null:null,'include':_0x4eeb0b[_0x74d5('0x1d')]?_0x4eeb0b[_0x74d5('0x1d')]['include']?_[_0x74d5('0x21')](_0x4eeb0b['options'][_0x74d5('0x22')],function(_0x169886){return{'model':db[_0x169886[_0x74d5('0x23')]],'as':_0x169886['as'],'attributes':_0x169886[_0x74d5('0x1f')],'include':_0x169886[_0x74d5('0x22')]?_[_0x74d5('0x21')](_0x169886[_0x74d5('0x22')],function(_0x873547){return{'model':db[_0x873547[_0x74d5('0x23')]],'as':_0x873547['as'],'attributes':_0x873547['attributes'],'include':_0x873547[_0x74d5('0x22')]?_['map'](_0x873547['include'],function(_0x49d243){return{'model':db[_0x49d243[_0x74d5('0x23')]],'as':_0x49d243['as'],'attributes':_0x49d243[_0x74d5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x74d5('0x24')](function(_0x504184){logger[_0x74d5('0x17')]('GetVoiceExtension',_0x4eeb0b);logger[_0x74d5('0x11')](_0x74d5('0x1a'),_0x4eeb0b,JSON[_0x74d5('0x13')](_0x504184));_0x21b245(_0x504184);})[_0x74d5('0x19')](function(_0x39475b){logger['error'](_0x74d5('0x1a'),_0x39475b[_0x74d5('0x16')],_0x4eeb0b);_0x4b4198(_0x401852[_0x74d5('0x14')](0x1f4,_0x39475b[_0x74d5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 7ba6ea4..6cd7957 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 _0x3294=['register','length','voiceExtension:','save','remove','update','emit','removeListener'];(function(_0x439c47,_0x55bb15){var _0xd0bcf1=function(_0x566700){while(--_0x566700){_0x439c47['push'](_0x439c47['shift']());}};_0xd0bcf1(++_0x55bb15);}(_0x3294,0x1db));var _0x4329=function(_0x37fb0e,_0x216e7d){_0x37fb0e=_0x37fb0e-0x0;var _0x296700=_0x3294[_0x37fb0e];return _0x296700;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x4329('0x0'),_0x4329('0x1'),_0x4329('0x2')];function createListener(_0x593785,_0x5c2624){return function(_0x5a78db){_0x5c2624[_0x4329('0x3')](_0x593785,_0x5a78db);};}function removeListener(_0x28be5f,_0x4d7369){return function(){VoiceExtensionEvents[_0x4329('0x4')](_0x28be5f,_0x4d7369);};}exports[_0x4329('0x5')]=function(_0x51b89a){for(var _0x40c217=0x0,_0x188ff9=events[_0x4329('0x6')];_0x40c217<_0x188ff9;_0x40c217++){var _0x59e0bf=events[_0x40c217];var _0x421b2c=createListener(_0x4329('0x7')+_0x59e0bf,_0x51b89a);VoiceExtensionEvents['on'](_0x59e0bf,_0x421b2c);}}; \ No newline at end of file +var _0x10f6=['save','remove','update','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x341d18,_0x5edf47){var _0x2e3047=function(_0x1a0d44){while(--_0x1a0d44){_0x341d18['push'](_0x341d18['shift']());}};_0x2e3047(++_0x5edf47);}(_0x10f6,0xb7));var _0x610f=function(_0xec174,_0x44d31c){_0xec174=_0xec174-0x0;var _0x33361c=_0x10f6[_0xec174];return _0x33361c;};'use strict';var VoiceExtensionEvents=require(_0x610f('0x0'));var events=[_0x610f('0x1'),_0x610f('0x2'),_0x610f('0x3')];function createListener(_0x4d35b5,_0x5c2e72){return function(_0xf8c7e6){_0x5c2e72[_0x610f('0x4')](_0x4d35b5,_0xf8c7e6);};}function removeListener(_0x51bf54,_0x589322){return function(){VoiceExtensionEvents[_0x610f('0x5')](_0x51bf54,_0x589322);};}exports[_0x610f('0x6')]=function(_0x590af5){for(var _0x5d8b2e=0x0,_0x20036d=events['length'];_0x5d8b2e<_0x20036d;_0x5d8b2e++){var _0xad222e=events[_0x5d8b2e];var _0x1a70a6=createListener(_0x610f('0x7')+_0xad222e,_0x590af5);VoiceExtensionEvents['on'](_0xad222e,_0x1a70a6);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index c2196fc..cb53aed 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 _0xac5f=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id/messages','isAuthenticated','getMessages','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x1fe881,_0x144dcb){var _0x3d8a54=function(_0x510c20){while(--_0x510c20){_0x1fe881['push'](_0x1fe881['shift']());}};_0x3d8a54(++_0x144dcb);}(_0xac5f,0x1e3));var _0xfac5=function(_0x4402ee,_0x371246){_0x4402ee=_0x4402ee-0x0;var _0x281a7b=_0xac5f[_0x4402ee];return _0x281a7b;};'use strict';var multer=require('multer');var util=require(_0xfac5('0x0'));var path=require(_0xfac5('0x1'));var timeout=require('connect-timeout');var express=require(_0xfac5('0x2'));var router=express[_0xfac5('0x3')]();var auth=require(_0xfac5('0x4'));var interaction=require(_0xfac5('0x5'));var config=require(_0xfac5('0x6'));var controller=require(_0xfac5('0x7'));router[_0xfac5('0x8')]('/',auth['isAuthenticated'](),controller[_0xfac5('0x9')]);router[_0xfac5('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xfac5('0xa'),auth[_0xfac5('0xb')](),controller[_0xfac5('0xc')]);router[_0xfac5('0xd')]('/',auth[_0xfac5('0xb')](),controller[_0xfac5('0xe')]);router[_0xfac5('0xf')](_0xfac5('0x10'),auth[_0xfac5('0xb')](),controller[_0xfac5('0x11')]);router[_0xfac5('0x12')](_0xfac5('0x10'),auth[_0xfac5('0xb')](),controller[_0xfac5('0x13')]);module[_0xfac5('0x14')]=router; \ No newline at end of file +var _0x8a66=['create','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','isAuthenticated','show','/:id/messages','getMessages','post'];(function(_0x1dac7a,_0x1828ce){var _0x4cb363=function(_0x80f6de){while(--_0x80f6de){_0x1dac7a['push'](_0x1dac7a['shift']());}};_0x4cb363(++_0x1828ce);}(_0x8a66,0xe0));var _0x68a6=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x8a66[_0x3a7a9c];return _0x59156e;};'use strict';var multer=require(_0x68a6('0x0'));var util=require(_0x68a6('0x1'));var path=require(_0x68a6('0x2'));var timeout=require(_0x68a6('0x3'));var express=require(_0x68a6('0x4'));var router=express[_0x68a6('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x68a6('0x6'));var config=require(_0x68a6('0x7'));var controller=require(_0x68a6('0x8'));router[_0x68a6('0x9')]('/',auth['isAuthenticated'](),controller[_0x68a6('0xa')]);router[_0x68a6('0x9')]('/:id',auth[_0x68a6('0xb')](),controller[_0x68a6('0xc')]);router[_0x68a6('0x9')](_0x68a6('0xd'),auth[_0x68a6('0xb')](),controller[_0x68a6('0xe')]);router[_0x68a6('0xf')]('/',auth[_0x68a6('0xb')](),controller[_0x68a6('0x10')]);router['put'](_0x68a6('0x11'),auth[_0x68a6('0xb')](),controller[_0x68a6('0x12')]);router['delete']('/:id',auth[_0x68a6('0xb')](),controller[_0x68a6('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 264400b..099f075 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 _0x5c00=['VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0x44b8db,_0x2ecd08){var _0x57b5f5=function(_0x52c1a7){while(--_0x52c1a7){_0x44b8db['push'](_0x44b8db['shift']());}};_0x57b5f5(++_0x2ecd08);}(_0x5c00,0x17e));var _0x05c0=function(_0x3f83dc,_0x5c8047){_0x3f83dc=_0x3f83dc-0x0;var _0x3876b8=_0x5c00[_0x3f83dc];return _0x3876b8;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'customer_id':{'type':Sequelize[_0x05c0('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x05c0('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x05c0('0x2')],'defaultValue':'','allowNull':![],'unique':_0x05c0('0x4')},'password':{'type':Sequelize[_0x05c0('0x2')]},'fullname':{'type':Sequelize[_0x05c0('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x145973){this[_0x05c0('0x5')](_0x05c0('0x6'),typeof _0x145973===_0x05c0('0x7')&&_0x145973['trim']()?_0x145973[_0x05c0('0x8')]():null);}},'pager':{'type':Sequelize[_0x05c0('0x2')]},'tz':{'type':Sequelize[_0x05c0('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x05c0('0x9')](_0x05c0('0xa'),'no'),'defaultValue':_0x05c0('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x05c0('0x9')](_0x05c0('0xa'),'no'),'defaultValue':_0x05c0('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x05c0('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x05c0('0x9')](_0x05c0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x05c0('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x05c0('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x05c0('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x05c0('0x9')](_0x05c0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x05c0('0x9')](_0x05c0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x05c0('0x9')](_0x05c0('0xa'),'no'),'defaultValue':_0x05c0('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x05c0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x05c0('0x9')](_0x05c0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x05c0('0x9')](_0x05c0('0xa'),'no'),'defaultValue':_0x05c0('0xa'),'allowNull':![]},'stamp':{'type':_0x05c0('0xc')},'emailsubject':{'type':Sequelize[_0x05c0('0x2')]},'emailbody':{'type':Sequelize[_0x05c0('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x05c0('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x05c0('0xe')],'get':function(){return this[_0x05c0('0xf')]('fullname')+_0x05c0('0x10')+this[_0x05c0('0xf')](_0x05c0('0x11'));}}}; \ No newline at end of file +var _0xbdb7=['getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','email','string','yes','ENUM','INTEGER'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2c90c1,_0x446eda){_0x2c90c1=_0x2c90c1-0x0;var _0xcb55d4=_0xbdb7[_0x2c90c1];return _0xcb55d4;};'use strict';var Sequelize=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]={'customer_id':{'type':Sequelize[_0x7bdb('0x2')]},'context':{'type':Sequelize[_0x7bdb('0x2')],'defaultValue':_0x7bdb('0x3'),'unique':_0x7bdb('0x4')},'mailbox':{'type':Sequelize[_0x7bdb('0x2')],'defaultValue':'','allowNull':![],'unique':_0x7bdb('0x4')},'password':{'type':Sequelize[_0x7bdb('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7bdb('0x2')],'validate':{'isEmail':!![]},'set':function(_0x4fd1ad){this['setDataValue'](_0x7bdb('0x5'),typeof _0x4fd1ad===_0x7bdb('0x6')&&_0x4fd1ad['trim']()?_0x4fd1ad['trim']():null);}},'pager':{'type':Sequelize[_0x7bdb('0x2')]},'tz':{'type':Sequelize[_0x7bdb('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x7bdb('0x7'),'no'),'defaultValue':_0x7bdb('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x7bdb('0x8')](_0x7bdb('0x7'),'no'),'defaultValue':_0x7bdb('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x7bdb('0x2')]},'callback':{'type':Sequelize[_0x7bdb('0x2')]},'review':{'type':Sequelize[_0x7bdb('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7bdb('0x8')](_0x7bdb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x7bdb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x7bdb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x7bdb('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x7bdb('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x7bdb('0x8')](_0x7bdb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x7bdb('0x8')](_0x7bdb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7bdb('0x8')](_0x7bdb('0x7'),'no'),'defaultValue':_0x7bdb('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x7bdb('0x2')]},'emailbody':{'type':Sequelize[_0x7bdb('0x2')]},'maxsecs':{'type':Sequelize[_0x7bdb('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x7bdb('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x7bdb('0xa')](_0x7bdb('0xb'))+'\x20-\x20'+this[_0x7bdb('0xa')](_0x7bdb('0xc'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 56f89a1..3d434ed 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 _0xbd60=['intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMail','includeAll','include','findAll','rows','show','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','VoiceMailMessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xbd60,0x78));var _0x0bd6=function(_0x3b876c,_0x340f60){_0x3b876c=_0x3b876c-0x0;var _0x2d5333=_0xbd60[_0x3b876c];return _0x2d5333;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0bd6('0x0'));var rimraf=require(_0x0bd6('0x1'));var zipdir=require(_0x0bd6('0x2'));var jsonpatch=require(_0x0bd6('0x3'));var rp=require('request-promise');var moment=require(_0x0bd6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0bd6('0x5'));var util=require(_0x0bd6('0x6'));var path=require(_0x0bd6('0x7'));var sox=require(_0x0bd6('0x8'));var csv=require(_0x0bd6('0x9'));var ejs=require(_0x0bd6('0xa'));var fs=require('fs');var _=require(_0x0bd6('0xb'));var squel=require(_0x0bd6('0xc'));var crypto=require(_0x0bd6('0xd'));var jsforce=require(_0x0bd6('0xe'));var deskjs=require(_0x0bd6('0xf'));var toCsv=require(_0x0bd6('0x9'));var querystring=require(_0x0bd6('0x10'));var Papa=require(_0x0bd6('0x11'));var Redis=require('ioredis');var authService=require(_0x0bd6('0x12'));var qs=require(_0x0bd6('0x13'));var as=require(_0x0bd6('0x14'));var hardwareService=require(_0x0bd6('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x0bd6('0x16'));var config=require(_0x0bd6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e784f,_0x2fdcc9){_0x2fdcc9=_0x2fdcc9||0xcc;return function(_0x43ac19){if(_0x43ac19){return _0x4e784f[_0x0bd6('0x18')](_0x2fdcc9);}return _0x4e784f[_0x0bd6('0x19')](_0x2fdcc9)[_0x0bd6('0x1a')]();};}function respondWithResult(_0x4e6ecf,_0x4beaf0){_0x4beaf0=_0x4beaf0||0xc8;return function(_0x1c72b8){if(_0x1c72b8){return _0x4e6ecf[_0x0bd6('0x19')](_0x4beaf0)[_0x0bd6('0x1b')](_0x1c72b8);}};}function respondWithFilteredResult(_0x17dad2,_0x123750){return function(_0x3f7de2){if(_0x3f7de2){var _0x7c26ea=_0x3f7de2[_0x0bd6('0x1c')],_0x9d4cf0=_0x123750[_0x0bd6('0x1d')],_0x133fff=_0x123750[_0x0bd6('0x1d')]+_0x123750['limit'],_0x4f2c44;if(_0x133fff>=_0x7c26ea){_0x133fff=_0x7c26ea;_0x4f2c44=0xc8;}else{_0x4f2c44=0xce;}_0x17dad2['status'](_0x4f2c44);return _0x17dad2[_0x0bd6('0x1e')](_0x0bd6('0x1f'),_0x9d4cf0+'-'+_0x133fff+'/'+_0x7c26ea)['json'](_0x3f7de2);}return null;};}function patchUpdates(_0x13844a){return function(_0x2a2855){try{jsonpatch['apply'](_0x2a2855,_0x13844a,!![]);}catch(_0x194bc6){return BPromise[_0x0bd6('0x20')](_0x194bc6);}return _0x2a2855[_0x0bd6('0x21')]();};}function saveUpdates(_0x1107f2,_0x68a144){return function(_0x6142da){if(_0x6142da){return _0x6142da[_0x0bd6('0x22')](_0x1107f2)[_0x0bd6('0x23')](function(_0x230b1b){return _0x230b1b;});}return null;};}function removeEntity(_0x452e21,_0x47cfe8){return function(_0x1567e2){if(_0x1567e2){return _0x1567e2[_0x0bd6('0x24')]()[_0x0bd6('0x23')](function(){var _0x3843e1=_0x1567e2[_0x0bd6('0x25')]({'plain':!![]});var _0x3a034d='Voicemails';return db['UserProfileResource'][_0x0bd6('0x24')]({'where':{'type':_0x3a034d,'resourceId':_0x3843e1['id']}})[_0x0bd6('0x23')](function(){return _0x1567e2;});})['then'](function(){_0x452e21['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f4471,_0x53ab02){return function(_0x5119e7){if(!_0x5119e7){_0x3f4471['sendStatus'](0x194);}return _0x5119e7;};}function handleError(_0xcd8d9a,_0x5f5851){_0x5f5851=_0x5f5851||0x1f4;return function(_0x58034f){logger[_0x0bd6('0x26')](_0x58034f[_0x0bd6('0x27')]);if(_0x58034f[_0x0bd6('0x28')]){delete _0x58034f[_0x0bd6('0x28')];}_0xcd8d9a['status'](_0x5f5851)[_0x0bd6('0x29')](_0x58034f);};}exports[_0x0bd6('0x2a')]=function(_0x5dc238,_0x11eb8e){var _0x548692={},_0x26d824={},_0x43a112={'count':0x0,'rows':[]};var _0x3fded5=_[_0x0bd6('0x2b')](db['VoiceMail'][_0x0bd6('0x2c')],function(_0x3786b2){return{'name':_0x3786b2[_0x0bd6('0x2d')],'type':_0x3786b2[_0x0bd6('0x2e')][_0x0bd6('0x2f')]};});_0x26d824[_0x0bd6('0x30')]=_[_0x0bd6('0x2b')](_0x3fded5,_0x0bd6('0x28'));_0x26d824[_0x0bd6('0x31')]=_[_0x0bd6('0x32')](_0x5dc238[_0x0bd6('0x31')]);_0x26d824[_0x0bd6('0x33')]=_[_0x0bd6('0x34')](_0x26d824[_0x0bd6('0x30')],_0x26d824[_0x0bd6('0x31')]);_0x548692[_0x0bd6('0x35')]=_[_0x0bd6('0x34')](_0x26d824[_0x0bd6('0x30')],qs[_0x0bd6('0x36')](_0x5dc238[_0x0bd6('0x31')][_0x0bd6('0x36')]));_0x548692['attributes']=_0x548692[_0x0bd6('0x35')][_0x0bd6('0x37')]?_0x548692[_0x0bd6('0x35')]:_0x26d824[_0x0bd6('0x30')];if(!_0x5dc238[_0x0bd6('0x31')][_0x0bd6('0x38')](_0x0bd6('0x39'))){_0x548692[_0x0bd6('0x3a')]=qs['limit'](_0x5dc238[_0x0bd6('0x31')][_0x0bd6('0x3a')]);_0x548692[_0x0bd6('0x1d')]=qs[_0x0bd6('0x1d')](_0x5dc238[_0x0bd6('0x31')][_0x0bd6('0x1d')]);}_0x548692[_0x0bd6('0x3b')]=qs[_0x0bd6('0x3c')](_0x5dc238[_0x0bd6('0x31')][_0x0bd6('0x3c')]);_0x548692[_0x0bd6('0x3d')]=qs['filters'](_[_0x0bd6('0x3e')](_0x5dc238[_0x0bd6('0x31')],_0x26d824[_0x0bd6('0x33')]),_0x3fded5);if(_0x5dc238[_0x0bd6('0x31')][_0x0bd6('0x3f')]){_0x548692[_0x0bd6('0x3d')]=_[_0x0bd6('0x40')](_0x548692[_0x0bd6('0x3d')],{'$or':_[_0x0bd6('0x2b')](_0x3fded5,function(_0x55ffa1){if(_0x55ffa1[_0x0bd6('0x2e')]!==_0x0bd6('0x41')){var _0x14551e={};_0x14551e[_0x55ffa1['name']]={'$like':'%'+_0x5dc238[_0x0bd6('0x31')]['filter']+'%'};return _0x14551e;}})});}_0x548692=_['merge']({},_0x548692,_0x5dc238[_0x0bd6('0x42')]);var _0x52df9c={'where':_0x548692['where']};return db[_0x0bd6('0x43')][_0x0bd6('0x1c')](_0x52df9c)[_0x0bd6('0x23')](function(_0x328d9a){_0x43a112[_0x0bd6('0x1c')]=_0x328d9a;if(_0x5dc238['query'][_0x0bd6('0x44')]){_0x548692[_0x0bd6('0x45')]=[{'all':!![]}];}return db[_0x0bd6('0x43')][_0x0bd6('0x46')](_0x548692);})[_0x0bd6('0x23')](function(_0x264087){_0x43a112[_0x0bd6('0x47')]=_0x264087;return _0x43a112;})['then'](respondWithFilteredResult(_0x11eb8e,_0x548692))['catch'](handleError(_0x11eb8e,null));};exports[_0x0bd6('0x48')]=function(_0x5b21cb,_0x10f2e8){var _0x38a060={'raw':!![],'where':{'id':_0x5b21cb['params']['id']}},_0xaedd5a={};_0xaedd5a[_0x0bd6('0x30')]=_['keys'](db[_0x0bd6('0x43')][_0x0bd6('0x2c')]);_0xaedd5a[_0x0bd6('0x31')]=_[_0x0bd6('0x32')](_0x5b21cb[_0x0bd6('0x31')]);_0xaedd5a[_0x0bd6('0x33')]=_[_0x0bd6('0x34')](_0xaedd5a[_0x0bd6('0x30')],_0xaedd5a[_0x0bd6('0x31')]);_0x38a060[_0x0bd6('0x35')]=_[_0x0bd6('0x34')](_0xaedd5a[_0x0bd6('0x30')],qs[_0x0bd6('0x36')](_0x5b21cb[_0x0bd6('0x31')][_0x0bd6('0x36')]));_0x38a060[_0x0bd6('0x35')]=_0x38a060[_0x0bd6('0x35')][_0x0bd6('0x37')]?_0x38a060[_0x0bd6('0x35')]:_0xaedd5a[_0x0bd6('0x30')];if(_0x5b21cb[_0x0bd6('0x31')][_0x0bd6('0x44')]){_0x38a060[_0x0bd6('0x45')]=[{'all':!![]}];}_0x38a060=_[_0x0bd6('0x40')]({},_0x38a060,_0x5b21cb['options']);return db[_0x0bd6('0x43')]['find'](_0x38a060)[_0x0bd6('0x23')](handleEntityNotFound(_0x10f2e8,null))['then'](respondWithResult(_0x10f2e8,null))[_0x0bd6('0x49')](handleError(_0x10f2e8,null));};exports[_0x0bd6('0x4a')]=function(_0x58926a,_0x142528){return db['VoiceMail']['create'](_0x58926a[_0x0bd6('0x4b')],{})[_0x0bd6('0x23')](function(_0x3f48ff){var _0x374596=_0x58926a[_0x0bd6('0x4c')]['get']({'plain':!![]});if(!_0x374596)throw new Error(_0x0bd6('0x4d'));if(_0x374596[_0x0bd6('0x4e')]===_0x0bd6('0x4c')){var _0x26c414=_0x3f48ff[_0x0bd6('0x25')]({'plain':!![]});var _0x5bad4a=_0x0bd6('0x4f');return db['UserProfileSection'][_0x0bd6('0x50')]({'where':{'name':_0x5bad4a,'userProfileId':_0x374596['userProfileId']},'raw':!![]})[_0x0bd6('0x23')](function(_0x3e4348){if(_0x3e4348&&_0x3e4348[_0x0bd6('0x51')]===0x0){return db['UserProfileResource'][_0x0bd6('0x4a')]({'name':_0x26c414[_0x0bd6('0x28')],'resourceId':_0x26c414['id'],'type':_0x3e4348[_0x0bd6('0x28')],'sectionId':_0x3e4348['id']},{})[_0x0bd6('0x23')](function(){return _0x3f48ff;});}else{return _0x3f48ff;}})[_0x0bd6('0x49')](function(_0x35bf9c){logger[_0x0bd6('0x26')](_0x0bd6('0x52'),_0x35bf9c);throw _0x35bf9c;});}return _0x3f48ff;})[_0x0bd6('0x23')](respondWithResult(_0x142528,0xc9))[_0x0bd6('0x49')](handleError(_0x142528,null));};exports[_0x0bd6('0x22')]=function(_0x5cee57,_0x4a30bd){if(_0x5cee57['body']['id']){delete _0x5cee57[_0x0bd6('0x4b')]['id'];}return db['VoiceMail'][_0x0bd6('0x50')]({'where':{'id':_0x5cee57[_0x0bd6('0x53')]['id']}})[_0x0bd6('0x23')](handleEntityNotFound(_0x4a30bd,null))[_0x0bd6('0x23')](saveUpdates(_0x5cee57[_0x0bd6('0x4b')],null))[_0x0bd6('0x23')](respondWithResult(_0x4a30bd,null))['catch'](handleError(_0x4a30bd,null));};exports[_0x0bd6('0x24')]=function(_0x33b74e,_0x215924){return db[_0x0bd6('0x43')][_0x0bd6('0x50')]({'where':{'id':_0x33b74e[_0x0bd6('0x53')]['id']}})[_0x0bd6('0x23')](handleEntityNotFound(_0x215924,null))['then'](removeEntity(_0x215924,null))['catch'](handleError(_0x215924,null));};exports[_0x0bd6('0x54')]=function(_0x4c95fa,_0x2ed2ea,_0x169d20){return db['VoiceMail']['findOne']({'where':{'id':_0x4c95fa[_0x0bd6('0x53')]['id']}})[_0x0bd6('0x23')](handleEntityNotFound(_0x2ed2ea,null))[_0x0bd6('0x23')](function(_0x580160){var _0x596f10;var _0x306119={},_0x5c8d1a={};_0x5c8d1a[_0x0bd6('0x30')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x5c8d1a['query']=_[_0x0bd6('0x32')](_0x4c95fa[_0x0bd6('0x31')]);_0x5c8d1a[_0x0bd6('0x33')]=_[_0x0bd6('0x34')](_0x5c8d1a['model'],_0x5c8d1a[_0x0bd6('0x31')]);_0x306119[_0x0bd6('0x35')]=_[_0x0bd6('0x34')](_0x5c8d1a[_0x0bd6('0x30')],qs[_0x0bd6('0x36')](_0x4c95fa['query'][_0x0bd6('0x36')]));_0x306119['attributes']=_0x306119[_0x0bd6('0x35')][_0x0bd6('0x37')]?_0x306119[_0x0bd6('0x35')]:_0x5c8d1a['model'];if(!_0x4c95fa['query'][_0x0bd6('0x38')](_0x0bd6('0x39'))){_0x306119['limit']=qs[_0x0bd6('0x3a')](_0x4c95fa[_0x0bd6('0x31')][_0x0bd6('0x3a')]);_0x306119[_0x0bd6('0x1d')]=qs['offset'](_0x4c95fa[_0x0bd6('0x31')][_0x0bd6('0x1d')]);}_0x306119[_0x0bd6('0x3b')]=qs[_0x0bd6('0x3c')](_0x4c95fa[_0x0bd6('0x31')][_0x0bd6('0x3c')]);_0x306119['where']=qs['filters'](_[_0x0bd6('0x3e')](_0x4c95fa[_0x0bd6('0x31')],_0x5c8d1a['filters']));if(_0x4c95fa['query'][_0x0bd6('0x3f')]){_0x306119[_0x0bd6('0x3d')]=_[_0x0bd6('0x40')](_0x306119[_0x0bd6('0x3d')],{'$or':_[_0x0bd6('0x2b')](_0x306119[_0x0bd6('0x35')],function(_0x4acaaa){var _0x27f7fc={};_0x27f7fc[_0x4acaaa]={'$like':'%'+_0x4c95fa[_0x0bd6('0x31')]['filter']+'%'};return _0x27f7fc;})});}_0x306119[_0x0bd6('0x3d')]=_[_0x0bd6('0x40')](_0x306119[_0x0bd6('0x3d')],{'mailboxuser':_0x580160['mailbox']});_0x306119=_[_0x0bd6('0x40')]({},_0x306119,_0x4c95fa[_0x0bd6('0x42')]);return db[_0x0bd6('0x55')]['findAndCountAll'](_0x306119)[_0x0bd6('0x23')](respondWithFilteredResult(_0x2ed2ea,_0x306119));})['catch'](handleError(_0x2ed2ea,null));}; \ No newline at end of file +var _0x39c8=['merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getMessages','findOne','mailbox','options','findAndCountAll','html-pdf','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','set','apply','save','update','then','get','Voicemails','UserProfileResource','sendStatus','error','stack','name','send','map','VoiceMail','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where'];(function(_0x1e7e6d,_0x590bab){var _0x1662ba=function(_0x51935b){while(--_0x51935b){_0x1e7e6d['push'](_0x1e7e6d['shift']());}};_0x1662ba(++_0x590bab);}(_0x39c8,0xc3));var _0x839c=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x39c8[_0xefd519];return _0x4bb882;};'use strict';var pdf=require(_0x839c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x839c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x839c('0x2'));var rp=require(_0x839c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x839c('0x4'));var util=require('util');var path=require(_0x839c('0x5'));var sox=require(_0x839c('0x6'));var csv=require(_0x839c('0x7'));var ejs=require(_0x839c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x839c('0x9'));var crypto=require(_0x839c('0xa'));var jsforce=require(_0x839c('0xb'));var deskjs=require(_0x839c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x839c('0xd'));var Papa=require('papaparse');var Redis=require(_0x839c('0xe'));var authService=require(_0x839c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x839c('0x10'));var hardwareService=require(_0x839c('0x11'));var logger=require(_0x839c('0x12'))(_0x839c('0x13'));var utils=require(_0x839c('0x14'));var config=require(_0x839c('0x15'));var db=require(_0x839c('0x16'))['db'];function respondWithStatusCode(_0x1bb38b,_0x5e6d67){_0x5e6d67=_0x5e6d67||0xcc;return function(_0x2cf0bc){if(_0x2cf0bc){return _0x1bb38b['sendStatus'](_0x5e6d67);}return _0x1bb38b[_0x839c('0x17')](_0x5e6d67)[_0x839c('0x18')]();};}function respondWithResult(_0x3f3154,_0x530b27){_0x530b27=_0x530b27||0xc8;return function(_0x15810a){if(_0x15810a){return _0x3f3154[_0x839c('0x17')](_0x530b27)[_0x839c('0x19')](_0x15810a);}};}function respondWithFilteredResult(_0x3a18a6,_0x33d169){return function(_0x39c8bf){if(_0x39c8bf){var _0x4e7a45=_0x39c8bf['count'],_0x27980c=_0x33d169[_0x839c('0x1a')],_0x5dcfb1=_0x33d169[_0x839c('0x1a')]+_0x33d169['limit'],_0x51c98d;if(_0x5dcfb1>=_0x4e7a45){_0x5dcfb1=_0x4e7a45;_0x51c98d=0xc8;}else{_0x51c98d=0xce;}_0x3a18a6[_0x839c('0x17')](_0x51c98d);return _0x3a18a6[_0x839c('0x1b')]('Content-Range',_0x27980c+'-'+_0x5dcfb1+'/'+_0x4e7a45)[_0x839c('0x19')](_0x39c8bf);}return null;};}function patchUpdates(_0x1deeb7){return function(_0x172446){try{jsonpatch[_0x839c('0x1c')](_0x172446,_0x1deeb7,!![]);}catch(_0x24f87b){return BPromise['reject'](_0x24f87b);}return _0x172446[_0x839c('0x1d')]();};}function saveUpdates(_0x2fec5e,_0x2cb42a){return function(_0x5deb56){if(_0x5deb56){return _0x5deb56[_0x839c('0x1e')](_0x2fec5e)['then'](function(_0x2192e7){return _0x2192e7;});}return null;};}function removeEntity(_0x48c7ae,_0x5c69ba){return function(_0xb513b7){if(_0xb513b7){return _0xb513b7['destroy']()[_0x839c('0x1f')](function(){var _0x1db44a=_0xb513b7[_0x839c('0x20')]({'plain':!![]});var _0x53b1e6=_0x839c('0x21');return db[_0x839c('0x22')]['destroy']({'where':{'type':_0x53b1e6,'resourceId':_0x1db44a['id']}})[_0x839c('0x1f')](function(){return _0xb513b7;});})[_0x839c('0x1f')](function(){_0x48c7ae['status'](0xcc)[_0x839c('0x18')]();});}};}function handleEntityNotFound(_0x4bf1cb,_0x2b3b54){return function(_0x10902b){if(!_0x10902b){_0x4bf1cb[_0x839c('0x23')](0x194);}return _0x10902b;};}function handleError(_0x3fbe07,_0x516eb0){_0x516eb0=_0x516eb0||0x1f4;return function(_0x5b9080){logger[_0x839c('0x24')](_0x5b9080[_0x839c('0x25')]);if(_0x5b9080[_0x839c('0x26')]){delete _0x5b9080[_0x839c('0x26')];}_0x3fbe07[_0x839c('0x17')](_0x516eb0)[_0x839c('0x27')](_0x5b9080);};}exports['index']=function(_0x127fb9,_0x3e7dd9){var _0xdcc310={},_0x2e76d3={},_0x34bab2={'count':0x0,'rows':[]};var _0x724df7=_[_0x839c('0x28')](db[_0x839c('0x29')]['rawAttributes'],function(_0x8e2141){return{'name':_0x8e2141[_0x839c('0x2a')],'type':_0x8e2141[_0x839c('0x2b')]['key']};});_0x2e76d3[_0x839c('0x2c')]=_[_0x839c('0x28')](_0x724df7,'name');_0x2e76d3['query']=_[_0x839c('0x2d')](_0x127fb9['query']);_0x2e76d3[_0x839c('0x2e')]=_[_0x839c('0x2f')](_0x2e76d3['model'],_0x2e76d3[_0x839c('0x30')]);_0xdcc310['attributes']=_[_0x839c('0x2f')](_0x2e76d3['model'],qs[_0x839c('0x31')](_0x127fb9['query']['fields']));_0xdcc310[_0x839c('0x32')]=_0xdcc310[_0x839c('0x32')][_0x839c('0x33')]?_0xdcc310[_0x839c('0x32')]:_0x2e76d3[_0x839c('0x2c')];if(!_0x127fb9[_0x839c('0x30')][_0x839c('0x34')](_0x839c('0x35'))){_0xdcc310[_0x839c('0x36')]=qs[_0x839c('0x36')](_0x127fb9['query'][_0x839c('0x36')]);_0xdcc310['offset']=qs['offset'](_0x127fb9[_0x839c('0x30')][_0x839c('0x1a')]);}_0xdcc310[_0x839c('0x37')]=qs[_0x839c('0x38')](_0x127fb9[_0x839c('0x30')]['sort']);_0xdcc310['where']=qs[_0x839c('0x2e')](_[_0x839c('0x39')](_0x127fb9[_0x839c('0x30')],_0x2e76d3[_0x839c('0x2e')]),_0x724df7);if(_0x127fb9[_0x839c('0x30')][_0x839c('0x3a')]){_0xdcc310[_0x839c('0x3b')]=_[_0x839c('0x3c')](_0xdcc310['where'],{'$or':_['map'](_0x724df7,function(_0x407217){if(_0x407217[_0x839c('0x2b')]!==_0x839c('0x3d')){var _0x2a27e7={};_0x2a27e7[_0x407217['name']]={'$like':'%'+_0x127fb9[_0x839c('0x30')][_0x839c('0x3a')]+'%'};return _0x2a27e7;}})});}_0xdcc310=_[_0x839c('0x3c')]({},_0xdcc310,_0x127fb9['options']);var _0x3cbcc5={'where':_0xdcc310[_0x839c('0x3b')]};return db[_0x839c('0x29')][_0x839c('0x3e')](_0x3cbcc5)[_0x839c('0x1f')](function(_0x27a8f4){_0x34bab2['count']=_0x27a8f4;if(_0x127fb9['query'][_0x839c('0x3f')]){_0xdcc310[_0x839c('0x40')]=[{'all':!![]}];}return db['VoiceMail'][_0x839c('0x41')](_0xdcc310);})[_0x839c('0x1f')](function(_0x573549){_0x34bab2[_0x839c('0x42')]=_0x573549;return _0x34bab2;})[_0x839c('0x1f')](respondWithFilteredResult(_0x3e7dd9,_0xdcc310))[_0x839c('0x43')](handleError(_0x3e7dd9,null));};exports[_0x839c('0x44')]=function(_0x113f21,_0x3323c6){var _0xed9404={'raw':!![],'where':{'id':_0x113f21[_0x839c('0x45')]['id']}},_0x5766c0={};_0x5766c0[_0x839c('0x2c')]=_[_0x839c('0x2d')](db[_0x839c('0x29')]['rawAttributes']);_0x5766c0['query']=_[_0x839c('0x2d')](_0x113f21['query']);_0x5766c0['filters']=_[_0x839c('0x2f')](_0x5766c0[_0x839c('0x2c')],_0x5766c0[_0x839c('0x30')]);_0xed9404[_0x839c('0x32')]=_[_0x839c('0x2f')](_0x5766c0[_0x839c('0x2c')],qs[_0x839c('0x31')](_0x113f21['query']['fields']));_0xed9404[_0x839c('0x32')]=_0xed9404[_0x839c('0x32')]['length']?_0xed9404[_0x839c('0x32')]:_0x5766c0[_0x839c('0x2c')];if(_0x113f21['query'][_0x839c('0x3f')]){_0xed9404[_0x839c('0x40')]=[{'all':!![]}];}_0xed9404=_[_0x839c('0x3c')]({},_0xed9404,_0x113f21['options']);return db[_0x839c('0x29')][_0x839c('0x46')](_0xed9404)[_0x839c('0x1f')](handleEntityNotFound(_0x3323c6,null))[_0x839c('0x1f')](respondWithResult(_0x3323c6,null))[_0x839c('0x43')](handleError(_0x3323c6,null));};exports[_0x839c('0x47')]=function(_0x519bf0,_0x60d836){return db[_0x839c('0x29')]['create'](_0x519bf0[_0x839c('0x48')],{})['then'](function(_0x5ac428){var _0x25cb57=_0x519bf0['user']['get']({'plain':!![]});if(!_0x25cb57)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25cb57[_0x839c('0x49')]===_0x839c('0x4a')){var _0x30ff06=_0x5ac428[_0x839c('0x20')]({'plain':!![]});var _0x521ddf=_0x839c('0x21');return db[_0x839c('0x4b')]['find']({'where':{'name':_0x521ddf,'userProfileId':_0x25cb57[_0x839c('0x4c')]},'raw':!![]})['then'](function(_0x8462e6){if(_0x8462e6&&_0x8462e6[_0x839c('0x4d')]===0x0){return db[_0x839c('0x22')]['create']({'name':_0x30ff06['name'],'resourceId':_0x30ff06['id'],'type':_0x8462e6['name'],'sectionId':_0x8462e6['id']},{})[_0x839c('0x1f')](function(){return _0x5ac428;});}else{return _0x5ac428;}})[_0x839c('0x43')](function(_0x5dfcf6){logger[_0x839c('0x24')](_0x839c('0x4e'),_0x5dfcf6);throw _0x5dfcf6;});}return _0x5ac428;})[_0x839c('0x1f')](respondWithResult(_0x60d836,0xc9))[_0x839c('0x43')](handleError(_0x60d836,null));};exports['update']=function(_0x554573,_0x48e419){if(_0x554573['body']['id']){delete _0x554573[_0x839c('0x48')]['id'];}return db[_0x839c('0x29')][_0x839c('0x46')]({'where':{'id':_0x554573[_0x839c('0x45')]['id']}})[_0x839c('0x1f')](handleEntityNotFound(_0x48e419,null))[_0x839c('0x1f')](saveUpdates(_0x554573[_0x839c('0x48')],null))[_0x839c('0x1f')](respondWithResult(_0x48e419,null))[_0x839c('0x43')](handleError(_0x48e419,null));};exports[_0x839c('0x4f')]=function(_0x2a3b36,_0x465a15){return db[_0x839c('0x29')][_0x839c('0x46')]({'where':{'id':_0x2a3b36[_0x839c('0x45')]['id']}})[_0x839c('0x1f')](handleEntityNotFound(_0x465a15,null))[_0x839c('0x1f')](removeEntity(_0x465a15,null))[_0x839c('0x43')](handleError(_0x465a15,null));};exports[_0x839c('0x50')]=function(_0x5e5e59,_0x2a5559,_0x46bc9f){return db['VoiceMail'][_0x839c('0x51')]({'where':{'id':_0x5e5e59[_0x839c('0x45')]['id']}})[_0x839c('0x1f')](handleEntityNotFound(_0x2a5559,null))['then'](function(_0x3a7b43){var _0xdbabe5;var _0x182ba1={},_0x27c85a={};_0x27c85a[_0x839c('0x2c')]=_[_0x839c('0x2d')](db['VoiceMailMessage']['rawAttributes']);_0x27c85a[_0x839c('0x30')]=_[_0x839c('0x2d')](_0x5e5e59['query']);_0x27c85a['filters']=_[_0x839c('0x2f')](_0x27c85a['model'],_0x27c85a['query']);_0x182ba1[_0x839c('0x32')]=_['intersection'](_0x27c85a['model'],qs[_0x839c('0x31')](_0x5e5e59['query'][_0x839c('0x31')]));_0x182ba1['attributes']=_0x182ba1[_0x839c('0x32')][_0x839c('0x33')]?_0x182ba1[_0x839c('0x32')]:_0x27c85a['model'];if(!_0x5e5e59[_0x839c('0x30')][_0x839c('0x34')](_0x839c('0x35'))){_0x182ba1[_0x839c('0x36')]=qs[_0x839c('0x36')](_0x5e5e59[_0x839c('0x30')][_0x839c('0x36')]);_0x182ba1[_0x839c('0x1a')]=qs[_0x839c('0x1a')](_0x5e5e59[_0x839c('0x30')][_0x839c('0x1a')]);}_0x182ba1[_0x839c('0x37')]=qs['sort'](_0x5e5e59[_0x839c('0x30')][_0x839c('0x38')]);_0x182ba1[_0x839c('0x3b')]=qs['filters'](_[_0x839c('0x39')](_0x5e5e59['query'],_0x27c85a[_0x839c('0x2e')]));if(_0x5e5e59['query']['filter']){_0x182ba1[_0x839c('0x3b')]=_['merge'](_0x182ba1[_0x839c('0x3b')],{'$or':_[_0x839c('0x28')](_0x182ba1[_0x839c('0x32')],function(_0x17360a){var _0x2089d3={};_0x2089d3[_0x17360a]={'$like':'%'+_0x5e5e59[_0x839c('0x30')][_0x839c('0x3a')]+'%'};return _0x2089d3;})});}_0x182ba1[_0x839c('0x3b')]=_['merge'](_0x182ba1[_0x839c('0x3b')],{'mailboxuser':_0x3a7b43[_0x839c('0x52')]});_0x182ba1=_['merge']({},_0x182ba1,_0x5e5e59[_0x839c('0x53')]);return db['VoiceMailMessage'][_0x839c('0x54')](_0x182ba1)[_0x839c('0x1f')](respondWithFilteredResult(_0x2a5559,_0x182ba1));})[_0x839c('0x43')](handleError(_0x2a5559,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index ea42893..c7ebe6a 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 _0xd547=['exports','VoiceMail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes'];(function(_0xc7d685,_0x769f27){var _0x5805aa=function(_0x3dc41a){while(--_0x3dc41a){_0xc7d685['push'](_0xc7d685['shift']());}};_0x5805aa(++_0x769f27);}(_0xd547,0x1a9));var _0x7d54=function(_0x188cb8,_0x3b12b3){_0x188cb8=_0x188cb8-0x0;var _0x25eb9b=_0xd547[_0x188cb8];return _0x25eb9b;};'use strict';var _=require(_0x7d54('0x0'));var util=require(_0x7d54('0x1'));var logger=require(_0x7d54('0x2'))(_0x7d54('0x3'));var moment=require(_0x7d54('0x4'));var BPromise=require(_0x7d54('0x5'));var rp=require(_0x7d54('0x6'));var fs=require('fs');var path=require(_0x7d54('0x7'));var rimraf=require(_0x7d54('0x8'));var config=require('../../config/environment');var attributes=require(_0x7d54('0x9'));module[_0x7d54('0xa')]=function(_0x28d24a,_0x128523){return _0x28d24a['define'](_0x7d54('0xb'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x7d54('0xc'),'fields':[_0x7d54('0xd'),_0x7d54('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbfb9=['request-promise','path','rimraf','../../config/environment','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x34f701,_0x37e407){var _0x3e2429=function(_0x20c0c3){while(--_0x20c0c3){_0x34f701['push'](_0x34f701['shift']());}};_0x3e2429(++_0x37e407);}(_0xbfb9,0x144));var _0x9bfb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbfb9[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x9bfb('0x0'));var util=require(_0x9bfb('0x1'));var logger=require(_0x9bfb('0x2'))(_0x9bfb('0x3'));var moment=require(_0x9bfb('0x4'));var BPromise=require(_0x9bfb('0x5'));var rp=require(_0x9bfb('0x6'));var fs=require('fs');var path=require(_0x9bfb('0x7'));var rimraf=require(_0x9bfb('0x8'));var config=require(_0x9bfb('0x9'));var attributes=require('./voiceMail.attributes');module[_0x9bfb('0xa')]=function(_0x3117d8,_0x4e37ea){return _0x3117d8['define'](_0x9bfb('0xb'),attributes,{'tableName':_0x9bfb('0xc'),'paranoid':![],'indexes':[{'name':_0x9bfb('0xd'),'fields':[_0x9bfb('0xe'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 880b93e..c139cef 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 _0x813c=['code','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x514e03,_0x57a3ff){var _0x5eea66=function(_0xe65f6e){while(--_0xe65f6e){_0x514e03['push'](_0x514e03['shift']());}};_0x5eea66(++_0x57a3ff);}(_0x813c,0x1d1));var _0xc813=function(_0x4bb06b,_0x300851){_0x4bb06b=_0x4bb06b-0x0;var _0x2d67e6=_0x813c[_0x4bb06b];return _0x2d67e6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc813('0x0'));var rs=require(_0xc813('0x1'));var fs=require('fs');var Redis=require(_0xc813('0x2'));var db=require(_0xc813('0x3'))['db'];var utils=require(_0xc813('0x4'));var logger=require(_0xc813('0x5'))(_0xc813('0x6'));var config=require(_0xc813('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc813('0x8')][_0xc813('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ecfbd,_0x470f09,_0x1c0516){return new BPromise(function(_0x1ca6a3,_0x554125){return client['request'](_0x3ecfbd,_0x1c0516)[_0xc813('0xa')](function(_0x2287c3){logger[_0xc813('0xb')](_0xc813('0xc'),_0x470f09,_0xc813('0xd'));logger[_0xc813('0xe')](_0xc813('0xf'),_0x470f09,_0xc813('0xd'),JSON[_0xc813('0x10')](_0x2287c3));if(_0x2287c3['error']){if(_0x2287c3[_0xc813('0x11')][_0xc813('0x12')]===0x1f4){logger[_0xc813('0x11')](_0xc813('0xc'),_0x470f09,_0x2287c3[_0xc813('0x11')][_0xc813('0x13')]);return _0x554125(_0x2287c3[_0xc813('0x11')][_0xc813('0x13')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x470f09,_0x2287c3[_0xc813('0x11')]['message']);return _0x1ca6a3(_0x2287c3['error'][_0xc813('0x13')]);}else{logger[_0xc813('0xb')](_0xc813('0xc'),_0x470f09,_0xc813('0xd'));_0x1ca6a3(_0x2287c3['result'][_0xc813('0x13')]);}})[_0xc813('0x14')](function(_0xd6f781){logger['error'](_0xc813('0xc'),_0x470f09,_0xd6f781);_0x554125(_0xd6f781);});});} \ No newline at end of file +var _0xe36b=['then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceMail,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x3d5a85,_0xe82e44){var _0x403a6f=function(_0xc1b0e8){while(--_0xc1b0e8){_0x3d5a85['push'](_0x3d5a85['shift']());}};_0x403a6f(++_0xe82e44);}(_0xe36b,0xf2));var _0xbe36=function(_0x44f1d6,_0x1f9336){_0x44f1d6=_0x44f1d6-0x0;var _0x49a030=_0xe36b[_0x44f1d6];return _0x49a030;};'use strict';var _=require(_0xbe36('0x0'));var util=require(_0xbe36('0x1'));var moment=require(_0xbe36('0x2'));var BPromise=require(_0xbe36('0x3'));var rs=require(_0xbe36('0x4'));var fs=require('fs');var Redis=require(_0xbe36('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe36('0x6'));var logger=require(_0xbe36('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbe36('0x8'));var client=jayson[_0xbe36('0x9')][_0xbe36('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5796b3,_0x5ad297,_0x28ec3d){return new BPromise(function(_0x4ff61c,_0xfb5e14){return client['request'](_0x5796b3,_0x28ec3d)[_0xbe36('0xb')](function(_0x45d871){logger[_0xbe36('0xc')]('VoiceMail,\x20%s,\x20%s',_0x5ad297,_0xbe36('0xd'));logger[_0xbe36('0xe')](_0xbe36('0xf'),_0x5ad297,_0xbe36('0xd'),JSON[_0xbe36('0x10')](_0x45d871));if(_0x45d871[_0xbe36('0x11')]){if(_0x45d871[_0xbe36('0x11')][_0xbe36('0x12')]===0x1f4){logger[_0xbe36('0x11')]('VoiceMail,\x20%s,\x20%s',_0x5ad297,_0x45d871['error'][_0xbe36('0x13')]);return _0xfb5e14(_0x45d871['error'][_0xbe36('0x13')]);}logger[_0xbe36('0x11')](_0xbe36('0x14'),_0x5ad297,_0x45d871[_0xbe36('0x11')][_0xbe36('0x13')]);return _0x4ff61c(_0x45d871[_0xbe36('0x11')][_0xbe36('0x13')]);}else{logger[_0xbe36('0xc')]('VoiceMail,\x20%s,\x20%s',_0x5ad297,_0xbe36('0xd'));_0x4ff61c(_0x45d871[_0xbe36('0x15')]['message']);}})[_0xbe36('0x16')](function(_0x3726d5){logger[_0xbe36('0x11')](_0xbe36('0x14'),_0x5ad297,_0x3726d5);_0xfb5e14(_0x3726d5);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 3a4776f..97b41a6 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 _0xf494=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0xfb2585,_0x344d74){var _0x4937c8=function(_0x45a5be){while(--_0x45a5be){_0xfb2585['push'](_0xfb2585['shift']());}};_0x4937c8(++_0x344d74);}(_0xf494,0x1c6));var _0x4f49=function(_0x53e384,_0x5e5e66){_0x53e384=_0x53e384-0x0;var _0x288c28=_0xf494[_0x53e384];return _0x288c28;};'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 auth=require(_0x4f49('0x5'));var interaction=require(_0x4f49('0x6'));var config=require(_0x4f49('0x7'));var controller=require(_0x4f49('0x8'));router[_0x4f49('0x9')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xb')]);router[_0x4f49('0x9')](_0x4f49('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4f49('0x9')](_0x4f49('0xd'),auth[_0x4f49('0xa')](),controller[_0x4f49('0xe')]);router[_0x4f49('0xf')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0x10')]);router[_0x4f49('0x11')]('/:id',auth[_0x4f49('0xa')](),controller[_0x4f49('0x12')]);router['delete'](_0x4f49('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x4f49('0x13')]=router; \ No newline at end of file +var _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','destroy','exports','multer','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x814b,0x1a2));var _0xb814=function(_0x4e8401,_0x51b328){_0x4e8401=_0x4e8401-0x0;var _0x17269f=_0x814b[_0x4e8401];return _0x17269f;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 58f4ecc..b494787 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 _0x2d9a=['STRING','BLOB','TIMESTAMP','sequelize','exports','VIRTUAL','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d9a,0xf8));var _0xa2d9=function(_0x4c4cbf,_0x1e6e6){_0x4c4cbf=_0x4c4cbf-0x0;var _0xa65774=_0x2d9a[_0x4c4cbf];return _0xa65774;};'use strict';var Sequelize=require(_0xa2d9('0x0'));module[_0xa2d9('0x1')]={'name':{'type':Sequelize[_0xa2d9('0x2')],'get':function(_0x308f9d){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xa2d9('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa2d9('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa2d9('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa2d9('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa2d9('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa2d9('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa2d9('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xa2d9('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xa2d9('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa2d9('0x4')],'defaultValue':''},'stamp':{'type':_0xa2d9('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x0910=['TIMESTAMP','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x5c5f0a,_0x5b76ea){var _0x4676e4=function(_0x59b62c){while(--_0x59b62c){_0x5c5f0a['push'](_0x5c5f0a['shift']());}};_0x4676e4(++_0x5b76ea);}(_0x0910,0x174));var _0x0091=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0910[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0091('0x0')],'get':function(_0x5042f1){return this[_0x0091('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x0091('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x0091('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x0091('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x0091('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x0091('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x0091('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x0091('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x0091('0x4')](_0x0091('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x0091('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x0091('0x3')],'defaultValue':''},'stamp':{'type':_0x0091('0x6'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index e530abc..2246754 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 _0x878f=['request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','then','destroy','error','stack','name','index','map','VoiceMailMessage','fieldName','type','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','rawAttributes','length','include','find','body','catch','update','params','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x511450,_0x4662a1){var _0xd2e574=function(_0x359464){while(--_0x359464){_0x511450['push'](_0x511450['shift']());}};_0xd2e574(++_0x4662a1);}(_0x878f,0x173));var _0xf878=function(_0x539f54,_0x4c1d36){_0x539f54=_0x539f54-0x0;var _0x1d2d20=_0x878f[_0x539f54];return _0x1d2d20;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf878('0x0'));var rimraf=require(_0xf878('0x1'));var zipdir=require(_0xf878('0x2'));var jsonpatch=require(_0xf878('0x3'));var rp=require(_0xf878('0x4'));var moment=require(_0xf878('0x5'));var BPromise=require(_0xf878('0x6'));var Mustache=require(_0xf878('0x7'));var util=require(_0xf878('0x8'));var path=require(_0xf878('0x9'));var sox=require(_0xf878('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf878('0xb'));var squel=require(_0xf878('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf878('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf878('0xe'));var authService=require(_0xf878('0xf'));var qs=require(_0xf878('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf878('0x11'));var logger=require(_0xf878('0x12'))('api');var utils=require(_0xf878('0x13'));var config=require('../../config/environment');var db=require(_0xf878('0x14'))['db'];function respondWithStatusCode(_0x97c396,_0x339c9c){_0x339c9c=_0x339c9c||0xcc;return function(_0x596fb5){if(_0x596fb5){return _0x97c396[_0xf878('0x15')](_0x339c9c);}return _0x97c396[_0xf878('0x16')](_0x339c9c)[_0xf878('0x17')]();};}function respondWithResult(_0x570dcc,_0xe2c2de){_0xe2c2de=_0xe2c2de||0xc8;return function(_0x3902f7){if(_0x3902f7){return _0x570dcc[_0xf878('0x16')](_0xe2c2de)['json'](_0x3902f7);}};}function respondWithFilteredResult(_0x568a3a,_0x4c0948){return function(_0x35ff2d){if(_0x35ff2d){var _0x31d888=_0x35ff2d[_0xf878('0x18')],_0x6dbeca=_0x4c0948[_0xf878('0x19')],_0x44aacc=_0x4c0948[_0xf878('0x19')]+_0x4c0948[_0xf878('0x1a')],_0x186a02;if(_0x44aacc>=_0x31d888){_0x44aacc=_0x31d888;_0x186a02=0xc8;}else{_0x186a02=0xce;}_0x568a3a[_0xf878('0x16')](_0x186a02);return _0x568a3a['set'](_0xf878('0x1b'),_0x6dbeca+'-'+_0x44aacc+'/'+_0x31d888)[_0xf878('0x1c')](_0x35ff2d);}return null;};}function patchUpdates(_0x412de1){return function(_0x622ea8){try{jsonpatch[_0xf878('0x1d')](_0x622ea8,_0x412de1,!![]);}catch(_0x237d15){return BPromise[_0xf878('0x1e')](_0x237d15);}return _0x622ea8['save']();};}function saveUpdates(_0x73f6bf,_0x140866){return function(_0x250f85){if(_0x250f85){return _0x250f85['update'](_0x73f6bf)[_0xf878('0x1f')](function(_0x23590c){return _0x23590c;});}return null;};}function removeEntity(_0xacc440,_0x392822){return function(_0x22d884){if(_0x22d884){return _0x22d884[_0xf878('0x20')]()[_0xf878('0x1f')](function(){_0xacc440[_0xf878('0x16')](0xcc)[_0xf878('0x17')]();});}};}function handleEntityNotFound(_0x1a6506,_0x45e61f){return function(_0x566995){if(!_0x566995){_0x1a6506[_0xf878('0x15')](0x194);}return _0x566995;};}function handleError(_0x5b0b06,_0xa3d3d3){_0xa3d3d3=_0xa3d3d3||0x1f4;return function(_0x12b32f){logger[_0xf878('0x21')](_0x12b32f[_0xf878('0x22')]);if(_0x12b32f[_0xf878('0x23')]){delete _0x12b32f['name'];}_0x5b0b06['status'](_0xa3d3d3)['send'](_0x12b32f);};}exports[_0xf878('0x24')]=function(_0x3baba4,_0x38fa87){var _0x5af87f={},_0xfa3e11={},_0x2e2256={'count':0x0,'rows':[]};var _0x3e848d=_[_0xf878('0x25')](db[_0xf878('0x26')]['rawAttributes'],function(_0x502322){return{'name':_0x502322[_0xf878('0x27')],'type':_0x502322[_0xf878('0x28')]['key']};});_0xfa3e11[_0xf878('0x29')]=_['differenceBy'](_[_0xf878('0x25')](_0x3e848d,'name'),[_0xf878('0x23')]);_0xfa3e11['query']=_[_0xf878('0x2a')](_0x3baba4['query']);_0xfa3e11[_0xf878('0x2b')]=_[_0xf878('0x2c')](_0xfa3e11[_0xf878('0x29')],_0xfa3e11[_0xf878('0x2d')]);_0x5af87f[_0xf878('0x2e')]=_[_0xf878('0x2c')](_0xfa3e11['model'],qs[_0xf878('0x2f')](_0x3baba4[_0xf878('0x2d')][_0xf878('0x2f')]));_0x5af87f[_0xf878('0x2e')]=_0x5af87f[_0xf878('0x2e')]['length']?_0x5af87f[_0xf878('0x2e')]:_0xfa3e11[_0xf878('0x29')];if(!_0x3baba4['query'][_0xf878('0x30')](_0xf878('0x31'))){_0x5af87f[_0xf878('0x1a')]=qs[_0xf878('0x1a')](_0x3baba4[_0xf878('0x2d')]['limit']);_0x5af87f[_0xf878('0x19')]=qs[_0xf878('0x19')](_0x3baba4[_0xf878('0x2d')][_0xf878('0x19')]);}_0x5af87f['order']=qs[_0xf878('0x32')](_0x3baba4['query']['sort']);_0x5af87f[_0xf878('0x33')]=qs[_0xf878('0x2b')](_[_0xf878('0x34')](_0x3baba4[_0xf878('0x2d')],_0xfa3e11[_0xf878('0x2b')]),_0x3e848d);if(_0x3baba4['query'][_0xf878('0x35')]){_0x5af87f['where']=_[_0xf878('0x36')](_0x5af87f[_0xf878('0x33')],{'$or':_['map'](_0x3e848d,function(_0x1489d5){if(_0x1489d5[_0xf878('0x28')]!=='VIRTUAL'){var _0x329f0b={};_0x329f0b[_0x1489d5[_0xf878('0x23')]]={'$like':'%'+_0x3baba4['query'][_0xf878('0x35')]+'%'};return _0x329f0b;}})});}_0x5af87f=_[_0xf878('0x36')]({},_0x5af87f,_0x3baba4[_0xf878('0x37')]);var _0xc8eb91={'where':_0x5af87f[_0xf878('0x33')]};return db[_0xf878('0x26')][_0xf878('0x18')](_0xc8eb91)['then'](function(_0x1179fb){_0x2e2256[_0xf878('0x18')]=_0x1179fb;if(_0x3baba4['query'][_0xf878('0x38')]){_0x5af87f['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0xf878('0x39')](_0x5af87f);})[_0xf878('0x1f')](function(_0x43b03e){_0x2e2256[_0xf878('0x3a')]=_0x43b03e;return _0x2e2256;})[_0xf878('0x1f')](respondWithFilteredResult(_0x38fa87,_0x5af87f))['catch'](handleError(_0x38fa87,null));};exports[_0xf878('0x3b')]=function(_0x4c4ae4,_0xb09736){var _0x2801b0={'raw':!![],'where':{'id':_0x4c4ae4['params']['id']}},_0x4f6be1={};_0x4f6be1[_0xf878('0x29')]=_[_0xf878('0x2a')](db[_0xf878('0x26')][_0xf878('0x3c')]);_0x4f6be1[_0xf878('0x2d')]=_[_0xf878('0x2a')](_0x4c4ae4[_0xf878('0x2d')]);_0x4f6be1[_0xf878('0x2b')]=_[_0xf878('0x2c')](_0x4f6be1['model'],_0x4f6be1[_0xf878('0x2d')]);_0x2801b0[_0xf878('0x2e')]=_[_0xf878('0x2c')](_0x4f6be1[_0xf878('0x29')],qs[_0xf878('0x2f')](_0x4c4ae4[_0xf878('0x2d')]['fields']));_0x2801b0[_0xf878('0x2e')]=_0x2801b0[_0xf878('0x2e')][_0xf878('0x3d')]?_0x2801b0[_0xf878('0x2e')]:_0x4f6be1[_0xf878('0x29')];if(_0x4c4ae4['query'][_0xf878('0x38')]){_0x2801b0[_0xf878('0x3e')]=[{'all':!![]}];}_0x2801b0=_[_0xf878('0x36')]({},_0x2801b0,_0x4c4ae4[_0xf878('0x37')]);return db['VoiceMailMessage'][_0xf878('0x3f')](_0x2801b0)[_0xf878('0x1f')](handleEntityNotFound(_0xb09736,null))[_0xf878('0x1f')](respondWithResult(_0xb09736,null))['catch'](handleError(_0xb09736,null));};exports['create']=function(_0x9c2fa3,_0x5bf396){return db['VoiceMailMessage']['create'](_0x9c2fa3[_0xf878('0x40')],{})['then'](respondWithResult(_0x5bf396,0xc9))[_0xf878('0x41')](handleError(_0x5bf396,null));};exports[_0xf878('0x42')]=function(_0x1dcb19,_0x1ff60b){if(_0x1dcb19[_0xf878('0x40')]['id']){delete _0x1dcb19[_0xf878('0x40')]['id'];}return db[_0xf878('0x26')]['find']({'where':{'id':_0x1dcb19[_0xf878('0x43')]['id']}})[_0xf878('0x1f')](handleEntityNotFound(_0x1ff60b,null))[_0xf878('0x1f')](saveUpdates(_0x1dcb19[_0xf878('0x40')],null))[_0xf878('0x1f')](respondWithResult(_0x1ff60b,null))['catch'](handleError(_0x1ff60b,null));};exports['destroy']=function(_0xb4f8fb,_0x18c9dc){return db['VoiceMailMessage'][_0xf878('0x3f')]({'where':{'id':_0xb4f8fb['params']['id']}})[_0xf878('0x1f')](handleEntityNotFound(_0x18c9dc,null))[_0xf878('0x1f')](removeEntity(_0x18c9dc,null))[_0xf878('0x41')](handleError(_0x18c9dc,null));};exports[_0xf878('0x44')]=function(_0x5411c2,_0xf0d960,_0xd8fbc9){return db[_0xf878('0x26')]['find']({'where':{'id':_0x5411c2[_0xf878('0x43')]['id']},'attributes':['id',_0xf878('0x45'),_0xf878('0x46')]})[_0xf878('0x1f')](handleEntityNotFound(_0xf0d960,null))['then'](function(_0x112f2a){if(_0x112f2a){if(!_0x112f2a[_0xf878('0x45')]){throw new db[(_0xf878('0x47'))]['ValidationError'](_0xf878('0x48'));}var _0xdfa29b={'Content-Type':_0xf878('0x49'),'Content-Disposition':_0xf878('0x4a')};if(_0x112f2a['msg_id']){_0xdfa29b['Content-Disposition']='attachment;\x20filename=\x22'+_0x112f2a[_0xf878('0x46')]+'.wav\x22';}_0xf0d960['set'](_0xdfa29b);return _0xf0d960['send'](new Buffer(_0x112f2a[_0xf878('0x45')]));}})[_0xf878('0x41')](handleError(_0xf0d960,null));}; \ No newline at end of file +var _0x693f=['mustache','util','path','sox','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','find','create','body','params','download','msg_id','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x124c75,_0x332013){var _0x5c5471=function(_0x2fd3eb){while(--_0x2fd3eb){_0x124c75['push'](_0x124c75['shift']());}};_0x5c5471(++_0x332013);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xf693('0x0'));var emlformat=require(_0xf693('0x1'));var rimraf=require(_0xf693('0x2'));var zipdir=require(_0xf693('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf693('0x4'));var moment=require(_0xf693('0x5'));var BPromise=require(_0xf693('0x6'));var Mustache=require(_0xf693('0x7'));var util=require(_0xf693('0x8'));var path=require(_0xf693('0x9'));var sox=require(_0xf693('0xa'));var csv=require('to-csv');var ejs=require(_0xf693('0xb'));var fs=require('fs');var _=require(_0xf693('0xc'));var squel=require('squel');var crypto=require(_0xf693('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf693('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf693('0xf'));var Papa=require(_0xf693('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf693('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf693('0x12'))(_0xf693('0x13'));var utils=require(_0xf693('0x14'));var config=require(_0xf693('0x15'));var db=require(_0xf693('0x16'))['db'];function respondWithStatusCode(_0x5a5a35,_0x5d0d4c){_0x5d0d4c=_0x5d0d4c||0xcc;return function(_0xd08be1){if(_0xd08be1){return _0x5a5a35[_0xf693('0x17')](_0x5d0d4c);}return _0x5a5a35['status'](_0x5d0d4c)[_0xf693('0x18')]();};}function respondWithResult(_0x1bfd8d,_0x5a5f86){_0x5a5f86=_0x5a5f86||0xc8;return function(_0x5c42f0){if(_0x5c42f0){return _0x1bfd8d[_0xf693('0x19')](_0x5a5f86)[_0xf693('0x1a')](_0x5c42f0);}};}function respondWithFilteredResult(_0xbd92c6,_0x208f32){return function(_0x36d92c){if(_0x36d92c){var _0x5541a7=_0x36d92c[_0xf693('0x1b')],_0x1d9278=_0x208f32[_0xf693('0x1c')],_0x1c0dfc=_0x208f32[_0xf693('0x1c')]+_0x208f32['limit'],_0x3c8084;if(_0x1c0dfc>=_0x5541a7){_0x1c0dfc=_0x5541a7;_0x3c8084=0xc8;}else{_0x3c8084=0xce;}_0xbd92c6['status'](_0x3c8084);return _0xbd92c6['set'](_0xf693('0x1d'),_0x1d9278+'-'+_0x1c0dfc+'/'+_0x5541a7)[_0xf693('0x1a')](_0x36d92c);}return null;};}function patchUpdates(_0x3f4d4d){return function(_0x4543a1){try{jsonpatch[_0xf693('0x1e')](_0x4543a1,_0x3f4d4d,!![]);}catch(_0x58f0f0){return BPromise[_0xf693('0x1f')](_0x58f0f0);}return _0x4543a1[_0xf693('0x20')]();};}function saveUpdates(_0x5f89c8,_0x31b887){return function(_0x1d20fc){if(_0x1d20fc){return _0x1d20fc[_0xf693('0x21')](_0x5f89c8)[_0xf693('0x22')](function(_0x38f209){return _0x38f209;});}return null;};}function removeEntity(_0x50b20e,_0x505ada){return function(_0x1188c6){if(_0x1188c6){return _0x1188c6[_0xf693('0x23')]()[_0xf693('0x22')](function(){_0x50b20e[_0xf693('0x19')](0xcc)[_0xf693('0x18')]();});}};}function handleEntityNotFound(_0x200c95,_0x5407f5){return function(_0x179e25){if(!_0x179e25){_0x200c95[_0xf693('0x17')](0x194);}return _0x179e25;};}function handleError(_0xc5c088,_0x414a3f){_0x414a3f=_0x414a3f||0x1f4;return function(_0x4840e2){logger[_0xf693('0x24')](_0x4840e2[_0xf693('0x25')]);if(_0x4840e2[_0xf693('0x26')]){delete _0x4840e2[_0xf693('0x26')];}_0xc5c088[_0xf693('0x19')](_0x414a3f)[_0xf693('0x27')](_0x4840e2);};}exports[_0xf693('0x28')]=function(_0x423cda,_0x3b3bfc){var _0x1b5f98={},_0x4ca818={},_0x79c2b9={'count':0x0,'rows':[]};var _0xaccce0=_[_0xf693('0x29')](db[_0xf693('0x2a')][_0xf693('0x2b')],function(_0x7fdc22){return{'name':_0x7fdc22[_0xf693('0x2c')],'type':_0x7fdc22[_0xf693('0x2d')]['key']};});_0x4ca818[_0xf693('0x2e')]=_[_0xf693('0x2f')](_[_0xf693('0x29')](_0xaccce0,_0xf693('0x26')),['name']);_0x4ca818['query']=_[_0xf693('0x30')](_0x423cda[_0xf693('0x31')]);_0x4ca818['filters']=_[_0xf693('0x32')](_0x4ca818[_0xf693('0x2e')],_0x4ca818[_0xf693('0x31')]);_0x1b5f98[_0xf693('0x33')]=_['intersection'](_0x4ca818[_0xf693('0x2e')],qs[_0xf693('0x34')](_0x423cda[_0xf693('0x31')][_0xf693('0x34')]));_0x1b5f98[_0xf693('0x33')]=_0x1b5f98[_0xf693('0x33')][_0xf693('0x35')]?_0x1b5f98[_0xf693('0x33')]:_0x4ca818['model'];if(!_0x423cda[_0xf693('0x31')][_0xf693('0x36')](_0xf693('0x37'))){_0x1b5f98[_0xf693('0x38')]=qs[_0xf693('0x38')](_0x423cda[_0xf693('0x31')]['limit']);_0x1b5f98['offset']=qs[_0xf693('0x1c')](_0x423cda[_0xf693('0x31')][_0xf693('0x1c')]);}_0x1b5f98['order']=qs[_0xf693('0x39')](_0x423cda[_0xf693('0x31')][_0xf693('0x39')]);_0x1b5f98[_0xf693('0x3a')]=qs[_0xf693('0x3b')](_['pick'](_0x423cda[_0xf693('0x31')],_0x4ca818[_0xf693('0x3b')]),_0xaccce0);if(_0x423cda[_0xf693('0x31')]['filter']){_0x1b5f98[_0xf693('0x3a')]=_['merge'](_0x1b5f98[_0xf693('0x3a')],{'$or':_[_0xf693('0x29')](_0xaccce0,function(_0x1ec098){if(_0x1ec098[_0xf693('0x2d')]!==_0xf693('0x3c')){var _0x5a5580={};_0x5a5580[_0x1ec098[_0xf693('0x26')]]={'$like':'%'+_0x423cda[_0xf693('0x31')][_0xf693('0x3d')]+'%'};return _0x5a5580;}})});}_0x1b5f98=_[_0xf693('0x3e')]({},_0x1b5f98,_0x423cda[_0xf693('0x3f')]);var _0x24c5d4={'where':_0x1b5f98[_0xf693('0x3a')]};return db[_0xf693('0x2a')][_0xf693('0x1b')](_0x24c5d4)['then'](function(_0x244b29){_0x79c2b9['count']=_0x244b29;if(_0x423cda['query'][_0xf693('0x40')]){_0x1b5f98[_0xf693('0x41')]=[{'all':!![]}];}return db[_0xf693('0x2a')]['findAll'](_0x1b5f98);})[_0xf693('0x22')](function(_0x51ef9a){_0x79c2b9[_0xf693('0x42')]=_0x51ef9a;return _0x79c2b9;})['then'](respondWithFilteredResult(_0x3b3bfc,_0x1b5f98))[_0xf693('0x43')](handleError(_0x3b3bfc,null));};exports[_0xf693('0x44')]=function(_0x3391e7,_0xb597a8){var _0x307bdf={'raw':!![],'where':{'id':_0x3391e7['params']['id']}},_0x47bc1b={};_0x47bc1b['model']=_['keys'](db[_0xf693('0x2a')][_0xf693('0x2b')]);_0x47bc1b['query']=_['keys'](_0x3391e7['query']);_0x47bc1b[_0xf693('0x3b')]=_[_0xf693('0x32')](_0x47bc1b[_0xf693('0x2e')],_0x47bc1b[_0xf693('0x31')]);_0x307bdf['attributes']=_[_0xf693('0x32')](_0x47bc1b[_0xf693('0x2e')],qs[_0xf693('0x34')](_0x3391e7['query'][_0xf693('0x34')]));_0x307bdf[_0xf693('0x33')]=_0x307bdf['attributes'][_0xf693('0x35')]?_0x307bdf[_0xf693('0x33')]:_0x47bc1b['model'];if(_0x3391e7[_0xf693('0x31')][_0xf693('0x40')]){_0x307bdf['include']=[{'all':!![]}];}_0x307bdf=_[_0xf693('0x3e')]({},_0x307bdf,_0x3391e7[_0xf693('0x3f')]);return db[_0xf693('0x2a')][_0xf693('0x45')](_0x307bdf)['then'](handleEntityNotFound(_0xb597a8,null))[_0xf693('0x22')](respondWithResult(_0xb597a8,null))[_0xf693('0x43')](handleError(_0xb597a8,null));};exports[_0xf693('0x46')]=function(_0x1a1efa,_0x2ceb64){return db[_0xf693('0x2a')]['create'](_0x1a1efa[_0xf693('0x47')],{})[_0xf693('0x22')](respondWithResult(_0x2ceb64,0xc9))[_0xf693('0x43')](handleError(_0x2ceb64,null));};exports[_0xf693('0x21')]=function(_0x16dd1b,_0x4f0e31){if(_0x16dd1b[_0xf693('0x47')]['id']){delete _0x16dd1b[_0xf693('0x47')]['id'];}return db['VoiceMailMessage'][_0xf693('0x45')]({'where':{'id':_0x16dd1b['params']['id']}})['then'](handleEntityNotFound(_0x4f0e31,null))['then'](saveUpdates(_0x16dd1b[_0xf693('0x47')],null))[_0xf693('0x22')](respondWithResult(_0x4f0e31,null))[_0xf693('0x43')](handleError(_0x4f0e31,null));};exports[_0xf693('0x23')]=function(_0x4c5beb,_0x4f01ae){return db[_0xf693('0x2a')]['find']({'where':{'id':_0x4c5beb[_0xf693('0x48')]['id']}})[_0xf693('0x22')](handleEntityNotFound(_0x4f01ae,null))[_0xf693('0x22')](removeEntity(_0x4f01ae,null))['catch'](handleError(_0x4f01ae,null));};exports[_0xf693('0x49')]=function(_0x3e9bf4,_0x43cf4f,_0x393555){return db[_0xf693('0x2a')][_0xf693('0x45')]({'where':{'id':_0x3e9bf4['params']['id']},'attributes':['id','recording',_0xf693('0x4a')]})['then'](handleEntityNotFound(_0x43cf4f,null))['then'](function(_0x3bd401){if(_0x3bd401){if(!_0x3bd401[_0xf693('0x4b')]){throw new db['Sequelize'][(_0xf693('0x4c'))](_0xf693('0x4d'));}var _0x2e08d2={'Content-Type':_0xf693('0x4e'),'Content-Disposition':'attachment'};if(_0x3bd401['msg_id']){_0x2e08d2[_0xf693('0x4f')]=_0xf693('0x50')+_0x3bd401[_0xf693('0x4a')]+_0xf693('0x51');}_0x43cf4f['set'](_0x2e08d2);return _0x43cf4f[_0xf693('0x27')](new Buffer(_0x3bd401[_0xf693('0x4b')]));}})['catch'](handleError(_0x43cf4f,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index da696af..983338f 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 _0x3d3d=['VoiceMailMessage','dir','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x3d3d,0x1c9));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd3d3('0x0'));var util=require(_0xd3d3('0x1'));var logger=require(_0xd3d3('0x2'))('api');var moment=require(_0xd3d3('0x3'));var BPromise=require(_0xd3d3('0x4'));var rp=require(_0xd3d3('0x5'));var fs=require('fs');var path=require(_0xd3d3('0x6'));var rimraf=require(_0xd3d3('0x7'));var config=require(_0xd3d3('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0xd3d3('0x9')]=function(_0x40444c,_0x37b9c7){return _0x40444c[_0xd3d3('0xa')](_0xd3d3('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xd3d3('0xc'),'fields':[_0xd3d3('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x68e7=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68e7,0x1bf));var _0x768e=function(_0x287d23,_0xfdad66){_0x287d23=_0x287d23-0x0;var _0xf1faf8=_0x68e7[_0x287d23];return _0xf1faf8;};'use strict';var _=require(_0x768e('0x0'));var util=require(_0x768e('0x1'));var logger=require(_0x768e('0x2'))(_0x768e('0x3'));var moment=require(_0x768e('0x4'));var BPromise=require(_0x768e('0x5'));var rp=require(_0x768e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x768e('0x7'));var config=require(_0x768e('0x8'));var attributes=require(_0x768e('0x9'));module[_0x768e('0xa')]=function(_0x12aa53,_0xcf7fec){return _0x12aa53[_0x768e('0xb')](_0x768e('0xc'),attributes,{'tableName':_0x768e('0xd'),'paranoid':![],'indexes':[{'name':_0x768e('0xe'),'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 ef51837..4650e26 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 _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceMailMessage,\x20%s,\x20%s','message','catch','lodash'];(function(_0x2f106b,_0x3917e3){var _0x2ce1a9=function(_0x3ad64e){while(--_0x3ad64e){_0x2f106b['push'](_0x2f106b['shift']());}};_0x2ce1a9(++_0x3917e3);}(_0x66fa,0x117));var _0xa66f=function(_0x48c848,_0x325d2e){_0x48c848=_0x48c848-0x0;var _0x1f50d8=_0x66fa[_0x48c848];return _0x1f50d8;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3cfc6c,_0x5d1fcb){var _0x3e5066=function(_0x4436aa){while(--_0x4436aa){_0x3cfc6c['push'](_0x3cfc6c['shift']());}};_0x3e5066(++_0x5d1fcb);}(_0xadb5,0xad));var _0x5adb=function(_0x4a37e0,_0xdf33af){_0x4a37e0=_0x4a37e0-0x0;var _0x4980a7=_0xadb5[_0x4a37e0];return _0x4980a7;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 1af1f22..b2387f5 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 _0x9cc1=['post','create','put','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds'];(function(_0x2bcb7c,_0x401e10){var _0x5d96b3=function(_0x3888f4){while(--_0x3888f4){_0x2bcb7c['push'](_0x2bcb7c['shift']());}};_0x5d96b3(++_0x401e10);}(_0x9cc1,0x134));var _0x19cc=function(_0x143cc6,_0xf94536){_0x143cc6=_0x143cc6-0x0;var _0x2cedba=_0x9cc1[_0x143cc6];return _0x2cedba;};'use strict';var multer=require(_0x19cc('0x0'));var util=require(_0x19cc('0x1'));var path=require(_0x19cc('0x2'));var timeout=require(_0x19cc('0x3'));var express=require(_0x19cc('0x4'));var router=express[_0x19cc('0x5')]();var auth=require(_0x19cc('0x6'));var interaction=require(_0x19cc('0x7'));var config=require(_0x19cc('0x8'));var controller=require(_0x19cc('0x9'));router[_0x19cc('0xa')]('/',auth[_0x19cc('0xb')](),controller[_0x19cc('0xc')]);router[_0x19cc('0xa')](_0x19cc('0xd'),auth[_0x19cc('0xb')](),controller[_0x19cc('0xe')]);router['get'](_0x19cc('0xf'),auth['isAuthenticated'](),controller[_0x19cc('0x10')]);router[_0x19cc('0x11')]('/',auth[_0x19cc('0xb')](),controller[_0x19cc('0x12')]);router[_0x19cc('0x11')](_0x19cc('0xf'),auth['isAuthenticated'](),controller['addSound']);router[_0x19cc('0x13')](_0x19cc('0xd'),auth[_0x19cc('0xb')](),controller['update']);router[_0x19cc('0x14')](_0x19cc('0xd'),auth[_0x19cc('0xb')](),controller[_0x19cc('0x15')]);router[_0x19cc('0x14')](_0x19cc('0x16'),auth[_0x19cc('0xb')](),controller[_0x19cc('0x17')]);module[_0x19cc('0x18')]=router; \ No newline at end of file +var _0xd871=['../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','post','create','addSound','put','delete','destroy','removeSound','multer','util','path','express','Router','../../components/interaction/service'];(function(_0xc66d64,_0x5c1dcc){var _0xa4a1ad=function(_0x48920b){while(--_0x48920b){_0xc66d64['push'](_0xc66d64['shift']());}};_0xa4a1ad(++_0x5c1dcc);}(_0xd871,0x19e));var _0x1d87=function(_0x25aec6,_0x216980){_0x25aec6=_0x25aec6-0x0;var _0x14d7ed=_0xd871[_0x25aec6];return _0x14d7ed;};'use strict';var multer=require(_0x1d87('0x0'));var util=require(_0x1d87('0x1'));var path=require(_0x1d87('0x2'));var timeout=require('connect-timeout');var express=require(_0x1d87('0x3'));var router=express[_0x1d87('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1d87('0x5'));var config=require(_0x1d87('0x6'));var controller=require(_0x1d87('0x7'));router[_0x1d87('0x8')]('/',auth[_0x1d87('0x9')](),controller[_0x1d87('0xa')]);router[_0x1d87('0x8')](_0x1d87('0xb'),auth[_0x1d87('0x9')](),controller[_0x1d87('0xc')]);router[_0x1d87('0x8')](_0x1d87('0xd'),auth[_0x1d87('0x9')](),controller['getSounds']);router[_0x1d87('0xe')]('/',auth['isAuthenticated'](),controller[_0x1d87('0xf')]);router['post'](_0x1d87('0xd'),auth['isAuthenticated'](),controller[_0x1d87('0x10')]);router[_0x1d87('0x11')](_0x1d87('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1d87('0x12')](_0x1d87('0xb'),auth['isAuthenticated'](),controller[_0x1d87('0x13')]);router[_0x1d87('0x12')]('/:id/sounds/:id2',auth[_0x1d87('0x9')](),controller[_0x1d87('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 57d3068..1f5f8a2 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 _0x5e8f=['custom','files','quietmp3nb','quietmp3','STRING','alpha','TIMESTAMP','sequelize','name','ENUM'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x5e8f,0x1b5));var _0xf5e8=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5e8f[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0xf5e8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf5e8('0x1')},'mode':{'type':Sequelize[_0xf5e8('0x2')](_0xf5e8('0x3'),_0xf5e8('0x4'),'mp3nb',_0xf5e8('0x5'),_0xf5e8('0x6'),'mp3'),'allowNull':!![],'defaultValue':_0xf5e8('0x4')},'directory':{'type':Sequelize[_0xf5e8('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0xf5e8('0x7')],'allowNull':!![]},'digit':{'type':Sequelize[_0xf5e8('0x7')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf5e8('0x8')},'format':{'type':Sequelize[_0xf5e8('0x7')],'allowNull':!![]},'stamp':{'type':_0xf5e8('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x048f=['STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','name','custom','files','quietmp3nb','mp3'];(function(_0x387dc1,_0x3ba649){var _0x17567c=function(_0x4690aa){while(--_0x4690aa){_0x387dc1['push'](_0x387dc1['shift']());}};_0x17567c(++_0x3ba649);}(_0x048f,0x1c7));var _0xf048=function(_0x32f20f,_0x291b06){_0x32f20f=_0x32f20f-0x0;var _0xf273d=_0x048f[_0x32f20f];return _0xf273d;};'use strict';var Sequelize=require(_0xf048('0x0'));module[_0xf048('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf048('0x2')},'mode':{'type':Sequelize['ENUM'](_0xf048('0x3'),_0xf048('0x4'),'mp3nb',_0xf048('0x5'),'quietmp3',_0xf048('0x6')),'allowNull':!![],'defaultValue':_0xf048('0x4')},'directory':{'type':Sequelize[_0xf048('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0xf048('0x7')],'allowNull':!![]},'digit':{'type':Sequelize[_0xf048('0x7')],'allowNull':!![]},'sort':{'type':Sequelize[_0xf048('0x7')],'allowNull':!![],'defaultValue':_0xf048('0x8')},'format':{'type':Sequelize[_0xf048('0x7')],'allowNull':!![]},'stamp':{'type':_0xf048('0x9')},'defaultEntry':{'type':Sequelize[_0xf048('0xa')],'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 e148be4..d39d6d3 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 _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x519c4d,_0xee2386){var _0x3931c9=function(_0x17d44b){while(--_0x17d44b){_0x519c4d['push'](_0x519c4d['shift']());}};_0x3931c9(++_0xee2386);}(_0xb10b,0x12a));var _0xbb10=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0xb10b[_0x16e57d];return _0x40239c;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file +var _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x27671d,_0x3df70e){var _0x4dd831=function(_0x238462){while(--_0x238462){_0x27671d['push'](_0x27671d['shift']());}};_0x4dd831(++_0x3df70e);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c5ca4,_0x1f6dd4){_0x3c5ca4=_0x3c5ca4-0x0;var _0x151a6b=_0xb10b[_0x3c5ca4];return _0x151a6b;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 34e59b7..a3a4b2b 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 _0x669a=['rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3894b3,_0x45c95e){var _0x140b18=function(_0x415ea3){while(--_0x415ea3){_0x3894b3['push'](_0x3894b3['shift']());}};_0x140b18(++_0x45c95e);}(_0x669a,0xa2));var _0xa669=function(_0x17398a,_0x28c0d0){_0x17398a=_0x17398a-0x0;var _0x32bff5=_0x669a[_0x17398a];return _0x32bff5;};'use strict';var _=require('lodash');var util=require(_0xa669('0x0'));var logger=require(_0xa669('0x1'))(_0xa669('0x2'));var moment=require(_0xa669('0x3'));var BPromise=require(_0xa669('0x4'));var rp=require(_0xa669('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa669('0x6'));var config=require(_0xa669('0x7'));var attributes=require(_0xa669('0x8'));module[_0xa669('0x9')]=function(_0x35f9ed,_0x33d914){return _0x35f9ed['define'](_0xa669('0xa'),attributes,{'tableName':_0xa669('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeeff=['../../config/environment','define','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xeeff,0x172));var _0xfeef=function(_0x7483e,_0x5ac055){_0x7483e=_0x7483e-0x0;var _0x2c9fda=_0xeeff[_0x7483e];return _0x2c9fda;};'use strict';var _=require(_0xfeef('0x0'));var util=require('util');var logger=require(_0xfeef('0x1'))(_0xfeef('0x2'));var moment=require(_0xfeef('0x3'));var BPromise=require('bluebird');var rp=require(_0xfeef('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfeef('0x5'));var config=require(_0xfeef('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x3fe89c,_0x38e4a9){return _0x3fe89c[_0xfeef('0x7')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 04b274d..6b03583 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 _0x619a=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x27ad89,_0xc4374a){var _0x490853=function(_0x3b7104){while(--_0x3b7104){_0x27ad89['push'](_0x27ad89['shift']());}};_0x490853(++_0xc4374a);}(_0x619a,0x182));var _0xa619=function(_0x531f4f,_0x103e4f){_0x531f4f=_0x531f4f-0x0;var _0x255b3a=_0x619a[_0x531f4f];return _0x255b3a;};'use strict';var _=require(_0xa619('0x0'));var util=require('util');var moment=require(_0xa619('0x1'));var BPromise=require(_0xa619('0x2'));var rs=require(_0xa619('0x3'));var fs=require('fs');var Redis=require(_0xa619('0x4'));var db=require(_0xa619('0x5'))['db'];var utils=require(_0xa619('0x6'));var logger=require('../../config/logger')(_0xa619('0x7'));var config=require(_0xa619('0x8'));var jayson=require(_0xa619('0x9'));var client=jayson[_0xa619('0xa')][_0xa619('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48ea76,_0x56f5ca,_0x52b5dd){return new BPromise(function(_0x583c64,_0x3227f4){return client['request'](_0x48ea76,_0x52b5dd)[_0xa619('0xc')](function(_0x1f96d2){logger[_0xa619('0xd')](_0xa619('0xe'),_0x56f5ca,_0xa619('0xf'));logger[_0xa619('0x10')](_0xa619('0x11'),_0x56f5ca,_0xa619('0xf'),JSON[_0xa619('0x12')](_0x1f96d2));if(_0x1f96d2[_0xa619('0x13')]){if(_0x1f96d2['error'][_0xa619('0x14')]===0x1f4){logger['error'](_0xa619('0xe'),_0x56f5ca,_0x1f96d2[_0xa619('0x13')][_0xa619('0x15')]);return _0x3227f4(_0x1f96d2[_0xa619('0x13')]['message']);}logger[_0xa619('0x13')](_0xa619('0xe'),_0x56f5ca,_0x1f96d2[_0xa619('0x13')][_0xa619('0x15')]);return _0x583c64(_0x1f96d2['error']['message']);}else{logger[_0xa619('0xd')](_0xa619('0xe'),_0x56f5ca,_0xa619('0xf'));_0x583c64(_0x1f96d2['result'][_0xa619('0x15')]);}})[_0xa619('0x16')](function(_0x2ad13d){logger[_0xa619('0x13')](_0xa619('0xe'),_0x56f5ca,_0x2ad13d);_0x3227f4(_0x2ad13d);});});} \ No newline at end of file +var _0x8228=['client','http','request','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2d64c5,_0x12c78c){var _0x16b2b3=function(_0x5ed6f7){while(--_0x5ed6f7){_0x2d64c5['push'](_0x2d64c5['shift']());}};_0x16b2b3(++_0x12c78c);}(_0x8228,0x113));var _0x8822=function(_0x28dfbe,_0x39d2e7){_0x28dfbe=_0x28dfbe-0x0;var _0xd80808=_0x8228[_0x28dfbe];return _0xd80808;};'use strict';var _=require(_0x8822('0x0'));var util=require(_0x8822('0x1'));var moment=require(_0x8822('0x2'));var BPromise=require(_0x8822('0x3'));var rs=require(_0x8822('0x4'));var fs=require('fs');var Redis=require(_0x8822('0x5'));var db=require(_0x8822('0x6'))['db'];var utils=require(_0x8822('0x7'));var logger=require(_0x8822('0x8'))('rpc');var config=require(_0x8822('0x9'));var jayson=require(_0x8822('0xa'));var client=jayson[_0x8822('0xb')][_0x8822('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b352d,_0x42e065,_0x5ea5f6){return new BPromise(function(_0x3a21c1,_0x470e47){return client[_0x8822('0xd')](_0x4b352d,_0x5ea5f6)['then'](function(_0x20e55a){logger['info'](_0x8822('0xe'),_0x42e065,_0x8822('0xf'));logger['debug'](_0x8822('0x10'),_0x42e065,'request\x20sent',JSON[_0x8822('0x11')](_0x20e55a));if(_0x20e55a['error']){if(_0x20e55a['error']['code']===0x1f4){logger['error'](_0x8822('0xe'),_0x42e065,_0x20e55a[_0x8822('0x12')][_0x8822('0x13')]);return _0x470e47(_0x20e55a['error'][_0x8822('0x13')]);}logger['error'](_0x8822('0xe'),_0x42e065,_0x20e55a[_0x8822('0x12')]['message']);return _0x3a21c1(_0x20e55a[_0x8822('0x12')][_0x8822('0x13')]);}else{logger[_0x8822('0x14')](_0x8822('0xe'),_0x42e065,'request\x20sent');_0x3a21c1(_0x20e55a['result'][_0x8822('0x13')]);}})[_0x8822('0x15')](function(_0x2a766a){logger[_0x8822('0x12')](_0x8822('0xe'),_0x42e065,_0x2a766a);_0x470e47(_0x2a766a);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 8ce8ad9..fb94846 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 _0x62ba=['index','describe','/:id','getAgents','create','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','path','Router','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x62ba,0x71));var _0xa62b=function(_0x5a8687,_0x33b1f1){_0x5a8687=_0x5a8687-0x0;var _0xc7703d=_0x62ba[_0x5a8687];return _0xc7703d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa62b('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa62b('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xa62b('0x2'));var config=require(_0xa62b('0x3'));var controller=require(_0xa62b('0x4'));router[_0xa62b('0x5')]('/',auth[_0xa62b('0x6')](),controller[_0xa62b('0x7')]);router['get']('/describe',auth[_0xa62b('0x6')](),controller[_0xa62b('0x8')]);router[_0xa62b('0x5')](_0xa62b('0x9'),auth[_0xa62b('0x6')](),controller['show']);router[_0xa62b('0x5')]('/:id/users',auth[_0xa62b('0x6')](),controller[_0xa62b('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa62b('0xb')]);router['post'](_0xa62b('0xc'),auth['isAuthenticated'](),controller[_0xa62b('0xd')]);router[_0xa62b('0xe')](_0xa62b('0x9'),auth[_0xa62b('0x6')](),controller[_0xa62b('0xf')]);router[_0xa62b('0x10')](_0xa62b('0x9'),auth[_0xa62b('0x6')](),controller[_0xa62b('0x11')]);router[_0xa62b('0x10')](_0xa62b('0xc'),auth[_0xa62b('0x6')](),controller[_0xa62b('0x12')]);module[_0xa62b('0x13')]=router; \ No newline at end of file +var _0x0e7c=['removeAgents','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','show','/:id/users','getAgents','post','put','/:id','update','delete','destroy'];(function(_0x438b91,_0x55c6d8){var _0x8a0d3b=function(_0x4fee67){while(--_0x4fee67){_0x438b91['push'](_0x438b91['shift']());}};_0x8a0d3b(++_0x55c6d8);}(_0x0e7c,0xa1));var _0xc0e7=function(_0xf74372,_0x51fe82){_0xf74372=_0xf74372-0x0;var _0x36bb65=_0x0e7c[_0xf74372];return _0x36bb65;};'use strict';var multer=require(_0xc0e7('0x0'));var util=require(_0xc0e7('0x1'));var path=require(_0xc0e7('0x2'));var timeout=require(_0xc0e7('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xc0e7('0x4'));var interaction=require(_0xc0e7('0x5'));var config=require(_0xc0e7('0x6'));var controller=require(_0xc0e7('0x7'));router[_0xc0e7('0x8')]('/',auth[_0xc0e7('0x9')](),controller['index']);router[_0xc0e7('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc0e7('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc0e7('0xa')]);router[_0xc0e7('0x8')](_0xc0e7('0xb'),auth[_0xc0e7('0x9')](),controller[_0xc0e7('0xc')]);router[_0xc0e7('0xd')]('/',auth[_0xc0e7('0x9')](),controller['create']);router[_0xc0e7('0xd')](_0xc0e7('0xb'),auth[_0xc0e7('0x9')](),controller['addAgents']);router[_0xc0e7('0xe')](_0xc0e7('0xf'),auth[_0xc0e7('0x9')](),controller[_0xc0e7('0x10')]);router[_0xc0e7('0x11')](_0xc0e7('0xf'),auth[_0xc0e7('0x9')](),controller[_0xc0e7('0x12')]);router[_0xc0e7('0x11')]('/:id/users',auth[_0xc0e7('0x9')](),controller[_0xc0e7('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index dbd75ef..863b732 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 _0x484a=['STRING','INTEGER','sequelize','exports','name','system-','getDataValue'];(function(_0x19e3c9,_0x2fb0c3){var _0x377fc9=function(_0x5bd928){while(--_0x5bd928){_0x19e3c9['push'](_0x19e3c9['shift']());}};_0x377fc9(++_0x2fb0c3);}(_0x484a,0x191));var _0xa484=function(_0xe53774,_0x80ecef){_0xe53774=_0xe53774-0x0;var _0x318b1a=_0x484a[_0xe53774];return _0x318b1a;};'use strict';var Sequelize=require(_0xa484('0x0'));module[_0xa484('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa484('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x2a4447){return _0xa484('0x3')+this[_0xa484('0x4')](_0xa484('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xa484('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0xa484('0x6')]}}; \ No newline at end of file +var _0x69d5=['getDataValue','INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x2fde3f,_0x6eaa1f){var _0x5e6775=function(_0x48901e){while(--_0x48901e){_0x2fde3f['push'](_0x2fde3f['shift']());}};_0x5e6775(++_0x6eaa1f);}(_0x69d5,0x15a));var _0x569d=function(_0x301b12,_0x4aae1b){_0x301b12=_0x301b12-0x0;var _0x9d6041=_0x69d5[_0x301b12];return _0x9d6041;};'use strict';var Sequelize=require(_0x569d('0x0'));module[_0x569d('0x1')]={'name':{'type':Sequelize[_0x569d('0x2')],'allowNull':![],'unique':_0x569d('0x3')},'prefix':{'type':Sequelize[_0x569d('0x4')],'get':function(_0x1b0d94){return _0x569d('0x5')+this[_0x569d('0x6')](_0x569d('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x569d('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x569d('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 6ccdb9f..347edfb 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 _0x855e=['filter','options','includeAll','include','findAll','rows','catch','show','find','describe','transaction','create','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','priority','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','CDR(prefix)=','push','callerIdAll','NoOp','No\x20callerid\x20available','goto','${EXTEN:','length','charAt','update','system-','sequelize','findById','addAgents','params','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','keys','order','sort','nolimit','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','status','end','json','count','offset','limit','Content-Range','reject','save','then','destroy','get','UserProfileResource','sendStatus','name','send','index','map','VoicePrefix','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','where','filters','pick','merge','type','VIRTUAL'];(function(_0x14f6fa,_0x44743d){var _0x2c62a5=function(_0x398da0){while(--_0x398da0){_0x14f6fa['push'](_0x14f6fa['shift']());}};_0x2c62a5(++_0x44743d);}(_0x855e,0x13b));var _0xe855=function(_0x2432de,_0x5a24eb){_0x2432de=_0x2432de-0x0;var _0x2422c9=_0x855e[_0x2432de];return _0x2422c9;};'use strict';var pdf=require(_0xe855('0x0'));var emlformat=require(_0xe855('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe855('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe855('0x3'));var moment=require(_0xe855('0x4'));var BPromise=require(_0xe855('0x5'));var Mustache=require(_0xe855('0x6'));var util=require(_0xe855('0x7'));var path=require(_0xe855('0x8'));var sox=require(_0xe855('0x9'));var csv=require(_0xe855('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe855('0xb'));var squel=require('squel');var crypto=require(_0xe855('0xc'));var jsforce=require(_0xe855('0xd'));var deskjs=require(_0xe855('0xe'));var toCsv=require(_0xe855('0xa'));var querystring=require(_0xe855('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe855('0x10'));var qs=require(_0xe855('0x11'));var as=require(_0xe855('0x12'));var hardwareService=require(_0xe855('0x13'));var logger=require(_0xe855('0x14'))(_0xe855('0x15'));var utils=require(_0xe855('0x16'));var config=require('../../config/environment');var db=require(_0xe855('0x17'))['db'];config[_0xe855('0x18')]=_[_0xe855('0x19')](config[_0xe855('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xe855('0x1a'))(new Redis(config[_0xe855('0x18')]));require(_0xe855('0x1b'))[_0xe855('0x1c')](socket);function respondWithStatusCode(_0x2df3b7,_0x36ccfb){_0x36ccfb=_0x36ccfb||0xcc;return function(_0x263a73){if(_0x263a73){return _0x2df3b7['sendStatus'](_0x36ccfb);}return _0x2df3b7[_0xe855('0x1d')](_0x36ccfb)[_0xe855('0x1e')]();};}function respondWithResult(_0x2961bc,_0x33fcf2){_0x33fcf2=_0x33fcf2||0xc8;return function(_0x186095){if(_0x186095){return _0x2961bc[_0xe855('0x1d')](_0x33fcf2)[_0xe855('0x1f')](_0x186095);}};}function respondWithFilteredResult(_0x4e2d9f,_0x4f0f66){return function(_0x506293){if(_0x506293){var _0x521bd5=_0x506293[_0xe855('0x20')],_0x2d5fa5=_0x4f0f66[_0xe855('0x21')],_0x240b19=_0x4f0f66[_0xe855('0x21')]+_0x4f0f66[_0xe855('0x22')],_0x3e1faa;if(_0x240b19>=_0x521bd5){_0x240b19=_0x521bd5;_0x3e1faa=0xc8;}else{_0x3e1faa=0xce;}_0x4e2d9f[_0xe855('0x1d')](_0x3e1faa);return _0x4e2d9f['set'](_0xe855('0x23'),_0x2d5fa5+'-'+_0x240b19+'/'+_0x521bd5)['json'](_0x506293);}return null;};}function patchUpdates(_0xe71850){return function(_0xbd667d){try{jsonpatch['apply'](_0xbd667d,_0xe71850,!![]);}catch(_0x2baa35){return BPromise[_0xe855('0x24')](_0x2baa35);}return _0xbd667d[_0xe855('0x25')]();};}function saveUpdates(_0x59e60d,_0x1bd673){return function(_0x5c26b2){if(_0x5c26b2){return _0x5c26b2['update'](_0x59e60d)[_0xe855('0x26')](function(_0x1989d2){return _0x1989d2;});}return null;};}function removeEntity(_0x31234f,_0x36f4cd){return function(_0x3a94e4){if(_0x3a94e4){return _0x3a94e4[_0xe855('0x27')]()[_0xe855('0x26')](function(){var _0x110ce7=_0x3a94e4[_0xe855('0x28')]({'plain':!![]});var _0x47a4ed='VoicePrefixes';return db[_0xe855('0x29')][_0xe855('0x27')]({'where':{'type':_0x47a4ed,'resourceId':_0x110ce7['id']}})[_0xe855('0x26')](function(){return _0x3a94e4;});})[_0xe855('0x26')](function(){_0x31234f[_0xe855('0x1d')](0xcc)[_0xe855('0x1e')]();});}};}function handleEntityNotFound(_0x4583f2,_0x29952e){return function(_0x46fa5e){if(!_0x46fa5e){_0x4583f2[_0xe855('0x2a')](0x194);}return _0x46fa5e;};}function handleError(_0x37aeb6,_0x293f88){_0x293f88=_0x293f88||0x1f4;return function(_0x5b0b9b){logger['error'](_0x5b0b9b['stack']);if(_0x5b0b9b['name']){delete _0x5b0b9b[_0xe855('0x2b')];}_0x37aeb6[_0xe855('0x1d')](_0x293f88)[_0xe855('0x2c')](_0x5b0b9b);};}exports[_0xe855('0x2d')]=function(_0x2f6c89,_0x3d4554){var _0x3c52c5={},_0x290b31={},_0x220b11={'count':0x0,'rows':[]};var _0x1b1bb6=_[_0xe855('0x2e')](db[_0xe855('0x2f')][_0xe855('0x30')],function(_0x1a6e41){return{'name':_0x1a6e41[_0xe855('0x31')],'type':_0x1a6e41['type'][_0xe855('0x32')]};});_0x290b31[_0xe855('0x33')]=_[_0xe855('0x2e')](_0x1b1bb6,_0xe855('0x2b'));_0x290b31[_0xe855('0x34')]=_['keys'](_0x2f6c89[_0xe855('0x34')]);_0x290b31['filters']=_[_0xe855('0x35')](_0x290b31[_0xe855('0x33')],_0x290b31[_0xe855('0x34')]);_0x3c52c5[_0xe855('0x36')]=_[_0xe855('0x35')](_0x290b31[_0xe855('0x33')],qs['fields'](_0x2f6c89['query'][_0xe855('0x37')]));_0x3c52c5[_0xe855('0x36')]=_0x3c52c5['attributes']['length']?_0x3c52c5['attributes']:_0x290b31[_0xe855('0x33')];if(!_0x2f6c89[_0xe855('0x34')][_0xe855('0x38')]('nolimit')){_0x3c52c5['limit']=qs['limit'](_0x2f6c89[_0xe855('0x34')][_0xe855('0x22')]);_0x3c52c5[_0xe855('0x21')]=qs[_0xe855('0x21')](_0x2f6c89[_0xe855('0x34')][_0xe855('0x21')]);}_0x3c52c5['order']=qs['sort'](_0x2f6c89['query']['sort']);_0x3c52c5[_0xe855('0x39')]=qs[_0xe855('0x3a')](_[_0xe855('0x3b')](_0x2f6c89[_0xe855('0x34')],_0x290b31[_0xe855('0x3a')]),_0x1b1bb6);if(_0x2f6c89[_0xe855('0x34')]['filter']){_0x3c52c5[_0xe855('0x39')]=_[_0xe855('0x3c')](_0x3c52c5['where'],{'$or':_[_0xe855('0x2e')](_0x1b1bb6,function(_0x17deb3){if(_0x17deb3[_0xe855('0x3d')]!==_0xe855('0x3e')){var _0x391b5c={};_0x391b5c[_0x17deb3['name']]={'$like':'%'+_0x2f6c89[_0xe855('0x34')][_0xe855('0x3f')]+'%'};return _0x391b5c;}})});}_0x3c52c5=_[_0xe855('0x3c')]({},_0x3c52c5,_0x2f6c89[_0xe855('0x40')]);var _0x942fb9={'where':_0x3c52c5[_0xe855('0x39')]};return db[_0xe855('0x2f')][_0xe855('0x20')](_0x942fb9)[_0xe855('0x26')](function(_0x2de2be){_0x220b11[_0xe855('0x20')]=_0x2de2be;if(_0x2f6c89[_0xe855('0x34')][_0xe855('0x41')]){_0x3c52c5[_0xe855('0x42')]=[{'all':!![]}];}return db[_0xe855('0x2f')][_0xe855('0x43')](_0x3c52c5);})['then'](function(_0x18e98f){_0x220b11[_0xe855('0x44')]=_0x18e98f;return _0x220b11;})[_0xe855('0x26')](respondWithFilteredResult(_0x3d4554,_0x3c52c5))[_0xe855('0x45')](handleError(_0x3d4554,null));};exports[_0xe855('0x46')]=function(_0x374121,_0x166a3e){var _0x17a729={'raw':![],'where':{'id':_0x374121['params']['id']}},_0x30eb99={};_0x30eb99[_0xe855('0x33')]=_['keys'](db[_0xe855('0x2f')][_0xe855('0x30')]);_0x30eb99[_0xe855('0x34')]=_['keys'](_0x374121[_0xe855('0x34')]);_0x30eb99[_0xe855('0x3a')]=_[_0xe855('0x35')](_0x30eb99[_0xe855('0x33')],_0x30eb99[_0xe855('0x34')]);_0x17a729['attributes']=_[_0xe855('0x35')](_0x30eb99[_0xe855('0x33')],qs[_0xe855('0x37')](_0x374121['query'][_0xe855('0x37')]));_0x17a729[_0xe855('0x36')]=_0x17a729[_0xe855('0x36')]['length']?_0x17a729[_0xe855('0x36')]:_0x30eb99[_0xe855('0x33')];if(_0x374121['query'][_0xe855('0x41')]){_0x17a729[_0xe855('0x42')]=[{'all':!![]}];}_0x17a729=_[_0xe855('0x3c')]({},_0x17a729,_0x374121[_0xe855('0x40')]);return db[_0xe855('0x2f')]['find'](_0x17a729)['then'](handleEntityNotFound(_0x166a3e,null))['then'](respondWithResult(_0x166a3e,null))['catch'](handleError(_0x166a3e,null));};exports['destroy']=function(_0x154192,_0x28005c){return db[_0xe855('0x2f')][_0xe855('0x47')]({'where':{'id':_0x154192['params']['id']}})[_0xe855('0x26')](handleEntityNotFound(_0x28005c,null))[_0xe855('0x26')](removeEntity(_0x28005c,null))[_0xe855('0x45')](handleError(_0x28005c,null));};exports[_0xe855('0x48')]=function(_0xdcfc03,_0x5bf8b9){return db[_0xe855('0x2f')][_0xe855('0x48')]()['then'](respondWithResult(_0x5bf8b9,null))['catch'](handleError(_0x5bf8b9,null));};exports['create']=function(_0x5cb743,_0xa86e5c){var _0x2956f3;return db['sequelize'][_0xe855('0x49')](function(_0xc96095){return db[_0xe855('0x2f')][_0xe855('0x4a')](_0x5cb743[_0xe855('0x4b')],{'transaction':_0xc96095})['then'](function(_0x1dc8cf){_0x2956f3=_0x1dc8cf[_0xe855('0x28')]({'plain':!![]});return db[_0xe855('0x4c')][_0xe855('0x47')]({'where':{'id':_0x2956f3[_0xe855('0x4d')]},'raw':!![]})[_0xe855('0x26')](function(_0x2d865d){return createVoicePrefixExtensions(_0x2956f3,_0x2d865d,_0xc96095);});});})[_0xe855('0x26')](function(){var _0x2fdc0b=_0x5cb743[_0xe855('0x4e')]['get']({'plain':!![]});if(!_0x2fdc0b)throw new Error(_0xe855('0x4f'));if(_0x2fdc0b[_0xe855('0x50')]===_0xe855('0x4e')){var _0x2f0666=_0x2956f3;return db[_0xe855('0x51')][_0xe855('0x47')]({'where':{'name':_0xe855('0x52'),'userProfileId':_0x2fdc0b['userProfileId']},'raw':!![]})[_0xe855('0x26')](function(_0xae8d5d){if(_0xae8d5d&&_0xae8d5d[_0xe855('0x53')]===0x0){return db[_0xe855('0x29')][_0xe855('0x4a')]({'name':_0x2f0666[_0xe855('0x2b')],'resourceId':_0x2f0666['id'],'type':_0xae8d5d[_0xe855('0x2b')],'sectionId':_0xae8d5d['id']},{})[_0xe855('0x26')](function(){return _0x2956f3;});}else{return _0x2956f3;}})[_0xe855('0x45')](function(_0x274eab){logger[_0xe855('0x54')](_0xe855('0x55'),_0x274eab);throw _0x274eab;});}return _0x2956f3;})[_0xe855('0x26')](respondWithResult(_0xa86e5c,null))[_0xe855('0x45')](handleError(_0xa86e5c,null));};function Extension(_0x3e3320,_0x20579b,_0x16d0b4,_0xb8fdb4){this[_0xe855('0x56')]=_0xe855('0x57');this[_0xe855('0x58')]=_0x3e3320;this['app']=_0x16d0b4;this[_0xe855('0x3d')]=_0xe855('0x59');this[_0xe855('0x5a')]='Voice\x20Prefix\x20Extension';this[_0xe855('0x5b')]=_0x20579b;this['appdata']=_0xb8fdb4;}function createVoicePrefixExtensions(_0x1ff35c,_0x4eaef3,_0x3d88f1){return new BPromise(function(_0x784c59,_0x56a075){var _0x5cce38=new Extension(formatPrefixName(_0x1ff35c[_0xe855('0x5c')]),0x1,'NoOp',_0xe855('0x5d'));_0x5cce38['VoicePrefixId']=_0x1ff35c['id'];return db[_0xe855('0x4c')][_0xe855('0x4a')](_0x5cce38,{'transaction':_0x3d88f1})[_0xe855('0x26')](function(_0x4108fc){var _0x5dc0e6=_0x4108fc['get']({'plain':!![]});var _0x661196=_[_0xe855('0x2e')](addVoicePrefixExtensions(_0x1ff35c,_0x4eaef3),function(_0x495977){_0x495977['VoiceExtensionId']=_0x5dc0e6['id'];_0x495977[_0xe855('0x5e')]=_0x1ff35c['id'];return _0x495977;});return db[_0xe855('0x4c')][_0xe855('0x5f')](_0x661196,{'transaction':_0x3d88f1})[_0xe855('0x26')](function(_0x5530de){if(!_0x5530de){return _0x56a075(_0xe855('0x60'));}else{return _0x784c59(_0x5530de);}})[_0xe855('0x45')](function(_0x494504){return _0x56a075(_0x494504);});});;});};function addVoicePrefixExtensions(_0xb92dc4,_0x42a9ac){var _0x2bac77=[];var _0x546133=formatPrefixName(_0xb92dc4[_0xe855('0x5c')]);_0x2bac77['push'](new Extension(_0x546133,0x2,'Set',_0xe855('0x61')+_0xb92dc4[_0xe855('0x2b')]));if(_0xb92dc4['callerIdAll']){_0x2bac77[_0xe855('0x62')](new Extension(_0x546133,0x3,'Set','PREFIX-CALLERIDALL='+_0xb92dc4[_0xe855('0x63')]));}else{_0x2bac77[_0xe855('0x62')](new Extension(_0x546133,0x3,_0xe855('0x64'),_0xe855('0x65')));}_0x2bac77['push'](new Extension(_0x546133,0x4,_0xe855('0x66'),_0x42a9ac[_0xe855('0x56')]+','+_0xe855('0x67')+(0x8+_0xb92dc4['name'][_0xe855('0x68')])+'}'+','+0x1));return _0x2bac77;}function formatPrefixName(_0x75a768){var _0x1709c8='_';for(var _0x6852a3=0x0;_0x6852a3<_0x75a768[_0xe855('0x68')];_0x6852a3++){if(_0x75a768[_0xe855('0x69')](_0x6852a3)=='-'){_0x1709c8+=_0x75a768['charAt'](_0x6852a3);}else{_0x1709c8+='['+_0x75a768['charAt'](_0x6852a3)+']';}}_0x1709c8+='.';return _0x1709c8;}exports[_0xe855('0x6a')]=function(_0x3173e1,_0x4cee68,_0x55d09f){var _0x1c888f=_0x3173e1[_0xe855('0x4b')];_0x1c888f[_0xe855('0x5c')]=_0xe855('0x6b')+_0x1c888f['name']+'-';return db[_0xe855('0x6c')]['transaction'](function(_0x328dfb){return db[_0xe855('0x2f')][_0xe855('0x6a')](_0x1c888f,{'where':{'id':_0x1c888f['id']},'transaction':_0x328dfb})['then'](function(){return db[_0xe855('0x4c')][_0xe855('0x27')]({'where':{'VoicePrefixId':_0x1c888f['id']},'transaction':_0x328dfb})['then'](function(){return db[_0xe855('0x4c')][_0xe855('0x47')]({'where':{'id':_0x1c888f['VoiceExtensionId']},'raw':!![]})[_0xe855('0x26')](function(_0x96b536){return createVoicePrefixExtensions(_0x1c888f,_0x96b536,_0x328dfb);});});});})['then'](function(){return db[_0xe855('0x2f')][_0xe855('0x6d')](_0x1c888f['id']);})['then'](respondWithResult(_0x4cee68,null))[_0xe855('0x45')](handleError(_0x4cee68,null));};exports[_0xe855('0x6e')]=function(_0x21ca77,_0x4d6ace,_0x1f6f27){return db['VoicePrefix'][_0xe855('0x47')]({'where':{'id':_0x21ca77[_0xe855('0x6f')]['id']}})[_0xe855('0x26')](handleEntityNotFound(_0x4d6ace,null))['then'](function(_0x26fbc3){if(_0x26fbc3){return _0x26fbc3[_0xe855('0x6e')](_0x21ca77['body'][_0xe855('0x70')],_[_0xe855('0x71')](_0x21ca77['body'],['ids','id'])||{})[_0xe855('0x72')](function(_0x1ce1b4){for(var _0x44f9fa=0x0;_0x44f9fa<_0x21ca77[_0xe855('0x4b')][_0xe855('0x70')][_0xe855('0x68')];_0x44f9fa+=0x1){socket[_0xe855('0x73')](_0xe855('0x74'),{'UserId':_0x21ca77[_0xe855('0x4b')][_0xe855('0x70')][_0x44f9fa],'VoicePrefixId':_0x21ca77[_0xe855('0x6f')]['id']});}return _0x1ce1b4;});}})[_0xe855('0x26')](respondWithResult(_0x4d6ace,null))[_0xe855('0x45')](handleError(_0x4d6ace,null));};exports[_0xe855('0x75')]=function(_0x4cada5,_0x17b8d2,_0x1aaf58){return db[_0xe855('0x2f')][_0xe855('0x47')]({'where':{'id':_0x4cada5[_0xe855('0x6f')]['id']}})[_0xe855('0x26')](handleEntityNotFound(_0x17b8d2,null))[_0xe855('0x26')](function(_0x5ad610){if(_0x5ad610){return _0x5ad610[_0xe855('0x75')](_0x4cada5[_0xe855('0x34')][_0xe855('0x70')])[_0xe855('0x26')](function(){if(_[_0xe855('0x76')](_0x4cada5['query']['ids'])){for(var _0x115dc5=0x0;_0x115dc5<_0x4cada5[_0xe855('0x34')][_0xe855('0x70')]['length'];_0x115dc5+=0x1){socket['emit'](_0xe855('0x77'),{'UserId':Number(_0x4cada5[_0xe855('0x34')][_0xe855('0x70')][_0x115dc5]),'VoicePrefixId':Number(_0x4cada5[_0xe855('0x6f')]['id'])});}}else{socket[_0xe855('0x73')](_0xe855('0x77'),{'UserId':Number(_0x4cada5[_0xe855('0x34')][_0xe855('0x70')]),'VoicePrefixId':Number(_0x4cada5[_0xe855('0x6f')]['id'])});}});}})[_0xe855('0x26')](respondWithStatusCode(_0x17b8d2,null))[_0xe855('0x45')](handleError(_0x17b8d2,null));};exports[_0xe855('0x78')]=function(_0xc35a15,_0x885181,_0x28c6fd){var _0x61f7a0={};var _0x569e31={};var _0x5be42f;var _0x2e5c53;return db['VoicePrefix'][_0xe855('0x79')]({'where':{'id':_0xc35a15['params']['id']}})['then'](handleEntityNotFound(_0x885181,null))['then'](function(_0x39881b){if(_0x39881b){_0x5be42f=_0x39881b;_0x569e31[_0xe855('0x33')]=_[_0xe855('0x7a')](db['User'][_0xe855('0x30')]);_0x569e31['query']=_[_0xe855('0x7a')](_0xc35a15[_0xe855('0x34')]);_0x569e31['filters']=_[_0xe855('0x35')](_0x569e31[_0xe855('0x33')],_0x569e31[_0xe855('0x34')]);_0x61f7a0[_0xe855('0x36')]=_[_0xe855('0x35')](_0x569e31[_0xe855('0x33')],qs[_0xe855('0x37')](_0xc35a15['query'][_0xe855('0x37')]));_0x61f7a0['attributes']=_0x61f7a0[_0xe855('0x36')][_0xe855('0x68')]?_0x61f7a0[_0xe855('0x36')]:_0x569e31['model'];_0x61f7a0[_0xe855('0x7b')]=qs['sort'](_0xc35a15['query'][_0xe855('0x7c')]);_0x61f7a0[_0xe855('0x39')]=qs['filters'](_['pick'](_0xc35a15[_0xe855('0x34')],_0x569e31[_0xe855('0x3a')]));if(_0xc35a15[_0xe855('0x34')][_0xe855('0x3f')]){_0x61f7a0[_0xe855('0x39')]=_[_0xe855('0x3c')](_0x61f7a0[_0xe855('0x39')],{'$or':_[_0xe855('0x2e')](_0x61f7a0[_0xe855('0x36')],function(_0x226b09){var _0x50cd52={};_0x50cd52[_0x226b09]={'$like':'%'+_0xc35a15['query'][_0xe855('0x3f')]+'%'};return _0x50cd52;})});}_0x61f7a0=_[_0xe855('0x3c')]({},_0x61f7a0,_0xc35a15[_0xe855('0x40')]);return _0x5be42f[_0xe855('0x78')](_0x61f7a0);}})[_0xe855('0x26')](function(_0x1ad9ef){if(_0x1ad9ef){_0x2e5c53=_0x1ad9ef['length'];if(!_0xc35a15[_0xe855('0x34')]['hasOwnProperty'](_0xe855('0x7d'))){_0x61f7a0['limit']=qs[_0xe855('0x22')](_0xc35a15[_0xe855('0x34')][_0xe855('0x22')]);_0x61f7a0['offset']=qs[_0xe855('0x21')](_0xc35a15[_0xe855('0x34')][_0xe855('0x21')]);}return _0x5be42f[_0xe855('0x78')](_0x61f7a0);}})[_0xe855('0x26')](function(_0x4bdcc7){if(_0x4bdcc7){return _0x4bdcc7?{'count':_0x2e5c53,'rows':_0x4bdcc7}:null;}})[_0xe855('0x26')](respondWithResult(_0x885181,null))[_0xe855('0x45')](handleError(_0x885181,null));}; \ No newline at end of file +var _0xb1ee=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','keys','describe','create','sequelize','transaction','find','VoiceExtensionId','user','userProfileId','autoAssociation','context','from-sip','app','description','Voice\x20Prefix\x20Extension','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','Set','CDR(prefix)=','callerIdAll','push','No\x20callerid\x20available','goto','${EXTEN:','charAt','findById','addAgents','body','ids','spread','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','emit','getAgents','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','destroy','get','VoicePrefixes','UserProfileResource','then','error','stack','name','send','index','map','VoicePrefix','fieldName','key','model','query'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xb1ee,0x11b));var _0xeb1e=function(_0x2a18b7,_0x5041c8){_0x2a18b7=_0x2a18b7-0x0;var _0x45e74e=_0xb1ee[_0x2a18b7];return _0x45e74e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeb1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeb1e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb1e('0x2'));var moment=require(_0xeb1e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xeb1e('0x4'));var util=require(_0xeb1e('0x5'));var path=require(_0xeb1e('0x6'));var sox=require('sox');var csv=require(_0xeb1e('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xeb1e('0x8'));var crypto=require('crypto');var jsforce=require(_0xeb1e('0x9'));var deskjs=require(_0xeb1e('0xa'));var toCsv=require(_0xeb1e('0x7'));var querystring=require(_0xeb1e('0xb'));var Papa=require(_0xeb1e('0xc'));var Redis=require('ioredis');var authService=require(_0xeb1e('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xeb1e('0xe'));var hardwareService=require(_0xeb1e('0xf'));var logger=require(_0xeb1e('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xeb1e('0x11'));var db=require(_0xeb1e('0x12'))['db'];config[_0xeb1e('0x13')]=_['defaults'](config[_0xeb1e('0x13')],{'host':_0xeb1e('0x14'),'port':0x18eb});var socket=require(_0xeb1e('0x15'))(new Redis(config[_0xeb1e('0x13')]));require(_0xeb1e('0x16'))[_0xeb1e('0x17')](socket);function respondWithStatusCode(_0x5edf9b,_0x464bdf){_0x464bdf=_0x464bdf||0xcc;return function(_0x40559a){if(_0x40559a){return _0x5edf9b[_0xeb1e('0x18')](_0x464bdf);}return _0x5edf9b[_0xeb1e('0x19')](_0x464bdf)[_0xeb1e('0x1a')]();};}function respondWithResult(_0x2f3234,_0x424edd){_0x424edd=_0x424edd||0xc8;return function(_0xf1b66e){if(_0xf1b66e){return _0x2f3234['status'](_0x424edd)[_0xeb1e('0x1b')](_0xf1b66e);}};}function respondWithFilteredResult(_0x426dc8,_0x3f8878){return function(_0x34c168){if(_0x34c168){var _0x4ac086=_0x34c168[_0xeb1e('0x1c')],_0x4aae39=_0x3f8878[_0xeb1e('0x1d')],_0x35e082=_0x3f8878[_0xeb1e('0x1d')]+_0x3f8878[_0xeb1e('0x1e')],_0x46f155;if(_0x35e082>=_0x4ac086){_0x35e082=_0x4ac086;_0x46f155=0xc8;}else{_0x46f155=0xce;}_0x426dc8[_0xeb1e('0x19')](_0x46f155);return _0x426dc8[_0xeb1e('0x1f')](_0xeb1e('0x20'),_0x4aae39+'-'+_0x35e082+'/'+_0x4ac086)[_0xeb1e('0x1b')](_0x34c168);}return null;};}function patchUpdates(_0x45b3ea){return function(_0x34bdcd){try{jsonpatch['apply'](_0x34bdcd,_0x45b3ea,!![]);}catch(_0x13f9f0){return BPromise['reject'](_0x13f9f0);}return _0x34bdcd['save']();};}function saveUpdates(_0x3422eb,_0x37f30f){return function(_0x404629){if(_0x404629){return _0x404629[_0xeb1e('0x21')](_0x3422eb)['then'](function(_0x447def){return _0x447def;});}return null;};}function removeEntity(_0x5558e1,_0x2373da){return function(_0x467064){if(_0x467064){return _0x467064[_0xeb1e('0x22')]()['then'](function(){var _0x2c6ca7=_0x467064[_0xeb1e('0x23')]({'plain':!![]});var _0x9b1c=_0xeb1e('0x24');return db[_0xeb1e('0x25')][_0xeb1e('0x22')]({'where':{'type':_0x9b1c,'resourceId':_0x2c6ca7['id']}})[_0xeb1e('0x26')](function(){return _0x467064;});})[_0xeb1e('0x26')](function(){_0x5558e1[_0xeb1e('0x19')](0xcc)[_0xeb1e('0x1a')]();});}};}function handleEntityNotFound(_0x7453d7,_0x14e5c4){return function(_0x1708fb){if(!_0x1708fb){_0x7453d7[_0xeb1e('0x18')](0x194);}return _0x1708fb;};}function handleError(_0x2d901b,_0x19731a){_0x19731a=_0x19731a||0x1f4;return function(_0x90cdbb){logger[_0xeb1e('0x27')](_0x90cdbb[_0xeb1e('0x28')]);if(_0x90cdbb['name']){delete _0x90cdbb[_0xeb1e('0x29')];}_0x2d901b[_0xeb1e('0x19')](_0x19731a)[_0xeb1e('0x2a')](_0x90cdbb);};}exports[_0xeb1e('0x2b')]=function(_0x10cb5d,_0x178e97){var _0x276e17={},_0x350859={},_0x109fc7={'count':0x0,'rows':[]};var _0x366bc1=_[_0xeb1e('0x2c')](db[_0xeb1e('0x2d')]['rawAttributes'],function(_0x273e71){return{'name':_0x273e71[_0xeb1e('0x2e')],'type':_0x273e71['type'][_0xeb1e('0x2f')]};});_0x350859[_0xeb1e('0x30')]=_[_0xeb1e('0x2c')](_0x366bc1,_0xeb1e('0x29'));_0x350859[_0xeb1e('0x31')]=_['keys'](_0x10cb5d[_0xeb1e('0x31')]);_0x350859[_0xeb1e('0x32')]=_[_0xeb1e('0x33')](_0x350859[_0xeb1e('0x30')],_0x350859[_0xeb1e('0x31')]);_0x276e17[_0xeb1e('0x34')]=_[_0xeb1e('0x33')](_0x350859[_0xeb1e('0x30')],qs['fields'](_0x10cb5d[_0xeb1e('0x31')][_0xeb1e('0x35')]));_0x276e17[_0xeb1e('0x34')]=_0x276e17[_0xeb1e('0x34')][_0xeb1e('0x36')]?_0x276e17[_0xeb1e('0x34')]:_0x350859[_0xeb1e('0x30')];if(!_0x10cb5d[_0xeb1e('0x31')][_0xeb1e('0x37')](_0xeb1e('0x38'))){_0x276e17[_0xeb1e('0x1e')]=qs[_0xeb1e('0x1e')](_0x10cb5d[_0xeb1e('0x31')][_0xeb1e('0x1e')]);_0x276e17[_0xeb1e('0x1d')]=qs[_0xeb1e('0x1d')](_0x10cb5d[_0xeb1e('0x31')]['offset']);}_0x276e17[_0xeb1e('0x39')]=qs['sort'](_0x10cb5d[_0xeb1e('0x31')][_0xeb1e('0x3a')]);_0x276e17[_0xeb1e('0x3b')]=qs[_0xeb1e('0x32')](_[_0xeb1e('0x3c')](_0x10cb5d[_0xeb1e('0x31')],_0x350859['filters']),_0x366bc1);if(_0x10cb5d[_0xeb1e('0x31')][_0xeb1e('0x3d')]){_0x276e17[_0xeb1e('0x3b')]=_[_0xeb1e('0x3e')](_0x276e17[_0xeb1e('0x3b')],{'$or':_['map'](_0x366bc1,function(_0x306845){if(_0x306845[_0xeb1e('0x3f')]!==_0xeb1e('0x40')){var _0x35bf4={};_0x35bf4[_0x306845[_0xeb1e('0x29')]]={'$like':'%'+_0x10cb5d[_0xeb1e('0x31')][_0xeb1e('0x3d')]+'%'};return _0x35bf4;}})});}_0x276e17=_[_0xeb1e('0x3e')]({},_0x276e17,_0x10cb5d[_0xeb1e('0x41')]);var _0x5726e9={'where':_0x276e17['where']};return db['VoicePrefix'][_0xeb1e('0x1c')](_0x5726e9)[_0xeb1e('0x26')](function(_0x469f8b){_0x109fc7[_0xeb1e('0x1c')]=_0x469f8b;if(_0x10cb5d[_0xeb1e('0x31')][_0xeb1e('0x42')]){_0x276e17[_0xeb1e('0x43')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x276e17);})[_0xeb1e('0x26')](function(_0x3a3dd1){_0x109fc7[_0xeb1e('0x44')]=_0x3a3dd1;return _0x109fc7;})[_0xeb1e('0x26')](respondWithFilteredResult(_0x178e97,_0x276e17))[_0xeb1e('0x45')](handleError(_0x178e97,null));};exports[_0xeb1e('0x46')]=function(_0x1cf0e5,_0xf94f62){var _0x3d0479={'raw':![],'where':{'id':_0x1cf0e5[_0xeb1e('0x47')]['id']}},_0x1a6af9={};_0x1a6af9['model']=_['keys'](db[_0xeb1e('0x2d')][_0xeb1e('0x48')]);_0x1a6af9['query']=_[_0xeb1e('0x49')](_0x1cf0e5[_0xeb1e('0x31')]);_0x1a6af9[_0xeb1e('0x32')]=_[_0xeb1e('0x33')](_0x1a6af9[_0xeb1e('0x30')],_0x1a6af9[_0xeb1e('0x31')]);_0x3d0479[_0xeb1e('0x34')]=_[_0xeb1e('0x33')](_0x1a6af9[_0xeb1e('0x30')],qs[_0xeb1e('0x35')](_0x1cf0e5['query']['fields']));_0x3d0479['attributes']=_0x3d0479[_0xeb1e('0x34')][_0xeb1e('0x36')]?_0x3d0479[_0xeb1e('0x34')]:_0x1a6af9[_0xeb1e('0x30')];if(_0x1cf0e5[_0xeb1e('0x31')][_0xeb1e('0x42')]){_0x3d0479[_0xeb1e('0x43')]=[{'all':!![]}];}_0x3d0479=_[_0xeb1e('0x3e')]({},_0x3d0479,_0x1cf0e5[_0xeb1e('0x41')]);return db[_0xeb1e('0x2d')]['find'](_0x3d0479)['then'](handleEntityNotFound(_0xf94f62,null))['then'](respondWithResult(_0xf94f62,null))[_0xeb1e('0x45')](handleError(_0xf94f62,null));};exports[_0xeb1e('0x22')]=function(_0x2aa5dd,_0x2c310c){return db[_0xeb1e('0x2d')]['find']({'where':{'id':_0x2aa5dd[_0xeb1e('0x47')]['id']}})[_0xeb1e('0x26')](handleEntityNotFound(_0x2c310c,null))['then'](removeEntity(_0x2c310c,null))[_0xeb1e('0x45')](handleError(_0x2c310c,null));};exports[_0xeb1e('0x4a')]=function(_0x1c80db,_0x2b1b99){return db[_0xeb1e('0x2d')]['describe']()[_0xeb1e('0x26')](respondWithResult(_0x2b1b99,null))[_0xeb1e('0x45')](handleError(_0x2b1b99,null));};exports[_0xeb1e('0x4b')]=function(_0x2853be,_0x304adf){var _0xcaf911;return db[_0xeb1e('0x4c')][_0xeb1e('0x4d')](function(_0x16cf5a){return db[_0xeb1e('0x2d')][_0xeb1e('0x4b')](_0x2853be['body'],{'transaction':_0x16cf5a})[_0xeb1e('0x26')](function(_0x42845d){_0xcaf911=_0x42845d['get']({'plain':!![]});return db['VoiceExtension'][_0xeb1e('0x4e')]({'where':{'id':_0xcaf911[_0xeb1e('0x4f')]},'raw':!![]})[_0xeb1e('0x26')](function(_0x2246c0){return createVoicePrefixExtensions(_0xcaf911,_0x2246c0,_0x16cf5a);});});})[_0xeb1e('0x26')](function(){var _0x384942=_0x2853be[_0xeb1e('0x50')][_0xeb1e('0x23')]({'plain':!![]});if(!_0x384942)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x384942['role']===_0xeb1e('0x50')){var _0xc944de=_0xcaf911;return db['UserProfileSection'][_0xeb1e('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x384942[_0xeb1e('0x51')]},'raw':!![]})['then'](function(_0x35a541){if(_0x35a541&&_0x35a541[_0xeb1e('0x52')]===0x0){return db['UserProfileResource'][_0xeb1e('0x4b')]({'name':_0xc944de[_0xeb1e('0x29')],'resourceId':_0xc944de['id'],'type':_0x35a541[_0xeb1e('0x29')],'sectionId':_0x35a541['id']},{})[_0xeb1e('0x26')](function(){return _0xcaf911;});}else{return _0xcaf911;}})[_0xeb1e('0x45')](function(_0x4fa313){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fa313);throw _0x4fa313;});}return _0xcaf911;})[_0xeb1e('0x26')](respondWithResult(_0x304adf,null))['catch'](handleError(_0x304adf,null));};function Extension(_0x13bdab,_0x235ffe,_0x4350dc,_0x2368f5){this[_0xeb1e('0x53')]=_0xeb1e('0x54');this['exten']=_0x13bdab;this[_0xeb1e('0x55')]=_0x4350dc;this['type']='system';this[_0xeb1e('0x56')]=_0xeb1e('0x57');this['priority']=_0x235ffe;this['appdata']=_0x2368f5;}function createVoicePrefixExtensions(_0x191c48,_0x1060e3,_0x281ee0){return new BPromise(function(_0x564b38,_0x1d98c9){var _0x3a2a3c=new Extension(formatPrefixName(_0x191c48[_0xeb1e('0x58')]),0x1,_0xeb1e('0x59'),_0xeb1e('0x5a'));_0x3a2a3c[_0xeb1e('0x5b')]=_0x191c48['id'];return db[_0xeb1e('0x5c')]['create'](_0x3a2a3c,{'transaction':_0x281ee0})['then'](function(_0x171e3f){var _0x2355a6=_0x171e3f[_0xeb1e('0x23')]({'plain':!![]});var _0x193fba=_[_0xeb1e('0x2c')](addVoicePrefixExtensions(_0x191c48,_0x1060e3),function(_0xe4172b){_0xe4172b[_0xeb1e('0x4f')]=_0x2355a6['id'];_0xe4172b[_0xeb1e('0x5b')]=_0x191c48['id'];return _0xe4172b;});return db['VoiceExtension']['bulkCreate'](_0x193fba,{'transaction':_0x281ee0})['then'](function(_0x4ce026){if(!_0x4ce026){return _0x1d98c9('Extensions\x20creation\x20failed');}else{return _0x564b38(_0x4ce026);}})[_0xeb1e('0x45')](function(_0x190d75){return _0x1d98c9(_0x190d75);});});;});};function addVoicePrefixExtensions(_0x1f2987,_0x39f253){var _0x120b64=[];var _0x28ffb1=formatPrefixName(_0x1f2987[_0xeb1e('0x58')]);_0x120b64['push'](new Extension(_0x28ffb1,0x2,_0xeb1e('0x5d'),_0xeb1e('0x5e')+_0x1f2987[_0xeb1e('0x29')]));if(_0x1f2987[_0xeb1e('0x5f')]){_0x120b64[_0xeb1e('0x60')](new Extension(_0x28ffb1,0x3,_0xeb1e('0x5d'),'PREFIX-CALLERIDALL='+_0x1f2987[_0xeb1e('0x5f')]));}else{_0x120b64[_0xeb1e('0x60')](new Extension(_0x28ffb1,0x3,_0xeb1e('0x59'),_0xeb1e('0x61')));}_0x120b64[_0xeb1e('0x60')](new Extension(_0x28ffb1,0x4,_0xeb1e('0x62'),_0x39f253[_0xeb1e('0x53')]+','+_0xeb1e('0x63')+(0x8+_0x1f2987[_0xeb1e('0x29')][_0xeb1e('0x36')])+'}'+','+0x1));return _0x120b64;}function formatPrefixName(_0x35b19e){var _0x12329f='_';for(var _0x562d3f=0x0;_0x562d3f<_0x35b19e[_0xeb1e('0x36')];_0x562d3f++){if(_0x35b19e['charAt'](_0x562d3f)=='-'){_0x12329f+=_0x35b19e[_0xeb1e('0x64')](_0x562d3f);}else{_0x12329f+='['+_0x35b19e[_0xeb1e('0x64')](_0x562d3f)+']';}}_0x12329f+='.';return _0x12329f;}exports['update']=function(_0x1689b6,_0x3fc0ed,_0x110981){var _0x44c6c6=_0x1689b6['body'];_0x44c6c6[_0xeb1e('0x58')]='system-'+_0x44c6c6['name']+'-';return db[_0xeb1e('0x4c')][_0xeb1e('0x4d')](function(_0x6d9d19){return db['VoicePrefix'][_0xeb1e('0x21')](_0x44c6c6,{'where':{'id':_0x44c6c6['id']},'transaction':_0x6d9d19})[_0xeb1e('0x26')](function(){return db[_0xeb1e('0x5c')][_0xeb1e('0x22')]({'where':{'VoicePrefixId':_0x44c6c6['id']},'transaction':_0x6d9d19})['then'](function(){return db[_0xeb1e('0x5c')][_0xeb1e('0x4e')]({'where':{'id':_0x44c6c6[_0xeb1e('0x4f')]},'raw':!![]})[_0xeb1e('0x26')](function(_0x183c9d){return createVoicePrefixExtensions(_0x44c6c6,_0x183c9d,_0x6d9d19);});});});})[_0xeb1e('0x26')](function(){return db[_0xeb1e('0x2d')][_0xeb1e('0x65')](_0x44c6c6['id']);})[_0xeb1e('0x26')](respondWithResult(_0x3fc0ed,null))[_0xeb1e('0x45')](handleError(_0x3fc0ed,null));};exports[_0xeb1e('0x66')]=function(_0x402b1d,_0xa2274f,_0x1782fd){return db[_0xeb1e('0x2d')]['find']({'where':{'id':_0x402b1d[_0xeb1e('0x47')]['id']}})[_0xeb1e('0x26')](handleEntityNotFound(_0xa2274f,null))[_0xeb1e('0x26')](function(_0x153a17){if(_0x153a17){return _0x153a17['addAgents'](_0x402b1d[_0xeb1e('0x67')][_0xeb1e('0x68')],_['omit'](_0x402b1d[_0xeb1e('0x67')],[_0xeb1e('0x68'),'id'])||{})[_0xeb1e('0x69')](function(_0xeba62){for(var _0x55d790=0x0;_0x55d790<_0x402b1d[_0xeb1e('0x67')][_0xeb1e('0x68')][_0xeb1e('0x36')];_0x55d790+=0x1){socket['emit'](_0xeb1e('0x6a'),{'UserId':_0x402b1d['body'][_0xeb1e('0x68')][_0x55d790],'VoicePrefixId':_0x402b1d[_0xeb1e('0x47')]['id']});}return _0xeba62;});}})[_0xeb1e('0x26')](respondWithResult(_0xa2274f,null))[_0xeb1e('0x45')](handleError(_0xa2274f,null));};exports[_0xeb1e('0x6b')]=function(_0x239cb4,_0x30816d,_0x4d5d2e){return db[_0xeb1e('0x2d')][_0xeb1e('0x4e')]({'where':{'id':_0x239cb4[_0xeb1e('0x47')]['id']}})[_0xeb1e('0x26')](handleEntityNotFound(_0x30816d,null))[_0xeb1e('0x26')](function(_0x4bc584){if(_0x4bc584){return _0x4bc584[_0xeb1e('0x6b')](_0x239cb4['query'][_0xeb1e('0x68')])[_0xeb1e('0x26')](function(){if(_['isArray'](_0x239cb4[_0xeb1e('0x31')][_0xeb1e('0x68')])){for(var _0x1b548b=0x0;_0x1b548b<_0x239cb4[_0xeb1e('0x31')]['ids']['length'];_0x1b548b+=0x1){socket['emit'](_0xeb1e('0x6c'),{'UserId':Number(_0x239cb4[_0xeb1e('0x31')][_0xeb1e('0x68')][_0x1b548b]),'VoicePrefixId':Number(_0x239cb4[_0xeb1e('0x47')]['id'])});}}else{socket[_0xeb1e('0x6d')](_0xeb1e('0x6c'),{'UserId':Number(_0x239cb4[_0xeb1e('0x31')][_0xeb1e('0x68')]),'VoicePrefixId':Number(_0x239cb4[_0xeb1e('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x30816d,null))['catch'](handleError(_0x30816d,null));};exports[_0xeb1e('0x6e')]=function(_0x3fa78d,_0x10bcca,_0x6da343){var _0x525725={};var _0x46fd6b={};var _0xf5b1af;var _0x440a38;return db[_0xeb1e('0x2d')]['findOne']({'where':{'id':_0x3fa78d[_0xeb1e('0x47')]['id']}})[_0xeb1e('0x26')](handleEntityNotFound(_0x10bcca,null))[_0xeb1e('0x26')](function(_0x5e4538){if(_0x5e4538){_0xf5b1af=_0x5e4538;_0x46fd6b[_0xeb1e('0x30')]=_[_0xeb1e('0x49')](db['User']['rawAttributes']);_0x46fd6b[_0xeb1e('0x31')]=_[_0xeb1e('0x49')](_0x3fa78d[_0xeb1e('0x31')]);_0x46fd6b[_0xeb1e('0x32')]=_[_0xeb1e('0x33')](_0x46fd6b[_0xeb1e('0x30')],_0x46fd6b[_0xeb1e('0x31')]);_0x525725[_0xeb1e('0x34')]=_['intersection'](_0x46fd6b[_0xeb1e('0x30')],qs['fields'](_0x3fa78d[_0xeb1e('0x31')][_0xeb1e('0x35')]));_0x525725[_0xeb1e('0x34')]=_0x525725[_0xeb1e('0x34')][_0xeb1e('0x36')]?_0x525725[_0xeb1e('0x34')]:_0x46fd6b[_0xeb1e('0x30')];_0x525725[_0xeb1e('0x39')]=qs[_0xeb1e('0x3a')](_0x3fa78d['query'][_0xeb1e('0x3a')]);_0x525725[_0xeb1e('0x3b')]=qs[_0xeb1e('0x32')](_[_0xeb1e('0x3c')](_0x3fa78d[_0xeb1e('0x31')],_0x46fd6b[_0xeb1e('0x32')]));if(_0x3fa78d[_0xeb1e('0x31')]['filter']){_0x525725[_0xeb1e('0x3b')]=_[_0xeb1e('0x3e')](_0x525725['where'],{'$or':_[_0xeb1e('0x2c')](_0x525725[_0xeb1e('0x34')],function(_0x4152cc){var _0x1680da={};_0x1680da[_0x4152cc]={'$like':'%'+_0x3fa78d[_0xeb1e('0x31')][_0xeb1e('0x3d')]+'%'};return _0x1680da;})});}_0x525725=_[_0xeb1e('0x3e')]({},_0x525725,_0x3fa78d[_0xeb1e('0x41')]);return _0xf5b1af[_0xeb1e('0x6e')](_0x525725);}})[_0xeb1e('0x26')](function(_0x156f0e){if(_0x156f0e){_0x440a38=_0x156f0e[_0xeb1e('0x36')];if(!_0x3fa78d[_0xeb1e('0x31')][_0xeb1e('0x37')]('nolimit')){_0x525725[_0xeb1e('0x1e')]=qs[_0xeb1e('0x1e')](_0x3fa78d[_0xeb1e('0x31')][_0xeb1e('0x1e')]);_0x525725[_0xeb1e('0x1d')]=qs[_0xeb1e('0x1d')](_0x3fa78d[_0xeb1e('0x31')]['offset']);}return _0xf5b1af[_0xeb1e('0x6e')](_0x525725);}})[_0xeb1e('0x26')](function(_0x500f4e){if(_0x500f4e){return _0x500f4e?{'count':_0x440a38,'rows':_0x500f4e}:null;}})[_0xeb1e('0x26')](respondWithResult(_0x10bcca,null))[_0xeb1e('0x45')](handleError(_0x10bcca,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index c9fa4a7..8f39fc8 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 _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','VoicePrefix','setMaxListeners'];(function(_0x15383c,_0x1e0f93){var _0x38f247=function(_0xad6030){while(--_0xad6030){_0x15383c['push'](_0x15383c['shift']());}};_0x38f247(++_0x1e0f93);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x49c4('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){VoicePrefixEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);VoicePrefixEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];VoicePrefix[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x4c9e31,_0x13568b){var _0x386208=function(_0x492b47){while(--_0x492b47){_0x4c9e31['push'](_0x4c9e31['shift']());}};_0x386208(++_0x13568b);}(_0x70e0,0x17b));var _0x070e=function(_0x5ca99b,_0x20f4c3){_0x5ca99b=_0x5ca99b-0x0;var _0x58b8d1=_0x70e0[_0x5ca99b];return _0x58b8d1;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index d104159..daf9c50 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 _0x5a89=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes'];(function(_0x1244a3,_0x2b4bfa){var _0x2d7bb4=function(_0x42e385){while(--_0x42e385){_0x1244a3['push'](_0x1244a3['shift']());}};_0x2d7bb4(++_0x2b4bfa);}(_0x5a89,0x1ba));var _0x95a8=function(_0x22a3c9,_0x2c12b6){_0x22a3c9=_0x22a3c9-0x0;var _0x1d78ba=_0x5a89[_0x22a3c9];return _0x1d78ba;};'use strict';var _=require(_0x95a8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x95a8('0x1'));var moment=require(_0x95a8('0x2'));var BPromise=require(_0x95a8('0x3'));var rp=require(_0x95a8('0x4'));var fs=require('fs');var path=require(_0x95a8('0x5'));var rimraf=require(_0x95a8('0x6'));var config=require(_0x95a8('0x7'));var attributes=require(_0x95a8('0x8'));module[_0x95a8('0x9')]=function(_0x182093,_0x94f586){return _0x182093[_0x95a8('0xa')](_0x95a8('0xb'),attributes,{'tableName':_0x95a8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e3b=['api','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','VoicePrefix','voice_prefixes','../../config/logger'];(function(_0x41bc8a,_0x13bae3){var _0x397a28=function(_0x343287){while(--_0x343287){_0x41bc8a['push'](_0x41bc8a['shift']());}};_0x397a28(++_0x13bae3);}(_0x1e3b,0x1c1));var _0xb1e3=function(_0x3d214b,_0x5a8a03){_0x3d214b=_0x3d214b-0x0;var _0x26be74=_0x1e3b[_0x3d214b];return _0x26be74;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb1e3('0x0'))(_0xb1e3('0x1'));var moment=require('moment');var BPromise=require(_0xb1e3('0x2'));var rp=require(_0xb1e3('0x3'));var fs=require('fs');var path=require(_0xb1e3('0x4'));var rimraf=require(_0xb1e3('0x5'));var config=require(_0xb1e3('0x6'));var attributes=require(_0xb1e3('0x7'));module['exports']=function(_0x4e22d6,_0x336ff0){return _0x4e22d6['define'](_0xb1e3('0x8'),attributes,{'tableName':_0xb1e3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index fbe5ff1..83ce321 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 _0x3841=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x21420e,_0x15c0b0){var _0x56a508=function(_0x3d48df){while(--_0x3d48df){_0x21420e['push'](_0x21420e['shift']());}};_0x56a508(++_0x15c0b0);}(_0x3841,0xc5));var _0x1384=function(_0x4057f9,_0x17c5b5){_0x4057f9=_0x4057f9-0x0;var _0x5552b7=_0x3841[_0x4057f9];return _0x5552b7;};'use strict';var _=require(_0x1384('0x0'));var util=require(_0x1384('0x1'));var moment=require(_0x1384('0x2'));var BPromise=require('bluebird');var rs=require(_0x1384('0x3'));var fs=require('fs');var Redis=require(_0x1384('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1384('0x5'));var logger=require(_0x1384('0x6'))(_0x1384('0x7'));var config=require(_0x1384('0x8'));var jayson=require(_0x1384('0x9'));var client=jayson[_0x1384('0xa')][_0x1384('0xb')]({'port':0x232a});config['redis']=_[_0x1384('0xc')](config['redis'],{'host':_0x1384('0xd'),'port':0x18eb});var socket=require(_0x1384('0xe'))(new Redis(config[_0x1384('0xf')]));require(_0x1384('0x10'))['register'](socket);function respondWithRpcPromise(_0x462e24,_0x35db88,_0x260dfa){return new BPromise(function(_0x2a19da,_0x540390){return client[_0x1384('0x11')](_0x462e24,_0x260dfa)[_0x1384('0x12')](function(_0x2dec75){logger[_0x1384('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x35db88,_0x1384('0x14'));logger[_0x1384('0x15')](_0x1384('0x16'),_0x35db88,'request\x20sent',JSON[_0x1384('0x17')](_0x2dec75));if(_0x2dec75[_0x1384('0x18')]){if(_0x2dec75[_0x1384('0x18')]['code']===0x1f4){logger[_0x1384('0x18')](_0x1384('0x19'),_0x35db88,_0x2dec75['error'][_0x1384('0x1a')]);return _0x540390(_0x2dec75[_0x1384('0x18')][_0x1384('0x1a')]);}logger[_0x1384('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x35db88,_0x2dec75['error'][_0x1384('0x1a')]);return _0x2a19da(_0x2dec75[_0x1384('0x18')]['message']);}else{logger[_0x1384('0x13')](_0x1384('0x19'),_0x35db88,'request\x20sent');_0x2a19da(_0x2dec75[_0x1384('0x1b')][_0x1384('0x1a')]);}})[_0x1384('0x1c')](function(_0x3c8bbe){logger[_0x1384('0x18')](_0x1384('0x19'),_0x35db88,_0x3c8bbe);_0x540390(_0x3c8bbe);});});} \ No newline at end of file +var _0x4f5c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util'];(function(_0x1a6ffb,_0x274cef){var _0x15dd7e=function(_0x55552e){while(--_0x55552e){_0x1a6ffb['push'](_0x1a6ffb['shift']());}};_0x15dd7e(++_0x274cef);}(_0x4f5c,0xb2));var _0xc4f5=function(_0x417610,_0x20e753){_0x417610=_0x417610-0x0;var _0x277c60=_0x4f5c[_0x417610];return _0x277c60;};'use strict';var _=require(_0xc4f5('0x0'));var util=require(_0xc4f5('0x1'));var moment=require('moment');var BPromise=require(_0xc4f5('0x2'));var rs=require(_0xc4f5('0x3'));var fs=require('fs');var Redis=require(_0xc4f5('0x4'));var db=require(_0xc4f5('0x5'))['db'];var utils=require(_0xc4f5('0x6'));var logger=require(_0xc4f5('0x7'))(_0xc4f5('0x8'));var config=require(_0xc4f5('0x9'));var jayson=require(_0xc4f5('0xa'));var client=jayson[_0xc4f5('0xb')][_0xc4f5('0xc')]({'port':0x232a});config['redis']=_[_0xc4f5('0xd')](config['redis'],{'host':_0xc4f5('0xe'),'port':0x18eb});var socket=require(_0xc4f5('0xf'))(new Redis(config[_0xc4f5('0x10')]));require(_0xc4f5('0x11'))[_0xc4f5('0x12')](socket);function respondWithRpcPromise(_0x104c26,_0x1815cc,_0x43a802){return new BPromise(function(_0x4790aa,_0x35fff1){return client[_0xc4f5('0x13')](_0x104c26,_0x43a802)[_0xc4f5('0x14')](function(_0x58ae26){logger[_0xc4f5('0x15')](_0xc4f5('0x16'),_0x1815cc,'request\x20sent');logger[_0xc4f5('0x17')](_0xc4f5('0x18'),_0x1815cc,_0xc4f5('0x19'),JSON[_0xc4f5('0x1a')](_0x58ae26));if(_0x58ae26[_0xc4f5('0x1b')]){if(_0x58ae26[_0xc4f5('0x1b')][_0xc4f5('0x1c')]===0x1f4){logger['error'](_0xc4f5('0x16'),_0x1815cc,_0x58ae26['error']['message']);return _0x35fff1(_0x58ae26[_0xc4f5('0x1b')]['message']);}logger['error'](_0xc4f5('0x16'),_0x1815cc,_0x58ae26[_0xc4f5('0x1b')][_0xc4f5('0x1d')]);return _0x4790aa(_0x58ae26[_0xc4f5('0x1b')][_0xc4f5('0x1d')]);}else{logger[_0xc4f5('0x15')](_0xc4f5('0x16'),_0x1815cc,_0xc4f5('0x19'));_0x4790aa(_0x58ae26['result'][_0xc4f5('0x1d')]);}})['catch'](function(_0x50fcc1){logger[_0xc4f5('0x1b')](_0xc4f5('0x16'),_0x1815cc,_0x50fcc1);_0x35fff1(_0x50fcc1);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 06776a2..8f3b148 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 _0x728a=['removeListener','register','length','voicePrefix:','./voicePrefix.events','update'];(function(_0x49d224,_0x4a3b6c){var _0x45074f=function(_0x44b11a){while(--_0x44b11a){_0x49d224['push'](_0x49d224['shift']());}};_0x45074f(++_0x4a3b6c);}(_0x728a,0x16c));var _0xa728=function(_0x1c2bd6,_0x127ba5){_0x1c2bd6=_0x1c2bd6-0x0;var _0x272584=_0x728a[_0x1c2bd6];return _0x272584;};'use strict';var VoicePrefixEvents=require(_0xa728('0x0'));var events=['save','remove',_0xa728('0x1')];function createListener(_0x295c9c,_0x4c29c7){return function(_0x39ff5f){_0x4c29c7['emit'](_0x295c9c,_0x39ff5f);};}function removeListener(_0x153e49,_0x1aa03c){return function(){VoicePrefixEvents[_0xa728('0x2')](_0x153e49,_0x1aa03c);};}exports[_0xa728('0x3')]=function(_0x45a9f0){for(var _0x599ec6=0x0,_0x33cb02=events[_0xa728('0x4')];_0x599ec6<_0x33cb02;_0x599ec6++){var _0x29fda6=events[_0x599ec6];var _0x140d56=createListener(_0xa728('0x5')+_0x29fda6,_0x45a9f0);VoicePrefixEvents['on'](_0x29fda6,_0x140d56);}}; \ No newline at end of file +var _0x36e9=['length','voicePrefix:','./voicePrefix.events','remove','update','removeListener'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x36e9,0x86));var _0x936e=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x36e9[_0x2f1762];return _0x8ab21;};'use strict';var VoicePrefixEvents=require(_0x936e('0x0'));var events=['save',_0x936e('0x1'),_0x936e('0x2')];function createListener(_0x4bc59d,_0x444ff5){return function(_0x5cce65){_0x444ff5['emit'](_0x4bc59d,_0x5cce65);};}function removeListener(_0x40113c,_0x418706){return function(){VoicePrefixEvents[_0x936e('0x3')](_0x40113c,_0x418706);};}exports['register']=function(_0x19232f){for(var _0xa462b5=0x0,_0x199cca=events[_0x936e('0x4')];_0xa462b5<_0x199cca;_0xa462b5++){var _0x4c0889=events[_0xa462b5];var _0x155a23=createListener(_0x936e('0x5')+_0x4c0889,_0x19232f);VoicePrefixEvents['on'](_0x4c0889,_0x155a23);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 35c1551..afdd897 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 _0x0567=['/:id','/:id/hopper_black','/:id/teams','getTeams','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','create','clone','post','addAgents','addLists','put','update','delete','removeTeams','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','index'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x0567,0x73));var _0x7056=function(_0x3e97ef,_0x49c8b9){_0x3e97ef=_0x3e97ef-0x0;var _0xbbb032=_0x0567[_0x3e97ef];return _0xbbb032;};'use strict';var multer=require(_0x7056('0x0'));var util=require(_0x7056('0x1'));var path=require(_0x7056('0x2'));var timeout=require(_0x7056('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7056('0x4'));var config=require('../../config/environment');var controller=require(_0x7056('0x5'));router[_0x7056('0x6')]('/',auth[_0x7056('0x7')](),controller[_0x7056('0x8')]);router[_0x7056('0x6')](_0x7056('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x7056('0x6')]('/:id/hoppers',auth[_0x7056('0x7')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth[_0x7056('0x7')](),controller['getHopperHistories']);router[_0x7056('0x6')]('/:id/hopper_finals',auth[_0x7056('0x7')](),controller['getHopperFinals']);router[_0x7056('0x6')](_0x7056('0xa'),auth[_0x7056('0x7')](),controller['getHopperBlacks']);router[_0x7056('0x6')](_0x7056('0xb'),auth[_0x7056('0x7')](),controller[_0x7056('0xc')]);router[_0x7056('0x6')]('/:id/users',auth[_0x7056('0x7')](),controller[_0x7056('0xd')]);router[_0x7056('0x6')](_0x7056('0xe'),auth[_0x7056('0x7')](),controller[_0x7056('0xf')]);router[_0x7056('0x6')](_0x7056('0x10'),auth[_0x7056('0x7')](),controller[_0x7056('0x11')]);router[_0x7056('0x6')](_0x7056('0x12'),auth[_0x7056('0x7')](),controller['getBlackLists']);router['post']('/',auth[_0x7056('0x7')](),controller[_0x7056('0x13')]);router['post']('/:id/clone',auth[_0x7056('0x7')](),controller[_0x7056('0x14')]);router['post'](_0x7056('0xb'),auth['isAuthenticated'](),controller['addTeams']);router[_0x7056('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0x7056('0x16')]);router[_0x7056('0x15')](_0x7056('0x10'),auth[_0x7056('0x7')](),controller[_0x7056('0x17')]);router[_0x7056('0x15')]('/:id/blacklists',auth['isAuthenticated'](),controller['addBlackLists']);router[_0x7056('0x18')]('/:id',auth[_0x7056('0x7')](),controller[_0x7056('0x19')]);router[_0x7056('0x1a')](_0x7056('0x9'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/teams',auth[_0x7056('0x7')](),controller[_0x7056('0x1b')]);router['delete']('/:id/users',auth[_0x7056('0x7')](),controller['removeAgents']);router[_0x7056('0x1a')](_0x7056('0x10'),auth[_0x7056('0x7')](),controller[_0x7056('0x1c')]);router[_0x7056('0x1a')](_0x7056('0x12'),auth[_0x7056('0x7')](),controller[_0x7056('0x1d')]);module[_0x7056('0x1e')]=router; \ No newline at end of file +var _0xb56e=['/:id/teams','addTeams','/:id/users','addAgents','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','/:id','show','/:id/hoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/members','getMembers','/:id/lists','getBlackLists','post','/:id/clone'];(function(_0x303683,_0x4d5216){var _0x57d5d3=function(_0x4f0104){while(--_0x4f0104){_0x303683['push'](_0x303683['shift']());}};_0x57d5d3(++_0x4d5216);}(_0xb56e,0xf2));var _0xeb56=function(_0x2c7a60,_0x378818){_0x2c7a60=_0x2c7a60-0x0;var _0x29813b=_0xb56e[_0x2c7a60];return _0x29813b;};'use strict';var multer=require(_0xeb56('0x0'));var util=require(_0xeb56('0x1'));var path=require(_0xeb56('0x2'));var timeout=require(_0xeb56('0x3'));var express=require(_0xeb56('0x4'));var router=express[_0xeb56('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xeb56('0x6'));var config=require('../../config/environment');var controller=require(_0xeb56('0x7'));router[_0xeb56('0x8')]('/',auth[_0xeb56('0x9')](),controller['index']);router['get'](_0xeb56('0xa'),auth[_0xeb56('0x9')](),controller[_0xeb56('0xb')]);router[_0xeb56('0x8')](_0xeb56('0xc'),auth[_0xeb56('0x9')](),controller['getHoppers']);router[_0xeb56('0x8')](_0xeb56('0xd'),auth['isAuthenticated'](),controller['getHopperHistories']);router['get'](_0xeb56('0xe'),auth[_0xeb56('0x9')](),controller[_0xeb56('0xf')]);router[_0xeb56('0x8')](_0xeb56('0x10'),auth[_0xeb56('0x9')](),controller[_0xeb56('0x11')]);router[_0xeb56('0x8')]('/:id/teams',auth[_0xeb56('0x9')](),controller['getTeams']);router[_0xeb56('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xeb56('0x8')](_0xeb56('0x12'),auth[_0xeb56('0x9')](),controller[_0xeb56('0x13')]);router[_0xeb56('0x8')](_0xeb56('0x14'),auth[_0xeb56('0x9')](),controller['getLists']);router[_0xeb56('0x8')]('/:id/blacklists',auth[_0xeb56('0x9')](),controller[_0xeb56('0x15')]);router[_0xeb56('0x16')]('/',auth[_0xeb56('0x9')](),controller['create']);router[_0xeb56('0x16')](_0xeb56('0x17'),auth[_0xeb56('0x9')](),controller['clone']);router[_0xeb56('0x16')](_0xeb56('0x18'),auth[_0xeb56('0x9')](),controller[_0xeb56('0x19')]);router['post'](_0xeb56('0x1a'),auth[_0xeb56('0x9')](),controller[_0xeb56('0x1b')]);router['post'](_0xeb56('0x14'),auth[_0xeb56('0x9')](),controller[_0xeb56('0x1c')]);router['post'](_0xeb56('0x1d'),auth['isAuthenticated'](),controller[_0xeb56('0x1e')]);router[_0xeb56('0x1f')](_0xeb56('0xa'),auth['isAuthenticated'](),controller[_0xeb56('0x20')]);router[_0xeb56('0x21')](_0xeb56('0xa'),auth[_0xeb56('0x9')](),controller[_0xeb56('0x22')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0xeb56('0x21')]('/:id/users',auth[_0xeb56('0x9')](),controller['removeAgents']);router[_0xeb56('0x21')](_0xeb56('0x14'),auth[_0xeb56('0x9')](),controller[_0xeb56('0x23')]);router['delete'](_0xeb56('0x1d'),auth[_0xeb56('0x9')](),controller[_0xeb56('0x24')]);module[_0xeb56('0x25')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index aa558dc..30b659b 100644 --- a/server/api/voiceQueue/voiceQueue.attributes.js +++ b/server/api/voiceQueue/voiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x11be52,_0x2ef4f4){var _0x5b0bf8=function(_0x3659b6){while(--_0x3659b6){_0x11be52['push'](_0x11be52['shift']());}};_0x5b0bf8(++_0x2ef4f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0xf46bd9,_0x322826){var _0x2763c3=function(_0x564f74){while(--_0x564f74){_0xf46bd9['push'](_0xf46bd9['shift']());}};_0x2763c3(++_0x322826);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index ea155cc..12a9e1b 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 _0xeb43=['catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','clone','omit','updatedAt','includeAll','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','order','VoiceQueueId','CmHopper','CmHopperHistory','pick','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','transaction','addTeams','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','upsert','all','isArray','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','ContactId','ListId','scheduledAt','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','NOW()','createdAt','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','find','type','UserProfileResource','error','stack','name','send','index','VoiceQueue','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','options','count','include','findAll','rows','show','params','keys'];(function(_0x4f1d5b,_0x4bea5b){var _0x1c1ace=function(_0x270156){while(--_0x270156){_0x4f1d5b['push'](_0x4f1d5b['shift']());}};_0x1c1ace(++_0x4bea5b);}(_0xeb43,0x127));var _0x3eb4=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0xeb43[_0x54b062];return _0x255e41;};'use strict';var pdf=require(_0x3eb4('0x0'));var emlformat=require(_0x3eb4('0x1'));var rimraf=require(_0x3eb4('0x2'));var zipdir=require(_0x3eb4('0x3'));var jsonpatch=require(_0x3eb4('0x4'));var rp=require(_0x3eb4('0x5'));var moment=require('moment');var BPromise=require(_0x3eb4('0x6'));var Mustache=require(_0x3eb4('0x7'));var util=require(_0x3eb4('0x8'));var path=require(_0x3eb4('0x9'));var sox=require(_0x3eb4('0xa'));var csv=require(_0x3eb4('0xb'));var ejs=require(_0x3eb4('0xc'));var fs=require('fs');var _=require(_0x3eb4('0xd'));var squel=require(_0x3eb4('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3eb4('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3eb4('0x10'));var Papa=require(_0x3eb4('0x11'));var Redis=require(_0x3eb4('0x12'));var authService=require(_0x3eb4('0x13'));var qs=require(_0x3eb4('0x14'));var as=require(_0x3eb4('0x15'));var hardwareService=require(_0x3eb4('0x16'));var logger=require(_0x3eb4('0x17'))(_0x3eb4('0x18'));var utils=require(_0x3eb4('0x19'));var config=require(_0x3eb4('0x1a'));var db=require(_0x3eb4('0x1b'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x3eb4('0x1c'),'port':0x18eb});var socket=require(_0x3eb4('0x1d'))(new Redis(config[_0x3eb4('0x1e')]));require(_0x3eb4('0x1f'))[_0x3eb4('0x20')](socket);function respondWithStatusCode(_0x5bec77,_0xa98679){_0xa98679=_0xa98679||0xcc;return function(_0x397a40){if(_0x397a40){return _0x5bec77[_0x3eb4('0x21')](_0xa98679);}return _0x5bec77[_0x3eb4('0x22')](_0xa98679)[_0x3eb4('0x23')]();};}function respondWithResult(_0x5ec5f2,_0x20196b){_0x20196b=_0x20196b||0xc8;return function(_0x1db8a5){if(_0x1db8a5){return _0x5ec5f2[_0x3eb4('0x22')](_0x20196b)[_0x3eb4('0x24')](_0x1db8a5);}};}function respondWithFilteredResult(_0x97a041,_0x358a0d){return function(_0x370adc){if(_0x370adc){var _0x15e253=_0x370adc['count'],_0x42108a=_0x358a0d[_0x3eb4('0x25')],_0x43429c=_0x358a0d[_0x3eb4('0x25')]+_0x358a0d['limit'],_0x10facc;if(_0x43429c>=_0x15e253){_0x43429c=_0x15e253;_0x10facc=0xc8;}else{_0x10facc=0xce;}_0x97a041[_0x3eb4('0x22')](_0x10facc);return _0x97a041[_0x3eb4('0x26')](_0x3eb4('0x27'),_0x42108a+'-'+_0x43429c+'/'+_0x15e253)[_0x3eb4('0x24')](_0x370adc);}return null;};}function patchUpdates(_0x18d49e){return function(_0x362905){try{jsonpatch[_0x3eb4('0x28')](_0x362905,_0x18d49e,!![]);}catch(_0x3a8465){return BPromise[_0x3eb4('0x29')](_0x3a8465);}return _0x362905[_0x3eb4('0x2a')]();};}function saveUpdates(_0x43aeb1,_0x209920){return function(_0x50fa2a){if(_0x50fa2a){return _0x50fa2a[_0x3eb4('0x2b')](_0x43aeb1)[_0x3eb4('0x2c')](function(_0x5b90be){return _0x5b90be;});}return null;};}function removeEntity(_0x34fcc0,_0x3db4aa){return function(_0x377ea7){if(_0x377ea7){return _0x377ea7[_0x3eb4('0x2d')]()[_0x3eb4('0x2c')](function(){var _0x53a27a=_0x377ea7[_0x3eb4('0x2e')]({'plain':!![]});var _0x53f266=[{'name':_0x3eb4('0x2f'),'value':_0x3eb4('0x30'),'ignore':![]},{'name':_0x3eb4('0x31'),'value':_0x3eb4('0x32'),'ignore':![]}];var _0x3f86ca=_(_0x53f266)[_0x3eb4('0x33')](_0x3eb4('0x34'))[_0x3eb4('0x35')]('value')[_0x3eb4('0x36')]();if(_[_0x3eb4('0x37')](_0x3f86ca,_0x53a27a['type'])){return;}var _0x4aab7f=_[_0x3eb4('0x38')](_0x53f266,['value',_0x53a27a[_0x3eb4('0x39')]])['name'];return db[_0x3eb4('0x3a')][_0x3eb4('0x2d')]({'where':{'type':_0x4aab7f,'resourceId':_0x53a27a['id']}})[_0x3eb4('0x2c')](function(){return _0x377ea7;});})[_0x3eb4('0x2c')](function(){_0x34fcc0[_0x3eb4('0x22')](0xcc)[_0x3eb4('0x23')]();});}};}function handleEntityNotFound(_0x31d33f,_0x417871){return function(_0x5ba89e){if(!_0x5ba89e){_0x31d33f[_0x3eb4('0x21')](0x194);}return _0x5ba89e;};}function handleError(_0x2993fd,_0x36ffda){_0x36ffda=_0x36ffda||0x1f4;return function(_0x31854f){logger[_0x3eb4('0x3b')](_0x31854f[_0x3eb4('0x3c')]);if(_0x31854f[_0x3eb4('0x3d')]){delete _0x31854f['name'];}_0x2993fd[_0x3eb4('0x22')](_0x36ffda)[_0x3eb4('0x3e')](_0x31854f);};}exports[_0x3eb4('0x3f')]=function(_0x96e3f6,_0x4c7786){var _0x5622d4={},_0x5dbf03={},_0x2fef8a={'count':0x0,'rows':[]};var _0x258117=_[_0x3eb4('0x35')](db[_0x3eb4('0x40')][_0x3eb4('0x41')],function(_0x3c6522){return{'name':_0x3c6522[_0x3eb4('0x42')],'type':_0x3c6522[_0x3eb4('0x39')]['key']};});_0x5dbf03[_0x3eb4('0x43')]=_['map'](_0x258117,_0x3eb4('0x3d'));_0x5dbf03[_0x3eb4('0x44')]=_['keys'](_0x96e3f6[_0x3eb4('0x44')]);_0x5dbf03[_0x3eb4('0x45')]=_[_0x3eb4('0x46')](_0x5dbf03[_0x3eb4('0x43')],_0x5dbf03[_0x3eb4('0x44')]);_0x5622d4['attributes']=_['intersection'](_0x5dbf03[_0x3eb4('0x43')],qs[_0x3eb4('0x47')](_0x96e3f6[_0x3eb4('0x44')][_0x3eb4('0x47')]));_0x5622d4[_0x3eb4('0x48')]=_0x5622d4[_0x3eb4('0x48')][_0x3eb4('0x49')]?_0x5622d4[_0x3eb4('0x48')]:_0x5dbf03[_0x3eb4('0x43')];if(!_0x96e3f6[_0x3eb4('0x44')][_0x3eb4('0x4a')](_0x3eb4('0x4b'))){_0x5622d4[_0x3eb4('0x4c')]=qs[_0x3eb4('0x4c')](_0x96e3f6[_0x3eb4('0x44')][_0x3eb4('0x4c')]);_0x5622d4[_0x3eb4('0x25')]=qs[_0x3eb4('0x25')](_0x96e3f6[_0x3eb4('0x44')]['offset']);}_0x5622d4['order']=qs[_0x3eb4('0x4d')](_0x96e3f6['query'][_0x3eb4('0x4d')]);_0x5622d4[_0x3eb4('0x4e')]=qs[_0x3eb4('0x45')](_['pick'](_0x96e3f6['query'],_0x5dbf03[_0x3eb4('0x45')]),_0x258117);if(_0x96e3f6['query'][_0x3eb4('0x33')]){_0x5622d4[_0x3eb4('0x4e')]=_[_0x3eb4('0x4f')](_0x5622d4[_0x3eb4('0x4e')],{'$or':_['map'](_0x258117,function(_0x271d52){if(_0x271d52['type']!==_0x3eb4('0x50')){var _0x5acf83={};_0x5acf83[_0x271d52[_0x3eb4('0x3d')]]={'$like':'%'+_0x96e3f6['query'][_0x3eb4('0x33')]+'%'};return _0x5acf83;}})});}_0x5622d4=_[_0x3eb4('0x4f')]({},_0x5622d4,_0x96e3f6[_0x3eb4('0x51')]);var _0x52ed8d={'where':_0x5622d4[_0x3eb4('0x4e')]};return db['VoiceQueue'][_0x3eb4('0x52')](_0x52ed8d)['then'](function(_0x35f503){_0x2fef8a[_0x3eb4('0x52')]=_0x35f503;if(_0x96e3f6[_0x3eb4('0x44')]['includeAll']){_0x5622d4[_0x3eb4('0x53')]=[{'all':!![]}];}return db[_0x3eb4('0x40')][_0x3eb4('0x54')](_0x5622d4);})[_0x3eb4('0x2c')](function(_0x68ad55){_0x2fef8a[_0x3eb4('0x55')]=_0x68ad55;return _0x2fef8a;})[_0x3eb4('0x2c')](respondWithFilteredResult(_0x4c7786,_0x5622d4))['catch'](handleError(_0x4c7786,null));};exports[_0x3eb4('0x56')]=function(_0x3c6cc7,_0xb1f019){var _0x1a4231={'raw':![],'where':{'id':_0x3c6cc7[_0x3eb4('0x57')]['id']}},_0x4b69ab={};_0x4b69ab['model']=_[_0x3eb4('0x58')](db[_0x3eb4('0x40')][_0x3eb4('0x41')]);_0x4b69ab[_0x3eb4('0x44')]=_['keys'](_0x3c6cc7[_0x3eb4('0x44')]);_0x4b69ab['filters']=_[_0x3eb4('0x46')](_0x4b69ab['model'],_0x4b69ab[_0x3eb4('0x44')]);_0x1a4231['attributes']=_[_0x3eb4('0x46')](_0x4b69ab[_0x3eb4('0x43')],qs['fields'](_0x3c6cc7[_0x3eb4('0x44')]['fields']));_0x1a4231['attributes']=_0x1a4231[_0x3eb4('0x48')]['length']?_0x1a4231[_0x3eb4('0x48')]:_0x4b69ab[_0x3eb4('0x43')];if(_0x3c6cc7[_0x3eb4('0x44')]['includeAll']){_0x1a4231[_0x3eb4('0x53')]=[{'all':!![]}];}_0x1a4231=_[_0x3eb4('0x4f')]({},_0x1a4231,_0x3c6cc7[_0x3eb4('0x51')]);return db[_0x3eb4('0x40')][_0x3eb4('0x38')](_0x1a4231)[_0x3eb4('0x2c')](handleEntityNotFound(_0xb1f019,null))['then'](respondWithResult(_0xb1f019,null))[_0x3eb4('0x59')](handleError(_0xb1f019,null));};exports[_0x3eb4('0x5a')]=function(_0x95c81b,_0x3f4667){return db[_0x3eb4('0x40')][_0x3eb4('0x5a')](_0x95c81b[_0x3eb4('0x5b')],{})['then'](function(_0xc5451c){var _0x54716c=_0x95c81b[_0x3eb4('0x5c')][_0x3eb4('0x2e')]({'plain':!![]});if(!_0x54716c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54716c['role']==='user'){var _0x5af29b=_0xc5451c[_0x3eb4('0x2e')]({'plain':!![]});var _0x306741=[{'name':_0x3eb4('0x2f'),'value':_0x3eb4('0x30')},{'name':_0x3eb4('0x31'),'value':'outbound'}];var _0x2013df=_['find'](_0x306741,['value',_0x5af29b[_0x3eb4('0x39')]])[_0x3eb4('0x3d')];return db[_0x3eb4('0x5d')][_0x3eb4('0x38')]({'where':{'name':_0x2013df,'userProfileId':_0x54716c[_0x3eb4('0x5e')]},'raw':!![]})['then'](function(_0x532144){if(_0x532144&&_0x532144[_0x3eb4('0x5f')]===0x0){return db[_0x3eb4('0x3a')][_0x3eb4('0x5a')]({'name':_0x5af29b[_0x3eb4('0x3d')],'resourceId':_0x5af29b['id'],'type':_0x532144[_0x3eb4('0x3d')],'sectionId':_0x532144['id']},{})[_0x3eb4('0x2c')](function(){return _0xc5451c;});}else{return _0xc5451c;}})['catch'](function(_0x542ad9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x542ad9);throw _0x542ad9;});}return _0xc5451c;})[_0x3eb4('0x2c')](respondWithResult(_0x3f4667,0xc9))[_0x3eb4('0x59')](handleError(_0x3f4667,null));};exports[_0x3eb4('0x60')]=function(_0x250a6a,_0x17d503){var _0x5b752c={'where':{'id':_0x250a6a[_0x3eb4('0x57')]['id']}},_0x9e27e6={};_0x9e27e6[_0x3eb4('0x43')]=_[_0x3eb4('0x58')](db[_0x3eb4('0x40')][_0x3eb4('0x41')]);_0x5b752c[_0x3eb4('0x48')]=_[_0x3eb4('0x46')](_0x9e27e6[_0x3eb4('0x43')],qs[_0x3eb4('0x47')](_0x250a6a[_0x3eb4('0x44')][_0x3eb4('0x47')]));_0x5b752c[_0x3eb4('0x48')]=_0x5b752c[_0x3eb4('0x48')][_0x3eb4('0x49')]?_0x5b752c['attributes']:_0x9e27e6['model'];if(_0x250a6a[_0x3eb4('0x44')]['includeAll']){_0x5b752c[_0x3eb4('0x53')]=[{'all':!![]}];}_0x5b752c=_[_0x3eb4('0x4f')]({},_0x5b752c,_0x250a6a[_0x3eb4('0x51')]);return db['VoiceQueue']['find'](_0x5b752c)['then'](handleEntityNotFound(_0x17d503,null))[_0x3eb4('0x2c')](function(_0x111ac4){if(_0x111ac4){var _0xcf0b36=_0x111ac4['get']({'plain':!![]});_0xcf0b36=qs[_0x3eb4('0x61')](_0xcf0b36,['id','createdAt',_0x3eb4('0x62')]);_0x250a6a[_0x3eb4('0x5b')]=_['omit'](_0x250a6a[_0x3eb4('0x5b')],['id','createdAt',_0x3eb4('0x62')]);return db['VoiceQueue'][_0x3eb4('0x5a')](_['merge'](_0xcf0b36,_0x250a6a[_0x3eb4('0x5b')]),{'include':_0x250a6a['query'][_0x3eb4('0x63')]?[{'all':!![]}]:undefined})['then'](function(_0xb9baab){var _0x16c50c=_0x250a6a[_0x3eb4('0x5c')][_0x3eb4('0x2e')]({'plain':!![]});if(!_0x16c50c)throw new Error(_0x3eb4('0x64'));if(_0x16c50c[_0x3eb4('0x65')]==='user'){var _0x10861d=_0xb9baab[_0x3eb4('0x2e')]({'plain':!![]});var _0x35bb88=[{'name':'VoiceQueues','value':_0x3eb4('0x30')},{'name':_0x3eb4('0x31'),'value':_0x3eb4('0x32')}];var _0x4810e8=_[_0x3eb4('0x38')](_0x35bb88,[_0x3eb4('0x36'),_0x10861d[_0x3eb4('0x39')]])['name'];return db[_0x3eb4('0x5d')][_0x3eb4('0x38')]({'where':{'name':_0x4810e8,'userProfileId':_0x16c50c[_0x3eb4('0x5e')]},'raw':!![]})[_0x3eb4('0x2c')](function(_0x26d5f4){if(_0x26d5f4&&_0x26d5f4[_0x3eb4('0x5f')]===0x0){return db[_0x3eb4('0x3a')][_0x3eb4('0x5a')]({'name':_0x10861d['name'],'resourceId':_0x10861d['id'],'type':_0x26d5f4[_0x3eb4('0x3d')],'sectionId':_0x26d5f4['id']},{})[_0x3eb4('0x2c')](function(){return _0xb9baab;});}else{return _0xb9baab;}})[_0x3eb4('0x59')](function(_0x18f6f5){logger['error'](_0x3eb4('0x66'),_0x18f6f5);throw _0x18f6f5;});}return _0xb9baab;});}})[_0x3eb4('0x2c')](respondWithResult(_0x17d503,0xc9))[_0x3eb4('0x59')](handleError(_0x17d503,null));};exports['update']=function(_0x174188,_0x29d388){if(_0x174188['body']['id']){delete _0x174188[_0x3eb4('0x5b')]['id'];}return db[_0x3eb4('0x40')][_0x3eb4('0x38')]({'where':{'id':_0x174188[_0x3eb4('0x57')]['id']}})[_0x3eb4('0x2c')](handleEntityNotFound(_0x29d388,null))[_0x3eb4('0x2c')](saveUpdates(_0x174188['body'],null))['then'](respondWithResult(_0x29d388,null))[_0x3eb4('0x59')](handleError(_0x29d388,null));};exports[_0x3eb4('0x2d')]=function(_0xf05c9e,_0x20640f){return db[_0x3eb4('0x40')]['find']({'where':{'id':_0xf05c9e[_0x3eb4('0x57')]['id']}})['then'](handleEntityNotFound(_0x20640f,null))[_0x3eb4('0x2c')](removeEntity(_0x20640f,null))[_0x3eb4('0x59')](handleError(_0x20640f,null));};exports[_0x3eb4('0x67')]=function(_0x39fc74,_0x495ece,_0x289bb5){var _0x92edad={'raw':![],'where':{}};var _0x321025={};var _0x2fc654={'count':0x0,'rows':[]};return db[_0x3eb4('0x40')][_0x3eb4('0x68')]({'where':{'id':_0x39fc74[_0x3eb4('0x57')]['id']}})[_0x3eb4('0x2c')](handleEntityNotFound(_0x495ece,null))[_0x3eb4('0x2c')](function(_0x258984){if(_0x258984){_0x321025[_0x3eb4('0x43')]=_[_0x3eb4('0x58')](db['CmHopper'][_0x3eb4('0x41')]);_0x321025[_0x3eb4('0x44')]=_['keys'](_0x39fc74[_0x3eb4('0x44')]);_0x321025[_0x3eb4('0x45')]=_[_0x3eb4('0x46')](_0x321025[_0x3eb4('0x43')],_0x321025['query']);_0x92edad['attributes']=_['intersection'](_0x321025['model'],qs[_0x3eb4('0x47')](_0x39fc74[_0x3eb4('0x44')]['fields']));_0x92edad[_0x3eb4('0x48')]=_0x92edad['attributes'][_0x3eb4('0x49')]?_0x92edad['attributes']:_0x321025[_0x3eb4('0x43')];if(!_0x39fc74[_0x3eb4('0x44')][_0x3eb4('0x4a')](_0x3eb4('0x4b'))){_0x92edad[_0x3eb4('0x4c')]=qs[_0x3eb4('0x4c')](_0x39fc74[_0x3eb4('0x44')][_0x3eb4('0x4c')]);_0x92edad[_0x3eb4('0x25')]=qs[_0x3eb4('0x25')](_0x39fc74[_0x3eb4('0x44')]['offset']);}_0x92edad[_0x3eb4('0x69')]=qs[_0x3eb4('0x4d')](_0x39fc74['query']['sort']);_0x92edad['where']=qs['filters'](_['pick'](_0x39fc74['query'],_0x321025[_0x3eb4('0x45')]));_0x92edad[_0x3eb4('0x4e')][_0x3eb4('0x6a')]=_0x258984['id'];if(_0x39fc74['query'][_0x3eb4('0x33')]){_0x92edad['where']=_[_0x3eb4('0x4f')](_0x92edad[_0x3eb4('0x4e')],{'$or':_[_0x3eb4('0x35')](_0x92edad[_0x3eb4('0x48')],function(_0x44d65d){var _0x4bf99f={};_0x4bf99f[_0x44d65d]={'$like':'%'+_0x39fc74[_0x3eb4('0x44')]['filter']+'%'};return _0x4bf99f;})});}_0x92edad=_['merge']({},_0x92edad,_0x39fc74[_0x3eb4('0x51')]);return db['CmHopper'][_0x3eb4('0x52')]({'where':_0x92edad[_0x3eb4('0x4e')]})[_0x3eb4('0x2c')](function(_0x4a17ef){_0x2fc654[_0x3eb4('0x52')]=_0x4a17ef;if(_0x39fc74[_0x3eb4('0x44')]['includeAll']){_0x92edad['include']=[{'all':!![]}];}return db[_0x3eb4('0x6b')][_0x3eb4('0x54')](_0x92edad);})[_0x3eb4('0x2c')](function(_0x28656b){_0x2fc654['rows']=_0x28656b;return _0x2fc654;});}})[_0x3eb4('0x2c')](respondWithFilteredResult(_0x495ece,_0x92edad))[_0x3eb4('0x59')](handleError(_0x495ece,null));};exports['getHopperHistories']=function(_0x19796d,_0x13c0f4,_0x421675){var _0xf8ca2b={'raw':!![],'where':{}};var _0xe4db77={};var _0x5bf5b0={'count':0x0,'rows':[]};return db[_0x3eb4('0x40')][_0x3eb4('0x68')]({'where':{'id':_0x19796d['params']['id']}})[_0x3eb4('0x2c')](handleEntityNotFound(_0x13c0f4,null))[_0x3eb4('0x2c')](function(_0xb1ecbc){if(_0xb1ecbc){_0xe4db77['model']=_['keys'](db[_0x3eb4('0x6c')][_0x3eb4('0x41')]);_0xe4db77[_0x3eb4('0x44')]=_['keys'](_0x19796d['query']);_0xe4db77[_0x3eb4('0x45')]=_['intersection'](_0xe4db77[_0x3eb4('0x43')],_0xe4db77[_0x3eb4('0x44')]);_0xf8ca2b[_0x3eb4('0x48')]=_[_0x3eb4('0x46')](_0xe4db77[_0x3eb4('0x43')],qs[_0x3eb4('0x47')](_0x19796d[_0x3eb4('0x44')][_0x3eb4('0x47')]));_0xf8ca2b[_0x3eb4('0x48')]=_0xf8ca2b[_0x3eb4('0x48')][_0x3eb4('0x49')]?_0xf8ca2b['attributes']:_0xe4db77[_0x3eb4('0x43')];if(!_0x19796d['query']['hasOwnProperty'](_0x3eb4('0x4b'))){_0xf8ca2b[_0x3eb4('0x4c')]=qs[_0x3eb4('0x4c')](_0x19796d['query'][_0x3eb4('0x4c')]);_0xf8ca2b[_0x3eb4('0x25')]=qs['offset'](_0x19796d[_0x3eb4('0x44')][_0x3eb4('0x25')]);}_0xf8ca2b[_0x3eb4('0x69')]=qs['sort'](_0x19796d['query']['sort']);_0xf8ca2b[_0x3eb4('0x4e')]=qs[_0x3eb4('0x45')](_[_0x3eb4('0x6d')](_0x19796d[_0x3eb4('0x44')],_0xe4db77[_0x3eb4('0x45')]));_0xf8ca2b['where'][_0x3eb4('0x6a')]=_0xb1ecbc['id'];if(_0x19796d[_0x3eb4('0x44')][_0x3eb4('0x33')]){_0xf8ca2b['where']=_[_0x3eb4('0x4f')](_0xf8ca2b[_0x3eb4('0x4e')],{'$or':_[_0x3eb4('0x35')](_0xf8ca2b[_0x3eb4('0x48')],function(_0x1ea717){var _0x5c3bbd={};_0x5c3bbd[_0x1ea717]={'$like':'%'+_0x19796d[_0x3eb4('0x44')][_0x3eb4('0x33')]+'%'};return _0x5c3bbd;})});}_0xf8ca2b=_['merge']({},_0xf8ca2b,_0x19796d['options']);return db[_0x3eb4('0x6c')][_0x3eb4('0x52')]({'where':_0xf8ca2b['where']})[_0x3eb4('0x2c')](function(_0x9be919){_0x5bf5b0['count']=_0x9be919;if(_0x19796d[_0x3eb4('0x44')][_0x3eb4('0x63')]){_0xf8ca2b[_0x3eb4('0x53')]=[{'all':!![]}];}return db[_0x3eb4('0x6c')][_0x3eb4('0x54')](_0xf8ca2b);})['then'](function(_0x2d509b){_0x5bf5b0[_0x3eb4('0x55')]=_0x2d509b;return _0x5bf5b0;});}})[_0x3eb4('0x2c')](respondWithFilteredResult(_0x13c0f4,_0xf8ca2b))[_0x3eb4('0x59')](handleError(_0x13c0f4,null));};exports[_0x3eb4('0x6e')]=function(_0x4f296f,_0x316f02,_0x1a70c8){var _0x4736a9={'raw':!![],'where':{}};var _0x17962e={};var _0x45ce35={'count':0x0,'rows':[]};return db[_0x3eb4('0x40')][_0x3eb4('0x68')]({'where':{'id':_0x4f296f['params']['id']}})[_0x3eb4('0x2c')](handleEntityNotFound(_0x316f02,null))[_0x3eb4('0x2c')](function(_0x294eae){if(_0x294eae){_0x17962e[_0x3eb4('0x43')]=_['keys'](db[_0x3eb4('0x6f')]['rawAttributes']);_0x17962e['query']=_[_0x3eb4('0x58')](_0x4f296f[_0x3eb4('0x44')]);_0x17962e[_0x3eb4('0x45')]=_[_0x3eb4('0x46')](_0x17962e[_0x3eb4('0x43')],_0x17962e[_0x3eb4('0x44')]);_0x4736a9['attributes']=_[_0x3eb4('0x46')](_0x17962e[_0x3eb4('0x43')],qs[_0x3eb4('0x47')](_0x4f296f[_0x3eb4('0x44')][_0x3eb4('0x47')]));_0x4736a9[_0x3eb4('0x48')]=_0x4736a9[_0x3eb4('0x48')][_0x3eb4('0x49')]?_0x4736a9[_0x3eb4('0x48')]:_0x17962e[_0x3eb4('0x43')];if(!_0x4f296f[_0x3eb4('0x44')][_0x3eb4('0x4a')](_0x3eb4('0x4b'))){_0x4736a9[_0x3eb4('0x4c')]=qs['limit'](_0x4f296f[_0x3eb4('0x44')][_0x3eb4('0x4c')]);_0x4736a9[_0x3eb4('0x25')]=qs[_0x3eb4('0x25')](_0x4f296f[_0x3eb4('0x44')][_0x3eb4('0x25')]);}_0x4736a9[_0x3eb4('0x69')]=qs[_0x3eb4('0x4d')](_0x4f296f['query'][_0x3eb4('0x4d')]);_0x4736a9[_0x3eb4('0x4e')]=qs[_0x3eb4('0x45')](_['pick'](_0x4f296f[_0x3eb4('0x44')],_0x17962e[_0x3eb4('0x45')]));_0x4736a9[_0x3eb4('0x4e')][_0x3eb4('0x6a')]=_0x294eae['id'];if(_0x4f296f[_0x3eb4('0x44')]['filter']){_0x4736a9[_0x3eb4('0x4e')]=_[_0x3eb4('0x4f')](_0x4736a9[_0x3eb4('0x4e')],{'$or':_[_0x3eb4('0x35')](_0x4736a9[_0x3eb4('0x48')],function(_0x1eddbb){var _0x495338={};_0x495338[_0x1eddbb]={'$like':'%'+_0x4f296f[_0x3eb4('0x44')]['filter']+'%'};return _0x495338;})});}_0x4736a9=_[_0x3eb4('0x4f')]({},_0x4736a9,_0x4f296f[_0x3eb4('0x51')]);return db[_0x3eb4('0x6f')][_0x3eb4('0x52')]({'where':_0x4736a9[_0x3eb4('0x4e')]})[_0x3eb4('0x2c')](function(_0x571472){_0x45ce35[_0x3eb4('0x52')]=_0x571472;if(_0x4f296f['query'][_0x3eb4('0x63')]){_0x4736a9[_0x3eb4('0x53')]=[{'all':!![]}];}return db[_0x3eb4('0x6f')][_0x3eb4('0x54')](_0x4736a9);})[_0x3eb4('0x2c')](function(_0x1ce8eb){_0x45ce35[_0x3eb4('0x55')]=_0x1ce8eb;return _0x45ce35;});}})[_0x3eb4('0x2c')](respondWithFilteredResult(_0x316f02,_0x4736a9))[_0x3eb4('0x59')](handleError(_0x316f02,null));};exports['getHopperBlacks']=function(_0x225d2d,_0x47af9c,_0x526d6d){var _0x3a2653={'raw':!![],'where':{}};var _0x4b695f={};var _0x24b276={'count':0x0,'rows':[]};return db[_0x3eb4('0x40')][_0x3eb4('0x68')]({'where':{'id':_0x225d2d[_0x3eb4('0x57')]['id']}})[_0x3eb4('0x2c')](handleEntityNotFound(_0x47af9c,null))[_0x3eb4('0x2c')](function(_0x77b61e){if(_0x77b61e){_0x4b695f[_0x3eb4('0x43')]=_[_0x3eb4('0x58')](db[_0x3eb4('0x70')][_0x3eb4('0x41')]);_0x4b695f[_0x3eb4('0x44')]=_[_0x3eb4('0x58')](_0x225d2d[_0x3eb4('0x44')]);_0x4b695f['filters']=_[_0x3eb4('0x46')](_0x4b695f[_0x3eb4('0x43')],_0x4b695f['query']);_0x3a2653[_0x3eb4('0x48')]=_[_0x3eb4('0x46')](_0x4b695f[_0x3eb4('0x43')],qs['fields'](_0x225d2d[_0x3eb4('0x44')][_0x3eb4('0x47')]));_0x3a2653['attributes']=_0x3a2653[_0x3eb4('0x48')][_0x3eb4('0x49')]?_0x3a2653[_0x3eb4('0x48')]:_0x4b695f[_0x3eb4('0x43')];if(!_0x225d2d[_0x3eb4('0x44')][_0x3eb4('0x4a')](_0x3eb4('0x4b'))){_0x3a2653['limit']=qs[_0x3eb4('0x4c')](_0x225d2d[_0x3eb4('0x44')][_0x3eb4('0x4c')]);_0x3a2653[_0x3eb4('0x25')]=qs[_0x3eb4('0x25')](_0x225d2d['query']['offset']);}_0x3a2653[_0x3eb4('0x69')]=qs['sort'](_0x225d2d[_0x3eb4('0x44')][_0x3eb4('0x4d')]);_0x3a2653[_0x3eb4('0x4e')]=qs[_0x3eb4('0x45')](_[_0x3eb4('0x6d')](_0x225d2d[_0x3eb4('0x44')],_0x4b695f[_0x3eb4('0x45')]));_0x3a2653['where']['VoiceQueueId']=_0x77b61e['id'];if(_0x225d2d[_0x3eb4('0x44')][_0x3eb4('0x33')]){_0x3a2653[_0x3eb4('0x4e')]=_[_0x3eb4('0x4f')](_0x3a2653[_0x3eb4('0x4e')],{'$or':_[_0x3eb4('0x35')](_0x3a2653[_0x3eb4('0x48')],function(_0x3ef2e6){var _0x4719e0={};_0x4719e0[_0x3ef2e6]={'$like':'%'+_0x225d2d[_0x3eb4('0x44')][_0x3eb4('0x33')]+'%'};return _0x4719e0;})});}_0x3a2653=_['merge']({},_0x3a2653,_0x225d2d[_0x3eb4('0x51')]);return db[_0x3eb4('0x70')][_0x3eb4('0x52')]({'where':_0x3a2653[_0x3eb4('0x4e')]})['then'](function(_0x439540){_0x24b276[_0x3eb4('0x52')]=_0x439540;if(_0x225d2d[_0x3eb4('0x44')][_0x3eb4('0x63')]){_0x3a2653['include']=[{'all':!![]}];}return db[_0x3eb4('0x70')][_0x3eb4('0x54')](_0x3a2653);})[_0x3eb4('0x2c')](function(_0x2d4c02){_0x24b276['rows']=_0x2d4c02;return _0x24b276;});}})[_0x3eb4('0x2c')](respondWithFilteredResult(_0x47af9c,_0x3a2653))[_0x3eb4('0x59')](handleError(_0x47af9c,null));};exports[_0x3eb4('0x71')]=function(_0x2d86ac,_0x4a64f2,_0x34d342){var _0x28ff4e={};var _0x1c868c={};var _0x59e252;var _0x295611;return db['VoiceQueue'][_0x3eb4('0x68')]({'where':{'id':_0x2d86ac[_0x3eb4('0x57')]['id']}})[_0x3eb4('0x2c')](handleEntityNotFound(_0x4a64f2,null))[_0x3eb4('0x2c')](function(_0x4c099b){if(_0x4c099b){_0x59e252=_0x4c099b;_0x1c868c[_0x3eb4('0x43')]=_[_0x3eb4('0x58')](db[_0x3eb4('0x72')][_0x3eb4('0x41')]);_0x1c868c[_0x3eb4('0x44')]=_['keys'](_0x2d86ac[_0x3eb4('0x44')]);_0x1c868c[_0x3eb4('0x45')]=_[_0x3eb4('0x46')](_0x1c868c[_0x3eb4('0x43')],_0x1c868c[_0x3eb4('0x44')]);_0x28ff4e['attributes']=_[_0x3eb4('0x46')](_0x1c868c[_0x3eb4('0x43')],qs[_0x3eb4('0x47')](_0x2d86ac['query'][_0x3eb4('0x47')]));_0x28ff4e[_0x3eb4('0x48')]=_0x28ff4e[_0x3eb4('0x48')][_0x3eb4('0x49')]?_0x28ff4e[_0x3eb4('0x48')]:_0x1c868c['model'];_0x28ff4e[_0x3eb4('0x69')]=qs[_0x3eb4('0x4d')](_0x2d86ac[_0x3eb4('0x44')]['sort']);_0x28ff4e[_0x3eb4('0x4e')]=qs[_0x3eb4('0x45')](_[_0x3eb4('0x6d')](_0x2d86ac[_0x3eb4('0x44')],_0x1c868c[_0x3eb4('0x45')]));if(_0x2d86ac[_0x3eb4('0x44')][_0x3eb4('0x33')]){_0x28ff4e[_0x3eb4('0x4e')]=_[_0x3eb4('0x4f')](_0x28ff4e[_0x3eb4('0x4e')],{'$or':_[_0x3eb4('0x35')](_0x28ff4e[_0x3eb4('0x48')],function(_0x39690d){var _0x293b09={};_0x293b09[_0x39690d]={'$like':'%'+_0x2d86ac['query'][_0x3eb4('0x33')]+'%'};return _0x293b09;})});}_0x28ff4e=_['merge']({},_0x28ff4e,_0x2d86ac[_0x3eb4('0x51')]);return _0x59e252[_0x3eb4('0x71')](_0x28ff4e);}})[_0x3eb4('0x2c')](function(_0x93adf9){if(_0x93adf9){_0x295611=_0x93adf9[_0x3eb4('0x49')];if(!_0x2d86ac['query'][_0x3eb4('0x4a')]('nolimit')){_0x28ff4e[_0x3eb4('0x4c')]=qs[_0x3eb4('0x4c')](_0x2d86ac[_0x3eb4('0x44')][_0x3eb4('0x4c')]);_0x28ff4e['offset']=qs[_0x3eb4('0x25')](_0x2d86ac[_0x3eb4('0x44')][_0x3eb4('0x25')]);}return _0x59e252[_0x3eb4('0x71')](_0x28ff4e);}})[_0x3eb4('0x2c')](function(_0x21f8a3){if(_0x21f8a3){return _0x21f8a3?{'count':_0x295611,'rows':_0x21f8a3}:null;}})[_0x3eb4('0x2c')](respondWithResult(_0x4a64f2,null))[_0x3eb4('0x59')](handleError(_0x4a64f2,null));};exports['addTeams']=function(_0x3af02f,_0x5a67db,_0x4040db){var _0x513725=_0x3af02f[_0x3eb4('0x5b')][_0x3eb4('0x73')];var _0x5f2cc9=_[_0x3eb4('0x35')](_0x513725,'id');return db[_0x3eb4('0x72')]['findAll']({'where':{'id':_0x5f2cc9},'attributes':['id'],'include':[{'model':db[_0x3eb4('0x74')],'as':_0x3eb4('0x75'),'attributes':['id',_0x3eb4('0x3d'),_0x3eb4('0x76'),_0x3eb4('0x77'),_0x3eb4('0x78')],'raw':!![]}]})[_0x3eb4('0x2c')](function(_0x290f2f){if(_0x290f2f){var _0x3ec165=_[_0x3eb4('0x79')](_0x290f2f,function(_0x34dd43){var _0x20de66=_0x34dd43[_0x3eb4('0x2e')]({'plain':!![]});_0x20de66[_0x3eb4('0x75')][_0x3eb4('0x7a')](function(_0x266627){_0x266627[_0x3eb4('0x7b')]=_[_0x3eb4('0x38')](_0x513725,{'id':_0x20de66['id']})[_0x3eb4('0x7b')];});return _0x20de66[_0x3eb4('0x75')];});return db[_0x3eb4('0x40')][_0x3eb4('0x38')]({'where':{'id':_0x3af02f[_0x3eb4('0x57')]['id']}})[_0x3eb4('0x2c')](function(_0x11a227){return db['sequelize'][_0x3eb4('0x7c')](function(_0x5e858c){return _0x11a227[_0x3eb4('0x7d')](_0x5f2cc9,{'transaction':_0x5e858c})[_0x3eb4('0x2c')](function(){return BPromise[_0x3eb4('0x7e')](_0x3ec165,function(_0xcfa075){return db[_0x3eb4('0x7f')][_0x3eb4('0x80')]({'where':{'UserId':_0xcfa075['id'],'VoiceQueueId':_0x3af02f[_0x3eb4('0x57')]['id']},'defaults':{'penalty':_0xcfa075[_0x3eb4('0x7b')]},'transaction':_0x5e858c});});})['then'](function(){return BPromise['each'](_[_0x3eb4('0x33')](_0x3ec165,{'online':!![]}),function(_0x453934){return db[_0x3eb4('0x81')]['upsert']({'membername':_0x453934[_0x3eb4('0x3d')],'UserId':_0x453934['id'],'queue_name':_0x11a227[_0x3eb4('0x3d')],'VoiceQueueId':_0x11a227['id'],'interface':_[_0x3eb4('0x82')](_0x453934[_0x3eb4('0x78')])?util[_0x3eb4('0x83')](_0x3eb4('0x84'),_0x453934[_0x3eb4('0x3d')]):_0x453934['interface'],'paused':_0x453934[_0x3eb4('0x77')]||![],'penalty':_0x453934[_0x3eb4('0x7b')]},{'transaction':_0x5e858c});});})['then'](function(){_0x3ec165[_0x3eb4('0x7a')](function(_0x59f9f7){socket[_0x3eb4('0x85')](_0x3eb4('0x86'),{'UserId':_0x59f9f7['id'],'VoiceQueueId':_0x11a227['id']});});});});});}})[_0x3eb4('0x2c')](respondWithStatusCode(_0x5a67db,null))[_0x3eb4('0x59')](handleError(_0x5a67db,null));};exports[_0x3eb4('0x87')]=function(_0x171802,_0x234318,_0x26d3db){return db[_0x3eb4('0x72')][_0x3eb4('0x54')]({'where':{'id':_0x171802[_0x3eb4('0x44')][_0x3eb4('0x88')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3eb4('0x75'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x234318,null))[_0x3eb4('0x2c')](function(_0x36efa6){var _0x4a3fd2=_[_0x3eb4('0x35')](_0x36efa6,'id');var _0x514d94=[];var _0x5840f3=[];var _0x5658b1=squel[_0x3eb4('0x89')]();_0x5658b1[_0x3eb4('0x8a')](_0x3eb4('0x8b'))[_0x3eb4('0x8c')](_0x3eb4('0x8d'),'tq')['join']('user_has_teams','ut',_0x3eb4('0x8e'))[_0x3eb4('0x4e')]('VoiceQueueId\x20=\x20?',_0x171802[_0x3eb4('0x57')]['id']);for(var _0x5ef29a=0x0;_0x5ef29a<_0x36efa6[_0x3eb4('0x49')];_0x5ef29a+=0x1){let _0x31ed53=_0x36efa6[_0x5ef29a];for(var _0x2aa384=0x0;_0x2aa384<_0x31ed53[_0x3eb4('0x75')][_0x3eb4('0x49')];_0x2aa384+=0x1){let _0xd25829=_0x31ed53['Agents'][_0x2aa384];var _0x3a1f12=_0x5658b1['clone']();_0x3a1f12[_0x3eb4('0x4e')](_0x3eb4('0x8f'),_0xd25829['id']);_0x5840f3[_0x3eb4('0x90')](db[_0x3eb4('0x91')][_0x3eb4('0x44')](_0x3a1f12[_0x3eb4('0x92')](),{'type':db[_0x3eb4('0x91')][_0x3eb4('0x93')][_0x3eb4('0x94')]})['then'](function(_0x46c3b0){if(_0x46c3b0['length']===0x1){return _0xd25829['id'];}else{var _0x1985e2=_[_0x3eb4('0x95')](_[_0x3eb4('0x35')](_0x46c3b0,_0x3eb4('0x96')),function(_0x18626c){return _[_0x3eb4('0x37')](_0x4a3fd2,_0x18626c);});if(_0x1985e2){return _0xd25829['id'];}}}));}}return BPromise['all'](_0x5840f3)[_0x3eb4('0x2c')](function(_0x582ae5){_0x514d94=_(_0x514d94)[_0x3eb4('0x97')](_0x582ae5)[_0x3eb4('0x98')]()[_0x3eb4('0x36')]();return db[_0x3eb4('0x40')]['find']({'where':{'id':_0x171802[_0x3eb4('0x57')]['id']}})[_0x3eb4('0x2c')](function(_0x140c77){return db['sequelize']['transaction'](function(_0x3b0466){return _0x140c77[_0x3eb4('0x87')](_0x171802[_0x3eb4('0x44')][_0x3eb4('0x88')],{'transaction':_0x3b0466})[_0x3eb4('0x2c')](function(){if(!_[_0x3eb4('0x99')](_0x514d94)){return _0x140c77[_0x3eb4('0x9a')](_0x514d94,{'transaction':_0x3b0466})['then'](function(){return db['UserVoiceQueueRt'][_0x3eb4('0x2d')]({'where':{'VoiceQueueId':_0x171802[_0x3eb4('0x57')]['id'],'UserId':_0x514d94},'transaction':_0x3b0466});});}})[_0x3eb4('0x2c')](function(){_0x514d94[_0x3eb4('0x7a')](function(_0x168eca){socket[_0x3eb4('0x85')](_0x3eb4('0x9b'),{'UserId':_0x168eca,'VoiceQueueId':_0x140c77['id']});});});});});});})[_0x3eb4('0x2c')](respondWithStatusCode(_0x234318,null))[_0x3eb4('0x59')](handleError(_0x234318,null));};exports[_0x3eb4('0x9c')]=function(_0x396d46,_0x3692c9,_0x1abfa5){var _0x5bd6c1,_0x1199b0;return db[_0x3eb4('0x40')][_0x3eb4('0x38')]({'where':{'id':_0x396d46[_0x3eb4('0x57')]['id']}})[_0x3eb4('0x2c')](handleEntityNotFound(_0x3692c9,null))[_0x3eb4('0x2c')](function(_0x1bbdd7){if(_0x1bbdd7){_0x1199b0=_0x1bbdd7;return _0x1bbdd7[_0x3eb4('0x9c')](_0x396d46[_0x3eb4('0x5b')][_0x3eb4('0x88')],_[_0x3eb4('0x61')](_0x396d46[_0x3eb4('0x5b')],[_0x3eb4('0x88'),'id'])||{})['spread'](function(_0x45746a){for(var _0x3eef8b=0x0;_0x3eef8b<_0x396d46[_0x3eb4('0x5b')][_0x3eb4('0x88')][_0x3eb4('0x49')];_0x3eef8b+=0x1){socket[_0x3eb4('0x85')](_0x3eb4('0x86'),{'UserId':_0x396d46[_0x3eb4('0x5b')][_0x3eb4('0x88')][_0x3eef8b],'VoiceQueueId':_0x396d46[_0x3eb4('0x57')]['id']});}return _0x45746a;});}})[_0x3eb4('0x2c')](function(_0x12d000){_0x5bd6c1=_0x12d000||[];if(_0x1199b0){return db[_0x3eb4('0x74')][_0x3eb4('0x54')]({'where':{'id':_0x396d46[_0x3eb4('0x5b')]['ids']},'attributes':['id',_0x3eb4('0x3d'),_0x3eb4('0x76'),_0x3eb4('0x77'),_0x3eb4('0x78')],'raw':!![]});}})['then'](function(_0x2016c4){if(!_[_0x3eb4('0x99')](_0x2016c4)){var _0x451f46=[];for(var _0x5ce7c4=0x0;_0x5ce7c4<_0x2016c4[_0x3eb4('0x49')];_0x5ce7c4++){if(_0x2016c4[_0x5ce7c4][_0x3eb4('0x76')]){_0x451f46[_0x3eb4('0x90')](db[_0x3eb4('0x81')][_0x3eb4('0x9d')]({'membername':_0x2016c4[_0x5ce7c4][_0x3eb4('0x3d')],'UserId':_0x2016c4[_0x5ce7c4]['id'],'queue_name':_0x1199b0[_0x3eb4('0x3d')],'VoiceQueueId':_0x1199b0['id'],'interface':_[_0x3eb4('0x82')](_0x2016c4[_0x5ce7c4][_0x3eb4('0x78')])?util[_0x3eb4('0x83')](_0x3eb4('0x84'),_0x2016c4[_0x5ce7c4]['name']):_0x2016c4[_0x5ce7c4]['interface'],'paused':_0x2016c4[_0x5ce7c4][_0x3eb4('0x77')]||![],'penalty':_0x396d46[_0x3eb4('0x5b')][_0x3eb4('0x7b')]||0x0}));}}return BPromise[_0x3eb4('0x9e')](_0x451f46);}})['then'](function(){return _0x5bd6c1;})[_0x3eb4('0x2c')](respondWithResult(_0x3692c9,null))['catch'](handleError(_0x3692c9,null));};exports[_0x3eb4('0x9a')]=function(_0xd90cda,_0x5e9d27,_0x906b49){return db[_0x3eb4('0x40')][_0x3eb4('0x38')]({'where':{'id':_0xd90cda[_0x3eb4('0x57')]['id']}})[_0x3eb4('0x2c')](handleEntityNotFound(_0x5e9d27,null))[_0x3eb4('0x2c')](function(_0x1c53c8){if(_0x1c53c8){return _0x1c53c8[_0x3eb4('0x9a')](_0xd90cda[_0x3eb4('0x44')][_0x3eb4('0x88')])['then'](function(){if(_[_0x3eb4('0x9f')](_0xd90cda[_0x3eb4('0x44')][_0x3eb4('0x88')])){for(var _0x26a80f=0x0;_0x26a80f<_0xd90cda[_0x3eb4('0x44')][_0x3eb4('0x88')][_0x3eb4('0x49')];_0x26a80f+=0x1){socket[_0x3eb4('0x85')](_0x3eb4('0x9b'),{'UserId':Number(_0xd90cda[_0x3eb4('0x44')][_0x3eb4('0x88')][_0x26a80f]),'VoiceQueueId':Number(_0xd90cda[_0x3eb4('0x57')]['id'])});}}else{socket[_0x3eb4('0x85')]('userVoiceQueue:remove',{'UserId':Number(_0xd90cda[_0x3eb4('0x44')][_0x3eb4('0x88')]),'VoiceQueueId':Number(_0xd90cda['params']['id'])});}});}})[_0x3eb4('0x2c')](function(_0x1c78aa){return db[_0x3eb4('0x81')]['destroy']({'where':{'VoiceQueueId':_0xd90cda['params']['id'],'UserId':_0xd90cda[_0x3eb4('0x44')][_0x3eb4('0x88')]}})[_0x3eb4('0x2c')](function(){return _0x1c78aa;});})['then'](respondWithStatusCode(_0x5e9d27,null))[_0x3eb4('0x59')](handleError(_0x5e9d27,null));};exports['getAgents']=function(_0x211963,_0x16d965,_0x1d3dd2){var _0x29de9b={};var _0x356d9e={};var _0x29f2d7;var _0x5f44c5;return db[_0x3eb4('0x40')]['findOne']({'where':{'id':_0x211963[_0x3eb4('0x57')]['id']}})[_0x3eb4('0x2c')](handleEntityNotFound(_0x16d965,null))[_0x3eb4('0x2c')](function(_0x6cd511){if(_0x6cd511){_0x29f2d7=_0x6cd511;_0x356d9e[_0x3eb4('0x43')]=_[_0x3eb4('0x58')](db[_0x3eb4('0x74')][_0x3eb4('0x41')]);_0x356d9e['query']=_[_0x3eb4('0x58')](_0x211963[_0x3eb4('0x44')]);_0x356d9e['filters']=_['intersection'](_0x356d9e[_0x3eb4('0x43')],_0x356d9e[_0x3eb4('0x44')]);_0x29de9b[_0x3eb4('0x48')]=_[_0x3eb4('0x46')](_0x356d9e['model'],qs[_0x3eb4('0x47')](_0x211963[_0x3eb4('0x44')][_0x3eb4('0x47')]));_0x29de9b[_0x3eb4('0x48')]=_0x29de9b[_0x3eb4('0x48')]['length']?_0x29de9b[_0x3eb4('0x48')]:_0x356d9e[_0x3eb4('0x43')];_0x29de9b[_0x3eb4('0x69')]=qs['sort'](_0x211963[_0x3eb4('0x44')]['sort']);_0x29de9b['where']=qs[_0x3eb4('0x45')](_[_0x3eb4('0x6d')](_0x211963[_0x3eb4('0x44')],_0x356d9e[_0x3eb4('0x45')]));if(_0x211963[_0x3eb4('0x44')]['filter']){_0x29de9b['where']=_[_0x3eb4('0x4f')](_0x29de9b[_0x3eb4('0x4e')],{'$or':_[_0x3eb4('0x35')](_0x29de9b[_0x3eb4('0x48')],function(_0x255057){var _0x5987ec={};_0x5987ec[_0x255057]={'$like':'%'+_0x211963[_0x3eb4('0x44')][_0x3eb4('0x33')]+'%'};return _0x5987ec;})});}_0x29de9b=_[_0x3eb4('0x4f')]({},_0x29de9b,_0x211963[_0x3eb4('0x51')]);return _0x29f2d7[_0x3eb4('0xa0')](_0x29de9b);}})[_0x3eb4('0x2c')](function(_0xa57fd9){if(_0xa57fd9){_0x5f44c5=_0xa57fd9[_0x3eb4('0x49')];if(!_0x211963[_0x3eb4('0x44')][_0x3eb4('0x4a')](_0x3eb4('0x4b'))){_0x29de9b[_0x3eb4('0x4c')]=qs[_0x3eb4('0x4c')](_0x211963[_0x3eb4('0x44')][_0x3eb4('0x4c')]);_0x29de9b['offset']=qs[_0x3eb4('0x25')](_0x211963['query'][_0x3eb4('0x25')]);}return _0x29f2d7['getAgents'](_0x29de9b);}})[_0x3eb4('0x2c')](function(_0x568010){if(_0x568010){return _0x568010?{'count':_0x5f44c5,'rows':_0x568010}:null;}})[_0x3eb4('0x2c')](respondWithResult(_0x16d965,null))[_0x3eb4('0x59')](handleError(_0x16d965,null));};exports[_0x3eb4('0xa1')]=function(_0x36cbfb,_0x1f6826,_0x3fa25f){var _0xb82559={};var _0x5a82fe={};var _0x3d6a78;var _0x3050df;return db[_0x3eb4('0x40')][_0x3eb4('0x68')]({'where':{'id':_0x36cbfb['params']['id']}})[_0x3eb4('0x2c')](handleEntityNotFound(_0x1f6826,null))[_0x3eb4('0x2c')](function(_0x312715){if(_0x312715){_0x3d6a78=_0x312715;_0x5a82fe[_0x3eb4('0x43')]=_[_0x3eb4('0x58')](db[_0x3eb4('0x81')][_0x3eb4('0x41')]);_0x5a82fe[_0x3eb4('0x44')]=_[_0x3eb4('0x58')](_0x36cbfb[_0x3eb4('0x44')]);_0x5a82fe[_0x3eb4('0x45')]=_[_0x3eb4('0x46')](_0x5a82fe['model'],_0x5a82fe[_0x3eb4('0x44')]);_0xb82559['attributes']=_[_0x3eb4('0x46')](_0x5a82fe[_0x3eb4('0x43')],qs[_0x3eb4('0x47')](_0x36cbfb['query'][_0x3eb4('0x47')]));_0xb82559['attributes']=_0xb82559[_0x3eb4('0x48')]['length']?_0xb82559['attributes']:_0x5a82fe['model'];_0xb82559['order']=qs[_0x3eb4('0x4d')](_0x36cbfb[_0x3eb4('0x44')][_0x3eb4('0x4d')]);_0xb82559[_0x3eb4('0x4e')]=qs[_0x3eb4('0x45')](_[_0x3eb4('0x6d')](_0x36cbfb[_0x3eb4('0x44')],_0x5a82fe[_0x3eb4('0x45')]));if(_0x36cbfb[_0x3eb4('0x44')][_0x3eb4('0x33')]){_0xb82559[_0x3eb4('0x4e')]=_[_0x3eb4('0x4f')](_0xb82559[_0x3eb4('0x4e')],{'$or':_[_0x3eb4('0x35')](_0xb82559[_0x3eb4('0x48')],function(_0x57b36a){var _0x353f20={};_0x353f20[_0x57b36a]={'$like':'%'+_0x36cbfb[_0x3eb4('0x44')][_0x3eb4('0x33')]+'%'};return _0x353f20;})});}_0xb82559=_[_0x3eb4('0x4f')]({},_0xb82559,_0x36cbfb['options']);return _0x3d6a78[_0x3eb4('0xa1')](_0xb82559);}})[_0x3eb4('0x2c')](function(_0x97847e){if(_0x97847e){_0x3050df=_0x97847e[_0x3eb4('0x49')];if(!_0x36cbfb['query']['hasOwnProperty'](_0x3eb4('0x4b'))){_0xb82559['limit']=qs[_0x3eb4('0x4c')](_0x36cbfb[_0x3eb4('0x44')][_0x3eb4('0x4c')]);_0xb82559[_0x3eb4('0x25')]=qs[_0x3eb4('0x25')](_0x36cbfb[_0x3eb4('0x44')][_0x3eb4('0x25')]);}return _0x3d6a78[_0x3eb4('0xa1')](_0xb82559);}})['then'](function(_0x1bd5de){return _0x1bd5de?{'count':_0x3050df,'rows':_0x1bd5de}:null;})[_0x3eb4('0x2c')](respondWithResult(_0x1f6826,null))[_0x3eb4('0x59')](handleError(_0x1f6826,null));};exports[_0x3eb4('0xa2')]=function(_0x5bcf58,_0xd28ca8,_0x467acb){var _0x14ec93={};var _0x324f70={};var _0x3fc6d9;var _0x51c95c;return db[_0x3eb4('0x40')]['findOne']({'where':{'id':_0x5bcf58[_0x3eb4('0x57')]['id']}})[_0x3eb4('0x2c')](handleEntityNotFound(_0xd28ca8,null))['then'](function(_0x4d97be){if(_0x4d97be){_0x3fc6d9=_0x4d97be;_0x324f70[_0x3eb4('0x43')]=_[_0x3eb4('0x58')](db[_0x3eb4('0xa3')][_0x3eb4('0x41')]);_0x324f70[_0x3eb4('0x44')]=_['keys'](_0x5bcf58[_0x3eb4('0x44')]);_0x324f70[_0x3eb4('0x45')]=_[_0x3eb4('0x46')](_0x324f70[_0x3eb4('0x43')],_0x324f70['query']);_0x14ec93[_0x3eb4('0x48')]=_[_0x3eb4('0x46')](_0x324f70[_0x3eb4('0x43')],qs[_0x3eb4('0x47')](_0x5bcf58['query'][_0x3eb4('0x47')]));_0x14ec93[_0x3eb4('0x48')]=_0x14ec93[_0x3eb4('0x48')][_0x3eb4('0x49')]?_0x14ec93[_0x3eb4('0x48')]:_0x324f70[_0x3eb4('0x43')];_0x14ec93[_0x3eb4('0x69')]=qs[_0x3eb4('0x4d')](_0x5bcf58[_0x3eb4('0x44')][_0x3eb4('0x4d')]);_0x14ec93[_0x3eb4('0x4e')]=qs[_0x3eb4('0x45')](_[_0x3eb4('0x6d')](_0x5bcf58['query'],_0x324f70[_0x3eb4('0x45')]));if(_0x5bcf58['query'][_0x3eb4('0x33')]){_0x14ec93[_0x3eb4('0x4e')]=_[_0x3eb4('0x4f')](_0x14ec93[_0x3eb4('0x4e')],{'$or':_[_0x3eb4('0x35')](_0x14ec93[_0x3eb4('0x48')],function(_0x415e8d){var _0x4af3aa={};_0x4af3aa[_0x415e8d]={'$like':'%'+_0x5bcf58['query'][_0x3eb4('0x33')]+'%'};return _0x4af3aa;})});}_0x14ec93=_['merge']({},_0x14ec93,_0x5bcf58[_0x3eb4('0x51')]);return _0x3fc6d9['getLists'](_0x14ec93);}})[_0x3eb4('0x2c')](function(_0x56d755){if(_0x56d755){_0x51c95c=_0x56d755['length'];if(!_0x5bcf58['query'][_0x3eb4('0x4a')](_0x3eb4('0x4b'))){_0x14ec93['limit']=qs[_0x3eb4('0x4c')](_0x5bcf58['query'][_0x3eb4('0x4c')]);_0x14ec93[_0x3eb4('0x25')]=qs[_0x3eb4('0x25')](_0x5bcf58[_0x3eb4('0x44')][_0x3eb4('0x25')]);}return _0x3fc6d9['getLists'](_0x14ec93);}})[_0x3eb4('0x2c')](function(_0x580215){if(_0x580215){return _0x580215?{'count':_0x51c95c,'rows':_0x580215}:null;}})[_0x3eb4('0x2c')](respondWithResult(_0xd28ca8,null))[_0x3eb4('0x59')](handleError(_0xd28ca8,null));};exports[_0x3eb4('0xa4')]=function(_0x21ab6a,_0x5573fd,_0x34fcb5){var _0x580a57,_0x5ce59b;return db['VoiceQueue'][_0x3eb4('0x38')]({'where':{'id':_0x21ab6a[_0x3eb4('0x57')]['id']}})[_0x3eb4('0x2c')](handleEntityNotFound(_0x5573fd,null))['then'](function(_0x22784a){if(_0x22784a){_0x5ce59b=_0x22784a;return _0x22784a[_0x3eb4('0xa4')](_0x21ab6a[_0x3eb4('0x5b')]['ids'],_[_0x3eb4('0x61')](_0x21ab6a[_0x3eb4('0x5b')],[_0x3eb4('0x88'),'id'])||{});}return null;})[_0x3eb4('0xa5')](function(_0x42b1cf){var _0x49d1b0;_0x580a57=_0x42b1cf||[];var _0x418bba=[];if(_0x42b1cf){for(var _0x449294=0x0;_0x449294<_0x42b1cf[_0x3eb4('0x49')];_0x449294+=0x1){var _0x35bd31=_0x42b1cf[_0x449294][_0x3eb4('0x2e')]({'plain':!![]});_0x5ce59b[_0x3eb4('0xa6')]=_0x21ab6a[_0x3eb4('0x5b')][_0x3eb4('0xa6')]?_0x21ab6a['body'][_0x3eb4('0xa6')]:_0x5ce59b['dialCheckDuplicateType'];switch(_0x5ce59b[_0x3eb4('0xa6')]){case _0x3eb4('0xa7'):_0x49d1b0=squel[_0x3eb4('0xa8')]()['into'](_0x3eb4('0xa9'))[_0x3eb4('0xaa')]([_0x3eb4('0xab'),'scheduledAt',_0x3eb4('0xac'),_0x3eb4('0xad'),_0x3eb4('0x6a'),'createdAt',_0x3eb4('0x62')],squel[_0x3eb4('0x89')]()['field'](_0x3eb4('0xab'),_0x3eb4('0xab'))['field']('NOW()',_0x3eb4('0xae'))[_0x3eb4('0x8a')]('id',_0x3eb4('0xac'))[_0x3eb4('0x8a')](_0x35bd31['CmListId'][_0x3eb4('0x92')](),'ListId')[_0x3eb4('0x8a')](_0x21ab6a[_0x3eb4('0x57')]['id']['toString'](),_0x3eb4('0x6a'))[_0x3eb4('0x8a')]('NOW()','createdAt')[_0x3eb4('0x8a')]('NOW()',_0x3eb4('0x62'))[_0x3eb4('0x8c')](_0x3eb4('0xaf'))[_0x3eb4('0x4e')]('deletedAt\x20IS\x20NULL')[_0x3eb4('0x4e')](_0x3eb4('0xb0'),_0x35bd31[_0x3eb4('0xb1')][_0x3eb4('0x92')]())[_0x3eb4('0x4e')](_0x3eb4('0xb2'))[_0x3eb4('0x4e')](_0x3eb4('0xb3'),squel['select']()[_0x3eb4('0x8a')]('COALESCE(calleridnum,\x27\x27)')['from']('cm_hopper_final')[_0x3eb4('0x4e')](_0x3eb4('0xb4'),_0x21ab6a['params']['id'][_0x3eb4('0x92')]()))[_0x3eb4('0x4e')](_0x3eb4('0xb3'),squel['select']()[_0x3eb4('0x8a')](_0x3eb4('0xb5'))[_0x3eb4('0x8c')](_0x3eb4('0xa9'))['where']('VoiceQueueId\x20=\x20?',_0x21ab6a['params']['id'][_0x3eb4('0x92')]())))['toString']();break;case _0x3eb4('0xb6'):_0x49d1b0=squel[_0x3eb4('0xa8')]()[_0x3eb4('0xb7')]('cm_hopper')['fromQuery'](['phone',_0x3eb4('0xae'),'ContactId',_0x3eb4('0xad'),_0x3eb4('0x6a'),'createdAt','updatedAt'],squel['select']()[_0x3eb4('0x8a')](_0x3eb4('0xab'),_0x3eb4('0xab'))[_0x3eb4('0x8a')](_0x3eb4('0xb8'),_0x3eb4('0xae'))[_0x3eb4('0x8a')]('id','ContactId')[_0x3eb4('0x8a')](_0x35bd31[_0x3eb4('0xb1')][_0x3eb4('0x92')](),_0x3eb4('0xad'))[_0x3eb4('0x8a')](_0x21ab6a[_0x3eb4('0x57')]['id'][_0x3eb4('0x92')](),'VoiceQueueId')[_0x3eb4('0x8a')](_0x3eb4('0xb8'),_0x3eb4('0xb9'))[_0x3eb4('0x8a')](_0x3eb4('0xb8'),_0x3eb4('0x62'))['from'](_0x3eb4('0xaf'))[_0x3eb4('0x4e')](_0x3eb4('0xba'))['where'](_0x3eb4('0xb0'),_0x35bd31[_0x3eb4('0xb1')][_0x3eb4('0x92')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x3eb4('0x4e')](_0x3eb4('0xb3'),squel[_0x3eb4('0x89')]()[_0x3eb4('0x8a')](_0x3eb4('0xb5'))[_0x3eb4('0x8c')](_0x3eb4('0xa9'))[_0x3eb4('0x4e')](_0x3eb4('0xb4'),_0x21ab6a[_0x3eb4('0x57')]['id'][_0x3eb4('0x92')]())))[_0x3eb4('0x92')]();break;default:_0x49d1b0=squel[_0x3eb4('0xa8')]()[_0x3eb4('0xb7')](_0x3eb4('0xa9'))[_0x3eb4('0xaa')]([_0x3eb4('0xab'),_0x3eb4('0xae'),_0x3eb4('0xac'),_0x3eb4('0xad'),_0x3eb4('0x6a'),_0x3eb4('0xb9'),_0x3eb4('0x62')],squel[_0x3eb4('0x89')]()[_0x3eb4('0x8a')](_0x3eb4('0xab'),_0x3eb4('0xab'))['field'](_0x3eb4('0xb8'),_0x3eb4('0xae'))['field']('id','ContactId')[_0x3eb4('0x8a')](_0x35bd31['CmListId'][_0x3eb4('0x92')](),_0x3eb4('0xad'))['field'](_0x21ab6a[_0x3eb4('0x57')]['id']['toString'](),'VoiceQueueId')['field'](_0x3eb4('0xb8'),_0x3eb4('0xb9'))['field'](_0x3eb4('0xb8'),'updatedAt')[_0x3eb4('0x8c')]('cm_contacts')[_0x3eb4('0x4e')]('deletedAt\x20IS\x20NULL')[_0x3eb4('0x4e')](_0x3eb4('0xb0'),_0x35bd31[_0x3eb4('0xb1')][_0x3eb4('0x92')]())[_0x3eb4('0x4e')]('phone\x20IS\x20NOT\x20NULL'))[_0x3eb4('0x92')]();}_0x418bba[_0x3eb4('0x90')](db[_0x3eb4('0x91')][_0x3eb4('0x44')](_0x49d1b0));}return BPromise[_0x3eb4('0x9e')](_0x418bba);}})[_0x3eb4('0x2c')](function(){return _0x580a57;})['then'](respondWithResult(_0x5573fd,null))[_0x3eb4('0x59')](handleError(_0x5573fd,null));};exports[_0x3eb4('0xbb')]=function(_0x527ae6,_0xfdecd0,_0x39f8be){return db[_0x3eb4('0x40')][_0x3eb4('0x38')]({'where':{'id':_0x527ae6['params']['id']}})[_0x3eb4('0x2c')](handleEntityNotFound(_0xfdecd0,null))['then'](function(_0x1eb64f){if(_0x1eb64f){return _0x1eb64f[_0x3eb4('0xbb')](_0x527ae6[_0x3eb4('0x44')][_0x3eb4('0x88')]);}})[_0x3eb4('0x2c')](function(_0x1c4898){if(_0x1c4898){return db[_0x3eb4('0x6b')]['destroy']({'where':{'ListId':_0x527ae6[_0x3eb4('0x44')]['ids'],'VoiceQueueId':_0x527ae6[_0x3eb4('0x57')]['id']}})[_0x3eb4('0x2c')](function(){return _0x1c4898;});}})[_0x3eb4('0x2c')](respondWithStatusCode(_0xfdecd0,null))[_0x3eb4('0x59')](handleError(_0xfdecd0,null));};exports['getBlackLists']=function(_0x31b402,_0x4d7696,_0x481fcd){var _0x237a63={};var _0x20ee24={};var _0x286ecb;var _0x474dc8;return db[_0x3eb4('0x40')][_0x3eb4('0x68')]({'where':{'id':_0x31b402[_0x3eb4('0x57')]['id']}})[_0x3eb4('0x2c')](handleEntityNotFound(_0x4d7696,null))[_0x3eb4('0x2c')](function(_0x383ee1){if(_0x383ee1){_0x286ecb=_0x383ee1;_0x20ee24[_0x3eb4('0x43')]=_[_0x3eb4('0x58')](db[_0x3eb4('0xa3')]['rawAttributes']);_0x20ee24[_0x3eb4('0x44')]=_[_0x3eb4('0x58')](_0x31b402[_0x3eb4('0x44')]);_0x20ee24[_0x3eb4('0x45')]=_[_0x3eb4('0x46')](_0x20ee24[_0x3eb4('0x43')],_0x20ee24[_0x3eb4('0x44')]);_0x237a63[_0x3eb4('0x48')]=_[_0x3eb4('0x46')](_0x20ee24[_0x3eb4('0x43')],qs[_0x3eb4('0x47')](_0x31b402[_0x3eb4('0x44')][_0x3eb4('0x47')]));_0x237a63[_0x3eb4('0x48')]=_0x237a63[_0x3eb4('0x48')][_0x3eb4('0x49')]?_0x237a63[_0x3eb4('0x48')]:_0x20ee24[_0x3eb4('0x43')];_0x237a63['order']=qs[_0x3eb4('0x4d')](_0x31b402['query'][_0x3eb4('0x4d')]);_0x237a63['where']=qs[_0x3eb4('0x45')](_['pick'](_0x31b402[_0x3eb4('0x44')],_0x20ee24['filters']));if(_0x31b402['query'][_0x3eb4('0x33')]){_0x237a63[_0x3eb4('0x4e')]=_[_0x3eb4('0x4f')](_0x237a63[_0x3eb4('0x4e')],{'$or':_[_0x3eb4('0x35')](_0x237a63[_0x3eb4('0x48')],function(_0x5924a1){var _0x148c6d={};_0x148c6d[_0x5924a1]={'$like':'%'+_0x31b402[_0x3eb4('0x44')]['filter']+'%'};return _0x148c6d;})});}_0x237a63=_['merge']({},_0x237a63,_0x31b402[_0x3eb4('0x51')]);return _0x286ecb[_0x3eb4('0xbc')](_0x237a63);}})[_0x3eb4('0x2c')](function(_0x11c97c){if(_0x11c97c){_0x474dc8=_0x11c97c[_0x3eb4('0x49')];if(!_0x31b402[_0x3eb4('0x44')][_0x3eb4('0x4a')](_0x3eb4('0x4b'))){_0x237a63[_0x3eb4('0x4c')]=qs[_0x3eb4('0x4c')](_0x31b402['query']['limit']);_0x237a63[_0x3eb4('0x25')]=qs[_0x3eb4('0x25')](_0x31b402['query'][_0x3eb4('0x25')]);}return _0x286ecb[_0x3eb4('0xbc')](_0x237a63);}})[_0x3eb4('0x2c')](function(_0x2ba63a){if(_0x2ba63a){return _0x2ba63a?{'count':_0x474dc8,'rows':_0x2ba63a}:null;}})['then'](respondWithResult(_0x4d7696,null))[_0x3eb4('0x59')](handleError(_0x4d7696,null));};exports[_0x3eb4('0xbd')]=function(_0x4e66a4,_0x4f468b,_0x383ec8){var _0x2a5c43,_0x13ac6c;return db[_0x3eb4('0x40')][_0x3eb4('0x38')]({'where':{'id':_0x4e66a4[_0x3eb4('0x57')]['id']}})['then'](handleEntityNotFound(_0x4f468b,null))['then'](function(_0x284721){if(_0x284721){_0x13ac6c=_0x284721;return _0x284721[_0x3eb4('0xbd')](_0x4e66a4[_0x3eb4('0x5b')][_0x3eb4('0x88')],_[_0x3eb4('0x61')](_0x4e66a4[_0x3eb4('0x5b')],[_0x3eb4('0x88'),'id'])||{});}return null;})[_0x3eb4('0xa5')](function(_0x5ae676){var _0x29e999;_0x2a5c43=_0x5ae676||[];var _0x51c8c3=[];if(_0x5ae676){for(var _0x5ebc03=0x0;_0x5ebc03<_0x5ae676[_0x3eb4('0x49')];_0x5ebc03+=0x1){var _0xbe3e65=_0x5ae676[_0x5ebc03]['get']({'plain':!![]});_0x29e999=squel[_0x3eb4('0xa8')]()['into'](_0x3eb4('0xbe'))[_0x3eb4('0xaa')]([_0x3eb4('0xab'),_0x3eb4('0xac'),_0x3eb4('0xad'),'VoiceQueueId',_0x3eb4('0xb9'),_0x3eb4('0x62')],squel['select']()[_0x3eb4('0x8a')](_0x3eb4('0xab'),_0x3eb4('0xab'))[_0x3eb4('0x8a')]('id',_0x3eb4('0xac'))[_0x3eb4('0x8a')](_0xbe3e65[_0x3eb4('0xb1')][_0x3eb4('0x92')](),_0x3eb4('0xad'))[_0x3eb4('0x8a')](_0x4e66a4['params']['id']['toString'](),'VoiceQueueId')[_0x3eb4('0x8a')](_0x3eb4('0xb8'),_0x3eb4('0xb9'))[_0x3eb4('0x8a')](_0x3eb4('0xb8'),_0x3eb4('0x62'))['from'](_0x3eb4('0xaf'))[_0x3eb4('0x4e')](_0x3eb4('0xba'))[_0x3eb4('0x4e')](_0x3eb4('0xb0'),_0xbe3e65['CmListId'][_0x3eb4('0x92')]())[_0x3eb4('0x4e')](_0x3eb4('0xb2')))['toString']();_0x51c8c3[_0x3eb4('0x90')](db[_0x3eb4('0x91')][_0x3eb4('0x44')](_0x29e999));}return BPromise[_0x3eb4('0x9e')](_0x51c8c3);}})[_0x3eb4('0x2c')](function(){return _0x2a5c43;})[_0x3eb4('0x2c')](respondWithResult(_0x4f468b,null))['catch'](handleError(_0x4f468b,null));};exports[_0x3eb4('0xbf')]=function(_0x24ba38,_0x3d4467,_0x24b78f){return db['VoiceQueue'][_0x3eb4('0x38')]({'where':{'id':_0x24ba38['params']['id']}})[_0x3eb4('0x2c')](handleEntityNotFound(_0x3d4467,null))[_0x3eb4('0x2c')](function(_0x2e40b3){if(_0x2e40b3){return _0x2e40b3[_0x3eb4('0xbf')](_0x24ba38[_0x3eb4('0x44')][_0x3eb4('0x88')]);}})['then'](function(_0x16376d){if(_0x16376d){return db[_0x3eb4('0x70')]['destroy']({'where':{'ListId':_0x24ba38[_0x3eb4('0x44')][_0x3eb4('0x88')],'VoiceQueueId':_0x24ba38[_0x3eb4('0x57')]['id']}})[_0x3eb4('0x2c')](function(){return _0x16376d;});}})[_0x3eb4('0x2c')](respondWithStatusCode(_0x3d4467,null))[_0x3eb4('0x59')](handleError(_0x3d4467,null));}; \ No newline at end of file +var _0xbe90=['include','findAll','catch','show','params','keys','fields','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','user','update','destroy','findOne','CmHopper','rawAttributes','VoiceQueueId','getHopperHistories','nolimit','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','User','Agents','online','interface','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','upsert','isNil','voicePause','emit','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','union','compact','removeTeams','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','ids','spread','userVoiceQueue:save','isEmpty','format','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','VoiceQueueId\x20=\x20?','cm_contacts','removeLists','getBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','status','json','count','offset','reject','save','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','map','value','type','find','name','error','stack','send','index','VoiceQueue','key','model','query','filters','intersection','attributes','length','hasOwnProperty','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll'];(function(_0x43ea4c,_0x5cfdeb){var _0x5144e0=function(_0x5acdb6){while(--_0x5acdb6){_0x43ea4c['push'](_0x43ea4c['shift']());}};_0x5144e0(++_0x5cfdeb);}(_0xbe90,0x1d4));var _0x0be9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe90[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x0be9('0x0'));var emlformat=require(_0x0be9('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0be9('0x2'));var rp=require('request-promise');var moment=require(_0x0be9('0x3'));var BPromise=require(_0x0be9('0x4'));var Mustache=require(_0x0be9('0x5'));var util=require(_0x0be9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0be9('0x7'));var ejs=require(_0x0be9('0x8'));var fs=require('fs');var _=require(_0x0be9('0x9'));var squel=require('squel');var crypto=require(_0x0be9('0xa'));var jsforce=require(_0x0be9('0xb'));var deskjs=require(_0x0be9('0xc'));var toCsv=require(_0x0be9('0x7'));var querystring=require('querystring');var Papa=require(_0x0be9('0xd'));var Redis=require(_0x0be9('0xe'));var authService=require(_0x0be9('0xf'));var qs=require(_0x0be9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0be9('0x11'));var logger=require(_0x0be9('0x12'))(_0x0be9('0x13'));var utils=require(_0x0be9('0x14'));var config=require(_0x0be9('0x15'));var db=require('../../mysqldb')['db'];config[_0x0be9('0x16')]=_[_0x0be9('0x17')](config[_0x0be9('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0be9('0x18'))(new Redis(config['redis']));require(_0x0be9('0x19'))[_0x0be9('0x1a')](socket);function respondWithStatusCode(_0x120454,_0x4d4872){_0x4d4872=_0x4d4872||0xcc;return function(_0x296c8b){if(_0x296c8b){return _0x120454[_0x0be9('0x1b')](_0x4d4872);}return _0x120454['status'](_0x4d4872)[_0x0be9('0x1c')]();};}function respondWithResult(_0x6c430a,_0x1e7991){_0x1e7991=_0x1e7991||0xc8;return function(_0x50923e){if(_0x50923e){return _0x6c430a[_0x0be9('0x1d')](_0x1e7991)[_0x0be9('0x1e')](_0x50923e);}};}function respondWithFilteredResult(_0x1f7f98,_0x4bea99){return function(_0x18922f){if(_0x18922f){var _0x901e03=_0x18922f[_0x0be9('0x1f')],_0x3fad1d=_0x4bea99[_0x0be9('0x20')],_0x1a00ec=_0x4bea99['offset']+_0x4bea99['limit'],_0x72ae02;if(_0x1a00ec>=_0x901e03){_0x1a00ec=_0x901e03;_0x72ae02=0xc8;}else{_0x72ae02=0xce;}_0x1f7f98[_0x0be9('0x1d')](_0x72ae02);return _0x1f7f98['set']('Content-Range',_0x3fad1d+'-'+_0x1a00ec+'/'+_0x901e03)[_0x0be9('0x1e')](_0x18922f);}return null;};}function patchUpdates(_0x5bacdf){return function(_0x58cc6d){try{jsonpatch['apply'](_0x58cc6d,_0x5bacdf,!![]);}catch(_0x47ccda){return BPromise[_0x0be9('0x21')](_0x47ccda);}return _0x58cc6d[_0x0be9('0x22')]();};}function saveUpdates(_0x323839,_0x511975){return function(_0x1caad8){if(_0x1caad8){return _0x1caad8['update'](_0x323839)[_0x0be9('0x23')](function(_0x419040){return _0x419040;});}return null;};}function removeEntity(_0x2d31af,_0x8faee1){return function(_0x567e52){if(_0x567e52){return _0x567e52['destroy']()[_0x0be9('0x23')](function(){var _0x13efea=_0x567e52[_0x0be9('0x24')]({'plain':!![]});var _0x46b079=[{'name':_0x0be9('0x25'),'value':_0x0be9('0x26'),'ignore':![]},{'name':_0x0be9('0x27'),'value':_0x0be9('0x28'),'ignore':![]}];var _0x3f9481=_(_0x46b079)['filter']('ignore')[_0x0be9('0x29')](_0x0be9('0x2a'))[_0x0be9('0x2a')]();if(_['includes'](_0x3f9481,_0x13efea[_0x0be9('0x2b')])){return;}var _0x377710=_[_0x0be9('0x2c')](_0x46b079,[_0x0be9('0x2a'),_0x13efea['type']])[_0x0be9('0x2d')];return db['UserProfileResource']['destroy']({'where':{'type':_0x377710,'resourceId':_0x13efea['id']}})[_0x0be9('0x23')](function(){return _0x567e52;});})['then'](function(){_0x2d31af[_0x0be9('0x1d')](0xcc)[_0x0be9('0x1c')]();});}};}function handleEntityNotFound(_0x419e92,_0x364b16){return function(_0x5480d3){if(!_0x5480d3){_0x419e92[_0x0be9('0x1b')](0x194);}return _0x5480d3;};}function handleError(_0x1bade1,_0x1ec4ab){_0x1ec4ab=_0x1ec4ab||0x1f4;return function(_0x4cd596){logger[_0x0be9('0x2e')](_0x4cd596[_0x0be9('0x2f')]);if(_0x4cd596[_0x0be9('0x2d')]){delete _0x4cd596[_0x0be9('0x2d')];}_0x1bade1[_0x0be9('0x1d')](_0x1ec4ab)[_0x0be9('0x30')](_0x4cd596);};}exports[_0x0be9('0x31')]=function(_0x2d7bc2,_0x2a0be7){var _0x8a4be3={},_0x2569c0={},_0x5ae8da={'count':0x0,'rows':[]};var _0x4f39cb=_[_0x0be9('0x29')](db[_0x0be9('0x32')]['rawAttributes'],function(_0x5266cc){return{'name':_0x5266cc['fieldName'],'type':_0x5266cc[_0x0be9('0x2b')][_0x0be9('0x33')]};});_0x2569c0[_0x0be9('0x34')]=_[_0x0be9('0x29')](_0x4f39cb,_0x0be9('0x2d'));_0x2569c0[_0x0be9('0x35')]=_['keys'](_0x2d7bc2['query']);_0x2569c0[_0x0be9('0x36')]=_[_0x0be9('0x37')](_0x2569c0[_0x0be9('0x34')],_0x2569c0[_0x0be9('0x35')]);_0x8a4be3[_0x0be9('0x38')]=_[_0x0be9('0x37')](_0x2569c0[_0x0be9('0x34')],qs['fields'](_0x2d7bc2['query']['fields']));_0x8a4be3[_0x0be9('0x38')]=_0x8a4be3[_0x0be9('0x38')][_0x0be9('0x39')]?_0x8a4be3['attributes']:_0x2569c0[_0x0be9('0x34')];if(!_0x2d7bc2[_0x0be9('0x35')][_0x0be9('0x3a')]('nolimit')){_0x8a4be3['limit']=qs[_0x0be9('0x3b')](_0x2d7bc2[_0x0be9('0x35')][_0x0be9('0x3b')]);_0x8a4be3[_0x0be9('0x20')]=qs[_0x0be9('0x20')](_0x2d7bc2[_0x0be9('0x35')][_0x0be9('0x20')]);}_0x8a4be3[_0x0be9('0x3c')]=qs[_0x0be9('0x3d')](_0x2d7bc2[_0x0be9('0x35')]['sort']);_0x8a4be3['where']=qs[_0x0be9('0x36')](_[_0x0be9('0x3e')](_0x2d7bc2[_0x0be9('0x35')],_0x2569c0['filters']),_0x4f39cb);if(_0x2d7bc2['query']['filter']){_0x8a4be3[_0x0be9('0x3f')]=_[_0x0be9('0x40')](_0x8a4be3[_0x0be9('0x3f')],{'$or':_[_0x0be9('0x29')](_0x4f39cb,function(_0x1c9dd7){if(_0x1c9dd7['type']!==_0x0be9('0x41')){var _0x274d43={};_0x274d43[_0x1c9dd7['name']]={'$like':'%'+_0x2d7bc2[_0x0be9('0x35')][_0x0be9('0x42')]+'%'};return _0x274d43;}})});}_0x8a4be3=_[_0x0be9('0x40')]({},_0x8a4be3,_0x2d7bc2[_0x0be9('0x43')]);var _0x2001d5={'where':_0x8a4be3['where']};return db[_0x0be9('0x32')][_0x0be9('0x1f')](_0x2001d5)['then'](function(_0x402241){_0x5ae8da['count']=_0x402241;if(_0x2d7bc2[_0x0be9('0x35')][_0x0be9('0x44')]){_0x8a4be3[_0x0be9('0x45')]=[{'all':!![]}];}return db['VoiceQueue'][_0x0be9('0x46')](_0x8a4be3);})[_0x0be9('0x23')](function(_0x58d0ee){_0x5ae8da['rows']=_0x58d0ee;return _0x5ae8da;})['then'](respondWithFilteredResult(_0x2a0be7,_0x8a4be3))[_0x0be9('0x47')](handleError(_0x2a0be7,null));};exports[_0x0be9('0x48')]=function(_0x48ca73,_0x6e3f51){var _0x2dc2a6={'raw':![],'where':{'id':_0x48ca73[_0x0be9('0x49')]['id']}},_0x5a65d7={};_0x5a65d7['model']=_[_0x0be9('0x4a')](db[_0x0be9('0x32')]['rawAttributes']);_0x5a65d7[_0x0be9('0x35')]=_[_0x0be9('0x4a')](_0x48ca73[_0x0be9('0x35')]);_0x5a65d7[_0x0be9('0x36')]=_['intersection'](_0x5a65d7[_0x0be9('0x34')],_0x5a65d7[_0x0be9('0x35')]);_0x2dc2a6[_0x0be9('0x38')]=_[_0x0be9('0x37')](_0x5a65d7['model'],qs[_0x0be9('0x4b')](_0x48ca73[_0x0be9('0x35')]['fields']));_0x2dc2a6[_0x0be9('0x38')]=_0x2dc2a6['attributes']['length']?_0x2dc2a6[_0x0be9('0x38')]:_0x5a65d7[_0x0be9('0x34')];if(_0x48ca73[_0x0be9('0x35')][_0x0be9('0x44')]){_0x2dc2a6['include']=[{'all':!![]}];}_0x2dc2a6=_['merge']({},_0x2dc2a6,_0x48ca73[_0x0be9('0x43')]);return db[_0x0be9('0x32')]['find'](_0x2dc2a6)[_0x0be9('0x23')](handleEntityNotFound(_0x6e3f51,null))['then'](respondWithResult(_0x6e3f51,null))[_0x0be9('0x47')](handleError(_0x6e3f51,null));};exports[_0x0be9('0x4c')]=function(_0x217cf3,_0x2f6648){return db[_0x0be9('0x32')][_0x0be9('0x4c')](_0x217cf3[_0x0be9('0x4d')],{})[_0x0be9('0x23')](function(_0x3f6020){var _0x53e4cc=_0x217cf3['user'][_0x0be9('0x24')]({'plain':!![]});if(!_0x53e4cc)throw new Error(_0x0be9('0x4e'));if(_0x53e4cc['role']==='user'){var _0x3ce3eb=_0x3f6020['get']({'plain':!![]});var _0x3959c8=[{'name':_0x0be9('0x25'),'value':_0x0be9('0x26')},{'name':'QueueCampaigns','value':_0x0be9('0x28')}];var _0x541c13=_['find'](_0x3959c8,[_0x0be9('0x2a'),_0x3ce3eb['type']])[_0x0be9('0x2d')];return db[_0x0be9('0x4f')][_0x0be9('0x2c')]({'where':{'name':_0x541c13,'userProfileId':_0x53e4cc[_0x0be9('0x50')]},'raw':!![]})[_0x0be9('0x23')](function(_0x385cbd){if(_0x385cbd&&_0x385cbd[_0x0be9('0x51')]===0x0){return db[_0x0be9('0x52')][_0x0be9('0x4c')]({'name':_0x3ce3eb[_0x0be9('0x2d')],'resourceId':_0x3ce3eb['id'],'type':_0x385cbd[_0x0be9('0x2d')],'sectionId':_0x385cbd['id']},{})[_0x0be9('0x23')](function(){return _0x3f6020;});}else{return _0x3f6020;}})[_0x0be9('0x47')](function(_0x300ee4){logger[_0x0be9('0x2e')](_0x0be9('0x53'),_0x300ee4);throw _0x300ee4;});}return _0x3f6020;})[_0x0be9('0x23')](respondWithResult(_0x2f6648,0xc9))[_0x0be9('0x47')](handleError(_0x2f6648,null));};exports[_0x0be9('0x54')]=function(_0x2aeaa1,_0xb9979d){var _0x5c6ac9={'where':{'id':_0x2aeaa1['params']['id']}},_0x3c370c={};_0x3c370c['model']=_[_0x0be9('0x4a')](db[_0x0be9('0x32')]['rawAttributes']);_0x5c6ac9[_0x0be9('0x38')]=_['intersection'](_0x3c370c[_0x0be9('0x34')],qs[_0x0be9('0x4b')](_0x2aeaa1[_0x0be9('0x35')][_0x0be9('0x4b')]));_0x5c6ac9['attributes']=_0x5c6ac9[_0x0be9('0x38')][_0x0be9('0x39')]?_0x5c6ac9[_0x0be9('0x38')]:_0x3c370c[_0x0be9('0x34')];if(_0x2aeaa1['query']['includeAll']){_0x5c6ac9['include']=[{'all':!![]}];}_0x5c6ac9=_['merge']({},_0x5c6ac9,_0x2aeaa1[_0x0be9('0x43')]);return db[_0x0be9('0x32')][_0x0be9('0x2c')](_0x5c6ac9)[_0x0be9('0x23')](handleEntityNotFound(_0xb9979d,null))[_0x0be9('0x23')](function(_0x221f1b){if(_0x221f1b){var _0x2125c4=_0x221f1b['get']({'plain':!![]});_0x2125c4=qs[_0x0be9('0x55')](_0x2125c4,['id',_0x0be9('0x56'),_0x0be9('0x57')]);_0x2aeaa1[_0x0be9('0x4d')]=_[_0x0be9('0x55')](_0x2aeaa1['body'],['id',_0x0be9('0x56'),_0x0be9('0x57')]);return db['VoiceQueue'][_0x0be9('0x4c')](_[_0x0be9('0x40')](_0x2125c4,_0x2aeaa1['body']),{'include':_0x2aeaa1[_0x0be9('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0x0be9('0x23')](function(_0x4c4d08){var _0x2f39a1=_0x2aeaa1[_0x0be9('0x58')][_0x0be9('0x24')]({'plain':!![]});if(!_0x2f39a1)throw new Error(_0x0be9('0x4e'));if(_0x2f39a1['role']===_0x0be9('0x58')){var _0x2e2023=_0x4c4d08['get']({'plain':!![]});var _0x1365a4=[{'name':'VoiceQueues','value':_0x0be9('0x26')},{'name':_0x0be9('0x27'),'value':_0x0be9('0x28')}];var _0x127599=_[_0x0be9('0x2c')](_0x1365a4,[_0x0be9('0x2a'),_0x2e2023[_0x0be9('0x2b')]])[_0x0be9('0x2d')];return db[_0x0be9('0x4f')]['find']({'where':{'name':_0x127599,'userProfileId':_0x2f39a1[_0x0be9('0x50')]},'raw':!![]})['then'](function(_0x18ff47){if(_0x18ff47&&_0x18ff47['autoAssociation']===0x0){return db[_0x0be9('0x52')][_0x0be9('0x4c')]({'name':_0x2e2023[_0x0be9('0x2d')],'resourceId':_0x2e2023['id'],'type':_0x18ff47[_0x0be9('0x2d')],'sectionId':_0x18ff47['id']},{})['then'](function(){return _0x4c4d08;});}else{return _0x4c4d08;}})[_0x0be9('0x47')](function(_0x586f6b){logger[_0x0be9('0x2e')](_0x0be9('0x53'),_0x586f6b);throw _0x586f6b;});}return _0x4c4d08;});}})[_0x0be9('0x23')](respondWithResult(_0xb9979d,0xc9))[_0x0be9('0x47')](handleError(_0xb9979d,null));};exports[_0x0be9('0x59')]=function(_0x382002,_0x407c9e){if(_0x382002[_0x0be9('0x4d')]['id']){delete _0x382002[_0x0be9('0x4d')]['id'];}return db[_0x0be9('0x32')][_0x0be9('0x2c')]({'where':{'id':_0x382002[_0x0be9('0x49')]['id']}})[_0x0be9('0x23')](handleEntityNotFound(_0x407c9e,null))[_0x0be9('0x23')](saveUpdates(_0x382002[_0x0be9('0x4d')],null))[_0x0be9('0x23')](respondWithResult(_0x407c9e,null))[_0x0be9('0x47')](handleError(_0x407c9e,null));};exports[_0x0be9('0x5a')]=function(_0x382674,_0x3ee136){return db[_0x0be9('0x32')][_0x0be9('0x2c')]({'where':{'id':_0x382674[_0x0be9('0x49')]['id']}})[_0x0be9('0x23')](handleEntityNotFound(_0x3ee136,null))[_0x0be9('0x23')](removeEntity(_0x3ee136,null))['catch'](handleError(_0x3ee136,null));};exports['getHoppers']=function(_0x452457,_0x393f7d,_0x345cdc){var _0x4c93bb={'raw':![],'where':{}};var _0x21bf0c={};var _0x5f551c={'count':0x0,'rows':[]};return db[_0x0be9('0x32')][_0x0be9('0x5b')]({'where':{'id':_0x452457[_0x0be9('0x49')]['id']}})[_0x0be9('0x23')](handleEntityNotFound(_0x393f7d,null))[_0x0be9('0x23')](function(_0x25510a){if(_0x25510a){_0x21bf0c[_0x0be9('0x34')]=_['keys'](db[_0x0be9('0x5c')][_0x0be9('0x5d')]);_0x21bf0c[_0x0be9('0x35')]=_[_0x0be9('0x4a')](_0x452457[_0x0be9('0x35')]);_0x21bf0c[_0x0be9('0x36')]=_[_0x0be9('0x37')](_0x21bf0c[_0x0be9('0x34')],_0x21bf0c[_0x0be9('0x35')]);_0x4c93bb[_0x0be9('0x38')]=_[_0x0be9('0x37')](_0x21bf0c[_0x0be9('0x34')],qs[_0x0be9('0x4b')](_0x452457[_0x0be9('0x35')][_0x0be9('0x4b')]));_0x4c93bb[_0x0be9('0x38')]=_0x4c93bb[_0x0be9('0x38')][_0x0be9('0x39')]?_0x4c93bb['attributes']:_0x21bf0c[_0x0be9('0x34')];if(!_0x452457[_0x0be9('0x35')][_0x0be9('0x3a')]('nolimit')){_0x4c93bb[_0x0be9('0x3b')]=qs[_0x0be9('0x3b')](_0x452457[_0x0be9('0x35')][_0x0be9('0x3b')]);_0x4c93bb[_0x0be9('0x20')]=qs['offset'](_0x452457[_0x0be9('0x35')][_0x0be9('0x20')]);}_0x4c93bb['order']=qs[_0x0be9('0x3d')](_0x452457[_0x0be9('0x35')][_0x0be9('0x3d')]);_0x4c93bb['where']=qs[_0x0be9('0x36')](_[_0x0be9('0x3e')](_0x452457[_0x0be9('0x35')],_0x21bf0c[_0x0be9('0x36')]));_0x4c93bb['where'][_0x0be9('0x5e')]=_0x25510a['id'];if(_0x452457['query']['filter']){_0x4c93bb[_0x0be9('0x3f')]=_[_0x0be9('0x40')](_0x4c93bb[_0x0be9('0x3f')],{'$or':_[_0x0be9('0x29')](_0x4c93bb[_0x0be9('0x38')],function(_0x302ed8){var _0x264944={};_0x264944[_0x302ed8]={'$like':'%'+_0x452457['query'][_0x0be9('0x42')]+'%'};return _0x264944;})});}_0x4c93bb=_[_0x0be9('0x40')]({},_0x4c93bb,_0x452457[_0x0be9('0x43')]);return db['CmHopper']['count']({'where':_0x4c93bb[_0x0be9('0x3f')]})['then'](function(_0x33356b){_0x5f551c['count']=_0x33356b;if(_0x452457[_0x0be9('0x35')][_0x0be9('0x44')]){_0x4c93bb[_0x0be9('0x45')]=[{'all':!![]}];}return db[_0x0be9('0x5c')][_0x0be9('0x46')](_0x4c93bb);})['then'](function(_0x28b4b0){_0x5f551c['rows']=_0x28b4b0;return _0x5f551c;});}})[_0x0be9('0x23')](respondWithFilteredResult(_0x393f7d,_0x4c93bb))[_0x0be9('0x47')](handleError(_0x393f7d,null));};exports[_0x0be9('0x5f')]=function(_0x52980d,_0x473d2e,_0x577e97){var _0x1c0668={'raw':!![],'where':{}};var _0x357433={};var _0x1b7876={'count':0x0,'rows':[]};return db[_0x0be9('0x32')]['findOne']({'where':{'id':_0x52980d[_0x0be9('0x49')]['id']}})[_0x0be9('0x23')](handleEntityNotFound(_0x473d2e,null))['then'](function(_0x581f93){if(_0x581f93){_0x357433[_0x0be9('0x34')]=_[_0x0be9('0x4a')](db['CmHopperHistory'][_0x0be9('0x5d')]);_0x357433[_0x0be9('0x35')]=_[_0x0be9('0x4a')](_0x52980d[_0x0be9('0x35')]);_0x357433[_0x0be9('0x36')]=_[_0x0be9('0x37')](_0x357433[_0x0be9('0x34')],_0x357433['query']);_0x1c0668[_0x0be9('0x38')]=_[_0x0be9('0x37')](_0x357433[_0x0be9('0x34')],qs[_0x0be9('0x4b')](_0x52980d[_0x0be9('0x35')][_0x0be9('0x4b')]));_0x1c0668['attributes']=_0x1c0668[_0x0be9('0x38')][_0x0be9('0x39')]?_0x1c0668[_0x0be9('0x38')]:_0x357433[_0x0be9('0x34')];if(!_0x52980d[_0x0be9('0x35')][_0x0be9('0x3a')](_0x0be9('0x60'))){_0x1c0668[_0x0be9('0x3b')]=qs['limit'](_0x52980d[_0x0be9('0x35')]['limit']);_0x1c0668[_0x0be9('0x20')]=qs[_0x0be9('0x20')](_0x52980d[_0x0be9('0x35')][_0x0be9('0x20')]);}_0x1c0668[_0x0be9('0x3c')]=qs[_0x0be9('0x3d')](_0x52980d[_0x0be9('0x35')][_0x0be9('0x3d')]);_0x1c0668[_0x0be9('0x3f')]=qs[_0x0be9('0x36')](_[_0x0be9('0x3e')](_0x52980d[_0x0be9('0x35')],_0x357433[_0x0be9('0x36')]));_0x1c0668[_0x0be9('0x3f')]['VoiceQueueId']=_0x581f93['id'];if(_0x52980d[_0x0be9('0x35')][_0x0be9('0x42')]){_0x1c0668[_0x0be9('0x3f')]=_[_0x0be9('0x40')](_0x1c0668['where'],{'$or':_['map'](_0x1c0668[_0x0be9('0x38')],function(_0x58ad29){var _0x1d2e65={};_0x1d2e65[_0x58ad29]={'$like':'%'+_0x52980d['query'][_0x0be9('0x42')]+'%'};return _0x1d2e65;})});}_0x1c0668=_[_0x0be9('0x40')]({},_0x1c0668,_0x52980d[_0x0be9('0x43')]);return db['CmHopperHistory'][_0x0be9('0x1f')]({'where':_0x1c0668[_0x0be9('0x3f')]})['then'](function(_0x5a82c3){_0x1b7876[_0x0be9('0x1f')]=_0x5a82c3;if(_0x52980d['query'][_0x0be9('0x44')]){_0x1c0668[_0x0be9('0x45')]=[{'all':!![]}];}return db[_0x0be9('0x61')]['findAll'](_0x1c0668);})[_0x0be9('0x23')](function(_0xa9e231){_0x1b7876[_0x0be9('0x62')]=_0xa9e231;return _0x1b7876;});}})[_0x0be9('0x23')](respondWithFilteredResult(_0x473d2e,_0x1c0668))[_0x0be9('0x47')](handleError(_0x473d2e,null));};exports[_0x0be9('0x63')]=function(_0x5775bc,_0x5615bc,_0x950a35){var _0x43e416={'raw':!![],'where':{}};var _0x111be6={};var _0x2f995d={'count':0x0,'rows':[]};return db[_0x0be9('0x32')][_0x0be9('0x5b')]({'where':{'id':_0x5775bc[_0x0be9('0x49')]['id']}})[_0x0be9('0x23')](handleEntityNotFound(_0x5615bc,null))[_0x0be9('0x23')](function(_0x5dd9ae){if(_0x5dd9ae){_0x111be6[_0x0be9('0x34')]=_[_0x0be9('0x4a')](db[_0x0be9('0x64')]['rawAttributes']);_0x111be6[_0x0be9('0x35')]=_[_0x0be9('0x4a')](_0x5775bc['query']);_0x111be6[_0x0be9('0x36')]=_[_0x0be9('0x37')](_0x111be6[_0x0be9('0x34')],_0x111be6[_0x0be9('0x35')]);_0x43e416[_0x0be9('0x38')]=_[_0x0be9('0x37')](_0x111be6[_0x0be9('0x34')],qs[_0x0be9('0x4b')](_0x5775bc[_0x0be9('0x35')][_0x0be9('0x4b')]));_0x43e416[_0x0be9('0x38')]=_0x43e416[_0x0be9('0x38')]['length']?_0x43e416['attributes']:_0x111be6['model'];if(!_0x5775bc[_0x0be9('0x35')]['hasOwnProperty']('nolimit')){_0x43e416[_0x0be9('0x3b')]=qs[_0x0be9('0x3b')](_0x5775bc[_0x0be9('0x35')][_0x0be9('0x3b')]);_0x43e416[_0x0be9('0x20')]=qs[_0x0be9('0x20')](_0x5775bc[_0x0be9('0x35')]['offset']);}_0x43e416[_0x0be9('0x3c')]=qs['sort'](_0x5775bc[_0x0be9('0x35')]['sort']);_0x43e416[_0x0be9('0x3f')]=qs[_0x0be9('0x36')](_[_0x0be9('0x3e')](_0x5775bc[_0x0be9('0x35')],_0x111be6[_0x0be9('0x36')]));_0x43e416['where']['VoiceQueueId']=_0x5dd9ae['id'];if(_0x5775bc['query'][_0x0be9('0x42')]){_0x43e416[_0x0be9('0x3f')]=_[_0x0be9('0x40')](_0x43e416['where'],{'$or':_[_0x0be9('0x29')](_0x43e416[_0x0be9('0x38')],function(_0x59b4bb){var _0x4b801c={};_0x4b801c[_0x59b4bb]={'$like':'%'+_0x5775bc[_0x0be9('0x35')]['filter']+'%'};return _0x4b801c;})});}_0x43e416=_[_0x0be9('0x40')]({},_0x43e416,_0x5775bc['options']);return db[_0x0be9('0x64')]['count']({'where':_0x43e416['where']})[_0x0be9('0x23')](function(_0x47ceb0){_0x2f995d[_0x0be9('0x1f')]=_0x47ceb0;if(_0x5775bc[_0x0be9('0x35')][_0x0be9('0x44')]){_0x43e416[_0x0be9('0x45')]=[{'all':!![]}];}return db[_0x0be9('0x64')][_0x0be9('0x46')](_0x43e416);})['then'](function(_0x40c7b4){_0x2f995d[_0x0be9('0x62')]=_0x40c7b4;return _0x2f995d;});}})[_0x0be9('0x23')](respondWithFilteredResult(_0x5615bc,_0x43e416))[_0x0be9('0x47')](handleError(_0x5615bc,null));};exports[_0x0be9('0x65')]=function(_0x485eb7,_0x5c4c8b,_0x4a2620){var _0x3d6779={'raw':!![],'where':{}};var _0x37497e={};var _0x40c81d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x0be9('0x5b')]({'where':{'id':_0x485eb7[_0x0be9('0x49')]['id']}})[_0x0be9('0x23')](handleEntityNotFound(_0x5c4c8b,null))[_0x0be9('0x23')](function(_0x383499){if(_0x383499){_0x37497e['model']=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x37497e[_0x0be9('0x35')]=_[_0x0be9('0x4a')](_0x485eb7[_0x0be9('0x35')]);_0x37497e[_0x0be9('0x36')]=_[_0x0be9('0x37')](_0x37497e['model'],_0x37497e[_0x0be9('0x35')]);_0x3d6779[_0x0be9('0x38')]=_[_0x0be9('0x37')](_0x37497e[_0x0be9('0x34')],qs['fields'](_0x485eb7[_0x0be9('0x35')][_0x0be9('0x4b')]));_0x3d6779[_0x0be9('0x38')]=_0x3d6779[_0x0be9('0x38')][_0x0be9('0x39')]?_0x3d6779['attributes']:_0x37497e['model'];if(!_0x485eb7[_0x0be9('0x35')][_0x0be9('0x3a')](_0x0be9('0x60'))){_0x3d6779['limit']=qs['limit'](_0x485eb7[_0x0be9('0x35')][_0x0be9('0x3b')]);_0x3d6779[_0x0be9('0x20')]=qs[_0x0be9('0x20')](_0x485eb7[_0x0be9('0x35')][_0x0be9('0x20')]);}_0x3d6779[_0x0be9('0x3c')]=qs[_0x0be9('0x3d')](_0x485eb7[_0x0be9('0x35')][_0x0be9('0x3d')]);_0x3d6779['where']=qs[_0x0be9('0x36')](_[_0x0be9('0x3e')](_0x485eb7[_0x0be9('0x35')],_0x37497e[_0x0be9('0x36')]));_0x3d6779['where'][_0x0be9('0x5e')]=_0x383499['id'];if(_0x485eb7[_0x0be9('0x35')][_0x0be9('0x42')]){_0x3d6779['where']=_[_0x0be9('0x40')](_0x3d6779[_0x0be9('0x3f')],{'$or':_[_0x0be9('0x29')](_0x3d6779[_0x0be9('0x38')],function(_0x2e012f){var _0x3a3e25={};_0x3a3e25[_0x2e012f]={'$like':'%'+_0x485eb7[_0x0be9('0x35')][_0x0be9('0x42')]+'%'};return _0x3a3e25;})});}_0x3d6779=_[_0x0be9('0x40')]({},_0x3d6779,_0x485eb7[_0x0be9('0x43')]);return db['CmHopperBlack'][_0x0be9('0x1f')]({'where':_0x3d6779[_0x0be9('0x3f')]})[_0x0be9('0x23')](function(_0x22d020){_0x40c81d[_0x0be9('0x1f')]=_0x22d020;if(_0x485eb7[_0x0be9('0x35')][_0x0be9('0x44')]){_0x3d6779[_0x0be9('0x45')]=[{'all':!![]}];}return db[_0x0be9('0x66')]['findAll'](_0x3d6779);})[_0x0be9('0x23')](function(_0x1a7d8d){_0x40c81d[_0x0be9('0x62')]=_0x1a7d8d;return _0x40c81d;});}})['then'](respondWithFilteredResult(_0x5c4c8b,_0x3d6779))[_0x0be9('0x47')](handleError(_0x5c4c8b,null));};exports[_0x0be9('0x67')]=function(_0xf0a0e2,_0x55ca2a,_0x3497d2){var _0x3d5949={};var _0x2bd616={};var _0x135618;var _0x50ba4a;return db['VoiceQueue'][_0x0be9('0x5b')]({'where':{'id':_0xf0a0e2[_0x0be9('0x49')]['id']}})['then'](handleEntityNotFound(_0x55ca2a,null))[_0x0be9('0x23')](function(_0x25faca){if(_0x25faca){_0x135618=_0x25faca;_0x2bd616[_0x0be9('0x34')]=_[_0x0be9('0x4a')](db[_0x0be9('0x68')][_0x0be9('0x5d')]);_0x2bd616[_0x0be9('0x35')]=_[_0x0be9('0x4a')](_0xf0a0e2[_0x0be9('0x35')]);_0x2bd616['filters']=_[_0x0be9('0x37')](_0x2bd616['model'],_0x2bd616[_0x0be9('0x35')]);_0x3d5949[_0x0be9('0x38')]=_[_0x0be9('0x37')](_0x2bd616[_0x0be9('0x34')],qs[_0x0be9('0x4b')](_0xf0a0e2[_0x0be9('0x35')][_0x0be9('0x4b')]));_0x3d5949[_0x0be9('0x38')]=_0x3d5949[_0x0be9('0x38')][_0x0be9('0x39')]?_0x3d5949['attributes']:_0x2bd616[_0x0be9('0x34')];_0x3d5949[_0x0be9('0x3c')]=qs[_0x0be9('0x3d')](_0xf0a0e2['query'][_0x0be9('0x3d')]);_0x3d5949[_0x0be9('0x3f')]=qs[_0x0be9('0x36')](_[_0x0be9('0x3e')](_0xf0a0e2['query'],_0x2bd616[_0x0be9('0x36')]));if(_0xf0a0e2['query'][_0x0be9('0x42')]){_0x3d5949[_0x0be9('0x3f')]=_[_0x0be9('0x40')](_0x3d5949[_0x0be9('0x3f')],{'$or':_[_0x0be9('0x29')](_0x3d5949[_0x0be9('0x38')],function(_0x3f3557){var _0x243597={};_0x243597[_0x3f3557]={'$like':'%'+_0xf0a0e2[_0x0be9('0x35')]['filter']+'%'};return _0x243597;})});}_0x3d5949=_[_0x0be9('0x40')]({},_0x3d5949,_0xf0a0e2['options']);return _0x135618[_0x0be9('0x67')](_0x3d5949);}})[_0x0be9('0x23')](function(_0x13cf15){if(_0x13cf15){_0x50ba4a=_0x13cf15[_0x0be9('0x39')];if(!_0xf0a0e2[_0x0be9('0x35')][_0x0be9('0x3a')](_0x0be9('0x60'))){_0x3d5949['limit']=qs[_0x0be9('0x3b')](_0xf0a0e2[_0x0be9('0x35')][_0x0be9('0x3b')]);_0x3d5949[_0x0be9('0x20')]=qs[_0x0be9('0x20')](_0xf0a0e2['query'][_0x0be9('0x20')]);}return _0x135618[_0x0be9('0x67')](_0x3d5949);}})[_0x0be9('0x23')](function(_0x21bc47){if(_0x21bc47){return _0x21bc47?{'count':_0x50ba4a,'rows':_0x21bc47}:null;}})[_0x0be9('0x23')](respondWithResult(_0x55ca2a,null))[_0x0be9('0x47')](handleError(_0x55ca2a,null));};exports['addTeams']=function(_0x1d22e7,_0x5f4fb0,_0x2ca5b4){var _0x2f49a5=_0x1d22e7['body']['teams'];var _0x35f941=_[_0x0be9('0x29')](_0x2f49a5,'id');return db[_0x0be9('0x68')][_0x0be9('0x46')]({'where':{'id':_0x35f941},'attributes':['id'],'include':[{'model':db[_0x0be9('0x69')],'as':_0x0be9('0x6a'),'attributes':['id',_0x0be9('0x2d'),_0x0be9('0x6b'),'voicePause',_0x0be9('0x6c')],'raw':!![]}]})[_0x0be9('0x23')](function(_0x2181d2){if(_0x2181d2){var _0x20b50d=_['flatMap'](_0x2181d2,function(_0x5f36f9){var _0x667609=_0x5f36f9[_0x0be9('0x24')]({'plain':!![]});_0x667609[_0x0be9('0x6a')][_0x0be9('0x6d')](function(_0x5b1dd3){_0x5b1dd3[_0x0be9('0x6e')]=_[_0x0be9('0x2c')](_0x2f49a5,{'id':_0x667609['id']})[_0x0be9('0x6e')];});return _0x667609[_0x0be9('0x6a')];});return db[_0x0be9('0x32')][_0x0be9('0x2c')]({'where':{'id':_0x1d22e7[_0x0be9('0x49')]['id']}})[_0x0be9('0x23')](function(_0x3406c7){return db[_0x0be9('0x6f')][_0x0be9('0x70')](function(_0x106cc7){return _0x3406c7['addTeams'](_0x35f941,{'transaction':_0x106cc7})[_0x0be9('0x23')](function(){return BPromise[_0x0be9('0x71')](_0x20b50d,function(_0x245d16){return db[_0x0be9('0x72')][_0x0be9('0x73')]({'where':{'UserId':_0x245d16['id'],'VoiceQueueId':_0x1d22e7[_0x0be9('0x49')]['id']},'defaults':{'penalty':_0x245d16[_0x0be9('0x6e')]},'transaction':_0x106cc7});});})['then'](function(){return BPromise[_0x0be9('0x71')](_[_0x0be9('0x42')](_0x20b50d,{'online':!![]}),function(_0x359642){return db['UserVoiceQueueRt'][_0x0be9('0x74')]({'membername':_0x359642['name'],'UserId':_0x359642['id'],'queue_name':_0x3406c7[_0x0be9('0x2d')],'VoiceQueueId':_0x3406c7['id'],'interface':_[_0x0be9('0x75')](_0x359642[_0x0be9('0x6c')])?util['format']('SIP/%s',_0x359642[_0x0be9('0x2d')]):_0x359642[_0x0be9('0x6c')],'paused':_0x359642[_0x0be9('0x76')]||![],'penalty':_0x359642[_0x0be9('0x6e')]},{'transaction':_0x106cc7});});})[_0x0be9('0x23')](function(){_0x20b50d[_0x0be9('0x6d')](function(_0x2eec60){socket[_0x0be9('0x77')]('userVoiceQueue:save',{'UserId':_0x2eec60['id'],'VoiceQueueId':_0x3406c7['id']});});});});});}})['then'](respondWithStatusCode(_0x5f4fb0,null))['catch'](handleError(_0x5f4fb0,null));};exports['removeTeams']=function(_0x2f9997,_0x3518e2,_0x50ca90){return db[_0x0be9('0x68')][_0x0be9('0x46')]({'where':{'id':_0x2f9997[_0x0be9('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0be9('0x69')],'as':_0x0be9('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3518e2,null))['then'](function(_0xc3a8ac){var _0x8baf7e=_[_0x0be9('0x29')](_0xc3a8ac,'id');var _0x304679=[];var _0x1c409a=[];var _0x15b8ff=squel[_0x0be9('0x78')]();_0x15b8ff['field'](_0x0be9('0x79'))[_0x0be9('0x7a')](_0x0be9('0x7b'),'tq')[_0x0be9('0x7c')](_0x0be9('0x7d'),'ut',_0x0be9('0x7e'))[_0x0be9('0x3f')]('VoiceQueueId\x20=\x20?',_0x2f9997[_0x0be9('0x49')]['id']);for(var _0x9f77f4=0x0;_0x9f77f4<_0xc3a8ac[_0x0be9('0x39')];_0x9f77f4+=0x1){let _0x1d9afb=_0xc3a8ac[_0x9f77f4];for(var _0x17a33c=0x0;_0x17a33c<_0x1d9afb['Agents']['length'];_0x17a33c+=0x1){let _0x201bab=_0x1d9afb[_0x0be9('0x6a')][_0x17a33c];var _0x204eb7=_0x15b8ff[_0x0be9('0x54')]();_0x204eb7[_0x0be9('0x3f')](_0x0be9('0x7f'),_0x201bab['id']);_0x1c409a[_0x0be9('0x80')](db[_0x0be9('0x6f')]['query'](_0x204eb7['toString'](),{'type':db[_0x0be9('0x6f')]['QueryTypes'][_0x0be9('0x81')]})[_0x0be9('0x23')](function(_0x5d6628){if(_0x5d6628[_0x0be9('0x39')]===0x1){return _0x201bab['id'];}else{var _0x1504db=_[_0x0be9('0x82')](_[_0x0be9('0x29')](_0x5d6628,_0x0be9('0x83')),function(_0x39022b){return _[_0x0be9('0x84')](_0x8baf7e,_0x39022b);});if(_0x1504db){return _0x201bab['id'];}}}));}}return BPromise[_0x0be9('0x85')](_0x1c409a)[_0x0be9('0x23')](function(_0x2d4442){_0x304679=_(_0x304679)[_0x0be9('0x86')](_0x2d4442)[_0x0be9('0x87')]()['value']();return db[_0x0be9('0x32')][_0x0be9('0x2c')]({'where':{'id':_0x2f9997[_0x0be9('0x49')]['id']}})['then'](function(_0x34a8a6){return db['sequelize']['transaction'](function(_0x3cb223){return _0x34a8a6[_0x0be9('0x88')](_0x2f9997['query']['ids'],{'transaction':_0x3cb223})[_0x0be9('0x23')](function(){if(!_['isEmpty'](_0x304679)){return _0x34a8a6['removeAgents'](_0x304679,{'transaction':_0x3cb223})[_0x0be9('0x23')](function(){return db[_0x0be9('0x89')][_0x0be9('0x5a')]({'where':{'VoiceQueueId':_0x2f9997[_0x0be9('0x49')]['id'],'UserId':_0x304679},'transaction':_0x3cb223});});}})[_0x0be9('0x23')](function(){_0x304679['forEach'](function(_0x1923ce){socket[_0x0be9('0x77')](_0x0be9('0x8a'),{'UserId':_0x1923ce,'VoiceQueueId':_0x34a8a6['id']});});});});});});})['then'](respondWithStatusCode(_0x3518e2,null))['catch'](handleError(_0x3518e2,null));};exports[_0x0be9('0x8b')]=function(_0x1e965b,_0x1d8e21,_0x393517){var _0x52cdad,_0x43b217;return db[_0x0be9('0x32')][_0x0be9('0x2c')]({'where':{'id':_0x1e965b[_0x0be9('0x49')]['id']}})['then'](handleEntityNotFound(_0x1d8e21,null))[_0x0be9('0x23')](function(_0x1be60f){if(_0x1be60f){_0x43b217=_0x1be60f;return _0x1be60f[_0x0be9('0x8b')](_0x1e965b['body'][_0x0be9('0x8c')],_['omit'](_0x1e965b[_0x0be9('0x4d')],[_0x0be9('0x8c'),'id'])||{})[_0x0be9('0x8d')](function(_0x4217cf){for(var _0x1c661e=0x0;_0x1c661e<_0x1e965b[_0x0be9('0x4d')][_0x0be9('0x8c')]['length'];_0x1c661e+=0x1){socket[_0x0be9('0x77')](_0x0be9('0x8e'),{'UserId':_0x1e965b['body']['ids'][_0x1c661e],'VoiceQueueId':_0x1e965b['params']['id']});}return _0x4217cf;});}})['then'](function(_0x2f6521){_0x52cdad=_0x2f6521||[];if(_0x43b217){return db[_0x0be9('0x69')][_0x0be9('0x46')]({'where':{'id':_0x1e965b[_0x0be9('0x4d')][_0x0be9('0x8c')]},'attributes':['id',_0x0be9('0x2d'),_0x0be9('0x6b'),_0x0be9('0x76'),_0x0be9('0x6c')],'raw':!![]});}})[_0x0be9('0x23')](function(_0xa5eeba){if(!_[_0x0be9('0x8f')](_0xa5eeba)){var _0x53a4f9=[];for(var _0x378547=0x0;_0x378547<_0xa5eeba[_0x0be9('0x39')];_0x378547++){if(_0xa5eeba[_0x378547]['online']){_0x53a4f9[_0x0be9('0x80')](db['UserVoiceQueueRt'][_0x0be9('0x74')]({'membername':_0xa5eeba[_0x378547]['name'],'UserId':_0xa5eeba[_0x378547]['id'],'queue_name':_0x43b217[_0x0be9('0x2d')],'VoiceQueueId':_0x43b217['id'],'interface':_['isNil'](_0xa5eeba[_0x378547][_0x0be9('0x6c')])?util[_0x0be9('0x90')](_0x0be9('0x91'),_0xa5eeba[_0x378547][_0x0be9('0x2d')]):_0xa5eeba[_0x378547]['interface'],'paused':_0xa5eeba[_0x378547][_0x0be9('0x76')]||![],'penalty':_0x1e965b[_0x0be9('0x4d')][_0x0be9('0x6e')]||0x0}));}}return BPromise[_0x0be9('0x85')](_0x53a4f9);}})[_0x0be9('0x23')](function(){return _0x52cdad;})[_0x0be9('0x23')](respondWithResult(_0x1d8e21,null))[_0x0be9('0x47')](handleError(_0x1d8e21,null));};exports[_0x0be9('0x92')]=function(_0x1999eb,_0x48ec6d,_0x2c1991){return db['VoiceQueue'][_0x0be9('0x2c')]({'where':{'id':_0x1999eb[_0x0be9('0x49')]['id']}})['then'](handleEntityNotFound(_0x48ec6d,null))[_0x0be9('0x23')](function(_0x2db963){if(_0x2db963){return _0x2db963[_0x0be9('0x92')](_0x1999eb[_0x0be9('0x35')]['ids'])[_0x0be9('0x23')](function(){if(_[_0x0be9('0x93')](_0x1999eb[_0x0be9('0x35')][_0x0be9('0x8c')])){for(var _0x3fc52b=0x0;_0x3fc52b<_0x1999eb['query'][_0x0be9('0x8c')][_0x0be9('0x39')];_0x3fc52b+=0x1){socket[_0x0be9('0x77')](_0x0be9('0x8a'),{'UserId':Number(_0x1999eb[_0x0be9('0x35')][_0x0be9('0x8c')][_0x3fc52b]),'VoiceQueueId':Number(_0x1999eb['params']['id'])});}}else{socket['emit'](_0x0be9('0x8a'),{'UserId':Number(_0x1999eb['query'][_0x0be9('0x8c')]),'VoiceQueueId':Number(_0x1999eb['params']['id'])});}});}})[_0x0be9('0x23')](function(_0xd44f6b){return db['UserVoiceQueueRt'][_0x0be9('0x5a')]({'where':{'VoiceQueueId':_0x1999eb[_0x0be9('0x49')]['id'],'UserId':_0x1999eb[_0x0be9('0x35')][_0x0be9('0x8c')]}})[_0x0be9('0x23')](function(){return _0xd44f6b;});})[_0x0be9('0x23')](respondWithStatusCode(_0x48ec6d,null))['catch'](handleError(_0x48ec6d,null));};exports[_0x0be9('0x94')]=function(_0x3c32f0,_0x5d6207,_0x34cfe8){var _0x3134fc={};var _0x5e4f7e={};var _0x2f50d2;var _0x2480d5;return db[_0x0be9('0x32')][_0x0be9('0x5b')]({'where':{'id':_0x3c32f0[_0x0be9('0x49')]['id']}})[_0x0be9('0x23')](handleEntityNotFound(_0x5d6207,null))[_0x0be9('0x23')](function(_0x324b5c){if(_0x324b5c){_0x2f50d2=_0x324b5c;_0x5e4f7e['model']=_[_0x0be9('0x4a')](db[_0x0be9('0x69')]['rawAttributes']);_0x5e4f7e[_0x0be9('0x35')]=_[_0x0be9('0x4a')](_0x3c32f0[_0x0be9('0x35')]);_0x5e4f7e['filters']=_['intersection'](_0x5e4f7e[_0x0be9('0x34')],_0x5e4f7e['query']);_0x3134fc[_0x0be9('0x38')]=_[_0x0be9('0x37')](_0x5e4f7e[_0x0be9('0x34')],qs['fields'](_0x3c32f0[_0x0be9('0x35')]['fields']));_0x3134fc[_0x0be9('0x38')]=_0x3134fc[_0x0be9('0x38')][_0x0be9('0x39')]?_0x3134fc[_0x0be9('0x38')]:_0x5e4f7e['model'];_0x3134fc[_0x0be9('0x3c')]=qs[_0x0be9('0x3d')](_0x3c32f0[_0x0be9('0x35')][_0x0be9('0x3d')]);_0x3134fc[_0x0be9('0x3f')]=qs[_0x0be9('0x36')](_[_0x0be9('0x3e')](_0x3c32f0[_0x0be9('0x35')],_0x5e4f7e[_0x0be9('0x36')]));if(_0x3c32f0['query'][_0x0be9('0x42')]){_0x3134fc['where']=_['merge'](_0x3134fc[_0x0be9('0x3f')],{'$or':_['map'](_0x3134fc[_0x0be9('0x38')],function(_0x3a1b94){var _0x2d0791={};_0x2d0791[_0x3a1b94]={'$like':'%'+_0x3c32f0[_0x0be9('0x35')][_0x0be9('0x42')]+'%'};return _0x2d0791;})});}_0x3134fc=_[_0x0be9('0x40')]({},_0x3134fc,_0x3c32f0[_0x0be9('0x43')]);return _0x2f50d2[_0x0be9('0x94')](_0x3134fc);}})[_0x0be9('0x23')](function(_0x1ceac9){if(_0x1ceac9){_0x2480d5=_0x1ceac9[_0x0be9('0x39')];if(!_0x3c32f0['query'][_0x0be9('0x3a')](_0x0be9('0x60'))){_0x3134fc[_0x0be9('0x3b')]=qs['limit'](_0x3c32f0[_0x0be9('0x35')][_0x0be9('0x3b')]);_0x3134fc[_0x0be9('0x20')]=qs['offset'](_0x3c32f0[_0x0be9('0x35')][_0x0be9('0x20')]);}return _0x2f50d2['getAgents'](_0x3134fc);}})[_0x0be9('0x23')](function(_0x1b0c38){if(_0x1b0c38){return _0x1b0c38?{'count':_0x2480d5,'rows':_0x1b0c38}:null;}})['then'](respondWithResult(_0x5d6207,null))[_0x0be9('0x47')](handleError(_0x5d6207,null));};exports['getMembers']=function(_0x16d435,_0x407e32,_0x10ae5b){var _0xb512a2={};var _0x913d27={};var _0x5440e2;var _0x507a67;return db['VoiceQueue'][_0x0be9('0x5b')]({'where':{'id':_0x16d435['params']['id']}})[_0x0be9('0x23')](handleEntityNotFound(_0x407e32,null))[_0x0be9('0x23')](function(_0x354be2){if(_0x354be2){_0x5440e2=_0x354be2;_0x913d27[_0x0be9('0x34')]=_[_0x0be9('0x4a')](db[_0x0be9('0x89')]['rawAttributes']);_0x913d27['query']=_['keys'](_0x16d435['query']);_0x913d27['filters']=_[_0x0be9('0x37')](_0x913d27[_0x0be9('0x34')],_0x913d27[_0x0be9('0x35')]);_0xb512a2[_0x0be9('0x38')]=_[_0x0be9('0x37')](_0x913d27[_0x0be9('0x34')],qs[_0x0be9('0x4b')](_0x16d435[_0x0be9('0x35')]['fields']));_0xb512a2[_0x0be9('0x38')]=_0xb512a2[_0x0be9('0x38')][_0x0be9('0x39')]?_0xb512a2[_0x0be9('0x38')]:_0x913d27[_0x0be9('0x34')];_0xb512a2['order']=qs[_0x0be9('0x3d')](_0x16d435[_0x0be9('0x35')][_0x0be9('0x3d')]);_0xb512a2['where']=qs[_0x0be9('0x36')](_[_0x0be9('0x3e')](_0x16d435[_0x0be9('0x35')],_0x913d27['filters']));if(_0x16d435[_0x0be9('0x35')][_0x0be9('0x42')]){_0xb512a2['where']=_[_0x0be9('0x40')](_0xb512a2[_0x0be9('0x3f')],{'$or':_['map'](_0xb512a2[_0x0be9('0x38')],function(_0x441ec0){var _0xf54c10={};_0xf54c10[_0x441ec0]={'$like':'%'+_0x16d435[_0x0be9('0x35')][_0x0be9('0x42')]+'%'};return _0xf54c10;})});}_0xb512a2=_[_0x0be9('0x40')]({},_0xb512a2,_0x16d435['options']);return _0x5440e2[_0x0be9('0x95')](_0xb512a2);}})[_0x0be9('0x23')](function(_0x41b280){if(_0x41b280){_0x507a67=_0x41b280[_0x0be9('0x39')];if(!_0x16d435[_0x0be9('0x35')][_0x0be9('0x3a')](_0x0be9('0x60'))){_0xb512a2[_0x0be9('0x3b')]=qs[_0x0be9('0x3b')](_0x16d435[_0x0be9('0x35')][_0x0be9('0x3b')]);_0xb512a2[_0x0be9('0x20')]=qs[_0x0be9('0x20')](_0x16d435[_0x0be9('0x35')][_0x0be9('0x20')]);}return _0x5440e2[_0x0be9('0x95')](_0xb512a2);}})['then'](function(_0x4378b0){return _0x4378b0?{'count':_0x507a67,'rows':_0x4378b0}:null;})[_0x0be9('0x23')](respondWithResult(_0x407e32,null))[_0x0be9('0x47')](handleError(_0x407e32,null));};exports[_0x0be9('0x96')]=function(_0x214a50,_0x42e100,_0x1f4c1f){var _0xc51b57={};var _0x1de82d={};var _0x255dd4;var _0x23faa5;return db[_0x0be9('0x32')][_0x0be9('0x5b')]({'where':{'id':_0x214a50[_0x0be9('0x49')]['id']}})['then'](handleEntityNotFound(_0x42e100,null))[_0x0be9('0x23')](function(_0x44db59){if(_0x44db59){_0x255dd4=_0x44db59;_0x1de82d[_0x0be9('0x34')]=_['keys'](db[_0x0be9('0x97')][_0x0be9('0x5d')]);_0x1de82d[_0x0be9('0x35')]=_[_0x0be9('0x4a')](_0x214a50['query']);_0x1de82d['filters']=_['intersection'](_0x1de82d[_0x0be9('0x34')],_0x1de82d[_0x0be9('0x35')]);_0xc51b57[_0x0be9('0x38')]=_[_0x0be9('0x37')](_0x1de82d[_0x0be9('0x34')],qs[_0x0be9('0x4b')](_0x214a50[_0x0be9('0x35')]['fields']));_0xc51b57[_0x0be9('0x38')]=_0xc51b57[_0x0be9('0x38')][_0x0be9('0x39')]?_0xc51b57[_0x0be9('0x38')]:_0x1de82d[_0x0be9('0x34')];_0xc51b57[_0x0be9('0x3c')]=qs['sort'](_0x214a50[_0x0be9('0x35')][_0x0be9('0x3d')]);_0xc51b57['where']=qs[_0x0be9('0x36')](_[_0x0be9('0x3e')](_0x214a50[_0x0be9('0x35')],_0x1de82d[_0x0be9('0x36')]));if(_0x214a50[_0x0be9('0x35')][_0x0be9('0x42')]){_0xc51b57[_0x0be9('0x3f')]=_[_0x0be9('0x40')](_0xc51b57['where'],{'$or':_[_0x0be9('0x29')](_0xc51b57['attributes'],function(_0x388466){var _0x44a6f0={};_0x44a6f0[_0x388466]={'$like':'%'+_0x214a50['query']['filter']+'%'};return _0x44a6f0;})});}_0xc51b57=_['merge']({},_0xc51b57,_0x214a50['options']);return _0x255dd4[_0x0be9('0x96')](_0xc51b57);}})[_0x0be9('0x23')](function(_0x111563){if(_0x111563){_0x23faa5=_0x111563[_0x0be9('0x39')];if(!_0x214a50[_0x0be9('0x35')][_0x0be9('0x3a')]('nolimit')){_0xc51b57[_0x0be9('0x3b')]=qs[_0x0be9('0x3b')](_0x214a50[_0x0be9('0x35')][_0x0be9('0x3b')]);_0xc51b57[_0x0be9('0x20')]=qs[_0x0be9('0x20')](_0x214a50[_0x0be9('0x35')][_0x0be9('0x20')]);}return _0x255dd4[_0x0be9('0x96')](_0xc51b57);}})[_0x0be9('0x23')](function(_0x245f8c){if(_0x245f8c){return _0x245f8c?{'count':_0x23faa5,'rows':_0x245f8c}:null;}})[_0x0be9('0x23')](respondWithResult(_0x42e100,null))[_0x0be9('0x47')](handleError(_0x42e100,null));};exports['addLists']=function(_0x1851bb,_0x17da7c,_0x1b786f){var _0x4f35e4,_0x647604;return db['VoiceQueue'][_0x0be9('0x2c')]({'where':{'id':_0x1851bb[_0x0be9('0x49')]['id']}})['then'](handleEntityNotFound(_0x17da7c,null))[_0x0be9('0x23')](function(_0x39dc22){if(_0x39dc22){_0x647604=_0x39dc22;return _0x39dc22[_0x0be9('0x98')](_0x1851bb[_0x0be9('0x4d')]['ids'],_[_0x0be9('0x55')](_0x1851bb[_0x0be9('0x4d')],['ids','id'])||{});}return null;})[_0x0be9('0x8d')](function(_0x3614f1){var _0x577694;_0x4f35e4=_0x3614f1||[];var _0x122919=[];if(_0x3614f1){for(var _0x5952e7=0x0;_0x5952e7<_0x3614f1[_0x0be9('0x39')];_0x5952e7+=0x1){var _0x46625e=_0x3614f1[_0x5952e7][_0x0be9('0x24')]({'plain':!![]});_0x647604['dialCheckDuplicateType']=_0x1851bb[_0x0be9('0x4d')]['dialCheckDuplicateType']?_0x1851bb[_0x0be9('0x4d')]['dialCheckDuplicateType']:_0x647604[_0x0be9('0x99')];switch(_0x647604[_0x0be9('0x99')]){case'always':_0x577694=squel[_0x0be9('0x9a')]()[_0x0be9('0x9b')]('cm_hopper')[_0x0be9('0x9c')]([_0x0be9('0x9d'),_0x0be9('0x9e'),_0x0be9('0x9f'),_0x0be9('0xa0'),_0x0be9('0x5e'),_0x0be9('0x56'),_0x0be9('0x57')],squel[_0x0be9('0x78')]()[_0x0be9('0xa1')](_0x0be9('0x9d'),_0x0be9('0x9d'))[_0x0be9('0xa1')](_0x0be9('0xa2'),'scheduledAt')[_0x0be9('0xa1')]('id',_0x0be9('0x9f'))[_0x0be9('0xa1')](_0x46625e[_0x0be9('0xa3')]['toString'](),'ListId')['field'](_0x1851bb['params']['id'][_0x0be9('0xa4')](),'VoiceQueueId')[_0x0be9('0xa1')]('NOW()','createdAt')[_0x0be9('0xa1')](_0x0be9('0xa2'),'updatedAt')['from']('cm_contacts')[_0x0be9('0x3f')](_0x0be9('0xa5'))[_0x0be9('0x3f')](_0x0be9('0xa6'),_0x46625e[_0x0be9('0xa3')]['toString']())[_0x0be9('0x3f')](_0x0be9('0xa7'))[_0x0be9('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0be9('0xa1')](_0x0be9('0xa8'))['from'](_0x0be9('0xa9'))['where']('VoiceQueueId\x20=\x20?',_0x1851bb['params']['id']['toString']()))['where'](_0x0be9('0xaa'),squel[_0x0be9('0x78')]()['field'](_0x0be9('0xab'))[_0x0be9('0x7a')](_0x0be9('0xac'))[_0x0be9('0x3f')](_0x0be9('0xad'),_0x1851bb[_0x0be9('0x49')]['id'][_0x0be9('0xa4')]())))[_0x0be9('0xa4')]();break;case'onlyIfOpen':_0x577694=squel[_0x0be9('0x9a')]()[_0x0be9('0x9b')](_0x0be9('0xac'))[_0x0be9('0x9c')]([_0x0be9('0x9d'),_0x0be9('0x9e'),_0x0be9('0x9f'),_0x0be9('0xa0'),'VoiceQueueId',_0x0be9('0x56'),'updatedAt'],squel['select']()[_0x0be9('0xa1')](_0x0be9('0x9d'),_0x0be9('0x9d'))[_0x0be9('0xa1')]('NOW()',_0x0be9('0x9e'))[_0x0be9('0xa1')]('id',_0x0be9('0x9f'))['field'](_0x46625e[_0x0be9('0xa3')][_0x0be9('0xa4')](),_0x0be9('0xa0'))[_0x0be9('0xa1')](_0x1851bb[_0x0be9('0x49')]['id']['toString'](),_0x0be9('0x5e'))['field'](_0x0be9('0xa2'),_0x0be9('0x56'))['field'](_0x0be9('0xa2'),_0x0be9('0x57'))[_0x0be9('0x7a')](_0x0be9('0xae'))[_0x0be9('0x3f')](_0x0be9('0xa5'))[_0x0be9('0x3f')](_0x0be9('0xa6'),_0x46625e[_0x0be9('0xa3')][_0x0be9('0xa4')]())[_0x0be9('0x3f')](_0x0be9('0xa7'))[_0x0be9('0x3f')](_0x0be9('0xaa'),squel[_0x0be9('0x78')]()['field'](_0x0be9('0xab'))[_0x0be9('0x7a')](_0x0be9('0xac'))[_0x0be9('0x3f')](_0x0be9('0xad'),_0x1851bb[_0x0be9('0x49')]['id'][_0x0be9('0xa4')]())))[_0x0be9('0xa4')]();break;default:_0x577694=squel[_0x0be9('0x9a')]()['into']('cm_hopper')[_0x0be9('0x9c')]([_0x0be9('0x9d'),_0x0be9('0x9e'),_0x0be9('0x9f'),_0x0be9('0xa0'),_0x0be9('0x5e'),'createdAt','updatedAt'],squel['select']()['field'](_0x0be9('0x9d'),'phone')[_0x0be9('0xa1')]('NOW()',_0x0be9('0x9e'))['field']('id',_0x0be9('0x9f'))[_0x0be9('0xa1')](_0x46625e['CmListId']['toString'](),_0x0be9('0xa0'))[_0x0be9('0xa1')](_0x1851bb['params']['id'][_0x0be9('0xa4')](),'VoiceQueueId')[_0x0be9('0xa1')](_0x0be9('0xa2'),_0x0be9('0x56'))[_0x0be9('0xa1')]('NOW()',_0x0be9('0x57'))[_0x0be9('0x7a')]('cm_contacts')[_0x0be9('0x3f')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x46625e['CmListId']['toString']())[_0x0be9('0x3f')](_0x0be9('0xa7')))[_0x0be9('0xa4')]();}_0x122919['push'](db[_0x0be9('0x6f')][_0x0be9('0x35')](_0x577694));}return BPromise['all'](_0x122919);}})['then'](function(){return _0x4f35e4;})['then'](respondWithResult(_0x17da7c,null))[_0x0be9('0x47')](handleError(_0x17da7c,null));};exports[_0x0be9('0xaf')]=function(_0x3fcc37,_0x30e4ae,_0x25e1c2){return db[_0x0be9('0x32')][_0x0be9('0x2c')]({'where':{'id':_0x3fcc37[_0x0be9('0x49')]['id']}})[_0x0be9('0x23')](handleEntityNotFound(_0x30e4ae,null))[_0x0be9('0x23')](function(_0xa4a420){if(_0xa4a420){return _0xa4a420[_0x0be9('0xaf')](_0x3fcc37['query']['ids']);}})['then'](function(_0x560ffb){if(_0x560ffb){return db[_0x0be9('0x5c')][_0x0be9('0x5a')]({'where':{'ListId':_0x3fcc37[_0x0be9('0x35')][_0x0be9('0x8c')],'VoiceQueueId':_0x3fcc37[_0x0be9('0x49')]['id']}})[_0x0be9('0x23')](function(){return _0x560ffb;});}})[_0x0be9('0x23')](respondWithStatusCode(_0x30e4ae,null))[_0x0be9('0x47')](handleError(_0x30e4ae,null));};exports['getBlackLists']=function(_0x183b5a,_0x4ca359,_0x5702e4){var _0x17b943={};var _0x5f0676={};var _0x292eeb;var _0x5b25ce;return db[_0x0be9('0x32')]['findOne']({'where':{'id':_0x183b5a[_0x0be9('0x49')]['id']}})[_0x0be9('0x23')](handleEntityNotFound(_0x4ca359,null))['then'](function(_0x168264){if(_0x168264){_0x292eeb=_0x168264;_0x5f0676[_0x0be9('0x34')]=_[_0x0be9('0x4a')](db[_0x0be9('0x97')][_0x0be9('0x5d')]);_0x5f0676['query']=_[_0x0be9('0x4a')](_0x183b5a[_0x0be9('0x35')]);_0x5f0676['filters']=_[_0x0be9('0x37')](_0x5f0676['model'],_0x5f0676[_0x0be9('0x35')]);_0x17b943['attributes']=_[_0x0be9('0x37')](_0x5f0676[_0x0be9('0x34')],qs[_0x0be9('0x4b')](_0x183b5a[_0x0be9('0x35')][_0x0be9('0x4b')]));_0x17b943[_0x0be9('0x38')]=_0x17b943[_0x0be9('0x38')]['length']?_0x17b943[_0x0be9('0x38')]:_0x5f0676[_0x0be9('0x34')];_0x17b943[_0x0be9('0x3c')]=qs[_0x0be9('0x3d')](_0x183b5a[_0x0be9('0x35')][_0x0be9('0x3d')]);_0x17b943['where']=qs['filters'](_[_0x0be9('0x3e')](_0x183b5a[_0x0be9('0x35')],_0x5f0676['filters']));if(_0x183b5a[_0x0be9('0x35')][_0x0be9('0x42')]){_0x17b943['where']=_['merge'](_0x17b943[_0x0be9('0x3f')],{'$or':_[_0x0be9('0x29')](_0x17b943[_0x0be9('0x38')],function(_0x50d841){var _0x16190b={};_0x16190b[_0x50d841]={'$like':'%'+_0x183b5a['query'][_0x0be9('0x42')]+'%'};return _0x16190b;})});}_0x17b943=_[_0x0be9('0x40')]({},_0x17b943,_0x183b5a[_0x0be9('0x43')]);return _0x292eeb['getBlackLists'](_0x17b943);}})[_0x0be9('0x23')](function(_0x1d0a19){if(_0x1d0a19){_0x5b25ce=_0x1d0a19[_0x0be9('0x39')];if(!_0x183b5a[_0x0be9('0x35')]['hasOwnProperty'](_0x0be9('0x60'))){_0x17b943[_0x0be9('0x3b')]=qs['limit'](_0x183b5a[_0x0be9('0x35')][_0x0be9('0x3b')]);_0x17b943[_0x0be9('0x20')]=qs[_0x0be9('0x20')](_0x183b5a['query'][_0x0be9('0x20')]);}return _0x292eeb[_0x0be9('0xb0')](_0x17b943);}})[_0x0be9('0x23')](function(_0xa5f72b){if(_0xa5f72b){return _0xa5f72b?{'count':_0x5b25ce,'rows':_0xa5f72b}:null;}})[_0x0be9('0x23')](respondWithResult(_0x4ca359,null))[_0x0be9('0x47')](handleError(_0x4ca359,null));};exports['addBlackLists']=function(_0x1a2643,_0x3d5970,_0x33b033){var _0x24f4ee,_0x16611e;return db['VoiceQueue'][_0x0be9('0x2c')]({'where':{'id':_0x1a2643['params']['id']}})['then'](handleEntityNotFound(_0x3d5970,null))[_0x0be9('0x23')](function(_0x1bc0eb){if(_0x1bc0eb){_0x16611e=_0x1bc0eb;return _0x1bc0eb['addBlackLists'](_0x1a2643['body'][_0x0be9('0x8c')],_[_0x0be9('0x55')](_0x1a2643['body'],['ids','id'])||{});}return null;})[_0x0be9('0x8d')](function(_0x4d74fa){var _0x3b936a;_0x24f4ee=_0x4d74fa||[];var _0x3ceb46=[];if(_0x4d74fa){for(var _0x3f49a4=0x0;_0x3f49a4<_0x4d74fa[_0x0be9('0x39')];_0x3f49a4+=0x1){var _0x2d0b02=_0x4d74fa[_0x3f49a4][_0x0be9('0x24')]({'plain':!![]});_0x3b936a=squel[_0x0be9('0x9a')]()[_0x0be9('0x9b')](_0x0be9('0xb1'))[_0x0be9('0x9c')]([_0x0be9('0x9d'),_0x0be9('0x9f'),_0x0be9('0xa0'),'VoiceQueueId',_0x0be9('0x56'),_0x0be9('0x57')],squel[_0x0be9('0x78')]()['field'](_0x0be9('0x9d'),_0x0be9('0x9d'))[_0x0be9('0xa1')]('id',_0x0be9('0x9f'))[_0x0be9('0xa1')](_0x2d0b02[_0x0be9('0xa3')][_0x0be9('0xa4')](),_0x0be9('0xa0'))[_0x0be9('0xa1')](_0x1a2643[_0x0be9('0x49')]['id'][_0x0be9('0xa4')](),_0x0be9('0x5e'))['field']('NOW()',_0x0be9('0x56'))['field']('NOW()',_0x0be9('0x57'))[_0x0be9('0x7a')](_0x0be9('0xae'))[_0x0be9('0x3f')]('deletedAt\x20IS\x20NULL')[_0x0be9('0x3f')](_0x0be9('0xa6'),_0x2d0b02['CmListId'][_0x0be9('0xa4')]())[_0x0be9('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0x0be9('0xa4')]();_0x3ceb46[_0x0be9('0x80')](db[_0x0be9('0x6f')][_0x0be9('0x35')](_0x3b936a));}return BPromise[_0x0be9('0x85')](_0x3ceb46);}})[_0x0be9('0x23')](function(){return _0x24f4ee;})[_0x0be9('0x23')](respondWithResult(_0x3d5970,null))[_0x0be9('0x47')](handleError(_0x3d5970,null));};exports[_0x0be9('0xb2')]=function(_0x443856,_0x2eddf5,_0x2146d3){return db['VoiceQueue'][_0x0be9('0x2c')]({'where':{'id':_0x443856['params']['id']}})[_0x0be9('0x23')](handleEntityNotFound(_0x2eddf5,null))[_0x0be9('0x23')](function(_0x1967fe){if(_0x1967fe){return _0x1967fe['removeBlackLists'](_0x443856['query'][_0x0be9('0x8c')]);}})['then'](function(_0x51d4b4){if(_0x51d4b4){return db[_0x0be9('0x66')][_0x0be9('0x5a')]({'where':{'ListId':_0x443856[_0x0be9('0x35')]['ids'],'VoiceQueueId':_0x443856[_0x0be9('0x49')]['id']}})['then'](function(){return _0x51d4b4;});}})[_0x0be9('0x23')](respondWithStatusCode(_0x2eddf5,null))[_0x0be9('0x47')](handleError(_0x2eddf5,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index dc8e987..fa4a0d8 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 _0x882c=['emit','hook','exports','events','../../mysqldb','save','remove'];(function(_0x208537,_0x3d8d2b){var _0x4f7cdb=function(_0x313e06){while(--_0x313e06){_0x208537['push'](_0x208537['shift']());}};_0x4f7cdb(++_0x3d8d2b);}(_0x882c,0x6c));var _0xc882=function(_0x111692,_0x19f8a9){_0x111692=_0x111692-0x0;var _0x11836f=_0x882c[_0x111692];return _0x11836f;};'use strict';var EventEmitter=require(_0xc882('0x0'));var VoiceQueue=require(_0xc882('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc882('0x2'),'afterUpdate':'update','afterDestroy':_0xc882('0x3')};function emitEvent(_0x1cc1db){return function(_0x363b23,_0x32dee9,_0x48cb60){VoiceQueueEvents[_0xc882('0x4')](_0x1cc1db+':'+_0x363b23['id'],_0x363b23);VoiceQueueEvents[_0xc882('0x4')](_0x1cc1db,_0x363b23);_0x48cb60(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xc882('0x5')](e,emitEvent(event));}}module[_0xc882('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x9b83=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x4e7ecb,_0x3c00a1){var _0x41aaf5=function(_0x584be5){while(--_0x584be5){_0x4e7ecb['push'](_0x4e7ecb['shift']());}};_0x41aaf5(++_0x3c00a1);}(_0x9b83,0x9b));var _0x39b8=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0x9b83[_0x324012];return _0x435cf2;};'use strict';var EventEmitter=require(_0x39b8('0x0'));var VoiceQueue=require(_0x39b8('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x39b8('0x2')](0x0);var events={'afterCreate':_0x39b8('0x3'),'afterUpdate':_0x39b8('0x4'),'afterDestroy':_0x39b8('0x5')};function emitEvent(_0x472dd5){return function(_0x51f662,_0x42ffad,_0x15587e){VoiceQueueEvents['emit'](_0x472dd5+':'+_0x51f662['id'],_0x51f662);VoiceQueueEvents[_0x39b8('0x6')](_0x472dd5,_0x51f662);_0x15587e(null);};}for(var e in events){if(events[_0x39b8('0x7')](e)){var event=events[e];VoiceQueue[_0x39b8('0x8')](e,emitEvent(event));}}module[_0x39b8('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index e99378c..7d6f4ee 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 _0x70a3=['path','rimraf','../../config/environment','./voiceQueue.attributes','VoiceQueue','voice_queues','api','bluebird','request-promise'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0x70a3,0x16e));var _0x370a=function(_0x53d0ff,_0x316997){_0x53d0ff=_0x53d0ff-0x0;var _0x45fc7b=_0x70a3[_0x53d0ff];return _0x45fc7b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x370a('0x0'));var moment=require('moment');var BPromise=require(_0x370a('0x1'));var rp=require(_0x370a('0x2'));var fs=require('fs');var path=require(_0x370a('0x3'));var rimraf=require(_0x370a('0x4'));var config=require(_0x370a('0x5'));var attributes=require(_0x370a('0x6'));module['exports']=function(_0x253546,_0x113847){return _0x253546['define'](_0x370a('0x7'),attributes,{'tableName':_0x370a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x160c=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','util','../../config/logger','api'];(function(_0x51b195,_0x1d6706){var _0x4270dc=function(_0x3f2ec9){while(--_0x3f2ec9){_0x51b195['push'](_0x51b195['shift']());}};_0x4270dc(++_0x1d6706);}(_0x160c,0x1c4));var _0xc160=function(_0xfd7416,_0x28bc19){_0xfd7416=_0xfd7416-0x0;var _0x4ae8ea=_0x160c[_0xfd7416];return _0x4ae8ea;};'use strict';var _=require('lodash');var util=require(_0xc160('0x0'));var logger=require(_0xc160('0x1'))(_0xc160('0x2'));var moment=require(_0xc160('0x3'));var BPromise=require(_0xc160('0x4'));var rp=require(_0xc160('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc160('0x6'));var config=require(_0xc160('0x7'));var attributes=require(_0xc160('0x8'));module[_0xc160('0x9')]=function(_0x1c0b79,_0x2e4dc5){return _0x1c0b79[_0xc160('0xa')](_0xc160('0xb'),attributes,{'tableName':_0xc160('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 85bb8e2..1ad7e98 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 _0x8648=['include','map','model','stringify','catch','ShowVoiceQueue','VoiceQueue','find','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','GetVoiceQueue','findAll','options','raw','attributes'];(function(_0x54a4db,_0x21e5cf){var _0x4c599f=function(_0x5e4d89){while(--_0x5e4d89){_0x54a4db['push'](_0x54a4db['shift']());}};_0x4c599f(++_0x21e5cf);}(_0x8648,0xd1));var _0x8864=function(_0x37bd3e,_0xc75e5a){_0x37bd3e=_0x37bd3e-0x0;var _0x280600=_0x8648[_0x37bd3e];return _0x280600;};'use strict';var _=require('lodash');var util=require(_0x8864('0x0'));var moment=require(_0x8864('0x1'));var BPromise=require(_0x8864('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8864('0x3'));var db=require(_0x8864('0x4'))['db'];var utils=require(_0x8864('0x5'));var logger=require(_0x8864('0x6'))(_0x8864('0x7'));var config=require(_0x8864('0x8'));var jayson=require(_0x8864('0x9'));var client=jayson['client'][_0x8864('0xa')]({'port':0x232a});config[_0x8864('0xb')]=_[_0x8864('0xc')](config[_0x8864('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8864('0xd'))(new Redis(config[_0x8864('0xb')]));require(_0x8864('0xe'))[_0x8864('0xf')](socket);function respondWithRpcPromise(_0xf2565a,_0x5a85e2,_0x47a642){return new BPromise(function(_0x1b5ad6,_0x16351a){return client[_0x8864('0x10')](_0xf2565a,_0x47a642)[_0x8864('0x11')](function(_0x380453){logger[_0x8864('0x12')](_0x8864('0x13'),_0x5a85e2,_0x8864('0x14'));logger[_0x8864('0x15')](_0x8864('0x16'),_0x5a85e2,_0x8864('0x14'),JSON['stringify'](_0x380453));if(_0x380453[_0x8864('0x17')]){if(_0x380453[_0x8864('0x17')]['code']===0x1f4){logger[_0x8864('0x17')](_0x8864('0x13'),_0x5a85e2,_0x380453[_0x8864('0x17')][_0x8864('0x18')]);return _0x16351a(_0x380453[_0x8864('0x17')][_0x8864('0x18')]);}logger['error'](_0x8864('0x13'),_0x5a85e2,_0x380453['error'][_0x8864('0x18')]);return _0x1b5ad6(_0x380453[_0x8864('0x17')]['message']);}else{logger[_0x8864('0x12')](_0x8864('0x13'),_0x5a85e2,'request\x20sent');_0x1b5ad6(_0x380453[_0x8864('0x19')]['message']);}})['catch'](function(_0x3a984f){logger[_0x8864('0x17')](_0x8864('0x13'),_0x5a85e2,_0x3a984f);_0x16351a(_0x3a984f);});});}exports[_0x8864('0x1a')]=function(_0x2417e7){var _0x3e3a12=this;return new Promise(function(_0x4167db,_0x57ffdb){return db['VoiceQueue'][_0x8864('0x1b')]({'raw':_0x2417e7[_0x8864('0x1c')]?_0x2417e7[_0x8864('0x1c')][_0x8864('0x1d')]===undefined?!![]:![]:!![],'where':_0x2417e7['options']?_0x2417e7['options']['where']||null:null,'attributes':_0x2417e7[_0x8864('0x1c')]?_0x2417e7[_0x8864('0x1c')][_0x8864('0x1e')]||null:null,'limit':_0x2417e7[_0x8864('0x1c')]?_0x2417e7['options']['limit']||null:null,'include':_0x2417e7[_0x8864('0x1c')]?_0x2417e7['options'][_0x8864('0x1f')]?_[_0x8864('0x20')](_0x2417e7[_0x8864('0x1c')]['include'],function(_0x1fa883){return{'model':db[_0x1fa883[_0x8864('0x21')]],'as':_0x1fa883['as'],'attributes':_0x1fa883[_0x8864('0x1e')],'include':_0x1fa883['include']?_[_0x8864('0x20')](_0x1fa883[_0x8864('0x1f')],function(_0x4b71e0){return{'model':db[_0x4b71e0[_0x8864('0x21')]],'as':_0x4b71e0['as'],'attributes':_0x4b71e0[_0x8864('0x1e')],'include':_0x4b71e0[_0x8864('0x1f')]?_[_0x8864('0x20')](_0x4b71e0[_0x8864('0x1f')],function(_0x5eddb9){return{'model':db[_0x5eddb9['model']],'as':_0x5eddb9['as'],'attributes':_0x5eddb9[_0x8864('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8864('0x11')](function(_0x59fe94){logger[_0x8864('0x12')](_0x8864('0x1a'),_0x2417e7);logger['debug'](_0x8864('0x1a'),_0x2417e7,JSON[_0x8864('0x22')](_0x59fe94));_0x4167db(_0x59fe94);})[_0x8864('0x23')](function(_0x1b39d8){logger[_0x8864('0x17')](_0x8864('0x1a'),_0x1b39d8[_0x8864('0x18')],_0x2417e7);_0x57ffdb(_0x3e3a12['error'](0x1f4,_0x1b39d8[_0x8864('0x18')]));});});};exports[_0x8864('0x24')]=function(_0x50f6fd){var _0x2b5490=this;return new Promise(function(_0x3f69cf,_0x443b86){return db[_0x8864('0x25')][_0x8864('0x26')]({'raw':_0x50f6fd[_0x8864('0x1c')]?_0x50f6fd[_0x8864('0x1c')][_0x8864('0x1d')]===undefined?!![]:![]:!![],'where':_0x50f6fd[_0x8864('0x1c')]?_0x50f6fd[_0x8864('0x1c')][_0x8864('0x27')]||null:null,'attributes':_0x50f6fd[_0x8864('0x1c')]?_0x50f6fd['options']['attributes']||null:null,'include':_0x50f6fd['options']?_0x50f6fd[_0x8864('0x1c')]['include']?_['map'](_0x50f6fd['options'][_0x8864('0x1f')],function(_0x7b48da){return{'model':db[_0x7b48da['model']],'as':_0x7b48da['as'],'attributes':_0x7b48da['attributes'],'include':_0x7b48da[_0x8864('0x1f')]?_[_0x8864('0x20')](_0x7b48da['include'],function(_0x4345a7){return{'model':db[_0x4345a7[_0x8864('0x21')]],'as':_0x4345a7['as'],'attributes':_0x4345a7[_0x8864('0x1e')],'include':_0x4345a7[_0x8864('0x1f')]?_[_0x8864('0x20')](_0x4345a7[_0x8864('0x1f')],function(_0xc547fa){return{'model':db[_0xc547fa[_0x8864('0x21')]],'as':_0xc547fa['as'],'attributes':_0xc547fa['attributes']};}):[]};}):[]};}):[]:[]})[_0x8864('0x11')](function(_0x1b124a){logger[_0x8864('0x12')]('ShowVoiceQueue',_0x50f6fd);logger[_0x8864('0x15')]('ShowVoiceQueue',_0x50f6fd,JSON[_0x8864('0x22')](_0x1b124a));_0x3f69cf(_0x1b124a);})[_0x8864('0x23')](function(_0x428624){logger[_0x8864('0x17')](_0x8864('0x24'),_0x428624[_0x8864('0x18')],_0x50f6fd);_0x443b86(_0x2b5490[_0x8864('0x17')](0x1f4,_0x428624[_0x8864('0x18')]));});});}; \ No newline at end of file +var _0xcb76=['error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','include','model','map','stringify','ShowVoiceQueue','find','lodash','util','moment','randomstring','../../config/utils','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xcb76,0x13b));var _0x6cb7=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xcb76[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x6cb7('0x0'));var util=require(_0x6cb7('0x1'));var moment=require(_0x6cb7('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cb7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6cb7('0x4'));var logger=require('../../config/logger')(_0x6cb7('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6cb7('0x6')][_0x6cb7('0x7')]({'port':0x232a});config[_0x6cb7('0x8')]=_[_0x6cb7('0x9')](config[_0x6cb7('0x8')],{'host':_0x6cb7('0xa'),'port':0x18eb});var socket=require(_0x6cb7('0xb'))(new Redis(config[_0x6cb7('0x8')]));require('./voiceQueue.socket')[_0x6cb7('0xc')](socket);function respondWithRpcPromise(_0x2b4392,_0x232158,_0x5b76d3){return new BPromise(function(_0x2c9e9e,_0x1fa722){return client['request'](_0x2b4392,_0x5b76d3)[_0x6cb7('0xd')](function(_0x48046b){logger['info'](_0x6cb7('0xe'),_0x232158,_0x6cb7('0xf'));logger[_0x6cb7('0x10')](_0x6cb7('0x11'),_0x232158,_0x6cb7('0xf'),JSON['stringify'](_0x48046b));if(_0x48046b[_0x6cb7('0x12')]){if(_0x48046b[_0x6cb7('0x12')][_0x6cb7('0x13')]===0x1f4){logger['error'](_0x6cb7('0xe'),_0x232158,_0x48046b[_0x6cb7('0x12')][_0x6cb7('0x14')]);return _0x1fa722(_0x48046b[_0x6cb7('0x12')][_0x6cb7('0x14')]);}logger['error'](_0x6cb7('0xe'),_0x232158,_0x48046b[_0x6cb7('0x12')]['message']);return _0x2c9e9e(_0x48046b[_0x6cb7('0x12')][_0x6cb7('0x14')]);}else{logger[_0x6cb7('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x232158,_0x6cb7('0xf'));_0x2c9e9e(_0x48046b[_0x6cb7('0x16')][_0x6cb7('0x14')]);}})[_0x6cb7('0x17')](function(_0x2fc99b){logger[_0x6cb7('0x12')](_0x6cb7('0xe'),_0x232158,_0x2fc99b);_0x1fa722(_0x2fc99b);});});}exports[_0x6cb7('0x18')]=function(_0x9a6338){var _0x20afe2=this;return new Promise(function(_0x32b8c1,_0x414815){return db[_0x6cb7('0x19')][_0x6cb7('0x1a')]({'raw':_0x9a6338[_0x6cb7('0x1b')]?_0x9a6338[_0x6cb7('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x9a6338[_0x6cb7('0x1b')]?_0x9a6338[_0x6cb7('0x1b')][_0x6cb7('0x1c')]||null:null,'attributes':_0x9a6338[_0x6cb7('0x1b')]?_0x9a6338['options'][_0x6cb7('0x1d')]||null:null,'limit':_0x9a6338[_0x6cb7('0x1b')]?_0x9a6338[_0x6cb7('0x1b')][_0x6cb7('0x1e')]||null:null,'include':_0x9a6338[_0x6cb7('0x1b')]?_0x9a6338[_0x6cb7('0x1b')][_0x6cb7('0x1f')]?_['map'](_0x9a6338[_0x6cb7('0x1b')][_0x6cb7('0x1f')],function(_0x145414){return{'model':db[_0x145414[_0x6cb7('0x20')]],'as':_0x145414['as'],'attributes':_0x145414[_0x6cb7('0x1d')],'include':_0x145414[_0x6cb7('0x1f')]?_[_0x6cb7('0x21')](_0x145414[_0x6cb7('0x1f')],function(_0x43645b){return{'model':db[_0x43645b[_0x6cb7('0x20')]],'as':_0x43645b['as'],'attributes':_0x43645b[_0x6cb7('0x1d')],'include':_0x43645b[_0x6cb7('0x1f')]?_[_0x6cb7('0x21')](_0x43645b['include'],function(_0xfe2f4f){return{'model':db[_0xfe2f4f[_0x6cb7('0x20')]],'as':_0xfe2f4f['as'],'attributes':_0xfe2f4f[_0x6cb7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6cb7('0xd')](function(_0x458440){logger['info'](_0x6cb7('0x18'),_0x9a6338);logger[_0x6cb7('0x10')](_0x6cb7('0x18'),_0x9a6338,JSON[_0x6cb7('0x22')](_0x458440));_0x32b8c1(_0x458440);})[_0x6cb7('0x17')](function(_0x4d4c0e){logger['error'](_0x6cb7('0x18'),_0x4d4c0e[_0x6cb7('0x14')],_0x9a6338);_0x414815(_0x20afe2[_0x6cb7('0x12')](0x1f4,_0x4d4c0e['message']));});});};exports[_0x6cb7('0x23')]=function(_0x580dda){var _0x2f1529=this;return new Promise(function(_0x2dc2e6,_0x2b9255){return db[_0x6cb7('0x19')][_0x6cb7('0x24')]({'raw':_0x580dda[_0x6cb7('0x1b')]?_0x580dda['options']['raw']===undefined?!![]:![]:!![],'where':_0x580dda[_0x6cb7('0x1b')]?_0x580dda[_0x6cb7('0x1b')]['where']||null:null,'attributes':_0x580dda[_0x6cb7('0x1b')]?_0x580dda['options'][_0x6cb7('0x1d')]||null:null,'include':_0x580dda[_0x6cb7('0x1b')]?_0x580dda[_0x6cb7('0x1b')][_0x6cb7('0x1f')]?_['map'](_0x580dda[_0x6cb7('0x1b')]['include'],function(_0x527496){return{'model':db[_0x527496[_0x6cb7('0x20')]],'as':_0x527496['as'],'attributes':_0x527496[_0x6cb7('0x1d')],'include':_0x527496[_0x6cb7('0x1f')]?_['map'](_0x527496[_0x6cb7('0x1f')],function(_0x2e520e){return{'model':db[_0x2e520e[_0x6cb7('0x20')]],'as':_0x2e520e['as'],'attributes':_0x2e520e[_0x6cb7('0x1d')],'include':_0x2e520e[_0x6cb7('0x1f')]?_['map'](_0x2e520e[_0x6cb7('0x1f')],function(_0x3a1472){return{'model':db[_0x3a1472[_0x6cb7('0x20')]],'as':_0x3a1472['as'],'attributes':_0x3a1472['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ba533){logger[_0x6cb7('0x15')](_0x6cb7('0x23'),_0x580dda);logger[_0x6cb7('0x10')](_0x6cb7('0x23'),_0x580dda,JSON[_0x6cb7('0x22')](_0x4ba533));_0x2dc2e6(_0x4ba533);})[_0x6cb7('0x17')](function(_0x487d9c){logger[_0x6cb7('0x12')]('ShowVoiceQueue',_0x487d9c[_0x6cb7('0x14')],_0x580dda);_0x2b9255(_0x2f1529['error'](0x1f4,_0x487d9c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 4156ff9..5810aa0 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 _0xfcef=['removeListener','voiceQueue:','./voiceQueue.events','save','remove','emit'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xfcef,0x74));var _0xffce=function(_0x6b091a,_0x2862ee){_0x6b091a=_0x6b091a-0x0;var _0x19a45c=_0xfcef[_0x6b091a];return _0x19a45c;};'use strict';var VoiceQueueEvents=require(_0xffce('0x0'));var events=[_0xffce('0x1'),_0xffce('0x2'),'update'];function createListener(_0x2a5732,_0x967c1c){return function(_0x1779ed){_0x967c1c[_0xffce('0x3')](_0x2a5732,_0x1779ed);};}function removeListener(_0x2055f4,_0xa315b1){return function(){VoiceQueueEvents[_0xffce('0x4')](_0x2055f4,_0xa315b1);};}exports['register']=function(_0x263173){for(var _0xa18bee=0x0,_0x339c0d=events['length'];_0xa18bee<_0x339c0d;_0xa18bee++){var _0x10364c=events[_0xa18bee];var _0x1eb45f=createListener(_0xffce('0x5')+_0x10364c,_0x263173);VoiceQueueEvents['on'](_0x10364c,_0x1eb45f);}}; \ No newline at end of file +var _0xcfa6=['remove','update','emit','voiceQueue:','./voiceQueue.events','save'];(function(_0x5257bf,_0xf39844){var _0x30f32b=function(_0x252bff){while(--_0x252bff){_0x5257bf['push'](_0x5257bf['shift']());}};_0x30f32b(++_0xf39844);}(_0xcfa6,0x9a));var _0x6cfa=function(_0x5de20b,_0x469b11){_0x5de20b=_0x5de20b-0x0;var _0x38a779=_0xcfa6[_0x5de20b];return _0x38a779;};'use strict';var VoiceQueueEvents=require(_0x6cfa('0x0'));var events=[_0x6cfa('0x1'),_0x6cfa('0x2'),_0x6cfa('0x3')];function createListener(_0x3a9e88,_0x477ec1){return function(_0x2c7618){_0x477ec1[_0x6cfa('0x4')](_0x3a9e88,_0x2c7618);};}function removeListener(_0x3d73d6,_0x509652){return function(){VoiceQueueEvents['removeListener'](_0x3d73d6,_0x509652);};}exports['register']=function(_0x56fc01){for(var _0x4b5278=0x0,_0x54317f=events['length'];_0x4b5278<_0x54317f;_0x4b5278++){var _0x555125=events[_0x4b5278];var _0x1d161c=createListener(_0x6cfa('0x5')+_0x555125,_0x56fc01);VoiceQueueEvents['on'](_0x555125,_0x1d161c);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index b35f457..7b9da88 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 _0x7bd0=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','getVoiceQueuesReport','show','post','put','/:id','update','delete','destroy'];(function(_0x152678,_0x11e0ac){var _0x311a9=function(_0x4f5291){while(--_0x4f5291){_0x152678['push'](_0x152678['shift']());}};_0x311a9(++_0x11e0ac);}(_0x7bd0,0x111));var _0x07bd=function(_0x3c4062,_0x3767fc){_0x3c4062=_0x3c4062-0x0;var _0x3f5bf3=_0x7bd0[_0x3c4062];return _0x3f5bf3;};'use strict';var multer=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var path=require(_0x07bd('0x2'));var timeout=require(_0x07bd('0x3'));var express=require(_0x07bd('0x4'));var router=express[_0x07bd('0x5')]();var auth=require(_0x07bd('0x6'));var interaction=require(_0x07bd('0x7'));var config=require('../../config/environment');var controller=require(_0x07bd('0x8'));router[_0x07bd('0x9')]('/',auth[_0x07bd('0xa')](),controller[_0x07bd('0xb')]);router[_0x07bd('0x9')](_0x07bd('0xc'),auth[_0x07bd('0xa')](),controller['describe']);router[_0x07bd('0x9')]('/index',auth[_0x07bd('0xa')](),controller[_0x07bd('0xd')]);router[_0x07bd('0x9')]('/:id',auth[_0x07bd('0xa')](),controller[_0x07bd('0xe')]);router[_0x07bd('0xf')]('/',auth[_0x07bd('0xa')](),controller['create']);router[_0x07bd('0x10')](_0x07bd('0x11'),auth[_0x07bd('0xa')](),controller[_0x07bd('0x12')]);router[_0x07bd('0x13')](_0x07bd('0x11'),auth[_0x07bd('0xa')](),controller[_0x07bd('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7bd0=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','getVoiceQueuesReport','show','post','put','/:id','update','delete','destroy'];(function(_0x837dad,_0x1d9098){var _0x1d62d3=function(_0x40b7c1){while(--_0x40b7c1){_0x837dad['push'](_0x837dad['shift']());}};_0x1d62d3(++_0x1d9098);}(_0x7bd0,0x111));var _0x07bd=function(_0x22f85a,_0x195ed5){_0x22f85a=_0x22f85a-0x0;var _0xaa717=_0x7bd0[_0x22f85a];return _0xaa717;};'use strict';var multer=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var path=require(_0x07bd('0x2'));var timeout=require(_0x07bd('0x3'));var express=require(_0x07bd('0x4'));var router=express[_0x07bd('0x5')]();var auth=require(_0x07bd('0x6'));var interaction=require(_0x07bd('0x7'));var config=require('../../config/environment');var controller=require(_0x07bd('0x8'));router[_0x07bd('0x9')]('/',auth[_0x07bd('0xa')](),controller[_0x07bd('0xb')]);router[_0x07bd('0x9')](_0x07bd('0xc'),auth[_0x07bd('0xa')](),controller['describe']);router[_0x07bd('0x9')]('/index',auth[_0x07bd('0xa')](),controller[_0x07bd('0xd')]);router[_0x07bd('0x9')]('/:id',auth[_0x07bd('0xa')](),controller[_0x07bd('0xe')]);router[_0x07bd('0xf')]('/',auth[_0x07bd('0xa')](),controller['create']);router[_0x07bd('0x10')](_0x07bd('0x11'),auth[_0x07bd('0xa')](),controller[_0x07bd('0x12')]);router[_0x07bd('0x13')](_0x07bd('0x11'),auth[_0x07bd('0xa')](),controller[_0x07bd('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 4fd9c68..65a2ff3 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 _0x2995=['format','diff','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x45c10a,_0x4b9090){var _0x3f680=function(_0x26243e){while(--_0x26243e){_0x45c10a['push'](_0x45c10a['shift']());}};_0x3f680(++_0x4b9090);}(_0x2995,0x1ea));var _0x5299=function(_0x2ef782,_0x103321){_0x2ef782=_0x2ef782-0x0;var _0x55d339=_0x2995[_0x2ef782];return _0x55d339;};'use strict';var Sequelize=require(_0x5299('0x0'));var moment=require('moment');module[_0x5299('0x1')]={'type':{'type':Sequelize[_0x5299('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5299('0x2')]},'calleridname':{'type':Sequelize[_0x5299('0x2')]},'queue':{'type':Sequelize[_0x5299('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x5299('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x5299('0x3')],'set':function(_0x4c5f23){var _0x254265=moment(_0x4c5f23);var _0x15a0c3=moment(this['getDataValue']('queuecallerjoinAt'))[_0x5299('0x4')]('YYYY-MM-DD\x20HH:mm:ss');var _0xa2e36f=_0x254265[_0x5299('0x5')](_0x15a0c3,'seconds');this['setDataValue'](_0x5299('0x6'),_0x4c5f23);this[_0x5299('0x7')](_0x5299('0x8'),_0xa2e36f||null);}},'position':{'type':Sequelize[_0x5299('0x9')]},'count':{'type':Sequelize[_0x5299('0x9')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x5299('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5299('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5299('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x5299('0x2')],'comment':_0x5299('0xb')},'originalposition':{'type':Sequelize[_0x5299('0x9')]},'channel':{'type':Sequelize[_0x5299('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5299('0x2')]},'connectedlinename':{'type':Sequelize[_0x5299('0x2')]},'accountcode':{'type':Sequelize[_0x5299('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5299('0x2')]},'priority':{'type':Sequelize[_0x5299('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x5299('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5299('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x5299('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5299('0x2')],'comment':_0x5299('0xc')},'transferexten':{'type':Sequelize[_0x5299('0x2')]},'transferuniqueid':{'type':Sequelize[_0x5299('0x2')]},'disposition':{'type':Sequelize[_0x5299('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x5299('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf11e=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','getDataValue','queuecallerjoinAt','format'];(function(_0xa9eaa0,_0x4ba2b4){var _0x30897a=function(_0x2caa01){while(--_0x2caa01){_0xa9eaa0['push'](_0xa9eaa0['shift']());}};_0x30897a(++_0x4ba2b4);}(_0xf11e,0x11b));var _0xef11=function(_0x3d124d,_0x177c30){_0x3d124d=_0x3d124d-0x0;var _0x2cd856=_0xf11e[_0x3d124d];return _0x2cd856;};'use strict';var Sequelize=require(_0xef11('0x0'));var moment=require('moment');module[_0xef11('0x1')]={'type':{'type':Sequelize[_0xef11('0x2')]},'uniqueid':{'type':Sequelize[_0xef11('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xef11('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x23dbcb){var _0x2e70d6=moment(_0x23dbcb);var _0x245f2b=moment(this[_0xef11('0x3')](_0xef11('0x4')))[_0xef11('0x5')](_0xef11('0x6'));var _0x58b05f=_0x2e70d6[_0xef11('0x7')](_0x245f2b,_0xef11('0x8'));this[_0xef11('0x9')](_0xef11('0xa'),_0x23dbcb);this[_0xef11('0x9')](_0xef11('0xb'),_0x58b05f||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xef11('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xef11('0xd')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xef11('0xd')]},'queuecallerexit':{'type':Sequelize[_0xef11('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xef11('0x2')],'comment':_0xef11('0xe')},'originalposition':{'type':Sequelize[_0xef11('0xf')]},'channel':{'type':Sequelize[_0xef11('0x2')]},'connectedlinenum':{'type':Sequelize[_0xef11('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xef11('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xef11('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xef11('0xf')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xef11('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xef11('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xef11('0x2')],'comment':_0xef11('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xef11('0x2')]},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xef11('0xf')],'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 3ba9153..3e2ac93 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 _0x7a54=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','getVoiceQueuesReport','intersection','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7a54,0x106));var _0x47a5=function(_0x3d67cc,_0x5d1c0a){_0x3d67cc=_0x3d67cc-0x0;var _0x34a828=_0x7a54[_0x3d67cc];return _0x34a828;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');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 db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}exports[_0x47a5('0x2b')]=function(_0x16631f,_0x361bfa){var _0x1127f8={},_0x11a4fa={},_0x3ad507={'count':0x0,'rows':[]};var _0x528582=_[_0x47a5('0x2c')](db['VoiceQueueReport'][_0x47a5('0x2d')],function(_0x9ac908){return{'name':_0x9ac908[_0x47a5('0x2e')],'type':_0x9ac908['type'][_0x47a5('0x2f')]};});_0x11a4fa[_0x47a5('0x30')]=_[_0x47a5('0x2c')](_0x528582,_0x47a5('0x29'));_0x11a4fa['query']=_['keys'](_0x16631f[_0x47a5('0x31')]);_0x11a4fa[_0x47a5('0x32')]=_['intersection'](_0x11a4fa['model'],_0x11a4fa[_0x47a5('0x31')]);_0x1127f8[_0x47a5('0x33')]=_['intersection'](_0x11a4fa[_0x47a5('0x30')],qs['fields'](_0x16631f[_0x47a5('0x31')][_0x47a5('0x34')]));_0x1127f8['attributes']=_0x1127f8['attributes'][_0x47a5('0x35')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x30')];if(!_0x16631f[_0x47a5('0x31')][_0x47a5('0x36')]('nolimit')){_0x1127f8[_0x47a5('0x1f')]=qs['limit'](_0x16631f['query'][_0x47a5('0x1f')]);_0x1127f8['offset']=qs[_0x47a5('0x1e')](_0x16631f['query'][_0x47a5('0x1e')]);}_0x1127f8[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0x16631f[_0x47a5('0x31')][_0x47a5('0x38')]);_0x1127f8[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0x16631f[_0x47a5('0x31')],_0x11a4fa['filters']),_0x528582);if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x1127f8['where']=_[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x39')],{'$or':_[_0x47a5('0x2c')](_0x528582,function(_0x49c4b5){if(_0x49c4b5[_0x47a5('0x3d')]!==_0x47a5('0x3e')){var _0x596097={};_0x596097[_0x49c4b5[_0x47a5('0x29')]]={'$like':'%'+_0x16631f[_0x47a5('0x31')]['filter']+'%'};return _0x596097;}})});}_0x1127f8=_['merge']({},_0x1127f8,_0x16631f['options']);var _0x12d9f2={'where':_0x1127f8['where']};return db[_0x47a5('0x3f')][_0x47a5('0x1d')](_0x12d9f2)[_0x47a5('0x26')](function(_0x111f0d){_0x3ad507[_0x47a5('0x1d')]=_0x111f0d;if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x40')]){_0x1127f8[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x1127f8);})[_0x47a5('0x26')](function(_0x1658e8){_0x3ad507[_0x47a5('0x43')]=_0x1658e8;return _0x3ad507;})['then'](respondWithFilteredResult(_0x361bfa,_0x1127f8))[_0x47a5('0x44')](handleError(_0x361bfa,null));};exports[_0x47a5('0x45')]=function(_0x331474,_0x23bd8d){var _0x586f4f={'raw':![],'where':{'id':_0x331474['params']['id']}},_0x7de536={};_0x7de536['model']=_['keys'](db['VoiceQueueReport'][_0x47a5('0x2d')]);_0x7de536['query']=_[_0x47a5('0x46')](_0x331474[_0x47a5('0x31')]);_0x7de536[_0x47a5('0x32')]=_['intersection'](_0x7de536[_0x47a5('0x30')],_0x7de536[_0x47a5('0x31')]);_0x586f4f['attributes']=_['intersection'](_0x7de536[_0x47a5('0x30')],qs['fields'](_0x331474[_0x47a5('0x31')][_0x47a5('0x34')]));_0x586f4f[_0x47a5('0x33')]=_0x586f4f[_0x47a5('0x33')][_0x47a5('0x35')]?_0x586f4f[_0x47a5('0x33')]:_0x7de536[_0x47a5('0x30')];if(_0x331474[_0x47a5('0x31')][_0x47a5('0x40')]){_0x586f4f[_0x47a5('0x41')]=[{'all':!![]}];}_0x586f4f=_[_0x47a5('0x3c')]({},_0x586f4f,_0x331474[_0x47a5('0x47')]);return db[_0x47a5('0x3f')][_0x47a5('0x48')](_0x586f4f)[_0x47a5('0x26')](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x26')](respondWithResult(_0x23bd8d,null))['catch'](handleError(_0x23bd8d,null));};exports[_0x47a5('0x49')]=function(_0x23bb04,_0x49eab1){return db['VoiceQueueReport'][_0x47a5('0x49')](_0x23bb04['body'],{})[_0x47a5('0x26')](respondWithResult(_0x49eab1,0xc9))[_0x47a5('0x44')](handleError(_0x49eab1,null));};exports['update']=function(_0x4f62d3,_0x3d85cc){if(_0x4f62d3['body']['id']){delete _0x4f62d3[_0x47a5('0x4a')]['id'];}return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x4f62d3[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x3d85cc,null))[_0x47a5('0x26')](saveUpdates(_0x4f62d3[_0x47a5('0x4a')],null))['then'](respondWithResult(_0x3d85cc,null))['catch'](handleError(_0x3d85cc,null));};exports[_0x47a5('0x25')]=function(_0x411230,_0x1163e3){return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x411230[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x1163e3,null))['then'](removeEntity(_0x1163e3,null))[_0x47a5('0x44')](handleError(_0x1163e3,null));};exports[_0x47a5('0x4c')]=function(_0x5f6a,_0x5c3c75){return db[_0x47a5('0x3f')]['describe']()[_0x47a5('0x26')](respondWithResult(_0x5c3c75,null))[_0x47a5('0x44')](handleError(_0x5c3c75,null));};exports[_0x47a5('0x4d')]=function(_0xf03bd5,_0x588551){var _0x3adf14={},_0x1e6de3={},_0x2f66e9={'count':0x0,'rows':[]};_0x1e6de3[_0x47a5('0x30')]=_[_0x47a5('0x46')](db[_0x47a5('0x3f')][_0x47a5('0x2d')]);_0x1e6de3['query']=_[_0x47a5('0x46')](_0xf03bd5[_0x47a5('0x31')]);_0x1e6de3[_0x47a5('0x32')]=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],_0x1e6de3[_0x47a5('0x31')]);_0x3adf14['attributes']=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],qs[_0x47a5('0x34')](_0xf03bd5['query'][_0x47a5('0x34')]));_0x3adf14[_0x47a5('0x33')]=_0x3adf14[_0x47a5('0x33')]['length']?_0x3adf14['attributes']:_0x1e6de3[_0x47a5('0x30')];if(!_0xf03bd5[_0x47a5('0x31')]['hasOwnProperty']('nolimit')){_0x3adf14[_0x47a5('0x1f')]=qs['limit'](_0xf03bd5[_0x47a5('0x31')]['limit']);_0x3adf14['offset']=qs[_0x47a5('0x1e')](_0xf03bd5[_0x47a5('0x31')]['offset']);}_0x3adf14[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0xf03bd5['query']['sort']);_0x3adf14[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0xf03bd5[_0x47a5('0x31')],_0x1e6de3['filters']));if(_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x3adf14[_0x47a5('0x39')]=_['merge'](_0x3adf14[_0x47a5('0x39')],{'$or':_['map'](_0x3adf14[_0x47a5('0x33')],function(_0x470da6){var _0x943a15={};_0x943a15[_0x470da6]={'$like':'%'+_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]+'%'};return _0x943a15;})});}_0x3adf14=_['merge']({},_0x3adf14,_0xf03bd5[_0x47a5('0x47')]);var _0x5d1550={'where':_0x3adf14['where']};return db['VoiceQueueReport']['count'](_0x5d1550)[_0x47a5('0x26')](function(_0x6cd4ea){_0x2f66e9[_0x47a5('0x1d')]=_0x6cd4ea;if(_0xf03bd5['query']['includeAll']){_0x3adf14[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x3adf14);})[_0x47a5('0x26')](function(_0xc45e25){_0x2f66e9['rows']=_0xc45e25;return _0x2f66e9;})[_0x47a5('0x26')](respondWithFilteredResult(_0x588551,_0x3adf14,'getVoiceQueuesReport'))[_0x47a5('0x44')](handleError(_0x588551,null,_0x47a5('0x4d')));}; \ No newline at end of file +var _0x9957=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','VoiceQueueReport','count','include','catch','show','params','keys','length','includeAll','find','create','body','describe','getVoiceQueuesReport','fields','limit','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');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 db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xcc;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1e')](_0x2233dd);}return _0x2b4e94[_0x7995('0x1f')](_0x2233dd)[_0x7995('0x20')]();};}function respondWithResult(_0x2202ce,_0x41cbf0){_0x41cbf0=_0x41cbf0||0xc8;return function(_0x5377e5){if(_0x5377e5){return _0x2202ce[_0x7995('0x1f')](_0x41cbf0)['json'](_0x5377e5);}};}function respondWithFilteredResult(_0x2f832e,_0x37f297){return function(_0x43d4b8){if(_0x43d4b8){var _0x291317=_0x43d4b8['count'],_0x1e1415=_0x37f297[_0x7995('0x21')],_0x37a7d4=_0x37f297['offset']+_0x37f297['limit'],_0x4faa60;if(_0x37a7d4>=_0x291317){_0x37a7d4=_0x291317;_0x4faa60=0xc8;}else{_0x4faa60=0xce;}_0x2f832e[_0x7995('0x1f')](_0x4faa60);return _0x2f832e[_0x7995('0x22')]('Content-Range',_0x1e1415+'-'+_0x37a7d4+'/'+_0x291317)[_0x7995('0x23')](_0x43d4b8);}return null;};}function patchUpdates(_0x51f276){return function(_0x4b1a8e){try{jsonpatch[_0x7995('0x24')](_0x4b1a8e,_0x51f276,!![]);}catch(_0x327b1f){return BPromise[_0x7995('0x25')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x26')]();};}function saveUpdates(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x27')](_0x460924)[_0x7995('0x28')](function(_0x204507){return _0x204507;});}return null;};}function removeEntity(_0x285437,_0x563799){return function(_0x13bc35){if(_0x13bc35){return _0x13bc35[_0x7995('0x29')]()[_0x7995('0x28')](function(){_0x285437['status'](0xcc)[_0x7995('0x20')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1e')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x2a')]);if(_0x47625f[_0x7995('0x2b')]){delete _0x47625f[_0x7995('0x2b')];}_0x2a307e[_0x7995('0x1f')](_0x56691a)[_0x7995('0x2c')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['VoiceQueueReport'][_0x7995('0x2d')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2e')],'type':_0xe6b0b3[_0x7995('0x2f')][_0x7995('0x30')]};});_0x3250e0[_0x7995('0x31')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x32')]=_['keys'](_0x9b2a15[_0x7995('0x32')]);_0x3250e0[_0x7995('0x33')]=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]);_0x456a28['attributes']=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x35')]=_0x456a28[_0x7995('0x35')]['length']?_0x456a28[_0x7995('0x35')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x32')][_0x7995('0x36')](_0x7995('0x37'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x32')]['limit']);_0x456a28['offset']=qs[_0x7995('0x21')](_0x9b2a15[_0x7995('0x32')]['offset']);}_0x456a28[_0x7995('0x38')]=qs[_0x7995('0x39')](_0x9b2a15[_0x7995('0x32')][_0x7995('0x39')]);_0x456a28[_0x7995('0x3a')]=qs['filters'](_[_0x7995('0x3b')](_0x9b2a15[_0x7995('0x32')],_0x3250e0[_0x7995('0x33')]),_0x574574);if(_0x9b2a15[_0x7995('0x32')]['filter']){_0x456a28[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x456a28[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2f')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2b')]]={'$like':'%'+_0x9b2a15[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3c')]({},_0x456a28,_0x9b2a15[_0x7995('0x3f')]);var _0x14d638={'where':_0x456a28[_0x7995('0x3a')]};return db[_0x7995('0x40')][_0x7995('0x41')](_0x14d638)[_0x7995('0x28')](function(_0x270d52){_0x4253e5[_0x7995('0x41')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x42')]=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x43')](handleError(_0x514445,null));};exports[_0x7995('0x44')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':![],'where':{'id':_0x35c8ff[_0x7995('0x45')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x40')][_0x7995('0x2d')]);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x46')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x33')]=_[_0x7995('0x34')](_0x5e85b9[_0x7995('0x31')],_0x5e85b9[_0x7995('0x32')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x31')],qs['fields'](_0x35c8ff[_0x7995('0x32')]['fields']));_0x46ac4f[_0x7995('0x35')]=_0x46ac4f['attributes'][_0x7995('0x47')]?_0x46ac4f[_0x7995('0x35')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x32')][_0x7995('0x48')]){_0x46ac4f[_0x7995('0x42')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3c')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x40')][_0x7995('0x49')](_0x46ac4f)[_0x7995('0x28')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x43')](handleError(_0x576b96,null));};exports[_0x7995('0x4a')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x40')]['create'](_0x511567[_0x7995('0x4b')],{})[_0x7995('0x28')](respondWithResult(_0x3d8ae3,0xc9))['catch'](handleError(_0x3d8ae3,null));};exports[_0x7995('0x27')]=function(_0x5843ba,_0x1d87f9){if(_0x5843ba[_0x7995('0x4b')]['id']){delete _0x5843ba[_0x7995('0x4b')]['id'];}return db[_0x7995('0x40')][_0x7995('0x49')]({'where':{'id':_0x5843ba[_0x7995('0x45')]['id']}})[_0x7995('0x28')](handleEntityNotFound(_0x1d87f9,null))['then'](saveUpdates(_0x5843ba[_0x7995('0x4b')],null))[_0x7995('0x28')](respondWithResult(_0x1d87f9,null))[_0x7995('0x43')](handleError(_0x1d87f9,null));};exports['destroy']=function(_0x19da63,_0x1fe77e){return db[_0x7995('0x40')]['find']({'where':{'id':_0x19da63['params']['id']}})['then'](handleEntityNotFound(_0x1fe77e,null))[_0x7995('0x28')](removeEntity(_0x1fe77e,null))[_0x7995('0x43')](handleError(_0x1fe77e,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x28')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x4d')]=function(_0x4ab09f,_0x14fe7f){var _0x33c801={},_0x206d2a={},_0x50c7b5={'count':0x0,'rows':[]};_0x206d2a['model']=_['keys'](db['VoiceQueueReport'][_0x7995('0x2d')]);_0x206d2a[_0x7995('0x32')]=_[_0x7995('0x46')](_0x4ab09f[_0x7995('0x32')]);_0x206d2a[_0x7995('0x33')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],_0x206d2a[_0x7995('0x32')]);_0x33c801[_0x7995('0x35')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],qs[_0x7995('0x4e')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x4e')]));_0x33c801[_0x7995('0x35')]=_0x33c801[_0x7995('0x35')][_0x7995('0x47')]?_0x33c801[_0x7995('0x35')]:_0x206d2a[_0x7995('0x31')];if(!_0x4ab09f['query'][_0x7995('0x36')](_0x7995('0x37'))){_0x33c801[_0x7995('0x4f')]=qs[_0x7995('0x4f')](_0x4ab09f['query']['limit']);_0x33c801[_0x7995('0x21')]=qs[_0x7995('0x21')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x21')]);}_0x33c801['order']=qs[_0x7995('0x39')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x39')]);_0x33c801[_0x7995('0x3a')]=qs['filters'](_['pick'](_0x4ab09f[_0x7995('0x32')],_0x206d2a[_0x7995('0x33')]));if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]){_0x33c801[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x33c801[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x33c801[_0x7995('0x35')],function(_0x50caf5){var _0x18f230={};_0x18f230[_0x50caf5]={'$like':'%'+_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x18f230;})});}_0x33c801=_[_0x7995('0x3c')]({},_0x33c801,_0x4ab09f['options']);var _0x51bf6a={'where':_0x33c801[_0x7995('0x3a')]};return db[_0x7995('0x40')]['count'](_0x51bf6a)[_0x7995('0x28')](function(_0x375fc9){_0x50c7b5[_0x7995('0x41')]=_0x375fc9;if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x48')]){_0x33c801['include']=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x33c801);})[_0x7995('0x28')](function(_0xe31dcb){_0x50c7b5[_0x7995('0x50')]=_0xe31dcb;return _0x50c7b5;})[_0x7995('0x28')](respondWithFilteredResult(_0x14fe7f,_0x33c801,_0x7995('0x4d')))[_0x7995('0x43')](handleError(_0x14fe7f,null,_0x7995('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 3458f84..54cffa4 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 _0xa571=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xa571,0xe6));var _0x1a57=function(_0x13aded,_0x21d21b){_0x13aded=_0x13aded-0x0;var _0x38f4c7=_0xa571[_0x13aded];return _0x38f4c7;};'use strict';var EventEmitter=require(_0x1a57('0x0'));var VoiceQueueReport=require(_0x1a57('0x1'))['db'][_0x1a57('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1a57('0x3')](0x0);var events={'afterCreate':_0x1a57('0x4'),'afterUpdate':_0x1a57('0x5'),'afterDestroy':_0x1a57('0x6')};function emitEvent(_0x404e63){return function(_0x409edd,_0x35928d,_0x5f3125){VoiceQueueReportEvents[_0x1a57('0x7')](_0x404e63+':'+_0x409edd['id'],_0x409edd);VoiceQueueReportEvents[_0x1a57('0x7')](_0x404e63,_0x409edd);_0x5f3125(null);};}for(var e in events){if(events[_0x1a57('0x8')](e)){var event=events[e];VoiceQueueReport[_0x1a57('0x9')](e,emitEvent(event));}}module[_0x1a57('0xa')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x9b26=['emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove'];(function(_0x3b4967,_0x267d42){var _0x47fc11=function(_0x5b6c4b){while(--_0x5b6c4b){_0x3b4967['push'](_0x3b4967['shift']());}};_0x47fc11(++_0x267d42);}(_0x9b26,0x86));var _0x69b2=function(_0x38a8af,_0x5729e2){_0x38a8af=_0x38a8af-0x0;var _0x25cc45=_0x9b26[_0x38a8af];return _0x25cc45;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x69b2('0x0'))['db'][_0x69b2('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x69b2('0x2')](0x0);var events={'afterCreate':_0x69b2('0x3'),'afterUpdate':_0x69b2('0x4'),'afterDestroy':_0x69b2('0x5')};function emitEvent(_0x5832a1){return function(_0x3df0ed,_0x278545,_0x190c11){VoiceQueueReportEvents[_0x69b2('0x6')](_0x5832a1+':'+_0x3df0ed['id'],_0x3df0ed);VoiceQueueReportEvents[_0x69b2('0x6')](_0x5832a1,_0x3df0ed);_0x190c11(null);};}for(var e in events){if(events[_0x69b2('0x7')](e)){var event=events[e];VoiceQueueReport[_0x69b2('0x8')](e,emitEvent(event));}}module[_0x69b2('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index df50539..95565b0 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 _0xbaf0=['define','VoiceQueueReport','report_queue','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x53f28e,_0x2e2c2d){var _0x21a9da=function(_0x468fab){while(--_0x468fab){_0x53f28e['push'](_0x53f28e['shift']());}};_0x21a9da(++_0x2e2c2d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['define','report_queue','uniqueid','calleridnum','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x385c76,_0xb97335){var _0x5c8367=function(_0xdfcd3){while(--_0xdfcd3){_0x385c76['push'](_0x385c76['shift']());}};_0x5c8367(++_0xb97335);}(_0xb10b,0x12a));var _0xbb10=function(_0x149f32,_0x4273f7){_0x149f32=_0x149f32-0x0;var _0x11f475=_0xb10b[_0x149f32];return _0x11f475;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('VoiceQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'fields':[_0xbb10('0xc')]},{'fields':[_0xbb10('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 8d38a84..85a952e 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 _0xeb5f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VoiceQueueReport,\x20%s,\x20%s','GetVoiceQueueReport','options','raw','where','limit','map','include','model','attributes','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment'];(function(_0x5514d1,_0x105abf){var _0xdb918=function(_0x1cf7ac){while(--_0x1cf7ac){_0x5514d1['push'](_0x5514d1['shift']());}};_0xdb918(++_0x105abf);}(_0xeb5f,0x8a));var _0xfeb5=function(_0x458c6a,_0x378e8b){_0x458c6a=_0x458c6a-0x0;var _0x78dbcf=_0xeb5f[_0x458c6a];return _0x78dbcf;};'use strict';var _=require(_0xfeb5('0x0'));var util=require(_0xfeb5('0x1'));var moment=require(_0xfeb5('0x2'));var BPromise=require(_0xfeb5('0x3'));var rs=require(_0xfeb5('0x4'));var fs=require('fs');var Redis=require(_0xfeb5('0x5'));var db=require(_0xfeb5('0x6'))['db'];var utils=require(_0xfeb5('0x7'));var logger=require(_0xfeb5('0x8'))(_0xfeb5('0x9'));var config=require(_0xfeb5('0xa'));var jayson=require(_0xfeb5('0xb'));var client=jayson[_0xfeb5('0xc')][_0xfeb5('0xd')]({'port':0x232a});config[_0xfeb5('0xe')]=_[_0xfeb5('0xf')](config[_0xfeb5('0xe')],{'host':_0xfeb5('0x10'),'port':0x18eb});var socket=require(_0xfeb5('0x11'))(new Redis(config[_0xfeb5('0xe')]));require(_0xfeb5('0x12'))['register'](socket);function respondWithRpcPromise(_0x126bdf,_0x34360d,_0xbccfae){return new BPromise(function(_0x2d627f,_0xbff496){return client[_0xfeb5('0x13')](_0x126bdf,_0xbccfae)[_0xfeb5('0x14')](function(_0xd46dfc){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x34360d,_0xfeb5('0x15'));logger[_0xfeb5('0x16')](_0xfeb5('0x17'),_0x34360d,_0xfeb5('0x15'),JSON[_0xfeb5('0x18')](_0xd46dfc));if(_0xd46dfc[_0xfeb5('0x19')]){if(_0xd46dfc['error'][_0xfeb5('0x1a')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x34360d,_0xd46dfc[_0xfeb5('0x19')][_0xfeb5('0x1b')]);return _0xbff496(_0xd46dfc['error']['message']);}logger[_0xfeb5('0x19')]('VoiceQueueReport,\x20%s,\x20%s',_0x34360d,_0xd46dfc['error']['message']);return _0x2d627f(_0xd46dfc['error'][_0xfeb5('0x1b')]);}else{logger[_0xfeb5('0x1c')]('VoiceQueueReport,\x20%s,\x20%s',_0x34360d,_0xfeb5('0x15'));_0x2d627f(_0xd46dfc[_0xfeb5('0x1d')][_0xfeb5('0x1b')]);}})[_0xfeb5('0x1e')](function(_0x16f962){logger[_0xfeb5('0x19')](_0xfeb5('0x1f'),_0x34360d,_0x16f962);_0xbff496(_0x16f962);});});}exports[_0xfeb5('0x20')]=function(_0xe09af9){var _0x50c09e=this;return new Promise(function(_0x1e19e0,_0x2d0e0a){return db['VoiceQueueReport']['findAll']({'raw':_0xe09af9[_0xfeb5('0x21')]?_0xe09af9[_0xfeb5('0x21')][_0xfeb5('0x22')]===undefined?!![]:![]:!![],'where':_0xe09af9[_0xfeb5('0x21')]?_0xe09af9[_0xfeb5('0x21')][_0xfeb5('0x23')]||null:null,'attributes':_0xe09af9[_0xfeb5('0x21')]?_0xe09af9[_0xfeb5('0x21')]['attributes']||null:null,'limit':_0xe09af9[_0xfeb5('0x21')]?_0xe09af9[_0xfeb5('0x21')][_0xfeb5('0x24')]||null:null,'include':_0xe09af9[_0xfeb5('0x21')]?_0xe09af9[_0xfeb5('0x21')]['include']?_[_0xfeb5('0x25')](_0xe09af9[_0xfeb5('0x21')][_0xfeb5('0x26')],function(_0x3beac2){return{'model':db[_0x3beac2[_0xfeb5('0x27')]],'as':_0x3beac2['as'],'attributes':_0x3beac2['attributes'],'include':_0x3beac2[_0xfeb5('0x26')]?_[_0xfeb5('0x25')](_0x3beac2[_0xfeb5('0x26')],function(_0x3df2c6){return{'model':db[_0x3df2c6[_0xfeb5('0x27')]],'as':_0x3df2c6['as'],'attributes':_0x3df2c6[_0xfeb5('0x28')],'include':_0x3df2c6[_0xfeb5('0x26')]?_[_0xfeb5('0x25')](_0x3df2c6[_0xfeb5('0x26')],function(_0x3b547c){return{'model':db[_0x3b547c[_0xfeb5('0x27')]],'as':_0x3b547c['as'],'attributes':_0x3b547c['attributes']};}):[]};}):[]};}):[]:[]})[_0xfeb5('0x14')](function(_0x3855c2){logger['info'](_0xfeb5('0x20'),_0xe09af9);logger[_0xfeb5('0x16')]('GetVoiceQueueReport',_0xe09af9,JSON['stringify'](_0x3855c2));_0x1e19e0(_0x3855c2);})[_0xfeb5('0x1e')](function(_0x40aced){logger[_0xfeb5('0x19')]('GetVoiceQueueReport',_0x40aced[_0xfeb5('0x1b')],_0xe09af9);_0x2d0e0a(_0x50c09e['error'](0x1f4,_0x40aced['message']));});});};exports[_0xfeb5('0x29')]=function(_0x592d3f){var _0x2ae984=this;return new Promise(function(_0x105b5f,_0x108acc){return db[_0xfeb5('0x2a')][_0xfeb5('0x2b')](_0x592d3f[_0xfeb5('0x2c')],{'raw':_0x592d3f[_0xfeb5('0x21')]?_0x592d3f['options'][_0xfeb5('0x22')]===undefined?!![]:![]:!![]})[_0xfeb5('0x14')](function(_0x130466){logger[_0xfeb5('0x1c')](_0xfeb5('0x29'),_0x592d3f);logger[_0xfeb5('0x16')](_0xfeb5('0x29'),_0x592d3f,JSON[_0xfeb5('0x18')](_0x130466));_0x105b5f(_0x130466);})['catch'](function(_0x30e6dc){logger[_0xfeb5('0x19')]('CreateVoiceQueueReport',_0x30e6dc['message'],_0x592d3f);_0x108acc(_0x2ae984[_0xfeb5('0x19')](0x1f4,_0x30e6dc[_0xfeb5('0x1b')]));});});};exports[_0xfeb5('0x2d')]=function(_0x3fbfa1){var _0x4e2e12=this;return new Promise(function(_0x288e71,_0x39af6f){return db[_0xfeb5('0x2a')][_0xfeb5('0x2e')](_0x3fbfa1['body'],{'raw':_0x3fbfa1[_0xfeb5('0x21')]?_0x3fbfa1[_0xfeb5('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fbfa1[_0xfeb5('0x21')]?_0x3fbfa1['options'][_0xfeb5('0x23')]||null:null,'attributes':_0x3fbfa1[_0xfeb5('0x21')]?_0x3fbfa1[_0xfeb5('0x21')][_0xfeb5('0x28')]||null:null,'limit':_0x3fbfa1[_0xfeb5('0x21')]?_0x3fbfa1[_0xfeb5('0x21')]['limit']||null:null})[_0xfeb5('0x14')](function(_0x6af715){logger[_0xfeb5('0x1c')](_0xfeb5('0x2d'),_0x3fbfa1);logger[_0xfeb5('0x16')](_0xfeb5('0x2d'),_0x3fbfa1,JSON[_0xfeb5('0x18')](_0x6af715));_0x288e71(_0x6af715);})[_0xfeb5('0x1e')](function(_0x18f412){logger[_0xfeb5('0x19')]('UpdateVoiceQueueReport',_0x18f412[_0xfeb5('0x1b')],_0x3fbfa1);_0x39af6f(_0x4e2e12[_0xfeb5('0x19')](0x1f4,_0x18f412['message']));});});}; \ No newline at end of file +var _0x935f=['include','model','map','CreateVoiceQueueReport','VoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','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','findAll','options','where','attributes','limit'];(function(_0x238830,_0x545f75){var _0x5917f0=function(_0x12f821){while(--_0x12f821){_0x238830['push'](_0x238830['shift']());}};_0x5917f0(++_0x545f75);}(_0x935f,0xc2));var _0xf935=function(_0x1a8518,_0x4fde78){_0x1a8518=_0x1a8518-0x0;var _0x1ac19c=_0x935f[_0x1a8518];return _0x1ac19c;};'use strict';var _=require(_0xf935('0x0'));var util=require(_0xf935('0x1'));var moment=require(_0xf935('0x2'));var BPromise=require(_0xf935('0x3'));var rs=require(_0xf935('0x4'));var fs=require('fs');var Redis=require(_0xf935('0x5'));var db=require(_0xf935('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf935('0x7'))(_0xf935('0x8'));var config=require(_0xf935('0x9'));var jayson=require(_0xf935('0xa'));var client=jayson[_0xf935('0xb')]['http']({'port':0x232a});config['redis']=_[_0xf935('0xc')](config['redis'],{'host':_0xf935('0xd'),'port':0x18eb});var socket=require(_0xf935('0xe'))(new Redis(config[_0xf935('0xf')]));require(_0xf935('0x10'))[_0xf935('0x11')](socket);function respondWithRpcPromise(_0x55dcb0,_0x47e329,_0x1dc0d7){return new BPromise(function(_0x1d2831,_0x23220d){return client[_0xf935('0x12')](_0x55dcb0,_0x1dc0d7)[_0xf935('0x13')](function(_0x5166bd){logger[_0xf935('0x14')](_0xf935('0x15'),_0x47e329,_0xf935('0x16'));logger[_0xf935('0x17')](_0xf935('0x18'),_0x47e329,_0xf935('0x16'),JSON[_0xf935('0x19')](_0x5166bd));if(_0x5166bd[_0xf935('0x1a')]){if(_0x5166bd[_0xf935('0x1a')][_0xf935('0x1b')]===0x1f4){logger[_0xf935('0x1a')](_0xf935('0x15'),_0x47e329,_0x5166bd[_0xf935('0x1a')][_0xf935('0x1c')]);return _0x23220d(_0x5166bd[_0xf935('0x1a')][_0xf935('0x1c')]);}logger['error'](_0xf935('0x15'),_0x47e329,_0x5166bd[_0xf935('0x1a')][_0xf935('0x1c')]);return _0x1d2831(_0x5166bd[_0xf935('0x1a')][_0xf935('0x1c')]);}else{logger[_0xf935('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x47e329,_0xf935('0x16'));_0x1d2831(_0x5166bd['result'][_0xf935('0x1c')]);}})[_0xf935('0x1d')](function(_0x460e92){logger[_0xf935('0x1a')](_0xf935('0x15'),_0x47e329,_0x460e92);_0x23220d(_0x460e92);});});}exports[_0xf935('0x1e')]=function(_0x277cf6){var _0x5c885c=this;return new Promise(function(_0x31c84b,_0x41278b){return db['VoiceQueueReport'][_0xf935('0x1f')]({'raw':_0x277cf6['options']?_0x277cf6[_0xf935('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x277cf6[_0xf935('0x20')]?_0x277cf6[_0xf935('0x20')][_0xf935('0x21')]||null:null,'attributes':_0x277cf6[_0xf935('0x20')]?_0x277cf6[_0xf935('0x20')][_0xf935('0x22')]||null:null,'limit':_0x277cf6[_0xf935('0x20')]?_0x277cf6[_0xf935('0x20')][_0xf935('0x23')]||null:null,'include':_0x277cf6[_0xf935('0x20')]?_0x277cf6[_0xf935('0x20')][_0xf935('0x24')]?_['map'](_0x277cf6[_0xf935('0x20')][_0xf935('0x24')],function(_0x5351db){return{'model':db[_0x5351db['model']],'as':_0x5351db['as'],'attributes':_0x5351db[_0xf935('0x22')],'include':_0x5351db[_0xf935('0x24')]?_['map'](_0x5351db[_0xf935('0x24')],function(_0x132abb){return{'model':db[_0x132abb[_0xf935('0x25')]],'as':_0x132abb['as'],'attributes':_0x132abb[_0xf935('0x22')],'include':_0x132abb[_0xf935('0x24')]?_[_0xf935('0x26')](_0x132abb[_0xf935('0x24')],function(_0x55f5a5){return{'model':db[_0x55f5a5[_0xf935('0x25')]],'as':_0x55f5a5['as'],'attributes':_0x55f5a5['attributes']};}):[]};}):[]};}):[]:[]})[_0xf935('0x13')](function(_0x4858b1){logger['info'](_0xf935('0x1e'),_0x277cf6);logger['debug'](_0xf935('0x1e'),_0x277cf6,JSON[_0xf935('0x19')](_0x4858b1));_0x31c84b(_0x4858b1);})[_0xf935('0x1d')](function(_0x198426){logger[_0xf935('0x1a')]('GetVoiceQueueReport',_0x198426[_0xf935('0x1c')],_0x277cf6);_0x41278b(_0x5c885c[_0xf935('0x1a')](0x1f4,_0x198426[_0xf935('0x1c')]));});});};exports[_0xf935('0x27')]=function(_0x2ada07){var _0x35a6c2=this;return new Promise(function(_0x189cb3,_0x331a9c){return db[_0xf935('0x28')][_0xf935('0x29')](_0x2ada07[_0xf935('0x2a')],{'raw':_0x2ada07['options']?_0x2ada07[_0xf935('0x20')][_0xf935('0x2b')]===undefined?!![]:![]:!![]})['then'](function(_0x248c80){logger[_0xf935('0x14')](_0xf935('0x27'),_0x2ada07);logger[_0xf935('0x17')]('CreateVoiceQueueReport',_0x2ada07,JSON[_0xf935('0x19')](_0x248c80));_0x189cb3(_0x248c80);})[_0xf935('0x1d')](function(_0x599ab1){logger[_0xf935('0x1a')]('CreateVoiceQueueReport',_0x599ab1['message'],_0x2ada07);_0x331a9c(_0x35a6c2[_0xf935('0x1a')](0x1f4,_0x599ab1[_0xf935('0x1c')]));});});};exports[_0xf935('0x2c')]=function(_0x3f43eb){var _0x35fd74=this;return new Promise(function(_0x263608,_0x404c6a){return db['VoiceQueueReport'][_0xf935('0x2d')](_0x3f43eb[_0xf935('0x2a')],{'raw':_0x3f43eb[_0xf935('0x20')]?_0x3f43eb[_0xf935('0x20')][_0xf935('0x2b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f43eb[_0xf935('0x20')]?_0x3f43eb[_0xf935('0x20')]['where']||null:null,'attributes':_0x3f43eb['options']?_0x3f43eb['options'][_0xf935('0x22')]||null:null,'limit':_0x3f43eb[_0xf935('0x20')]?_0x3f43eb[_0xf935('0x20')][_0xf935('0x23')]||null:null})[_0xf935('0x13')](function(_0x4229fd){logger[_0xf935('0x14')]('UpdateVoiceQueueReport',_0x3f43eb);logger[_0xf935('0x17')](_0xf935('0x2c'),_0x3f43eb,JSON[_0xf935('0x19')](_0x4229fd));_0x263608(_0x4229fd);})[_0xf935('0x1d')](function(_0x44d59f){logger['error'](_0xf935('0x2c'),_0x44d59f['message'],_0x3f43eb);_0x404c6a(_0x35fd74[_0xf935('0x1a')](0x1f4,_0x44d59f[_0xf935('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index ac20800..a0c40a7 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 _0xc623=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','removeListener'];(function(_0x536919,_0x2d0c68){var _0x3694d9=function(_0xf21223){while(--_0xf21223){_0x536919['push'](_0x536919['shift']());}};_0x3694d9(++_0x2d0c68);}(_0xc623,0x9b));var _0x3c62=function(_0x3033e7,_0x18ff2a){_0x3033e7=_0x3033e7-0x0;var _0x2f9f62=_0xc623[_0x3033e7];return _0x2f9f62;};'use strict';var VoiceQueueReportEvents=require(_0x3c62('0x0'));var events=[_0x3c62('0x1'),_0x3c62('0x2'),_0x3c62('0x3')];function createListener(_0x1ca90c,_0x351560){return function(_0x1cee19){_0x351560['emit'](_0x1ca90c,_0x1cee19);};}function removeListener(_0x5caca4,_0x1b220b){return function(){VoiceQueueReportEvents[_0x3c62('0x4')](_0x5caca4,_0x1b220b);};}exports[_0x3c62('0x5')]=function(_0x1f630f){for(var _0x4783a1=0x0,_0xfd3211=events[_0x3c62('0x6')];_0x4783a1<_0xfd3211;_0x4783a1++){var _0x2ffb25=events[_0x4783a1];var _0x4248c2=createListener(_0x3c62('0x7')+_0x2ffb25,_0x1f630f);VoiceQueueReportEvents['on'](_0x2ffb25,_0x4248c2);}}; \ No newline at end of file +var _0x5b2e=['save','remove','update','emit','length','voiceQueueReport:'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x5b2e,0x1c8));var _0xe5b2=function(_0x4537d1,_0x281391){_0x4537d1=_0x4537d1-0x0;var _0x237472=_0x5b2e[_0x4537d1];return _0x237472;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xe5b2('0x0'),_0xe5b2('0x1'),_0xe5b2('0x2')];function createListener(_0x29c8fe,_0x370583){return function(_0x374473){_0x370583[_0xe5b2('0x3')](_0x29c8fe,_0x374473);};}function removeListener(_0x1777da,_0x8d3b5a){return function(){VoiceQueueReportEvents['removeListener'](_0x1777da,_0x8d3b5a);};}exports['register']=function(_0x22aa71){for(var _0x2b6255=0x0,_0x211eab=events[_0xe5b2('0x4')];_0x2b6255<_0x211eab;_0x2b6255++){var _0xa59e5e=events[_0x2b6255];var _0x2f107e=createListener(_0xe5b2('0x5')+_0xa59e5e,_0x22aa71);VoiceQueueReportEvents['on'](_0xa59e5e,_0x2f107e);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 0be47f8..57c796b 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 _0xe9b9=['../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1253b7,_0x34214a){var _0xf18c64=function(_0x3690ae){while(--_0x3690ae){_0x1253b7['push'](_0x1253b7['shift']());}};_0xf18c64(++_0x34214a);}(_0xe9b9,0x19c));var _0x9e9b=function(_0x20e283,_0x2b5a6e){_0x20e283=_0x20e283-0x0;var _0x199e10=_0xe9b9[_0x20e283];return _0x199e10;};'use strict';var multer=require(_0x9e9b('0x0'));var util=require(_0x9e9b('0x1'));var path=require(_0x9e9b('0x2'));var timeout=require(_0x9e9b('0x3'));var express=require(_0x9e9b('0x4'));var router=express[_0x9e9b('0x5')]();var auth=require(_0x9e9b('0x6'));var interaction=require(_0x9e9b('0x7'));var config=require(_0x9e9b('0x8'));var controller=require(_0x9e9b('0x9'));router[_0x9e9b('0xa')]('/',auth[_0x9e9b('0xb')](),controller[_0x9e9b('0xc')]);router[_0x9e9b('0xa')](_0x9e9b('0xd'),auth[_0x9e9b('0xb')](),controller[_0x9e9b('0xe')]);router['post']('/',auth[_0x9e9b('0xb')](),controller['create']);router[_0x9e9b('0xf')](_0x9e9b('0xd'),auth[_0x9e9b('0xb')](),controller[_0x9e9b('0x10')]);router[_0x9e9b('0x11')](_0x9e9b('0xd'),auth[_0x9e9b('0xb')](),controller[_0x9e9b('0x12')]);module[_0x9e9b('0x13')]=router; \ No newline at end of file +var _0xed39=['isAuthenticated','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./voiceQueuesLog.controller','get','/:id'];(function(_0x535e94,_0x2b325e){var _0x337d55=function(_0x260cd0){while(--_0x260cd0){_0x535e94['push'](_0x535e94['shift']());}};_0x337d55(++_0x2b325e);}(_0xed39,0xa7));var _0x9ed3=function(_0x18947c,_0xa391b){_0x18947c=_0x18947c-0x0;var _0x5ed660=_0xed39[_0x18947c];return _0x5ed660;};'use strict';var multer=require(_0x9ed3('0x0'));var util=require(_0x9ed3('0x1'));var path=require(_0x9ed3('0x2'));var timeout=require(_0x9ed3('0x3'));var express=require(_0x9ed3('0x4'));var router=express['Router']();var auth=require(_0x9ed3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9ed3('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9ed3('0x7')](_0x9ed3('0x8'),auth[_0x9ed3('0x9')](),controller[_0x9ed3('0xa')]);router['post']('/',auth[_0x9ed3('0x9')](),controller[_0x9ed3('0xb')]);router[_0x9ed3('0xc')](_0x9ed3('0x8'),auth[_0x9ed3('0x9')](),controller[_0x9ed3('0xd')]);router[_0x9ed3('0xe')]('/:id',auth[_0x9ed3('0x9')](),controller['destroy']);module[_0x9ed3('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 59121bf..6a5d3aa 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 _0xc076=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE'];(function(_0x3da07e,_0x543814){var _0x34b5cc=function(_0x4aa1de){while(--_0x4aa1de){_0x3da07e['push'](_0x3da07e['shift']());}};_0x34b5cc(++_0x543814);}(_0xc076,0x159));var _0x6c07=function(_0x288bf4,_0x230d74){_0x288bf4=_0x288bf4-0x0;var _0x41f92a=_0xc076[_0x288bf4];return _0x41f92a;};'use strict';var Sequelize=require(_0x6c07('0x0'));var moment=require(_0x6c07('0x1'));module[_0x6c07('0x2')]={'time':{'type':Sequelize[_0x6c07('0x3')]},'callid':{'type':Sequelize[_0x6c07('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6c07('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6c07('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6c07('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6c07('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6c07('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x6c07('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6c07('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6c07('0x4')],'allowNull':![],'defaultValue':moment()[_0x6c07('0x5')](_0x6c07('0x6'))}}; \ No newline at end of file +var _0x5dd8=['format','YYYY-MM-DD\x20HH:mm:ss','exports','STRING','DATE'];(function(_0xcf73aa,_0x454902){var _0x1044df=function(_0x594690){while(--_0x594690){_0xcf73aa['push'](_0xcf73aa['shift']());}};_0x1044df(++_0x454902);}(_0x5dd8,0x142));var _0x85dd=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0x5dd8[_0x5756f8];return _0x3bb749;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x85dd('0x0')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x85dd('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x85dd('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x85dd('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x85dd('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x85dd('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x85dd('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x85dd('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x85dd('0x2')],'allowNull':![],'defaultValue':moment()[_0x85dd('0x3')](_0x85dd('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 621a0c0..783dfe0 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x36f569,_0x4c2933){var _0x5ba075=function(_0x5c483f){while(--_0x5c483f){_0x36f569['push'](_0x36f569['shift']());}};_0x5ba075(++_0x4c2933);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xb10b=['where','merge','VoiceQueuesLog','include','rows','catch','show','params','includeAll','options','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x293717,_0x4d7163){var _0x5568b6=function(_0xb5d01d){while(--_0xb5d01d){_0x293717['push'](_0x293717['shift']());}};_0x5568b6(++_0x4d7163);}(_0xb10b,0x12a));var _0xbb10=function(_0x57b5d5,_0x25b4ee){_0x57b5d5=_0x57b5d5-0x0;var _0x24e2b5=_0xb10b[_0x57b5d5];return _0x24e2b5;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['VoiceQueuesLog'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]),_0x20d946);if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));};exports[_0xbb10('0x3f')]=function(_0x5f3d67,_0x1e8f79){var _0x1c7fae={'raw':!![],'where':{'id':_0x5f3d67[_0xbb10('0x40')]['id']}},_0x3e7b4c={};_0x3e7b4c['model']=_[_0xbb10('0x2d')](db[_0xbb10('0x3b')][_0xbb10('0x28')]);_0x3e7b4c[_0xbb10('0x30')]=_['keys'](_0x5f3d67[_0xbb10('0x30')]);_0x3e7b4c[_0xbb10('0x2e')]=_['intersection'](_0x3e7b4c['model'],_0x3e7b4c[_0xbb10('0x30')]);_0x1c7fae['attributes']=_[_0xbb10('0x2f')](_0x3e7b4c[_0xbb10('0x2c')],qs['fields'](_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x31')]));_0x1c7fae[_0xbb10('0x32')]=_0x1c7fae['attributes'][_0xbb10('0x33')]?_0x1c7fae[_0xbb10('0x32')]:_0x3e7b4c[_0xbb10('0x2c')];if(_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x41')]){_0x1c7fae[_0xbb10('0x3c')]=[{'all':!![]}];}_0x1c7fae=_[_0xbb10('0x3a')]({},_0x1c7fae,_0x5f3d67[_0xbb10('0x42')]);return db[_0xbb10('0x3b')][_0xbb10('0x43')](_0x1c7fae)[_0xbb10('0x23')](handleEntityNotFound(_0x1e8f79,null))[_0xbb10('0x23')](respondWithResult(_0x1e8f79,null))['catch'](handleError(_0x1e8f79,null));};exports[_0xbb10('0x44')]=function(_0x41bbf8,_0x4a1248){return db[_0xbb10('0x3b')][_0xbb10('0x44')](_0x41bbf8[_0xbb10('0x45')],{})[_0xbb10('0x23')](respondWithResult(_0x4a1248,0xc9))[_0xbb10('0x3e')](handleError(_0x4a1248,null));};exports[_0xbb10('0x46')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x45')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x45')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x3e')](handleError(_0x5be85e,null));};exports[_0xbb10('0x24')]=function(_0x22b315,_0x2f2552){return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x22b315[_0xbb10('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f2552,null))['then'](removeEntity(_0x2f2552,null))[_0xbb10('0x3e')](handleError(_0x2f2552,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 9407dee..d720aa8 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 _0x82c4=['api','moment','bluebird','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0x82c4,0x144));var _0x482c=function(_0xcb6d2b,_0x1a56ac){_0xcb6d2b=_0xcb6d2b-0x0;var _0x2c3687=_0x82c4[_0xcb6d2b];return _0x2c3687;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x482c('0x0'));var moment=require(_0x482c('0x1'));var BPromise=require(_0x482c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x3'));var config=require(_0x482c('0x4'));var attributes=require(_0x482c('0x5'));module[_0x482c('0x6')]=function(_0x898a7,_0x17d79f){return _0x898a7['define'](_0x482c('0x7'),attributes,{'tableName':_0x482c('0x8'),'paranoid':![],'indexes':[{'name':_0x482c('0x9'),'fields':[_0x482c('0xa'),_0x482c('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7796=['VoiceQueuesLog','voice_queues_log','event','dtm','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define'];(function(_0x4aa37b,_0x17724b){var _0x4605a1=function(_0x443829){while(--_0x443829){_0x4aa37b['push'](_0x4aa37b['shift']());}};_0x4605a1(++_0x17724b);}(_0x7796,0x1b6));var _0x6779=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7796[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6779('0x0'));var util=require(_0x6779('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6779('0x2'));var BPromise=require(_0x6779('0x3'));var rp=require(_0x6779('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6779('0x5'));var config=require(_0x6779('0x6'));var attributes=require(_0x6779('0x7'));module[_0x6779('0x8')]=function(_0x2d26cd,_0x1f299d){return _0x2d26cd[_0x6779('0x9')](_0x6779('0xa'),attributes,{'tableName':_0x6779('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x6779('0xc'),_0x6779('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 7e02397..3c8ad9f 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 _0x1bc6=['then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x380105,_0x55667e){var _0x450f7b=function(_0x2e23c2){while(--_0x2e23c2){_0x380105['push'](_0x380105['shift']());}};_0x450f7b(++_0x55667e);}(_0x1bc6,0x94));var _0x61bc=function(_0x49abfb,_0x51548d){_0x49abfb=_0x49abfb-0x0;var _0x140c07=_0x1bc6[_0x49abfb];return _0x140c07;};'use strict';var _=require(_0x61bc('0x0'));var util=require(_0x61bc('0x1'));var moment=require(_0x61bc('0x2'));var BPromise=require(_0x61bc('0x3'));var rs=require(_0x61bc('0x4'));var fs=require('fs');var Redis=require(_0x61bc('0x5'));var db=require(_0x61bc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x61bc('0x7'))(_0x61bc('0x8'));var config=require(_0x61bc('0x9'));var jayson=require(_0x61bc('0xa'));var client=jayson[_0x61bc('0xb')][_0x61bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x410656,_0x1b29e3,_0x151ef4){return new BPromise(function(_0x5ebb87,_0x339305){return client['request'](_0x410656,_0x151ef4)[_0x61bc('0xd')](function(_0x502dc0){logger[_0x61bc('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1b29e3,_0x61bc('0xf'));logger[_0x61bc('0x10')](_0x61bc('0x11'),_0x1b29e3,'request\x20sent',JSON['stringify'](_0x502dc0));if(_0x502dc0['error']){if(_0x502dc0['error']['code']===0x1f4){logger[_0x61bc('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1b29e3,_0x502dc0[_0x61bc('0x12')][_0x61bc('0x13')]);return _0x339305(_0x502dc0['error']['message']);}logger['error'](_0x61bc('0x14'),_0x1b29e3,_0x502dc0[_0x61bc('0x12')]['message']);return _0x5ebb87(_0x502dc0[_0x61bc('0x12')][_0x61bc('0x13')]);}else{logger[_0x61bc('0xe')](_0x61bc('0x14'),_0x1b29e3,_0x61bc('0xf'));_0x5ebb87(_0x502dc0[_0x61bc('0x15')]['message']);}})[_0x61bc('0x16')](function(_0x21b974){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x1b29e3,_0x21b974);_0x339305(_0x21b974);});});} \ No newline at end of file +var _0x3c81=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x37e4db,_0x4a7101){var _0x290dfa=function(_0x4c9719){while(--_0x4c9719){_0x37e4db['push'](_0x37e4db['shift']());}};_0x290dfa(++_0x4a7101);}(_0x3c81,0x102));var _0x13c8=function(_0xc93c1e,_0x11c446){_0xc93c1e=_0xc93c1e-0x0;var _0x3436a6=_0x3c81[_0xc93c1e];return _0x3436a6;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c8('0x4'));var config=require(_0x13c8('0x5'));var jayson=require(_0x13c8('0x6'));var client=jayson[_0x13c8('0x7')][_0x13c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f0bd2,_0x445b69,_0x4f7bcc){return new BPromise(function(_0x17c228,_0x4905c3){return client[_0x13c8('0x9')](_0x3f0bd2,_0x4f7bcc)[_0x13c8('0xa')](function(_0x189ce6){logger[_0x13c8('0xb')](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));logger[_0x13c8('0xe')](_0x13c8('0xf'),_0x445b69,_0x13c8('0xd'),JSON[_0x13c8('0x10')](_0x189ce6));if(_0x189ce6[_0x13c8('0x11')]){if(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x12')]===0x1f4){logger[_0x13c8('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x445b69,_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);return _0x4905c3(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);}logger['error'](_0x13c8('0xc'),_0x445b69,_0x189ce6['error']['message']);return _0x17c228(_0x189ce6['error'][_0x13c8('0x13')]);}else{logger['info'](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));_0x17c228(_0x189ce6[_0x13c8('0x14')][_0x13c8('0x13')]);}})['catch'](function(_0x13a9e1){logger[_0x13c8('0x11')](_0x13c8('0xc'),_0x445b69,_0x13a9e1);_0x4905c3(_0x13a9e1);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index b1ce5a1..3e1e962 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 _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x49d63f,_0x4259f9){var _0xbbb70e=function(_0x1edad5){while(--_0x1edad5){_0x49d63f['push'](_0x49d63f['shift']());}};_0xbbb70e(++_0x4259f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x4f210c,_0x85c4c1){var _0x41d251=function(_0x2ae409){while(--_0x2ae409){_0x4f210c['push'](_0x4f210c['shift']());}};_0x41d251(++_0x85c4c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index bc570e9..9662e91 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 _0x4d9a=['NEW','FLOAT','BOOLEAN','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','DATE','sequelize','moment','path','VIRTUAL','extname','STRING','setDataValue','membername','split','TEXT'];(function(_0x424c0f,_0x31a27d){var _0x265bf4=function(_0x419f69){while(--_0x419f69){_0x424c0f['push'](_0x424c0f['shift']());}};_0x265bf4(++_0x31a27d);}(_0x4d9a,0x1b8));var _0xa4d9=function(_0x2c554d,_0x2ac33f){_0x2c554d=_0x2c554d-0x0;var _0x55808d=_0x4d9a[_0x2c554d];return _0x55808d;};'use strict';var Sequelize=require(_0xa4d9('0x0'));var moment=require(_0xa4d9('0x1'));var path=require(_0xa4d9('0x2'));module['exports']={'format':{'type':Sequelize[_0xa4d9('0x3')],'get':function(){return this['getDataValue']('value')?path[_0xa4d9('0x4')](this['getDataValue']('value')):undefined;}},'uniqueid':{'type':Sequelize[_0xa4d9('0x5')]},'channel':{'type':Sequelize[_0xa4d9('0x5')],'set':function(_0x3f2c3d){if(_0x3f2c3d){this[_0xa4d9('0x6')]('channel',_0x3f2c3d);this['setDataValue'](_0xa4d9('0x7'),_0x3f2c3d[_0xa4d9('0x8')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xa4d9('0x5')]},'calleridnum':{'type':Sequelize[_0xa4d9('0x5')]},'calleridname':{'type':Sequelize[_0xa4d9('0x5')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xa4d9('0x5')]},'accountcode':{'type':Sequelize[_0xa4d9('0x5')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xa4d9('0x5')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xa4d9('0x5')]},'userDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0xa4d9('0x9')]},'transcribeName':{'type':Sequelize[_0xa4d9('0x5')]},'transcribeStatus':{'type':Sequelize[_0xa4d9('0x5')],'defaultValue':_0xa4d9('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0xa4d9('0x9')]},'failureReason':{'type':Sequelize[_0xa4d9('0x9')]},'sentiment':{'type':Sequelize[_0xa4d9('0x5')]},'sPositive':{'type':Sequelize[_0xa4d9('0xb')]},'sNegative':{'type':Sequelize[_0xa4d9('0xb')]},'sNeutral':{'type':Sequelize[_0xa4d9('0xb')]},'sMixed':{'type':Sequelize[_0xa4d9('0xb')]},'tempSentiment':{'type':Sequelize[_0xa4d9('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa4d9('0xd')]('createdAt'))[_0xa4d9('0xe')](_0xa4d9('0xf'))[_0xa4d9('0x10')]();}},'updatedAt':{'type':Sequelize[_0xa4d9('0x11')],'get':function(){return moment(this[_0xa4d9('0xd')]('updatedAt'))[_0xa4d9('0xe')](_0xa4d9('0xf'))[_0xa4d9('0x10')]();}}}; \ No newline at end of file +var _0x4422=['createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','getDataValue','value','STRING','setDataValue','membername','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE'];(function(_0x4fbc39,_0x1ba566){var _0x515f3e=function(_0x52af0d){while(--_0x52af0d){_0x4fbc39['push'](_0x4fbc39['shift']());}};_0x515f3e(++_0x1ba566);}(_0x4422,0x175));var _0x2442=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4422[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require('path');module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('value')?path['extname'](this[_0x2442('0x0')](_0x2442('0x1'))):undefined;}},'uniqueid':{'type':Sequelize[_0x2442('0x2')]},'channel':{'type':Sequelize[_0x2442('0x2')],'set':function(_0x581187){if(_0x581187){this[_0x2442('0x3')]('channel',_0x581187);this[_0x2442('0x3')](_0x2442('0x4'),_0x581187['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x2442('0x2')]},'calleridnum':{'type':Sequelize[_0x2442('0x2')]},'calleridname':{'type':Sequelize[_0x2442('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2442('0x2')]},'connectedlinename':{'type':Sequelize[_0x2442('0x2')]},'accountcode':{'type':Sequelize[_0x2442('0x2')]},'context':{'type':Sequelize[_0x2442('0x2')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x2442('0x2')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x2442('0x5')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x2442('0x2')]},'location':{'type':Sequelize[_0x2442('0x6')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0x2442('0x2')],'defaultValue':_0x2442('0x7')},'fileUri':{'type':Sequelize[_0x2442('0x6')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0x2442('0x6')]},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize[_0x2442('0x8')]},'sNegative':{'type':Sequelize[_0x2442('0x8')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x2442('0x8')]},'tempSentiment':{'type':Sequelize[_0x2442('0x9')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x2442('0xa')],'get':function(){return moment(this[_0x2442('0x0')](_0x2442('0xb')))[_0x2442('0xc')](_0x2442('0xd'))[_0x2442('0xe')]();}},'updatedAt':{'type':Sequelize[_0x2442('0xa')],'get':function(){return moment(this[_0x2442('0x0')](_0x2442('0xf')))[_0x2442('0xc')](_0x2442('0xd'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 6ebd4b1..168bee3 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 _0x51e0=['attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','col','token','$and','push','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','destroy','listBuckets','upload','TranscribeService','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','findOne','decryptFile','recording','Voice\x20Recording\x20not\x20found','Setting','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','set','apply','save','update','then','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','format','keys','query','filters','intersection','model','fields'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x51e0,0x183));var _0x051e=function(_0xdda626,_0x22a782){_0xdda626=_0xdda626-0x0;var _0x122c8f=_0x51e0[_0xdda626];return _0x122c8f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x051e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x051e('0x1'));var moment=require(_0x051e('0x2'));var BPromise=require(_0x051e('0x3'));var Mustache=require(_0x051e('0x4'));var util=require('util');var path=require('path');var sox=require(_0x051e('0x5'));var csv=require(_0x051e('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x051e('0x7'));var crypto=require(_0x051e('0x8'));var jsforce=require(_0x051e('0x9'));var deskjs=require(_0x051e('0xa'));var toCsv=require('to-csv');var querystring=require(_0x051e('0xb'));var Papa=require(_0x051e('0xc'));var AWS=require(_0x051e('0xd'));var uuidv4=require(_0x051e('0xe'));var Redis=require(_0x051e('0xf'));var authService=require(_0x051e('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x051e('0x11'));var logger=require(_0x051e('0x12'))('api');var utils=require(_0x051e('0x13'));var config=require(_0x051e('0x14'));var db=require(_0x051e('0x15'))['db'];function respondWithStatusCode(_0x4230dd,_0x58fad6){_0x58fad6=_0x58fad6||0xcc;return function(_0x43bf2a){if(_0x43bf2a){return _0x4230dd[_0x051e('0x16')](_0x58fad6);}return _0x4230dd['status'](_0x58fad6)[_0x051e('0x17')]();};}function respondWithResult(_0x46b9ad,_0x3000fd){_0x3000fd=_0x3000fd||0xc8;return function(_0x271015){if(_0x271015){return _0x46b9ad['status'](_0x3000fd)[_0x051e('0x18')](_0x271015);}};}function respondWithFilteredResult(_0x17381e,_0x4acfd9){return function(_0x4fd617){if(_0x4fd617){var _0x3b7731=_0x4fd617[_0x051e('0x19')],_0x4e4e5f=_0x4acfd9['offset'],_0x44eab2=_0x4acfd9[_0x051e('0x1a')]+_0x4acfd9['limit'],_0x510549;if(_0x44eab2>=_0x3b7731){_0x44eab2=_0x3b7731;_0x510549=0xc8;}else{_0x510549=0xce;}_0x17381e[_0x051e('0x1b')](_0x510549);return _0x17381e[_0x051e('0x1c')]('Content-Range',_0x4e4e5f+'-'+_0x44eab2+'/'+_0x3b7731)[_0x051e('0x18')](_0x4fd617);}return null;};}function patchUpdates(_0x3f0022){return function(_0x10f07d){try{jsonpatch[_0x051e('0x1d')](_0x10f07d,_0x3f0022,!![]);}catch(_0x54b483){return BPromise['reject'](_0x54b483);}return _0x10f07d[_0x051e('0x1e')]();};}function saveUpdates(_0x55dc0f,_0x29ac30){return function(_0x552f8b){if(_0x552f8b){return _0x552f8b[_0x051e('0x1f')](_0x55dc0f)[_0x051e('0x20')](function(_0x7ef455){return _0x7ef455;});}return null;};}function removeEntity(_0x2c7d11,_0x2d477b){return function(_0x3ea368){if(_0x3ea368){return _0x3ea368['destroy']()[_0x051e('0x20')](function(){_0x2c7d11[_0x051e('0x1b')](0xcc)[_0x051e('0x17')]();});}};}function handleEntityNotFound(_0x41ea57,_0x2df52){return function(_0x5ccaf5){if(!_0x5ccaf5){_0x41ea57[_0x051e('0x16')](0x194);}return _0x5ccaf5;};}function handleError(_0x390640,_0x2cab2a){_0x2cab2a=_0x2cab2a||0x1f4;return function(_0x34cc59){logger[_0x051e('0x21')](_0x34cc59[_0x051e('0x22')]);if(_0x34cc59[_0x051e('0x23')]){delete _0x34cc59['name'];}_0x390640[_0x051e('0x1b')](_0x2cab2a)[_0x051e('0x24')](_0x34cc59);};}exports[_0x051e('0x25')]=function(_0x45e35d,_0x5b4f47){var _0x69ef9e={},_0x907a1b={},_0x5813c0={'count':0x0,'rows':[]};var _0x354b73=_[_0x051e('0x26')](db[_0x051e('0x27')][_0x051e('0x28')],function(_0x3efd39){return{'name':_0x3efd39[_0x051e('0x29')],'type':_0x3efd39[_0x051e('0x2a')][_0x051e('0x2b')]};});_0x907a1b['model']=_['differenceBy'](_[_0x051e('0x26')](_0x354b73,_0x051e('0x23')),[_0x051e('0x2c')]);_0x907a1b['query']=_[_0x051e('0x2d')](_0x45e35d[_0x051e('0x2e')]);_0x907a1b[_0x051e('0x2f')]=_[_0x051e('0x30')](_0x907a1b['model'],_0x907a1b['query']);_0x69ef9e['attributes']=_['intersection'](_0x907a1b[_0x051e('0x31')],qs[_0x051e('0x32')](_0x45e35d['query'][_0x051e('0x32')]));_0x69ef9e[_0x051e('0x33')]=_0x69ef9e['attributes'][_0x051e('0x34')]?_0x69ef9e['attributes']:_0x907a1b[_0x051e('0x31')];if(!_0x45e35d[_0x051e('0x2e')][_0x051e('0x35')](_0x051e('0x36'))){_0x69ef9e['limit']=qs[_0x051e('0x37')](_0x45e35d[_0x051e('0x2e')]['limit']);_0x69ef9e[_0x051e('0x1a')]=qs[_0x051e('0x1a')](_0x45e35d['query'][_0x051e('0x1a')]);}_0x69ef9e[_0x051e('0x38')]=qs[_0x051e('0x39')](_0x45e35d['query'][_0x051e('0x39')]);_0x69ef9e[_0x051e('0x3a')]=qs[_0x051e('0x2f')](_[_0x051e('0x3b')](_0x45e35d[_0x051e('0x2e')],_0x907a1b[_0x051e('0x2f')]),_0x354b73);if(_0x45e35d['query']['filter']){_0x69ef9e[_0x051e('0x3a')]=_['merge'](_0x69ef9e[_0x051e('0x3a')],{'$or':_[_0x051e('0x26')](_0x354b73,function(_0x462bf4){if(_0x462bf4[_0x051e('0x2a')]!=='VIRTUAL'){var _0x20bfa2={};_0x20bfa2[_0x462bf4[_0x051e('0x23')]]={'$like':'%'+_0x45e35d[_0x051e('0x2e')][_0x051e('0x3c')]+'%'};return _0x20bfa2;}})});}_0x69ef9e=_[_0x051e('0x3d')]({},_0x69ef9e,_0x45e35d[_0x051e('0x3e')]);var _0x1360a9={'where':_0x69ef9e['where']};return db[_0x051e('0x27')][_0x051e('0x19')](_0x1360a9)[_0x051e('0x20')](function(_0x4815f1){_0x5813c0[_0x051e('0x19')]=_0x4815f1;if(_0x45e35d[_0x051e('0x2e')][_0x051e('0x3f')]){_0x69ef9e[_0x051e('0x40')]=[{'all':!![]}];}return db[_0x051e('0x27')][_0x051e('0x41')](_0x69ef9e);})[_0x051e('0x20')](function(_0x16c0bf){_0x5813c0[_0x051e('0x42')]=_0x16c0bf;return _0x5813c0;})[_0x051e('0x20')](respondWithFilteredResult(_0x5b4f47,_0x69ef9e))[_0x051e('0x43')](handleError(_0x5b4f47,null));};exports[_0x051e('0x44')]=function(_0x5684be,_0xb8deb9){var _0x3bb5b3={'raw':![],'where':{'id':_0x5684be[_0x051e('0x45')]['id']}},_0x2bab67={};_0x2bab67[_0x051e('0x31')]=_[_0x051e('0x2d')](db[_0x051e('0x27')]['rawAttributes']);_0x2bab67['query']=_[_0x051e('0x2d')](_0x5684be[_0x051e('0x2e')]);_0x2bab67[_0x051e('0x2f')]=_[_0x051e('0x30')](_0x2bab67[_0x051e('0x31')],_0x2bab67[_0x051e('0x2e')]);_0x3bb5b3['attributes']=_[_0x051e('0x30')](_0x2bab67[_0x051e('0x31')],qs['fields'](_0x5684be[_0x051e('0x2e')]['fields']));_0x3bb5b3[_0x051e('0x33')]=_0x3bb5b3[_0x051e('0x33')][_0x051e('0x34')]?_0x3bb5b3[_0x051e('0x33')]:_0x2bab67[_0x051e('0x31')];if(_0x5684be[_0x051e('0x2e')][_0x051e('0x3f')]){_0x3bb5b3[_0x051e('0x40')]=[{'all':!![]}];}_0x3bb5b3=_[_0x051e('0x3d')]({},_0x3bb5b3,_0x5684be['options']);return db[_0x051e('0x27')][_0x051e('0x46')](_0x3bb5b3)[_0x051e('0x20')](handleEntityNotFound(_0xb8deb9,null))[_0x051e('0x20')](respondWithResult(_0xb8deb9,null))['catch'](handleError(_0xb8deb9,null));};exports[_0x051e('0x47')]=function(_0x28fa42,_0x3e3e07){return db[_0x051e('0x27')][_0x051e('0x47')](_0x28fa42[_0x051e('0x48')],{})[_0x051e('0x20')](respondWithResult(_0x3e3e07,0xc9))[_0x051e('0x43')](handleError(_0x3e3e07,null));};exports[_0x051e('0x1f')]=function(_0x41857c,_0x5bd0f2){if(_0x41857c['body']['id']){delete _0x41857c[_0x051e('0x48')]['id'];}return db[_0x051e('0x27')][_0x051e('0x46')]({'where':{'id':_0x41857c[_0x051e('0x45')]['id']}})[_0x051e('0x20')](handleEntityNotFound(_0x5bd0f2,null))['then'](saveUpdates(_0x41857c['body'],null))['then'](respondWithResult(_0x5bd0f2,null))[_0x051e('0x43')](handleError(_0x5bd0f2,null));};exports[_0x051e('0x49')]=function(_0x3f3be2,_0x2b1e58){return db[_0x051e('0x27')][_0x051e('0x49')]()[_0x051e('0x20')](respondWithResult(_0x2b1e58,null))[_0x051e('0x43')](handleError(_0x2b1e58,null));};exports[_0x051e('0x4a')]=function(_0x14988d,_0x4c237b,_0x1e194f){var _0x477e87=require(_0x051e('0x4b'));var _0x54aadd=![];var _0x39a42a={};if(_0x14988d[_0x051e('0x2e')]['type']&&_0x14988d[_0x051e('0x2e')][_0x051e('0x2a')]===_0x051e('0x4c')){_0x39a42a['uniqueid']=_0x14988d[_0x051e('0x45')]['id'];}else{_0x39a42a['id']=_0x14988d[_0x051e('0x45')]['id'];}return db['VoiceRecording']['find']({'where':_0x39a42a,'attributes':['id',_0x051e('0x4d')],'raw':!![]})[_0x051e('0x20')](handleEntityNotFound(_0x4c237b,null))[_0x051e('0x20')](function(_0x301848){if(_0x301848){var _0x15006e=_0x301848[_0x051e('0x4d')];var _0x46380d=util[_0x051e('0x2c')](_0x051e('0x4e'),_0x15006e);if(fs[_0x051e('0x4f')](_0x46380d)){_0x54aadd=!![];return _0x477e87['decryptFile'](_0x46380d,_0x15006e,config[_0x051e('0x50')]['recording'])[_0x051e('0x20')](function(){return _0x301848;});}return _0x301848;}})[_0x051e('0x20')](function(_0xa68d00){if(_0xa68d00){var _0x898ac1=_0xa68d00[_0x051e('0x4d')];if(!fs['existsSync'](_0x898ac1)){throw new db[(_0x051e('0x51'))][(_0x051e('0x52'))](_0x051e('0x53'));}if(_0xa68d00[_0x051e('0x54')]){return _0x4c237b['download'](_0x898ac1,_0xa68d00[_0x051e('0x54')]+path[_0x051e('0x55')](_0x898ac1),function(){if(_0x54aadd){fs[_0x051e('0x56')](_0x898ac1);}});}else{return _0x4c237b[_0x051e('0x4a')](_0x898ac1,function(_0x4b0757){if(_0x54aadd){fs[_0x051e('0x56')](_0x898ac1);}});}}})[_0x051e('0x43')](function(_0x459dd7){if(_0x459dd7[_0x051e('0x57')]===_0x051e('0x53')){_0x4c237b['status'](0x194)[_0x051e('0x24')]('Not\x20found');}else{return handleError(_0x4c237b,null);}});};exports[_0x051e('0x58')]=function(_0x20d4da,_0x3601d3,_0x5cdcc9){var _0x3d2988=require(_0x051e('0x4b'));var _0xaa8982=![];var _0x30831f={'$and':[db[_0x051e('0x59')][_0x051e('0x3a')](db[_0x051e('0x59')]['fn']('MD5',db['sequelize'][_0x051e('0x5a')]('uniqueid')),_0x20d4da[_0x051e('0x2e')][_0x051e('0x5b')])]};if(_0x20d4da[_0x051e('0x2e')][_0x051e('0x2a')]&&_0x20d4da['query'][_0x051e('0x2a')]===_0x051e('0x4c')){_0x30831f['$and']['push']({'uniqueid':_0x20d4da[_0x051e('0x45')]['id']});}else{_0x30831f[_0x051e('0x5c')][_0x051e('0x5d')]({'id':_0x20d4da[_0x051e('0x45')]['id']});}return db[_0x051e('0x27')][_0x051e('0x46')]({'where':_0x30831f,'attributes':['id',_0x051e('0x4d')],'raw':!![]})[_0x051e('0x20')](handleEntityNotFound(_0x3601d3,null))[_0x051e('0x20')](function(_0x50cae0){if(_0x50cae0){var _0x3ea660=util[_0x051e('0x2c')](_0x051e('0x4e'),_0x50cae0[_0x051e('0x4d')]);if(fs[_0x051e('0x4f')](_0x3ea660)){_0xaa8982=!![];return _0x3d2988['decryptFile'](_0x3ea660,_0x50cae0[_0x051e('0x4d')],config[_0x051e('0x50')]['recording'])[_0x051e('0x20')](function(){return _0x50cae0;});}return _0x50cae0;}})[_0x051e('0x20')](function(_0x520e2f){if(_0x520e2f){if(!fs['existsSync'](_0x520e2f[_0x051e('0x4d')])){throw new db[(_0x051e('0x51'))][(_0x051e('0x52'))](_0x051e('0x53'));}if(_0x520e2f[_0x051e('0x54')]){return _0x3601d3[_0x051e('0x4a')](_0x520e2f['value'],_0x520e2f[_0x051e('0x54')]+path[_0x051e('0x55')](_0x520e2f['value']),function(){if(_0xaa8982){fs['unlink'](_0x520e2f[_0x051e('0x4d')]);}});}else{return _0x3601d3[_0x051e('0x4a')](_0x520e2f[_0x051e('0x4d')],function(_0x2cbb12){if(_0xaa8982){fs['unlink'](_0x520e2f['value']);}});}}})['catch'](handleError(_0x3601d3,null));};exports['destroy']=function(_0x3aa0ab,_0x4ebe68){return db[_0x051e('0x27')][_0x051e('0x46')]({'where':{'id':_0x3aa0ab['params']['id']}})[_0x051e('0x20')](function(_0x49f0d){if(!_0x49f0d)throw new ReferenceError('Entity\x20not\x20found');return _0x49f0d;})[_0x051e('0x20')](function(_0x3b199d){var _0x3117ad=_0x3b199d[_0x051e('0x4d')];logger[_0x051e('0x5e')](_0x051e('0x5f'),_0x3117ad);if(!_[_0x051e('0x60')](_0x3b199d[_0x051e('0x4d')])&&fs[_0x051e('0x4f')](_0x3117ad)){logger[_0x051e('0x5e')](_0x051e('0x61')+_0x3117ad+_0x051e('0x62'));fs[_0x051e('0x63')](_0x3117ad);}_0x3117ad=_0x3117ad+_0x051e('0x64');if(!_[_0x051e('0x60')](_0x3b199d[_0x051e('0x4d')])&&fs[_0x051e('0x4f')](_0x3117ad)){logger[_0x051e('0x5e')](_0x051e('0x61')+_0x3117ad+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x051e('0x63')](_0x3117ad);}return _0x3b199d;})[_0x051e('0x20')](function(_0x588a08){if(!_0x588a08)throw new InternalError();return _0x588a08[_0x051e('0x65')]();})[_0x051e('0x20')](function(){_0x4ebe68[_0x051e('0x1b')](0xcc)['end']();})[_0x051e('0x43')](handleError(_0x4ebe68,null));};function getBucketslist(_0x820d8d,_0x5b17b2,_0x362861){return new Promise(function(_0x5d3ca4,_0x41ec49){var _0x4738ae=new AWS['S3']({'accessKeyId':_0x5b17b2,'secretAccessKey':_0x820d8d,'region':_0x362861});_0x4738ae[_0x051e('0x66')]({},function(_0x104ede,_0x29b59a){if(_0x104ede){return _0x41ec49(_0x104ede);}else{return _0x5d3ca4(_0x29b59a);}});});}function createBucket(_0x35b25c,_0x235a36,_0x5509b0,_0x1d8e10){return new Promise(function(_0x56e8b0,_0x279ad2){var _0x180d50=new AWS['S3']({'accessKeyId':_0x235a36,'secretAccessKey':_0x35b25c,'region':_0x5509b0});_0x180d50['createBucket']({'Bucket':_0x1d8e10},function(_0x26a8c8,_0x1d6ee8){if(_0x26a8c8){return _0x279ad2(_0x26a8c8);}else{return _0x56e8b0(_0x1d6ee8);}});});}function uploadFile(_0x22c5e6,_0x4699cc,_0xb5add5,_0x5b7f5f,_0x3345e1,_0x4165bb){return new Promise(function(_0x7a06f8,_0x410ff3){var _0x3c7fc1=new AWS['S3']({'accessKeyId':_0x4699cc,'secretAccessKey':_0x22c5e6,'region':_0xb5add5});_0x3c7fc1[_0x051e('0x67')]({'Bucket':_0x5b7f5f,'Key':_0x3345e1,'Body':_0x4165bb},function(_0x5a6880,_0x165491){if(_0x5a6880){return _0x410ff3(_0x5a6880);}else{return _0x7a06f8(_0x165491);}});});}function startTranscribe(_0x5653f5,_0x2e46e4,_0x2c4325,_0x2f825e,_0x2c2adf,_0x1ae836){return new Promise(function(_0x28a93d,_0x2d6059){var _0x50b4af=new AWS[(_0x051e('0x68'))]({'accessKeyId':_0x2e46e4,'secretAccessKey':_0x5653f5,'region':_0x2c4325});_0x50b4af['startTranscriptionJob']({'TranscriptionJobName':_0x2f825e,'LanguageCode':_0x2c2adf,'Media':{'MediaFileUri':_0x1ae836}},function(_0xff79bc,_0x5e9a62){if(_0xff79bc){return _0x2d6059(_0xff79bc);}else{return _0x28a93d(_0x5e9a62);}});});}function transcribe(_0x27f5f2,_0xfb422b,_0x43d1a0,_0x4cef12,_0x37a091,_0x905499,_0x185220){return new Promise(function(_0x594063,_0x44597b){var _0x34b5d8={};logger[_0x051e('0x5e')](util[_0x051e('0x2c')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x27f5f2,_0x37a091));return uploadFile(_0xfb422b,_0x43d1a0,_0x4cef12,_0x37a091,path[_0x051e('0x69')](_0x905499),fs[_0x051e('0x6a')](_0x905499))[_0x051e('0x20')](function(_0x4d39bb){logger['info'](util[_0x051e('0x2c')](_0x051e('0x6b'),_0x27f5f2,_0x37a091,_0x4d39bb[_0x051e('0x6c')]));_0x34b5d8['bucket']=_0x4d39bb[_0x051e('0x6d')];_0x34b5d8[_0x051e('0x6e')]=_0x4d39bb[_0x051e('0x6c')];logger[_0x051e('0x5e')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x27f5f2));return startTranscribe(_0xfb422b,_0x43d1a0,_0x4cef12,uuidv4(),_0x185220,_0x4d39bb['Location']);})[_0x051e('0x20')](function(_0x4ab531){logger[_0x051e('0x5e')](util[_0x051e('0x2c')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x27f5f2,_0x4ab531['TranscriptionJob'][_0x051e('0x6f')]));_0x34b5d8[_0x051e('0x70')]=_0x4ab531[_0x051e('0x71')][_0x051e('0x6f')];_0x34b5d8[_0x051e('0x72')]=_0x4ab531[_0x051e('0x71')][_0x051e('0x73')];return _0x594063(_0x34b5d8);})['catch'](function(_0x5d6014){return _0x44597b(_0x5d6014);});});}exports['runTranscribe']=function(_0x49652f,_0x1876f4,_0x3e1f60){var _0x4124c8;var _0x5d67f0;var _0x3d2043;var _0x3858bf=require('../../components/encryptor');return db[_0x051e('0x27')][_0x051e('0x74')]({'where':{'id':_0x49652f['params']['id']}})[_0x051e('0x20')](function(_0x4e37ac){if(_0x4e37ac){var _0x18c8f3=util['format'](_0x051e('0x4e'),_0x4e37ac[_0x051e('0x4d')]);if(fs['existsSync'](_0x18c8f3)){cypher=!![];return _0x3858bf[_0x051e('0x75')](_0x18c8f3,_0x4e37ac[_0x051e('0x4d')],config[_0x051e('0x50')][_0x051e('0x76')])[_0x051e('0x20')](function(){return _0x4e37ac;});}return _0x4e37ac;}})['then'](function(_0x52c334){if(!_0x52c334){throw new db['Sequelize'][(_0x051e('0x52'))](_0x051e('0x77'));}_0x5d67f0=_0x52c334;return db[_0x051e('0x78')][_0x051e('0x74')]({'where':{'id':0x1}});})[_0x051e('0x20')](handleEntityNotFound(_0x1876f4,null))[_0x051e('0x20')](function(_0x4922cf){if(_0x4922cf){_0x4124c8=_0x4922cf;if(!_0x4124c8['transcribe']||!_0x4124c8['transcribeAccountId']||!_0x4124c8['transcribeRegion']||!_0x4124c8[_0x051e('0x79')]||!_0x4124c8[_0x051e('0x7a')]){throw new db[(_0x051e('0x51'))]['ValidationError'](_0x051e('0x7b'));}if(_0x49652f['body'][_0x051e('0x7c')]&&(!_0x4124c8[_0x051e('0x7d')]||!_0x4124c8[_0x051e('0x7e')]||!_0x4124c8[_0x051e('0x7f')]||!_0x4124c8[_0x051e('0x79')]||!_0x4124c8[_0x051e('0x7a')])){throw new db[(_0x051e('0x51'))][(_0x051e('0x52'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0x051e('0x74')]({'where':{'id':_0x4124c8[_0x051e('0x80')]}});}})[_0x051e('0x20')](function(_0x1898ce){if(!_0x1898ce){throw new db[(_0x051e('0x51'))][(_0x051e('0x52'))](_0x051e('0x81'));}if(!_0x1898ce[_0x051e('0x82')]||!_0x1898ce[_0x051e('0x83')]){throw new db['Sequelize'][(_0x051e('0x52'))]('Cloud\x20Provider\x20not\x20configured');}_0x3d2043=_0x1898ce;return getBucketslist(_0x3d2043['data1'],_0x3d2043[_0x051e('0x83')],_0x4124c8[_0x051e('0x84')]);})[_0x051e('0x20')](function(_0x4bd351){if(_0x4bd351&&_0x4bd351['Buckets']){var _0x4fc605=_[_0x051e('0x46')](_0x4bd351[_0x051e('0x85')],function(_0x3c5dc8){return _0x3c5dc8[_0x051e('0x86')]===_0x4124c8[_0x051e('0x7a')];});if(!_0x4fc605){logger[_0x051e('0x5e')](util['format'](_0x051e('0x87'),_0x49652f[_0x051e('0x45')]['id'],_0x4124c8[_0x051e('0x7a')]));return createBucket(_0x3d2043[_0x051e('0x82')],_0x3d2043[_0x051e('0x83')],_0x4124c8[_0x051e('0x84')],_0x4124c8['bucket']);}logger[_0x051e('0x5e')](util['format'](_0x051e('0x88'),_0x49652f[_0x051e('0x45')]['id'],_0x4124c8[_0x051e('0x7a')]));return;}})[_0x051e('0x20')](function(_0x511543){if(_0x5d67f0[_0x051e('0x72')]==='NEW'){return transcribe(_0x49652f['params']['id'],_0x3d2043[_0x051e('0x82')],_0x3d2043[_0x051e('0x83')],_0x4124c8[_0x051e('0x84')],_0x4124c8['bucket'],_0x5d67f0[_0x051e('0x4d')],_0x4124c8[_0x051e('0x79')]);}else{logger[_0x051e('0x5e')](util[_0x051e('0x2c')](_0x051e('0x89'),_0x49652f[_0x051e('0x45')]['id']));return{'transcribeStatus':_0x051e('0x8a')};}})[_0x051e('0x20')](function(_0x494d04){if(_0x494d04){_0x494d04[_0x051e('0x8b')]=_0x49652f['body']['runSentiment'];return _0x5d67f0['updateAttributes'](_0x494d04);}})[_0x051e('0x20')](respondWithResult(_0x1876f4,null))[_0x051e('0x43')](handleError(_0x1876f4,null));};function writeFile(_0x2b4cd6,_0x204ec6){return new Promise(function(_0x3dc005,_0x10bf0a){fs[_0x051e('0x8c')](_0x204ec6,_0x2b4cd6,function(_0x42797e,_0x53461b){if(_0x42797e){return _0x10bf0a(_0x42797e);}else{return _0x3dc005(_0x53461b);}});});}exports['downloadTranscribe']=function(_0x2de89e,_0x383878,_0x5951fd){return db['VoiceRecording'][_0x051e('0x74')]({'where':{'id':_0x2de89e['params']['id']}})[_0x051e('0x20')](handleEntityNotFound(_0x383878))[_0x051e('0x20')](function(_0x4d33c7){if(_0x4d33c7&&_0x4d33c7[_0x051e('0x8d')]){var _0x3b3ece=_0x4d33c7[_0x051e('0x8d')];var _0x1262ce=config[_0x051e('0x8e')]+_0x051e('0x8f')+_0x4d33c7['id']+_0x051e('0x90');if(fs[_0x051e('0x4f')](_0x1262ce)){return _0x1262ce;}return writeFile(_0x3b3ece,_0x1262ce)[_0x051e('0x20')](function(){return _0x1262ce;});}else{throw new db['Sequelize']['ValidationError'](_0x051e('0x91'));}})['then'](function(_0x54c19c){return _0x383878[_0x051e('0x4a')](_0x54c19c);})[_0x051e('0x43')](handleError(_0x383878));}; \ No newline at end of file +var _0x25c8=['aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','set','Content-Range','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filters','pick','merge','filter','options','VoiceRecording','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','download','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','../../components/encryptor','sequelize','MD5','col','$and','push','Sequelize','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse'];(function(_0x507d62,_0x1f83cb){var _0xed22f2=function(_0x183714){while(--_0x183714){_0x507d62['push'](_0x507d62['shift']());}};_0xed22f2(++_0x1f83cb);}(_0x25c8,0x11d));var _0x825c=function(_0x52a208,_0xb330a6){_0x52a208=_0x52a208-0x0;var _0x3f3956=_0x25c8[_0x52a208];return _0x3f3956;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x825c('0x0'));var zipdir=require(_0x825c('0x1'));var jsonpatch=require(_0x825c('0x2'));var rp=require('request-promise');var moment=require(_0x825c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x825c('0x4'));var util=require(_0x825c('0x5'));var path=require(_0x825c('0x6'));var sox=require(_0x825c('0x7'));var csv=require(_0x825c('0x8'));var ejs=require(_0x825c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x825c('0xa'));var crypto=require(_0x825c('0xb'));var jsforce=require(_0x825c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x825c('0x8'));var querystring=require(_0x825c('0xd'));var Papa=require(_0x825c('0xe'));var AWS=require(_0x825c('0xf'));var uuidv4=require(_0x825c('0x10'));var Redis=require('ioredis');var authService=require(_0x825c('0x11'));var qs=require(_0x825c('0x12'));var as=require(_0x825c('0x13'));var hardwareService=require(_0x825c('0x14'));var logger=require('../../config/logger')(_0x825c('0x15'));var utils=require('../../config/utils');var config=require(_0x825c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f8cd1,_0x2cd858){_0x2cd858=_0x2cd858||0xcc;return function(_0x13a750){if(_0x13a750){return _0x1f8cd1[_0x825c('0x17')](_0x2cd858);}return _0x1f8cd1[_0x825c('0x18')](_0x2cd858)[_0x825c('0x19')]();};}function respondWithResult(_0x480796,_0x23fe82){_0x23fe82=_0x23fe82||0xc8;return function(_0x1f3f46){if(_0x1f3f46){return _0x480796['status'](_0x23fe82)[_0x825c('0x1a')](_0x1f3f46);}};}function respondWithFilteredResult(_0x1f6cb2,_0x51e337){return function(_0x46ca78){if(_0x46ca78){var _0x2ed13f=_0x46ca78['count'],_0x5a0762=_0x51e337[_0x825c('0x1b')],_0x1856f7=_0x51e337[_0x825c('0x1b')]+_0x51e337['limit'],_0x1b5762;if(_0x1856f7>=_0x2ed13f){_0x1856f7=_0x2ed13f;_0x1b5762=0xc8;}else{_0x1b5762=0xce;}_0x1f6cb2[_0x825c('0x18')](_0x1b5762);return _0x1f6cb2[_0x825c('0x1c')](_0x825c('0x1d'),_0x5a0762+'-'+_0x1856f7+'/'+_0x2ed13f)['json'](_0x46ca78);}return null;};}function patchUpdates(_0x44527f){return function(_0x4bc3ad){try{jsonpatch['apply'](_0x4bc3ad,_0x44527f,!![]);}catch(_0x3c8cf7){return BPromise[_0x825c('0x1e')](_0x3c8cf7);}return _0x4bc3ad['save']();};}function saveUpdates(_0x9f4b1d,_0x43c20a){return function(_0x2e5b44){if(_0x2e5b44){return _0x2e5b44[_0x825c('0x1f')](_0x9f4b1d)[_0x825c('0x20')](function(_0x22d144){return _0x22d144;});}return null;};}function removeEntity(_0x672824,_0x39eb04){return function(_0x53aa62){if(_0x53aa62){return _0x53aa62[_0x825c('0x21')]()[_0x825c('0x20')](function(){_0x672824['status'](0xcc)[_0x825c('0x19')]();});}};}function handleEntityNotFound(_0x490309,_0x17ff0b){return function(_0x4288e5){if(!_0x4288e5){_0x490309[_0x825c('0x17')](0x194);}return _0x4288e5;};}function handleError(_0x281e7b,_0x5e0221){_0x5e0221=_0x5e0221||0x1f4;return function(_0x21c366){logger[_0x825c('0x22')](_0x21c366['stack']);if(_0x21c366[_0x825c('0x23')]){delete _0x21c366[_0x825c('0x23')];}_0x281e7b['status'](_0x5e0221)[_0x825c('0x24')](_0x21c366);};}exports[_0x825c('0x25')]=function(_0x559358,_0x126c6f){var _0x4d1fd2={},_0x1e65f5={},_0x2c4957={'count':0x0,'rows':[]};var _0x84f91b=_[_0x825c('0x26')](db['VoiceRecording'][_0x825c('0x27')],function(_0x1ebf6f){return{'name':_0x1ebf6f[_0x825c('0x28')],'type':_0x1ebf6f[_0x825c('0x29')][_0x825c('0x2a')]};});_0x1e65f5[_0x825c('0x2b')]=_[_0x825c('0x2c')](_['map'](_0x84f91b,_0x825c('0x23')),['format']);_0x1e65f5[_0x825c('0x2d')]=_[_0x825c('0x2e')](_0x559358['query']);_0x1e65f5['filters']=_[_0x825c('0x2f')](_0x1e65f5['model'],_0x1e65f5[_0x825c('0x2d')]);_0x4d1fd2[_0x825c('0x30')]=_[_0x825c('0x2f')](_0x1e65f5[_0x825c('0x2b')],qs[_0x825c('0x31')](_0x559358['query'][_0x825c('0x31')]));_0x4d1fd2[_0x825c('0x30')]=_0x4d1fd2[_0x825c('0x30')][_0x825c('0x32')]?_0x4d1fd2[_0x825c('0x30')]:_0x1e65f5[_0x825c('0x2b')];if(!_0x559358[_0x825c('0x2d')][_0x825c('0x33')]('nolimit')){_0x4d1fd2['limit']=qs[_0x825c('0x34')](_0x559358[_0x825c('0x2d')][_0x825c('0x34')]);_0x4d1fd2[_0x825c('0x1b')]=qs[_0x825c('0x1b')](_0x559358['query'][_0x825c('0x1b')]);}_0x4d1fd2['order']=qs[_0x825c('0x35')](_0x559358[_0x825c('0x2d')][_0x825c('0x35')]);_0x4d1fd2[_0x825c('0x36')]=qs[_0x825c('0x37')](_[_0x825c('0x38')](_0x559358[_0x825c('0x2d')],_0x1e65f5[_0x825c('0x37')]),_0x84f91b);if(_0x559358['query']['filter']){_0x4d1fd2['where']=_[_0x825c('0x39')](_0x4d1fd2[_0x825c('0x36')],{'$or':_[_0x825c('0x26')](_0x84f91b,function(_0x278417){if(_0x278417['type']!=='VIRTUAL'){var _0x3d5c84={};_0x3d5c84[_0x278417[_0x825c('0x23')]]={'$like':'%'+_0x559358['query'][_0x825c('0x3a')]+'%'};return _0x3d5c84;}})});}_0x4d1fd2=_[_0x825c('0x39')]({},_0x4d1fd2,_0x559358[_0x825c('0x3b')]);var _0x52ce34={'where':_0x4d1fd2[_0x825c('0x36')]};return db[_0x825c('0x3c')][_0x825c('0x3d')](_0x52ce34)[_0x825c('0x20')](function(_0x8ed2b9){_0x2c4957['count']=_0x8ed2b9;if(_0x559358[_0x825c('0x2d')][_0x825c('0x3e')]){_0x4d1fd2[_0x825c('0x3f')]=[{'all':!![]}];}return db[_0x825c('0x3c')][_0x825c('0x40')](_0x4d1fd2);})['then'](function(_0x3d3530){_0x2c4957[_0x825c('0x41')]=_0x3d3530;return _0x2c4957;})['then'](respondWithFilteredResult(_0x126c6f,_0x4d1fd2))[_0x825c('0x42')](handleError(_0x126c6f,null));};exports[_0x825c('0x43')]=function(_0x5586a7,_0x1d5331){var _0x390407={'raw':![],'where':{'id':_0x5586a7[_0x825c('0x44')]['id']}},_0x3985b7={};_0x3985b7[_0x825c('0x2b')]=_[_0x825c('0x2e')](db[_0x825c('0x3c')]['rawAttributes']);_0x3985b7['query']=_[_0x825c('0x2e')](_0x5586a7[_0x825c('0x2d')]);_0x3985b7['filters']=_[_0x825c('0x2f')](_0x3985b7[_0x825c('0x2b')],_0x3985b7[_0x825c('0x2d')]);_0x390407[_0x825c('0x30')]=_[_0x825c('0x2f')](_0x3985b7[_0x825c('0x2b')],qs[_0x825c('0x31')](_0x5586a7[_0x825c('0x2d')][_0x825c('0x31')]));_0x390407[_0x825c('0x30')]=_0x390407[_0x825c('0x30')][_0x825c('0x32')]?_0x390407[_0x825c('0x30')]:_0x3985b7[_0x825c('0x2b')];if(_0x5586a7[_0x825c('0x2d')][_0x825c('0x3e')]){_0x390407[_0x825c('0x3f')]=[{'all':!![]}];}_0x390407=_['merge']({},_0x390407,_0x5586a7[_0x825c('0x3b')]);return db[_0x825c('0x3c')]['find'](_0x390407)['then'](handleEntityNotFound(_0x1d5331,null))[_0x825c('0x20')](respondWithResult(_0x1d5331,null))['catch'](handleError(_0x1d5331,null));};exports[_0x825c('0x45')]=function(_0x398ace,_0x4d97c9){return db[_0x825c('0x3c')][_0x825c('0x45')](_0x398ace[_0x825c('0x46')],{})['then'](respondWithResult(_0x4d97c9,0xc9))[_0x825c('0x42')](handleError(_0x4d97c9,null));};exports[_0x825c('0x1f')]=function(_0x1dc33d,_0x1d6c45){if(_0x1dc33d[_0x825c('0x46')]['id']){delete _0x1dc33d['body']['id'];}return db[_0x825c('0x3c')][_0x825c('0x47')]({'where':{'id':_0x1dc33d[_0x825c('0x44')]['id']}})[_0x825c('0x20')](handleEntityNotFound(_0x1d6c45,null))['then'](saveUpdates(_0x1dc33d['body'],null))[_0x825c('0x20')](respondWithResult(_0x1d6c45,null))[_0x825c('0x42')](handleError(_0x1d6c45,null));};exports['describe']=function(_0x373958,_0x247ab2){return db['VoiceRecording'][_0x825c('0x48')]()[_0x825c('0x20')](respondWithResult(_0x247ab2,null))[_0x825c('0x42')](handleError(_0x247ab2,null));};exports[_0x825c('0x49')]=function(_0x5dd1df,_0x456e7e,_0x2a44dc){var _0x2845c8=require('../../components/encryptor');var _0x21c22e=![];var _0x3bb3ae={};if(_0x5dd1df[_0x825c('0x2d')][_0x825c('0x29')]&&_0x5dd1df[_0x825c('0x2d')][_0x825c('0x29')]===_0x825c('0x4a')){_0x3bb3ae['uniqueid']=_0x5dd1df[_0x825c('0x44')]['id'];}else{_0x3bb3ae['id']=_0x5dd1df[_0x825c('0x44')]['id'];}return db[_0x825c('0x3c')]['find']({'where':_0x3bb3ae,'attributes':['id',_0x825c('0x4b')],'raw':!![]})[_0x825c('0x20')](handleEntityNotFound(_0x456e7e,null))['then'](function(_0x5a3ccc){if(_0x5a3ccc){var _0x37ad3b=_0x5a3ccc[_0x825c('0x4b')];var _0x22a443=util[_0x825c('0x4c')](_0x825c('0x4d'),_0x37ad3b);if(fs[_0x825c('0x4e')](_0x22a443)){_0x21c22e=!![];return _0x2845c8[_0x825c('0x4f')](_0x22a443,_0x37ad3b,config[_0x825c('0x50')][_0x825c('0x51')])[_0x825c('0x20')](function(){return _0x5a3ccc;});}return _0x5a3ccc;}})[_0x825c('0x20')](function(_0x2be0b7){if(_0x2be0b7){var _0x506c28=_0x2be0b7[_0x825c('0x4b')];if(!fs[_0x825c('0x4e')](_0x506c28)){throw new db['Sequelize'][(_0x825c('0x52'))](_0x825c('0x53'));}if(_0x2be0b7[_0x825c('0x54')]){return _0x456e7e[_0x825c('0x49')](_0x506c28,_0x2be0b7[_0x825c('0x54')]+path[_0x825c('0x55')](_0x506c28),function(){if(_0x21c22e){fs[_0x825c('0x56')](_0x506c28);}});}else{return _0x456e7e[_0x825c('0x49')](_0x506c28,function(_0xfd0716){if(_0x21c22e){fs[_0x825c('0x56')](_0x506c28);}});}}})[_0x825c('0x42')](function(_0x112f1c){if(_0x112f1c[_0x825c('0x57')]===_0x825c('0x53')){_0x456e7e[_0x825c('0x18')](0x194)[_0x825c('0x24')]('Not\x20found');}else{return handleError(_0x456e7e,null);}});};exports[_0x825c('0x58')]=function(_0x383567,_0x23c279,_0x323651){var _0x30e83a=require(_0x825c('0x59'));var _0x2c6e76=![];var _0x45c546={'$and':[db[_0x825c('0x5a')][_0x825c('0x36')](db['sequelize']['fn'](_0x825c('0x5b'),db[_0x825c('0x5a')][_0x825c('0x5c')](_0x825c('0x4a'))),_0x383567[_0x825c('0x2d')]['token'])]};if(_0x383567['query'][_0x825c('0x29')]&&_0x383567['query'][_0x825c('0x29')]===_0x825c('0x4a')){_0x45c546[_0x825c('0x5d')][_0x825c('0x5e')]({'uniqueid':_0x383567['params']['id']});}else{_0x45c546[_0x825c('0x5d')]['push']({'id':_0x383567[_0x825c('0x44')]['id']});}return db[_0x825c('0x3c')]['find']({'where':_0x45c546,'attributes':['id',_0x825c('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x23c279,null))['then'](function(_0x3797dc){if(_0x3797dc){var _0x4e5686=util[_0x825c('0x4c')]('%s.cypher',_0x3797dc['value']);if(fs[_0x825c('0x4e')](_0x4e5686)){_0x2c6e76=!![];return _0x30e83a[_0x825c('0x4f')](_0x4e5686,_0x3797dc[_0x825c('0x4b')],config[_0x825c('0x50')][_0x825c('0x51')])[_0x825c('0x20')](function(){return _0x3797dc;});}return _0x3797dc;}})['then'](function(_0x311b65){if(_0x311b65){if(!fs[_0x825c('0x4e')](_0x311b65[_0x825c('0x4b')])){throw new db[(_0x825c('0x5f'))][(_0x825c('0x52'))](_0x825c('0x53'));}if(_0x311b65[_0x825c('0x54')]){return _0x23c279[_0x825c('0x49')](_0x311b65['value'],_0x311b65[_0x825c('0x54')]+path['extname'](_0x311b65[_0x825c('0x4b')]),function(){if(_0x2c6e76){fs['unlink'](_0x311b65['value']);}});}else{return _0x23c279[_0x825c('0x49')](_0x311b65[_0x825c('0x4b')],function(_0x481b82){if(_0x2c6e76){fs[_0x825c('0x56')](_0x311b65[_0x825c('0x4b')]);}});}}})[_0x825c('0x42')](handleError(_0x23c279,null));};exports[_0x825c('0x21')]=function(_0x22f40a,_0x3f3738){return db[_0x825c('0x3c')][_0x825c('0x47')]({'where':{'id':_0x22f40a[_0x825c('0x44')]['id']}})[_0x825c('0x20')](function(_0x96fb4c){if(!_0x96fb4c)throw new ReferenceError(_0x825c('0x60'));return _0x96fb4c;})['then'](function(_0x1b781d){var _0x5a9353=_0x1b781d[_0x825c('0x4b')];logger[_0x825c('0x61')](_0x825c('0x62'),_0x5a9353);if(!_[_0x825c('0x63')](_0x1b781d[_0x825c('0x4b')])&&fs[_0x825c('0x4e')](_0x5a9353)){logger[_0x825c('0x61')](_0x825c('0x64')+_0x5a9353+_0x825c('0x65'));fs['unlinkSync'](_0x5a9353);}_0x5a9353=_0x5a9353+'.cypher';if(!_[_0x825c('0x63')](_0x1b781d[_0x825c('0x4b')])&&fs['existsSync'](_0x5a9353)){logger['info'](_0x825c('0x64')+_0x5a9353+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x825c('0x66')](_0x5a9353);}return _0x1b781d;})[_0x825c('0x20')](function(_0x24614c){if(!_0x24614c)throw new InternalError();return _0x24614c[_0x825c('0x21')]();})[_0x825c('0x20')](function(){_0x3f3738['status'](0xcc)[_0x825c('0x19')]();})[_0x825c('0x42')](handleError(_0x3f3738,null));};function getBucketslist(_0x231632,_0x56c0b4,_0x164523){return new Promise(function(_0x35b6dd,_0x4d08d1){var _0x2fdc35=new AWS['S3']({'accessKeyId':_0x56c0b4,'secretAccessKey':_0x231632,'region':_0x164523});_0x2fdc35[_0x825c('0x67')]({},function(_0x26c9e4,_0x1e4b8f){if(_0x26c9e4){return _0x4d08d1(_0x26c9e4);}else{return _0x35b6dd(_0x1e4b8f);}});});}function createBucket(_0x920478,_0x4362bf,_0x185ff1,_0x4c6d8f){return new Promise(function(_0x40ef1d,_0x5a7c62){var _0x2a9bc1=new AWS['S3']({'accessKeyId':_0x4362bf,'secretAccessKey':_0x920478,'region':_0x185ff1});_0x2a9bc1['createBucket']({'Bucket':_0x4c6d8f},function(_0x21d1b1,_0x328fe6){if(_0x21d1b1){return _0x5a7c62(_0x21d1b1);}else{return _0x40ef1d(_0x328fe6);}});});}function uploadFile(_0x3ad6fd,_0x4a772a,_0x7b55ba,_0x4e71c3,_0x5d09c5,_0x5bacc3){return new Promise(function(_0x2f264c,_0x4da82e){var _0x2afba9=new AWS['S3']({'accessKeyId':_0x4a772a,'secretAccessKey':_0x3ad6fd,'region':_0x7b55ba});_0x2afba9[_0x825c('0x68')]({'Bucket':_0x4e71c3,'Key':_0x5d09c5,'Body':_0x5bacc3},function(_0x5401cf,_0x214ad6){if(_0x5401cf){return _0x4da82e(_0x5401cf);}else{return _0x2f264c(_0x214ad6);}});});}function startTranscribe(_0x4ff299,_0x102201,_0x5a299b,_0x29c8e3,_0x12166f,_0x581d5d){return new Promise(function(_0x247e00,_0x63b11e){var _0x112d70=new AWS[(_0x825c('0x69'))]({'accessKeyId':_0x102201,'secretAccessKey':_0x4ff299,'region':_0x5a299b});_0x112d70[_0x825c('0x6a')]({'TranscriptionJobName':_0x29c8e3,'LanguageCode':_0x12166f,'Media':{'MediaFileUri':_0x581d5d}},function(_0x4b964c,_0x47fc20){if(_0x4b964c){return _0x63b11e(_0x4b964c);}else{return _0x247e00(_0x47fc20);}});});}function transcribe(_0x10c578,_0x121fd4,_0x21f5b9,_0xb0a5ff,_0x11ad7a,_0x546345,_0x1b362e){return new Promise(function(_0x7bb3fc,_0x52758b){var _0x87886f={};logger[_0x825c('0x61')](util['format'](_0x825c('0x6b'),_0x10c578,_0x11ad7a));return uploadFile(_0x121fd4,_0x21f5b9,_0xb0a5ff,_0x11ad7a,path['basename'](_0x546345),fs[_0x825c('0x6c')](_0x546345))[_0x825c('0x20')](function(_0x558ed2){logger[_0x825c('0x61')](util['format'](_0x825c('0x6d'),_0x10c578,_0x11ad7a,_0x558ed2['Location']));_0x87886f[_0x825c('0x6e')]=_0x558ed2[_0x825c('0x6f')];_0x87886f[_0x825c('0x70')]=_0x558ed2[_0x825c('0x71')];logger['info'](util[_0x825c('0x4c')](_0x825c('0x72'),_0x10c578));return startTranscribe(_0x121fd4,_0x21f5b9,_0xb0a5ff,uuidv4(),_0x1b362e,_0x558ed2[_0x825c('0x71')]);})[_0x825c('0x20')](function(_0x3c0c0c){logger[_0x825c('0x61')](util[_0x825c('0x4c')](_0x825c('0x73'),_0x10c578,_0x3c0c0c[_0x825c('0x74')]['TranscriptionJobName']));_0x87886f[_0x825c('0x75')]=_0x3c0c0c[_0x825c('0x74')]['TranscriptionJobName'];_0x87886f[_0x825c('0x76')]=_0x3c0c0c[_0x825c('0x74')][_0x825c('0x77')];return _0x7bb3fc(_0x87886f);})[_0x825c('0x42')](function(_0x4bf214){return _0x52758b(_0x4bf214);});});}exports[_0x825c('0x78')]=function(_0x429a3a,_0x1b0526,_0x4bd485){var _0x3a25d5;var _0x29ae06;var _0x3b5135;var _0x5e2312=require(_0x825c('0x59'));return db['VoiceRecording'][_0x825c('0x79')]({'where':{'id':_0x429a3a[_0x825c('0x44')]['id']}})['then'](function(_0x22bfae){if(_0x22bfae){var _0x1c4401=util[_0x825c('0x4c')](_0x825c('0x4d'),_0x22bfae[_0x825c('0x4b')]);if(fs[_0x825c('0x4e')](_0x1c4401)){cypher=!![];return _0x5e2312[_0x825c('0x4f')](_0x1c4401,_0x22bfae[_0x825c('0x4b')],config[_0x825c('0x50')][_0x825c('0x51')])['then'](function(){return _0x22bfae;});}return _0x22bfae;}})['then'](function(_0x2aebe2){if(!_0x2aebe2){throw new db[(_0x825c('0x5f'))][(_0x825c('0x52'))]('Voice\x20Recording\x20not\x20found');}_0x29ae06=_0x2aebe2;return db[_0x825c('0x7a')][_0x825c('0x79')]({'where':{'id':0x1}});})[_0x825c('0x20')](handleEntityNotFound(_0x1b0526,null))[_0x825c('0x20')](function(_0x26f96b){if(_0x26f96b){_0x3a25d5=_0x26f96b;if(!_0x3a25d5['transcribe']||!_0x3a25d5[_0x825c('0x7b')]||!_0x3a25d5['transcribeRegion']||!_0x3a25d5[_0x825c('0x7c')]||!_0x3a25d5['bucket']){throw new db[(_0x825c('0x5f'))][(_0x825c('0x52'))](_0x825c('0x7d'));}if(_0x429a3a['body'][_0x825c('0x7e')]&&(!_0x3a25d5[_0x825c('0x7f')]||!_0x3a25d5[_0x825c('0x80')]||!_0x3a25d5[_0x825c('0x81')]||!_0x3a25d5[_0x825c('0x7c')]||!_0x3a25d5[_0x825c('0x6e')])){throw new db['Sequelize'][(_0x825c('0x52'))](_0x825c('0x82'));}return db[_0x825c('0x83')]['findOne']({'where':{'id':_0x3a25d5[_0x825c('0x7b')]}});}})[_0x825c('0x20')](function(_0x24a680){if(!_0x24a680){throw new db['Sequelize']['ValidationError'](_0x825c('0x84'));}if(!_0x24a680[_0x825c('0x85')]||!_0x24a680[_0x825c('0x86')]){throw new db[(_0x825c('0x5f'))]['ValidationError'](_0x825c('0x87'));}_0x3b5135=_0x24a680;return getBucketslist(_0x3b5135['data1'],_0x3b5135[_0x825c('0x86')],_0x3a25d5[_0x825c('0x88')]);})['then'](function(_0x2e2bf6){if(_0x2e2bf6&&_0x2e2bf6[_0x825c('0x89')]){var _0x4a4b01=_[_0x825c('0x47')](_0x2e2bf6[_0x825c('0x89')],function(_0x42cdb1){return _0x42cdb1[_0x825c('0x8a')]===_0x3a25d5[_0x825c('0x6e')];});if(!_0x4a4b01){logger[_0x825c('0x61')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x429a3a[_0x825c('0x44')]['id'],_0x3a25d5['bucket']));return createBucket(_0x3b5135[_0x825c('0x85')],_0x3b5135[_0x825c('0x86')],_0x3a25d5[_0x825c('0x88')],_0x3a25d5[_0x825c('0x6e')]);}logger[_0x825c('0x61')](util[_0x825c('0x4c')](_0x825c('0x8b'),_0x429a3a['params']['id'],_0x3a25d5[_0x825c('0x6e')]));return;}})['then'](function(_0xe59757){if(_0x29ae06['transcribeStatus']==='NEW'){return transcribe(_0x429a3a[_0x825c('0x44')]['id'],_0x3b5135['data1'],_0x3b5135[_0x825c('0x86')],_0x3a25d5[_0x825c('0x88')],_0x3a25d5[_0x825c('0x6e')],_0x29ae06[_0x825c('0x4b')],_0x3a25d5['language']);}else{logger[_0x825c('0x61')](util[_0x825c('0x4c')](_0x825c('0x8c'),_0x429a3a[_0x825c('0x44')]['id']));return{'transcribeStatus':_0x825c('0x8d')};}})[_0x825c('0x20')](function(_0x51cfc8){if(_0x51cfc8){_0x51cfc8[_0x825c('0x8e')]=_0x429a3a[_0x825c('0x46')][_0x825c('0x7e')];return _0x29ae06[_0x825c('0x8f')](_0x51cfc8);}})[_0x825c('0x20')](respondWithResult(_0x1b0526,null))['catch'](handleError(_0x1b0526,null));};function writeFile(_0x1274c3,_0x5d65fb){return new Promise(function(_0x14266c,_0xbd31ca){fs[_0x825c('0x90')](_0x5d65fb,_0x1274c3,function(_0x2868df,_0xdebf1e){if(_0x2868df){return _0xbd31ca(_0x2868df);}else{return _0x14266c(_0xdebf1e);}});});}exports[_0x825c('0x91')]=function(_0x1243c2,_0x1304c3,_0x1d19d5){return db[_0x825c('0x3c')]['findOne']({'where':{'id':_0x1243c2[_0x825c('0x44')]['id']}})['then'](handleEntityNotFound(_0x1304c3))['then'](function(_0x57e773){if(_0x57e773&&_0x57e773['fileText']){var _0x2f5d27=_0x57e773[_0x825c('0x92')];var _0x3f3a40=config['root']+_0x825c('0x93')+_0x57e773['id']+_0x825c('0x94');if(fs[_0x825c('0x4e')](_0x3f3a40)){return _0x3f3a40;}return writeFile(_0x2f5d27,_0x3f3a40)['then'](function(){return _0x3f3a40;});}else{throw new db[(_0x825c('0x5f'))][(_0x825c('0x52'))](_0x825c('0x95'));}})[_0x825c('0x20')](function(_0x5956d6){return _0x1304c3[_0x825c('0x49')](_0x5956d6);})[_0x825c('0x42')](handleError(_0x1304c3));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 4ac99b2..82b39e3 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 _0x4869=['../../config/logger','api','moment','define','VoiceRecording','uniqueid','lodash','util'];(function(_0x5a2386,_0x1a1c41){var _0x1457d1=function(_0x40eb50){while(--_0x40eb50){_0x5a2386['push'](_0x5a2386['shift']());}};_0x1457d1(++_0x1a1c41);}(_0x4869,0x126));var _0x9486=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4869[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x9486('0x0'));var util=require(_0x9486('0x1'));var logger=require(_0x9486('0x2'))(_0x9486('0x3'));var moment=require(_0x9486('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('./voiceRecording.attributes');module['exports']=function(_0x15760d,_0x3d4dcc){return _0x15760d[_0x9486('0x5')](_0x9486('0x6'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x9486('0x7'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7bcc=['request-promise','rimraf','define','VoiceRecording','voice_recordings','uniqueid','../../config/logger','moment','bluebird'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7bcc,0x153));var _0xc7bc=function(_0x23a49b,_0x3764d4){_0x23a49b=_0x23a49b-0x0;var _0x135945=_0x7bcc[_0x23a49b];return _0x135945;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc7bc('0x0'))('api');var moment=require(_0xc7bc('0x1'));var BPromise=require(_0xc7bc('0x2'));var rp=require(_0xc7bc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc7bc('0x4'));var config=require('../../config/environment');var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x1558aa,_0x436164){return _0x1558aa[_0xc7bc('0x5')](_0xc7bc('0x6'),attributes,{'tableName':_0xc7bc('0x7'),'paranoid':![],'indexes':[{'name':_0xc7bc('0x8'),'fields':[_0xc7bc('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index e6331d1..f966951 100644 --- a/server/api/voiceRecording/voiceRecording.rpc.js +++ b/server/api/voiceRecording/voiceRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x3896ea,_0x489972){var _0x3527bf=function(_0xa92d01){while(--_0xa92d01){_0x3896ea['push'](_0x3896ea['shift']());}};_0x3527bf(++_0x489972);}(_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 moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x5e4e54,_0x22683c){var _0x20b557=function(_0x59d565){while(--_0x59d565){_0x5e4e54['push'](_0x5e4e54['shift']());}};_0x20b557(++_0x22683c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index f16d0a8..8022542 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 _0x1883=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','show','create','update','delete','exports'];(function(_0x3f4ca2,_0x289432){var _0x379ca7=function(_0x4db4a2){while(--_0x4db4a2){_0x3f4ca2['push'](_0x3f4ca2['shift']());}};_0x379ca7(++_0x289432);}(_0x1883,0xab));var _0x3188=function(_0x55ebb2,_0xff57ea){_0x55ebb2=_0x55ebb2-0x0;var _0x2c53fd=_0x1883[_0x55ebb2];return _0x2c53fd;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var auth=require(_0x3188('0x6'));var interaction=require(_0x3188('0x7'));var config=require(_0x3188('0x8'));var controller=require(_0x3188('0x9'));router[_0x3188('0xa')]('/',auth[_0x3188('0xb')](),controller[_0x3188('0xc')]);router[_0x3188('0xa')](_0x3188('0xd'),auth[_0x3188('0xb')](),controller[_0x3188('0xe')]);router['post']('/',auth[_0x3188('0xb')](),controller[_0x3188('0xf')]);router['put'](_0x3188('0xd'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router[_0x3188('0x11')](_0x3188('0xd'),auth[_0x3188('0xb')](),controller['destroy']);module[_0x3188('0x12')]=router; \ No newline at end of file +var _0x6f47=['put','delete','exports','util','path','express','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/:id','post','create'];(function(_0x2f7420,_0x50cf44){var _0xbba805=function(_0x181220){while(--_0x181220){_0x2f7420['push'](_0x2f7420['shift']());}};_0xbba805(++_0x50cf44);}(_0x6f47,0xc7));var _0x76f4=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x6f47[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var auth=require(_0x76f4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x76f4('0x4'));var controller=require(_0x76f4('0x5'));router[_0x76f4('0x6')]('/',auth[_0x76f4('0x7')](),controller['index']);router[_0x76f4('0x6')](_0x76f4('0x8'),auth[_0x76f4('0x7')](),controller['show']);router[_0x76f4('0x9')]('/',auth[_0x76f4('0x7')](),controller[_0x76f4('0xa')]);router[_0x76f4('0xb')](_0x76f4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x76f4('0xc')](_0x76f4('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x76f4('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index dbf64cb..45d9599 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 _0x006f=['exports','blind','attended','STRING','sequelize','moment'];(function(_0x17d803,_0x1850e6){var _0x5907cf=function(_0x5a3a9a){while(--_0x5a3a9a){_0x17d803['push'](_0x17d803['shift']());}};_0x5907cf(++_0x1850e6);}(_0x006f,0xc4));var _0xf006=function(_0x17b987,_0x400ad2){_0x17b987=_0x17b987-0x0;var _0x4ebe24=_0x006f[_0x17b987];return _0x4ebe24;};'use strict';var Sequelize=require(_0xf006('0x0'));var moment=require(_0xf006('0x1'));module[_0xf006('0x2')]={'type':{'type':Sequelize['ENUM'](_0xf006('0x3'),_0xf006('0x4'))},'result':{'type':Sequelize[_0xf006('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xf006('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xf006('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xf006('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xf006('0x5')]},'transfererexten':{'type':Sequelize[_0xf006('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xf006('0x5')]},'transfereechannel':{'type':Sequelize[_0xf006('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xf006('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xf006('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xf006('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xf006('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xf006('0x5')]},'transfereecontext':{'type':Sequelize[_0xf006('0x5')]},'transfereeexten':{'type':Sequelize[_0xf006('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xf006('0x5')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0xf006('0x5')]},'extension':{'type':Sequelize[_0xf006('0x5')]}}; \ No newline at end of file +var _0x46cb=['Yes','sequelize','moment','exports','ENUM','STRING'];(function(_0x297530,_0x1141c0){var _0x28aa7e=function(_0x839147){while(--_0x839147){_0x297530['push'](_0x297530['shift']());}};_0x28aa7e(++_0x1141c0);}(_0x46cb,0x97));var _0xb46c=function(_0x54e81a,_0x4ba69d){_0x54e81a=_0x54e81a-0x0;var _0x937fe=_0x46cb[_0x54e81a];return _0x937fe;};'use strict';var Sequelize=require(_0xb46c('0x0'));var moment=require(_0xb46c('0x1'));module[_0xb46c('0x2')]={'type':{'type':Sequelize[_0xb46c('0x3')]('blind','attended')},'result':{'type':Sequelize[_0xb46c('0x4')]},'transfererchannel':{'type':Sequelize[_0xb46c('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xb46c('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb46c('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xb46c('0x4')]},'transferercontext':{'type':Sequelize[_0xb46c('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xb46c('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xb46c('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xb46c('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xb46c('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xb46c('0x4')]},'transfereecontext':{'type':Sequelize[_0xb46c('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xb46c('0x4')]},'isexternal':{'type':Sequelize[_0xb46c('0x3')](_0xb46c('0x5'),'No')},'context':{'type':Sequelize[_0xb46c('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 957cfea..93f95a8 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 _0x776d=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','VIRTUAL','options','VoiceTransferReport','includeAll','include','rows','catch','show','params','merge','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','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','../../mysqldb','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','map'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x776d,0x1e7));var _0xd776=function(_0x45f3ad,_0x5bed7f){_0x45f3ad=_0x45f3ad-0x0;var _0x143683=_0x776d[_0x45f3ad];return _0x143683;};'use strict';var pdf=require(_0xd776('0x0'));var emlformat=require(_0xd776('0x1'));var rimraf=require(_0xd776('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd776('0x3'));var rp=require(_0xd776('0x4'));var moment=require(_0xd776('0x5'));var BPromise=require(_0xd776('0x6'));var Mustache=require(_0xd776('0x7'));var util=require(_0xd776('0x8'));var path=require(_0xd776('0x9'));var sox=require(_0xd776('0xa'));var csv=require('to-csv');var ejs=require(_0xd776('0xb'));var fs=require('fs');var _=require(_0xd776('0xc'));var squel=require(_0xd776('0xd'));var crypto=require(_0xd776('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd776('0xf'));var toCsv=require(_0xd776('0x10'));var querystring=require(_0xd776('0x11'));var Papa=require(_0xd776('0x12'));var Redis=require(_0xd776('0x13'));var authService=require(_0xd776('0x14'));var qs=require(_0xd776('0x15'));var as=require(_0xd776('0x16'));var hardwareService=require(_0xd776('0x17'));var logger=require(_0xd776('0x18'))(_0xd776('0x19'));var utils=require(_0xd776('0x1a'));var config=require(_0xd776('0x1b'));var db=require(_0xd776('0x1c'))['db'];function respondWithStatusCode(_0x3d7bda,_0x1697f6){_0x1697f6=_0x1697f6||0xcc;return function(_0x65710d){if(_0x65710d){return _0x3d7bda['sendStatus'](_0x1697f6);}return _0x3d7bda[_0xd776('0x1d')](_0x1697f6)['end']();};}function respondWithResult(_0x4f5f62,_0x3a335e){_0x3a335e=_0x3a335e||0xc8;return function(_0x32ef95){if(_0x32ef95){return _0x4f5f62[_0xd776('0x1d')](_0x3a335e)[_0xd776('0x1e')](_0x32ef95);}};}function respondWithFilteredResult(_0x3f207d,_0xe69781){return function(_0x5091b2){if(_0x5091b2){var _0xbdab75=_0x5091b2[_0xd776('0x1f')],_0x48fe2b=_0xe69781[_0xd776('0x20')],_0x560b17=_0xe69781[_0xd776('0x20')]+_0xe69781['limit'],_0x168251;if(_0x560b17>=_0xbdab75){_0x560b17=_0xbdab75;_0x168251=0xc8;}else{_0x168251=0xce;}_0x3f207d[_0xd776('0x1d')](_0x168251);return _0x3f207d[_0xd776('0x21')](_0xd776('0x22'),_0x48fe2b+'-'+_0x560b17+'/'+_0xbdab75)[_0xd776('0x1e')](_0x5091b2);}return null;};}function patchUpdates(_0x289626){return function(_0x4f4d17){try{jsonpatch[_0xd776('0x23')](_0x4f4d17,_0x289626,!![]);}catch(_0x2aa166){return BPromise[_0xd776('0x24')](_0x2aa166);}return _0x4f4d17[_0xd776('0x25')]();};}function saveUpdates(_0x54140c,_0x299a84){return function(_0x1d4310){if(_0x1d4310){return _0x1d4310[_0xd776('0x26')](_0x54140c)['then'](function(_0x3568c2){return _0x3568c2;});}return null;};}function removeEntity(_0x26223d,_0x6a47a6){return function(_0x21f421){if(_0x21f421){return _0x21f421['destroy']()[_0xd776('0x27')](function(){_0x26223d[_0xd776('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x151587,_0x40726e){return function(_0x2a0803){if(!_0x2a0803){_0x151587[_0xd776('0x28')](0x194);}return _0x2a0803;};}function handleError(_0x17282e,_0x36ee9f){_0x36ee9f=_0x36ee9f||0x1f4;return function(_0x29fca1){logger[_0xd776('0x29')](_0x29fca1[_0xd776('0x2a')]);if(_0x29fca1[_0xd776('0x2b')]){delete _0x29fca1['name'];}_0x17282e[_0xd776('0x1d')](_0x36ee9f)['send'](_0x29fca1);};}exports['index']=function(_0xc5e884,_0x22371a){var _0x3eb21c={},_0x509f78={},_0xbdee74={'count':0x0,'rows':[]};var _0x4181be=_[_0xd776('0x2c')](db['VoiceTransferReport'][_0xd776('0x2d')],function(_0x15ae1a){return{'name':_0x15ae1a[_0xd776('0x2e')],'type':_0x15ae1a[_0xd776('0x2f')][_0xd776('0x30')]};});_0x509f78[_0xd776('0x31')]=_[_0xd776('0x2c')](_0x4181be,'name');_0x509f78[_0xd776('0x32')]=_['keys'](_0xc5e884[_0xd776('0x32')]);_0x509f78[_0xd776('0x33')]=_[_0xd776('0x34')](_0x509f78[_0xd776('0x31')],_0x509f78[_0xd776('0x32')]);_0x3eb21c[_0xd776('0x35')]=_[_0xd776('0x34')](_0x509f78[_0xd776('0x31')],qs[_0xd776('0x36')](_0xc5e884[_0xd776('0x32')][_0xd776('0x36')]));_0x3eb21c[_0xd776('0x35')]=_0x3eb21c[_0xd776('0x35')][_0xd776('0x37')]?_0x3eb21c['attributes']:_0x509f78[_0xd776('0x31')];if(!_0xc5e884[_0xd776('0x32')][_0xd776('0x38')]('nolimit')){_0x3eb21c[_0xd776('0x39')]=qs[_0xd776('0x39')](_0xc5e884['query'][_0xd776('0x39')]);_0x3eb21c[_0xd776('0x20')]=qs['offset'](_0xc5e884[_0xd776('0x32')][_0xd776('0x20')]);}_0x3eb21c[_0xd776('0x3a')]=qs[_0xd776('0x3b')](_0xc5e884[_0xd776('0x32')]['sort']);_0x3eb21c['where']=qs[_0xd776('0x33')](_[_0xd776('0x3c')](_0xc5e884['query'],_0x509f78[_0xd776('0x33')]),_0x4181be);if(_0xc5e884[_0xd776('0x32')][_0xd776('0x3d')]){_0x3eb21c['where']=_['merge'](_0x3eb21c[_0xd776('0x3e')],{'$or':_[_0xd776('0x2c')](_0x4181be,function(_0x3e2f02){if(_0x3e2f02[_0xd776('0x2f')]!==_0xd776('0x3f')){var _0xe30ee0={};_0xe30ee0[_0x3e2f02[_0xd776('0x2b')]]={'$like':'%'+_0xc5e884[_0xd776('0x32')][_0xd776('0x3d')]+'%'};return _0xe30ee0;}})});}_0x3eb21c=_['merge']({},_0x3eb21c,_0xc5e884[_0xd776('0x40')]);var _0x2cdbee={'where':_0x3eb21c[_0xd776('0x3e')]};return db[_0xd776('0x41')][_0xd776('0x1f')](_0x2cdbee)[_0xd776('0x27')](function(_0x96e8a9){_0xbdee74['count']=_0x96e8a9;if(_0xc5e884[_0xd776('0x32')][_0xd776('0x42')]){_0x3eb21c[_0xd776('0x43')]=[{'all':!![]}];}return db[_0xd776('0x41')]['findAll'](_0x3eb21c);})[_0xd776('0x27')](function(_0x38b01b){_0xbdee74[_0xd776('0x44')]=_0x38b01b;return _0xbdee74;})[_0xd776('0x27')](respondWithFilteredResult(_0x22371a,_0x3eb21c))[_0xd776('0x45')](handleError(_0x22371a,null));};exports[_0xd776('0x46')]=function(_0x490bef,_0x239352){var _0x7a4718={'raw':!![],'where':{'id':_0x490bef[_0xd776('0x47')]['id']}},_0x2d6e33={};_0x2d6e33['model']=_['keys'](db[_0xd776('0x41')]['rawAttributes']);_0x2d6e33[_0xd776('0x32')]=_['keys'](_0x490bef['query']);_0x2d6e33[_0xd776('0x33')]=_[_0xd776('0x34')](_0x2d6e33[_0xd776('0x31')],_0x2d6e33[_0xd776('0x32')]);_0x7a4718[_0xd776('0x35')]=_[_0xd776('0x34')](_0x2d6e33[_0xd776('0x31')],qs[_0xd776('0x36')](_0x490bef['query'][_0xd776('0x36')]));_0x7a4718[_0xd776('0x35')]=_0x7a4718[_0xd776('0x35')][_0xd776('0x37')]?_0x7a4718[_0xd776('0x35')]:_0x2d6e33[_0xd776('0x31')];if(_0x490bef[_0xd776('0x32')][_0xd776('0x42')]){_0x7a4718[_0xd776('0x43')]=[{'all':!![]}];}_0x7a4718=_[_0xd776('0x48')]({},_0x7a4718,_0x490bef['options']);return db['VoiceTransferReport'][_0xd776('0x49')](_0x7a4718)['then'](handleEntityNotFound(_0x239352,null))['then'](respondWithResult(_0x239352,null))[_0xd776('0x45')](handleError(_0x239352,null));};exports[_0xd776('0x4a')]=function(_0x300013,_0x41aff9){return db[_0xd776('0x41')][_0xd776('0x4a')](_0x300013['body'],{})[_0xd776('0x27')](respondWithResult(_0x41aff9,0xc9))[_0xd776('0x45')](handleError(_0x41aff9,null));};exports[_0xd776('0x26')]=function(_0x564318,_0x407f5b){if(_0x564318[_0xd776('0x4b')]['id']){delete _0x564318[_0xd776('0x4b')]['id'];}return db[_0xd776('0x41')][_0xd776('0x49')]({'where':{'id':_0x564318[_0xd776('0x47')]['id']}})[_0xd776('0x27')](handleEntityNotFound(_0x407f5b,null))['then'](saveUpdates(_0x564318[_0xd776('0x4b')],null))['then'](respondWithResult(_0x407f5b,null))[_0xd776('0x45')](handleError(_0x407f5b,null));};exports['destroy']=function(_0x48302a,_0x3aded7){return db[_0xd776('0x41')]['find']({'where':{'id':_0x48302a[_0xd776('0x47')]['id']}})[_0xd776('0x27')](handleEntityNotFound(_0x3aded7,null))['then'](removeEntity(_0x3aded7,null))['catch'](handleError(_0x3aded7,null));}; \ No newline at end of file +var _0x8b87=['sort','where','pick','merge','filter','includeAll','findAll','catch','params','rawAttributes','length','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','keys','query','filters','attributes','fields','hasOwnProperty'];(function(_0x35f15b,_0x387db3){var _0x262619=function(_0x4467b9){while(--_0x4467b9){_0x35f15b['push'](_0x35f15b['shift']());}};_0x262619(++_0x387db3);}(_0x8b87,0x9b));var _0x78b8=function(_0x41330c,_0x4ec801){_0x41330c=_0x41330c-0x0;var _0x2275f4=_0x8b87[_0x41330c];return _0x2275f4;};'use strict';var pdf=require(_0x78b8('0x0'));var emlformat=require(_0x78b8('0x1'));var rimraf=require(_0x78b8('0x2'));var zipdir=require(_0x78b8('0x3'));var jsonpatch=require(_0x78b8('0x4'));var rp=require(_0x78b8('0x5'));var moment=require(_0x78b8('0x6'));var BPromise=require(_0x78b8('0x7'));var Mustache=require(_0x78b8('0x8'));var util=require(_0x78b8('0x9'));var path=require(_0x78b8('0xa'));var sox=require('sox');var csv=require(_0x78b8('0xb'));var ejs=require(_0x78b8('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x78b8('0xd'));var crypto=require(_0x78b8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x78b8('0xf'));var toCsv=require(_0x78b8('0xb'));var querystring=require(_0x78b8('0x10'));var Papa=require('papaparse');var Redis=require(_0x78b8('0x11'));var authService=require(_0x78b8('0x12'));var qs=require(_0x78b8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x78b8('0x14'));var logger=require('../../config/logger')(_0x78b8('0x15'));var utils=require('../../config/utils');var config=require(_0x78b8('0x16'));var db=require(_0x78b8('0x17'))['db'];function respondWithStatusCode(_0x16cef1,_0x335613){_0x335613=_0x335613||0xcc;return function(_0xa4f1b4){if(_0xa4f1b4){return _0x16cef1['sendStatus'](_0x335613);}return _0x16cef1[_0x78b8('0x18')](_0x335613)['end']();};}function respondWithResult(_0x34699a,_0x33f87c){_0x33f87c=_0x33f87c||0xc8;return function(_0x599857){if(_0x599857){return _0x34699a[_0x78b8('0x18')](_0x33f87c)[_0x78b8('0x19')](_0x599857);}};}function respondWithFilteredResult(_0x4c86ca,_0x5a80df){return function(_0x342e0b){if(_0x342e0b){var _0x452a13=_0x342e0b[_0x78b8('0x1a')],_0x1885fe=_0x5a80df[_0x78b8('0x1b')],_0x2f39d2=_0x5a80df['offset']+_0x5a80df[_0x78b8('0x1c')],_0x436577;if(_0x2f39d2>=_0x452a13){_0x2f39d2=_0x452a13;_0x436577=0xc8;}else{_0x436577=0xce;}_0x4c86ca[_0x78b8('0x18')](_0x436577);return _0x4c86ca[_0x78b8('0x1d')](_0x78b8('0x1e'),_0x1885fe+'-'+_0x2f39d2+'/'+_0x452a13)[_0x78b8('0x19')](_0x342e0b);}return null;};}function patchUpdates(_0x263681){return function(_0x347db3){try{jsonpatch[_0x78b8('0x1f')](_0x347db3,_0x263681,!![]);}catch(_0x4a8c13){return BPromise['reject'](_0x4a8c13);}return _0x347db3[_0x78b8('0x20')]();};}function saveUpdates(_0x5d8a34,_0x48966e){return function(_0x474a0e){if(_0x474a0e){return _0x474a0e[_0x78b8('0x21')](_0x5d8a34)[_0x78b8('0x22')](function(_0x3115db){return _0x3115db;});}return null;};}function removeEntity(_0x4a944e,_0x5ab462){return function(_0x378dbf){if(_0x378dbf){return _0x378dbf[_0x78b8('0x23')]()['then'](function(){_0x4a944e['status'](0xcc)[_0x78b8('0x24')]();});}};}function handleEntityNotFound(_0x12d30b,_0x425331){return function(_0x100810){if(!_0x100810){_0x12d30b[_0x78b8('0x25')](0x194);}return _0x100810;};}function handleError(_0x2a1f32,_0x1b3931){_0x1b3931=_0x1b3931||0x1f4;return function(_0x10402d){logger[_0x78b8('0x26')](_0x10402d[_0x78b8('0x27')]);if(_0x10402d[_0x78b8('0x28')]){delete _0x10402d['name'];}_0x2a1f32[_0x78b8('0x18')](_0x1b3931)[_0x78b8('0x29')](_0x10402d);};}exports[_0x78b8('0x2a')]=function(_0x1f6817,_0x238ac4){var _0x2feacf={},_0x3d0ccd={},_0xb12563={'count':0x0,'rows':[]};var _0x148cff=_[_0x78b8('0x2b')](db[_0x78b8('0x2c')]['rawAttributes'],function(_0x453fac){return{'name':_0x453fac[_0x78b8('0x2d')],'type':_0x453fac[_0x78b8('0x2e')][_0x78b8('0x2f')]};});_0x3d0ccd[_0x78b8('0x30')]=_[_0x78b8('0x2b')](_0x148cff,'name');_0x3d0ccd['query']=_[_0x78b8('0x31')](_0x1f6817[_0x78b8('0x32')]);_0x3d0ccd[_0x78b8('0x33')]=_['intersection'](_0x3d0ccd[_0x78b8('0x30')],_0x3d0ccd[_0x78b8('0x32')]);_0x2feacf[_0x78b8('0x34')]=_['intersection'](_0x3d0ccd[_0x78b8('0x30')],qs[_0x78b8('0x35')](_0x1f6817[_0x78b8('0x32')][_0x78b8('0x35')]));_0x2feacf[_0x78b8('0x34')]=_0x2feacf[_0x78b8('0x34')]['length']?_0x2feacf[_0x78b8('0x34')]:_0x3d0ccd[_0x78b8('0x30')];if(!_0x1f6817[_0x78b8('0x32')][_0x78b8('0x36')]('nolimit')){_0x2feacf[_0x78b8('0x1c')]=qs[_0x78b8('0x1c')](_0x1f6817[_0x78b8('0x32')][_0x78b8('0x1c')]);_0x2feacf[_0x78b8('0x1b')]=qs['offset'](_0x1f6817[_0x78b8('0x32')][_0x78b8('0x1b')]);}_0x2feacf['order']=qs[_0x78b8('0x37')](_0x1f6817[_0x78b8('0x32')][_0x78b8('0x37')]);_0x2feacf[_0x78b8('0x38')]=qs[_0x78b8('0x33')](_[_0x78b8('0x39')](_0x1f6817[_0x78b8('0x32')],_0x3d0ccd[_0x78b8('0x33')]),_0x148cff);if(_0x1f6817[_0x78b8('0x32')]['filter']){_0x2feacf[_0x78b8('0x38')]=_[_0x78b8('0x3a')](_0x2feacf[_0x78b8('0x38')],{'$or':_[_0x78b8('0x2b')](_0x148cff,function(_0x13058d){if(_0x13058d[_0x78b8('0x2e')]!=='VIRTUAL'){var _0x3a05a7={};_0x3a05a7[_0x13058d['name']]={'$like':'%'+_0x1f6817[_0x78b8('0x32')][_0x78b8('0x3b')]+'%'};return _0x3a05a7;}})});}_0x2feacf=_['merge']({},_0x2feacf,_0x1f6817['options']);var _0x30d987={'where':_0x2feacf[_0x78b8('0x38')]};return db[_0x78b8('0x2c')][_0x78b8('0x1a')](_0x30d987)[_0x78b8('0x22')](function(_0x587564){_0xb12563[_0x78b8('0x1a')]=_0x587564;if(_0x1f6817[_0x78b8('0x32')][_0x78b8('0x3c')]){_0x2feacf['include']=[{'all':!![]}];}return db[_0x78b8('0x2c')][_0x78b8('0x3d')](_0x2feacf);})[_0x78b8('0x22')](function(_0x5a9119){_0xb12563['rows']=_0x5a9119;return _0xb12563;})[_0x78b8('0x22')](respondWithFilteredResult(_0x238ac4,_0x2feacf))[_0x78b8('0x3e')](handleError(_0x238ac4,null));};exports['show']=function(_0x1ca507,_0x1fa398){var _0x4b5152={'raw':!![],'where':{'id':_0x1ca507[_0x78b8('0x3f')]['id']}},_0x552ecf={};_0x552ecf[_0x78b8('0x30')]=_[_0x78b8('0x31')](db['VoiceTransferReport'][_0x78b8('0x40')]);_0x552ecf['query']=_['keys'](_0x1ca507[_0x78b8('0x32')]);_0x552ecf[_0x78b8('0x33')]=_['intersection'](_0x552ecf[_0x78b8('0x30')],_0x552ecf[_0x78b8('0x32')]);_0x4b5152[_0x78b8('0x34')]=_['intersection'](_0x552ecf[_0x78b8('0x30')],qs[_0x78b8('0x35')](_0x1ca507[_0x78b8('0x32')]['fields']));_0x4b5152['attributes']=_0x4b5152[_0x78b8('0x34')][_0x78b8('0x41')]?_0x4b5152['attributes']:_0x552ecf['model'];if(_0x1ca507[_0x78b8('0x32')][_0x78b8('0x3c')]){_0x4b5152[_0x78b8('0x42')]=[{'all':!![]}];}_0x4b5152=_[_0x78b8('0x3a')]({},_0x4b5152,_0x1ca507['options']);return db[_0x78b8('0x2c')][_0x78b8('0x43')](_0x4b5152)[_0x78b8('0x22')](handleEntityNotFound(_0x1fa398,null))[_0x78b8('0x22')](respondWithResult(_0x1fa398,null))['catch'](handleError(_0x1fa398,null));};exports[_0x78b8('0x44')]=function(_0x55a91f,_0xca803b){return db[_0x78b8('0x2c')][_0x78b8('0x44')](_0x55a91f[_0x78b8('0x45')],{})[_0x78b8('0x22')](respondWithResult(_0xca803b,0xc9))[_0x78b8('0x3e')](handleError(_0xca803b,null));};exports[_0x78b8('0x21')]=function(_0x3fb5f8,_0x59fe9a){if(_0x3fb5f8[_0x78b8('0x45')]['id']){delete _0x3fb5f8['body']['id'];}return db[_0x78b8('0x2c')][_0x78b8('0x43')]({'where':{'id':_0x3fb5f8['params']['id']}})[_0x78b8('0x22')](handleEntityNotFound(_0x59fe9a,null))[_0x78b8('0x22')](saveUpdates(_0x3fb5f8['body'],null))[_0x78b8('0x22')](respondWithResult(_0x59fe9a,null))[_0x78b8('0x3e')](handleError(_0x59fe9a,null));};exports[_0x78b8('0x23')]=function(_0x428db4,_0x23f684){return db[_0x78b8('0x2c')][_0x78b8('0x43')]({'where':{'id':_0x428db4['params']['id']}})['then'](handleEntityNotFound(_0x23f684,null))[_0x78b8('0x22')](removeEntity(_0x23f684,null))[_0x78b8('0x3e')](handleError(_0x23f684,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index c131437..12af82d 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 _0xf264=['exports','define','VoiceTransferReport','lodash','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x4f3fb0,_0x2cda32){var _0x2773a6=function(_0x5610fe){while(--_0x5610fe){_0x4f3fb0['push'](_0x4f3fb0['shift']());}};_0x2773a6(++_0x2cda32);}(_0xf264,0xfd));var _0x4f26=function(_0xb72cc8,_0x3b7aa3){_0xb72cc8=_0xb72cc8-0x0;var _0x75cfb3=_0xf264[_0xb72cc8];return _0x75cfb3;};'use strict';var _=require(_0x4f26('0x0'));var util=require(_0x4f26('0x1'));var logger=require(_0x4f26('0x2'))(_0x4f26('0x3'));var moment=require('moment');var BPromise=require(_0x4f26('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f26('0x5'));var rimraf=require('rimraf');var config=require(_0x4f26('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0x4f26('0x7')]=function(_0x21c53e,_0x417694){return _0x21c53e[_0x4f26('0x8')](_0x4f26('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x658b=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceTransferReport','report_call_transfer','lodash'];(function(_0xb0f5ee,_0xff94c3){var _0x1e819c=function(_0x1ec2ca){while(--_0x1ec2ca){_0xb0f5ee['push'](_0xb0f5ee['shift']());}};_0x1e819c(++_0xff94c3);}(_0x658b,0x11f));var _0xb658=function(_0x496649,_0xeef0fc){_0x496649=_0x496649-0x0;var _0x224b19=_0x658b[_0x496649];return _0x224b19;};'use strict';var _=require(_0xb658('0x0'));var util=require(_0xb658('0x1'));var logger=require(_0xb658('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb658('0x3'));var rp=require(_0xb658('0x4'));var fs=require('fs');var path=require(_0xb658('0x5'));var rimraf=require(_0xb658('0x6'));var config=require(_0xb658('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0xb658('0x8')]=function(_0x4adf38,_0x15b2e4){return _0x4adf38[_0xb658('0x9')](_0xb658('0xa'),attributes,{'tableName':_0xb658('0xb'),'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 b2d586b..e2f54c2 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 _0x1606=['CreateVoiceTransferReport','body','options','raw','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x1606,0x12e));var _0x6160=function(_0x5518ae,_0x570a67){_0x5518ae=_0x5518ae-0x0;var _0x269b81=_0x1606[_0x5518ae];return _0x269b81;};'use strict';var _=require(_0x6160('0x0'));var util=require('util');var moment=require(_0x6160('0x1'));var BPromise=require(_0x6160('0x2'));var rs=require(_0x6160('0x3'));var fs=require('fs');var Redis=require(_0x6160('0x4'));var db=require(_0x6160('0x5'))['db'];var utils=require(_0x6160('0x6'));var logger=require(_0x6160('0x7'))('rpc');var config=require(_0x6160('0x8'));var jayson=require(_0x6160('0x9'));var client=jayson[_0x6160('0xa')][_0x6160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe64d57,_0x369f95,_0x3ac70a){return new BPromise(function(_0x111c95,_0x12b4c2){return client[_0x6160('0xc')](_0xe64d57,_0x3ac70a)['then'](function(_0x37d520){logger[_0x6160('0xd')](_0x6160('0xe'),_0x369f95,'request\x20sent');logger[_0x6160('0xf')](_0x6160('0x10'),_0x369f95,_0x6160('0x11'),JSON[_0x6160('0x12')](_0x37d520));if(_0x37d520['error']){if(_0x37d520[_0x6160('0x13')]['code']===0x1f4){logger[_0x6160('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x369f95,_0x37d520[_0x6160('0x13')][_0x6160('0x14')]);return _0x12b4c2(_0x37d520[_0x6160('0x13')][_0x6160('0x14')]);}logger[_0x6160('0x13')](_0x6160('0xe'),_0x369f95,_0x37d520[_0x6160('0x13')]['message']);return _0x111c95(_0x37d520[_0x6160('0x13')]['message']);}else{logger[_0x6160('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x369f95,_0x6160('0x11'));_0x111c95(_0x37d520['result'][_0x6160('0x14')]);}})[_0x6160('0x15')](function(_0x518967){logger[_0x6160('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x369f95,_0x518967);_0x12b4c2(_0x518967);});});}exports[_0x6160('0x16')]=function(_0x18d0b6){var _0x5d7823=this;return new Promise(function(_0x52d456,_0x3f5913){return db['VoiceTransferReport']['create'](_0x18d0b6[_0x6160('0x17')],{'raw':_0x18d0b6[_0x6160('0x18')]?_0x18d0b6[_0x6160('0x18')][_0x6160('0x19')]===undefined?!![]:![]:!![]})[_0x6160('0x1a')](function(_0x100280){logger[_0x6160('0xd')](_0x6160('0x16'),_0x18d0b6);logger['debug'](_0x6160('0x16'),_0x18d0b6,JSON[_0x6160('0x12')](_0x100280));_0x52d456(_0x100280);})[_0x6160('0x15')](function(_0x35041a){logger[_0x6160('0x13')](_0x6160('0x16'),_0x35041a['message'],_0x18d0b6);_0x3f5913(_0x5d7823[_0x6160('0x13')](0x1f4,_0x35041a[_0x6160('0x14')]));});});}; \ No newline at end of file +var _0x3b9e=['create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceTransferReport','VoiceTransferReport'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3b9e,0x90));var _0xe3b9=function(_0x287435,_0x524e54){_0x287435=_0x287435-0x0;var _0x2861e9=_0x3b9e[_0x287435];return _0x2861e9;};'use strict';var _=require('lodash');var util=require(_0xe3b9('0x0'));var moment=require(_0xe3b9('0x1'));var BPromise=require(_0xe3b9('0x2'));var rs=require(_0xe3b9('0x3'));var fs=require('fs');var Redis=require(_0xe3b9('0x4'));var db=require(_0xe3b9('0x5'))['db'];var utils=require(_0xe3b9('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe3b9('0x7'));var client=jayson[_0xe3b9('0x8')][_0xe3b9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x465929,_0x541478,_0x20f4c7){return new BPromise(function(_0x2668e2,_0x17ee23){return client[_0xe3b9('0xa')](_0x465929,_0x20f4c7)[_0xe3b9('0xb')](function(_0x2ed462){logger[_0xe3b9('0xc')](_0xe3b9('0xd'),_0x541478,_0xe3b9('0xe'));logger[_0xe3b9('0xf')](_0xe3b9('0x10'),_0x541478,_0xe3b9('0xe'),JSON[_0xe3b9('0x11')](_0x2ed462));if(_0x2ed462['error']){if(_0x2ed462[_0xe3b9('0x12')][_0xe3b9('0x13')]===0x1f4){logger[_0xe3b9('0x12')](_0xe3b9('0xd'),_0x541478,_0x2ed462[_0xe3b9('0x12')]['message']);return _0x17ee23(_0x2ed462[_0xe3b9('0x12')]['message']);}logger[_0xe3b9('0x12')](_0xe3b9('0xd'),_0x541478,_0x2ed462[_0xe3b9('0x12')][_0xe3b9('0x14')]);return _0x2668e2(_0x2ed462[_0xe3b9('0x12')][_0xe3b9('0x14')]);}else{logger[_0xe3b9('0xc')](_0xe3b9('0xd'),_0x541478,_0xe3b9('0xe'));_0x2668e2(_0x2ed462['result'][_0xe3b9('0x14')]);}})[_0xe3b9('0x15')](function(_0x19df19){logger[_0xe3b9('0x12')](_0xe3b9('0xd'),_0x541478,_0x19df19);_0x17ee23(_0x19df19);});});}exports[_0xe3b9('0x16')]=function(_0x126fc5){var _0x7bdeed=this;return new Promise(function(_0x2c2810,_0x1f2f99){return db[_0xe3b9('0x17')][_0xe3b9('0x18')](_0x126fc5[_0xe3b9('0x19')],{'raw':_0x126fc5[_0xe3b9('0x1a')]?_0x126fc5[_0xe3b9('0x1a')][_0xe3b9('0x1b')]===undefined?!![]:![]:!![]})[_0xe3b9('0xb')](function(_0x408ed6){logger[_0xe3b9('0xc')](_0xe3b9('0x16'),_0x126fc5);logger[_0xe3b9('0xf')](_0xe3b9('0x16'),_0x126fc5,JSON[_0xe3b9('0x11')](_0x408ed6));_0x2c2810(_0x408ed6);})[_0xe3b9('0x15')](function(_0x59c054){logger['error'](_0xe3b9('0x16'),_0x59c054[_0xe3b9('0x14')],_0x126fc5);_0x1f2f99(_0x7bdeed[_0xe3b9('0x12')](0x1f4,_0x59c054['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 50366d9..d31cd73 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 _0x86fd=['/unhold','/calls','calls','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','canUpdate','originate','/hangup','isAuthenticated','post','answer','/hold','hold'];(function(_0x4ad655,_0x26a787){var _0xea8eca=function(_0x1e8e5d){while(--_0x1e8e5d){_0x4ad655['push'](_0x4ad655['shift']());}};_0xea8eca(++_0x26a787);}(_0x86fd,0xa7));var _0xd86f=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x86fd[_0x4e6ae6];return _0x23c108;};'use strict';var express=require(_0xd86f('0x0'));var router=express[_0xd86f('0x1')]();var auth=require(_0xd86f('0x2'));var controller=require(_0xd86f('0x3'));router['post'](_0xd86f('0x4'),auth['isAuthenticated'](),auth[_0xd86f('0x5')](),controller[_0xd86f('0x6')]);router['post'](_0xd86f('0x7'),auth[_0xd86f('0x8')](),auth['canUpdate'](),controller['hangup']);router[_0xd86f('0x9')]('/answer',auth[_0xd86f('0x8')](),auth['canUpdate'](),controller[_0xd86f('0xa')]);router[_0xd86f('0x9')](_0xd86f('0xb'),auth[_0xd86f('0x8')](),auth['canUpdate'](),controller[_0xd86f('0xc')]);router[_0xd86f('0x9')](_0xd86f('0xd'),auth['isAuthenticated'](),auth['canUpdate'](),controller['unhold']);router['post'](_0xd86f('0xe'),auth[_0xd86f('0x8')](),auth[_0xd86f('0x5')](),controller[_0xd86f('0xf')]);router['post']('/transfer',auth[_0xd86f('0x8')](),auth[_0xd86f('0x5')](),controller[_0xd86f('0x10')]);module[_0xd86f('0x11')]=router; \ No newline at end of file +var _0x8c38=['unhold','/calls','/transfer','transfer','exports','express','Router','./webbar.controller','post','/originate','isAuthenticated','originate','/hangup','canUpdate','hangup','/answer','hold','/unhold'];(function(_0x36812e,_0x1f4763){var _0x5e818d=function(_0x23462c){while(--_0x23462c){_0x36812e['push'](_0x36812e['shift']());}};_0x5e818d(++_0x1f4763);}(_0x8c38,0x83));var _0x88c3=function(_0x535c0d,_0x158dc5){_0x535c0d=_0x535c0d-0x0;var _0x286be5=_0x8c38[_0x535c0d];return _0x286be5;};'use strict';var express=require(_0x88c3('0x0'));var router=express[_0x88c3('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x88c3('0x2'));router[_0x88c3('0x3')](_0x88c3('0x4'),auth[_0x88c3('0x5')](),auth['canUpdate'](),controller[_0x88c3('0x6')]);router[_0x88c3('0x3')](_0x88c3('0x7'),auth[_0x88c3('0x5')](),auth[_0x88c3('0x8')](),controller[_0x88c3('0x9')]);router[_0x88c3('0x3')](_0x88c3('0xa'),auth['isAuthenticated'](),auth[_0x88c3('0x8')](),controller['answer']);router[_0x88c3('0x3')]('/hold',auth[_0x88c3('0x5')](),auth['canUpdate'](),controller[_0x88c3('0xb')]);router[_0x88c3('0x3')](_0x88c3('0xc'),auth[_0x88c3('0x5')](),auth['canUpdate'](),controller[_0x88c3('0xd')]);router[_0x88c3('0x3')](_0x88c3('0xe'),auth['isAuthenticated'](),auth[_0x88c3('0x8')](),controller['calls']);router['post'](_0x88c3('0xf'),auth[_0x88c3('0x5')](),auth[_0x88c3('0x8')](),controller[_0x88c3('0x10')]);module[_0x88c3('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 6a872ac..b7891cc 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 _0x397c=['emit','log','handleError:','error','stack','name','status','NotFound','code','message','result','catch','then','VoiceChannels','all','rows','UserId','length','sessionId\x20','originate\x20fired:','body','userId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','sessionId','entityFound:','webbar:hangup','json','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','filter','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','info'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x397c,0xc1));var _0xc397=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x397c[_0x474bc0];return _0x4b24cf;};'use strict';var path=require(_0xc397('0x0'));var fs=require('fs');var _=require(_0xc397('0x1'));var db=require(_0xc397('0x2'))['db'];var config=require('../../config/environment');var util=require(_0xc397('0x3'));var BPromise=require('bluebird');var jayson=require(_0xc397('0x4'));var amiClient=jayson[_0xc397('0x5')][_0xc397('0x6')]({'port':0x232a});var logger=require(_0xc397('0x7'))(_0xc397('0x8'));var Redis=require('ioredis');config[_0xc397('0x9')]=_[_0xc397('0xa')](config['redis'],{'host':_0xc397('0xb'),'port':0x18eb});var io=require(_0xc397('0xc'))(new Redis(config[_0xc397('0x9')]));var Schema=require(_0xc397('0xd'));var originateValidation=new Schema({'userId':{'type':_0xc397('0xe'),'required':[!![],_0xc397('0xf')]},'callNumber':{'type':_0xc397('0x10'),'required':[!![],_0xc397('0x11')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xc397('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0xc397('0xe'),'required':[!![],_0xc397('0xf')]},'sessionId':{'type':_0xc397('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xc397('0xe'),'required':[!![],_0xc397('0xf')]},'sessionId':{'type':_0xc397('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xc397('0xe'),'required':[!![],_0xc397('0xf')]},'sessionId':{'type':_0xc397('0x10'),'required':[!![],_0xc397('0x12')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc397('0xf')]},'sessionId':{'type':_0xc397('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xc397('0xe'),'required':[!![],_0xc397('0xf')]},'sessionId':{'type':_0xc397('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xc397('0xe'),'required':[!![],_0xc397('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x57e3dc,_0x1a4f76,_0x29b557){logger[_0xc397('0x13')](_0x57e3dc,_0x1a4f76,JSON['stringify'](_0x29b557));io['to'](_0x57e3dc)[_0xc397('0x14')](_0x1a4f76,_0x29b557);}function handleError(_0x1bf3b8){return function(_0x2eb838){console[_0xc397('0x15')](_0xc397('0x16'),_0x2eb838,_0x2eb838 instanceof RangeError);logger[_0xc397('0x17')](_0x2eb838[_0xc397('0x18')]);if(_0x2eb838 instanceof RangeError){if(_0x2eb838[_0xc397('0x19')]){delete _0x2eb838[_0xc397('0x19')];}_0x1bf3b8['status'](0x194)['send'](_0x2eb838);}else{if(_0x2eb838[_0xc397('0x19')]){delete _0x2eb838[_0xc397('0x19')];}_0x1bf3b8[_0xc397('0x1a')](0x1f4)['send'](_0x2eb838);}};}function checkError(){return function(_0x667478){if(!_0x667478){throw new RangeError(_0xc397('0x1b'));}return _0x667478;};}function respondWithRpcPromise(_0x57bf5e,_0x4206de){return new BPromise(function(_0x1b8de5,_0x1331ea){var _0x5a3ff1=amiClient;return _0x5a3ff1['request'](_0x57bf5e,_0x4206de)['then'](function(_0x1c6612){if(_0x1c6612[_0xc397('0x17')]){if(_0x1c6612['error'][_0xc397('0x1c')]===0x1f4){return _0x1331ea(_0x1c6612[_0xc397('0x17')][_0xc397('0x1d')]);}return _0x1b8de5(_0x1c6612[_0xc397('0x17')][_0xc397('0x1d')]);}else{_0x1b8de5(_0x1c6612[_0xc397('0x1e')]);}})[_0xc397('0x1f')](function(_0x1c0e2e){_0x1331ea(_0x1c0e2e);});});}function getAgent(_0xec8024){return db['User']['findOne']({'where':{'id':_0xec8024,'role':'agent'}})[_0xc397('0x20')](checkError());}function getAgentCheckSession(_0x55e144,_0x20f527){return new BPromise(function(_0x5ccc02,_0x4a9daa){var _0x32ef69=respondWithRpcPromise(_0xc397('0x21'));var _0x3c70ee=getAgent(_0x55e144);Promise[_0xc397('0x22')]([_0x32ef69,_0x3c70ee])['then'](function(_0x4b4f7a){var _0x573b37=_0x4b4f7a[0x0];var _0x244cda=_0x4b4f7a[0x1];var _0x3577f0=_['filter'](_0x573b37[_0xc397('0x23')],function(_0x949775){return _0x949775[_0xc397('0x24')]==_0x244cda['id']&&_0x949775['sessionId']==_0x20f527;});if(_0x3577f0[_0xc397('0x25')]==0x1){_0x5ccc02(_0x244cda);}else{_0x4a9daa(new RangeError(_0xc397('0x26')+_0x20f527+'\x20not\x20found!'));}});});}exports['originate']=function(_0x16490d,_0x3f5e14){logger['info'](_0xc397('0x27'),_0x16490d['body']);var _0x15c4f4=originateValidation[_0xc397('0xd')](_0x16490d[_0xc397('0x28')]);if(_0x15c4f4[_0xc397('0x25')]>0x0){return _0x3f5e14[_0xc397('0x1a')](0x190)['json'](_0x15c4f4);}var _0x5aea7e=_0x16490d['body'][_0xc397('0x29')];var _0x453842=_0x16490d['body']['callNumber'];var _0x32aaaa=_0x16490d[_0xc397('0x28')]['callerId'];var _0x40fda1=_0x16490d['body'][_0xc397('0x2a')];return getAgent(_0x5aea7e)['then'](function(_0x3dad71){logger[_0xc397('0x13')]('entityFound:',_0x3dad71[_0xc397('0x19')]);emit(util[_0xc397('0x2b')](_0xc397('0x2c'),_0x3dad71[_0xc397('0x19')]),_0xc397('0x2d'),{'callNumber':_0x453842,'callerId':_0x32aaaa,'callbackUrl':_0x40fda1});return _0x3f5e14[_0xc397('0x1a')](0xc8)['json']({'error':![],'message':_0xc397('0x2e')});})['catch'](handleError(_0x3f5e14));};exports['hangup']=function(_0x1d5a52,_0x12481f){logger[_0xc397('0x13')](_0xc397('0x2f'),_0x1d5a52[_0xc397('0x28')]);var _0x306703=hangupValidation['validate'](_0x1d5a52[_0xc397('0x28')]);if(_0x306703[_0xc397('0x25')]>0x0){return _0x12481f[_0xc397('0x1a')](0x190)['json'](_0x306703);}var _0x45c415=_0x1d5a52[_0xc397('0x28')]['userId'];var _0x5a5a46=_0x1d5a52['body'][_0xc397('0x30')];return getAgent(_0x45c415)[_0xc397('0x20')](function(_0x291497){logger[_0xc397('0x13')](_0xc397('0x31'),_0x291497['name']);emit(util[_0xc397('0x2b')](_0xc397('0x2c'),_0x291497[_0xc397('0x19')]),_0xc397('0x32'),{'sessionId':_0x5a5a46});return _0x12481f[_0xc397('0x1a')](0xc8)[_0xc397('0x33')]({'error':![],'message':_0xc397('0x34')});})[_0xc397('0x1f')](handleError(_0x12481f));};exports[_0xc397('0x35')]=function(_0x5d1f59,_0x59276e){logger['info'](_0xc397('0x36'),_0x5d1f59['body']);var _0x1e681a=answerValidation[_0xc397('0xd')](_0x5d1f59[_0xc397('0x28')]);if(_0x1e681a[_0xc397('0x25')]>0x0){return _0x59276e[_0xc397('0x1a')](0x190)[_0xc397('0x33')](_0x1e681a);}var _0x5c37e5=_0x5d1f59[_0xc397('0x28')][_0xc397('0x29')];var _0x587ce8=_0x5d1f59['body'][_0xc397('0x30')];return getAgent(_0x5c37e5)[_0xc397('0x20')](function(_0x366300){logger[_0xc397('0x13')]('entityFound:',_0x366300[_0xc397('0x19')]);emit(util['format'](_0xc397('0x2c'),_0x366300['name']),_0xc397('0x37'),{'sessionId':_0x587ce8});return _0x59276e['status'](0xc8)[_0xc397('0x33')]({'error':![],'message':_0xc397('0x38')});})[_0xc397('0x1f')](handleError(_0x59276e));};exports['hold']=function(_0x4a91d8,_0x386153){logger['info'](_0xc397('0x39'),_0x4a91d8[_0xc397('0x28')]);var _0x269feb=holdValidation[_0xc397('0xd')](_0x4a91d8[_0xc397('0x28')]);if(_0x269feb[_0xc397('0x25')]>0x0){return _0x386153['status'](0x190)[_0xc397('0x33')](_0x269feb);}var _0xea6b50=_0x4a91d8['body'][_0xc397('0x29')];var _0x4b0dec=_0x4a91d8[_0xc397('0x28')]['sessionId'];return getAgent(_0xea6b50)['then'](function(_0x41c2f8){logger['info'](_0xc397('0x31'),_0x41c2f8[_0xc397('0x19')]);emit(util[_0xc397('0x2b')](_0xc397('0x2c'),_0x41c2f8['name']),'webbar:hold',{'sessionId':_0x4b0dec});return _0x386153[_0xc397('0x1a')](0xc8)[_0xc397('0x33')]({'error':![],'message':'hold\x20executed!'});})[_0xc397('0x1f')](handleError(_0x386153));};exports[_0xc397('0x3a')]=function(_0x55847a,_0x184e46){logger[_0xc397('0x13')](_0xc397('0x3b'),_0x55847a[_0xc397('0x28')]);var _0x453314=unholdValidation[_0xc397('0xd')](_0x55847a[_0xc397('0x28')]);if(_0x453314[_0xc397('0x25')]>0x0){return _0x184e46[_0xc397('0x1a')](0x190)['json'](_0x453314);}var _0xea784e=_0x55847a[_0xc397('0x28')]['userId'];var _0x1acae4=_0x55847a[_0xc397('0x28')]['sessionId'];return getAgent(_0xea784e)[_0xc397('0x20')](function(_0x351db3){logger[_0xc397('0x13')](_0xc397('0x31'),_0x351db3[_0xc397('0x19')]);emit(util[_0xc397('0x2b')](_0xc397('0x2c'),_0x351db3[_0xc397('0x19')]),_0xc397('0x3c'),{'sessionId':_0x1acae4});return _0x184e46[_0xc397('0x1a')](0xc8)[_0xc397('0x33')]({'error':![],'message':_0xc397('0x3d')});})[_0xc397('0x1f')](handleError(_0x184e46));};exports[_0xc397('0x3e')]=function(_0x4ca9fc,_0x410d9a){logger['info'](_0xc397('0x3f'),_0x410d9a[_0xc397('0x28')]);var _0x2b8aef=callsValidation[_0xc397('0xd')](_0x4ca9fc['body']);if(_0x2b8aef[_0xc397('0x25')]>0x0){return _0x410d9a['status'](0x190)[_0xc397('0x33')](_0x2b8aef);}var _0x474894=_0x4ca9fc[_0xc397('0x28')][_0xc397('0x29')];var _0x48b4d8=respondWithRpcPromise(_0xc397('0x21'));var _0x2bf3c9=getAgent(_0x474894);return Promise[_0xc397('0x22')]([_0x48b4d8,_0x2bf3c9])[_0xc397('0x20')](function(_0x175f98){var _0x547496=_0x175f98[0x0];var _0x45f97e=_0x175f98[0x1];var _0x25c17f=_[_0xc397('0x40')](_0x547496[_0xc397('0x23')],function(_0x30b56d){return _0x30b56d['UserId']==_0x45f97e['id'];});return _0x410d9a['status'](0xc8)[_0xc397('0x33')]({'count':_0x25c17f[_0xc397('0x25')],'rows':_0x25c17f});})['catch'](handleError(_0x410d9a));};exports[_0xc397('0x41')]=function(_0xa79d96,_0x2a49b9){logger['info'](_0xc397('0x42'),_0xa79d96[_0xc397('0x28')]);var _0x27822c=conferenceValidation[_0xc397('0xd')](_0xa79d96['body']);if(_0x27822c[_0xc397('0x25')]>0x0){return _0x2a49b9['status'](0x190)[_0xc397('0x33')](_0x27822c);}var _0x4b4929=_0xa79d96[_0xc397('0x28')]['userId'];return getAgent(_0x4b4929)[_0xc397('0x20')](function(_0x1c7790){logger[_0xc397('0x13')](_0xc397('0x31'),_0x1c7790[_0xc397('0x19')]);emit(util[_0xc397('0x2b')](_0xc397('0x2c'),_0x1c7790[_0xc397('0x19')]),_0xc397('0x43'));return _0x2a49b9[_0xc397('0x1a')](0xc8)[_0xc397('0x33')]({'error':![],'message':'conference\x20executed!'});})[_0xc397('0x1f')](handleError(_0x2a49b9));};exports['transfer']=function(_0x598b77,_0x34d177){logger[_0xc397('0x13')](_0xc397('0x44'),_0x598b77[_0xc397('0x28')]);var _0x442d8a=transferValidation[_0xc397('0xd')](_0x598b77[_0xc397('0x28')]);if(_0x442d8a['length']>0x0){return _0x34d177['status'](0x190)[_0xc397('0x33')](_0x442d8a);}var _0x4b754a=_0x598b77[_0xc397('0x28')][_0xc397('0x29')];var _0x59bde2=_0x598b77['body'][_0xc397('0x30')];var _0x2a94d9=_0x598b77[_0xc397('0x28')]['transferNumber'];return getAgent(_0x4b754a)['then'](function(_0x11d5c4){logger[_0xc397('0x13')](_0xc397('0x31'),_0x11d5c4[_0xc397('0x19')]);emit(util[_0xc397('0x2b')](_0xc397('0x2c'),_0x11d5c4[_0xc397('0x19')]),_0xc397('0x45'),{'sessionId':_0x59bde2,'transferNumber':_0x2a94d9});return _0x34d177[_0xc397('0x1a')](0xc8)[_0xc397('0x33')]({'error':![],'message':_0xc397('0x46')});})[_0xc397('0x1f')](handleError(_0x34d177));}; \ No newline at end of file +var _0xcc73=['hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','VoiceChannels','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','lodash','../../mysqldb','bluebird','client','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','request','message','result','catch','User','findOne','then','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','body','json','userId','callNumber','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','format','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold'];(function(_0x409b87,_0x5ef488){var _0x46fa68=function(_0x2ddda7){while(--_0x2ddda7){_0x409b87['push'](_0x409b87['shift']());}};_0x46fa68(++_0x5ef488);}(_0xcc73,0x1cb));var _0x3cc7=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xcc73[_0x3947c9];return _0x2e7871;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x3cc7('0x0'));var db=require(_0x3cc7('0x1'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x3cc7('0x2'));var jayson=require('jayson/promise');var amiClient=jayson[_0x3cc7('0x3')]['http']({'port':0x232a});var logger=require('../../config/logger')(_0x3cc7('0x4'));var Redis=require(_0x3cc7('0x5'));config[_0x3cc7('0x6')]=_[_0x3cc7('0x7')](config[_0x3cc7('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x3cc7('0x8'))(new Redis(config[_0x3cc7('0x6')]));var Schema=require(_0x3cc7('0x9'));var originateValidation=new Schema({'userId':{'type':_0x3cc7('0xa'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x3cc7('0xb'),'required':[!![],_0x3cc7('0xc')]},'callerId':{'type':_0x3cc7('0xb')},'callbackUrl':{'type':_0x3cc7('0xb')}});var hangupValidation=new Schema({'userId':{'type':_0x3cc7('0xa'),'required':[!![],_0x3cc7('0xd')]},'sessionId':{'type':_0x3cc7('0xb'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3cc7('0xb'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3cc7('0xd')]},'sessionId':{'type':_0x3cc7('0xb'),'required':[!![],_0x3cc7('0xe')]},'transferNumber':{'type':_0x3cc7('0xb'),'required':[!![],_0x3cc7('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x3cc7('0xa'),'required':[!![],_0x3cc7('0xd')]},'sessionId':{'type':_0x3cc7('0xb'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x3cc7('0xa'),'required':[!![],_0x3cc7('0xd')]},'sessionId':{'type':_0x3cc7('0xb'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3cc7('0xa'),'required':[!![],_0x3cc7('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x3cc7('0xa'),'required':[!![],_0x3cc7('0xd')]}});function emit(_0x857775,_0x2c4688,_0x1320a8){logger[_0x3cc7('0x10')](_0x857775,_0x2c4688,JSON[_0x3cc7('0x11')](_0x1320a8));io['to'](_0x857775)[_0x3cc7('0x12')](_0x2c4688,_0x1320a8);}function handleError(_0x1bf3b7){return function(_0x2a4ddf){console[_0x3cc7('0x13')](_0x3cc7('0x14'),_0x2a4ddf,_0x2a4ddf instanceof RangeError);logger[_0x3cc7('0x15')](_0x2a4ddf[_0x3cc7('0x16')]);if(_0x2a4ddf instanceof RangeError){if(_0x2a4ddf[_0x3cc7('0x17')]){delete _0x2a4ddf[_0x3cc7('0x17')];}_0x1bf3b7['status'](0x194)['send'](_0x2a4ddf);}else{if(_0x2a4ddf[_0x3cc7('0x17')]){delete _0x2a4ddf['name'];}_0x1bf3b7[_0x3cc7('0x18')](0x1f4)[_0x3cc7('0x19')](_0x2a4ddf);}};}function checkError(){return function(_0x252a35){if(!_0x252a35){throw new RangeError('NotFound');}return _0x252a35;};}function respondWithRpcPromise(_0x490730,_0x2434f2){return new BPromise(function(_0xffbcd9,_0x4d5b7f){var _0x40906b=amiClient;return _0x40906b[_0x3cc7('0x1a')](_0x490730,_0x2434f2)['then'](function(_0xe345c){if(_0xe345c['error']){if(_0xe345c[_0x3cc7('0x15')]['code']===0x1f4){return _0x4d5b7f(_0xe345c[_0x3cc7('0x15')][_0x3cc7('0x1b')]);}return _0xffbcd9(_0xe345c[_0x3cc7('0x15')][_0x3cc7('0x1b')]);}else{_0xffbcd9(_0xe345c[_0x3cc7('0x1c')]);}})[_0x3cc7('0x1d')](function(_0x534cea){_0x4d5b7f(_0x534cea);});});}function getAgent(_0x2fa3d5){return db[_0x3cc7('0x1e')][_0x3cc7('0x1f')]({'where':{'id':_0x2fa3d5,'role':'agent'}})[_0x3cc7('0x20')](checkError());}function getAgentCheckSession(_0x595e7e,_0x58793b){return new BPromise(function(_0x4bd571,_0x2df77b){var _0x55e18=respondWithRpcPromise('VoiceChannels');var _0x5518cf=getAgent(_0x595e7e);Promise[_0x3cc7('0x21')]([_0x55e18,_0x5518cf])[_0x3cc7('0x20')](function(_0x17aa73){var _0x40a01c=_0x17aa73[0x0];var _0x281754=_0x17aa73[0x1];var _0x3af533=_[_0x3cc7('0x22')](_0x40a01c[_0x3cc7('0x23')],function(_0x30ccb6){return _0x30ccb6[_0x3cc7('0x24')]==_0x281754['id']&&_0x30ccb6[_0x3cc7('0x25')]==_0x58793b;});if(_0x3af533[_0x3cc7('0x26')]==0x1){_0x4bd571(_0x281754);}else{_0x2df77b(new RangeError(_0x3cc7('0x27')+_0x58793b+_0x3cc7('0x28')));}});});}exports['originate']=function(_0xbd633e,_0x4eeabb){logger['info']('originate\x20fired:',_0xbd633e[_0x3cc7('0x29')]);var _0x71cfb7=originateValidation[_0x3cc7('0x9')](_0xbd633e[_0x3cc7('0x29')]);if(_0x71cfb7[_0x3cc7('0x26')]>0x0){return _0x4eeabb[_0x3cc7('0x18')](0x190)[_0x3cc7('0x2a')](_0x71cfb7);}var _0x1ffb57=_0xbd633e[_0x3cc7('0x29')][_0x3cc7('0x2b')];var _0x3d0c75=_0xbd633e['body'][_0x3cc7('0x2c')];var _0x2c383b=_0xbd633e[_0x3cc7('0x29')]['callerId'];var _0x4b53e7=_0xbd633e[_0x3cc7('0x29')][_0x3cc7('0x2d')];return getAgent(_0x1ffb57)['then'](function(_0x3d0230){logger['info'](_0x3cc7('0x2e'),_0x3d0230[_0x3cc7('0x17')]);emit(util['format'](_0x3cc7('0x2f'),_0x3d0230[_0x3cc7('0x17')]),_0x3cc7('0x30'),{'callNumber':_0x3d0c75,'callerId':_0x2c383b,'callbackUrl':_0x4b53e7});return _0x4eeabb[_0x3cc7('0x18')](0xc8)[_0x3cc7('0x2a')]({'error':![],'message':_0x3cc7('0x31')});})['catch'](handleError(_0x4eeabb));};exports[_0x3cc7('0x32')]=function(_0x1d3e94,_0x594eb1){logger[_0x3cc7('0x10')](_0x3cc7('0x33'),_0x1d3e94['body']);var _0x3abeda=hangupValidation['validate'](_0x1d3e94[_0x3cc7('0x29')]);if(_0x3abeda[_0x3cc7('0x26')]>0x0){return _0x594eb1[_0x3cc7('0x18')](0x190)[_0x3cc7('0x2a')](_0x3abeda);}var _0x22ff63=_0x1d3e94[_0x3cc7('0x29')][_0x3cc7('0x2b')];var _0x1dda84=_0x1d3e94[_0x3cc7('0x29')][_0x3cc7('0x25')];return getAgent(_0x22ff63)[_0x3cc7('0x20')](function(_0xb44605){logger['info'](_0x3cc7('0x2e'),_0xb44605[_0x3cc7('0x17')]);emit(util[_0x3cc7('0x34')](_0x3cc7('0x2f'),_0xb44605[_0x3cc7('0x17')]),_0x3cc7('0x35'),{'sessionId':_0x1dda84});return _0x594eb1[_0x3cc7('0x18')](0xc8)[_0x3cc7('0x2a')]({'error':![],'message':_0x3cc7('0x36')});})[_0x3cc7('0x1d')](handleError(_0x594eb1));};exports['answer']=function(_0x10f4cd,_0xda646c){logger[_0x3cc7('0x10')](_0x3cc7('0x37'),_0x10f4cd[_0x3cc7('0x29')]);var _0x1cd784=answerValidation[_0x3cc7('0x9')](_0x10f4cd['body']);if(_0x1cd784[_0x3cc7('0x26')]>0x0){return _0xda646c[_0x3cc7('0x18')](0x190)[_0x3cc7('0x2a')](_0x1cd784);}var _0x2496b5=_0x10f4cd[_0x3cc7('0x29')][_0x3cc7('0x2b')];var _0x410be6=_0x10f4cd[_0x3cc7('0x29')]['sessionId'];return getAgent(_0x2496b5)[_0x3cc7('0x20')](function(_0x23895d){logger['info'](_0x3cc7('0x2e'),_0x23895d[_0x3cc7('0x17')]);emit(util[_0x3cc7('0x34')](_0x3cc7('0x2f'),_0x23895d[_0x3cc7('0x17')]),_0x3cc7('0x38'),{'sessionId':_0x410be6});return _0xda646c[_0x3cc7('0x18')](0xc8)[_0x3cc7('0x2a')]({'error':![],'message':_0x3cc7('0x39')});})[_0x3cc7('0x1d')](handleError(_0xda646c));};exports[_0x3cc7('0x3a')]=function(_0xdd1e69,_0xc85888){logger[_0x3cc7('0x10')](_0x3cc7('0x3b'),_0xdd1e69[_0x3cc7('0x29')]);var _0x56299a=holdValidation[_0x3cc7('0x9')](_0xdd1e69[_0x3cc7('0x29')]);if(_0x56299a[_0x3cc7('0x26')]>0x0){return _0xc85888[_0x3cc7('0x18')](0x190)['json'](_0x56299a);}var _0x443c6d=_0xdd1e69[_0x3cc7('0x29')]['userId'];var _0x16cae2=_0xdd1e69[_0x3cc7('0x29')][_0x3cc7('0x25')];return getAgent(_0x443c6d)[_0x3cc7('0x20')](function(_0x174fbb){logger['info'](_0x3cc7('0x2e'),_0x174fbb['name']);emit(util[_0x3cc7('0x34')](_0x3cc7('0x2f'),_0x174fbb[_0x3cc7('0x17')]),_0x3cc7('0x3c'),{'sessionId':_0x16cae2});return _0xc85888[_0x3cc7('0x18')](0xc8)['json']({'error':![],'message':_0x3cc7('0x3d')});})[_0x3cc7('0x1d')](handleError(_0xc85888));};exports[_0x3cc7('0x3e')]=function(_0x215b45,_0x35248b){logger['info'](_0x3cc7('0x3f'),_0x215b45[_0x3cc7('0x29')]);var _0x17a515=unholdValidation['validate'](_0x215b45[_0x3cc7('0x29')]);if(_0x17a515[_0x3cc7('0x26')]>0x0){return _0x35248b[_0x3cc7('0x18')](0x190)[_0x3cc7('0x2a')](_0x17a515);}var _0x569774=_0x215b45[_0x3cc7('0x29')][_0x3cc7('0x2b')];var _0xb4997f=_0x215b45[_0x3cc7('0x29')][_0x3cc7('0x25')];return getAgent(_0x569774)[_0x3cc7('0x20')](function(_0x2387c0){logger[_0x3cc7('0x10')]('entityFound:',_0x2387c0['name']);emit(util['format'](_0x3cc7('0x2f'),_0x2387c0['name']),_0x3cc7('0x40'),{'sessionId':_0xb4997f});return _0x35248b[_0x3cc7('0x18')](0xc8)[_0x3cc7('0x2a')]({'error':![],'message':_0x3cc7('0x41')});})[_0x3cc7('0x1d')](handleError(_0x35248b));};exports[_0x3cc7('0x42')]=function(_0x21a7d0,_0x49bfa8){logger[_0x3cc7('0x10')]('calls\x20fired:',_0x49bfa8['body']);var _0x47012d=callsValidation[_0x3cc7('0x9')](_0x21a7d0[_0x3cc7('0x29')]);if(_0x47012d['length']>0x0){return _0x49bfa8[_0x3cc7('0x18')](0x190)['json'](_0x47012d);}var _0x59fcc4=_0x21a7d0[_0x3cc7('0x29')][_0x3cc7('0x2b')];var _0x2902c4=respondWithRpcPromise(_0x3cc7('0x43'));var _0x5be52a=getAgent(_0x59fcc4);return Promise[_0x3cc7('0x21')]([_0x2902c4,_0x5be52a])[_0x3cc7('0x20')](function(_0x3fe653){var _0x41f705=_0x3fe653[0x0];var _0x5b25aa=_0x3fe653[0x1];var _0xee667f=_[_0x3cc7('0x22')](_0x41f705[_0x3cc7('0x23')],function(_0x84de20){return _0x84de20[_0x3cc7('0x24')]==_0x5b25aa['id'];});return _0x49bfa8[_0x3cc7('0x18')](0xc8)['json']({'count':_0xee667f['length'],'rows':_0xee667f});})[_0x3cc7('0x1d')](handleError(_0x49bfa8));};exports['conference']=function(_0x5502aa,_0xcafdb5){logger[_0x3cc7('0x10')](_0x3cc7('0x44'),_0x5502aa[_0x3cc7('0x29')]);var _0x1c095a=conferenceValidation[_0x3cc7('0x9')](_0x5502aa[_0x3cc7('0x29')]);if(_0x1c095a[_0x3cc7('0x26')]>0x0){return _0xcafdb5[_0x3cc7('0x18')](0x190)['json'](_0x1c095a);}var _0x6e0b1f=_0x5502aa[_0x3cc7('0x29')][_0x3cc7('0x2b')];return getAgent(_0x6e0b1f)[_0x3cc7('0x20')](function(_0x5e506a){logger[_0x3cc7('0x10')]('entityFound:',_0x5e506a[_0x3cc7('0x17')]);emit(util['format'](_0x3cc7('0x2f'),_0x5e506a[_0x3cc7('0x17')]),_0x3cc7('0x45'));return _0xcafdb5['status'](0xc8)[_0x3cc7('0x2a')]({'error':![],'message':_0x3cc7('0x46')});})['catch'](handleError(_0xcafdb5));};exports[_0x3cc7('0x47')]=function(_0x467be0,_0x2be9e6){logger[_0x3cc7('0x10')]('transfer\x20fired:',_0x467be0['body']);var _0x550220=transferValidation[_0x3cc7('0x9')](_0x467be0[_0x3cc7('0x29')]);if(_0x550220[_0x3cc7('0x26')]>0x0){return _0x2be9e6[_0x3cc7('0x18')](0x190)[_0x3cc7('0x2a')](_0x550220);}var _0x367940=_0x467be0[_0x3cc7('0x29')][_0x3cc7('0x2b')];var _0x5dff51=_0x467be0[_0x3cc7('0x29')][_0x3cc7('0x25')];var _0x2b0411=_0x467be0[_0x3cc7('0x29')][_0x3cc7('0x48')];return getAgent(_0x367940)[_0x3cc7('0x20')](function(_0x3b0e1e){logger['info'](_0x3cc7('0x2e'),_0x3b0e1e[_0x3cc7('0x17')]);emit(util['format'](_0x3cc7('0x2f'),_0x3b0e1e['name']),_0x3cc7('0x49'),{'sessionId':_0x5dff51,'transferNumber':_0x2b0411});return _0x2be9e6[_0x3cc7('0x18')](0xc8)[_0x3cc7('0x2a')]({'error':![],'message':'transfer\x20executed!'});})[_0x3cc7('0x1d')](handleError(_0x2be9e6));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index bb0a1ba..4257799 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 _0xa04e=['../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','create','post','addAnswer','addAgents','addApplications','/:id/notify','notify','send','put','update','destroy','removeDispositions','removeAnswers','delete','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x25eeb7,_0xbcbd23){var _0x518846=function(_0x23394b){while(--_0x23394b){_0x25eeb7['push'](_0x25eeb7['shift']());}};_0x518846(++_0xbcbd23);}(_0xa04e,0x1aa));var _0xea04=function(_0x51f17b,_0x137622){_0x51f17b=_0x51f17b-0x0;var _0x549b5f=_0xa04e[_0x51f17b];return _0x549b5f;};'use strict';var multer=require(_0xea04('0x0'));var util=require(_0xea04('0x1'));var path=require(_0xea04('0x2'));var timeout=require(_0xea04('0x3'));var express=require(_0xea04('0x4'));var router=express['Router']();var auth=require(_0xea04('0x5'));var interaction=require(_0xea04('0x6'));var config=require('../../config/environment');var controller=require(_0xea04('0x7'));router[_0xea04('0x8')]('/',auth[_0xea04('0x9')](),controller[_0xea04('0xa')]);router[_0xea04('0x8')](_0xea04('0xb'),auth['isAuthenticated'](),controller[_0xea04('0xc')]);router[_0xea04('0x8')](_0xea04('0xd'),auth[_0xea04('0x9')](),controller[_0xea04('0xe')]);router['get'](_0xea04('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xea04('0x8')](_0xea04('0x10'),auth['isAuthenticated'](),controller[_0xea04('0x11')]);router[_0xea04('0x8')](_0xea04('0x12'),auth[_0xea04('0x9')](),controller['getAgents']);router[_0xea04('0x8')](_0xea04('0x13'),auth[_0xea04('0x9')](),controller['getApplications']);router['post']('/',auth['isAuthenticated'](),controller[_0xea04('0x14')]);router['post'](_0xea04('0xf'),auth[_0xea04('0x9')](),controller['addDisposition']);router[_0xea04('0x15')]('/:id/canned_answers',auth[_0xea04('0x9')](),controller[_0xea04('0x16')]);router['post'](_0xea04('0x12'),auth['isAuthenticated'](),controller[_0xea04('0x17')]);router[_0xea04('0x15')](_0xea04('0x13'),auth[_0xea04('0x9')](),controller[_0xea04('0x18')]);router[_0xea04('0x15')](_0xea04('0x19'),controller[_0xea04('0x1a')]);router[_0xea04('0x15')]('/:id/send',auth[_0xea04('0x9')](),controller[_0xea04('0x1b')]);router[_0xea04('0x1c')](_0xea04('0xd'),auth[_0xea04('0x9')](),controller[_0xea04('0x1d')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xea04('0x1e')]);router['delete'](_0xea04('0xf'),auth['isAuthenticated'](),controller[_0xea04('0x1f')]);router['delete'](_0xea04('0x10'),auth[_0xea04('0x9')](),controller[_0xea04('0x20')]);router[_0xea04('0x21')](_0xea04('0x12'),auth[_0xea04('0x9')](),controller[_0xea04('0x22')]);module[_0xea04('0x23')]=router; \ No newline at end of file +var _0x1966=['show','/:id/canned_answers','getAnswers','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/users','addAgents','/:id/applications','addApplications','/:id/notify','notify','send','put','update','delete','destroy','removeDispositions','removeAnswers','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x30d6d2,_0x72bc42){var _0x206511=function(_0x1bb538){while(--_0x1bb538){_0x30d6d2['push'](_0x30d6d2['shift']());}};_0x206511(++_0x72bc42);}(_0x1966,0x10a));var _0x6196=function(_0x436c1b,_0x291299){_0x436c1b=_0x436c1b-0x0;var _0x20bc05=_0x1966[_0x436c1b];return _0x20bc05;};'use strict';var multer=require(_0x6196('0x0'));var util=require(_0x6196('0x1'));var path=require('path');var timeout=require(_0x6196('0x2'));var express=require(_0x6196('0x3'));var router=express['Router']();var auth=require(_0x6196('0x4'));var interaction=require(_0x6196('0x5'));var config=require(_0x6196('0x6'));var controller=require(_0x6196('0x7'));router[_0x6196('0x8')]('/',auth[_0x6196('0x9')](),controller[_0x6196('0xa')]);router['get'](_0x6196('0xb'),auth['isAuthenticated'](),controller[_0x6196('0xc')]);router[_0x6196('0x8')](_0x6196('0xd'),auth[_0x6196('0x9')](),controller[_0x6196('0xe')]);router['get']('/:id/dispositions',auth[_0x6196('0x9')](),controller['getDispositions']);router[_0x6196('0x8')](_0x6196('0xf'),auth[_0x6196('0x9')](),controller[_0x6196('0x10')]);router[_0x6196('0x8')]('/:id/users',auth[_0x6196('0x9')](),controller['getAgents']);router['get']('/:id/applications',auth[_0x6196('0x9')](),controller['getApplications']);router[_0x6196('0x11')]('/',auth[_0x6196('0x9')](),controller[_0x6196('0x12')]);router[_0x6196('0x11')](_0x6196('0x13'),auth[_0x6196('0x9')](),controller[_0x6196('0x14')]);router[_0x6196('0x11')](_0x6196('0xf'),auth[_0x6196('0x9')](),controller[_0x6196('0x15')]);router[_0x6196('0x11')](_0x6196('0x16'),auth[_0x6196('0x9')](),controller[_0x6196('0x17')]);router[_0x6196('0x11')](_0x6196('0x18'),auth[_0x6196('0x9')](),controller[_0x6196('0x19')]);router[_0x6196('0x11')](_0x6196('0x1a'),controller[_0x6196('0x1b')]);router['post']('/:id/send',auth[_0x6196('0x9')](),controller[_0x6196('0x1c')]);router[_0x6196('0x1d')](_0x6196('0xd'),auth['isAuthenticated'](),controller[_0x6196('0x1e')]);router[_0x6196('0x1f')](_0x6196('0xd'),auth[_0x6196('0x9')](),controller[_0x6196('0x20')]);router['delete']('/:id/dispositions',auth[_0x6196('0x9')](),controller[_0x6196('0x21')]);router[_0x6196('0x1f')]('/:id/canned_answers',auth[_0x6196('0x9')](),controller[_0x6196('0x22')]);router[_0x6196('0x1f')](_0x6196('0x16'),auth[_0x6196('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 432807d..365937a 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 _0x1084=['generate','ENUM','twilio','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x19c75a,_0x5fde73){var _0xe51d07=function(_0x49b7e1){while(--_0x49b7e1){_0x19c75a['push'](_0x19c75a['shift']());}};_0xe51d07(++_0x5fde73);}(_0x1084,0x191));var _0x4108=function(_0x28e48b,_0x9b5034){_0x28e48b=_0x28e48b-0x0;var _0xd0bc23=_0x1084[_0x28e48b];return _0xd0bc23;};'use strict';var Sequelize=require(_0x4108('0x0'));var rs=require(_0x4108('0x1'));module[_0x4108('0x2')]={'name':{'type':Sequelize[_0x4108('0x3')],'unique':_0x4108('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x4108('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x4108('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x4108('0x3')],'defaultValue':function(){return rs[_0x4108('0x5')]();}},'phone':{'type':Sequelize[_0x4108('0x3')]},'type':{'type':Sequelize[_0x4108('0x6')](_0x4108('0x7'))},'accountSid':{'type':Sequelize[_0x4108('0x3')]},'authToken':{'type':Sequelize[_0x4108('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x4108('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x4108('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4108('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4108('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4108('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4108('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4108('0x9')],'comment':_0x4108('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x4108('0x8')],'defaultValue':![],'comment':_0x4108('0xb'),'set':function(_0x38be79){if(!_0x38be79){this['setDataValue'](_0x4108('0xc'),null);}this['setDataValue'](_0x4108('0xd'),_0x38be79);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x65c8=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x65c8,0xb8));var _0x865c=function(_0x13c282,_0x447e47){_0x13c282=_0x13c282-0x0;var _0x5893da=_0x65c8[_0x13c282];return _0x5893da;};'use strict';var Sequelize=require(_0x865c('0x0'));var rs=require(_0x865c('0x1'));module[_0x865c('0x2')]={'name':{'type':Sequelize[_0x865c('0x3')],'unique':_0x865c('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x865c('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x865c('0x3')]},'type':{'type':Sequelize[_0x865c('0x5')](_0x865c('0x6'))},'accountSid':{'type':Sequelize[_0x865c('0x3')]},'authToken':{'type':Sequelize[_0x865c('0x3')]},'notificationTemplate':{'type':Sequelize[_0x865c('0x7')],'defaultValue':function(){return _0x865c('0x8');}},'notificationSound':{'type':Sequelize[_0x865c('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x865c('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x865c('0xa')],'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[_0x865c('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x865c('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x865c('0xa')],'comment':_0x865c('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x865c('0x9')],'defaultValue':![],'comment':_0x865c('0xc'),'set':function(_0x58b18e){if(!_0x58b18e){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0x865c('0xd')](_0x865c('0xe'),_0x58b18e);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index e2c468b..a6535f8 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 _0x373d=['Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','filters','pick','filter','merge','options','includeAll','WhatsappAccount','findAll','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','order','map','include','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','applications','asc','account','CmContact','createdAt','difference','CompanyId','ListId','mobile','from','From','replace','MessageSid','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','updatedAt','DESC','Contacts','defaults','contact','WhatsappInteraction','interaction','autoclose','close','unmanaged','created','WhatsappMessage','messageId','ContactId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','send','\x0a','to\x20is\x20mandatory','List','out','dataValues','Messages','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','index'];(function(_0xcc4d4,_0x39918f){var _0x4af6ec=function(_0x38db08){while(--_0x38db08){_0xcc4d4['push'](_0xcc4d4['shift']());}};_0x4af6ec(++_0x39918f);}(_0x373d,0x1e2));var _0xd373=function(_0x24cf99,_0x2e2189){_0x24cf99=_0x24cf99-0x0;var _0x210865=_0x373d[_0x24cf99];return _0x210865;};'use strict';var pdf=require(_0xd373('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd373('0x1'));var zipdir=require(_0xd373('0x2'));var jsonpatch=require(_0xd373('0x3'));var rp=require(_0xd373('0x4'));var moment=require('moment');var BPromise=require(_0xd373('0x5'));var Mustache=require(_0xd373('0x6'));var util=require(_0xd373('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd373('0x8'));var ejs=require(_0xd373('0x9'));var fs=require('fs');var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var db=require(_0xd373('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd373('0x15'),'port':0x18eb});var socket=require(_0xd373('0x16'))(new Redis(config['redis']));require(_0xd373('0x17'))[_0xd373('0x18')](socket);var jayson=require(_0xd373('0x19'));var client=jayson[_0xd373('0x1a')][_0xd373('0x1b')]({'port':0x232c});function checkPasswordPattern(_0x1a9df9,_0x20aca5,_0x2eacb1){if(_0x2eacb1){var _0x5a286a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a286a[_0xd373('0x1c')](_0x20aca5)){return _0x1a9df9;}else{throw new db[(_0xd373('0x1d'))][(_0xd373('0x1e'))](_0xd373('0x1f'));}}else{return _0x1a9df9;}}function respondWithRpcPromise(_0x4e5768,_0x1e26cf,_0x5eab00,_0x460259){return new BPromise(function(_0x36d47a,_0x55c5c7){var _0x1bbdbd=_0x460259||client;return _0x1bbdbd['request'](_0x4e5768,_0x5eab00)['then'](function(_0x23fada){logger[_0xd373('0x20')](_0xd373('0x21'),_0x1e26cf,_0xd373('0x22'));logger[_0xd373('0x23')](_0xd373('0x24'),_0x1e26cf,'request\x20sent',JSON[_0xd373('0x25')](_0x23fada));if(_0x23fada[_0xd373('0x26')]){if(_0x23fada[_0xd373('0x26')][_0xd373('0x27')]===0x1f4){logger[_0xd373('0x26')](_0xd373('0x21'),_0x1e26cf,_0x23fada['error'][_0xd373('0x28')]);return _0x55c5c7(_0x23fada[_0xd373('0x26')][_0xd373('0x28')]);}logger[_0xd373('0x26')](_0xd373('0x21'),_0x1e26cf,_0x23fada[_0xd373('0x26')][_0xd373('0x28')]);return _0x36d47a(_0x23fada[_0xd373('0x26')][_0xd373('0x28')]);}else{logger[_0xd373('0x20')](_0xd373('0x21'),_0x1e26cf,_0xd373('0x22'));_0x36d47a(_0x23fada[_0xd373('0x29')][_0xd373('0x28')]);}})[_0xd373('0x2a')](function(_0x38ba50){logger[_0xd373('0x26')](_0xd373('0x21'),_0x1e26cf,_0x38ba50);_0x55c5c7(_0x38ba50);});});}function respondWithStatusCode(_0x3e657b,_0x470612){_0x470612=_0x470612||0xcc;return function(_0x45ee58){if(_0x45ee58){return _0x3e657b[_0xd373('0x2b')](_0x470612);}return _0x3e657b[_0xd373('0x2c')](_0x470612)[_0xd373('0x2d')]();};}function respondWithResult(_0xf85ca8,_0x2869e5){_0x2869e5=_0x2869e5||0xc8;return function(_0x158825){if(_0x158825){return _0xf85ca8[_0xd373('0x2c')](_0x2869e5)[_0xd373('0x2e')](_0x158825);}};}function respondWithFilteredResult(_0x7dad3e,_0x5287e7){return function(_0x7ca56e){if(_0x7ca56e){var _0x490842=_0x7ca56e[_0xd373('0x2f')],_0x498aaa=_0x5287e7[_0xd373('0x30')],_0xedc8f3=_0x5287e7[_0xd373('0x30')]+_0x5287e7['limit'],_0x15da6c;if(_0xedc8f3>=_0x490842){_0xedc8f3=_0x490842;_0x15da6c=0xc8;}else{_0x15da6c=0xce;}_0x7dad3e[_0xd373('0x2c')](_0x15da6c);return _0x7dad3e[_0xd373('0x31')]('Content-Range',_0x498aaa+'-'+_0xedc8f3+'/'+_0x490842)[_0xd373('0x2e')](_0x7ca56e);}return null;};}function patchUpdates(_0x8e4884){return function(_0x146e24){try{jsonpatch[_0xd373('0x32')](_0x146e24,_0x8e4884,!![]);}catch(_0x26538a){return BPromise[_0xd373('0x33')](_0x26538a);}return _0x146e24[_0xd373('0x34')]();};}function saveUpdates(_0x470d6e,_0x42faaa){return function(_0x52ff26){if(_0x52ff26){return _0x52ff26[_0xd373('0x35')](_0x470d6e)[_0xd373('0x36')](function(_0x420c73){return _0x420c73;});}return null;};}function removeEntity(_0x2cb761,_0x2da192){return function(_0x28da03){if(_0x28da03){return _0x28da03[_0xd373('0x37')]()[_0xd373('0x36')](function(){var _0xaa62aa=_0x28da03[_0xd373('0x38')]({'plain':!![]});var _0x38e0ea=_0xd373('0x39');return db[_0xd373('0x3a')][_0xd373('0x37')]({'where':{'type':_0x38e0ea,'resourceId':_0xaa62aa['id']}})[_0xd373('0x36')](function(){return _0x28da03;});})['then'](function(){_0x2cb761[_0xd373('0x2c')](0xcc)[_0xd373('0x2d')]();});}};}function handleEntityNotFound(_0x186e39,_0x3b4382){return function(_0x4b1080){if(!_0x4b1080){_0x186e39[_0xd373('0x2b')](0x194);}return _0x4b1080;};}function handleError(_0x470d91,_0x109fb2){_0x109fb2=_0x109fb2||0x1f4;return function(_0x3af9f7){logger[_0xd373('0x26')](_0x3af9f7[_0xd373('0x3b')]);if(_0x3af9f7['name']){delete _0x3af9f7['name'];}_0x470d91[_0xd373('0x2c')](_0x109fb2)['send'](_0x3af9f7);};}exports[_0xd373('0x3c')]=function(_0xe19d5b,_0x1d9b7a){var _0x51ba69={'include':[{'model':db[_0xd373('0x3d')],'as':_0xd373('0x3e')}]},_0x287136={},_0x14db16={'count':0x0,'rows':[]};var _0x504450=_['map'](db['WhatsappAccount'][_0xd373('0x3f')],function(_0x5b6385){return{'name':_0x5b6385[_0xd373('0x40')],'type':_0x5b6385[_0xd373('0x41')]['key']};});_0x287136['model']=_['map'](_0x504450,_0xd373('0x42'));_0x287136[_0xd373('0x43')]=_[_0xd373('0x44')](_0xe19d5b['query']);_0x287136['filters']=_[_0xd373('0x45')](_0x287136[_0xd373('0x46')],_0x287136['query']);_0x51ba69[_0xd373('0x47')]=_[_0xd373('0x45')](_0x287136[_0xd373('0x46')],qs[_0xd373('0x48')](_0xe19d5b[_0xd373('0x43')]['fields']));_0x51ba69['attributes']=_0x51ba69[_0xd373('0x47')][_0xd373('0x49')]?_0x51ba69[_0xd373('0x47')]:_0x287136[_0xd373('0x46')];if(!_0xe19d5b['query'][_0xd373('0x4a')]('nolimit')){_0x51ba69[_0xd373('0x4b')]=qs[_0xd373('0x4b')](_0xe19d5b[_0xd373('0x43')][_0xd373('0x4b')]);_0x51ba69[_0xd373('0x30')]=qs['offset'](_0xe19d5b[_0xd373('0x43')][_0xd373('0x30')]);}_0x51ba69['order']=qs[_0xd373('0x4c')](_0xe19d5b[_0xd373('0x43')][_0xd373('0x4c')]);_0x51ba69[_0xd373('0x4d')]=qs[_0xd373('0x4e')](_[_0xd373('0x4f')](_0xe19d5b[_0xd373('0x43')],_0x287136[_0xd373('0x4e')]),_0x504450);if(_0xe19d5b[_0xd373('0x43')][_0xd373('0x50')]){_0x51ba69['where']=_['merge'](_0x51ba69[_0xd373('0x4d')],{'$or':_['map'](_0x504450,function(_0x313963){if(_0x313963['type']!=='VIRTUAL'){var _0x5cbc16={};_0x5cbc16[_0x313963[_0xd373('0x42')]]={'$like':'%'+_0xe19d5b[_0xd373('0x43')][_0xd373('0x50')]+'%'};return _0x5cbc16;}})});}_0x51ba69=_[_0xd373('0x51')]({},_0x51ba69,_0xe19d5b[_0xd373('0x52')]);var _0x2fd07a={'where':_0x51ba69[_0xd373('0x4d')]};return db['WhatsappAccount'][_0xd373('0x2f')](_0x2fd07a)['then'](function(_0x4076e0){_0x14db16[_0xd373('0x2f')]=_0x4076e0;if(_0xe19d5b['query'][_0xd373('0x53')]){_0x51ba69['include']=[{'all':!![]}];}return db[_0xd373('0x54')][_0xd373('0x55')](_0x51ba69);})[_0xd373('0x36')](function(_0x1e97aa){_0x14db16[_0xd373('0x56')]=_0x1e97aa;return _0x14db16;})['then'](respondWithFilteredResult(_0x1d9b7a,_0x51ba69))['catch'](handleError(_0x1d9b7a,null));};exports['show']=function(_0x3a2192,_0x384e23){var _0x5b0801={'raw':![],'where':{'id':_0x3a2192[_0xd373('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xd373('0x3e')}]},_0x359bca={};_0x359bca[_0xd373('0x46')]=_[_0xd373('0x44')](db[_0xd373('0x54')][_0xd373('0x3f')]);_0x359bca[_0xd373('0x43')]=_[_0xd373('0x44')](_0x3a2192[_0xd373('0x43')]);_0x359bca[_0xd373('0x4e')]=_[_0xd373('0x45')](_0x359bca[_0xd373('0x46')],_0x359bca['query']);_0x5b0801['attributes']=_['intersection'](_0x359bca['model'],qs['fields'](_0x3a2192['query'][_0xd373('0x48')]));_0x5b0801[_0xd373('0x47')]=_0x5b0801['attributes']['length']?_0x5b0801['attributes']:_0x359bca[_0xd373('0x46')];if(_0x3a2192[_0xd373('0x43')]['includeAll']){_0x5b0801['include']=[{'all':!![]}];}_0x5b0801=_[_0xd373('0x51')]({},_0x5b0801,_0x3a2192[_0xd373('0x52')]);return db[_0xd373('0x54')][_0xd373('0x58')](_0x5b0801)[_0xd373('0x36')](handleEntityNotFound(_0x384e23,null))['then'](respondWithResult(_0x384e23,null))[_0xd373('0x2a')](handleError(_0x384e23,null));};exports[_0xd373('0x59')]=function(_0x386e4c,_0x213da6){return db[_0xd373('0x54')][_0xd373('0x59')](_0x386e4c[_0xd373('0x5a')],{})[_0xd373('0x36')](function(_0x10fffb){var _0x558aaf=_0x386e4c[_0xd373('0x5b')][_0xd373('0x38')]({'plain':!![]});if(!_0x558aaf)throw new Error(_0xd373('0x5c'));if(_0x558aaf[_0xd373('0x5d')]===_0xd373('0x5b')){var _0x4cb143=_0x10fffb[_0xd373('0x38')]({'plain':!![]});var _0x1f775c=_0xd373('0x39');return db['UserProfileSection'][_0xd373('0x58')]({'where':{'name':_0x1f775c,'userProfileId':_0x558aaf['userProfileId']},'raw':!![]})[_0xd373('0x36')](function(_0x4bf666){if(_0x4bf666&&_0x4bf666[_0xd373('0x5e')]===0x0){return db[_0xd373('0x3a')][_0xd373('0x59')]({'name':_0x4cb143[_0xd373('0x42')],'resourceId':_0x4cb143['id'],'type':_0x4bf666[_0xd373('0x42')],'sectionId':_0x4bf666['id']},{})[_0xd373('0x36')](function(){return _0x10fffb;});}else{return _0x10fffb;}})[_0xd373('0x2a')](function(_0xaaf7fa){logger[_0xd373('0x26')](_0xd373('0x5f'),_0xaaf7fa);throw _0xaaf7fa;});}return _0x10fffb;})[_0xd373('0x36')](respondWithResult(_0x213da6,0xc9))[_0xd373('0x2a')](handleError(_0x213da6,null));};exports[_0xd373('0x35')]=function(_0x1f496e,_0x2e3266){if(_0x1f496e[_0xd373('0x5a')]['id']){delete _0x1f496e[_0xd373('0x5a')]['id'];}return db[_0xd373('0x54')][_0xd373('0x58')]({'where':{'id':_0x1f496e[_0xd373('0x57')]['id']},'include':[{'model':db[_0xd373('0x3d')],'as':_0xd373('0x3e')}]})[_0xd373('0x36')](handleEntityNotFound(_0x2e3266,null))[_0xd373('0x36')](saveUpdates(_0x1f496e[_0xd373('0x5a')],null))[_0xd373('0x36')](respondWithResult(_0x2e3266,null))['catch'](handleError(_0x2e3266,null));};exports[_0xd373('0x37')]=function(_0x1f92bb,_0x5fdc16){return db['WhatsappAccount'][_0xd373('0x58')]({'where':{'id':_0x1f92bb[_0xd373('0x57')]['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x5fdc16,null))[_0xd373('0x36')](removeEntity(_0x5fdc16,null))[_0xd373('0x2a')](handleError(_0x5fdc16,null));};exports[_0xd373('0x60')]=function(_0x284730,_0x51f71f){return db[_0xd373('0x54')][_0xd373('0x60')]()[_0xd373('0x36')](respondWithResult(_0x51f71f,null))[_0xd373('0x2a')](handleError(_0x51f71f,null));};exports[_0xd373('0x61')]=function(_0x208233,_0x3fd90e,_0x2cf09){if(_0x208233['body']['id']){delete _0x208233[_0xd373('0x5a')]['id'];}return db['WhatsappAccount'][_0xd373('0x58')]({'where':{'id':_0x208233[_0xd373('0x57')]['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x3fd90e,null))[_0xd373('0x36')](function(_0x36e7cc){if(_0x36e7cc){_0x208233[_0xd373('0x5a')][_0xd373('0x62')]=_0x36e7cc['id'];return db[_0xd373('0x63')]['create'](_0x208233[_0xd373('0x5a')]);}})['then'](respondWithResult(_0x3fd90e,null))[_0xd373('0x2a')](handleError(_0x3fd90e,null));};exports[_0xd373('0x64')]=function(_0x310a65,_0x3ce679,_0x30fcd6){var _0x267e66={'raw':![],'where':{}};var _0x1f9a5a={};var _0x4cd326={'count':0x0,'rows':[]};return db[_0xd373('0x54')][_0xd373('0x65')]({'where':{'id':_0x310a65[_0xd373('0x57')]['id']}})['then'](handleEntityNotFound(_0x3ce679,null))[_0xd373('0x36')](function(_0x1d5b48){if(_0x1d5b48){_0x1f9a5a[_0xd373('0x46')]=_[_0xd373('0x44')](db[_0xd373('0x63')][_0xd373('0x3f')]);_0x1f9a5a[_0xd373('0x43')]=_[_0xd373('0x44')](_0x310a65[_0xd373('0x43')]);_0x1f9a5a[_0xd373('0x4e')]=_[_0xd373('0x45')](_0x1f9a5a[_0xd373('0x46')],_0x1f9a5a['query']);_0x267e66[_0xd373('0x47')]=_[_0xd373('0x45')](_0x1f9a5a[_0xd373('0x46')],qs['fields'](_0x310a65[_0xd373('0x43')][_0xd373('0x48')]));_0x267e66[_0xd373('0x47')]=_0x267e66['attributes'][_0xd373('0x49')]?_0x267e66['attributes']:_0x1f9a5a[_0xd373('0x46')];if(!_0x310a65[_0xd373('0x43')][_0xd373('0x4a')](_0xd373('0x66'))){_0x267e66['limit']=qs[_0xd373('0x4b')](_0x310a65['query'][_0xd373('0x4b')]);_0x267e66[_0xd373('0x30')]=qs[_0xd373('0x30')](_0x310a65[_0xd373('0x43')][_0xd373('0x30')]);}_0x267e66[_0xd373('0x67')]=qs['sort'](_0x310a65[_0xd373('0x43')]['sort']);_0x267e66[_0xd373('0x4d')]=qs['filters'](_['pick'](_0x310a65[_0xd373('0x43')],_0x1f9a5a[_0xd373('0x4e')]));_0x267e66[_0xd373('0x4d')][_0xd373('0x62')]=_0x1d5b48['id'];if(_0x310a65['query']['filter']){_0x267e66[_0xd373('0x4d')]=_[_0xd373('0x51')](_0x267e66[_0xd373('0x4d')],{'$or':_[_0xd373('0x68')](_0x267e66[_0xd373('0x47')],function(_0x1a30eb){var _0x16e708={};_0x16e708[_0x1a30eb]={'$like':'%'+_0x310a65[_0xd373('0x43')][_0xd373('0x50')]+'%'};return _0x16e708;})});}_0x267e66=_[_0xd373('0x51')]({},_0x267e66,_0x310a65['options']);return db[_0xd373('0x63')][_0xd373('0x2f')]({'where':_0x267e66[_0xd373('0x4d')]})[_0xd373('0x36')](function(_0x9bdd39){_0x4cd326[_0xd373('0x2f')]=_0x9bdd39;if(_0x310a65[_0xd373('0x43')]['includeAll']){_0x267e66[_0xd373('0x69')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x267e66);})[_0xd373('0x36')](function(_0x43f4a7){_0x4cd326[_0xd373('0x56')]=_0x43f4a7;return _0x4cd326;});}})[_0xd373('0x36')](respondWithFilteredResult(_0x3ce679,_0x267e66))[_0xd373('0x2a')](handleError(_0x3ce679,null));};exports[_0xd373('0x6a')]=function(_0x578a5e,_0x30732e,_0x19eb94){return db[_0xd373('0x54')]['find']({'where':{'id':_0x578a5e[_0xd373('0x57')]['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x30732e,null))[_0xd373('0x36')](function(_0x47ae4c){if(_0x47ae4c){return _0x47ae4c[_0xd373('0x6a')](_0x578a5e[_0xd373('0x43')][_0xd373('0x6b')]);}})['then'](respondWithStatusCode(_0x30732e,null))[_0xd373('0x2a')](handleError(_0x30732e,null));};exports[_0xd373('0x6c')]=function(_0x2059c4,_0x33ca89,_0x715eca){if(_0x2059c4[_0xd373('0x5a')]['id']){delete _0x2059c4[_0xd373('0x5a')]['id'];}return db[_0xd373('0x54')][_0xd373('0x58')]({'where':{'id':_0x2059c4[_0xd373('0x57')]['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x33ca89,null))[_0xd373('0x36')](function(_0x406f52){if(_0x406f52){_0x2059c4['body'][_0xd373('0x62')]=_0x406f52['id'];return db[_0xd373('0x6d')][_0xd373('0x59')](_0x2059c4['body']);}})[_0xd373('0x36')](respondWithResult(_0x33ca89,null))[_0xd373('0x2a')](handleError(_0x33ca89,null));};exports['getAnswers']=function(_0x476501,_0x578096,_0xf93f6b){var _0x473cf1={'raw':![],'where':{}};var _0x2a00e8={};var _0x3bc47a={'count':0x0,'rows':[]};return db[_0xd373('0x54')][_0xd373('0x65')]({'where':{'id':_0x476501['params']['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x578096,null))['then'](function(_0x18e009){if(_0x18e009){_0x2a00e8[_0xd373('0x46')]=_[_0xd373('0x44')](db[_0xd373('0x6d')][_0xd373('0x3f')]);_0x2a00e8['query']=_[_0xd373('0x44')](_0x476501[_0xd373('0x43')]);_0x2a00e8[_0xd373('0x4e')]=_[_0xd373('0x45')](_0x2a00e8[_0xd373('0x46')],_0x2a00e8[_0xd373('0x43')]);_0x473cf1['attributes']=_[_0xd373('0x45')](_0x2a00e8[_0xd373('0x46')],qs[_0xd373('0x48')](_0x476501['query'][_0xd373('0x48')]));_0x473cf1[_0xd373('0x47')]=_0x473cf1['attributes'][_0xd373('0x49')]?_0x473cf1['attributes']:_0x2a00e8[_0xd373('0x46')];if(!_0x476501['query']['hasOwnProperty'](_0xd373('0x66'))){_0x473cf1[_0xd373('0x4b')]=qs[_0xd373('0x4b')](_0x476501[_0xd373('0x43')][_0xd373('0x4b')]);_0x473cf1['offset']=qs[_0xd373('0x30')](_0x476501['query'][_0xd373('0x30')]);}_0x473cf1[_0xd373('0x67')]=qs[_0xd373('0x4c')](_0x476501['query'][_0xd373('0x4c')]);_0x473cf1['where']=qs[_0xd373('0x4e')](_[_0xd373('0x4f')](_0x476501[_0xd373('0x43')],_0x2a00e8[_0xd373('0x4e')]));_0x473cf1[_0xd373('0x4d')]['WhatsappAccountId']=_0x18e009['id'];if(_0x476501[_0xd373('0x43')][_0xd373('0x50')]){_0x473cf1[_0xd373('0x4d')]=_[_0xd373('0x51')](_0x473cf1[_0xd373('0x4d')],{'$or':_[_0xd373('0x68')](_0x473cf1[_0xd373('0x47')],function(_0x4859be){var _0x35e083={};_0x35e083[_0x4859be]={'$like':'%'+_0x476501[_0xd373('0x43')][_0xd373('0x50')]+'%'};return _0x35e083;})});}_0x473cf1=_[_0xd373('0x51')]({},_0x473cf1,_0x476501[_0xd373('0x52')]);return db[_0xd373('0x6d')][_0xd373('0x2f')]({'where':_0x473cf1[_0xd373('0x4d')]})[_0xd373('0x36')](function(_0xbe4347){_0x3bc47a[_0xd373('0x2f')]=_0xbe4347;if(_0x476501[_0xd373('0x43')][_0xd373('0x53')]){_0x473cf1[_0xd373('0x69')]=[{'all':!![]}];}return db[_0xd373('0x6d')][_0xd373('0x55')](_0x473cf1);})[_0xd373('0x36')](function(_0x53644a){_0x3bc47a[_0xd373('0x56')]=_0x53644a;return _0x3bc47a;});}})[_0xd373('0x36')](respondWithFilteredResult(_0x578096,_0x473cf1))['catch'](handleError(_0x578096,null));};exports['removeAnswers']=function(_0x280166,_0x3e7e7c,_0x4bcc80){return db[_0xd373('0x54')][_0xd373('0x58')]({'where':{'id':_0x280166[_0xd373('0x57')]['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x3e7e7c,null))[_0xd373('0x36')](function(_0x4870ca){if(_0x4870ca){return _0x4870ca[_0xd373('0x6e')](_0x280166[_0xd373('0x43')][_0xd373('0x6b')]);}})[_0xd373('0x36')](respondWithStatusCode(_0x3e7e7c,null))[_0xd373('0x2a')](handleError(_0x3e7e7c,null));};exports['addAgents']=function(_0x4e8b06,_0x147e3f,_0x19aed9){return db['WhatsappAccount'][_0xd373('0x58')]({'where':{'id':_0x4e8b06[_0xd373('0x57')]['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x147e3f,null))[_0xd373('0x36')](function(_0x1a3969){if(_0x1a3969){return _0x1a3969[_0xd373('0x6f')](_0x4e8b06['body'][_0xd373('0x6b')],_[_0xd373('0x70')](_0x4e8b06[_0xd373('0x5a')],['ids','id'])||{})[_0xd373('0x71')](function(_0x10b35e){for(var _0x698bd=0x0;_0x698bd<_0x4e8b06['body'][_0xd373('0x6b')][_0xd373('0x49')];_0x698bd+=0x1){socket['emit'](_0xd373('0x72'),{'UserId':_0x4e8b06[_0xd373('0x5a')]['ids'][_0x698bd],'WhatsappAccountId':_0x4e8b06[_0xd373('0x57')]['id']});}return _0x10b35e;});}})['then'](respondWithResult(_0x147e3f,null))[_0xd373('0x2a')](handleError(_0x147e3f,null));};exports[_0xd373('0x73')]=function(_0x3b6ba5,_0x54fef0,_0x585e5b){return db['WhatsappAccount'][_0xd373('0x58')]({'where':{'id':_0x3b6ba5['params']['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x54fef0,null))[_0xd373('0x36')](function(_0x57c629){if(_0x57c629){return _0x57c629[_0xd373('0x73')](_0x3b6ba5['query'][_0xd373('0x6b')])[_0xd373('0x36')](function(){if(_[_0xd373('0x74')](_0x3b6ba5[_0xd373('0x43')][_0xd373('0x6b')])){for(var _0x415d80=0x0;_0x415d80<_0x3b6ba5['query'][_0xd373('0x6b')]['length'];_0x415d80+=0x1){socket[_0xd373('0x75')](_0xd373('0x76'),{'UserId':Number(_0x3b6ba5[_0xd373('0x43')][_0xd373('0x6b')][_0x415d80]),'WhatsappAccountId':Number(_0x3b6ba5[_0xd373('0x57')]['id'])});}}else{socket[_0xd373('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x3b6ba5[_0xd373('0x43')][_0xd373('0x6b')]),'WhatsappAccountId':Number(_0x3b6ba5[_0xd373('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x54fef0,null))[_0xd373('0x2a')](handleError(_0x54fef0,null));};exports[_0xd373('0x77')]=function(_0x3edaa5,_0x2f1dc0,_0x132a55){var _0x783928={};var _0x5ae777={};var _0x1d4551;var _0x59c27d;return db[_0xd373('0x54')][_0xd373('0x65')]({'where':{'id':_0x3edaa5[_0xd373('0x57')]['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x2f1dc0,null))['then'](function(_0x5ccc0e){if(_0x5ccc0e){_0x1d4551=_0x5ccc0e;_0x5ae777[_0xd373('0x46')]=_[_0xd373('0x44')](db[_0xd373('0x78')][_0xd373('0x3f')]);_0x5ae777[_0xd373('0x43')]=_[_0xd373('0x44')](_0x3edaa5['query']);_0x5ae777[_0xd373('0x4e')]=_[_0xd373('0x45')](_0x5ae777['model'],_0x5ae777[_0xd373('0x43')]);_0x783928[_0xd373('0x47')]=_[_0xd373('0x45')](_0x5ae777['model'],qs[_0xd373('0x48')](_0x3edaa5[_0xd373('0x43')]['fields']));_0x783928['attributes']=_0x783928[_0xd373('0x47')][_0xd373('0x49')]?_0x783928[_0xd373('0x47')]:_0x5ae777[_0xd373('0x46')];_0x783928[_0xd373('0x67')]=qs[_0xd373('0x4c')](_0x3edaa5[_0xd373('0x43')]['sort']);_0x783928[_0xd373('0x4d')]=qs[_0xd373('0x4e')](_[_0xd373('0x4f')](_0x3edaa5[_0xd373('0x43')],_0x5ae777[_0xd373('0x4e')]));if(_0x3edaa5['query'][_0xd373('0x50')]){_0x783928[_0xd373('0x4d')]=_['merge'](_0x783928[_0xd373('0x4d')],{'$or':_['map'](_0x783928[_0xd373('0x47')],function(_0xead65e){var _0x1816a7={};_0x1816a7[_0xead65e]={'$like':'%'+_0x3edaa5[_0xd373('0x43')][_0xd373('0x50')]+'%'};return _0x1816a7;})});}_0x783928=_[_0xd373('0x51')]({},_0x783928,_0x3edaa5[_0xd373('0x52')]);return _0x1d4551[_0xd373('0x77')](_0x783928);}})['then'](function(_0x3f98d4){if(_0x3f98d4){_0x59c27d=_0x3f98d4[_0xd373('0x49')];if(!_0x3edaa5[_0xd373('0x43')][_0xd373('0x4a')](_0xd373('0x66'))){_0x783928[_0xd373('0x4b')]=qs['limit'](_0x3edaa5[_0xd373('0x43')][_0xd373('0x4b')]);_0x783928[_0xd373('0x30')]=qs[_0xd373('0x30')](_0x3edaa5[_0xd373('0x43')][_0xd373('0x30')]);}return _0x1d4551[_0xd373('0x77')](_0x783928);}})[_0xd373('0x36')](function(_0x442c3b){if(_0x442c3b){return _0x442c3b?{'count':_0x59c27d,'rows':_0x442c3b}:null;}})['then'](respondWithResult(_0x2f1dc0,null))[_0xd373('0x2a')](handleError(_0x2f1dc0,null));};exports[_0xd373('0x79')]=function(_0x2df849,_0x536c81,_0x14181d){return db['WhatsappAccount']['findOne']({'where':{'id':_0x2df849[_0xd373('0x57')]['id']}})['then'](handleEntityNotFound(_0x536c81,null))[_0xd373('0x36')](function(_0x528ea0){if(_0x528ea0){return db['sequelize']['transaction'](function(_0x570e1e){return db['WhatsappApplication'][_0xd373('0x37')]({'where':{'WhatsappAccountId':_0x2df849[_0xd373('0x57')]['id']},'transaction':_0x570e1e})[_0xd373('0x36')](function(_0x267dbd){var _0x4c7f62=_[_0xd373('0x68')](_0x2df849[_0xd373('0x5a')],function(_0x39cfbf){_0x39cfbf[_0xd373('0x62')]=_0x2df849[_0xd373('0x57')]['id'];return _0x39cfbf;});return db[_0xd373('0x7a')][_0xd373('0x7b')](_0x4c7f62,{'transaction':_0x570e1e});});})[_0xd373('0x36')](function(){return db[_0xd373('0x7a')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x2df849[_0xd373('0x57')]['id']},'order':_0xd373('0x7c')});});}})[_0xd373('0x36')](respondWithResult(_0x536c81,null))['catch'](handleError(_0x536c81,null));};exports[_0xd373('0x7d')]=function(_0x116a86,_0x4fbfbd,_0x4f50fd){var _0x389f22={};var _0x59e7d9={};var _0x435f3e;var _0x4152c6;return db[_0xd373('0x54')][_0xd373('0x65')]({'where':{'id':_0x116a86[_0xd373('0x57')]['id']}})[_0xd373('0x36')](handleEntityNotFound(_0x4fbfbd,null))['then'](function(_0x4b3764){if(_0x4b3764){_0x435f3e=_0x4b3764;_0x59e7d9[_0xd373('0x46')]=_[_0xd373('0x44')](db[_0xd373('0x7a')][_0xd373('0x3f')]);_0x59e7d9['query']=_['keys'](_0x116a86[_0xd373('0x43')]);_0x59e7d9[_0xd373('0x4e')]=_[_0xd373('0x45')](_0x59e7d9[_0xd373('0x46')],_0x59e7d9[_0xd373('0x43')]);_0x389f22['attributes']=_['intersection'](_0x59e7d9[_0xd373('0x46')],qs['fields'](_0x116a86[_0xd373('0x43')][_0xd373('0x48')]));_0x389f22[_0xd373('0x47')]=_0x389f22['attributes'][_0xd373('0x49')]?_0x389f22[_0xd373('0x47')]:_0x59e7d9['model'];_0x389f22[_0xd373('0x67')]=qs[_0xd373('0x4c')](_0x116a86[_0xd373('0x43')]['sort']);_0x389f22[_0xd373('0x4d')]=qs[_0xd373('0x4e')](_[_0xd373('0x4f')](_0x116a86['query'],_0x59e7d9['filters']));if(_0x116a86[_0xd373('0x43')][_0xd373('0x50')]){_0x389f22[_0xd373('0x4d')]=_[_0xd373('0x51')](_0x389f22[_0xd373('0x4d')],{'$or':_[_0xd373('0x68')](_0x389f22[_0xd373('0x47')],function(_0xbceb23){var _0x558917={};_0x558917[_0xbceb23]={'$like':'%'+_0x116a86[_0xd373('0x43')][_0xd373('0x50')]+'%'};return _0x558917;})});}_0x389f22=_[_0xd373('0x51')]({},_0x389f22,_0x116a86[_0xd373('0x52')]);return _0x435f3e['getApplications'](_0x389f22);}})[_0xd373('0x36')](function(_0x53d182){if(_0x53d182){_0x4152c6=_0x53d182[_0xd373('0x49')];if(!_0x116a86[_0xd373('0x43')]['hasOwnProperty'](_0xd373('0x66'))){_0x389f22[_0xd373('0x4b')]=qs[_0xd373('0x4b')](_0x116a86[_0xd373('0x43')][_0xd373('0x4b')]);_0x389f22[_0xd373('0x30')]=qs[_0xd373('0x30')](_0x116a86[_0xd373('0x43')]['offset']);}return _0x435f3e['getApplications'](_0x389f22);}})[_0xd373('0x36')](function(_0x35c0f8){if(_0x35c0f8){return _0x35c0f8?{'count':_0x4152c6,'rows':_0x35c0f8}:null;}})[_0xd373('0x36')](respondWithResult(_0x4fbfbd,null))['catch'](handleError(_0x4fbfbd,null));};exports[_0xd373('0x7e')]=function(_0x2e8acd,_0x5961e6,_0x765bf4){var _0x39d4de={'channel':_0xd373('0x7f')};var _0x442774=[];var _0x170502=[];var _0x1e18a3={};return db[_0xd373('0x54')][_0xd373('0x58')]({'where':{'id':_0x2e8acd[_0xd373('0x57')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xd373('0x80')}]})[_0xd373('0x36')](handleEntityNotFound(_0x5961e6,null))[_0xd373('0x36')](function(_0x8cb4da){_0x39d4de['account']=_0x8cb4da;_0x39d4de[_0xd373('0x81')]=_['orderBy'](_0x8cb4da[_0xd373('0x80')],[_0xd373('0x7c')],[_0xd373('0x82')]);if(_0x39d4de[_0xd373('0x83')][_0xd373('0x80')]){delete _0x39d4de['account']['Applications'];}return db[_0xd373('0x84')][_0xd373('0x60')]();})[_0xd373('0x36')](function(_0x54b879){if(!_0x54b879){throw new db[(_0xd373('0x1d'))][(_0xd373('0x1e'))]('no\x20available\x20attributes');}_0x442774=_['difference'](_['keys'](_0x54b879),[_0xd373('0x85'),'updatedAt']);_0x170502=_[_0xd373('0x86')](_[_0xd373('0x44')](_0x54b879),[_0xd373('0x85'),'updatedAt',_0xd373('0x87'),_0xd373('0x88')]);_0x39d4de[_0xd373('0x5a')]={'mapKey':_0xd373('0x89')};if(_0x39d4de[_0xd373('0x83')][_0xd373('0x41')]&&_0x39d4de['account'][_0xd373('0x41')]==='twilio'){_0x39d4de[_0xd373('0x5a')][_0xd373('0x8a')]=_0x2e8acd[_0xd373('0x5a')][_0xd373('0x8b')][_0xd373('0x8c')]('whatsapp:','');_0x39d4de[_0xd373('0x5a')][_0xd373('0x5a')]=_0x2e8acd[_0xd373('0x5a')]['Body'];_0x39d4de[_0xd373('0x5a')]['messageId']=_0x2e8acd['body'][_0xd373('0x8d')];}if(_0x39d4de[_0xd373('0x5a')]['id']){delete _0x39d4de[_0xd373('0x5a')]['id'];}if(_[_0xd373('0x8e')](_0x39d4de[_0xd373('0x5a')][_0xd373('0x8a')])){throw new db[(_0xd373('0x1d'))][(_0xd373('0x1e'))](_0xd373('0x8f'));}if(_[_0xd373('0x8e')](_0x39d4de[_0xd373('0x5a')]['body'])||_0x39d4de[_0xd373('0x5a')][_0xd373('0x5a')]===''){throw new db[(_0xd373('0x1d'))]['ValidationError'](_0xd373('0x90'));}if(_[_0xd373('0x8e')](_0x39d4de[_0xd373('0x5a')][_0xd373('0x91')])){throw new db[(_0xd373('0x1d'))][(_0xd373('0x1e'))](_0xd373('0x92')+_0x170502);}if(!_[_0xd373('0x93')](_0x170502,_0x39d4de[_0xd373('0x5a')]['mapKey'])){throw new db[(_0xd373('0x1d'))]['ValidationError'](_0xd373('0x94')+_0x170502);}_0x1e18a3[_0x39d4de['body'][_0xd373('0x91')]]=_0x39d4de[_0xd373('0x5a')]['from'];return db['CmList'][_0xd373('0x58')]({'where':{'id':_0x39d4de['account']['ListId']},'include':[{'model':db[_0xd373('0x84')],'as':'Contacts','where':_0x1e18a3,'limit':0x1,'order':[[_0xd373('0x95'),_0xd373('0x96')]]}]});})[_0xd373('0x36')](handleEntityNotFound(_0x5961e6,null))[_0xd373('0x36')](function(_0x1fe2e1){if(_0x1fe2e1){_0x39d4de['list']=_[_0xd373('0x70')](_0x1fe2e1,[_0xd373('0x97')]);if(_0x1fe2e1[_0xd373('0x97')][_0xd373('0x49')]){return _0x1fe2e1['Contacts'][0x0];}var _0xd93aba=_[_0xd373('0x98')](_0x39d4de[_0xd373('0x5a')],{'firstName':_0x39d4de[_0xd373('0x5a')][_0xd373('0x8a')],'ListId':_0x1fe2e1['id']});_0xd93aba[_0x39d4de[_0xd373('0x5a')][_0xd373('0x91')]]=_0x39d4de[_0xd373('0x5a')][_0xd373('0x8a')];return db[_0xd373('0x84')][_0xd373('0x59')](_0xd93aba,{'fields':_0x442774,'raw':!![]});}})[_0xd373('0x36')](handleEntityNotFound(_0x5961e6,null))[_0xd373('0x36')](function(_0x38dc69){if(_0x38dc69){_0x39d4de[_0xd373('0x99')]=_0x38dc69;var _0x48bd60={'ContactId':_0x38dc69['id'],'phone':_0x39d4de[_0xd373('0x5a')][_0xd373('0x8a')],'WhatsappAccountId':_0x2e8acd[_0xd373('0x57')]['id']};var _0x151771={'ContactId':_0x38dc69['id'],'WhatsappAccountId':_0x2e8acd[_0xd373('0x57')]['id'],'closed':![]};return db[_0xd373('0x9a')][_0xd373('0x58')]({'where':_0x151771})[_0xd373('0x36')](function(_0x3a0df2){if(_0x3a0df2){return[_0x3a0df2,![]];}return db[_0xd373('0x9a')][_0xd373('0x59')](_0x48bd60)[_0xd373('0x36')](function(_0x4dc083){return[_0x4dc083,!![]];});});}})[_0xd373('0x71')](function(_0xb70252,_0x49333f){_0x39d4de[_0xd373('0x9b')]=_0xb70252[_0xd373('0x38')]({'plain':!![]});_0x39d4de[_0xd373('0x9b')]['created']=![];if(_0x49333f){if(_0x39d4de[_0xd373('0x83')][_0xd373('0x9c')]){_0x39d4de[_0xd373('0x81')]['push']({'id':0x0,'priority':_0x39d4de[_0xd373('0x81')][_0xd373('0x49')]+0x1,'app':_0xd373('0x9d'),'appdata':_0xd373('0x9e'),'interval':'*,*,*,*'});}_0x39d4de[_0xd373('0x9b')][_0xd373('0x9f')]=!![];}return db[_0xd373('0xa0')][_0xd373('0x59')]({'phone':_0x39d4de[_0xd373('0x5a')][_0xd373('0x8a')],'messageId':_0x39d4de['body'][_0xd373('0xa1')],'body':_0x39d4de[_0xd373('0x5a')][_0xd373('0x5a')],'WhatsappAccountId':_0x2e8acd[_0xd373('0x57')]['id'],'WhatsappInteractionId':_0xb70252['id'],'direction':'in','ContactId':_0xb70252[_0xd373('0xa2')],'AttachmentId':_0x39d4de['body']['AttachmentId']});})[_0xd373('0x36')](function(_0x3bab9c){_0x39d4de['message']=_0x3bab9c;if(_0x39d4de[_0xd373('0x9b')][_0xd373('0xa3')]){return db[_0xd373('0x78')][_0xd373('0x58')]({'attributes':['id',_0xd373('0x42')],'where':{'id':_0x39d4de[_0xd373('0x9b')][_0xd373('0xa3')]}})[_0xd373('0x36')](function(_0x1bbf63){if(_0x1bbf63){_0x39d4de['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xd373('0xa4'),'appdata':_0x1bbf63[_0xd373('0x42')]+','+(_0x39d4de['account'][_0xd373('0xa5')]||0xa),'interval':_0xd373('0xa6')});}return respondWithRpcPromise(_0xd373('0xa7'),_0xd373('0xa8'),_0x39d4de);});}return respondWithRpcPromise(_0xd373('0xa7'),_0xd373('0xa8'),_0x39d4de);})['then'](function(_0x29029b){if(_0x29029b){var _0x42ee7c=0xc8;var _0x221a31=_0xd373('0xa9');logger[_0xd373('0x20')](_0xd373('0x24'),_0x221a31,_0x42ee7c,_0xd373('0xaa'));logger[_0xd373('0x23')](_0xd373('0xab'),_0x221a31,_0x42ee7c,_0xd373('0xaa'),JSON['stringify'](_0x29029b));if(_0x39d4de[_0xd373('0x83')][_0xd373('0x41')]===_0xd373('0xac')){return _0x5961e6[_0xd373('0x2c')](_0x42ee7c)[_0xd373('0x31')]('Content-Type',_0xd373('0xad'))[_0xd373('0xae')](_0xd373('0xaf'));}else{return _0x5961e6[_0xd373('0x2c')](_0x42ee7c)[_0xd373('0x2e')](_0x29029b);}}})[_0xd373('0x2a')](handleError(_0x5961e6,null));};exports[_0xd373('0xae')]=function(_0x23743f,_0x5d6c98,_0x13fe0c){var _0xe5660f,_0x8b94d9,_0x16126a;if(_['isNil'](_0x23743f[_0xd373('0x5a')][_0xd373('0x5a')])||_0x23743f['body'][_0xd373('0x5a')]===''){throw new db[(_0xd373('0x1d'))][(_0xd373('0x1e'))](_0xd373('0x90'));}if(_[_0xd373('0x8e')](_0x23743f[_0xd373('0x5a')]['to'])){throw new db['Sequelize'][(_0xd373('0x1e'))](_0xd373('0xb0'));}_0xe5660f=_0x23743f[_0xd373('0x5a')]['to'];return db[_0xd373('0x54')]['find']({'where':{'id':_0x23743f['params']['id']},'include':[{'model':db['CmList'],'as':_0xd373('0xb1'),'include':[{'model':db[_0xd373('0x84')],'as':_0xd373('0x97'),'where':{'mobile':_0xe5660f},'limit':0x1,'order':[['updatedAt',_0xd373('0x96')]]}]}]})[_0xd373('0x36')](handleEntityNotFound(_0x5d6c98,null))['then'](function(_0x471916){if(_0x471916&&_0x471916[_0xd373('0xb1')]){_0x8b94d9=_0x471916['get']({'plain':!![]});if(_0x8b94d9[_0xd373('0xb1')]&&_0x8b94d9[_0xd373('0xb1')][_0xd373('0x97')][_0xd373('0x49')]){return _0x8b94d9[_0xd373('0xb1')][_0xd373('0x97')][0x0];}return db[_0xd373('0x84')]['create'](_['defaults'](_0x23743f[_0xd373('0x5a')],{'firstName':_0xe5660f,'mobile':_0xe5660f,'phone':_0xe5660f,'ListId':_0x8b94d9['ListId']}));}})[_0xd373('0x36')](handleEntityNotFound(_0x5d6c98,null))['then'](function(_0x1a9169){if(_0x1a9169){_0x16126a=_0x1a9169;return db['WhatsappInteraction'][_0xd373('0x58')]({'where':{'ContactId':_0x16126a['id'],'closed':![],'WhatsappAccountId':_0x8b94d9['id']}})['then'](function(_0x8d4995){if(_0x8d4995){return[_0x8d4995,![]];}return db[_0xd373('0x9a')]['create']({'UserId':_0x23743f[_0xd373('0x5b')]['id'],'ContactId':_0x16126a['id'],'WhatsappAccountId':_0x8b94d9['id'],'phone':_0xe5660f,'firstMsgDirection':_0xd373('0xb2'),'Messages':[_['merge'](_0x23743f[_0xd373('0x5a')],{'read':![],'body':_0x23743f[_0xd373('0x5a')][_0xd373('0x5a')],'phone':_0xe5660f,'WhatsappAccountId':_0x8b94d9['id'],'UserId':_0x23743f[_0xd373('0x5b')]['id'],'ContactId':_0x16126a['id']})]},{'include':[{'model':db[_0xd373('0xa0')],'as':'Messages'}]})[_0xd373('0x36')](function(_0x5b8844){return[_0x5b8844,!![]];});});}})['spread'](function(_0x1851c7,_0x5b1887){if(_0x5b1887){return _0x1851c7;}return db['WhatsappMessage'][_0xd373('0x59')](_[_0xd373('0x51')](_0x23743f[_0xd373('0x5a')],{'read':![],'body':_0x23743f[_0xd373('0x5a')][_0xd373('0x5a')],'phone':_0xe5660f,'WhatsappAccountId':_0x8b94d9['id'],'WhatsappInteractionId':_0x1851c7['id'],'UserId':_0x23743f[_0xd373('0x5b')]['id'],'ContactId':_0x16126a['id']}))[_0xd373('0x36')](function(_0x1bd6f6){_0x1851c7[_0xd373('0xb3')]['Messages']=[];_0x1851c7['dataValues'][_0xd373('0xb4')]['push'](_0x1bd6f6[_0xd373('0xb3')]);return _0x1851c7;});})[_0xd373('0x36')](respondWithResult(_0x5d6c98,null))['catch'](handleError(_0x5d6c98,null));}; \ No newline at end of file +var _0x153f=['Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','filters','pick','where','merge','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','WhatsappAccountId','Disposition','getDispositions','order','removeDispositions','CannedAnswer','getAnswers','findOne','nolimit','removeAnswers','addAgents','ids','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','applications','orderBy','Applications','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','unshift','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','set','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','WhatsappMessage','dataValues','Messages','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','test'];(function(_0x45733e,_0x305175){var _0x15b259=function(_0xa1a12b){while(--_0xa1a12b){_0x45733e['push'](_0x45733e['shift']());}};_0x15b259(++_0x305175);}(_0x153f,0x15b));var _0xf153=function(_0x56434e,_0x31c145){_0x56434e=_0x56434e-0x0;var _0x1f1d5b=_0x153f[_0x56434e];return _0x1f1d5b;};'use strict';var pdf=require(_0xf153('0x0'));var emlformat=require(_0xf153('0x1'));var rimraf=require(_0xf153('0x2'));var zipdir=require(_0xf153('0x3'));var jsonpatch=require(_0xf153('0x4'));var rp=require(_0xf153('0x5'));var moment=require(_0xf153('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xf153('0x7'));var util=require('util');var path=require(_0xf153('0x8'));var sox=require(_0xf153('0x9'));var csv=require(_0xf153('0xa'));var ejs=require(_0xf153('0xb'));var fs=require('fs');var _=require(_0xf153('0xc'));var squel=require('squel');var crypto=require(_0xf153('0xd'));var jsforce=require(_0xf153('0xe'));var deskjs=require(_0xf153('0xf'));var toCsv=require(_0xf153('0xa'));var querystring=require(_0xf153('0x10'));var Papa=require(_0xf153('0x11'));var Redis=require(_0xf153('0x12'));var authService=require(_0xf153('0x13'));var qs=require(_0xf153('0x14'));var as=require(_0xf153('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf153('0x16'))(_0xf153('0x17'));var utils=require(_0xf153('0x18'));var config=require('../../config/environment');var db=require(_0xf153('0x19'))['db'];config[_0xf153('0x1a')]=_[_0xf153('0x1b')](config[_0xf153('0x1a')],{'host':_0xf153('0x1c'),'port':0x18eb});var socket=require(_0xf153('0x1d'))(new Redis(config[_0xf153('0x1a')]));require(_0xf153('0x1e'))[_0xf153('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf153('0x20')][_0xf153('0x21')]({'port':0x232c});function checkPasswordPattern(_0x2b666e,_0x406e6f,_0x3afea2){if(_0x3afea2){var _0x68f436=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x68f436[_0xf153('0x22')](_0x406e6f)){return _0x2b666e;}else{throw new db[(_0xf153('0x23'))]['ValidationError'](_0xf153('0x24'));}}else{return _0x2b666e;}}function respondWithRpcPromise(_0x564eeb,_0x37093a,_0x2c62b6,_0x138dbe){return new BPromise(function(_0x44272e,_0x4e790d){var _0x357d57=_0x138dbe||client;return _0x357d57[_0xf153('0x25')](_0x564eeb,_0x2c62b6)[_0xf153('0x26')](function(_0x14b83f){logger[_0xf153('0x27')](_0xf153('0x28'),_0x37093a,_0xf153('0x29'));logger[_0xf153('0x2a')](_0xf153('0x2b'),_0x37093a,_0xf153('0x29'),JSON[_0xf153('0x2c')](_0x14b83f));if(_0x14b83f[_0xf153('0x2d')]){if(_0x14b83f['error'][_0xf153('0x2e')]===0x1f4){logger[_0xf153('0x2d')](_0xf153('0x28'),_0x37093a,_0x14b83f[_0xf153('0x2d')][_0xf153('0x2f')]);return _0x4e790d(_0x14b83f[_0xf153('0x2d')][_0xf153('0x2f')]);}logger[_0xf153('0x2d')](_0xf153('0x28'),_0x37093a,_0x14b83f[_0xf153('0x2d')][_0xf153('0x2f')]);return _0x44272e(_0x14b83f[_0xf153('0x2d')][_0xf153('0x2f')]);}else{logger[_0xf153('0x27')](_0xf153('0x28'),_0x37093a,_0xf153('0x29'));_0x44272e(_0x14b83f[_0xf153('0x30')][_0xf153('0x2f')]);}})[_0xf153('0x31')](function(_0x17f7a4){logger['error'](_0xf153('0x28'),_0x37093a,_0x17f7a4);_0x4e790d(_0x17f7a4);});});}function respondWithStatusCode(_0x3f1c6f,_0x576788){_0x576788=_0x576788||0xcc;return function(_0x16cdcd){if(_0x16cdcd){return _0x3f1c6f[_0xf153('0x32')](_0x576788);}return _0x3f1c6f['status'](_0x576788)[_0xf153('0x33')]();};}function respondWithResult(_0x10295e,_0x261ac0){_0x261ac0=_0x261ac0||0xc8;return function(_0x2b9a9c){if(_0x2b9a9c){return _0x10295e[_0xf153('0x34')](_0x261ac0)[_0xf153('0x35')](_0x2b9a9c);}};}function respondWithFilteredResult(_0x441436,_0x3b5f4f){return function(_0x19a568){if(_0x19a568){var _0x8e31bf=_0x19a568[_0xf153('0x36')],_0x13b541=_0x3b5f4f[_0xf153('0x37')],_0x415a5f=_0x3b5f4f[_0xf153('0x37')]+_0x3b5f4f[_0xf153('0x38')],_0x5b5237;if(_0x415a5f>=_0x8e31bf){_0x415a5f=_0x8e31bf;_0x5b5237=0xc8;}else{_0x5b5237=0xce;}_0x441436['status'](_0x5b5237);return _0x441436['set'](_0xf153('0x39'),_0x13b541+'-'+_0x415a5f+'/'+_0x8e31bf)['json'](_0x19a568);}return null;};}function patchUpdates(_0x4bdd44){return function(_0x2473d0){try{jsonpatch['apply'](_0x2473d0,_0x4bdd44,!![]);}catch(_0x2b9623){return BPromise['reject'](_0x2b9623);}return _0x2473d0[_0xf153('0x3a')]();};}function saveUpdates(_0x10f461,_0x4bc442){return function(_0x7077dd){if(_0x7077dd){return _0x7077dd[_0xf153('0x3b')](_0x10f461)[_0xf153('0x26')](function(_0x40be52){return _0x40be52;});}return null;};}function removeEntity(_0x425a65,_0x220d31){return function(_0x4ab69c){if(_0x4ab69c){return _0x4ab69c[_0xf153('0x3c')]()['then'](function(){var _0x40834b=_0x4ab69c[_0xf153('0x3d')]({'plain':!![]});var _0x9b3f4c=_0xf153('0x3e');return db[_0xf153('0x3f')][_0xf153('0x3c')]({'where':{'type':_0x9b3f4c,'resourceId':_0x40834b['id']}})['then'](function(){return _0x4ab69c;});})[_0xf153('0x26')](function(){_0x425a65[_0xf153('0x34')](0xcc)[_0xf153('0x33')]();});}};}function handleEntityNotFound(_0x4e0634,_0x244172){return function(_0x17d60c){if(!_0x17d60c){_0x4e0634[_0xf153('0x32')](0x194);}return _0x17d60c;};}function handleError(_0x254692,_0x36c5cd){_0x36c5cd=_0x36c5cd||0x1f4;return function(_0x85f7cd){logger['error'](_0x85f7cd[_0xf153('0x40')]);if(_0x85f7cd[_0xf153('0x41')]){delete _0x85f7cd['name'];}_0x254692[_0xf153('0x34')](_0x36c5cd)[_0xf153('0x42')](_0x85f7cd);};}exports[_0xf153('0x43')]=function(_0x40e9f0,_0x103b91){var _0x42360a={'include':[{'model':db[_0xf153('0x44')],'as':_0xf153('0x45')}]},_0xef1510={},_0x4d90c1={'count':0x0,'rows':[]};var _0x150ce4=_[_0xf153('0x46')](db[_0xf153('0x47')][_0xf153('0x48')],function(_0x485c52){return{'name':_0x485c52['fieldName'],'type':_0x485c52[_0xf153('0x49')]['key']};});_0xef1510[_0xf153('0x4a')]=_[_0xf153('0x46')](_0x150ce4,_0xf153('0x41'));_0xef1510[_0xf153('0x4b')]=_[_0xf153('0x4c')](_0x40e9f0[_0xf153('0x4b')]);_0xef1510['filters']=_['intersection'](_0xef1510[_0xf153('0x4a')],_0xef1510[_0xf153('0x4b')]);_0x42360a['attributes']=_[_0xf153('0x4d')](_0xef1510[_0xf153('0x4a')],qs[_0xf153('0x4e')](_0x40e9f0[_0xf153('0x4b')][_0xf153('0x4e')]));_0x42360a[_0xf153('0x4f')]=_0x42360a[_0xf153('0x4f')][_0xf153('0x50')]?_0x42360a[_0xf153('0x4f')]:_0xef1510[_0xf153('0x4a')];if(!_0x40e9f0[_0xf153('0x4b')][_0xf153('0x51')]('nolimit')){_0x42360a[_0xf153('0x38')]=qs[_0xf153('0x38')](_0x40e9f0[_0xf153('0x4b')]['limit']);_0x42360a[_0xf153('0x37')]=qs[_0xf153('0x37')](_0x40e9f0['query'][_0xf153('0x37')]);}_0x42360a['order']=qs[_0xf153('0x52')](_0x40e9f0[_0xf153('0x4b')][_0xf153('0x52')]);_0x42360a['where']=qs[_0xf153('0x53')](_[_0xf153('0x54')](_0x40e9f0[_0xf153('0x4b')],_0xef1510[_0xf153('0x53')]),_0x150ce4);if(_0x40e9f0[_0xf153('0x4b')]['filter']){_0x42360a[_0xf153('0x55')]=_[_0xf153('0x56')](_0x42360a['where'],{'$or':_[_0xf153('0x46')](_0x150ce4,function(_0x100ce6){if(_0x100ce6[_0xf153('0x49')]!=='VIRTUAL'){var _0x657403={};_0x657403[_0x100ce6[_0xf153('0x41')]]={'$like':'%'+_0x40e9f0[_0xf153('0x4b')][_0xf153('0x57')]+'%'};return _0x657403;}})});}_0x42360a=_[_0xf153('0x56')]({},_0x42360a,_0x40e9f0[_0xf153('0x58')]);var _0x2a094f={'where':_0x42360a[_0xf153('0x55')]};return db[_0xf153('0x47')]['count'](_0x2a094f)[_0xf153('0x26')](function(_0x5540a0){_0x4d90c1['count']=_0x5540a0;if(_0x40e9f0['query'][_0xf153('0x59')]){_0x42360a[_0xf153('0x5a')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xf153('0x5b')](_0x42360a);})[_0xf153('0x26')](function(_0x557d1e){_0x4d90c1[_0xf153('0x5c')]=_0x557d1e;return _0x4d90c1;})[_0xf153('0x26')](respondWithFilteredResult(_0x103b91,_0x42360a))[_0xf153('0x31')](handleError(_0x103b91,null));};exports[_0xf153('0x5d')]=function(_0x3964db,_0x3ab27a){var _0x488baa={'raw':![],'where':{'id':_0x3964db[_0xf153('0x5e')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x19334e={};_0x19334e[_0xf153('0x4a')]=_[_0xf153('0x4c')](db[_0xf153('0x47')][_0xf153('0x48')]);_0x19334e[_0xf153('0x4b')]=_[_0xf153('0x4c')](_0x3964db['query']);_0x19334e[_0xf153('0x53')]=_['intersection'](_0x19334e[_0xf153('0x4a')],_0x19334e[_0xf153('0x4b')]);_0x488baa[_0xf153('0x4f')]=_['intersection'](_0x19334e[_0xf153('0x4a')],qs[_0xf153('0x4e')](_0x3964db[_0xf153('0x4b')][_0xf153('0x4e')]));_0x488baa[_0xf153('0x4f')]=_0x488baa[_0xf153('0x4f')][_0xf153('0x50')]?_0x488baa['attributes']:_0x19334e[_0xf153('0x4a')];if(_0x3964db[_0xf153('0x4b')][_0xf153('0x59')]){_0x488baa['include']=[{'all':!![]}];}_0x488baa=_[_0xf153('0x56')]({},_0x488baa,_0x3964db[_0xf153('0x58')]);return db[_0xf153('0x47')][_0xf153('0x5f')](_0x488baa)[_0xf153('0x26')](handleEntityNotFound(_0x3ab27a,null))[_0xf153('0x26')](respondWithResult(_0x3ab27a,null))[_0xf153('0x31')](handleError(_0x3ab27a,null));};exports[_0xf153('0x60')]=function(_0x4e1e51,_0x308b5f){return db[_0xf153('0x47')]['create'](_0x4e1e51[_0xf153('0x61')],{})[_0xf153('0x26')](function(_0x2e95f4){var _0xce9a19=_0x4e1e51[_0xf153('0x62')][_0xf153('0x3d')]({'plain':!![]});if(!_0xce9a19)throw new Error(_0xf153('0x63'));if(_0xce9a19[_0xf153('0x64')]===_0xf153('0x62')){var _0x133b2a=_0x2e95f4[_0xf153('0x3d')]({'plain':!![]});var _0x5aea57=_0xf153('0x3e');return db[_0xf153('0x65')]['find']({'where':{'name':_0x5aea57,'userProfileId':_0xce9a19[_0xf153('0x66')]},'raw':!![]})[_0xf153('0x26')](function(_0x249cd6){if(_0x249cd6&&_0x249cd6[_0xf153('0x67')]===0x0){return db[_0xf153('0x3f')][_0xf153('0x60')]({'name':_0x133b2a[_0xf153('0x41')],'resourceId':_0x133b2a['id'],'type':_0x249cd6['name'],'sectionId':_0x249cd6['id']},{})[_0xf153('0x26')](function(){return _0x2e95f4;});}else{return _0x2e95f4;}})[_0xf153('0x31')](function(_0x2deabc){logger[_0xf153('0x2d')](_0xf153('0x68'),_0x2deabc);throw _0x2deabc;});}return _0x2e95f4;})[_0xf153('0x26')](respondWithResult(_0x308b5f,0xc9))[_0xf153('0x31')](handleError(_0x308b5f,null));};exports[_0xf153('0x3b')]=function(_0x437083,_0x4c9157){if(_0x437083[_0xf153('0x61')]['id']){delete _0x437083[_0xf153('0x61')]['id'];}return db['WhatsappAccount'][_0xf153('0x5f')]({'where':{'id':_0x437083['params']['id']},'include':[{'model':db[_0xf153('0x44')],'as':_0xf153('0x45')}]})['then'](handleEntityNotFound(_0x4c9157,null))[_0xf153('0x26')](saveUpdates(_0x437083['body'],null))[_0xf153('0x26')](respondWithResult(_0x4c9157,null))[_0xf153('0x31')](handleError(_0x4c9157,null));};exports[_0xf153('0x3c')]=function(_0x1c2e33,_0x4ad773){return db[_0xf153('0x47')][_0xf153('0x5f')]({'where':{'id':_0x1c2e33['params']['id']}})[_0xf153('0x26')](handleEntityNotFound(_0x4ad773,null))[_0xf153('0x26')](removeEntity(_0x4ad773,null))[_0xf153('0x31')](handleError(_0x4ad773,null));};exports[_0xf153('0x69')]=function(_0x1e19f4,_0x55f7c1){return db[_0xf153('0x47')]['describe']()[_0xf153('0x26')](respondWithResult(_0x55f7c1,null))[_0xf153('0x31')](handleError(_0x55f7c1,null));};exports['addDisposition']=function(_0x4d87ec,_0x122590,_0xc6fb6e){if(_0x4d87ec['body']['id']){delete _0x4d87ec[_0xf153('0x61')]['id'];}return db[_0xf153('0x47')][_0xf153('0x5f')]({'where':{'id':_0x4d87ec['params']['id']}})[_0xf153('0x26')](handleEntityNotFound(_0x122590,null))[_0xf153('0x26')](function(_0x3b87e7){if(_0x3b87e7){_0x4d87ec[_0xf153('0x61')][_0xf153('0x6a')]=_0x3b87e7['id'];return db[_0xf153('0x6b')][_0xf153('0x60')](_0x4d87ec[_0xf153('0x61')]);}})[_0xf153('0x26')](respondWithResult(_0x122590,null))[_0xf153('0x31')](handleError(_0x122590,null));};exports[_0xf153('0x6c')]=function(_0x2c810b,_0x21202e,_0x570128){var _0x36ba4d={'raw':![],'where':{}};var _0x2c08a8={};var _0x51398a={'count':0x0,'rows':[]};return db[_0xf153('0x47')]['findOne']({'where':{'id':_0x2c810b['params']['id']}})[_0xf153('0x26')](handleEntityNotFound(_0x21202e,null))['then'](function(_0xbc1d08){if(_0xbc1d08){_0x2c08a8[_0xf153('0x4a')]=_[_0xf153('0x4c')](db[_0xf153('0x6b')][_0xf153('0x48')]);_0x2c08a8[_0xf153('0x4b')]=_['keys'](_0x2c810b[_0xf153('0x4b')]);_0x2c08a8[_0xf153('0x53')]=_[_0xf153('0x4d')](_0x2c08a8['model'],_0x2c08a8['query']);_0x36ba4d[_0xf153('0x4f')]=_[_0xf153('0x4d')](_0x2c08a8[_0xf153('0x4a')],qs['fields'](_0x2c810b[_0xf153('0x4b')]['fields']));_0x36ba4d['attributes']=_0x36ba4d[_0xf153('0x4f')][_0xf153('0x50')]?_0x36ba4d[_0xf153('0x4f')]:_0x2c08a8['model'];if(!_0x2c810b[_0xf153('0x4b')][_0xf153('0x51')]('nolimit')){_0x36ba4d[_0xf153('0x38')]=qs[_0xf153('0x38')](_0x2c810b[_0xf153('0x4b')][_0xf153('0x38')]);_0x36ba4d[_0xf153('0x37')]=qs['offset'](_0x2c810b[_0xf153('0x4b')][_0xf153('0x37')]);}_0x36ba4d[_0xf153('0x6d')]=qs[_0xf153('0x52')](_0x2c810b[_0xf153('0x4b')][_0xf153('0x52')]);_0x36ba4d[_0xf153('0x55')]=qs['filters'](_[_0xf153('0x54')](_0x2c810b[_0xf153('0x4b')],_0x2c08a8[_0xf153('0x53')]));_0x36ba4d[_0xf153('0x55')][_0xf153('0x6a')]=_0xbc1d08['id'];if(_0x2c810b[_0xf153('0x4b')]['filter']){_0x36ba4d[_0xf153('0x55')]=_[_0xf153('0x56')](_0x36ba4d[_0xf153('0x55')],{'$or':_[_0xf153('0x46')](_0x36ba4d[_0xf153('0x4f')],function(_0x20db97){var _0x27f79a={};_0x27f79a[_0x20db97]={'$like':'%'+_0x2c810b[_0xf153('0x4b')][_0xf153('0x57')]+'%'};return _0x27f79a;})});}_0x36ba4d=_[_0xf153('0x56')]({},_0x36ba4d,_0x2c810b['options']);return db['Disposition']['count']({'where':_0x36ba4d['where']})[_0xf153('0x26')](function(_0x43aa7f){_0x51398a[_0xf153('0x36')]=_0x43aa7f;if(_0x2c810b[_0xf153('0x4b')][_0xf153('0x59')]){_0x36ba4d['include']=[{'all':!![]}];}return db[_0xf153('0x6b')][_0xf153('0x5b')](_0x36ba4d);})[_0xf153('0x26')](function(_0x974b36){_0x51398a['rows']=_0x974b36;return _0x51398a;});}})[_0xf153('0x26')](respondWithFilteredResult(_0x21202e,_0x36ba4d))[_0xf153('0x31')](handleError(_0x21202e,null));};exports[_0xf153('0x6e')]=function(_0x4a5f54,_0x38ceb8,_0x4dbf1b){return db[_0xf153('0x47')][_0xf153('0x5f')]({'where':{'id':_0x4a5f54[_0xf153('0x5e')]['id']}})['then'](handleEntityNotFound(_0x38ceb8,null))['then'](function(_0x5e88aa){if(_0x5e88aa){return _0x5e88aa[_0xf153('0x6e')](_0x4a5f54[_0xf153('0x4b')]['ids']);}})['then'](respondWithStatusCode(_0x38ceb8,null))[_0xf153('0x31')](handleError(_0x38ceb8,null));};exports['addAnswer']=function(_0x3b01cd,_0x57ece2,_0xb3632c){if(_0x3b01cd[_0xf153('0x61')]['id']){delete _0x3b01cd[_0xf153('0x61')]['id'];}return db[_0xf153('0x47')][_0xf153('0x5f')]({'where':{'id':_0x3b01cd[_0xf153('0x5e')]['id']}})['then'](handleEntityNotFound(_0x57ece2,null))[_0xf153('0x26')](function(_0x33cd1a){if(_0x33cd1a){_0x3b01cd['body'][_0xf153('0x6a')]=_0x33cd1a['id'];return db[_0xf153('0x6f')][_0xf153('0x60')](_0x3b01cd[_0xf153('0x61')]);}})['then'](respondWithResult(_0x57ece2,null))[_0xf153('0x31')](handleError(_0x57ece2,null));};exports[_0xf153('0x70')]=function(_0x4f0e7e,_0x105e33,_0x1c521c){var _0x1b5b64={'raw':![],'where':{}};var _0x11d650={};var _0x512568={'count':0x0,'rows':[]};return db[_0xf153('0x47')][_0xf153('0x71')]({'where':{'id':_0x4f0e7e[_0xf153('0x5e')]['id']}})[_0xf153('0x26')](handleEntityNotFound(_0x105e33,null))[_0xf153('0x26')](function(_0x39d8fd){if(_0x39d8fd){_0x11d650[_0xf153('0x4a')]=_[_0xf153('0x4c')](db[_0xf153('0x6f')]['rawAttributes']);_0x11d650[_0xf153('0x4b')]=_[_0xf153('0x4c')](_0x4f0e7e[_0xf153('0x4b')]);_0x11d650['filters']=_['intersection'](_0x11d650[_0xf153('0x4a')],_0x11d650['query']);_0x1b5b64[_0xf153('0x4f')]=_[_0xf153('0x4d')](_0x11d650[_0xf153('0x4a')],qs['fields'](_0x4f0e7e['query'][_0xf153('0x4e')]));_0x1b5b64[_0xf153('0x4f')]=_0x1b5b64[_0xf153('0x4f')]['length']?_0x1b5b64[_0xf153('0x4f')]:_0x11d650[_0xf153('0x4a')];if(!_0x4f0e7e[_0xf153('0x4b')][_0xf153('0x51')](_0xf153('0x72'))){_0x1b5b64[_0xf153('0x38')]=qs[_0xf153('0x38')](_0x4f0e7e[_0xf153('0x4b')][_0xf153('0x38')]);_0x1b5b64[_0xf153('0x37')]=qs[_0xf153('0x37')](_0x4f0e7e[_0xf153('0x4b')][_0xf153('0x37')]);}_0x1b5b64['order']=qs[_0xf153('0x52')](_0x4f0e7e[_0xf153('0x4b')][_0xf153('0x52')]);_0x1b5b64['where']=qs['filters'](_[_0xf153('0x54')](_0x4f0e7e['query'],_0x11d650[_0xf153('0x53')]));_0x1b5b64[_0xf153('0x55')]['WhatsappAccountId']=_0x39d8fd['id'];if(_0x4f0e7e[_0xf153('0x4b')][_0xf153('0x57')]){_0x1b5b64[_0xf153('0x55')]=_[_0xf153('0x56')](_0x1b5b64[_0xf153('0x55')],{'$or':_[_0xf153('0x46')](_0x1b5b64[_0xf153('0x4f')],function(_0x42fcc8){var _0x4b416d={};_0x4b416d[_0x42fcc8]={'$like':'%'+_0x4f0e7e[_0xf153('0x4b')][_0xf153('0x57')]+'%'};return _0x4b416d;})});}_0x1b5b64=_['merge']({},_0x1b5b64,_0x4f0e7e['options']);return db[_0xf153('0x6f')]['count']({'where':_0x1b5b64['where']})[_0xf153('0x26')](function(_0x9298bc){_0x512568['count']=_0x9298bc;if(_0x4f0e7e[_0xf153('0x4b')][_0xf153('0x59')]){_0x1b5b64[_0xf153('0x5a')]=[{'all':!![]}];}return db[_0xf153('0x6f')][_0xf153('0x5b')](_0x1b5b64);})[_0xf153('0x26')](function(_0x2ddb7d){_0x512568[_0xf153('0x5c')]=_0x2ddb7d;return _0x512568;});}})[_0xf153('0x26')](respondWithFilteredResult(_0x105e33,_0x1b5b64))['catch'](handleError(_0x105e33,null));};exports[_0xf153('0x73')]=function(_0x5e3042,_0x2f3419,_0x5e9a0c){return db[_0xf153('0x47')]['find']({'where':{'id':_0x5e3042['params']['id']}})[_0xf153('0x26')](handleEntityNotFound(_0x2f3419,null))['then'](function(_0x24a097){if(_0x24a097){return _0x24a097[_0xf153('0x73')](_0x5e3042['query']['ids']);}})[_0xf153('0x26')](respondWithStatusCode(_0x2f3419,null))[_0xf153('0x31')](handleError(_0x2f3419,null));};exports[_0xf153('0x74')]=function(_0x5d8bbb,_0xa4e3fb,_0x360931){return db[_0xf153('0x47')][_0xf153('0x5f')]({'where':{'id':_0x5d8bbb['params']['id']}})[_0xf153('0x26')](handleEntityNotFound(_0xa4e3fb,null))[_0xf153('0x26')](function(_0x67b37a){if(_0x67b37a){return _0x67b37a[_0xf153('0x74')](_0x5d8bbb[_0xf153('0x61')][_0xf153('0x75')],_[_0xf153('0x76')](_0x5d8bbb[_0xf153('0x61')],[_0xf153('0x75'),'id'])||{})[_0xf153('0x77')](function(_0x3eef78){for(var _0x1875d4=0x0;_0x1875d4<_0x5d8bbb['body'][_0xf153('0x75')][_0xf153('0x50')];_0x1875d4+=0x1){socket['emit'](_0xf153('0x78'),{'UserId':_0x5d8bbb[_0xf153('0x61')][_0xf153('0x75')][_0x1875d4],'WhatsappAccountId':_0x5d8bbb[_0xf153('0x5e')]['id']});}return _0x3eef78;});}})[_0xf153('0x26')](respondWithResult(_0xa4e3fb,null))['catch'](handleError(_0xa4e3fb,null));};exports[_0xf153('0x79')]=function(_0xa13662,_0x459fe9,_0xf711b2){return db[_0xf153('0x47')][_0xf153('0x5f')]({'where':{'id':_0xa13662[_0xf153('0x5e')]['id']}})[_0xf153('0x26')](handleEntityNotFound(_0x459fe9,null))[_0xf153('0x26')](function(_0x3f7938){if(_0x3f7938){return _0x3f7938[_0xf153('0x79')](_0xa13662[_0xf153('0x4b')][_0xf153('0x75')])[_0xf153('0x26')](function(){if(_[_0xf153('0x7a')](_0xa13662['query'][_0xf153('0x75')])){for(var _0x24ad4d=0x0;_0x24ad4d<_0xa13662[_0xf153('0x4b')][_0xf153('0x75')][_0xf153('0x50')];_0x24ad4d+=0x1){socket[_0xf153('0x7b')](_0xf153('0x7c'),{'UserId':Number(_0xa13662[_0xf153('0x4b')]['ids'][_0x24ad4d]),'WhatsappAccountId':Number(_0xa13662[_0xf153('0x5e')]['id'])});}}else{socket[_0xf153('0x7b')](_0xf153('0x7c'),{'UserId':Number(_0xa13662[_0xf153('0x4b')][_0xf153('0x75')]),'WhatsappAccountId':Number(_0xa13662['params']['id'])});}});}})[_0xf153('0x26')](respondWithStatusCode(_0x459fe9,null))[_0xf153('0x31')](handleError(_0x459fe9,null));};exports[_0xf153('0x7d')]=function(_0xc60a93,_0x5d27bc,_0x4e39d0){var _0x13ba6f={};var _0x157aa8={};var _0x4adced;var _0x52b99f;return db[_0xf153('0x47')][_0xf153('0x71')]({'where':{'id':_0xc60a93[_0xf153('0x5e')]['id']}})[_0xf153('0x26')](handleEntityNotFound(_0x5d27bc,null))[_0xf153('0x26')](function(_0x26e672){if(_0x26e672){_0x4adced=_0x26e672;_0x157aa8[_0xf153('0x4a')]=_[_0xf153('0x4c')](db[_0xf153('0x7e')]['rawAttributes']);_0x157aa8[_0xf153('0x4b')]=_[_0xf153('0x4c')](_0xc60a93['query']);_0x157aa8[_0xf153('0x53')]=_[_0xf153('0x4d')](_0x157aa8[_0xf153('0x4a')],_0x157aa8[_0xf153('0x4b')]);_0x13ba6f['attributes']=_['intersection'](_0x157aa8[_0xf153('0x4a')],qs[_0xf153('0x4e')](_0xc60a93[_0xf153('0x4b')]['fields']));_0x13ba6f[_0xf153('0x4f')]=_0x13ba6f[_0xf153('0x4f')][_0xf153('0x50')]?_0x13ba6f[_0xf153('0x4f')]:_0x157aa8[_0xf153('0x4a')];_0x13ba6f[_0xf153('0x6d')]=qs[_0xf153('0x52')](_0xc60a93['query'][_0xf153('0x52')]);_0x13ba6f[_0xf153('0x55')]=qs[_0xf153('0x53')](_[_0xf153('0x54')](_0xc60a93[_0xf153('0x4b')],_0x157aa8[_0xf153('0x53')]));if(_0xc60a93[_0xf153('0x4b')][_0xf153('0x57')]){_0x13ba6f[_0xf153('0x55')]=_['merge'](_0x13ba6f[_0xf153('0x55')],{'$or':_[_0xf153('0x46')](_0x13ba6f[_0xf153('0x4f')],function(_0x374ba4){var _0x1b4f50={};_0x1b4f50[_0x374ba4]={'$like':'%'+_0xc60a93[_0xf153('0x4b')]['filter']+'%'};return _0x1b4f50;})});}_0x13ba6f=_[_0xf153('0x56')]({},_0x13ba6f,_0xc60a93[_0xf153('0x58')]);return _0x4adced[_0xf153('0x7d')](_0x13ba6f);}})[_0xf153('0x26')](function(_0x4bfc01){if(_0x4bfc01){_0x52b99f=_0x4bfc01[_0xf153('0x50')];if(!_0xc60a93[_0xf153('0x4b')][_0xf153('0x51')](_0xf153('0x72'))){_0x13ba6f[_0xf153('0x38')]=qs['limit'](_0xc60a93[_0xf153('0x4b')][_0xf153('0x38')]);_0x13ba6f['offset']=qs[_0xf153('0x37')](_0xc60a93['query'][_0xf153('0x37')]);}return _0x4adced[_0xf153('0x7d')](_0x13ba6f);}})[_0xf153('0x26')](function(_0x2bd3a0){if(_0x2bd3a0){return _0x2bd3a0?{'count':_0x52b99f,'rows':_0x2bd3a0}:null;}})['then'](respondWithResult(_0x5d27bc,null))[_0xf153('0x31')](handleError(_0x5d27bc,null));};exports[_0xf153('0x7f')]=function(_0x4d7e1e,_0xa1c6d6,_0x4a592e){return db[_0xf153('0x47')][_0xf153('0x71')]({'where':{'id':_0x4d7e1e['params']['id']}})['then'](handleEntityNotFound(_0xa1c6d6,null))['then'](function(_0x40de54){if(_0x40de54){return db[_0xf153('0x80')]['transaction'](function(_0x129df3){return db[_0xf153('0x81')]['destroy']({'where':{'WhatsappAccountId':_0x4d7e1e['params']['id']},'transaction':_0x129df3})[_0xf153('0x26')](function(_0x15045a){var _0x32971d=_[_0xf153('0x46')](_0x4d7e1e[_0xf153('0x61')],function(_0x32eb9a){_0x32eb9a[_0xf153('0x6a')]=_0x4d7e1e[_0xf153('0x5e')]['id'];return _0x32eb9a;});return db[_0xf153('0x81')][_0xf153('0x82')](_0x32971d,{'transaction':_0x129df3});});})['then'](function(){return db[_0xf153('0x81')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x4d7e1e['params']['id']},'order':_0xf153('0x83')});});}})[_0xf153('0x26')](respondWithResult(_0xa1c6d6,null))[_0xf153('0x31')](handleError(_0xa1c6d6,null));};exports[_0xf153('0x84')]=function(_0x5d4e3e,_0x2c6a39,_0x50fd44){var _0x44d18a={};var _0x19c044={};var _0x160df9;var _0x4c00a8;return db[_0xf153('0x47')][_0xf153('0x71')]({'where':{'id':_0x5d4e3e['params']['id']}})[_0xf153('0x26')](handleEntityNotFound(_0x2c6a39,null))['then'](function(_0x2d8c95){if(_0x2d8c95){_0x160df9=_0x2d8c95;_0x19c044[_0xf153('0x4a')]=_[_0xf153('0x4c')](db['WhatsappApplication']['rawAttributes']);_0x19c044[_0xf153('0x4b')]=_['keys'](_0x5d4e3e[_0xf153('0x4b')]);_0x19c044[_0xf153('0x53')]=_[_0xf153('0x4d')](_0x19c044[_0xf153('0x4a')],_0x19c044[_0xf153('0x4b')]);_0x44d18a[_0xf153('0x4f')]=_[_0xf153('0x4d')](_0x19c044[_0xf153('0x4a')],qs[_0xf153('0x4e')](_0x5d4e3e[_0xf153('0x4b')][_0xf153('0x4e')]));_0x44d18a[_0xf153('0x4f')]=_0x44d18a[_0xf153('0x4f')][_0xf153('0x50')]?_0x44d18a[_0xf153('0x4f')]:_0x19c044[_0xf153('0x4a')];_0x44d18a[_0xf153('0x6d')]=qs['sort'](_0x5d4e3e[_0xf153('0x4b')][_0xf153('0x52')]);_0x44d18a[_0xf153('0x55')]=qs['filters'](_[_0xf153('0x54')](_0x5d4e3e[_0xf153('0x4b')],_0x19c044[_0xf153('0x53')]));if(_0x5d4e3e['query'][_0xf153('0x57')]){_0x44d18a[_0xf153('0x55')]=_[_0xf153('0x56')](_0x44d18a[_0xf153('0x55')],{'$or':_[_0xf153('0x46')](_0x44d18a['attributes'],function(_0x446c06){var _0x597859={};_0x597859[_0x446c06]={'$like':'%'+_0x5d4e3e[_0xf153('0x4b')]['filter']+'%'};return _0x597859;})});}_0x44d18a=_['merge']({},_0x44d18a,_0x5d4e3e['options']);return _0x160df9[_0xf153('0x84')](_0x44d18a);}})['then'](function(_0x1fc87f){if(_0x1fc87f){_0x4c00a8=_0x1fc87f['length'];if(!_0x5d4e3e[_0xf153('0x4b')][_0xf153('0x51')](_0xf153('0x72'))){_0x44d18a[_0xf153('0x38')]=qs['limit'](_0x5d4e3e[_0xf153('0x4b')][_0xf153('0x38')]);_0x44d18a['offset']=qs[_0xf153('0x37')](_0x5d4e3e[_0xf153('0x4b')][_0xf153('0x37')]);}return _0x160df9[_0xf153('0x84')](_0x44d18a);}})[_0xf153('0x26')](function(_0x5827d1){if(_0x5827d1){return _0x5827d1?{'count':_0x4c00a8,'rows':_0x5827d1}:null;}})[_0xf153('0x26')](respondWithResult(_0x2c6a39,null))['catch'](handleError(_0x2c6a39,null));};exports[_0xf153('0x85')]=function(_0x25dbd1,_0x1cccfe,_0x6dbb0e){var _0x114cd8={'channel':_0xf153('0x86')};var _0x41ef70=[];var _0x4e8393=[];var _0x40a066={};return db[_0xf153('0x47')][_0xf153('0x5f')]({'where':{'id':_0x25dbd1[_0xf153('0x5e')]['id']},'include':[{'model':db[_0xf153('0x81')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x1cccfe,null))[_0xf153('0x26')](function(_0x8595b){_0x114cd8['account']=_0x8595b;_0x114cd8[_0xf153('0x87')]=_[_0xf153('0x88')](_0x8595b[_0xf153('0x89')],['priority'],['asc']);if(_0x114cd8[_0xf153('0x8a')][_0xf153('0x89')]){delete _0x114cd8[_0xf153('0x8a')]['Applications'];}return db[_0xf153('0x8b')][_0xf153('0x69')]();})[_0xf153('0x26')](function(_0x130311){if(!_0x130311){throw new db[(_0xf153('0x23'))][(_0xf153('0x8c'))](_0xf153('0x8d'));}_0x41ef70=_[_0xf153('0x8e')](_[_0xf153('0x4c')](_0x130311),[_0xf153('0x8f'),_0xf153('0x90')]);_0x4e8393=_[_0xf153('0x8e')](_[_0xf153('0x4c')](_0x130311),[_0xf153('0x8f'),_0xf153('0x90'),_0xf153('0x91'),_0xf153('0x92')]);_0x114cd8[_0xf153('0x61')]={'mapKey':'mobile'};if(_0x114cd8[_0xf153('0x8a')]['type']&&_0x114cd8[_0xf153('0x8a')][_0xf153('0x49')]==='twilio'){_0x114cd8['body']['from']=_0x25dbd1[_0xf153('0x61')][_0xf153('0x93')][_0xf153('0x94')](_0xf153('0x95'),'');_0x114cd8['body'][_0xf153('0x61')]=_0x25dbd1[_0xf153('0x61')][_0xf153('0x96')];_0x114cd8[_0xf153('0x61')][_0xf153('0x97')]=_0x25dbd1[_0xf153('0x61')][_0xf153('0x98')];}if(_0x114cd8[_0xf153('0x61')]['id']){delete _0x114cd8['body']['id'];}if(_[_0xf153('0x99')](_0x114cd8[_0xf153('0x61')]['from'])){throw new db['Sequelize'][(_0xf153('0x8c'))](_0xf153('0x9a'));}if(_['isNil'](_0x114cd8[_0xf153('0x61')]['body'])||_0x114cd8[_0xf153('0x61')][_0xf153('0x61')]===''){throw new db[(_0xf153('0x23'))][(_0xf153('0x8c'))](_0xf153('0x9b'));}if(_['isNil'](_0x114cd8[_0xf153('0x61')]['mapKey'])){throw new db['Sequelize'][(_0xf153('0x8c'))](_0xf153('0x9c')+_0x4e8393);}if(!_[_0xf153('0x9d')](_0x4e8393,_0x114cd8[_0xf153('0x61')]['mapKey'])){throw new db[(_0xf153('0x23'))][(_0xf153('0x8c'))](_0xf153('0x9e')+_0x4e8393);}_0x40a066[_0x114cd8[_0xf153('0x61')][_0xf153('0x9f')]]=_0x114cd8[_0xf153('0x61')][_0xf153('0xa0')];return db[_0xf153('0xa1')]['find']({'where':{'id':_0x114cd8[_0xf153('0x8a')][_0xf153('0x92')]},'include':[{'model':db[_0xf153('0x8b')],'as':_0xf153('0xa2'),'where':_0x40a066,'limit':0x1,'order':[[_0xf153('0x90'),_0xf153('0xa3')]]}]});})[_0xf153('0x26')](handleEntityNotFound(_0x1cccfe,null))[_0xf153('0x26')](function(_0x3b2cc6){if(_0x3b2cc6){_0x114cd8[_0xf153('0xa4')]=_[_0xf153('0x76')](_0x3b2cc6,[_0xf153('0xa2')]);if(_0x3b2cc6['Contacts'][_0xf153('0x50')]){return _0x3b2cc6[_0xf153('0xa2')][0x0];}var _0x4e863a=_[_0xf153('0x1b')](_0x114cd8[_0xf153('0x61')],{'firstName':_0x114cd8[_0xf153('0x61')][_0xf153('0xa0')],'ListId':_0x3b2cc6['id']});_0x4e863a[_0x114cd8[_0xf153('0x61')][_0xf153('0x9f')]]=_0x114cd8[_0xf153('0x61')]['from'];return db[_0xf153('0x8b')][_0xf153('0x60')](_0x4e863a,{'fields':_0x41ef70,'raw':!![]});}})[_0xf153('0x26')](handleEntityNotFound(_0x1cccfe,null))[_0xf153('0x26')](function(_0x47ef42){if(_0x47ef42){_0x114cd8[_0xf153('0xa5')]=_0x47ef42;var _0x2564dc={'ContactId':_0x47ef42['id'],'phone':_0x114cd8['body'][_0xf153('0xa0')],'WhatsappAccountId':_0x25dbd1['params']['id']};var _0x2433e1={'ContactId':_0x47ef42['id'],'WhatsappAccountId':_0x25dbd1['params']['id'],'closed':![]};return db[_0xf153('0xa6')][_0xf153('0x5f')]({'where':_0x2433e1})[_0xf153('0x26')](function(_0x10dc5e){if(_0x10dc5e){return[_0x10dc5e,![]];}return db['WhatsappInteraction'][_0xf153('0x60')](_0x2564dc)['then'](function(_0x21285e){return[_0x21285e,!![]];});});}})[_0xf153('0x77')](function(_0x1b033e,_0x10fbfc){_0x114cd8[_0xf153('0xa7')]=_0x1b033e[_0xf153('0x3d')]({'plain':!![]});_0x114cd8['interaction'][_0xf153('0xa8')]=![];if(_0x10fbfc){if(_0x114cd8['account'][_0xf153('0xa9')]){_0x114cd8['applications'][_0xf153('0xaa')]({'id':0x0,'priority':_0x114cd8[_0xf153('0x87')][_0xf153('0x50')]+0x1,'app':_0xf153('0xab'),'appdata':'unmanaged','interval':_0xf153('0xac')});}_0x114cd8['interaction'][_0xf153('0xa8')]=!![];}return db['WhatsappMessage'][_0xf153('0x60')]({'phone':_0x114cd8[_0xf153('0x61')][_0xf153('0xa0')],'messageId':_0x114cd8[_0xf153('0x61')][_0xf153('0x97')],'body':_0x114cd8[_0xf153('0x61')][_0xf153('0x61')],'WhatsappAccountId':_0x25dbd1[_0xf153('0x5e')]['id'],'WhatsappInteractionId':_0x1b033e['id'],'direction':'in','ContactId':_0x1b033e['ContactId'],'AttachmentId':_0x114cd8[_0xf153('0x61')][_0xf153('0xad')]});})['then'](function(_0x35a6d1){_0x114cd8[_0xf153('0x2f')]=_0x35a6d1;if(_0x114cd8[_0xf153('0xa7')][_0xf153('0xae')]){return db[_0xf153('0x7e')][_0xf153('0x5f')]({'attributes':['id',_0xf153('0x41')],'where':{'id':_0x114cd8['interaction']['UserId']}})['then'](function(_0x3e8153){if(_0x3e8153){_0x114cd8[_0xf153('0x87')][_0xf153('0xaf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3e8153['name']+','+(_0x114cd8[_0xf153('0x8a')]['waitForTheAssignedAgent']||0xa),'interval':_0xf153('0xac')});}return respondWithRpcPromise(_0xf153('0xb0'),_0xf153('0xb1'),_0x114cd8);});}return respondWithRpcPromise(_0xf153('0xb0'),_0xf153('0xb1'),_0x114cd8);})['then'](function(_0x1d5f95){if(_0x1d5f95){var _0x43d114=0xc8;var _0x179c1a='receiveMessage';logger[_0xf153('0x27')](_0xf153('0x2b'),_0x179c1a,_0x43d114,_0xf153('0xb2'));logger[_0xf153('0x2a')](_0xf153('0xb3'),_0x179c1a,_0x43d114,_0xf153('0xb2'),JSON[_0xf153('0x2c')](_0x1d5f95));if(_0x114cd8[_0xf153('0x8a')][_0xf153('0x49')]===_0xf153('0xb4')){return _0x1cccfe[_0xf153('0x34')](_0x43d114)[_0xf153('0xb5')](_0xf153('0xb6'),_0xf153('0xb7'))[_0xf153('0x42')](_0xf153('0xb8'));}else{return _0x1cccfe[_0xf153('0x34')](_0x43d114)['json'](_0x1d5f95);}}})[_0xf153('0x31')](handleError(_0x1cccfe,null));};exports[_0xf153('0x42')]=function(_0xf39b8d,_0x3a91e7,_0x576daf){var _0x127c83,_0x35e976,_0xc77048;if(_[_0xf153('0x99')](_0xf39b8d[_0xf153('0x61')][_0xf153('0x61')])||_0xf39b8d['body'][_0xf153('0x61')]===''){throw new db[(_0xf153('0x23'))]['ValidationError'](_0xf153('0x9b'));}if(_[_0xf153('0x99')](_0xf39b8d[_0xf153('0x61')]['to'])){throw new db[(_0xf153('0x23'))][(_0xf153('0x8c'))](_0xf153('0xb9'));}_0x127c83=_0xf39b8d[_0xf153('0x61')]['to'];return db[_0xf153('0x47')][_0xf153('0x5f')]({'where':{'id':_0xf39b8d[_0xf153('0x5e')]['id']},'include':[{'model':db[_0xf153('0xa1')],'as':_0xf153('0xba'),'include':[{'model':db[_0xf153('0x8b')],'as':'Contacts','where':{'mobile':_0x127c83},'limit':0x1,'order':[[_0xf153('0x90'),_0xf153('0xa3')]]}]}]})[_0xf153('0x26')](handleEntityNotFound(_0x3a91e7,null))[_0xf153('0x26')](function(_0x1f5264){if(_0x1f5264&&_0x1f5264[_0xf153('0xba')]){_0x35e976=_0x1f5264['get']({'plain':!![]});if(_0x35e976['List']&&_0x35e976[_0xf153('0xba')][_0xf153('0xa2')][_0xf153('0x50')]){return _0x35e976['List'][_0xf153('0xa2')][0x0];}return db[_0xf153('0x8b')][_0xf153('0x60')](_[_0xf153('0x1b')](_0xf39b8d[_0xf153('0x61')],{'firstName':_0x127c83,'mobile':_0x127c83,'phone':_0x127c83,'ListId':_0x35e976[_0xf153('0x92')]}));}})[_0xf153('0x26')](handleEntityNotFound(_0x3a91e7,null))[_0xf153('0x26')](function(_0x4af415){if(_0x4af415){_0xc77048=_0x4af415;return db['WhatsappInteraction'][_0xf153('0x5f')]({'where':{'ContactId':_0xc77048['id'],'closed':![],'WhatsappAccountId':_0x35e976['id']}})[_0xf153('0x26')](function(_0x273a50){if(_0x273a50){return[_0x273a50,![]];}return db[_0xf153('0xa6')][_0xf153('0x60')]({'UserId':_0xf39b8d['user']['id'],'ContactId':_0xc77048['id'],'WhatsappAccountId':_0x35e976['id'],'phone':_0x127c83,'firstMsgDirection':_0xf153('0xbb'),'Messages':[_[_0xf153('0x56')](_0xf39b8d[_0xf153('0x61')],{'read':![],'body':_0xf39b8d[_0xf153('0x61')][_0xf153('0x61')],'phone':_0x127c83,'WhatsappAccountId':_0x35e976['id'],'UserId':_0xf39b8d['user']['id'],'ContactId':_0xc77048['id']})]},{'include':[{'model':db[_0xf153('0xbc')],'as':'Messages'}]})[_0xf153('0x26')](function(_0x19efc8){return[_0x19efc8,!![]];});});}})[_0xf153('0x77')](function(_0xbf21df,_0xc4d05a){if(_0xc4d05a){return _0xbf21df;}return db['WhatsappMessage']['create'](_[_0xf153('0x56')](_0xf39b8d[_0xf153('0x61')],{'read':![],'body':_0xf39b8d[_0xf153('0x61')][_0xf153('0x61')],'phone':_0x127c83,'WhatsappAccountId':_0x35e976['id'],'WhatsappInteractionId':_0xbf21df['id'],'UserId':_0xf39b8d[_0xf153('0x62')]['id'],'ContactId':_0xc77048['id']}))[_0xf153('0x26')](function(_0x12dc14){_0xbf21df[_0xf153('0xbd')][_0xf153('0xbe')]=[];_0xbf21df[_0xf153('0xbd')][_0xf153('0xbe')][_0xf153('0xaa')](_0x12dc14[_0xf153('0xbd')]);return _0xbf21df;});})[_0xf153('0x26')](respondWithResult(_0x3a91e7,null))[_0xf153('0x31')](handleError(_0x3a91e7,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 041ddd2..6bb0ba5 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 _0x6d11=['hook','exports','events','../../mysqldb','WhatsappAccount','save','remove','emit','hasOwnProperty'];(function(_0x48693e,_0x580687){var _0x231d52=function(_0x3b8fee){while(--_0x3b8fee){_0x48693e['push'](_0x48693e['shift']());}};_0x231d52(++_0x580687);}(_0x6d11,0xbf));var _0x16d1=function(_0x2c1bea,_0x15f809){_0x2c1bea=_0x2c1bea-0x0;var _0x46fa5a=_0x6d11[_0x2c1bea];return _0x46fa5a;};'use strict';var EventEmitter=require(_0x16d1('0x0'));var WhatsappAccount=require(_0x16d1('0x1'))['db'][_0x16d1('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x16d1('0x3'),'afterUpdate':'update','afterDestroy':_0x16d1('0x4')};function emitEvent(_0x2e1a35){return function(_0x4bce83,_0x48754e,_0x3e0e86){WhatsappAccountEvents[_0x16d1('0x5')](_0x2e1a35+':'+_0x4bce83['id'],_0x4bce83);WhatsappAccountEvents[_0x16d1('0x5')](_0x2e1a35,_0x4bce83);_0x3e0e86(null);};}for(var e in events){if(events[_0x16d1('0x6')](e)){var event=events[e];WhatsappAccount[_0x16d1('0x7')](e,emitEvent(event));}}module[_0x16d1('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x6931=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x1e20f4,_0x103413){var _0x7d34cd=function(_0x51f50f){while(--_0x51f50f){_0x1e20f4['push'](_0x1e20f4['shift']());}};_0x7d34cd(++_0x103413);}(_0x6931,0x1a9));var _0x1693=function(_0x42d2c3,_0x254b7a){_0x42d2c3=_0x42d2c3-0x0;var _0x38e95f=_0x6931[_0x42d2c3];return _0x38e95f;};'use strict';var EventEmitter=require(_0x1693('0x0'));var WhatsappAccount=require(_0x1693('0x1'))['db'][_0x1693('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1693('0x3')](0x0);var events={'afterCreate':_0x1693('0x4'),'afterUpdate':_0x1693('0x5'),'afterDestroy':_0x1693('0x6')};function emitEvent(_0x2cb142){return function(_0x59d148,_0x19ff1c,_0x2ca960){WhatsappAccountEvents[_0x1693('0x7')](_0x2cb142+':'+_0x59d148['id'],_0x59d148);WhatsappAccountEvents[_0x1693('0x7')](_0x2cb142,_0x59d148);_0x2ca960(null);};}for(var e in events){if(events[_0x1693('0x8')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x1693('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 317f081..620bd19 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 _0xa336=['./whatsappAccount.attributes','define','WhatsappAccount','util','api','bluebird','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa336,0x1c3));var _0x6a33=function(_0x237868,_0x267e95){_0x237868=_0x237868-0x0;var _0x3bc4f6=_0xa336[_0x237868];return _0x3bc4f6;};'use strict';var _=require('lodash');var util=require(_0x6a33('0x0'));var logger=require('../../config/logger')(_0x6a33('0x1'));var moment=require('moment');var BPromise=require(_0x6a33('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6a33('0x3'));var config=require(_0x6a33('0x4'));var attributes=require(_0x6a33('0x5'));module['exports']=function(_0x4bfd94,_0x117d6c){return _0x4bfd94[_0x6a33('0x6')](_0x6a33('0x7'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80ab=['../../config/environment','./whatsappAccount.attributes','WhatsappAccount','whatsapp_accounts','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x80ab,0x72));var _0xb80a=function(_0x513fa2,_0x1f46ca){_0x513fa2=_0x513fa2-0x0;var _0x3b719b=_0x80ab[_0x513fa2];return _0x3b719b;};'use strict';var _=require(_0xb80a('0x0'));var util=require(_0xb80a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb80a('0x2'));var BPromise=require(_0xb80a('0x3'));var rp=require(_0xb80a('0x4'));var fs=require('fs');var path=require(_0xb80a('0x5'));var rimraf=require(_0xb80a('0x6'));var config=require(_0xb80a('0x7'));var attributes=require(_0xb80a('0x8'));module['exports']=function(_0x1b882c,_0x322a6d){return _0x1b882c['define'](_0xb80a('0x9'),attributes,{'tableName':_0xb80a('0xa'),'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 0336c66..51d32b4 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 _0x3bc2=['then','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','where','attributes','map','include','model'];(function(_0x3cc8b4,_0x33bc7d){var _0x20ff15=function(_0x5c30c2){while(--_0x5c30c2){_0x3cc8b4['push'](_0x3cc8b4['shift']());}};_0x20ff15(++_0x33bc7d);}(_0x3bc2,0x91));var _0x23bc=function(_0x5661ce,_0x2eaeb3){_0x5661ce=_0x5661ce-0x0;var _0x5a3305=_0x3bc2[_0x5661ce];return _0x5a3305;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x23bc('0x0'));var rs=require(_0x23bc('0x1'));var fs=require('fs');var Redis=require(_0x23bc('0x2'));var db=require(_0x23bc('0x3'))['db'];var utils=require(_0x23bc('0x4'));var logger=require('../../config/logger')(_0x23bc('0x5'));var config=require(_0x23bc('0x6'));var jayson=require(_0x23bc('0x7'));var client=jayson[_0x23bc('0x8')][_0x23bc('0x9')]({'port':0x232a});config[_0x23bc('0xa')]=_[_0x23bc('0xb')](config[_0x23bc('0xa')],{'host':_0x23bc('0xc'),'port':0x18eb});var socket=require(_0x23bc('0xd'))(new Redis(config[_0x23bc('0xa')]));require(_0x23bc('0xe'))[_0x23bc('0xf')](socket);function respondWithRpcPromise(_0x57e89f,_0x1624e6,_0x4e7d39){return new BPromise(function(_0x52de53,_0x508cf6){return client['request'](_0x57e89f,_0x4e7d39)['then'](function(_0x14903c){logger[_0x23bc('0x10')](_0x23bc('0x11'),_0x1624e6,'request\x20sent');logger[_0x23bc('0x12')](_0x23bc('0x13'),_0x1624e6,_0x23bc('0x14'),JSON[_0x23bc('0x15')](_0x14903c));if(_0x14903c[_0x23bc('0x16')]){if(_0x14903c[_0x23bc('0x16')][_0x23bc('0x17')]===0x1f4){logger['error'](_0x23bc('0x11'),_0x1624e6,_0x14903c[_0x23bc('0x16')][_0x23bc('0x18')]);return _0x508cf6(_0x14903c[_0x23bc('0x16')]['message']);}logger['error'](_0x23bc('0x11'),_0x1624e6,_0x14903c['error'][_0x23bc('0x18')]);return _0x52de53(_0x14903c[_0x23bc('0x16')][_0x23bc('0x18')]);}else{logger[_0x23bc('0x10')](_0x23bc('0x11'),_0x1624e6,_0x23bc('0x14'));_0x52de53(_0x14903c[_0x23bc('0x19')][_0x23bc('0x18')]);}})[_0x23bc('0x1a')](function(_0xe7b601){logger[_0x23bc('0x16')](_0x23bc('0x11'),_0x1624e6,_0xe7b601);_0x508cf6(_0xe7b601);});});}exports[_0x23bc('0x1b')]=function(_0xd67816){var _0x1dc51a=this;return new Promise(function(_0x4309e7,_0x453c0e){return db[_0x23bc('0x1c')]['find']({'raw':_0xd67816['options']?_0xd67816[_0x23bc('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xd67816[_0x23bc('0x1d')]?_0xd67816[_0x23bc('0x1d')][_0x23bc('0x1e')]||null:null,'attributes':_0xd67816[_0x23bc('0x1d')]?_0xd67816[_0x23bc('0x1d')][_0x23bc('0x1f')]||null:null,'include':_0xd67816[_0x23bc('0x1d')]?_0xd67816[_0x23bc('0x1d')]['include']?_[_0x23bc('0x20')](_0xd67816[_0x23bc('0x1d')]['include'],function(_0xba38b0){return{'model':db[_0xba38b0['model']],'as':_0xba38b0['as'],'attributes':_0xba38b0['attributes'],'include':_0xba38b0[_0x23bc('0x21')]?_[_0x23bc('0x20')](_0xba38b0[_0x23bc('0x21')],function(_0x128b92){return{'model':db[_0x128b92[_0x23bc('0x22')]],'as':_0x128b92['as'],'attributes':_0x128b92[_0x23bc('0x1f')],'include':_0x128b92[_0x23bc('0x21')]?_['map'](_0x128b92[_0x23bc('0x21')],function(_0x1cb3e9){return{'model':db[_0x1cb3e9[_0x23bc('0x22')]],'as':_0x1cb3e9['as'],'attributes':_0x1cb3e9[_0x23bc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x23bc('0x23')](function(_0x368023){logger['info']('ShowWhatsappAccount',_0xd67816);logger[_0x23bc('0x12')](_0x23bc('0x1b'),_0xd67816,JSON['stringify'](_0x368023));_0x4309e7(_0x368023);})['catch'](function(_0x133370){logger[_0x23bc('0x16')]('ShowWhatsappAccount',_0x133370[_0x23bc('0x18')],_0xd67816);_0x453c0e(_0x1dc51a[_0x23bc('0x16')](0x1f4,_0x133370[_0x23bc('0x18')]));});});}; \ No newline at end of file +var _0x059a=['include','map','model','ShowWhatsappAccount','stringify','util','ioredis','../../mysqldb','rpc','jayson/promise','http','redis','defaults','./whatsappAccount.socket','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','WhatsappAccount','options','raw','attributes'];(function(_0x3e83dd,_0x1a8ce3){var _0x1a1082=function(_0x161d54){while(--_0x161d54){_0x3e83dd['push'](_0x3e83dd['shift']());}};_0x1a1082(++_0x1a8ce3);}(_0x059a,0x18b));var _0xa059=function(_0x2c5340,_0x5c86e5){_0x2c5340=_0x2c5340-0x0;var _0x3c505e=_0x059a[_0x2c5340];return _0x3c505e;};'use strict';var _=require('lodash');var util=require(_0xa059('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa059('0x1'));var db=require(_0xa059('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa059('0x3'));var config=require('../../config/environment');var jayson=require(_0xa059('0x4'));var client=jayson['client'][_0xa059('0x5')]({'port':0x232a});config[_0xa059('0x6')]=_[_0xa059('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa059('0x6')]));require(_0xa059('0x8'))['register'](socket);function respondWithRpcPromise(_0x714e54,_0x5e4b55,_0x4153e8){return new BPromise(function(_0x4d337e,_0x490252){return client[_0xa059('0x9')](_0x714e54,_0x4153e8)[_0xa059('0xa')](function(_0x2e4836){logger[_0xa059('0xb')]('WhatsappAccount,\x20%s,\x20%s',_0x5e4b55,_0xa059('0xc'));logger[_0xa059('0xd')](_0xa059('0xe'),_0x5e4b55,_0xa059('0xc'),JSON['stringify'](_0x2e4836));if(_0x2e4836[_0xa059('0xf')]){if(_0x2e4836['error'][_0xa059('0x10')]===0x1f4){logger[_0xa059('0xf')](_0xa059('0x11'),_0x5e4b55,_0x2e4836[_0xa059('0xf')]['message']);return _0x490252(_0x2e4836[_0xa059('0xf')][_0xa059('0x12')]);}logger[_0xa059('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x5e4b55,_0x2e4836[_0xa059('0xf')][_0xa059('0x12')]);return _0x4d337e(_0x2e4836[_0xa059('0xf')][_0xa059('0x12')]);}else{logger['info'](_0xa059('0x11'),_0x5e4b55,_0xa059('0xc'));_0x4d337e(_0x2e4836[_0xa059('0x13')][_0xa059('0x12')]);}})[_0xa059('0x14')](function(_0xfd31ae){logger[_0xa059('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x5e4b55,_0xfd31ae);_0x490252(_0xfd31ae);});});}exports['ShowWhatsappAccount']=function(_0x1a6e39){var _0x539a38=this;return new Promise(function(_0x21737f,_0x56bdd8){return db[_0xa059('0x15')]['find']({'raw':_0x1a6e39[_0xa059('0x16')]?_0x1a6e39[_0xa059('0x16')][_0xa059('0x17')]===undefined?!![]:![]:!![],'where':_0x1a6e39[_0xa059('0x16')]?_0x1a6e39[_0xa059('0x16')]['where']||null:null,'attributes':_0x1a6e39[_0xa059('0x16')]?_0x1a6e39[_0xa059('0x16')][_0xa059('0x18')]||null:null,'include':_0x1a6e39[_0xa059('0x16')]?_0x1a6e39['options'][_0xa059('0x19')]?_[_0xa059('0x1a')](_0x1a6e39[_0xa059('0x16')]['include'],function(_0x4ca173){return{'model':db[_0x4ca173['model']],'as':_0x4ca173['as'],'attributes':_0x4ca173[_0xa059('0x18')],'include':_0x4ca173['include']?_['map'](_0x4ca173[_0xa059('0x19')],function(_0x5ef192){return{'model':db[_0x5ef192[_0xa059('0x1b')]],'as':_0x5ef192['as'],'attributes':_0x5ef192[_0xa059('0x18')],'include':_0x5ef192[_0xa059('0x19')]?_[_0xa059('0x1a')](_0x5ef192[_0xa059('0x19')],function(_0x3165fe){return{'model':db[_0x3165fe[_0xa059('0x1b')]],'as':_0x3165fe['as'],'attributes':_0x3165fe[_0xa059('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa059('0xa')](function(_0x423107){logger['info']('ShowWhatsappAccount',_0x1a6e39);logger[_0xa059('0xd')](_0xa059('0x1c'),_0x1a6e39,JSON[_0xa059('0x1d')](_0x423107));_0x21737f(_0x423107);})[_0xa059('0x14')](function(_0x3f8d0d){logger[_0xa059('0xf')]('ShowWhatsappAccount',_0x3f8d0d['message'],_0x1a6e39);_0x56bdd8(_0x539a38['error'](0x1f4,_0x3f8d0d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 3503071..829be18 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 _0x0b32=['length','whatsappAccount:','./whatsappAccount.events','save','remove','emit','removeListener'];(function(_0x5390e7,_0x22ce3a){var _0x499ab2=function(_0x50e9ca){while(--_0x50e9ca){_0x5390e7['push'](_0x5390e7['shift']());}};_0x499ab2(++_0x22ce3a);}(_0x0b32,0x12f));var _0x20b3=function(_0x2b7f3a,_0x518001){_0x2b7f3a=_0x2b7f3a-0x0;var _0x58dfd0=_0x0b32[_0x2b7f3a];return _0x58dfd0;};'use strict';var WhatsappAccountEvents=require(_0x20b3('0x0'));var events=[_0x20b3('0x1'),_0x20b3('0x2'),'update'];function createListener(_0x1e4fca,_0x7d9e7d){return function(_0x179415){_0x7d9e7d[_0x20b3('0x3')](_0x1e4fca,_0x179415);};}function removeListener(_0x15e264,_0x438412){return function(){WhatsappAccountEvents[_0x20b3('0x4')](_0x15e264,_0x438412);};}exports['register']=function(_0xe9bc62){for(var _0x59f20e=0x0,_0x4d5aa=events[_0x20b3('0x5')];_0x59f20e<_0x4d5aa;_0x59f20e++){var _0xe63071=events[_0x59f20e];var _0xde26cc=createListener(_0x20b3('0x6')+_0xe63071,_0xe9bc62);WhatsappAccountEvents['on'](_0xe63071,_0xde26cc);}}; \ No newline at end of file +var _0x9af1=['removeListener','length','whatsappAccount:','./whatsappAccount.events','save','remove','update'];(function(_0x4fb9ed,_0x187ea0){var _0x263645=function(_0x11c604){while(--_0x11c604){_0x4fb9ed['push'](_0x4fb9ed['shift']());}};_0x263645(++_0x187ea0);}(_0x9af1,0x1bc));var _0x19af=function(_0x30a385,_0x242ecd){_0x30a385=_0x30a385-0x0;var _0x27df00=_0x9af1[_0x30a385];return _0x27df00;};'use strict';var WhatsappAccountEvents=require(_0x19af('0x0'));var events=[_0x19af('0x1'),_0x19af('0x2'),_0x19af('0x3')];function createListener(_0x89f196,_0x569774){return function(_0x341446){_0x569774['emit'](_0x89f196,_0x341446);};}function removeListener(_0x4b3bd3,_0x28a6c6){return function(){WhatsappAccountEvents[_0x19af('0x4')](_0x4b3bd3,_0x28a6c6);};}exports['register']=function(_0x4844af){for(var _0x29044d=0x0,_0x5012cd=events[_0x19af('0x5')];_0x29044d<_0x5012cd;_0x29044d++){var _0x5ee183=events[_0x29044d];var _0x314a0c=createListener(_0x19af('0x6')+_0x5ee183,_0x4844af);WhatsappAccountEvents['on'](_0x5ee183,_0x314a0c);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index b92eb86..0fa8e02 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 _0xd1a6=['put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x11a901,_0x2fe2c2){var _0x887c05=function(_0x5276a0){while(--_0x5276a0){_0x11a901['push'](_0x11a901['shift']());}};_0x887c05(++_0x2fe2c2);}(_0xd1a6,0xb7));var _0x6d1a=function(_0x43cdc5,_0x2f19ba){_0x43cdc5=_0x43cdc5-0x0;var _0x2da6c5=_0xd1a6[_0x43cdc5];return _0x2da6c5;};'use strict';var multer=require(_0x6d1a('0x0'));var util=require(_0x6d1a('0x1'));var path=require(_0x6d1a('0x2'));var timeout=require(_0x6d1a('0x3'));var express=require('express');var router=express[_0x6d1a('0x4')]();var auth=require(_0x6d1a('0x5'));var interaction=require(_0x6d1a('0x6'));var config=require(_0x6d1a('0x7'));var controller=require('./whatsappApplication.controller');router[_0x6d1a('0x8')]('/',auth['isAuthenticated'](),controller[_0x6d1a('0x9')]);router[_0x6d1a('0x8')](_0x6d1a('0xa'),auth[_0x6d1a('0xb')](),controller[_0x6d1a('0xc')]);router[_0x6d1a('0xd')]('/',auth['isAuthenticated'](),controller[_0x6d1a('0xe')]);router[_0x6d1a('0xf')](_0x6d1a('0xa'),auth[_0x6d1a('0xb')](),controller['update']);router[_0x6d1a('0x10')](_0x6d1a('0xa'),auth[_0x6d1a('0xb')](),controller['destroy']);module[_0x6d1a('0x11')]=router; \ No newline at end of file +var _0x9961=['../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9961,0x1b2));var _0x1996=function(_0x221488,_0x2e8347){_0x221488=_0x221488-0x0;var _0x28cf2a=_0x9961[_0x221488];return _0x28cf2a;};'use strict';var multer=require(_0x1996('0x0'));var util=require('util');var path=require(_0x1996('0x1'));var timeout=require(_0x1996('0x2'));var express=require(_0x1996('0x3'));var router=express[_0x1996('0x4')]();var auth=require(_0x1996('0x5'));var interaction=require(_0x1996('0x6'));var config=require(_0x1996('0x7'));var controller=require(_0x1996('0x8'));router[_0x1996('0x9')]('/',auth['isAuthenticated'](),controller[_0x1996('0xa')]);router['get'](_0x1996('0xb'),auth[_0x1996('0xc')](),controller[_0x1996('0xd')]);router[_0x1996('0xe')]('/',auth[_0x1996('0xc')](),controller[_0x1996('0xf')]);router[_0x1996('0x10')]('/:id',auth[_0x1996('0xc')](),controller[_0x1996('0x11')]);router[_0x1996('0x12')](_0x1996('0xb'),auth[_0x1996('0xc')](),controller[_0x1996('0x13')]);module[_0x1996('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index b9fb077..0661e41 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 _0x1580=['STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1580,0x8f));var _0x0158=function(_0x32909a,_0x12f12c){_0x32909a=_0x32909a-0x0;var _0x33093f=_0x1580[_0x32909a];return _0x33093f;};'use strict';var Sequelize=require(_0x0158('0x0'));module[_0x0158('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0158('0x2')],'allowNull':![],'defaultValue':_0x0158('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0158('0x2')]},'interval':{'type':Sequelize[_0x0158('0x2')],'defaultValue':_0x0158('0x4')}}; \ No newline at end of file +var _0x0490=['STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x568105,_0x5b73b2){var _0x4647a6=function(_0x858e05){while(--_0x858e05){_0x568105['push'](_0x568105['shift']());}};_0x4647a6(++_0x5b73b2);}(_0x0490,0x8a));var _0x0049=function(_0x4617c7,_0x17aab3){_0x4617c7=_0x4617c7-0x0;var _0x162c33=_0x0490[_0x4617c7];return _0x162c33;};'use strict';var Sequelize=require(_0x0049('0x0'));module[_0x0049('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0049('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0049('0x3')]()},'description':{'type':Sequelize[_0x0049('0x2')]},'interval':{'type':Sequelize[_0x0049('0x2')],'defaultValue':_0x0049('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 7d2a0dd..a491ca0 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 _0x4cc5=['filter','merge','type','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','WhatsappApplication','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0x4cc5,0x1c5));var _0x54cc=function(_0x16ef39,_0x5d3f7a){_0x16ef39=_0x16ef39-0x0;var _0x733cef=_0x4cc5[_0x16ef39];return _0x733cef;};'use strict';var pdf=require(_0x54cc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x54cc('0x1'));var zipdir=require(_0x54cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x54cc('0x3'));var moment=require('moment');var BPromise=require(_0x54cc('0x4'));var Mustache=require(_0x54cc('0x5'));var util=require(_0x54cc('0x6'));var path=require(_0x54cc('0x7'));var sox=require(_0x54cc('0x8'));var csv=require(_0x54cc('0x9'));var ejs=require(_0x54cc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x54cc('0xb'));var crypto=require(_0x54cc('0xc'));var jsforce=require(_0x54cc('0xd'));var deskjs=require(_0x54cc('0xe'));var toCsv=require(_0x54cc('0x9'));var querystring=require(_0x54cc('0xf'));var Papa=require(_0x54cc('0x10'));var Redis=require(_0x54cc('0x11'));var authService=require(_0x54cc('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x54cc('0x13'))(_0x54cc('0x14'));var utils=require(_0x54cc('0x15'));var config=require(_0x54cc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d64b5,_0x3412df){_0x3412df=_0x3412df||0xcc;return function(_0x129270){if(_0x129270){return _0x4d64b5[_0x54cc('0x17')](_0x3412df);}return _0x4d64b5[_0x54cc('0x18')](_0x3412df)['end']();};}function respondWithResult(_0x22309a,_0x2a279b){_0x2a279b=_0x2a279b||0xc8;return function(_0x18aea7){if(_0x18aea7){return _0x22309a[_0x54cc('0x18')](_0x2a279b)[_0x54cc('0x19')](_0x18aea7);}};}function respondWithFilteredResult(_0x41e308,_0x3762ad){return function(_0xeb0c51){if(_0xeb0c51){var _0xfc7a30=_0xeb0c51[_0x54cc('0x1a')],_0x206f29=_0x3762ad[_0x54cc('0x1b')],_0x55dd7b=_0x3762ad['offset']+_0x3762ad[_0x54cc('0x1c')],_0x4ee5bf;if(_0x55dd7b>=_0xfc7a30){_0x55dd7b=_0xfc7a30;_0x4ee5bf=0xc8;}else{_0x4ee5bf=0xce;}_0x41e308['status'](_0x4ee5bf);return _0x41e308[_0x54cc('0x1d')](_0x54cc('0x1e'),_0x206f29+'-'+_0x55dd7b+'/'+_0xfc7a30)[_0x54cc('0x19')](_0xeb0c51);}return null;};}function patchUpdates(_0x1213b8){return function(_0x1cf250){try{jsonpatch[_0x54cc('0x1f')](_0x1cf250,_0x1213b8,!![]);}catch(_0x145b3a){return BPromise['reject'](_0x145b3a);}return _0x1cf250[_0x54cc('0x20')]();};}function saveUpdates(_0x1c3313,_0x230f23){return function(_0x5d7b3e){if(_0x5d7b3e){return _0x5d7b3e[_0x54cc('0x21')](_0x1c3313)[_0x54cc('0x22')](function(_0x1a7e5d){return _0x1a7e5d;});}return null;};}function removeEntity(_0xb5b459,_0x1829e7){return function(_0x4073ec){if(_0x4073ec){return _0x4073ec[_0x54cc('0x23')]()[_0x54cc('0x22')](function(){_0xb5b459[_0x54cc('0x18')](0xcc)[_0x54cc('0x24')]();});}};}function handleEntityNotFound(_0x2de64a,_0x4c69c5){return function(_0x5a58b1){if(!_0x5a58b1){_0x2de64a['sendStatus'](0x194);}return _0x5a58b1;};}function handleError(_0x270c68,_0x357763){_0x357763=_0x357763||0x1f4;return function(_0x471b22){logger[_0x54cc('0x25')](_0x471b22[_0x54cc('0x26')]);if(_0x471b22[_0x54cc('0x27')]){delete _0x471b22[_0x54cc('0x27')];}_0x270c68[_0x54cc('0x18')](_0x357763)[_0x54cc('0x28')](_0x471b22);};}exports[_0x54cc('0x29')]=function(_0x3380ce,_0x28d919){var _0x3ffc14={},_0x38bcf4={},_0x391d0c={'count':0x0,'rows':[]};var _0x2f38a4=_[_0x54cc('0x2a')](db[_0x54cc('0x2b')]['rawAttributes'],function(_0xe51b22){return{'name':_0xe51b22[_0x54cc('0x2c')],'type':_0xe51b22['type'][_0x54cc('0x2d')]};});_0x38bcf4[_0x54cc('0x2e')]=_[_0x54cc('0x2a')](_0x2f38a4,_0x54cc('0x27'));_0x38bcf4['query']=_[_0x54cc('0x2f')](_0x3380ce[_0x54cc('0x30')]);_0x38bcf4[_0x54cc('0x31')]=_[_0x54cc('0x32')](_0x38bcf4[_0x54cc('0x2e')],_0x38bcf4[_0x54cc('0x30')]);_0x3ffc14['attributes']=_[_0x54cc('0x32')](_0x38bcf4[_0x54cc('0x2e')],qs[_0x54cc('0x33')](_0x3380ce[_0x54cc('0x30')][_0x54cc('0x33')]));_0x3ffc14[_0x54cc('0x34')]=_0x3ffc14[_0x54cc('0x34')][_0x54cc('0x35')]?_0x3ffc14[_0x54cc('0x34')]:_0x38bcf4[_0x54cc('0x2e')];if(!_0x3380ce[_0x54cc('0x30')][_0x54cc('0x36')](_0x54cc('0x37'))){_0x3ffc14['limit']=qs[_0x54cc('0x1c')](_0x3380ce[_0x54cc('0x30')][_0x54cc('0x1c')]);_0x3ffc14['offset']=qs['offset'](_0x3380ce[_0x54cc('0x30')][_0x54cc('0x1b')]);}_0x3ffc14['order']=qs[_0x54cc('0x38')](_0x3380ce[_0x54cc('0x30')]['sort']);_0x3ffc14[_0x54cc('0x39')]=qs[_0x54cc('0x31')](_['pick'](_0x3380ce[_0x54cc('0x30')],_0x38bcf4[_0x54cc('0x31')]),_0x2f38a4);if(_0x3380ce[_0x54cc('0x30')][_0x54cc('0x3a')]){_0x3ffc14[_0x54cc('0x39')]=_[_0x54cc('0x3b')](_0x3ffc14[_0x54cc('0x39')],{'$or':_[_0x54cc('0x2a')](_0x2f38a4,function(_0x1a1ac6){if(_0x1a1ac6[_0x54cc('0x3c')]!=='VIRTUAL'){var _0x378ba9={};_0x378ba9[_0x1a1ac6[_0x54cc('0x27')]]={'$like':'%'+_0x3380ce['query']['filter']+'%'};return _0x378ba9;}})});}_0x3ffc14=_[_0x54cc('0x3b')]({},_0x3ffc14,_0x3380ce[_0x54cc('0x3d')]);var _0x1044ce={'where':_0x3ffc14[_0x54cc('0x39')]};return db[_0x54cc('0x2b')]['count'](_0x1044ce)[_0x54cc('0x22')](function(_0xf26f07){_0x391d0c[_0x54cc('0x1a')]=_0xf26f07;if(_0x3380ce[_0x54cc('0x30')][_0x54cc('0x3e')]){_0x3ffc14[_0x54cc('0x3f')]=[{'all':!![]}];}return db[_0x54cc('0x2b')][_0x54cc('0x40')](_0x3ffc14);})[_0x54cc('0x22')](function(_0x5db4b3){_0x391d0c[_0x54cc('0x41')]=_0x5db4b3;return _0x391d0c;})[_0x54cc('0x22')](respondWithFilteredResult(_0x28d919,_0x3ffc14))[_0x54cc('0x42')](handleError(_0x28d919,null));};exports[_0x54cc('0x43')]=function(_0x3c20bf,_0x5ce4f3){var _0x42e7e0={'raw':!![],'where':{'id':_0x3c20bf['params']['id']}},_0x3b55f5={};_0x3b55f5['model']=_['keys'](db[_0x54cc('0x2b')][_0x54cc('0x44')]);_0x3b55f5[_0x54cc('0x30')]=_[_0x54cc('0x2f')](_0x3c20bf[_0x54cc('0x30')]);_0x3b55f5['filters']=_[_0x54cc('0x32')](_0x3b55f5[_0x54cc('0x2e')],_0x3b55f5[_0x54cc('0x30')]);_0x42e7e0[_0x54cc('0x34')]=_[_0x54cc('0x32')](_0x3b55f5[_0x54cc('0x2e')],qs[_0x54cc('0x33')](_0x3c20bf[_0x54cc('0x30')][_0x54cc('0x33')]));_0x42e7e0[_0x54cc('0x34')]=_0x42e7e0['attributes'][_0x54cc('0x35')]?_0x42e7e0[_0x54cc('0x34')]:_0x3b55f5['model'];if(_0x3c20bf[_0x54cc('0x30')][_0x54cc('0x3e')]){_0x42e7e0[_0x54cc('0x3f')]=[{'all':!![]}];}_0x42e7e0=_[_0x54cc('0x3b')]({},_0x42e7e0,_0x3c20bf[_0x54cc('0x3d')]);return db[_0x54cc('0x2b')][_0x54cc('0x45')](_0x42e7e0)[_0x54cc('0x22')](handleEntityNotFound(_0x5ce4f3,null))[_0x54cc('0x22')](respondWithResult(_0x5ce4f3,null))[_0x54cc('0x42')](handleError(_0x5ce4f3,null));};exports['create']=function(_0x53ae86,_0x42d18d){return db[_0x54cc('0x2b')][_0x54cc('0x46')](_0x53ae86[_0x54cc('0x47')],{})[_0x54cc('0x22')](respondWithResult(_0x42d18d,0xc9))[_0x54cc('0x42')](handleError(_0x42d18d,null));};exports['update']=function(_0x555d52,_0x2ecc29){if(_0x555d52[_0x54cc('0x47')]['id']){delete _0x555d52[_0x54cc('0x47')]['id'];}return db['WhatsappApplication'][_0x54cc('0x45')]({'where':{'id':_0x555d52[_0x54cc('0x48')]['id']}})[_0x54cc('0x22')](handleEntityNotFound(_0x2ecc29,null))[_0x54cc('0x22')](saveUpdates(_0x555d52[_0x54cc('0x47')],null))[_0x54cc('0x22')](respondWithResult(_0x2ecc29,null))[_0x54cc('0x42')](handleError(_0x2ecc29,null));};exports[_0x54cc('0x23')]=function(_0x40a913,_0x3465c6){return db[_0x54cc('0x2b')][_0x54cc('0x45')]({'where':{'id':_0x40a913[_0x54cc('0x48')]['id']}})[_0x54cc('0x22')](handleEntityNotFound(_0x3465c6,null))[_0x54cc('0x22')](removeEntity(_0x3465c6,null))[_0x54cc('0x42')](handleError(_0x3465c6,null));}; \ No newline at end of file +var _0x0711=['type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','WhatsappApplication','includeAll','include','findAll','show','params','filters','options','catch','body','find','destroy','html-pdf','rimraf','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','limit','set','reject','save','update','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName'];(function(_0x234318,_0xf22f31){var _0x1ab719=function(_0x10a0b1){while(--_0x10a0b1){_0x234318['push'](_0x234318['shift']());}};_0x1ab719(++_0xf22f31);}(_0x0711,0x1b3));var _0x1071=function(_0x58cde9,_0x278957){_0x58cde9=_0x58cde9-0x0;var _0x4bdb16=_0x0711[_0x58cde9];return _0x4bdb16;};'use strict';var pdf=require(_0x1071('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1071('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1071('0x2'));var moment=require(_0x1071('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1071('0x4'));var util=require(_0x1071('0x5'));var path=require(_0x1071('0x6'));var sox=require(_0x1071('0x7'));var csv=require('to-csv');var ejs=require(_0x1071('0x8'));var fs=require('fs');var _=require(_0x1071('0x9'));var squel=require(_0x1071('0xa'));var crypto=require(_0x1071('0xb'));var jsforce=require(_0x1071('0xc'));var deskjs=require(_0x1071('0xd'));var toCsv=require(_0x1071('0xe'));var querystring=require(_0x1071('0xf'));var Papa=require(_0x1071('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1071('0x11'));var hardwareService=require(_0x1071('0x12'));var logger=require(_0x1071('0x13'))(_0x1071('0x14'));var utils=require(_0x1071('0x15'));var config=require(_0x1071('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ccee9,_0x562826){_0x562826=_0x562826||0xcc;return function(_0x2837ce){if(_0x2837ce){return _0x2ccee9['sendStatus'](_0x562826);}return _0x2ccee9[_0x1071('0x17')](_0x562826)['end']();};}function respondWithResult(_0x3cb6eb,_0x5c5a67){_0x5c5a67=_0x5c5a67||0xc8;return function(_0x2820f3){if(_0x2820f3){return _0x3cb6eb[_0x1071('0x17')](_0x5c5a67)[_0x1071('0x18')](_0x2820f3);}};}function respondWithFilteredResult(_0xb6d233,_0x1b7a49){return function(_0x5eb7f7){if(_0x5eb7f7){var _0x19abcf=_0x5eb7f7[_0x1071('0x19')],_0x4a5424=_0x1b7a49[_0x1071('0x1a')],_0x426e10=_0x1b7a49[_0x1071('0x1a')]+_0x1b7a49[_0x1071('0x1b')],_0x11cb1a;if(_0x426e10>=_0x19abcf){_0x426e10=_0x19abcf;_0x11cb1a=0xc8;}else{_0x11cb1a=0xce;}_0xb6d233[_0x1071('0x17')](_0x11cb1a);return _0xb6d233[_0x1071('0x1c')]('Content-Range',_0x4a5424+'-'+_0x426e10+'/'+_0x19abcf)['json'](_0x5eb7f7);}return null;};}function patchUpdates(_0x3a753b){return function(_0x67f856){try{jsonpatch['apply'](_0x67f856,_0x3a753b,!![]);}catch(_0x1702cb){return BPromise[_0x1071('0x1d')](_0x1702cb);}return _0x67f856[_0x1071('0x1e')]();};}function saveUpdates(_0x3e52df,_0x2dc695){return function(_0x5574ff){if(_0x5574ff){return _0x5574ff[_0x1071('0x1f')](_0x3e52df)[_0x1071('0x20')](function(_0x149a61){return _0x149a61;});}return null;};}function removeEntity(_0x55b3e3,_0x4b6f1a){return function(_0x1fd402){if(_0x1fd402){return _0x1fd402['destroy']()[_0x1071('0x20')](function(){_0x55b3e3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25bfdb,_0x1cb713){return function(_0x2115df){if(!_0x2115df){_0x25bfdb[_0x1071('0x21')](0x194);}return _0x2115df;};}function handleError(_0x4ca5e4,_0x555373){_0x555373=_0x555373||0x1f4;return function(_0x20a3f4){logger[_0x1071('0x22')](_0x20a3f4['stack']);if(_0x20a3f4[_0x1071('0x23')]){delete _0x20a3f4[_0x1071('0x23')];}_0x4ca5e4[_0x1071('0x17')](_0x555373)[_0x1071('0x24')](_0x20a3f4);};}exports[_0x1071('0x25')]=function(_0x4f65eb,_0x32e325){var _0x4e131e={},_0x2b8a85={},_0x440546={'count':0x0,'rows':[]};var _0x39a15d=_[_0x1071('0x26')](db['WhatsappApplication'][_0x1071('0x27')],function(_0x26b2fc){return{'name':_0x26b2fc[_0x1071('0x28')],'type':_0x26b2fc[_0x1071('0x29')][_0x1071('0x2a')]};});_0x2b8a85[_0x1071('0x2b')]=_['map'](_0x39a15d,'name');_0x2b8a85[_0x1071('0x2c')]=_[_0x1071('0x2d')](_0x4f65eb[_0x1071('0x2c')]);_0x2b8a85['filters']=_[_0x1071('0x2e')](_0x2b8a85[_0x1071('0x2b')],_0x2b8a85[_0x1071('0x2c')]);_0x4e131e['attributes']=_[_0x1071('0x2e')](_0x2b8a85[_0x1071('0x2b')],qs['fields'](_0x4f65eb[_0x1071('0x2c')][_0x1071('0x2f')]));_0x4e131e[_0x1071('0x30')]=_0x4e131e['attributes']['length']?_0x4e131e['attributes']:_0x2b8a85[_0x1071('0x2b')];if(!_0x4f65eb['query'][_0x1071('0x31')](_0x1071('0x32'))){_0x4e131e[_0x1071('0x1b')]=qs[_0x1071('0x1b')](_0x4f65eb[_0x1071('0x2c')][_0x1071('0x1b')]);_0x4e131e[_0x1071('0x1a')]=qs[_0x1071('0x1a')](_0x4f65eb[_0x1071('0x2c')][_0x1071('0x1a')]);}_0x4e131e[_0x1071('0x33')]=qs[_0x1071('0x34')](_0x4f65eb[_0x1071('0x2c')][_0x1071('0x34')]);_0x4e131e[_0x1071('0x35')]=qs['filters'](_[_0x1071('0x36')](_0x4f65eb[_0x1071('0x2c')],_0x2b8a85['filters']),_0x39a15d);if(_0x4f65eb[_0x1071('0x2c')]['filter']){_0x4e131e['where']=_[_0x1071('0x37')](_0x4e131e[_0x1071('0x35')],{'$or':_[_0x1071('0x26')](_0x39a15d,function(_0x5df5df){if(_0x5df5df[_0x1071('0x29')]!=='VIRTUAL'){var _0x213f5c={};_0x213f5c[_0x5df5df[_0x1071('0x23')]]={'$like':'%'+_0x4f65eb[_0x1071('0x2c')]['filter']+'%'};return _0x213f5c;}})});}_0x4e131e=_[_0x1071('0x37')]({},_0x4e131e,_0x4f65eb['options']);var _0x1e221f={'where':_0x4e131e[_0x1071('0x35')]};return db[_0x1071('0x38')][_0x1071('0x19')](_0x1e221f)[_0x1071('0x20')](function(_0x3ff349){_0x440546['count']=_0x3ff349;if(_0x4f65eb[_0x1071('0x2c')][_0x1071('0x39')]){_0x4e131e[_0x1071('0x3a')]=[{'all':!![]}];}return db[_0x1071('0x38')][_0x1071('0x3b')](_0x4e131e);})[_0x1071('0x20')](function(_0x5ea94c){_0x440546['rows']=_0x5ea94c;return _0x440546;})[_0x1071('0x20')](respondWithFilteredResult(_0x32e325,_0x4e131e))['catch'](handleError(_0x32e325,null));};exports[_0x1071('0x3c')]=function(_0x3988b6,_0x2f99bd){var _0xe4e1bd={'raw':!![],'where':{'id':_0x3988b6[_0x1071('0x3d')]['id']}},_0x5cfca9={};_0x5cfca9['model']=_['keys'](db[_0x1071('0x38')]['rawAttributes']);_0x5cfca9[_0x1071('0x2c')]=_[_0x1071('0x2d')](_0x3988b6[_0x1071('0x2c')]);_0x5cfca9[_0x1071('0x3e')]=_[_0x1071('0x2e')](_0x5cfca9['model'],_0x5cfca9['query']);_0xe4e1bd[_0x1071('0x30')]=_[_0x1071('0x2e')](_0x5cfca9[_0x1071('0x2b')],qs[_0x1071('0x2f')](_0x3988b6[_0x1071('0x2c')][_0x1071('0x2f')]));_0xe4e1bd['attributes']=_0xe4e1bd[_0x1071('0x30')]['length']?_0xe4e1bd[_0x1071('0x30')]:_0x5cfca9[_0x1071('0x2b')];if(_0x3988b6['query']['includeAll']){_0xe4e1bd['include']=[{'all':!![]}];}_0xe4e1bd=_[_0x1071('0x37')]({},_0xe4e1bd,_0x3988b6[_0x1071('0x3f')]);return db[_0x1071('0x38')]['find'](_0xe4e1bd)[_0x1071('0x20')](handleEntityNotFound(_0x2f99bd,null))[_0x1071('0x20')](respondWithResult(_0x2f99bd,null))[_0x1071('0x40')](handleError(_0x2f99bd,null));};exports['create']=function(_0x485920,_0x2c40ee){return db[_0x1071('0x38')]['create'](_0x485920['body'],{})['then'](respondWithResult(_0x2c40ee,0xc9))['catch'](handleError(_0x2c40ee,null));};exports[_0x1071('0x1f')]=function(_0x47a9a4,_0x13d33a){if(_0x47a9a4['body']['id']){delete _0x47a9a4[_0x1071('0x41')]['id'];}return db[_0x1071('0x38')][_0x1071('0x42')]({'where':{'id':_0x47a9a4[_0x1071('0x3d')]['id']}})[_0x1071('0x20')](handleEntityNotFound(_0x13d33a,null))[_0x1071('0x20')](saveUpdates(_0x47a9a4[_0x1071('0x41')],null))['then'](respondWithResult(_0x13d33a,null))[_0x1071('0x40')](handleError(_0x13d33a,null));};exports[_0x1071('0x43')]=function(_0xb9230b,_0x18b231){return db[_0x1071('0x38')]['find']({'where':{'id':_0xb9230b['params']['id']}})[_0x1071('0x20')](handleEntityNotFound(_0x18b231,null))[_0x1071('0x20')](removeEntity(_0x18b231,null))['catch'](handleError(_0x18b231,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 5103f1a..23159e0 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 _0x562f=['path','rimraf','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise'];(function(_0x1f0ca7,_0x403fe9){var _0x107ec2=function(_0x12f7af){while(--_0x12f7af){_0x1f0ca7['push'](_0x1f0ca7['shift']());}};_0x107ec2(++_0x403fe9);}(_0x562f,0x113));var _0xf562=function(_0x32e264,_0x41cee8){_0x32e264=_0x32e264-0x0;var _0x1d7175=_0x562f[_0x32e264];return _0x1d7175;};'use strict';var _=require(_0xf562('0x0'));var util=require(_0xf562('0x1'));var logger=require(_0xf562('0x2'))(_0xf562('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf562('0x4'));var fs=require('fs');var path=require(_0xf562('0x5'));var rimraf=require(_0xf562('0x6'));var config=require(_0xf562('0x7'));var attributes=require(_0xf562('0x8'));module['exports']=function(_0x14c2e6,_0x5b6de2){return _0x14c2e6[_0xf562('0x9')](_0xf562('0xa'),attributes,{'tableName':_0xf562('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf562('0xc'),'collate':_0xf562('0xd')});}; \ No newline at end of file +var _0x39f8=['WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','moment','bluebird','request-promise','rimraf','./whatsappApplication.attributes','exports','define'];(function(_0x5a3c7b,_0x3fad44){var _0x5763f5=function(_0x238f9b){while(--_0x238f9b){_0x5a3c7b['push'](_0x5a3c7b['shift']());}};_0x5763f5(++_0x3fad44);}(_0x39f8,0x88));var _0x839f=function(_0x54ae90,_0x2be4a3){_0x54ae90=_0x54ae90-0x0;var _0x25ed9e=_0x39f8[_0x54ae90];return _0x25ed9e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x839f('0x0'));var BPromise=require(_0x839f('0x1'));var rp=require(_0x839f('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x839f('0x3'));var config=require('../../config/environment');var attributes=require(_0x839f('0x4'));module[_0x839f('0x5')]=function(_0x11f576,_0x440c9f){return _0x11f576[_0x839f('0x6')](_0x839f('0x7'),attributes,{'tableName':_0x839f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x839f('0x9'),'collate':_0x839f('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 127395a..e4de0f3 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 _0x038b=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis'];(function(_0x28e30a,_0x514484){var _0x1aa1f3=function(_0x4c6a59){while(--_0x4c6a59){_0x28e30a['push'](_0x28e30a['shift']());}};_0x1aa1f3(++_0x514484);}(_0x038b,0x114));var _0xb038=function(_0x801694,_0x4d67ed){_0x801694=_0x801694-0x0;var _0x535b24=_0x038b[_0x801694];return _0x535b24;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var moment=require(_0xb038('0x1'));var BPromise=require(_0xb038('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb038('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb038('0x4'));var logger=require(_0xb038('0x5'))('rpc');var config=require(_0xb038('0x6'));var jayson=require(_0xb038('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e3e64,_0x1b077a,_0x1534a9){return new BPromise(function(_0x4b4085,_0x48a4d7){return client[_0xb038('0x8')](_0x2e3e64,_0x1534a9)[_0xb038('0x9')](function(_0x4d85b4){logger['info'](_0xb038('0xa'),_0x1b077a,_0xb038('0xb'));logger['debug'](_0xb038('0xc'),_0x1b077a,_0xb038('0xb'),JSON[_0xb038('0xd')](_0x4d85b4));if(_0x4d85b4[_0xb038('0xe')]){if(_0x4d85b4[_0xb038('0xe')][_0xb038('0xf')]===0x1f4){logger[_0xb038('0xe')](_0xb038('0xa'),_0x1b077a,_0x4d85b4[_0xb038('0xe')][_0xb038('0x10')]);return _0x48a4d7(_0x4d85b4[_0xb038('0xe')][_0xb038('0x10')]);}logger[_0xb038('0xe')](_0xb038('0xa'),_0x1b077a,_0x4d85b4[_0xb038('0xe')][_0xb038('0x10')]);return _0x4b4085(_0x4d85b4[_0xb038('0xe')]['message']);}else{logger[_0xb038('0x11')](_0xb038('0xa'),_0x1b077a,_0xb038('0xb'));_0x4b4085(_0x4d85b4[_0xb038('0x12')][_0xb038('0x10')]);}})[_0xb038('0x13')](function(_0x5246c3){logger[_0xb038('0xe')](_0xb038('0xa'),_0x1b077a,_0x5246c3);_0x48a4d7(_0x5246c3);});});} \ No newline at end of file +var _0xbff5=['message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','WhatsappApplication,\x20%s,\x20%s','request\x20sent','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xbff5,0x1bc));var _0x5bff=function(_0x517341,_0x525715){_0x517341=_0x517341-0x0;var _0x2bf848=_0xbff5[_0x517341];return _0x2bf848;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var moment=require(_0x5bff('0x2'));var BPromise=require(_0x5bff('0x3'));var rs=require(_0x5bff('0x4'));var fs=require('fs');var Redis=require(_0x5bff('0x5'));var db=require(_0x5bff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bff('0x8'));var client=jayson[_0x5bff('0x9')][_0x5bff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa54c57,_0x43605a,_0xd4b9dc){return new BPromise(function(_0x1acb49,_0x139c99){return client[_0x5bff('0xb')](_0xa54c57,_0xd4b9dc)['then'](function(_0x20e26f){logger['info'](_0x5bff('0xc'),_0x43605a,_0x5bff('0xd'));logger['debug'](_0x5bff('0xe'),_0x43605a,'request\x20sent',JSON[_0x5bff('0xf')](_0x20e26f));if(_0x20e26f['error']){if(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x11')]===0x1f4){logger['error'](_0x5bff('0xc'),_0x43605a,_0x20e26f['error'][_0x5bff('0x12')]);return _0x139c99(_0x20e26f[_0x5bff('0x10')]['message']);}logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x20e26f['error']['message']);return _0x1acb49(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x12')]);}else{logger[_0x5bff('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x43605a,_0x5bff('0xd'));_0x1acb49(_0x20e26f[_0x5bff('0x14')][_0x5bff('0x12')]);}})['catch'](function(_0x3ffbbc){logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x3ffbbc);_0x139c99(_0x3ffbbc);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index f201723..a2c87e4 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 _0x3d68=['whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','whatsapp'];(function(_0x576cac,_0x11925a){var _0x375683=function(_0xd7952f){while(--_0xd7952f){_0x576cac['push'](_0x576cac['shift']());}};_0x375683(++_0x11925a);}(_0x3d68,0x107));var _0x83d6=function(_0xc6a026,_0x2078c0){_0xc6a026=_0xc6a026-0x0;var _0x3bb9eb=_0x3d68[_0xc6a026];return _0x3bb9eb;};'use strict';var multer=require(_0x83d6('0x0'));var util=require(_0x83d6('0x1'));var path=require(_0x83d6('0x2'));var timeout=require(_0x83d6('0x3'));var express=require(_0x83d6('0x4'));var router=express[_0x83d6('0x5')]();var auth=require(_0x83d6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x83d6('0x7'));var controller=require('./whatsappInteraction.controller');router[_0x83d6('0x8')]('/',auth[_0x83d6('0x9')](),controller[_0x83d6('0xa')]);router[_0x83d6('0x8')]('/describe',auth[_0x83d6('0x9')](),controller[_0x83d6('0xb')]);router['get'](_0x83d6('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x83d6('0x8')](_0x83d6('0xd'),auth[_0x83d6('0x9')](),controller[_0x83d6('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x83d6('0xf')]);router[_0x83d6('0x10')]('/',auth[_0x83d6('0x9')](),controller[_0x83d6('0x11')]);router[_0x83d6('0x10')](_0x83d6('0xd'),auth[_0x83d6('0x9')](),controller[_0x83d6('0x12')]);router[_0x83d6('0x10')](_0x83d6('0x13'),auth['isAuthenticated'](),interaction[_0x83d6('0x14')]('whatsapp',_0x83d6('0x15')),controller[_0x83d6('0x16')]);router[_0x83d6('0x17')](_0x83d6('0xc'),auth[_0x83d6('0x9')](),interaction[_0x83d6('0x14')](_0x83d6('0x18'),_0x83d6('0x19')),controller[_0x83d6('0x1a')]);router[_0x83d6('0x1b')](_0x83d6('0xc'),auth['isAuthenticated'](),interaction[_0x83d6('0x14')](_0x83d6('0x18'),_0x83d6('0x1c')),controller[_0x83d6('0x1d')]);router[_0x83d6('0x1b')](_0x83d6('0x13'),auth[_0x83d6('0x9')](),controller[_0x83d6('0x1e')]);module[_0x83d6('0x1f')]=router; \ No newline at end of file +var _0x1235=['delete','/:id','whatsappinteraction:destroy','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','put','whatsapp','update'];(function(_0x2aa5df,_0x5e298a){var _0xc8062a=function(_0x2e1e86){while(--_0x2e1e86){_0x2aa5df['push'](_0x2aa5df['shift']());}};_0xc8062a(++_0x5e298a);}(_0x1235,0xe4));var _0x5123=function(_0x3ed4e2,_0x28398b){_0x3ed4e2=_0x3ed4e2-0x0;var _0x367683=_0x1235[_0x3ed4e2];return _0x367683;};'use strict';var multer=require(_0x5123('0x0'));var util=require(_0x5123('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5123('0x2'));var router=express[_0x5123('0x3')]();var auth=require(_0x5123('0x4'));var interaction=require(_0x5123('0x5'));var config=require('../../config/environment');var controller=require(_0x5123('0x6'));router[_0x5123('0x7')]('/',auth[_0x5123('0x8')](),controller[_0x5123('0x9')]);router['get'](_0x5123('0xa'),auth['isAuthenticated'](),controller[_0x5123('0xb')]);router[_0x5123('0x7')]('/:id',auth[_0x5123('0x8')](),controller[_0x5123('0xc')]);router[_0x5123('0x7')](_0x5123('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0x5123('0x7')](_0x5123('0xe'),auth[_0x5123('0x8')](),controller[_0x5123('0xf')]);router['post']('/',auth[_0x5123('0x8')](),controller['create']);router[_0x5123('0x10')](_0x5123('0xd'),auth[_0x5123('0x8')](),controller[_0x5123('0x11')]);router['post'](_0x5123('0x12'),auth[_0x5123('0x8')](),interaction[_0x5123('0x13')]('whatsapp',_0x5123('0x14')),controller['addTags']);router[_0x5123('0x15')]('/:id',auth[_0x5123('0x8')](),interaction[_0x5123('0x13')](_0x5123('0x16'),'whatsappinteraction:update'),controller[_0x5123('0x17')]);router[_0x5123('0x18')](_0x5123('0x19'),auth[_0x5123('0x8')](),interaction[_0x5123('0x13')](_0x5123('0x16'),_0x5123('0x1a')),controller[_0x5123('0x1b')]);router[_0x5123('0x18')](_0x5123('0x12'),auth[_0x5123('0x8')](),controller['removeTags']);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 67e946a..d9428f0 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 _0xab21=['ENUM','out','moment','exports','BOOLEAN','STRING','DATE'];(function(_0x4f754b,_0x1c6457){var _0x545c6e=function(_0x16e067){while(--_0x16e067){_0x4f754b['push'](_0x4f754b['shift']());}};_0x545c6e(++_0x1c6457);}(_0xab21,0x1ad));var _0x1ab2=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xab21[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1ab2('0x0'));module[_0x1ab2('0x1')]={'closed':{'type':Sequelize[_0x1ab2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1ab2('0x3')]},'note':{'type':Sequelize[_0x1ab2('0x3')]},'phone':{'type':Sequelize[_0x1ab2('0x3')]},'read1stAt':{'type':Sequelize[_0x1ab2('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1ab2('0x5')]('in',_0x1ab2('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1ab2('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1ab2('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x6ac1=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x5ecbd3,_0x4dc5f8){var _0x358764=function(_0x5dae5f){while(--_0x5dae5f){_0x5ecbd3['push'](_0x5ecbd3['shift']());}};_0x358764(++_0x4dc5f8);}(_0x6ac1,0x105));var _0x16ac=function(_0xdbbdc2,_0x16a3be){_0xdbbdc2=_0xdbbdc2-0x0;var _0x20f387=_0x6ac1[_0xdbbdc2];return _0x20f387;};'use strict';var Sequelize=require(_0x16ac('0x0'));var moment=require('moment');module[_0x16ac('0x1')]={'closed':{'type':Sequelize[_0x16ac('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x16ac('0x3')]},'disposition':{'type':Sequelize[_0x16ac('0x4')]},'note':{'type':Sequelize[_0x16ac('0x4')]},'phone':{'type':Sequelize[_0x16ac('0x4')]},'read1stAt':{'type':Sequelize[_0x16ac('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x16ac('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x16ac('0x5')]('in',_0x16ac('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index becc203..a22b2ee 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 _0x7a54=['attachments','Attachment','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','30px','%s\x20#%d','Whatsapp','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','select','color','tools_tags','u.id','field','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','buildExpression','start','body','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','rows','show','params','includeAll','include','WhatsappInteraction','create','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','format','options','findAll','emit','removeTags','unix','root','files','tmp','server','join','transcript-%d-%s.zip','User','firstName','lastName'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x7a54,0x106));var _0x47a5=function(_0x581e43,_0x33fd0e){_0x581e43=_0x581e43-0x0;var _0xe72df7=_0x7a54[_0x581e43];return _0xe72df7;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');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 db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}function getInteractionUsers(_0x136b14,_0x16631f){return new BPromise(function(_0x361bfa,_0x1127f8){try{if(_0x16631f[_0x136b14['id']]){_0x136b14[_0x47a5('0x2b')]=_[_0x47a5('0x2c')](_0x16631f[_0x136b14['id']],function(_0x528582){return{'id':_0x528582['id'],'fullname':_0x528582[_0x47a5('0x2d')]};});}}catch(_0x51833b){_0x1127f8(_0x51833b);}_0x361bfa(_0x136b14);});}function getInteractionTags(_0x2ef875,_0x9ac908){return new BPromise(function(_0x16901f,_0x4d6b57){try{if(_0x2ef875[_0x47a5('0x2e')]){_0x2ef875[_0x47a5('0x2f')]=[];_0x2ef875[_0x47a5('0x2e')][_0x47a5('0x30')](',')['forEach'](function(_0x50d875){_0x2ef875[_0x47a5('0x2f')][_0x47a5('0x31')](_0x9ac908[_0x50d875]);});}delete _0x2ef875['TagIds'];}catch(_0x4e1006){_0x4d6b57(_0x4e1006);}_0x16901f(_0x2ef875);});}function updateWhatsappInteraction(_0x836303,_0x51544e,_0x57bff6){return new BPromise(function(_0x42f70c,_0x53119b){return getInteractionUsers(_0x836303,_0x57bff6)[_0x47a5('0x26')](function(_0xd972c){return getInteractionTags(_0xd972c,_0x51544e);})['then'](function(_0x4843c0){_0x42f70c(_0x4843c0);})[_0x47a5('0x32')](function(_0x5910bb){_0x53119b(_0x5910bb);});});}exports[_0x47a5('0x33')]=function(_0x87e4c9,_0xf269a8){var _0x52749b={},_0x18f7e9={},_0x50c086={'count':0x0,'rows':[]};var _0x53c754=_[_0x47a5('0x2c')](db['WhatsappInteraction'][_0x47a5('0x34')],function(_0x5ef577){return{'name':_0x5ef577[_0x47a5('0x35')],'type':_0x5ef577[_0x47a5('0x36')][_0x47a5('0x37')]};});_0x18f7e9[_0x47a5('0x38')]=_[_0x47a5('0x2c')](_0x53c754,_0x47a5('0x29'));_0x18f7e9[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x87e4c9[_0x47a5('0x39')]);_0x18f7e9['filters']=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],_0x18f7e9['query']);_0x52749b[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],qs['fields'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x3d')]));_0x52749b['attributes']=_0x52749b[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x52749b['attributes']:_0x18f7e9['model'];if(!_0x87e4c9['query'][_0x47a5('0x3f')]('nolimit')){_0x52749b[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1f')]);_0x52749b[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x52749b[_0x47a5('0x40')]=qs[_0x47a5('0x41')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x41')]);_0x52749b[_0x47a5('0x42')]=qs['filters'](_[_0x47a5('0x43')](_0x87e4c9[_0x47a5('0x39')],_0x18f7e9[_0x47a5('0x44')]),_0x53c754);var _0x23bd8d=[];var _0x586f4f=squel[_0x47a5('0x45')]()['field']('id')['field']('name')['field'](_0x47a5('0x46'))['from'](_0x47a5('0x47'));var _0x3a740b=squel[_0x47a5('0x45')]()['field'](_0x47a5('0x48'))[_0x47a5('0x49')]('u.fullname')['field'](_0x47a5('0x4a'))['from'](_0x47a5('0x4b'),'ui')[_0x47a5('0x4c')](_0x47a5('0x4d'),'u',_0x47a5('0x4e'));var _0x34a9ae=squel[_0x47a5('0x45')]()[_0x47a5('0x4f')](_0x47a5('0x50'),'i')[_0x47a5('0x4c')](_0x47a5('0x51'),'c',_0x47a5('0x52'))[_0x47a5('0x4c')](_0x47a5('0x4d'),'o',_0x47a5('0x53'))[_0x47a5('0x4c')](_0x47a5('0x54'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x47a5('0x4c')](_0x47a5('0x55'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x47a5('0x56'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x47a5('0x4c')](_0x47a5('0x47'),'t','t.id\x20=\x20it.TagId');var _0x4f62d3=squel[_0x47a5('0x57')]();var _0x52d409=[];var _0x2d147c=squel[_0x47a5('0x57')]();var _0x3548bc;if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x58')]){_0x3548bc=as[_0x47a5('0x59')](_0x87e4c9[_0x47a5('0x39')]['search']);var _0x48a0ef=_0x3548bc[_0x47a5('0x5a')];for(var _0x411230=0x0;_0x411230<_0x3548bc[_0x47a5('0x5b')][_0x47a5('0x3e')];_0x411230++){var _0x2c7020=_0x3548bc[_0x47a5('0x5b')][_0x411230];var _0x249de5='i';var _0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x2c7020[_0x47a5('0x49')]]);if(!_0x492cf7){switch(_0x2c7020['field']){case _0x47a5('0x5d'):if(_0x2c7020['value']==0x1){_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020[_0x47a5('0x49')]+_0x47a5('0x5f'));}else{_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020['field']+_0x47a5('0x60'));}break;case _0x47a5('0x61'):if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){if(_0x2c7020[_0x47a5('0x64')][_0x47a5('0x30')]('\x20')[_0x47a5('0x3e')]>0x1){_0x4f62d3[_0x48a0ef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x47a5('0x65')](_0x2c7020[_0x47a5('0x64')]),null);}else{var _0x187d7e='%'+_0x2c7020[_0x47a5('0x64')]+'%';_0x4f62d3[_0x48a0ef](_0x47a5('0x66'),_0x187d7e,_0x187d7e,_0x187d7e);}}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,['name',_0x47a5('0x67')]);_0x2c7020[_0x47a5('0x49')]=_0x47a5('0x67');_0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x69'):var _0x4fa1da=_0x2c7020['value'][_0x47a5('0x30')](',')['map'](function(_0x16bb8a){return Number(_0x16bb8a);});_0x4fa1da['forEach'](function(_0x482de6){_0x2d147c['or'](_0x47a5('0x6a'),'%,'+_0x482de6+',%');});_0x52d409=_[_0x47a5('0x6b')](_0x52d409,_0x4fa1da);break;case'User':if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){_0x4f62d3[_0x48a0ef]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2c7020['value']+'%',null);}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x47a5('0x6c')]);_0x2c7020[_0x47a5('0x49')]='UserId';_0x5cbe97=as[_0x47a5('0x6d')](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97['value'][_0x47a5('0x6e')],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x6f'):_0x5cbe97=as[_0x47a5('0x6d')]('me',null,_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97[_0x47a5('0x64')]['end']);break;}}else{var _0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7['type'],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')][_0x47a5('0x6e')],_0x5cbe97['value']['end']);}}}else{var _0x139229=_(_0x87e4c9[_0x47a5('0x39')])[_0x47a5('0x3a')]()[_0x47a5('0x2c')](function(_0xc45e25){return _['some'](_0x53c754,[_0x47a5('0x29'),_0xc45e25])?_0xc45e25:undefined;})['compact']()[_0x47a5('0x64')]();if(!_[_0x47a5('0x70')](_0x139229)){_0x139229['forEach'](function(_0x32b4de){if(_0x32b4de===_0x47a5('0x71')){_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x72'),[][_0x47a5('0x73')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de]));}else if(_0x32b4de===_0x47a5('0x74')){var _0x3ac38c=JSON['parse'](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])[_0x47a5('0x75')];var _0x3c75c6=JSON[_0x47a5('0x76')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])['$lte'];_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x77'),_0x3ac38c,_0x3c75c6);}else{if(_0x87e4c9[_0x47a5('0x39')][_0x32b4de]===_0x47a5('0x78')){_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x79'));}else{_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x7a'),_0x87e4c9[_0x47a5('0x39')][_0x32b4de]);}}});}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]==0x1){_0x34a9ae[_0x47a5('0x5e')](_0x47a5('0x7c'));}else{_0x34a9ae['having'](_0x47a5('0x7d'));}}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]){_0x52d409=_['isArray'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')])?_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]:new Array(_0x87e4c9['query'][_0x47a5('0x7e')]);_0x52d409['forEach'](function(_0x2d5ee6){_0x2d147c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2d5ee6+',%');});}if(_0x87e4c9[_0x47a5('0x39')]['filter']){var _0x7c1190=_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7f')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x47a5('0x80')](_0x7c1190)){_0x4f62d3['or'](_0x47a5('0x81'),_0x7c1190+'%')['or'](_0x47a5('0x82'),_0x7c1190+'%');}else{_0x4f62d3['or'](_0x47a5('0x83'),qs['getFullTextValue'](_0x7c1190))['or'](_0x47a5('0x84'),_0x7c1190+'%');}}}_0x34a9ae[_0x47a5('0x42')](_0x4f62d3);_0x34a9ae[_0x47a5('0x85')](_0x47a5('0x86'));var _0x308c9a={'type':db[_0x47a5('0x87')][_0x47a5('0x88')][_0x47a5('0x89')],'raw':!![]};var _0x4618a0=_0x34a9ae[_0x47a5('0x8a')]();_0x4618a0[_0x47a5('0x49')](_0x47a5('0x86'));_0x4618a0['field'](_0x47a5('0x8b'),'unreadMessages');if(_0x52749b[_0x47a5('0x40')]){_0x52749b[_0x47a5('0x40')][_0x47a5('0x8c')](function(_0x12fec9){_0x34a9ae[_0x47a5('0x40')]('i.'+_0x12fec9[0x0],_0x12fec9[0x1]===_0x47a5('0x8d')?![]:!![]);});}if(!_[_0x47a5('0x70')](_0x52d409)){_0x34a9ae[_0x47a5('0x5e')](_0x2d147c);_0x4618a0[_0x47a5('0x42')](_0x47a5('0x8e'),_0x52d409);}BPromise[_0x47a5('0x8f')]()[_0x47a5('0x26')](function(){if(!_0x3548bc){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x71')]||_0x87e4c9[_0x47a5('0x39')]['journey'])return;_0x4618a0['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x34a9ae['where'](_0x47a5('0x90'));return;}return _0x87e4c9[_0x47a5('0x91')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x47a5('0x26')](function(_0x44dda2){if(_[_0x47a5('0x70')](_0x44dda2)){_0x4618a0[_0x47a5('0x42')](_0x47a5('0x92'));_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x92'));}else{_0x4618a0[_0x47a5('0x42')](_0x47a5('0x72'),_[_0x47a5('0x2c')](_0x44dda2,'id'));_0x34a9ae[_0x47a5('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0x47a5('0x2c')](_0x44dda2,'id'));}});})[_0x47a5('0x26')](function(){db[_0x47a5('0x93')]['query'](_0x4618a0[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x17b61d){_0x50c086['count']=_0x17b61d[_0x47a5('0x3e')];if(_0x50c086['count']===0x0)return[];return db['sequelize'][_0x47a5('0x39')](_0x586f4f[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x27333e){_0x23bd8d=_[_0x47a5('0x95')](_0x27333e,'id');_0x308c9a=_[_0x47a5('0x96')](_0x308c9a,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x87e4c9['query'][_0x47a5('0x3d')]){_0x52749b['attributes'][_0x47a5('0x8c')](function(_0x3fffd1){_0x34a9ae[_0x47a5('0x49')]('i.'+_0x3fffd1);});}else{_0x34a9ae[_0x47a5('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x47a5('0x5d'));_0x34a9ae['field']('a.key',_0x47a5('0x97'));_0x34a9ae[_0x47a5('0x49')]('a.mandatoryDisposition',_0x47a5('0x98'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x99'));_0x34a9ae['field'](_0x47a5('0x9a'),'Contact.firstName');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x9b'),_0x47a5('0x9c'));_0x34a9ae['field'](_0x47a5('0x9d'),_0x47a5('0x9e'));_0x34a9ae[_0x47a5('0x49')]('c.phone',_0x47a5('0x9f'));_0x34a9ae['field'](_0x47a5('0xa0'),'Contact.mobile');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa1'),_0x47a5('0xa2'));_0x34a9ae[_0x47a5('0x49')]('o.fullname',_0x47a5('0xa3'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa4'),_0x47a5('0xa5'));_0x34a9ae[_0x47a5('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x52749b[_0x47a5('0x1f')])_0x34a9ae['limit'](_0x52749b[_0x47a5('0x1f')]);if(_0x52749b[_0x47a5('0x1e')])_0x34a9ae[_0x47a5('0x1e')](_0x52749b['offset']);return db[_0x47a5('0x93')][_0x47a5('0x39')](_0x34a9ae['toString'](),_0x308c9a);})[_0x47a5('0x26')](function(_0x8a9dea){_0x3a740b[_0x47a5('0x42')](_0x47a5('0xa6'),_['map'](_0x8a9dea,'id'));return db['sequelize'][_0x47a5('0x39')](_0x3a740b[_0x47a5('0x94')](),_0x308c9a)['then'](function(_0x27d422){var _0x23f055=_['groupBy'](_0x27d422,_0x47a5('0xa7'));var _0x2a02cd=[];_0x8a9dea[_0x47a5('0x8c')](function(_0x59f010){_0x2a02cd[_0x47a5('0x31')](updateWhatsappInteraction(_0x59f010,_0x23bd8d,_0x23f055));});return BPromise['all'](_0x2a02cd);});});})[_0x47a5('0x26')](function(_0x5e2946){_0x50c086[_0x47a5('0xa8')]=_0x5e2946;return _0x50c086;})[_0x47a5('0x26')](respondWithFilteredResult(_0xf269a8,_0x52749b));})['catch'](handleError(_0xf269a8,null));};exports[_0x47a5('0xa9')]=function(_0x597cb2,_0x1eabef){var _0x36f619={'raw':![],'where':{'id':_0x597cb2[_0x47a5('0xaa')]['id']}},_0x37e045={};_0x37e045['model']=_[_0x47a5('0x3a')](db['WhatsappInteraction']['rawAttributes']);_0x37e045[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x597cb2[_0x47a5('0x39')]);_0x37e045[_0x47a5('0x44')]=_[_0x47a5('0x3b')](_0x37e045['model'],_0x37e045[_0x47a5('0x39')]);_0x36f619[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x37e045[_0x47a5('0x38')],qs['fields'](_0x597cb2[_0x47a5('0x39')]['fields']));_0x36f619[_0x47a5('0x3c')]=_0x36f619[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x36f619[_0x47a5('0x3c')]:_0x37e045[_0x47a5('0x38')];if(_0x597cb2[_0x47a5('0x39')][_0x47a5('0xab')]){_0x36f619[_0x47a5('0xac')]=[{'all':!![]}];}_0x36f619=_[_0x47a5('0x96')]({},_0x36f619,_0x597cb2['options']);return db[_0x47a5('0xad')][_0x47a5('0x5c')](_0x36f619)['then'](handleEntityNotFound(_0x1eabef,null))[_0x47a5('0x26')](respondWithResult(_0x1eabef,null))[_0x47a5('0x32')](handleError(_0x1eabef,null));};exports[_0x47a5('0xae')]=function(_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0xad')][_0x47a5('0xae')](_0x5b85cd['body'],{})['then'](respondWithResult(_0x4bf1f5,0xc9))[_0x47a5('0x32')](handleError(_0x4bf1f5,null));};exports[_0x47a5('0x24')]=function(_0x54eab1,_0x29e384){if(_0x54eab1[_0x47a5('0x6f')]['id']){delete _0x54eab1['body']['id'];}return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x54eab1[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x29e384,null))[_0x47a5('0x26')](saveUpdates(_0x54eab1[_0x47a5('0x6f')],null))['then'](respondWithResult(_0x29e384,null))['catch'](handleError(_0x29e384,null));};exports['destroy']=function(_0x133b7a,_0xce5ada){return db['WhatsappInteraction'][_0x47a5('0x5c')]({'where':{'id':_0x133b7a[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0xce5ada,null))[_0x47a5('0x26')](removeEntity(_0xce5ada,null))[_0x47a5('0x32')](handleError(_0xce5ada,null));};exports['describe']=function(_0x3e7750,_0x548a06){return db['WhatsappInteraction']['describe']()[_0x47a5('0x26')](respondWithResult(_0x548a06,null))['catch'](handleError(_0x548a06,null));};exports[_0x47a5('0xaf')]=function(_0xf3edc8,_0x5a316e,_0x49f791){return db[_0x47a5('0xb0')][_0x47a5('0x5c')]({'where':{'id':_0xf3edc8[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x5a316e,null))[_0x47a5('0x26')](function(_0x581a87){if(_0x581a87){return _0x581a87[_0x47a5('0xaf')](_0xf3edc8[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0xf3edc8[_0x47a5('0x6f')],[_0x47a5('0xb2'),'id'])||{});}})[_0x47a5('0x26')](respondWithResult(_0x5a316e,null))[_0x47a5('0x32')](handleError(_0x5a316e,null));};exports[_0x47a5('0xb3')]=function(_0x5112d7,_0x6a8174,_0x2e418d){var _0x50b236={'raw':![],'where':{}};var _0x263521={};var _0x9769b5={'count':0x0,'rows':[]};return db[_0x47a5('0xad')][_0x47a5('0xb4')]({'where':{'id':_0x5112d7['params']['id']}})['then'](handleEntityNotFound(_0x6a8174,null))['then'](function(_0x4eee99){if(_0x4eee99){_0x263521[_0x47a5('0x38')]=_[_0x47a5('0x3a')](db[_0x47a5('0xb0')][_0x47a5('0x34')]);_0x263521[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x5112d7[_0x47a5('0x39')]);_0x263521[_0x47a5('0x44')]=_['intersection'](_0x263521[_0x47a5('0x38')],_0x263521[_0x47a5('0x39')]);_0x50b236[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x263521['model'],qs['fields'](_0x5112d7[_0x47a5('0x39')]['fields']));_0x50b236['attributes']=_0x50b236[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x50b236['attributes']:_0x263521[_0x47a5('0x38')];if(!_0x5112d7[_0x47a5('0x39')][_0x47a5('0x3f')]('nolimit')){_0x50b236[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x5112d7['query'][_0x47a5('0x1f')]);_0x50b236[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x5112d7[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x50b236[_0x47a5('0x40')]=qs['sort'](_0x5112d7[_0x47a5('0x39')]['sort']);_0x50b236[_0x47a5('0x42')]=qs[_0x47a5('0x44')](_[_0x47a5('0x43')](_0x5112d7[_0x47a5('0x39')],_0x263521['filters']));_0x50b236[_0x47a5('0x42')][_0x47a5('0xa7')]=_0x4eee99['id'];if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x7f')]){_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],{'$or':_[_0x47a5('0x2c')](_0x50b236[_0x47a5('0x3c')],function(_0xa2045c){var _0x109738={};_0x109738[_0xa2045c]={'$like':'%'+_0x5112d7[_0x47a5('0x39')]['filter']+'%'};return _0x109738;})});}if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')]){var _0x591bde=_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')][_0x47a5('0x30')](',');var _0x2ccf21={};_0x2ccf21[_0x591bde[0x0]]={'$gte':moment(_0x591bde[0x1])[_0x47a5('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],_0x2ccf21);}_0x50b236=_[_0x47a5('0x96')]({},_0x50b236,_0x5112d7[_0x47a5('0xb6')]);return db[_0x47a5('0xb0')][_0x47a5('0x1d')]({'where':_0x50b236['where']})['then'](function(_0xa3d578){_0x9769b5['count']=_0xa3d578;if(_0x5112d7[_0x47a5('0x39')]['includeAll']){_0x50b236[_0x47a5('0xac')]=[{'all':!![]}];}return db[_0x47a5('0xb0')][_0x47a5('0xb7')](_0x50b236);})[_0x47a5('0x26')](function(_0x49cb8c){_0x9769b5[_0x47a5('0xa8')]=_0x49cb8c;return _0x9769b5;});}})[_0x47a5('0x26')](respondWithFilteredResult(_0x6a8174,_0x50b236))[_0x47a5('0x32')](handleError(_0x6a8174,null));};exports['addTags']=function(_0x581759,_0x30375f,_0x29015a){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x581759[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x30375f,null))[_0x47a5('0x26')](function(_0xe662d7){if(_0xe662d7){return _0xe662d7['setTags'](_0x581759[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0x581759[_0x47a5('0x6f')],['ids','id'])||{})['spread'](function(){return db[_0x47a5('0x69')][_0x47a5('0xb7')]({'attributes':['id','name',_0x47a5('0x46')],'where':{'id':_0x581759[_0x47a5('0x6f')][_0x47a5('0xb2')]}});})[_0x47a5('0x26')](function(_0x5a7f32){socket[_0x47a5('0xb8')]('whatsappInteractionTags:save',{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]});return{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]};});}})[_0x47a5('0x26')](respondWithResult(_0x30375f,null))['catch'](handleError(_0x30375f,null));};exports[_0x47a5('0xb9')]=function(_0x156d51,_0x401139,_0x2005d5){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x156d51[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x401139,null))[_0x47a5('0x26')](function(_0x2200f9){if(_0x2200f9){return _0x2200f9[_0x47a5('0xb9')](_0x156d51[_0x47a5('0x39')][_0x47a5('0xb2')]);}})[_0x47a5('0x26')](respondWithStatusCode(_0x401139,null))[_0x47a5('0x32')](handleError(_0x401139,null));};exports['download']=function(_0xdd95c8,_0x40aee5){var _0x322cee=moment()[_0x47a5('0xba')]()['toString']();var _0x367662=path['join'](config[_0x47a5('0xbb')],'server',_0x47a5('0xbc'),_0x47a5('0xbd'));var _0x3b894d=path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xbc'),'attachments');var _0x52798d=path[_0x47a5('0xbf')](_0x367662,_0x322cee);var _0x1a5e07=util[_0x47a5('0xb5')](_0x47a5('0xc0'),_0xdd95c8[_0x47a5('0xaa')]['id'],_0x322cee);var _0x579e5c=path[_0x47a5('0xbf')](_0x367662,_0x1a5e07);var _0x4b3ae4=[];_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc1')],'as':_0x47a5('0xc1'),'attributes':['id',_0x47a5('0x2d')],'raw':!![]});_0x4b3ae4['push']({'model':db['CmContact'],'as':_0x47a5('0x61'),'attributes':['id',_0x47a5('0xc2'),_0x47a5('0xc3')],'raw':!![]});if(_0xdd95c8[_0x47a5('0x39')][_0x47a5('0xc4')]){_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc5')],'as':_0x47a5('0xc5'),'raw':!![]});}var _0x2c2245=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x47a5('0x6f'),'createdAt',_0x47a5('0xc6'),_0x47a5('0xc7'),_0x47a5('0x7b')],'include':_0x4b3ae4}];_0x2c2245['push']({'model':db[_0x47a5('0xc8')],'as':_0x47a5('0xc9'),'attributes':['id','name']});_0x2c2245[_0x47a5('0x31')]({'model':db['User'],'as':_0x47a5('0xca'),'attributes':['id',_0x47a5('0x2d')]});return db[_0x47a5('0xad')]['find']({'where':{'id':_0xdd95c8['params']['id']},'include':_0x2c2245})['then'](handleEntityNotFound(_0x40aee5,null))['then'](function(_0x5075a6){if(_0x5075a6){var _0x1ba5b6=_0x5075a6['get']({'plain':!![]});fs[_0x47a5('0xcb')](_0x52798d);var _0x2287b0={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x47a5('0xcc'),'contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0x47a5('0xcd'),_0x47a5('0xce'),_0x1ba5b6['id']),moment()[_0x47a5('0xb5')](_0x47a5('0xcf'))['toString']())}}};var _0xdda046={'channel':'Whatsapp','account':_0x1ba5b6[_0x47a5('0xc9')]['name'],'agent':_0x1ba5b6[_0x47a5('0xca')]?_0x1ba5b6[_0x47a5('0xca')][_0x47a5('0x2d')]:'N.A.','createdAt':moment(_0x1ba5b6[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')](),'closedAt':_0x1ba5b6['closed']?moment(_0x1ba5b6[_0x47a5('0xd1')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')]():'','disposition':_0x1ba5b6[_0x47a5('0xd2')],'messages':_(_0x1ba5b6[_0x47a5('0xd3')])['filter']({'secret':![]})[_0x47a5('0x2c')](function(_0xe245ca){if(_0xe245ca[_0x47a5('0xc5')]){var _0xac8d4f=path[_0x47a5('0xbf')](_0x3b894d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]);if(fs[_0x47a5('0xd5')](_0xac8d4f)){fs[_0x47a5('0xd6')](_0xac8d4f)[_0x47a5('0xd7')](fs[_0x47a5('0xd8')](path[_0x47a5('0xbf')](_0x52798d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')])));}}return{'date':moment(_0xe245ca[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))['toString'](),'sender':_0xe245ca[_0x47a5('0xc6')]==='out'?_0xe245ca['User']?_0xe245ca[_0x47a5('0xc1')][_0x47a5('0x2d')]:_0x47a5('0xd9'):_0xe245ca['Contact'][_0x47a5('0xc2')]+(_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]?'\x20'+_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]:''),'body':_0xe245ca[_0x47a5('0xc5')]?_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]:_0xe245ca[_0x47a5('0x6f')],'direction':_0xe245ca[_0x47a5('0xc6')]===_0x47a5('0xda')?'A':'C','secret':_0xe245ca[_0x47a5('0xc7')],'read':_0xe245ca[_0x47a5('0x7b')],'attachment':_0xe245ca['Attachment']};})['value']()};return ejs[_0x47a5('0xdb')](path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xdc'),_0x47a5('0xdd')),{'interaction':_0xdda046})[_0x47a5('0x26')](function(_0x3708ea){return new BPromise(function(_0x583b37,_0x2b4039){pdf[_0x47a5('0xae')](_0x3708ea,_0x2287b0)[_0x47a5('0xde')](path['join'](_0x52798d,_0x47a5('0xdf')+_0x1ba5b6['id']+'-'+_0x322cee+_0x47a5('0xe0')),function(_0x3ecc41,_0x3e4148){if(_0x3ecc41)return _0x2b4039(_0x3ecc41);_0x583b37(_0x3e4148);});});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x23e649,_0x35e20f){zipdir(_0x52798d,{'saveTo':_0x579e5c},function(_0x46615a,_0xd6e255){if(_0x46615a)return _0x35e20f(_0x46615a);return _0x23e649(_0xd6e255);});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x1b91ad,_0x40b7a5){rimraf(_0x52798d,function(_0x28e998){if(_0x28e998)_0x40b7a5(_0x28e998);return _0x1b91ad();});});})[_0x47a5('0x26')](function(){return _0x40aee5[_0x47a5('0xe1')](_0x579e5c,_0x1a5e07,function(_0x3f7fdc){if(_0x3f7fdc){console[_0x47a5('0xe2')](_0x47a5('0xe3'),_0x3f7fdc);}else{fs[_0x47a5('0xe4')](_0x579e5c);}});});});}else{return _0x40aee5[_0x47a5('0x1a')](0xc8);}})[_0x47a5('0x32')](handleError(_0x40aee5,null));}; \ No newline at end of file +var _0x7a54=['attachments','Attachment','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','30px','%s\x20#%d','Whatsapp','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','select','color','tools_tags','u.id','field','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','buildExpression','start','body','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','rows','show','params','includeAll','include','WhatsappInteraction','create','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','format','options','findAll','emit','removeTags','unix','root','files','tmp','server','join','transcript-%d-%s.zip','User','firstName','lastName'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x7a54,0x106));var _0x47a5=function(_0x507301,_0x5234a7){_0x507301=_0x507301-0x0;var _0x4bfc1e=_0x7a54[_0x507301];return _0x4bfc1e;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');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 db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}function getInteractionUsers(_0x136b14,_0x16631f){return new BPromise(function(_0x361bfa,_0x1127f8){try{if(_0x16631f[_0x136b14['id']]){_0x136b14[_0x47a5('0x2b')]=_[_0x47a5('0x2c')](_0x16631f[_0x136b14['id']],function(_0x528582){return{'id':_0x528582['id'],'fullname':_0x528582[_0x47a5('0x2d')]};});}}catch(_0x51833b){_0x1127f8(_0x51833b);}_0x361bfa(_0x136b14);});}function getInteractionTags(_0x2ef875,_0x9ac908){return new BPromise(function(_0x16901f,_0x4d6b57){try{if(_0x2ef875[_0x47a5('0x2e')]){_0x2ef875[_0x47a5('0x2f')]=[];_0x2ef875[_0x47a5('0x2e')][_0x47a5('0x30')](',')['forEach'](function(_0x50d875){_0x2ef875[_0x47a5('0x2f')][_0x47a5('0x31')](_0x9ac908[_0x50d875]);});}delete _0x2ef875['TagIds'];}catch(_0x4e1006){_0x4d6b57(_0x4e1006);}_0x16901f(_0x2ef875);});}function updateWhatsappInteraction(_0x836303,_0x51544e,_0x57bff6){return new BPromise(function(_0x42f70c,_0x53119b){return getInteractionUsers(_0x836303,_0x57bff6)[_0x47a5('0x26')](function(_0xd972c){return getInteractionTags(_0xd972c,_0x51544e);})['then'](function(_0x4843c0){_0x42f70c(_0x4843c0);})[_0x47a5('0x32')](function(_0x5910bb){_0x53119b(_0x5910bb);});});}exports[_0x47a5('0x33')]=function(_0x87e4c9,_0xf269a8){var _0x52749b={},_0x18f7e9={},_0x50c086={'count':0x0,'rows':[]};var _0x53c754=_[_0x47a5('0x2c')](db['WhatsappInteraction'][_0x47a5('0x34')],function(_0x5ef577){return{'name':_0x5ef577[_0x47a5('0x35')],'type':_0x5ef577[_0x47a5('0x36')][_0x47a5('0x37')]};});_0x18f7e9[_0x47a5('0x38')]=_[_0x47a5('0x2c')](_0x53c754,_0x47a5('0x29'));_0x18f7e9[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x87e4c9[_0x47a5('0x39')]);_0x18f7e9['filters']=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],_0x18f7e9['query']);_0x52749b[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],qs['fields'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x3d')]));_0x52749b['attributes']=_0x52749b[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x52749b['attributes']:_0x18f7e9['model'];if(!_0x87e4c9['query'][_0x47a5('0x3f')]('nolimit')){_0x52749b[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1f')]);_0x52749b[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x52749b[_0x47a5('0x40')]=qs[_0x47a5('0x41')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x41')]);_0x52749b[_0x47a5('0x42')]=qs['filters'](_[_0x47a5('0x43')](_0x87e4c9[_0x47a5('0x39')],_0x18f7e9[_0x47a5('0x44')]),_0x53c754);var _0x23bd8d=[];var _0x586f4f=squel[_0x47a5('0x45')]()['field']('id')['field']('name')['field'](_0x47a5('0x46'))['from'](_0x47a5('0x47'));var _0x3a740b=squel[_0x47a5('0x45')]()['field'](_0x47a5('0x48'))[_0x47a5('0x49')]('u.fullname')['field'](_0x47a5('0x4a'))['from'](_0x47a5('0x4b'),'ui')[_0x47a5('0x4c')](_0x47a5('0x4d'),'u',_0x47a5('0x4e'));var _0x34a9ae=squel[_0x47a5('0x45')]()[_0x47a5('0x4f')](_0x47a5('0x50'),'i')[_0x47a5('0x4c')](_0x47a5('0x51'),'c',_0x47a5('0x52'))[_0x47a5('0x4c')](_0x47a5('0x4d'),'o',_0x47a5('0x53'))[_0x47a5('0x4c')](_0x47a5('0x54'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x47a5('0x4c')](_0x47a5('0x55'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x47a5('0x56'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x47a5('0x4c')](_0x47a5('0x47'),'t','t.id\x20=\x20it.TagId');var _0x4f62d3=squel[_0x47a5('0x57')]();var _0x52d409=[];var _0x2d147c=squel[_0x47a5('0x57')]();var _0x3548bc;if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x58')]){_0x3548bc=as[_0x47a5('0x59')](_0x87e4c9[_0x47a5('0x39')]['search']);var _0x48a0ef=_0x3548bc[_0x47a5('0x5a')];for(var _0x411230=0x0;_0x411230<_0x3548bc[_0x47a5('0x5b')][_0x47a5('0x3e')];_0x411230++){var _0x2c7020=_0x3548bc[_0x47a5('0x5b')][_0x411230];var _0x249de5='i';var _0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x2c7020[_0x47a5('0x49')]]);if(!_0x492cf7){switch(_0x2c7020['field']){case _0x47a5('0x5d'):if(_0x2c7020['value']==0x1){_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020[_0x47a5('0x49')]+_0x47a5('0x5f'));}else{_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020['field']+_0x47a5('0x60'));}break;case _0x47a5('0x61'):if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){if(_0x2c7020[_0x47a5('0x64')][_0x47a5('0x30')]('\x20')[_0x47a5('0x3e')]>0x1){_0x4f62d3[_0x48a0ef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x47a5('0x65')](_0x2c7020[_0x47a5('0x64')]),null);}else{var _0x187d7e='%'+_0x2c7020[_0x47a5('0x64')]+'%';_0x4f62d3[_0x48a0ef](_0x47a5('0x66'),_0x187d7e,_0x187d7e,_0x187d7e);}}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,['name',_0x47a5('0x67')]);_0x2c7020[_0x47a5('0x49')]=_0x47a5('0x67');_0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x69'):var _0x4fa1da=_0x2c7020['value'][_0x47a5('0x30')](',')['map'](function(_0x16bb8a){return Number(_0x16bb8a);});_0x4fa1da['forEach'](function(_0x482de6){_0x2d147c['or'](_0x47a5('0x6a'),'%,'+_0x482de6+',%');});_0x52d409=_[_0x47a5('0x6b')](_0x52d409,_0x4fa1da);break;case'User':if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){_0x4f62d3[_0x48a0ef]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2c7020['value']+'%',null);}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x47a5('0x6c')]);_0x2c7020[_0x47a5('0x49')]='UserId';_0x5cbe97=as[_0x47a5('0x6d')](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97['value'][_0x47a5('0x6e')],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x6f'):_0x5cbe97=as[_0x47a5('0x6d')]('me',null,_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97[_0x47a5('0x64')]['end']);break;}}else{var _0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7['type'],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')][_0x47a5('0x6e')],_0x5cbe97['value']['end']);}}}else{var _0x139229=_(_0x87e4c9[_0x47a5('0x39')])[_0x47a5('0x3a')]()[_0x47a5('0x2c')](function(_0xc45e25){return _['some'](_0x53c754,[_0x47a5('0x29'),_0xc45e25])?_0xc45e25:undefined;})['compact']()[_0x47a5('0x64')]();if(!_[_0x47a5('0x70')](_0x139229)){_0x139229['forEach'](function(_0x32b4de){if(_0x32b4de===_0x47a5('0x71')){_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x72'),[][_0x47a5('0x73')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de]));}else if(_0x32b4de===_0x47a5('0x74')){var _0x3ac38c=JSON['parse'](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])[_0x47a5('0x75')];var _0x3c75c6=JSON[_0x47a5('0x76')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])['$lte'];_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x77'),_0x3ac38c,_0x3c75c6);}else{if(_0x87e4c9[_0x47a5('0x39')][_0x32b4de]===_0x47a5('0x78')){_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x79'));}else{_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x7a'),_0x87e4c9[_0x47a5('0x39')][_0x32b4de]);}}});}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]==0x1){_0x34a9ae[_0x47a5('0x5e')](_0x47a5('0x7c'));}else{_0x34a9ae['having'](_0x47a5('0x7d'));}}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]){_0x52d409=_['isArray'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')])?_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]:new Array(_0x87e4c9['query'][_0x47a5('0x7e')]);_0x52d409['forEach'](function(_0x2d5ee6){_0x2d147c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2d5ee6+',%');});}if(_0x87e4c9[_0x47a5('0x39')]['filter']){var _0x7c1190=_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7f')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x47a5('0x80')](_0x7c1190)){_0x4f62d3['or'](_0x47a5('0x81'),_0x7c1190+'%')['or'](_0x47a5('0x82'),_0x7c1190+'%');}else{_0x4f62d3['or'](_0x47a5('0x83'),qs['getFullTextValue'](_0x7c1190))['or'](_0x47a5('0x84'),_0x7c1190+'%');}}}_0x34a9ae[_0x47a5('0x42')](_0x4f62d3);_0x34a9ae[_0x47a5('0x85')](_0x47a5('0x86'));var _0x308c9a={'type':db[_0x47a5('0x87')][_0x47a5('0x88')][_0x47a5('0x89')],'raw':!![]};var _0x4618a0=_0x34a9ae[_0x47a5('0x8a')]();_0x4618a0[_0x47a5('0x49')](_0x47a5('0x86'));_0x4618a0['field'](_0x47a5('0x8b'),'unreadMessages');if(_0x52749b[_0x47a5('0x40')]){_0x52749b[_0x47a5('0x40')][_0x47a5('0x8c')](function(_0x12fec9){_0x34a9ae[_0x47a5('0x40')]('i.'+_0x12fec9[0x0],_0x12fec9[0x1]===_0x47a5('0x8d')?![]:!![]);});}if(!_[_0x47a5('0x70')](_0x52d409)){_0x34a9ae[_0x47a5('0x5e')](_0x2d147c);_0x4618a0[_0x47a5('0x42')](_0x47a5('0x8e'),_0x52d409);}BPromise[_0x47a5('0x8f')]()[_0x47a5('0x26')](function(){if(!_0x3548bc){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x71')]||_0x87e4c9[_0x47a5('0x39')]['journey'])return;_0x4618a0['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x34a9ae['where'](_0x47a5('0x90'));return;}return _0x87e4c9[_0x47a5('0x91')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x47a5('0x26')](function(_0x44dda2){if(_[_0x47a5('0x70')](_0x44dda2)){_0x4618a0[_0x47a5('0x42')](_0x47a5('0x92'));_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x92'));}else{_0x4618a0[_0x47a5('0x42')](_0x47a5('0x72'),_[_0x47a5('0x2c')](_0x44dda2,'id'));_0x34a9ae[_0x47a5('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0x47a5('0x2c')](_0x44dda2,'id'));}});})[_0x47a5('0x26')](function(){db[_0x47a5('0x93')]['query'](_0x4618a0[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x17b61d){_0x50c086['count']=_0x17b61d[_0x47a5('0x3e')];if(_0x50c086['count']===0x0)return[];return db['sequelize'][_0x47a5('0x39')](_0x586f4f[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x27333e){_0x23bd8d=_[_0x47a5('0x95')](_0x27333e,'id');_0x308c9a=_[_0x47a5('0x96')](_0x308c9a,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x87e4c9['query'][_0x47a5('0x3d')]){_0x52749b['attributes'][_0x47a5('0x8c')](function(_0x3fffd1){_0x34a9ae[_0x47a5('0x49')]('i.'+_0x3fffd1);});}else{_0x34a9ae[_0x47a5('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x47a5('0x5d'));_0x34a9ae['field']('a.key',_0x47a5('0x97'));_0x34a9ae[_0x47a5('0x49')]('a.mandatoryDisposition',_0x47a5('0x98'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x99'));_0x34a9ae['field'](_0x47a5('0x9a'),'Contact.firstName');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x9b'),_0x47a5('0x9c'));_0x34a9ae['field'](_0x47a5('0x9d'),_0x47a5('0x9e'));_0x34a9ae[_0x47a5('0x49')]('c.phone',_0x47a5('0x9f'));_0x34a9ae['field'](_0x47a5('0xa0'),'Contact.mobile');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa1'),_0x47a5('0xa2'));_0x34a9ae[_0x47a5('0x49')]('o.fullname',_0x47a5('0xa3'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa4'),_0x47a5('0xa5'));_0x34a9ae[_0x47a5('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x52749b[_0x47a5('0x1f')])_0x34a9ae['limit'](_0x52749b[_0x47a5('0x1f')]);if(_0x52749b[_0x47a5('0x1e')])_0x34a9ae[_0x47a5('0x1e')](_0x52749b['offset']);return db[_0x47a5('0x93')][_0x47a5('0x39')](_0x34a9ae['toString'](),_0x308c9a);})[_0x47a5('0x26')](function(_0x8a9dea){_0x3a740b[_0x47a5('0x42')](_0x47a5('0xa6'),_['map'](_0x8a9dea,'id'));return db['sequelize'][_0x47a5('0x39')](_0x3a740b[_0x47a5('0x94')](),_0x308c9a)['then'](function(_0x27d422){var _0x23f055=_['groupBy'](_0x27d422,_0x47a5('0xa7'));var _0x2a02cd=[];_0x8a9dea[_0x47a5('0x8c')](function(_0x59f010){_0x2a02cd[_0x47a5('0x31')](updateWhatsappInteraction(_0x59f010,_0x23bd8d,_0x23f055));});return BPromise['all'](_0x2a02cd);});});})[_0x47a5('0x26')](function(_0x5e2946){_0x50c086[_0x47a5('0xa8')]=_0x5e2946;return _0x50c086;})[_0x47a5('0x26')](respondWithFilteredResult(_0xf269a8,_0x52749b));})['catch'](handleError(_0xf269a8,null));};exports[_0x47a5('0xa9')]=function(_0x597cb2,_0x1eabef){var _0x36f619={'raw':![],'where':{'id':_0x597cb2[_0x47a5('0xaa')]['id']}},_0x37e045={};_0x37e045['model']=_[_0x47a5('0x3a')](db['WhatsappInteraction']['rawAttributes']);_0x37e045[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x597cb2[_0x47a5('0x39')]);_0x37e045[_0x47a5('0x44')]=_[_0x47a5('0x3b')](_0x37e045['model'],_0x37e045[_0x47a5('0x39')]);_0x36f619[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x37e045[_0x47a5('0x38')],qs['fields'](_0x597cb2[_0x47a5('0x39')]['fields']));_0x36f619[_0x47a5('0x3c')]=_0x36f619[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x36f619[_0x47a5('0x3c')]:_0x37e045[_0x47a5('0x38')];if(_0x597cb2[_0x47a5('0x39')][_0x47a5('0xab')]){_0x36f619[_0x47a5('0xac')]=[{'all':!![]}];}_0x36f619=_[_0x47a5('0x96')]({},_0x36f619,_0x597cb2['options']);return db[_0x47a5('0xad')][_0x47a5('0x5c')](_0x36f619)['then'](handleEntityNotFound(_0x1eabef,null))[_0x47a5('0x26')](respondWithResult(_0x1eabef,null))[_0x47a5('0x32')](handleError(_0x1eabef,null));};exports[_0x47a5('0xae')]=function(_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0xad')][_0x47a5('0xae')](_0x5b85cd['body'],{})['then'](respondWithResult(_0x4bf1f5,0xc9))[_0x47a5('0x32')](handleError(_0x4bf1f5,null));};exports[_0x47a5('0x24')]=function(_0x54eab1,_0x29e384){if(_0x54eab1[_0x47a5('0x6f')]['id']){delete _0x54eab1['body']['id'];}return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x54eab1[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x29e384,null))[_0x47a5('0x26')](saveUpdates(_0x54eab1[_0x47a5('0x6f')],null))['then'](respondWithResult(_0x29e384,null))['catch'](handleError(_0x29e384,null));};exports['destroy']=function(_0x133b7a,_0xce5ada){return db['WhatsappInteraction'][_0x47a5('0x5c')]({'where':{'id':_0x133b7a[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0xce5ada,null))[_0x47a5('0x26')](removeEntity(_0xce5ada,null))[_0x47a5('0x32')](handleError(_0xce5ada,null));};exports['describe']=function(_0x3e7750,_0x548a06){return db['WhatsappInteraction']['describe']()[_0x47a5('0x26')](respondWithResult(_0x548a06,null))['catch'](handleError(_0x548a06,null));};exports[_0x47a5('0xaf')]=function(_0xf3edc8,_0x5a316e,_0x49f791){return db[_0x47a5('0xb0')][_0x47a5('0x5c')]({'where':{'id':_0xf3edc8[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x5a316e,null))[_0x47a5('0x26')](function(_0x581a87){if(_0x581a87){return _0x581a87[_0x47a5('0xaf')](_0xf3edc8[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0xf3edc8[_0x47a5('0x6f')],[_0x47a5('0xb2'),'id'])||{});}})[_0x47a5('0x26')](respondWithResult(_0x5a316e,null))[_0x47a5('0x32')](handleError(_0x5a316e,null));};exports[_0x47a5('0xb3')]=function(_0x5112d7,_0x6a8174,_0x2e418d){var _0x50b236={'raw':![],'where':{}};var _0x263521={};var _0x9769b5={'count':0x0,'rows':[]};return db[_0x47a5('0xad')][_0x47a5('0xb4')]({'where':{'id':_0x5112d7['params']['id']}})['then'](handleEntityNotFound(_0x6a8174,null))['then'](function(_0x4eee99){if(_0x4eee99){_0x263521[_0x47a5('0x38')]=_[_0x47a5('0x3a')](db[_0x47a5('0xb0')][_0x47a5('0x34')]);_0x263521[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x5112d7[_0x47a5('0x39')]);_0x263521[_0x47a5('0x44')]=_['intersection'](_0x263521[_0x47a5('0x38')],_0x263521[_0x47a5('0x39')]);_0x50b236[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x263521['model'],qs['fields'](_0x5112d7[_0x47a5('0x39')]['fields']));_0x50b236['attributes']=_0x50b236[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x50b236['attributes']:_0x263521[_0x47a5('0x38')];if(!_0x5112d7[_0x47a5('0x39')][_0x47a5('0x3f')]('nolimit')){_0x50b236[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x5112d7['query'][_0x47a5('0x1f')]);_0x50b236[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x5112d7[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x50b236[_0x47a5('0x40')]=qs['sort'](_0x5112d7[_0x47a5('0x39')]['sort']);_0x50b236[_0x47a5('0x42')]=qs[_0x47a5('0x44')](_[_0x47a5('0x43')](_0x5112d7[_0x47a5('0x39')],_0x263521['filters']));_0x50b236[_0x47a5('0x42')][_0x47a5('0xa7')]=_0x4eee99['id'];if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x7f')]){_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],{'$or':_[_0x47a5('0x2c')](_0x50b236[_0x47a5('0x3c')],function(_0xa2045c){var _0x109738={};_0x109738[_0xa2045c]={'$like':'%'+_0x5112d7[_0x47a5('0x39')]['filter']+'%'};return _0x109738;})});}if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')]){var _0x591bde=_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')][_0x47a5('0x30')](',');var _0x2ccf21={};_0x2ccf21[_0x591bde[0x0]]={'$gte':moment(_0x591bde[0x1])[_0x47a5('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],_0x2ccf21);}_0x50b236=_[_0x47a5('0x96')]({},_0x50b236,_0x5112d7[_0x47a5('0xb6')]);return db[_0x47a5('0xb0')][_0x47a5('0x1d')]({'where':_0x50b236['where']})['then'](function(_0xa3d578){_0x9769b5['count']=_0xa3d578;if(_0x5112d7[_0x47a5('0x39')]['includeAll']){_0x50b236[_0x47a5('0xac')]=[{'all':!![]}];}return db[_0x47a5('0xb0')][_0x47a5('0xb7')](_0x50b236);})[_0x47a5('0x26')](function(_0x49cb8c){_0x9769b5[_0x47a5('0xa8')]=_0x49cb8c;return _0x9769b5;});}})[_0x47a5('0x26')](respondWithFilteredResult(_0x6a8174,_0x50b236))[_0x47a5('0x32')](handleError(_0x6a8174,null));};exports['addTags']=function(_0x581759,_0x30375f,_0x29015a){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x581759[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x30375f,null))[_0x47a5('0x26')](function(_0xe662d7){if(_0xe662d7){return _0xe662d7['setTags'](_0x581759[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0x581759[_0x47a5('0x6f')],['ids','id'])||{})['spread'](function(){return db[_0x47a5('0x69')][_0x47a5('0xb7')]({'attributes':['id','name',_0x47a5('0x46')],'where':{'id':_0x581759[_0x47a5('0x6f')][_0x47a5('0xb2')]}});})[_0x47a5('0x26')](function(_0x5a7f32){socket[_0x47a5('0xb8')]('whatsappInteractionTags:save',{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]});return{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]};});}})[_0x47a5('0x26')](respondWithResult(_0x30375f,null))['catch'](handleError(_0x30375f,null));};exports[_0x47a5('0xb9')]=function(_0x156d51,_0x401139,_0x2005d5){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x156d51[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x401139,null))[_0x47a5('0x26')](function(_0x2200f9){if(_0x2200f9){return _0x2200f9[_0x47a5('0xb9')](_0x156d51[_0x47a5('0x39')][_0x47a5('0xb2')]);}})[_0x47a5('0x26')](respondWithStatusCode(_0x401139,null))[_0x47a5('0x32')](handleError(_0x401139,null));};exports['download']=function(_0xdd95c8,_0x40aee5){var _0x322cee=moment()[_0x47a5('0xba')]()['toString']();var _0x367662=path['join'](config[_0x47a5('0xbb')],'server',_0x47a5('0xbc'),_0x47a5('0xbd'));var _0x3b894d=path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xbc'),'attachments');var _0x52798d=path[_0x47a5('0xbf')](_0x367662,_0x322cee);var _0x1a5e07=util[_0x47a5('0xb5')](_0x47a5('0xc0'),_0xdd95c8[_0x47a5('0xaa')]['id'],_0x322cee);var _0x579e5c=path[_0x47a5('0xbf')](_0x367662,_0x1a5e07);var _0x4b3ae4=[];_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc1')],'as':_0x47a5('0xc1'),'attributes':['id',_0x47a5('0x2d')],'raw':!![]});_0x4b3ae4['push']({'model':db['CmContact'],'as':_0x47a5('0x61'),'attributes':['id',_0x47a5('0xc2'),_0x47a5('0xc3')],'raw':!![]});if(_0xdd95c8[_0x47a5('0x39')][_0x47a5('0xc4')]){_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc5')],'as':_0x47a5('0xc5'),'raw':!![]});}var _0x2c2245=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x47a5('0x6f'),'createdAt',_0x47a5('0xc6'),_0x47a5('0xc7'),_0x47a5('0x7b')],'include':_0x4b3ae4}];_0x2c2245['push']({'model':db[_0x47a5('0xc8')],'as':_0x47a5('0xc9'),'attributes':['id','name']});_0x2c2245[_0x47a5('0x31')]({'model':db['User'],'as':_0x47a5('0xca'),'attributes':['id',_0x47a5('0x2d')]});return db[_0x47a5('0xad')]['find']({'where':{'id':_0xdd95c8['params']['id']},'include':_0x2c2245})['then'](handleEntityNotFound(_0x40aee5,null))['then'](function(_0x5075a6){if(_0x5075a6){var _0x1ba5b6=_0x5075a6['get']({'plain':!![]});fs[_0x47a5('0xcb')](_0x52798d);var _0x2287b0={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x47a5('0xcc'),'contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0x47a5('0xcd'),_0x47a5('0xce'),_0x1ba5b6['id']),moment()[_0x47a5('0xb5')](_0x47a5('0xcf'))['toString']())}}};var _0xdda046={'channel':'Whatsapp','account':_0x1ba5b6[_0x47a5('0xc9')]['name'],'agent':_0x1ba5b6[_0x47a5('0xca')]?_0x1ba5b6[_0x47a5('0xca')][_0x47a5('0x2d')]:'N.A.','createdAt':moment(_0x1ba5b6[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')](),'closedAt':_0x1ba5b6['closed']?moment(_0x1ba5b6[_0x47a5('0xd1')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')]():'','disposition':_0x1ba5b6[_0x47a5('0xd2')],'messages':_(_0x1ba5b6[_0x47a5('0xd3')])['filter']({'secret':![]})[_0x47a5('0x2c')](function(_0xe245ca){if(_0xe245ca[_0x47a5('0xc5')]){var _0xac8d4f=path[_0x47a5('0xbf')](_0x3b894d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]);if(fs[_0x47a5('0xd5')](_0xac8d4f)){fs[_0x47a5('0xd6')](_0xac8d4f)[_0x47a5('0xd7')](fs[_0x47a5('0xd8')](path[_0x47a5('0xbf')](_0x52798d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')])));}}return{'date':moment(_0xe245ca[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))['toString'](),'sender':_0xe245ca[_0x47a5('0xc6')]==='out'?_0xe245ca['User']?_0xe245ca[_0x47a5('0xc1')][_0x47a5('0x2d')]:_0x47a5('0xd9'):_0xe245ca['Contact'][_0x47a5('0xc2')]+(_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]?'\x20'+_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]:''),'body':_0xe245ca[_0x47a5('0xc5')]?_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]:_0xe245ca[_0x47a5('0x6f')],'direction':_0xe245ca[_0x47a5('0xc6')]===_0x47a5('0xda')?'A':'C','secret':_0xe245ca[_0x47a5('0xc7')],'read':_0xe245ca[_0x47a5('0x7b')],'attachment':_0xe245ca['Attachment']};})['value']()};return ejs[_0x47a5('0xdb')](path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xdc'),_0x47a5('0xdd')),{'interaction':_0xdda046})[_0x47a5('0x26')](function(_0x3708ea){return new BPromise(function(_0x583b37,_0x2b4039){pdf[_0x47a5('0xae')](_0x3708ea,_0x2287b0)[_0x47a5('0xde')](path['join'](_0x52798d,_0x47a5('0xdf')+_0x1ba5b6['id']+'-'+_0x322cee+_0x47a5('0xe0')),function(_0x3ecc41,_0x3e4148){if(_0x3ecc41)return _0x2b4039(_0x3ecc41);_0x583b37(_0x3e4148);});});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x23e649,_0x35e20f){zipdir(_0x52798d,{'saveTo':_0x579e5c},function(_0x46615a,_0xd6e255){if(_0x46615a)return _0x35e20f(_0x46615a);return _0x23e649(_0xd6e255);});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x1b91ad,_0x40b7a5){rimraf(_0x52798d,function(_0x28e998){if(_0x28e998)_0x40b7a5(_0x28e998);return _0x1b91ad();});});})[_0x47a5('0x26')](function(){return _0x40aee5[_0x47a5('0xe1')](_0x579e5c,_0x1a5e07,function(_0x3f7fdc){if(_0x3f7fdc){console[_0x47a5('0xe2')](_0x47a5('0xe3'),_0x3f7fdc);}else{fs[_0x47a5('0xe4')](_0x579e5c);}});});});}else{return _0x40aee5[_0x47a5('0x1a')](0xc8);}})[_0x47a5('0x32')](handleError(_0x40aee5,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index bafef0f..198fa65 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 _0x9067=['setDataValue','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','map','findAll'];(function(_0x31c11e,_0x1c951d){var _0x5ee70c=function(_0x4c42d3){while(--_0x4c42d3){_0x31c11e['push'](_0x31c11e['shift']());}};_0x5ee70c(++_0x1c951d);}(_0x9067,0x149));var _0x7906=function(_0x54aeee,_0x1c04ea){_0x54aeee=_0x54aeee-0x0;var _0x34fff9=_0x9067[_0x54aeee];return _0x34fff9;};'use strict';var EventEmitter=require(_0x7906('0x0'));var WhatsappInteraction=require(_0x7906('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x7906('0x1'))['db'][_0x7906('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x7906('0x3')](0x0);var events={'afterCreate':_0x7906('0x4'),'afterUpdate':_0x7906('0x5'),'afterDestroy':_0x7906('0x6')};function emitEvent(_0x36007b){return function(_0x13f291,_0x4871d1,_0x453fb9){_0x13f291[_0x7906('0x7')]({'attributes':['id'],'raw':!![]})[_0x7906('0x8')](function(_0x4e736d){_0x13f291['setDataValue']('Users',_0x4e736d[_0x7906('0x9')](function(_0x335a28){return{'id':_0x335a28['id']};}));return WhatsappMessage[_0x7906('0xa')]({'where':{'WhatsappInteractionId':_0x13f291['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7906('0x8')](function(_0xbc3c99){_0x13f291[_0x7906('0xb')]('unreadMessages',_0xbc3c99[_0x7906('0xc')]);WhatsappInteractionEvents[_0x7906('0xd')](_0x36007b+':'+_0x13f291['id'],_0x13f291);WhatsappInteractionEvents[_0x7906('0xd')](_0x36007b,_0x13f291);_0x453fb9(null);})[_0x7906('0xe')](_0x453fb9(null));};}for(var e in events){if(events[_0x7906('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x7906('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xd7a3=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','WhatsappInteraction','../../mysqldb','save','update','remove','getUsers','then'];(function(_0x26b5af,_0x38291e){var _0x13dad4=function(_0x56117c){while(--_0x56117c){_0x26b5af['push'](_0x26b5af['shift']());}};_0x13dad4(++_0x38291e);}(_0xd7a3,0xac));var _0x3d7a=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xd7a3[_0x5bd426];return _0x23a7eb;};'use strict';var EventEmitter=require(_0x3d7a('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x3d7a('0x1')];var WhatsappMessage=require(_0x3d7a('0x2'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3d7a('0x3'),'afterUpdate':_0x3d7a('0x4'),'afterDestroy':_0x3d7a('0x5')};function emitEvent(_0x41d695){return function(_0x559b2a,_0x12b1cd,_0x5bbe9f){_0x559b2a[_0x3d7a('0x6')]({'attributes':['id'],'raw':!![]})[_0x3d7a('0x7')](function(_0x4eb75b){_0x559b2a[_0x3d7a('0x8')](_0x3d7a('0x9'),_0x4eb75b[_0x3d7a('0xa')](function(_0x1f70dc){return{'id':_0x1f70dc['id']};}));return WhatsappMessage[_0x3d7a('0xb')]({'where':{'WhatsappInteractionId':_0x559b2a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3d7a('0x7')](function(_0x1e5e16){_0x559b2a[_0x3d7a('0x8')](_0x3d7a('0xc'),_0x1e5e16[_0x3d7a('0xd')]);WhatsappInteractionEvents[_0x3d7a('0xe')](_0x41d695+':'+_0x559b2a['id'],_0x559b2a);WhatsappInteractionEvents['emit'](_0x41d695,_0x559b2a);_0x5bbe9f(null);})[_0x3d7a('0xf')](_0x5bbe9f(null));};}for(var e in events){if(events[_0x3d7a('0x10')](e)){var event=events[e];WhatsappInteraction[_0x3d7a('0x11')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 30e67ca..bdc0991 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 _0xf162=['define','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','moment','bluebird','request-promise','../../config/environment','./whatsappInteraction.attributes'];(function(_0xb645b,_0x45d7ee){var _0x21fbf1=function(_0xf7b4b2){while(--_0xf7b4b2){_0xb645b['push'](_0xb645b['shift']());}};_0x21fbf1(++_0x45d7ee);}(_0xf162,0x16e));var _0x2f16=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf162[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x2f16('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2f16('0x1'));var BPromise=require(_0x2f16('0x2'));var rp=require(_0x2f16('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2f16('0x4'));var attributes=require(_0x2f16('0x5'));module['exports']=function(_0x5ea22e,_0x4c0a89){return _0x5ea22e[_0x2f16('0x6')]('WhatsappInteraction',attributes,{'tableName':_0x2f16('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d2981,_0x45e39a,_0x45b137){if(_0x2d2981[_0x2f16('0x8')]('closed')){_0x2d2981[_0x2f16('0x9')]=moment()[_0x2f16('0xa')](_0x2f16('0xb'));}_0x45b137(null,_0x2d2981);}}});}; \ No newline at end of file +var _0x2aff=['rimraf','../../config/environment','exports','WhatsappInteraction','closed','closedAt','lodash','util','api','moment','bluebird','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2aff,0x1ce));var _0xf2af=function(_0x360995,_0x35c271){_0x360995=_0x360995-0x0;var _0x2c280c=_0x2aff[_0x360995];return _0x2c280c;};'use strict';var _=require(_0xf2af('0x0'));var util=require(_0xf2af('0x1'));var logger=require('../../config/logger')(_0xf2af('0x2'));var moment=require(_0xf2af('0x3'));var BPromise=require(_0xf2af('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2af('0x5'));var rimraf=require(_0xf2af('0x6'));var config=require(_0xf2af('0x7'));var attributes=require('./whatsappInteraction.attributes');module[_0xf2af('0x8')]=function(_0xf4af3c,_0x41e613){return _0xf4af3c['define'](_0xf2af('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x394521,_0x175e03,_0x5588c5){if(_0x394521['changed'](_0xf2af('0xa'))){_0x394521[_0xf2af('0xb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5588c5(null,_0x394521);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index d720715..5b70b4a 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 _0x588a=['omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./whatsappInteraction.socket','request','then','request\x20sent','debug','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','info','result','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','limit','catch','WhatsappInteraction','addTags'];(function(_0x211a95,_0x3a7951){var _0x4f8368=function(_0x3034c6){while(--_0x3034c6){_0x211a95['push'](_0x211a95['shift']());}};_0x4f8368(++_0x3a7951);}(_0x588a,0x144));var _0xa588=function(_0x6c0f5f,_0x1deead){_0x6c0f5f=_0x6c0f5f-0x0;var _0x23980f=_0x588a[_0x6c0f5f];return _0x23980f;};'use strict';var _=require(_0xa588('0x0'));var util=require(_0xa588('0x1'));var moment=require(_0xa588('0x2'));var BPromise=require(_0xa588('0x3'));var rs=require(_0xa588('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa588('0x5'));var logger=require(_0xa588('0x6'))('rpc');var config=require(_0xa588('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa588('0x8')][_0xa588('0x9')]({'port':0x232a});config[_0xa588('0xa')]=_[_0xa588('0xb')](config['redis'],{'host':_0xa588('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa588('0xa')]));require(_0xa588('0xd'))['register'](socket);function respondWithRpcPromise(_0xe5c2b8,_0x356128,_0x5f3cbf){return new BPromise(function(_0x5475e9,_0x2652d8){return client[_0xa588('0xe')](_0xe5c2b8,_0x5f3cbf)[_0xa588('0xf')](function(_0x2021b7){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x356128,_0xa588('0x10'));logger[_0xa588('0x11')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x356128,_0xa588('0x10'),JSON[_0xa588('0x12')](_0x2021b7));if(_0x2021b7[_0xa588('0x13')]){if(_0x2021b7['error'][_0xa588('0x14')]===0x1f4){logger['error'](_0xa588('0x15'),_0x356128,_0x2021b7[_0xa588('0x13')][_0xa588('0x16')]);return _0x2652d8(_0x2021b7[_0xa588('0x13')][_0xa588('0x16')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x356128,_0x2021b7[_0xa588('0x13')][_0xa588('0x16')]);return _0x5475e9(_0x2021b7[_0xa588('0x13')][_0xa588('0x16')]);}else{logger[_0xa588('0x17')](_0xa588('0x15'),_0x356128,_0xa588('0x10'));_0x5475e9(_0x2021b7[_0xa588('0x18')]['message']);}})['catch'](function(_0x51a107){logger[_0xa588('0x13')](_0xa588('0x15'),_0x356128,_0x51a107);_0x2652d8(_0x51a107);});});}exports[_0xa588('0x19')]=function(_0x1d5f4f){var _0x38e88a=this;return new Promise(function(_0x152800,_0x56d65b){return db['WhatsappInteraction'][_0xa588('0x1a')](_0x1d5f4f[_0xa588('0x1b')],{'raw':_0x1d5f4f['options']?_0x1d5f4f[_0xa588('0x1c')][_0xa588('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d5f4f[_0xa588('0x1c')]?_0x1d5f4f[_0xa588('0x1c')][_0xa588('0x1e')]||null:null,'attributes':_0x1d5f4f[_0xa588('0x1c')]?_0x1d5f4f[_0xa588('0x1c')][_0xa588('0x1f')]||null:null,'limit':_0x1d5f4f[_0xa588('0x1c')]?_0x1d5f4f[_0xa588('0x1c')][_0xa588('0x20')]||null:null})['then'](function(_0x21765c){logger[_0xa588('0x17')](_0xa588('0x19'),_0x1d5f4f);logger[_0xa588('0x11')]('UpdateWhatsappInteraction',_0x1d5f4f,JSON['stringify'](_0x21765c));_0x152800(_0x21765c);})[_0xa588('0x21')](function(_0x39f05c){logger[_0xa588('0x13')](_0xa588('0x19'),_0x39f05c[_0xa588('0x16')],_0x1d5f4f);_0x56d65b(_0x38e88a[_0xa588('0x13')](0x1f4,_0x39f05c[_0xa588('0x16')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x19a5d8){return new Promise(function(_0x46c393,_0x5d73b0){return db[_0xa588('0x22')]['find']({'where':_0x19a5d8[_0xa588('0x1c')]?_0x19a5d8[_0xa588('0x1c')][_0xa588('0x1e')]||null:null})['then'](function(_0x188d2b){if(_0x188d2b){return _0x188d2b[_0xa588('0x23')](_0x19a5d8['body']['ids'],_[_0xa588('0x24')](_0x19a5d8[_0xa588('0x1b')],[_0xa588('0x25'),'id'])||{});}})[_0xa588('0x26')](function(_0x3ad434){logger['info'](_0xa588('0x27'),_0x19a5d8);logger[_0xa588('0x11')]('AddTags',_0x19a5d8,JSON[_0xa588('0x12')](_0x3ad434));_0x46c393(_0x3ad434);})['catch'](function(_0x14320d){logger['error'](_0xa588('0x27'),_0x14320d[_0xa588('0x16')],_0x19a5d8);_0x5d73b0(_this[_0xa588('0x13')](0x1f4,_0x14320d[_0xa588('0x16')]));});});}; \ No newline at end of file +var _0x7934=['omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','redis','localhost','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','options','raw','where','attributes','limit','then','UpdateWhatsappInteraction','WhatsappInteraction','find','addTags','body','ids'];(function(_0x23cc7d,_0x553e85){var _0x41abb3=function(_0x3cbbde){while(--_0x3cbbde){_0x23cc7d['push'](_0x23cc7d['shift']());}};_0x41abb3(++_0x553e85);}(_0x7934,0x7e));var _0x4793=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7934[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4793('0x0'));var util=require('util');var moment=require(_0x4793('0x1'));var BPromise=require(_0x4793('0x2'));var rs=require(_0x4793('0x3'));var fs=require('fs');var Redis=require(_0x4793('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4793('0x5'));var config=require('../../config/environment');var jayson=require(_0x4793('0x6'));var client=jayson[_0x4793('0x7')][_0x4793('0x8')]({'port':0x232a});config[_0x4793('0x9')]=_['defaults'](config[_0x4793('0x9')],{'host':_0x4793('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4793('0x9')]));require(_0x4793('0xb'))[_0x4793('0xc')](socket);function respondWithRpcPromise(_0xae7b1b,_0x2a9820,_0x1252b8){return new BPromise(function(_0x2cfde3,_0x1b0cd0){return client[_0x4793('0xd')](_0xae7b1b,_0x1252b8)['then'](function(_0x504388){logger[_0x4793('0xe')](_0x4793('0xf'),_0x2a9820,_0x4793('0x10'));logger[_0x4793('0x11')](_0x4793('0x12'),_0x2a9820,'request\x20sent',JSON[_0x4793('0x13')](_0x504388));if(_0x504388['error']){if(_0x504388[_0x4793('0x14')][_0x4793('0x15')]===0x1f4){logger['error'](_0x4793('0xf'),_0x2a9820,_0x504388[_0x4793('0x14')]['message']);return _0x1b0cd0(_0x504388[_0x4793('0x14')][_0x4793('0x16')]);}logger[_0x4793('0x14')](_0x4793('0xf'),_0x2a9820,_0x504388['error'][_0x4793('0x16')]);return _0x2cfde3(_0x504388[_0x4793('0x14')]['message']);}else{logger[_0x4793('0xe')](_0x4793('0xf'),_0x2a9820,_0x4793('0x10'));_0x2cfde3(_0x504388[_0x4793('0x17')]['message']);}})[_0x4793('0x18')](function(_0x36d839){logger[_0x4793('0x14')](_0x4793('0xf'),_0x2a9820,_0x36d839);_0x1b0cd0(_0x36d839);});});}exports['UpdateWhatsappInteraction']=function(_0x1d23a2){var _0x2cdf3a=this;return new Promise(function(_0x259cef,_0x36780a){return db['WhatsappInteraction'][_0x4793('0x19')](_0x1d23a2['body'],{'raw':_0x1d23a2['options']?_0x1d23a2[_0x4793('0x1a')][_0x4793('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d23a2[_0x4793('0x1a')]?_0x1d23a2[_0x4793('0x1a')][_0x4793('0x1c')]||null:null,'attributes':_0x1d23a2[_0x4793('0x1a')]?_0x1d23a2[_0x4793('0x1a')][_0x4793('0x1d')]||null:null,'limit':_0x1d23a2[_0x4793('0x1a')]?_0x1d23a2[_0x4793('0x1a')][_0x4793('0x1e')]||null:null})[_0x4793('0x1f')](function(_0x2c4874){logger['info'](_0x4793('0x20'),_0x1d23a2);logger['debug'](_0x4793('0x20'),_0x1d23a2,JSON[_0x4793('0x13')](_0x2c4874));_0x259cef(_0x2c4874);})['catch'](function(_0x15407f){logger[_0x4793('0x14')](_0x4793('0x20'),_0x15407f[_0x4793('0x16')],_0x1d23a2);_0x36780a(_0x2cdf3a['error'](0x1f4,_0x15407f[_0x4793('0x16')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x1426b5){return new Promise(function(_0x9748d9,_0x53d680){return db[_0x4793('0x21')][_0x4793('0x22')]({'where':_0x1426b5[_0x4793('0x1a')]?_0x1426b5[_0x4793('0x1a')][_0x4793('0x1c')]||null:null})['then'](function(_0x11a492){if(_0x11a492){return _0x11a492[_0x4793('0x23')](_0x1426b5[_0x4793('0x24')][_0x4793('0x25')],_[_0x4793('0x26')](_0x1426b5[_0x4793('0x24')],[_0x4793('0x25'),'id'])||{});}})[_0x4793('0x27')](function(_0x4571a3){logger[_0x4793('0xe')](_0x4793('0x28'),_0x1426b5);logger[_0x4793('0x11')]('AddTags',_0x1426b5,JSON[_0x4793('0x13')](_0x4571a3));_0x9748d9(_0x4571a3);})[_0x4793('0x18')](function(_0x1ef261){logger[_0x4793('0x14')](_0x4793('0x28'),_0x1ef261[_0x4793('0x16')],_0x1426b5);_0x53d680(_this[_0x4793('0x14')](0x1f4,_0x1ef261[_0x4793('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 4239aa2..002a51c 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 _0xbdf3=['save','remove','update','emit','removeListener','whatsappInteraction:'];(function(_0x2335c0,_0x55d3b2){var _0x47895d=function(_0x220754){while(--_0x220754){_0x2335c0['push'](_0x2335c0['shift']());}};_0x47895d(++_0x55d3b2);}(_0xbdf3,0x126));var _0x3bdf=function(_0x29e2af,_0x15e2b1){_0x29e2af=_0x29e2af-0x0;var _0x1ea06a=_0xbdf3[_0x29e2af];return _0x1ea06a;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x3bdf('0x0'),_0x3bdf('0x1'),_0x3bdf('0x2')];function createListener(_0x332f8d,_0x518b0d){return function(_0x5280c2){_0x518b0d[_0x3bdf('0x3')](_0x332f8d,_0x5280c2);};}function removeListener(_0x4ca50c,_0x586cf5){return function(){WhatsappInteractionEvents[_0x3bdf('0x4')](_0x4ca50c,_0x586cf5);};}exports['register']=function(_0x54cc3b){for(var _0x5c8e06=0x0,_0x4e4d87=events['length'];_0x5c8e06<_0x4e4d87;_0x5c8e06++){var _0x3cd07b=events[_0x5c8e06];var _0x895018=createListener(_0x3bdf('0x5')+_0x3cd07b,_0x54cc3b);WhatsappInteractionEvents['on'](_0x3cd07b,_0x895018);}}; \ No newline at end of file +var _0xb489=['removeListener','register','length','whatsappInteraction:','update'];(function(_0x4c2687,_0x5c4f38){var _0x132287=function(_0xfc04c2){while(--_0xfc04c2){_0x4c2687['push'](_0x4c2687['shift']());}};_0x132287(++_0x5c4f38);}(_0xb489,0x86));var _0x9b48=function(_0x1af972,_0x2bcee5){_0x1af972=_0x1af972-0x0;var _0x4ee73c=_0xb489[_0x1af972];return _0x4ee73c;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save','remove',_0x9b48('0x0')];function createListener(_0x2ef93f,_0x77790d){return function(_0x22c879){_0x77790d['emit'](_0x2ef93f,_0x22c879);};}function removeListener(_0x1adf89,_0x401edb){return function(){WhatsappInteractionEvents[_0x9b48('0x1')](_0x1adf89,_0x401edb);};}exports[_0x9b48('0x2')]=function(_0x5eddba){for(var _0x19b1f3=0x0,_0x47f8bc=events[_0x9b48('0x3')];_0x19b1f3<_0x47f8bc;_0x19b1f3++){var _0x5d269d=events[_0x19b1f3];var _0x4bf36b=createListener(_0x9b48('0x4')+_0x5d269d,_0x5eddba);WhatsappInteractionEvents['on'](_0x5d269d,_0x4bf36b);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 759feff..eca16d2 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 _0x8c29=['../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','/:id','post','tracked','whatsapp','create','status','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x1d656c,_0x14fba4){var _0x4eeb25=function(_0x14a892){while(--_0x14a892){_0x1d656c['push'](_0x1d656c['shift']());}};_0x4eeb25(++_0x14fba4);}(_0x8c29,0x159));var _0x98c2=function(_0x11ac64,_0x55cd47){_0x11ac64=_0x11ac64-0x0;var _0x15e739=_0x8c29[_0x11ac64];return _0x15e739;};'use strict';var multer=require(_0x98c2('0x0'));var util=require(_0x98c2('0x1'));var path=require('path');var timeout=require(_0x98c2('0x2'));var express=require(_0x98c2('0x3'));var router=express[_0x98c2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x98c2('0x5'));var config=require(_0x98c2('0x6'));var controller=require(_0x98c2('0x7'));router[_0x98c2('0x8')]('/',auth[_0x98c2('0x9')](),controller[_0x98c2('0xa')]);router[_0x98c2('0x8')](_0x98c2('0xb'),auth[_0x98c2('0x9')](),controller['describe']);router[_0x98c2('0x8')](_0x98c2('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x98c2('0xd')]('/',auth[_0x98c2('0x9')](),interaction[_0x98c2('0xe')](_0x98c2('0xf'),'whatsappmessage:create'),controller[_0x98c2('0x10')]);router[_0x98c2('0xd')]('/:id/status',controller[_0x98c2('0x11')]);router[_0x98c2('0x12')](_0x98c2('0xc'),auth[_0x98c2('0x9')](),controller[_0x98c2('0x13')]);router[_0x98c2('0x12')](_0x98c2('0x14'),auth[_0x98c2('0x9')](),controller[_0x98c2('0x15')]);router[_0x98c2('0x12')]('/:id/reject',auth[_0x98c2('0x9')](),controller[_0x98c2('0x16')]);router['delete'](_0x98c2('0xc'),auth['isAuthenticated'](),controller[_0x98c2('0x17')]);module[_0x98c2('0x18')]=router; \ No newline at end of file +var _0xa504=['accept','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','/:id','show','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','put','update','/:id/accept'];(function(_0x1bffd0,_0x5c57f3){var _0x15893a=function(_0x11cd75){while(--_0x11cd75){_0x1bffd0['push'](_0x1bffd0['shift']());}};_0x15893a(++_0x5c57f3);}(_0xa504,0x154));var _0x4a50=function(_0x49681e,_0x214fc7){_0x49681e=_0x49681e-0x0;var _0x1ba7df=_0xa504[_0x49681e];return _0x1ba7df;};'use strict';var multer=require(_0x4a50('0x0'));var util=require(_0x4a50('0x1'));var path=require(_0x4a50('0x2'));var timeout=require(_0x4a50('0x3'));var express=require(_0x4a50('0x4'));var router=express[_0x4a50('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4a50('0x6'));var config=require(_0x4a50('0x7'));var controller=require(_0x4a50('0x8'));router[_0x4a50('0x9')]('/',auth[_0x4a50('0xa')](),controller[_0x4a50('0xb')]);router[_0x4a50('0x9')](_0x4a50('0xc'),auth[_0x4a50('0xa')](),controller['describe']);router[_0x4a50('0x9')](_0x4a50('0xd'),auth[_0x4a50('0xa')](),controller[_0x4a50('0xe')]);router['post']('/',auth[_0x4a50('0xa')](),interaction[_0x4a50('0xf')](_0x4a50('0x10'),_0x4a50('0x11')),controller[_0x4a50('0x12')]);router[_0x4a50('0x13')](_0x4a50('0x14'),controller['status']);router[_0x4a50('0x15')](_0x4a50('0xd'),auth[_0x4a50('0xa')](),controller[_0x4a50('0x16')]);router[_0x4a50('0x15')](_0x4a50('0x17'),auth['isAuthenticated'](),controller[_0x4a50('0x18')]);router[_0x4a50('0x15')]('/:id/reject',auth[_0x4a50('0xa')](),controller[_0x4a50('0x19')]);router[_0x4a50('0x1a')](_0x4a50('0xd'),auth[_0x4a50('0xa')](),controller[_0x4a50('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index f06cba6..8b5c2a2 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 _0x009f=['out','STRING','sequelize','exports','TEXT','BOOLEAN'];(function(_0x29c023,_0x1c501d){var _0x6159ad=function(_0x12f3d6){while(--_0x12f3d6){_0x29c023['push'](_0x29c023['shift']());}};_0x6159ad(++_0x1c501d);}(_0x009f,0x194));var _0xf009=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0x009f[_0x118139];return _0x2fece9;};'use strict';var Sequelize=require(_0xf009('0x0'));module[_0xf009('0x1')]={'body':{'type':Sequelize[_0xf009('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf009('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf009('0x4')),'defaultValue':_0xf009('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf009('0x5')](0xbe)},'phone':{'type':Sequelize[_0xf009('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xf009('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1d81=['TEXT','medium','ENUM','out','STRING','exports'];(function(_0x44dbe4,_0x479d7a){var _0x1f2449=function(_0x189176){while(--_0x189176){_0x44dbe4['push'](_0x44dbe4['shift']());}};_0x1f2449(++_0x479d7a);}(_0x1d81,0x155));var _0x11d8=function(_0x39bc06,_0x18d7ff){_0x39bc06=_0x39bc06-0x0;var _0x131143=_0x1d81[_0x39bc06];return _0x131143;};'use strict';var Sequelize=require('sequelize');module[_0x11d8('0x0')]={'body':{'type':Sequelize[_0x11d8('0x1')](_0x11d8('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x11d8('0x3')]('in','out'),'defaultValue':_0x11d8('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x11d8('0x5')](0xbe)},'phone':{'type':Sequelize[_0x11d8('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 6ffd78c..9d960ea 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 _0x578a=['event','accept','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','rejectmessage','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','update','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','http','client','Sequelize','ValidationError','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','stack','name','index','map','WhatsappMessage','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','show','params','includeAll','find','create','body','describe','whatsapp-interactions','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','user','CmContact','Contact','WhatsappInteraction','WhatsappInteractionId','UserId','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','acceptMessage','manual','interface','SIP/%s','channel'];(function(_0x22a5f7,_0x268aca){var _0x3a47d3=function(_0x175339){while(--_0x175339){_0x22a5f7['push'](_0x22a5f7['shift']());}};_0x3a47d3(++_0x268aca);}(_0x578a,0x197));var _0xa578=function(_0x54f3e8,_0x3ed493){_0x54f3e8=_0x54f3e8-0x0;var _0x267b37=_0x578a[_0x54f3e8];return _0x267b37;};'use strict';var pdf=require(_0xa578('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa578('0x1'));var zipdir=require(_0xa578('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa578('0x3'));var moment=require(_0xa578('0x4'));var BPromise=require(_0xa578('0x5'));var Mustache=require(_0xa578('0x6'));var util=require(_0xa578('0x7'));var path=require(_0xa578('0x8'));var sox=require(_0xa578('0x9'));var csv=require(_0xa578('0xa'));var ejs=require(_0xa578('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa578('0xc'));var crypto=require(_0xa578('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa578('0xe'));var toCsv=require(_0xa578('0xa'));var querystring=require(_0xa578('0xf'));var Papa=require(_0xa578('0x10'));var Redis=require(_0xa578('0x11'));var authService=require(_0xa578('0x12'));var qs=require(_0xa578('0x13'));var as=require(_0xa578('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa578('0x15'))(_0xa578('0x16'));var utils=require(_0xa578('0x17'));var config=require(_0xa578('0x18'));var db=require(_0xa578('0x19'))['db'];config[_0xa578('0x1a')]=_[_0xa578('0x1b')](config['redis'],{'host':_0xa578('0x1c'),'port':0x18eb});var socket=require(_0xa578('0x1d'))(new Redis(config[_0xa578('0x1a')]));require(_0xa578('0x1e'))['register'](socket);var jayson=require(_0xa578('0x1f'));var client=jayson['client'][_0xa578('0x20')]({'port':0x232c});var client9002=jayson[_0xa578('0x21')][_0xa578('0x20')]({'port':0x232a});function checkPasswordPattern(_0x51a55b,_0x1e0f72,_0x42fe3a){if(_0x42fe3a){var _0x16a5bb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16a5bb['test'](_0x1e0f72)){return _0x51a55b;}else{throw new db[(_0xa578('0x22'))][(_0xa578('0x23'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x51a55b;}}function respondWithRpcPromise(_0x48c7f7,_0x2b304b,_0xbae4c0,_0x242232){return new BPromise(function(_0x14d34a,_0x12faba){var _0x541b32=_0x242232||client;return _0x541b32[_0xa578('0x24')](_0x48c7f7,_0xbae4c0)['then'](function(_0x36ea88){logger[_0xa578('0x25')](_0xa578('0x26'),_0x2b304b,_0xa578('0x27'));logger['debug'](_0xa578('0x28'),_0x2b304b,_0xa578('0x27'),JSON[_0xa578('0x29')](_0x36ea88));if(_0x36ea88['error']){if(_0x36ea88[_0xa578('0x2a')][_0xa578('0x2b')]===0x1f4){logger[_0xa578('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x2b304b,_0x36ea88[_0xa578('0x2a')][_0xa578('0x2c')]);return _0x12faba(_0x36ea88[_0xa578('0x2a')][_0xa578('0x2c')]);}logger['error'](_0xa578('0x26'),_0x2b304b,_0x36ea88[_0xa578('0x2a')][_0xa578('0x2c')]);return _0x14d34a(_0x36ea88[_0xa578('0x2a')][_0xa578('0x2c')]);}else{logger['info'](_0xa578('0x26'),_0x2b304b,_0xa578('0x27'));_0x14d34a(_0x36ea88['result'][_0xa578('0x2c')]);}})[_0xa578('0x2d')](function(_0x1ec921){logger[_0xa578('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x2b304b,_0x1ec921);_0x12faba(_0x1ec921);});});}function respondWithStatusCode(_0x184713,_0x291837){_0x291837=_0x291837||0xcc;return function(_0x134838){if(_0x134838){return _0x184713['sendStatus'](_0x291837);}return _0x184713['status'](_0x291837)[_0xa578('0x2e')]();};}function respondWithResult(_0x4777a9,_0x36b614){_0x36b614=_0x36b614||0xc8;return function(_0x53bb3a){if(_0x53bb3a){return _0x4777a9[_0xa578('0x2f')](_0x36b614)['json'](_0x53bb3a);}};}function respondWithFilteredResult(_0x244c96,_0x1cc175){return function(_0x5223d8){if(_0x5223d8){var _0x193b33=_0x5223d8[_0xa578('0x30')],_0x46909d=_0x1cc175[_0xa578('0x31')],_0x19be25=_0x1cc175['offset']+_0x1cc175[_0xa578('0x32')],_0x296f1f;if(_0x19be25>=_0x193b33){_0x19be25=_0x193b33;_0x296f1f=0xc8;}else{_0x296f1f=0xce;}_0x244c96[_0xa578('0x2f')](_0x296f1f);return _0x244c96[_0xa578('0x33')](_0xa578('0x34'),_0x46909d+'-'+_0x19be25+'/'+_0x193b33)[_0xa578('0x35')](_0x5223d8);}return null;};}function patchUpdates(_0xd1f633){return function(_0x580ed3){try{jsonpatch[_0xa578('0x36')](_0x580ed3,_0xd1f633,!![]);}catch(_0x276646){return BPromise[_0xa578('0x37')](_0x276646);}return _0x580ed3['save']();};}function saveUpdates(_0x3f8063,_0x51aca6){return function(_0x3b58bd){if(_0x3b58bd){return _0x3b58bd['update'](_0x3f8063)[_0xa578('0x38')](function(_0x5bdbec){return _0x5bdbec;});}return null;};}function removeEntity(_0x289239,_0x5d55d1){return function(_0x1353d5){if(_0x1353d5){return _0x1353d5[_0xa578('0x39')]()[_0xa578('0x38')](function(){_0x289239[_0xa578('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb64e8,_0x6d502b){return function(_0x419915){if(!_0x419915){_0xfb64e8['sendStatus'](0x194);}return _0x419915;};}function handleError(_0x3097f0,_0x2fcc55){_0x2fcc55=_0x2fcc55||0x1f4;return function(_0x4dd179){logger['error'](_0x4dd179[_0xa578('0x3a')]);if(_0x4dd179[_0xa578('0x3b')]){delete _0x4dd179[_0xa578('0x3b')];}_0x3097f0[_0xa578('0x2f')](_0x2fcc55)['send'](_0x4dd179);};}exports[_0xa578('0x3c')]=function(_0x10979c,_0x48f671){var _0x20ac38={},_0xefe368={},_0x154d4b={'count':0x0,'rows':[]};var _0x147399=_[_0xa578('0x3d')](db[_0xa578('0x3e')][_0xa578('0x3f')],function(_0x7df2b6){return{'name':_0x7df2b6['fieldName'],'type':_0x7df2b6['type']['key']};});_0xefe368[_0xa578('0x40')]=_['map'](_0x147399,_0xa578('0x3b'));_0xefe368[_0xa578('0x41')]=_[_0xa578('0x42')](_0x10979c[_0xa578('0x41')]);_0xefe368[_0xa578('0x43')]=_[_0xa578('0x44')](_0xefe368[_0xa578('0x40')],_0xefe368[_0xa578('0x41')]);_0x20ac38[_0xa578('0x45')]=_[_0xa578('0x44')](_0xefe368[_0xa578('0x40')],qs['fields'](_0x10979c[_0xa578('0x41')][_0xa578('0x46')]));_0x20ac38[_0xa578('0x45')]=_0x20ac38[_0xa578('0x45')][_0xa578('0x47')]?_0x20ac38['attributes']:_0xefe368[_0xa578('0x40')];if(!_0x10979c['query'][_0xa578('0x48')](_0xa578('0x49'))){_0x20ac38[_0xa578('0x32')]=qs[_0xa578('0x32')](_0x10979c[_0xa578('0x41')][_0xa578('0x32')]);_0x20ac38['offset']=qs['offset'](_0x10979c[_0xa578('0x41')][_0xa578('0x31')]);}_0x20ac38[_0xa578('0x4a')]=qs['sort'](_0x10979c['query'][_0xa578('0x4b')]);_0x20ac38[_0xa578('0x4c')]=qs[_0xa578('0x43')](_[_0xa578('0x4d')](_0x10979c[_0xa578('0x41')],_0xefe368['filters']),_0x147399);if(_0x10979c[_0xa578('0x41')][_0xa578('0x4e')]){_0x20ac38[_0xa578('0x4c')]=_['merge'](_0x20ac38[_0xa578('0x4c')],{'$or':_['map'](_0x147399,function(_0x1136e0){if(_0x1136e0[_0xa578('0x4f')]!==_0xa578('0x50')){var _0x224290={};_0x224290[_0x1136e0[_0xa578('0x3b')]]={'$like':'%'+_0x10979c['query'][_0xa578('0x4e')]+'%'};return _0x224290;}})});}_0x20ac38=_[_0xa578('0x51')]({},_0x20ac38,_0x10979c[_0xa578('0x52')]);var _0x5db4b1={'where':_0x20ac38[_0xa578('0x4c')]};return db[_0xa578('0x3e')][_0xa578('0x30')](_0x5db4b1)[_0xa578('0x38')](function(_0x551bbb){_0x154d4b['count']=_0x551bbb;if(_0x10979c[_0xa578('0x41')]['includeAll']){_0x20ac38[_0xa578('0x53')]=[{'all':!![]}];}return db[_0xa578('0x3e')][_0xa578('0x54')](_0x20ac38);})[_0xa578('0x38')](function(_0xbd103d){_0x154d4b['rows']=_0xbd103d;return _0x154d4b;})[_0xa578('0x38')](respondWithFilteredResult(_0x48f671,_0x20ac38))[_0xa578('0x2d')](handleError(_0x48f671,null));};exports[_0xa578('0x55')]=function(_0x50040f,_0x261989){var _0x4dc343={'raw':!![],'where':{'id':_0x50040f[_0xa578('0x56')]['id']}},_0x5b46b8={};_0x5b46b8[_0xa578('0x40')]=_[_0xa578('0x42')](db[_0xa578('0x3e')][_0xa578('0x3f')]);_0x5b46b8[_0xa578('0x41')]=_[_0xa578('0x42')](_0x50040f['query']);_0x5b46b8[_0xa578('0x43')]=_['intersection'](_0x5b46b8['model'],_0x5b46b8[_0xa578('0x41')]);_0x4dc343[_0xa578('0x45')]=_['intersection'](_0x5b46b8[_0xa578('0x40')],qs[_0xa578('0x46')](_0x50040f[_0xa578('0x41')]['fields']));_0x4dc343[_0xa578('0x45')]=_0x4dc343['attributes'][_0xa578('0x47')]?_0x4dc343[_0xa578('0x45')]:_0x5b46b8[_0xa578('0x40')];if(_0x50040f[_0xa578('0x41')][_0xa578('0x57')]){_0x4dc343['include']=[{'all':!![]}];}_0x4dc343=_[_0xa578('0x51')]({},_0x4dc343,_0x50040f[_0xa578('0x52')]);return db[_0xa578('0x3e')][_0xa578('0x58')](_0x4dc343)[_0xa578('0x38')](handleEntityNotFound(_0x261989,null))['then'](respondWithResult(_0x261989,null))[_0xa578('0x2d')](handleError(_0x261989,null));};exports[_0xa578('0x59')]=function(_0x43c557,_0x35bda2){return db[_0xa578('0x3e')][_0xa578('0x59')](_0x43c557['body'],{})[_0xa578('0x38')](respondWithResult(_0x35bda2,0xc9))[_0xa578('0x2d')](handleError(_0x35bda2,null));};exports['update']=function(_0x10def4,_0x1fdf5a){if(_0x10def4['body']['id']){delete _0x10def4['body']['id'];}return db[_0xa578('0x3e')][_0xa578('0x58')]({'where':{'id':_0x10def4[_0xa578('0x56')]['id']}})[_0xa578('0x38')](handleEntityNotFound(_0x1fdf5a,null))[_0xa578('0x38')](saveUpdates(_0x10def4[_0xa578('0x5a')],null))[_0xa578('0x38')](respondWithResult(_0x1fdf5a,null))[_0xa578('0x2d')](handleError(_0x1fdf5a,null));};exports[_0xa578('0x39')]=function(_0x1717ce,_0x5c4a8b){return db[_0xa578('0x3e')]['find']({'where':{'id':_0x1717ce['params']['id']}})[_0xa578('0x38')](handleEntityNotFound(_0x5c4a8b,null))[_0xa578('0x38')](removeEntity(_0x5c4a8b,null))[_0xa578('0x2d')](handleError(_0x5c4a8b,null));};exports[_0xa578('0x5b')]=function(_0x221c8a,_0x2520eb){return db[_0xa578('0x3e')]['describe']()[_0xa578('0x38')](respondWithResult(_0x2520eb,null))[_0xa578('0x2d')](handleError(_0x2520eb,null));};var interaction_log=require(_0xa578('0x15'))(_0xa578('0x5c'));exports['accept']=function(_0x4648ba,_0x1e0e4b,_0x4e4d7c){var _0x1ac335={'channel':_0xa578('0x5d')};if(_0x4648ba['body']['id']){delete _0x4648ba[_0xa578('0x5a')]['id'];}_0x4648ba[_0xa578('0x5a')][_0xa578('0x5e')]=!![];_0x4648ba[_0xa578('0x5a')][_0xa578('0x5f')]=moment()['format'](_0xa578('0x60'));_0x4648ba[_0xa578('0x5a')]['UserId']=_0x4648ba[_0xa578('0x5a')]['UserId']||_0x4648ba[_0xa578('0x61')]['id'];return db[_0xa578('0x3e')][_0xa578('0x58')]({'where':{'id':_0x4648ba[_0xa578('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xa578('0x62')],'as':_0xa578('0x63')}]})[_0xa578('0x38')](handleEntityNotFound(_0x1e0e4b,null))[_0xa578('0x38')](saveUpdates(_0x4648ba[_0xa578('0x5a')],null))['then'](function(_0x314ad0){if(_0x314ad0){_0x1ac335[_0xa578('0x2c')]=_0x314ad0['get']({'plain':!![]});return db[_0xa578('0x64')][_0xa578('0x58')]({'where':{'id':_0x314ad0[_0xa578('0x65')]}});}return null;})[_0xa578('0x38')](handleEntityNotFound(_0x1e0e4b,null))[_0xa578('0x38')](function(_0x3002c7){if(_0x3002c7){return _0x3002c7['update']({'UserId':_0x4648ba[_0xa578('0x5a')][_0xa578('0x66')],'read1stAt':_[_0xa578('0x67')](_0x3002c7[_0xa578('0x68')])?moment()['format'](_0xa578('0x60')):undefined});}return null;})[_0xa578('0x38')](function(_0x3179c3){if(_0x3179c3){_0x1ac335[_0xa578('0x69')]=_0x3179c3[_0xa578('0x6a')]({'plain':!![]});interaction_log['info'](_0xa578('0x6b'),_0x4648ba[_0xa578('0x61')]['id'],_0x4648ba[_0xa578('0x61')][_0xa578('0x3b')],_0x4648ba['user']['role'],_0x1ac335[_0xa578('0x69')]['id'],_0x4648ba[_0xa578('0x5a')]?JSON[_0xa578('0x29')](_0x4648ba[_0xa578('0x5a')]):'null');return respondWithRpcPromise('AcceptMessage',_0xa578('0x6c'),_0x1ac335);}return null;})[_0xa578('0x38')](function(_0x5bfb00){if(_0x5bfb00){if(_0x4648ba[_0xa578('0x5a')][_0xa578('0x6d')]){_0x1ac335['message'][_0xa578('0x6e')]=util['format'](_0xa578('0x6f'),_0x4648ba[_0xa578('0x61')][_0xa578('0x3b')]);_0x1ac335[_0xa578('0x2c')][_0xa578('0x70')]=_0x1ac335[_0xa578('0x70')];_0x1ac335[_0xa578('0x2c')][_0xa578('0x71')]=_0xa578('0x72');return respondWithRpcPromise(_0xa578('0x73'),_0xa578('0x73'),{'event':_0xa578('0x74'),'message':_0x1ac335[_0xa578('0x2c')]},client9002)[_0xa578('0x38')](function(){return _0x1ac335;});}return _0x1ac335;}return null;})[_0xa578('0x38')](respondWithResult(_0x1e0e4b,null))[_0xa578('0x2d')](handleError(_0x1e0e4b,null));};var interaction_log=require(_0xa578('0x15'))('whatsapp-interactions');exports[_0xa578('0x37')]=function(_0x5ad349,_0x535cf6,_0x4fde23){var _0x510a8a={'agent':{},'channel':'whatsapp'};if(_0x5ad349[_0xa578('0x5a')]['id']){delete _0x5ad349[_0xa578('0x5a')]['id'];}_0x5ad349[_0xa578('0x5a')][_0xa578('0x66')]=_0x5ad349[_0xa578('0x5a')][_0xa578('0x66')]||_0x5ad349[_0xa578('0x61')]['id'];_0x510a8a['agent']['id']=_0x5ad349['body']['UserId'];return db[_0xa578('0x3e')][_0xa578('0x58')]({'where':{'id':_0x5ad349[_0xa578('0x56')]['id'],'UserId':null}})[_0xa578('0x38')](handleEntityNotFound(_0x535cf6,null))[_0xa578('0x38')](function(_0x5c0cf8){if(_0x5c0cf8){_0x510a8a[_0xa578('0x2c')]=_0x5c0cf8[_0xa578('0x6a')]({'plain':!![]});return db[_0xa578('0x64')][_0xa578('0x58')]({'where':{'id':_0x5c0cf8[_0xa578('0x65')]}});}return null;})[_0xa578('0x38')](handleEntityNotFound(_0x535cf6,null))['then'](function(_0x375cdd){if(_0x375cdd){_0x510a8a[_0xa578('0x69')]=_0x375cdd[_0xa578('0x6a')]({'plain':!![]});interaction_log[_0xa578('0x25')](_0xa578('0x75'),_0x5ad349[_0xa578('0x61')]['id'],_0x5ad349['user'][_0xa578('0x3b')],_0x5ad349[_0xa578('0x61')]['role'],_0x510a8a[_0xa578('0x69')]['id'],_0x5ad349[_0xa578('0x5a')]?JSON['stringify'](_0x5ad349[_0xa578('0x5a')]):_0xa578('0x76'));return respondWithRpcPromise('RejectMessage',_0xa578('0x77'),_0x510a8a);}return null;})[_0xa578('0x38')](function(_0x2b8ad7){if(_0x2b8ad7){_0x2b8ad7[_0xa578('0x2c')]['interface']=util['format'](_0xa578('0x6f'),_0x5ad349[_0xa578('0x61')][_0xa578('0x3b')]);_0x2b8ad7[_0xa578('0x2c')][_0xa578('0x70')]=_0x510a8a[_0xa578('0x70')];_0x2b8ad7[_0xa578('0x2c')][_0xa578('0x71')]='reject';respondWithRpcPromise(_0xa578('0x73'),_0xa578('0x73'),{'event':_0xa578('0x78'),'message':_0x2b8ad7[_0xa578('0x2c')]},client9002);return _0x510a8a;}return null;})['then'](respondWithResult(_0x535cf6,null))[_0xa578('0x2d')](handleError(_0x535cf6,null));};exports[_0xa578('0x2f')]=function(_0x100104,_0x231cca,_0x56acad){if(_0x100104[_0xa578('0x5a')]['id']){delete _0x100104[_0xa578('0x5a')]['id'];}var _0x385a63;return db['WhatsappMessage']['find']({'where':{'id':_0x100104['params']['id']}})[_0xa578('0x38')](handleEntityNotFound(_0x231cca,null))['then'](function(_0x22150f){if(_0x22150f){_0x385a63=_0x22150f;return db['WhatsappAccount'][_0xa578('0x58')]({'where':{'id':_0x22150f['WhatsappAccountId']}});}})[_0xa578('0x38')](handleEntityNotFound(_0x231cca,null))[_0xa578('0x38')](function(_0x2c4874){if(_0x2c4874){logger[_0xa578('0x79')](_0xa578('0x7a'),_0xa578('0x2f'),_0xa578('0x7b'),_0x2c4874[_0xa578('0x4f')],util['inspect'](_0x100104[_0xa578('0x5a')],{'showHidden':![],'depth':null}));switch(_0x2c4874[_0xa578('0x4f')]){case _0xa578('0x7c'):if(_0x100104[_0xa578('0x5a')][_0xa578('0x7d')]&&_0x100104[_0xa578('0x5a')][_0xa578('0x7d')]===_0x385a63['messageId']&&_0x100104['body'][_0xa578('0x7e')]&&_0x100104['body']['MessageStatus']==='read'){return _0x385a63[_0xa578('0x7f')]({'read':!![]});}else{logger['error'](_0xa578('0x80'),_0xa578('0x2f'),_0xa578('0x7c'),util[_0xa578('0x81')](_0x100104['body'],{'showHidden':![],'depth':null}));}break;}return _0x385a63;}})[_0xa578('0x38')](respondWithResult(_0x231cca,null))[_0xa578('0x2d')](handleError(_0x231cca,null));}; \ No newline at end of file +var _0xebc9=['index','WhatsappMessage','rawAttributes','type','key','model','map','keys','query','attributes','intersection','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','count','includeAll','include','findAll','rows','show','fields','options','find','create','body','update','params','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','isNil','read1stAt','stringify','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','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~!@#$%^&-_=+[{]}.','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','status','json','offset','limit','Content-Range','reject','save','destroy','stack','name','send'];(function(_0xe1209d,_0x5a4cf4){var _0x25d286=function(_0x3c9d53){while(--_0x3c9d53){_0xe1209d['push'](_0xe1209d['shift']());}};_0x25d286(++_0x5a4cf4);}(_0xebc9,0x1d2));var _0x9ebc=function(_0x3d56e1,_0xe7287){_0x3d56e1=_0x3d56e1-0x0;var _0x4e24a8=_0xebc9[_0x3d56e1];return _0x4e24a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9ebc('0x0'));var rimraf=require(_0x9ebc('0x1'));var zipdir=require(_0x9ebc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ebc('0x3'));var moment=require(_0x9ebc('0x4'));var BPromise=require(_0x9ebc('0x5'));var Mustache=require(_0x9ebc('0x6'));var util=require(_0x9ebc('0x7'));var path=require(_0x9ebc('0x8'));var sox=require(_0x9ebc('0x9'));var csv=require('to-csv');var ejs=require(_0x9ebc('0xa'));var fs=require('fs');var _=require(_0x9ebc('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9ebc('0xc'));var Redis=require(_0x9ebc('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9ebc('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ebc('0xf'));var logger=require('../../config/logger')(_0x9ebc('0x10'));var utils=require(_0x9ebc('0x11'));var config=require(_0x9ebc('0x12'));var db=require(_0x9ebc('0x13'))['db'];config[_0x9ebc('0x14')]=_['defaults'](config[_0x9ebc('0x14')],{'host':_0x9ebc('0x15'),'port':0x18eb});var socket=require(_0x9ebc('0x16'))(new Redis(config['redis']));require(_0x9ebc('0x17'))[_0x9ebc('0x18')](socket);var jayson=require(_0x9ebc('0x19'));var client=jayson['client'][_0x9ebc('0x1a')]({'port':0x232c});var client9002=jayson[_0x9ebc('0x1b')][_0x9ebc('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2c6485,_0x5f0b7a,_0x17c168){if(_0x17c168){var _0x11bc93=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11bc93[_0x9ebc('0x1c')](_0x5f0b7a)){return _0x2c6485;}else{throw new db[(_0x9ebc('0x1d'))][(_0x9ebc('0x1e'))](_0x9ebc('0x1f'));}}else{return _0x2c6485;}}function respondWithRpcPromise(_0x44224e,_0x4eb76c,_0x3206df,_0x4011a5){return new BPromise(function(_0x2d4e36,_0xf016af){var _0x361234=_0x4011a5||client;return _0x361234[_0x9ebc('0x20')](_0x44224e,_0x3206df)[_0x9ebc('0x21')](function(_0x43e692){logger[_0x9ebc('0x22')](_0x9ebc('0x23'),_0x4eb76c,'request\x20sent');logger[_0x9ebc('0x24')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4eb76c,_0x9ebc('0x25'),JSON['stringify'](_0x43e692));if(_0x43e692['error']){if(_0x43e692[_0x9ebc('0x26')][_0x9ebc('0x27')]===0x1f4){logger[_0x9ebc('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x4eb76c,_0x43e692[_0x9ebc('0x26')][_0x9ebc('0x28')]);return _0xf016af(_0x43e692[_0x9ebc('0x26')][_0x9ebc('0x28')]);}logger[_0x9ebc('0x26')](_0x9ebc('0x23'),_0x4eb76c,_0x43e692[_0x9ebc('0x26')][_0x9ebc('0x28')]);return _0x2d4e36(_0x43e692[_0x9ebc('0x26')][_0x9ebc('0x28')]);}else{logger['info'](_0x9ebc('0x23'),_0x4eb76c,'request\x20sent');_0x2d4e36(_0x43e692[_0x9ebc('0x29')][_0x9ebc('0x28')]);}})[_0x9ebc('0x2a')](function(_0x26df9c){logger[_0x9ebc('0x26')](_0x9ebc('0x23'),_0x4eb76c,_0x26df9c);_0xf016af(_0x26df9c);});});}function respondWithStatusCode(_0xf4416e,_0x3f30bf){_0x3f30bf=_0x3f30bf||0xcc;return function(_0x2ae960){if(_0x2ae960){return _0xf4416e['sendStatus'](_0x3f30bf);}return _0xf4416e[_0x9ebc('0x2b')](_0x3f30bf)['end']();};}function respondWithResult(_0x44fee6,_0x13d3f3){_0x13d3f3=_0x13d3f3||0xc8;return function(_0x12a305){if(_0x12a305){return _0x44fee6[_0x9ebc('0x2b')](_0x13d3f3)[_0x9ebc('0x2c')](_0x12a305);}};}function respondWithFilteredResult(_0x1c0589,_0x2f6086){return function(_0x3956a9){if(_0x3956a9){var _0x4a7841=_0x3956a9['count'],_0x4a77e3=_0x2f6086['offset'],_0x1f3d15=_0x2f6086[_0x9ebc('0x2d')]+_0x2f6086[_0x9ebc('0x2e')],_0x114279;if(_0x1f3d15>=_0x4a7841){_0x1f3d15=_0x4a7841;_0x114279=0xc8;}else{_0x114279=0xce;}_0x1c0589[_0x9ebc('0x2b')](_0x114279);return _0x1c0589['set'](_0x9ebc('0x2f'),_0x4a77e3+'-'+_0x1f3d15+'/'+_0x4a7841)[_0x9ebc('0x2c')](_0x3956a9);}return null;};}function patchUpdates(_0xab25c7){return function(_0x4dfc4b){try{jsonpatch['apply'](_0x4dfc4b,_0xab25c7,!![]);}catch(_0x118e8b){return BPromise[_0x9ebc('0x30')](_0x118e8b);}return _0x4dfc4b[_0x9ebc('0x31')]();};}function saveUpdates(_0x130b09,_0xbe1b40){return function(_0x1e74c2){if(_0x1e74c2){return _0x1e74c2['update'](_0x130b09)['then'](function(_0x462e9a){return _0x462e9a;});}return null;};}function removeEntity(_0x58324e,_0x2b6558){return function(_0x1cf5f3){if(_0x1cf5f3){return _0x1cf5f3[_0x9ebc('0x32')]()[_0x9ebc('0x21')](function(){_0x58324e[_0x9ebc('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c502a,_0x116230){return function(_0x1d31d1){if(!_0x1d31d1){_0x3c502a['sendStatus'](0x194);}return _0x1d31d1;};}function handleError(_0x1acef2,_0x320f25){_0x320f25=_0x320f25||0x1f4;return function(_0x1a0b2d){logger['error'](_0x1a0b2d[_0x9ebc('0x33')]);if(_0x1a0b2d[_0x9ebc('0x34')]){delete _0x1a0b2d['name'];}_0x1acef2[_0x9ebc('0x2b')](_0x320f25)[_0x9ebc('0x35')](_0x1a0b2d);};}exports[_0x9ebc('0x36')]=function(_0x1d6b4b,_0x5d1bb6){var _0x570e18={},_0x1c9807={},_0x254735={'count':0x0,'rows':[]};var _0x3e9f59=_['map'](db[_0x9ebc('0x37')][_0x9ebc('0x38')],function(_0x554d2d){return{'name':_0x554d2d['fieldName'],'type':_0x554d2d[_0x9ebc('0x39')][_0x9ebc('0x3a')]};});_0x1c9807[_0x9ebc('0x3b')]=_[_0x9ebc('0x3c')](_0x3e9f59,_0x9ebc('0x34'));_0x1c9807['query']=_[_0x9ebc('0x3d')](_0x1d6b4b[_0x9ebc('0x3e')]);_0x1c9807['filters']=_['intersection'](_0x1c9807['model'],_0x1c9807[_0x9ebc('0x3e')]);_0x570e18[_0x9ebc('0x3f')]=_[_0x9ebc('0x40')](_0x1c9807[_0x9ebc('0x3b')],qs['fields'](_0x1d6b4b[_0x9ebc('0x3e')]['fields']));_0x570e18[_0x9ebc('0x3f')]=_0x570e18['attributes'][_0x9ebc('0x41')]?_0x570e18['attributes']:_0x1c9807[_0x9ebc('0x3b')];if(!_0x1d6b4b[_0x9ebc('0x3e')]['hasOwnProperty'](_0x9ebc('0x42'))){_0x570e18[_0x9ebc('0x2e')]=qs['limit'](_0x1d6b4b[_0x9ebc('0x3e')][_0x9ebc('0x2e')]);_0x570e18[_0x9ebc('0x2d')]=qs[_0x9ebc('0x2d')](_0x1d6b4b[_0x9ebc('0x3e')][_0x9ebc('0x2d')]);}_0x570e18[_0x9ebc('0x43')]=qs[_0x9ebc('0x44')](_0x1d6b4b[_0x9ebc('0x3e')]['sort']);_0x570e18[_0x9ebc('0x45')]=qs[_0x9ebc('0x46')](_[_0x9ebc('0x47')](_0x1d6b4b[_0x9ebc('0x3e')],_0x1c9807[_0x9ebc('0x46')]),_0x3e9f59);if(_0x1d6b4b[_0x9ebc('0x3e')][_0x9ebc('0x48')]){_0x570e18[_0x9ebc('0x45')]=_['merge'](_0x570e18[_0x9ebc('0x45')],{'$or':_[_0x9ebc('0x3c')](_0x3e9f59,function(_0x204875){if(_0x204875[_0x9ebc('0x39')]!==_0x9ebc('0x49')){var _0x8670b6={};_0x8670b6[_0x204875[_0x9ebc('0x34')]]={'$like':'%'+_0x1d6b4b[_0x9ebc('0x3e')][_0x9ebc('0x48')]+'%'};return _0x8670b6;}})});}_0x570e18=_['merge']({},_0x570e18,_0x1d6b4b['options']);var _0x461fb5={'where':_0x570e18[_0x9ebc('0x45')]};return db[_0x9ebc('0x37')]['count'](_0x461fb5)[_0x9ebc('0x21')](function(_0x2e2f13){_0x254735[_0x9ebc('0x4a')]=_0x2e2f13;if(_0x1d6b4b[_0x9ebc('0x3e')][_0x9ebc('0x4b')]){_0x570e18[_0x9ebc('0x4c')]=[{'all':!![]}];}return db[_0x9ebc('0x37')][_0x9ebc('0x4d')](_0x570e18);})[_0x9ebc('0x21')](function(_0x4ba03d){_0x254735[_0x9ebc('0x4e')]=_0x4ba03d;return _0x254735;})[_0x9ebc('0x21')](respondWithFilteredResult(_0x5d1bb6,_0x570e18))[_0x9ebc('0x2a')](handleError(_0x5d1bb6,null));};exports[_0x9ebc('0x4f')]=function(_0x138b93,_0x43dd42){var _0x4d781a={'raw':!![],'where':{'id':_0x138b93['params']['id']}},_0x5ca1c1={};_0x5ca1c1[_0x9ebc('0x3b')]=_[_0x9ebc('0x3d')](db['WhatsappMessage'][_0x9ebc('0x38')]);_0x5ca1c1[_0x9ebc('0x3e')]=_[_0x9ebc('0x3d')](_0x138b93[_0x9ebc('0x3e')]);_0x5ca1c1[_0x9ebc('0x46')]=_['intersection'](_0x5ca1c1[_0x9ebc('0x3b')],_0x5ca1c1[_0x9ebc('0x3e')]);_0x4d781a[_0x9ebc('0x3f')]=_[_0x9ebc('0x40')](_0x5ca1c1[_0x9ebc('0x3b')],qs['fields'](_0x138b93[_0x9ebc('0x3e')][_0x9ebc('0x50')]));_0x4d781a['attributes']=_0x4d781a['attributes']['length']?_0x4d781a[_0x9ebc('0x3f')]:_0x5ca1c1[_0x9ebc('0x3b')];if(_0x138b93['query']['includeAll']){_0x4d781a[_0x9ebc('0x4c')]=[{'all':!![]}];}_0x4d781a=_['merge']({},_0x4d781a,_0x138b93[_0x9ebc('0x51')]);return db[_0x9ebc('0x37')][_0x9ebc('0x52')](_0x4d781a)[_0x9ebc('0x21')](handleEntityNotFound(_0x43dd42,null))[_0x9ebc('0x21')](respondWithResult(_0x43dd42,null))['catch'](handleError(_0x43dd42,null));};exports[_0x9ebc('0x53')]=function(_0x505003,_0x316357){return db['WhatsappMessage'][_0x9ebc('0x53')](_0x505003[_0x9ebc('0x54')],{})[_0x9ebc('0x21')](respondWithResult(_0x316357,0xc9))[_0x9ebc('0x2a')](handleError(_0x316357,null));};exports[_0x9ebc('0x55')]=function(_0x2fca52,_0x116b8b){if(_0x2fca52[_0x9ebc('0x54')]['id']){delete _0x2fca52[_0x9ebc('0x54')]['id'];}return db['WhatsappMessage'][_0x9ebc('0x52')]({'where':{'id':_0x2fca52[_0x9ebc('0x56')]['id']}})[_0x9ebc('0x21')](handleEntityNotFound(_0x116b8b,null))['then'](saveUpdates(_0x2fca52[_0x9ebc('0x54')],null))[_0x9ebc('0x21')](respondWithResult(_0x116b8b,null))['catch'](handleError(_0x116b8b,null));};exports['destroy']=function(_0x23f55e,_0x290976){return db[_0x9ebc('0x37')][_0x9ebc('0x52')]({'where':{'id':_0x23f55e[_0x9ebc('0x56')]['id']}})[_0x9ebc('0x21')](handleEntityNotFound(_0x290976,null))['then'](removeEntity(_0x290976,null))[_0x9ebc('0x2a')](handleError(_0x290976,null));};exports[_0x9ebc('0x57')]=function(_0x89b64d,_0x2ea7eb){return db[_0x9ebc('0x37')][_0x9ebc('0x57')]()[_0x9ebc('0x21')](respondWithResult(_0x2ea7eb,null))['catch'](handleError(_0x2ea7eb,null));};var interaction_log=require(_0x9ebc('0x58'))(_0x9ebc('0x59'));exports[_0x9ebc('0x5a')]=function(_0x5a2f3a,_0x29bb1a,_0x23abf9){var _0x6f6fe9={'channel':_0x9ebc('0x5b')};if(_0x5a2f3a[_0x9ebc('0x54')]['id']){delete _0x5a2f3a[_0x9ebc('0x54')]['id'];}_0x5a2f3a['body'][_0x9ebc('0x5c')]=!![];_0x5a2f3a[_0x9ebc('0x54')][_0x9ebc('0x5d')]=moment()[_0x9ebc('0x5e')](_0x9ebc('0x5f'));_0x5a2f3a[_0x9ebc('0x54')][_0x9ebc('0x60')]=_0x5a2f3a[_0x9ebc('0x54')][_0x9ebc('0x60')]||_0x5a2f3a[_0x9ebc('0x61')]['id'];return db[_0x9ebc('0x37')][_0x9ebc('0x52')]({'where':{'id':_0x5a2f3a['params']['id'],'UserId':null},'include':[{'model':db[_0x9ebc('0x62')],'as':_0x9ebc('0x63')}]})[_0x9ebc('0x21')](handleEntityNotFound(_0x29bb1a,null))['then'](saveUpdates(_0x5a2f3a[_0x9ebc('0x54')],null))[_0x9ebc('0x21')](function(_0xff188){if(_0xff188){_0x6f6fe9[_0x9ebc('0x28')]=_0xff188[_0x9ebc('0x64')]({'plain':!![]});return db[_0x9ebc('0x65')][_0x9ebc('0x52')]({'where':{'id':_0xff188['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x29bb1a,null))[_0x9ebc('0x21')](function(_0x20ed7d){if(_0x20ed7d){return _0x20ed7d['update']({'UserId':_0x5a2f3a[_0x9ebc('0x54')][_0x9ebc('0x60')],'read1stAt':_[_0x9ebc('0x66')](_0x20ed7d[_0x9ebc('0x67')])?moment()[_0x9ebc('0x5e')](_0x9ebc('0x5f')):undefined});}return null;})[_0x9ebc('0x21')](function(_0x578206){if(_0x578206){_0x6f6fe9['interaction']=_0x578206[_0x9ebc('0x64')]({'plain':!![]});interaction_log[_0x9ebc('0x22')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5a2f3a['user']['id'],_0x5a2f3a[_0x9ebc('0x61')]['name'],_0x5a2f3a['user']['role'],_0x6f6fe9['interaction']['id'],_0x5a2f3a[_0x9ebc('0x54')]?JSON[_0x9ebc('0x68')](_0x5a2f3a[_0x9ebc('0x54')]):_0x9ebc('0x69'));return respondWithRpcPromise(_0x9ebc('0x6a'),_0x9ebc('0x6b'),_0x6f6fe9);}return null;})[_0x9ebc('0x21')](function(_0x38fdc4){if(_0x38fdc4){if(_0x5a2f3a[_0x9ebc('0x54')][_0x9ebc('0x6c')]){_0x6f6fe9[_0x9ebc('0x28')][_0x9ebc('0x6d')]=util[_0x9ebc('0x5e')](_0x9ebc('0x6e'),_0x5a2f3a[_0x9ebc('0x61')][_0x9ebc('0x34')]);_0x6f6fe9[_0x9ebc('0x28')][_0x9ebc('0x6f')]=_0x6f6fe9[_0x9ebc('0x6f')];_0x6f6fe9['message'][_0x9ebc('0x70')]=_0x9ebc('0x5a');return respondWithRpcPromise('EventManager',_0x9ebc('0x71'),{'event':_0x9ebc('0x72'),'message':_0x6f6fe9['message']},client9002)['then'](function(){return _0x6f6fe9;});}return _0x6f6fe9;}return null;})[_0x9ebc('0x21')](respondWithResult(_0x29bb1a,null))[_0x9ebc('0x2a')](handleError(_0x29bb1a,null));};var interaction_log=require(_0x9ebc('0x58'))(_0x9ebc('0x59'));exports[_0x9ebc('0x30')]=function(_0xe1761f,_0xbe0851,_0x3c7cfa){var _0x165207={'agent':{},'channel':_0x9ebc('0x5b')};if(_0xe1761f['body']['id']){delete _0xe1761f[_0x9ebc('0x54')]['id'];}_0xe1761f['body'][_0x9ebc('0x60')]=_0xe1761f[_0x9ebc('0x54')][_0x9ebc('0x60')]||_0xe1761f['user']['id'];_0x165207[_0x9ebc('0x73')]['id']=_0xe1761f[_0x9ebc('0x54')][_0x9ebc('0x60')];return db[_0x9ebc('0x37')][_0x9ebc('0x52')]({'where':{'id':_0xe1761f[_0x9ebc('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xbe0851,null))['then'](function(_0x591ccc){if(_0x591ccc){_0x165207[_0x9ebc('0x28')]=_0x591ccc[_0x9ebc('0x64')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x591ccc['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xbe0851,null))[_0x9ebc('0x21')](function(_0x5d7db4){if(_0x5d7db4){_0x165207[_0x9ebc('0x74')]=_0x5d7db4[_0x9ebc('0x64')]({'plain':!![]});interaction_log[_0x9ebc('0x22')](_0x9ebc('0x75'),_0xe1761f[_0x9ebc('0x61')]['id'],_0xe1761f[_0x9ebc('0x61')]['name'],_0xe1761f[_0x9ebc('0x61')][_0x9ebc('0x76')],_0x165207['interaction']['id'],_0xe1761f[_0x9ebc('0x54')]?JSON[_0x9ebc('0x68')](_0xe1761f[_0x9ebc('0x54')]):_0x9ebc('0x69'));return respondWithRpcPromise(_0x9ebc('0x77'),_0x9ebc('0x78'),_0x165207);}return null;})['then'](function(_0x273cf4){if(_0x273cf4){_0x273cf4[_0x9ebc('0x28')][_0x9ebc('0x6d')]=util[_0x9ebc('0x5e')](_0x9ebc('0x6e'),_0xe1761f[_0x9ebc('0x61')]['name']);_0x273cf4['message'][_0x9ebc('0x6f')]=_0x165207['channel'];_0x273cf4[_0x9ebc('0x28')][_0x9ebc('0x70')]=_0x9ebc('0x30');respondWithRpcPromise(_0x9ebc('0x71'),_0x9ebc('0x71'),{'event':'rejectmessage','message':_0x273cf4[_0x9ebc('0x28')]},client9002);return _0x165207;}return null;})['then'](respondWithResult(_0xbe0851,null))[_0x9ebc('0x2a')](handleError(_0xbe0851,null));};exports[_0x9ebc('0x2b')]=function(_0xa53d9c,_0x1cd06c,_0x3482a7){if(_0xa53d9c[_0x9ebc('0x54')]['id']){delete _0xa53d9c[_0x9ebc('0x54')]['id'];}var _0x46ee7f;return db[_0x9ebc('0x37')][_0x9ebc('0x52')]({'where':{'id':_0xa53d9c[_0x9ebc('0x56')]['id']}})[_0x9ebc('0x21')](handleEntityNotFound(_0x1cd06c,null))[_0x9ebc('0x21')](function(_0x170cf7){if(_0x170cf7){_0x46ee7f=_0x170cf7;return db[_0x9ebc('0x79')][_0x9ebc('0x52')]({'where':{'id':_0x170cf7[_0x9ebc('0x7a')]}});}})[_0x9ebc('0x21')](handleEntityNotFound(_0x1cd06c,null))['then'](function(_0x104f32){if(_0x104f32){logger[_0x9ebc('0x24')](_0x9ebc('0x7b'),_0x9ebc('0x2b'),'received\x20delivery\x20report\x20from',_0x104f32[_0x9ebc('0x39')],util[_0x9ebc('0x7c')](_0xa53d9c[_0x9ebc('0x54')],{'showHidden':![],'depth':null}));switch(_0x104f32[_0x9ebc('0x39')]){case _0x9ebc('0x7d'):if(_0xa53d9c['body']['MessageSid']&&_0xa53d9c[_0x9ebc('0x54')][_0x9ebc('0x7e')]===_0x46ee7f[_0x9ebc('0x7f')]&&_0xa53d9c['body'][_0x9ebc('0x80')]&&_0xa53d9c[_0x9ebc('0x54')][_0x9ebc('0x80')]===_0x9ebc('0x5c')){return _0x46ee7f[_0x9ebc('0x55')]({'read':!![]});}else{logger[_0x9ebc('0x26')](_0x9ebc('0x81'),'status',_0x9ebc('0x7d'),util['inspect'](_0xa53d9c[_0x9ebc('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x46ee7f;}})[_0x9ebc('0x21')](respondWithResult(_0x1cd06c,null))[_0x9ebc('0x2a')](handleError(_0x1cd06c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 152fe1c..9196d15 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x349a0b,_0x187ddd){var _0x48aa3b=function(_0x216a79){while(--_0x216a79){_0x349a0b['push'](_0x349a0b['shift']());}};_0x48aa3b(++_0x187ddd);}(_0x7a54,0x106));var _0x47a5=function(_0x355d73,_0xb67a4c){_0x355d73=_0x355d73-0x0;var _0x3dc12c=_0x7a54[_0x355d73];return _0x3dc12c;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x12f449,_0x43c1b9){var _0x526954=function(_0x1ddf99){while(--_0x1ddf99){_0x12f449['push'](_0x12f449['shift']());}};_0x526954(++_0x43c1b9);}(_0xb10b,0x12a));var _0xbb10=function(_0x6fd8ad,_0x597818){_0x6fd8ad=_0x6fd8ad-0x0;var _0x257d21=_0xb10b[_0x6fd8ad];return _0x257d21;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index dd97491..bb138a4 100644 --- a/server/api/whatsappMessage/whatsappMessage.model.js +++ b/server/api/whatsappMessage/whatsappMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8a4=['body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','out','WhatsappAccount','find','WhatsappAccountId','type','accountSid','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','twilio','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages'];(function(_0x260391,_0x2eda13){var _0x30abef=function(_0x1793b4){while(--_0x1793b4){_0x260391['push'](_0x260391['shift']());}};_0x30abef(++_0x2eda13);}(_0xd8a4,0x16b));var _0x4d8a=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xd8a4[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x4d8a('0x0'));var util=require(_0x4d8a('0x1'));var logger=require(_0x4d8a('0x2'))(_0x4d8a('0x3'));var moment=require(_0x4d8a('0x4'));var BPromise=require(_0x4d8a('0x5'));var rp=require(_0x4d8a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d8a('0x7'));var config=require(_0x4d8a('0x8'));var attributes=require(_0x4d8a('0x9'));module[_0x4d8a('0xa')]=function(_0xef5d03,_0x1c7001){return _0xef5d03[_0x4d8a('0xb')]('WhatsappMessage',attributes,{'tableName':_0x4d8a('0xc'),'paranoid':![],'indexes':[{'name':_0x4d8a('0xd'),'fields':['messageId']},{'name':_0x4d8a('0xe'),'fields':[_0x4d8a('0xf')],'type':_0x4d8a('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f454a,_0x9f350f,_0x15893b){var _0x2e6dcc=_0xef5d03[_0x4d8a('0x11')];var _0x39d89c=_0x2f454a[_0x4d8a('0x12')]({'plain':!![]});if(_0x39d89c[_0x4d8a('0x13')][_0x4d8a('0x14')]()==='in'||_0x39d89c[_0x4d8a('0x13')][_0x4d8a('0x14')]()==='out'&&!_0x39d89c[_0x4d8a('0x15')]&&!_[_0x4d8a('0x16')](_0x39d89c[_0x4d8a('0x17')])){_0x2e6dcc[_0x4d8a('0x18')][_0x4d8a('0x19')]({'where':{'id':_0x39d89c[_0x4d8a('0x1a')]}})[_0x4d8a('0x1b')](function(_0x10b2b0){if(_0x10b2b0){_0x10b2b0['update']({'lastMsgAt':_0x39d89c[_0x4d8a('0x1c')],'lastMsgDirection':_0x39d89c['direction']['toLowerCase']()});}})[_0x4d8a('0x1d')](function(_0x66892f){console[_0x4d8a('0x1e')](_0x66892f);});}if(_0x39d89c[_0x4d8a('0x13')]===_0x4d8a('0x1f')&&!_0x39d89c[_0x4d8a('0x15')]){var _0x365322;_0x2e6dcc[_0x4d8a('0x20')][_0x4d8a('0x21')]({'where':{'id':_0x39d89c[_0x4d8a('0x22')]},'raw':!![]})[_0x4d8a('0x1b')](function(_0x4e6572){_0x365322=_0x4e6572;if(_0x365322&&_0x365322[_0x4d8a('0x23')]){switch(_0x365322[_0x4d8a('0x23')]){case'twilio':var _0x14f94b=require('twilio');if(_0x365322[_0x4d8a('0x24')]&&_0x365322['authToken']&&_0x365322[_0x4d8a('0x25')]){var _0x20177d=new _0x14f94b(_0x365322[_0x4d8a('0x24')],_0x365322[_0x4d8a('0x26')]);_0x20177d[_0x4d8a('0x27')][_0x4d8a('0x28')]({'body':_0x39d89c['body'],'to':_0x4d8a('0x29')+_0x39d89c['phone'],'from':_0x4d8a('0x29')+_0x365322['phone'],'statusCallback':_0x365322[_0x4d8a('0x2a')]+_0x4d8a('0x2b')+_0x39d89c['id']+_0x4d8a('0x2c')+_0x365322['token']})['then'](function(_0xf109cf){if(_0xf109cf[_0x4d8a('0x2d')]){return _0x2f454a[_0x4d8a('0x2e')]({'messageId':_0xf109cf[_0x4d8a('0x2d')]});}})['catch'](function(_0x548d6e){logger[_0x4d8a('0x1e')](_0x4d8a('0x2f'),'afterCreate',_0x4d8a('0x30'),util[_0x4d8a('0x31')](_0x548d6e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4d8a('0x2f'),_0x4d8a('0x32'),_0x4d8a('0x30'),_0x4d8a('0x33'));}break;}}})[_0x4d8a('0x34')](function(){_0x15893b();});}else{_0x15893b();}}},'charset':_0x4d8a('0x35'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x84e7=['messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','out','WhatsappAccount','find','WhatsappAccountId','twilio','accountSid','phone','authToken'];(function(_0xe6036b,_0x57ced5){var _0x9dd9e=function(_0x413feb){while(--_0x413feb){_0xe6036b['push'](_0xe6036b['shift']());}};_0x9dd9e(++_0x57ced5);}(_0x84e7,0x17a));var _0x784e=function(_0xd90da7,_0x532c10){_0xd90da7=_0xd90da7-0x0;var _0x392ca9=_0x84e7[_0xd90da7];return _0x392ca9;};'use strict';var _=require(_0x784e('0x0'));var util=require(_0x784e('0x1'));var logger=require(_0x784e('0x2'))('api');var moment=require(_0x784e('0x3'));var BPromise=require(_0x784e('0x4'));var rp=require(_0x784e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x784e('0x6'));var config=require(_0x784e('0x7'));var attributes=require(_0x784e('0x8'));module['exports']=function(_0x206939,_0x4bc72f){return _0x206939[_0x784e('0x9')](_0x784e('0xa'),attributes,{'tableName':_0x784e('0xb'),'paranoid':![],'indexes':[{'name':_0x784e('0xc'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0x784e('0xd')],'type':_0x784e('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x6722b4,_0x33a527,_0x5bd325){var _0x28dba4=_0x206939[_0x784e('0xf')];var _0x4612b2=_0x6722b4[_0x784e('0x10')]({'plain':!![]});if(_0x4612b2[_0x784e('0x11')][_0x784e('0x12')]()==='in'||_0x4612b2[_0x784e('0x11')][_0x784e('0x12')]()==='out'&&!_0x4612b2[_0x784e('0x13')]&&!_[_0x784e('0x14')](_0x4612b2[_0x784e('0x15')])){_0x28dba4[_0x784e('0x16')][_0x784e('0x17')]({'where':{'id':_0x4612b2[_0x784e('0x18')]}})[_0x784e('0x19')](function(_0x1b229e){if(_0x1b229e){_0x1b229e[_0x784e('0x1a')]({'lastMsgAt':_0x4612b2[_0x784e('0x1b')],'lastMsgDirection':_0x4612b2[_0x784e('0x11')][_0x784e('0x12')]()});}})[_0x784e('0x1c')](function(_0x552dc0){console[_0x784e('0x1d')](_0x552dc0);});}if(_0x4612b2[_0x784e('0x11')]===_0x784e('0x1e')&&!_0x4612b2[_0x784e('0x13')]){var _0x6a510f;_0x28dba4[_0x784e('0x1f')][_0x784e('0x20')]({'where':{'id':_0x4612b2[_0x784e('0x21')]},'raw':!![]})[_0x784e('0x19')](function(_0x114bfb){_0x6a510f=_0x114bfb;if(_0x6a510f&&_0x6a510f['type']){switch(_0x6a510f['type']){case _0x784e('0x22'):var _0x591bd4=require(_0x784e('0x22'));if(_0x6a510f[_0x784e('0x23')]&&_0x6a510f['authToken']&&_0x6a510f[_0x784e('0x24')]){var _0x51969f=new _0x591bd4(_0x6a510f[_0x784e('0x23')],_0x6a510f[_0x784e('0x25')]);_0x51969f[_0x784e('0x26')][_0x784e('0x27')]({'body':_0x4612b2['body'],'to':_0x784e('0x28')+_0x4612b2[_0x784e('0x24')],'from':_0x784e('0x28')+_0x6a510f['phone'],'statusCallback':_0x6a510f[_0x784e('0x29')]+_0x784e('0x2a')+_0x4612b2['id']+_0x784e('0x2b')+_0x6a510f[_0x784e('0x2c')]})['then'](function(_0x498268){if(_0x498268[_0x784e('0x2d')]){return _0x6722b4[_0x784e('0x1a')]({'messageId':_0x498268['sid']});}})[_0x784e('0x1c')](function(_0x39b3e8){logger[_0x784e('0x1d')](_0x784e('0x2e'),_0x784e('0x2f'),'twilio',util['inspect'](_0x39b3e8,{'showHidden':![],'depth':null}));});}else{logger[_0x784e('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x784e('0x2f'),_0x784e('0x22'),_0x784e('0x30'));}break;}}})[_0x784e('0x31')](function(){_0x5bd325();});}else{_0x5bd325();}}},'charset':_0x784e('0x32'),'collate':_0x784e('0x33')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 3b87a65..33414af 100644 --- a/server/api/whatsappMessage/whatsappMessage.rpc.js +++ b/server/api/whatsappMessage/whatsappMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2437=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','info','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','debug','lodash','util','bluebird','randomstring'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x2437,0x132));var _0x7243=function(_0x3db71e,_0x275086){_0x3db71e=_0x3db71e-0x0;var _0x4240a1=_0x2437[_0x3db71e];return _0x4240a1;};'use strict';var _=require(_0x7243('0x0'));var util=require(_0x7243('0x1'));var moment=require('moment');var BPromise=require(_0x7243('0x2'));var rs=require(_0x7243('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7243('0x4'))['db'];var utils=require(_0x7243('0x5'));var logger=require('../../config/logger')(_0x7243('0x6'));var config=require(_0x7243('0x7'));var jayson=require(_0x7243('0x8'));var client=jayson['client'][_0x7243('0x9')]({'port':0x232a});config[_0x7243('0xa')]=_['defaults'](config['redis'],{'host':_0x7243('0xb'),'port':0x18eb});var socket=require(_0x7243('0xc'))(new Redis(config['redis']));require(_0x7243('0xd'))[_0x7243('0xe')](socket);function respondWithRpcPromise(_0x5aa756,_0x1dc3d7,_0x3f4da7){return new BPromise(function(_0x4dacc5,_0x2114c3){return client[_0x7243('0xf')](_0x5aa756,_0x3f4da7)[_0x7243('0x10')](function(_0x44acd8){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x1dc3d7,_0x7243('0x11'));logger['debug'](_0x7243('0x12'),_0x1dc3d7,'request\x20sent',JSON[_0x7243('0x13')](_0x44acd8));if(_0x44acd8['error']){if(_0x44acd8[_0x7243('0x14')]['code']===0x1f4){logger[_0x7243('0x14')](_0x7243('0x15'),_0x1dc3d7,_0x44acd8[_0x7243('0x14')][_0x7243('0x16')]);return _0x2114c3(_0x44acd8['error']['message']);}logger[_0x7243('0x14')](_0x7243('0x15'),_0x1dc3d7,_0x44acd8[_0x7243('0x14')][_0x7243('0x16')]);return _0x4dacc5(_0x44acd8[_0x7243('0x14')][_0x7243('0x16')]);}else{logger[_0x7243('0x17')](_0x7243('0x15'),_0x1dc3d7,_0x7243('0x11'));_0x4dacc5(_0x44acd8['result'][_0x7243('0x16')]);}})[_0x7243('0x18')](function(_0x2fe31f){logger[_0x7243('0x14')](_0x7243('0x15'),_0x1dc3d7,_0x2fe31f);_0x2114c3(_0x2fe31f);});});}exports[_0x7243('0x19')]=function(_0xc606b3){var _0x10a868=this;return new Promise(function(_0x54372f,_0x47a889){return db[_0x7243('0x1a')][_0x7243('0x1b')](_0xc606b3['body'],{'raw':_0xc606b3[_0x7243('0x1c')]?_0xc606b3[_0x7243('0x1c')][_0x7243('0x1d')]===undefined?!![]:![]:!![]})[_0x7243('0x10')](function(_0x4b4cdd){logger['info']('CreateWhatsappMessage',_0xc606b3);logger[_0x7243('0x1e')](_0x7243('0x19'),_0xc606b3,JSON[_0x7243('0x13')](_0x4b4cdd));_0x54372f(_0x4b4cdd);})[_0x7243('0x18')](function(_0x11d15c){logger[_0x7243('0x14')](_0x7243('0x19'),_0x11d15c[_0x7243('0x16')],_0xc606b3);_0x47a889(_0x10a868[_0x7243('0x14')](0x1f4,_0x11d15c[_0x7243('0x16')]));});});}; \ No newline at end of file +var _0x16c1=['then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','body','raw','info','CreateWhatsappMessage','lodash','util','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x16c1,0x109));var _0x116c=function(_0x248058,_0x134991){_0x248058=_0x248058-0x0;var _0x3c1d5b=_0x16c1[_0x248058];return _0x3c1d5b;};'use strict';var _=require(_0x116c('0x0'));var util=require(_0x116c('0x1'));var moment=require('moment');var BPromise=require(_0x116c('0x2'));var rs=require(_0x116c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x116c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x116c('0x5'));var jayson=require(_0x116c('0x6'));var client=jayson[_0x116c('0x7')][_0x116c('0x8')]({'port':0x232a});config[_0x116c('0x9')]=_[_0x116c('0xa')](config[_0x116c('0x9')],{'host':_0x116c('0xb'),'port':0x18eb});var socket=require(_0x116c('0xc'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x116c('0xd')](socket);function respondWithRpcPromise(_0x42d1ae,_0x59fa72,_0x4cf34c){return new BPromise(function(_0x510eb4,_0x5bd34d){return client[_0x116c('0xe')](_0x42d1ae,_0x4cf34c)[_0x116c('0xf')](function(_0x25a367){logger['info'](_0x116c('0x10'),_0x59fa72,_0x116c('0x11'));logger[_0x116c('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x59fa72,_0x116c('0x11'),JSON[_0x116c('0x13')](_0x25a367));if(_0x25a367[_0x116c('0x14')]){if(_0x25a367[_0x116c('0x14')]['code']===0x1f4){logger[_0x116c('0x14')](_0x116c('0x10'),_0x59fa72,_0x25a367[_0x116c('0x14')][_0x116c('0x15')]);return _0x5bd34d(_0x25a367[_0x116c('0x14')][_0x116c('0x15')]);}logger['error'](_0x116c('0x10'),_0x59fa72,_0x25a367[_0x116c('0x14')]['message']);return _0x510eb4(_0x25a367[_0x116c('0x14')][_0x116c('0x15')]);}else{logger['info'](_0x116c('0x10'),_0x59fa72,_0x116c('0x11'));_0x510eb4(_0x25a367[_0x116c('0x16')][_0x116c('0x15')]);}})[_0x116c('0x17')](function(_0x4acb10){logger[_0x116c('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x59fa72,_0x4acb10);_0x5bd34d(_0x4acb10);});});}exports['CreateWhatsappMessage']=function(_0x3e4761){var _0x9eac8a=this;return new Promise(function(_0x2bbf4f,_0x12108a){return db['WhatsappMessage']['create'](_0x3e4761[_0x116c('0x18')],{'raw':_0x3e4761['options']?_0x3e4761['options'][_0x116c('0x19')]===undefined?!![]:![]:!![]})[_0x116c('0xf')](function(_0x31316e){logger[_0x116c('0x1a')](_0x116c('0x1b'),_0x3e4761);logger['debug']('CreateWhatsappMessage',_0x3e4761,JSON[_0x116c('0x13')](_0x31316e));_0x2bbf4f(_0x31316e);})[_0x116c('0x17')](function(_0x147077){logger['error']('CreateWhatsappMessage',_0x147077[_0x116c('0x15')],_0x3e4761);_0x12108a(_0x9eac8a[_0x116c('0x14')](0x1f4,_0x147077[_0x116c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 7c70010..adce221 100644 --- a/server/api/whatsappMessage/whatsappMessage.socket.js +++ b/server/api/whatsappMessage/whatsappMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ce=['removeListener','register','length','save','remove','update','emit'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x53ce,0x7a));var _0xe53c=function(_0x3c1530,_0x39fb39){_0x3c1530=_0x3c1530-0x0;var _0x239bda=_0x53ce[_0x3c1530];return _0x239bda;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xe53c('0x0'),_0xe53c('0x1'),_0xe53c('0x2')];function createListener(_0x339c4e,_0x5b549f){return function(_0x18a51c){_0x5b549f[_0xe53c('0x3')](_0x339c4e,_0x18a51c);};}function removeListener(_0x25de2f,_0x451185){return function(){WhatsappMessageEvents[_0xe53c('0x4')](_0x25de2f,_0x451185);};}exports[_0xe53c('0x5')]=function(_0x29ce44){for(var _0x1ce2ee=0x0,_0x1a05ed=events[_0xe53c('0x6')];_0x1ce2ee<_0x1a05ed;_0x1ce2ee++){var _0x21fef9=events[_0x1ce2ee];var _0xe53436=createListener('whatsappMessage:'+_0x21fef9,_0x29ce44);WhatsappMessageEvents['on'](_0x21fef9,_0xe53436);}}; \ No newline at end of file +var _0xeddf=['remove','update','removeListener','length','./whatsappMessage.events','save'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xeddf,0x13c));var _0xfedd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeddf[_0x321bb2];return _0x9c12ed;};'use strict';var WhatsappMessageEvents=require(_0xfedd('0x0'));var events=[_0xfedd('0x1'),_0xfedd('0x2'),_0xfedd('0x3')];function createListener(_0x1eabd3,_0x172fe0){return function(_0x21770b){_0x172fe0['emit'](_0x1eabd3,_0x21770b);};}function removeListener(_0x2ab11f,_0x4cd7a9){return function(){WhatsappMessageEvents[_0xfedd('0x4')](_0x2ab11f,_0x4cd7a9);};}exports['register']=function(_0x5f3b46){for(var _0x38da23=0x0,_0x3744a6=events[_0xfedd('0x5')];_0x38da23<_0x3744a6;_0x38da23++){var _0xcca034=events[_0x38da23];var _0x50d0f2=createListener('whatsappMessage:'+_0xcca034,_0x5f3b46);WhatsappMessageEvents['on'](_0xcca034,_0x50d0f2);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 9cc35b3..1902b31 100644 --- a/server/api/whatsappQueue/index.js +++ b/server/api/whatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe51=['getMembers','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','update','delete','destroy','removeTeams','removeAgents','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','describe','get','/:id','/:id/members'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xbe51,0x151));var _0x1be5=function(_0x469b7,_0x434111){_0x469b7=_0x469b7-0x0;var _0x31ae7d=_0xbe51[_0x469b7];return _0x31ae7d;};'use strict';var multer=require('multer');var util=require(_0x1be5('0x0'));var path=require(_0x1be5('0x1'));var timeout=require(_0x1be5('0x2'));var express=require(_0x1be5('0x3'));var router=express[_0x1be5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1be5('0x5'));var config=require(_0x1be5('0x6'));var controller=require(_0x1be5('0x7'));router['get']('/',auth[_0x1be5('0x8')](),controller[_0x1be5('0x9')]);router['get']('/describe',auth[_0x1be5('0x8')](),controller[_0x1be5('0xa')]);router[_0x1be5('0xb')](_0x1be5('0xc'),auth[_0x1be5('0x8')](),controller['show']);router[_0x1be5('0xb')](_0x1be5('0xd'),auth[_0x1be5('0x8')](),controller[_0x1be5('0xe')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x1be5('0xf'),auth[_0x1be5('0x8')](),controller[_0x1be5('0x10')]);router[_0x1be5('0x11')]('/',auth[_0x1be5('0x8')](),controller[_0x1be5('0x12')]);router[_0x1be5('0x11')](_0x1be5('0x13'),auth['isAuthenticated'](),controller[_0x1be5('0x14')]);router[_0x1be5('0x11')](_0x1be5('0xf'),auth[_0x1be5('0x8')](),controller['addAgents']);router[_0x1be5('0x15')](_0x1be5('0xc'),auth[_0x1be5('0x8')](),controller[_0x1be5('0x16')]);router[_0x1be5('0x17')](_0x1be5('0xc'),auth[_0x1be5('0x8')](),controller[_0x1be5('0x18')]);router[_0x1be5('0x17')](_0x1be5('0x13'),auth[_0x1be5('0x8')](),controller[_0x1be5('0x19')]);router['delete']('/:id/users',auth[_0x1be5('0x8')](),controller[_0x1be5('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xc30d=['../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x3a166a,_0x2018be){var _0x1b0279=function(_0x5b98dd){while(--_0x5b98dd){_0x3a166a['push'](_0x3a166a['shift']());}};_0x1b0279(++_0x2018be);}(_0xc30d,0x11c));var _0xdc30=function(_0x2d6533,_0x19f68c){_0x2d6533=_0x2d6533-0x0;var _0x26c12f=_0xc30d[_0x2d6533];return _0x26c12f;};'use strict';var multer=require(_0xdc30('0x0'));var util=require(_0xdc30('0x1'));var path=require(_0xdc30('0x2'));var timeout=require('connect-timeout');var express=require(_0xdc30('0x3'));var router=express[_0xdc30('0x4')]();var auth=require(_0xdc30('0x5'));var interaction=require(_0xdc30('0x6'));var config=require(_0xdc30('0x7'));var controller=require(_0xdc30('0x8'));router[_0xdc30('0x9')]('/',auth[_0xdc30('0xa')](),controller[_0xdc30('0xb')]);router['get'](_0xdc30('0xc'),auth[_0xdc30('0xa')](),controller['describe']);router[_0xdc30('0x9')]('/:id',auth[_0xdc30('0xa')](),controller[_0xdc30('0xd')]);router[_0xdc30('0x9')](_0xdc30('0xe'),auth[_0xdc30('0xa')](),controller[_0xdc30('0xf')]);router[_0xdc30('0x9')](_0xdc30('0x10'),auth[_0xdc30('0xa')](),controller[_0xdc30('0x11')]);router['get']('/:id/users',auth[_0xdc30('0xa')](),controller[_0xdc30('0x12')]);router[_0xdc30('0x13')]('/',auth[_0xdc30('0xa')](),controller[_0xdc30('0x14')]);router['post'](_0xdc30('0x10'),auth[_0xdc30('0xa')](),controller[_0xdc30('0x15')]);router[_0xdc30('0x13')](_0xdc30('0x16'),auth[_0xdc30('0xa')](),controller['addAgents']);router[_0xdc30('0x17')](_0xdc30('0x18'),auth[_0xdc30('0xa')](),controller[_0xdc30('0x19')]);router[_0xdc30('0x1a')](_0xdc30('0x18'),auth[_0xdc30('0xa')](),controller[_0xdc30('0x1b')]);router[_0xdc30('0x1a')](_0xdc30('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xdc30('0x1a')](_0xdc30('0x16'),auth[_0xdc30('0xa')](),controller['removeAgents']);module[_0xdc30('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 94cc413..89be40f 100644 --- a/server/api/whatsappQueue/whatsappQueue.attributes.js +++ b/server/api/whatsappQueue/whatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0daa=['rrmemory','beepall','sequelize','STRING','INTEGER','ENUM'];(function(_0x5722b1,_0x168a72){var _0x55f30c=function(_0x51fc3f){while(--_0x51fc3f){_0x5722b1['push'](_0x5722b1['shift']());}};_0x55f30c(++_0x168a72);}(_0x0daa,0x134));var _0xa0da=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0daa[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xa0da('0x0'));module['exports']={'name':{'type':Sequelize[_0xa0da('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xa0da('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa0da('0x3')](_0xa0da('0x4'),_0xa0da('0x5'),'roundrobin')},'description':{'type':Sequelize[_0xa0da('0x1')]}}; \ No newline at end of file +var _0xe40b=['INTEGER','rrmemory','beepall','exports','STRING','name'];(function(_0x2f50b6,_0xd09fe3){var _0x54b027=function(_0x680941){while(--_0x680941){_0x2f50b6['push'](_0x2f50b6['shift']());}};_0x54b027(++_0xd09fe3);}(_0xe40b,0x1a1));var _0xbe40=function(_0x1143e9,_0x1e0966){_0x1143e9=_0x1143e9-0x0;var _0x4ec50b=_0xe40b[_0x1143e9];return _0x4ec50b;};'use strict';var Sequelize=require('sequelize');module[_0xbe40('0x0')]={'name':{'type':Sequelize[_0xbe40('0x1')],'unique':_0xbe40('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xbe40('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xbe40('0x4'),_0xbe40('0x5'),'roundrobin')},'description':{'type':Sequelize[_0xbe40('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 4da9619..a14fe86 100644 --- a/server/api/whatsappQueue/whatsappQueue.controller.js +++ b/server/api/whatsappQueue/whatsappQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0641=['destroy','then','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','show','length','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserWhatsappQueue','order','WhatsappQueueId','findAndCountAll','UserId','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','User','online','voicePause','interface','flatMap','sequelize','each','forEach','emit','userWhatsappQueue:save','removeTeams','Agents','select','team_has_whatsapp_queues','join','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','includes','all','union','compact','value','transaction','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','sendStatus','status','end','json','offset','limit','set','Content-Range','update'];(function(_0x61964b,_0x2dfb76){var _0x49711d=function(_0x3483de){while(--_0x3483de){_0x61964b['push'](_0x61964b['shift']());}};_0x49711d(++_0x2dfb76);}(_0x0641,0x1eb));var _0x1064=function(_0x412767,_0x2be49e){_0x412767=_0x412767-0x0;var _0x428500=_0x0641[_0x412767];return _0x428500;};'use strict';var pdf=require(_0x1064('0x0'));var emlformat=require(_0x1064('0x1'));var rimraf=require(_0x1064('0x2'));var zipdir=require(_0x1064('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1064('0x4'));var BPromise=require(_0x1064('0x5'));var Mustache=require(_0x1064('0x6'));var util=require(_0x1064('0x7'));var path=require(_0x1064('0x8'));var sox=require(_0x1064('0x9'));var csv=require(_0x1064('0xa'));var ejs=require(_0x1064('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1064('0xc'));var crypto=require(_0x1064('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1064('0xe'));var Redis=require(_0x1064('0xf'));var authService=require(_0x1064('0x10'));var qs=require(_0x1064('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1064('0x12'))(_0x1064('0x13'));var utils=require(_0x1064('0x14'));var config=require(_0x1064('0x15'));var db=require(_0x1064('0x16'))['db'];config[_0x1064('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x44d393,_0xb9ee80){_0xb9ee80=_0xb9ee80||0xcc;return function(_0x3a65a0){if(_0x3a65a0){return _0x44d393[_0x1064('0x18')](_0xb9ee80);}return _0x44d393[_0x1064('0x19')](_0xb9ee80)[_0x1064('0x1a')]();};}function respondWithResult(_0x20865e,_0x679403){_0x679403=_0x679403||0xc8;return function(_0x2e31d4){if(_0x2e31d4){return _0x20865e[_0x1064('0x19')](_0x679403)[_0x1064('0x1b')](_0x2e31d4);}};}function respondWithFilteredResult(_0x45a541,_0x1449eb){return function(_0x446ee2){if(_0x446ee2){var _0x1fbca8=_0x446ee2['count'],_0x112ad5=_0x1449eb[_0x1064('0x1c')],_0x2b3132=_0x1449eb[_0x1064('0x1c')]+_0x1449eb[_0x1064('0x1d')],_0x6a7323;if(_0x2b3132>=_0x1fbca8){_0x2b3132=_0x1fbca8;_0x6a7323=0xc8;}else{_0x6a7323=0xce;}_0x45a541[_0x1064('0x19')](_0x6a7323);return _0x45a541[_0x1064('0x1e')](_0x1064('0x1f'),_0x112ad5+'-'+_0x2b3132+'/'+_0x1fbca8)['json'](_0x446ee2);}return null;};}function patchUpdates(_0xd935bb){return function(_0x255977){try{jsonpatch['apply'](_0x255977,_0xd935bb,!![]);}catch(_0x4cd167){return BPromise['reject'](_0x4cd167);}return _0x255977['save']();};}function saveUpdates(_0x102dfd,_0x31de16){return function(_0x43f412){if(_0x43f412){return _0x43f412[_0x1064('0x20')](_0x102dfd)['then'](function(_0x78912c){return _0x78912c;});}return null;};}function removeEntity(_0x3d9087,_0x1825be){return function(_0x26cecf){if(_0x26cecf){return _0x26cecf[_0x1064('0x21')]()[_0x1064('0x22')](function(){var _0x3dd733=_0x26cecf[_0x1064('0x23')]({'plain':!![]});var _0x44f97a=_0x1064('0x24');return db[_0x1064('0x25')][_0x1064('0x21')]({'where':{'type':_0x44f97a,'resourceId':_0x3dd733['id']}})[_0x1064('0x22')](function(){return _0x26cecf;});})[_0x1064('0x22')](function(){_0x3d9087[_0x1064('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1647f8,_0x58639a){return function(_0x14ffd2){if(!_0x14ffd2){_0x1647f8[_0x1064('0x18')](0x194);}return _0x14ffd2;};}function handleError(_0x55f0b4,_0x1a65f0){_0x1a65f0=_0x1a65f0||0x1f4;return function(_0x22e410){logger[_0x1064('0x26')](_0x22e410[_0x1064('0x27')]);if(_0x22e410[_0x1064('0x28')]){delete _0x22e410[_0x1064('0x28')];}_0x55f0b4[_0x1064('0x19')](_0x1a65f0)[_0x1064('0x29')](_0x22e410);};}exports[_0x1064('0x2a')]=function(_0x508de8,_0x273a52){var _0x45e98b={},_0x303a2e={},_0x54d087={'count':0x0,'rows':[]};var _0x491ce4=_[_0x1064('0x2b')](db[_0x1064('0x2c')][_0x1064('0x2d')],function(_0x17677b){return{'name':_0x17677b[_0x1064('0x2e')],'type':_0x17677b[_0x1064('0x2f')]['key']};});_0x303a2e[_0x1064('0x30')]=_[_0x1064('0x2b')](_0x491ce4,_0x1064('0x28'));_0x303a2e[_0x1064('0x31')]=_[_0x1064('0x32')](_0x508de8[_0x1064('0x31')]);_0x303a2e[_0x1064('0x33')]=_[_0x1064('0x34')](_0x303a2e[_0x1064('0x30')],_0x303a2e[_0x1064('0x31')]);_0x45e98b[_0x1064('0x35')]=_[_0x1064('0x34')](_0x303a2e[_0x1064('0x30')],qs[_0x1064('0x36')](_0x508de8[_0x1064('0x31')]['fields']));_0x45e98b['attributes']=_0x45e98b[_0x1064('0x35')]['length']?_0x45e98b['attributes']:_0x303a2e['model'];if(!_0x508de8[_0x1064('0x31')][_0x1064('0x37')](_0x1064('0x38'))){_0x45e98b[_0x1064('0x1d')]=qs[_0x1064('0x1d')](_0x508de8['query'][_0x1064('0x1d')]);_0x45e98b['offset']=qs[_0x1064('0x1c')](_0x508de8[_0x1064('0x31')][_0x1064('0x1c')]);}_0x45e98b['order']=qs[_0x1064('0x39')](_0x508de8['query'][_0x1064('0x39')]);_0x45e98b[_0x1064('0x3a')]=qs[_0x1064('0x33')](_[_0x1064('0x3b')](_0x508de8[_0x1064('0x31')],_0x303a2e[_0x1064('0x33')]),_0x491ce4);if(_0x508de8[_0x1064('0x31')][_0x1064('0x3c')]){_0x45e98b['where']=_[_0x1064('0x3d')](_0x45e98b['where'],{'$or':_[_0x1064('0x2b')](_0x491ce4,function(_0x5f297a){if(_0x5f297a[_0x1064('0x2f')]!=='VIRTUAL'){var _0x4b191b={};_0x4b191b[_0x5f297a[_0x1064('0x28')]]={'$like':'%'+_0x508de8['query'][_0x1064('0x3c')]+'%'};return _0x4b191b;}})});}_0x45e98b=_[_0x1064('0x3d')]({},_0x45e98b,_0x508de8[_0x1064('0x3e')]);var _0x7bffc5={'where':_0x45e98b['where']};return db[_0x1064('0x2c')]['count'](_0x7bffc5)[_0x1064('0x22')](function(_0x324555){_0x54d087[_0x1064('0x3f')]=_0x324555;if(_0x508de8[_0x1064('0x31')][_0x1064('0x40')]){_0x45e98b[_0x1064('0x41')]=[{'all':!![]}];}return db[_0x1064('0x2c')][_0x1064('0x42')](_0x45e98b);})['then'](function(_0x35b6de){_0x54d087[_0x1064('0x43')]=_0x35b6de;return _0x54d087;})[_0x1064('0x22')](respondWithFilteredResult(_0x273a52,_0x45e98b))['catch'](handleError(_0x273a52,null));};exports[_0x1064('0x44')]=function(_0x2792aa,_0x48fd4f){var _0xa93a4f={'raw':!![],'where':{'id':_0x2792aa['params']['id']}},_0x23385b={};_0x23385b['model']=_[_0x1064('0x32')](db['WhatsappQueue'][_0x1064('0x2d')]);_0x23385b[_0x1064('0x31')]=_[_0x1064('0x32')](_0x2792aa[_0x1064('0x31')]);_0x23385b['filters']=_[_0x1064('0x34')](_0x23385b[_0x1064('0x30')],_0x23385b[_0x1064('0x31')]);_0xa93a4f['attributes']=_[_0x1064('0x34')](_0x23385b[_0x1064('0x30')],qs['fields'](_0x2792aa[_0x1064('0x31')][_0x1064('0x36')]));_0xa93a4f['attributes']=_0xa93a4f[_0x1064('0x35')][_0x1064('0x45')]?_0xa93a4f[_0x1064('0x35')]:_0x23385b['model'];if(_0x2792aa[_0x1064('0x31')][_0x1064('0x40')]){_0xa93a4f[_0x1064('0x41')]=[{'all':!![]}];}_0xa93a4f=_[_0x1064('0x3d')]({},_0xa93a4f,_0x2792aa[_0x1064('0x3e')]);return db[_0x1064('0x2c')]['find'](_0xa93a4f)[_0x1064('0x22')](handleEntityNotFound(_0x48fd4f,null))[_0x1064('0x22')](respondWithResult(_0x48fd4f,null))[_0x1064('0x46')](handleError(_0x48fd4f,null));};exports[_0x1064('0x47')]=function(_0x201d24,_0x3e53f6){return db[_0x1064('0x2c')][_0x1064('0x47')](_0x201d24['body'],{})[_0x1064('0x22')](function(_0x5e3be3){var _0x373ce3=_0x201d24[_0x1064('0x48')]['get']({'plain':!![]});if(!_0x373ce3)throw new Error(_0x1064('0x49'));if(_0x373ce3[_0x1064('0x4a')]==='user'){var _0x550f0c=_0x5e3be3[_0x1064('0x23')]({'plain':!![]});var _0x30ed37=_0x1064('0x24');return db['UserProfileSection'][_0x1064('0x4b')]({'where':{'name':_0x30ed37,'userProfileId':_0x373ce3['userProfileId']},'raw':!![]})[_0x1064('0x22')](function(_0x576ed3){if(_0x576ed3&&_0x576ed3['autoAssociation']===0x0){return db['UserProfileResource'][_0x1064('0x47')]({'name':_0x550f0c[_0x1064('0x28')],'resourceId':_0x550f0c['id'],'type':_0x576ed3[_0x1064('0x28')],'sectionId':_0x576ed3['id']},{})['then'](function(){return _0x5e3be3;});}else{return _0x5e3be3;}})[_0x1064('0x46')](function(_0x429f53){logger['error'](_0x1064('0x4c'),_0x429f53);throw _0x429f53;});}return _0x5e3be3;})['then'](respondWithResult(_0x3e53f6,0xc9))[_0x1064('0x46')](handleError(_0x3e53f6,null));};exports[_0x1064('0x20')]=function(_0x986557,_0x3e346d){if(_0x986557[_0x1064('0x4d')]['id']){delete _0x986557[_0x1064('0x4d')]['id'];}return db[_0x1064('0x2c')][_0x1064('0x4b')]({'where':{'id':_0x986557[_0x1064('0x4e')]['id']}})[_0x1064('0x22')](handleEntityNotFound(_0x3e346d,null))[_0x1064('0x22')](saveUpdates(_0x986557['body'],null))[_0x1064('0x22')](respondWithResult(_0x3e346d,null))[_0x1064('0x46')](handleError(_0x3e346d,null));};exports[_0x1064('0x21')]=function(_0x5d1ad6,_0x309e39){return db['WhatsappQueue'][_0x1064('0x4b')]({'where':{'id':_0x5d1ad6[_0x1064('0x4e')]['id']}})[_0x1064('0x22')](handleEntityNotFound(_0x309e39,null))[_0x1064('0x22')](removeEntity(_0x309e39,null))['catch'](handleError(_0x309e39,null));};exports[_0x1064('0x4f')]=function(_0x48b944,_0x436028){return db[_0x1064('0x2c')]['describe']()[_0x1064('0x22')](respondWithResult(_0x436028,null))[_0x1064('0x46')](handleError(_0x436028,null));};exports[_0x1064('0x50')]=function(_0x12f386,_0x2cafb0,_0x399ab6){var _0xcbbc22={'raw':!![],'where':{}},_0xa761cf={},_0x34c26c;return db[_0x1064('0x2c')][_0x1064('0x51')]({'where':{'id':_0x12f386[_0x1064('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2cafb0,null))[_0x1064('0x22')](function(_0x4618a6){if(_0x4618a6){_0x34c26c=_0x4618a6['get']({'plain':!![]});_0xa761cf[_0x1064('0x30')]=_[_0x1064('0x32')](db[_0x1064('0x52')][_0x1064('0x2d')]);_0xa761cf[_0x1064('0x31')]=_['keys'](_0x12f386[_0x1064('0x31')]);_0xa761cf[_0x1064('0x33')]=_['intersection'](_0xa761cf['model'],_0xa761cf['query']);_0xcbbc22[_0x1064('0x35')]=_['intersection'](_0xa761cf['model'],qs[_0x1064('0x36')](_0x12f386[_0x1064('0x31')][_0x1064('0x36')]));_0xcbbc22[_0x1064('0x35')]=_0xcbbc22[_0x1064('0x35')][_0x1064('0x45')]?_0xcbbc22[_0x1064('0x35')]:_0xa761cf[_0x1064('0x30')];if(!_0x12f386[_0x1064('0x31')][_0x1064('0x37')]('nolimit')){_0xcbbc22[_0x1064('0x1d')]=qs[_0x1064('0x1d')](_0x12f386[_0x1064('0x31')]['limit']);_0xcbbc22[_0x1064('0x1c')]=qs['offset'](_0x12f386[_0x1064('0x31')][_0x1064('0x1c')]);}_0xcbbc22[_0x1064('0x53')]=qs[_0x1064('0x39')](_0x12f386[_0x1064('0x31')][_0x1064('0x39')]);_0xcbbc22[_0x1064('0x3a')]=qs['filters'](_[_0x1064('0x3b')](_0x12f386[_0x1064('0x31')],_0xa761cf[_0x1064('0x33')]));_0xcbbc22[_0x1064('0x3a')][_0x1064('0x54')]=_0x4618a6['id'];if(_0x12f386[_0x1064('0x31')][_0x1064('0x3c')]){_0xcbbc22[_0x1064('0x3a')]=_['merge'](_0xcbbc22['where'],{'$or':_['map'](_0xcbbc22['attributes'],function(_0x4230e6){var _0x5705a5={};_0x5705a5[_0x4230e6]={'$like':'%'+_0x12f386[_0x1064('0x31')][_0x1064('0x3c')]+'%'};return _0x5705a5;})});}_0xcbbc22=_[_0x1064('0x3d')]({},_0xcbbc22,_0x12f386['options']);return db[_0x1064('0x52')][_0x1064('0x42')](_0xcbbc22);}})['then'](function(_0x3360cc){if(_0x3360cc){return db['User'][_0x1064('0x55')]({'where':{'id':_[_0x1064('0x2b')](_0x3360cc,_0x1064('0x56')),'role':'agent'},'attributes':['id',_0x1064('0x28'),_0x1064('0x57'),'updatedAt',_0x1064('0x58')]});}})[_0x1064('0x22')](function(_0x48dbc2){if(_0x48dbc2){return{'count':_0x48dbc2[_0x1064('0x3f')],'rows':_[_0x1064('0x2b')](_0x48dbc2[_0x1064('0x43')],function(_0x49faab){return{'membername':_0x49faab[_0x1064('0x28')],'UserId':_0x49faab['id'],'queue_name':_0x34c26c[_0x1064('0x28')],'WhatsappQueueId':_0x34c26c['id'],'interface':util[_0x1064('0x59')](_0x1064('0x5a'),_0x1064('0x5b'),_0x49faab['name']),'penalty':0x0,'paused':_0x49faab['whatsappPause'],'createdAt':_0x49faab['createdAt'],'updatedAt':_0x49faab[_0x1064('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1064('0x22')](respondWithFilteredResult(_0x2cafb0,_0xcbbc22))[_0x1064('0x46')](handleError(_0x2cafb0,null));};exports[_0x1064('0x5d')]=function(_0x11bf22,_0x13a88a,_0x6ab17d){var _0x1f3277={};var _0x443d04={};var _0x1eff76;var _0x569bc4;return db[_0x1064('0x2c')][_0x1064('0x51')]({'where':{'id':_0x11bf22[_0x1064('0x4e')]['id']}})[_0x1064('0x22')](handleEntityNotFound(_0x13a88a,null))[_0x1064('0x22')](function(_0x4b3c66){if(_0x4b3c66){_0x1eff76=_0x4b3c66;_0x443d04['model']=_['keys'](db[_0x1064('0x5e')][_0x1064('0x2d')]);_0x443d04[_0x1064('0x31')]=_[_0x1064('0x32')](_0x11bf22[_0x1064('0x31')]);_0x443d04[_0x1064('0x33')]=_[_0x1064('0x34')](_0x443d04['model'],_0x443d04[_0x1064('0x31')]);_0x1f3277['attributes']=_[_0x1064('0x34')](_0x443d04[_0x1064('0x30')],qs[_0x1064('0x36')](_0x11bf22['query'][_0x1064('0x36')]));_0x1f3277[_0x1064('0x35')]=_0x1f3277[_0x1064('0x35')][_0x1064('0x45')]?_0x1f3277[_0x1064('0x35')]:_0x443d04['model'];_0x1f3277[_0x1064('0x53')]=qs[_0x1064('0x39')](_0x11bf22[_0x1064('0x31')][_0x1064('0x39')]);_0x1f3277['where']=qs['filters'](_[_0x1064('0x3b')](_0x11bf22[_0x1064('0x31')],_0x443d04[_0x1064('0x33')]));if(_0x11bf22[_0x1064('0x31')][_0x1064('0x3c')]){_0x1f3277[_0x1064('0x3a')]=_['merge'](_0x1f3277[_0x1064('0x3a')],{'$or':_['map'](_0x1f3277[_0x1064('0x35')],function(_0xa6ce87){var _0x101668={};_0x101668[_0xa6ce87]={'$like':'%'+_0x11bf22[_0x1064('0x31')][_0x1064('0x3c')]+'%'};return _0x101668;})});}_0x1f3277=_[_0x1064('0x3d')]({},_0x1f3277,_0x11bf22[_0x1064('0x3e')]);return _0x1eff76[_0x1064('0x5d')](_0x1f3277);}})['then'](function(_0x2a79a1){if(_0x2a79a1){_0x569bc4=_0x2a79a1['length'];if(!_0x11bf22['query'][_0x1064('0x37')](_0x1064('0x38'))){_0x1f3277[_0x1064('0x1d')]=qs[_0x1064('0x1d')](_0x11bf22[_0x1064('0x31')]['limit']);_0x1f3277[_0x1064('0x1c')]=qs[_0x1064('0x1c')](_0x11bf22['query'][_0x1064('0x1c')]);}return _0x1eff76[_0x1064('0x5d')](_0x1f3277);}})['then'](function(_0xf13630){if(_0xf13630){return _0xf13630?{'count':_0x569bc4,'rows':_0xf13630}:null;}})[_0x1064('0x22')](respondWithResult(_0x13a88a,null))[_0x1064('0x46')](handleError(_0x13a88a,null));};exports[_0x1064('0x5f')]=function(_0x4c6e01,_0x392e2c,_0x407dd8){var _0x201945=_0x4c6e01['body'][_0x1064('0x60')];return db['Team']['findAll']({'where':{'id':_0x201945},'attributes':['id'],'include':[{'model':db[_0x1064('0x61')],'as':'Agents','attributes':['id',_0x1064('0x28'),_0x1064('0x62'),_0x1064('0x63'),_0x1064('0x64')],'raw':!![]}]})[_0x1064('0x22')](function(_0x48cae5){if(_0x48cae5){var _0x1be832=_[_0x1064('0x65')](_0x48cae5,function(_0x279b07){var _0x474017=_0x279b07[_0x1064('0x23')]({'plain':!![]});return _0x474017['Agents'];});return db[_0x1064('0x2c')][_0x1064('0x4b')]({'where':{'id':_0x4c6e01[_0x1064('0x4e')]['id']}})[_0x1064('0x22')](function(_0x35d00f){return db[_0x1064('0x66')]['transaction'](function(_0x20d0e6){return _0x35d00f[_0x1064('0x5f')](_0x201945,{'transaction':_0x20d0e6})[_0x1064('0x22')](function(){return BPromise[_0x1064('0x67')](_0x1be832,function(_0x6a6432){return db[_0x1064('0x52')]['findOrCreate']({'where':{'UserId':_0x6a6432['id'],'WhatsappQueueId':_0x4c6e01[_0x1064('0x4e')]['id']},'transaction':_0x20d0e6});});})[_0x1064('0x22')](function(){_0x1be832[_0x1064('0x68')](function(_0x5e7a40){socket[_0x1064('0x69')](_0x1064('0x6a'),{'UserId':_0x5e7a40['id'],'WhatsappQueueId':_0x35d00f['id']});});});});});}})['then'](respondWithStatusCode(_0x392e2c,null))[_0x1064('0x46')](handleError(_0x392e2c,null));};exports[_0x1064('0x6b')]=function(_0x4c8422,_0x385301,_0x170709){return db[_0x1064('0x5e')][_0x1064('0x42')]({'where':{'id':_0x4c8422[_0x1064('0x31')][_0x1064('0x60')]},'attributes':['id'],'include':[{'model':db[_0x1064('0x61')],'as':_0x1064('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x1064('0x22')](handleEntityNotFound(_0x385301,null))[_0x1064('0x22')](function(_0x5baaab){var _0x45acd9=_[_0x1064('0x2b')](_0x5baaab,'id');var _0x4812c1=[];var _0x1a4dc6=[];var _0x112af5=squel[_0x1064('0x6d')]();_0x112af5['field']('tq.TeamId')['from'](_0x1064('0x6e'),'tq')[_0x1064('0x6f')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x1064('0x3a')](_0x1064('0x70'),_0x4c8422[_0x1064('0x4e')]['id']);for(var _0x262fc2=0x0;_0x262fc2<_0x5baaab[_0x1064('0x45')];_0x262fc2+=0x1){let _0x4a48de=_0x5baaab[_0x262fc2];for(var _0x289b74=0x0;_0x289b74<_0x4a48de[_0x1064('0x6c')]['length'];_0x289b74+=0x1){let _0x22a15d=_0x4a48de[_0x1064('0x6c')][_0x289b74];var _0x509b7f=_0x112af5[_0x1064('0x71')]();_0x509b7f[_0x1064('0x3a')](_0x1064('0x72'),_0x22a15d['id']);_0x1a4dc6[_0x1064('0x73')](db['sequelize'][_0x1064('0x31')](_0x509b7f[_0x1064('0x74')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x1064('0x22')](function(_0x4dae9c){if(_0x4dae9c['length']===0x1){return _0x22a15d['id'];}else{var _0xe334eb=_['every'](_[_0x1064('0x2b')](_0x4dae9c,'TeamId'),function(_0x4fada3){return _[_0x1064('0x75')](_0x45acd9,_0x4fada3);});if(_0xe334eb){return _0x22a15d['id'];}}}));}}return BPromise[_0x1064('0x76')](_0x1a4dc6)[_0x1064('0x22')](function(_0x2ed819){_0x4812c1=_(_0x4812c1)[_0x1064('0x77')](_0x2ed819)[_0x1064('0x78')]()[_0x1064('0x79')]();return db[_0x1064('0x2c')]['find']({'where':{'id':_0x4c8422[_0x1064('0x4e')]['id']}})[_0x1064('0x22')](function(_0x4355eb){return db[_0x1064('0x66')][_0x1064('0x7a')](function(_0xb1b065){return _0x4355eb['removeTeams'](_0x4c8422[_0x1064('0x31')]['ids'],{'transaction':_0xb1b065})['then'](function(){if(!_[_0x1064('0x7b')](_0x4812c1)){return _0x4355eb['removeAgents'](_0x4812c1,{'transaction':_0xb1b065});}})['then'](function(){_0x4812c1[_0x1064('0x68')](function(_0x34c022){socket[_0x1064('0x69')](_0x1064('0x7c'),{'UserId':_0x34c022,'WhatsappQueueId':_0x4355eb['id']});});});});});});})[_0x1064('0x22')](respondWithStatusCode(_0x385301,null))[_0x1064('0x46')](handleError(_0x385301,null));};exports[_0x1064('0x7d')]=function(_0x30bf70,_0x1c80fa,_0x4a057b){return db['WhatsappQueue']['find']({'where':{'id':_0x30bf70[_0x1064('0x4e')]['id']}})[_0x1064('0x22')](handleEntityNotFound(_0x1c80fa,null))['then'](function(_0x4ad9d3){if(_0x4ad9d3){return _0x4ad9d3[_0x1064('0x7d')](_0x30bf70[_0x1064('0x4d')][_0x1064('0x60')],_[_0x1064('0x7e')](_0x30bf70[_0x1064('0x4d')],[_0x1064('0x60'),'id'])||{})[_0x1064('0x7f')](function(_0x1d05ee){for(var _0xf0bd1c=0x0;_0xf0bd1c<_0x30bf70[_0x1064('0x4d')]['ids']['length'];_0xf0bd1c+=0x1){socket['emit'](_0x1064('0x6a'),{'UserId':_0x30bf70[_0x1064('0x4d')][_0x1064('0x60')][_0xf0bd1c],'WhatsappQueueId':_0x30bf70[_0x1064('0x4e')]['id']});}return _0x1d05ee;});}})[_0x1064('0x22')](respondWithResult(_0x1c80fa,null))[_0x1064('0x46')](handleError(_0x1c80fa,null));};exports['removeAgents']=function(_0x46e03e,_0x444824,_0x55c2e4){return db['WhatsappQueue'][_0x1064('0x4b')]({'where':{'id':_0x46e03e['params']['id']}})['then'](handleEntityNotFound(_0x444824,null))[_0x1064('0x22')](function(_0x5ad839){if(_0x5ad839){return _0x5ad839[_0x1064('0x80')](_0x46e03e['query'][_0x1064('0x60')])[_0x1064('0x22')](function(){if(_[_0x1064('0x81')](_0x46e03e[_0x1064('0x31')]['ids'])){for(var _0x122c53=0x0;_0x122c53<_0x46e03e[_0x1064('0x31')][_0x1064('0x60')]['length'];_0x122c53+=0x1){socket[_0x1064('0x69')](_0x1064('0x7c'),{'UserId':Number(_0x46e03e[_0x1064('0x31')][_0x1064('0x60')][_0x122c53]),'WhatsappQueueId':Number(_0x46e03e[_0x1064('0x4e')]['id'])});}}else{socket[_0x1064('0x69')](_0x1064('0x7c'),{'UserId':Number(_0x46e03e[_0x1064('0x31')][_0x1064('0x60')]),'WhatsappQueueId':Number(_0x46e03e[_0x1064('0x4e')]['id'])});}});}})[_0x1064('0x22')](respondWithStatusCode(_0x444824,null))[_0x1064('0x46')](handleError(_0x444824,null));};exports[_0x1064('0x82')]=function(_0x497c4f,_0x12a7cb,_0x10d792){var _0x2437b8={};var _0x335a82={};var _0x1216cc;var _0x378809;return db['WhatsappQueue']['findOne']({'where':{'id':_0x497c4f[_0x1064('0x4e')]['id']}})[_0x1064('0x22')](handleEntityNotFound(_0x12a7cb,null))[_0x1064('0x22')](function(_0x11bef1){if(_0x11bef1){_0x1216cc=_0x11bef1;_0x335a82[_0x1064('0x30')]=_[_0x1064('0x32')](db[_0x1064('0x61')][_0x1064('0x2d')]);_0x335a82[_0x1064('0x31')]=_[_0x1064('0x32')](_0x497c4f['query']);_0x335a82[_0x1064('0x33')]=_['intersection'](_0x335a82[_0x1064('0x30')],_0x335a82[_0x1064('0x31')]);_0x2437b8['attributes']=_[_0x1064('0x34')](_0x335a82['model'],qs['fields'](_0x497c4f[_0x1064('0x31')][_0x1064('0x36')]));_0x2437b8['attributes']=_0x2437b8[_0x1064('0x35')][_0x1064('0x45')]?_0x2437b8[_0x1064('0x35')]:_0x335a82[_0x1064('0x30')];_0x2437b8[_0x1064('0x53')]=qs[_0x1064('0x39')](_0x497c4f['query'][_0x1064('0x39')]);_0x2437b8[_0x1064('0x3a')]=qs[_0x1064('0x33')](_[_0x1064('0x3b')](_0x497c4f[_0x1064('0x31')],_0x335a82[_0x1064('0x33')]));if(_0x497c4f['query'][_0x1064('0x3c')]){_0x2437b8[_0x1064('0x3a')]=_['merge'](_0x2437b8[_0x1064('0x3a')],{'$or':_[_0x1064('0x2b')](_0x2437b8['attributes'],function(_0x3ac3c4){var _0x1fb8d3={};_0x1fb8d3[_0x3ac3c4]={'$like':'%'+_0x497c4f['query'][_0x1064('0x3c')]+'%'};return _0x1fb8d3;})});}_0x2437b8=_[_0x1064('0x3d')]({},_0x2437b8,_0x497c4f[_0x1064('0x3e')]);return _0x1216cc['getAgents'](_0x2437b8);}})['then'](function(_0x263536){if(_0x263536){_0x378809=_0x263536[_0x1064('0x45')];if(!_0x497c4f['query'][_0x1064('0x37')](_0x1064('0x38'))){_0x2437b8[_0x1064('0x1d')]=qs['limit'](_0x497c4f[_0x1064('0x31')]['limit']);_0x2437b8[_0x1064('0x1c')]=qs[_0x1064('0x1c')](_0x497c4f[_0x1064('0x31')][_0x1064('0x1c')]);}return _0x1216cc[_0x1064('0x82')](_0x2437b8);}})[_0x1064('0x22')](function(_0x13f02d){if(_0x13f02d){return _0x13f02d?{'count':_0x378809,'rows':_0x13f02d}:null;}})[_0x1064('0x22')](respondWithResult(_0x12a7cb,null))[_0x1064('0x46')](handleError(_0x12a7cb,null));}; \ No newline at end of file +var _0x71f7=['UserProfileSection','find','autoAssociation','describe','getMembers','findOne','UserWhatsappQueue','rawAttributes','hasOwnProperty','nolimit','pick','User','whatsappPause','format','createdAt','updatedAt','getTeams','Team','ids','Agents','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','./whatsappQueue.socket','status','json','count','offset','limit','set','Content-Range','apply','update','get','WhatsappQueues','UserProfileResource','then','sendStatus','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','WhatsappQueue','include','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x1fee50,_0x17efb8){var _0x36079e=function(_0x3c913e){while(--_0x3c913e){_0x1fee50['push'](_0x1fee50['shift']());}};_0x36079e(++_0x17efb8);}(_0x71f7,0xbc));var _0x771f=function(_0xf54784,_0x345a44){_0xf54784=_0xf54784-0x0;var _0x4c785c=_0x71f7[_0xf54784];return _0x4c785c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x771f('0x0'));var rimraf=require(_0x771f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x771f('0x2'));var moment=require(_0x771f('0x3'));var BPromise=require(_0x771f('0x4'));var Mustache=require(_0x771f('0x5'));var util=require('util');var path=require(_0x771f('0x6'));var sox=require(_0x771f('0x7'));var csv=require(_0x771f('0x8'));var ejs=require(_0x771f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x771f('0xa'));var crypto=require(_0x771f('0xb'));var jsforce=require(_0x771f('0xc'));var deskjs=require(_0x771f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x771f('0xe'));var Papa=require(_0x771f('0xf'));var Redis=require('ioredis');var authService=require(_0x771f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x771f('0x11'));var hardwareService=require(_0x771f('0x12'));var logger=require(_0x771f('0x13'))(_0x771f('0x14'));var utils=require('../../config/utils');var config=require(_0x771f('0x15'));var db=require('../../mysqldb')['db'];config[_0x771f('0x16')]=_[_0x771f('0x17')](config[_0x771f('0x16')],{'host':_0x771f('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x771f('0x16')]));require(_0x771f('0x19'))['register'](socket);function respondWithStatusCode(_0x44e456,_0x1db836){_0x1db836=_0x1db836||0xcc;return function(_0x216cf0){if(_0x216cf0){return _0x44e456['sendStatus'](_0x1db836);}return _0x44e456[_0x771f('0x1a')](_0x1db836)['end']();};}function respondWithResult(_0x35c273,_0x41b493){_0x41b493=_0x41b493||0xc8;return function(_0x240e0f){if(_0x240e0f){return _0x35c273[_0x771f('0x1a')](_0x41b493)[_0x771f('0x1b')](_0x240e0f);}};}function respondWithFilteredResult(_0x2832e5,_0x6cc4e1){return function(_0x4964ca){if(_0x4964ca){var _0x56154c=_0x4964ca[_0x771f('0x1c')],_0x3816f0=_0x6cc4e1[_0x771f('0x1d')],_0x23bc9f=_0x6cc4e1['offset']+_0x6cc4e1[_0x771f('0x1e')],_0xb44a4c;if(_0x23bc9f>=_0x56154c){_0x23bc9f=_0x56154c;_0xb44a4c=0xc8;}else{_0xb44a4c=0xce;}_0x2832e5[_0x771f('0x1a')](_0xb44a4c);return _0x2832e5[_0x771f('0x1f')](_0x771f('0x20'),_0x3816f0+'-'+_0x23bc9f+'/'+_0x56154c)[_0x771f('0x1b')](_0x4964ca);}return null;};}function patchUpdates(_0xec8eb0){return function(_0xd11a86){try{jsonpatch[_0x771f('0x21')](_0xd11a86,_0xec8eb0,!![]);}catch(_0x1c812d){return BPromise['reject'](_0x1c812d);}return _0xd11a86['save']();};}function saveUpdates(_0x3286de,_0x511bd8){return function(_0x3ef555){if(_0x3ef555){return _0x3ef555[_0x771f('0x22')](_0x3286de)['then'](function(_0x4974a5){return _0x4974a5;});}return null;};}function removeEntity(_0x4df697,_0xc8d298){return function(_0x1b3146){if(_0x1b3146){return _0x1b3146['destroy']()['then'](function(){var _0x17072a=_0x1b3146[_0x771f('0x23')]({'plain':!![]});var _0x4fff9c=_0x771f('0x24');return db[_0x771f('0x25')]['destroy']({'where':{'type':_0x4fff9c,'resourceId':_0x17072a['id']}})[_0x771f('0x26')](function(){return _0x1b3146;});})['then'](function(){_0x4df697[_0x771f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dc30b,_0x55aa32){return function(_0x4854eb){if(!_0x4854eb){_0x2dc30b[_0x771f('0x27')](0x194);}return _0x4854eb;};}function handleError(_0x582557,_0xadb4c){_0xadb4c=_0xadb4c||0x1f4;return function(_0x3ced9b){logger[_0x771f('0x28')](_0x3ced9b[_0x771f('0x29')]);if(_0x3ced9b[_0x771f('0x2a')]){delete _0x3ced9b[_0x771f('0x2a')];}_0x582557[_0x771f('0x1a')](_0xadb4c)[_0x771f('0x2b')](_0x3ced9b);};}exports[_0x771f('0x2c')]=function(_0x223a60,_0x282507){var _0x266c3b={},_0x3b92b6={},_0x5b59c1={'count':0x0,'rows':[]};var _0x37da89=_[_0x771f('0x2d')](db['WhatsappQueue']['rawAttributes'],function(_0x309cb9){return{'name':_0x309cb9[_0x771f('0x2e')],'type':_0x309cb9[_0x771f('0x2f')]['key']};});_0x3b92b6[_0x771f('0x30')]=_[_0x771f('0x2d')](_0x37da89,'name');_0x3b92b6[_0x771f('0x31')]=_[_0x771f('0x32')](_0x223a60[_0x771f('0x31')]);_0x3b92b6[_0x771f('0x33')]=_[_0x771f('0x34')](_0x3b92b6[_0x771f('0x30')],_0x3b92b6[_0x771f('0x31')]);_0x266c3b[_0x771f('0x35')]=_[_0x771f('0x34')](_0x3b92b6[_0x771f('0x30')],qs[_0x771f('0x36')](_0x223a60[_0x771f('0x31')][_0x771f('0x36')]));_0x266c3b['attributes']=_0x266c3b['attributes'][_0x771f('0x37')]?_0x266c3b[_0x771f('0x35')]:_0x3b92b6[_0x771f('0x30')];if(!_0x223a60[_0x771f('0x31')]['hasOwnProperty']('nolimit')){_0x266c3b[_0x771f('0x1e')]=qs[_0x771f('0x1e')](_0x223a60[_0x771f('0x31')][_0x771f('0x1e')]);_0x266c3b['offset']=qs[_0x771f('0x1d')](_0x223a60['query'][_0x771f('0x1d')]);}_0x266c3b[_0x771f('0x38')]=qs[_0x771f('0x39')](_0x223a60[_0x771f('0x31')][_0x771f('0x39')]);_0x266c3b[_0x771f('0x3a')]=qs['filters'](_['pick'](_0x223a60[_0x771f('0x31')],_0x3b92b6['filters']),_0x37da89);if(_0x223a60['query'][_0x771f('0x3b')]){_0x266c3b[_0x771f('0x3a')]=_[_0x771f('0x3c')](_0x266c3b[_0x771f('0x3a')],{'$or':_[_0x771f('0x2d')](_0x37da89,function(_0x976d60){if(_0x976d60[_0x771f('0x2f')]!==_0x771f('0x3d')){var _0x38d29c={};_0x38d29c[_0x976d60[_0x771f('0x2a')]]={'$like':'%'+_0x223a60[_0x771f('0x31')][_0x771f('0x3b')]+'%'};return _0x38d29c;}})});}_0x266c3b=_['merge']({},_0x266c3b,_0x223a60[_0x771f('0x3e')]);var _0x2091d3={'where':_0x266c3b['where']};return db[_0x771f('0x3f')][_0x771f('0x1c')](_0x2091d3)[_0x771f('0x26')](function(_0x49633d){_0x5b59c1[_0x771f('0x1c')]=_0x49633d;if(_0x223a60['query']['includeAll']){_0x266c3b[_0x771f('0x40')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x771f('0x41')](_0x266c3b);})[_0x771f('0x26')](function(_0x5337c4){_0x5b59c1[_0x771f('0x42')]=_0x5337c4;return _0x5b59c1;})[_0x771f('0x26')](respondWithFilteredResult(_0x282507,_0x266c3b))['catch'](handleError(_0x282507,null));};exports['show']=function(_0x544ff4,_0x26fba9){var _0x3bed7e={'raw':!![],'where':{'id':_0x544ff4[_0x771f('0x43')]['id']}},_0x32f024={};_0x32f024['model']=_['keys'](db[_0x771f('0x3f')]['rawAttributes']);_0x32f024[_0x771f('0x31')]=_[_0x771f('0x32')](_0x544ff4['query']);_0x32f024['filters']=_['intersection'](_0x32f024[_0x771f('0x30')],_0x32f024[_0x771f('0x31')]);_0x3bed7e[_0x771f('0x35')]=_['intersection'](_0x32f024[_0x771f('0x30')],qs[_0x771f('0x36')](_0x544ff4[_0x771f('0x31')][_0x771f('0x36')]));_0x3bed7e[_0x771f('0x35')]=_0x3bed7e[_0x771f('0x35')][_0x771f('0x37')]?_0x3bed7e[_0x771f('0x35')]:_0x32f024[_0x771f('0x30')];if(_0x544ff4['query']['includeAll']){_0x3bed7e['include']=[{'all':!![]}];}_0x3bed7e=_[_0x771f('0x3c')]({},_0x3bed7e,_0x544ff4[_0x771f('0x3e')]);return db[_0x771f('0x3f')]['find'](_0x3bed7e)[_0x771f('0x26')](handleEntityNotFound(_0x26fba9,null))['then'](respondWithResult(_0x26fba9,null))[_0x771f('0x44')](handleError(_0x26fba9,null));};exports[_0x771f('0x45')]=function(_0x268ec6,_0x3d41e6){return db[_0x771f('0x3f')][_0x771f('0x45')](_0x268ec6[_0x771f('0x46')],{})[_0x771f('0x26')](function(_0x1925d1){var _0x3b1f40=_0x268ec6[_0x771f('0x47')][_0x771f('0x23')]({'plain':!![]});if(!_0x3b1f40)throw new Error(_0x771f('0x48'));if(_0x3b1f40[_0x771f('0x49')]===_0x771f('0x47')){var _0x10bd16=_0x1925d1[_0x771f('0x23')]({'plain':!![]});var _0x2b2458=_0x771f('0x24');return db[_0x771f('0x4a')][_0x771f('0x4b')]({'where':{'name':_0x2b2458,'userProfileId':_0x3b1f40['userProfileId']},'raw':!![]})[_0x771f('0x26')](function(_0x1efc2f){if(_0x1efc2f&&_0x1efc2f[_0x771f('0x4c')]===0x0){return db['UserProfileResource'][_0x771f('0x45')]({'name':_0x10bd16[_0x771f('0x2a')],'resourceId':_0x10bd16['id'],'type':_0x1efc2f[_0x771f('0x2a')],'sectionId':_0x1efc2f['id']},{})[_0x771f('0x26')](function(){return _0x1925d1;});}else{return _0x1925d1;}})[_0x771f('0x44')](function(_0x2a99bb){logger[_0x771f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a99bb);throw _0x2a99bb;});}return _0x1925d1;})['then'](respondWithResult(_0x3d41e6,0xc9))[_0x771f('0x44')](handleError(_0x3d41e6,null));};exports[_0x771f('0x22')]=function(_0x2d7d90,_0x2da213){if(_0x2d7d90[_0x771f('0x46')]['id']){delete _0x2d7d90[_0x771f('0x46')]['id'];}return db[_0x771f('0x3f')][_0x771f('0x4b')]({'where':{'id':_0x2d7d90[_0x771f('0x43')]['id']}})[_0x771f('0x26')](handleEntityNotFound(_0x2da213,null))['then'](saveUpdates(_0x2d7d90[_0x771f('0x46')],null))['then'](respondWithResult(_0x2da213,null))['catch'](handleError(_0x2da213,null));};exports['destroy']=function(_0x1f062c,_0x45e1a9){return db[_0x771f('0x3f')][_0x771f('0x4b')]({'where':{'id':_0x1f062c[_0x771f('0x43')]['id']}})[_0x771f('0x26')](handleEntityNotFound(_0x45e1a9,null))[_0x771f('0x26')](removeEntity(_0x45e1a9,null))[_0x771f('0x44')](handleError(_0x45e1a9,null));};exports[_0x771f('0x4d')]=function(_0x35076d,_0x24ce3a){return db[_0x771f('0x3f')][_0x771f('0x4d')]()[_0x771f('0x26')](respondWithResult(_0x24ce3a,null))[_0x771f('0x44')](handleError(_0x24ce3a,null));};exports[_0x771f('0x4e')]=function(_0x4e7365,_0x9c2bd4,_0x382c88){var _0x25c60b={'raw':!![],'where':{}},_0x4addd2={},_0x5a2295;return db[_0x771f('0x3f')][_0x771f('0x4f')]({'where':{'id':_0x4e7365['params']['id']}})[_0x771f('0x26')](handleEntityNotFound(_0x9c2bd4,null))['then'](function(_0x3b8ea4){if(_0x3b8ea4){_0x5a2295=_0x3b8ea4[_0x771f('0x23')]({'plain':!![]});_0x4addd2['model']=_['keys'](db[_0x771f('0x50')][_0x771f('0x51')]);_0x4addd2[_0x771f('0x31')]=_[_0x771f('0x32')](_0x4e7365[_0x771f('0x31')]);_0x4addd2[_0x771f('0x33')]=_[_0x771f('0x34')](_0x4addd2[_0x771f('0x30')],_0x4addd2['query']);_0x25c60b[_0x771f('0x35')]=_[_0x771f('0x34')](_0x4addd2[_0x771f('0x30')],qs[_0x771f('0x36')](_0x4e7365[_0x771f('0x31')]['fields']));_0x25c60b[_0x771f('0x35')]=_0x25c60b['attributes'][_0x771f('0x37')]?_0x25c60b['attributes']:_0x4addd2['model'];if(!_0x4e7365['query'][_0x771f('0x52')](_0x771f('0x53'))){_0x25c60b[_0x771f('0x1e')]=qs[_0x771f('0x1e')](_0x4e7365['query'][_0x771f('0x1e')]);_0x25c60b['offset']=qs['offset'](_0x4e7365[_0x771f('0x31')][_0x771f('0x1d')]);}_0x25c60b[_0x771f('0x38')]=qs[_0x771f('0x39')](_0x4e7365[_0x771f('0x31')][_0x771f('0x39')]);_0x25c60b[_0x771f('0x3a')]=qs['filters'](_[_0x771f('0x54')](_0x4e7365[_0x771f('0x31')],_0x4addd2[_0x771f('0x33')]));_0x25c60b[_0x771f('0x3a')]['WhatsappQueueId']=_0x3b8ea4['id'];if(_0x4e7365[_0x771f('0x31')][_0x771f('0x3b')]){_0x25c60b[_0x771f('0x3a')]=_[_0x771f('0x3c')](_0x25c60b[_0x771f('0x3a')],{'$or':_[_0x771f('0x2d')](_0x25c60b[_0x771f('0x35')],function(_0x6f5b7f){var _0x4583d6={};_0x4583d6[_0x6f5b7f]={'$like':'%'+_0x4e7365[_0x771f('0x31')][_0x771f('0x3b')]+'%'};return _0x4583d6;})});}_0x25c60b=_['merge']({},_0x25c60b,_0x4e7365[_0x771f('0x3e')]);return db['UserWhatsappQueue'][_0x771f('0x41')](_0x25c60b);}})['then'](function(_0x2744f1){if(_0x2744f1){return db[_0x771f('0x55')]['findAndCountAll']({'where':{'id':_['map'](_0x2744f1,'UserId'),'role':'agent'},'attributes':['id',_0x771f('0x2a'),_0x771f('0x56'),'updatedAt','createdAt']});}})[_0x771f('0x26')](function(_0x199dea){if(_0x199dea){return{'count':_0x199dea[_0x771f('0x1c')],'rows':_[_0x771f('0x2d')](_0x199dea['rows'],function(_0x5a5153){return{'membername':_0x5a5153[_0x771f('0x2a')],'UserId':_0x5a5153['id'],'queue_name':_0x5a2295[_0x771f('0x2a')],'WhatsappQueueId':_0x5a2295['id'],'interface':util[_0x771f('0x57')]('%s/%s','SIP',_0x5a5153[_0x771f('0x2a')]),'penalty':0x0,'paused':_0x5a5153[_0x771f('0x56')],'createdAt':_0x5a5153[_0x771f('0x58')],'updatedAt':_0x5a5153[_0x771f('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x771f('0x26')](respondWithFilteredResult(_0x9c2bd4,_0x25c60b))[_0x771f('0x44')](handleError(_0x9c2bd4,null));};exports[_0x771f('0x5a')]=function(_0x33a1cc,_0x6c69e3,_0x5a3f03){var _0x167ccc={};var _0x297fff={};var _0x5518a4;var _0x531673;return db[_0x771f('0x3f')][_0x771f('0x4f')]({'where':{'id':_0x33a1cc[_0x771f('0x43')]['id']}})[_0x771f('0x26')](handleEntityNotFound(_0x6c69e3,null))['then'](function(_0x128b82){if(_0x128b82){_0x5518a4=_0x128b82;_0x297fff['model']=_[_0x771f('0x32')](db[_0x771f('0x5b')][_0x771f('0x51')]);_0x297fff[_0x771f('0x31')]=_[_0x771f('0x32')](_0x33a1cc[_0x771f('0x31')]);_0x297fff[_0x771f('0x33')]=_[_0x771f('0x34')](_0x297fff[_0x771f('0x30')],_0x297fff[_0x771f('0x31')]);_0x167ccc[_0x771f('0x35')]=_[_0x771f('0x34')](_0x297fff[_0x771f('0x30')],qs[_0x771f('0x36')](_0x33a1cc[_0x771f('0x31')][_0x771f('0x36')]));_0x167ccc[_0x771f('0x35')]=_0x167ccc[_0x771f('0x35')][_0x771f('0x37')]?_0x167ccc[_0x771f('0x35')]:_0x297fff[_0x771f('0x30')];_0x167ccc[_0x771f('0x38')]=qs[_0x771f('0x39')](_0x33a1cc[_0x771f('0x31')][_0x771f('0x39')]);_0x167ccc[_0x771f('0x3a')]=qs[_0x771f('0x33')](_[_0x771f('0x54')](_0x33a1cc[_0x771f('0x31')],_0x297fff[_0x771f('0x33')]));if(_0x33a1cc[_0x771f('0x31')][_0x771f('0x3b')]){_0x167ccc[_0x771f('0x3a')]=_[_0x771f('0x3c')](_0x167ccc[_0x771f('0x3a')],{'$or':_[_0x771f('0x2d')](_0x167ccc['attributes'],function(_0x27d964){var _0x2371f4={};_0x2371f4[_0x27d964]={'$like':'%'+_0x33a1cc[_0x771f('0x31')][_0x771f('0x3b')]+'%'};return _0x2371f4;})});}_0x167ccc=_['merge']({},_0x167ccc,_0x33a1cc[_0x771f('0x3e')]);return _0x5518a4[_0x771f('0x5a')](_0x167ccc);}})[_0x771f('0x26')](function(_0x1aac01){if(_0x1aac01){_0x531673=_0x1aac01[_0x771f('0x37')];if(!_0x33a1cc['query'][_0x771f('0x52')](_0x771f('0x53'))){_0x167ccc[_0x771f('0x1e')]=qs[_0x771f('0x1e')](_0x33a1cc[_0x771f('0x31')]['limit']);_0x167ccc[_0x771f('0x1d')]=qs['offset'](_0x33a1cc['query']['offset']);}return _0x5518a4[_0x771f('0x5a')](_0x167ccc);}})[_0x771f('0x26')](function(_0x259c94){if(_0x259c94){return _0x259c94?{'count':_0x531673,'rows':_0x259c94}:null;}})[_0x771f('0x26')](respondWithResult(_0x6c69e3,null))[_0x771f('0x44')](handleError(_0x6c69e3,null));};exports['addTeams']=function(_0x1f5173,_0x35b391,_0xa3e489){var _0x5762c1=_0x1f5173['body'][_0x771f('0x5c')];return db[_0x771f('0x5b')][_0x771f('0x41')]({'where':{'id':_0x5762c1},'attributes':['id'],'include':[{'model':db[_0x771f('0x55')],'as':_0x771f('0x5d'),'attributes':['id',_0x771f('0x2a'),'online',_0x771f('0x5e'),_0x771f('0x5f')],'raw':!![]}]})[_0x771f('0x26')](function(_0x226f0f){if(_0x226f0f){var _0x544fbf=_[_0x771f('0x60')](_0x226f0f,function(_0x3ac8bb){var _0x408d97=_0x3ac8bb[_0x771f('0x23')]({'plain':!![]});return _0x408d97['Agents'];});return db[_0x771f('0x3f')][_0x771f('0x4b')]({'where':{'id':_0x1f5173[_0x771f('0x43')]['id']}})['then'](function(_0x4ddfba){return db['sequelize'][_0x771f('0x61')](function(_0x47d7ce){return _0x4ddfba['addTeams'](_0x5762c1,{'transaction':_0x47d7ce})[_0x771f('0x26')](function(){return BPromise[_0x771f('0x62')](_0x544fbf,function(_0x2ebc7){return db[_0x771f('0x50')][_0x771f('0x63')]({'where':{'UserId':_0x2ebc7['id'],'WhatsappQueueId':_0x1f5173[_0x771f('0x43')]['id']},'transaction':_0x47d7ce});});})[_0x771f('0x26')](function(){_0x544fbf[_0x771f('0x64')](function(_0x1da084){socket[_0x771f('0x65')](_0x771f('0x66'),{'UserId':_0x1da084['id'],'WhatsappQueueId':_0x4ddfba['id']});});});});});}})[_0x771f('0x26')](respondWithStatusCode(_0x35b391,null))['catch'](handleError(_0x35b391,null));};exports[_0x771f('0x67')]=function(_0x2b69bd,_0x1606ec,_0x263784){return db[_0x771f('0x5b')][_0x771f('0x41')]({'where':{'id':_0x2b69bd[_0x771f('0x31')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x771f('0x5d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1606ec,null))[_0x771f('0x26')](function(_0x2cf40b){var _0x1031ea=_['map'](_0x2cf40b,'id');var _0x2a8256=[];var _0x2c59c7=[];var _0x97c568=squel[_0x771f('0x68')]();_0x97c568[_0x771f('0x69')](_0x771f('0x6a'))[_0x771f('0x6b')](_0x771f('0x6c'),'tq')[_0x771f('0x6d')]('user_has_teams','ut',_0x771f('0x6e'))['where'](_0x771f('0x6f'),_0x2b69bd[_0x771f('0x43')]['id']);for(var _0x460daf=0x0;_0x460daf<_0x2cf40b['length'];_0x460daf+=0x1){let _0x19fdca=_0x2cf40b[_0x460daf];for(var _0x12f19f=0x0;_0x12f19f<_0x19fdca[_0x771f('0x5d')][_0x771f('0x37')];_0x12f19f+=0x1){let _0x1d191c=_0x19fdca[_0x771f('0x5d')][_0x12f19f];var _0x3a60a3=_0x97c568['clone']();_0x3a60a3[_0x771f('0x3a')](_0x771f('0x70'),_0x1d191c['id']);_0x2c59c7['push'](db[_0x771f('0x71')]['query'](_0x3a60a3[_0x771f('0x72')](),{'type':db[_0x771f('0x71')][_0x771f('0x73')][_0x771f('0x74')]})[_0x771f('0x26')](function(_0x4d1d2a){if(_0x4d1d2a[_0x771f('0x37')]===0x1){return _0x1d191c['id'];}else{var _0x3659f1=_[_0x771f('0x75')](_[_0x771f('0x2d')](_0x4d1d2a,_0x771f('0x76')),function(_0x244c7a){return _[_0x771f('0x77')](_0x1031ea,_0x244c7a);});if(_0x3659f1){return _0x1d191c['id'];}}}));}}return BPromise[_0x771f('0x78')](_0x2c59c7)[_0x771f('0x26')](function(_0x3905b7){_0x2a8256=_(_0x2a8256)['union'](_0x3905b7)[_0x771f('0x79')]()[_0x771f('0x7a')]();return db[_0x771f('0x3f')][_0x771f('0x4b')]({'where':{'id':_0x2b69bd[_0x771f('0x43')]['id']}})[_0x771f('0x26')](function(_0x22eaae){return db[_0x771f('0x71')][_0x771f('0x61')](function(_0x2db802){return _0x22eaae['removeTeams'](_0x2b69bd[_0x771f('0x31')][_0x771f('0x5c')],{'transaction':_0x2db802})[_0x771f('0x26')](function(){if(!_[_0x771f('0x7b')](_0x2a8256)){return _0x22eaae[_0x771f('0x7c')](_0x2a8256,{'transaction':_0x2db802});}})['then'](function(){_0x2a8256[_0x771f('0x64')](function(_0xf01404){socket[_0x771f('0x65')](_0x771f('0x7d'),{'UserId':_0xf01404,'WhatsappQueueId':_0x22eaae['id']});});});});});});})['then'](respondWithStatusCode(_0x1606ec,null))[_0x771f('0x44')](handleError(_0x1606ec,null));};exports[_0x771f('0x7e')]=function(_0x331e04,_0x5085db,_0x468252){return db['WhatsappQueue'][_0x771f('0x4b')]({'where':{'id':_0x331e04['params']['id']}})['then'](handleEntityNotFound(_0x5085db,null))[_0x771f('0x26')](function(_0x21c499){if(_0x21c499){return _0x21c499[_0x771f('0x7e')](_0x331e04['body'][_0x771f('0x5c')],_[_0x771f('0x7f')](_0x331e04[_0x771f('0x46')],[_0x771f('0x5c'),'id'])||{})[_0x771f('0x80')](function(_0x22a152){for(var _0x1c25f9=0x0;_0x1c25f9<_0x331e04[_0x771f('0x46')]['ids'][_0x771f('0x37')];_0x1c25f9+=0x1){socket[_0x771f('0x65')](_0x771f('0x66'),{'UserId':_0x331e04[_0x771f('0x46')][_0x771f('0x5c')][_0x1c25f9],'WhatsappQueueId':_0x331e04['params']['id']});}return _0x22a152;});}})[_0x771f('0x26')](respondWithResult(_0x5085db,null))[_0x771f('0x44')](handleError(_0x5085db,null));};exports['removeAgents']=function(_0x4be713,_0x54eb93,_0x16dc3e){return db[_0x771f('0x3f')][_0x771f('0x4b')]({'where':{'id':_0x4be713[_0x771f('0x43')]['id']}})[_0x771f('0x26')](handleEntityNotFound(_0x54eb93,null))[_0x771f('0x26')](function(_0x2bf041){if(_0x2bf041){return _0x2bf041[_0x771f('0x7c')](_0x4be713['query'][_0x771f('0x5c')])[_0x771f('0x26')](function(){if(_[_0x771f('0x81')](_0x4be713[_0x771f('0x31')]['ids'])){for(var _0x5274bc=0x0;_0x5274bc<_0x4be713[_0x771f('0x31')][_0x771f('0x5c')][_0x771f('0x37')];_0x5274bc+=0x1){socket[_0x771f('0x65')](_0x771f('0x7d'),{'UserId':Number(_0x4be713[_0x771f('0x31')]['ids'][_0x5274bc]),'WhatsappQueueId':Number(_0x4be713[_0x771f('0x43')]['id'])});}}else{socket[_0x771f('0x65')](_0x771f('0x7d'),{'UserId':Number(_0x4be713['query'][_0x771f('0x5c')]),'WhatsappQueueId':Number(_0x4be713[_0x771f('0x43')]['id'])});}});}})['then'](respondWithStatusCode(_0x54eb93,null))[_0x771f('0x44')](handleError(_0x54eb93,null));};exports[_0x771f('0x82')]=function(_0x1535c5,_0xc4b639,_0x4af42a){var _0x1d317e={};var _0x3d3398={};var _0x31fe43;var _0x4cd887;return db[_0x771f('0x3f')]['findOne']({'where':{'id':_0x1535c5[_0x771f('0x43')]['id']}})[_0x771f('0x26')](handleEntityNotFound(_0xc4b639,null))[_0x771f('0x26')](function(_0x217feb){if(_0x217feb){_0x31fe43=_0x217feb;_0x3d3398[_0x771f('0x30')]=_[_0x771f('0x32')](db[_0x771f('0x55')][_0x771f('0x51')]);_0x3d3398[_0x771f('0x31')]=_[_0x771f('0x32')](_0x1535c5[_0x771f('0x31')]);_0x3d3398[_0x771f('0x33')]=_[_0x771f('0x34')](_0x3d3398['model'],_0x3d3398[_0x771f('0x31')]);_0x1d317e[_0x771f('0x35')]=_['intersection'](_0x3d3398['model'],qs['fields'](_0x1535c5[_0x771f('0x31')]['fields']));_0x1d317e['attributes']=_0x1d317e['attributes'][_0x771f('0x37')]?_0x1d317e['attributes']:_0x3d3398[_0x771f('0x30')];_0x1d317e[_0x771f('0x38')]=qs[_0x771f('0x39')](_0x1535c5[_0x771f('0x31')]['sort']);_0x1d317e[_0x771f('0x3a')]=qs[_0x771f('0x33')](_[_0x771f('0x54')](_0x1535c5['query'],_0x3d3398[_0x771f('0x33')]));if(_0x1535c5[_0x771f('0x31')][_0x771f('0x3b')]){_0x1d317e['where']=_[_0x771f('0x3c')](_0x1d317e[_0x771f('0x3a')],{'$or':_[_0x771f('0x2d')](_0x1d317e[_0x771f('0x35')],function(_0x405d01){var _0x551d66={};_0x551d66[_0x405d01]={'$like':'%'+_0x1535c5[_0x771f('0x31')][_0x771f('0x3b')]+'%'};return _0x551d66;})});}_0x1d317e=_[_0x771f('0x3c')]({},_0x1d317e,_0x1535c5[_0x771f('0x3e')]);return _0x31fe43[_0x771f('0x82')](_0x1d317e);}})[_0x771f('0x26')](function(_0x340b82){if(_0x340b82){_0x4cd887=_0x340b82['length'];if(!_0x1535c5[_0x771f('0x31')][_0x771f('0x52')]('nolimit')){_0x1d317e[_0x771f('0x1e')]=qs[_0x771f('0x1e')](_0x1535c5[_0x771f('0x31')][_0x771f('0x1e')]);_0x1d317e[_0x771f('0x1d')]=qs[_0x771f('0x1d')](_0x1535c5[_0x771f('0x31')]['offset']);}return _0x31fe43[_0x771f('0x82')](_0x1d317e);}})['then'](function(_0x29bea9){if(_0x29bea9){return _0x29bea9?{'count':_0x4cd887,'rows':_0x29bea9}:null;}})[_0x771f('0x26')](respondWithResult(_0xc4b639,null))['catch'](handleError(_0xc4b639,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 73b8397..102cef0 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 _0x606a=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x579325,_0x5c414e){var _0x440efc=function(_0x20f9ec){while(--_0x20f9ec){_0x579325['push'](_0x579325['shift']());}};_0x440efc(++_0x5c414e);}(_0x606a,0x182));var _0xa606=function(_0x7ddd81,_0x4c65e1){_0x7ddd81=_0x7ddd81-0x0;var _0x2d5688=_0x606a[_0x7ddd81];return _0x2d5688;};'use strict';var EventEmitter=require(_0xa606('0x0'));var WhatsappQueue=require(_0xa606('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xa606('0x2')](0x0);var events={'afterCreate':_0xa606('0x3'),'afterUpdate':_0xa606('0x4'),'afterDestroy':'remove'};function emitEvent(_0xa073b6){return function(_0xf8e140,_0x11a355,_0x5bedb9){WhatsappQueueEvents[_0xa606('0x5')](_0xa073b6+':'+_0xf8e140['id'],_0xf8e140);WhatsappQueueEvents[_0xa606('0x5')](_0xa073b6,_0xf8e140);_0x5bedb9(null);};}for(var e in events){if(events[_0xa606('0x6')](e)){var event=events[e];WhatsappQueue[_0xa606('0x7')](e,emitEvent(event));}}module[_0xa606('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x8121=['emit','hook','exports','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x3374a3,_0x316fe3){var _0x1371b0=function(_0x5a53e1){while(--_0x5a53e1){_0x3374a3['push'](_0x3374a3['shift']());}};_0x1371b0(++_0x316fe3);}(_0x8121,0xbd));var _0x1812=function(_0x2a9161,_0x2531b6){_0x2a9161=_0x2a9161-0x0;var _0x24b74e=_0x8121[_0x2a9161];return _0x24b74e;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x1812('0x0'))['db'][_0x1812('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x1812('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x543e4b){return function(_0x313bf9,_0x211c81,_0x243644){WhatsappQueueEvents[_0x1812('0x3')](_0x543e4b+':'+_0x313bf9['id'],_0x313bf9);WhatsappQueueEvents['emit'](_0x543e4b,_0x313bf9);_0x243644(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x1812('0x4')](e,emitEvent(event));}}module[_0x1812('0x5')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index face3df..cb63790 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 _0xd1c4=['api','moment','bluebird','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash','../../config/logger'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xd1c4,0x1c0));var _0x4d1c=function(_0x47c183,_0x4591e6){_0x47c183=_0x47c183-0x0;var _0x52fa5b=_0xd1c4[_0x47c183];return _0x52fa5b;};'use strict';var _=require(_0x4d1c('0x0'));var util=require('util');var logger=require(_0x4d1c('0x1'))(_0x4d1c('0x2'));var moment=require(_0x4d1c('0x3'));var BPromise=require(_0x4d1c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4d1c('0x5'));var attributes=require('./whatsappQueue.attributes');module[_0x4d1c('0x6')]=function(_0x35b382,_0x5eb68f){return _0x35b382[_0x4d1c('0x7')](_0x4d1c('0x8'),attributes,{'tableName':_0x4d1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30c4=['rimraf','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x11a846,_0x2c29cb){var _0x2b8c28=function(_0x2b8a43){while(--_0x2b8a43){_0x11a846['push'](_0x11a846['shift']());}};_0x2b8c28(++_0x2c29cb);}(_0x30c4,0x149));var _0x430c=function(_0x4716fd,_0x267154){_0x4716fd=_0x4716fd-0x0;var _0x1569e0=_0x30c4[_0x4716fd];return _0x1569e0;};'use strict';var _=require(_0x430c('0x0'));var util=require(_0x430c('0x1'));var logger=require(_0x430c('0x2'))(_0x430c('0x3'));var moment=require(_0x430c('0x4'));var BPromise=require(_0x430c('0x5'));var rp=require(_0x430c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x430c('0x7'));var config=require('../../config/environment');var attributes=require(_0x430c('0x8'));module['exports']=function(_0x3a3449,_0x521a09){return _0x3a3449[_0x430c('0x9')](_0x430c('0xa'),attributes,{'tableName':_0x430c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 828f63b..3ef2a50 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 _0x6cae=['map','model','stringify','catch','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x5e62d0,_0x442238){var _0x39319f=function(_0x2c59e9){while(--_0x2c59e9){_0x5e62d0['push'](_0x5e62d0['shift']());}};_0x39319f(++_0x442238);}(_0x6cae,0x180));var _0xe6ca=function(_0x5a2b60,_0x3fa4ae){_0x5a2b60=_0x5a2b60-0x0;var _0x3f7692=_0x6cae[_0x5a2b60];return _0x3f7692;};'use strict';var _=require(_0xe6ca('0x0'));var util=require(_0xe6ca('0x1'));var moment=require(_0xe6ca('0x2'));var BPromise=require(_0xe6ca('0x3'));var rs=require(_0xe6ca('0x4'));var fs=require('fs');var Redis=require(_0xe6ca('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe6ca('0x6'));var logger=require(_0xe6ca('0x7'))(_0xe6ca('0x8'));var config=require('../../config/environment');var jayson=require(_0xe6ca('0x9'));var client=jayson[_0xe6ca('0xa')][_0xe6ca('0xb')]({'port':0x232a});config[_0xe6ca('0xc')]=_[_0xe6ca('0xd')](config[_0xe6ca('0xc')],{'host':_0xe6ca('0xe'),'port':0x18eb});var socket=require(_0xe6ca('0xf'))(new Redis(config[_0xe6ca('0xc')]));require(_0xe6ca('0x10'))['register'](socket);function respondWithRpcPromise(_0x8e1214,_0x249dae,_0x59667f){return new BPromise(function(_0x5c9cd4,_0x233ad3){return client[_0xe6ca('0x11')](_0x8e1214,_0x59667f)[_0xe6ca('0x12')](function(_0x131efb){logger[_0xe6ca('0x13')](_0xe6ca('0x14'),_0x249dae,'request\x20sent');logger[_0xe6ca('0x15')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x249dae,_0xe6ca('0x16'),JSON['stringify'](_0x131efb));if(_0x131efb['error']){if(_0x131efb[_0xe6ca('0x17')][_0xe6ca('0x18')]===0x1f4){logger[_0xe6ca('0x17')](_0xe6ca('0x14'),_0x249dae,_0x131efb[_0xe6ca('0x17')][_0xe6ca('0x19')]);return _0x233ad3(_0x131efb[_0xe6ca('0x17')]['message']);}logger[_0xe6ca('0x17')](_0xe6ca('0x14'),_0x249dae,_0x131efb[_0xe6ca('0x17')][_0xe6ca('0x19')]);return _0x5c9cd4(_0x131efb[_0xe6ca('0x17')][_0xe6ca('0x19')]);}else{logger[_0xe6ca('0x13')](_0xe6ca('0x14'),_0x249dae,'request\x20sent');_0x5c9cd4(_0x131efb[_0xe6ca('0x1a')][_0xe6ca('0x19')]);}})['catch'](function(_0x123f6b){logger[_0xe6ca('0x17')](_0xe6ca('0x14'),_0x249dae,_0x123f6b);_0x233ad3(_0x123f6b);});});}exports[_0xe6ca('0x1b')]=function(_0x506bb1){var _0x18378c=this;return new Promise(function(_0x202d8e,_0x2cfac0){return db[_0xe6ca('0x1c')][_0xe6ca('0x1d')]({'raw':_0x506bb1['options']?_0x506bb1[_0xe6ca('0x1e')][_0xe6ca('0x1f')]===undefined?!![]:![]:!![],'where':_0x506bb1[_0xe6ca('0x1e')]?_0x506bb1[_0xe6ca('0x1e')][_0xe6ca('0x20')]||null:null,'attributes':_0x506bb1['options']?_0x506bb1[_0xe6ca('0x1e')][_0xe6ca('0x21')]||null:null,'limit':_0x506bb1[_0xe6ca('0x1e')]?_0x506bb1[_0xe6ca('0x1e')][_0xe6ca('0x22')]||null:null,'include':_0x506bb1[_0xe6ca('0x1e')]?_0x506bb1[_0xe6ca('0x1e')][_0xe6ca('0x23')]?_[_0xe6ca('0x24')](_0x506bb1['options'][_0xe6ca('0x23')],function(_0x157c39){return{'model':db[_0x157c39[_0xe6ca('0x25')]],'as':_0x157c39['as'],'attributes':_0x157c39[_0xe6ca('0x21')],'include':_0x157c39['include']?_['map'](_0x157c39[_0xe6ca('0x23')],function(_0x574ab3){return{'model':db[_0x574ab3[_0xe6ca('0x25')]],'as':_0x574ab3['as'],'attributes':_0x574ab3[_0xe6ca('0x21')],'include':_0x574ab3[_0xe6ca('0x23')]?_[_0xe6ca('0x24')](_0x574ab3[_0xe6ca('0x23')],function(_0x37f762){return{'model':db[_0x37f762[_0xe6ca('0x25')]],'as':_0x37f762['as'],'attributes':_0x37f762['attributes']};}):[]};}):[]};}):[]:[]})[_0xe6ca('0x12')](function(_0x568885){logger[_0xe6ca('0x13')](_0xe6ca('0x1b'),_0x506bb1);logger[_0xe6ca('0x15')]('GetWhatsappQueue',_0x506bb1,JSON[_0xe6ca('0x26')](_0x568885));_0x202d8e(_0x568885);})[_0xe6ca('0x27')](function(_0x263150){logger[_0xe6ca('0x17')]('GetWhatsappQueue',_0x263150[_0xe6ca('0x19')],_0x506bb1);_0x2cfac0(_0x18378c[_0xe6ca('0x17')](0x1f4,_0x263150[_0xe6ca('0x19')]));});});};exports[_0xe6ca('0x28')]=function(_0x1906c8){var _0x2a5c20=this;return new Promise(function(_0x375738,_0x9d4cfb){return db[_0xe6ca('0x1c')][_0xe6ca('0x29')]({'raw':_0x1906c8['options']?_0x1906c8[_0xe6ca('0x1e')][_0xe6ca('0x1f')]===undefined?!![]:![]:!![],'where':_0x1906c8[_0xe6ca('0x1e')]?_0x1906c8[_0xe6ca('0x1e')][_0xe6ca('0x20')]||null:null,'attributes':_0x1906c8[_0xe6ca('0x1e')]?_0x1906c8[_0xe6ca('0x1e')][_0xe6ca('0x21')]||null:null,'include':_0x1906c8['options']?_0x1906c8['options'][_0xe6ca('0x23')]?_[_0xe6ca('0x24')](_0x1906c8[_0xe6ca('0x1e')][_0xe6ca('0x23')],function(_0x5650b3){return{'model':db[_0x5650b3[_0xe6ca('0x25')]],'as':_0x5650b3['as'],'attributes':_0x5650b3[_0xe6ca('0x21')],'include':_0x5650b3[_0xe6ca('0x23')]?_[_0xe6ca('0x24')](_0x5650b3[_0xe6ca('0x23')],function(_0x52daec){return{'model':db[_0x52daec[_0xe6ca('0x25')]],'as':_0x52daec['as'],'attributes':_0x52daec['attributes'],'include':_0x52daec[_0xe6ca('0x23')]?_[_0xe6ca('0x24')](_0x52daec['include'],function(_0x34d870){return{'model':db[_0x34d870[_0xe6ca('0x25')]],'as':_0x34d870['as'],'attributes':_0x34d870[_0xe6ca('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe6ca('0x12')](function(_0x22a63f){logger[_0xe6ca('0x13')](_0xe6ca('0x28'),_0x1906c8);logger[_0xe6ca('0x15')](_0xe6ca('0x28'),_0x1906c8,JSON['stringify'](_0x22a63f));_0x375738(_0x22a63f);})[_0xe6ca('0x27')](function(_0x1252f9){logger[_0xe6ca('0x17')](_0xe6ca('0x28'),_0x1252f9['message'],_0x1906c8);_0x9d4cfb(_0x2a5c20['error'](0x1f4,_0x1252f9['message']));});});}; \ No newline at end of file +var _0x6ddb=['attributes','limit','include','map','model','then','GetWhatsappQueue','catch','ShowWhatsappQueue','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','WhatsappQueue','options','raw','where'];(function(_0x2f32c4,_0x2597ba){var _0x95b5dc=function(_0x4ee89e){while(--_0x4ee89e){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x95b5dc(++_0x2597ba);}(_0x6ddb,0x151));var _0xb6dd=function(_0x45fc68,_0x2f3322){_0x45fc68=_0x45fc68-0x0;var _0x550824=_0x6ddb[_0x45fc68];return _0x550824;};'use strict';var _=require(_0xb6dd('0x0'));var util=require(_0xb6dd('0x1'));var moment=require(_0xb6dd('0x2'));var BPromise=require('bluebird');var rs=require(_0xb6dd('0x3'));var fs=require('fs');var Redis=require(_0xb6dd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb6dd('0x5'));var logger=require(_0xb6dd('0x6'))(_0xb6dd('0x7'));var config=require(_0xb6dd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb6dd('0x9')][_0xb6dd('0xa')]({'port':0x232a});config[_0xb6dd('0xb')]=_[_0xb6dd('0xc')](config['redis'],{'host':_0xb6dd('0xd'),'port':0x18eb});var socket=require(_0xb6dd('0xe'))(new Redis(config[_0xb6dd('0xb')]));require(_0xb6dd('0xf'))[_0xb6dd('0x10')](socket);function respondWithRpcPromise(_0x552c92,_0x3958e1,_0x2f8d1d){return new BPromise(function(_0x3670d5,_0x5e9959){return client[_0xb6dd('0x11')](_0x552c92,_0x2f8d1d)['then'](function(_0x46e0bf){logger[_0xb6dd('0x12')](_0xb6dd('0x13'),_0x3958e1,_0xb6dd('0x14'));logger[_0xb6dd('0x15')](_0xb6dd('0x16'),_0x3958e1,_0xb6dd('0x14'),JSON[_0xb6dd('0x17')](_0x46e0bf));if(_0x46e0bf[_0xb6dd('0x18')]){if(_0x46e0bf[_0xb6dd('0x18')][_0xb6dd('0x19')]===0x1f4){logger[_0xb6dd('0x18')](_0xb6dd('0x13'),_0x3958e1,_0x46e0bf[_0xb6dd('0x18')][_0xb6dd('0x1a')]);return _0x5e9959(_0x46e0bf[_0xb6dd('0x18')][_0xb6dd('0x1a')]);}logger[_0xb6dd('0x18')](_0xb6dd('0x13'),_0x3958e1,_0x46e0bf[_0xb6dd('0x18')][_0xb6dd('0x1a')]);return _0x3670d5(_0x46e0bf['error'][_0xb6dd('0x1a')]);}else{logger[_0xb6dd('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x3958e1,_0xb6dd('0x14'));_0x3670d5(_0x46e0bf[_0xb6dd('0x1b')][_0xb6dd('0x1a')]);}})['catch'](function(_0x5404be){logger[_0xb6dd('0x18')](_0xb6dd('0x13'),_0x3958e1,_0x5404be);_0x5e9959(_0x5404be);});});}exports['GetWhatsappQueue']=function(_0x59847e){var _0x1789d3=this;return new Promise(function(_0x489ce8,_0x1a34e5){return db[_0xb6dd('0x1c')]['findAll']({'raw':_0x59847e[_0xb6dd('0x1d')]?_0x59847e['options'][_0xb6dd('0x1e')]===undefined?!![]:![]:!![],'where':_0x59847e[_0xb6dd('0x1d')]?_0x59847e['options'][_0xb6dd('0x1f')]||null:null,'attributes':_0x59847e['options']?_0x59847e['options'][_0xb6dd('0x20')]||null:null,'limit':_0x59847e[_0xb6dd('0x1d')]?_0x59847e[_0xb6dd('0x1d')][_0xb6dd('0x21')]||null:null,'include':_0x59847e[_0xb6dd('0x1d')]?_0x59847e[_0xb6dd('0x1d')][_0xb6dd('0x22')]?_[_0xb6dd('0x23')](_0x59847e[_0xb6dd('0x1d')][_0xb6dd('0x22')],function(_0x1288ea){return{'model':db[_0x1288ea[_0xb6dd('0x24')]],'as':_0x1288ea['as'],'attributes':_0x1288ea[_0xb6dd('0x20')],'include':_0x1288ea[_0xb6dd('0x22')]?_[_0xb6dd('0x23')](_0x1288ea['include'],function(_0x5b5354){return{'model':db[_0x5b5354['model']],'as':_0x5b5354['as'],'attributes':_0x5b5354[_0xb6dd('0x20')],'include':_0x5b5354[_0xb6dd('0x22')]?_[_0xb6dd('0x23')](_0x5b5354[_0xb6dd('0x22')],function(_0x185c44){return{'model':db[_0x185c44['model']],'as':_0x185c44['as'],'attributes':_0x185c44['attributes']};}):[]};}):[]};}):[]:[]})[_0xb6dd('0x25')](function(_0x36aa4f){logger[_0xb6dd('0x12')]('GetWhatsappQueue',_0x59847e);logger[_0xb6dd('0x15')](_0xb6dd('0x26'),_0x59847e,JSON[_0xb6dd('0x17')](_0x36aa4f));_0x489ce8(_0x36aa4f);})[_0xb6dd('0x27')](function(_0x5d1002){logger[_0xb6dd('0x18')]('GetWhatsappQueue',_0x5d1002['message'],_0x59847e);_0x1a34e5(_0x1789d3['error'](0x1f4,_0x5d1002[_0xb6dd('0x1a')]));});});};exports[_0xb6dd('0x28')]=function(_0x3596e2){var _0x4827e3=this;return new Promise(function(_0x556875,_0x577ef6){return db['WhatsappQueue']['find']({'raw':_0x3596e2['options']?_0x3596e2['options']['raw']===undefined?!![]:![]:!![],'where':_0x3596e2[_0xb6dd('0x1d')]?_0x3596e2[_0xb6dd('0x1d')][_0xb6dd('0x1f')]||null:null,'attributes':_0x3596e2[_0xb6dd('0x1d')]?_0x3596e2[_0xb6dd('0x1d')][_0xb6dd('0x20')]||null:null,'include':_0x3596e2['options']?_0x3596e2[_0xb6dd('0x1d')][_0xb6dd('0x22')]?_[_0xb6dd('0x23')](_0x3596e2[_0xb6dd('0x1d')][_0xb6dd('0x22')],function(_0x1ca85b){return{'model':db[_0x1ca85b[_0xb6dd('0x24')]],'as':_0x1ca85b['as'],'attributes':_0x1ca85b[_0xb6dd('0x20')],'include':_0x1ca85b[_0xb6dd('0x22')]?_['map'](_0x1ca85b['include'],function(_0x50c0cc){return{'model':db[_0x50c0cc[_0xb6dd('0x24')]],'as':_0x50c0cc['as'],'attributes':_0x50c0cc[_0xb6dd('0x20')],'include':_0x50c0cc[_0xb6dd('0x22')]?_[_0xb6dd('0x23')](_0x50c0cc[_0xb6dd('0x22')],function(_0x193302){return{'model':db[_0x193302['model']],'as':_0x193302['as'],'attributes':_0x193302[_0xb6dd('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb6dd('0x25')](function(_0x1cba76){logger[_0xb6dd('0x12')](_0xb6dd('0x28'),_0x3596e2);logger[_0xb6dd('0x15')](_0xb6dd('0x28'),_0x3596e2,JSON[_0xb6dd('0x17')](_0x1cba76));_0x556875(_0x1cba76);})[_0xb6dd('0x27')](function(_0x39b938){logger[_0xb6dd('0x18')]('ShowWhatsappQueue',_0x39b938['message'],_0x3596e2);_0x577ef6(_0x4827e3[_0xb6dd('0x18')](0x1f4,_0x39b938[_0xb6dd('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index c78bc83..cccb4f2 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 _0x53b9=['update','removeListener','register','whatsappQueue:','save'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x53b9,0x18f));var _0x953b=function(_0x2913d0,_0x46396c){_0x2913d0=_0x2913d0-0x0;var _0x3a0090=_0x53b9[_0x2913d0];return _0x3a0090;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x953b('0x0'),'remove',_0x953b('0x1')];function createListener(_0x1950ee,_0x53a005){return function(_0xc2ad2f){_0x53a005['emit'](_0x1950ee,_0xc2ad2f);};}function removeListener(_0x4e76eb,_0xe18e6d){return function(){WhatsappQueueEvents[_0x953b('0x2')](_0x4e76eb,_0xe18e6d);};}exports[_0x953b('0x3')]=function(_0x1cd858){for(var _0x1d8292=0x0,_0x3ebb22=events['length'];_0x1d8292<_0x3ebb22;_0x1d8292++){var _0x3f3f91=events[_0x1d8292];var _0x5c6bf3=createListener(_0x953b('0x4')+_0x3f3f91,_0x1cd858);WhatsappQueueEvents['on'](_0x3f3f91,_0x5c6bf3);}}; \ No newline at end of file +var _0xb37d=['register','whatsappQueue:','./whatsappQueue.events','save','emit','removeListener'];(function(_0x25353d,_0x1c0ead){var _0x5ec6a4=function(_0xcd6c95){while(--_0xcd6c95){_0x25353d['push'](_0x25353d['shift']());}};_0x5ec6a4(++_0x1c0ead);}(_0xb37d,0x11c));var _0xdb37=function(_0x100912,_0x417fd8){_0x100912=_0x100912-0x0;var _0x54ac37=_0xb37d[_0x100912];return _0x54ac37;};'use strict';var WhatsappQueueEvents=require(_0xdb37('0x0'));var events=[_0xdb37('0x1'),'remove','update'];function createListener(_0x8e1fa3,_0x340d39){return function(_0x44758d){_0x340d39[_0xdb37('0x2')](_0x8e1fa3,_0x44758d);};}function removeListener(_0x5705ef,_0xc721e8){return function(){WhatsappQueueEvents[_0xdb37('0x3')](_0x5705ef,_0xc721e8);};}exports[_0xdb37('0x4')]=function(_0x3844d4){for(var _0xed68bb=0x0,_0x4eb86c=events['length'];_0xed68bb<_0x4eb86c;_0xed68bb++){var _0x50e036=events[_0xed68bb];var _0x176b34=createListener(_0xdb37('0x5')+_0x50e036,_0x3844d4);WhatsappQueueEvents['on'](_0x50e036,_0x176b34);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 1d12d4f..bb1d489 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 _0xd71f=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x45baf9,_0xff685f){var _0x53f518=function(_0x16dced){while(--_0x16dced){_0x45baf9['push'](_0x45baf9['shift']());}};_0x53f518(++_0xff685f);}(_0xd71f,0xcb));var _0xfd71=function(_0x9a050f,_0x179ae1){_0x9a050f=_0x9a050f-0x0;var _0xa14fe7=_0xd71f[_0x9a050f];return _0xa14fe7;};'use strict';var multer=require(_0xfd71('0x0'));var util=require(_0xfd71('0x1'));var path=require(_0xfd71('0x2'));var timeout=require(_0xfd71('0x3'));var express=require(_0xfd71('0x4'));var router=express[_0xfd71('0x5')]();var auth=require(_0xfd71('0x6'));var interaction=require(_0xfd71('0x7'));var config=require(_0xfd71('0x8'));var controller=require(_0xfd71('0x9'));router[_0xfd71('0xa')]('/',auth[_0xfd71('0xb')](),controller[_0xfd71('0xc')]);router['get'](_0xfd71('0xd'),auth['isAuthenticated'](),controller[_0xfd71('0xe')]);router[_0xfd71('0xa')](_0xfd71('0xf'),auth[_0xfd71('0xb')](),controller['show']);router[_0xfd71('0x10')]('/',auth[_0xfd71('0xb')](),controller[_0xfd71('0x11')]);router[_0xfd71('0x12')](_0xfd71('0xf'),auth[_0xfd71('0xb')](),controller['update']);router[_0xfd71('0x13')](_0xfd71('0xf'),auth['isAuthenticated'](),controller[_0xfd71('0x14')]);module[_0xfd71('0x15')]=router; \ No newline at end of file +var _0xa8f3=['create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post'];(function(_0x1aafc6,_0x1cbc22){var _0x24aecb=function(_0x31e4dc){while(--_0x31e4dc){_0x1aafc6['push'](_0x1aafc6['shift']());}};_0x24aecb(++_0x1cbc22);}(_0xa8f3,0xc1));var _0x3a8f=function(_0x5149cf,_0x4956d4){_0x5149cf=_0x5149cf-0x0;var _0xff300f=_0xa8f3[_0x5149cf];return _0xff300f;};'use strict';var multer=require(_0x3a8f('0x0'));var util=require(_0x3a8f('0x1'));var path=require(_0x3a8f('0x2'));var timeout=require(_0x3a8f('0x3'));var express=require(_0x3a8f('0x4'));var router=express[_0x3a8f('0x5')]();var auth=require(_0x3a8f('0x6'));var interaction=require(_0x3a8f('0x7'));var config=require(_0x3a8f('0x8'));var controller=require(_0x3a8f('0x9'));router[_0x3a8f('0xa')]('/',auth[_0x3a8f('0xb')](),controller[_0x3a8f('0xc')]);router[_0x3a8f('0xa')](_0x3a8f('0xd'),auth[_0x3a8f('0xb')](),controller['describe']);router[_0x3a8f('0xa')](_0x3a8f('0xe'),auth[_0x3a8f('0xb')](),controller[_0x3a8f('0xf')]);router[_0x3a8f('0x10')]('/',auth[_0x3a8f('0xb')](),controller[_0x3a8f('0x11')]);router[_0x3a8f('0x12')](_0x3a8f('0xe'),auth[_0x3a8f('0xb')](),controller['update']);router[_0x3a8f('0x13')]('/:id',auth[_0x3a8f('0xb')](),controller['destroy']);module[_0x3a8f('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 595092f..1df5af9 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 _0x7fbe=['STRING','DATE'];(function(_0x5779a4,_0x4d085c){var _0xe2e128=function(_0x47734e){while(--_0x47734e){_0x5779a4['push'](_0x5779a4['shift']());}};_0xe2e128(++_0x4d085c);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x1ccd8a,_0x5bf417){_0x1ccd8a=_0x1ccd8a-0x0;var _0x5a69d8=_0x7fbe[_0x1ccd8a];return _0x5a69d8;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0xe7fb('0x0')]},'joinAt':{'type':Sequelize[_0xe7fb('0x1')]},'leaveAt':{'type':Sequelize[_0xe7fb('0x1')]},'acceptAt':{'type':Sequelize[_0xe7fb('0x1')]},'exitAt':{'type':Sequelize[_0xe7fb('0x1')]},'reason':{'type':Sequelize[_0xe7fb('0x0')]}}; \ No newline at end of file +var _0x3e74=['DATE','sequelize','STRING'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x3e74,0x175));var _0x43e7=function(_0x506c26,_0x1492da){_0x506c26=_0x506c26-0x0;var _0x307728=_0x3e74[_0x506c26];return _0x307728;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x43e7('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x43e7('0x1')]},'joinAt':{'type':Sequelize[_0x43e7('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x43e7('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 48b2de5..03df49e 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 _0x0a1c=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','error','name','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','pick','filters','where','merge','type','filter','options','then','includeAll','findAll','rows','show','params','include','find','create','catch','body','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x52f983,_0x208c78){var _0x3429ba=function(_0x369e4f){while(--_0x369e4f){_0x52f983['push'](_0x52f983['shift']());}};_0x3429ba(++_0x208c78);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0x0a1c[_0x30cc1a];return _0xb3f18f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc0a1('0x0'));var zipdir=require(_0xc0a1('0x1'));var jsonpatch=require(_0xc0a1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc0a1('0x3'));var Mustache=require(_0xc0a1('0x4'));var util=require(_0xc0a1('0x5'));var path=require(_0xc0a1('0x6'));var sox=require(_0xc0a1('0x7'));var csv=require(_0xc0a1('0x8'));var ejs=require(_0xc0a1('0x9'));var fs=require('fs');var _=require(_0xc0a1('0xa'));var squel=require(_0xc0a1('0xb'));var crypto=require(_0xc0a1('0xc'));var jsforce=require(_0xc0a1('0xd'));var deskjs=require(_0xc0a1('0xe'));var toCsv=require(_0xc0a1('0x8'));var querystring=require(_0xc0a1('0xf'));var Papa=require(_0xc0a1('0x10'));var Redis=require(_0xc0a1('0x11'));var authService=require(_0xc0a1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc0a1('0x13'));var hardwareService=require(_0xc0a1('0x14'));var logger=require(_0xc0a1('0x15'))('api');var utils=require(_0xc0a1('0x16'));var config=require(_0xc0a1('0x17'));var db=require(_0xc0a1('0x18'))['db'];function respondWithStatusCode(_0x4d9b49,_0x1565f4){_0x1565f4=_0x1565f4||0xcc;return function(_0x138338){if(_0x138338){return _0x4d9b49['sendStatus'](_0x1565f4);}return _0x4d9b49[_0xc0a1('0x19')](_0x1565f4)[_0xc0a1('0x1a')]();};}function respondWithResult(_0x34a9e8,_0x395ade){_0x395ade=_0x395ade||0xc8;return function(_0x32c3b9){if(_0x32c3b9){return _0x34a9e8['status'](_0x395ade)['json'](_0x32c3b9);}};}function respondWithFilteredResult(_0x19873d,_0x3f5ce8){return function(_0x49a97c){if(_0x49a97c){var _0x5a3e1d=_0x49a97c[_0xc0a1('0x1b')],_0x8aa354=_0x3f5ce8[_0xc0a1('0x1c')],_0x38170d=_0x3f5ce8[_0xc0a1('0x1c')]+_0x3f5ce8[_0xc0a1('0x1d')],_0x587c1e;if(_0x38170d>=_0x5a3e1d){_0x38170d=_0x5a3e1d;_0x587c1e=0xc8;}else{_0x587c1e=0xce;}_0x19873d[_0xc0a1('0x19')](_0x587c1e);return _0x19873d[_0xc0a1('0x1e')](_0xc0a1('0x1f'),_0x8aa354+'-'+_0x38170d+'/'+_0x5a3e1d)[_0xc0a1('0x20')](_0x49a97c);}return null;};}function patchUpdates(_0x26a827){return function(_0x36acc2){try{jsonpatch[_0xc0a1('0x21')](_0x36acc2,_0x26a827,!![]);}catch(_0x26ca3c){return BPromise[_0xc0a1('0x22')](_0x26ca3c);}return _0x36acc2[_0xc0a1('0x23')]();};}function saveUpdates(_0xd691c0,_0x3e8940){return function(_0x563987){if(_0x563987){return _0x563987[_0xc0a1('0x24')](_0xd691c0)['then'](function(_0x340d03){return _0x340d03;});}return null;};}function removeEntity(_0xc9d7b0,_0x19e24b){return function(_0x316f1a){if(_0x316f1a){return _0x316f1a[_0xc0a1('0x25')]()['then'](function(){_0xc9d7b0[_0xc0a1('0x19')](0xcc)[_0xc0a1('0x1a')]();});}};}function handleEntityNotFound(_0x247179,_0x3e7997){return function(_0xb78441){if(!_0xb78441){_0x247179[_0xc0a1('0x26')](0x194);}return _0xb78441;};}function handleError(_0x273fa6,_0x6b1ca5){_0x6b1ca5=_0x6b1ca5||0x1f4;return function(_0x3e1a93){logger[_0xc0a1('0x27')](_0x3e1a93['stack']);if(_0x3e1a93['name']){delete _0x3e1a93[_0xc0a1('0x28')];}_0x273fa6[_0xc0a1('0x19')](_0x6b1ca5)['send'](_0x3e1a93);};}exports['index']=function(_0x240605,_0x9fc1d3){var _0x4a5c37={},_0x203ab8={},_0x95b026={'count':0x0,'rows':[]};var _0x10dcd9=_[_0xc0a1('0x29')](db[_0xc0a1('0x2a')][_0xc0a1('0x2b')],function(_0x114f76){return{'name':_0x114f76[_0xc0a1('0x2c')],'type':_0x114f76['type'][_0xc0a1('0x2d')]};});_0x203ab8[_0xc0a1('0x2e')]=_[_0xc0a1('0x29')](_0x10dcd9,_0xc0a1('0x28'));_0x203ab8[_0xc0a1('0x2f')]=_[_0xc0a1('0x30')](_0x240605['query']);_0x203ab8['filters']=_[_0xc0a1('0x31')](_0x203ab8[_0xc0a1('0x2e')],_0x203ab8['query']);_0x4a5c37[_0xc0a1('0x32')]=_['intersection'](_0x203ab8[_0xc0a1('0x2e')],qs['fields'](_0x240605[_0xc0a1('0x2f')][_0xc0a1('0x33')]));_0x4a5c37[_0xc0a1('0x32')]=_0x4a5c37['attributes'][_0xc0a1('0x34')]?_0x4a5c37['attributes']:_0x203ab8[_0xc0a1('0x2e')];if(!_0x240605[_0xc0a1('0x2f')]['hasOwnProperty'](_0xc0a1('0x35'))){_0x4a5c37[_0xc0a1('0x1d')]=qs[_0xc0a1('0x1d')](_0x240605[_0xc0a1('0x2f')][_0xc0a1('0x1d')]);_0x4a5c37[_0xc0a1('0x1c')]=qs['offset'](_0x240605[_0xc0a1('0x2f')][_0xc0a1('0x1c')]);}_0x4a5c37[_0xc0a1('0x36')]=qs[_0xc0a1('0x37')](_0x240605[_0xc0a1('0x2f')][_0xc0a1('0x37')]);_0x4a5c37['where']=qs['filters'](_[_0xc0a1('0x38')](_0x240605[_0xc0a1('0x2f')],_0x203ab8[_0xc0a1('0x39')]),_0x10dcd9);if(_0x240605['query']['filter']){_0x4a5c37[_0xc0a1('0x3a')]=_[_0xc0a1('0x3b')](_0x4a5c37[_0xc0a1('0x3a')],{'$or':_['map'](_0x10dcd9,function(_0xc80b){if(_0xc80b[_0xc0a1('0x3c')]!=='VIRTUAL'){var _0x2cbeaa={};_0x2cbeaa[_0xc80b[_0xc0a1('0x28')]]={'$like':'%'+_0x240605['query'][_0xc0a1('0x3d')]+'%'};return _0x2cbeaa;}})});}_0x4a5c37=_[_0xc0a1('0x3b')]({},_0x4a5c37,_0x240605[_0xc0a1('0x3e')]);var _0x2b0f37={'where':_0x4a5c37[_0xc0a1('0x3a')]};return db[_0xc0a1('0x2a')][_0xc0a1('0x1b')](_0x2b0f37)[_0xc0a1('0x3f')](function(_0x59fd71){_0x95b026['count']=_0x59fd71;if(_0x240605[_0xc0a1('0x2f')][_0xc0a1('0x40')]){_0x4a5c37['include']=[{'all':!![]}];}return db[_0xc0a1('0x2a')][_0xc0a1('0x41')](_0x4a5c37);})[_0xc0a1('0x3f')](function(_0x7416dd){_0x95b026[_0xc0a1('0x42')]=_0x7416dd;return _0x95b026;})[_0xc0a1('0x3f')](respondWithFilteredResult(_0x9fc1d3,_0x4a5c37))['catch'](handleError(_0x9fc1d3,null));};exports[_0xc0a1('0x43')]=function(_0x903fbe,_0x4ddc9b){var _0x289501={'raw':!![],'where':{'id':_0x903fbe[_0xc0a1('0x44')]['id']}},_0x39a8d8={};_0x39a8d8[_0xc0a1('0x2e')]=_[_0xc0a1('0x30')](db[_0xc0a1('0x2a')][_0xc0a1('0x2b')]);_0x39a8d8['query']=_['keys'](_0x903fbe[_0xc0a1('0x2f')]);_0x39a8d8['filters']=_[_0xc0a1('0x31')](_0x39a8d8['model'],_0x39a8d8['query']);_0x289501[_0xc0a1('0x32')]=_[_0xc0a1('0x31')](_0x39a8d8[_0xc0a1('0x2e')],qs[_0xc0a1('0x33')](_0x903fbe[_0xc0a1('0x2f')][_0xc0a1('0x33')]));_0x289501[_0xc0a1('0x32')]=_0x289501[_0xc0a1('0x32')][_0xc0a1('0x34')]?_0x289501[_0xc0a1('0x32')]:_0x39a8d8[_0xc0a1('0x2e')];if(_0x903fbe[_0xc0a1('0x2f')][_0xc0a1('0x40')]){_0x289501[_0xc0a1('0x45')]=[{'all':!![]}];}_0x289501=_[_0xc0a1('0x3b')]({},_0x289501,_0x903fbe[_0xc0a1('0x3e')]);return db['WhatsappQueueReport'][_0xc0a1('0x46')](_0x289501)[_0xc0a1('0x3f')](handleEntityNotFound(_0x4ddc9b,null))['then'](respondWithResult(_0x4ddc9b,null))['catch'](handleError(_0x4ddc9b,null));};exports[_0xc0a1('0x47')]=function(_0x581818,_0xbac6ae){return db[_0xc0a1('0x2a')][_0xc0a1('0x47')](_0x581818['body'],{})[_0xc0a1('0x3f')](respondWithResult(_0xbac6ae,0xc9))[_0xc0a1('0x48')](handleError(_0xbac6ae,null));};exports['update']=function(_0x934f6d,_0x45c24e){if(_0x934f6d['body']['id']){delete _0x934f6d['body']['id'];}return db[_0xc0a1('0x2a')][_0xc0a1('0x46')]({'where':{'id':_0x934f6d['params']['id']}})[_0xc0a1('0x3f')](handleEntityNotFound(_0x45c24e,null))[_0xc0a1('0x3f')](saveUpdates(_0x934f6d[_0xc0a1('0x49')],null))[_0xc0a1('0x3f')](respondWithResult(_0x45c24e,null))['catch'](handleError(_0x45c24e,null));};exports['destroy']=function(_0x3fbdae,_0x56498f){return db[_0xc0a1('0x2a')]['find']({'where':{'id':_0x3fbdae[_0xc0a1('0x44')]['id']}})['then'](handleEntityNotFound(_0x56498f,null))[_0xc0a1('0x3f')](removeEntity(_0x56498f,null))[_0xc0a1('0x48')](handleError(_0x56498f,null));};exports['describe']=function(_0x29ae1f,_0x3b1b3d){return db[_0xc0a1('0x2a')][_0xc0a1('0x4a')]()[_0xc0a1('0x3f')](respondWithResult(_0x3b1b3d,null))['catch'](handleError(_0x3b1b3d,null));}; \ No newline at end of file +var _0x7c71=['filters','filter','merge','VIRTUAL','options','include','findAll','rows','params','keys','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick'];(function(_0x40d5a5,_0x18306d){var _0x46f3bd=function(_0x406fba){while(--_0x406fba){_0x40d5a5['push'](_0x40d5a5['shift']());}};_0x46f3bd(++_0x18306d);}(_0x7c71,0x177));var _0x17c7=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0x7c71[_0x3bef2c];return _0x331503;};'use strict';var pdf=require(_0x17c7('0x0'));var emlformat=require(_0x17c7('0x1'));var rimraf=require(_0x17c7('0x2'));var zipdir=require(_0x17c7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x17c7('0x4'));var moment=require(_0x17c7('0x5'));var BPromise=require(_0x17c7('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x17c7('0x7'));var sox=require(_0x17c7('0x8'));var csv=require(_0x17c7('0x9'));var ejs=require(_0x17c7('0xa'));var fs=require('fs');var _=require(_0x17c7('0xb'));var squel=require(_0x17c7('0xc'));var crypto=require(_0x17c7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x17c7('0xe'));var toCsv=require(_0x17c7('0x9'));var querystring=require(_0x17c7('0xf'));var Papa=require(_0x17c7('0x10'));var Redis=require(_0x17c7('0x11'));var authService=require(_0x17c7('0x12'));var qs=require(_0x17c7('0x13'));var as=require(_0x17c7('0x14'));var hardwareService=require(_0x17c7('0x15'));var logger=require(_0x17c7('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x17c7('0x17'));var db=require(_0x17c7('0x18'))['db'];function respondWithStatusCode(_0x501d58,_0x430506){_0x430506=_0x430506||0xcc;return function(_0x22ad50){if(_0x22ad50){return _0x501d58['sendStatus'](_0x430506);}return _0x501d58[_0x17c7('0x19')](_0x430506)[_0x17c7('0x1a')]();};}function respondWithResult(_0x48be80,_0x56ef3b){_0x56ef3b=_0x56ef3b||0xc8;return function(_0xfae300){if(_0xfae300){return _0x48be80[_0x17c7('0x19')](_0x56ef3b)[_0x17c7('0x1b')](_0xfae300);}};}function respondWithFilteredResult(_0x19e219,_0x3d0fb2){return function(_0x2851){if(_0x2851){var _0x2c992f=_0x2851[_0x17c7('0x1c')],_0x295168=_0x3d0fb2[_0x17c7('0x1d')],_0xa06e65=_0x3d0fb2['offset']+_0x3d0fb2[_0x17c7('0x1e')],_0x30bb1d;if(_0xa06e65>=_0x2c992f){_0xa06e65=_0x2c992f;_0x30bb1d=0xc8;}else{_0x30bb1d=0xce;}_0x19e219[_0x17c7('0x19')](_0x30bb1d);return _0x19e219['set'](_0x17c7('0x1f'),_0x295168+'-'+_0xa06e65+'/'+_0x2c992f)[_0x17c7('0x1b')](_0x2851);}return null;};}function patchUpdates(_0x2c652c){return function(_0xded8ca){try{jsonpatch['apply'](_0xded8ca,_0x2c652c,!![]);}catch(_0x593c85){return BPromise[_0x17c7('0x20')](_0x593c85);}return _0xded8ca[_0x17c7('0x21')]();};}function saveUpdates(_0x13b756,_0x86956b){return function(_0x2579b7){if(_0x2579b7){return _0x2579b7[_0x17c7('0x22')](_0x13b756)[_0x17c7('0x23')](function(_0x5d324c){return _0x5d324c;});}return null;};}function removeEntity(_0x1e511e,_0x3885c8){return function(_0x3c25ba){if(_0x3c25ba){return _0x3c25ba[_0x17c7('0x24')]()[_0x17c7('0x23')](function(){_0x1e511e[_0x17c7('0x19')](0xcc)[_0x17c7('0x1a')]();});}};}function handleEntityNotFound(_0x196e0e,_0x512c3c){return function(_0x312373){if(!_0x312373){_0x196e0e[_0x17c7('0x25')](0x194);}return _0x312373;};}function handleError(_0x26e280,_0x4e1316){_0x4e1316=_0x4e1316||0x1f4;return function(_0x35c4c7){logger[_0x17c7('0x26')](_0x35c4c7['stack']);if(_0x35c4c7[_0x17c7('0x27')]){delete _0x35c4c7[_0x17c7('0x27')];}_0x26e280['status'](_0x4e1316)[_0x17c7('0x28')](_0x35c4c7);};}exports['index']=function(_0x463ff2,_0x2e2c7a){var _0x4a61f4={},_0x42b7f2={},_0x7ecd2b={'count':0x0,'rows':[]};var _0x29dc53=_[_0x17c7('0x29')](db[_0x17c7('0x2a')][_0x17c7('0x2b')],function(_0x3ca9d3){return{'name':_0x3ca9d3[_0x17c7('0x2c')],'type':_0x3ca9d3[_0x17c7('0x2d')][_0x17c7('0x2e')]};});_0x42b7f2[_0x17c7('0x2f')]=_[_0x17c7('0x29')](_0x29dc53,_0x17c7('0x27'));_0x42b7f2[_0x17c7('0x30')]=_['keys'](_0x463ff2[_0x17c7('0x30')]);_0x42b7f2['filters']=_[_0x17c7('0x31')](_0x42b7f2[_0x17c7('0x2f')],_0x42b7f2[_0x17c7('0x30')]);_0x4a61f4[_0x17c7('0x32')]=_[_0x17c7('0x31')](_0x42b7f2['model'],qs['fields'](_0x463ff2[_0x17c7('0x30')][_0x17c7('0x33')]));_0x4a61f4[_0x17c7('0x32')]=_0x4a61f4[_0x17c7('0x32')][_0x17c7('0x34')]?_0x4a61f4[_0x17c7('0x32')]:_0x42b7f2[_0x17c7('0x2f')];if(!_0x463ff2[_0x17c7('0x30')][_0x17c7('0x35')]('nolimit')){_0x4a61f4[_0x17c7('0x1e')]=qs[_0x17c7('0x1e')](_0x463ff2[_0x17c7('0x30')]['limit']);_0x4a61f4[_0x17c7('0x1d')]=qs[_0x17c7('0x1d')](_0x463ff2[_0x17c7('0x30')][_0x17c7('0x1d')]);}_0x4a61f4[_0x17c7('0x36')]=qs[_0x17c7('0x37')](_0x463ff2[_0x17c7('0x30')]['sort']);_0x4a61f4['where']=qs['filters'](_[_0x17c7('0x38')](_0x463ff2['query'],_0x42b7f2[_0x17c7('0x39')]),_0x29dc53);if(_0x463ff2[_0x17c7('0x30')][_0x17c7('0x3a')]){_0x4a61f4['where']=_[_0x17c7('0x3b')](_0x4a61f4['where'],{'$or':_['map'](_0x29dc53,function(_0x270b9a){if(_0x270b9a[_0x17c7('0x2d')]!==_0x17c7('0x3c')){var _0x2b8023={};_0x2b8023[_0x270b9a[_0x17c7('0x27')]]={'$like':'%'+_0x463ff2[_0x17c7('0x30')][_0x17c7('0x3a')]+'%'};return _0x2b8023;}})});}_0x4a61f4=_[_0x17c7('0x3b')]({},_0x4a61f4,_0x463ff2[_0x17c7('0x3d')]);var _0x1bcf03={'where':_0x4a61f4['where']};return db[_0x17c7('0x2a')][_0x17c7('0x1c')](_0x1bcf03)[_0x17c7('0x23')](function(_0x42c4d5){_0x7ecd2b[_0x17c7('0x1c')]=_0x42c4d5;if(_0x463ff2[_0x17c7('0x30')]['includeAll']){_0x4a61f4[_0x17c7('0x3e')]=[{'all':!![]}];}return db[_0x17c7('0x2a')][_0x17c7('0x3f')](_0x4a61f4);})[_0x17c7('0x23')](function(_0x227441){_0x7ecd2b[_0x17c7('0x40')]=_0x227441;return _0x7ecd2b;})[_0x17c7('0x23')](respondWithFilteredResult(_0x2e2c7a,_0x4a61f4))['catch'](handleError(_0x2e2c7a,null));};exports['show']=function(_0x8d769c,_0x1474ab){var _0xef91f1={'raw':!![],'where':{'id':_0x8d769c[_0x17c7('0x41')]['id']}},_0x31234a={};_0x31234a['model']=_[_0x17c7('0x42')](db[_0x17c7('0x2a')]['rawAttributes']);_0x31234a[_0x17c7('0x30')]=_[_0x17c7('0x42')](_0x8d769c['query']);_0x31234a[_0x17c7('0x39')]=_[_0x17c7('0x31')](_0x31234a[_0x17c7('0x2f')],_0x31234a['query']);_0xef91f1['attributes']=_[_0x17c7('0x31')](_0x31234a[_0x17c7('0x2f')],qs[_0x17c7('0x33')](_0x8d769c['query'][_0x17c7('0x33')]));_0xef91f1['attributes']=_0xef91f1[_0x17c7('0x32')]['length']?_0xef91f1[_0x17c7('0x32')]:_0x31234a[_0x17c7('0x2f')];if(_0x8d769c[_0x17c7('0x30')]['includeAll']){_0xef91f1[_0x17c7('0x3e')]=[{'all':!![]}];}_0xef91f1=_[_0x17c7('0x3b')]({},_0xef91f1,_0x8d769c[_0x17c7('0x3d')]);return db[_0x17c7('0x2a')][_0x17c7('0x43')](_0xef91f1)[_0x17c7('0x23')](handleEntityNotFound(_0x1474ab,null))[_0x17c7('0x23')](respondWithResult(_0x1474ab,null))[_0x17c7('0x44')](handleError(_0x1474ab,null));};exports[_0x17c7('0x45')]=function(_0x178da6,_0x4ee720){return db[_0x17c7('0x2a')]['create'](_0x178da6[_0x17c7('0x46')],{})['then'](respondWithResult(_0x4ee720,0xc9))[_0x17c7('0x44')](handleError(_0x4ee720,null));};exports['update']=function(_0x3b2e65,_0x39a616){if(_0x3b2e65['body']['id']){delete _0x3b2e65['body']['id'];}return db[_0x17c7('0x2a')][_0x17c7('0x43')]({'where':{'id':_0x3b2e65[_0x17c7('0x41')]['id']}})[_0x17c7('0x23')](handleEntityNotFound(_0x39a616,null))[_0x17c7('0x23')](saveUpdates(_0x3b2e65[_0x17c7('0x46')],null))[_0x17c7('0x23')](respondWithResult(_0x39a616,null))[_0x17c7('0x44')](handleError(_0x39a616,null));};exports['destroy']=function(_0x192b3f,_0x15276f){return db[_0x17c7('0x2a')][_0x17c7('0x43')]({'where':{'id':_0x192b3f[_0x17c7('0x41')]['id']}})[_0x17c7('0x23')](handleEntityNotFound(_0x15276f,null))[_0x17c7('0x23')](removeEntity(_0x15276f,null))['catch'](handleError(_0x15276f,null));};exports[_0x17c7('0x47')]=function(_0xc2a4ce,_0x4ef661){return db[_0x17c7('0x2a')]['describe']()[_0x17c7('0x23')](respondWithResult(_0x4ef661,null))[_0x17c7('0x44')](handleError(_0x4ef661,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 0c8b299..d634e98 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 _0xb1f0=['bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','uniqueid','api','moment'];(function(_0x2b42e3,_0x42a9d9){var _0x3b88d3=function(_0x2bdf99){while(--_0x2bdf99){_0x2b42e3['push'](_0x2b42e3['shift']());}};_0x3b88d3(++_0x42a9d9);}(_0xb1f0,0x1de));var _0x0b1f=function(_0x553688,_0x542f15){_0x553688=_0x553688-0x0;var _0x43e262=_0xb1f0[_0x553688];return _0x43e262;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0b1f('0x0'));var moment=require(_0x0b1f('0x1'));var BPromise=require(_0x0b1f('0x2'));var rp=require(_0x0b1f('0x3'));var fs=require('fs');var path=require(_0x0b1f('0x4'));var rimraf=require('rimraf');var config=require(_0x0b1f('0x5'));var attributes=require(_0x0b1f('0x6'));module['exports']=function(_0x53687a,_0x22bf5c){return _0x53687a[_0x0b1f('0x7')](_0x0b1f('0x8'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x0b1f('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x78b9=['report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport'];(function(_0x43c395,_0x2fc352){var _0x4dd55c=function(_0x7a82ca){while(--_0x7a82ca){_0x43c395['push'](_0x43c395['shift']());}};_0x4dd55c(++_0x2fc352);}(_0x78b9,0x1ec));var _0x978b=function(_0x57638e,_0x3d9525){_0x57638e=_0x57638e-0x0;var _0x105991=_0x78b9[_0x57638e];return _0x105991;};'use strict';var _=require(_0x978b('0x0'));var util=require(_0x978b('0x1'));var logger=require(_0x978b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x978b('0x3'));var rp=require(_0x978b('0x4'));var fs=require('fs');var path=require(_0x978b('0x5'));var rimraf=require(_0x978b('0x6'));var config=require(_0x978b('0x7'));var attributes=require(_0x978b('0x8'));module[_0x978b('0x9')]=function(_0x44f870,_0x20b267){return _0x44f870[_0x978b('0xa')](_0x978b('0xb'),attributes,{'tableName':_0x978b('0xc'),'paranoid':![],'indexes':[{'name':_0x978b('0xd'),'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 938cbd6..75ba062 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 _0x4000=['debug','stringify','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport'];(function(_0x5a1dd9,_0x1ab14e){var _0x147565=function(_0x3c9825){while(--_0x3c9825){_0x5a1dd9['push'](_0x5a1dd9['shift']());}};_0x147565(++_0x1ab14e);}(_0x4000,0x1c1));var _0x0400=function(_0x2b0abc,_0x4396ab){_0x2b0abc=_0x2b0abc-0x0;var _0x1f6d61=_0x4000[_0x2b0abc];return _0x1f6d61;};'use strict';var _=require(_0x0400('0x0'));var util=require(_0x0400('0x1'));var moment=require('moment');var BPromise=require(_0x0400('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0400('0x3'));var db=require(_0x0400('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0400('0x5'))(_0x0400('0x6'));var config=require(_0x0400('0x7'));var jayson=require(_0x0400('0x8'));var client=jayson[_0x0400('0x9')][_0x0400('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x398602,_0x38c819,_0x3b0c0c){return new BPromise(function(_0xcc025b,_0x10bef9){return client[_0x0400('0xb')](_0x398602,_0x3b0c0c)[_0x0400('0xc')](function(_0x4e55c1){logger[_0x0400('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x38c819,_0x0400('0xe'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x38c819,_0x0400('0xe'),JSON['stringify'](_0x4e55c1));if(_0x4e55c1[_0x0400('0xf')]){if(_0x4e55c1[_0x0400('0xf')][_0x0400('0x10')]===0x1f4){logger[_0x0400('0xf')](_0x0400('0x11'),_0x38c819,_0x4e55c1[_0x0400('0xf')]['message']);return _0x10bef9(_0x4e55c1[_0x0400('0xf')][_0x0400('0x12')]);}logger[_0x0400('0xf')](_0x0400('0x11'),_0x38c819,_0x4e55c1['error']['message']);return _0xcc025b(_0x4e55c1['error']['message']);}else{logger[_0x0400('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x38c819,_0x0400('0xe'));_0xcc025b(_0x4e55c1[_0x0400('0x13')][_0x0400('0x12')]);}})[_0x0400('0x14')](function(_0x1fcaa5){logger[_0x0400('0xf')](_0x0400('0x11'),_0x38c819,_0x1fcaa5);_0x10bef9(_0x1fcaa5);});});}exports['CreateWhatsappQueueReport']=function(_0x456455){var _0x5ddeb6=this;return new Promise(function(_0x5e926a,_0x1b0a86){return db[_0x0400('0x15')][_0x0400('0x16')](_0x456455[_0x0400('0x17')],{'raw':_0x456455[_0x0400('0x18')]?_0x456455[_0x0400('0x18')][_0x0400('0x19')]===undefined?!![]:![]:!![]})[_0x0400('0xc')](function(_0x2004ef){logger['info'](_0x0400('0x1a'),_0x456455);logger[_0x0400('0x1b')]('CreateWhatsappQueueReport',_0x456455,JSON[_0x0400('0x1c')](_0x2004ef));_0x5e926a(_0x2004ef);})[_0x0400('0x14')](function(_0x3e186b){logger[_0x0400('0xf')](_0x0400('0x1a'),_0x3e186b[_0x0400('0x12')],_0x456455);_0x1b0a86(_0x5ddeb6[_0x0400('0xf')](0x1f4,_0x3e186b['message']));});});};exports[_0x0400('0x1d')]=function(_0x4d818b){var _0x6e7f7f=this;return new Promise(function(_0x1e1006,_0x42a958){return db[_0x0400('0x15')][_0x0400('0x1e')](_0x4d818b[_0x0400('0x17')],{'raw':_0x4d818b[_0x0400('0x18')]?_0x4d818b['options'][_0x0400('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d818b[_0x0400('0x18')]?_0x4d818b['options'][_0x0400('0x1f')]||null:null,'attributes':_0x4d818b[_0x0400('0x18')]?_0x4d818b[_0x0400('0x18')][_0x0400('0x20')]||null:null,'limit':_0x4d818b[_0x0400('0x18')]?_0x4d818b[_0x0400('0x18')][_0x0400('0x21')]||null:null})[_0x0400('0xc')](function(_0x42d87d){logger[_0x0400('0xd')](_0x0400('0x1d'),_0x4d818b);logger[_0x0400('0x1b')](_0x0400('0x1d'),_0x4d818b,JSON[_0x0400('0x1c')](_0x42d87d));_0x1e1006(_0x42d87d);})[_0x0400('0x14')](function(_0x3ca7cb){logger['error'](_0x0400('0x1d'),_0x3ca7cb[_0x0400('0x12')],_0x4d818b);_0x42a958(_0x6e7f7f[_0x0400('0xf')](0x1f4,_0x3ca7cb[_0x0400('0x12')]));});});}; \ No newline at end of file +var _0xcb3f=['raw','stringify','update','limit','info','UpdateWhatsappQueueReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options'];(function(_0x10c0e5,_0x1c2f36){var _0x245670=function(_0x480978){while(--_0x480978){_0x10c0e5['push'](_0x10c0e5['shift']());}};_0x245670(++_0x1c2f36);}(_0xcb3f,0xc0));var _0xfcb3=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xcb3f[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xfcb3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfcb3('0x1'));var rs=require(_0xfcb3('0x2'));var fs=require('fs');var Redis=require(_0xfcb3('0x3'));var db=require(_0xfcb3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfcb3('0x5'));var config=require(_0xfcb3('0x6'));var jayson=require(_0xfcb3('0x7'));var client=jayson[_0xfcb3('0x8')][_0xfcb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37176e,_0x444af8,_0x38bcac){return new BPromise(function(_0x57deca,_0x3a2d83){return client[_0xfcb3('0xa')](_0x37176e,_0x38bcac)[_0xfcb3('0xb')](function(_0x41743e){logger['info'](_0xfcb3('0xc'),_0x444af8,'request\x20sent');logger[_0xfcb3('0xd')](_0xfcb3('0xe'),_0x444af8,_0xfcb3('0xf'),JSON['stringify'](_0x41743e));if(_0x41743e[_0xfcb3('0x10')]){if(_0x41743e[_0xfcb3('0x10')]['code']===0x1f4){logger[_0xfcb3('0x10')](_0xfcb3('0xc'),_0x444af8,_0x41743e[_0xfcb3('0x10')][_0xfcb3('0x11')]);return _0x3a2d83(_0x41743e[_0xfcb3('0x10')][_0xfcb3('0x11')]);}logger[_0xfcb3('0x10')](_0xfcb3('0xc'),_0x444af8,_0x41743e['error'][_0xfcb3('0x11')]);return _0x57deca(_0x41743e[_0xfcb3('0x10')][_0xfcb3('0x11')]);}else{logger['info'](_0xfcb3('0xc'),_0x444af8,_0xfcb3('0xf'));_0x57deca(_0x41743e[_0xfcb3('0x12')][_0xfcb3('0x11')]);}})[_0xfcb3('0x13')](function(_0xb191b4){logger[_0xfcb3('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x444af8,_0xb191b4);_0x3a2d83(_0xb191b4);});});}exports[_0xfcb3('0x14')]=function(_0x47896e){var _0xcc4cdd=this;return new Promise(function(_0x48fe55,_0xd9d884){return db[_0xfcb3('0x15')][_0xfcb3('0x16')](_0x47896e[_0xfcb3('0x17')],{'raw':_0x47896e['options']?_0x47896e[_0xfcb3('0x18')][_0xfcb3('0x19')]===undefined?!![]:![]:!![]})[_0xfcb3('0xb')](function(_0x45c46f){logger['info']('CreateWhatsappQueueReport',_0x47896e);logger[_0xfcb3('0xd')](_0xfcb3('0x14'),_0x47896e,JSON[_0xfcb3('0x1a')](_0x45c46f));_0x48fe55(_0x45c46f);})['catch'](function(_0x390f96){logger[_0xfcb3('0x10')](_0xfcb3('0x14'),_0x390f96[_0xfcb3('0x11')],_0x47896e);_0xd9d884(_0xcc4cdd[_0xfcb3('0x10')](0x1f4,_0x390f96[_0xfcb3('0x11')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x543755){var _0x17e1c1=this;return new Promise(function(_0x46283f,_0x33d5b8){return db[_0xfcb3('0x15')][_0xfcb3('0x1b')](_0x543755[_0xfcb3('0x17')],{'raw':_0x543755['options']?_0x543755['options'][_0xfcb3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x543755['options']?_0x543755[_0xfcb3('0x18')]['where']||null:null,'attributes':_0x543755['options']?_0x543755[_0xfcb3('0x18')]['attributes']||null:null,'limit':_0x543755['options']?_0x543755[_0xfcb3('0x18')][_0xfcb3('0x1c')]||null:null})[_0xfcb3('0xb')](function(_0x5853d7){logger[_0xfcb3('0x1d')]('UpdateWhatsappQueueReport',_0x543755);logger[_0xfcb3('0xd')](_0xfcb3('0x1e'),_0x543755,JSON[_0xfcb3('0x1a')](_0x5853d7));_0x46283f(_0x5853d7);})['catch'](function(_0x20d87e){logger[_0xfcb3('0x10')](_0xfcb3('0x1e'),_0x20d87e[_0xfcb3('0x11')],_0x543755);_0x33d5b8(_0x17e1c1['error'](0x1f4,_0x20d87e[_0xfcb3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 19d5c23..2c41894 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 _0xf37f=['create','put','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x1bed48,_0x505c87){var _0x393163=function(_0x2ecd57){while(--_0x2ecd57){_0x1bed48['push'](_0x1bed48['shift']());}};_0x393163(++_0x505c87);}(_0xf37f,0xee));var _0xff37=function(_0x320c0c,_0x3f03bd){_0x320c0c=_0x320c0c-0x0;var _0x5a49bc=_0xf37f[_0x320c0c];return _0x5a49bc;};'use strict';var multer=require(_0xff37('0x0'));var util=require(_0xff37('0x1'));var path=require('path');var timeout=require(_0xff37('0x2'));var express=require('express');var router=express[_0xff37('0x3')]();var auth=require(_0xff37('0x4'));var interaction=require(_0xff37('0x5'));var config=require(_0xff37('0x6'));var controller=require(_0xff37('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xff37('0x8')](_0xff37('0x9'),auth[_0xff37('0xa')](),controller[_0xff37('0xb')]);router[_0xff37('0x8')](_0xff37('0xc'),auth['isAuthenticated'](),controller[_0xff37('0xd')]);router['post']('/',auth[_0xff37('0xa')](),controller[_0xff37('0xe')]);router[_0xff37('0xf')]('/:id',auth[_0xff37('0xa')](),controller['update']);router[_0xff37('0x10')](_0xff37('0xc'),auth[_0xff37('0xa')](),controller[_0xff37('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0b62=['../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x45b7be,_0x5b66ce){var _0x5cd24a=function(_0x26180a){while(--_0x26180a){_0x45b7be['push'](_0x45b7be['shift']());}};_0x5cd24a(++_0x5b66ce);}(_0x0b62,0x177));var _0x20b6=function(_0x4831d7,_0x8a88e8){_0x4831d7=_0x4831d7-0x0;var _0x5f0e7d=_0x0b62[_0x4831d7];return _0x5f0e7d;};'use strict';var multer=require(_0x20b6('0x0'));var util=require(_0x20b6('0x1'));var path=require('path');var timeout=require(_0x20b6('0x2'));var express=require('express');var router=express[_0x20b6('0x3')]();var auth=require(_0x20b6('0x4'));var interaction=require(_0x20b6('0x5'));var config=require(_0x20b6('0x6'));var controller=require(_0x20b6('0x7'));router[_0x20b6('0x8')]('/',auth['isAuthenticated'](),controller[_0x20b6('0x9')]);router[_0x20b6('0x8')](_0x20b6('0xa'),auth[_0x20b6('0xb')](),controller[_0x20b6('0xc')]);router[_0x20b6('0x8')](_0x20b6('0xd'),auth[_0x20b6('0xb')](),controller[_0x20b6('0xe')]);router['post']('/',auth[_0x20b6('0xb')](),controller['create']);router[_0x20b6('0xf')](_0x20b6('0xd'),auth[_0x20b6('0xb')](),controller[_0x20b6('0x10')]);router[_0x20b6('0x11')](_0x20b6('0xd'),auth[_0x20b6('0xb')](),controller[_0x20b6('0x12')]);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 eaca051..1d6fa50 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 _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file +var _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0b0e,0x187));var _0xe0b0=function(_0xf2f332,_0x299fbf){_0xf2f332=_0xf2f332-0x0;var _0x56cce3=_0x0b0e[_0xf2f332];return _0x56cce3;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 01cccde..d132369 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 _0x5cdb=['filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','query','keys'];(function(_0x14fc71,_0x48f7d2){var _0x14007e=function(_0x6fb593){while(--_0x6fb593){_0x14fc71['push'](_0x14fc71['shift']());}};_0x14007e(++_0x48f7d2);}(_0x5cdb,0x65));var _0xb5cd=function(_0x568a20,_0x32cce6){_0x568a20=_0x568a20-0x0;var _0x250611=_0x5cdb[_0x568a20];return _0x250611;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb5cd('0x0'));var jsonpatch=require(_0xb5cd('0x1'));var rp=require(_0xb5cd('0x2'));var moment=require(_0xb5cd('0x3'));var BPromise=require(_0xb5cd('0x4'));var Mustache=require(_0xb5cd('0x5'));var util=require('util');var path=require(_0xb5cd('0x6'));var sox=require(_0xb5cd('0x7'));var csv=require(_0xb5cd('0x8'));var ejs=require(_0xb5cd('0x9'));var fs=require('fs');var _=require(_0xb5cd('0xa'));var squel=require(_0xb5cd('0xb'));var crypto=require('crypto');var jsforce=require(_0xb5cd('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb5cd('0xd'));var Papa=require('papaparse');var Redis=require(_0xb5cd('0xe'));var authService=require(_0xb5cd('0xf'));var qs=require(_0xb5cd('0x10'));var as=require(_0xb5cd('0x11'));var hardwareService=require(_0xb5cd('0x12'));var logger=require(_0xb5cd('0x13'))(_0xb5cd('0x14'));var utils=require('../../config/utils');var config=require(_0xb5cd('0x15'));var db=require(_0xb5cd('0x16'))['db'];function respondWithStatusCode(_0x4a8003,_0x53d4b6){_0x53d4b6=_0x53d4b6||0xcc;return function(_0x14ca5f){if(_0x14ca5f){return _0x4a8003[_0xb5cd('0x17')](_0x53d4b6);}return _0x4a8003[_0xb5cd('0x18')](_0x53d4b6)[_0xb5cd('0x19')]();};}function respondWithResult(_0x38e7e6,_0x942089){_0x942089=_0x942089||0xc8;return function(_0x443dbd){if(_0x443dbd){return _0x38e7e6[_0xb5cd('0x18')](_0x942089)['json'](_0x443dbd);}};}function respondWithFilteredResult(_0x418713,_0x9f6515){return function(_0x4d5f02){if(_0x4d5f02){var _0x902c0=_0x4d5f02[_0xb5cd('0x1a')],_0x22d8f4=_0x9f6515[_0xb5cd('0x1b')],_0x2731bc=_0x9f6515['offset']+_0x9f6515[_0xb5cd('0x1c')],_0x45208a;if(_0x2731bc>=_0x902c0){_0x2731bc=_0x902c0;_0x45208a=0xc8;}else{_0x45208a=0xce;}_0x418713[_0xb5cd('0x18')](_0x45208a);return _0x418713[_0xb5cd('0x1d')]('Content-Range',_0x22d8f4+'-'+_0x2731bc+'/'+_0x902c0)[_0xb5cd('0x1e')](_0x4d5f02);}return null;};}function patchUpdates(_0x16ebf7){return function(_0x588e4e){try{jsonpatch['apply'](_0x588e4e,_0x16ebf7,!![]);}catch(_0x44134f){return BPromise[_0xb5cd('0x1f')](_0x44134f);}return _0x588e4e[_0xb5cd('0x20')]();};}function saveUpdates(_0xf2da8a,_0x4a6f59){return function(_0x43130b){if(_0x43130b){return _0x43130b[_0xb5cd('0x21')](_0xf2da8a)[_0xb5cd('0x22')](function(_0x7c9b7a){return _0x7c9b7a;});}return null;};}function removeEntity(_0x56c066,_0x50478c){return function(_0x5cd41e){if(_0x5cd41e){return _0x5cd41e[_0xb5cd('0x23')]()['then'](function(){_0x56c066[_0xb5cd('0x18')](0xcc)[_0xb5cd('0x19')]();});}};}function handleEntityNotFound(_0x108436,_0x54520a){return function(_0x40c95c){if(!_0x40c95c){_0x108436[_0xb5cd('0x17')](0x194);}return _0x40c95c;};}function handleError(_0x50b93c,_0x4a39d4){_0x4a39d4=_0x4a39d4||0x1f4;return function(_0xbafa3){logger[_0xb5cd('0x24')](_0xbafa3[_0xb5cd('0x25')]);if(_0xbafa3[_0xb5cd('0x26')]){delete _0xbafa3[_0xb5cd('0x26')];}_0x50b93c[_0xb5cd('0x18')](_0x4a39d4)[_0xb5cd('0x27')](_0xbafa3);};}exports[_0xb5cd('0x28')]=function(_0x15a94e,_0x20b0c9){var _0x21b2b7={},_0x267a78={},_0x493d6a={'count':0x0,'rows':[]};var _0x49ae43=_[_0xb5cd('0x29')](db[_0xb5cd('0x2a')]['rawAttributes'],function(_0x4749e9){return{'name':_0x4749e9[_0xb5cd('0x2b')],'type':_0x4749e9[_0xb5cd('0x2c')][_0xb5cd('0x2d')]};});_0x267a78[_0xb5cd('0x2e')]=_[_0xb5cd('0x29')](_0x49ae43,'name');_0x267a78[_0xb5cd('0x2f')]=_[_0xb5cd('0x30')](_0x15a94e[_0xb5cd('0x2f')]);_0x267a78[_0xb5cd('0x31')]=_[_0xb5cd('0x32')](_0x267a78[_0xb5cd('0x2e')],_0x267a78[_0xb5cd('0x2f')]);_0x21b2b7['attributes']=_['intersection'](_0x267a78['model'],qs[_0xb5cd('0x33')](_0x15a94e[_0xb5cd('0x2f')][_0xb5cd('0x33')]));_0x21b2b7[_0xb5cd('0x34')]=_0x21b2b7[_0xb5cd('0x34')]['length']?_0x21b2b7[_0xb5cd('0x34')]:_0x267a78['model'];if(!_0x15a94e[_0xb5cd('0x2f')][_0xb5cd('0x35')](_0xb5cd('0x36'))){_0x21b2b7[_0xb5cd('0x1c')]=qs[_0xb5cd('0x1c')](_0x15a94e[_0xb5cd('0x2f')]['limit']);_0x21b2b7['offset']=qs[_0xb5cd('0x1b')](_0x15a94e['query'][_0xb5cd('0x1b')]);}_0x21b2b7[_0xb5cd('0x37')]=qs[_0xb5cd('0x38')](_0x15a94e[_0xb5cd('0x2f')][_0xb5cd('0x38')]);_0x21b2b7[_0xb5cd('0x39')]=qs[_0xb5cd('0x31')](_[_0xb5cd('0x3a')](_0x15a94e[_0xb5cd('0x2f')],_0x267a78[_0xb5cd('0x31')]),_0x49ae43);if(_0x15a94e[_0xb5cd('0x2f')]['filter']){_0x21b2b7[_0xb5cd('0x39')]=_[_0xb5cd('0x3b')](_0x21b2b7[_0xb5cd('0x39')],{'$or':_[_0xb5cd('0x29')](_0x49ae43,function(_0xa3ec32){if(_0xa3ec32[_0xb5cd('0x2c')]!==_0xb5cd('0x3c')){var _0x29c2dd={};_0x29c2dd[_0xa3ec32[_0xb5cd('0x26')]]={'$like':'%'+_0x15a94e[_0xb5cd('0x2f')][_0xb5cd('0x3d')]+'%'};return _0x29c2dd;}})});}_0x21b2b7=_[_0xb5cd('0x3b')]({},_0x21b2b7,_0x15a94e[_0xb5cd('0x3e')]);var _0x1aed19={'where':_0x21b2b7['where']};return db[_0xb5cd('0x2a')]['count'](_0x1aed19)[_0xb5cd('0x22')](function(_0x4f366b){_0x493d6a[_0xb5cd('0x1a')]=_0x4f366b;if(_0x15a94e['query'][_0xb5cd('0x3f')]){_0x21b2b7[_0xb5cd('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xb5cd('0x41')](_0x21b2b7);})[_0xb5cd('0x22')](function(_0x5182a3){_0x493d6a[_0xb5cd('0x42')]=_0x5182a3;return _0x493d6a;})['then'](respondWithFilteredResult(_0x20b0c9,_0x21b2b7))[_0xb5cd('0x43')](handleError(_0x20b0c9,null));};exports['show']=function(_0x2a6d23,_0x55fff2){var _0x327c7c={'raw':!![],'where':{'id':_0x2a6d23[_0xb5cd('0x44')]['id']}},_0x44824b={};_0x44824b[_0xb5cd('0x2e')]=_[_0xb5cd('0x30')](db[_0xb5cd('0x2a')][_0xb5cd('0x45')]);_0x44824b[_0xb5cd('0x2f')]=_['keys'](_0x2a6d23[_0xb5cd('0x2f')]);_0x44824b[_0xb5cd('0x31')]=_[_0xb5cd('0x32')](_0x44824b[_0xb5cd('0x2e')],_0x44824b[_0xb5cd('0x2f')]);_0x327c7c[_0xb5cd('0x34')]=_[_0xb5cd('0x32')](_0x44824b[_0xb5cd('0x2e')],qs[_0xb5cd('0x33')](_0x2a6d23[_0xb5cd('0x2f')][_0xb5cd('0x33')]));_0x327c7c['attributes']=_0x327c7c[_0xb5cd('0x34')][_0xb5cd('0x46')]?_0x327c7c[_0xb5cd('0x34')]:_0x44824b[_0xb5cd('0x2e')];if(_0x2a6d23[_0xb5cd('0x2f')][_0xb5cd('0x3f')]){_0x327c7c[_0xb5cd('0x40')]=[{'all':!![]}];}_0x327c7c=_['merge']({},_0x327c7c,_0x2a6d23[_0xb5cd('0x3e')]);return db[_0xb5cd('0x2a')][_0xb5cd('0x47')](_0x327c7c)[_0xb5cd('0x22')](handleEntityNotFound(_0x55fff2,null))['then'](respondWithResult(_0x55fff2,null))['catch'](handleError(_0x55fff2,null));};exports[_0xb5cd('0x48')]=function(_0x4d70b4,_0x5988b2){return db[_0xb5cd('0x2a')][_0xb5cd('0x48')](_0x4d70b4[_0xb5cd('0x49')],{})[_0xb5cd('0x22')](respondWithResult(_0x5988b2,0xc9))[_0xb5cd('0x43')](handleError(_0x5988b2,null));};exports[_0xb5cd('0x21')]=function(_0x108bde,_0x545a76){if(_0x108bde[_0xb5cd('0x49')]['id']){delete _0x108bde['body']['id'];}return db[_0xb5cd('0x2a')][_0xb5cd('0x47')]({'where':{'id':_0x108bde[_0xb5cd('0x44')]['id']}})['then'](handleEntityNotFound(_0x545a76,null))[_0xb5cd('0x22')](saveUpdates(_0x108bde[_0xb5cd('0x49')],null))[_0xb5cd('0x22')](respondWithResult(_0x545a76,null))[_0xb5cd('0x43')](handleError(_0x545a76,null));};exports[_0xb5cd('0x23')]=function(_0x40fa69,_0x296ac6){return db[_0xb5cd('0x2a')][_0xb5cd('0x47')]({'where':{'id':_0x40fa69[_0xb5cd('0x44')]['id']}})[_0xb5cd('0x22')](handleEntityNotFound(_0x296ac6,null))[_0xb5cd('0x22')](removeEntity(_0x296ac6,null))['catch'](handleError(_0x296ac6,null));};exports[_0xb5cd('0x4a')]=function(_0xe2a747,_0xd19d8){return db[_0xb5cd('0x2a')]['describe']()[_0xb5cd('0x22')](respondWithResult(_0xd19d8,null))[_0xb5cd('0x43')](handleError(_0xd19d8,null));}; \ No newline at end of file +var _0x6430=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','keys','find','catch','create','update','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x6430,0xcb));var _0x0643=function(_0x1a90fe,_0x4182e5){_0x1a90fe=_0x1a90fe-0x0;var _0x2456fb=_0x6430[_0x1a90fe];return _0x2456fb;};'use strict';var pdf=require(_0x0643('0x0'));var emlformat=require(_0x0643('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0643('0x2'));var jsonpatch=require(_0x0643('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0643('0x4'));var Mustache=require('mustache');var util=require(_0x0643('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0643('0x6'));var ejs=require(_0x0643('0x7'));var fs=require('fs');var _=require(_0x0643('0x8'));var squel=require(_0x0643('0x9'));var crypto=require(_0x0643('0xa'));var jsforce=require(_0x0643('0xb'));var deskjs=require(_0x0643('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0643('0xd'));var Papa=require(_0x0643('0xe'));var Redis=require(_0x0643('0xf'));var authService=require(_0x0643('0x10'));var qs=require(_0x0643('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0643('0x12'));var utils=require('../../config/utils');var config=require(_0x0643('0x13'));var db=require(_0x0643('0x14'))['db'];function respondWithStatusCode(_0x585399,_0x35cac8){_0x35cac8=_0x35cac8||0xcc;return function(_0x488ba0){if(_0x488ba0){return _0x585399[_0x0643('0x15')](_0x35cac8);}return _0x585399[_0x0643('0x16')](_0x35cac8)[_0x0643('0x17')]();};}function respondWithResult(_0x34464f,_0x4fd51e){_0x4fd51e=_0x4fd51e||0xc8;return function(_0x398e87){if(_0x398e87){return _0x34464f[_0x0643('0x16')](_0x4fd51e)[_0x0643('0x18')](_0x398e87);}};}function respondWithFilteredResult(_0x43a716,_0x9975b){return function(_0x4f0a19){if(_0x4f0a19){var _0x5d3902=_0x4f0a19[_0x0643('0x19')],_0x2d24ba=_0x9975b[_0x0643('0x1a')],_0x4eadd7=_0x9975b[_0x0643('0x1a')]+_0x9975b['limit'],_0x194ad4;if(_0x4eadd7>=_0x5d3902){_0x4eadd7=_0x5d3902;_0x194ad4=0xc8;}else{_0x194ad4=0xce;}_0x43a716[_0x0643('0x16')](_0x194ad4);return _0x43a716[_0x0643('0x1b')](_0x0643('0x1c'),_0x2d24ba+'-'+_0x4eadd7+'/'+_0x5d3902)['json'](_0x4f0a19);}return null;};}function patchUpdates(_0x3d0642){return function(_0x2bfc79){try{jsonpatch[_0x0643('0x1d')](_0x2bfc79,_0x3d0642,!![]);}catch(_0x28d18e){return BPromise[_0x0643('0x1e')](_0x28d18e);}return _0x2bfc79[_0x0643('0x1f')]();};}function saveUpdates(_0x5f59ac,_0x52bc8d){return function(_0x38aa6f){if(_0x38aa6f){return _0x38aa6f['update'](_0x5f59ac)[_0x0643('0x20')](function(_0x2c0c15){return _0x2c0c15;});}return null;};}function removeEntity(_0x312c09,_0x2ba29d){return function(_0x5cd206){if(_0x5cd206){return _0x5cd206[_0x0643('0x21')]()[_0x0643('0x20')](function(){_0x312c09[_0x0643('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd77ce,_0x5b3f9b){return function(_0x332a76){if(!_0x332a76){_0xd77ce['sendStatus'](0x194);}return _0x332a76;};}function handleError(_0x2e4d0d,_0x3d17c2){_0x3d17c2=_0x3d17c2||0x1f4;return function(_0x2f8047){logger[_0x0643('0x22')](_0x2f8047['stack']);if(_0x2f8047[_0x0643('0x23')]){delete _0x2f8047['name'];}_0x2e4d0d[_0x0643('0x16')](_0x3d17c2)[_0x0643('0x24')](_0x2f8047);};}exports[_0x0643('0x25')]=function(_0x56ecfb,_0x4e4d6f){var _0x3bc8ce={},_0x22acd0={},_0x1d3d67={'count':0x0,'rows':[]};var _0x31461b=_[_0x0643('0x26')](db[_0x0643('0x27')][_0x0643('0x28')],function(_0x292ad7){return{'name':_0x292ad7[_0x0643('0x29')],'type':_0x292ad7[_0x0643('0x2a')][_0x0643('0x2b')]};});_0x22acd0['model']=_[_0x0643('0x26')](_0x31461b,_0x0643('0x23'));_0x22acd0[_0x0643('0x2c')]=_['keys'](_0x56ecfb[_0x0643('0x2c')]);_0x22acd0[_0x0643('0x2d')]=_[_0x0643('0x2e')](_0x22acd0[_0x0643('0x2f')],_0x22acd0['query']);_0x3bc8ce[_0x0643('0x30')]=_[_0x0643('0x2e')](_0x22acd0[_0x0643('0x2f')],qs[_0x0643('0x31')](_0x56ecfb[_0x0643('0x2c')][_0x0643('0x31')]));_0x3bc8ce[_0x0643('0x30')]=_0x3bc8ce[_0x0643('0x30')][_0x0643('0x32')]?_0x3bc8ce[_0x0643('0x30')]:_0x22acd0[_0x0643('0x2f')];if(!_0x56ecfb['query'][_0x0643('0x33')](_0x0643('0x34'))){_0x3bc8ce[_0x0643('0x35')]=qs[_0x0643('0x35')](_0x56ecfb['query'][_0x0643('0x35')]);_0x3bc8ce['offset']=qs[_0x0643('0x1a')](_0x56ecfb['query'][_0x0643('0x1a')]);}_0x3bc8ce['order']=qs[_0x0643('0x36')](_0x56ecfb[_0x0643('0x2c')][_0x0643('0x36')]);_0x3bc8ce[_0x0643('0x37')]=qs[_0x0643('0x2d')](_[_0x0643('0x38')](_0x56ecfb['query'],_0x22acd0['filters']),_0x31461b);if(_0x56ecfb[_0x0643('0x2c')][_0x0643('0x39')]){_0x3bc8ce[_0x0643('0x37')]=_[_0x0643('0x3a')](_0x3bc8ce[_0x0643('0x37')],{'$or':_[_0x0643('0x26')](_0x31461b,function(_0x1bcbcb){if(_0x1bcbcb[_0x0643('0x2a')]!=='VIRTUAL'){var _0x223f4a={};_0x223f4a[_0x1bcbcb[_0x0643('0x23')]]={'$like':'%'+_0x56ecfb[_0x0643('0x2c')][_0x0643('0x39')]+'%'};return _0x223f4a;}})});}_0x3bc8ce=_['merge']({},_0x3bc8ce,_0x56ecfb[_0x0643('0x3b')]);var _0x283cb0={'where':_0x3bc8ce[_0x0643('0x37')]};return db[_0x0643('0x27')][_0x0643('0x19')](_0x283cb0)[_0x0643('0x20')](function(_0x220aeb){_0x1d3d67[_0x0643('0x19')]=_0x220aeb;if(_0x56ecfb[_0x0643('0x2c')][_0x0643('0x3c')]){_0x3bc8ce[_0x0643('0x3d')]=[{'all':!![]}];}return db[_0x0643('0x27')][_0x0643('0x3e')](_0x3bc8ce);})[_0x0643('0x20')](function(_0x37c2b3){_0x1d3d67[_0x0643('0x3f')]=_0x37c2b3;return _0x1d3d67;})[_0x0643('0x20')](respondWithFilteredResult(_0x4e4d6f,_0x3bc8ce))['catch'](handleError(_0x4e4d6f,null));};exports['show']=function(_0x3655e8,_0xe22dd0){var _0x1c58b0={'raw':!![],'where':{'id':_0x3655e8['params']['id']}},_0x4185d5={};_0x4185d5[_0x0643('0x2f')]=_['keys'](db[_0x0643('0x27')][_0x0643('0x28')]);_0x4185d5[_0x0643('0x2c')]=_[_0x0643('0x40')](_0x3655e8[_0x0643('0x2c')]);_0x4185d5[_0x0643('0x2d')]=_[_0x0643('0x2e')](_0x4185d5[_0x0643('0x2f')],_0x4185d5['query']);_0x1c58b0[_0x0643('0x30')]=_[_0x0643('0x2e')](_0x4185d5[_0x0643('0x2f')],qs[_0x0643('0x31')](_0x3655e8[_0x0643('0x2c')][_0x0643('0x31')]));_0x1c58b0[_0x0643('0x30')]=_0x1c58b0[_0x0643('0x30')][_0x0643('0x32')]?_0x1c58b0[_0x0643('0x30')]:_0x4185d5[_0x0643('0x2f')];if(_0x3655e8[_0x0643('0x2c')]['includeAll']){_0x1c58b0[_0x0643('0x3d')]=[{'all':!![]}];}_0x1c58b0=_['merge']({},_0x1c58b0,_0x3655e8['options']);return db[_0x0643('0x27')][_0x0643('0x41')](_0x1c58b0)[_0x0643('0x20')](handleEntityNotFound(_0xe22dd0,null))[_0x0643('0x20')](respondWithResult(_0xe22dd0,null))[_0x0643('0x42')](handleError(_0xe22dd0,null));};exports[_0x0643('0x43')]=function(_0x21a6d4,_0x45ba43){return db[_0x0643('0x27')]['create'](_0x21a6d4['body'],{})[_0x0643('0x20')](respondWithResult(_0x45ba43,0xc9))['catch'](handleError(_0x45ba43,null));};exports[_0x0643('0x44')]=function(_0x235b34,_0x2b178e){if(_0x235b34['body']['id']){delete _0x235b34[_0x0643('0x45')]['id'];}return db[_0x0643('0x27')][_0x0643('0x41')]({'where':{'id':_0x235b34[_0x0643('0x46')]['id']}})[_0x0643('0x20')](handleEntityNotFound(_0x2b178e,null))[_0x0643('0x20')](saveUpdates(_0x235b34[_0x0643('0x45')],null))[_0x0643('0x20')](respondWithResult(_0x2b178e,null))[_0x0643('0x42')](handleError(_0x2b178e,null));};exports[_0x0643('0x21')]=function(_0x426155,_0x52501d){return db[_0x0643('0x27')][_0x0643('0x41')]({'where':{'id':_0x426155[_0x0643('0x46')]['id']}})['then'](handleEntityNotFound(_0x52501d,null))[_0x0643('0x20')](removeEntity(_0x52501d,null))[_0x0643('0x42')](handleError(_0x52501d,null));};exports[_0x0643('0x47')]=function(_0x2c8fc4,_0x1cab9c){return db[_0x0643('0x27')][_0x0643('0x47')]()[_0x0643('0x20')](respondWithResult(_0x1cab9c,null))[_0x0643('0x42')](handleError(_0x1cab9c,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index a9182e1..c96a5b1 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 _0xfd1a=['rimraf','./whatsappTransferReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x1e58a0,_0x243bde){var _0x1f1dc8=function(_0x1a197f){while(--_0x1a197f){_0x1e58a0['push'](_0x1e58a0['shift']());}};_0x1f1dc8(++_0x243bde);}(_0xfd1a,0x1d9));var _0xafd1=function(_0x20e8d6,_0x4d9a75){_0x20e8d6=_0x20e8d6-0x0;var _0x44ea29=_0xfd1a[_0x20e8d6];return _0x44ea29;};'use strict';var _=require(_0xafd1('0x0'));var util=require(_0xafd1('0x1'));var logger=require(_0xafd1('0x2'))(_0xafd1('0x3'));var moment=require(_0xafd1('0x4'));var BPromise=require(_0xafd1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xafd1('0x6'));var rimraf=require(_0xafd1('0x7'));var config=require('../../config/environment');var attributes=require(_0xafd1('0x8'));module[_0xafd1('0x9')]=function(_0x117dec,_0x51cac7){return _0x117dec[_0xafd1('0xa')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xafd1('0xb'),'fields':[_0xafd1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x495d=['../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','report_whatsapp_transfer','lodash'];(function(_0x169996,_0x4b59b5){var _0x28d7e6=function(_0x5e3acd){while(--_0x5e3acd){_0x169996['push'](_0x169996['shift']());}};_0x28d7e6(++_0x4b59b5);}(_0x495d,0x1cb));var _0xd495=function(_0x2d97a8,_0x3095c2){_0x2d97a8=_0x2d97a8-0x0;var _0x2e697b=_0x495d[_0x2d97a8];return _0x2e697b;};'use strict';var _=require(_0xd495('0x0'));var util=require('util');var logger=require(_0xd495('0x1'))(_0xd495('0x2'));var moment=require(_0xd495('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd495('0x4'));var rimraf=require(_0xd495('0x5'));var config=require(_0xd495('0x6'));var attributes=require('./whatsappTransferReport.attributes');module[_0xd495('0x7')]=function(_0x3ede52,_0x32d049){return _0x3ede52[_0xd495('0x8')]('WhatsappTransferReport',attributes,{'tableName':_0xd495('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','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 08b9e5c..7afd1c5 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x11cbf4,_0x456061){var _0x4b3d9f=function(_0x260e18){while(--_0x260e18){_0x11cbf4['push'](_0x11cbf4['shift']());}};_0x4b3d9f(++_0x456061);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1cedd8,_0x1d2eb2){var _0x3a57e6=function(_0xa34117){while(--_0xa34117){_0x1cedd8['push'](_0x1cedd8['shift']());}};_0x3a57e6(++_0x1d2eb2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index b8459d5..f63d8e0 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed7e=['name','map','filter','status','join','None','seedDB','./config/seedDB','default','./config/license','catch','error','exit','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/transcribe','sync','listen','then','info','start','Online\x20apps:','online'];(function(_0x2df84d,_0x56d874){var _0x2634ce=function(_0x8e8e31){while(--_0x8e8e31){_0x2df84d['push'](_0x2df84d['shift']());}};_0x2634ce(++_0x56d874);}(_0xed7e,0x11b));var _0xeed7=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xed7e[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require('lodash');var mysqldb=require('./mysqldb');var rpc=require(_0xeed7('0x0'));var config=require(_0xeed7('0x1'));var logger=require(_0xeed7('0x2'))(_0xeed7('0x3'));var pm2=require(_0xeed7('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xeed7('0x5'));var chat=require('./config/schedule/chat');var transcribe=require(_0xeed7('0x6'));function main(){return mysqldb['db']['sequelize'][_0xeed7('0x7')]()['then'](function(){return rpc[_0xeed7('0x8')]();})[_0xeed7('0x9')](function(_0x50881c){logger[_0xeed7('0xa')](_0x50881c);return chat[_0xeed7('0xb')]();})[_0xeed7('0x9')](function(){return schedule[_0xeed7('0xb')]();})['then'](function(){return transcribe[_0xeed7('0xb')]();})[_0xeed7('0x9')](function(_0x38746e){logger[_0xeed7('0xa')](_0x38746e);return pm2['start'](pm2Config);})[_0xeed7('0x9')](function(_0x431f83){logger[_0xeed7('0xa')](_0xeed7('0xc'),_['map'](_['filter'](_0x431f83,{'status':_0xeed7('0xd')}),_0xeed7('0xe'))['join']());logger[_0xeed7('0xa')]('Offline\x20apps:',_[_0xeed7('0xf')](_[_0xeed7('0x10')](_0x431f83,function(_0x2ba13c){return _0x2ba13c[_0xeed7('0x11')]!==_0xeed7('0xd');}),'name')[_0xeed7('0x12')]()||_0xeed7('0x13'));config[_0xeed7('0x14')]&&require(_0xeed7('0x15'))[_0xeed7('0x16')]();require(_0xeed7('0x17'))[_0xeed7('0x16')]();})[_0xeed7('0x18')](function(_0x5da064){logger[_0xeed7('0x19')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x5da064);process[_0xeed7('0x1a')](0x1);});}main(); \ No newline at end of file +var _0xfeb5=['./config/schedule','./config/schedule/chat','sync','listen','then','start','info','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','seedDB','./config/seedDB','default','./config/license','catch','error','exit','lodash','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config'];(function(_0x367054,_0x1debc3){var _0x472454=function(_0x3f4ea7){while(--_0x3f4ea7){_0x367054['push'](_0x367054['shift']());}};_0x472454(++_0x1debc3);}(_0xfeb5,0xd9));var _0x5feb=function(_0x37df6f,_0x51d002){_0x37df6f=_0x37df6f-0x0;var _0x87e89b=_0xfeb5[_0x37df6f];return _0x87e89b;};'use strict';var _=require(_0x5feb('0x0'));var mysqldb=require(_0x5feb('0x1'));var rpc=require('./rpc');var config=require(_0x5feb('0x2'));var logger=require(_0x5feb('0x3'))(_0x5feb('0x4'));var pm2=require(_0x5feb('0x5'));var pm2Config=require(_0x5feb('0x6'));var schedule=require(_0x5feb('0x7'));var chat=require(_0x5feb('0x8'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db']['sequelize'][_0x5feb('0x9')]()['then'](function(){return rpc[_0x5feb('0xa')]();})['then'](function(_0x3a28aa){logger['info'](_0x3a28aa);return chat['start']();})[_0x5feb('0xb')](function(){return schedule[_0x5feb('0xc')]();})[_0x5feb('0xb')](function(){return transcribe['start']();})[_0x5feb('0xb')](function(_0x20cf70){logger[_0x5feb('0xd')](_0x20cf70);return pm2[_0x5feb('0xc')](pm2Config);})['then'](function(_0x1c49b3){logger['info'](_0x5feb('0xe'),_[_0x5feb('0xf')](_[_0x5feb('0x10')](_0x1c49b3,{'status':_0x5feb('0x11')}),_0x5feb('0x12'))[_0x5feb('0x13')]());logger['info'](_0x5feb('0x14'),_[_0x5feb('0xf')](_['filter'](_0x1c49b3,function(_0x23d3f8){return _0x23d3f8['status']!==_0x5feb('0x11');}),_0x5feb('0x12'))[_0x5feb('0x13')]()||'None');config[_0x5feb('0x15')]&&require(_0x5feb('0x16'))[_0x5feb('0x17')]();require(_0x5feb('0x18'))[_0x5feb('0x17')]();})[_0x5feb('0x19')](function(_0x31fb50){logger[_0x5feb('0x1a')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x31fb50);process[_0x5feb('0x1b')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 6849b8b..4fe5ceb 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 _0xedd2=['faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','isChatInteractionAuthorized','isAuthenticated','user','findOne','params','closed','disposition','status','unmanaged','Forbidden.','catch','use','headers','authorization','startsWith','Basic','User','find','then','authenticate','pass','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','getUuid','query','apikey','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20not\x20found.','canUpdate','../../config/license/util','update','Forbidden','isMiddleware','signToken','setTokenCookie','motion.token','/dashboards/general','send','generateApiKey','regenerateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secrets','session','payload','options','verify','randomBytes','hex','floor','now','HS512','toString','../../mysqldb','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','role','fullname','name','userpic','permissions','md5secret','voicePause'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xedd2,0x1c2));var _0x2edd=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xedd2[_0x19950b];return _0x3c6b41;};'use strict';var db=require(_0x2edd('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x2edd('0x1'));var _=require(_0x2edd('0x2'));var jwt=require(_0x2edd('0x3'));var expressJwt=require(_0x2edd('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0x2edd('0x5'));var crypto=require(_0x2edd('0x6'));var BPromise=require(_0x2edd('0x7'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0x2edd('0x8'),_0x2edd('0x9'),_0x2edd('0xa'),'internal','email',_0x2edd('0xb'),_0x2edd('0xc'),_0x2edd('0xd'),_0x2edd('0xe'),'chatPause','mailPause',_0x2edd('0xf'),_0x2edd('0x10'),_0x2edd('0x11'),_0x2edd('0x12'),_0x2edd('0x13'),_0x2edd('0x14'),_0x2edd('0x15'),'crudPermissions','allowmessenger',_0x2edd('0x16'),'alias',_0x2edd('0x17'),_0x2edd('0x18'),_0x2edd('0x19'),_0x2edd('0x1a'),_0x2edd('0x1b'),_0x2edd('0x1c'),'phoneBarExpires','phoneBarPrefixRequired',_0x2edd('0x1d'),_0x2edd('0x1e'),_0x2edd('0x1f'),_0x2edd('0x20'),'userProfileId'];exports[_0x2edd('0x21')]=function(){return this[_0x2edd('0x22')](!![])['use'](function(_0x1c3d2a,_0x4ef250,_0x1fd17c){if(_0x1c3d2a[_0x2edd('0x23')]){_0x1fd17c();}else{return db['ChatInteraction'][_0x2edd('0x24')]({'where':{'id':_0x1c3d2a[_0x2edd('0x25')]['id']},'attributes':['id',_0x2edd('0x26'),_0x2edd('0x27')],'raw':!![]})['then'](function(_0x263594){if(_0x263594&&_0x263594['closed']){return _0x4ef250[_0x2edd('0x28')](_0x263594[_0x2edd('0x27')]===_0x2edd('0x29')?0x195:0x193)['json']({'message':_0x263594[_0x2edd('0x27')]===_0x2edd('0x29')?'Unmanaged.':_0x2edd('0x2a')});}else{_0x1fd17c();}})[_0x2edd('0x2b')](function(_0x5eb3e7){_0x1fd17c(_0x5eb3e7);});}});};exports[_0x2edd('0x22')]=function isAuthenticated(_0x1f8727){return compose()[_0x2edd('0x2c')](function(_0x4ea58e,_0x4db0aa,_0x39eb37){if(_0x4ea58e[_0x2edd('0x2d')][_0x2edd('0x2e')]){if(_[_0x2edd('0x2f')](_0x4ea58e['headers'][_0x2edd('0x2e')],_0x2edd('0x30'))){var _0xe3a28c=basicAuth(_0x4ea58e);db[_0x2edd('0x31')][_0x2edd('0x32')]({'where':{'name':_0xe3a28c[_0x2edd('0xa')]}})[_0x2edd('0x33')](function(_0x5845f6){if(!_0x5845f6||!_0x5845f6[_0x2edd('0x34')](_0xe3a28c[_0x2edd('0x35')])){return _0x4db0aa[_0x2edd('0x28')](0x191)[_0x2edd('0x36')]({'message':_0x2edd('0x37')});}_0x4ea58e[_0x2edd('0x23')]={'id':_0x5845f6['id']};_0x39eb37();})[_0x2edd('0x2b')](function(_0x5d3c52){_0x39eb37(_0x5d3c52);});}else if(_['startsWith'](_0x4ea58e[_0x2edd('0x2d')]['authorization'],'Bearer')){validateJwt(_0x4ea58e,_0x4db0aa,_0x39eb37);}else{if(_0x1f8727){_0x39eb37();}else{return _0x4db0aa[_0x2edd('0x28')](0x193)['json']({'message':_0x2edd('0x38')});}}}else if(_0x4ea58e['query']['apikey']){try{var _0x4b1f93={'audience':hardwareConf[_0x2edd('0x39')](),'issuer':hardwareConf[_0x2edd('0x39')]()};verifyJwt(_0x4ea58e[_0x2edd('0x3a')][_0x2edd('0x3b')],_0x4b1f93)[_0x2edd('0x33')](function(_0x5230ec){return db[_0x2edd('0x31')]['find']({'where':{'id':_0x5230ec['sub']}})['then'](function(_0x47f4bd){if(!_0x47f4bd||!_[_0x2edd('0x3c')](_0x47f4bd[_0x2edd('0x3d')],_0x5230ec[_0x2edd('0x3e')])){return _0x4db0aa[_0x2edd('0x28')](0x191)['json']({'message':_0x2edd('0x3f')});}_0x4ea58e[_0x2edd('0x23')]={'id':_0x47f4bd['id']};_0x39eb37();});})['catch'](function(){return _0x4db0aa[_0x2edd('0x28')](0x191)['json']({'message':_0x2edd('0x40')});});}catch(_0x34d4bb){_0x39eb37(_0x34d4bb);}}else if(_0x1f8727){_0x39eb37();}else{return _0x4db0aa[_0x2edd('0x28')](0x193)[_0x2edd('0x36')]({'message':_0x2edd('0x38')});}})[_0x2edd('0x2c')](function(_0x1732fb,_0x4ab5e2,_0x46557f){if(_0x1732fb[_0x2edd('0x23')]){db[_0x2edd('0x31')]['find']({'where':{'id':_0x1732fb['user']['id']},'attributes':userAttributes})[_0x2edd('0x33')](function(_0xdf777b){if(!_0xdf777b){return _0x4ab5e2[_0x2edd('0x28')](0x194)[_0x2edd('0x36')]({'message':_0x2edd('0x41')});}_0x1732fb[_0x2edd('0x23')]=_0xdf777b;_0x46557f();})[_0x2edd('0x2b')](function(_0x4abff9){_0x46557f(_0x4abff9);});}else if(_0x1f8727){_0x46557f();}else{return _0x4ab5e2[_0x2edd('0x28')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x2edd('0x42')]=function canUpdate(){return compose()[_0x2edd('0x2c')](function(_0x4f9f33,_0xb55ae4,_0x75acc5){return require(_0x2edd('0x43'))['getLicense']()[_0x2edd('0x33')](function(_0x316da3){if(_0x316da3[_0x2edd('0x44')]){_0x75acc5();}else{return _0xb55ae4[_0x2edd('0x28')](0x193)[_0x2edd('0x36')]({'message':_0x2edd('0x45')});}})['catch'](function(_0x8e48a7){_0x75acc5(_0x8e48a7);});});};exports[_0x2edd('0x46')]=function(_0x29401c,_0x8c2a24,_0x2512a9){_0x29401c[_0x2edd('0x46')]=!![];return _0x2512a9();};exports[_0x2edd('0x47')]=function signToken(_0x1bbce4){return signJwt(_0x1bbce4);};exports[_0x2edd('0x48')]=function(_0x1ec810,_0x5b212c){if(!_0x1ec810[_0x2edd('0x23')]){return _0x5b212c[_0x2edd('0x28')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x11c48d={'payload':{'id':_0x1ec810[_0x2edd('0x23')]['id'],'role':_0x1ec810['user'][_0x2edd('0x8')]},'options':{'expiresIn':0x15180}};return signJwt(_0x11c48d)[_0x2edd('0x33')](function(_0x2e3a86){_0x5b212c['cookie'](_0x2edd('0x49'),_0x2e3a86);_0x5b212c['redirect'](_0x2edd('0x4a'));})['catch'](function(_0x1fe5cd){return _0x5b212c[_0x2edd('0x28')](0x1f4)[_0x2edd('0x4b')](_0x1fe5cd);});};exports['retrieveApiKey']=function(_0x5b0515){if(_['isNil'](_0x5b0515[_0x2edd('0x3d')])||_['isNil'](_0x5b0515['apiKeyIat'])){return null;}else{return createJwt(_0x5b0515);}};exports[_0x2edd('0x4c')]=function(_0x568d34){_0x568d34[_0x2edd('0x3d')]=generateNonce();_0x568d34['apiKeyIat']=generateIssuedAt();return createJwt(_0x568d34);};exports[_0x2edd('0x4d')]=function(_0xd1b4ad,_0x25ff91){var _0x1f4a8e=_0xd1b4ad[_0x2edd('0x3a')][_0x2edd('0x3b')];if(_0x1f4a8e){var _0x9e7eb1={'nonce':_0x25ff91[_0x2edd('0x3d')],'iat':_0x25ff91[_0x2edd('0x4e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x2edd('0x39')]()};return verifyJwt(_0x1f4a8e,_0x9e7eb1)[_0x2edd('0x33')](function(){return generateApiKey(_0x25ff91);});}else{throw{'message':_0x2edd('0x4f')};}};function signJwt(_0x15b001){var _0xc65f31=BPromise[_0x2edd('0x50')](jwt[_0x2edd('0x51')],{'context':jwt});var _0x5b5aea=_0x15b001['secret']||config[_0x2edd('0x52')][_0x2edd('0x53')];return new BPromise(function(_0x4ba1d9,_0xbcbe79){_0xc65f31(_0x15b001[_0x2edd('0x54')],_0x5b5aea,_0x15b001[_0x2edd('0x55')])[_0x2edd('0x33')](function(_0x1f4391){_0x4ba1d9(_0x1f4391);})[_0x2edd('0x2b')](function(_0x52f651){_0xbcbe79(_0x52f651);});});}function verifyJwt(_0x4ae873,_0x2c302a,_0x2b73e8){var _0x5d61a3=BPromise[_0x2edd('0x50')](jwt[_0x2edd('0x56')],{'context':jwt});var _0x32fd4e=_0x2b73e8||config['secrets'][_0x2edd('0x53')];return new BPromise(function(_0x5794fc,_0x8dd826){_0x5d61a3(_0x4ae873,_0x32fd4e,_0x2c302a)[_0x2edd('0x33')](function(_0x1666a1){_0x5794fc(_0x1666a1);})[_0x2edd('0x2b')](function(_0x6b5a6){_0x8dd826(_0x6b5a6);});});}function generateNonce(){return crypto[_0x2edd('0x57')](0x10)['toString'](_0x2edd('0x58'));}function generateIssuedAt(){return Math[_0x2edd('0x59')](Date[_0x2edd('0x5a')]()/0x3e8)['toString']();}function createJwt(_0x47a348){var _0x2dbe60={'payload':{'iat':_0x47a348[_0x2edd('0x4e')],'nonce':_0x47a348[_0x2edd('0x3d')]},'options':{'algorithm':_0x2edd('0x5b'),'subject':_0x47a348['id'][_0x2edd('0x5c')](),'issuer':hardwareConf[_0x2edd('0x39')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x2dbe60)[_0x2edd('0x33')](function(_0x102299){return{'iat':_0x47a348[_0x2edd('0x4e')],'nonce':_0x47a348[_0x2edd('0x3d')],'token':_0x102299};});} \ No newline at end of file +var _0x766f=['promisify','sign','secret','payload','verify','randomBytes','toString','hex','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControlPort','interface','userProfileId','isChatInteractionAuthorized','use','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','Basic','User','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','user','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','update','Forbidden','isMiddleware','signToken','setTokenCookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey'];(function(_0x4fc19a,_0x5d2084){var _0x3b2fa1=function(_0x168450){while(--_0x168450){_0x4fc19a['push'](_0x4fc19a['shift']());}};_0x3b2fa1(++_0x5d2084);}(_0x766f,0x6c));var _0xf766=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x766f[_0x82129b];return _0x2ae5dc;};'use strict';var db=require(_0xf766('0x0'))['db'];var config=require(_0xf766('0x1'));var hardwareConf=require(_0xf766('0x2'));var _=require(_0xf766('0x3'));var jwt=require(_0xf766('0x4'));var expressJwt=require(_0xf766('0x5'));var compose=require(_0xf766('0x6'));var basicAuth=require(_0xf766('0x7'));var crypto=require(_0xf766('0x8'));var BPromise=require(_0xf766('0x9'));var validateJwt=expressJwt({'secret':config[_0xf766('0xa')][_0xf766('0xb')]});var userAttributes=['id',_0xf766('0xc'),'fullname',_0xf766('0xd'),_0xf766('0xe'),_0xf766('0xf'),_0xf766('0x10'),_0xf766('0x11'),_0xf766('0x12'),_0xf766('0x13'),_0xf766('0x14'),'mailPause',_0xf766('0x15'),_0xf766('0x16'),_0xf766('0x17'),_0xf766('0x18'),_0xf766('0x19'),'lastLoginAt',_0xf766('0x1a'),_0xf766('0x1b'),_0xf766('0x1c'),'passwordResetAt',_0xf766('0x1d'),_0xf766('0x1e'),'phoneBarAutoAnswerDelay',_0xf766('0x1f'),_0xf766('0x20'),_0xf766('0x21'),_0xf766('0x22'),'phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl',_0xf766('0x23'),'hotdesk',_0xf766('0x24'),_0xf766('0x25')];exports[_0xf766('0x26')]=function(){return this['isAuthenticated'](!![])[_0xf766('0x27')](function(_0x34022d,_0x35a068,_0x29e4e8){if(_0x34022d['user']){_0x29e4e8();}else{return db[_0xf766('0x28')][_0xf766('0x29')]({'where':{'id':_0x34022d[_0xf766('0x2a')]['id']},'attributes':['id',_0xf766('0x2b'),_0xf766('0x2c')],'raw':!![]})[_0xf766('0x2d')](function(_0x31f347){if(_0x31f347&&_0x31f347[_0xf766('0x2b')]){return _0x35a068[_0xf766('0x2e')](_0x31f347[_0xf766('0x2c')]===_0xf766('0x2f')?0x195:0x193)[_0xf766('0x30')]({'message':_0x31f347[_0xf766('0x2c')]===_0xf766('0x2f')?_0xf766('0x31'):_0xf766('0x32')});}else{_0x29e4e8();}})[_0xf766('0x33')](function(_0x3c372){_0x29e4e8(_0x3c372);});}});};exports[_0xf766('0x34')]=function isAuthenticated(_0xc58ae5){return compose()[_0xf766('0x27')](function(_0x28ad5c,_0x114939,_0x65ee81){if(_0x28ad5c[_0xf766('0x35')][_0xf766('0x36')]){if(_[_0xf766('0x37')](_0x28ad5c[_0xf766('0x35')]['authorization'],_0xf766('0x38'))){var _0x494a58=basicAuth(_0x28ad5c);db[_0xf766('0x39')]['find']({'where':{'name':_0x494a58[_0xf766('0xd')]}})[_0xf766('0x2d')](function(_0x5a66ee){if(!_0x5a66ee||!_0x5a66ee['authenticate'](_0x494a58[_0xf766('0x3a')])){return _0x114939[_0xf766('0x2e')](0x191)['json']({'message':_0xf766('0x3b')});}_0x28ad5c['user']={'id':_0x5a66ee['id']};_0x65ee81();})[_0xf766('0x33')](function(_0x4abfa4){_0x65ee81(_0x4abfa4);});}else if(_['startsWith'](_0x28ad5c[_0xf766('0x35')][_0xf766('0x36')],_0xf766('0x3c'))){validateJwt(_0x28ad5c,_0x114939,_0x65ee81);}else{if(_0xc58ae5){_0x65ee81();}else{return _0x114939['status'](0x193)[_0xf766('0x30')]({'message':_0xf766('0x3d')});}}}else if(_0x28ad5c[_0xf766('0x3e')][_0xf766('0x3f')]){try{var _0x274433={'audience':hardwareConf[_0xf766('0x40')](),'issuer':hardwareConf[_0xf766('0x40')]()};verifyJwt(_0x28ad5c['query']['apikey'],_0x274433)['then'](function(_0x4fc934){return db[_0xf766('0x39')][_0xf766('0x41')]({'where':{'id':_0x4fc934[_0xf766('0x42')]}})[_0xf766('0x2d')](function(_0x2bbd88){if(!_0x2bbd88||!_[_0xf766('0x43')](_0x2bbd88[_0xf766('0x44')],_0x4fc934[_0xf766('0x45')])){return _0x114939[_0xf766('0x2e')](0x191)[_0xf766('0x30')]({'message':_0xf766('0x46')});}_0x28ad5c['user']={'id':_0x2bbd88['id']};_0x65ee81();});})[_0xf766('0x33')](function(){return _0x114939[_0xf766('0x2e')](0x191)['json']({'message':_0xf766('0x47')});});}catch(_0x102304){_0x65ee81(_0x102304);}}else if(_0xc58ae5){_0x65ee81();}else{return _0x114939['status'](0x193)[_0xf766('0x30')]({'message':'Unknown\x20authorization\x20format'});}})[_0xf766('0x27')](function(_0x580f60,_0x2d9c97,_0x2b7adf){if(_0x580f60['user']){db[_0xf766('0x39')][_0xf766('0x41')]({'where':{'id':_0x580f60[_0xf766('0x48')]['id']},'attributes':userAttributes})[_0xf766('0x2d')](function(_0x3c7331){if(!_0x3c7331){return _0x2d9c97[_0xf766('0x2e')](0x194)[_0xf766('0x30')]({'message':_0xf766('0x49')});}_0x580f60['user']=_0x3c7331;_0x2b7adf();})[_0xf766('0x33')](function(_0x16366d){_0x2b7adf(_0x16366d);});}else if(_0xc58ae5){_0x2b7adf();}else{return _0x2d9c97[_0xf766('0x2e')](0x194)[_0xf766('0x30')]({'message':_0xf766('0x4a')});}});};exports[_0xf766('0x4b')]=function canUpdate(){return compose()['use'](function(_0x2859a1,_0x3e42ac,_0xe4fc9b){return require(_0xf766('0x4c'))['getLicense']()[_0xf766('0x2d')](function(_0x4f9ea6){if(_0x4f9ea6[_0xf766('0x4d')]){_0xe4fc9b();}else{return _0x3e42ac[_0xf766('0x2e')](0x193)[_0xf766('0x30')]({'message':_0xf766('0x4e')});}})[_0xf766('0x33')](function(_0x75000){_0xe4fc9b(_0x75000);});});};exports[_0xf766('0x4f')]=function(_0x84304b,_0x4262cb,_0x23b3f2){_0x84304b[_0xf766('0x4f')]=!![];return _0x23b3f2();};exports[_0xf766('0x50')]=function signToken(_0x34af93){return signJwt(_0x34af93);};exports[_0xf766('0x51')]=function(_0x290a30,_0xc133b4){if(!_0x290a30[_0xf766('0x48')]){return _0xc133b4[_0xf766('0x2e')](0x194)[_0xf766('0x30')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x410ad1={'payload':{'id':_0x290a30[_0xf766('0x48')]['id'],'role':_0x290a30[_0xf766('0x48')][_0xf766('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x410ad1)['then'](function(_0x329dca){_0xc133b4['cookie'](_0xf766('0x52'),_0x329dca);_0xc133b4[_0xf766('0x53')](_0xf766('0x54'));})[_0xf766('0x33')](function(_0x201d57){return _0xc133b4[_0xf766('0x2e')](0x1f4)[_0xf766('0x55')](_0x201d57);});};exports[_0xf766('0x56')]=function(_0x7f2d03){if(_[_0xf766('0x57')](_0x7f2d03[_0xf766('0x44')])||_[_0xf766('0x57')](_0x7f2d03[_0xf766('0x58')])){return null;}else{return createJwt(_0x7f2d03);}};exports['generateApiKey']=function(_0x20295b){_0x20295b[_0xf766('0x44')]=generateNonce();_0x20295b[_0xf766('0x58')]=generateIssuedAt();return createJwt(_0x20295b);};exports[_0xf766('0x59')]=function(_0x279084,_0x1c8ee4){var _0xcc76d8=_0x279084[_0xf766('0x3e')][_0xf766('0x3f')];if(_0xcc76d8){var _0x463547={'nonce':_0x1c8ee4['apiKeyNonce'],'iat':_0x1c8ee4[_0xf766('0x58')],'audience':hardwareConf[_0xf766('0x40')](),'issuer':hardwareConf[_0xf766('0x40')]()};return verifyJwt(_0xcc76d8,_0x463547)[_0xf766('0x2d')](function(){return generateApiKey(_0x1c8ee4);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};function signJwt(_0x16f19d){var _0x2c990b=BPromise[_0xf766('0x5a')](jwt[_0xf766('0x5b')],{'context':jwt});var _0x21fb93=_0x16f19d[_0xf766('0x5c')]||config[_0xf766('0xa')]['session'];return new BPromise(function(_0x460846,_0x3455f3){_0x2c990b(_0x16f19d[_0xf766('0x5d')],_0x21fb93,_0x16f19d['options'])[_0xf766('0x2d')](function(_0x19f5ef){_0x460846(_0x19f5ef);})[_0xf766('0x33')](function(_0x252de1){_0x3455f3(_0x252de1);});});}function verifyJwt(_0x471946,_0x498082,_0x4254e0){var _0x54207e=BPromise['promisify'](jwt[_0xf766('0x5e')],{'context':jwt});var _0xa9dd3b=_0x4254e0||config[_0xf766('0xa')][_0xf766('0xb')];return new BPromise(function(_0x423be6,_0x5f2e6c){_0x54207e(_0x471946,_0xa9dd3b,_0x498082)[_0xf766('0x2d')](function(_0x52cf35){_0x423be6(_0x52cf35);})[_0xf766('0x33')](function(_0x13fb0c){_0x5f2e6c(_0x13fb0c);});});}function generateNonce(){return crypto[_0xf766('0x5f')](0x10)[_0xf766('0x60')](_0xf766('0x61'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0xf766('0x60')]();}function createJwt(_0x397017){var _0x589450={'payload':{'iat':_0x397017[_0xf766('0x58')],'nonce':_0x397017[_0xf766('0x44')]},'options':{'algorithm':_0xf766('0x62'),'subject':_0x397017['id'][_0xf766('0x60')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xf766('0x40')]()}};return signJwt(_0x589450)['then'](function(_0x136cc0){return{'iat':_0x397017['apiKeyIat'],'nonce':_0x397017['apiKeyNonce'],'token':_0x136cc0};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e94c43d..714b9e2 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 _0xd8b0=['data','binary','end','final','write','close','unlink','decryptFile','createReadStream','createDecipher','update','crypto','bluebird','hasOwnProperty','encryptFile','createWriteStream','createCipher','algorithm'];(function(_0xcff851,_0x19e131){var _0x54ae65=function(_0x3e81a2){while(--_0x3e81a2){_0xcff851['push'](_0xcff851['shift']());}};_0x54ae65(++_0x19e131);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var crypto=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var defaultOptions={'algorithm':'aes192'};function combineOptions(_0x585166){var _0x4b72b0={};for(var _0x3ff8df in defaultOptions){if(defaultOptions[_0x0d8b('0x2')](_0x3ff8df)){_0x4b72b0[_0x3ff8df]=defaultOptions[_0x3ff8df];}}if(_0x585166){for(var _0x43bca1 in _0x585166){if(_0x585166[_0x0d8b('0x2')](_0x43bca1)){_0x4b72b0[_0x43bca1]=_0x585166[_0x43bca1];}}}return _0x4b72b0;}exports[_0x0d8b('0x3')]=function(_0x577834,_0x5e15e6,_0x3f8b6f,_0x227c63){return new BPromise(function(_0x39f43a,_0x4a4470){_0x227c63=combineOptions(_0x227c63);var _0x413284=new Buffer(_0x3f8b6f);var _0x284169=fs['createReadStream'](_0x577834);var _0x129310=fs[_0x0d8b('0x4')](_0x5e15e6);var _0x3b027f=crypto[_0x0d8b('0x5')](_0x227c63[_0x0d8b('0x6')],_0x413284);_0x284169['on'](_0x0d8b('0x7'),function(_0x2c5e9e){var _0x28f87c=new Buffer(_0x3b027f['update'](_0x2c5e9e),_0x0d8b('0x8'));_0x129310['write'](_0x28f87c);});_0x284169['on'](_0x0d8b('0x9'),function(){try{var _0xc574a3=new Buffer(_0x3b027f[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x129310[_0x0d8b('0xb')](_0xc574a3);_0x129310[_0x0d8b('0x9')]();_0x129310['on'](_0x0d8b('0xc'),function(){return _0x39f43a(_0x5e15e6);});}catch(_0x1d4bbc){fs[_0x0d8b('0xd')](_0x5e15e6);return _0x4a4470(_0x1d4bbc);}});});};exports[_0x0d8b('0xe')]=function(_0xe65334,_0x1567ce,_0x2d4e1c,_0x4f6f21){return new BPromise(function(_0x23eb7b,_0xa86349){_0x4f6f21=combineOptions(_0x4f6f21);var _0x17f7df=new Buffer(_0x2d4e1c);var _0xe2e167=fs[_0x0d8b('0xf')](_0xe65334);var _0x5cd485=fs[_0x0d8b('0x4')](_0x1567ce);var _0x4586c2=crypto[_0x0d8b('0x10')](_0x4f6f21[_0x0d8b('0x6')],_0x17f7df);_0xe2e167['on'](_0x0d8b('0x7'),function(_0x18dd2d){var _0x264b39=new Buffer(_0x4586c2[_0x0d8b('0x11')](_0x18dd2d),'binary');_0x5cd485[_0x0d8b('0xb')](_0x264b39);});_0xe2e167['on'](_0x0d8b('0x9'),function(){try{var _0x196c0a=new Buffer(_0x4586c2[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x5cd485[_0x0d8b('0xb')](_0x196c0a);_0x5cd485[_0x0d8b('0x9')]();_0x5cd485['on']('close',function(){return _0x23eb7b(_0x1567ce);});}catch(_0x4f0a1a){fs[_0x0d8b('0xd')](_0x1567ce);return _0xa86349(_0x4f0a1a);}});});}; \ No newline at end of file +var _0xd8b0=['data','binary','end','final','write','close','unlink','decryptFile','createReadStream','createDecipher','update','crypto','bluebird','hasOwnProperty','encryptFile','createWriteStream','createCipher','algorithm'];(function(_0x474ee4,_0x17dcaa){var _0xdde2cf=function(_0x71f6c5){while(--_0x71f6c5){_0x474ee4['push'](_0x474ee4['shift']());}};_0xdde2cf(++_0x17dcaa);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var crypto=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var defaultOptions={'algorithm':'aes192'};function combineOptions(_0x585166){var _0x4b72b0={};for(var _0x3ff8df in defaultOptions){if(defaultOptions[_0x0d8b('0x2')](_0x3ff8df)){_0x4b72b0[_0x3ff8df]=defaultOptions[_0x3ff8df];}}if(_0x585166){for(var _0x43bca1 in _0x585166){if(_0x585166[_0x0d8b('0x2')](_0x43bca1)){_0x4b72b0[_0x43bca1]=_0x585166[_0x43bca1];}}}return _0x4b72b0;}exports[_0x0d8b('0x3')]=function(_0x577834,_0x5e15e6,_0x3f8b6f,_0x227c63){return new BPromise(function(_0x39f43a,_0x4a4470){_0x227c63=combineOptions(_0x227c63);var _0x413284=new Buffer(_0x3f8b6f);var _0x284169=fs['createReadStream'](_0x577834);var _0x129310=fs[_0x0d8b('0x4')](_0x5e15e6);var _0x3b027f=crypto[_0x0d8b('0x5')](_0x227c63[_0x0d8b('0x6')],_0x413284);_0x284169['on'](_0x0d8b('0x7'),function(_0x2c5e9e){var _0x28f87c=new Buffer(_0x3b027f['update'](_0x2c5e9e),_0x0d8b('0x8'));_0x129310['write'](_0x28f87c);});_0x284169['on'](_0x0d8b('0x9'),function(){try{var _0xc574a3=new Buffer(_0x3b027f[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x129310[_0x0d8b('0xb')](_0xc574a3);_0x129310[_0x0d8b('0x9')]();_0x129310['on'](_0x0d8b('0xc'),function(){return _0x39f43a(_0x5e15e6);});}catch(_0x1d4bbc){fs[_0x0d8b('0xd')](_0x5e15e6);return _0x4a4470(_0x1d4bbc);}});});};exports[_0x0d8b('0xe')]=function(_0xe65334,_0x1567ce,_0x2d4e1c,_0x4f6f21){return new BPromise(function(_0x23eb7b,_0xa86349){_0x4f6f21=combineOptions(_0x4f6f21);var _0x17f7df=new Buffer(_0x2d4e1c);var _0xe2e167=fs[_0x0d8b('0xf')](_0xe65334);var _0x5cd485=fs[_0x0d8b('0x4')](_0x1567ce);var _0x4586c2=crypto[_0x0d8b('0x10')](_0x4f6f21[_0x0d8b('0x6')],_0x17f7df);_0xe2e167['on'](_0x0d8b('0x7'),function(_0x18dd2d){var _0x264b39=new Buffer(_0x4586c2[_0x0d8b('0x11')](_0x18dd2d),'binary');_0x5cd485[_0x0d8b('0xb')](_0x264b39);});_0xe2e167['on'](_0x0d8b('0x9'),function(){try{var _0x196c0a=new Buffer(_0x4586c2[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x5cd485[_0x0d8b('0xb')](_0x196c0a);_0x5cd485[_0x0d8b('0x9')]();_0x5cd485['on']('close',function(){return _0x23eb7b(_0x1567ce);});}catch(_0x4f0a1a){fs[_0x0d8b('0xd')](_0x1567ce);return _0xa86349(_0x4f0a1a);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 3b0ed28..21e81b1 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 _0x2dae=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','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','Setting','find','split','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.csv','existsSync','mkdirSync','join','each','%s%d.%s','csv','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x2dae,0xc3));var _0xe2da=function(_0x5ebc04,_0x14a363){_0x5ebc04=_0x5ebc04-0x0;var _0x17845c=_0x2dae[_0x5ebc04];return _0x17845c;};'use strict';var util=require(_0xe2da('0x0'));var path=require('path');var _=require(_0xe2da('0x1'));var csv=require(_0xe2da('0x2'));var fs=require('fs');var BPromise=require(_0xe2da('0x3'));var zipdir=require(_0xe2da('0x4'));var rimraf=require(_0xe2da('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xe2da('0x6'))[_0xe2da('0x7')];var logger=require(_0xe2da('0x8'))(_0xe2da('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xe2da('0xa')][0x3];var PATH=process[_0xe2da('0xa')][0x4];function analyticExtractedReport(_0x34cc98,_0x2efbd8){var _0x238da3={'status':_0x34cc98};var _0x1c71ea={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2efbd8){_0x238da3[_0xe2da('0xb')]=_0x2efbd8;}return db[_0xe2da('0xc')][_0xe2da('0xd')](_0x238da3,_0x1c71ea);}function main(){var _0x5a2fc5=0x1388;var _0x52e650;logger[_0xe2da('0xe')](util[_0xe2da('0xf')](_0xe2da('0x10'),EXTRACTED_REPORT_ID,_0xe2da('0x11')));return db[_0xe2da('0x12')][_0xe2da('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe2da('0x14'),'splitSizeCsv']})[_0xe2da('0x15')](function(_0x5200b1){if(_0x5200b1){_0x52e650=_0x5200b1;_0x5a2fc5=_0x52e650[_0xe2da('0x16')]||0x1388;}})[_0xe2da('0x15')](function(){return dbH[_0xe2da('0x17')][_0xe2da('0x18')](util[_0xe2da('0xf')](_0xe2da('0x19'),QUERY),{'type':dbH[_0xe2da('0x17')]['QueryTypes'][_0xe2da('0x1a')]});})['then'](function(_0x586b27){if(!_0x586b27[0x0][_0xe2da('0x1b')]){return analyticExtractedReport(_0xe2da('0x1c'));}var _0x33f919=[];var _0x4dc58b=0x0;var _0x25d4fa=!![];if(_0x586b27&&_0x586b27[_0xe2da('0x1d')]){var _0x2ea60e=_0x586b27[0x0][_0xe2da('0x1b')]%(_0x4dc58b+_0x5a2fc5);if(_0x52e650['split']){for(;_0x25d4fa;_0x4dc58b+=_0x5a2fc5,_0x2ea60e=_0x586b27[0x0][_0xe2da('0x1b')]%(_0x4dc58b+_0x5a2fc5)){if(_0x2ea60e==0x0||_0x2ea60e==_0x586b27[0x0][_0xe2da('0x1b')]){_0x25d4fa=![];}_0x33f919[_0xe2da('0x1e')](dbH[_0xe2da('0x17')][_0xe2da('0x18')](util['format'](_0xe2da('0x1f'),QUERY,_0x5a2fc5,_0x4dc58b),{'type':dbH[_0xe2da('0x17')]['QueryTypes'][_0xe2da('0x1a')]}));}}else{_0x33f919[_0xe2da('0x1e')](dbH[_0xe2da('0x17')][_0xe2da('0x18')](QUERY,{'type':dbH[_0xe2da('0x17')][_0xe2da('0x20')]['SELECT']}));}}var _0x467cd6=path['dirname'](PATH);var _0x30efdc=path[_0xe2da('0x21')](PATH,_0xe2da('0x22'));var _0x28f1d3=_0x52e650[_0xe2da('0x14')]&&_0x33f919[_0xe2da('0x1d')]>0x1;var _0x38f2c4=[];if(!fs[_0xe2da('0x23')](path['join'](_0x467cd6,_0x30efdc))&&_0x28f1d3){fs[_0xe2da('0x24')](path[_0xe2da('0x25')](_0x467cd6,_0x30efdc));}return BPromise[_0xe2da('0x26')](_0x33f919,function(_0x14704d){_0x38f2c4[_0xe2da('0x1e')](_0x14704d);})[_0xe2da('0x15')](function(){for(var _0x124d93=0x0;_0x124d93<_0x38f2c4['length'];_0x124d93+=0x1){var _0x2adc49;var _0x3e23d7=_0x38f2c4[_0x124d93];if(_0x28f1d3){_0x2adc49=path[_0xe2da('0x25')](_0x467cd6,_0x30efdc,util[_0xe2da('0xf')](_0xe2da('0x27'),_0x30efdc,_0x124d93,_0xe2da('0x28')));}else{_0x2adc49=path[_0xe2da('0x25')](_0x467cd6,util[_0xe2da('0xf')]('%s.%s',_0x30efdc,'csv'));}fs['writeFileSync'](_0x2adc49,csv(_0x3e23d7));}})[_0xe2da('0x15')](function(){if(_0x28f1d3){zipdir(path[_0xe2da('0x25')](_0x467cd6,_0x30efdc),{'saveTo':path[_0xe2da('0x25')](_0x467cd6,util[_0xe2da('0xf')]('%s.%s',_0x30efdc,'zip'))},function(_0x356ab4,_0x1ec8ca){});rimraf(path[_0xe2da('0x25')](_0x467cd6,_0x30efdc),function(){});}})[_0xe2da('0x15')](function(){logger[_0xe2da('0xe')](util[_0xe2da('0xf')](_0xe2da('0x29'),EXTRACTED_REPORT_ID,_0xe2da('0x11')));return analyticExtractedReport(_0xe2da('0x2a'),_0x28f1d3?util['format']('%s.%s',_0x30efdc,_0x28f1d3?_0xe2da('0x2b'):_0xe2da('0x28')):null);});})[_0xe2da('0x2c')](function(_0x34f5fe){logger[_0xe2da('0xe')](util[_0xe2da('0xf')](_0xe2da('0x2d'),EXTRACTED_REPORT_ID,_0xe2da('0x11')),util[_0xe2da('0x2e')](_0x34f5fe,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xe2da('0x2f'));});}main(); \ No newline at end of file +var _0x4522=['Setting','find','split','splitSizeCsv','then','format','sequelize','SELECT','num','length','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','existsSync','mkdirSync','join','each','csv','writeFileSync','Completed','%s.%s','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','CSV'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4522,0x1a0));var _0x2452=function(_0x45de25,_0x1fa0a2){_0x45de25=_0x45de25-0x0;var _0x783497=_0x4522[_0x45de25];return _0x783497;};'use strict';var util=require('util');var path=require('path');var _=require(_0x2452('0x0'));var csv=require(_0x2452('0x1'));var fs=require('fs');var BPromise=require(_0x2452('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x2452('0x3'));var db=require(_0x2452('0x4'))['db'];var dbH=require(_0x2452('0x4'))[_0x2452('0x5')];var logger=require(_0x2452('0x6'))(_0x2452('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x2452('0x8')][0x2]);var QUERY=process[_0x2452('0x8')][0x3];var PATH=process[_0x2452('0x8')][0x4];function analyticExtractedReport(_0x149807,_0x3bc193){var _0x33b935={'status':_0x149807};var _0x24073f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3bc193){_0x33b935[_0x2452('0x9')]=_0x3bc193;}return db[_0x2452('0xa')][_0x2452('0xb')](_0x33b935,_0x24073f);}function main(){var _0x5a38e0=0x1388;var _0x5dc630;logger[_0x2452('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2452('0xd')));return db[_0x2452('0xe')][_0x2452('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2452('0x10'),_0x2452('0x11')]})[_0x2452('0x12')](function(_0x2c1e0f){if(_0x2c1e0f){_0x5dc630=_0x2c1e0f;_0x5a38e0=_0x5dc630[_0x2452('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize']['query'](util[_0x2452('0x13')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x2452('0x14')]['QueryTypes'][_0x2452('0x15')]});})[_0x2452('0x12')](function(_0x5d0438){if(!_0x5d0438[0x0][_0x2452('0x16')]){return analyticExtractedReport('Empty');}var _0x3dd8cc=[];var _0x734b88=0x0;var _0x461d2b=!![];if(_0x5d0438&&_0x5d0438[_0x2452('0x17')]){var _0x4e1d20=_0x5d0438[0x0][_0x2452('0x16')]%(_0x734b88+_0x5a38e0);if(_0x5dc630[_0x2452('0x10')]){for(;_0x461d2b;_0x734b88+=_0x5a38e0,_0x4e1d20=_0x5d0438[0x0]['num']%(_0x734b88+_0x5a38e0)){if(_0x4e1d20==0x0||_0x4e1d20==_0x5d0438[0x0]['num']){_0x461d2b=![];}_0x3dd8cc[_0x2452('0x18')](dbH[_0x2452('0x14')][_0x2452('0x19')](util['format'](_0x2452('0x1a'),QUERY,_0x5a38e0,_0x734b88),{'type':dbH[_0x2452('0x14')][_0x2452('0x1b')][_0x2452('0x15')]}));}}else{_0x3dd8cc[_0x2452('0x18')](dbH[_0x2452('0x14')][_0x2452('0x19')](QUERY,{'type':dbH[_0x2452('0x14')]['QueryTypes']['SELECT']}));}}var _0x1f060d=path[_0x2452('0x1c')](PATH);var _0x4bb3ff=path[_0x2452('0x1d')](PATH,_0x2452('0x1e'));var _0x1d5720=_0x5dc630[_0x2452('0x10')]&&_0x3dd8cc[_0x2452('0x17')]>0x1;var _0x397f21=[];if(!fs[_0x2452('0x1f')](path['join'](_0x1f060d,_0x4bb3ff))&&_0x1d5720){fs[_0x2452('0x20')](path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff));}return BPromise[_0x2452('0x22')](_0x3dd8cc,function(_0x231410){_0x397f21[_0x2452('0x18')](_0x231410);})['then'](function(){for(var _0x48783a=0x0;_0x48783a<_0x397f21[_0x2452('0x17')];_0x48783a+=0x1){var _0x159ba1;var _0x46fcbb=_0x397f21[_0x48783a];if(_0x1d5720){_0x159ba1=path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff,util[_0x2452('0x13')]('%s%d.%s',_0x4bb3ff,_0x48783a,_0x2452('0x23')));}else{_0x159ba1=path[_0x2452('0x21')](_0x1f060d,util['format']('%s.%s',_0x4bb3ff,_0x2452('0x23')));}fs[_0x2452('0x24')](_0x159ba1,csv(_0x46fcbb));}})[_0x2452('0x12')](function(){if(_0x1d5720){zipdir(path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff),{'saveTo':path[_0x2452('0x21')](_0x1f060d,util[_0x2452('0x13')]('%s.%s',_0x4bb3ff,'zip'))},function(_0x46b611,_0x454e0a){});rimraf(path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff),function(){});}})['then'](function(){logger[_0x2452('0xc')](util[_0x2452('0x13')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x2452('0xd')));return analyticExtractedReport(_0x2452('0x25'),_0x1d5720?util[_0x2452('0x13')](_0x2452('0x26'),_0x4bb3ff,_0x1d5720?_0x2452('0x27'):_0x2452('0x23')):null);});})[_0x2452('0x28')](function(_0x115e09){logger[_0x2452('0xc')](util[_0x2452('0x13')](_0x2452('0x29'),EXTRACTED_REPORT_ID,_0x2452('0xd')),util[_0x2452('0x2a')](_0x115e09,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index fb33d4d..d94e6f3 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','query','format','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','createWriteStream','finish','err','end','info','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','bluebird','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x464ad3,_0x31ceef){var _0x51b1e2=function(_0x531fac){while(--_0x531fac){_0x464ad3['push'](_0x464ad3['shift']());}};_0x51b1e2(++_0x31ceef);}(_0x5f2f,0x73));var _0xf5f2=function(_0x49ff50,_0x183c50){_0x49ff50=_0x49ff50-0x0;var _0x5c6bea=_0x5f2f[_0x49ff50];return _0x5c6bea;};'use strict';var _=require(_0xf5f2('0x0'));var fs=require('fs');var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var PdfPrinter=require(_0xf5f2('0x5'));var zipdir=require(_0xf5f2('0x6'));var rimraf=require(_0xf5f2('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5f2('0x8')];var logger=require(_0xf5f2('0x9'))(_0xf5f2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf5f2('0xb')][0x2]);var QUERY=process[_0xf5f2('0xb')][0x3];var PATH=process[_0xf5f2('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5f2('0xc');var _extractedReport;function analyticExtractedReport(_0x46cd9c,_0x2ec345){var _0x56a69f={'status':_0x46cd9c};var _0x375da4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ec345){_0x56a69f[_0xf5f2('0xd')]=_0x2ec345;}return db[_0xf5f2('0xe')]['update'](_0x56a69f,_0x375da4);}function getHeader(_0x977a59){var _0x4ebbbe=[];for(var _0x53fb33 in _0x977a59){if(_0x977a59[_0xf5f2('0xf')](_0x53fb33)){_0x4ebbbe[_0xf5f2('0x10')]({'text':_0x53fb33,'style':'tableHeader'});}}return _0x4ebbbe;}function extractReport(_0x336f6b){var _0x14b51f=0x1388;var _0x331482;if(!_0x336f6b[0x0][_0xf5f2('0x11')]){return analyticExtractedReport(_0xf5f2('0x12'));}var _0x3e5956=[];var _0x5c01b8=0x0;var _0x5850f4=!![];var _0xea612c=path[_0xf5f2('0x13')](PATH);var _0x1c1a5c=path[_0xf5f2('0x14')](PATH,'.pdf');var _0xafe430=![];var _0x286197=[];return db[_0xf5f2('0x15')][_0xf5f2('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5f2('0x17'),_0xf5f2('0x18')]})[_0xf5f2('0x19')](function(_0x395a5a){if(_0x395a5a){_0x331482=_0x395a5a;_0x14b51f=_0x331482[_0xf5f2('0x18')]||0x3e8;}})[_0xf5f2('0x19')](function(){if(_0x336f6b&&_0x336f6b[_0xf5f2('0x1a')]){var _0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f);if(_0x331482[_0xf5f2('0x17')]){for(;_0x5850f4;_0x5c01b8+=_0x14b51f,_0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f)){if(_0x28e097==0x0||_0x28e097==_0x336f6b[0x0][_0xf5f2('0x11')]){_0x5850f4=![];}_0x3e5956[_0xf5f2('0x10')](dbH['sequelize'][_0xf5f2('0x1b')](util[_0xf5f2('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14b51f,_0x5c01b8),{'type':dbH['sequelize'][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}else{_0x3e5956['push'](dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](QUERY,{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}_0xafe430=_0x331482['split']&&_0x3e5956[_0xf5f2('0x1a')]>0x1;if(!fs[_0xf5f2('0x20')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c))&&_0xafe430){fs[_0xf5f2('0x22')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c));}return BPromise['each'](_0x3e5956,function(_0x529f07){_0x286197[_0xf5f2('0x10')](_0x529f07);});})[_0xf5f2('0x19')](function(){return BPromise[_0xf5f2('0x23')](_0x3e5956,function(_0x1a5bb3,_0xf6c58d){var _0x788a8d;var _0x13a3be=util[_0xf5f2('0x1c')](_0xf5f2('0x24'),NAME,_extractedReport['name'],moment(_extractedReport[_0xf5f2('0x25')])[_0xf5f2('0x1c')](FORMAT),moment(_extractedReport[_0xf5f2('0x26')])[_0xf5f2('0x1c')](FORMAT));var _0x198c73={'pageSize':'A4','pageOrientation':_0xf5f2('0x27'),'content':[{'text':_0x13a3be,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x22c826={'headerRows':0x1,'body':[]};_0x22c826[_0xf5f2('0x28')][_0xf5f2('0x10')](getHeader(_0x1a5bb3[0x0]));var _0x5027ab;for(var _0x5a2c7e=0x0;_0x5a2c7e<_0x1a5bb3[_0xf5f2('0x1a')];_0x5a2c7e+=0x1){_0x5027ab=[];for(var _0x50b8a2 in _0x1a5bb3[_0x5a2c7e]){if(_0x1a5bb3[_0x5a2c7e][_0xf5f2('0xf')](_0x50b8a2)){_0x5027ab[_0xf5f2('0x10')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]?_[_0xf5f2('0x29')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]):'');}}_0x22c826['body']['push'](_0x5027ab);}_0x198c73[_0xf5f2('0x2a')]['push']({'table':_0x22c826});return new BPromise(function(_0xb744b9,_0x58a4df){var _0x45b643=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf5f2('0x2b'),'bold':__dirname+_0xf5f2('0x2c'),'italics':__dirname+_0xf5f2('0x2d'),'bolditalics':__dirname+_0xf5f2('0x2e')}});var _0x277eee=_0x45b643[_0xf5f2('0x2f')](_0x198c73);if(_0xafe430){_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c,util['format'](_0xf5f2('0x30'),_0x1c1a5c,_0xf6c58d,_0xf5f2('0x31')));}else{_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xf5f2('0x31')));}var _0x297c0c=_0x277eee['pipe'](fs[_0xf5f2('0x33')](_0x788a8d));_0x297c0c['on'](_0xf5f2('0x34'),function(){_0xb744b9();});_0x297c0c['on']('error',function(_0x3fc168){console['log'](_0xf5f2('0x35'),_0x3fc168);_0x58a4df(_0x3fc168);});_0x277eee[_0xf5f2('0x36')]();});});})[_0xf5f2('0x19')](function(){if(_0xafe430){return new BPromise(function(_0x2e3cca,_0x59a6dd){zipdir(path['join'](_0xea612c,_0x1c1a5c),{'saveTo':path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,'zip'))},function(_0x41447f){if(_0x41447f){_0x59a6dd(_0x41447f);}else{_0x2e3cca();}});});}})['then'](function(){if(_0xafe430){rimraf(path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c),function(){});}})['then'](function(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf5f2('0x38')));return analyticExtractedReport(_0xf5f2('0x39'),_0xafe430?util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xafe430?'zip':'pdf'):null);});}function main(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')](_0xf5f2('0x3a'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')));return db[_0xf5f2('0xe')][_0xf5f2('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5f2('0x19')](function(_0x4c0ac7){_extractedReport=_0x4c0ac7;return dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](util['format'](_0xf5f2('0x3d'),QUERY),{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]});})[_0xf5f2('0x19')](extractReport)[_0xf5f2('0x3e')](function(_0x462ea3){logger[_0xf5f2('0x37')](util['format'](_0xf5f2('0x3f'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')),util[_0xf5f2('0x40')](_0x462ea3,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x2991cb,_0x3ee557){var _0x13e078=function(_0x5d44fc){while(--_0x5d44fc){_0x2991cb['push'](_0x2991cb['shift']());}};_0x13e078(++_0x3ee557);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e8874,_0x134292){_0x5e8874=_0x5e8874-0x0;var _0x4bf1de=_0xb10b[_0x5e8874];return _0x4bf1de;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index e7fbef0..209b951 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 _0x0e66=['Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','then','num','push','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','each','xlsx','writeFileSync','binary','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0e66,0xb5));var _0x60e6=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0x0e66[_0x5e6ea3];return _0x4048b5;};'use strict';var util=require(_0x60e6('0x0'));var path=require(_0x60e6('0x1'));var _=require(_0x60e6('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x60e6('0x3'));var rimraf=require(_0x60e6('0x4'));var db=require(_0x60e6('0x5'))['db'];var dbH=require(_0x60e6('0x5'))[_0x60e6('0x6')];var logger=require(_0x60e6('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x60e6('0x8')][0x2]);var QUERY=process[_0x60e6('0x8')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x90524d,_0x2eea52){var _0x57ac87={'status':_0x90524d};var _0x41128f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2eea52){_0x57ac87['savename']=_0x2eea52;}return db['AnalyticExtractedReport'][_0x60e6('0x9')](_0x57ac87,_0x41128f);}function main(){var _0x10cac7=0x1388;var _0xc752ea;logger[_0x60e6('0xa')](util[_0x60e6('0xb')](_0x60e6('0xc'),EXTRACTED_REPORT_ID,_0x60e6('0xd')));return db[_0x60e6('0xe')][_0x60e6('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x60e6('0x10'),_0x60e6('0x11')]})['then'](function(_0x3be534){if(_0x3be534){_0xc752ea=_0x3be534;_0x10cac7=_0xc752ea[_0x60e6('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x60e6('0x12')](util[_0x60e6('0xb')](_0x60e6('0x13'),QUERY),{'type':dbH[_0x60e6('0x14')][_0x60e6('0x15')][_0x60e6('0x16')]});})[_0x60e6('0x17')](function(_0x339e0a){if(!_0x339e0a[0x0][_0x60e6('0x18')]){return analyticExtractedReport('Empty');}var _0x5b893e=[];var _0x2f00b4=0x0;var _0x227d36=!![];if(_0xc752ea[_0x60e6('0x10')]){if(_0x339e0a&&_0x339e0a['length']){var _0x3495c0=_0x339e0a[0x0][_0x60e6('0x18')]%(_0x2f00b4+_0x10cac7);for(;_0x227d36;_0x2f00b4+=_0x10cac7,_0x3495c0=_0x339e0a[0x0][_0x60e6('0x18')]%(_0x2f00b4+_0x10cac7)){if(_0x3495c0==0x0||_0x3495c0==_0x339e0a[0x0][_0x60e6('0x18')]){_0x227d36=![];}_0x5b893e[_0x60e6('0x19')](dbH['sequelize'][_0x60e6('0x12')](util[_0x60e6('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x10cac7,_0x2f00b4),{'type':dbH['sequelize']['QueryTypes'][_0x60e6('0x16')]}));}}}else{_0x5b893e[_0x60e6('0x19')](dbH['sequelize'][_0x60e6('0x12')](QUERY,{'type':dbH['sequelize'][_0x60e6('0x15')][_0x60e6('0x16')]}));}var _0x589460=path[_0x60e6('0x1a')](PATH);var _0x495c31=path[_0x60e6('0x1b')](PATH,_0x60e6('0x1c'));var _0x442cf8=_0xc752ea[_0x60e6('0x10')]&&_0x5b893e[_0x60e6('0x1d')]>0x1;var _0x496d48=[];if(!fs[_0x60e6('0x1e')](path[_0x60e6('0x1f')](_0x589460,_0x495c31))&&_0x442cf8){fs[_0x60e6('0x20')](path[_0x60e6('0x1f')](_0x589460,_0x495c31));}return BPromise[_0x60e6('0x21')](_0x5b893e,function(_0x5efca3){_0x496d48[_0x60e6('0x19')](_0x5efca3);})[_0x60e6('0x17')](function(){for(var _0xe1b9f4=0x0;_0xe1b9f4<_0x496d48[_0x60e6('0x1d')];_0xe1b9f4+=0x1){var _0x4647fe;var _0x8b1c48=_0x496d48[_0xe1b9f4];if(_0x442cf8){_0x4647fe=path[_0x60e6('0x1f')](_0x589460,_0x495c31,util[_0x60e6('0xb')]('%s%d.%s',_0x495c31,_0xe1b9f4,_0x60e6('0x22')));}else{_0x4647fe=path[_0x60e6('0x1f')](_0x589460,util[_0x60e6('0xb')]('%s.%s',_0x495c31,'xlsx'));}fs[_0x60e6('0x23')](_0x4647fe,json2xls(_0x8b1c48),_0x60e6('0x24'));}})[_0x60e6('0x17')](function(){if(_0x442cf8){zipdir(path[_0x60e6('0x1f')](_0x589460,_0x495c31),{'saveTo':path[_0x60e6('0x1f')](_0x589460,util[_0x60e6('0xb')](_0x60e6('0x25'),_0x495c31,'zip'))},function(_0x3fa7ab,_0x2c8410){});rimraf(path[_0x60e6('0x1f')](_0x589460,_0x495c31),function(){});}})[_0x60e6('0x17')](function(){logger[_0x60e6('0xa')](util['format'](_0x60e6('0x26'),EXTRACTED_REPORT_ID,_0x60e6('0xd')));return analyticExtractedReport(_0x60e6('0x27'),_0x442cf8?util[_0x60e6('0xb')]('%s.%s',_0x495c31,_0x442cf8?_0x60e6('0x28'):_0x60e6('0x22')):null);});})[_0x60e6('0x29')](function(_0x5d7092){logger[_0x60e6('0xa')](util[_0x60e6('0xb')](_0x60e6('0x2a'),EXTRACTED_REPORT_ID,_0x60e6('0xd')),util['inspect'](_0x5d7092,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x60e6('0x2b'));});}main(); \ No newline at end of file +var _0x065d=['split','splitSizeXlsx','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','then','num','Empty','length','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','.xlsx','existsSync','join','%s.%s','xlsx','writeFileSync','binary','zip','info','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','Failed','util','lodash','json2xls','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','format','XLSX','Setting'];(function(_0x45450b,_0x46d86a){var _0x4b8b89=function(_0x2eed94){while(--_0x2eed94){_0x45450b['push'](_0x45450b['shift']());}};_0x4b8b89(++_0x46d86a);}(_0x065d,0x6f));var _0xd065=function(_0x2fddb6,_0x421000){_0x2fddb6=_0x2fddb6-0x0;var _0x5ea8ab=_0x065d[_0x2fddb6];return _0x5ea8ab;};'use strict';var util=require(_0xd065('0x0'));var path=require('path');var _=require(_0xd065('0x1'));var fs=require('fs');var json2xls=require(_0xd065('0x2'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0xd065('0x3'))['db'];var dbH=require(_0xd065('0x3'))[_0xd065('0x4')];var logger=require(_0xd065('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd065('0x6')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd065('0x6')][0x4];function analyticExtractedReport(_0xc74d3d,_0x370e71){var _0x3ae7c8={'status':_0xc74d3d};var _0x19a5c1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x370e71){_0x3ae7c8[_0xd065('0x7')]=_0x370e71;}return db[_0xd065('0x8')]['update'](_0x3ae7c8,_0x19a5c1);}function main(){var _0x116ee7=0x1388;var _0x4b0b62;logger['info'](util[_0xd065('0x9')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xd065('0xa')));return db[_0xd065('0xb')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd065('0xc'),_0xd065('0xd')]})['then'](function(_0x1975d1){if(_0x1975d1){_0x4b0b62=_0x1975d1;_0x116ee7=_0x4b0b62[_0xd065('0xd')]||0x1388;}})['then'](function(){return dbH[_0xd065('0xe')]['query'](util[_0xd065('0x9')](_0xd065('0xf'),QUERY),{'type':dbH[_0xd065('0xe')][_0xd065('0x10')]['SELECT']});})[_0xd065('0x11')](function(_0x318bc1){if(!_0x318bc1[0x0][_0xd065('0x12')]){return analyticExtractedReport(_0xd065('0x13'));}var _0x47c735=[];var _0x187d4b=0x0;var _0xb5ee79=!![];if(_0x4b0b62[_0xd065('0xc')]){if(_0x318bc1&&_0x318bc1[_0xd065('0x14')]){var _0x45de7a=_0x318bc1[0x0]['num']%(_0x187d4b+_0x116ee7);for(;_0xb5ee79;_0x187d4b+=_0x116ee7,_0x45de7a=_0x318bc1[0x0][_0xd065('0x12')]%(_0x187d4b+_0x116ee7)){if(_0x45de7a==0x0||_0x45de7a==_0x318bc1[0x0][_0xd065('0x12')]){_0xb5ee79=![];}_0x47c735[_0xd065('0x15')](dbH['sequelize'][_0xd065('0x16')](util['format'](_0xd065('0x17'),QUERY,_0x116ee7,_0x187d4b),{'type':dbH[_0xd065('0xe')][_0xd065('0x10')][_0xd065('0x18')]}));}}}else{_0x47c735[_0xd065('0x15')](dbH[_0xd065('0xe')][_0xd065('0x16')](QUERY,{'type':dbH[_0xd065('0xe')][_0xd065('0x10')][_0xd065('0x18')]}));}var _0xcaf3a3=path[_0xd065('0x19')](PATH);var _0x3c5504=path['basename'](PATH,_0xd065('0x1a'));var _0x15414d=_0x4b0b62[_0xd065('0xc')]&&_0x47c735['length']>0x1;var _0x54d9e4=[];if(!fs[_0xd065('0x1b')](path[_0xd065('0x1c')](_0xcaf3a3,_0x3c5504))&&_0x15414d){fs['mkdirSync'](path[_0xd065('0x1c')](_0xcaf3a3,_0x3c5504));}return BPromise['each'](_0x47c735,function(_0x26db1f){_0x54d9e4[_0xd065('0x15')](_0x26db1f);})[_0xd065('0x11')](function(){for(var _0x41a7a2=0x0;_0x41a7a2<_0x54d9e4[_0xd065('0x14')];_0x41a7a2+=0x1){var _0x2dbb47;var _0x5e2316=_0x54d9e4[_0x41a7a2];if(_0x15414d){_0x2dbb47=path[_0xd065('0x1c')](_0xcaf3a3,_0x3c5504,util[_0xd065('0x9')]('%s%d.%s',_0x3c5504,_0x41a7a2,'xlsx'));}else{_0x2dbb47=path['join'](_0xcaf3a3,util[_0xd065('0x9')](_0xd065('0x1d'),_0x3c5504,_0xd065('0x1e')));}fs[_0xd065('0x1f')](_0x2dbb47,json2xls(_0x5e2316),_0xd065('0x20'));}})['then'](function(){if(_0x15414d){zipdir(path[_0xd065('0x1c')](_0xcaf3a3,_0x3c5504),{'saveTo':path['join'](_0xcaf3a3,util['format'](_0xd065('0x1d'),_0x3c5504,_0xd065('0x21')))},function(_0x31c662,_0x1af41d){});rimraf(path['join'](_0xcaf3a3,_0x3c5504),function(){});}})['then'](function(){logger[_0xd065('0x22')](util[_0xd065('0x9')](_0xd065('0x23'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xd065('0x24'),_0x15414d?util['format'](_0xd065('0x1d'),_0x3c5504,_0x15414d?'zip':_0xd065('0x1e')):null);});})[_0xd065('0x25')](function(_0x1fd2ee){logger['info'](util[_0xd065('0x9')](_0xd065('0x26'),EXTRACTED_REPORT_ID,_0xd065('0xa')),util[_0xd065('0x27')](_0x1fd2ee,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xd065('0x28'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index d869637..5b58e05 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 _0x98b8=['Hangup','transaction','destroy','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extensions','extension','find','push','type','Set','format','priority','VoiceExtensionId','CDR(destination)=','cutdigits','${EXTEN:','context','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat'];(function(_0x3f08e8,_0x2d312d){var _0x162e1f=function(_0x337498){while(--_0x337498){_0x3f08e8['push'](_0x3f08e8['shift']());}};_0x162e1f(++_0x2d312d);}(_0x98b8,0x93));var _0x898b=function(_0xf0d35,_0xce9c1c){_0xf0d35=_0xf0d35-0x0;var _0x5ba3bc=_0x98b8[_0xf0d35];return _0x5ba3bc;};'use strict';var _=require(_0x898b('0x0'));var util=require(_0x898b('0x1'));function rewrite(_0x43dfc2,_0x45d860){var _0x17a43c=this;return _0x43dfc2[_0x898b('0x2')][_0x898b('0x3')][_0x898b('0x4')]({'raw':!![]})[_0x898b('0x5')](function(_0x7aea2f){_0x17a43c[_0x898b('0x6')]=_0x7aea2f;return _0x43dfc2[_0x898b('0x2')][_0x898b('0x7')][_0x898b('0x4')]({'where':{'IntervalId':_0x45d860[_0x898b('0x8')]},'raw':!![]});})['then'](function(_0x3989f9){return _0x43dfc2[_0x898b('0x2')][_0x898b('0x7')][_0x898b('0x4')]({'where':{'exten':{'$in':_[_0x898b('0x9')](_[_0x898b('0xa')](_0x3989f9,_0x898b('0xb')))}},'order':[{'raw':_0x898b('0xc')}],'raw':!![]});})['then'](function(_0x2b7b79){var _0x4b4b44=_['filter'](_0x2b7b79,{'priority':'1'});var _0x4548f8=_[_0x898b('0xd')](_0x2b7b79,{'isApp':0x1});var _0x2ed188=_[_0x898b('0xe')](_0x4548f8,_0x898b('0xb'));var _0xdee6a3=[_0x898b('0xf'),_0x898b('0x10')];var _0x88230c=[];var _0x405aa0=[];for(var _0x20669c in _0x2ed188){if(_0x2ed188[_0x898b('0x11')](_0x20669c)){_0x17a43c['priority']=0x2;_0x17a43c[_0x898b('0x12')]=[];_0x17a43c[_0x898b('0x13')]=_[_0x898b('0x14')](_0x4b4b44,{'exten':_0x2ed188[_0x20669c][0x0]['exten']});_0x17a43c['extensions'][_0x898b('0x15')]({'type':_0x2ed188[_0x20669c][0x0][_0x898b('0x16')],'app':_0x898b('0x17'),'appdata':util[_0x898b('0x18')]('CDR(type)=%s',_0x2ed188[_0x20669c][0x0][_0x898b('0x16')]),'context':_0x2ed188[_0x20669c][0x0]['context'],'exten':_0x2ed188[_0x20669c][0x0]['exten'],'priority':_0x17a43c[_0x898b('0x19')]++,'VoiceExtensionId':_0x2ed188[_0x20669c][0x0][_0x898b('0x1a')]});if(_0x2ed188[_0x20669c][0x0][_0x898b('0x16')]==='outbound'){if(_0x17a43c[_0x898b('0x13')]){_0x17a43c[_0x898b('0x12')][_0x898b('0x15')]({'type':_0x2ed188[_0x20669c][0x0][_0x898b('0x16')],'app':_0x898b('0x17'),'appdata':_0x898b('0x1b')+(_0x17a43c[_0x898b('0x13')][_0x898b('0x1c')]?_0x898b('0x1d')+_0x17a43c[_0x898b('0x13')]['cutdigits']+'}':'${EXTEN}'),'context':_0x2ed188[_0x20669c][0x0][_0x898b('0x1e')],'exten':_0x2ed188[_0x20669c][0x0][_0x898b('0xb')],'priority':_0x17a43c['priority']++,'VoiceExtensionId':_0x2ed188[_0x20669c][0x0][_0x898b('0x1a')]});}_0x17a43c[_0x898b('0x12')][_0x898b('0x15')]({'type':_0x2ed188[_0x20669c][0x0]['type'],'app':'Set','appdata':_0x898b('0x1f')+_0x2ed188[_0x20669c][0x0][_0x898b('0x1a')],'context':_0x2ed188[_0x20669c][0x0][_0x898b('0x1e')],'exten':_0x2ed188[_0x20669c][0x0][_0x898b('0xb')],'priority':_0x17a43c[_0x898b('0x19')]++,'VoiceExtensionId':_0x2ed188[_0x20669c][0x0][_0x898b('0x1a')]});var _0x11c558=_0x17a43c[_0x898b('0x19')]++;_0x17a43c[_0x898b('0x12')][_0x898b('0x15')]({'type':_0x2ed188[_0x20669c][0x0][_0x898b('0x16')],'app':_0x898b('0x20'),'appdata':_0x898b('0x21')+(_0x11c558+0x2)+'):Goto('+(_0x11c558+0x1)+')','context':_0x2ed188[_0x20669c][0x0]['context'],'exten':_0x2ed188[_0x20669c][0x0][_0x898b('0xb')],'priority':_0x11c558,'VoiceExtensionId':_0x2ed188[_0x20669c][0x0][_0x898b('0x1a')]});if(_0x17a43c[_0x898b('0x13')]){_0x17a43c[_0x898b('0x12')][_0x898b('0x15')]({'type':_0x2ed188[_0x20669c][0x0][_0x898b('0x16')],'app':_0x898b('0x17'),'appdata':_0x17a43c[_0x898b('0x13')][_0x898b('0x1c')]?_0x898b('0x22')+_0x17a43c['extension']['cutdigits']+'}':_0x898b('0x23'),'context':_0x2ed188[_0x20669c][0x0][_0x898b('0x1e')],'exten':_0x2ed188[_0x20669c][0x0]['exten'],'priority':_0x17a43c[_0x898b('0x19')]++,'VoiceExtensionId':_0x2ed188[_0x20669c][0x0][_0x898b('0x1a')]});}_0x17a43c[_0x898b('0x12')][_0x898b('0x15')]({'type':_0x2ed188[_0x20669c][0x0][_0x898b('0x16')],'app':_0x898b('0x17'),'appdata':'outboundrouteid='+_0x2ed188[_0x20669c][0x0][_0x898b('0x1a')],'context':_0x2ed188[_0x20669c][0x0][_0x898b('0x1e')],'exten':_0x2ed188[_0x20669c][0x0]['exten'],'priority':_0x17a43c[_0x898b('0x19')]++,'VoiceExtensionId':_0x2ed188[_0x20669c][0x0]['VoiceExtensionId']});if(_0x17a43c[_0x898b('0x13')]&&_0x17a43c[_0x898b('0x13')]['hasOwnProperty'](_0x898b('0x24'))&&_0x17a43c['extension']['recordingFormat']!==_0x898b('0x25')){_0x17a43c[_0x898b('0x12')][_0x898b('0x15')]({'type':_0x2ed188[_0x20669c][0x0][_0x898b('0x16')],'app':_0x898b('0x17'),'appdata':_0x898b('0x26'),'context':_0x2ed188[_0x20669c][0x0][_0x898b('0x1e')],'exten':_0x2ed188[_0x20669c][0x0][_0x898b('0xb')],'priority':_0x17a43c[_0x898b('0x19')]++,'VoiceExtensionId':_0x2ed188[_0x20669c][0x0][_0x898b('0x1a')]});_0x17a43c[_0x898b('0x12')][_0x898b('0x15')]({'type':_0x2ed188[_0x20669c][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x17a43c['extension'][_0x898b('0x24')]||_0x898b('0x27'),'context':_0x2ed188[_0x20669c][0x0][_0x898b('0x1e')],'exten':_0x2ed188[_0x20669c][0x0]['exten'],'priority':_0x17a43c[_0x898b('0x19')]++,'VoiceExtensionId':_0x2ed188[_0x20669c][0x0][_0x898b('0x1a')]});}}_0x17a43c[_0x898b('0x12')][_0x898b('0x15')]({'type':_0x2ed188[_0x20669c][0x0][_0x898b('0x16')],'app':'Set','appdata':_0x898b('0x28'),'context':_0x2ed188[_0x20669c][0x0][_0x898b('0x1e')],'exten':_0x2ed188[_0x20669c][0x0][_0x898b('0xb')],'priority':_0x17a43c['priority']++,'VoiceExtensionId':_0x2ed188[_0x20669c][0x0][_0x898b('0x1a')]});_0x17a43c[_0x898b('0x12')]['push']({'type':_0x2ed188[_0x20669c][0x0][_0x898b('0x16')],'app':_0x898b('0x17'),'appdata':_0x898b('0x29'),'context':_0x2ed188[_0x20669c][0x0][_0x898b('0x1e')],'exten':_0x2ed188[_0x20669c][0x0]['exten'],'priority':_0x17a43c[_0x898b('0x19')]++,'VoiceExtensionId':_0x2ed188[_0x20669c][0x0][_0x898b('0x1a')]});_0x17a43c[_0x898b('0x12')][_0x898b('0x15')]({'type':_0x2ed188[_0x20669c][0x0][_0x898b('0x16')],'app':_0x898b('0x17'),'appdata':_0x898b('0x2a'),'context':_0x2ed188[_0x20669c][0x0][_0x898b('0x1e')],'exten':_0x2ed188[_0x20669c][0x0][_0x898b('0xb')],'priority':_0x17a43c[_0x898b('0x19')]++,'VoiceExtensionId':_0x2ed188[_0x20669c][0x0]['VoiceExtensionId']});for(var _0x5d86cb=0x0,_0x395428=0x0;_0x5d86cb<_0x2ed188[_0x20669c][_0x898b('0x2b')];_0x5d86cb+=0x1,_0x395428=0x0){var _0x39c383=_0x2ed188[_0x20669c][_0x5d86cb];if(_0x39c383[_0x898b('0x16')]){_0x39c383['type']=_0x39c383[_0x898b('0x16')][_0x898b('0x2c')]();}var _0x3de871=[];var _0xfbc6ea=[];delete _0x39c383['id'];delete _0x39c383['createdAt'];delete _0x39c383[_0x898b('0x2d')];var _0x2f363e=_0x39c383['interval']!==_0x898b('0x2e')?[_0x39c383[_0x898b('0x2f')]]:_0x39c383['IntervalId']?_[_0x898b('0xa')](_['filter'](_0x17a43c[_0x898b('0x6')],{'IntervalId':_0x39c383['IntervalId']}),_0x898b('0x2f')):[];if(_0x39c383[_0x898b('0x11')](_0x898b('0x30'))){if(_0x39c383[_0x898b('0x30')]&&_0x39c383[_0x898b('0x30')]!=='--'){_0x3de871['push']({'type':_0x39c383[_0x898b('0x16')],'app':_0x898b('0x17'),'appdata':_0x898b('0x31')+_0x39c383['tag'],'context':_0x39c383[_0x898b('0x1e')],'exten':_0x39c383[_0x898b('0xb')],'priority':_0x2f363e['length']+_0x17a43c[_0x898b('0x19')]+_0x395428++,'VoiceExtensionId':_0x39c383[_0x898b('0x1a')]});}}if(_0x39c383[_0x898b('0x16')]===_0x898b('0x32')&&_0x39c383[_0x898b('0x11')](_0x898b('0x33'))){if(_0x39c383['callerID']){_0x3de871['push']({'type':_0x39c383[_0x898b('0x16')],'app':_0x898b('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x39c383[_0x898b('0x33')]+')','context':_0x39c383[_0x898b('0x1e')],'exten':_0x39c383[_0x898b('0xb')],'priority':_0x2f363e[_0x898b('0x2b')]+_0x17a43c[_0x898b('0x19')]+_0x395428++,'VoiceExtensionId':_0x39c383[_0x898b('0x1a')]});}else{_0x3de871['push']({'type':_0x39c383['type'],'app':'ExecIf','appdata':_0x898b('0x34'),'context':_0x39c383[_0x898b('0x1e')],'exten':_0x39c383['exten'],'priority':_0x2f363e[_0x898b('0x2b')]+_0x17a43c[_0x898b('0x19')]+_0x395428++,'VoiceExtensionId':_0x39c383[_0x898b('0x1a')]});}}if(_0x39c383[_0x898b('0x11')]('answer')){if(_0xdee6a3[_0x898b('0x35')](_0x39c383['app'][_0x898b('0x2c')]())>=0x0&&_0x39c383['appType']!==_0x898b('0x36')){if(_0x39c383[_0x898b('0x37')]){_0x3de871[_0x898b('0x15')]({'type':_0x39c383['type'],'app':_0x898b('0x20'),'appdata':_0x898b('0x38'),'context':_0x39c383[_0x898b('0x1e')],'exten':_0x39c383[_0x898b('0xb')],'priority':_0x2f363e[_0x898b('0x2b')]+_0x17a43c['priority']+_0x395428++,'VoiceExtensionId':_0x39c383['VoiceExtensionId']});_0x3de871[_0x898b('0x15')]({'type':_0x39c383[_0x898b('0x16')],'app':_0x898b('0x17'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x39c383[_0x898b('0x1e')],'exten':_0x39c383['exten'],'priority':_0x2f363e[_0x898b('0x2b')]+_0x17a43c[_0x898b('0x19')]+_0x395428++,'VoiceExtensionId':_0x39c383['VoiceExtensionId']});}else{_0x3de871['push']({'type':_0x39c383[_0x898b('0x16')],'app':_0x898b('0x20'),'appdata':_0x898b('0x39'),'context':_0x39c383['context'],'exten':_0x39c383['exten'],'priority':_0x2f363e['length']+_0x17a43c[_0x898b('0x19')]+_0x395428++,'VoiceExtensionId':_0x39c383[_0x898b('0x1a')]});_0x3de871[_0x898b('0x15')]({'type':_0x39c383[_0x898b('0x16')],'app':_0x898b('0x17'),'appdata':_0x898b('0x3a'),'context':_0x39c383['context'],'exten':_0x39c383[_0x898b('0xb')],'priority':_0x2f363e[_0x898b('0x2b')]+_0x17a43c[_0x898b('0x19')]+_0x395428++,'VoiceExtensionId':_0x39c383[_0x898b('0x1a')]});}}}for(var _0x2865ac=0x0;_0x2865ac<_0x2f363e[_0x898b('0x2b')];_0x2865ac+=0x1){var _0x55cc05=_0x17a43c['priority']+_0x2f363e[_0x898b('0x2b')];var _0x163f51=_0x2865ac===_0x2f363e[_0x898b('0x2b')]-0x1?_0x17a43c[_0x898b('0x19')]+_0x3de871[_0x898b('0x2b')]+_0xfbc6ea[_0x898b('0x2b')]+0x2:_0x17a43c['priority']+_0x2865ac+0x1;_0x3de871[_0x898b('0x3b')](_0x2865ac,0x0,{'type':_0x39c383[_0x898b('0x16')],'app':'GotoIfTime','appdata':_0x2f363e[_0x2865ac]+'?'+_0x39c383[_0x898b('0x1e')]+',${EXTEN},'+_0x55cc05+':'+_0x39c383[_0x898b('0x1e')]+_0x898b('0x3c')+_0x163f51,'exten':_0x39c383[_0x898b('0xb')],'context':_0x39c383[_0x898b('0x1e')],'priority':_0x17a43c[_0x898b('0x19')]+_0x2865ac,'VoiceExtensionId':_0x2ed188[_0x20669c][0x0][_0x898b('0x1a')]});}_0x39c383[_0x898b('0x19')]=_0x3de871[_0x898b('0x2b')]?_['last'](_0x3de871)[_0x898b('0x19')]+0x1:_0x17a43c[_0x898b('0x19')];_0x17a43c[_0x898b('0x19')]=(_0xfbc6ea['length']?_[_0x898b('0x3d')](_0xfbc6ea)[_0x898b('0x19')]:_0x39c383[_0x898b('0x19')])+0x1;_0x17a43c[_0x898b('0x12')]=_[_0x898b('0x3e')](_0x17a43c['extensions'],_0x3de871,[_0x39c383],_0xfbc6ea);}_0x17a43c[_0x898b('0x12')][_0x898b('0x15')]({'type':_0x2ed188[_0x20669c][0x0][_0x898b('0x16')],'app':_0x898b('0x3f'),'exten':_0x2ed188[_0x20669c][0x0]['exten'],'context':_0x2ed188[_0x20669c][0x0]['context'],'priority':_0x17a43c['priority'],'VoiceExtensionId':_0x2ed188[_0x20669c][0x0]['VoiceExtensionId']});_0x88230c[_0x898b('0x15')](_0x2ed188[_0x20669c][0x0][_0x898b('0x1a')]);_0x405aa0=_[_0x898b('0x3e')](_0x405aa0,_0x17a43c[_0x898b('0x12')]);}}return _0x43dfc2[_0x898b('0x40')](function(_0x445860){return _0x43dfc2[_0x898b('0x2')][_0x898b('0x7')][_0x898b('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x88230c}},'transaction':_0x445860})[_0x898b('0x5')](function(_0x40b091){return _0x43dfc2[_0x898b('0x2')][_0x898b('0x7')][_0x898b('0x42')](_[_0x898b('0x43')](_0x405aa0,'priority'),{'transaction':_0x445860});});});})[_0x898b('0x44')](function(_0x4a099a){console['error'](_0x4a099a);});}exports[_0x898b('0x45')]=rewrite; \ No newline at end of file +var _0x1849=['exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','hasOwnProperty','priority','extensions','extension','push','Set','format','CDR(type)=%s','type','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','context','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','*,*,*,*','interval','map','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','then','uniq'];(function(_0x54fc1f,_0x1703c2){var _0x53f699=function(_0x3fad74){while(--_0x3fad74){_0x54fc1f['push'](_0x54fc1f['shift']());}};_0x53f699(++_0x1703c2);}(_0x1849,0x7e));var _0x9184=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1849[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9184('0x0'));var util=require(_0x9184('0x1'));function rewrite(_0xbfcba9,_0x43b37d){var _0x4366ab=this;return _0xbfcba9[_0x9184('0x2')][_0x9184('0x3')][_0x9184('0x4')]({'raw':!![]})['then'](function(_0x192759){_0x4366ab[_0x9184('0x5')]=_0x192759;return _0xbfcba9[_0x9184('0x2')][_0x9184('0x6')][_0x9184('0x4')]({'where':{'IntervalId':_0x43b37d[_0x9184('0x7')]},'raw':!![]});})[_0x9184('0x8')](function(_0x30bfdb){return _0xbfcba9[_0x9184('0x2')]['VoiceExtension'][_0x9184('0x4')]({'where':{'exten':{'$in':_[_0x9184('0x9')](_['map'](_0x30bfdb,_0x9184('0xa')))}},'order':[{'raw':_0x9184('0xb')}],'raw':!![]});})[_0x9184('0x8')](function(_0x265c27){var _0x3c98b1=_['filter'](_0x265c27,{'priority':'1'});var _0x3630f9=_[_0x9184('0xc')](_0x265c27,{'isApp':0x1});var _0x3a58b5=_['groupBy'](_0x3630f9,_0x9184('0xa'));var _0x70b6f1=[_0x9184('0xd'),'playback'];var _0x24994b=[];var _0x34b1ea=[];for(var _0x472493 in _0x3a58b5){if(_0x3a58b5[_0x9184('0xe')](_0x472493)){_0x4366ab[_0x9184('0xf')]=0x2;_0x4366ab[_0x9184('0x10')]=[];_0x4366ab[_0x9184('0x11')]=_['find'](_0x3c98b1,{'exten':_0x3a58b5[_0x472493][0x0]['exten']});_0x4366ab[_0x9184('0x10')][_0x9184('0x12')]({'type':_0x3a58b5[_0x472493][0x0]['type'],'app':_0x9184('0x13'),'appdata':util[_0x9184('0x14')](_0x9184('0x15'),_0x3a58b5[_0x472493][0x0][_0x9184('0x16')]),'context':_0x3a58b5[_0x472493][0x0]['context'],'exten':_0x3a58b5[_0x472493][0x0][_0x9184('0xa')],'priority':_0x4366ab[_0x9184('0xf')]++,'VoiceExtensionId':_0x3a58b5[_0x472493][0x0][_0x9184('0x17')]});if(_0x3a58b5[_0x472493][0x0][_0x9184('0x16')]===_0x9184('0x18')){if(_0x4366ab[_0x9184('0x11')]){_0x4366ab[_0x9184('0x10')][_0x9184('0x12')]({'type':_0x3a58b5[_0x472493][0x0][_0x9184('0x16')],'app':_0x9184('0x13'),'appdata':_0x9184('0x19')+(_0x4366ab[_0x9184('0x11')][_0x9184('0x1a')]?_0x9184('0x1b')+_0x4366ab[_0x9184('0x11')]['cutdigits']+'}':_0x9184('0x1c')),'context':_0x3a58b5[_0x472493][0x0][_0x9184('0x1d')],'exten':_0x3a58b5[_0x472493][0x0]['exten'],'priority':_0x4366ab[_0x9184('0xf')]++,'VoiceExtensionId':_0x3a58b5[_0x472493][0x0][_0x9184('0x17')]});}_0x4366ab[_0x9184('0x10')][_0x9184('0x12')]({'type':_0x3a58b5[_0x472493][0x0][_0x9184('0x16')],'app':_0x9184('0x13'),'appdata':'CDR(routeid)='+_0x3a58b5[_0x472493][0x0][_0x9184('0x17')],'context':_0x3a58b5[_0x472493][0x0][_0x9184('0x1d')],'exten':_0x3a58b5[_0x472493][0x0]['exten'],'priority':_0x4366ab[_0x9184('0xf')]++,'VoiceExtensionId':_0x3a58b5[_0x472493][0x0]['VoiceExtensionId']});var _0x256d3e=_0x4366ab[_0x9184('0xf')]++;_0x4366ab['extensions'][_0x9184('0x12')]({'type':_0x3a58b5[_0x472493][0x0][_0x9184('0x16')],'app':_0x9184('0x1e'),'appdata':_0x9184('0x1f')+(_0x256d3e+0x2)+_0x9184('0x20')+(_0x256d3e+0x1)+')','context':_0x3a58b5[_0x472493][0x0][_0x9184('0x1d')],'exten':_0x3a58b5[_0x472493][0x0][_0x9184('0xa')],'priority':_0x256d3e,'VoiceExtensionId':_0x3a58b5[_0x472493][0x0][_0x9184('0x17')]});if(_0x4366ab[_0x9184('0x11')]){_0x4366ab[_0x9184('0x10')][_0x9184('0x12')]({'type':_0x3a58b5[_0x472493][0x0]['type'],'app':_0x9184('0x13'),'appdata':_0x4366ab[_0x9184('0x11')][_0x9184('0x1a')]?_0x9184('0x21')+_0x4366ab['extension'][_0x9184('0x1a')]+'}':'CDR(prefix)=noprefix','context':_0x3a58b5[_0x472493][0x0]['context'],'exten':_0x3a58b5[_0x472493][0x0][_0x9184('0xa')],'priority':_0x4366ab['priority']++,'VoiceExtensionId':_0x3a58b5[_0x472493][0x0][_0x9184('0x17')]});}_0x4366ab[_0x9184('0x10')][_0x9184('0x12')]({'type':_0x3a58b5[_0x472493][0x0][_0x9184('0x16')],'app':'Set','appdata':_0x9184('0x22')+_0x3a58b5[_0x472493][0x0]['VoiceExtensionId'],'context':_0x3a58b5[_0x472493][0x0][_0x9184('0x1d')],'exten':_0x3a58b5[_0x472493][0x0]['exten'],'priority':_0x4366ab['priority']++,'VoiceExtensionId':_0x3a58b5[_0x472493][0x0][_0x9184('0x17')]});if(_0x4366ab[_0x9184('0x11')]&&_0x4366ab[_0x9184('0x11')][_0x9184('0xe')]('recordingFormat')&&_0x4366ab[_0x9184('0x11')]['recordingFormat']!==_0x9184('0x23')){_0x4366ab[_0x9184('0x10')]['push']({'type':_0x3a58b5[_0x472493][0x0][_0x9184('0x16')],'app':_0x9184('0x13'),'appdata':_0x9184('0x24'),'context':_0x3a58b5[_0x472493][0x0][_0x9184('0x1d')],'exten':_0x3a58b5[_0x472493][0x0][_0x9184('0xa')],'priority':_0x4366ab[_0x9184('0xf')]++,'VoiceExtensionId':_0x3a58b5[_0x472493][0x0][_0x9184('0x17')]});_0x4366ab['extensions'][_0x9184('0x12')]({'type':_0x3a58b5[_0x472493][0x0]['type'],'app':'Set','appdata':_0x9184('0x25')+_0x4366ab[_0x9184('0x11')]['recordingFormat']||_0x9184('0x26'),'context':_0x3a58b5[_0x472493][0x0][_0x9184('0x1d')],'exten':_0x3a58b5[_0x472493][0x0][_0x9184('0xa')],'priority':_0x4366ab['priority']++,'VoiceExtensionId':_0x3a58b5[_0x472493][0x0][_0x9184('0x17')]});}}_0x4366ab[_0x9184('0x10')]['push']({'type':_0x3a58b5[_0x472493][0x0]['type'],'app':_0x9184('0x13'),'appdata':_0x9184('0x27'),'context':_0x3a58b5[_0x472493][0x0]['context'],'exten':_0x3a58b5[_0x472493][0x0]['exten'],'priority':_0x4366ab[_0x9184('0xf')]++,'VoiceExtensionId':_0x3a58b5[_0x472493][0x0]['VoiceExtensionId']});_0x4366ab[_0x9184('0x10')]['push']({'type':_0x3a58b5[_0x472493][0x0][_0x9184('0x16')],'app':_0x9184('0x13'),'appdata':_0x9184('0x28'),'context':_0x3a58b5[_0x472493][0x0][_0x9184('0x1d')],'exten':_0x3a58b5[_0x472493][0x0][_0x9184('0xa')],'priority':_0x4366ab['priority']++,'VoiceExtensionId':_0x3a58b5[_0x472493][0x0][_0x9184('0x17')]});_0x4366ab[_0x9184('0x10')]['push']({'type':_0x3a58b5[_0x472493][0x0][_0x9184('0x16')],'app':_0x9184('0x13'),'appdata':_0x9184('0x29'),'context':_0x3a58b5[_0x472493][0x0]['context'],'exten':_0x3a58b5[_0x472493][0x0]['exten'],'priority':_0x4366ab[_0x9184('0xf')]++,'VoiceExtensionId':_0x3a58b5[_0x472493][0x0][_0x9184('0x17')]});for(var _0x3c1395=0x0,_0x277f30=0x0;_0x3c1395<_0x3a58b5[_0x472493][_0x9184('0x2a')];_0x3c1395+=0x1,_0x277f30=0x0){var _0x25c568=_0x3a58b5[_0x472493][_0x3c1395];if(_0x25c568[_0x9184('0x16')]){_0x25c568[_0x9184('0x16')]=_0x25c568[_0x9184('0x16')]['toLowerCase']();}var _0x54d004=[];var _0x119bc9=[];delete _0x25c568['id'];delete _0x25c568[_0x9184('0x2b')];delete _0x25c568[_0x9184('0x2c')];var _0x152d10=_0x25c568['interval']!==_0x9184('0x2d')?[_0x25c568[_0x9184('0x2e')]]:_0x25c568[_0x9184('0x7')]?_[_0x9184('0x2f')](_[_0x9184('0xc')](_0x4366ab[_0x9184('0x5')],{'IntervalId':_0x25c568[_0x9184('0x7')]}),_0x9184('0x2e')):[];if(_0x25c568['hasOwnProperty'](_0x9184('0x30'))){if(_0x25c568['tag']&&_0x25c568[_0x9184('0x30')]!=='--'){_0x54d004['push']({'type':_0x25c568[_0x9184('0x16')],'app':_0x9184('0x13'),'appdata':'CDR(tag)='+_0x25c568['tag'],'context':_0x25c568[_0x9184('0x1d')],'exten':_0x25c568[_0x9184('0xa')],'priority':_0x152d10[_0x9184('0x2a')]+_0x4366ab['priority']+_0x277f30++,'VoiceExtensionId':_0x25c568['VoiceExtensionId']});}}if(_0x25c568[_0x9184('0x16')]==='outbound'&&_0x25c568[_0x9184('0xe')]('callerID')){if(_0x25c568['callerID']){_0x54d004[_0x9184('0x12')]({'type':_0x25c568[_0x9184('0x16')],'app':_0x9184('0x1e'),'appdata':_0x9184('0x31')+_0x25c568['callerID']+')','context':_0x25c568['context'],'exten':_0x25c568[_0x9184('0xa')],'priority':_0x152d10['length']+_0x4366ab[_0x9184('0xf')]+_0x277f30++,'VoiceExtensionId':_0x25c568[_0x9184('0x17')]});}else{_0x54d004['push']({'type':_0x25c568['type'],'app':_0x9184('0x1e'),'appdata':_0x9184('0x32'),'context':_0x25c568[_0x9184('0x1d')],'exten':_0x25c568['exten'],'priority':_0x152d10[_0x9184('0x2a')]+_0x4366ab[_0x9184('0xf')]+_0x277f30++,'VoiceExtensionId':_0x25c568[_0x9184('0x17')]});}}if(_0x25c568[_0x9184('0xe')](_0x9184('0x33'))){if(_0x70b6f1[_0x9184('0x34')](_0x25c568['app']['toLowerCase']())>=0x0&&_0x25c568[_0x9184('0x35')]!=='custom'){if(_0x25c568[_0x9184('0x33')]){_0x54d004['push']({'type':_0x25c568[_0x9184('0x16')],'app':_0x9184('0x1e'),'appdata':_0x9184('0x36'),'context':_0x25c568[_0x9184('0x1d')],'exten':_0x25c568[_0x9184('0xa')],'priority':_0x152d10[_0x9184('0x2a')]+_0x4366ab[_0x9184('0xf')]+_0x277f30++,'VoiceExtensionId':_0x25c568[_0x9184('0x17')]});_0x54d004[_0x9184('0x12')]({'type':_0x25c568[_0x9184('0x16')],'app':_0x9184('0x13'),'appdata':_0x9184('0x37'),'context':_0x25c568[_0x9184('0x1d')],'exten':_0x25c568[_0x9184('0xa')],'priority':_0x152d10[_0x9184('0x2a')]+_0x4366ab[_0x9184('0xf')]+_0x277f30++,'VoiceExtensionId':_0x25c568[_0x9184('0x17')]});}else{_0x54d004[_0x9184('0x12')]({'type':_0x25c568[_0x9184('0x16')],'app':_0x9184('0x1e'),'appdata':_0x9184('0x38'),'context':_0x25c568[_0x9184('0x1d')],'exten':_0x25c568[_0x9184('0xa')],'priority':_0x152d10[_0x9184('0x2a')]+_0x4366ab['priority']+_0x277f30++,'VoiceExtensionId':_0x25c568[_0x9184('0x17')]});_0x54d004[_0x9184('0x12')]({'type':_0x25c568['type'],'app':_0x9184('0x13'),'appdata':_0x9184('0x39'),'context':_0x25c568['context'],'exten':_0x25c568[_0x9184('0xa')],'priority':_0x152d10[_0x9184('0x2a')]+_0x4366ab[_0x9184('0xf')]+_0x277f30++,'VoiceExtensionId':_0x25c568[_0x9184('0x17')]});}}}for(var _0xd787a5=0x0;_0xd787a5<_0x152d10[_0x9184('0x2a')];_0xd787a5+=0x1){var _0x36cd6a=_0x4366ab[_0x9184('0xf')]+_0x152d10[_0x9184('0x2a')];var _0x121613=_0xd787a5===_0x152d10[_0x9184('0x2a')]-0x1?_0x4366ab[_0x9184('0xf')]+_0x54d004['length']+_0x119bc9[_0x9184('0x2a')]+0x2:_0x4366ab['priority']+_0xd787a5+0x1;_0x54d004[_0x9184('0x3a')](_0xd787a5,0x0,{'type':_0x25c568[_0x9184('0x16')],'app':'GotoIfTime','appdata':_0x152d10[_0xd787a5]+'?'+_0x25c568[_0x9184('0x1d')]+_0x9184('0x3b')+_0x36cd6a+':'+_0x25c568[_0x9184('0x1d')]+_0x9184('0x3b')+_0x121613,'exten':_0x25c568[_0x9184('0xa')],'context':_0x25c568[_0x9184('0x1d')],'priority':_0x4366ab[_0x9184('0xf')]+_0xd787a5,'VoiceExtensionId':_0x3a58b5[_0x472493][0x0][_0x9184('0x17')]});}_0x25c568[_0x9184('0xf')]=_0x54d004[_0x9184('0x2a')]?_[_0x9184('0x3c')](_0x54d004)[_0x9184('0xf')]+0x1:_0x4366ab['priority'];_0x4366ab[_0x9184('0xf')]=(_0x119bc9[_0x9184('0x2a')]?_['last'](_0x119bc9)[_0x9184('0xf')]:_0x25c568[_0x9184('0xf')])+0x1;_0x4366ab[_0x9184('0x10')]=_[_0x9184('0x3d')](_0x4366ab[_0x9184('0x10')],_0x54d004,[_0x25c568],_0x119bc9);}_0x4366ab[_0x9184('0x10')][_0x9184('0x12')]({'type':_0x3a58b5[_0x472493][0x0][_0x9184('0x16')],'app':'Hangup','exten':_0x3a58b5[_0x472493][0x0][_0x9184('0xa')],'context':_0x3a58b5[_0x472493][0x0][_0x9184('0x1d')],'priority':_0x4366ab[_0x9184('0xf')],'VoiceExtensionId':_0x3a58b5[_0x472493][0x0][_0x9184('0x17')]});_0x24994b[_0x9184('0x12')](_0x3a58b5[_0x472493][0x0][_0x9184('0x17')]);_0x34b1ea=_[_0x9184('0x3d')](_0x34b1ea,_0x4366ab['extensions']);}}return _0xbfcba9['transaction'](function(_0x5aaeee){return _0xbfcba9[_0x9184('0x2')]['VoiceExtension'][_0x9184('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x24994b}},'transaction':_0x5aaeee})[_0x9184('0x8')](function(_0x37d020){return _0xbfcba9[_0x9184('0x2')]['VoiceExtension'][_0x9184('0x3f')](_[_0x9184('0x40')](_0x34b1ea,_0x9184('0xf')),{'transaction':_0x5aaeee});});});})[_0x9184('0x41')](function(_0x303bd0){console[_0x9184('0x42')](_0x303bd0);});}exports[_0x9184('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 1b7474d..7d8cb9f 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 _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','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!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x3d5be0,_0x51d89b){var _0x59b197=function(_0x55c7a2){while(--_0x55c7a2){_0x3d5be0['push'](_0x3d5be0['shift']());}};_0x59b197(++_0x51d89b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);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(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){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))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file +var _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x1af049,_0x4bd15a){var _0x4f15f2=function(_0x34ffad){while(--_0x34ffad){_0x1af049['push'](_0x1af049['shift']());}};_0x4f15f2(++_0x4bd15a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 6ef157e..bbd4419 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 _0xec20=['YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','length','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','each','then','finish','affectedRows','unlink','error','complete','argv','arguments\x20\x20\x20','existsSync','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','createdAt','UserId','recallme','fields','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.phone','cm_contacts.id','cm_hopper_black','ContactId','ListId','cm_contacts','.CmListId','ListId\x20=\x20?','\x20=\x20?','concat','CompanyId','updatedAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','message','exit','errors','code','info','sequelize','spread','push','catch','main','stringify','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','data','trim','replace','isValid','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0xec20,0xae));var _0x0ec2=function(_0x1cff8e,_0x2c975a){_0x1cff8e=_0x1cff8e-0x0;var _0x59021a=_0xec20[_0x1cff8e];return _0x59021a;};'use strict';var fs=require('fs');var path=require(_0x0ec2('0x0'));var _=require(_0x0ec2('0x1'));var Papa=require(_0x0ec2('0x2'));var util=require(_0x0ec2('0x3'));var BPromise=require(_0x0ec2('0x4'));var moment=require('moment');var squel=require(_0x0ec2('0x5'));var Redis=require(_0x0ec2('0x6'));var db=require(_0x0ec2('0x7'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x0ec2('0x8'));config[_0x0ec2('0x9')]=_[_0x0ec2('0xa')](config[_0x0ec2('0x9')],{'host':_0x0ec2('0xb'),'port':0x18eb});var socket=require(_0x0ec2('0xc'))(new Redis(config[_0x0ec2('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x0ec2('0xd')](_0x0ec2('0xe'));function isEmail(_0x22609f){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))*$/[_0x0ec2('0xf')](_0x22609f);}function selectNotIn(_0x41bf34,_0x22672f,_0x4a73f2,_0x59d68e,_0x2e457e){return squel[_0x0ec2('0x10')]()[_0x0ec2('0x11')](_0x0ec2('0x12'))[_0x0ec2('0x13')](_0x59d68e)[_0x0ec2('0x14')](_0x22672f,null,_0x22672f+_0x0ec2('0x15')+_0x59d68e+'.'+_0x4a73f2)[_0x0ec2('0x16')](_0x59d68e+'.'+_0x4a73f2+_0x0ec2('0x17')+_0x41bf34+'.'+_0x4a73f2)[_0x0ec2('0x16')](_0x22672f+'.dialCheckDuplicateType\x20IN\x20('+_0x2e457e[_0x0ec2('0x14')]()+')');}function insertCmHopper(_0x1e6071,_0x44db07,_0x2c3c3c,_0x3a7618,_0x1a0687){var _0x3eba34=['cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id',_0x0ec2('0x18'),_0x44db07+'.'+_0x3a7618,_0x0ec2('0x19'),_0x0ec2('0x1a'),_0x0ec2('0x1b'),_0x0ec2('0x1c'),'\x22'+_0x1a0687+'\x22'];return squel['insert']()[_0x0ec2('0x1d')](_0x0ec2('0x1e'))[_0x0ec2('0x1f')]([_0x0ec2('0x12'),_0x0ec2('0x20'),'ContactId','ListId',_0x3a7618,_0x0ec2('0x21'),'updatedAt','priority',_0x0ec2('0x22'),_0x0ec2('0x23')],squel['select']()[_0x0ec2('0x24')](_0x3eba34)[_0x0ec2('0x13')](_0x44db07)[_0x0ec2('0x14')]('cm_contacts',null,_0x0ec2('0x25')+_0x44db07+'.CmListId')[_0x0ec2('0x14')](_0x2c3c3c,null,_0x2c3c3c+_0x0ec2('0x15')+_0x44db07+'.'+_0x3a7618)['where'](_0x44db07+_0x0ec2('0x26'),_0x1e6071)[_0x0ec2('0x16')](_0x0ec2('0x27'),NOW)[_0x0ec2('0x16')](_0x0ec2('0x28'),selectNotIn(_0x44db07,_0x2c3c3c,_0x3a7618,_0x0ec2('0x1e'),[_0x0ec2('0x29'),_0x0ec2('0x2a')]))['where'](_0x0ec2('0x28'),selectNotIn(_0x44db07,_0x2c3c3c,_0x3a7618,_0x0ec2('0x1e'),[_0x0ec2('0x29')])))[_0x0ec2('0x2b')]();}function insertCmHopperBlack(_0x5466ff,_0x259aaa,_0x59c8b4,_0x379595){var _0x320ade=[_0x0ec2('0x2c'),_0x0ec2('0x2d'),_0x0ec2('0x18'),_0x259aaa+'.'+_0x379595,'cm_contacts.createdAt',_0x0ec2('0x1a')];return squel['insert']()[_0x0ec2('0x1d')](_0x0ec2('0x2e'))[_0x0ec2('0x1f')]([_0x0ec2('0x12'),_0x0ec2('0x2f'),_0x0ec2('0x30'),_0x379595,_0x0ec2('0x21'),'updatedAt'],squel[_0x0ec2('0x10')]()[_0x0ec2('0x24')](_0x320ade)[_0x0ec2('0x13')](_0x259aaa)[_0x0ec2('0x14')](_0x0ec2('0x31'),null,_0x0ec2('0x25')+_0x259aaa+_0x0ec2('0x32'))[_0x0ec2('0x14')](_0x59c8b4,null,_0x59c8b4+_0x0ec2('0x15')+_0x259aaa+'.'+_0x379595)[_0x0ec2('0x16')](_0x259aaa+_0x0ec2('0x26'),_0x5466ff)[_0x0ec2('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x0ec2('0x16')](_0x0ec2('0x28'),squel[_0x0ec2('0x10')]()[_0x0ec2('0x11')](_0x0ec2('0x12'))[_0x0ec2('0x13')](_0x0ec2('0x2e'))[_0x0ec2('0x16')](_0x0ec2('0x33'),_0x5466ff)[_0x0ec2('0x16')](_0x379595+_0x0ec2('0x34'),_0x259aaa+'.'+_0x379595)))[_0x0ec2('0x2b')]();}function insertCmContact(_0x35f119,_0x2eeda7,_0x144b5c,_0x110951){var _0x23f34c=_[_0x0ec2('0x35')](_['keys'](_0x110951),[_0x0ec2('0x30'),_0x0ec2('0x36'),_0x0ec2('0x21'),_0x0ec2('0x37')]);return squel['insert']()[_0x0ec2('0x1d')](_0x0ec2('0x31'))['fromQuery'](_0x23f34c,squel[_0x0ec2('0x10')]()[_0x0ec2('0x24')](_0x23f34c)[_0x0ec2('0x13')](_0x2eeda7)[_0x0ec2('0x16')]('('+_0x144b5c[_0x0ec2('0x14')](',')+_0x0ec2('0x38'),squel[_0x0ec2('0x10')]()[_0x0ec2('0x24')](_0x144b5c)['from'](_0x0ec2('0x31'))[_0x0ec2('0x16')](_0x0ec2('0x33'),_0x35f119)[_0x0ec2('0x16')](_0x0ec2('0x39')))[_0x0ec2('0x16')](_0x0ec2('0x3a'),squel[_0x0ec2('0x10')]()[_0x0ec2('0x11')]('MIN(id)',_0x0ec2('0x3b'))[_0x0ec2('0x13')](_0x2eeda7)[_0x0ec2('0x3c')](_0x144b5c['join'](','))))['toString']();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x555084){logger['error'](_0x555084[_0x0ec2('0x3d')]);process[_0x0ec2('0x3e')](0x1);}function handleError(_0x57cb4c,_0xf5c98a){stats[_0x0ec2('0x3f')]['push']({'name':_0xf5c98a[_0x0ec2('0x40')],'message':_0xf5c98a['message'],'row':_0x57cb4c});}function handleQuery(_0x1c222f){logger[_0x0ec2('0x41')](_0x1c222f);return db[_0x0ec2('0x42')]['query'](_0x1c222f)[_0x0ec2('0x43')](function(_0x3a3b3c){results[_0x0ec2('0x44')](_0x3a3b3c);})[_0x0ec2('0x45')](function(_0x3afcff){logger['error'](_0x3afcff['message']);});}function main(_0x324c7b,_0xc7f8e3,_0x15a77c,_0x4d21a8){logger['info'](_0x0ec2('0x46'),_0x324c7b,JSON[_0x0ec2('0x47')](_0xc7f8e3));process['send']('start');var _0x1bad8d=_0xc7f8e3['binding'];var _0x3c8cf5=_0xc7f8e3[_0x0ec2('0x48')];var _0x35d6bb=path['join'](config[_0x0ec2('0x49')],_0x0ec2('0x4a'),_0x3c8cf5+_0x0ec2('0x4b'));var _0x4371e1=_['keys'](_0x1bad8d)[_0x0ec2('0x14')]();logger['info'](_0x0ec2('0x4c'),_0x4371e1);fs[_0x0ec2('0x4d')](_0x35d6bb,_0x4371e1+'\x0a');Papa[_0x0ec2('0x4e')](fs['createReadStream'](_0x324c7b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x25966c,_0x1cd336){try{for(var _0x5baab8=0x0,_0x28123c=[];_0x5baab8<_0x25966c['data']['length'];_0x5baab8++){stats['rows']+=0x1;if(_0x25966c[_0x0ec2('0x3f')][_0x5baab8]){handleError(_0x25966c['data'][_0x5baab8],_0x25966c[_0x0ec2('0x3f')][_0x5baab8]);}else{var _0x172b77=[];for(var _0x22a21a in _0x1bad8d){if(_0x1bad8d['hasOwnProperty'](_0x22a21a)){if(_0x25966c[_0x0ec2('0x4f')][_0x5baab8][_0x1bad8d[_0x22a21a]]){var _0x187c74=_[_0x0ec2('0x50')](_0x25966c[_0x0ec2('0x4f')][_0x5baab8][_0x1bad8d[_0x22a21a]][_0x0ec2('0x51')](/"/g,'\x27'));switch(_0x22a21a){case _0x0ec2('0x20'):var _0x28675d=moment(_0x187c74,_0x0ec2('0xe'),!![]);if(_0x28675d[_0x0ec2('0x52')]()){_0x28123c[_0x0ec2('0x44')]('\x22'+_0x187c74+'\x22');}else{_0x172b77['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x0ec2('0x53'):var _0x3163c1=parseInt(_0x187c74);_0x187c74=_[_0x0ec2('0x54')](_0x3163c1)||_0x3163c1<0x0||_0x3163c1>0x4?_0x4d21a8?0x3:0x2:_0x3163c1;_0x28123c[_0x0ec2('0x44')]('\x22'+_0x187c74+'\x22');break;case _0x0ec2('0x22'):var _0x1363b0=parseInt(_0x187c74);if(_[_0x0ec2('0x55')](_0x1363b0)&&_[_0x0ec2('0x56')](_0x15a77c,_0x1363b0)){_0x28123c[_0x0ec2('0x44')]('\x22'+_0x1363b0+'\x22');}else{_0x172b77[_0x0ec2('0x44')](_0x0ec2('0x57'));}break;case _0x0ec2('0x58'):if(isEmail(_0x187c74)){_0x28123c['push']('\x22'+_0x187c74+'\x22');}else{_0x172b77[_0x0ec2('0x44')]('email\x20wrong\x20format');}break;case _0x0ec2('0x59'):var _0x39c438=moment(_0x187c74,_0x0ec2('0x5a'),!![]);if(_0x39c438[_0x0ec2('0x52')]()){_0x28123c['push']('\x22'+_0x187c74+'\x22');}else{_0x172b77[_0x0ec2('0x44')](_0x0ec2('0x5b'));}break;default:_0x28123c['push']('\x22'+_0x187c74+'\x22');}}else{switch(_0x22a21a){case'firstName':case _0x0ec2('0x12'):_0x172b77[_0x0ec2('0x44')](_0x22a21a+_0x0ec2('0x5c'));break;default:_0x28123c[_0x0ec2('0x44')]('\x22\x22');}}}}if(_0x172b77[_0x0ec2('0x5d')]){handleError(_0x25966c['data'][_0x5baab8],{'code':_0x0ec2('0x5e'),'message':_0x172b77[_0x0ec2('0x14')]()});}else{fs[_0x0ec2('0x5f')](_0x35d6bb,_0x28123c[_0x0ec2('0x14')]()+'\x0a');}_0x28123c=[];}if(!(stats[_0x0ec2('0x60')]%0xc8)){socket[_0x0ec2('0x61')](_0x0ec2('0x62')+_0x3c8cf5,stats);stats[_0x0ec2('0x3f')]=[];}}if(stopped){logger[_0x0ec2('0x41')](_0x0ec2('0x63'));_0x1cd336['abort']();}}catch(_0x45ee67){handleError(_0x25966c[_0x0ec2('0x4f')][_0x5baab8],{'code':_0x0ec2('0x64'),'message':_0x45ee67['message']});logger['error'](_0x0ec2('0x65'),_0x45ee67[_0x0ec2('0x3d')]);}},'complete':function(){try{var _0xa8aa52=[];var _0x1eb74b=_0x0ec2('0x31');if(_0xc7f8e3[_0x0ec2('0x66')]&&_0xc7f8e3[_0x0ec2('0x66')]['length']){_0x1eb74b=_0x0ec2('0x67')+_0x3c8cf5;_0xa8aa52[_0x0ec2('0x44')](_0x0ec2('0x68')+_0x1eb74b+_0x0ec2('0x69'));}var _0x5c85bb=util[_0x0ec2('0xd')](_0x0ec2('0x6a'),_0x35d6bb,_0x1eb74b,_0x4371e1,_0xc7f8e3['ListId'],_0xc7f8e3[_0x0ec2('0x36')]||null,NOW,NOW);if(_[_0x0ec2('0x6b')](_0x1bad8d[_0x0ec2('0x20')])){_0x5c85bb+=',\x20scheduledAt\x20=\x20NOW()';}_0xa8aa52[_0x0ec2('0x44')](_0x5c85bb);if(_0xc7f8e3[_0x0ec2('0x66')]&&_0xc7f8e3[_0x0ec2('0x66')][_0x0ec2('0x5d')]){_0xa8aa52[_0x0ec2('0x44')](insertCmContact(_0xc7f8e3[_0x0ec2('0x30')],_0x1eb74b,_0xc7f8e3[_0x0ec2('0x66')],_0x1bad8d));_0xa8aa52['push'](_0x0ec2('0x6c')+_0x1eb74b+';');}_0xa8aa52[_0x0ec2('0x44')](insertCmHopper(_0xc7f8e3[_0x0ec2('0x30')],'voice_queues_has_cm_lists',_0x0ec2('0x6d'),_0x0ec2('0x6e'),_0x4d21a8));_0xa8aa52[_0x0ec2('0x44')](insertCmHopperBlack(_0xc7f8e3[_0x0ec2('0x30')],_0x0ec2('0x6f'),_0x0ec2('0x6d'),'VoiceQueueId'));_0xa8aa52['push'](insertCmHopper(_0xc7f8e3[_0x0ec2('0x30')],'campaigns_has_cm_lists',_0x0ec2('0x70'),'CampaignId',_0x4d21a8));_0xa8aa52[_0x0ec2('0x44')](insertCmHopperBlack(_0xc7f8e3[_0x0ec2('0x30')],'campaigns_has_cm_blacklists',_0x0ec2('0x70'),'CampaignId'));BPromise[_0x0ec2('0x71')](_0xa8aa52,handleQuery)[_0x0ec2('0x72')](function(_0xf1c59d){stats[_0x0ec2('0x73')]=!![];stats[_0x0ec2('0x74')]=_0xc7f8e3[_0x0ec2('0x66')]&&_0xc7f8e3[_0x0ec2('0x66')]['length']?results[0x2][_0x0ec2('0x74')]:results[0x0][_0x0ec2('0x74')];socket[_0x0ec2('0x61')]('contact:import:'+_0x3c8cf5,stats);fs[_0x0ec2('0x75')](_0x324c7b);fs[_0x0ec2('0x75')](_0x35d6bb);process['exit'](0x0);})[_0x0ec2('0x45')](function(_0x4574db){logger['error'](_0x4574db[_0x0ec2('0x3d')]);process[_0x0ec2('0x3e')](0x1);});}catch(_0x26854a){logger[_0x0ec2('0x76')](_0x0ec2('0x77'),_0x26854a[_0x0ec2('0x3d')]);process[_0x0ec2('0x3e')](0x1);}},'error':function(_0xbce045,_0x3c20c0,_0x1e5129,_0xdc7b13){throw new Error(_0xdc7b13);}});}function validate(){if(process[_0x0ec2('0x78')]&&process[_0x0ec2('0x78')][_0x0ec2('0x5d')]<0x4){throw new Error(_0x0ec2('0x79'));}var _0x3255cc=path[_0x0ec2('0x14')](config['root'],_0x0ec2('0x4a'),process[_0x0ec2('0x78')][0x2]);if(!fs[_0x0ec2('0x7a')](_0x3255cc)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x4c2ab1={};try{_0x4c2ab1=JSON[_0x0ec2('0x4e')](process[_0x0ec2('0x78')][0x3]);if(!_0x4c2ab1[_0x0ec2('0x7b')]){throw new Error(_0x0ec2('0x7c'));}if(!_0x4c2ab1['binding']['phone']){throw new Error(_0x0ec2('0x7d'));}if(!_0x4c2ab1[_0x0ec2('0x7b')][_0x0ec2('0x7e')]){throw new Error(_0x0ec2('0x7f'));}var _0xec0688=0x0;if(_0x4c2ab1['binding'][_0x0ec2('0x22')]){_0xec0688=0x1;}if(!_0x4c2ab1[_0x0ec2('0x30')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x22a130){throw new Error(_0x0ec2('0x80'));}var _0x2000b8=[];try{_0x2000b8=_[_0x0ec2('0x81')](JSON[_0x0ec2('0x4e')](process[_0x0ec2('0x78')][0x4]),'id');}catch(_0x54d088){logger[_0x0ec2('0x41')](_0x0ec2('0x82'));}main(_0x3255cc,_0x4c2ab1,_0x2000b8,_0xec0688);}validate();process['on']('SIGINT',handleStop);process['on'](_0x0ec2('0x83'),handleUncaughtException); \ No newline at end of file +var _0x16d8=['ContactId','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','fields','deletedAt\x20IS\x20NULL','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','errors','push','sequelize','query','spread','catch','main','stringify','send','start','binding','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','length','rows','hasOwnProperty','trim','data','replace','YYYY-MM-DD\x20HH:mm:ss','isNaN','includes','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','appendFileSync','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()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','campaigns','each','then','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','map','SIGINT','uncaughtException','lodash','papaparse','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','join','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','insert','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.createdAt','into','cm_hopper_black'];(function(_0x51e191,_0x4a6564){var _0x279f91=function(_0x2de7e9){while(--_0x2de7e9){_0x51e191['push'](_0x51e191['shift']());}};_0x279f91(++_0x4a6564);}(_0x16d8,0x159));var _0x816d=function(_0x26f6a9,_0x33bf6c){_0x26f6a9=_0x26f6a9-0x0;var _0x49c007=_0x16d8[_0x26f6a9];return _0x49c007;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x816d('0x0'));var Papa=require(_0x816d('0x1'));var util=require('util');var BPromise=require(_0x816d('0x2'));var moment=require(_0x816d('0x3'));var squel=require(_0x816d('0x4'));var Redis=require('ioredis');var db=require(_0x816d('0x5'))['db'];var config=require(_0x816d('0x6'));var logger=require(_0x816d('0x7'))(_0x816d('0x8'));config[_0x816d('0x9')]=_[_0x816d('0xa')](config[_0x816d('0x9')],{'host':_0x816d('0xb'),'port':0x18eb});var socket=require(_0x816d('0xc'))(new Redis(config[_0x816d('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x816d('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x189322){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))*$/[_0x816d('0xe')](_0x189322);}function selectNotIn(_0xddaedd,_0x40966e,_0x261909,_0x37bb98,_0xc3fcad){return squel[_0x816d('0xf')]()[_0x816d('0x10')](_0x816d('0x11'))[_0x816d('0x12')](_0x37bb98)['join'](_0x40966e,null,_0x40966e+_0x816d('0x13')+_0x37bb98+'.'+_0x261909)[_0x816d('0x14')](_0x37bb98+'.'+_0x261909+_0x816d('0x15')+_0xddaedd+'.'+_0x261909)[_0x816d('0x14')](_0x40966e+'.dialCheckDuplicateType\x20IN\x20('+_0xc3fcad[_0x816d('0x16')]()+')');}function insertCmHopper(_0x33970d,_0x5a6735,_0x2083a2,_0x52b940,_0x3e9675){var _0xdc1e7=[_0x816d('0x17'),'cm_contacts.scheduledat',_0x816d('0x18'),_0x816d('0x19'),_0x5a6735+'.'+_0x52b940,'cm_contacts.createdAt',_0x816d('0x1a'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x3e9675+'\x22'];return squel[_0x816d('0x1b')]()['into'](_0x816d('0x1c'))[_0x816d('0x1d')]([_0x816d('0x11'),_0x816d('0x1e'),'ContactId',_0x816d('0x1f'),_0x52b940,_0x816d('0x20'),_0x816d('0x21'),_0x816d('0x22'),_0x816d('0x23'),_0x816d('0x24')],squel[_0x816d('0xf')]()['fields'](_0xdc1e7)['from'](_0x5a6735)['join'](_0x816d('0x25'),null,_0x816d('0x26')+_0x5a6735+_0x816d('0x27'))['join'](_0x2083a2,null,_0x2083a2+_0x816d('0x13')+_0x5a6735+'.'+_0x52b940)[_0x816d('0x14')](_0x5a6735+_0x816d('0x28'),_0x33970d)['where'](_0x816d('0x29'),NOW)[_0x816d('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5a6735,_0x2083a2,_0x52b940,_0x816d('0x1c'),[_0x816d('0x2a'),_0x816d('0x2b')]))[_0x816d('0x14')](_0x816d('0x2c'),selectNotIn(_0x5a6735,_0x2083a2,_0x52b940,_0x816d('0x1c'),[_0x816d('0x2a')])))['toString']();}function insertCmHopperBlack(_0x12ee34,_0x16f0d4,_0x2d3d17,_0x5a605f){var _0x54da37=[_0x816d('0x17'),_0x816d('0x18'),_0x816d('0x19'),_0x16f0d4+'.'+_0x5a605f,_0x816d('0x2d'),_0x816d('0x1a')];return squel[_0x816d('0x1b')]()[_0x816d('0x2e')](_0x816d('0x2f'))[_0x816d('0x1d')]([_0x816d('0x11'),_0x816d('0x30'),_0x816d('0x1f'),_0x5a605f,_0x816d('0x20'),_0x816d('0x21')],squel[_0x816d('0xf')]()['fields'](_0x54da37)[_0x816d('0x12')](_0x16f0d4)[_0x816d('0x16')](_0x816d('0x25'),null,'cm_contacts.ListId\x20=\x20'+_0x16f0d4+_0x816d('0x27'))[_0x816d('0x16')](_0x2d3d17,null,_0x2d3d17+'.id\x20=\x20'+_0x16f0d4+'.'+_0x5a605f)['where'](_0x16f0d4+'.CmListId\x20=\x20?',_0x12ee34)[_0x816d('0x14')](_0x816d('0x29'),NOW)[_0x816d('0x14')](_0x816d('0x2c'),squel[_0x816d('0xf')]()[_0x816d('0x10')](_0x816d('0x11'))[_0x816d('0x12')]('cm_hopper_black')[_0x816d('0x14')](_0x816d('0x31'),_0x12ee34)[_0x816d('0x14')](_0x5a605f+_0x816d('0x32'),_0x16f0d4+'.'+_0x5a605f)))['toString']();}function insertCmContact(_0xd5397b,_0x1a1618,_0x4eb1c2,_0x3f7978){var _0x252af0=_[_0x816d('0x33')](_[_0x816d('0x34')](_0x3f7978),[_0x816d('0x1f'),_0x816d('0x35'),_0x816d('0x20'),_0x816d('0x21')]);return squel[_0x816d('0x1b')]()[_0x816d('0x2e')](_0x816d('0x25'))['fromQuery'](_0x252af0,squel[_0x816d('0xf')]()[_0x816d('0x36')](_0x252af0)[_0x816d('0x12')](_0x1a1618)[_0x816d('0x14')]('('+_0x4eb1c2[_0x816d('0x16')](',')+')\x20NOT\x20IN\x20?',squel['select']()['fields'](_0x4eb1c2)[_0x816d('0x12')](_0x816d('0x25'))[_0x816d('0x14')](_0x816d('0x31'),_0xd5397b)[_0x816d('0x14')](_0x816d('0x37')))[_0x816d('0x14')]('id\x20IN\x20?',squel[_0x816d('0xf')]()[_0x816d('0x10')](_0x816d('0x38'),'min_id')[_0x816d('0x12')](_0x1a1618)[_0x816d('0x39')](_0x4eb1c2[_0x816d('0x16')](','))))['toString']();}function handleStop(){logger[_0x816d('0x3a')](_0x816d('0x3b'));stopped=!![];}function handleUncaughtException(_0x78f2c0){logger[_0x816d('0x3c')](_0x78f2c0[_0x816d('0x3d')]);process[_0x816d('0x3e')](0x1);}function handleError(_0x5a2cfa,_0x3e4db1){stats[_0x816d('0x3f')][_0x816d('0x40')]({'name':_0x3e4db1['code'],'message':_0x3e4db1['message'],'row':_0x5a2cfa});}function handleQuery(_0x2913c4){logger[_0x816d('0x3a')](_0x2913c4);return db[_0x816d('0x41')][_0x816d('0x42')](_0x2913c4)[_0x816d('0x43')](function(_0x30e53e){results[_0x816d('0x40')](_0x30e53e);})[_0x816d('0x44')](function(_0x2805cc){logger['error'](_0x2805cc[_0x816d('0x3d')]);});}function main(_0x208325,_0x2eccef,_0x3e51f8,_0x32137e){logger[_0x816d('0x3a')](_0x816d('0x45'),_0x208325,JSON[_0x816d('0x46')](_0x2eccef));process[_0x816d('0x47')](_0x816d('0x48'));var _0x1fe92b=_0x2eccef[_0x816d('0x49')];var _0xb76fe4=_0x2eccef['socket_timestamp'];var _0x231934=path[_0x816d('0x16')](config[_0x816d('0x4a')],_0x816d('0x4b'),_0xb76fe4+_0x816d('0x4c'));var _0x40b7d6=_[_0x816d('0x34')](_0x1fe92b)[_0x816d('0x16')]();logger[_0x816d('0x3a')](_0x816d('0x4d'),_0x40b7d6);fs[_0x816d('0x4e')](_0x231934,_0x40b7d6+'\x0a');Papa[_0x816d('0x4f')](fs[_0x816d('0x50')](_0x208325),{'header':!![],'skipEmptyLines':!![],'step':function(_0xf6d6fb,_0x38d521){try{for(var _0x417a09=0x0,_0x4536a4=[];_0x417a09<_0xf6d6fb['data'][_0x816d('0x51')];_0x417a09++){stats[_0x816d('0x52')]+=0x1;if(_0xf6d6fb[_0x816d('0x3f')][_0x417a09]){handleError(_0xf6d6fb['data'][_0x417a09],_0xf6d6fb[_0x816d('0x3f')][_0x417a09]);}else{var _0x5c52f4=[];for(var _0x2f6baf in _0x1fe92b){if(_0x1fe92b[_0x816d('0x53')](_0x2f6baf)){if(_0xf6d6fb['data'][_0x417a09][_0x1fe92b[_0x2f6baf]]){var _0x1c119e=_[_0x816d('0x54')](_0xf6d6fb[_0x816d('0x55')][_0x417a09][_0x1fe92b[_0x2f6baf]][_0x816d('0x56')](/"/g,'\x27'));switch(_0x2f6baf){case _0x816d('0x1e'):var _0x34de90=moment(_0x1c119e,_0x816d('0x57'),!![]);if(_0x34de90['isValid']()){_0x4536a4[_0x816d('0x40')]('\x22'+_0x1c119e+'\x22');}else{_0x5c52f4[_0x816d('0x40')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x816d('0x22'):var _0x21426c=parseInt(_0x1c119e);_0x1c119e=_[_0x816d('0x58')](_0x21426c)||_0x21426c<0x0||_0x21426c>0x4?_0x32137e?0x3:0x2:_0x21426c;_0x4536a4['push']('\x22'+_0x1c119e+'\x22');break;case _0x816d('0x23'):var _0x499ad9=parseInt(_0x1c119e);if(_['isNumber'](_0x499ad9)&&_[_0x816d('0x59')](_0x3e51f8,_0x499ad9)){_0x4536a4[_0x816d('0x40')]('\x22'+_0x499ad9+'\x22');}else{_0x5c52f4[_0x816d('0x40')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x1c119e)){_0x4536a4['push']('\x22'+_0x1c119e+'\x22');}else{_0x5c52f4['push'](_0x816d('0x5a'));}break;case _0x816d('0x5b'):var _0x5445cf=moment(_0x1c119e,_0x816d('0x5c'),!![]);if(_0x5445cf['isValid']()){_0x4536a4[_0x816d('0x40')]('\x22'+_0x1c119e+'\x22');}else{_0x5c52f4[_0x816d('0x40')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x4536a4['push']('\x22'+_0x1c119e+'\x22');}}else{switch(_0x2f6baf){case _0x816d('0x5d'):case _0x816d('0x11'):_0x5c52f4[_0x816d('0x40')](_0x2f6baf+_0x816d('0x5e'));break;default:_0x4536a4['push']('\x22\x22');}}}}if(_0x5c52f4[_0x816d('0x51')]){handleError(_0xf6d6fb[_0x816d('0x55')][_0x417a09],{'code':'SystemRow','message':_0x5c52f4['join']()});}else{fs[_0x816d('0x5f')](_0x231934,_0x4536a4[_0x816d('0x16')]()+'\x0a');}_0x4536a4=[];}if(!(stats[_0x816d('0x52')]%0xc8)){socket['emit']('contact:import:'+_0xb76fe4,stats);stats['errors']=[];}}if(stopped){logger[_0x816d('0x3a')](_0x816d('0x60'));_0x38d521[_0x816d('0x61')]();}}catch(_0x51957a){handleError(_0xf6d6fb['data'][_0x417a09],{'code':_0x816d('0x62'),'message':_0x51957a[_0x816d('0x3d')]});logger[_0x816d('0x3c')](_0x816d('0x63'),_0x51957a[_0x816d('0x3d')]);}},'complete':function(){try{var _0x45496e=[];var _0x5c0e8f=_0x816d('0x25');if(_0x2eccef[_0x816d('0x64')]&&_0x2eccef[_0x816d('0x64')][_0x816d('0x51')]){_0x5c0e8f=_0x816d('0x65')+_0xb76fe4;_0x45496e[_0x816d('0x40')](_0x816d('0x66')+_0x5c0e8f+'\x20LIKE\x20cm_contacts;');}var _0x32edc8=util[_0x816d('0xd')](_0x816d('0x67'),_0x231934,_0x5c0e8f,_0x40b7d6,_0x2eccef[_0x816d('0x1f')],_0x2eccef['CompanyId']||null,NOW,NOW);if(_[_0x816d('0x68')](_0x1fe92b['scheduledat'])){_0x32edc8+=_0x816d('0x69');}_0x45496e[_0x816d('0x40')](_0x32edc8);if(_0x2eccef[_0x816d('0x64')]&&_0x2eccef['duplicates'][_0x816d('0x51')]){_0x45496e[_0x816d('0x40')](insertCmContact(_0x2eccef[_0x816d('0x1f')],_0x5c0e8f,_0x2eccef[_0x816d('0x64')],_0x1fe92b));_0x45496e[_0x816d('0x40')](_0x816d('0x6a')+_0x5c0e8f+';');}_0x45496e[_0x816d('0x40')](insertCmHopper(_0x2eccef[_0x816d('0x1f')],_0x816d('0x6b'),'voice_queues',_0x816d('0x6c'),_0x32137e));_0x45496e[_0x816d('0x40')](insertCmHopperBlack(_0x2eccef[_0x816d('0x1f')],_0x816d('0x6d'),_0x816d('0x6e'),_0x816d('0x6c')));_0x45496e[_0x816d('0x40')](insertCmHopper(_0x2eccef[_0x816d('0x1f')],_0x816d('0x6f'),'campaigns',_0x816d('0x70'),_0x32137e));_0x45496e[_0x816d('0x40')](insertCmHopperBlack(_0x2eccef[_0x816d('0x1f')],_0x816d('0x71'),_0x816d('0x72'),_0x816d('0x70')));BPromise[_0x816d('0x73')](_0x45496e,handleQuery)[_0x816d('0x74')](function(_0x2b94c1){stats[_0x816d('0x75')]=!![];stats['affectedRows']=_0x2eccef['duplicates']&&_0x2eccef[_0x816d('0x64')][_0x816d('0x51')]?results[0x2]['affectedRows']:results[0x0][_0x816d('0x76')];socket[_0x816d('0x77')]('contact:import:'+_0xb76fe4,stats);fs[_0x816d('0x78')](_0x208325);fs['unlink'](_0x231934);process[_0x816d('0x3e')](0x0);})[_0x816d('0x44')](function(_0x52d040){logger['error'](_0x52d040[_0x816d('0x3d')]);process[_0x816d('0x3e')](0x1);});}catch(_0x1f4409){logger[_0x816d('0x3c')](_0x816d('0x79'),_0x1f4409[_0x816d('0x3d')]);process[_0x816d('0x3e')](0x1);}},'error':function(_0x5b2400,_0x22cda6,_0x44f44d,_0x12bf5a){throw new Error(_0x12bf5a);}});}function validate(){if(process[_0x816d('0x7a')]&&process[_0x816d('0x7a')]['length']<0x4){throw new Error(_0x816d('0x7b'));}var _0x1d128b=path[_0x816d('0x16')](config[_0x816d('0x4a')],_0x816d('0x4b'),process[_0x816d('0x7a')][0x2]);if(!fs[_0x816d('0x7c')](_0x1d128b)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x4df899={};try{_0x4df899=JSON['parse'](process[_0x816d('0x7a')][0x3]);if(!_0x4df899[_0x816d('0x49')]){throw new Error(_0x816d('0x7d'));}if(!_0x4df899['binding'][_0x816d('0x11')]){throw new Error(_0x816d('0x7e'));}if(!_0x4df899[_0x816d('0x49')][_0x816d('0x5d')]){throw new Error(_0x816d('0x7f'));}var _0x474e84=0x0;if(_0x4df899[_0x816d('0x49')]['UserId']){_0x474e84=0x1;}if(!_0x4df899[_0x816d('0x1f')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x3a5d31){throw new Error('body\x20id\x20mandatory');}var _0x33579d=[];try{_0x33579d=_[_0x816d('0x80')](JSON[_0x816d('0x4f')](process['argv'][0x4]),'id');}catch(_0x1d0166){logger[_0x816d('0x3a')]('No\x20agent\x20available');}main(_0x1d128b,_0x4df899,_0x33579d,_0x474e84);}validate();process['on'](_0x816d('0x81'),handleStop);process['on'](_0x816d('0x82'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 8d16040..eb6a173 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 _0x1bc6=['***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','talktime','Called\x20Number','Member\x20Name','membername','uniqueid','starttime','Answer\x20Time','answertime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','destcalleridnum','***\x20Call\x20Info\x20***','Caller\x20Number','calleridname','Call\x20To','destexten','keyValue','Queue','UniqueId','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number'];(function(_0xaacad6,_0x14b670){var _0x55a3de=function(_0x2df12f){while(--_0x2df12f){_0xaacad6['push'](_0xaacad6['shift']());}};_0x55a3de(++_0x14b670);}(_0x1bc6,0x94));var _0x61bc=function(_0x58ec79,_0x1539c2){_0x58ec79=_0x58ec79-0x0;var _0x38ab19=_0x1bc6[_0x58ec79];return _0x38ab19;};'use strict';exports[_0x61bc('0x0')]=function(_0x197c34,_0x396bc0){var _0x92f1f7=[{'type':_0x61bc('0x1'),'content':_0x61bc('0x2'),'variableName':null}];switch(_0x197c34[_0x61bc('0x3')]()){case'voice':switch(_0x396bc0[_0x61bc('0x3')]()){case _0x61bc('0x4'):_0x92f1f7[_0x61bc('0x5')]({'type':_0x61bc('0x6'),'content':'','variableName':_0x61bc('0x7')});_0x92f1f7[_0x61bc('0x5')]({'type':_0x61bc('0x6'),'content':'','variableName':_0x61bc('0x8')});break;case _0x61bc('0x9'):_0x92f1f7['push']({'type':_0x61bc('0x1'),'content':'Outbound\x20Call','variableName':null});_0x92f1f7[_0x61bc('0x5')]({'type':'variable','content':'','variableName':_0x61bc('0xa')});break;}}return _0x92f1f7;};exports['getDescriptions']=function(_0x23ff47,_0x34650a){var _0x955483=[];switch(_0x23ff47['toLowerCase']()){case'voice':switch(_0x34650a['toLowerCase']()){case'inbound':_0x955483=[{'type':'string','content':_0x61bc('0xb'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x61bc('0xc'),'keyType':_0x61bc('0x6'),'variableName':'calleridnum'},{'type':'keyValue','content':'','key':'Caller\x20Name','keyType':_0x61bc('0x6'),'variableName':_0x61bc('0xd')},{'type':'keyValue','content':'','key':_0x61bc('0xe'),'keyType':_0x61bc('0x6'),'variableName':_0x61bc('0xf')},{'type':_0x61bc('0x10'),'content':'','key':_0x61bc('0x11'),'keyType':_0x61bc('0x6'),'variableName':'queue'},{'type':_0x61bc('0x10'),'content':'','key':_0x61bc('0x12'),'keyType':'variable','variableName':'uniqueid'},{'type':_0x61bc('0x10'),'content':'','key':_0x61bc('0x13'),'keyType':_0x61bc('0x6'),'variableName':'agentcalledAt'},{'type':_0x61bc('0x1'),'content':_0x61bc('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x61bc('0x10'),'content':'','key':_0x61bc('0x15'),'keyType':'variable','variableName':_0x61bc('0x16')},{'type':_0x61bc('0x10'),'content':'','key':_0x61bc('0x17'),'keyType':_0x61bc('0x6'),'variableName':'destcalleridnum'},{'type':_0x61bc('0x1'),'content':_0x61bc('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x61bc('0x10'),'content':'','key':_0x61bc('0x19'),'keyType':_0x61bc('0x6'),'variableName':_0x61bc('0x1a')},{'type':_0x61bc('0x10'),'content':'','key':'Agent\x20Connect','keyType':_0x61bc('0x6'),'variableName':_0x61bc('0x1b')},{'type':_0x61bc('0x10'),'content':'','key':_0x61bc('0x1c'),'keyType':_0x61bc('0x6'),'variableName':'agentcompleteAt'},{'type':_0x61bc('0x10'),'content':'','key':_0x61bc('0x1d'),'keyType':_0x61bc('0x6'),'variableName':_0x61bc('0x1e')},{'type':_0x61bc('0x10'),'content':'','key':'Talk\x20Time','keyType':'variable','variableName':_0x61bc('0x1f')}];break;case'outbound':_0x955483=[{'type':_0x61bc('0x1'),'content':_0x61bc('0xb'),'variableName':null},{'type':_0x61bc('0x10'),'content':'','key':_0x61bc('0x20'),'keyType':'variable','keyContent':'','variableName':_0x61bc('0xa')},{'type':_0x61bc('0x10'),'content':'','key':_0x61bc('0x21'),'keyType':_0x61bc('0x6'),'keyContent':'','variableName':_0x61bc('0x22')},{'type':_0x61bc('0x10'),'content':'','key':_0x61bc('0x12'),'keyType':_0x61bc('0x6'),'keyContent':'','variableName':_0x61bc('0x23')},{'type':_0x61bc('0x10'),'content':'','key':'Date','keyType':_0x61bc('0x6'),'keyContent':'','variableName':_0x61bc('0x24')},{'type':_0x61bc('0x1'),'content':_0x61bc('0x18')},{'type':_0x61bc('0x10'),'content':'','key':_0x61bc('0x25'),'keyType':_0x61bc('0x6'),'keyContent':'','variableName':_0x61bc('0x26')},{'type':_0x61bc('0x10'),'content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':'endtime'},{'type':_0x61bc('0x10'),'content':'','key':_0x61bc('0x27'),'keyType':_0x61bc('0x6'),'keyContent':'','variableName':_0x61bc('0x28')},{'type':_0x61bc('0x10'),'content':'','key':_0x61bc('0x29'),'keyType':_0x61bc('0x6'),'keyContent':'','variableName':_0x61bc('0x2a')}];break;}}return _0x955483;}; \ No newline at end of file +var _0x531a=['Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','push','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','calleridname','Call\x20To','Queue','queue','UniqueId','agentcalledAt','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','talktime','Called\x20Number','uniqueid','Answer\x20Time','answertime','Complete\x20Time'];(function(_0x425561,_0x3a4598){var _0x303b28=function(_0x42f9f3){while(--_0x42f9f3){_0x425561['push'](_0x425561['shift']());}};_0x303b28(++_0x3a4598);}(_0x531a,0x100));var _0xa531=function(_0x107f87,_0x2fc1b3){_0x107f87=_0x107f87-0x0;var _0x1a18fe=_0x531a[_0x107f87];return _0x1a18fe;};'use strict';exports[_0xa531('0x0')]=function(_0x2687d1,_0x3a1577){var _0x28fae4=[{'type':_0xa531('0x1'),'content':_0xa531('0x2'),'variableName':null}];switch(_0x2687d1[_0xa531('0x3')]()){case _0xa531('0x4'):switch(_0x3a1577[_0xa531('0x3')]()){case _0xa531('0x5'):_0x28fae4['push']({'type':_0xa531('0x6'),'content':'','variableName':'queue'});_0x28fae4[_0xa531('0x7')]({'type':_0xa531('0x6'),'content':'','variableName':_0xa531('0x8')});break;case _0xa531('0x9'):_0x28fae4[_0xa531('0x7')]({'type':'string','content':_0xa531('0xa'),'variableName':null});_0x28fae4[_0xa531('0x7')]({'type':'variable','content':'','variableName':_0xa531('0xb')});break;}}return _0x28fae4;};exports[_0xa531('0xc')]=function(_0x10f6e0,_0x3eb94f){var _0x3e25a8=[];switch(_0x10f6e0['toLowerCase']()){case _0xa531('0x4'):switch(_0x3eb94f['toLowerCase']()){case _0xa531('0x5'):_0x3e25a8=[{'type':_0xa531('0x1'),'content':_0xa531('0xd'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xa531('0xe'),'keyType':_0xa531('0x6'),'variableName':'calleridnum'},{'type':_0xa531('0xf'),'content':'','key':_0xa531('0x10'),'keyType':'variable','variableName':_0xa531('0x11')},{'type':_0xa531('0xf'),'content':'','key':_0xa531('0x12'),'keyType':'variable','variableName':'destexten'},{'type':'keyValue','content':'','key':_0xa531('0x13'),'keyType':_0xa531('0x6'),'variableName':_0xa531('0x14')},{'type':_0xa531('0xf'),'content':'','key':_0xa531('0x15'),'keyType':_0xa531('0x6'),'variableName':'uniqueid'},{'type':_0xa531('0xf'),'content':'','key':'Date','keyType':_0xa531('0x6'),'variableName':_0xa531('0x16')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xa531('0xf'),'content':'','key':_0xa531('0x17'),'keyType':_0xa531('0x6'),'variableName':'destcalleridname'},{'type':_0xa531('0xf'),'content':'','key':_0xa531('0x18'),'keyType':_0xa531('0x6'),'variableName':'destcalleridnum'},{'type':_0xa531('0x1'),'content':_0xa531('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xa531('0x1a'),'keyType':_0xa531('0x6'),'variableName':_0xa531('0x16')},{'type':_0xa531('0xf'),'content':'','key':_0xa531('0x1b'),'keyType':_0xa531('0x6'),'variableName':_0xa531('0x1c')},{'type':_0xa531('0xf'),'content':'','key':_0xa531('0x1d'),'keyType':_0xa531('0x6'),'variableName':_0xa531('0x1e')},{'type':_0xa531('0xf'),'content':'','key':'Hold\x20Time','keyType':_0xa531('0x6'),'variableName':_0xa531('0x1f')},{'type':_0xa531('0xf'),'content':'','key':'Talk\x20Time','keyType':_0xa531('0x6'),'variableName':_0xa531('0x20')}];break;case'outbound':_0x3e25a8=[{'type':'string','content':_0xa531('0xd'),'variableName':null},{'type':'keyValue','content':'','key':_0xa531('0x21'),'keyType':_0xa531('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0xa531('0xf'),'content':'','key':'Member\x20Name','keyType':_0xa531('0x6'),'keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0xa531('0x6'),'keyContent':'','variableName':_0xa531('0x22')},{'type':'keyValue','content':'','key':'Date','keyType':_0xa531('0x6'),'keyContent':'','variableName':'starttime'},{'type':_0xa531('0x1'),'content':_0xa531('0x19')},{'type':'keyValue','content':'','key':_0xa531('0x23'),'keyType':_0xa531('0x6'),'keyContent':'','variableName':_0xa531('0x24')},{'type':'keyValue','content':'','key':_0xa531('0x25'),'keyType':_0xa531('0x6'),'keyContent':'','variableName':'endtime'},{'type':_0xa531('0xf'),'content':'','key':_0xa531('0x26'),'keyType':'variable','keyContent':'','variableName':_0xa531('0x27')},{'type':_0xa531('0xf'),'content':'','key':_0xa531('0x28'),'keyType':_0xa531('0x6'),'keyContent':'','variableName':_0xa531('0x29')}];break;}}return _0x3e25a8;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 5d24858..ce0ff3b 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 _0xbac8=['sms-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','update','then','info','catch','user','clone','body','omit','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','mail-interactions'];(function(_0x2834c7,_0x5d3e03){var _0x545af4=function(_0x2c9cdf){while(--_0x2c9cdf){_0x2834c7['push'](_0x2834c7['shift']());}};_0x545af4(++_0x5d3e03);}(_0xbac8,0x140));var _0x8bac=function(_0x382452,_0x156f23){_0x382452=_0x382452-0x0;var _0x183310=_0xbac8[_0x382452];return _0x183310;};'use strict';var _=require(_0x8bac('0x0'));var db=require(_0x8bac('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0x8bac('0x2'))(_0x8bac('0x3')),'fax':require(_0x8bac('0x2'))('fax-interactions'),'sms':require(_0x8bac('0x2'))(_0x8bac('0x4')),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require(_0x8bac('0x2'))(_0x8bac('0x5'))};function getInteractionId(_0x3e95bb,_0x65a44b,_0x2e6c33){if(_0x3e95bb&&_0x3e95bb[_[_0x8bac('0x6')](_0x2e6c33)+_0x8bac('0x7')]){return _0x3e95bb[_[_0x8bac('0x6')](_0x2e6c33)+_0x8bac('0x7')];}else if(_0x3e95bb&&_0x3e95bb['id']){return _0x3e95bb['id'];}else if(_0x65a44b&&_0x65a44b['id']){return _0x65a44b['id'];}else{return'unknown';}}function log(_0x11596d,_0x39b869,_0x16ebdb,_0x4d1a27,_0x31e977,_0x54381f){loggers[_0x31e977[_0x8bac('0x8')]()][_0x11596d](_0x8bac('0x9'),_0x54381f['toUpperCase'](),_0x39b869?_0x39b869['id']:null,_0x39b869?_0x39b869[_0x8bac('0xa')]:null,_0x39b869?_0x39b869[_0x8bac('0xb')]:null,getInteractionId(_0x16ebdb,_0x4d1a27,_0x31e977),_0x16ebdb?JSON[_0x8bac('0xc')](_0x16ebdb):_0x8bac('0xd'));}function updateUser(_0x3fa066,_0x5bc586,_0x4e571a,_0x318c69,_0x442c66){db[_['upperFirst'](_0x318c69)+_0x8bac('0xe')]['findOne']({'where':{'id':getInteractionId(_0x5bc586,_0x4e571a,_0x318c69)}})['then'](function(_0x7617a6){if(_0x7617a6){return _0x7617a6[_0x8bac('0xf')]({'UserId':_0x3fa066?_0x3fa066['id']:null});}})[_0x8bac('0x10')](function(_0x3225ea){if(_0x3225ea){log(_0x8bac('0x11'),_0x3fa066,_0x5bc586,_0x4e571a,_0x318c69,_0x442c66);}})[_0x8bac('0x12')](function(){log('error',_0x3fa066,_0x5bc586,_0x4e571a,_0x318c69,_0x442c66);});}exports['tracked']=function(_0x41692b,_0x4cf355){return function(_0x5e700a,_0x3ab89d,_0x447814){var _0x105e06=_0x5e700a[_0x8bac('0x13')];var _0x298062={};var _0x6e7fbf=_0x5e700a['query'];if(_0x298062){_0x298062=_[_0x8bac('0x14')](_0x5e700a[_0x8bac('0x15')]);_0x298062=_[_0x8bac('0x16')](_0x298062,[_0x8bac('0x15'),_0x8bac('0x17'),_0x8bac('0x18'),_0x8bac('0x19'),_0x8bac('0x1a')]);}updateUser(_0x105e06,_0x298062,_0x6e7fbf,_0x41692b,_0x4cf355);_0x447814(null);};}; \ No newline at end of file +var _0x45c9=['../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','catch','error','query','clone','body','phone','fax','mobile'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x45c9,0x96));var _0x945c=function(_0x143b7b,_0x1e078f){_0x143b7b=_0x143b7b-0x0;var _0x5dfe42=_0x45c9[_0x143b7b];return _0x5dfe42;};'use strict';var _=require('lodash');var db=require(_0x945c('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x945c('0x1')),'mail':require(_0x945c('0x2'))(_0x945c('0x3')),'fax':require(_0x945c('0x2'))(_0x945c('0x4')),'sms':require('../../config/logger')(_0x945c('0x5')),'chat':require('../../config/logger')(_0x945c('0x6')),'whatsapp':require(_0x945c('0x2'))(_0x945c('0x7'))};function getInteractionId(_0x3c5c07,_0x265b02,_0x9a988b){if(_0x3c5c07&&_0x3c5c07[_[_0x945c('0x8')](_0x9a988b)+'InteractionId']){return _0x3c5c07[_[_0x945c('0x8')](_0x9a988b)+'InteractionId'];}else if(_0x3c5c07&&_0x3c5c07['id']){return _0x3c5c07['id'];}else if(_0x265b02&&_0x265b02['id']){return _0x265b02['id'];}else{return _0x945c('0x9');}}function log(_0x569568,_0x3e46e1,_0x4e0f64,_0x2a8d86,_0x11c8ce,_0x448180){loggers[_0x11c8ce[_0x945c('0xa')]()][_0x569568](_0x945c('0xb'),_0x448180[_0x945c('0xc')](),_0x3e46e1?_0x3e46e1['id']:null,_0x3e46e1?_0x3e46e1[_0x945c('0xd')]:null,_0x3e46e1?_0x3e46e1[_0x945c('0xe')]:null,getInteractionId(_0x4e0f64,_0x2a8d86,_0x11c8ce),_0x4e0f64?JSON[_0x945c('0xf')](_0x4e0f64):_0x945c('0x10'));}function updateUser(_0x35ad90,_0x15e148,_0x11c52e,_0x2676d1,_0x47af02){db[_[_0x945c('0x8')](_0x2676d1)+_0x945c('0x11')][_0x945c('0x12')]({'where':{'id':getInteractionId(_0x15e148,_0x11c52e,_0x2676d1)}})[_0x945c('0x13')](function(_0x2bda60){if(_0x2bda60){return _0x2bda60[_0x945c('0x14')]({'UserId':_0x35ad90?_0x35ad90['id']:null});}})[_0x945c('0x13')](function(_0x529f29){if(_0x529f29){log(_0x945c('0x15'),_0x35ad90,_0x15e148,_0x11c52e,_0x2676d1,_0x47af02);}})[_0x945c('0x16')](function(){log(_0x945c('0x17'),_0x35ad90,_0x15e148,_0x11c52e,_0x2676d1,_0x47af02);});}exports['tracked']=function(_0x3a37dc,_0xa6dd2e){return function(_0x314d7a,_0xbc5e03,_0x828fb9){var _0x27a48f=_0x314d7a['user'];var _0x269029={};var _0x2cf962=_0x314d7a[_0x945c('0x18')];if(_0x269029){_0x269029=_[_0x945c('0x19')](_0x314d7a[_0x945c('0x1a')]);_0x269029=_['omit'](_0x269029,[_0x945c('0x1a'),'html',_0x945c('0x1b'),_0x945c('0x1c'),_0x945c('0x1d')]);}updateUser(_0x27a48f,_0x269029,_0x2cf962,_0x3a37dc,_0xa6dd2e);_0x828fb9(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 7b467ca..8018101 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 _0x2e0c=['parse','hasOwnProperty','use','then','count','status','json','catch','User','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','format','%s:%s:%s','utf8','final'];(function(_0x493ed2,_0x246935){var _0x46d495=function(_0x2c59bf){while(--_0x2c59bf){_0x493ed2['push'](_0x493ed2['shift']());}};_0x46d495(++_0x246935);}(_0x2e0c,0xa4));var _0xc2e0=function(_0x2703d7,_0x5edbe3){_0x2703d7=_0x2703d7-0x0;var _0x83891c=_0x2e0c[_0x2703d7];return _0x83891c;};'use strict';var crypto=require(_0xc2e0('0x0'));var util=require(_0xc2e0('0x1'));var compose=require(_0xc2e0('0x2'));var db=require(_0xc2e0('0x3'))['db'];var config=require(_0xc2e0('0x4'));function getValueFromLicense(_0x46ef3a,_0x3062c4){if(_0x46ef3a&&_0x3062c4){if(_0x3062c4[_0xc2e0('0x5')]&&_0x3062c4[_0xc2e0('0x6')]){var _0x5768c4=_0x3062c4['data1'];var _0x4bbffe=_0x3062c4['license'];var _0x2c9d51=_0x5768c4[_0xc2e0('0x7')]('-')[0x4];var _0x51f53e=_0x5768c4['split']('-')[0x0];var _0x16d31e=crypto['createDecipher']('aes-256-ctr',util[_0xc2e0('0x8')](_0xc2e0('0x9'),_0x2c9d51,_0x5768c4,_0x51f53e));var _0xad90fc=_0x16d31e['update'](_0x4bbffe,'base64',_0xc2e0('0xa'));_0xad90fc+=_0x16d31e[_0xc2e0('0xb')](_0xc2e0('0xa'));var _0x26d455=JSON[_0xc2e0('0xc')](_0xad90fc);return _0x26d455[_0xc2e0('0xd')](_0x46ef3a)?_0x26d455[_0x46ef3a]:null;}}return null;}function isLimit(_0x3949d8,_0x583b0f,_0x4086be,_0x2fce68){var _0xa839c6=_0x583b0f;return compose()[_0xc2e0('0xe')](function(_0x3369e0,_0x3fcf5d,_0xb337eb){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0xc2e0('0xf')](function(_0x320bef){var _0xd1ba09=getValueFromLicense(_0x3949d8,_0x320bef);return _0xd1ba09?_0xd1ba09:_0xa839c6;})[_0xc2e0('0xf')](function(_0x1ce252){_0xa839c6=_0x1ce252;return _0x4086be[_0xc2e0('0x10')](_0x2fce68);})['then'](function(_0x1eb7d7){if(_0x1eb7d7>=_0xa839c6){return _0x3fcf5d[_0xc2e0('0x11')](0x193)[_0xc2e0('0x12')]({'message':util[_0xc2e0('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x3949d8)});}_0xb337eb();})[_0xc2e0('0x13')](function(_0x5e1976){_0xb337eb(_0x5e1976);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xc2e0('0x14')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0xc2e0('0x15')]=isUserLimit; \ No newline at end of file +var _0x422d=['parse','hasOwnProperty','License','findOne','then','count','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','isUserLimit','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','%s:%s:%s','update','base64','utf8','final'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x422d,0x179));var _0xd422=function(_0x1f9343,_0x1b8420){_0x1f9343=_0x1f9343-0x0;var _0x459836=_0x422d[_0x1f9343];return _0x459836;};'use strict';var crypto=require(_0xd422('0x0'));var util=require('util');var compose=require(_0xd422('0x1'));var db=require(_0xd422('0x2'))['db'];var config=require(_0xd422('0x3'));function getValueFromLicense(_0x3ab815,_0x171be2){if(_0x3ab815&&_0x171be2){if(_0x171be2[_0xd422('0x4')]&&_0x171be2[_0xd422('0x5')]){var _0x1a0959=_0x171be2[_0xd422('0x4')];var _0x2d6945=_0x171be2[_0xd422('0x5')];var _0x174997=_0x1a0959[_0xd422('0x6')]('-')[0x4];var _0x5c764a=_0x1a0959[_0xd422('0x6')]('-')[0x0];var _0x593fd0=crypto[_0xd422('0x7')]('aes-256-ctr',util['format'](_0xd422('0x8'),_0x174997,_0x1a0959,_0x5c764a));var _0x1d083d=_0x593fd0[_0xd422('0x9')](_0x2d6945,_0xd422('0xa'),_0xd422('0xb'));_0x1d083d+=_0x593fd0[_0xd422('0xc')](_0xd422('0xb'));var _0x41e616=JSON[_0xd422('0xd')](_0x1d083d);return _0x41e616[_0xd422('0xe')](_0x3ab815)?_0x41e616[_0x3ab815]:null;}}return null;}function isLimit(_0x3c5b5f,_0x49ba2f,_0x1c1ed7,_0x49916a){var _0x8558bc=_0x49ba2f;return compose()['use'](function(_0x538553,_0x17d186,_0x4aac2f){return db[_0xd422('0xf')][_0xd422('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xd422('0x11')](function(_0x456315){var _0xa901c4=getValueFromLicense(_0x3c5b5f,_0x456315);return _0xa901c4?_0xa901c4:_0x8558bc;})['then'](function(_0x4477eb){_0x8558bc=_0x4477eb;return _0x1c1ed7[_0xd422('0x12')](_0x49916a);})[_0xd422('0x11')](function(_0xc71730){if(_0xc71730>=_0x8558bc){return _0x17d186[_0xd422('0x13')](0x193)[_0xd422('0x14')]({'message':util[_0xd422('0x15')](_0xd422('0x16'),_0x3c5b5f)});}_0x4aac2f();})[_0xd422('0x17')](function(_0xa01286){_0x4aac2f(_0xa01286);});});}function isUserLimit(){return isLimit(_0xd422('0x18'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0xd422('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 0cf24e1..bbf21f5 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 _0xb212=['>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$substring','pop','utcOffset','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','slice','shift','match','forEach','indexOf','push','DATE','operator','$eq','$between','value','add','days','format','YYYY-MM-DD','text','CAST(','field','castTo','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','=\x20?','<>\x20?','$startsWith','$endsWith','$lt','<\x20?','$gt','>\x20?','$lte','<=\x20?','$gte'];(function(_0x2d5887,_0xace828){var _0x257084=function(_0x457e3a){while(--_0x457e3a){_0x2d5887['push'](_0x2d5887['shift']());}};_0x257084(++_0xace828);}(_0xb212,0x139));var _0x2b21=function(_0x1c43a3,_0x482b7f){_0x1c43a3=_0x1c43a3-0x0;var _0x205ddd=_0xb212[_0x1c43a3];return _0x205ddd;};'use strict';var _=require(_0x2b21('0x0'));var moment=require(_0x2b21('0x1'));exports['parseSearch']=function(_0x150b1c){var _0x3af55c={'conditions':[]};_0x3af55c[_0x2b21('0x2')]=_[_0x2b21('0x3')](_0x150b1c,_0x2b21('0x4'))?'or':_0x2b21('0x5');var _0x12d370=_0x150b1c[_0x2b21('0x6')](_0x2b21('0x7'),'')[_0x2b21('0x6')](_0x2b21('0x4'),'')[_0x2b21('0x8')]('||');for(var _0x36b16a=0x0;_0x36b16a<_0x12d370['length'];_0x36b16a++){var _0x1e5aa0=_0x12d370[_0x36b16a]['split'](':=');var _0x3de3f7=_0x1e5aa0[0x0];var _0x5e2214=_0x1e5aa0[_0x2b21('0x9')](0x1);_0x5e2214['forEach'](function(_0x5c73cd){var _0x176009=_0x5c73cd[_0x2b21('0x8')]('[')[_0x2b21('0xa')]();var _0x1264c4=_0x5c73cd[_0x2b21('0xb')](/\[(.*?)\]/g);_0x1264c4[_0x2b21('0xc')](function(_0x1fe996){var _0x2ff932=_0x1fe996[_0x2b21('0x8')]('[')['filter'](function(_0x3eb0f0){return _0x3eb0f0[_0x2b21('0xd')](']')>-0x1;})['map'](function(_0x281d96){return _0x281d96[_0x2b21('0x8')](']')[0x0];})[0x0];_0x3af55c['conditions'][_0x2b21('0xe')]({'field':_0x3de3f7,'operator':_0x176009,'value':_0x2ff932});});});}return _0x3af55c;};exports['buildExpression']=function(_0xf87a55,_0x417a20,_0x3a153f){var _0xddfc2a={};if(_0x417a20===_0x2b21('0xf')){if(_0x3a153f[_0x2b21('0x10')]===_0x2b21('0x11')){_0x3a153f[_0x2b21('0x10')]=_0x2b21('0x12');_0x3a153f[_0x2b21('0x13')]+=','+_0x3a153f[_0x2b21('0x13')];}else if(_['includes'](['$gt','$lte'],_0x3a153f[_0x2b21('0x10')])){_0x3a153f[_0x2b21('0x13')]=moment(_0x3a153f[_0x2b21('0x13')])[_0x2b21('0x14')](0x1,_0x2b21('0x15'))[_0x2b21('0x16')](_0x2b21('0x17'));}}if(_0x3a153f['castTo']){_0x417a20=_0x3a153f['castTo'];_0xddfc2a[_0x2b21('0x18')]=_0x2b21('0x19')+_0xf87a55+'.'+_0x3a153f[_0x2b21('0x1a')]+'\x20AS\x20'+_0x3a153f[_0x2b21('0x1b')]+')\x20'+parseOperator(_0x3a153f['operator']);}else{_0xddfc2a[_0x2b21('0x18')]=_0xf87a55+'.'+_0x3a153f[_0x2b21('0x1a')]+'\x20'+parseOperator(_0x3a153f['operator']);}if(_[_0x2b21('0x1c')]([_0x2b21('0x1d'),_0x2b21('0x1e')],_0x3a153f[_0x2b21('0x10')]))_0xddfc2a[_0x2b21('0x18')]='('+_0xddfc2a[_0x2b21('0x18')]+_0x2b21('0x1f')+_0xf87a55+'.'+_0x3a153f[_0x2b21('0x1a')]+_0x2b21('0x20');_0xddfc2a['value']=parseValue(_0x417a20,_0x3a153f[_0x2b21('0x10')],_0x3a153f['value']);return _0xddfc2a;};function parseOperator(_0x1472f3){var _0x392082;switch(_0x1472f3){case'$in':_0x392082='IN\x20?';break;case _0x2b21('0x1e'):_0x392082='NOT\x20IN\x20?';break;case _0x2b21('0x11'):_0x392082=_0x2b21('0x21');break;case _0x2b21('0x1d'):_0x392082=_0x2b21('0x22');break;case'$substring':case _0x2b21('0x23'):case _0x2b21('0x24'):_0x392082='LIKE\x20?';break;case _0x2b21('0x25'):_0x392082=_0x2b21('0x26');break;case _0x2b21('0x27'):_0x392082=_0x2b21('0x28');break;case _0x2b21('0x29'):_0x392082=_0x2b21('0x2a');break;case _0x2b21('0x2b'):_0x392082=_0x2b21('0x2c');break;case _0x2b21('0x12'):_0x392082=_0x2b21('0x2d');break;}return _0x392082;}function parseValue(_0x49e749,_0x2234c7,_0x37bf8c){var _0x19da02={'start':undefined,'end':undefined};switch(_0x2234c7){case _0x2b21('0x2e'):case _0x2b21('0x1e'):_0x19da02[_0x2b21('0x2f')]=_0x37bf8c[_0x2b21('0x8')](',');break;case _0x2b21('0x30'):_0x19da02[_0x2b21('0x2f')]='%'+_0x37bf8c+'%';break;case _0x2b21('0x23'):_0x19da02[_0x2b21('0x2f')]=_0x37bf8c+'%';break;case'$endsWith':_0x19da02['start']='%'+_0x37bf8c;break;case _0x2b21('0x12'):var _0x10d301=_0x37bf8c['split'](',');var _0x37bf8c=_0x10d301['shift']();var _0x56bf1b=_0x10d301[_0x2b21('0x31')]();if(_0x49e749===_0x2b21('0xf')){_0x37bf8c=moment(_0x37bf8c)['utcOffset'](0x0,!![])[_0x2b21('0x16')]();_0x56bf1b=moment(_0x56bf1b)[_0x2b21('0x32')](0x0,!![])['add'](0x17,'hours')[_0x2b21('0x14')](0x3b,'minutes')[_0x2b21('0x14')](0x3b,'seconds')[_0x2b21('0x16')]();}_0x19da02={'start':_0x37bf8c,'end':_0x56bf1b};break;default:_0x19da02[_0x2b21('0x2f')]=_0x37bf8c;break;}return _0x19da02;} \ No newline at end of file +var _0x21a8=['\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','>=\x20?','start','utcOffset','add','hours','seconds','lodash','parseSearch','startsWith','[$or]','and','replace','split','slice','forEach','shift','indexOf','map','conditions','push','DATE','operator','$eq','$between','value','$gt','days','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','text','includes','$notIn'];(function(_0x3000bb,_0x1a37f1){var _0x2fe054=function(_0x5610f5){while(--_0x5610f5){_0x3000bb['push'](_0x3000bb['shift']());}};_0x2fe054(++_0x1a37f1);}(_0x21a8,0x1ad));var _0x821a=function(_0x2a861f,_0x326544){_0x2a861f=_0x2a861f-0x0;var _0x1cd348=_0x21a8[_0x2a861f];return _0x1cd348;};'use strict';var _=require(_0x821a('0x0'));var moment=require('moment');exports[_0x821a('0x1')]=function(_0x58ac05){var _0x58e1d5={'conditions':[]};_0x58e1d5['sqlOperator']=_[_0x821a('0x2')](_0x58ac05,_0x821a('0x3'))?'or':_0x821a('0x4');var _0xf509d8=_0x58ac05[_0x821a('0x5')]('[$and]','')[_0x821a('0x5')](_0x821a('0x3'),'')[_0x821a('0x6')]('||');for(var _0x33c22f=0x0;_0x33c22f<_0xf509d8['length'];_0x33c22f++){var _0x66748b=_0xf509d8[_0x33c22f][_0x821a('0x6')](':=');var _0x13054a=_0x66748b[0x0];var _0x49184c=_0x66748b[_0x821a('0x7')](0x1);_0x49184c[_0x821a('0x8')](function(_0x13254f){var _0x515f28=_0x13254f[_0x821a('0x6')]('[')[_0x821a('0x9')]();var _0x337c70=_0x13254f['match'](/\[(.*?)\]/g);_0x337c70[_0x821a('0x8')](function(_0x4e6bbd){var _0x48a2c2=_0x4e6bbd[_0x821a('0x6')]('[')['filter'](function(_0x22496e){return _0x22496e[_0x821a('0xa')](']')>-0x1;})[_0x821a('0xb')](function(_0x7ad434){return _0x7ad434[_0x821a('0x6')](']')[0x0];})[0x0];_0x58e1d5[_0x821a('0xc')][_0x821a('0xd')]({'field':_0x13054a,'operator':_0x515f28,'value':_0x48a2c2});});});}return _0x58e1d5;};exports['buildExpression']=function(_0x5ce925,_0x9ed081,_0x4afff7){var _0x4f58ce={};if(_0x9ed081===_0x821a('0xe')){if(_0x4afff7[_0x821a('0xf')]===_0x821a('0x10')){_0x4afff7[_0x821a('0xf')]=_0x821a('0x11');_0x4afff7[_0x821a('0x12')]+=','+_0x4afff7[_0x821a('0x12')];}else if(_['includes']([_0x821a('0x13'),'$lte'],_0x4afff7[_0x821a('0xf')])){_0x4afff7['value']=moment(_0x4afff7['value'])['add'](0x1,_0x821a('0x14'))[_0x821a('0x15')](_0x821a('0x16'));}}if(_0x4afff7['castTo']){_0x9ed081=_0x4afff7[_0x821a('0x17')];_0x4f58ce['text']=_0x821a('0x18')+_0x5ce925+'.'+_0x4afff7[_0x821a('0x19')]+_0x821a('0x1a')+_0x4afff7[_0x821a('0x17')]+')\x20'+parseOperator(_0x4afff7[_0x821a('0xf')]);}else{_0x4f58ce[_0x821a('0x1b')]=_0x5ce925+'.'+_0x4afff7[_0x821a('0x19')]+'\x20'+parseOperator(_0x4afff7['operator']);}if(_[_0x821a('0x1c')](['$ne',_0x821a('0x1d')],_0x4afff7[_0x821a('0xf')]))_0x4f58ce[_0x821a('0x1b')]='('+_0x4f58ce[_0x821a('0x1b')]+_0x821a('0x1e')+_0x5ce925+'.'+_0x4afff7[_0x821a('0x19')]+_0x821a('0x1f');_0x4f58ce[_0x821a('0x12')]=parseValue(_0x9ed081,_0x4afff7[_0x821a('0xf')],_0x4afff7[_0x821a('0x12')]);return _0x4f58ce;};function parseOperator(_0x4f20aa){var _0x2e552e;switch(_0x4f20aa){case _0x821a('0x20'):_0x2e552e=_0x821a('0x21');break;case _0x821a('0x1d'):_0x2e552e=_0x821a('0x22');break;case _0x821a('0x10'):_0x2e552e='=\x20?';break;case _0x821a('0x23'):_0x2e552e=_0x821a('0x24');break;case _0x821a('0x25'):case _0x821a('0x26'):case _0x821a('0x27'):_0x2e552e=_0x821a('0x28');break;case _0x821a('0x29'):_0x2e552e=_0x821a('0x2a');break;case'$gt':_0x2e552e='>\x20?';break;case'$lte':_0x2e552e=_0x821a('0x2b');break;case _0x821a('0x2c'):_0x2e552e=_0x821a('0x2d');break;case'$between':_0x2e552e='BETWEEN\x20?\x20AND\x20?';break;}return _0x2e552e;}function parseValue(_0x9e74d6,_0xcd9741,_0x97d536){var _0x38d024={'start':undefined,'end':undefined};switch(_0xcd9741){case _0x821a('0x20'):case _0x821a('0x1d'):_0x38d024[_0x821a('0x2e')]=_0x97d536[_0x821a('0x6')](',');break;case _0x821a('0x25'):_0x38d024[_0x821a('0x2e')]='%'+_0x97d536+'%';break;case _0x821a('0x26'):_0x38d024['start']=_0x97d536+'%';break;case _0x821a('0x27'):_0x38d024[_0x821a('0x2e')]='%'+_0x97d536;break;case _0x821a('0x11'):var _0x3fddf7=_0x97d536[_0x821a('0x6')](',');var _0x97d536=_0x3fddf7[_0x821a('0x9')]();var _0x500356=_0x3fddf7['pop']();if(_0x9e74d6==='DATE'){_0x97d536=moment(_0x97d536)['utcOffset'](0x0,!![])[_0x821a('0x15')]();_0x500356=moment(_0x500356)[_0x821a('0x2f')](0x0,!![])[_0x821a('0x30')](0x17,_0x821a('0x31'))[_0x821a('0x30')](0x3b,'minutes')['add'](0x3b,_0x821a('0x32'))[_0x821a('0x15')]();}_0x38d024={'start':_0x97d536,'end':_0x500356};break;default:_0x38d024[_0x821a('0x2e')]=_0x97d536;break;}return _0x38d024;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 1dbbf35..654efba 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 _0xd5ee=['isNumeric','match','^[0-9]*$','isEmail','getFullTextValue','forEach','push','lodash','moment','fields','split','isEmpty','forOwn','find','type','DATE','parse','$gte','format','YYYY-MM-DD','utc','$lte','isArray','limit','sort','map','priority','cast','col','unsigned','isObject','isString','unset','hasOwnProperty','omit'];(function(_0x4b5d2c,_0x4bcd69){var _0x38f6b2=function(_0x411356){while(--_0x411356){_0x4b5d2c['push'](_0x4b5d2c['shift']());}};_0x38f6b2(++_0x4bcd69);}(_0xd5ee,0x93));var _0xed5e=function(_0x5285f9,_0x2bd7d7){_0x5285f9=_0x5285f9-0x0;var _0x6edc0c=_0xd5ee[_0x5285f9];return _0x6edc0c;};'use strict';var _=require(_0xed5e('0x0'));var sequelize=require('sequelize');var moment=require(_0xed5e('0x1'));var LIMIT_VALUE=0xfa;exports[_0xed5e('0x2')]=function(_0x3d4b66){var _0x4c9096=null;if(_0x3d4b66){_0x4c9096=_0x3d4b66[_0xed5e('0x3')](',');}return _0x4c9096;};exports['filters']=function(_0x175a58,_0x45be67){var _0x1e85d2={};if(!_[_0xed5e('0x4')](_0x175a58)){_[_0xed5e('0x5')](_0x175a58,function(_0x465b37,_0x1f2ea7){try{if(_0x45be67){var _0x34dfe4=_[_0xed5e('0x6')](_0x45be67,{'name':_0x1f2ea7})||{};if(_0x34dfe4[_0xed5e('0x7')]===_0xed5e('0x8')&&_['isPlainObject'](_0x465b37)){var _0x2f13f2=JSON[_0xed5e('0x9')](_0x465b37);var _0x39e7a5={'$gte':moment(moment(_0x2f13f2[_0xed5e('0xa')])[_0xed5e('0xb')](_0xed5e('0xc')))[_0xed5e('0xd')]()[_0xed5e('0xb')](),'$lte':moment(moment(_0x2f13f2[_0xed5e('0xe')])[_0xed5e('0xb')](_0xed5e('0xc')))[_0xed5e('0xd')]()['subtract'](0x1,'s')[_0xed5e('0xb')]()};_0x1e85d2[_0x1f2ea7]=_0x39e7a5;}else{_0x1e85d2[_0x1f2ea7]=_[_0xed5e('0xf')](_0x465b37)?_0x465b37:JSON[_0xed5e('0x9')](_0x465b37);}}else{_0x1e85d2[_0x1f2ea7]=_[_0xed5e('0xf')](_0x465b37)?_0x465b37:JSON['parse'](_0x465b37);}}catch(_0x5adc89){_0x1e85d2[_0x1f2ea7]=_0x465b37[_0xed5e('0x3')](',');}});}return _0x1e85d2;};exports[_0xed5e('0x10')]=function(_0x1fc3a7){_0x1fc3a7=parseInt(_0x1fc3a7,0xa);if(!_0x1fc3a7||_0x1fc3a7<0x0){_0x1fc3a7=LIMIT_VALUE;}return _0x1fc3a7;};exports['offset']=function(_0x18b4ab){_0x18b4ab=parseInt(_0x18b4ab,0xa);if(!_0x18b4ab||_0x18b4ab<0x0){_0x18b4ab=0x0;}return _0x18b4ab;};exports[_0xed5e('0x11')]=function(_0x2952ac){var _0x10893d,_0x54fe57=null;if(_0x2952ac){_0x10893d=_0x2952ac[_0xed5e('0x3')](',');_0x54fe57=_[_0xed5e('0x12')](_0x10893d,function(_0xda157){if(_0xda157['indexOf']('-')===0x0){return[_0xda157===_0xed5e('0x13')?sequelize[_0xed5e('0x14')](sequelize[_0xed5e('0x15')]('priority'),_0xed5e('0x16')):_0xda157['substr'](0x1),'DESC'];}else{return[_0xda157===_0xed5e('0x13')?sequelize['cast'](sequelize[_0xed5e('0x15')](_0xed5e('0x13')),'unsigned'):_0xda157,'ASC'];}});}return _0x54fe57;};exports['omit']=function(_0x47ef2e,_0x4c7fa6){if(_[_0xed5e('0x4')](_0x47ef2e)){return _0x47ef2e;}if(_[_0xed5e('0xf')](_0x47ef2e)){for(var _0x10013f=0x0;_0x10013f<_0x47ef2e['length'];_0x10013f+=0x1){_0x47ef2e[_0x10013f]=this['omit'](_0x47ef2e[_0x10013f],_0x4c7fa6);}return _0x47ef2e;}if(!_[_0xed5e('0x17')](_0x47ef2e)){return _0x47ef2e;}if(_[_0xed5e('0x18')](_0x4c7fa6)){_0x4c7fa6=[_0x4c7fa6];}if(!_['isArray'](_0x4c7fa6)){return _0x47ef2e;}for(var _0x42a2f9=0x0;_0x42a2f9<_0x4c7fa6['length'];_0x42a2f9+=0x1){_[_0xed5e('0x19')](_0x47ef2e,_0x4c7fa6[_0x42a2f9]);}for(var _0x13433d in _0x47ef2e){if(_0x47ef2e[_0xed5e('0x1a')](_0x13433d)){_0x47ef2e[_0x13433d]=this[_0xed5e('0x1b')](_0x47ef2e[_0x13433d],_0x4c7fa6);}}return _0x47ef2e;};exports[_0xed5e('0x1c')]=function(_0x33e947){return _0x33e947[_0xed5e('0x1d')](RegExp(_0xed5e('0x1e')))?!![]:![];};exports[_0xed5e('0x1f')]=function(_0x5a9fc3){return _0x5a9fc3['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xed5e('0x20')]=function(_0x2dc7fd){var _0x19beeb=[];_0x2dc7fd[_0xed5e('0x3')]('\x20')[_0xed5e('0x21')](function(_0x44b3f){_0x19beeb[_0xed5e('0x22')]('+'+_0x44b3f['toString']()+'*');});return _0x19beeb['join']('\x20');}; \ No newline at end of file +var _0xd96d=['subtract','isArray','limit','sort','map','indexOf','priority','cast','col','unsigned','substr','ASC','omit','length','isObject','isString','hasOwnProperty','^[0-9]*$','forEach','push','join','sequelize','fields','split','isEmpty','find','type','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc'];(function(_0x3cf197,_0x511b5a){var _0x1939b0=function(_0x1407f1){while(--_0x1407f1){_0x3cf197['push'](_0x3cf197['shift']());}};_0x1939b0(++_0x511b5a);}(_0xd96d,0x180));var _0xdd96=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xd96d[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var sequelize=require(_0xdd96('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0xdd96('0x1')]=function(_0xde9010){var _0x52aa4b=null;if(_0xde9010){_0x52aa4b=_0xde9010[_0xdd96('0x2')](',');}return _0x52aa4b;};exports['filters']=function(_0x1f9690,_0x8ef44b){var _0x426cc2={};if(!_[_0xdd96('0x3')](_0x1f9690)){_['forOwn'](_0x1f9690,function(_0x1b1e29,_0x27bb5a){try{if(_0x8ef44b){var _0x5c3e58=_[_0xdd96('0x4')](_0x8ef44b,{'name':_0x27bb5a})||{};if(_0x5c3e58[_0xdd96('0x5')]==='DATE'&&_[_0xdd96('0x6')](_0x1b1e29)){var _0x48d020=JSON[_0xdd96('0x7')](_0x1b1e29);var _0x166ed7={'$gte':moment(moment(_0x48d020[_0xdd96('0x8')])[_0xdd96('0x9')](_0xdd96('0xa')))[_0xdd96('0xb')]()[_0xdd96('0x9')](),'$lte':moment(moment(_0x48d020['$lte'])[_0xdd96('0x9')](_0xdd96('0xa')))['utc']()[_0xdd96('0xc')](0x1,'s')[_0xdd96('0x9')]()};_0x426cc2[_0x27bb5a]=_0x166ed7;}else{_0x426cc2[_0x27bb5a]=_[_0xdd96('0xd')](_0x1b1e29)?_0x1b1e29:JSON[_0xdd96('0x7')](_0x1b1e29);}}else{_0x426cc2[_0x27bb5a]=_['isArray'](_0x1b1e29)?_0x1b1e29:JSON[_0xdd96('0x7')](_0x1b1e29);}}catch(_0x67e22f){_0x426cc2[_0x27bb5a]=_0x1b1e29[_0xdd96('0x2')](',');}});}return _0x426cc2;};exports[_0xdd96('0xe')]=function(_0x566d87){_0x566d87=parseInt(_0x566d87,0xa);if(!_0x566d87||_0x566d87<0x0){_0x566d87=LIMIT_VALUE;}return _0x566d87;};exports['offset']=function(_0x4a8a11){_0x4a8a11=parseInt(_0x4a8a11,0xa);if(!_0x4a8a11||_0x4a8a11<0x0){_0x4a8a11=0x0;}return _0x4a8a11;};exports[_0xdd96('0xf')]=function(_0xd19d36){var _0xba578,_0x2eef06=null;if(_0xd19d36){_0xba578=_0xd19d36[_0xdd96('0x2')](',');_0x2eef06=_[_0xdd96('0x10')](_0xba578,function(_0x381abd){if(_0x381abd[_0xdd96('0x11')]('-')===0x0){return[_0x381abd===_0xdd96('0x12')?sequelize[_0xdd96('0x13')](sequelize[_0xdd96('0x14')]('priority'),_0xdd96('0x15')):_0x381abd[_0xdd96('0x16')](0x1),'DESC'];}else{return[_0x381abd==='priority'?sequelize[_0xdd96('0x13')](sequelize[_0xdd96('0x14')](_0xdd96('0x12')),'unsigned'):_0x381abd,_0xdd96('0x17')];}});}return _0x2eef06;};exports[_0xdd96('0x18')]=function(_0x465ee5,_0x57681a){if(_[_0xdd96('0x3')](_0x465ee5)){return _0x465ee5;}if(_[_0xdd96('0xd')](_0x465ee5)){for(var _0x70754b=0x0;_0x70754b<_0x465ee5[_0xdd96('0x19')];_0x70754b+=0x1){_0x465ee5[_0x70754b]=this[_0xdd96('0x18')](_0x465ee5[_0x70754b],_0x57681a);}return _0x465ee5;}if(!_[_0xdd96('0x1a')](_0x465ee5)){return _0x465ee5;}if(_[_0xdd96('0x1b')](_0x57681a)){_0x57681a=[_0x57681a];}if(!_[_0xdd96('0xd')](_0x57681a)){return _0x465ee5;}for(var _0x3f045f=0x0;_0x3f045f<_0x57681a[_0xdd96('0x19')];_0x3f045f+=0x1){_['unset'](_0x465ee5,_0x57681a[_0x3f045f]);}for(var _0x1daa07 in _0x465ee5){if(_0x465ee5[_0xdd96('0x1c')](_0x1daa07)){_0x465ee5[_0x1daa07]=this[_0xdd96('0x18')](_0x465ee5[_0x1daa07],_0x57681a);}}return _0x465ee5;};exports['isNumeric']=function(_0x332896){return _0x332896['match'](RegExp(_0xdd96('0x1d')))?!![]:![];};exports['isEmail']=function(_0x21a969){return _0x21a969['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x430221){var _0x5795fd=[];_0x430221['split']('\x20')[_0xdd96('0x1e')](function(_0x58dd7b){_0x5795fd[_0xdd96('0x1f')]('+'+_0x58dd7b['toString']()+'*');});return _0x5795fd[_0xdd96('0x20')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index f469bf6..f825313 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5802=['use','urlencoded','json','initialize','express','method-override','cookie-parser','passport','moment','./environment','../mysqldb','default','env','production','join','root','test','set','client','json\x20replacer','toISOString','split','get','appPath','/server/views','engine','html','renderFile'];(function(_0x5e9248,_0x524895){var _0xd434ac=function(_0x5e2342){while(--_0x5e2342){_0x5e9248['push'](_0x5e9248['shift']());}};_0xd434ac(++_0x524895);}(_0x5802,0x90));var _0x2580=function(_0x459573,_0x35679e){_0x459573=_0x459573-0x0;var _0x51ffcd=_0x5802[_0x459573];return _0x51ffcd;};'use strict';var express=require(_0x2580('0x0'));var favicon=require('serve-favicon');var bodyParser=require('body-parser');var methodOverride=require(_0x2580('0x1'));var cookieParser=require(_0x2580('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x2580('0x3'));var cors=require('cors');var moment=require(_0x2580('0x4'));var config=require(_0x2580('0x5'));var db=require(_0x2580('0x6'))['db'];exports[_0x2580('0x7')]=function(_0x2a3bd3){var _0x1a4ea9=_0x2a3bd3['get'](_0x2580('0x8'));if(_0x1a4ea9===_0x2580('0x9')){_0x2a3bd3['set']('appPath',path[_0x2580('0xa')](config[_0x2580('0xb')],'public'));}if(_0x1a4ea9==='development'||_0x1a4ea9===_0x2580('0xc')){_0x2a3bd3[_0x2580('0xd')]('appPath',path[_0x2580('0xa')](config[_0x2580('0xb')],_0x2580('0xe')));_0x2a3bd3['use'](errorHandler());}_0x2a3bd3[_0x2580('0xd')](_0x2580('0xf'),function(_0x2738d3,_0x28aa62){if(this[_0x2738d3]instanceof Date){_0x28aa62=this[_0x2738d3][_0x2580('0x10')]()[_0x2580('0x11')]('.')[0x0]+'Z';}return _0x28aa62;});_0x2a3bd3['use'](express['static'](_0x2a3bd3[_0x2580('0x12')](_0x2580('0x13'))));_0x2a3bd3['set']('views',config[_0x2580('0xb')]+_0x2580('0x14'));_0x2a3bd3[_0x2580('0x15')](_0x2580('0x16'),require('ejs')[_0x2580('0x17')]);_0x2a3bd3[_0x2580('0xd')]('view\x20engine','html');_0x2a3bd3[_0x2580('0x18')](bodyParser[_0x2580('0x19')]({'limit':'50mb','extended':!![]}));_0x2a3bd3[_0x2580('0x18')](bodyParser[_0x2580('0x1a')]({'limit':'50mb'}));_0x2a3bd3[_0x2580('0x18')](cors());_0x2a3bd3[_0x2580('0x18')](methodOverride());_0x2a3bd3[_0x2580('0x18')](cookieParser());_0x2a3bd3['use'](passport[_0x2580('0x1b')]());}; \ No newline at end of file +var _0x1f29=['default','get','env','production','development','test','set','appPath','join','root','client','use','json\x20replacer','toISOString','split','static','views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','path','passport','cors','./environment','../mysqldb'];(function(_0x2d4371,_0x2a71a9){var _0x5d6727=function(_0x5b36f3){while(--_0x5b36f3){_0x2d4371['push'](_0x2d4371['shift']());}};_0x5d6727(++_0x2a71a9);}(_0x1f29,0x182));var _0x91f2=function(_0x2a3595,_0x3dbdd2){_0x2a3595=_0x2a3595-0x0;var _0x2d8e55=_0x1f29[_0x2a3595];return _0x2d8e55;};'use strict';var express=require(_0x91f2('0x0'));var favicon=require(_0x91f2('0x1'));var bodyParser=require(_0x91f2('0x2'));var methodOverride=require(_0x91f2('0x3'));var cookieParser=require(_0x91f2('0x4'));var errorHandler=require('errorhandler');var path=require(_0x91f2('0x5'));var passport=require(_0x91f2('0x6'));var cors=require(_0x91f2('0x7'));var moment=require('moment');var config=require(_0x91f2('0x8'));var db=require(_0x91f2('0x9'))['db'];exports[_0x91f2('0xa')]=function(_0x135f3e){var _0x901aa9=_0x135f3e[_0x91f2('0xb')](_0x91f2('0xc'));if(_0x901aa9===_0x91f2('0xd')){_0x135f3e['set']('appPath',path['join'](config['root'],'public'));}if(_0x901aa9===_0x91f2('0xe')||_0x901aa9===_0x91f2('0xf')){_0x135f3e[_0x91f2('0x10')](_0x91f2('0x11'),path[_0x91f2('0x12')](config[_0x91f2('0x13')],_0x91f2('0x14')));_0x135f3e[_0x91f2('0x15')](errorHandler());}_0x135f3e['set'](_0x91f2('0x16'),function(_0x50d741,_0x9ddcfc){if(this[_0x50d741]instanceof Date){_0x9ddcfc=this[_0x50d741][_0x91f2('0x17')]()[_0x91f2('0x18')]('.')[0x0]+'Z';}return _0x9ddcfc;});_0x135f3e['use'](express[_0x91f2('0x19')](_0x135f3e[_0x91f2('0xb')]('appPath')));_0x135f3e[_0x91f2('0x10')](_0x91f2('0x1a'),config[_0x91f2('0x13')]+'/server/views');_0x135f3e[_0x91f2('0x1b')](_0x91f2('0x1c'),require(_0x91f2('0x1d'))[_0x91f2('0x1e')]);_0x135f3e['set'](_0x91f2('0x1f'),_0x91f2('0x1c'));_0x135f3e['use'](bodyParser[_0x91f2('0x20')]({'limit':_0x91f2('0x21'),'extended':!![]}));_0x135f3e[_0x91f2('0x15')](bodyParser[_0x91f2('0x22')]({'limit':_0x91f2('0x21')}));_0x135f3e[_0x91f2('0x15')](cors());_0x135f3e[_0x91f2('0x15')](methodOverride());_0x135f3e[_0x91f2('0x15')](cookieParser());_0x135f3e[_0x91f2('0x15')](passport[_0x91f2('0x23')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index c9ea5fc..478aeea 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 _0x0a52=['concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','model','join','md5','update','digest','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','createHash','substring','lodash','crypto','child_process','execSync','networkInterfaces','orderBy','keys','length','family','internal'];(function(_0x187842,_0x58331c){var _0x5dbcf3=function(_0x55faef){while(--_0x55faef){_0x187842['push'](_0x187842['shift']());}};_0x5dbcf3(++_0x58331c);}(_0x0a52,0xe4));var _0x20a5=function(_0xc22df2,_0x16f608){_0xc22df2=_0xc22df2-0x0;var _0x4b1166=_0x0a52[_0xc22df2];return _0x4b1166;};'use strict';var _=require(_0x20a5('0x0'));var os=require('os');var crypto=require(_0x20a5('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x20a5('0x2'))[_0x20a5('0x3')];function getInterfaces(){var _0xe4dbc9=[];var _0x5a71da=os[_0x20a5('0x4')]();var _0x16e604=_[_0x20a5('0x5')](_[_0x20a5('0x6')](_0x5a71da));for(var _0x2eb093=0x0;_0x2eb093<_0x16e604[_0x20a5('0x7')];_0x2eb093++){var _0x4acc66=_0x5a71da[_0x16e604[_0x2eb093]]['filter'](function(_0x39920b){return _0x39920b[_0x20a5('0x8')]==='IPv4'&&_0x39920b[_0x20a5('0x9')]===![];});_0xe4dbc9=_0xe4dbc9[_0x20a5('0xa')](_0x4acc66);}return _0xe4dbc9;}function getFirstInterface(){var _0x1835e3=_[_0x20a5('0xb')](getInterfaces());return{'macAddress':_0x1835e3&&_0x1835e3['mac']?_0x1835e3[_0x20a5('0xc')]:_0x20a5('0xd'),'ipAddress':_0x1835e3&&_0x1835e3[_0x20a5('0xe')]?_0x1835e3[_0x20a5('0xe')]:_0x20a5('0xf')};}exports[_0x20a5('0x10')]=getFirstInterface;function getCPUhash(){var _0x34db0d=_[_0x20a5('0x5')](os['cpus']()[_0x20a5('0x11')](function(_0x5e6c3b){return _0x5e6c3b[_0x20a5('0x12')];}))[_0x20a5('0x13')](':');return crypto['createHash'](_0x20a5('0x14'))[_0x20a5('0x15')](_0x34db0d)[_0x20a5('0x16')](_0x20a5('0x17'));}exports[_0x20a5('0x18')]=function(){switch(os[_0x20a5('0x19')]()){case _0x20a5('0x1a'):return exec(_0x20a5('0x1b'),{'encoding':_0x20a5('0x1c')})[_0x20a5('0x1d')]('\x0d\x0a','');default:var _0x24e1b0=getFirstInterface();var _0x2744d5=getCPUhash();var _0x5137d7=_0x2744d5+'|'+os[_0x20a5('0x1e')]()+'|'+_0x24e1b0['macAddress']+'|'+_0x24e1b0[_0x20a5('0x1f')];var _0xcd18a=crypto[_0x20a5('0x20')](_0x20a5('0x14'))[_0x20a5('0x15')](_0x5137d7)[_0x20a5('0x16')](_0x20a5('0x17'));return _0xcd18a['substring'](0x0,0x8)+'-'+_0xcd18a[_0x20a5('0x21')](0x8,0xc)+'-'+_0xcd18a['substring'](0xc,0x10)+'-'+_0xcd18a[_0x20a5('0x21')](0x10,0x14)+'-'+_0xcd18a[_0x20a5('0x21')](0x14);}}; \ No newline at end of file +var _0xf8b2=['getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','createHash','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','keys','length','filter','family','IPv4','internal','head','mac','00:00:00:00:00:00','address','orderBy','cpus','map','join','md5','update','digest','hex'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x472917,_0x34d079){_0x472917=_0x472917-0x0;var _0x2fffae=_0xf8b2[_0x472917];return _0x2fffae;};'use strict';var _=require(_0x2f8b('0x0'));var os=require('os');var crypto=require(_0x2f8b('0x1'));var machine=require(_0x2f8b('0x2'));var exec=require(_0x2f8b('0x3'))[_0x2f8b('0x4')];function getInterfaces(){var _0x365b20=[];var _0x22e1c8=os[_0x2f8b('0x5')]();var _0x50dae3=_['orderBy'](_[_0x2f8b('0x6')](_0x22e1c8));for(var _0x242821=0x0;_0x242821<_0x50dae3[_0x2f8b('0x7')];_0x242821++){var _0x1d133a=_0x22e1c8[_0x50dae3[_0x242821]][_0x2f8b('0x8')](function(_0x2cc1e9){return _0x2cc1e9[_0x2f8b('0x9')]===_0x2f8b('0xa')&&_0x2cc1e9[_0x2f8b('0xb')]===![];});_0x365b20=_0x365b20['concat'](_0x1d133a);}return _0x365b20;}function getFirstInterface(){var _0xdb9718=_[_0x2f8b('0xc')](getInterfaces());return{'macAddress':_0xdb9718&&_0xdb9718[_0x2f8b('0xd')]?_0xdb9718['mac']:_0x2f8b('0xe'),'ipAddress':_0xdb9718&&_0xdb9718[_0x2f8b('0xf')]?_0xdb9718[_0x2f8b('0xf')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x14811d=_[_0x2f8b('0x10')](os[_0x2f8b('0x11')]()[_0x2f8b('0x12')](function(_0x175111){return _0x175111['model'];}))[_0x2f8b('0x13')](':');return crypto['createHash'](_0x2f8b('0x14'))[_0x2f8b('0x15')](_0x14811d)[_0x2f8b('0x16')](_0x2f8b('0x17'));}exports[_0x2f8b('0x18')]=function(){switch(os[_0x2f8b('0x19')]()){case _0x2f8b('0x1a'):return exec(_0x2f8b('0x1b'),{'encoding':'utf8'})[_0x2f8b('0x1c')]('\x0d\x0a','');default:var _0xdec711=getFirstInterface();var _0x2daba9=getCPUhash();var _0xcc7e2c=_0x2daba9+'|'+os[_0x2f8b('0x1d')]()+'|'+_0xdec711[_0x2f8b('0x1e')]+'|'+_0xdec711[_0x2f8b('0x1f')];var _0x1fe74a=crypto[_0x2f8b('0x20')]('md5')[_0x2f8b('0x15')](_0xcc7e2c)[_0x2f8b('0x16')](_0x2f8b('0x17'));return _0x1fe74a['substring'](0x0,0x8)+'-'+_0x1fe74a[_0x2f8b('0x21')](0x8,0xc)+'-'+_0x1fe74a['substring'](0xc,0x10)+'-'+_0x1fe74a[_0x2f8b('0x21')](0x10,0x14)+'-'+_0x1fe74a[_0x2f8b('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7ab5e94..55d7199 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 _0xa5d7=['GET','then','catch','createCipher','aes-256-ctr','utf8','base64','final','secrets','session','update','||FIELD||VALUE||\x0a','findOne','fullname','email','|uuid|','|email|','getFirstInterface','openIssue','Motion\x20License\x20Alert','Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','crypto','moment','request-promise','pkginfo','../../mysqldb','./hardware','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','exports','version'];(function(_0x41d271,_0x530f74){var _0x1924d1=function(_0x7e4c92){while(--_0x7e4c92){_0x41d271['push'](_0x41d271['shift']());}};_0x1924d1(++_0x530f74);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x2f38c0,_0x17dbcc){_0x2f38c0=_0x2f38c0-0x0;var _0x2ff8f5=_0xa5d7[_0x2f38c0];return _0x2ff8f5;};'use strict';var util=require(_0x7a5d('0x0'));var crypto=require(_0x7a5d('0x1'));var moment=require(_0x7a5d('0x2'));var rp=require(_0x7a5d('0x3'));var BPromise=require('bluebird');var pkginfo=require(_0x7a5d('0x4'))(module,'version');var db=require(_0x7a5d('0x5'))['db'];var config=require('../environment');var hardware=require(_0x7a5d('0x6'));var logger=require('../logger')(_0x7a5d('0x7'));var jira=require(_0x7a5d('0x8'));var HOST=_0x7a5d('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x4cb015){return new BPromise(function(_0x2092de,_0xc34a6a){var _0x5e6442=util[_0x7a5d('0xa')]('%s/api/servers/%s/check?version=%s',HOST,_0x4cb015,module[_0x7a5d('0xb')][_0x7a5d('0xc')]);if(oldToken){_0x5e6442=util[_0x7a5d('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x4cb015,module[_0x7a5d('0xb')][_0x7a5d('0xc')],oldToken);}var _0x25da61={'uri':_0x5e6442,'method':_0x7a5d('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x25da61)[_0x7a5d('0xe')](function(_0x1b6a3f){_0x2092de(_0x1b6a3f);})[_0x7a5d('0xf')](function(_0x42d2cc){_0xc34a6a(_0x42d2cc);});});}function encryptDate(_0x196db3){var _0xc4d232=crypto[_0x7a5d('0x10')](_0x7a5d('0x11'),config['secrets']['session']);var _0x34d400=_0xc4d232['update'](_0x196db3,_0x7a5d('0x12'),_0x7a5d('0x13'));_0x34d400+=_0xc4d232[_0x7a5d('0x14')](_0x7a5d('0x13'));return _0x34d400;}function decryptDate(_0xd9d560){var _0x342f63=crypto['createDecipher'](_0x7a5d('0x11'),config[_0x7a5d('0x15')][_0x7a5d('0x16')]);var _0xc57403=_0x342f63[_0x7a5d('0x17')](_0xd9d560,'base64',_0x7a5d('0x12'));_0xc57403+=_0x342f63[_0x7a5d('0x14')]('utf8');return _0xc57403;}function sendJiraAlert(_0x4ea1b5,_0x1e710c,_0x4229f6){var _0x55fac7=_0x7a5d('0x18');return db['User'][_0x7a5d('0x19')]({'where':{'role':'admin'},'attributes':[_0x7a5d('0x1a'),_0x7a5d('0x1b')],'raw':!![]})['then'](function(_0x3df067){ADMIN=_0x3df067;_0x55fac7+='|reason|'+_0x4229f6+'|\x0a';_0x55fac7+=_0x7a5d('0x1c')+_0x4ea1b5+'|\x0a';_0x55fac7+='|machineUuid|'+_0x1e710c+'|\x0a';_0x55fac7+='|name|'+ADMIN[_0x7a5d('0x1a')]+'|\x0a';_0x55fac7+=_0x7a5d('0x1d')+ADMIN[_0x7a5d('0x1b')]+'|\x0a';return _0x55fac7;})['then'](function(_0x7b8ce1){var _0x45377a=hardware[_0x7a5d('0x1e')]()['ipAddress'];return jira[_0x7a5d('0x1f')]({'key':'MOTLICENSE','summary':_0x7a5d('0x20'),'description':_0x7b8ce1,'issuetype':_0x7a5d('0x21'),'oldToken':_0x4ea1b5,'newToken':_0x1e710c,'email':ADMIN[_0x7a5d('0x1b')],'name':ADMIN[_0x7a5d('0x1a')],'reason':GRAY_PERIOD_REASON,'ip':_0x45377a});});}function manageLicense(_0x7383c0,_0x65cc6f){var _0x58d59c=_0x65cc6f[_0x7a5d('0x22')]({'plain':!![]});httpRequest(_0x7383c0)[_0x7a5d('0xe')](function(_0x4bd5fd){if(oldToken){oldToken=undefined;}if(_0x4bd5fd[_0x7a5d('0x23')]){if(!_0x58d59c[_0x7a5d('0x7')]&&_0x58d59c[_0x7a5d('0x7')]!=_0x4bd5fd[_0x7a5d('0x7')]||_0x58d59c['license']&&_0x58d59c[_0x7a5d('0x24')]){logger[_0x7a5d('0x25')](_0x7a5d('0x26'));}if(_0x58d59c[_0x7a5d('0x7')]&&!_0x58d59c[_0x7a5d('0x24')]&&_0x58d59c[_0x7a5d('0x7')]!=_0x4bd5fd[_0x7a5d('0x7')]){logger[_0x7a5d('0x25')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x58d59c[_0x7a5d('0x7')]&&!_0x58d59c[_0x7a5d('0x24')]&&_0x58d59c[_0x7a5d('0x7')]==_0x4bd5fd[_0x7a5d('0x7')]){return _0x65cc6f;}return _0x65cc6f[_0x7a5d('0x17')]({'data1':_0x7383c0,'data2':null,'license':_0x4bd5fd[_0x7a5d('0x7')]});}else{if(_0x4bd5fd[_0x7a5d('0x7')]||_0x58d59c[_0x7a5d('0x7')]){if(!_0x58d59c[_0x7a5d('0x24')]){if(_0x58d59c[_0x7a5d('0x27')]==_0x7383c0){GRAY_PERIOD_REASON=_0x7a5d('0x28');logger[_0x7a5d('0x25')](_0x7a5d('0x29'));}else{GRAY_PERIOD_REASON=_0x7a5d('0x2a');oldToken=_0x58d59c['data1'];logger[_0x7a5d('0x25')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x58d59c[_0x7a5d('0x27')],_0x7383c0);}sendJiraAlert(_0x58d59c[_0x7a5d('0x27')],_0x4bd5fd[_0x7a5d('0x2b')],GRAY_PERIOD_REASON);logger['info'](_0x7a5d('0x2c'),GRAY_PERIOD_REASON[_0x7a5d('0x2d')](),moment()[_0x7a5d('0xa')](_0x7a5d('0x2e')));return _0x65cc6f['update']({'data2':encryptDate(moment()[_0x7a5d('0xa')](_0x7a5d('0x2e')))});}else{if(moment()[_0x7a5d('0x2f')](decryptDate(_0x58d59c[_0x7a5d('0x24')]),_0x7a5d('0x30'))>DAYS){logger[_0x7a5d('0x25')]('DEMO\x20START\x20AT\x20%s',moment()[_0x7a5d('0xa')](_0x7a5d('0x2e')));return _0x65cc6f[_0x7a5d('0x17')]({'data1':_0x7383c0,'data2':null,'license':null});}}}else{if(_0x58d59c['data1']!=_0x7383c0){logger[_0x7a5d('0x25')](_0x7a5d('0x31'),_0x58d59c[_0x7a5d('0x27')],_0x7383c0);return _0x65cc6f[_0x7a5d('0x17')]({'data1':_0x7383c0,'data2':null,'license':null});}}}return _0x65cc6f;})[_0x7a5d('0xe')](function(_0x3f6f11){_0x65cc6f=_0x3f6f11;})[_0x7a5d('0xf')](function(_0x292055){logger[_0x7a5d('0x32')](_0x292055[_0x7a5d('0x33')]);})[_0x7a5d('0x34')](function(){setTimeout(function(){manageLicense(hardware[_0x7a5d('0x35')](),_0x65cc6f);},TIME);});}function defaultLicense(){var _0x174e54=hardware[_0x7a5d('0x35')]();if(_0x174e54){return db['License'][_0x7a5d('0x36')]({'where':{'id':0x1},'defaults':{'data1':_0x174e54}})[_0x7a5d('0x37')](function(_0x24c8e1,_0x12ac4b){logger[_0x7a5d('0x25')](_0x7a5d('0x38'),_0x174e54);manageLicense(_0x174e54,_0x24c8e1);})[_0x7a5d('0xf')](function(_0x143156){logger[_0x7a5d('0x32')](_0x143156['message']);});}}exports[_0x7a5d('0x39')]=defaultLicense; \ No newline at end of file +var _0xb7f0=['exports','GET','then','catch','createCipher','aes-256-ctr','session','update','utf8','base64','final','createDecipher','secrets','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','|reason|','|uuid|','|name|','|email|','email','getFirstInterface','ipAddress','MOTLICENSE','Motion\x20License\x20Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','days','DEMO\x20START\x20AT\x20%s','message','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','crypto','moment','request-promise','version','../../mysqldb','../environment','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format'];(function(_0x3e01c7,_0x20c920){var _0x27dce5=function(_0x1da441){while(--_0x1da441){_0x3e01c7['push'](_0x3e01c7['shift']());}};_0x27dce5(++_0x20c920);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x1cb86d,_0x202738){_0x1cb86d=_0x1cb86d-0x0;var _0x4130c3=_0xb7f0[_0x1cb86d];return _0x4130c3;};'use strict';var util=require(_0x0b7f('0x0'));var crypto=require(_0x0b7f('0x1'));var moment=require(_0x0b7f('0x2'));var rp=require(_0x0b7f('0x3'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x0b7f('0x4'));var db=require(_0x0b7f('0x5'))['db'];var config=require(_0x0b7f('0x6'));var hardware=require(_0x0b7f('0x7'));var logger=require(_0x0b7f('0x8'))(_0x0b7f('0x9'));var jira=require(_0x0b7f('0xa'));var HOST=_0x0b7f('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x10dc6c){return new BPromise(function(_0x36ff5c,_0x53f9a5){var _0x98065a=util[_0x0b7f('0xc')]('%s/api/servers/%s/check?version=%s',HOST,_0x10dc6c,module[_0x0b7f('0xd')][_0x0b7f('0x4')]);if(oldToken){_0x98065a=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x10dc6c,module['exports'][_0x0b7f('0x4')],oldToken);}var _0x1e8f0a={'uri':_0x98065a,'method':_0x0b7f('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x1e8f0a)[_0x0b7f('0xf')](function(_0x43114c){_0x36ff5c(_0x43114c);})[_0x0b7f('0x10')](function(_0x23a0b4){_0x53f9a5(_0x23a0b4);});});}function encryptDate(_0x1ed8aa){var _0x1af907=crypto[_0x0b7f('0x11')](_0x0b7f('0x12'),config['secrets'][_0x0b7f('0x13')]);var _0x1ea72c=_0x1af907[_0x0b7f('0x14')](_0x1ed8aa,_0x0b7f('0x15'),_0x0b7f('0x16'));_0x1ea72c+=_0x1af907[_0x0b7f('0x17')](_0x0b7f('0x16'));return _0x1ea72c;}function decryptDate(_0x18069a){var _0x5a2b0b=crypto[_0x0b7f('0x18')](_0x0b7f('0x12'),config[_0x0b7f('0x19')][_0x0b7f('0x13')]);var _0x58c901=_0x5a2b0b[_0x0b7f('0x14')](_0x18069a,_0x0b7f('0x16'),_0x0b7f('0x15'));_0x58c901+=_0x5a2b0b[_0x0b7f('0x17')](_0x0b7f('0x15'));return _0x58c901;}function sendJiraAlert(_0x50cee2,_0x4545aa,_0x5112be){var _0x5b9062=_0x0b7f('0x1a');return db[_0x0b7f('0x1b')][_0x0b7f('0x1c')]({'where':{'role':_0x0b7f('0x1d')},'attributes':[_0x0b7f('0x1e'),'email'],'raw':!![]})['then'](function(_0x651668){ADMIN=_0x651668;_0x5b9062+=_0x0b7f('0x1f')+_0x5112be+'|\x0a';_0x5b9062+=_0x0b7f('0x20')+_0x50cee2+'|\x0a';_0x5b9062+='|machineUuid|'+_0x4545aa+'|\x0a';_0x5b9062+=_0x0b7f('0x21')+ADMIN[_0x0b7f('0x1e')]+'|\x0a';_0x5b9062+=_0x0b7f('0x22')+ADMIN[_0x0b7f('0x23')]+'|\x0a';return _0x5b9062;})[_0x0b7f('0xf')](function(_0x44a0ae){var _0x459389=hardware[_0x0b7f('0x24')]()[_0x0b7f('0x25')];return jira['openIssue']({'key':_0x0b7f('0x26'),'summary':_0x0b7f('0x27'),'description':_0x44a0ae,'issuetype':'Alert','oldToken':_0x50cee2,'newToken':_0x4545aa,'email':ADMIN['email'],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x459389});});}function manageLicense(_0x37a5e5,_0x4e9a0a){var _0x4e61be=_0x4e9a0a[_0x0b7f('0x28')]({'plain':!![]});httpRequest(_0x37a5e5)[_0x0b7f('0xf')](function(_0x14152a){if(oldToken){oldToken=undefined;}if(_0x14152a[_0x0b7f('0x29')]){if(!_0x4e61be[_0x0b7f('0x9')]&&_0x4e61be[_0x0b7f('0x9')]!=_0x14152a[_0x0b7f('0x9')]||_0x4e61be[_0x0b7f('0x9')]&&_0x4e61be[_0x0b7f('0x2a')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x4e61be['license']&&!_0x4e61be[_0x0b7f('0x2a')]&&_0x4e61be['license']!=_0x14152a[_0x0b7f('0x9')]){logger[_0x0b7f('0x2b')](_0x0b7f('0x2c'));}if(_0x4e61be[_0x0b7f('0x9')]&&!_0x4e61be[_0x0b7f('0x2a')]&&_0x4e61be[_0x0b7f('0x9')]==_0x14152a[_0x0b7f('0x9')]){return _0x4e9a0a;}return _0x4e9a0a['update']({'data1':_0x37a5e5,'data2':null,'license':_0x14152a['license']});}else{if(_0x14152a[_0x0b7f('0x9')]||_0x4e61be['license']){if(!_0x4e61be[_0x0b7f('0x2a')]){if(_0x4e61be[_0x0b7f('0x2d')]==_0x37a5e5){GRAY_PERIOD_REASON=_0x0b7f('0x2e');logger[_0x0b7f('0x2b')](_0x0b7f('0x2f'));}else{GRAY_PERIOD_REASON=_0x0b7f('0x30');oldToken=_0x4e61be[_0x0b7f('0x2d')];logger[_0x0b7f('0x2b')](_0x0b7f('0x31'),_0x4e61be['data1'],_0x37a5e5);}sendJiraAlert(_0x4e61be['data1'],_0x14152a[_0x0b7f('0x32')],GRAY_PERIOD_REASON);logger[_0x0b7f('0x2b')](_0x0b7f('0x33'),GRAY_PERIOD_REASON[_0x0b7f('0x34')](),moment()[_0x0b7f('0xc')](_0x0b7f('0x35')));return _0x4e9a0a[_0x0b7f('0x14')]({'data2':encryptDate(moment()[_0x0b7f('0xc')](_0x0b7f('0x35')))});}else{if(moment()['diff'](decryptDate(_0x4e61be['data2']),_0x0b7f('0x36'))>DAYS){logger['info'](_0x0b7f('0x37'),moment()['format'](_0x0b7f('0x35')));return _0x4e9a0a[_0x0b7f('0x14')]({'data1':_0x37a5e5,'data2':null,'license':null});}}}else{if(_0x4e61be[_0x0b7f('0x2d')]!=_0x37a5e5){logger[_0x0b7f('0x2b')](_0x0b7f('0x31'),_0x4e61be[_0x0b7f('0x2d')],_0x37a5e5);return _0x4e9a0a[_0x0b7f('0x14')]({'data1':_0x37a5e5,'data2':null,'license':null});}}}return _0x4e9a0a;})[_0x0b7f('0xf')](function(_0x25e08a){_0x4e9a0a=_0x25e08a;})['catch'](function(_0x5a46c8){logger['error'](_0x5a46c8[_0x0b7f('0x38')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x0b7f('0x39')](),_0x4e9a0a);},TIME);});}function defaultLicense(){var _0x31f317=hardware[_0x0b7f('0x39')]();if(_0x31f317){return db[_0x0b7f('0x3a')][_0x0b7f('0x3b')]({'where':{'id':0x1},'defaults':{'data1':_0x31f317}})['spread'](function(_0x432c1b,_0x2eafb6){logger[_0x0b7f('0x2b')](_0x0b7f('0x3c'),_0x31f317);manageLicense(_0x31f317,_0x432c1b);})[_0x0b7f('0x10')](function(_0x5b9d5d){logger[_0x0b7f('0x3d')](_0x5b9d5d[_0x0b7f('0x38')]);});}}exports[_0x0b7f('0x3e')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 52bde6e..df3832b 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 _0x32c4=['lodash','moment','../environment','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','format','%s:%s:%s','base64','final','utf8','parse','demo','uuid','machineUuid','createDecipher','aes-256-ctr','secrets','session','update','deadline','add','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','message','Demo\x20license','getLicense','License','then','checkLicense','util'];(function(_0x2bcb0b,_0x4a5057){var _0x1efbed=function(_0x1d885a){while(--_0x1d885a){_0x2bcb0b['push'](_0x2bcb0b['shift']());}};_0x1efbed(++_0x4a5057);}(_0x32c4,0x71));var _0x432c=function(_0x487bce,_0xd11228){_0x487bce=_0x487bce-0x0;var _0x17ba7a=_0x32c4[_0x487bce];return _0x17ba7a;};'use strict';var crypto=require('crypto');var util=require(_0x432c('0x0'));var _=require(_0x432c('0x1'));var moment=require(_0x432c('0x2'));var hardware=require('./hardware');var config=require(_0x432c('0x3'));var db=require('../../mysqldb')['db'];function checkLicense(_0x2daa84,_0x43ba5c){if(_0x2daa84){try{var _0x5438b4=_0x43ba5c||_0x2daa84['license'];if(_[_0x432c('0x4')](_0x5438b4)){throw new Error(_0x432c('0x5'));}var _0x2beb91=_0x2daa84[_0x432c('0x6')];var _0x184130=_0x2daa84[_0x432c('0x7')];var _0x42d08e=_0x2beb91['split']('-')[0x4];var _0x214f04=_0x2beb91[_0x432c('0x8')]('-')[0x0];var _0x535e82=crypto['createDecipher']('aes-256-ctr',util[_0x432c('0x9')](_0x432c('0xa'),_0x42d08e,_0x2beb91,_0x214f04));var _0x20b33e=_0x535e82['update'](_0x5438b4,_0x432c('0xb'),'utf8');_0x20b33e+=_0x535e82[_0x432c('0xc')](_0x432c('0xd'));var _0x30483d=JSON[_0x432c('0xe')](_0x20b33e);_0x30483d[_0x432c('0xf')]=![];_0x30483d[_0x432c('0x10')]=_0x2beb91;_0x30483d[_0x432c('0x11')]=hardware['getUuid']();if(_0x184130){var _0x6c4073=crypto[_0x432c('0x12')](_0x432c('0x13'),config[_0x432c('0x14')][_0x432c('0x15')]);var _0x4861ae=_0x6c4073[_0x432c('0x16')](_0x184130,_0x432c('0xb'),'utf8');_0x4861ae+=_0x6c4073['final']('utf8');_0x30483d['gray']=_0x4861ae;_0x30483d[_0x432c('0x17')]=moment(_0x4861ae)[_0x432c('0x18')](0x7,_0x432c('0x19'))[_0x432c('0x9')]();_0x30483d[_0x432c('0x1a')]=_0x30483d[_0x432c('0x10')]!=_0x30483d['machineUuid']?_0x432c('0x1b'):_0x432c('0x1c');}return _0x30483d;}catch(_0x5f3f67){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x432c('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x432c('0x1e'),'uuid':_0x2daa84['data1'],'machineUuid':hardware[_0x432c('0x1f')](),'message':_0x5f3f67[_0x432c('0x20')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x432c('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x432c('0x21'),'uuid':_0x2daa84[_0x432c('0x6')],'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x432c('0x22')]=function(_0x3197c6){return db[_0x432c('0x23')]['find'](_['defaults'](_0x3197c6,{'raw':!![],'where':{'id':0x1}}))[_0x432c('0x24')](function(_0x5181a8){return checkLicense(_0x5181a8,null);});};exports[_0x432c('0x25')]=checkLicense; \ No newline at end of file +var _0x462f=['../environment','license','isEmpty','data1','data2','split','createDecipher','aes-256-ctr','format','base64','utf8','final','parse','uuid','machineUuid','getUuid','secrets','session','update','gray','add','days','grayReason','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','getLicense','License','find','defaults','checkLicense','util','moment'];(function(_0x18e3b4,_0x180ad6){var _0x309c94=function(_0x2bfd34){while(--_0x2bfd34){_0x18e3b4['push'](_0x18e3b4['shift']());}};_0x309c94(++_0x180ad6);}(_0x462f,0x1c5));var _0xf462=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x462f[_0x59c301];return _0x3866b9;};'use strict';var crypto=require('crypto');var util=require(_0xf462('0x0'));var _=require('lodash');var moment=require(_0xf462('0x1'));var hardware=require('./hardware');var config=require(_0xf462('0x2'));var db=require('../../mysqldb')['db'];function checkLicense(_0x3e210c,_0x3a222f){if(_0x3e210c){try{var _0x5a7341=_0x3a222f||_0x3e210c[_0xf462('0x3')];if(_[_0xf462('0x4')](_0x5a7341)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x561fa1=_0x3e210c[_0xf462('0x5')];var _0x17511d=_0x3e210c[_0xf462('0x6')];var _0x15af59=_0x561fa1[_0xf462('0x7')]('-')[0x4];var _0x5eb055=_0x561fa1[_0xf462('0x7')]('-')[0x0];var _0x69a64b=crypto[_0xf462('0x8')](_0xf462('0x9'),util[_0xf462('0xa')]('%s:%s:%s',_0x15af59,_0x561fa1,_0x5eb055));var _0x1529dc=_0x69a64b['update'](_0x5a7341,_0xf462('0xb'),_0xf462('0xc'));_0x1529dc+=_0x69a64b[_0xf462('0xd')]('utf8');var _0x5da1f1=JSON[_0xf462('0xe')](_0x1529dc);_0x5da1f1['demo']=![];_0x5da1f1[_0xf462('0xf')]=_0x561fa1;_0x5da1f1[_0xf462('0x10')]=hardware[_0xf462('0x11')]();if(_0x17511d){var _0x1bf48a=crypto[_0xf462('0x8')]('aes-256-ctr',config[_0xf462('0x12')][_0xf462('0x13')]);var _0x288d73=_0x1bf48a[_0xf462('0x14')](_0x17511d,_0xf462('0xb'),'utf8');_0x288d73+=_0x1bf48a[_0xf462('0xd')](_0xf462('0xc'));_0x5da1f1[_0xf462('0x15')]=_0x288d73;_0x5da1f1['deadline']=moment(_0x288d73)[_0xf462('0x16')](0x7,_0xf462('0x17'))['format']();_0x5da1f1[_0xf462('0x18')]=_0x5da1f1[_0xf462('0xf')]!=_0x5da1f1[_0xf462('0x10')]?'changed':_0xf462('0x19');}return _0x5da1f1;}catch(_0x551fe7){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf462('0x1a'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xf462('0x1b'),'uuid':_0x3e210c[_0xf462('0x5')],'machineUuid':hardware[_0xf462('0x11')](),'message':_0x551fe7[_0xf462('0x1c')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf462('0x1a'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf462('0x1d'),'uuid':_0x3e210c[_0xf462('0x5')],'machineUuid':hardware[_0xf462('0x11')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0xf462('0x1e')]=function(_0x463520){return db[_0xf462('0x1f')][_0xf462('0x20')](_[_0xf462('0x21')](_0x463520,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x890341){return checkLicense(_0x890341,null);});};exports[_0xf462('0x22')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 93f68f2..ab28024 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 _0x0b6f=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x2e15e8,_0x12287f){var _0x1978b5=function(_0x4abe75){while(--_0x4abe75){_0x2e15e8['push'](_0x2e15e8['shift']());}};_0x1978b5(++_0x12287f);}(_0x0b6f,0x134));var _0xf0b6=function(_0x1be3b3,_0x4335ee){_0x1be3b3=_0x1be3b3-0x0;var _0x4f8b2d=_0x0b6f[_0x1be3b3];return _0x4f8b2d;};'use strict';module[_0xf0b6('0x0')]={'DOMAIN':_0xf0b6('0x1'),'SESSION_SECRET':_0xf0b6('0x2'),'GOOGLE_ID':_0xf0b6('0x3'),'GOOGLE_SECRET':_0xf0b6('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x0e9e=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x232708,_0x2c804d){var _0x3c07c5=function(_0x47be7b){while(--_0x47be7b){_0x232708['push'](_0x232708['shift']());}};_0x3c07c5(++_0x2c804d);}(_0x0e9e,0x19a));var _0xe0e9=function(_0x3410c8,_0x2cad42){_0x3410c8=_0x3410c8-0x0;var _0x2d9b54=_0x0e9e[_0x3410c8];return _0x2d9b54;};'use strict';module[_0xe0e9('0x0')]={'DOMAIN':_0xe0e9('0x1'),'SESSION_SECRET':_0xe0e9('0x2'),'GOOGLE_ID':_0xe0e9('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 355ba65..725b825 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e8c=['debugLevel','winston','util','INFO','join','/var','log','xcally','format','%s-%s.log','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','Logger','transports','File','%s-%s','error','info'];(function(_0x2d145d,_0x1b956b){var _0x171fd0=function(_0x27381f){while(--_0x27381f){_0x2d145d['push'](_0x2d145d['shift']());}};_0x171fd0(++_0x1b956b);}(_0x3e8c,0xe8));var _0xc3e8=function(_0x15f3d6,_0x1c4ca2){_0x15f3d6=_0x15f3d6-0x0;var _0xb9633b=_0x3e8c[_0x15f3d6];return _0xb9633b;};'use strict';var moment=require('moment');var winston=require(_0xc3e8('0x0'));var util=require(_0xc3e8('0x1'));var path=require('path');var debugLevel=_0xc3e8('0x2');function filename(_0x229c8c,_0x2d3b54){return path[_0xc3e8('0x3')](_0xc3e8('0x4'),_0xc3e8('0x5'),_0xc3e8('0x6'),util[_0xc3e8('0x7')](_0xc3e8('0x8'),_0x229c8c,_0x2d3b54));}function formatter(_0xccbc57,_0x5172eb){return util[_0xc3e8('0x7')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xc3e8('0x7')](_0xc3e8('0x9')),_0x5172eb[_0xc3e8('0xa')][_0xc3e8('0xb')](),_0xccbc57,_0x5172eb[_0xc3e8('0xc')]);}module[_0xc3e8('0xd')]=function(_0xe7ebfe){return new winston[(_0xc3e8('0xe'))]({'transports':[new winston[(_0xc3e8('0xf'))][(_0xc3e8('0x10'))]({'name':util[_0xc3e8('0x7')](_0xc3e8('0x11'),_0xe7ebfe,'error'),'filename':filename(_0xe7ebfe,_0xc3e8('0x12')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2cc0b8){return formatter(_0xe7ebfe,_0x2cc0b8);}}),new winston[(_0xc3e8('0xf'))][(_0xc3e8('0x10'))]({'name':util['format'](_0xc3e8('0x11'),_0xe7ebfe,_0xc3e8('0x13')),'filename':filename(_0xe7ebfe,_0xc3e8('0x13')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xa62090){return formatter(_0xe7ebfe,_0xa62090);}}),new winston[(_0xc3e8('0xf'))]['Console']({'level':process['env'][_0xc3e8('0x14')]||debugLevel,'json':![],'formatter':function(_0x53d4e0){return formatter(_0xe7ebfe,_0x53d4e0);}})]});}; \ No newline at end of file +var _0x0023=['error','File','info','Console','env','debugLevel','util','path','join','/var','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','message','exports','Logger','transports','%s-%s'];(function(_0x5dce4b,_0x24a949){var _0x2a37c4=function(_0x76b20f){while(--_0x76b20f){_0x5dce4b['push'](_0x5dce4b['shift']());}};_0x2a37c4(++_0x24a949);}(_0x0023,0x15a));var _0x3002=function(_0x57a313,_0x4da781){_0x57a313=_0x57a313-0x0;var _0x287e45=_0x0023[_0x57a313];return _0x287e45;};'use strict';var moment=require('moment');var winston=require('winston');var util=require(_0x3002('0x0'));var path=require(_0x3002('0x1'));var debugLevel='INFO';function filename(_0x3f696b,_0x553af1){return path[_0x3002('0x2')](_0x3002('0x3'),'log','xcally',util[_0x3002('0x4')](_0x3002('0x5'),_0x3f696b,_0x553af1));}function formatter(_0x4fd3a3,_0x15685d){return util[_0x3002('0x4')](_0x3002('0x6'),moment()[_0x3002('0x4')]('YYYY-MM-DD\x20HH:mm:ss'),_0x15685d[_0x3002('0x7')][_0x3002('0x8')](),_0x4fd3a3,_0x15685d[_0x3002('0x9')]);}module[_0x3002('0xa')]=function(_0xec4ce7){return new winston[(_0x3002('0xb'))]({'transports':[new winston[(_0x3002('0xc'))]['File']({'name':util[_0x3002('0x4')](_0x3002('0xd'),_0xec4ce7,_0x3002('0xe')),'filename':filename(_0xec4ce7,_0x3002('0xe')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1592f9){return formatter(_0xec4ce7,_0x1592f9);}}),new winston['transports'][(_0x3002('0xf'))]({'name':util[_0x3002('0x4')]('%s-%s',_0xec4ce7,_0x3002('0x10')),'filename':filename(_0xec4ce7,_0x3002('0x10')),'level':_0x3002('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x21952c){return formatter(_0xec4ce7,_0x21952c);}}),new winston[(_0x3002('0xc'))][(_0x3002('0x11'))]({'level':process[_0x3002('0x12')][_0x3002('0x13')]||debugLevel,'json':![],'formatter':function(_0x5289a1){return formatter(_0xec4ce7,_0x5289a1);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 17b25a6..c8ee662 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 _0x358f=['email','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x358f,0x198));var _0xf358=function(_0x211397,_0x52b103){_0x211397=_0x211397-0x0;var _0x3df56c=_0x358f[_0x211397];return _0x3df56c;};'use strict';var path=require(_0xf358('0x0'));var os=require('os');var config={'apps':[{'name':_0xf358('0x1'),'script':path[_0xf358('0x2')](__dirname,_0xf358('0x3'))},{'name':_0xf358('0x4'),'script':path[_0xf358('0x2')](__dirname,_0xf358('0x5'))},{'name':_0xf358('0x6'),'script':path['join'](__dirname,_0xf358('0x7'))},{'name':_0xf358('0x8'),'script':path[_0xf358('0x2')](__dirname,'../../services/email/index.js')},{'name':_0xf358('0x9'),'script':path[_0xf358('0x2')](__dirname,_0xf358('0xa'))},{'name':'xdr','script':path[_0xf358('0x2')](__dirname,_0xf358('0xb'))}]};module[_0xf358('0xc')]=config; \ No newline at end of file +var _0x5d3c=['ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','xdr','exports','path','express','join'];(function(_0x195c08,_0x190028){var _0x1c202c=function(_0x484fb7){while(--_0x484fb7){_0x195c08['push'](_0x195c08['shift']());}};_0x1c202c(++_0x190028);}(_0x5d3c,0x159));var _0xc5d3=function(_0x348fee,_0x25c92d){_0x348fee=_0x348fee-0x0;var _0x3e2707=_0x5d3c[_0x348fee];return _0x3e2707;};'use strict';var path=require(_0xc5d3('0x0'));var os=require('os');var config={'apps':[{'name':_0xc5d3('0x1'),'script':path[_0xc5d3('0x2')](__dirname,'../../services/express/index.js')},{'name':_0xc5d3('0x3'),'script':path['join'](__dirname,_0xc5d3('0x4'))},{'name':_0xc5d3('0x5'),'script':path[_0xc5d3('0x2')](__dirname,_0xc5d3('0x6'))},{'name':_0xc5d3('0x7'),'script':path[_0xc5d3('0x2')](__dirname,_0xc5d3('0x8'))},{'name':'routing','script':path['join'](__dirname,_0xc5d3('0x9'))},{'name':_0xc5d3('0xa'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module[_0xc5d3('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index da4b927..7206bfc 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 _0xe198=['bluebird','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2'];(function(_0x3cf68c,_0x24b213){var _0x3f618e=function(_0x4dfd1a){while(--_0x4dfd1a){_0x3cf68c['push'](_0x3cf68c['shift']());}};_0x3f618e(++_0x24b213);}(_0xe198,0x6f));var _0x8e19=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xe198[_0x465a0c];return _0x1e202e;};'use strict';var pm2=require(_0x8e19('0x0'));var BPromise=require(_0x8e19('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x488972,_0x18c3af){return pm2[_0x8e19('0x2')](function(_0x2a2529){if(_0x2a2529){return _0x18c3af(_0x2a2529);}return _0x488972(_0x8e19('0x3'));});});};exports[_0x8e19('0x4')]=function(_0x4e3f58){return connect()[_0x8e19('0x5')](function(){return new BPromise(function(_0x2f94a8,_0x2fb138){return pm2[_0x8e19('0x4')](_0x4e3f58,function(_0x1175d6,_0x4db35e){if(_0x1175d6){return _0x2fb138(_0x1175d6);}pm2[_0x8e19('0x6')]();return _0x2f94a8(_0x4db35e);});});});};exports[_0x8e19('0x7')]=function(_0xfc4670){return connect()[_0x8e19('0x5')](function(){return new BPromise(function(_0x3fbe35,_0x41e998){return pm2[_0x8e19('0x7')](_0xfc4670,function(_0x4a315b,_0x146989){if(_0x4a315b){return _0x41e998(_0x4a315b);}pm2[_0x8e19('0x6')]();return _0x3fbe35(_0x146989);});});});};exports[_0x8e19('0x8')]=function(_0x2ffcd1){return connect()[_0x8e19('0x5')](function(){return new BPromise(function(_0x192c62,_0x3c9588){return pm2[_0x8e19('0x8')](_0x2ffcd1,function(_0x48433d,_0x51a0c4){if(_0x48433d){return _0x3c9588(_0x48433d);}pm2[_0x8e19('0x6')]();return _0x192c62(_0x51a0c4);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x29b2dc,_0x2c2d05){return pm2[_0x8e19('0x9')](function(_0x76ccdb,_0x4a75e0){if(_0x76ccdb){return _0x2c2d05(_0x76ccdb);}pm2[_0x8e19('0x6')]();return _0x29b2dc(_0x4a75e0);});});});};exports[_0x8e19('0xa')]=function(_0x5c474d){return connect()[_0x8e19('0x5')](function(){return new BPromise(function(_0x319971,_0x4b2c05){return pm2[_0x8e19('0xa')](_0x5c474d,function(_0x33c590,_0x47680f){if(_0x33c590){return _0x4b2c05(_0x33c590);}pm2[_0x8e19('0x6')]();return _0x319971(_0x47680f);});});});};exports[_0x8e19('0xb')]=function(_0x2e61e9){return connect()[_0x8e19('0x5')](function(){return new BPromise(function(_0x1dde49,_0x28d288){return pm2[_0x8e19('0xb')](_0x2e61e9,function(_0x18a9d0,_0x1118f2){if(_0x18a9d0){return _0x28d288(_0x18a9d0);}pm2[_0x8e19('0x6')]();return _0x1dde49(_0x1118f2);});});});};exports[_0x8e19('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x1945e1,_0x8d132c){return pm2[_0x8e19('0xc')](function(_0x314798){if(_0x314798){return _0x8d132c(_0x314798);}return _0x1945e1(_0x8e19('0xd'));});});});}; \ No newline at end of file +var _0x2a56=['disconnect','stop','restart','list','describe','delete','dump','bluebird','connect','connected','then','start'];(function(_0x3ac769,_0x2825df){var _0x2185eb=function(_0x43cc1d){while(--_0x43cc1d){_0x3ac769['push'](_0x3ac769['shift']());}};_0x2185eb(++_0x2825df);}(_0x2a56,0xaf));var _0x62a5=function(_0x3e753a,_0x10a06e){_0x3e753a=_0x3e753a-0x0;var _0x1fa127=_0x2a56[_0x3e753a];return _0x1fa127;};'use strict';var pm2=require('pm2');var BPromise=require(_0x62a5('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x2b3e5b,_0x236dfe){return pm2[_0x62a5('0x1')](function(_0x315f00){if(_0x315f00){return _0x236dfe(_0x315f00);}return _0x2b3e5b(_0x62a5('0x2'));});});};exports['start']=function(_0x280fad){return connect()[_0x62a5('0x3')](function(){return new BPromise(function(_0x46a15f,_0x40bd58){return pm2[_0x62a5('0x4')](_0x280fad,function(_0x206ee4,_0x42023b){if(_0x206ee4){return _0x40bd58(_0x206ee4);}pm2[_0x62a5('0x5')]();return _0x46a15f(_0x42023b);});});});};exports['stop']=function(_0x32fa8c){return connect()[_0x62a5('0x3')](function(){return new BPromise(function(_0x38be93,_0x3300f9){return pm2[_0x62a5('0x6')](_0x32fa8c,function(_0x4e95ab,_0x2afe61){if(_0x4e95ab){return _0x3300f9(_0x4e95ab);}pm2[_0x62a5('0x5')]();return _0x38be93(_0x2afe61);});});});};exports[_0x62a5('0x7')]=function(_0x4063ea){return connect()[_0x62a5('0x3')](function(){return new BPromise(function(_0x1379f6,_0x31f51b){return pm2[_0x62a5('0x7')](_0x4063ea,function(_0x1f46ab,_0x57ee80){if(_0x1f46ab){return _0x31f51b(_0x1f46ab);}pm2[_0x62a5('0x5')]();return _0x1379f6(_0x57ee80);});});});};exports[_0x62a5('0x8')]=function(){return connect()[_0x62a5('0x3')](function(){return new BPromise(function(_0x1d82f0,_0x4f8372){return pm2[_0x62a5('0x8')](function(_0x55a70f,_0x27ade1){if(_0x55a70f){return _0x4f8372(_0x55a70f);}pm2['disconnect']();return _0x1d82f0(_0x27ade1);});});});};exports[_0x62a5('0x9')]=function(_0x4b9e38){return connect()[_0x62a5('0x3')](function(){return new BPromise(function(_0x18dca,_0x2bc6d9){return pm2['describe'](_0x4b9e38,function(_0x38653a,_0x5789ba){if(_0x38653a){return _0x2bc6d9(_0x38653a);}pm2['disconnect']();return _0x18dca(_0x5789ba);});});});};exports[_0x62a5('0xa')]=function(_0x4d1a75){return connect()['then'](function(){return new BPromise(function(_0x5942a9,_0xddb1ff){return pm2[_0x62a5('0xa')](_0x4d1a75,function(_0x5e6b6d,_0x240edb){if(_0x5e6b6d){return _0xddb1ff(_0x5e6b6d);}pm2[_0x62a5('0x5')]();return _0x5942a9(_0x240edb);});});});};exports[_0x62a5('0xb')]=function(){return connect()[_0x62a5('0x3')](function(){return new BPromise(function(_0x9e7b95,_0x4265ac){return pm2[_0x62a5('0xb')](function(_0x203985){if(_0x203985){return _0x4265ac(_0x203985);}return _0x9e7b95('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 5fa98a2..55851ff 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 _0xc930=['map','length','emit','chatInteraction:update','catch','error','start','moment','ioredis','../../mysqldb','../../config/environment','redis','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3a17ef,_0x29664f){var _0x34723a=function(_0x12bc6e){while(--_0x12bc6e){_0x3a17ef['push'](_0x3a17ef['shift']());}};_0x34723a(++_0x29664f);}(_0xc930,0x9d));var _0x0c93=function(_0x5c0088,_0x11086a){_0x5c0088=_0x5c0088-0x0;var _0x5d7ace=_0xc930[_0x5c0088];return _0x5d7ace;};'use strict';var _=require('lodash');var moment=require(_0x0c93('0x0'));var Redis=require(_0x0c93('0x1'));var db=require(_0x0c93('0x2'))['db'];var config=require(_0x0c93('0x3'));config[_0x0c93('0x4')]=_['defaults'](config[_0x0c93('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x0c93('0x5'))(new Redis(config['redis']));function closeInteractions(){var _0x34a91e=0x0;var _0xdc7a52=[];return db[_0x0c93('0x6')][_0x0c93('0x7')]({'raw':!![],'attributes':['id',_0x0c93('0x8')],'where':{'id':0x1}})[_0x0c93('0x9')](function(_0x2605af){_0x34a91e=_0x2605af[_0x0c93('0x8')];if(_0x34a91e){return db[_0x0c93('0xa')][_0x0c93('0xb')]({'raw':!![],'attributes':['id',_0x0c93('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0c93('0xd')](_0x2605af[_0x0c93('0x8')],'minutes')}}});}else{return[];}})[_0x0c93('0x9')](function(_0x5eb8a1){_0xdc7a52=_0x5eb8a1;if(_0x34a91e){return db[_0x0c93('0xa')][_0x0c93('0xe')]({'closeReason':_0x0c93('0xf'),'disposition':_0x0c93('0x10'),'closed':!![],'closedAt':moment()['format'](_0x0c93('0x11'))},{'where':{'id':_[_0x0c93('0x12')](_0xdc7a52||[],'id')}});}})['then'](function(_0x468af1){for(var _0xaf9d8d=0x0;_0xaf9d8d<_0xdc7a52[_0x0c93('0x13')];_0xaf9d8d++){io[_0x0c93('0x14')](_0x0c93('0x15'),{'id':_0xdc7a52[_0xaf9d8d]['id'],'closed':!![]});}})[_0x0c93('0x16')](function(_0x42c4ba){console[_0x0c93('0x17')](_0x42c4ba);});}exports[_0x0c93('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb0d5=['catch','start','lodash','ioredis','../../mysqldb','../../config/environment','defaults','redis','localhost','find','chatTimeout','then','ChatInteraction','findAll','subtract','update','system','format','YYYY-MM-DD\x20HH:mm:ss','map','length','chatInteraction:update'];(function(_0x427e1e,_0x5e5657){var _0x8399b7=function(_0x3b5662){while(--_0x3b5662){_0x427e1e['push'](_0x427e1e['shift']());}};_0x8399b7(++_0x5e5657);}(_0xb0d5,0x162));var _0x5b0d=function(_0x486c22,_0x306c6d){_0x486c22=_0x486c22-0x0;var _0xbad918=_0xb0d5[_0x486c22];return _0xbad918;};'use strict';var _=require(_0x5b0d('0x0'));var moment=require('moment');var Redis=require(_0x5b0d('0x1'));var db=require(_0x5b0d('0x2'))['db'];var config=require(_0x5b0d('0x3'));config['redis']=_[_0x5b0d('0x4')](config[_0x5b0d('0x5')],{'host':_0x5b0d('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x56a328=0x0;var _0x303254=[];return db['Setting'][_0x5b0d('0x7')]({'raw':!![],'attributes':['id',_0x5b0d('0x8')],'where':{'id':0x1}})[_0x5b0d('0x9')](function(_0x4d66d3){_0x56a328=_0x4d66d3[_0x5b0d('0x8')];if(_0x56a328){return db[_0x5b0d('0xa')][_0x5b0d('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5b0d('0xc')](_0x4d66d3[_0x5b0d('0x8')],'minutes')}}});}else{return[];}})[_0x5b0d('0x9')](function(_0x514deb){_0x303254=_0x514deb;if(_0x56a328){return db[_0x5b0d('0xa')][_0x5b0d('0xd')]({'closeReason':_0x5b0d('0xe'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x5b0d('0xf')](_0x5b0d('0x10'))},{'where':{'id':_[_0x5b0d('0x11')](_0x303254||[],'id')}});}})['then'](function(_0x4e5616){for(var _0x4a7b3d=0x0;_0x4a7b3d<_0x303254[_0x5b0d('0x12')];_0x4a7b3d++){io['emit'](_0x5b0d('0x13'),{'id':_0x303254[_0x4a7b3d]['id'],'closed':!![]});}})[_0x5b0d('0x14')](function(_0x1465e8){console['error'](_0x1465e8);});}exports[_0x5b0d('0x15')]=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 1606ed7..bfc3bba 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 _0xf7e9=['join','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','stringify','data','isNil','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','catch','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','map','keyBy','toString','difference','exists','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','active','isBetween','startAt','endAt','add','cron','add\x20cron','update\x20cron','run','start','path','jayson/promise','schedule','../../mysqldb','client','Try\x20to\x20send\x20a\x20mail\x20to','email','service','MailAccount','Smtp','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','savename','%s.%s','basename','extname'];(function(_0x5bdc72,_0x277782){var _0x14bf16=function(_0x48284c){while(--_0x48284c){_0x5bdc72['push'](_0x5bdc72['shift']());}};_0x14bf16(++_0x277782);}(_0xf7e9,0xe3));var _0x9f7e=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0xf7e9[_0x328534];return _0x2796c0;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x9f7e('0x0'));var _=require('lodash');var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0x9f7e('0x1'));var BPromise=require('bluebird');var logger=require('../logger')(_0x9f7e('0x2'));var db=require(_0x9f7e('0x3'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x9f7e('0x4')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x119a10,_0x361f33){return function(){logger['info'](_0x9f7e('0x5'),_0x119a10[_0x9f7e('0x6')]);var _0x4a5d43=!![];var _0xbf91b8={'tls':{'rejectUnauthorized':![]}};if(_0x119a10['MailAccount']['Smtp'][_0x9f7e('0x7')]){_0xbf91b8[_0x9f7e('0x7')]=_0x119a10[_0x9f7e('0x8')][_0x9f7e('0x9')]['service'];}else{_0xbf91b8[_0x9f7e('0xa')]=_0x119a10[_0x9f7e('0x8')][_0x9f7e('0x9')][_0x9f7e('0xa')];_0xbf91b8[_0x9f7e('0xb')]=_0x119a10[_0x9f7e('0x8')][_0x9f7e('0x9')][_0x9f7e('0xb')];_0xbf91b8[_0x9f7e('0xc')]=_0x119a10[_0x9f7e('0x8')][_0x9f7e('0x9')][_0x9f7e('0xc')];}if(_0x119a10[_0x9f7e('0x8')][_0x9f7e('0x9')][_0x9f7e('0xd')]){_0xbf91b8[_0x9f7e('0xe')]={'user':_0x119a10[_0x9f7e('0x8')][_0x9f7e('0x9')]['user'],'pass':_0x119a10[_0x9f7e('0x8')][_0x9f7e('0x9')][_0x9f7e('0xf')]};}var _0x36a9a8={'account':_0xbf91b8,'message':{'from':util[_0x9f7e('0x10')](_0x9f7e('0x11'),_0x119a10[_0x9f7e('0x8')][_0x9f7e('0x12')],_0x119a10['MailAccount'][_0x9f7e('0x6')]||_0x119a10[_0x9f7e('0x8')][_0x9f7e('0x9')][_0x9f7e('0x13')]),'to':_0x119a10[_0x9f7e('0x6')],'cc':_0x119a10['cc'],'bcc':_0x119a10[_0x9f7e('0x14')],'subject':util[_0x9f7e('0x10')](_0x9f7e('0x15'),_0x361f33['name'],_0x119a10[_0x9f7e('0x16')],_0x119a10[_0x9f7e('0x17')])}};var _0x460fc0=path['join'](__dirname,'../../files/reports');var _0x10fc14=_0x361f33[_0x9f7e('0x18')];var _0x5d8f18=util[_0x9f7e('0x10')](_0x9f7e('0x19'),path[_0x9f7e('0x1a')](_0x361f33['savename'],path[_0x9f7e('0x1b')](_0x361f33['savename'])),'zip');var _0x3e774b=path[_0x9f7e('0x1c')](_0x460fc0,_0x10fc14);var _0x1e274c=path[_0x9f7e('0x1c')](_0x460fc0,_0x5d8f18);if(fs[_0x9f7e('0x1d')](_0x3e774b)){_0x361f33['status']=_0x9f7e('0x1e');_0x36a9a8[_0x9f7e('0x1f')][_0x9f7e('0x20')]=[{'filename':_0x10fc14,'path':_0x3e774b}];_0x36a9a8[_0x9f7e('0x1f')][_0x9f7e('0x21')]=util['format'](_0x9f7e('0x22'),JSON['stringify'](_0x361f33,null,0x2));}else if(fs[_0x9f7e('0x1d')](_0x1e274c)){_0x361f33[_0x9f7e('0x23')]=_0x9f7e('0x1e');_0x36a9a8[_0x9f7e('0x1f')][_0x9f7e('0x20')]=[{'filename':_0x5d8f18,'path':_0x1e274c}];}else{_0x36a9a8[_0x9f7e('0x1f')][_0x9f7e('0x21')]=_0x9f7e('0x24');if(!_0x119a10['sendIfEmpty']){_0x4a5d43=![];logger[_0x9f7e('0x25')](_0x9f7e('0x26'));}}if(_0x4a5d43){return client[_0x9f7e('0x27')](_0x9f7e('0x28'),_0x36a9a8)[_0x9f7e('0x29')](function(_0x310a0a){if(_0x310a0a[_0x9f7e('0x2a')]){return logger['error'](_0x9f7e('0x2b'),JSON['stringify'](_0x310a0a));}return logger[_0x9f7e('0x25')](_0x9f7e('0x2c'));})['catch'](function(_0x16c135){return logger[_0x9f7e('0x2a')](_0x9f7e('0x2b'),JSON[_0x9f7e('0x2d')](_0x16c135));});}};}function handleError(){return function(_0x1cd541){return logger['error'](JSON[_0x9f7e('0x2d')](_0x1cd541));};}function handleResult(_0x1d24ff){return function(_0x48f8fd){logger[_0x9f7e('0x25')](_0x9f7e('0x2e'),JSON['stringify'](_0x48f8fd));if(_0x1d24ff[_0x9f7e('0x8')]&&_0x1d24ff[_0x9f7e('0x8')][_0x9f7e('0x9')]&&!_[_0x9f7e('0x2f')](_0x1d24ff[_0x9f7e('0x6')])){setTimeout(handleSendEmail(_0x1d24ff,_0x48f8fd),0x3c*0x3e8);}};}function handleJob(_0x143044){return function(){try{if(_[_0x9f7e('0x2f')](_0x143044[_0x9f7e('0x16')])){return logger[_0x9f7e('0x25')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x143044[_0x9f7e('0x17')])){return logger[_0x9f7e('0x25')]('subtractUnit\x20null\x20or\x20undefined');}var _0xfbc094={'startDate':moment()[_0x9f7e('0x30')](_0x143044['subtractNumber'],_0x143044['subtractUnit'])[_0x9f7e('0x10')](_0x9f7e('0x31')),'endDate':moment()['format'](_0x9f7e('0x31')),'type':_0x9f7e('0x32'),'output':_0x143044[_0x9f7e('0x33')],'name':_0x143044[_0x9f7e('0x12')]};if(!_[_0x9f7e('0x2f')](_0x143044[_0x9f7e('0x34')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x143044[_0x9f7e('0x34')]);return analyticDefaultReportController[_0x9f7e('0x35')]({'id':_0x143044[_0x9f7e('0x34')]},_0xfbc094)[_0x9f7e('0x29')](handleResult(_0x143044))[_0x9f7e('0x36')](handleError());}if(!_[_0x9f7e('0x2f')](_0x143044[_0x9f7e('0x37')])){logger[_0x9f7e('0x25')]('exec\x20custom\x20report\x20id:%s',_0x143044['CustomReportId']);return analyticCustomReportController[_0x9f7e('0x35')]({'id':_0x143044[_0x9f7e('0x37')]},_0xfbc094)[_0x9f7e('0x29')](handleResult(_0x143044))[_0x9f7e('0x36')](handleError());}}catch(_0x2c123d){logger[_0x9f7e('0x2a')](JSON[_0x9f7e('0x2d')](_0x2c123d));}return logger[_0x9f7e('0x25')](_0x9f7e('0x38'));};}function getJobs(_0x4c4e04){var _0x137f3a={};if(_0x4c4e04){_0x137f3a['id']=_0x4c4e04;}return db[_0x9f7e('0x39')][_0x9f7e('0x3a')]({'where':_0x137f3a,'include':[{'model':db[_0x9f7e('0x8')],'attributes':['id',_0x9f7e('0x12'),'email'],'include':[{'model':db[_0x9f7e('0x3b')],'as':_0x9f7e('0x9')}]}]})['then'](function(_0x532c05){var _0x3c2f90=_[_0x9f7e('0x3c')](manager['jobs']);var _0x83aafb=_[_0x9f7e('0x3d')](_0x532c05,function(_0x550755){return _0x550755['id']['toString']();});var _0x2b93a6=_[_0x9f7e('0x3e')](_0x532c05,function(_0x458141){return _0x458141['id'][_0x9f7e('0x3f')]();});var _0x50687=_0x4c4e04?_0x83aafb:_[_0x9f7e('0x40')](_0x83aafb,_0x3c2f90);var _0x54894d=_['intersection'](_0x83aafb,_0x3c2f90);var _0x59f7ab=_['difference'](_0x3c2f90,_0x83aafb);var _0x3f09b3;var _0x3834fd;for(_0x3f09b3=0x0;_0x3f09b3<_0x59f7ab['length']&&!_0x4c4e04;_0x3f09b3+=0x1){_0x3834fd=_0x59f7ab[_0x3f09b3][_0x9f7e('0x3f')]();if(manager[_0x9f7e('0x41')](_0x3834fd)){manager[_0x9f7e('0x42')](_0x3834fd);manager[_0x9f7e('0x43')](_0x3834fd);logger[_0x9f7e('0x25')](_0x9f7e('0x44'),_0x3834fd);}}logger['info'](_0x9f7e('0x45'),JSON[_0x9f7e('0x2d')](_0x50687));for(_0x3f09b3=0x0;_0x3f09b3<_0x50687[_0x9f7e('0x46')];_0x3f09b3+=0x1){_0x3834fd=_0x50687[_0x3f09b3]['toString']();logger['info'](_0x9f7e('0x47'),_0x3834fd);if(_0x4c4e04){logger[_0x9f7e('0x25')](_0x9f7e('0x48'),_0x4c4e04);logger[_0x9f7e('0x25')](JSON[_0x9f7e('0x2d')](_0x2b93a6[_0x3834fd]));BPromise[_0x9f7e('0x49')]()[_0x9f7e('0x29')](handleJob(_0x2b93a6[_0x3834fd]));logger[_0x9f7e('0x25')](_0x9f7e('0x4a'),_0x2b93a6[_0x3834fd]['name'],_0x2b93a6[_0x3834fd]['cron']);}else if(_0x2b93a6[_0x3834fd]['cron']&&_0x2b93a6[_0x3834fd][_0x9f7e('0x4b')]&&moment()[_0x9f7e('0x4c')](_0x2b93a6[_0x3834fd][_0x9f7e('0x4d')],_0x2b93a6[_0x3834fd][_0x9f7e('0x4e')])){manager[_0x9f7e('0x4f')](_0x3834fd,_0x2b93a6[_0x3834fd][_0x9f7e('0x50')],handleJob(_0x2b93a6[_0x3834fd]));manager['start'](_0x3834fd);logger[_0x9f7e('0x25')](_0x9f7e('0x51'),_0x2b93a6[_0x3834fd][_0x9f7e('0x12')],_0x2b93a6[_0x3834fd][_0x9f7e('0x50')]);}else if(manager[_0x9f7e('0x41')](_0x3834fd)){manager[_0x9f7e('0x42')](_0x3834fd);manager[_0x9f7e('0x43')](_0x3834fd);logger[_0x9f7e('0x25')]('stop\x20cron',_0x2b93a6[_0x3834fd][_0x9f7e('0x12')],_0x2b93a6[_0x3834fd][_0x9f7e('0x50')]);}}for(_0x3f09b3=0x0,_0x3834fd;_0x3f09b3<_0x54894d[_0x9f7e('0x46')]&&!_0x4c4e04;_0x3f09b3+=0x1){_0x3834fd=_0x54894d[_0x3f09b3][_0x9f7e('0x3f')]();if(manager[_0x9f7e('0x41')](_0x3834fd)){if(_0x2b93a6[_0x3834fd][_0x9f7e('0x50')]&&_0x2b93a6[_0x3834fd][_0x9f7e('0x4b')]&&moment()[_0x9f7e('0x4c')](_0x2b93a6[_0x3834fd][_0x9f7e('0x4d')],_0x2b93a6[_0x3834fd][_0x9f7e('0x4e')])){manager['update'](_0x3834fd,_0x2b93a6[_0x3834fd][_0x9f7e('0x50')],handleJob(_0x2b93a6[_0x3834fd]));logger[_0x9f7e('0x25')](_0x9f7e('0x52'),_0x2b93a6[_0x3834fd][_0x9f7e('0x12')],_0x2b93a6[_0x3834fd][_0x9f7e('0x50')]);}else{manager['stop'](_0x3834fd);manager[_0x9f7e('0x43')](_0x3834fd);logger[_0x9f7e('0x25')]('stop\x20cron',_0x2b93a6[_0x3834fd][_0x9f7e('0x12')],_0x2b93a6[_0x3834fd]['cron']);}}}})[_0x9f7e('0x36')](function(_0x207a34){logger[_0x9f7e('0x2a')](JSON['stringify'](_0x207a34));});}exports[_0x9f7e('0x53')]=function(_0xd5a5b7){return getJobs(_0xd5a5b7);};exports[_0x9f7e('0x54')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xf22e=['subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','keys','jobs','map','toString','keyBy','difference','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','exists','update','update\x20cron','stop\x20cron','run','util','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined'];(function(_0x3b819e,_0x2a8868){var _0x49349c=function(_0x27ac8e){while(--_0x27ac8e){_0x3b819e['push'](_0x3b819e['shift']());}};_0x49349c(++_0x2a8868);}(_0xf22e,0x1a3));var _0xef22=function(_0x167d98,_0x17bb15){_0x167d98=_0x167d98-0x0;var _0xc1a88f=_0xf22e[_0x167d98];return _0xc1a88f;};'use strict';var fs=require('fs');var util=require(_0xef22('0x0'));var path=require(_0xef22('0x1'));var _=require('lodash');var moment=require(_0xef22('0x2'));var CronJobManager=require(_0xef22('0x3'));var jayson=require(_0xef22('0x4'));var BPromise=require(_0xef22('0x5'));var logger=require(_0xef22('0x6'))(_0xef22('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0xef22('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3c3513,_0x42efdd){return function(){logger[_0xef22('0x9')](_0xef22('0xa'),_0x3c3513[_0xef22('0xb')]);var _0x16a3f5=!![];var _0x5065c7={'tls':{'rejectUnauthorized':![]}};if(_0x3c3513[_0xef22('0xc')][_0xef22('0xd')][_0xef22('0xe')]){_0x5065c7[_0xef22('0xe')]=_0x3c3513['MailAccount'][_0xef22('0xd')]['service'];}else{_0x5065c7[_0xef22('0xf')]=_0x3c3513['MailAccount'][_0xef22('0xd')][_0xef22('0xf')];_0x5065c7[_0xef22('0x10')]=_0x3c3513['MailAccount'][_0xef22('0xd')][_0xef22('0x10')];_0x5065c7['secure']=_0x3c3513[_0xef22('0xc')]['Smtp'][_0xef22('0x11')];}if(_0x3c3513[_0xef22('0xc')][_0xef22('0xd')][_0xef22('0x12')]){_0x5065c7[_0xef22('0x13')]={'user':_0x3c3513[_0xef22('0xc')][_0xef22('0xd')][_0xef22('0x14')],'pass':_0x3c3513[_0xef22('0xc')]['Smtp'][_0xef22('0x15')]};}var _0x58a9a9={'account':_0x5065c7,'message':{'from':util[_0xef22('0x16')](_0xef22('0x17'),_0x3c3513['MailAccount'][_0xef22('0x18')],_0x3c3513['MailAccount'][_0xef22('0xb')]||_0x3c3513[_0xef22('0xc')]['Smtp'][_0xef22('0x14')]),'to':_0x3c3513[_0xef22('0xb')],'cc':_0x3c3513['cc'],'bcc':_0x3c3513[_0xef22('0x19')],'subject':util[_0xef22('0x16')](_0xef22('0x1a'),_0x42efdd['name'],_0x3c3513['subtractNumber'],_0x3c3513[_0xef22('0x1b')])}};var _0x5b2a95=path[_0xef22('0x1c')](__dirname,_0xef22('0x1d'));var _0x384c76=_0x42efdd[_0xef22('0x1e')];var _0x2ac629=util[_0xef22('0x16')](_0xef22('0x1f'),path[_0xef22('0x20')](_0x42efdd['savename'],path[_0xef22('0x21')](_0x42efdd[_0xef22('0x1e')])),_0xef22('0x22'));var _0x16d5bd=path[_0xef22('0x1c')](_0x5b2a95,_0x384c76);var _0x34a93b=path[_0xef22('0x1c')](_0x5b2a95,_0x2ac629);if(fs[_0xef22('0x23')](_0x16d5bd)){_0x42efdd['status']='Sent';_0x58a9a9[_0xef22('0x24')]['attachments']=[{'filename':_0x384c76,'path':_0x16d5bd}];_0x58a9a9[_0xef22('0x24')][_0xef22('0x25')]=util[_0xef22('0x16')](_0xef22('0x26'),JSON[_0xef22('0x27')](_0x42efdd,null,0x2));}else if(fs[_0xef22('0x23')](_0x34a93b)){_0x42efdd[_0xef22('0x28')]=_0xef22('0x29');_0x58a9a9[_0xef22('0x24')]['attachments']=[{'filename':_0x2ac629,'path':_0x34a93b}];}else{_0x58a9a9[_0xef22('0x24')][_0xef22('0x25')]=_0xef22('0x2a');if(!_0x3c3513[_0xef22('0x2b')]){_0x16a3f5=![];logger[_0xef22('0x9')](_0xef22('0x2c'));}}if(_0x16a3f5){return client[_0xef22('0x2d')](_0xef22('0x2e'),_0x58a9a9)[_0xef22('0x2f')](function(_0x2be50d){if(_0x2be50d['error']){return logger[_0xef22('0x30')](_0xef22('0x31'),JSON['stringify'](_0x2be50d));}return logger[_0xef22('0x9')](_0xef22('0x32'));})[_0xef22('0x33')](function(_0x2c8155){return logger[_0xef22('0x30')](_0xef22('0x31'),JSON[_0xef22('0x27')](_0x2c8155));});}};}function handleError(){return function(_0x515408){return logger[_0xef22('0x30')](JSON['stringify'](_0x515408));};}function handleResult(_0x458fe9){return function(_0x4992df){logger[_0xef22('0x9')]('data',JSON[_0xef22('0x27')](_0x4992df));if(_0x458fe9[_0xef22('0xc')]&&_0x458fe9[_0xef22('0xc')]['Smtp']&&!_[_0xef22('0x34')](_0x458fe9[_0xef22('0xb')])){setTimeout(handleSendEmail(_0x458fe9,_0x4992df),0x3c*0x3e8);}};}function handleJob(_0x33a4fe){return function(){try{if(_[_0xef22('0x34')](_0x33a4fe[_0xef22('0x35')])){return logger['info'](_0xef22('0x36'));}if(_[_0xef22('0x34')](_0x33a4fe[_0xef22('0x1b')])){return logger[_0xef22('0x9')](_0xef22('0x37'));}var _0x323241={'startDate':moment()[_0xef22('0x38')](_0x33a4fe[_0xef22('0x35')],_0x33a4fe[_0xef22('0x1b')])[_0xef22('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xef22('0x16')](_0xef22('0x39')),'type':_0xef22('0x3a'),'output':_0x33a4fe[_0xef22('0x3b')],'name':_0x33a4fe[_0xef22('0x18')]};if(!_[_0xef22('0x34')](_0x33a4fe['DefaultReportId'])){logger[_0xef22('0x9')](_0xef22('0x3c'),_0x33a4fe[_0xef22('0x3d')]);return analyticDefaultReportController[_0xef22('0x3e')]({'id':_0x33a4fe[_0xef22('0x3d')]},_0x323241)[_0xef22('0x2f')](handleResult(_0x33a4fe))[_0xef22('0x33')](handleError());}if(!_['isNil'](_0x33a4fe[_0xef22('0x3f')])){logger[_0xef22('0x9')](_0xef22('0x40'),_0x33a4fe[_0xef22('0x3f')]);return analyticCustomReportController[_0xef22('0x3e')]({'id':_0x33a4fe[_0xef22('0x3f')]},_0x323241)['then'](handleResult(_0x33a4fe))[_0xef22('0x33')](handleError());}}catch(_0x51978e){logger[_0xef22('0x30')](JSON[_0xef22('0x27')](_0x51978e));}return logger[_0xef22('0x9')](_0xef22('0x41'));};}function getJobs(_0x2a8590){var _0x1ed68f={};if(_0x2a8590){_0x1ed68f['id']=_0x2a8590;}return db[_0xef22('0x42')]['findAll']({'where':_0x1ed68f,'include':[{'model':db['MailAccount'],'attributes':['id',_0xef22('0x18'),_0xef22('0xb')],'include':[{'model':db[_0xef22('0x43')],'as':_0xef22('0xd')}]}]})['then'](function(_0x2eb951){var _0x4a9ad3=_[_0xef22('0x44')](manager[_0xef22('0x45')]);var _0xa00f26=_[_0xef22('0x46')](_0x2eb951,function(_0x1f8828){return _0x1f8828['id'][_0xef22('0x47')]();});var _0x45f981=_[_0xef22('0x48')](_0x2eb951,function(_0x3b8040){return _0x3b8040['id'][_0xef22('0x47')]();});var _0x20f38b=_0x2a8590?_0xa00f26:_[_0xef22('0x49')](_0xa00f26,_0x4a9ad3);var _0x517ae6=_['intersection'](_0xa00f26,_0x4a9ad3);var _0x240dd6=_[_0xef22('0x49')](_0x4a9ad3,_0xa00f26);var _0x205b11;var _0x551aaf;for(_0x205b11=0x0;_0x205b11<_0x240dd6[_0xef22('0x4a')]&&!_0x2a8590;_0x205b11+=0x1){_0x551aaf=_0x240dd6[_0x205b11]['toString']();if(manager['exists'](_0x551aaf)){manager[_0xef22('0x4b')](_0x551aaf);manager[_0xef22('0x4c')](_0x551aaf);logger[_0xef22('0x9')](_0xef22('0x4d'),_0x551aaf);}}logger[_0xef22('0x9')](_0xef22('0x4e'),JSON['stringify'](_0x20f38b));for(_0x205b11=0x0;_0x205b11<_0x20f38b['length'];_0x205b11+=0x1){_0x551aaf=_0x20f38b[_0x205b11][_0xef22('0x47')]();logger[_0xef22('0x9')](_0xef22('0x4f'),_0x551aaf);if(_0x2a8590){logger[_0xef22('0x9')](_0xef22('0x50'),_0x2a8590);logger['info'](JSON[_0xef22('0x27')](_0x45f981[_0x551aaf]));BPromise[_0xef22('0x51')]()['then'](handleJob(_0x45f981[_0x551aaf]));logger[_0xef22('0x9')]('run\x20job',_0x45f981[_0x551aaf][_0xef22('0x18')],_0x45f981[_0x551aaf][_0xef22('0x52')]);}else if(_0x45f981[_0x551aaf][_0xef22('0x52')]&&_0x45f981[_0x551aaf][_0xef22('0x53')]&&moment()[_0xef22('0x54')](_0x45f981[_0x551aaf][_0xef22('0x55')],_0x45f981[_0x551aaf][_0xef22('0x56')])){manager[_0xef22('0x57')](_0x551aaf,_0x45f981[_0x551aaf][_0xef22('0x52')],handleJob(_0x45f981[_0x551aaf]));manager[_0xef22('0x58')](_0x551aaf);logger[_0xef22('0x9')](_0xef22('0x59'),_0x45f981[_0x551aaf][_0xef22('0x18')],_0x45f981[_0x551aaf]['cron']);}else if(manager['exists'](_0x551aaf)){manager[_0xef22('0x4b')](_0x551aaf);manager['deleteJob'](_0x551aaf);logger[_0xef22('0x9')]('stop\x20cron',_0x45f981[_0x551aaf]['name'],_0x45f981[_0x551aaf][_0xef22('0x52')]);}}for(_0x205b11=0x0,_0x551aaf;_0x205b11<_0x517ae6[_0xef22('0x4a')]&&!_0x2a8590;_0x205b11+=0x1){_0x551aaf=_0x517ae6[_0x205b11][_0xef22('0x47')]();if(manager[_0xef22('0x5a')](_0x551aaf)){if(_0x45f981[_0x551aaf][_0xef22('0x52')]&&_0x45f981[_0x551aaf]['active']&&moment()[_0xef22('0x54')](_0x45f981[_0x551aaf][_0xef22('0x55')],_0x45f981[_0x551aaf][_0xef22('0x56')])){manager[_0xef22('0x5b')](_0x551aaf,_0x45f981[_0x551aaf][_0xef22('0x52')],handleJob(_0x45f981[_0x551aaf]));logger[_0xef22('0x9')](_0xef22('0x5c'),_0x45f981[_0x551aaf]['name'],_0x45f981[_0x551aaf]['cron']);}else{manager[_0xef22('0x4b')](_0x551aaf);manager[_0xef22('0x4c')](_0x551aaf);logger['info'](_0xef22('0x5d'),_0x45f981[_0x551aaf]['name'],_0x45f981[_0x551aaf][_0xef22('0x52')]);}}}})['catch'](function(_0x58d4c3){logger[_0xef22('0x30')](JSON[_0xef22('0x27')](_0x58d4c3));});}exports[_0xef22('0x5e')]=function(_0x53168f){return getJobs(_0x53168f);};exports[_0xef22('0x58')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index bd1f169..17e65f7 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 _0x48e5=['Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','length','transcripts','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Negative','SentimentScore','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Mixed','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','catch','error','start','aws-sdk','util','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','info','format','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0x48e5,0x196));var _0x548e=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x48e5[_0x2f3794];return _0x1c9fbe;};var _=require('lodash');var AWS=require(_0x548e('0x0'));var rp=require('request-promise');var util=require(_0x548e('0x1'));var BPromise=require(_0x548e('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x548e('0x3'))(_0x548e('0x4'));function getTranscriptionJob(_0x19bd7c,_0x5a32f1,_0x5f44e7,_0x1c917e){return new Promise(function(_0x2ae535,_0x1186fe){var _0x44a5e3=new AWS[(_0x548e('0x5'))]({'accessKeyId':_0x5a32f1,'secretAccessKey':_0x19bd7c,'region':_0x5f44e7});_0x44a5e3[_0x548e('0x6')]({'TranscriptionJobName':_0x1c917e},function(_0x171184,_0x3d8a6f){if(_0x171184){return _0x1186fe(_0x171184);}else{return _0x2ae535(_0x3d8a6f);}});});}function sentiment(_0x3b15bb,_0x23b2e3,_0x22286c,_0x3cd280,_0x438c26){return new Promise(function(_0x5254b4,_0x18f224){var _0x1f0aeb=new AWS[(_0x548e('0x7'))]({'accessKeyId':_0x23b2e3,'secretAccessKey':_0x3b15bb,'region':_0x22286c});_0x1f0aeb['detectSentiment']({'Text':_0x3cd280,'LanguageCode':_0x438c26['substring'](0x0,0x2)},function(_0x281db6,_0x5d9f13){if(_0x281db6){return _0x18f224(_0x281db6);}else{return _0x5254b4(_0x5d9f13);}});});}function checkTranscribeJob(_0x590f01,_0x32a75c,_0x43f4aa){var _0x152050;return new BPromise(function(_0x2a69cf,_0x21f516){logger['info'](util['format'](_0x548e('0x8'),_0x590f01['id'],_0x590f01[_0x548e('0x9')]));return getTranscriptionJob(_0x43f4aa[_0x548e('0xa')],_0x43f4aa[_0x548e('0xb')],_0x32a75c[_0x548e('0xc')],_0x590f01[_0x548e('0x9')])[_0x548e('0xd')](function(_0x4fdea5){logger[_0x548e('0xe')](util[_0x548e('0xf')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x590f01['id'],_0x590f01[_0x548e('0x9')],_0x4fdea5[_0x548e('0x10')][_0x548e('0x11')]));if(!_0x590f01[_0x548e('0x12')]){switch(_0x4fdea5[_0x548e('0x10')]['TranscriptionJobStatus']){case _0x548e('0x13'):var _0x5512de={'transcribeStatus':_0x4fdea5[_0x548e('0x10')][_0x548e('0x11')],'fileUri':_0x4fdea5[_0x548e('0x10')][_0x548e('0x14')][_0x548e('0x15')]};logger['info'](util[_0x548e('0xf')](_0x548e('0x16'),_0x590f01['id']));return rp({'uri':_0x4fdea5[_0x548e('0x10')][_0x548e('0x14')][_0x548e('0x15')],'json':!![]})[_0x548e('0xd')](function(_0x305f3c){logger[_0x548e('0xe')](util[_0x548e('0xf')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x590f01['id']));if(_0x305f3c&&_0x305f3c['results']&&_0x305f3c[_0x548e('0x17')]['transcripts']&&_0x305f3c[_0x548e('0x17')]['transcripts'][_0x548e('0x18')]){_0x5512de[_0x548e('0x12')]='';for(var _0x15f5ae=0x0;_0x15f5ae<_0x305f3c['results'][_0x548e('0x19')][_0x548e('0x18')];_0x15f5ae++){_0x5512de['fileText']+=_0x305f3c[_0x548e('0x17')][_0x548e('0x19')][_0x15f5ae][_0x548e('0x1a')]+'';}}return _0x590f01[_0x548e('0x1b')](_0x5512de);})[_0x548e('0xd')](function(){logger[_0x548e('0xe')](util[_0x548e('0xf')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x590f01['id']));if(!_0x590f01[_0x548e('0x1c')]){throw new db[(_0x548e('0x1d'))][(_0x548e('0x1e'))](_0x548e('0x1f'));}if(!_0x32a75c[_0x548e('0x20')]||!_0x32a75c['sentimentAccountId']||!_0x32a75c['sentimentRegion']||!_0x32a75c[_0x548e('0x21')]||!_0x32a75c[_0x548e('0x22')]){throw new db[(_0x548e('0x1d'))]['ValidationError'](_0x548e('0x23'));}if(!_0x5512de['fileText']){throw new Error(_0x548e('0x24'));}if(_0x32a75c[_0x548e('0x25')]===_0x43f4aa['id']){return _0x43f4aa;}else{return db[_0x548e('0x26')][_0x548e('0x27')]({'where':{'id':_settings[_0x548e('0x25')]}});}})[_0x548e('0xd')](function(_0x3ab9dd){if(!_0x3ab9dd){throw new db[(_0x548e('0x1d'))]['ValidationError'](_0x548e('0x28'));}if(!_0x3ab9dd['data1']||!_0x3ab9dd[_0x548e('0xb')]){throw new db[(_0x548e('0x1d'))][(_0x548e('0x1e'))](_0x548e('0x29'));}_0x152050=_0x3ab9dd;logger[_0x548e('0xe')](util[_0x548e('0xf')](_0x548e('0x2a'),_0x590f01['id']));return sentiment(_0x152050[_0x548e('0xa')],_0x152050[_0x548e('0xb')],_0x32a75c[_0x548e('0x2b')],_0x5512de[_0x548e('0x12')],_0x32a75c[_0x548e('0x21')]);})[_0x548e('0xd')](function(_0x2a6055){logger[_0x548e('0xe')](util['format'](_0x548e('0x2c'),_0x590f01['id']));return _0x590f01[_0x548e('0x1b')]({'sentiment':_0x2a6055['Sentiment'],'sPositive':_0x2a6055['SentimentScore'][_0x548e('0x2d')],'sNegative':_0x2a6055['SentimentScore'][_0x548e('0x2e')],'sMixed':_0x2a6055[_0x548e('0x2f')]['Mixed'],'sNeutral':_0x2a6055['SentimentScore'][_0x548e('0x30')]});})[_0x548e('0xd')](function(){logger[_0x548e('0xe')](util[_0x548e('0xf')](_0x548e('0x31'),_0x590f01['id']));_0x2a69cf();});case _0x548e('0x32'):return _0x590f01[_0x548e('0x1b')]({'transcribeStatus':_0x548e('0x32'),'failureReason':_0x4fdea5[_0x548e('0x10')][_0x548e('0x33')]})[_0x548e('0xd')](function(){logger[_0x548e('0xe')](util[_0x548e('0xf')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x590f01['id']));_0x2a69cf();});default:logger[_0x548e('0xe')](util[_0x548e('0xf')](_0x548e('0x34'),_0x590f01['id']));break;}}else{return BPromise[_0x548e('0x35')]()[_0x548e('0xd')](function(){if(!_0x590f01[_0x548e('0x1c')]){throw new db[(_0x548e('0x1d'))]['ValidationError'](_0x548e('0x1f'));}if(!_0x32a75c[_0x548e('0x20')]||!_0x32a75c[_0x548e('0x25')]||!_0x32a75c[_0x548e('0x2b')]||!_0x32a75c[_0x548e('0x21')]||!_0x32a75c[_0x548e('0x22')]){throw new db[(_0x548e('0x1d'))][(_0x548e('0x1e'))](_0x548e('0x23'));}if(!_0x590f01[_0x548e('0x12')]){throw new Error(_0x548e('0x24'));}if(_0x32a75c[_0x548e('0x25')]===_0x43f4aa['id']){return _0x43f4aa;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x548e('0x25')]}});}})[_0x548e('0xd')](function(_0x44e72d){if(!_0x44e72d){throw new db['Sequelize'][(_0x548e('0x1e'))](_0x548e('0x28'));}if(!_0x44e72d[_0x548e('0xa')]||!_0x44e72d[_0x548e('0xb')]){throw new db[(_0x548e('0x1d'))][(_0x548e('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x152050=_0x44e72d;logger['info'](util[_0x548e('0xf')](_0x548e('0x2a'),_0x590f01['id']));return sentiment(_0x152050[_0x548e('0xa')],_0x152050[_0x548e('0xb')],_0x32a75c['sentimentRegion'],_0x590f01[_0x548e('0x12')],_0x32a75c[_0x548e('0x21')]);})[_0x548e('0xd')](function(_0xdc49b4){logger[_0x548e('0xe')](util[_0x548e('0xf')](_0x548e('0x2c'),_0x590f01['id']));return _0x590f01[_0x548e('0x1b')]({'sentiment':_0xdc49b4['Sentiment'],'sPositive':_0xdc49b4[_0x548e('0x2f')][_0x548e('0x2d')],'sNegative':_0xdc49b4[_0x548e('0x2f')][_0x548e('0x2e')],'sMixed':_0xdc49b4[_0x548e('0x2f')][_0x548e('0x36')],'sNeutral':_0xdc49b4[_0x548e('0x2f')][_0x548e('0x30')],'transcribeStatus':_0x548e('0x13')});})[_0x548e('0xd')](function(){logger['info'](util[_0x548e('0xf')](_0x548e('0x31'),_0x590f01['id']));_0x2a69cf();});}})['catch'](function(_0x1b8e45){if(_0x1b8e45){if(!_0x1b8e45['name']||_0x1b8e45[_0x548e('0x37')]!==_0x548e('0x38')){logger['error'](util[_0x548e('0xf')](_0x548e('0x39'),_0x590f01['id']),util['inspect'](_0x1b8e45,{'showHidden':![],'depth':null}));}}_0x2a69cf();});});}function checkTranscribe(){var _0x5e57b0;var _0x1a4a7d;var _0x11675a;return db[_0x548e('0x3a')][_0x548e('0x3b')]({'where':{'transcribeStatus':_0x548e('0x3c')}})[_0x548e('0xd')](function(_0x370bbc){if(!_0x370bbc||!_0x370bbc[_0x548e('0x18')]){throw new db['Sequelize'][(_0x548e('0x1e'))](_0x548e('0x3d'));}_0x5e57b0=_0x370bbc;return db[_0x548e('0x3e')]['findOne']({'where':{'id':0x1}});})[_0x548e('0xd')](function(_0x12265f){if(!_0x12265f){throw new db[(_0x548e('0x1d'))]['ValidationError'](_0x548e('0x3f'));}_0x1a4a7d=_0x12265f;if(!_0x1a4a7d[_0x548e('0x4')]||!_0x1a4a7d[_0x548e('0x40')]||!_0x1a4a7d['transcribeRegion']||!_0x1a4a7d[_0x548e('0x21')]||!_0x1a4a7d[_0x548e('0x22')]){throw new db[(_0x548e('0x1d'))][(_0x548e('0x1e'))]('Transcribe\x20not\x20configured');}return db[_0x548e('0x26')][_0x548e('0x27')]({'where':{'id':_0x1a4a7d['transcribeAccountId']}});})[_0x548e('0xd')](function(_0x2b3316){if(!_0x2b3316){throw new db[(_0x548e('0x1d'))][(_0x548e('0x1e'))](_0x548e('0x28'));}if(!_0x2b3316['data1']||!_0x2b3316[_0x548e('0xb')]){throw new db[(_0x548e('0x1d'))][(_0x548e('0x1e'))](_0x548e('0x29'));}_0x11675a=_0x2b3316;var _0x211d94=[];_0x5e57b0[_0x548e('0x41')](function(_0x1aacea){_0x211d94[_0x548e('0x42')](checkTranscribeJob(_0x1aacea,_0x1a4a7d,_0x11675a));});return BPromise[_0x548e('0x43')](_0x211d94);})[_0x548e('0x44')](function(_0x5d14d3){if(_0x5d14d3){if(!_0x5d14d3['name']||_0x5d14d3['name']!==_0x548e('0x38')){logger[_0x548e('0x45')](util['inspect'](_0x5d14d3,{'showHidden':![],'depth':null}));}}});}exports[_0x548e('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xac1c=['update','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','catch','name','SequelizeValidationError','error','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','inspect','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','results','transcripts','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Sequelize','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED'];(function(_0x9f5414,_0x1f17ee){var _0x27dafa=function(_0x399c3c){while(--_0x399c3c){_0x9f5414['push'](_0x9f5414['shift']());}};_0x27dafa(++_0x1f17ee);}(_0xac1c,0x131));var _0xcac1=function(_0x599c94,_0x464f0e){_0x599c94=_0x599c94-0x0;var _0x34e215=_0xac1c[_0x599c94];return _0x34e215;};var _=require(_0xcac1('0x0'));var AWS=require(_0xcac1('0x1'));var rp=require(_0xcac1('0x2'));var util=require(_0xcac1('0x3'));var BPromise=require(_0xcac1('0x4'));var db=require(_0xcac1('0x5'))['db'];var logger=require(_0xcac1('0x6'))(_0xcac1('0x7'));function getTranscriptionJob(_0x2ceeba,_0x458c5c,_0x58d8ab,_0x2656d3){return new Promise(function(_0x247ab9,_0x1b2104){var _0x19864b=new AWS['TranscribeService']({'accessKeyId':_0x458c5c,'secretAccessKey':_0x2ceeba,'region':_0x58d8ab});_0x19864b['getTranscriptionJob']({'TranscriptionJobName':_0x2656d3},function(_0x58c463,_0x25fef1){if(_0x58c463){return _0x1b2104(_0x58c463);}else{return _0x247ab9(_0x25fef1);}});});}function sentiment(_0x1f63b4,_0x41463b,_0x355b45,_0x49922b,_0xc43d6a){return new Promise(function(_0x53fd21,_0x4d08b4){var _0x4d5fdd=new AWS['Comprehend']({'accessKeyId':_0x41463b,'secretAccessKey':_0x1f63b4,'region':_0x355b45});_0x4d5fdd[_0xcac1('0x8')]({'Text':_0x49922b,'LanguageCode':_0xc43d6a[_0xcac1('0x9')](0x0,0x2)},function(_0x2ece19,_0x187099){if(_0x2ece19){return _0x4d08b4(_0x2ece19);}else{return _0x53fd21(_0x187099);}});});}function checkTranscribeJob(_0x3b4e8b,_0x8221ca,_0x2f2a14){var _0xc6820a;return new BPromise(function(_0x109baf,_0x4181c1){logger[_0xcac1('0xa')](util['format'](_0xcac1('0xb'),_0x3b4e8b['id'],_0x3b4e8b[_0xcac1('0xc')]));return getTranscriptionJob(_0x2f2a14[_0xcac1('0xd')],_0x2f2a14[_0xcac1('0xe')],_0x8221ca[_0xcac1('0xf')],_0x3b4e8b[_0xcac1('0xc')])['then'](function(_0x2210cf){logger[_0xcac1('0xa')](util[_0xcac1('0x10')](_0xcac1('0x11'),_0x3b4e8b['id'],_0x3b4e8b[_0xcac1('0xc')],_0x2210cf[_0xcac1('0x12')]['TranscriptionJobStatus']));if(!_0x3b4e8b[_0xcac1('0x13')]){switch(_0x2210cf[_0xcac1('0x12')][_0xcac1('0x14')]){case _0xcac1('0x15'):var _0x424408={'transcribeStatus':_0x2210cf['TranscriptionJob'][_0xcac1('0x14')],'fileUri':_0x2210cf['TranscriptionJob'][_0xcac1('0x16')][_0xcac1('0x17')]};logger[_0xcac1('0xa')](util['format'](_0xcac1('0x18'),_0x3b4e8b['id']));return rp({'uri':_0x2210cf[_0xcac1('0x12')][_0xcac1('0x16')][_0xcac1('0x17')],'json':!![]})[_0xcac1('0x19')](function(_0xc89883){logger[_0xcac1('0xa')](util[_0xcac1('0x10')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x3b4e8b['id']));if(_0xc89883&&_0xc89883[_0xcac1('0x1a')]&&_0xc89883[_0xcac1('0x1a')][_0xcac1('0x1b')]&&_0xc89883['results']['transcripts'][_0xcac1('0x1c')]){_0x424408['fileText']='';for(var _0x369eac=0x0;_0x369eac<_0xc89883[_0xcac1('0x1a')]['transcripts'][_0xcac1('0x1c')];_0x369eac++){_0x424408[_0xcac1('0x13')]+=_0xc89883[_0xcac1('0x1a')][_0xcac1('0x1b')][_0x369eac]['transcript']+'';}}return _0x3b4e8b['update'](_0x424408);})[_0xcac1('0x19')](function(){logger[_0xcac1('0xa')](util[_0xcac1('0x10')](_0xcac1('0x1d'),_0x3b4e8b['id']));if(!_0x3b4e8b[_0xcac1('0x1e')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x8221ca['sentiment']||!_0x8221ca['sentimentAccountId']||!_0x8221ca[_0xcac1('0x1f')]||!_0x8221ca[_0xcac1('0x20')]||!_0x8221ca[_0xcac1('0x21')]){throw new db['Sequelize'][(_0xcac1('0x22'))](_0xcac1('0x23'));}if(!_0x424408['fileText']){throw new Error(_0xcac1('0x24'));}if(_0x8221ca[_0xcac1('0x25')]===_0x2f2a14['id']){return _0x2f2a14;}else{return db[_0xcac1('0x26')][_0xcac1('0x27')]({'where':{'id':_settings[_0xcac1('0x25')]}});}})['then'](function(_0x181a4e){if(!_0x181a4e){throw new db[(_0xcac1('0x28'))][(_0xcac1('0x22'))](_0xcac1('0x29'));}if(!_0x181a4e['data1']||!_0x181a4e['data2']){throw new db[(_0xcac1('0x28'))][(_0xcac1('0x22'))](_0xcac1('0x2a'));}_0xc6820a=_0x181a4e;logger[_0xcac1('0xa')](util[_0xcac1('0x10')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3b4e8b['id']));return sentiment(_0xc6820a[_0xcac1('0xd')],_0xc6820a[_0xcac1('0xe')],_0x8221ca[_0xcac1('0x1f')],_0x424408['fileText'],_0x8221ca[_0xcac1('0x20')]);})[_0xcac1('0x19')](function(_0x8416df){logger['info'](util[_0xcac1('0x10')](_0xcac1('0x2b'),_0x3b4e8b['id']));return _0x3b4e8b['update']({'sentiment':_0x8416df[_0xcac1('0x2c')],'sPositive':_0x8416df[_0xcac1('0x2d')][_0xcac1('0x2e')],'sNegative':_0x8416df['SentimentScore']['Negative'],'sMixed':_0x8416df[_0xcac1('0x2d')][_0xcac1('0x2f')],'sNeutral':_0x8416df[_0xcac1('0x2d')][_0xcac1('0x30')]});})[_0xcac1('0x19')](function(){logger[_0xcac1('0xa')](util[_0xcac1('0x10')](_0xcac1('0x1d'),_0x3b4e8b['id']));_0x109baf();});case _0xcac1('0x31'):return _0x3b4e8b[_0xcac1('0x32')]({'transcribeStatus':_0xcac1('0x31'),'failureReason':_0x2210cf[_0xcac1('0x12')]['FailureReason']})[_0xcac1('0x19')](function(){logger[_0xcac1('0xa')](util[_0xcac1('0x10')](_0xcac1('0x1d'),_0x3b4e8b['id']));_0x109baf();});default:logger[_0xcac1('0xa')](util['format'](_0xcac1('0x33'),_0x3b4e8b['id']));break;}}else{return BPromise[_0xcac1('0x34')]()[_0xcac1('0x19')](function(){if(!_0x3b4e8b[_0xcac1('0x1e')]){throw new db[(_0xcac1('0x28'))][(_0xcac1('0x22'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x8221ca[_0xcac1('0x35')]||!_0x8221ca['sentimentAccountId']||!_0x8221ca[_0xcac1('0x1f')]||!_0x8221ca[_0xcac1('0x20')]||!_0x8221ca['bucket']){throw new db['Sequelize']['ValidationError'](_0xcac1('0x23'));}if(!_0x3b4e8b[_0xcac1('0x13')]){throw new Error(_0xcac1('0x24'));}if(_0x8221ca[_0xcac1('0x25')]===_0x2f2a14['id']){return _0x2f2a14;}else{return db[_0xcac1('0x26')][_0xcac1('0x27')]({'where':{'id':_settings[_0xcac1('0x25')]}});}})[_0xcac1('0x19')](function(_0x560aa6){if(!_0x560aa6){throw new db[(_0xcac1('0x28'))][(_0xcac1('0x22'))](_0xcac1('0x29'));}if(!_0x560aa6[_0xcac1('0xd')]||!_0x560aa6['data2']){throw new db[(_0xcac1('0x28'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0xc6820a=_0x560aa6;logger[_0xcac1('0xa')](util['format'](_0xcac1('0x36'),_0x3b4e8b['id']));return sentiment(_0xc6820a['data1'],_0xc6820a[_0xcac1('0xe')],_0x8221ca[_0xcac1('0x1f')],_0x3b4e8b[_0xcac1('0x13')],_0x8221ca['language']);})[_0xcac1('0x19')](function(_0x4b9033){logger['info'](util[_0xcac1('0x10')](_0xcac1('0x2b'),_0x3b4e8b['id']));return _0x3b4e8b['update']({'sentiment':_0x4b9033[_0xcac1('0x2c')],'sPositive':_0x4b9033['SentimentScore'][_0xcac1('0x2e')],'sNegative':_0x4b9033['SentimentScore']['Negative'],'sMixed':_0x4b9033[_0xcac1('0x2d')][_0xcac1('0x2f')],'sNeutral':_0x4b9033['SentimentScore'][_0xcac1('0x30')],'transcribeStatus':_0xcac1('0x15')});})[_0xcac1('0x19')](function(){logger[_0xcac1('0xa')](util[_0xcac1('0x10')](_0xcac1('0x1d'),_0x3b4e8b['id']));_0x109baf();});}})[_0xcac1('0x37')](function(_0x5135f6){if(_0x5135f6){if(!_0x5135f6['name']||_0x5135f6[_0xcac1('0x38')]!==_0xcac1('0x39')){logger[_0xcac1('0x3a')](util[_0xcac1('0x10')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x3b4e8b['id']),util['inspect'](_0x5135f6,{'showHidden':![],'depth':null}));}}_0x109baf();});});}function checkTranscribe(){var _0x14fc29;var _0x55c52d;var _0x244978;return db[_0xcac1('0x3b')][_0xcac1('0x3c')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xcac1('0x19')](function(_0x45800c){if(!_0x45800c||!_0x45800c[_0xcac1('0x1c')]){throw new db[(_0xcac1('0x28'))][(_0xcac1('0x22'))](_0xcac1('0x3d'));}_0x14fc29=_0x45800c;return db[_0xcac1('0x3e')]['findOne']({'where':{'id':0x1}});})[_0xcac1('0x19')](function(_0x2e784b){if(!_0x2e784b){throw new db[(_0xcac1('0x28'))][(_0xcac1('0x22'))](_0xcac1('0x3f'));}_0x55c52d=_0x2e784b;if(!_0x55c52d[_0xcac1('0x7')]||!_0x55c52d['transcribeAccountId']||!_0x55c52d[_0xcac1('0xf')]||!_0x55c52d[_0xcac1('0x20')]||!_0x55c52d['bucket']){throw new db[(_0xcac1('0x28'))][(_0xcac1('0x22'))](_0xcac1('0x40'));}return db[_0xcac1('0x26')][_0xcac1('0x27')]({'where':{'id':_0x55c52d[_0xcac1('0x41')]}});})[_0xcac1('0x19')](function(_0x73a4c7){if(!_0x73a4c7){throw new db[(_0xcac1('0x28'))][(_0xcac1('0x22'))](_0xcac1('0x29'));}if(!_0x73a4c7[_0xcac1('0xd')]||!_0x73a4c7[_0xcac1('0xe')]){throw new db[(_0xcac1('0x28'))][(_0xcac1('0x22'))](_0xcac1('0x2a'));}_0x244978=_0x73a4c7;var _0x4f1eb5=[];_0x14fc29[_0xcac1('0x42')](function(_0xdcbd6f){_0x4f1eb5[_0xcac1('0x43')](checkTranscribeJob(_0xdcbd6f,_0x55c52d,_0x244978));});return BPromise[_0xcac1('0x44')](_0x4f1eb5);})[_0xcac1('0x37')](function(_0x4b3334){if(_0x4b3334){if(!_0x4b3334[_0xcac1('0x38')]||_0x4b3334[_0xcac1('0x38')]!==_0xcac1('0x39')){logger['error'](util[_0xcac1('0x45')](_0x4b3334,{'showHidden':![],'depth':null}));}}});}exports[_0xcac1('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 1ed5098..8c3129d 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc85e=['Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','destroy','hopper1','contacts2','hopper2','catch','util','push'];(function(_0x26f91e,_0x33dd59){var _0x12f85b=function(_0xde794c){while(--_0xde794c){_0x26f91e['push'](_0x26f91e['shift']());}};_0x12f85b(++_0x33dd59);}(_0xc85e,0x1b3));var _0xec85=function(_0x46e9dd,_0x1c3a1c){_0x46e9dd=_0x46e9dd-0x0;var _0xfe5a27=_0xc85e[_0x46e9dd];return _0xfe5a27;};'use strict';var util=require(_0xec85('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xec85('0x1')]({'id':i,'firstName':_0xec85('0x2')+i,'lastName':_0xec85('0x3')+i,'phone':0xf879fb460+i,'email':_0xec85('0x4')+i+_0xec85('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xec85('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xec85('0x6')](),'updatedAt':Date[_0xec85('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xec85('0x1')]({'id':i,'firstName':_0xec85('0x2')+i,'lastName':_0xec85('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xec85('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xec85('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xec85('0x6')](),'updatedAt':Date[_0xec85('0x6')]()});}db[_0xec85('0x7')]['destroy']({'where':{}})['then'](function(){return db[_0xec85('0x7')][_0xec85('0x8')](contacts);})[_0xec85('0x9')](function(){console[_0xec85('0xa')](_0xec85('0xb'),_0xec85('0xc'));return db[_0xec85('0xd')][_0xec85('0xe')]({'where':{}});})[_0xec85('0x9')](function(){return db[_0xec85('0xd')]['bulkCreate'](hopper);})[_0xec85('0x9')](function(){console[_0xec85('0xa')](_0xec85('0xb'),_0xec85('0xf'));return db['CmContact'][_0xec85('0x8')](contacts2);})[_0xec85('0x9')](function(){console[_0xec85('0xa')](_0xec85('0xb'),_0xec85('0x10'));return db['CmHopper'][_0xec85('0x8')](hopper2);})[_0xec85('0x9')](function(){console[_0xec85('0xa')](_0xec85('0xb'),_0xec85('0x11'));})[_0xec85('0x12')](function(_0x4e61ef){console[_0xec85('0xa')](_0x4e61ef);}); \ No newline at end of file +var _0x9f16=['Biondo','now','Innocenzo','innocenzo.biondo','@xcally.com','destroy','then','CmContact','bulkCreate','log','finished\x20populating','CmHopper','hopper1','contacts2','hopper2','util','../mysqldb','push'];(function(_0xc25ac6,_0x3e406b){var _0xa2ffa2=function(_0x1efd84){while(--_0x1efd84){_0xc25ac6['push'](_0xc25ac6['shift']());}};_0xa2ffa2(++_0x3e406b);}(_0x9f16,0x12f));var _0x69f1=function(_0x54a24b,_0x423b2b){_0x54a24b=_0x54a24b-0x0;var _0x3c8bec=_0x9f16[_0x54a24b];return _0x3c8bec;};'use strict';var util=require(_0x69f1('0x0'));var db=require(_0x69f1('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x69f1('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x69f1('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x69f1('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x69f1('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x69f1('0x2')]({'id':i,'firstName':_0x69f1('0x5')+i,'lastName':_0x69f1('0x3')+i,'phone':0xf879fb460+i,'email':_0x69f1('0x6')+i+_0x69f1('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x69f1('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x69f1('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x69f1('0x4')](),'updatedAt':Date['now']()});}db['CmContact'][_0x69f1('0x8')]({'where':{}})[_0x69f1('0x9')](function(){return db[_0x69f1('0xa')][_0x69f1('0xb')](contacts);})[_0x69f1('0x9')](function(){console[_0x69f1('0xc')](_0x69f1('0xd'),'contacts1');return db['CmHopper'][_0x69f1('0x8')]({'where':{}});})['then'](function(){return db[_0x69f1('0xe')]['bulkCreate'](hopper);})[_0x69f1('0x9')](function(){console['log'](_0x69f1('0xd'),_0x69f1('0xf'));return db[_0x69f1('0xa')][_0x69f1('0xb')](contacts2);})[_0x69f1('0x9')](function(){console[_0x69f1('0xc')]('finished\x20populating',_0x69f1('0x10'));return db[_0x69f1('0xe')]['bulkCreate'](hopper2);})[_0x69f1('0x9')](function(){console[_0x69f1('0xc')](_0x69f1('0xd'),_0x69f1('0x11'));})['catch'](function(_0x52ff18){console[_0x69f1('0xc')](_0x52ff18);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 18b74cf..bf75075 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd10=['log','add\x20user','catch','util','../mysqldb','format','agent','%s%s@xcally.com','password','udp','wss','all','ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User'];(function(_0x2f2418,_0x49c6db){var _0xe55945=function(_0x42f17e){while(--_0x42f17e){_0x2f2418['push'](_0x2f2418['shift']());}};_0xe55945(++_0x49c6db);}(_0xdd10,0x1a7));var _0x0dd1=function(_0x3aa92f,_0x4c5cd1){_0x3aa92f=_0x3aa92f-0x0;var _0x1f82a1=_0xdd10[_0x3aa92f];return _0x1f82a1;};'use strict';var util=require(_0x0dd1('0x0'));var db=require(_0x0dd1('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x0dd1('0x2')]('%s%s',_0x0dd1('0x3'),i),'fullname':util[_0x0dd1('0x2')]('%s%s',_0x0dd1('0x3'),i),'email':util[_0x0dd1('0x2')](_0x0dd1('0x4'),_0x0dd1('0x3'),i),'role':_0x0dd1('0x3'),'password':_0x0dd1('0x5'),'internal':0xfa0+i,'type':'friend','transport':[_0x0dd1('0x6'),'ws',_0x0dd1('0x7')],'disallow':[_0x0dd1('0x8')],'allow':[_0x0dd1('0x9')],'defaultuser':util[_0x0dd1('0x2')](_0x0dd1('0xa'),_0x0dd1('0x3'),i),'encryption':_0x0dd1('0xb'),'avpf':_0x0dd1('0xb'),'force_avp':_0x0dd1('0xb'),'icesupport':_0x0dd1('0xb'),'dtlsenable':_0x0dd1('0xb'),'dtlsverify':'no','dtlscertfile':_0x0dd1('0xc'),'dtlsprivatekey':_0x0dd1('0xd'),'dtlssetup':_0x0dd1('0xe'),'callerid':util[_0x0dd1('0x2')](_0x0dd1('0xf'),util[_0x0dd1('0x2')]('%s%s','agent',i),0xfa0+i)});}db[_0x0dd1('0x10')]['bulkCreate'](users)['then'](function(){console[_0x0dd1('0x11')](_0x0dd1('0x12'));})[_0x0dd1('0x13')](function(_0x3a060){console[_0x0dd1('0x11')](_0x3a060);}); \ No newline at end of file +var _0x1f01=['%s%s','yes','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','format','agent','%s%s@xcally.com','password','friend','udp','all','ulaw'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x1f01,0x1c2));var _0x11f0=function(_0x532745,_0x1a16d6){_0x532745=_0x532745-0x0;var _0x37a301=_0x1f01[_0x532745];return _0x37a301;};'use strict';var util=require(_0x11f0('0x0'));var db=require(_0x11f0('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x11f0('0x2')]('%s%s',_0x11f0('0x3'),i),'fullname':util['format']('%s%s',_0x11f0('0x3'),i),'email':util['format'](_0x11f0('0x4'),'agent',i),'role':'agent','password':_0x11f0('0x5'),'internal':0xfa0+i,'type':_0x11f0('0x6'),'transport':[_0x11f0('0x7'),'ws','wss'],'disallow':[_0x11f0('0x8')],'allow':[_0x11f0('0x9')],'defaultuser':util[_0x11f0('0x2')](_0x11f0('0xa'),_0x11f0('0x3'),i),'encryption':_0x11f0('0xb'),'avpf':_0x11f0('0xb'),'force_avp':'yes','icesupport':_0x11f0('0xb'),'dtlsenable':_0x11f0('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x11f0('0xc'),'dtlssetup':'actpass','callerid':util[_0x11f0('0x2')](_0x11f0('0xd'),util['format'](_0x11f0('0xa'),'agent',i),0xfa0+i)});}db[_0x11f0('0xe')][_0x11f0('0xf')](users)[_0x11f0('0x10')](function(){console[_0x11f0('0x11')](_0x11f0('0x12'));})[_0x11f0('0x13')](function(_0x420128){console[_0x11f0('0x11')](_0x420128);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 55f7720..aea3aca 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e1=['SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','userProfileId','MailQueues','Telephones','Trunk','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','mail','telephone:%s','campaign:%s:%s','leave','user_has_chat_interactions:remove','map','removeMailInteractions','removeFaxInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','catch','log','join','default','address','request','connection','remoteAddress','remotePort','connectedAt','SocketIO\x20','disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','User','where','Campaign','format','%s:queue:%s','user:%s','find','handshake','query','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','VoiceQueue','push','FaxQueue'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb7e1,0x8e));var _0x1b7e=function(_0x3316b1,_0x716974){_0x3316b1=_0x3316b1-0x0;var _0x4b4caf=_0xb7e1[_0x3316b1];return _0x4b4caf;};'use strict';var _=require(_0x1b7e('0x0'));var util=require(_0x1b7e('0x1'));var BPromise=require(_0x1b7e('0x2'));var db=require(_0x1b7e('0x3'))['db'];var config=require(_0x1b7e('0x4'));var queryQueues={'attributes':['id',_0x1b7e('0x5')],'include':[{'as':_0x1b7e('0x6'),'model':db['User'],'attributes':['id','name',_0x1b7e('0x7')],'raw':!![],'where':{'role':_0x1b7e('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x1b7e('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x1b7e('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x1b7e('0x5')],'where':{'role':_0x1b7e('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1b7e('0x5'),_0x1b7e('0xa')],'where':{'type':_0x1b7e('0xb')}};function getAssociatedResources(_0x4d12c8,_0x4e8470,_0x33fbcd){return db[_0x1b7e('0xc')][_0x1b7e('0xd')]({'where':{'name':_0x4d12c8,'userProfileId':_0x4e8470},'raw':!![]})[_0x1b7e('0xe')](function(_0x305048){if(_0x305048){if(_0x305048[_0x1b7e('0xf')]){switch(_0x4d12c8){case _0x1b7e('0x10'):case _0x1b7e('0x11'):case _0x1b7e('0x12'):case _0x1b7e('0x13'):case'MailQueues':case _0x1b7e('0x14'):case _0x1b7e('0x15'):return db[_0x33fbcd][_0x1b7e('0x16')](queryQueues);case'Telephones':return db[_0x33fbcd][_0x1b7e('0x16')](queryTelephones);case _0x1b7e('0x17'):return db[_0x33fbcd][_0x1b7e('0x16')](queryTrunks);case _0x1b7e('0x18'):return db[_0x33fbcd][_0x1b7e('0x16')](queryCampaigns);}}else{return db[_0x1b7e('0x19')][_0x1b7e('0x16')]({'attributes':['resourceId'],'where':{'sectionId':_0x305048['id']},'raw':!![]})[_0x1b7e('0xe')](function(_0x3a45ea){if(_0x3a45ea){var _0x16566d={'where':{'id':_['map'](_0x3a45ea,_0x1b7e('0x1a'))},'raw':!![]};switch(_0x33fbcd){case _0x1b7e('0x1b'):_0x16566d[_0x1b7e('0x1c')]['role']=_0x1b7e('0x9');break;case _0x1b7e('0x1d'):_0x16566d[_0x1b7e('0x1c')][_0x1b7e('0xa')]=_0x1b7e('0xb');break;}return db[_0x33fbcd][_0x1b7e('0x16')](_0x16566d);}else{return[];}});}}else{return[];}})[_0x1b7e('0xe')](function(_0x261cd5){return _0x261cd5;});}function joinOrLeaveQueues(_0x1e5231,_0x459051,_0x4e76eb,_0x15ef12){_0x1e5231[_0x459051](util[_0x1b7e('0x1e')](_0x1b7e('0x1f'),_0x4e76eb,_0x15ef12[_0x1b7e('0x5')]));if(_0x15ef12[_0x1b7e('0x6')]){for(var _0xf26fbb=0x0;_0xf26fbb<_0x15ef12[_0x1b7e('0x6')]['length'];_0xf26fbb+=0x1){_0x1e5231[_0x459051](util['format'](_0x1b7e('0x20'),_0x15ef12[_0x1b7e('0x6')][_0xf26fbb][_0x1b7e('0x5')]));}}}function joinOrLeave(_0x417a85,_0x329abb,_0x46c635){var _0x334222;if(_0x417a85['handshake']['query']['id']){db[_0x1b7e('0x1b')][_0x1b7e('0x21')]({'attributes':['id',_0x1b7e('0x5'),_0x1b7e('0x7'),'userProfileId'],'where':{'id':_0x417a85[_0x1b7e('0x22')][_0x1b7e('0x23')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x1b7e('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x1b7e('0x25')],'as':_0x1b7e('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x1b7e('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x1b7e('0x28')],'as':_0x1b7e('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x1b7e('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1b7e('0x2b')],'as':_0x1b7e('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x105ba6){if(_0x105ba6){_0x334222=_0x105ba6;_0x417a85[_0x329abb](util[_0x1b7e('0x1e')](_0x1b7e('0x20'),_0x105ba6[_0x1b7e('0x5')]));var _0x19e524=[];switch(_0x105ba6[_0x1b7e('0x7')]){case _0x1b7e('0x2d'):_0x417a85[_0x329abb](_0x1b7e('0x2e'));_0x417a85[_0x329abb](_0x1b7e('0x2f'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0x1b7e('0x30')];}_0x19e524['push'](db[_0x1b7e('0x31')]['findAll'](queryQueues));_0x19e524['push'](db['ChatQueue'][_0x1b7e('0x16')](queryQueues));_0x19e524[_0x1b7e('0x32')](db[_0x1b7e('0x33')][_0x1b7e('0x16')](queryQueues));_0x19e524[_0x1b7e('0x32')](db[_0x1b7e('0x34')][_0x1b7e('0x16')](queryQueues));_0x19e524[_0x1b7e('0x32')](db[_0x1b7e('0x35')][_0x1b7e('0x16')](queryQueues));_0x19e524['push'](db[_0x1b7e('0x36')]['findAll'](queryQueues));_0x19e524[_0x1b7e('0x32')](db[_0x1b7e('0x37')]['findAll'](queryQueues));_0x19e524[_0x1b7e('0x32')](db[_0x1b7e('0x1b')]['findAll'](queryTelephones));_0x19e524['push'](db['Trunk'][_0x1b7e('0x16')](queryTrunks));_0x19e524['push'](db[_0x1b7e('0x1d')][_0x1b7e('0x16')](queryCampaigns));_0x19e524[_0x1b7e('0x32')](db[_0x1b7e('0x1b')]['findAll'](queryAgents));break;case _0x1b7e('0x38'):_0x417a85[_0x329abb](_0x1b7e('0x2e'));_0x417a85[_0x329abb](_0x1b7e('0x2f'));_0x19e524[_0x1b7e('0x32')](getAssociatedResources('VoiceQueues',_0x105ba6['userProfileId'],_0x1b7e('0x31')));_0x19e524['push'](getAssociatedResources(_0x1b7e('0x11'),_0x105ba6[_0x1b7e('0x39')],'ChatQueue'));_0x19e524['push'](getAssociatedResources(_0x1b7e('0x12'),_0x105ba6[_0x1b7e('0x39')],'FaxQueue'));_0x19e524[_0x1b7e('0x32')](getAssociatedResources(_0x1b7e('0x13'),_0x105ba6['userProfileId'],_0x1b7e('0x34')));_0x19e524[_0x1b7e('0x32')](getAssociatedResources(_0x1b7e('0x3a'),_0x105ba6[_0x1b7e('0x39')],_0x1b7e('0x35')));_0x19e524[_0x1b7e('0x32')](getAssociatedResources(_0x1b7e('0x14'),_0x105ba6[_0x1b7e('0x39')],_0x1b7e('0x36')));_0x19e524[_0x1b7e('0x32')](getAssociatedResources(_0x1b7e('0x15'),_0x105ba6['userProfileId'],'WhatsappQueue'));_0x19e524[_0x1b7e('0x32')](getAssociatedResources(_0x1b7e('0x3b'),_0x105ba6[_0x1b7e('0x39')],_0x1b7e('0x1b')));_0x19e524[_0x1b7e('0x32')](getAssociatedResources(_0x1b7e('0x17'),_0x105ba6[_0x1b7e('0x39')],_0x1b7e('0x3c')));_0x19e524[_0x1b7e('0x32')](getAssociatedResources(_0x1b7e('0x18'),_0x105ba6[_0x1b7e('0x39')],_0x1b7e('0x1d')));_0x19e524[_0x1b7e('0x32')](db['User'][_0x1b7e('0x16')](queryAgents));break;case _0x1b7e('0x8'):_0x417a85[_0x329abb](_0x1b7e('0x2e'));_0x417a85[_0x329abb]('voice:outbound');_0x19e524[_0x1b7e('0x32')](_0x105ba6[_0x1b7e('0x3d')]({'attributes':['id',_0x1b7e('0x5')]}));_0x19e524[_0x1b7e('0x32')](_0x105ba6[_0x1b7e('0x3e')]({'attributes':['id','name']}));_0x19e524['push'](_0x105ba6['getFaxQueues']({'attributes':['id',_0x1b7e('0x5')]}));_0x19e524['push'](_0x105ba6[_0x1b7e('0x3f')]({'attributes':['id',_0x1b7e('0x5')]}));_0x19e524[_0x1b7e('0x32')](_0x105ba6[_0x1b7e('0x40')]({'attributes':['id',_0x1b7e('0x5')]}));_0x19e524[_0x1b7e('0x32')](_0x105ba6[_0x1b7e('0x41')]({'attributes':['id',_0x1b7e('0x5')]}));_0x19e524[_0x1b7e('0x32')](_0x105ba6[_0x1b7e('0x42')]({'attributes':['id','name']}));break;}return BPromise[_0x1b7e('0x43')](_0x19e524);}})[_0x1b7e('0xe')](function(_0x46ddb1){if(_0x46ddb1&&_0x46ddb1[_0x1b7e('0x44')]){for(var _0x109cbc=0x0;_0x109cbc<_0x46ddb1['length'];_0x109cbc+=0x1){for(var _0x1e2a05=0x0;_0x1e2a05<_0x46ddb1[_0x109cbc][_0x1b7e('0x44')];_0x1e2a05+=0x1){switch(_0x109cbc){case 0x0:joinOrLeaveQueues(_0x417a85,_0x329abb,'voice',_0x46ddb1[_0x109cbc][_0x1e2a05]);break;case 0x1:joinOrLeaveQueues(_0x417a85,_0x329abb,'chat',_0x46ddb1[_0x109cbc][_0x1e2a05]);break;case 0x2:joinOrLeaveQueues(_0x417a85,_0x329abb,'fax',_0x46ddb1[_0x109cbc][_0x1e2a05]);break;case 0x3:joinOrLeaveQueues(_0x417a85,_0x329abb,'sms',_0x46ddb1[_0x109cbc][_0x1e2a05]);break;case 0x4:joinOrLeaveQueues(_0x417a85,_0x329abb,_0x1b7e('0x45'),_0x46ddb1[_0x109cbc][_0x1e2a05]);break;case 0x5:joinOrLeaveQueues(_0x417a85,_0x329abb,'openchannel',_0x46ddb1[_0x109cbc][_0x1e2a05]);break;case 0x6:joinOrLeaveQueues(_0x417a85,_0x329abb,'whatsapp',_0x46ddb1[_0x109cbc][_0x1e2a05]);break;case 0x7:_0x417a85[_0x329abb](util[_0x1b7e('0x1e')](_0x1b7e('0x46'),_0x46ddb1[_0x109cbc][_0x1e2a05][_0x1b7e('0x5')]));break;case 0x8:_0x417a85[_0x329abb](util[_0x1b7e('0x1e')]('trunk:%s',_0x46ddb1[_0x109cbc][_0x1e2a05][_0x1b7e('0x5')]));break;case 0x9:_0x417a85[_0x329abb](util[_0x1b7e('0x1e')](_0x1b7e('0x47'),_0x46ddb1[_0x109cbc][_0x1e2a05][_0x1b7e('0xa')],_0x46ddb1[_0x109cbc][_0x1e2a05][_0x1b7e('0x5')]));break;case 0xa:_0x417a85[_0x329abb](util[_0x1b7e('0x1e')](_0x1b7e('0x20'),_0x46ddb1[_0x109cbc][_0x1e2a05][_0x1b7e('0x5')]));break;}}}}})['then'](function(){if(_0x329abb===_0x1b7e('0x48')){var _0x20e0a3=_['map'](_0x334222[_0x1b7e('0x24')],'id');return _0x334222['removeChatInteractions'](_0x20e0a3)[_0x1b7e('0xe')](function(){for(var _0x3c2fbb=0x0;_0x3c2fbb<_0x20e0a3[_0x1b7e('0x44')];_0x3c2fbb+=0x1){_0x46c635['emit'](_0x1b7e('0x49'),{'ChatInteractionId':Number(_0x20e0a3[_0x3c2fbb]),'UserId':Number(_0x334222['id'])});}});}})[_0x1b7e('0xe')](function(){if(_0x329abb===_0x1b7e('0x48')){var _0x337d3d=_[_0x1b7e('0x4a')](_0x334222['MailInteractions'],'id');return _0x334222[_0x1b7e('0x4b')](_0x337d3d)[_0x1b7e('0xe')](function(){for(var _0x2356d0=0x0;_0x2356d0<_0x337d3d['length'];_0x2356d0+=0x1){_0x46c635['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x337d3d[_0x2356d0]),'UserId':Number(_0x334222['id'])});}});}})[_0x1b7e('0xe')](function(){if(_0x329abb==='leave'){var _0x3b3040=_[_0x1b7e('0x4a')](_0x334222[_0x1b7e('0x27')],'id');return _0x334222[_0x1b7e('0x4c')](_0x3b3040)['then'](function(){for(var _0x232d9b=0x0;_0x232d9b<_0x3b3040['length'];_0x232d9b+=0x1){_0x46c635[_0x1b7e('0x4d')](_0x1b7e('0x4e'),{'FaxInteractionId':Number(_0x3b3040[_0x232d9b]),'UserId':Number(_0x334222['id'])});}});}})[_0x1b7e('0xe')](function(){if(_0x329abb==='leave'){var _0x52c3ed=_['map'](_0x334222[_0x1b7e('0x29')],'id');return _0x334222[_0x1b7e('0x4f')](_0x52c3ed)[_0x1b7e('0xe')](function(){for(var _0x4fd4eb=0x0;_0x4fd4eb<_0x52c3ed[_0x1b7e('0x44')];_0x4fd4eb+=0x1){_0x46c635['emit'](_0x1b7e('0x50'),{'SmsInteractionId':Number(_0x52c3ed[_0x4fd4eb]),'UserId':Number(_0x334222['id'])});}});}})['then'](function(){if(_0x329abb===_0x1b7e('0x48')){var _0x6e6c4e=_['map'](_0x334222[_0x1b7e('0x51')],'id');return _0x334222[_0x1b7e('0x52')](_0x6e6c4e)['then'](function(){for(var _0x3fd078=0x0;_0x3fd078<_0x6e6c4e['length'];_0x3fd078+=0x1){_0x46c635[_0x1b7e('0x4d')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x6e6c4e[_0x3fd078]),'UserId':Number(_0x334222['id'])});}});}})['then'](function(){if(_0x329abb===_0x1b7e('0x48')){var _0x1a60d4=_[_0x1b7e('0x4a')](_0x334222[_0x1b7e('0x2c')],'id');return _0x334222[_0x1b7e('0x53')](_0x1a60d4)[_0x1b7e('0xe')](function(){for(var _0x286e07=0x0;_0x286e07<_0x1a60d4[_0x1b7e('0x44')];_0x286e07+=0x1){_0x46c635[_0x1b7e('0x4d')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x1a60d4[_0x286e07]),'UserId':Number(_0x334222['id'])});}});}})[_0x1b7e('0x54')](function(_0x1ef5ce){_0x417a85[_0x1b7e('0x55')](_0x1ef5ce);});}}function onDisconnect(_0x1c8abf,_0x3928e6){joinOrLeave(_0x1c8abf,_0x1b7e('0x48'),_0x3928e6);}function onConnect(_0x2841a6){joinOrLeave(_0x2841a6,_0x1b7e('0x56'));}exports[_0x1b7e('0x57')]=function(_0x107151){_0x107151['on']('connection',function(_0x1df2ea){_0x1df2ea['setMaxListeners'](0x0);_0x1df2ea[_0x1b7e('0x58')]=_0x1df2ea[_0x1b7e('0x59')][_0x1b7e('0x5a')][_0x1b7e('0x5b')]+':'+_0x1df2ea[_0x1b7e('0x59')]['connection'][_0x1b7e('0x5c')];_0x1df2ea[_0x1b7e('0x5d')]=new Date();_0x1df2ea['log']=function(_0x30dd6e){console[_0x1b7e('0x55')](_0x1b7e('0x5e')+_0x1df2ea['nsp'][_0x1b7e('0x5')]+'['+_0x1df2ea[_0x1b7e('0x58')]+']',_0x30dd6e);};_0x1df2ea['on'](_0x1b7e('0x5f'),function(){onDisconnect(_0x1df2ea,_0x107151);_0x1df2ea[_0x1b7e('0x55')]('DISCONNECTED');});onConnect(_0x1df2ea);_0x1df2ea[_0x1b7e('0x55')](_0x1b7e('0x60'));});}; \ No newline at end of file +var _0x630e=['%s:queue:%s','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','WhatsappInteraction','admin','voice:outbound','hasOwnProperty','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','voice:inbound','FaxQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','length','chat','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','emit','removeMailInteractions','leave','removeFaxInteractions','SmsInteractions','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','remoteAddress','request','remotePort','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','then','map','resourceId','where','Campaign','type','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x630e,0x1af));var _0xe630=function(_0x5e4b4e,_0x585c6c){_0x5e4b4e=_0x5e4b4e-0x0;var _0x1c0a4e=_0x630e[_0x5e4b4e];return _0x1c0a4e;};'use strict';var _=require(_0xe630('0x0'));var util=require('util');var BPromise=require(_0xe630('0x1'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xe630('0x2')],'include':[{'as':_0xe630('0x3'),'model':db[_0xe630('0x4')],'attributes':['id','name',_0xe630('0x5')],'raw':!![],'where':{'role':_0xe630('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xe630('0x2')],'where':{'role':_0xe630('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xe630('0x2')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xe630('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xe630('0x2'),'type'],'where':{'type':_0xe630('0x8')}};function getAssociatedResources(_0x5a9d7c,_0x2ebe2e,_0x3da641){return db[_0xe630('0x9')]['findOne']({'where':{'name':_0x5a9d7c,'userProfileId':_0x2ebe2e},'raw':!![]})['then'](function(_0x465c45){if(_0x465c45){if(_0x465c45[_0xe630('0xa')]){switch(_0x5a9d7c){case _0xe630('0xb'):case _0xe630('0xc'):case'FaxQueues':case _0xe630('0xd'):case _0xe630('0xe'):case _0xe630('0xf'):case _0xe630('0x10'):return db[_0x3da641][_0xe630('0x11')](queryQueues);case _0xe630('0x12'):return db[_0x3da641][_0xe630('0x11')](queryTelephones);case _0xe630('0x13'):return db[_0x3da641][_0xe630('0x11')](queryTrunks);case _0xe630('0x14'):return db[_0x3da641][_0xe630('0x11')](queryCampaigns);}}else{return db[_0xe630('0x15')][_0xe630('0x11')]({'attributes':['resourceId'],'where':{'sectionId':_0x465c45['id']},'raw':!![]})[_0xe630('0x16')](function(_0x1587a7){if(_0x1587a7){var _0x3e89f7={'where':{'id':_[_0xe630('0x17')](_0x1587a7,_0xe630('0x18'))},'raw':!![]};switch(_0x3da641){case _0xe630('0x4'):_0x3e89f7[_0xe630('0x19')][_0xe630('0x5')]=_0xe630('0x7');break;case _0xe630('0x1a'):_0x3e89f7[_0xe630('0x19')][_0xe630('0x1b')]=_0xe630('0x8');break;}return db[_0x3da641][_0xe630('0x11')](_0x3e89f7);}else{return[];}});}}else{return[];}})[_0xe630('0x16')](function(_0x109a7b){return _0x109a7b;});}function joinOrLeaveQueues(_0x11ac6f,_0x29a67f,_0x1a5f9a,_0x2148f0){_0x11ac6f[_0x29a67f](util[_0xe630('0x1c')](_0xe630('0x1d'),_0x1a5f9a,_0x2148f0[_0xe630('0x2')]));if(_0x2148f0[_0xe630('0x3')]){for(var _0x1c2d94=0x0;_0x1c2d94<_0x2148f0[_0xe630('0x3')]['length'];_0x1c2d94+=0x1){_0x11ac6f[_0x29a67f](util[_0xe630('0x1c')](_0xe630('0x1e'),_0x2148f0[_0xe630('0x3')][_0x1c2d94]['name']));}}}function joinOrLeave(_0x426873,_0x11159a,_0x36ba2c){var _0x5c2ac6;if(_0x426873[_0xe630('0x1f')][_0xe630('0x20')]['id']){db[_0xe630('0x4')][_0xe630('0x21')]({'attributes':['id',_0xe630('0x2'),_0xe630('0x5'),_0xe630('0x22')],'where':{'id':_0x426873['handshake'][_0xe630('0x20')]['id']},'include':[{'model':db[_0xe630('0x23')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe630('0x24')],'as':_0xe630('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xe630('0x26')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe630('0x27')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x70f17e){if(_0x70f17e){_0x5c2ac6=_0x70f17e;_0x426873[_0x11159a](util[_0xe630('0x1c')](_0xe630('0x1e'),_0x70f17e[_0xe630('0x2')]));var _0x1cd97c=[];switch(_0x70f17e[_0xe630('0x5')]){case _0xe630('0x28'):_0x426873[_0x11159a]('voice:inbound');_0x426873[_0x11159a](_0xe630('0x29'));if(queryQueues[_0xe630('0x2a')]('include')){delete queryQueues['include'];}_0x1cd97c['push'](db[_0xe630('0x2b')]['findAll'](queryQueues));_0x1cd97c[_0xe630('0x2c')](db[_0xe630('0x2d')][_0xe630('0x11')](queryQueues));_0x1cd97c[_0xe630('0x2c')](db[_0xe630('0x2e')][_0xe630('0x11')](queryQueues));_0x1cd97c['push'](db[_0xe630('0x2f')]['findAll'](queryQueues));_0x1cd97c['push'](db[_0xe630('0x30')][_0xe630('0x11')](queryQueues));_0x1cd97c[_0xe630('0x2c')](db[_0xe630('0x31')]['findAll'](queryQueues));_0x1cd97c[_0xe630('0x2c')](db[_0xe630('0x32')][_0xe630('0x11')](queryQueues));_0x1cd97c[_0xe630('0x2c')](db[_0xe630('0x4')][_0xe630('0x11')](queryTelephones));_0x1cd97c[_0xe630('0x2c')](db['Trunk'][_0xe630('0x11')](queryTrunks));_0x1cd97c['push'](db[_0xe630('0x1a')][_0xe630('0x11')](queryCampaigns));_0x1cd97c[_0xe630('0x2c')](db[_0xe630('0x4')][_0xe630('0x11')](queryAgents));break;case _0xe630('0x33'):_0x426873[_0x11159a](_0xe630('0x34'));_0x426873[_0x11159a](_0xe630('0x29'));_0x1cd97c['push'](getAssociatedResources(_0xe630('0xb'),_0x70f17e[_0xe630('0x22')],'VoiceQueue'));_0x1cd97c['push'](getAssociatedResources('ChatQueues',_0x70f17e['userProfileId'],_0xe630('0x2d')));_0x1cd97c[_0xe630('0x2c')](getAssociatedResources(_0xe630('0x35'),_0x70f17e[_0xe630('0x22')],_0xe630('0x2e')));_0x1cd97c[_0xe630('0x2c')](getAssociatedResources(_0xe630('0xd'),_0x70f17e[_0xe630('0x22')],_0xe630('0x2f')));_0x1cd97c[_0xe630('0x2c')](getAssociatedResources(_0xe630('0xe'),_0x70f17e[_0xe630('0x22')],_0xe630('0x30')));_0x1cd97c[_0xe630('0x2c')](getAssociatedResources(_0xe630('0xf'),_0x70f17e[_0xe630('0x22')],_0xe630('0x31')));_0x1cd97c[_0xe630('0x2c')](getAssociatedResources(_0xe630('0x10'),_0x70f17e['userProfileId'],'WhatsappQueue'));_0x1cd97c['push'](getAssociatedResources(_0xe630('0x12'),_0x70f17e[_0xe630('0x22')],_0xe630('0x4')));_0x1cd97c['push'](getAssociatedResources(_0xe630('0x13'),_0x70f17e[_0xe630('0x22')],'Trunk'));_0x1cd97c['push'](getAssociatedResources(_0xe630('0x14'),_0x70f17e['userProfileId'],_0xe630('0x1a')));_0x1cd97c[_0xe630('0x2c')](db[_0xe630('0x4')]['findAll'](queryAgents));break;case _0xe630('0x6'):_0x426873[_0x11159a](_0xe630('0x34'));_0x426873[_0x11159a](_0xe630('0x29'));_0x1cd97c[_0xe630('0x2c')](_0x70f17e['getVoiceQueues']({'attributes':['id',_0xe630('0x2')]}));_0x1cd97c[_0xe630('0x2c')](_0x70f17e['getChatQueues']({'attributes':['id',_0xe630('0x2')]}));_0x1cd97c[_0xe630('0x2c')](_0x70f17e[_0xe630('0x36')]({'attributes':['id',_0xe630('0x2')]}));_0x1cd97c['push'](_0x70f17e[_0xe630('0x37')]({'attributes':['id',_0xe630('0x2')]}));_0x1cd97c[_0xe630('0x2c')](_0x70f17e['getMailQueues']({'attributes':['id',_0xe630('0x2')]}));_0x1cd97c[_0xe630('0x2c')](_0x70f17e[_0xe630('0x38')]({'attributes':['id',_0xe630('0x2')]}));_0x1cd97c['push'](_0x70f17e[_0xe630('0x39')]({'attributes':['id','name']}));break;}return BPromise[_0xe630('0x3a')](_0x1cd97c);}})['then'](function(_0x2c8c0a){if(_0x2c8c0a&&_0x2c8c0a[_0xe630('0x3b')]){for(var _0xb06a01=0x0;_0xb06a01<_0x2c8c0a[_0xe630('0x3b')];_0xb06a01+=0x1){for(var _0x12c74d=0x0;_0x12c74d<_0x2c8c0a[_0xb06a01][_0xe630('0x3b')];_0x12c74d+=0x1){switch(_0xb06a01){case 0x0:joinOrLeaveQueues(_0x426873,_0x11159a,'voice',_0x2c8c0a[_0xb06a01][_0x12c74d]);break;case 0x1:joinOrLeaveQueues(_0x426873,_0x11159a,_0xe630('0x3c'),_0x2c8c0a[_0xb06a01][_0x12c74d]);break;case 0x2:joinOrLeaveQueues(_0x426873,_0x11159a,'fax',_0x2c8c0a[_0xb06a01][_0x12c74d]);break;case 0x3:joinOrLeaveQueues(_0x426873,_0x11159a,_0xe630('0x3d'),_0x2c8c0a[_0xb06a01][_0x12c74d]);break;case 0x4:joinOrLeaveQueues(_0x426873,_0x11159a,_0xe630('0x3e'),_0x2c8c0a[_0xb06a01][_0x12c74d]);break;case 0x5:joinOrLeaveQueues(_0x426873,_0x11159a,_0xe630('0x3f'),_0x2c8c0a[_0xb06a01][_0x12c74d]);break;case 0x6:joinOrLeaveQueues(_0x426873,_0x11159a,_0xe630('0x40'),_0x2c8c0a[_0xb06a01][_0x12c74d]);break;case 0x7:_0x426873[_0x11159a](util[_0xe630('0x1c')](_0xe630('0x41'),_0x2c8c0a[_0xb06a01][_0x12c74d][_0xe630('0x2')]));break;case 0x8:_0x426873[_0x11159a](util[_0xe630('0x1c')](_0xe630('0x42'),_0x2c8c0a[_0xb06a01][_0x12c74d]['name']));break;case 0x9:_0x426873[_0x11159a](util[_0xe630('0x1c')]('campaign:%s:%s',_0x2c8c0a[_0xb06a01][_0x12c74d][_0xe630('0x1b')],_0x2c8c0a[_0xb06a01][_0x12c74d][_0xe630('0x2')]));break;case 0xa:_0x426873[_0x11159a](util[_0xe630('0x1c')](_0xe630('0x1e'),_0x2c8c0a[_0xb06a01][_0x12c74d]['name']));break;}}}}})[_0xe630('0x16')](function(){if(_0x11159a==='leave'){var _0x558e3e=_[_0xe630('0x17')](_0x5c2ac6['ChatInteractions'],'id');return _0x5c2ac6['removeChatInteractions'](_0x558e3e)[_0xe630('0x16')](function(){for(var _0x3a8f71=0x0;_0x3a8f71<_0x558e3e['length'];_0x3a8f71+=0x1){_0x36ba2c[_0xe630('0x43')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x558e3e[_0x3a8f71]),'UserId':Number(_0x5c2ac6['id'])});}});}})['then'](function(){if(_0x11159a==='leave'){var _0x4fb7dd=_['map'](_0x5c2ac6[_0xe630('0x25')],'id');return _0x5c2ac6[_0xe630('0x44')](_0x4fb7dd)['then'](function(){for(var _0x53d29a=0x0;_0x53d29a<_0x4fb7dd['length'];_0x53d29a+=0x1){_0x36ba2c[_0xe630('0x43')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4fb7dd[_0x53d29a]),'UserId':Number(_0x5c2ac6['id'])});}});}})[_0xe630('0x16')](function(){if(_0x11159a===_0xe630('0x45')){var _0x388585=_[_0xe630('0x17')](_0x5c2ac6['FaxInteractions'],'id');return _0x5c2ac6[_0xe630('0x46')](_0x388585)[_0xe630('0x16')](function(){for(var _0x3a508c=0x0;_0x3a508c<_0x388585[_0xe630('0x3b')];_0x3a508c+=0x1){_0x36ba2c['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x388585[_0x3a508c]),'UserId':Number(_0x5c2ac6['id'])});}});}})[_0xe630('0x16')](function(){if(_0x11159a===_0xe630('0x45')){var _0x4abde0=_[_0xe630('0x17')](_0x5c2ac6[_0xe630('0x47')],'id');return _0x5c2ac6[_0xe630('0x48')](_0x4abde0)[_0xe630('0x16')](function(){for(var _0x4fd2c2=0x0;_0x4fd2c2<_0x4abde0[_0xe630('0x3b')];_0x4fd2c2+=0x1){_0x36ba2c[_0xe630('0x43')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x4abde0[_0x4fd2c2]),'UserId':Number(_0x5c2ac6['id'])});}});}})[_0xe630('0x16')](function(){if(_0x11159a===_0xe630('0x45')){var _0x1b9279=_[_0xe630('0x17')](_0x5c2ac6['OpenchannelInteractions'],'id');return _0x5c2ac6[_0xe630('0x49')](_0x1b9279)[_0xe630('0x16')](function(){for(var _0x4b17b9=0x0;_0x4b17b9<_0x1b9279[_0xe630('0x3b')];_0x4b17b9+=0x1){_0x36ba2c[_0xe630('0x43')](_0xe630('0x4a'),{'OpenchannelInteractionId':Number(_0x1b9279[_0x4b17b9]),'UserId':Number(_0x5c2ac6['id'])});}});}})[_0xe630('0x16')](function(){if(_0x11159a===_0xe630('0x45')){var _0x20d462=_[_0xe630('0x17')](_0x5c2ac6[_0xe630('0x4b')],'id');return _0x5c2ac6[_0xe630('0x4c')](_0x20d462)[_0xe630('0x16')](function(){for(var _0xf8c509=0x0;_0xf8c509<_0x20d462[_0xe630('0x3b')];_0xf8c509+=0x1){_0x36ba2c[_0xe630('0x43')](_0xe630('0x4d'),{'WhatsappInteractionId':Number(_0x20d462[_0xf8c509]),'UserId':Number(_0x5c2ac6['id'])});}});}})['catch'](function(_0x1253e0){_0x426873[_0xe630('0x4e')](_0x1253e0);});}}function onDisconnect(_0x192f1b,_0x612081){joinOrLeave(_0x192f1b,'leave',_0x612081);}function onConnect(_0x443f52){joinOrLeave(_0x443f52,_0xe630('0x4f'));}exports[_0xe630('0x50')]=function(_0x5a86c5){_0x5a86c5['on'](_0xe630('0x51'),function(_0xb1637c){_0xb1637c[_0xe630('0x52')](0x0);_0xb1637c['address']=_0xb1637c['request'][_0xe630('0x51')][_0xe630('0x53')]+':'+_0xb1637c[_0xe630('0x54')]['connection'][_0xe630('0x55')];_0xb1637c['connectedAt']=new Date();_0xb1637c[_0xe630('0x4e')]=function(_0x3f36a1){console[_0xe630('0x4e')](_0xe630('0x56')+_0xb1637c[_0xe630('0x57')][_0xe630('0x2')]+'['+_0xb1637c[_0xe630('0x58')]+']',_0x3f36a1);};_0xb1637c['on'](_0xe630('0x59'),function(){onDisconnect(_0xb1637c,_0x5a86c5);_0xb1637c[_0xe630('0x4e')](_0xe630('0x5a'));});onConnect(_0xb1637c);_0xb1637c[_0xe630('0x4e')](_0xe630('0x5b'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index fc18631..cd07e86 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 _0x795d=['triggers','client','http','Chat','ChatInteraction','afterUpdate','afterCreate','newmessage','Sms','SmsInteraction','newinteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','event','direction','UserId','User','find','name','interface','format','SIP/%s','outgoingmessage','opened','changed','closed','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','../logger'];(function(_0x12a579,_0x47f1a0){var _0x4d2ef2=function(_0x2745dc){while(--_0x2745dc){_0x12a579['push'](_0x12a579['shift']());}};_0x4d2ef2(++_0x47f1a0);}(_0x795d,0xe5));var _0xd795=function(_0x38b149,_0x34ac58){_0x38b149=_0x38b149-0x0;var _0x97edb8=_0x795d[_0x38b149];return _0x97edb8;};'use strict';var util=require(_0xd795('0x0'));var db=require(_0xd795('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0xd795('0x2'))(_0xd795('0x3'));var client=jayson[_0xd795('0x4')][_0xd795('0x5')]({'port':0x232a});var triggers=[{'channel':_0xd795('0x6'),'model':'ChatInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Chat','model':_0xd795('0x7'),'event':_0xd795('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':_0xd795('0x9'),'condition':_0xd795('0xa'),'callback':afterCreateMessage},{'channel':_0xd795('0xb'),'model':_0xd795('0xc'),'event':_0xd795('0x9'),'condition':_0xd795('0xd'),'callback':afterCreate},{'channel':_0xd795('0xb'),'model':'SmsInteraction','event':_0xd795('0x8'),'condition':_0xd795('0xe'),'callback':afterUpdate},{'channel':'Sms','model':_0xd795('0xf'),'event':_0xd795('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xd795('0x10'),'model':_0xd795('0x11'),'event':_0xd795('0x9'),'condition':_0xd795('0xd'),'callback':afterCreate},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0xd795('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xd795('0x10'),'model':_0xd795('0x12'),'event':_0xd795('0x9'),'condition':_0xd795('0xa'),'callback':afterCreateMessage},{'channel':_0xd795('0x13'),'model':'FaxInteraction','event':_0xd795('0x9'),'condition':_0xd795('0xd'),'callback':afterCreate},{'channel':_0xd795('0x13'),'model':'FaxInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xd795('0x13'),'model':_0xd795('0x14'),'event':_0xd795('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xd795('0x15'),'model':_0xd795('0x16'),'event':_0xd795('0x9'),'condition':_0xd795('0xd'),'callback':afterCreate},{'channel':_0xd795('0x15'),'model':_0xd795('0x16'),'event':_0xd795('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xd795('0x15'),'model':_0xd795('0x17'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xd795('0x18'),'model':_0xd795('0x19'),'event':_0xd795('0x9'),'condition':_0xd795('0xd'),'callback':afterCreate},{'channel':'Openchannel','model':_0xd795('0x19'),'event':_0xd795('0x8'),'condition':_0xd795('0xe'),'callback':afterUpdate},{'channel':_0xd795('0x18'),'model':_0xd795('0x1a'),'event':'afterCreate','condition':_0xd795('0xa'),'callback':afterCreateMessage}];function request(_0x404c22){return client[_0xd795('0x1b')](_0xd795('0x1c'),_0x404c22)[_0xd795('0x1d')](function(_0x1cd691){logger[_0xd795('0x1e')](_0xd795('0x1f'),_0xd795('0x1c'),_0x1cd691);if(_0x1cd691[_0xd795('0x20')]){if(_0x1cd691[_0xd795('0x20')][_0xd795('0x21')]===0x1f4){logger['error'](_0xd795('0x1f'),_0xd795('0x1c'),_0x1cd691[_0xd795('0x20')]);}}})[_0xd795('0x22')](function(_0x204a7b){logger[_0xd795('0x20')](_0xd795('0x1f'),_0xd795('0x1c'),_0x204a7b);});}function afterCreateMessage(_0x39f9f2,_0x1903be){return function(_0x6591a,_0x4a5fe6){_0x6591a=_0x6591a[_0xd795('0x23')]({'plain':!![]});_0x6591a[_0xd795('0x24')]=_0x39f9f2;_0x6591a[_0xd795('0x25')]=_0x6591a[_0xd795('0x26')];if(_0x6591a[_0xd795('0x27')]){return db[_0xd795('0x28')][_0xd795('0x29')]({'where':{'id':_0x6591a[_0xd795('0x27')]},'attributes':['id',_0xd795('0x2a')],'raw':!![]})[_0xd795('0x1d')](function(_0x59bfd5){_0x6591a[_0xd795('0x2b')]=util[_0xd795('0x2c')](_0xd795('0x2d'),_0x59bfd5[_0xd795('0x2a')]);_0x6591a['channel']=_0x39f9f2;return request({'event':'incomingmessage','message':_0x6591a});})['catch'](function(_0x589234){console[_0xd795('0x20')](_0x589234);});}else{return request({'event':_0xd795('0x2e'),'message':_0x6591a});}};}function afterCreate(_0x480602,_0x362dea){return function(_0x5e9ece,_0x4b66d3){_0x5e9ece=_0x5e9ece[_0xd795('0x23')]({'plain':!![]});_0x5e9ece[_0xd795('0x24')]=_0x480602;_0x5e9ece[_0xd795('0x25')]=_0xd795('0x2f');return request({'event':_0x362dea,'message':_0x5e9ece});};}function afterUpdate(_0xbd0ed4,_0x3a7ca0){return function(_0x4e4faa,_0x1e4b63){if(_0x4e4faa[_0xd795('0x30')](_0xd795('0x31'))&&_0x4e4faa[_0xd795('0x31')]){_0x4e4faa=_0x4e4faa['get']({'plain':!![]});_0x4e4faa[_0xd795('0x24')]=_0xbd0ed4;_0x4e4faa[_0xd795('0x25')]='closed';if(_0x4e4faa[_0xd795('0x27')]){return db[_0xd795('0x28')][_0xd795('0x29')]({'where':{'id':_0x4e4faa[_0xd795('0x27')]},'attributes':['id','name'],'raw':!![]})['then'](function(_0xe93d46){_0x4e4faa[_0xd795('0x2b')]=util[_0xd795('0x2c')](_0xd795('0x2d'),_0xe93d46['name']);return request({'event':_0x3a7ca0,'message':_0x4e4faa});})['catch'](function(_0x18b611){console[_0xd795('0x20')](_0x18b611);});}else{return request({'event':_0x3a7ca0,'message':_0x4e4faa});}}};}exports[_0xd795('0x32')]=function(){for(var _0x1f41e5=0x0;_0x1f41e5=_0x3290fd[_0x3f3f('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x4acbfd(_0x3cdc8f);})[_0x3f3f('0x12')](function(_0x111d75){_0x2ded36(_0x111d75);});});}; \ No newline at end of file +var _0xdc19=['../mysqldb','voice','mail','chat','fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','includes','isUndefined','updateAttributes','getLicense','User','agent','then','agents','catch','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdc19,0x1cb));var _0x9dc1=function(_0x2bb7c6,_0x4c9352){_0x2bb7c6=_0x2bb7c6-0x0;var _0x56a8ab=_0xdc19[_0x2bb7c6];return _0x56a8ab;};'use strict';var _=require('lodash');var BPromise=require(_0x9dc1('0x0'));var db=require(_0x9dc1('0x1'))['db'];var util=require('./license/util');var channels=[_0x9dc1('0x2'),_0x9dc1('0x3'),_0x9dc1('0x4'),_0x9dc1('0x5'),_0x9dc1('0x6'),'whatsapp',_0x9dc1('0x7')];exports[_0x9dc1('0x8')]=function(){return channels;};exports[_0x9dc1('0x9')]=function(_0x8a782e){_0x8a782e=_0x8a782e[_0x9dc1('0xa')]();return _[_0x9dc1('0xb')](channels,_0x8a782e);};exports['clearBlockUser']=function(_0x49805f,_0x2f5862,_0x552fbb,_0x25183f){var _0x3dee02={'loginAttempts':_0x2f5862,'blocked':_0x552fbb};if(!_[_0x9dc1('0xc')](_0x25183f)){_0x3dee02['blockedAt']=_0x25183f;}return _0x49805f[_0x9dc1('0xd')](_0x3dee02);};exports[_0x9dc1('0xe')]=function(_0x5dd3fc){return new BPromise(function(_0x565ca7,_0x1d356a){var _0x19c15e=0x0;if(_0x5dd3fc['role']!=='agent'){_0x565ca7(_0x5dd3fc);}db[_0x9dc1('0xf')]['count']({'where':{'role':_0x9dc1('0x10'),'online':!![],'id':{'$ne':_0x5dd3fc['id']}}})[_0x9dc1('0x11')](function(_0x1268be){_0x19c15e=_0x1268be;return util[_0x9dc1('0xe')]();})['then'](function(_0x351af5){if(_0x351af5&&_0x351af5[_0x9dc1('0x12')]&&_0x19c15e>=_0x351af5[_0x9dc1('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x565ca7(_0x5dd3fc);})[_0x9dc1('0x13')](function(_0x5150bc){_0x1d356a(_0x5150bc);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 84d9abb..2fc68f2 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe477=['render','json','exports','404','status'];(function(_0x5604a4,_0x31a3d8){var _0x1d132c=function(_0x4b6f92){while(--_0x4b6f92){_0x5604a4['push'](_0x5604a4['shift']());}};_0x1d132c(++_0x31a3d8);}(_0xe477,0x6b));var _0x7e47=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0xe477[_0x470f63];return _0x4f09e2;};'use strict';module[_0x7e47('0x0')][0x194]=function pageNotFound(_0x3e25f3,_0x1dc859){var _0x1695cd=_0x7e47('0x1');var _0x364a9c=0x194;var _0x22d349={'status':_0x364a9c};_0x1dc859[_0x7e47('0x2')](_0x22d349[_0x7e47('0x2')]);_0x1dc859[_0x7e47('0x3')](_0x1695cd,{},function(_0x446232,_0x3a60a8){if(_0x446232){return _0x1dc859['status'](_0x22d349[_0x7e47('0x2')])[_0x7e47('0x4')](_0x22d349);}_0x1dc859['send'](_0x3a60a8);});}; \ No newline at end of file +var _0x64b4=['render','send','exports','status'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x64b4,0xbe));var _0x464b=function(_0x496c48,_0x278268){_0x496c48=_0x496c48-0x0;var _0x524034=_0x64b4[_0x496c48];return _0x524034;};'use strict';module[_0x464b('0x0')][0x194]=function pageNotFound(_0x152fad,_0x5c4f20){var _0x41f5a1='404';var _0x348517=0x194;var _0x509a33={'status':_0x348517};_0x5c4f20[_0x464b('0x1')](_0x509a33[_0x464b('0x1')]);_0x5c4f20[_0x464b('0x2')](_0x41f5a1,{},function(_0x4d0d8a,_0x2fe8f4){if(_0x4d0d8a){return _0x5c4f20['status'](_0x509a33[_0x464b('0x1')])['json'](_0x509a33);}_0x5c4f20[_0x464b('0x3')](_0x2fe8f4);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index f007c46..39fda6f 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaab2=['user_has_openchannel_interactions','VoiceQueues','MailQueues','ChatQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','user_has_chat_websites','FaxAccount','FaxAccounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','UserVoiceQueueRt','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','MailAccountId','hasOne','Imap','Dispositions','Answers','MailMessage','Interactions','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','restrict','List','FaxAccountId','Exntensions','FaxMessage','Messages','user_has_fax_accounts','TagId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','UserChatQueue','team_has_chat_queues','ChatGroupId','ChatGroup','Contacts','CmHopper','Company','CompanyId','cm_contact_has_tags','CampaignId','CmHopperBlack','All','OneAll','OneAny','Action','AutomationId','Intervals','MailApplications','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyConditions','Actions','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','SalesforceConfiguration','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmConfiguration','Descriptions','int_desk_configuration_has_tags','ZohoField','int_zendesk_configuration_has_tags','VtigerField','ServicenowConfiguration','ServicenowField','ServicenowAccount','Dynamics365Configuration','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyProject','ProjectId','user_has_teams','team_has_sms_queues','team_has_whatsapp_queues','campaigns_has_cm_lists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToAccount','FromChatWebsiteId','FromAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','UserProfileSection','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappQueueReport','WhatsappTransferReport','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','determine','defaultsDeep','motion2','xC@LL1234','mysql','utf8mb4','name','utf8','sequelizeHistory','xcall','utf8_general_ci','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','MailServerIn','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../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','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','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','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileSection/userProfileSection.model','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','cascade','hasMany','VoiceQueuesRt','UserId','Extensions','HopperFinals','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','WhatsappInteractions','Notification','Notifications','SenderId','belongsTo','userProfileId','belongsToMany','chat_group_has_users','cm_user_has_contacts','MailInteractions','user_has_mail_interactions','user_has_fax_interactions','SmsInteraction','user_has_sms_interactions'];(function(_0x4a15d9,_0x5ed229){var _0x175cb7=function(_0x240285){while(--_0x240285){_0x4a15d9['push'](_0x4a15d9['shift']());}};_0x175cb7(++_0x5ed229);}(_0xaab2,0xca));var _0x2aab=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xaab2[_0x2d7f0e];return _0x110b07;};'use strict';var path=require('path');var config=require(_0x2aab('0x0'));var Sequelize=require(_0x2aab('0x1'));var _=require(_0x2aab('0x2'));var jstz=require('jstz');var timezone=jstz[_0x2aab('0x3')]();config[_0x2aab('0x1')]=_[_0x2aab('0x4')](config[_0x2aab('0x1')],{'database':_0x2aab('0x5'),'username':'xcall','password':_0x2aab('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x2aab('0x7'),'dialectOptions':{'charset':_0x2aab('0x8')},'logging':![],'timezone':timezone[_0x2aab('0x9')](),'define':{'charset':_0x2aab('0xa'),'collate':'utf8_general_ci'}}});config[_0x2aab('0xb')]=_[_0x2aab('0x4')](config[_0x2aab('0xb')],{'database':_0x2aab('0x5'),'username':_0x2aab('0xc'),'password':_0x2aab('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x2aab('0x8')},'logging':![],'timezone':timezone[_0x2aab('0x9')](),'define':{'charset':'utf8','collate':_0x2aab('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2aab('0x1')][_0x2aab('0xe')],config['sequelize'][_0x2aab('0xf')],config[_0x2aab('0x1')][_0x2aab('0x10')],config[_0x2aab('0x1')][_0x2aab('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2aab('0xb')]['database'],config['sequelizeHistory'][_0x2aab('0xf')],config['sequelizeHistory']['password'],config[_0x2aab('0xb')][_0x2aab('0x11')])};db[_0x2aab('0x12')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x14'));db[_0x2aab('0x15')]=db[_0x2aab('0x1')]['import'](_0x2aab('0x16'));db[_0x2aab('0x17')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x18'));db[_0x2aab('0x19')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x1a'));db[_0x2aab('0x1b')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x1c'));db[_0x2aab('0x1d')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x1e'));db[_0x2aab('0x1f')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0x2aab('0x20')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/screenRecording/screenRecording.model');db[_0x2aab('0x21')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x22'));db[_0x2aab('0x23')]=db['sequelize'][_0x2aab('0x13')](_0x2aab('0x24'));db[_0x2aab('0x25')]=db[_0x2aab('0x1')]['import'](_0x2aab('0x26'));db[_0x2aab('0x27')]=db['sequelize'][_0x2aab('0x13')](_0x2aab('0x28'));db[_0x2aab('0x29')]=db[_0x2aab('0x1')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db[_0x2aab('0x2a')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x2b'));db[_0x2aab('0x2c')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x2d'));db[_0x2aab('0x2e')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/trunk/trunk.model');db[_0x2aab('0x2f')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x30'));db['UserVoiceQueueRt']=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x31'));db[_0x2aab('0x32')]=db[_0x2aab('0x1')]['import'](_0x2aab('0x33'));db['UserChatQueue']=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x34'));db[_0x2aab('0x35')]=db['sequelize'][_0x2aab('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0x2aab('0x36')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x37'));db[_0x2aab('0x38')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x39'));db[_0x2aab('0x3a')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x2aab('0x3b')]=db[_0x2aab('0x1')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x2aab('0x3c')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x3d'));db['MailAccount']=db['sequelize']['import'](_0x2aab('0x3e'));db[_0x2aab('0x3f')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x40'));db[_0x2aab('0x41')]=db['sequelize']['import'](_0x2aab('0x42'));db['MailInteraction']=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x43'));db['MailMessage']=db[_0x2aab('0x1')]['import'](_0x2aab('0x44'));db[_0x2aab('0x45')]=db['sequelize']['import'](_0x2aab('0x46'));db[_0x2aab('0x47')]=db[_0x2aab('0x1')]['import'](_0x2aab('0x48'));db[_0x2aab('0x49')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x4a'));db[_0x2aab('0x4b')]=db['sequelize'][_0x2aab('0x13')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/faxAccount/faxAccount.model');db[_0x2aab('0x4c')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/faxApplication/faxApplication.model');db[_0x2aab('0x4d')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x4e'));db['FaxMessage']=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x4f'));db[_0x2aab('0x50')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x51'));db[_0x2aab('0x52')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/faxQueueReport/faxQueueReport.model');db[_0x2aab('0x53')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/smsAccount/smsAccount.model');db[_0x2aab('0x54')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x55'));db['SmsInteraction']=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x56'));db[_0x2aab('0x57')]=db[_0x2aab('0x1')]['import']('../api/smsMessage/smsMessage.model');db[_0x2aab('0x58')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/smsQueue/smsQueue.model');db[_0x2aab('0x59')]=db[_0x2aab('0x1')]['import'](_0x2aab('0x5a'));db['OpenchannelApplication']=db['sequelize']['import'](_0x2aab('0x5b'));db[_0x2aab('0x5c')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x5d'));db[_0x2aab('0x5e')]=db[_0x2aab('0x1')]['import'](_0x2aab('0x5f'));db[_0x2aab('0x60')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x61'));db[_0x2aab('0x62')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x63'));db[_0x2aab('0x64')]=db['sequelize'][_0x2aab('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x2aab('0x65')]=db['sequelize']['import'](_0x2aab('0x66'));db['ChatInteraction']=db['sequelize'][_0x2aab('0x13')](_0x2aab('0x67'));db[_0x2aab('0x68')]=db[_0x2aab('0x1')]['import'](_0x2aab('0x69'));db[_0x2aab('0x6a')]=db[_0x2aab('0x1')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0x2aab('0x1')]['import']('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x6b'));db[_0x2aab('0x6c')]=db['sequelize'][_0x2aab('0x13')](_0x2aab('0x6d'));db['CmCompany']=db['sequelize'][_0x2aab('0x13')]('../api/cmCompany/cmCompany.model');db[_0x2aab('0x6e')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/cmContact/cmContact.model');db['CmHopper']=db['sequelize']['import'](_0x2aab('0x6f'));db['CmHopperBlack']=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x70'));db[_0x2aab('0x71')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x72'));db[_0x2aab('0x73')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x74'));db[_0x2aab('0x75')]=db[_0x2aab('0x1')]['import'](_0x2aab('0x76'));db[_0x2aab('0x77')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x78'));db['Action']=db[_0x2aab('0x1')]['import'](_0x2aab('0x79'));db[_0x2aab('0x7a')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x7b'));db[_0x2aab('0x7c')]=db['sequelize'][_0x2aab('0x13')](_0x2aab('0x7d'));db[_0x2aab('0x7e')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x7f'));db[_0x2aab('0x80')]=db['sequelize'][_0x2aab('0x13')](_0x2aab('0x81'));db[_0x2aab('0x82')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x83'));db['Pause']=db[_0x2aab('0x1')]['import'](_0x2aab('0x84'));db[_0x2aab('0x85')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x86'));db[_0x2aab('0x87')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x88'));db[_0x2aab('0x89')]=db['sequelize'][_0x2aab('0x13')](_0x2aab('0x8a'));db[_0x2aab('0x8b')]=db['sequelize'][_0x2aab('0x13')](_0x2aab('0x8c'));db[_0x2aab('0x8d')]=db[_0x2aab('0x1')]['import'](_0x2aab('0x8e'));db[_0x2aab('0x8f')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/template/template.model');db[_0x2aab('0x90')]=db[_0x2aab('0x1')]['import'](_0x2aab('0x91'));db[_0x2aab('0x92')]=db['sequelize']['import'](_0x2aab('0x93'));db[_0x2aab('0x94')]=db['sequelize']['import']('../api/integration/integration.model');db['IntegrationReport']=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/integrationReport/integrationReport.model');db[_0x2aab('0x95')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x96'));db[_0x2aab('0x97')]=db[_0x2aab('0x1')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x2aab('0x98')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x99'));db[_0x2aab('0x9a')]=db['sequelize'][_0x2aab('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0x2aab('0x9b')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x2aab('0x9c')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x9d'));db[_0x2aab('0x9e')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0x2aab('0x1')]['import'](_0x2aab('0x9f'));db[_0x2aab('0xa0')]=db[_0x2aab('0x1')]['import'](_0x2aab('0xa1'));db[_0x2aab('0xa2')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xa3'));db['SugarcrmConfiguration']=db[_0x2aab('0x1')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x2aab('0xa4')]=db['sequelize'][_0x2aab('0x13')](_0x2aab('0xa5'));db[_0x2aab('0xa6')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xa7'));db[_0x2aab('0xa8')]=db['sequelize']['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x2aab('0xa9')]=db['sequelize'][_0x2aab('0x13')]('../api/intDeskField/intDeskField.model');db[_0x2aab('0xaa')]=db[_0x2aab('0x1')]['import'](_0x2aab('0xab'));db[_0x2aab('0xac')]=db['sequelize'][_0x2aab('0x13')](_0x2aab('0xad'));db['ZohoField']=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/intZohoField/intZohoField.model');db[_0x2aab('0xae')]=db['sequelize']['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0x2aab('0xaf')]=db[_0x2aab('0x1')]['import'](_0x2aab('0xb0'));db[_0x2aab('0xb1')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0x2aab('0xb2')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xb3'));db[_0x2aab('0xb4')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x2aab('0xb5')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xb6'));db[_0x2aab('0xb7')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x2aab('0xb8')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xb9'));db['VtigerField']=db['sequelize'][_0x2aab('0x13')](_0x2aab('0xba'));db['ServicenowAccount']=db['sequelize'][_0x2aab('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xbb'));db['ServicenowField']=db['sequelize'][_0x2aab('0x13')]('../api/intServicenowField/intServicenowField.model');db[_0x2aab('0xbc')]=db[_0x2aab('0x1')]['import']('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xbd'));db[_0x2aab('0xbe')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xbf'));db[_0x2aab('0xc0')]=db['sequelize'][_0x2aab('0x13')](_0x2aab('0xc1'));db[_0x2aab('0xc2')]=db['sequelize'][_0x2aab('0x13')](_0x2aab('0xc3'));db[_0x2aab('0xc4')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x2aab('0x94')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/integration/integration.model');db[_0x2aab('0xc5')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xc6'));db[_0x2aab('0xc7')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xc8'));db[_0x2aab('0xc9')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xca'));db[_0x2aab('0xcb')]=db['sequelize']['import'](_0x2aab('0xcc'));db['JscriptyQuestionReport']=db[_0x2aab('0x1')]['import'](_0x2aab('0xcd'));db[_0x2aab('0xce')]=db['sequelize'][_0x2aab('0x13')](_0x2aab('0xcf'));db[_0x2aab('0xd0')]=db[_0x2aab('0x1')]['import'](_0x2aab('0xd1'));db[_0x2aab('0xd2')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/squareReport/squareReport.model');db[_0x2aab('0xd3')]=db[_0x2aab('0x1')]['import']('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db['sequelize']['import'](_0x2aab('0xd4'));db[_0x2aab('0xd5')]=db['sequelize'][_0x2aab('0x13')](_0x2aab('0xd6'));db[_0x2aab('0xd7')]=db[_0x2aab('0x1')]['import'](_0x2aab('0xd8'));db[_0x2aab('0xd9')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xda'));db[_0x2aab('0xdb')]=db[_0x2aab('0x1')]['import'](_0x2aab('0xdc'));db[_0x2aab('0xdd')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/squareMessage/squareMessage.model');db[_0x2aab('0xde')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xdf'));db[_0x2aab('0xe0')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xe1'));db[_0x2aab('0xe2')]=db['sequelize']['import'](_0x2aab('0xe3'));db[_0x2aab('0xe4')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xe5'));db[_0x2aab('0xe6')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xe7'));db['Plugin']=db[_0x2aab('0x1')]['import']('../api/plugin/plugin.model');db[_0x2aab('0xe8')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xe9'));db[_0x2aab('0xea')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xeb'));db['FaxTransferReport']=db[_0x2aab('0x1')]['import'](_0x2aab('0xec'));db['OpenchannelTransferReport']=db['sequelize']['import'](_0x2aab('0xed'));db[_0x2aab('0xee')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xef'));db[_0x2aab('0xf0')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xf1'));db[_0x2aab('0xf2')]=db[_0x2aab('0x1')]['import'](_0x2aab('0xf3'));db[_0x2aab('0xf4')]=db[_0x2aab('0x1')]['import']('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xf5'));db['UserProfileResource']=db['sequelize'][_0x2aab('0x13')]('../api/userProfileResource/userProfileResource.model');db['Notification']=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xf6'));db[_0x2aab('0xf7')]=db['sequelize']['import'](_0x2aab('0xf8'));db[_0x2aab('0xf9')]=db[_0x2aab('0x1')]['import'](_0x2aab('0xfa'));db[_0x2aab('0xfb')]=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db['sequelize'][_0x2aab('0x13')](_0x2aab('0xfc'));db['WhatsappQueueReport']=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0xfd'));db['WhatsappTransferReport']=db[_0x2aab('0x1')]['import'](_0x2aab('0xfe'));db[_0x2aab('0xff')]=db[_0x2aab('0x1')][_0x2aab('0x13')](_0x2aab('0x100'));db['CloudProvider']=db[_0x2aab('0x1')][_0x2aab('0x13')]('../api/cloudProvider/cloudProvider.model');db['User']['hasOne'](db['VoiceMail'],{'as':_0x2aab('0x21'),'onDelete':_0x2aab('0x101'),'foreignKey':'UserId'});db[_0x2aab('0x12')][_0x2aab('0x102')](db['VoiceRecording'],{'as':'Recordings','foreignKey':'UserId'});db['User'][_0x2aab('0x102')](db['UserVoiceQueueRt'],{'as':_0x2aab('0x103'),'foreignKey':_0x2aab('0x104')});db['User'][_0x2aab('0x102')](db[_0x2aab('0x19')],{'as':_0x2aab('0x105'),'onDelete':_0x2aab('0x101'),'hooks':!![]});db['User']['hasMany'](db['CmHopperFinal'],{'as':_0x2aab('0x106'),'foreignKey':_0x2aab('0x104')});db['User'][_0x2aab('0x102')](db[_0x2aab('0x73')],{'as':'HopperHistory','foreignKey':_0x2aab('0x104')});db[_0x2aab('0x12')][_0x2aab('0x102')](db[_0x2aab('0x75')],{'as':'ReportAgentPreview','foreignKey':_0x2aab('0x104')});db[_0x2aab('0x12')][_0x2aab('0x102')](db[_0x2aab('0x5c')],{'as':_0x2aab('0x107'),'foreignKey':_0x2aab('0x104')});db[_0x2aab('0x12')]['hasMany'](db[_0x2aab('0x108')],{'as':_0x2aab('0x109'),'foreignKey':'UserId'});db[_0x2aab('0x12')][_0x2aab('0x102')](db['SmsInteraction'],{'as':_0x2aab('0x10a'),'foreignKey':'UserId'});db[_0x2aab('0x12')][_0x2aab('0x102')](db[_0x2aab('0x4d')],{'as':_0x2aab('0x10b'),'foreignKey':_0x2aab('0x104')});db[_0x2aab('0x12')]['hasMany'](db[_0x2aab('0x10c')],{'as':'MailInteractions','foreignKey':_0x2aab('0x104')});db['User'][_0x2aab('0x102')](db['WhatsappInteraction'],{'as':_0x2aab('0x10d'),'foreignKey':_0x2aab('0x104')});db[_0x2aab('0x12')][_0x2aab('0x102')](db[_0x2aab('0x10e')],{'as':_0x2aab('0x10f'),'foreignKey':_0x2aab('0x110')});db[_0x2aab('0x12')][_0x2aab('0x111')](db[_0x2aab('0xf4')],{'as':_0x2aab('0xf4'),'foreignKey':_0x2aab('0x112')});db[_0x2aab('0x12')][_0x2aab('0x113')](db['ChatGroup'],{'as':'Groups','through':_0x2aab('0x114')});db['User']['belongsToMany'](db[_0x2aab('0x6e')],{'as':'Contacts','through':_0x2aab('0x115')});db[_0x2aab('0x12')][_0x2aab('0x113')](db['CmList'],{'as':'Lists','through':'cm_user_has_lists'});db['User'][_0x2aab('0x113')](db[_0x2aab('0xde')],{'through':'user_has_teams'});db['User']['belongsToMany'](db['MailInteraction'],{'as':_0x2aab('0x116'),'through':_0x2aab('0x117')});db['User'][_0x2aab('0x113')](db['ChatInteraction'],{'as':_0x2aab('0x109'),'through':'user_has_chat_interactions'});db[_0x2aab('0x12')][_0x2aab('0x113')](db['FaxInteraction'],{'as':_0x2aab('0x10b'),'through':_0x2aab('0x118')});db[_0x2aab('0x12')][_0x2aab('0x113')](db[_0x2aab('0x119')],{'as':'SmsInteractions','through':_0x2aab('0x11a')});db['User'][_0x2aab('0x113')](db[_0x2aab('0x5c')],{'as':'OpenchannelInteractions','through':_0x2aab('0x11b')});db['User'][_0x2aab('0x113')](db['WhatsappInteraction'],{'as':_0x2aab('0x10d'),'through':'user_has_whatsapp_interactions'});db[_0x2aab('0x12')]['belongsToMany'](db['VoiceQueue'],{'as':_0x2aab('0x11c'),'through':_0x2aab('0x32'),'required':![]});db[_0x2aab('0x12')][_0x2aab('0x113')](db[_0x2aab('0x3f')],{'as':_0x2aab('0x11d'),'through':_0x2aab('0x35'),'required':![]});db['User'][_0x2aab('0x113')](db[_0x2aab('0x11e')],{'as':_0x2aab('0x11f'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x2aab('0x12')][_0x2aab('0x113')](db['FaxQueue'],{'as':_0x2aab('0x120'),'through':_0x2aab('0x36'),'required':![]});db[_0x2aab('0x12')][_0x2aab('0x113')](db[_0x2aab('0x58')],{'as':_0x2aab('0x121'),'through':_0x2aab('0x38'),'required':![]});db[_0x2aab('0x12')][_0x2aab('0x113')](db[_0x2aab('0x60')],{'as':_0x2aab('0x122'),'through':_0x2aab('0x3a'),'required':![]});db[_0x2aab('0x12')]['belongsToMany'](db['WhatsappQueue'],{'as':_0x2aab('0x123'),'through':'UserWhatsappQueue','required':![]});db['User'][_0x2aab('0x113')](db[_0x2aab('0xf0')],{'through':_0x2aab('0x124')});db[_0x2aab('0x12')][_0x2aab('0x113')](db['VoicePrefix'],{'as':_0x2aab('0x125'),'through':_0x2aab('0x126'),'required':![]});db[_0x2aab('0x12')][_0x2aab('0x113')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0x2aab('0x127')});db[_0x2aab('0x12')][_0x2aab('0x113')](db[_0x2aab('0x128')],{'as':_0x2aab('0x129'),'through':'user_has_fax_accounts'});db[_0x2aab('0x12')][_0x2aab('0x113')](db[_0x2aab('0x12a')],{'as':_0x2aab('0x12b'),'through':_0x2aab('0x12c')});db[_0x2aab('0x12')][_0x2aab('0x113')](db[_0x2aab('0x59')],{'as':_0x2aab('0x12d'),'through':_0x2aab('0x12e')});db['User']['belongsToMany'](db[_0x2aab('0x53')],{'as':_0x2aab('0x12f'),'through':_0x2aab('0x130')});db[_0x2aab('0x12')]['belongsToMany'](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0x2aab('0x131')});db[_0x2aab('0x12')]['belongsToMany'](db['SquareProject'],{'as':'SquareProjects','through':'user_has_square_projects'});db[_0x2aab('0x15')]['hasMany'](db[_0x2aab('0x19')],{'as':_0x2aab('0x132'),'onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x133')});db[_0x2aab('0x17')]['hasMany'](db[_0x2aab('0x19')],{'onDelete':_0x2aab('0x101')});db[_0x2aab('0x19')][_0x2aab('0x102')](db[_0x2aab('0x19')],{'as':_0x2aab('0x134'),'onDelete':'cascade'});db[_0x2aab('0x1b')][_0x2aab('0x113')](db[_0x2aab('0x8b')],{'as':_0x2aab('0x135'),'through':_0x2aab('0x136')});db[_0x2aab('0x1d')][_0x2aab('0x102')](db[_0x2aab('0x137')],{'as':_0x2aab('0x138'),'foreignKey':_0x2aab('0x139')});db[_0x2aab('0x1d')][_0x2aab('0x102')](db['CmHopper'],{'as':_0x2aab('0x13a'),'foreignKey':'VoiceQueueId'});db[_0x2aab('0x1d')][_0x2aab('0x102')](db['CmHopperFinal'],{'as':_0x2aab('0x106'),'foreignKey':'VoiceQueueId'});db[_0x2aab('0x1d')]['hasMany'](db[_0x2aab('0x73')],{'as':_0x2aab('0x13b'),'foreignKey':_0x2aab('0x139')});db[_0x2aab('0x1d')][_0x2aab('0x102')](db[_0x2aab('0x75')],{'as':_0x2aab('0x75'),'foreignKey':_0x2aab('0x139')});db[_0x2aab('0x1d')]['hasMany'](db['CmHopperBlack'],{'as':_0x2aab('0x13c'),'foreignKey':_0x2aab('0x139')});db['VoiceQueue'][_0x2aab('0x102')](db[_0x2aab('0xce')],{'as':_0x2aab('0x13d'),'foreignKey':_0x2aab('0x139')});db[_0x2aab('0x1d')]['belongsTo'](db[_0x2aab('0x2e')],{'as':_0x2aab('0x2e'),'foreignKey':_0x2aab('0x13e')});db[_0x2aab('0x1d')]['belongsTo'](db[_0x2aab('0x2e')],{'as':_0x2aab('0x13f'),'foreignKey':_0x2aab('0x140')});db[_0x2aab('0x1d')]['belongsTo'](db[_0x2aab('0x82')],{'as':_0x2aab('0x82'),'foreignKey':_0x2aab('0x141')});db[_0x2aab('0x1d')]['belongsTo'](db[_0x2aab('0x142')],{'as':_0x2aab('0x143'),'foreignKey':_0x2aab('0x144')});db[_0x2aab('0x1d')][_0x2aab('0x113')](db[_0x2aab('0xf0')],{'as':_0x2aab('0x145'),'through':_0x2aab('0x146')});db[_0x2aab('0x1d')][_0x2aab('0x113')](db[_0x2aab('0x12')],{'as':_0x2aab('0x147'),'through':_0x2aab('0x32')});db['VoiceQueue'][_0x2aab('0x113')](db[_0x2aab('0xde')],{'as':_0x2aab('0x148'),'through':_0x2aab('0x149')});db['VoiceQueue'][_0x2aab('0x113')](db[_0x2aab('0xf0')],{'as':_0x2aab('0x14a'),'through':_0x2aab('0x14b')});db[_0x2aab('0x1f')]['belongsTo'](db[_0x2aab('0x12')],{'as':_0x2aab('0x12'),'foreignKey':_0x2aab('0x104')});db['ScreenRecording']['belongsTo'](db['User'],{'as':_0x2aab('0x12'),'foreignKey':_0x2aab('0x104')});db[_0x2aab('0x21')][_0x2aab('0x102')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x14c'),'sourceKey':_0x2aab('0x14d')});db[_0x2aab('0x23')]['belongsTo'](db[_0x2aab('0x21')],{'foreignKey':_0x2aab('0x14c'),'targetKey':_0x2aab('0x14d')});db[_0x2aab('0x25')][_0x2aab('0x102')](db[_0x2aab('0x2a')],{'as':_0x2aab('0x14e'),'foreignKey':'uniqueid','constraints':![]});db[_0x2aab('0x25')]['hasMany'](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0x2aab('0x14f'),'constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0x2aab('0x12')],{'as':_0x2aab('0x12'),'foreignKey':_0x2aab('0x104')});db[_0x2aab('0x25')][_0x2aab('0x111')](db[_0x2aab('0x6e')],{'as':_0x2aab('0x150'),'foreignKey':'ContactId'});db[_0x2aab('0x3c')][_0x2aab('0x111')](db[_0x2aab('0x12a')],{'as':_0x2aab('0x12a'),'foreignKey':_0x2aab('0x151')});db['MailServerOut']['belongsTo'](db[_0x2aab('0x12a')],{'as':_0x2aab('0x12a'),'foreignKey':_0x2aab('0x151')});db['MailAccount'][_0x2aab('0x152')](db[_0x2aab('0x3c')],{'as':_0x2aab('0x153'),'onDelete':_0x2aab('0x101')});db[_0x2aab('0x12a')][_0x2aab('0x152')](db['MailServerOut'],{'as':'Smtp','onDelete':'cascade'});db[_0x2aab('0x12a')][_0x2aab('0x102')](db[_0x2aab('0x7e')],{'as':_0x2aab('0x154'),'foreignKey':_0x2aab('0x151')});db[_0x2aab('0x12a')][_0x2aab('0x102')](db['CannedAnswer'],{'as':_0x2aab('0x155'),'foreignKey':_0x2aab('0x151')});db[_0x2aab('0x12a')]['hasMany'](db[_0x2aab('0x156')],{'as':'Messages','foreignKey':_0x2aab('0x151')});db['MailAccount'][_0x2aab('0x102')](db[_0x2aab('0x10c')],{'as':_0x2aab('0x157')});db[_0x2aab('0x12a')][_0x2aab('0x102')](db[_0x2aab('0x45')],{'as':_0x2aab('0x134')});db[_0x2aab('0x12a')][_0x2aab('0x111')](db['CmList'],{'as':'List','foreignKey':_0x2aab('0x158')});db[_0x2aab('0x12a')][_0x2aab('0x111')](db[_0x2aab('0x8f')],{'as':'Template','foreignKey':_0x2aab('0x159')});db[_0x2aab('0x12a')]['belongsTo'](db[_0x2aab('0x142')],{'as':_0x2aab('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2aab('0x12a')]['belongsToMany'](db[_0x2aab('0x12')],{'as':_0x2aab('0x147'),'through':_0x2aab('0x12c')});db[_0x2aab('0x3f')][_0x2aab('0x113')](db['User'],{'as':_0x2aab('0x147'),'through':_0x2aab('0x35')});db[_0x2aab('0x3f')][_0x2aab('0x113')](db[_0x2aab('0xde')],{'through':_0x2aab('0x15a'),'as':_0x2aab('0x148')});db[_0x2aab('0x10c')][_0x2aab('0x102')](db['MailMessage'],{'as':'Messages','onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x15b')});db['MailInteraction'][_0x2aab('0x111')](db[_0x2aab('0x12a')],{'as':_0x2aab('0x15c'),'foreignKey':'MailAccountId'});db['MailInteraction'][_0x2aab('0x111')](db[_0x2aab('0x6e')],{'as':'Contact','foreignKey':_0x2aab('0x15d')});db[_0x2aab('0x10c')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'as':_0x2aab('0x15e'),'foreignKey':_0x2aab('0x104')});db[_0x2aab('0x10c')][_0x2aab('0x113')](db[_0x2aab('0x8d')],{'through':_0x2aab('0x15f'),'as':_0x2aab('0x160')});db['MailInteraction'][_0x2aab('0x113')](db[_0x2aab('0x8d')],{'through':'mail_interaction_has_tags','as':_0x2aab('0x161')});db['MailInteraction']['belongsToMany'](db[_0x2aab('0x12')],{'as':_0x2aab('0x162'),'through':_0x2aab('0x117'),'foreignKey':_0x2aab('0x15b')});db[_0x2aab('0x156')][_0x2aab('0x102')](db[_0x2aab('0xe6')],{'as':_0x2aab('0x163'),'onDelete':_0x2aab('0x101')});db[_0x2aab('0x156')][_0x2aab('0x111')](db['User'],{'as':_0x2aab('0x12')});db[_0x2aab('0x156')][_0x2aab('0x111')](db[_0x2aab('0x6e')],{'onDelete':'cascade','as':'Contact'});db[_0x2aab('0x156')]['belongsTo'](db[_0x2aab('0x10c')],{'as':_0x2aab('0x164'),'foreignKey':_0x2aab('0x15b')});db[_0x2aab('0x156')][_0x2aab('0x111')](db[_0x2aab('0x12a')],{'as':_0x2aab('0x15c'),'foreignKey':_0x2aab('0x151')});db[_0x2aab('0x45')][_0x2aab('0x111')](db['User'],{'onDelete':'restrict'});db[_0x2aab('0x45')][_0x2aab('0x111')](db['MailQueue'],{'onDelete':_0x2aab('0x165')});db[_0x2aab('0x45')][_0x2aab('0x111')](db['MailAccount'],{'onDelete':_0x2aab('0x165')});db['MailApplication']['belongsTo'](db[_0x2aab('0x82')],{'onDelete':'restrict','foreignKey':_0x2aab('0x141')});db['MailApplication'][_0x2aab('0x111')](db[_0x2aab('0x8d')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport'][_0x2aab('0x111')](db[_0x2aab('0x12a')],{});db[_0x2aab('0x47')][_0x2aab('0x111')](db[_0x2aab('0xf0')],{'as':_0x2aab('0x166'),'foreignKey':_0x2aab('0x158')});db[_0x2aab('0x47')][_0x2aab('0x111')](db['CmContact'],{'as':'Contact','foreignKey':_0x2aab('0x15d')});db[_0x2aab('0x47')]['belongsTo'](db[_0x2aab('0x10c')],{});db['MailQueueReport'][_0x2aab('0x111')](db[_0x2aab('0x156')],{});db[_0x2aab('0x47')][_0x2aab('0x111')](db[_0x2aab('0x12')],{});db[_0x2aab('0x47')][_0x2aab('0x111')](db[_0x2aab('0x3f')],{});db['Dashboard'][_0x2aab('0x102')](db[_0x2aab('0x4b')],{'as':'Items','onDelete':_0x2aab('0x101')});db[_0x2aab('0x128')][_0x2aab('0x102')](db[_0x2aab('0x7e')],{'as':_0x2aab('0x154'),'foreignKey':_0x2aab('0x167')});db['FaxAccount'][_0x2aab('0x102')](db[_0x2aab('0x7c')],{'as':_0x2aab('0x155'),'foreignKey':_0x2aab('0x167')});db['FaxAccount'][_0x2aab('0x102')](db[_0x2aab('0x4d')],{'as':_0x2aab('0x157')});db[_0x2aab('0x128')][_0x2aab('0x102')](db[_0x2aab('0x4c')],{'as':_0x2aab('0x134')});db[_0x2aab('0x128')]['hasMany'](db[_0x2aab('0x19')],{'as':_0x2aab('0x168'),'onDelete':_0x2aab('0x101')});db[_0x2aab('0x128')]['hasMany'](db[_0x2aab('0x169')],{'as':_0x2aab('0x16a')});db[_0x2aab('0x128')][_0x2aab('0x111')](db[_0x2aab('0x2e')],{'as':_0x2aab('0x2e')});db[_0x2aab('0x128')][_0x2aab('0x111')](db[_0x2aab('0xf0')],{'as':'List','foreignKey':_0x2aab('0x158')});db['FaxAccount'][_0x2aab('0x111')](db[_0x2aab('0x142')],{'as':_0x2aab('0x143'),'foreignKey':_0x2aab('0x144')});db[_0x2aab('0x128')]['belongsToMany'](db[_0x2aab('0x12')],{'as':_0x2aab('0x147'),'through':_0x2aab('0x16b')});db[_0x2aab('0x4c')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'onDelete':'restrict'});db[_0x2aab('0x4c')][_0x2aab('0x111')](db['FaxQueue'],{'onDelete':'restrict'});db['FaxApplication'][_0x2aab('0x111')](db[_0x2aab('0x128')],{'onDelete':_0x2aab('0x165')});db[_0x2aab('0x4c')]['belongsTo'](db[_0x2aab('0x8d')],{'onDelete':_0x2aab('0x165'),'foreignKey':_0x2aab('0x16c')});db['FaxInteraction'][_0x2aab('0x102')](db['FaxMessage'],{'as':_0x2aab('0x16a'),'onDelete':'cascade','foreignKey':_0x2aab('0x16d')});db[_0x2aab('0x4d')]['belongsTo'](db[_0x2aab('0x128')],{'as':_0x2aab('0x15c'),'foreignKey':_0x2aab('0x167')});db[_0x2aab('0x4d')][_0x2aab('0x111')](db[_0x2aab('0x6e')],{'as':_0x2aab('0x150'),'foreignKey':_0x2aab('0x15d')});db[_0x2aab('0x4d')]['belongsTo'](db[_0x2aab('0x12')],{'as':_0x2aab('0x15e'),'foreignKey':'UserId'});db['FaxInteraction'][_0x2aab('0x113')](db[_0x2aab('0x8d')],{'through':_0x2aab('0x16e'),'as':_0x2aab('0x160')});db[_0x2aab('0x4d')][_0x2aab('0x113')](db[_0x2aab('0x8d')],{'through':_0x2aab('0x16e'),'as':_0x2aab('0x161')});db[_0x2aab('0x4d')]['belongsToMany'](db[_0x2aab('0x12')],{'as':_0x2aab('0x162'),'through':'user_has_fax_interactions','foreignKey':_0x2aab('0x16d')});db[_0x2aab('0x169')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'onDelete':_0x2aab('0x101'),'as':_0x2aab('0x12')});db[_0x2aab('0x169')][_0x2aab('0x111')](db[_0x2aab('0x4d')],{'as':'Interaction','foreignKey':_0x2aab('0x16d')});db[_0x2aab('0x169')]['belongsTo'](db[_0x2aab('0x6e')],{'onDelete':_0x2aab('0x101'),'as':_0x2aab('0x150')});db['FaxMessage']['belongsTo'](db[_0x2aab('0xe6')],{'as':'Attachment','foreignKey':_0x2aab('0x16f')});db[_0x2aab('0x169')][_0x2aab('0x111')](db[_0x2aab('0x128')],{'as':_0x2aab('0x15c'),'foreignKey':_0x2aab('0x167')});db['FaxQueue']['belongsToMany'](db[_0x2aab('0x12')],{'as':_0x2aab('0x147'),'through':'UserFaxQueue'});db[_0x2aab('0x50')][_0x2aab('0x113')](db['Team'],{'through':_0x2aab('0x170'),'as':_0x2aab('0x148')});db['FaxQueueReport']['belongsTo'](db[_0x2aab('0x128')],{});db['FaxQueueReport']['belongsTo'](db[_0x2aab('0xf0')],{'as':_0x2aab('0x166'),'foreignKey':_0x2aab('0x158')});db[_0x2aab('0x52')][_0x2aab('0x111')](db['CmContact'],{'as':_0x2aab('0x150'),'foreignKey':_0x2aab('0x15d')});db[_0x2aab('0x52')][_0x2aab('0x111')](db[_0x2aab('0x4d')],{});db[_0x2aab('0x52')][_0x2aab('0x111')](db[_0x2aab('0x169')],{});db[_0x2aab('0x52')][_0x2aab('0x111')](db['User'],{});db[_0x2aab('0x52')][_0x2aab('0x111')](db[_0x2aab('0x50')],{});db[_0x2aab('0x53')][_0x2aab('0x102')](db['Disposition'],{'as':_0x2aab('0x154'),'foreignKey':_0x2aab('0x171')});db[_0x2aab('0x53')][_0x2aab('0x102')](db['CannedAnswer'],{'as':_0x2aab('0x155'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x2aab('0x102')](db[_0x2aab('0x57')],{'as':_0x2aab('0x16a'),'foreignKey':_0x2aab('0x171')});db[_0x2aab('0x53')]['hasMany'](db['SmsInteraction'],{'as':'Interactions'});db['SmsAccount'][_0x2aab('0x102')](db[_0x2aab('0x54')],{'as':'Applications'});db[_0x2aab('0x53')][_0x2aab('0x111')](db[_0x2aab('0xf0')],{'as':'List','foreignKey':_0x2aab('0x158')});db[_0x2aab('0x53')][_0x2aab('0x111')](db['Pause'],{'as':_0x2aab('0x143'),'foreignKey':_0x2aab('0x144')});db['SmsAccount']['belongsToMany'](db[_0x2aab('0x12')],{'as':_0x2aab('0x147'),'through':_0x2aab('0x130')});db[_0x2aab('0x54')]['belongsTo'](db[_0x2aab('0x12')],{'onDelete':_0x2aab('0x165')});db[_0x2aab('0x54')]['belongsTo'](db['SmsQueue'],{'onDelete':_0x2aab('0x165')});db[_0x2aab('0x54')][_0x2aab('0x111')](db[_0x2aab('0x53')],{'onDelete':'restrict'});db[_0x2aab('0x54')]['belongsTo'](db[_0x2aab('0x82')],{'onDelete':'restrict','foreignKey':_0x2aab('0x141')});db[_0x2aab('0x54')][_0x2aab('0x111')](db[_0x2aab('0x8d')],{'onDelete':'restrict','foreignKey':_0x2aab('0x16c')});db[_0x2aab('0x119')]['hasMany'](db[_0x2aab('0x57')],{'as':'Messages','onDelete':_0x2aab('0x101'),'foreignKey':'SmsInteractionId'});db[_0x2aab('0x119')][_0x2aab('0x111')](db[_0x2aab('0x53')],{'as':_0x2aab('0x15c'),'foreignKey':_0x2aab('0x171')});db[_0x2aab('0x119')]['belongsTo'](db[_0x2aab('0x6e')],{'as':_0x2aab('0x150'),'foreignKey':_0x2aab('0x15d')});db['SmsInteraction']['belongsTo'](db[_0x2aab('0x12')],{'as':_0x2aab('0x15e'),'foreignKey':'UserId'});db[_0x2aab('0x119')][_0x2aab('0x113')](db[_0x2aab('0x8d')],{'through':'sms_interaction_has_tags','as':_0x2aab('0x160')});db[_0x2aab('0x119')]['belongsToMany'](db['Tag'],{'through':_0x2aab('0x172'),'as':'ThroughTags'});db[_0x2aab('0x119')][_0x2aab('0x113')](db[_0x2aab('0x12')],{'as':_0x2aab('0x162'),'through':_0x2aab('0x11a'),'foreignKey':_0x2aab('0x173')});db[_0x2aab('0x57')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'as':_0x2aab('0x12')});db[_0x2aab('0x57')][_0x2aab('0x111')](db[_0x2aab('0x6e')],{'onDelete':_0x2aab('0x101'),'as':_0x2aab('0x150')});db[_0x2aab('0x57')][_0x2aab('0x111')](db[_0x2aab('0x119')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x2aab('0x173')});db['SmsMessage'][_0x2aab('0x111')](db['SmsAccount'],{'as':'Account','foreignKey':_0x2aab('0x171')});db[_0x2aab('0x58')][_0x2aab('0x113')](db[_0x2aab('0x12')],{'as':_0x2aab('0x147'),'through':_0x2aab('0x38'),'foreignKey':_0x2aab('0x174')});db[_0x2aab('0x58')][_0x2aab('0x113')](db[_0x2aab('0xde')],{'through':'team_has_sms_queues','as':_0x2aab('0x148')});db[_0x2aab('0x59')][_0x2aab('0x102')](db[_0x2aab('0x7e')],{'as':_0x2aab('0x154'),'foreignKey':_0x2aab('0x175')});db[_0x2aab('0x59')][_0x2aab('0x102')](db['CannedAnswer'],{'as':_0x2aab('0x155'),'foreignKey':_0x2aab('0x175')});db['OpenchannelAccount'][_0x2aab('0x102')](db['OpenchannelInteraction'],{'as':_0x2aab('0x157'),'foreignKey':_0x2aab('0x175')});db[_0x2aab('0x59')][_0x2aab('0x102')](db[_0x2aab('0x5e')],{'as':_0x2aab('0x16a'),'foreignKey':_0x2aab('0x175')});db[_0x2aab('0x59')]['hasMany'](db[_0x2aab('0x176')],{'as':'Applications','foreignKey':_0x2aab('0x175')});db['OpenchannelAccount'][_0x2aab('0x111')](db['CmList'],{'as':_0x2aab('0x166'),'foreignKey':_0x2aab('0x158')});db[_0x2aab('0x59')][_0x2aab('0x111')](db[_0x2aab('0x142')],{'as':_0x2aab('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount']['belongsToMany'](db['User'],{'as':_0x2aab('0x147'),'through':_0x2aab('0x12e')});db[_0x2aab('0x176')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'onDelete':'restrict'});db[_0x2aab('0x176')][_0x2aab('0x111')](db[_0x2aab('0x60')],{'onDelete':_0x2aab('0x165'),'foreignKey':_0x2aab('0x177')});db['OpenchannelApplication'][_0x2aab('0x111')](db[_0x2aab('0x59')],{'onDelete':_0x2aab('0x165'),'foreignKey':_0x2aab('0x175')});db[_0x2aab('0x176')][_0x2aab('0x111')](db[_0x2aab('0x82')],{'onDelete':_0x2aab('0x165'),'foreignKey':_0x2aab('0x141')});db[_0x2aab('0x176')][_0x2aab('0x111')](db[_0x2aab('0x8d')],{'onDelete':_0x2aab('0x165'),'foreignKey':_0x2aab('0x16c')});db[_0x2aab('0x5c')]['hasMany'](db['OpenchannelMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x2aab('0x178')});db['OpenchannelInteraction'][_0x2aab('0x111')](db[_0x2aab('0x59')],{'as':_0x2aab('0x15c'),'foreignKey':_0x2aab('0x175')});db[_0x2aab('0x5c')][_0x2aab('0x111')](db['CmContact'],{'as':_0x2aab('0x150'),'foreignKey':_0x2aab('0x15d')});db['OpenchannelInteraction'][_0x2aab('0x111')](db[_0x2aab('0x12')],{'as':_0x2aab('0x15e'),'foreignKey':_0x2aab('0x104')});db['OpenchannelInteraction'][_0x2aab('0x113')](db[_0x2aab('0x8d')],{'through':_0x2aab('0x179'),'as':'Tags'});db[_0x2aab('0x5c')][_0x2aab('0x113')](db[_0x2aab('0x8d')],{'through':_0x2aab('0x179'),'as':'ThroughTags'});db[_0x2aab('0x5c')][_0x2aab('0x113')](db[_0x2aab('0x12')],{'as':'Users','through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x2aab('0x5e')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'onDelete':'cascade','as':_0x2aab('0x12')});db[_0x2aab('0x5e')][_0x2aab('0x111')](db['CmContact'],{'onDelete':_0x2aab('0x101'),'as':_0x2aab('0x150')});db[_0x2aab('0x5e')]['belongsTo'](db[_0x2aab('0x5c')],{'onDelete':_0x2aab('0x101'),'as':_0x2aab('0x164'),'foreignKey':'OpenchannelInteractionId'});db[_0x2aab('0x5e')]['belongsTo'](db[_0x2aab('0xe6')],{'as':_0x2aab('0xe6'),'foreignKey':_0x2aab('0x16f')});db[_0x2aab('0x5e')]['belongsTo'](db[_0x2aab('0x59')],{'as':_0x2aab('0x15c'),'foreignKey':'OpenchannelAccountId'});db[_0x2aab('0x60')][_0x2aab('0x113')](db[_0x2aab('0x12')],{'as':_0x2aab('0x147'),'through':_0x2aab('0x3a'),'foreignKey':_0x2aab('0x177')});db['OpenchannelQueue']['belongsToMany'](db['Team'],{'through':_0x2aab('0x17a'),'as':'Teams'});db[_0x2aab('0x62')][_0x2aab('0x102')](db[_0x2aab('0x7e')],{'as':_0x2aab('0x154'),'foreignKey':_0x2aab('0x17b')});db['ChatWebsite'][_0x2aab('0x102')](db[_0x2aab('0x7c')],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0x2aab('0x62')][_0x2aab('0x102')](db[_0x2aab('0x6c')],{'as':_0x2aab('0x17c')});db[_0x2aab('0x62')][_0x2aab('0x102')](db[_0x2aab('0x108')],{'as':_0x2aab('0x157')});db[_0x2aab('0x62')][_0x2aab('0x102')](db[_0x2aab('0x65')],{'as':'Applications'});db[_0x2aab('0x62')][_0x2aab('0x102')](db['ChatMessage'],{'as':_0x2aab('0x16a')});db['ChatWebsite'][_0x2aab('0x111')](db[_0x2aab('0xf0')],{'as':_0x2aab('0x166'),'foreignKey':_0x2aab('0x158')});db[_0x2aab('0x62')][_0x2aab('0x111')](db[_0x2aab('0x82')],{'as':_0x2aab('0x82'),'foreignKey':_0x2aab('0x141')});db[_0x2aab('0x62')]['belongsTo'](db['Pause'],{'as':_0x2aab('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0x2aab('0x113')](db[_0x2aab('0x12')],{'as':_0x2aab('0x147'),'through':_0x2aab('0x127')});db['OpenchannelQueueReport']['belongsTo'](db[_0x2aab('0x59')],{});db['OpenchannelQueueReport'][_0x2aab('0x111')](db[_0x2aab('0xf0')],{'as':_0x2aab('0x166'),'foreignKey':_0x2aab('0x158')});db[_0x2aab('0x64')][_0x2aab('0x111')](db['CmContact'],{'as':_0x2aab('0x150'),'foreignKey':_0x2aab('0x15d')});db[_0x2aab('0x64')][_0x2aab('0x111')](db[_0x2aab('0x5c')],{});db[_0x2aab('0x64')]['belongsTo'](db[_0x2aab('0x5e')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x2aab('0x12')],{});db[_0x2aab('0x64')][_0x2aab('0x111')](db[_0x2aab('0x60')],{});db[_0x2aab('0x65')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'as':_0x2aab('0x17d'),'foreignKey':_0x2aab('0x104'),'onDelete':_0x2aab('0x165')});db[_0x2aab('0x65')][_0x2aab('0x111')](db['ChatQueue'],{'as':_0x2aab('0x17e'),'foreignKey':'ChatQueueId','onDelete':_0x2aab('0x165')});db[_0x2aab('0x65')][_0x2aab('0x111')](db[_0x2aab('0x62')],{'as':_0x2aab('0x17f'),'foreignKey':'ChatWebsiteId','onDelete':_0x2aab('0x165')});db['ChatApplication']['belongsTo'](db[_0x2aab('0x8d')],{'onDelete':_0x2aab('0x165'),'foreignKey':_0x2aab('0x16c')});db[_0x2aab('0x108')][_0x2aab('0x102')](db[_0x2aab('0x68')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x2aab('0x180')});db[_0x2aab('0x108')]['belongsTo'](db[_0x2aab('0x62')],{'as':_0x2aab('0x15c'),'foreignKey':_0x2aab('0x17b')});db['ChatInteraction']['belongsTo'](db['CmContact'],{'as':_0x2aab('0x150'),'foreignKey':_0x2aab('0x15d')});db[_0x2aab('0x108')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'as':_0x2aab('0x15e'),'foreignKey':'UserId'});db[_0x2aab('0x108')]['belongsToMany'](db['Tag'],{'through':_0x2aab('0x181'),'as':_0x2aab('0x160')});db[_0x2aab('0x108')][_0x2aab('0x113')](db[_0x2aab('0x8d')],{'through':_0x2aab('0x181'),'as':'ThroughTags'});db[_0x2aab('0x108')]['belongsToMany'](db[_0x2aab('0x12')],{'as':_0x2aab('0x162'),'through':_0x2aab('0x182'),'foreignKey':_0x2aab('0x180')});db[_0x2aab('0x68')]['belongsTo'](db[_0x2aab('0x12')],{'onDelete':_0x2aab('0x101'),'as':'User'});db['ChatMessage'][_0x2aab('0x111')](db[_0x2aab('0x6e')],{'onDelete':_0x2aab('0x101'),'as':_0x2aab('0x150'),'foreignKey':_0x2aab('0x15d')});db[_0x2aab('0x68')][_0x2aab('0x111')](db[_0x2aab('0x108')],{'onDelete':_0x2aab('0x101'),'as':_0x2aab('0x164'),'foreignKey':_0x2aab('0x180')});db[_0x2aab('0x68')][_0x2aab('0x111')](db['Attachment'],{'as':_0x2aab('0xe6'),'foreignKey':_0x2aab('0x16f')});db['ChatMessage']['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0x2aab('0x17b')});db[_0x2aab('0x6a')]['belongsTo'](db[_0x2aab('0x6e')],{'onDelete':_0x2aab('0x101'),'as':'Contact','foreignKey':_0x2aab('0x15d')});db[_0x2aab('0x6a')][_0x2aab('0x111')](db[_0x2aab('0x62')],{'as':_0x2aab('0x15c'),'foreignKey':_0x2aab('0x17b')});db[_0x2aab('0x11e')][_0x2aab('0x113')](db[_0x2aab('0x12')],{'as':'Agents','through':_0x2aab('0x183'),'hooks':!![]});db['ChatQueue'][_0x2aab('0x113')](db[_0x2aab('0xde')],{'through':_0x2aab('0x184'),'as':'Teams'});db['ChatGroup'][_0x2aab('0x102')](db[_0x2aab('0xc9')],{'as':_0x2aab('0x16a'),'foreignKey':_0x2aab('0x185'),'onDelete':_0x2aab('0x101')});db[_0x2aab('0x186')][_0x2aab('0x113')](db[_0x2aab('0x12')],{'as':_0x2aab('0x138'),'through':_0x2aab('0x114')});db[_0x2aab('0x6c')][_0x2aab('0x111')](db[_0x2aab('0x62')],{'as':'Website','foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x2aab('0x102')](db['CmContact'],{'as':_0x2aab('0x187'),'foreignKey':'CompanyId'});db[_0x2aab('0x6e')][_0x2aab('0x102')](db[_0x2aab('0x188')],{'as':'Hoppers','foreignKey':_0x2aab('0x15d')});db[_0x2aab('0x6e')]['hasMany'](db[_0x2aab('0x71')],{'as':_0x2aab('0x106'),'foreignKey':_0x2aab('0x15d')});db[_0x2aab('0x6e')][_0x2aab('0x102')](db['CmHopperHistory'],{'as':_0x2aab('0x13b'),'foreignKey':'ContactId'});db[_0x2aab('0x6e')][_0x2aab('0x102')](db[_0x2aab('0x75')],{'as':_0x2aab('0x75'),'foreignKey':_0x2aab('0x15d')});db[_0x2aab('0x6e')][_0x2aab('0x102')](db['JscriptySessionReport'],{'as':_0x2aab('0x13d'),'foreignKey':'ContactId'});db['CmContact'][_0x2aab('0x102')](db[_0x2aab('0x5c')],{'as':_0x2aab('0x107'),'foreignKey':_0x2aab('0x15d'),'onDelete':_0x2aab('0x165')});db[_0x2aab('0x6e')][_0x2aab('0x102')](db[_0x2aab('0x108')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x2aab('0x6e')]['hasMany'](db[_0x2aab('0x119')],{'as':_0x2aab('0x10a'),'foreignKey':_0x2aab('0x15d'),'onDelete':_0x2aab('0x165')});db[_0x2aab('0x6e')][_0x2aab('0x102')](db[_0x2aab('0x4d')],{'as':_0x2aab('0x10b'),'foreignKey':_0x2aab('0x15d'),'onDelete':_0x2aab('0x165')});db[_0x2aab('0x6e')][_0x2aab('0x102')](db[_0x2aab('0x10c')],{'as':_0x2aab('0x116'),'foreignKey':_0x2aab('0x15d'),'onDelete':_0x2aab('0x165')});db[_0x2aab('0x6e')]['belongsTo'](db['CmCompany'],{'as':_0x2aab('0x189'),'foreignKey':_0x2aab('0x18a')});db[_0x2aab('0x6e')]['belongsTo'](db[_0x2aab('0xf0')],{'as':_0x2aab('0x166'),'foreignKey':_0x2aab('0x158'),'onDelete':_0x2aab('0x101')});db[_0x2aab('0x6e')][_0x2aab('0x113')](db[_0x2aab('0x12')],{'as':_0x2aab('0x162'),'through':_0x2aab('0x115')});db[_0x2aab('0x6e')][_0x2aab('0x113')](db[_0x2aab('0x8d')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x2aab('0x6e')][_0x2aab('0x113')](db[_0x2aab('0x8d')],{'through':_0x2aab('0x18b'),'as':'ThroughTags'});db[_0x2aab('0x188')][_0x2aab('0x111')](db[_0x2aab('0x6e')],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db[_0x2aab('0x188')][_0x2aab('0x111')](db['CmList'],{'as':_0x2aab('0x166'),'foreignKey':_0x2aab('0x158'),'onDelete':'cascade'});db[_0x2aab('0x188')]['belongsTo'](db[_0x2aab('0x12')],{'as':_0x2aab('0x17d'),'foreignKey':_0x2aab('0x104')});db[_0x2aab('0x188')]['belongsTo'](db[_0x2aab('0x1d')],{'as':_0x2aab('0x17e'),'foreignKey':_0x2aab('0x139'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0x2aab('0xe2')],{'as':_0x2aab('0xe2'),'foreignKey':_0x2aab('0x18c'),'onDelete':_0x2aab('0x101')});db[_0x2aab('0x188')][_0x2aab('0x111')](db['User'],{'as':_0x2aab('0x15e'),'foreignKey':'OwnerId'});db[_0x2aab('0x18d')][_0x2aab('0x111')](db[_0x2aab('0x6e')],{'as':_0x2aab('0x150'),'foreignKey':'ContactId','onDelete':_0x2aab('0x101')});db[_0x2aab('0x18d')][_0x2aab('0x111')](db['CmList'],{'as':_0x2aab('0x166'),'foreignKey':_0x2aab('0x158'),'onDelete':_0x2aab('0x101')});db[_0x2aab('0x18d')][_0x2aab('0x111')](db[_0x2aab('0x1d')],{'as':_0x2aab('0x17e'),'foreignKey':_0x2aab('0x139'),'onDelete':'cascade'});db[_0x2aab('0x18d')][_0x2aab('0x111')](db[_0x2aab('0xe2')],{'as':_0x2aab('0xe2'),'foreignKey':_0x2aab('0x18c'),'onDelete':'cascade'});db[_0x2aab('0x7a')][_0x2aab('0x102')](db[_0x2aab('0x80')],{'as':{'plural':_0x2aab('0x18e'),'singular':_0x2aab('0x18f')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db['Automation'][_0x2aab('0x102')](db[_0x2aab('0x80')],{'as':{'plural':'Any','singular':_0x2aab('0x190')},'foreignKey':'AutomationAnyId','onDelete':_0x2aab('0x101'),'hooks':!![]});db['Automation'][_0x2aab('0x102')](db[_0x2aab('0x191')],{'as':'Actions','foreignKey':_0x2aab('0x192'),'onDelete':_0x2aab('0x101'),'hooks':!![]});db[_0x2aab('0x82')]['hasMany'](db['Interval'],{'as':_0x2aab('0x193'),'foreignKey':_0x2aab('0x141'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x2aab('0x82')][_0x2aab('0x102')](db[_0x2aab('0x19')],{'as':'Extensions','foreignKey':_0x2aab('0x141'),'onDelete':_0x2aab('0x165')});db['Interval'][_0x2aab('0x102')](db[_0x2aab('0x45')],{'as':_0x2aab('0x194'),'foreignKey':'IntervalId'});db[_0x2aab('0x82')][_0x2aab('0x102')](db[_0x2aab('0x65')],{'as':_0x2aab('0x195'),'foreignKey':_0x2aab('0x141')});db['Interval'][_0x2aab('0x102')](db[_0x2aab('0x4c')],{'as':'FaxApplications','foreignKey':_0x2aab('0x141')});db[_0x2aab('0x82')]['hasMany'](db['SmsApplication'],{'as':_0x2aab('0x196'),'foreignKey':_0x2aab('0x141')});db[_0x2aab('0x89')]['belongsTo'](db['MailAccount'],{});db[_0x2aab('0x89')][_0x2aab('0x111')](db['AnalyticDefaultReport'],{'foreignKey':_0x2aab('0x197')});db['Schedule']['belongsTo'](db[_0x2aab('0x95')],{'foreignKey':_0x2aab('0x198')});db[_0x2aab('0x8b')][_0x2aab('0x113')](db[_0x2aab('0x1b')],{'as':'Mohs','through':_0x2aab('0x136'),'onDelete':_0x2aab('0x165')});db[_0x2aab('0x8d')][_0x2aab('0x113')](db[_0x2aab('0x6e')],{'through':'cm_contact_has_tags'});db['Tag']['belongsToMany'](db[_0x2aab('0x108')],{'through':'chat_interaction_has_tags'});db['Tag']['belongsToMany'](db['MailInteraction'],{'through':_0x2aab('0x15f')});db[_0x2aab('0x8d')][_0x2aab('0x113')](db[_0x2aab('0x119')],{'through':_0x2aab('0x172')});db[_0x2aab('0x8d')][_0x2aab('0x113')](db[_0x2aab('0x4d')],{'through':_0x2aab('0x16e')});db[_0x2aab('0x8d')][_0x2aab('0x113')](db[_0x2aab('0x5c')],{'through':'openchannel_interaction_has_tags'});db[_0x2aab('0x8d')][_0x2aab('0x113')](db['WhatsappInteraction'],{'through':_0x2aab('0x199')});db[_0x2aab('0x90')]['hasMany'](db[_0x2aab('0x80')],{'as':{'plural':_0x2aab('0x19a'),'singular':_0x2aab('0x19b')},'foreignKey':'TriggerAllId','onDelete':_0x2aab('0x101'),'hooks':!![]});db[_0x2aab('0x90')]['hasMany'](db[_0x2aab('0x80')],{'as':{'plural':_0x2aab('0x19c'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':_0x2aab('0x101'),'hooks':!![]});db[_0x2aab('0x90')][_0x2aab('0x102')](db[_0x2aab('0x191')],{'as':_0x2aab('0x19d'),'foreignKey':_0x2aab('0x19e'),'onDelete':'cascade','hooks':!![]});db[_0x2aab('0x95')][_0x2aab('0x102')](db['AnalyticFieldReport'],{'as':_0x2aab('0x19f'),'onDelete':'cascade','foreignKey':_0x2aab('0x198'),'hooks':!![]});db[_0x2aab('0x97')][_0x2aab('0x102')](db[_0x2aab('0x9b')],{'as':_0x2aab('0x19f'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x2aab('0x9a')][_0x2aab('0x102')](db[_0x2aab('0x9b')],{'as':_0x2aab('0x19f'),'onDelete':'cascade','foreignKey':_0x2aab('0x1a0')});db['AnalyticFieldReport']['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0x2aab('0x1a0')});db[_0x2aab('0x9e')][_0x2aab('0x102')](db['SalesforceConfiguration'],{'as':_0x2aab('0x1a1'),'onDelete':'cascade','foreignKey':_0x2aab('0x1a2')});db['SalesforceConfiguration'][_0x2aab('0x102')](db[_0x2aab('0xa0')],{'as':_0x2aab('0x1a3'),'onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x1a4')});db[_0x2aab('0x1a5')][_0x2aab('0x102')](db[_0x2aab('0xa0')],{'as':'Descriptions','onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x1a6')});db[_0x2aab('0x1a5')][_0x2aab('0x102')](db[_0x2aab('0xa0')],{'as':_0x2aab('0x19f'),'onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x1a7')});db[_0x2aab('0x1a5')]['belongsTo'](db['SalesforceAccount'],{'as':'Account','foreignKey':_0x2aab('0x1a2')});db[_0x2aab('0xa0')]['hasMany'](db[_0x2aab('0xa0')],{'as':_0x2aab('0x1a8'),'foreignKey':'SubjectId'});db[_0x2aab('0xa0')][_0x2aab('0x102')](db[_0x2aab('0xa0')],{'as':_0x2aab('0x1a9'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0x2aab('0x102')](db[_0x2aab('0xa0')],{'as':_0x2aab('0x1aa'),'foreignKey':_0x2aab('0x1a7')});db[_0x2aab('0xa0')][_0x2aab('0x111')](db[_0x2aab('0x92')],{'as':'Variable','foreignKey':_0x2aab('0x1ab')});db[_0x2aab('0xa2')][_0x2aab('0x102')](db[_0x2aab('0x1ac')],{'as':_0x2aab('0x1a1'),'onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x1a2')});db[_0x2aab('0x1ac')][_0x2aab('0x102')](db[_0x2aab('0xa4')],{'as':_0x2aab('0x1a3'),'onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x1a4')});db[_0x2aab('0x1ac')][_0x2aab('0x102')](db['SugarcrmField'],{'as':_0x2aab('0x1ad'),'onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x1a6')});db[_0x2aab('0x1ac')]['hasMany'](db[_0x2aab('0xa4')],{'as':_0x2aab('0x19f'),'onDelete':_0x2aab('0x101'),'foreignKey':'FieldId'});db[_0x2aab('0x1ac')][_0x2aab('0x111')](db[_0x2aab('0xa2')],{'as':_0x2aab('0x15c'),'foreignKey':_0x2aab('0x1a2')});db[_0x2aab('0xa4')][_0x2aab('0x102')](db[_0x2aab('0xa4')],{'as':'Subject','foreignKey':_0x2aab('0x1a4')});db['SugarcrmField'][_0x2aab('0x102')](db['SugarcrmField'],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0x2aab('0x102')](db[_0x2aab('0xa4')],{'as':'Field','foreignKey':_0x2aab('0x1a7')});db['SugarcrmField'][_0x2aab('0x111')](db[_0x2aab('0x92')],{'as':'Variable','foreignKey':_0x2aab('0x1ab')});db[_0x2aab('0xa6')]['hasMany'](db[_0x2aab('0xa8')],{'as':_0x2aab('0x1a1'),'onDelete':_0x2aab('0x101'),'foreignKey':'AccountId'});db[_0x2aab('0xa8')][_0x2aab('0x102')](db['DeskField'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x2aab('0xa8')][_0x2aab('0x102')](db[_0x2aab('0xa9')],{'as':_0x2aab('0x1ad'),'onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x1a6')});db[_0x2aab('0xa8')][_0x2aab('0x102')](db[_0x2aab('0xa9')],{'as':_0x2aab('0x19f'),'onDelete':_0x2aab('0x101'),'foreignKey':'FieldId'});db[_0x2aab('0xa8')][_0x2aab('0x111')](db[_0x2aab('0xa6')],{'as':_0x2aab('0x15c'),'foreignKey':_0x2aab('0x1a2')});db['DeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0x2aab('0x1ae')});db[_0x2aab('0xa9')][_0x2aab('0x102')](db[_0x2aab('0xa9')],{'as':_0x2aab('0x1a8'),'foreignKey':_0x2aab('0x1a4')});db[_0x2aab('0xa9')][_0x2aab('0x102')](db[_0x2aab('0xa9')],{'as':_0x2aab('0x1a9'),'foreignKey':_0x2aab('0x1a6')});db[_0x2aab('0xa9')][_0x2aab('0x102')](db[_0x2aab('0xa9')],{'as':'Field','foreignKey':_0x2aab('0x1a7')});db['DeskField'][_0x2aab('0x111')](db[_0x2aab('0x92')],{'as':_0x2aab('0x92'),'foreignKey':_0x2aab('0x1ab')});db[_0x2aab('0xaa')][_0x2aab('0x102')](db[_0x2aab('0xac')],{'as':_0x2aab('0x1a1'),'onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x1a2')});db[_0x2aab('0xac')][_0x2aab('0x102')](db['ZohoField'],{'as':_0x2aab('0x1a3'),'onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x1a4')});db[_0x2aab('0xac')][_0x2aab('0x102')](db[_0x2aab('0x1af')],{'as':_0x2aab('0x1ad'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x2aab('0xac')][_0x2aab('0x102')](db['ZohoField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x2aab('0x1a7')});db[_0x2aab('0xac')][_0x2aab('0x111')](db[_0x2aab('0xaa')],{'as':_0x2aab('0x15c'),'foreignKey':_0x2aab('0x1a2')});db[_0x2aab('0x1af')][_0x2aab('0x102')](db[_0x2aab('0x1af')],{'as':_0x2aab('0x1a8'),'foreignKey':_0x2aab('0x1a4')});db[_0x2aab('0x1af')]['hasMany'](db[_0x2aab('0x1af')],{'as':_0x2aab('0x1a9'),'foreignKey':'DescriptionId'});db[_0x2aab('0x1af')][_0x2aab('0x102')](db[_0x2aab('0x1af')],{'as':'Field','foreignKey':_0x2aab('0x1a7')});db[_0x2aab('0x1af')]['belongsTo'](db[_0x2aab('0x92')],{'as':_0x2aab('0x92'),'foreignKey':_0x2aab('0x1ab')});db['ZendeskAccount']['hasMany'](db[_0x2aab('0xaf')],{'as':'Configurations','onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x1a2')});db['ZendeskConfiguration'][_0x2aab('0x102')](db[_0x2aab('0xb1')],{'as':_0x2aab('0x1a3'),'foreignKey':_0x2aab('0x1a4')});db[_0x2aab('0xaf')][_0x2aab('0x102')](db[_0x2aab('0xb1')],{'as':'Descriptions','foreignKey':_0x2aab('0x1a6')});db[_0x2aab('0xaf')][_0x2aab('0x102')](db[_0x2aab('0xb1')],{'as':_0x2aab('0x19f'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x2aab('0x111')](db[_0x2aab('0xae')],{'as':_0x2aab('0x15c'),'foreignKey':_0x2aab('0x1a2')});db[_0x2aab('0xaf')]['belongsToMany'](db[_0x2aab('0x8d')],{'through':_0x2aab('0x1b0')});db[_0x2aab('0xb1')][_0x2aab('0x102')](db[_0x2aab('0xb1')],{'as':_0x2aab('0x1a8'),'foreignKey':_0x2aab('0x1a4')});db[_0x2aab('0xb1')][_0x2aab('0x102')](db[_0x2aab('0xb1')],{'as':_0x2aab('0x1a9'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x2aab('0x102')](db[_0x2aab('0xb1')],{'as':_0x2aab('0x1aa'),'foreignKey':_0x2aab('0x1a7')});db['ZendeskField'][_0x2aab('0x111')](db['Variable'],{'as':_0x2aab('0x92'),'foreignKey':_0x2aab('0x1ab')});db[_0x2aab('0xb2')][_0x2aab('0x102')](db['FreshdeskConfiguration'],{'as':_0x2aab('0x1a1'),'onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x1a2')});db[_0x2aab('0xb4')][_0x2aab('0x102')](db[_0x2aab('0xb5')],{'as':'Subjects','onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x1a4')});db[_0x2aab('0xb4')][_0x2aab('0x102')](db[_0x2aab('0xb5')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x2aab('0x1a6')});db[_0x2aab('0xb4')][_0x2aab('0x102')](db[_0x2aab('0xb5')],{'as':_0x2aab('0x19f'),'onDelete':'cascade','foreignKey':_0x2aab('0x1a7')});db[_0x2aab('0xb4')][_0x2aab('0x111')](db[_0x2aab('0xb2')],{'as':_0x2aab('0x15c'),'foreignKey':_0x2aab('0x1a2')});db['FreshdeskConfiguration']['belongsToMany'](db[_0x2aab('0x8d')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x2aab('0xb5')]['hasMany'](db[_0x2aab('0xb5')],{'as':_0x2aab('0x1a8'),'foreignKey':_0x2aab('0x1a4')});db[_0x2aab('0xb5')]['hasMany'](db[_0x2aab('0xb5')],{'as':_0x2aab('0x1a9'),'foreignKey':_0x2aab('0x1a6')});db['FreshdeskField']['hasMany'](db[_0x2aab('0xb5')],{'as':_0x2aab('0x1aa'),'foreignKey':_0x2aab('0x1a7')});db['FreshdeskField'][_0x2aab('0x111')](db[_0x2aab('0x92')],{'as':_0x2aab('0x92'),'foreignKey':_0x2aab('0x1ab')});db[_0x2aab('0xb7')][_0x2aab('0x102')](db[_0x2aab('0xb8')],{'as':_0x2aab('0x1a1'),'onDelete':_0x2aab('0x101'),'foreignKey':'AccountId'});db[_0x2aab('0xb8')]['hasMany'](db[_0x2aab('0x1b1')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x2aab('0xb8')][_0x2aab('0x102')](db['VtigerField'],{'as':_0x2aab('0x1ad'),'foreignKey':_0x2aab('0x1a6')});db['VtigerConfiguration'][_0x2aab('0x102')](db[_0x2aab('0x1b1')],{'as':_0x2aab('0x19f'),'foreignKey':_0x2aab('0x1a7')});db['VtigerConfiguration'][_0x2aab('0x111')](db[_0x2aab('0xb7')],{'as':_0x2aab('0x15c'),'foreignKey':_0x2aab('0x1a2')});db[_0x2aab('0x1b1')][_0x2aab('0x102')](db[_0x2aab('0x1b1')],{'as':_0x2aab('0x1a8'),'foreignKey':_0x2aab('0x1a4')});db[_0x2aab('0x1b1')][_0x2aab('0x102')](db['VtigerField'],{'as':_0x2aab('0x1a9'),'foreignKey':_0x2aab('0x1a6')});db['VtigerField'][_0x2aab('0x102')](db[_0x2aab('0x1b1')],{'as':'Field','foreignKey':_0x2aab('0x1a7')});db[_0x2aab('0x1b1')][_0x2aab('0x111')](db[_0x2aab('0x92')],{'as':_0x2aab('0x92'),'foreignKey':'VariableId'});db['ServicenowAccount'][_0x2aab('0x102')](db['ServicenowConfiguration'],{'as':_0x2aab('0x1a1'),'onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x1a2')});db[_0x2aab('0x1b2')][_0x2aab('0x102')](db[_0x2aab('0x1b3')],{'as':_0x2aab('0x1a3'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x2aab('0x102')](db[_0x2aab('0x1b3')],{'as':'Descriptions','foreignKey':_0x2aab('0x1a6')});db[_0x2aab('0x1b2')][_0x2aab('0x102')](db[_0x2aab('0x1b3')],{'as':'Fields','foreignKey':_0x2aab('0x1a7')});db[_0x2aab('0x1b2')]['belongsTo'](db[_0x2aab('0x1b4')],{'as':_0x2aab('0x15c'),'foreignKey':'AccountId'});db[_0x2aab('0x1b3')][_0x2aab('0x102')](db[_0x2aab('0x1b3')],{'as':_0x2aab('0x1a8'),'foreignKey':_0x2aab('0x1a4')});db[_0x2aab('0x1b3')][_0x2aab('0x102')](db['ServicenowField'],{'as':_0x2aab('0x1a9'),'foreignKey':_0x2aab('0x1a6')});db[_0x2aab('0x1b3')][_0x2aab('0x102')](db[_0x2aab('0x1b3')],{'as':'Field','foreignKey':_0x2aab('0x1a7')});db['ServicenowField']['belongsTo'](db[_0x2aab('0x92')],{'as':_0x2aab('0x92'),'foreignKey':_0x2aab('0x1ab')});db[_0x2aab('0xbc')][_0x2aab('0x102')](db[_0x2aab('0x1b5')],{'as':_0x2aab('0x1a1'),'onDelete':'cascade','foreignKey':_0x2aab('0x1a2')});db['Dynamics365Configuration']['hasMany'](db[_0x2aab('0xbe')],{'as':_0x2aab('0x1a3'),'onDelete':'cascade','foreignKey':_0x2aab('0x1a4')});db[_0x2aab('0x1b5')][_0x2aab('0x102')](db[_0x2aab('0xbe')],{'as':_0x2aab('0x1ad'),'onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x1a6')});db[_0x2aab('0x1b5')]['hasMany'](db[_0x2aab('0xbe')],{'as':_0x2aab('0x19f'),'onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x1a7')});db[_0x2aab('0x1b5')][_0x2aab('0x111')](db[_0x2aab('0xbc')],{'as':'Account','foreignKey':_0x2aab('0x1a2')});db[_0x2aab('0xbe')][_0x2aab('0x102')](db[_0x2aab('0xbe')],{'as':'Subject','foreignKey':_0x2aab('0x1a4')});db['Dynamics365Field'][_0x2aab('0x102')](db[_0x2aab('0xbe')],{'as':'Description','foreignKey':'DescriptionId'});db['Dynamics365Field'][_0x2aab('0x102')](db['Dynamics365Field'],{'as':_0x2aab('0x1aa'),'foreignKey':'FieldId'});db[_0x2aab('0xbe')][_0x2aab('0x111')](db[_0x2aab('0x92')],{'as':_0x2aab('0x92'),'foreignKey':_0x2aab('0x1ab')});db[_0x2aab('0xc0')][_0x2aab('0x102')](db[_0x2aab('0xc2')],{'as':_0x2aab('0x1a1'),'onDelete':_0x2aab('0x101'),'foreignKey':'AccountId'});db[_0x2aab('0xc2')]['hasMany'](db['FreshsalesField'],{'as':_0x2aab('0x1a3'),'foreignKey':_0x2aab('0x1a4')});db['FreshsalesConfiguration'][_0x2aab('0x102')](db['FreshsalesField'],{'as':_0x2aab('0x1ad'),'foreignKey':_0x2aab('0x1a6')});db['FreshsalesConfiguration'][_0x2aab('0x102')](db[_0x2aab('0xc4')],{'as':_0x2aab('0x19f'),'foreignKey':_0x2aab('0x1a7')});db[_0x2aab('0xc2')][_0x2aab('0x111')](db[_0x2aab('0xc0')],{'as':'Account','foreignKey':'AccountId'});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':_0x2aab('0x1a8'),'foreignKey':_0x2aab('0x1a4')});db[_0x2aab('0xc4')]['hasMany'](db[_0x2aab('0xc4')],{'as':_0x2aab('0x1a9'),'foreignKey':_0x2aab('0x1a6')});db[_0x2aab('0xc4')]['hasMany'](db[_0x2aab('0xc4')],{'as':_0x2aab('0x1aa'),'foreignKey':_0x2aab('0x1a7')});db[_0x2aab('0xc4')][_0x2aab('0x111')](db['Variable'],{'as':_0x2aab('0x92'),'foreignKey':'VariableId'});db[_0x2aab('0xc7')][_0x2aab('0x111')](db[_0x2aab('0x62')],{});db[_0x2aab('0xc7')]['belongsTo'](db[_0x2aab('0xf0')],{'as':'List','foreignKey':_0x2aab('0x158')});db[_0x2aab('0xc7')][_0x2aab('0x111')](db[_0x2aab('0x6e')],{'as':_0x2aab('0x150'),'foreignKey':_0x2aab('0x15d')});db[_0x2aab('0xc7')]['belongsTo'](db['ChatInteraction'],{});db['ChatQueueReport'][_0x2aab('0x111')](db[_0x2aab('0x68')],{});db[_0x2aab('0xc7')][_0x2aab('0x111')](db[_0x2aab('0x12')],{});db[_0x2aab('0xc7')]['belongsTo'](db[_0x2aab('0x11e')],{});db[_0x2aab('0xc9')]['belongsTo'](db[_0x2aab('0x12')],{'onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x1b6')});db[_0x2aab('0xc9')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'onDelete':'cascade','foreignKey':_0x2aab('0x1b7')});db['JscriptySessionReport'][_0x2aab('0x102')](db[_0x2aab('0x1b8')],{'foreignKey':_0x2aab('0x1b9'),'onDelete':_0x2aab('0x101')});db[_0x2aab('0xce')][_0x2aab('0x102')](db[_0x2aab('0xcb')],{'foreignKey':_0x2aab('0x1b9'),'onDelete':_0x2aab('0x101')});db[_0x2aab('0xd0')][_0x2aab('0x111')](db[_0x2aab('0x53')],{});db['SmsQueueReport'][_0x2aab('0x111')](db[_0x2aab('0xf0')],{'as':_0x2aab('0x166'),'foreignKey':_0x2aab('0x158')});db['SmsQueueReport'][_0x2aab('0x111')](db[_0x2aab('0x6e')],{'as':_0x2aab('0x150'),'foreignKey':_0x2aab('0x15d')});db['SmsQueueReport'][_0x2aab('0x111')](db[_0x2aab('0x119')],{});db['SmsQueueReport'][_0x2aab('0x111')](db['SmsMessage'],{});db[_0x2aab('0xd0')][_0x2aab('0x111')](db[_0x2aab('0x12')],{});db[_0x2aab('0xd0')][_0x2aab('0x111')](db[_0x2aab('0x58')],{});db[_0x2aab('0x1ba')][_0x2aab('0x102')](db[_0x2aab('0xce')],{'foreignKey':_0x2aab('0x1bb')});db[_0x2aab('0x1ba')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0x2aab('0x1ba')][_0x2aab('0x102')](db[_0x2aab('0xcb')],{'foreignKey':_0x2aab('0x1bb')});db[_0x2aab('0xd9')][_0x2aab('0x113')](db['User'],{'as':'Users','through':'user_has_square_projects'});db[_0x2aab('0xde')][_0x2aab('0x113')](db[_0x2aab('0x12')],{'as':'Agents','through':_0x2aab('0x1bc')});db[_0x2aab('0xde')][_0x2aab('0x113')](db[_0x2aab('0x1d')],{'through':_0x2aab('0x149'),'as':'VoiceQueues'});db[_0x2aab('0xde')]['belongsToMany'](db[_0x2aab('0x3f')],{'through':'team_has_mail_queues','as':_0x2aab('0x11d')});db['Team'][_0x2aab('0x113')](db[_0x2aab('0x11e')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0x2aab('0xde')]['belongsToMany'](db[_0x2aab('0x50')],{'through':_0x2aab('0x170'),'as':_0x2aab('0x120')});db[_0x2aab('0xde')]['belongsToMany'](db['SmsQueue'],{'through':_0x2aab('0x1bd'),'as':_0x2aab('0x121')});db['Team'][_0x2aab('0x113')](db[_0x2aab('0x60')],{'through':_0x2aab('0x17a'),'as':_0x2aab('0x122')});db[_0x2aab('0xde')][_0x2aab('0x113')](db['WhatsappQueue'],{'through':_0x2aab('0x1be'),'as':'WhatsappQueues'});db[_0x2aab('0xe2')][_0x2aab('0x102')](db['CmHopper'],{'as':_0x2aab('0x13a'),'foreignKey':'CampaignId'});db[_0x2aab('0xe2')][_0x2aab('0x102')](db['CmHopperFinal'],{'as':_0x2aab('0x106'),'foreignKey':_0x2aab('0x18c')});db[_0x2aab('0xe2')][_0x2aab('0x102')](db[_0x2aab('0x73')],{'as':_0x2aab('0x13b'),'foreignKey':_0x2aab('0x18c')});db[_0x2aab('0xe2')][_0x2aab('0x102')](db[_0x2aab('0x18d')],{'as':_0x2aab('0x13c'),'foreignKey':_0x2aab('0x18c')});db[_0x2aab('0xe2')]['belongsTo'](db[_0x2aab('0x2e')],{'as':_0x2aab('0x2e'),'foreignKey':_0x2aab('0x13e')});db['Campaign'][_0x2aab('0x111')](db[_0x2aab('0x2e')],{'as':'TrunkBackup','foreignKey':_0x2aab('0x140')});db['Campaign']['belongsTo'](db['Interval'],{'as':'Interval','foreignKey':_0x2aab('0x141')});db[_0x2aab('0xe2')]['belongsTo'](db[_0x2aab('0xd9')],{'as':_0x2aab('0xd9'),'foreignKey':'SquareProjectId'});db[_0x2aab('0xe2')]['belongsToMany'](db['CmList'],{'as':_0x2aab('0x145'),'through':_0x2aab('0x1bf')});db[_0x2aab('0xe2')]['belongsToMany'](db[_0x2aab('0xf0')],{'as':_0x2aab('0x14a'),'through':'campaigns_has_cm_blacklists'});db[_0x2aab('0xe8')][_0x2aab('0x111')](db[_0x2aab('0x156')],{});db['MailTransferReport'][_0x2aab('0x111')](db['MailInteraction'],{});db['MailTransferReport'][_0x2aab('0x111')](db['MailAccount'],{'foreignKey':_0x2aab('0x1c0'),'as':_0x2aab('0x1c1')});db['MailTransferReport']['belongsTo'](db[_0x2aab('0x12')],{'foreignKey':_0x2aab('0x1c2'),'as':'FromAgent'});db[_0x2aab('0xe8')]['belongsTo'](db[_0x2aab('0x12')],{'foreignKey':_0x2aab('0x1c3'),'as':_0x2aab('0x1c4')});db[_0x2aab('0xe8')][_0x2aab('0x111')](db[_0x2aab('0x3f')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x2aab('0xe8')]['belongsTo'](db[_0x2aab('0x12a')],{'foreignKey':'ToMailAccountId','as':_0x2aab('0x1c5')});db['ChatTransferReport'][_0x2aab('0x111')](db[_0x2aab('0x68')],{});db['ChatTransferReport'][_0x2aab('0x111')](db[_0x2aab('0x108')],{});db['ChatTransferReport'][_0x2aab('0x111')](db[_0x2aab('0x62')],{'foreignKey':_0x2aab('0x1c6'),'as':_0x2aab('0x1c1')});db[_0x2aab('0xea')]['belongsTo'](db['User'],{'foreignKey':_0x2aab('0x1c2'),'as':_0x2aab('0x1c7')});db[_0x2aab('0xea')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'foreignKey':_0x2aab('0x1c3'),'as':_0x2aab('0x1c4')});db['ChatTransferReport'][_0x2aab('0x111')](db[_0x2aab('0x11e')],{'foreignKey':_0x2aab('0x1c8'),'as':_0x2aab('0x1c9')});db[_0x2aab('0xea')][_0x2aab('0x111')](db[_0x2aab('0x62')],{'foreignKey':_0x2aab('0x1ca'),'as':_0x2aab('0x1c5')});db[_0x2aab('0x1cb')][_0x2aab('0x111')](db[_0x2aab('0x169')],{});db['FaxTransferReport']['belongsTo'](db[_0x2aab('0x4d')],{});db[_0x2aab('0x1cb')]['belongsTo'](db[_0x2aab('0x128')],{'foreignKey':_0x2aab('0x1cc'),'as':_0x2aab('0x1c1')});db[_0x2aab('0x1cb')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'foreignKey':'FromUserId','as':_0x2aab('0x1c7')});db[_0x2aab('0x1cb')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'foreignKey':_0x2aab('0x1c3'),'as':_0x2aab('0x1c4')});db['FaxTransferReport'][_0x2aab('0x111')](db[_0x2aab('0x50')],{'foreignKey':_0x2aab('0x1cd'),'as':'ToQueue'});db[_0x2aab('0x1cb')][_0x2aab('0x111')](db['FaxAccount'],{'foreignKey':_0x2aab('0x1ce'),'as':_0x2aab('0x1c5')});db[_0x2aab('0x1cf')]['belongsTo'](db['OpenchannelMessage'],{});db[_0x2aab('0x1cf')][_0x2aab('0x111')](db[_0x2aab('0x5c')],{});db[_0x2aab('0x1cf')][_0x2aab('0x111')](db[_0x2aab('0x59')],{'foreignKey':_0x2aab('0x1d0'),'as':_0x2aab('0x1c1')});db['OpenchannelTransferReport'][_0x2aab('0x111')](db[_0x2aab('0x12')],{'foreignKey':'FromUserId','as':_0x2aab('0x1c7')});db[_0x2aab('0x1cf')]['belongsTo'](db[_0x2aab('0x12')],{'foreignKey':_0x2aab('0x1c3'),'as':'ToAgent'});db[_0x2aab('0x1cf')]['belongsTo'](db[_0x2aab('0x60')],{'foreignKey':_0x2aab('0x1d1'),'as':'ToQueue'});db[_0x2aab('0x1cf')][_0x2aab('0x111')](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0x2aab('0x1c5')});db[_0x2aab('0xee')]['belongsTo'](db[_0x2aab('0x57')],{});db[_0x2aab('0xee')][_0x2aab('0x111')](db[_0x2aab('0x119')],{});db['SmsTransferReport'][_0x2aab('0x111')](db[_0x2aab('0x53')],{'foreignKey':_0x2aab('0x1d2'),'as':_0x2aab('0x1c1')});db[_0x2aab('0xee')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'foreignKey':_0x2aab('0x1c2'),'as':_0x2aab('0x1c7')});db[_0x2aab('0xee')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'foreignKey':_0x2aab('0x1c3'),'as':_0x2aab('0x1c4')});db[_0x2aab('0xee')][_0x2aab('0x111')](db[_0x2aab('0x58')],{'foreignKey':_0x2aab('0x1d3'),'as':'ToQueue'});db[_0x2aab('0xee')][_0x2aab('0x111')](db[_0x2aab('0x53')],{'foreignKey':_0x2aab('0x1d4'),'as':_0x2aab('0x1c5')});db['CmList'][_0x2aab('0x102')](db[_0x2aab('0x7e')],{'as':_0x2aab('0x154'),'foreignKey':_0x2aab('0x158')});db[_0x2aab('0xf0')][_0x2aab('0x102')](db[_0x2aab('0x77')],{'as':_0x2aab('0x1d5'),'foreignKey':_0x2aab('0x158')});db[_0x2aab('0xf0')][_0x2aab('0x102')](db['CmContact'],{'as':_0x2aab('0x187'),'onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x158')});db[_0x2aab('0xf0')][_0x2aab('0x102')](db[_0x2aab('0x71')],{'as':_0x2aab('0x106'),'foreignKey':'ListId'});db[_0x2aab('0xf0')]['hasMany'](db[_0x2aab('0x73')],{'as':_0x2aab('0x1d6'),'foreignKey':_0x2aab('0x158')});db['CmList']['hasMany'](db[_0x2aab('0x75')],{'as':'ReportAgentPreview','foreignKey':_0x2aab('0x158')});db['CmList'][_0x2aab('0x113')](db[_0x2aab('0x1d')],{'as':'Queues','through':_0x2aab('0x146')});db[_0x2aab('0xf0')][_0x2aab('0x113')](db[_0x2aab('0x12')],{'as':'Agents','through':_0x2aab('0x124')});db[_0x2aab('0xf2')][_0x2aab('0x102')](db[_0x2aab('0x19')],{'as':_0x2aab('0x105'),'onDelete':'cascade'});db[_0x2aab('0xf2')][_0x2aab('0x113')](db['User'],{'as':_0x2aab('0x147'),'through':_0x2aab('0x126')});db[_0x2aab('0xf4')][_0x2aab('0x102')](db[_0x2aab('0x12')],{'as':_0x2aab('0x162'),'foreignKey':_0x2aab('0x112')});db[_0x2aab('0xf4')][_0x2aab('0x102')](db[_0x2aab('0x1d7')],{'as':_0x2aab('0x1d8'),'foreignKey':_0x2aab('0x112'),'onDelete':_0x2aab('0x101')});db['UserProfileSection'][_0x2aab('0x102')](db[_0x2aab('0x1d9')],{'as':_0x2aab('0x1da'),'foreignKey':_0x2aab('0x1db'),'onDelete':_0x2aab('0x101')});db[_0x2aab('0xf7')]['hasMany'](db[_0x2aab('0x7e')],{'as':_0x2aab('0x154'),'foreignKey':_0x2aab('0x1dc')});db[_0x2aab('0xf7')][_0x2aab('0x102')](db[_0x2aab('0x7c')],{'as':_0x2aab('0x155'),'foreignKey':_0x2aab('0x1dc')});db[_0x2aab('0xf7')]['hasMany'](db[_0x2aab('0x1dd')],{'as':_0x2aab('0x16a'),'foreignKey':_0x2aab('0x1dc')});db['WhatsappAccount'][_0x2aab('0x102')](db['WhatsappInteraction'],{'as':_0x2aab('0x157')});db[_0x2aab('0xf7')]['hasMany'](db[_0x2aab('0xf9')],{'as':_0x2aab('0x134')});db[_0x2aab('0xf7')][_0x2aab('0x111')](db[_0x2aab('0xf0')],{'as':_0x2aab('0x166'),'foreignKey':_0x2aab('0x158')});db[_0x2aab('0xf7')][_0x2aab('0x111')](db[_0x2aab('0x142')],{'as':'mandatoryDispositionPause','foreignKey':_0x2aab('0x144')});db[_0x2aab('0xf7')][_0x2aab('0x113')](db[_0x2aab('0x12')],{'as':_0x2aab('0x147'),'through':_0x2aab('0x131')});db[_0x2aab('0xf9')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'onDelete':_0x2aab('0x165')});db[_0x2aab('0xf9')][_0x2aab('0x111')](db[_0x2aab('0xff')],{'onDelete':_0x2aab('0x165')});db[_0x2aab('0xf9')]['belongsTo'](db[_0x2aab('0xf7')],{'onDelete':_0x2aab('0x165')});db[_0x2aab('0xf9')][_0x2aab('0x111')](db['Interval'],{'onDelete':_0x2aab('0x165'),'foreignKey':_0x2aab('0x141')});db[_0x2aab('0xf9')][_0x2aab('0x111')](db[_0x2aab('0x8d')],{'onDelete':_0x2aab('0x165'),'foreignKey':_0x2aab('0x16c')});db['WhatsappInteraction'][_0x2aab('0x102')](db[_0x2aab('0x1dd')],{'as':_0x2aab('0x16a'),'onDelete':_0x2aab('0x101'),'foreignKey':_0x2aab('0x1de')});db[_0x2aab('0xfb')]['belongsTo'](db[_0x2aab('0xf7')],{'as':_0x2aab('0x15c'),'foreignKey':_0x2aab('0x1dc')});db[_0x2aab('0xfb')]['belongsTo'](db['CmContact'],{'as':_0x2aab('0x150'),'foreignKey':_0x2aab('0x15d')});db[_0x2aab('0xfb')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'as':_0x2aab('0x15e'),'foreignKey':_0x2aab('0x104')});db[_0x2aab('0xfb')][_0x2aab('0x113')](db[_0x2aab('0x8d')],{'through':_0x2aab('0x199'),'as':_0x2aab('0x160')});db[_0x2aab('0xfb')]['belongsToMany'](db[_0x2aab('0x8d')],{'through':_0x2aab('0x199'),'as':'ThroughTags'});db[_0x2aab('0xfb')][_0x2aab('0x113')](db[_0x2aab('0x12')],{'as':_0x2aab('0x162'),'through':_0x2aab('0x1df'),'foreignKey':'WhatsappInteractionId'});db[_0x2aab('0x1dd')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'as':_0x2aab('0x12')});db[_0x2aab('0x1dd')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0x2aab('0x150')});db[_0x2aab('0x1dd')][_0x2aab('0x111')](db[_0x2aab('0xfb')],{'onDelete':_0x2aab('0x101'),'as':_0x2aab('0x164'),'foreignKey':_0x2aab('0x1de')});db[_0x2aab('0x1dd')]['belongsTo'](db[_0x2aab('0xf7')],{'as':_0x2aab('0x15c'),'foreignKey':_0x2aab('0x1dc')});db['WhatsappQueueReport'][_0x2aab('0x111')](db[_0x2aab('0xf7')],{});db[_0x2aab('0x1e0')][_0x2aab('0x111')](db[_0x2aab('0xf0')],{'as':_0x2aab('0x166'),'foreignKey':'ListId'});db[_0x2aab('0x1e0')][_0x2aab('0x111')](db[_0x2aab('0x6e')],{'as':_0x2aab('0x150'),'foreignKey':_0x2aab('0x15d')});db[_0x2aab('0x1e0')][_0x2aab('0x111')](db[_0x2aab('0xfb')],{});db[_0x2aab('0x1e0')]['belongsTo'](db[_0x2aab('0xff')],{});db[_0x2aab('0x1e0')][_0x2aab('0x111')](db['WhatsappMessage'],{});db[_0x2aab('0x1e0')][_0x2aab('0x111')](db[_0x2aab('0x12')],{});db[_0x2aab('0x1e1')][_0x2aab('0x111')](db[_0x2aab('0x1dd')],{});db[_0x2aab('0x1e1')]['belongsTo'](db[_0x2aab('0xfb')],{});db[_0x2aab('0x1e1')][_0x2aab('0x111')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db['WhatsappTransferReport'][_0x2aab('0x111')](db[_0x2aab('0xf7')],{'foreignKey':'ToWhatsappAccountId','as':_0x2aab('0x1c5')});db[_0x2aab('0x1e1')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x2aab('0x1e2'),'as':_0x2aab('0x1c9')});db[_0x2aab('0x1e1')][_0x2aab('0x111')](db[_0x2aab('0x12')],{'foreignKey':_0x2aab('0x1c2'),'as':_0x2aab('0x1c7')});db['WhatsappTransferReport'][_0x2aab('0x111')](db[_0x2aab('0x12')],{'foreignKey':'ToUserId','as':_0x2aab('0x1c4')});db['WhatsappQueue'][_0x2aab('0x113')](db[_0x2aab('0x12')],{'as':_0x2aab('0x147'),'through':_0x2aab('0x3b'),'foreignKey':_0x2aab('0x1e3')});db['WhatsappQueue'][_0x2aab('0x113')](db[_0x2aab('0xde')],{'through':_0x2aab('0x1be'),'as':_0x2aab('0x148')});module[_0x2aab('0x1e4')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x4d49=['ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','MailTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','User','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','CmHopperFinal','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','VoiceQueues','ChatQueues','FaxQueues','SmsQueue','SmsQueues','UserOpenchannelQueue','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccount','user_has_fax_accounts','MailAccount','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_square_projects','SpiedAgents','VoiceContext','Applications','Sounds','Members','VoiceQueueId','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkBackup','TrunkBackupId','Interval','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','VoiceMailMessage','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailServerIn','Smtp','Dispositions','CannedAnswer','Answers','MailAccountId','List','ListId','MailInteractionId','Account','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Attachments','Interaction','restrict','TagId','Items','FaxAccountId','Interactions','FaxMessage','FaxInteractionId','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsQueueId','team_has_sms_queues','Teams','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueue','OpenchannelQueueId','IntervalId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','OpenchannelQueueReport','Agent','Queue','ChatQueueId','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatGroupId','Website','CompanyId','Hoppers','HopperFinals','MailInteractions','cm_contact_has_tags','CampaignId','All','OneAll','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','DefaultReportId','MetricId','AccountId','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','Variable','VariableId','SugarcrmField','Subjects','Configurations','DeskField','int_desk_configuration_has_tags','ZendeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowAccount','ServicenowField','Dynamics365Field','ChatInternalMessage','FromId','ToId','SessionId','SmsQueueReport','ProjectId','team_has_mail_queues','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','WhatsappQueues','TrunkId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','ToChatWebsiteId','ToAccount','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','cm_user_has_lists','userProfileId','UserProfileSection','UserProfileSections','Resources','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','user_has_whatsapp_interactions','ToQueueId','WhatsappQueueId','exports','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','127.0.0.1','database','username','options','password','../api/user/user.model','VoiceChanSpy','import','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','CmCustomField','Action','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/pause/pause.model','Cdr','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model'];(function(_0x594220,_0x1c9a6f){var _0x14e042=function(_0x3f84dc){while(--_0x3f84dc){_0x594220['push'](_0x594220['shift']());}};_0x14e042(++_0x1c9a6f);}(_0x4d49,0x141));var _0x94d4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4d49[_0x1facfa];return _0x9ec701;};'use strict';var path=require('path');var config=require(_0x94d4('0x0'));var Sequelize=require('sequelize');var _=require(_0x94d4('0x1'));var jstz=require(_0x94d4('0x2'));var timezone=jstz[_0x94d4('0x3')]();config[_0x94d4('0x4')]=_[_0x94d4('0x5')](config[_0x94d4('0x4')],{'database':_0x94d4('0x6'),'username':_0x94d4('0x7'),'password':_0x94d4('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x94d4('0x9'),'dialectOptions':{'charset':_0x94d4('0xa')},'logging':![],'timezone':timezone[_0x94d4('0xb')](),'define':{'charset':_0x94d4('0xc'),'collate':_0x94d4('0xd')}}});config[_0x94d4('0xe')]=_['defaultsDeep'](config[_0x94d4('0xe')],{'database':_0x94d4('0x6'),'username':'xcall','password':_0x94d4('0x8'),'options':{'host':_0x94d4('0xf'),'port':0xcea,'dialect':_0x94d4('0x9'),'dialectOptions':{'charset':_0x94d4('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x94d4('0xc'),'collate':_0x94d4('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x94d4('0x4')][_0x94d4('0x10')],config[_0x94d4('0x4')][_0x94d4('0x11')],config['sequelize']['password'],config['sequelize'][_0x94d4('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x94d4('0xe')]['database'],config[_0x94d4('0xe')][_0x94d4('0x11')],config['sequelizeHistory'][_0x94d4('0x13')],config['sequelizeHistory'][_0x94d4('0x12')])};db['User']=db['sequelize']['import'](_0x94d4('0x14'));db[_0x94d4('0x15')]=db[_0x94d4('0x4')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x17'));db[_0x94d4('0x18')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x19'));db[_0x94d4('0x1a')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x1b'));db[_0x94d4('0x1c')]=db['sequelize'][_0x94d4('0x16')]('../api/voiceQueue/voiceQueue.model');db[_0x94d4('0x1d')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x1e'));db['ScreenRecording']=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x1f'));db['VoiceMailMessage']=db[_0x94d4('0x4')]['import'](_0x94d4('0x20'));db['VoiceCallReport']=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x21'));db[_0x94d4('0x22')]=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/voiceDialReport/voiceDialReport.model');db[_0x94d4('0x23')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x24'));db[_0x94d4('0x25')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x26'));db[_0x94d4('0x27')]=db[_0x94d4('0x4')]['import'](_0x94d4('0x28'));db[_0x94d4('0x29')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0x2a'));db[_0x94d4('0x2b')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x2c'));db[_0x94d4('0x2d')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x2e'));db[_0x94d4('0x2f')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x30'));db[_0x94d4('0x31')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x32'));db[_0x94d4('0x33')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x34'));db[_0x94d4('0x35')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x36'));db[_0x94d4('0x37')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x38'));db['UserOpenchannelQueue']=db[_0x94d4('0x4')]['import'](_0x94d4('0x39'));db[_0x94d4('0x3a')]=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0x94d4('0x4')]['import'](_0x94d4('0x3b'));db[_0x94d4('0x3c')]=db[_0x94d4('0x4')]['import'](_0x94d4('0x3d'));db['MailAccount']=db['sequelize']['import'](_0x94d4('0x3e'));db[_0x94d4('0x3f')]=db[_0x94d4('0x4')]['import'](_0x94d4('0x40'));db[_0x94d4('0x41')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x42'));db[_0x94d4('0x43')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x44'));db[_0x94d4('0x45')]=db[_0x94d4('0x4')]['import'](_0x94d4('0x46'));db[_0x94d4('0x47')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x48'));db[_0x94d4('0x49')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0x4a'));db[_0x94d4('0x4b')]=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/dashboard/dashboard.model');db[_0x94d4('0x4c')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x4d'));db['FaxAccount']=db['sequelize'][_0x94d4('0x16')](_0x94d4('0x4e'));db[_0x94d4('0x4f')]=db[_0x94d4('0x4')]['import'](_0x94d4('0x50'));db[_0x94d4('0x51')]=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x94d4('0x4')]['import'](_0x94d4('0x52'));db[_0x94d4('0x53')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x54'));db[_0x94d4('0x55')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0x56'));db[_0x94d4('0x57')]=db[_0x94d4('0x4')]['import']('../api/smsAccount/smsAccount.model');db[_0x94d4('0x58')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0x59'));db['SmsInteraction']=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x5a'));db[_0x94d4('0x5b')]=db[_0x94d4('0x4')]['import'](_0x94d4('0x5c'));db['SmsQueue']=db[_0x94d4('0x4')]['import'](_0x94d4('0x5d'));db[_0x94d4('0x5e')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0x5f'));db['OpenchannelApplication']=db[_0x94d4('0x4')]['import'](_0x94d4('0x60'));db[_0x94d4('0x61')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0x62'));db[_0x94d4('0x63')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x64'));db['OpenchannelQueue']=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x65'));db[_0x94d4('0x66')]=db['sequelize'][_0x94d4('0x16')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db['sequelize'][_0x94d4('0x16')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x94d4('0x67')]=db['sequelize']['import']('../api/chatApplication/chatApplication.model');db[_0x94d4('0x68')]=db[_0x94d4('0x4')]['import'](_0x94d4('0x69'));db[_0x94d4('0x6a')]=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/chatMessage/chatMessage.model');db[_0x94d4('0x6b')]=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x94d4('0x6c')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x6d'));db[_0x94d4('0x6e')]=db[_0x94d4('0x4')]['import'](_0x94d4('0x6f'));db[_0x94d4('0x70')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0x71'));db[_0x94d4('0x72')]=db[_0x94d4('0x4')]['import'](_0x94d4('0x73'));db[_0x94d4('0x74')]=db[_0x94d4('0x4')]['import'](_0x94d4('0x75'));db[_0x94d4('0x76')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x77'));db['CmHopperBlack']=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x78'));db['CmHopperFinal']=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x79'));db[_0x94d4('0x7a')]=db[_0x94d4('0x4')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0x94d4('0x7b')]=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x94d4('0x7c')]=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/cmCustomField/cmCustomField.model');db[_0x94d4('0x7d')]=db['sequelize'][_0x94d4('0x16')]('../api/action/action.model');db[_0x94d4('0x7e')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x7f'));db['CannedAnswer']=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x80'));db[_0x94d4('0x81')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0x82'));db[_0x94d4('0x83')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x84'));db['Interval']=db['sequelize'][_0x94d4('0x16')]('../api/interval/interval.model');db['Pause']=db[_0x94d4('0x4')]['import'](_0x94d4('0x85'));db[_0x94d4('0x86')]=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x94d4('0x87')]=db[_0x94d4('0x4')]['import'](_0x94d4('0x88'));db[_0x94d4('0x89')]=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/sound/sound.model');db[_0x94d4('0x8a')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x8b'));db[_0x94d4('0x8c')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0x8d'));db['Trigger']=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x8e'));db['Variable']=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x8f'));db[_0x94d4('0x90')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x91'));db[_0x94d4('0x92')]=db[_0x94d4('0x4')]['import'](_0x94d4('0x93'));db[_0x94d4('0x94')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x95'));db[_0x94d4('0x96')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0x97'));db['AnalyticExtractedReport']=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x98'));db[_0x94d4('0x99')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x9a'));db[_0x94d4('0x9b')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0x9c'));db[_0x94d4('0x9d')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x9e'));db[_0x94d4('0x9f')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xa0'));db[_0x94d4('0xa1')]=db['sequelize']['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x94d4('0xa2')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0xa3'));db[_0x94d4('0xa4')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xa5'));db[_0x94d4('0xa6')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xa7'));db['SugarcrmField']=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x94d4('0xa8')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xa9'));db[_0x94d4('0xaa')]=db[_0x94d4('0x4')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0x94d4('0x4')]['import'](_0x94d4('0xab'));db[_0x94d4('0xac')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0xad'));db[_0x94d4('0xae')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xaf'));db[_0x94d4('0xb0')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0xb1'));db['ZendeskAccount']=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xb2'));db['ZendeskConfiguration']=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xb3'));db[_0x94d4('0xb4')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xb5'));db[_0x94d4('0xb6')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xb7'));db[_0x94d4('0xb8')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xb9'));db[_0x94d4('0xba')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xbb'));db[_0x94d4('0xbc')]=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x94d4('0xbd')]=db[_0x94d4('0x4')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x94d4('0xbe')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0xbf'));db['ServicenowAccount']=db['sequelize'][_0x94d4('0x16')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x94d4('0xc0')]=db[_0x94d4('0x4')]['import'](_0x94d4('0xc1'));db['ServicenowField']=db['sequelize']['import']('../api/intServicenowField/intServicenowField.model');db[_0x94d4('0xc2')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xc3'));db[_0x94d4('0xc4')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xc5'));db['Dynamics365Field']=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xc6'));db[_0x94d4('0xc7')]=db['sequelize'][_0x94d4('0x16')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x94d4('0xc8')]=db[_0x94d4('0x4')]['import'](_0x94d4('0xc9'));db[_0x94d4('0xca')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xcb'));db[_0x94d4('0x90')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0x91'));db[_0x94d4('0xcc')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xcd'));db[_0x94d4('0xce')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xcf'));db['ChatInternalMessage']=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x94d4('0xd0')]=db['sequelize'][_0x94d4('0x16')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x94d4('0xd1')]=db[_0x94d4('0x4')]['import'](_0x94d4('0xd2'));db[_0x94d4('0xd3')]=db[_0x94d4('0x4')]['import'](_0x94d4('0xd4'));db['SmsQueueReport']=db['sequelize'][_0x94d4('0x16')](_0x94d4('0xd5'));db[_0x94d4('0xd6')]=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xd7'));db[_0x94d4('0xd8')]=db[_0x94d4('0x4')]['import'](_0x94d4('0xd9'));db[_0x94d4('0xda')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xdb'));db[_0x94d4('0xdc')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xdd'));db[_0x94d4('0xde')]=db[_0x94d4('0x4')]['import'](_0x94d4('0xdf'));db['SquareRecording']=db['sequelize']['import']('../api/squareRecording/squareRecording.model');db[_0x94d4('0xe0')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0xe1'));db['Team']=db['sequelize'][_0x94d4('0x16')](_0x94d4('0xe2'));db['License']=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xe3'));db[_0x94d4('0xe4')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0xe5'));db[_0x94d4('0xe6')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xe7'));db['Attachment']=db['sequelize'][_0x94d4('0x16')](_0x94d4('0xe8'));db['Plugin']=db['sequelize']['import']('../api/plugin/plugin.model');db[_0x94d4('0xe9')]=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db['sequelize'][_0x94d4('0x16')](_0x94d4('0xea'));db[_0x94d4('0xeb')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xec'));db[_0x94d4('0xed')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xee'));db[_0x94d4('0xef')]=db['sequelize'][_0x94d4('0x16')]('../api/smsTransferReport/smsTransferReport.model');db[_0x94d4('0xf0')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xf1'));db[_0x94d4('0xf2')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xf3'));db[_0x94d4('0xf4')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xf5'));db['UserProfileSection']=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/userProfileSection/userProfileSection.model');db[_0x94d4('0xf6')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0xf7'));db[_0x94d4('0xf8')]=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/notification/notification.model');db[_0x94d4('0xf9')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xfa'));db[_0x94d4('0xfb')]=db['sequelize']['import'](_0x94d4('0xfc'));db[_0x94d4('0xfd')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0xfe'));db[_0x94d4('0xff')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x100'));db[_0x94d4('0x101')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x102'));db[_0x94d4('0x103')]=db['sequelize'][_0x94d4('0x16')](_0x94d4('0x104'));db[_0x94d4('0x105')]=db[_0x94d4('0x4')][_0x94d4('0x16')](_0x94d4('0x106'));db[_0x94d4('0x107')]=db[_0x94d4('0x4')][_0x94d4('0x16')]('../api/cloudProvider/cloudProvider.model');db[_0x94d4('0x108')][_0x94d4('0x109')](db[_0x94d4('0x10a')],{'as':'VoiceMail','onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x10c')});db[_0x94d4('0x108')][_0x94d4('0x10d')](db[_0x94d4('0x1d')],{'as':_0x94d4('0x10e'),'foreignKey':'UserId'});db[_0x94d4('0x108')][_0x94d4('0x10d')](db[_0x94d4('0x2d')],{'as':_0x94d4('0x10f'),'foreignKey':'UserId'});db[_0x94d4('0x108')][_0x94d4('0x10d')](db[_0x94d4('0x18')],{'as':_0x94d4('0x110'),'onDelete':_0x94d4('0x10b'),'hooks':!![]});db[_0x94d4('0x108')][_0x94d4('0x10d')](db[_0x94d4('0x111')],{'as':'HopperFinals','foreignKey':_0x94d4('0x10c')});db['User'][_0x94d4('0x10d')](db[_0x94d4('0x7a')],{'as':_0x94d4('0x112'),'foreignKey':'UserId'});db[_0x94d4('0x108')][_0x94d4('0x10d')](db[_0x94d4('0x7b')],{'as':_0x94d4('0x7b'),'foreignKey':_0x94d4('0x10c')});db[_0x94d4('0x108')]['hasMany'](db[_0x94d4('0x61')],{'as':_0x94d4('0x113'),'foreignKey':'UserId'});db[_0x94d4('0x108')][_0x94d4('0x10d')](db[_0x94d4('0x68')],{'as':_0x94d4('0x114'),'foreignKey':_0x94d4('0x10c')});db[_0x94d4('0x108')][_0x94d4('0x10d')](db[_0x94d4('0x115')],{'as':_0x94d4('0x116'),'foreignKey':_0x94d4('0x10c')});db[_0x94d4('0x108')][_0x94d4('0x10d')](db[_0x94d4('0x51')],{'as':_0x94d4('0x117'),'foreignKey':'UserId'});db[_0x94d4('0x108')][_0x94d4('0x10d')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x94d4('0x10c')});db['User'][_0x94d4('0x10d')](db[_0x94d4('0xfd')],{'as':_0x94d4('0x118'),'foreignKey':_0x94d4('0x10c')});db[_0x94d4('0x108')][_0x94d4('0x10d')](db[_0x94d4('0xf8')],{'as':_0x94d4('0x119'),'foreignKey':_0x94d4('0x11a')});db[_0x94d4('0x108')][_0x94d4('0x11b')](db['UserProfile'],{'as':_0x94d4('0xf4'),'foreignKey':'userProfileId'});db[_0x94d4('0x108')][_0x94d4('0x11c')](db[_0x94d4('0x6e')],{'as':_0x94d4('0x11d'),'through':_0x94d4('0x11e')});db[_0x94d4('0x108')][_0x94d4('0x11c')](db[_0x94d4('0x74')],{'as':_0x94d4('0x11f'),'through':_0x94d4('0x120')});db[_0x94d4('0x108')][_0x94d4('0x11c')](db[_0x94d4('0xf0')],{'as':'Lists','through':'cm_user_has_lists'});db[_0x94d4('0x108')][_0x94d4('0x11c')](db[_0x94d4('0x121')],{'through':_0x94d4('0x122')});db[_0x94d4('0x108')][_0x94d4('0x11c')](db['MailInteraction'],{'as':'MailInteractions','through':_0x94d4('0x123')});db[_0x94d4('0x108')][_0x94d4('0x11c')](db[_0x94d4('0x68')],{'as':_0x94d4('0x114'),'through':_0x94d4('0x124')});db[_0x94d4('0x108')][_0x94d4('0x11c')](db['FaxInteraction'],{'as':_0x94d4('0x117'),'through':_0x94d4('0x125')});db[_0x94d4('0x108')][_0x94d4('0x11c')](db[_0x94d4('0x115')],{'as':_0x94d4('0x116'),'through':_0x94d4('0x126')});db['User'][_0x94d4('0x11c')](db[_0x94d4('0x61')],{'as':_0x94d4('0x113'),'through':'user_has_openchannel_interactions'});db[_0x94d4('0x108')][_0x94d4('0x11c')](db['WhatsappInteraction'],{'as':_0x94d4('0x118'),'through':'user_has_whatsapp_interactions'});db[_0x94d4('0x108')][_0x94d4('0x11c')](db['VoiceQueue'],{'as':_0x94d4('0x127'),'through':'UserVoiceQueue','required':![]});db[_0x94d4('0x108')][_0x94d4('0x11c')](db[_0x94d4('0x3f')],{'as':'MailQueues','through':_0x94d4('0x33'),'required':![]});db[_0x94d4('0x108')]['belongsToMany'](db[_0x94d4('0x6c')],{'as':_0x94d4('0x128'),'through':_0x94d4('0x31'),'required':![],'hooks':!![]});db[_0x94d4('0x108')][_0x94d4('0x11c')](db[_0x94d4('0x53')],{'as':_0x94d4('0x129'),'through':_0x94d4('0x35'),'required':![]});db[_0x94d4('0x108')]['belongsToMany'](db[_0x94d4('0x12a')],{'as':_0x94d4('0x12b'),'through':_0x94d4('0x37'),'required':![]});db[_0x94d4('0x108')][_0x94d4('0x11c')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x94d4('0x12c'),'required':![]});db[_0x94d4('0x108')][_0x94d4('0x11c')](db[_0x94d4('0x105')],{'as':'WhatsappQueues','through':_0x94d4('0x3a'),'required':![]});db[_0x94d4('0x108')][_0x94d4('0x11c')](db['CmList'],{'through':'cm_user_has_lists'});db[_0x94d4('0x108')][_0x94d4('0x11c')](db[_0x94d4('0xf2')],{'as':'VoicePrefixes','through':_0x94d4('0x12d'),'required':![]});db[_0x94d4('0x108')][_0x94d4('0x11c')](db[_0x94d4('0x66')],{'as':_0x94d4('0x12e'),'through':_0x94d4('0x12f')});db[_0x94d4('0x108')]['belongsToMany'](db[_0x94d4('0x130')],{'as':'FaxAccounts','through':_0x94d4('0x131')});db[_0x94d4('0x108')]['belongsToMany'](db[_0x94d4('0x132')],{'as':_0x94d4('0x133'),'through':'user_has_mail_accounts'});db[_0x94d4('0x108')][_0x94d4('0x11c')](db[_0x94d4('0x5e')],{'as':_0x94d4('0x134'),'through':_0x94d4('0x135')});db[_0x94d4('0x108')][_0x94d4('0x11c')](db['SmsAccount'],{'as':_0x94d4('0x136'),'through':'user_has_sms_accounts'});db['User']['belongsToMany'](db[_0x94d4('0xf9')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x94d4('0x108')][_0x94d4('0x11c')](db[_0x94d4('0xde')],{'as':'SquareProjects','through':_0x94d4('0x137')});db['VoiceChanSpy'][_0x94d4('0x10d')](db[_0x94d4('0x18')],{'as':_0x94d4('0x138'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0x94d4('0x139')][_0x94d4('0x10d')](db[_0x94d4('0x18')],{'onDelete':_0x94d4('0x10b')});db[_0x94d4('0x18')][_0x94d4('0x10d')](db[_0x94d4('0x18')],{'as':_0x94d4('0x13a'),'onDelete':_0x94d4('0x10b')});db[_0x94d4('0x1a')][_0x94d4('0x11c')](db[_0x94d4('0x89')],{'as':_0x94d4('0x13b'),'through':'moh_has_sounds'});db[_0x94d4('0x1c')][_0x94d4('0x10d')](db['UserVoiceQueueRt'],{'as':_0x94d4('0x13c'),'foreignKey':'VoiceQueueId'});db[_0x94d4('0x1c')][_0x94d4('0x10d')](db[_0x94d4('0x76')],{'as':'Hoppers','foreignKey':_0x94d4('0x13d')});db[_0x94d4('0x1c')][_0x94d4('0x10d')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x94d4('0x13d')});db[_0x94d4('0x1c')][_0x94d4('0x10d')](db['CmHopperHistory'],{'as':_0x94d4('0x13e'),'foreignKey':_0x94d4('0x13d')});db[_0x94d4('0x1c')][_0x94d4('0x10d')](db['ReportAgentPreview'],{'as':_0x94d4('0x7b'),'foreignKey':_0x94d4('0x13d')});db[_0x94d4('0x1c')]['hasMany'](db[_0x94d4('0x13f')],{'as':_0x94d4('0x140'),'foreignKey':_0x94d4('0x13d')});db[_0x94d4('0x1c')][_0x94d4('0x10d')](db[_0x94d4('0xd3')],{'as':_0x94d4('0x141'),'foreignKey':_0x94d4('0x13d')});db[_0x94d4('0x1c')]['belongsTo'](db[_0x94d4('0x29')],{'as':_0x94d4('0x29'),'foreignKey':'TrunkId'});db['VoiceQueue'][_0x94d4('0x11b')](db[_0x94d4('0x29')],{'as':_0x94d4('0x142'),'foreignKey':_0x94d4('0x143')});db[_0x94d4('0x1c')]['belongsTo'](db[_0x94d4('0x144')],{'as':_0x94d4('0x144'),'foreignKey':'IntervalId'});db['VoiceQueue']['belongsTo'](db[_0x94d4('0x145')],{'as':_0x94d4('0x146'),'foreignKey':_0x94d4('0x147')});db[_0x94d4('0x1c')][_0x94d4('0x11c')](db[_0x94d4('0xf0')],{'as':_0x94d4('0x148'),'through':_0x94d4('0x149')});db[_0x94d4('0x1c')][_0x94d4('0x11c')](db[_0x94d4('0x108')],{'as':_0x94d4('0x14a'),'through':'UserVoiceQueue'});db['VoiceQueue']['belongsToMany'](db[_0x94d4('0x121')],{'as':'Teams','through':_0x94d4('0x14b')});db[_0x94d4('0x1c')][_0x94d4('0x11c')](db['CmList'],{'as':_0x94d4('0x14c'),'through':_0x94d4('0x14d')});db[_0x94d4('0x1d')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{'as':_0x94d4('0x108'),'foreignKey':_0x94d4('0x10c')});db[_0x94d4('0x14e')][_0x94d4('0x11b')](db['User'],{'as':'User','foreignKey':_0x94d4('0x10c')});db['VoiceMail'][_0x94d4('0x10d')](db[_0x94d4('0x14f')],{'as':_0x94d4('0x150'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x151'),'sourceKey':'mailbox'});db['VoiceMailMessage'][_0x94d4('0x11b')](db[_0x94d4('0x10a')],{'foreignKey':_0x94d4('0x151'),'targetKey':_0x94d4('0x152')});db[_0x94d4('0x153')]['hasMany'](db[_0x94d4('0x25')],{'as':_0x94d4('0x154'),'foreignKey':_0x94d4('0x155'),'constraints':![]});db[_0x94d4('0x153')][_0x94d4('0x10d')](db[_0x94d4('0x23')],{'as':_0x94d4('0x156'),'foreignKey':_0x94d4('0x155'),'constraints':![]});db[_0x94d4('0x153')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{'as':_0x94d4('0x108'),'foreignKey':_0x94d4('0x10c')});db[_0x94d4('0x153')][_0x94d4('0x11b')](db[_0x94d4('0x74')],{'as':_0x94d4('0x157'),'foreignKey':_0x94d4('0x158')});db[_0x94d4('0x159')][_0x94d4('0x11b')](db[_0x94d4('0x132')],{'as':_0x94d4('0x132'),'foreignKey':'MailAccountId'});db[_0x94d4('0x3c')]['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x94d4('0x132')][_0x94d4('0x109')](db[_0x94d4('0x159')],{'as':'Imap','onDelete':_0x94d4('0x10b')});db[_0x94d4('0x132')][_0x94d4('0x109')](db['MailServerOut'],{'as':_0x94d4('0x15a'),'onDelete':_0x94d4('0x10b')});db[_0x94d4('0x132')][_0x94d4('0x10d')](db['Disposition'],{'as':_0x94d4('0x15b'),'foreignKey':'MailAccountId'});db[_0x94d4('0x132')][_0x94d4('0x10d')](db[_0x94d4('0x15c')],{'as':_0x94d4('0x15d'),'foreignKey':_0x94d4('0x15e')});db[_0x94d4('0x132')][_0x94d4('0x10d')](db['MailMessage'],{'as':_0x94d4('0x150'),'foreignKey':_0x94d4('0x15e')});db[_0x94d4('0x132')][_0x94d4('0x10d')](db[_0x94d4('0x43')],{'as':'Interactions'});db[_0x94d4('0x132')]['hasMany'](db[_0x94d4('0x47')],{'as':'Applications'});db[_0x94d4('0x132')][_0x94d4('0x11b')](db[_0x94d4('0xf0')],{'as':_0x94d4('0x15f'),'foreignKey':_0x94d4('0x160')});db[_0x94d4('0x132')][_0x94d4('0x11b')](db['Template'],{'as':_0x94d4('0x8c'),'foreignKey':'TemplateId'});db['MailAccount'][_0x94d4('0x11b')](db[_0x94d4('0x145')],{'as':_0x94d4('0x146'),'foreignKey':_0x94d4('0x147')});db[_0x94d4('0x132')]['belongsToMany'](db[_0x94d4('0x108')],{'as':_0x94d4('0x14a'),'through':'user_has_mail_accounts'});db[_0x94d4('0x3f')]['belongsToMany'](db[_0x94d4('0x108')],{'as':_0x94d4('0x14a'),'through':_0x94d4('0x33')});db['MailQueue']['belongsToMany'](db[_0x94d4('0x121')],{'through':'team_has_mail_queues','as':'Teams'});db['MailInteraction'][_0x94d4('0x10d')](db['MailMessage'],{'as':_0x94d4('0x150'),'onDelete':'cascade','foreignKey':_0x94d4('0x161')});db[_0x94d4('0x43')][_0x94d4('0x11b')](db[_0x94d4('0x132')],{'as':_0x94d4('0x162'),'foreignKey':'MailAccountId'});db[_0x94d4('0x43')][_0x94d4('0x11b')](db[_0x94d4('0x74')],{'as':_0x94d4('0x157'),'foreignKey':_0x94d4('0x158')});db[_0x94d4('0x43')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{'as':'Owner','foreignKey':_0x94d4('0x10c')});db[_0x94d4('0x43')][_0x94d4('0x11c')](db[_0x94d4('0x8a')],{'through':_0x94d4('0x163'),'as':_0x94d4('0x164')});db[_0x94d4('0x43')][_0x94d4('0x11c')](db['Tag'],{'through':_0x94d4('0x163'),'as':_0x94d4('0x165')});db[_0x94d4('0x43')][_0x94d4('0x11c')](db['User'],{'as':_0x94d4('0x166'),'through':_0x94d4('0x123'),'foreignKey':_0x94d4('0x161')});db[_0x94d4('0x45')]['hasMany'](db[_0x94d4('0x167')],{'as':_0x94d4('0x168'),'onDelete':'cascade'});db[_0x94d4('0x45')][_0x94d4('0x11b')](db['User'],{'as':'User'});db['MailMessage'][_0x94d4('0x11b')](db[_0x94d4('0x74')],{'onDelete':_0x94d4('0x10b'),'as':_0x94d4('0x157')});db[_0x94d4('0x45')][_0x94d4('0x11b')](db[_0x94d4('0x43')],{'as':_0x94d4('0x169'),'foreignKey':_0x94d4('0x161')});db[_0x94d4('0x45')][_0x94d4('0x11b')](db['MailAccount'],{'as':_0x94d4('0x162'),'foreignKey':_0x94d4('0x15e')});db[_0x94d4('0x47')]['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0x94d4('0x47')]['belongsTo'](db[_0x94d4('0x3f')],{'onDelete':_0x94d4('0x16a')});db['MailApplication'][_0x94d4('0x11b')](db[_0x94d4('0x132')],{'onDelete':_0x94d4('0x16a')});db['MailApplication']['belongsTo'](db[_0x94d4('0x144')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x94d4('0x47')][_0x94d4('0x11b')](db[_0x94d4('0x8a')],{'onDelete':_0x94d4('0x16a'),'foreignKey':_0x94d4('0x16b')});db[_0x94d4('0x49')][_0x94d4('0x11b')](db['MailAccount'],{});db[_0x94d4('0x49')][_0x94d4('0x11b')](db['CmList'],{'as':_0x94d4('0x15f'),'foreignKey':_0x94d4('0x160')});db[_0x94d4('0x49')][_0x94d4('0x11b')](db['CmContact'],{'as':_0x94d4('0x157'),'foreignKey':_0x94d4('0x158')});db[_0x94d4('0x49')][_0x94d4('0x11b')](db[_0x94d4('0x43')],{});db[_0x94d4('0x49')]['belongsTo'](db[_0x94d4('0x45')],{});db['MailQueueReport'][_0x94d4('0x11b')](db[_0x94d4('0x108')],{});db['MailQueueReport'][_0x94d4('0x11b')](db['MailQueue'],{});db[_0x94d4('0x4b')][_0x94d4('0x10d')](db[_0x94d4('0x4c')],{'as':_0x94d4('0x16c'),'onDelete':'cascade'});db[_0x94d4('0x130')][_0x94d4('0x10d')](db[_0x94d4('0x81')],{'as':_0x94d4('0x15b'),'foreignKey':_0x94d4('0x16d')});db[_0x94d4('0x130')]['hasMany'](db[_0x94d4('0x15c')],{'as':_0x94d4('0x15d'),'foreignKey':'FaxAccountId'});db[_0x94d4('0x130')][_0x94d4('0x10d')](db[_0x94d4('0x51')],{'as':_0x94d4('0x16e')});db['FaxAccount'][_0x94d4('0x10d')](db[_0x94d4('0x4f')],{'as':_0x94d4('0x13a')});db['FaxAccount'][_0x94d4('0x10d')](db[_0x94d4('0x18')],{'as':'Exntensions','onDelete':_0x94d4('0x10b')});db['FaxAccount'][_0x94d4('0x10d')](db['FaxMessage'],{'as':_0x94d4('0x150')});db[_0x94d4('0x130')][_0x94d4('0x11b')](db[_0x94d4('0x29')],{'as':_0x94d4('0x29')});db[_0x94d4('0x130')][_0x94d4('0x11b')](db[_0x94d4('0xf0')],{'as':_0x94d4('0x15f'),'foreignKey':_0x94d4('0x160')});db[_0x94d4('0x130')][_0x94d4('0x11b')](db[_0x94d4('0x145')],{'as':_0x94d4('0x146'),'foreignKey':_0x94d4('0x147')});db['FaxAccount'][_0x94d4('0x11c')](db['User'],{'as':_0x94d4('0x14a'),'through':_0x94d4('0x131')});db[_0x94d4('0x4f')][_0x94d4('0x11b')](db['User'],{'onDelete':'restrict'});db['FaxApplication'][_0x94d4('0x11b')](db[_0x94d4('0x53')],{'onDelete':_0x94d4('0x16a')});db[_0x94d4('0x4f')][_0x94d4('0x11b')](db['FaxAccount'],{'onDelete':_0x94d4('0x16a')});db[_0x94d4('0x4f')][_0x94d4('0x11b')](db['Tag'],{'onDelete':_0x94d4('0x16a'),'foreignKey':_0x94d4('0x16b')});db[_0x94d4('0x51')][_0x94d4('0x10d')](db[_0x94d4('0x16f')],{'as':'Messages','onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x170')});db[_0x94d4('0x51')][_0x94d4('0x11b')](db['FaxAccount'],{'as':_0x94d4('0x162'),'foreignKey':_0x94d4('0x16d')});db[_0x94d4('0x51')]['belongsTo'](db[_0x94d4('0x74')],{'as':_0x94d4('0x157'),'foreignKey':_0x94d4('0x158')});db['FaxInteraction']['belongsTo'](db[_0x94d4('0x108')],{'as':_0x94d4('0x171'),'foreignKey':_0x94d4('0x10c')});db[_0x94d4('0x51')][_0x94d4('0x11c')](db[_0x94d4('0x8a')],{'through':_0x94d4('0x172'),'as':_0x94d4('0x164')});db['FaxInteraction'][_0x94d4('0x11c')](db[_0x94d4('0x8a')],{'through':_0x94d4('0x172'),'as':'ThroughTags'});db[_0x94d4('0x51')][_0x94d4('0x11c')](db[_0x94d4('0x108')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0x94d4('0x170')});db[_0x94d4('0x16f')][_0x94d4('0x11b')](db['User'],{'onDelete':'cascade','as':_0x94d4('0x108')});db[_0x94d4('0x16f')][_0x94d4('0x11b')](db[_0x94d4('0x51')],{'as':_0x94d4('0x169'),'foreignKey':'FaxInteractionId'});db['FaxMessage']['belongsTo'](db[_0x94d4('0x74')],{'onDelete':_0x94d4('0x10b'),'as':_0x94d4('0x157')});db[_0x94d4('0x16f')][_0x94d4('0x11b')](db[_0x94d4('0x167')],{'as':'Attachment','foreignKey':_0x94d4('0x173')});db['FaxMessage'][_0x94d4('0x11b')](db['FaxAccount'],{'as':_0x94d4('0x162'),'foreignKey':'FaxAccountId'});db[_0x94d4('0x53')][_0x94d4('0x11c')](db[_0x94d4('0x108')],{'as':_0x94d4('0x14a'),'through':_0x94d4('0x35')});db[_0x94d4('0x53')][_0x94d4('0x11c')](db[_0x94d4('0x121')],{'through':_0x94d4('0x174'),'as':'Teams'});db[_0x94d4('0x55')][_0x94d4('0x11b')](db['FaxAccount'],{});db[_0x94d4('0x55')][_0x94d4('0x11b')](db[_0x94d4('0xf0')],{'as':_0x94d4('0x15f'),'foreignKey':'ListId'});db[_0x94d4('0x55')][_0x94d4('0x11b')](db[_0x94d4('0x74')],{'as':_0x94d4('0x157'),'foreignKey':_0x94d4('0x158')});db['FaxQueueReport'][_0x94d4('0x11b')](db[_0x94d4('0x51')],{});db[_0x94d4('0x55')][_0x94d4('0x11b')](db[_0x94d4('0x16f')],{});db[_0x94d4('0x55')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{});db[_0x94d4('0x55')][_0x94d4('0x11b')](db['FaxQueue'],{});db[_0x94d4('0x57')]['hasMany'](db[_0x94d4('0x81')],{'as':_0x94d4('0x15b'),'foreignKey':'SmsAccountId'});db[_0x94d4('0x57')][_0x94d4('0x10d')](db[_0x94d4('0x15c')],{'as':_0x94d4('0x15d'),'foreignKey':_0x94d4('0x175')});db['SmsAccount'][_0x94d4('0x10d')](db[_0x94d4('0x5b')],{'as':'Messages','foreignKey':_0x94d4('0x175')});db['SmsAccount'][_0x94d4('0x10d')](db[_0x94d4('0x115')],{'as':'Interactions'});db[_0x94d4('0x57')][_0x94d4('0x10d')](db[_0x94d4('0x58')],{'as':_0x94d4('0x13a')});db[_0x94d4('0x57')][_0x94d4('0x11b')](db[_0x94d4('0xf0')],{'as':'List','foreignKey':'ListId'});db[_0x94d4('0x57')][_0x94d4('0x11b')](db[_0x94d4('0x145')],{'as':_0x94d4('0x146'),'foreignKey':_0x94d4('0x147')});db[_0x94d4('0x57')][_0x94d4('0x11c')](db['User'],{'as':_0x94d4('0x14a'),'through':_0x94d4('0x176')});db['SmsApplication']['belongsTo'](db[_0x94d4('0x108')],{'onDelete':_0x94d4('0x16a')});db[_0x94d4('0x58')]['belongsTo'](db[_0x94d4('0x12a')],{'onDelete':_0x94d4('0x16a')});db[_0x94d4('0x58')][_0x94d4('0x11b')](db[_0x94d4('0x57')],{'onDelete':_0x94d4('0x16a')});db['SmsApplication']['belongsTo'](db[_0x94d4('0x144')],{'onDelete':_0x94d4('0x16a'),'foreignKey':'IntervalId'});db[_0x94d4('0x58')][_0x94d4('0x11b')](db['Tag'],{'onDelete':_0x94d4('0x16a'),'foreignKey':_0x94d4('0x16b')});db[_0x94d4('0x115')][_0x94d4('0x10d')](db[_0x94d4('0x5b')],{'as':_0x94d4('0x150'),'onDelete':_0x94d4('0x10b'),'foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0x94d4('0x11b')](db[_0x94d4('0x57')],{'as':'Account','foreignKey':_0x94d4('0x175')});db['SmsInteraction'][_0x94d4('0x11b')](db[_0x94d4('0x74')],{'as':_0x94d4('0x157'),'foreignKey':_0x94d4('0x158')});db[_0x94d4('0x115')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{'as':_0x94d4('0x171'),'foreignKey':'UserId'});db[_0x94d4('0x115')][_0x94d4('0x11c')](db[_0x94d4('0x8a')],{'through':'sms_interaction_has_tags','as':'Tags'});db[_0x94d4('0x115')][_0x94d4('0x11c')](db[_0x94d4('0x8a')],{'through':'sms_interaction_has_tags','as':_0x94d4('0x165')});db[_0x94d4('0x115')][_0x94d4('0x11c')](db['User'],{'as':_0x94d4('0x166'),'through':_0x94d4('0x126'),'foreignKey':'SmsInteractionId'});db[_0x94d4('0x5b')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{'as':'User'});db[_0x94d4('0x5b')][_0x94d4('0x11b')](db[_0x94d4('0x74')],{'onDelete':_0x94d4('0x10b'),'as':_0x94d4('0x157')});db['SmsMessage'][_0x94d4('0x11b')](db[_0x94d4('0x115')],{'onDelete':'cascade','as':_0x94d4('0x169'),'foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db[_0x94d4('0x57')],{'as':_0x94d4('0x162'),'foreignKey':_0x94d4('0x175')});db[_0x94d4('0x12a')][_0x94d4('0x11c')](db[_0x94d4('0x108')],{'as':_0x94d4('0x14a'),'through':_0x94d4('0x37'),'foreignKey':_0x94d4('0x177')});db[_0x94d4('0x12a')][_0x94d4('0x11c')](db['Team'],{'through':_0x94d4('0x178'),'as':_0x94d4('0x179')});db['OpenchannelAccount'][_0x94d4('0x10d')](db[_0x94d4('0x81')],{'as':_0x94d4('0x15b'),'foreignKey':'OpenchannelAccountId'});db[_0x94d4('0x5e')]['hasMany'](db[_0x94d4('0x15c')],{'as':_0x94d4('0x15d'),'foreignKey':'OpenchannelAccountId'});db[_0x94d4('0x5e')][_0x94d4('0x10d')](db['OpenchannelInteraction'],{'as':_0x94d4('0x16e'),'foreignKey':_0x94d4('0x17a')});db[_0x94d4('0x5e')][_0x94d4('0x10d')](db[_0x94d4('0x63')],{'as':_0x94d4('0x150'),'foreignKey':'OpenchannelAccountId'});db[_0x94d4('0x5e')]['hasMany'](db[_0x94d4('0x17b')],{'as':_0x94d4('0x13a'),'foreignKey':_0x94d4('0x17a')});db[_0x94d4('0x5e')][_0x94d4('0x11b')](db['CmList'],{'as':_0x94d4('0x15f'),'foreignKey':_0x94d4('0x160')});db['OpenchannelAccount'][_0x94d4('0x11b')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x94d4('0x147')});db[_0x94d4('0x5e')]['belongsToMany'](db[_0x94d4('0x108')],{'as':_0x94d4('0x14a'),'through':_0x94d4('0x135')});db['OpenchannelApplication'][_0x94d4('0x11b')](db[_0x94d4('0x108')],{'onDelete':'restrict'});db[_0x94d4('0x17b')][_0x94d4('0x11b')](db[_0x94d4('0x17c')],{'onDelete':_0x94d4('0x16a'),'foreignKey':_0x94d4('0x17d')});db['OpenchannelApplication'][_0x94d4('0x11b')](db[_0x94d4('0x5e')],{'onDelete':_0x94d4('0x16a'),'foreignKey':'OpenchannelAccountId'});db[_0x94d4('0x17b')][_0x94d4('0x11b')](db['Interval'],{'onDelete':_0x94d4('0x16a'),'foreignKey':_0x94d4('0x17e')});db[_0x94d4('0x17b')][_0x94d4('0x11b')](db[_0x94d4('0x8a')],{'onDelete':_0x94d4('0x16a'),'foreignKey':_0x94d4('0x16b')});db['OpenchannelInteraction'][_0x94d4('0x10d')](db[_0x94d4('0x63')],{'as':_0x94d4('0x150'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x17f')});db[_0x94d4('0x61')][_0x94d4('0x11b')](db['OpenchannelAccount'],{'as':_0x94d4('0x162'),'foreignKey':_0x94d4('0x17a')});db[_0x94d4('0x61')][_0x94d4('0x11b')](db[_0x94d4('0x74')],{'as':_0x94d4('0x157'),'foreignKey':_0x94d4('0x158')});db[_0x94d4('0x61')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{'as':_0x94d4('0x171'),'foreignKey':_0x94d4('0x10c')});db[_0x94d4('0x61')][_0x94d4('0x11c')](db[_0x94d4('0x8a')],{'through':_0x94d4('0x180'),'as':'Tags'});db['OpenchannelInteraction'][_0x94d4('0x11c')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0x94d4('0x61')][_0x94d4('0x11c')](db[_0x94d4('0x108')],{'as':_0x94d4('0x166'),'through':'user_has_openchannel_interactions','foreignKey':_0x94d4('0x17f')});db[_0x94d4('0x63')][_0x94d4('0x11b')](db['User'],{'onDelete':_0x94d4('0x10b'),'as':_0x94d4('0x108')});db['OpenchannelMessage']['belongsTo'](db[_0x94d4('0x74')],{'onDelete':_0x94d4('0x10b'),'as':'Contact'});db[_0x94d4('0x63')][_0x94d4('0x11b')](db['OpenchannelInteraction'],{'onDelete':_0x94d4('0x10b'),'as':_0x94d4('0x169'),'foreignKey':_0x94d4('0x17f')});db[_0x94d4('0x63')][_0x94d4('0x11b')](db[_0x94d4('0x167')],{'as':'Attachment','foreignKey':_0x94d4('0x173')});db['OpenchannelMessage'][_0x94d4('0x11b')](db[_0x94d4('0x5e')],{'as':_0x94d4('0x162'),'foreignKey':_0x94d4('0x17a')});db[_0x94d4('0x17c')][_0x94d4('0x11c')](db[_0x94d4('0x108')],{'as':'Agents','through':_0x94d4('0x12c'),'foreignKey':_0x94d4('0x17d')});db['OpenchannelQueue']['belongsToMany'](db['Team'],{'through':_0x94d4('0x181'),'as':_0x94d4('0x179')});db[_0x94d4('0x66')][_0x94d4('0x10d')](db[_0x94d4('0x81')],{'as':_0x94d4('0x15b'),'foreignKey':_0x94d4('0x182')});db[_0x94d4('0x66')][_0x94d4('0x10d')](db['CannedAnswer'],{'as':'Answers','foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x94d4('0x10d')](db[_0x94d4('0x70')],{'as':_0x94d4('0x183')});db[_0x94d4('0x66')][_0x94d4('0x10d')](db['ChatInteraction'],{'as':_0x94d4('0x16e')});db[_0x94d4('0x66')]['hasMany'](db[_0x94d4('0x67')],{'as':_0x94d4('0x13a')});db[_0x94d4('0x66')][_0x94d4('0x10d')](db[_0x94d4('0x6a')],{'as':_0x94d4('0x150')});db[_0x94d4('0x66')][_0x94d4('0x11b')](db['CmList'],{'as':_0x94d4('0x15f'),'foreignKey':_0x94d4('0x160')});db[_0x94d4('0x66')][_0x94d4('0x11b')](db[_0x94d4('0x144')],{'as':_0x94d4('0x144'),'foreignKey':'IntervalId'});db['ChatWebsite'][_0x94d4('0x11b')](db[_0x94d4('0x145')],{'as':'mandatoryDispositionPause','foreignKey':_0x94d4('0x147')});db[_0x94d4('0x66')]['belongsToMany'](db[_0x94d4('0x108')],{'as':_0x94d4('0x14a'),'through':_0x94d4('0x12f')});db['OpenchannelQueueReport']['belongsTo'](db[_0x94d4('0x5e')],{});db[_0x94d4('0x184')][_0x94d4('0x11b')](db[_0x94d4('0xf0')],{'as':_0x94d4('0x15f'),'foreignKey':_0x94d4('0x160')});db['OpenchannelQueueReport'][_0x94d4('0x11b')](db['CmContact'],{'as':_0x94d4('0x157'),'foreignKey':_0x94d4('0x158')});db[_0x94d4('0x184')][_0x94d4('0x11b')](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0x94d4('0x11b')](db[_0x94d4('0x63')],{});db[_0x94d4('0x184')]['belongsTo'](db[_0x94d4('0x108')],{});db[_0x94d4('0x184')][_0x94d4('0x11b')](db['OpenchannelQueue'],{});db[_0x94d4('0x67')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{'as':_0x94d4('0x185'),'foreignKey':'UserId','onDelete':_0x94d4('0x16a')});db[_0x94d4('0x67')][_0x94d4('0x11b')](db['ChatQueue'],{'as':_0x94d4('0x186'),'foreignKey':_0x94d4('0x187'),'onDelete':'restrict'});db[_0x94d4('0x67')][_0x94d4('0x11b')](db['ChatWebsite'],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0x94d4('0x67')][_0x94d4('0x11b')](db[_0x94d4('0x8a')],{'onDelete':_0x94d4('0x16a'),'foreignKey':_0x94d4('0x16b')});db['ChatInteraction']['hasMany'](db[_0x94d4('0x6a')],{'as':_0x94d4('0x150'),'onDelete':_0x94d4('0x10b'),'foreignKey':'ChatInteractionId'});db[_0x94d4('0x68')][_0x94d4('0x11b')](db[_0x94d4('0x66')],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0x94d4('0x11b')](db[_0x94d4('0x74')],{'as':_0x94d4('0x157'),'foreignKey':_0x94d4('0x158')});db[_0x94d4('0x68')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{'as':_0x94d4('0x171'),'foreignKey':_0x94d4('0x10c')});db[_0x94d4('0x68')][_0x94d4('0x11c')](db[_0x94d4('0x8a')],{'through':'chat_interaction_has_tags','as':_0x94d4('0x164')});db[_0x94d4('0x68')][_0x94d4('0x11c')](db[_0x94d4('0x8a')],{'through':_0x94d4('0x188'),'as':'ThroughTags'});db[_0x94d4('0x68')]['belongsToMany'](db[_0x94d4('0x108')],{'as':_0x94d4('0x166'),'through':_0x94d4('0x124'),'foreignKey':_0x94d4('0x189')});db[_0x94d4('0x6a')][_0x94d4('0x11b')](db['User'],{'onDelete':_0x94d4('0x10b'),'as':_0x94d4('0x108')});db[_0x94d4('0x6a')][_0x94d4('0x11b')](db[_0x94d4('0x74')],{'onDelete':_0x94d4('0x10b'),'as':_0x94d4('0x157'),'foreignKey':'ContactId'});db[_0x94d4('0x6a')]['belongsTo'](db[_0x94d4('0x68')],{'onDelete':_0x94d4('0x10b'),'as':'Interaction','foreignKey':_0x94d4('0x189')});db[_0x94d4('0x6a')]['belongsTo'](db['Attachment'],{'as':_0x94d4('0x167'),'foreignKey':'AttachmentId'});db[_0x94d4('0x6a')][_0x94d4('0x11b')](db['ChatWebsite'],{'as':_0x94d4('0x162'),'foreignKey':_0x94d4('0x182')});db[_0x94d4('0x6b')][_0x94d4('0x11b')](db[_0x94d4('0x74')],{'onDelete':_0x94d4('0x10b'),'as':_0x94d4('0x157'),'foreignKey':_0x94d4('0x158')});db[_0x94d4('0x6b')][_0x94d4('0x11b')](db[_0x94d4('0x66')],{'as':_0x94d4('0x162'),'foreignKey':_0x94d4('0x182')});db[_0x94d4('0x6c')][_0x94d4('0x11c')](db['User'],{'as':_0x94d4('0x14a'),'through':_0x94d4('0x31'),'hooks':!![]});db[_0x94d4('0x6c')][_0x94d4('0x11c')](db['Team'],{'through':_0x94d4('0x18a'),'as':'Teams'});db['ChatGroup'][_0x94d4('0x10d')](db['ChatInternalMessage'],{'as':_0x94d4('0x150'),'foreignKey':_0x94d4('0x18b'),'onDelete':'cascade'});db[_0x94d4('0x6e')][_0x94d4('0x11c')](db[_0x94d4('0x108')],{'as':_0x94d4('0x13c'),'through':_0x94d4('0x11e')});db[_0x94d4('0x70')][_0x94d4('0x11b')](db[_0x94d4('0x66')],{'as':_0x94d4('0x18c'),'foreignKey':_0x94d4('0x182')});db[_0x94d4('0x72')][_0x94d4('0x10d')](db[_0x94d4('0x74')],{'as':_0x94d4('0x11f'),'foreignKey':_0x94d4('0x18d')});db[_0x94d4('0x74')][_0x94d4('0x10d')](db[_0x94d4('0x76')],{'as':_0x94d4('0x18e'),'foreignKey':_0x94d4('0x158')});db[_0x94d4('0x74')][_0x94d4('0x10d')](db[_0x94d4('0x111')],{'as':_0x94d4('0x18f'),'foreignKey':_0x94d4('0x158')});db['CmContact']['hasMany'](db[_0x94d4('0x7a')],{'as':_0x94d4('0x13e'),'foreignKey':_0x94d4('0x158')});db['CmContact']['hasMany'](db['ReportAgentPreview'],{'as':_0x94d4('0x7b'),'foreignKey':_0x94d4('0x158')});db[_0x94d4('0x74')][_0x94d4('0x10d')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x94d4('0x158')});db[_0x94d4('0x74')][_0x94d4('0x10d')](db[_0x94d4('0x61')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x94d4('0x16a')});db[_0x94d4('0x74')][_0x94d4('0x10d')](db[_0x94d4('0x68')],{'as':_0x94d4('0x114'),'foreignKey':_0x94d4('0x158'),'onDelete':'restrict'});db[_0x94d4('0x74')]['hasMany'](db['SmsInteraction'],{'as':_0x94d4('0x116'),'foreignKey':'ContactId','onDelete':_0x94d4('0x16a')});db[_0x94d4('0x74')][_0x94d4('0x10d')](db['FaxInteraction'],{'as':_0x94d4('0x117'),'foreignKey':_0x94d4('0x158'),'onDelete':_0x94d4('0x16a')});db['CmContact'][_0x94d4('0x10d')](db[_0x94d4('0x43')],{'as':_0x94d4('0x190'),'foreignKey':_0x94d4('0x158'),'onDelete':_0x94d4('0x16a')});db[_0x94d4('0x74')]['belongsTo'](db[_0x94d4('0x72')],{'as':'Company','foreignKey':_0x94d4('0x18d')});db[_0x94d4('0x74')][_0x94d4('0x11b')](db[_0x94d4('0xf0')],{'as':'List','foreignKey':_0x94d4('0x160'),'onDelete':_0x94d4('0x10b')});db['CmContact'][_0x94d4('0x11c')](db['User'],{'as':_0x94d4('0x166'),'through':'cm_user_has_contacts'});db['CmContact'][_0x94d4('0x11c')](db[_0x94d4('0x8a')],{'as':_0x94d4('0x164'),'through':_0x94d4('0x191')});db[_0x94d4('0x74')][_0x94d4('0x11c')](db['Tag'],{'through':'cm_contact_has_tags','as':_0x94d4('0x165')});db[_0x94d4('0x76')]['belongsTo'](db['CmContact'],{'as':_0x94d4('0x157'),'foreignKey':_0x94d4('0x158'),'onDelete':'cascade'});db[_0x94d4('0x76')]['belongsTo'](db[_0x94d4('0xf0')],{'as':_0x94d4('0x15f'),'foreignKey':_0x94d4('0x160'),'onDelete':_0x94d4('0x10b')});db[_0x94d4('0x76')][_0x94d4('0x11b')](db['User'],{'as':_0x94d4('0x185'),'foreignKey':_0x94d4('0x10c')});db['CmHopper'][_0x94d4('0x11b')](db[_0x94d4('0x1c')],{'as':_0x94d4('0x186'),'foreignKey':'VoiceQueueId','onDelete':_0x94d4('0x10b')});db[_0x94d4('0x76')][_0x94d4('0x11b')](db[_0x94d4('0xe4')],{'as':'Campaign','foreignKey':_0x94d4('0x192'),'onDelete':_0x94d4('0x10b')});db[_0x94d4('0x76')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{'as':_0x94d4('0x171'),'foreignKey':'OwnerId'});db[_0x94d4('0x13f')]['belongsTo'](db['CmContact'],{'as':_0x94d4('0x157'),'foreignKey':'ContactId','onDelete':_0x94d4('0x10b')});db[_0x94d4('0x13f')]['belongsTo'](db[_0x94d4('0xf0')],{'as':_0x94d4('0x15f'),'foreignKey':_0x94d4('0x160'),'onDelete':_0x94d4('0x10b')});db['CmHopperBlack']['belongsTo'](db[_0x94d4('0x1c')],{'as':'Queue','foreignKey':_0x94d4('0x13d'),'onDelete':_0x94d4('0x10b')});db[_0x94d4('0x13f')]['belongsTo'](db[_0x94d4('0xe4')],{'as':_0x94d4('0xe4'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0x94d4('0x7e')][_0x94d4('0x10d')](db[_0x94d4('0x83')],{'as':{'plural':_0x94d4('0x193'),'singular':_0x94d4('0x194')},'foreignKey':'AutomationAllId','onDelete':_0x94d4('0x10b'),'hooks':!![]});db[_0x94d4('0x7e')][_0x94d4('0x10d')](db[_0x94d4('0x83')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0x94d4('0x195'),'onDelete':'cascade','hooks':!![]});db[_0x94d4('0x7e')]['hasMany'](db['Action'],{'as':_0x94d4('0x196'),'foreignKey':_0x94d4('0x197'),'onDelete':_0x94d4('0x10b'),'hooks':!![]});db[_0x94d4('0x144')][_0x94d4('0x10d')](db[_0x94d4('0x144')],{'as':_0x94d4('0x198'),'foreignKey':'IntervalId','onDelete':_0x94d4('0x10b'),'hooks':!![],'required':![]});db[_0x94d4('0x144')][_0x94d4('0x10d')](db[_0x94d4('0x18')],{'as':_0x94d4('0x110'),'foreignKey':'IntervalId','onDelete':_0x94d4('0x16a')});db[_0x94d4('0x144')]['hasMany'](db[_0x94d4('0x47')],{'as':_0x94d4('0x199'),'foreignKey':_0x94d4('0x17e')});db[_0x94d4('0x144')][_0x94d4('0x10d')](db[_0x94d4('0x67')],{'as':_0x94d4('0x19a'),'foreignKey':'IntervalId'});db[_0x94d4('0x144')][_0x94d4('0x10d')](db[_0x94d4('0x4f')],{'as':_0x94d4('0x19b'),'foreignKey':'IntervalId'});db[_0x94d4('0x144')][_0x94d4('0x10d')](db['SmsApplication'],{'as':_0x94d4('0x19c'),'foreignKey':'IntervalId'});db[_0x94d4('0x87')][_0x94d4('0x11b')](db[_0x94d4('0x132')],{});db[_0x94d4('0x87')][_0x94d4('0x11b')](db[_0x94d4('0x96')],{'foreignKey':'DefaultReportId'});db[_0x94d4('0x87')][_0x94d4('0x11b')](db['AnalyticCustomReport'],{'foreignKey':_0x94d4('0x19d')});db[_0x94d4('0x89')]['belongsToMany'](db[_0x94d4('0x1a')],{'as':_0x94d4('0x19e'),'through':_0x94d4('0x19f'),'onDelete':_0x94d4('0x16a')});db[_0x94d4('0x8a')][_0x94d4('0x11c')](db['CmContact'],{'through':_0x94d4('0x191')});db[_0x94d4('0x8a')]['belongsToMany'](db[_0x94d4('0x68')],{'through':_0x94d4('0x188')});db[_0x94d4('0x8a')][_0x94d4('0x11c')](db[_0x94d4('0x43')],{'through':_0x94d4('0x163')});db[_0x94d4('0x8a')][_0x94d4('0x11c')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0x94d4('0x8a')][_0x94d4('0x11c')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db['Tag'][_0x94d4('0x11c')](db[_0x94d4('0x61')],{'through':_0x94d4('0x180')});db[_0x94d4('0x8a')][_0x94d4('0x11c')](db[_0x94d4('0xfd')],{'through':_0x94d4('0x1a0')});db[_0x94d4('0x1a1')][_0x94d4('0x10d')](db[_0x94d4('0x83')],{'as':{'plural':_0x94d4('0x1a2'),'singular':_0x94d4('0x1a3')},'foreignKey':_0x94d4('0x1a4'),'onDelete':_0x94d4('0x10b'),'hooks':!![]});db[_0x94d4('0x1a1')][_0x94d4('0x10d')](db[_0x94d4('0x83')],{'as':{'plural':'AnyConditions','singular':_0x94d4('0x1a5')},'foreignKey':_0x94d4('0x1a6'),'onDelete':_0x94d4('0x10b'),'hooks':!![]});db['Trigger'][_0x94d4('0x10d')](db[_0x94d4('0x7d')],{'as':_0x94d4('0x196'),'foreignKey':_0x94d4('0x1a7'),'onDelete':_0x94d4('0x10b'),'hooks':!![]});db[_0x94d4('0x94')]['hasMany'](db[_0x94d4('0x9b')],{'as':_0x94d4('0x1a8'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x19d'),'hooks':!![]});db[_0x94d4('0x96')][_0x94d4('0x10d')](db[_0x94d4('0x9b')],{'as':_0x94d4('0x1a8'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1a9')});db['AnalyticMetric'][_0x94d4('0x10d')](db[_0x94d4('0x9b')],{'as':_0x94d4('0x1a8'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1aa')});db[_0x94d4('0x9b')][_0x94d4('0x11b')](db[_0x94d4('0x99')],{'foreignKey':_0x94d4('0x1aa')});db[_0x94d4('0x9f')][_0x94d4('0x10d')](db[_0x94d4('0xa1')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x94d4('0x1ab')});db[_0x94d4('0xa1')][_0x94d4('0x10d')](db[_0x94d4('0xa2')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x94d4('0xa1')][_0x94d4('0x10d')](db[_0x94d4('0xa2')],{'as':_0x94d4('0x1ac'),'onDelete':'cascade','foreignKey':_0x94d4('0x1ad')});db[_0x94d4('0xa1')][_0x94d4('0x10d')](db[_0x94d4('0xa2')],{'as':_0x94d4('0x1a8'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1ae')});db[_0x94d4('0xa1')][_0x94d4('0x11b')](db['SalesforceAccount'],{'as':_0x94d4('0x162'),'foreignKey':_0x94d4('0x1ab')});db[_0x94d4('0xa2')][_0x94d4('0x10d')](db[_0x94d4('0xa2')],{'as':_0x94d4('0x1af'),'foreignKey':_0x94d4('0x1b0')});db[_0x94d4('0xa2')][_0x94d4('0x10d')](db[_0x94d4('0xa2')],{'as':_0x94d4('0x1b1'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0x94d4('0x10d')](db[_0x94d4('0xa2')],{'as':_0x94d4('0x1b2'),'foreignKey':'FieldId'});db[_0x94d4('0xa2')]['belongsTo'](db[_0x94d4('0x1b3')],{'as':'Variable','foreignKey':_0x94d4('0x1b4')});db[_0x94d4('0xa4')][_0x94d4('0x10d')](db[_0x94d4('0xa6')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x94d4('0xa6')]['hasMany'](db[_0x94d4('0x1b5')],{'as':_0x94d4('0x1b6'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1b0')});db['SugarcrmConfiguration'][_0x94d4('0x10d')](db[_0x94d4('0x1b5')],{'as':_0x94d4('0x1ac'),'onDelete':_0x94d4('0x10b'),'foreignKey':'DescriptionId'});db[_0x94d4('0xa6')]['hasMany'](db[_0x94d4('0x1b5')],{'as':_0x94d4('0x1a8'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1ae')});db[_0x94d4('0xa6')][_0x94d4('0x11b')](db['SugarcrmAccount'],{'as':_0x94d4('0x162'),'foreignKey':_0x94d4('0x1ab')});db['SugarcrmField']['hasMany'](db[_0x94d4('0x1b5')],{'as':_0x94d4('0x1af'),'foreignKey':'SubjectId'});db[_0x94d4('0x1b5')][_0x94d4('0x10d')](db[_0x94d4('0x1b5')],{'as':_0x94d4('0x1b1'),'foreignKey':_0x94d4('0x1ad')});db[_0x94d4('0x1b5')][_0x94d4('0x10d')](db[_0x94d4('0x1b5')],{'as':_0x94d4('0x1b2'),'foreignKey':_0x94d4('0x1ae')});db[_0x94d4('0x1b5')][_0x94d4('0x11b')](db[_0x94d4('0x1b3')],{'as':_0x94d4('0x1b3'),'foreignKey':'VariableId'});db[_0x94d4('0xa8')][_0x94d4('0x10d')](db[_0x94d4('0xaa')],{'as':_0x94d4('0x1b7'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1ab')});db['DeskConfiguration'][_0x94d4('0x10d')](db[_0x94d4('0x1b8')],{'as':_0x94d4('0x1b6'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x94d4('0xaa')][_0x94d4('0x10d')](db[_0x94d4('0x1b8')],{'as':_0x94d4('0x1ac'),'onDelete':_0x94d4('0x10b'),'foreignKey':'DescriptionId'});db[_0x94d4('0xaa')]['hasMany'](db['DeskField'],{'as':_0x94d4('0x1a8'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1ae')});db[_0x94d4('0xaa')][_0x94d4('0x11b')](db[_0x94d4('0xa8')],{'as':_0x94d4('0x162'),'foreignKey':_0x94d4('0x1ab')});db[_0x94d4('0xaa')][_0x94d4('0x11c')](db[_0x94d4('0x8a')],{'through':_0x94d4('0x1b9')});db[_0x94d4('0x1b8')][_0x94d4('0x10d')](db[_0x94d4('0x1b8')],{'as':_0x94d4('0x1af'),'foreignKey':_0x94d4('0x1b0')});db[_0x94d4('0x1b8')][_0x94d4('0x10d')](db[_0x94d4('0x1b8')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x94d4('0x1b8')]['hasMany'](db[_0x94d4('0x1b8')],{'as':_0x94d4('0x1b2'),'foreignKey':_0x94d4('0x1ae')});db[_0x94d4('0x1b8')][_0x94d4('0x11b')](db[_0x94d4('0x1b3')],{'as':_0x94d4('0x1b3'),'foreignKey':_0x94d4('0x1b4')});db[_0x94d4('0xac')][_0x94d4('0x10d')](db[_0x94d4('0xae')],{'as':_0x94d4('0x1b7'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1ab')});db[_0x94d4('0xae')][_0x94d4('0x10d')](db['ZohoField'],{'as':_0x94d4('0x1b6'),'onDelete':'cascade','foreignKey':_0x94d4('0x1b0')});db[_0x94d4('0xae')]['hasMany'](db[_0x94d4('0xb0')],{'as':_0x94d4('0x1ac'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1ad')});db['ZohoConfiguration'][_0x94d4('0x10d')](db[_0x94d4('0xb0')],{'as':_0x94d4('0x1a8'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1ae')});db[_0x94d4('0xae')][_0x94d4('0x11b')](db[_0x94d4('0xac')],{'as':'Account','foreignKey':_0x94d4('0x1ab')});db['ZohoField'][_0x94d4('0x10d')](db[_0x94d4('0xb0')],{'as':'Subject','foreignKey':_0x94d4('0x1b0')});db['ZohoField'][_0x94d4('0x10d')](db[_0x94d4('0xb0')],{'as':'Description','foreignKey':_0x94d4('0x1ad')});db[_0x94d4('0xb0')][_0x94d4('0x10d')](db[_0x94d4('0xb0')],{'as':_0x94d4('0x1b2'),'foreignKey':_0x94d4('0x1ae')});db[_0x94d4('0xb0')][_0x94d4('0x11b')](db['Variable'],{'as':_0x94d4('0x1b3'),'foreignKey':_0x94d4('0x1b4')});db[_0x94d4('0x1ba')]['hasMany'](db['ZendeskConfiguration'],{'as':_0x94d4('0x1b7'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x94d4('0x1bb')][_0x94d4('0x10d')](db['ZendeskField'],{'as':_0x94d4('0x1b6'),'foreignKey':_0x94d4('0x1b0')});db[_0x94d4('0x1bb')][_0x94d4('0x10d')](db[_0x94d4('0xb4')],{'as':_0x94d4('0x1ac'),'foreignKey':_0x94d4('0x1ad')});db['ZendeskConfiguration'][_0x94d4('0x10d')](db[_0x94d4('0xb4')],{'as':_0x94d4('0x1a8'),'foreignKey':_0x94d4('0x1ae')});db[_0x94d4('0x1bb')][_0x94d4('0x11b')](db[_0x94d4('0x1ba')],{'as':'Account','foreignKey':_0x94d4('0x1ab')});db['ZendeskConfiguration'][_0x94d4('0x11c')](db['Tag'],{'through':_0x94d4('0x1bc')});db[_0x94d4('0xb4')][_0x94d4('0x10d')](db[_0x94d4('0xb4')],{'as':'Subject','foreignKey':_0x94d4('0x1b0')});db[_0x94d4('0xb4')]['hasMany'](db['ZendeskField'],{'as':_0x94d4('0x1b1'),'foreignKey':_0x94d4('0x1ad')});db[_0x94d4('0xb4')][_0x94d4('0x10d')](db[_0x94d4('0xb4')],{'as':_0x94d4('0x1b2'),'foreignKey':'FieldId'});db[_0x94d4('0xb4')][_0x94d4('0x11b')](db[_0x94d4('0x1b3')],{'as':_0x94d4('0x1b3'),'foreignKey':_0x94d4('0x1b4')});db[_0x94d4('0xb6')][_0x94d4('0x10d')](db[_0x94d4('0xb8')],{'as':_0x94d4('0x1b7'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1ab')});db[_0x94d4('0xb8')][_0x94d4('0x10d')](db[_0x94d4('0xba')],{'as':'Subjects','onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1b0')});db[_0x94d4('0xb8')][_0x94d4('0x10d')](db['FreshdeskField'],{'as':_0x94d4('0x1ac'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1ad')});db[_0x94d4('0xb8')]['hasMany'](db[_0x94d4('0xba')],{'as':_0x94d4('0x1a8'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1ae')});db[_0x94d4('0xb8')]['belongsTo'](db[_0x94d4('0xb6')],{'as':_0x94d4('0x162'),'foreignKey':_0x94d4('0x1ab')});db[_0x94d4('0xb8')][_0x94d4('0x11c')](db[_0x94d4('0x8a')],{'through':_0x94d4('0x1bd')});db[_0x94d4('0xba')][_0x94d4('0x10d')](db[_0x94d4('0xba')],{'as':'Subject','foreignKey':_0x94d4('0x1b0')});db[_0x94d4('0xba')]['hasMany'](db[_0x94d4('0xba')],{'as':_0x94d4('0x1b1'),'foreignKey':'DescriptionId'});db[_0x94d4('0xba')][_0x94d4('0x10d')](db[_0x94d4('0xba')],{'as':_0x94d4('0x1b2'),'foreignKey':_0x94d4('0x1ae')});db['FreshdeskField'][_0x94d4('0x11b')](db[_0x94d4('0x1b3')],{'as':_0x94d4('0x1b3'),'foreignKey':_0x94d4('0x1b4')});db['VtigerAccount']['hasMany'](db['VtigerConfiguration'],{'as':_0x94d4('0x1b7'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1ab')});db[_0x94d4('0xbd')]['hasMany'](db['VtigerField'],{'as':_0x94d4('0x1b6'),'foreignKey':_0x94d4('0x1b0')});db['VtigerConfiguration'][_0x94d4('0x10d')](db[_0x94d4('0xbe')],{'as':_0x94d4('0x1ac'),'foreignKey':_0x94d4('0x1ad')});db['VtigerConfiguration'][_0x94d4('0x10d')](db['VtigerField'],{'as':'Fields','foreignKey':_0x94d4('0x1ae')});db[_0x94d4('0xbd')][_0x94d4('0x11b')](db[_0x94d4('0xbc')],{'as':_0x94d4('0x162'),'foreignKey':_0x94d4('0x1ab')});db[_0x94d4('0xbe')][_0x94d4('0x10d')](db[_0x94d4('0xbe')],{'as':_0x94d4('0x1af'),'foreignKey':_0x94d4('0x1b0')});db['VtigerField'][_0x94d4('0x10d')](db[_0x94d4('0xbe')],{'as':'Description','foreignKey':_0x94d4('0x1ad')});db[_0x94d4('0xbe')]['hasMany'](db[_0x94d4('0xbe')],{'as':'Field','foreignKey':_0x94d4('0x1ae')});db[_0x94d4('0xbe')][_0x94d4('0x11b')](db['Variable'],{'as':'Variable','foreignKey':_0x94d4('0x1b4')});db[_0x94d4('0x1be')][_0x94d4('0x10d')](db[_0x94d4('0xc0')],{'as':_0x94d4('0x1b7'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1ab')});db[_0x94d4('0xc0')][_0x94d4('0x10d')](db[_0x94d4('0x1bf')],{'as':_0x94d4('0x1b6'),'foreignKey':'SubjectId'});db[_0x94d4('0xc0')][_0x94d4('0x10d')](db[_0x94d4('0x1bf')],{'as':_0x94d4('0x1ac'),'foreignKey':_0x94d4('0x1ad')});db[_0x94d4('0xc0')][_0x94d4('0x10d')](db[_0x94d4('0x1bf')],{'as':_0x94d4('0x1a8'),'foreignKey':_0x94d4('0x1ae')});db[_0x94d4('0xc0')][_0x94d4('0x11b')](db[_0x94d4('0x1be')],{'as':_0x94d4('0x162'),'foreignKey':_0x94d4('0x1ab')});db[_0x94d4('0x1bf')][_0x94d4('0x10d')](db['ServicenowField'],{'as':_0x94d4('0x1af'),'foreignKey':_0x94d4('0x1b0')});db['ServicenowField'][_0x94d4('0x10d')](db[_0x94d4('0x1bf')],{'as':'Description','foreignKey':_0x94d4('0x1ad')});db[_0x94d4('0x1bf')][_0x94d4('0x10d')](db[_0x94d4('0x1bf')],{'as':_0x94d4('0x1b2'),'foreignKey':_0x94d4('0x1ae')});db[_0x94d4('0x1bf')][_0x94d4('0x11b')](db['Variable'],{'as':_0x94d4('0x1b3'),'foreignKey':_0x94d4('0x1b4')});db[_0x94d4('0xc2')][_0x94d4('0x10d')](db[_0x94d4('0xc4')],{'as':_0x94d4('0x1b7'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1ab')});db[_0x94d4('0xc4')][_0x94d4('0x10d')](db['Dynamics365Field'],{'as':_0x94d4('0x1b6'),'onDelete':'cascade','foreignKey':_0x94d4('0x1b0')});db[_0x94d4('0xc4')][_0x94d4('0x10d')](db[_0x94d4('0x1c0')],{'as':_0x94d4('0x1ac'),'onDelete':_0x94d4('0x10b'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x94d4('0x10d')](db[_0x94d4('0x1c0')],{'as':_0x94d4('0x1a8'),'onDelete':_0x94d4('0x10b'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x94d4('0x11b')](db[_0x94d4('0xc2')],{'as':_0x94d4('0x162'),'foreignKey':_0x94d4('0x1ab')});db[_0x94d4('0x1c0')][_0x94d4('0x10d')](db[_0x94d4('0x1c0')],{'as':'Subject','foreignKey':_0x94d4('0x1b0')});db[_0x94d4('0x1c0')][_0x94d4('0x10d')](db[_0x94d4('0x1c0')],{'as':_0x94d4('0x1b1'),'foreignKey':_0x94d4('0x1ad')});db[_0x94d4('0x1c0')][_0x94d4('0x10d')](db['Dynamics365Field'],{'as':_0x94d4('0x1b2'),'foreignKey':'FieldId'});db[_0x94d4('0x1c0')]['belongsTo'](db['Variable'],{'as':_0x94d4('0x1b3'),'foreignKey':'VariableId'});db['FreshsalesAccount'][_0x94d4('0x10d')](db[_0x94d4('0xc8')],{'as':_0x94d4('0x1b7'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1ab')});db['FreshsalesConfiguration']['hasMany'](db[_0x94d4('0xca')],{'as':_0x94d4('0x1b6'),'foreignKey':_0x94d4('0x1b0')});db['FreshsalesConfiguration'][_0x94d4('0x10d')](db[_0x94d4('0xca')],{'as':_0x94d4('0x1ac'),'foreignKey':_0x94d4('0x1ad')});db[_0x94d4('0xc8')]['hasMany'](db['FreshsalesField'],{'as':_0x94d4('0x1a8'),'foreignKey':_0x94d4('0x1ae')});db[_0x94d4('0xc8')]['belongsTo'](db[_0x94d4('0xc7')],{'as':'Account','foreignKey':_0x94d4('0x1ab')});db[_0x94d4('0xca')][_0x94d4('0x10d')](db[_0x94d4('0xca')],{'as':'Subject','foreignKey':_0x94d4('0x1b0')});db[_0x94d4('0xca')][_0x94d4('0x10d')](db['FreshsalesField'],{'as':_0x94d4('0x1b1'),'foreignKey':_0x94d4('0x1ad')});db['FreshsalesField'][_0x94d4('0x10d')](db[_0x94d4('0xca')],{'as':'Field','foreignKey':_0x94d4('0x1ae')});db[_0x94d4('0xca')]['belongsTo'](db[_0x94d4('0x1b3')],{'as':'Variable','foreignKey':_0x94d4('0x1b4')});db[_0x94d4('0xce')]['belongsTo'](db[_0x94d4('0x66')],{});db['ChatQueueReport'][_0x94d4('0x11b')](db[_0x94d4('0xf0')],{'as':_0x94d4('0x15f'),'foreignKey':_0x94d4('0x160')});db['ChatQueueReport']['belongsTo'](db['CmContact'],{'as':_0x94d4('0x157'),'foreignKey':_0x94d4('0x158')});db[_0x94d4('0xce')][_0x94d4('0x11b')](db[_0x94d4('0x68')],{});db[_0x94d4('0xce')][_0x94d4('0x11b')](db['ChatMessage'],{});db[_0x94d4('0xce')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{});db[_0x94d4('0xce')]['belongsTo'](db[_0x94d4('0x6c')],{});db[_0x94d4('0x1c1')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1c2')});db[_0x94d4('0x1c1')]['belongsTo'](db['User'],{'onDelete':'cascade','foreignKey':_0x94d4('0x1c3')});db[_0x94d4('0xd3')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x94d4('0x10b')});db[_0x94d4('0xd3')][_0x94d4('0x10d')](db[_0x94d4('0xd0')],{'foreignKey':_0x94d4('0x1c4'),'onDelete':_0x94d4('0x10b')});db[_0x94d4('0x1c5')][_0x94d4('0x11b')](db['SmsAccount'],{});db[_0x94d4('0x1c5')][_0x94d4('0x11b')](db[_0x94d4('0xf0')],{'as':'List','foreignKey':_0x94d4('0x160')});db[_0x94d4('0x1c5')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x94d4('0x158')});db['SmsQueueReport'][_0x94d4('0x11b')](db[_0x94d4('0x115')],{});db['SmsQueueReport'][_0x94d4('0x11b')](db['SmsMessage'],{});db[_0x94d4('0x1c5')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{});db[_0x94d4('0x1c5')][_0x94d4('0x11b')](db[_0x94d4('0x12a')],{});db[_0x94d4('0xd8')][_0x94d4('0x10d')](db['JscriptySessionReport'],{'foreignKey':_0x94d4('0x1c6')});db[_0x94d4('0xd8')][_0x94d4('0x10d')](db[_0x94d4('0xd1')],{'foreignKey':_0x94d4('0x1c6')});db[_0x94d4('0xd8')]['hasMany'](db[_0x94d4('0xd0')],{'foreignKey':_0x94d4('0x1c6')});db[_0x94d4('0xde')]['belongsToMany'](db[_0x94d4('0x108')],{'as':_0x94d4('0x166'),'through':_0x94d4('0x137')});db[_0x94d4('0x121')][_0x94d4('0x11c')](db[_0x94d4('0x108')],{'as':_0x94d4('0x14a'),'through':_0x94d4('0x122')});db[_0x94d4('0x121')][_0x94d4('0x11c')](db[_0x94d4('0x1c')],{'through':_0x94d4('0x14b'),'as':_0x94d4('0x127')});db[_0x94d4('0x121')]['belongsToMany'](db[_0x94d4('0x3f')],{'through':_0x94d4('0x1c7'),'as':_0x94d4('0x1c8')});db[_0x94d4('0x121')]['belongsToMany'](db[_0x94d4('0x6c')],{'through':_0x94d4('0x18a'),'as':'ChatQueues'});db[_0x94d4('0x121')][_0x94d4('0x11c')](db[_0x94d4('0x53')],{'through':'team_has_fax_queues','as':_0x94d4('0x129')});db[_0x94d4('0x121')]['belongsToMany'](db[_0x94d4('0x12a')],{'through':_0x94d4('0x178'),'as':'SmsQueues'});db['Team'][_0x94d4('0x11c')](db[_0x94d4('0x17c')],{'through':_0x94d4('0x181'),'as':_0x94d4('0x1c9')});db['Team']['belongsToMany'](db[_0x94d4('0x105')],{'through':_0x94d4('0x1ca'),'as':_0x94d4('0x1cb')});db[_0x94d4('0xe4')][_0x94d4('0x10d')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x94d4('0x192')});db[_0x94d4('0xe4')][_0x94d4('0x10d')](db[_0x94d4('0x111')],{'as':_0x94d4('0x18f'),'foreignKey':_0x94d4('0x192')});db[_0x94d4('0xe4')]['hasMany'](db[_0x94d4('0x7a')],{'as':_0x94d4('0x13e'),'foreignKey':_0x94d4('0x192')});db[_0x94d4('0xe4')][_0x94d4('0x10d')](db['CmHopperBlack'],{'as':_0x94d4('0x140'),'foreignKey':'CampaignId'});db[_0x94d4('0xe4')][_0x94d4('0x11b')](db['Trunk'],{'as':_0x94d4('0x29'),'foreignKey':_0x94d4('0x1cc')});db['Campaign']['belongsTo'](db[_0x94d4('0x29')],{'as':'TrunkBackup','foreignKey':_0x94d4('0x143')});db[_0x94d4('0xe4')][_0x94d4('0x11b')](db[_0x94d4('0x144')],{'as':_0x94d4('0x144'),'foreignKey':_0x94d4('0x17e')});db[_0x94d4('0xe4')][_0x94d4('0x11b')](db[_0x94d4('0xde')],{'as':_0x94d4('0xde'),'foreignKey':_0x94d4('0x1cd')});db[_0x94d4('0xe4')][_0x94d4('0x11c')](db[_0x94d4('0xf0')],{'as':'Lists','through':_0x94d4('0x1ce')});db[_0x94d4('0xe4')][_0x94d4('0x11c')](db[_0x94d4('0xf0')],{'as':_0x94d4('0x14c'),'through':_0x94d4('0x1cf')});db['MailTransferReport'][_0x94d4('0x11b')](db[_0x94d4('0x45')],{});db[_0x94d4('0xe9')][_0x94d4('0x11b')](db[_0x94d4('0x43')],{});db[_0x94d4('0xe9')][_0x94d4('0x11b')](db[_0x94d4('0x132')],{'foreignKey':_0x94d4('0x1d0'),'as':_0x94d4('0x1d1')});db['MailTransferReport']['belongsTo'](db[_0x94d4('0x108')],{'foreignKey':_0x94d4('0x1d2'),'as':_0x94d4('0x1d3')});db[_0x94d4('0xe9')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{'foreignKey':_0x94d4('0x1d4'),'as':_0x94d4('0x1d5')});db[_0x94d4('0xe9')]['belongsTo'](db[_0x94d4('0x3f')],{'foreignKey':'ToMailQueueId','as':_0x94d4('0x1d6')});db['MailTransferReport'][_0x94d4('0x11b')](db[_0x94d4('0x132')],{'foreignKey':_0x94d4('0x1d7'),'as':'ToAccount'});db[_0x94d4('0x1d8')][_0x94d4('0x11b')](db[_0x94d4('0x6a')],{});db[_0x94d4('0x1d8')][_0x94d4('0x11b')](db[_0x94d4('0x68')],{});db['ChatTransferReport']['belongsTo'](db[_0x94d4('0x66')],{'foreignKey':_0x94d4('0x1d9'),'as':'FromAccount'});db[_0x94d4('0x1d8')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{'foreignKey':_0x94d4('0x1d2'),'as':_0x94d4('0x1d3')});db[_0x94d4('0x1d8')]['belongsTo'](db[_0x94d4('0x108')],{'foreignKey':_0x94d4('0x1d4'),'as':'ToAgent'});db[_0x94d4('0x1d8')]['belongsTo'](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x94d4('0x1d6')});db[_0x94d4('0x1d8')]['belongsTo'](db[_0x94d4('0x66')],{'foreignKey':_0x94d4('0x1da'),'as':_0x94d4('0x1db')});db[_0x94d4('0xeb')][_0x94d4('0x11b')](db[_0x94d4('0x16f')],{});db['FaxTransferReport']['belongsTo'](db['FaxInteraction'],{});db[_0x94d4('0xeb')][_0x94d4('0x11b')](db[_0x94d4('0x130')],{'foreignKey':_0x94d4('0x1dc'),'as':_0x94d4('0x1d1')});db[_0x94d4('0xeb')][_0x94d4('0x11b')](db['User'],{'foreignKey':'FromUserId','as':_0x94d4('0x1d3')});db[_0x94d4('0xeb')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{'foreignKey':_0x94d4('0x1d4'),'as':_0x94d4('0x1d5')});db[_0x94d4('0xeb')][_0x94d4('0x11b')](db[_0x94d4('0x53')],{'foreignKey':_0x94d4('0x1dd'),'as':'ToQueue'});db[_0x94d4('0xeb')][_0x94d4('0x11b')](db[_0x94d4('0x130')],{'foreignKey':'ToFaxAccountId','as':_0x94d4('0x1db')});db[_0x94d4('0xed')]['belongsTo'](db[_0x94d4('0x63')],{});db[_0x94d4('0xed')][_0x94d4('0x11b')](db[_0x94d4('0x61')],{});db['OpenchannelTransferReport'][_0x94d4('0x11b')](db[_0x94d4('0x5e')],{'foreignKey':_0x94d4('0x1de'),'as':_0x94d4('0x1d1')});db[_0x94d4('0xed')][_0x94d4('0x11b')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x94d4('0xed')][_0x94d4('0x11b')](db['User'],{'foreignKey':_0x94d4('0x1d4'),'as':_0x94d4('0x1d5')});db[_0x94d4('0xed')][_0x94d4('0x11b')](db['OpenchannelQueue'],{'foreignKey':_0x94d4('0x1df'),'as':_0x94d4('0x1d6')});db[_0x94d4('0xed')][_0x94d4('0x11b')](db[_0x94d4('0x5e')],{'foreignKey':_0x94d4('0x1e0'),'as':_0x94d4('0x1db')});db[_0x94d4('0xef')][_0x94d4('0x11b')](db[_0x94d4('0x5b')],{});db['SmsTransferReport'][_0x94d4('0x11b')](db[_0x94d4('0x115')],{});db[_0x94d4('0xef')][_0x94d4('0x11b')](db[_0x94d4('0x57')],{'foreignKey':_0x94d4('0x1e1'),'as':_0x94d4('0x1d1')});db[_0x94d4('0xef')][_0x94d4('0x11b')](db['User'],{'foreignKey':_0x94d4('0x1d2'),'as':_0x94d4('0x1d3')});db[_0x94d4('0xef')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{'foreignKey':_0x94d4('0x1d4'),'as':_0x94d4('0x1d5')});db['SmsTransferReport'][_0x94d4('0x11b')](db[_0x94d4('0x12a')],{'foreignKey':_0x94d4('0x1e2'),'as':'ToQueue'});db[_0x94d4('0xef')][_0x94d4('0x11b')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0x94d4('0x1db')});db['CmList'][_0x94d4('0x10d')](db[_0x94d4('0x81')],{'as':'Dispositions','foreignKey':_0x94d4('0x160')});db[_0x94d4('0xf0')][_0x94d4('0x10d')](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0x94d4('0x160')});db[_0x94d4('0xf0')]['hasMany'](db[_0x94d4('0x74')],{'as':_0x94d4('0x11f'),'onDelete':'cascade','foreignKey':_0x94d4('0x160')});db[_0x94d4('0xf0')][_0x94d4('0x10d')](db[_0x94d4('0x111')],{'as':'HopperFinals','foreignKey':_0x94d4('0x160')});db[_0x94d4('0xf0')][_0x94d4('0x10d')](db[_0x94d4('0x7a')],{'as':_0x94d4('0x112'),'foreignKey':_0x94d4('0x160')});db[_0x94d4('0xf0')][_0x94d4('0x10d')](db['ReportAgentPreview'],{'as':_0x94d4('0x7b'),'foreignKey':_0x94d4('0x160')});db[_0x94d4('0xf0')]['belongsToMany'](db[_0x94d4('0x1c')],{'as':'Queues','through':_0x94d4('0x149')});db[_0x94d4('0xf0')]['belongsToMany'](db[_0x94d4('0x108')],{'as':_0x94d4('0x14a'),'through':_0x94d4('0x1e3')});db['VoicePrefix'][_0x94d4('0x10d')](db[_0x94d4('0x18')],{'as':'Extensions','onDelete':_0x94d4('0x10b')});db[_0x94d4('0xf2')][_0x94d4('0x11c')](db[_0x94d4('0x108')],{'as':'Agents','through':'user_has_voice_prefixes'});db[_0x94d4('0xf4')][_0x94d4('0x10d')](db['User'],{'as':'Users','foreignKey':_0x94d4('0x1e4')});db[_0x94d4('0xf4')][_0x94d4('0x10d')](db[_0x94d4('0x1e5')],{'as':_0x94d4('0x1e6'),'foreignKey':_0x94d4('0x1e4'),'onDelete':_0x94d4('0x10b')});db[_0x94d4('0x1e5')][_0x94d4('0x10d')](db[_0x94d4('0xf6')],{'as':_0x94d4('0x1e7'),'foreignKey':'sectionId','onDelete':_0x94d4('0x10b')});db[_0x94d4('0xf9')][_0x94d4('0x10d')](db[_0x94d4('0x81')],{'as':_0x94d4('0x15b'),'foreignKey':'WhatsappAccountId'});db[_0x94d4('0xf9')][_0x94d4('0x10d')](db['CannedAnswer'],{'as':_0x94d4('0x15d'),'foreignKey':_0x94d4('0x1e8')});db['WhatsappAccount'][_0x94d4('0x10d')](db[_0x94d4('0xff')],{'as':_0x94d4('0x150'),'foreignKey':_0x94d4('0x1e8')});db[_0x94d4('0xf9')][_0x94d4('0x10d')](db[_0x94d4('0xfd')],{'as':_0x94d4('0x16e')});db['WhatsappAccount'][_0x94d4('0x10d')](db[_0x94d4('0xfb')],{'as':_0x94d4('0x13a')});db[_0x94d4('0xf9')][_0x94d4('0x11b')](db[_0x94d4('0xf0')],{'as':'List','foreignKey':'ListId'});db['WhatsappAccount'][_0x94d4('0x11b')](db[_0x94d4('0x145')],{'as':'mandatoryDispositionPause','foreignKey':_0x94d4('0x147')});db[_0x94d4('0xf9')][_0x94d4('0x11c')](db[_0x94d4('0x108')],{'as':_0x94d4('0x14a'),'through':_0x94d4('0x1e9')});db[_0x94d4('0xfb')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{'onDelete':_0x94d4('0x16a')});db[_0x94d4('0xfb')][_0x94d4('0x11b')](db[_0x94d4('0x105')],{'onDelete':_0x94d4('0x16a')});db[_0x94d4('0xfb')][_0x94d4('0x11b')](db['WhatsappAccount'],{'onDelete':_0x94d4('0x16a')});db['WhatsappApplication'][_0x94d4('0x11b')](db[_0x94d4('0x144')],{'onDelete':_0x94d4('0x16a'),'foreignKey':_0x94d4('0x17e')});db['WhatsappApplication'][_0x94d4('0x11b')](db['Tag'],{'onDelete':_0x94d4('0x16a'),'foreignKey':_0x94d4('0x16b')});db[_0x94d4('0xfd')][_0x94d4('0x10d')](db[_0x94d4('0xff')],{'as':_0x94d4('0x150'),'onDelete':_0x94d4('0x10b'),'foreignKey':_0x94d4('0x1ea')});db[_0x94d4('0xfd')][_0x94d4('0x11b')](db[_0x94d4('0xf9')],{'as':_0x94d4('0x162'),'foreignKey':_0x94d4('0x1e8')});db[_0x94d4('0xfd')]['belongsTo'](db[_0x94d4('0x74')],{'as':_0x94d4('0x157'),'foreignKey':'ContactId'});db[_0x94d4('0xfd')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x94d4('0x10c')});db['WhatsappInteraction'][_0x94d4('0x11c')](db['Tag'],{'through':_0x94d4('0x1a0'),'as':_0x94d4('0x164')});db[_0x94d4('0xfd')][_0x94d4('0x11c')](db[_0x94d4('0x8a')],{'through':'whatsapp_interaction_has_tags','as':_0x94d4('0x165')});db[_0x94d4('0xfd')][_0x94d4('0x11c')](db[_0x94d4('0x108')],{'as':_0x94d4('0x166'),'through':_0x94d4('0x1eb'),'foreignKey':_0x94d4('0x1ea')});db[_0x94d4('0xff')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{'as':_0x94d4('0x108')});db[_0x94d4('0xff')][_0x94d4('0x11b')](db['CmContact'],{'onDelete':_0x94d4('0x10b'),'as':_0x94d4('0x157')});db['WhatsappMessage'][_0x94d4('0x11b')](db[_0x94d4('0xfd')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x94d4('0x1ea')});db[_0x94d4('0xff')]['belongsTo'](db['WhatsappAccount'],{'as':_0x94d4('0x162'),'foreignKey':_0x94d4('0x1e8')});db[_0x94d4('0x101')][_0x94d4('0x11b')](db[_0x94d4('0xf9')],{});db[_0x94d4('0x101')][_0x94d4('0x11b')](db['CmList'],{'as':'List','foreignKey':_0x94d4('0x160')});db[_0x94d4('0x101')][_0x94d4('0x11b')](db[_0x94d4('0x74')],{'as':_0x94d4('0x157'),'foreignKey':'ContactId'});db['WhatsappQueueReport'][_0x94d4('0x11b')](db[_0x94d4('0xfd')],{});db[_0x94d4('0x101')]['belongsTo'](db[_0x94d4('0x105')],{});db[_0x94d4('0x101')][_0x94d4('0x11b')](db['WhatsappMessage'],{});db[_0x94d4('0x101')][_0x94d4('0x11b')](db[_0x94d4('0x108')],{});db['WhatsappTransferReport'][_0x94d4('0x11b')](db[_0x94d4('0xff')],{});db[_0x94d4('0x103')][_0x94d4('0x11b')](db[_0x94d4('0xfd')],{});db[_0x94d4('0x103')][_0x94d4('0x11b')](db[_0x94d4('0xf9')],{'foreignKey':'FromWhatsappAccountId','as':_0x94d4('0x1d1')});db[_0x94d4('0x103')][_0x94d4('0x11b')](db[_0x94d4('0xf9')],{'foreignKey':'ToWhatsappAccountId','as':_0x94d4('0x1db')});db[_0x94d4('0x103')][_0x94d4('0x11b')](db[_0x94d4('0x105')],{'foreignKey':_0x94d4('0x1ec'),'as':_0x94d4('0x1d6')});db[_0x94d4('0x103')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x94d4('0x1d3')});db[_0x94d4('0x103')]['belongsTo'](db[_0x94d4('0x108')],{'foreignKey':'ToUserId','as':_0x94d4('0x1d5')});db['WhatsappQueue'][_0x94d4('0x11c')](db[_0x94d4('0x108')],{'as':_0x94d4('0x14a'),'through':_0x94d4('0x3a'),'foreignKey':_0x94d4('0x1ed')});db[_0x94d4('0x105')][_0x94d4('0x11c')](db[_0x94d4('0x121')],{'through':_0x94d4('0x1ca'),'as':_0x94d4('0x179')});module[_0x94d4('0x1ee')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index df2aeec..3ba34bc 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc54d=['./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','/api/fax/messages','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','./api/openchannelInteraction','./api/openchannelMessage','./api/openchannelQueue','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/template','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/fields','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/webbar','./api/webbar','/apidoc','static','join','/www','/demo','root','/snippet','snippet','1.0.16','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','express','express-winston','util','./errors','./config/environment','api','./config/logger','auth','default','logger','x-forwarded-for','headers','remoteAddress','url','user','name','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','connection','responseTime','agent_id','agent_name','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage'];(function(_0x2811dd,_0x45f3a0){var _0x210599=function(_0x4a9ecd){while(--_0x4a9ecd){_0x2811dd['push'](_0x2811dd['shift']());}};_0x210599(++_0x45f3a0);}(_0xc54d,0xf6));var _0xdc54=function(_0x3ef4ce,_0x5b4e3e){_0x3ef4ce=_0x3ef4ce-0x0;var _0x414d9d=_0xc54d[_0x3ef4ce];return _0x414d9d;};'use strict';var path=require('path');var express=require(_0xdc54('0x0'));var ewinston=require(_0xdc54('0x1'));var util=require(_0xdc54('0x2'));var errors=require(_0xdc54('0x3'));var config=require(_0xdc54('0x4'));var logger=require('./config/logger')(_0xdc54('0x5'));var authLogger=require(_0xdc54('0x6'))(_0xdc54('0x7'));exports[_0xdc54('0x8')]=function(_0x520f6e){_0x520f6e['use'](ewinston[_0xdc54('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x10a397,_0x30f534){return util['format']('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0x10a397['method'],_0x10a397['headers'][_0xdc54('0xa')]?_0x10a397[_0xdc54('0xb')][_0xdc54('0xa')]:_0x10a397['connection'][_0xdc54('0xc')]||_0x10a397['ip'],_0x10a397[_0xdc54('0xd')],_0x30f534['statusCode'],_0x30f534['responseTime'],_0x10a397[_0xdc54('0xe')]?_0x10a397[_0xdc54('0xe')]['id']:null,_0x10a397[_0xdc54('0xe')]?_0x10a397[_0xdc54('0xe')][_0xdc54('0xf')]:null,_0x10a397[_0xdc54('0xe')]?_0x10a397[_0xdc54('0xe')]['role']:null);}}));_0x520f6e['use'](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x910fee,_0x5b4a79){var _0x3e753a=_0xdc54('0x10');if(_0x910fee['body']&&_0x910fee[_0xdc54('0x11')][_0xdc54('0x12')]&&_0x910fee[_0xdc54('0x11')]['agent_id']){_0x3e753a=_0xdc54('0x13');}return util[_0xdc54('0x14')](_0x3e753a,_0x910fee[_0xdc54('0x15')],_0x910fee[_0xdc54('0xb')][_0xdc54('0xa')]?_0x910fee['headers'][_0xdc54('0xa')]:_0x910fee[_0xdc54('0x16')][_0xdc54('0xc')]||_0x910fee['ip'],_0x910fee[_0xdc54('0xd')],_0x5b4a79['statusCode'],_0x5b4a79[_0xdc54('0x17')],_0x910fee[_0xdc54('0xe')]?_0x910fee['user']['id']:null,_0x910fee['user']?_0x910fee[_0xdc54('0xe')]['name']:null,_0x910fee[_0xdc54('0xe')]?_0x910fee['user']['role']:null,_0x910fee[_0xdc54('0x11')]&&_0x910fee[_0xdc54('0x11')][_0xdc54('0x12')]?_0x910fee[_0xdc54('0x11')][_0xdc54('0x12')]:'other',_0x910fee[_0xdc54('0x11')]&&_0x910fee[_0xdc54('0x11')][_0xdc54('0x18')]?_0x910fee[_0xdc54('0x11')]['agent_id']:'',_0x910fee[_0xdc54('0x11')]&&_0x910fee['body'][_0xdc54('0x19')]?_0x910fee[_0xdc54('0x11')][_0xdc54('0x19')]:'');},'ignoreRoute':function(_0x399148){var _0x29fe2c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x29fe2c['test'](_0x399148[_0xdc54('0xd')]);}}));_0x520f6e[_0xdc54('0x1a')]('/api/users',require(_0xdc54('0x1b')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x1c'),require(_0xdc54('0x1d')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x1e'),require('./api/voiceContext'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x1f'),require('./api/voiceExtension'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x20'),require(_0xdc54('0x21')));_0x520f6e['use']('/api/voice/queues',require(_0xdc54('0x22')));_0x520f6e['use'](_0xdc54('0x23'),require(_0xdc54('0x24')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x25'),require(_0xdc54('0x26')));_0x520f6e[_0xdc54('0x1a')]('/api/voice/mails',require(_0xdc54('0x27')));_0x520f6e['use'](_0xdc54('0x28'),require(_0xdc54('0x29')));_0x520f6e['use']('/api/voice/calls/reports',require(_0xdc54('0x2a')));_0x520f6e['use'](_0xdc54('0x2b'),require(_0xdc54('0x2c')));_0x520f6e['use'](_0xdc54('0x2d'),require(_0xdc54('0x2e')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x2f'),require(_0xdc54('0x30')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x31'),require(_0xdc54('0x32')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x33'),require(_0xdc54('0x34')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x35'),require('./api/voiceTransferReport'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x36'),require(_0xdc54('0x37')));_0x520f6e[_0xdc54('0x1a')]('/api/mail/accounts',require(_0xdc54('0x38')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x39'),require(_0xdc54('0x3a')));_0x520f6e['use'](_0xdc54('0x3b'),require(_0xdc54('0x3c')));_0x520f6e['use']('/api/mail/interactions',require(_0xdc54('0x3d')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x3e'),require(_0xdc54('0x3f')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x40'),require(_0xdc54('0x41')));_0x520f6e[_0xdc54('0x1a')]('/api/mail/reports/queue',require(_0xdc54('0x42')));_0x520f6e['use'](_0xdc54('0x43'),require(_0xdc54('0x44')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x45'),require(_0xdc54('0x46')));_0x520f6e['use'](_0xdc54('0x47'),require(_0xdc54('0x48')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x49'),require('./api/faxApplication'));_0x520f6e['use'](_0xdc54('0x4a'),require('./api/faxInteraction'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x4b'),require('./api/faxMessage'));_0x520f6e[_0xdc54('0x1a')]('/api/fax/queues',require('./api/faxQueue'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x4c'),require(_0xdc54('0x4d')));_0x520f6e['use'](_0xdc54('0x4e'),require(_0xdc54('0x4f')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x50'),require(_0xdc54('0x51')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x52'),require('./api/smsInteraction'));_0x520f6e['use'](_0xdc54('0x53'),require(_0xdc54('0x54')));_0x520f6e['use'](_0xdc54('0x55'),require(_0xdc54('0x56')));_0x520f6e['use'](_0xdc54('0x57'),require(_0xdc54('0x58')));_0x520f6e['use']('/api/openchannel/applications',require(_0xdc54('0x59')));_0x520f6e['use']('/api/openchannel/interactions',require(_0xdc54('0x5a')));_0x520f6e[_0xdc54('0x1a')]('/api/openchannel/messages',require(_0xdc54('0x5b')));_0x520f6e[_0xdc54('0x1a')]('/api/openchannel/queues',require(_0xdc54('0x5c')));_0x520f6e[_0xdc54('0x1a')]('/api/chat/websites',require('./api/chatWebsite'));_0x520f6e[_0xdc54('0x1a')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x520f6e['use'](_0xdc54('0x5d'),require('./api/chatApplication'));_0x520f6e['use'](_0xdc54('0x5e'),require(_0xdc54('0x5f')));_0x520f6e['use'](_0xdc54('0x60'),require(_0xdc54('0x61')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x62'),require(_0xdc54('0x63')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x64'),require(_0xdc54('0x65')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x66'),require(_0xdc54('0x67')));_0x520f6e[_0xdc54('0x1a')]('/api/chat/proactive_actions',require(_0xdc54('0x68')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x69'),require(_0xdc54('0x6a')));_0x520f6e['use'](_0xdc54('0x6b'),require('./api/cmContact'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x6c'),require('./api/cmHopper'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x6d'),require(_0xdc54('0x6e')));_0x520f6e[_0xdc54('0x1a')]('/api/cm/hopper_final',require(_0xdc54('0x6f')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x70'),require(_0xdc54('0x71')));_0x520f6e['use'](_0xdc54('0x72'),require(_0xdc54('0x73')));_0x520f6e['use'](_0xdc54('0x74'),require(_0xdc54('0x75')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x76'),require(_0xdc54('0x77')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x78'),require('./api/cannedAnswer'));_0x520f6e[_0xdc54('0x1a')]('/api/dispositions',require('./api/disposition'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x79'),require(_0xdc54('0x7a')));_0x520f6e['use'](_0xdc54('0x7b'),require(_0xdc54('0x7c')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x7d'),require(_0xdc54('0x7e')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x7f'),require('./api/cdr'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x80'),require(_0xdc54('0x81')));_0x520f6e['use'](_0xdc54('0x82'),require(_0xdc54('0x83')));_0x520f6e['use'](_0xdc54('0x84'),require(_0xdc54('0x85')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x86'),require(_0xdc54('0x87')));_0x520f6e[_0xdc54('0x1a')]('/api/templates',require(_0xdc54('0x88')));_0x520f6e[_0xdc54('0x1a')]('/api/triggers',require('./api/trigger'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x89'),require(_0xdc54('0x8a')));_0x520f6e[_0xdc54('0x1a')]('/api/integrations',require(_0xdc54('0x8b')));_0x520f6e['use'](_0xdc54('0x8c'),require(_0xdc54('0x8d')));_0x520f6e['use']('/api/analytics/custom_reports',require(_0xdc54('0x8e')));_0x520f6e['use'](_0xdc54('0x8f'),require(_0xdc54('0x90')));_0x520f6e['use'](_0xdc54('0x91'),require(_0xdc54('0x92')));_0x520f6e['use'](_0xdc54('0x93'),require('./api/analyticMetric'));_0x520f6e['use'](_0xdc54('0x94'),require(_0xdc54('0x95')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x96'),require(_0xdc54('0x97')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x98'),require(_0xdc54('0x99')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x9a'),require(_0xdc54('0x9b')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x9c'),require(_0xdc54('0x9d')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x9e'),require(_0xdc54('0x9f')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xa0'),require(_0xdc54('0xa1')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xa2'),require(_0xdc54('0xa3')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xa4'),require(_0xdc54('0xa5')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xa6'),require(_0xdc54('0xa7')));_0x520f6e['use'](_0xdc54('0xa8'),require(_0xdc54('0xa9')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xaa'),require(_0xdc54('0xab')));_0x520f6e[_0xdc54('0x1a')]('/api/integrations/zoho/configurations',require(_0xdc54('0xac')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xad'),require('./api/intZohoField'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xae'),require(_0xdc54('0xaf')));_0x520f6e[_0xdc54('0x1a')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xb0'),require('./api/intZendeskField'));_0x520f6e[_0xdc54('0x1a')]('/api/integrations/freshdesk/accounts',require(_0xdc54('0xb1')));_0x520f6e[_0xdc54('0x1a')]('/api/integrations/freshdesk/configurations',require(_0xdc54('0xb2')));_0x520f6e['use'](_0xdc54('0xb3'),require(_0xdc54('0xb4')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xb5'),require(_0xdc54('0xb6')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xb7'),require(_0xdc54('0xb8')));_0x520f6e['use'](_0xdc54('0xb9'),require('./api/intVtigerField'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xba'),require(_0xdc54('0xbb')));_0x520f6e[_0xdc54('0x1a')]('/api/integrations/servicenow/configurations',require(_0xdc54('0xbc')));_0x520f6e[_0xdc54('0x1a')]('/api/integrations/servicenow/fields',require(_0xdc54('0xbd')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xbe'),require(_0xdc54('0xbf')));_0x520f6e['use'](_0xdc54('0xc0'),require('./api/intDynamics365Configuration'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xc1'),require(_0xdc54('0xc2')));_0x520f6e['use'](_0xdc54('0xc3'),require(_0xdc54('0xc4')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xc5'),require(_0xdc54('0xc6')));_0x520f6e['use'](_0xdc54('0xc7'),require(_0xdc54('0xc8')));_0x520f6e['use'](_0xdc54('0xc9'),require(_0xdc54('0xca')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xcb'),require(_0xdc54('0xcc')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xcd'),require(_0xdc54('0xce')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xcf'),require(_0xdc54('0xd0')));_0x520f6e[_0xdc54('0x1a')]('/api/jscripty/questions/reports',require(_0xdc54('0xd1')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xd2'),require(_0xdc54('0xd3')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xd4'),require(_0xdc54('0xd5')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xd6'),require(_0xdc54('0xd7')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xd8'),require('./api/squareReportDetail'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xd9'),require(_0xdc54('0xda')));_0x520f6e[_0xdc54('0x1a')]('/api/settings',require(_0xdc54('0xdb')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xdc'),require(_0xdc54('0xdd')));_0x520f6e[_0xdc54('0x1a')]('/api/square/projects',require(_0xdc54('0xde')));_0x520f6e[_0xdc54('0x1a')]('/api/square/recordings',require(_0xdc54('0xdf')));_0x520f6e['use'](_0xdc54('0xe0'),require(_0xdc54('0xe1')));_0x520f6e['use'](_0xdc54('0xe2'),require(_0xdc54('0xe3')));_0x520f6e[_0xdc54('0x1a')]('/api/license',require('./api/license'));_0x520f6e[_0xdc54('0x1a')]('/api/campaigns',require('./api/campaign'));_0x520f6e['use'](_0xdc54('0xe4'),require(_0xdc54('0xe5')));_0x520f6e['use'](_0xdc54('0xe6'),require(_0xdc54('0xe7')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xe8'),require(_0xdc54('0xe9')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xea'),require('./api/mailTransferReport'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xeb'),require(_0xdc54('0xec')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xed'),require(_0xdc54('0xee')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xef'),require('./api/openchannelTransferReport'));_0x520f6e['use'](_0xdc54('0xf0'),require(_0xdc54('0xf1')));_0x520f6e['use'](_0xdc54('0xf2'),require(_0xdc54('0xf3')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xf4'),require(_0xdc54('0xf5')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xf6'),require(_0xdc54('0xf7')));_0x520f6e[_0xdc54('0x1a')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xf8'),require(_0xdc54('0xf9')));_0x520f6e['use'](_0xdc54('0xfa'),require(_0xdc54('0xfb')));_0x520f6e['use'](_0xdc54('0xfc'),require('./api/whatsappAccount'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0xfd'),require(_0xdc54('0xfe')));_0x520f6e[_0xdc54('0x1a')]('/api/whatsapp/interactions',require(_0xdc54('0xff')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x100'),require(_0xdc54('0x101')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x102'),require(_0xdc54('0x103')));_0x520f6e[_0xdc54('0x1a')]('/api/whatsapp/reports/transfer',require(_0xdc54('0x104')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x105'),require('./api/whatsappQueue'));_0x520f6e['use']('/api/cloudProviders',require('./api/cloudProvider'));_0x520f6e[_0xdc54('0x1a')]('/api/auth/local',require(_0xdc54('0x106')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x107'),require(_0xdc54('0x108')));_0x520f6e['use'](_0xdc54('0x109'),require(_0xdc54('0x10a')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x10b'),require(_0xdc54('0x10c')));_0x520f6e['use']('/api/version',require(_0xdc54('0x10d')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x10e'),require(_0xdc54('0x10f')));_0x520f6e['use']('/api/pm2',require('./api/pm2'));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x110'),require(_0xdc54('0x111')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x112'),express[_0xdc54('0x113')](path[_0xdc54('0x114')](config['root'],_0xdc54('0x112'))));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x115'),express[_0xdc54('0x113')](path[_0xdc54('0x114')](config['root'],_0xdc54('0x115'))));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x116'),express[_0xdc54('0x113')](path['join'](config[_0xdc54('0x117')],'/demo')));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x118'),express[_0xdc54('0x113')](path[_0xdc54('0x114')](config[_0xdc54('0x117')],_0xdc54('0x119'),_0xdc54('0x11a'))));_0x520f6e[_0xdc54('0x1a')](_0xdc54('0x11b'),express['static'](path[_0xdc54('0x114')](config['root'],'/server/files/plugins')));_0x520f6e[_0xdc54('0x11c')](_0xdc54('0x11d'))[_0xdc54('0x11e')](errors[0x194]);_0x520f6e['route']('/*')['get'](function(_0x2883e9,_0x12427c){_0x12427c['sendFile'](path[_0xdc54('0x11f')](_0x520f6e[_0xdc54('0x11e')]('appPath')+'/index.html'));});}; \ No newline at end of file +var _0x2378=['./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/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/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/recordings','./api/squareRecording','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','/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/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','/api/auth/google','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','./api/webbar','/apidoc','static','/www','join','root','/demo','/snippet','snippet','1.0.16','/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','resolve','appPath','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','auth','default','use','logger','format','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','./api/voiceMail','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/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/mail/messages','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','/api/chat/queues','./api/chatQueue','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2378,0x90));var _0x8237=function(_0x28c33a,_0x1288c0){_0x28c33a=_0x28c33a-0x0;var _0x1fe8e2=_0x2378[_0x28c33a];return _0x1fe8e2;};'use strict';var path=require(_0x8237('0x0'));var express=require(_0x8237('0x1'));var ewinston=require(_0x8237('0x2'));var util=require(_0x8237('0x3'));var errors=require(_0x8237('0x4'));var config=require(_0x8237('0x5'));var logger=require(_0x8237('0x6'))(_0x8237('0x7'));var authLogger=require(_0x8237('0x6'))(_0x8237('0x8'));exports[_0x8237('0x9')]=function(_0x190509){_0x190509[_0x8237('0xa')](ewinston[_0x8237('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x50f741,_0x3f1b3){return util[_0x8237('0xc')]('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0x50f741['method'],_0x50f741[_0x8237('0xd')]['x-forwarded-for']?_0x50f741[_0x8237('0xd')][_0x8237('0xe')]:_0x50f741[_0x8237('0xf')][_0x8237('0x10')]||_0x50f741['ip'],_0x50f741['url'],_0x3f1b3[_0x8237('0x11')],_0x3f1b3[_0x8237('0x12')],_0x50f741[_0x8237('0x13')]?_0x50f741['user']['id']:null,_0x50f741[_0x8237('0x13')]?_0x50f741['user'][_0x8237('0x14')]:null,_0x50f741[_0x8237('0x13')]?_0x50f741[_0x8237('0x13')][_0x8237('0x15')]:null);}}));_0x190509[_0x8237('0xa')](ewinston[_0x8237('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x17fc08,_0x1fac50){var _0x518134=_0x8237('0x16');if(_0x17fc08[_0x8237('0x17')]&&_0x17fc08['body'][_0x8237('0x18')]&&_0x17fc08[_0x8237('0x17')][_0x8237('0x19')]){_0x518134=_0x8237('0x1a');}return util[_0x8237('0xc')](_0x518134,_0x17fc08['method'],_0x17fc08['headers'][_0x8237('0xe')]?_0x17fc08[_0x8237('0xd')][_0x8237('0xe')]:_0x17fc08['connection'][_0x8237('0x10')]||_0x17fc08['ip'],_0x17fc08['url'],_0x1fac50[_0x8237('0x11')],_0x1fac50[_0x8237('0x12')],_0x17fc08[_0x8237('0x13')]?_0x17fc08['user']['id']:null,_0x17fc08[_0x8237('0x13')]?_0x17fc08[_0x8237('0x13')][_0x8237('0x14')]:null,_0x17fc08['user']?_0x17fc08[_0x8237('0x13')]['role']:null,_0x17fc08[_0x8237('0x17')]&&_0x17fc08[_0x8237('0x17')]['device']?_0x17fc08['body'][_0x8237('0x18')]:_0x8237('0x1b'),_0x17fc08[_0x8237('0x17')]&&_0x17fc08['body']['agent_id']?_0x17fc08[_0x8237('0x17')][_0x8237('0x19')]:'',_0x17fc08[_0x8237('0x17')]&&_0x17fc08[_0x8237('0x17')][_0x8237('0x1c')]?_0x17fc08[_0x8237('0x17')][_0x8237('0x1c')]:'');},'ignoreRoute':function(_0x8be906){var _0x11a0ba=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x11a0ba[_0x8237('0x1d')](_0x8be906['url']);}}));_0x190509['use'](_0x8237('0x1e'),require(_0x8237('0x1f')));_0x190509[_0x8237('0xa')](_0x8237('0x20'),require(_0x8237('0x21')));_0x190509['use'](_0x8237('0x22'),require(_0x8237('0x23')));_0x190509['use'](_0x8237('0x24'),require(_0x8237('0x25')));_0x190509[_0x8237('0xa')](_0x8237('0x26'),require(_0x8237('0x27')));_0x190509[_0x8237('0xa')](_0x8237('0x28'),require(_0x8237('0x29')));_0x190509['use']('/api/voice/recordings',require(_0x8237('0x2a')));_0x190509[_0x8237('0xa')]('/api/screen/recordings',require(_0x8237('0x2b')));_0x190509[_0x8237('0xa')]('/api/voice/mails',require(_0x8237('0x2c')));_0x190509[_0x8237('0xa')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x190509[_0x8237('0xa')](_0x8237('0x2d'),require(_0x8237('0x2e')));_0x190509['use']('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x190509['use'](_0x8237('0x2f'),require(_0x8237('0x30')));_0x190509[_0x8237('0xa')](_0x8237('0x31'),require(_0x8237('0x32')));_0x190509[_0x8237('0xa')]('/api/members/reports',require(_0x8237('0x33')));_0x190509[_0x8237('0xa')]('/api/trunks',require(_0x8237('0x34')));_0x190509[_0x8237('0xa')](_0x8237('0x35'),require('./api/voiceTransferReport'));_0x190509[_0x8237('0xa')](_0x8237('0x36'),require(_0x8237('0x37')));_0x190509[_0x8237('0xa')](_0x8237('0x38'),require(_0x8237('0x39')));_0x190509[_0x8237('0xa')](_0x8237('0x3a'),require(_0x8237('0x3b')));_0x190509[_0x8237('0xa')](_0x8237('0x3c'),require(_0x8237('0x3d')));_0x190509['use'](_0x8237('0x3e'),require(_0x8237('0x3f')));_0x190509[_0x8237('0xa')](_0x8237('0x40'),require('./api/mailMessage'));_0x190509[_0x8237('0xa')]('/api/mail/applications',require(_0x8237('0x41')));_0x190509[_0x8237('0xa')](_0x8237('0x42'),require(_0x8237('0x43')));_0x190509[_0x8237('0xa')](_0x8237('0x44'),require('./api/dashboard'));_0x190509[_0x8237('0xa')]('/api/dashboards/items',require(_0x8237('0x45')));_0x190509[_0x8237('0xa')](_0x8237('0x46'),require(_0x8237('0x47')));_0x190509['use'](_0x8237('0x48'),require(_0x8237('0x49')));_0x190509[_0x8237('0xa')](_0x8237('0x4a'),require('./api/faxInteraction'));_0x190509[_0x8237('0xa')]('/api/fax/messages',require('./api/faxMessage'));_0x190509[_0x8237('0xa')](_0x8237('0x4b'),require(_0x8237('0x4c')));_0x190509[_0x8237('0xa')]('/api/fax/reports/queue',require(_0x8237('0x4d')));_0x190509[_0x8237('0xa')](_0x8237('0x4e'),require(_0x8237('0x4f')));_0x190509[_0x8237('0xa')](_0x8237('0x50'),require(_0x8237('0x51')));_0x190509['use'](_0x8237('0x52'),require('./api/smsInteraction'));_0x190509[_0x8237('0xa')](_0x8237('0x53'),require('./api/smsMessage'));_0x190509[_0x8237('0xa')](_0x8237('0x54'),require(_0x8237('0x55')));_0x190509[_0x8237('0xa')](_0x8237('0x56'),require('./api/openchannelAccount'));_0x190509[_0x8237('0xa')](_0x8237('0x57'),require(_0x8237('0x58')));_0x190509[_0x8237('0xa')]('/api/openchannel/interactions',require(_0x8237('0x59')));_0x190509[_0x8237('0xa')](_0x8237('0x5a'),require(_0x8237('0x5b')));_0x190509[_0x8237('0xa')](_0x8237('0x5c'),require(_0x8237('0x5d')));_0x190509['use']('/api/chat/websites',require(_0x8237('0x5e')));_0x190509[_0x8237('0xa')](_0x8237('0x5f'),require(_0x8237('0x60')));_0x190509[_0x8237('0xa')](_0x8237('0x61'),require(_0x8237('0x62')));_0x190509[_0x8237('0xa')](_0x8237('0x63'),require('./api/chatInteraction'));_0x190509[_0x8237('0xa')](_0x8237('0x64'),require('./api/chatMessage'));_0x190509[_0x8237('0xa')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x190509[_0x8237('0xa')](_0x8237('0x65'),require(_0x8237('0x66')));_0x190509[_0x8237('0xa')]('/api/chat/groups',require(_0x8237('0x67')));_0x190509[_0x8237('0xa')]('/api/chat/proactive_actions',require(_0x8237('0x68')));_0x190509['use'](_0x8237('0x69'),require(_0x8237('0x6a')));_0x190509[_0x8237('0xa')](_0x8237('0x6b'),require(_0x8237('0x6c')));_0x190509[_0x8237('0xa')](_0x8237('0x6d'),require('./api/cmHopper'));_0x190509[_0x8237('0xa')]('/api/cm/hopper_black',require(_0x8237('0x6e')));_0x190509[_0x8237('0xa')]('/api/cm/hopper_final',require(_0x8237('0x6f')));_0x190509[_0x8237('0xa')](_0x8237('0x70'),require(_0x8237('0x71')));_0x190509['use'](_0x8237('0x72'),require(_0x8237('0x73')));_0x190509[_0x8237('0xa')](_0x8237('0x74'),require(_0x8237('0x75')));_0x190509[_0x8237('0xa')](_0x8237('0x76'),require('./api/automation'));_0x190509[_0x8237('0xa')]('/api/canned_answers',require(_0x8237('0x77')));_0x190509[_0x8237('0xa')](_0x8237('0x78'),require(_0x8237('0x79')));_0x190509['use'](_0x8237('0x7a'),require(_0x8237('0x7b')));_0x190509[_0x8237('0xa')]('/api/intervals',require('./api/interval'));_0x190509[_0x8237('0xa')](_0x8237('0x7c'),require(_0x8237('0x7d')));_0x190509['use']('/api/cdr',require(_0x8237('0x7e')));_0x190509[_0x8237('0xa')](_0x8237('0x7f'),require(_0x8237('0x80')));_0x190509[_0x8237('0xa')]('/api/schedules',require(_0x8237('0x81')));_0x190509[_0x8237('0xa')](_0x8237('0x82'),require('./api/sound'));_0x190509[_0x8237('0xa')]('/api/tags',require(_0x8237('0x83')));_0x190509[_0x8237('0xa')](_0x8237('0x84'),require(_0x8237('0x85')));_0x190509['use'](_0x8237('0x86'),require(_0x8237('0x87')));_0x190509[_0x8237('0xa')](_0x8237('0x88'),require('./api/variable'));_0x190509[_0x8237('0xa')]('/api/integrations',require('./api/integration'));_0x190509[_0x8237('0xa')](_0x8237('0x89'),require(_0x8237('0x8a')));_0x190509['use']('/api/analytics/custom_reports',require(_0x8237('0x8b')));_0x190509[_0x8237('0xa')](_0x8237('0x8c'),require(_0x8237('0x8d')));_0x190509['use'](_0x8237('0x8e'),require('./api/analyticExtractedReport'));_0x190509[_0x8237('0xa')](_0x8237('0x8f'),require(_0x8237('0x90')));_0x190509['use'](_0x8237('0x91'),require(_0x8237('0x92')));_0x190509[_0x8237('0xa')]('/api/analytics/tree_reports',require(_0x8237('0x93')));_0x190509[_0x8237('0xa')](_0x8237('0x94'),require(_0x8237('0x95')));_0x190509[_0x8237('0xa')]('/api/integrations/salesforce/configurations',require(_0x8237('0x96')));_0x190509[_0x8237('0xa')](_0x8237('0x97'),require('./api/intSalesforceField'));_0x190509[_0x8237('0xa')](_0x8237('0x98'),require(_0x8237('0x99')));_0x190509[_0x8237('0xa')]('/api/integrations/sugarcrm/configurations',require(_0x8237('0x9a')));_0x190509['use'](_0x8237('0x9b'),require('./api/intSugarcrmField'));_0x190509['use'](_0x8237('0x9c'),require(_0x8237('0x9d')));_0x190509[_0x8237('0xa')]('/api/integrations/desk/configurations',require(_0x8237('0x9e')));_0x190509[_0x8237('0xa')](_0x8237('0x9f'),require('./api/intDeskField'));_0x190509[_0x8237('0xa')](_0x8237('0xa0'),require(_0x8237('0xa1')));_0x190509[_0x8237('0xa')](_0x8237('0xa2'),require(_0x8237('0xa3')));_0x190509[_0x8237('0xa')]('/api/integrations/zoho/fields',require(_0x8237('0xa4')));_0x190509[_0x8237('0xa')](_0x8237('0xa5'),require('./api/intZendeskAccount'));_0x190509[_0x8237('0xa')](_0x8237('0xa6'),require(_0x8237('0xa7')));_0x190509[_0x8237('0xa')]('/api/integrations/zendesk/fields',require(_0x8237('0xa8')));_0x190509[_0x8237('0xa')](_0x8237('0xa9'),require(_0x8237('0xaa')));_0x190509[_0x8237('0xa')]('/api/integrations/freshdesk/configurations',require(_0x8237('0xab')));_0x190509[_0x8237('0xa')](_0x8237('0xac'),require(_0x8237('0xad')));_0x190509['use'](_0x8237('0xae'),require(_0x8237('0xaf')));_0x190509['use'](_0x8237('0xb0'),require(_0x8237('0xb1')));_0x190509[_0x8237('0xa')](_0x8237('0xb2'),require(_0x8237('0xb3')));_0x190509[_0x8237('0xa')](_0x8237('0xb4'),require(_0x8237('0xb5')));_0x190509[_0x8237('0xa')](_0x8237('0xb6'),require(_0x8237('0xb7')));_0x190509[_0x8237('0xa')](_0x8237('0xb8'),require('./api/intServicenowField'));_0x190509[_0x8237('0xa')](_0x8237('0xb9'),require(_0x8237('0xba')));_0x190509[_0x8237('0xa')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x190509[_0x8237('0xa')](_0x8237('0xbb'),require('./api/intDynamics365Field'));_0x190509[_0x8237('0xa')](_0x8237('0xbc'),require(_0x8237('0xbd')));_0x190509[_0x8237('0xa')](_0x8237('0xbe'),require(_0x8237('0xbf')));_0x190509['use'](_0x8237('0xc0'),require(_0x8237('0xc1')));_0x190509['use'](_0x8237('0xc2'),require(_0x8237('0xc3')));_0x190509[_0x8237('0xa')](_0x8237('0xc4'),require('./api/chatQueueReport'));_0x190509[_0x8237('0xa')]('/api/chat/internal/messages',require(_0x8237('0xc5')));_0x190509['use'](_0x8237('0xc6'),require(_0x8237('0xc7')));_0x190509['use'](_0x8237('0xc8'),require(_0x8237('0xc9')));_0x190509[_0x8237('0xa')](_0x8237('0xca'),require(_0x8237('0xcb')));_0x190509[_0x8237('0xa')](_0x8237('0xcc'),require('./api/smsQueueReport'));_0x190509[_0x8237('0xa')]('/api/square/reports',require(_0x8237('0xcd')));_0x190509['use'](_0x8237('0xce'),require(_0x8237('0xcf')));_0x190509['use']('/api/jscripty/projects',require(_0x8237('0xd0')));_0x190509[_0x8237('0xa')](_0x8237('0xd1'),require(_0x8237('0xd2')));_0x190509[_0x8237('0xa')](_0x8237('0xd3'),require(_0x8237('0xd4')));_0x190509[_0x8237('0xa')]('/api/square/projects',require('./api/squareProject'));_0x190509[_0x8237('0xa')](_0x8237('0xd5'),require(_0x8237('0xd6')));_0x190509['use']('/api/square/messages',require('./api/squareMessage'));_0x190509['use'](_0x8237('0xd7'),require(_0x8237('0xd8')));_0x190509['use'](_0x8237('0xd9'),require(_0x8237('0xda')));_0x190509[_0x8237('0xa')](_0x8237('0xdb'),require(_0x8237('0xdc')));_0x190509[_0x8237('0xa')]('/api/migrations',require(_0x8237('0xdd')));_0x190509[_0x8237('0xa')](_0x8237('0xde'),require(_0x8237('0xdf')));_0x190509[_0x8237('0xa')](_0x8237('0xe0'),require(_0x8237('0xe1')));_0x190509[_0x8237('0xa')](_0x8237('0xe2'),require(_0x8237('0xe3')));_0x190509['use'](_0x8237('0xe4'),require(_0x8237('0xe5')));_0x190509[_0x8237('0xa')](_0x8237('0xe6'),require(_0x8237('0xe7')));_0x190509[_0x8237('0xa')](_0x8237('0xe8'),require('./api/openchannelTransferReport'));_0x190509['use'](_0x8237('0xe9'),require('./api/smsTransferReport'));_0x190509[_0x8237('0xa')](_0x8237('0xea'),require(_0x8237('0xeb')));_0x190509[_0x8237('0xa')](_0x8237('0xec'),require(_0x8237('0xed')));_0x190509[_0x8237('0xa')](_0x8237('0xee'),require(_0x8237('0xef')));_0x190509[_0x8237('0xa')](_0x8237('0xf0'),require(_0x8237('0xf1')));_0x190509[_0x8237('0xa')](_0x8237('0xf2'),require(_0x8237('0xf3')));_0x190509[_0x8237('0xa')](_0x8237('0xf4'),require('./api/notification'));_0x190509[_0x8237('0xa')]('/api/whatsapp/accounts',require(_0x8237('0xf5')));_0x190509[_0x8237('0xa')](_0x8237('0xf6'),require(_0x8237('0xf7')));_0x190509[_0x8237('0xa')](_0x8237('0xf8'),require(_0x8237('0xf9')));_0x190509[_0x8237('0xa')](_0x8237('0xfa'),require(_0x8237('0xfb')));_0x190509['use'](_0x8237('0xfc'),require(_0x8237('0xfd')));_0x190509[_0x8237('0xa')](_0x8237('0xfe'),require('./api/whatsappTransferReport'));_0x190509[_0x8237('0xa')]('/api/whatsapp/queues',require(_0x8237('0xff')));_0x190509['use'](_0x8237('0x100'),require(_0x8237('0x101')));_0x190509[_0x8237('0xa')](_0x8237('0x102'),require('./api/authLocal'));_0x190509[_0x8237('0xa')](_0x8237('0x103'),require('./api/authGoogle'));_0x190509[_0x8237('0xa')](_0x8237('0x104'),require(_0x8237('0x105')));_0x190509['use'](_0x8237('0x106'),require(_0x8237('0x107')));_0x190509[_0x8237('0xa')](_0x8237('0x108'),require(_0x8237('0x109')));_0x190509['use'](_0x8237('0x10a'),require(_0x8237('0x10b')));_0x190509[_0x8237('0xa')]('/api/pm2',require(_0x8237('0x10c')));_0x190509[_0x8237('0xa')]('/api/webbar',require(_0x8237('0x10d')));_0x190509[_0x8237('0xa')](_0x8237('0x10e'),express[_0x8237('0x10f')](path['join'](config['root'],_0x8237('0x10e'))));_0x190509['use'](_0x8237('0x110'),express[_0x8237('0x10f')](path[_0x8237('0x111')](config[_0x8237('0x112')],_0x8237('0x110'))));_0x190509[_0x8237('0xa')](_0x8237('0x113'),express['static'](path['join'](config['root'],_0x8237('0x113'))));_0x190509[_0x8237('0xa')](_0x8237('0x114'),express[_0x8237('0x10f')](path['join'](config[_0x8237('0x112')],_0x8237('0x115'),_0x8237('0x116'))));_0x190509['use'](_0x8237('0x117'),express[_0x8237('0x10f')](path[_0x8237('0x111')](config[_0x8237('0x112')],'/server/files/plugins')));_0x190509['route'](_0x8237('0x118'))[_0x8237('0x119')](errors[0x194]);_0x190509[_0x8237('0x11a')]('/*')[_0x8237('0x119')](function(_0x53bb53,_0x564814){_0x564814['sendFile'](path[_0x8237('0x11b')](_0x190509[_0x8237('0x119')](_0x8237('0x11c'))+'/index.html'));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 02984dc..879a80d 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf0b1=['../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.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/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.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/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','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/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc'];(function(_0x1dbf3d,_0x546c0d){var _0x385d36=function(_0x33ed86){while(--_0x33ed86){_0x1dbf3d['push'](_0x1dbf3d['shift']());}};_0x385d36(++_0x546c0d);}(_0xf0b1,0xfa));var _0x1f0b=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xf0b1[_0xbca1b1];return _0x4e1686;};'use strict';var jayson=require(_0x1f0b('0x0'));var BPromise=require(_0x1f0b('0x1'));var _=require(_0x1f0b('0x2'));var config=require(_0x1f0b('0x3'));exports[_0x1f0b('0x4')]=function(){return new BPromise(function(_0x277c99,_0x19bf4a){var _0x2708ed={};_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x6')));_0x2708ed=_['merge'](_0x2708ed,require(_0x1f0b('0x7')));_0x2708ed=_['merge'](_0x2708ed,require('../api/voiceQueue/voiceQueue.rpc'));_0x2708ed=_['merge'](_0x2708ed,require(_0x1f0b('0x8')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x9')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0xa')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0xb')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0xc')));_0x2708ed=_['merge'](_0x2708ed,require(_0x1f0b('0xd')));_0x2708ed=_['merge'](_0x2708ed,require(_0x1f0b('0xe')));_0x2708ed=_['merge'](_0x2708ed,require(_0x1f0b('0xf')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x10')));_0x2708ed=_['merge'](_0x2708ed,require(_0x1f0b('0x11')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x12')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require('../api/mailInteraction/mailInteraction.rpc'));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x13')));_0x2708ed=_['merge'](_0x2708ed,require('../api/mailApplication/mailApplication.rpc'));_0x2708ed=_['merge'](_0x2708ed,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x14')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x15')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x16')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require('../api/faxMessage/faxMessage.rpc'));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require('../api/faxQueue/faxQueue.rpc'));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x17')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x18')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x19')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require('../api/smsQueue/smsQueue.rpc'));_0x2708ed=_['merge'](_0x2708ed,require(_0x1f0b('0x1a')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x1b')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x1c')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x1d')));_0x2708ed=_['merge'](_0x2708ed,require(_0x1f0b('0x1e')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x1f')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x20')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x21')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x22')));_0x2708ed=_['merge'](_0x2708ed,require(_0x1f0b('0x23')));_0x2708ed=_['merge'](_0x2708ed,require(_0x1f0b('0x24')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x25')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x26')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x27')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require('../api/template/template.rpc'));_0x2708ed=_['merge'](_0x2708ed,require(_0x1f0b('0x28')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x29')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x2a')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x2b')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x2c')));_0x2708ed=_['merge'](_0x2708ed,require(_0x1f0b('0x2d')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x2e')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x2f')));_0x2708ed=_['merge'](_0x2708ed,require(_0x1f0b('0x30')));_0x2708ed=_['merge'](_0x2708ed,require(_0x1f0b('0x31')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x32')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x33')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x34')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x35')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x36')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x37')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require('../api/squareMessage/squareMessage.rpc'));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x38')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require('../api/attachment/attachment.rpc'));_0x2708ed=_['merge'](_0x2708ed,require('../api/plugin/plugin.rpc'));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require(_0x1f0b('0x39')));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x2708ed=_[_0x1f0b('0x5')](_0x2708ed,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x2708ed=_['merge'](_0x2708ed,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x2708ed=_['merge'](_0x2708ed,require(_0x1f0b('0x3a')));var _0x43a460=jayson['server'](_0x2708ed)[_0x1f0b('0x3b')]();var _0x582e8e=config[_0x1f0b('0x3c')][_0x1f0b('0x3d')]||config[_0x1f0b('0x3d')]+0x1;var _0x4b7dc9=config[_0x1f0b('0x3c')]['ip']||_0x1f0b('0x3e');_0x43a460['on'](_0x1f0b('0x3f'),function(_0x53dc46){return _0x19bf4a(_0x53dc46);});_0x43a460[_0x1f0b('0x4')](_0x582e8e,_0x4b7dc9,function(){console[_0x1f0b('0x40')](_0x1f0b('0x41'),_0x4b7dc9,_0x582e8e);require(_0x1f0b('0x42'))[_0x1f0b('0x43')]();return _0x277c99(_0x1f0b('0x44')+_0x4b7dc9+':'+_0x582e8e);});});}; \ No newline at end of file +var _0x6739=['../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.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/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc'];(function(_0x53d447,_0xe8abb6){var _0x11f0b9=function(_0x443686){while(--_0x443686){_0x53d447['push'](_0x53d447['shift']());}};_0x11f0b9(++_0xe8abb6);}(_0x6739,0x194));var _0x9673=function(_0x51d91e,_0x288045){_0x51d91e=_0x51d91e-0x0;var _0x476aa4=_0x6739[_0x51d91e];return _0x476aa4;};'use strict';var jayson=require(_0x9673('0x0'));var BPromise=require(_0x9673('0x1'));var _=require(_0x9673('0x2'));var config=require(_0x9673('0x3'));exports[_0x9673('0x4')]=function(){return new BPromise(function(_0x4e26bb,_0x4280a2){var _0x4b2d59={};_0x4b2d59=_['merge'](_0x4b2d59,require(_0x9673('0x5')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x7')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x8')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require('../api/voiceRecording/voiceRecording.rpc'));_0x4b2d59=_['merge'](_0x4b2d59,require(_0x9673('0x9')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0xa')));_0x4b2d59=_['merge'](_0x4b2d59,require(_0x9673('0xb')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require('../api/memberReport/memberReport.rpc'));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0xc')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0xd')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0xe')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0xf')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x10')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require('../api/mailInteraction/mailInteraction.rpc'));_0x4b2d59=_['merge'](_0x4b2d59,require(_0x9673('0x11')));_0x4b2d59=_['merge'](_0x4b2d59,require(_0x9673('0x12')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x13')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x14')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x15')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require('../api/faxInteraction/faxInteraction.rpc'));_0x4b2d59=_['merge'](_0x4b2d59,require('../api/faxMessage/faxMessage.rpc'));_0x4b2d59=_['merge'](_0x4b2d59,require(_0x9673('0x16')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x17')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x18')));_0x4b2d59=_['merge'](_0x4b2d59,require(_0x9673('0x19')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x1a')));_0x4b2d59=_['merge'](_0x4b2d59,require(_0x9673('0x1b')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x1c')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x1d')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x1e')));_0x4b2d59=_['merge'](_0x4b2d59,require(_0x9673('0x1f')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x20')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require('../api/chatMessage/chatMessage.rpc'));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x21')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require('../api/cmContact/cmContact.rpc'));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require('../api/cmHopper/cmHopper.rpc'));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x22')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x4b2d59=_['merge'](_0x4b2d59,require(_0x9673('0x23')));_0x4b2d59=_['merge'](_0x4b2d59,require(_0x9673('0x24')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x25')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x26')));_0x4b2d59=_['merge'](_0x4b2d59,require('../api/sound/sound.rpc'));_0x4b2d59=_['merge'](_0x4b2d59,require(_0x9673('0x27')));_0x4b2d59=_['merge'](_0x4b2d59,require(_0x9673('0x28')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x29')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x2a')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x2b')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x2c')));_0x4b2d59=_['merge'](_0x4b2d59,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x4b2d59=_['merge'](_0x4b2d59,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x4b2d59=_['merge'](_0x4b2d59,require(_0x9673('0x2d')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x2e')));_0x4b2d59=_['merge'](_0x4b2d59,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x2f')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x30')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x31')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x32')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x33')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require('../api/squareProject/squareProject.rpc'));_0x4b2d59=_['merge'](_0x4b2d59,require('../api/squareRecording/squareRecording.rpc'));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x34')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x35')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x36')));_0x4b2d59=_['merge'](_0x4b2d59,require(_0x9673('0x37')));_0x4b2d59=_['merge'](_0x4b2d59,require(_0x9673('0x38')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x39')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x3a')));_0x4b2d59=_[_0x9673('0x6')](_0x4b2d59,require(_0x9673('0x3b')));var _0x3bce12=jayson[_0x9673('0x3c')](_0x4b2d59)[_0x9673('0x3d')]();var _0x585572=config[_0x9673('0x3e')][_0x9673('0x3f')]||config[_0x9673('0x3f')]+0x1;var _0x41c912=config[_0x9673('0x3e')]['ip']||_0x9673('0x40');_0x3bce12['on'](_0x9673('0x41'),function(_0x4c13e2){return _0x4280a2(_0x4c13e2);});_0x3bce12[_0x9673('0x4')](_0x585572,_0x41c912,function(){console[_0x9673('0x42')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x41c912,_0x585572);require(_0x9673('0x43'))['default']();return _0x4e26bb(_0x9673('0x44')+_0x41c912+':'+_0x585572);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 03d7fcc..6cf13f4 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file +var _0x9c44=['no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 406fd02..6b43e29 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 _0xa1fd=['Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','exports','util'];(function(_0x3af469,_0x13e385){var _0x3385d2=function(_0x193861){while(--_0x193861){_0x3af469['push'](_0x3af469['shift']());}};_0x3385d2(++_0x13e385);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x20e5c3,_0x41470c){_0x20e5c3=_0x20e5c3-0x0;var _0x401520=_0xa1fd[_0x20e5c3];return _0x401520;};'use strict';var util=require(_0xda1f('0x0'));var error={'E_AGI_UNDEFINED':_0xda1f('0x1'),'E_AGI_ARGUMENT_PORT':_0xda1f('0x2'),'E_AGI_SERVER_ERROR':_0xda1f('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xda1f('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xda1f('0x5'),'E_AGI_SOCKET_ERROR':_0xda1f('0x6'),'E_AGI_SOCKET_CLOSE':_0xda1f('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xda1f('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xda1f('0x9'),'E_AGI_IVR_ENTRY':_0xda1f('0xa')};function AGIError(_0x362dee){var _0x362dee=_0x362dee||null,_0x33502e=_0x33502e||[],_0x46a29e=0x1,_0x199a8d='';if(!error[_0x362dee]){_0x362dee=_0xda1f('0xb');}_0x33502e[_0xda1f('0xc')](error[_0x362dee]);while(arguments[_0x46a29e]){_0x33502e[_0xda1f('0xc')](arguments[_0x46a29e]);_0x46a29e++;}_0x199a8d=util[_0xda1f('0xd')][_0xda1f('0xe')](util,_0x33502e);this[_0xda1f('0xf')]=_0x199a8d;this['name']=_0x362dee;}module[_0xda1f('0x10')]=AGIError; \ No newline at end of file +var _0x40b5=['Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x40b5,0x1d7));var _0x540b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40b5[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x540b('0x0'));var error={'E_AGI_UNDEFINED':_0x540b('0x1'),'E_AGI_ARGUMENT_PORT':_0x540b('0x2'),'E_AGI_SERVER_ERROR':_0x540b('0x3'),'E_AGI_SERVER_CLOSE':_0x540b('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x540b('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x540b('0x6'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x540b('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x540b('0x8'),'E_AGI_COMMAND_EMPTY':_0x540b('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x540b('0xa'),'E_AGI_IVR_ENTRY':_0x540b('0xb')};function AGIError(_0x4e0a29){var _0x4e0a29=_0x4e0a29||null,_0x448b68=_0x448b68||[],_0x316ab7=0x1,_0x5aeb5f='';if(!error[_0x4e0a29]){_0x4e0a29='E_AGI_UNDEFINED';}_0x448b68[_0x540b('0xc')](error[_0x4e0a29]);while(arguments[_0x316ab7]){_0x448b68['push'](arguments[_0x316ab7]);_0x316ab7++;}_0x5aeb5f=util['format']['apply'](util,_0x448b68);this[_0x540b('0xd')]=_0x5aeb5f;this['name']=_0x4e0a29;}module[_0x540b('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index ad468d7..51f42e1 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 _0x1ba2=['numberOfEdges','addVertex','addEdge','push','size','prototype','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','no\x20edge/s\x20available','length','condition','split','agicommand','target','default','menu','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','agi','getdigits','getsecretdigits','vertices','edges'];(function(_0x159610,_0x3017ea){var _0x2b4b58=function(_0x590045){while(--_0x590045){_0x159610['push'](_0x159610['shift']());}};_0x2b4b58(++_0x3017ea);}(_0x1ba2,0xb4));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x21ba('0x0'));var logger=require('../../../config/logger')(_0x21ba('0x1'));var verticesWithRetry=['menu',_0x21ba('0x2'),_0x21ba('0x3')];var Graph=function(){this[_0x21ba('0x4')]={};this[_0x21ba('0x5')]={};this[_0x21ba('0x6')]=0x0;};Graph['prototype'][_0x21ba('0x7')]=function(_0x13a04e){this['vertices'][_0x13a04e['id']]=_0x13a04e;this[_0x21ba('0x5')][_0x13a04e['id']]=[];};Graph['prototype'][_0x21ba('0x8')]=function(_0x23c3b7,_0x5c50aa,_0x17755a){this['edges'][_0x23c3b7][_0x21ba('0x9')]({'target':_0x5c50aa,'condition':_0x17755a});this[_0x21ba('0x6')]+=0x1;};Graph['prototype'][_0x21ba('0xa')]=function(){return _[_0x21ba('0xa')](this[_0x21ba('0x4')]);};Graph[_0x21ba('0xb')][_0x21ba('0xc')]=function(){return this[_0x21ba('0x6')];};Graph[_0x21ba('0xb')][_0x21ba('0xd')]=function(_0x598045){return this[_0x21ba('0x4')][_0x598045];};Graph[_0x21ba('0xb')][_0x21ba('0xe')]=function(_0x48f552,_0x4deda3){if(!this[_0x21ba('0x4')][_0x48f552]){return logger[_0x21ba('0xf')](_0x21ba('0x10'));}var _0x4f43e2=_0x4deda3(this['vertices'][_0x48f552]);if(!_0x4f43e2){return logger[_0x21ba('0xf')]('stop\x20traverse');}if(this[_0x21ba('0x5')][_0x48f552]['length']===0x0){return logger[_0x21ba('0xf')](_0x21ba('0x11'));}for(var _0x17df0e=0x0,_0x1c2bac=[],_0x10b9e6=![];_0x17df0e\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','joinAt','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','clear','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','evtHangup','response','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','connection','xml2json','lodash','syncho','moment','../../config/logger','agi','./rpc','./graph','./vertices','defaults','nextTick','error','stack','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','toJson','mxGraphModel','root','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','addEdge','source','target','value','getSquareProject'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xd0bb[_0x5f09c5];return _0x426ad9;};'use strict';var parser=require(_0xbd0b('0x0'));var _=require(_0xbd0b('0x1'));var syncho=require(_0xbd0b('0x2'));var util=require('util');var moment=require(_0xbd0b('0x3'));var config=require('../../config/environment');var logger=require(_0xbd0b('0x4'))(_0xbd0b('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0xbd0b('0x6'));var mailRpc=require('./mailRpc');var Graph=require(_0xbd0b('0x7'));var Vertices=require(_0xbd0b('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xbd0b('0x5')]=_[_0xbd0b('0x9')](config[_0xbd0b('0x5')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x2a4075){process[_0xbd0b('0xa')](function(){syncho(function(){try{setChannelVariables(_0x2a4075);agiHandler(_0x2a4075);}catch(_0x39c099){logger[_0xbd0b('0xb')](_0x39c099[_0xbd0b('0xc')]);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xbd0b('0x5')][_0xbd0b('0xd')]);logger['info'](util[_0xbd0b('0xe')](_0xbd0b('0xf'),config['agi']['ip'],config[_0xbd0b('0x5')][_0xbd0b('0xd')]));}function errorHandler(_0x3a4b28){if(_0x3a4b28&&_0x3a4b28[_0xbd0b('0x10')]&&_0x3a4b28[_0xbd0b('0x11')]){logger[_0xbd0b('0xb')](util[_0xbd0b('0xe')](_0xbd0b('0x12'),_0x3a4b28[_0xbd0b('0x10')],_0x3a4b28[_0xbd0b('0x11')]));}else{logger[_0xbd0b('0xb')](util['format'](_0xbd0b('0x13'),_0x3a4b28['stack']));}}function closeHandler(){logger['info'](util[_0xbd0b('0xe')](_0xbd0b('0x14'),this[_0xbd0b('0x15')],this[_0xbd0b('0x16')],this[_0xbd0b('0x17')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x2136ef){logger[_0xbd0b('0xb')](_0x2136ef[_0xbd0b('0xc')]);}}function timeoutHandler(){logger[_0xbd0b('0x18')](util[_0xbd0b('0xe')](_0xbd0b('0x19'),this['arg_1'],this[_0xbd0b('0x16')],this['callerid'],this[_0xbd0b('0x1a')],this[_0xbd0b('0x1b')]));}function hangupHandler(){logger[_0xbd0b('0x18')](util[_0xbd0b('0xe')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xbd0b('0x15')],this[_0xbd0b('0x16')],this[_0xbd0b('0x17')],this['dnid'],this[_0xbd0b('0x1b')]));this['evtHangup']=!![];}function getRoot(_0xc66b8){return parser[_0xbd0b('0x1c')](_0xc66b8,{'object':!![]})[_0xbd0b('0x1d')][_0xbd0b('0x1e')];}function addVertex(_0x297c85,_0x539359,_0x75909f){_0x539359['agicommand']=_0x75909f;if(_0x539359[_0xbd0b('0x1f')](_0xbd0b('0x20'))){_0x539359[_0xbd0b('0x21')]=parseInt(_0x539359[_0xbd0b('0x20')],0xa);}_0x297c85[_0xbd0b('0x22')](_[_0xbd0b('0x23')](_0x539359,'mxCell'));}function initGraph(_0x382f76,_0x1b46a3){var _0x33b752=new Graph();for(var _0x1b5a00 in _0x382f76){if(_0x382f76[_0xbd0b('0x1f')](_0x1b5a00)){if(_[_0xbd0b('0x24')](_0x382f76[_0x1b5a00])){for(var _0x47f6f5=0x0;_0x47f6f5<_0x382f76[_0x1b5a00][_0xbd0b('0x25')];_0x47f6f5+=0x1){addVertex(_0x33b752,_0x382f76[_0x1b5a00][_0x47f6f5],_0x1b5a00);}}else{addVertex(_0x33b752,_0x382f76[_0x1b5a00],_0x1b5a00);}}}for(var _0x28f1a7=0x0;_0x28f1a7<_0x1b46a3[_0xbd0b('0x25')];_0x28f1a7+=0x1){if(_0x1b46a3[_0x28f1a7]['source']&&_0x1b46a3[_0x28f1a7]['target']){_0x33b752[_0xbd0b('0x26')](_0x1b46a3[_0x28f1a7][_0xbd0b('0x27')],_0x1b46a3[_0x28f1a7][_0xbd0b('0x28')],_0x1b46a3[_0x28f1a7][_0xbd0b('0x29')]);}}return _0x33b752;}function getSquareProject(_0x4e2149,_0x38926f){rpc[_0xbd0b('0x2a')](_0x4e2149)['then'](function(_0x45f7d6){_0x38926f(null,_0x45f7d6);})[_0xbd0b('0x2b')](function(_0x5e1cb3){_0x38926f(null,_0x5e1cb3);});}function createSquareReport(_0x5e5e69,_0x206c6a){rpc[_0xbd0b('0x2c')](_0x5e5e69)['then'](function(_0x31bdd3){if(_0x206c6a){_0x206c6a(null,_0x31bdd3);}})[_0xbd0b('0x2b')](function(_0x431e51){if(_0x206c6a){_0x206c6a(null,_0x431e51);}});}function setChannelVariables(_0x417e25){for(var _0x3ce614 in _0x417e25){if(_0x417e25[_0xbd0b('0x1f')](_0x3ce614)){if(_0x3ce614['indexOf'](_0xbd0b('0x2d'))===0x0){_0x417e25[_0x3ce614[_0xbd0b('0x2e')](0x4)]=_0x417e25[_0x3ce614];delete _0x417e25[_0x3ce614];}}}}function getLogFromObject(_0x32572e){return util[_0xbd0b('0x2f')](_0x32572e,{'showHidden':![],'depth':null});}function agiHandler(_0x2aec53){var _0x3ced2f,_0x2c94d4,_0x1029a0,_0x10e06b,_0x3ac75f;logger[_0xbd0b('0x30')](_0xbd0b('0x31'),JSON[_0xbd0b('0x32')](_0x2aec53,null,0x2));logger[_0xbd0b('0x18')](util['format'](_0xbd0b('0x33'),_0x2aec53[_0xbd0b('0x15')],_0x2aec53['calleridname'],_0x2aec53[_0xbd0b('0x17')],_0x2aec53[_0xbd0b('0x1a')],_0x2aec53[_0xbd0b('0x1b')]));_0x2aec53['on'](_0xbd0b('0xb'),errorHandler);_0x2aec53['on'](_0xbd0b('0x34'),closeHandler);_0x2aec53['on'](_0xbd0b('0x35'),timeoutHandler);_0x2aec53['evtHangup']=![];_0x2aec53['on'](_0xbd0b('0x36'),hangupHandler);var _0x11cf5a=getSquareProject[_0xbd0b('0x37')](null,_0x2aec53[_0xbd0b('0x15')]);if(_0x11cf5a){if(_0x11cf5a[_0xbd0b('0x38')]){_0x3ced2f=getRoot(_0x11cf5a['production']);if(_0x3ced2f&&_0x3ced2f['start']){logger[_0xbd0b('0x30')](_0xbd0b('0x1e'),JSON[_0xbd0b('0x32')](_0x3ced2f,null,0x2));_0x2aec53[_0xbd0b('0x39')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2c94d4=initGraph(_[_0xbd0b('0x23')](_0x3ced2f,'mxCell'),_0x3ced2f[_0xbd0b('0x3a')]);_0x1029a0=new Vertices(_0x2aec53,rpc,mailRpc);logger[_0xbd0b('0x18')](util[_0xbd0b('0xe')](_0xbd0b('0x3b'),_0x2aec53[_0xbd0b('0x15')],_0x2aec53[_0xbd0b('0x16')],_0x2aec53[_0xbd0b('0x17')],_0x2aec53[_0xbd0b('0x1a')],_0x2aec53[_0xbd0b('0x1b')]));_0x2c94d4[_0xbd0b('0x3c')](_0x3ced2f[_0xbd0b('0x3d')]['id'],function(_0x411872){try{_0x411872=_0x1029a0[_0xbd0b('0x3e')](_0x411872);logger[_0xbd0b('0x30')](_0xbd0b('0x3f'),JSON[_0xbd0b('0x32')](_0x411872,null,0x2));if(_0x411872[_0xbd0b('0x40')]===_0xbd0b('0x41')){logger['info'](_0xbd0b('0x42'));_0x2aec53[_0xbd0b('0x43')]=_0x411872[_0xbd0b('0x43')]||_0x2aec53[_0xbd0b('0x43')];_0x2aec53[_0xbd0b('0x44')]=_0x411872[_0xbd0b('0x44')];_0x2aec53[_0xbd0b('0x45')]=_0x411872[_0xbd0b('0x45')]?_0x411872[_0xbd0b('0x45')]-0x1:0x1;return null;}else if(_0x411872&&_0x1029a0[_0x411872[_0xbd0b('0x40')]]){_0x3ac75f=_0x1029a0[_0x411872[_0xbd0b('0x40')]](_0x411872);logger[_0xbd0b('0x18')]('response',JSON[_0xbd0b('0x32')](_0x3ac75f,null,0x2));if(_0x3ac75f&&_0x3ac75f['code']===AGI_CODE_SUCCESS&&_0x3ac75f['result']!==AGI_RESULT_ERROR&&!_0x2aec53[_0xbd0b('0x46')]){logger[_0xbd0b('0x30')](_0xbd0b('0x47'),getLogFromObject(_0x3ac75f));return _['isUndefined'](_0x3ac75f[_0xbd0b('0x48')])?null:_0x3ac75f[_0xbd0b('0x48')][_0xbd0b('0x49')]();}else{logger[_0xbd0b('0xb')](_0xbd0b('0x47'),getLogFromObject(_0x3ac75f));return null;}}else{logger['error'](_0xbd0b('0x4a'));return null;}}catch(_0x3619b9){logger[_0xbd0b('0xb')](_0x3619b9[_0xbd0b('0xc')]);return null;}});if(_0x3ced2f[_0xbd0b('0x4b')]){logger[_0xbd0b('0x18')](util['format'](_0xbd0b('0x4c'),_0x2aec53[_0xbd0b('0x15')],_0x2aec53[_0xbd0b('0x16')],_0x2aec53[_0xbd0b('0x17')],_0x2aec53[_0xbd0b('0x1a')],_0x2aec53[_0xbd0b('0x1b')]));_0x2c94d4[_0xbd0b('0x3c')](_0x3ced2f[_0xbd0b('0x4b')]['id'],function(_0xc8b3f){try{_0xc8b3f=_0x1029a0[_0xbd0b('0x3e')](_0xc8b3f);logger[_0xbd0b('0x30')](_0xbd0b('0x3f'),JSON[_0xbd0b('0x32')](_0xc8b3f,null,0x2));if(_0xc8b3f&&_0x1029a0[_0xc8b3f[_0xbd0b('0x40')]]){_0x3ac75f=_0x1029a0[_0xc8b3f[_0xbd0b('0x40')]](_0xc8b3f);if(_0x3ac75f){logger[_0xbd0b('0x30')](_0xbd0b('0x47'),getLogFromObject(_0x3ac75f));return _[_0xbd0b('0x4d')](_0x3ac75f[_0xbd0b('0x48')])?null:_0x3ac75f[_0xbd0b('0x48')][_0xbd0b('0x49')]();}else{logger[_0xbd0b('0xb')](_0xbd0b('0x47'),getLogFromObject(_0x3ac75f));return null;}}else{logger['error'](_0xbd0b('0x4a'));return null;}}catch(_0x1c13da){logger['error'](_0x1c13da['stack']);return null;}});}logger['info'](util[_0xbd0b('0xe')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2aec53[_0xbd0b('0x15')],_0x2aec53[_0xbd0b('0x16')],_0x2aec53[_0xbd0b('0x17')],_0x2aec53[_0xbd0b('0x1a')],_0x2aec53['uniqueid']));logger[_0xbd0b('0x18')](util['format'](_0xbd0b('0x4e'),_0x2aec53['context'],_0x2aec53['extension'],parseInt(_0x2aec53[_0xbd0b('0x45')],0xa)+0x1));_0x2aec53[_0xbd0b('0x4f')](_0x2aec53[_0xbd0b('0x43')],_0x2aec53[_0xbd0b('0x44')],parseInt(_0x2aec53[_0xbd0b('0x45')],0xa)+0x1);_0x2aec53[_0xbd0b('0x34')]();}}else{logger[_0xbd0b('0xb')](util[_0xbd0b('0xe')]('Project\x20%s\x20not\x20published',_0x2aec53['arg_1']));_0x2aec53[_0xbd0b('0x4f')](_0x2aec53[_0xbd0b('0x43')],_0x2aec53['extension'],parseInt(_0x2aec53['priority'],0xa)+0x1);_0x2aec53[_0xbd0b('0x34')]();}}else{logger[_0xbd0b('0xb')](util[_0xbd0b('0xe')](_0xbd0b('0x50'),_0x2aec53['arg_1']));_0x2aec53[_0xbd0b('0x4f')](_0x2aec53[_0xbd0b('0x43')],_0x2aec53[_0xbd0b('0x44')],parseInt(_0x2aec53[_0xbd0b('0x45')],0xa)+0x1);_0x2aec53['close']();}}function main(){var _0xa6ac89;return utilLicense[_0xbd0b('0x51')]()['then'](function(_0x122a19){if(_0x122a19){if(_0x122a19[_0xbd0b('0x52')]){if(_0x122a19[_0xbd0b('0x53')]&&_0x122a19[_0xbd0b('0x53')]>0x0){logger[_0xbd0b('0x18')](util[_0xbd0b('0xe')](_0xbd0b('0x54'),_0x122a19[_0xbd0b('0x53')]));_0xa6ac89=_0x122a19['callysquare'];}else{logger[_0xbd0b('0x18')](_0xbd0b('0x55'));}}else{logger[_0xbd0b('0x18')](_0xbd0b('0x56'));_0xa6ac89=-0x1;}}})[_0xbd0b('0x2b')](function(_0x1076dc){logger['error']('[LICENSE]',_0x1076dc[_0xbd0b('0xc')]);})[_0xbd0b('0x4b')](function(){var _0x4d23cd=require(_0xbd0b('0x57'))(config[_0xbd0b('0x5')][_0xbd0b('0xd')],config[_0xbd0b('0x5')]['ip'],_0xa6ac89);_0x4d23cd['on'](_0xbd0b('0xb'),errorHandler);_0x4d23cd['on']('listening',listeningHandler);_0x4d23cd['on'](_0xbd0b('0x58'),connectionHandler);_0x4d23cd['on'](_0xbd0b('0x34'),closeHandler);});}main(); \ No newline at end of file +var _0xfc76=['voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch','connection','lodash','syncho','util','moment','../../config/environment','agi','../../config/license/util','./mailRpc','./vertices','defaults','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','addEdge','target','value','getSquareProject','then','createSquareReport','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','evtHangup','production','root','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','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense'];(function(_0x3d7e8d,_0x3a1df3){var _0x511a74=function(_0x383d74){while(--_0x383d74){_0x3d7e8d['push'](_0x3d7e8d['shift']());}};_0x511a74(++_0x3a1df3);}(_0xfc76,0xb5));var _0x6fc7=function(_0x5a839b,_0x4a7964){_0x5a839b=_0x5a839b-0x0;var _0x4a9366=_0xfc76[_0x5a839b];return _0x4a9366;};'use strict';var parser=require('xml2json');var _=require(_0x6fc7('0x0'));var syncho=require(_0x6fc7('0x1'));var util=require(_0x6fc7('0x2'));var moment=require(_0x6fc7('0x3'));var config=require(_0x6fc7('0x4'));var logger=require('../../config/logger')(_0x6fc7('0x5'));var utilLicense=require(_0x6fc7('0x6'));var rpc=require('./rpc');var mailRpc=require(_0x6fc7('0x7'));var Graph=require('./graph');var Vertices=require(_0x6fc7('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x6fc7('0x5')]=_[_0x6fc7('0x9')](config['agi'],{'ip':_0x6fc7('0xa'),'port':0x11dd});function connectionHandler(_0x407b0a){process[_0x6fc7('0xb')](function(){syncho(function(){try{setChannelVariables(_0x407b0a);agiHandler(_0x407b0a);}catch(_0x1d4fee){logger[_0x6fc7('0xc')](_0x1d4fee[_0x6fc7('0xd')]);}});});}function listeningHandler(){console['log'](_0x6fc7('0xe'),config[_0x6fc7('0x5')][_0x6fc7('0xf')]);logger[_0x6fc7('0x10')](util[_0x6fc7('0x11')](_0x6fc7('0x12'),config['agi']['ip'],config[_0x6fc7('0x5')][_0x6fc7('0xf')]));}function errorHandler(_0x5cd139){if(_0x5cd139&&_0x5cd139[_0x6fc7('0x13')]&&_0x5cd139[_0x6fc7('0x14')]){logger['error'](util[_0x6fc7('0x11')](_0x6fc7('0x15'),_0x5cd139['name'],_0x5cd139[_0x6fc7('0x14')]));}else{logger[_0x6fc7('0xc')](util[_0x6fc7('0x11')]('[ERROR]\x20%s',_0x5cd139['stack']));}}function closeHandler(){logger[_0x6fc7('0x10')](util[_0x6fc7('0x11')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x6fc7('0x16')],this[_0x6fc7('0x17')],this[_0x6fc7('0x18')],this[_0x6fc7('0x19')],this['uniqueid']));try{createSquareReport(this);}catch(_0x816704){logger[_0x6fc7('0xc')](_0x816704[_0x6fc7('0xd')]);}}function timeoutHandler(){logger[_0x6fc7('0x10')](util[_0x6fc7('0x11')](_0x6fc7('0x1a'),this['arg_1'],this[_0x6fc7('0x17')],this[_0x6fc7('0x18')],this[_0x6fc7('0x19')],this[_0x6fc7('0x1b')]));}function hangupHandler(){logger[_0x6fc7('0x10')](util['format'](_0x6fc7('0x1c'),this[_0x6fc7('0x16')],this['calleridname'],this[_0x6fc7('0x18')],this['dnid'],this[_0x6fc7('0x1b')]));this['evtHangup']=!![];}function getRoot(_0x11b359){return parser[_0x6fc7('0x1d')](_0x11b359,{'object':!![]})[_0x6fc7('0x1e')]['root'];}function addVertex(_0x45e53e,_0x4a4cdf,_0x2dd21a){_0x4a4cdf[_0x6fc7('0x1f')]=_0x2dd21a;if(_0x4a4cdf[_0x6fc7('0x20')](_0x6fc7('0x21'))){_0x4a4cdf[_0x6fc7('0x22')]=parseInt(_0x4a4cdf[_0x6fc7('0x21')],0xa);}_0x45e53e[_0x6fc7('0x23')](_[_0x6fc7('0x24')](_0x4a4cdf,_0x6fc7('0x25')));}function initGraph(_0x2759ad,_0xaa2687){var _0x426872=new Graph();for(var _0x4612d4 in _0x2759ad){if(_0x2759ad[_0x6fc7('0x20')](_0x4612d4)){if(_[_0x6fc7('0x26')](_0x2759ad[_0x4612d4])){for(var _0x5880cc=0x0;_0x5880cc<_0x2759ad[_0x4612d4][_0x6fc7('0x27')];_0x5880cc+=0x1){addVertex(_0x426872,_0x2759ad[_0x4612d4][_0x5880cc],_0x4612d4);}}else{addVertex(_0x426872,_0x2759ad[_0x4612d4],_0x4612d4);}}}for(var _0x3053b1=0x0;_0x3053b1<_0xaa2687[_0x6fc7('0x27')];_0x3053b1+=0x1){if(_0xaa2687[_0x3053b1][_0x6fc7('0x28')]&&_0xaa2687[_0x3053b1]['target']){_0x426872[_0x6fc7('0x29')](_0xaa2687[_0x3053b1][_0x6fc7('0x28')],_0xaa2687[_0x3053b1][_0x6fc7('0x2a')],_0xaa2687[_0x3053b1][_0x6fc7('0x2b')]);}}return _0x426872;}function getSquareProject(_0x34bf7f,_0x1465a7){rpc[_0x6fc7('0x2c')](_0x34bf7f)[_0x6fc7('0x2d')](function(_0x59a70e){_0x1465a7(null,_0x59a70e);})['catch'](function(_0x15a856){_0x1465a7(null,_0x15a856);});}function createSquareReport(_0x17ddfe,_0x3e796a){rpc[_0x6fc7('0x2e')](_0x17ddfe)[_0x6fc7('0x2d')](function(_0x3185ee){if(_0x3e796a){_0x3e796a(null,_0x3185ee);}})['catch'](function(_0x278f8f){if(_0x3e796a){_0x3e796a(null,_0x278f8f);}});}function setChannelVariables(_0xbf7528){for(var _0x16c514 in _0xbf7528){if(_0xbf7528[_0x6fc7('0x20')](_0x16c514)){if(_0x16c514['indexOf']('agi_')===0x0){_0xbf7528[_0x16c514['substring'](0x4)]=_0xbf7528[_0x16c514];delete _0xbf7528[_0x16c514];}}}}function getLogFromObject(_0xb80178){return util[_0x6fc7('0x2f')](_0xb80178,{'showHidden':![],'depth':null});}function agiHandler(_0x2fd248){var _0x4673d9,_0x129672,_0x241da7,_0x46aad4,_0x141898;logger[_0x6fc7('0x30')]('variables',JSON[_0x6fc7('0x31')](_0x2fd248,null,0x2));logger['info'](util[_0x6fc7('0x11')](_0x6fc7('0x32'),_0x2fd248[_0x6fc7('0x16')],_0x2fd248[_0x6fc7('0x17')],_0x2fd248['callerid'],_0x2fd248[_0x6fc7('0x19')],_0x2fd248[_0x6fc7('0x1b')]));_0x2fd248['on'](_0x6fc7('0xc'),errorHandler);_0x2fd248['on'](_0x6fc7('0x33'),closeHandler);_0x2fd248['on']('timeout',timeoutHandler);_0x2fd248[_0x6fc7('0x34')]=![];_0x2fd248['on']('hangup',hangupHandler);var _0xec700a=getSquareProject['sync'](null,_0x2fd248['arg_1']);if(_0xec700a){if(_0xec700a['production']){_0x4673d9=getRoot(_0xec700a[_0x6fc7('0x35')]);if(_0x4673d9&&_0x4673d9['start']){logger[_0x6fc7('0x30')](_0x6fc7('0x36'),JSON[_0x6fc7('0x31')](_0x4673d9,null,0x2));_0x2fd248[_0x6fc7('0x37')]=moment()[_0x6fc7('0x11')](_0x6fc7('0x38'));_0x129672=initGraph(_[_0x6fc7('0x24')](_0x4673d9,_0x6fc7('0x25')),_0x4673d9[_0x6fc7('0x25')]);_0x241da7=new Vertices(_0x2fd248,rpc,mailRpc);logger[_0x6fc7('0x10')](util[_0x6fc7('0x11')](_0x6fc7('0x39'),_0x2fd248[_0x6fc7('0x16')],_0x2fd248[_0x6fc7('0x17')],_0x2fd248[_0x6fc7('0x18')],_0x2fd248[_0x6fc7('0x19')],_0x2fd248[_0x6fc7('0x1b')]));_0x129672[_0x6fc7('0x3a')](_0x4673d9['start']['id'],function(_0x490f2e){try{_0x490f2e=_0x241da7[_0x6fc7('0x3b')](_0x490f2e);logger[_0x6fc7('0x30')](_0x6fc7('0x3c'),JSON[_0x6fc7('0x31')](_0x490f2e,null,0x2));if(_0x490f2e['agicommand']===_0x6fc7('0x3d')){logger[_0x6fc7('0x10')](_0x6fc7('0x3e'));_0x2fd248[_0x6fc7('0x3f')]=_0x490f2e[_0x6fc7('0x3f')]||_0x2fd248[_0x6fc7('0x3f')];_0x2fd248[_0x6fc7('0x40')]=_0x490f2e[_0x6fc7('0x40')];_0x2fd248[_0x6fc7('0x41')]=_0x490f2e[_0x6fc7('0x41')]?_0x490f2e[_0x6fc7('0x41')]-0x1:0x1;return null;}else if(_0x490f2e&&_0x241da7[_0x490f2e[_0x6fc7('0x1f')]]){_0x141898=_0x241da7[_0x490f2e['agicommand']](_0x490f2e);logger[_0x6fc7('0x10')](_0x6fc7('0x42'),JSON['stringify'](_0x141898,null,0x2));if(_0x141898&&_0x141898[_0x6fc7('0x43')]===AGI_CODE_SUCCESS&&_0x141898[_0x6fc7('0x44')]!==AGI_RESULT_ERROR&&!_0x2fd248[_0x6fc7('0x34')]){logger[_0x6fc7('0x30')](_0x6fc7('0x42'),getLogFromObject(_0x141898));return _[_0x6fc7('0x45')](_0x141898[_0x6fc7('0x44')])?null:_0x141898[_0x6fc7('0x44')][_0x6fc7('0x46')]();}else{logger[_0x6fc7('0xc')]('response',getLogFromObject(_0x141898));return null;}}else{logger[_0x6fc7('0xc')](_0x6fc7('0x47'));return null;}}catch(_0x494380){logger['error'](_0x494380[_0x6fc7('0xd')]);return null;}});if(_0x4673d9[_0x6fc7('0x48')]){logger[_0x6fc7('0x10')](util['format'](_0x6fc7('0x49'),_0x2fd248[_0x6fc7('0x16')],_0x2fd248['calleridname'],_0x2fd248[_0x6fc7('0x18')],_0x2fd248[_0x6fc7('0x19')],_0x2fd248[_0x6fc7('0x1b')]));_0x129672[_0x6fc7('0x3a')](_0x4673d9[_0x6fc7('0x48')]['id'],function(_0x2b24e8){try{_0x2b24e8=_0x241da7[_0x6fc7('0x3b')](_0x2b24e8);logger[_0x6fc7('0x30')](_0x6fc7('0x3c'),JSON[_0x6fc7('0x31')](_0x2b24e8,null,0x2));if(_0x2b24e8&&_0x241da7[_0x2b24e8[_0x6fc7('0x1f')]]){_0x141898=_0x241da7[_0x2b24e8['agicommand']](_0x2b24e8);if(_0x141898){logger['debug']('response',getLogFromObject(_0x141898));return _['isUndefined'](_0x141898[_0x6fc7('0x44')])?null:_0x141898['result'][_0x6fc7('0x46')]();}else{logger[_0x6fc7('0xc')](_0x6fc7('0x42'),getLogFromObject(_0x141898));return null;}}else{logger[_0x6fc7('0xc')](_0x6fc7('0x47'));return null;}}catch(_0x297146){logger['error'](_0x297146[_0x6fc7('0xd')]);return null;}});}logger[_0x6fc7('0x10')](util['format'](_0x6fc7('0x4a'),_0x2fd248[_0x6fc7('0x16')],_0x2fd248[_0x6fc7('0x17')],_0x2fd248[_0x6fc7('0x18')],_0x2fd248[_0x6fc7('0x19')],_0x2fd248[_0x6fc7('0x1b')]));logger[_0x6fc7('0x10')](util[_0x6fc7('0x11')](_0x6fc7('0x4b'),_0x2fd248[_0x6fc7('0x3f')],_0x2fd248['extension'],parseInt(_0x2fd248[_0x6fc7('0x41')],0xa)+0x1));_0x2fd248[_0x6fc7('0x4c')](_0x2fd248[_0x6fc7('0x3f')],_0x2fd248['extension'],parseInt(_0x2fd248[_0x6fc7('0x41')],0xa)+0x1);_0x2fd248['close']();}}else{logger[_0x6fc7('0xc')](util['format'](_0x6fc7('0x4d'),_0x2fd248[_0x6fc7('0x16')]));_0x2fd248[_0x6fc7('0x4c')](_0x2fd248[_0x6fc7('0x3f')],_0x2fd248[_0x6fc7('0x40')],parseInt(_0x2fd248[_0x6fc7('0x41')],0xa)+0x1);_0x2fd248[_0x6fc7('0x33')]();}}else{logger[_0x6fc7('0xc')](util['format'](_0x6fc7('0x4e'),_0x2fd248[_0x6fc7('0x16')]));_0x2fd248[_0x6fc7('0x4c')](_0x2fd248[_0x6fc7('0x3f')],_0x2fd248[_0x6fc7('0x40')],parseInt(_0x2fd248['priority'],0xa)+0x1);_0x2fd248[_0x6fc7('0x33')]();}}function main(){var _0x118f81;return utilLicense[_0x6fc7('0x4f')]()[_0x6fc7('0x2d')](function(_0x1927d6){if(_0x1927d6){if(_0x1927d6[_0x6fc7('0x50')]){if(_0x1927d6[_0x6fc7('0x51')]&&_0x1927d6[_0x6fc7('0x51')]>0x0){logger[_0x6fc7('0x10')](util[_0x6fc7('0x11')](_0x6fc7('0x52'),_0x1927d6['callysquare']));_0x118f81=_0x1927d6[_0x6fc7('0x51')];}else{logger[_0x6fc7('0x10')](_0x6fc7('0x53'));}}else{logger[_0x6fc7('0x10')](_0x6fc7('0x54'));_0x118f81=-0x1;}}})[_0x6fc7('0x55')](function(_0x39ae2f){logger[_0x6fc7('0xc')]('[LICENSE]',_0x39ae2f[_0x6fc7('0xd')]);})['finally'](function(){var _0x5da61c=require('./server')(config[_0x6fc7('0x5')][_0x6fc7('0xf')],config[_0x6fc7('0x5')]['ip'],_0x118f81);_0x5da61c['on']('error',errorHandler);_0x5da61c['on']('listening',listeningHandler);_0x5da61c['on'](_0x6fc7('0x56'),connectionHandler);_0x5da61c['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index f44e382..968843f 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x264f36,_0x3b54d5){var _0xbf8695=function(_0x523614){while(--_0x523614){_0x264f36['push'](_0x264f36['shift']());}};_0xbf8695(++_0x3b54d5);}(_0x814b,0x1a2));var _0xb814=function(_0x6148ee,_0x4d2fca){_0x6148ee=_0x6148ee-0x0;var _0x5afc74=_0x814b[_0x6148ee];return _0x5afc74;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x54a1c0,_0x58307b){var _0x3d35ce=function(_0x8b1b48){while(--_0x8b1b48){_0x54a1c0['push'](_0x54a1c0['shift']());}};_0x3d35ce(++_0x58307b);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index c6e1983..b104659 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 _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x4973e2,_0x3973a9){var _0x596228=function(_0x273cd0){while(--_0x273cd0){_0x4973e2['push'](_0x4973e2['shift']());}};_0x596228(++_0x3973a9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2df440,_0x190e84){_0x2df440=_0x2df440-0x0;var _0x2dac95=_0x5f2f[_0x2df440];return _0x2dac95;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x3ba5a4,_0x1ab3a2){var _0x361851=function(_0x2711bb){while(--_0x2711bb){_0x3ba5a4['push'](_0x3ba5a4['shift']());}};_0x361851(++_0x1ab3a2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4f5659,_0x2e4ec0){_0x4f5659=_0x4f5659-0x0;var _0x3d8556=_0x5f2f[_0x4f5659];return _0x3d8556;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 2a7a0fa..0493a52 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 _0x1ff8=['then','error','message','catch','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_1','arg_2','createSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','ShowPause','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1ff8,0x17e));var _0x81ff=function(_0x4eb747,_0x2a8d80){_0x4eb747=_0x4eb747-0x0;var _0x166652=_0x1ff8[_0x4eb747];return _0x166652;};'use strict';var BPromise=require(_0x81ff('0x0'));var moment=require('moment');var _=require('lodash');var util=require(_0x81ff('0x1'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x2329});function request(_0xbc745a,_0x5bd857){return new BPromise(function(_0x1499f8,_0x5c1ece){return client['request'](_0xbc745a,_0x5bd857)[_0x81ff('0x2')](function(_0x3337c7){if(_0x3337c7[_0x81ff('0x3')]){return _0x5c1ece(_0x3337c7[_0x81ff('0x3')][_0x81ff('0x4')]);}else{return _0x1499f8(_0x3337c7['result']);}})[_0x81ff('0x5')](function(_0xf7bbd0){return _0x5c1ece(_0xf7bbd0);});});}exports['getSquareProject']=function(_0x4a105f){return request(_0x81ff('0x6'),{'options':{'raw':![],'where':{'name':_0x4a105f},'attributes':[_0x81ff('0x7')]}});};exports[_0x81ff('0x8')]=function(_0x10f0d6){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x10f0d6},'include':[{'model':_0x81ff('0x9'),'as':_0x81ff('0xa')}],'attributes':['id',_0x81ff('0xb'),_0x81ff('0xc')]}});};exports[_0x81ff('0xd')]=function(_0x4b0c71){return request(_0x81ff('0x6'),{'options':{'where':{'id':_0x4b0c71},'attributes':['name']}});};exports[_0x81ff('0xe')]=function(_0x54cb40){return request(_0x81ff('0xf'),{'options':{'where':{'id':_0x54cb40},'attributes':[_0x81ff('0xb')]}});};exports[_0x81ff('0x10')]=function(_0x4c7de4){return request('ShowVariable',{'options':{'where':{'id':_0x4c7de4},'attributes':[_0x81ff('0xb')]}});};exports[_0x81ff('0x11')]=function(_0x2378e6){return request(_0x81ff('0x12'),{'options':{'where':{'id':_0x2378e6},'attributes':[_0x81ff('0x13')]}});};exports[_0x81ff('0x14')]=function(_0x44e7c5){return request('ShowUser',{'options':{'where':{'id':_0x44e7c5},'attributes':[_0x81ff('0xb')]}});};exports['getTrunkById']=function(_0x39b63b){return request(_0x81ff('0x15'),{'options':{'where':{'id':_0x39b63b},'attributes':[_0x81ff('0xb')]}});};exports[_0x81ff('0x16')]=function(_0x51cc18){return request(_0x81ff('0x17'),{'options':{'where':{'id':_0x51cc18},'attributes':[_0x81ff('0x18')]}});};exports[_0x81ff('0x19')]=function(_0x1ebb7f){return request(_0x81ff('0x1a'),{'options':{'raw':![],'where':{'id':_0x1ebb7f},'include':[{'model':_0x81ff('0x1b'),'as':_0x81ff('0x1c')}]}});};exports[_0x81ff('0x1d')]=function(_0x92fbe7){return request('ShowSmsAccount',{'options':{'where':{'id':_0x92fbe7},'attributes':['id',_0x81ff('0xb')]}});};exports['createSmsMessage']=function(_0x14de3b){return request('CreateSmsMessage',{'body':_0x14de3b});};exports[_0x81ff('0x1e')]=function(_0x3f472a){return request(_0x81ff('0x1f'),{'body':_0x3f472a});};exports['createSquareReport']=function(_0x42ac01){return request('CreateSquareReport',{'body':_[_0x81ff('0x20')](_0x42ac01,{'project_name':_0x42ac01[_0x81ff('0x21')],'prev_project_name':_0x42ac01['arg_2']||'','is_subproject':_0x42ac01[_0x81ff('0x22')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x81ff('0x23')]=function(_0x7f6828){return request('CreateSquareRecording',{'body':_0x7f6828});};exports[_0x81ff('0x24')]=function(_0x2dbfa3){return request('CreateSquareMessage',{'body':_0x2dbfa3});};exports[_0x81ff('0x25')]=function(_0x59e718){return request(_0x81ff('0x26'),{'options':{'raw':![],'where':{'phone':_0x59e718[_0x81ff('0x27')],'ListId':_0x59e718[_0x81ff('0x28')]}}})['then'](function(_0x9b3e6a){if(_0x9b3e6a){return _0x9b3e6a;}return request(_0x81ff('0x29'),{'body':_0x59e718});});};exports['getPauseById']=function(_0x289d76){return request(_0x81ff('0x2a'),{'options':{'where':{'id':_0x289d76},'attributes':[_0x81ff('0xb')]}});};exports['agentLogin']=function(_0x2ff22c,_0x3fa758){return request('LoginUser',{'body':{'interface':_0x3fa758},'options':{'where':_0x2ff22c}});};exports[_0x81ff('0x2b')]=function(_0x43800a,_0x47957b,_0x539577){return request(_0x81ff('0x2c'),{'body':{'type':_0x47957b,'uniqueid':_0x539577},'options':{'where':_0x43800a}});};exports[_0x81ff('0x2d')]=function(_0x2ecd57){return request(_0x81ff('0x2e'),{'body':{},'options':{'where':_0x2ecd57}});};exports['agentLogout']=function(_0x1f28b1){return request(_0x81ff('0x2f'),{'body':{},'options':{'where':_0x1f28b1}});}; \ No newline at end of file +var _0x9490=['agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','client','request','then','error','result','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','ShowSquareOdbc','dsn','ShowUser','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','CreateSquareMessage','createCmContact','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause'];(function(_0x57014b,_0x360c0f){var _0x2b258a=function(_0x52c4a3){while(--_0x52c4a3){_0x57014b['push'](_0x57014b['shift']());}};_0x2b258a(++_0x360c0f);}(_0x9490,0x148));var _0x0949=function(_0x3b633e,_0xe3037){_0x3b633e=_0x3b633e-0x0;var _0x1fd31e=_0x9490[_0x3b633e];return _0x1fd31e;};'use strict';var BPromise=require(_0x0949('0x0'));var moment=require(_0x0949('0x1'));var _=require(_0x0949('0x2'));var util=require(_0x0949('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x0949('0x4')]['http']({'port':0x2329});function request(_0xefc063,_0x1ccf37){return new BPromise(function(_0x3f266a,_0x17a5ae){return client[_0x0949('0x5')](_0xefc063,_0x1ccf37)[_0x0949('0x6')](function(_0x3ba763){if(_0x3ba763[_0x0949('0x7')]){return _0x17a5ae(_0x3ba763[_0x0949('0x7')]['message']);}else{return _0x3f266a(_0x3ba763[_0x0949('0x8')]);}})['catch'](function(_0x271841){return _0x17a5ae(_0x271841);});});}exports['getSquareProject']=function(_0x2eb4a0){return request(_0x0949('0x9'),{'options':{'raw':![],'where':{'name':_0x2eb4a0},'attributes':[_0x0949('0xa')]}});};exports[_0x0949('0xb')]=function(_0x42a0b9){return request(_0x0949('0xc'),{'options':{'raw':![],'where':{'id':_0x42a0b9},'include':[{'model':_0x0949('0xd'),'as':_0x0949('0xe')}],'attributes':['id',_0x0949('0xf'),'email']}});};exports[_0x0949('0x10')]=function(_0x5eea3c){return request('ShowSquareProject',{'options':{'where':{'id':_0x5eea3c},'attributes':[_0x0949('0xf')]}});};exports[_0x0949('0x11')]=function(_0x54a0a6){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x54a0a6},'attributes':[_0x0949('0xf')]}});};exports[_0x0949('0x12')]=function(_0x4b28e0){return request(_0x0949('0x13'),{'options':{'where':{'id':_0x4b28e0},'attributes':[_0x0949('0xf')]}});};exports['getSquareOdbcById']=function(_0x4b2787){return request(_0x0949('0x14'),{'options':{'where':{'id':_0x4b2787},'attributes':[_0x0949('0x15')]}});};exports['getUserById']=function(_0x2c3cf3){return request(_0x0949('0x16'),{'options':{'where':{'id':_0x2c3cf3},'attributes':['name']}});};exports['getTrunkById']=function(_0x35b594){return request(_0x0949('0x17'),{'options':{'where':{'id':_0x35b594},'attributes':[_0x0949('0xf')]}});};exports[_0x0949('0x18')]=function(_0x2e8382){return request(_0x0949('0x19'),{'options':{'where':{'id':_0x2e8382},'attributes':[_0x0949('0x1a')]}});};exports[_0x0949('0x1b')]=function(_0x3c3654){return request(_0x0949('0x1c'),{'options':{'raw':![],'where':{'id':_0x3c3654},'include':[{'model':_0x0949('0x1d'),'as':_0x0949('0x1e')}]}});};exports[_0x0949('0x1f')]=function(_0x4ff102){return request(_0x0949('0x20'),{'options':{'where':{'id':_0x4ff102},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x56b0ef){return request('CreateSmsMessage',{'body':_0x56b0ef});};exports[_0x0949('0x21')]=function(_0x44c930){return request(_0x0949('0x22'),{'body':_0x44c930});};exports[_0x0949('0x23')]=function(_0x3e24ec){return request(_0x0949('0x24'),{'body':_[_0x0949('0x25')](_0x3e24ec,{'project_name':_0x3e24ec[_0x0949('0x26')],'prev_project_name':_0x3e24ec[_0x0949('0x27')]||'','is_subproject':_0x3e24ec[_0x0949('0x27')]?!![]:![],'leaveAt':moment()['format'](_0x0949('0x28'))})});};exports['createSquareRecording']=function(_0x1d766e){return request('CreateSquareRecording',{'body':_0x1d766e});};exports[_0x0949('0x29')]=function(_0x1c6421){return request(_0x0949('0x2a'),{'body':_0x1c6421});};exports[_0x0949('0x2b')]=function(_0x4e4f98){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4e4f98['phone'],'ListId':_0x4e4f98[_0x0949('0x2c')]}}})['then'](function(_0x27fd6c){if(_0x27fd6c){return _0x27fd6c;}return request('CreateCmContact',{'body':_0x4e4f98});});};exports[_0x0949('0x2d')]=function(_0x567ef0){return request(_0x0949('0x2e'),{'options':{'where':{'id':_0x567ef0},'attributes':['name']}});};exports[_0x0949('0x2f')]=function(_0x563b37,_0x4c80db){return request(_0x0949('0x30'),{'body':{'interface':_0x4c80db},'options':{'where':_0x563b37}});};exports[_0x0949('0x31')]=function(_0x2aaaba,_0x16fcda,_0x1b1e9e){return request('PauseUser',{'body':{'type':_0x16fcda,'uniqueid':_0x1b1e9e},'options':{'where':_0x2aaaba}});};exports[_0x0949('0x32')]=function(_0x3af46c){return request(_0x0949('0x33'),{'body':{},'options':{'where':_0x3af46c}});};exports[_0x0949('0x34')]=function(_0x1d6da9){return request(_0x0949('0x35'),{'body':{},'options':{'where':_0x1d6da9}});}; \ 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 f309fd1..1cce63c 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 _0x2d17=['./polly','./lex'];(function(_0x54f9fd,_0x270058){var _0x51dc8a=function(_0x293b02){while(--_0x293b02){_0x54f9fd['push'](_0x54f9fd['shift']());}};_0x51dc8a(++_0x270058);}(_0x2d17,0x17e));var _0x72d1=function(_0x1caa28,_0x557041){_0x1caa28=_0x1caa28-0x0;var _0x4afbac=_0x2d17[_0x1caa28];return _0x4afbac;};var polly=require(_0x72d1('0x0'));var lex=require(_0x72d1('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x032e=['./polly','exports'];(function(_0x391924,_0x52a231){var _0x13c220=function(_0x168f91){while(--_0x168f91){_0x391924['push'](_0x391924['shift']());}};_0x13c220(++_0x52a231);}(_0x032e,0x124));var _0xe032=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x032e[_0x2dafbe];return _0x58a45a;};var polly=require(_0xe032('0x0'));var lex=require('./lex');module[_0xe032('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index df9d5d0..b291d53 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 _0x303a=['./lib/api'];(function(_0x2c877a,_0x30cc88){var _0x2f068b=function(_0x4e15db){while(--_0x4e15db){_0x2c877a['push'](_0x2c877a['shift']());}};_0x2f068b(++_0x30cc88);}(_0x303a,0x1a0));var _0xa303=function(_0xf5eaa0,_0x5bfa29){_0xf5eaa0=_0xf5eaa0-0x0;var _0x47039e=_0x303a[_0xf5eaa0];return _0x47039e;};'use strict';var lex=require(_0xa303('0x0'));module['exports']=function(_0x387608,_0x262522,_0x36e548,_0x19d27a,_0x594b49,_0x46c56b){return lex(_0x387608,_0x262522,_0x36e548,_0x19d27a,_0x594b49,_0x46c56b);}; \ No newline at end of file +var _0xe14d=['./lib/api','exports'];(function(_0x43815d,_0x59426d){var _0x4eb5f8=function(_0x628305){while(--_0x628305){_0x43815d['push'](_0x43815d['shift']());}};_0x4eb5f8(++_0x59426d);}(_0xe14d,0x1ee));var _0xde14=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xe14d[_0x28947d];return _0x12d2ee;};'use strict';var lex=require(_0xde14('0x0'));module[_0xde14('0x1')]=function(_0x1b5d3b,_0x41974a,_0x48b392,_0x1c5b4,_0x28965b,_0x4b20e2){return lex(_0x1b5d3b,_0x41974a,_0x48b392,_0x1c5b4,_0x28965b,_0x4b20e2);}; \ 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 37b5e0b..c0b8039 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 _0x1b7b=['slots','hasOwnProperty','slot_','exports','LexRuntime','bluebird','aws-sdk','postText'];(function(_0xa2981a,_0x2b8ce6){var _0x25b10a=function(_0x4f5dc4){while(--_0x4f5dc4){_0xa2981a['push'](_0xa2981a['shift']());}};_0x25b10a(++_0x2b8ce6);}(_0x1b7b,0x19d));var _0xb1b7=function(_0x451069,_0x298f29){_0x451069=_0x451069-0x0;var _0x3e41cd=_0x1b7b[_0x451069];return _0x3e41cd;};'use strict';var BPromise=require(_0xb1b7('0x0'));var AWS=require(_0xb1b7('0x1'));function lexResult(_0x8441de,_0x29aa59){return new BPromise(function(_0x365d2c,_0x29e128){_0x8441de[_0xb1b7('0x2')](_0x29aa59,function(_0x475beb,_0x585fe6){if(_0x475beb){_0x29e128(_0x475beb);}if(_0x585fe6[_0xb1b7('0x3')]){for(const _0x21160a in _0x585fe6[_0xb1b7('0x3')]){if(_0x585fe6['slots'][_0xb1b7('0x4')](_0x21160a)){var _0x13e151=_0x585fe6[_0xb1b7('0x3')][_0x21160a];_0x585fe6[_0xb1b7('0x5')+_0x21160a]=_0x13e151;}}}_0x365d2c(_0x585fe6);});});}module[_0xb1b7('0x6')]=function(_0x2c0e28,_0x888d4,_0x5e7f4d,_0x4e78fc,_0x31d363,_0x4ea2b2){var _0x4c7185=new AWS[(_0xb1b7('0x7'))]({'accessKeyId':_0x888d4,'secretAccessKey':_0x5e7f4d,'region':_0x4e78fc});var _0x1ca2df={'botAlias':'$LATEST','botName':_0x4ea2b2,'inputText':_0x31d363,'userId':_0x2c0e28};return lexResult(_0x4c7185,_0x1ca2df);}; \ No newline at end of file +var _0xf579=['slots','slot_','exports','$LATEST','aws-sdk','postText'];(function(_0x41486e,_0x1b665d){var _0x41f5b9=function(_0x38f54d){while(--_0x38f54d){_0x41486e['push'](_0x41486e['shift']());}};_0x41f5b9(++_0x1b665d);}(_0xf579,0x112));var _0x9f57=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xf579[_0x138adb];return _0x1b27f2;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x9f57('0x0'));function lexResult(_0x47a098,_0x21ae58){return new BPromise(function(_0x5c2638,_0x533a4c){_0x47a098[_0x9f57('0x1')](_0x21ae58,function(_0x2a9337,_0x19e99d){if(_0x2a9337){_0x533a4c(_0x2a9337);}if(_0x19e99d[_0x9f57('0x2')]){for(const _0x393915 in _0x19e99d[_0x9f57('0x2')]){if(_0x19e99d['slots']['hasOwnProperty'](_0x393915)){var _0x3079e9=_0x19e99d[_0x9f57('0x2')][_0x393915];_0x19e99d[_0x9f57('0x3')+_0x393915]=_0x3079e9;}}}_0x5c2638(_0x19e99d);});});}module[_0x9f57('0x4')]=function(_0x208adf,_0x4b3718,_0x566579,_0x34295f,_0x200bf8,_0x113828){var _0x17feb2=new AWS['LexRuntime']({'accessKeyId':_0x4b3718,'secretAccessKey':_0x566579,'region':_0x34295f});var _0x1a99ec={'botAlias':_0x9f57('0x5'),'botName':_0x113828,'inputText':_0x200bf8,'userId':_0x208adf};return lexResult(_0x17feb2,_0x1a99ec);}; \ 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 0a5ae9c..ac3fcf4 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 _0x650b=['./lib/api','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x650b,0x11a));var _0xb650=function(_0x407654,_0x275ae3){_0x407654=_0x407654-0x0;var _0x521dbd=_0x650b[_0x407654];return _0x521dbd;};'use strict';var polly=require(_0xb650('0x0'));module[_0xb650('0x1')]=function(_0x4f3705,_0x54c30b,_0x22f825,_0x3b03cb,_0x58536f,_0x11f673,_0x552399){return polly(_0x4f3705,_0x54c30b,_0x22f825,_0x3b03cb,_0x58536f,_0x11f673,_0x552399);}; \ No newline at end of file +var _0x4226=['exports'];(function(_0x2c86dc,_0x397970){var _0xa7b83e=function(_0x482061){while(--_0x482061){_0x2c86dc['push'](_0x2c86dc['shift']());}};_0xa7b83e(++_0x397970);}(_0x4226,0x1dc));var _0x6422=function(_0x2e0e82,_0x268a35){_0x2e0e82=_0x2e0e82-0x0;var _0x4c16ed=_0x4226[_0x2e0e82];return _0x4c16ed;};'use strict';var polly=require('./lib/api');module[_0x6422('0x0')]=function(_0x4b72ee,_0x582382,_0x4f14b3,_0x1d3da3,_0x3c85e7,_0x49678b,_0xc74a5a){return polly(_0x4b72ee,_0x582382,_0x4f14b3,_0x1d3da3,_0x3c85e7,_0x49678b,_0xc74a5a);}; \ 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 a582188..ec35aee 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 _0x22dc=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0x115034,_0x5157ec){var _0x1d8c93=function(_0x3f00e2){while(--_0x3f00e2){_0x115034['push'](_0x115034['shift']());}};_0x1d8c93(++_0x5157ec);}(_0x22dc,0xa1));var _0xc22d=function(_0x247c6d,_0x5be1c6){_0x247c6d=_0x247c6d-0x0;var _0x20c59a=_0x22dc[_0x247c6d];return _0x20c59a;};'use strict';var fs=require('fs');var path=require(_0xc22d('0x0'));var BPromise=require(_0xc22d('0x1'));var rs=require(_0xc22d('0x2'));var AWS=require(_0xc22d('0x3'));function pollyResult(_0xf1ff5a,_0x4891bb,_0x159111){return new BPromise(function(_0x4adaea,_0x18500e){_0xf1ff5a[_0xc22d('0x4')](_0x4891bb,function(_0x31da25,_0x28d6ca){if(_0x31da25){_0x18500e(_0x31da25);}else if(_0x28d6ca){if(_0x28d6ca[_0xc22d('0x5')]instanceof Buffer){fs[_0xc22d('0x6')](_0x159111,_0x28d6ca[_0xc22d('0x5')],function(_0x305119){if(_0x305119){_0x18500e(_0x305119);}else{_0x4adaea();}});}else{_0x18500e(new Error(_0xc22d('0x7')));}}else{_0x18500e(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xc22d('0x8')]=function(_0x390bb9,_0x5217de,_0x4a8927,_0xbf69dc,_0x46dee2,_0x525cf0,_0x549a1f){var _0x3051d6=new AWS[(_0xc22d('0x9'))]({'accessKeyId':_0x390bb9,'secretAccessKey':_0x5217de,'region':_0x4a8927});var _0x3d8b57={'Text':_0x46dee2,'TextType':_0x525cf0||_0xc22d('0xa'),'OutputFormat':_0xc22d('0xb'),'VoiceId':_0xbf69dc};return pollyResult(_0x3051d6,_0x3d8b57,_0x549a1f);}; \ No newline at end of file +var _0x0bde=['AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','randomstring','aws-sdk'];(function(_0x336dda,_0x59b998){var _0x244c18=function(_0x1cb3a0){while(--_0x1cb3a0){_0x336dda['push'](_0x336dda['shift']());}};_0x244c18(++_0x59b998);}(_0x0bde,0x1bf));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var fs=require('fs');var path=require(_0xe0bd('0x0'));var BPromise=require(_0xe0bd('0x1'));var rs=require(_0xe0bd('0x2'));var AWS=require(_0xe0bd('0x3'));function pollyResult(_0xc62c2d,_0x1ebc28,_0x2280fd){return new BPromise(function(_0x149b4d,_0x2e3621){_0xc62c2d['synthesizeSpeech'](_0x1ebc28,function(_0x3fa92c,_0x5ea83c){if(_0x3fa92c){_0x2e3621(_0x3fa92c);}else if(_0x5ea83c){if(_0x5ea83c[_0xe0bd('0x4')]instanceof Buffer){fs[_0xe0bd('0x5')](_0x2280fd,_0x5ea83c[_0xe0bd('0x4')],function(_0x511729){if(_0x511729){_0x2e3621(_0x511729);}else{_0x149b4d();}});}else{_0x2e3621(new Error(_0xe0bd('0x6')));}}else{_0x2e3621(new Error(_0xe0bd('0x7')));}});});}module['exports']=function(_0x3fccf7,_0x51d96e,_0x1e0cd1,_0x46af7f,_0x4bc22a,_0x47aa85,_0x426779){var _0x493c01=new AWS[(_0xe0bd('0x8'))]({'accessKeyId':_0x3fccf7,'secretAccessKey':_0x51d96e,'region':_0x1e0cd1});var _0x5ae063={'Text':_0x4bc22a,'TextType':_0x47aa85||_0xe0bd('0x9'),'OutputFormat':_0xe0bd('0xa'),'VoiceId':_0x46af7f};return pollyResult(_0x493c01,_0x5ae063,_0x426779);}; \ 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 c1fc91e..d01c26c 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 _0xd90a=['exports','./lib/api'];(function(_0x1911ed,_0x4e8c73){var _0x11edaa=function(_0x216008){while(--_0x216008){_0x1911ed['push'](_0x1911ed['shift']());}};_0x11edaa(++_0x4e8c73);}(_0xd90a,0x9d));var _0xad90=function(_0xc28078,_0x38031e){_0xc28078=_0xc28078-0x0;var _0x5d281e=_0xd90a[_0xc28078];return _0x5d281e;};'use strict';var asr=require(_0xad90('0x0'));module[_0xad90('0x1')]=function(_0xb5e8b4,_0x5626b3,_0x275d50,_0x542d1b){return asr(_0xb5e8b4,_0x5626b3,_0x275d50);}; \ No newline at end of file +var _0x0027=['./lib/api'];(function(_0x347c7f,_0x1e2ccc){var _0x22ff7b=function(_0xe8783c){while(--_0xe8783c){_0x347c7f['push'](_0x347c7f['shift']());}};_0x22ff7b(++_0x1e2ccc);}(_0x0027,0xdf));var _0x7002=function(_0x3ff13,_0x3fdd45){_0x3ff13=_0x3ff13-0x0;var _0x28c909=_0x0027[_0x3ff13];return _0x28c909;};'use strict';var asr=require(_0x7002('0x0'));module['exports']=function(_0x43168a,_0x5cf4b5,_0x3a9b71,_0x4a3e8f){return asr(_0x43168a,_0x5cf4b5,_0x3a9b71);}; \ 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 9f862d8..d886079 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 _0xfd3b=['url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','LINEAR16','8000'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfd3b,0x70));var _0xbfd3=function(_0x2f7824,_0xe4c578){_0x2f7824=_0x2f7824-0x0;var _0x3fdc0e=_0xfd3b[_0x2f7824];return _0x3fdc0e;};'use strict';var url=require(_0xbfd3('0x0'));var BPromise=require(_0xbfd3('0x1'));var fs=require('fs');var host=_0xbfd3('0x2');module[_0xbfd3('0x3')]=function(_0x357ff5,_0x3eb7a2,_0x1b12b2){return new BPromise(function(_0x984bda,_0x377a22){var _0x33c7c9;if(typeof _0x357ff5!==_0xbfd3('0x4')||_0x357ff5[_0xbfd3('0x5')]===0x0){return _0x377a22(_0xbfd3('0x6'));}if(typeof _0x3eb7a2!==_0xbfd3('0x4')||_0x3eb7a2[_0xbfd3('0x5')]===0x0){return _0x377a22(_0xbfd3('0x7'));}if(typeof _0x1b12b2!==_0xbfd3('0x8')&&(typeof _0x1b12b2!==_0xbfd3('0x4')||_0x1b12b2['length']===0x0)){return _0x377a22(_0xbfd3('0x9'));}try{_0x33c7c9=fs[_0xbfd3('0xa')](_0x357ff5)[_0xbfd3('0xb')]('base64');}catch(_0x53e671){return _0x377a22(_0x53e671);}return _0x984bda({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x3eb7a2,'body':{'config':{'encoding':_0xbfd3('0xc'),'sampleRateHertz':_0xbfd3('0xd'),'languageCode':_0x1b12b2},'audio':{'content':_0x33c7c9}},'json':!![]});});}; \ No newline at end of file +var _0xd19e=['bluebird','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000','url'];(function(_0xd28cb5,_0x184f5c){var _0x2bcbff=function(_0x54c358){while(--_0x54c358){_0xd28cb5['push'](_0xd28cb5['shift']());}};_0x2bcbff(++_0x184f5c);}(_0xd19e,0x185));var _0xed19=function(_0xc2e769,_0x473323){_0xc2e769=_0xc2e769-0x0;var _0x36703c=_0xd19e[_0xc2e769];return _0x36703c;};'use strict';var url=require(_0xed19('0x0'));var BPromise=require(_0xed19('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xed19('0x2')]=function(_0x5d720f,_0xbd988,_0x1fcdfc){return new BPromise(function(_0x257fd9,_0x5e4907){var _0xd50e8b;if(typeof _0x5d720f!==_0xed19('0x3')||_0x5d720f[_0xed19('0x4')]===0x0){return _0x5e4907(_0xed19('0x5'));}if(typeof _0xbd988!==_0xed19('0x3')||_0xbd988['length']===0x0){return _0x5e4907(_0xed19('0x6'));}if(typeof _0x1fcdfc!==_0xed19('0x7')&&(typeof _0x1fcdfc!==_0xed19('0x3')||_0x1fcdfc[_0xed19('0x4')]===0x0)){return _0x5e4907(_0xed19('0x8'));}try{_0xd50e8b=fs[_0xed19('0x9')](_0x5d720f)[_0xed19('0xa')](_0xed19('0xb'));}catch(_0x1ccedb){return _0x5e4907(_0x1ccedb);}return _0x257fd9({'method':_0xed19('0xc'),'uri':host+'/v1/speech:recognize?key='+_0xbd988,'body':{'config':{'encoding':_0xed19('0xd'),'sampleRateHertz':_0xed19('0xe'),'languageCode':_0x1fcdfc},'audio':{'content':_0xd50e8b}},'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 b96496f..c9f7e59 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 _0xc68e=['./asr','exports'];(function(_0x2749ed,_0xbc33c2){var _0x5ac798=function(_0x7c73b9){while(--_0x7c73b9){_0x2749ed['push'](_0x2749ed['shift']());}};_0x5ac798(++_0xbc33c2);}(_0xc68e,0x104));var _0xec68=function(_0x2e43d0,_0x27712d){_0x2e43d0=_0x2e43d0-0x0;var _0x3c38d3=_0xc68e[_0x2e43d0];return _0x3c38d3;};var asr=require(_0xec68('0x0'));module[_0xec68('0x1')]={'asr':asr}; \ No newline at end of file +var _0x4877=['./asr','exports'];(function(_0x2ad880,_0x4d9802){var _0x4426c8=function(_0x39de2b){while(--_0x39de2b){_0x2ad880['push'](_0x2ad880['shift']());}};_0x4426c8(++_0x4d9802);}(_0x4877,0x80));var _0x7487=function(_0x3822f8,_0x5dabe5){_0x3822f8=_0x3822f8-0x0;var _0x553d7b=_0x4877[_0x3822f8];return _0x553d7b;};var asr=require(_0x7487('0x0'));module[_0x7487('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 473096f..be4cbe1 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 _0x01e8=['ispeechASR','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','path','http','https','parse','randomstring','request-promise','querystring','google-tts-api','md5','./google','./aws','../../../config/logger','agi','https:','host','WHAT_EVER','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','info','finish\x20download\x20file','close','unlink','pipe','end','protocol','get','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','777','split','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','voice','audioConfig','text:synthesize','POST','then','generate','.mp3','audioContent','chmodSync','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','stringify','source','result','resolvedQuery','actionIncomplete','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20confidence','polly','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3'];(function(_0x3560ee,_0x58d7ab){var _0x3b1d99=function(_0x5d6f22){while(--_0x5d6f22){_0x3560ee['push'](_0x3560ee['shift']());}};_0x3b1d99(++_0x58d7ab);}(_0x01e8,0x6e));var _0x801e=function(_0x3b6bab,_0x4dd853){_0x3b6bab=_0x3b6bab-0x0;var _0x3f6478=_0x01e8[_0x3b6bab];return _0x3f6478;};'use strict';var fs=require('fs');var path=require(_0x801e('0x0'));var http=require(_0x801e('0x1'));var https=require(_0x801e('0x2'));var urlParse=require('url')[_0x801e('0x3')];var BPromise=require('bluebird');var rs=require(_0x801e('0x4'));var sox=require('sox');var rp=require(_0x801e('0x5'));var util=require('util');var querystring=require(_0x801e('0x6'));var tts=require(_0x801e('0x7'));var apiai=require('apiai-promise');var md5=require(_0x801e('0x8'));var google=require(_0x801e('0x9'));var aws=require(_0x801e('0xa'));var tilde=require('./tilde');var sestek=require('./sestek');var logger=require(_0x801e('0xb'))(_0x801e('0xc'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x1d7410,_0x42ddc1){return new BPromise(function(_0x594585,_0x10d37f){var _0x2b8d16=urlParse(_0x1d7410);var _0x68b370=_0x2b8d16['protocol']===_0x801e('0xd')?https:http;var _0xd833db={'host':_0x2b8d16[_0x801e('0xe')],'path':_0x2b8d16[_0x801e('0x0')],'headers':{'user-agent':_0x801e('0xf')}};_0x68b370['get'](_0xd833db,function(_0x23215d){if(_0x23215d[_0x801e('0x10')]!==0xc8){logger[_0x801e('0x11')](_0x801e('0x12')+_0x1d7410+'\x20failed,\x20status\x20code\x20=\x20'+_0x23215d[_0x801e('0x10')]+'\x20('+_0x23215d[_0x801e('0x13')]+')');_0x10d37f(new Error(_0x801e('0x12')+_0x1d7410+_0x801e('0x14')+_0x23215d[_0x801e('0x10')]+'\x20('+_0x23215d[_0x801e('0x13')]+')'));return;}var _0x1c68e1=fs[_0x801e('0x15')](_0x42ddc1);_0x1c68e1['on']('finish',function(){logger[_0x801e('0x16')](_0x801e('0x17'));_0x1c68e1[_0x801e('0x18')](_0x594585);});_0x1c68e1['on']('error',function(_0x3f8dc6){fs[_0x801e('0x19')](_0x42ddc1);logger[_0x801e('0x11')]('download\x20error',_0x3f8dc6);_0x10d37f(_0x3f8dc6);});_0x23215d[_0x801e('0x1a')](_0x1c68e1);})['on'](_0x801e('0x11'),function(_0x31290b){logger[_0x801e('0x11')](_0x31290b);_0x10d37f(_0x31290b);})[_0x801e('0x1b')]();});}function uploadFile(_0x967d4f){return new BPromise(function(_0x5d924f,_0x3efb9d){var _0x17b4b2=urlParse(_0x967d4f);var _0x4b9ae9=_0x17b4b2[_0x801e('0x1c')]===_0x801e('0xd')?https:http;var _0xc66778={'host':_0x17b4b2[_0x801e('0xe')],'path':_0x17b4b2[_0x801e('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x4b9ae9[_0x801e('0x1d')](_0xc66778,function(_0x2a8f30){if(_0x2a8f30[_0x801e('0x10')]!==0xc8){_0x3efb9d(new Error(_0x801e('0x12')+_0x967d4f+_0x801e('0x14')+_0x2a8f30['statusCode']+'\x20('+_0x2a8f30['statusMessage']+')'));return;}var _0x41e36a='';_0x2a8f30['on']('data',function(_0x504781){_0x41e36a+=_0x504781;});_0x2a8f30['on']('end',function(){_0x5d924f(_0x41e36a);});})['on']('error',function(_0x15db4e){_0x3efb9d(_0x15db4e);})[_0x801e('0x1b')]();});}function convertFile(_0x101219,_0x13a2d8){return new BPromise(function(_0x2b67a2,_0x4c5951){var _0x114a19=sox[_0x801e('0x1e')](_0x101219,_0x13a2d8,{'sampleRate':0x1f40,'format':_0x801e('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x114a19['on'](_0x801e('0x11'),function(_0xf0e2a5){logger[_0x801e('0x11')](_0x801e('0x20'),_0xf0e2a5);_0x4c5951(_0xf0e2a5);});_0x114a19['on'](_0x801e('0x1b'),function(){logger[_0x801e('0x16')](_0x801e('0x21'));_0x2b67a2();});_0x114a19[_0x801e('0x22')]();});}function base64Decode(_0xfa0dd,_0x2f3614){var _0x3cf3b7=path[_0x801e('0x23')](__dirname,_0x801e('0x24'),rs['generate'](0x4)+_0x801e('0x25'));fs[_0x801e('0x26')](_0x3cf3b7,_0xfa0dd,_0x801e('0x27'));return convertFile(_0x3cf3b7,_0x2f3614)['then'](function(){try{fs[_0x801e('0x19')](_0x3cf3b7);fs['chmodSync'](_0x2f3614,_0x801e('0x28'));}catch(_0x493719){logger['error'](_0x493719);}return _0x2f3614[_0x801e('0x29')]('.')[0x0];});}function base64Encode(_0x355397){var _0x36471d=fs['readFileSync'](_0x355397);return new Buffer(_0x36471d)[_0x801e('0x2a')]('base64');}exports['googleCloudTTS']=function(_0x3eab4b,_0x5073da,_0x4e5210,_0x2b3515,_0x2b26df,_0x4d2239){var _0xa6c2a8,_0x905ff3;var _0x28247f=_0x801e('0x2b');var _0x5dfb18=_0x801e('0x2c')+_0x3eab4b;var _0x4d34ee={};if(_0x5073da===_0x801e('0x2d')){_0x4d34ee['input']={'ssml':_0x4e5210};}else{_0x4d34ee['input']={'text':_0x4e5210};};_0x4d34ee[_0x801e('0x2e')]={'languageCode':_0x2b3515,'ssmlGender':_0x2b26df};_0x4d34ee[_0x801e('0x2f')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x1abb32={'url':_0x28247f+_0x801e('0x30')+_0x5dfb18,'method':_0x801e('0x31'),'json':!![],'body':_0x4d34ee};return rp(_0x1abb32)[_0x801e('0x32')](function(_0x2e6853){return new BPromise(function(_0x3efca3,_0x135049){_0xa6c2a8=path[_0x801e('0x23')](__dirname,'tmp',rs[_0x801e('0x33')](0x4)+_0x801e('0x34'));var _0x2fb41f=Buffer['from'](_0x2e6853[_0x801e('0x35')],_0x801e('0x27'));return fs['writeFile'](_0xa6c2a8,_0x2fb41f,function(_0x40f3ef){_0x135049(_0x40f3ef);},function(_0x27ba7b){fs['chmodSync'](_0xa6c2a8,'777');_0x3efca3(_0x27ba7b);});});})['then'](function(_0x1e1dff){_0x905ff3=path[_0x801e('0x23')](__dirname,'tmp',rs['generate'](0x4)+_0x801e('0x25'));return convertFile(_0xa6c2a8,_0x905ff3);})[_0x801e('0x32')](function(){try{fs[_0x801e('0x19')](_0xa6c2a8);fs[_0x801e('0x36')](_0x905ff3,'777');}catch(_0x1931d4){logger['error'](_0x1931d4);}logger[_0x801e('0x16')](_0x801e('0x37'),_0x905ff3[_0x801e('0x29')]('.')[0x0]);return _0x905ff3[_0x801e('0x29')]('.')[0x0];});};exports[_0x801e('0x38')]=function(_0x3daf9e,_0x3e542b){var _0x4b1f39,_0x5753d3;return tts(_0x3daf9e,_0x3e542b||'en',0x1)[_0x801e('0x32')](function(_0x2a4ec7){logger[_0x801e('0x16')](_0x2a4ec7);_0x4b1f39=path[_0x801e('0x23')](__dirname,_0x801e('0x24'),rs['generate'](0x4)+'.mp3');return downloadFile(_0x2a4ec7,_0x4b1f39);})[_0x801e('0x32')](function(){_0x5753d3=path[_0x801e('0x23')](__dirname,_0x801e('0x24'),rs[_0x801e('0x33')](0x4)+_0x801e('0x25'));return convertFile(_0x4b1f39,_0x5753d3);})[_0x801e('0x32')](function(){try{fs[_0x801e('0x19')](_0x4b1f39);fs['chmodSync'](_0x5753d3,_0x801e('0x28'));}catch(_0xe2e78d){logger['error'](_0xe2e78d);}logger[_0x801e('0x16')](_0x801e('0x39'),_0x5753d3[_0x801e('0x29')]('.')[0x0]);return _0x5753d3[_0x801e('0x29')]('.')[0x0];});};exports[_0x801e('0x3a')]=function(_0x2eba7b,_0x205a64,_0xa57fc){return google['asr'](_0x2eba7b,_0x205a64,_0xa57fc)[_0x801e('0x32')](function(_0x149f72){logger['info'](_0x149f72[_0x801e('0x3b')]);return rp(_0x149f72);})['then'](function(_0x9761e6){var _0x3869ee='';var _0xd172b2=0x0;try{fs[_0x801e('0x19')](_0x2eba7b);}catch(_0x203a46){logger[_0x801e('0x11')](_0x203a46);}if(_0x9761e6&&_0x9761e6[_0x801e('0x3c')]){_0x3869ee=_0x9761e6[_0x801e('0x3c')][_0x801e('0x3d')](function(_0x5e3eb3){return _0x5e3eb3&&_0x5e3eb3[_0x801e('0x3e')][0x0]&&_0x5e3eb3[_0x801e('0x3e')][0x0][_0x801e('0x3f')]?_0x5e3eb3[_0x801e('0x3e')][0x0][_0x801e('0x3f')]:'';})['join']('\x0a');_0xd172b2=_0x9761e6[_0x801e('0x3c')][_0x801e('0x3d')](function(_0x4f490c){return _0x4f490c&&_0x4f490c[_0x801e('0x3e')][0x0]&&_0x4f490c['alternatives'][0x0][_0x801e('0x40')]?_0x4f490c['alternatives'][0x0][_0x801e('0x40')]:0x0;})[_0x801e('0x41')]('\x0a');}logger[_0x801e('0x16')]('googleASR\x20transcription',_0x3869ee);logger[_0x801e('0x16')](_0x801e('0x42'),_0xd172b2);return{'transcript':_0x3869ee,'confidence':_0xd172b2};})[_0x801e('0x43')](function(_0x136716){logger['error'](_0x801e('0x44'),_0x136716[_0x801e('0x10')],_0x136716[_0x801e('0x45')],_0x136716['message']);});};exports[_0x801e('0x46')]=function(_0x3cbdb1,_0x3136a9,_0x37310d,_0x3e1a2){var _0x7ad0ed=apiai(_0x3136a9,{'language':_0x3e1a2||'en'});return _0x7ad0ed[_0x801e('0x47')](_0x37310d,{'sessionId':md5(_0x3cbdb1)})[_0x801e('0x32')](function(_0x462759){logger[_0x801e('0x16')](JSON[_0x801e('0x48')](_0x462759));return{'source':_0x462759['result'][_0x801e('0x49')],'resolvedQuery':_0x462759[_0x801e('0x4a')][_0x801e('0x4b')],'action':_0x462759[_0x801e('0x4a')]['action'],'actionIncomplete':_0x462759[_0x801e('0x4a')][_0x801e('0x4c')],'speech':_0x462759[_0x801e('0x4a')]['fulfillment']['speech'],'score':_0x462759[_0x801e('0x4a')]['score'],'statusCode':_0x462759['status']['code'],'endConversation':_0x462759['result'][_0x801e('0x4d')][_0x801e('0x4e')]||![],'isFallbackIntent':_0x462759[_0x801e('0x4a')][_0x801e('0x4d')][_0x801e('0x4f')]};});};exports[_0x801e('0x50')]=function(_0x464485,_0x20b20e,_0x4f4f2f,_0x1eb866){return tilde['asr'](_0x464485,_0x20b20e,_0x4f4f2f,_0x1eb866)[_0x801e('0x32')](function(_0x51c9b5){try{fs[_0x801e('0x19')](_0x464485);}catch(_0x4bdf86){logger[_0x801e('0x11')](_0x4bdf86);}logger['info']('Tilde\x20ASR\x20transcription',_0x51c9b5[_0x801e('0x3f')]);logger[_0x801e('0x16')](_0x801e('0x51'),_0x51c9b5[_0x801e('0x40')]);return _0x51c9b5;});};exports['awsPolly']=function(_0x3de56b,_0x3d83a8,_0x514a90,_0xbc92ba,_0x1f3693,_0x2363cc){var _0x1f00f9=path[_0x801e('0x23')](__dirname,_0x801e('0x24'),rs[_0x801e('0x33')](0x4)+'.mp3');var _0x1da2e6;return aws[_0x801e('0x52')](_0x3de56b,_0x3d83a8,_0x514a90,_0xbc92ba,_0x1f3693,_0x2363cc,_0x1f00f9)[_0x801e('0x32')](function(){_0x1da2e6=path[_0x801e('0x23')](__dirname,_0x801e('0x24'),rs[_0x801e('0x33')](0x4)+_0x801e('0x25'));return convertFile(_0x1f00f9,_0x1da2e6);})['then'](function(){try{fs[_0x801e('0x19')](_0x1f00f9);fs[_0x801e('0x36')](_0x1da2e6,_0x801e('0x28'));}catch(_0x937e9c){logger[_0x801e('0x11')](_0x937e9c);}return _0x1da2e6['split']('.')[0x0];});};exports['awsLex']=function(_0x179229,_0x11de93,_0x4d2257,_0x1d9858,_0xb92aa4,_0x2181d9){return aws[_0x801e('0x53')](_0x179229,_0x11de93,_0x4d2257,_0x1d9858,_0xb92aa4,_0x2181d9)[_0x801e('0x32')](function(_0x5705fc){logger[_0x801e('0x16')](JSON[_0x801e('0x48')](_0x5705fc));return _0x5705fc;});};exports['ispeechTTS']=function(_0x1319db,_0x45c72c,_0x4a3152,_0x430238){var _0x861955=util[_0x801e('0x54')](_0x801e('0x55'),ISPEECH_API,_0x1319db,encodeURIComponent(_0x45c72c),_0x4a3152,_0x430238);var _0x4639ea=path[_0x801e('0x23')](__dirname,_0x801e('0x24'),rs[_0x801e('0x33')](0x4)+_0x801e('0x34'));var _0x66bd70;return downloadFile(_0x861955,_0x4639ea)[_0x801e('0x32')](function(){_0x66bd70=path[_0x801e('0x23')](__dirname,_0x801e('0x24'),rs[_0x801e('0x33')](0x4)+_0x801e('0x25'));return convertFile(_0x4639ea,_0x66bd70);})[_0x801e('0x32')](function(){try{fs[_0x801e('0x19')](_0x4639ea);fs['chmodSync'](_0x66bd70,_0x801e('0x28'));}catch(_0x500f38){logger['error'](_0x500f38);}return _0x66bd70['split']('.')[0x0];});};exports[_0x801e('0x56')]=function(_0x27b7e6,_0xff4e58,_0x54acdc,_0x5f2c7c){var _0x15ab00=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0xff4e58,_0x54acdc,base64Encode(_0x27b7e6),_0x5f2c7c?util[_0x801e('0x54')](_0x801e('0x57'),encodeURIComponent(_0x5f2c7c)):_0x801e('0x58'));return uploadFile(_0x15ab00)[_0x801e('0x32')](function(_0x4fce40){return querystring[_0x801e('0x3')](_0x4fce40);});};exports[_0x801e('0x59')]=function(_0x1c925f,_0x20c124){return sestek[_0x801e('0x5a')](_0x1c925f,_0x20c124)[_0x801e('0x32')](function(_0x175961){logger[_0x801e('0x16')](JSON[_0x801e('0x48')](_0x175961));var _0x53895c={'speech':_0x175961[_0x801e('0x5b')],'action':_0x175961['channelData']?_0x175961[_0x801e('0x5c')][_0x801e('0x5d')]:undefined,'actiondata':_0x175961[_0x801e('0x5c')]?_0x175961[_0x801e('0x5c')][_0x801e('0x5e')]:undefined};if(_0x175961[_0x801e('0x5c')]&&_0x175961['channelData'][_0x801e('0x5f')]){return base64Decode(_0x175961[_0x801e('0x5c')][_0x801e('0x5f')][_0x801e('0x60')],path['resolve'](__dirname,_0x801e('0x24'),rs['generate'](0x4)+'.wav'))[_0x801e('0x32')](function(_0x5bdabb){_0x53895c['audiofile']=_0x5bdabb;return _0x53895c;});}return _0x53895c;});};exports[_0x801e('0x61')]=function(){return __dirname;}; \ No newline at end of file +var _0x8f81=['statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','download\x20error','pipe','WHAT_EVER','data','end','wav','error\x20convert','start','resolve','generate','.wav','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','input','voice','audioConfig','MP3','text:synthesize','tmp','.mp3','audioContent','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','textRequest','stringify','result','source','resolvedQuery','action','actionIncomplete','speech','status','code','endConversation','metadata','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','path','http','https','url','bluebird','sox','request-promise','google-tts-api','apiai-promise','md5','./google','./aws','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20'];(function(_0x14c889,_0x33c043){var _0x32f296=function(_0xb679b){while(--_0xb679b){_0x14c889['push'](_0x14c889['shift']());}};_0x32f296(++_0x33c043);}(_0x8f81,0xbf));var _0x18f8=function(_0x6bea35,_0x5f2416){_0x6bea35=_0x6bea35-0x0;var _0x286134=_0x8f81[_0x6bea35];return _0x286134;};'use strict';var fs=require('fs');var path=require(_0x18f8('0x0'));var http=require(_0x18f8('0x1'));var https=require(_0x18f8('0x2'));var urlParse=require(_0x18f8('0x3'))['parse'];var BPromise=require(_0x18f8('0x4'));var rs=require('randomstring');var sox=require(_0x18f8('0x5'));var rp=require(_0x18f8('0x6'));var util=require('util');var querystring=require('querystring');var tts=require(_0x18f8('0x7'));var apiai=require(_0x18f8('0x8'));var md5=require(_0x18f8('0x9'));var google=require(_0x18f8('0xa'));var aws=require(_0x18f8('0xb'));var tilde=require('./tilde');var sestek=require(_0x18f8('0xc'));var logger=require(_0x18f8('0xd'))(_0x18f8('0xe'));var ISPEECH_API=_0x18f8('0xf');function downloadFile(_0x101017,_0x3bec00){return new BPromise(function(_0x4286d4,_0x503963){var _0x46cdf8=urlParse(_0x101017);var _0x330834=_0x46cdf8[_0x18f8('0x10')]===_0x18f8('0x11')?https:http;var _0x22a742={'host':_0x46cdf8[_0x18f8('0x12')],'path':_0x46cdf8[_0x18f8('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x330834['get'](_0x22a742,function(_0x49983e){if(_0x49983e[_0x18f8('0x13')]!==0xc8){logger[_0x18f8('0x14')](_0x18f8('0x15')+_0x101017+_0x18f8('0x16')+_0x49983e['statusCode']+'\x20('+_0x49983e[_0x18f8('0x17')]+')');_0x503963(new Error(_0x18f8('0x15')+_0x101017+_0x18f8('0x16')+_0x49983e[_0x18f8('0x13')]+'\x20('+_0x49983e[_0x18f8('0x17')]+')'));return;}var _0x508c0a=fs[_0x18f8('0x18')](_0x3bec00);_0x508c0a['on'](_0x18f8('0x19'),function(){logger[_0x18f8('0x1a')](_0x18f8('0x1b'));_0x508c0a['close'](_0x4286d4);});_0x508c0a['on']('error',function(_0x524dc7){fs[_0x18f8('0x1c')](_0x3bec00);logger[_0x18f8('0x14')](_0x18f8('0x1d'),_0x524dc7);_0x503963(_0x524dc7);});_0x49983e[_0x18f8('0x1e')](_0x508c0a);})['on'](_0x18f8('0x14'),function(_0x3531c4){logger[_0x18f8('0x14')](_0x3531c4);_0x503963(_0x3531c4);})['end']();});}function uploadFile(_0x3ae9fc){return new BPromise(function(_0x2d49d1,_0x2d2d00){var _0x23030d=urlParse(_0x3ae9fc);var _0x573bcb=_0x23030d[_0x18f8('0x10')]===_0x18f8('0x11')?https:http;var _0x364fba={'host':_0x23030d[_0x18f8('0x12')],'path':_0x23030d[_0x18f8('0x0')],'headers':{'user-agent':_0x18f8('0x1f')}};_0x573bcb['get'](_0x364fba,function(_0x947770){if(_0x947770['statusCode']!==0xc8){_0x2d2d00(new Error(_0x18f8('0x15')+_0x3ae9fc+'\x20failed,\x20status\x20code\x20=\x20'+_0x947770[_0x18f8('0x13')]+'\x20('+_0x947770[_0x18f8('0x17')]+')'));return;}var _0x2f1771='';_0x947770['on'](_0x18f8('0x20'),function(_0x2b0e89){_0x2f1771+=_0x2b0e89;});_0x947770['on'](_0x18f8('0x21'),function(){_0x2d49d1(_0x2f1771);});})['on']('error',function(_0x25456f){_0x2d2d00(_0x25456f);})['end']();});}function convertFile(_0x5b903d,_0x192923){return new BPromise(function(_0xbac6a1,_0x5162c8){var _0x21529f=sox['transcode'](_0x5b903d,_0x192923,{'sampleRate':0x1f40,'format':_0x18f8('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x21529f['on'](_0x18f8('0x14'),function(_0x1bb36b){logger['error'](_0x18f8('0x23'),_0x1bb36b);_0x5162c8(_0x1bb36b);});_0x21529f['on']('end',function(){logger['info']('finish\x20to\x20convert');_0xbac6a1();});_0x21529f[_0x18f8('0x24')]();});}function base64Decode(_0x1ad0a2,_0x33d750){var _0x5d2dbe=path[_0x18f8('0x25')](__dirname,'tmp',rs[_0x18f8('0x26')](0x4)+_0x18f8('0x27'));fs['writeFileSync'](_0x5d2dbe,_0x1ad0a2,_0x18f8('0x28'));return convertFile(_0x5d2dbe,_0x33d750)[_0x18f8('0x29')](function(){try{fs[_0x18f8('0x1c')](_0x5d2dbe);fs[_0x18f8('0x2a')](_0x33d750,_0x18f8('0x2b'));}catch(_0x29b825){logger[_0x18f8('0x14')](_0x29b825);}return _0x33d750[_0x18f8('0x2c')]('.')[0x0];});}function base64Encode(_0x95ebb3){var _0x526863=fs[_0x18f8('0x2d')](_0x95ebb3);return new Buffer(_0x526863)[_0x18f8('0x2e')](_0x18f8('0x28'));}exports[_0x18f8('0x2f')]=function(_0x2bf108,_0x217068,_0x582d2e,_0x739a2b,_0x370053,_0x5ca11e){var _0x2c4854,_0x289bfe;var _0x529cee=_0x18f8('0x30');var _0x55c141='?key='+_0x2bf108;var _0x2bedd0={};if(_0x217068==='ssml'){_0x2bedd0[_0x18f8('0x31')]={'ssml':_0x582d2e};}else{_0x2bedd0[_0x18f8('0x31')]={'text':_0x582d2e};};_0x2bedd0[_0x18f8('0x32')]={'languageCode':_0x739a2b,'ssmlGender':_0x370053};_0x2bedd0[_0x18f8('0x33')]={'audioEncoding':_0x18f8('0x34'),'sampleRateHertz':0x1f40};var _0x4ed619={'url':_0x529cee+_0x18f8('0x35')+_0x55c141,'method':'POST','json':!![],'body':_0x2bedd0};return rp(_0x4ed619)[_0x18f8('0x29')](function(_0x22dc36){return new BPromise(function(_0x3e87aa,_0x25612b){_0x2c4854=path[_0x18f8('0x25')](__dirname,_0x18f8('0x36'),rs[_0x18f8('0x26')](0x4)+_0x18f8('0x37'));var _0x28c496=Buffer['from'](_0x22dc36[_0x18f8('0x38')],_0x18f8('0x28'));return fs['writeFile'](_0x2c4854,_0x28c496,function(_0x17d6af){_0x25612b(_0x17d6af);},function(_0x249e72){fs['chmodSync'](_0x2c4854,_0x18f8('0x2b'));_0x3e87aa(_0x249e72);});});})['then'](function(_0x464b5a){_0x289bfe=path[_0x18f8('0x25')](__dirname,_0x18f8('0x36'),rs[_0x18f8('0x26')](0x4)+_0x18f8('0x27'));return convertFile(_0x2c4854,_0x289bfe);})['then'](function(){try{fs[_0x18f8('0x1c')](_0x2c4854);fs[_0x18f8('0x2a')](_0x289bfe,_0x18f8('0x2b'));}catch(_0x3b49ab){logger[_0x18f8('0x14')](_0x3b49ab);}logger[_0x18f8('0x1a')]('googleCloudTTS\x20path',_0x289bfe[_0x18f8('0x2c')]('.')[0x0]);return _0x289bfe[_0x18f8('0x2c')]('.')[0x0];});};exports['googleTTS']=function(_0x37c69f,_0x10a468){var _0x4d2c3b,_0x13d701;return tts(_0x37c69f,_0x10a468||'en',0x1)[_0x18f8('0x29')](function(_0x4b31af){logger[_0x18f8('0x1a')](_0x4b31af);_0x4d2c3b=path[_0x18f8('0x25')](__dirname,_0x18f8('0x36'),rs['generate'](0x4)+_0x18f8('0x37'));return downloadFile(_0x4b31af,_0x4d2c3b);})['then'](function(){_0x13d701=path[_0x18f8('0x25')](__dirname,'tmp',rs[_0x18f8('0x26')](0x4)+'.wav');return convertFile(_0x4d2c3b,_0x13d701);})[_0x18f8('0x29')](function(){try{fs[_0x18f8('0x1c')](_0x4d2c3b);fs[_0x18f8('0x2a')](_0x13d701,_0x18f8('0x2b'));}catch(_0x1b6c5d){logger['error'](_0x1b6c5d);}logger['info'](_0x18f8('0x39'),_0x13d701[_0x18f8('0x2c')]('.')[0x0]);return _0x13d701[_0x18f8('0x2c')]('.')[0x0];});};exports[_0x18f8('0x3a')]=function(_0x41b32b,_0x1e806c,_0x5cd9b8){return google['asr'](_0x41b32b,_0x1e806c,_0x5cd9b8)[_0x18f8('0x29')](function(_0x5ae063){logger[_0x18f8('0x1a')](_0x5ae063[_0x18f8('0x3b')]);return rp(_0x5ae063);})[_0x18f8('0x29')](function(_0x43b225){var _0x327dd4='';var _0x480f25=0x0;try{fs[_0x18f8('0x1c')](_0x41b32b);}catch(_0xe02d24){logger[_0x18f8('0x14')](_0xe02d24);}if(_0x43b225&&_0x43b225['results']){_0x327dd4=_0x43b225[_0x18f8('0x3c')][_0x18f8('0x3d')](function(_0x4293c4){return _0x4293c4&&_0x4293c4['alternatives'][0x0]&&_0x4293c4[_0x18f8('0x3e')][0x0][_0x18f8('0x3f')]?_0x4293c4[_0x18f8('0x3e')][0x0]['transcript']:'';})[_0x18f8('0x40')]('\x0a');_0x480f25=_0x43b225['results']['map'](function(_0x3c0bc2){return _0x3c0bc2&&_0x3c0bc2['alternatives'][0x0]&&_0x3c0bc2[_0x18f8('0x3e')][0x0][_0x18f8('0x41')]?_0x3c0bc2[_0x18f8('0x3e')][0x0]['confidence']:0x0;})[_0x18f8('0x40')]('\x0a');}logger[_0x18f8('0x1a')](_0x18f8('0x42'),_0x327dd4);logger[_0x18f8('0x1a')](_0x18f8('0x43'),_0x480f25);return{'transcript':_0x327dd4,'confidence':_0x480f25};})['catch'](function(_0x19b306){logger[_0x18f8('0x14')](_0x18f8('0x44'),_0x19b306[_0x18f8('0x13')],_0x19b306[_0x18f8('0x45')],_0x19b306[_0x18f8('0x46')]);});};exports['googleDialogflow']=function(_0x35ef2d,_0xe5ac66,_0x11f0c4,_0x498155){var _0x964edc=apiai(_0xe5ac66,{'language':_0x498155||'en'});return _0x964edc[_0x18f8('0x47')](_0x11f0c4,{'sessionId':md5(_0x35ef2d)})[_0x18f8('0x29')](function(_0x19b709){logger[_0x18f8('0x1a')](JSON[_0x18f8('0x48')](_0x19b709));return{'source':_0x19b709[_0x18f8('0x49')][_0x18f8('0x4a')],'resolvedQuery':_0x19b709[_0x18f8('0x49')][_0x18f8('0x4b')],'action':_0x19b709['result'][_0x18f8('0x4c')],'actionIncomplete':_0x19b709['result'][_0x18f8('0x4d')],'speech':_0x19b709[_0x18f8('0x49')]['fulfillment'][_0x18f8('0x4e')],'score':_0x19b709[_0x18f8('0x49')]['score'],'statusCode':_0x19b709[_0x18f8('0x4f')][_0x18f8('0x50')],'endConversation':_0x19b709[_0x18f8('0x49')]['metadata'][_0x18f8('0x51')]||![],'isFallbackIntent':_0x19b709['result'][_0x18f8('0x52')][_0x18f8('0x53')]};});};exports[_0x18f8('0x54')]=function(_0x3e9d4f,_0x4ef96b,_0x17a536,_0x34d664){return tilde['asr'](_0x3e9d4f,_0x4ef96b,_0x17a536,_0x34d664)['then'](function(_0x3fd355){try{fs[_0x18f8('0x1c')](_0x3e9d4f);}catch(_0x53ed22){logger[_0x18f8('0x14')](_0x53ed22);}logger['info'](_0x18f8('0x55'),_0x3fd355[_0x18f8('0x3f')]);logger[_0x18f8('0x1a')](_0x18f8('0x56'),_0x3fd355[_0x18f8('0x41')]);return _0x3fd355;});};exports[_0x18f8('0x57')]=function(_0x46bc2a,_0x4d5eef,_0xb32967,_0x3d01cf,_0xf041bd,_0x436f39){var _0x5ba645=path['resolve'](__dirname,_0x18f8('0x36'),rs['generate'](0x4)+'.mp3');var _0xf7ea9d;return aws[_0x18f8('0x58')](_0x46bc2a,_0x4d5eef,_0xb32967,_0x3d01cf,_0xf041bd,_0x436f39,_0x5ba645)[_0x18f8('0x29')](function(){_0xf7ea9d=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x5ba645,_0xf7ea9d);})[_0x18f8('0x29')](function(){try{fs[_0x18f8('0x1c')](_0x5ba645);fs[_0x18f8('0x2a')](_0xf7ea9d,_0x18f8('0x2b'));}catch(_0x5e4ae3){logger['error'](_0x5e4ae3);}return _0xf7ea9d['split']('.')[0x0];});};exports[_0x18f8('0x59')]=function(_0x37378e,_0x410e16,_0x55cd62,_0x27f86f,_0x4e69a4,_0xe88dfc){return aws[_0x18f8('0x5a')](_0x37378e,_0x410e16,_0x55cd62,_0x27f86f,_0x4e69a4,_0xe88dfc)['then'](function(_0x283574){logger['info'](JSON[_0x18f8('0x48')](_0x283574));return _0x283574;});};exports[_0x18f8('0x5b')]=function(_0x55768c,_0x4c1377,_0x34545e,_0x1275c6){var _0x43711b=util['format'](_0x18f8('0x5c'),ISPEECH_API,_0x55768c,encodeURIComponent(_0x4c1377),_0x34545e,_0x1275c6);var _0x6c7980=path[_0x18f8('0x25')](__dirname,_0x18f8('0x36'),rs[_0x18f8('0x26')](0x4)+_0x18f8('0x37'));var _0x512ef5;return downloadFile(_0x43711b,_0x6c7980)[_0x18f8('0x29')](function(){_0x512ef5=path['resolve'](__dirname,_0x18f8('0x36'),rs[_0x18f8('0x26')](0x4)+_0x18f8('0x27'));return convertFile(_0x6c7980,_0x512ef5);})[_0x18f8('0x29')](function(){try{fs[_0x18f8('0x1c')](_0x6c7980);fs[_0x18f8('0x2a')](_0x512ef5,_0x18f8('0x2b'));}catch(_0x4305b4){logger[_0x18f8('0x14')](_0x4305b4);}return _0x512ef5[_0x18f8('0x2c')]('.')[0x0];});};exports[_0x18f8('0x5d')]=function(_0x375ab5,_0x184885,_0x5f5630,_0x264174){var _0x2d5fb4=util[_0x18f8('0x5e')](_0x18f8('0x5f'),ISPEECH_API,_0x184885,_0x5f5630,base64Encode(_0x375ab5),_0x264174?util[_0x18f8('0x5e')]('model=%s',encodeURIComponent(_0x264174)):_0x18f8('0x60'));return uploadFile(_0x2d5fb4)[_0x18f8('0x29')](function(_0x5afdd8){return querystring[_0x18f8('0x61')](_0x5afdd8);});};exports[_0x18f8('0x62')]=function(_0x3e5a3f,_0x2bcd04){return sestek[_0x18f8('0x63')](_0x3e5a3f,_0x2bcd04)[_0x18f8('0x29')](function(_0x53a749){logger[_0x18f8('0x1a')](JSON[_0x18f8('0x48')](_0x53a749));var _0x317ef1={'speech':_0x53a749[_0x18f8('0x64')],'action':_0x53a749[_0x18f8('0x65')]?_0x53a749['channelData'][_0x18f8('0x66')]:undefined,'actiondata':_0x53a749[_0x18f8('0x65')]?_0x53a749['channelData'][_0x18f8('0x67')]:undefined};if(_0x53a749[_0x18f8('0x65')]&&_0x53a749[_0x18f8('0x65')]['AudioFromTts']){return base64Decode(_0x53a749[_0x18f8('0x65')][_0x18f8('0x68')][_0x18f8('0x69')],path['resolve'](__dirname,_0x18f8('0x36'),rs[_0x18f8('0x26')](0x4)+'.wav'))[_0x18f8('0x29')](function(_0x5ed5c8){_0x317ef1['audiofile']=_0x5ed5c8;return _0x317ef1;});}return _0x317ef1;});};exports[_0x18f8('0x6a')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 8f34e03..8ff9828 100644 --- a/server/services/agi/scripts/sestek/index.js +++ b/server/services/agi/scripts/sestek/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file +var _0xcc66=['./nda','exports'];(function(_0x5ba88b,_0x44b93d){var _0x153eb3=function(_0x2b08e1){while(--_0x2b08e1){_0x5ba88b['push'](_0x5ba88b['shift']());}};_0x153eb3(++_0x44b93d);}(_0xcc66,0x11e));var _0x6cc6=function(_0x41d184,_0xd9177c){_0x41d184=_0x41d184-0x0;var _0x1c2ba2=_0xcc66[_0x41d184];return _0x1c2ba2;};var nda=require(_0x6cc6('0x0'));module[_0x6cc6('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 c2b765c..067b36e 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 _0x79e4=['stringify','request-promise','../../../../../config/logger','agi','exports','ndauth_url','/token','password','username','then','POST','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','text','Bearer\x20','access_token','project','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','body'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x79e4,0x1f1));var _0x479e=function(_0x20c7f9,_0x59841b){_0x20c7f9=_0x20c7f9-0x0;var _0x2808d1=_0x79e4[_0x20c7f9];return _0x2808d1;};'use strict';var rp=require(_0x479e('0x0'));var url=require('url');var logger=require(_0x479e('0x1'))(_0x479e('0x2'));module[_0x479e('0x3')]=function(_0x18d450,_0x249b3a){var _0x6ace40={'method':'POST','uri':url['resolve'](_0x249b3a[_0x479e('0x4')],_0x479e('0x5')),'form':{'grant_type':_0x479e('0x6'),'username':_0x249b3a[_0x479e('0x7')],'password':_0x249b3a[_0x479e('0x6')]},'json':!![]};return rp(_0x6ace40)[_0x479e('0x8')](function(_0x280a54){var _0x52ce27={'method':_0x479e('0x9'),'uri':url[_0x479e('0xa')](_0x249b3a[_0x479e('0xb')],_0x479e('0xc')),'body':{'type':_0x249b3a[_0x479e('0xd')]||_0x479e('0xe'),'channelId':_0x479e('0xf'),'conversation':{'id':_0x18d450[_0x479e('0x10')]},'from':{'id':_0x18d450[_0x479e('0x11')],'name':_0x18d450['calleridname']},'recipient':{'id':_0x18d450[_0x479e('0x12')],'name':_0x18d450['extension']},'text':_0x249b3a[_0x479e('0x13')],'channelData':{}},'headers':{'Authorization':_0x479e('0x14')+_0x280a54[_0x479e('0x15')]},'json':!![]};if(_0x249b3a[_0x479e('0x16')]){_0x52ce27['body'][_0x479e('0x17')]['ProjectName']=_0x249b3a[_0x479e('0x16')];}if(_0x249b3a['ndagenerate_audio']=='1'){_0x52ce27['body'][_0x479e('0x17')][_0x479e('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x479e('0x19')};}if(_0x249b3a[_0x479e('0x1a')]){_0x52ce27['body'][_0x479e('0x17')][_0x479e('0x1b')]=_0x249b3a['custom_action'];if(_0x249b3a[_0x479e('0x1c')]){_0x52ce27[_0x479e('0x1d')]['channelData']['CustomActionData']=_0x249b3a['custom_action_data'];}}logger['info'](JSON[_0x479e('0x1e')](_0x52ce27));return rp(_0x52ce27);});}; \ No newline at end of file +var _0x8114=['uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x8114,0x6f));var _0x4811=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8114[_0x2dafbe];return _0x58a45a;};'use strict';var rp=require(_0x4811('0x0'));var url=require('url');var logger=require(_0x4811('0x1'))('agi');module['exports']=function(_0x8d1cf,_0x151273){var _0x3045bc={'method':_0x4811('0x2'),'uri':url[_0x4811('0x3')](_0x151273[_0x4811('0x4')],_0x4811('0x5')),'form':{'grant_type':_0x4811('0x6'),'username':_0x151273['username'],'password':_0x151273[_0x4811('0x6')]},'json':!![]};return rp(_0x3045bc)[_0x4811('0x7')](function(_0x1c72d4){var _0x1ee2fb={'method':_0x4811('0x2'),'uri':url[_0x4811('0x3')](_0x151273[_0x4811('0x8')],_0x4811('0x9')),'body':{'type':_0x151273[_0x4811('0xa')]||_0x4811('0xb'),'channelId':_0x4811('0xc'),'conversation':{'id':_0x8d1cf[_0x4811('0xd')]},'from':{'id':_0x8d1cf[_0x4811('0xe')],'name':_0x8d1cf[_0x4811('0xf')]},'recipient':{'id':_0x8d1cf['dnid'],'name':_0x8d1cf[_0x4811('0x10')]},'text':_0x151273[_0x4811('0x11')],'channelData':{}},'headers':{'Authorization':_0x4811('0x12')+_0x1c72d4[_0x4811('0x13')]},'json':!![]};if(_0x151273[_0x4811('0x14')]){_0x1ee2fb[_0x4811('0x15')][_0x4811('0x16')][_0x4811('0x17')]=_0x151273[_0x4811('0x14')];}if(_0x151273['ndagenerate_audio']=='1'){_0x1ee2fb[_0x4811('0x15')][_0x4811('0x16')][_0x4811('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4811('0x19')};}if(_0x151273[_0x4811('0x1a')]){_0x1ee2fb['body'][_0x4811('0x16')]['CustomAction']=_0x151273[_0x4811('0x1a')];if(_0x151273[_0x4811('0x1b')]){_0x1ee2fb['body'][_0x4811('0x16')][_0x4811('0x1c')]=_0x151273['custom_action_data'];}}logger[_0x4811('0x1d')](JSON[_0x4811('0x1e')](_0x1ee2fb));return rp(_0x1ee2fb);});}; \ 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 b2854dc..8ce7895 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 _0xd9d4=['./lib/api','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd9d4,0x172));var _0x4d9d=function(_0x51b661,_0x566ef8){_0x51b661=_0x51b661-0x0;var _0x5d1971=_0xd9d4[_0x51b661];return _0x5d1971;};'use strict';var asr=require(_0x4d9d('0x0'));module[_0x4d9d('0x1')]=function(_0x30d153,_0x180c2e,_0xbb348e,_0x238d88){return asr(_0x30d153,_0x180c2e,_0xbb348e,_0x238d88);}; \ No newline at end of file +var _0x727b=['./lib/api','exports'];(function(_0x10b697,_0x2b1775){var _0x4ef1cc=function(_0x183c2e){while(--_0x183c2e){_0x10b697['push'](_0x10b697['shift']());}};_0x4ef1cc(++_0x2b1775);}(_0x727b,0x15a));var _0xb727=function(_0x3f7b43,_0x32f087){_0x3f7b43=_0x3f7b43-0x0;var _0x327d40=_0x727b[_0x3f7b43];return _0x327d40;};'use strict';var asr=require(_0xb727('0x0'));module[_0xb727('0x1')]=function(_0x475913,_0x578bc5,_0xb79510,_0x2d3b47){return asr(_0x475913,_0x578bc5,_0xb79510,_0x2d3b47);}; \ 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 7da430d..b7702eb 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 _0xf1ce=['info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','hex','send','createReadStream','close','error','stringify','terminate','parse','result','final','hypotheses','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','isObject','open','message','bluebird','moment','crypto','../../../../../../config/logger','agi','exports'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xf1ce,0x12c));var _0xef1c=function(_0xe0d65e,_0x5203ca){_0xe0d65e=_0xe0d65e-0x0;var _0xc15f13=_0xf1ce[_0xe0d65e];return _0xc15f13;};'use strict';var BPromise=require(_0xef1c('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xef1c('0x1'));var crypto=require(_0xef1c('0x2'));var logger=require(_0xef1c('0x3'))(_0xef1c('0x4'));module[_0xef1c('0x5')]=function(_0x87e692,_0x55d226,_0x14b1ad,_0x482aaa){return new BPromise(function(_0x8447e2,_0x104e85){logger[_0xef1c('0x6')](_0xef1c('0x7'),_0x482aaa||_0xef1c('0x8'));var _0x2b4fc6=new WebSocket(_0x482aaa||_0xef1c('0x8'),{'perMessageDeflate':![]});var _0x5cbfae='';var _0x5d3216='0';var _0x43432f='1';var _0x425b96=_0xef1c('0x9');function _0xafbd5c(_0x1b9432){var _0x306bf6=crypto['createHash'](_0xef1c('0xa'));_0x306bf6[_0xef1c('0xb')](_0x1b9432);return _0x306bf6['digest'](_0xef1c('0xc'));}function _0x59bed8(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x344092=moment()['unix']();var _0x4c697f=_0xafbd5c(_0x344092+_0x55d226+_0x14b1ad);_0x2b4fc6[_0xef1c('0xd')](JSON['stringify']({'appID':_0x55d226,'timestamp':_0x344092,'appKey':_0x4c697f}));var _0x1ad558=fs[_0xef1c('0xe')](_0x87e692);_0x1ad558['on']('data',function(_0x106ac5){_0x2b4fc6[_0xef1c('0xd')](_0x106ac5);});_0x1ad558['on'](_0xef1c('0xf'),function(){_0x2b4fc6[_0xef1c('0xd')]('EOS');});}catch(_0x55f8b2){logger[_0xef1c('0x10')]('Tilde\x20ASR\x20send\x20error',JSON[_0xef1c('0x11')](_0x55f8b2));_0x2b4fc6[_0xef1c('0x12')]();}}function _0x246062(_0x542dc0){try{if(_0x542dc0){var _0x47af73=JSON[_0xef1c('0x13')](_0x542dc0);switch(_0x47af73['status']){case 0x0:if(_0x47af73['result']){if(_0x47af73[_0xef1c('0x14')][_0xef1c('0x15')]){logger[_0xef1c('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0xef1c('0x11')](_0x47af73['result'][_0xef1c('0x16')]));_0x5cbfae=_0x47af73[_0xef1c('0x14')]['hypotheses'][0x0]['transcript'];_0x5d3216=_0x47af73[_0xef1c('0x14')][_0xef1c('0x16')][0x0]['likelihood'];_0x43432f='0';_0x425b96=_0xef1c('0x17');_0x2b4fc6[_0xef1c('0x12')]();}}break;case 0x1:logger[_0xef1c('0x6')](_0xef1c('0x9'));_0x43432f='1';_0x425b96=_0xef1c('0x9');break;case 0x2:logger[_0xef1c('0x6')](_0xef1c('0x18'));_0x43432f='2';_0x425b96=_0xef1c('0x18');break;case 0x9:logger[_0xef1c('0x6')](_0xef1c('0x19'));_0x43432f='9';_0x425b96=_0xef1c('0x19');break;case 0xa:logger[_0xef1c('0x6')](_0xef1c('0x1a'));_0x43432f='10';_0x425b96=_0xef1c('0x1a');break;case 0xb:logger[_0xef1c('0x6')](_0xef1c('0x1b'));_0x43432f='11';_0x425b96='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x439202){logger['error'](_0xef1c('0x1c'),JSON[_0xef1c('0x11')](_0x439202));_0x2b4fc6[_0xef1c('0x12')]();}}function _0x1399e5(){logger[_0xef1c('0x6')](_0xef1c('0x1d'));_0x8447e2({'transcript':_0x5cbfae,'confidence':_0x5d3216,'status':_0x43432f,'status_message':_0x425b96});}function _0x1be324(_0x16abea){logger[_0xef1c('0x10')](_0xef1c('0x1e'));if(!_['isNil'](_0x16abea)){logger[_0xef1c('0x10')](_[_0xef1c('0x1f')](_0x16abea)?JSON[_0xef1c('0x11')](_0x16abea):_0x16abea);}}_0x2b4fc6['on'](_0xef1c('0x20'),_0x59bed8);_0x2b4fc6['on'](_0xef1c('0x21'),_0x246062);_0x2b4fc6['on'](_0xef1c('0xf'),_0x1399e5);_0x2b4fc6['on'](_0xef1c('0x10'),_0x1be324);});}; \ No newline at end of file +var _0x8082=['createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','stringify','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','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','open','message','bluebird','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','send'];(function(_0x43fa11,_0x339ba5){var _0x464e28=function(_0x38ce42){while(--_0x38ce42){_0x43fa11['push'](_0x43fa11['shift']());}};_0x464e28(++_0x339ba5);}(_0x8082,0x8a));var _0x2808=function(_0x40abf7,_0x6d4d0a){_0x40abf7=_0x40abf7-0x0;var _0x2c5a79=_0x8082[_0x40abf7];return _0x2c5a79;};'use strict';var BPromise=require(_0x2808('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x2808('0x1'));var crypto=require(_0x2808('0x2'));var logger=require(_0x2808('0x3'))('agi');module[_0x2808('0x4')]=function(_0x3d9d93,_0x709020,_0x523164,_0x3e252f){return new BPromise(function(_0x55e4bb,_0x2797bc){logger[_0x2808('0x5')](_0x2808('0x6'),_0x3e252f||_0x2808('0x7'));var _0x562fd3=new WebSocket(_0x3e252f||_0x2808('0x7'),{'perMessageDeflate':![]});var _0x5c1b63='';var _0x27148c='0';var _0x1852b2='1';var _0x2368ee=_0x2808('0x8');function _0x498605(_0x37b32e){var _0x377838=crypto['createHash'](_0x2808('0x9'));_0x377838[_0x2808('0xa')](_0x37b32e);return _0x377838[_0x2808('0xb')]('hex');}function _0x256aaf(){try{logger['info'](_0x2808('0xc'));var _0x29d118=moment()['unix']();var _0x27ca6f=_0x498605(_0x29d118+_0x709020+_0x523164);_0x562fd3[_0x2808('0xd')](JSON['stringify']({'appID':_0x709020,'timestamp':_0x29d118,'appKey':_0x27ca6f}));var _0x38ede9=fs[_0x2808('0xe')](_0x3d9d93);_0x38ede9['on'](_0x2808('0xf'),function(_0x5a8ea7){_0x562fd3[_0x2808('0xd')](_0x5a8ea7);});_0x38ede9['on'](_0x2808('0x10'),function(){_0x562fd3[_0x2808('0xd')](_0x2808('0x11'));});}catch(_0x137bdf){logger[_0x2808('0x12')](_0x2808('0x13'),JSON['stringify'](_0x137bdf));_0x562fd3[_0x2808('0x14')]();}}function _0x10c93b(_0x22c02d){try{if(_0x22c02d){var _0x4502c9=JSON[_0x2808('0x15')](_0x22c02d);switch(_0x4502c9['status']){case 0x0:if(_0x4502c9[_0x2808('0x16')]){if(_0x4502c9['result'][_0x2808('0x17')]){logger[_0x2808('0x5')](_0x2808('0x18'),JSON[_0x2808('0x19')](_0x4502c9[_0x2808('0x16')][_0x2808('0x1a')]));_0x5c1b63=_0x4502c9[_0x2808('0x16')][_0x2808('0x1a')][0x0]['transcript'];_0x27148c=_0x4502c9['result']['hypotheses'][0x0][_0x2808('0x1b')];_0x1852b2='0';_0x2368ee=_0x2808('0x1c');_0x562fd3[_0x2808('0x14')]();}}break;case 0x1:logger['info'](_0x2808('0x8'));_0x1852b2='1';_0x2368ee='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x2808('0x5')](_0x2808('0x1d'));_0x1852b2='2';_0x2368ee='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x2808('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x1852b2='9';_0x2368ee=_0x2808('0x1e');break;case 0xa:logger[_0x2808('0x5')]('Authentication\x20failed.');_0x1852b2='10';_0x2368ee='Authentication\x20failed.';break;case 0xb:logger['info'](_0x2808('0x1f'));_0x1852b2='11';_0x2368ee=_0x2808('0x1f');}}}catch(_0x504159){logger[_0x2808('0x12')](_0x2808('0x20'),JSON[_0x2808('0x19')](_0x504159));_0x562fd3[_0x2808('0x14')]();}}function _0x2e1f7f(){logger['info'](_0x2808('0x21'));_0x55e4bb({'transcript':_0x5c1b63,'confidence':_0x27148c,'status':_0x1852b2,'status_message':_0x2368ee});}function _0x22aed8(_0x1197f4){logger[_0x2808('0x12')](_0x2808('0x22'));if(!_[_0x2808('0x23')](_0x1197f4)){logger[_0x2808('0x12')](_['isObject'](_0x1197f4)?JSON[_0x2808('0x19')](_0x1197f4):_0x1197f4);}}_0x562fd3['on'](_0x2808('0x24'),_0x256aaf);_0x562fd3['on'](_0x2808('0x25'),_0x10c93b);_0x562fd3['on'](_0x2808('0x10'),_0x2e1f7f);_0x562fd3['on'](_0x2808('0x12'),_0x22aed8);});}; \ 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 715dfcf..7bb6634 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 _0xc474=['./asr','exports'];(function(_0x3e798a,_0x1c3f1f){var _0x34538f=function(_0x40e35d){while(--_0x40e35d){_0x3e798a['push'](_0x3e798a['shift']());}};_0x34538f(++_0x1c3f1f);}(_0xc474,0xe8));var _0x4c47=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xc474[_0x2aec52];return _0x3b8835;};var asr=require(_0x4c47('0x0'));module[_0x4c47('0x1')]={'asr':asr}; \ No newline at end of file +var _0xf8e4=['./asr','exports'];(function(_0x3392d0,_0x51a7b7){var _0x4c3078=function(_0x5505f5){while(--_0x5505f5){_0x3392d0['push'](_0x3392d0['shift']());}};_0x4c3078(++_0x51a7b7);}(_0xf8e4,0xf2));var _0x4f8e=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0xf8e4[_0x34d275];return _0x1379cc;};var asr=require(_0x4f8e('0x0'));module[_0x4f8e('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index a250095..ab76e35 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 _0x3f59=['listening','connection','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','close','nextTick','inherits','exports','util','net','EventEmitter','./error','./channel','127.0.0.1','call','emit','error'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x3f59,0x1b0));var _0x93f5=function(_0x2e7229,_0x5f4e84){_0x2e7229=_0x2e7229-0x0;var _0x4e99e1=_0x3f59[_0x2e7229];return _0x4e99e1;};'use strict';var util=require(_0x93f5('0x0'));var net=require(_0x93f5('0x1'));var EventEmitter=require('events')[_0x93f5('0x2')];var AGIError=require(_0x93f5('0x3'));var AGIChannel=require(_0x93f5('0x4'));var AGIServer=function(_0xcea971,_0x2e1dfe,_0x21ac17){var _0x374022=this,_0xcea971=_0xcea971||0x11dd,_0x2e1dfe=_0x2e1dfe||_0x93f5('0x5'),_0x4dd06b=null,_0x565ad3=0x0;EventEmitter[_0x93f5('0x6')](_0x374022);function _0x1e7b4d(){if(!_0xcea971){_0x374022[_0x93f5('0x7')](_0x93f5('0x8'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x4dd06b=net['createServer']();_0x4dd06b['listen'](_0xcea971,_0x2e1dfe);_0x4dd06b['on']('listening',function(){_0x374022[_0x93f5('0x7')](_0x93f5('0x9'));});_0x4dd06b['on'](_0x93f5('0xa'),function(_0xe2e487){_0x4dd06b['getConnections'](function(_0x559793,_0x364b63){if(_0x559793){_0x374022[_0x93f5('0x7')](_0x93f5('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x559793));}else if(_0x21ac17&&_0x21ac17<0x0){_0x374022[_0x93f5('0x7')]('error',new AGIError(_0x93f5('0xb')));_0xe2e487[_0x93f5('0xc')]();}else if(_0x21ac17&&_0x21ac17>0x0&&_0x21ac17<_0x364b63){_0x565ad3+=0x1;_0x374022[_0x93f5('0x7')](_0x93f5('0x8'),new AGIError(_0x93f5('0xd'),_0x565ad3));_0xe2e487[_0x93f5('0xc')]();}else{var _0x5d6001=new AGIChannel(_0xe2e487);_0x5d6001['on'](_0x93f5('0xe'),function(){_0x374022[_0x93f5('0x7')](_0x93f5('0xa'),_0x5d6001);});}});});_0x4dd06b['on'](_0x93f5('0x8'),function(_0x316fb2){_0x374022[_0x93f5('0x7')](_0x93f5('0x8'),new AGIError(_0x93f5('0xf'),_0x316fb2[_0x93f5('0x10')]));});_0x4dd06b['on'](_0x93f5('0x11'),function(){_0x374022[_0x93f5('0x7')](_0x93f5('0x11'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x93f5('0x12')](function(){_0x1e7b4d();});};util[_0x93f5('0x13')](AGIServer,EventEmitter);module[_0x93f5('0x14')]=function(_0x32b798,_0x22452d,_0x569c0c){return new AGIServer(_0x32b798,_0x22452d,_0x569c0c);}; \ No newline at end of file +var _0x68fc=['getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','net','events','./channel','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection'];(function(_0x475835,_0x3dd122){var _0x496aed=function(_0x24ab63){while(--_0x24ab63){_0x475835['push'](_0x475835['shift']());}};_0x496aed(++_0x3dd122);}(_0x68fc,0xa5));var _0xc68f=function(_0x4fa673,_0x4469c7){_0x4fa673=_0x4fa673-0x0;var _0xfc946f=_0x68fc[_0x4fa673];return _0xfc946f;};'use strict';var util=require(_0xc68f('0x0'));var net=require(_0xc68f('0x1'));var EventEmitter=require(_0xc68f('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0xc68f('0x3'));var AGIServer=function(_0x506fb5,_0xe70787,_0x593648){var _0x5899ea=this,_0x506fb5=_0x506fb5||0x11dd,_0xe70787=_0xe70787||'127.0.0.1',_0x1c6df9=null,_0x363cdf=0x0;EventEmitter['call'](_0x5899ea);function _0x9f2705(){if(!_0x506fb5){_0x5899ea[_0xc68f('0x4')](_0xc68f('0x5'),new AGIError(_0xc68f('0x6')));return![];}_0x1c6df9=net[_0xc68f('0x7')]();_0x1c6df9[_0xc68f('0x8')](_0x506fb5,_0xe70787);_0x1c6df9['on'](_0xc68f('0x9'),function(){_0x5899ea[_0xc68f('0x4')](_0xc68f('0x9'));});_0x1c6df9['on'](_0xc68f('0xa'),function(_0x5777f9){_0x1c6df9[_0xc68f('0xb')](function(_0x29f1fe,_0x1f2758){if(_0x29f1fe){_0x5899ea[_0xc68f('0x4')](_0xc68f('0x5'),new AGIError(_0xc68f('0xc'),_0x29f1fe));}else if(_0x593648&&_0x593648<0x0){_0x5899ea[_0xc68f('0x4')](_0xc68f('0x5'),new AGIError(_0xc68f('0xd')));_0x5777f9[_0xc68f('0xe')]();}else if(_0x593648&&_0x593648>0x0&&_0x593648<_0x1f2758){_0x363cdf+=0x1;_0x5899ea[_0xc68f('0x4')]('error',new AGIError(_0xc68f('0xf'),_0x363cdf));_0x5777f9[_0xc68f('0xe')]();}else{var _0x2b1d30=new AGIChannel(_0x5777f9);_0x2b1d30['on'](_0xc68f('0x10'),function(){_0x5899ea[_0xc68f('0x4')](_0xc68f('0xa'),_0x2b1d30);});}});});_0x1c6df9['on'](_0xc68f('0x5'),function(_0x209d16){_0x5899ea[_0xc68f('0x4')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x209d16[_0xc68f('0x11')]));});_0x1c6df9['on'](_0xc68f('0x12'),function(){_0x5899ea[_0xc68f('0x4')](_0xc68f('0x12'),new AGIError(_0xc68f('0x13')));});}process[_0xc68f('0x14')](function(){_0x9f2705();});};util['inherits'](AGIServer,EventEmitter);module[_0xc68f('0x15')]=function(_0x398b35,_0x2acad7,_0x2c058c){return new AGIServer(_0x398b35,_0x2acad7,_0x2c058c);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index ff5a73b..a474247 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 _0x722b=['no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','agi://%s/square,\x22%s\x22,\x22%s\x22','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','googleCloudTTS','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','./scripts','rawHeaders','menu','getdigits','getsecretdigits','mailRpc','getVariable','rpc','getVariableById','name','getVoiceQueue','then','catch','prototype','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getSound','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','lastName','isNil','phone','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','MP3','google_tts_language','restAPI','url','number','timeout','includes','method','toUpperCase','body','rawBody','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','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','options','googleDialogflow','key','sestekNDA','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','%s.%s','saveRestApiResult','stringify','split','replaceAll','extra','getAndSetVariable','result','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','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','callback','list_id','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','DIAL','SIP/%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','setVariable','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','maxdigit','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws\x20Polly\x20%s\x20file\x20created','awslex','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','generate','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','extension','priority','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\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','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','ispeechTTS','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','service','host','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block'];(function(_0x3f986a,_0x2fe38a){var _0x26741d=function(_0x344387){while(--_0x344387){_0x3f986a['push'](_0x3f986a['shift']());}};_0x26741d(++_0x2fe38a);}(_0x722b,0x1e2));var _0xb722=function(_0x1caf9e,_0x5890b0){_0x1caf9e=_0x1caf9e-0x0;var _0x4bc41d=_0x722b[_0x1caf9e];return _0x4bc41d;};'use strict';var fs=require('fs');var path=require(_0xb722('0x0'));var util=require(_0xb722('0x1'));var _=require(_0xb722('0x2'));var sh=require('shelljs');var odbc=require(_0xb722('0x3'))();var rs=require(_0xb722('0x4'));var moment=require(_0xb722('0x5'));var Mustache=require(_0xb722('0x6'));var rp=require(_0xb722('0x7'));var logger=require('../../config/logger')(_0xb722('0x8'));var config=require(_0xb722('0x9'));var scripts=require(_0xb722('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xb722('0xb'),'rawBody'];var verticesWithRetry=[_0xb722('0xc'),_0xb722('0xd'),_0xb722('0xe')];var AGIVertices=function(_0xe3df96,_0x4bbeb8,_0x3a15f8){this['channel']=_0xe3df96;this['rpc']=_0x4bbeb8;this[_0xb722('0xf')]=_0x3a15f8;};AGIVertices['prototype'][_0xb722('0x10')]=function(_0x1e05eb,_0x7e5aa5){this[_0xb722('0x11')][_0xb722('0x12')](_0x1e05eb)['then'](function(_0x5936bb){_0x7e5aa5(null,_0x5936bb?_0x5936bb[_0xb722('0x13')]:![]);})['catch'](function(_0x3643ae){_0x7e5aa5(_0x3643ae);});};AGIVertices['prototype'][_0xb722('0x14')]=function(_0x346282,_0x31c02c){this['rpc']['getVoiceQueueById'](_0x346282)[_0xb722('0x15')](function(_0x37a0b5){_0x31c02c(null,_0x37a0b5?_0x37a0b5[_0xb722('0x13')]:![]);})[_0xb722('0x16')](function(_0x5ad829){_0x31c02c(_0x5ad829);});};AGIVertices[_0xb722('0x17')][_0xb722('0x18')]=function(_0x34b410,_0xa7cda0){this[_0xb722('0x11')][_0xb722('0x19')](_0x34b410)[_0xb722('0x15')](function(_0xa023cc){_0xa7cda0(null,_0xa023cc?_0xa023cc[_0xb722('0x13')]:![]);})[_0xb722('0x16')](function(_0x3f654c){_0xa7cda0(_0x3f654c);});};AGIVertices['prototype'][_0xb722('0x1a')]=function(_0x2f6222,_0x2d9653){this[_0xb722('0x11')]['getSquareOdbcById'](_0x2f6222)[_0xb722('0x15')](function(_0x2a7f6f){_0x2d9653(null,_0x2a7f6f?_0x2a7f6f[_0xb722('0x1b')]:![]);})['catch'](function(_0x42c173){_0x2d9653(_0x42c173);});};AGIVertices[_0xb722('0x17')][_0xb722('0x1c')]=function(_0x592e67,_0x10c9c5){this[_0xb722('0x11')][_0xb722('0x1d')](_0x592e67)['then'](function(_0x53b7e6){_0x10c9c5(null,_0x53b7e6?_0x53b7e6[_0xb722('0x13')]:![]);})['catch'](function(_0x107464){_0x10c9c5(_0x107464);});};AGIVertices['prototype'][_0xb722('0x1e')]=function(_0x5a2397,_0x408b25){this['rpc']['getTrunkById'](_0x5a2397)[_0xb722('0x15')](function(_0x4e7600){_0x408b25(null,_0x4e7600?_0x4e7600[_0xb722('0x13')]:![]);})[_0xb722('0x16')](function(_0x27f1ac){_0x408b25(_0x27f1ac);});};AGIVertices[_0xb722('0x17')][_0xb722('0x1f')]=function(_0x513967,_0x4baed7){var _0x471134=this;this[_0xb722('0x11')]['getSoundById'](_0x513967)[_0xb722('0x15')](function(_0x24606f){_0x4baed7(null,_0x24606f?_0x471134['getSoundPath'](_0x24606f['save_name']):![]);})[_0xb722('0x16')](function(_0x490103){_0x4baed7(_0x490103);});};AGIVertices[_0xb722('0x17')]['getMailAccount']=function(_0x5dd9bb,_0x44a576){this[_0xb722('0x11')][_0xb722('0x20')](_0x5dd9bb)['then'](function(_0x52e540){_0x44a576(null,_0x52e540?_0x52e540:![]);})[_0xb722('0x16')](function(_0x3b895d){_0x44a576(_0x3b895d);});};AGIVertices[_0xb722('0x17')][_0xb722('0x21')]=function(_0x9c5e9c,_0x367779,_0x19f4b9){this[_0xb722('0xf')][_0xb722('0x21')](_0x9c5e9c,_0x367779)['then'](function(){_0x19f4b9(null);})[_0xb722('0x16')](function(_0x291e0b){_0x19f4b9(_0x291e0b);});};AGIVertices[_0xb722('0x17')][_0xb722('0x22')]=function(_0x21cc45,_0x288905){this[_0xb722('0x11')][_0xb722('0x23')](_0x21cc45)[_0xb722('0x15')](function(_0x5d20c8){if(_0x5d20c8){if(_0x5d20c8[_0xb722('0x24')]){_0x288905(null,[_0x5d20c8[_0xb722('0x25')]]);}else{_0x288905(null,_['map'](_0x5d20c8[_0xb722('0x26')],_0xb722('0x25')));}}else{_0x288905(null,![]);}})[_0xb722('0x16')](function(_0x217870){_0x288905(_0x217870);});};AGIVertices['prototype']['getSoundPath']=function(_0x3fbec2){return util[_0xb722('0x27')](_0xb722('0x28'),FILES_PATH,_0x3fbec2);};AGIVertices[_0xb722('0x17')][_0xb722('0x29')]=function(_0x2749ef,_0x12deaa,_0x87abc4){odbc[_0xb722('0x2a')](_0x2749ef,function(_0x3c38a9){if(_0x3c38a9){logger[_0xb722('0x2b')](_0xb722('0x2c'),_0x3c38a9);_0x87abc4(_0x3c38a9);}else{logger[_0xb722('0x2d')]('ODBC\x20connection\x20successfully');odbc[_0xb722('0x2e')](_0x12deaa,function(_0x476c99,_0x38c196){if(_0x476c99){logger[_0xb722('0x2d')](_0xb722('0x2f'),_0x12deaa);_0x87abc4(_0x476c99);}else{logger[_0xb722('0x2d')](_0xb722('0x30'),_0x12deaa);odbc['close'](function(_0x2a27b){if(_0x2a27b){logger['error'](_0xb722('0x31'),_0x2a27b);}_0x87abc4(null,_0x38c196);});}});}});};AGIVertices['prototype'][_0xb722('0x32')]=function(_0x3c0c3b,_0xbfc8aa){this[_0xb722('0x11')]['getSmsAccountById'](_0x3c0c3b)['then'](function(_0x212929){_0xbfc8aa(null,_0x212929?_0x212929:![]);})[_0xb722('0x16')](function(_0x766736){_0xbfc8aa(_0x766736);});};AGIVertices[_0xb722('0x17')][_0xb722('0x33')]=function(_0x2d393e,_0x3814bf){this[_0xb722('0x11')][_0xb722('0x33')](_0x2d393e)[_0xb722('0x15')](function(_0x3fcdae){_0x3814bf(null,_0x3fcdae);})[_0xb722('0x16')](function(_0x231805){_0x3814bf(_0x231805);});};AGIVertices[_0xb722('0x17')]['createSquareDetailsReport']=function(_0x3d1344,_0x296693,_0x5192f4){this[_0xb722('0x11')][_0xb722('0x34')]({'uniqueid':this[_0xb722('0x35')][_0xb722('0x36')],'node':_0x3d1344[_0xb722('0x37')],'application':_0x3d1344[_0xb722('0x38')],'data':_0x296693||null,'project_name':this[_0xb722('0x35')][_0xb722('0x39')],'callerid':this['channel'][_0xb722('0x3a')]})[_0xb722('0x15')](function(_0x4896cd){if(_0x5192f4){_0x5192f4(null,_0x4896cd);}})['catch'](function(_0x259d99){if(_0x5192f4){_0x5192f4(_0x259d99);}});};AGIVertices[_0xb722('0x17')][_0xb722('0x3b')]=function(_0x1184e4,_0x4d2312,_0x2ae106,_0x999105){this['rpc'][_0xb722('0x3b')]({'uniqueid':this[_0xb722('0x35')][_0xb722('0x36')],'callerid':this[_0xb722('0x35')]['callerid'],'calleridname':this[_0xb722('0x35')][_0xb722('0x3c')],'context':this[_0xb722('0x35')][_0xb722('0x3d')],'extension':this['channel']['extension'],'priority':this[_0xb722('0x35')]['priority'],'accountcode':this['channel']['accountcode'],'dnid':this[_0xb722('0x35')][_0xb722('0x3e')],'projectName':this[_0xb722('0x35')]['arg_1'],'saveName':_0x4d2312,'filename':_0x1184e4[_0xb722('0x3f')]||_0x4d2312,'savePath':_0x2ae106})['then'](function(_0x245a9e){_0x999105(null,_0x245a9e);})[_0xb722('0x16')](function(_0xedc075){_0x999105(_0xedc075);});};AGIVertices[_0xb722('0x17')][_0xb722('0x40')]=function(_0x48cf8c,_0x24583c,_0x4e77a8){this[_0xb722('0x11')]['createSquareMessage']({'uniqueid':this[_0xb722('0x35')][_0xb722('0x36')],'body':_0x48cf8c,'direction':_0x24583c})[_0xb722('0x15')](function(_0x451967){if(_0x4e77a8){_0x4e77a8(null,_0x451967);}})[_0xb722('0x16')](function(_0x558d23){if(_0x4e77a8){_0x4e77a8(_0x558d23);}});};AGIVertices[_0xb722('0x17')][_0xb722('0x41')]=function(_0x17f3b1,_0x384052){this['rpc'][_0xb722('0x41')]({'firstName':_[_0xb722('0x42')](_0x17f3b1[_0xb722('0x13')])||_['isNil'](_0x17f3b1[_0xb722('0x13')])?_0xb722('0x43')+Math['random']():_0x17f3b1['name'],'lastName':_[_0xb722('0x42')](_0x17f3b1[_0xb722('0x44')])||_[_0xb722('0x45')](_0x17f3b1[_0xb722('0x44')])?null:_0x17f3b1[_0xb722('0x44')],'phone':_0x17f3b1[_0xb722('0x46')],'ListId':_0x17f3b1['list_id'],'scheduledat':_0x17f3b1[_0xb722('0x47')],'callbackUniqueid':this[_0xb722('0x35')][_0xb722('0x36')],'tags':'callback','description':_0xb722('0x48')+_0x17f3b1[_0xb722('0x47')][_0xb722('0x49')](),'priority':_0x17f3b1[_0xb722('0x4a')]})[_0xb722('0x15')](function(_0x3ef765){_0x384052(null,_0x3ef765);})[_0xb722('0x16')](function(_0x3be80d){_0x384052(_0x3be80d);});};AGIVertices['prototype'][_0xb722('0x4b')]=function(_0x46b9eb,_0x45a0c1){this[_0xb722('0x11')][_0xb722('0x4c')](_0x46b9eb)[_0xb722('0x15')](function(_0x3fc24d){_0x45a0c1(null,_0x3fc24d?_0x3fc24d[_0xb722('0x13')]:![]);})[_0xb722('0x16')](function(_0xf72f7a){_0x45a0c1(_0xf72f7a);});};AGIVertices[_0xb722('0x17')][_0xb722('0x4d')]=function(_0x2f13a4,_0x53615b,_0x13b21a){var _0x4bfa5a={'role':_0xb722('0x4e')};_0x4bfa5a[_0x2f13a4]=this[_0xb722('0x35')][_0xb722('0x3a')];this[_0xb722('0x11')][_0xb722('0x4d')](_0x4bfa5a,_0x53615b,this[_0xb722('0x35')][_0xb722('0x36')])[_0xb722('0x15')](function(_0x35ea48){_0x13b21a(null,_[_0xb722('0x45')](_0x35ea48)?![]:!![]);})[_0xb722('0x16')](function(_0x1855ae){logger['error'](_0x1855ae);_0x13b21a(null,![]);});};AGIVertices['prototype'][_0xb722('0x4f')]=function(_0x2ffee5,_0x5d88ad){var _0x2b6d81={'role':_0xb722('0x4e')};_0x2b6d81[_0x2ffee5]=this[_0xb722('0x35')]['callerid'];this[_0xb722('0x11')][_0xb722('0x4f')](_0x2b6d81)[_0xb722('0x15')](function(_0x21da66){_0x5d88ad(null,_['isNil'](_0x21da66)?![]:!![]);})['catch'](function(_0x42be59){logger[_0xb722('0x2b')](_0x42be59);_0x5d88ad(null,![]);});};AGIVertices[_0xb722('0x17')][_0xb722('0x50')]=function(_0x128b9d,_0x316260){var _0x5b16a4={'role':_0xb722('0x4e')};_0x5b16a4[_0x128b9d]=this[_0xb722('0x35')]['callerid'];this['rpc']['agentLogout'](_0x5b16a4)['then'](function(_0x368148){_0x316260(null,_['isNil'](_0x368148)?![]:!![]);})[_0xb722('0x16')](function(_0x54be41){logger['error'](_0x54be41);_0x316260(null,![]);});};AGIVertices[_0xb722('0x17')][_0xb722('0x51')]=function(_0x55a959,_0x11331e){var _0x12dd54={'role':'agent'};_0x12dd54[_0x55a959]=this[_0xb722('0x35')][_0xb722('0x3a')];var _0x47a37c=_0x55a959!=_0xb722('0x52')?util[_0xb722('0x27')](_0xb722('0x53'),_0xb722('0x54'),this[_0xb722('0x35')][_0xb722('0x3a')]):undefined;this[_0xb722('0x11')]['agentLogin'](_0x12dd54,_0x47a37c)[_0xb722('0x15')](function(_0x2322d2){_0x11331e(null,_[_0xb722('0x45')](_0x2322d2)?![]:!![]);})[_0xb722('0x16')](function(_0xc0409){logger['error'](_0xc0409);_0x11331e(null,![]);});};AGIVertices[_0xb722('0x17')][_0xb722('0x55')]=function(_0x18f921,_0x5ca9bb){sh['exec'](_[_0xb722('0x56')](_0x18f921),function(_0x299563,_0x2035fa){var _0x29c9a2=_0x2035fa[_0xb722('0x57')](/(\r\n|\n|\r)/gm,'');_0x5ca9bb(null,_0x29c9a2);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x1bbb18,_0x9e10d9){scripts['googleCloudTTS'](_0x1bbb18['apiKey'],_0x1bbb18[_0xb722('0x58')]||_0xb722('0x59'),_0x1bbb18[_0xb722('0x59')],_0x1bbb18[_0xb722('0x5a')]||_0xb722('0x5b'),_0x1bbb18['ssmlGender']||_0xb722('0x5c'),_0x1bbb18[_0xb722('0x5d')]||_0xb722('0x5e'))[_0xb722('0x15')](function(_0x5c0d14){_0x9e10d9(null,_0x5c0d14);})[_0xb722('0x16')](function(_0x2220f2){_0x9e10d9(_0x2220f2);});};AGIVertices[_0xb722('0x17')]['googleTTS']=function(_0x2f18d4,_0x2d0498){scripts['googleTTS'](_0x2f18d4[_0xb722('0x59')],_0x2f18d4[_0xb722('0x5f')]||'en',0x1)[_0xb722('0x15')](function(_0x49f1d8){_0x2d0498(null,_0x49f1d8);})['catch'](function(_0x41c282){_0x2d0498(_0x41c282);});};AGIVertices[_0xb722('0x17')][_0xb722('0x60')]=function(_0xe9ca3b,_0xb1f97a){var _0x4839e8={'uri':_0xe9ca3b[_0xb722('0x61')],'method':_0xe9ca3b['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xe9ca3b['timeout'])===_0xb722('0x62')&&parseInt(_0xe9ca3b[_0xb722('0x63')])>=0x1?parseInt(_0xe9ca3b['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xb722('0x64')](['POST','PUT'],_0x4839e8[_0xb722('0x65')][_0xb722('0x66')]())){try{_0x4839e8[_0xb722('0x67')]=_0xe9ca3b[_0xb722('0x68')]?JSON[_0xb722('0x69')](_0xe9ca3b[_0xb722('0x68')]):{};}catch(_0x141a5a){logger[_0xb722('0x2b')](_0xb722('0x6a'),_0x141a5a);}}try{_0x4839e8[_0xb722('0x6b')]=_0xe9ca3b[_0xb722('0xb')]?JSON[_0xb722('0x69')](_0xe9ca3b['rawHeaders']):{};}catch(_0x1fd683){logger[_0xb722('0x2b')](_0xb722('0x6c'),_0x1fd683);}if(_0xe9ca3b[_0xb722('0x6d')]){try{var _0x4db401=require(_0xe9ca3b[_0xb722('0x6d')])[_0xb722('0x6e')](this,_0x4839e8);_0x4839e8['uri']=Mustache['render'](_0xe9ca3b[_0xb722('0x61')],_0x4db401,{},['$$','$$']);if(_0x4839e8[_0xb722('0x6b')]){_0x4839e8['headers']=JSON[_0xb722('0x69')](Mustache[_0xb722('0x6f')](JSON['stringify'](_0x4839e8[_0xb722('0x6b')]),_0x4db401,{},['$$','$$']));}if(_0x4839e8[_0xb722('0x67')]){_0x4839e8[_0xb722('0x67')]=JSON[_0xb722('0x69')](Mustache[_0xb722('0x6f')](JSON['stringify'](_0x4839e8[_0xb722('0x67')]),_0x4db401,{},['$$','$$']));}}catch(_0x41459b){logger[_0xb722('0x2b')](_0xb722('0x70'),_0x41459b);}}rp(_0x4839e8)['then'](function(_0x1bceb0){var _0x6bc8b9={'statusCode':_0x1bceb0['statusCode']||0xc8,'statusMessage':_0x1bceb0[_0xb722('0x71')]||'OK','headers':_0x1bceb0['headers']||{},'body':_0x1bceb0[_0xb722('0x67')]||{}};_0xb1f97a(null,_0x6bc8b9);})[_0xb722('0x16')](function(_0x2574fd){var _0x432ed6={'statusCode':_0x2574fd[_0xb722('0x72')]||0x1f4,'statusMessage':_0x2574fd[_0xb722('0x73')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x2574fd[_0xb722('0x74')][_0xb722('0x6b')]||{},'body':_0x2574fd[_0xb722('0x74')][_0xb722('0x67')]||{}};_0xb1f97a(null,_0x432ed6);});};AGIVertices[_0xb722('0x17')][_0xb722('0x75')]=function(_0x579c4a,_0x462d41){scripts[_0xb722('0x75')](this[_0xb722('0x35')][_0xb722('0x36')],_0x579c4a[_0xb722('0x76')],_0x579c4a[_0xb722('0x59')],_0x579c4a['dialogflow_language']||'en')[_0xb722('0x15')](function(_0xb8c6ec){_0x462d41(null,_0xb8c6ec);})[_0xb722('0x16')](function(_0x4e6462){_0x462d41(_0x4e6462);});};AGIVertices[_0xb722('0x17')]['sestekNDA']=function(_0x3ca026,_0x366878){scripts[_0xb722('0x77')](this[_0xb722('0x35')],_0x3ca026)[_0xb722('0x15')](function(_0x41275c){_0x366878(null,_0x41275c);})[_0xb722('0x16')](function(_0x24504f){_0x366878(_0x24504f);});};AGIVertices[_0xb722('0x17')]['ispeechTTS']=function(_0x286039,_0xf4b2c4){scripts['ispeechTTS'](_0x286039[_0xb722('0x76')],_0x286039[_0xb722('0x59')],_0x286039[_0xb722('0x78')]||'en-US',_0x286039[_0xb722('0x79')])[_0xb722('0x15')](function(_0x1b815f){_0xf4b2c4(null,_0x1b815f);})[_0xb722('0x16')](function(_0x3eef8e){_0xf4b2c4(_0x3eef8e);});};AGIVertices[_0xb722('0x17')][_0xb722('0x7a')]=function(_0x132e05,_0x16763d,_0x445a6d){scripts[_0xb722('0x7a')](_0x16763d,_0x132e05['key'],_0x132e05['ispeech_asr_language']||_0xb722('0x5b'),this[_0xb722('0x7b')](_0x132e05[_0xb722('0x7c')])?_0x132e05[_0xb722('0x7c')]:undefined)[_0xb722('0x15')](function(_0x952785){_0x445a6d(null,_0x952785);})['catch'](function(_0x3f01e5){_0x445a6d(_0x3f01e5);});};AGIVertices[_0xb722('0x17')][_0xb722('0x7d')]=function(_0x134ba5,_0x34a9f2){scripts['awsPolly'](_0x134ba5['aws_access_key_id'],_0x134ba5[_0xb722('0x7e')],_0x134ba5[_0xb722('0x7f')],_0x134ba5['aws_polly_voice']||'Amy',_0x134ba5[_0xb722('0x59')],_0x134ba5[_0xb722('0x80')]||_0xb722('0x59'))[_0xb722('0x15')](function(_0x4526a8){_0x34a9f2(null,_0x4526a8);})[_0xb722('0x16')](function(_0x1dba7a){_0x34a9f2(_0x1dba7a);});};AGIVertices[_0xb722('0x17')]['awsLex']=function(_0x4015b9,_0x24e98d){scripts[_0xb722('0x81')](this[_0xb722('0x35')][_0xb722('0x36')],_0x4015b9[_0xb722('0x82')],_0x4015b9['aws_secret_access_key'],_0x4015b9[_0xb722('0x83')],_0x4015b9[_0xb722('0x59')],_0x4015b9[_0xb722('0x84')])['then'](function(_0x476d2a){_0x24e98d(null,_0x476d2a);})[_0xb722('0x16')](function(_0x263eb0){_0x24e98d(_0x263eb0);});};AGIVertices[_0xb722('0x17')][_0xb722('0x85')]=function(_0x476608,_0x1b8be3,_0x33e5d5){scripts[_0xb722('0x85')](_0x1b8be3,_0x476608[_0xb722('0x76')],_0x476608[_0xb722('0x86')]||_0xb722('0x5b'))[_0xb722('0x15')](function(_0x18f399){_0x33e5d5(null,_0x18f399);})['catch'](function(_0x140c6d){_0x33e5d5(_0x140c6d);});};AGIVertices['prototype']['tildeASR']=function(_0x267b2a,_0x193836,_0x1d3860){scripts[_0xb722('0x87')](_0x193836,_0x267b2a['appid'],_0x267b2a[_0xb722('0x88')],_0x267b2a['uri'])['then'](function(_0x497871){_0x1d3860(null,_0x497871);})[_0xb722('0x16')](function(_0x4c9044){_0x1d3860(_0x4c9044);});};AGIVertices[_0xb722('0x17')][_0xb722('0x89')]=function(_0xb9526e){var _0x363ec6=_['includes'](verticesWithRetry,_0xb9526e['agicommand'])?_0xb9526e:_[_0xb722('0x8a')](_0xb9526e);for(var _0x5d1e8c in _0x363ec6){if(_0x363ec6[_0xb722('0x8b')](_0x5d1e8c)){if(_0x363ec6[_0x5d1e8c]&&_[_0xb722('0x8c')](_0x363ec6[_0x5d1e8c])){if(_[_0xb722('0x64')](recursiveMapAttributes,_0x5d1e8c)){_0x363ec6[_0x5d1e8c]=this[_0xb722('0x8d')](_0x363ec6[_0x5d1e8c]);}else{_0x363ec6[_0x5d1e8c]=this[_0xb722('0x8e')](_0x363ec6[_0x5d1e8c]);}}}}return _0x363ec6;};AGIVertices[_0xb722('0x17')][_0xb722('0x8f')]=function(_0x40f65f){for(var _0xab258a in _0x40f65f){if(_0x40f65f['hasOwnProperty'](_0xab258a)){if(_[_0xb722('0x90')](_0x40f65f[_0xab258a])){this[_0xb722('0x8f')](_0x40f65f[_0xab258a]);}else if(_[_0xb722('0x91')](_0x40f65f[_0xab258a])){for(var _0xd19c7c=0x0;_0xd19c7c<_0x40f65f[_0xab258a][_0xb722('0x92')];_0xd19c7c++){this[_0xb722('0x8f')](_0x40f65f[_0xab258a][_0xd19c7c]);}}else if(_[_0xb722('0x8c')](_0x40f65f[_0xab258a])){_0x40f65f[_0xab258a]=this[_0xb722('0x8e')](_0x40f65f[_0xab258a]);}}}};AGIVertices[_0xb722('0x17')]['saveRestApiResult']=function(_0x4ead11,_0x4d7f15){for(var _0x30102a in _0x4ead11){if(_0x4ead11[_0xb722('0x8b')](_0x30102a)){if(_['isPlainObject'](_0x4ead11[_0x30102a])){if(!_['isEmpty'](_0x4ead11[_0x30102a])){this['saveRestApiResult'](_0x4ead11[_0x30102a],util[_0xb722('0x27')](_0xb722('0x93'),_0x4d7f15,_0x30102a));}}else if(_[_0xb722('0x91')](_0x4ead11[_0x30102a])){for(var _0x116d99=0x0;_0x116d99<_0x4ead11[_0x30102a][_0xb722('0x92')];_0x116d99++){this[_0xb722('0x94')](_0x4ead11[_0x30102a][_0x116d99],util[_0xb722('0x27')](_0xb722('0x93'),_0x4d7f15,_0x30102a+'['+_0x116d99+']'));}}else{if(!_[_0xb722('0x45')](_0x4ead11[_0x30102a])){this[_0xb722('0x35')]['setVariable'](util[_0xb722('0x27')](_0xb722('0x93'),_0x4d7f15,_0x30102a),_0x4ead11[_0x30102a]);}}}}};AGIVertices[_0xb722('0x17')][_0xb722('0x8d')]=function(_0x12c088){try{var _0x57590=JSON['parse'](_0x12c088);this[_0xb722('0x8f')](_0x57590);return JSON[_0xb722('0x95')](_0x57590);}catch(_0x13bb23){return this[_0xb722('0x8e')](_0x12c088);}};AGIVertices[_0xb722('0x17')][_0xb722('0x8e')]=function(_0x4d2957){var _0x51c2e4=_0x4d2957[_0xb722('0x96')]('{');for(var _0x2a61ec=0x1;_0x2a61ec<_0x51c2e4[_0xb722('0x92')];_0x2a61ec+=0x1){var _0x57dabb=_0x51c2e4[_0x2a61ec]['split']('}');if(_0x57dabb[_0xb722('0x92')]>0x1){_0x4d2957=_0x4d2957[_0xb722('0x97')]('{'+_0x57dabb[0x0]+'}',this[_0xb722('0x35')][_0xb722('0x10')](_0x57dabb[0x0])[_0xb722('0x98')]||_0x57dabb[0x0]);}}if(_0x51c2e4['length']===0x1){return _0x4d2957['toString']();}return this[_0xb722('0x8e')](_0x4d2957);};AGIVertices['prototype'][_0xb722('0x99')]=function(_0x4a557b,_0x3a983c){var _0xb0fee4=this[_0xb722('0x35')][_0xb722('0x10')](_0x4a557b);if(_0xb0fee4[_0xb722('0x9a')]===-0x1){return _0xb0fee4;}logger[_0xb722('0x2d')](util[_0xb722('0x27')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x3a983c,_0xb0fee4['extra']));return this[_0xb722('0x35')]['setVariable'](_0x3a983c,_0xb0fee4['extra']);};AGIVertices[_0xb722('0x17')][_0xb722('0x7b')]=function(_0x24b246){return _0x24b246&&_0x24b246!=='0'&&_0x24b246!=='-1'&&_0x24b246!=='';};AGIVertices[_0xb722('0x17')][_0xb722('0x9b')]=function(_0x86642c){this[_0xb722('0x34')]['sync'](this,_0x86642c,'-');_0x86642c[_0xb722('0x9c')]=_0x86642c[_0xb722('0x9b')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xb722('0x17')][_0xb722('0x9d')]=function(_0x4c4432){logger['info'](util[_0xb722('0x27')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x4c4432['label']));if(!this[_0xb722('0x7b')](_0x4c4432['text'])){return this['channel'][_0xb722('0x9e')](_0xb722('0x9f'));}var _0x40e3ae='\x22'+_0x4c4432[_0xb722('0x59')]+'\x22';if(this[_0xb722('0x7b')](_0x4c4432[_0xb722('0x74')])){_0x40e3ae+=','+_0x4c4432[_0xb722('0x74')];}var _0x1acf34=this['channel'][_0xb722('0xa0')](_0xb722('0xa1'),_0x40e3ae);if(_0x1acf34[_0xb722('0x9a')]===-0x1){return _0x1acf34;}return this[_0xb722('0x35')][_0xb722('0x9e')](util['format'](_0xb722('0xa2'),_0x40e3ae));};AGIVertices[_0xb722('0x17')][_0xb722('0xa3')]=function(_0x424f04){logger[_0xb722('0x2d')](util[_0xb722('0x27')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x424f04[_0xb722('0x37')]));if(!this['isConfigured'](_0x424f04[_0xb722('0xa4')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x5ab817=_0x424f04[_0xb722('0xa4')];if(this[_0xb722('0x7b')](_0x424f04[_0xb722('0x74')])){_0x5ab817+=','+_0x424f04[_0xb722('0x74')];}var _0x243f72=this[_0xb722('0x35')]['exec'](_0xb722('0xa5'),_0x5ab817);if(_0x243f72[_0xb722('0x9a')]===-0x1){return _0x243f72;}var _0xedd35=this['getAndSetVariable'](_0xb722('0xa6'),_0xb722('0xa7'));if(_0xedd35[_0xb722('0x9a')]===-0x1){return _0xedd35;}var _0x1e66df=this[_0xb722('0x99')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x1e66df['result']===-0x1){return _0x1e66df;}var _0x3a9431=this[_0xb722('0x99')]('RECOG_INSTANCE()',_0xb722('0xa8'));if(_0x3a9431[_0xb722('0x9a')]===-0x1){return _0x3a9431;}return this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0xa9'),_0x5ab817));};AGIVertices[_0xb722('0x17')][_0xb722('0x8')]=function(_0x3e87e3){logger[_0xb722('0x2d')](util['format'](_0xb722('0xaa'),_0x3e87e3['label']));return this[_0xb722('0x35')]['agi']([_0x3e87e3[_0xb722('0xab')],_0x3e87e3[_0xb722('0xac')]]);};AGIVertices[_0xb722('0x17')][_0xb722('0xad')]=function(_0x160501){logger['info'](util[_0xb722('0x27')](_0xb722('0xae'),_0x160501['label']));if(this[_0xb722('0x7b')](_0x160501[_0xb722('0x63')])){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0xaf'),_0x160501[_0xb722('0x63')]));var _0x5dd627=this[_0xb722('0x35')][_0xb722('0xb0')](_0x160501[_0xb722('0x63')]);if(_0x5dd627[_0xb722('0x9a')]===-0x1){return _0x5dd627;}}return this[_0xb722('0x35')][_0xb722('0xad')]();};AGIVertices['prototype'][_0xb722('0xb1')]=function(_0x2b3da3){logger[_0xb722('0x2d')](util[_0xb722('0x27')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x2b3da3[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0x2b3da3[_0xb722('0xb2')])){return this['channel'][_0xb722('0x2b')](_0x2b3da3,_0xb722('0xb3'));}_0x2b3da3[_0xb722('0x47')]=moment();if(this[_0xb722('0x7b')](_0x2b3da3[_0xb722('0xb4')])){_0x2b3da3[_0xb722('0x47')]=moment()[_0xb722('0xb5')](_0x2b3da3[_0xb722('0xb4')],_0xb722('0xb6'));}if(!this[_0xb722('0x7b')](_0x2b3da3[_0xb722('0x4a')])){_0x2b3da3[_0xb722('0x4a')]=0x2;}this[_0xb722('0x41')][_0xb722('0x6e')](this,_0x2b3da3);return this['channel'][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0xb7'),_0x2b3da3[_0xb722('0x46')],_0x2b3da3[_0xb722('0xb2')],_0x2b3da3[_0xb722('0x47')]));};AGIVertices[_0xb722('0x17')][_0xb722('0xb8')]=function(_0x438780){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0xb9'),_0x438780[_0xb722('0x37')]));var _0x2ecdf3=this[_0xb722('0x35')][_0xb722('0xa0')](_0x438780['application'],_0x438780[_0xb722('0x74')]);if(_0x2ecdf3['result']===-0x1){return _0x2ecdf3;}return this['channel'][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0xba'),_0x438780[_0xb722('0xbb')],_0x438780[_0xb722('0x74')]));};AGIVertices[_0xb722('0x17')][_0xb722('0xbc')]=function(_0x2165e9){logger['info'](util['format'](_0xb722('0xbd'),_0x2165e9[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0x2165e9[_0xb722('0x59')])){return this['channel'][_0xb722('0x9e')](_0xb722('0x9f'));}var _0x46b774='\x22'+_0x2165e9[_0xb722('0x59')]+'\x22';if(this['isConfigured'](_0x2165e9[_0xb722('0x74')])){_0x46b774+=','+_0x2165e9[_0xb722('0x74')];}var _0x117696=this[_0xb722('0x35')][_0xb722('0xa0')](_0xb722('0xa1'),_0x46b774);if(_0x117696['result']===-0x1){return _0x117696;}return this[_0xb722('0x35')][_0xb722('0x9e')](util['format'](_0xb722('0xa2'),_0x46b774));};AGIVertices[_0xb722('0x17')][_0xb722('0xbe')]=function(_0x3e9896){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0xbf'),_0x3e9896[_0xb722('0x37')]));if(!this['isConfigured'](_0x3e9896['text'])){return this[_0xb722('0x35')][_0xb722('0x9e')](_0xb722('0x9f'));}var _0x57d3c9='\x22'+_0x3e9896[_0xb722('0x59')]+'\x22';if(this['isConfigured'](_0x3e9896[_0xb722('0x74')])){_0x57d3c9+=','+_0x3e9896[_0xb722('0x74')];}var _0x2f35d6=this[_0xb722('0x35')][_0xb722('0xa0')](_0xb722('0xa1'),_0x57d3c9);if(_0x2f35d6[_0xb722('0x9a')]===-0x1){return _0x2f35d6;}return this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0xa2'),_0x57d3c9));};AGIVertices[_0xb722('0x17')][_0xb722('0xc0')]=function(_0x404eaf){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0xc1'),_0x404eaf[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0x404eaf[_0xb722('0xa4')])){return this[_0xb722('0x35')]['noop'](_0xb722('0xc2'));}var _0x468a61=_0x404eaf[_0xb722('0xa4')];if(this[_0xb722('0x7b')](_0x404eaf['options'])){_0x468a61+=','+_0x404eaf[_0xb722('0x74')];}var _0x188711=this['channel'][_0xb722('0xa0')]('MRCPRecog',_0x468a61);if(_0x188711[_0xb722('0x9a')]===-0x1){return _0x188711;}var _0x4d93e1=this[_0xb722('0x99')](_0xb722('0xa6'),'LUMENVOX_ASR_CONFIDENCE');if(_0x4d93e1[_0xb722('0x9a')]===-0x1){return _0x4d93e1;}var _0x5d31bc=this[_0xb722('0x99')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x5d31bc['result']===-0x1){return _0x5d31bc;}var _0x169f44=this[_0xb722('0x99')]('RECOG_INSTANCE()',_0xb722('0xc3'));if(_0x169f44['result']===-0x1){return _0x169f44;}return this['channel'][_0xb722('0x9e')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x468a61));};AGIVertices[_0xb722('0x17')][_0xb722('0xc4')]=function(_0x2b1d20){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0xc5'),_0x2b1d20[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0x2b1d20[_0xb722('0xa4')])){return this[_0xb722('0x35')][_0xb722('0x9e')](_0xb722('0xc2'));}var _0x2c6c25=_0x2b1d20[_0xb722('0xa4')];if(this[_0xb722('0x7b')](_0x2b1d20[_0xb722('0x74')])){_0x2c6c25+=','+_0x2b1d20[_0xb722('0x74')];}var _0x3a5a42=this[_0xb722('0x35')][_0xb722('0xa0')](_0xb722('0xa5'),_0x2c6c25);if(_0x3a5a42['result']===-0x1){return _0x3a5a42;}var _0x4f8128=this[_0xb722('0x99')](_0xb722('0xa6'),_0xb722('0xc6'));if(_0x4f8128[_0xb722('0x9a')]===-0x1){return _0x4f8128;}var _0x3c7491=this[_0xb722('0x99')]('RECOG_INPUT()',_0xb722('0xc7'));if(_0x3c7491[_0xb722('0x9a')]===-0x1){return _0x3c7491;}var _0x2fc049=this[_0xb722('0x99')](_0xb722('0xc8'),_0xb722('0xc9'));if(_0x2fc049['result']===-0x1){return _0x2fc049;}return this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0xa9'),_0x2c6c25));};AGIVertices[_0xb722('0x17')][_0xb722('0xca')]=function(_0x4d083c){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0xcb'),_0x4d083c[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0x4d083c[_0xb722('0xcc')])){return this[_0xb722('0x35')][_0xb722('0x2b')](_0x4d083c,_0xb722('0xcd'));}var _0x4a2fc3=this[_0xb722('0x1a')][_0xb722('0x6e')](this,_0x4d083c[_0xb722('0xcc')]);if(!_0x4a2fc3){return this[_0xb722('0x35')]['error'](_0x4d083c,'no\x20odbc\x20database\x20found');}if(!this[_0xb722('0x7b')](_0x4d083c[_0xb722('0x2e')])){return this[_0xb722('0x35')]['error'](_0x4d083c,_0xb722('0xce'));}var _0xe11a2=_0x4d083c[_0xb722('0x2e')][_0xb722('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0xb722('0x35')][_0xb722('0x9e')](util['format'](_0xb722('0xcf'),_0xe11a2));var _0x4333bd=this[_0xb722('0x29')]['sync'](this,_0x4a2fc3,_0xe11a2);this[_0xb722('0x34')]['sync'](this,_0x4d083c,_0xe11a2);if(!this['isConfigured'](_0x4d083c[_0xb722('0xd0')])){return this[_0xb722('0x35')][_0xb722('0x9e')](_0xb722('0xd1'));}var _0x5b67f2=this[_0xb722('0x10')]['sync'](this,_0x4d083c[_0xb722('0xd0')]);if(!_0x5b67f2){return this[_0xb722('0x35')][_0xb722('0x2b')](_0x4d083c,_0xb722('0xd2'));}var _0x1fb184=this;_0x4333bd[_0xb722('0xd3')](function(_0x5c0d77,_0x104fc6){Object[_0xb722('0xd4')](_0x5c0d77)[_0xb722('0xd3')](function(_0xfa99bb){_0x1fb184['channel']['setVariable'](util['format']('%s[%s][%s]',_0x5b67f2,_0x104fc6,_0xfa99bb),_0x5c0d77[_0xfa99bb]);});});this[_0xb722('0x35')]['setVariable'](util[_0xb722('0x27')](_0xb722('0xd5'),_0x5b67f2),_0x4333bd[_0xb722('0x92')]);return this[_0xb722('0x35')]['noop'](util[_0xb722('0x27')]('variable\x20%s\x20set',_0x5b67f2));};AGIVertices[_0xb722('0x17')][_0xb722('0xd6')]=function(_0x25c0c5){logger[_0xb722('0xd7')](util[_0xb722('0x27')](_0xb722('0xd8'),_0x25c0c5[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0x25c0c5['sip_id'])){return this[_0xb722('0x35')][_0xb722('0x2b')](_0x25c0c5,_0xb722('0xd9'));}var _0x3e1b74=this['getUser'][_0xb722('0x6e')](this,_0x25c0c5[_0xb722('0xda')]);if(!_0x3e1b74){return this[_0xb722('0x35')]['error'](_0x25c0c5,'no\x20user\x20found');}var _0x3c2d89=this[_0xb722('0x35')][_0xb722('0xa0')](_0xb722('0xdb'),[util['format'](_0xb722('0xdc'),_0x3e1b74),_0x25c0c5[_0xb722('0x63')],_0x25c0c5['opts'],_0x25c0c5[_0xb722('0x61')]]);if(_0x3c2d89[_0xb722('0x9a')]===-0x1){return _0x3c2d89;}return this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')]('Executed\x20command\x20%s',_0xb722('0xdb')));};AGIVertices[_0xb722('0x17')][_0xb722('0xdd')]=function(_0xb80cef){logger[_0xb722('0x2d')](util['format'](_0xb722('0xde'),_0xb80cef['label']));if(!this[_0xb722('0x7b')](_0xb80cef[_0xb722('0x76')])){return this['channel']['noop'](_0xb722('0xdf'));}if(!this[_0xb722('0x7b')](_0xb80cef[_0xb722('0x59')])){return this[_0xb722('0x35')][_0xb722('0x9e')](_0xb722('0x9f'));}this['channel'][_0xb722('0xe0')]=!![];this['createSquareDetailsReport'](_0xb80cef);this[_0xb722('0x40')](_0xb80cef[_0xb722('0x59')],'in');this[_0xb722('0x35')]['noop'](util[_0xb722('0x27')](_0xb722('0xe1'),_0xb80cef[_0xb722('0x59')]));var _0x339abe=this[_0xb722('0x75')][_0xb722('0x6e')](this,_0xb80cef);if(_0x339abe){for(var _0x16b00c in _0x339abe){if(_0x339abe[_0xb722('0x8b')](_0x16b00c)){this['channel'][_0xb722('0xe2')](util[_0xb722('0x27')](_0xb722('0xe3'),_0x16b00c[_0xb722('0x66')]()),_0x339abe[_0x16b00c]);}}this[_0xb722('0x40')](_0x339abe[_0xb722('0xe4')],'out');return this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')]('Dialogflow\x20Result\x20%s',_0x339abe['speech']));}return this[_0xb722('0x35')]['error'](_0xb80cef,_0xb722('0xe5'));};AGIVertices[_0xb722('0x17')]['sesteknda']=function(_0x177ed5){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0xe6'),_0x177ed5[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0x177ed5['ndauth_url'])){return this[_0xb722('0x35')][_0xb722('0x9e')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x177ed5[_0xb722('0xe7')])){return this[_0xb722('0x35')][_0xb722('0x9e')](_0xb722('0xe8'));}if(!this[_0xb722('0x7b')](_0x177ed5[_0xb722('0xe9')])){return this[_0xb722('0x35')][_0xb722('0x9e')](_0xb722('0xea'));}if(!this[_0xb722('0x7b')](_0x177ed5[_0xb722('0xeb')])){return this['channel'][_0xb722('0x9e')](_0xb722('0x9f'));}this[_0xb722('0x35')]['bot']=!![];this[_0xb722('0x34')](_0x177ed5);this[_0xb722('0x40')](_0x177ed5['text'],'in');this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0xec'),_0x177ed5['text']));var _0x2ccf72=this['sestekNDA'][_0xb722('0x6e')](this,_0x177ed5);if(_0x2ccf72){for(var _0x59f65e in _0x2ccf72){if(_0x2ccf72[_0xb722('0x8b')](_0x59f65e)){this[_0xb722('0x35')][_0xb722('0xe2')](util['format'](_0xb722('0xed'),_0x59f65e['toUpperCase']()),_0x2ccf72[_0x59f65e]);}}this[_0xb722('0x40')](_0x2ccf72['speech'],'out');if(_0x2ccf72[_0xb722('0xee')]){this[_0xb722('0x35')][_0xb722('0x9e')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x2ccf72[_0xb722('0xee')]));var _0x2f439e=this['channel'][_0xb722('0xef')](_0x2ccf72['audiofile']);try{fs[_0xb722('0xf0')](_0x2ccf72[_0xb722('0xee')]+_0xb722('0xf1'));}catch(_0x5ac82f){logger[_0xb722('0x2b')](_0x5ac82f);}return _0x2f439e;}else{return this[_0xb722('0x35')]['noop'](util['format'](_0xb722('0xf2'),_0x2ccf72['speech']));}}return this['channel']['error'](_0x177ed5,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xb722('0x17')][_0xb722('0xf3')]=function(_0x75521e){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0xf4'),_0x75521e[_0xb722('0x37')]));return this[_0xb722('0x35')]['noop'](_0xb722('0xf3'));};AGIVertices[_0xb722('0x17')][_0xb722('0xf5')]=function(_0x524f8d){logger[_0xb722('0x2d')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x524f8d[_0xb722('0x37')]));var _0x2953b6='';if(_0x524f8d['trunk_id']){if(!this[_0xb722('0x7b')](_0x524f8d[_0xb722('0xf6')])){return this['channel']['error'](_0x524f8d,'no\x20trunk\x20selected');}else{var _0x342ec3=parseInt(_0x524f8d['trunk_id'],0xa);if(isNaN(_0x342ec3)){_0x2953b6=_0x524f8d['trunk_id'];}else{_0x2953b6=this['getTrunk'][_0xb722('0x6e')](this,_0x524f8d[_0xb722('0xf6')]);if(!_0x2953b6){return this[_0xb722('0x35')][_0xb722('0x2b')](_0x524f8d,_0xb722('0xf7'));}}}}else if(_0x524f8d[_0xb722('0xf8')]){_0x2953b6=_0x524f8d['trunk_name'];}else{return this[_0xb722('0x35')][_0xb722('0x2b')](_0x524f8d,_0xb722('0xf9'));}var _0x30e98f=this[_0xb722('0x35')][_0xb722('0xa0')](_0xb722('0xdb'),[util[_0xb722('0x27')](_0xb722('0xfa'),_0x2953b6,_0x524f8d['phone']),_0x524f8d['timeout'],_0x524f8d[_0xb722('0xfb')],_0x524f8d[_0xb722('0x61')]]);if(_0x30e98f['result']===-0x1){return _0x30e98f;}return this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0xfc'),_0xb722('0xdb')));};AGIVertices['prototype'][_0xb722('0xfd')]=function(_0x1cd145){logger[_0xb722('0x2d')](util['format'](_0xb722('0xfe'),_0x1cd145[_0xb722('0x37')]));return this['channel'][_0xb722('0x9e')](_0xb722('0xfd'));};AGIVertices['prototype'][_0xb722('0xd')]=function(_0x227451){logger['info'](util[_0xb722('0x27')](_0xb722('0xff'),_0x227451[_0xb722('0x37')]));if(_0x227451[_0xb722('0x9c')]===0x0){return this[_0xb722('0x9b')](_0x227451);}_0x227451[_0xb722('0x9c')]-=0x1;if(!this[_0xb722('0x7b')](_0x227451[_0xb722('0x100')])){return this[_0xb722('0x35')]['error'](_0x227451,_0xb722('0x101'));}var _0x1c25b0=this[_0xb722('0x1f')]['sync'](this,_0x227451[_0xb722('0x100')]);if(!_0x1c25b0){return this[_0xb722('0x35')]['error'](_0x227451,'no\x20file\x20audio\x20found');}if(!this[_0xb722('0x7b')](_0x227451[_0xb722('0xd0')])){return this['channel'][_0xb722('0x2b')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1f2f3d=this[_0xb722('0x35')][_0xb722('0x102')](_0x1c25b0,_0x227451['response'],_0x227451[_0xb722('0x103')]);var _0x1b6509=_0x1f2f3d[_0xb722('0x9a')]?_0x1f2f3d[_0xb722('0x9a')]['toString']():'';logger[_0xb722('0x2d')]('test',JSON[_0xb722('0x95')](_0x1f2f3d));if(_0x1f2f3d[_0xb722('0x9a')]===-0x1){this[_0xb722('0x34')]['sync'](this,_0x227451,_0x1b6509);return _0x1f2f3d;}else if(_0x1f2f3d[_0xb722('0x98')]==='timeout'){_0x1f2f3d[_0xb722('0x9a')]=_0x1b6509[_0xb722('0x92')]>=parseInt(_0x227451[_0xb722('0x104')])?'x':'i';}else{_0x1f2f3d[_0xb722('0x9a')]=_0x1b6509[_0xb722('0x92')]>=parseInt(_0x227451[_0xb722('0x104')])&&_0x1b6509['length']<=parseInt(_0x227451[_0xb722('0x103')])?'x':'i';}var _0x1d15c1=this['getVariable'][_0xb722('0x6e')](this,_0x227451[_0xb722('0xd0')]);if(!_0x1d15c1){return this[_0xb722('0x35')]['error'](_0x227451,'no\x20variable\x20found');}this[_0xb722('0x35')][_0xb722('0xe2')](_0x1d15c1,_0x1b6509);if(this[_0xb722('0x7b')](_0x227451[_0xb722('0x105')])){var _0x3e32d9=parseInt(_0x227451[_0xb722('0x105')],0xa);var _0x3f2248=rs['generate']({'charset':'*','length':_0x3e32d9});var _0x5c30ce=_0x1b6509['length'];if(_0x5c30ce>0x0){if(_0x5c30ce>_0x3e32d9){this[_0xb722('0x34')][_0xb722('0x6e')](this,_0x227451,_0x227451[_0xb722('0x106')]===_0xb722('0x107')?_0x3f2248+_0x1b6509['substr'](_0x3e32d9):_0x1b6509[_0xb722('0x108')](0x0,_0x5c30ce-_0x3e32d9)+_0x3f2248);}else{this['createSquareDetailsReport']['sync'](this,_0x227451,rs['generate']({'charset':'*','length':_0x5c30ce}));}}else{this[_0xb722('0x34')][_0xb722('0x6e')](this,_0x227451,'');}}else{this[_0xb722('0x34')][_0xb722('0x6e')](this,_0x227451,_0x1b6509);}return _0x1f2f3d;};AGIVertices[_0xb722('0x17')]['getsecretdigits']=function(_0x517bc7){logger[_0xb722('0x2d')](util['format'](_0xb722('0x109'),_0x517bc7[_0xb722('0x37')]));return this['getdigits'](_0x517bc7);};AGIVertices[_0xb722('0x17')][_0xb722('0x10a')]=function(_0x538fcb){logger[_0xb722('0x2d')](util[_0xb722('0x27')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x538fcb[_0xb722('0x37')]));this[_0xb722('0x34')][_0xb722('0x6e')](this,_0x538fcb,_0x538fcb[_0xb722('0x10b')]);return this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0x10c'),_0x538fcb['goalname']));};AGIVertices['prototype'][_0xb722('0x10d')]=function(_0x3b620f){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x10e'),_0x3b620f[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0x3b620f[_0xb722('0x82')])||!this[_0xb722('0x7b')](_0x3b620f[_0xb722('0x7e')])){return this[_0xb722('0x35')][_0xb722('0x9e')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xb722('0x7b')](_0x3b620f[_0xb722('0x59')])){return this[_0xb722('0x35')]['noop'](_0xb722('0x9f'));}this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')]('Trying\x20aws\x20Polly\x20%s',_0x3b620f[_0xb722('0x59')]));var _0x4a3e75=this['awsPolly'][_0xb722('0x6e')](this,_0x3b620f);if(_0x4a3e75){this[_0xb722('0x35')]['noop'](util[_0xb722('0x27')](_0xb722('0x10f'),_0x4a3e75));var _0x249da8=this[_0xb722('0x35')][_0xb722('0xef')](_0x4a3e75);try{fs[_0xb722('0xf0')](_0x4a3e75+'.wav');}catch(_0x18f5bb){logger[_0xb722('0x2b')](_0x18f5bb);}return _0x249da8;}return this[_0xb722('0x35')][_0xb722('0x2b')](_0x3b620f,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xb722('0x17')][_0xb722('0x110')]=function(_0x3eb10e){logger[_0xb722('0x2d')](util[_0xb722('0x27')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x3eb10e[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0x3eb10e[_0xb722('0x82')])||!this['isConfigured'](_0x3eb10e[_0xb722('0x7e')])){return this[_0xb722('0x35')][_0xb722('0x9e')](_0xb722('0x111'));}if(!this[_0xb722('0x7b')](_0x3eb10e[_0xb722('0x84')])){return this['channel'][_0xb722('0x9e')](_0xb722('0x112'));}if(!this[_0xb722('0x7b')](_0x3eb10e[_0xb722('0x59')])){return this['channel'][_0xb722('0x9e')](_0xb722('0x9f'));}this['channel'][_0xb722('0xe0')]=!![];this['createSquareDetailsReport'](_0x3eb10e);this[_0xb722('0x40')](_0x3eb10e[_0xb722('0x59')],'in');this['channel'][_0xb722('0x9e')](util[_0xb722('0x27')]('Trying\x20Amazon\x20Lex:\x20%s',_0x3eb10e[_0xb722('0x59')]));var _0x125539=this[_0xb722('0x81')][_0xb722('0x6e')](this,_0x3eb10e);if(_0x125539){for(var _0x2dc2b8 in _0x125539){if(_0x125539['hasOwnProperty'](_0x2dc2b8)&&_['isString'](_0x125539[_0x2dc2b8])){this['channel'][_0xb722('0xe2')](util[_0xb722('0x27')](_0xb722('0x113'),_0x2dc2b8['toUpperCase']()),_0x125539[_0x2dc2b8]);}}if(_['isNil'](_0x125539[_0xb722('0x73')])){return this[_0xb722('0x35')][_0xb722('0x9e')](_0xb722('0x114'));}else{this[_0xb722('0x40')](_0x125539[_0xb722('0x73')],'out');return this[_0xb722('0x35')]['noop'](util[_0xb722('0x27')](_0xb722('0x115'),_0x125539['message']));}}return this[_0xb722('0x35')][_0xb722('0x2b')](_0x3eb10e,_0xb722('0x116'));};AGIVertices[_0xb722('0x17')]['googleasr']=function(_0x18e020){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x117'),_0x18e020[_0xb722('0x37')],_0x18e020[_0xb722('0x63')]));if(!this['isConfigured'](_0x18e020[_0xb722('0x76')])){return this[_0xb722('0x35')][_0xb722('0x9e')](_0xb722('0xdf'));}var _0x22b18c=_0xb722('0x118');var _0x21d0b4=util[_0xb722('0x27')](_0xb722('0x119'),FILES_PATH,rs[_0xb722('0x11a')](0x4));var _0x394dc7=util['format'](_0xb722('0x93'),_0x21d0b4,_0x22b18c);var _0x16192b=!![];if(_0x18e020[_0xb722('0x11b')]===_0xb722('0x11c')){_0x16192b=![];}var _0x25d6a1=this['channel'][_0xb722('0x11d')](_0x21d0b4,_0x22b18c,_0x18e020[_0xb722('0x11e')],_0x18e020[_0xb722('0x63')],undefined,_0x16192b);if(_0x25d6a1['result']!==-0x1){this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0x11f'),_0x394dc7));var _0x5e10e7=this[_0xb722('0x85')][_0xb722('0x6e')](this,_0x18e020,_0x394dc7);if(_0x5e10e7){for(var _0x4c2f94 in _0x5e10e7){if(_0x5e10e7[_0xb722('0x8b')](_0x4c2f94)){this[_0xb722('0x35')][_0xb722('0xe2')](util[_0xb722('0x27')](_0xb722('0x120'),_0x4c2f94[_0xb722('0x66')]()),_0x5e10e7[_0x4c2f94]);}}return this[_0xb722('0x35')]['noop'](util[_0xb722('0x27')]('GoogleASR\x20Result\x20%s',JSON[_0xb722('0x95')](_0x5e10e7)));}}return _0x25d6a1;};AGIVertices[_0xb722('0x17')]['tildeasr']=function(_0x330b44){logger[_0xb722('0x2d')](util['format'](_0xb722('0x121'),_0x330b44[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0x330b44[_0xb722('0x122')])){return this[_0xb722('0x35')][_0xb722('0x9e')](_0xb722('0x123'));}if(!this[_0xb722('0x7b')](_0x330b44['appsecret'])){return this['channel'][_0xb722('0x9e')](_0xb722('0x124'));}var _0x36f633=_0xb722('0x118');var _0x10c536=util[_0xb722('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0xb722('0x11a')](0x4));var _0x74f01f=util['format'](_0xb722('0x93'),_0x10c536,_0x36f633);var _0x28e24a=!![];if(_0x330b44[_0xb722('0x11b')]==='NOBEEP'){_0x28e24a=![];}var _0x14e124=this['channel'][_0xb722('0x11d')](_0x10c536,_0x36f633,_0x330b44[_0xb722('0x11e')],_0x330b44[_0xb722('0x63')],undefined,_0x28e24a);if(_0x14e124[_0xb722('0x9a')]!==-0x1){this['channel']['noop'](util['format'](_0xb722('0x125'),_0x74f01f));var _0x2af807=this[_0xb722('0x87')][_0xb722('0x6e')](this,_0x330b44,_0x74f01f);if(_0x2af807){for(var _0x3d200f in _0x2af807){if(_0x2af807['hasOwnProperty'](_0x3d200f)){this[_0xb722('0x35')]['setVariable'](util[_0xb722('0x27')](_0xb722('0x126'),_0x3d200f[_0xb722('0x66')]()),_0x2af807[_0x3d200f]);}}return this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0x127'),JSON[_0xb722('0x95')](_0x2af807)));}}return _0x14e124;};AGIVertices[_0xb722('0x17')][_0xb722('0x128')]=function(_0x1cd8cc){logger['info'](util[_0xb722('0x27')](_0xb722('0x129'),_0x1cd8cc[_0xb722('0x37')]));return this[_0xb722('0x35')]['continueAt'](_0x1cd8cc[_0xb722('0x3d')],_0x1cd8cc[_0xb722('0x12a')],_0x1cd8cc[_0xb722('0x12b')]);};AGIVertices[_0xb722('0x17')][_0xb722('0x12c')]=function(_0x53e72d){logger['info'](util['format'](_0xb722('0x12d'),_0x53e72d[_0xb722('0x37')]));if(!this['isConfigured'](_0x53e72d['condition'])){return this[_0xb722('0x35')][_0xb722('0x2b')](_0x53e72d,_0xb722('0x12e'));}try{var _0x4491cc=eval(_0x53e72d[_0xb722('0x12f')])?_0xb722('0x130'):_0xb722('0x131');this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0x132'),_0x53e72d['condition'],_0x4491cc));return{'code':0xc8,'result':_0x4491cc};}catch(_0x1f3426){return{'code':0xc8,'result':_0xb722('0x131')};}};AGIVertices[_0xb722('0x17')]['gotoiftime']=function(_0x4481d1){logger[_0xb722('0x2d')](util['format'](_0xb722('0x133'),_0x4481d1[_0xb722('0x37')]));if(!this['isConfigured'](_0x4481d1['interval_id'])){return this[_0xb722('0x35')]['error'](_0x4481d1,_0xb722('0x134'));}var _0x56f649=this['getIntervals']['sync'](this,_0x4481d1['interval_id']);if(!_0x56f649){return this[_0xb722('0x35')]['error'](_0x4481d1,_0xb722('0x135'));}for(var _0x5a758a=0x0;_0x5a758a<_0x56f649[_0xb722('0x92')];_0x5a758a+=0x1){var _0x1865ac=this[_0xb722('0x35')][_0xb722('0x10')](util[_0xb722('0x27')](_0xb722('0x136'),_0x56f649[_0x5a758a]));if(_0x1865ac['result']===-0x1){return _0x1865ac;}logger[_0xb722('0x2d')](util[_0xb722('0x27')]('IFTIME\x20%s\x20%s',_0x56f649[_0x5a758a],_0x1865ac['extra']));if(_0x1865ac[_0xb722('0x98')]==='true'){logger['info'](util[_0xb722('0x27')]('IFTIME\x20%s\x20%s',_0x56f649[_0x5a758a],'true'));this[_0xb722('0x35')]['noop'](util[_0xb722('0x27')](_0xb722('0x137'),_0x56f649[_0x5a758a],_0xb722('0x130')));return{'code':0xc8,'result':_0xb722('0x130')};}else{logger[_0xb722('0x2d')](util['format'](_0xb722('0x137'),_0x56f649[_0x5a758a],_0xb722('0x131')));this[_0xb722('0x35')]['noop'](util[_0xb722('0x27')](_0xb722('0x137'),_0x56f649[_0x5a758a],_0xb722('0x131')));}}return{'code':0xc8,'result':_0xb722('0x131')};};AGIVertices['prototype'][_0xb722('0x138')]=function(_0x4f7c1e){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x139'),_0x4f7c1e[_0xb722('0x37')]));return this[_0xb722('0x35')][_0xb722('0x138')]();};AGIVertices['prototype']['ispeechasr']=function(_0x1504bc){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x13a'),_0x1504bc[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0x1504bc[_0xb722('0x76')])){return this['channel'][_0xb722('0x9e')](_0xb722('0xdf'));}var _0x4d6d46=_0xb722('0x118');var _0x2ef968=util[_0xb722('0x27')](_0xb722('0x119'),FILES_PATH,rs[_0xb722('0x11a')](0x4));var _0x157c58=util[_0xb722('0x27')](_0xb722('0x93'),_0x2ef968,_0x4d6d46);var _0x42d14d=!![];if(_0x1504bc[_0xb722('0x11b')]===_0xb722('0x11c')){_0x42d14d=![];}var _0xd4d26a=this[_0xb722('0x35')][_0xb722('0x11d')](_0x2ef968,_0x4d6d46,_0x1504bc[_0xb722('0x11e')],_0x1504bc[_0xb722('0x63')],undefined,_0x42d14d);if(_0xd4d26a['result']!==-0x1){this[_0xb722('0x35')]['noop'](util['format'](_0xb722('0x13b'),_0x157c58));var _0x217e3c=this['ispeechASR'][_0xb722('0x6e')](this,_0x1504bc,_0x157c58);if(_0x217e3c){for(var _0x5da194 in _0x217e3c){if(_0x217e3c[_0xb722('0x8b')](_0x5da194)){this[_0xb722('0x35')]['setVariable'](util[_0xb722('0x27')](_0xb722('0x13c'),_0x5da194[_0xb722('0x66')]()),_0x217e3c[_0x5da194]);}}return this[_0xb722('0x35')]['noop'](util['format'](_0xb722('0x13d'),JSON['stringify'](_0x217e3c)));}}return _0xd4d26a;};AGIVertices['prototype'][_0xb722('0x13e')]=function(_0x510c91){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x13f'),_0x510c91[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0x510c91[_0xb722('0x76')])){return this[_0xb722('0x35')][_0xb722('0x9e')](_0xb722('0xdf'));}if(!this[_0xb722('0x7b')](_0x510c91[_0xb722('0x59')])){return this[_0xb722('0x35')]['noop']('no\x20text\x20configured');}this[_0xb722('0x35')][_0xb722('0x9e')](util['format'](_0xb722('0x140'),_0x510c91[_0xb722('0x59')]));var _0x1eca33=this[_0xb722('0x141')][_0xb722('0x6e')](this,_0x510c91);if(_0x1eca33){this[_0xb722('0x35')]['noop'](util[_0xb722('0x27')](_0xb722('0x13b'),_0x1eca33));var _0x5577f8=this[_0xb722('0x35')][_0xb722('0xef')](_0x1eca33,_0x510c91[_0xb722('0x11e')]);try{fs[_0xb722('0xf0')](_0x1eca33+_0xb722('0xf1'));}catch(_0x27fe3e){logger[_0xb722('0x2b')](_0x27fe3e);}return _0x5577f8;}return this[_0xb722('0x35')][_0xb722('0x2b')](_0x510c91,_0xb722('0x142'));};AGIVertices[_0xb722('0x17')][_0xb722('0x143')]=function(_0x5e902a){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x144'),_0x5e902a['label']));if(!this[_0xb722('0x7b')](_0x5e902a[_0xb722('0x145')])){return this[_0xb722('0x35')][_0xb722('0x2b')](_0x5e902a,'no\x20find\x20by\x20configured');}logger[_0xb722('0x2d')](util[_0xb722('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xb722('0x35')]['callerid'],_0x5e902a[_0xb722('0x145')]));var _0x289121=this[_0xb722('0x51')][_0xb722('0x6e')](this,_0x5e902a[_0xb722('0x145')]);if(_0x289121){logger[_0xb722('0x2d')](util[_0xb722('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb722('0x35')][_0xb722('0x3a')],_0x5e902a[_0xb722('0x145')]));this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xb722('0x3a')],_0x5e902a[_0xb722('0x145')]));return{'code':0xc8,'result':_0xb722('0x146')};}else{logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x147'),this['channel'][_0xb722('0x3a')],_0x5e902a[_0xb722('0x145')]));this['channel']['noop'](util[_0xb722('0x27')](_0xb722('0x147'),this[_0xb722('0x35')][_0xb722('0x3a')],_0x5e902a[_0xb722('0x145')]));return{'code':0xc8,'result':_0xb722('0x148')};}};AGIVertices[_0xb722('0x17')][_0xb722('0x149')]=function(_0x3cfe0d){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x14a'),_0x3cfe0d['label']));if(!this[_0xb722('0x7b')](_0x3cfe0d[_0xb722('0x145')])){return this[_0xb722('0x35')]['error'](_0x3cfe0d,_0xb722('0x14b'));}logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x14c'),this[_0xb722('0x35')][_0xb722('0x3a')],_0x3cfe0d[_0xb722('0x145')]));var _0x6f53c9=this[_0xb722('0x50')]['sync'](this,_0x3cfe0d['findBy']);if(_0x6f53c9){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x14d'),this[_0xb722('0x35')][_0xb722('0x3a')],_0x3cfe0d[_0xb722('0x145')]));this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0x14d'),this['channel'][_0xb722('0x3a')],_0x3cfe0d[_0xb722('0x145')]));return{'code':0xc8,'result':_0xb722('0x146')};}else{logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x147'),this[_0xb722('0x35')][_0xb722('0x3a')],_0x3cfe0d[_0xb722('0x145')]));this['channel']['noop'](util[_0xb722('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xb722('0x35')][_0xb722('0x3a')],_0x3cfe0d[_0xb722('0x145')]));return{'code':0xc8,'result':_0xb722('0x148')};}};AGIVertices[_0xb722('0x17')][_0xb722('0x14e')]=function(_0x4920fe){logger['info'](util[_0xb722('0x27')](_0xb722('0x14f'),_0x4920fe[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0x4920fe[_0xb722('0x150')])){return this['channel']['error'](_0x4920fe,_0xb722('0x151'));}this[_0xb722('0x35')]['noop'](util[_0xb722('0x27')](_0xb722('0x152'),_0x4920fe[_0xb722('0x150')]));var _0x3b8adf=eval(_0x4920fe[_0xb722('0x150')]);if(!this[_0xb722('0x7b')](_0x4920fe[_0xb722('0xd0')])){return this[_0xb722('0x35')][_0xb722('0x9e')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3a5912=this['getVariable']['sync'](this,_0x4920fe[_0xb722('0xd0')]);if(!_0x3a5912){return this[_0xb722('0x35')][_0xb722('0x2b')](_0x4920fe,'no\x20variable\x20found');}if(_[_0xb722('0x91')](_0x3b8adf)){var _0x2c8928=this;_0x3b8adf['forEach'](function(_0x4f6fe1,_0x3261bd){_0x2c8928[_0xb722('0x35')]['setVariable'](util[_0xb722('0x27')](_0xb722('0x153'),_0x3a5912,_0x3261bd),_0x4f6fe1);});return this['channel'][_0xb722('0x9e')](util['format']('variable\x20%s[key]\x20set',_0x3a5912));}else{return this['channel'][_0xb722('0xe2')](_0x3a5912,_0x3b8adf);}};AGIVertices[_0xb722('0x17')]['menu']=function(_0x1e25df){logger[_0xb722('0x2d')](util[_0xb722('0x27')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x1e25df[_0xb722('0x37')]));if(_0x1e25df[_0xb722('0x9c')]===0x0){return this['maxRetry'](_0x1e25df);}_0x1e25df['retry']-=0x1;if(!this[_0xb722('0x7b')](_0x1e25df[_0xb722('0x100')])){return this[_0xb722('0x35')][_0xb722('0x2b')](_0x1e25df,_0xb722('0x101'));}var _0xbd061b=this[_0xb722('0x1f')][_0xb722('0x6e')](this,_0x1e25df[_0xb722('0x100')]);if(!_0xbd061b){return this[_0xb722('0x35')][_0xb722('0x2b')](_0x1e25df,_0xb722('0x154'));}var _0x35f3f=this[_0xb722('0x35')][_0xb722('0x102')](_0xbd061b,_0x1e25df['response'],_0x1e25df[_0xb722('0x155')]);var _0x5d9138=_0x35f3f[_0xb722('0x9a')];if(_0x35f3f[_0xb722('0x9a')]===-0x1){this[_0xb722('0x34')][_0xb722('0x6e')](this,_0x1e25df,'-1');return _0x35f3f;}else if(_0x35f3f[_0xb722('0x98')]===_0xb722('0x63')){_0x35f3f[_0xb722('0x9a')]=_0x35f3f[_0xb722('0x9a')][_0xb722('0x92')]>0x0?_0x35f3f[_0xb722('0x9a')]:'t';}else if(_[_0xb722('0x42')](_0x35f3f[_0xb722('0x9a')])){_0x35f3f[_0xb722('0x9a')]='#';_0x5d9138='#';}if(!this[_0xb722('0x7b')](_0x1e25df[_0xb722('0xd0')])){this['channel'][_0xb722('0x9e')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x4147d7=this[_0xb722('0x10')][_0xb722('0x6e')](this,_0x1e25df[_0xb722('0xd0')]);if(!_0x4147d7){return this[_0xb722('0x35')]['error'](_0x1e25df,_0xb722('0xd2'));}this['channel'][_0xb722('0xe2')](_0x4147d7,_0x5d9138);}this['createSquareDetailsReport'][_0xb722('0x6e')](this,_0x1e25df,_0x5d9138);return _0x35f3f;};AGIVertices[_0xb722('0x17')][_0xb722('0x9e')]=function(_0x5824a4){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x156'),_0x5824a4['label']));return this['channel']['noop'](_0x5824a4['output']||_0x5824a4[_0xb722('0x37')]);};AGIVertices[_0xb722('0x17')]['pause']=function(_0x2207aa){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x157'),_0x2207aa[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0x2207aa[_0xb722('0x145')])){return this[_0xb722('0x35')][_0xb722('0x2b')](_0x2207aa,_0xb722('0x14b'));}logger[_0xb722('0x2d')](util[_0xb722('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xb722('0x35')][_0xb722('0x3a')],_0x2207aa['findBy']));var _0x44467b=this[_0xb722('0x4b')][_0xb722('0x6e')](this,_0x2207aa['pause_id']);var _0x4ebaf6=this[_0xb722('0x4d')][_0xb722('0x6e')](this,_0x2207aa['findBy'],_0x44467b);if(_0x4ebaf6){logger['info'](util[_0xb722('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x2207aa[_0xb722('0x145')]));this['channel'][_0xb722('0x9e')](util[_0xb722('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xb722('0x3a')],_0x2207aa[_0xb722('0x145')]));return{'code':0xc8,'result':_0xb722('0x146')};}else{logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x147'),this['channel'][_0xb722('0x3a')],_0x2207aa[_0xb722('0x145')]));this[_0xb722('0x35')]['noop'](util[_0xb722('0x27')](_0xb722('0x14d'),this[_0xb722('0x35')]['callerid'],_0x2207aa[_0xb722('0x145')]));return{'code':0xc8,'result':_0xb722('0x148')};}};AGIVertices[_0xb722('0x17')][_0xb722('0x158')]=function(_0x3663eb){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x159'),_0x3663eb[_0xb722('0x37')]));if(!this['isConfigured'](_0x3663eb[_0xb722('0x100')])){return this[_0xb722('0x35')]['error'](_0x3663eb,_0xb722('0x101'));}var _0x448856=this['getSound'][_0xb722('0x6e')](this,_0x3663eb[_0xb722('0x100')]);if(!_0x448856){return this[_0xb722('0x35')][_0xb722('0x2b')](_0x3663eb,_0xb722('0x154'));}var _0x19d9d8=this[_0xb722('0x35')][_0xb722('0xa0')]('PLAYBACK',[_0x448856,_0x3663eb[_0xb722('0xfb')]]);if(_0x19d9d8[_0xb722('0x9a')]===-0x1){return _0x19d9d8;}return this[_0xb722('0x35')]['noop'](util[_0xb722('0x27')](_0xb722('0xba'),_0xb722('0x15a'),_0x448856));};AGIVertices[_0xb722('0x17')][_0xb722('0x15b')]=function(_0x217fbb){logger['info'](util[_0xb722('0x27')](_0xb722('0x15c'),_0x217fbb[_0xb722('0x37')]));if(!this['isConfigured'](_0x217fbb[_0xb722('0x15d')])){return this['channel'][_0xb722('0x2b')](_0x217fbb,_0xb722('0x15e'));}var _0x3de13e='';var _0x221691=parseInt(_0x217fbb['queue_id'],0xa);if(isNaN(_0x221691)){_0x3de13e=_0x217fbb[_0xb722('0x15d')];}else{_0x3de13e=this['getVoiceQueue'][_0xb722('0x6e')](this,_0x217fbb[_0xb722('0x15d')]);if(!_0x3de13e){return this['channel'][_0xb722('0x2b')](_0x217fbb,'no\x20queue\x20found');}}var _0x48ea3c='';if(this[_0xb722('0x7b')](_0x217fbb[_0xb722('0x100')])){var _0x45ad83=this['getSound'][_0xb722('0x6e')](this,_0x217fbb[_0xb722('0x100')]);if(_0x45ad83){_0x48ea3c=_0x45ad83;}}this[_0xb722('0x34')]['sync'](this,_0x217fbb,_0x3de13e);if(_0x217fbb[_0xb722('0xfb')][_0xb722('0x15f')]('x')<0x0){_0x217fbb[_0xb722('0xfb')]+='x';}if(_0x217fbb['opts'][_0xb722('0x15f')]('X')<0x0){_0x217fbb['opts']+='X';}this['channel'][_0xb722('0xe2')](_0xb722('0x160'),_0x3de13e?_0x3de13e[_0xb722('0x161')]():'');var _0x157537=this[_0xb722('0x35')]['exec']('QUEUE',[_0x3de13e,_0x217fbb['opts'],_0x217fbb[_0xb722('0x61')],_0x48ea3c,_0x217fbb[_0xb722('0x63')],_0x217fbb[_0xb722('0x8')],_0x217fbb[_0xb722('0x162')],_0x217fbb[_0xb722('0x163')],'',_0x217fbb['position']]);if(_0x157537[_0xb722('0x9a')]===-0x1){return _0x157537;}return this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0xba'),_0xb722('0x164'),_0x3de13e));};AGIVertices[_0xb722('0x17')][_0xb722('0x165')]=function(_0x4d8501){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x166'),_0x4d8501[_0xb722('0x37')]));var _0xaba788=_0x4d8501[_0xb722('0x167')]||_0xb722('0x118');var _0x36a991=util[_0xb722('0x27')]('%s_%s',this[_0xb722('0x35')][_0xb722('0x36')],rs[_0xb722('0x11a')](0x5));var _0x318241=util[_0xb722('0x27')](_0xb722('0x168'),FILES_PATH,_0x36a991,_0xaba788);var _0x28ccd3=util['format']('%s/recordings/%s',FILES_PATH,_0x36a991);this['createSquareRecording'][_0xb722('0x6e')](this,_0x4d8501,_0x36a991,_0x318241);this['channel'][_0xb722('0xe2')](_0xb722('0x169'),_0x36a991);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x28ccd3,_0xaba788,_0x4d8501[_0xb722('0x16a')],_0x4d8501[_0xb722('0x63')]);return this[_0xb722('0x35')][_0xb722('0x11d')](_0x28ccd3,_0xaba788,_0x4d8501[_0xb722('0x16a')],_0x4d8501[_0xb722('0x63')],undefined,!![]);};AGIVertices['prototype'][_0xb722('0x16b')]=function(_0xcda75b){logger['info'](util[_0xb722('0x27')](_0xb722('0x16c'),_0xcda75b[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0xcda75b[_0xb722('0x61')])){return this[_0xb722('0x35')][_0xb722('0x9e')]('no\x20url\x20configured');}var _0x13d5e4=this[_0xb722('0x60')][_0xb722('0x6e')](this,_0xcda75b);logger[_0xb722('0x2d')](util['format'](_0xb722('0x16d'),util[_0xb722('0x16e')](_0x13d5e4,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0xcda75b[_0xb722('0xd0')])){return this[_0xb722('0x35')]['noop'](_0xb722('0x16f'));}var _0x13ac79=this['getVariable'][_0xb722('0x6e')](this,_0xcda75b[_0xb722('0xd0')]);if(!_0x13ac79){return this['channel']['error'](_0xcda75b,_0xb722('0xd2'));}this[_0xb722('0x35')][_0xb722('0xe2')](util['format'](_0xb722('0x170'),_0x13ac79),_0x13d5e4[_0xb722('0x72')]?_0x13d5e4[_0xb722('0x72')]:_0xb722('0x171'));this[_0xb722('0x35')]['setVariable'](util['format'](_0xb722('0x172'),_0x13ac79),_0x13d5e4[_0xb722('0x71')]?_0x13d5e4[_0xb722('0x71')]:'OK');if(_0x13d5e4['body']){try{this[_0xb722('0x94')](_0x13d5e4['body'],_0x13ac79);}catch(_0x1e32de){logger['error'](util['format'](_0xb722('0x173'),_0x13ac79));}}return this[_0xb722('0x35')][_0xb722('0x9e')](util['format'](_0xb722('0x174'),_0x13ac79));};AGIVertices[_0xb722('0x17')][_0xb722('0x175')]=function(_0x339959){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x176'),_0x339959['label']));return this['channel']['sayDigits'](_0x339959[_0xb722('0x177')][_0xb722('0x57')](/\s+/g,''),_0x339959[_0xb722('0x16a')]);};AGIVertices[_0xb722('0x17')][_0xb722('0x178')]=function(_0x18a5af){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x179'),_0x18a5af[_0xb722('0x37')]));return this[_0xb722('0x35')][_0xb722('0x17a')](_0x18a5af[_0xb722('0x62')]['replace'](/\s+/g,''),_0x18a5af[_0xb722('0x16a')]);};AGIVertices[_0xb722('0x17')][_0xb722('0x17b')]=function(_0x57a3d2){logger[_0xb722('0x2d')](util[_0xb722('0x27')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x57a3d2['label']));return this[_0xb722('0x35')][_0xb722('0x17c')](_0x57a3d2[_0xb722('0x59')],_0x57a3d2[_0xb722('0x16a')]);};AGIVertices[_0xb722('0x17')][_0xb722('0x17d')]=function(_0x3bc78f){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x17e'),_0x3bc78f[_0xb722('0x37')]));if(!this['isConfigured'](_0x3bc78f[_0xb722('0x17f')])){return this[_0xb722('0x35')][_0xb722('0x9e')](_0xb722('0x180'));}var _0x4408c4=this[_0xb722('0x181')][_0xb722('0x6e')](this,_0x3bc78f['account_id']);if(!_0x4408c4||!_0x4408c4[_0xb722('0x182')]){return this['channel']['error'](_0x3bc78f,_0xb722('0x183'));}var _0x1e2db6={'from':util['format'](_0xb722('0x184'),_0x4408c4['name'],_0x4408c4[_0xb722('0x185')]||_0x4408c4[_0xb722('0x182')][_0xb722('0x186')]),'to':_0x3bc78f['to']||'','cc':_0x3bc78f['cc']||'','bcc':_0x3bc78f[_0xb722('0x187')]||'','subject':_0x3bc78f['subject'],'html':_0x3bc78f[_0xb722('0x59')],'text':_0x3bc78f['text']};var _0x329b80={'tls':{'rejectUnauthorized':![]}};if(_0x4408c4['Smtp'][_0xb722('0x188')]){_0x329b80[_0xb722('0x188')]=_0x4408c4['Smtp'][_0xb722('0x188')];}else{_0x329b80[_0xb722('0x189')]=_0x4408c4[_0xb722('0x182')][_0xb722('0x189')];_0x329b80['port']=_0x4408c4['Smtp']['port'];_0x329b80[_0xb722('0x18a')]=_0x4408c4['Smtp'][_0xb722('0x18a')];}if(_0x4408c4['Smtp'][_0xb722('0x18b')]){_0x329b80[_0xb722('0x18c')]={'user':_0x4408c4[_0xb722('0x182')]['user'],'pass':_0x4408c4[_0xb722('0x182')][_0xb722('0x18d')]};}if(this['isConfigured'](_0x3bc78f[_0xb722('0x18e')])){}logger['debug'](_0xb722('0x18f'),JSON[_0xb722('0x95')](_0x1e2db6));this[_0xb722('0x34')]['sync'](this,_0x3bc78f,_0x3bc78f[_0xb722('0x17f')]);this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0x190'),_0x4408c4[_0xb722('0x13')]));this['sendMailMessage'][_0xb722('0x6e')](this,_0x329b80,_0x1e2db6);return this[_0xb722('0x35')][_0xb722('0x9e')](_0xb722('0x191'));};AGIVertices[_0xb722('0x17')][_0xb722('0x192')]=function(_0x48d458){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x193'),_0x48d458[_0xb722('0x37')]));return this['channel'][_0xb722('0x9e')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype'][_0xb722('0x194')]=function(_0x14b7b5){logger[_0xb722('0x2d')](util[_0xb722('0x27')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x14b7b5[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0x14b7b5['sms_account_id'])){return this[_0xb722('0x35')][_0xb722('0x9e')](_0xb722('0x195'));}var _0x348195=this[_0xb722('0x32')][_0xb722('0x6e')](this,_0x14b7b5[_0xb722('0x196')]);if(!_0x348195){return this[_0xb722('0x35')][_0xb722('0x2b')](_0x14b7b5,_0xb722('0x197'));}var _0x58244e={'body':_0x14b7b5[_0xb722('0x198')],'phone':_0x14b7b5['to']||'','SmsAccountId':_0x348195['id']};logger[_0xb722('0xd7')](_0xb722('0x199'),JSON['stringify'](_0x58244e));this[_0xb722('0x34')][_0xb722('0x6e')](this,_0x14b7b5,_0x14b7b5['sms_account_id']);this['channel']['noop'](util['format'](_0xb722('0x19a'),_0x348195[_0xb722('0x13')]));this[_0xb722('0x33')][_0xb722('0x6e')](this,_0x58244e);return this[_0xb722('0x35')][_0xb722('0x9e')](_0xb722('0x19b'));};AGIVertices[_0xb722('0x17')][_0xb722('0x19c')]=function(_0x26ccdc){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x19d'),_0x26ccdc[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0x26ccdc[_0xb722('0xd0')])){return this[_0xb722('0x35')][_0xb722('0x2b')](_0x26ccdc,_0xb722('0x19e'));}var _0x1ef3cb=this['getVariable'][_0xb722('0x6e')](this,_0x26ccdc[_0xb722('0xd0')]);if(!_0x1ef3cb){return this[_0xb722('0x35')]['error'](_0x26ccdc,'no\x20variable\x20found');}return this[_0xb722('0x35')][_0xb722('0xe2')](_0x1ef3cb,_0x26ccdc[_0xb722('0x19f')]);};AGIVertices[_0xb722('0x17')]['start']=function(_0x4fbae6){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x1a0'),_0x4fbae6[_0xb722('0x37')]));this[_0xb722('0x35')]['noop'](_0xb722('0x1a1'));if(_0x4fbae6[_0xb722('0xad')]===_0xb722('0x1a2')){this[_0xb722('0x35')][_0xb722('0x9e')]('Answer');return this[_0xb722('0x35')][_0xb722('0xad')]();}return this[_0xb722('0x35')]['noop']('Skipped\x20Answer');};AGIVertices['prototype']['subproject']=function(_0x24f19e){logger[_0xb722('0x2d')](util[_0xb722('0x27')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x24f19e[_0xb722('0x37')]));if(!this[_0xb722('0x7b')](_0x24f19e[_0xb722('0x1a3')])){return this[_0xb722('0x35')][_0xb722('0x2b')](_0x24f19e,_0xb722('0x1a4'));}var _0x5dde98=this['getSquareProject'][_0xb722('0x6e')](this,_0x24f19e[_0xb722('0x1a3')]);if(!this[_0xb722('0x7b')](_0x5dde98)){return this['channel']['error'](_0x24f19e,util[_0xb722('0x27')](_0xb722('0x1a5'),_0x24f19e[_0xb722('0x1a3')]));}if(_0x5dde98===this[_0xb722('0x35')][_0xb722('0x39')]){return this[_0xb722('0x35')][_0xb722('0x2b')](_0x24f19e,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xb722('0x34')][_0xb722('0x6e')](this,_0x24f19e,_0x5dde98);var _0x16f927=this[_0xb722('0x35')][_0xb722('0xa0')]('AGI',util['format'](_0xb722('0x1a6'),config[_0xb722('0x8')]['host']||'127.0.0.1',_0x5dde98,this['channel'][_0xb722('0x39')]));if(_0x16f927[_0xb722('0x9a')]===-0x1){return _0x16f927;}return this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0xba'),_0xb722('0x1a7'),_0x5dde98));};AGIVertices[_0xb722('0x17')][_0xb722('0x1a8')]=function(_0x5b0839){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x1a9'),_0x5b0839['label']));var _0x83f01f=this[_0xb722('0x55')][_0xb722('0x6e')](this,_0x5b0839[_0xb722('0xab')]);this[_0xb722('0x34')][_0xb722('0x6e')](this,_0x5b0839,_0x5b0839[_0xb722('0xab')]);if(this[_0xb722('0x7b')](_0x5b0839[_0xb722('0xd0')])){var _0x1ab172=this['getVariable'][_0xb722('0x6e')](this,_0x5b0839['variable_id']);if(_0x1ab172){this['channel'][_0xb722('0xe2')](_0x1ab172,_0x83f01f);return this['channel'][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0x1aa'),_0x5b0839['command'],_0x1ab172));}}return this['channel'][_0xb722('0x9e')](util[_0xb722('0x27')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x5b0839['command']));};AGIVertices[_0xb722('0x17')][_0xb722('0x1ab')]=function(_0x92f445){logger[_0xb722('0x2d')](util['format'](_0xb722('0x1ac'),_0x92f445[_0xb722('0x37')]));_0x92f445[_0xb722('0x59')]=_0x92f445[_0xb722('0x59')][_0xb722('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xb722('0x7b')](_0x92f445[_0xb722('0x1ad')])){return this['channel']['noop'](_0xb722('0x1ae'));}if(!this[_0xb722('0x7b')](_0x92f445[_0xb722('0x59')])){return this['channel']['noop'](_0xb722('0x9f'));}this[_0xb722('0x35')][_0xb722('0x9e')](util['format'](_0xb722('0x1af'),_0x92f445[_0xb722('0x59')]));var _0x4384ec=this[_0xb722('0x1b0')][_0xb722('0x6e')](this,_0x92f445);if(_0x4384ec){this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0x1b1'),_0x4384ec));var _0x18a18f=this['channel']['streamFile'](_0x4384ec);try{fs['unlink'](_0x4384ec+'.wav');}catch(_0x2c9eda){logger[_0xb722('0x2b')](_0x2c9eda);}return _0x18a18f;}return this[_0xb722('0x35')]['error'](_0x92f445,_0xb722('0x1b2'));};AGIVertices[_0xb722('0x17')][_0xb722('0x1b3')]=function(_0x3c1cd6){logger['info'](util[_0xb722('0x27')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x3c1cd6['label']));_0x3c1cd6['text']=_0x3c1cd6['text'][_0xb722('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xb722('0x7b')](_0x3c1cd6[_0xb722('0x59')])){return this[_0xb722('0x35')][_0xb722('0x9e')](_0xb722('0x9f'));}this['channel'][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0x1b4'),_0x3c1cd6[_0xb722('0x59')]));var _0x5f368c=this['googleTTS'][_0xb722('0x6e')](this,_0x3c1cd6);if(_0x5f368c){this[_0xb722('0x35')]['noop'](util[_0xb722('0x27')](_0xb722('0x1b5'),_0x5f368c));var _0x99898f=this[_0xb722('0x35')][_0xb722('0xef')](_0x5f368c);try{fs[_0xb722('0xf0')](_0x5f368c+_0xb722('0xf1'));}catch(_0x4ef935){logger[_0xb722('0x2b')](_0x4ef935);}return _0x99898f;}return this[_0xb722('0x35')]['error'](_0x3c1cd6,_0xb722('0x1b6'));};AGIVertices['prototype'][_0xb722('0x1b7')]=function(_0x4b1ba3){logger[_0xb722('0x2d')](util[_0xb722('0x27')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x4b1ba3[_0xb722('0x37')]));if(!this['isConfigured'](_0x4b1ba3[_0xb722('0x145')])){return this['channel']['error'](_0x4b1ba3,_0xb722('0x14b'));}logger[_0xb722('0x2d')](util[_0xb722('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xb722('0x35')][_0xb722('0x3a')],_0x4b1ba3[_0xb722('0x145')]));var _0x274d21=this[_0xb722('0x4f')][_0xb722('0x6e')](this,_0x4b1ba3[_0xb722('0x145')]);if(_0x274d21){logger['info'](util[_0xb722('0x27')](_0xb722('0x14d'),this[_0xb722('0x35')]['callerid'],_0x4b1ba3[_0xb722('0x145')]));this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x4b1ba3[_0xb722('0x145')]));return{'code':0xc8,'result':'success'};}else{logger[_0xb722('0x2d')](util['format'](_0xb722('0x147'),this['channel'][_0xb722('0x3a')],_0x4b1ba3[_0xb722('0x145')]));this[_0xb722('0x35')][_0xb722('0x9e')](util[_0xb722('0x27')](_0xb722('0x147'),this[_0xb722('0x35')][_0xb722('0x3a')],_0x4b1ba3[_0xb722('0x145')]));return{'code':0xc8,'result':_0xb722('0x148')};}};AGIVertices[_0xb722('0x17')][_0xb722('0x1b8')]=function(_0x192f07){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x1b9'),_0x192f07['label']));var _0xf1ccc6=this[_0xb722('0x35')][_0xb722('0xa0')](_0xb722('0x1ba'),[_0x192f07['mailbox'],_0x192f07['options']]);if(_0xf1ccc6['result']===-0x1){return _0xf1ccc6;}return this['channel']['noop'](util[_0xb722('0x27')](_0xb722('0xba'),_0xb722('0x1ba'),_0x192f07[_0xb722('0x1bb')]));};AGIVertices[_0xb722('0x17')][_0xb722('0x1bc')]=function(_0x467245){logger[_0xb722('0x2d')](util[_0xb722('0x27')](_0xb722('0x1bd'),_0x467245['label']));if(!this['isConfigured'](_0x467245['variable_id'])){return this[_0xb722('0x35')][_0xb722('0x2b')](_0x467245,'no\x20variable\x20selected');}var _0x5ea5f0=this['getVariable'][_0xb722('0x6e')](this,_0x467245[_0xb722('0xd0')]);if(!_0x5ea5f0){return this['channel'][_0xb722('0x2b')](_0x467245,_0xb722('0xd2'));}var _0x2cfd67=this[_0xb722('0x35')]['getVariable'](_0x5ea5f0);return{'code':0xc8,'result':_0x2cfd67[_0xb722('0x98')]?_0x2cfd67['extra']:'-'};};String[_0xb722('0x17')]['replaceAll']=function(_0x50ede5,_0x480991){return this[_0xb722('0x96')](_0x50ede5)[_0xb722('0x1be')](_0x480991);};module[_0xb722('0x1bf')]=AGIVertices; \ No newline at end of file +var _0xb753=['uri','render','headers','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','Amy','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','isArray','length','saveRestApiResult','%s.%s','recursiveNodeIndex','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','%s[%s][%s]','setVariable','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','getUser','sip_id','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','audiofile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','no\x20variable\x20found','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','no\x20appsecret\x20configured','NOBEEP','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeechASR','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','agentLogout','success','failure','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%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','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','bcc','subject','service','host','secure','authentication','auth','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','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','Google\x20TTS\x20%s\x20file\x20created','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','no\x20variable\x20selected','exports','path','util','lodash','shelljs','moment','mustache','request-promise','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','map','Intervals','format','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','callerid','calleridname','context','extension','priority','accountcode','arg_1','file','createSquareMessage','uniqueid','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogin','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','text','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync'];(function(_0x2d86f2,_0x5e1b5c){var _0x4d2124=function(_0x4b6c2f){while(--_0x4b6c2f){_0x2d86f2['push'](_0x2d86f2['shift']());}};_0x4d2124(++_0x5e1b5c);}(_0xb753,0x158));var _0x3b75=function(_0x22868f,_0x450f48){_0x22868f=_0x22868f-0x0;var _0x97bc75=_0xb753[_0x22868f];return _0x97bc75;};'use strict';var fs=require('fs');var path=require(_0x3b75('0x0'));var util=require(_0x3b75('0x1'));var _=require(_0x3b75('0x2'));var sh=require(_0x3b75('0x3'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0x3b75('0x4'));var Mustache=require(_0x3b75('0x5'));var rp=require(_0x3b75('0x6'));var logger=require(_0x3b75('0x7'))('agi');var config=require('../../config/environment');var scripts=require(_0x3b75('0x8'));var FILES_PATH=_0x3b75('0x9');var recursiveMapAttributes=[_0x3b75('0xa'),_0x3b75('0xb')];var verticesWithRetry=[_0x3b75('0xc'),_0x3b75('0xd'),_0x3b75('0xe')];var AGIVertices=function(_0x333b07,_0x1106ad,_0x54c157){this[_0x3b75('0xf')]=_0x333b07;this[_0x3b75('0x10')]=_0x1106ad;this[_0x3b75('0x11')]=_0x54c157;};AGIVertices[_0x3b75('0x12')][_0x3b75('0x13')]=function(_0x15eb41,_0x1da617){this[_0x3b75('0x10')][_0x3b75('0x14')](_0x15eb41)[_0x3b75('0x15')](function(_0x311e2a){_0x1da617(null,_0x311e2a?_0x311e2a[_0x3b75('0x16')]:![]);})[_0x3b75('0x17')](function(_0x430ab5){_0x1da617(_0x430ab5);});};AGIVertices[_0x3b75('0x12')][_0x3b75('0x18')]=function(_0x3336bf,_0x5cdb29){this[_0x3b75('0x10')]['getVoiceQueueById'](_0x3336bf)[_0x3b75('0x15')](function(_0xed26f){_0x5cdb29(null,_0xed26f?_0xed26f[_0x3b75('0x16')]:![]);})[_0x3b75('0x17')](function(_0x476217){_0x5cdb29(_0x476217);});};AGIVertices[_0x3b75('0x12')][_0x3b75('0x19')]=function(_0x392153,_0x58a211){this[_0x3b75('0x10')][_0x3b75('0x1a')](_0x392153)[_0x3b75('0x15')](function(_0x226c02){_0x58a211(null,_0x226c02?_0x226c02[_0x3b75('0x16')]:![]);})[_0x3b75('0x17')](function(_0x232b91){_0x58a211(_0x232b91);});};AGIVertices['prototype'][_0x3b75('0x1b')]=function(_0x2e3b74,_0x5cca8f){this[_0x3b75('0x10')][_0x3b75('0x1c')](_0x2e3b74)[_0x3b75('0x15')](function(_0x341523){_0x5cca8f(null,_0x341523?_0x341523[_0x3b75('0x1d')]:![]);})['catch'](function(_0x1aaf9f){_0x5cca8f(_0x1aaf9f);});};AGIVertices['prototype']['getUser']=function(_0x98a62f,_0x464c77){this['rpc']['getUserById'](_0x98a62f)['then'](function(_0x1966c2){_0x464c77(null,_0x1966c2?_0x1966c2[_0x3b75('0x16')]:![]);})[_0x3b75('0x17')](function(_0x504a38){_0x464c77(_0x504a38);});};AGIVertices['prototype'][_0x3b75('0x1e')]=function(_0x3b0285,_0x52f47f){this[_0x3b75('0x10')][_0x3b75('0x1f')](_0x3b0285)[_0x3b75('0x15')](function(_0x4ab16e){_0x52f47f(null,_0x4ab16e?_0x4ab16e['name']:![]);})[_0x3b75('0x17')](function(_0x6aca76){_0x52f47f(_0x6aca76);});};AGIVertices[_0x3b75('0x12')][_0x3b75('0x20')]=function(_0x305b4e,_0x3a97e8){var _0x15f0e7=this;this[_0x3b75('0x10')]['getSoundById'](_0x305b4e)[_0x3b75('0x15')](function(_0x29d33b){_0x3a97e8(null,_0x29d33b?_0x15f0e7[_0x3b75('0x21')](_0x29d33b[_0x3b75('0x22')]):![]);})[_0x3b75('0x17')](function(_0x204dbb){_0x3a97e8(_0x204dbb);});};AGIVertices[_0x3b75('0x12')]['getMailAccount']=function(_0x33807f,_0x517bee){this[_0x3b75('0x10')][_0x3b75('0x23')](_0x33807f)[_0x3b75('0x15')](function(_0x1cd8d9){_0x517bee(null,_0x1cd8d9?_0x1cd8d9:![]);})[_0x3b75('0x17')](function(_0x200ef4){_0x517bee(_0x200ef4);});};AGIVertices[_0x3b75('0x12')][_0x3b75('0x24')]=function(_0x405127,_0x58759d,_0x45c3f4){this[_0x3b75('0x11')][_0x3b75('0x24')](_0x405127,_0x58759d)[_0x3b75('0x15')](function(){_0x45c3f4(null);})[_0x3b75('0x17')](function(_0x4357a4){_0x45c3f4(_0x4357a4);});};AGIVertices[_0x3b75('0x12')][_0x3b75('0x25')]=function(_0x41d1e4,_0x5c685c){this['rpc'][_0x3b75('0x26')](_0x41d1e4)['then'](function(_0x19836d){if(_0x19836d){if(_0x19836d['IntervalId']){_0x5c685c(null,[_0x19836d['interval']]);}else{_0x5c685c(null,_[_0x3b75('0x27')](_0x19836d[_0x3b75('0x28')],'interval'));}}else{_0x5c685c(null,![]);}})[_0x3b75('0x17')](function(_0x2546ac){_0x5c685c(_0x2546ac);});};AGIVertices[_0x3b75('0x12')][_0x3b75('0x21')]=function(_0x1b555d){return util[_0x3b75('0x29')](_0x3b75('0x2a'),FILES_PATH,_0x1b555d);};AGIVertices[_0x3b75('0x12')]['getQueryOdbc']=function(_0x51564a,_0x30e324,_0x3c331a){odbc['open'](_0x51564a,function(_0x3b36d3){if(_0x3b36d3){logger[_0x3b75('0x2b')](_0x3b75('0x2c'),_0x3b36d3);_0x3c331a(_0x3b36d3);}else{logger['info']('ODBC\x20connection\x20successfully');odbc['query'](_0x30e324,function(_0x4a4067,_0x1b571d){if(_0x4a4067){logger[_0x3b75('0x2d')]('Error\x20executing\x20query\x20%s',_0x30e324);_0x3c331a(_0x4a4067);}else{logger[_0x3b75('0x2d')](_0x3b75('0x2e'),_0x30e324);odbc[_0x3b75('0x2f')](function(_0x1a83e2){if(_0x1a83e2){logger[_0x3b75('0x2b')](_0x3b75('0x30'),_0x1a83e2);}_0x3c331a(null,_0x1b571d);});}});}});};AGIVertices['prototype'][_0x3b75('0x31')]=function(_0x59f692,_0x43df48){this[_0x3b75('0x10')][_0x3b75('0x32')](_0x59f692)[_0x3b75('0x15')](function(_0x38d4a4){_0x43df48(null,_0x38d4a4?_0x38d4a4:![]);})[_0x3b75('0x17')](function(_0x3df15e){_0x43df48(_0x3df15e);});};AGIVertices['prototype'][_0x3b75('0x33')]=function(_0x488ff3,_0x4bf57c){this[_0x3b75('0x10')]['createSmsMessage'](_0x488ff3)[_0x3b75('0x15')](function(_0x257e2c){_0x4bf57c(null,_0x257e2c);})['catch'](function(_0x59546f){_0x4bf57c(_0x59546f);});};AGIVertices[_0x3b75('0x12')]['createSquareDetailsReport']=function(_0x174685,_0x1ae529,_0x54493d){this['rpc'][_0x3b75('0x34')]({'uniqueid':this[_0x3b75('0xf')]['uniqueid'],'node':_0x174685[_0x3b75('0x35')],'application':_0x174685['agicommand'],'data':_0x1ae529||null,'project_name':this[_0x3b75('0xf')]['arg_1'],'callerid':this[_0x3b75('0xf')][_0x3b75('0x36')]})['then'](function(_0x38d98b){if(_0x54493d){_0x54493d(null,_0x38d98b);}})[_0x3b75('0x17')](function(_0x297a56){if(_0x54493d){_0x54493d(_0x297a56);}});};AGIVertices[_0x3b75('0x12')]['createSquareRecording']=function(_0x764b86,_0xc047e7,_0x4357d,_0x46ae21){this[_0x3b75('0x10')]['createSquareRecording']({'uniqueid':this[_0x3b75('0xf')]['uniqueid'],'callerid':this[_0x3b75('0xf')]['callerid'],'calleridname':this['channel'][_0x3b75('0x37')],'context':this[_0x3b75('0xf')][_0x3b75('0x38')],'extension':this[_0x3b75('0xf')][_0x3b75('0x39')],'priority':this[_0x3b75('0xf')][_0x3b75('0x3a')],'accountcode':this[_0x3b75('0xf')][_0x3b75('0x3b')],'dnid':this['channel']['dnid'],'projectName':this[_0x3b75('0xf')][_0x3b75('0x3c')],'saveName':_0xc047e7,'filename':_0x764b86[_0x3b75('0x3d')]||_0xc047e7,'savePath':_0x4357d})[_0x3b75('0x15')](function(_0x1339a4){_0x46ae21(null,_0x1339a4);})[_0x3b75('0x17')](function(_0x2eb2e8){_0x46ae21(_0x2eb2e8);});};AGIVertices['prototype'][_0x3b75('0x3e')]=function(_0x2a329d,_0x5190b5,_0x926da3){this[_0x3b75('0x10')][_0x3b75('0x3e')]({'uniqueid':this[_0x3b75('0xf')][_0x3b75('0x3f')],'body':_0x2a329d,'direction':_0x5190b5})[_0x3b75('0x15')](function(_0x5f0c40){if(_0x926da3){_0x926da3(null,_0x5f0c40);}})[_0x3b75('0x17')](function(_0x35f9a0){if(_0x926da3){_0x926da3(_0x35f9a0);}});};AGIVertices[_0x3b75('0x12')][_0x3b75('0x40')]=function(_0x12c837,_0x319590){this[_0x3b75('0x10')][_0x3b75('0x40')]({'firstName':_['isEmpty'](_0x12c837['name'])||_[_0x3b75('0x41')](_0x12c837[_0x3b75('0x16')])?_0x3b75('0x42')+Math[_0x3b75('0x43')]():_0x12c837[_0x3b75('0x16')],'lastName':_[_0x3b75('0x44')](_0x12c837[_0x3b75('0x45')])||_[_0x3b75('0x41')](_0x12c837[_0x3b75('0x45')])?null:_0x12c837[_0x3b75('0x45')],'phone':_0x12c837[_0x3b75('0x46')],'ListId':_0x12c837[_0x3b75('0x47')],'scheduledat':_0x12c837[_0x3b75('0x48')],'callbackUniqueid':this[_0x3b75('0xf')][_0x3b75('0x3f')],'tags':'callback','description':_0x3b75('0x49')+_0x12c837[_0x3b75('0x48')][_0x3b75('0x4a')](),'priority':_0x12c837[_0x3b75('0x4b')]})[_0x3b75('0x15')](function(_0x274139){_0x319590(null,_0x274139);})[_0x3b75('0x17')](function(_0x1f7b98){_0x319590(_0x1f7b98);});};AGIVertices[_0x3b75('0x12')][_0x3b75('0x4c')]=function(_0x336cec,_0x4cd635){this[_0x3b75('0x10')][_0x3b75('0x4d')](_0x336cec)[_0x3b75('0x15')](function(_0x4016c3){_0x4cd635(null,_0x4016c3?_0x4016c3[_0x3b75('0x16')]:![]);})[_0x3b75('0x17')](function(_0x638d1a){_0x4cd635(_0x638d1a);});};AGIVertices[_0x3b75('0x12')]['agentPause']=function(_0x2da73f,_0x43f877,_0x3b30f0){var _0x2947b1={'role':_0x3b75('0x4e')};_0x2947b1[_0x2da73f]=this[_0x3b75('0xf')][_0x3b75('0x36')];this[_0x3b75('0x10')][_0x3b75('0x4f')](_0x2947b1,_0x43f877,this[_0x3b75('0xf')][_0x3b75('0x3f')])['then'](function(_0x579104){_0x3b30f0(null,_[_0x3b75('0x41')](_0x579104)?![]:!![]);})[_0x3b75('0x17')](function(_0x5b28c0){logger['error'](_0x5b28c0);_0x3b30f0(null,![]);});};AGIVertices[_0x3b75('0x12')][_0x3b75('0x50')]=function(_0x4f318c,_0x1dadbd){var _0x13b060={'role':_0x3b75('0x4e')};_0x13b060[_0x4f318c]=this[_0x3b75('0xf')][_0x3b75('0x36')];this[_0x3b75('0x10')][_0x3b75('0x50')](_0x13b060)[_0x3b75('0x15')](function(_0x1633fd){_0x1dadbd(null,_[_0x3b75('0x41')](_0x1633fd)?![]:!![]);})[_0x3b75('0x17')](function(_0x205837){logger['error'](_0x205837);_0x1dadbd(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x113ac7,_0x182982){var _0x424366={'role':_0x3b75('0x4e')};_0x424366[_0x113ac7]=this[_0x3b75('0xf')][_0x3b75('0x36')];this['rpc']['agentLogout'](_0x424366)['then'](function(_0x5a9849){_0x182982(null,_[_0x3b75('0x41')](_0x5a9849)?![]:!![]);})[_0x3b75('0x17')](function(_0x3af41c){logger[_0x3b75('0x2b')](_0x3af41c);_0x182982(null,![]);});};AGIVertices['prototype'][_0x3b75('0x51')]=function(_0x4da207,_0x28a3ac){var _0x1510c1={'role':_0x3b75('0x4e')};_0x1510c1[_0x4da207]=this[_0x3b75('0xf')][_0x3b75('0x36')];var _0x56538d=_0x4da207!='internal'?util['format'](_0x3b75('0x52'),_0x3b75('0x53'),this[_0x3b75('0xf')]['callerid']):undefined;this[_0x3b75('0x10')][_0x3b75('0x51')](_0x1510c1,_0x56538d)[_0x3b75('0x15')](function(_0x115d96){_0x28a3ac(null,_[_0x3b75('0x41')](_0x115d96)?![]:!![]);})[_0x3b75('0x17')](function(_0xccfb89){logger['error'](_0xccfb89);_0x28a3ac(null,![]);});};AGIVertices[_0x3b75('0x12')]['shellCommand']=function(_0x3757a0,_0x15f45e){sh[_0x3b75('0x54')](_[_0x3b75('0x55')](_0x3757a0),function(_0x30e93c,_0x1ea9ef){var _0x3160c8=_0x1ea9ef[_0x3b75('0x56')](/(\r\n|\n|\r)/gm,'');_0x15f45e(null,_0x3160c8);});};AGIVertices[_0x3b75('0x12')][_0x3b75('0x57')]=function(_0x2a42f8,_0x36bf69){scripts[_0x3b75('0x57')](_0x2a42f8[_0x3b75('0x58')],_0x2a42f8['google_cloud_tts_text_type']||_0x3b75('0x59'),_0x2a42f8['text'],_0x2a42f8['languageCode']||'en-US',_0x2a42f8['ssmlGender']||_0x3b75('0x5a'),_0x2a42f8[_0x3b75('0x5b')]||'MP3')[_0x3b75('0x15')](function(_0x262bc7){_0x36bf69(null,_0x262bc7);})[_0x3b75('0x17')](function(_0x172a41){_0x36bf69(_0x172a41);});};AGIVertices[_0x3b75('0x12')]['googleTTS']=function(_0x1afcca,_0xa18b6e){scripts[_0x3b75('0x5c')](_0x1afcca[_0x3b75('0x59')],_0x1afcca[_0x3b75('0x5d')]||'en',0x1)[_0x3b75('0x15')](function(_0x305f5e){_0xa18b6e(null,_0x305f5e);})[_0x3b75('0x17')](function(_0x5a1d8a){_0xa18b6e(_0x5a1d8a);});};AGIVertices[_0x3b75('0x12')][_0x3b75('0x5e')]=function(_0x5ac0fa,_0x15a850){var _0x40722b={'uri':_0x5ac0fa[_0x3b75('0x5f')],'method':_0x5ac0fa[_0x3b75('0x60')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5ac0fa[_0x3b75('0x61')])===_0x3b75('0x62')&&parseInt(_0x5ac0fa['timeout'])>=0x1?parseInt(_0x5ac0fa['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x3b75('0x63')]([_0x3b75('0x64'),_0x3b75('0x65')],_0x40722b[_0x3b75('0x60')]['toUpperCase']())){try{_0x40722b['body']=_0x5ac0fa[_0x3b75('0xb')]?JSON[_0x3b75('0x66')](_0x5ac0fa[_0x3b75('0xb')]):{};}catch(_0x3ea22d){logger[_0x3b75('0x2b')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3ea22d);}}try{_0x40722b['headers']=_0x5ac0fa[_0x3b75('0xa')]?JSON['parse'](_0x5ac0fa[_0x3b75('0xa')]):{};}catch(_0x3712d6){logger['error'](_0x3b75('0x67'),_0x3712d6);}if(_0x5ac0fa[_0x3b75('0x68')]){try{var _0x22478b=require(_0x5ac0fa[_0x3b75('0x68')])[_0x3b75('0x69')](this,_0x40722b);_0x40722b[_0x3b75('0x6a')]=Mustache[_0x3b75('0x6b')](_0x5ac0fa[_0x3b75('0x5f')],_0x22478b,{},['$$','$$']);if(_0x40722b[_0x3b75('0x6c')]){_0x40722b[_0x3b75('0x6c')]=JSON[_0x3b75('0x66')](Mustache[_0x3b75('0x6b')](JSON[_0x3b75('0x6d')](_0x40722b[_0x3b75('0x6c')]),_0x22478b,{},['$$','$$']));}if(_0x40722b[_0x3b75('0x6e')]){_0x40722b['body']=JSON[_0x3b75('0x66')](Mustache[_0x3b75('0x6b')](JSON['stringify'](_0x40722b[_0x3b75('0x6e')]),_0x22478b,{},['$$','$$']));}}catch(_0x106cfa){logger[_0x3b75('0x2b')](_0x3b75('0x6f'),_0x106cfa);}}rp(_0x40722b)[_0x3b75('0x15')](function(_0x39b2e2){var _0x46157c={'statusCode':_0x39b2e2['statusCode']||0xc8,'statusMessage':_0x39b2e2[_0x3b75('0x70')]||'OK','headers':_0x39b2e2[_0x3b75('0x6c')]||{},'body':_0x39b2e2[_0x3b75('0x6e')]||{}};_0x15a850(null,_0x46157c);})[_0x3b75('0x17')](function(_0x5ca99a){var _0x2775d3={'statusCode':_0x5ca99a[_0x3b75('0x71')]||0x1f4,'statusMessage':_0x5ca99a[_0x3b75('0x72')]||_0x3b75('0x73'),'headers':_0x5ca99a[_0x3b75('0x74')]['headers']||{},'body':_0x5ca99a[_0x3b75('0x74')][_0x3b75('0x6e')]||{}};_0x15a850(null,_0x2775d3);});};AGIVertices[_0x3b75('0x12')]['googleDialogflow']=function(_0x23a8ee,_0x5de054){scripts[_0x3b75('0x75')](this[_0x3b75('0xf')]['uniqueid'],_0x23a8ee[_0x3b75('0x76')],_0x23a8ee[_0x3b75('0x59')],_0x23a8ee[_0x3b75('0x77')]||'en')[_0x3b75('0x15')](function(_0x323ae2){_0x5de054(null,_0x323ae2);})['catch'](function(_0x535cc7){_0x5de054(_0x535cc7);});};AGIVertices['prototype'][_0x3b75('0x78')]=function(_0x3adb1b,_0x29b8fe){scripts[_0x3b75('0x78')](this[_0x3b75('0xf')],_0x3adb1b)[_0x3b75('0x15')](function(_0x55749f){_0x29b8fe(null,_0x55749f);})[_0x3b75('0x17')](function(_0x236340){_0x29b8fe(_0x236340);});};AGIVertices[_0x3b75('0x12')][_0x3b75('0x79')]=function(_0x5f228e,_0x3f36ea){scripts[_0x3b75('0x79')](_0x5f228e['key'],_0x5f228e[_0x3b75('0x59')],_0x5f228e[_0x3b75('0x7a')]||_0x3b75('0x7b'),_0x5f228e['speed'])[_0x3b75('0x15')](function(_0x30e187){_0x3f36ea(null,_0x30e187);})[_0x3b75('0x17')](function(_0x72dca5){_0x3f36ea(_0x72dca5);});};AGIVertices['prototype']['ispeechASR']=function(_0x27f290,_0x6e7e1e,_0x532ce5){scripts['ispeechASR'](_0x6e7e1e,_0x27f290['key'],_0x27f290['ispeech_asr_language']||_0x3b75('0x7b'),this[_0x3b75('0x7c')](_0x27f290[_0x3b75('0x7d')])?_0x27f290[_0x3b75('0x7d')]:undefined)[_0x3b75('0x15')](function(_0x2c8d8e){_0x532ce5(null,_0x2c8d8e);})[_0x3b75('0x17')](function(_0x5045af){_0x532ce5(_0x5045af);});};AGIVertices[_0x3b75('0x12')][_0x3b75('0x7e')]=function(_0x18b651,_0x7d2301){scripts['awsPolly'](_0x18b651[_0x3b75('0x7f')],_0x18b651['aws_secret_access_key'],_0x18b651[_0x3b75('0x80')],_0x18b651['aws_polly_voice']||_0x3b75('0x81'),_0x18b651[_0x3b75('0x59')],_0x18b651['aws_text_type']||'text')[_0x3b75('0x15')](function(_0x437aa7){_0x7d2301(null,_0x437aa7);})['catch'](function(_0x542ae4){_0x7d2301(_0x542ae4);});};AGIVertices['prototype'][_0x3b75('0x82')]=function(_0x48787d,_0x57706e){scripts[_0x3b75('0x82')](this['channel'][_0x3b75('0x3f')],_0x48787d[_0x3b75('0x7f')],_0x48787d[_0x3b75('0x83')],_0x48787d[_0x3b75('0x84')],_0x48787d[_0x3b75('0x59')],_0x48787d[_0x3b75('0x85')])[_0x3b75('0x15')](function(_0x2f9377){_0x57706e(null,_0x2f9377);})['catch'](function(_0x3f7b35){_0x57706e(_0x3f7b35);});};AGIVertices[_0x3b75('0x12')][_0x3b75('0x86')]=function(_0x2336a7,_0x20b51e,_0x39fe90){scripts[_0x3b75('0x86')](_0x20b51e,_0x2336a7[_0x3b75('0x76')],_0x2336a7[_0x3b75('0x87')]||_0x3b75('0x7b'))[_0x3b75('0x15')](function(_0xe54e7a){_0x39fe90(null,_0xe54e7a);})['catch'](function(_0x3822e0){_0x39fe90(_0x3822e0);});};AGIVertices[_0x3b75('0x12')]['tildeASR']=function(_0x1bf52,_0x39b5c4,_0x51ec11){scripts[_0x3b75('0x88')](_0x39b5c4,_0x1bf52[_0x3b75('0x89')],_0x1bf52['appsecret'],_0x1bf52[_0x3b75('0x6a')])[_0x3b75('0x15')](function(_0x5313c6){_0x51ec11(null,_0x5313c6);})[_0x3b75('0x17')](function(_0xfd6029){_0x51ec11(_0xfd6029);});};AGIVertices[_0x3b75('0x12')][_0x3b75('0x8a')]=function(_0x22f50b){var _0x238a42=_['includes'](verticesWithRetry,_0x22f50b['agicommand'])?_0x22f50b:_[_0x3b75('0x8b')](_0x22f50b);for(var _0x2dbf17 in _0x238a42){if(_0x238a42[_0x3b75('0x8c')](_0x2dbf17)){if(_0x238a42[_0x2dbf17]&&_[_0x3b75('0x8d')](_0x238a42[_0x2dbf17])){if(_['includes'](recursiveMapAttributes,_0x2dbf17)){_0x238a42[_0x2dbf17]=this[_0x3b75('0x8e')](_0x238a42[_0x2dbf17]);}else{_0x238a42[_0x2dbf17]=this[_0x3b75('0x8f')](_0x238a42[_0x2dbf17]);}}}}return _0x238a42;};AGIVertices[_0x3b75('0x12')]['recursiveNodeIndex']=function(_0x5ba52c){for(var _0xad8e6c in _0x5ba52c){if(_0x5ba52c[_0x3b75('0x8c')](_0xad8e6c)){if(_[_0x3b75('0x90')](_0x5ba52c[_0xad8e6c])){this['recursiveNodeIndex'](_0x5ba52c[_0xad8e6c]);}else if(_[_0x3b75('0x91')](_0x5ba52c[_0xad8e6c])){for(var _0x51c48c=0x0;_0x51c48c<_0x5ba52c[_0xad8e6c][_0x3b75('0x92')];_0x51c48c++){this['recursiveNodeIndex'](_0x5ba52c[_0xad8e6c][_0x51c48c]);}}else if(_[_0x3b75('0x8d')](_0x5ba52c[_0xad8e6c])){_0x5ba52c[_0xad8e6c]=this['replaceAllVariables'](_0x5ba52c[_0xad8e6c]);}}}};AGIVertices[_0x3b75('0x12')][_0x3b75('0x93')]=function(_0x34a7cf,_0xb445a){for(var _0x24e755 in _0x34a7cf){if(_0x34a7cf[_0x3b75('0x8c')](_0x24e755)){if(_['isPlainObject'](_0x34a7cf[_0x24e755])){if(!_[_0x3b75('0x44')](_0x34a7cf[_0x24e755])){this[_0x3b75('0x93')](_0x34a7cf[_0x24e755],util[_0x3b75('0x29')](_0x3b75('0x94'),_0xb445a,_0x24e755));}}else if(_[_0x3b75('0x91')](_0x34a7cf[_0x24e755])){for(var _0x1a3e0c=0x0;_0x1a3e0c<_0x34a7cf[_0x24e755]['length'];_0x1a3e0c++){this['saveRestApiResult'](_0x34a7cf[_0x24e755][_0x1a3e0c],util[_0x3b75('0x29')](_0x3b75('0x94'),_0xb445a,_0x24e755+'['+_0x1a3e0c+']'));}}else{if(!_[_0x3b75('0x41')](_0x34a7cf[_0x24e755])){this['channel']['setVariable'](util[_0x3b75('0x29')](_0x3b75('0x94'),_0xb445a,_0x24e755),_0x34a7cf[_0x24e755]);}}}}};AGIVertices[_0x3b75('0x12')][_0x3b75('0x8e')]=function(_0x4df137){try{var _0x2f2330=JSON[_0x3b75('0x66')](_0x4df137);this[_0x3b75('0x95')](_0x2f2330);return JSON[_0x3b75('0x6d')](_0x2f2330);}catch(_0x17aaca){return this['replaceAllVariables'](_0x4df137);}};AGIVertices[_0x3b75('0x12')]['replaceAllVariables']=function(_0x535551){var _0x4f70c9=_0x535551[_0x3b75('0x96')]('{');for(var _0x45cf90=0x1;_0x45cf90<_0x4f70c9[_0x3b75('0x92')];_0x45cf90+=0x1){var _0x1f76dc=_0x4f70c9[_0x45cf90]['split']('}');if(_0x1f76dc[_0x3b75('0x92')]>0x1){_0x535551=_0x535551[_0x3b75('0x97')]('{'+_0x1f76dc[0x0]+'}',this[_0x3b75('0xf')][_0x3b75('0x13')](_0x1f76dc[0x0])[_0x3b75('0x98')]||_0x1f76dc[0x0]);}}if(_0x4f70c9['length']===0x1){return _0x535551[_0x3b75('0x4a')]();}return this[_0x3b75('0x8f')](_0x535551);};AGIVertices['prototype']['getAndSetVariable']=function(_0x1d7a05,_0x21ce27){var _0xc8cec4=this['channel'][_0x3b75('0x13')](_0x1d7a05);if(_0xc8cec4[_0x3b75('0x99')]===-0x1){return _0xc8cec4;}logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x9a'),_0x21ce27,_0xc8cec4['extra']));return this[_0x3b75('0xf')]['setVariable'](_0x21ce27,_0xc8cec4['extra']);};AGIVertices[_0x3b75('0x12')][_0x3b75('0x7c')]=function(_0x3dd611){return _0x3dd611&&_0x3dd611!=='0'&&_0x3dd611!=='-1'&&_0x3dd611!=='';};AGIVertices[_0x3b75('0x12')][_0x3b75('0x9b')]=function(_0x5b6ef7){this[_0x3b75('0x34')][_0x3b75('0x69')](this,_0x5b6ef7,'-');_0x5b6ef7[_0x3b75('0x9c')]=_0x5b6ef7[_0x3b75('0x9b')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x5c0cf7){logger['info'](util[_0x3b75('0x29')](_0x3b75('0x9d'),_0x5c0cf7[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x5c0cf7[_0x3b75('0x59')])){return this[_0x3b75('0xf')]['noop'](_0x3b75('0x9e'));}var _0x4171e8='\x22'+_0x5c0cf7['text']+'\x22';if(this[_0x3b75('0x7c')](_0x5c0cf7['options'])){_0x4171e8+=','+_0x5c0cf7[_0x3b75('0x74')];}var _0x3944d7=this[_0x3b75('0xf')][_0x3b75('0x54')](_0x3b75('0x9f'),_0x4171e8);if(_0x3944d7[_0x3b75('0x99')]===-0x1){return _0x3944d7;}return this['channel'][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0xa1'),_0x4171e8));};AGIVertices[_0x3b75('0x12')][_0x3b75('0xa2')]=function(_0x15b2c3){logger[_0x3b75('0x2d')](util['format'](_0x3b75('0xa3'),_0x15b2c3[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x15b2c3[_0x3b75('0xa4')])){return this['channel'][_0x3b75('0xa0')](_0x3b75('0xa5'));}var _0x40b1a1=_0x15b2c3[_0x3b75('0xa4')];if(this[_0x3b75('0x7c')](_0x15b2c3[_0x3b75('0x74')])){_0x40b1a1+=','+_0x15b2c3[_0x3b75('0x74')];}var _0x9b0d88=this[_0x3b75('0xf')][_0x3b75('0x54')](_0x3b75('0xa6'),_0x40b1a1);if(_0x9b0d88['result']===-0x1){return _0x9b0d88;}var _0x55122f=this[_0x3b75('0xa7')](_0x3b75('0xa8'),_0x3b75('0xa9'));if(_0x55122f['result']===-0x1){return _0x55122f;}var _0x14aeda=this[_0x3b75('0xa7')](_0x3b75('0xaa'),_0x3b75('0xab'));if(_0x14aeda[_0x3b75('0x99')]===-0x1){return _0x14aeda;}var _0x4ce551=this['getAndSetVariable']('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x4ce551[_0x3b75('0x99')]===-0x1){return _0x4ce551;}return this[_0x3b75('0xf')][_0x3b75('0xa0')](util['format'](_0x3b75('0xac'),_0x40b1a1));};AGIVertices[_0x3b75('0x12')][_0x3b75('0xad')]=function(_0x12789a){logger[_0x3b75('0x2d')](util['format'](_0x3b75('0xae'),_0x12789a[_0x3b75('0x35')]));return this['channel'][_0x3b75('0xad')]([_0x12789a[_0x3b75('0xaf')],_0x12789a[_0x3b75('0xb0')]]);};AGIVertices[_0x3b75('0x12')][_0x3b75('0xb1')]=function(_0x43cd1b){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x43cd1b['label']));if(this['isConfigured'](_0x43cd1b[_0x3b75('0x61')])){logger[_0x3b75('0x2d')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x43cd1b[_0x3b75('0x61')]));var _0x362179=this[_0x3b75('0xf')][_0x3b75('0xb2')](_0x43cd1b['timeout']);if(_0x362179[_0x3b75('0x99')]===-0x1){return _0x362179;}}return this[_0x3b75('0xf')][_0x3b75('0xb1')]();};AGIVertices[_0x3b75('0x12')][_0x3b75('0xb3')]=function(_0x2ff396){logger[_0x3b75('0x2d')](util['format'](_0x3b75('0xb4'),_0x2ff396[_0x3b75('0x35')]));if(!this['isConfigured'](_0x2ff396['list_id'])){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x2ff396,_0x3b75('0xb5'));}_0x2ff396['scheduledAt']=moment();if(this['isConfigured'](_0x2ff396[_0x3b75('0xb6')])){_0x2ff396['scheduledAt']=moment()[_0x3b75('0xb7')](_0x2ff396[_0x3b75('0xb6')],_0x3b75('0xb8'));}if(!this[_0x3b75('0x7c')](_0x2ff396[_0x3b75('0x4b')])){_0x2ff396[_0x3b75('0x4b')]=0x2;}this[_0x3b75('0x40')][_0x3b75('0x69')](this,_0x2ff396);return this[_0x3b75('0xf')][_0x3b75('0xa0')](util['format'](_0x3b75('0xb9'),_0x2ff396[_0x3b75('0x46')],_0x2ff396[_0x3b75('0x47')],_0x2ff396[_0x3b75('0x48')]));};AGIVertices[_0x3b75('0x12')]['custom_app']=function(_0x12db29){logger[_0x3b75('0x2d')](util['format'](_0x3b75('0xba'),_0x12db29[_0x3b75('0x35')]));var _0x211394=this[_0x3b75('0xf')][_0x3b75('0x54')](_0x12db29[_0x3b75('0xbb')],_0x12db29[_0x3b75('0x74')]);if(_0x211394['result']===-0x1){return _0x211394;}return this[_0x3b75('0xf')][_0x3b75('0xa0')](util['format'](_0x3b75('0xbc'),_0x12db29['application'],_0x12db29['options']));};AGIVertices[_0x3b75('0x12')][_0x3b75('0xbd')]=function(_0x57e078){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0xbe'),_0x57e078[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x57e078[_0x3b75('0x59')])){return this[_0x3b75('0xf')][_0x3b75('0xa0')]('no\x20text\x20configured');}var _0x4d227e='\x22'+_0x57e078[_0x3b75('0x59')]+'\x22';if(this[_0x3b75('0x7c')](_0x57e078[_0x3b75('0x74')])){_0x4d227e+=','+_0x57e078[_0x3b75('0x74')];}var _0x275d46=this[_0x3b75('0xf')]['exec'](_0x3b75('0x9f'),_0x4d227e);if(_0x275d46[_0x3b75('0x99')]===-0x1){return _0x275d46;}return this['channel'][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0xa1'),_0x4d227e));};AGIVertices['prototype'][_0x3b75('0xbf')]=function(_0x251662){logger[_0x3b75('0x2d')](util['format'](_0x3b75('0xc0'),_0x251662[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x251662[_0x3b75('0x59')])){return this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x3b75('0x9e'));}var _0x4a57bf='\x22'+_0x251662[_0x3b75('0x59')]+'\x22';if(this[_0x3b75('0x7c')](_0x251662[_0x3b75('0x74')])){_0x4a57bf+=','+_0x251662['options'];}var _0x5059f2=this[_0x3b75('0xf')][_0x3b75('0x54')](_0x3b75('0x9f'),_0x4a57bf);if(_0x5059f2['result']===-0x1){return _0x5059f2;}return this['channel']['noop'](util[_0x3b75('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4a57bf));};AGIVertices[_0x3b75('0x12')]['lumenvoxasr']=function(_0x399ffe){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0xc1'),_0x399ffe[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x399ffe[_0x3b75('0xa4')])){return this['channel'][_0x3b75('0xa0')]('no\x20grammar\x20configured');}var _0x50c563=_0x399ffe['grammar'];if(this[_0x3b75('0x7c')](_0x399ffe['options'])){_0x50c563+=','+_0x399ffe['options'];}var _0xba3169=this[_0x3b75('0xf')][_0x3b75('0x54')]('MRCPRecog',_0x50c563);if(_0xba3169[_0x3b75('0x99')]===-0x1){return _0xba3169;}var _0x4e6866=this[_0x3b75('0xa7')](_0x3b75('0xa8'),'LUMENVOX_ASR_CONFIDENCE');if(_0x4e6866[_0x3b75('0x99')]===-0x1){return _0x4e6866;}var _0x45d317=this[_0x3b75('0xa7')]('RECOG_INPUT()',_0x3b75('0xc2'));if(_0x45d317[_0x3b75('0x99')]===-0x1){return _0x45d317;}var _0x4b2235=this['getAndSetVariable'](_0x3b75('0xc3'),_0x3b75('0xc4'));if(_0x4b2235[_0x3b75('0x99')]===-0x1){return _0x4b2235;}return this['channel'][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0xac'),_0x50c563));};AGIVertices['prototype'][_0x3b75('0xc5')]=function(_0x40a97f){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0xc6'),_0x40a97f[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x40a97f[_0x3b75('0xa4')])){return this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x3b75('0xa5'));}var _0x3f799b=_0x40a97f[_0x3b75('0xa4')];if(this[_0x3b75('0x7c')](_0x40a97f[_0x3b75('0x74')])){_0x3f799b+=','+_0x40a97f[_0x3b75('0x74')];}var _0x30f446=this[_0x3b75('0xf')][_0x3b75('0x54')](_0x3b75('0xa6'),_0x3f799b);if(_0x30f446[_0x3b75('0x99')]===-0x1){return _0x30f446;}var _0x555a2d=this[_0x3b75('0xa7')]('RECOG_CONFIDENCE()',_0x3b75('0xc7'));if(_0x555a2d['result']===-0x1){return _0x555a2d;}var _0x35c59e=this[_0x3b75('0xa7')]('RECOG_INPUT()',_0x3b75('0xc8'));if(_0x35c59e[_0x3b75('0x99')]===-0x1){return _0x35c59e;}var _0x384b71=this[_0x3b75('0xa7')](_0x3b75('0xc3'),_0x3b75('0xc9'));if(_0x384b71[_0x3b75('0x99')]===-0x1){return _0x384b71;}return this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3f799b));};AGIVertices[_0x3b75('0x12')][_0x3b75('0xca')]=function(_0x22d72b){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x22d72b[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x22d72b['odbc_id'])){return this['channel']['error'](_0x22d72b,_0x3b75('0xcb'));}var _0x431f1a=this[_0x3b75('0x1b')][_0x3b75('0x69')](this,_0x22d72b[_0x3b75('0xcc')]);if(!_0x431f1a){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x22d72b,_0x3b75('0xcd'));}if(!this[_0x3b75('0x7c')](_0x22d72b['query'])){return this['channel'][_0x3b75('0x2b')](_0x22d72b,_0x3b75('0xce'));}var _0x236c93=_0x22d72b[_0x3b75('0xcf')][_0x3b75('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0xd0'),_0x236c93));var _0x35cdbe=this[_0x3b75('0xd1')][_0x3b75('0x69')](this,_0x431f1a,_0x236c93);this[_0x3b75('0x34')][_0x3b75('0x69')](this,_0x22d72b,_0x236c93);if(!this[_0x3b75('0x7c')](_0x22d72b['variable_id'])){return this[_0x3b75('0xf')]['noop'](_0x3b75('0xd2'));}var _0x2faa77=this[_0x3b75('0x13')][_0x3b75('0x69')](this,_0x22d72b[_0x3b75('0xd3')]);if(!_0x2faa77){return this[_0x3b75('0xf')]['error'](_0x22d72b,'no\x20variable\x20found');}var _0x4f79c9=this;_0x35cdbe[_0x3b75('0xd4')](function(_0x256cff,_0x50b190){Object[_0x3b75('0xd5')](_0x256cff)['forEach'](function(_0x10e572){_0x4f79c9['channel']['setVariable'](util['format'](_0x3b75('0xd6'),_0x2faa77,_0x50b190,_0x10e572),_0x256cff[_0x10e572]);});});this['channel'][_0x3b75('0xd7')](util['format'](_0x3b75('0xd8'),_0x2faa77),_0x35cdbe[_0x3b75('0x92')]);return this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0xd9'),_0x2faa77));};AGIVertices[_0x3b75('0x12')][_0x3b75('0xda')]=function(_0x525216){logger[_0x3b75('0xdb')](util[_0x3b75('0x29')](_0x3b75('0xdc'),_0x525216[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x525216['sip_id'])){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x525216,_0x3b75('0xdd'));}var _0x58b661=this[_0x3b75('0xde')][_0x3b75('0x69')](this,_0x525216[_0x3b75('0xdf')]);if(!_0x58b661){return this['channel'][_0x3b75('0x2b')](_0x525216,_0x3b75('0xe0'));}var _0x361a4c=this[_0x3b75('0xf')][_0x3b75('0x54')](_0x3b75('0xe1'),[util[_0x3b75('0x29')]('SIP/%s',_0x58b661),_0x525216[_0x3b75('0x61')],_0x525216[_0x3b75('0xe2')],_0x525216[_0x3b75('0x5f')]]);if(_0x361a4c[_0x3b75('0x99')]===-0x1){return _0x361a4c;}return this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0xe3'),_0x3b75('0xe1')));};AGIVertices[_0x3b75('0x12')][_0x3b75('0xe4')]=function(_0x27a65c){logger['info'](util[_0x3b75('0x29')](_0x3b75('0xe5'),_0x27a65c['label']));if(!this[_0x3b75('0x7c')](_0x27a65c[_0x3b75('0x76')])){return this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x3b75('0xe6'));}if(!this['isConfigured'](_0x27a65c[_0x3b75('0x59')])){return this[_0x3b75('0xf')][_0x3b75('0xa0')]('no\x20text\x20configured');}this['channel'][_0x3b75('0xe7')]=!![];this[_0x3b75('0x34')](_0x27a65c);this['createSquareMessage'](_0x27a65c[_0x3b75('0x59')],'in');this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0xe8'),_0x27a65c[_0x3b75('0x59')]));var _0x535fb8=this[_0x3b75('0x75')]['sync'](this,_0x27a65c);if(_0x535fb8){for(var _0x35a4f5 in _0x535fb8){if(_0x535fb8[_0x3b75('0x8c')](_0x35a4f5)){this[_0x3b75('0xf')][_0x3b75('0xd7')](util[_0x3b75('0x29')](_0x3b75('0xe9'),_0x35a4f5[_0x3b75('0xea')]()),_0x535fb8[_0x35a4f5]);}}this[_0x3b75('0x3e')](_0x535fb8['speech'],_0x3b75('0xeb'));return this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0xec'),_0x535fb8[_0x3b75('0xed')]));}return this['channel'][_0x3b75('0x2b')](_0x27a65c,_0x3b75('0xee'));};AGIVertices[_0x3b75('0x12')][_0x3b75('0xef')]=function(_0x26a076){logger[_0x3b75('0x2d')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x26a076[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x26a076['ndauth_url'])){return this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x3b75('0xf0'));}if(!this[_0x3b75('0x7c')](_0x26a076[_0x3b75('0xf1')])){return this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x3b75('0xf2'));}if(!this[_0x3b75('0x7c')](_0x26a076[_0x3b75('0xf3')])){return this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x3b75('0xf4'));}if(!this['isConfigured'](_0x26a076[_0x3b75('0xf5')])){return this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x3b75('0x9e'));}this['channel'][_0x3b75('0xe7')]=!![];this[_0x3b75('0x34')](_0x26a076);this['createSquareMessage'](_0x26a076['text'],'in');this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0xf6'),_0x26a076[_0x3b75('0x59')]));var _0x249610=this[_0x3b75('0x78')][_0x3b75('0x69')](this,_0x26a076);if(_0x249610){for(var _0x5bfa4b in _0x249610){if(_0x249610[_0x3b75('0x8c')](_0x5bfa4b)){this[_0x3b75('0xf')][_0x3b75('0xd7')](util['format'](_0x3b75('0xf7'),_0x5bfa4b['toUpperCase']()),_0x249610[_0x5bfa4b]);}}this[_0x3b75('0x3e')](_0x249610[_0x3b75('0xed')],_0x3b75('0xeb'));if(_0x249610['audiofile']){this['channel'][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0xf8'),_0x249610['audiofile']));var _0x3cac2d=this['channel'][_0x3b75('0xf9')](_0x249610['audiofile']);try{fs[_0x3b75('0xfa')](_0x249610[_0x3b75('0xfb')]+_0x3b75('0xfc'));}catch(_0x224300){logger[_0x3b75('0x2b')](_0x224300);}return _0x3cac2d;}else{return this['channel'][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0xfd'),_0x249610[_0x3b75('0xed')]));}}return this[_0x3b75('0xf')]['error'](_0x26a076,_0x3b75('0xfe'));};AGIVertices[_0x3b75('0x12')][_0x3b75('0xff')]=function(_0x57afde){logger['info'](util[_0x3b75('0x29')]('Enter\x20in\x20END\x20(%s)\x20block',_0x57afde[_0x3b75('0x35')]));return this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x3b75('0xff'));};AGIVertices[_0x3b75('0x12')][_0x3b75('0x100')]=function(_0x20fc69){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x20fc69['label']));var _0x2047f2='';if(_0x20fc69[_0x3b75('0x101')]){if(!this[_0x3b75('0x7c')](_0x20fc69[_0x3b75('0x101')])){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x20fc69,'no\x20trunk\x20selected');}else{var _0x2f0d7d=parseInt(_0x20fc69[_0x3b75('0x101')],0xa);if(isNaN(_0x2f0d7d)){_0x2047f2=_0x20fc69[_0x3b75('0x101')];}else{_0x2047f2=this[_0x3b75('0x1e')][_0x3b75('0x69')](this,_0x20fc69[_0x3b75('0x101')]);if(!_0x2047f2){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x20fc69,_0x3b75('0x102'));}}}}else if(_0x20fc69['trunk_name']){_0x2047f2=_0x20fc69[_0x3b75('0x103')];}else{return this[_0x3b75('0xf')]['error'](_0x20fc69,_0x3b75('0x104'));}var _0x1dfe61=this[_0x3b75('0xf')][_0x3b75('0x54')](_0x3b75('0xe1'),[util['format'](_0x3b75('0x105'),_0x2047f2,_0x20fc69[_0x3b75('0x46')]),_0x20fc69[_0x3b75('0x61')],_0x20fc69[_0x3b75('0xe2')],_0x20fc69[_0x3b75('0x5f')]]);if(_0x1dfe61['result']===-0x1){return _0x1dfe61;}return this[_0x3b75('0xf')][_0x3b75('0xa0')](util['format'](_0x3b75('0xe3'),_0x3b75('0xe1')));};AGIVertices['prototype']['finally']=function(_0x3a2fad){logger['info'](util['format'](_0x3b75('0x106'),_0x3a2fad[_0x3b75('0x35')]));return this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x3b75('0x107'));};AGIVertices[_0x3b75('0x12')]['getdigits']=function(_0x1b393a){logger['info'](util[_0x3b75('0x29')](_0x3b75('0x108'),_0x1b393a['label']));if(_0x1b393a[_0x3b75('0x9c')]===0x0){return this[_0x3b75('0x9b')](_0x1b393a);}_0x1b393a[_0x3b75('0x9c')]-=0x1;if(!this['isConfigured'](_0x1b393a[_0x3b75('0x109')])){return this[_0x3b75('0xf')]['error'](_0x1b393a,_0x3b75('0x10a'));}var _0x131199=this[_0x3b75('0x20')][_0x3b75('0x69')](this,_0x1b393a['file_id']);if(!_0x131199){return this['channel']['error'](_0x1b393a,_0x3b75('0x10b'));}if(!this[_0x3b75('0x7c')](_0x1b393a[_0x3b75('0xd3')])){return this[_0x3b75('0xf')]['error'](_0x3b75('0xd2'));}var _0x432d3f=this[_0x3b75('0xf')][_0x3b75('0x10c')](_0x131199,_0x1b393a[_0x3b75('0x10d')],_0x1b393a[_0x3b75('0x10e')]);var _0x2de1fd=_0x432d3f[_0x3b75('0x99')]?_0x432d3f['result'][_0x3b75('0x4a')]():'';logger[_0x3b75('0x2d')]('test',JSON[_0x3b75('0x6d')](_0x432d3f));if(_0x432d3f['result']===-0x1){this[_0x3b75('0x34')][_0x3b75('0x69')](this,_0x1b393a,_0x2de1fd);return _0x432d3f;}else if(_0x432d3f[_0x3b75('0x98')]===_0x3b75('0x61')){_0x432d3f['result']=_0x2de1fd[_0x3b75('0x92')]>=parseInt(_0x1b393a[_0x3b75('0x10f')])?'x':'i';}else{_0x432d3f[_0x3b75('0x99')]=_0x2de1fd['length']>=parseInt(_0x1b393a[_0x3b75('0x10f')])&&_0x2de1fd[_0x3b75('0x92')]<=parseInt(_0x1b393a['maxdigit'])?'x':'i';}var _0x1e7125=this[_0x3b75('0x13')][_0x3b75('0x69')](this,_0x1b393a['variable_id']);if(!_0x1e7125){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x1b393a,_0x3b75('0x110'));}this[_0x3b75('0xf')][_0x3b75('0xd7')](_0x1e7125,_0x2de1fd);if(this[_0x3b75('0x7c')](_0x1b393a['hiddendigitsnum'])){var _0x1e0bde=parseInt(_0x1b393a['hiddendigitsnum'],0xa);var _0xe8ee45=rs['generate']({'charset':'*','length':_0x1e0bde});var _0x12de7d=_0x2de1fd[_0x3b75('0x92')];if(_0x12de7d>0x0){if(_0x12de7d>_0x1e0bde){this[_0x3b75('0x34')][_0x3b75('0x69')](this,_0x1b393a,_0x1b393a['hiddendigitspos']===_0x3b75('0x111')?_0xe8ee45+_0x2de1fd[_0x3b75('0x112')](_0x1e0bde):_0x2de1fd[_0x3b75('0x112')](0x0,_0x12de7d-_0x1e0bde)+_0xe8ee45);}else{this[_0x3b75('0x34')][_0x3b75('0x69')](this,_0x1b393a,rs[_0x3b75('0x113')]({'charset':'*','length':_0x12de7d}));}}else{this[_0x3b75('0x34')][_0x3b75('0x69')](this,_0x1b393a,'');}}else{this[_0x3b75('0x34')][_0x3b75('0x69')](this,_0x1b393a,_0x2de1fd);}return _0x432d3f;};AGIVertices['prototype']['getsecretdigits']=function(_0x2fc911){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x114'),_0x2fc911['label']));return this[_0x3b75('0xd')](_0x2fc911);};AGIVertices[_0x3b75('0x12')][_0x3b75('0x115')]=function(_0x40fe00){logger[_0x3b75('0x2d')](util['format'](_0x3b75('0x116'),_0x40fe00[_0x3b75('0x35')]));this[_0x3b75('0x34')][_0x3b75('0x69')](this,_0x40fe00,_0x40fe00[_0x3b75('0x117')]);return this['channel'][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x118'),_0x40fe00[_0x3b75('0x117')]));};AGIVertices[_0x3b75('0x12')]['awspolly']=function(_0x44ae93){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x119'),_0x44ae93[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x44ae93[_0x3b75('0x7f')])||!this['isConfigured'](_0x44ae93[_0x3b75('0x83')])){return this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x3b75('0x11a'));}if(!this[_0x3b75('0x7c')](_0x44ae93[_0x3b75('0x59')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x3b75('0xf')][_0x3b75('0xa0')](util['format'](_0x3b75('0x11b'),_0x44ae93['text']));var _0x5b1a7a=this[_0x3b75('0x7e')][_0x3b75('0x69')](this,_0x44ae93);if(_0x5b1a7a){this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')]('aws\x20Polly\x20%s\x20file\x20created',_0x5b1a7a));var _0x5c7c67=this[_0x3b75('0xf')][_0x3b75('0xf9')](_0x5b1a7a);try{fs[_0x3b75('0xfa')](_0x5b1a7a+'.wav');}catch(_0x9b85b5){logger[_0x3b75('0x2b')](_0x9b85b5);}return _0x5c7c67;}return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x44ae93,_0x3b75('0x11c'));};AGIVertices[_0x3b75('0x12')][_0x3b75('0x11d')]=function(_0x2a3fe7){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x11e'),_0x2a3fe7[_0x3b75('0x35')]));if(!this['isConfigured'](_0x2a3fe7[_0x3b75('0x7f')])||!this['isConfigured'](_0x2a3fe7[_0x3b75('0x83')])){return this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x3b75('0x11a'));}if(!this[_0x3b75('0x7c')](_0x2a3fe7[_0x3b75('0x85')])){return this[_0x3b75('0xf')]['noop'](_0x3b75('0x11f'));}if(!this['isConfigured'](_0x2a3fe7[_0x3b75('0x59')])){return this[_0x3b75('0xf')]['noop'](_0x3b75('0x9e'));}this[_0x3b75('0xf')][_0x3b75('0xe7')]=!![];this['createSquareDetailsReport'](_0x2a3fe7);this[_0x3b75('0x3e')](_0x2a3fe7[_0x3b75('0x59')],'in');this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x120'),_0x2a3fe7[_0x3b75('0x59')]));var _0xda317=this['awsLex']['sync'](this,_0x2a3fe7);if(_0xda317){for(var _0x148504 in _0xda317){if(_0xda317[_0x3b75('0x8c')](_0x148504)&&_[_0x3b75('0x8d')](_0xda317[_0x148504])){this['channel'][_0x3b75('0xd7')](util[_0x3b75('0x29')](_0x3b75('0x121'),_0x148504['toUpperCase']()),_0xda317[_0x148504]);}}if(_[_0x3b75('0x41')](_0xda317[_0x3b75('0x72')])){return this['channel'][_0x3b75('0xa0')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x3b75('0x3e')](_0xda317[_0x3b75('0x72')],_0x3b75('0xeb'));return this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')]('Amazon\x20Lex\x20Result\x20%s',_0xda317[_0x3b75('0x72')]));}}return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x2a3fe7,_0x3b75('0x122'));};AGIVertices[_0x3b75('0x12')][_0x3b75('0x123')]=function(_0x55531a){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x124'),_0x55531a[_0x3b75('0x35')],_0x55531a[_0x3b75('0x61')]));if(!this['isConfigured'](_0x55531a[_0x3b75('0x76')])){return this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x3b75('0xe6'));}var _0x1dd274=_0x3b75('0x125');var _0x191ed0=util[_0x3b75('0x29')](_0x3b75('0x126'),FILES_PATH,rs[_0x3b75('0x113')](0x4));var _0x11f32b=util['format'](_0x3b75('0x94'),_0x191ed0,_0x1dd274);var _0x3c4cf3=!![];if(_0x55531a[_0x3b75('0x127')]==='NOBEEP'){_0x3c4cf3=![];}var _0x4c636f=this[_0x3b75('0xf')][_0x3b75('0x128')](_0x191ed0,_0x1dd274,_0x55531a['intKey'],_0x55531a[_0x3b75('0x61')],undefined,_0x3c4cf3);if(_0x4c636f[_0x3b75('0x99')]!==-0x1){this[_0x3b75('0xf')]['noop'](util[_0x3b75('0x29')](_0x3b75('0x129'),_0x11f32b));var _0x569291=this[_0x3b75('0x86')][_0x3b75('0x69')](this,_0x55531a,_0x11f32b);if(_0x569291){for(var _0xc04f69 in _0x569291){if(_0x569291[_0x3b75('0x8c')](_0xc04f69)){this[_0x3b75('0xf')][_0x3b75('0xd7')](util['format']('GOOGLE_ASR_%s',_0xc04f69[_0x3b75('0xea')]()),_0x569291[_0xc04f69]);}}return this['channel']['noop'](util[_0x3b75('0x29')](_0x3b75('0x12a'),JSON[_0x3b75('0x6d')](_0x569291)));}}return _0x4c636f;};AGIVertices[_0x3b75('0x12')][_0x3b75('0x12b')]=function(_0x493653){logger['info'](util[_0x3b75('0x29')](_0x3b75('0x12c'),_0x493653[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x493653[_0x3b75('0x89')])){return this[_0x3b75('0xf')]['noop']('no\x20appid\x20configured');}if(!this['isConfigured'](_0x493653[_0x3b75('0x12d')])){return this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x3b75('0x12e'));}var _0x560a12=_0x3b75('0x125');var _0x34d46e=util[_0x3b75('0x29')](_0x3b75('0x126'),FILES_PATH,rs[_0x3b75('0x113')](0x4));var _0x4702ae=util[_0x3b75('0x29')](_0x3b75('0x94'),_0x34d46e,_0x560a12);var _0x1a0d9f=!![];if(_0x493653['beep']===_0x3b75('0x12f')){_0x1a0d9f=![];}var _0x2c51d2=this['channel'][_0x3b75('0x128')](_0x34d46e,_0x560a12,_0x493653[_0x3b75('0x130')],_0x493653[_0x3b75('0x61')],undefined,_0x1a0d9f);if(_0x2c51d2['result']!==-0x1){this['channel']['noop'](util['format'](_0x3b75('0x131'),_0x4702ae));var _0x19973c=this[_0x3b75('0x88')]['sync'](this,_0x493653,_0x4702ae);if(_0x19973c){for(var _0x2f83ac in _0x19973c){if(_0x19973c[_0x3b75('0x8c')](_0x2f83ac)){this[_0x3b75('0xf')][_0x3b75('0xd7')](util['format'](_0x3b75('0x132'),_0x2f83ac['toUpperCase']()),_0x19973c[_0x2f83ac]);}}return this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x133'),JSON[_0x3b75('0x6d')](_0x19973c)));}}return _0x2c51d2;};AGIVertices['prototype'][_0x3b75('0x134')]=function(_0x4aa67b){logger['info'](util[_0x3b75('0x29')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4aa67b[_0x3b75('0x35')]));return this[_0x3b75('0xf')]['continueAt'](_0x4aa67b[_0x3b75('0x38')],_0x4aa67b['extension'],_0x4aa67b[_0x3b75('0x3a')]);};AGIVertices[_0x3b75('0x12')][_0x3b75('0x135')]=function(_0x44360f){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x136'),_0x44360f[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x44360f[_0x3b75('0x137')])){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x44360f,_0x3b75('0x138'));}try{var _0x12b31d=eval(_0x44360f[_0x3b75('0x137')])?'true':_0x3b75('0x139');this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')]('EVAL\x20CONDITION\x20%s\x20%s',_0x44360f[_0x3b75('0x137')],_0x12b31d));return{'code':0xc8,'result':_0x12b31d};}catch(_0x21d623){return{'code':0xc8,'result':_0x3b75('0x139')};}};AGIVertices[_0x3b75('0x12')][_0x3b75('0x13a')]=function(_0x4f1f04){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x13b'),_0x4f1f04[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x4f1f04['interval_id'])){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x4f1f04,_0x3b75('0x13c'));}var _0x2f10d0=this['getIntervals'][_0x3b75('0x69')](this,_0x4f1f04[_0x3b75('0x13d')]);if(!_0x2f10d0){return this['channel'][_0x3b75('0x2b')](_0x4f1f04,'no\x20intervals\x20found');}for(var _0x4c0b9e=0x0;_0x4c0b9e<_0x2f10d0[_0x3b75('0x92')];_0x4c0b9e+=0x1){var _0x31c25f=this[_0x3b75('0xf')][_0x3b75('0x13')](util[_0x3b75('0x29')](_0x3b75('0x13e'),_0x2f10d0[_0x4c0b9e]));if(_0x31c25f[_0x3b75('0x99')]===-0x1){return _0x31c25f;}logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x13f'),_0x2f10d0[_0x4c0b9e],_0x31c25f[_0x3b75('0x98')]));if(_0x31c25f[_0x3b75('0x98')]===_0x3b75('0x140')){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')]('IFTIME\x20%s\x20%s',_0x2f10d0[_0x4c0b9e],_0x3b75('0x140')));this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x13f'),_0x2f10d0[_0x4c0b9e],_0x3b75('0x140')));return{'code':0xc8,'result':'true'};}else{logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x13f'),_0x2f10d0[_0x4c0b9e],_0x3b75('0x139')));this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x13f'),_0x2f10d0[_0x4c0b9e],_0x3b75('0x139')));}}return{'code':0xc8,'result':_0x3b75('0x139')};};AGIVertices[_0x3b75('0x12')]['hangup']=function(_0x2bc548){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x141'),_0x2bc548[_0x3b75('0x35')]));return this[_0x3b75('0xf')][_0x3b75('0x142')]();};AGIVertices[_0x3b75('0x12')][_0x3b75('0x143')]=function(_0xf371c2){logger['info'](util[_0x3b75('0x29')](_0x3b75('0x144'),_0xf371c2['label']));if(!this[_0x3b75('0x7c')](_0xf371c2[_0x3b75('0x76')])){return this[_0x3b75('0xf')][_0x3b75('0xa0')]('no\x20key\x20configured');}var _0x4cd408=_0x3b75('0x125');var _0x108d61=util['format'](_0x3b75('0x126'),FILES_PATH,rs[_0x3b75('0x113')](0x4));var _0x4397e4=util[_0x3b75('0x29')]('%s.%s',_0x108d61,_0x4cd408);var _0x20b2e8=!![];if(_0xf371c2[_0x3b75('0x127')]==='NOBEEP'){_0x20b2e8=![];}var _0x5150a5=this[_0x3b75('0xf')][_0x3b75('0x128')](_0x108d61,_0x4cd408,_0xf371c2[_0x3b75('0x130')],_0xf371c2[_0x3b75('0x61')],undefined,_0x20b2e8);if(_0x5150a5[_0x3b75('0x99')]!==-0x1){this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')]('ispeech\x20%s\x20file\x20created',_0x4397e4));var _0x29a71a=this[_0x3b75('0x145')]['sync'](this,_0xf371c2,_0x4397e4);if(_0x29a71a){for(var _0x457c37 in _0x29a71a){if(_0x29a71a['hasOwnProperty'](_0x457c37)){this[_0x3b75('0xf')][_0x3b75('0xd7')](util['format'](_0x3b75('0x146'),_0x457c37['toUpperCase']()),_0x29a71a[_0x457c37]);}}return this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x147'),JSON[_0x3b75('0x6d')](_0x29a71a)));}}return _0x5150a5;};AGIVertices[_0x3b75('0x12')]['ispeechtts']=function(_0x18365e){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x148'),_0x18365e['label']));if(!this['isConfigured'](_0x18365e['key'])){return this['channel'][_0x3b75('0xa0')](_0x3b75('0xe6'));}if(!this[_0x3b75('0x7c')](_0x18365e['text'])){return this[_0x3b75('0xf')]['noop'](_0x3b75('0x9e'));}this['channel'][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x149'),_0x18365e[_0x3b75('0x59')]));var _0x77ddaf=this[_0x3b75('0x79')][_0x3b75('0x69')](this,_0x18365e);if(_0x77ddaf){this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')]('ispeech\x20%s\x20file\x20created',_0x77ddaf));var _0x236dbb=this[_0x3b75('0xf')][_0x3b75('0xf9')](_0x77ddaf,_0x18365e['intKey']);try{fs['unlink'](_0x77ddaf+_0x3b75('0xfc'));}catch(_0x338bb7){logger['error'](_0x338bb7);}return _0x236dbb;}return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x18365e,_0x3b75('0x14a'));};AGIVertices[_0x3b75('0x12')][_0x3b75('0x14b')]=function(_0x51bb9d){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x14c'),_0x51bb9d[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x51bb9d[_0x3b75('0x14d')])){return this['channel'][_0x3b75('0x2b')](_0x51bb9d,_0x3b75('0x14e'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3b75('0xf')][_0x3b75('0x36')],_0x51bb9d['findBy']));var _0x2e25f4=this[_0x3b75('0x51')][_0x3b75('0x69')](this,_0x51bb9d['findBy']);if(_0x2e25f4){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x14f'),this[_0x3b75('0xf')][_0x3b75('0x36')],_0x51bb9d[_0x3b75('0x14d')]));this['channel'][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x14f'),this['channel'][_0x3b75('0x36')],_0x51bb9d[_0x3b75('0x14d')]));return{'code':0xc8,'result':'success'};}else{logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x150'),this[_0x3b75('0xf')][_0x3b75('0x36')],_0x51bb9d[_0x3b75('0x14d')]));this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x150'),this[_0x3b75('0xf')][_0x3b75('0x36')],_0x51bb9d['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x3b75('0x12')][_0x3b75('0x151')]=function(_0x22a77e){logger['info'](util[_0x3b75('0x29')](_0x3b75('0x152'),_0x22a77e[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x22a77e[_0x3b75('0x14d')])){return this['channel'][_0x3b75('0x2b')](_0x22a77e,_0x3b75('0x14e'));}logger['info'](util[_0x3b75('0x29')](_0x3b75('0x153'),this['channel']['callerid'],_0x22a77e[_0x3b75('0x14d')]));var _0x3451d5=this[_0x3b75('0x154')]['sync'](this,_0x22a77e['findBy']);if(_0x3451d5){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x14f'),this[_0x3b75('0xf')][_0x3b75('0x36')],_0x22a77e[_0x3b75('0x14d')]));this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3b75('0xf')][_0x3b75('0x36')],_0x22a77e[_0x3b75('0x14d')]));return{'code':0xc8,'result':_0x3b75('0x155')};}else{logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x150'),this['channel'][_0x3b75('0x36')],_0x22a77e[_0x3b75('0x14d')]));this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x150'),this[_0x3b75('0xf')][_0x3b75('0x36')],_0x22a77e[_0x3b75('0x14d')]));return{'code':0xc8,'result':_0x3b75('0x156')};}};AGIVertices['prototype']['math']=function(_0x141ee0){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x141ee0[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x141ee0[_0x3b75('0x157')])){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x141ee0,_0x3b75('0x158'));}this['channel'][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x159'),_0x141ee0[_0x3b75('0x157')]));var _0x1ffdd3=eval(_0x141ee0[_0x3b75('0x157')]);if(!this['isConfigured'](_0x141ee0[_0x3b75('0xd3')])){return this[_0x3b75('0xf')][_0x3b75('0xa0')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x9294cc=this[_0x3b75('0x13')][_0x3b75('0x69')](this,_0x141ee0[_0x3b75('0xd3')]);if(!_0x9294cc){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x141ee0,_0x3b75('0x110'));}if(_[_0x3b75('0x91')](_0x1ffdd3)){var _0x3e185e=this;_0x1ffdd3[_0x3b75('0xd4')](function(_0xb170c6,_0xa5295b){_0x3e185e[_0x3b75('0xf')][_0x3b75('0xd7')](util[_0x3b75('0x29')](_0x3b75('0x15a'),_0x9294cc,_0xa5295b),_0xb170c6);});return this['channel']['noop'](util[_0x3b75('0x29')](_0x3b75('0x15b'),_0x9294cc));}else{return this[_0x3b75('0xf')][_0x3b75('0xd7')](_0x9294cc,_0x1ffdd3);}};AGIVertices[_0x3b75('0x12')][_0x3b75('0xc')]=function(_0x5b8eb5){logger['info'](util[_0x3b75('0x29')](_0x3b75('0x15c'),_0x5b8eb5[_0x3b75('0x35')]));if(_0x5b8eb5[_0x3b75('0x9c')]===0x0){return this['maxRetry'](_0x5b8eb5);}_0x5b8eb5[_0x3b75('0x9c')]-=0x1;if(!this[_0x3b75('0x7c')](_0x5b8eb5[_0x3b75('0x109')])){return this['channel']['error'](_0x5b8eb5,_0x3b75('0x10a'));}var _0x5c18db=this[_0x3b75('0x20')][_0x3b75('0x69')](this,_0x5b8eb5[_0x3b75('0x109')]);if(!_0x5c18db){return this[_0x3b75('0xf')]['error'](_0x5b8eb5,_0x3b75('0x10b'));}var _0x51157b=this[_0x3b75('0xf')]['getData'](_0x5c18db,_0x5b8eb5[_0x3b75('0x10d')],_0x5b8eb5[_0x3b75('0x15d')]);var _0xbe705c=_0x51157b['result'];if(_0x51157b['result']===-0x1){this['createSquareDetailsReport']['sync'](this,_0x5b8eb5,'-1');return _0x51157b;}else if(_0x51157b['extra']==='timeout'){_0x51157b['result']=_0x51157b[_0x3b75('0x99')][_0x3b75('0x92')]>0x0?_0x51157b[_0x3b75('0x99')]:'t';}else if(_['isEmpty'](_0x51157b[_0x3b75('0x99')])){_0x51157b[_0x3b75('0x99')]='#';_0xbe705c='#';}if(!this['isConfigured'](_0x5b8eb5[_0x3b75('0xd3')])){this[_0x3b75('0xf')][_0x3b75('0xa0')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x2e297d=this[_0x3b75('0x13')][_0x3b75('0x69')](this,_0x5b8eb5[_0x3b75('0xd3')]);if(!_0x2e297d){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x5b8eb5,_0x3b75('0x110'));}this[_0x3b75('0xf')][_0x3b75('0xd7')](_0x2e297d,_0xbe705c);}this[_0x3b75('0x34')][_0x3b75('0x69')](this,_0x5b8eb5,_0xbe705c);return _0x51157b;};AGIVertices['prototype'][_0x3b75('0xa0')]=function(_0x135bc2){logger['info'](util[_0x3b75('0x29')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x135bc2[_0x3b75('0x35')]));return this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x135bc2[_0x3b75('0x15e')]||_0x135bc2[_0x3b75('0x35')]);};AGIVertices[_0x3b75('0x12')][_0x3b75('0x15f')]=function(_0x91d303){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x160'),_0x91d303[_0x3b75('0x35')]));if(!this['isConfigured'](_0x91d303[_0x3b75('0x14d')])){return this[_0x3b75('0xf')]['error'](_0x91d303,'no\x20find\x20by\x20configured');}logger['info'](util[_0x3b75('0x29')](_0x3b75('0x153'),this[_0x3b75('0xf')][_0x3b75('0x36')],_0x91d303[_0x3b75('0x14d')]));var _0x3644ec=this['getPause'][_0x3b75('0x69')](this,_0x91d303[_0x3b75('0x161')]);var _0xa7545=this[_0x3b75('0x4f')][_0x3b75('0x69')](this,_0x91d303[_0x3b75('0x14d')],_0x3644ec);if(_0xa7545){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x91d303[_0x3b75('0x14d')]));this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x14f'),this[_0x3b75('0xf')][_0x3b75('0x36')],_0x91d303[_0x3b75('0x14d')]));return{'code':0xc8,'result':_0x3b75('0x155')};}else{logger['info'](util[_0x3b75('0x29')](_0x3b75('0x150'),this[_0x3b75('0xf')][_0x3b75('0x36')],_0x91d303['findBy']));this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x3b75('0x36')],_0x91d303[_0x3b75('0x14d')]));return{'code':0xc8,'result':_0x3b75('0x156')};}};AGIVertices[_0x3b75('0x12')][_0x3b75('0x162')]=function(_0x15a3c5){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x15a3c5[_0x3b75('0x35')]));if(!this['isConfigured'](_0x15a3c5['file_id'])){return this['channel'][_0x3b75('0x2b')](_0x15a3c5,_0x3b75('0x10a'));}var _0xd44a9=this['getSound'][_0x3b75('0x69')](this,_0x15a3c5[_0x3b75('0x109')]);if(!_0xd44a9){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x15a3c5,_0x3b75('0x10b'));}var _0x2ded12=this[_0x3b75('0xf')][_0x3b75('0x54')](_0x3b75('0x163'),[_0xd44a9,_0x15a3c5[_0x3b75('0xe2')]]);if(_0x2ded12[_0x3b75('0x99')]===-0x1){return _0x2ded12;}return this[_0x3b75('0xf')]['noop'](util[_0x3b75('0x29')](_0x3b75('0xbc'),_0x3b75('0x163'),_0xd44a9));};AGIVertices[_0x3b75('0x12')][_0x3b75('0x164')]=function(_0x201c7f){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x165'),_0x201c7f[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x201c7f['queue_id'])){return this[_0x3b75('0xf')]['error'](_0x201c7f,'no\x20queue\x20selected');}var _0x92cc87='';var _0x53f1d9=parseInt(_0x201c7f[_0x3b75('0x166')],0xa);if(isNaN(_0x53f1d9)){_0x92cc87=_0x201c7f[_0x3b75('0x166')];}else{_0x92cc87=this[_0x3b75('0x18')][_0x3b75('0x69')](this,_0x201c7f[_0x3b75('0x166')]);if(!_0x92cc87){return this['channel'][_0x3b75('0x2b')](_0x201c7f,'no\x20queue\x20found');}}var _0x2e09f7='';if(this[_0x3b75('0x7c')](_0x201c7f['file_id'])){var _0x55c79e=this['getSound'][_0x3b75('0x69')](this,_0x201c7f['file_id']);if(_0x55c79e){_0x2e09f7=_0x55c79e;}}this[_0x3b75('0x34')][_0x3b75('0x69')](this,_0x201c7f,_0x92cc87);if(_0x201c7f[_0x3b75('0xe2')][_0x3b75('0x167')]('x')<0x0){_0x201c7f['opts']+='x';}if(_0x201c7f[_0x3b75('0xe2')]['indexOf']('X')<0x0){_0x201c7f[_0x3b75('0xe2')]+='X';}this[_0x3b75('0xf')]['setVariable'](_0x3b75('0x168'),_0x92cc87?_0x92cc87[_0x3b75('0x169')]():'');var _0x26e3b9=this['channel'][_0x3b75('0x54')](_0x3b75('0x16a'),[_0x92cc87,_0x201c7f[_0x3b75('0xe2')],_0x201c7f[_0x3b75('0x5f')],_0x2e09f7,_0x201c7f['timeout'],_0x201c7f[_0x3b75('0xad')],_0x201c7f['macro'],_0x201c7f['gosub'],'',_0x201c7f[_0x3b75('0x16b')]]);if(_0x26e3b9[_0x3b75('0x99')]===-0x1){return _0x26e3b9;}return this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0xbc'),_0x3b75('0x16a'),_0x92cc87));};AGIVertices['prototype'][_0x3b75('0x16c')]=function(_0x5f1d29){logger[_0x3b75('0x2d')](util['format'](_0x3b75('0x16d'),_0x5f1d29[_0x3b75('0x35')]));var _0x364dab=_0x5f1d29[_0x3b75('0x16e')]||_0x3b75('0x125');var _0x290ffa=util[_0x3b75('0x29')](_0x3b75('0x16f'),this[_0x3b75('0xf')][_0x3b75('0x3f')],rs['generate'](0x5));var _0x429a15=util[_0x3b75('0x29')](_0x3b75('0x170'),FILES_PATH,_0x290ffa,_0x364dab);var _0x49fb0e=util['format'](_0x3b75('0x126'),FILES_PATH,_0x290ffa);this['createSquareRecording']['sync'](this,_0x5f1d29,_0x290ffa,_0x429a15);this[_0x3b75('0xf')][_0x3b75('0xd7')](_0x3b75('0x171'),_0x290ffa);logger[_0x3b75('0x2d')](_0x3b75('0x172'),_0x49fb0e,_0x364dab,_0x5f1d29[_0x3b75('0x173')],_0x5f1d29[_0x3b75('0x61')]);return this[_0x3b75('0xf')][_0x3b75('0x128')](_0x49fb0e,_0x364dab,_0x5f1d29[_0x3b75('0x173')],_0x5f1d29[_0x3b75('0x61')],undefined,!![]);};AGIVertices[_0x3b75('0x12')][_0x3b75('0x174')]=function(_0x3407ae){logger['info'](util[_0x3b75('0x29')](_0x3b75('0x175'),_0x3407ae[_0x3b75('0x35')]));if(!this['isConfigured'](_0x3407ae[_0x3b75('0x5f')])){return this['channel'][_0x3b75('0xa0')](_0x3b75('0x176'));}var _0x52a983=this[_0x3b75('0x5e')][_0x3b75('0x69')](this,_0x3407ae);logger[_0x3b75('0x2d')](util[_0x3b75('0x29')]('Response:',util[_0x3b75('0x177')](_0x52a983,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3407ae[_0x3b75('0xd3')])){return this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x3b75('0x178'));}var _0x17a6ef=this[_0x3b75('0x13')][_0x3b75('0x69')](this,_0x3407ae[_0x3b75('0xd3')]);if(!_0x17a6ef){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x3407ae,_0x3b75('0x110'));}this[_0x3b75('0xf')][_0x3b75('0xd7')](util['format'](_0x3b75('0x179'),_0x17a6ef),_0x52a983[_0x3b75('0x71')]?_0x52a983['statusCode']:'200');this[_0x3b75('0xf')][_0x3b75('0xd7')](util['format'](_0x3b75('0x17a'),_0x17a6ef),_0x52a983[_0x3b75('0x70')]?_0x52a983[_0x3b75('0x70')]:'OK');if(_0x52a983[_0x3b75('0x6e')]){try{this['saveRestApiResult'](_0x52a983[_0x3b75('0x6e')],_0x17a6ef);}catch(_0x3a0ba9){logger[_0x3b75('0x2b')](util[_0x3b75('0x29')](_0x3b75('0x17b'),_0x17a6ef));}}return this[_0x3b75('0xf')]['noop'](util[_0x3b75('0x29')](_0x3b75('0xd9'),_0x17a6ef));};AGIVertices[_0x3b75('0x12')][_0x3b75('0x17c')]=function(_0x596b65){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x17d'),_0x596b65[_0x3b75('0x35')]));return this[_0x3b75('0xf')][_0x3b75('0x17e')](_0x596b65[_0x3b75('0x17f')][_0x3b75('0x56')](/\s+/g,''),_0x596b65['escape_digits']);};AGIVertices[_0x3b75('0x12')]['saynumber']=function(_0x372cff){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x180'),_0x372cff[_0x3b75('0x35')]));return this['channel'][_0x3b75('0x181')](_0x372cff[_0x3b75('0x62')][_0x3b75('0x56')](/\s+/g,''),_0x372cff[_0x3b75('0x173')]);};AGIVertices['prototype'][_0x3b75('0x182')]=function(_0x10df64){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x183'),_0x10df64[_0x3b75('0x35')]));return this['channel'][_0x3b75('0x184')](_0x10df64[_0x3b75('0x59')],_0x10df64[_0x3b75('0x173')]);};AGIVertices['prototype'][_0x3b75('0x185')]=function(_0x55cbe9){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x186'),_0x55cbe9['label']));if(!this[_0x3b75('0x7c')](_0x55cbe9[_0x3b75('0x187')])){return this['channel'][_0x3b75('0xa0')](_0x3b75('0x188'));}var _0x450902=this['getMailAccount'][_0x3b75('0x69')](this,_0x55cbe9[_0x3b75('0x187')]);if(!_0x450902||!_0x450902[_0x3b75('0x189')]){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x55cbe9,_0x3b75('0x18a'));}var _0x552042={'from':util['format']('\x22%s\x22\x20<%s>',_0x450902[_0x3b75('0x16')],_0x450902[_0x3b75('0x18b')]||_0x450902[_0x3b75('0x189')]['user']),'to':_0x55cbe9['to']||'','cc':_0x55cbe9['cc']||'','bcc':_0x55cbe9[_0x3b75('0x18c')]||'','subject':_0x55cbe9[_0x3b75('0x18d')],'html':_0x55cbe9['text'],'text':_0x55cbe9[_0x3b75('0x59')]};var _0x480e7f={'tls':{'rejectUnauthorized':![]}};if(_0x450902['Smtp'][_0x3b75('0x18e')]){_0x480e7f['service']=_0x450902['Smtp'][_0x3b75('0x18e')];}else{_0x480e7f['host']=_0x450902[_0x3b75('0x189')][_0x3b75('0x18f')];_0x480e7f['port']=_0x450902[_0x3b75('0x189')]['port'];_0x480e7f[_0x3b75('0x190')]=_0x450902[_0x3b75('0x189')][_0x3b75('0x190')];}if(_0x450902[_0x3b75('0x189')][_0x3b75('0x191')]){_0x480e7f[_0x3b75('0x192')]={'user':_0x450902[_0x3b75('0x189')]['user'],'pass':_0x450902[_0x3b75('0x189')]['pass']};}if(this[_0x3b75('0x7c')](_0x55cbe9[_0x3b75('0x193')])){}logger[_0x3b75('0xdb')](_0x3b75('0x194'),JSON[_0x3b75('0x6d')](_0x552042));this['createSquareDetailsReport'][_0x3b75('0x69')](this,_0x55cbe9,_0x55cbe9[_0x3b75('0x187')]);this[_0x3b75('0xf')][_0x3b75('0xa0')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x450902[_0x3b75('0x16')]));this['sendMailMessage'][_0x3b75('0x69')](this,_0x480e7f,_0x552042);return this['channel'][_0x3b75('0xa0')](_0x3b75('0x195'));};AGIVertices['prototype'][_0x3b75('0x196')]=function(_0x56cb5d){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x197'),_0x56cb5d['label']));return this[_0x3b75('0xf')][_0x3b75('0xa0')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype']['sendSMS']=function(_0x32e4f0){logger[_0x3b75('0x2d')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x32e4f0[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x32e4f0[_0x3b75('0x198')])){return this[_0x3b75('0xf')][_0x3b75('0xa0')]('no\x20sms\x20account\x20configured');}var _0x415fa5=this[_0x3b75('0x31')][_0x3b75('0x69')](this,_0x32e4f0['sms_account_id']);if(!_0x415fa5){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x32e4f0,_0x3b75('0x199'));}var _0xe8c495={'body':_0x32e4f0[_0x3b75('0x19a')],'phone':_0x32e4f0['to']||'','SmsAccountId':_0x415fa5['id']};logger[_0x3b75('0xdb')](_0x3b75('0x19b'),JSON['stringify'](_0xe8c495));this[_0x3b75('0x34')][_0x3b75('0x69')](this,_0x32e4f0,_0x32e4f0[_0x3b75('0x198')]);this['channel'][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x19c'),_0x415fa5[_0x3b75('0x16')]));this[_0x3b75('0x33')][_0x3b75('0x69')](this,_0xe8c495);return this[_0x3b75('0xf')]['noop'](_0x3b75('0x19d'));};AGIVertices['prototype'][_0x3b75('0x19e')]=function(_0x101f8a){logger['info'](util[_0x3b75('0x29')](_0x3b75('0x19f'),_0x101f8a[_0x3b75('0x35')]));if(!this['isConfigured'](_0x101f8a[_0x3b75('0xd3')])){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x101f8a,'no\x20variable\x20selected');}var _0x30e098=this['getVariable'][_0x3b75('0x69')](this,_0x101f8a[_0x3b75('0xd3')]);if(!_0x30e098){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x101f8a,_0x3b75('0x110'));}return this['channel']['setVariable'](_0x30e098,_0x101f8a['variable_value']);};AGIVertices['prototype']['start']=function(_0x51d003){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')]('Enter\x20in\x20START\x20(%s)\x20block',_0x51d003[_0x3b75('0x35')]));this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x3b75('0x1a0'));if(_0x51d003[_0x3b75('0xb1')]===_0x3b75('0x1a1')){this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x3b75('0x1a2'));return this[_0x3b75('0xf')]['answer']();}return this['channel'][_0x3b75('0xa0')](_0x3b75('0x1a3'));};AGIVertices['prototype'][_0x3b75('0x1a4')]=function(_0x15e206){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x1a5'),_0x15e206[_0x3b75('0x35')]));if(!this['isConfigured'](_0x15e206[_0x3b75('0x1a6')])){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x15e206,_0x3b75('0x1a7'));}var _0x3a12df=this[_0x3b75('0x19')][_0x3b75('0x69')](this,_0x15e206[_0x3b75('0x1a6')]);if(!this[_0x3b75('0x7c')](_0x3a12df)){return this['channel'][_0x3b75('0x2b')](_0x15e206,util['format'](_0x3b75('0x1a8'),_0x15e206['project_id']));}if(_0x3a12df===this[_0x3b75('0xf')][_0x3b75('0x3c')]){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x15e206,_0x3b75('0x1a9'));}this['createSquareDetailsReport']['sync'](this,_0x15e206,_0x3a12df);var _0x301863=this['channel']['exec'](_0x3b75('0x1aa'),util[_0x3b75('0x29')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x3b75('0xad')][_0x3b75('0x18f')]||_0x3b75('0x1ab'),_0x3a12df,this[_0x3b75('0xf')][_0x3b75('0x3c')]));if(_0x301863['result']===-0x1){return _0x301863;}return this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')]('Executed\x20command\x20%s\x20%s','AGI',_0x3a12df));};AGIVertices[_0x3b75('0x12')][_0x3b75('0x1ac')]=function(_0x23a287){logger[_0x3b75('0x2d')](util['format'](_0x3b75('0x1ad'),_0x23a287[_0x3b75('0x35')]));var _0x547384=this['shellCommand'][_0x3b75('0x69')](this,_0x23a287[_0x3b75('0xaf')]);this[_0x3b75('0x34')][_0x3b75('0x69')](this,_0x23a287,_0x23a287[_0x3b75('0xaf')]);if(this['isConfigured'](_0x23a287['variable_id'])){var _0x36605e=this[_0x3b75('0x13')][_0x3b75('0x69')](this,_0x23a287[_0x3b75('0xd3')]);if(_0x36605e){this[_0x3b75('0xf')][_0x3b75('0xd7')](_0x36605e,_0x547384);return this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x1ae'),_0x23a287['command'],_0x36605e));}}return this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x23a287['command']));};AGIVertices[_0x3b75('0x12')][_0x3b75('0x1af')]=function(_0x1ad793){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x1b0'),_0x1ad793['label']));_0x1ad793[_0x3b75('0x59')]=_0x1ad793[_0x3b75('0x59')][_0x3b75('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3b75('0x7c')](_0x1ad793['apiKey'])){return this[_0x3b75('0xf')][_0x3b75('0xa0')]('no\x20apiKey\x20configured');}if(!this[_0x3b75('0x7c')](_0x1ad793[_0x3b75('0x59')])){return this[_0x3b75('0xf')][_0x3b75('0xa0')](_0x3b75('0x9e'));}this['channel'][_0x3b75('0xa0')](util['format'](_0x3b75('0x1b1'),_0x1ad793[_0x3b75('0x59')]));var _0x4ec3dc=this[_0x3b75('0x57')]['sync'](this,_0x1ad793);if(_0x4ec3dc){this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x1b2'),_0x4ec3dc));var _0x3e6c5a=this[_0x3b75('0xf')][_0x3b75('0xf9')](_0x4ec3dc);try{fs[_0x3b75('0xfa')](_0x4ec3dc+'.wav');}catch(_0x54b701){logger['error'](_0x54b701);}return _0x3e6c5a;}return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x1ad793,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x3b75('0x12')][_0x3b75('0x1b3')]=function(_0x3a6276){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x1b4'),_0x3a6276[_0x3b75('0x35')]));_0x3a6276[_0x3b75('0x59')]=_0x3a6276[_0x3b75('0x59')][_0x3b75('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3a6276['text'])){return this[_0x3b75('0xf')]['noop'](_0x3b75('0x9e'));}this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x1b5'),_0x3a6276[_0x3b75('0x59')]));var _0x58c4a5=this[_0x3b75('0x5c')][_0x3b75('0x69')](this,_0x3a6276);if(_0x58c4a5){this['channel'][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x1b6'),_0x58c4a5));var _0x470626=this[_0x3b75('0xf')][_0x3b75('0xf9')](_0x58c4a5);try{fs[_0x3b75('0xfa')](_0x58c4a5+_0x3b75('0xfc'));}catch(_0x3d319d){logger['error'](_0x3d319d);}return _0x470626;}return this[_0x3b75('0xf')]['error'](_0x3a6276,_0x3b75('0x1b7'));};AGIVertices[_0x3b75('0x12')][_0x3b75('0x1b8')]=function(_0x2464a9){logger[_0x3b75('0x2d')](util['format'](_0x3b75('0x1b9'),_0x2464a9[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x2464a9[_0x3b75('0x14d')])){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x2464a9,_0x3b75('0x14e'));}logger['info'](util['format'](_0x3b75('0x153'),this[_0x3b75('0xf')][_0x3b75('0x36')],_0x2464a9['findBy']));var _0x522a17=this['agentUnpause'][_0x3b75('0x69')](this,_0x2464a9[_0x3b75('0x14d')]);if(_0x522a17){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x14f'),this[_0x3b75('0xf')][_0x3b75('0x36')],_0x2464a9['findBy']));this['channel'][_0x3b75('0xa0')](util['format'](_0x3b75('0x14f'),this[_0x3b75('0xf')][_0x3b75('0x36')],_0x2464a9['findBy']));return{'code':0xc8,'result':_0x3b75('0x155')};}else{logger[_0x3b75('0x2d')](util[_0x3b75('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3b75('0xf')]['callerid'],_0x2464a9[_0x3b75('0x14d')]));this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0x150'),this['channel']['callerid'],_0x2464a9[_0x3b75('0x14d')]));return{'code':0xc8,'result':_0x3b75('0x156')};}};AGIVertices[_0x3b75('0x12')][_0x3b75('0x1ba')]=function(_0x331401){logger[_0x3b75('0x2d')](util[_0x3b75('0x29')](_0x3b75('0x1bb'),_0x331401[_0x3b75('0x35')]));var _0x1cbb95=this['channel']['exec'](_0x3b75('0x1bc'),[_0x331401[_0x3b75('0x1bd')],_0x331401[_0x3b75('0x74')]]);if(_0x1cbb95[_0x3b75('0x99')]===-0x1){return _0x1cbb95;}return this[_0x3b75('0xf')][_0x3b75('0xa0')](util[_0x3b75('0x29')](_0x3b75('0xbc'),_0x3b75('0x1bc'),_0x331401[_0x3b75('0x1bd')]));};AGIVertices[_0x3b75('0x12')][_0x3b75('0x1be')]=function(_0x4fdd06){logger[_0x3b75('0x2d')](util['format'](_0x3b75('0x1bf'),_0x4fdd06[_0x3b75('0x35')]));if(!this[_0x3b75('0x7c')](_0x4fdd06[_0x3b75('0xd3')])){return this[_0x3b75('0xf')]['error'](_0x4fdd06,_0x3b75('0x1c0'));}var _0x74a617=this['getVariable'][_0x3b75('0x69')](this,_0x4fdd06[_0x3b75('0xd3')]);if(!_0x74a617){return this[_0x3b75('0xf')][_0x3b75('0x2b')](_0x4fdd06,'no\x20variable\x20found');}var _0x19c4bd=this[_0x3b75('0xf')]['getVariable'](_0x74a617);return{'code':0xc8,'result':_0x19c4bd[_0x3b75('0x98')]?_0x19c4bd[_0x3b75('0x98')]:'-'};};String[_0x3b75('0x12')][_0x3b75('0x97')]=function(_0x52bc93,_0x13f9af){return this[_0x3b75('0x96')](_0x52bc93)['join'](_0x13f9af);};module[_0x3b75('0x1c1')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index e35eec4..d881fe7 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 _0x5fd1=['../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','message','stopAcw','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','attended','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami'];(function(_0x214f4c,_0x5ab32b){var _0x46265d=function(_0xef2c8c){while(--_0xef2c8c){_0x214f4c['push'](_0x214f4c['shift']());}};_0x46265d(++_0x5ab32b);}(_0x5fd1,0x155));var _0x15fd=function(_0x509147,_0x1b4f9f){_0x509147=_0x509147-0x0;var _0xd3468e=_0x5fd1[_0x509147];return _0xd3468e;};'use strict';var util=require(_0x15fd('0x0'));var _=require('lodash');var moment=require(_0x15fd('0x1'));var ami=require(_0x15fd('0x2'));var logger=require(_0x15fd('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x15fd('0x4'));function Acw(_0x3138f3){this[_0x15fd('0x5')]=_0x3138f3['voiceQueues'];this[_0x15fd('0x6')]=_0x3138f3[_0x15fd('0x6')];this[_0x15fd('0x7')]=_0x3138f3[_0x15fd('0x7')];this[_0x15fd('0x8')]={};ami['on']('agentconnect',this[_0x15fd('0x9')][_0x15fd('0xa')](this));ami['on'](_0x15fd('0xb'),this['syncHangupRequest'][_0x15fd('0xa')](this));ami['on']('hangup',this[_0x15fd('0xc')][_0x15fd('0xa')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x15fd('0xd'),this[_0x15fd('0xe')][_0x15fd('0xa')](this));ami['on'](_0x15fd('0xf'),this[_0x15fd('0x10')][_0x15fd('0xa')](this));ami['on'](_0x15fd('0x11'),this[_0x15fd('0x12')][_0x15fd('0xa')](this));}function getDiff(_0x4cb391){var _0x5b7af0=moment()['milliseconds'](0x0);var _0x3fda60=moment(_0x4cb391)[_0x15fd('0x13')](0x0);return _0x5b7af0[_0x15fd('0x14')](_0x3fda60,_0x15fd('0x15'));}Acw[_0x15fd('0x16')][_0x15fd('0x17')]=function(_0x2c5375){try{var _0x44a63a=this;var _0x5aae13=this['channels'][_0x2c5375][_0x15fd('0x18')];var _0x5ca5a2=this[_0x15fd('0x8')][_0x2c5375]['queue'];var _0x917fe4=this[_0x15fd('0x5')][_0x5ca5a2];var _0x855bae=![];var _0x49ceac=_0x15fd('0x19');if(_0x917fe4[_0x15fd('0x1a')]){if(_0x917fe4[_0x15fd('0x1b')][_0x15fd('0x1c')]){_0x855bae=!![];_0x49ceac=_0x917fe4[_0x15fd('0x1b')][_0x15fd('0x1c')];}}ami[_0x15fd('0x1d')]({'action':_0x15fd('0x1e'),'interface':_0x5aae13,'paused':!![],'reason':_0x49ceac})[_0x15fd('0x1f')](function(_0x1eab55){if(_0x44a63a[_0x15fd('0x6')][_0x5aae13]){return RpcUser['getAgent'](_0x44a63a['agents'][_0x5aae13]['id'])[_0x15fd('0x1f')](function(_0x36b21e){if(_0x36b21e&&!_0x36b21e[_0x15fd('0x20')]){logger[_0x15fd('0x21')](_0x15fd('0x22'),_0x2c5375,_0x5aae13,_0x5ca5a2);var _0x11496a=_0x44a63a[_0x15fd('0x8')][_0x2c5375]['attended']&&_0x44a63a[_0x15fd('0x8')][_0x2c5375][_0x15fd('0x23')]?_0x44a63a[_0x15fd('0x8')][_0x2c5375]['destlinkedid']:_0x2c5375;return RpcUser[_0x15fd('0x24')](_0x44a63a['agents'][_0x5aae13],_0x49ceac,_0x11496a)[_0x15fd('0x1f')](function(_0x1fc24f){if(!_0x855bae){_0x44a63a[_0x15fd('0x7')][_0x5aae13]={};logger['info'](_0x15fd('0x25'),_0x2c5375,_0x44a63a[_0x15fd('0x5')][_0x5ca5a2][_0x15fd('0x26')],_0x5aae13,_0x5ca5a2);_0x44a63a['timers'][_0x5aae13][_0x15fd('0x27')]=setTimeout(_0x44a63a['stopAcw'][_0x15fd('0xa')](_0x44a63a,_0x5aae13),_0x44a63a[_0x15fd('0x5')][_0x5ca5a2][_0x15fd('0x26')]*0x3e8);_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x28')]=moment()[_0x15fd('0x29')](_0x15fd('0x2a'));_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x2b')]=_0x2c5375;_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x2c')]=_0x5ca5a2;_0x44a63a['timers'][_0x5aae13][_0x15fd('0x2d')]=function(){var _0x2fe61e=getDiff(_0x44a63a['timers'][_0x5aae13][_0x15fd('0x28')]);clearTimeout(_0x44a63a[_0x15fd('0x7')][_0x5aae13]['timer']);_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x27')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x2fe61e},_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x2b')],_0x5aae13)[_0x15fd('0x1f')](function(_0x476828){logger[_0x15fd('0x21')](_0x15fd('0x2e'),_0x2c5375,_0x2fe61e,_0x476828);})['catch'](function(_0x2d647c){logger[_0x15fd('0x2f')](_0x15fd('0x30'),_0x2c5375,_0x2d647c);});delete _0x44a63a[_0x15fd('0x7')][_0x5aae13];};}});}else{logger['info'](_0x15fd('0x31'),_0x2c5375,_0x5aae13,_0x5ca5a2);}});}})[_0x15fd('0x32')](function(_0x11b3a1){logger[_0x15fd('0x2f')](_0x15fd('0x25'),_0x2c5375,_0x44a63a[_0x15fd('0x5')][_0x5ca5a2]['acwTimeout'],_0x5aae13,_0x5ca5a2);})[_0x15fd('0x33')](function(){delete _0x44a63a[_0x15fd('0x8')][_0x2c5375];});}catch(_0x57c118){logger[_0x15fd('0x2f')](_0x15fd('0x34'),_0x57c118[_0x15fd('0x35')]);}};Acw['prototype'][_0x15fd('0x36')]=function(_0x309851){try{var _0x1732bc=this;if(_0x1732bc[_0x15fd('0x7')][_0x309851]){_0x1732bc[_0x15fd('0x7')][_0x309851][_0x15fd('0x27')]=![];var _0x4d7259=_0x1732bc['timers'][_0x309851]['uniqueid'];var _0x340d17=_0x1732bc[_0x15fd('0x7')][_0x309851][_0x15fd('0x2c')];var _0x4e608d=_0x1732bc['voiceQueues'][_0x340d17][_0x15fd('0x26')];logger['info']('[TIMER][STOP][AGENT:%s]',_0x309851);RpcUser['saveUnpause'](this[_0x15fd('0x6')][_0x309851]);RpcVoiceAgentReport[_0x15fd('0x37')]({'acwtime':_0x4e608d,'agentacw':!![]},_0x4d7259,_0x309851)[_0x15fd('0x1f')](function(_0x59d0d7){logger[_0x15fd('0x21')](_0x15fd('0x2e'),_0x4d7259,_0x4e608d,_0x59d0d7);})[_0x15fd('0x32')](function(_0x5beb6e){logger[_0x15fd('0x2f')](_0x15fd('0x30'),_0x4d7259,_0x5beb6e);});}else{logger[_0x15fd('0x2f')](_0x15fd('0x38'),_0x309851);if(_0x1732bc[_0x15fd('0x7')]){logger[_0x15fd('0x21')](_0x15fd('0x39'),JSON[_0x15fd('0x3a')](_0x1732bc[_0x15fd('0x7')]));}}}catch(_0x5dd3c4){logger[_0x15fd('0x2f')](_0x15fd('0x3b'),_0x5dd3c4[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x9')]=function(_0x5f9429){try{if(this[_0x15fd('0x5')][_0x5f9429[_0x15fd('0x2c')]]&&(this[_0x15fd('0x5')][_0x5f9429[_0x15fd('0x2c')]][_0x15fd('0x3c')]||this[_0x15fd('0x5')][_0x5f9429[_0x15fd('0x2c')]][_0x15fd('0x1a')])){if(this[_0x15fd('0x6')][_0x5f9429['interface']]){this[_0x15fd('0x8')][_0x5f9429[_0x15fd('0x2b')]]={'queue':_0x5f9429[_0x15fd('0x2c')],'interface':_0x5f9429[_0x15fd('0x18')],'destlinkedid':_0x5f9429[_0x15fd('0x23')]};}}}catch(_0x44d08b){logger[_0x15fd('0x2f')](_0x15fd('0x3d'),_0x44d08b['message']);}};Acw['prototype'][_0x15fd('0x12')]=function(_0x57bbd5){try{if(this[_0x15fd('0x5')][_0x57bbd5[_0x15fd('0x2c')]]&&(this['voiceQueues'][_0x57bbd5[_0x15fd('0x2c')]][_0x15fd('0x3c')]||this[_0x15fd('0x5')][_0x57bbd5[_0x15fd('0x2c')]][_0x15fd('0x1a')])){if(this[_0x15fd('0x6')][_0x57bbd5['interface']]){this[_0x15fd('0x8')][_0x57bbd5[_0x15fd('0x2b')]]={'queue':_0x57bbd5[_0x15fd('0x2c')],'interface':_0x57bbd5[_0x15fd('0x18')]};}}}catch(_0xcce802){logger[_0x15fd('0x2f')](_0x15fd('0x3e'),_0xcce802[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x3f')]=function(_0x16b4f5){try{if(this[_0x15fd('0x8')][_0x16b4f5['uniqueid']]&&_[_0x15fd('0x40')](this['channels'][_0x16b4f5[_0x15fd('0x2b')]][_0x15fd('0x41')])){logger[_0x15fd('0x21')]('[%s][HANGUP:UNIQUEID]',_0x16b4f5[_0x15fd('0x2b')]);this[_0x15fd('0x17')](_0x16b4f5[_0x15fd('0x2b')]);}else if(this[_0x15fd('0x8')][_0x16b4f5['linkedid']]&&_[_0x15fd('0x40')](this[_0x15fd('0x8')][_0x16b4f5[_0x15fd('0x42')]][_0x15fd('0x41')])){logger['info'](_0x15fd('0x43'),_0x16b4f5[_0x15fd('0x42')]);this['startAcw'](_0x16b4f5['linkedid']);}}catch(_0x5da44c){logger[_0x15fd('0x2f')](_0x15fd('0x44'),_0x5da44c[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0xc')]=function(_0x33a128){try{if(this['channels'][_0x33a128[_0x15fd('0x2b')]]&&this[_0x15fd('0x8')][_0x33a128[_0x15fd('0x2b')]]['attended']){logger[_0x15fd('0x21')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x33a128[_0x15fd('0x2b')]);this[_0x15fd('0x17')](_0x33a128[_0x15fd('0x2b')]);}else if(this[_0x15fd('0x8')][_0x33a128[_0x15fd('0x42')]]&&this[_0x15fd('0x8')][_0x33a128[_0x15fd('0x42')]][_0x15fd('0x41')]){logger[_0x15fd('0x21')](_0x15fd('0x45'),_0x33a128[_0x15fd('0x42')]);this[_0x15fd('0x17')](_0x33a128[_0x15fd('0x42')]);}}catch(_0x5343b8){logger[_0x15fd('0x2f')]('[ACW][syncHangup]\x20%s',_0x5343b8[_0x15fd('0x35')]);}};Acw['prototype'][_0x15fd('0xe')]=function(_0x1fac7f){try{if(!_[_0x15fd('0x46')](this['channels'][_0x1fac7f['transfereeuniqueid']])){this[_0x15fd('0x17')](_0x1fac7f[_0x15fd('0x47')]);if(this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x48')]]){this['channels'][_0x1fac7f[_0x15fd('0x48')]][_0x15fd('0x41')]=!![];this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x49')]]=this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x48')]];delete this['channels'][_0x1fac7f[_0x15fd('0x48')]];}}else if(!_[_0x15fd('0x46')](this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x49')]])){this[_0x15fd('0x17')](_0x1fac7f[_0x15fd('0x49')]);if(this['channels'][_0x1fac7f['origtransfereruniqueid']]){this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x4a')]]['attended']=!![];this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x47')]]=this['channels'][_0x1fac7f[_0x15fd('0x4a')]];delete this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x4a')]];}}}catch(_0x53bfd7){logger[_0x15fd('0x2f')](_0x15fd('0x4b'),_0x53bfd7[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x10')]=function(_0x1f4581){try{if(this[_0x15fd('0x8')][_0x1f4581[_0x15fd('0x4c')]]){logger[_0x15fd('0x21')](_0x15fd('0x4d'),JSON['stringify'](_0x1f4581[_0x15fd('0x4c')]));this[_0x15fd('0x17')](_0x1f4581['transfereruniqueid']);}else if(this['channels'][_0x1f4581[_0x15fd('0x4e')]]){logger[_0x15fd('0x21')](_0x15fd('0x4f'),JSON[_0x15fd('0x3a')](_0x1f4581[_0x15fd('0x4e')]));this[_0x15fd('0x17')](_0x1f4581['transfererlinkedid']);}}catch(_0x41d398){logger[_0x15fd('0x2f')](_0x15fd('0x50'),_0x41d398[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x51')]=function(_0xf27ab4){try{if(this[_0x15fd('0x5')][_0xf27ab4[_0x15fd('0x2c')]]&&this[_0x15fd('0x5')][_0xf27ab4[_0x15fd('0x2c')]]['autopause']==='all'){if(this[_0x15fd('0x6')][_0xf27ab4[_0x15fd('0x18')]]){logger[_0x15fd('0x21')](_0x15fd('0x52'),_0xf27ab4[_0x15fd('0x2b')],_0xf27ab4[_0x15fd('0x18')],_0xf27ab4[_0x15fd('0x2c')]);return RpcUser['savePause'](this[_0x15fd('0x6')][_0xf27ab4['interface']],_0x15fd('0x53'),_0xf27ab4['uniqueid']);}}}catch(_0x1c2828){logger['error'](_0x15fd('0x54'),_0x1c2828[_0x15fd('0x35')]);}};module[_0x15fd('0x55')]=Acw; \ No newline at end of file +var _0x5c12=['timers','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','name','mandatoryDispositionPause','Action','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','channels','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','uniqueid','queue','updateAcw','lastPauseAt','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x5c12,0x188));var _0x25c1=function(_0x442f02,_0x47d845){_0x442f02=_0x442f02-0x0;var _0xab6ef1=_0x5c12[_0x442f02];return _0xab6ef1;};'use strict';var util=require('util');var _=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var ami=require('../ami');var logger=require(_0x25c1('0x2'))(_0x25c1('0x3'));var RpcUser=require(_0x25c1('0x4'));var RpcVoiceAgentReport=require(_0x25c1('0x5'));function Acw(_0x2c5df0){this[_0x25c1('0x6')]=_0x2c5df0[_0x25c1('0x6')];this['agents']=_0x2c5df0[_0x25c1('0x7')];this[_0x25c1('0x8')]=_0x2c5df0[_0x25c1('0x8')];this['channels']={};ami['on']('agentconnect',this[_0x25c1('0x9')][_0x25c1('0xa')](this));ami['on'](_0x25c1('0xb'),this[_0x25c1('0xc')][_0x25c1('0xa')](this));ami['on']('hangup',this[_0x25c1('0xd')][_0x25c1('0xa')](this));ami['on'](_0x25c1('0xe'),this[_0x25c1('0xf')][_0x25c1('0xa')](this));ami['on']('attendedtransfer',this[_0x25c1('0x10')][_0x25c1('0xa')](this));ami['on']('blindtransfer',this[_0x25c1('0x11')][_0x25c1('0xa')](this));ami['on'](_0x25c1('0x12'),this[_0x25c1('0x13')]['bind'](this));}function getDiff(_0x569ef9){var _0x4ef5d7=moment()['milliseconds'](0x0);var _0x3ef429=moment(_0x569ef9)[_0x25c1('0x14')](0x0);return _0x4ef5d7[_0x25c1('0x15')](_0x3ef429,_0x25c1('0x16'));}Acw[_0x25c1('0x17')]['startAcw']=function(_0x4638f0){try{var _0x55b62d=this;var _0x5d631e=this['channels'][_0x4638f0][_0x25c1('0x18')];var _0x1a08b5=this['channels'][_0x4638f0]['queue'];var _0x61a29f=this['voiceQueues'][_0x1a08b5];var _0x7175d4=![];var _0x23a418='ACW';if(_0x61a29f['mandatoryDisposition']){if(_0x61a29f['mandatoryDispositionPause'][_0x25c1('0x19')]){_0x7175d4=!![];_0x23a418=_0x61a29f[_0x25c1('0x1a')][_0x25c1('0x19')];}}ami[_0x25c1('0x1b')]({'action':'QueuePause','interface':_0x5d631e,'paused':!![],'reason':_0x23a418})[_0x25c1('0x1c')](function(_0x9f54e3){if(_0x55b62d[_0x25c1('0x7')][_0x5d631e]){return RpcUser[_0x25c1('0x1d')](_0x55b62d['agents'][_0x5d631e]['id'])['then'](function(_0x2a8a84){if(_0x2a8a84&&!_0x2a8a84[_0x25c1('0x1e')]){logger[_0x25c1('0x1f')](_0x25c1('0x20'),_0x4638f0,_0x5d631e,_0x1a08b5);var _0x15cf2f=_0x55b62d[_0x25c1('0x21')][_0x4638f0][_0x25c1('0x22')]&&_0x55b62d[_0x25c1('0x21')][_0x4638f0][_0x25c1('0x23')]?_0x55b62d[_0x25c1('0x21')][_0x4638f0][_0x25c1('0x23')]:_0x4638f0;return RpcUser[_0x25c1('0x24')](_0x55b62d[_0x25c1('0x7')][_0x5d631e],_0x23a418,_0x15cf2f)['then'](function(_0x2dadae){if(!_0x7175d4){_0x55b62d[_0x25c1('0x8')][_0x5d631e]={};logger[_0x25c1('0x1f')](_0x25c1('0x25'),_0x4638f0,_0x55b62d[_0x25c1('0x6')][_0x1a08b5][_0x25c1('0x26')],_0x5d631e,_0x1a08b5);_0x55b62d['timers'][_0x5d631e][_0x25c1('0x27')]=setTimeout(_0x55b62d[_0x25c1('0x28')][_0x25c1('0xa')](_0x55b62d,_0x5d631e),_0x55b62d[_0x25c1('0x6')][_0x1a08b5][_0x25c1('0x26')]*0x3e8);_0x55b62d[_0x25c1('0x8')][_0x5d631e]['lastPauseAt']=moment()[_0x25c1('0x29')]('YYYY-MM-DD\x20HH:mm:ss');_0x55b62d[_0x25c1('0x8')][_0x5d631e][_0x25c1('0x2a')]=_0x4638f0;_0x55b62d[_0x25c1('0x8')][_0x5d631e][_0x25c1('0x2b')]=_0x1a08b5;_0x55b62d[_0x25c1('0x8')][_0x5d631e][_0x25c1('0x2c')]=function(){var _0x1fd4e3=getDiff(_0x55b62d[_0x25c1('0x8')][_0x5d631e][_0x25c1('0x2d')]);clearTimeout(_0x55b62d['timers'][_0x5d631e][_0x25c1('0x27')]);_0x55b62d['timers'][_0x5d631e]['timer']=![];RpcVoiceAgentReport[_0x25c1('0x2e')]({'acwtime':_0x1fd4e3},_0x55b62d[_0x25c1('0x8')][_0x5d631e]['uniqueid'],_0x5d631e)[_0x25c1('0x1c')](function(_0x5a5a32){logger[_0x25c1('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x4638f0,_0x1fd4e3,_0x5a5a32);})[_0x25c1('0x2f')](function(_0x7f1e7a){logger[_0x25c1('0x30')](_0x25c1('0x31'),_0x4638f0,_0x7f1e7a);});delete _0x55b62d[_0x25c1('0x8')][_0x5d631e];};}});}else{logger[_0x25c1('0x1f')](_0x25c1('0x32'),_0x4638f0,_0x5d631e,_0x1a08b5);}});}})[_0x25c1('0x2f')](function(_0x578713){logger[_0x25c1('0x30')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4638f0,_0x55b62d[_0x25c1('0x6')][_0x1a08b5]['acwTimeout'],_0x5d631e,_0x1a08b5);})[_0x25c1('0x33')](function(){delete _0x55b62d[_0x25c1('0x21')][_0x4638f0];});}catch(_0x18f10c){logger[_0x25c1('0x30')](_0x25c1('0x34'),_0x18f10c[_0x25c1('0x35')]);}};Acw[_0x25c1('0x17')][_0x25c1('0x28')]=function(_0x3fced1){try{var _0x2d060c=this;if(_0x2d060c[_0x25c1('0x8')][_0x3fced1]){_0x2d060c[_0x25c1('0x8')][_0x3fced1][_0x25c1('0x27')]=![];var _0x1b6e92=_0x2d060c[_0x25c1('0x8')][_0x3fced1][_0x25c1('0x2a')];var _0x349aef=_0x2d060c[_0x25c1('0x8')][_0x3fced1][_0x25c1('0x2b')];var _0x357385=_0x2d060c['voiceQueues'][_0x349aef][_0x25c1('0x26')];logger[_0x25c1('0x1f')]('[TIMER][STOP][AGENT:%s]',_0x3fced1);RpcUser[_0x25c1('0x36')](this['agents'][_0x3fced1]);RpcVoiceAgentReport[_0x25c1('0x2e')]({'acwtime':_0x357385,'agentacw':!![]},_0x1b6e92,_0x3fced1)['then'](function(_0x4326fb){logger[_0x25c1('0x1f')](_0x25c1('0x37'),_0x1b6e92,_0x357385,_0x4326fb);})[_0x25c1('0x2f')](function(_0xbc20a3){logger['error'](_0x25c1('0x31'),_0x1b6e92,_0xbc20a3);});}else{logger['error'](_0x25c1('0x38'),_0x3fced1);if(_0x2d060c[_0x25c1('0x8')]){logger[_0x25c1('0x1f')](_0x25c1('0x39'),JSON['stringify'](_0x2d060c['timers']));}}}catch(_0x58b8f3){logger[_0x25c1('0x30')](_0x25c1('0x3a'),_0x58b8f3['message']);}};Acw[_0x25c1('0x17')]['syncAgentConnect']=function(_0x3d5172){try{if(this[_0x25c1('0x6')][_0x3d5172[_0x25c1('0x2b')]]&&(this['voiceQueues'][_0x3d5172['queue']]['acw']||this[_0x25c1('0x6')][_0x3d5172[_0x25c1('0x2b')]]['mandatoryDisposition'])){if(this[_0x25c1('0x7')][_0x3d5172[_0x25c1('0x18')]]){this[_0x25c1('0x21')][_0x3d5172['uniqueid']]={'queue':_0x3d5172['queue'],'interface':_0x3d5172['interface'],'destlinkedid':_0x3d5172['destlinkedid']};}}}catch(_0x669152){logger[_0x25c1('0x30')]('[ACW][syncAgentConnect]\x20%s',_0x669152[_0x25c1('0x35')]);}};Acw[_0x25c1('0x17')][_0x25c1('0x13')]=function(_0x2dbe23){try{if(this[_0x25c1('0x6')][_0x2dbe23[_0x25c1('0x2b')]]&&(this[_0x25c1('0x6')][_0x2dbe23['queue']]['acw']||this[_0x25c1('0x6')][_0x2dbe23[_0x25c1('0x2b')]][_0x25c1('0x3b')])){if(this['agents'][_0x2dbe23[_0x25c1('0x18')]]){this[_0x25c1('0x21')][_0x2dbe23[_0x25c1('0x2a')]]={'queue':_0x2dbe23[_0x25c1('0x2b')],'interface':_0x2dbe23['interface']};}}}catch(_0xb87cf1){logger[_0x25c1('0x30')](_0x25c1('0x3c'),_0xb87cf1[_0x25c1('0x35')]);}};Acw['prototype']['syncHangupRequest']=function(_0x13ac06){try{if(this[_0x25c1('0x21')][_0x13ac06[_0x25c1('0x2a')]]&&_[_0x25c1('0x3d')](this['channels'][_0x13ac06[_0x25c1('0x2a')]][_0x25c1('0x22')])){logger['info'](_0x25c1('0x3e'),_0x13ac06[_0x25c1('0x2a')]);this[_0x25c1('0x3f')](_0x13ac06[_0x25c1('0x2a')]);}else if(this['channels'][_0x13ac06['linkedid']]&&_[_0x25c1('0x3d')](this[_0x25c1('0x21')][_0x13ac06[_0x25c1('0x40')]]['attended'])){logger[_0x25c1('0x1f')](_0x25c1('0x41'),_0x13ac06['linkedid']);this[_0x25c1('0x3f')](_0x13ac06[_0x25c1('0x40')]);}}catch(_0x2b58a3){logger[_0x25c1('0x30')](_0x25c1('0x42'),_0x2b58a3[_0x25c1('0x35')]);}};Acw[_0x25c1('0x17')]['syncHangup']=function(_0x5344da){try{if(this['channels'][_0x5344da[_0x25c1('0x2a')]]&&this['channels'][_0x5344da[_0x25c1('0x2a')]][_0x25c1('0x22')]){logger[_0x25c1('0x1f')](_0x25c1('0x43'),_0x5344da[_0x25c1('0x2a')]);this[_0x25c1('0x3f')](_0x5344da['uniqueid']);}else if(this[_0x25c1('0x21')][_0x5344da[_0x25c1('0x40')]]&&this[_0x25c1('0x21')][_0x5344da[_0x25c1('0x40')]][_0x25c1('0x22')]){logger[_0x25c1('0x1f')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5344da[_0x25c1('0x40')]);this[_0x25c1('0x3f')](_0x5344da[_0x25c1('0x40')]);}}catch(_0xbff8ad){logger[_0x25c1('0x30')]('[ACW][syncHangup]\x20%s',_0xbff8ad[_0x25c1('0x35')]);}};Acw[_0x25c1('0x17')]['syncAttendedTransfer']=function(_0x1341d2){try{if(!_[_0x25c1('0x44')](this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x45')]])){this[_0x25c1('0x3f')](_0x1341d2[_0x25c1('0x45')]);if(this['channels'][_0x1341d2[_0x25c1('0x46')]]){this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x46')]][_0x25c1('0x22')]=!![];this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x47')]]=this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x46')]];delete this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x46')]];}}else if(!_[_0x25c1('0x44')](this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x47')]])){this[_0x25c1('0x3f')](_0x1341d2['transfertargetuniqueid']);if(this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x48')]]){this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x48')]][_0x25c1('0x22')]=!![];this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x45')]]=this['channels'][_0x1341d2[_0x25c1('0x48')]];delete this['channels'][_0x1341d2[_0x25c1('0x48')]];}}}catch(_0x24568c){logger[_0x25c1('0x30')](_0x25c1('0x49'),_0x24568c[_0x25c1('0x35')]);}};Acw[_0x25c1('0x17')][_0x25c1('0x11')]=function(_0x19df83){try{if(this['channels'][_0x19df83[_0x25c1('0x4a')]]){logger[_0x25c1('0x1f')](_0x25c1('0x4b'),JSON[_0x25c1('0x4c')](_0x19df83[_0x25c1('0x4a')]));this[_0x25c1('0x3f')](_0x19df83[_0x25c1('0x4a')]);}else if(this['channels'][_0x19df83[_0x25c1('0x4d')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x19df83[_0x25c1('0x4d')]));this[_0x25c1('0x3f')](_0x19df83[_0x25c1('0x4d')]);}}catch(_0x15cd6d){logger[_0x25c1('0x30')]('[ACW][syncBlindTransfer]\x20%s',_0x15cd6d[_0x25c1('0x35')]);}};Acw['prototype'][_0x25c1('0xf')]=function(_0x36aa98){try{if(this[_0x25c1('0x6')][_0x36aa98[_0x25c1('0x2b')]]&&this[_0x25c1('0x6')][_0x36aa98[_0x25c1('0x2b')]][_0x25c1('0x4e')]==='all'){if(this[_0x25c1('0x7')][_0x36aa98[_0x25c1('0x18')]]){logger[_0x25c1('0x1f')](_0x25c1('0x4f'),_0x36aa98[_0x25c1('0x2a')],_0x36aa98[_0x25c1('0x18')],_0x36aa98['queue']);return RpcUser[_0x25c1('0x24')](this['agents'][_0x36aa98[_0x25c1('0x18')]],'Auto-Pause',_0x36aa98['uniqueid']);}}}catch(_0x1c66d6){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1c66d6['message']);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 70bb95b..8e8eed7 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 _0x1cec=['Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionSipShowRegistry','catch','log','asterisk-manager','bluebird','util','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x1cec,0x135));var _0xc1ce=function(_0x3369a8,_0xfea8b1){_0x3369a8=_0x3369a8-0x0;var _0x4b5e69=_0x1cec[_0x3369a8];return _0x4b5e69;};'use strict';var Manager=require(_0xc1ce('0x0'));var BPromise=require(_0xc1ce('0x1'));var moment=require('moment');var util=require(_0xc1ce('0x2'));var _=require('lodash');var logger=require('../../config/logger')(_0xc1ce('0x3'));var config=require(_0xc1ce('0x4'));var ami=new Manager(config[_0xc1ce('0x5')][_0xc1ce('0x6')],config[_0xc1ce('0x5')]['ip'],config['asterisk'][_0xc1ce('0x7')],config[_0xc1ce('0x5')][_0xc1ce('0x8')],!![]);ami[_0xc1ce('0x9')]();ami[_0xc1ce('0xa')]=BPromise[_0xc1ce('0xb')](ami[_0xc1ce('0xc')]);function error(_0x496fdb){logger[_0xc1ce('0xd')](util[_0xc1ce('0xe')](_0xc1ce('0xf'),config[_0xc1ce('0x5')]['username'],config[_0xc1ce('0x5')]['ip'],config['asterisk'][_0xc1ce('0x6')],util['inspect'](_0x496fdb,![],null)));}function close(){logger[_0xc1ce('0xd')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0xc1ce('0x7')],config[_0xc1ce('0x5')]['ip'],config[_0xc1ce('0x5')][_0xc1ce('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xc1ce('0xa')]({'action':_0xc1ce('0x10')});};};ami[_0xc1ce('0x11')]=function(){return function(){return ami[_0xc1ce('0xa')]({'action':_0xc1ce('0x12')});};};ami[_0xc1ce('0x13')]=function(){return function(){return ami['Action']({'action':_0xc1ce('0x14')});};};ami[_0xc1ce('0x15')]=function(){return function(){return ami['Action']({'action':_0xc1ce('0x16')});};};ami[_0xc1ce('0x17')]=function(){return function(){return ami[_0xc1ce('0xa')]({'action':_0xc1ce('0x18')});};};function connect(_0x1cf171){logger[_0xc1ce('0x19')](util[_0xc1ce('0xe')](_0xc1ce('0x1a'),config[_0xc1ce('0x5')]['username'],config[_0xc1ce('0x5')]['ip'],config['asterisk'][_0xc1ce('0x6')]));ami[_0xc1ce('0x1b')](_0xc1ce('0xd'),error);ami[_0xc1ce('0x1b')](_0xc1ce('0x1c'),close);}ami['on'](_0xc1ce('0x1d'),connect);ami['on'](_0xc1ce('0x1e'),function(_0x3ce27e){logger[_0xc1ce('0x19')](util[_0xc1ce('0xe')](_0xc1ce('0x1f'),config['asterisk'][_0xc1ce('0x7')],config[_0xc1ce('0x5')]['ip'],config['asterisk']['port'],util['inspect'](_0x3ce27e,![],null)));});ami['on'](_0xc1ce('0x20'),function(_0x2fda38){logger[_0xc1ce('0x19')](util[_0xc1ce('0xe')](_0xc1ce('0x21'),config[_0xc1ce('0x5')][_0xc1ce('0x7')],config[_0xc1ce('0x5')]['ip'],config[_0xc1ce('0x5')]['port']));return BPromise['resolve']()[_0xc1ce('0x22')](ami[_0xc1ce('0x23')]())['then'](ami[_0xc1ce('0x11')]())[_0xc1ce('0x22')](ami['actionSipPeerStatus']())[_0xc1ce('0x22')](ami[_0xc1ce('0x15')]())[_0xc1ce('0x22')](ami['actionCoreShowChannels']())[_0xc1ce('0x24')](function(_0x2b7fc0){console[_0xc1ce('0x25')](_0x2b7fc0);});});ami['once'](_0xc1ce('0xd'),error);ami[_0xc1ce('0x1b')](_0xc1ce('0x1c'),close);module['exports']=ami; \ No newline at end of file +var _0xba8e=['queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','catch','exports','asterisk-manager','moment','util','lodash','../../config/logger','ami','asterisk','port','username','keepConnected','Action','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba8e,0xed));var _0xeba8=function(_0x334fea,_0x1f1e18){_0x334fea=_0x334fea-0x0;var _0x3c5829=_0xba8e[_0x334fea];return _0x3c5829;};'use strict';var Manager=require(_0xeba8('0x0'));var BPromise=require('bluebird');var moment=require(_0xeba8('0x1'));var util=require(_0xeba8('0x2'));var _=require(_0xeba8('0x3'));var logger=require(_0xeba8('0x4'))(_0xeba8('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0xeba8('0x6')][_0xeba8('0x7')],config['asterisk']['ip'],config['asterisk'][_0xeba8('0x8')],config[_0xeba8('0x6')]['password'],!![]);ami[_0xeba8('0x9')]();ami[_0xeba8('0xa')]=BPromise['promisify'](ami[_0xeba8('0xb')]);function error(_0x44379e){logger['error'](util[_0xeba8('0xc')](_0xeba8('0xd'),config[_0xeba8('0x6')][_0xeba8('0x8')],config['asterisk']['ip'],config[_0xeba8('0x6')][_0xeba8('0x7')],util[_0xeba8('0xe')](_0x44379e,![],null)));}function close(){logger[_0xeba8('0xf')](util[_0xeba8('0xc')](_0xeba8('0x10'),config['asterisk'][_0xeba8('0x8')],config[_0xeba8('0x6')]['ip'],config[_0xeba8('0x6')][_0xeba8('0x7')]));}ami[_0xeba8('0x11')]=function(){return function(){return ami[_0xeba8('0xa')]({'action':_0xeba8('0x12')});};};ami[_0xeba8('0x13')]=function(){return function(){return ami[_0xeba8('0xa')]({'action':_0xeba8('0x14')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0xeba8('0x15')]=function(){return function(){return ami[_0xeba8('0xa')]({'action':_0xeba8('0x16')});};};ami[_0xeba8('0x17')]=function(){return function(){return ami['Action']({'action':_0xeba8('0x18')});};};function connect(_0x5119fc){logger['info'](util[_0xeba8('0xc')](_0xeba8('0x19'),config[_0xeba8('0x6')][_0xeba8('0x8')],config['asterisk']['ip'],config[_0xeba8('0x6')][_0xeba8('0x7')]));ami[_0xeba8('0x1a')](_0xeba8('0xf'),error);ami['once'](_0xeba8('0x1b'),close);}ami['on'](_0xeba8('0x1c'),connect);ami['on']('shutdown',function(_0x539973){logger['info'](util['format'](_0xeba8('0x1d'),config['asterisk'][_0xeba8('0x8')],config[_0xeba8('0x6')]['ip'],config[_0xeba8('0x6')]['port'],util[_0xeba8('0xe')](_0x539973,![],null)));});ami['on'](_0xeba8('0x1e'),function(_0x10513e){logger['info'](util[_0xeba8('0xc')](_0xeba8('0x1f'),config[_0xeba8('0x6')][_0xeba8('0x8')],config['asterisk']['ip'],config['asterisk'][_0xeba8('0x7')]));return BPromise[_0xeba8('0x20')]()['then'](ami[_0xeba8('0x11')]())[_0xeba8('0x21')](ami[_0xeba8('0x13')]())[_0xeba8('0x21')](ami[_0xeba8('0x22')]())[_0xeba8('0x21')](ami[_0xeba8('0x15')]())[_0xeba8('0x21')](ami[_0xeba8('0x17')]())[_0xeba8('0x23')](function(_0x33e604){console['log'](_0x33e604);});});ami[_0xeba8('0x1a')](_0xeba8('0xf'),error);ami[_0xeba8('0x1a')](_0xeba8('0x1b'),close);module[_0xeba8('0x24')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 34b6225..bfc5485 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 _0xc2b7=['result','catch','exports','jayson/promise','http','Request','then','debug','rpc','memberReport','error','message'];(function(_0x2ff846,_0x4fb859){var _0x568b5b=function(_0x2d7cc1){while(--_0x2d7cc1){_0x2ff846['push'](_0x2ff846['shift']());}};_0x568b5b(++_0x4fb859);}(_0xc2b7,0x1bf));var _0x7c2b=function(_0x1252d9,_0xb59816){_0x1252d9=_0x1252d9-0x0;var _0x76c018=_0xc2b7[_0x1252d9];return _0x76c018;};'use strict';var jayson=require(_0x7c2b('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x7c2b('0x1')]({'port':0x2329});client[_0x7c2b('0x2')]=function(_0x2f0134,_0xd30444){return new BPromise(function(_0x188e93,_0x3f3a7d){return client['request'](_0x2f0134,_0xd30444)[_0x7c2b('0x3')](function(_0x6ab115){logger[_0x7c2b('0x4')](_0x7c2b('0x5'),_0x7c2b('0x6'),_0x2f0134,_0xd30444,_0x6ab115);if(_0x6ab115[_0x7c2b('0x7')]){logger['error'](_0x7c2b('0x5'),_0x7c2b('0x6'),_0x2f0134,_0x6ab115['error'][_0x7c2b('0x8')],_0xd30444);return _0x3f3a7d(_0x6ab115[_0x7c2b('0x7')][_0x7c2b('0x8')]);}else{return _0x188e93(_0x6ab115[_0x7c2b('0x9')]);}})[_0x7c2b('0xa')](function(_0x3d07da){logger[_0x7c2b('0x7')]('rpc',_0x7c2b('0x6'),_0x2f0134,_0x3d07da,_0xd30444);return _0x3f3a7d(_0x3d07da);});});};module[_0x7c2b('0xb')]=client; \ No newline at end of file +var _0x5ecb=['http','request','then','debug','rpc','memberReport','error','message','catch','exports','jayson/promise','bluebird','../../config/logger','ami','client'];(function(_0x710771,_0x3e7ff6){var _0x37b20e=function(_0x441aa9){while(--_0x441aa9){_0x710771['push'](_0x710771['shift']());}};_0x37b20e(++_0x3e7ff6);}(_0x5ecb,0x181));var _0xb5ec=function(_0x754ab4,_0x56daa7){_0x754ab4=_0x754ab4-0x0;var _0x34079a=_0x5ecb[_0x754ab4];return _0x34079a;};'use strict';var jayson=require(_0xb5ec('0x0'));var BPromise=require(_0xb5ec('0x1'));var logger=require(_0xb5ec('0x2'))(_0xb5ec('0x3'));var client=jayson[_0xb5ec('0x4')][_0xb5ec('0x5')]({'port':0x2329});client['Request']=function(_0xab5ddf,_0x32b6a6){return new BPromise(function(_0x3ebf85,_0x1d4fd3){return client[_0xb5ec('0x6')](_0xab5ddf,_0x32b6a6)[_0xb5ec('0x7')](function(_0x5c79db){logger[_0xb5ec('0x8')](_0xb5ec('0x9'),_0xb5ec('0xa'),_0xab5ddf,_0x32b6a6,_0x5c79db);if(_0x5c79db[_0xb5ec('0xb')]){logger['error'](_0xb5ec('0x9'),'memberReport',_0xab5ddf,_0x5c79db['error'][_0xb5ec('0xc')],_0x32b6a6);return _0x1d4fd3(_0x5c79db[_0xb5ec('0xb')]['message']);}else{return _0x3ebf85(_0x5c79db['result']);}})[_0xb5ec('0xd')](function(_0x2d9f67){logger['error'](_0xb5ec('0x9'),'memberReport',_0xab5ddf,_0x2d9f67,_0x32b6a6);return _0x1d4fd3(_0x2d9f67);});});};module[_0xb5ec('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 5fe9feb..00dad58 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 _0x99e8=['UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','dialCutDigit','number','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId'];(function(_0x23942c,_0x385bbb){var _0x17dadb=function(_0x2f4a89){while(--_0x2f4a89){_0x23942c['push'](_0x23942c['shift']());}};_0x17dadb(++_0x385bbb);}(_0x99e8,0x11b));var _0x899e=function(_0x932dd,_0x430c11){_0x932dd=_0x932dd-0x0;var _0x2caa3c=_0x99e8[_0x932dd];return _0x2caa3c;};'use strict';var util=require(_0x899e('0x0'));var _=require(_0x899e('0x1'));var moment=require(_0x899e('0x2'));function checkNameSurname(_0x14cead,_0x44a8f5,_0x12185f){var _0x397d8f='';if(!_[_0x899e('0x3')](_0x44a8f5)&&'string'===typeof _0x44a8f5){_0x397d8f+=_0x44a8f5;}if(!_[_0x899e('0x3')](_0x12185f)&&_0x899e('0x4')===typeof _0x12185f){_0x397d8f+='\x20'+_0x12185f;}if(_0x397d8f!==''){return _0x397d8f;}return _0x14cead;}function Action(_0xb6ba2a,_0x13c8c2,_0x477941){this[_0x899e('0x5')]=_0xb6ba2a;this[_0x899e('0x6')]=_0x477941||undefined;this[_0x899e('0x7')]=checkNameSurname(_0x13c8c2[_0x899e('0x8')][_0x899e('0x9')],_0x13c8c2[_0x899e('0x8')][_0x899e('0xa')],_0x13c8c2[_0x899e('0x8')][_0x899e('0xb')]);this['number']=_0x13c8c2['Contact']['phone'];this['queue']=_0xb6ba2a['name'];this['active']=_0x13c8c2['active']||![];this['type']=_0xb6ba2a[_0x899e('0xc')];this[_0x899e('0xd')]=_0xb6ba2a['dialQueueTimeout']||0x3;this[_0x899e('0xe')]=_0x13c8c2[_0x899e('0xe')];this[_0x899e('0xf')]=_0x13c8c2[_0x899e('0xf')];this[_0x899e('0x10')]=_0x13c8c2[_0x899e('0x10')];this[_0x899e('0x11')]=_0x13c8c2['countnoanswerretry'];this[_0x899e('0x12')]=_0x13c8c2['countnosuchnumberretry'];this[_0x899e('0x13')]=_0x13c8c2['countdropretry'];this[_0x899e('0x14')]=_0x13c8c2[_0x899e('0x14')];this['countmachineretry']=_0x13c8c2[_0x899e('0x15')];this[_0x899e('0x16')]=_0x13c8c2[_0x899e('0x16')];this[_0x899e('0x17')]=_0x13c8c2[_0x899e('0x17')];this[_0x899e('0x18')]=_0x13c8c2[_0x899e('0x18')];this[_0x899e('0x19')]=_0x13c8c2['UserId'];this[_0x899e('0x1a')]=_0x13c8c2['VoiceQueueId'];this[_0x899e('0x1b')]=_0x13c8c2['CampaignId'];this[_0x899e('0x1c')]=_0x13c8c2['id'];this[_0x899e('0x1d')]=_0x13c8c2[_0x899e('0x8')]['firstName']||'';this['starttime']=moment()['format'](_0x899e('0x1e'));this[_0x899e('0x1f')]=_0x13c8c2['callback'];this['callbackuniqueid']=_0x13c8c2[_0x899e('0x20')];this[_0x899e('0x21')]=_0x13c8c2[_0x899e('0x21')];this[_0x899e('0x22')]=_0x13c8c2[_0x899e('0x22')];this[_0x899e('0x23')]='';this[_0x899e('0x24')]='';}Action[_0x899e('0x25')][_0x899e('0x26')]=function(){return util[_0x899e('0x27')]('\x22%s\x22\x20<%s>',this['name'],this[_0x899e('0x5')][_0x899e('0x28')]>0x0?this[_0x899e('0x29')]['substring'](this[_0x899e('0x5')][_0x899e('0x28')]):this['number']);};Action[_0x899e('0x25')][_0x899e('0x2a')]=function(){return this['queue'];};module[_0x899e('0x2b')]=Action; \ No newline at end of file +var _0x99b7=['CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','exports','util','moment','isNil','string','voiceQueue','uniqueid','Contact','phone','firstName','number','name','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x99b7,0x14e));var _0x799b=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x99b7[_0x220f3f];return _0x1f170e;};'use strict';var util=require(_0x799b('0x0'));var _=require('lodash');var moment=require(_0x799b('0x1'));function checkNameSurname(_0x4c877e,_0x5ae2c3,_0x58056f){var _0x41135c='';if(!_[_0x799b('0x2')](_0x5ae2c3)&&_0x799b('0x3')===typeof _0x5ae2c3){_0x41135c+=_0x5ae2c3;}if(!_['isNil'](_0x58056f)&&_0x799b('0x3')===typeof _0x58056f){_0x41135c+='\x20'+_0x58056f;}if(_0x41135c!==''){return _0x41135c;}return _0x4c877e;}function Action(_0x1f8594,_0x3959ed,_0x70f082){this[_0x799b('0x4')]=_0x1f8594;this[_0x799b('0x5')]=_0x70f082||undefined;this['name']=checkNameSurname(_0x3959ed[_0x799b('0x6')][_0x799b('0x7')],_0x3959ed[_0x799b('0x6')][_0x799b('0x8')],_0x3959ed[_0x799b('0x6')]['lastName']);this[_0x799b('0x9')]=_0x3959ed[_0x799b('0x6')][_0x799b('0x7')];this['queue']=_0x1f8594[_0x799b('0xa')];this['active']=_0x3959ed['active']||![];this[_0x799b('0xb')]=_0x1f8594['type'];this[_0x799b('0xc')]=_0x1f8594['dialQueueTimeout']||0x3;this[_0x799b('0xd')]=_0x3959ed['scheduledat'];this['countbusyretry']=_0x3959ed[_0x799b('0xe')];this[_0x799b('0xf')]=_0x3959ed[_0x799b('0xf')];this[_0x799b('0x10')]=_0x3959ed[_0x799b('0x10')];this[_0x799b('0x11')]=_0x3959ed['countnosuchnumberretry'];this[_0x799b('0x12')]=_0x3959ed['countdropretry'];this[_0x799b('0x13')]=_0x3959ed[_0x799b('0x13')];this['countmachineretry']=_0x3959ed[_0x799b('0x14')];this[_0x799b('0x15')]=_0x3959ed['countagentrejectretry'];this[_0x799b('0x16')]=_0x3959ed[_0x799b('0x16')];this[_0x799b('0x17')]=_0x3959ed['ListId'];this[_0x799b('0x18')]=_0x3959ed[_0x799b('0x18')];this['VoiceQueueId']=_0x3959ed[_0x799b('0x19')];this[_0x799b('0x1a')]=_0x3959ed['CampaignId'];this['idHopper']=_0x3959ed['id'];this[_0x799b('0x1b')]=_0x3959ed[_0x799b('0x6')]['firstName']||'';this[_0x799b('0x1c')]=moment()[_0x799b('0x1d')](_0x799b('0x1e'));this[_0x799b('0x1f')]=_0x3959ed['callback'];this['callbackuniqueid']=_0x3959ed[_0x799b('0x20')];this[_0x799b('0x21')]=_0x3959ed['callbackat'];this[_0x799b('0x22')]=_0x3959ed[_0x799b('0x22')];this[_0x799b('0x23')]='';this[_0x799b('0x24')]='';}Action[_0x799b('0x25')][_0x799b('0x26')]=function(){return util[_0x799b('0x1d')](_0x799b('0x27'),this[_0x799b('0xa')],this[_0x799b('0x4')][_0x799b('0x28')]>0x0?this[_0x799b('0x9')][_0x799b('0x29')](this[_0x799b('0x4')][_0x799b('0x28')]):this['number']);};Action[_0x799b('0x25')][_0x799b('0x2a')]=function(){return this[_0x799b('0x2b')];};module[_0x799b('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 9f093ca..6582062 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 _0xea64=['countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','ringtime','talktime','queue','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x2411ea,_0x4e2188){var _0x4b9644=function(_0x3273ad){while(--_0x3273ad){_0x2411ea['push'](_0x2411ea['shift']());}};_0x4b9644(++_0x4e2188);}(_0xea64,0x1eb));var _0x4ea6=function(_0x5e75ae,_0x459f86){_0x5e75ae=_0x5e75ae-0x0;var _0x299855=_0xea64[_0x5e75ae];return _0x299855;};'use strict';var util=require(_0x4ea6('0x0'));var _=require(_0x4ea6('0x1'));var moment=require(_0x4ea6('0x2'));function getSeconds(_0x1c0fa0,_0x145594){var _0x1ee666=moment(_0x1c0fa0)[_0x4ea6('0x3')](0x0);var _0x57660b=moment(_0x145594)[_0x4ea6('0x3')](0x0);return _0x1ee666[_0x4ea6('0x4')](_0x57660b,_0x4ea6('0x5'));}function AgentComplete(_0x458d31,_0x5aefa0){this[_0x4ea6('0x6')]=0x4;this[_0x4ea6('0x7')]=_0x4ea6('0x8');this['scheduledat']=_0x458d31[_0x4ea6('0x9')];this[_0x4ea6('0xa')]=_0x458d31['type'];this['campaigntype']=_0x458d31['type']===_0x4ea6('0xb')?'queue':_0x458d31[_0x4ea6('0xa')];this[_0x4ea6('0xc')]=_0x458d31[_0x4ea6('0xc')];this['countcongestionretry']=_0x458d31[_0x4ea6('0xd')];this[_0x4ea6('0xe')]=_0x458d31['countnoanswerretry'];this[_0x4ea6('0xf')]=_0x458d31[_0x4ea6('0xc')]+_0x458d31[_0x4ea6('0xd')]+_0x458d31[_0x4ea6('0xe')]+_0x458d31['countnosuchnumberretry']+_0x458d31['countdropretry']+_0x458d31[_0x4ea6('0x10')]+_0x458d31[_0x4ea6('0x11')]+_0x458d31[_0x4ea6('0x12')];this[_0x4ea6('0x13')]=_0x458d31['countnosuchnumberretry'];this['countdropretry']=_0x458d31[_0x4ea6('0x14')];this[_0x4ea6('0x10')]=_0x458d31[_0x4ea6('0x10')];this[_0x4ea6('0x11')]=_0x458d31[_0x4ea6('0x11')];this[_0x4ea6('0x12')]=_0x458d31[_0x4ea6('0x12')];this[_0x4ea6('0x15')]=_0x5aefa0[_0x4ea6('0x15')];this[_0x4ea6('0x16')]=_0x458d31[_0x4ea6('0x17')];this[_0x4ea6('0x18')]=_0x458d31[_0x4ea6('0x19')];this['starttime']=_0x458d31[_0x4ea6('0x1a')];this[_0x4ea6('0x1b')]=_0x458d31[_0x4ea6('0x1b')];this[_0x4ea6('0x1c')]=_0x458d31[_0x4ea6('0x1c')];this[_0x4ea6('0x1d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x4ea6('0x1e')]=getSeconds(_0x458d31[_0x4ea6('0x1b')],_0x458d31[_0x4ea6('0x1a')]);this['holdtime']=getSeconds(_0x458d31[_0x4ea6('0x1c')],_0x458d31[_0x4ea6('0x1b')]);this[_0x4ea6('0x1f')]=getSeconds(this['endtime'],_0x458d31['answertime']);this[_0x4ea6('0x20')]=_0x5aefa0[_0x4ea6('0x20')];this[_0x4ea6('0x21')]=_0x5aefa0['membername'];this['reason']=_0x5aefa0[_0x4ea6('0x22')];this[_0x4ea6('0x23')]=_0x458d31[_0x4ea6('0x23')];this[_0x4ea6('0x24')]=_0x458d31['callbackuniqueid'];this['callbackat']=_0x458d31['callbackat'];this[_0x4ea6('0x25')]=_0x458d31[_0x4ea6('0x25')];this['ContactId']=_0x458d31[_0x4ea6('0x26')];this[_0x4ea6('0x27')]=_0x458d31[_0x4ea6('0x27')];this[_0x4ea6('0x28')]=_0x458d31[_0x4ea6('0x28')];this[_0x4ea6('0x29')]=_0x458d31[_0x4ea6('0x29')];this['CampaignId']=_0x458d31[_0x4ea6('0x2a')];this[_0x4ea6('0x2b')]=_0x458d31[_0x4ea6('0x2b')]||'';this[_0x4ea6('0x2c')]=_0x458d31[_0x4ea6('0x2c')]||'';}module[_0x4ea6('0x2d')]=AgentComplete; \ No newline at end of file +var _0x248e=['answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','milliseconds','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime'];(function(_0x582cea,_0x420fac){var _0x59ac2b=function(_0x14f2e1){while(--_0x14f2e1){_0x582cea['push'](_0x582cea['shift']());}};_0x59ac2b(++_0x420fac);}(_0x248e,0x106));var _0xe248=function(_0x39f1e8,_0xd73b5d){_0x39f1e8=_0x39f1e8-0x0;var _0x4eebaf=_0x248e[_0x39f1e8];return _0x4eebaf;};'use strict';var util=require(_0xe248('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0xb4024f,_0x209558){var _0x288dbe=moment(_0xb4024f)[_0xe248('0x1')](0x0);var _0x183279=moment(_0x209558)[_0xe248('0x1')](0x0);return _0x288dbe['diff'](_0x183279,_0xe248('0x2'));}function AgentComplete(_0x29538d,_0x54a92c){this[_0xe248('0x3')]=0x4;this['statedesc']=_0xe248('0x4');this[_0xe248('0x5')]=_0x29538d['scheduledat'];this[_0xe248('0x6')]=_0x29538d[_0xe248('0x6')];this[_0xe248('0x7')]=_0x29538d[_0xe248('0x6')]===_0xe248('0x8')?_0xe248('0x9'):_0x29538d['type'];this[_0xe248('0xa')]=_0x29538d[_0xe248('0xa')];this['countcongestionretry']=_0x29538d[_0xe248('0xb')];this[_0xe248('0xc')]=_0x29538d[_0xe248('0xc')];this[_0xe248('0xd')]=_0x29538d['countbusyretry']+_0x29538d['countcongestionretry']+_0x29538d['countnoanswerretry']+_0x29538d[_0xe248('0xe')]+_0x29538d['countdropretry']+_0x29538d['countabandonedretry']+_0x29538d['countmachineretry']+_0x29538d[_0xe248('0xf')];this[_0xe248('0xe')]=_0x29538d[_0xe248('0xe')];this['countdropretry']=_0x29538d['countdropretry'];this[_0xe248('0x10')]=_0x29538d['countabandonedretry'];this[_0xe248('0x11')]=_0x29538d[_0xe248('0x11')];this[_0xe248('0xf')]=_0x29538d[_0xe248('0xf')];this[_0xe248('0x12')]=_0x54a92c['uniqueid'];this[_0xe248('0x13')]=_0x29538d[_0xe248('0x14')];this[_0xe248('0x15')]=_0x29538d[_0xe248('0x16')];this[_0xe248('0x17')]=_0x29538d[_0xe248('0x17')];this[_0xe248('0x18')]=_0x29538d['responsetime'];this['answertime']=_0x29538d[_0xe248('0x19')];this[_0xe248('0x1a')]=moment()[_0xe248('0x1b')](_0xe248('0x1c'));this['ringtime']=getSeconds(_0x29538d['responsetime'],_0x29538d['starttime']);this[_0xe248('0x1d')]=getSeconds(_0x29538d['answertime'],_0x29538d['responsetime']);this[_0xe248('0x1e')]=getSeconds(this['endtime'],_0x29538d[_0xe248('0x19')]);this[_0xe248('0x9')]=_0x54a92c[_0xe248('0x9')];this['membername']=_0x54a92c['membername'];this[_0xe248('0x1f')]=_0x54a92c[_0xe248('0x1f')];this['callback']=_0x29538d[_0xe248('0x20')];this[_0xe248('0x21')]=_0x29538d[_0xe248('0x21')];this[_0xe248('0x22')]=_0x29538d[_0xe248('0x22')];this[_0xe248('0x23')]=_0x29538d[_0xe248('0x23')];this[_0xe248('0x24')]=_0x29538d['ContactId'];this[_0xe248('0x25')]=_0x29538d[_0xe248('0x25')];this[_0xe248('0x26')]=_0x29538d['UserId'];this[_0xe248('0x27')]=_0x29538d[_0xe248('0x27')];this[_0xe248('0x28')]=_0x29538d['CampaignId'];this['originatecalleridnum']=_0x29538d['originatecalleridnum']||'';this['originatecalleridname']=_0x29538d['originatecalleridname']||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 91e7bc0..72d9c55 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 _0x2a85=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2a85,0x18b));var _0x52a8=function(_0x276cc2,_0x564487){_0x276cc2=_0x276cc2-0x0;var _0x4b8119=_0x2a85[_0x276cc2];return _0x4b8119;};'use strict';var util=require(_0x52a8('0x0'));var _=require('lodash');var moment=require(_0x52a8('0x1'));function getSeconds(_0x5b9033,_0x3801fb){var _0x12eb3d=moment(_0x5b9033)[_0x52a8('0x2')](0x0);var _0x5f4a57=moment(_0x3801fb)['milliseconds'](0x0);return _0x12eb3d[_0x52a8('0x3')](_0x5f4a57,_0x52a8('0x4'));}function Final(_0x58db5f){this[_0x52a8('0x5')]=_0x58db5f[_0x52a8('0x5')];this[_0x52a8('0x6')]=_0x58db5f[_0x52a8('0x6')];this[_0x52a8('0x7')]=_0x58db5f[_0x52a8('0x7')];this[_0x52a8('0x8')]=_0x58db5f[_0x52a8('0x7')]==='outbound'?_0x52a8('0x9'):_0x58db5f[_0x52a8('0x7')];this[_0x52a8('0xa')]=_0x58db5f[_0x52a8('0xa')];this['countcongestionretry']=_0x58db5f[_0x52a8('0xb')];this[_0x52a8('0xc')]=_0x58db5f[_0x52a8('0xc')];this[_0x52a8('0xd')]=_0x58db5f[_0x52a8('0xa')]+_0x58db5f[_0x52a8('0xb')]+_0x58db5f[_0x52a8('0xc')]+_0x58db5f[_0x52a8('0xe')]+_0x58db5f[_0x52a8('0xf')]+_0x58db5f[_0x52a8('0x10')]+_0x58db5f[_0x52a8('0x11')]+_0x58db5f['countagentrejectretry'];this['countnosuchnumberretry']=_0x58db5f[_0x52a8('0xe')];this[_0x52a8('0xf')]=_0x58db5f['countdropretry'];this[_0x52a8('0x10')]=_0x58db5f[_0x52a8('0x10')];this['countmachineretry']=_0x58db5f[_0x52a8('0x11')];this[_0x52a8('0x12')]=_0x58db5f['countagentrejectretry'];this[_0x52a8('0x9')]=_0x58db5f[_0x52a8('0x9')];this[_0x52a8('0x13')]=_0x58db5f[_0x52a8('0x13')];this[_0x52a8('0x14')]=_0x58db5f[_0x52a8('0x14')];this[_0x52a8('0x15')]=_0x58db5f[_0x52a8('0x15')];this[_0x52a8('0x16')]=_0x58db5f[_0x52a8('0x16')];this['endtime']=_0x58db5f[_0x52a8('0x16')];this[_0x52a8('0x17')]=_0x58db5f[_0x52a8('0x17')]||0x0;this['holdtime']=_0x58db5f[_0x52a8('0x18')]||0x0;this['talktime']=_0x58db5f[_0x52a8('0x19')]||0x0;this[_0x52a8('0x1a')]=_0x58db5f[_0x52a8('0x1a')];this[_0x52a8('0x1b')]=_0x58db5f[_0x52a8('0x1b')];this[_0x52a8('0x1c')]=_0x58db5f[_0x52a8('0x1c')];this[_0x52a8('0x1d')]=_0x58db5f[_0x52a8('0x1d')];this[_0x52a8('0x1e')]=_0x58db5f[_0x52a8('0x1e')];this['ListId']=_0x58db5f['ListId'];this[_0x52a8('0x1f')]=_0x58db5f['UserId'];this[_0x52a8('0x20')]=_0x58db5f['VoiceQueueId'];this['CampaignId']=_0x58db5f[_0x52a8('0x21')];this[_0x52a8('0x22')]=_0x58db5f[_0x52a8('0x22')]||'';this[_0x52a8('0x23')]=_0x58db5f[_0x52a8('0x23')]||'';}module[_0x52a8('0x24')]=Final; \ No newline at end of file +var _0x230b=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x230b,0x1a8));var _0xb230=function(_0x5598cc,_0x3d798d){_0x5598cc=_0x5598cc-0x0;var _0x33d243=_0x230b[_0x5598cc];return _0x33d243;};'use strict';var util=require(_0xb230('0x0'));var _=require(_0xb230('0x1'));var moment=require(_0xb230('0x2'));function getSeconds(_0x37369a,_0x1d05d9){var _0x320050=moment(_0x37369a)[_0xb230('0x3')](0x0);var _0x24578c=moment(_0x1d05d9)[_0xb230('0x3')](0x0);return _0x320050[_0xb230('0x4')](_0x24578c,_0xb230('0x5'));}function Final(_0x2df373){this[_0xb230('0x6')]=_0x2df373[_0xb230('0x6')];this['scheduledat']=_0x2df373[_0xb230('0x7')];this[_0xb230('0x8')]=_0x2df373['type'];this[_0xb230('0x9')]=_0x2df373[_0xb230('0x8')]==='outbound'?_0xb230('0xa'):_0x2df373[_0xb230('0x8')];this[_0xb230('0xb')]=_0x2df373['countbusyretry'];this[_0xb230('0xc')]=_0x2df373[_0xb230('0xc')];this['countnoanswerretry']=_0x2df373['countnoanswerretry'];this[_0xb230('0xd')]=_0x2df373[_0xb230('0xb')]+_0x2df373[_0xb230('0xc')]+_0x2df373['countnoanswerretry']+_0x2df373[_0xb230('0xe')]+_0x2df373[_0xb230('0xf')]+_0x2df373[_0xb230('0x10')]+_0x2df373[_0xb230('0x11')]+_0x2df373[_0xb230('0x12')];this['countnosuchnumberretry']=_0x2df373[_0xb230('0xe')];this['countdropretry']=_0x2df373[_0xb230('0xf')];this['countabandonedretry']=_0x2df373[_0xb230('0x10')];this[_0xb230('0x11')]=_0x2df373[_0xb230('0x11')];this[_0xb230('0x12')]=_0x2df373[_0xb230('0x12')];this[_0xb230('0xa')]=_0x2df373[_0xb230('0xa')];this[_0xb230('0x13')]=_0x2df373[_0xb230('0x13')];this['calleridnum']=_0x2df373[_0xb230('0x14')];this[_0xb230('0x15')]=_0x2df373[_0xb230('0x15')];this[_0xb230('0x16')]=_0x2df373[_0xb230('0x16')];this['endtime']=_0x2df373[_0xb230('0x16')];this[_0xb230('0x17')]=_0x2df373[_0xb230('0x17')]||0x0;this[_0xb230('0x18')]=_0x2df373[_0xb230('0x18')]||0x0;this[_0xb230('0x19')]=_0x2df373[_0xb230('0x19')]||0x0;this[_0xb230('0x1a')]=_0x2df373[_0xb230('0x1a')];this['callbackuniqueid']=_0x2df373[_0xb230('0x1b')];this[_0xb230('0x1c')]=_0x2df373[_0xb230('0x1c')];this[_0xb230('0x1d')]=_0x2df373[_0xb230('0x1d')];this['ContactId']=_0x2df373[_0xb230('0x1e')];this[_0xb230('0x1f')]=_0x2df373['ListId'];this['UserId']=_0x2df373[_0xb230('0x20')];this['VoiceQueueId']=_0x2df373[_0xb230('0x21')];this[_0xb230('0x22')]=_0x2df373[_0xb230('0x22')];this[_0xb230('0x23')]=_0x2df373[_0xb230('0x23')]||'';this[_0xb230('0x24')]=_0x2df373[_0xb230('0x24')]||'';}module[_0xb230('0x25')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 4bb3ccf..a49f4c3 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 _0xa2c4=['responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','IVR','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','uniqueid','name','calleridnum','number','starttime'];(function(_0x3b7223,_0x33cb9e){var _0x84300a=function(_0x4f35a1){while(--_0x4f35a1){_0x3b7223['push'](_0x3b7223['shift']());}};_0x84300a(++_0x33cb9e);}(_0xa2c4,0x160));var _0x4a2c=function(_0x23f1ba,_0x4c976b){_0x23f1ba=_0x23f1ba-0x0;var _0x48f690=_0xa2c4[_0x23f1ba];return _0x48f690;};'use strict';var util=require(_0x4a2c('0x0'));var _=require(_0x4a2c('0x1'));var moment=require(_0x4a2c('0x2'));function getSeconds(_0x596681,_0x9f10de){var _0x2cc53a=moment(_0x596681)[_0x4a2c('0x3')](0x0);var _0x25e1ad=moment(_0x9f10de)['milliseconds'](0x0);return _0x2cc53a[_0x4a2c('0x4')](_0x25e1ad,_0x4a2c('0x5'));}function Hangup(_0x354144,_0x324449){this[_0x4a2c('0x6')]=0x4;this[_0x4a2c('0x7')]=_0x4a2c('0x8');this[_0x4a2c('0x9')]=_0x354144[_0x4a2c('0x9')];this['type']=_0x354144[_0x4a2c('0xa')];this[_0x4a2c('0xb')]=_0x354144[_0x4a2c('0xa')]===_0x4a2c('0xc')?_0x4a2c('0xd'):_0x354144[_0x4a2c('0xa')];this[_0x4a2c('0xe')]=_0x354144['countbusyretry'];this['countcongestionretry']=_0x354144[_0x4a2c('0xf')];this[_0x4a2c('0x10')]=_0x354144[_0x4a2c('0x10')];this['countglobal']=_0x354144[_0x4a2c('0xe')]+_0x354144[_0x4a2c('0xf')]+_0x354144['countnoanswerretry']+_0x354144[_0x4a2c('0x11')]+_0x354144[_0x4a2c('0x12')]+_0x354144[_0x4a2c('0x13')]+_0x354144[_0x4a2c('0x14')]+_0x354144['countagentrejectretry'];this[_0x4a2c('0x11')]=_0x354144[_0x4a2c('0x11')];this['countdropretry']=_0x354144['countdropretry'];this[_0x4a2c('0x13')]=_0x354144['countabandonedretry'];this[_0x4a2c('0x14')]=_0x354144['countmachineretry'];this['countagentrejectretry']=_0x354144['countagentrejectretry'];this['uniqueid']=_0x324449[_0x4a2c('0x15')];this['calleridname']=_0x354144[_0x4a2c('0x16')];this[_0x4a2c('0x17')]=_0x354144[_0x4a2c('0x18')];this[_0x4a2c('0x19')]=_0x354144[_0x4a2c('0x19')];this['responsetime']=_0x354144[_0x4a2c('0x1a')];this[_0x4a2c('0x1b')]=moment()[_0x4a2c('0x1c')](_0x4a2c('0x1d'));this[_0x4a2c('0x1e')]=getSeconds(_0x354144[_0x4a2c('0x1a')],_0x354144['starttime']);this[_0x4a2c('0x1f')]=0x0;this['talktime']=getSeconds(this[_0x4a2c('0x1b')],_0x354144['responsetime']);this[_0x4a2c('0xd')]=_0x354144[_0x4a2c('0xd')];this['membername']=_0x4a2c('0x20');this['reason']=_0x324449['cause-txt'];this['callback']=_0x354144['callback'];this[_0x4a2c('0x21')]=_0x354144[_0x4a2c('0x21')];this[_0x4a2c('0x22')]=_0x354144[_0x4a2c('0x22')];this[_0x4a2c('0x23')]=_0x354144[_0x4a2c('0x23')];this[_0x4a2c('0x24')]=_0x354144['ContactId'];this[_0x4a2c('0x25')]=_0x354144[_0x4a2c('0x25')];this[_0x4a2c('0x26')]=_0x354144[_0x4a2c('0x26')];this[_0x4a2c('0x27')]=_0x354144[_0x4a2c('0x27')];this[_0x4a2c('0x28')]=_0x354144[_0x4a2c('0x28')];}module[_0x4a2c('0x29')]=Hangup; \ No newline at end of file +var _0x8701=['campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ListId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type'];(function(_0x7f6a21,_0x345b98){var _0x335917=function(_0x1bbc16){while(--_0x1bbc16){_0x7f6a21['push'](_0x7f6a21['shift']());}};_0x335917(++_0x345b98);}(_0x8701,0x7a));var _0x1870=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0x8701[_0x186d17];return _0x5d4b89;};'use strict';var util=require(_0x1870('0x0'));var _=require(_0x1870('0x1'));var moment=require(_0x1870('0x2'));function getSeconds(_0x1e0b91,_0x21a230){var _0x58522f=moment(_0x1e0b91)[_0x1870('0x3')](0x0);var _0x5409c1=moment(_0x21a230)['milliseconds'](0x0);return _0x58522f[_0x1870('0x4')](_0x5409c1,_0x1870('0x5'));}function Hangup(_0x3609b1,_0x4fe445){this['state']=0x4;this[_0x1870('0x6')]=_0x1870('0x7');this[_0x1870('0x8')]=_0x3609b1[_0x1870('0x8')];this[_0x1870('0x9')]=_0x3609b1['type'];this[_0x1870('0xa')]=_0x3609b1['type']===_0x1870('0xb')?'queue':_0x3609b1[_0x1870('0x9')];this[_0x1870('0xc')]=_0x3609b1[_0x1870('0xc')];this[_0x1870('0xd')]=_0x3609b1[_0x1870('0xd')];this[_0x1870('0xe')]=_0x3609b1[_0x1870('0xe')];this[_0x1870('0xf')]=_0x3609b1[_0x1870('0xc')]+_0x3609b1[_0x1870('0xd')]+_0x3609b1[_0x1870('0xe')]+_0x3609b1['countnosuchnumberretry']+_0x3609b1[_0x1870('0x10')]+_0x3609b1[_0x1870('0x11')]+_0x3609b1[_0x1870('0x12')]+_0x3609b1['countagentrejectretry'];this['countnosuchnumberretry']=_0x3609b1[_0x1870('0x13')];this[_0x1870('0x10')]=_0x3609b1[_0x1870('0x10')];this[_0x1870('0x11')]=_0x3609b1['countabandonedretry'];this[_0x1870('0x12')]=_0x3609b1['countmachineretry'];this[_0x1870('0x14')]=_0x3609b1['countagentrejectretry'];this['uniqueid']=_0x4fe445['uniqueid'];this[_0x1870('0x15')]=_0x3609b1[_0x1870('0x16')];this['calleridnum']=_0x3609b1[_0x1870('0x17')];this[_0x1870('0x18')]=_0x3609b1[_0x1870('0x18')];this[_0x1870('0x19')]=_0x3609b1[_0x1870('0x19')];this[_0x1870('0x1a')]=moment()[_0x1870('0x1b')](_0x1870('0x1c'));this[_0x1870('0x1d')]=getSeconds(_0x3609b1[_0x1870('0x19')],_0x3609b1[_0x1870('0x18')]);this[_0x1870('0x1e')]=0x0;this[_0x1870('0x1f')]=getSeconds(this['endtime'],_0x3609b1[_0x1870('0x19')]);this[_0x1870('0x20')]=_0x3609b1[_0x1870('0x20')];this[_0x1870('0x21')]=_0x1870('0x22');this[_0x1870('0x23')]=_0x4fe445[_0x1870('0x24')];this[_0x1870('0x25')]=_0x3609b1['callback'];this[_0x1870('0x26')]=_0x3609b1['callbackuniqueid'];this[_0x1870('0x27')]=_0x3609b1[_0x1870('0x27')];this[_0x1870('0x28')]=_0x3609b1[_0x1870('0x28')];this['ContactId']=_0x3609b1['ContactId'];this[_0x1870('0x29')]=_0x3609b1[_0x1870('0x29')];this['UserId']=_0x3609b1['UserId'];this['VoiceQueueId']=_0x3609b1['VoiceQueueId'];this[_0x1870('0x2a')]=_0x3609b1[_0x1870('0x2a')];}module[_0x1870('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index f183463..c503ddb 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 _0x6ed5=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6ed5,0xe2));var _0x56ed=function(_0x374079,_0x38d886){_0x374079=_0x374079-0x0;var _0x494dfd=_0x6ed5[_0x374079];return _0x494dfd;};'use strict';var util=require(_0x56ed('0x0'));var _=require(_0x56ed('0x1'));var moment=require('moment');function getSeconds(_0xa83278,_0x270a9f){var _0x36b70c=moment(_0xa83278)['milliseconds'](0x0);var _0x473584=moment(_0x270a9f)['milliseconds'](0x0);return _0x36b70c[_0x56ed('0x2')](_0x473584,_0x56ed('0x3'));}function History(_0xbdf302){this[_0x56ed('0x4')]=_0xbdf302[_0x56ed('0x4')];this[_0x56ed('0x5')]=_0xbdf302['scheduledat']||undefined;this[_0x56ed('0x6')]=_0xbdf302['type'];this[_0x56ed('0x7')]=_0xbdf302[_0x56ed('0x6')]===_0x56ed('0x8')?_0x56ed('0x9'):_0xbdf302[_0x56ed('0x6')];this[_0x56ed('0xa')]=_0xbdf302[_0x56ed('0xa')];this['countcongestionretry']=_0xbdf302[_0x56ed('0xb')];this['countnoanswerretry']=_0xbdf302[_0x56ed('0xc')];this[_0x56ed('0xd')]=_0xbdf302[_0x56ed('0xa')]+_0xbdf302[_0x56ed('0xb')]+_0xbdf302[_0x56ed('0xc')]+_0xbdf302[_0x56ed('0xe')]+_0xbdf302['countdropretry']+_0xbdf302[_0x56ed('0xf')]+_0xbdf302[_0x56ed('0x10')]+_0xbdf302[_0x56ed('0x11')];this[_0x56ed('0xe')]=_0xbdf302[_0x56ed('0xe')];this['countdropretry']=_0xbdf302[_0x56ed('0x12')];this[_0x56ed('0xf')]=_0xbdf302[_0x56ed('0xf')];this[_0x56ed('0x10')]=_0xbdf302['countmachineretry'];this[_0x56ed('0x11')]=_0xbdf302[_0x56ed('0x11')];this[_0x56ed('0x9')]=_0xbdf302[_0x56ed('0x9')];this[_0x56ed('0x13')]=_0xbdf302[_0x56ed('0x14')];this[_0x56ed('0x15')]=_0xbdf302[_0x56ed('0x16')];this[_0x56ed('0x17')]=_0xbdf302[_0x56ed('0x17')];this[_0x56ed('0x18')]=_0xbdf302['responsetime'];this[_0x56ed('0x19')]=_0xbdf302['responsetime'];this[_0x56ed('0x1a')]=getSeconds(_0xbdf302['responsetime'],_0xbdf302[_0x56ed('0x17')]);this[_0x56ed('0x1b')]=0x0;this[_0x56ed('0x1c')]=0x0;this[_0x56ed('0x1d')]=_0xbdf302[_0x56ed('0x1d')];this[_0x56ed('0x1e')]=_0xbdf302['callbackuniqueid'];this['callbackat']=_0xbdf302[_0x56ed('0x1f')];this['recallme']=_0xbdf302[_0x56ed('0x20')];this[_0x56ed('0x21')]=_0xbdf302[_0x56ed('0x21')];this[_0x56ed('0x22')]=_0xbdf302['ListId'];this[_0x56ed('0x23')]=_0xbdf302['UserId'];this[_0x56ed('0x24')]=_0xbdf302[_0x56ed('0x24')];this[_0x56ed('0x25')]=_0xbdf302[_0x56ed('0x25')];this[_0x56ed('0x26')]=_0xbdf302[_0x56ed('0x26')]||'';this[_0x56ed('0x27')]=_0xbdf302[_0x56ed('0x27')]||'';}module['exports']=History; \ No newline at end of file +var _0x3aa4=['countbusyretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','starttime','endtime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry'];(function(_0xda7824,_0x496438){var _0x322494=function(_0x3ad482){while(--_0x3ad482){_0xda7824['push'](_0xda7824['shift']());}};_0x322494(++_0x496438);}(_0x3aa4,0x11c));var _0x43aa=function(_0x4ec007,_0x3f9e7c){_0x4ec007=_0x4ec007-0x0;var _0x33ca59=_0x3aa4[_0x4ec007];return _0x33ca59;};'use strict';var util=require('util');var _=require(_0x43aa('0x0'));var moment=require('moment');function getSeconds(_0x290fc5,_0x30bbe3){var _0x3b4c89=moment(_0x290fc5)[_0x43aa('0x1')](0x0);var _0x22c699=moment(_0x30bbe3)[_0x43aa('0x1')](0x0);return _0x3b4c89[_0x43aa('0x2')](_0x22c699,_0x43aa('0x3'));}function History(_0x45312d){this[_0x43aa('0x4')]=_0x45312d[_0x43aa('0x4')];this[_0x43aa('0x5')]=_0x45312d[_0x43aa('0x5')]||undefined;this[_0x43aa('0x6')]=_0x45312d[_0x43aa('0x6')];this[_0x43aa('0x7')]=_0x45312d[_0x43aa('0x6')]===_0x43aa('0x8')?_0x43aa('0x9'):_0x45312d[_0x43aa('0x6')];this['countbusyretry']=_0x45312d['countbusyretry'];this['countcongestionretry']=_0x45312d[_0x43aa('0xa')];this[_0x43aa('0xb')]=_0x45312d[_0x43aa('0xb')];this['countglobal']=_0x45312d[_0x43aa('0xc')]+_0x45312d[_0x43aa('0xa')]+_0x45312d[_0x43aa('0xb')]+_0x45312d['countnosuchnumberretry']+_0x45312d[_0x43aa('0xd')]+_0x45312d[_0x43aa('0xe')]+_0x45312d[_0x43aa('0xf')]+_0x45312d[_0x43aa('0x10')];this[_0x43aa('0x11')]=_0x45312d[_0x43aa('0x11')];this[_0x43aa('0xd')]=_0x45312d[_0x43aa('0xd')];this[_0x43aa('0xe')]=_0x45312d[_0x43aa('0xe')];this[_0x43aa('0xf')]=_0x45312d[_0x43aa('0xf')];this[_0x43aa('0x10')]=_0x45312d['countagentrejectretry'];this[_0x43aa('0x9')]=_0x45312d[_0x43aa('0x9')];this[_0x43aa('0x12')]=_0x45312d[_0x43aa('0x13')];this['calleridnum']=_0x45312d['number'];this[_0x43aa('0x14')]=_0x45312d[_0x43aa('0x14')];this['responsetime']=_0x45312d['responsetime'];this[_0x43aa('0x15')]=_0x45312d[_0x43aa('0x16')];this[_0x43aa('0x17')]=getSeconds(_0x45312d[_0x43aa('0x16')],_0x45312d[_0x43aa('0x14')]);this[_0x43aa('0x18')]=0x0;this[_0x43aa('0x19')]=0x0;this[_0x43aa('0x1a')]=_0x45312d[_0x43aa('0x1a')];this[_0x43aa('0x1b')]=_0x45312d[_0x43aa('0x1b')];this[_0x43aa('0x1c')]=_0x45312d[_0x43aa('0x1c')];this['recallme']=_0x45312d[_0x43aa('0x1d')];this['ContactId']=_0x45312d[_0x43aa('0x1e')];this[_0x43aa('0x1f')]=_0x45312d[_0x43aa('0x1f')];this['UserId']=_0x45312d[_0x43aa('0x20')];this[_0x43aa('0x21')]=_0x45312d[_0x43aa('0x21')];this[_0x43aa('0x22')]=_0x45312d[_0x43aa('0x22')];this[_0x43aa('0x23')]=_0x45312d[_0x43aa('0x23')]||'';this[_0x43aa('0x24')]=_0x45312d[_0x43aa('0x24')]||'';}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 d7162fd..dc39f63 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 _0x25d9=['isEmpty','Error','stringify','emit','outbound','strategy','answered','available','loggedIn','sumHoldTime','talking','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','callerid','format','campaign:ivr:%s','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','seconds','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','inspect','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','clearZombieChannels','[uniqueid]','[actions]','isNil','channel','catch','No\x20such\x20channel','ivr','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','[getVoiceQueueRtPauses]\x20','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','uniqueid','variable','exten','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','Machine','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','[rescheduleContact][Machine]','saveInDb','MACHINE','countglobal','countnoanswerretry','countdropretry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','moveContactManagedDialer','[syncHangupIvr]','dialQueueProject','AGI','outboundUnknownCallsDay','cause-txt','Unknow','syncAgentComplete','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','Abandoned','actionid','locked','stateinterface','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','push','Action','command','iftime\x20%s,%s','interval','indexOf','content','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','predictive','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','pow','replace','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','substring','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','averageHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','getVoiceQueueRtPauses','predictiveIntervalAvgTalktime','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','check\x20failure','startMethodPredictive','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','Agent','log','Contact\x20updated','outboundReCallsDay','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','pick','[actionOriginateIvr]\x20','[getContactCampaign2]','booked','dialLimitQueue','pTalking','not_inuse','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','emptyContact','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','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','Umin\x20=\x20','util','bluebird','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncHangup','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x25d9,0x1d1));var _0x925d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x25d9[_0x57b54c];return _0x59cc19;};'use strict';var util=require(_0x925d('0x0'));var _=require('lodash');var BPromise=require(_0x925d('0x1'));var uuid=require('uuid');var moment=require(_0x925d('0x2'));var rr=require('rr');var md5=require(_0x925d('0x3'));var Redis=require(_0x925d('0x4'));var ut=require('../preview/util/util');var config=require(_0x925d('0x5'));var logger=require(_0x925d('0x6'))(_0x925d('0x7'));var loggerBooked=require(_0x925d('0x6'))('booked');var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0x925d('0x6'))(_0x925d('0x8'));var loggerSyncQueueSummary=require(_0x925d('0x6'))(_0x925d('0x9'));var ami=require(_0x925d('0xa'));config['redis']=_[_0x925d('0xb')](config[_0x925d('0xc')],{'host':_0x925d('0xd'),'port':0x18eb});var io=require(_0x925d('0xe'))(new Redis(config[_0x925d('0xc')]));var cmHopper=require(_0x925d('0xf'));var cmHopperFinal=require(_0x925d('0x10'));var cmHopperHistory=require(_0x925d('0x11'));var cmHopperBlack=require(_0x925d('0x12'));var voiceQueueRt=require(_0x925d('0x13'));var Action=require(_0x925d('0x14'));var History=require(_0x925d('0x15'));var Final=require('./final');var AgentComplete=require(_0x925d('0x16'));var QueueCallerAbandon=require(_0x925d('0x17'));var Hangup=require(_0x925d('0x18'));var ipAgi=process[_0x925d('0x19')]['XCALLY_IP_AGI']||_0x925d('0x1a');var strategy={'rrmemory':_0x925d('0x1b'),'roundrobin':_0x925d('0x1c')};var Sequence=function(){};Sequence[_0x925d('0x1d')]['enqueue']=function(_0xaa0299){this[_0x925d('0x1e')]=this[_0x925d('0x1e')]?this[_0x925d('0x1e')][_0x925d('0x1f')](_0xaa0299):_0xaa0299();};function Dialer(_0x1dbf64,_0x337997){this['sequence']=new Sequence();this[_0x925d('0x20')]=_0x337997;this[_0x925d('0x21')]=_0x1dbf64[_0x925d('0x21')];this[_0x925d('0x22')]=_0x1dbf64[_0x925d('0x22')];this[_0x925d('0x23')]=_0x1dbf64[_0x925d('0x23')];this[_0x925d('0x24')]=_0x1dbf64[_0x925d('0x24')];this[_0x925d('0x25')]=config[_0x925d('0x25')]||0x2;this[_0x925d('0x26')]={};this[_0x925d('0x27')]={};this[_0x925d('0x28')]={};this[_0x925d('0x29')]={};this[_0x925d('0x2a')]={};this[_0x925d('0x2b')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0x925d('0x2c')]={};this[_0x925d('0x2d')]={};ami['on'](_0x925d('0x2e'),this[_0x925d('0x2f')][_0x925d('0x30')](this));ami['on'](_0x925d('0x31'),this[_0x925d('0x32')][_0x925d('0x30')](this));ami['on']('originateresponse',this[_0x925d('0x33')][_0x925d('0x30')](this));ami['on'](_0x925d('0x34'),this['syncAgentComplete'][_0x925d('0x30')](this));ami['on']('custom:queuesummary',this[_0x925d('0x9')][_0x925d('0x30')](this));ami['on']('hangup',this[_0x925d('0x35')][_0x925d('0x30')](this));ami['on']('newexten',this[_0x925d('0x36')][_0x925d('0x30')](this));ami['on'](_0x925d('0x37'),this[_0x925d('0x38')]['bind'](this));ami['on']('queuemember',this[_0x925d('0x39')][_0x925d('0x30')](this));ami['on'](_0x925d('0x3a'),this['syncQueueStatusComplete'][_0x925d('0x30')](this));this[_0x925d('0x3b')]();this[_0x925d('0x3c')]();}function isNotNull(_0x5da90c){return _0x5da90c!==null&&!_[_0x925d('0x3d')](_0x5da90c);}function checkIsLoggedIn(_0xfe7580,_0x8cda77){return function(){if(_0x8cda77<=0x0){_0xfe7580[_0x925d('0x3e')]=_0x925d('0x3f');throw _0xfe7580[_0x925d('0x40')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x439774){return _0x439774;}function checkIsActive(_0x4b3071,_0x33bd98){return function(){if(!isActive(_0x33bd98)){_0x4b3071[_0x925d('0x3e')]=_0x925d('0x41');throw _0x4b3071[_0x925d('0x40')]+'\x20NOT\x20Active';}};}function checkInterval(_0x2dad89){return function(){if(!isNotNull(_0x2dad89[_0x925d('0x42')])){_0x2dad89[_0x925d('0x3e')]=_0x925d('0x43');throw _0x2dad89[_0x925d('0x40')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x2dad89[_0x925d('0x42')][_0x925d('0x44')])){_0x2dad89[_0x925d('0x3e')]=_0x925d('0x43');throw _0x2dad89[_0x925d('0x40')]+_0x925d('0x45');}if(!isNotNull(_[_0x925d('0x46')](_0x2dad89[_0x925d('0x42')]['Intervals']))){_0x2dad89[_0x925d('0x3e')]=_0x925d('0x43');throw _0x2dad89[_0x925d('0x40')]+_0x925d('0x45');}};}function msgResponse(_0x15c91a,_0x174e24,_0x58f385){return{'action':_0x15c91a,'response':_0x174e24,'message':_0x58f385,'stack':_0x58f385};}function myreject(_0x4e6bd7){return function(_0xa4a1a0){return _0x4e6bd7(msgResponse('[ifTime][Action]',_0x925d('0x47'),JSON[_0x925d('0x48')](_0xa4a1a0)));};}function getSeconds(_0x3988f4,_0x138deb){var _0x32f63b=moment(_0x3988f4)['milliseconds'](0x0);var _0x5d272c=moment(_0x138deb)['milliseconds'](0x0);return _0x32f63b['diff'](_0x5d272c,'seconds');}function emit(_0x4d9361,_0x45ce13,_0x233635){io['to'](_0x4d9361)[_0x925d('0x49')](_0x45ce13,_0x233635);}function emitVoiceQueueSummary(_0x32d09e){if(_0x32d09e['type']===_0x925d('0x4a')){var _0x2a1633={'id':_0x32d09e['id'],'name':_0x32d09e['name'],'strategy':_0x32d09e[_0x925d('0x4b')],'answered':_0x32d09e[_0x925d('0x4c')],'available':_0x32d09e[_0x925d('0x4d')],'loggedIn':_0x32d09e[_0x925d('0x4e')],'pTalking':_0x32d09e['pTalking'],'sumBillable':_0x32d09e['sumBillable'],'sumDuration':_0x32d09e['sumDuration'],'sumHoldTime':_0x32d09e[_0x925d('0x4f')]||0x0,'talking':_0x32d09e[_0x925d('0x50')],'total':_0x32d09e['total'],'type':_0x32d09e[_0x925d('0x51')],'unmanaged':_0x32d09e[_0x925d('0x52')],'abandoned':_0x32d09e[_0x925d('0x53')],'waiting':_0x32d09e[_0x925d('0x54')],'loggedInDb':_0x32d09e[_0x925d('0x55')],'dialActive':_0x32d09e[_0x925d('0x56')],'dialMethod':_0x32d09e[_0x925d('0x57')],'dialOriginateCallerIdName':_0x32d09e[_0x925d('0x58')],'dialOriginateCallerIdNumber':_0x32d09e['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x32d09e[_0x925d('0x59')],'dialPrefix':_0x32d09e[_0x925d('0x5a')],'outboundAnswerAgiCallsDay':_0x32d09e[_0x925d('0x5b')],'outboundAnswerCallsDay':_0x32d09e[_0x925d('0x5c')],'outboundBlacklistCallsDay':_0x32d09e[_0x925d('0x5d')],'outboundBusyCallsDay':_0x32d09e['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x32d09e[_0x925d('0x5e')],'outboundDropCallsDayACS':_0x32d09e[_0x925d('0x5f')],'outboundDropCallsDayCallersExit':_0x32d09e[_0x925d('0x60')],'outboundDropCallsDayTimeout':_0x32d09e[_0x925d('0x61')],'outboundNoAnswerCallsDay':_0x32d09e[_0x925d('0x62')],'outboundNoSuchCallsDay':_0x32d09e[_0x925d('0x63')],'outboundOriginateFailureCallsDay':_0x32d09e[_0x925d('0x64')],'outboundReCallsDay':_0x32d09e['outboundReCallsDay'],'outboundRejectCallsDay':_0x32d09e[_0x925d('0x65')],'outboundUnknownCallsDay':_0x32d09e['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x32d09e[_0x925d('0x66')],'predictiveIntervalAvgHoldtime':_0x32d09e[_0x925d('0x67')],'predictiveIntervalAvgTalktime':_0x32d09e['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x32d09e[_0x925d('0x68')],'predictiveIntervalDroppedCallsTimeout':_0x32d09e[_0x925d('0x69')],'predictiveIntervalErlangCalls':_0x32d09e[_0x925d('0x6a')],'predictiveIntervalErlangCallsDroppedCalls':_0x32d09e['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x32d09e[_0x925d('0x6b')],'predictiveIntervalMultiplicativeFactor':_0x32d09e['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x32d09e['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x32d09e[_0x925d('0x6c')],'predictiveIntervalTotalCalls':_0x32d09e[_0x925d('0x6d')],'message':_0x32d09e['message'],'originated':_0x32d09e[_0x925d('0x6e')],'erlangCalls':_0x32d09e[_0x925d('0x6f')],'erlangCallToSecond':_0x32d09e[_0x925d('0x70')],'erlangAbandonmentRate':_0x32d09e[_0x925d('0x71')],'erlangBusyFactor':_0x32d09e[_0x925d('0x72')],'startPredictive':_0x32d09e['startPredictive'],'startProgressive':_0x32d09e[_0x925d('0x73')]};if(_0x32d09e['Trunk']){_0x2a1633[_0x925d('0x74')]={'id':_0x32d09e[_0x925d('0x74')]['id'],'name':_0x32d09e[_0x925d('0x74')]['name'],'active':_0x32d09e['Trunk']['active'],'callerid':_0x32d09e[_0x925d('0x74')][_0x925d('0x75')]};}if(_0x32d09e['Interval']){_0x2a1633[_0x925d('0x42')]={'id':_0x32d09e[_0x925d('0x42')]['id'],'name':_0x32d09e['Interval'][_0x925d('0x40')]};}var _0x40ad01=md5(JSON['stringify'](_0x2a1633));if(_0x32d09e[_0x925d('0x3')]!==_0x40ad01){_0x32d09e[_0x925d('0x3')]=_0x40ad01;emit(util[_0x925d('0x76')]('voice:queue:%s',_0x2a1633[_0x925d('0x40')]),'voice_queue:save',_0x2a1633);}}}function emitCampaignSummary(_0x312731){if(_0x312731[_0x925d('0x51')]==='ivr'){emit(util[_0x925d('0x76')](_0x925d('0x77'),_0x312731[_0x925d('0x40')]),'campaign:save',_0x312731);}}function checkGetDataPredictive(_0x53617b){if(isNotNull(_0x53617b)){if(!_[_0x925d('0x46')](_0x53617b)){loggerPredictive[_0x925d('0x78')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info'](_0x925d('0x79'),_0x53617b[_0x925d('0x6d')]);loggerPredictive[_0x925d('0x78')](_0x925d('0x7a'),_0x53617b[_0x925d('0x66')]);loggerPredictive[_0x925d('0x78')](_0x925d('0x7b'),_0x53617b[_0x925d('0x69')]);loggerPredictive[_0x925d('0x78')](_0x925d('0x7c'),_0x53617b[_0x925d('0x68')]);loggerPredictive[_0x925d('0x78')](_0x925d('0x7d'),_0x53617b[_0x925d('0x67')]);loggerPredictive[_0x925d('0x78')](_0x925d('0x7e'),_0x53617b['predictiveIntervalAvgTalktime']);loggerPredictive[_0x925d('0x78')](_0x925d('0x7f'));if(_0x53617b['predictiveIntervalTotalCalls']>0x0){if(!_[_0x925d('0x3d')](_0x53617b['predictiveIntervalAvgTalktime'])&&_0x53617b['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0x925d('0x78')](_0x925d('0x80'));}if(!_['isUndefined'](_0x53617b[_0x925d('0x67')])&&_0x53617b[_0x925d('0x67')]>0x0){return!![];}else{loggerPredictive[_0x925d('0x78')](_0x925d('0x81'));}}else{loggerPredictive[_0x925d('0x78')](_0x925d('0x82'));}}else{loggerPredictive[_0x925d('0x78')]('History\x20information\x20are\x20empty');}}else{loggerPredictive[_0x925d('0x78')](_0x925d('0x83'));}return![];}function mergeDataErlangB(_0x11a188){return function(_0x16a794){loggerPredictive['info'](_0x925d('0x84'));loggerPredictive['info'](_0x925d('0x85'),_0x16a794[_0x925d('0x6f')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x16a794[_0x925d('0x70')]);loggerPredictive[_0x925d('0x78')](_0x925d('0x86'),_0x16a794[_0x925d('0x71')]);loggerPredictive[_0x925d('0x78')](_0x925d('0x87'),_0x16a794[_0x925d('0x72')]);loggerPredictive[_0x925d('0x78')](_0x925d('0x86'),_0x16a794[_0x925d('0x71')]);loggerPredictive[_0x925d('0x78')]('---------------------------');_[_0x925d('0x88')](_0x11a188,_0x16a794);};}function getDiff(_0x579d3d){var _0x57f696=moment()['milliseconds'](0x0);var _0x2089e9=moment(_0x579d3d)['milliseconds'](0x0);return _0x57f696[_0x925d('0x89')](_0x2089e9,_0x925d('0x8a'));}function ifInterval(_0x369247,_0x1be364){if(_[_0x925d('0x3d')](_0x1be364)){return![];}if(getDiff(_0x1be364)<_0x369247*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x48c703){if(isNotNull(_0x48c703)){if(!_[_0x925d('0x3d')](_0x48c703[_0x925d('0x73')])){_0x48c703[_0x925d('0x73')]=undefined;loggerPredictive[_0x925d('0x78')](_0x48c703[_0x925d('0x40')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x925d('0x3d')](_0x48c703['startPredictive'])){_0x48c703['startPredictive']=undefined;loggerPredictive['info'](_0x48c703[_0x925d('0x40')],_0x925d('0x8b'));}if(!_[_0x925d('0x3d')](_0x48c703[_0x925d('0x8c')])){clearInterval(_0x48c703['handlePredictive']);_0x48c703[_0x925d('0x8c')]=undefined;loggerPredictive[_0x925d('0x78')](_0x48c703['name'],_0x925d('0x8d'));}}}function erlangb(_0x33f2da,_0x170132){if(_0x170132===0x0){return 0x0;}var _0x3b1cae=0x1;for(var _0x3a0fa0=0x1;_0x3a0fa0<=_0x170132;_0x3a0fa0+=0x1){_0x3b1cae=0x1+_0x3b1cae*_0x3a0fa0/_0x33f2da;}return 0x1/_0x3b1cae;}function isVoiceQueueOutbound(_0x3ceb80){return _0x3ceb80===_0x925d('0x4a');}function isNotPreview(_0x3d218d){return _0x3d218d!==_0x925d('0x20');}function isCampaignIvr(_0x2e1240){return _0x2e1240==='ivr';}function getCallerId(_0x29668e,_0x194840,_0x1179ab){if(!_['isUndefined'](_0x1179ab)&&_0x925d('0x8e')===typeof _0x1179ab&&!_[_0x925d('0x46')](_0x1179ab)){if(!_[_0x925d('0x3d')](_0x194840)&&_0x925d('0x8e')===typeof _0x194840&&!_[_0x925d('0x46')](_0x194840)){return util['format'](_0x925d('0x8f'),_0x194840,_0x1179ab);}return util[_0x925d('0x76')](_0x925d('0x8f'),_0x1179ab,_0x1179ab);}if(!_[_0x925d('0x3d')](_0x29668e)&&'string'===typeof _0x29668e&&!_[_0x925d('0x46')](_0x29668e)){return _0x29668e;}return _0x925d('0x90');}function loggerCatchQueueSummary(_0x2ba0d3,_0x9b2436){return function(_0x14a3d7){freeVariablesPredictive(_0x9b2436);emitVoiceQueueSummary(_0x9b2436);emitCampaignSummary(_0x9b2436);loggerSyncQueueSummary[_0x925d('0x91')](_0x2ba0d3,util['inspect'](_0x14a3d7,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xf7c73b,_0x4ad97b){return function(_0x204f8f){loggerPredictive[_0x925d('0x91')](_0x4ad97b[_0x925d('0x40')],_0xf7c73b);loggerPredictive['error'](_0x204f8f[_0x925d('0x92')]);freeVariablesPredictive(_0x4ad97b);};}function loggerCatch(_0x895a0f){return function(_0x1f67aa){logger['error'](_0x895a0f,util['inspect'](_0x1f67aa,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1d5630){return _0x1d5630&&!_[_0x925d('0x3d')](_0x1d5630)&&_0x1d5630[_0x925d('0x93')]>0x0;}function decremetOriginate(_0x284a68){if(!_['isUndefined'](_0x284a68)&&_0x284a68!==null){if(_0x284a68[_0x925d('0x94')]('originated')){if(_0x284a68['originated']>0x0){_0x284a68[_0x925d('0x6e')]-=0x1;}else{logger['error'](_0x925d('0x95'));}}}else{logger['error'](_0x925d('0x96'));}}function checkContactLowerLimitOriginate(_0x45bfd3,_0xc08d5e,_0xd997f6){if(_0xc08d5e>_0xd997f6){for(var _0x1c84d4=0x0;_0x1c84d4<_0xc08d5e-_0xd997f6;_0x1c84d4+=0x1){decremetOriginate(_0x45bfd3);}}}function loggerGetContactDialer(_0x26ac26,_0x63d675,_0x2deebc){return function(_0x4da983){checkContactLowerLimitOriginate(_0x63d675,_0x2deebc,0x0);logger['error'](_0x26ac26,util[_0x925d('0x97')](_0x4da983,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x154b19){return function(_0x299ec5){if(isNotNull(_0x299ec5)&&isNotNull(_0x299ec5[0x0])){if(_0x299ec5[0x0][_0x925d('0x98')]>0x0){_0x154b19[_0x925d('0x3e')]=_0x925d('0x99');logger[_0x925d('0x78')](_0x925d('0x9a')+_0x154b19[_0x925d('0x40')],_0x299ec5[0x0][_0x925d('0x98')],'contacts');}else{_0x154b19[_0x925d('0x3e')]=_0x925d('0x9b');logger[_0x925d('0x78')](_0x925d('0x9c')+_0x154b19['name']);}}};}function notSendMessagesQueue(_0x347002){if(_0x347002[_0x925d('0x9d')]){freeVariablesPredictive(_0x347002);if(_0x347002[_0x925d('0x6e')]===0x0&&_0x347002[_0x925d('0x50')]===0x0&&_0x347002['waiting']===0x0&&(_0x347002['pTalking']||0x0)===0x0){_0x347002[_0x925d('0x9d')]=![];_0x347002['available']=0x0;_0x347002[_0x925d('0x3e')]=_0x925d('0x41');loggerSyncQueueSummary['error'](_0x925d('0x9e'),_0x347002[_0x925d('0x40')],'is\x20not\x20active');}else{_0x347002[_0x925d('0x3e')]=_0x925d('0x9f');loggerSyncQueueSummary[_0x925d('0x91')](_0x925d('0x9e'),_0x347002[_0x925d('0x40')],_0x925d('0xa0'));}emitVoiceQueueSummary(_0x347002);}}function notSendMessagesCampaign(_0x28d48f){if(_0x28d48f[_0x925d('0x9d')]){if(_0x28d48f[_0x925d('0x6e')]===0x0){_0x28d48f[_0x925d('0x9d')]=![];_0x28d48f['message']=_0x925d('0x41');loggerSyncQueueSummary[_0x925d('0x91')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x28d48f['name'],_0x925d('0xa1'));}else{_0x28d48f[_0x925d('0x3e')]=_0x925d('0x9f');loggerSyncQueueSummary[_0x925d('0x91')](_0x925d('0xa2'),_0x28d48f[_0x925d('0x40')],_0x925d('0xa0'));}emitCampaignSummary(_0x28d48f);}}function createObjHistory(_0xff1b23,_0x17173b,_0x445488,_0x382eb9,_0x2204a5){_0xff1b23['message']=_0x445488;var _0x17387a=new Action(_0xff1b23,_0x17173b);var _0x244d7c=new History(_0x17387a);_0x244d7c[_0x925d('0xa3')]=_0x382eb9;_0x244d7c[_0x925d('0xa4')]=_0x2204a5;_0x244d7c['endtime']=_0x17387a['starttime'];return _0x244d7c;}Dialer[_0x925d('0x1d')][_0x925d('0x3c')]=function(){var _0x4f78e8=this;setInterval(function(){_0x4f78e8[_0x925d('0xa5')](_0x4f78e8[_0x925d('0x29')],_0x925d('0xa6'));_0x4f78e8[_0x925d('0xa5')](_0x4f78e8[_0x925d('0x27')],_0x925d('0xa7'));},0x32c8);};Dialer[_0x925d('0x1d')]['clearZombieChannels']=function(_0x255269,_0xc03d81){var _0x50a423=this;for(var _0x496881 in _0x255269){if(_0x255269[_0x925d('0x94')](_0x496881)){this['sequence']['enqueue'](function(){if(!_[_0x925d('0xa8')](_0x255269[_0x496881])){return ami['Action']({'action':'status','channel':_0x255269[_0x496881][_0x925d('0xa9')]})[_0x925d('0xaa')](function(_0xdb68bb){if(_0xdb68bb[_0x925d('0x3e')]===_0x925d('0xab')){setTimeout(function(){if(_0x255269[_0x496881]&&_0x255269[_0x496881][_0x925d('0x51')]!==_0x925d('0xac')){_0x50a423['updateOriginated'](_0x50a423[_0x925d('0x21')][_0x255269[_0x496881][_0x925d('0xad')]]);logger['error'](_0x925d('0xae'),_0xc03d81,_0x496881,_0x255269[_0x496881][_0x925d('0xad')]);delete _0x255269[_0x496881];}if(_0x255269[_0x496881]&&_0x255269[_0x496881][_0x925d('0x51')]===_0x925d('0xac')){_0x50a423[_0x925d('0xaf')](_0x50a423[_0x925d('0x22')][_0x255269[_0x496881][_0x925d('0xad')]]);logger[_0x925d('0x91')](_0x925d('0xb0'),_0xc03d81,_0x496881,_0x255269[_0x496881][_0x925d('0xad')]);delete _0x255269[_0x496881];}},0x2328);}});}});}}};Dialer[_0x925d('0x1d')][_0x925d('0xb1')]=function(_0x153828){return BPromise[_0x925d('0xb2')]()[_0x925d('0xb3')](cmHopper[_0x925d('0xb1')](_0x153828))['catch'](loggerCatch(_0x925d('0xb4')));};Dialer['prototype'][_0x925d('0xb5')]=function(_0x48745e){return BPromise[_0x925d('0xb2')]()[_0x925d('0xb3')](cmHopperBlack[_0x925d('0xb5')](_0x48745e))['catch'](loggerCatch(_0x925d('0xb6')));};Dialer['prototype'][_0x925d('0xb7')]=function(_0x280bff){return BPromise['resolve']()[_0x925d('0xb3')](cmHopperBlack[_0x925d('0xb7')](_0x280bff))[_0x925d('0xaa')](loggerCatch(_0x925d('0xb8')));};Dialer[_0x925d('0x1d')]['averageHandleTime']=function(_0x4aee5a){return BPromise['resolve']()[_0x925d('0xb3')](cmHopperHistory[_0x925d('0xb9')](_0x4aee5a))[_0x925d('0xaa')](loggerCatch(_0x925d('0xba')));};Dialer[_0x925d('0x1d')][_0x925d('0xbb')]=function(_0x35a16a){return BPromise[_0x925d('0xb2')]()[_0x925d('0xb3')](cmHopper[_0x925d('0xbb')](_0x35a16a))[_0x925d('0xaa')](loggerCatch(_0x925d('0xbc')));};Dialer[_0x925d('0x1d')][_0x925d('0xbd')]=function(_0x1ea0bd,_0x119fde,_0x1c2dcc){return BPromise[_0x925d('0xb2')]()[_0x925d('0xb3')](cmHopper['unlockContact'](_0x1ea0bd,_0x119fde,_0x1c2dcc))['catch'](loggerCatch(_0x925d('0xbe')));};Dialer[_0x925d('0x1d')][_0x925d('0xbf')]=function(_0x2dfd45,_0x6d5c78,_0x30f8d3,_0x581802){return BPromise['resolve']()[_0x925d('0xb3')](cmHopper[_0x925d('0xbf')](_0x2dfd45,_0x6d5c78,_0x30f8d3,_0x581802))[_0x925d('0xaa')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x925d('0x1d')][_0x925d('0xc0')]=function(_0xcb699f,_0xade986,_0x396b21){return BPromise[_0x925d('0xb2')]()[_0x925d('0xb3')](cmHopper[_0x925d('0xc0')](_0xcb699f,_0xade986,_0x396b21))[_0x925d('0xaa')](loggerCatch(_0x925d('0xc1')));};Dialer[_0x925d('0x1d')]['getVoiceQueueRtPauses']=function(_0xe8e408){return BPromise[_0x925d('0xb2')]()[_0x925d('0xb3')](voiceQueueRt['getVoiceQueueRtPauses'](_0xe8e408))[_0x925d('0xaa')](loggerCatch(_0x925d('0xc2')));};Dialer[_0x925d('0x1d')]['moveContactManagedDialer']=function(_0x191a8a){return BPromise[_0x925d('0xb2')]()[_0x925d('0xb3')](cmHopper['moveContactManagedDialer'](_0x191a8a))['catch'](loggerCatch(_0x925d('0xc3')));};Dialer[_0x925d('0x1d')][_0x925d('0xc4')]=function(_0x1fd050){return BPromise[_0x925d('0xb2')]()[_0x925d('0xb3')](cmHopperHistory[_0x925d('0xc4')](_0x1fd050))[_0x925d('0xaa')](loggerCatch('[createHistory]\x20'));};Dialer[_0x925d('0x1d')][_0x925d('0xaf')]=function(_0x537f84){if(!_[_0x925d('0x3d')](_0x537f84)&&_0x537f84!==null){if(_0x537f84['hasOwnProperty'](_0x925d('0x6e'))){if(_0x537f84['originated']>0x0){_0x537f84['originated']-=0x1;}else{logger[_0x925d('0x91')](_0x925d('0xc5'));}}}else{logger[_0x925d('0x91')](_0x925d('0xc6'));}};Dialer[_0x925d('0x1d')][_0x925d('0xc7')]=function(_0x30bb9b,_0x37d97a){var _0x487be0=this;return function(_0x56cfa8){_0x487be0[_0x925d('0xaf')](_0x37d97a);logger[_0x925d('0x91')](_0x30bb9b,util[_0x925d('0x97')](_0x56cfa8,{'showHidden':![],'depth':null}));};};Dialer[_0x925d('0x1d')]['emptyContact']=function(_0x38b480,_0x1736dc,_0x3bf00b){var _0x4e21e7={'state':0x19,'statedesc':_0x925d('0xc8')};this[_0x925d('0xaf')](_0x1736dc);this['saveInDb'](_[_0x925d('0x88')](_0x4e21e7,_['pick'](_0x3bf00b,[_0x925d('0xc9'),'ListId',_0x925d('0xca'),_0x925d('0xcb'),_0x925d('0xcc')])),_0x925d('0xcd'),'[emptyContact]');logger[_0x925d('0x91')](_0x38b480);};Dialer[_0x925d('0x1d')][_0x925d('0xce')]=function(_0x14885b){return _0x14885b===_0x925d('0xcf');};Dialer[_0x925d('0x1d')][_0x925d('0xd0')]=function(_0x2ec46d){return!_[_0x925d('0x3d')](_0x2ec46d)&&_0x2ec46d&&!_[_0x925d('0x3d')](_0x2ec46d[_0x925d('0x40')])&&!_['isUndefined'](_0x2ec46d['active'])&&_0x2ec46d[_0x925d('0xd1')]&&(this['trunks'][util[_0x925d('0x76')](_0x925d('0xd2'),_0x2ec46d[_0x925d('0x40')])][_0x925d('0xd3')]===_0x925d('0xd4')||this[_0x925d('0x24')][util[_0x925d('0x76')]('SIP/%s',_0x2ec46d[_0x925d('0x40')])][_0x925d('0xd3')]===_0x925d('0xd5'));};Dialer['prototype']['saveInDb']=function(_0x2ced35,_0x29033b,_0x3d4de2){this[_0x925d('0xc4')](_0x2ced35)['catch'](loggerCatch(_0x29033b));this['moveContactManagedDialer'](_0x2ced35)[_0x925d('0xaa')](loggerCatch(_0x3d4de2));};Dialer['prototype'][_0x925d('0x38')]=function(_0x414b1a){var _0x3a74d1=this[_0x925d('0x29')][_0x414b1a[_0x925d('0xd6')]];var _0x5b92f8;if(!_['isNil'](_0x414b1a)&&!_[_0x925d('0xa8')](_0x414b1a[_0x925d('0xd7')])&&!_[_0x925d('0xa8')](_0x414b1a['variable']['amdstatus'])&&_0x414b1a[_0x925d('0xd8')]==='xcally-motion-dialer'&&_0x3a74d1){if(_0x3a74d1[_0x925d('0x51')]!==_0x925d('0xac')&&this[_0x925d('0x21')][_0x3a74d1['queue']][_0x925d('0xd9')]&&_0x414b1a[_0x925d('0xda')]===_0x925d('0xdb')){delete this[_0x925d('0x29')][_0x414b1a['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x3a74d1['queue']]);this[_0x925d('0x21')][_0x3a74d1[_0x925d('0xad')]]['outboundAnswerCallsDay']+=0x1;this[_0x925d('0x21')][_0x3a74d1[_0x925d('0xad')]][_0x925d('0x5b')]+=0x1;_0x5b92f8=new Hangup(_0x3a74d1,_0x414b1a);_0x5b92f8[_0x925d('0xa3')]=0x12;_0x5b92f8[_0x925d('0xa4')]=_0x925d('0xdc');_0x5b92f8[_0x925d('0xdd')]=_0x925d('0xde');this['saveInDb'](_0x5b92f8,_0x925d('0xdf'),'[syncHangupInAMD]');}if(_0x3a74d1[_0x925d('0x51')]!==_0x925d('0xac')&&this[_0x925d('0x21')][_0x3a74d1[_0x925d('0xad')]]['dialAMDActive']&&_0x414b1a[_0x925d('0xda')]==='MACHINE'){var _0x4c4f46=this;return new BPromise(function(_0x15e3c8,_0x1eae56){delete _0x4c4f46[_0x925d('0x29')][_0x414b1a[_0x925d('0xd6')]];_0x4c4f46[_0x925d('0xaf')](_0x4c4f46[_0x925d('0x21')][_0x3a74d1[_0x925d('0xad')]]);_0x4c4f46[_0x925d('0x21')][_0x3a74d1['queue']][_0x925d('0x5c')]+=0x1;_0x4c4f46['voiceQueues'][_0x3a74d1['queue']][_0x925d('0x5b')]+=0x1;var _0x2c0760=_0x4c4f46[_0x925d('0x21')][_0x3a74d1['queue']];var _0x577903=new Hangup(_0x3a74d1,_0x414b1a);_0x577903[_0x925d('0xa3')]=0x13;_0x577903[_0x925d('0xa4')]=_0x925d('0xe0');_0x577903[_0x925d('0xdd')]=_0x925d('0xde');_0x577903[_0x925d('0xe1')]+=0x1;_0x577903['countglobal']+=0x1;_0x577903[_0x925d('0xe2')]=!![];_0x4c4f46['createHistory'](_0x577903)['catch'](loggerCatch(_0x925d('0xe3')));if(_0x577903[_0x925d('0xe4')]+_0x577903[_0x925d('0xe5')]+_0x577903['countnoanswerretry']+_0x577903[_0x925d('0xe6')]+_0x577903['countdropretry']+_0x577903[_0x925d('0xe7')]+_0x577903['countmachineretry']+_0x577903[_0x925d('0xe8')]>=_0x2c0760[_0x925d('0xe9')]){_0x4c4f46['stateGlobal'](_0x577903,_0x15e3c8,_0x1eae56,_0x925d('0xea'));}else{if(_0x577903[_0x925d('0xe1')]>=_0x2c0760[_0x925d('0xeb')]){_0x4c4f46[_0x925d('0xec')](_0x577903,_0x15e3c8,_0x1eae56,'reason\x2019\x20machine....');}else{_0x4c4f46[_0x925d('0xbb')]({'active':![],'countmachineretry':_0x577903['countmachineretry'],'scheduledat':moment()[_0x925d('0xed')](_0x2c0760['dialMachineRetryFrequency'],_0x925d('0xee'))['format'](_0x925d('0xef')),'ContactId':_0x577903[_0x925d('0xc9')],'ListId':_0x577903[_0x925d('0xf0')],'VoiceQueueId':_0x577903[_0x925d('0xcb')]||undefined,'CampaignId':_0x577903['CampaignId']||undefined})[_0x925d('0xaa')](loggerCatch(_0x925d('0xf1')));_0x15e3c8({'reschedule':0x1});}}});}if(_0x3a74d1[_0x925d('0x51')]===_0x925d('0xac')&&this['campaigns'][_0x3a74d1[_0x925d('0xad')]][_0x925d('0xd9')]&&_0x414b1a[_0x925d('0xda')]===_0x925d('0xdb')){delete this['uniqueId'][_0x414b1a[_0x925d('0xd6')]];this[_0x925d('0xaf')](this[_0x925d('0x22')][_0x3a74d1[_0x925d('0xad')]]);_0x5b92f8=new Hangup(_0x3a74d1,_0x414b1a);_0x5b92f8[_0x925d('0xa3')]=0x12;_0x5b92f8[_0x925d('0xa4')]=_0x925d('0xdc');_0x5b92f8['membername']=_0x925d('0xde');this[_0x925d('0xf2')](_0x5b92f8,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x3a74d1['type']===_0x925d('0xac')&&this[_0x925d('0x22')][_0x3a74d1['queue']]['dialAMDActive']&&_0x414b1a[_0x925d('0xda')]===_0x925d('0xf3')){var _0x4c4f46=this;return new BPromise(function(_0x4c81e5,_0x1380c7){delete _0x4c4f46['uniqueId'][_0x414b1a[_0x925d('0xd6')]];_0x4c4f46[_0x925d('0xaf')](_0x4c4f46[_0x925d('0x22')][_0x3a74d1[_0x925d('0xad')]]);_0x4c4f46['campaigns'][_0x3a74d1[_0x925d('0xad')]][_0x925d('0x5c')]+=0x1;_0x4c4f46[_0x925d('0x22')][_0x3a74d1['queue']][_0x925d('0x5b')]+=0x1;var _0x136106=_0x4c4f46[_0x925d('0x22')][_0x3a74d1[_0x925d('0xad')]];var _0x4b2eb8=new Hangup(_0x3a74d1,_0x414b1a);_0x4b2eb8[_0x925d('0xa3')]=0x13;_0x4b2eb8[_0x925d('0xa4')]=_0x925d('0xe0');_0x4b2eb8[_0x925d('0xdd')]=_0x925d('0xde');_0x4b2eb8[_0x925d('0xe1')]+=0x1;_0x4b2eb8[_0x925d('0xf4')]+=0x1;_0x4b2eb8[_0x925d('0xe2')]=!![];_0x4c4f46[_0x925d('0xc4')](_0x4b2eb8)[_0x925d('0xaa')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4b2eb8['countbusyretry']+_0x4b2eb8['countcongestionretry']+_0x4b2eb8[_0x925d('0xf5')]+_0x4b2eb8[_0x925d('0xe6')]+_0x4b2eb8[_0x925d('0xf6')]+_0x4b2eb8[_0x925d('0xe7')]+_0x4b2eb8[_0x925d('0xe1')]+_0x4b2eb8['countagentrejectretry']>=_0x136106[_0x925d('0xe9')]){_0x4c4f46[_0x925d('0xf7')](_0x4b2eb8,_0x4c81e5,_0x1380c7,_0x925d('0xea'));}else{if(_0x4b2eb8['countmachineretry']>=_0x136106[_0x925d('0xeb')]){_0x4c4f46['createStateFinal'](_0x4b2eb8,_0x4c81e5,_0x1380c7,'reason\x2019\x20machine....');}else{_0x4c4f46[_0x925d('0xbb')]({'active':![],'countmachineretry':_0x4b2eb8[_0x925d('0xe1')],'scheduledat':moment()[_0x925d('0xed')](_0x136106['dialMachineRetryFrequency'],_0x925d('0xee'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4b2eb8['ContactId'],'ListId':_0x4b2eb8[_0x925d('0xf0')],'VoiceQueueId':_0x4b2eb8[_0x925d('0xcb')]||undefined,'CampaignId':_0x4b2eb8[_0x925d('0xcc')]||undefined})['catch'](loggerCatch(_0x925d('0xf1')));_0x4c81e5({'reschedule':0x1});}}});}}};Dialer[_0x925d('0x1d')][_0x925d('0x35')]=function(_0x44d7b9){var _0x3f0fa8=this[_0x925d('0x29')][_0x44d7b9['uniqueid']];var _0x2718cc=this;var _0xc99114;if(_0x3f0fa8&&_0x3f0fa8[_0x925d('0x51')]===_0x925d('0xac')){delete this[_0x925d('0x29')][_0x44d7b9[_0x925d('0xd6')]];this[_0x925d('0xaf')](this[_0x925d('0x22')][_0x3f0fa8[_0x925d('0xad')]]);this[_0x925d('0x22')][_0x3f0fa8[_0x925d('0xad')]][_0x925d('0xf8')]+=0x1;_0xc99114=new Hangup(_0x3f0fa8,_0x44d7b9);this[_0x925d('0xc4')](_0xc99114)[_0x925d('0xaa')](loggerCatch(_0x925d('0xf9')));this[_0x925d('0xfa')](_0xc99114)[_0x925d('0xaa')](loggerCatch(_0x925d('0xfb')));}if(_0x3f0fa8&&_0x3f0fa8[_0x925d('0x51')]!==_0x925d('0xac')&&isNotNull(this['voiceQueues'][_0x3f0fa8[_0x925d('0xad')]][_0x925d('0xfc')])){delete this[_0x925d('0x29')][_0x44d7b9['uniqueid']];this[_0x925d('0xaf')](this[_0x925d('0x21')][_0x3f0fa8[_0x925d('0xad')]]);this['voiceQueues'][_0x3f0fa8[_0x925d('0xad')]][_0x925d('0x5c')]+=0x1;this[_0x925d('0x21')][_0x3f0fa8[_0x925d('0xad')]]['outboundAnswerAgiCallsDay']+=0x1;_0xc99114=new Hangup(_0x3f0fa8,_0x44d7b9);_0xc99114['state']=0x10;_0xc99114[_0x925d('0xa4')]='AnswerAGI';_0xc99114[_0x925d('0xdd')]=_0x925d('0xfd');this['createHistory'](_0xc99114)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x925d('0xfa')](_0xc99114)['catch'](loggerCatch(_0x925d('0xfb')));}if(_0x3f0fa8&&_0x3f0fa8[_0x925d('0x51')]!==_0x925d('0xac')&&!isNotNull(this[_0x925d('0x21')][_0x3f0fa8[_0x925d('0xad')]][_0x925d('0xfc')])){delete this[_0x925d('0x29')][_0x44d7b9[_0x925d('0xd6')]];this[_0x925d('0xaf')](this[_0x925d('0x21')][_0x3f0fa8[_0x925d('0xad')]]);this[_0x925d('0x21')][_0x3f0fa8[_0x925d('0xad')]][_0x925d('0xfe')]+=0x1;_0xc99114=new Hangup(_0x3f0fa8,_0x44d7b9);_0xc99114[_0x925d('0xa3')]=0xc;_0xc99114[_0x925d('0xa4')]=_0x44d7b9[_0x925d('0xff')];_0xc99114[_0x925d('0xdd')]=_0x925d('0x100');this[_0x925d('0xc4')](_0xc99114)['catch'](loggerCatch(_0x925d('0xf9')));this[_0x925d('0xfa')](_0xc99114)[_0x925d('0xaa')](loggerCatch(_0x925d('0xfb')));}};Dialer[_0x925d('0x1d')][_0x925d('0x101')]=function(_0x5a1825){var _0x4e622f=this[_0x925d('0x29')][_0x5a1825['uniqueid']];var _0x2cc51c=this;if(this[_0x925d('0x21')][_0x5a1825[_0x925d('0xad')]]){if(_0x4e622f&&_0x4e622f['type']!==_0x925d('0xac')){delete this[_0x925d('0x29')][_0x5a1825[_0x925d('0xd6')]];this['voiceQueues'][_0x5a1825[_0x925d('0xad')]]['outboundAnswerCallsDay']+=0x1;var _0x3a9c51=new AgentComplete(_0x4e622f,_0x5a1825);if(_0x5a1825[_0x925d('0x102')]==='agent'){_0x3a9c51[_0x925d('0x103')]=this[_0x925d('0x21')][_0x5a1825['queue']][_0x925d('0x104')]&&this[_0x925d('0x21')][_0x5a1825[_0x925d('0xad')]][_0x925d('0x105')]?moment()[_0x925d('0x76')](_0x925d('0xef')):undefined;}this[_0x925d('0xc4')](_0x3a9c51)[_0x925d('0xaa')](loggerCatch(_0x925d('0x106')));this[_0x925d('0xfa')](_0x3a9c51)[_0x925d('0xaa')](loggerCatch(_0x925d('0x107')));}}};Dialer[_0x925d('0x1d')][_0x925d('0x2f')]=function(_0x1fa186){if(this[_0x925d('0x21')][_0x1fa186[_0x925d('0xad')]]){if(this['uniqueId'][_0x1fa186[_0x925d('0xd6')]]&&this[_0x925d('0x29')][_0x1fa186[_0x925d('0xd6')]][_0x925d('0x51')]!==_0x925d('0xac')){this['updateOriginated'](this[_0x925d('0x21')][_0x1fa186[_0x925d('0xad')]]);this['uniqueId'][_0x1fa186[_0x925d('0xd6')]]['answertime']=moment()[_0x925d('0x76')](_0x925d('0xef'));}}};Dialer[_0x925d('0x1d')]['queueCallerAbandonCreateState']=function(_0x27ba05){this[_0x925d('0xc4')](_0x27ba05)[_0x925d('0xaa')](loggerCatch(_0x925d('0x106')));this[_0x925d('0xfa')](_0x27ba05)[_0x925d('0xaa')](loggerCatch(_0x925d('0x108')));};Dialer[_0x925d('0x1d')]['syncQueueCallerAbandon']=function(_0x3fa8ee){var _0x1534a6=this[_0x925d('0x29')][_0x3fa8ee[_0x925d('0xd6')]];var _0x3f6c71=this;if(this[_0x925d('0x21')][_0x3fa8ee[_0x925d('0xad')]]){if(_0x1534a6&&_0x1534a6['type']!=='ivr'){delete this[_0x925d('0x29')][_0x3fa8ee[_0x925d('0xd6')]];this[_0x925d('0xaf')](this[_0x925d('0x21')][_0x3fa8ee[_0x925d('0xad')]]);_0x1534a6[_0x925d('0x109')]=moment()['format'](_0x925d('0xef'));var _0x34a860=new QueueCallerAbandon(_0x1534a6,_0x3fa8ee);if(getSeconds(_0x1534a6[_0x925d('0x109')],_0x1534a6[_0x925d('0x10a')])>=_0x1534a6[_0x925d('0x10b')]){this[_0x925d('0x21')][_0x3fa8ee['queue']][_0x925d('0x69')]+=0x1;this[_0x925d('0x21')][_0x3fa8ee[_0x925d('0xad')]][_0x925d('0x61')]+=0x1;this[_0x925d('0x21')][_0x3fa8ee['queue']][_0x925d('0x10c')]+=0x1;_0x34a860[_0x925d('0xa3')]=0xa;_0x34a860[_0x925d('0xa4')]=_0x925d('0x10d');_0x34a860[_0x925d('0x10e')]=_0x925d('0x10f');_0x34a860[_0x925d('0x103')]=this[_0x925d('0x21')][_0x3fa8ee[_0x925d('0xad')]]['dialQueueProject2']?moment()[_0x925d('0x76')](_0x925d('0xef')):undefined;_0x34a860['countdropretry']+=0x1;_0x34a860[_0x925d('0xf4')]+=0x1;if(_0x34a860[_0x925d('0xf6')]>=this[_0x925d('0x21')][_0x3fa8ee[_0x925d('0xad')]][_0x925d('0x110')]){this[_0x925d('0x111')](_0x34a860);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x34a860[_0x925d('0xf6')],'scheduledat':moment()[_0x925d('0xed')](this[_0x925d('0x21')][_0x3fa8ee['queue']][_0x925d('0x112')],_0x925d('0xee'))[_0x925d('0x76')](_0x925d('0xef')),'ContactId':_0x1534a6['ContactId'],'ListId':_0x1534a6[_0x925d('0xf0')],'VoiceQueueId':_0x1534a6[_0x925d('0xcb')]||undefined,'CampaignId':_0x1534a6[_0x925d('0xcc')]||undefined})[_0x925d('0xaa')](loggerCatch(_0x925d('0x113')));var _0x5ad2c7=new History(_0x34a860);_0x5ad2c7[_0x925d('0xa3')]=0xa;_0x5ad2c7[_0x925d('0xa4')]='Drop';_0x5ad2c7[_0x925d('0x114')]=moment()[_0x925d('0x76')](_0x925d('0xef'));_0x5ad2c7[_0x925d('0x115')]=_0x5ad2c7['starttime'];_0x5ad2c7[_0x925d('0x116')]=_0x34a860['calleridname'];_0x5ad2c7[_0x925d('0x117')]=_0x34a860[_0x925d('0x117')];this[_0x925d('0xc4')](_0x5ad2c7)[_0x925d('0xaa')](loggerCatch(_0x925d('0x118')));}}else{this[_0x925d('0x21')][_0x3fa8ee['queue']][_0x925d('0x68')]+=0x1;this['voiceQueues'][_0x3fa8ee['queue']][_0x925d('0x60')]+=0x1;_0x34a860[_0x925d('0xa3')]=0xb;_0x34a860[_0x925d('0xa4')]='Abandoned';_0x34a860[_0x925d('0x10e')]=_0x925d('0x119');_0x34a860[_0x925d('0xe7')]+=0x1;_0x34a860[_0x925d('0xf4')]+=0x1;if(_0x34a860[_0x925d('0xe7')]>=this[_0x925d('0x21')][_0x3fa8ee[_0x925d('0xad')]][_0x925d('0x11a')]){this[_0x925d('0x111')](_0x34a860);}else{this[_0x925d('0xbb')]({'active':![],'countabandonedretry':_0x34a860[_0x925d('0xe7')],'scheduledat':moment()[_0x925d('0xed')](this[_0x925d('0x21')][_0x3fa8ee['queue']]['dialAbandonedRetryFrequency'],_0x925d('0xee'))[_0x925d('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1534a6['ContactId'],'ListId':_0x1534a6[_0x925d('0xf0')],'VoiceQueueId':_0x1534a6[_0x925d('0xcb')]||undefined,'CampaignId':_0x1534a6[_0x925d('0xcc')]||undefined})[_0x925d('0xaa')](loggerCatch(_0x925d('0x11b')));var _0x5ad2c7=new History(_0x34a860);_0x5ad2c7[_0x925d('0xa3')]=0xb;_0x5ad2c7[_0x925d('0xa4')]=_0x925d('0x11c');_0x5ad2c7[_0x925d('0x114')]=moment()[_0x925d('0x76')](_0x925d('0xef'));_0x5ad2c7['endtime']=_0x5ad2c7['starttime'];_0x5ad2c7[_0x925d('0x116')]=_0x34a860[_0x925d('0x116')];_0x5ad2c7[_0x925d('0x117')]=_0x34a860[_0x925d('0x117')];this['createHistory'](_0x5ad2c7)[_0x925d('0xaa')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x925d('0x1d')][_0x925d('0x36')]=function(_0x35f6a4){if(this[_0x925d('0x27')][_0x35f6a4['uniqueid']]){this[_0x925d('0x27')][_0x35f6a4[_0x925d('0xd6')]][_0x925d('0xa9')]=_0x35f6a4[_0x925d('0xa9')];}if(this[_0x925d('0x29')][_0x35f6a4[_0x925d('0xd6')]]){this[_0x925d('0x29')][_0x35f6a4['uniqueid']][_0x925d('0xa9')]=_0x35f6a4['channel'];}};Dialer['prototype'][_0x925d('0x39')]=function(_0x26c69f){if(strategy[this[_0x925d('0x21')][this[_0x925d('0x27')][_0x26c69f[_0x925d('0x11d')]][_0x925d('0xad')]][_0x925d('0x4b')]]===_0x925d('0x1c')){if(this['actions'][_0x26c69f[_0x925d('0x11d')]]&&_['isNil'](this['actions'][_0x26c69f[_0x925d('0x11d')]][_0x925d('0x11e')])&&_0x26c69f[_0x925d('0xd3')]==='1'&&_0x26c69f['paused']==='0'){if(this[_0x925d('0x23')][_0x26c69f[_0x925d('0x11f')]]){if(!this[_0x925d('0x23')][_0x26c69f[_0x925d('0x11f')]][_0x925d('0x11e')]){this['agents'][_0x26c69f[_0x925d('0x11f')]][_0x925d('0x11e')]=!![];this['actions'][_0x26c69f[_0x925d('0x11d')]][_0x925d('0x11e')]=!![];this[_0x925d('0x27')][_0x26c69f[_0x925d('0x11d')]][_0x925d('0x11f')]=_0x26c69f[_0x925d('0x11f')];}}}}else if((strategy[this['voiceQueues'][this['actions'][_0x26c69f[_0x925d('0x11d')]][_0x925d('0xad')]][_0x925d('0x4b')]]||'rrmemory')===_0x925d('0x1b')){if(this[_0x925d('0x27')][_0x26c69f['actionid']]){if(this[_0x925d('0x23')][_0x26c69f['stateinterface']]){this[_0x925d('0x27')][_0x26c69f[_0x925d('0x11d')]][_0x925d('0x11f')]=_0x26c69f['stateinterface'];if(_[_0x925d('0xa8')](this[_0x925d('0x2c')][this[_0x925d('0x27')][_0x26c69f[_0x925d('0x11d')]][_0x925d('0xad')]])){this[_0x925d('0x2c')][this[_0x925d('0x27')][_0x26c69f['actionid']][_0x925d('0xad')]]=[];}this[_0x925d('0x2c')][this[_0x925d('0x27')][_0x26c69f['actionid']][_0x925d('0xad')]]['push'](_[_0x925d('0x88')](_['pick'](this[_0x925d('0x27')][_0x26c69f[_0x925d('0x11d')]],[_0x925d('0x120'),_0x925d('0x11f')]),{'status':_0x26c69f[_0x925d('0xd3')],'paused':_0x26c69f[_0x925d('0x121')]}));}}}};function unlockQueueStatus(_0x6542de,_0x53a28d){setTimeout(function(){if(_[_0x925d('0x3d')](_0x6542de[_0x925d('0x122')])){loggerBooked[_0x925d('0x91')](_0x925d('0x123'),_0x53a28d);}_0x6542de[_0x925d('0x122')]=!![];loggerBooked[_0x925d('0x78')](_0x925d('0x124'),_0x53a28d,JSON[_0x925d('0x48')](_['pick'](_0x6542de,[_0x925d('0x40'),_0x925d('0x122')])));},0x1f3);}Dialer[_0x925d('0x1d')][_0x925d('0x125')]=function(_0x279f69){var _0x4a1627=this;var _0x4a0b01=_0x4a1627['voiceQueues'][_0x4a1627[_0x925d('0x27')][_0x279f69['actionid']][_0x925d('0xad')]];if(strategy[this['voiceQueues'][this[_0x925d('0x27')][_0x279f69[_0x925d('0x11d')]][_0x925d('0xad')]][_0x925d('0x4b')]]===_0x925d('0x1c')){if(this[_0x925d('0x27')][_0x279f69[_0x925d('0x11d')]]&&this[_0x925d('0x27')][_0x279f69[_0x925d('0x11d')]][_0x925d('0x11f')]){this[_0x925d('0x20')][_0x925d('0x126')](this[_0x925d('0x27')][_0x279f69[_0x925d('0x11d')]]['idHopper'],this['actions'][_0x279f69[_0x925d('0x11d')]][_0x925d('0x11f')])[_0x925d('0xaa')](function(_0x3907c9){logger[_0x925d('0x91')](_0x925d('0x127'),util['inspect'](_0x3907c9,{'showHidden':![],'depth':null}));})[_0x925d('0x1f')](function(){_0x4a1627[_0x925d('0xaf')](_0x4a1627['voiceQueues'][_0x4a1627[_0x925d('0x27')][_0x279f69['actionid']][_0x925d('0xad')]]);_0x4a1627[_0x925d('0x23')][_0x4a1627[_0x925d('0x27')][_0x279f69[_0x925d('0x11d')]][_0x925d('0x11f')]][_0x925d('0x11e')]=![];delete _0x4a1627[_0x925d('0x27')][_0x279f69[_0x925d('0x11d')]];unlockQueueStatus(_0x4a0b01);});}else{this[_0x925d('0xaf')](this['voiceQueues'][this[_0x925d('0x27')][_0x279f69['actionid']][_0x925d('0xad')]]);this[_0x925d('0xbb')]({'active':![],'ContactId':this[_0x925d('0x27')][_0x279f69[_0x925d('0x11d')]][_0x925d('0xc9')],'ListId':this[_0x925d('0x27')][_0x279f69[_0x925d('0x11d')]][_0x925d('0xf0')],'VoiceQueueId':this[_0x925d('0x27')][_0x279f69[_0x925d('0x11d')]][_0x925d('0xcb')]||undefined,'CampaignId':this[_0x925d('0x27')][_0x279f69[_0x925d('0x11d')]]['CampaignId']||undefined})[_0x925d('0xaa')](loggerCatch(_0x925d('0x128')));delete this[_0x925d('0x27')][_0x279f69['actionid']];unlockQueueStatus(_0x4a0b01);}}else if((strategy[this[_0x925d('0x21')][this[_0x925d('0x27')][_0x279f69[_0x925d('0x11d')]][_0x925d('0xad')]][_0x925d('0x4b')]]||_0x925d('0x1b'))===_0x925d('0x1b')){var _0x4b5425;if(this['actions'][_0x279f69[_0x925d('0x11d')]]&&!_[_0x925d('0x46')](this[_0x925d('0x2c')][this[_0x925d('0x27')][_0x279f69['actionid']][_0x925d('0xad')]])){if(this[_0x925d('0x2d')][_0x4a1627[_0x925d('0x27')][_0x279f69[_0x925d('0x11d')]][_0x925d('0xad')]]){this[_0x925d('0x2d')][_0x4a1627[_0x925d('0x27')][_0x279f69[_0x925d('0x11d')]]['queue']]=this[_0x925d('0x2d')][this['actions'][_0x279f69[_0x925d('0x11d')]][_0x925d('0xad')]]?this['queueBookedRR'][this['actions'][_0x279f69[_0x925d('0x11d')]]['queue']]:this['queueBooked'][this[_0x925d('0x27')][_0x279f69[_0x925d('0x11d')]][_0x925d('0xad')]]?this[_0x925d('0x2c')][this[_0x925d('0x27')][_0x279f69[_0x925d('0x11d')]]['queue']]['_rr']||0x0:0x0;}this['queueBooked'][this[_0x925d('0x27')][_0x279f69[_0x925d('0x11d')]][_0x925d('0xad')]][_0x925d('0x129')]=this['queueBookedRR'][this['actions'][_0x279f69[_0x925d('0x11d')]][_0x925d('0xad')]];for(var _0x24dbaa=0x0;_0x24dbaa=0x0?!![]:![];})['catch'](myreject(_0x69ddf8)));}}else{_0x1c0e07['push'](ami[_0x925d('0x140')]({'action':_0x925d('0x141'),'command':util[_0x925d('0x76')](_0x925d('0x142'),_0x5068a8,!_[_0x925d('0x3d')](config['timezones'][_0x4e0e26])?_0x4e0e26:'')})['then'](function(_0x498c4d){return _0x498c4d[_0x925d('0x145')][_0x925d('0x144')]('true')>=0x0?!![]:![];})[_0x925d('0xaa')](myreject(_0x69ddf8)));}BPromise['all'](_0x1c0e07)[_0x925d('0xb3')](function(_0x3ce0ec){var _0x36dc66=_[_0x925d('0x146')](_0x3ce0ec);if(_0x36dc66){return _0x29c702(_0x36dc66);}else{_0x21a801[_0x925d('0x3e')]=_0x33c553?_0x925d('0x147'):_0x925d('0x148');return _0x69ddf8(msgResponse(_0x925d('0x149'),'Failure',_0x925d('0x14a')+_0x33c553+'\x20'+_0x4b3614+_0x925d('0x14b')+util[_0x925d('0x97')](_0x5068a8,{'showHidden':![],'depth':null})+_0x925d('0x14c')+_0x4e0e26));}})[_0x925d('0xaa')](function(_0x195bd1){return _0x69ddf8(msgResponse('ifTime','Failure',JSON[_0x925d('0x48')](_0x195bd1)));});});};Dialer[_0x925d('0x1d')][_0x925d('0x14d')]=function(_0x17c1ec){var _0xc4680b=this;return function(){switch(_0x17c1ec[_0x925d('0x57')]){case _0x925d('0x14e'):freeVariablesPredictive(_0x17c1ec);_0xc4680b[_0x925d('0x14f')](_0x17c1ec,0x1);break;case'power':freeVariablesPredictive(_0x17c1ec);_0xc4680b[_0x925d('0x14f')](_0x17c1ec,_0x17c1ec['dialPowerLevel']);break;case _0x925d('0x150'):_0xc4680b[_0x925d('0x150')](_0x17c1ec);break;case'booked':freeVariablesPredictive(_0x17c1ec);_0xc4680b[_0x925d('0x14f')](_0x17c1ec,0x1);break;default:freeVariablesPredictive(_0x17c1ec);logger[_0x925d('0x91')](_0x925d('0x151'),_0x17c1ec[_0x925d('0x40')],_0x925d('0x152'));}};};Dialer[_0x925d('0x1d')][_0x925d('0x153')]=function(_0x24fba7){var _0x28d6fb=this;return function(){_0x28d6fb[_0x925d('0x154')](_0x24fba7);};};Dialer[_0x925d('0x1d')][_0x925d('0x9')]=function(_0x45f2e2){var _0xfd0d6=this;if(isNotPreview(_0x45f2e2[_0x925d('0x57')])){if(isVoiceQueueOutbound(_0x45f2e2[_0x925d('0x51')])&&isActive(_0x45f2e2[_0x925d('0x56')])){_0x45f2e2[_0x925d('0x9d')]=!![];BPromise['resolve']()[_0x925d('0xb3')](checkIsLoggedIn(_0x45f2e2,_0x45f2e2[_0x925d('0x4e')]))['then'](checkIsActive(_0x45f2e2,_0x45f2e2[_0x925d('0x56')]))[_0x925d('0xb3')](checkInterval(_0x45f2e2))['then'](_0xfd0d6[_0x925d('0x134')](_0x45f2e2))['then'](_0xfd0d6[_0x925d('0x155')](_0x45f2e2[_0x925d('0x156')],_0x45f2e2[_0x925d('0x157')],_0x45f2e2[_0x925d('0x40')],_0x45f2e2))[_0x925d('0xb3')](_0xfd0d6[_0x925d('0x137')](_0x45f2e2[_0x925d('0x42')],_0x45f2e2[_0x925d('0x157')],_0x45f2e2[_0x925d('0x40')],_0x45f2e2))['then'](_0xfd0d6['checkDialMethod'](_0x45f2e2))[_0x925d('0xaa')](loggerCatchQueueSummary(_0x925d('0x158'),_0x45f2e2));}else{notSendMessagesQueue(_0x45f2e2);}}else{freeVariablesPredictive(_0x45f2e2);}};Dialer[_0x925d('0x1d')][_0x925d('0x133')]=function(){var _0x267afb=this;var _0x12a81f;for(var _0x442433 in this['campaigns']){if(this[_0x925d('0x22')][_0x925d('0x94')](_0x442433)){_0x12a81f=this[_0x925d('0x22')][_0x442433];if(isCampaignIvr(_0x12a81f[_0x925d('0x51')])&&isActive(_0x12a81f[_0x925d('0xd1')])){_0x12a81f[_0x925d('0x9d')]=!![];BPromise[_0x925d('0xb2')]()[_0x925d('0xb3')](checkIsActive(_0x12a81f,_0x12a81f['active']))['then'](checkInterval(_0x12a81f))[_0x925d('0xb3')](_0x267afb['checkIsTrunkReachable'](_0x12a81f))[_0x925d('0xb3')](_0x267afb['checkIfTime'](_0x12a81f['dialGlobalInterval'],_0x12a81f[_0x925d('0x157')],_0x12a81f[_0x925d('0x40')],_0x12a81f))[_0x925d('0xb3')](_0x267afb[_0x925d('0x137')](_0x12a81f[_0x925d('0x42')],_0x12a81f[_0x925d('0x157')],_0x12a81f[_0x925d('0x40')],_0x12a81f))[_0x925d('0xb3')](_0x267afb['launchHandleIvr'](_0x12a81f))['catch'](loggerCatchQueueSummary(_0x925d('0x159'),_0x12a81f));}else{notSendMessagesCampaign(_0x12a81f);}}}};function getCallerIdRandom(_0x4dc5c2,_0x4ff46f){var _0x2e84e3,_0x380d8a,_0x4d2e2b;if(_0x4ff46f<=0x0){_0x4ff46f=0x1;}_0x2e84e3=new RegExp('\x5cw{0,'+_0x4ff46f+'}$');_0x380d8a=Math[_0x925d('0x15a')](0xa,_0x4ff46f-0x1);_0x4d2e2b=Math['pow'](0xa,_0x4ff46f)-0x1;return util[_0x925d('0x76')]('%s',_[_0x925d('0x15b')](_0x4dc5c2,_0x2e84e3,_['random'](_0x380d8a,_0x4d2e2b)));}function extractCalleridName(_0x57d064){var _0x311456=_0x57d064[_0x925d('0x15c')](/"(.*?)"/);return _0x311456?_0x311456[0x1]:_0x57d064;}function extractCalleridNumber(_0x52d521){var _0x553091=_0x52d521[_0x925d('0x15c')](/<(.*?)>/);return _0x553091?_0x553091[0x1]:_0x52d521;}Dialer[_0x925d('0x1d')][_0x925d('0x15d')]=function(_0x540e58,_0x3d0cf1){var _0x158267=this;var _0x20f3cc=uuid['v4']();this['actions'][_0x20f3cc]=new Action(_0x540e58,_0x3d0cf1,_0x20f3cc);return new BPromise(function(_0x598b4d,_0x4cd163){if(_[_0x925d('0x3d')](_0x540e58)&&_0x925d('0x15e')!==typeof _0x540e58){return _0x4cd163(msgResponse(_0x925d('0x15f'),_0x925d('0x139'),_0x925d('0x160')));}if(_['isUndefined'](_0x3d0cf1[_0x925d('0x161')][_0x925d('0x162')])||_0x3d0cf1[_0x925d('0x161')][_0x925d('0x162')]===null){return _0x4cd163(msgResponse(_0x925d('0x15f'),_0x925d('0x139'),_0x925d('0x163')));}var _0x55fb7a={'XMD-CALLERID':_0x158267[_0x925d('0x27')][_0x20f3cc][_0x925d('0x164')](),'XMD-AGI':_0x540e58[_0x925d('0xfc')]?util[_0x925d('0x76')](_0x925d('0x165'),ipAgi,_0x540e58[_0x925d('0xfc')]):_0x925d('0x166'),'XMD-AGIAFTER':_0x540e58[_0x925d('0x104')]?util[_0x925d('0x76')](_0x925d('0x165'),ipAgi,_0x540e58['dialQueueProject2']):_0x925d('0x166'),'XMD-QUEUE':_0x540e58[_0x925d('0x51')]==='outbound'?util[_0x925d('0x76')](_0x925d('0x167'),_0x540e58[_0x925d('0x40')],_0x540e58[_0x925d('0x168')]||'',_0x540e58['dialAgiAfterHangupAgent']?'c':'',_0x540e58['dialQueueTimeout']||0x3):_0x925d('0x166'),'XMD-CONTACTID':_0x3d0cf1['ContactId'],'XMD-CDRTYPE':_0x925d('0x7'),'CALLERID(all)':_0x158267[_0x925d('0x27')][_0x20f3cc]['getCaller'](),'XMD-AMD':_0x540e58['dialAMDActive']?_0x925d('0x169'):_0x925d('0x166'),'XMD-DESTINATION':_0x925d('0x16a')};if(_0x540e58[_0x925d('0xd9')]){_0x55fb7a[_0x925d('0x16b')]=_0x540e58[_0x925d('0x16c')]||0x9c4;_0x55fb7a['XMD-AMDGREETING']=_0x540e58['dialAMDGreeting']||0x5dc;_0x55fb7a[_0x925d('0x16d')]=_0x540e58[_0x925d('0x16e')]||0x320;_0x55fb7a[_0x925d('0x16f')]=_0x540e58[_0x925d('0x170')]||0x1388;_0x55fb7a[_0x925d('0x171')]=_0x540e58[_0x925d('0x172')]||0x64;_0x55fb7a[_0x925d('0x173')]=_0x540e58[_0x925d('0x174')]||0x32;_0x55fb7a[_0x925d('0x175')]=_0x540e58[_0x925d('0x176')]||0x3;_0x55fb7a[_0x925d('0x177')]=_0x540e58[_0x925d('0x178')]||0x100;_0x55fb7a[_0x925d('0x179')]=_0x540e58[_0x925d('0x17a')]||0x1388;}if(_0x540e58[_0x925d('0x51')]===_0x925d('0x4a')){_0x55fb7a[_0x925d('0x17b')]=_0x3d0cf1['VoiceQueueId'];}else{_0x55fb7a[_0x925d('0x17c')]=_0x3d0cf1[_0x925d('0xcc')];}for(var _0x28f279 in _0x3d0cf1[_0x925d('0x161')]){if(_0x3d0cf1[_0x925d('0x161')][_0x925d('0x94')](_0x28f279)){if(isNotNull(_0x3d0cf1[_0x925d('0x161')][_0x28f279])&&_0x28f279!=='id'&&_0x28f279!==_0x925d('0x17d')&&_0x28f279!=='createdAt'&&_0x28f279!=='updatedAt'){_0x55fb7a[util['format']('%s%s',_0x925d('0x17e'),_[_0x925d('0x17f')](_0x28f279))]=_0x3d0cf1[_0x925d('0x161')][_0x28f279];}}}var _0x3c957c=_0x158267[_0x925d('0xd0')](_0x540e58[_0x925d('0x74')])?getCallerId(_0x540e58['Trunk'][_0x925d('0x75')],_0x540e58[_0x925d('0x58')],_0x540e58[_0x925d('0x180')]>0x0?getCallerIdRandom(_0x540e58[_0x925d('0x181')],_0x540e58['dialRandomLastDigitCallerIdNumber']):_0x540e58[_0x925d('0x181')]):getCallerId(_[_0x925d('0xa8')](_0x540e58['TrunkBackup'])?_0x540e58['Trunk'][_0x925d('0x75')]:_0x540e58[_0x925d('0x135')]['callerid'],_0x540e58[_0x925d('0x58')],_0x540e58[_0x925d('0x180')]>0x0?getCallerIdRandom(_0x540e58[_0x925d('0x181')],_0x540e58[_0x925d('0x180')]):_0x540e58[_0x925d('0x181')]);if(_0x3c957c){_0x55fb7a['XMD-ORIGINATECALLERIDNAME']=_0x158267[_0x925d('0x27')][_0x20f3cc][_0x925d('0x182')]=extractCalleridName(_0x3c957c);_0x55fb7a['XMD-ORIGINATECALLERIDNUM']=_0x158267[_0x925d('0x27')][_0x20f3cc][_0x925d('0x183')]=extractCalleridNumber(_0x3c957c);}return ami[_0x925d('0x140')]({'actionid':_0x20f3cc,'action':_0x925d('0x15f'),'channel':_0x158267['isTrunkReachable'](_0x540e58[_0x925d('0x74')])?util[_0x925d('0x76')](_0x925d('0x184'),_0x540e58['Trunk'][_0x925d('0x40')],isNotNull(_0x540e58[_0x925d('0x5a')])?_0x540e58[_0x925d('0x5a')]['trim']()||'':'',_0x540e58[_0x925d('0x185')]>0x0?_0x3d0cf1[_0x925d('0x161')][_0x925d('0x162')][_0x925d('0x186')](_0x540e58['dialCutDigit']):_0x3d0cf1[_0x925d('0x161')]['phone']):util['format'](_0x925d('0x184'),_[_0x925d('0xa8')](_0x540e58[_0x925d('0x135')])?_0x540e58['Trunk'][_0x925d('0x40')]:_0x540e58[_0x925d('0x135')][_0x925d('0x40')],isNotNull(_0x540e58[_0x925d('0x5a')])?_0x540e58['dialPrefix']['trim']()||'':'',_0x540e58[_0x925d('0x185')]>0x0?_0x3d0cf1['Contact'][_0x925d('0x162')]['substring'](_0x540e58[_0x925d('0x185')]):_0x3d0cf1[_0x925d('0x161')][_0x925d('0x162')]),'callerid':_0x3c957c,'Exten':_0x925d('0x16a'),'Context':'from-sip','Priority':'1','variable':_0x55fb7a,'timeout':(_0x540e58[_0x925d('0x59')]||0x1e)*0x3e8,'async':!![],'channelid':_0x20f3cc})[_0x925d('0xb3')](function(_0x3c82c4){return _0x598b4d(_0x3c82c4);})[_0x925d('0xaa')](function(_0x292f5f){_0x540e58[_0x925d('0x64')]+=0x1;var _0xd70bbd=new History(_0x158267[_0x925d('0x27')][_0x20f3cc]);logger[_0x925d('0x91')](util[_0x925d('0x76')]('[originateError]:\x20%s',JSON[_0x925d('0x48')](_0x292f5f)));_0xd70bbd[_0x925d('0xa3')]=0xe;_0xd70bbd[_0x925d('0xa4')]=_0x925d('0x187');_0xd70bbd[_0x925d('0x114')]=moment()[_0x925d('0x76')]('YYYY-MM-DD\x20HH:mm:ss');_0xd70bbd[_0x925d('0x115')]=_0xd70bbd[_0x925d('0x114')];_0x158267[_0x925d('0xc4')](_0xd70bbd)['catch'](loggerCatch(_0x925d('0x188')));_0x158267[_0x925d('0xfa')](_0xd70bbd)[_0x925d('0xaa')](loggerCatch(_0x925d('0x188')))[_0x925d('0x1f')](function(){delete _0x158267[_0x925d('0x27')][_0x20f3cc];return _0x4cd163(msgResponse(_0x925d('0x15f'),_0x925d('0x47'),_0x925d('0x189')));});});});};Dialer[_0x925d('0x1d')][_0x925d('0x33')]=function(_0x3a50e3){var _0xbbabc5=this[_0x925d('0x27')][_0x3a50e3[_0x925d('0x11d')]];var _0x4dff4e=this;if(_0xbbabc5){delete this['actions'][_0x3a50e3[_0x925d('0x11d')]];_0xbbabc5[_0x925d('0x10a')]=moment()[_0x925d('0x76')](_0x925d('0xef'));var _0x4de895=_0xbbabc5[_0x925d('0x51')]==='ivr'?this[_0x925d('0x22')][_0xbbabc5[_0x925d('0xad')]]:this['voiceQueues'][_0xbbabc5[_0x925d('0x18a')]()];if(!this[_0x925d('0xce')](_0x3a50e3[_0x925d('0x18b')])){this[_0x925d('0xaf')](_0x4de895);return this[_0x925d('0x18c')](_0xbbabc5,_0x4de895,_0x3a50e3)[_0x925d('0xb3')](function(_0x46340b){})['catch'](loggerCatch(_0x925d('0x18d')));}else{this[_0x925d('0x29')][_0x3a50e3[_0x925d('0xd6')]]=_0xbbabc5;}}};Dialer['prototype']['checkRetriveMax']=function(_0x4e22d1,_0xd4a229,_0x477350){var _0x557d68=new History(_0xd4a229);if(_0x557d68['countbusyretry']+_0x557d68[_0x925d('0xe5')]+_0x557d68['countnoanswerretry']+_0x557d68[_0x925d('0xe6')]+_0x557d68[_0x925d('0xf6')]+_0x557d68[_0x925d('0xe7')]+_0x557d68[_0x925d('0xe1')]+_0x557d68[_0x925d('0xe8')]>=_0x477350[_0x925d('0xe9')]-0x1){return!![];}switch(_0x4e22d1){case 0x3:if(_0x557d68[_0x925d('0xf5')]>=_0x477350[_0x925d('0x18e')]-0x1){return!![];}else{this[_0x925d('0xbb')]({'active':![],'countnoanswerretry':_0x557d68[_0x925d('0xf5')]+=0x1,'scheduledat':moment()[_0x925d('0xed')](_0x477350[_0x925d('0x18f')],_0x925d('0xee'))[_0x925d('0x76')](_0x925d('0xef')),'ContactId':_0x557d68[_0x925d('0xc9')],'ListId':_0x557d68[_0x925d('0xf0')],'VoiceQueueId':_0x557d68[_0x925d('0xcb')]||undefined,'CampaignId':_0x557d68[_0x925d('0xcc')]||undefined})[_0x925d('0xaa')](loggerCatch(_0x925d('0x190')));}break;case 0x5:if(_0x557d68[_0x925d('0xe4')]>=_0x477350['dialBusyMaxRetry']-0x1){return!![];}else{this[_0x925d('0xbb')]({'active':![],'countbusyretry':_0x557d68[_0x925d('0xe4')]+=0x1,'scheduledat':moment()[_0x925d('0xed')](_0x477350[_0x925d('0x191')],_0x925d('0xee'))[_0x925d('0x76')](_0x925d('0xef')),'ContactId':_0x557d68['ContactId'],'ListId':_0x557d68[_0x925d('0xf0')],'VoiceQueueId':_0x557d68['VoiceQueueId']||undefined,'CampaignId':_0x557d68['CampaignId']||undefined})[_0x925d('0xaa')](loggerCatch(_0x925d('0x192')));}break;case 0x8:if(_0x557d68['countcongestionretry']>=_0x477350[_0x925d('0x193')]-0x1){return!![];}else{this[_0x925d('0xbb')]({'active':![],'countcongestionretry':_0x557d68[_0x925d('0xe5')]+=0x1,'scheduledat':moment()[_0x925d('0xed')](_0x477350[_0x925d('0x194')],_0x925d('0xee'))[_0x925d('0x76')](_0x925d('0xef')),'ContactId':_0x557d68[_0x925d('0xc9')],'ListId':_0x557d68[_0x925d('0xf0')],'VoiceQueueId':_0x557d68[_0x925d('0xcb')]||undefined,'CampaignId':_0x557d68[_0x925d('0xcc')]||undefined})[_0x925d('0xaa')](loggerCatch(_0x925d('0x195')));}break;case 0x0:if(_0x557d68['countnosuchnumberretry']>=_0x477350[_0x925d('0x196')]-0x1){return!![];}else{this[_0x925d('0xbb')]({'active':![],'countnosuchnumberretry':_0x557d68[_0x925d('0xe6')]+=0x1,'scheduledat':moment()[_0x925d('0xed')](_0x477350[_0x925d('0x197')],'minutes')[_0x925d('0x76')](_0x925d('0xef')),'ContactId':_0x557d68[_0x925d('0xc9')],'ListId':_0x557d68[_0x925d('0xf0')],'VoiceQueueId':_0x557d68[_0x925d('0xcb')]||undefined,'CampaignId':_0x557d68[_0x925d('0xcc')]||undefined})['catch'](loggerCatch(_0x925d('0x198')));}break;case 0xa:if(_0x557d68[_0x925d('0xf6')]>=_0x477350['dialDropMaxRetry']-0x1){return!![];}else{this[_0x925d('0xbb')]({'active':![],'countdropretry':_0x557d68['countdropretry']+=0x1,'scheduledat':moment()[_0x925d('0xed')](_0x477350[_0x925d('0x112')],_0x925d('0xee'))[_0x925d('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x557d68[_0x925d('0xc9')],'ListId':_0x557d68[_0x925d('0xf0')],'VoiceQueueId':_0x557d68['VoiceQueueId']||undefined,'CampaignId':_0x557d68[_0x925d('0xcc')]||undefined})[_0x925d('0xaa')](loggerCatch(_0x925d('0x113')));}break;case 0xb:if(_0x557d68[_0x925d('0xe7')]>=_0x477350['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0x925d('0xbb')]({'active':![],'countabandonedretry':_0x557d68[_0x925d('0xe7')]+=0x1,'scheduledat':moment()[_0x925d('0xed')](_0x477350[_0x925d('0x199')],_0x925d('0xee'))[_0x925d('0x76')](_0x925d('0xef')),'ContactId':_0x557d68[_0x925d('0xc9')],'ListId':_0x557d68[_0x925d('0xf0')],'VoiceQueueId':_0x557d68[_0x925d('0xcb')]||undefined,'CampaignId':_0x557d68[_0x925d('0xcc')]||undefined})[_0x925d('0xaa')](loggerCatch('[rescheduleContact][Abandoned]'));}break;case 0x13:if(_0x557d68[_0x925d('0xe1')]>=_0x477350[_0x925d('0xeb')]-0x1){return!![];}else{this[_0x925d('0xbb')]({'active':![],'countmachineretry':_0x557d68[_0x925d('0xe1')]+=0x1,'scheduledat':moment()[_0x925d('0xed')](_0x477350[_0x925d('0x19a')],_0x925d('0xee'))[_0x925d('0x76')](_0x925d('0xef')),'ContactId':_0x557d68[_0x925d('0xc9')],'ListId':_0x557d68[_0x925d('0xf0')],'VoiceQueueId':_0x557d68[_0x925d('0xcb')]||undefined,'CampaignId':_0x557d68[_0x925d('0xcc')]||undefined})[_0x925d('0xaa')](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x557d68[_0x925d('0xe8')]>=_0x477350[_0x925d('0x19b')]-0x1){return!![];}else{this[_0x925d('0xbb')]({'active':![],'countagentrejectretry':_0x557d68['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x925d('0xed')](_0x477350[_0x925d('0x19c')],_0x925d('0xee'))['format'](_0x925d('0xef')),'ContactId':_0x557d68['ContactId'],'ListId':_0x557d68['ListId'],'VoiceQueueId':_0x557d68[_0x925d('0xcb')]||undefined,'CampaignId':_0x557d68['CampaignId']||undefined})[_0x925d('0xaa')](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer['prototype'][_0x925d('0x18c')]=function(_0x4a4bff,_0x158185,_0x374754){var _0x25c5ac=this;var _0x1f406e=new History(_0x4a4bff);return new BPromise(function(_0x14c8ff,_0x422c0e){if(_['isUndefined'](_0x158185)&&_0x925d('0x15e')!==typeof _0x158185){return _0x422c0e(msgResponse(_0x925d('0x19d'),'Failure',_0x925d('0x19e')));}if(_[_0x925d('0x3d')](_0x374754)&&_0x925d('0x15e')!==typeof _0x374754){return _0x422c0e(msgResponse(_0x925d('0x19d'),_0x925d('0x139'),'evt\x20is\x20undefine'));}switch(_0x374754['reason']){case'0':_0x158185[_0x925d('0x63')]+=0x1;_0x1f406e['state']=0x0;_0x1f406e['statedesc']=_0x925d('0x19f');_0x1f406e[_0x925d('0xe6')]+=0x1;_0x1f406e[_0x925d('0xf4')]+=0x1;ami[_0x925d('0x49')](_0x925d('0x1a0'),ut[_0x925d('0x1a1')](_0x4a4bff,_0x925d('0x1a2')));_0x25c5ac['createHistory'](_0x1f406e)[_0x925d('0xaa')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x25c5ac[_0x925d('0x1a3')](0x0,_0x4a4bff,_0x158185)){if(_0x1f406e['countnosuchnumberretry']>=_0x158185[_0x925d('0x196')]){_0x25c5ac['createStateFinal'](_0x1f406e,_0x14c8ff,_0x422c0e,_0x925d('0x1a4'));}else{_0x25c5ac['stateGlobal'](_0x1f406e,_0x14c8ff,_0x422c0e,_0x925d('0x1a4'));}}break;case'3':_0x158185['outboundNoAnswerCallsDay']+=0x1;_0x1f406e[_0x925d('0xa3')]=0x3;_0x1f406e[_0x925d('0xa4')]='NoAnswer';_0x1f406e['countnoanswerretry']+=0x1;_0x1f406e[_0x925d('0xf4')]+=0x1;ami['emit']('custom:agentnoanswer',ut[_0x925d('0x1a1')](_0x4a4bff,'noanswer'));_0x25c5ac[_0x925d('0xc4')](_0x1f406e)[_0x925d('0xaa')](loggerCatch(_0x925d('0x1a5')));if(_0x25c5ac[_0x925d('0x1a3')](0x3,_0x4a4bff,_0x158185)){if(_0x1f406e[_0x925d('0xf5')]>=_0x158185['dialNoAnswerMaxRetry']){_0x25c5ac[_0x925d('0xec')](_0x1f406e,_0x14c8ff,_0x422c0e,'reason\x203\x20ringing\x20no\x20answer');}else{_0x25c5ac[_0x925d('0xf7')](_0x1f406e,_0x14c8ff,_0x422c0e,_0x925d('0x1a6'));}}break;case'5':_0x158185[_0x925d('0x1a7')]+=0x1;_0x1f406e[_0x925d('0xa3')]=0x5;_0x1f406e[_0x925d('0xa4')]=_0x925d('0x1a8');_0x1f406e['countbusyretry']+=0x1;_0x1f406e[_0x925d('0xf4')]+=0x1;ami[_0x925d('0x49')](_0x925d('0x1a9'),ut['buildObj'](_0x4a4bff,'busy'));_0x25c5ac[_0x925d('0xc4')](_0x1f406e)[_0x925d('0xaa')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x25c5ac[_0x925d('0x1a3')](0x5,_0x4a4bff,_0x158185)){if(_0x1f406e[_0x925d('0xe4')]>=_0x158185[_0x925d('0x1aa')]){_0x25c5ac[_0x925d('0xec')](_0x1f406e,_0x14c8ff,_0x422c0e,'reason\x205\x20busy');}else{_0x25c5ac['stateGlobal'](_0x1f406e,_0x14c8ff,_0x422c0e,_0x925d('0x1ab'));}}break;case'8':_0x158185[_0x925d('0x5e')]+=0x1;_0x1f406e['state']=0x8;_0x1f406e['statedesc']=_0x925d('0x1ac');_0x1f406e[_0x925d('0xe5')]+=0x1;_0x1f406e['countglobal']+=0x1;ami[_0x925d('0x49')](_0x925d('0x1ad'),ut['buildObj'](_0x4a4bff,_0x925d('0x1ae')));_0x25c5ac[_0x925d('0xc4')](_0x1f406e)[_0x925d('0xaa')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x25c5ac[_0x925d('0x1a3')](0x8,_0x4a4bff,_0x158185)){if(_0x1f406e[_0x925d('0xe5')]>=_0x158185[_0x925d('0x193')]){_0x25c5ac[_0x925d('0xec')](_0x1f406e,_0x14c8ff,_0x422c0e,_0x925d('0x1af'));}else{_0x25c5ac['stateGlobal'](_0x1f406e,_0x14c8ff,_0x422c0e,_0x925d('0x1af'));}}break;case'11':_0x158185[_0x925d('0x1b0')]+=0x1;_0x1f406e[_0x925d('0xa3')]=0xb;_0x1f406e['statedesc']=_0x925d('0x11c');_0x1f406e[_0x925d('0xe7')]+=0x1;_0x1f406e[_0x925d('0xf4')]+=0x1;_0x25c5ac['createHistory'](_0x1f406e)[_0x925d('0xaa')](loggerCatch(_0x925d('0x1b1')));if(_0x25c5ac[_0x925d('0x1a3')](0xb,_0x4a4bff,_0x158185)){if(_0x1f406e[_0x925d('0xe7')]>=_0x158185[_0x925d('0x11a')]){_0x25c5ac['createStateFinal'](_0x1f406e,_0x14c8ff,_0x422c0e,'reason\x2011\x20abandoned');}else{_0x25c5ac[_0x925d('0xf7')](_0x1f406e,_0x14c8ff,_0x422c0e,_0x925d('0x1b2'));}}break;case'20':_0x158185[_0x925d('0x65')]+=0x1;_0x1f406e[_0x925d('0xa3')]=0x14;_0x1f406e['statedesc']=_0x925d('0x1b3');_0x1f406e[_0x925d('0xe8')]+=0x1;_0x1f406e[_0x925d('0xf4')]+=0x1;ami['emit'](_0x925d('0x1b4'),ut['buildObj'](_0x4a4bff,_0x925d('0x1b5')));_0x25c5ac[_0x925d('0xc4')](_0x1f406e)[_0x925d('0xaa')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x25c5ac['checkRetriveMax'](0x14,_0x4a4bff,_0x158185)){if(_0x1f406e['countagentrejectretry']>=_0x158185[_0x925d('0x19b')]){_0x25c5ac['createStateFinal'](_0x1f406e,_0x14c8ff,_0x422c0e,_0x925d('0x1b6'));}else{_0x25c5ac[_0x925d('0xf7')](_0x1f406e,_0x14c8ff,_0x422c0e,_0x925d('0x1b6'));}}break;default:_0x158185[_0x925d('0xfe')]+=0x1;_0x1f406e['state']=0xc;_0x1f406e[_0x925d('0xa4')]=_0x374754[_0x925d('0x102')];_0x25c5ac[_0x925d('0xc4')](_0x1f406e)[_0x925d('0xaa')](loggerCatch(_0x925d('0x1b7')));if(_0x25c5ac[_0x925d('0x1a3')](_0x374754[_0x925d('0x102')],_0x4a4bff,_0x158185)){if(_0x1f406e[_0x925d('0xe4')]+_0x1f406e[_0x925d('0xe5')]+_0x1f406e['countnoanswerretry']+_0x1f406e[_0x925d('0xe6')]+_0x1f406e[_0x925d('0xf6')]+_0x1f406e[_0x925d('0xe7')]+_0x1f406e[_0x925d('0xe1')]+_0x1f406e[_0x925d('0xe8')]>=_0x158185['dialGlobalMaxRetry']){_0x25c5ac[_0x925d('0xf7')](_0x1f406e,_0x14c8ff,_0x422c0e,_0x374754[_0x925d('0x102')]);}else{_0x25c5ac[_0x925d('0xec')](_0x1f406e,_0x14c8ff,_0x422c0e,_0x374754[_0x925d('0x102')]);}}}});};Dialer[_0x925d('0x1d')][_0x925d('0xf7')]=function(_0x5e64ff,_0x5c2f7a,_0x42eee7,_0x3b7f42){var _0x42bf12=new Final(_0x5e64ff);_0x42bf12[_0x925d('0xa3')]=0xf;_0x42bf12[_0x925d('0xa4')]=_0x925d('0x1b8');this[_0x925d('0xec')](_0x42bf12,_0x5c2f7a,_0x42eee7,_0x3b7f42);};Dialer[_0x925d('0x1d')][_0x925d('0xec')]=function(_0x397205,_0x160143,_0x364c5a,_0xe0d56e){this[_0x925d('0xfa')](_0x397205)[_0x925d('0xb3')](function(_0x42dbb0){return _0x160143(msgResponse(_0x925d('0x19d'),_0x925d('0xcf'),_0xe0d56e));})[_0x925d('0xaa')](function(_0xc51f54){return _0x364c5a(msgResponse(_0x925d('0x1b9'),'Failure','contact\x20not\x20moved'));});};Dialer[_0x925d('0x1d')]['predictive']=function(_0xb1d880){var _0x1d97dc=this;var _0x2ecc95=_0xb1d880[_0x925d('0x1ba')]/0x64;var _0x5e9b95=_0xb1d880[_0x925d('0x61')]/(_0xb1d880['outboundDropCallsDayTimeout']+_0xb1d880[_0x925d('0x5c')]);var _0x261970=Math[_0x925d('0x1bb')](_0xb1d880['predictiveIntervalAvailable']*(_0xb1d880[_0x925d('0x1bc')]/0x64));var _0x32c6a3=Math[_0x925d('0x1bb')](_0xb1d880[_0x925d('0x6c')]*(_0xb1d880[_0x925d('0x1bd')]/0x64));var _0x51654d=_0xb1d880[_0x925d('0x4d')]+_0xb1d880['talking'];var _0xd119a9=Math[_0x925d('0x1be')](_0xb1d880[_0x925d('0x6f')]*_0xb1d880[_0x925d('0x71')]*_0xb1d880[_0x925d('0x6b')]*_0xb1d880[_0x925d('0x1bf')]);if(_[_0x925d('0x3d')](_0xb1d880[_0x925d('0x73')])){if(!_['isUndefined'](_0xb1d880[_0x925d('0x2b')])){_0xb1d880[_0x925d('0x2b')]=undefined;loggerPredictive[_0x925d('0x91')]('[startMethodPredictive][StartProgressive]',_0x925d('0x1c0'));}if(!_[_0x925d('0x3d')](_0xb1d880[_0x925d('0x8c')])){loggerPredictive[_0x925d('0x91')](_0x925d('0x1c1'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0xb1d880[_0x925d('0x8c')]);_0xb1d880[_0x925d('0x8c')]=undefined;}_0xb1d880[_0x925d('0x73')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x925d('0x78')](_0xb1d880['name'],'collection\x20data\x20in\x20progressive\x20at',_0xb1d880[_0x925d('0x73')]);this[_0x925d('0x14f')](_0xb1d880,0x1);}else if(ifInterval(_0xb1d880[_0x925d('0x1c2')],_0xb1d880['startProgressive'])){this['handlePower'](_0xb1d880,0x1);loggerPredictiveCalls[_0x925d('0x78')](_0x925d('0x1c3'),_0xb1d880['startProgressive'],_0xb1d880[_0x925d('0x40')]);_0xb1d880[_0x925d('0x6f')]=0x0;_0xb1d880['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x2ecc95<_0x5e9b95&&_0xb1d880[_0x925d('0x1c4')]===_0x925d('0x1c5')){freeVariablesPredictive(_0xb1d880);loggerPredictive['info'](_0x925d('0x1c6'),'Dropped\x20calls\x20day',_0x5e9b95,'startProgressive',_0xb1d880[_0x925d('0x40')]);}else if(_0xd119a9<_0xb1d880[_0x925d('0x10c')]&&_0xb1d880[_0x925d('0x1c4')]===_0x925d('0x1c5')){freeVariablesPredictive(_0xb1d880);loggerPredictive[_0x925d('0x78')](_0x925d('0x1c7'),_0x925d('0x1c8'),_0xd119a9,'Drop\x20in\x20this\x20interval',_0xb1d880['predictiveIntervalErlangCallsDroppedCalls'],_0x925d('0x73'),_0xb1d880[_0x925d('0x40')]);}else if(!ifInterval(_0xb1d880[_0x925d('0x1c2')],_0xb1d880['startProgressive'])&&_[_0x925d('0x3d')](_0xb1d880[_0x925d('0x2b')])&&!_[_0x925d('0x3d')](_0xb1d880[_0x925d('0x73')])){_0xb1d880[_0x925d('0x2b')]=moment()[_0x925d('0x76')](_0x925d('0xef'));loggerPredictive[_0x925d('0x78')](_0xb1d880[_0x925d('0x40')],_0x925d('0x1c9'),_0xb1d880['startPredictive']);this['averageHandleTime'](_0xb1d880[_0x925d('0x1c2')])[_0x925d('0xb3')](this[_0x925d('0x1ca')](_0xb1d880))['then'](mergeDataErlangB(_0xb1d880))[_0x925d('0xb3')](this['startMethodPredictive'](_0xb1d880))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0xb1d880));}else if(!ifInterval(_0xb1d880[_0x925d('0x1c2')],_0xb1d880['startPredictive'])){_0xb1d880[_0x925d('0x10c')]=0x0;_0xb1d880['startPredictive']=moment()['format'](_0x925d('0xef'));loggerPredictive[_0x925d('0x78')](_0xb1d880[_0x925d('0x40')],'recalculate\x20predictive\x20at',_0xb1d880[_0x925d('0x2b')]);clearInterval(_0xb1d880[_0x925d('0x8c')]);_0xb1d880['handlePredictive']=undefined;this[_0x925d('0x1cb')](_0xb1d880[_0x925d('0x1c2')])[_0x925d('0xb3')](this[_0x925d('0x1ca')](_0xb1d880))[_0x925d('0xb3')](mergeDataErlangB(_0xb1d880))['then'](this['startMethodPredictive'](_0xb1d880))[_0x925d('0xaa')](loggerCatchPredictive(_0x925d('0x1cc'),_0xb1d880));}else if(_0xb1d880[_0x925d('0x6c')]&&_0x51654d<_0xb1d880[_0x925d('0x6c')]-_0x32c6a3){freeVariablesPredictive(_0xb1d880);loggerPredictive[_0x925d('0x78')](_0xb1d880[_0x925d('0x40')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x51654d,')\x20are\x20less\x20than\x20threshold\x20(',_0xb1d880[_0x925d('0x6c')],'-',_0x32c6a3,'=',_0xb1d880[_0x925d('0x6c')]-_0x32c6a3,')');}else if(_0xb1d880[_0x925d('0x6c')]&&_0x51654d>_0xb1d880[_0x925d('0x6c')]+_0x261970){freeVariablesPredictive(_0xb1d880);loggerPredictive[_0x925d('0x78')](_0xb1d880[_0x925d('0x40')],_0x925d('0x1cd'),_0x51654d,')\x20are\x20more\x20than\x20threshold\x20(',_0xb1d880['predictiveIntervalAvailable'],'+',_0x261970,'=',_0xb1d880[_0x925d('0x6c')]+_0x261970,')');}};Dialer['prototype'][_0x925d('0x1ca')]=function(_0x46c6b0){var _0x18b5ea=this;return function(_0x2e1f91){return new BPromise(function(_0x53036d,_0x1a7f44){_[_0x925d('0x88')](_0x46c6b0,_0x2e1f91[0x0]);if(checkGetDataPredictive(_0x2e1f91[0x0])){var _0x47e1ee=_0x46c6b0[_0x925d('0x6c')]=_0x46c6b0[_0x925d('0x50')]+_0x46c6b0[_0x925d('0x4d')];var _0xf834=_0x46c6b0['dialPredictiveInterval']*0x3c;var _0x422bab=_0x2e1f91[0x0]['predictiveIntervalAvgTalktime']+_0x2e1f91[0x0][_0x925d('0x67')];var _0x58c5d8=(_0x2e1f91[0x0][_0x925d('0x66')]+_0x2e1f91[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2e1f91[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2e1f91[0x0][_0x925d('0x6d')];_0x46c6b0[_0x925d('0x6b')]=_0x58c5d8>0x0?_0x58c5d8:0x1;switch(_0x46c6b0[_0x925d('0x1c4')]){case _0x925d('0x1c5'):var _0x463c8e=_0x46c6b0[_0x925d('0x1ba')]/0x64;return _0x18b5ea[_0x925d('0x1ce')](_0x47e1ee,_0xf834,_0x422bab,_0x58c5d8,_0x463c8e)[_0x925d('0xb3')](function(_0x17c0aa){return _0x53036d(_0x17c0aa);});case _0x925d('0x1cf'):var _0x475050=_0x46c6b0[_0x925d('0x1ba')]/0x64;return _0x18b5ea[_0x925d('0x1d0')](_0x47e1ee,_0xf834,_0x422bab,_0x58c5d8,_0x475050)[_0x925d('0xb3')](function(_0x198966){return _0x53036d(_0x198966);});default:return _0x1a7f44(msgResponse(_0x925d('0x1d1'),_0x925d('0x139'),_0x925d('0x1d2')));}}else{return _0x1a7f44(msgResponse(_0x925d('0x1d1'),'Failure','check\x20failure'));}});};};Dialer[_0x925d('0x1d')][_0x925d('0x1d3')]=function(_0x3d94ac){var _0x4b6970=this;return function(_0x4969c4){return new BPromise(function(_0x3c2239,_0x2796d8){_[_0x925d('0x88')](_0x3d94ac,_0x4969c4[0x0]);if(checkGetDataPredictive(_0x4969c4[0x0])){loggerPredictive[_0x925d('0x78')](JSON['stringify'](_0x4969c4[0x0]));if(_0x3d94ac[_0x925d('0x1c4')]===_0x925d('0x1c5')){return _0x4b6970[_0x925d('0x1d4')](_0x3d94ac['id'])[_0x925d('0xb3')](function(_0x357e25){var _0x2439f4=_0x3d94ac[_0x925d('0x4e')]-_0x357e25[0x0]['outboundQueuePauses'];var _0x5cd630=_0x3d94ac[_0x925d('0x1c2')]*0x3c;var _0x2f04da=_0x4969c4[0x0][_0x925d('0x1d5')]+_0x4969c4[0x0]['predictiveIntervalAvgHoldtime'];var _0x59002a=(_0x4969c4[0x0][_0x925d('0x66')]+_0x4969c4[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4969c4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4969c4[0x0]['predictiveIntervalTotalCalls'];var _0x11efc3=_0x3d94ac['dialPredictiveOptimizationPercentage']/0x64;_0x3d94ac[_0x925d('0x1d6')]=_0x357e25[0x0][_0x925d('0x1d7')]||0x0;_0x3d94ac[_0x925d('0x6b')]=_0x59002a>0x0?_0x59002a:0x1;return _0x4b6970[_0x925d('0x1ce')](_0x2439f4,_0x5cd630,_0x2f04da,_0x59002a,_0x11efc3);})[_0x925d('0xb3')](function(_0x5b6f74){return _0x3c2239(_0x5b6f74);})['catch'](function(_0xb5f49d){return _0x2796d8(msgResponse(_0x925d('0x1d8'),_0x925d('0x139'),JSON[_0x925d('0x48')](_0xb5f49d)));});}if(_0x3d94ac[_0x925d('0x1c4')]===_0x925d('0x1cf')){return _0x4b6970[_0x925d('0x1d4')](_0x3d94ac['id'])[_0x925d('0xb3')](function(_0x40ef38){var _0x3f1367=_0x3d94ac[_0x925d('0x4e')]-_0x40ef38[0x0][_0x925d('0x1d7')];var _0x2abb9b=_0x3d94ac['dialPredictiveInterval']*0x3c;var _0x4964ab=_0x4969c4[0x0]['predictiveIntervalAvgTalktime']+_0x4969c4[0x0]['predictiveIntervalAvgHoldtime'];var _0x31f675=(_0x4969c4[0x0][_0x925d('0x66')]+_0x4969c4[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4969c4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4969c4[0x0]['predictiveIntervalTotalCalls'];var _0x4d92cb=_0x3d94ac[_0x925d('0x1ba')]/0x64;_0x3d94ac['predictiveIntervalPauses']=_0x40ef38[0x0][_0x925d('0x1d7')]||0x0;_0x3d94ac[_0x925d('0x6b')]=_0x31f675>0x0?_0x31f675:0x1;return _0x4b6970[_0x925d('0x1d0')](_0x3f1367,_0x2abb9b,_0x4964ab,_0x31f675,_0x4d92cb);})[_0x925d('0xb3')](function(_0x19f9f2){return _0x3c2239(_0x19f9f2);})['catch'](function(_0x4defcd){return _0x2796d8(msgResponse(_0x925d('0x1d8'),_0x925d('0x139'),JSON['stringify'](_0x4defcd)));});}}else{return _0x2796d8(msgResponse(_0x925d('0x1d1'),'Failure',_0x925d('0x1d9')));}});};};Dialer[_0x925d('0x1d')][_0x925d('0x1da')]=function(_0x3b3672){var _0x405276=this;return function(){var _0x5d7bd7=0x0;var _0x575e22=Math[_0x925d('0x1be')](_0x3b3672['erlangCallToSecond']*0x3e8);if(_0x575e22>0x0){_0x575e22=_0x575e22<0x64?0x64:_0x575e22;loggerPredictive['info'](_0x3b3672[_0x925d('0x40')],_0x925d('0x1db'),_0x575e22,_0x925d('0x1dc'));_0x3b3672['handlePredictive']=setInterval(function(){_0x405276[_0x925d('0x8c')](_0x3b3672);loggerPredictiveCalls[_0x925d('0x78')](_0x925d('0x1dd'),_0x5d7bd7+=0x1);},_0x575e22);}else{loggerPredictive['info'](_0x3b3672[_0x925d('0x40')],_0x925d('0x1de'));}};};Dialer[_0x925d('0x1d')][_0x925d('0x1df')]=function(_0x5b74c4,_0x4a7b38){var _0x559054=this;return function(_0x228570){if(_[_0x925d('0x46')](_0x228570)){if(_['isNil'](_0x4a7b38[_0x925d('0xca')])||!_0x4a7b38[_0x925d('0x1e0')]){if(_0x5b74c4[_0x925d('0x57')]==='booked'){_0x5b74c4[_0x925d('0x122')]=_[_0x925d('0x3d')](_0x5b74c4[_0x925d('0x122')])?!![]:_0x5b74c4['queueStatusComplete'];var _0xddeffe=uuid['v4']();_0x559054[_0x925d('0x27')][_0xddeffe]=new Action(_0x5b74c4,_0x4a7b38,_0xddeffe);loggerBooked[_0x925d('0x78')](_0x925d('0x1e1'),_0xddeffe,'queueStatusComplete:\x20',JSON['stringify'](_0x5b74c4[_0x925d('0x122')]),_0x925d('0x1e2'),_0x5b74c4[_0x925d('0x40')]);if(_0x5b74c4[_0x925d('0x122')]){_0x5b74c4[_0x925d('0x122')]=![];_0x559054['queueBooked'][_0x559054[_0x925d('0x27')][_0xddeffe][_0x925d('0xad')]]=[];ami[_0x925d('0x140')]({'actionid':_0xddeffe,'action':_0x925d('0x1e3'),'queue':_0x5b74c4[_0x925d('0x40')]})[_0x925d('0xaa')](function(_0x2d4e8b){_0x559054['updateOriginated'](_0x5b74c4);_0x559054[_0x925d('0xbb')]({'active':![],'ContactId':_0x559054['actions'][_0xddeffe]['ContactId'],'ListId':_0x559054[_0x925d('0x27')][_0xddeffe][_0x925d('0xf0')],'VoiceQueueId':_0x559054[_0x925d('0x27')][_0xddeffe][_0x925d('0xcb')]||undefined,'CampaignId':_0x559054[_0x925d('0x27')][_0xddeffe]['CampaignId']||undefined})[_0x925d('0xaa')](loggerCatch(_0x925d('0x1e4')));delete _0x559054[_0x925d('0x27')][_0xddeffe];});}else{loggerBooked['info'](_0x925d('0x1e5'),JSON[_0x925d('0x48')](_0x5b74c4['queueStatusComplete']),_0x925d('0x1e2'),_0x5b74c4['name']);_0x559054[_0x925d('0xaf')](_0x5b74c4);_0x559054[_0x925d('0xbb')]({'active':![],'ContactId':_0x559054[_0x925d('0x27')][_0xddeffe][_0x925d('0xc9')],'ListId':_0x559054['actions'][_0xddeffe][_0x925d('0xf0')],'VoiceQueueId':_0x559054[_0x925d('0x27')][_0xddeffe]['VoiceQueueId']||undefined,'CampaignId':_0x559054[_0x925d('0x27')][_0xddeffe][_0x925d('0xcc')]||undefined})['catch'](loggerCatch(_0x925d('0x1e4')));delete _0x559054['actions'][_0xddeffe];}}else{return _0x559054[_0x925d('0x15d')](_0x5b74c4,_0x4a7b38);}}else{if(getDiff(_0x4a7b38[_0x925d('0x1e6')])<_0x5b74c4['dialRecallMeTimeout']*0x3c){if(_0x4a7b38[_0x925d('0x1e7')]&&!_0x4a7b38[_0x925d('0x1e7')]['voicePause']){_0x559054['preview']['run'](_0x4a7b38['id'])['finally'](function(){_0x559054[_0x925d('0xaf')](_0x5b74c4);});}else{_0x559054[_0x925d('0xbd')]({'active':![]},_0x4a7b38['id'],0x1)[_0x925d('0x1f')](function(){console[_0x925d('0x1e8')](_0x925d('0x1e9'));_0x559054[_0x925d('0xaf')](_0x5b74c4);});}}else{_0x5b74c4[_0x925d('0x1ea')]+=0x1;_0x559054[_0x925d('0xaf')](_0x5b74c4);if(_0x5b74c4['dialRecallInQueue']){_0x559054[_0x925d('0xbb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4a7b38[_0x925d('0xc9')],'ListId':_0x4a7b38[_0x925d('0xf0')],'VoiceQueueId':_0x4a7b38[_0x925d('0xcb')]||undefined,'CampaignId':_0x4a7b38[_0x925d('0xcc')]||undefined})[_0x925d('0xaa')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x559054[_0x925d('0xc4')](createObjHistory(_0x5b74c4,_0x4a7b38,'RECALLINQUEUE',0x17,_0x925d('0x1eb')))[_0x925d('0xaa')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x559054[_0x925d('0xf2')](createObjHistory(_0x5b74c4,_0x4a7b38,_0x925d('0x1ec'),0x16,_0x925d('0x1ed')),_0x925d('0x1ee'),_0x925d('0x1ef'));}}}}else{_0x5b74c4[_0x925d('0x5d')]+=0x1;_0x559054[_0x925d('0xf2')](createObjHistory(_0x5b74c4,_0x4a7b38,_0x925d('0x1f0'),0xd,_0x925d('0x1f1')),_0x925d('0x1f2'),_0x925d('0x1f3'));throw _0x925d('0x1f4');}};};Dialer[_0x925d('0x1d')][_0x925d('0x154')]=function(_0x13920d){var _0x2ca927=this;var _0x55250a=[];var _0x497c44=_0x13920d[_0x925d('0x1f5')]-_0x13920d['originated']-_0x13920d['temp'];emitCampaignSummary(_0x13920d);if(_0x497c44>0x0){if(_0x497c44>this['maxNumberOriginate']){_0x497c44=this[_0x925d('0x25')];}_0x13920d[_0x925d('0x1f6')]+=_0x497c44;this['getContactDialerIvr'](_0x13920d['id'],_0x497c44,_0x13920d[_0x925d('0x1f7')])[_0x925d('0xb3')](function(_0x2d0743){_0x13920d['temp']-=_0x497c44;_0x13920d['temp']=_0x13920d[_0x925d('0x1f6')]>0x0?_0x13920d['temp']:0x0;if(!checkContactEmpty(_0x2d0743)){_0x13920d[_0x925d('0x3e')]=_0x925d('0x9b');logger[_0x925d('0x78')](_0x925d('0x1f8')+_0x13920d[_0x925d('0x40')]);}else{_0x13920d[_0x925d('0x6e')]+=_0x2d0743[_0x925d('0x93')];_0x13920d[_0x925d('0x3e')]=_0x925d('0x1f9');for(var _0x253a21=0x0;_0x253a21<_0x2d0743[_0x925d('0x93')];_0x253a21+=0x1){_0x13920d['ivrTotalCallsDays']+=0x1;if(_[_0x925d('0xa8')](_0x2d0743[_0x253a21])||_['isNil'](_0x2d0743[_0x253a21][_0x925d('0x161')])||_['isNil'](_0x2d0743[_0x253a21][_0x925d('0x161')][_0x925d('0x162')])){_0x2ca927['emptyContact'](_0x925d('0x1fa'),_0x13920d,_0x2d0743[_0x253a21]);}else{_0x2ca927[_0x925d('0xb7')](_[_0x925d('0x1fb')](_0x2d0743[_0x253a21],['CampaignId','Contact.phone']))[_0x925d('0xb3')](_0x2ca927[_0x925d('0x1df')](_0x13920d,_0x2d0743[_0x253a21]))[_0x925d('0xaa')](_0x2ca927[_0x925d('0xc7')](_0x925d('0x1fc'),_0x13920d));}}}})[_0x925d('0xaa')](loggerGetContactDialer(_0x925d('0x1fd'),_0x13920d,_0x497c44));}};Dialer[_0x925d('0x1d')][_0x925d('0x14f')]=function(_0x5bccec,_0x5a5a3b){var _0x9c9f00=this;var _0x3af80d=[];var _0x43f5f6=_0x5a5a3b>=0x1?_0x5a5a3b:0x1;var _0x537637=[];if(_0x5bccec[_0x925d('0x57')]===_0x925d('0x1fe')){_0x43f5f6=0x1;}var _0x24b87f=Math[_0x925d('0x1be')](_0x5bccec[_0x925d('0x4d')]*_0x43f5f6)-_0x5bccec['originated']-_0x5bccec[_0x925d('0x1f6')];emitVoiceQueueSummary(_0x5bccec);if(_0x5bccec['dialLimitQueue']>0x0){var _0x36e730=_0x5bccec[_0x925d('0x1ff')]-_0x5bccec[_0x925d('0x6e')]-_0x5bccec['talking']-_0x5bccec[_0x925d('0x1f6')]-_0x5bccec[_0x925d('0x200')];if(_0x24b87f>_0x36e730){_0x24b87f=_0x36e730;}}if(_0x24b87f>0x0){if(_0x5bccec['dialMethod']==='booked'){_0x24b87f=0x1;}if(_0x24b87f>this[_0x925d('0x25')]){_0x24b87f=this[_0x925d('0x25')];}_0x5bccec[_0x925d('0x1f6')]+=_0x24b87f;for(var _0x5b4223 in this[_0x925d('0x23')]){if(this[_0x925d('0x23')][_0x925d('0x94')](_0x5b4223)){if(this[_0x925d('0x23')][_0x5b4223][_0x925d('0xa3')]===_0x925d('0x201')&&this[_0x925d('0x23')][_0x5b4223][_0x925d('0xd3')]==='reachable'){_0x3af80d[_0x925d('0x13f')](this[_0x925d('0x23')][_0x5b4223]['id']);}}}this[_0x925d('0xbf')](_0x5bccec['id'],_0x3af80d,_0x24b87f,_0x5bccec[_0x925d('0x1f7')])['then'](function(_0x2d4a8f){_0x5bccec['temp']-=_0x24b87f;_0x5bccec[_0x925d('0x1f6')]=_0x5bccec[_0x925d('0x1f6')]>0x0?_0x5bccec[_0x925d('0x1f6')]:0x0;if(!checkContactEmpty(_0x2d4a8f)){_0x9c9f00['countReScheduled'](_0x5bccec)[_0x925d('0xb3')](sendMessageReschedule(_0x5bccec))[_0x925d('0xaa')](loggerCatch(_0x925d('0xb4')));}else{_0x5bccec[_0x925d('0x6e')]+=_0x2d4a8f[_0x925d('0x93')];_0x5bccec[_0x925d('0x3e')]=_0x5bccec[_0x925d('0x57')]==='booked'?_0x925d('0x169'):_0x925d('0x1f9');for(var _0x1120de=0x0;_0x1120de<_0x2d4a8f[_0x925d('0x93')];_0x1120de+=0x1){if(_[_0x925d('0xa8')](_0x2d4a8f[_0x1120de])||_[_0x925d('0xa8')](_0x2d4a8f[_0x1120de][_0x925d('0x161')])||_[_0x925d('0xa8')](_0x2d4a8f[_0x1120de]['Contact']['phone'])){_0x9c9f00['emptyContact'](_0x925d('0x1fa'),_0x5bccec,_0x2d4a8f[_0x1120de]);}else{_0x9c9f00['checkIsBlackList'](_[_0x925d('0x1fb')](_0x2d4a8f[_0x1120de],[_0x925d('0xcb'),_0x925d('0x202')]))[_0x925d('0xb3')](_0x9c9f00['checkContactBlack'](_0x5bccec,_0x2d4a8f[_0x1120de]))[_0x925d('0xaa')](_0x9c9f00[_0x925d('0xc7')](_0x925d('0x1fa'),_0x5bccec));}}}})['catch'](loggerGetContactDialer(_0x925d('0x203'),_0x5bccec,_0x24b87f));}};Dialer[_0x925d('0x1d')][_0x925d('0x8c')]=function(_0x527213){var _0xd88e31=this;if(_0x527213[_0x925d('0x1ff')]>0x0){var _0x33012f=_0x527213[_0x925d('0x1ff')]-_0x527213['originated']-_0x527213[_0x925d('0x50')];if(_0x33012f>0x0){this[_0x925d('0x204')](_0x527213);}else{loggerPredictiveCalls[_0x925d('0x78')](_0x925d('0x205'));}}else{this['tryOriginatePredictive'](_0x527213);}};Dialer['prototype'][_0x925d('0x204')]=function(_0x8facef){var _0x235d37=this;var _0x55473e=[];_0x8facef[_0x925d('0x6e')]+=0x1;for(var _0x5059ba in this['agents']){if(this[_0x925d('0x23')][_0x925d('0x94')](_0x5059ba)){if(this[_0x925d('0x23')][_0x5059ba][_0x925d('0xa3')]==='not_inuse'&&this[_0x925d('0x23')][_0x5059ba][_0x925d('0xd3')]===_0x925d('0xd4')){_0x55473e[_0x925d('0x13f')](this['agents'][_0x5059ba]['id']);}}}this[_0x925d('0xbf')](_0x8facef['id'],_0x55473e,0x1,_0x8facef[_0x925d('0x1f7')])[_0x925d('0xb3')](function(_0x162997){if(!checkContactEmpty(_0x162997)){checkContactLowerLimitOriginate(_0x8facef,0x1,0x0);_0x235d37[_0x925d('0xb1')](_0x8facef)[_0x925d('0xb3')](sendMessageReschedule(_0x8facef))[_0x925d('0xaa')](loggerCatch(_0x925d('0xb4')));}else{_0x8facef[_0x925d('0x3e')]=_0x925d('0x1f9');if(_[_0x925d('0xa8')](_0x162997[0x0])||_['isNil'](_0x162997[0x0][_0x925d('0x161')])||_[_0x925d('0xa8')](_0x162997[0x0]['Contact']['phone'])){_0x235d37[_0x925d('0x206')](_0x925d('0x1fa'),_0x8facef,_0x162997[0x0]);}else{_0x235d37[_0x925d('0xb5')](_[_0x925d('0x1fb')](_0x162997[0x0],[_0x925d('0xcb'),_0x925d('0x202')]))['then'](_0x235d37[_0x925d('0x1df')](_0x8facef,_0x162997[0x0]))['catch'](_0x235d37[_0x925d('0xc7')](_0x925d('0x207'),_0x8facef));}}})['catch'](loggerGetContactDialer(_0x925d('0x208'),_0x8facef,0x1));emitVoiceQueueSummary(_0x8facef);};Dialer['prototype']['abandonmentRate']=function(_0x31f9f8,_0x3e3a54,_0x2bef61,_0x3cf5d0,_0x5a015d,_0x4812e3){loggerPredictive[_0x925d('0x78')](_0x925d('0x209'));loggerPredictive['info'](_0x925d('0x20a'),_0x31f9f8);loggerPredictive[_0x925d('0x78')](_0x925d('0x20b'),_0x3e3a54);loggerPredictive[_0x925d('0x78')](_0x925d('0x20c'),_0x2bef61);loggerPredictive['info'](_0x925d('0x20d'),_0x3cf5d0);loggerPredictive[_0x925d('0x78')](_0x925d('0x20e'),_0x5a015d);loggerPredictive[_0x925d('0x78')]('---------------------------');return new BPromise(function(_0x29d6fd,_0x1e71ad){if(_0x31f9f8<=0x0||isNaN(_0x31f9f8)){return _0x1e71ad(msgResponse(_0x925d('0x20f'),_0x925d('0x47'),'m\x20=\x20'+_0x31f9f8));}if(_0x2bef61<=0x0||isNaN(_0x2bef61)){return _0x1e71ad(msgResponse('[abandonmentRate]',_0x925d('0x47'),_0x925d('0x210')+_0x2bef61));}if(_0x3cf5d0<=0x0||isNaN(_0x3cf5d0)){return _0x1e71ad(msgResponse(_0x925d('0x20f'),_0x925d('0x47'),'p\x20=\x20'+_0x3cf5d0));}if(_0x3e3a54<=0x0||isNaN(_0x3e3a54)){return _0x1e71ad(msgResponse(_0x925d('0x20f'),_0x925d('0x47'),_0x925d('0x211')+_0x3e3a54));}if(_0x5a015d<=0x0||isNaN(_0x5a015d)){return _0x1e71ad(msgResponse(_0x925d('0x20f'),_0x925d('0x47'),'Amax\x20=\x20'+_0x5a015d));}_0x4812e3=_0x4812e3||0x0;var _0x2f96ac=0x1/_0x2bef61;var _0xdd950f=0x0;var _0x11cabe=0x0;var _0x8183cf=0x0;var _0x457059=0x0;for(var _0x584558=0x0;_0x8183cf<_0x5a015d;_0x584558+=0x1){_0x11cabe=_0x584558/_0x3e3a54;_0xdd950f=(_0x3cf5d0*_0x11cabe+_0x4812e3)/_0x2f96ac;_0x8183cf=erlangb(_0xdd950f,_0x31f9f8);_0x457059=_0xdd950f/_0x31f9f8*(0x1-erlangb(_0xdd950f,_0x31f9f8));}return _0x29d6fd({'erlangCalls':_0x584558,'erlangCallToSecond':_0x3e3a54/_0x584558,'erlangAbandonmentRate':_0x8183cf,'erlangBusyFactor':_0x457059});});};Dialer[_0x925d('0x1d')][_0x925d('0x1d0')]=function(_0xb5dfba,_0xe9cd0b,_0x94ce2c,_0x161aae,_0x11720c,_0x59c2b1){loggerPredictive['info'](_0x925d('0x212'));loggerPredictive[_0x925d('0x78')](_0x925d('0x20a'),_0xb5dfba);loggerPredictive[_0x925d('0x78')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xe9cd0b);loggerPredictive[_0x925d('0x78')]('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',_0x94ce2c);loggerPredictive[_0x925d('0x78')](_0x925d('0x20d'),_0x161aae);loggerPredictive[_0x925d('0x78')](_0x925d('0x213'),_0x11720c);loggerPredictive[_0x925d('0x78')](_0x925d('0x7f'));return new BPromise(function(_0x29ab4f,_0x117b0b){if(_0xb5dfba<=0x0||isNaN(_0xb5dfba)){return _0x117b0b(msgResponse(_0x925d('0x214'),_0x925d('0x47'),_0x925d('0x215')+_0xb5dfba));}if(_0x94ce2c<=0x0||isNaN(_0x94ce2c)){return _0x117b0b(msgResponse(_0x925d('0x214'),_0x925d('0x47'),_0x925d('0x210')+_0x94ce2c));}if(_0x161aae<=0x0||isNaN(_0x161aae)){return _0x117b0b(msgResponse('[busyFactor]',_0x925d('0x47'),'p\x20=\x20'+_0x161aae));}if(_0xe9cd0b<=0x0||isNaN(_0xe9cd0b)){return _0x117b0b(msgResponse(_0x925d('0x214'),_0x925d('0x47'),_0x925d('0x211')+_0xe9cd0b));}if(_0x11720c<=0x0||isNaN(_0x11720c)){return _0x117b0b(msgResponse(_0x925d('0x214'),_0x925d('0x47'),_0x925d('0x216')+_0x11720c));}_0x59c2b1=_0x59c2b1||0x0;var _0x5ac198=0x1/_0x94ce2c;var _0x534771=0x0;var _0x3fd23a=0x0;var _0x471266=0x0;var _0x2ad76f=0x0;for(var _0x42d76c=0x0;_0x2ad76f<_0x11720c;_0x42d76c+=0x1){_0x3fd23a=_0x42d76c/_0xe9cd0b;_0x534771=(_0x161aae*_0x3fd23a+_0x59c2b1)/_0x5ac198;_0x471266=erlangb(_0x534771,_0xb5dfba);_0x2ad76f=_0x534771/_0xb5dfba*(0x1-erlangb(_0x534771,_0xb5dfba));}return _0x29ab4f({'erlangCalls':_0x42d76c,'erlangCallToSecond':_0xe9cd0b/_0x42d76c,'erlangAbandonmentRate':_0x471266,'erlangBusyFactor':_0x2ad76f});});};module['exports']=Dialer; \ No newline at end of file +var _0x2ba3=['outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','callerid','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','clearZombieChannels','[actions]','hasOwnProperty','enqueue','isNil','Action','status','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','merge','ContactId','UserId','CampaignId','isSuccess','Success','isTrunkReachable','active','SIP/%s','reachable','unmonitored','saveInDb','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','state','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','dialAMDActive','Machine','countglobal','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','VoiceQueueId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','amd','countnosuchnumberretry','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dropreason','dialDropMaxRetry','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','predictiveIntervalDroppedCallsCallersExit','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','locked','paused','stateinterface','queueBooked','push','pick','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','timezones','indexOf','true','iftime\x20%s,%s','content','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','%s%s','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','phone','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','getQueue','response','[callProgressDetecting]\x20','countbusyretry','dialNoAnswerMaxRetry','add','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildObj','noanswer','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','busyFactor','check\x20failure','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','Agent','voicePause','Contact\x20updated','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','emptyContact','[actionOriginate]\x20','Contact.phone','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','getContactDialer','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Error','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','lodash','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','varset','syncVarSet','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','message','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','stringify','milliseconds','diff','seconds','emit','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x2ba3,0x1c2));var _0x32ba=function(_0x4d2663,_0x1c0704){_0x4d2663=_0x4d2663-0x0;var _0x4db53b=_0x2ba3[_0x4d2663];return _0x4db53b;};'use strict';var util=require('util');var _=require(_0x32ba('0x0'));var BPromise=require(_0x32ba('0x1'));var uuid=require(_0x32ba('0x2'));var moment=require('moment');var rr=require('rr');var md5=require(_0x32ba('0x3'));var Redis=require(_0x32ba('0x4'));var ut=require(_0x32ba('0x5'));var config=require(_0x32ba('0x6'));var logger=require(_0x32ba('0x7'))(_0x32ba('0x8'));var loggerBooked=require(_0x32ba('0x7'))(_0x32ba('0x9'));var loggerPredictive=require(_0x32ba('0x7'))(_0x32ba('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0x32ba('0xb'));var loggerSyncQueueSummary=require(_0x32ba('0x7'))(_0x32ba('0xc'));var ami=require('../ami');config[_0x32ba('0xd')]=_[_0x32ba('0xe')](config[_0x32ba('0xd')],{'host':_0x32ba('0xf'),'port':0x18eb});var io=require(_0x32ba('0x10'))(new Redis(config['redis']));var cmHopper=require(_0x32ba('0x11'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x32ba('0x12'));var cmHopperBlack=require(_0x32ba('0x13'));var voiceQueueRt=require(_0x32ba('0x14'));var Action=require('./action');var History=require(_0x32ba('0x15'));var Final=require(_0x32ba('0x16'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x32ba('0x17'));var Hangup=require(_0x32ba('0x18'));var ipAgi=process['env'][_0x32ba('0x19')]||_0x32ba('0x1a');var strategy={'rrmemory':_0x32ba('0x1b'),'roundrobin':_0x32ba('0x1c')};var Sequence=function(){};Sequence[_0x32ba('0x1d')]['enqueue']=function(_0x5a84a){this['tail']=this[_0x32ba('0x1e')]?this[_0x32ba('0x1e')][_0x32ba('0x1f')](_0x5a84a):_0x5a84a();};function Dialer(_0x13f3b9,_0x266168){this[_0x32ba('0x20')]=new Sequence();this['preview']=_0x266168;this['voiceQueues']=_0x13f3b9[_0x32ba('0x21')];this[_0x32ba('0x22')]=_0x13f3b9['campaigns'];this[_0x32ba('0x23')]=_0x13f3b9['agents'];this[_0x32ba('0x24')]=_0x13f3b9[_0x32ba('0x24')];this[_0x32ba('0x25')]=config[_0x32ba('0x25')]||0x2;this[_0x32ba('0x26')]={};this[_0x32ba('0x27')]={};this['contactsId']={};this[_0x32ba('0x28')]={};this[_0x32ba('0x29')]={};this[_0x32ba('0x2a')]={};this[_0x32ba('0x2b')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0x32ba('0x2c')]={};ami['on'](_0x32ba('0x2d'),this[_0x32ba('0x2e')]['bind'](this));ami['on'](_0x32ba('0x2f'),this[_0x32ba('0x30')][_0x32ba('0x31')](this));ami['on'](_0x32ba('0x32'),this['syncOriginateResponse'][_0x32ba('0x31')](this));ami['on']('agentcomplete',this[_0x32ba('0x33')][_0x32ba('0x31')](this));ami['on'](_0x32ba('0x34'),this[_0x32ba('0xc')]['bind'](this));ami['on'](_0x32ba('0x35'),this[_0x32ba('0x36')][_0x32ba('0x31')](this));ami['on'](_0x32ba('0x37'),this['syncNewExten']['bind'](this));ami['on'](_0x32ba('0x38'),this[_0x32ba('0x39')][_0x32ba('0x31')](this));ami['on']('queuemember',this[_0x32ba('0x3a')]['bind'](this));ami['on']('queuestatuscomplete',this[_0x32ba('0x3b')][_0x32ba('0x31')](this));this['loopCampaigns']();this[_0x32ba('0x3c')]();}function isNotNull(_0x4ebafd){return _0x4ebafd!==null&&!_[_0x32ba('0x3d')](_0x4ebafd);}function checkIsLoggedIn(_0x1876c2,_0x309b14){return function(){if(_0x309b14<=0x0){_0x1876c2['message']=_0x32ba('0x3e');throw _0x1876c2['name']+_0x32ba('0x3f');}};}function isActive(_0x56cdd6){return _0x56cdd6;}function checkIsActive(_0x104407,_0x2a4b3b){return function(){if(!isActive(_0x2a4b3b)){_0x104407[_0x32ba('0x40')]='NOT_ACTIVE';throw _0x104407[_0x32ba('0x41')]+_0x32ba('0x42');}};}function checkInterval(_0xf4e3bc){return function(){if(!isNotNull(_0xf4e3bc[_0x32ba('0x43')])){_0xf4e3bc['message']=_0x32ba('0x44');throw _0xf4e3bc[_0x32ba('0x41')]+_0x32ba('0x45');}if(!isNotNull(_0xf4e3bc['Interval']['Intervals'])){_0xf4e3bc[_0x32ba('0x40')]=_0x32ba('0x44');throw _0xf4e3bc[_0x32ba('0x41')]+_0x32ba('0x45');}if(!isNotNull(_['isEmpty'](_0xf4e3bc[_0x32ba('0x43')][_0x32ba('0x46')]))){_0xf4e3bc['message']=_0x32ba('0x44');throw _0xf4e3bc[_0x32ba('0x41')]+_0x32ba('0x45');}};}function msgResponse(_0x5e6d55,_0x75b1a7,_0x23a3a2){return{'action':_0x5e6d55,'response':_0x75b1a7,'message':_0x23a3a2,'stack':_0x23a3a2};}function myreject(_0x122757){return function(_0x10faea){return _0x122757(msgResponse('[ifTime][Action]','Error',JSON[_0x32ba('0x47')](_0x10faea)));};}function getSeconds(_0x141790,_0x1f548b){var _0x28ead7=moment(_0x141790)['milliseconds'](0x0);var _0x45482b=moment(_0x1f548b)[_0x32ba('0x48')](0x0);return _0x28ead7[_0x32ba('0x49')](_0x45482b,_0x32ba('0x4a'));}function emit(_0x24c0c3,_0x52f157,_0x1ab679){io['to'](_0x24c0c3)[_0x32ba('0x4b')](_0x52f157,_0x1ab679);}function emitVoiceQueueSummary(_0x2f5575){if(_0x2f5575['type']===_0x32ba('0x4c')){var _0x27c89f={'id':_0x2f5575['id'],'name':_0x2f5575[_0x32ba('0x41')],'strategy':_0x2f5575[_0x32ba('0x4d')],'answered':_0x2f5575[_0x32ba('0x4e')],'available':_0x2f5575[_0x32ba('0x4f')],'loggedIn':_0x2f5575[_0x32ba('0x50')],'pTalking':_0x2f5575[_0x32ba('0x51')],'sumBillable':_0x2f5575[_0x32ba('0x52')],'sumDuration':_0x2f5575[_0x32ba('0x53')],'sumHoldTime':_0x2f5575[_0x32ba('0x54')]||0x0,'talking':_0x2f5575['talking'],'total':_0x2f5575[_0x32ba('0x55')],'type':_0x2f5575[_0x32ba('0x56')],'unmanaged':_0x2f5575[_0x32ba('0x57')],'abandoned':_0x2f5575[_0x32ba('0x58')],'waiting':_0x2f5575[_0x32ba('0x59')],'loggedInDb':_0x2f5575[_0x32ba('0x5a')],'dialActive':_0x2f5575[_0x32ba('0x5b')],'dialMethod':_0x2f5575[_0x32ba('0x5c')],'dialOriginateCallerIdName':_0x2f5575[_0x32ba('0x5d')],'dialOriginateCallerIdNumber':_0x2f5575['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x2f5575['dialOriginateTimeout'],'dialPrefix':_0x2f5575['dialPrefix'],'outboundAnswerAgiCallsDay':_0x2f5575['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x2f5575[_0x32ba('0x5e')],'outboundBlacklistCallsDay':_0x2f5575[_0x32ba('0x5f')],'outboundBusyCallsDay':_0x2f5575[_0x32ba('0x60')],'outboundCongestionCallsDay':_0x2f5575[_0x32ba('0x61')],'outboundDropCallsDayACS':_0x2f5575[_0x32ba('0x62')],'outboundDropCallsDayCallersExit':_0x2f5575[_0x32ba('0x63')],'outboundDropCallsDayTimeout':_0x2f5575[_0x32ba('0x64')],'outboundNoAnswerCallsDay':_0x2f5575['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x2f5575[_0x32ba('0x65')],'outboundOriginateFailureCallsDay':_0x2f5575['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x2f5575[_0x32ba('0x66')],'outboundRejectCallsDay':_0x2f5575[_0x32ba('0x67')],'outboundUnknownCallsDay':_0x2f5575['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x2f5575[_0x32ba('0x68')],'predictiveIntervalAvgHoldtime':_0x2f5575[_0x32ba('0x69')],'predictiveIntervalAvgTalktime':_0x2f5575[_0x32ba('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x2f5575['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x2f5575[_0x32ba('0x6b')],'predictiveIntervalErlangCalls':_0x2f5575['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x2f5575[_0x32ba('0x6c')],'predictiveIntervalHitRate':_0x2f5575[_0x32ba('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x2f5575['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x2f5575['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x2f5575[_0x32ba('0x6e')],'predictiveIntervalTotalCalls':_0x2f5575[_0x32ba('0x6f')],'message':_0x2f5575[_0x32ba('0x40')],'originated':_0x2f5575[_0x32ba('0x70')],'erlangCalls':_0x2f5575[_0x32ba('0x71')],'erlangCallToSecond':_0x2f5575[_0x32ba('0x72')],'erlangAbandonmentRate':_0x2f5575['erlangAbandonmentRate'],'erlangBusyFactor':_0x2f5575[_0x32ba('0x73')],'startPredictive':_0x2f5575['startPredictive'],'startProgressive':_0x2f5575[_0x32ba('0x2b')]};if(_0x2f5575[_0x32ba('0x74')]){_0x27c89f[_0x32ba('0x74')]={'id':_0x2f5575[_0x32ba('0x74')]['id'],'name':_0x2f5575[_0x32ba('0x74')]['name'],'active':_0x2f5575['Trunk']['active'],'callerid':_0x2f5575['Trunk'][_0x32ba('0x75')]};}if(_0x2f5575['Interval']){_0x27c89f['Interval']={'id':_0x2f5575[_0x32ba('0x43')]['id'],'name':_0x2f5575['Interval']['name']};}var _0x3db653=md5(JSON[_0x32ba('0x47')](_0x27c89f));if(_0x2f5575['md5']!==_0x3db653){_0x2f5575['md5']=_0x3db653;emit(util[_0x32ba('0x76')]('voice:queue:%s',_0x27c89f['name']),_0x32ba('0x77'),_0x27c89f);}}}function emitCampaignSummary(_0x48d94d){if(_0x48d94d[_0x32ba('0x56')]===_0x32ba('0x78')){emit(util['format'](_0x32ba('0x79'),_0x48d94d[_0x32ba('0x41')]),_0x32ba('0x7a'),_0x48d94d);}}function checkGetDataPredictive(_0x380c4d){if(isNotNull(_0x380c4d)){if(!_[_0x32ba('0x7b')](_0x380c4d)){loggerPredictive[_0x32ba('0x7c')](_0x32ba('0x7d'));loggerPredictive['info'](_0x32ba('0x7e'),_0x380c4d['predictiveIntervalTotalCalls']);loggerPredictive[_0x32ba('0x7c')](_0x32ba('0x7f'),_0x380c4d[_0x32ba('0x68')]);loggerPredictive[_0x32ba('0x7c')](_0x32ba('0x80'),_0x380c4d[_0x32ba('0x6b')]);loggerPredictive[_0x32ba('0x7c')](_0x32ba('0x81'),_0x380c4d['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x32ba('0x7c')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x380c4d['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x32ba('0x82'),_0x380c4d[_0x32ba('0x6a')]);loggerPredictive['info']('---------------------------');if(_0x380c4d['predictiveIntervalTotalCalls']>0x0){if(!_[_0x32ba('0x3d')](_0x380c4d[_0x32ba('0x6a')])&&_0x380c4d[_0x32ba('0x6a')]>0x0){return!![];}else{loggerPredictive[_0x32ba('0x7c')](_0x32ba('0x83'));}if(!_[_0x32ba('0x3d')](_0x380c4d[_0x32ba('0x69')])&&_0x380c4d['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x32ba('0x7c')](_0x32ba('0x84'));}}else{loggerPredictive['info'](_0x32ba('0x85'));}}else{loggerPredictive['info'](_0x32ba('0x85'));}return![];}function mergeDataErlangB(_0x340c49){return function(_0x109e5b){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x32ba('0x7c')](_0x32ba('0x86'),_0x109e5b[_0x32ba('0x71')]);loggerPredictive[_0x32ba('0x7c')](_0x32ba('0x87'),_0x109e5b[_0x32ba('0x72')]);loggerPredictive['info'](_0x32ba('0x88'),_0x109e5b[_0x32ba('0x89')]);loggerPredictive[_0x32ba('0x7c')](_0x32ba('0x8a'),_0x109e5b[_0x32ba('0x73')]);loggerPredictive[_0x32ba('0x7c')](_0x32ba('0x88'),_0x109e5b['erlangAbandonmentRate']);loggerPredictive[_0x32ba('0x7c')](_0x32ba('0x8b'));_['merge'](_0x340c49,_0x109e5b);};}function getDiff(_0x14cb30){var _0x2da685=moment()[_0x32ba('0x48')](0x0);var _0x5192c2=moment(_0x14cb30)[_0x32ba('0x48')](0x0);return _0x2da685['diff'](_0x5192c2,'seconds');}function ifInterval(_0x2fb1fb,_0x4cbb1d){if(_[_0x32ba('0x3d')](_0x4cbb1d)){return![];}if(getDiff(_0x4cbb1d)<_0x2fb1fb*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x3ca52f){if(isNotNull(_0x3ca52f)){if(!_['isUndefined'](_0x3ca52f['startProgressive'])){_0x3ca52f[_0x32ba('0x2b')]=undefined;loggerPredictive[_0x32ba('0x7c')](_0x3ca52f[_0x32ba('0x41')],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x3ca52f[_0x32ba('0x2a')])){_0x3ca52f['startPredictive']=undefined;loggerPredictive[_0x32ba('0x7c')](_0x3ca52f[_0x32ba('0x41')],_0x32ba('0x8c'));}if(!_[_0x32ba('0x3d')](_0x3ca52f[_0x32ba('0x8d')])){clearInterval(_0x3ca52f[_0x32ba('0x8d')]);_0x3ca52f[_0x32ba('0x8d')]=undefined;loggerPredictive['info'](_0x3ca52f['name'],_0x32ba('0x8e'));}}}function erlangb(_0x31f3e0,_0xd9790e){if(_0xd9790e===0x0){return 0x0;}var _0x4b396e=0x1;for(var _0x2d126c=0x1;_0x2d126c<=_0xd9790e;_0x2d126c+=0x1){_0x4b396e=0x1+_0x4b396e*_0x2d126c/_0x31f3e0;}return 0x1/_0x4b396e;}function isVoiceQueueOutbound(_0x23ca99){return _0x23ca99===_0x32ba('0x4c');}function isNotPreview(_0x3eb5ec){return _0x3eb5ec!==_0x32ba('0x8f');}function isCampaignIvr(_0x361d96){return _0x361d96===_0x32ba('0x78');}function getCallerId(_0x54b364,_0x141a59,_0x2f999){if(!_[_0x32ba('0x3d')](_0x2f999)&&_0x32ba('0x90')===typeof _0x2f999&&!_[_0x32ba('0x7b')](_0x2f999)){if(!_[_0x32ba('0x3d')](_0x141a59)&&_0x32ba('0x90')===typeof _0x141a59&&!_[_0x32ba('0x7b')](_0x141a59)){return util[_0x32ba('0x76')]('\x22%s\x22\x20<%s>',_0x141a59,_0x2f999);}return util['format'](_0x32ba('0x91'),_0x2f999,_0x2f999);}if(!_['isUndefined'](_0x54b364)&&'string'===typeof _0x54b364&&!_[_0x32ba('0x7b')](_0x54b364)){return _0x54b364;}return _0x32ba('0x92');}function loggerCatchQueueSummary(_0x570478,_0x560ad2){return function(_0x171b31){freeVariablesPredictive(_0x560ad2);emitVoiceQueueSummary(_0x560ad2);emitCampaignSummary(_0x560ad2);loggerSyncQueueSummary[_0x32ba('0x93')](_0x570478,util[_0x32ba('0x94')](_0x171b31,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x41b093,_0x2d8270){return function(_0x1d0c28){loggerPredictive['error'](_0x2d8270[_0x32ba('0x41')],_0x41b093);loggerPredictive['error'](_0x1d0c28[_0x32ba('0x95')]);freeVariablesPredictive(_0x2d8270);};}function loggerCatch(_0x108793){return function(_0x424b75){logger[_0x32ba('0x93')](_0x108793,util[_0x32ba('0x94')](_0x424b75,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x5dc37e){return _0x5dc37e&&!_[_0x32ba('0x3d')](_0x5dc37e)&&_0x5dc37e[_0x32ba('0x96')]>0x0;}function decremetOriginate(_0x2236d8){if(!_[_0x32ba('0x3d')](_0x2236d8)&&_0x2236d8!==null){if(_0x2236d8['hasOwnProperty']('originated')){if(_0x2236d8[_0x32ba('0x70')]>0x0){_0x2236d8[_0x32ba('0x70')]-=0x1;}else{logger[_0x32ba('0x93')](_0x32ba('0x97'));}}}else{logger[_0x32ba('0x93')](_0x32ba('0x98'));}}function checkContactLowerLimitOriginate(_0x30e4cf,_0x578f88,_0x1a7018){if(_0x578f88>_0x1a7018){for(var _0x50af45=0x0;_0x50af45<_0x578f88-_0x1a7018;_0x50af45+=0x1){decremetOriginate(_0x30e4cf);}}}function loggerGetContactDialer(_0xc7e7bd,_0x141d9e,_0x388a80){return function(_0x3aaf25){checkContactLowerLimitOriginate(_0x141d9e,_0x388a80,0x0);logger[_0x32ba('0x93')](_0xc7e7bd,util['inspect'](_0x3aaf25,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x36a905){return function(_0x997a0e){if(isNotNull(_0x997a0e)&&isNotNull(_0x997a0e[0x0])){if(_0x997a0e[0x0]['contactsRescheduled']>0x0){_0x36a905[_0x32ba('0x40')]='RESCHEDULED_CONTACTS';logger[_0x32ba('0x7c')]('[getContactDialer2][ReScheduled]'+_0x36a905[_0x32ba('0x41')],_0x997a0e[0x0]['contactsRescheduled'],_0x32ba('0x99'));}else{_0x36a905[_0x32ba('0x40')]='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x32ba('0x9a')+_0x36a905['name']);}}};}function notSendMessagesQueue(_0x2f6be2){if(_0x2f6be2[_0x32ba('0x9b')]){freeVariablesPredictive(_0x2f6be2);if(_0x2f6be2[_0x32ba('0x70')]===0x0&&_0x2f6be2[_0x32ba('0x9c')]===0x0&&_0x2f6be2[_0x32ba('0x59')]===0x0&&(_0x2f6be2['pTalking']||0x0)===0x0){_0x2f6be2[_0x32ba('0x9b')]=![];_0x2f6be2[_0x32ba('0x4f')]=0x0;_0x2f6be2[_0x32ba('0x40')]=_0x32ba('0x9d');loggerSyncQueueSummary['error'](_0x32ba('0x9e'),_0x2f6be2[_0x32ba('0x41')],_0x32ba('0x9f'));}else{_0x2f6be2['message']=_0x32ba('0xa0');loggerSyncQueueSummary[_0x32ba('0x93')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2f6be2['name'],_0x32ba('0xa1'));}emitVoiceQueueSummary(_0x2f6be2);}}function notSendMessagesCampaign(_0x529cb5){if(_0x529cb5['sendMessageOneNotActive']){if(_0x529cb5['originated']===0x0){_0x529cb5[_0x32ba('0x9b')]=![];_0x529cb5[_0x32ba('0x40')]=_0x32ba('0x9d');loggerSyncQueueSummary[_0x32ba('0x93')](_0x32ba('0xa2'),_0x529cb5['name'],'is\x20not\x20active');}else{_0x529cb5[_0x32ba('0x40')]=_0x32ba('0xa0');loggerSyncQueueSummary[_0x32ba('0x93')](_0x32ba('0xa2'),_0x529cb5[_0x32ba('0x41')],_0x32ba('0xa1'));}emitCampaignSummary(_0x529cb5);}}function createObjHistory(_0x280130,_0xa03a80,_0x5983dc,_0x4d60d1,_0x11eb43){_0x280130['message']=_0x5983dc;var _0x5ad55c=new Action(_0x280130,_0xa03a80);var _0x1756ec=new History(_0x5ad55c);_0x1756ec['state']=_0x4d60d1;_0x1756ec[_0x32ba('0xa3')]=_0x11eb43;_0x1756ec[_0x32ba('0xa4')]=_0x5ad55c[_0x32ba('0xa5')];return _0x1756ec;}Dialer['prototype'][_0x32ba('0x3c')]=function(){var _0x37bc43=this;setInterval(function(){_0x37bc43[_0x32ba('0xa6')](_0x37bc43[_0x32ba('0x28')],'[uniqueid]');_0x37bc43[_0x32ba('0xa6')](_0x37bc43[_0x32ba('0x27')],_0x32ba('0xa7'));},0x32c8);};Dialer[_0x32ba('0x1d')]['clearZombieChannels']=function(_0x416764,_0x540285){var _0x513f85=this;for(var _0x3c4848 in _0x416764){if(_0x416764[_0x32ba('0xa8')](_0x3c4848)){this[_0x32ba('0x20')][_0x32ba('0xa9')](function(){if(!_[_0x32ba('0xaa')](_0x416764[_0x3c4848])){return ami[_0x32ba('0xab')]({'action':_0x32ba('0xac'),'channel':_0x416764[_0x3c4848]['channel']})[_0x32ba('0xad')](function(_0x37c81f){if(_0x37c81f[_0x32ba('0x40')]===_0x32ba('0xae')){setTimeout(function(){if(_0x416764[_0x3c4848]&&_0x416764[_0x3c4848][_0x32ba('0x56')]!=='ivr'){_0x513f85[_0x32ba('0xaf')](_0x513f85[_0x32ba('0x21')][_0x416764[_0x3c4848][_0x32ba('0xb0')]]);logger[_0x32ba('0x93')](_0x32ba('0xb1'),_0x540285,_0x3c4848,_0x416764[_0x3c4848][_0x32ba('0xb0')]);delete _0x416764[_0x3c4848];}if(_0x416764[_0x3c4848]&&_0x416764[_0x3c4848]['type']===_0x32ba('0x78')){_0x513f85[_0x32ba('0xaf')](_0x513f85[_0x32ba('0x22')][_0x416764[_0x3c4848][_0x32ba('0xb0')]]);logger[_0x32ba('0x93')]('[Dialer][checkChannel][ivr]',_0x540285,_0x3c4848,_0x416764[_0x3c4848][_0x32ba('0xb0')]);delete _0x416764[_0x3c4848];}},0x2328);}});}});}}};Dialer[_0x32ba('0x1d')][_0x32ba('0xb2')]=function(_0x4ca9d2){return BPromise[_0x32ba('0xb3')]()[_0x32ba('0xb4')](cmHopper[_0x32ba('0xb2')](_0x4ca9d2))[_0x32ba('0xad')](loggerCatch(_0x32ba('0xb5')));};Dialer[_0x32ba('0x1d')]['checkIsBlackList']=function(_0x44785b){return BPromise['resolve']()[_0x32ba('0xb4')](cmHopperBlack[_0x32ba('0xb6')](_0x44785b))['catch'](loggerCatch(_0x32ba('0xb7')));};Dialer['prototype'][_0x32ba('0xb8')]=function(_0x4f6254){return BPromise[_0x32ba('0xb3')]()[_0x32ba('0xb4')](cmHopperBlack['checkIsBlackListIvr'](_0x4f6254))['catch'](loggerCatch(_0x32ba('0xb9')));};Dialer[_0x32ba('0x1d')][_0x32ba('0xba')]=function(_0x5b4aac){return BPromise[_0x32ba('0xb3')]()[_0x32ba('0xb4')](cmHopperHistory['avgHandleTime'](_0x5b4aac))[_0x32ba('0xad')](loggerCatch(_0x32ba('0xbb')));};Dialer[_0x32ba('0x1d')][_0x32ba('0xbc')]=function(_0x3ba096){return BPromise['resolve']()[_0x32ba('0xb4')](cmHopper[_0x32ba('0xbc')](_0x3ba096))[_0x32ba('0xad')](loggerCatch(_0x32ba('0xbd')));};Dialer['prototype'][_0x32ba('0xbe')]=function(_0x2ce710,_0x130656,_0x4cbb34){return BPromise[_0x32ba('0xb3')]()['then'](cmHopper[_0x32ba('0xbe')](_0x2ce710,_0x130656,_0x4cbb34))['catch'](loggerCatch(_0x32ba('0xbf')));};Dialer[_0x32ba('0x1d')]['getContactDialer']=function(_0x305bea,_0x1ceae9,_0x3b2984,_0x3fa1ef){return BPromise[_0x32ba('0xb3')]()[_0x32ba('0xb4')](cmHopper['getContactDialer'](_0x305bea,_0x1ceae9,_0x3b2984,_0x3fa1ef))[_0x32ba('0xad')](loggerCatch(_0x32ba('0xc0')));};Dialer[_0x32ba('0x1d')][_0x32ba('0xc1')]=function(_0x167a30,_0x2f17ba,_0x5748c9){return BPromise[_0x32ba('0xb3')]()[_0x32ba('0xb4')](cmHopper[_0x32ba('0xc1')](_0x167a30,_0x2f17ba,_0x5748c9))[_0x32ba('0xad')](loggerCatch(_0x32ba('0xc0')));};Dialer['prototype'][_0x32ba('0xc2')]=function(_0x35a7ae){return BPromise[_0x32ba('0xb3')]()[_0x32ba('0xb4')](voiceQueueRt['getVoiceQueueRtPauses'](_0x35a7ae))[_0x32ba('0xad')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x32ba('0x1d')][_0x32ba('0xc3')]=function(_0x5e9ef9){return BPromise[_0x32ba('0xb3')]()['then'](cmHopper['moveContactManagedDialer'](_0x5e9ef9))[_0x32ba('0xad')](loggerCatch(_0x32ba('0xc4')));};Dialer[_0x32ba('0x1d')][_0x32ba('0xc5')]=function(_0x4200a7){return BPromise[_0x32ba('0xb3')]()[_0x32ba('0xb4')](cmHopperHistory['createHistory'](_0x4200a7))[_0x32ba('0xad')](loggerCatch('[createHistory]\x20'));};Dialer[_0x32ba('0x1d')][_0x32ba('0xaf')]=function(_0x4452e3){if(!_['isUndefined'](_0x4452e3)&&_0x4452e3!==null){if(_0x4452e3[_0x32ba('0xa8')](_0x32ba('0x70'))){if(_0x4452e3['originated']>0x0){_0x4452e3[_0x32ba('0x70')]-=0x1;}else{logger[_0x32ba('0x93')](_0x32ba('0xc6'));}}}else{logger[_0x32ba('0x93')](_0x32ba('0xc7'));}};Dialer[_0x32ba('0x1d')][_0x32ba('0xc8')]=function(_0x1aea36,_0x45f970){var _0xc3c3e5=this;return function(_0x1d5792){_0xc3c3e5['updateOriginated'](_0x45f970);logger['error'](_0x1aea36,util['inspect'](_0x1d5792,{'showHidden':![],'depth':null}));};};Dialer[_0x32ba('0x1d')]['emptyContact']=function(_0x55b491,_0x5cb125,_0x47d64b){var _0x2a6741={'state':0x19,'statedesc':_0x32ba('0xc9')};this['updateOriginated'](_0x5cb125);this['saveInDb'](_[_0x32ba('0xca')](_0x2a6741,_['pick'](_0x47d64b,[_0x32ba('0xcb'),'ListId',_0x32ba('0xcc'),'VoiceQueueId',_0x32ba('0xcd')])),'[emptyContact][createHistory]','[emptyContact]');logger[_0x32ba('0x93')](_0x55b491);};Dialer[_0x32ba('0x1d')][_0x32ba('0xce')]=function(_0x3bb49e){return _0x3bb49e===_0x32ba('0xcf');};Dialer[_0x32ba('0x1d')][_0x32ba('0xd0')]=function(_0x391bc6){return!_[_0x32ba('0x3d')](_0x391bc6)&&_0x391bc6&&!_[_0x32ba('0x3d')](_0x391bc6['name'])&&!_['isUndefined'](_0x391bc6['active'])&&_0x391bc6[_0x32ba('0xd1')]&&(this[_0x32ba('0x24')][util[_0x32ba('0x76')](_0x32ba('0xd2'),_0x391bc6[_0x32ba('0x41')])]['status']===_0x32ba('0xd3')||this[_0x32ba('0x24')][util[_0x32ba('0x76')](_0x32ba('0xd2'),_0x391bc6[_0x32ba('0x41')])][_0x32ba('0xac')]===_0x32ba('0xd4'));};Dialer[_0x32ba('0x1d')][_0x32ba('0xd5')]=function(_0x2ee0d4,_0x4c0ea5,_0x115b10){this['createHistory'](_0x2ee0d4)[_0x32ba('0xad')](loggerCatch(_0x4c0ea5));this[_0x32ba('0xc3')](_0x2ee0d4)[_0x32ba('0xad')](loggerCatch(_0x115b10));};Dialer[_0x32ba('0x1d')]['syncVarSet']=function(_0x3669d0){var _0x31b658=this[_0x32ba('0x28')][_0x3669d0[_0x32ba('0xd6')]];var _0x288e4c;if(!_[_0x32ba('0xaa')](_0x3669d0)&&!_[_0x32ba('0xaa')](_0x3669d0[_0x32ba('0xd7')])&&!_[_0x32ba('0xaa')](_0x3669d0[_0x32ba('0xd7')][_0x32ba('0xd8')])&&_0x3669d0[_0x32ba('0xd9')]===_0x32ba('0xda')&&_0x31b658){if(_0x31b658['type']!==_0x32ba('0x78')&&this[_0x32ba('0x21')][_0x31b658[_0x32ba('0xb0')]]['dialAMDActive']&&_0x3669d0[_0x32ba('0xdb')]===_0x32ba('0xdc')){delete this[_0x32ba('0x28')][_0x3669d0[_0x32ba('0xd6')]];this[_0x32ba('0xaf')](this[_0x32ba('0x21')][_0x31b658[_0x32ba('0xb0')]]);this[_0x32ba('0x21')][_0x31b658['queue']][_0x32ba('0x5e')]+=0x1;this[_0x32ba('0x21')][_0x31b658[_0x32ba('0xb0')]][_0x32ba('0xdd')]+=0x1;_0x288e4c=new Hangup(_0x31b658,_0x3669d0);_0x288e4c[_0x32ba('0xde')]=0x12;_0x288e4c['statedesc']=_0x32ba('0xdf');_0x288e4c[_0x32ba('0xe0')]=_0x32ba('0xe1');this[_0x32ba('0xd5')](_0x288e4c,_0x32ba('0xe2'),'[syncHangupInAMD]');}if(_0x31b658[_0x32ba('0x56')]!=='ivr'&&this['voiceQueues'][_0x31b658['queue']][_0x32ba('0xe3')]&&_0x3669d0[_0x32ba('0xdb')]==='MACHINE'){var _0x49079e=this;return new BPromise(function(_0x2598c4,_0x1717a9){delete _0x49079e[_0x32ba('0x28')][_0x3669d0[_0x32ba('0xd6')]];_0x49079e['updateOriginated'](_0x49079e['voiceQueues'][_0x31b658[_0x32ba('0xb0')]]);_0x49079e[_0x32ba('0x21')][_0x31b658[_0x32ba('0xb0')]][_0x32ba('0x5e')]+=0x1;_0x49079e[_0x32ba('0x21')][_0x31b658['queue']][_0x32ba('0xdd')]+=0x1;var _0x5adaf8=_0x49079e[_0x32ba('0x21')][_0x31b658[_0x32ba('0xb0')]];var _0x45540a=new Hangup(_0x31b658,_0x3669d0);_0x45540a[_0x32ba('0xde')]=0x13;_0x45540a['statedesc']=_0x32ba('0xe4');_0x45540a[_0x32ba('0xe0')]=_0x32ba('0xe1');_0x45540a['countmachineretry']+=0x1;_0x45540a[_0x32ba('0xe5')]+=0x1;_0x45540a['amd']=!![];_0x49079e[_0x32ba('0xc5')](_0x45540a)['catch'](loggerCatch(_0x32ba('0xe6')));if(_0x45540a['countbusyretry']+_0x45540a[_0x32ba('0xe7')]+_0x45540a[_0x32ba('0xe8')]+_0x45540a['countnosuchnumberretry']+_0x45540a[_0x32ba('0xe9')]+_0x45540a[_0x32ba('0xea')]+_0x45540a[_0x32ba('0xeb')]+_0x45540a[_0x32ba('0xec')]>=_0x5adaf8[_0x32ba('0xed')]){_0x49079e[_0x32ba('0xee')](_0x45540a,_0x2598c4,_0x1717a9,_0x32ba('0xef'));}else{if(_0x45540a[_0x32ba('0xeb')]>=_0x5adaf8[_0x32ba('0xf0')]){_0x49079e[_0x32ba('0xf1')](_0x45540a,_0x2598c4,_0x1717a9,_0x32ba('0xf2'));}else{_0x49079e[_0x32ba('0xbc')]({'active':![],'countmachineretry':_0x45540a[_0x32ba('0xeb')],'scheduledat':moment()['add'](_0x5adaf8['dialMachineRetryFrequency'],_0x32ba('0xf3'))[_0x32ba('0x76')](_0x32ba('0xf4')),'ContactId':_0x45540a[_0x32ba('0xcb')],'ListId':_0x45540a[_0x32ba('0xf5')],'VoiceQueueId':_0x45540a[_0x32ba('0xf6')]||undefined,'CampaignId':_0x45540a[_0x32ba('0xcd')]||undefined})[_0x32ba('0xad')](loggerCatch(_0x32ba('0xf7')));_0x2598c4({'reschedule':0x1});}}});}if(_0x31b658[_0x32ba('0x56')]===_0x32ba('0x78')&&this[_0x32ba('0x22')][_0x31b658[_0x32ba('0xb0')]]['dialAMDActive']&&_0x3669d0[_0x32ba('0xdb')]===_0x32ba('0xdc')){delete this[_0x32ba('0x28')][_0x3669d0['uniqueid']];this['updateOriginated'](this[_0x32ba('0x22')][_0x31b658[_0x32ba('0xb0')]]);_0x288e4c=new Hangup(_0x31b658,_0x3669d0);_0x288e4c[_0x32ba('0xde')]=0x12;_0x288e4c[_0x32ba('0xa3')]=_0x32ba('0xdf');_0x288e4c['membername']=_0x32ba('0xe1');this[_0x32ba('0xd5')](_0x288e4c,_0x32ba('0xf8'),_0x32ba('0xf9'));}if(_0x31b658['type']===_0x32ba('0x78')&&this['campaigns'][_0x31b658[_0x32ba('0xb0')]]['dialAMDActive']&&_0x3669d0[_0x32ba('0xdb')]===_0x32ba('0xfa')){var _0x49079e=this;return new BPromise(function(_0x20a767,_0x4da963){delete _0x49079e[_0x32ba('0x28')][_0x3669d0['uniqueid']];_0x49079e[_0x32ba('0xaf')](_0x49079e[_0x32ba('0x22')][_0x31b658[_0x32ba('0xb0')]]);_0x49079e[_0x32ba('0x22')][_0x31b658[_0x32ba('0xb0')]][_0x32ba('0x5e')]+=0x1;_0x49079e[_0x32ba('0x22')][_0x31b658[_0x32ba('0xb0')]][_0x32ba('0xdd')]+=0x1;var _0x521ff3=_0x49079e[_0x32ba('0x22')][_0x31b658['queue']];var _0x238d73=new Hangup(_0x31b658,_0x3669d0);_0x238d73[_0x32ba('0xde')]=0x13;_0x238d73[_0x32ba('0xa3')]='Machine';_0x238d73[_0x32ba('0xe0')]=_0x32ba('0xe1');_0x238d73['countmachineretry']+=0x1;_0x238d73['countglobal']+=0x1;_0x238d73[_0x32ba('0xfb')]=!![];_0x49079e[_0x32ba('0xc5')](_0x238d73)[_0x32ba('0xad')](loggerCatch(_0x32ba('0xe6')));if(_0x238d73['countbusyretry']+_0x238d73['countcongestionretry']+_0x238d73['countnoanswerretry']+_0x238d73[_0x32ba('0xfc')]+_0x238d73[_0x32ba('0xe9')]+_0x238d73[_0x32ba('0xea')]+_0x238d73[_0x32ba('0xeb')]+_0x238d73[_0x32ba('0xec')]>=_0x521ff3[_0x32ba('0xed')]){_0x49079e[_0x32ba('0xee')](_0x238d73,_0x20a767,_0x4da963,_0x32ba('0xef'));}else{if(_0x238d73[_0x32ba('0xeb')]>=_0x521ff3[_0x32ba('0xf0')]){_0x49079e[_0x32ba('0xf1')](_0x238d73,_0x20a767,_0x4da963,_0x32ba('0xf2'));}else{_0x49079e[_0x32ba('0xbc')]({'active':![],'countmachineretry':_0x238d73[_0x32ba('0xeb')],'scheduledat':moment()['add'](_0x521ff3[_0x32ba('0xfd')],_0x32ba('0xf3'))[_0x32ba('0x76')](_0x32ba('0xf4')),'ContactId':_0x238d73[_0x32ba('0xcb')],'ListId':_0x238d73[_0x32ba('0xf5')],'VoiceQueueId':_0x238d73[_0x32ba('0xf6')]||undefined,'CampaignId':_0x238d73[_0x32ba('0xcd')]||undefined})[_0x32ba('0xad')](loggerCatch(_0x32ba('0xf7')));_0x20a767({'reschedule':0x1});}}});}}};Dialer[_0x32ba('0x1d')][_0x32ba('0x36')]=function(_0x4459d7){var _0xda2d67=this[_0x32ba('0x28')][_0x4459d7['uniqueid']];var _0x1e1d83=this;var _0x38f79a;if(_0xda2d67&&_0xda2d67[_0x32ba('0x56')]==='ivr'){delete this['uniqueId'][_0x4459d7[_0x32ba('0xd6')]];this[_0x32ba('0xaf')](this[_0x32ba('0x22')][_0xda2d67[_0x32ba('0xb0')]]);this[_0x32ba('0x22')][_0xda2d67[_0x32ba('0xb0')]][_0x32ba('0xfe')]+=0x1;_0x38f79a=new Hangup(_0xda2d67,_0x4459d7);this['createHistory'](_0x38f79a)[_0x32ba('0xad')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x32ba('0xc3')](_0x38f79a)[_0x32ba('0xad')](loggerCatch(_0x32ba('0xff')));}if(_0xda2d67&&_0xda2d67[_0x32ba('0x56')]!=='ivr'&&isNotNull(this[_0x32ba('0x21')][_0xda2d67[_0x32ba('0xb0')]][_0x32ba('0x100')])){delete this['uniqueId'][_0x4459d7[_0x32ba('0xd6')]];this[_0x32ba('0xaf')](this[_0x32ba('0x21')][_0xda2d67[_0x32ba('0xb0')]]);this[_0x32ba('0x21')][_0xda2d67[_0x32ba('0xb0')]]['outboundAnswerCallsDay']+=0x1;this[_0x32ba('0x21')][_0xda2d67[_0x32ba('0xb0')]][_0x32ba('0xdd')]+=0x1;_0x38f79a=new Hangup(_0xda2d67,_0x4459d7);_0x38f79a[_0x32ba('0xde')]=0x10;_0x38f79a['statedesc']=_0x32ba('0x101');_0x38f79a[_0x32ba('0xe0')]=_0x32ba('0x102');this['createHistory'](_0x38f79a)[_0x32ba('0xad')](loggerCatch(_0x32ba('0x103')));this[_0x32ba('0xc3')](_0x38f79a)[_0x32ba('0xad')](loggerCatch(_0x32ba('0xff')));}if(_0xda2d67&&_0xda2d67[_0x32ba('0x56')]!==_0x32ba('0x78')&&!isNotNull(this[_0x32ba('0x21')][_0xda2d67['queue']][_0x32ba('0x100')])){delete this[_0x32ba('0x28')][_0x4459d7[_0x32ba('0xd6')]];this[_0x32ba('0xaf')](this[_0x32ba('0x21')][_0xda2d67[_0x32ba('0xb0')]]);this[_0x32ba('0x21')][_0xda2d67['queue']]['outboundUnknownCallsDay']+=0x1;_0x38f79a=new Hangup(_0xda2d67,_0x4459d7);_0x38f79a[_0x32ba('0xde')]=0xc;_0x38f79a[_0x32ba('0xa3')]=_0x4459d7['cause-txt'];_0x38f79a[_0x32ba('0xe0')]=_0x32ba('0x104');this[_0x32ba('0xc5')](_0x38f79a)[_0x32ba('0xad')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x38f79a)[_0x32ba('0xad')](loggerCatch(_0x32ba('0xff')));}};Dialer[_0x32ba('0x1d')]['syncAgentComplete']=function(_0x335cc0){var _0x513cb4=this[_0x32ba('0x28')][_0x335cc0['uniqueid']];var _0x9c3f6d=this;if(this[_0x32ba('0x21')][_0x335cc0[_0x32ba('0xb0')]]){if(_0x513cb4&&_0x513cb4[_0x32ba('0x56')]!=='ivr'){delete this[_0x32ba('0x28')][_0x335cc0['uniqueid']];this['voiceQueues'][_0x335cc0[_0x32ba('0xb0')]][_0x32ba('0x5e')]+=0x1;var _0x258571=new AgentComplete(_0x513cb4,_0x335cc0);if(_0x335cc0[_0x32ba('0x105')]==='agent'){_0x258571[_0x32ba('0x106')]=this[_0x32ba('0x21')][_0x335cc0[_0x32ba('0xb0')]][_0x32ba('0x107')]&&this[_0x32ba('0x21')][_0x335cc0['queue']][_0x32ba('0x108')]?moment()[_0x32ba('0x76')](_0x32ba('0xf4')):undefined;}this[_0x32ba('0xc5')](_0x258571)[_0x32ba('0xad')](loggerCatch(_0x32ba('0x109')));this[_0x32ba('0xc3')](_0x258571)[_0x32ba('0xad')](loggerCatch(_0x32ba('0x10a')));}}};Dialer[_0x32ba('0x1d')][_0x32ba('0x2e')]=function(_0x10895c){if(this[_0x32ba('0x21')][_0x10895c['queue']]){if(this[_0x32ba('0x28')][_0x10895c[_0x32ba('0xd6')]]&&this['uniqueId'][_0x10895c[_0x32ba('0xd6')]][_0x32ba('0x56')]!==_0x32ba('0x78')){this[_0x32ba('0xaf')](this[_0x32ba('0x21')][_0x10895c['queue']]);this[_0x32ba('0x28')][_0x10895c[_0x32ba('0xd6')]][_0x32ba('0x10b')]=moment()[_0x32ba('0x76')](_0x32ba('0xf4'));}}};Dialer['prototype'][_0x32ba('0x10c')]=function(_0x3a582f){this['createHistory'](_0x3a582f)['catch'](loggerCatch(_0x32ba('0x109')));this['moveContactManagedDialer'](_0x3a582f)[_0x32ba('0xad')](loggerCatch(_0x32ba('0x10d')));};Dialer[_0x32ba('0x1d')][_0x32ba('0x30')]=function(_0x82cf1b){var _0x18cdd4=this[_0x32ba('0x28')][_0x82cf1b[_0x32ba('0xd6')]];var _0x435f34=this;if(this[_0x32ba('0x21')][_0x82cf1b[_0x32ba('0xb0')]]){if(_0x18cdd4&&_0x18cdd4[_0x32ba('0x56')]!=='ivr'){delete this[_0x32ba('0x28')][_0x82cf1b['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x82cf1b[_0x32ba('0xb0')]]);_0x18cdd4[_0x32ba('0x10e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x1060a4=new QueueCallerAbandon(_0x18cdd4,_0x82cf1b);if(getSeconds(_0x18cdd4[_0x32ba('0x10e')],_0x18cdd4[_0x32ba('0x10f')])>=_0x18cdd4['dialQueueTimeout']){this[_0x32ba('0x21')][_0x82cf1b[_0x32ba('0xb0')]][_0x32ba('0x6b')]+=0x1;this[_0x32ba('0x21')][_0x82cf1b[_0x32ba('0xb0')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x32ba('0x21')][_0x82cf1b[_0x32ba('0xb0')]][_0x32ba('0x6c')]+=0x1;_0x1060a4[_0x32ba('0xde')]=0xa;_0x1060a4[_0x32ba('0xa3')]='Drop';_0x1060a4[_0x32ba('0x110')]='TIMEOUT';_0x1060a4[_0x32ba('0x106')]=this[_0x32ba('0x21')][_0x82cf1b['queue']]['dialQueueProject2']?moment()[_0x32ba('0x76')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x1060a4['countdropretry']+=0x1;_0x1060a4['countglobal']+=0x1;if(_0x1060a4[_0x32ba('0xe9')]>=this[_0x32ba('0x21')][_0x82cf1b[_0x32ba('0xb0')]][_0x32ba('0x111')]){this[_0x32ba('0x10c')](_0x1060a4);}else{this[_0x32ba('0xbc')]({'active':![],'countdropretry':_0x1060a4[_0x32ba('0xe9')],'scheduledat':moment()['add'](this['voiceQueues'][_0x82cf1b[_0x32ba('0xb0')]]['dialDropRetryFrequency'],_0x32ba('0xf3'))[_0x32ba('0x76')](_0x32ba('0xf4')),'ContactId':_0x18cdd4[_0x32ba('0xcb')],'ListId':_0x18cdd4[_0x32ba('0xf5')],'VoiceQueueId':_0x18cdd4['VoiceQueueId']||undefined,'CampaignId':_0x18cdd4[_0x32ba('0xcd')]||undefined})['catch'](loggerCatch(_0x32ba('0x112')));var _0x113acd=new History(_0x1060a4);_0x113acd['state']=0xa;_0x113acd[_0x32ba('0xa3')]=_0x32ba('0x113');_0x113acd[_0x32ba('0xa5')]=moment()[_0x32ba('0x76')](_0x32ba('0xf4'));_0x113acd[_0x32ba('0xa4')]=_0x113acd[_0x32ba('0xa5')];_0x113acd[_0x32ba('0x114')]=_0x1060a4[_0x32ba('0x114')];_0x113acd['calleridnum']=_0x1060a4[_0x32ba('0x115')];this[_0x32ba('0xc5')](_0x113acd)[_0x32ba('0xad')](loggerCatch(_0x32ba('0x116')));}}else{this[_0x32ba('0x21')][_0x82cf1b[_0x32ba('0xb0')]][_0x32ba('0x117')]+=0x1;this[_0x32ba('0x21')][_0x82cf1b[_0x32ba('0xb0')]][_0x32ba('0x63')]+=0x1;_0x1060a4[_0x32ba('0xde')]=0xb;_0x1060a4[_0x32ba('0xa3')]=_0x32ba('0x118');_0x1060a4[_0x32ba('0x110')]='CALLEREXIT';_0x1060a4[_0x32ba('0xea')]+=0x1;_0x1060a4['countglobal']+=0x1;if(_0x1060a4[_0x32ba('0xea')]>=this[_0x32ba('0x21')][_0x82cf1b[_0x32ba('0xb0')]][_0x32ba('0x119')]){this[_0x32ba('0x10c')](_0x1060a4);}else{this[_0x32ba('0xbc')]({'active':![],'countabandonedretry':_0x1060a4['countabandonedretry'],'scheduledat':moment()['add'](this[_0x32ba('0x21')][_0x82cf1b[_0x32ba('0xb0')]][_0x32ba('0x11a')],_0x32ba('0xf3'))[_0x32ba('0x76')](_0x32ba('0xf4')),'ContactId':_0x18cdd4[_0x32ba('0xcb')],'ListId':_0x18cdd4['ListId'],'VoiceQueueId':_0x18cdd4[_0x32ba('0xf6')]||undefined,'CampaignId':_0x18cdd4[_0x32ba('0xcd')]||undefined})['catch'](loggerCatch(_0x32ba('0x11b')));var _0x113acd=new History(_0x1060a4);_0x113acd[_0x32ba('0xde')]=0xb;_0x113acd[_0x32ba('0xa3')]=_0x32ba('0x118');_0x113acd['starttime']=moment()['format'](_0x32ba('0xf4'));_0x113acd['endtime']=_0x113acd[_0x32ba('0xa5')];_0x113acd[_0x32ba('0x114')]=_0x1060a4['calleridname'];_0x113acd[_0x32ba('0x115')]=_0x1060a4[_0x32ba('0x115')];this[_0x32ba('0xc5')](_0x113acd)[_0x32ba('0xad')](loggerCatch(_0x32ba('0x11c')));}}}}};Dialer[_0x32ba('0x1d')][_0x32ba('0x11d')]=function(_0x4f9a01){if(this[_0x32ba('0x27')][_0x4f9a01[_0x32ba('0xd6')]]){this[_0x32ba('0x27')][_0x4f9a01[_0x32ba('0xd6')]][_0x32ba('0x11e')]=_0x4f9a01['channel'];}if(this['uniqueId'][_0x4f9a01['uniqueid']]){this[_0x32ba('0x28')][_0x4f9a01[_0x32ba('0xd6')]]['channel']=_0x4f9a01[_0x32ba('0x11e')];}};Dialer[_0x32ba('0x1d')][_0x32ba('0x3a')]=function(_0x3d7f9b){if(strategy[this['voiceQueues'][this['actions'][_0x3d7f9b['actionid']][_0x32ba('0xb0')]][_0x32ba('0x4d')]]===_0x32ba('0x1c')){if(this[_0x32ba('0x27')][_0x3d7f9b[_0x32ba('0x11f')]]&&_[_0x32ba('0xaa')](this[_0x32ba('0x27')][_0x3d7f9b['actionid']][_0x32ba('0x120')])&&_0x3d7f9b[_0x32ba('0xac')]==='1'&&_0x3d7f9b[_0x32ba('0x121')]==='0'){if(this['agents'][_0x3d7f9b['stateinterface']]){if(!this[_0x32ba('0x23')][_0x3d7f9b[_0x32ba('0x122')]][_0x32ba('0x120')]){this['agents'][_0x3d7f9b[_0x32ba('0x122')]]['locked']=!![];this['actions'][_0x3d7f9b['actionid']][_0x32ba('0x120')]=!![];this[_0x32ba('0x27')][_0x3d7f9b[_0x32ba('0x11f')]][_0x32ba('0x122')]=_0x3d7f9b[_0x32ba('0x122')];}}}}else if((strategy[this[_0x32ba('0x21')][this[_0x32ba('0x27')][_0x3d7f9b[_0x32ba('0x11f')]][_0x32ba('0xb0')]][_0x32ba('0x4d')]]||_0x32ba('0x1b'))===_0x32ba('0x1b')){if(this[_0x32ba('0x27')][_0x3d7f9b['actionid']]){if(this['agents'][_0x3d7f9b[_0x32ba('0x122')]]){this[_0x32ba('0x27')][_0x3d7f9b['actionid']][_0x32ba('0x122')]=_0x3d7f9b[_0x32ba('0x122')];if(_[_0x32ba('0xaa')](this[_0x32ba('0x123')][this[_0x32ba('0x27')][_0x3d7f9b[_0x32ba('0x11f')]][_0x32ba('0xb0')]])){this[_0x32ba('0x123')][this[_0x32ba('0x27')][_0x3d7f9b[_0x32ba('0x11f')]][_0x32ba('0xb0')]]=[];}this[_0x32ba('0x123')][this['actions'][_0x3d7f9b[_0x32ba('0x11f')]][_0x32ba('0xb0')]][_0x32ba('0x124')](_[_0x32ba('0xca')](_[_0x32ba('0x125')](this[_0x32ba('0x27')][_0x3d7f9b['actionid']],['idHopper','stateinterface']),{'status':_0x3d7f9b[_0x32ba('0xac')],'paused':_0x3d7f9b[_0x32ba('0x121')]}));}}}};function unlockQueueStatus(_0x26b8b5,_0x3722c5){setTimeout(function(){if(_[_0x32ba('0x3d')](_0x26b8b5[_0x32ba('0x126')])){loggerBooked['error'](_0x32ba('0x127'),_0x3722c5);}_0x26b8b5[_0x32ba('0x126')]=!![];loggerBooked[_0x32ba('0x7c')](_0x32ba('0x128'),_0x3722c5,JSON['stringify'](_['pick'](_0x26b8b5,[_0x32ba('0x41'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x32ba('0x1d')][_0x32ba('0x3b')]=function(_0x4c20a5){var _0x37a28f=this;var _0x3e625a=_0x37a28f[_0x32ba('0x21')][_0x37a28f[_0x32ba('0x27')][_0x4c20a5[_0x32ba('0x11f')]][_0x32ba('0xb0')]];if(strategy[this['voiceQueues'][this[_0x32ba('0x27')][_0x4c20a5[_0x32ba('0x11f')]][_0x32ba('0xb0')]][_0x32ba('0x4d')]]===_0x32ba('0x1c')){if(this[_0x32ba('0x27')][_0x4c20a5[_0x32ba('0x11f')]]&&this[_0x32ba('0x27')][_0x4c20a5[_0x32ba('0x11f')]]['stateinterface']){this[_0x32ba('0x8f')][_0x32ba('0x129')](this[_0x32ba('0x27')][_0x4c20a5[_0x32ba('0x11f')]][_0x32ba('0x12a')],this['actions'][_0x4c20a5[_0x32ba('0x11f')]]['stateinterface'])[_0x32ba('0xad')](function(_0x4edbeb){logger['error'](_0x32ba('0x12b'),util[_0x32ba('0x94')](_0x4edbeb,{'showHidden':![],'depth':null}));})[_0x32ba('0x1f')](function(){_0x37a28f['updateOriginated'](_0x37a28f['voiceQueues'][_0x37a28f[_0x32ba('0x27')][_0x4c20a5[_0x32ba('0x11f')]][_0x32ba('0xb0')]]);_0x37a28f[_0x32ba('0x23')][_0x37a28f['actions'][_0x4c20a5[_0x32ba('0x11f')]][_0x32ba('0x122')]][_0x32ba('0x120')]=![];delete _0x37a28f['actions'][_0x4c20a5[_0x32ba('0x11f')]];unlockQueueStatus(_0x3e625a);});}else{this['updateOriginated'](this['voiceQueues'][this['actions'][_0x4c20a5[_0x32ba('0x11f')]][_0x32ba('0xb0')]]);this[_0x32ba('0xbc')]({'active':![],'ContactId':this[_0x32ba('0x27')][_0x4c20a5['actionid']]['ContactId'],'ListId':this[_0x32ba('0x27')][_0x4c20a5[_0x32ba('0x11f')]][_0x32ba('0xf5')],'VoiceQueueId':this[_0x32ba('0x27')][_0x4c20a5[_0x32ba('0x11f')]][_0x32ba('0xf6')]||undefined,'CampaignId':this[_0x32ba('0x27')][_0x4c20a5[_0x32ba('0x11f')]][_0x32ba('0xcd')]||undefined})[_0x32ba('0xad')](loggerCatch(_0x32ba('0x12c')));delete this[_0x32ba('0x27')][_0x4c20a5[_0x32ba('0x11f')]];unlockQueueStatus(_0x3e625a);}}else if((strategy[this[_0x32ba('0x21')][this[_0x32ba('0x27')][_0x4c20a5['actionid']][_0x32ba('0xb0')]][_0x32ba('0x4d')]]||_0x32ba('0x1b'))==='rrmemory'){var _0xe8b1d1;if(this[_0x32ba('0x27')][_0x4c20a5['actionid']]&&!_[_0x32ba('0x7b')](this[_0x32ba('0x123')][this['actions'][_0x4c20a5['actionid']][_0x32ba('0xb0')]])){if(this[_0x32ba('0x2c')][_0x37a28f[_0x32ba('0x27')][_0x4c20a5['actionid']][_0x32ba('0xb0')]]){this['queueBookedRR'][_0x37a28f[_0x32ba('0x27')][_0x4c20a5[_0x32ba('0x11f')]][_0x32ba('0xb0')]]=this[_0x32ba('0x2c')][this['actions'][_0x4c20a5['actionid']][_0x32ba('0xb0')]]?this[_0x32ba('0x2c')][this['actions'][_0x4c20a5[_0x32ba('0x11f')]][_0x32ba('0xb0')]]:this[_0x32ba('0x123')][this['actions'][_0x4c20a5[_0x32ba('0x11f')]][_0x32ba('0xb0')]]?this['queueBooked'][this[_0x32ba('0x27')][_0x4c20a5['actionid']]['queue']][_0x32ba('0x12d')]||0x0:0x0;}this[_0x32ba('0x123')][this[_0x32ba('0x27')][_0x4c20a5[_0x32ba('0x11f')]]['queue']][_0x32ba('0x12d')]=this[_0x32ba('0x2c')][this[_0x32ba('0x27')][_0x4c20a5['actionid']][_0x32ba('0xb0')]];for(var _0x2579f3=0x0;_0x2579f3=0x0?!![]:![];})['catch'](myreject(_0x19a404)));}}else{_0x448241[_0x32ba('0x124')](ami[_0x32ba('0xab')]({'action':_0x32ba('0x147'),'command':util['format'](_0x32ba('0x14b'),_0x2d4663,!_['isUndefined'](config['timezones'][_0x45d336])?_0x45d336:'')})['then'](function(_0xf2dd64){return _0xf2dd64[_0x32ba('0x14c')]['indexOf'](_0x32ba('0x14a'))>=0x0?!![]:![];})['catch'](myreject(_0x19a404)));}BPromise[_0x32ba('0x14d')](_0x448241)[_0x32ba('0xb4')](function(_0x399221){var _0x1f340c=_[_0x32ba('0x14e')](_0x399221);if(_0x1f340c){return _0x589b48(_0x1f340c);}else{_0x1f9f87[_0x32ba('0x40')]=_0x25e283?_0x32ba('0x14f'):_0x32ba('0x150');return _0x19a404(msgResponse(_0x32ba('0x151'),'Failure',_0x32ba('0x152')+_0x25e283+'\x20'+_0x1678fd+_0x32ba('0x153')+util['inspect'](_0x2d4663,{'showHidden':![],'depth':null})+_0x32ba('0x154')+_0x45d336));}})[_0x32ba('0xad')](function(_0x166a3d){return _0x19a404(msgResponse(_0x32ba('0x13f'),'Failure',JSON[_0x32ba('0x47')](_0x166a3d)));});});};Dialer['prototype'][_0x32ba('0x155')]=function(_0x1d3201){var _0x585603=this;return function(){switch(_0x1d3201[_0x32ba('0x5c')]){case _0x32ba('0x156'):freeVariablesPredictive(_0x1d3201);_0x585603[_0x32ba('0x157')](_0x1d3201,0x1);break;case _0x32ba('0x158'):freeVariablesPredictive(_0x1d3201);_0x585603[_0x32ba('0x157')](_0x1d3201,_0x1d3201[_0x32ba('0x159')]);break;case'predictive':_0x585603[_0x32ba('0xa')](_0x1d3201);break;case _0x32ba('0x9'):freeVariablesPredictive(_0x1d3201);_0x585603['handlePower'](_0x1d3201,0x1);break;default:freeVariablesPredictive(_0x1d3201);logger[_0x32ba('0x93')](_0x32ba('0x15a'),_0x1d3201['name'],_0x32ba('0x15b'));}};};Dialer[_0x32ba('0x1d')][_0x32ba('0x15c')]=function(_0x2c483b){var _0x4856d3=this;return function(){_0x4856d3[_0x32ba('0x15d')](_0x2c483b);};};Dialer[_0x32ba('0x1d')][_0x32ba('0xc')]=function(_0x8f3487){var _0x38ae0d=this;if(isNotPreview(_0x8f3487['dialMethod'])){if(isVoiceQueueOutbound(_0x8f3487[_0x32ba('0x56')])&&isActive(_0x8f3487[_0x32ba('0x5b')])){_0x8f3487['sendMessageOneNotActive']=!![];BPromise[_0x32ba('0xb3')]()[_0x32ba('0xb4')](checkIsLoggedIn(_0x8f3487,_0x8f3487[_0x32ba('0x50')]))[_0x32ba('0xb4')](checkIsActive(_0x8f3487,_0x8f3487[_0x32ba('0x5b')]))[_0x32ba('0xb4')](checkInterval(_0x8f3487))[_0x32ba('0xb4')](_0x38ae0d[_0x32ba('0x139')](_0x8f3487))['then'](_0x38ae0d[_0x32ba('0x13d')](_0x8f3487[_0x32ba('0x15e')],_0x8f3487[_0x32ba('0x15f')],_0x8f3487['name'],_0x8f3487))[_0x32ba('0xb4')](_0x38ae0d[_0x32ba('0x13e')](_0x8f3487['Interval'],_0x8f3487[_0x32ba('0x15f')],_0x8f3487['name'],_0x8f3487))[_0x32ba('0xb4')](_0x38ae0d[_0x32ba('0x155')](_0x8f3487))[_0x32ba('0xad')](loggerCatchQueueSummary(_0x32ba('0x160'),_0x8f3487));}else{notSendMessagesQueue(_0x8f3487);}}else{freeVariablesPredictive(_0x8f3487);}};Dialer['prototype']['syncCampaigns']=function(){var _0x3f933d=this;var _0x5d9305;for(var _0x71eb50 in this[_0x32ba('0x22')]){if(this[_0x32ba('0x22')][_0x32ba('0xa8')](_0x71eb50)){_0x5d9305=this[_0x32ba('0x22')][_0x71eb50];if(isCampaignIvr(_0x5d9305['type'])&&isActive(_0x5d9305[_0x32ba('0xd1')])){_0x5d9305[_0x32ba('0x9b')]=!![];BPromise[_0x32ba('0xb3')]()[_0x32ba('0xb4')](checkIsActive(_0x5d9305,_0x5d9305[_0x32ba('0xd1')]))[_0x32ba('0xb4')](checkInterval(_0x5d9305))[_0x32ba('0xb4')](_0x3f933d[_0x32ba('0x139')](_0x5d9305))[_0x32ba('0xb4')](_0x3f933d[_0x32ba('0x13d')](_0x5d9305['dialGlobalInterval'],_0x5d9305[_0x32ba('0x15f')],_0x5d9305[_0x32ba('0x41')],_0x5d9305))[_0x32ba('0xb4')](_0x3f933d[_0x32ba('0x13e')](_0x5d9305[_0x32ba('0x43')],_0x5d9305[_0x32ba('0x15f')],_0x5d9305[_0x32ba('0x41')],_0x5d9305))[_0x32ba('0xb4')](_0x3f933d[_0x32ba('0x15c')](_0x5d9305))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x5d9305));}else{notSendMessagesCampaign(_0x5d9305);}}}};function getCallerIdRandom(_0x417a83,_0x580a2c){var _0x34ae8a,_0x30fd9c,_0xcc716b;if(_0x580a2c<=0x0){_0x580a2c=0x1;}_0x34ae8a=new RegExp(_0x32ba('0x161')+_0x580a2c+'}$');_0x30fd9c=Math['pow'](0xa,_0x580a2c-0x1);_0xcc716b=Math[_0x32ba('0x162')](0xa,_0x580a2c)-0x1;return util['format']('%s',_[_0x32ba('0x163')](_0x417a83,_0x34ae8a,_[_0x32ba('0x164')](_0x30fd9c,_0xcc716b)));}function extractCalleridName(_0x337c18){var _0x46579f=_0x337c18[_0x32ba('0x165')](/"(.*?)"/);return _0x46579f?_0x46579f[0x1]:_0x337c18;}function extractCalleridNumber(_0x24f259){var _0x385644=_0x24f259[_0x32ba('0x165')](/<(.*?)>/);return _0x385644?_0x385644[0x1]:_0x24f259;}Dialer[_0x32ba('0x1d')][_0x32ba('0x166')]=function(_0x440119,_0x3888a7){var _0x941044=this;var _0x29c73e=uuid['v4']();this['actions'][_0x29c73e]=new Action(_0x440119,_0x3888a7,_0x29c73e);return new BPromise(function(_0x2e0ab6,_0x4ff4f8){if(_[_0x32ba('0x3d')](_0x440119)&&_0x32ba('0x167')!==typeof _0x440119){return _0x4ff4f8(msgResponse(_0x32ba('0x168'),_0x32ba('0x140'),_0x32ba('0x169')));}if(_[_0x32ba('0x3d')](_0x3888a7[_0x32ba('0x16a')]['phone'])||_0x3888a7[_0x32ba('0x16a')]['phone']===null){return _0x4ff4f8(msgResponse(_0x32ba('0x168'),_0x32ba('0x140'),_0x32ba('0x16b')));}var _0x32e63d={'XMD-CALLERID':_0x941044[_0x32ba('0x27')][_0x29c73e][_0x32ba('0x16c')](),'XMD-AGI':_0x440119[_0x32ba('0x100')]?util[_0x32ba('0x76')]('\x22agi://%s/square,%s\x22',ipAgi,_0x440119[_0x32ba('0x100')]):_0x32ba('0x16d'),'XMD-AGIAFTER':_0x440119[_0x32ba('0x107')]?util[_0x32ba('0x76')](_0x32ba('0x16e'),ipAgi,_0x440119['dialQueueProject2']):_0x32ba('0x16d'),'XMD-QUEUE':_0x440119[_0x32ba('0x56')]===_0x32ba('0x4c')?util['format'](_0x32ba('0x16f'),_0x440119['name'],_0x440119[_0x32ba('0x170')]||'',_0x440119['dialAgiAfterHangupAgent']?'c':'',_0x440119[_0x32ba('0x171')]||0x3):_0x32ba('0x16d'),'XMD-CONTACTID':_0x3888a7[_0x32ba('0xcb')],'XMD-CDRTYPE':_0x32ba('0x8'),'CALLERID(all)':_0x941044[_0x32ba('0x27')][_0x29c73e]['getCaller'](),'XMD-AMD':_0x440119[_0x32ba('0xe3')]?_0x32ba('0x172'):_0x32ba('0x16d'),'XMD-DESTINATION':_0x32ba('0xda')};if(_0x440119[_0x32ba('0xe3')]){_0x32e63d[_0x32ba('0x173')]=_0x440119[_0x32ba('0x174')]||0x9c4;_0x32e63d['XMD-AMDGREETING']=_0x440119['dialAMDGreeting']||0x5dc;_0x32e63d[_0x32ba('0x175')]=_0x440119[_0x32ba('0x176')]||0x320;_0x32e63d[_0x32ba('0x177')]=_0x440119[_0x32ba('0x178')]||0x1388;_0x32e63d[_0x32ba('0x179')]=_0x440119[_0x32ba('0x17a')]||0x64;_0x32e63d['XMD-AMDBETWEENWORDSSILENCE']=_0x440119[_0x32ba('0x17b')]||0x32;_0x32e63d[_0x32ba('0x17c')]=_0x440119['dialAMDMaximumNumberOfWords']||0x3;_0x32e63d[_0x32ba('0x17d')]=_0x440119[_0x32ba('0x17e')]||0x100;_0x32e63d[_0x32ba('0x17f')]=_0x440119[_0x32ba('0x180')]||0x1388;}if(_0x440119[_0x32ba('0x56')]===_0x32ba('0x4c')){_0x32e63d[_0x32ba('0x181')]=_0x3888a7['VoiceQueueId'];}else{_0x32e63d['XMD-CAMPAIGNID']=_0x3888a7[_0x32ba('0xcd')];}for(var _0x1afa68 in _0x3888a7[_0x32ba('0x16a')]){if(_0x3888a7[_0x32ba('0x16a')][_0x32ba('0xa8')](_0x1afa68)){if(isNotNull(_0x3888a7[_0x32ba('0x16a')][_0x1afa68])&&_0x1afa68!=='id'&&_0x1afa68!==_0x32ba('0x182')&&_0x1afa68!==_0x32ba('0x183')&&_0x1afa68!=='updatedAt'){_0x32e63d[util[_0x32ba('0x76')](_0x32ba('0x184'),'XMD-',_['toUpper'](_0x1afa68))]=_0x3888a7[_0x32ba('0x16a')][_0x1afa68];}}}var _0x306c8f=_0x941044['isTrunkReachable'](_0x440119[_0x32ba('0x74')])?getCallerId(_0x440119[_0x32ba('0x74')][_0x32ba('0x75')],_0x440119[_0x32ba('0x5d')],_0x440119[_0x32ba('0x185')]>0x0?getCallerIdRandom(_0x440119['dialOriginateCallerIdNumber'],_0x440119[_0x32ba('0x185')]):_0x440119['dialOriginateCallerIdNumber']):getCallerId(_[_0x32ba('0xaa')](_0x440119[_0x32ba('0x13a')])?_0x440119[_0x32ba('0x74')][_0x32ba('0x75')]:_0x440119[_0x32ba('0x13a')][_0x32ba('0x75')],_0x440119[_0x32ba('0x5d')],_0x440119[_0x32ba('0x185')]>0x0?getCallerIdRandom(_0x440119[_0x32ba('0x186')],_0x440119[_0x32ba('0x185')]):_0x440119[_0x32ba('0x186')]);if(_0x306c8f){_0x32e63d[_0x32ba('0x187')]=_0x941044[_0x32ba('0x27')][_0x29c73e][_0x32ba('0x188')]=extractCalleridName(_0x306c8f);_0x32e63d['XMD-ORIGINATECALLERIDNUM']=_0x941044['actions'][_0x29c73e][_0x32ba('0x189')]=extractCalleridNumber(_0x306c8f);}return ami[_0x32ba('0xab')]({'actionid':_0x29c73e,'action':_0x32ba('0x168'),'channel':_0x941044[_0x32ba('0xd0')](_0x440119['Trunk'])?util[_0x32ba('0x76')](_0x32ba('0x18a'),_0x440119[_0x32ba('0x74')][_0x32ba('0x41')],isNotNull(_0x440119[_0x32ba('0x18b')])?_0x440119['dialPrefix'][_0x32ba('0x18c')]()||'':'',_0x440119['dialCutDigit']>0x0?_0x3888a7[_0x32ba('0x16a')]['phone'][_0x32ba('0x18d')](_0x440119[_0x32ba('0x18e')]):_0x3888a7[_0x32ba('0x16a')]['phone']):util['format'](_0x32ba('0x18a'),_[_0x32ba('0xaa')](_0x440119[_0x32ba('0x13a')])?_0x440119[_0x32ba('0x74')][_0x32ba('0x41')]:_0x440119['TrunkBackup'][_0x32ba('0x41')],isNotNull(_0x440119[_0x32ba('0x18b')])?_0x440119[_0x32ba('0x18b')][_0x32ba('0x18c')]()||'':'',_0x440119[_0x32ba('0x18e')]>0x0?_0x3888a7[_0x32ba('0x16a')]['phone'][_0x32ba('0x18d')](_0x440119[_0x32ba('0x18e')]):_0x3888a7['Contact'][_0x32ba('0x18f')]),'callerid':_0x306c8f,'Exten':_0x32ba('0xda'),'Context':'from-sip','Priority':'1','variable':_0x32e63d,'timeout':(_0x440119[_0x32ba('0x190')]||0x1e)*0x3e8,'async':!![],'channelid':_0x29c73e})[_0x32ba('0xb4')](function(_0xad43aa){return _0x2e0ab6(_0xad43aa);})[_0x32ba('0xad')](function(_0x3455f1){_0x440119[_0x32ba('0x191')]+=0x1;var _0x5492b8=new History(_0x941044[_0x32ba('0x27')][_0x29c73e]);logger[_0x32ba('0x93')](util[_0x32ba('0x76')](_0x32ba('0x192'),JSON[_0x32ba('0x47')](_0x3455f1)));_0x5492b8[_0x32ba('0xde')]=0xe;_0x5492b8[_0x32ba('0xa3')]=_0x32ba('0x193');_0x5492b8[_0x32ba('0xa5')]=moment()[_0x32ba('0x76')]('YYYY-MM-DD\x20HH:mm:ss');_0x5492b8[_0x32ba('0xa4')]=_0x5492b8[_0x32ba('0xa5')];_0x941044[_0x32ba('0xc5')](_0x5492b8)[_0x32ba('0xad')](loggerCatch('[originate][error]'));_0x941044[_0x32ba('0xc3')](_0x5492b8)['catch'](loggerCatch(_0x32ba('0x194')))['finally'](function(){delete _0x941044['actions'][_0x29c73e];return _0x4ff4f8(msgResponse(_0x32ba('0x168'),'Error',_0x32ba('0x195')));});});});};Dialer[_0x32ba('0x1d')][_0x32ba('0x196')]=function(_0x2e819e){var _0x23841d=this[_0x32ba('0x27')][_0x2e819e['actionid']];var _0x45649f=this;if(_0x23841d){delete this[_0x32ba('0x27')][_0x2e819e[_0x32ba('0x11f')]];_0x23841d[_0x32ba('0x10f')]=moment()['format'](_0x32ba('0xf4'));var _0xbfebc=_0x23841d[_0x32ba('0x56')]===_0x32ba('0x78')?this[_0x32ba('0x22')][_0x23841d[_0x32ba('0xb0')]]:this[_0x32ba('0x21')][_0x23841d[_0x32ba('0x197')]()];if(!this[_0x32ba('0xce')](_0x2e819e[_0x32ba('0x198')])){this[_0x32ba('0xaf')](_0xbfebc);return this['callProgressDetecting'](_0x23841d,_0xbfebc,_0x2e819e)[_0x32ba('0xb4')](function(_0x12c704){})[_0x32ba('0xad')](loggerCatch(_0x32ba('0x199')));}else{this['uniqueId'][_0x2e819e[_0x32ba('0xd6')]]=_0x23841d;}}};Dialer[_0x32ba('0x1d')]['checkRetriveMax']=function(_0x118af3,_0x1299d2,_0x5cc9f0){var _0x359a73=new History(_0x1299d2);if(_0x359a73[_0x32ba('0x19a')]+_0x359a73[_0x32ba('0xe7')]+_0x359a73['countnoanswerretry']+_0x359a73[_0x32ba('0xfc')]+_0x359a73['countdropretry']+_0x359a73[_0x32ba('0xea')]+_0x359a73[_0x32ba('0xeb')]+_0x359a73[_0x32ba('0xec')]>=_0x5cc9f0[_0x32ba('0xed')]-0x1){return!![];}switch(_0x118af3){case 0x3:if(_0x359a73[_0x32ba('0xe8')]>=_0x5cc9f0[_0x32ba('0x19b')]-0x1){return!![];}else{this[_0x32ba('0xbc')]({'active':![],'countnoanswerretry':_0x359a73[_0x32ba('0xe8')]+=0x1,'scheduledat':moment()[_0x32ba('0x19c')](_0x5cc9f0[_0x32ba('0x19d')],_0x32ba('0xf3'))[_0x32ba('0x76')](_0x32ba('0xf4')),'ContactId':_0x359a73[_0x32ba('0xcb')],'ListId':_0x359a73['ListId'],'VoiceQueueId':_0x359a73[_0x32ba('0xf6')]||undefined,'CampaignId':_0x359a73[_0x32ba('0xcd')]||undefined})[_0x32ba('0xad')](loggerCatch(_0x32ba('0x19e')));}break;case 0x5:if(_0x359a73[_0x32ba('0x19a')]>=_0x5cc9f0[_0x32ba('0x19f')]-0x1){return!![];}else{this[_0x32ba('0xbc')]({'active':![],'countbusyretry':_0x359a73[_0x32ba('0x19a')]+=0x1,'scheduledat':moment()['add'](_0x5cc9f0[_0x32ba('0x1a0')],'minutes')[_0x32ba('0x76')](_0x32ba('0xf4')),'ContactId':_0x359a73[_0x32ba('0xcb')],'ListId':_0x359a73['ListId'],'VoiceQueueId':_0x359a73['VoiceQueueId']||undefined,'CampaignId':_0x359a73[_0x32ba('0xcd')]||undefined})[_0x32ba('0xad')](loggerCatch(_0x32ba('0x1a1')));}break;case 0x8:if(_0x359a73['countcongestionretry']>=_0x5cc9f0[_0x32ba('0x1a2')]-0x1){return!![];}else{this[_0x32ba('0xbc')]({'active':![],'countcongestionretry':_0x359a73[_0x32ba('0xe7')]+=0x1,'scheduledat':moment()[_0x32ba('0x19c')](_0x5cc9f0['dialCongestionRetryFrequency'],'minutes')[_0x32ba('0x76')](_0x32ba('0xf4')),'ContactId':_0x359a73[_0x32ba('0xcb')],'ListId':_0x359a73[_0x32ba('0xf5')],'VoiceQueueId':_0x359a73['VoiceQueueId']||undefined,'CampaignId':_0x359a73[_0x32ba('0xcd')]||undefined})[_0x32ba('0xad')](loggerCatch(_0x32ba('0x1a3')));}break;case 0x0:if(_0x359a73[_0x32ba('0xfc')]>=_0x5cc9f0[_0x32ba('0x1a4')]-0x1){return!![];}else{this[_0x32ba('0xbc')]({'active':![],'countnosuchnumberretry':_0x359a73[_0x32ba('0xfc')]+=0x1,'scheduledat':moment()[_0x32ba('0x19c')](_0x5cc9f0[_0x32ba('0x1a5')],_0x32ba('0xf3'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x359a73[_0x32ba('0xcb')],'ListId':_0x359a73[_0x32ba('0xf5')],'VoiceQueueId':_0x359a73[_0x32ba('0xf6')]||undefined,'CampaignId':_0x359a73[_0x32ba('0xcd')]||undefined})['catch'](loggerCatch(_0x32ba('0x1a6')));}break;case 0xa:if(_0x359a73[_0x32ba('0xe9')]>=_0x5cc9f0['dialDropMaxRetry']-0x1){return!![];}else{this[_0x32ba('0xbc')]({'active':![],'countdropretry':_0x359a73[_0x32ba('0xe9')]+=0x1,'scheduledat':moment()[_0x32ba('0x19c')](_0x5cc9f0[_0x32ba('0x1a7')],_0x32ba('0xf3'))[_0x32ba('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x359a73[_0x32ba('0xcb')],'ListId':_0x359a73[_0x32ba('0xf5')],'VoiceQueueId':_0x359a73['VoiceQueueId']||undefined,'CampaignId':_0x359a73[_0x32ba('0xcd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x359a73[_0x32ba('0xea')]>=_0x5cc9f0[_0x32ba('0x119')]-0x1){return!![];}else{this[_0x32ba('0xbc')]({'active':![],'countabandonedretry':_0x359a73[_0x32ba('0xea')]+=0x1,'scheduledat':moment()[_0x32ba('0x19c')](_0x5cc9f0[_0x32ba('0x11a')],_0x32ba('0xf3'))[_0x32ba('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x359a73[_0x32ba('0xcb')],'ListId':_0x359a73[_0x32ba('0xf5')],'VoiceQueueId':_0x359a73[_0x32ba('0xf6')]||undefined,'CampaignId':_0x359a73['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));}break;case 0x13:if(_0x359a73[_0x32ba('0xeb')]>=_0x5cc9f0[_0x32ba('0xf0')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countmachineretry':_0x359a73['countmachineretry']+=0x1,'scheduledat':moment()[_0x32ba('0x19c')](_0x5cc9f0[_0x32ba('0xfd')],_0x32ba('0xf3'))['format'](_0x32ba('0xf4')),'ContactId':_0x359a73[_0x32ba('0xcb')],'ListId':_0x359a73['ListId'],'VoiceQueueId':_0x359a73[_0x32ba('0xf6')]||undefined,'CampaignId':_0x359a73['CampaignId']||undefined})[_0x32ba('0xad')](loggerCatch(_0x32ba('0xf7')));}break;case 0x14:if(_0x359a73[_0x32ba('0xec')]>=_0x5cc9f0[_0x32ba('0x1a8')]-0x1){return!![];}else{this[_0x32ba('0xbc')]({'active':![],'countagentrejectretry':_0x359a73[_0x32ba('0xec')]+=0x1,'scheduledat':moment()[_0x32ba('0x19c')](_0x5cc9f0[_0x32ba('0x1a9')],_0x32ba('0xf3'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x359a73['ContactId'],'ListId':_0x359a73['ListId'],'VoiceQueueId':_0x359a73[_0x32ba('0xf6')]||undefined,'CampaignId':_0x359a73[_0x32ba('0xcd')]||undefined})[_0x32ba('0xad')](loggerCatch(_0x32ba('0x1aa')));}break;default:return!![];}};Dialer[_0x32ba('0x1d')][_0x32ba('0x1ab')]=function(_0x21a66e,_0x2b8d27,_0x3af7e2){var _0x3ff279=this;var _0x52674b=new History(_0x21a66e);return new BPromise(function(_0x12db8e,_0x480ade){if(_[_0x32ba('0x3d')](_0x2b8d27)&&_0x32ba('0x167')!==typeof _0x2b8d27){return _0x480ade(msgResponse('[callProgressDetecting]','Failure','entity\x20is\x20undefine'));}if(_[_0x32ba('0x3d')](_0x3af7e2)&&_0x32ba('0x167')!==typeof _0x3af7e2){return _0x480ade(msgResponse(_0x32ba('0x1ac'),_0x32ba('0x140'),_0x32ba('0x1ad')));}switch(_0x3af7e2[_0x32ba('0x105')]){case'0':_0x2b8d27[_0x32ba('0x65')]+=0x1;_0x52674b[_0x32ba('0xde')]=0x0;_0x52674b['statedesc']='NoSuchNumber';_0x52674b['countnosuchnumberretry']+=0x1;_0x52674b['countglobal']+=0x1;ami[_0x32ba('0x4b')]('custom:agentnosuchnumber',ut['buildObj'](_0x21a66e,_0x32ba('0x1ae')));_0x3ff279[_0x32ba('0xc5')](_0x52674b)[_0x32ba('0xad')](loggerCatch(_0x32ba('0xe6')));if(_0x3ff279['checkRetriveMax'](0x0,_0x21a66e,_0x2b8d27)){if(_0x52674b['countnosuchnumberretry']>=_0x2b8d27[_0x32ba('0x1a4')]){_0x3ff279['createStateFinal'](_0x52674b,_0x12db8e,_0x480ade,'reason\x200\x20no\x20such\x20number....');}else{_0x3ff279[_0x32ba('0xee')](_0x52674b,_0x12db8e,_0x480ade,_0x32ba('0x1af'));}}break;case'3':_0x2b8d27['outboundNoAnswerCallsDay']+=0x1;_0x52674b[_0x32ba('0xde')]=0x3;_0x52674b[_0x32ba('0xa3')]=_0x32ba('0x1b0');_0x52674b[_0x32ba('0xe8')]+=0x1;_0x52674b[_0x32ba('0xe5')]+=0x1;ami[_0x32ba('0x4b')]('custom:agentnoanswer',ut[_0x32ba('0x1b1')](_0x21a66e,_0x32ba('0x1b2')));_0x3ff279[_0x32ba('0xc5')](_0x52674b)[_0x32ba('0xad')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x3ff279[_0x32ba('0x1b3')](0x3,_0x21a66e,_0x2b8d27)){if(_0x52674b[_0x32ba('0xe8')]>=_0x2b8d27[_0x32ba('0x19b')]){_0x3ff279[_0x32ba('0xf1')](_0x52674b,_0x12db8e,_0x480ade,_0x32ba('0x1b4'));}else{_0x3ff279[_0x32ba('0xee')](_0x52674b,_0x12db8e,_0x480ade,_0x32ba('0x1b4'));}}break;case'5':_0x2b8d27[_0x32ba('0x60')]+=0x1;_0x52674b[_0x32ba('0xde')]=0x5;_0x52674b[_0x32ba('0xa3')]=_0x32ba('0x1b5');_0x52674b[_0x32ba('0x19a')]+=0x1;_0x52674b[_0x32ba('0xe5')]+=0x1;ami['emit'](_0x32ba('0x1b6'),ut[_0x32ba('0x1b1')](_0x21a66e,_0x32ba('0x1b7')));_0x3ff279['createHistory'](_0x52674b)[_0x32ba('0xad')](loggerCatch(_0x32ba('0x1b8')));if(_0x3ff279[_0x32ba('0x1b3')](0x5,_0x21a66e,_0x2b8d27)){if(_0x52674b[_0x32ba('0x19a')]>=_0x2b8d27['dialBusyMaxRetry']){_0x3ff279['createStateFinal'](_0x52674b,_0x12db8e,_0x480ade,_0x32ba('0x1b9'));}else{_0x3ff279['stateGlobal'](_0x52674b,_0x12db8e,_0x480ade,'reason\x205\x20busy');}}break;case'8':_0x2b8d27[_0x32ba('0x61')]+=0x1;_0x52674b['state']=0x8;_0x52674b['statedesc']=_0x32ba('0x1ba');_0x52674b['countcongestionretry']+=0x1;_0x52674b[_0x32ba('0xe5')]+=0x1;ami['emit']('custom:agentcongestion',ut[_0x32ba('0x1b1')](_0x21a66e,_0x32ba('0x1bb')));_0x3ff279['createHistory'](_0x52674b)[_0x32ba('0xad')](loggerCatch(_0x32ba('0x1bc')));if(_0x3ff279[_0x32ba('0x1b3')](0x8,_0x21a66e,_0x2b8d27)){if(_0x52674b[_0x32ba('0xe7')]>=_0x2b8d27[_0x32ba('0x1a2')]){_0x3ff279[_0x32ba('0xf1')](_0x52674b,_0x12db8e,_0x480ade,_0x32ba('0x1bd'));}else{_0x3ff279['stateGlobal'](_0x52674b,_0x12db8e,_0x480ade,_0x32ba('0x1bd'));}}break;case'11':_0x2b8d27[_0x32ba('0x1be')]+=0x1;_0x52674b[_0x32ba('0xde')]=0xb;_0x52674b[_0x32ba('0xa3')]=_0x32ba('0x118');_0x52674b['countabandonedretry']+=0x1;_0x52674b[_0x32ba('0xe5')]+=0x1;_0x3ff279[_0x32ba('0xc5')](_0x52674b)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x3ff279['checkRetriveMax'](0xb,_0x21a66e,_0x2b8d27)){if(_0x52674b[_0x32ba('0xea')]>=_0x2b8d27[_0x32ba('0x119')]){_0x3ff279[_0x32ba('0xf1')](_0x52674b,_0x12db8e,_0x480ade,_0x32ba('0x1bf'));}else{_0x3ff279[_0x32ba('0xee')](_0x52674b,_0x12db8e,_0x480ade,_0x32ba('0x1bf'));}}break;case'20':_0x2b8d27[_0x32ba('0x67')]+=0x1;_0x52674b[_0x32ba('0xde')]=0x14;_0x52674b['statedesc']=_0x32ba('0x1c0');_0x52674b['countagentrejectretry']+=0x1;_0x52674b[_0x32ba('0xe5')]+=0x1;ami[_0x32ba('0x4b')](_0x32ba('0x1c1'),ut['buildObj'](_0x21a66e,_0x32ba('0x1c2')));_0x3ff279['createHistory'](_0x52674b)[_0x32ba('0xad')](loggerCatch(_0x32ba('0x1c3')));if(_0x3ff279[_0x32ba('0x1b3')](0x14,_0x21a66e,_0x2b8d27)){if(_0x52674b[_0x32ba('0xec')]>=_0x2b8d27[_0x32ba('0x1a8')]){_0x3ff279['createStateFinal'](_0x52674b,_0x12db8e,_0x480ade,'reason\x2020\x20agentreject');}else{_0x3ff279[_0x32ba('0xee')](_0x52674b,_0x12db8e,_0x480ade,_0x32ba('0x1c4'));}}break;default:_0x2b8d27[_0x32ba('0x1c5')]+=0x1;_0x52674b['state']=0xc;_0x52674b[_0x32ba('0xa3')]=_0x3af7e2[_0x32ba('0x105')];_0x3ff279['createHistory'](_0x52674b)[_0x32ba('0xad')](loggerCatch(_0x32ba('0x1c6')));if(_0x3ff279['checkRetriveMax'](_0x3af7e2['reason'],_0x21a66e,_0x2b8d27)){if(_0x52674b[_0x32ba('0x19a')]+_0x52674b[_0x32ba('0xe7')]+_0x52674b['countnoanswerretry']+_0x52674b[_0x32ba('0xfc')]+_0x52674b[_0x32ba('0xe9')]+_0x52674b[_0x32ba('0xea')]+_0x52674b['countmachineretry']+_0x52674b[_0x32ba('0xec')]>=_0x2b8d27[_0x32ba('0xed')]){_0x3ff279[_0x32ba('0xee')](_0x52674b,_0x12db8e,_0x480ade,_0x3af7e2[_0x32ba('0x105')]);}else{_0x3ff279[_0x32ba('0xf1')](_0x52674b,_0x12db8e,_0x480ade,_0x3af7e2[_0x32ba('0x105')]);}}}});};Dialer[_0x32ba('0x1d')][_0x32ba('0xee')]=function(_0x146a91,_0x2a9fdf,_0x43dcd3,_0x21ff5a){var _0x5dc24e=new Final(_0x146a91);_0x5dc24e[_0x32ba('0xde')]=0xf;_0x5dc24e[_0x32ba('0xa3')]='Global';this[_0x32ba('0xf1')](_0x5dc24e,_0x2a9fdf,_0x43dcd3,_0x21ff5a);};Dialer[_0x32ba('0x1d')][_0x32ba('0xf1')]=function(_0x6a1e79,_0x1d6bc0,_0x3f8cc8,_0x199155){this[_0x32ba('0xc3')](_0x6a1e79)['then'](function(_0x5e9069){return _0x1d6bc0(msgResponse(_0x32ba('0x1ac'),_0x32ba('0xcf'),_0x199155));})[_0x32ba('0xad')](function(_0x5949f3){return _0x3f8cc8(msgResponse(_0x32ba('0x1c7'),_0x32ba('0x140'),_0x32ba('0x1c8')));});};Dialer[_0x32ba('0x1d')]['predictive']=function(_0x3da559){var _0x51aa52=this;var _0x57a9cf=_0x3da559[_0x32ba('0x1c9')]/0x64;var _0x1e1524=_0x3da559[_0x32ba('0x64')]/(_0x3da559[_0x32ba('0x64')]+_0x3da559[_0x32ba('0x5e')]);var _0x4aba32=Math['round'](_0x3da559[_0x32ba('0x6e')]*(_0x3da559[_0x32ba('0x1ca')]/0x64));var _0x2becaa=Math[_0x32ba('0x1cb')](_0x3da559[_0x32ba('0x6e')]*(_0x3da559[_0x32ba('0x1cc')]/0x64));var _0x375670=_0x3da559[_0x32ba('0x4f')]+_0x3da559['talking'];var _0x4957f6=Math[_0x32ba('0x1cd')](_0x3da559[_0x32ba('0x71')]*_0x3da559[_0x32ba('0x89')]*_0x3da559[_0x32ba('0x6d')]*_0x3da559[_0x32ba('0x1ce')]);if(_[_0x32ba('0x3d')](_0x3da559[_0x32ba('0x2b')])){if(!_[_0x32ba('0x3d')](_0x3da559[_0x32ba('0x2a')])){_0x3da559[_0x32ba('0x2a')]=undefined;loggerPredictive[_0x32ba('0x93')](_0x32ba('0x1cf'),_0x32ba('0x1d0'));}if(!_['isUndefined'](_0x3da559[_0x32ba('0x8d')])){loggerPredictive[_0x32ba('0x93')]('[startMethodPredictive][StartProgressive]',_0x32ba('0x1d1'));clearInterval(_0x3da559[_0x32ba('0x8d')]);_0x3da559[_0x32ba('0x8d')]=undefined;}_0x3da559[_0x32ba('0x2b')]=moment()[_0x32ba('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x32ba('0x7c')](_0x3da559['name'],_0x32ba('0x1d2'),_0x3da559[_0x32ba('0x2b')]);this['handlePower'](_0x3da559,0x1);}else if(ifInterval(_0x3da559[_0x32ba('0x1d3')],_0x3da559[_0x32ba('0x2b')])){this['handlePower'](_0x3da559,0x1);loggerPredictiveCalls[_0x32ba('0x7c')](_0x32ba('0x1d4'),_0x3da559[_0x32ba('0x2b')],_0x3da559[_0x32ba('0x41')]);_0x3da559[_0x32ba('0x71')]=0x0;_0x3da559[_0x32ba('0x6c')]=0x0;}else if(_0x57a9cf<_0x1e1524&&_0x3da559[_0x32ba('0x1d5')]===_0x32ba('0x1d6')){freeVariablesPredictive(_0x3da559);loggerPredictive['info'](_0x32ba('0x1d7'),_0x32ba('0x1d8'),_0x1e1524,_0x32ba('0x2b'),_0x3da559[_0x32ba('0x41')]);}else if(_0x4957f6<_0x3da559[_0x32ba('0x6c')]&&_0x3da559[_0x32ba('0x1d5')]===_0x32ba('0x1d6')){freeVariablesPredictive(_0x3da559);loggerPredictive[_0x32ba('0x7c')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x4957f6,_0x32ba('0x1d9'),_0x3da559[_0x32ba('0x6c')],_0x32ba('0x2b'),_0x3da559[_0x32ba('0x41')]);}else if(!ifInterval(_0x3da559['dialPredictiveInterval'],_0x3da559[_0x32ba('0x2b')])&&_[_0x32ba('0x3d')](_0x3da559[_0x32ba('0x2a')])&&!_[_0x32ba('0x3d')](_0x3da559[_0x32ba('0x2b')])){_0x3da559[_0x32ba('0x2a')]=moment()[_0x32ba('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x32ba('0x7c')](_0x3da559[_0x32ba('0x41')],_0x32ba('0x1da'),_0x3da559[_0x32ba('0x2a')]);this['averageHandleTime'](_0x3da559['dialPredictiveInterval'])[_0x32ba('0xb4')](this[_0x32ba('0x1db')](_0x3da559))['then'](mergeDataErlangB(_0x3da559))[_0x32ba('0xb4')](this[_0x32ba('0x1dc')](_0x3da559))[_0x32ba('0xad')](loggerCatchPredictive(_0x32ba('0x1dd'),_0x3da559));}else if(!ifInterval(_0x3da559[_0x32ba('0x1d3')],_0x3da559[_0x32ba('0x2a')])){_0x3da559['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x3da559[_0x32ba('0x2a')]=moment()[_0x32ba('0x76')](_0x32ba('0xf4'));loggerPredictive[_0x32ba('0x7c')](_0x3da559[_0x32ba('0x41')],_0x32ba('0x1de'),_0x3da559['startPredictive']);clearInterval(_0x3da559['handlePredictive']);_0x3da559[_0x32ba('0x8d')]=undefined;this[_0x32ba('0xba')](_0x3da559['dialPredictiveInterval'])[_0x32ba('0xb4')](this[_0x32ba('0x1db')](_0x3da559))['then'](mergeDataErlangB(_0x3da559))[_0x32ba('0xb4')](this['startMethodPredictive'](_0x3da559))[_0x32ba('0xad')](loggerCatchPredictive(_0x32ba('0x1df'),_0x3da559));}else if(_0x3da559[_0x32ba('0x6e')]&&_0x375670<_0x3da559['predictiveIntervalAvailable']-_0x2becaa){freeVariablesPredictive(_0x3da559);loggerPredictive[_0x32ba('0x7c')](_0x3da559[_0x32ba('0x41')],_0x32ba('0x1e0'),_0x375670,_0x32ba('0x1e1'),_0x3da559[_0x32ba('0x6e')],'-',_0x2becaa,'=',_0x3da559['predictiveIntervalAvailable']-_0x2becaa,')');}else if(_0x3da559['predictiveIntervalAvailable']&&_0x375670>_0x3da559[_0x32ba('0x6e')]+_0x4aba32){freeVariablesPredictive(_0x3da559);loggerPredictive[_0x32ba('0x7c')](_0x3da559[_0x32ba('0x41')],_0x32ba('0x1e0'),_0x375670,_0x32ba('0x1e2'),_0x3da559[_0x32ba('0x6e')],'+',_0x4aba32,'=',_0x3da559['predictiveIntervalAvailable']+_0x4aba32,')');}};Dialer[_0x32ba('0x1d')][_0x32ba('0x1db')]=function(_0xaad25a){var _0x417513=this;return function(_0x3f0d39){return new BPromise(function(_0x404c49,_0x7f8996){_[_0x32ba('0xca')](_0xaad25a,_0x3f0d39[0x0]);if(checkGetDataPredictive(_0x3f0d39[0x0])){var _0x180cb8=_0xaad25a[_0x32ba('0x6e')]=_0xaad25a[_0x32ba('0x9c')]+_0xaad25a[_0x32ba('0x4f')];var _0x1e80c0=_0xaad25a[_0x32ba('0x1d3')]*0x3c;var _0x2b2168=_0x3f0d39[0x0][_0x32ba('0x6a')]+_0x3f0d39[0x0][_0x32ba('0x69')];var _0x526ffa=(_0x3f0d39[0x0][_0x32ba('0x68')]+_0x3f0d39[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3f0d39[0x0][_0x32ba('0x117')])/_0x3f0d39[0x0][_0x32ba('0x6f')];_0xaad25a[_0x32ba('0x6d')]=_0x526ffa>0x0?_0x526ffa:0x1;switch(_0xaad25a[_0x32ba('0x1d5')]){case _0x32ba('0x1d6'):var _0x4e6a15=_0xaad25a['dialPredictiveOptimizationPercentage']/0x64;return _0x417513[_0x32ba('0x1e3')](_0x180cb8,_0x1e80c0,_0x2b2168,_0x526ffa,_0x4e6a15)[_0x32ba('0xb4')](function(_0x3cf965){return _0x404c49(_0x3cf965);});case _0x32ba('0x1e4'):var _0x22bdaa=_0xaad25a[_0x32ba('0x1c9')]/0x64;return _0x417513['busyFactor'](_0x180cb8,_0x1e80c0,_0x2b2168,_0x526ffa,_0x22bdaa)[_0x32ba('0xb4')](function(_0x36b502){return _0x404c49(_0x36b502);});default:return _0x7f8996(msgResponse(_0x32ba('0x1e5'),_0x32ba('0x140'),_0x32ba('0x1e6')));}}else{return _0x7f8996(msgResponse(_0x32ba('0x1e5'),_0x32ba('0x140'),'check\x20failure'));}});};};Dialer[_0x32ba('0x1d')][_0x32ba('0x1e7')]=function(_0x2286c9){var _0x50b5a5=this;return function(_0x89ceb8){return new BPromise(function(_0x25dd1f,_0x4571ef){_['merge'](_0x2286c9,_0x89ceb8[0x0]);if(checkGetDataPredictive(_0x89ceb8[0x0])){loggerPredictive[_0x32ba('0x7c')](JSON[_0x32ba('0x47')](_0x89ceb8[0x0]));if(_0x2286c9[_0x32ba('0x1d5')]===_0x32ba('0x1d6')){return _0x50b5a5[_0x32ba('0xc2')](_0x2286c9['id'])[_0x32ba('0xb4')](function(_0x39bc93){var _0x11b5f5=_0x2286c9[_0x32ba('0x50')]-_0x39bc93[0x0][_0x32ba('0x1e8')];var _0x52f477=_0x2286c9[_0x32ba('0x1d3')]*0x3c;var _0x34569b=_0x89ceb8[0x0]['predictiveIntervalAvgTalktime']+_0x89ceb8[0x0][_0x32ba('0x69')];var _0x1e4827=(_0x89ceb8[0x0][_0x32ba('0x68')]+_0x89ceb8[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x89ceb8[0x0][_0x32ba('0x117')])/_0x89ceb8[0x0][_0x32ba('0x6f')];var _0x269757=_0x2286c9[_0x32ba('0x1c9')]/0x64;_0x2286c9[_0x32ba('0x1e9')]=_0x39bc93[0x0][_0x32ba('0x1e8')]||0x0;_0x2286c9[_0x32ba('0x6d')]=_0x1e4827>0x0?_0x1e4827:0x1;return _0x50b5a5[_0x32ba('0x1e3')](_0x11b5f5,_0x52f477,_0x34569b,_0x1e4827,_0x269757);})[_0x32ba('0xb4')](function(_0x5567a0){return _0x25dd1f(_0x5567a0);})['catch'](function(_0x176b33){return _0x4571ef(msgResponse(_0x32ba('0x1ea'),_0x32ba('0x140'),JSON[_0x32ba('0x47')](_0x176b33)));});}if(_0x2286c9[_0x32ba('0x1d5')]===_0x32ba('0x1e4')){return _0x50b5a5['getVoiceQueueRtPauses'](_0x2286c9['id'])[_0x32ba('0xb4')](function(_0x3a2dcf){var _0x132d8c=_0x2286c9['loggedIn']-_0x3a2dcf[0x0][_0x32ba('0x1e8')];var _0x3f125b=_0x2286c9['dialPredictiveInterval']*0x3c;var _0x22541f=_0x89ceb8[0x0][_0x32ba('0x6a')]+_0x89ceb8[0x0][_0x32ba('0x69')];var _0x79539b=(_0x89ceb8[0x0]['predictiveIntervalAnsweredCalls']+_0x89ceb8[0x0][_0x32ba('0x6b')]+_0x89ceb8[0x0][_0x32ba('0x117')])/_0x89ceb8[0x0][_0x32ba('0x6f')];var _0x443cad=_0x2286c9['dialPredictiveOptimizationPercentage']/0x64;_0x2286c9[_0x32ba('0x1e9')]=_0x3a2dcf[0x0][_0x32ba('0x1e8')]||0x0;_0x2286c9['predictiveIntervalHitRate']=_0x79539b>0x0?_0x79539b:0x1;return _0x50b5a5[_0x32ba('0x1eb')](_0x132d8c,_0x3f125b,_0x22541f,_0x79539b,_0x443cad);})[_0x32ba('0xb4')](function(_0xdbe060){return _0x25dd1f(_0xdbe060);})[_0x32ba('0xad')](function(_0x3b7500){return _0x4571ef(msgResponse(_0x32ba('0x1ea'),_0x32ba('0x140'),JSON['stringify'](_0x3b7500)));});}}else{return _0x4571ef(msgResponse(_0x32ba('0x1e5'),_0x32ba('0x140'),_0x32ba('0x1ec')));}});};};Dialer['prototype'][_0x32ba('0x1dc')]=function(_0x42c5e7){var _0x534817=this;return function(){var _0x1cf545=0x0;var _0x72b9e1=Math[_0x32ba('0x1cd')](_0x42c5e7['erlangCallToSecond']*0x3e8);if(_0x72b9e1>0x0){_0x72b9e1=_0x72b9e1<0x64?0x64:_0x72b9e1;loggerPredictive[_0x32ba('0x7c')](_0x42c5e7[_0x32ba('0x41')],_0x32ba('0x1ed'),_0x72b9e1,_0x32ba('0x48'));_0x42c5e7[_0x32ba('0x8d')]=setInterval(function(){_0x534817[_0x32ba('0x8d')](_0x42c5e7);loggerPredictiveCalls[_0x32ba('0x7c')](_0x32ba('0x1ee'),_0x1cf545+=0x1);},_0x72b9e1);}else{loggerPredictive[_0x32ba('0x7c')](_0x42c5e7[_0x32ba('0x41')],_0x32ba('0x1ef'));}};};Dialer[_0x32ba('0x1d')][_0x32ba('0x1f0')]=function(_0x17d335,_0x113bd6){var _0x5f0d3f=this;return function(_0x5baaf7){if(_[_0x32ba('0x7b')](_0x5baaf7)){if(_[_0x32ba('0xaa')](_0x113bd6[_0x32ba('0xcc')])||!_0x113bd6[_0x32ba('0x1f1')]){if(_0x17d335[_0x32ba('0x5c')]===_0x32ba('0x9')){_0x17d335[_0x32ba('0x126')]=_[_0x32ba('0x3d')](_0x17d335[_0x32ba('0x126')])?!![]:_0x17d335[_0x32ba('0x126')];var _0x556aa4=uuid['v4']();_0x5f0d3f[_0x32ba('0x27')][_0x556aa4]=new Action(_0x17d335,_0x113bd6,_0x556aa4);loggerBooked['info'](_0x32ba('0x1f2'),_0x556aa4,_0x32ba('0x1f3'),JSON[_0x32ba('0x47')](_0x17d335['queueStatusComplete']),_0x32ba('0x1f4'),_0x17d335[_0x32ba('0x41')]);if(_0x17d335[_0x32ba('0x126')]){_0x17d335[_0x32ba('0x126')]=![];_0x5f0d3f[_0x32ba('0x123')][_0x5f0d3f['actions'][_0x556aa4]['queue']]=[];ami[_0x32ba('0xab')]({'actionid':_0x556aa4,'action':_0x32ba('0x1f5'),'queue':_0x17d335[_0x32ba('0x41')]})[_0x32ba('0xad')](function(_0x2d20ef){_0x5f0d3f[_0x32ba('0xaf')](_0x17d335);_0x5f0d3f[_0x32ba('0xbc')]({'active':![],'ContactId':_0x5f0d3f[_0x32ba('0x27')][_0x556aa4][_0x32ba('0xcb')],'ListId':_0x5f0d3f[_0x32ba('0x27')][_0x556aa4]['ListId'],'VoiceQueueId':_0x5f0d3f[_0x32ba('0x27')][_0x556aa4]['VoiceQueueId']||undefined,'CampaignId':_0x5f0d3f['actions'][_0x556aa4][_0x32ba('0xcd')]||undefined})[_0x32ba('0xad')](loggerCatch(_0x32ba('0x1f6')));delete _0x5f0d3f[_0x32ba('0x27')][_0x556aa4];});}else{loggerBooked[_0x32ba('0x7c')](_0x32ba('0x1f7'),JSON[_0x32ba('0x47')](_0x17d335[_0x32ba('0x126')]),_0x32ba('0x1f4'),_0x17d335['name']);_0x5f0d3f['updateOriginated'](_0x17d335);_0x5f0d3f[_0x32ba('0xbc')]({'active':![],'ContactId':_0x5f0d3f[_0x32ba('0x27')][_0x556aa4][_0x32ba('0xcb')],'ListId':_0x5f0d3f[_0x32ba('0x27')][_0x556aa4][_0x32ba('0xf5')],'VoiceQueueId':_0x5f0d3f[_0x32ba('0x27')][_0x556aa4]['VoiceQueueId']||undefined,'CampaignId':_0x5f0d3f[_0x32ba('0x27')][_0x556aa4]['CampaignId']||undefined})['catch'](loggerCatch(_0x32ba('0x1f6')));delete _0x5f0d3f[_0x32ba('0x27')][_0x556aa4];}}else{return _0x5f0d3f['actionOriginate'](_0x17d335,_0x113bd6);}}else{if(getDiff(_0x113bd6[_0x32ba('0x1f8')])<_0x17d335['dialRecallMeTimeout']*0x3c){if(_0x113bd6[_0x32ba('0x1f9')]&&!_0x113bd6['Agent'][_0x32ba('0x1fa')]){_0x5f0d3f['preview']['run'](_0x113bd6['id'])[_0x32ba('0x1f')](function(){_0x5f0d3f[_0x32ba('0xaf')](_0x17d335);});}else{_0x5f0d3f[_0x32ba('0xbe')]({'active':![]},_0x113bd6['id'],0x1)[_0x32ba('0x1f')](function(){console['log'](_0x32ba('0x1fb'));_0x5f0d3f[_0x32ba('0xaf')](_0x17d335);});}}else{_0x17d335[_0x32ba('0x66')]+=0x1;_0x5f0d3f[_0x32ba('0xaf')](_0x17d335);if(_0x17d335['dialRecallInQueue']){_0x5f0d3f['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x113bd6[_0x32ba('0xcb')],'ListId':_0x113bd6[_0x32ba('0xf5')],'VoiceQueueId':_0x113bd6['VoiceQueueId']||undefined,'CampaignId':_0x113bd6[_0x32ba('0xcd')]||undefined})[_0x32ba('0xad')](loggerCatch(_0x32ba('0x1fc')));_0x5f0d3f['createHistory'](createObjHistory(_0x17d335,_0x113bd6,'RECALLINQUEUE',0x17,_0x32ba('0x1fd')))[_0x32ba('0xad')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x5f0d3f['saveInDb'](createObjHistory(_0x17d335,_0x113bd6,_0x32ba('0x1fe'),0x16,_0x32ba('0x1ff')),'[Originate][HistoryRecallClose][historyCatch]',_0x32ba('0x200'));}}}}else{_0x17d335['outboundBlacklistCallsDay']+=0x1;_0x5f0d3f[_0x32ba('0xd5')](createObjHistory(_0x17d335,_0x113bd6,_0x32ba('0x201'),0xd,_0x32ba('0x202')),_0x32ba('0x203'),_0x32ba('0x204'));throw _0x32ba('0x205');}};};Dialer['prototype'][_0x32ba('0x15d')]=function(_0x5aeb92){var _0x2a28e4=this;var _0x5251ea=[];var _0x1e2b74=_0x5aeb92[_0x32ba('0x206')]-_0x5aeb92[_0x32ba('0x70')]-_0x5aeb92[_0x32ba('0x207')];emitCampaignSummary(_0x5aeb92);if(_0x1e2b74>0x0){if(_0x1e2b74>this[_0x32ba('0x25')]){_0x1e2b74=this[_0x32ba('0x25')];}_0x5aeb92[_0x32ba('0x207')]+=_0x1e2b74;this[_0x32ba('0xc1')](_0x5aeb92['id'],_0x1e2b74,_0x5aeb92[_0x32ba('0x208')])[_0x32ba('0xb4')](function(_0xa527ce){_0x5aeb92[_0x32ba('0x207')]-=_0x1e2b74;_0x5aeb92[_0x32ba('0x207')]=_0x5aeb92[_0x32ba('0x207')]>0x0?_0x5aeb92[_0x32ba('0x207')]:0x0;if(!checkContactEmpty(_0xa527ce)){_0x5aeb92[_0x32ba('0x40')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x32ba('0x7c')](_0x32ba('0x209')+_0x5aeb92[_0x32ba('0x41')]);}else{_0x5aeb92[_0x32ba('0x70')]+=_0xa527ce[_0x32ba('0x96')];_0x5aeb92[_0x32ba('0x40')]=_0x32ba('0x20a');for(var _0x1de00a=0x0;_0x1de00a<_0xa527ce[_0x32ba('0x96')];_0x1de00a+=0x1){_0x5aeb92[_0x32ba('0x20b')]+=0x1;if(_['isNil'](_0xa527ce[_0x1de00a])||_['isNil'](_0xa527ce[_0x1de00a][_0x32ba('0x16a')])||_[_0x32ba('0xaa')](_0xa527ce[_0x1de00a]['Contact'][_0x32ba('0x18f')])){_0x2a28e4['emptyContact']('[actionOriginate]\x20',_0x5aeb92,_0xa527ce[_0x1de00a]);}else{_0x2a28e4[_0x32ba('0xb8')](_['pick'](_0xa527ce[_0x1de00a],[_0x32ba('0xcd'),'Contact.phone']))[_0x32ba('0xb4')](_0x2a28e4[_0x32ba('0x1f0')](_0x5aeb92,_0xa527ce[_0x1de00a]))[_0x32ba('0xad')](_0x2a28e4[_0x32ba('0xc8')](_0x32ba('0x20c'),_0x5aeb92));}}}})[_0x32ba('0xad')](loggerGetContactDialer('[getContactCampaign2]',_0x5aeb92,_0x1e2b74));}};Dialer[_0x32ba('0x1d')][_0x32ba('0x157')]=function(_0xd7033d,_0x2255e4){var _0x45cd04=this;var _0x44d058=[];var _0x59142e=_0x2255e4>=0x1?_0x2255e4:0x1;var _0x16b2e8=[];if(_0xd7033d[_0x32ba('0x5c')]===_0x32ba('0x9')){_0x59142e=0x1;}var _0x1507d0=Math[_0x32ba('0x1cd')](_0xd7033d[_0x32ba('0x4f')]*_0x59142e)-_0xd7033d['originated']-_0xd7033d['temp'];emitVoiceQueueSummary(_0xd7033d);if(_0xd7033d['dialLimitQueue']>0x0){var _0x1e60d4=_0xd7033d[_0x32ba('0x20d')]-_0xd7033d[_0x32ba('0x70')]-_0xd7033d[_0x32ba('0x9c')]-_0xd7033d['temp']-_0xd7033d[_0x32ba('0x51')];if(_0x1507d0>_0x1e60d4){_0x1507d0=_0x1e60d4;}}if(_0x1507d0>0x0){if(_0xd7033d[_0x32ba('0x5c')]==='booked'){_0x1507d0=0x1;}if(_0x1507d0>this[_0x32ba('0x25')]){_0x1507d0=this['maxNumberOriginate'];}_0xd7033d[_0x32ba('0x207')]+=_0x1507d0;for(var _0x454857 in this[_0x32ba('0x23')]){if(this[_0x32ba('0x23')][_0x32ba('0xa8')](_0x454857)){if(this[_0x32ba('0x23')][_0x454857]['state']===_0x32ba('0x20e')&&this[_0x32ba('0x23')][_0x454857]['status']==='reachable'){_0x44d058[_0x32ba('0x124')](this[_0x32ba('0x23')][_0x454857]['id']);}}}this['getContactDialer'](_0xd7033d['id'],_0x44d058,_0x1507d0,_0xd7033d['dialOrderByScheduledAt'])[_0x32ba('0xb4')](function(_0x49810a){_0xd7033d['temp']-=_0x1507d0;_0xd7033d[_0x32ba('0x207')]=_0xd7033d['temp']>0x0?_0xd7033d[_0x32ba('0x207')]:0x0;if(!checkContactEmpty(_0x49810a)){_0x45cd04[_0x32ba('0xb2')](_0xd7033d)[_0x32ba('0xb4')](sendMessageReschedule(_0xd7033d))[_0x32ba('0xad')](loggerCatch(_0x32ba('0xb5')));}else{_0xd7033d[_0x32ba('0x70')]+=_0x49810a[_0x32ba('0x96')];_0xd7033d[_0x32ba('0x40')]=_0xd7033d[_0x32ba('0x5c')]===_0x32ba('0x9')?_0x32ba('0x172'):'RUNNING';for(var _0xa91cb8=0x0;_0xa91cb8<_0x49810a['length'];_0xa91cb8+=0x1){if(_[_0x32ba('0xaa')](_0x49810a[_0xa91cb8])||_[_0x32ba('0xaa')](_0x49810a[_0xa91cb8]['Contact'])||_[_0x32ba('0xaa')](_0x49810a[_0xa91cb8][_0x32ba('0x16a')][_0x32ba('0x18f')])){_0x45cd04[_0x32ba('0x20f')](_0x32ba('0x210'),_0xd7033d,_0x49810a[_0xa91cb8]);}else{_0x45cd04[_0x32ba('0xb6')](_[_0x32ba('0x125')](_0x49810a[_0xa91cb8],['VoiceQueueId',_0x32ba('0x211')]))[_0x32ba('0xb4')](_0x45cd04[_0x32ba('0x1f0')](_0xd7033d,_0x49810a[_0xa91cb8]))[_0x32ba('0xad')](_0x45cd04['loggerHandler'](_0x32ba('0x210'),_0xd7033d));}}}})[_0x32ba('0xad')](loggerGetContactDialer(_0x32ba('0x212'),_0xd7033d,_0x1507d0));}};Dialer[_0x32ba('0x1d')][_0x32ba('0x8d')]=function(_0x3c2e70){var _0x32de5b=this;if(_0x3c2e70[_0x32ba('0x20d')]>0x0){var _0x26e8a8=_0x3c2e70['dialLimitQueue']-_0x3c2e70[_0x32ba('0x70')]-_0x3c2e70[_0x32ba('0x9c')];if(_0x26e8a8>0x0){this['tryOriginatePredictive'](_0x3c2e70);}else{loggerPredictiveCalls[_0x32ba('0x7c')](_0x32ba('0x213'));}}else{this[_0x32ba('0x214')](_0x3c2e70);}};Dialer['prototype'][_0x32ba('0x214')]=function(_0x429684){var _0x35efc5=this;var _0x3603c3=[];_0x429684[_0x32ba('0x70')]+=0x1;for(var _0x40e5c1 in this[_0x32ba('0x23')]){if(this[_0x32ba('0x23')][_0x32ba('0xa8')](_0x40e5c1)){if(this[_0x32ba('0x23')][_0x40e5c1][_0x32ba('0xde')]==='not_inuse'&&this['agents'][_0x40e5c1][_0x32ba('0xac')]==='reachable'){_0x3603c3[_0x32ba('0x124')](this[_0x32ba('0x23')][_0x40e5c1]['id']);}}}this[_0x32ba('0x215')](_0x429684['id'],_0x3603c3,0x1,_0x429684['dialOrderByScheduledAt'])[_0x32ba('0xb4')](function(_0x5e29f9){if(!checkContactEmpty(_0x5e29f9)){checkContactLowerLimitOriginate(_0x429684,0x1,0x0);_0x35efc5[_0x32ba('0xb2')](_0x429684)[_0x32ba('0xb4')](sendMessageReschedule(_0x429684))[_0x32ba('0xad')](loggerCatch(_0x32ba('0xb5')));}else{_0x429684[_0x32ba('0x40')]='RUNNING';if(_[_0x32ba('0xaa')](_0x5e29f9[0x0])||_[_0x32ba('0xaa')](_0x5e29f9[0x0][_0x32ba('0x16a')])||_[_0x32ba('0xaa')](_0x5e29f9[0x0][_0x32ba('0x16a')][_0x32ba('0x18f')])){_0x35efc5[_0x32ba('0x20f')](_0x32ba('0x210'),_0x429684,_0x5e29f9[0x0]);}else{_0x35efc5[_0x32ba('0xb6')](_[_0x32ba('0x125')](_0x5e29f9[0x0],[_0x32ba('0xf6'),_0x32ba('0x211')]))[_0x32ba('0xb4')](_0x35efc5[_0x32ba('0x1f0')](_0x429684,_0x5e29f9[0x0]))[_0x32ba('0xad')](_0x35efc5[_0x32ba('0xc8')](_0x32ba('0x216'),_0x429684));}}})[_0x32ba('0xad')](loggerGetContactDialer(_0x32ba('0x217'),_0x429684,0x1));emitVoiceQueueSummary(_0x429684);};Dialer[_0x32ba('0x1d')][_0x32ba('0x1e3')]=function(_0xa609ba,_0x237900,_0x106f2e,_0xbe735,_0xbad37,_0x5c5ede){loggerPredictive[_0x32ba('0x7c')](_0x32ba('0x218'));loggerPredictive[_0x32ba('0x7c')](_0x32ba('0x219'),_0xa609ba);loggerPredictive[_0x32ba('0x7c')](_0x32ba('0x21a'),_0x237900);loggerPredictive[_0x32ba('0x7c')](_0x32ba('0x21b'),_0x106f2e);loggerPredictive[_0x32ba('0x7c')]('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',_0xbe735);loggerPredictive[_0x32ba('0x7c')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xbad37);loggerPredictive['info'](_0x32ba('0x8b'));return new BPromise(function(_0x14a47a,_0x4ad160){if(_0xa609ba<=0x0||isNaN(_0xa609ba)){return _0x4ad160(msgResponse(_0x32ba('0x21c'),_0x32ba('0x21d'),_0x32ba('0x21e')+_0xa609ba));}if(_0x106f2e<=0x0||isNaN(_0x106f2e)){return _0x4ad160(msgResponse(_0x32ba('0x21c'),'Error',_0x32ba('0x21f')+_0x106f2e));}if(_0xbe735<=0x0||isNaN(_0xbe735)){return _0x4ad160(msgResponse(_0x32ba('0x21c'),_0x32ba('0x21d'),_0x32ba('0x220')+_0xbe735));}if(_0x237900<=0x0||isNaN(_0x237900)){return _0x4ad160(msgResponse('[abandonmentRate]','Error','interval\x20=\x20'+_0x237900));}if(_0xbad37<=0x0||isNaN(_0xbad37)){return _0x4ad160(msgResponse(_0x32ba('0x21c'),'Error','Amax\x20=\x20'+_0xbad37));}_0x5c5ede=_0x5c5ede||0x0;var _0x4da63f=0x1/_0x106f2e;var _0x20535f=0x0;var _0x2e1c75=0x0;var _0x75c34b=0x0;var _0x4d0c00=0x0;for(var _0x1e8c53=0x0;_0x75c34b<_0xbad37;_0x1e8c53+=0x1){_0x2e1c75=_0x1e8c53/_0x237900;_0x20535f=(_0xbe735*_0x2e1c75+_0x5c5ede)/_0x4da63f;_0x75c34b=erlangb(_0x20535f,_0xa609ba);_0x4d0c00=_0x20535f/_0xa609ba*(0x1-erlangb(_0x20535f,_0xa609ba));}return _0x14a47a({'erlangCalls':_0x1e8c53,'erlangCallToSecond':_0x237900/_0x1e8c53,'erlangAbandonmentRate':_0x75c34b,'erlangBusyFactor':_0x4d0c00});});};Dialer[_0x32ba('0x1d')][_0x32ba('0x1eb')]=function(_0x2b1371,_0x6fdca2,_0x50ac27,_0x18df3b,_0xa7e21f,_0x33bee1){loggerPredictive[_0x32ba('0x7c')](_0x32ba('0x221'));loggerPredictive[_0x32ba('0x7c')](_0x32ba('0x219'),_0x2b1371);loggerPredictive[_0x32ba('0x7c')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x6fdca2);loggerPredictive[_0x32ba('0x7c')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x50ac27);loggerPredictive['info'](_0x32ba('0x222'),_0x18df3b);loggerPredictive['info'](_0x32ba('0x223'),_0xa7e21f);loggerPredictive['info'](_0x32ba('0x8b'));return new BPromise(function(_0x979bd2,_0x9421e4){if(_0x2b1371<=0x0||isNaN(_0x2b1371)){return _0x9421e4(msgResponse('[busyFactor]',_0x32ba('0x21d'),_0x32ba('0x21e')+_0x2b1371));}if(_0x50ac27<=0x0||isNaN(_0x50ac27)){return _0x9421e4(msgResponse(_0x32ba('0x224'),'Error',_0x32ba('0x21f')+_0x50ac27));}if(_0x18df3b<=0x0||isNaN(_0x18df3b)){return _0x9421e4(msgResponse(_0x32ba('0x224'),'Error','p\x20=\x20'+_0x18df3b));}if(_0x6fdca2<=0x0||isNaN(_0x6fdca2)){return _0x9421e4(msgResponse(_0x32ba('0x224'),'Error',_0x32ba('0x225')+_0x6fdca2));}if(_0xa7e21f<=0x0||isNaN(_0xa7e21f)){return _0x9421e4(msgResponse(_0x32ba('0x224'),_0x32ba('0x21d'),_0x32ba('0x226')+_0xa7e21f));}_0x33bee1=_0x33bee1||0x0;var _0x59bd1a=0x1/_0x50ac27;var _0xdf2b31=0x0;var _0x47be66=0x0;var _0x2c7fe4=0x0;var _0x584ee9=0x0;for(var _0x5e5cd5=0x0;_0x584ee9<_0xa7e21f;_0x5e5cd5+=0x1){_0x47be66=_0x5e5cd5/_0x6fdca2;_0xdf2b31=(_0x18df3b*_0x47be66+_0x33bee1)/_0x59bd1a;_0x2c7fe4=erlangb(_0xdf2b31,_0x2b1371);_0x584ee9=_0xdf2b31/_0x2b1371*(0x1-erlangb(_0xdf2b31,_0x2b1371));}return _0x979bd2({'erlangCalls':_0x5e5cd5,'erlangCallToSecond':_0x6fdca2/_0x5e5cd5,'erlangAbandonmentRate':_0x2c7fe4,'erlangBusyFactor':_0x584ee9});});};module[_0x32ba('0x227')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 8c141ff..cbf45c5 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 _0x5c0e=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype'];(function(_0x2c24d4,_0x2bad45){var _0x41936c=function(_0x41dac2){while(--_0x41dac2){_0x2c24d4['push'](_0x2c24d4['shift']());}};_0x41936c(++_0x2bad45);}(_0x5c0e,0xa0));var _0xe5c0=function(_0x2c7b86,_0x59ef3c){_0x2c7b86=_0x2c7b86-0x0;var _0x256735=_0x5c0e[_0x2c7b86];return _0x256735;};'use strict';var util=require(_0xe5c0('0x0'));var _=require('lodash');var moment=require(_0xe5c0('0x1'));function getSeconds(_0x3565db,_0x9cd5dd){var _0x8e1193=moment(_0x3565db)[_0xe5c0('0x2')](0x0);var _0x3acdae=moment(_0x9cd5dd)[_0xe5c0('0x2')](0x0);return _0x8e1193[_0xe5c0('0x3')](_0x3acdae,_0xe5c0('0x4'));}function QueueCallerAbandon(_0x3f169f,_0x5429b3){this[_0xe5c0('0x5')]=_0x3f169f[_0xe5c0('0x5')];this[_0xe5c0('0x6')]=_0x3f169f[_0xe5c0('0x6')];this[_0xe5c0('0x7')]=_0x3f169f['type']==='outbound'?_0xe5c0('0x8'):_0x3f169f[_0xe5c0('0x6')];this[_0xe5c0('0x9')]=_0x3f169f[_0xe5c0('0x9')];this[_0xe5c0('0xa')]=_0x3f169f['countcongestionretry'];this[_0xe5c0('0xb')]=_0x3f169f['countnoanswerretry'];this[_0xe5c0('0xc')]=_0x3f169f[_0xe5c0('0x9')]+_0x3f169f['countcongestionretry']+_0x3f169f[_0xe5c0('0xb')]+_0x3f169f[_0xe5c0('0xd')]+_0x3f169f['countdropretry']+_0x3f169f[_0xe5c0('0xe')]+_0x3f169f[_0xe5c0('0xf')]+_0x3f169f[_0xe5c0('0x10')];this[_0xe5c0('0xd')]=_0x3f169f[_0xe5c0('0xd')];this[_0xe5c0('0x11')]=_0x3f169f[_0xe5c0('0x11')];this[_0xe5c0('0xe')]=_0x3f169f[_0xe5c0('0xe')];this[_0xe5c0('0xf')]=_0x3f169f[_0xe5c0('0xf')];this[_0xe5c0('0x10')]=_0x3f169f['countagentrejectretry'];this[_0xe5c0('0x12')]=_0x5429b3[_0xe5c0('0x12')];this[_0xe5c0('0x13')]=_0x3f169f[_0xe5c0('0x14')];this[_0xe5c0('0x15')]=_0x3f169f[_0xe5c0('0x16')];this['starttime']=_0x3f169f[_0xe5c0('0x17')];this[_0xe5c0('0x18')]=_0x3f169f['responsetime'];this[_0xe5c0('0x19')]=_0x3f169f[_0xe5c0('0x19')];this[_0xe5c0('0x1a')]=this[_0xe5c0('0x19')];this['ringtime']=getSeconds(_0x3f169f[_0xe5c0('0x18')],_0x3f169f[_0xe5c0('0x17')]);this[_0xe5c0('0x1b')]=getSeconds(this[_0xe5c0('0x19')],_0x3f169f['responsetime']);this[_0xe5c0('0x1c')]=0x0;this[_0xe5c0('0x8')]=_0x5429b3[_0xe5c0('0x8')];this['membername']=_0x5429b3[_0xe5c0('0x1d')];this['reason']=_0x5429b3[_0xe5c0('0x1e')];this[_0xe5c0('0x1f')]=_0x3f169f[_0xe5c0('0x1f')];this[_0xe5c0('0x20')]=_0x3f169f['callbackuniqueid'];this['callbackat']=_0x3f169f[_0xe5c0('0x21')];this[_0xe5c0('0x22')]=_0x3f169f['recallme'];this[_0xe5c0('0x23')]=_0x3f169f['ContactId'];this[_0xe5c0('0x24')]=_0x3f169f[_0xe5c0('0x24')];this['UserId']=_0x3f169f[_0xe5c0('0x25')];this['VoiceQueueId']=_0x3f169f['VoiceQueueId'];this[_0xe5c0('0x26')]=_0x3f169f[_0xe5c0('0x26')];this[_0xe5c0('0x27')]=_0x3f169f['originatecalleridnum']||'';this[_0xe5c0('0x28')]=_0x3f169f[_0xe5c0('0x28')]||'';}module[_0xe5c0('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0xdc5a=['talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','moment','diff','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','droptime','endtime','ringtime','responsetime','holdtime'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0xdc5a,0x1ef));var _0xadc5=function(_0x486c14,_0x2f0aab){_0x486c14=_0x486c14-0x0;var _0x480806=_0xdc5a[_0x486c14];return _0x480806;};'use strict';var util=require(_0xadc5('0x0'));var _=require('lodash');var moment=require(_0xadc5('0x1'));function getSeconds(_0x5de465,_0x364e7d){var _0x138dae=moment(_0x5de465)['milliseconds'](0x0);var _0x2e9d28=moment(_0x364e7d)['milliseconds'](0x0);return _0x138dae[_0xadc5('0x2')](_0x2e9d28,'seconds');}function QueueCallerAbandon(_0x5d75fd,_0x11a4fd){this[_0xadc5('0x3')]=_0x5d75fd['scheduledat'];this[_0xadc5('0x4')]=_0x5d75fd[_0xadc5('0x4')];this[_0xadc5('0x5')]=_0x5d75fd[_0xadc5('0x4')]==='outbound'?_0xadc5('0x6'):_0x5d75fd[_0xadc5('0x4')];this[_0xadc5('0x7')]=_0x5d75fd[_0xadc5('0x7')];this[_0xadc5('0x8')]=_0x5d75fd['countcongestionretry'];this[_0xadc5('0x9')]=_0x5d75fd[_0xadc5('0x9')];this[_0xadc5('0xa')]=_0x5d75fd['countbusyretry']+_0x5d75fd['countcongestionretry']+_0x5d75fd[_0xadc5('0x9')]+_0x5d75fd[_0xadc5('0xb')]+_0x5d75fd[_0xadc5('0xc')]+_0x5d75fd[_0xadc5('0xd')]+_0x5d75fd[_0xadc5('0xe')]+_0x5d75fd[_0xadc5('0xf')];this[_0xadc5('0xb')]=_0x5d75fd['countnosuchnumberretry'];this['countdropretry']=_0x5d75fd['countdropretry'];this[_0xadc5('0xd')]=_0x5d75fd[_0xadc5('0xd')];this[_0xadc5('0xe')]=_0x5d75fd[_0xadc5('0xe')];this[_0xadc5('0xf')]=_0x5d75fd[_0xadc5('0xf')];this[_0xadc5('0x10')]=_0x11a4fd[_0xadc5('0x10')];this[_0xadc5('0x11')]=_0x5d75fd['name'];this['calleridnum']=_0x5d75fd[_0xadc5('0x12')];this[_0xadc5('0x13')]=_0x5d75fd[_0xadc5('0x13')];this['responsetime']=_0x5d75fd['responsetime'];this[_0xadc5('0x14')]=_0x5d75fd[_0xadc5('0x14')];this[_0xadc5('0x15')]=this[_0xadc5('0x14')];this[_0xadc5('0x16')]=getSeconds(_0x5d75fd[_0xadc5('0x17')],_0x5d75fd['starttime']);this[_0xadc5('0x18')]=getSeconds(this['droptime'],_0x5d75fd[_0xadc5('0x17')]);this[_0xadc5('0x19')]=0x0;this[_0xadc5('0x6')]=_0x11a4fd['queue'];this[_0xadc5('0x1a')]=_0x11a4fd[_0xadc5('0x1b')];this[_0xadc5('0x1c')]=_0x11a4fd[_0xadc5('0x1c')];this[_0xadc5('0x1d')]=_0x5d75fd[_0xadc5('0x1d')];this[_0xadc5('0x1e')]=_0x5d75fd[_0xadc5('0x1e')];this[_0xadc5('0x1f')]=_0x5d75fd[_0xadc5('0x1f')];this[_0xadc5('0x20')]=_0x5d75fd['recallme'];this['ContactId']=_0x5d75fd[_0xadc5('0x21')];this[_0xadc5('0x22')]=_0x5d75fd[_0xadc5('0x22')];this[_0xadc5('0x23')]=_0x5d75fd[_0xadc5('0x23')];this[_0xadc5('0x24')]=_0x5d75fd[_0xadc5('0x24')];this[_0xadc5('0x25')]=_0x5d75fd[_0xadc5('0x25')];this[_0xadc5('0x26')]=_0x5d75fd[_0xadc5('0x26')]||'';this['originatecalleridname']=_0x5d75fd['originatecalleridname']||'';}module[_0xadc5('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 8a3f37d..d5bbae9 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 _0x1961=['AttachmentId','exports','util','lodash','moment','uniqueid','channel','%s/%s/%s','tech','Trunk','name','fax','localstationid','headerinfo','path'];(function(_0x2ec34e,_0xecf11f){var _0x2526e9=function(_0x34bd17){while(--_0x34bd17){_0x2ec34e['push'](_0x2ec34e['shift']());}};_0x2526e9(++_0xecf11f);}(_0x1961,0x89));var _0x1196=function(_0x1a9e15,_0x586b52){_0x1a9e15=_0x1a9e15-0x0;var _0x5d3d0a=_0x1961[_0x1a9e15];return _0x5d3d0a;};'use strict';var util=require(_0x1196('0x0'));var _=require(_0x1196('0x1'));var moment=require(_0x1196('0x2'));function Action(_0x3b593b,_0x561ceb,_0x5c0998){this[_0x1196('0x3')]=_0x3b593b||undefined;this[_0x1196('0x4')]=util['format'](_0x1196('0x5'),_0x561ceb[_0x1196('0x6')],_0x561ceb[_0x1196('0x7')][_0x1196('0x8')],_0x5c0998[_0x1196('0x9')]);this[_0x1196('0xa')]=_0x561ceb[_0x1196('0xa')];this[_0x1196('0xb')]=_0x561ceb['headerinfo'];this[_0x1196('0xc')]=_0x5c0998[_0x1196('0xc')];this[_0x1196('0xd')]=_0x5c0998[_0x1196('0xd')];}module[_0x1196('0xe')]=Action; \ No newline at end of file +var _0x872e=['util','moment','channel','format','tech','Trunk','fax','localstationid','headerinfo','path','AttachmentId','exports'];(function(_0x426b63,_0x3b4c07){var _0x1adcc0=function(_0x638c80){while(--_0x638c80){_0x426b63['push'](_0x426b63['shift']());}};_0x1adcc0(++_0x3b4c07);}(_0x872e,0x78));var _0xe872=function(_0x5326de,_0x5491ed){_0x5326de=_0x5326de-0x0;var _0x4c7bef=_0x872e[_0x5326de];return _0x4c7bef;};'use strict';var util=require(_0xe872('0x0'));var _=require('lodash');var moment=require(_0xe872('0x1'));function Action(_0x3b468a,_0x4431f2,_0x28ed71){this['uniqueid']=_0x3b468a||undefined;this[_0xe872('0x2')]=util[_0xe872('0x3')]('%s/%s/%s',_0x4431f2[_0xe872('0x4')],_0x4431f2[_0xe872('0x5')]['name'],_0x28ed71[_0xe872('0x6')]);this['localstationid']=_0x4431f2[_0xe872('0x7')];this[_0xe872('0x8')]=_0x4431f2[_0xe872('0x8')];this[_0xe872('0x9')]=_0x28ed71['path'];this[_0xe872('0xa')]=_0x28ed71[_0xe872('0xa')];}module[_0xe872('0xb')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index a6201ad..f2c662d 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 _0x7211=['varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','channelstate','channelstatedesc','value','operation','status','localstationid','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','.pdf','application/pdf','then','notify','parse','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','response','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','isNil','active','trunks','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','actions','newchannel','syncNewchannel','bind'];(function(_0x10673d,_0x4c5105){var _0x4bfe43=function(_0x18656b){while(--_0x18656b){_0x10673d['push'](_0x10673d['shift']());}};_0x4bfe43(++_0x4c5105);}(_0x7211,0x165));var _0x1721=function(_0x19c13a,_0x246fae){_0x19c13a=_0x19c13a-0x0;var _0x558a0e=_0x7211[_0x19c13a];return _0x558a0e;};'use strict';var util=require(_0x1721('0x0'));var _=require(_0x1721('0x1'));var BPromise=require(_0x1721('0x2'));var uuid=require(_0x1721('0x3'));var moment=require(_0x1721('0x4'));var path=require(_0x1721('0x5'));var tiff2pdf=require(_0x1721('0x6'));var gs=require(_0x1721('0x7'));var logger=require(_0x1721('0x8'))(_0x1721('0x9'));var ami=require(_0x1721('0xa'));var rpcDb=require(_0x1721('0xb'));var Channel=require(_0x1721('0xc'));var ut=require(_0x1721('0xd'));var Action=require(_0x1721('0xe'));var faxAccount=require(_0x1721('0xf'));var attachment=require(_0x1721('0x10'));var faxMessage=require(_0x1721('0x11'));function Fax(_0x4f5b00){this[_0x1721('0x12')]={};this['faxAccounts']=_0x4f5b00[_0x1721('0x13')];this['trunks']=_0x4f5b00['trunks'];this[_0x1721('0x14')]={};ami['on'](_0x1721('0x15'),this[_0x1721('0x16')][_0x1721('0x17')](this));ami['on'](_0x1721('0x18'),this[_0x1721('0x19')][_0x1721('0x17')](this));ami['on'](_0x1721('0x1a'),this[_0x1721('0x1b')][_0x1721('0x17')](this));ami['on'](_0x1721('0x1c'),this[_0x1721('0x1d')][_0x1721('0x17')](this));ami['on'](_0x1721('0x1e'),this[_0x1721('0x1f')]['bind'](this));ami['on'](_0x1721('0x20'),this['syncReceiveFax']['bind'](this));ami['on'](_0x1721('0x21'),this[_0x1721('0x22')][_0x1721('0x17')](this));ami['on']('originateresponse',this[_0x1721('0x23')]['bind'](this));}Fax['prototype'][_0x1721('0x16')]=function(_0x278521){if(_0x278521[_0x1721('0x24')]===_0x1721('0x25')){for(var _0x5500cc in this[_0x1721('0x13')]){if(this[_0x1721('0x13')][_0x1721('0x26')](_0x5500cc)){if(_0x278521['exten']===this[_0x1721('0x13')][_0x5500cc]['localstationid']){this[_0x1721('0x12')][_0x278521['uniqueid']]={};this[_0x1721('0x12')][_0x278521[_0x1721('0x27')]][_0x1721('0x28')]=_0x278521['channel'];this[_0x1721('0x12')][_0x278521['uniqueid']]['id']=this[_0x1721('0x13')][_0x5500cc]['id'];this[_0x1721('0x12')][_0x278521['uniqueid']]['name']=this[_0x1721('0x13')][_0x5500cc][_0x1721('0x29')];logger[_0x1721('0x2a')](_0x278521[_0x1721('0x27')],_0x1721('0x2b'));}}}}if(this[_0x1721('0x14')][_0x278521['uniqueid']]){this[_0x1721('0x12')][_0x278521[_0x1721('0x27')]]={};this['channels'][_0x278521[_0x1721('0x27')]][_0x1721('0x28')]=_0x278521[_0x1721('0x28')];logger[_0x1721('0x2a')](_0x278521[_0x1721('0x27')],_0x1721('0x2b'));}};Fax[_0x1721('0x2c')][_0x1721('0x19')]=function(_0x6de356){if(this[_0x1721('0x12')][_0x6de356['uniqueid']]){for(var _0x1d11e1 in _0x6de356[_0x1721('0x2d')]){if(_0x6de356[_0x1721('0x2d')]['hasOwnProperty'](_0x1d11e1)){this[_0x1721('0x12')][_0x6de356[_0x1721('0x27')]][_0x1d11e1]=_0x6de356['value'];}}}};Fax['prototype'][_0x1721('0x1b')]=function(_0x4901df){if(this[_0x1721('0x12')][_0x4901df[_0x1721('0x27')]]){this['channels'][_0x4901df[_0x1721('0x27')]][_0x1721('0x2e')]=_0x4901df[_0x1721('0x2e')];this['channels'][_0x4901df['uniqueid']][_0x1721('0x2f')]=_0x4901df['channelstatedesc'];}};Fax['prototype'][_0x1721('0x1d')]=function(_0x2b58b1){if(this[_0x1721('0x12')][_0x2b58b1[_0x1721('0x27')]]){for(var _0xe8b783 in _0x2b58b1['variable']){if(_0x2b58b1[_0x1721('0x2d')][_0x1721('0x26')](_0xe8b783)){this[_0x1721('0x12')][_0x2b58b1[_0x1721('0x27')]][_0xe8b783]=_0x2b58b1[_0x1721('0x30')];}}}};Fax['prototype'][_0x1721('0x1f')]=function(_0x4c609c){if(this[_0x1721('0x12')][_0x4c609c[_0x1721('0x27')]]){this[_0x1721('0x12')][_0x4c609c[_0x1721('0x27')]]['operation']=_0x4c609c[_0x1721('0x31')];this[_0x1721('0x12')][_0x4c609c[_0x1721('0x27')]][_0x1721('0x32')]=_0x4c609c['status'];this[_0x1721('0x12')][_0x4c609c[_0x1721('0x27')]][_0x1721('0x33')]=_0x4c609c[_0x1721('0x33')];this['channels'][_0x4c609c[_0x1721('0x27')]][_0x1721('0x34')]=_0x4c609c[_0x1721('0x34')];logger[_0x1721('0x2a')](_0x4c609c[_0x1721('0x27')],'\x20syncFaxStatus\x20');}};Fax[_0x1721('0x2c')][_0x1721('0x35')]=function(_0x4894b7){var _0x3f0ced=this;if(this[_0x1721('0x12')][_0x4894b7[_0x1721('0x27')]]){var _0x34f414=this['channels'][_0x4894b7[_0x1721('0x27')]]['id'];this[_0x1721('0x12')][_0x4894b7['uniqueid']][_0x1721('0x36')]=_0x4894b7['remotestationid'];this[_0x1721('0x12')][_0x4894b7['uniqueid']][_0x1721('0x37')]=_0x4894b7[_0x1721('0x37')];this[_0x1721('0x12')][_0x4894b7[_0x1721('0x27')]][_0x1721('0x33')]=_0x4894b7[_0x1721('0x33')];this[_0x1721('0x12')][_0x4894b7['uniqueid']][_0x1721('0x38')]=_0x4894b7[_0x1721('0x38')];this[_0x1721('0x12')][_0x4894b7[_0x1721('0x27')]][_0x1721('0x39')]=_0x4894b7[_0x1721('0x39')];this[_0x1721('0x12')][_0x4894b7[_0x1721('0x27')]]['filename']=_0x4894b7[_0x1721('0x34')];this[_0x1721('0x12')][_0x4894b7[_0x1721('0x27')]][_0x1721('0x3a')]=_0x4894b7[_0x1721('0x3a')];if(this[_0x1721('0x12')][_0x4894b7[_0x1721('0x27')]][_0x1721('0x37')]>0x0){tiff2pdf(_0x4894b7[_0x1721('0x34')],_0x1721('0x3b'),function(_0x13b896){logger[_0x1721('0x2a')](_0x4894b7[_0x1721('0x27')],_0x1721('0x3c'),_0x13b896[_0x1721('0x3d')]);attachment[_0x1721('0x3e')]({'name':path['parse'](_0x4894b7['filename'])[_0x1721('0x29')],'basename':path['parse'](_0x4894b7['filename'])[_0x1721('0x29')]+_0x1721('0x3f'),'type':_0x1721('0x40')})[_0x1721('0x41')](function(_0x459b58){faxAccount[_0x1721('0x42')](_0x34f414,{'from':_0x4894b7['calleridnum'],'mapKey':'fax','body':path[_0x1721('0x43')](_0x4894b7['filename'])[_0x1721('0x29')]+'.pdf','AttachmentId':_0x459b58['id']})[_0x1721('0x44')](function(_0xf647eb){logger[_0x1721('0x45')](_0x4894b7[_0x1721('0x27')],_0x1721('0x46'),JSON[_0x1721('0x47')](_0xf647eb));});})[_0x1721('0x44')](function(_0x4af893){logger[_0x1721('0x45')](_0x4894b7['uniqueid'],_0x1721('0x48'),JSON[_0x1721('0x47')](_0x4af893));});});}logger['info'](_0x4894b7[_0x1721('0x27')],_0x1721('0x48'));}};Fax[_0x1721('0x2c')][_0x1721('0x23')]=function(_0x48745f){if(this[_0x1721('0x14')][_0x48745f[_0x1721('0x27')]]){_[_0x1721('0x49')](this[_0x1721('0x12')][_0x48745f[_0x1721('0x27')]],_['pick'](_0x48745f,[_0x1721('0x4a'),'reason']));}};function updateStatus(_0x36bd0c){if(_0x36bd0c[_0x1721('0x4b')]){faxMessage[_0x1721('0x4c')](_0x36bd0c[_0x1721('0x4b')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x28573e){ut[_0x1721('0x4d')]('[Fax][Message][Error][Updated]',_0x28573e);})[_0x1721('0x44')](function(_0x47a0fa){ut['logger'](_0x1721('0x4e'),_0x47a0fa);});}else{ut[_0x1721('0x4d')](_0x1721('0x4f'));}}Fax[_0x1721('0x2c')][_0x1721('0x50')]=function(_0x3610a2,_0x126058,_0x4c318e){var _0x192a13=this;var _0x302a4f={};if(_0x126058){_0x302a4f={'read':_0x126058};}else{_0x302a4f={'failMessage':_0x4c318e};}if(this['actions'][_0x3610a2][_0x1721('0x4b')]){faxMessage[_0x1721('0x4c')](this[_0x1721('0x14')][_0x3610a2][_0x1721('0x4b')],_0x302a4f)['then'](function(_0x4e4196){ut[_0x1721('0x4d')](_0x1721('0x51'),_0x4e4196);})[_0x1721('0x44')](function(_0x951d93){ut[_0x1721('0x4d')](_0x1721('0x52'),_0x951d93);})[_0x1721('0x53')](function(){delete _0x192a13[_0x1721('0x12')][_0x3610a2];delete _0x192a13['actions'][_0x3610a2];});}else{ut[_0x1721('0x4d')](_0x1721('0x54'));delete this['channels'][_0x3610a2];delete this[_0x1721('0x14')][_0x3610a2];}};Fax[_0x1721('0x2c')]['syncHangup']=function(_0x5b49a3){var _0x3b233d=this;if(this[_0x1721('0x12')][_0x5b49a3[_0x1721('0x27')]]){if(this[_0x1721('0x14')][_0x5b49a3[_0x1721('0x27')]]){this[_0x1721('0x12')][_0x5b49a3[_0x1721('0x27')]]['id']=this[_0x1721('0x14')][_0x5b49a3['uniqueid']]['id'];this[_0x1721('0x12')][_0x5b49a3[_0x1721('0x27')]][_0x1721('0x29')]=this['actions'][_0x5b49a3['uniqueid']][_0x1721('0x29')];}logger['info'](_0x5b49a3[_0x1721('0x27')],this[_0x1721('0x14')][_0x5b49a3[_0x1721('0x27')]]?_0x1721('0x55'):'\x20hangup\x20faxRiceive\x20',JSON[_0x1721('0x47')](this[_0x1721('0x12')][_0x5b49a3[_0x1721('0x27')]]));if(this[_0x1721('0x14')][_0x5b49a3[_0x1721('0x27')]]){if(this[_0x1721('0x12')][_0x5b49a3[_0x1721('0x27')]][_0x1721('0x56')]>0x0&&this[_0x1721('0x12')][_0x5b49a3[_0x1721('0x27')]][_0x1721('0x1e')]===_0x1721('0x57')){this[_0x1721('0x50')](_0x5b49a3[_0x1721('0x27')],!![]);}else{this[_0x1721('0x50')](_0x5b49a3[_0x1721('0x27')],![],this[_0x1721('0x12')][_0x5b49a3['uniqueid']][_0x1721('0x58')]?_0x1721('0x59')+this['channels'][_0x5b49a3[_0x1721('0x27')]]['faxstatusstring']:_0x1721('0x5a'));}}}};Fax[_0x1721('0x2c')]['send']=function(_0x13e405){var _0x500917=this;return new BPromise(function(_0x5b1673,_0x144344){_0x500917[_0x1721('0x5b')](_0x13e405,_0x500917[_0x1721('0x13')][_0x13e405[_0x1721('0x5c')]])[_0x1721('0x41')](function(_0x4e5f03){ut[_0x1721('0x4d')](_0x1721('0x5d'),_0x4e5f03);_0x5b1673(ut[_0x1721('0x3d')](_0x1721('0x5e')));})[_0x1721('0x44')](function(_0x362321){ut[_0x1721('0x4d')](_0x1721('0x5f'),_0x362321);updateStatus(_0x13e405);_0x144344(ut['message'](_0x1721('0x60')));});});};Fax['prototype'][_0x1721('0x61')]=function(_0x594e62){var _0x1f852d=this;return new BPromise(function(_0x128507,_0x2f6afa){var _0x4013f5=_0x1f852d[_0x1721('0x62')](_0x1f852d['faxAccounts'][_0x594e62['FaxAccountId']][_0x1721('0x63')],_0x594e62);if(_0x4013f5[_0x1721('0x64')]){_0x128507(ut[_0x1721('0x3d')](_0x1721('0x65')));}else{_0x2f6afa(ut[_0x1721('0x3d')](_0x4013f5[_0x1721('0x3d')]));}});};function originate(_0x666db,_0x2386df,_0x5d06c0){return new BPromise(function(_0x447330,_0x39b1f8){if(_0x5d06c0){var _0x20aada=util[_0x1721('0x66')](_0x1721('0x67'),path['parse'](_0x666db['path'])[_0x1721('0x29')],_0x666db[_0x1721('0x5')]);gs[_0x1721('0x68')](_0x20aada)['then'](function(){_0x666db['path']=util['format'](_0x1721('0x69'),path[_0x1721('0x43')](_0x666db[_0x1721('0x5')])[_0x1721('0x6a')],path['parse'](_0x666db[_0x1721('0x5')])['name']);_0x2386df[_0x1721('0x6b')]=_0x666db[_0x1721('0x5')];ut[_0x1721('0x4d')](_0x1721('0x6c'),'');ami['Action'](ut[_0x1721('0x6d')](_0x666db,_0x2386df))[_0x1721('0x41')](function(_0x45528e){_0x447330(_0x45528e);})[_0x1721('0x44')](function(_0x10966e){_0x39b1f8(_0x10966e);});})[_0x1721('0x44')](function(_0x41264c){_0x39b1f8(_0x41264c);});}else{ami[_0x1721('0x6e')](ut[_0x1721('0x6d')](_0x666db,_0x2386df))[_0x1721('0x41')](function(_0x16f200){_0x447330(_0x16f200);})['catch'](function(_0x9d1f8){_0x39b1f8(_0x9d1f8);});}});}Fax['prototype'][_0x1721('0x5b')]=function(_0x229af4,_0x435daa){var _0xb1b8e2=this;return new BPromise(function(_0x59fcef,_0xd7e94f){var _0x48a5dd=uuid['v4']();var _0x5511ef=ut[_0x1721('0x6f')](_0x229af4,_0x435daa);_0xb1b8e2[_0x1721('0x14')][_0x48a5dd]=new Action(_0x48a5dd,_0x435daa,_0x229af4);var _0x2ad092=_0xb1b8e2[_0x1721('0x14')][_0x48a5dd];if(path['parse'](_0x229af4[_0x1721('0x5')])['ext']===_0x1721('0x3f')){originate(_0x2ad092,_0x5511ef,!![])[_0x1721('0x41')](function(_0x11bbea){_0x59fcef(_0x11bbea);})[_0x1721('0x44')](function(_0x2d1c80){_0xd7e94f(_0x2d1c80);});}else{originate(_0x2ad092,_0x5511ef,![])[_0x1721('0x41')](function(_0x4f1210){_0x59fcef(_0x4f1210);})[_0x1721('0x44')](function(_0x2fcf40){_0xd7e94f(_0x2fcf40);});}});};Fax[_0x1721('0x2c')]['isTrunkReachable']=function(_0x119266){return!_[_0x1721('0x70')](_0x119266)&&!_['isNil'](_0x119266[_0x1721('0x29')])&&!_[_0x1721('0x70')](_0x119266[_0x1721('0x71')])&&_0x119266[_0x1721('0x71')]&&!_[_0x1721('0x70')](this[_0x1721('0x72')][util[_0x1721('0x66')]('SIP/%s',_0x119266['name'])])&&!_[_0x1721('0x70')](this[_0x1721('0x72')][util[_0x1721('0x66')](_0x1721('0x73'),_0x119266[_0x1721('0x29')])][_0x1721('0x32')])&&(this[_0x1721('0x72')][util[_0x1721('0x66')]('SIP/%s',_0x119266[_0x1721('0x29')])]['status']===_0x1721('0x74')||this['trunks'][util[_0x1721('0x66')](_0x1721('0x73'),_0x119266[_0x1721('0x29')])][_0x1721('0x32')]===_0x1721('0x75'));};Fax['prototype'][_0x1721('0x62')]=function(_0x305242,_0x3bc671){if(!this[_0x1721('0x76')](_0x305242)){ut[_0x1721('0x4d')](_0x1721('0x77'),_[_0x1721('0x70')](_0x305242)?'':_0x305242['name']+_0x1721('0x78'));return{'isValid':![],'message':_0x1721('0x79')};}if(_[_0x1721('0x70')](_0x3bc671[_0x1721('0x9')])){ut['logger'](_0x1721('0x7a'),JSON[_0x1721('0x47')](_0x3bc671));return{'isValid':![],'message':_0x1721('0x7b')};}if(_['isNil'](_0x3bc671[_0x1721('0x5')])){ut[_0x1721('0x4d')](_0x1721('0x7c'),JSON[_0x1721('0x47')](_0x3bc671));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x1721('0x7d')};};module[_0x1721('0x7e')]=Fax; \ No newline at end of file +var _0xed5f=['[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','send','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','FaxAccountId','Trunk\x20Reachable','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','execOriginate','ext','isNil','SIP/%s','status','unmonitored','checkTrunk','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','prototype','variable','value','syncNewState','channelstate','channelstatedesc','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','notify','error','stringify','catch','\x20receiveFax\x20','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]'];(function(_0x3b12d3,_0x4dcab2){var _0xf32064=function(_0x597b4b){while(--_0x597b4b){_0x3b12d3['push'](_0x3b12d3['shift']());}};_0xf32064(++_0x4dcab2);}(_0xed5f,0x106));var _0xfed5=function(_0x4677da,_0x302ee0){_0x4677da=_0x4677da-0x0;var _0x1ca977=_0xed5f[_0x4677da];return _0x1ca977;};'use strict';var util=require(_0xfed5('0x0'));var _=require(_0xfed5('0x1'));var BPromise=require(_0xfed5('0x2'));var uuid=require('uuid');var moment=require(_0xfed5('0x3'));var path=require(_0xfed5('0x4'));var tiff2pdf=require(_0xfed5('0x5'));var gs=require(_0xfed5('0x6'));var logger=require(_0xfed5('0x7'))(_0xfed5('0x8'));var ami=require(_0xfed5('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0xfed5('0xa'));var ut=require('./util/util');var Action=require(_0xfed5('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xfed5('0xc'));var faxMessage=require(_0xfed5('0xd'));function Fax(_0x5ae0d1){this[_0xfed5('0xe')]={};this[_0xfed5('0xf')]=_0x5ae0d1['faxAccounts'];this[_0xfed5('0x10')]=_0x5ae0d1[_0xfed5('0x10')];this['actions']={};ami['on'](_0xfed5('0x11'),this[_0xfed5('0x12')][_0xfed5('0x13')](this));ami['on'](_0xfed5('0x14'),this[_0xfed5('0x15')][_0xfed5('0x13')](this));ami['on'](_0xfed5('0x16'),this['syncNewState'][_0xfed5('0x13')](this));ami['on'](_0xfed5('0x17'),this[_0xfed5('0x18')]['bind'](this));ami['on'](_0xfed5('0x19'),this[_0xfed5('0x1a')]['bind'](this));ami['on'](_0xfed5('0x1b'),this[_0xfed5('0x1c')]['bind'](this));ami['on'](_0xfed5('0x1d'),this[_0xfed5('0x1e')][_0xfed5('0x13')](this));ami['on']('originateresponse',this[_0xfed5('0x1f')]['bind'](this));}Fax['prototype'][_0xfed5('0x12')]=function(_0x3bb295){if(_0x3bb295['context']===_0xfed5('0x20')){for(var _0x50adad in this[_0xfed5('0xf')]){if(this[_0xfed5('0xf')][_0xfed5('0x21')](_0x50adad)){if(_0x3bb295['exten']===this['faxAccounts'][_0x50adad][_0xfed5('0x22')]){this['channels'][_0x3bb295['uniqueid']]={};this[_0xfed5('0xe')][_0x3bb295[_0xfed5('0x23')]]['channel']=_0x3bb295[_0xfed5('0x24')];this[_0xfed5('0xe')][_0x3bb295[_0xfed5('0x23')]]['id']=this[_0xfed5('0xf')][_0x50adad]['id'];this['channels'][_0x3bb295['uniqueid']]['name']=this[_0xfed5('0xf')][_0x50adad][_0xfed5('0x25')];logger[_0xfed5('0x26')](_0x3bb295[_0xfed5('0x23')],_0xfed5('0x27'));}}}}if(this[_0xfed5('0x28')][_0x3bb295[_0xfed5('0x23')]]){this[_0xfed5('0xe')][_0x3bb295['uniqueid']]={};this[_0xfed5('0xe')][_0x3bb295[_0xfed5('0x23')]][_0xfed5('0x24')]=_0x3bb295[_0xfed5('0x24')];logger[_0xfed5('0x26')](_0x3bb295[_0xfed5('0x23')],_0xfed5('0x27'));}};Fax[_0xfed5('0x29')][_0xfed5('0x15')]=function(_0x4fa0a3){if(this[_0xfed5('0xe')][_0x4fa0a3[_0xfed5('0x23')]]){for(var _0x12c688 in _0x4fa0a3[_0xfed5('0x2a')]){if(_0x4fa0a3['variable'][_0xfed5('0x21')](_0x12c688)){this[_0xfed5('0xe')][_0x4fa0a3[_0xfed5('0x23')]][_0x12c688]=_0x4fa0a3[_0xfed5('0x2b')];}}}};Fax[_0xfed5('0x29')][_0xfed5('0x2c')]=function(_0x4ae190){if(this[_0xfed5('0xe')][_0x4ae190[_0xfed5('0x23')]]){this[_0xfed5('0xe')][_0x4ae190[_0xfed5('0x23')]][_0xfed5('0x2d')]=_0x4ae190['channelstate'];this[_0xfed5('0xe')][_0x4ae190[_0xfed5('0x23')]][_0xfed5('0x2e')]=_0x4ae190[_0xfed5('0x2e')];}};Fax[_0xfed5('0x29')][_0xfed5('0x18')]=function(_0xd9c740){if(this['channels'][_0xd9c740['uniqueid']]){for(var _0x61c1e5 in _0xd9c740[_0xfed5('0x2a')]){if(_0xd9c740[_0xfed5('0x2a')][_0xfed5('0x21')](_0x61c1e5)){this[_0xfed5('0xe')][_0xd9c740['uniqueid']][_0x61c1e5]=_0xd9c740['value'];}}}};Fax[_0xfed5('0x29')]['syncFaxStatus']=function(_0x43e595){if(this[_0xfed5('0xe')][_0x43e595[_0xfed5('0x23')]]){this[_0xfed5('0xe')][_0x43e595[_0xfed5('0x23')]]['operation']=_0x43e595['operation'];this[_0xfed5('0xe')][_0x43e595['uniqueid']]['status']=_0x43e595['status'];this[_0xfed5('0xe')][_0x43e595[_0xfed5('0x23')]][_0xfed5('0x22')]=_0x43e595[_0xfed5('0x22')];this[_0xfed5('0xe')][_0x43e595['uniqueid']][_0xfed5('0x2f')]=_0x43e595[_0xfed5('0x2f')];logger[_0xfed5('0x26')](_0x43e595['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0xfed5('0x29')][_0xfed5('0x1c')]=function(_0x542a79){var _0xedcf0e=this;if(this['channels'][_0x542a79[_0xfed5('0x23')]]){var _0x108111=this['channels'][_0x542a79[_0xfed5('0x23')]]['id'];this['channels'][_0x542a79['uniqueid']][_0xfed5('0x30')]=_0x542a79['remotestationid'];this['channels'][_0x542a79['uniqueid']][_0xfed5('0x31')]=_0x542a79[_0xfed5('0x31')];this[_0xfed5('0xe')][_0x542a79[_0xfed5('0x23')]][_0xfed5('0x22')]=_0x542a79[_0xfed5('0x22')];this[_0xfed5('0xe')][_0x542a79['uniqueid']][_0xfed5('0x32')]=_0x542a79[_0xfed5('0x32')];this[_0xfed5('0xe')][_0x542a79[_0xfed5('0x23')]][_0xfed5('0x33')]=_0x542a79['transferrate'];this[_0xfed5('0xe')][_0x542a79[_0xfed5('0x23')]][_0xfed5('0x2f')]=_0x542a79[_0xfed5('0x2f')];this['channels'][_0x542a79[_0xfed5('0x23')]][_0xfed5('0x34')]=_0x542a79[_0xfed5('0x34')];if(this[_0xfed5('0xe')][_0x542a79[_0xfed5('0x23')]][_0xfed5('0x31')]>0x0){tiff2pdf(_0x542a79[_0xfed5('0x2f')],_0xfed5('0x35'),function(_0x4b6013){logger[_0xfed5('0x26')](_0x542a79[_0xfed5('0x23')],_0xfed5('0x36'),_0x4b6013[_0xfed5('0x37')]);attachment['create']({'name':path[_0xfed5('0x38')](_0x542a79['filename'])[_0xfed5('0x25')],'basename':path[_0xfed5('0x38')](_0x542a79[_0xfed5('0x2f')])[_0xfed5('0x25')]+_0xfed5('0x39'),'type':_0xfed5('0x3a')})['then'](function(_0x376acc){faxAccount[_0xfed5('0x3b')](_0x108111,{'from':_0x542a79['calleridnum'],'mapKey':_0xfed5('0x8'),'body':path[_0xfed5('0x38')](_0x542a79[_0xfed5('0x2f')])['name']+'.pdf','AttachmentId':_0x376acc['id']})['catch'](function(_0x4c0da2){logger[_0xfed5('0x3c')](_0x542a79[_0xfed5('0x23')],'\x20notify\x20',JSON[_0xfed5('0x3d')](_0x4c0da2));});})[_0xfed5('0x3e')](function(_0x3d9ab5){logger[_0xfed5('0x3c')](_0x542a79[_0xfed5('0x23')],'\x20receiveFax\x20',JSON['stringify'](_0x3d9ab5));});});}logger[_0xfed5('0x26')](_0x542a79[_0xfed5('0x23')],_0xfed5('0x3f'));}};Fax[_0xfed5('0x29')][_0xfed5('0x1f')]=function(_0x4a0e39){if(this['actions'][_0x4a0e39[_0xfed5('0x23')]]){_[_0xfed5('0x40')](this[_0xfed5('0xe')][_0x4a0e39['uniqueid']],_[_0xfed5('0x41')](_0x4a0e39,[_0xfed5('0x42'),'reason']));}};function updateStatus(_0x3ba3c5){if(_0x3ba3c5[_0xfed5('0x43')]){faxMessage[_0xfed5('0x44')](_0x3ba3c5[_0xfed5('0x43')],{'failMessage':_0xfed5('0x45')})[_0xfed5('0x46')](function(_0x1cec82){ut['logger'](_0xfed5('0x47'),_0x1cec82);})[_0xfed5('0x3e')](function(_0x5b42f1){ut[_0xfed5('0x48')](_0xfed5('0x49'),_0x5b42f1);});}else{ut['logger'](_0xfed5('0x4a'));}}Fax[_0xfed5('0x29')][_0xfed5('0x4b')]=function(_0x4e8b3c,_0x40cd3c,_0x257af1){var _0x24eaf5=this;var _0x430a9c={};if(_0x40cd3c){_0x430a9c={'read':_0x40cd3c};}else{_0x430a9c={'failMessage':_0x257af1};}if(this[_0xfed5('0x28')][_0x4e8b3c][_0xfed5('0x43')]){faxMessage[_0xfed5('0x44')](this[_0xfed5('0x28')][_0x4e8b3c][_0xfed5('0x43')],_0x430a9c)['then'](function(_0x54037a){ut[_0xfed5('0x48')](_0xfed5('0x4c'),_0x54037a);})['catch'](function(_0xb9a6cb){ut['logger'](_0xfed5('0x4d'),_0xb9a6cb);})['finally'](function(){delete _0x24eaf5[_0xfed5('0xe')][_0x4e8b3c];delete _0x24eaf5[_0xfed5('0x28')][_0x4e8b3c];});}else{ut[_0xfed5('0x48')](_0xfed5('0x4e'));delete this['channels'][_0x4e8b3c];delete this[_0xfed5('0x28')][_0x4e8b3c];}};Fax[_0xfed5('0x29')][_0xfed5('0x1e')]=function(_0x1f67ba){var _0x5cc8f1=this;if(this[_0xfed5('0xe')][_0x1f67ba[_0xfed5('0x23')]]){if(this[_0xfed5('0x28')][_0x1f67ba[_0xfed5('0x23')]]){this[_0xfed5('0xe')][_0x1f67ba[_0xfed5('0x23')]]['id']=this[_0xfed5('0x28')][_0x1f67ba[_0xfed5('0x23')]]['id'];this[_0xfed5('0xe')][_0x1f67ba[_0xfed5('0x23')]]['name']=this[_0xfed5('0x28')][_0x1f67ba[_0xfed5('0x23')]][_0xfed5('0x25')];}logger['info'](_0x1f67ba['uniqueid'],this[_0xfed5('0x28')][_0x1f67ba[_0xfed5('0x23')]]?_0xfed5('0x4f'):_0xfed5('0x50'),JSON['stringify'](this[_0xfed5('0xe')][_0x1f67ba[_0xfed5('0x23')]]));if(this[_0xfed5('0x28')][_0x1f67ba[_0xfed5('0x23')]]){if(this[_0xfed5('0xe')][_0x1f67ba[_0xfed5('0x23')]][_0xfed5('0x51')]>0x0&&this['channels'][_0x1f67ba['uniqueid']][_0xfed5('0x19')]===_0xfed5('0x52')){this[_0xfed5('0x4b')](_0x1f67ba[_0xfed5('0x23')],!![]);}else{this[_0xfed5('0x4b')](_0x1f67ba['uniqueid'],![],this[_0xfed5('0xe')][_0x1f67ba[_0xfed5('0x23')]][_0xfed5('0x53')]?'SENDING\x20FAILED:\x20'+this[_0xfed5('0xe')][_0x1f67ba[_0xfed5('0x23')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax['prototype'][_0xfed5('0x54')]=function(_0x33ae0d){var _0x5af862=this;return new BPromise(function(_0x4aa4f4,_0x4a814e){_0x5af862['execOriginate'](_0x33ae0d,_0x5af862[_0xfed5('0xf')][_0x33ae0d['FaxAccountId']])[_0xfed5('0x46')](function(_0x345fb0){ut[_0xfed5('0x48')]('[Fax][execOriginate][success]',_0x345fb0);_0x4aa4f4(ut[_0xfed5('0x37')](_0xfed5('0x55')));})[_0xfed5('0x3e')](function(_0x4bc723){ut[_0xfed5('0x48')](_0xfed5('0x56'),_0x4bc723);updateStatus(_0x33ae0d);_0x4a814e(ut[_0xfed5('0x37')](_0xfed5('0x57')));});});};Fax[_0xfed5('0x29')][_0xfed5('0x58')]=function(_0x29c1eb){var _0x4692ee=this;return new BPromise(function(_0x2abd57,_0x1018a5){var _0x791c6b=_0x4692ee['checkTrunk'](_0x4692ee[_0xfed5('0xf')][_0x29c1eb[_0xfed5('0x59')]]['Trunk'],_0x29c1eb);if(_0x791c6b['isValid']){_0x2abd57(ut['message'](_0xfed5('0x5a')));}else{_0x1018a5(ut[_0xfed5('0x37')](_0x791c6b[_0xfed5('0x37')]));}});};function originate(_0x2ef662,_0xf3db2,_0x297f89){return new BPromise(function(_0x170e6c,_0x72410c){if(_0x297f89){var _0x4b2374=util[_0xfed5('0x5b')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xfed5('0x38')](_0x2ef662[_0xfed5('0x4')])[_0xfed5('0x25')],_0x2ef662[_0xfed5('0x4')]);gs['execute'](_0x4b2374)['then'](function(){_0x2ef662[_0xfed5('0x4')]=util[_0xfed5('0x5b')](_0xfed5('0x5c'),path['parse'](_0x2ef662[_0xfed5('0x4')])[_0xfed5('0x5d')],path[_0xfed5('0x38')](_0x2ef662[_0xfed5('0x4')])['name']);_0xf3db2[_0xfed5('0x5e')]=_0x2ef662['path'];ut['logger'](_0xfed5('0x5f'),'');ami['Action'](ut[_0xfed5('0x60')](_0x2ef662,_0xf3db2))[_0xfed5('0x46')](function(_0x2b8f8e){_0x170e6c(_0x2b8f8e);})[_0xfed5('0x3e')](function(_0x466e96){_0x72410c(_0x466e96);});})[_0xfed5('0x3e')](function(_0x5e5a58){_0x72410c(_0x5e5a58);});}else{ami[_0xfed5('0x61')](ut['variablesAction'](_0x2ef662,_0xf3db2))[_0xfed5('0x46')](function(_0x345348){_0x170e6c(_0x345348);})[_0xfed5('0x3e')](function(_0x5bdb42){_0x72410c(_0x5bdb42);});}});}Fax[_0xfed5('0x29')][_0xfed5('0x62')]=function(_0xc27855,_0x2f78b0){var _0x553098=this;return new BPromise(function(_0x1e91b7,_0x38e753){var _0x33c754=uuid['v4']();var _0x33919e=ut['addVariables'](_0xc27855,_0x2f78b0);_0x553098[_0xfed5('0x28')][_0x33c754]=new Action(_0x33c754,_0x2f78b0,_0xc27855);var _0x14b6ab=_0x553098[_0xfed5('0x28')][_0x33c754];if(path[_0xfed5('0x38')](_0xc27855[_0xfed5('0x4')])[_0xfed5('0x63')]===_0xfed5('0x39')){originate(_0x14b6ab,_0x33919e,!![])[_0xfed5('0x46')](function(_0x28d8de){_0x1e91b7(_0x28d8de);})['catch'](function(_0x419f0d){_0x38e753(_0x419f0d);});}else{originate(_0x14b6ab,_0x33919e,![])[_0xfed5('0x46')](function(_0x2b2524){_0x1e91b7(_0x2b2524);})['catch'](function(_0x502aa3){_0x38e753(_0x502aa3);});}});};Fax[_0xfed5('0x29')]['isTrunkReachable']=function(_0x22f533){return!_[_0xfed5('0x64')](_0x22f533)&&!_[_0xfed5('0x64')](_0x22f533[_0xfed5('0x25')])&&!_[_0xfed5('0x64')](_0x22f533['active'])&&_0x22f533['active']&&!_[_0xfed5('0x64')](this[_0xfed5('0x10')][util[_0xfed5('0x5b')](_0xfed5('0x65'),_0x22f533[_0xfed5('0x25')])])&&!_[_0xfed5('0x64')](this[_0xfed5('0x10')][util[_0xfed5('0x5b')](_0xfed5('0x65'),_0x22f533[_0xfed5('0x25')])][_0xfed5('0x66')])&&(this[_0xfed5('0x10')][util[_0xfed5('0x5b')](_0xfed5('0x65'),_0x22f533[_0xfed5('0x25')])][_0xfed5('0x66')]==='reachable'||this[_0xfed5('0x10')][util[_0xfed5('0x5b')](_0xfed5('0x65'),_0x22f533[_0xfed5('0x25')])][_0xfed5('0x66')]===_0xfed5('0x67'));};Fax['prototype'][_0xfed5('0x68')]=function(_0x2a5df5,_0x2be65a){if(!this[_0xfed5('0x69')](_0x2a5df5)){ut[_0xfed5('0x48')](_0xfed5('0x6a'),_[_0xfed5('0x64')](_0x2a5df5)?'':_0x2a5df5['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xfed5('0x6b')};}if(_['isNil'](_0x2be65a['fax'])){ut[_0xfed5('0x48')](_0xfed5('0x6c'),JSON[_0xfed5('0x3d')](_0x2be65a));return{'isValid':![],'message':_0xfed5('0x6d')};}if(_[_0xfed5('0x64')](_0x2be65a[_0xfed5('0x4')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0xfed5('0x3d')](_0x2be65a));return{'isValid':![],'message':_0xfed5('0x6e')};}return{'isValid':!![],'message':_0xfed5('0x6f')};};module[_0xfed5('0x70')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index c50f54c..7d95246 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 _0x0aa2=['lodash','../rpc/faxAccount','error','inspect','notify','then','catch','[Notify]\x20','util','bluebird','preview'];(function(_0x4e36d1,_0x4c38e7){var _0x2ff0e2=function(_0x520192){while(--_0x520192){_0x4e36d1['push'](_0x4e36d1['shift']());}};_0x2ff0e2(++_0x4c38e7);}(_0x0aa2,0x168));var _0x20aa=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0aa2[_0x4a9fb1];return _0x348672;};'use strict';var util=require(_0x20aa('0x0'));var BPromise=require(_0x20aa('0x1'));var logger=require('../../../config/logger')(_0x20aa('0x2'));var _=require(_0x20aa('0x3'));var faxAccount=require(_0x20aa('0x4'));function loggerCatch(_0x9c6a33){return function(_0x4a23b){logger[_0x20aa('0x5')](_0x9c6a33,util[_0x20aa('0x6')](_0x4a23b,{'showHidden':![],'depth':null}));};}exports[_0x20aa('0x7')]=function(_0x7874ec,_0x396dfa){return BPromise['resolve']()[_0x20aa('0x8')](faxAccount[_0x20aa('0x7')](_0x7874ec,_0x396dfa))[_0x20aa('0x9')](loggerCatch(_0x20aa('0xa')));}; \ No newline at end of file +var _0x1dbc=['util','bluebird','../../../config/logger','preview','lodash','error','resolve','then','notify','catch','[Notify]\x20'];(function(_0x540c49,_0x3e88d9){var _0x390f69=function(_0x4cdf60){while(--_0x4cdf60){_0x540c49['push'](_0x540c49['shift']());}};_0x390f69(++_0x3e88d9);}(_0x1dbc,0x16b));var _0xc1db=function(_0x8fee0f,_0x118ab0){_0x8fee0f=_0x8fee0f-0x0;var _0xa5e569=_0x1dbc[_0x8fee0f];return _0xa5e569;};'use strict';var util=require(_0xc1db('0x0'));var BPromise=require(_0xc1db('0x1'));var logger=require(_0xc1db('0x2'))(_0xc1db('0x3'));var _=require(_0xc1db('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x17cc4a){return function(_0x1913fe){logger[_0xc1db('0x5')](_0x17cc4a,util['inspect'](_0x1913fe,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x3452e5,_0x13951e){return BPromise[_0xc1db('0x6')]()[_0xc1db('0x7')](faxAccount[_0xc1db('0x8')](_0x3452e5,_0x13951e))[_0xc1db('0x9')](loggerCatch(_0xc1db('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 4957fd5..6df911b 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 _0xeded=['info','Exec\x20gs','\x20Error\x20:','inspect','util','fax','bluebird','child_process','exec','execute'];(function(_0x12a5da,_0x41c9ce){var _0x34ec27=function(_0x18d55f){while(--_0x18d55f){_0x12a5da['push'](_0x12a5da['shift']());}};_0x34ec27(++_0x41c9ce);}(_0xeded,0x126));var _0xdede=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeded[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xdede('0x0'));var logger=require('../../../../config/logger')(_0xdede('0x1'));var BPromise=require(_0xdede('0x2'));var exec=require(_0xdede('0x3'))[_0xdede('0x4')];exports[_0xdede('0x5')]=function(_0x46dd24){return new BPromise(function(_0x22c129,_0x24922b){exec(_0x46dd24,function(_0x1af4f4,_0xe0b6bc,_0x563465){logger['info']('Exec\x20gs',_0xe0b6bc);if(_0x1af4f4){logger[_0xdede('0x6')](_0xdede('0x7'),_0xdede('0x8'),util[_0xdede('0x9')](_0x1af4f4,{'showHidden':![],'depth':null}),_0xe0b6bc,_0x563465);_0x24922b(_0x1af4f4);}_0x22c129(_0xe0b6bc);});});}; \ No newline at end of file +var _0xcb23=['fax','exec','info','Exec\x20gs','inspect'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xcb23,0xd2));var _0x3cb2=function(_0x5c16a0,_0x1bd4b4){_0x5c16a0=_0x5c16a0-0x0;var _0x530662=_0xcb23[_0x5c16a0];return _0x530662;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x3cb2('0x0'));var BPromise=require('bluebird');var exec=require('child_process')[_0x3cb2('0x1')];exports['execute']=function(_0x267a10){return new BPromise(function(_0x1c262d,_0x387195){exec(_0x267a10,function(_0x116cd1,_0x20dabf,_0x1e59aa){logger[_0x3cb2('0x2')](_0x3cb2('0x3'),_0x20dabf);if(_0x116cd1){logger[_0x3cb2('0x2')](_0x3cb2('0x3'),'\x20Error\x20:',util[_0x3cb2('0x4')](_0x116cd1,{'showHidden':![],'depth':null}),_0x20dabf,_0x1e59aa);_0x387195(_0x116cd1);}_0x1c262d(_0x20dabf);});});}; \ 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 e82972a..468c1d4 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 _0xe205=['inspect','addVariables','ecm','maxrate','format','modem','gateway','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','headerinfo','localstationid','util','lodash','moment','../../../../config/logger','fax','message','logger','info'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0xe205,0xa7));var _0x5e20=function(_0x29a4fb,_0x537211){_0x29a4fb=_0x29a4fb-0x0;var _0x20d5cf=_0xe205[_0x29a4fb];return _0x20d5cf;};'use strict';var util=require(_0x5e20('0x0'));var _=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var logger=require(_0x5e20('0x3'))(_0x5e20('0x4'));exports[_0x5e20('0x5')]=function(_0x13bace){return{'message':_0x13bace};};exports[_0x5e20('0x6')]=function(_0x37c5e9,_0x4ac934){logger[_0x5e20('0x7')](_0x37c5e9,util[_0x5e20('0x8')](_0x4ac934,{'showHidden':![],'depth':null}));};exports[_0x5e20('0x9')]=function(_0x3c4203,_0x5eca5c){var _0x4cc88d={'XMF-ECM':_0x5eca5c[_0x5e20('0xa')],'XMF-HEADERINFO':_0x5eca5c['headerinfo'],'XMF-MINRATE':_0x5eca5c['minrate'],'XMF-MAXRATE':_0x5eca5c[_0x5e20('0xb')],'XMF-MODEM':util[_0x5e20('0xc')]('\x22%s\x22',_0x5eca5c[_0x5e20('0xd')]),'XMF-GATEWAY':_0x5eca5c[_0x5e20('0xe')],'XMF-FAXDETECT':_0x5eca5c[_0x5e20('0xf')],'XMF-T38TIMEOUT':_0x5eca5c[_0x5e20('0x10')],'XMF-LOCALSTATIONID':_0x5eca5c['localstationid'],'XMF-PATH':_0x3c4203[_0x5e20('0x11')]};return _0x4cc88d;};exports[_0x5e20('0x12')]=function(_0x270689,_0x27f1f9){return{'actionid':_0x270689[_0x5e20('0x13')],'action':_0x5e20('0x14'),'channel':_0x270689['channel'],'Exten':_0x5e20('0x15'),'Context':_0x5e20('0x16'),'Priority':'1','callerid':util[_0x5e20('0xc')]('\x22%s\x22\x20<%s>',_0x270689[_0x5e20('0x17')]?_0x270689['headerinfo']:'',_0x270689[_0x5e20('0x18')]),'variable':_0x27f1f9,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x270689['uniqueid']};}; \ No newline at end of file +var _0x4ea3=['modem','gateway','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger','message','logger','info','inspect','addVariables','ecm','minrate','maxrate','format'];(function(_0x38f951,_0x59d126){var _0x8b70d4=function(_0x298156){while(--_0x298156){_0x38f951['push'](_0x38f951['shift']());}};_0x8b70d4(++_0x59d126);}(_0x4ea3,0x70));var _0x34ea=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4ea3[_0x1ac595];return _0x455fff;};'use strict';var util=require(_0x34ea('0x0'));var _=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var logger=require(_0x34ea('0x3'))('fax');exports[_0x34ea('0x4')]=function(_0x494b56){return{'message':_0x494b56};};exports[_0x34ea('0x5')]=function(_0x571f1b,_0x5e5a84){logger[_0x34ea('0x6')](_0x571f1b,util[_0x34ea('0x7')](_0x5e5a84,{'showHidden':![],'depth':null}));};exports[_0x34ea('0x8')]=function(_0x123d48,_0x40434e){var _0x18b461={'XMF-ECM':_0x40434e[_0x34ea('0x9')],'XMF-HEADERINFO':_0x40434e['headerinfo'],'XMF-MINRATE':_0x40434e[_0x34ea('0xa')],'XMF-MAXRATE':_0x40434e[_0x34ea('0xb')],'XMF-MODEM':util[_0x34ea('0xc')]('\x22%s\x22',_0x40434e[_0x34ea('0xd')]),'XMF-GATEWAY':_0x40434e[_0x34ea('0xe')],'XMF-FAXDETECT':_0x40434e['faxdetect'],'XMF-T38TIMEOUT':_0x40434e['t38timeout'],'XMF-LOCALSTATIONID':_0x40434e[_0x34ea('0xf')],'XMF-PATH':_0x123d48[_0x34ea('0x10')]};return _0x18b461;};exports[_0x34ea('0x11')]=function(_0x58bb0d,_0x11229e){return{'actionid':_0x58bb0d[_0x34ea('0x12')],'action':_0x34ea('0x13'),'channel':_0x58bb0d[_0x34ea('0x14')],'Exten':_0x34ea('0x15'),'Context':_0x34ea('0x16'),'Priority':'1','callerid':util[_0x34ea('0xc')](_0x34ea('0x17'),_0x58bb0d[_0x34ea('0x18')]?_0x58bb0d[_0x34ea('0x18')]:'',_0x58bb0d[_0x34ea('0xf')]),'variable':_0x11229e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x58bb0d['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 713ff13..877511e 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 _0x9852=['./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/dynamics365','hour','get','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','catch','log','listen','sync','bluebird','util','./realtime','./report','./acw','./trigger','./dialer','./fax'];(function(_0x92e3db,_0x1b1059){var _0x3eb7b3=function(_0x595db3){while(--_0x595db3){_0x92e3db['push'](_0x92e3db['shift']());}};_0x3eb7b3(++_0x1b1059);}(_0x9852,0x133));var _0x2985=function(_0x460358,_0x354877){_0x460358=_0x460358-0x0;var _0xdfdfa8=_0x9852[_0x460358];return _0xdfdfa8;};'use strict';var BPromise=require(_0x2985('0x0'));var util=require(_0x2985('0x1'));var moment=require('moment');var server=require('./server');var Realtime=require(_0x2985('0x2'));var Report=require(_0x2985('0x3'));var Acw=require(_0x2985('0x4'));var Trigger=require(_0x2985('0x5'));var Dialer=require(_0x2985('0x6'));var Preview=require('./preview');var Fax=require(_0x2985('0x7'));var user=require(_0x2985('0x8'));var voiceQueue=require(_0x2985('0x9'));var voiceQueueReport=require(_0x2985('0xa'));var voiceCallReport=require(_0x2985('0xb'));var trunk=require(_0x2985('0xc'));var trigger=require(_0x2985('0xd'));var template=require('./rpc/template');var cmHopperHistory=require(_0x2985('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x2985('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x2985('0x10'));var sugarcrm=require(_0x2985('0x11'));var freshdesk=require(_0x2985('0x12'));var desk=require(_0x2985('0x13'));var zoho=require(_0x2985('0x14'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x2985('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'](_0x2985('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2985('0x17')](_0x2985('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x2985('0x18')]()[_0x2985('0x19')](user[_0x2985('0x1a')]())[_0x2985('0x19')](realtime[_0x2985('0x1b')]())['then'](user[_0x2985('0x1c')]())[_0x2985('0x19')](realtime['initTelephones']())['then'](trunk[_0x2985('0x1d')]())['then'](realtime[_0x2985('0x1e')]())[_0x2985('0x19')](voiceQueue[_0x2985('0x1f')]())[_0x2985('0x19')](realtime['initVoiceQueues']())['then'](trigger[_0x2985('0x20')]())[_0x2985('0x19')](realtime['initTriggers']())[_0x2985('0x19')](template[_0x2985('0x21')]())[_0x2985('0x19')](realtime[_0x2985('0x22')]())[_0x2985('0x19')](zendesk[_0x2985('0x23')]())[_0x2985('0x19')](realtime[_0x2985('0x24')]())['then'](salesforce[_0x2985('0x25')]())[_0x2985('0x19')](realtime[_0x2985('0x26')]())[_0x2985('0x19')](sugarcrm[_0x2985('0x27')]())['then'](realtime[_0x2985('0x28')]())['then'](freshdesk[_0x2985('0x29')]())[_0x2985('0x19')](realtime[_0x2985('0x2a')]())[_0x2985('0x19')](desk['getDeskAccounts']())[_0x2985('0x19')](realtime['initDeskAccounts']())[_0x2985('0x19')](zoho['getZohoAccounts']())['then'](realtime[_0x2985('0x2b')]())[_0x2985('0x19')](vtiger[_0x2985('0x2c')]())[_0x2985('0x19')](realtime[_0x2985('0x2d')]())[_0x2985('0x19')](freshsales['getFreshsalesAccounts']())[_0x2985('0x19')](realtime[_0x2985('0x2e')]())[_0x2985('0x19')](servicenow[_0x2985('0x2f')]())['then'](realtime['initServicenowAccounts']())[_0x2985('0x19')](dynamics365[_0x2985('0x30')]())[_0x2985('0x19')](realtime[_0x2985('0x31')]())[_0x2985('0x19')](campaign[_0x2985('0x32')]())[_0x2985('0x19')](realtime[_0x2985('0x33')]())[_0x2985('0x19')](voiceExtension['getVoiceExtensions']())[_0x2985('0x19')](realtime[_0x2985('0x34')]())['then'](faxAccount['getFaxAccounts']())['then'](realtime[_0x2985('0x35')]())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport[_0x2985('0x36')]())[_0x2985('0x19')](realtime[_0x2985('0x37')]())[_0x2985('0x19')](cmHopperHistory[_0x2985('0x38')]())[_0x2985('0x19')](realtime['initVoiceQueueHopperHistory']())[_0x2985('0x19')](cmHopperHistory[_0x2985('0x39')]())[_0x2985('0x19')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x2985('0x3a')]())[_0x2985('0x19')](realtime['initVoiceCallReports']())[_0x2985('0x19')](function(_0x40054e){})[_0x2985('0x3b')](function(_0x4f8456){console[_0x2985('0x3c')](_0x4f8456);});}function main(){return server[_0x2985('0x3d')](realtime,preview,fax)[_0x2985('0x19')](function(_0x16ead5){return initRealtime();})['then'](function(){return initParams();})[_0x2985('0x19')](function(){report[_0x2985('0x3e')]();setInterval(initRealtime,0x1388);})[_0x2985('0x3b')](function(_0x4ab32e){console[_0x2985('0x3c')](_0x4ab32e);});}main(); \ No newline at end of file +var _0x3d75=['./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','hour','get','resolve','getAgents','then','initAgents','initTelephones','getTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','sync','log','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory'];(function(_0x56eb89,_0xa70f63){var _0x237f9d=function(_0xee35df){while(--_0xee35df){_0x56eb89['push'](_0x56eb89['shift']());}};_0x237f9d(++_0xa70f63);}(_0x3d75,0x189));var _0x53d7=function(_0x4ec7a0,_0x36d7b9){_0x4ec7a0=_0x4ec7a0-0x0;var _0xa74dae=_0x3d75[_0x4ec7a0];return _0xa74dae;};'use strict';var BPromise=require('bluebird');var util=require(_0x53d7('0x0'));var moment=require(_0x53d7('0x1'));var server=require(_0x53d7('0x2'));var Realtime=require(_0x53d7('0x3'));var Report=require(_0x53d7('0x4'));var Acw=require(_0x53d7('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x53d7('0x6'));var Preview=require(_0x53d7('0x7'));var Fax=require(_0x53d7('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0x53d7('0x9'));var voiceQueueReport=require(_0x53d7('0xa'));var voiceCallReport=require(_0x53d7('0xb'));var trunk=require(_0x53d7('0xc'));var trigger=require('./rpc/trigger');var template=require(_0x53d7('0xd'));var cmHopperHistory=require(_0x53d7('0xe'));var campaign=require(_0x53d7('0xf'));var voiceExtension=require(_0x53d7('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x53d7('0x11'));var salesforce=require(_0x53d7('0x12'));var sugarcrm=require(_0x53d7('0x13'));var freshdesk=require(_0x53d7('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x53d7('0x15'));var vtiger=require(_0x53d7('0x16'));var freshsales=require(_0x53d7('0x17'));var servicenow=require(_0x53d7('0x18'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x53d7('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x53d7('0x1a')](_0x53d7('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x53d7('0x1b')]()['then'](user[_0x53d7('0x1c')]())[_0x53d7('0x1d')](realtime[_0x53d7('0x1e')]())[_0x53d7('0x1d')](user['getTelephones']())[_0x53d7('0x1d')](realtime[_0x53d7('0x1f')]())[_0x53d7('0x1d')](trunk[_0x53d7('0x20')]())['then'](realtime['initTrunks']())[_0x53d7('0x1d')](voiceQueue['getVoiceQueues']())[_0x53d7('0x1d')](realtime[_0x53d7('0x21')]())['then'](trigger[_0x53d7('0x22')]())['then'](realtime[_0x53d7('0x23')]())[_0x53d7('0x1d')](template[_0x53d7('0x24')]())[_0x53d7('0x1d')](realtime[_0x53d7('0x25')]())[_0x53d7('0x1d')](zendesk[_0x53d7('0x26')]())[_0x53d7('0x1d')](realtime['initZendeskAccounts']())[_0x53d7('0x1d')](salesforce[_0x53d7('0x27')]())[_0x53d7('0x1d')](realtime[_0x53d7('0x28')]())['then'](sugarcrm[_0x53d7('0x29')]())[_0x53d7('0x1d')](realtime[_0x53d7('0x2a')]())[_0x53d7('0x1d')](freshdesk[_0x53d7('0x2b')]())['then'](realtime[_0x53d7('0x2c')]())[_0x53d7('0x1d')](desk[_0x53d7('0x2d')]())['then'](realtime[_0x53d7('0x2e')]())['then'](zoho[_0x53d7('0x2f')]())[_0x53d7('0x1d')](realtime['initZohoAccounts']())[_0x53d7('0x1d')](vtiger['getVtigerAccounts']())[_0x53d7('0x1d')](realtime[_0x53d7('0x30')]())['then'](freshsales[_0x53d7('0x31')]())[_0x53d7('0x1d')](realtime[_0x53d7('0x32')]())[_0x53d7('0x1d')](servicenow[_0x53d7('0x33')]())[_0x53d7('0x1d')](realtime[_0x53d7('0x34')]())[_0x53d7('0x1d')](dynamics365[_0x53d7('0x35')]())[_0x53d7('0x1d')](realtime[_0x53d7('0x36')]())[_0x53d7('0x1d')](campaign[_0x53d7('0x37')]())[_0x53d7('0x1d')](realtime[_0x53d7('0x38')]())['then'](voiceExtension['getVoiceExtensions']())['then'](realtime['initVoiceExtensions']())['then'](faxAccount['getFaxAccounts']())['then'](realtime['initFaxAccounts']())[_0x53d7('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x53d7('0x1b')]()[_0x53d7('0x1d')](voiceQueueReport[_0x53d7('0x39')]())[_0x53d7('0x1d')](realtime[_0x53d7('0x3a')]())[_0x53d7('0x1d')](cmHopperHistory[_0x53d7('0x3b')]())['then'](realtime[_0x53d7('0x3c')]())[_0x53d7('0x1d')](cmHopperHistory[_0x53d7('0x3d')]())['then'](realtime[_0x53d7('0x3e')]())[_0x53d7('0x1d')](voiceCallReport[_0x53d7('0x3f')]())[_0x53d7('0x1d')](realtime[_0x53d7('0x40')]())[_0x53d7('0x1d')](function(_0x2f93b3){})[_0x53d7('0x41')](function(_0x59e015){console['log'](_0x59e015);});}function main(){return server['listen'](realtime,preview,fax)[_0x53d7('0x1d')](function(_0x3c2cc6){return initRealtime();})[_0x53d7('0x1d')](function(){return initParams();})['then'](function(){report[_0x53d7('0x42')]();setInterval(initRealtime,0x1388);})[_0x53d7('0x41')](function(_0x3794a1){console[_0x53d7('0x43')](_0x3794a1);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 63b2d31..67d63b1 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 _0xe1e4=['phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','md5','prototype','updateStatusRealtime','toLowerCase','idle','inuse','talking','toNumber','format','address','stringify','user:%s','emit','exports','util','moment','../../../config/environment','redis','defaults','localhost','name','email','accountcode','fullname','state','stateTime','unknown'];(function(_0x106328,_0x30f469){var _0x18b5da=function(_0x271fe2){while(--_0x271fe2){_0x106328['push'](_0x106328['shift']());}};_0x18b5da(++_0x30f469);}(_0xe1e4,0x1eb));var _0x4e1e=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xe1e4[_0x29d94e];return _0x106237;};'use strict';var _=require('lodash');var util=require(_0x4e1e('0x0'));var moment=require(_0x4e1e('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x4e1e('0x2'));config[_0x4e1e('0x3')]=_[_0x4e1e('0x4')](config['redis'],{'host':_0x4e1e('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4e1e('0x3')]));function Agent(_0x8241e0){this['id']=_0x8241e0['id']||0x0;this[_0x4e1e('0x6')]=_0x8241e0[_0x4e1e('0x6')]||'';this[_0x4e1e('0x7')]=_0x8241e0[_0x4e1e('0x7')]||'';this[_0x4e1e('0x8')]=_0x8241e0[_0x4e1e('0x8')]||'';this[_0x4e1e('0x9')]=_0x8241e0[_0x4e1e('0x9')]||'';this[_0x4e1e('0xa')]='unknown';this[_0x4e1e('0xb')]=0x0;this['status']=_0x4e1e('0xc');this['address']='';this[_0x4e1e('0xd')]='';this[_0x4e1e('0xe')]='';this[_0x4e1e('0xf')]='';this['online']=_0x8241e0[_0x4e1e('0x10')]||![];this[_0x4e1e('0x11')]=_0x4e1e('0xc');this[_0x4e1e('0x12')]=0x0;this[_0x4e1e('0x13')]='';this[_0x4e1e('0x14')]='';this[_0x4e1e('0x15')]=![];this['local']=![];this[_0x4e1e('0x16')]='';}Agent[_0x4e1e('0x17')][_0x4e1e('0x18')]=function(_0x57d126){var _0x1a2db8;if(_0x57d126&&_0x57d126[_0x4e1e('0xa')]){_0x1a2db8=_0x57d126['state'][_0x4e1e('0x19')]();switch(_0x1a2db8){case'not_inuse':_0x1a2db8=_0x4e1e('0x1a');break;case _0x4e1e('0x1b'):_0x1a2db8=_0x4e1e('0x1c');break;}}if(_0x1a2db8&&this[_0x4e1e('0x11')]!==_0x1a2db8||_0x57d126['statePause']){this[_0x4e1e('0x12')]=_[_0x4e1e('0x1d')](moment()[_0x4e1e('0x1e')]('x'));}if(_0x1a2db8){this['voiceStatus']=_0x1a2db8;}var _0xa2c532={'id':this['id'],'name':this['name'],'email':this[_0x4e1e('0x7')],'accountcode':this[_0x4e1e('0x8')],'fullname':this['fullname'],'state':this[_0x4e1e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x4e1e('0x1f')],'online':this[_0x4e1e('0x10')],'voiceStatus':this[_0x4e1e('0x11')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x4e1e('0x13')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x4e1e('0x15')]};var _0x5e58b8=md5(JSON[_0x4e1e('0x20')](_0xa2c532));if(this[_0x4e1e('0x16')]!==_0x5e58b8){this[_0x4e1e('0x16')]=_0x5e58b8;io['to'](util[_0x4e1e('0x1e')](_0x4e1e('0x21'),_0xa2c532[_0x4e1e('0x6')]))[_0x4e1e('0x22')]('user:save',_0xa2c532);}};module[_0x4e1e('0x23')]=Agent; \ No newline at end of file +var _0xb676=['emit','exports','lodash','util','moment','md5','ioredis','defaults','localhost','socket.io-emitter','redis','email','accountcode','unknown','stateTime','status','phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format','name','fullname','stringify'];(function(_0x5f143e,_0x4bf238){var _0x427844=function(_0x3dacdd){while(--_0x3dacdd){_0x5f143e['push'](_0x5f143e['shift']());}};_0x427844(++_0x4bf238);}(_0xb676,0x12a));var _0x6b67=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xb676[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0x6b67('0x0'));var util=require(_0x6b67('0x1'));var moment=require(_0x6b67('0x2'));var md5=require(_0x6b67('0x3'));var Redis=require(_0x6b67('0x4'));var config=require('../../../config/environment');config['redis']=_[_0x6b67('0x5')](config['redis'],{'host':_0x6b67('0x6'),'port':0x18eb});var io=require(_0x6b67('0x7'))(new Redis(config[_0x6b67('0x8')]));function Agent(_0xbca103){this['id']=_0xbca103['id']||0x0;this['name']=_0xbca103['name']||'';this[_0x6b67('0x9')]=_0xbca103[_0x6b67('0x9')]||'';this[_0x6b67('0xa')]=_0xbca103[_0x6b67('0xa')]||'';this['fullname']=_0xbca103['fullname']||'';this['state']=_0x6b67('0xb');this[_0x6b67('0xc')]=0x0;this[_0x6b67('0xd')]=_0x6b67('0xb');this['address']='';this[_0x6b67('0xe')]='';this[_0x6b67('0xf')]='';this['interface']='';this['online']=_0xbca103[_0x6b67('0x10')]||![];this[_0x6b67('0x11')]=_0x6b67('0xb');this[_0x6b67('0x12')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x6b67('0x13')]='';this[_0x6b67('0x14')]=![];this[_0x6b67('0x15')]=![];this[_0x6b67('0x3')]='';}Agent[_0x6b67('0x16')][_0x6b67('0x17')]=function(_0x28b1cc){var _0x2c30ac;if(_0x28b1cc&&_0x28b1cc['state']){_0x2c30ac=_0x28b1cc[_0x6b67('0x18')][_0x6b67('0x19')]();switch(_0x2c30ac){case _0x6b67('0x1a'):_0x2c30ac=_0x6b67('0x1b');break;case _0x6b67('0x1c'):_0x2c30ac='talking';break;}}if(_0x2c30ac&&this[_0x6b67('0x11')]!==_0x2c30ac||_0x28b1cc[_0x6b67('0x1d')]){this[_0x6b67('0x12')]=_[_0x6b67('0x1e')](moment()[_0x6b67('0x1f')]('x'));}if(_0x2c30ac){this[_0x6b67('0x11')]=_0x2c30ac;}var _0x132a43={'id':this['id'],'name':this[_0x6b67('0x20')],'email':this[_0x6b67('0x9')],'accountcode':this[_0x6b67('0xa')],'fullname':this[_0x6b67('0x21')],'state':this[_0x6b67('0x18')],'stateTime':this[_0x6b67('0xc')],'status':this[_0x6b67('0xd')],'address':this['address'],'online':this[_0x6b67('0x10')],'voiceStatus':this[_0x6b67('0x11')],'voiceStatusTime':this[_0x6b67('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6b67('0x13')],'interface':this['interface'],'onhold':this['onhold']};var _0x40e557=md5(JSON[_0x6b67('0x22')](_0x132a43));if(this[_0x6b67('0x3')]!==_0x40e557){this[_0x6b67('0x3')]=_0x40e557;io['to'](util['format']('user:%s',_0x132a43[_0x6b67('0x20')]))[_0x6b67('0x23')]('user:save',_0x132a43);}};module[_0x6b67('0x24')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 11b9d69..43028f9 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 _0x7061=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x4da4ea,_0x2875d3){var _0x3cc102=function(_0x5549c2){while(--_0x5549c2){_0x4da4ea['push'](_0x4da4ea['shift']());}};_0x3cc102(++_0x2875d3);}(_0x7061,0x1f3));var _0x1706=function(_0x427e66,_0x2ae755){_0x427e66=_0x427e66-0x0;var _0xbbd7ba=_0x7061[_0x427e66];return _0xbbd7ba;};'use strict';function Campaign(_0x598964){this['id']=_0x598964['id']||0x0;this[_0x1706('0x0')]=_0x598964['name']||'';this['type']=_0x598964[_0x1706('0x1')]||_0x1706('0x2');this[_0x1706('0x3')]=0x0;this[_0x1706('0x4')]=0x0;this[_0x1706('0x5')]=0x0;this[_0x1706('0x6')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x1706('0x7')]=_0x598964[_0x1706('0x7')];this[_0x1706('0x8')]=_0x598964[_0x1706('0x8')];this[_0x1706('0x9')]=_0x598964['dialTimezone']||null;this[_0x1706('0xa')]=_0x598964['dialGlobalInterval']?_0x598964[_0x1706('0xa')]:null;this[_0x1706('0xb')]=_0x598964[_0x1706('0xb')];this[_0x1706('0xc')]=_0x598964[_0x1706('0xc')];this[_0x1706('0xd')]=_0x598964['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x598964['dialCongestionMaxRetry'];this[_0x1706('0xe')]=_0x598964[_0x1706('0xe')];this[_0x1706('0xf')]=_0x598964[_0x1706('0xf')];this[_0x1706('0x10')]=_0x598964[_0x1706('0x10')];this[_0x1706('0x11')]=_0x598964[_0x1706('0x11')];this[_0x1706('0x12')]=_0x598964[_0x1706('0x12')];this[_0x1706('0x13')]=_0x598964['dialGlobalMaxRetry'];this[_0x1706('0x14')]=_0x598964[_0x1706('0x14')]||0x3;this[_0x1706('0x15')]=_0x598964[_0x1706('0x15')]||0x96;this[_0x1706('0x16')]=_0x598964[_0x1706('0x16')]||0x3;this[_0x1706('0x17')]=_0x598964[_0x1706('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x598964['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x598964[_0x1706('0x18')]||0x96;this[_0x1706('0x19')]=_0x598964[_0x1706('0x19')]||0x3;this[_0x1706('0x1a')]=_0x598964[_0x1706('0x1a')]||0x96;this[_0x1706('0x1b')]=_0x598964[_0x1706('0x1b')]||0x3;this[_0x1706('0x1c')]=_0x598964[_0x1706('0x1c')]||0x96;this[_0x1706('0x1d')]=_0x598964[_0x1706('0x1d')]||'DESC';this[_0x1706('0x1e')]=_0x598964[_0x1706('0x1e')]||undefined;this[_0x1706('0x1f')]=_0x598964[_0x1706('0x1f')]||undefined;this[_0x1706('0x20')]=_0x598964[_0x1706('0x20')]||undefined;this[_0x1706('0x21')]=_0x598964['TrunkBackup']?_0x598964[_0x1706('0x21')]:undefined;this[_0x1706('0x22')]=_0x598964[_0x1706('0x22')]?_0x598964[_0x1706('0x22')]:undefined;this[_0x1706('0x23')]=_0x598964[_0x1706('0x23')]?_0x598964[_0x1706('0x23')]:undefined;this['SquareProject']=_0x598964[_0x1706('0x24')]?_0x598964['SquareProject']:undefined;this[_0x1706('0x25')]=_0x598964['SquareProject']?_0x598964[_0x1706('0x24')]['name']:undefined;this[_0x1706('0x26')]=_0x598964[_0x1706('0x26')]||![];this[_0x1706('0x27')]=_0x598964[_0x1706('0x27')];this['dialAMDGreeting']=_0x598964[_0x1706('0x28')];this[_0x1706('0x29')]=_0x598964[_0x1706('0x29')];this[_0x1706('0x2a')]=_0x598964[_0x1706('0x2a')];this[_0x1706('0x2b')]=_0x598964[_0x1706('0x2b')];this[_0x1706('0x2c')]=_0x598964[_0x1706('0x2c')];this['dialAMDMaximumNumberOfWords']=_0x598964['dialAMDMaximumNumberOfWords'];this[_0x1706('0x2d')]=_0x598964[_0x1706('0x2d')];this[_0x1706('0x2e')]=_0x598964[_0x1706('0x2e')];}module['exports']=Campaign; \ No newline at end of file +var _0xedc6=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xedc6,0x9f));var _0x6edc=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xedc6[_0x5447fd];return _0x15b28a;};'use strict';function Campaign(_0x4c3191){this['id']=_0x4c3191['id']||0x0;this['name']=_0x4c3191['name']||'';this[_0x6edc('0x0')]=_0x4c3191['type']||_0x6edc('0x1');this[_0x6edc('0x2')]=0x0;this[_0x6edc('0x3')]=0x0;this[_0x6edc('0x4')]=0x0;this[_0x6edc('0x5')]=0x0;this[_0x6edc('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0x6edc('0x7')]=_0x4c3191[_0x6edc('0x7')];this['limitCalls']=_0x4c3191['limitCalls'];this[_0x6edc('0x8')]=_0x4c3191[_0x6edc('0x8')]||null;this[_0x6edc('0x9')]=_0x4c3191[_0x6edc('0x9')]?_0x4c3191['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x4c3191[_0x6edc('0xa')];this[_0x6edc('0xb')]=_0x4c3191[_0x6edc('0xb')];this[_0x6edc('0xc')]=_0x4c3191['dialOriginateTimeout']||0x1e;this[_0x6edc('0xd')]=_0x4c3191['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x4c3191['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x4c3191[_0x6edc('0xe')];this[_0x6edc('0xf')]=_0x4c3191['dialBusyRetryFrequency'];this[_0x6edc('0x10')]=_0x4c3191[_0x6edc('0x10')];this[_0x6edc('0x11')]=_0x4c3191[_0x6edc('0x11')];this[_0x6edc('0x12')]=_0x4c3191['dialGlobalMaxRetry'];this[_0x6edc('0x13')]=_0x4c3191['dialNoSuchNumberMaxRetry']||0x3;this[_0x6edc('0x14')]=_0x4c3191[_0x6edc('0x14')]||0x96;this[_0x6edc('0x15')]=_0x4c3191[_0x6edc('0x15')]||0x3;this[_0x6edc('0x16')]=_0x4c3191[_0x6edc('0x16')]||0x96;this[_0x6edc('0x17')]=_0x4c3191[_0x6edc('0x17')]||0x3;this[_0x6edc('0x18')]=_0x4c3191['dialAbandonedRetryFrequency']||0x96;this[_0x6edc('0x19')]=_0x4c3191['dialMachineMaxRetry']||0x3;this[_0x6edc('0x1a')]=_0x4c3191[_0x6edc('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x4c3191[_0x6edc('0x1b')]||0x3;this[_0x6edc('0x1c')]=_0x4c3191[_0x6edc('0x1c')]||0x96;this[_0x6edc('0x1d')]=_0x4c3191[_0x6edc('0x1d')]||_0x6edc('0x1e');this[_0x6edc('0x1f')]=_0x4c3191[_0x6edc('0x1f')]||undefined;this[_0x6edc('0x20')]=_0x4c3191[_0x6edc('0x20')]||undefined;this['dialCutDigit']=_0x4c3191[_0x6edc('0x21')]||undefined;this[_0x6edc('0x22')]=_0x4c3191[_0x6edc('0x22')]?_0x4c3191[_0x6edc('0x22')]:undefined;this[_0x6edc('0x23')]=_0x4c3191['Trunk']?_0x4c3191[_0x6edc('0x23')]:undefined;this[_0x6edc('0x24')]=_0x4c3191[_0x6edc('0x24')]?_0x4c3191[_0x6edc('0x24')]:undefined;this[_0x6edc('0x25')]=_0x4c3191['SquareProject']?_0x4c3191[_0x6edc('0x25')]:undefined;this[_0x6edc('0x26')]=_0x4c3191[_0x6edc('0x25')]?_0x4c3191['SquareProject']['name']:undefined;this[_0x6edc('0x27')]=_0x4c3191[_0x6edc('0x27')]||![];this[_0x6edc('0x28')]=_0x4c3191['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x4c3191[_0x6edc('0x29')];this[_0x6edc('0x2a')]=_0x4c3191[_0x6edc('0x2a')];this[_0x6edc('0x2b')]=_0x4c3191[_0x6edc('0x2b')];this[_0x6edc('0x2c')]=_0x4c3191[_0x6edc('0x2c')];this[_0x6edc('0x2d')]=_0x4c3191[_0x6edc('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x4c3191[_0x6edc('0x2e')];this['dialAMDSilenceThreshold']=_0x4c3191[_0x6edc('0x2f')];this[_0x6edc('0x30')]=_0x4c3191[_0x6edc('0x30')];}module[_0x6edc('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 bfdc6d4..2c179f3 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 _0xef4d=['calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','exports','starttime','channel','destinationchannel'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0xef4d,0x165));var _0xdef4=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xef4d[_0x4b2863];return _0x567d67;};'use strict';function Channel(){this[_0xdef4('0x0')]=null;this[_0xdef4('0x1')]='';this[_0xdef4('0x2')]='';this[_0xdef4('0x3')]=0x0;this[_0xdef4('0x4')]='';this[_0xdef4('0x5')]=undefined;this[_0xdef4('0x6')]=undefined;this[_0xdef4('0x7')]=0x0;this[_0xdef4('0x8')]='';this[_0xdef4('0x9')]=0x0;this[_0xdef4('0xa')]=0x0;this[_0xdef4('0xb')]=0x0;this[_0xdef4('0xc')]=![];this['answertime']=null;this[_0xdef4('0xd')]=null;this[_0xdef4('0xe')]=![];this[_0xdef4('0xf')]=![];this[_0xdef4('0x10')]='';this[_0xdef4('0x11')]='';this[_0xdef4('0x12')]=0x0;this[_0xdef4('0x13')]=0x0;this[_0xdef4('0x14')]=0x0;this[_0xdef4('0x15')]=null;this['tag']=null;this[_0xdef4('0x16')]=null;this[_0xdef4('0x17')]=![];this[_0xdef4('0x18')]=null;this[_0xdef4('0x19')]=null;this[_0xdef4('0x1a')]=[];this[_0xdef4('0x1b')]=undefined;this[_0xdef4('0x1c')]=undefined;this['mohtime']=0x0;}module[_0xdef4('0x1d')]=Channel; \ No newline at end of file +var _0xce9e=['calleridname','accountcode','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0xce9e,0x1c8));var _0xece9=function(_0x26eb88,_0x5efcf1){_0x26eb88=_0x26eb88-0x0;var _0x5a1b15=_0xce9e[_0x26eb88];return _0x5a1b15;};'use strict';function Channel(){this[_0xece9('0x0')]=null;this[_0xece9('0x1')]='';this[_0xece9('0x2')]='';this['calleridnum']=0x0;this[_0xece9('0x3')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0xece9('0x4')]=0x0;this['context']='';this[_0xece9('0x5')]=0x0;this[_0xece9('0x6')]=0x0;this[_0xece9('0x7')]=0x0;this[_0xece9('0x8')]=![];this[_0xece9('0x9')]=null;this[_0xece9('0xa')]=null;this[_0xece9('0xb')]=![];this['abandoned']=![];this['lastapplication']='';this[_0xece9('0xc')]='';this[_0xece9('0xd')]=0x0;this[_0xece9('0xe')]=0x0;this[_0xece9('0xf')]=0x0;this[_0xece9('0x10')]=null;this[_0xece9('0x11')]=null;this[_0xece9('0x12')]=null;this[_0xece9('0x13')]=![];this[_0xece9('0x14')]=null;this[_0xece9('0x15')]=null;this[_0xece9('0x16')]=[];this[_0xece9('0x17')]=undefined;this[_0xece9('0x18')]=undefined;this[_0xece9('0x19')]=0x0;}module[_0xece9('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index c3aa757..ff4c02b 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 _0x0a9f=['name','remoteUri','authType','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x57f37c,_0x509412){var _0x4b3535=function(_0x3aae68){while(--_0x3aae68){_0x57f37c['push'](_0x57f37c['shift']());}};_0x4b3535(++_0x509412);}(_0x0a9f,0x64));var _0xf0a9=function(_0x4a177c,_0x2bd612){_0x4a177c=_0x4a177c-0x0;var _0x54dd37=_0x0a9f[_0x4a177c];return _0x54dd37;};'use strict';function DeskAccount(_0x4db288){this['id']=_0x4db288['id']||0x0;this[_0xf0a9('0x0')]=_0x4db288[_0xf0a9('0x0')]||'';this['username']=_0x4db288['username']||'';this[_0xf0a9('0x1')]=_0x4db288['remoteUri']||'';this[_0xf0a9('0x2')]=_0x4db288['authType']||'';this['password']=_0x4db288['password']||'';this['consumerKey']=_0x4db288[_0xf0a9('0x3')]||'';this[_0xf0a9('0x4')]=_0x4db288['consumerSecret']||'';this[_0xf0a9('0x5')]=_0x4db288['token']||'';this[_0xf0a9('0x6')]=_0x4db288[_0xf0a9('0x6')]||'';this['type']=_0x4db288[_0xf0a9('0x7')]||'';this[_0xf0a9('0x8')]=_0x4db288[_0xf0a9('0x8')]||'';this['Configurations']=_0x4db288[_0xf0a9('0x9')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xa7e6=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','name','username','remoteUri','authType','password'];(function(_0x54ccd7,_0x3bc3ce){var _0x4e667b=function(_0xab8fea){while(--_0xab8fea){_0x54ccd7['push'](_0x54ccd7['shift']());}};_0x4e667b(++_0x3bc3ce);}(_0xa7e6,0x74));var _0x6a7e=function(_0x39e309,_0x1b260b){_0x39e309=_0x39e309-0x0;var _0x180c8a=_0xa7e6[_0x39e309];return _0x180c8a;};'use strict';function DeskAccount(_0x495a94){this['id']=_0x495a94['id']||0x0;this[_0x6a7e('0x0')]=_0x495a94[_0x6a7e('0x0')]||'';this[_0x6a7e('0x1')]=_0x495a94[_0x6a7e('0x1')]||'';this[_0x6a7e('0x2')]=_0x495a94['remoteUri']||'';this[_0x6a7e('0x3')]=_0x495a94[_0x6a7e('0x3')]||'';this[_0x6a7e('0x4')]=_0x495a94[_0x6a7e('0x4')]||'';this[_0x6a7e('0x5')]=_0x495a94['consumerKey']||'';this[_0x6a7e('0x6')]=_0x495a94[_0x6a7e('0x6')]||'';this[_0x6a7e('0x7')]=_0x495a94[_0x6a7e('0x7')]||'';this[_0x6a7e('0x8')]=_0x495a94[_0x6a7e('0x8')]||'';this[_0x6a7e('0x9')]=_0x495a94[_0x6a7e('0x9')]||'';this[_0x6a7e('0xa')]=_0x495a94['serverUrl']||'';this['Configurations']=_0x495a94['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 93c7852..b6fbc18 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 _0x4176=['remoteUri','tenantId','clientId','clientSecret','serverUrl','exports','name','password'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0x4176,0xb6));var _0x6417=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x4176[_0x484e36];return _0xafc85d;};'use strict';function Dynamics365Account(_0x470bcd){this['id']=_0x470bcd['id']||0x0;this[_0x6417('0x0')]=_0x470bcd[_0x6417('0x0')]||'';this['username']=_0x470bcd['username']||'';this[_0x6417('0x1')]=_0x470bcd['password']||'';this[_0x6417('0x2')]=_0x470bcd[_0x6417('0x2')]||'';this[_0x6417('0x3')]=_0x470bcd['tenantId']||'';this[_0x6417('0x4')]=_0x470bcd[_0x6417('0x4')]||'';this[_0x6417('0x5')]=_0x470bcd[_0x6417('0x5')]||{};this[_0x6417('0x6')]=_0x470bcd[_0x6417('0x6')]||'';this['Configurations']=_0x470bcd['Configurations']||{};}module[_0x6417('0x7')]=Dynamics365Account; \ No newline at end of file +var _0xe821=['tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x561f25,_0x2d95c1){var _0x150e4c=function(_0x266e99){while(--_0x266e99){_0x561f25['push'](_0x561f25['shift']());}};_0x150e4c(++_0x2d95c1);}(_0xe821,0x114));var _0x1e82=function(_0x16c9c9,_0x23c6f4){_0x16c9c9=_0x16c9c9-0x0;var _0x3f7921=_0xe821[_0x16c9c9];return _0x3f7921;};'use strict';function Dynamics365Account(_0x35e8e0){this['id']=_0x35e8e0['id']||0x0;this[_0x1e82('0x0')]=_0x35e8e0[_0x1e82('0x0')]||'';this['username']=_0x35e8e0[_0x1e82('0x1')]||'';this[_0x1e82('0x2')]=_0x35e8e0['password']||'';this[_0x1e82('0x3')]=_0x35e8e0[_0x1e82('0x3')]||'';this[_0x1e82('0x4')]=_0x35e8e0[_0x1e82('0x4')]||'';this[_0x1e82('0x5')]=_0x35e8e0[_0x1e82('0x5')]||'';this[_0x1e82('0x6')]=_0x35e8e0[_0x1e82('0x6')]||{};this[_0x1e82('0x7')]=_0x35e8e0[_0x1e82('0x7')]||'';this['Configurations']=_0x35e8e0[_0x1e82('0x8')]||{};}module[_0x1e82('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 b569e76..9954cda 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 _0x9934=['SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','faxdetect','t38timeout','tech'];(function(_0x5dd118,_0x3f166d){var _0x519ca5=function(_0x40a88e){while(--_0x40a88e){_0x5dd118['push'](_0x5dd118['shift']());}};_0x519ca5(++_0x3f166d);}(_0x9934,0x7c));var _0x4993=function(_0x124298,_0x542004){_0x124298=_0x124298-0x0;var _0x35ac24=_0x9934[_0x124298];return _0x35ac24;};'use strict';function FaxAccount(_0x1e6890){this['id']=_0x1e6890['id']||0x0;this[_0x4993('0x0')]=_0x1e6890['name']||'';this[_0x4993('0x1')]=_0x1e6890[_0x4993('0x1')];this[_0x4993('0x2')]=_0x1e6890[_0x4993('0x2')];this['headerinfo']=_0x1e6890[_0x4993('0x3')];this[_0x4993('0x4')]=_0x1e6890[_0x4993('0x4')];this[_0x4993('0x5')]=_0x1e6890[_0x4993('0x5')]||0x960;this[_0x4993('0x6')]=_0x1e6890['maxrate']||0x3840;this['modem']=_0x1e6890[_0x4993('0x7')]||_0x4993('0x8');this['gateway']=_0x1e6890['gateway']||'no';this['faxdetect']=_0x1e6890[_0x4993('0x9')]||'no';this[_0x4993('0xa')]=_0x1e6890[_0x4993('0xa')]||0x1388;this[_0x4993('0xb')]=_0x1e6890[_0x4993('0xb')]||_0x4993('0xc');this['Trunk']=_0x1e6890[_0x4993('0xd')]?_0x1e6890[_0x4993('0xd')]:undefined;this[_0x4993('0xe')]=_0x1e6890[_0x4993('0xe')];this['key']=_0x1e6890[_0x4993('0xf')];}module[_0x4993('0x10')]=FaxAccount; \ No newline at end of file +var _0x6c58=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x30be6c,_0x2a2b7f){var _0x3f0d96=function(_0x3f82f8){while(--_0x3f82f8){_0x30be6c['push'](_0x30be6c['shift']());}};_0x3f0d96(++_0x2a2b7f);}(_0x6c58,0x1ef));var _0x86c5=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x6c58[_0x494d1f];return _0x457b6e;};'use strict';function FaxAccount(_0x8f9084){this['id']=_0x8f9084['id']||0x0;this[_0x86c5('0x0')]=_0x8f9084[_0x86c5('0x0')]||'';this[_0x86c5('0x1')]=_0x8f9084['description'];this[_0x86c5('0x2')]=_0x8f9084['ecm'];this['headerinfo']=_0x8f9084[_0x86c5('0x3')];this[_0x86c5('0x4')]=_0x8f9084[_0x86c5('0x4')];this[_0x86c5('0x5')]=_0x8f9084[_0x86c5('0x5')]||0x960;this[_0x86c5('0x6')]=_0x8f9084[_0x86c5('0x6')]||0x3840;this[_0x86c5('0x7')]=_0x8f9084['modem']||_0x86c5('0x8');this[_0x86c5('0x9')]=_0x8f9084['gateway']||'no';this[_0x86c5('0xa')]=_0x8f9084[_0x86c5('0xa')]||'no';this['t38timeout']=_0x8f9084[_0x86c5('0xb')]||0x1388;this[_0x86c5('0xc')]=_0x8f9084[_0x86c5('0xc')]||_0x86c5('0xd');this['Trunk']=_0x8f9084['Trunk']?_0x8f9084[_0x86c5('0xe')]:undefined;this[_0x86c5('0xf')]=_0x8f9084[_0x86c5('0xf')];this[_0x86c5('0x10')]=_0x8f9084[_0x86c5('0x10')];}module[_0x86c5('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 874a346..865a349 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 _0x3eed=['token','remoteUri','serverUrl','Configurations','name','username'];(function(_0x375b32,_0x5c19b9){var _0x4e6982=function(_0xa3a503){while(--_0xa3a503){_0x375b32['push'](_0x375b32['shift']());}};_0x4e6982(++_0x5c19b9);}(_0x3eed,0x1b4));var _0xd3ee=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3eed[_0x3ab51d];return _0x29a04e;};'use strict';function FreshdeskAccount(_0x56512d){this['id']=_0x56512d['id']||0x0;this['name']=_0x56512d[_0xd3ee('0x0')]||'';this[_0xd3ee('0x1')]=_0x56512d['username']||'';this['apiKey']=_0x56512d[_0xd3ee('0x2')]||'';this[_0xd3ee('0x3')]=_0x56512d[_0xd3ee('0x3')]||'';this[_0xd3ee('0x4')]=_0x56512d[_0xd3ee('0x4')]||'';this['Configurations']=_0x56512d[_0xd3ee('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x7366=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x1ab1f6,_0x2514c0){var _0x4ff83e=function(_0x1afc93){while(--_0x1afc93){_0x1ab1f6['push'](_0x1ab1f6['shift']());}};_0x4ff83e(++_0x2514c0);}(_0x7366,0x1e2));var _0x6736=function(_0x41be5e,_0x179575){_0x41be5e=_0x41be5e-0x0;var _0x32cdee=_0x7366[_0x41be5e];return _0x32cdee;};'use strict';function FreshdeskAccount(_0x4d4d5b){this['id']=_0x4d4d5b['id']||0x0;this[_0x6736('0x0')]=_0x4d4d5b['name']||'';this[_0x6736('0x1')]=_0x4d4d5b[_0x6736('0x1')]||'';this[_0x6736('0x2')]=_0x4d4d5b[_0x6736('0x3')]||'';this[_0x6736('0x4')]=_0x4d4d5b[_0x6736('0x4')]||'';this[_0x6736('0x5')]=_0x4d4d5b[_0x6736('0x5')]||'';this[_0x6736('0x6')]=_0x4d4d5b[_0x6736('0x6')]||{};}module[_0x6736('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 72cedf0..608bc4e 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 _0x2a69=['name','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x2b2dbd,_0x3c294e){var _0x2dde0c=function(_0x3ffbdc){while(--_0x3ffbdc){_0x2b2dbd['push'](_0x2b2dbd['shift']());}};_0x2dde0c(++_0x3c294e);}(_0x2a69,0x120));var _0x92a6=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2a69[_0x2c91e9];return _0x13f0ff;};'use strict';function FreshsalesAccount(_0x56b92f){this['id']=_0x56b92f['id']||0x0;this[_0x92a6('0x0')]=_0x56b92f[_0x92a6('0x0')]||'';this[_0x92a6('0x1')]=_0x56b92f[_0x92a6('0x1')]||'';this[_0x92a6('0x2')]=_0x56b92f['token']||'';this['remoteUri']=_0x56b92f[_0x92a6('0x3')]||'';this[_0x92a6('0x4')]=_0x56b92f[_0x92a6('0x4')]||'';this['Configurations']=_0x56b92f[_0x92a6('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xaed4=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4f0d87,_0x25662a){var _0x1893b3=function(_0x45207c){while(--_0x45207c){_0x4f0d87['push'](_0x4f0d87['shift']());}};_0x1893b3(++_0x25662a);}(_0xaed4,0xf4));var _0x4aed=function(_0x39919d,_0x3e7cb7){_0x39919d=_0x39919d-0x0;var _0x4e71fa=_0xaed4[_0x39919d];return _0x4e71fa;};'use strict';function FreshsalesAccount(_0x3614b5){this['id']=_0x3614b5['id']||0x0;this['name']=_0x3614b5[_0x4aed('0x0')]||'';this[_0x4aed('0x1')]=_0x3614b5[_0x4aed('0x1')]||'';this[_0x4aed('0x2')]=_0x3614b5['token']||'';this[_0x4aed('0x3')]=_0x3614b5[_0x4aed('0x3')]||'';this[_0x4aed('0x4')]=_0x3614b5[_0x4aed('0x4')]||'';this[_0x4aed('0x5')]=_0x3614b5['Configurations']||{};}module[_0x4aed('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index f6b90c1..0ed3b05 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 _0x5ac0=['queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','holdtime','assigned','mohtime','variables','exports','inbound','uniqueid','queue','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x5ac0,0x19d));var _0x05ac=function(_0x2b3977,_0x7d6722){_0x2b3977=_0x2b3977-0x0;var _0x45388b=_0x5ac0[_0x2b3977];return _0x45388b;};'use strict';function QueueReport(){this['type']=_0x05ac('0x0');this[_0x05ac('0x1')]='';this['calleridnum']='';this['calleridname']='';this[_0x05ac('0x2')]='';this['queuecallerjoinAt']=null;this[_0x05ac('0x3')]=null;this['position']=0x1;this[_0x05ac('0x4')]=0x1;this[_0x05ac('0x5')]=![];this[_0x05ac('0x6')]=null;this[_0x05ac('0x7')]=![];this[_0x05ac('0x8')]=null;this[_0x05ac('0x9')]=![];this[_0x05ac('0xa')]=null;this[_0x05ac('0xb')]=0x1;this['channel']='';this[_0x05ac('0xc')]='';this[_0x05ac('0xd')]='';this[_0x05ac('0xe')]='';this['context']='';this['exten']='';this['priority']='';this[_0x05ac('0xf')]=0x0;this[_0x05ac('0x10')]=![];this['lastAssignedTo']='';this[_0x05ac('0x11')]=0x0;this[_0x05ac('0x12')]={};}module[_0x05ac('0x13')]=QueueReport; \ No newline at end of file +var _0x1aed=['connectedlinenum','connectedlinename','accountcode','context','exten','priority','assigned','variables','exports','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt'];(function(_0x81e6e2,_0x3565ca){var _0x56bb71=function(_0x49c2b7){while(--_0x49c2b7){_0x81e6e2['push'](_0x81e6e2['shift']());}};_0x56bb71(++_0x3565ca);}(_0x1aed,0x121));var _0xd1ae=function(_0x394b06,_0xc21d27){_0x394b06=_0x394b06-0x0;var _0x727ed2=_0x1aed[_0x394b06];return _0x727ed2;};'use strict';function QueueReport(){this['type']='inbound';this['uniqueid']='';this[_0xd1ae('0x0')]='';this[_0xd1ae('0x1')]='';this[_0xd1ae('0x2')]='';this[_0xd1ae('0x3')]=null;this[_0xd1ae('0x4')]=null;this[_0xd1ae('0x5')]=0x1;this['count']=0x1;this[_0xd1ae('0x6')]=![];this['queuecallerabandonAt']=null;this[_0xd1ae('0x7')]=![];this[_0xd1ae('0x8')]=null;this[_0xd1ae('0x9')]=![];this[_0xd1ae('0xa')]=null;this['originalposition']=0x1;this['channel']='';this[_0xd1ae('0xb')]='';this[_0xd1ae('0xc')]='';this[_0xd1ae('0xd')]='';this[_0xd1ae('0xe')]='';this[_0xd1ae('0xf')]='';this[_0xd1ae('0x10')]='';this['holdtime']=0x0;this[_0xd1ae('0x11')]=![];this['lastAssignedTo']='';this['mohtime']=0x0;this[_0xd1ae('0x12')]={};}module[_0xd1ae('0x13')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index ed90979..d9f8e45 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 _0x1171=['serverUrl','Configurations','exports','username','remoteUri','password','clientId','clientSecret','securityToken','integrationTab'];(function(_0x5b7ead,_0x33f76c){var _0x4bf513=function(_0x56adff){while(--_0x56adff){_0x5b7ead['push'](_0x5b7ead['shift']());}};_0x4bf513(++_0x33f76c);}(_0x1171,0x1e3));var _0x1117=function(_0x1a50a6,_0x400207){_0x1a50a6=_0x1a50a6-0x0;var _0x9cd101=_0x1171[_0x1a50a6];return _0x9cd101;};'use strict';function SalesforceAccount(_0x3ce6cd){this['id']=_0x3ce6cd['id']||0x0;this['name']=_0x3ce6cd['name']||'';this[_0x1117('0x0')]=_0x3ce6cd['username']||'';this['remoteUri']=_0x3ce6cd[_0x1117('0x1')]||'';this[_0x1117('0x2')]=_0x3ce6cd[_0x1117('0x2')]||'';this['clientId']=_0x3ce6cd[_0x1117('0x3')]||'';this[_0x1117('0x4')]=_0x3ce6cd[_0x1117('0x4')]||'';this[_0x1117('0x5')]=_0x3ce6cd[_0x1117('0x5')]||'';this['type']=_0x3ce6cd['type']||_0x1117('0x6');this[_0x1117('0x7')]=_0x3ce6cd[_0x1117('0x7')]||'';this[_0x1117('0x8')]=_0x3ce6cd[_0x1117('0x8')]||{};}module[_0x1117('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x9289=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','Configurations','exports'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x9289,0x1ae));var _0x9928=function(_0x414381,_0x59ae8a){_0x414381=_0x414381-0x0;var _0x4e66ad=_0x9289[_0x414381];return _0x4e66ad;};'use strict';function SalesforceAccount(_0x41f766){this['id']=_0x41f766['id']||0x0;this['name']=_0x41f766['name']||'';this[_0x9928('0x0')]=_0x41f766[_0x9928('0x0')]||'';this[_0x9928('0x1')]=_0x41f766[_0x9928('0x1')]||'';this[_0x9928('0x2')]=_0x41f766[_0x9928('0x2')]||'';this[_0x9928('0x3')]=_0x41f766[_0x9928('0x3')]||'';this['clientSecret']=_0x41f766[_0x9928('0x4')]||'';this['securityToken']=_0x41f766[_0x9928('0x5')]||'';this[_0x9928('0x6')]=_0x41f766[_0x9928('0x6')]||_0x9928('0x7');this['serverUrl']=_0x41f766['serverUrl']||'';this[_0x9928('0x8')]=_0x41f766[_0x9928('0x8')]||{};}module[_0x9928('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 0556eee..15adec7 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 _0x1260=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1cea91,_0x156c8e){var _0x501e60=function(_0x17a2c4){while(--_0x17a2c4){_0x1cea91['push'](_0x1cea91['shift']());}};_0x501e60(++_0x156c8e);}(_0x1260,0x15d));var _0x0126=function(_0x21dd73,_0x11aaaa){_0x21dd73=_0x21dd73-0x0;var _0x4684ab=_0x1260[_0x21dd73];return _0x4684ab;};'use strict';function ServicenowAccount(_0x42c951){this['id']=_0x42c951['id']||0x0;this[_0x0126('0x0')]=_0x42c951['name']||'';this[_0x0126('0x1')]=_0x42c951['username']||'';this[_0x0126('0x2')]=_0x42c951['password']||'';this['remoteUri']=_0x42c951[_0x0126('0x3')]||'';this[_0x0126('0x4')]=_0x42c951[_0x0126('0x4')]||'';this[_0x0126('0x5')]=_0x42c951['Configurations']||{};}module[_0x0126('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xc159=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xc159,0x1a6));var _0x9c15=function(_0x57ac3b,_0x32e884){_0x57ac3b=_0x57ac3b-0x0;var _0x4204c9=_0xc159[_0x57ac3b];return _0x4204c9;};'use strict';function ServicenowAccount(_0x5f5005){this['id']=_0x5f5005['id']||0x0;this[_0x9c15('0x0')]=_0x5f5005['name']||'';this[_0x9c15('0x1')]=_0x5f5005['username']||'';this['password']=_0x5f5005[_0x9c15('0x2')]||'';this['remoteUri']=_0x5f5005[_0x9c15('0x3')]||'';this[_0x9c15('0x4')]=_0x5f5005[_0x9c15('0x4')]||'';this[_0x9c15('0x5')]=_0x5f5005[_0x9c15('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 7ceae0f..c973d56 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 _0x11df=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0x11df,0x9e));var _0xf11d=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x11df[_0x5608a3];return _0x1ed50a;};'use strict';function SugarcrmAccount(_0x3d5ab8){this['id']=_0x3d5ab8['id']||0x0;this['name']=_0x3d5ab8[_0xf11d('0x0')]||'';this['username']=_0x3d5ab8[_0xf11d('0x1')]||'';this[_0xf11d('0x2')]=_0x3d5ab8[_0xf11d('0x2')]||'';this[_0xf11d('0x3')]=_0x3d5ab8[_0xf11d('0x3')]||'';this[_0xf11d('0x4')]=_0x3d5ab8[_0xf11d('0x4')]||'';this[_0xf11d('0x5')]=_0x3d5ab8[_0xf11d('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xf4e6=['Configurations','exports','name','password','remoteUri','serverUrl'];(function(_0x57e113,_0x502ce5){var _0x32681f=function(_0x5e29c8){while(--_0x5e29c8){_0x57e113['push'](_0x57e113['shift']());}};_0x32681f(++_0x502ce5);}(_0xf4e6,0x1ca));var _0x6f4e=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0xf4e6[_0x27beea];return _0x122645;};'use strict';function SugarcrmAccount(_0x8adce3){this['id']=_0x8adce3['id']||0x0;this[_0x6f4e('0x0')]=_0x8adce3['name']||'';this['username']=_0x8adce3['username']||'';this[_0x6f4e('0x1')]=_0x8adce3[_0x6f4e('0x1')]||'';this[_0x6f4e('0x2')]=_0x8adce3[_0x6f4e('0x2')]||'';this[_0x6f4e('0x3')]=_0x8adce3[_0x6f4e('0x3')]||'';this[_0x6f4e('0x4')]=_0x8adce3[_0x6f4e('0x4')]||{};}module[_0x6f4e('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 3d89914..113ca85 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 _0x8432=['exports','name','accountcode','state','unknown','stateTime','status'];(function(_0x453a8d,_0x4fb835){var _0x3c8817=function(_0x36f438){while(--_0x36f438){_0x453a8d['push'](_0x453a8d['shift']());}};_0x3c8817(++_0x4fb835);}(_0x8432,0x135));var _0x2843=function(_0x1c289a,_0x277fe7){_0x1c289a=_0x1c289a-0x0;var _0x28d68e=_0x8432[_0x1c289a];return _0x28d68e;};'use strict';function Telephone(_0x3389ab){this['id']=_0x3389ab['id']||0x0;this[_0x2843('0x0')]=_0x3389ab['name']||'';this[_0x2843('0x1')]=_0x3389ab['accountcode']||'';this[_0x2843('0x2')]=_0x2843('0x3');this[_0x2843('0x4')]=0x0;this[_0x2843('0x5')]=_0x2843('0x3');this['address']='';}module[_0x2843('0x6')]=Telephone; \ No newline at end of file +var _0x32b6=['state','unknown','stateTime','status','exports','name','accountcode'];(function(_0x3caa0b,_0xc80598){var _0x773a29=function(_0x59c779){while(--_0x59c779){_0x3caa0b['push'](_0x3caa0b['shift']());}};_0x773a29(++_0xc80598);}(_0x32b6,0x194));var _0x632b=function(_0x5029b5,_0x4aea11){_0x5029b5=_0x5029b5-0x0;var _0x20ae3c=_0x32b6[_0x5029b5];return _0x20ae3c;};'use strict';function Telephone(_0x3ebc6e){this['id']=_0x3ebc6e['id']||0x0;this[_0x632b('0x0')]=_0x3ebc6e[_0x632b('0x0')]||'';this[_0x632b('0x1')]=_0x3ebc6e[_0x632b('0x1')]||'';this[_0x632b('0x2')]=_0x632b('0x3');this[_0x632b('0x4')]=0x0;this[_0x632b('0x5')]=_0x632b('0x3');this['address']='';}module[_0x632b('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 5115d97..cb5f7de 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 _0x9b96=['name','html','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9b96,0x183));var _0x69b9=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x9b96[_0x42245d];return _0x4b211a;};'use strict';function template(_0x220c06){this['id']=_0x220c06['id']||0x0;this['name']=_0x220c06[_0x69b9('0x0')]||'';this['html']=_0x220c06[_0x69b9('0x1')]||'';}module[_0x69b9('0x2')]=template; \ No newline at end of file +var _0x7166=['html','name'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0x7166,0x127));var _0x6716=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x7166[_0x35d4e9];return _0x5c2770;};'use strict';function template(_0x3154f3){this['id']=_0x3154f3['id']||0x0;this[_0x6716('0x0')]=_0x3154f3['name']||'';this['html']=_0x3154f3[_0x6716('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 fa21621..b9a4abf 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['voice','status','AllConditions','AnyConditions','Actions','exports','name','channel'];(function(_0x1bc8c5,_0x33cc8c){var _0x25062d=function(_0x30acd6){while(--_0x30acd6){_0x1bc8c5['push'](_0x1bc8c5['shift']());}};_0x25062d(++_0x33cc8c);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x26dfc5,_0x138166){_0x26dfc5=_0x26dfc5-0x0;var _0x566350=_0xf3cd[_0x26dfc5];return _0x566350;};'use strict';function Trigger(_0x13cb67){this['id']=_0x13cb67['id']||0x0;this[_0xdf3c('0x0')]=_0x13cb67[_0xdf3c('0x0')]||'';this[_0xdf3c('0x1')]=_0x13cb67[_0xdf3c('0x1')]||_0xdf3c('0x2');this['status']=_0x13cb67[_0xdf3c('0x3')]||![];this[_0xdf3c('0x4')]=_0x13cb67[_0xdf3c('0x4')]||[];this['AnyConditions']=_0x13cb67[_0xdf3c('0x5')]||[];this[_0xdf3c('0x6')]=_0x13cb67[_0xdf3c('0x6')]||[];}module[_0xdf3c('0x7')]=Trigger; \ No newline at end of file +var _0x00bb=['status','AllConditions','AnyConditions','exports','name','channel'];(function(_0x32fe72,_0x1fd6dd){var _0x1ebeeb=function(_0x2e871f){while(--_0x2e871f){_0x32fe72['push'](_0x32fe72['shift']());}};_0x1ebeeb(++_0x1fd6dd);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x00bb[_0x3054be];return _0x3df150;};'use strict';function Trigger(_0x4b870b){this['id']=_0x4b870b['id']||0x0;this[_0xb00b('0x0')]=_0x4b870b[_0xb00b('0x0')]||'';this['channel']=_0x4b870b[_0xb00b('0x1')]||'voice';this[_0xb00b('0x2')]=_0x4b870b[_0xb00b('0x2')]||![];this['AllConditions']=_0x4b870b[_0xb00b('0x3')]||[];this[_0xb00b('0x4')]=_0x4b870b['AnyConditions']||[];this['Actions']=_0x4b870b['Actions']||[];}module[_0xb00b('0x5')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index aa7840a..73a44f9 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 _0xa468=['registrationtime','address','exports','active','name','state','unknown','stateTime','status','registry','host','port','domain','refresh','stateRegistry'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa468,0x1e3));var _0x8a46=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xa468[_0x1d1779];return _0x2377e9;};'use strict';function Trunk(_0x5e4814){this['id']=_0x5e4814['id']||0x0;this['active']=_0x5e4814[_0x8a46('0x0')]||![];this[_0x8a46('0x1')]=_0x5e4814['name']||'';this[_0x8a46('0x2')]=_0x8a46('0x3');this[_0x8a46('0x4')]=0x0;this[_0x8a46('0x5')]=_0x8a46('0x3');this['registry']=_0x5e4814['registry']&&_0x5e4814[_0x8a46('0x6')]['indexOf'](':')?_0x5e4814[_0x8a46('0x6')]['split'](':')[0x0]:'';this[_0x8a46('0x7')]='';this[_0x8a46('0x8')]='';this[_0x8a46('0x9')]='';this['domainport']='';this[_0x8a46('0xa')]='';this[_0x8a46('0xb')]=_0x8a46('0x3');this[_0x8a46('0xc')]='';this[_0x8a46('0xd')]='';}module[_0x8a46('0xe')]=Trunk; \ No newline at end of file +var _0xfddb=['state','stateTime','status','unknown','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','address','exports','active','name'];(function(_0x47112c,_0x1db348){var _0x17609b=function(_0x495d8f){while(--_0x495d8f){_0x47112c['push'](_0x47112c['shift']());}};_0x17609b(++_0x1db348);}(_0xfddb,0x174));var _0xbfdd=function(_0x173b28,_0x542b14){_0x173b28=_0x173b28-0x0;var _0x255939=_0xfddb[_0x173b28];return _0x255939;};'use strict';function Trunk(_0x30c88b){this['id']=_0x30c88b['id']||0x0;this[_0xbfdd('0x0')]=_0x30c88b['active']||![];this[_0xbfdd('0x1')]=_0x30c88b[_0xbfdd('0x1')]||'';this[_0xbfdd('0x2')]='unknown';this[_0xbfdd('0x3')]=0x0;this[_0xbfdd('0x4')]=_0xbfdd('0x5');this[_0xbfdd('0x6')]=_0x30c88b[_0xbfdd('0x6')]&&_0x30c88b[_0xbfdd('0x6')][_0xbfdd('0x7')](':')?_0x30c88b[_0xbfdd('0x6')][_0xbfdd('0x8')](':')[0x0]:'';this[_0xbfdd('0x9')]='';this[_0xbfdd('0xa')]='';this[_0xbfdd('0xb')]='';this[_0xbfdd('0xc')]='';this[_0xbfdd('0xd')]='';this[_0xbfdd('0xe')]='unknown';this['registrationtime']='';this[_0xbfdd('0xf')]='';}module[_0xbfdd('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 3fc580b..68fffa4 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 _0xa1e8=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xa1e8,0x1c6));var _0x8a1e=function(_0x171f48,_0x167a53){_0x171f48=_0x171f48-0x0;var _0xc8d0=_0xa1e8[_0x171f48];return _0xc8d0;};'use strict';function voiceExtension(_0x4416ff){this['id']=_0x4416ff['id']||0x0;this[_0x8a1e('0x0')]=_0x4416ff[_0x8a1e('0x0')]||'';this[_0x8a1e('0x1')]=_0x4416ff[_0x8a1e('0x1')]||_0x8a1e('0x2');this[_0x8a1e('0x3')]=_0x4416ff[_0x8a1e('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x9fc0=['mandatoryDisposition','exports','recordingFormat'];(function(_0x212b8f,_0x1dc017){var _0x39c20f=function(_0x30d9c7){while(--_0x30d9c7){_0x212b8f['push'](_0x212b8f['shift']());}};_0x39c20f(++_0x1dc017);}(_0x9fc0,0x16d));var _0x09fc=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0x9fc0[_0x406e46];return _0x4a3742;};'use strict';function voiceExtension(_0x49d473){this['id']=_0x49d473['id']||0x0;this['exten']=_0x49d473['exten']||'';this[_0x09fc('0x0')]=_0x49d473[_0x09fc('0x0')]||'none';this[_0x09fc('0x1')]=_0x49d473[_0x09fc('0x1')]||![];}module[_0x09fc('0x2')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index b04fcb9..9adbbb0 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 _0xd4bf=['dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','queueStatusComplete','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','unavailable','ringing','ringinuse','onhold','wav49','gsm','rrmemory','roundrobin','name','type','inbound','talking','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xd4bf,0x147));var _0xfd4b=function(_0x59fd38,_0x5f1ef3){_0x59fd38=_0x59fd38-0x0;var _0x552d59=_0xd4bf[_0x59fd38];return _0x552d59;};'use strict';var statusDesc=[_0xfd4b('0x0'),_0xfd4b('0x1'),'inuse',_0xfd4b('0x2'),'invalid',_0xfd4b('0x3'),_0xfd4b('0x4'),_0xfd4b('0x5'),_0xfd4b('0x6')];var monitorFormat={'wav':'wav','wav49':_0xfd4b('0x7'),'gsm':_0xfd4b('0x8')};var strategy={'rrmemory':_0xfd4b('0x9'),'roundrobin':_0xfd4b('0xa')};function VoiceQueue(_0x28d19d){this['id']=_0x28d19d['id']||0x0;this[_0xfd4b('0xb')]=_0x28d19d['name']||'';this['monitor_format']=_0x28d19d['monitor_format']||'';this[_0xfd4b('0xc')]=_0x28d19d['type']||_0xfd4b('0xd');this['waiting']=0x0;this[_0xfd4b('0xe')]=0x0;this[_0xfd4b('0xf')]=0x0;this[_0xfd4b('0x10')]=0x0;this['sumDuration']=0x0;this[_0xfd4b('0x11')]=0x0;this[_0xfd4b('0x12')]=0x0;this[_0xfd4b('0x13')]=0x0;this[_0xfd4b('0x14')]=0x0;this[_0xfd4b('0x15')]=0x0;this['available']=0x0;this[_0xfd4b('0x16')]=_0x28d19d[_0xfd4b('0x16')]||![];this['acwTimeout']=_0x28d19d[_0xfd4b('0x17')]||0xa;this[_0xfd4b('0x18')]=_0x28d19d['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0xfd4b('0x19')]='';this[_0xfd4b('0x1a')]=0x0;this['temp']=0x0;this[_0xfd4b('0x1b')]=_0x28d19d[_0xfd4b('0x1b')]||null;this[_0xfd4b('0x1c')]=_0x28d19d['dialGlobalInterval']?_0x28d19d[_0xfd4b('0x1c')]:null;this[_0xfd4b('0x1d')]=_0x28d19d[_0xfd4b('0x1d')];this[_0xfd4b('0x1e')]=_0x28d19d[_0xfd4b('0x1e')]||_0xfd4b('0x1f');this[_0xfd4b('0x20')]=_0x28d19d[_0xfd4b('0x20')]||0x0;this[_0xfd4b('0x21')]=_0x28d19d[_0xfd4b('0x21')]||0x0;this['dialPowerLevel']=_0x28d19d[_0xfd4b('0x22')]||0x1;this[_0xfd4b('0x23')]=_0x28d19d[_0xfd4b('0x23')]||_0xfd4b('0x24');this[_0xfd4b('0x25')]=_0x28d19d[_0xfd4b('0x25')]||0.03;this['dialPredictiveInterval']=_0x28d19d[_0xfd4b('0x26')]||0x258;this[_0xfd4b('0x27')]=_0x28d19d[_0xfd4b('0x27')]||_0xfd4b('0x28');this[_0xfd4b('0x29')]=_0x28d19d[_0xfd4b('0x29')]||'anonymous';this[_0xfd4b('0x2a')]=_0x28d19d['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x28d19d[_0xfd4b('0x2b')]||_0xfd4b('0x2c');this[_0xfd4b('0x2d')]=_0x28d19d[_0xfd4b('0x2d')]||0x3;this[_0xfd4b('0x2e')]=_0x28d19d[_0xfd4b('0x2e')]||undefined;this['dialCongestionMaxRetry']=_0x28d19d[_0xfd4b('0x2f')]||0x3;this[_0xfd4b('0x30')]=_0x28d19d[_0xfd4b('0x30')]||0x96;this[_0xfd4b('0x31')]=_0x28d19d[_0xfd4b('0x31')]||0x3;this[_0xfd4b('0x32')]=_0x28d19d[_0xfd4b('0x32')]||0x96;this[_0xfd4b('0x33')]=_0x28d19d[_0xfd4b('0x33')]||0x3;this[_0xfd4b('0x34')]=_0x28d19d[_0xfd4b('0x34')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x28d19d['dialNoSuchNumberMaxRetry']||0x3;this[_0xfd4b('0x35')]=_0x28d19d[_0xfd4b('0x35')]||0x96;this[_0xfd4b('0x36')]=_0x28d19d['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x28d19d[_0xfd4b('0x37')]||0x96;this[_0xfd4b('0x38')]=_0x28d19d[_0xfd4b('0x38')]||0x3;this[_0xfd4b('0x39')]=_0x28d19d[_0xfd4b('0x39')]||0x96;this['dialMachineMaxRetry']=_0x28d19d[_0xfd4b('0x3a')]||0x3;this[_0xfd4b('0x3b')]=_0x28d19d['dialMachineRetryFrequency']||0x96;this[_0xfd4b('0x3c')]=_0x28d19d[_0xfd4b('0x3c')]||0x3;this[_0xfd4b('0x3d')]=_0x28d19d['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x28d19d[_0xfd4b('0x3e')]||0x4;this[_0xfd4b('0x3f')]=_0x28d19d[_0xfd4b('0x3f')]?_0x28d19d[_0xfd4b('0x3f')]:undefined;this[_0xfd4b('0x40')]=_0x28d19d[_0xfd4b('0x40')]?_0x28d19d[_0xfd4b('0x40')]:undefined;this[_0xfd4b('0x41')]=_0x28d19d[_0xfd4b('0x41')]||undefined;this['Interval']=_0x28d19d[_0xfd4b('0x42')]?_0x28d19d[_0xfd4b('0x42')]:undefined;this[_0xfd4b('0x43')]=_0x28d19d[_0xfd4b('0x43')]||_0xfd4b('0x44');this['dialRandomLastDigitCallerIdNumber']=_0x28d19d['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xfd4b('0x45')]=_0x28d19d['dialCutDigit']||undefined;this[_0xfd4b('0x46')]=strategy[_0x28d19d[_0xfd4b('0x46')]]||_0xfd4b('0x9');this[_0xfd4b('0x47')]=!![];this['dialAMDActive']=_0x28d19d['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x28d19d['dialAMDInitialSilence'];this[_0xfd4b('0x48')]=_0x28d19d[_0xfd4b('0x48')];this[_0xfd4b('0x49')]=_0x28d19d[_0xfd4b('0x49')];this[_0xfd4b('0x4a')]=_0x28d19d[_0xfd4b('0x4a')];this[_0xfd4b('0x4b')]=_0x28d19d[_0xfd4b('0x4b')];this['dialAMDBetweenWordsSilence']=_0x28d19d[_0xfd4b('0x4c')];this[_0xfd4b('0x4d')]=_0x28d19d['dialAMDMaximumNumberOfWords'];this[_0xfd4b('0x4e')]=_0x28d19d[_0xfd4b('0x4e')];this[_0xfd4b('0x4f')]=_0x28d19d[_0xfd4b('0x4f')];this[_0xfd4b('0x50')]=0x0;this[_0xfd4b('0x51')]=0x0;this[_0xfd4b('0x52')]=_0x28d19d['timeout'];this[_0xfd4b('0x53')]=0x0;this[_0xfd4b('0x54')]=0x0;this[_0xfd4b('0x55')]=0x0;this[_0xfd4b('0x56')]=0x0;this[_0xfd4b('0x57')]=0x0;this[_0xfd4b('0x58')]=0x0;this[_0xfd4b('0x59')]=0x0;this[_0xfd4b('0x5a')]=0x0;this[_0xfd4b('0x5b')]=0x0;this[_0xfd4b('0x5c')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xfd4b('0x5d')]=0x0;this[_0xfd4b('0x5e')]=0x0;this[_0xfd4b('0x5f')]=0x0;this[_0xfd4b('0x60')]=undefined;this['startPredictive']=undefined;this[_0xfd4b('0x61')]=undefined;this[_0xfd4b('0x62')]=1.05;this[_0xfd4b('0x63')]=0x0;this[_0xfd4b('0x64')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xfd4b('0x65')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0xfd4b('0x66')]=0x0;this[_0xfd4b('0x67')]=_0x28d19d[_0xfd4b('0x68')]||0x14;this[_0xfd4b('0x69')]=_0x28d19d[_0xfd4b('0x68')]||0xa;this[_0xfd4b('0x6a')]=0x0;this[_0xfd4b('0x6b')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xfd4b('0x6c')]=0x0;this[_0xfd4b('0x6d')]=0x0;this[_0xfd4b('0x6e')]=0x0;this[_0xfd4b('0x6f')]=0x0;this[_0xfd4b('0x70')]=_0x28d19d['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x28d19d[_0xfd4b('0x71')]||![];this[_0xfd4b('0x72')]=_0x28d19d['dialQueueProject2']||undefined;this[_0xfd4b('0x73')]=_0x28d19d[_0xfd4b('0x73')]||![];this[_0xfd4b('0x74')]=_0x28d19d[_0xfd4b('0x74')]||![];this[_0xfd4b('0x75')]=monitorFormat[_0x28d19d[_0xfd4b('0x75')]]?monitorFormat[_0x28d19d['monitor_format']]:undefined;this[_0xfd4b('0x76')]=_0x28d19d[_0xfd4b('0x76')]||![];this['mandatoryDispositionPause']=_0x28d19d[_0xfd4b('0x77')]?_0x28d19d[_0xfd4b('0x77')]:undefined;}module[_0xfd4b('0x78')]=VoiceQueue; \ No newline at end of file +var _0x5dcf=['dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','invalid','unavailable','ringing','ringinuse','wav','gsm','name','monitor_format','type','inbound','waiting','talking','total','answered','sumBillable','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry'];(function(_0x12e5b4,_0x120d54){var _0x5c42a0=function(_0x4e490a){while(--_0x4e490a){_0x12e5b4['push'](_0x12e5b4['shift']());}};_0x5c42a0(++_0x120d54);}(_0x5dcf,0x19e));var _0xf5dc=function(_0x58b96a,_0x36e565){_0x58b96a=_0x58b96a-0x0;var _0x2ba258=_0x5dcf[_0x58b96a];return _0x2ba258;};'use strict';var statusDesc=[_0xf5dc('0x0'),'not_inuse',_0xf5dc('0x1'),_0xf5dc('0x2'),_0xf5dc('0x3'),_0xf5dc('0x4'),_0xf5dc('0x5'),_0xf5dc('0x6'),'onhold'];var monitorFormat={'wav':_0xf5dc('0x7'),'wav49':'wav49','gsm':_0xf5dc('0x8')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x471582){this['id']=_0x471582['id']||0x0;this[_0xf5dc('0x9')]=_0x471582['name']||'';this['monitor_format']=_0x471582[_0xf5dc('0xa')]||'';this[_0xf5dc('0xb')]=_0x471582[_0xf5dc('0xb')]||_0xf5dc('0xc');this[_0xf5dc('0xd')]=0x0;this[_0xf5dc('0xe')]=0x0;this[_0xf5dc('0xf')]=0x0;this[_0xf5dc('0x10')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0xf5dc('0x11')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0xf5dc('0x12')]=0x0;this[_0xf5dc('0x13')]=0x0;this[_0xf5dc('0x14')]=_0x471582[_0xf5dc('0x14')]||![];this[_0xf5dc('0x15')]=_0x471582[_0xf5dc('0x15')]||0xa;this[_0xf5dc('0x16')]=_0x471582['autopause']||'no';this[_0xf5dc('0x17')]=!![];this[_0xf5dc('0x18')]='';this[_0xf5dc('0x19')]=0x0;this[_0xf5dc('0x1a')]=0x0;this[_0xf5dc('0x1b')]=_0x471582[_0xf5dc('0x1b')]||null;this['dialGlobalInterval']=_0x471582[_0xf5dc('0x1c')]?_0x471582[_0xf5dc('0x1c')]:null;this[_0xf5dc('0x1d')]=_0x471582[_0xf5dc('0x1d')];this['dialMethod']=_0x471582[_0xf5dc('0x1e')]||_0xf5dc('0x1f');this['dialLimitChannel']=_0x471582[_0xf5dc('0x20')]||0x0;this[_0xf5dc('0x21')]=_0x471582[_0xf5dc('0x21')]||0x0;this[_0xf5dc('0x22')]=_0x471582[_0xf5dc('0x22')]||0x1;this[_0xf5dc('0x23')]=_0x471582[_0xf5dc('0x23')]||_0xf5dc('0x24');this[_0xf5dc('0x25')]=_0x471582[_0xf5dc('0x25')]||0.03;this[_0xf5dc('0x26')]=_0x471582[_0xf5dc('0x26')]||0x258;this[_0xf5dc('0x27')]=_0x471582['dialOriginateCallerIdName']||_0xf5dc('0x28');this[_0xf5dc('0x29')]=_0x471582['dialOriginateCallerIdNumber']||_0xf5dc('0x28');this[_0xf5dc('0x2a')]=_0x471582['dialOriginateTimeout']||0x1e;this[_0xf5dc('0x2b')]=_0x471582['dialQueueOptions']||_0xf5dc('0x2c');this[_0xf5dc('0x2d')]=_0x471582['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x471582[_0xf5dc('0x2e')]||undefined;this['dialCongestionMaxRetry']=_0x471582[_0xf5dc('0x2f')]||0x3;this[_0xf5dc('0x30')]=_0x471582[_0xf5dc('0x30')]||0x96;this[_0xf5dc('0x31')]=_0x471582['dialBusyMaxRetry']||0x3;this[_0xf5dc('0x32')]=_0x471582[_0xf5dc('0x32')]||0x96;this['dialNoAnswerMaxRetry']=_0x471582[_0xf5dc('0x33')]||0x3;this[_0xf5dc('0x34')]=_0x471582[_0xf5dc('0x34')]||0x96;this[_0xf5dc('0x35')]=_0x471582[_0xf5dc('0x35')]||0x3;this[_0xf5dc('0x36')]=_0x471582[_0xf5dc('0x36')]||0x96;this[_0xf5dc('0x37')]=_0x471582['dialDropMaxRetry']||0x3;this[_0xf5dc('0x38')]=_0x471582[_0xf5dc('0x38')]||0x96;this[_0xf5dc('0x39')]=_0x471582[_0xf5dc('0x39')]||0x3;this[_0xf5dc('0x3a')]=_0x471582['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x471582['dialMachineMaxRetry']||0x3;this[_0xf5dc('0x3b')]=_0x471582[_0xf5dc('0x3b')]||0x96;this[_0xf5dc('0x3c')]=_0x471582[_0xf5dc('0x3c')]||0x3;this[_0xf5dc('0x3d')]=_0x471582[_0xf5dc('0x3d')]||0x96;this[_0xf5dc('0x3e')]=_0x471582['dialGlobalMaxRetry']||0x4;this[_0xf5dc('0x3f')]=_0x471582['Trunk']?_0x471582['Trunk']:undefined;this['TrunkBackup']=_0x471582['TrunkBackup']?_0x471582[_0xf5dc('0x40')]:undefined;this['dialPrefix']=_0x471582[_0xf5dc('0x41')]||undefined;this['Interval']=_0x471582[_0xf5dc('0x42')]?_0x471582[_0xf5dc('0x42')]:undefined;this[_0xf5dc('0x43')]=_0x471582[_0xf5dc('0x43')]||_0xf5dc('0x44');this[_0xf5dc('0x45')]=_0x471582['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xf5dc('0x46')]=_0x471582[_0xf5dc('0x46')]||undefined;this[_0xf5dc('0x47')]=strategy[_0x471582['strategy']]||_0xf5dc('0x48');this[_0xf5dc('0x49')]=!![];this[_0xf5dc('0x4a')]=_0x471582['dialAMDActive']||![];this[_0xf5dc('0x4b')]=_0x471582[_0xf5dc('0x4b')];this[_0xf5dc('0x4c')]=_0x471582[_0xf5dc('0x4c')];this[_0xf5dc('0x4d')]=_0x471582['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x471582[_0xf5dc('0x4e')];this['dialAMDMinWordLength']=_0x471582[_0xf5dc('0x4f')];this[_0xf5dc('0x50')]=_0x471582[_0xf5dc('0x50')];this['dialAMDMaximumNumberOfWords']=_0x471582['dialAMDMaximumNumberOfWords'];this[_0xf5dc('0x51')]=_0x471582['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x471582[_0xf5dc('0x52')];this[_0xf5dc('0x53')]=0x0;this[_0xf5dc('0x54')]=0x0;this[_0xf5dc('0x55')]=_0x471582['timeout'];this[_0xf5dc('0x56')]=0x0;this[_0xf5dc('0x57')]=0x0;this[_0xf5dc('0x58')]=0x0;this[_0xf5dc('0x59')]=0x0;this[_0xf5dc('0x5a')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xf5dc('0x5b')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xf5dc('0x5c')]=0x0;this[_0xf5dc('0x5d')]=0x0;this[_0xf5dc('0x5e')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xf5dc('0x5f')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0xf5dc('0x60')]=1.05;this[_0xf5dc('0x61')]=0x0;this[_0xf5dc('0x62')]=0x0;this[_0xf5dc('0x63')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xf5dc('0x64')]=0x0;this[_0xf5dc('0x65')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xf5dc('0x66')]=0x0;this[_0xf5dc('0x67')]=_0x471582['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xf5dc('0x68')]=_0x471582['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xf5dc('0x69')]=0x0;this[_0xf5dc('0x6a')]=0x0;this[_0xf5dc('0x6b')]=0x1;this[_0xf5dc('0x6c')]=0x0;this[_0xf5dc('0x6d')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0xf5dc('0x6e')]=_0x471582[_0xf5dc('0x6e')]||0x1e;this[_0xf5dc('0x6f')]=_0x471582['dialRecallInQueue']||![];this[_0xf5dc('0x70')]=_0x471582[_0xf5dc('0x70')]||undefined;this['dialAgiAfterHangupClient']=_0x471582[_0xf5dc('0x71')]||![];this[_0xf5dc('0x72')]=_0x471582[_0xf5dc('0x72')]||![];this[_0xf5dc('0xa')]=monitorFormat[_0x471582[_0xf5dc('0xa')]]?monitorFormat[_0x471582['monitor_format']]:undefined;this[_0xf5dc('0x73')]=_0x471582['mandatoryDisposition']||![];this[_0xf5dc('0x74')]=_0x471582[_0xf5dc('0x74')]?_0x471582['mandatoryDispositionPause']:undefined;}module[_0xf5dc('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 4581a93..f01a87e 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 _0xbe75=['name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x44a5b0,_0x2d15da){var _0x188a0f=function(_0x4bea5e){while(--_0x4bea5e){_0x44a5b0['push'](_0x44a5b0['shift']());}};_0x188a0f(++_0x2d15da);}(_0xbe75,0x174));var _0x5be7=function(_0xe0050c,_0xdbbd9d){_0xe0050c=_0xe0050c-0x0;var _0x3fbecc=_0xbe75[_0xe0050c];return _0x3fbecc;};'use strict';function VtigerAccount(_0x423030){this['id']=_0x423030['id']||0x0;this[_0x5be7('0x0')]=_0x423030[_0x5be7('0x0')]||'';this[_0x5be7('0x1')]=_0x423030[_0x5be7('0x1')]||'';this[_0x5be7('0x2')]=_0x423030[_0x5be7('0x2')]||'';this[_0x5be7('0x3')]=_0x423030[_0x5be7('0x3')]||'';this[_0x5be7('0x4')]=_0x423030[_0x5be7('0x4')]||'';this['Configurations']=_0x423030[_0x5be7('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xccad=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x4cf8cc,_0x9401a5){var _0x4aa374=function(_0x11a6b9){while(--_0x11a6b9){_0x4cf8cc['push'](_0x4cf8cc['shift']());}};_0x4aa374(++_0x9401a5);}(_0xccad,0x77));var _0xdcca=function(_0xf1af27,_0x598bb1){_0xf1af27=_0xf1af27-0x0;var _0x46b274=_0xccad[_0xf1af27];return _0x46b274;};'use strict';function VtigerAccount(_0xed61ee){this['id']=_0xed61ee['id']||0x0;this[_0xdcca('0x0')]=_0xed61ee[_0xdcca('0x0')]||'';this['username']=_0xed61ee[_0xdcca('0x1')]||'';this[_0xdcca('0x2')]=_0xed61ee[_0xdcca('0x2')]||'';this[_0xdcca('0x3')]=_0xed61ee['remoteUri']||'';this[_0xdcca('0x4')]=_0xed61ee[_0xdcca('0x4')]||'';this[_0xdcca('0x5')]=_0xed61ee[_0xdcca('0x5')]||{};}module[_0xdcca('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 502dfd5..fc35a93 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 _0x5f2f=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x481102,_0x184a86){var _0x271f8f=function(_0x4e2ecf){while(--_0x4e2ecf){_0x481102['push'](_0x481102['shift']());}};_0x271f8f(++_0x184a86);}(_0x5f2f,0x73));var _0xf5f2=function(_0x17f46d,_0x9dd34e){_0x17f46d=_0x17f46d-0x0;var _0x174b82=_0x5f2f[_0x17f46d];return _0x174b82;};'use strict';function ZendeskAccount(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||'';this[_0xf5f2('0x2')]=_0x7c86d8[_0xf5f2('0x2')]||'';this[_0xf5f2('0x3')]=_0x7c86d8['token']||'';this['remoteUri']=_0x7c86d8[_0xf5f2('0x4')]||'';this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||'';this[_0xf5f2('0x6')]=_0x7c86d8[_0xf5f2('0x6')]||_0xf5f2('0x7');this['serverUrl']=_0x7c86d8[_0xf5f2('0x8')]||'';this[_0xf5f2('0x9')]=_0x7c86d8[_0xf5f2('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x438a4b,_0x2ed4ac){var _0xbe3f25=function(_0xf583c0){while(--_0xf583c0){_0x438a4b['push'](_0x438a4b['shift']());}};_0xbe3f25(++_0x2ed4ac);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 4bcebe5..c7047eb 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 _0x4e5c=['description','host','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x28b4cd,_0x573ff1){var _0x4229cc=function(_0x2ba663){while(--_0x2ba663){_0x28b4cd['push'](_0x28b4cd['shift']());}};_0x4229cc(++_0x573ff1);}(_0x4e5c,0x149));var _0xc4e5=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x4e5c[_0x2261ce];return _0x524640;};'use strict';function ZohoAccount(_0x327695){this['id']=_0x327695['id']||0x0;this['name']=_0x327695[_0xc4e5('0x0')]||'';this['description']=_0x327695[_0xc4e5('0x1')]||'';this[_0xc4e5('0x2')]=_0x327695[_0xc4e5('0x2')]||'';this['zone']=_0x327695['zone']||'';this['clientId']=_0x327695[_0xc4e5('0x3')]||'';this[_0xc4e5('0x4')]=_0x327695[_0xc4e5('0x4')]||'';this[_0xc4e5('0x5')]=_0x327695[_0xc4e5('0x5')]||'';this[_0xc4e5('0x6')]=_0x327695[_0xc4e5('0x6')]||'';this[_0xc4e5('0x7')]=_0x327695[_0xc4e5('0x7')]||'';this[_0xc4e5('0x8')]=_0x327695[_0xc4e5('0x8')]||{};}module[_0xc4e5('0x9')]=ZohoAccount; \ No newline at end of file +var _0x83cd=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x2de76e,_0x18bbab){var _0x51042d=function(_0x1e8c61){while(--_0x1e8c61){_0x2de76e['push'](_0x2de76e['shift']());}};_0x51042d(++_0x18bbab);}(_0x83cd,0x17b));var _0xd83c=function(_0x78fb00,_0x2befb9){_0x78fb00=_0x78fb00-0x0;var _0x1c1514=_0x83cd[_0x78fb00];return _0x1c1514;};'use strict';function ZohoAccount(_0x49c37a){this['id']=_0x49c37a['id']||0x0;this[_0xd83c('0x0')]=_0x49c37a[_0xd83c('0x0')]||'';this[_0xd83c('0x1')]=_0x49c37a[_0xd83c('0x1')]||'';this['host']=_0x49c37a[_0xd83c('0x2')]||'';this[_0xd83c('0x3')]=_0x49c37a[_0xd83c('0x3')]||'';this[_0xd83c('0x4')]=_0x49c37a['clientId']||'';this[_0xd83c('0x5')]=_0x49c37a[_0xd83c('0x5')]||'';this[_0xd83c('0x6')]=_0x49c37a['serverUrl']||'';this[_0xd83c('0x7')]=_0x49c37a['code']||'';this[_0xd83c('0x8')]=_0x49c37a['refreshToken']||'';this[_0xd83c('0x9')]=_0x49c37a['Configurations']||{};}module[_0xd83c('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 7fcbe05..228fb40 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 _0x59c4=['number','exports','util','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent','name','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0x59c4,0xbe));var _0x459c=function(_0x45cefb,_0x5edaa6){_0x45cefb=_0x45cefb-0x0;var _0x3541a9=_0x59c4[_0x45cefb];return _0x3541a9;};'use strict';var util=require(_0x459c('0x0'));var _=require('lodash');var moment=require(_0x459c('0x1'));function checkNameSurname(_0x5b5ad0,_0x19dc45,_0x4e678f){var _0x2fc769='';if(!_[_0x459c('0x2')](_0x19dc45)&&_0x459c('0x3')===typeof _0x19dc45){_0x2fc769+=_0x19dc45;}if(!_[_0x459c('0x2')](_0x4e678f)&&_0x459c('0x3')===typeof _0x4e678f){_0x2fc769+='\x20'+_0x4e678f;}if(_0x2fc769!==''){return _0x2fc769;}return _0x5b5ad0;}function Action(_0x4dc115,_0x1134ab,_0x525504,_0x43e192,_0x560b43){this[_0x459c('0x4')]=_0x525504||undefined;this[_0x459c('0x5')]=_0x4dc115['id'];this[_0x459c('0x6')]=_0x1134ab['name'];this[_0x459c('0x7')]=_0x1134ab['type'];this[_0x459c('0x8')]=_0x459c('0x6');this[_0x459c('0x9')]=![];this[_0x459c('0xa')]=_[_0x459c('0x2')](_0x4dc115[_0x459c('0xb')])?undefined:_0x4dc115[_0x459c('0xb')][_0x459c('0xc')];this[_0x459c('0xd')]=this[_0x459c('0xa')]?util[_0x459c('0xe')](_0x459c('0xf'),this[_0x459c('0xa')]):_0x43e192||undefined;this[_0x459c('0x10')]=checkNameSurname(_0x4dc115[_0x459c('0x11')][_0x459c('0x12')],_0x4dc115[_0x459c('0x11')][_0x459c('0x13')],_0x4dc115[_0x459c('0x11')][_0x459c('0x14')]);this[_0x459c('0x15')]=_0x4dc115['active']||![];this[_0x459c('0x16')]=_0x4dc115[_0x459c('0x11')][_0x459c('0x12')];this[_0x459c('0x17')]=_0x4dc115['scheduledat'];this['countbusyretry']=_0x4dc115[_0x459c('0x18')]||0x0;this[_0x459c('0x19')]=_0x4dc115[_0x459c('0x19')]||0x0;this[_0x459c('0x1a')]=_0x4dc115[_0x459c('0x1a')]||0x0;this[_0x459c('0x1b')]=(_0x4dc115[_0x459c('0x18')]||0x0)+(_0x4dc115[_0x459c('0x19')]||0x0)+(_0x4dc115[_0x459c('0x1a')]||0x0)+(_0x4dc115[_0x459c('0x1c')]||0x0)+(_0x4dc115[_0x459c('0x1d')]||0x0)+(_0x4dc115[_0x459c('0x1e')]||0x0)+(_0x4dc115['countmachineretry']||0x0)+(_0x4dc115[_0x459c('0x1f')]||0x0);this[_0x459c('0x1c')]=_0x4dc115[_0x459c('0x1c')]||0x0;this['countdropretry']=_0x4dc115[_0x459c('0x1d')]||0x0;this[_0x459c('0x1e')]=_0x4dc115['countabandonedretry']||0x0;this[_0x459c('0x20')]=_0x4dc115['countmachineretry']||0x0;this['countagentrejectretry']=_0x4dc115[_0x459c('0x1f')]||0x0;this[_0x459c('0x21')]=_0x4dc115[_0x459c('0x21')];this['callbackuniqueid']=_0x4dc115[_0x459c('0x22')];this[_0x459c('0x23')]=_0x4dc115[_0x459c('0x23')];this[_0x459c('0x24')]=_0x4dc115[_0x459c('0x24')];this[_0x459c('0x25')]=_0x4dc115[_0x459c('0x25')];this[_0x459c('0x26')]=_0x4dc115[_0x459c('0x26')];this[_0x459c('0x27')]=_[_0x459c('0x2')](_0x4dc115[_0x459c('0xb')])?_0x4dc115['UserId']:_0x4dc115[_0x459c('0xb')]['id'];this[_0x459c('0x28')]=_0x4dc115[_0x459c('0x28')];this[_0x459c('0x29')]='';this[_0x459c('0x2a')]='';}Action['prototype'][_0x459c('0x2b')]=function(){return util[_0x459c('0xe')](_0x459c('0x2c'),this[_0x459c('0x10')],this[_0x459c('0x2d')]);};module[_0x459c('0x2e')]=Action; \ No newline at end of file +var _0xe005=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','string','isNil','idContact','queue','type','campaigntype','dialAnswer','Agent','name','channelAgent','format','SIP/%s','membername','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x56a4c1,_0x5f0117){var _0x3bcea5=function(_0x5b8a18){while(--_0x5b8a18){_0x56a4c1['push'](_0x56a4c1['shift']());}};_0x3bcea5(++_0x5f0117);}(_0xe005,0x1df));var _0x5e00=function(_0x4add12,_0x1693d8){_0x4add12=_0x4add12-0x0;var _0x3723d2=_0xe005[_0x4add12];return _0x3723d2;};'use strict';var util=require(_0x5e00('0x0'));var _=require(_0x5e00('0x1'));var moment=require(_0x5e00('0x2'));function checkNameSurname(_0x5e2da4,_0x5c1078,_0x18261b){var _0x6c79b5='';if(!_['isNil'](_0x5c1078)&&_0x5e00('0x3')===typeof _0x5c1078){_0x6c79b5+=_0x5c1078;}if(!_[_0x5e00('0x4')](_0x18261b)&&_0x5e00('0x3')===typeof _0x18261b){_0x6c79b5+='\x20'+_0x18261b;}if(_0x6c79b5!==''){return _0x6c79b5;}return _0x5e2da4;}function Action(_0x20d825,_0x417076,_0x388d4c,_0x404020,_0x361110){this['uniqueid']=_0x388d4c||undefined;this[_0x5e00('0x5')]=_0x20d825['id'];this[_0x5e00('0x6')]=_0x417076['name'];this[_0x5e00('0x7')]=_0x417076[_0x5e00('0x7')];this[_0x5e00('0x8')]=_0x5e00('0x6');this[_0x5e00('0x9')]=![];this['membername']=_[_0x5e00('0x4')](_0x20d825[_0x5e00('0xa')])?undefined:_0x20d825[_0x5e00('0xa')][_0x5e00('0xb')];this[_0x5e00('0xc')]=this['membername']?util[_0x5e00('0xd')](_0x5e00('0xe'),this[_0x5e00('0xf')]):_0x404020||undefined;this[_0x5e00('0x10')]=checkNameSurname(_0x20d825[_0x5e00('0x11')]['phone'],_0x20d825[_0x5e00('0x11')][_0x5e00('0x12')],_0x20d825[_0x5e00('0x11')][_0x5e00('0x13')]);this[_0x5e00('0x14')]=_0x20d825['active']||![];this[_0x5e00('0x15')]=_0x20d825[_0x5e00('0x11')][_0x5e00('0x16')];this[_0x5e00('0x17')]=_0x20d825['scheduledat'];this[_0x5e00('0x18')]=_0x20d825['countbusyretry']||0x0;this[_0x5e00('0x19')]=_0x20d825[_0x5e00('0x19')]||0x0;this[_0x5e00('0x1a')]=_0x20d825[_0x5e00('0x1a')]||0x0;this[_0x5e00('0x1b')]=(_0x20d825[_0x5e00('0x18')]||0x0)+(_0x20d825['countcongestionretry']||0x0)+(_0x20d825[_0x5e00('0x1a')]||0x0)+(_0x20d825[_0x5e00('0x1c')]||0x0)+(_0x20d825[_0x5e00('0x1d')]||0x0)+(_0x20d825[_0x5e00('0x1e')]||0x0)+(_0x20d825['countmachineretry']||0x0)+(_0x20d825['countagentrejectretry']||0x0);this[_0x5e00('0x1c')]=_0x20d825[_0x5e00('0x1c')]||0x0;this['countdropretry']=_0x20d825[_0x5e00('0x1d')]||0x0;this[_0x5e00('0x1e')]=_0x20d825[_0x5e00('0x1e')]||0x0;this[_0x5e00('0x1f')]=_0x20d825[_0x5e00('0x1f')]||0x0;this['countagentrejectretry']=_0x20d825[_0x5e00('0x20')]||0x0;this['callback']=_0x20d825[_0x5e00('0x21')];this[_0x5e00('0x22')]=_0x20d825[_0x5e00('0x22')];this[_0x5e00('0x23')]=_0x20d825['callbackat'];this[_0x5e00('0x24')]=_0x20d825[_0x5e00('0x24')];this[_0x5e00('0x25')]=_0x20d825[_0x5e00('0x25')];this[_0x5e00('0x26')]=_0x20d825['ListId'];this[_0x5e00('0x27')]=_[_0x5e00('0x4')](_0x20d825[_0x5e00('0xa')])?_0x20d825['UserId']:_0x20d825['Agent']['id'];this['VoiceQueueId']=_0x20d825[_0x5e00('0x28')];this[_0x5e00('0x29')]='';this['originatecalleridname']='';}Action[_0x5e00('0x2a')][_0x5e00('0x2b')]=function(){return util[_0x5e00('0xd')](_0x5e00('0x2c'),this[_0x5e00('0x10')],this['number']);};module[_0x5e00('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 5f507ff..4d395ab 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 _0xcac1=['filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','hanguprequest','bind','dialend','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','name','answered','available','sumBillable','sumHoldTime','talking','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','voice:queue:%s','voice_queue:save','info','format','voice_queue_channel:remove','originated','pTalking','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','IS_DISACTIVED','\x20is\x20disactive','prototype','syncCampaigns','booked','outbound','clearZombieChannels','hasOwnProperty','dialActive','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','loggerError','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','then','getDiff','Agent','voicePause','run','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','decrementTalkink','[16]','countglobal','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','scheduledAt','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','createAgentHistory','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','Queue:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','recallme','validateContact','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridNumber','addVariables','merge','toLowerVariables','starttime','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','channel','logLookAgent','clone','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','pTalking:\x20','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','syncHangupRequest','addVariable','variables'];(function(_0x1d5a19,_0x598812){var _0x491a45=function(_0x294e5c){while(--_0x294e5c){_0x1d5a19['push'](_0x1d5a19['shift']());}};_0x491a45(++_0x598812);}(_0xcac1,0x166));var _0x1cac=function(_0x2d57a9,_0x5ae060){_0x2d57a9=_0x2d57a9-0x0;var _0x1b9671=_0xcac1[_0x2d57a9];return _0x1b9671;};'use strict';var util=require('util');var _=require(_0x1cac('0x0'));var BPromise=require(_0x1cac('0x1'));var uuid=require(_0x1cac('0x2'));var moment=require('moment');var md5=require(_0x1cac('0x3'));var Redis=require(_0x1cac('0x4'));var config=require(_0x1cac('0x5'));var logger=require(_0x1cac('0x6'))(_0x1cac('0x7'));var loggerAction=require(_0x1cac('0x6'))(_0x1cac('0x8'));var ami=require(_0x1cac('0x9'));var rpcDb=require(_0x1cac('0xa'));var Action=require(_0x1cac('0xb'));var ut=require(_0x1cac('0xc'));config[_0x1cac('0xd')]=_[_0x1cac('0xe')](config[_0x1cac('0xd')],{'host':_0x1cac('0xf'),'port':0x18eb});var io=require(_0x1cac('0x10'))(new Redis(config[_0x1cac('0xd')]));var Sequence=function(){};Sequence['prototype'][_0x1cac('0x11')]=function(_0x351cd1){this[_0x1cac('0x12')]=this[_0x1cac('0x12')]?this[_0x1cac('0x12')][_0x1cac('0x13')](_0x351cd1):_0x351cd1();};function Preview(_0x477e83){this[_0x1cac('0x14')]=new Sequence();this[_0x1cac('0x15')]=_0x477e83[_0x1cac('0x16')];this[_0x1cac('0x17')]=_0x477e83['trunks'];this[_0x1cac('0x18')]={};this['agents']=_0x477e83[_0x1cac('0x19')];this[_0x1cac('0x1a')]=0x0;ami['on'](_0x1cac('0x1b'),this[_0x1cac('0x1c')]['bind'](this));ami['on'](_0x1cac('0x1d'),this[_0x1cac('0x1e')]['bind'](this));ami['on'](_0x1cac('0x1f'),this['syncHangupRequest'][_0x1cac('0x20')](this));ami['on'](_0x1cac('0x21'),this['syncDialEnd'][_0x1cac('0x20')](this));ami['on']('newexten',this[_0x1cac('0x22')]['bind'](this));ami['on'](_0x1cac('0x23'),this[_0x1cac('0x24')][_0x1cac('0x20')](this));ami['on'](_0x1cac('0x25'),this[_0x1cac('0x26')][_0x1cac('0x20')](this));ami['on']('blindtransfer',this[_0x1cac('0x27')][_0x1cac('0x20')](this));this[_0x1cac('0x28')](this[_0x1cac('0x15')]);}function emit(_0x46f976,_0x1dd45f,_0x59f1b7){io['to'](_0x46f976)[_0x1cac('0x29')](_0x1dd45f,_0x59f1b7);}function emitCampaignPreview(_0x59cbfd){if(_0x59cbfd[_0x1cac('0x2a')]==='outbound'){var _0x2cef25={'id':_0x59cbfd['id'],'name':_0x59cbfd[_0x1cac('0x2b')],'strategy':_0x59cbfd['strategy'],'answered':_0x59cbfd[_0x1cac('0x2c')],'available':_0x59cbfd[_0x1cac('0x2d')],'loggedIn':_0x59cbfd['loggedIn'],'pTalking':_0x59cbfd['pTalking'],'sumBillable':_0x59cbfd[_0x1cac('0x2e')],'sumDuration':_0x59cbfd['sumDuration'],'sumHoldTime':_0x59cbfd[_0x1cac('0x2f')]||0x0,'talking':_0x59cbfd[_0x1cac('0x30')],'total':_0x59cbfd['total'],'type':_0x59cbfd[_0x1cac('0x2a')],'unmanaged':_0x59cbfd[_0x1cac('0x31')],'abandoned':_0x59cbfd['abandoned'],'waiting':_0x59cbfd[_0x1cac('0x32')],'loggedInDb':_0x59cbfd[_0x1cac('0x33')],'dialActive':_0x59cbfd['dialActive'],'dialMethod':_0x59cbfd[_0x1cac('0x34')],'dialOriginateCallerIdName':_0x59cbfd[_0x1cac('0x35')],'dialOriginateCallerIdNumber':_0x59cbfd[_0x1cac('0x36')],'dialOriginateTimeout':_0x59cbfd[_0x1cac('0x37')],'dialPrefix':_0x59cbfd[_0x1cac('0x38')],'outboundAnswerAgiCallsDay':_0x59cbfd[_0x1cac('0x39')],'outboundAnswerCallsDay':_0x59cbfd[_0x1cac('0x3a')],'outboundBlacklistCallsDay':_0x59cbfd['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x59cbfd[_0x1cac('0x3b')],'outboundCongestionCallsDay':_0x59cbfd[_0x1cac('0x3c')],'outboundDropCallsDayACS':_0x59cbfd[_0x1cac('0x3d')],'outboundDropCallsDayCallersExit':_0x59cbfd[_0x1cac('0x3e')],'outboundDropCallsDayTimeout':_0x59cbfd[_0x1cac('0x3f')],'outboundNoAnswerCallsDay':_0x59cbfd[_0x1cac('0x40')],'outboundNoSuchCallsDay':_0x59cbfd['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x59cbfd[_0x1cac('0x41')],'outboundReCallsDay':_0x59cbfd[_0x1cac('0x42')],'outboundRejectCallsDay':_0x59cbfd[_0x1cac('0x43')],'outboundUnknownCallsDay':_0x59cbfd[_0x1cac('0x44')],'outboundAbandonedCallsDay':_0x59cbfd[_0x1cac('0x45')],'predictiveIntervalAnsweredCalls':_0x59cbfd[_0x1cac('0x46')],'predictiveIntervalAvgHoldtime':_0x59cbfd[_0x1cac('0x47')],'predictiveIntervalAvgTalktime':_0x59cbfd[_0x1cac('0x48')],'predictiveIntervalDroppedCallsCallersExit':_0x59cbfd[_0x1cac('0x49')],'predictiveIntervalDroppedCallsTimeout':_0x59cbfd[_0x1cac('0x4a')],'predictiveIntervalErlangCalls':_0x59cbfd[_0x1cac('0x4b')],'predictiveIntervalErlangCallsDroppedCalls':_0x59cbfd[_0x1cac('0x4c')],'predictiveIntervalHitRate':_0x59cbfd[_0x1cac('0x4d')],'predictiveIntervalMultiplicativeFactor':_0x59cbfd['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x59cbfd[_0x1cac('0x4e')],'predictiveIntervalAvailable':_0x59cbfd[_0x1cac('0x4f')],'predictiveIntervalTotalCalls':_0x59cbfd[_0x1cac('0x50')],'message':_0x59cbfd['message'],'originated':_0x59cbfd['originated'],'erlangCalls':_0x59cbfd[_0x1cac('0x51')],'erlangCallToSecond':_0x59cbfd['erlangCallToSecond'],'erlangAbandonmentRate':_0x59cbfd['erlangAbandonmentRate'],'erlangBusyFactor':_0x59cbfd[_0x1cac('0x52')],'startPredictive':_0x59cbfd[_0x1cac('0x53')],'startProgressive':_0x59cbfd[_0x1cac('0x54')]};if(_0x59cbfd[_0x1cac('0x55')]){_0x2cef25[_0x1cac('0x55')]={'id':_0x59cbfd['Trunk']['id'],'name':_0x59cbfd['Trunk'][_0x1cac('0x2b')],'active':_0x59cbfd[_0x1cac('0x55')][_0x1cac('0x56')],'callerid':_0x59cbfd[_0x1cac('0x55')][_0x1cac('0x57')]};}if(_0x59cbfd['Interval']){_0x2cef25[_0x1cac('0x58')]={'id':_0x59cbfd[_0x1cac('0x58')]['id'],'name':_0x59cbfd[_0x1cac('0x58')]['name']};}var _0x398bdd=md5(JSON['stringify'](_0x2cef25));if(_0x59cbfd[_0x1cac('0x3')]!==_0x398bdd){_0x59cbfd[_0x1cac('0x3')]=_0x398bdd;emit(util['format'](_0x1cac('0x59'),_0x2cef25[_0x1cac('0x2b')]),_0x1cac('0x5a'),_0x2cef25);}}}function emitVoiceQueueChannelRemove(_0x2a088a){logger[_0x1cac('0x5b')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x2a088a));emit(util[_0x1cac('0x5c')](_0x1cac('0x59'),_0x2a088a['name']),_0x1cac('0x5d'),_0x2a088a);}function notSendMessagesQueue(_0x265617){if(_0x265617['sendMessageOneNotActive']){if(_0x265617[_0x1cac('0x5e')]===0x0&&_0x265617[_0x1cac('0x5f')]===0x0){_0x265617[_0x1cac('0x60')]=![];_0x265617[_0x1cac('0x2d')]=0x0;_0x265617[_0x1cac('0x61')]=0x0;_0x265617['message']=_0x1cac('0x62');ut[_0x1cac('0x63')](_0x1cac('0x64'),_0x265617['name']+_0x1cac('0x65'));}else{_0x265617[_0x1cac('0x66')]=_0x1cac('0x67');ut[_0x1cac('0x63')](_0x1cac('0x64'),_0x265617['name']+_0x1cac('0x68'));}emitCampaignPreview(_0x265617);}}Preview[_0x1cac('0x69')][_0x1cac('0x28')]=function(){var _0x323fac=this;setInterval(function(){_0x323fac[_0x1cac('0x6a')]();},0x7cf);};Preview[_0x1cac('0x69')][_0x1cac('0x6a')]=function(){var _0x4a21e7=this[_0x1cac('0x15')];this[_0x1cac('0x1a')]+=0x1;for(var _0x366645 in _0x4a21e7){if(_0x4a21e7['hasOwnProperty'](_0x366645)&&(_0x4a21e7[_0x366645][_0x1cac('0x34')]==='preview'||_0x4a21e7[_0x366645][_0x1cac('0x34')]===_0x1cac('0x6b'))&&_0x4a21e7[_0x366645]['type']===_0x1cac('0x6c')){if(this[_0x1cac('0x1a')]>0x7){this[_0x1cac('0x1a')]=0x0;this[_0x1cac('0x6d')]();}}if(_0x4a21e7[_0x1cac('0x6e')](_0x366645)&&_0x4a21e7[_0x366645][_0x1cac('0x34')]===_0x1cac('0x7')&&_0x4a21e7[_0x366645]['type']===_0x1cac('0x6c')){if(_0x4a21e7[_0x366645][_0x1cac('0x6f')]){this[_0x1cac('0x70')](_0x4a21e7[_0x366645]);this[_0x1cac('0x71')](_0x4a21e7[_0x366645]);}else{notSendMessagesQueue(_0x4a21e7[_0x366645]);}}}};Preview[_0x1cac('0x69')][_0x1cac('0x72')]=function(_0x52e7a9){var _0x435123=this;this[_0x1cac('0x14')][_0x1cac('0x11')](function(){if(!_[_0x1cac('0x73')](_0x435123[_0x1cac('0x18')][_0x52e7a9])){loggerAction[_0x1cac('0x5b')](_0x1cac('0x74'),_0x52e7a9,_0x1cac('0x75'),_0x435123[_0x1cac('0x18')][_0x52e7a9][_0x1cac('0x76')],_0x1cac('0x77'),JSON[_0x1cac('0x78')](_0x435123[_0x1cac('0x15')][_0x435123[_0x1cac('0x18')][_0x52e7a9][_0x1cac('0x76')]][_0x1cac('0x5e')]),'pTalking:\x20',JSON[_0x1cac('0x78')](_0x435123['campaignsPreview'][_0x435123[_0x1cac('0x18')][_0x52e7a9]['queue']][_0x1cac('0x5f')]),JSON[_0x1cac('0x78')](_0x435123[_0x1cac('0x18')][_0x52e7a9]['dialAnswer']),JSON[_0x1cac('0x78')](_[_0x1cac('0x79')](_0x435123['actions'][_0x52e7a9],[_0x1cac('0x7a'),_0x1cac('0x7b'),_0x1cac('0x7c'),_0x1cac('0x7d')])));return ami[_0x1cac('0x7e')]({'action':_0x1cac('0x7f'),'channel':_0x435123[_0x1cac('0x18')][_0x52e7a9]['channel']})[_0x1cac('0x80')](function(_0x5ea9d3){if(_0x5ea9d3['message']===_0x1cac('0x81')){setTimeout(function(){if(_0x435123[_0x1cac('0x18')][_0x52e7a9]){ut[_0x1cac('0x82')](_0x435123[_0x1cac('0x15')][_0x435123['actions'][_0x52e7a9]['queue']],_0x1cac('0x83'));if(_0x435123[_0x1cac('0x18')][_0x52e7a9][_0x1cac('0x84')]===!![]){ut['decrementTalkink'](_0x435123[_0x1cac('0x15')][_0x435123['actions'][_0x52e7a9][_0x1cac('0x76')]],'[clearZombieChannel]');ut[_0x1cac('0x85')]('[Dialer][checkChannel][pTalking][Preview]'+_0x52e7a9,_0x435123['actions'][_0x52e7a9]['queue']);}ut[_0x1cac('0x85')](_0x1cac('0x86')+_0x52e7a9,_0x435123['actions'][_0x52e7a9][_0x1cac('0x76')]);delete _0x435123[_0x1cac('0x18')][_0x52e7a9];}},0x2328);}});}});};Preview['prototype'][_0x1cac('0x6d')]=function(){var _0x24cc7e=this;loggerAction['info'](_0x1cac('0x87'),_['size'](this['actions']));for(var _0x146e6f in this[_0x1cac('0x18')]){if(_0x24cc7e[_0x1cac('0x18')]['hasOwnProperty'](_0x146e6f)){_0x24cc7e[_0x1cac('0x72')](_0x146e6f);}}};Preview['prototype'][_0x1cac('0x71')]=function(_0x25d585){var _0x29b94d=this;rpcDb[_0x1cac('0x88')](_0x25d585['id'],ut[_0x1cac('0x89')](this[_0x1cac('0x19')]))[_0x1cac('0x8a')](function(_0x1d30d6){if(!_['isNil'](_0x1d30d6)){for(var _0x2edfe5=0x0;_0x2edfe5<_0x1d30d6['length'];_0x2edfe5+=0x1){if(ut[_0x1cac('0x8b')](_0x1d30d6[_0x2edfe5]['scheduledat'])<_0x25d585['dialRecallMeTimeout']*0x3c){if(_0x1d30d6[_0x2edfe5][_0x1cac('0x8c')]&&!_0x1d30d6[_0x2edfe5][_0x1cac('0x8c')][_0x1cac('0x8d')]){_0x29b94d[_0x1cac('0x8e')](_0x1d30d6[_0x2edfe5]['id'])[_0x1cac('0x8a')](ut[_0x1cac('0x8f')]('[RecallMe]'))[_0x1cac('0x80')](ut[_0x1cac('0x8f')](_0x1cac('0x90')));}else{rpcDb[_0x1cac('0x91')](_0x1d30d6[_0x2edfe5]['id']);}}else{var _0x10858f=new Action(_0x1d30d6[_0x2edfe5],_0x25d585);_0x10858f['starttime']=moment()['format'](_0x1cac('0x92'));_0x25d585['outboundReCallsDay']+=0x1;ut[_0x1cac('0x93')](_0x10858f,0x17,_0x1cac('0x94'));if(_0x25d585[_0x1cac('0x95')]){rpcDb['rescheduleContactInQueue'](ut[_0x1cac('0x96')](_0x1d30d6[_0x2edfe5]));rpcDb[_0x1cac('0x97')](_0x10858f,_0x1cac('0x98'));}else{ut[_0x1cac('0x93')](_0x10858f,0x16,_0x1cac('0x99'));rpcDb[_0x1cac('0x97')](_0x10858f,_0x1cac('0x9a'));rpcDb[_0x1cac('0x9b')](_0x10858f,'[HistoryRecallClose]');}}}}})[_0x1cac('0x80')](ut['logger2']('[getContactRecallMe]'));};Preview[_0x1cac('0x69')][_0x1cac('0x70')]=function(_0x1bdf6c){_0x1bdf6c[_0x1cac('0x60')]=!![];if(ut[_0x1cac('0x9c')](_0x1bdf6c['loggedIn'])){_0x1bdf6c[_0x1cac('0x66')]=_0x1cac('0x9d');}else if(!ut['isActive'](_0x1bdf6c[_0x1cac('0x6f')])){_0x1bdf6c[_0x1cac('0x66')]=_0x1cac('0x62');}else if(!this[_0x1cac('0x9e')](_0x1bdf6c[_0x1cac('0x55')])){if(!this['isTrunkReachable'](_0x1bdf6c[_0x1cac('0x9f')])){_0x1bdf6c[_0x1cac('0x66')]=_0x1cac('0xa0');}else{_0x1bdf6c[_0x1cac('0x66')]=_0x1cac('0xa1');}}else{_0x1bdf6c['message']=_0x1cac('0xa1');}emitCampaignPreview(_0x1bdf6c);};Preview[_0x1cac('0x69')][_0x1cac('0xa2')]=function(_0x442d14,_0x265339,_0x5f262e){var _0x4f45e6=this;var _0x13448f=this[_0x1cac('0x18')][_0x265339];var _0x89b32=this[_0x1cac('0x15')][_0x13448f['queue']];var _0x3d79be;if(_0x89b32){switch(_0x5f262e){case'1':_0x89b32['outboundNoSuchCallsDay']+=0x1;_0x13448f[_0x1cac('0xa3')]+=0x1;_0x13448f['countglobal']=ut[_0x1cac('0xa4')](_0x13448f);ut[_0x1cac('0x93')](_0x13448f,0x0,_0x1cac('0xa5'));ami[_0x1cac('0x29')](_0x1cac('0xa6'),ut[_0x1cac('0xa7')](_0x13448f,_0x1cac('0xa8')));rpcDb[_0x1cac('0x97')](_0x13448f,_0x1cac('0xa9'));if(ut[_0x1cac('0xa4')](_0x13448f)>=_0x89b32['dialGlobalMaxRetry']){_0x3d79be=ut['cloneAction'](_0x13448f,0xf,'Global');rpcDb['createCustomerFinal'](_0x3d79be,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x13448f[_0x1cac('0xa3')]>=_0x89b32[_0x1cac('0xaa')]){rpcDb[_0x1cac('0x9b')](_0x13448f,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x1cac('0xab')](ut['scheduledAt'](_0x13448f,_0x1cac('0xa3'),_0x89b32[_0x1cac('0xac')]),_0x13448f[_0x1cac('0xad')],_0x13448f[_0x1cac('0xae')]);}}delete this[_0x1cac('0x18')][_0x442d14['linkedid']];break;case _0x1cac('0xaf'):var _0x4d0396=moment()[_0x1cac('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x13448f[_0x1cac('0xb0')]=_0x4d0396;_0x13448f[_0x1cac('0xb1')]=_0x4d0396;_0x13448f[_0x1cac('0x84')]=!![];_0x89b32[_0x1cac('0x5f')]+=0x1;logger['info'](_0x1cac('0xb2'),_0x13448f[_0x1cac('0xb3')],_0x1cac('0xb4'),_0x89b32['name'],'pTalking:\x20',_0x89b32[_0x1cac('0x5f')]);ami[_0x1cac('0x29')](_0x1cac('0xb5'),ut[_0x1cac('0xa7')](_0x13448f,_0x1cac('0xb6')));if(_0x89b32[_0x1cac('0xb7')]){ami[_0x1cac('0x29')](_0x1cac('0xb8'),ut[_0x1cac('0xb9')](_0x13448f));}break;case'16':ami[_0x1cac('0x29')](_0x1cac('0xba'),ut['buildObj'](_0x13448f,_0x1cac('0xbb')));emitVoiceQueueChannelRemove(ut['buildObj'](_0x13448f,_0x1cac('0xbb')));_0x89b32[_0x1cac('0x3a')]+=0x1;_0x89b32[_0x1cac('0xbc')]+=0x1;_0x89b32['answered']+=0x1;ut[_0x1cac('0xbd')](_0x89b32,_0x1cac('0xbe'));_0x13448f[_0x1cac('0xbf')]=ut[_0x1cac('0xa4')](_0x13448f);ut['logCustomer'](_0x13448f,0x4,'Answer');rpcDb[_0x1cac('0x97')](_0x13448f,_0x1cac('0xc0'));rpcDb[_0x1cac('0x9b')](_0x13448f,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x1cac('0xc1')](_0x13448f);_0x89b32[_0x1cac('0xc2')]+=_0x13448f[_0x1cac('0xc3')];_0x89b32[_0x1cac('0x2e')]+=_0x13448f['talktime'];logger['info'](_0x1cac('0xc4'),_0x13448f['uniqueid'],'\x20Queue',_0x89b32[_0x1cac('0x2b')],'pTalking:\x20',_0x89b32[_0x1cac('0x5f')]);delete this[_0x1cac('0x18')][_0x442d14[_0x1cac('0xc5')]];break;case _0x1cac('0xc6'):_0x89b32['outboundBusyCallsDay']+=0x1;_0x13448f[_0x1cac('0xc7')]+=0x1;_0x13448f['countglobal']=ut[_0x1cac('0xa4')](_0x13448f);ut[_0x1cac('0x93')](_0x13448f,0x5,_0x1cac('0xc8'));ami['emit'](_0x1cac('0xc9'),ut[_0x1cac('0xa7')](_0x13448f,_0x1cac('0xca')));rpcDb[_0x1cac('0x97')](_0x13448f,_0x1cac('0xcb'));if(ut[_0x1cac('0xa4')](_0x13448f)>=_0x89b32[_0x1cac('0xcc')]){_0x3d79be=ut[_0x1cac('0xcd')](_0x13448f,0xf,_0x1cac('0xce'));rpcDb['createCustomerFinal'](_0x3d79be,_0x1cac('0xcf'));}else{if(_0x13448f[_0x1cac('0xc7')]>=_0x89b32[_0x1cac('0xd0')]){rpcDb[_0x1cac('0x9b')](_0x13448f,_0x1cac('0xcb'));}else{rpcDb[_0x1cac('0xab')](ut['scheduledAt'](_0x13448f,_0x1cac('0xc7'),_0x89b32[_0x1cac('0xd1')]),_0x13448f[_0x1cac('0xad')],_0x13448f[_0x1cac('0xae')]);}}break;case _0x1cac('0xd2'):_0x89b32[_0x1cac('0x40')]+=0x1;_0x13448f[_0x1cac('0xd3')]+=0x1;_0x13448f['countglobal']=ut[_0x1cac('0xa4')](_0x13448f);ut[_0x1cac('0x93')](_0x13448f,0x3,_0x1cac('0xd4'));ami['emit'](_0x1cac('0xd5'),ut['buildObj'](_0x13448f,_0x1cac('0xd6')));rpcDb[_0x1cac('0x97')](_0x13448f,_0x1cac('0xd7'));if(ut[_0x1cac('0xa4')](_0x13448f)>=_0x89b32[_0x1cac('0xcc')]){_0x3d79be=ut[_0x1cac('0xcd')](_0x13448f,0xf,_0x1cac('0xce'));rpcDb[_0x1cac('0x9b')](_0x3d79be,_0x1cac('0xd8'));}else{if(_0x13448f[_0x1cac('0xd3')]>=_0x89b32[_0x1cac('0xd9')]){rpcDb[_0x1cac('0x9b')](_0x13448f,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x1cac('0xab')](ut[_0x1cac('0xda')](_0x13448f,_0x1cac('0xd3'),_0x89b32[_0x1cac('0xdb')]),_0x13448f[_0x1cac('0xad')],_0x13448f[_0x1cac('0xae')]);}}break;case'CONGESTION':_0x89b32[_0x1cac('0x3c')]+=0x1;_0x13448f[_0x1cac('0xdc')]+=0x1;_0x13448f[_0x1cac('0xbf')]=ut[_0x1cac('0xa4')](_0x13448f);ut[_0x1cac('0x93')](_0x13448f,0x8,_0x1cac('0xdd'));ami[_0x1cac('0x29')](_0x1cac('0xde'),ut[_0x1cac('0xa7')](_0x13448f,_0x1cac('0xdf')));rpcDb[_0x1cac('0x97')](_0x13448f,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x1cac('0xa4')](_0x13448f)>=_0x89b32[_0x1cac('0xcc')]){_0x3d79be=ut[_0x1cac('0xcd')](_0x13448f,0xf,'Global');rpcDb[_0x1cac('0x9b')](_0x3d79be,_0x1cac('0xe0'));}else{if(_0x13448f[_0x1cac('0xdc')]>=_0x89b32[_0x1cac('0xe1')]){rpcDb[_0x1cac('0x9b')](_0x13448f,_0x1cac('0xe2'));}else{rpcDb[_0x1cac('0xab')](ut[_0x1cac('0xda')](_0x13448f,_0x1cac('0xdc'),_0x89b32[_0x1cac('0xd1')]),_0x13448f[_0x1cac('0xad')],_0x13448f['activeContact']);}}break;case _0x1cac('0xe3'):_0x89b32[_0x1cac('0x43')]+=0x1;_0x13448f[_0x1cac('0xe4')]+=0x1;_0x13448f[_0x1cac('0xbf')]=ut[_0x1cac('0xa4')](_0x13448f);ut[_0x1cac('0x93')](_0x13448f,0x14,_0x1cac('0xe5'));ami[_0x1cac('0x29')](_0x1cac('0xe6'),ut[_0x1cac('0xa7')](_0x13448f,_0x1cac('0xe7')));rpcDb[_0x1cac('0x97')](_0x13448f,_0x1cac('0xe8'));if(ut[_0x1cac('0xa4')](_0x13448f)>=_0x89b32['dialGlobalMaxRetry']){_0x3d79be=ut[_0x1cac('0xcd')](_0x13448f,0x14,'AgentReject');rpcDb[_0x1cac('0x9b')](_0x3d79be,_0x1cac('0xe9'));}else{if(_0x13448f[_0x1cac('0xe4')]>=_0x89b32[_0x1cac('0xea')]){rpcDb[_0x1cac('0x9b')](_0x13448f,_0x1cac('0xe9'));}else{rpcDb[_0x1cac('0xab')](ut[_0x1cac('0xda')](_0x13448f,_0x1cac('0xe4'),_0x89b32[_0x1cac('0xeb')]),_0x13448f[_0x1cac('0xad')],_0x13448f[_0x1cac('0xae')]);}}break;case _0x1cac('0xec'):_0x89b32['outboundAbandonedCallsDay']+=0x1;_0x13448f[_0x1cac('0xed')]+=0x1;_0x13448f[_0x1cac('0xbf')]=ut[_0x1cac('0xa4')](_0x13448f);ut[_0x1cac('0x93')](_0x13448f,0xb,_0x1cac('0xee'));rpcDb['createCustomerHistory'](_0x13448f,_0x1cac('0xef'));if(ut['totalGlobal'](_0x13448f)>=_0x89b32[_0x1cac('0xcc')]){_0x3d79be=ut[_0x1cac('0xcd')](_0x13448f,0xf,_0x1cac('0xce'));rpcDb[_0x1cac('0x9b')](_0x3d79be,_0x1cac('0xef'));}else{if(_0x13448f[_0x1cac('0xf0')]>=_0x89b32['dialAbandonedMaxRety']){rpcDb[_0x1cac('0x9b')](_0x13448f,_0x1cac('0xef'));}else{rpcDb[_0x1cac('0xab')](ut['scheduledAt'](_0x13448f,_0x1cac('0xed'),_0x89b32['dialAbandonedRetryFrequency']),_0x13448f[_0x1cac('0xad')],_0x13448f[_0x1cac('0xae')]);}}break;default:if(_0x13448f['dialAnswer']){ut[_0x1cac('0xbd')](_0x89b32,_0x1cac('0xf1'));ut[_0x1cac('0x85')](_0x1cac('0xf2')+_0x89b32[_0x1cac('0x2b')],_0x442d14);}_0x89b32[_0x1cac('0x44')]+=0x1;_0x13448f[_0x1cac('0xbf')]=ut[_0x1cac('0xa4')](_0x13448f);ut[_0x1cac('0x93')](_0x13448f,0xc,_0x442d14[_0x1cac('0xf3')]||_0x442d14[_0x1cac('0xf4')]);rpcDb['createCustomerHistory'](_0x13448f,_0x1cac('0xf5'));if(ut['totalGlobal'](_0x13448f)>=_0x89b32[_0x1cac('0xcc')]){_0x3d79be=ut[_0x1cac('0xcd')](_0x13448f,0xf,_0x1cac('0xce'));rpcDb[_0x1cac('0x9b')](_0x3d79be,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x13448f,_0x1cac('0xf6'));}delete this[_0x1cac('0x18')][_0x442d14[_0x1cac('0xc5')]];}if(!(_0x13448f[_0x1cac('0x84')]&&_0x5f262e==='16')){ut['updateOriginated'](_0x89b32,'[callProgressDetectingCustomer]');logger[_0x1cac('0x5b')](_0x1cac('0xf7'),_0x13448f[_0x1cac('0xb3')],'\x20Queue',_0x89b32[_0x1cac('0x2b')],_0x1cac('0x77'),_0x89b32[_0x1cac('0x5e')]);}if(_0x5f262e!==_0x1cac('0xaf')){delete this[_0x1cac('0x18')][_0x442d14[_0x1cac('0xc5')]];delete this[_0x1cac('0x18')][_0x442d14[_0x1cac('0xf8')]];}}};Preview[_0x1cac('0x69')][_0x1cac('0xf9')]=function(_0x452891,_0x28be36,_0x344f0d){if(_[_0x1cac('0xfa')](_0x28be36)&&_0x1cac('0xfb')!==typeof _0x28be36){return;}if(_[_0x1cac('0xfa')](_0x344f0d)&&_0x1cac('0xfb')!==typeof _0x344f0d){return;}switch(_0x344f0d[_0x1cac('0xfc')]){case'0':ut[_0x1cac('0xfd')](_0x452891,0x0,_0x1cac('0xa5'));rpcDb['createAgentHistory'](_0x452891,_0x1cac('0xfe'));break;case'3':ut[_0x1cac('0xfd')](_0x452891,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x452891,_0x1cac('0xff'));break;case'5':ut[_0x1cac('0xfd')](_0x452891,0x5,_0x1cac('0xc8'));rpcDb['createAgentHistory'](_0x452891,_0x1cac('0x100'));break;case'8':ut[_0x1cac('0xfd')](_0x452891,0x8,_0x1cac('0xdd'));rpcDb['createAgentHistory'](_0x452891,_0x1cac('0x101'));break;case'22':ut[_0x1cac('0xfd')](_0x452891,0x16,_0x1cac('0x102'));rpcDb[_0x1cac('0x103')](_0x452891,_0x1cac('0x104'));break;default:ut['logAgent'](_0x452891,0xc,_0x344f0d[_0x1cac('0xfc')]);rpcDb[_0x1cac('0x103')](_0x452891,'[callProgressDetectingAgent][logCongestion]');}ut['updateOriginated'](_0x28be36,_0x1cac('0x105'));logger['info'](_0x1cac('0x106'),_0x452891['uniqueid'],_0x1cac('0xb4'),_0x28be36['name'],'originated:\x20',_0x28be36[_0x1cac('0x5e')]);delete this['actions'][_0x452891[_0x1cac('0xb3')]];};Preview[_0x1cac('0x69')][_0x1cac('0x107')]=function(_0x539a52,_0x430fa7,_0xcaa958,_0x377ae6,_0x46b728){var _0x31e859=this;return new BPromise(function(_0x10c5a0,_0xafda7e){if(_['isNil'](_0x430fa7)||_[_0x1cac('0x73')](_0x430fa7[_0x1cac('0x108')])||_[_0x1cac('0x73')](_0x430fa7[_0x1cac('0x108')][_0x1cac('0x109')])||_[_0x1cac('0x73')](_0x430fa7[_0x1cac('0x7c')])){_0xafda7e(ut['message'](_0x1cac('0x10a'),_0x377ae6,_0x46b728));return;}var _0x27dca5=uuid['v4']();var _0x378573=_0x31e859[_0x1cac('0x15')][_0x430fa7['Queue']['name']];var _0x47d120=_0xcaa958?_0x31e859[_0x1cac('0x19')][_0xcaa958]['id']:undefined;_0x31e859[_0x1cac('0x18')][_0x27dca5]=new Action(_0x430fa7,_0x378573,_0x27dca5,_0xcaa958,_0x47d120);var _0x5bf235=_0x31e859[_0x1cac('0x18')][_0x27dca5];_0x5bf235[_0x1cac('0xad')]=_0x377ae6;_0x5bf235[_0x1cac('0xae')]=_0x46b728;_0x5bf235[_0x1cac('0x10b')]=_0xcaa958;if(_[_0x1cac('0x10c')](_0x539a52)){_0x31e859[_0x1cac('0x10d')](_0x5bf235,_0x378573,_0x430fa7,_0xcaa958)[_0x1cac('0x8a')](function(_0x456207){logger[_0x1cac('0x5b')]('[Preview][execCall][success]',_0x1cac('0x10e')+_0x5bf235[_0x1cac('0x76')]+'\x20IdHopper:\x20'+_0x5bf235[_0x1cac('0x10f')],JSON['stringify'](_0x456207));ami['emit'](_0x1cac('0x110'),ut[_0x1cac('0xa7')](_0x5bf235,_0x1cac('0x111')));_0x10c5a0(ut['message'](_0x1cac('0x112')));})[_0x1cac('0x80')](function(_0x1f1bf3){ut[_0x1cac('0x63')](_0x1cac('0x113'),_0x1f1bf3);_0xafda7e(ut['message'](_0x1cac('0x114'),_0x377ae6,_0x46b728));});}else{_0x378573[_0x1cac('0x115')]+=0x1;ut[_0x1cac('0x116')](_0x5bf235);rpcDb[_0x1cac('0x117')](_0x5bf235,'[Blacklist][error]');delete _0x31e859['actions'][_0x27dca5];_0xafda7e(ut[_0x1cac('0x66')](_0x1cac('0x118'),_0x377ae6,_0x46b728));}});};Preview[_0x1cac('0x69')][_0x1cac('0x9e')]=function(_0xeb3202){return!_[_0x1cac('0x73')](_0xeb3202)&&!_[_0x1cac('0x73')](_0xeb3202[_0x1cac('0x2b')])&&!_[_0x1cac('0x73')](_0xeb3202[_0x1cac('0x56')])&&_0xeb3202[_0x1cac('0x56')]&&!_[_0x1cac('0x73')](this[_0x1cac('0x17')][util['format']('SIP/%s',_0xeb3202[_0x1cac('0x2b')])])&&!_[_0x1cac('0x73')](this[_0x1cac('0x17')][util[_0x1cac('0x5c')]('SIP/%s',_0xeb3202[_0x1cac('0x2b')])][_0x1cac('0x7f')])&&(this['trunks'][util[_0x1cac('0x5c')](_0x1cac('0x119'),_0xeb3202['name'])][_0x1cac('0x7f')]===_0x1cac('0x11a')||this['trunks'][util[_0x1cac('0x5c')](_0x1cac('0x119'),_0xeb3202['name'])][_0x1cac('0x7f')]===_0x1cac('0x11b'));};Preview[_0x1cac('0x69')][_0x1cac('0x8e')]=function(_0x3e82f4,_0x18ccac){var _0x3c7379=this;return new BPromise(function(_0x4afbaf,_0x12eb3d){_0x3c7379[_0x1cac('0x11c')](_0x3e82f4,_0x18ccac)[_0x1cac('0x8a')](function(_0x1ea88f){_0x4afbaf(_[_0x1cac('0x79')](_0x1ea88f,[_0x1cac('0x66')]));})['catch'](function(_0x1ee396){if(_0x1ee396['unlock']){rpcDb['unlockContact'](_0x3e82f4);}if(_0x1ee396[_0x1cac('0x56')]){rpcDb[_0x1cac('0x91')](_0x3e82f4);}_0x12eb3d(_[_0x1cac('0x79')](_0x1ee396,['message']));});});};Preview[_0x1cac('0x69')]['execRun']=function(_0x29ccfc,_0x3ade15){var _0x39738c=this;return new BPromise(function(_0x21ce02,_0x2f69eb){var _0x2f29d9,_0x3c3933;rpcDb['getContactPreview'](_0x29ccfc)[_0x1cac('0x8a')](function(_0x207171){if(!_[_0x1cac('0x73')](_0x207171[0x0])){_0x3c3933=_0x207171[0x0][_0x1cac('0x11d')]?![]:!![];_0x2f29d9=_0x207171[0x0][_0x1cac('0x11d')]?!![]:![];_0x2f29d9=_0x3ade15?!![]:_0x2f29d9;}var _0x27b2d7=_0x39738c[_0x1cac('0x11e')](_0x207171);if(_0x27b2d7['isValid']){rpcDb[_0x1cac('0x11f')](_[_0x1cac('0x79')](_0x207171[0x0],[_0x1cac('0x7c'),_0x1cac('0x120')]))[_0x1cac('0x8a')](function(_0x272ff2){_0x39738c[_0x1cac('0x107')](_0x272ff2,_0x207171[0x0],_0x3ade15,_0x3c3933,_0x2f29d9)[_0x1cac('0x8a')](function(_0x1b33b2){_0x21ce02(_0x1b33b2);})[_0x1cac('0x80')](function(_0x3ccc77){_0x2f69eb(_0x3ccc77);});})[_0x1cac('0x80')](function(_0x2b324e){ut[_0x1cac('0x63')](_0x1cac('0x121'),_0x2b324e);_0x2f69eb(ut['message'](_0x1cac('0x122'),_0x3c3933,_0x2f29d9));});}else{_0x2f69eb(ut[_0x1cac('0x66')](_0x27b2d7['message'],_0x3c3933,_0x2f29d9));}})['catch'](function(_0x13088f){ut[_0x1cac('0x63')]('[Preview][getContactPreview]',_0x13088f);_0x2f69eb(ut['message'](_0x1cac('0x122'),![],!![]));});});};Preview['prototype']['validateContact']=function(_0x1a9784){if(_[_0x1cac('0x73')](_0x1a9784)||_[_0x1cac('0x10c')](_0x1a9784)||!_[_0x1cac('0x73')](_0x1a9784[0x0]['Agent'])&&_[_0x1cac('0x73')](_0x1a9784[0x0][_0x1cac('0x8c')][_0x1cac('0x2b')])){ut[_0x1cac('0x63')](_0x1cac('0x123'),_0x1a9784);return{'isValid':![],'message':_0x1cac('0x124')};}var _0xc9261=this[_0x1cac('0x15')][_0x1a9784[0x0]['Queue'][_0x1cac('0x2b')]];_0xc9261[_0x1cac('0x66')]=_0x1cac('0xa1');if(_[_0x1cac('0x73')](_0xc9261)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0xc9261);return{'isValid':![],'message':_0x1cac('0x125')};}if(!this[_0x1cac('0x9e')](_0xc9261[_0x1cac('0x55')])){ut[_0x1cac('0x63')](_0x1cac('0x126'),_0x1cac('0x127')+_0xc9261['name']+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0xc9261[_0x1cac('0x9f')])){ut[_0x1cac('0x63')]('[Preview][validateContact][Trunk\x20not\x20work]',_0xc9261[_0x1cac('0x2b')]+_0x1cac('0x128'));return{'isValid':![],'message':_0x1cac('0x129')};}}if(!ut['isActive'](_0xc9261[_0x1cac('0x6f')])){ut[_0x1cac('0x63')]('[Preview][validateContact][Campaign\x20Active]',_0xc9261['name']+_0x1cac('0x12a'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0xc9261[_0x1cac('0x2b')]+_0x1cac('0x12a')};}return{'isValid':!![],'message':_0x1cac('0x12b')};};Preview[_0x1cac('0x69')][_0x1cac('0x10d')]=function(_0x517a67,_0x459ee9,_0x1b4f30,_0x40c31d){var _0xe4a6a8=this;return new BPromise(function(_0x5d0861,_0x20dc73){var _0x4c99c2=_0x517a67[_0x1cac('0xb3')];var _0x42fa2f=_0xe4a6a8[_0x1cac('0x9e')](_0x459ee9['Trunk'])?util[_0x1cac('0x5c')]('SIP/%s/%s%s',_0x459ee9[_0x1cac('0x55')]['name'],_[_0x1cac('0x73')](_0x459ee9[_0x1cac('0x38')])?'':_0x459ee9[_0x1cac('0x38')][_0x1cac('0x12c')]()||'',_0x459ee9[_0x1cac('0x12d')]>0x0?_0x1b4f30[_0x1cac('0x108')][_0x1cac('0x109')][_0x1cac('0x12e')](_0x459ee9[_0x1cac('0x12d')]):_0x1b4f30[_0x1cac('0x108')][_0x1cac('0x109')]):util[_0x1cac('0x5c')](_0x1cac('0x12f'),_[_0x1cac('0x73')](_0x459ee9['TrunkBackup'])?_0x459ee9[_0x1cac('0x55')][_0x1cac('0x2b')]:_0x459ee9[_0x1cac('0x9f')][_0x1cac('0x2b')],_['isNil'](_0x459ee9[_0x1cac('0x38')])?'':_0x459ee9[_0x1cac('0x38')][_0x1cac('0x12c')]()||'',_0x459ee9[_0x1cac('0x12d')]>0x0?_0x1b4f30[_0x1cac('0x108')]['phone'][_0x1cac('0x12e')](_0x459ee9[_0x1cac('0x12d')]):_0x1b4f30[_0x1cac('0x108')]['phone']);var _0x320702=_0xe4a6a8[_0x1cac('0x9e')](_0x459ee9[_0x1cac('0x55')])?ut[_0x1cac('0x130')](_0x459ee9['Trunk'][_0x1cac('0x57')],_0x459ee9[_0x1cac('0x35')],_0x459ee9[_0x1cac('0x131')]>0x0?ut[_0x1cac('0x132')](_0x459ee9[_0x1cac('0x36')],_0x459ee9[_0x1cac('0x131')]):_0x459ee9[_0x1cac('0x36')]):ut[_0x1cac('0x130')](_[_0x1cac('0x73')](_0x459ee9[_0x1cac('0x9f')])?_0x459ee9[_0x1cac('0x55')][_0x1cac('0x57')]:_0x459ee9[_0x1cac('0x9f')]['callerid'],_0x459ee9[_0x1cac('0x35')],_0x459ee9[_0x1cac('0x131')]>0x0?ut[_0x1cac('0x132')](_0x459ee9[_0x1cac('0x36')],_0x459ee9[_0x1cac('0x131')]):_0x459ee9['dialOriginateCallerIdNumber']);if(_0x320702){_0x517a67[_0x1cac('0x133')]=ut['extractCalleridName'](_0x320702);_0x517a67['originatecalleridnum']=ut[_0x1cac('0x134')](_0x320702);}var _0x37aeaa=ut[_0x1cac('0x135')](_0x459ee9,_0x1b4f30,_0x42fa2f,_0x320702,_0x4c99c2,_0x517a67);_[_0x1cac('0x136')](_0x517a67,ut[_0x1cac('0x137')](_0x37aeaa));_0x517a67[_0x1cac('0x138')]=moment()[_0x1cac('0x5c')](_0x1cac('0x92'));ami['Action'](ut[_0x1cac('0x139')](_0x517a67,_0x459ee9,_0x37aeaa,_0x517a67[_0x1cac('0xae')],_0x40c31d))[_0x1cac('0x8a')](function(_0x43ab7e){_0x459ee9[_0x1cac('0x5e')]+=0x1;logger['info'](_0x1cac('0x13a'),_0x4c99c2,_0x1cac('0xb4'),_0x459ee9['name'],'originated:\x20',_0x459ee9[_0x1cac('0x5e')]);_0x5d0861(_0x43ab7e);})[_0x1cac('0x80')](function(_0x46d032){ut['logAgent'](_0x517a67,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x517a67,_0x1cac('0x13b'));_0x20dc73(_0x46d032);});});};Preview[_0x1cac('0x69')][_0x1cac('0x22')]=function(_0x566934){if(this['actions'][_0x566934['linkedid']]){this[_0x1cac('0x18')][_0x566934['linkedid']][_0x1cac('0x13c')]=_0x566934['channel'];}};Preview[_0x1cac('0x69')][_0x1cac('0x1c')]=function(_0xfd35e9){var _0xe5f42d=this;var _0x5bfb0d=this[_0x1cac('0x18')][_0xfd35e9['actionid']];if(_0x5bfb0d){if(_0x5bfb0d[_0x1cac('0x10b')]&&this[_0x1cac('0x19')][_0x5bfb0d['lookAgent']]){ut[_0x1cac('0x13d')](_0x5bfb0d,this[_0x1cac('0x19')][_0x5bfb0d['lookAgent']][_0x1cac('0x2b')],this[_0x1cac('0x19')][_0x5bfb0d[_0x1cac('0x10b')]]['id']);}var _0x2dfc64=_[_0x1cac('0x13e')](_0x5bfb0d);_0x2dfc64[_0x1cac('0xb0')]=moment()[_0x1cac('0x5c')](_0x1cac('0x92'));var _0xe2f4d4=_0xe5f42d[_0x1cac('0x15')][_0x5bfb0d['queue']];if(ut[_0x1cac('0x13f')](_0xfd35e9[_0x1cac('0x140')])){if(_0x5bfb0d[_0x1cac('0xad')]){rpcDb[_0x1cac('0x141')](_0x5bfb0d['idContact']);}if(_0x5bfb0d[_0x1cac('0xae')]){rpcDb[_0x1cac('0x91')](_0x5bfb0d['idContact']);}ami[_0x1cac('0x29')](_0x1cac('0x142'),ut[_0x1cac('0xa7')](_0x5bfb0d,_0x1cac('0x143')));this[_0x1cac('0xf9')](_0x2dfc64,_0xe2f4d4,_0xfd35e9);}else{_0x5bfb0d[_0x1cac('0x138')]=moment()[_0x1cac('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x1cac('0xfd')](_0x2dfc64,0x4,_0x1cac('0x144'));rpcDb[_0x1cac('0x103')](_0x2dfc64,_0x1cac('0x145'));}}};Preview[_0x1cac('0x69')][_0x1cac('0x1e')]=function(_0x35c6de){var _0x3b5997=this;var _0x137d83=this['actions'][_0x35c6de[_0x1cac('0xc5')]];var _0x4e4451;if(_0x137d83){_0x4e4451=this[_0x1cac('0x15')][_0x137d83[_0x1cac('0x76')]];logger[_0x1cac('0x5b')](_0x1cac('0x146'),_0x35c6de[_0x1cac('0xc5')],_0x1cac('0xb4'),_0x4e4451[_0x1cac('0x2b')],_0x1cac('0x147'),_0x4e4451[_0x1cac('0x5f')]);}if(this[_0x1cac('0x18')][_0x35c6de[_0x1cac('0xc5')]]&&_0x35c6de[_0x1cac('0xc5')]!==_0x35c6de[_0x1cac('0xb3')]){if(_0x35c6de[_0x1cac('0x148')]==='16'&&this[_0x1cac('0x18')][_0x35c6de['linkedid']]['dialAnswer']){this[_0x1cac('0xa2')](_0x35c6de,_0x35c6de[_0x1cac('0xc5')],_0x35c6de[_0x1cac('0x148')]);}else if(this['actions'][_0x35c6de[_0x1cac('0xc5')]][_0x1cac('0x84')]){logger['info'](_0x1cac('0x149'),_0x35c6de[_0x1cac('0xc5')],_0x35c6de[_0x1cac('0x148')],_0x1cac('0xb4'),_0x4e4451[_0x1cac('0x2b')],_0x1cac('0x147'),_0x4e4451[_0x1cac('0x5f')]);this[_0x1cac('0xa2')](_0x35c6de,_0x35c6de[_0x1cac('0xc5')],_0x35c6de['cause']);}}else if(_0x137d83&&_[_0x1cac('0x73')](_0x137d83[_0x1cac('0x14a')])&&_0x4e4451[_0x1cac('0x14b')]&&_0x35c6de[_0x1cac('0xc5')]===_0x35c6de[_0x1cac('0xb3')]&&_[_0x1cac('0x73')](_0x35c6de[_0x1cac('0xfc')])&&_0x35c6de[_0x1cac('0x148')]==='16'&&_0x35c6de[_0x1cac('0x14c')]==='6'&&_[_0x1cac('0xfa')](_0x137d83['transfer'])){if(_0x137d83[_0x1cac('0xad')]){rpcDb[_0x1cac('0x141')](_0x137d83[_0x1cac('0x10f')]);}if(_0x137d83[_0x1cac('0xae')]){rpcDb['disableContact'](_0x137d83['idContact']);}_0x35c6de[_0x1cac('0xfc')]='22';this[_0x1cac('0xf9')](_0x137d83,_0x4e4451,_0x35c6de);}else if(_0x137d83&&_0x137d83[_0x1cac('0x14d')]){if(_0x35c6de[_0x1cac('0x148')]==='16'&&this[_0x1cac('0x18')][_0x35c6de['linkedid']]['dialAnswer']){logger[_0x1cac('0x5b')](_0x1cac('0x14e'),_0x35c6de[_0x1cac('0xc5')],_0x35c6de[_0x1cac('0x148')],'\x20Queue',_0x4e4451[_0x1cac('0x2b')],_0x1cac('0x147'),_0x4e4451[_0x1cac('0x5f')]);this[_0x1cac('0xa2')](_0x35c6de,_0x35c6de['linkedid'],_0x35c6de['cause']);}else if(this[_0x1cac('0x18')][_0x35c6de[_0x1cac('0xc5')]][_0x1cac('0x84')]){logger[_0x1cac('0x5b')](_0x1cac('0x149'),_0x35c6de['linkedid'],_0x35c6de[_0x1cac('0x148')],_0x1cac('0xb4'),_0x4e4451[_0x1cac('0x2b')],_0x1cac('0x147'),_0x4e4451['pTalking']);this[_0x1cac('0xa2')](_0x35c6de,_0x35c6de['linkedid'],_0x35c6de[_0x1cac('0x148')]);}}};Preview['prototype'][_0x1cac('0x14f')]=function(_0x35dcc7){if(this[_0x1cac('0x18')][_0x35dcc7[_0x1cac('0xf8')]]&&_0x35dcc7[_0x1cac('0xf8')]!==_0x35dcc7[_0x1cac('0x150')]){this['callProgressDetectingCustomer'](_0x35dcc7,_0x35dcc7[_0x1cac('0xf8')],_0x35dcc7[_0x1cac('0xf4')]);}};Preview['prototype'][_0x1cac('0x151')]=function(_0x470479){if(this['actions'][_0x470479[_0x1cac('0xc5')]]&&_0x470479[_0x1cac('0xc5')]!==_0x470479[_0x1cac('0xb3')]&&!this[_0x1cac('0x18')][_0x470479[_0x1cac('0xc5')]]['dialAnswer']){if(_0x470479[_0x1cac('0x148')]==='1'){this[_0x1cac('0xa2')](_0x470479,_0x470479[_0x1cac('0xc5')],_0x470479[_0x1cac('0x148')]);}}};Preview[_0x1cac('0x69')][_0x1cac('0x152')]=function(_0x3884a2,_0x13cd80,_0x1ae2f8){if(this[_0x1cac('0x18')][_0x3884a2]){if(_[_0x1cac('0x73')](this[_0x1cac('0x18')][_0x3884a2][_0x1cac('0x153')])){this['actions'][_0x3884a2][_0x1cac('0x153')]={};}this[_0x1cac('0x18')][_0x3884a2][_0x1cac('0x153')][_0x13cd80]=_0x1ae2f8;}};Preview[_0x1cac('0x69')][_0x1cac('0x24')]=function(_0x50c209){try{if(!_[_0x1cac('0x73')](_0x50c209)){if(ut[_0x1cac('0x154')](_[_0x1cac('0x155')](_0x50c209[_0x1cac('0x156')])[0x0])){this[_0x1cac('0x152')](_0x50c209[_0x1cac('0xb3')],_[_0x1cac('0x155')](_0x50c209[_0x1cac('0x156')])[0x0],_0x50c209[_0x1cac('0x157')]);}}}catch(_0x2fb248){logger[_0x1cac('0x158')](_0x1cac('0x159'),util['inspect'](_0x2fb248,{'showHidden':![],'depth':null}));}};Preview[_0x1cac('0x69')][_0x1cac('0x26')]=function(_0xbdf61e){if(_0xbdf61e){if(this[_0x1cac('0x18')][_0xbdf61e[_0x1cac('0x15a')]]){this[_0x1cac('0x18')][_0xbdf61e[_0x1cac('0x15a')]][_0x1cac('0x14d')]=!![];}}};Preview[_0x1cac('0x69')]['syncBlindTransfer']=function(_0x511e72){if(_0x511e72){if(this[_0x1cac('0x18')][_0x511e72[_0x1cac('0x15b')]]){this[_0x1cac('0x18')][_0x511e72[_0x1cac('0x15b')]][_0x1cac('0x14d')]=!![];}}};module[_0x1cac('0x15c')]=Preview; \ No newline at end of file +var _0x629d=['[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','unlockAgent','activeContact','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','acw','custom:agentConnectPreview','custom:agentcomplete','complete','total','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','pTalking:\x20','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','cloneAction','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countcongestionretry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','\x20Queue','checkInBlack','Contact','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','called','Calling','Call\x20failed','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','TrunkBackup','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','substring','dialCutDigit','phone','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','[originated][increment]','OriginateError','actionid','clone','response','rejected','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','variables','variable','addVariable','keys','value','error','transfertargetlinkedid','transfererlinkedid','exports','util','uuid','md5','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./util/util','redis','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','syncOriginateResponse','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','sumBillable','sumDuration','talking','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','pTalking','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','recallMe','clearZombieChannel','isNil','Queue','actions','queue','dialAnswer','pick','contactId','UserId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','[HistoryRecallClose]','createCustomerFinal','setMessage','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','custom:agentnosuchnumber','buildObj','nosuchnumber'];(function(_0x2a9cdd,_0x27eab1){var _0xe215ca=function(_0x39b3e9){while(--_0x39b3e9){_0x2a9cdd['push'](_0x2a9cdd['shift']());}};_0xe215ca(++_0x27eab1);}(_0x629d,0x1e7));var _0xd629=function(_0x188c88,_0x210793){_0x188c88=_0x188c88-0x0;var _0x4e4c38=_0x629d[_0x188c88];return _0x4e4c38;};'use strict';var util=require(_0xd629('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0xd629('0x1'));var moment=require('moment');var md5=require(_0xd629('0x2'));var Redis=require('ioredis');var config=require(_0xd629('0x3'));var logger=require('../../../config/logger')(_0xd629('0x4'));var loggerAction=require(_0xd629('0x5'))(_0xd629('0x6'));var ami=require(_0xd629('0x7'));var rpcDb=require(_0xd629('0x8'));var Action=require('./action');var ut=require(_0xd629('0x9'));config[_0xd629('0xa')]=_['defaults'](config[_0xd629('0xa')],{'host':_0xd629('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd629('0xa')]));var Sequence=function(){};Sequence[_0xd629('0xc')][_0xd629('0xd')]=function(_0x58b2ed){this[_0xd629('0xe')]=this[_0xd629('0xe')]?this['tail'][_0xd629('0xf')](_0x58b2ed):_0x58b2ed();};function Preview(_0x4346bb){this[_0xd629('0x10')]=new Sequence();this[_0xd629('0x11')]=_0x4346bb[_0xd629('0x12')];this[_0xd629('0x13')]=_0x4346bb[_0xd629('0x13')];this['actions']={};this[_0xd629('0x14')]=_0x4346bb[_0xd629('0x14')];this[_0xd629('0x15')]=0x0;ami['on']('originateresponse',this[_0xd629('0x16')]['bind'](this));ami['on'](_0xd629('0x17'),this[_0xd629('0x18')][_0xd629('0x19')](this));ami['on'](_0xd629('0x1a'),this[_0xd629('0x1b')][_0xd629('0x19')](this));ami['on']('dialend',this[_0xd629('0x1c')][_0xd629('0x19')](this));ami['on']('newexten',this[_0xd629('0x1d')][_0xd629('0x19')](this));ami['on'](_0xd629('0x1e'),this[_0xd629('0x1f')][_0xd629('0x19')](this));ami['on'](_0xd629('0x20'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xd629('0x21'),this[_0xd629('0x22')][_0xd629('0x19')](this));this[_0xd629('0x23')](this[_0xd629('0x11')]);}function emit(_0x382902,_0x28898c,_0x4d9a51){io['to'](_0x382902)[_0xd629('0x24')](_0x28898c,_0x4d9a51);}function emitCampaignPreview(_0x5bdf39){if(_0x5bdf39[_0xd629('0x25')]===_0xd629('0x26')){var _0x32234e={'id':_0x5bdf39['id'],'name':_0x5bdf39[_0xd629('0x27')],'strategy':_0x5bdf39[_0xd629('0x28')],'answered':_0x5bdf39[_0xd629('0x29')],'available':_0x5bdf39[_0xd629('0x2a')],'loggedIn':_0x5bdf39[_0xd629('0x2b')],'pTalking':_0x5bdf39['pTalking'],'sumBillable':_0x5bdf39[_0xd629('0x2c')],'sumDuration':_0x5bdf39[_0xd629('0x2d')],'sumHoldTime':_0x5bdf39['sumHoldTime']||0x0,'talking':_0x5bdf39[_0xd629('0x2e')],'total':_0x5bdf39['total'],'type':_0x5bdf39[_0xd629('0x25')],'unmanaged':_0x5bdf39[_0xd629('0x2f')],'abandoned':_0x5bdf39['abandoned'],'waiting':_0x5bdf39[_0xd629('0x30')],'loggedInDb':_0x5bdf39[_0xd629('0x31')],'dialActive':_0x5bdf39[_0xd629('0x32')],'dialMethod':_0x5bdf39[_0xd629('0x33')],'dialOriginateCallerIdName':_0x5bdf39[_0xd629('0x34')],'dialOriginateCallerIdNumber':_0x5bdf39[_0xd629('0x35')],'dialOriginateTimeout':_0x5bdf39['dialOriginateTimeout'],'dialPrefix':_0x5bdf39[_0xd629('0x36')],'outboundAnswerAgiCallsDay':_0x5bdf39[_0xd629('0x37')],'outboundAnswerCallsDay':_0x5bdf39[_0xd629('0x38')],'outboundBlacklistCallsDay':_0x5bdf39[_0xd629('0x39')],'outboundBusyCallsDay':_0x5bdf39['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x5bdf39['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x5bdf39[_0xd629('0x3a')],'outboundDropCallsDayCallersExit':_0x5bdf39['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x5bdf39[_0xd629('0x3b')],'outboundNoAnswerCallsDay':_0x5bdf39['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x5bdf39['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x5bdf39['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5bdf39[_0xd629('0x3c')],'outboundRejectCallsDay':_0x5bdf39[_0xd629('0x3d')],'outboundUnknownCallsDay':_0x5bdf39[_0xd629('0x3e')],'outboundAbandonedCallsDay':_0x5bdf39['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x5bdf39[_0xd629('0x3f')],'predictiveIntervalAvgHoldtime':_0x5bdf39[_0xd629('0x40')],'predictiveIntervalAvgTalktime':_0x5bdf39[_0xd629('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x5bdf39['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x5bdf39[_0xd629('0x42')],'predictiveIntervalErlangCalls':_0x5bdf39[_0xd629('0x43')],'predictiveIntervalErlangCallsDroppedCalls':_0x5bdf39[_0xd629('0x44')],'predictiveIntervalHitRate':_0x5bdf39[_0xd629('0x45')],'predictiveIntervalMultiplicativeFactor':_0x5bdf39[_0xd629('0x46')],'predictiveIntervalPauses':_0x5bdf39[_0xd629('0x47')],'predictiveIntervalAvailable':_0x5bdf39[_0xd629('0x48')],'predictiveIntervalTotalCalls':_0x5bdf39[_0xd629('0x49')],'message':_0x5bdf39[_0xd629('0x4a')],'originated':_0x5bdf39[_0xd629('0x4b')],'erlangCalls':_0x5bdf39[_0xd629('0x4c')],'erlangCallToSecond':_0x5bdf39[_0xd629('0x4d')],'erlangAbandonmentRate':_0x5bdf39[_0xd629('0x4e')],'erlangBusyFactor':_0x5bdf39[_0xd629('0x4f')],'startPredictive':_0x5bdf39['startPredictive'],'startProgressive':_0x5bdf39[_0xd629('0x50')]};if(_0x5bdf39['Trunk']){_0x32234e[_0xd629('0x51')]={'id':_0x5bdf39[_0xd629('0x51')]['id'],'name':_0x5bdf39[_0xd629('0x51')][_0xd629('0x27')],'active':_0x5bdf39[_0xd629('0x51')][_0xd629('0x52')],'callerid':_0x5bdf39['Trunk'][_0xd629('0x53')]};}if(_0x5bdf39[_0xd629('0x54')]){_0x32234e['Interval']={'id':_0x5bdf39[_0xd629('0x54')]['id'],'name':_0x5bdf39[_0xd629('0x54')]['name']};}var _0x398feb=md5(JSON[_0xd629('0x55')](_0x32234e));if(_0x5bdf39[_0xd629('0x2')]!==_0x398feb){_0x5bdf39['md5']=_0x398feb;emit(util[_0xd629('0x56')](_0xd629('0x57'),_0x32234e[_0xd629('0x27')]),'voice_queue:save',_0x32234e);}}}function emitVoiceQueueChannelRemove(_0x1c4fc5){logger[_0xd629('0x58')](_0xd629('0x59'),JSON['stringify'](_0x1c4fc5));emit(util[_0xd629('0x56')](_0xd629('0x57'),_0x1c4fc5['name']),_0xd629('0x5a'),_0x1c4fc5);}function notSendMessagesQueue(_0x3ef7ed){if(_0x3ef7ed['sendMessageOneNotActive']){if(_0x3ef7ed[_0xd629('0x4b')]===0x0&&_0x3ef7ed[_0xd629('0x5b')]===0x0){_0x3ef7ed[_0xd629('0x5c')]=![];_0x3ef7ed[_0xd629('0x2a')]=0x0;_0x3ef7ed[_0xd629('0x5d')]=0x0;_0x3ef7ed[_0xd629('0x4a')]=_0xd629('0x5e');ut[_0xd629('0x5f')](_0xd629('0x60'),_0x3ef7ed['name']+_0xd629('0x61'));}else{_0x3ef7ed[_0xd629('0x4a')]=_0xd629('0x62');ut[_0xd629('0x5f')](_0xd629('0x60'),_0x3ef7ed[_0xd629('0x27')]+_0xd629('0x63'));}emitCampaignPreview(_0x3ef7ed);}}Preview[_0xd629('0xc')][_0xd629('0x23')]=function(){var _0x429e3f=this;setInterval(function(){_0x429e3f[_0xd629('0x64')]();},0x7cf);};Preview[_0xd629('0xc')][_0xd629('0x64')]=function(){var _0x498935=this[_0xd629('0x11')];this['clockClearZombieChannels']+=0x1;for(var _0x361dc9 in _0x498935){if(_0x498935[_0xd629('0x65')](_0x361dc9)&&(_0x498935[_0x361dc9][_0xd629('0x33')]===_0xd629('0x4')||_0x498935[_0x361dc9][_0xd629('0x33')]===_0xd629('0x66'))&&_0x498935[_0x361dc9][_0xd629('0x25')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0xd629('0x15')]=0x0;this[_0xd629('0x67')]();}}if(_0x498935['hasOwnProperty'](_0x361dc9)&&_0x498935[_0x361dc9][_0xd629('0x33')]===_0xd629('0x4')&&_0x498935[_0x361dc9][_0xd629('0x25')]===_0xd629('0x26')){if(_0x498935[_0x361dc9][_0xd629('0x32')]){this['setMessage'](_0x498935[_0x361dc9]);this[_0xd629('0x68')](_0x498935[_0x361dc9]);}else{notSendMessagesQueue(_0x498935[_0x361dc9]);}}}};Preview[_0xd629('0xc')][_0xd629('0x69')]=function(_0x56b182){var _0x496473=this;this['sequence'][_0xd629('0xd')](function(){if(!_[_0xd629('0x6a')](_0x496473['actions'][_0x56b182])){loggerAction[_0xd629('0x58')]('[clearZombieChannels][talking]',_0x56b182,_0xd629('0x6b'),_0x496473[_0xd629('0x6c')][_0x56b182]['queue'],'originated:\x20',JSON['stringify'](_0x496473[_0xd629('0x11')][_0x496473['actions'][_0x56b182][_0xd629('0x6d')]]['originated']),'pTalking:\x20',JSON[_0xd629('0x55')](_0x496473['campaignsPreview'][_0x496473[_0xd629('0x6c')][_0x56b182][_0xd629('0x6d')]][_0xd629('0x5b')]),JSON['stringify'](_0x496473[_0xd629('0x6c')][_0x56b182][_0xd629('0x6e')]),JSON['stringify'](_[_0xd629('0x6f')](_0x496473['actions'][_0x56b182],[_0xd629('0x70'),_0xd629('0x71'),'VoiceQueueId','ListId'])));return ami[_0xd629('0x72')]({'action':_0xd629('0x73'),'channel':_0x496473[_0xd629('0x6c')][_0x56b182][_0xd629('0x74')]})[_0xd629('0x75')](function(_0x3bc697){if(_0x3bc697[_0xd629('0x4a')]===_0xd629('0x76')){setTimeout(function(){if(_0x496473[_0xd629('0x6c')][_0x56b182]){ut[_0xd629('0x77')](_0x496473[_0xd629('0x11')][_0x496473[_0xd629('0x6c')][_0x56b182][_0xd629('0x6d')]],_0xd629('0x78'));if(_0x496473[_0xd629('0x6c')][_0x56b182][_0xd629('0x6e')]===!![]){ut[_0xd629('0x79')](_0x496473[_0xd629('0x11')][_0x496473['actions'][_0x56b182]['queue']],_0xd629('0x78'));ut['loggerError'](_0xd629('0x7a')+_0x56b182,_0x496473['actions'][_0x56b182][_0xd629('0x6d')]);}ut['loggerError'](_0xd629('0x7b')+_0x56b182,_0x496473[_0xd629('0x6c')][_0x56b182][_0xd629('0x6d')]);delete _0x496473[_0xd629('0x6c')][_0x56b182];}},0x2328);}});}});};Preview[_0xd629('0xc')][_0xd629('0x67')]=function(){var _0x151d6a=this;loggerAction[_0xd629('0x58')](_0xd629('0x7c'),_[_0xd629('0x7d')](this['actions']));for(var _0x124d3e in this['actions']){if(_0x151d6a['actions'][_0xd629('0x65')](_0x124d3e)){_0x151d6a[_0xd629('0x69')](_0x124d3e);}}};Preview[_0xd629('0xc')][_0xd629('0x68')]=function(_0x551998){var _0xa18a59=this;rpcDb['getContactRecallMe'](_0x551998['id'],ut[_0xd629('0x7e')](this[_0xd629('0x14')]))[_0xd629('0x7f')](function(_0x31b0b2){if(!_[_0xd629('0x6a')](_0x31b0b2)){for(var _0x1ac4c8=0x0;_0x1ac4c8<_0x31b0b2['length'];_0x1ac4c8+=0x1){if(ut[_0xd629('0x80')](_0x31b0b2[_0x1ac4c8][_0xd629('0x81')])<_0x551998[_0xd629('0x82')]*0x3c){if(_0x31b0b2[_0x1ac4c8][_0xd629('0x83')]&&!_0x31b0b2[_0x1ac4c8][_0xd629('0x83')]['voicePause']){_0xa18a59[_0xd629('0x84')](_0x31b0b2[_0x1ac4c8]['id'])[_0xd629('0x7f')](ut[_0xd629('0x85')](_0xd629('0x86')))[_0xd629('0x75')](ut[_0xd629('0x85')]('[RecallMe]'));}else{rpcDb[_0xd629('0x87')](_0x31b0b2[_0x1ac4c8]['id']);}}else{var _0x7bd219=new Action(_0x31b0b2[_0x1ac4c8],_0x551998);_0x7bd219[_0xd629('0x88')]=moment()[_0xd629('0x56')](_0xd629('0x89'));_0x551998[_0xd629('0x3c')]+=0x1;ut['logCustomer'](_0x7bd219,0x17,_0xd629('0x8a'));if(_0x551998[_0xd629('0x8b')]){rpcDb['rescheduleContactInQueue'](ut[_0xd629('0x8c')](_0x31b0b2[_0x1ac4c8]));rpcDb[_0xd629('0x8d')](_0x7bd219,_0xd629('0x8e'));}else{ut[_0xd629('0x8f')](_0x7bd219,0x16,'RecallFailedTimeout');rpcDb[_0xd629('0x8d')](_0x7bd219,_0xd629('0x90'));rpcDb[_0xd629('0x91')](_0x7bd219,_0xd629('0x90'));}}}}})[_0xd629('0x75')](ut[_0xd629('0x85')]('[getContactRecallMe]'));};Preview[_0xd629('0xc')][_0xd629('0x92')]=function(_0x380124){_0x380124['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x380124['loggedIn'])){_0x380124[_0xd629('0x4a')]=_0xd629('0x93');}else if(!ut[_0xd629('0x94')](_0x380124[_0xd629('0x32')])){_0x380124[_0xd629('0x4a')]=_0xd629('0x5e');}else if(!this[_0xd629('0x95')](_0x380124[_0xd629('0x51')])){if(!this[_0xd629('0x95')](_0x380124['TrunkBackup'])){_0x380124[_0xd629('0x4a')]=_0xd629('0x96');}else{_0x380124[_0xd629('0x4a')]=_0xd629('0x97');}}else{_0x380124['message']=_0xd629('0x97');}emitCampaignPreview(_0x380124);};Preview[_0xd629('0xc')][_0xd629('0x98')]=function(_0x4575a9,_0x31d16d,_0x1864a8){var _0x83f1a3=this;var _0xe6845=this[_0xd629('0x6c')][_0x31d16d];var _0x49e9c3=this['campaignsPreview'][_0xe6845[_0xd629('0x6d')]];var _0xcbb7dc;if(_0x49e9c3){switch(_0x1864a8){case'1':_0x49e9c3[_0xd629('0x99')]+=0x1;_0xe6845[_0xd629('0x9a')]+=0x1;_0xe6845[_0xd629('0x9b')]=ut['totalGlobal'](_0xe6845);ut['logCustomer'](_0xe6845,0x0,'NoSuchNumber');ami[_0xd629('0x24')](_0xd629('0x9c'),ut[_0xd629('0x9d')](_0xe6845,_0xd629('0x9e')));rpcDb[_0xd629('0x8d')](_0xe6845,_0xd629('0x9f'));if(ut[_0xd629('0xa0')](_0xe6845)>=_0x49e9c3[_0xd629('0xa1')]){_0xcbb7dc=ut['cloneAction'](_0xe6845,0xf,'Global');rpcDb[_0xd629('0x91')](_0xcbb7dc,_0xd629('0xa2'));}else{if(_0xe6845[_0xd629('0x9a')]>=_0x49e9c3[_0xd629('0xa3')]){rpcDb[_0xd629('0x91')](_0xe6845,_0xd629('0xa2'));}else{rpcDb[_0xd629('0xa4')](ut['scheduledAt'](_0xe6845,_0xd629('0x9a'),_0x49e9c3['dialNoSuchNumberRetryFrequency']),_0xe6845[_0xd629('0xa5')],_0xe6845[_0xd629('0xa6')]);}}delete this[_0xd629('0x6c')][_0x4575a9['linkedid']];break;case _0xd629('0xa7'):var _0x58981f=moment()[_0xd629('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0xe6845[_0xd629('0xa8')]=_0x58981f;_0xe6845[_0xd629('0xa9')]=_0x58981f;_0xe6845[_0xd629('0x6e')]=!![];_0x49e9c3[_0xd629('0x5b')]+=0x1;logger[_0xd629('0x58')](_0xd629('0xaa'),_0xe6845[_0xd629('0xab')],'\x20Queue',_0x49e9c3['name'],'pTalking:\x20',_0x49e9c3[_0xd629('0x5b')]);ami[_0xd629('0x24')]('custom:agentconnect',ut['buildObj'](_0xe6845,'connect'));if(_0x49e9c3[_0xd629('0xac')]){ami[_0xd629('0x24')](_0xd629('0xad'),ut['buildAcw'](_0xe6845));}break;case'16':ami[_0xd629('0x24')](_0xd629('0xae'),ut['buildObj'](_0xe6845,_0xd629('0xaf')));emitVoiceQueueChannelRemove(ut['buildObj'](_0xe6845,_0xd629('0xaf')));_0x49e9c3[_0xd629('0x38')]+=0x1;_0x49e9c3[_0xd629('0xb0')]+=0x1;_0x49e9c3[_0xd629('0x29')]+=0x1;ut[_0xd629('0x79')](_0x49e9c3,'[16]');_0xe6845[_0xd629('0x9b')]=ut[_0xd629('0xa0')](_0xe6845);ut[_0xd629('0x8f')](_0xe6845,0x4,_0xd629('0xb1'));rpcDb[_0xd629('0x8d')](_0xe6845,_0xd629('0xb2'));rpcDb[_0xd629('0x91')](_0xe6845,_0xd629('0xb3'));rpcDb['crateCustomerReportQueue'](_0xe6845);_0x49e9c3[_0xd629('0x2d')]+=_0xe6845[_0xd629('0xb4')];_0x49e9c3[_0xd629('0x2c')]+=_0xe6845[_0xd629('0xb4')];logger[_0xd629('0x58')](_0xd629('0xb5'),_0xe6845[_0xd629('0xab')],'\x20Queue',_0x49e9c3[_0xd629('0x27')],_0xd629('0xb6'),_0x49e9c3[_0xd629('0x5b')]);delete this[_0xd629('0x6c')][_0x4575a9[_0xd629('0xb7')]];break;case _0xd629('0xb8'):_0x49e9c3[_0xd629('0xb9')]+=0x1;_0xe6845[_0xd629('0xba')]+=0x1;_0xe6845[_0xd629('0x9b')]=ut['totalGlobal'](_0xe6845);ut[_0xd629('0x8f')](_0xe6845,0x5,_0xd629('0xbb'));ami[_0xd629('0x24')]('custom:agentbusy',ut[_0xd629('0x9d')](_0xe6845,_0xd629('0xbc')));rpcDb[_0xd629('0x8d')](_0xe6845,_0xd629('0xbd'));if(ut[_0xd629('0xa0')](_0xe6845)>=_0x49e9c3[_0xd629('0xa1')]){_0xcbb7dc=ut['cloneAction'](_0xe6845,0xf,'Global');rpcDb[_0xd629('0x91')](_0xcbb7dc,_0xd629('0xbe'));}else{if(_0xe6845[_0xd629('0xba')]>=_0x49e9c3[_0xd629('0xbf')]){rpcDb[_0xd629('0x91')](_0xe6845,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xd629('0xa4')](ut[_0xd629('0xc0')](_0xe6845,_0xd629('0xba'),_0x49e9c3[_0xd629('0xc1')]),_0xe6845[_0xd629('0xa5')],_0xe6845[_0xd629('0xa6')]);}}break;case'NOANSWER':_0x49e9c3[_0xd629('0xc2')]+=0x1;_0xe6845[_0xd629('0xc3')]+=0x1;_0xe6845[_0xd629('0x9b')]=ut[_0xd629('0xa0')](_0xe6845);ut['logCustomer'](_0xe6845,0x3,_0xd629('0xc4'));ami[_0xd629('0x24')](_0xd629('0xc5'),ut['buildObj'](_0xe6845,'noanswer'));rpcDb[_0xd629('0x8d')](_0xe6845,_0xd629('0xc6'));if(ut['totalGlobal'](_0xe6845)>=_0x49e9c3['dialGlobalMaxRetry']){_0xcbb7dc=ut[_0xd629('0xc7')](_0xe6845,0xf,_0xd629('0xc8'));rpcDb[_0xd629('0x91')](_0xcbb7dc,_0xd629('0xc9'));}else{if(_0xe6845[_0xd629('0xc3')]>=_0x49e9c3[_0xd629('0xca')]){rpcDb[_0xd629('0x91')](_0xe6845,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0xd629('0xc0')](_0xe6845,'countnoanswerretry',_0x49e9c3['dialNoAnswerRetryFrequency']),_0xe6845[_0xd629('0xa5')],_0xe6845[_0xd629('0xa6')]);}}break;case _0xd629('0xcb'):_0x49e9c3[_0xd629('0xcc')]+=0x1;_0xe6845['countcongestionretry']+=0x1;_0xe6845[_0xd629('0x9b')]=ut[_0xd629('0xa0')](_0xe6845);ut[_0xd629('0x8f')](_0xe6845,0x8,_0xd629('0xcd'));ami[_0xd629('0x24')](_0xd629('0xce'),ut[_0xd629('0x9d')](_0xe6845,'congestion'));rpcDb[_0xd629('0x8d')](_0xe6845,_0xd629('0xcf'));if(ut[_0xd629('0xa0')](_0xe6845)>=_0x49e9c3[_0xd629('0xa1')]){_0xcbb7dc=ut[_0xd629('0xc7')](_0xe6845,0xf,_0xd629('0xc8'));rpcDb[_0xd629('0x91')](_0xcbb7dc,_0xd629('0xd0'));}else{if(_0xe6845['countcongestionretry']>=_0x49e9c3[_0xd629('0xd1')]){rpcDb[_0xd629('0x91')](_0xe6845,_0xd629('0xcf'));}else{rpcDb['rescheduleContact'](ut[_0xd629('0xc0')](_0xe6845,_0xd629('0xd2'),_0x49e9c3[_0xd629('0xc1')]),_0xe6845[_0xd629('0xa5')],_0xe6845['activeContact']);}}break;case _0xd629('0xd3'):_0x49e9c3[_0xd629('0x3d')]+=0x1;_0xe6845[_0xd629('0xd4')]+=0x1;_0xe6845['countglobal']=ut[_0xd629('0xa0')](_0xe6845);ut[_0xd629('0x8f')](_0xe6845,0x14,_0xd629('0xd5'));ami[_0xd629('0x24')](_0xd629('0xd6'),ut[_0xd629('0x9d')](_0xe6845,_0xd629('0xd7')));rpcDb[_0xd629('0x8d')](_0xe6845,'[syncHangupRequest][logAgentReject]');if(ut[_0xd629('0xa0')](_0xe6845)>=_0x49e9c3[_0xd629('0xa1')]){_0xcbb7dc=ut['cloneAction'](_0xe6845,0x14,'AgentReject');rpcDb[_0xd629('0x91')](_0xcbb7dc,_0xd629('0xd8'));}else{if(_0xe6845[_0xd629('0xd4')]>=_0x49e9c3['dialAgentRejectMaxRetry']){rpcDb[_0xd629('0x91')](_0xe6845,_0xd629('0xd8'));}else{rpcDb[_0xd629('0xa4')](ut['scheduledAt'](_0xe6845,_0xd629('0xd4'),_0x49e9c3[_0xd629('0xd9')]),_0xe6845[_0xd629('0xa5')],_0xe6845[_0xd629('0xa6')]);}}break;case _0xd629('0xda'):_0x49e9c3[_0xd629('0xdb')]+=0x1;_0xe6845['countabandonedretry']+=0x1;_0xe6845[_0xd629('0x9b')]=ut[_0xd629('0xa0')](_0xe6845);ut['logCustomer'](_0xe6845,0xb,_0xd629('0xdc'));rpcDb[_0xd629('0x8d')](_0xe6845,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xd629('0xa0')](_0xe6845)>=_0x49e9c3[_0xd629('0xa1')]){_0xcbb7dc=ut[_0xd629('0xc7')](_0xe6845,0xf,'Global');rpcDb[_0xd629('0x91')](_0xcbb7dc,_0xd629('0xdd'));}else{if(_0xe6845[_0xd629('0xde')]>=_0x49e9c3[_0xd629('0xdf')]){rpcDb[_0xd629('0x91')](_0xe6845,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0xd629('0xc0')](_0xe6845,_0xd629('0xe0'),_0x49e9c3[_0xd629('0xe1')]),_0xe6845[_0xd629('0xa5')],_0xe6845[_0xd629('0xa6')]);}}break;default:if(_0xe6845[_0xd629('0x6e')]){ut[_0xd629('0x79')](_0x49e9c3,_0xd629('0xe2'));ut['loggerError'](_0xd629('0xe3')+_0x49e9c3[_0xd629('0x27')],_0x4575a9);}_0x49e9c3[_0xd629('0x3e')]+=0x1;_0xe6845[_0xd629('0x9b')]=ut['totalGlobal'](_0xe6845);ut[_0xd629('0x8f')](_0xe6845,0xc,_0x4575a9[_0xd629('0xe4')]||_0x4575a9[_0xd629('0xe5')]);rpcDb['createCustomerHistory'](_0xe6845,_0xd629('0xe6'));if(ut[_0xd629('0xa0')](_0xe6845)>=_0x49e9c3['dialGlobalMaxRetry']){_0xcbb7dc=ut['cloneAction'](_0xe6845,0xf,_0xd629('0xc8'));rpcDb[_0xd629('0x91')](_0xcbb7dc,_0xd629('0xe7'));}else{rpcDb[_0xd629('0x91')](_0xe6845,_0xd629('0xe7'));}delete this[_0xd629('0x6c')][_0x4575a9[_0xd629('0xb7')]];}if(!(_0xe6845[_0xd629('0x6e')]&&_0x1864a8==='16')){ut[_0xd629('0x77')](_0x49e9c3,_0xd629('0xe8'));logger[_0xd629('0x58')]('[originated][decrement][callProgressDetectingCustomer]',_0xe6845['uniqueid'],'\x20Queue',_0x49e9c3[_0xd629('0x27')],_0xd629('0xe9'),_0x49e9c3['originated']);}if(_0x1864a8!==_0xd629('0xa7')){delete this[_0xd629('0x6c')][_0x4575a9[_0xd629('0xb7')]];delete this['actions'][_0x4575a9[_0xd629('0xea')]];}}};Preview[_0xd629('0xc')]['callProgressDetectingAgent']=function(_0x11700f,_0x2b7820,_0x511c71){if(_[_0xd629('0xeb')](_0x2b7820)&&'object'!==typeof _0x2b7820){return;}if(_[_0xd629('0xeb')](_0x511c71)&&_0xd629('0xec')!==typeof _0x511c71){return;}switch(_0x511c71[_0xd629('0xed')]){case'0':ut[_0xd629('0xee')](_0x11700f,0x0,'NoSuchNumber');rpcDb[_0xd629('0xef')](_0x11700f,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xd629('0xee')](_0x11700f,0x3,_0xd629('0xc4'));rpcDb[_0xd629('0xef')](_0x11700f,_0xd629('0xf0'));break;case'5':ut[_0xd629('0xee')](_0x11700f,0x5,_0xd629('0xbb'));rpcDb[_0xd629('0xef')](_0x11700f,_0xd629('0xf1'));break;case'8':ut[_0xd629('0xee')](_0x11700f,0x8,_0xd629('0xcd'));rpcDb[_0xd629('0xef')](_0x11700f,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xd629('0xee')](_0x11700f,0x16,_0xd629('0xf2'));rpcDb[_0xd629('0xef')](_0x11700f,_0xd629('0xf3'));break;default:ut[_0xd629('0xee')](_0x11700f,0xc,_0x511c71[_0xd629('0xed')]);rpcDb[_0xd629('0xef')](_0x11700f,_0xd629('0xf4'));}ut[_0xd629('0x77')](_0x2b7820,_0xd629('0xf5'));logger[_0xd629('0x58')](_0xd629('0xf6'),_0x11700f[_0xd629('0xab')],_0xd629('0xf7'),_0x2b7820[_0xd629('0x27')],_0xd629('0xe9'),_0x2b7820[_0xd629('0x4b')]);delete this[_0xd629('0x6c')][_0x11700f[_0xd629('0xab')]];};Preview['prototype'][_0xd629('0xf8')]=function(_0x4fb02d,_0x178049,_0x311942,_0x45aeaf,_0x17f946){var _0x146d3f=this;return new BPromise(function(_0x2fe878,_0x49b95e){if(_[_0xd629('0x6a')](_0x178049)||_[_0xd629('0x6a')](_0x178049['Contact'])||_[_0xd629('0x6a')](_0x178049[_0xd629('0xf9')]['phone'])||_[_0xd629('0x6a')](_0x178049[_0xd629('0xfa')])){_0x49b95e(ut[_0xd629('0x4a')](_0xd629('0xfb'),_0x45aeaf,_0x17f946));return;}var _0x435fca=uuid['v4']();var _0x41db4a=_0x146d3f[_0xd629('0x11')][_0x178049[_0xd629('0x6b')][_0xd629('0x27')]];var _0xc1d445=_0x311942?_0x146d3f[_0xd629('0x14')][_0x311942]['id']:undefined;_0x146d3f[_0xd629('0x6c')][_0x435fca]=new Action(_0x178049,_0x41db4a,_0x435fca,_0x311942,_0xc1d445);var _0x40bc5b=_0x146d3f['actions'][_0x435fca];_0x40bc5b[_0xd629('0xa5')]=_0x45aeaf;_0x40bc5b[_0xd629('0xa6')]=_0x17f946;_0x40bc5b[_0xd629('0xfc')]=_0x311942;if(_[_0xd629('0xfd')](_0x4fb02d)){_0x146d3f[_0xd629('0xfe')](_0x40bc5b,_0x41db4a,_0x178049,_0x311942)[_0xd629('0x7f')](function(_0xe316b7){logger[_0xd629('0x58')](_0xd629('0xff'),_0xd629('0x100')+_0x40bc5b[_0xd629('0x6d')]+_0xd629('0x101')+_0x40bc5b[_0xd629('0x102')],JSON[_0xd629('0x55')](_0xe316b7));ami[_0xd629('0x24')]('custom:agentcalled',ut[_0xd629('0x9d')](_0x40bc5b,_0xd629('0x103')));_0x2fe878(ut[_0xd629('0x4a')](_0xd629('0x104')));})[_0xd629('0x75')](function(_0x29b4e6){ut['logger']('[Preview][execCall][failure]',_0x29b4e6);_0x49b95e(ut[_0xd629('0x4a')](_0xd629('0x105'),_0x45aeaf,_0x17f946));});}else{_0x41db4a[_0xd629('0x39')]+=0x1;ut['logBlacklist'](_0x40bc5b);rpcDb[_0xd629('0x106')](_0x40bc5b,'[Blacklist][error]');delete _0x146d3f[_0xd629('0x6c')][_0x435fca];_0x49b95e(ut[_0xd629('0x4a')](_0xd629('0x107'),_0x45aeaf,_0x17f946));}});};Preview[_0xd629('0xc')][_0xd629('0x95')]=function(_0x17ec5a){return!_['isNil'](_0x17ec5a)&&!_[_0xd629('0x6a')](_0x17ec5a[_0xd629('0x27')])&&!_['isNil'](_0x17ec5a[_0xd629('0x52')])&&_0x17ec5a[_0xd629('0x52')]&&!_['isNil'](this[_0xd629('0x13')][util[_0xd629('0x56')](_0xd629('0x108'),_0x17ec5a[_0xd629('0x27')])])&&!_[_0xd629('0x6a')](this['trunks'][util[_0xd629('0x56')](_0xd629('0x108'),_0x17ec5a[_0xd629('0x27')])][_0xd629('0x73')])&&(this[_0xd629('0x13')][util['format'](_0xd629('0x108'),_0x17ec5a[_0xd629('0x27')])]['status']===_0xd629('0x109')||this[_0xd629('0x13')][util[_0xd629('0x56')](_0xd629('0x108'),_0x17ec5a[_0xd629('0x27')])][_0xd629('0x73')]===_0xd629('0x10a'));};Preview['prototype'][_0xd629('0x84')]=function(_0x322360,_0x3ce3c4){var _0x2c36b6=this;return new BPromise(function(_0x2e141d,_0x9c7943){_0x2c36b6[_0xd629('0x10b')](_0x322360,_0x3ce3c4)[_0xd629('0x7f')](function(_0x2ce58f){_0x2e141d(_['pick'](_0x2ce58f,[_0xd629('0x4a')]));})[_0xd629('0x75')](function(_0x5311e0){if(_0x5311e0[_0xd629('0x10c')]){rpcDb[_0xd629('0x10d')](_0x322360);}if(_0x5311e0['active']){rpcDb[_0xd629('0x87')](_0x322360);}_0x9c7943(_[_0xd629('0x6f')](_0x5311e0,[_0xd629('0x4a')]));});});};Preview['prototype'][_0xd629('0x10b')]=function(_0x3b1e58,_0x2174c9){var _0x2de92b=this;return new BPromise(function(_0x35969b,_0x14162e){var _0x1eb7bf,_0x38ee1e;rpcDb[_0xd629('0x10e')](_0x3b1e58)[_0xd629('0x7f')](function(_0x29af84){if(!_[_0xd629('0x6a')](_0x29af84[0x0])){_0x38ee1e=_0x29af84[0x0][_0xd629('0x10f')]?![]:!![];_0x1eb7bf=_0x29af84[0x0]['recallme']?!![]:![];_0x1eb7bf=_0x2174c9?!![]:_0x1eb7bf;}var _0x53b44d=_0x2de92b[_0xd629('0x110')](_0x29af84);if(_0x53b44d[_0xd629('0x111')]){rpcDb[_0xd629('0x112')](_[_0xd629('0x6f')](_0x29af84[0x0],['VoiceQueueId',_0xd629('0x113')]))[_0xd629('0x7f')](function(_0x2c8d33){_0x2de92b[_0xd629('0xf8')](_0x2c8d33,_0x29af84[0x0],_0x2174c9,_0x38ee1e,_0x1eb7bf)[_0xd629('0x7f')](function(_0x1eacb7){_0x35969b(_0x1eacb7);})[_0xd629('0x75')](function(_0x30644a){_0x14162e(_0x30644a);});})['catch'](function(_0x301256){ut[_0xd629('0x5f')](_0xd629('0x114'),_0x301256);_0x14162e(ut[_0xd629('0x4a')](_0xd629('0x115'),_0x38ee1e,_0x1eb7bf));});}else{_0x14162e(ut[_0xd629('0x4a')](_0x53b44d[_0xd629('0x4a')],_0x38ee1e,_0x1eb7bf));}})[_0xd629('0x75')](function(_0xc7c81b){ut['logger'](_0xd629('0x116'),_0xc7c81b);_0x14162e(ut[_0xd629('0x4a')](_0xd629('0x115'),![],!![]));});});};Preview[_0xd629('0xc')]['validateContact']=function(_0x2ac39b){if(_[_0xd629('0x6a')](_0x2ac39b)||_[_0xd629('0xfd')](_0x2ac39b)||!_[_0xd629('0x6a')](_0x2ac39b[0x0]['Agent'])&&_[_0xd629('0x6a')](_0x2ac39b[0x0][_0xd629('0x83')]['name'])){ut[_0xd629('0x5f')](_0xd629('0x117'),_0x2ac39b);return{'isValid':![],'message':_0xd629('0x118')};}var _0x374cbc=this[_0xd629('0x11')][_0x2ac39b[0x0]['Queue']['name']];_0x374cbc[_0xd629('0x4a')]='ACTIVE';if(_['isNil'](_0x374cbc)){ut['logger'](_0xd629('0x119'),_0x374cbc);return{'isValid':![],'message':_0xd629('0x11a')};}if(!this['isTrunkReachable'](_0x374cbc[_0xd629('0x51')])){ut[_0xd629('0x5f')](_0xd629('0x11b'),_0xd629('0x11c')+_0x374cbc['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xd629('0x95')](_0x374cbc[_0xd629('0x11d')])){ut[_0xd629('0x5f')](_0xd629('0x11b'),_0x374cbc[_0xd629('0x27')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xd629('0x11e')};}}if(!ut[_0xd629('0x94')](_0x374cbc['dialActive'])){ut['logger'](_0xd629('0x11f'),_0x374cbc['name']+_0xd629('0x120'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x374cbc[_0xd629('0x27')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xd629('0x121')};};Preview[_0xd629('0xc')][_0xd629('0xfe')]=function(_0xec67dc,_0x4fe880,_0x49c235,_0x841e73){var _0x4c61b6=this;return new BPromise(function(_0x5dd6bb,_0x403e4d){var _0x366225=_0xec67dc['uniqueid'];var _0x3c3eb0=_0x4c61b6[_0xd629('0x95')](_0x4fe880[_0xd629('0x51')])?util[_0xd629('0x56')](_0xd629('0x122'),_0x4fe880[_0xd629('0x51')][_0xd629('0x27')],_[_0xd629('0x6a')](_0x4fe880[_0xd629('0x36')])?'':_0x4fe880[_0xd629('0x36')][_0xd629('0x123')]()||'',_0x4fe880['dialCutDigit']>0x0?_0x49c235[_0xd629('0xf9')]['phone'][_0xd629('0x124')](_0x4fe880[_0xd629('0x125')]):_0x49c235[_0xd629('0xf9')]['phone']):util[_0xd629('0x56')](_0xd629('0x122'),_[_0xd629('0x6a')](_0x4fe880[_0xd629('0x11d')])?_0x4fe880[_0xd629('0x51')][_0xd629('0x27')]:_0x4fe880[_0xd629('0x11d')][_0xd629('0x27')],_['isNil'](_0x4fe880[_0xd629('0x36')])?'':_0x4fe880[_0xd629('0x36')]['trim']()||'',_0x4fe880['dialCutDigit']>0x0?_0x49c235[_0xd629('0xf9')][_0xd629('0x126')][_0xd629('0x124')](_0x4fe880[_0xd629('0x125')]):_0x49c235[_0xd629('0xf9')][_0xd629('0x126')]);var _0x341729=_0x4c61b6['isTrunkReachable'](_0x4fe880[_0xd629('0x51')])?ut[_0xd629('0x127')](_0x4fe880[_0xd629('0x51')][_0xd629('0x53')],_0x4fe880[_0xd629('0x34')],_0x4fe880[_0xd629('0x128')]>0x0?ut[_0xd629('0x129')](_0x4fe880[_0xd629('0x35')],_0x4fe880[_0xd629('0x128')]):_0x4fe880[_0xd629('0x35')]):ut[_0xd629('0x127')](_[_0xd629('0x6a')](_0x4fe880[_0xd629('0x11d')])?_0x4fe880['Trunk']['callerid']:_0x4fe880[_0xd629('0x11d')]['callerid'],_0x4fe880[_0xd629('0x34')],_0x4fe880[_0xd629('0x128')]>0x0?ut[_0xd629('0x129')](_0x4fe880[_0xd629('0x35')],_0x4fe880[_0xd629('0x128')]):_0x4fe880['dialOriginateCallerIdNumber']);if(_0x341729){_0xec67dc[_0xd629('0x12a')]=ut['extractCalleridName'](_0x341729);_0xec67dc['originatecalleridnum']=ut['extractCalleridNumber'](_0x341729);}var _0x5568a8=ut['addVariables'](_0x4fe880,_0x49c235,_0x3c3eb0,_0x341729,_0x366225,_0xec67dc);_['merge'](_0xec67dc,ut['toLowerVariables'](_0x5568a8));_0xec67dc[_0xd629('0x88')]=moment()[_0xd629('0x56')](_0xd629('0x89'));ami[_0xd629('0x72')](ut['variablesAction'](_0xec67dc,_0x4fe880,_0x5568a8,_0xec67dc[_0xd629('0xa6')],_0x841e73))[_0xd629('0x7f')](function(_0x80b7dc){_0x4fe880['originated']+=0x1;logger[_0xd629('0x58')](_0xd629('0x12b'),_0x366225,_0xd629('0xf7'),_0x4fe880[_0xd629('0x27')],'originated:\x20',_0x4fe880[_0xd629('0x4b')]);_0x5dd6bb(_0x80b7dc);})[_0xd629('0x75')](function(_0x3bda72){ut[_0xd629('0xee')](_0xec67dc,0xe,_0xd629('0x12c'));rpcDb[_0xd629('0xef')](_0xec67dc,'[originateFailure][logOriginateFailure]');_0x403e4d(_0x3bda72);});});};Preview['prototype'][_0xd629('0x1d')]=function(_0x19ab27){if(this['actions'][_0x19ab27[_0xd629('0xb7')]]){this['actions'][_0x19ab27[_0xd629('0xb7')]][_0xd629('0x74')]=_0x19ab27[_0xd629('0x74')];}};Preview[_0xd629('0xc')]['syncOriginateResponse']=function(_0x48b86c){var _0x2be08d=this;var _0x1eb486=this[_0xd629('0x6c')][_0x48b86c[_0xd629('0x12d')]];if(_0x1eb486){if(_0x1eb486['lookAgent']&&this[_0xd629('0x14')][_0x1eb486[_0xd629('0xfc')]]){ut['logLookAgent'](_0x1eb486,this[_0xd629('0x14')][_0x1eb486[_0xd629('0xfc')]]['name'],this['agents'][_0x1eb486['lookAgent']]['id']);}var _0x4f1053=_[_0xd629('0x12e')](_0x1eb486);_0x4f1053[_0xd629('0xa8')]=moment()[_0xd629('0x56')](_0xd629('0x89'));var _0x3ba896=_0x2be08d[_0xd629('0x11')][_0x1eb486[_0xd629('0x6d')]];if(ut['isFailure'](_0x48b86c[_0xd629('0x12f')])){if(_0x1eb486[_0xd629('0xa5')]){rpcDb[_0xd629('0x10d')](_0x1eb486['idContact']);}if(_0x1eb486['activeContact']){rpcDb[_0xd629('0x87')](_0x1eb486['idContact']);}ami[_0xd629('0x24')]('custom:agentringnoanswer',ut[_0xd629('0x9d')](_0x1eb486,_0xd629('0x130')));this['callProgressDetectingAgent'](_0x4f1053,_0x3ba896,_0x48b86c);}else{_0x1eb486[_0xd629('0x88')]=moment()[_0xd629('0x56')](_0xd629('0x89'));ut[_0xd629('0xee')](_0x4f1053,0x4,_0xd629('0xb1'));rpcDb[_0xd629('0xef')](_0x4f1053,_0xd629('0x131'));}}};Preview[_0xd629('0xc')][_0xd629('0x18')]=function(_0x16db66){var _0x508ef8=this;var _0x1adcc4=this[_0xd629('0x6c')][_0x16db66['linkedid']];var _0xa86056;if(_0x1adcc4){_0xa86056=this[_0xd629('0x11')][_0x1adcc4['queue']];logger['info']('[syncHangup][talking]',_0x16db66[_0xd629('0xb7')],_0xd629('0xf7'),_0xa86056['name'],_0xd629('0xb6'),_0xa86056['pTalking']);}if(this[_0xd629('0x6c')][_0x16db66[_0xd629('0xb7')]]&&_0x16db66['linkedid']!==_0x16db66[_0xd629('0xab')]){if(_0x16db66['cause']==='16'&&this[_0xd629('0x6c')][_0x16db66[_0xd629('0xb7')]][_0xd629('0x6e')]){this[_0xd629('0x98')](_0x16db66,_0x16db66[_0xd629('0xb7')],_0x16db66[_0xd629('0x132')]);}else if(this['actions'][_0x16db66[_0xd629('0xb7')]][_0xd629('0x6e')]){logger['info']('[syncHangup][talking][cause]',_0x16db66['linkedid'],_0x16db66[_0xd629('0x132')],_0xd629('0xf7'),_0xa86056[_0xd629('0x27')],_0xd629('0xb6'),_0xa86056[_0xd629('0x5b')]);this[_0xd629('0x98')](_0x16db66,_0x16db66[_0xd629('0xb7')],_0x16db66['cause']);}}else if(_0x1adcc4&&_['isNil'](_0x1adcc4[_0xd629('0x133')])&&_0xa86056[_0xd629('0x134')]&&_0x16db66[_0xd629('0xb7')]===_0x16db66[_0xd629('0xab')]&&_[_0xd629('0x6a')](_0x16db66[_0xd629('0xed')])&&_0x16db66[_0xd629('0x132')]==='16'&&_0x16db66[_0xd629('0x135')]==='6'&&_[_0xd629('0xeb')](_0x1adcc4[_0xd629('0x136')])){if(_0x1adcc4[_0xd629('0xa5')]){rpcDb[_0xd629('0x10d')](_0x1adcc4['idContact']);}if(_0x1adcc4[_0xd629('0xa6')]){rpcDb[_0xd629('0x87')](_0x1adcc4['idContact']);}_0x16db66[_0xd629('0xed')]='22';this['callProgressDetectingAgent'](_0x1adcc4,_0xa86056,_0x16db66);}else if(_0x1adcc4&&_0x1adcc4[_0xd629('0x136')]){if(_0x16db66[_0xd629('0x132')]==='16'&&this[_0xd629('0x6c')][_0x16db66[_0xd629('0xb7')]][_0xd629('0x6e')]){logger[_0xd629('0x58')](_0xd629('0x137'),_0x16db66[_0xd629('0xb7')],_0x16db66[_0xd629('0x132')],'\x20Queue',_0xa86056[_0xd629('0x27')],_0xd629('0xb6'),_0xa86056[_0xd629('0x5b')]);this['callProgressDetectingCustomer'](_0x16db66,_0x16db66['linkedid'],_0x16db66[_0xd629('0x132')]);}else if(this[_0xd629('0x6c')][_0x16db66[_0xd629('0xb7')]][_0xd629('0x6e')]){logger[_0xd629('0x58')](_0xd629('0x138'),_0x16db66[_0xd629('0xb7')],_0x16db66[_0xd629('0x132')],'\x20Queue',_0xa86056[_0xd629('0x27')],_0xd629('0xb6'),_0xa86056[_0xd629('0x5b')]);this['callProgressDetectingCustomer'](_0x16db66,_0x16db66[_0xd629('0xb7')],_0x16db66[_0xd629('0x132')]);}}};Preview[_0xd629('0xc')]['syncDialEnd']=function(_0x4149ab){if(this[_0xd629('0x6c')][_0x4149ab[_0xd629('0xea')]]&&_0x4149ab[_0xd629('0xea')]!==_0x4149ab[_0xd629('0x139')]){this[_0xd629('0x98')](_0x4149ab,_0x4149ab[_0xd629('0xea')],_0x4149ab[_0xd629('0xe5')]);}};Preview['prototype'][_0xd629('0x1b')]=function(_0x38f073){if(this[_0xd629('0x6c')][_0x38f073[_0xd629('0xb7')]]&&_0x38f073[_0xd629('0xb7')]!==_0x38f073[_0xd629('0xab')]&&!this[_0xd629('0x6c')][_0x38f073[_0xd629('0xb7')]][_0xd629('0x6e')]){if(_0x38f073['cause']==='1'){this['callProgressDetectingCustomer'](_0x38f073,_0x38f073[_0xd629('0xb7')],_0x38f073[_0xd629('0x132')]);}}};Preview[_0xd629('0xc')]['addVariable']=function(_0x10bf41,_0x3b0ca4,_0xfc2267){if(this[_0xd629('0x6c')][_0x10bf41]){if(_[_0xd629('0x6a')](this['actions'][_0x10bf41][_0xd629('0x13a')])){this[_0xd629('0x6c')][_0x10bf41][_0xd629('0x13a')]={};}this['actions'][_0x10bf41]['variables'][_0x3b0ca4]=_0xfc2267;}};Preview['prototype']['syncVarSet']=function(_0x1af329){try{if(!_[_0xd629('0x6a')](_0x1af329)){if(ut['filterKey'](_['keys'](_0x1af329[_0xd629('0x13b')])[0x0])){this[_0xd629('0x13c')](_0x1af329['uniqueid'],_[_0xd629('0x13d')](_0x1af329[_0xd629('0x13b')])[0x0],_0x1af329[_0xd629('0x13e')]);}}}catch(_0x53f1f4){logger[_0xd629('0x13f')]('[syncVarSet][Preview]',util['inspect'](_0x53f1f4,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x1d878a){if(_0x1d878a){if(this[_0xd629('0x6c')][_0x1d878a[_0xd629('0x140')]]){this[_0xd629('0x6c')][_0x1d878a['transfertargetlinkedid']]['transfer']=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x105a96){if(_0x105a96){if(this[_0xd629('0x6c')][_0x105a96['transfererlinkedid']]){this[_0xd629('0x6c')][_0x105a96[_0xd629('0x141')]]['transfer']=!![];}}};module[_0xd629('0x142')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 539e62f..c204291 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 _0x9c5a=['xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','resolve','then','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','active','rescheduleContact','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten'];(function(_0x48d1d1,_0x406a17){var _0x50e3bd=function(_0x17ef92){while(--_0x17ef92){_0x48d1d1['push'](_0x48d1d1['shift']());}};_0x50e3bd(++_0x406a17);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x977509,_0x5a16a2){_0x977509=_0x977509-0x0;var _0x3c29e6=_0x9c5a[_0x977509];return _0x3c29e6;};'use strict';var util=require(_0xa9c5('0x0'));var BPromise=require(_0xa9c5('0x1'));var logger=require('../../../config/logger')(_0xa9c5('0x2'));var _=require(_0xa9c5('0x3'));var cmHopper=require(_0xa9c5('0x4'));var cmHopperFinal=require(_0xa9c5('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xa9c5('0x6'));var voiceQueueRt=require(_0xa9c5('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xa9c5('0x8'));function loggerCatch(_0x4d9c7a){return function(_0x394d84){logger[_0xa9c5('0x9')](_0x4d9c7a,util['inspect'](_0x394d84,{'showHidden':![],'depth':null}));};}function create(_0x4b6db6){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopperHistory['createHistory'](_0x4b6db6))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0xd')));}function createAgent(_0x51c14c){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](agentReportPreview['createHistory'](_0x51c14c))['catch'](loggerCatch(_0xa9c5('0xd')));}function moveContact(_0x11421c){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper[_0xa9c5('0xe')](_0x11421c,!![]))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0xf')));}exports[_0xa9c5('0x10')]=function(_0x3c5ac7){return BPromise[_0xa9c5('0xa')]()['then'](cmHopperBlack[_0xa9c5('0x10')](_0x3c5ac7))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x11')));};exports[_0xa9c5('0x12')]=function(_0x418ca5){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper[_0xa9c5('0x12')](_0x418ca5))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x13')));};exports['createHistory']=function(_0x2b0d73,_0xd85c32){create(_0x2b0d73)[_0xa9c5('0xc')](loggerCatch(_0xd85c32));moveContact(_0x2b0d73)['catch'](loggerCatch(_0xd85c32));};exports[_0xa9c5('0x14')]=function(_0x1142d9,_0x2b9ac5){createAgent(_0x1142d9)[_0xa9c5('0xc')](loggerCatch(_0x2b9ac5));};exports[_0xa9c5('0x15')]=function(_0x349f27,_0x3b8d4d){create(_0x349f27)[_0xa9c5('0xc')](loggerCatch(_0x3b8d4d));};exports[_0xa9c5('0x16')]=function(_0x36c486,_0x113c8f){moveContact(_0x36c486)[_0xa9c5('0xc')](loggerCatch(_0x113c8f));};exports['rescheduleContact']=function(_0x1115ad,_0x21ab50,_0x541c77){if(_0x21ab50){_0x1115ad['UserId']=null;}if(_0x541c77){_0x1115ad[_0xa9c5('0x17')]=![];}return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper[_0xa9c5('0x18')](_0x1115ad))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x19')));};exports['countReScheduled']=function(_0x4fa280){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper['countReScheduled'](_0x4fa280))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x1a')));};exports[_0xa9c5('0x1b')]=function(_0x32fc7d){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper[_0xa9c5('0x1b')]({'UserId':null},_0x32fc7d,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0xa9c5('0x1c')]=function(_0x4cd5e6){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper['unlockContact']({'active':![]},_0x4cd5e6,0x1))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x1d')));};exports['crateCustomerReportQueue']=function(_0x413edf){var _0x32baf9={};_0x32baf9[_0xa9c5('0x1e')]=_0x413edf[_0xa9c5('0x1e')];_0x32baf9[_0xa9c5('0x1f')]=_0x413edf['uniqueid'];_0x32baf9[_0xa9c5('0x20')]=_0x413edf['calleridnum'];_0x32baf9[_0xa9c5('0x21')]=_0x413edf[_0xa9c5('0x21')];_0x32baf9[_0xa9c5('0x22')]=_0x413edf['queue'];_0x32baf9[_0xa9c5('0x23')]=_0x413edf[_0xa9c5('0x24')];_0x32baf9['queuecallerleaveAt']=_0x413edf[_0xa9c5('0x24')];_0x32baf9[_0xa9c5('0x25')]=0x1;_0x32baf9[_0xa9c5('0x26')]=_0x413edf[_0xa9c5('0x27')];_0x32baf9[_0xa9c5('0x28')]=_0x413edf[_0xa9c5('0x29')];_0x32baf9[_0xa9c5('0x2a')]='from-sip';_0x32baf9[_0xa9c5('0x2b')]=_0xa9c5('0x2c');_0x32baf9[_0xa9c5('0x2d')]=0x0;_0x32baf9[_0xa9c5('0x2e')]=0x1;_0x32baf9[_0xa9c5('0x2f')]=_0x413edf[_0xa9c5('0x29')];_0x32baf9[_0xa9c5('0x30')]=_0xa9c5('0x31');return BPromise['resolve']()['then'](voiceQueueReport[_0xa9c5('0x32')](_0x32baf9))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x33')));};exports[_0xa9c5('0x34')]=function(_0x296116,_0x25121e){return BPromise['resolve']()['then'](cmHopper['getContactRecallMe'](_0x296116,_0x25121e))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x35')));};exports['rescheduleContactInQueue']=function(_0x13a1f5){return BPromise['resolve']()[_0xa9c5('0xb')](cmHopper[_0xa9c5('0x18')](_0x13a1f5,!![],!![]))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x36')));}; \ No newline at end of file +var _0x207c=['checkIsBlackList','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','error','inspect','resolve','then','createHistory','[createHistory]\x20','catch','[moveContactManagedDialer]\x20'];(function(_0x2d390b,_0x262592){var _0x1277e9=function(_0x1e1b71){while(--_0x1e1b71){_0x2d390b['push'](_0x2d390b['shift']());}};_0x1277e9(++_0x262592);}(_0x207c,0x1e8));var _0xc207=function(_0x58b301,_0x45e991){_0x58b301=_0x58b301-0x0;var _0x2171b3=_0x207c[_0x58b301];return _0x2171b3;};'use strict';var util=require('util');var BPromise=require(_0xc207('0x0'));var logger=require(_0xc207('0x1'))(_0xc207('0x2'));var _=require(_0xc207('0x3'));var cmHopper=require(_0xc207('0x4'));var cmHopperFinal=require(_0xc207('0x5'));var cmHopperHistory=require(_0xc207('0x6'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xc207('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x55023e){return function(_0xc88789){logger[_0xc207('0x8')](_0x55023e,util[_0xc207('0x9')](_0xc88789,{'showHidden':![],'depth':null}));};}function create(_0x59ff6f){return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](cmHopperHistory[_0xc207('0xc')](_0x59ff6f))['catch'](loggerCatch(_0xc207('0xd')));}function createAgent(_0x817576){return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](agentReportPreview[_0xc207('0xc')](_0x817576))[_0xc207('0xe')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x574425){return BPromise['resolve']()[_0xc207('0xb')](cmHopper['moveContactManagedDialer'](_0x574425,!![]))[_0xc207('0xe')](loggerCatch(_0xc207('0xf')));}exports['checkIsBlackList']=function(_0x3e1108){return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](cmHopperBlack[_0xc207('0x10')](_0x3e1108))[_0xc207('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xc207('0x11')]=function(_0x3c77b7){return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](cmHopper['getContactPreview'](_0x3c77b7))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0xc207('0xc')]=function(_0x6e793d,_0x3d9c7b){create(_0x6e793d)[_0xc207('0xe')](loggerCatch(_0x3d9c7b));moveContact(_0x6e793d)['catch'](loggerCatch(_0x3d9c7b));};exports[_0xc207('0x12')]=function(_0x282595,_0x217d5e){createAgent(_0x282595)['catch'](loggerCatch(_0x217d5e));};exports[_0xc207('0x13')]=function(_0x488cc0,_0x42c8ba){create(_0x488cc0)[_0xc207('0xe')](loggerCatch(_0x42c8ba));};exports[_0xc207('0x14')]=function(_0x461f6a,_0xce0770){moveContact(_0x461f6a)[_0xc207('0xe')](loggerCatch(_0xce0770));};exports[_0xc207('0x15')]=function(_0x464dea,_0x212005,_0x2bd2eb){if(_0x212005){_0x464dea[_0xc207('0x16')]=null;}if(_0x2bd2eb){_0x464dea[_0xc207('0x17')]=![];}return BPromise[_0xc207('0xa')]()['then'](cmHopper[_0xc207('0x15')](_0x464dea))['catch'](loggerCatch(_0xc207('0x18')));};exports[_0xc207('0x19')]=function(_0x1eabe8){return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](cmHopper[_0xc207('0x19')](_0x1eabe8))[_0xc207('0xe')](loggerCatch(_0xc207('0x1a')));};exports[_0xc207('0x1b')]=function(_0x2385f7){return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](cmHopper[_0xc207('0x1b')]({'UserId':null},_0x2385f7,0x1))[_0xc207('0xe')](loggerCatch(_0xc207('0x1c')));};exports['disableContact']=function(_0x1e1440){return BPromise['resolve']()['then'](cmHopper[_0xc207('0x1b')]({'active':![]},_0x1e1440,0x1))[_0xc207('0xe')](loggerCatch(_0xc207('0x1d')));};exports[_0xc207('0x1e')]=function(_0x6a653d){var _0x478af7={};_0x478af7[_0xc207('0x1f')]=_0x6a653d[_0xc207('0x1f')];_0x478af7[_0xc207('0x20')]=_0x6a653d[_0xc207('0x20')];_0x478af7[_0xc207('0x21')]=_0x6a653d[_0xc207('0x21')];_0x478af7[_0xc207('0x22')]=_0x6a653d[_0xc207('0x22')];_0x478af7[_0xc207('0x23')]=_0x6a653d[_0xc207('0x23')];_0x478af7[_0xc207('0x24')]=_0x6a653d[_0xc207('0x25')];_0x478af7[_0xc207('0x26')]=_0x6a653d['answertime'];_0x478af7[_0xc207('0x27')]=0x1;_0x478af7[_0xc207('0x28')]=_0x6a653d[_0xc207('0x29')];_0x478af7[_0xc207('0x2a')]=_0x6a653d[_0xc207('0x2b')];_0x478af7[_0xc207('0x2c')]='from-sip';_0x478af7[_0xc207('0x2d')]=_0xc207('0x2e');_0x478af7[_0xc207('0x2f')]=0x0;_0x478af7[_0xc207('0x30')]=0x1;_0x478af7['lastAssignedTo']=_0x6a653d[_0xc207('0x2b')];_0x478af7[_0xc207('0x31')]=_0xc207('0x32');return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](voiceQueueReport[_0xc207('0x33')](_0x478af7))[_0xc207('0xe')](loggerCatch(_0xc207('0x34')));};exports[_0xc207('0x35')]=function(_0x557d5d,_0x48d8a4){return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](cmHopper[_0xc207('0x35')](_0x557d5d,_0x48d8a4))[_0xc207('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xc207('0x36')]=function(_0x433c0f){return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](cmHopper[_0xc207('0x15')](_0x433c0f,!![],!![]))['catch'](loggerCatch(_0xc207('0x37')));}; \ 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 a93580c..65b2b97 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 _0x4ccb=['moment','preview','env','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','loggerError','logger2','string','isEmpty','isUndefined','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialOriginateTimeout','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','isNil','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','logAgent','ringtime','logLookAgent','membername','logCustomer','endtime','starttime','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','clone','Global','scheduledAt','active','add','minutes','ListId','VoiceQueueId','pTalking','buildObj','lastevent','queue','interface','agentReadyId','status','reachable','push','getDiff','diff','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','scheduledat','countglobal','callbackuniqueid','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','match','extractCalleridNumber','util','lodash'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0x4ccb,0x196));var _0xb4cc=function(_0xd333c2,_0x20370e){_0xd333c2=_0xd333c2-0x0;var _0x4475c0=_0x4ccb[_0xd333c2];return _0x4475c0;};'use strict';var util=require(_0xb4cc('0x0'));var _=require(_0xb4cc('0x1'));var moment=require(_0xb4cc('0x2'));var logger=require('../../../../config/logger')(_0xb4cc('0x3'));var ipAgi=process[_0xb4cc('0x4')]['XCALLY_IP_AGI']||_0xb4cc('0x5');function getSeconds(_0x2ae5e6,_0x23c968){var _0x4cad3f=moment(_0x2ae5e6)[_0xb4cc('0x6')](0x0);var _0x2181b2=moment(_0x23c968)[_0xb4cc('0x6')](0x0);return _0x4cad3f['diff'](_0x2181b2,_0xb4cc('0x7'));}exports[_0xb4cc('0x8')]=function(_0x2129ef){return function(_0x5327a4){logger[_0xb4cc('0x9')](_0x2129ef,util[_0xb4cc('0xa')](_0x5327a4,{'showHidden':![],'depth':null}));};};exports[_0xb4cc('0xb')]=function(_0x11139d,_0x14014d){logger['info'](_0x11139d,util[_0xb4cc('0xa')](_0x14014d,{'showHidden':![],'depth':null}));};exports[_0xb4cc('0xc')]=function(_0x4f9b61,_0x1e9480){logger['error'](_0x4f9b61,util[_0xb4cc('0xa')](_0x1e9480,{'showHidden':![],'depth':null}));};exports[_0xb4cc('0xd')]=function(_0x277c2a){return function(_0x58ed7d){logger['info'](_0x277c2a,util[_0xb4cc('0xa')](_0x58ed7d,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x5cf92a,_0x1b10ae,_0x58b1c2){return{'message':_0x5cf92a,'unlock':_0x1b10ae,'active':_0x58b1c2};};exports['getCallerId']=function(_0xcfdeb9,_0x2b8b91,_0x1bd491){if(!_['isUndefined'](_0x1bd491)&&_0xb4cc('0xe')===typeof _0x1bd491&&!_[_0xb4cc('0xf')](_0x1bd491)){if(!_[_0xb4cc('0x10')](_0x2b8b91)&&_0xb4cc('0xe')===typeof _0x2b8b91&&!_[_0xb4cc('0xf')](_0x2b8b91)){return util['format'](_0xb4cc('0x11'),_0x2b8b91,_0x1bd491);}return util[_0xb4cc('0x12')](_0xb4cc('0x11'),_0x1bd491,_0x1bd491);}if(!_['isUndefined'](_0xcfdeb9)&&_0xb4cc('0xe')===typeof _0xcfdeb9&&!_[_0xb4cc('0xf')](_0xcfdeb9)){return _0xcfdeb9;}return _0xb4cc('0x13');};exports[_0xb4cc('0x14')]=function(_0xa99916){if(_['isNil'](_0xa99916)){return![];}return _0xa99916;};exports[_0xb4cc('0x15')]=function(_0x20b08f,_0x300a99,_0x38fffd,_0x3a957b,_0x554418,_0x100c6a){var _0x1bed69={'XMD-QUEUE':_0x300a99[_0xb4cc('0x16')]?_0x300a99[_0xb4cc('0x16')][_0xb4cc('0x17')]:'','XMD-CALLERID':_0x3a957b,'XMD-CALLERID-PREVIEW':_0x100c6a?util['format'](_0xb4cc('0x11'),_0x100c6a[_0xb4cc('0x18')],_0x100c6a[_0xb4cc('0x19')]):_0x3a957b,'XMD-DIALID':_0x554418,'XMD-CONTACTID':_0x300a99[_0xb4cc('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3a957b,'XMD-VOICEQUEUEID':_0x300a99['VoiceQueueId'],'XMD-DIALCHANNEL':_0x38fffd,'XMD-DIALTIMEOUT':_0x20b08f[_0xb4cc('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0xb4cc('0x12')]('\x22rtTxX%s%s\x22',_0x20b08f['dialQueueProject2']?'g':'',_[_0xb4cc('0xf')](_0x20b08f[_0xb4cc('0x1c')])?'':_0xb4cc('0x1d')),'XMD-DIALURL':_0x20b08f[_0xb4cc('0x1e')]||'','XMD-AGI':_0x20b08f['dialQueueProject']?util['format'](_0xb4cc('0x1f'),ipAgi,_0x20b08f['dialQueueProject']):_0xb4cc('0x20'),'XMD-AGIAFTER':_0x20b08f[_0xb4cc('0x21')]?util[_0xb4cc('0x12')](_0xb4cc('0x1f'),ipAgi,_0x20b08f[_0xb4cc('0x21')]):_0xb4cc('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x100c6a?_0x100c6a[_0xb4cc('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x100c6a?_0x100c6a[_0xb4cc('0x23')]:'','XMD-DESTINATION':_0xb4cc('0x24')};if(!_['isEmpty'](_0x20b08f[_0xb4cc('0x1c')])){_0x1bed69[util[_0xb4cc('0x12')]('%s',_0xb4cc('0x25'))]=_0x20b08f[_0xb4cc('0x1c')];_0x1bed69[util[_0xb4cc('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x554418;}if(_0x300a99&&_0x300a99[_0xb4cc('0x26')]){for(var _0x2957ee in _0x300a99[_0xb4cc('0x26')]){if(_0x300a99[_0xb4cc('0x26')]['hasOwnProperty'](_0x2957ee)){if(!_[_0xb4cc('0x27')](_0x300a99[_0xb4cc('0x26')][_0x2957ee])&&_0x2957ee!=='id'&&_0x2957ee!=='tags'&&_0x2957ee!==_0xb4cc('0x28')&&_0x2957ee!==_0xb4cc('0x29')){_0x1bed69[util['format'](_0xb4cc('0x2a'),_0xb4cc('0x2b'),_[_0xb4cc('0x2c')](_0x2957ee))]=_0x300a99[_0xb4cc('0x26')][_0x2957ee];}}}}return _0x1bed69;};exports[_0xb4cc('0x2d')]=function(_0x2e4246){var _0x255b0e={};for(var _0x3a48ca in _0x2e4246){if(_0x2e4246[_0xb4cc('0x2e')](_0x3a48ca)){_0x255b0e[util['format']('%s',_['toLower'](_0x3a48ca))]=_0x2e4246[_0x3a48ca];}}return{'variables':_0x255b0e};};exports[_0xb4cc('0x2f')]=function(_0x8dafaf,_0x3fe057){if(!_[_0xb4cc('0x27')](_0x8dafaf)){if(_0x8dafaf[_0xb4cc('0x2e')]('originated')){if(_0x8dafaf[_0xb4cc('0x30')]>0x0){_0x8dafaf[_0xb4cc('0x30')]-=0x1;}else{logger[_0xb4cc('0x9')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x3fe057);}}}else{logger[_0xb4cc('0x9')](_0xb4cc('0x31'),_0x3fe057);}};exports[_0xb4cc('0x32')]=function(_0x519b22){var _0x27e4fb=moment()['format'](_0xb4cc('0x33'));_0x519b22[_0xb4cc('0x34')]=0xd;_0x519b22[_0xb4cc('0x35')]=_0xb4cc('0x36');_0x519b22['starttime']=_0x27e4fb;_0x519b22[_0xb4cc('0x37')]=_0x27e4fb;_0x519b22['endtime']=_0x27e4fb;};exports[_0xb4cc('0x38')]=function(_0x44b56d,_0x4490ea,_0x4245cd){var _0x1ce892=moment()[_0xb4cc('0x12')](_0xb4cc('0x33'));_0x44b56d['state']=_0x4490ea;_0x44b56d[_0xb4cc('0x35')]=_0x4245cd;_0x44b56d[_0xb4cc('0x37')]=_0x1ce892;_0x44b56d[_0xb4cc('0x39')]=getSeconds(_0x44b56d['responsetime'],_0x44b56d['starttime']);};exports[_0xb4cc('0x3a')]=function(_0xc257a,_0x2d3653,_0x43d334){_0xc257a[_0xb4cc('0x3b')]=_0x2d3653;_0xc257a['UserId']=_0x43d334;};exports[_0xb4cc('0x3c')]=function(_0x5d55fe,_0x4b2010,_0x3e428a){var _0x18095b=moment()[_0xb4cc('0x12')](_0xb4cc('0x33'));_0x5d55fe[_0xb4cc('0x34')]=_0x4b2010;_0x5d55fe['statedesc']=_0x3e428a;_0x5d55fe[_0xb4cc('0x37')]=_0x5d55fe['responsetime']?_0x5d55fe[_0xb4cc('0x37')]:_0x18095b;_0x5d55fe[_0xb4cc('0x3d')]=_0x5d55fe[_0xb4cc('0x3d')]?_0x5d55fe[_0xb4cc('0x3d')]:_0x18095b;_0x5d55fe[_0xb4cc('0x39')]=getSeconds(_0x5d55fe[_0xb4cc('0x37')]||0x0,_0x5d55fe[_0xb4cc('0x3e')]||0x0);_0x5d55fe[_0xb4cc('0x3f')]=_0x5d55fe[_0xb4cc('0x40')]?getSeconds(_0x5d55fe[_0xb4cc('0x3d')],_0x5d55fe[_0xb4cc('0x40')]):0x0;};exports['isFailure']=function(_0x29f2da){return _0x29f2da===_0xb4cc('0x41');};exports[_0xb4cc('0x42')]=function(_0x3edf47,_0x5d7539,_0x5be726,_0x2fe47b,_0x2834b6){var _0x4c3de5=_0x2fe47b?_0xb4cc('0x43'):_0x3edf47[_0xb4cc('0x18')];_0x4c3de5=_0x2834b6?_0xb4cc('0x44'):_0x4c3de5;return{'actionid':_0x3edf47[_0xb4cc('0x45')],'action':'originate','channel':_0x3edf47[_0xb4cc('0x46')],'callerid':util[_0xb4cc('0x12')](_0xb4cc('0x11'),_0x4c3de5,_0x3edf47['calleridnum']),'Exten':_0xb4cc('0x24'),'Context':_0xb4cc('0x47'),'Priority':'1','variable':_0x5be726,'timeout':(_0x5d7539[_0xb4cc('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3edf47[_0xb4cc('0x45')]};};exports[_0xb4cc('0x49')]=function(_0x439aa6){return _0x439aa6[_0xb4cc('0x4a')]+_0x439aa6[_0xb4cc('0x4b')]+_0x439aa6[_0xb4cc('0x4c')]+_0x439aa6['countagentrejectretry']+_0x439aa6[_0xb4cc('0x4d')];};exports['cloneAction']=function(_0x2b159b){var _0x31a76a=_[_0xb4cc('0x4e')](_0x2b159b);_0x31a76a['state']=0xf;_0x31a76a[_0xb4cc('0x35')]=_0xb4cc('0x4f');return _0x31a76a;};exports[_0xb4cc('0x50')]=function(_0x422db1,_0x28d91f,_0x3e9013){var _0x22fc9a={};_0x22fc9a[_0x28d91f]=_0x422db1[_0x28d91f];_0x22fc9a[_0xb4cc('0x51')]=![];_0x22fc9a['scheduledat']=moment()[_0xb4cc('0x52')](_0x3e9013,_0xb4cc('0x53'))[_0xb4cc('0x12')](_0xb4cc('0x33'));_0x22fc9a[_0xb4cc('0x1a')]=_0x422db1[_0xb4cc('0x1a')];_0x22fc9a[_0xb4cc('0x54')]=_0x422db1['ListId'];_0x22fc9a[_0xb4cc('0x55')]=_0x422db1[_0xb4cc('0x55')]||undefined;return _0x22fc9a;};exports['decrementTalkink']=function(_0x108dfd,_0x1fef55){if(!_[_0xb4cc('0x27')](_0x108dfd)){if(_0x108dfd[_0xb4cc('0x56')]>0x0){_0x108dfd['pTalking']-=0x1;}else{logger[_0xb4cc('0x9')](_0x1fef55,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xb4cc('0x9')](_0x1fef55,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x42a947){if(_0x42a947<=0x0){return!![];}return![];};exports[_0xb4cc('0x57')]=function(_0xe7268d,_0x5811b1){_0xe7268d[_0xb4cc('0x58')]=_0x5811b1;_0xe7268d[_0xb4cc('0x17')]=_0xe7268d[_0xb4cc('0x59')];_0xe7268d[_0xb4cc('0x5a')]=_0xe7268d[_0xb4cc('0x46')];return _0xe7268d;};exports['buildAcw']=function(_0x45bd2c){var _0x17d765={};_0x17d765['queue']=_0x45bd2c[_0xb4cc('0x59')];_0x17d765[_0xb4cc('0x5a')]=_0x45bd2c[_0xb4cc('0x46')];_0x17d765['uniqueid']=_0x45bd2c[_0xb4cc('0x45')];return _0x17d765;};exports[_0xb4cc('0x5b')]=function(_0x4ccbd7){var _0x5c5a3e=[];for(var _0x6c1e81 in _0x4ccbd7){if(_0x4ccbd7['hasOwnProperty'](_0x6c1e81)){if(!_[_0xb4cc('0x27')](_0x4ccbd7[_0x6c1e81])&&_0x4ccbd7[_0x6c1e81][_0xb4cc('0x34')]==='not_inuse'&&_0x4ccbd7[_0x6c1e81][_0xb4cc('0x5c')]===_0xb4cc('0x5d')){_0x5c5a3e[_0xb4cc('0x5e')](_0x4ccbd7[_0x6c1e81]['id']);}}}return _0x5c5a3e;};exports[_0xb4cc('0x5f')]=function(_0xb69112){var _0x4fcb76=moment()[_0xb4cc('0x6')](0x0);var _0x4e4ba5=moment(_0xb69112)[_0xb4cc('0x6')](0x0);return _0x4fcb76[_0xb4cc('0x60')](_0x4e4ba5,_0xb4cc('0x7'));};exports['createBody']=function(_0x11e230){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x11e230[_0xb4cc('0x1a')],'ListId':_0x11e230[_0xb4cc('0x54')],'VoiceQueueId':_0x11e230['VoiceQueueId']||undefined,'CampaignId':_0x11e230[_0xb4cc('0x61')]||undefined};};exports[_0xb4cc('0x62')]=function(_0x290b4f){if(_0x290b4f==='uniqueid'||_0x290b4f===_0xb4cc('0x63')||_0x290b4f===_0xb4cc('0x59')||_0x290b4f===_0xb4cc('0x64')||_0x290b4f===_0xb4cc('0x65')||_0x290b4f===_0xb4cc('0x66')||_0x290b4f==='membername'||_0x290b4f===_0xb4cc('0x46')||_0x290b4f===_0xb4cc('0x18')||_0x290b4f===_0xb4cc('0x51')||_0x290b4f===_0xb4cc('0x19')||_0x290b4f===_0xb4cc('0x67')||_0x290b4f===_0xb4cc('0x4a')||_0x290b4f===_0xb4cc('0x4b')||_0x290b4f===_0xb4cc('0x4c')||_0x290b4f===_0xb4cc('0x68')||_0x290b4f==='callback'||_0x290b4f===_0xb4cc('0x69')||_0x290b4f==='callbackat'||_0x290b4f===_0xb4cc('0x6a')||_0x290b4f===_0xb4cc('0x1a')||_0x290b4f==='ListId'||_0x290b4f===_0xb4cc('0x6b')||_0x290b4f==='VoiceQueueId'||_0x290b4f===_0xb4cc('0x6c')||_0x290b4f===_0xb4cc('0x6d')||_0x290b4f==='xmd-queue'||_0x290b4f===_0xb4cc('0x6e')||_0x290b4f===_0xb4cc('0x6f')||_0x290b4f===_0xb4cc('0x70')||_0x290b4f===_0xb4cc('0x71')||_0x290b4f===_0xb4cc('0x72')||_0x290b4f==='xmd-dialid'||_0x290b4f===_0xb4cc('0x73')||_0x290b4f==='xmd-contactid'||_0x290b4f===_0xb4cc('0x74')||_0x290b4f===_0xb4cc('0x75')||_0x290b4f===_0xb4cc('0x76')||_0x290b4f===_0xb4cc('0x77')||_0x290b4f===_0xb4cc('0x78')||_0x290b4f===_0xb4cc('0x79')||_0x290b4f===_0xb4cc('0x7a')||_0x290b4f===_0xb4cc('0x7b')||_0x290b4f===_0xb4cc('0x7c')||_0x290b4f===_0xb4cc('0x7d')||_0x290b4f==='rtpaudioqosrtt'||_0x290b4f==='rtpaudioqosrttbridged'||_0x290b4f===_0xb4cc('0x78')||_0x290b4f===_0xb4cc('0x79')||_0x290b4f===_0xb4cc('0x7a')||_0x290b4f==='rtpaudioqosjitterbridged'||_0x290b4f===_0xb4cc('0x7c')||_0x290b4f===_0xb4cc('0x7d')||_0x290b4f===_0xb4cc('0x7e')||_0x290b4f===_0xb4cc('0x7f')||_0x290b4f===_0xb4cc('0x80')||_0x290b4f===_0xb4cc('0x81')||_0x290b4f===_0xb4cc('0x34')||_0x290b4f===_0xb4cc('0x35')){return![];}return!![];};exports[_0xb4cc('0x82')]=function(_0x567d8c,_0xd789eb){var _0x5c1d89,_0xd335f,_0x2360d4;if(_0xd789eb<=0x0){_0xd789eb=0x1;}_0x5c1d89=new RegExp('\x5cw{0,'+_0xd789eb+'}$');_0xd335f=Math[_0xb4cc('0x83')](0xa,_0xd789eb-0x1);_0x2360d4=Math[_0xb4cc('0x83')](0xa,_0xd789eb)-0x1;return util['format']('%s',_[_0xb4cc('0x84')](_0x567d8c,_0x5c1d89,_[_0xb4cc('0x85')](_0xd335f,_0x2360d4)));};exports['extractCalleridName']=function(_0x73f135){var _0x1d67c6=_0x73f135[_0xb4cc('0x86')](/"(.*?)"/);return _0x1d67c6?_0x1d67c6[0x1]:_0x73f135;};exports[_0xb4cc('0x87')]=function(_0xc7874){var _0x36339f=_0xc7874[_0xb4cc('0x86')](/<(.*?)>/);return _0x36339f?_0x36339f[0x1]:_0xc7874;}; \ No newline at end of file +var _0x1c52=['message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','monitor_format','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','statedesc','talktime','answertime','isFailure','Failure','RECALL','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','buildAcw','queue','interface','agentReadyId','not_inuse','status','reachable','push','CampaignId','filterKey','idContact','type','dialAnswer','scheduledat','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','info','logger2'];(function(_0x596828,_0x4a0d72){var _0x24f8e4=function(_0x1a9913){while(--_0x1a9913){_0x596828['push'](_0x596828['shift']());}};_0x24f8e4(++_0x4a0d72);}(_0x1c52,0x7c));var _0x21c5=function(_0x3afb59,_0x1bf23e){_0x3afb59=_0x3afb59-0x0;var _0x581188=_0x1c52[_0x3afb59];return _0x581188;};'use strict';var util=require(_0x21c5('0x0'));var _=require(_0x21c5('0x1'));var moment=require(_0x21c5('0x2'));var logger=require(_0x21c5('0x3'))('preview');var ipAgi=process['env']['XCALLY_IP_AGI']||_0x21c5('0x4');function getSeconds(_0x67781f,_0x5374cd){var _0x13c1a9=moment(_0x67781f)[_0x21c5('0x5')](0x0);var _0x2a74b7=moment(_0x5374cd)[_0x21c5('0x5')](0x0);return _0x13c1a9['diff'](_0x2a74b7,_0x21c5('0x6'));}exports[_0x21c5('0x7')]=function(_0x4c5a4f){return function(_0xd34da2){logger[_0x21c5('0x8')](_0x4c5a4f,util[_0x21c5('0x9')](_0xd34da2,{'showHidden':![],'depth':null}));};};exports[_0x21c5('0xa')]=function(_0x54a640,_0x38a038){logger[_0x21c5('0xb')](_0x54a640,util[_0x21c5('0x9')](_0x38a038,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x378ec7,_0x48ed61){logger[_0x21c5('0x8')](_0x378ec7,util[_0x21c5('0x9')](_0x48ed61,{'showHidden':![],'depth':null}));};exports[_0x21c5('0xc')]=function(_0x2dc212){return function(_0x511e96){logger[_0x21c5('0xb')](_0x2dc212,util['inspect'](_0x511e96,{'showHidden':![],'depth':null}));};};exports[_0x21c5('0xd')]=function(_0x93e063,_0x5bb986,_0x17be3d){return{'message':_0x93e063,'unlock':_0x5bb986,'active':_0x17be3d};};exports['getCallerId']=function(_0x4791f7,_0x3ba28b,_0x35d2fe){if(!_[_0x21c5('0xe')](_0x35d2fe)&&_0x21c5('0xf')===typeof _0x35d2fe&&!_[_0x21c5('0x10')](_0x35d2fe)){if(!_[_0x21c5('0xe')](_0x3ba28b)&&_0x21c5('0xf')===typeof _0x3ba28b&&!_['isEmpty'](_0x3ba28b)){return util[_0x21c5('0x11')]('\x22%s\x22\x20<%s>',_0x3ba28b,_0x35d2fe);}return util['format'](_0x21c5('0x12'),_0x35d2fe,_0x35d2fe);}if(!_['isUndefined'](_0x4791f7)&&'string'===typeof _0x4791f7&&!_[_0x21c5('0x10')](_0x4791f7)){return _0x4791f7;}return'\x22\x22\x20<>';};exports[_0x21c5('0x13')]=function(_0x5770e6){if(_[_0x21c5('0x14')](_0x5770e6)){return![];}return _0x5770e6;};exports['addVariables']=function(_0x4bf01b,_0x2d57fc,_0x141ae0,_0x2840b7,_0x300178,_0xd23b55){var _0x1fb82d={'XMD-QUEUE':_0x2d57fc[_0x21c5('0x15')]?_0x2d57fc[_0x21c5('0x15')][_0x21c5('0x16')]:'','XMD-CALLERID':_0x2840b7,'XMD-CALLERID-PREVIEW':_0xd23b55?util['format'](_0x21c5('0x12'),_0xd23b55[_0x21c5('0x17')],_0xd23b55[_0x21c5('0x18')]):_0x2840b7,'XMD-DIALID':_0x300178,'XMD-CONTACTID':_0x2d57fc[_0x21c5('0x19')],'XMD-CDRTYPE':_0x21c5('0x1a'),'CALLERID(all)':_0x2840b7,'XMD-VOICEQUEUEID':_0x2d57fc['VoiceQueueId'],'XMD-DIALCHANNEL':_0x141ae0,'XMD-DIALTIMEOUT':_0x4bf01b[_0x21c5('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x21c5('0x11')](_0x21c5('0x1c'),_0x4bf01b[_0x21c5('0x1d')]?'g':'',_[_0x21c5('0x10')](_0x4bf01b['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x4bf01b[_0x21c5('0x1e')]||'','XMD-AGI':_0x4bf01b[_0x21c5('0x1f')]?util[_0x21c5('0x11')](_0x21c5('0x20'),ipAgi,_0x4bf01b[_0x21c5('0x1f')]):_0x21c5('0x21'),'XMD-AGIAFTER':_0x4bf01b['dialQueueProject2']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x4bf01b[_0x21c5('0x1d')]):_0x21c5('0x21'),'XMD-ORIGINATECALLERIDNUM':_0xd23b55?_0xd23b55[_0x21c5('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0xd23b55?_0xd23b55[_0x21c5('0x23')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x21c5('0x10')](_0x4bf01b[_0x21c5('0x24')])){_0x1fb82d[util[_0x21c5('0x11')]('%s',_0x21c5('0x25'))]=_0x4bf01b[_0x21c5('0x24')];_0x1fb82d[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x300178;}if(_0x2d57fc&&_0x2d57fc[_0x21c5('0x26')]){for(var _0x29a15b in _0x2d57fc[_0x21c5('0x26')]){if(_0x2d57fc[_0x21c5('0x26')][_0x21c5('0x27')](_0x29a15b)){if(!_[_0x21c5('0x14')](_0x2d57fc[_0x21c5('0x26')][_0x29a15b])&&_0x29a15b!=='id'&&_0x29a15b!==_0x21c5('0x28')&&_0x29a15b!==_0x21c5('0x29')&&_0x29a15b!==_0x21c5('0x2a')){_0x1fb82d[util['format']('%s%s',_0x21c5('0x2b'),_['toUpper'](_0x29a15b))]=_0x2d57fc[_0x21c5('0x26')][_0x29a15b];}}}}return _0x1fb82d;};exports[_0x21c5('0x2c')]=function(_0x404e20){var _0x2a366e={};for(var _0x4fe6c4 in _0x404e20){if(_0x404e20[_0x21c5('0x27')](_0x4fe6c4)){_0x2a366e[util['format']('%s',_[_0x21c5('0x2d')](_0x4fe6c4))]=_0x404e20[_0x4fe6c4];}}return{'variables':_0x2a366e};};exports['updateOriginated']=function(_0x41419a,_0x1471f4){if(!_[_0x21c5('0x14')](_0x41419a)){if(_0x41419a['hasOwnProperty'](_0x21c5('0x2e'))){if(_0x41419a['originated']>0x0){_0x41419a[_0x21c5('0x2e')]-=0x1;}else{logger[_0x21c5('0x8')](_0x21c5('0x2f'),_0x1471f4);}}}else{logger['error'](_0x21c5('0x30'),_0x1471f4);}};exports['logBlacklist']=function(_0x4f74aa){var _0x449e7f=moment()[_0x21c5('0x11')](_0x21c5('0x31'));_0x4f74aa[_0x21c5('0x32')]=0xd;_0x4f74aa['statedesc']=_0x21c5('0x33');_0x4f74aa[_0x21c5('0x34')]=_0x449e7f;_0x4f74aa[_0x21c5('0x35')]=_0x449e7f;_0x4f74aa[_0x21c5('0x36')]=_0x449e7f;};exports[_0x21c5('0x37')]=function(_0x282178,_0x1d0434,_0x13f7a1){var _0x4e28a1=moment()[_0x21c5('0x11')](_0x21c5('0x31'));_0x282178[_0x21c5('0x32')]=_0x1d0434;_0x282178['statedesc']=_0x13f7a1;_0x282178[_0x21c5('0x35')]=_0x4e28a1;_0x282178[_0x21c5('0x38')]=getSeconds(_0x282178[_0x21c5('0x35')],_0x282178[_0x21c5('0x34')]);};exports[_0x21c5('0x39')]=function(_0x50f3c1,_0x5a08ad,_0x406abc){_0x50f3c1[_0x21c5('0x3a')]=_0x5a08ad;_0x50f3c1[_0x21c5('0x3b')]=_0x406abc;};exports[_0x21c5('0x3c')]=function(_0x59a2fb,_0x4414e1,_0x169c0d){var _0x301ea7=moment()[_0x21c5('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x59a2fb[_0x21c5('0x32')]=_0x4414e1;_0x59a2fb[_0x21c5('0x3d')]=_0x169c0d;_0x59a2fb['responsetime']=_0x59a2fb[_0x21c5('0x35')]?_0x59a2fb[_0x21c5('0x35')]:_0x301ea7;_0x59a2fb[_0x21c5('0x36')]=_0x59a2fb['endtime']?_0x59a2fb[_0x21c5('0x36')]:_0x301ea7;_0x59a2fb[_0x21c5('0x38')]=getSeconds(_0x59a2fb[_0x21c5('0x35')]||0x0,_0x59a2fb['starttime']||0x0);_0x59a2fb[_0x21c5('0x3e')]=_0x59a2fb['answertime']?getSeconds(_0x59a2fb[_0x21c5('0x36')],_0x59a2fb[_0x21c5('0x3f')]):0x0;};exports[_0x21c5('0x40')]=function(_0x3e915a){return _0x3e915a===_0x21c5('0x41');};exports['variablesAction']=function(_0x4e3053,_0x503ffa,_0x12da6a,_0x555736,_0x13c281){var _0x1bb6b2=_0x555736?_0x21c5('0x42'):_0x4e3053[_0x21c5('0x17')];_0x1bb6b2=_0x13c281?'BOOKED':_0x1bb6b2;return{'actionid':_0x4e3053[_0x21c5('0x43')],'action':_0x21c5('0x44'),'channel':_0x4e3053[_0x21c5('0x45')],'callerid':util[_0x21c5('0x11')](_0x21c5('0x12'),_0x1bb6b2,_0x4e3053[_0x21c5('0x18')]),'Exten':_0x21c5('0x46'),'Context':_0x21c5('0x47'),'Priority':'1','variable':_0x12da6a,'timeout':(_0x503ffa[_0x21c5('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4e3053['uniqueid']};};exports[_0x21c5('0x49')]=function(_0x5f3d15){return _0x5f3d15[_0x21c5('0x4a')]+_0x5f3d15[_0x21c5('0x4b')]+_0x5f3d15[_0x21c5('0x4c')]+_0x5f3d15[_0x21c5('0x4d')]+_0x5f3d15[_0x21c5('0x4e')];};exports[_0x21c5('0x4f')]=function(_0x29e4d3){var _0x132eec=_[_0x21c5('0x50')](_0x29e4d3);_0x132eec[_0x21c5('0x32')]=0xf;_0x132eec[_0x21c5('0x3d')]=_0x21c5('0x51');return _0x132eec;};exports['scheduledAt']=function(_0x5e4586,_0x5513c5,_0xe237a5){var _0x4100d4={};_0x4100d4[_0x5513c5]=_0x5e4586[_0x5513c5];_0x4100d4[_0x21c5('0x52')]=![];_0x4100d4['scheduledat']=moment()[_0x21c5('0x53')](_0xe237a5,_0x21c5('0x54'))[_0x21c5('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x4100d4['ContactId']=_0x5e4586[_0x21c5('0x19')];_0x4100d4[_0x21c5('0x55')]=_0x5e4586[_0x21c5('0x55')];_0x4100d4[_0x21c5('0x56')]=_0x5e4586['VoiceQueueId']||undefined;return _0x4100d4;};exports[_0x21c5('0x57')]=function(_0x31f2f6,_0x6a22a9){if(!_[_0x21c5('0x14')](_0x31f2f6)){if(_0x31f2f6['pTalking']>0x0){_0x31f2f6[_0x21c5('0x58')]-=0x1;}else{logger[_0x21c5('0x8')](_0x6a22a9,_0x21c5('0x59'));}}else{logger['error'](_0x6a22a9,_0x21c5('0x5a'));}};exports['IsNotLoggedIn']=function(_0x5391f7){if(_0x5391f7<=0x0){return!![];}return![];};exports[_0x21c5('0x5b')]=function(_0x2daf92,_0x26007f){_0x2daf92[_0x21c5('0x5c')]=_0x26007f;_0x2daf92[_0x21c5('0x16')]=_0x2daf92['queue'];_0x2daf92['interface']=_0x2daf92['channelAgent'];return _0x2daf92;};exports[_0x21c5('0x5d')]=function(_0x106cc6){var _0x573a1b={};_0x573a1b[_0x21c5('0x5e')]=_0x106cc6[_0x21c5('0x5e')];_0x573a1b[_0x21c5('0x5f')]=_0x106cc6[_0x21c5('0x45')];_0x573a1b['uniqueid']=_0x106cc6[_0x21c5('0x43')];return _0x573a1b;};exports[_0x21c5('0x60')]=function(_0x1b467f){var _0x8a9485=[];for(var _0x253781 in _0x1b467f){if(_0x1b467f['hasOwnProperty'](_0x253781)){if(!_['isNil'](_0x1b467f[_0x253781])&&_0x1b467f[_0x253781][_0x21c5('0x32')]===_0x21c5('0x61')&&_0x1b467f[_0x253781][_0x21c5('0x62')]===_0x21c5('0x63')){_0x8a9485[_0x21c5('0x64')](_0x1b467f[_0x253781]['id']);}}}return _0x8a9485;};exports['getDiff']=function(_0x184bc3){var _0xa94d2d=moment()['milliseconds'](0x0);var _0xeb6ad9=moment(_0x184bc3)[_0x21c5('0x5')](0x0);return _0xa94d2d['diff'](_0xeb6ad9,_0x21c5('0x6'));};exports['createBody']=function(_0x343fbe){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x343fbe['ContactId'],'ListId':_0x343fbe[_0x21c5('0x55')],'VoiceQueueId':_0x343fbe[_0x21c5('0x56')]||undefined,'CampaignId':_0x343fbe[_0x21c5('0x65')]||undefined};};exports[_0x21c5('0x66')]=function(_0x199890){if(_0x199890==='uniqueid'||_0x199890===_0x21c5('0x67')||_0x199890==='queue'||_0x199890===_0x21c5('0x68')||_0x199890==='campaigntype'||_0x199890===_0x21c5('0x69')||_0x199890===_0x21c5('0x3a')||_0x199890===_0x21c5('0x45')||_0x199890===_0x21c5('0x17')||_0x199890===_0x21c5('0x52')||_0x199890===_0x21c5('0x18')||_0x199890===_0x21c5('0x6a')||_0x199890===_0x21c5('0x4a')||_0x199890==='countcongestionretry'||_0x199890===_0x21c5('0x4c')||_0x199890==='countglobal'||_0x199890===_0x21c5('0x6b')||_0x199890===_0x21c5('0x6c')||_0x199890===_0x21c5('0x6d')||_0x199890===_0x21c5('0x6e')||_0x199890===_0x21c5('0x19')||_0x199890==='ListId'||_0x199890==='UserId'||_0x199890===_0x21c5('0x56')||_0x199890===_0x21c5('0x6f')||_0x199890===_0x21c5('0x70')||_0x199890===_0x21c5('0x71')||_0x199890===_0x21c5('0x72')||_0x199890==='xmd-listid'||_0x199890===_0x21c5('0x73')||_0x199890===_0x21c5('0x74')||_0x199890==='xmd-dialoptions'||_0x199890===_0x21c5('0x75')||_0x199890==='xmd-dialchannel'||_0x199890===_0x21c5('0x76')||_0x199890===_0x21c5('0x77')||_0x199890===_0x21c5('0x78')||_0x199890===_0x21c5('0x79')||_0x199890===_0x21c5('0x7a')||_0x199890==='rtpaudioqos'||_0x199890===_0x21c5('0x7b')||_0x199890===_0x21c5('0x7c')||_0x199890===_0x21c5('0x7d')||_0x199890==='rtpaudioqosloss'||_0x199890===_0x21c5('0x7e')||_0x199890==='rtpaudioqosrtt'||_0x199890===_0x21c5('0x7f')||_0x199890==='rtpaudioqos'||_0x199890===_0x21c5('0x7b')||_0x199890===_0x21c5('0x7c')||_0x199890===_0x21c5('0x7d')||_0x199890===_0x21c5('0x80')||_0x199890===_0x21c5('0x7e')||_0x199890==='rtpaudioqosrtt'||_0x199890===_0x21c5('0x7f')||_0x199890===_0x21c5('0x81')||_0x199890==='bridgepvtcallid'||_0x199890===_0x21c5('0x32')||_0x199890===_0x21c5('0x3d')){return![];}return!![];};exports[_0x21c5('0x82')]=function(_0x5382e9,_0xc2c339){var _0x2a4bc9,_0x1ebc0d,_0x2f549d;if(_0xc2c339<=0x0){_0xc2c339=0x1;}_0x2a4bc9=new RegExp(_0x21c5('0x83')+_0xc2c339+'}$');_0x1ebc0d=Math['pow'](0xa,_0xc2c339-0x1);_0x2f549d=Math[_0x21c5('0x84')](0xa,_0xc2c339)-0x1;return util[_0x21c5('0x11')]('%s',_['replace'](_0x5382e9,_0x2a4bc9,_[_0x21c5('0x85')](_0x1ebc0d,_0x2f549d)));};exports[_0x21c5('0x86')]=function(_0x44b00f){var _0x1ca34b=_0x44b00f['match'](/"(.*?)"/);return _0x1ca34b?_0x1ca34b[0x1]:_0x44b00f;};exports[_0x21c5('0x87')]=function(_0x2a547b){var _0x21bedc=_0x2a547b[_0x21c5('0x88')](/<(.*?)>/);return _0x21bedc?_0x21bedc[0x1]:_0x2a547b;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 6f5a615..3269d39 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x5d50e4,_0x3810a4){var _0x56946b=function(_0x88d803){while(--_0x88d803){_0x5d50e4['push'](_0x5d50e4['shift']());}};_0x56946b(++_0x3810a4);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b7711,_0x4bd810){_0x5b7711=_0x5b7711-0x0;var _0x16e558=_0xb10b[_0x5b7711];return _0x16e558;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x5c120a,_0x564426){var _0x339c28=function(_0x27c6ba){while(--_0x27c6ba){_0x5c120a['push'](_0x5c120a['shift']());}};_0x339c28(++_0x564426);}(_0xb10b,0x12a));var _0xbb10=function(_0xcf82b2,_0x49ab9a){_0xcf82b2=_0xcf82b2-0x0;var _0x4275e9=_0xb10b[_0xcf82b2];return _0x4275e9;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 18dafb0..8509d6d 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 _0xc7fa=['queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','merge','initFaxAccounts','bluebird','util','lodash','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions','channels','queueChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','abandoned','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isUndefined','mergeFromDatabase','initTrunks','initVoiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','initFreshdeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','unmanaged','queuecallerabandon'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xc7fa,0x7a));var _0xac7f=function(_0xdc5685,_0x3d880b){_0xdc5685=_0xdc5685-0x0;var _0x387326=_0xc7fa[_0xdc5685];return _0x387326;};'use strict';var BPromise=require(_0xac7f('0x0'));var util=require(_0xac7f('0x1'));var _=require(_0xac7f('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0xac7f('0x3'));var Trunk=require(_0xac7f('0x4'));var VoiceQueue=require(_0xac7f('0x5'));var Trigger=require(_0xac7f('0x6'));var Template=require(_0xac7f('0x7'));var Campaign=require(_0xac7f('0x8'));var VoiceExtension=require(_0xac7f('0x9'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xac7f('0xa'));var FreshdeskAccount=require(_0xac7f('0xb'));var SugarcrmAccount=require(_0xac7f('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xac7f('0xd'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xac7f('0xe'));var Dynamics365Account=require(_0xac7f('0xf'));var FreshsalesAccount=require(_0xac7f('0x10'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xac7f('0x11')]={};this[_0xac7f('0x12')]={};this[_0xac7f('0x13')]={};this[_0xac7f('0x14')]={};this[_0xac7f('0x15')]={};this[_0xac7f('0x16')]={};this['templates']={};this[_0xac7f('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xac7f('0x18')]={};this[_0xac7f('0x19')]={};this[_0xac7f('0x1a')]={};this['outboundChannels']={};this['timers']={};this[_0xac7f('0x1b')]={};this[_0xac7f('0x1c')]={};this[_0xac7f('0x1d')]={};this[_0xac7f('0x1e')]={};this[_0xac7f('0x1f')]={};this[_0xac7f('0x20')]={};this[_0xac7f('0x21')]={};this[_0xac7f('0x22')]={};this['dynamics365Accounts']={};this[_0xac7f('0x23')]={};this[_0xac7f('0x24')]={};};function freeIsNotKey(_0x40a23f,_0x5001d0,_0x287c50){var _0x32ce01=_['mapKeys'](_0x40a23f,function(_0x4b84f5,_0x20aaf4){return _0x4b84f5[_0x287c50];});for(var _0x4288e5 in _0x5001d0){if(_0x5001d0[_0xac7f('0x25')](_0x4288e5)){if(!_0x32ce01[_0x4288e5]){delete _0x5001d0[_0x4288e5];}}}}function freeIsNotKeySip(_0x5e01c2,_0xb1b837){var _0x41b35e=_[_0xac7f('0x26')](_0x5e01c2,function(_0x4ec09b,_0x30a7e6){return util[_0xac7f('0x27')](_0xac7f('0x28'),_0x4ec09b[_0xac7f('0x29')]);});for(var _0x129235 in _0xb1b837){if(_0xb1b837[_0xac7f('0x25')](_0x129235)){if(!_0x41b35e[_0x129235]){delete _0xb1b837[_0x129235];}}}}function freeIsNotKeyAgent(_0x3b49e9,_0xfc6dea){var _0x29c068=_[_0xac7f('0x26')](_0x3b49e9,function(_0x47b24b,_0x1d2fde){var _0xe13901=_[_0xac7f('0x2a')](_0x47b24b[_0xac7f('0x2b')])?util[_0xac7f('0x27')](_0xac7f('0x28'),_0x47b24b[_0xac7f('0x29')]):_0x47b24b[_0xac7f('0x2b')];return _0xe13901;});for(var _0x373d86 in _0xfc6dea){if(_0xfc6dea[_0xac7f('0x25')](_0x373d86)){if(!_0x29c068[_0x373d86]){delete _0xfc6dea[_0x373d86];}}}}function clearVoiceCallReports(_0x4c84e3){_0x4c84e3[_0xac7f('0x2c')]=0x0;_0x4c84e3[_0xac7f('0x2d')]=0x0;_0x4c84e3[_0xac7f('0x2e')]=0x0;_0x4c84e3[_0xac7f('0x2f')]=0x0;_0x4c84e3[_0xac7f('0x30')]=0x0;}function clearCampaigns(_0x1405a4){if(!_['isEmpty'](_0x1405a4)){for(var _0x53fe0d in _0x1405a4){if(_0x1405a4[_0xac7f('0x25')](_0x53fe0d)){_0x1405a4[_0x53fe0d][_0xac7f('0x31')]=0x0;_0x1405a4[_0x53fe0d]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x236fe0){if(!_['isEmpty'](_0x236fe0)){for(var _0x4e5b28 in _0x236fe0){if(_0x236fe0[_0xac7f('0x25')](_0x4e5b28)){_0x236fe0[_0x4e5b28][_0xac7f('0x2c')]=0x0;_0x236fe0[_0x4e5b28][_0xac7f('0x2d')]=0x0;_0x236fe0[_0x4e5b28]['unmanaged']=0x0;_0x236fe0[_0x4e5b28][_0xac7f('0x32')]=0x0;_0x236fe0[_0x4e5b28][_0xac7f('0x2e')]=0x0;_0x236fe0[_0x4e5b28][_0xac7f('0x2f')]=0x0;_0x236fe0[_0x4e5b28]['sumBillable']=0x0;_0x236fe0[_0x4e5b28][_0xac7f('0x33')]=0x0;_0x236fe0[_0x4e5b28]['outboundNoAnswerCallsDay']=0x0;_0x236fe0[_0x4e5b28]['outboundBusyCallsDay']=0x0;_0x236fe0[_0x4e5b28][_0xac7f('0x34')]=0x0;_0x236fe0[_0x4e5b28][_0xac7f('0x35')]=0x0;_0x236fe0[_0x4e5b28]['outboundUnknownCallsDay']=0x0;_0x236fe0[_0x4e5b28][_0xac7f('0x36')]=0x0;_0x236fe0[_0x4e5b28][_0xac7f('0x37')]=0x0;_0x236fe0[_0x4e5b28][_0xac7f('0x38')]=0x0;_0x236fe0[_0x4e5b28][_0xac7f('0x39')]=0x0;_0x236fe0[_0x4e5b28][_0xac7f('0x3a')]=0x0;_0x236fe0[_0x4e5b28][_0xac7f('0x3b')]=0x0;_0x236fe0[_0x4e5b28][_0xac7f('0x33')]=0x0;_0x236fe0[_0x4e5b28][_0xac7f('0x3c')]=0x0;_0x236fe0[_0x4e5b28][_0xac7f('0x3d')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x25621a,_0xc97459){for(var _0xd8feb7 in _0xc97459){if(_0x25621a['hasOwnProperty'](_0xd8feb7)){_0x25621a[_0xd8feb7]=_0xc97459[_0xd8feb7];}}};Realtime[_0xac7f('0x3e')][_0xac7f('0x3f')]=function(){var _0x2d72fc=this;return function(_0x211dad){if(_0x211dad){freeIsNotKeyAgent(_0x211dad,_0x2d72fc[_0xac7f('0x11')]);for(var _0x2b362c=0x0,_0x5c218a={},_0x5ce63b={};_0x2b362c<_0x211dad[_0xac7f('0x40')];_0x2b362c+=0x1){_0x5c218a=_0x211dad[_0x2b362c];var _0x1fb085=_[_0xac7f('0x2a')](_0x5c218a[_0xac7f('0x2b')])?util[_0xac7f('0x27')](_0xac7f('0x28'),_0x5c218a['name']):_0x5c218a['interface'];if(_[_0xac7f('0x41')](_0x2d72fc[_0xac7f('0x11')][_0x1fb085])){_0x2d72fc[_0xac7f('0x11')][_0x1fb085]=new Agent(_0x5c218a);}else{_0x2d72fc['mergeFromDatabase'](_0x2d72fc[_0xac7f('0x11')][_0x1fb085],_0x5c218a);}}}return _0x2d72fc['agents'];};};Realtime[_0xac7f('0x3e')]['initTelephones']=function(){var _0x87b2da=this;return function(_0x593a1a){if(_0x593a1a){freeIsNotKeySip(_0x593a1a,_0x87b2da[_0xac7f('0x12')]);for(var _0x53bf3c=0x0,_0x291c1a={},_0x2bd7eb={};_0x53bf3c<_0x593a1a[_0xac7f('0x40')];_0x53bf3c+=0x1){_0x291c1a=_0x593a1a[_0x53bf3c];if(_[_0xac7f('0x41')](_0x87b2da[_0xac7f('0x12')][util[_0xac7f('0x27')](_0xac7f('0x28'),_0x291c1a[_0xac7f('0x29')])])){_0x87b2da[_0xac7f('0x12')][util[_0xac7f('0x27')]('SIP/%s',_0x291c1a[_0xac7f('0x29')])]=new Telephone(_0x291c1a);}else{_0x87b2da[_0xac7f('0x42')](_0x87b2da[_0xac7f('0x12')][util[_0xac7f('0x27')](_0xac7f('0x28'),_0x291c1a['name'])],_0x291c1a);}}}return _0x87b2da[_0xac7f('0x12')];};};Realtime[_0xac7f('0x3e')][_0xac7f('0x43')]=function(){var _0x58c0be=this;return function(_0x396396){if(_0x396396){freeIsNotKeySip(_0x396396,_0x58c0be['trunks']);for(var _0x58687b=0x0,_0x5ee275={},_0x5e611b={};_0x58687b<_0x396396[_0xac7f('0x40')];_0x58687b+=0x1){_0x5ee275=_0x396396[_0x58687b];if(_[_0xac7f('0x41')](_0x58c0be[_0xac7f('0x13')][util[_0xac7f('0x27')](_0xac7f('0x28'),_0x5ee275['name'])])){_0x58c0be[_0xac7f('0x13')][util[_0xac7f('0x27')]('SIP/%s',_0x5ee275[_0xac7f('0x29')])]=new Trunk(_0x5ee275);}else{_0x58c0be[_0xac7f('0x42')](_0x58c0be[_0xac7f('0x13')][util[_0xac7f('0x27')](_0xac7f('0x28'),_0x5ee275[_0xac7f('0x29')])],_0x5ee275);}}}return _0x58c0be[_0xac7f('0x13')];};};Realtime['prototype'][_0xac7f('0x44')]=function(){var _0x54068b=this;return function(_0x44bb04){if(_0x44bb04){freeIsNotKey(_0x44bb04,_0x54068b[_0xac7f('0x14')],_0xac7f('0x29'));for(var _0x2569c9=0x0,_0x5546d5={},_0x986beb={};_0x2569c9<_0x44bb04[_0xac7f('0x40')];_0x2569c9+=0x1){_0x5546d5=_0x44bb04[_0x2569c9];if(_[_0xac7f('0x41')](_0x54068b[_0xac7f('0x14')][_0x5546d5[_0xac7f('0x29')]])){_0x54068b[_0xac7f('0x14')][_0x5546d5[_0xac7f('0x29')]]=new VoiceQueue(_0x5546d5);}else{_0x54068b[_0xac7f('0x42')](_0x54068b[_0xac7f('0x14')][_0x5546d5[_0xac7f('0x29')]],_0x5546d5);}}}return _0x54068b[_0xac7f('0x14')];};};Realtime[_0xac7f('0x3e')][_0xac7f('0x45')]=function(){var _0x409679=this;return function(_0x5a1f6a){if(_0x5a1f6a){freeIsNotKey(_0x5a1f6a,_0x409679[_0xac7f('0x15')],'id');for(var _0x4cde00=0x0,_0x2d8284={},_0x11af76={};_0x4cde00<_0x5a1f6a['length'];_0x4cde00+=0x1){_0x2d8284=_0x5a1f6a[_0x4cde00];if(_['isUndefined'](_0x409679[_0xac7f('0x15')][_0x2d8284['id']])){_0x409679[_0xac7f('0x15')][_0x2d8284['id']]=new Trigger(_0x2d8284);}else{_0x409679[_0xac7f('0x42')](_0x409679[_0xac7f('0x15')][_0x2d8284['id']],_0x2d8284);}}}return _0x409679['triggers'];};};Realtime[_0xac7f('0x3e')][_0xac7f('0x46')]=function(){var _0x4c306d=this;return function(_0x105461){if(_0x105461){freeIsNotKey(_0x105461,_0x4c306d[_0xac7f('0x47')],'id');for(var _0x5191eb=0x0,_0x41fa06={},_0x161575={};_0x5191eb<_0x105461[_0xac7f('0x40')];_0x5191eb+=0x1){_0x41fa06=_0x105461[_0x5191eb];if(_[_0xac7f('0x41')](_0x4c306d[_0xac7f('0x47')][_0x41fa06['id']])){_0x4c306d[_0xac7f('0x47')][_0x41fa06['id']]=new Template(_0x41fa06);}else{_0x4c306d[_0xac7f('0x42')](_0x4c306d[_0xac7f('0x47')][_0x41fa06['id']],_0x41fa06);}}}return _0x4c306d['templates'];};};Realtime[_0xac7f('0x3e')][_0xac7f('0x48')]=function(){var _0x4a905f=this;return function(_0x54ee12){if(_0x54ee12){freeIsNotKey(_0x54ee12,_0x4a905f[_0xac7f('0x1b')],'id');for(var _0x1ead73=0x0,_0x512643={},_0x17e7c4={};_0x1ead73<_0x54ee12[_0xac7f('0x40')];_0x1ead73+=0x1){_0x512643=_0x54ee12[_0x1ead73];if(_['isUndefined'](_0x4a905f[_0xac7f('0x1b')][_0x512643['id']])){_0x4a905f[_0xac7f('0x1b')][_0x512643['id']]=new ZendeskAccount(_0x512643);}else{_0x4a905f[_0xac7f('0x42')](_0x4a905f['zendeskAccounts'][_0x512643['id']],_0x512643);}}}return _0x4a905f[_0xac7f('0x1b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x1366f9=this;return function(_0x3069dd){if(_0x3069dd){freeIsNotKey(_0x3069dd,_0x1366f9[_0xac7f('0x1c')],'id');for(var _0xf8e6ae=0x0,_0x294d28={},_0x11fefc={};_0xf8e6ae<_0x3069dd['length'];_0xf8e6ae+=0x1){_0x294d28=_0x3069dd[_0xf8e6ae];if(_[_0xac7f('0x41')](_0x1366f9[_0xac7f('0x1c')][_0x294d28['id']])){_0x1366f9[_0xac7f('0x1c')][_0x294d28['id']]=new SalesforceAccount(_0x294d28);}else{_0x1366f9['mergeFromDatabase'](_0x1366f9[_0xac7f('0x1c')][_0x294d28['id']],_0x294d28);}}}return _0x1366f9[_0xac7f('0x1c')];};};Realtime['prototype'][_0xac7f('0x49')]=function(){var _0xf1095e=this;return function(_0x38c644){if(_0x38c644){freeIsNotKey(_0x38c644,_0xf1095e[_0xac7f('0x1e')],'id');for(var _0x4a940a=0x0,_0x443071={},_0x4ef29e={};_0x4a940a<_0x38c644['length'];_0x4a940a+=0x1){_0x443071=_0x38c644[_0x4a940a];if(_['isUndefined'](_0xf1095e[_0xac7f('0x1e')][_0x443071['id']])){_0xf1095e[_0xac7f('0x1e')][_0x443071['id']]=new FreshdeskAccount(_0x443071);}else{_0xf1095e['mergeFromDatabase'](_0xf1095e[_0xac7f('0x1e')][_0x443071['id']],_0x443071);}}}return _0xf1095e[_0xac7f('0x1e')];};};Realtime[_0xac7f('0x3e')]['initZohoAccounts']=function(){var _0x3a9577=this;return function(_0x1ee7fd){if(_0x1ee7fd){freeIsNotKey(_0x1ee7fd,_0x3a9577[_0xac7f('0x1f')],'id');for(var _0x5640bc=0x0,_0xe2b600={},_0xa3c970={};_0x5640bc<_0x1ee7fd[_0xac7f('0x40')];_0x5640bc+=0x1){_0xe2b600=_0x1ee7fd[_0x5640bc];if(_['isUndefined'](_0x3a9577[_0xac7f('0x1f')][_0xe2b600['id']])){_0x3a9577[_0xac7f('0x1f')][_0xe2b600['id']]=new ZohoAccount(_0xe2b600);}else{_0x3a9577['mergeFromDatabase'](_0x3a9577[_0xac7f('0x1f')][_0xe2b600['id']],_0xe2b600);}}}return _0x3a9577[_0xac7f('0x1f')];};};Realtime[_0xac7f('0x3e')]['initDeskAccounts']=function(){var _0x39c241=this;return function(_0x24979f){if(_0x24979f){freeIsNotKey(_0x24979f,_0x39c241[_0xac7f('0x20')],'id');for(var _0x468e41=0x0,_0x2f600c={},_0x2b8678={};_0x468e41<_0x24979f['length'];_0x468e41+=0x1){_0x2f600c=_0x24979f[_0x468e41];if(_[_0xac7f('0x41')](_0x39c241[_0xac7f('0x20')][_0x2f600c['id']])){_0x39c241[_0xac7f('0x20')][_0x2f600c['id']]=new DeskAccount(_0x2f600c);}else{_0x39c241['mergeFromDatabase'](_0x39c241[_0xac7f('0x20')][_0x2f600c['id']],_0x2f600c);}}}return _0x39c241[_0xac7f('0x20')];};};Realtime[_0xac7f('0x3e')][_0xac7f('0x4a')]=function(){var _0x5f4cc0=this;return function(_0x565982){if(_0x565982){freeIsNotKey(_0x565982,_0x5f4cc0[_0xac7f('0x1d')],'id');for(var _0x554c70=0x0,_0x5a8ccf={},_0x20e570={};_0x554c70<_0x565982[_0xac7f('0x40')];_0x554c70+=0x1){_0x5a8ccf=_0x565982[_0x554c70];if(_[_0xac7f('0x41')](_0x5f4cc0['sugarcrmAccounts'][_0x5a8ccf['id']])){_0x5f4cc0['sugarcrmAccounts'][_0x5a8ccf['id']]=new SugarcrmAccount(_0x5a8ccf);}else{_0x5f4cc0[_0xac7f('0x42')](_0x5f4cc0[_0xac7f('0x1d')][_0x5a8ccf['id']],_0x5a8ccf);}}}return _0x5f4cc0[_0xac7f('0x1d')];};};Realtime[_0xac7f('0x3e')][_0xac7f('0x4b')]=function(){var _0xdc3db9=this;return function(_0x5cc0f3){if(_0x5cc0f3){freeIsNotKey(_0x5cc0f3,_0xdc3db9[_0xac7f('0x21')],'id');for(var _0x5e8a29=0x0,_0x19708e={},_0x1f668a={};_0x5e8a29<_0x5cc0f3[_0xac7f('0x40')];_0x5e8a29+=0x1){_0x19708e=_0x5cc0f3[_0x5e8a29];if(_['isUndefined'](_0xdc3db9[_0xac7f('0x21')][_0x19708e['id']])){_0xdc3db9[_0xac7f('0x21')][_0x19708e['id']]=new VtigerAccount(_0x19708e);}else{_0xdc3db9[_0xac7f('0x42')](_0xdc3db9[_0xac7f('0x21')][_0x19708e['id']],_0x19708e);}}}return _0xdc3db9['vtigerAccounts'];};};Realtime[_0xac7f('0x3e')][_0xac7f('0x4c')]=function(){var _0x5b6f26=this;return function(_0x255c63){if(_0x255c63){freeIsNotKey(_0x255c63,_0x5b6f26[_0xac7f('0x22')],'id');for(var _0x21b919=0x0,_0x218678={},_0x4dbaa2={};_0x21b919<_0x255c63['length'];_0x21b919+=0x1){_0x218678=_0x255c63[_0x21b919];if(_[_0xac7f('0x41')](_0x5b6f26['servicenowAccounts'][_0x218678['id']])){_0x5b6f26['servicenowAccounts'][_0x218678['id']]=new ServicenowAccount(_0x218678);}else{_0x5b6f26[_0xac7f('0x42')](_0x5b6f26[_0xac7f('0x22')][_0x218678['id']],_0x218678);}}}return _0x5b6f26['servicenowAccounts'];};};Realtime[_0xac7f('0x3e')][_0xac7f('0x4d')]=function(){var _0x3f6bd1=this;return function(_0x3f02f2){if(_0x3f02f2){freeIsNotKey(_0x3f02f2,_0x3f6bd1['dynamics365Accounts'],'id');for(var _0x1a3319=0x0,_0x19e15e={},_0x29c644={};_0x1a3319<_0x3f02f2[_0xac7f('0x40')];_0x1a3319+=0x1){_0x19e15e=_0x3f02f2[_0x1a3319];if(_[_0xac7f('0x41')](_0x3f6bd1[_0xac7f('0x4e')][_0x19e15e['id']])){_0x3f6bd1['dynamics365Accounts'][_0x19e15e['id']]=new Dynamics365Account(_0x19e15e);}else{_0x3f6bd1[_0xac7f('0x42')](_0x3f6bd1[_0xac7f('0x4e')][_0x19e15e['id']],_0x19e15e);}}}return _0x3f6bd1[_0xac7f('0x4e')];};};Realtime[_0xac7f('0x3e')]['initFreshsalesAccounts']=function(){var _0x1d60e5=this;return function(_0x11bdc9){if(_0x11bdc9){freeIsNotKey(_0x11bdc9,_0x1d60e5['freshsalesAccounts'],'id');for(var _0xf801ee=0x0,_0x1820a7={},_0x57a5f3={};_0xf801ee<_0x11bdc9[_0xac7f('0x40')];_0xf801ee+=0x1){_0x1820a7=_0x11bdc9[_0xf801ee];if(_[_0xac7f('0x41')](_0x1d60e5[_0xac7f('0x23')][_0x1820a7['id']])){_0x1d60e5[_0xac7f('0x23')][_0x1820a7['id']]=new FreshsalesAccount(_0x1820a7);}else{_0x1d60e5[_0xac7f('0x42')](_0x1d60e5['freshsalesAccounts'][_0x1820a7['id']],_0x1820a7);}}}return _0x1d60e5['freshsalesAccounts'];};};Realtime[_0xac7f('0x3e')][_0xac7f('0x4f')]=function(){var _0x5daa38=this;return function(_0x3e2cc9){for(var _0x13d393=0x0;_0x13d393<_0x3e2cc9['length'];_0x13d393+=0x1){_['merge'](_0x5daa38[_0xac7f('0x14')][_0x3e2cc9[_0x13d393][_0xac7f('0x29')]],_0x3e2cc9[_0x13d393]);}return _0x5daa38['voiceQueues'];};};Realtime[_0xac7f('0x3e')][_0xac7f('0x50')]=function(){var _0x5b1195=this;return function(_0x58dae9){clearVoiceQueues(_0x5b1195['voiceQueues']);if(_0x58dae9){_0x58dae9=_[_0xac7f('0x51')](_0x58dae9,_0xac7f('0x52'));for(var _0x3be6db in _0x58dae9){if(_0x58dae9[_0xac7f('0x25')](_0x3be6db)){var _0x3cf30b={};for(var _0x20770c=0x0;_0x20770c<_0x58dae9[_0x3be6db]['length'];_0x20770c+=0x1){var _0x57e5f0=_0x58dae9[_0x3be6db][_0x20770c][_0xac7f('0x53')];if(_0x5b1195[_0xac7f('0x14')][_0x57e5f0]){if(_0x58dae9[_0x3be6db][_0x20770c]['queuecallerexit']){_0x5b1195[_0xac7f('0x14')][_0x57e5f0][_0xac7f('0x54')]+=0x1;}if(_0x58dae9[_0x3be6db][_0x20770c][_0xac7f('0x55')]){_0x5b1195['voiceQueues'][_0x57e5f0][_0xac7f('0x32')]+=0x1;}_0x5b1195[_0xac7f('0x14')][_0x57e5f0][_0xac7f('0x2e')]+=moment(_0x58dae9[_0x3be6db][_0x20770c][_0xac7f('0x56')])[_0xac7f('0x57')](moment(_0x58dae9[_0x3be6db][_0x20770c][_0xac7f('0x58')]),_0xac7f('0x59'))||0x0;if(_0x20770c===_0x58dae9[_0x3be6db][_0xac7f('0x40')]-0x1){_0x5b1195[_0xac7f('0x14')][_0x57e5f0]['sumDuration']+=moment(_0x58dae9[_0x3be6db][_0x20770c][_0xac7f('0x5a')]||_0x58dae9[_0x3be6db][_0x20770c][_0xac7f('0x5b')]||_0x58dae9[_0x3be6db][_0x20770c][_0xac7f('0x5c')])[_0xac7f('0x57')](moment(_0x58dae9[_0x3be6db][_0x20770c][_0xac7f('0x58')]),_0xac7f('0x59'))||0x0;_0x5b1195['voiceQueues'][_0x57e5f0][_0xac7f('0x2c')]+=0x1;if(_0x58dae9[_0x3be6db][_0x20770c][_0xac7f('0x5d')]){_0x5b1195[_0xac7f('0x14')][_0x57e5f0][_0xac7f('0x2d')]+=0x1;_0x5b1195[_0xac7f('0x14')][_0x57e5f0][_0xac7f('0x30')]+=moment(_0x58dae9[_0x3be6db][_0x20770c][_0xac7f('0x5a')])[_0xac7f('0x57')](moment(_0x58dae9[_0x3be6db][_0x20770c][_0xac7f('0x56')]),'seconds')||0x0;}}else{_0x5b1195[_0xac7f('0x14')][_0x57e5f0][_0xac7f('0x2f')]+=_0x5b1195['voiceQueues'][_0x57e5f0][_0xac7f('0x2e')]||0x0;}}}}}}return _0x5b1195[_0xac7f('0x14')];};};Realtime['prototype'][_0xac7f('0x5e')]=function(){var _0x88ea28=this;return function(_0x33ecfc){clearVoiceCallReports(_0x88ea28['outbound']);if(_0x33ecfc){for(var _0x40abc0=0x0;_0x40abc0<_0x33ecfc[_0xac7f('0x40')];_0x40abc0+=0x1){_0x88ea28['outbound'][_0xac7f('0x2c')]+=0x1;_0x88ea28[_0xac7f('0x17')]['sumDuration']+=_0x33ecfc[_0x40abc0][_0xac7f('0x5f')];if(_0x33ecfc[_0x40abc0][_0xac7f('0x60')]==='ANSWERED'){_0x88ea28[_0xac7f('0x17')][_0xac7f('0x2d')]+=0x1;_0x88ea28[_0xac7f('0x17')][_0xac7f('0x2e')]+=_0x33ecfc[_0x40abc0][_0xac7f('0x5f')]-_0x33ecfc[_0x40abc0][_0xac7f('0x61')]||0x0;_0x88ea28[_0xac7f('0x17')]['sumBillable']+=_0x33ecfc[_0x40abc0][_0xac7f('0x61')];}}}return _0x88ea28[_0xac7f('0x17')];};};Realtime[_0xac7f('0x3e')][_0xac7f('0x62')]=function(){var _0x3af927=this;return function(_0x444cd3){if(_0x444cd3){freeIsNotKey(_0x444cd3,_0x3af927[_0xac7f('0x16')],_0xac7f('0x29'));for(var _0x123f43=0x0,_0x372f62={};_0x123f43<_0x444cd3['length'];_0x123f43+=0x1){_0x372f62=_0x444cd3[_0x123f43];if(_[_0xac7f('0x41')](_0x3af927[_0xac7f('0x16')][_0x372f62[_0xac7f('0x29')]])){_0x3af927[_0xac7f('0x16')][_0x372f62[_0xac7f('0x29')]]=new Campaign(_0x372f62);}else{_0x3af927['mergeFromDatabase'](_0x3af927[_0xac7f('0x16')][_0x372f62[_0xac7f('0x29')]],_0x372f62);_0x3af927['campaigns'][_0x372f62[_0xac7f('0x29')]][_0xac7f('0x63')]=_0x372f62[_0xac7f('0x64')]?_0x372f62['SquareProject'][_0xac7f('0x29')]:undefined;}}}return _0x3af927[_0xac7f('0x16')];};};Realtime[_0xac7f('0x3e')][_0xac7f('0x65')]=function(){var _0x93915d=this;return function(_0x27b930){if(_0x27b930){freeIsNotKey(_0x27b930,_0x93915d[_0xac7f('0x18')],'id');for(var _0x1aa7d0=0x0,_0x133982={};_0x1aa7d0<_0x27b930[_0xac7f('0x40')];_0x1aa7d0+=0x1){_0x133982=_0x27b930[_0x1aa7d0];if(_[_0xac7f('0x41')](_0x93915d[_0xac7f('0x18')][_0x133982['id']])){_0x93915d['voiceExtensions'][_0x133982['id']]=new VoiceExtension(_0x133982);}else{_0x93915d[_0xac7f('0x42')](_0x93915d['voiceExtensions'][_0x133982['id']],_0x133982);}}}return _0x93915d[_0xac7f('0x18')];};};Realtime[_0xac7f('0x3e')]['initCampaignHopperHistory']=function(){var _0x545ec3=this;return function(_0x58422e){clearCampaigns(_0x545ec3[_0xac7f('0x16')]);for(var _0x2f9b33=0x0;_0x2f9b33<_0x58422e['length'];_0x2f9b33+=0x1){_[_0xac7f('0x66')](_0x545ec3[_0xac7f('0x16')][_0x58422e[_0x2f9b33][_0xac7f('0x29')]],_0x58422e[_0x2f9b33]);}return _0x545ec3['campaigns'];};};Realtime[_0xac7f('0x3e')][_0xac7f('0x67')]=function(){var _0x53c8fb=this;return function(_0x51d11b){if(_0x51d11b){freeIsNotKey(_0x51d11b,_0x53c8fb[_0xac7f('0x24')],'id');for(var _0x28e2cb=0x0,_0x3bc6aa={},_0x83dbb0={};_0x28e2cb<_0x51d11b[_0xac7f('0x40')];_0x28e2cb+=0x1){_0x3bc6aa=_0x51d11b[_0x28e2cb];if(_[_0xac7f('0x41')](_0x53c8fb['faxAccounts'][_0x3bc6aa['id']])){_0x53c8fb['faxAccounts'][_0x3bc6aa['id']]=new FaxAccount(_0x3bc6aa);}else{_0x53c8fb['mergeFromDatabase'](_0x53c8fb[_0xac7f('0x24')][_0x3bc6aa['id']],_0x3bc6aa);}}}return _0x53c8fb[_0xac7f('0x24')];};};module['exports']=Realtime; \ No newline at end of file +var _0xc2e1=['campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','lodash','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','agents','voiceQueues','triggers','outbound','voiceExtensions','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','name','isNil','format','interface','total','answered','sumHoldTime','sumDuration','ivrAnswerCallsDay','isEmpty','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','SIP/%s','isUndefined','initTelephones','telephones','trunks','initVoiceQueues','initTemplates','templates','initZendeskAccounts','initFreshdeskAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','sumBillable','initCampaigns'];(function(_0x492e2e,_0x5ce525){var _0x5344ec=function(_0x12dec9){while(--_0x12dec9){_0x492e2e['push'](_0x492e2e['shift']());}};_0x5344ec(++_0x5ce525);}(_0xc2e1,0x1b3));var _0x1c2e=function(_0x446a44,_0x8a11d0){_0x446a44=_0x446a44-0x0;var _0x5b7b0a=_0xc2e1[_0x446a44];return _0x5b7b0a;};'use strict';var BPromise=require(_0x1c2e('0x0'));var util=require('util');var _=require(_0x1c2e('0x1'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0x1c2e('0x2'));var Trunk=require(_0x1c2e('0x3'));var VoiceQueue=require(_0x1c2e('0x4'));var Trigger=require(_0x1c2e('0x5'));var Template=require(_0x1c2e('0x6'));var Campaign=require(_0x1c2e('0x7'));var VoiceExtension=require(_0x1c2e('0x8'));var ZendeskAccount=require(_0x1c2e('0x9'));var SalesforceAccount=require(_0x1c2e('0xa'));var FreshdeskAccount=require(_0x1c2e('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x1c2e('0xc'));var DeskAccount=require(_0x1c2e('0xd'));var VtigerAccount=require(_0x1c2e('0xe'));var ServicenowAccount=require(_0x1c2e('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x1c2e('0x10'));var FaxAccount=require(_0x1c2e('0x11'));var Realtime=function(){this[_0x1c2e('0x12')]={};this['telephones']={};this['trunks']={};this[_0x1c2e('0x13')]={};this[_0x1c2e('0x14')]={};this['campaigns']={};this['templates']={};this[_0x1c2e('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x1c2e('0x16')]={};this['channels']={};this[_0x1c2e('0x17')]={};this[_0x1c2e('0x18')]={};this[_0x1c2e('0x19')]={};this[_0x1c2e('0x1a')]={};this[_0x1c2e('0x1b')]={};this['sugarcrmAccounts']={};this[_0x1c2e('0x1c')]={};this[_0x1c2e('0x1d')]={};this[_0x1c2e('0x1e')]={};this[_0x1c2e('0x1f')]={};this['servicenowAccounts']={};this[_0x1c2e('0x20')]={};this[_0x1c2e('0x21')]={};this[_0x1c2e('0x22')]={};};function freeIsNotKey(_0x50c5f6,_0x2eed9a,_0x5e24d5){var _0x50387c=_[_0x1c2e('0x23')](_0x50c5f6,function(_0xb02ae,_0x5556c2){return _0xb02ae[_0x5e24d5];});for(var _0x3f10f3 in _0x2eed9a){if(_0x2eed9a[_0x1c2e('0x24')](_0x3f10f3)){if(!_0x50387c[_0x3f10f3]){delete _0x2eed9a[_0x3f10f3];}}}}function freeIsNotKeySip(_0x351ba4,_0x7ab833){var _0x178d7b=_[_0x1c2e('0x23')](_0x351ba4,function(_0x26d7b6,_0x5428bf){return util['format']('SIP/%s',_0x26d7b6[_0x1c2e('0x25')]);});for(var _0x431a6a in _0x7ab833){if(_0x7ab833['hasOwnProperty'](_0x431a6a)){if(!_0x178d7b[_0x431a6a]){delete _0x7ab833[_0x431a6a];}}}}function freeIsNotKeyAgent(_0x2dd3f3,_0x2f0b02){var _0x18d3dc=_['mapKeys'](_0x2dd3f3,function(_0x3a14b2,_0x35de4c){var _0x51a151=_[_0x1c2e('0x26')](_0x3a14b2['interface'])?util[_0x1c2e('0x27')]('SIP/%s',_0x3a14b2['name']):_0x3a14b2[_0x1c2e('0x28')];return _0x51a151;});for(var _0x28e179 in _0x2f0b02){if(_0x2f0b02[_0x1c2e('0x24')](_0x28e179)){if(!_0x18d3dc[_0x28e179]){delete _0x2f0b02[_0x28e179];}}}}function clearVoiceCallReports(_0x168d1e){_0x168d1e[_0x1c2e('0x29')]=0x0;_0x168d1e[_0x1c2e('0x2a')]=0x0;_0x168d1e[_0x1c2e('0x2b')]=0x0;_0x168d1e[_0x1c2e('0x2c')]=0x0;_0x168d1e['sumBillable']=0x0;}function clearCampaigns(_0x4d7e76){if(!_['isEmpty'](_0x4d7e76)){for(var _0x227e56 in _0x4d7e76){if(_0x4d7e76[_0x1c2e('0x24')](_0x227e56)){_0x4d7e76[_0x227e56]['ivrTotalCallsDays']=0x0;_0x4d7e76[_0x227e56][_0x1c2e('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x16676e){if(!_[_0x1c2e('0x2e')](_0x16676e)){for(var _0x516a92 in _0x16676e){if(_0x16676e[_0x1c2e('0x24')](_0x516a92)){_0x16676e[_0x516a92][_0x1c2e('0x29')]=0x0;_0x16676e[_0x516a92][_0x1c2e('0x2a')]=0x0;_0x16676e[_0x516a92][_0x1c2e('0x2f')]=0x0;_0x16676e[_0x516a92]['abandoned']=0x0;_0x16676e[_0x516a92][_0x1c2e('0x2b')]=0x0;_0x16676e[_0x516a92]['sumDuration']=0x0;_0x16676e[_0x516a92]['sumBillable']=0x0;_0x16676e[_0x516a92][_0x1c2e('0x30')]=0x0;_0x16676e[_0x516a92][_0x1c2e('0x31')]=0x0;_0x16676e[_0x516a92]['outboundBusyCallsDay']=0x0;_0x16676e[_0x516a92]['outboundCongestionCallsDay']=0x0;_0x16676e[_0x516a92][_0x1c2e('0x32')]=0x0;_0x16676e[_0x516a92][_0x1c2e('0x33')]=0x0;_0x16676e[_0x516a92][_0x1c2e('0x34')]=0x0;_0x16676e[_0x516a92][_0x1c2e('0x35')]=0x0;_0x16676e[_0x516a92]['outboundBlacklistCallsDay']=0x0;_0x16676e[_0x516a92][_0x1c2e('0x36')]=0x0;_0x16676e[_0x516a92][_0x1c2e('0x37')]=0x0;_0x16676e[_0x516a92]['outboundReCallsDay']=0x0;_0x16676e[_0x516a92][_0x1c2e('0x30')]=0x0;_0x16676e[_0x516a92][_0x1c2e('0x38')]=0x0;_0x16676e[_0x516a92][_0x1c2e('0x39')]=!![];}}}}Realtime['prototype'][_0x1c2e('0x3a')]=function(_0x388970,_0x10527c){for(var _0x1558ee in _0x10527c){if(_0x388970[_0x1c2e('0x24')](_0x1558ee)){_0x388970[_0x1558ee]=_0x10527c[_0x1558ee];}}};Realtime[_0x1c2e('0x3b')][_0x1c2e('0x3c')]=function(){var _0x37ccea=this;return function(_0x46b0aa){if(_0x46b0aa){freeIsNotKeyAgent(_0x46b0aa,_0x37ccea['agents']);for(var _0x18af52=0x0,_0x389bd0={},_0x11e1d5={};_0x18af52<_0x46b0aa[_0x1c2e('0x3d')];_0x18af52+=0x1){_0x389bd0=_0x46b0aa[_0x18af52];var _0xe95149=_[_0x1c2e('0x26')](_0x389bd0[_0x1c2e('0x28')])?util[_0x1c2e('0x27')](_0x1c2e('0x3e'),_0x389bd0['name']):_0x389bd0[_0x1c2e('0x28')];if(_[_0x1c2e('0x3f')](_0x37ccea[_0x1c2e('0x12')][_0xe95149])){_0x37ccea[_0x1c2e('0x12')][_0xe95149]=new Agent(_0x389bd0);}else{_0x37ccea['mergeFromDatabase'](_0x37ccea[_0x1c2e('0x12')][_0xe95149],_0x389bd0);}}}return _0x37ccea[_0x1c2e('0x12')];};};Realtime[_0x1c2e('0x3b')][_0x1c2e('0x40')]=function(){var _0x2bc191=this;return function(_0x26a0c7){if(_0x26a0c7){freeIsNotKeySip(_0x26a0c7,_0x2bc191[_0x1c2e('0x41')]);for(var _0x3bc6f7=0x0,_0x9a12e8={},_0x50c90b={};_0x3bc6f7<_0x26a0c7[_0x1c2e('0x3d')];_0x3bc6f7+=0x1){_0x9a12e8=_0x26a0c7[_0x3bc6f7];if(_[_0x1c2e('0x3f')](_0x2bc191[_0x1c2e('0x41')][util[_0x1c2e('0x27')](_0x1c2e('0x3e'),_0x9a12e8[_0x1c2e('0x25')])])){_0x2bc191['telephones'][util[_0x1c2e('0x27')](_0x1c2e('0x3e'),_0x9a12e8[_0x1c2e('0x25')])]=new Telephone(_0x9a12e8);}else{_0x2bc191['mergeFromDatabase'](_0x2bc191[_0x1c2e('0x41')][util['format'](_0x1c2e('0x3e'),_0x9a12e8[_0x1c2e('0x25')])],_0x9a12e8);}}}return _0x2bc191['telephones'];};};Realtime['prototype']['initTrunks']=function(){var _0xd66186=this;return function(_0x3f2a95){if(_0x3f2a95){freeIsNotKeySip(_0x3f2a95,_0xd66186[_0x1c2e('0x42')]);for(var _0x1464fa=0x0,_0x279b8f={},_0x1a0177={};_0x1464fa<_0x3f2a95[_0x1c2e('0x3d')];_0x1464fa+=0x1){_0x279b8f=_0x3f2a95[_0x1464fa];if(_[_0x1c2e('0x3f')](_0xd66186['trunks'][util[_0x1c2e('0x27')](_0x1c2e('0x3e'),_0x279b8f[_0x1c2e('0x25')])])){_0xd66186[_0x1c2e('0x42')][util[_0x1c2e('0x27')](_0x1c2e('0x3e'),_0x279b8f[_0x1c2e('0x25')])]=new Trunk(_0x279b8f);}else{_0xd66186[_0x1c2e('0x3a')](_0xd66186[_0x1c2e('0x42')][util['format'](_0x1c2e('0x3e'),_0x279b8f[_0x1c2e('0x25')])],_0x279b8f);}}}return _0xd66186[_0x1c2e('0x42')];};};Realtime[_0x1c2e('0x3b')][_0x1c2e('0x43')]=function(){var _0x530fa5=this;return function(_0xae3d50){if(_0xae3d50){freeIsNotKey(_0xae3d50,_0x530fa5[_0x1c2e('0x13')],_0x1c2e('0x25'));for(var _0x24d754=0x0,_0x8a99e9={},_0x25f406={};_0x24d754<_0xae3d50[_0x1c2e('0x3d')];_0x24d754+=0x1){_0x8a99e9=_0xae3d50[_0x24d754];if(_[_0x1c2e('0x3f')](_0x530fa5[_0x1c2e('0x13')][_0x8a99e9[_0x1c2e('0x25')]])){_0x530fa5[_0x1c2e('0x13')][_0x8a99e9['name']]=new VoiceQueue(_0x8a99e9);}else{_0x530fa5[_0x1c2e('0x3a')](_0x530fa5[_0x1c2e('0x13')][_0x8a99e9[_0x1c2e('0x25')]],_0x8a99e9);}}}return _0x530fa5['voiceQueues'];};};Realtime['prototype']['initTriggers']=function(){var _0xfbf6a2=this;return function(_0x5e85ae){if(_0x5e85ae){freeIsNotKey(_0x5e85ae,_0xfbf6a2[_0x1c2e('0x14')],'id');for(var _0x44ffa2=0x0,_0x1e7c01={},_0x198852={};_0x44ffa2<_0x5e85ae[_0x1c2e('0x3d')];_0x44ffa2+=0x1){_0x1e7c01=_0x5e85ae[_0x44ffa2];if(_[_0x1c2e('0x3f')](_0xfbf6a2['triggers'][_0x1e7c01['id']])){_0xfbf6a2[_0x1c2e('0x14')][_0x1e7c01['id']]=new Trigger(_0x1e7c01);}else{_0xfbf6a2['mergeFromDatabase'](_0xfbf6a2[_0x1c2e('0x14')][_0x1e7c01['id']],_0x1e7c01);}}}return _0xfbf6a2[_0x1c2e('0x14')];};};Realtime['prototype'][_0x1c2e('0x44')]=function(){var _0x43a2bb=this;return function(_0x99e287){if(_0x99e287){freeIsNotKey(_0x99e287,_0x43a2bb['templates'],'id');for(var _0x4dc7f7=0x0,_0x24cb2e={},_0x3e3a21={};_0x4dc7f7<_0x99e287[_0x1c2e('0x3d')];_0x4dc7f7+=0x1){_0x24cb2e=_0x99e287[_0x4dc7f7];if(_['isUndefined'](_0x43a2bb[_0x1c2e('0x45')][_0x24cb2e['id']])){_0x43a2bb[_0x1c2e('0x45')][_0x24cb2e['id']]=new Template(_0x24cb2e);}else{_0x43a2bb['mergeFromDatabase'](_0x43a2bb[_0x1c2e('0x45')][_0x24cb2e['id']],_0x24cb2e);}}}return _0x43a2bb[_0x1c2e('0x45')];};};Realtime[_0x1c2e('0x3b')][_0x1c2e('0x46')]=function(){var _0x1408d3=this;return function(_0x548f2b){if(_0x548f2b){freeIsNotKey(_0x548f2b,_0x1408d3[_0x1c2e('0x1a')],'id');for(var _0xe035f5=0x0,_0x38572c={},_0x14ea95={};_0xe035f5<_0x548f2b[_0x1c2e('0x3d')];_0xe035f5+=0x1){_0x38572c=_0x548f2b[_0xe035f5];if(_[_0x1c2e('0x3f')](_0x1408d3[_0x1c2e('0x1a')][_0x38572c['id']])){_0x1408d3[_0x1c2e('0x1a')][_0x38572c['id']]=new ZendeskAccount(_0x38572c);}else{_0x1408d3[_0x1c2e('0x3a')](_0x1408d3[_0x1c2e('0x1a')][_0x38572c['id']],_0x38572c);}}}return _0x1408d3[_0x1c2e('0x1a')];};};Realtime[_0x1c2e('0x3b')]['initSalesforceAccounts']=function(){var _0x45473d=this;return function(_0x50e4f5){if(_0x50e4f5){freeIsNotKey(_0x50e4f5,_0x45473d[_0x1c2e('0x1b')],'id');for(var _0x538d5f=0x0,_0x5483a9={},_0x5ec2d4={};_0x538d5f<_0x50e4f5[_0x1c2e('0x3d')];_0x538d5f+=0x1){_0x5483a9=_0x50e4f5[_0x538d5f];if(_[_0x1c2e('0x3f')](_0x45473d[_0x1c2e('0x1b')][_0x5483a9['id']])){_0x45473d['salesforceAccounts'][_0x5483a9['id']]=new SalesforceAccount(_0x5483a9);}else{_0x45473d['mergeFromDatabase'](_0x45473d['salesforceAccounts'][_0x5483a9['id']],_0x5483a9);}}}return _0x45473d[_0x1c2e('0x1b')];};};Realtime[_0x1c2e('0x3b')][_0x1c2e('0x47')]=function(){var _0x1cef93=this;return function(_0x5911e0){if(_0x5911e0){freeIsNotKey(_0x5911e0,_0x1cef93['freshdeskAccounts'],'id');for(var _0x416e4e=0x0,_0x382a15={},_0x1bdc9f={};_0x416e4e<_0x5911e0[_0x1c2e('0x3d')];_0x416e4e+=0x1){_0x382a15=_0x5911e0[_0x416e4e];if(_[_0x1c2e('0x3f')](_0x1cef93[_0x1c2e('0x1c')][_0x382a15['id']])){_0x1cef93[_0x1c2e('0x1c')][_0x382a15['id']]=new FreshdeskAccount(_0x382a15);}else{_0x1cef93['mergeFromDatabase'](_0x1cef93[_0x1c2e('0x1c')][_0x382a15['id']],_0x382a15);}}}return _0x1cef93[_0x1c2e('0x1c')];};};Realtime[_0x1c2e('0x3b')]['initZohoAccounts']=function(){var _0x3983b8=this;return function(_0x35c2e7){if(_0x35c2e7){freeIsNotKey(_0x35c2e7,_0x3983b8[_0x1c2e('0x1d')],'id');for(var _0x2a9374=0x0,_0x4a72e3={},_0x4307d7={};_0x2a9374<_0x35c2e7[_0x1c2e('0x3d')];_0x2a9374+=0x1){_0x4a72e3=_0x35c2e7[_0x2a9374];if(_['isUndefined'](_0x3983b8['zohoAccounts'][_0x4a72e3['id']])){_0x3983b8[_0x1c2e('0x1d')][_0x4a72e3['id']]=new ZohoAccount(_0x4a72e3);}else{_0x3983b8['mergeFromDatabase'](_0x3983b8[_0x1c2e('0x1d')][_0x4a72e3['id']],_0x4a72e3);}}}return _0x3983b8['zohoAccounts'];};};Realtime[_0x1c2e('0x3b')]['initDeskAccounts']=function(){var _0x5e4947=this;return function(_0x8738f7){if(_0x8738f7){freeIsNotKey(_0x8738f7,_0x5e4947['deskAccounts'],'id');for(var _0x1aa740=0x0,_0xf5279b={},_0x16c6d9={};_0x1aa740<_0x8738f7[_0x1c2e('0x3d')];_0x1aa740+=0x1){_0xf5279b=_0x8738f7[_0x1aa740];if(_[_0x1c2e('0x3f')](_0x5e4947['deskAccounts'][_0xf5279b['id']])){_0x5e4947['deskAccounts'][_0xf5279b['id']]=new DeskAccount(_0xf5279b);}else{_0x5e4947[_0x1c2e('0x3a')](_0x5e4947['deskAccounts'][_0xf5279b['id']],_0xf5279b);}}}return _0x5e4947['deskAccounts'];};};Realtime[_0x1c2e('0x3b')]['initSugarcrmAccounts']=function(){var _0x28f917=this;return function(_0x45c7f9){if(_0x45c7f9){freeIsNotKey(_0x45c7f9,_0x28f917[_0x1c2e('0x48')],'id');for(var _0xd1bc8=0x0,_0x41b863={},_0xd36e4d={};_0xd1bc8<_0x45c7f9[_0x1c2e('0x3d')];_0xd1bc8+=0x1){_0x41b863=_0x45c7f9[_0xd1bc8];if(_[_0x1c2e('0x3f')](_0x28f917[_0x1c2e('0x48')][_0x41b863['id']])){_0x28f917[_0x1c2e('0x48')][_0x41b863['id']]=new SugarcrmAccount(_0x41b863);}else{_0x28f917[_0x1c2e('0x3a')](_0x28f917[_0x1c2e('0x48')][_0x41b863['id']],_0x41b863);}}}return _0x28f917[_0x1c2e('0x48')];};};Realtime['prototype'][_0x1c2e('0x49')]=function(){var _0xfe5198=this;return function(_0xb8873c){if(_0xb8873c){freeIsNotKey(_0xb8873c,_0xfe5198['vtigerAccounts'],'id');for(var _0xde7741=0x0,_0x289ded={},_0xfc758d={};_0xde7741<_0xb8873c['length'];_0xde7741+=0x1){_0x289ded=_0xb8873c[_0xde7741];if(_[_0x1c2e('0x3f')](_0xfe5198['vtigerAccounts'][_0x289ded['id']])){_0xfe5198[_0x1c2e('0x1f')][_0x289ded['id']]=new VtigerAccount(_0x289ded);}else{_0xfe5198[_0x1c2e('0x3a')](_0xfe5198[_0x1c2e('0x1f')][_0x289ded['id']],_0x289ded);}}}return _0xfe5198[_0x1c2e('0x1f')];};};Realtime['prototype'][_0x1c2e('0x4a')]=function(){var _0x3e10b4=this;return function(_0x152eaf){if(_0x152eaf){freeIsNotKey(_0x152eaf,_0x3e10b4[_0x1c2e('0x4b')],'id');for(var _0xc3338b=0x0,_0x83fa97={},_0x36233f={};_0xc3338b<_0x152eaf[_0x1c2e('0x3d')];_0xc3338b+=0x1){_0x83fa97=_0x152eaf[_0xc3338b];if(_[_0x1c2e('0x3f')](_0x3e10b4[_0x1c2e('0x4b')][_0x83fa97['id']])){_0x3e10b4[_0x1c2e('0x4b')][_0x83fa97['id']]=new ServicenowAccount(_0x83fa97);}else{_0x3e10b4[_0x1c2e('0x3a')](_0x3e10b4[_0x1c2e('0x4b')][_0x83fa97['id']],_0x83fa97);}}}return _0x3e10b4[_0x1c2e('0x4b')];};};Realtime[_0x1c2e('0x3b')][_0x1c2e('0x4c')]=function(){var _0xe96926=this;return function(_0x13e915){if(_0x13e915){freeIsNotKey(_0x13e915,_0xe96926['dynamics365Accounts'],'id');for(var _0x45b60b=0x0,_0x449c6e={},_0x35b1be={};_0x45b60b<_0x13e915[_0x1c2e('0x3d')];_0x45b60b+=0x1){_0x449c6e=_0x13e915[_0x45b60b];if(_[_0x1c2e('0x3f')](_0xe96926[_0x1c2e('0x20')][_0x449c6e['id']])){_0xe96926[_0x1c2e('0x20')][_0x449c6e['id']]=new Dynamics365Account(_0x449c6e);}else{_0xe96926[_0x1c2e('0x3a')](_0xe96926[_0x1c2e('0x20')][_0x449c6e['id']],_0x449c6e);}}}return _0xe96926[_0x1c2e('0x20')];};};Realtime[_0x1c2e('0x3b')][_0x1c2e('0x4d')]=function(){var _0xed143a=this;return function(_0x2a1057){if(_0x2a1057){freeIsNotKey(_0x2a1057,_0xed143a['freshsalesAccounts'],'id');for(var _0x32bf35=0x0,_0x33e2e6={},_0x4af668={};_0x32bf35<_0x2a1057[_0x1c2e('0x3d')];_0x32bf35+=0x1){_0x33e2e6=_0x2a1057[_0x32bf35];if(_[_0x1c2e('0x3f')](_0xed143a[_0x1c2e('0x21')][_0x33e2e6['id']])){_0xed143a[_0x1c2e('0x21')][_0x33e2e6['id']]=new FreshsalesAccount(_0x33e2e6);}else{_0xed143a['mergeFromDatabase'](_0xed143a['freshsalesAccounts'][_0x33e2e6['id']],_0x33e2e6);}}}return _0xed143a[_0x1c2e('0x21')];};};Realtime[_0x1c2e('0x3b')]['initVoiceQueueHopperHistory']=function(){var _0x2e2047=this;return function(_0x42e00a){for(var _0x50bde7=0x0;_0x50bde7<_0x42e00a[_0x1c2e('0x3d')];_0x50bde7+=0x1){_[_0x1c2e('0x4e')](_0x2e2047[_0x1c2e('0x13')][_0x42e00a[_0x50bde7][_0x1c2e('0x25')]],_0x42e00a[_0x50bde7]);}return _0x2e2047[_0x1c2e('0x13')];};};Realtime[_0x1c2e('0x3b')][_0x1c2e('0x4f')]=function(){var _0x5ac846=this;return function(_0x211954){clearVoiceQueues(_0x5ac846['voiceQueues']);if(_0x211954){_0x211954=_[_0x1c2e('0x50')](_0x211954,_0x1c2e('0x51'));for(var _0x3edb8a in _0x211954){if(_0x211954['hasOwnProperty'](_0x3edb8a)){var _0x1263f2={};for(var _0x1871d7=0x0;_0x1871d7<_0x211954[_0x3edb8a][_0x1c2e('0x3d')];_0x1871d7+=0x1){var _0x40d736=_0x211954[_0x3edb8a][_0x1871d7][_0x1c2e('0x52')];if(_0x5ac846[_0x1c2e('0x13')][_0x40d736]){if(_0x211954[_0x3edb8a][_0x1871d7][_0x1c2e('0x53')]){_0x5ac846['voiceQueues'][_0x40d736][_0x1c2e('0x2f')]+=0x1;}if(_0x211954[_0x3edb8a][_0x1871d7][_0x1c2e('0x54')]){_0x5ac846['voiceQueues'][_0x40d736][_0x1c2e('0x55')]+=0x1;}_0x5ac846['voiceQueues'][_0x40d736][_0x1c2e('0x2b')]+=moment(_0x211954[_0x3edb8a][_0x1871d7][_0x1c2e('0x56')])[_0x1c2e('0x57')](moment(_0x211954[_0x3edb8a][_0x1871d7][_0x1c2e('0x58')]),_0x1c2e('0x59'))||0x0;if(_0x1871d7===_0x211954[_0x3edb8a][_0x1c2e('0x3d')]-0x1){_0x5ac846['voiceQueues'][_0x40d736][_0x1c2e('0x2c')]+=moment(_0x211954[_0x3edb8a][_0x1871d7][_0x1c2e('0x5a')]||_0x211954[_0x3edb8a][_0x1871d7]['queuecallerabandonAt']||_0x211954[_0x3edb8a][_0x1871d7][_0x1c2e('0x5b')])[_0x1c2e('0x57')](moment(_0x211954[_0x3edb8a][_0x1871d7][_0x1c2e('0x58')]),'seconds')||0x0;_0x5ac846[_0x1c2e('0x13')][_0x40d736][_0x1c2e('0x29')]+=0x1;if(_0x211954[_0x3edb8a][_0x1871d7][_0x1c2e('0x5c')]){_0x5ac846[_0x1c2e('0x13')][_0x40d736][_0x1c2e('0x2a')]+=0x1;_0x5ac846[_0x1c2e('0x13')][_0x40d736]['sumBillable']+=moment(_0x211954[_0x3edb8a][_0x1871d7][_0x1c2e('0x5a')])[_0x1c2e('0x57')](moment(_0x211954[_0x3edb8a][_0x1871d7][_0x1c2e('0x56')]),'seconds')||0x0;}}else{_0x5ac846[_0x1c2e('0x13')][_0x40d736][_0x1c2e('0x2c')]+=_0x5ac846[_0x1c2e('0x13')][_0x40d736][_0x1c2e('0x2b')]||0x0;}}}}}}return _0x5ac846['voiceQueues'];};};Realtime[_0x1c2e('0x3b')][_0x1c2e('0x5d')]=function(){var _0x289a75=this;return function(_0x4077ca){clearVoiceCallReports(_0x289a75[_0x1c2e('0x15')]);if(_0x4077ca){for(var _0x31816a=0x0;_0x31816a<_0x4077ca['length'];_0x31816a+=0x1){_0x289a75['outbound']['total']+=0x1;_0x289a75[_0x1c2e('0x15')]['sumDuration']+=_0x4077ca[_0x31816a][_0x1c2e('0x5e')];if(_0x4077ca[_0x31816a][_0x1c2e('0x5f')]===_0x1c2e('0x60')){_0x289a75[_0x1c2e('0x15')][_0x1c2e('0x2a')]+=0x1;_0x289a75[_0x1c2e('0x15')]['sumHoldTime']+=_0x4077ca[_0x31816a][_0x1c2e('0x5e')]-_0x4077ca[_0x31816a][_0x1c2e('0x61')]||0x0;_0x289a75[_0x1c2e('0x15')][_0x1c2e('0x62')]+=_0x4077ca[_0x31816a][_0x1c2e('0x61')];}}}return _0x289a75['outbound'];};};Realtime[_0x1c2e('0x3b')][_0x1c2e('0x63')]=function(){var _0x2be73a=this;return function(_0x1c57a3){if(_0x1c57a3){freeIsNotKey(_0x1c57a3,_0x2be73a['campaigns'],_0x1c2e('0x25'));for(var _0x22c2f8=0x0,_0x279165={};_0x22c2f8<_0x1c57a3[_0x1c2e('0x3d')];_0x22c2f8+=0x1){_0x279165=_0x1c57a3[_0x22c2f8];if(_['isUndefined'](_0x2be73a[_0x1c2e('0x64')][_0x279165['name']])){_0x2be73a[_0x1c2e('0x64')][_0x279165['name']]=new Campaign(_0x279165);}else{_0x2be73a['mergeFromDatabase'](_0x2be73a[_0x1c2e('0x64')][_0x279165[_0x1c2e('0x25')]],_0x279165);_0x2be73a[_0x1c2e('0x64')][_0x279165[_0x1c2e('0x25')]][_0x1c2e('0x65')]=_0x279165[_0x1c2e('0x66')]?_0x279165['SquareProject'][_0x1c2e('0x25')]:undefined;}}}return _0x2be73a[_0x1c2e('0x64')];};};Realtime[_0x1c2e('0x3b')][_0x1c2e('0x67')]=function(){var _0x1eeb99=this;return function(_0xc34c4){if(_0xc34c4){freeIsNotKey(_0xc34c4,_0x1eeb99[_0x1c2e('0x16')],'id');for(var _0x133d9e=0x0,_0x32393f={};_0x133d9e<_0xc34c4[_0x1c2e('0x3d')];_0x133d9e+=0x1){_0x32393f=_0xc34c4[_0x133d9e];if(_[_0x1c2e('0x3f')](_0x1eeb99['voiceExtensions'][_0x32393f['id']])){_0x1eeb99[_0x1c2e('0x16')][_0x32393f['id']]=new VoiceExtension(_0x32393f);}else{_0x1eeb99[_0x1c2e('0x3a')](_0x1eeb99[_0x1c2e('0x16')][_0x32393f['id']],_0x32393f);}}}return _0x1eeb99[_0x1c2e('0x16')];};};Realtime['prototype'][_0x1c2e('0x68')]=function(){var _0x3a8349=this;return function(_0x143b7a){clearCampaigns(_0x3a8349[_0x1c2e('0x64')]);for(var _0xd7651c=0x0;_0xd7651c<_0x143b7a['length'];_0xd7651c+=0x1){_[_0x1c2e('0x4e')](_0x3a8349[_0x1c2e('0x64')][_0x143b7a[_0xd7651c][_0x1c2e('0x25')]],_0x143b7a[_0xd7651c]);}return _0x3a8349[_0x1c2e('0x64')];};};Realtime[_0x1c2e('0x3b')][_0x1c2e('0x69')]=function(){var _0x25aeb2=this;return function(_0x3cb658){if(_0x3cb658){freeIsNotKey(_0x3cb658,_0x25aeb2[_0x1c2e('0x22')],'id');for(var _0x142d76=0x0,_0x3bf59a={},_0x4d4524={};_0x142d76<_0x3cb658[_0x1c2e('0x3d')];_0x142d76+=0x1){_0x3bf59a=_0x3cb658[_0x142d76];if(_[_0x1c2e('0x3f')](_0x25aeb2['faxAccounts'][_0x3bf59a['id']])){_0x25aeb2['faxAccounts'][_0x3bf59a['id']]=new FaxAccount(_0x3bf59a);}else{_0x25aeb2[_0x1c2e('0x3a')](_0x25aeb2[_0x1c2e('0x22')][_0x3bf59a['id']],_0x3bf59a);}}}return _0x25aeb2[_0x1c2e('0x22')];};};module[_0x1c2e('0x6a')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 5dcaf3b..04996cb 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 _0x778f=['calleridpreview','originatecalleridnum','destinationchannel','channel','calleridnum','disposition','ANSWERED','calleridname','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','isArray','forEach','substring','indexOf','mobile','lastIndexOf','membername','exports','bluebird','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','interface','SIP/%s','voiceQueueReport','length','connectedlinenum','assigned','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','destination','exten','type','dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip'];(function(_0x643f45,_0x4e8799){var _0x743ccd=function(_0x1da4e5){while(--_0x1da4e5){_0x643f45['push'](_0x643f45['shift']());}};_0x743ccd(++_0x4e8799);}(_0x778f,0x117));var _0xf778=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x778f[_0x24f31b];return _0x488401;};'use strict';var BPromise=require(_0xf778('0x0'));var _=require('lodash');var moment=require(_0xf778('0x1'));var util=require(_0xf778('0x2'));var config=require(_0xf778('0x3'));var logger=require(_0xf778('0x4'))(_0xf778('0x5'));var ami=require(_0xf778('0x6'));var RpcVoiceAgentReport=require(_0xf778('0x7'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xf778('0x8'));var RpcVoiceQueueReport=require(_0xf778('0x9'));var RpcVoiceRecording=require(_0xf778('0xa'));var RpcVoiceTransferReport=require(_0xf778('0xb'));var VoiceQueueReport=require(_0xf778('0xc'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xf778('0xd'));var UserReport=require(_0xf778('0xe'));function Report(_0x40e253){this[_0xf778('0xf')]=_0x40e253;this['agents']=_0x40e253[_0xf778('0x10')];this[_0xf778('0x11')]=_0x40e253[_0xf778('0x11')];}Report[_0xf778('0x12')][_0xf778('0x13')]=function(_0x483cf2){var _0x135b32=new VoiceQueueReport(this[_0xf778('0xf')]);var _0x3ab6c9=new VoiceAgentReport(this[_0xf778('0xf')]);var _0x183f35=new VoiceDialReport(this[_0xf778('0xf')]);var _0x21bbdb=new VoiceCallReport(this['realtime']);var _0x2a1f95=new UserReport(this['realtime']);if(config['xdr']&&config[_0xf778('0x14')][_0xf778('0x15')]){ami['on'](_0xf778('0x16'),this['voiceQueueReport'][_0xf778('0x17')](this));ami['on'](_0xf778('0x18'),this[_0xf778('0x19')][_0xf778('0x17')](this));ami['on'](_0xf778('0x1a'),this[_0xf778('0x1b')][_0xf778('0x17')](this));ami['on'](_0xf778('0x1c'),this[_0xf778('0x1d')][_0xf778('0x17')](this));ami['on']('blindtransfer',this[_0xf778('0x1e')][_0xf778('0x17')](this));ami['on']('attendedtransfer',this[_0xf778('0x1f')]['bind'](this));}};Report[_0xf778('0x12')][_0xf778('0x20')]=function(_0x55eeb4){var _0x1e7179=undefined;_0x1e7179=_[_0xf778('0x21')](this['agents'],function(_0x2be50b){return _0x2be50b['accountcode']==_0x55eeb4||_0x2be50b[_0xf778('0x22')]==_0x55eeb4;});if(_[_0xf778('0x23')](_0x1e7179)){var _0x1ff1d3=_['find'](this[_0xf778('0x11')],function(_0x428497){return _0x428497[_0xf778('0x24')]==_0x55eeb4||_0x428497['name']==_0x55eeb4;});if(_0x1ff1d3){_0x1e7179=_[_0xf778('0x21')](this[_0xf778('0x10')],function(_0x902abb){return _0x902abb[_0xf778('0x25')]==util['format'](_0xf778('0x26'),_0x1ff1d3['name']);});}}return _0x1e7179;};Report[_0xf778('0x12')][_0xf778('0x27')]=function(_0x4019ac){for(var _0x5226a5=0x0;_0x5226a5<_0x4019ac[_0xf778('0x28')];_0x5226a5+=0x1){var _0x45b45f=this[_0xf778('0x20')](_0x4019ac[_0x5226a5][_0xf778('0x29')]);if(_0x45b45f){_0x4019ac[_0x5226a5][_0xf778('0x24')]=_0x45b45f[_0xf778('0x24')];_0x4019ac[_0x5226a5][_0xf778('0x2a')]=!![];_0x4019ac[_0x5226a5][_0xf778('0x2b')]=_0x45b45f['name'];_0x4019ac[_0x5226a5][_0xf778('0x25')]=_[_0xf778('0x23')](_0x45b45f[_0xf778('0x25')])?util[_0xf778('0x2c')](_0xf778('0x26'),_0x45b45f[_0xf778('0x22')]):_0x45b45f[_0xf778('0x25')];if(_0x4019ac[_0x5226a5][_0xf778('0x2d')]){_0x4019ac[_0x5226a5][_0xf778('0x2e')]=moment()[_0xf778('0x2c')](_0xf778('0x2f'));}if(_0x4019ac[_0x5226a5][_0xf778('0x30')]){_0x4019ac[_0x5226a5][_0xf778('0x31')]=moment()[_0xf778('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xf778('0x27')](_0x4019ac[_0x5226a5]);}RpcVoiceQueueReport[_0xf778('0x32')](_0x4019ac[_0x5226a5]);}};function extractCalleridNumber(_0x21c5bc){var _0x5d3f0b=_0x21c5bc['match'](/<(.*?)>/);return _0x5d3f0b?_0x5d3f0b[0x1]:_0x21c5bc;}Report[_0xf778('0x12')][_0xf778('0x19')]=function(_0x243a49){_0x243a49['destination']=_0x243a49[_0xf778('0x33')]||_0x243a49[_0xf778('0x34')];if(_0x243a49[_0xf778('0x35')]==_0xf778('0x36')){_0x243a49[_0xf778('0x37')]=_0xf778('0x38');_0x243a49['lastdata']=_0x243a49[_0xf778('0x38')];if(_0x243a49[_0xf778('0x39')]==_0xf778('0x3a')){_0x243a49[_0xf778('0x24')]='';_0x243a49[_0xf778('0x33')]=extractCalleridNumber(_0x243a49[_0xf778('0x3b')]);}else if(_0x243a49[_0xf778('0x39')]==_0xf778('0x3c')){if(_0x243a49[_0xf778('0x33')]=='xcally-motion-preview'){_0x243a49[_0xf778('0x33')]=extractCalleridNumber(_0x243a49[_0xf778('0x3d')]);_0x243a49['calleridnum']=_0x243a49[_0xf778('0x3e')];_0x243a49[_0xf778('0x3f')]=[_0x243a49['channel'],_0x243a49[_0xf778('0x40')]=_0x243a49[_0xf778('0x3f')]][0x0];_0x243a49[_0xf778('0x3b')]=_0x243a49[_0xf778('0x3d')];}else{_0x243a49[_0xf778('0x33')]=_0x243a49[_0xf778('0x41')];_0x243a49[_0xf778('0x41')]=_0x243a49[_0xf778('0x3e')];if(_0x243a49[_0xf778('0x42')]==_0xf778('0x43')){_0x243a49[_0xf778('0x24')]=_0x243a49[_0xf778('0x29')];}else{_0x243a49[_0xf778('0x24')]='';}}}}else{_0x243a49[_0xf778('0x3b')]=util[_0xf778('0x2c')]('\x22%s\x22\x20<%s>',_0x243a49[_0xf778('0x44')],_0x243a49[_0xf778('0x41')]);}RpcVoiceCallReport[_0xf778('0x32')](_0x243a49);if(_0x243a49[_0xf778('0x45')]){for(var _0x3ceaf7=0x0;_0x3ceaf7<_0x243a49[_0xf778('0x46')]['length'];_0x3ceaf7+=0x1){_0x243a49[_0xf778('0x47')]=_0x243a49[_0xf778('0x46')][_0x3ceaf7][_0xf778('0x48')];_0x243a49[_0xf778('0x49')]=_0x243a49[_0xf778('0x46')][_0x3ceaf7][_0xf778('0x49')];if(_0x243a49[_0xf778('0x34')]==_0xf778('0x4a')){_0x243a49['calleridnum']=_0x243a49[_0xf778('0x29')];_0x243a49[_0xf778('0x44')]=_0x243a49[_0xf778('0x4b')];_0x243a49[_0xf778('0x29')]=_0x243a49[_0xf778('0x24')];_0x243a49[_0xf778('0x4b')]=_0x243a49['membername'];_0x243a49[_0xf778('0x34')]=_0x243a49[_0xf778('0x3e')];}else if(_0x243a49['exten']==_0xf778('0x4c')){_0x243a49[_0xf778('0x41')]=_0x243a49[_0xf778('0x33')];_0x243a49[_0xf778('0x34')]=_0x243a49[_0xf778('0x3e')];}RpcVoiceRecording['create'](_0x243a49);}}};Report[_0xf778('0x12')][_0xf778('0x1b')]=function(_0x3f2aad){if(_[_0xf778('0x4d')](_0x3f2aad)){_0x3f2aad[_0xf778('0x4e')](function(_0x25fc54){RpcVoiceAgentReport[_0xf778('0x32')](_0x25fc54);});}else{RpcVoiceAgentReport[_0xf778('0x32')](_0x3f2aad);}};Report['prototype'][_0xf778('0x1d')]=function(_0x1bdd53){RpcVoiceDialReport[_0xf778('0x32')](_0x1bdd53);var _0xa8f258=undefined;var _0x4541ef=_0x1bdd53['channel'];if(_['startsWith'](_0x4541ef,'Local')){var _0x5b2a1d=_0x4541ef[_0xf778('0x4f')](_0x4541ef['indexOf']('/')+0x1,_0x4541ef[_0xf778('0x50')]('@'));_0xa8f258=_[_0xf778('0x21')](this[_0xf778('0x10')],function(_0x4ccd79){return _0x4ccd79[_0xf778('0x51')]==_0x5b2a1d||_0x4ccd79['phone']==_0x5b2a1d||_0x4ccd79[_0xf778('0x24')]==_0x5b2a1d;});}else{var _0x5b2a1d=_0x4541ef[_0xf778('0x4f')](_0x4541ef[_0xf778('0x50')]('/')+0x1,_0x4541ef[_0xf778('0x52')]('-'));_0xa8f258=this[_0xf778('0x20')](_0x5b2a1d);}if(_0xa8f258){_0x1bdd53[_0xf778('0x25')]=_[_0xf778('0x23')](_0xa8f258[_0xf778('0x25')])?util['format'](_0xf778('0x26'),_0xa8f258[_0xf778('0x22')]):_0xa8f258[_0xf778('0x25')];_0x1bdd53[_0xf778('0x53')]=_0xa8f258[_0xf778('0x22')];_0x1bdd53[_0xf778('0x24')]=_0xa8f258[_0xf778('0x24')];RpcMemberReport[_0xf778('0x1d')](_0x1bdd53);}};Report[_0xf778('0x12')][_0xf778('0x1e')]=function(_0x4b81e5){RpcVoiceTransferReport[_0xf778('0x1e')](_0x4b81e5);};Report[_0xf778('0x12')][_0xf778('0x1f')]=function(_0x134523){RpcVoiceTransferReport[_0xf778('0x1f')](_0x134523);};module[_0xf778('0x54')]=Report; \ No newline at end of file +var _0x351c=['destination','exten','type','dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','\x22%s\x22\x20<%s>','calleridname','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','blindTransfer','exports','bluebird','lodash','moment','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedTransfer','prototype','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','assigned','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create'];(function(_0xc4790,_0x13cc68){var _0x3256fe=function(_0x1cfaf5){while(--_0x1cfaf5){_0xc4790['push'](_0xc4790['shift']());}};_0x3256fe(++_0x13cc68);}(_0x351c,0x1c3));var _0xc351=function(_0x54dd08,_0x191aaf){_0x54dd08=_0x54dd08-0x0;var _0x2e9fcc=_0x351c[_0x54dd08];return _0x2e9fcc;};'use strict';var BPromise=require(_0xc351('0x0'));var _=require(_0xc351('0x1'));var moment=require(_0xc351('0x2'));var util=require('util');var config=require(_0xc351('0x3'));var logger=require(_0xc351('0x4'))(_0xc351('0x5'));var ami=require(_0xc351('0x6'));var RpcVoiceAgentReport=require(_0xc351('0x7'));var RpcVoiceCallReport=require(_0xc351('0x8'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xc351('0x9'));var RpcVoiceQueueReport=require(_0xc351('0xa'));var RpcVoiceRecording=require(_0xc351('0xb'));var RpcVoiceTransferReport=require(_0xc351('0xc'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xc351('0xd'));var VoiceDialReport=require(_0xc351('0xe'));var UserReport=require(_0xc351('0xf'));function Report(_0x5b9cca){this[_0xc351('0x10')]=_0x5b9cca;this['agents']=_0x5b9cca[_0xc351('0x11')];this[_0xc351('0x12')]=_0x5b9cca['telephones'];}Report['prototype'][_0xc351('0x13')]=function(_0x4c3940){var _0x26949a=new VoiceQueueReport(this['realtime']);var _0x1b0707=new VoiceAgentReport(this[_0xc351('0x10')]);var _0x57913b=new VoiceDialReport(this[_0xc351('0x10')]);var _0x538bc5=new VoiceCallReport(this['realtime']);var _0x552f83=new UserReport(this[_0xc351('0x10')]);if(config[_0xc351('0x14')]&&config['xdr'][_0xc351('0x15')]){ami['on'](_0xc351('0x16'),this[_0xc351('0x17')][_0xc351('0x18')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0xc351('0x18')](this));ami['on']('custom:voiceAgentReport',this[_0xc351('0x19')]['bind'](this));ami['on'](_0xc351('0x1a'),this[_0xc351('0x1b')][_0xc351('0x18')](this));ami['on'](_0xc351('0x1c'),this['blindTransfer']['bind'](this));ami['on']('attendedtransfer',this[_0xc351('0x1d')][_0xc351('0x18')](this));}};Report[_0xc351('0x1e')][_0xc351('0x1f')]=function(_0x19d58a){var _0x10e21d=undefined;_0x10e21d=_[_0xc351('0x20')](this['agents'],function(_0x4add96){return _0x4add96[_0xc351('0x21')]==_0x19d58a||_0x4add96[_0xc351('0x22')]==_0x19d58a;});if(_[_0xc351('0x23')](_0x10e21d)){var _0x486215=_[_0xc351('0x20')](this[_0xc351('0x12')],function(_0x5493c3){return _0x5493c3['accountcode']==_0x19d58a||_0x5493c3['name']==_0x19d58a;});if(_0x486215){_0x10e21d=_[_0xc351('0x20')](this['agents'],function(_0x1ac0ef){return _0x1ac0ef[_0xc351('0x24')]==util[_0xc351('0x25')](_0xc351('0x26'),_0x486215[_0xc351('0x22')]);});}}return _0x10e21d;};Report[_0xc351('0x1e')][_0xc351('0x17')]=function(_0x1d3885){for(var _0xd041e1=0x0;_0xd041e1<_0x1d3885[_0xc351('0x27')];_0xd041e1+=0x1){var _0xd63b55=this[_0xc351('0x1f')](_0x1d3885[_0xd041e1][_0xc351('0x28')]);if(_0xd63b55){_0x1d3885[_0xd041e1][_0xc351('0x21')]=_0xd63b55[_0xc351('0x21')];_0x1d3885[_0xd041e1][_0xc351('0x29')]=!![];_0x1d3885[_0xd041e1]['lastAssignedTo']=_0xd63b55[_0xc351('0x22')];_0x1d3885[_0xd041e1][_0xc351('0x24')]=_[_0xc351('0x23')](_0xd63b55['interface'])?util[_0xc351('0x25')](_0xc351('0x26'),_0xd63b55[_0xc351('0x22')]):_0xd63b55[_0xc351('0x24')];if(_0x1d3885[_0xd041e1][_0xc351('0x2a')]){_0x1d3885[_0xd041e1][_0xc351('0x2b')]=moment()[_0xc351('0x25')](_0xc351('0x2c'));}if(_0x1d3885[_0xd041e1][_0xc351('0x2d')]){_0x1d3885[_0xd041e1]['queuecallerexitAt']=moment()[_0xc351('0x25')](_0xc351('0x2c'));}RpcMemberReport['voiceQueueReport'](_0x1d3885[_0xd041e1]);}RpcVoiceQueueReport[_0xc351('0x2e')](_0x1d3885[_0xd041e1]);}};function extractCalleridNumber(_0x1c29e7){var _0x48a9ff=_0x1c29e7['match'](/<(.*?)>/);return _0x48a9ff?_0x48a9ff[0x1]:_0x1c29e7;}Report[_0xc351('0x1e')]['voiceCallReport']=function(_0x37ca22){_0x37ca22[_0xc351('0x2f')]=_0x37ca22[_0xc351('0x2f')]||_0x37ca22[_0xc351('0x30')];if(_0x37ca22[_0xc351('0x31')]==_0xc351('0x32')){_0x37ca22[_0xc351('0x33')]=_0xc351('0x34');_0x37ca22['lastdata']=_0x37ca22[_0xc351('0x34')];if(_0x37ca22[_0xc351('0x35')]==_0xc351('0x36')){_0x37ca22[_0xc351('0x21')]='';_0x37ca22[_0xc351('0x2f')]=extractCalleridNumber(_0x37ca22[_0xc351('0x37')]);}else if(_0x37ca22[_0xc351('0x35')]==_0xc351('0x38')){if(_0x37ca22[_0xc351('0x2f')]==_0xc351('0x39')){_0x37ca22[_0xc351('0x2f')]=extractCalleridNumber(_0x37ca22[_0xc351('0x3a')]);_0x37ca22[_0xc351('0x3b')]=_0x37ca22[_0xc351('0x3c')];_0x37ca22[_0xc351('0x3d')]=[_0x37ca22[_0xc351('0x3e')],_0x37ca22[_0xc351('0x3e')]=_0x37ca22[_0xc351('0x3d')]][0x0];_0x37ca22['callerid']=_0x37ca22[_0xc351('0x3a')];}else{_0x37ca22[_0xc351('0x2f')]=_0x37ca22[_0xc351('0x3b')];_0x37ca22[_0xc351('0x3b')]=_0x37ca22[_0xc351('0x3c')];if(_0x37ca22['disposition']=='ANSWERED'){_0x37ca22[_0xc351('0x21')]=_0x37ca22[_0xc351('0x28')];}else{_0x37ca22[_0xc351('0x21')]='';}}}}else{_0x37ca22[_0xc351('0x37')]=util[_0xc351('0x25')](_0xc351('0x3f'),_0x37ca22[_0xc351('0x40')],_0x37ca22[_0xc351('0x3b')]);}RpcVoiceCallReport['create'](_0x37ca22);if(_0x37ca22[_0xc351('0x41')]){for(var _0x380ddc=0x0;_0x380ddc<_0x37ca22[_0xc351('0x42')]['length'];_0x380ddc+=0x1){_0x37ca22[_0xc351('0x43')]=_0x37ca22[_0xc351('0x42')][_0x380ddc][_0xc351('0x44')];_0x37ca22[_0xc351('0x45')]=_0x37ca22['monitors'][_0x380ddc][_0xc351('0x45')];if(_0x37ca22['exten']==_0xc351('0x39')){_0x37ca22[_0xc351('0x3b')]=_0x37ca22[_0xc351('0x28')];_0x37ca22['calleridname']=_0x37ca22[_0xc351('0x46')];_0x37ca22[_0xc351('0x28')]=_0x37ca22['accountcode'];_0x37ca22[_0xc351('0x46')]=_0x37ca22[_0xc351('0x47')];_0x37ca22[_0xc351('0x30')]=_0x37ca22[_0xc351('0x3c')];}else if(_0x37ca22[_0xc351('0x30')]==_0xc351('0x48')){_0x37ca22[_0xc351('0x3b')]=_0x37ca22['destination'];_0x37ca22[_0xc351('0x30')]=_0x37ca22['originatecalleridnum'];}RpcVoiceRecording[_0xc351('0x2e')](_0x37ca22);}}};Report[_0xc351('0x1e')][_0xc351('0x19')]=function(_0x3ec61f){if(_[_0xc351('0x49')](_0x3ec61f)){_0x3ec61f[_0xc351('0x4a')](function(_0x365c26){RpcVoiceAgentReport[_0xc351('0x2e')](_0x365c26);});}else{RpcVoiceAgentReport[_0xc351('0x2e')](_0x3ec61f);}};Report[_0xc351('0x1e')]['voiceDialReport']=function(_0x202c01){RpcVoiceDialReport[_0xc351('0x2e')](_0x202c01);var _0x467d92=undefined;var _0x4e801d=_0x202c01[_0xc351('0x3e')];if(_[_0xc351('0x4b')](_0x4e801d,'Local')){var _0x475a90=_0x4e801d[_0xc351('0x4c')](_0x4e801d[_0xc351('0x4d')]('/')+0x1,_0x4e801d[_0xc351('0x4d')]('@'));_0x467d92=_[_0xc351('0x20')](this['agents'],function(_0x22a70d){return _0x22a70d[_0xc351('0x4e')]==_0x475a90||_0x22a70d[_0xc351('0x4f')]==_0x475a90||_0x22a70d[_0xc351('0x21')]==_0x475a90;});}else{var _0x475a90=_0x4e801d[_0xc351('0x4c')](_0x4e801d['indexOf']('/')+0x1,_0x4e801d[_0xc351('0x50')]('-'));_0x467d92=this[_0xc351('0x1f')](_0x475a90);}if(_0x467d92){_0x202c01['interface']=_['isNil'](_0x467d92[_0xc351('0x24')])?util[_0xc351('0x25')](_0xc351('0x26'),_0x467d92[_0xc351('0x22')]):_0x467d92[_0xc351('0x24')];_0x202c01[_0xc351('0x47')]=_0x467d92[_0xc351('0x22')];_0x202c01[_0xc351('0x21')]=_0x467d92[_0xc351('0x21')];RpcMemberReport['voiceDialReport'](_0x202c01);}};Report['prototype'][_0xc351('0x51')]=function(_0x4d266f){RpcVoiceTransferReport[_0xc351('0x51')](_0x4d266f);};Report[_0xc351('0x1e')][_0xc351('0x1d')]=function(_0x132d65){RpcVoiceTransferReport['attendedTransfer'](_0x132d65);};module[_0xc351('0x52')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index b02dc97..ebdd3a0 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 _0xb6ea=['../../../config/environment','../../../config/logger','ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','bind','registry','syncRegistry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','prototype','actionSipShowRegistry','isNotNull','isUndefined','emit','username','stateRegistry','state','merge','actionid','format','trunk:%s','name','trunk:save','inspect','device','local','toLowerCase','inuse','toNumber','stateTime','telephone:%s','telephone:save','startsWith','Local','substring','indexOf','find','mobile','phone','accountcode','peer','registered','status','address','updateStatusRealtime','error','[syncPeerStatus][UserReport]','exports','util','ioredis'];(function(_0xe69607,_0x5d792f){var _0x378497=function(_0x4bc299){while(--_0x4bc299){_0xe69607['push'](_0xe69607['shift']());}};_0x378497(++_0x5d792f);}(_0xb6ea,0x102));var _0xab6e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb6ea[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xab6e('0x0'));var Redis=require(_0xab6e('0x1'));var config=require(_0xab6e('0x2'));var logger=require(_0xab6e('0x3'))(_0xab6e('0x4'));var ami=require('../ami');config['redis']=_[_0xab6e('0x5')](config[_0xab6e('0x6')],{'host':_0xab6e('0x7'),'port':0x18eb});var io=require(_0xab6e('0x8'))(new Redis(config[_0xab6e('0x6')]));function UserReport(_0x10d667){this[_0xab6e('0x9')]=_0x10d667[_0xab6e('0x9')];this[_0xab6e('0xa')]=_0x10d667[_0xab6e('0xa')];this[_0xab6e('0xb')]=_0x10d667[_0xab6e('0xb')];ami['on'](_0xab6e('0xc'),this['syncRegistry'][_0xab6e('0xd')](this));ami['on'](_0xab6e('0xe'),this[_0xab6e('0xf')][_0xab6e('0xd')](this));ami['on'](_0xab6e('0x10'),this[_0xab6e('0x11')][_0xab6e('0xd')](this));ami['on'](_0xab6e('0x12'),this[_0xab6e('0x13')][_0xab6e('0xd')](this));this['loopSyncRealTimeShow']();return BPromise[_0xab6e('0x14')]()['then'](ami['actionSipShowRegistry']())[_0xab6e('0x15')](ami[_0xab6e('0x16')]())[_0xab6e('0x15')](ami[_0xab6e('0x17')]())[_0xab6e('0x18')](loggerCatch(_0xab6e('0x19')));}function loggerCatch(_0xf92da4){return function(_0x13b5cd){logger['error'](_0xf92da4,util['inspect'](_0x13b5cd,{'showHidden':![],'depth':null}));};}UserReport[_0xab6e('0x1a')]['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise[_0xab6e('0x14')]()[_0xab6e('0x15')](ami[_0xab6e('0x1b')]())[_0xab6e('0x15')](ami[_0xab6e('0x16')]())[_0xab6e('0x15')](ami[_0xab6e('0x17')]())[_0xab6e('0x18')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0xab6e('0x1a')][_0xab6e('0x1c')]=function(_0x40a947){return _0x40a947!==null&&!_[_0xab6e('0x1d')](_0x40a947);};UserReport[_0xab6e('0x1a')][_0xab6e('0x1e')]=function(_0x1456ba,_0x2af455,_0x2b58fb){io['to'](_0x1456ba)[_0xab6e('0x1e')](_0x2af455,_0x2b58fb);};UserReport[_0xab6e('0x1a')][_0xab6e('0xf')]=function(_0x34204c){try{if(this[_0xab6e('0x1c')](_0x34204c)){var _0xbbb9e3=_['find'](this[_0xab6e('0x9')],{'registry':_0x34204c[_0xab6e('0x1f')]});if(_0xbbb9e3){_0x34204c[_0xab6e('0x20')]=_0x34204c[_0xab6e('0x21')];_[_0xab6e('0x22')](_0xbbb9e3,_['omit'](_0x34204c,['event',_0xab6e('0x23'),_0xab6e('0x1f'),_0xab6e('0x21')]));this[_0xab6e('0x1e')](util[_0xab6e('0x24')](_0xab6e('0x25'),_0xbbb9e3[_0xab6e('0x26')]),_0xab6e('0x27'),_0xbbb9e3);}}}catch(_0x55fc43){logger['error']('[syncRegistry][UserReport]',util[_0xab6e('0x28')](_0x55fc43,{'showHidden':![],'depth':null}));}};UserReport[_0xab6e('0x1a')][_0xab6e('0x11')]=function(_0xac914d){try{if(this[_0xab6e('0x1c')](_0xac914d)){if(this[_0xab6e('0xa')][_0xac914d[_0xab6e('0x29')]]){if(!this['agents'][_0xac914d['device']][_0xab6e('0x2a')]||_0xac914d[_0xab6e('0x21')][_0xab6e('0x2b')]()==_0xab6e('0x2c')){this[_0xab6e('0xa')][_0xac914d[_0xab6e('0x29')]][_0xab6e('0x2a')]=![];if(this[_0xab6e('0xa')][_0xac914d['device']][_0xab6e('0x21')]!==_0xac914d['state']['toLowerCase']()){this[_0xab6e('0xa')][_0xac914d[_0xab6e('0x29')]]['stateTime']=_[_0xab6e('0x2d')](moment()[_0xab6e('0x24')]('x'));}this['agents'][_0xac914d['device']][_0xab6e('0x21')]=_0xac914d[_0xab6e('0x21')][_0xab6e('0x2b')]();this[_0xab6e('0xa')][_0xac914d['device']]['updateStatusRealtime'](_0xac914d);}}else if(this[_0xab6e('0xb')][_0xac914d[_0xab6e('0x29')]]){if(this[_0xab6e('0xb')][_0xac914d['device']]['state']!==_0xac914d[_0xab6e('0x21')][_0xab6e('0x2b')]()){this[_0xab6e('0xb')][_0xac914d['device']][_0xab6e('0x2e')]=_['toNumber'](moment()['format']('x'));}this['telephones'][_0xac914d[_0xab6e('0x29')]]['state']=_0xac914d[_0xab6e('0x21')][_0xab6e('0x2b')]();this[_0xab6e('0x1e')](util['format'](_0xab6e('0x2f'),this[_0xab6e('0xb')][_0xac914d[_0xab6e('0x29')]]['name']),_0xab6e('0x30'),this[_0xab6e('0xb')][_0xac914d['device']]);}else if(this[_0xab6e('0x9')][_0xac914d[_0xab6e('0x29')]]){if(this[_0xab6e('0x9')][_0xac914d[_0xab6e('0x29')]][_0xab6e('0x21')]!==_0xac914d[_0xab6e('0x21')][_0xab6e('0x2b')]()){this[_0xab6e('0x9')][_0xac914d[_0xab6e('0x29')]][_0xab6e('0x2e')]=_[_0xab6e('0x2d')](moment()[_0xab6e('0x24')]('x'));}this[_0xab6e('0x9')][_0xac914d[_0xab6e('0x29')]][_0xab6e('0x21')]=_0xac914d[_0xab6e('0x21')]['toLowerCase']();this[_0xab6e('0x1e')](util['format'](_0xab6e('0x25'),this[_0xab6e('0x9')][_0xac914d[_0xab6e('0x29')]]['name']),_0xab6e('0x27'),this[_0xab6e('0x9')][_0xac914d[_0xab6e('0x29')]]);}else if(_[_0xab6e('0x31')](_0xac914d[_0xab6e('0x29')],'Queue')){}else if(_[_0xab6e('0x31')](_0xac914d['device'],_0xab6e('0x32'))){var _0x3451=_0xac914d[_0xab6e('0x29')];var _0x143d1f=_0x3451[_0xab6e('0x33')](_0x3451[_0xab6e('0x34')]('/')+0x1,_0x3451[_0xab6e('0x34')]('@'));var _0x27993b=_[_0xab6e('0x35')](this[_0xab6e('0xa')],function(_0x3c0bea){return _0x3c0bea[_0xab6e('0x36')]==_0x143d1f||_0x3c0bea[_0xab6e('0x37')]==_0x143d1f||_0x3c0bea[_0xab6e('0x38')]==_0x143d1f;});if(_0x27993b){if(_0x27993b[_0xab6e('0x21')]!==_0xac914d['state']['toLowerCase']()){_0x27993b[_0xab6e('0x2e')]=_['toNumber'](moment()['format']('x'));}_0x27993b[_0xab6e('0x21')]=_0xac914d[_0xab6e('0x21')][_0xab6e('0x2b')]();_0x27993b['local']=!![];_0x27993b['updateStatusRealtime'](_0xac914d);}}else{}}}catch(_0x52bb8e){logger['error']('[syncDeviceState][UserReport]',util[_0xab6e('0x28')](_0x52bb8e,{'showHidden':![],'depth':null}));}};UserReport[_0xab6e('0x1a')][_0xab6e('0x13')]=function(_0x4ec8dc){try{if(this[_0xab6e('0x1c')](_0x4ec8dc)&&this[_0xab6e('0x1c')](_0x4ec8dc['peerstatus'])){if(this[_0xab6e('0xa')][_0x4ec8dc[_0xab6e('0x39')]]){if(!this[_0xab6e('0xa')][_0x4ec8dc[_0xab6e('0x39')]][_0xab6e('0x2a')]||_0x4ec8dc[_0xab6e('0x12')][_0xab6e('0x2b')]()==_0xab6e('0x3a')){this['agents'][_0x4ec8dc[_0xab6e('0x39')]][_0xab6e('0x2a')]=![];this[_0xab6e('0xa')][_0x4ec8dc[_0xab6e('0x39')]][_0xab6e('0x3b')]=_0x4ec8dc[_0xab6e('0x12')][_0xab6e('0x2b')]();this[_0xab6e('0xa')][_0x4ec8dc[_0xab6e('0x39')]][_0xab6e('0x3c')]=_0x4ec8dc[_0xab6e('0x3c')];this[_0xab6e('0xa')][_0x4ec8dc[_0xab6e('0x39')]][_0xab6e('0x3d')](_0x4ec8dc);}}else if(this[_0xab6e('0xb')][_0x4ec8dc[_0xab6e('0x39')]]){this['telephones'][_0x4ec8dc[_0xab6e('0x39')]][_0xab6e('0x3b')]=_0x4ec8dc[_0xab6e('0x12')]['toLowerCase']();this[_0xab6e('0xb')][_0x4ec8dc['peer']][_0xab6e('0x3c')]=_0x4ec8dc['address'];this[_0xab6e('0x1e')](util[_0xab6e('0x24')](_0xab6e('0x2f'),this['telephones'][_0x4ec8dc[_0xab6e('0x39')]][_0xab6e('0x26')]),_0xab6e('0x30'),this[_0xab6e('0xb')][_0x4ec8dc['peer']]);}else if(this['trunks'][_0x4ec8dc['peer']]){this['trunks'][_0x4ec8dc['peer']][_0xab6e('0x3b')]=_0x4ec8dc[_0xab6e('0x12')][_0xab6e('0x2b')]();this[_0xab6e('0x9')][_0x4ec8dc['peer']]['address']=_0x4ec8dc[_0xab6e('0x3c')];this['emit'](util['format']('trunk:%s',this[_0xab6e('0x9')][_0x4ec8dc[_0xab6e('0x39')]][_0xab6e('0x26')]),_0xab6e('0x27'),this[_0xab6e('0x9')][_0x4ec8dc['peer']]);}else{}}}catch(_0x38713e){logger[_0xab6e('0x3e')](_0xab6e('0x3f'),util['inspect'](_0x38713e,{'showHidden':![],'depth':null}));}};module[_0xab6e('0x40')]=UserReport; \ No newline at end of file +var _0xbee3=['agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','error','inspect','prototype','actionSipPeerStatus','[loopSyncRealTimeShow]','isNotNull','isUndefined','emit','find','username','stateRegistry','state','merge','actionid','format','name','trunk:save','[syncRegistry][UserReport]','device','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','trunk:%s','startsWith','Queue','Local','substring','indexOf','mobile','phone','accountcode','[syncDeviceState][UserReport]','peer','registered','status','address','[syncPeerStatus][UserReport]','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks'];(function(_0x5d46f5,_0xbd5c4f){var _0x9d552=function(_0x205bf9){while(--_0x205bf9){_0x5d46f5['push'](_0x5d46f5['shift']());}};_0x9d552(++_0xbd5c4f);}(_0xbee3,0x104));var _0x3bee=function(_0x5acd55,_0x5affab){_0x5acd55=_0x5acd55-0x0;var _0xeef4aa=_0xbee3[_0x5acd55];return _0xeef4aa;};'use strict';var _=require(_0x3bee('0x0'));var moment=require(_0x3bee('0x1'));var BPromise=require(_0x3bee('0x2'));var util=require('util');var Redis=require(_0x3bee('0x3'));var config=require(_0x3bee('0x4'));var logger=require(_0x3bee('0x5'))(_0x3bee('0x6'));var ami=require('../ami');config[_0x3bee('0x7')]=_[_0x3bee('0x8')](config['redis'],{'host':_0x3bee('0x9'),'port':0x18eb});var io=require(_0x3bee('0xa'))(new Redis(config[_0x3bee('0x7')]));function UserReport(_0x1af5cf){this[_0x3bee('0xb')]=_0x1af5cf[_0x3bee('0xb')];this[_0x3bee('0xc')]=_0x1af5cf[_0x3bee('0xc')];this['telephones']=_0x1af5cf[_0x3bee('0xd')];ami['on'](_0x3bee('0xe'),this[_0x3bee('0xf')][_0x3bee('0x10')](this));ami['on'](_0x3bee('0x11'),this[_0x3bee('0xf')][_0x3bee('0x10')](this));ami['on']('devicestatechange',this[_0x3bee('0x12')][_0x3bee('0x10')](this));ami['on'](_0x3bee('0x13'),this[_0x3bee('0x14')][_0x3bee('0x10')](this));this['loopSyncRealTimeShow']();return BPromise[_0x3bee('0x15')]()[_0x3bee('0x16')](ami[_0x3bee('0x17')]())[_0x3bee('0x16')](ami[_0x3bee('0x18')]())['then'](ami['actionSipPeerStatus']())[_0x3bee('0x19')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x3ef136){return function(_0x10eb10){logger[_0x3bee('0x1a')](_0x3ef136,util[_0x3bee('0x1b')](_0x10eb10,{'showHidden':![],'depth':null}));};}UserReport[_0x3bee('0x1c')]['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise[_0x3bee('0x15')]()[_0x3bee('0x16')](ami[_0x3bee('0x17')]())[_0x3bee('0x16')](ami['actionDeviceStateList']())[_0x3bee('0x16')](ami[_0x3bee('0x1d')]())[_0x3bee('0x19')](loggerCatch(_0x3bee('0x1e')));},0x32c8);};UserReport[_0x3bee('0x1c')][_0x3bee('0x1f')]=function(_0x4b4a61){return _0x4b4a61!==null&&!_[_0x3bee('0x20')](_0x4b4a61);};UserReport[_0x3bee('0x1c')][_0x3bee('0x21')]=function(_0x3b2930,_0x13acfe,_0x1966cb){io['to'](_0x3b2930)[_0x3bee('0x21')](_0x13acfe,_0x1966cb);};UserReport[_0x3bee('0x1c')][_0x3bee('0xf')]=function(_0x45370a){try{if(this[_0x3bee('0x1f')](_0x45370a)){var _0x2267c3=_[_0x3bee('0x22')](this[_0x3bee('0xb')],{'registry':_0x45370a[_0x3bee('0x23')]});if(_0x2267c3){_0x45370a[_0x3bee('0x24')]=_0x45370a[_0x3bee('0x25')];_[_0x3bee('0x26')](_0x2267c3,_['omit'](_0x45370a,['event',_0x3bee('0x27'),_0x3bee('0x23'),'state']));this[_0x3bee('0x21')](util[_0x3bee('0x28')]('trunk:%s',_0x2267c3[_0x3bee('0x29')]),_0x3bee('0x2a'),_0x2267c3);}}}catch(_0xa7bc96){logger['error'](_0x3bee('0x2b'),util[_0x3bee('0x1b')](_0xa7bc96,{'showHidden':![],'depth':null}));}};UserReport[_0x3bee('0x1c')][_0x3bee('0x12')]=function(_0x1ccc88){try{if(this[_0x3bee('0x1f')](_0x1ccc88)){if(this[_0x3bee('0xc')][_0x1ccc88[_0x3bee('0x2c')]]){if(!this[_0x3bee('0xc')][_0x1ccc88['device']][_0x3bee('0x2d')]||_0x1ccc88[_0x3bee('0x25')][_0x3bee('0x2e')]()=='inuse'){this[_0x3bee('0xc')][_0x1ccc88['device']]['local']=![];if(this[_0x3bee('0xc')][_0x1ccc88['device']][_0x3bee('0x25')]!==_0x1ccc88['state'][_0x3bee('0x2e')]()){this[_0x3bee('0xc')][_0x1ccc88['device']][_0x3bee('0x2f')]=_[_0x3bee('0x30')](moment()['format']('x'));}this[_0x3bee('0xc')][_0x1ccc88[_0x3bee('0x2c')]][_0x3bee('0x25')]=_0x1ccc88['state'][_0x3bee('0x2e')]();this[_0x3bee('0xc')][_0x1ccc88[_0x3bee('0x2c')]][_0x3bee('0x31')](_0x1ccc88);}}else if(this[_0x3bee('0xd')][_0x1ccc88[_0x3bee('0x2c')]]){if(this['telephones'][_0x1ccc88[_0x3bee('0x2c')]][_0x3bee('0x25')]!==_0x1ccc88[_0x3bee('0x25')][_0x3bee('0x2e')]()){this['telephones'][_0x1ccc88['device']]['stateTime']=_[_0x3bee('0x30')](moment()[_0x3bee('0x28')]('x'));}this[_0x3bee('0xd')][_0x1ccc88[_0x3bee('0x2c')]][_0x3bee('0x25')]=_0x1ccc88[_0x3bee('0x25')][_0x3bee('0x2e')]();this[_0x3bee('0x21')](util['format'](_0x3bee('0x32'),this[_0x3bee('0xd')][_0x1ccc88[_0x3bee('0x2c')]][_0x3bee('0x29')]),_0x3bee('0x33'),this[_0x3bee('0xd')][_0x1ccc88['device']]);}else if(this[_0x3bee('0xb')][_0x1ccc88[_0x3bee('0x2c')]]){if(this['trunks'][_0x1ccc88[_0x3bee('0x2c')]][_0x3bee('0x25')]!==_0x1ccc88['state'][_0x3bee('0x2e')]()){this[_0x3bee('0xb')][_0x1ccc88[_0x3bee('0x2c')]][_0x3bee('0x2f')]=_['toNumber'](moment()[_0x3bee('0x28')]('x'));}this[_0x3bee('0xb')][_0x1ccc88[_0x3bee('0x2c')]]['state']=_0x1ccc88[_0x3bee('0x25')]['toLowerCase']();this[_0x3bee('0x21')](util[_0x3bee('0x28')](_0x3bee('0x34'),this['trunks'][_0x1ccc88[_0x3bee('0x2c')]]['name']),_0x3bee('0x2a'),this[_0x3bee('0xb')][_0x1ccc88[_0x3bee('0x2c')]]);}else if(_[_0x3bee('0x35')](_0x1ccc88[_0x3bee('0x2c')],_0x3bee('0x36'))){}else if(_[_0x3bee('0x35')](_0x1ccc88[_0x3bee('0x2c')],_0x3bee('0x37'))){var _0x522a14=_0x1ccc88['device'];var _0x183d11=_0x522a14[_0x3bee('0x38')](_0x522a14[_0x3bee('0x39')]('/')+0x1,_0x522a14[_0x3bee('0x39')]('@'));var _0x107333=_[_0x3bee('0x22')](this['agents'],function(_0x57c0e5){return _0x57c0e5[_0x3bee('0x3a')]==_0x183d11||_0x57c0e5[_0x3bee('0x3b')]==_0x183d11||_0x57c0e5[_0x3bee('0x3c')]==_0x183d11;});if(_0x107333){if(_0x107333['state']!==_0x1ccc88[_0x3bee('0x25')][_0x3bee('0x2e')]()){_0x107333[_0x3bee('0x2f')]=_['toNumber'](moment()[_0x3bee('0x28')]('x'));}_0x107333['state']=_0x1ccc88[_0x3bee('0x25')][_0x3bee('0x2e')]();_0x107333[_0x3bee('0x2d')]=!![];_0x107333[_0x3bee('0x31')](_0x1ccc88);}}else{}}}catch(_0x2a0d5e){logger[_0x3bee('0x1a')](_0x3bee('0x3d'),util['inspect'](_0x2a0d5e,{'showHidden':![],'depth':null}));}};UserReport[_0x3bee('0x1c')][_0x3bee('0x14')]=function(_0x2fccc1){try{if(this[_0x3bee('0x1f')](_0x2fccc1)&&this[_0x3bee('0x1f')](_0x2fccc1[_0x3bee('0x13')])){if(this[_0x3bee('0xc')][_0x2fccc1[_0x3bee('0x3e')]]){if(!this[_0x3bee('0xc')][_0x2fccc1[_0x3bee('0x3e')]]['local']||_0x2fccc1[_0x3bee('0x13')][_0x3bee('0x2e')]()==_0x3bee('0x3f')){this['agents'][_0x2fccc1[_0x3bee('0x3e')]][_0x3bee('0x2d')]=![];this[_0x3bee('0xc')][_0x2fccc1[_0x3bee('0x3e')]][_0x3bee('0x40')]=_0x2fccc1['peerstatus']['toLowerCase']();this[_0x3bee('0xc')][_0x2fccc1[_0x3bee('0x3e')]][_0x3bee('0x41')]=_0x2fccc1[_0x3bee('0x41')];this['agents'][_0x2fccc1[_0x3bee('0x3e')]]['updateStatusRealtime'](_0x2fccc1);}}else if(this['telephones'][_0x2fccc1[_0x3bee('0x3e')]]){this[_0x3bee('0xd')][_0x2fccc1[_0x3bee('0x3e')]][_0x3bee('0x40')]=_0x2fccc1[_0x3bee('0x13')][_0x3bee('0x2e')]();this[_0x3bee('0xd')][_0x2fccc1[_0x3bee('0x3e')]][_0x3bee('0x41')]=_0x2fccc1[_0x3bee('0x41')];this[_0x3bee('0x21')](util['format'](_0x3bee('0x32'),this[_0x3bee('0xd')][_0x2fccc1['peer']][_0x3bee('0x29')]),_0x3bee('0x33'),this[_0x3bee('0xd')][_0x2fccc1[_0x3bee('0x3e')]]);}else if(this[_0x3bee('0xb')][_0x2fccc1[_0x3bee('0x3e')]]){this['trunks'][_0x2fccc1[_0x3bee('0x3e')]][_0x3bee('0x40')]=_0x2fccc1[_0x3bee('0x13')][_0x3bee('0x2e')]();this[_0x3bee('0xb')][_0x2fccc1[_0x3bee('0x3e')]][_0x3bee('0x41')]=_0x2fccc1[_0x3bee('0x41')];this[_0x3bee('0x21')](util[_0x3bee('0x28')](_0x3bee('0x34'),this[_0x3bee('0xb')][_0x2fccc1[_0x3bee('0x3e')]][_0x3bee('0x29')]),_0x3bee('0x2a'),this[_0x3bee('0xb')][_0x2fccc1['peer']]);}else{}}}catch(_0x495f5d){logger['error'](_0x3bee('0x42'),util[_0x3bee('0x1b')](_0x495f5d,{'showHidden':![],'depth':null}));}};module[_0x3bee('0x43')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index f2ca7d0..7a1cb38 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 _0x0431=['musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','prototype','isUndefined','isNotNull','uniqueid','destuniqueid','format','variables','queue','type','inbound','merge','omit','event','privilege','custom:agentcalled','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','agents','interface','user:%s','user:agentconnect','custom:agentconnect','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','agentringnoanswerAt','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','agentconnectAt','agentcomplete','complete','talktime','transfer','agentacw','acwtime','acwTimeout','destconnectedlinenum','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','membercalls','memberinterface','memberrealtime','isNil','includes','agentcompleteAt','custom:voiceAgentReport','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','diff','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','[syncMusicOnHoldStop][VoiceAgentReport]','exports','util','ioredis','../../../config/logger','ami','../ami','defaults','localhost','socket.io-emitter','redis','channels','voiceQueues','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','bind','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','hangup','syncHangup'];(function(_0x4b2775,_0x181b74){var _0x49626f=function(_0x3bc903){while(--_0x3bc903){_0x4b2775['push'](_0x4b2775['shift']());}};_0x49626f(++_0x181b74);}(_0x0431,0x1cf));var _0x1043=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x0431[_0x32d457];return _0x338386;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x1043('0x0'));var Redis=require(_0x1043('0x1'));var config=require('../../../config/environment');var logger=require(_0x1043('0x2'))(_0x1043('0x3'));var ami=require(_0x1043('0x4'));config['redis']=_[_0x1043('0x5')](config['redis'],{'host':_0x1043('0x6'),'port':0x18eb});var io=require(_0x1043('0x7'))(new Redis(config[_0x1043('0x8')]));function VoiceAgentReport(_0xb8c58a){this[_0x1043('0x9')]={};this['voiceQueues']=_0xb8c58a[_0x1043('0xa')];this['agents']=_0xb8c58a['agents'];this['variables']={};ami['on'](_0x1043('0xb'),this[_0x1043('0xc')]['bind'](this));ami['on'](_0x1043('0xd'),this[_0x1043('0xe')]['bind'](this));ami['on'](_0x1043('0xf'),this[_0x1043('0x10')][_0x1043('0x11')](this));ami['on'](_0x1043('0x12'),this[_0x1043('0x13')][_0x1043('0x11')](this));ami['on']('agentcomplete',this[_0x1043('0x14')]['bind'](this));ami['on'](_0x1043('0x15'),this[_0x1043('0x16')][_0x1043('0x11')](this));ami['on'](_0x1043('0x17'),this[_0x1043('0x18')][_0x1043('0x11')](this));ami['on'](_0x1043('0x19'),this[_0x1043('0x1a')][_0x1043('0x11')](this));ami['on']('musiconholdstop',this[_0x1043('0x1b')]['bind'](this));ami['on'](_0x1043('0x1c'),this[_0x1043('0x1d')][_0x1043('0x11')](this));ami['on']('blindtransfer',this[_0x1043('0x1e')][_0x1043('0x11')](this));}VoiceAgentReport['prototype'][_0x1043('0x1f')]=function(_0x81536c,_0x3b3d98,_0x58f4b1){io['to'](_0x81536c)['emit'](_0x3b3d98,_0x58f4b1);};VoiceAgentReport[_0x1043('0x20')]['isNotNull']=function(_0x34f3c8){return _0x34f3c8!==null&&!_[_0x1043('0x21')](_0x34f3c8);};VoiceAgentReport['prototype'][_0x1043('0xc')]=function(_0x391f02){try{if(this[_0x1043('0x22')](_0x391f02)){if(_['isUndefined'](this['channels'][_0x391f02['uniqueid']])){this[_0x1043('0x9')][_0x391f02['uniqueid']]={};}if(_['isUndefined'](this[_0x1043('0x9')][_0x391f02['uniqueid']][_0x391f02['destuniqueid']])){this[_0x1043('0x9')][_0x391f02[_0x1043('0x23')]][_0x391f02[_0x1043('0x24')]]={'agentcalledAt':moment()[_0x1043('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','variables':this[_0x1043('0x26')][_0x391f02['uniqueid']],'type':this[_0x1043('0xa')][_0x391f02[_0x1043('0x27')]]?this[_0x1043('0xa')][_0x391f02['queue']][_0x1043('0x28')]||_0x1043('0x29'):'inbound'};}_[_0x1043('0x2a')](this[_0x1043('0x9')][_0x391f02['uniqueid']][_0x391f02[_0x1043('0x24')]],_[_0x1043('0x2b')](_0x391f02,[_0x1043('0x2c'),_0x1043('0x2d')]));ami['emit'](_0x1043('0x2e'),this[_0x1043('0x9')][_0x391f02['uniqueid']][_0x391f02[_0x1043('0x24')]]);this[_0x1043('0x1f')](util['format']('user:%s',_0x391f02[_0x1043('0x2f')]),_0x1043('0x30'),this[_0x1043('0x9')][_0x391f02[_0x1043('0x23')]][_0x391f02[_0x1043('0x24')]]);}}catch(_0x43aa3e){logger[_0x1043('0x31')](_0x1043('0x32'),util[_0x1043('0x33')](_0x43aa3e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1043('0x20')][_0x1043('0xe')]=function(_0x91de9e){try{if(this['isNotNull'](_0x91de9e)){if(this[_0x1043('0x9')][_0x91de9e[_0x1043('0x23')]]){for(var _0x2e5801 in this['channels'][_0x91de9e[_0x1043('0x23')]]){if(this[_0x1043('0x9')][_0x91de9e['uniqueid']][_0x1043('0x34')](_0x2e5801)){if(_0x91de9e[_0x1043('0x24')]===_0x2e5801){this['channels'][_0x91de9e[_0x1043('0x23')]][_0x2e5801]['agentconnectAt']=moment()[_0x1043('0x25')](_0x1043('0x35'));this[_0x1043('0x9')][_0x91de9e[_0x1043('0x23')]][_0x2e5801][_0x1043('0x36')]=_0x1043('0x37');this[_0x1043('0x9')][_0x91de9e['uniqueid']][_0x2e5801][_0x1043('0x38')]=_0x91de9e[_0x1043('0x38')];this[_0x1043('0x9')][_0x91de9e[_0x1043('0x23')]][_0x2e5801][_0x1043('0x39')]=_0x91de9e[_0x1043('0x39')];this['channels'][_0x91de9e[_0x1043('0x23')]][_0x2e5801][_0x1043('0x3a')]=_0x91de9e[_0x1043('0x3a')];this['channels'][_0x91de9e[_0x1043('0x23')]][_0x2e5801]['destchannelstate']=_0x91de9e[_0x1043('0x3b')];this['channels'][_0x91de9e[_0x1043('0x23')]][_0x2e5801]['destchannelstatedesc']=_0x91de9e[_0x1043('0x3c')];_[_0x1043('0x2a')](this[_0x1043('0x3d')][_0x91de9e[_0x1043('0x3e')]],_['pick'](_0x91de9e,[_0x1043('0x27'),'destconnectedlinenum']));this[_0x1043('0x1f')](util[_0x1043('0x25')](_0x1043('0x3f'),_0x91de9e['membername']),_0x1043('0x40'),this[_0x1043('0x9')][_0x91de9e[_0x1043('0x23')]][_0x91de9e['destuniqueid']]);ami['emit'](_0x1043('0x41'),this['channels'][_0x91de9e[_0x1043('0x23')]][_0x2e5801]);}else if(!this['channels'][_0x91de9e[_0x1043('0x23')]][_0x2e5801][_0x1043('0xf')]&&!this[_0x1043('0x9')][_0x91de9e[_0x1043('0x23')]][_0x2e5801]['agentcomplete']){this[_0x1043('0x9')][_0x91de9e[_0x1043('0x23')]][_0x2e5801][_0x1043('0xf')]=!![];this['channels'][_0x91de9e['uniqueid']][_0x2e5801]['agentringnoanswerAt']=moment()['format'](_0x1043('0x35'));this['channels'][_0x91de9e[_0x1043('0x23')]][_0x2e5801][_0x1043('0x42')]=_0x1043('0x43');this[_0x1043('0x9')][_0x91de9e[_0x1043('0x23')]][_0x2e5801][_0x1043('0x36')]=_0x1043('0x43');this[_0x1043('0x9')][_0x91de9e[_0x1043('0x23')]][_0x2e5801][_0x1043('0x44')]=_0x91de9e[_0x1043('0x24')];this['channels'][_0x91de9e[_0x1043('0x23')]][_0x2e5801]['answeredelsewheremembername']=_0x91de9e['membername'];ami['emit'](_0x1043('0x45'),this['channels'][_0x91de9e[_0x1043('0x23')]][_0x2e5801]);}}}}}}catch(_0xd922b1){logger[_0x1043('0x31')](_0x1043('0x46'),util[_0x1043('0x33')](_0xd922b1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1043('0x20')][_0x1043('0x10')]=function(_0x50ac7c){try{if(this[_0x1043('0x22')](_0x50ac7c)){if(this[_0x1043('0x9')][_0x50ac7c[_0x1043('0x23')]]&&this[_0x1043('0x9')][_0x50ac7c[_0x1043('0x23')]][_0x50ac7c[_0x1043('0x24')]]){this[_0x1043('0x9')][_0x50ac7c[_0x1043('0x23')]][_0x50ac7c[_0x1043('0x24')]]['agentringnoanswer']=!![];this['channels'][_0x50ac7c['uniqueid']][_0x50ac7c[_0x1043('0x24')]][_0x1043('0x47')]=moment()[_0x1043('0x25')](_0x1043('0x35'));this[_0x1043('0x9')][_0x50ac7c['uniqueid']][_0x50ac7c[_0x1043('0x24')]][_0x1043('0x42')]='rejected';this['channels'][_0x50ac7c[_0x1043('0x23')]][_0x50ac7c[_0x1043('0x24')]][_0x1043('0x36')]=_0x1043('0x48');ami[_0x1043('0x1f')](_0x1043('0x49'),this['channels'][_0x50ac7c[_0x1043('0x23')]][_0x50ac7c['destuniqueid']]);}}}catch(_0x573afb){logger[_0x1043('0x31')](_0x1043('0x4a'),util[_0x1043('0x33')](_0x573afb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1043('0x20')][_0x1043('0x13')]=function(_0x3966b3){try{if(this[_0x1043('0x22')](_0x3966b3)){if(this[_0x1043('0x9')][_0x3966b3[_0x1043('0x23')]]){for(var _0x378489 in this['channels'][_0x3966b3[_0x1043('0x23')]]){if(this['channels'][_0x3966b3['uniqueid']][_0x1043('0x34')](_0x378489)&&!this[_0x1043('0x9')][_0x3966b3[_0x1043('0x23')]][_0x378489]['agentringnoanswer']&&!this['channels'][_0x3966b3[_0x1043('0x23')]][_0x378489]['agentcomplete']){this[_0x1043('0x9')][_0x3966b3['uniqueid']][_0x378489][_0x1043('0xf')]=!![];this[_0x1043('0x9')][_0x3966b3[_0x1043('0x23')]][_0x378489]['agentringnoanswerAt']=moment()[_0x1043('0x25')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1043('0x9')][_0x3966b3[_0x1043('0x23')]][_0x378489][_0x1043('0x42')]=_0x1043('0x4b');this['channels'][_0x3966b3[_0x1043('0x23')]][_0x378489][_0x1043('0x36')]=_0x1043('0x4b');ami[_0x1043('0x1f')](_0x1043('0x4c'),this[_0x1043('0x9')][_0x3966b3[_0x1043('0x23')]][_0x378489]);}}}}}catch(_0x3ad411){logger[_0x1043('0x31')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x1043('0x33')](_0x3ad411,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1043('0x14')]=function(_0x21eb40){try{if(this[_0x1043('0x22')](_0x21eb40)){if(this[_0x1043('0x9')][_0x21eb40[_0x1043('0x23')]]){for(var _0x24c265 in this['channels'][_0x21eb40[_0x1043('0x23')]]){if(this[_0x1043('0x9')][_0x21eb40[_0x1043('0x23')]][_0x1043('0x34')](_0x24c265)){if(this[_0x1043('0x9')][_0x21eb40[_0x1043('0x23')]][_0x24c265][_0x1043('0x4d')]&&!this[_0x1043('0x9')][_0x21eb40[_0x1043('0x23')]][_0x24c265][_0x1043('0x4e')]){this[_0x1043('0x9')][_0x21eb40[_0x1043('0x23')]][_0x24c265][_0x1043('0x4e')]=!![];this[_0x1043('0x9')][_0x21eb40['uniqueid']][_0x24c265]['agentcompleteAt']=moment()[_0x1043('0x25')](_0x1043('0x35'));this[_0x1043('0x9')][_0x21eb40[_0x1043('0x23')]][_0x24c265][_0x1043('0x36')]=_0x1043('0x4f');this[_0x1043('0x9')][_0x21eb40[_0x1043('0x23')]][_0x24c265][_0x1043('0x50')]=_0x21eb40['talktime'];this[_0x1043('0x9')][_0x21eb40[_0x1043('0x23')]][_0x24c265]['reason']=_0x21eb40['reason']==_0x1043('0x51')?'agent':_0x21eb40[_0x1043('0x42')];if(this[_0x1043('0xa')][_0x21eb40[_0x1043('0x27')]]&&this[_0x1043('0xa')][_0x21eb40[_0x1043('0x27')]]['acw']){this[_0x1043('0x9')][_0x21eb40[_0x1043('0x23')]][_0x24c265][_0x1043('0x52')]=!![];this[_0x1043('0x9')][_0x21eb40['uniqueid']][_0x24c265][_0x1043('0x53')]=this[_0x1043('0xa')][_0x21eb40['queue']][_0x1043('0x54')];}this[_0x1043('0x3d')][_0x21eb40[_0x1043('0x3e')]]=_[_0x1043('0x2b')](this[_0x1043('0x3d')][_0x21eb40[_0x1043('0x3e')]],[_0x1043('0x27'),_0x1043('0x55')]);this[_0x1043('0x1f')](util[_0x1043('0x25')](_0x1043('0x3f'),_0x21eb40['membername']),'user:agentcomplete',this['channels'][_0x21eb40[_0x1043('0x23')]][_0x24c265]);ami[_0x1043('0x1f')](_0x1043('0x56'),this[_0x1043('0x9')][_0x21eb40['uniqueid']][_0x24c265]);}}}}}}catch(_0x5304b5){logger[_0x1043('0x31')](_0x1043('0x57'),util['inspect'](_0x5304b5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1043('0x20')][_0x1043('0x16')]=function(_0x32414b){try{if(this['isNotNull'](_0x32414b)){this[_0x1043('0x58')](_0x32414b[_0x1043('0x23')],_[_0x1043('0x59')](_0x32414b['variable'])[0x0],_0x32414b[_0x1043('0x5a')]);if(this['channels'][_0x32414b[_0x1043('0x23')]]){for(var _0xd107fc in this['channels'][_0x32414b[_0x1043('0x23')]]){if(this['channels'][_0x32414b[_0x1043('0x23')]][_0x1043('0x34')](_0xd107fc)){if(_[_0x1043('0x21')](this['channels'][_0x32414b['uniqueid']][_0xd107fc][_0x1043('0x26')])){this['channels'][_0x32414b[_0x1043('0x23')]][_0xd107fc][_0x1043('0x26')]={};}this[_0x1043('0x9')][_0x32414b[_0x1043('0x23')]][_0xd107fc][_0x1043('0x26')]=this[_0x1043('0x26')][_0x32414b[_0x1043('0x23')]];}}}}}catch(_0x2a8511){logger[_0x1043('0x31')](_0x1043('0x5b'),util[_0x1043('0x33')](_0x2a8511,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1043('0x20')][_0x1043('0x58')]=function(_0x39da27,_0x3ff277,_0x4655ba){var _0x2501e6=[_0x1043('0x5c'),_0x1043('0x5d'),'rtpaudioqosjitter',_0x1043('0x5e'),'rtpaudioqosloss',_0x1043('0x5f'),_0x1043('0x60'),'rtpaudioqosrttbridged',_0x1043('0x61'),_0x1043('0x62'),_0x1043('0x63'),'bridgepvtcallid',_0x1043('0x64'),'memberdynamic',_0x1043('0x65'),'memberlastcall',_0x1043('0x2f'),'memberpenalty',_0x1043('0x66')];if(!_[_0x1043('0x67')](_0x3ff277)&&!_[_0x1043('0x68')](_0x2501e6,_0x3ff277)){if(_['isUndefined'](this[_0x1043('0x26')][_0x39da27])){this[_0x1043('0x26')][_0x39da27]={};}this[_0x1043('0x26')][_0x39da27][_0x3ff277]=_0x4655ba;}};VoiceAgentReport[_0x1043('0x20')][_0x1043('0x18')]=function(_0x171989){try{if(this[_0x1043('0x22')](_0x171989)){if(this[_0x1043('0x9')][_0x171989[_0x1043('0x23')]]){for(var _0x510feb in this[_0x1043('0x9')][_0x171989[_0x1043('0x23')]]){if(this[_0x1043('0x9')][_0x171989[_0x1043('0x23')]][_0x1043('0x34')](_0x510feb)){if(this[_0x1043('0x9')][_0x171989['uniqueid']][_0x510feb][_0x1043('0x42')]==_0x1043('0x51')&&this[_0x1043('0x9')][_0x171989[_0x1043('0x23')]][_0x510feb][_0x1043('0x4e')]){this['channels'][_0x171989['uniqueid']][_0x510feb][_0x1043('0x69')]=moment()[_0x1043('0x25')](_0x1043('0x35'));}}}ami['emit'](_0x1043('0x6a'),_['values'](this[_0x1043('0x9')][_0x171989[_0x1043('0x23')]]));delete this[_0x1043('0x9')][_0x171989['uniqueid']];}if(this['variables'][_0x171989[_0x1043('0x23')]]){delete this[_0x1043('0x26')][_0x171989[_0x1043('0x23')]];}}}catch(_0x1a6043){logger['error'](_0x1043('0x6b'),util[_0x1043('0x33')](_0x1a6043,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1043('0x20')][_0x1043('0x1d')]=function(_0x3c1a40){try{if(this[_0x1043('0x22')](_0x3c1a40)){if(this[_0x1043('0x9')][_0x3c1a40[_0x1043('0x6c')]]){for(var _0x2635d9 in this[_0x1043('0x9')][_0x3c1a40[_0x1043('0x6c')]]){if(this[_0x1043('0x9')][_0x3c1a40['transfereeuniqueid']][_0x1043('0x34')](_0x2635d9)){if(_0x3c1a40[_0x1043('0x6d')]===_0x2635d9){var _0x30d3d4=moment();this[_0x1043('0x9')][_0x3c1a40[_0x1043('0x6c')]][_0x2635d9][_0x1043('0x4e')]=!![];this[_0x1043('0x9')][_0x3c1a40[_0x1043('0x6c')]][_0x2635d9]['agentcompleteAt']=moment()['format'](_0x1043('0x35'));this[_0x1043('0x9')][_0x3c1a40[_0x1043('0x6c')]][_0x2635d9][_0x1043('0x42')]=_0x1043('0x51');this[_0x1043('0x9')][_0x3c1a40['transfereeuniqueid']][_0x2635d9][_0x1043('0x36')]='complete';this[_0x1043('0x9')][_0x3c1a40['transfereeuniqueid']][_0x2635d9][_0x1043('0x50')]=_0x30d3d4[_0x1043('0x6e')](this[_0x1043('0x9')][_0x3c1a40['transfereeuniqueid']][_0x2635d9]['agentconnectAt'],'seconds');}}}}if(this['channels'][_0x3c1a40['secondtransfereruniqueid']]){var _0x1eecb6=this[_0x1043('0x9')][_0x3c1a40[_0x1043('0x6f')]];this[_0x1043('0x9')][_0x3c1a40[_0x1043('0x6f')]]=this[_0x1043('0x9')][_0x3c1a40[_0x1043('0x6c')]];this[_0x1043('0x9')][_0x3c1a40['transfereeuniqueid']]=_0x1eecb6;}}}catch(_0x3cb18b){logger[_0x1043('0x31')](_0x1043('0x70'),util[_0x1043('0x33')](_0x3cb18b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1043('0x20')]['syncBlindTransfer']=function(_0x46249d){try{if(this[_0x1043('0x22')](_0x46249d)){if(this[_0x1043('0x9')][_0x46249d['transfereeuniqueid']]){for(var _0x486ae8 in this['channels'][_0x46249d[_0x1043('0x6c')]]){if(this[_0x1043('0x9')][_0x46249d['transfereeuniqueid']][_0x1043('0x34')](_0x486ae8)){if(_0x46249d[_0x1043('0x71')]===_0x486ae8){var _0xeb5cc0=moment();this['channels'][_0x46249d[_0x1043('0x6c')]][_0x486ae8][_0x1043('0x4e')]=!![];this['channels'][_0x46249d[_0x1043('0x6c')]][_0x486ae8][_0x1043('0x69')]=_0xeb5cc0;this['channels'][_0x46249d[_0x1043('0x6c')]][_0x486ae8]['reason']=_0x1043('0x51');this[_0x1043('0x9')][_0x46249d[_0x1043('0x6c')]][_0x486ae8]['lastevent']=_0x1043('0x4f');this['channels'][_0x46249d[_0x1043('0x6c')]][_0x486ae8][_0x1043('0x50')]=_0xeb5cc0['diff'](this['channels'][_0x46249d[_0x1043('0x6c')]][_0x486ae8][_0x1043('0x4d')],'seconds');}}}}}}catch(_0x588310){logger[_0x1043('0x31')](_0x1043('0x72'),util['inspect'](_0x588310,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1043('0x20')][_0x1043('0x1a')]=function(_0xa0f35a){var _0x3281bd='';try{if(this['isNotNull'](_0xa0f35a)){if(_0xa0f35a[_0x1043('0x73')]){_0x3281bd=_0xa0f35a['channel'][_0x1043('0x74')](0x0,_0xa0f35a['channel'][_0x1043('0x75')]('-'));if(this[_0x1043('0x3d')][_0x3281bd]){this['agents'][_0x3281bd][_0x1043('0x76')]=!![];}}}}catch(_0x2f8565){logger[_0x1043('0x31')](_0x1043('0x77'),util[_0x1043('0x33')](_0x2f8565,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1043('0x1b')]=function(_0x445812){var _0x1275b5='';try{if(this[_0x1043('0x22')](_0x445812)){if(_0x445812[_0x1043('0x73')]){_0x1275b5=_0x445812[_0x1043('0x73')][_0x1043('0x74')](0x0,_0x445812[_0x1043('0x73')]['lastIndexOf']('-'));if(this['agents'][_0x1275b5]){this[_0x1043('0x3d')][_0x1275b5][_0x1043('0x76')]=![];}}}}catch(_0x21b7ce){logger[_0x1043('0x31')](_0x1043('0x78'),util[_0x1043('0x33')](_0x21b7ce,{'showHidden':![],'depth':null}));}};module[_0x1043('0x79')]=VoiceAgentReport; \ No newline at end of file +var _0xfdf7=['user:%s','membername','error','inspect','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','user:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','custom:agentringnoanswer','hasOwnProperty','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','complete','talktime','transfer','agent','acw','acwtime','interface','destconnectedlinenum','user:agentcomplete','custom:agentcomplete','addVariable','keys','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','syncAttendedTransfer','transfereeuniqueid','diff','seconds','secondtransfereruniqueid','syncBlindTransfer','transfereruniqueid','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStop][VoiceAgentReport]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','voiceQueues','agents','variables','syncAgentCalled','syncAgentConnect','bind','agentringnoanswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','blindtransfer','prototype','emit','isUndefined','isNotNull','channels','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','event','privilege'];(function(_0x411e71,_0xf9652){var _0x226ae3=function(_0x1339f6){while(--_0x1339f6){_0x411e71['push'](_0x411e71['shift']());}};_0x226ae3(++_0xf9652);}(_0xfdf7,0x129));var _0x7fdf=function(_0x3be43b,_0x3c10b3){_0x3be43b=_0x3be43b-0x0;var _0x2dc567=_0xfdf7[_0x3be43b];return _0x2dc567;};'use strict';var _=require(_0x7fdf('0x0'));var moment=require(_0x7fdf('0x1'));var util=require(_0x7fdf('0x2'));var Redis=require(_0x7fdf('0x3'));var config=require(_0x7fdf('0x4'));var logger=require(_0x7fdf('0x5'))(_0x7fdf('0x6'));var ami=require(_0x7fdf('0x7'));config[_0x7fdf('0x8')]=_['defaults'](config['redis'],{'host':_0x7fdf('0x9'),'port':0x18eb});var io=require(_0x7fdf('0xa'))(new Redis(config[_0x7fdf('0x8')]));function VoiceAgentReport(_0x290b2a){this['channels']={};this[_0x7fdf('0xb')]=_0x290b2a[_0x7fdf('0xb')];this[_0x7fdf('0xc')]=_0x290b2a[_0x7fdf('0xc')];this[_0x7fdf('0xd')]={};ami['on']('agentcalled',this[_0x7fdf('0xe')]['bind'](this));ami['on']('agentconnect',this[_0x7fdf('0xf')][_0x7fdf('0x10')](this));ami['on'](_0x7fdf('0x11'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x7fdf('0x12'),this['syncQueueCallerAbandon'][_0x7fdf('0x10')](this));ami['on'](_0x7fdf('0x13'),this[_0x7fdf('0x14')][_0x7fdf('0x10')](this));ami['on'](_0x7fdf('0x15'),this[_0x7fdf('0x16')]['bind'](this));ami['on']('hangup',this[_0x7fdf('0x17')][_0x7fdf('0x10')](this));ami['on']('musiconholdstart',this[_0x7fdf('0x18')][_0x7fdf('0x10')](this));ami['on'](_0x7fdf('0x19'),this[_0x7fdf('0x1a')][_0x7fdf('0x10')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x7fdf('0x1b'),this['syncBlindTransfer'][_0x7fdf('0x10')](this));}VoiceAgentReport[_0x7fdf('0x1c')][_0x7fdf('0x1d')]=function(_0x465a81,_0x1c7a4d,_0x1c41cb){io['to'](_0x465a81)[_0x7fdf('0x1d')](_0x1c7a4d,_0x1c41cb);};VoiceAgentReport[_0x7fdf('0x1c')]['isNotNull']=function(_0x521c78){return _0x521c78!==null&&!_[_0x7fdf('0x1e')](_0x521c78);};VoiceAgentReport[_0x7fdf('0x1c')]['syncAgentCalled']=function(_0x38bab8){try{if(this[_0x7fdf('0x1f')](_0x38bab8)){if(_['isUndefined'](this[_0x7fdf('0x20')][_0x38bab8[_0x7fdf('0x21')]])){this[_0x7fdf('0x20')][_0x38bab8['uniqueid']]={};}if(_[_0x7fdf('0x1e')](this['channels'][_0x38bab8[_0x7fdf('0x21')]][_0x38bab8[_0x7fdf('0x22')]])){this['channels'][_0x38bab8[_0x7fdf('0x21')]][_0x38bab8['destuniqueid']]={'agentcalledAt':moment()[_0x7fdf('0x23')](_0x7fdf('0x24')),'lastevent':_0x7fdf('0x25'),'variables':this[_0x7fdf('0xd')][_0x38bab8[_0x7fdf('0x21')]],'type':this[_0x7fdf('0xb')][_0x38bab8[_0x7fdf('0x26')]]?this['voiceQueues'][_0x38bab8[_0x7fdf('0x26')]][_0x7fdf('0x27')]||_0x7fdf('0x28'):_0x7fdf('0x28')};}_[_0x7fdf('0x29')](this[_0x7fdf('0x20')][_0x38bab8[_0x7fdf('0x21')]][_0x38bab8['destuniqueid']],_[_0x7fdf('0x2a')](_0x38bab8,[_0x7fdf('0x2b'),_0x7fdf('0x2c')]));ami[_0x7fdf('0x1d')]('custom:agentcalled',this[_0x7fdf('0x20')][_0x38bab8[_0x7fdf('0x21')]][_0x38bab8['destuniqueid']]);this['emit'](util[_0x7fdf('0x23')](_0x7fdf('0x2d'),_0x38bab8[_0x7fdf('0x2e')]),'user:called',this['channels'][_0x38bab8[_0x7fdf('0x21')]][_0x38bab8[_0x7fdf('0x22')]]);}}catch(_0x28018e){logger[_0x7fdf('0x2f')]('[syncAgentCalled][VoiceAgentReport]',util[_0x7fdf('0x30')](_0x28018e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7fdf('0x1c')][_0x7fdf('0xf')]=function(_0x4a8afc){try{if(this[_0x7fdf('0x1f')](_0x4a8afc)){if(this[_0x7fdf('0x20')][_0x4a8afc[_0x7fdf('0x21')]]){for(var _0x5cd174 in this[_0x7fdf('0x20')][_0x4a8afc[_0x7fdf('0x21')]]){if(this[_0x7fdf('0x20')][_0x4a8afc[_0x7fdf('0x21')]]['hasOwnProperty'](_0x5cd174)){if(_0x4a8afc['destuniqueid']===_0x5cd174){this[_0x7fdf('0x20')][_0x4a8afc['uniqueid']][_0x5cd174][_0x7fdf('0x31')]=moment()[_0x7fdf('0x23')](_0x7fdf('0x24'));this['channels'][_0x4a8afc[_0x7fdf('0x21')]][_0x5cd174][_0x7fdf('0x32')]=_0x7fdf('0x33');this[_0x7fdf('0x20')][_0x4a8afc[_0x7fdf('0x21')]][_0x5cd174][_0x7fdf('0x34')]=_0x4a8afc[_0x7fdf('0x34')];this[_0x7fdf('0x20')][_0x4a8afc['uniqueid']][_0x5cd174][_0x7fdf('0x35')]=_0x4a8afc['connectedlinenum'];this['channels'][_0x4a8afc[_0x7fdf('0x21')]][_0x5cd174][_0x7fdf('0x36')]=_0x4a8afc[_0x7fdf('0x36')];this[_0x7fdf('0x20')][_0x4a8afc[_0x7fdf('0x21')]][_0x5cd174][_0x7fdf('0x37')]=_0x4a8afc[_0x7fdf('0x37')];this[_0x7fdf('0x20')][_0x4a8afc['uniqueid']][_0x5cd174][_0x7fdf('0x38')]=_0x4a8afc['destchannelstatedesc'];_[_0x7fdf('0x29')](this[_0x7fdf('0xc')][_0x4a8afc['interface']],_['pick'](_0x4a8afc,[_0x7fdf('0x26'),'destconnectedlinenum']));this['emit'](util['format']('user:%s',_0x4a8afc['membername']),_0x7fdf('0x39'),this[_0x7fdf('0x20')][_0x4a8afc[_0x7fdf('0x21')]][_0x4a8afc[_0x7fdf('0x22')]]);ami['emit']('custom:agentconnect',this[_0x7fdf('0x20')][_0x4a8afc[_0x7fdf('0x21')]][_0x5cd174]);}else if(!this[_0x7fdf('0x20')][_0x4a8afc[_0x7fdf('0x21')]][_0x5cd174][_0x7fdf('0x11')]&&!this['channels'][_0x4a8afc[_0x7fdf('0x21')]][_0x5cd174][_0x7fdf('0x13')]){this[_0x7fdf('0x20')][_0x4a8afc[_0x7fdf('0x21')]][_0x5cd174][_0x7fdf('0x11')]=!![];this[_0x7fdf('0x20')][_0x4a8afc[_0x7fdf('0x21')]][_0x5cd174][_0x7fdf('0x3a')]=moment()[_0x7fdf('0x23')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7fdf('0x20')][_0x4a8afc[_0x7fdf('0x21')]][_0x5cd174][_0x7fdf('0x3b')]=_0x7fdf('0x3c');this[_0x7fdf('0x20')][_0x4a8afc[_0x7fdf('0x21')]][_0x5cd174][_0x7fdf('0x32')]=_0x7fdf('0x3c');this['channels'][_0x4a8afc[_0x7fdf('0x21')]][_0x5cd174]['answeredelsewheredestinationuniqueid']=_0x4a8afc[_0x7fdf('0x22')];this[_0x7fdf('0x20')][_0x4a8afc[_0x7fdf('0x21')]][_0x5cd174]['answeredelsewheremembername']=_0x4a8afc['membername'];ami[_0x7fdf('0x1d')](_0x7fdf('0x3d'),this[_0x7fdf('0x20')][_0x4a8afc[_0x7fdf('0x21')]][_0x5cd174]);}}}}}}catch(_0x15a605){logger[_0x7fdf('0x2f')](_0x7fdf('0x3e'),util['inspect'](_0x15a605,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x29aec3){try{if(this[_0x7fdf('0x1f')](_0x29aec3)){if(this['channels'][_0x29aec3[_0x7fdf('0x21')]]&&this['channels'][_0x29aec3[_0x7fdf('0x21')]][_0x29aec3[_0x7fdf('0x22')]]){this['channels'][_0x29aec3[_0x7fdf('0x21')]][_0x29aec3[_0x7fdf('0x22')]][_0x7fdf('0x11')]=!![];this['channels'][_0x29aec3[_0x7fdf('0x21')]][_0x29aec3[_0x7fdf('0x22')]][_0x7fdf('0x3a')]=moment()['format'](_0x7fdf('0x24'));this[_0x7fdf('0x20')][_0x29aec3[_0x7fdf('0x21')]][_0x29aec3[_0x7fdf('0x22')]][_0x7fdf('0x3b')]='rejected';this['channels'][_0x29aec3[_0x7fdf('0x21')]][_0x29aec3[_0x7fdf('0x22')]][_0x7fdf('0x32')]='rejected';ami[_0x7fdf('0x1d')](_0x7fdf('0x3f'),this[_0x7fdf('0x20')][_0x29aec3[_0x7fdf('0x21')]][_0x29aec3[_0x7fdf('0x22')]]);}}}catch(_0x27b4d3){logger[_0x7fdf('0x2f')]('[syncAgentRingNoAnswer][VoiceAgentReport]',util[_0x7fdf('0x30')](_0x27b4d3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7fdf('0x1c')]['syncQueueCallerAbandon']=function(_0xcb80ed){try{if(this[_0x7fdf('0x1f')](_0xcb80ed)){if(this[_0x7fdf('0x20')][_0xcb80ed[_0x7fdf('0x21')]]){for(var _0x404556 in this[_0x7fdf('0x20')][_0xcb80ed[_0x7fdf('0x21')]]){if(this[_0x7fdf('0x20')][_0xcb80ed[_0x7fdf('0x21')]][_0x7fdf('0x40')](_0x404556)&&!this['channels'][_0xcb80ed[_0x7fdf('0x21')]][_0x404556][_0x7fdf('0x11')]&&!this[_0x7fdf('0x20')][_0xcb80ed[_0x7fdf('0x21')]][_0x404556][_0x7fdf('0x13')]){this[_0x7fdf('0x20')][_0xcb80ed[_0x7fdf('0x21')]][_0x404556][_0x7fdf('0x11')]=!![];this['channels'][_0xcb80ed[_0x7fdf('0x21')]][_0x404556]['agentringnoanswerAt']=moment()[_0x7fdf('0x23')](_0x7fdf('0x24'));this[_0x7fdf('0x20')][_0xcb80ed[_0x7fdf('0x21')]][_0x404556][_0x7fdf('0x3b')]=_0x7fdf('0x41');this['channels'][_0xcb80ed['uniqueid']][_0x404556][_0x7fdf('0x32')]=_0x7fdf('0x41');ami[_0x7fdf('0x1d')](_0x7fdf('0x42'),this[_0x7fdf('0x20')][_0xcb80ed['uniqueid']][_0x404556]);}}}}}catch(_0x4dd8c6){logger[_0x7fdf('0x2f')](_0x7fdf('0x43'),util[_0x7fdf('0x30')](_0x4dd8c6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7fdf('0x1c')][_0x7fdf('0x14')]=function(_0x1e74cb){try{if(this[_0x7fdf('0x1f')](_0x1e74cb)){if(this['channels'][_0x1e74cb['uniqueid']]){for(var _0x4c1932 in this[_0x7fdf('0x20')][_0x1e74cb['uniqueid']]){if(this[_0x7fdf('0x20')][_0x1e74cb['uniqueid']][_0x7fdf('0x40')](_0x4c1932)){if(this[_0x7fdf('0x20')][_0x1e74cb[_0x7fdf('0x21')]][_0x4c1932][_0x7fdf('0x31')]&&!this[_0x7fdf('0x20')][_0x1e74cb[_0x7fdf('0x21')]][_0x4c1932][_0x7fdf('0x13')]){this[_0x7fdf('0x20')][_0x1e74cb[_0x7fdf('0x21')]][_0x4c1932][_0x7fdf('0x13')]=!![];this[_0x7fdf('0x20')][_0x1e74cb[_0x7fdf('0x21')]][_0x4c1932][_0x7fdf('0x44')]=moment()[_0x7fdf('0x23')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7fdf('0x20')][_0x1e74cb[_0x7fdf('0x21')]][_0x4c1932][_0x7fdf('0x32')]=_0x7fdf('0x45');this[_0x7fdf('0x20')][_0x1e74cb[_0x7fdf('0x21')]][_0x4c1932][_0x7fdf('0x46')]=_0x1e74cb['talktime'];this[_0x7fdf('0x20')][_0x1e74cb[_0x7fdf('0x21')]][_0x4c1932][_0x7fdf('0x3b')]=_0x1e74cb['reason']==_0x7fdf('0x47')?_0x7fdf('0x48'):_0x1e74cb['reason'];if(this['voiceQueues'][_0x1e74cb[_0x7fdf('0x26')]]&&this[_0x7fdf('0xb')][_0x1e74cb[_0x7fdf('0x26')]][_0x7fdf('0x49')]){this[_0x7fdf('0x20')][_0x1e74cb['uniqueid']][_0x4c1932]['agentacw']=!![];this[_0x7fdf('0x20')][_0x1e74cb[_0x7fdf('0x21')]][_0x4c1932][_0x7fdf('0x4a')]=this[_0x7fdf('0xb')][_0x1e74cb[_0x7fdf('0x26')]]['acwTimeout'];}this['agents'][_0x1e74cb['interface']]=_[_0x7fdf('0x2a')](this[_0x7fdf('0xc')][_0x1e74cb[_0x7fdf('0x4b')]],[_0x7fdf('0x26'),_0x7fdf('0x4c')]);this['emit'](util[_0x7fdf('0x23')](_0x7fdf('0x2d'),_0x1e74cb[_0x7fdf('0x2e')]),_0x7fdf('0x4d'),this['channels'][_0x1e74cb[_0x7fdf('0x21')]][_0x4c1932]);ami[_0x7fdf('0x1d')](_0x7fdf('0x4e'),this['channels'][_0x1e74cb[_0x7fdf('0x21')]][_0x4c1932]);}}}}}}catch(_0x542046){logger[_0x7fdf('0x2f')]('[syncAgentComplete][VoiceAgentReport]',util[_0x7fdf('0x30')](_0x542046,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7fdf('0x1c')]['syncVarSet']=function(_0x4fae2d){try{if(this[_0x7fdf('0x1f')](_0x4fae2d)){this[_0x7fdf('0x4f')](_0x4fae2d['uniqueid'],_[_0x7fdf('0x50')](_0x4fae2d['variable'])[0x0],_0x4fae2d[_0x7fdf('0x51')]);if(this[_0x7fdf('0x20')][_0x4fae2d['uniqueid']]){for(var _0x383be4 in this['channels'][_0x4fae2d[_0x7fdf('0x21')]]){if(this['channels'][_0x4fae2d[_0x7fdf('0x21')]][_0x7fdf('0x40')](_0x383be4)){if(_[_0x7fdf('0x1e')](this['channels'][_0x4fae2d['uniqueid']][_0x383be4][_0x7fdf('0xd')])){this[_0x7fdf('0x20')][_0x4fae2d[_0x7fdf('0x21')]][_0x383be4][_0x7fdf('0xd')]={};}this[_0x7fdf('0x20')][_0x4fae2d['uniqueid']][_0x383be4][_0x7fdf('0xd')]=this['variables'][_0x4fae2d[_0x7fdf('0x21')]];}}}}}catch(_0x4359c0){logger[_0x7fdf('0x2f')](_0x7fdf('0x52'),util[_0x7fdf('0x30')](_0x4359c0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7fdf('0x1c')]['addVariable']=function(_0x599a53,_0x1ff995,_0x2b18b5){var _0x2f44ed=[_0x7fdf('0x53'),_0x7fdf('0x54'),_0x7fdf('0x55'),_0x7fdf('0x56'),_0x7fdf('0x57'),_0x7fdf('0x58'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x7fdf('0x59'),_0x7fdf('0x5a'),'bridgepeer','bridgepvtcallid',_0x7fdf('0x5b'),_0x7fdf('0x5c'),_0x7fdf('0x5d'),_0x7fdf('0x5e'),_0x7fdf('0x2e'),_0x7fdf('0x5f'),_0x7fdf('0x60')];if(!_[_0x7fdf('0x61')](_0x1ff995)&&!_[_0x7fdf('0x62')](_0x2f44ed,_0x1ff995)){if(_[_0x7fdf('0x1e')](this['variables'][_0x599a53])){this[_0x7fdf('0xd')][_0x599a53]={};}this[_0x7fdf('0xd')][_0x599a53][_0x1ff995]=_0x2b18b5;}};VoiceAgentReport[_0x7fdf('0x1c')]['syncHangup']=function(_0x481c2a){try{if(this['isNotNull'](_0x481c2a)){if(this['channels'][_0x481c2a[_0x7fdf('0x21')]]){for(var _0x8a10d1 in this['channels'][_0x481c2a[_0x7fdf('0x21')]]){if(this[_0x7fdf('0x20')][_0x481c2a[_0x7fdf('0x21')]][_0x7fdf('0x40')](_0x8a10d1)){if(this[_0x7fdf('0x20')][_0x481c2a[_0x7fdf('0x21')]][_0x8a10d1][_0x7fdf('0x3b')]==_0x7fdf('0x47')&&this[_0x7fdf('0x20')][_0x481c2a[_0x7fdf('0x21')]][_0x8a10d1]['agentcomplete']){this[_0x7fdf('0x20')][_0x481c2a[_0x7fdf('0x21')]][_0x8a10d1][_0x7fdf('0x44')]=moment()[_0x7fdf('0x23')](_0x7fdf('0x24'));}}}ami[_0x7fdf('0x1d')](_0x7fdf('0x63'),_[_0x7fdf('0x64')](this[_0x7fdf('0x20')][_0x481c2a[_0x7fdf('0x21')]]));delete this['channels'][_0x481c2a[_0x7fdf('0x21')]];}if(this[_0x7fdf('0xd')][_0x481c2a[_0x7fdf('0x21')]]){delete this[_0x7fdf('0xd')][_0x481c2a[_0x7fdf('0x21')]];}}}catch(_0x30b446){logger['error'](_0x7fdf('0x65'),util[_0x7fdf('0x30')](_0x30b446,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7fdf('0x1c')][_0x7fdf('0x66')]=function(_0x28b22a){try{if(this[_0x7fdf('0x1f')](_0x28b22a)){if(this[_0x7fdf('0x20')][_0x28b22a['transfereeuniqueid']]){for(var _0x1189ee in this[_0x7fdf('0x20')][_0x28b22a['transfereeuniqueid']]){if(this[_0x7fdf('0x20')][_0x28b22a['transfereeuniqueid']][_0x7fdf('0x40')](_0x1189ee)){if(_0x28b22a['origtransfereruniqueid']===_0x1189ee){var _0x3b2d86=moment();this[_0x7fdf('0x20')][_0x28b22a[_0x7fdf('0x67')]][_0x1189ee][_0x7fdf('0x13')]=!![];this[_0x7fdf('0x20')][_0x28b22a[_0x7fdf('0x67')]][_0x1189ee][_0x7fdf('0x44')]=moment()[_0x7fdf('0x23')](_0x7fdf('0x24'));this[_0x7fdf('0x20')][_0x28b22a[_0x7fdf('0x67')]][_0x1189ee]['reason']=_0x7fdf('0x47');this['channels'][_0x28b22a['transfereeuniqueid']][_0x1189ee][_0x7fdf('0x32')]=_0x7fdf('0x45');this[_0x7fdf('0x20')][_0x28b22a[_0x7fdf('0x67')]][_0x1189ee][_0x7fdf('0x46')]=_0x3b2d86[_0x7fdf('0x68')](this['channels'][_0x28b22a['transfereeuniqueid']][_0x1189ee][_0x7fdf('0x31')],_0x7fdf('0x69'));}}}}if(this[_0x7fdf('0x20')][_0x28b22a[_0x7fdf('0x6a')]]){var _0x1d2a5f=this[_0x7fdf('0x20')][_0x28b22a[_0x7fdf('0x6a')]];this[_0x7fdf('0x20')][_0x28b22a[_0x7fdf('0x6a')]]=this[_0x7fdf('0x20')][_0x28b22a[_0x7fdf('0x67')]];this[_0x7fdf('0x20')][_0x28b22a[_0x7fdf('0x67')]]=_0x1d2a5f;}}}catch(_0xe577f4){logger[_0x7fdf('0x2f')]('[syncAttendedTransfer][VoiceAgentReport]',util['inspect'](_0xe577f4,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7fdf('0x6b')]=function(_0x15720f){try{if(this[_0x7fdf('0x1f')](_0x15720f)){if(this[_0x7fdf('0x20')][_0x15720f[_0x7fdf('0x67')]]){for(var _0x330ffb in this[_0x7fdf('0x20')][_0x15720f[_0x7fdf('0x67')]]){if(this[_0x7fdf('0x20')][_0x15720f[_0x7fdf('0x67')]][_0x7fdf('0x40')](_0x330ffb)){if(_0x15720f[_0x7fdf('0x6c')]===_0x330ffb){var _0x1e3459=moment();this[_0x7fdf('0x20')][_0x15720f[_0x7fdf('0x67')]][_0x330ffb][_0x7fdf('0x13')]=!![];this['channels'][_0x15720f[_0x7fdf('0x67')]][_0x330ffb][_0x7fdf('0x44')]=_0x1e3459;this[_0x7fdf('0x20')][_0x15720f['transfereeuniqueid']][_0x330ffb][_0x7fdf('0x3b')]=_0x7fdf('0x47');this[_0x7fdf('0x20')][_0x15720f['transfereeuniqueid']][_0x330ffb]['lastevent']=_0x7fdf('0x45');this['channels'][_0x15720f[_0x7fdf('0x67')]][_0x330ffb][_0x7fdf('0x46')]=_0x1e3459['diff'](this[_0x7fdf('0x20')][_0x15720f[_0x7fdf('0x67')]][_0x330ffb]['agentconnectAt'],'seconds');}}}}}}catch(_0x332d99){logger[_0x7fdf('0x2f')]('[syncBlindTransfer][VoiceAgentReport]',util[_0x7fdf('0x30')](_0x332d99,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7fdf('0x1c')]['syncMusicOnHoldStart']=function(_0x39470d){var _0x4ff054='';try{if(this[_0x7fdf('0x1f')](_0x39470d)){if(_0x39470d[_0x7fdf('0x6d')]){_0x4ff054=_0x39470d[_0x7fdf('0x6d')][_0x7fdf('0x6e')](0x0,_0x39470d['channel'][_0x7fdf('0x6f')]('-'));if(this[_0x7fdf('0xc')][_0x4ff054]){this[_0x7fdf('0xc')][_0x4ff054][_0x7fdf('0x70')]=!![];}}}}catch(_0xd27ee7){logger[_0x7fdf('0x2f')]('[syncMusicOnHoldStart][VoiceAgentReport]',util[_0x7fdf('0x30')](_0xd27ee7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7fdf('0x1c')][_0x7fdf('0x1a')]=function(_0x420743){var _0x1f138b='';try{if(this[_0x7fdf('0x1f')](_0x420743)){if(_0x420743[_0x7fdf('0x6d')]){_0x1f138b=_0x420743[_0x7fdf('0x6d')][_0x7fdf('0x6e')](0x0,_0x420743[_0x7fdf('0x6d')][_0x7fdf('0x6f')]('-'));if(this['agents'][_0x1f138b]){this['agents'][_0x1f138b][_0x7fdf('0x70')]=![];}}}}catch(_0x57fcde){logger[_0x7fdf('0x2f')](_0x7fdf('0x71'),util[_0x7fdf('0x30')](_0x57fcde,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 0974889..45dae1c 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 _0xf734=['[syncMusicOnHoldStart][VoiceCallReport]','[syncMusicOnHoldStop][VoiceCallReport]','exports','moment','util','path','ioredis','../../../config/logger','../ami','unknown','not_inuse','busy','invalid','unavailable','ringing','onhold','queue','agi','playback','voicemail','NO\x20ANSWER','BUSY','FAILED','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newstate','varset','syncVarSet','hangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','log','prototype','isUndefined','emit','isNotNull','uniqueid','linkedid','merge','pick','error','[syncNewCallerId][VoiceCallReport]','channel','OutgoingSpoolFailed','format','YYYY-MM-DD\x20HH:mm:ss','disposition','keys','context','from-sip','split','destconnectedlinenum','exten','name','accountcode','[syncNewChannel][VoiceCallReport]','inspect','application','toLowerCase','applicationdata','starttime','subtract','duration','seconds','includes','set','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','channelstate','answertime','diff','xcally-motion-preview','calleridnum','connectedlinename','calleridname','destinationchannel','toNumber','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','.WAV','find','monitors','isNil','push','rec','variable','mixmonitor_filename','value','xmd-phone','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','destination','xmd-callerid-preview','calleridpreview','sipcalluniqueid','sipcallid','[syncVarSet][VoiceCallReport]','syncHangup','billableseconds','holdtime','user:%s','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransferercalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','extension','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime'];(function(_0x3e61d4,_0x224d2d){var _0x40bd4e=function(_0x21432f){while(--_0x21432f){_0x3e61d4['push'](_0x3e61d4['shift']());}};_0x40bd4e(++_0x224d2d);}(_0xf734,0x129));var _0x4f73=function(_0xaedd5c,_0x230c89){_0xaedd5c=_0xaedd5c-0x0;var _0x330946=_0xf734[_0xaedd5c];return _0x330946;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var moment=require(_0x4f73('0x0'));var util=require(_0x4f73('0x1'));var path=require(_0x4f73('0x2'));var Redis=require(_0x4f73('0x3'));var config=require('../../../config/environment');var logger=require(_0x4f73('0x4'))('ami');var ami=require(_0x4f73('0x5'));var Channel=require('../model/channel');var statusDesc=[_0x4f73('0x6'),_0x4f73('0x7'),'inuse',_0x4f73('0x8'),_0x4f73('0x9'),_0x4f73('0xa'),_0x4f73('0xb'),'ringinuse',_0x4f73('0xc')];var applications=['set',_0x4f73('0xd'),_0x4f73('0xe'),'dial',_0x4f73('0xf'),_0x4f73('0x10')];var dispositions=['NO\x20ANSWER','FAILED','FAILED',_0x4f73('0x11'),_0x4f73('0x11'),_0x4f73('0x11'),'ANSWERED',_0x4f73('0x12'),'FAILED',_0x4f73('0x13'),_0x4f73('0x13')];var actions={};config[_0x4f73('0x14')]=_[_0x4f73('0x15')](config[_0x4f73('0x14')],{'host':_0x4f73('0x16'),'port':0x18eb});var io=require(_0x4f73('0x17'))(new Redis(config[_0x4f73('0x14')]));function VoiceCallReport(_0x2eb5ce){this[_0x4f73('0x18')]=_0x2eb5ce['channels'];this['agents']=_0x2eb5ce[_0x4f73('0x19')];ami['on'](_0x4f73('0x1a'),this[_0x4f73('0x1b')][_0x4f73('0x1c')](this));ami['on'](_0x4f73('0x1d'),this['syncNewExten'][_0x4f73('0x1c')](this));ami['on']('newchannel',this['syncNewChannel'][_0x4f73('0x1c')](this));ami['on'](_0x4f73('0x1e'),this['syncNewState']['bind'](this));ami['on'](_0x4f73('0x1f'),this[_0x4f73('0x20')][_0x4f73('0x1c')](this));ami['on'](_0x4f73('0x21'),this['syncHangup'][_0x4f73('0x1c')](this));ami['on']('newcallerid',this[_0x4f73('0x22')][_0x4f73('0x1c')](this));ami['on'](_0x4f73('0x23'),this[_0x4f73('0x24')][_0x4f73('0x1c')](this));ami['on'](_0x4f73('0x25'),this[_0x4f73('0x26')]['bind'](this));ami['on'](_0x4f73('0x27'),this[_0x4f73('0x28')][_0x4f73('0x1c')](this));ami['on'](_0x4f73('0x29'),this[_0x4f73('0x2a')][_0x4f73('0x1c')](this));return BPromise[_0x4f73('0x2b')]()[_0x4f73('0x2c')](ami[_0x4f73('0x2d')]())[_0x4f73('0x2e')](function(_0x31e60b){console[_0x4f73('0x2f')](_0x31e60b);});}VoiceCallReport[_0x4f73('0x30')]['isNotNull']=function(_0x44321a){return _0x44321a!==null&&!_[_0x4f73('0x31')](_0x44321a);};VoiceCallReport['prototype'][_0x4f73('0x32')]=function(_0x38f662,_0x3de107,_0x524ee3){io['to'](_0x38f662)['emit'](_0x3de107,_0x524ee3);};VoiceCallReport[_0x4f73('0x30')][_0x4f73('0x22')]=function(_0x86f938){try{if(this[_0x4f73('0x33')](_0x86f938)){if(_0x86f938[_0x4f73('0x34')]===_0x86f938[_0x4f73('0x35')]){if(!_[_0x4f73('0x31')](this[_0x4f73('0x18')][_0x86f938[_0x4f73('0x34')]])){_[_0x4f73('0x36')](this[_0x4f73('0x18')][_0x86f938['uniqueid']],_[_0x4f73('0x37')](_0x86f938,_['keys'](this[_0x4f73('0x18')][_0x86f938[_0x4f73('0x34')]])));}}}}catch(_0x2abd11){logger[_0x4f73('0x38')](_0x4f73('0x39'),util['inspect'](_0x2abd11,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4f73('0x30')]['syncNewChannel']=function(_0x3a6796){try{if(this[_0x4f73('0x33')](_0x3a6796)){if(_0x3a6796[_0x4f73('0x34')]===_0x3a6796[_0x4f73('0x35')]&&_0x3a6796[_0x4f73('0x3a')]!=_0x4f73('0x3b')){if(_['isUndefined'](this['channels'][_0x3a6796[_0x4f73('0x34')]])){this[_0x4f73('0x18')][_0x3a6796[_0x4f73('0x34')]]=new Channel();this[_0x4f73('0x18')][_0x3a6796[_0x4f73('0x34')]]['starttime']=moment()[_0x4f73('0x3c')](_0x4f73('0x3d'));this[_0x4f73('0x18')][_0x3a6796[_0x4f73('0x34')]][_0x4f73('0x3e')]=dispositions[_['toNumber'](_0x3a6796['channelstate'])];_['merge'](this['channels'][_0x3a6796[_0x4f73('0x34')]],_['pick'](_0x3a6796,_[_0x4f73('0x3f')](this[_0x4f73('0x18')][_0x3a6796[_0x4f73('0x34')]])));if(_0x3a6796[_0x4f73('0x40')]===_0x4f73('0x41')){if(this['agents'][_0x3a6796[_0x4f73('0x3a')][_0x4f73('0x42')]('-')[0x0]]){this[_0x4f73('0x19')][_0x3a6796['channel'][_0x4f73('0x42')]('-')[0x0]][_0x4f73('0x43')]=_0x3a6796[_0x4f73('0x44')];this[_0x4f73('0x32')](util[_0x4f73('0x3c')]('user:%s',this[_0x4f73('0x19')][_0x3a6796[_0x4f73('0x3a')][_0x4f73('0x42')]('-')[0x0]][_0x4f73('0x45')]),'user:agentconnect',{'destaccountcode':this[_0x4f73('0x19')][_0x3a6796[_0x4f73('0x3a')][_0x4f73('0x42')]('-')[0x0]][_0x4f73('0x46')],'destconnectedlinenum':_0x3a6796[_0x4f73('0x44')]});}}}}}}catch(_0x522216){logger['error'](_0x4f73('0x47'),util[_0x4f73('0x48')](_0x522216,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4f73('0x1b')]=function(_0x108165){try{if(this[_0x4f73('0x33')](_0x108165)){if(_0x108165['uniqueid']===_0x108165['linkedid']&&_0x108165[_0x4f73('0x44')]!='h'&&_0x108165[_0x4f73('0x3a')]!=_0x4f73('0x3b')){_0x108165[_0x4f73('0x49')]=_0x108165[_0x4f73('0x49')][_0x4f73('0x4a')]();_0x108165[_0x4f73('0x4b')]=(_0x108165['appdata']||_0x108165[_0x4f73('0x4b')])[_0x4f73('0x4a')]();if(_[_0x4f73('0x31')](this['channels'][_0x108165[_0x4f73('0x34')]])){this[_0x4f73('0x18')][_0x108165['uniqueid']]=new Channel();this[_0x4f73('0x18')][_0x108165['uniqueid']][_0x4f73('0x4c')]=_0x108165['duration']?moment()[_0x4f73('0x4d')](moment[_0x4f73('0x4e')](_0x108165[_0x4f73('0x4e')])['seconds'](),_0x4f73('0x4f'))[_0x4f73('0x3c')](_0x4f73('0x3d')):moment()[_0x4f73('0x3c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4f73('0x18')][_0x108165['uniqueid']]['disposition']=_0x4f73('0x11');}_[_0x4f73('0x36')](this[_0x4f73('0x18')][_0x108165[_0x4f73('0x34')]],_[_0x4f73('0x37')](_0x108165,_[_0x4f73('0x3f')](this[_0x4f73('0x18')][_0x108165['uniqueid']])));if(_[_0x4f73('0x50')](applications,_0x108165[_0x4f73('0x49')])){this[_0x4f73('0x18')][_0x108165['uniqueid']]['lastapplication']=_0x108165['application'];this[_0x4f73('0x18')][_0x108165['uniqueid']]['lastdata']=_0x108165[_0x4f73('0x4b')];if(_0x108165['application']===_0x4f73('0x51')&&_[_0x4f73('0x52')](_0x108165[_0x4f73('0x4b')],_0x4f73('0x53'))){var _0x14bf6d=_0x108165[_0x4f73('0x4b')]['split']('=');var _0x50eb66=_0x14bf6d[0x0][_0x4f73('0x54')](/cdr\((.*)\)/);if(_0x50eb66){this[_0x4f73('0x18')][_0x108165[_0x4f73('0x34')]][_0x50eb66[0x1]]=_0x14bf6d[0x1];}}else if(_0x108165[_0x4f73('0x49')]===_0x4f73('0xd')){this[_0x4f73('0x18')][_0x108165['uniqueid']][_0x4f73('0xd')]=_0x108165['applicationdata'][_0x4f73('0x42')](',')[0x0];}}}}}catch(_0x414322){logger[_0x4f73('0x38')](_0x4f73('0x55'),util[_0x4f73('0x48')](_0x414322,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4f73('0x30')]['syncNewState']=function(_0x2f5bc8){try{if(this[_0x4f73('0x33')](_0x2f5bc8)){if(_0x2f5bc8[_0x4f73('0x34')]!==_0x2f5bc8[_0x4f73('0x35')]){if(this[_0x4f73('0x18')][_0x2f5bc8[_0x4f73('0x35')]]){if(_0x2f5bc8[_0x4f73('0x56')]==='6'){if(!this[_0x4f73('0x18')][_0x2f5bc8[_0x4f73('0x35')]]['answered']){var _0x213c0a=moment();this[_0x4f73('0x18')][_0x2f5bc8['linkedid']]['answered']=!![];this[_0x4f73('0x18')][_0x2f5bc8[_0x4f73('0x35')]][_0x4f73('0x57')]=_0x213c0a[_0x4f73('0x3c')](_0x4f73('0x3d'));if(this[_0x4f73('0x18')][_0x2f5bc8['linkedid']]['starttime']){this['channels'][_0x2f5bc8[_0x4f73('0x35')]]['holdtime']=_0x213c0a[_0x4f73('0x58')](this[_0x4f73('0x18')][_0x2f5bc8['linkedid']][_0x4f73('0x4c')],_0x4f73('0x4f'));}}this[_0x4f73('0x18')][_0x2f5bc8[_0x4f73('0x35')]][_0x4f73('0x35')]=_0x2f5bc8[_0x4f73('0x34')];if(_0x2f5bc8['calleridnum']!==_0x4f73('0x59')){this['channels'][_0x2f5bc8[_0x4f73('0x35')]]['connectedlinenum']=_0x2f5bc8[_0x4f73('0x5a')];}this[_0x4f73('0x18')][_0x2f5bc8[_0x4f73('0x35')]][_0x4f73('0x5b')]=_0x2f5bc8[_0x4f73('0x5c')];this[_0x4f73('0x18')][_0x2f5bc8[_0x4f73('0x35')]][_0x4f73('0x5d')]=_0x2f5bc8['channel'];this['channels'][_0x2f5bc8['linkedid']][_0x4f73('0x3e')]=dispositions[_[_0x4f73('0x5e')](_0x2f5bc8[_0x4f73('0x56')])];if(this[_0x4f73('0x19')][_0x2f5bc8[_0x4f73('0x3a')][_0x4f73('0x42')]('-')[0x0]]){this[_0x4f73('0x18')][_0x2f5bc8[_0x4f73('0x35')]][_0x4f73('0x5f')]=this[_0x4f73('0x19')][_0x2f5bc8['channel'][_0x4f73('0x42')]('-')[0x0]]['id'];this[_0x4f73('0x18')][_0x2f5bc8[_0x4f73('0x35')]][_0x4f73('0x60')]=this[_0x4f73('0x19')][_0x2f5bc8[_0x4f73('0x3a')][_0x4f73('0x42')]('-')[0x0]][_0x4f73('0x45')];}}}}else{if(this[_0x4f73('0x18')][_0x2f5bc8[_0x4f73('0x34')]]){if(_0x2f5bc8[_0x4f73('0x56')]==='6'){if(this[_0x4f73('0x19')][_0x2f5bc8[_0x4f73('0x3a')][_0x4f73('0x42')]('-')[0x0]]){this['channels'][_0x2f5bc8[_0x4f73('0x34')]][_0x4f73('0x5f')]=this[_0x4f73('0x19')][_0x2f5bc8['channel'][_0x4f73('0x42')]('-')[0x0]]['id'];this['channels'][_0x2f5bc8[_0x4f73('0x34')]]['membername']=this[_0x4f73('0x19')][_0x2f5bc8[_0x4f73('0x3a')][_0x4f73('0x42')]('-')[0x0]][_0x4f73('0x45')];}}}}}}catch(_0x574505){logger[_0x4f73('0x38')](_0x4f73('0x61'),util[_0x4f73('0x48')](_0x574505,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4f73('0x30')][_0x4f73('0x62')]=function(_0x5b0d46,_0x2dcbd6){if(this[_0x4f73('0x18')][_0x5b0d46]){this[_0x4f73('0x18')][_0x5b0d46][_0x4f73('0x63')]=!![];if(_[_0x4f73('0x64')](_0x2dcbd6,'.wav49')){_0x2dcbd6=_0x2dcbd6['replace'](_0x4f73('0x65'),_0x4f73('0x66'));}this[_0x4f73('0x18')][_0x5b0d46]['monitorFilename']=_0x2dcbd6;var _0x39ab98=_[_0x4f73('0x67')](this[_0x4f73('0x18')][_0x5b0d46][_0x4f73('0x68')],{'filename':_0x2dcbd6});if(_[_0x4f73('0x69')](_0x39ab98)){this['channels'][_0x5b0d46][_0x4f73('0x68')][_0x4f73('0x6a')]({'filename':_0x2dcbd6,'createdAt':moment()[_0x4f73('0x3c')](_0x4f73('0x3d')),'mixmonitorid':'','status':_0x4f73('0x6b')});}}};VoiceCallReport['prototype']['syncVarSet']=function(_0x15376a){try{if(this[_0x4f73('0x33')](_0x15376a)){if(this[_0x4f73('0x18')][_0x15376a['uniqueid']]&&_0x15376a['channel']!=_0x4f73('0x3b')){if(this[_0x4f73('0x33')](_0x15376a[_0x4f73('0x6c')])){if(this['isNotNull'](_0x15376a['variable'][_0x4f73('0x6d')])){this[_0x4f73('0x62')](_0x15376a[_0x4f73('0x34')],_0x15376a[_0x4f73('0x6e')]);}else if(this[_0x4f73('0x33')](_0x15376a[_0x4f73('0x6c')][_0x4f73('0x6f')])){this[_0x4f73('0x18')][_0x15376a['uniqueid']][_0x4f73('0x5a')]=_0x15376a[_0x4f73('0x6e')];}else if(this['isNotNull'](_0x15376a['variable']['xmd-callerid'])){this[_0x4f73('0x18')][_0x15376a[_0x4f73('0x34')]][_0x4f73('0x70')]=_0x15376a[_0x4f73('0x6e')];}else if(this[_0x4f73('0x33')](_0x15376a[_0x4f73('0x6c')][_0x4f73('0x71')])){this[_0x4f73('0x18')][_0x15376a['uniqueid']][_0x4f73('0x72')]=_0x15376a[_0x4f73('0x6e')];}else if(this[_0x4f73('0x33')](_0x15376a[_0x4f73('0x6c')][_0x4f73('0x73')])){this[_0x4f73('0x18')][_0x15376a[_0x4f73('0x34')]]['queue']=_0x15376a[_0x4f73('0x6e')][_0x4f73('0x42')](',')[0x0];}else if(this['isNotNull'](_0x15376a[_0x4f73('0x6c')][_0x4f73('0x74')])){this[_0x4f73('0x18')][_0x15376a[_0x4f73('0x34')]][_0x4f73('0x75')]=_0x15376a[_0x4f73('0x6e')];}else if(this['isNotNull'](_0x15376a['variable']['xmd-destination'])){this[_0x4f73('0x18')][_0x15376a['uniqueid']][_0x4f73('0x76')]=_0x15376a[_0x4f73('0x6e')];}else if(this[_0x4f73('0x33')](_0x15376a[_0x4f73('0x6c')][_0x4f73('0x77')])){this['channels'][_0x15376a['uniqueid']][_0x4f73('0x78')]=_0x15376a['value'];}else if(this[_0x4f73('0x33')](_0x15376a[_0x4f73('0x6c')]['xmcs-queue'])){this[_0x4f73('0x18')][_0x15376a[_0x4f73('0x34')]][_0x4f73('0xd')]=_0x15376a['value'];}else if(this[_0x4f73('0x33')](_0x15376a['variable']['sipcallid'])){this[_0x4f73('0x18')][_0x15376a[_0x4f73('0x34')]][_0x4f73('0x79')]=_0x15376a[_0x4f73('0x6e')];}}}else if(this['isNotNull'](_0x15376a[_0x4f73('0x6c')][_0x4f73('0x6d')])){if(_0x15376a[_0x4f73('0x6e')]){var _0x3581ee=path['parse'](_0x15376a[_0x4f73('0x6e')])['name'];this[_0x4f73('0x62')](_0x3581ee,_0x15376a['value']);}}else if(this[_0x4f73('0x18')][_0x15376a[_0x4f73('0x35')]]){if(this[_0x4f73('0x33')](_0x15376a[_0x4f73('0x6c')])){if(this[_0x4f73('0x33')](_0x15376a[_0x4f73('0x6c')][_0x4f73('0x7a')])){this['channels'][_0x15376a[_0x4f73('0x35')]]['sipcalllinkedid']=_0x15376a['value'];}}}}}catch(_0x238768){logger[_0x4f73('0x38')](_0x4f73('0x7b'),util[_0x4f73('0x48')](_0x238768,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4f73('0x30')][_0x4f73('0x7c')]=function(_0x1faed2){try{if(this['isNotNull'](_0x1faed2)){if(this['channels'][_0x1faed2[_0x4f73('0x34')]]){var _0x190dd2=moment();this[_0x4f73('0x18')][_0x1faed2['uniqueid']]['endtime']=_0x190dd2[_0x4f73('0x3c')](_0x4f73('0x3d'));this['channels'][_0x1faed2[_0x4f73('0x34')]]['duration']=_0x190dd2[_0x4f73('0x58')](this[_0x4f73('0x18')][_0x1faed2[_0x4f73('0x34')]][_0x4f73('0x4c')],_0x4f73('0x4f'));if(this[_0x4f73('0x18')][_0x1faed2['uniqueid']]['answered']){this['channels'][_0x1faed2['uniqueid']][_0x4f73('0x7d')]=_0x190dd2[_0x4f73('0x58')](this[_0x4f73('0x18')][_0x1faed2[_0x4f73('0x34')]]['answertime'],_0x4f73('0x4f'));this[_0x4f73('0x18')][_0x1faed2[_0x4f73('0x34')]][_0x4f73('0x7e')]=this['channels'][_0x1faed2[_0x4f73('0x34')]]['duration']-this[_0x4f73('0x18')][_0x1faed2[_0x4f73('0x34')]][_0x4f73('0x7d')];}if(_0x1faed2['context']===_0x4f73('0x41')){if(this[_0x4f73('0x19')][_0x1faed2[_0x4f73('0x3a')][_0x4f73('0x42')]('-')[0x0]]){this[_0x4f73('0x19')][_0x1faed2['channel'][_0x4f73('0x42')]('-')[0x0]]=_['omit'](this[_0x4f73('0x19')][_0x1faed2['channel']['split']('-')[0x0]],[_0x4f73('0x43')]);this[_0x4f73('0x32')](util['format'](_0x4f73('0x7f'),this[_0x4f73('0x19')][_0x1faed2[_0x4f73('0x3a')][_0x4f73('0x42')]('-')[0x0]]['name']),_0x4f73('0x80'),{'destaccountcode':this['agents'][_0x1faed2['channel']['split']('-')[0x0]][_0x4f73('0x46')]});}}ami[_0x4f73('0x32')](_0x4f73('0x81'),this[_0x4f73('0x18')][_0x1faed2[_0x4f73('0x34')]]);delete this['channels'][_0x1faed2['uniqueid']];}}}catch(_0x122b32){logger['error'](_0x4f73('0x82'),util['inspect'](_0x122b32,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4f73('0x30')]['syncAttendedTransfer']=function(_0x37e784){try{if(this[_0x4f73('0x33')](_0x37e784)){if(this['channels'][_0x37e784['transfereeuniqueid']]){this[_0x4f73('0x18')][_0x37e784[_0x4f73('0x83')]]['transfercalleridnum']=_0x37e784['origtransferercalleridnum'];this[_0x4f73('0x18')][_0x37e784[_0x4f73('0x83')]][_0x4f73('0x84')]=_0x37e784[_0x4f73('0x85')];if(this['channels'][_0x37e784[_0x4f73('0x86')]]){var _0x563114=this[_0x4f73('0x18')][_0x37e784[_0x4f73('0x86')]];this[_0x4f73('0x18')][_0x37e784['secondtransfereruniqueid']]=this['channels'][_0x37e784['transfereeuniqueid']];this['channels'][_0x37e784['transfereeuniqueid']]=_0x563114;}}else if(this[_0x4f73('0x18')][_0x37e784[_0x4f73('0x87')]]){this[_0x4f73('0x18')][_0x37e784[_0x4f73('0x87')]][_0x4f73('0x88')]=_0x37e784[_0x4f73('0x89')];this[_0x4f73('0x18')][_0x37e784['transfertargetuniqueid']][_0x4f73('0x84')]=_0x37e784[_0x4f73('0x85')];if(this[_0x4f73('0x18')][_0x37e784[_0x4f73('0x8a')]]){var _0x563114=this['channels'][_0x37e784[_0x4f73('0x8a')]];this[_0x4f73('0x18')][_0x37e784[_0x4f73('0x8a')]]=this[_0x4f73('0x18')][_0x37e784[_0x4f73('0x87')]];this[_0x4f73('0x18')][_0x37e784[_0x4f73('0x87')]]=_0x563114;}}}}catch(_0xaa30a6){logger[_0x4f73('0x38')](_0x4f73('0x8b'),util[_0x4f73('0x48')](_0xaa30a6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4f73('0x30')]['syncBlindTransfer']=function(_0x24cdec){try{if(this[_0x4f73('0x33')](_0x24cdec)){if(this[_0x4f73('0x18')][_0x24cdec['transfereeuniqueid']]){this['channels'][_0x24cdec[_0x4f73('0x83')]][_0x4f73('0x88')]=_0x24cdec['transfereecalleridnum'];this['channels'][_0x24cdec[_0x4f73('0x83')]][_0x4f73('0x84')]=_0x24cdec[_0x4f73('0x8c')];this[_0x4f73('0x7c')]({'event':'BlindTransfer','uniqueid':_0x24cdec['transfereeuniqueid'],'context':_0x24cdec[_0x4f73('0x40')],'channel':_0x24cdec[_0x4f73('0x8d')]});}}}catch(_0xd44a55){logger[_0x4f73('0x38')](_0x4f73('0x8e'),util[_0x4f73('0x48')](_0xd44a55,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStart']=function(_0xabc8c8){try{if(this['isNotNull'](_0xabc8c8)){if(this[_0x4f73('0x18')][_0xabc8c8[_0x4f73('0x34')]]){if(!_[_0x4f73('0x69')](this[_0x4f73('0x18')][_0xabc8c8[_0x4f73('0x34')]][_0x4f73('0x57')])){this[_0x4f73('0x18')][_0xabc8c8[_0x4f73('0x34')]][_0x4f73('0x8f')]=moment()[_0x4f73('0x3c')](_0x4f73('0x3d'));}}}}catch(_0x1d0379){logger[_0x4f73('0x38')](_0x4f73('0x90'),util[_0x4f73('0x48')](_0x1d0379,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4f73('0x2a')]=function(_0x4801ed){try{if(this['isNotNull'](_0x4801ed)){if(this[_0x4f73('0x18')][_0x4801ed[_0x4f73('0x34')]]){if(!_[_0x4f73('0x69')](this[_0x4f73('0x18')][_0x4801ed['uniqueid']]['mohstarttime'])){this[_0x4f73('0x18')][_0x4801ed[_0x4f73('0x34')]]['mohtime']+=moment()['milliseconds'](0x0)['diff'](this[_0x4f73('0x18')][_0x4801ed[_0x4f73('0x34')]]['mohstarttime'],_0x4f73('0x4f'));delete this[_0x4f73('0x18')][_0x4801ed['uniqueid']]['mohstarttime'];}}}}catch(_0x73198){logger[_0x4f73('0x38')](_0x4f73('0x91'),util[_0x4f73('0x48')](_0x73198,{'showHidden':![],'depth':null}));}};module[_0x4f73('0x92')]=VoiceCallReport; \ No newline at end of file +var _0x9555=['origtransferercalleridnum','transfertargetcalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','syncBlindTransfer','transfereecalleridnum','transferconnectedlinenum','extension','transfererchannel','[syncBlindTransfer][VoiceCallReport]','syncMusicOnHoldStart','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','path','ioredis','../../../config/environment','../../../config/logger','../ami','../model/channel','unknown','not_inuse','inuse','invalid','ringing','ringinuse','onhold','set','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','musiconholdstart','syncMusicOnHoldStop','resolve','actionCoreShowChannels','catch','log','isNotNull','isUndefined','prototype','emit','linkedid','uniqueid','merge','pick','keys','[syncNewCallerId][VoiceCallReport]','inspect','syncNewChannel','channel','OutgoingSpoolFailed','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','from-sip','destconnectedlinenum','exten','user:%s','split','accountcode','error','[syncNewChannel][VoiceCallReport]','application','applicationdata','appdata','toLowerCase','starttime','subtract','duration','seconds','includes','lastapplication','lastdata','cdr(','match','queue','[syncNewExten][VoiceCallReport]','answered','holdtime','diff','xcally-motion-preview','calleridnum','connectedlinename','destinationchannel','UserId','name','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','isNil','push','rec','variable','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','mixmonitor_filename','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','billableseconds','answertime','omit','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9555,0x149));var _0x5955=function(_0x2dd529,_0x4a353d){_0x2dd529=_0x2dd529-0x0;var _0x431047=_0x9555[_0x2dd529];return _0x431047;};'use strict';var BPromise=require(_0x5955('0x0'));var _=require(_0x5955('0x1'));var moment=require(_0x5955('0x2'));var util=require('util');var path=require(_0x5955('0x3'));var Redis=require(_0x5955('0x4'));var config=require(_0x5955('0x5'));var logger=require(_0x5955('0x6'))('ami');var ami=require(_0x5955('0x7'));var Channel=require(_0x5955('0x8'));var statusDesc=[_0x5955('0x9'),_0x5955('0xa'),_0x5955('0xb'),'busy',_0x5955('0xc'),'unavailable',_0x5955('0xd'),_0x5955('0xe'),_0x5955('0xf')];var applications=[_0x5955('0x10'),'queue',_0x5955('0x11'),_0x5955('0x12'),_0x5955('0x13'),_0x5955('0x14')];var dispositions=[_0x5955('0x15'),_0x5955('0x16'),_0x5955('0x16'),'NO\x20ANSWER',_0x5955('0x15'),_0x5955('0x15'),'ANSWERED',_0x5955('0x17'),_0x5955('0x16'),_0x5955('0x16'),'FAILED'];var actions={};config[_0x5955('0x18')]=_[_0x5955('0x19')](config[_0x5955('0x18')],{'host':_0x5955('0x1a'),'port':0x18eb});var io=require(_0x5955('0x1b'))(new Redis(config['redis']));function VoiceCallReport(_0x212b29){this[_0x5955('0x1c')]=_0x212b29[_0x5955('0x1c')];this[_0x5955('0x1d')]=_0x212b29[_0x5955('0x1d')];ami['on'](_0x5955('0x1e'),this[_0x5955('0x1f')][_0x5955('0x20')](this));ami['on'](_0x5955('0x21'),this[_0x5955('0x1f')]['bind'](this));ami['on']('newchannel',this['syncNewChannel']['bind'](this));ami['on'](_0x5955('0x22'),this[_0x5955('0x23')][_0x5955('0x20')](this));ami['on'](_0x5955('0x24'),this[_0x5955('0x25')][_0x5955('0x20')](this));ami['on'](_0x5955('0x26'),this[_0x5955('0x27')][_0x5955('0x20')](this));ami['on'](_0x5955('0x28'),this[_0x5955('0x29')]['bind'](this));ami['on'](_0x5955('0x2a'),this[_0x5955('0x2b')][_0x5955('0x20')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x5955('0x20')](this));ami['on'](_0x5955('0x2c'),this['syncMusicOnHoldStart']['bind'](this));ami['on']('musiconholdstop',this[_0x5955('0x2d')][_0x5955('0x20')](this));return BPromise[_0x5955('0x2e')]()['then'](ami[_0x5955('0x2f')]())[_0x5955('0x30')](function(_0x685af3){console[_0x5955('0x31')](_0x685af3);});}VoiceCallReport['prototype'][_0x5955('0x32')]=function(_0x284142){return _0x284142!==null&&!_[_0x5955('0x33')](_0x284142);};VoiceCallReport[_0x5955('0x34')][_0x5955('0x35')]=function(_0x686298,_0x1118f3,_0x17aa64){io['to'](_0x686298)[_0x5955('0x35')](_0x1118f3,_0x17aa64);};VoiceCallReport[_0x5955('0x34')]['syncNewCallerId']=function(_0x38a941){try{if(this[_0x5955('0x32')](_0x38a941)){if(_0x38a941['uniqueid']===_0x38a941[_0x5955('0x36')]){if(!_[_0x5955('0x33')](this[_0x5955('0x1c')][_0x38a941[_0x5955('0x37')]])){_[_0x5955('0x38')](this[_0x5955('0x1c')][_0x38a941[_0x5955('0x37')]],_[_0x5955('0x39')](_0x38a941,_[_0x5955('0x3a')](this[_0x5955('0x1c')][_0x38a941['uniqueid']])));}}}}catch(_0x3daaf4){logger['error'](_0x5955('0x3b'),util[_0x5955('0x3c')](_0x3daaf4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5955('0x34')][_0x5955('0x3d')]=function(_0x21b4e4){try{if(this[_0x5955('0x32')](_0x21b4e4)){if(_0x21b4e4[_0x5955('0x37')]===_0x21b4e4[_0x5955('0x36')]&&_0x21b4e4[_0x5955('0x3e')]!=_0x5955('0x3f')){if(_['isUndefined'](this[_0x5955('0x1c')][_0x21b4e4[_0x5955('0x37')]])){this['channels'][_0x21b4e4['uniqueid']]=new Channel();this['channels'][_0x21b4e4[_0x5955('0x37')]]['starttime']=moment()[_0x5955('0x40')](_0x5955('0x41'));this[_0x5955('0x1c')][_0x21b4e4[_0x5955('0x37')]][_0x5955('0x42')]=dispositions[_[_0x5955('0x43')](_0x21b4e4[_0x5955('0x44')])];_['merge'](this['channels'][_0x21b4e4[_0x5955('0x37')]],_[_0x5955('0x39')](_0x21b4e4,_[_0x5955('0x3a')](this[_0x5955('0x1c')][_0x21b4e4[_0x5955('0x37')]])));if(_0x21b4e4[_0x5955('0x45')]===_0x5955('0x46')){if(this[_0x5955('0x1d')][_0x21b4e4['channel']['split']('-')[0x0]]){this[_0x5955('0x1d')][_0x21b4e4[_0x5955('0x3e')]['split']('-')[0x0]][_0x5955('0x47')]=_0x21b4e4[_0x5955('0x48')];this['emit'](util[_0x5955('0x40')](_0x5955('0x49'),this[_0x5955('0x1d')][_0x21b4e4[_0x5955('0x3e')][_0x5955('0x4a')]('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this[_0x5955('0x1d')][_0x21b4e4['channel']['split']('-')[0x0]][_0x5955('0x4b')],'destconnectedlinenum':_0x21b4e4['exten']});}}}}}}catch(_0x258641){logger[_0x5955('0x4c')](_0x5955('0x4d'),util['inspect'](_0x258641,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5955('0x34')][_0x5955('0x1f')]=function(_0x3cc5a6){try{if(this[_0x5955('0x32')](_0x3cc5a6)){if(_0x3cc5a6[_0x5955('0x37')]===_0x3cc5a6[_0x5955('0x36')]&&_0x3cc5a6[_0x5955('0x48')]!='h'&&_0x3cc5a6[_0x5955('0x3e')]!=_0x5955('0x3f')){_0x3cc5a6['application']=_0x3cc5a6[_0x5955('0x4e')]['toLowerCase']();_0x3cc5a6[_0x5955('0x4f')]=(_0x3cc5a6[_0x5955('0x50')]||_0x3cc5a6[_0x5955('0x4f')])[_0x5955('0x51')]();if(_[_0x5955('0x33')](this[_0x5955('0x1c')][_0x3cc5a6[_0x5955('0x37')]])){this[_0x5955('0x1c')][_0x3cc5a6[_0x5955('0x37')]]=new Channel();this[_0x5955('0x1c')][_0x3cc5a6['uniqueid']][_0x5955('0x52')]=_0x3cc5a6['duration']?moment()[_0x5955('0x53')](moment['duration'](_0x3cc5a6[_0x5955('0x54')])['seconds'](),_0x5955('0x55'))[_0x5955('0x40')](_0x5955('0x41')):moment()[_0x5955('0x40')](_0x5955('0x41'));this[_0x5955('0x1c')][_0x3cc5a6[_0x5955('0x37')]][_0x5955('0x42')]='NO\x20ANSWER';}_[_0x5955('0x38')](this[_0x5955('0x1c')][_0x3cc5a6[_0x5955('0x37')]],_[_0x5955('0x39')](_0x3cc5a6,_[_0x5955('0x3a')](this[_0x5955('0x1c')][_0x3cc5a6['uniqueid']])));if(_[_0x5955('0x56')](applications,_0x3cc5a6[_0x5955('0x4e')])){this[_0x5955('0x1c')][_0x3cc5a6['uniqueid']][_0x5955('0x57')]=_0x3cc5a6[_0x5955('0x4e')];this[_0x5955('0x1c')][_0x3cc5a6['uniqueid']][_0x5955('0x58')]=_0x3cc5a6[_0x5955('0x4f')];if(_0x3cc5a6['application']===_0x5955('0x10')&&_['startsWith'](_0x3cc5a6['applicationdata'],_0x5955('0x59'))){var _0x435962=_0x3cc5a6[_0x5955('0x4f')][_0x5955('0x4a')]('=');var _0x2ef783=_0x435962[0x0][_0x5955('0x5a')](/cdr\((.*)\)/);if(_0x2ef783){this[_0x5955('0x1c')][_0x3cc5a6[_0x5955('0x37')]][_0x2ef783[0x1]]=_0x435962[0x1];}}else if(_0x3cc5a6[_0x5955('0x4e')]===_0x5955('0x5b')){this[_0x5955('0x1c')][_0x3cc5a6[_0x5955('0x37')]][_0x5955('0x5b')]=_0x3cc5a6[_0x5955('0x4f')][_0x5955('0x4a')](',')[0x0];}}}}}catch(_0x49fe38){logger[_0x5955('0x4c')](_0x5955('0x5c'),util[_0x5955('0x3c')](_0x49fe38,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5955('0x34')][_0x5955('0x23')]=function(_0x35b8f4){try{if(this[_0x5955('0x32')](_0x35b8f4)){if(_0x35b8f4[_0x5955('0x37')]!==_0x35b8f4['linkedid']){if(this[_0x5955('0x1c')][_0x35b8f4[_0x5955('0x36')]]){if(_0x35b8f4[_0x5955('0x44')]==='6'){if(!this[_0x5955('0x1c')][_0x35b8f4[_0x5955('0x36')]]['answered']){var _0x15c460=moment();this[_0x5955('0x1c')][_0x35b8f4[_0x5955('0x36')]][_0x5955('0x5d')]=!![];this[_0x5955('0x1c')][_0x35b8f4['linkedid']]['answertime']=_0x15c460[_0x5955('0x40')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x5955('0x1c')][_0x35b8f4[_0x5955('0x36')]][_0x5955('0x52')]){this[_0x5955('0x1c')][_0x35b8f4[_0x5955('0x36')]][_0x5955('0x5e')]=_0x15c460[_0x5955('0x5f')](this[_0x5955('0x1c')][_0x35b8f4[_0x5955('0x36')]][_0x5955('0x52')],_0x5955('0x55'));}}this[_0x5955('0x1c')][_0x35b8f4['linkedid']][_0x5955('0x36')]=_0x35b8f4[_0x5955('0x37')];if(_0x35b8f4['calleridnum']!==_0x5955('0x60')){this[_0x5955('0x1c')][_0x35b8f4[_0x5955('0x36')]]['connectedlinenum']=_0x35b8f4[_0x5955('0x61')];}this[_0x5955('0x1c')][_0x35b8f4[_0x5955('0x36')]][_0x5955('0x62')]=_0x35b8f4['calleridname'];this[_0x5955('0x1c')][_0x35b8f4[_0x5955('0x36')]][_0x5955('0x63')]=_0x35b8f4[_0x5955('0x3e')];this[_0x5955('0x1c')][_0x35b8f4[_0x5955('0x36')]]['disposition']=dispositions[_['toNumber'](_0x35b8f4[_0x5955('0x44')])];if(this[_0x5955('0x1d')][_0x35b8f4[_0x5955('0x3e')][_0x5955('0x4a')]('-')[0x0]]){this[_0x5955('0x1c')][_0x35b8f4['linkedid']][_0x5955('0x64')]=this[_0x5955('0x1d')][_0x35b8f4[_0x5955('0x3e')][_0x5955('0x4a')]('-')[0x0]]['id'];this['channels'][_0x35b8f4[_0x5955('0x36')]]['membername']=this['agents'][_0x35b8f4[_0x5955('0x3e')]['split']('-')[0x0]][_0x5955('0x65')];}}}}else{if(this['channels'][_0x35b8f4['uniqueid']]){if(_0x35b8f4[_0x5955('0x44')]==='6'){if(this['agents'][_0x35b8f4['channel'][_0x5955('0x4a')]('-')[0x0]]){this[_0x5955('0x1c')][_0x35b8f4[_0x5955('0x37')]][_0x5955('0x64')]=this[_0x5955('0x1d')][_0x35b8f4[_0x5955('0x3e')][_0x5955('0x4a')]('-')[0x0]]['id'];this[_0x5955('0x1c')][_0x35b8f4[_0x5955('0x37')]][_0x5955('0x66')]=this['agents'][_0x35b8f4['channel'][_0x5955('0x4a')]('-')[0x0]][_0x5955('0x65')];}}}}}}catch(_0x4e3445){logger[_0x5955('0x4c')](_0x5955('0x67'),util[_0x5955('0x3c')](_0x4e3445,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x5955('0x68')]=function(_0x37fe42,_0x414ed9){if(this[_0x5955('0x1c')][_0x37fe42]){this[_0x5955('0x1c')][_0x37fe42][_0x5955('0x69')]=!![];if(_[_0x5955('0x6a')](_0x414ed9,_0x5955('0x6b'))){_0x414ed9=_0x414ed9[_0x5955('0x6c')]('.wav49',_0x5955('0x6d'));}this[_0x5955('0x1c')][_0x37fe42][_0x5955('0x6e')]=_0x414ed9;var _0x469efe=_['find'](this[_0x5955('0x1c')][_0x37fe42][_0x5955('0x6f')],{'filename':_0x414ed9});if(_[_0x5955('0x70')](_0x469efe)){this['channels'][_0x37fe42][_0x5955('0x6f')][_0x5955('0x71')]({'filename':_0x414ed9,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x5955('0x72')});}}};VoiceCallReport[_0x5955('0x34')]['syncVarSet']=function(_0xde7737){try{if(this[_0x5955('0x32')](_0xde7737)){if(this[_0x5955('0x1c')][_0xde7737['uniqueid']]&&_0xde7737[_0x5955('0x3e')]!=_0x5955('0x3f')){if(this['isNotNull'](_0xde7737[_0x5955('0x73')])){if(this[_0x5955('0x32')](_0xde7737[_0x5955('0x73')]['mixmonitor_filename'])){this[_0x5955('0x68')](_0xde7737['uniqueid'],_0xde7737[_0x5955('0x74')]);}else if(this[_0x5955('0x32')](_0xde7737[_0x5955('0x73')][_0x5955('0x75')])){this[_0x5955('0x1c')][_0xde7737['uniqueid']][_0x5955('0x61')]=_0xde7737[_0x5955('0x74')];}else if(this[_0x5955('0x32')](_0xde7737[_0x5955('0x73')][_0x5955('0x76')])){this['channels'][_0xde7737[_0x5955('0x37')]][_0x5955('0x77')]=_0xde7737[_0x5955('0x74')];}else if(this[_0x5955('0x32')](_0xde7737['variable'][_0x5955('0x78')])){this['channels'][_0xde7737[_0x5955('0x37')]][_0x5955('0x79')]=_0xde7737[_0x5955('0x74')];}else if(this[_0x5955('0x32')](_0xde7737[_0x5955('0x73')][_0x5955('0x7a')])){this['channels'][_0xde7737['uniqueid']][_0x5955('0x5b')]=_0xde7737['value'][_0x5955('0x4a')](',')[0x0];}else if(this['isNotNull'](_0xde7737[_0x5955('0x73')][_0x5955('0x7b')])){this[_0x5955('0x1c')][_0xde7737['uniqueid']]['originatecalleridnum']=_0xde7737[_0x5955('0x74')];}else if(this[_0x5955('0x32')](_0xde7737[_0x5955('0x73')]['xmd-destination'])){this['channels'][_0xde7737[_0x5955('0x37')]][_0x5955('0x7c')]=_0xde7737['value'];}else if(this[_0x5955('0x32')](_0xde7737[_0x5955('0x73')][_0x5955('0x7d')])){this[_0x5955('0x1c')][_0xde7737[_0x5955('0x37')]][_0x5955('0x7e')]=_0xde7737[_0x5955('0x74')];}else if(this[_0x5955('0x32')](_0xde7737[_0x5955('0x73')][_0x5955('0x7f')])){this[_0x5955('0x1c')][_0xde7737[_0x5955('0x37')]]['queue']=_0xde7737[_0x5955('0x74')];}else if(this[_0x5955('0x32')](_0xde7737['variable'][_0x5955('0x80')])){this[_0x5955('0x1c')][_0xde7737[_0x5955('0x37')]][_0x5955('0x81')]=_0xde7737['value'];}}}else if(this[_0x5955('0x32')](_0xde7737[_0x5955('0x73')][_0x5955('0x82')])){if(_0xde7737[_0x5955('0x74')]){var _0x450315=path[_0x5955('0x83')](_0xde7737[_0x5955('0x74')])[_0x5955('0x65')];this['syncMixMonitorFilename'](_0x450315,_0xde7737[_0x5955('0x74')]);}}else if(this['channels'][_0xde7737['linkedid']]){if(this[_0x5955('0x32')](_0xde7737[_0x5955('0x73')])){if(this[_0x5955('0x32')](_0xde7737[_0x5955('0x73')]['sipcallid'])){this[_0x5955('0x1c')][_0xde7737[_0x5955('0x36')]][_0x5955('0x84')]=_0xde7737[_0x5955('0x74')];}}}}}catch(_0x36b985){logger[_0x5955('0x4c')](_0x5955('0x85'),util[_0x5955('0x3c')](_0x36b985,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5955('0x34')][_0x5955('0x27')]=function(_0x32b7dd){try{if(this[_0x5955('0x32')](_0x32b7dd)){if(this[_0x5955('0x1c')][_0x32b7dd['uniqueid']]){var _0x4e859f=moment();this[_0x5955('0x1c')][_0x32b7dd[_0x5955('0x37')]]['endtime']=_0x4e859f[_0x5955('0x40')](_0x5955('0x41'));this[_0x5955('0x1c')][_0x32b7dd[_0x5955('0x37')]][_0x5955('0x54')]=_0x4e859f[_0x5955('0x5f')](this[_0x5955('0x1c')][_0x32b7dd['uniqueid']][_0x5955('0x52')],'seconds');if(this[_0x5955('0x1c')][_0x32b7dd[_0x5955('0x37')]][_0x5955('0x5d')]){this['channels'][_0x32b7dd[_0x5955('0x37')]][_0x5955('0x86')]=_0x4e859f[_0x5955('0x5f')](this[_0x5955('0x1c')][_0x32b7dd['uniqueid']][_0x5955('0x87')],_0x5955('0x55'));this[_0x5955('0x1c')][_0x32b7dd[_0x5955('0x37')]]['holdtime']=this[_0x5955('0x1c')][_0x32b7dd['uniqueid']][_0x5955('0x54')]-this['channels'][_0x32b7dd[_0x5955('0x37')]][_0x5955('0x86')];}if(_0x32b7dd[_0x5955('0x45')]===_0x5955('0x46')){if(this['agents'][_0x32b7dd[_0x5955('0x3e')][_0x5955('0x4a')]('-')[0x0]]){this[_0x5955('0x1d')][_0x32b7dd[_0x5955('0x3e')][_0x5955('0x4a')]('-')[0x0]]=_[_0x5955('0x88')](this[_0x5955('0x1d')][_0x32b7dd['channel'][_0x5955('0x4a')]('-')[0x0]],[_0x5955('0x47')]);this[_0x5955('0x35')](util['format'](_0x5955('0x49'),this[_0x5955('0x1d')][_0x32b7dd[_0x5955('0x3e')][_0x5955('0x4a')]('-')[0x0]][_0x5955('0x65')]),'user:agentcomplete',{'destaccountcode':this[_0x5955('0x1d')][_0x32b7dd[_0x5955('0x3e')][_0x5955('0x4a')]('-')[0x0]][_0x5955('0x4b')]});}}ami['emit']('custom:voiceCallReport',this['channels'][_0x32b7dd['uniqueid']]);delete this[_0x5955('0x1c')][_0x32b7dd[_0x5955('0x37')]];}}}catch(_0x48f7b4){logger[_0x5955('0x4c')](_0x5955('0x89'),util[_0x5955('0x3c')](_0x48f7b4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5955('0x34')]['syncAttendedTransfer']=function(_0x13834a){try{if(this[_0x5955('0x32')](_0x13834a)){if(this[_0x5955('0x1c')][_0x13834a['transfereeuniqueid']]){this[_0x5955('0x1c')][_0x13834a[_0x5955('0x8a')]][_0x5955('0x8b')]=_0x13834a['origtransferercalleridnum'];this[_0x5955('0x1c')][_0x13834a[_0x5955('0x8a')]]['transferconnectedlinenum']=_0x13834a['transfertargetcalleridnum'];if(this[_0x5955('0x1c')][_0x13834a[_0x5955('0x8c')]]){var _0x41f0d5=this[_0x5955('0x1c')][_0x13834a[_0x5955('0x8c')]];this[_0x5955('0x1c')][_0x13834a[_0x5955('0x8c')]]=this['channels'][_0x13834a[_0x5955('0x8a')]];this['channels'][_0x13834a[_0x5955('0x8a')]]=_0x41f0d5;}}else if(this[_0x5955('0x1c')][_0x13834a[_0x5955('0x8d')]]){this['channels'][_0x13834a[_0x5955('0x8d')]][_0x5955('0x8b')]=_0x13834a[_0x5955('0x8e')];this[_0x5955('0x1c')][_0x13834a['transfertargetuniqueid']]['transferconnectedlinenum']=_0x13834a[_0x5955('0x8f')];if(this[_0x5955('0x1c')][_0x13834a[_0x5955('0x90')]]){var _0x41f0d5=this['channels'][_0x13834a['origtransfereruniqueid']];this[_0x5955('0x1c')][_0x13834a['origtransfereruniqueid']]=this[_0x5955('0x1c')][_0x13834a[_0x5955('0x8d')]];this[_0x5955('0x1c')][_0x13834a[_0x5955('0x8d')]]=_0x41f0d5;}}}}catch(_0x46f93a){logger[_0x5955('0x4c')](_0x5955('0x91'),util[_0x5955('0x3c')](_0x46f93a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5955('0x34')][_0x5955('0x92')]=function(_0x2a427e){try{if(this['isNotNull'](_0x2a427e)){if(this[_0x5955('0x1c')][_0x2a427e[_0x5955('0x8a')]]){this[_0x5955('0x1c')][_0x2a427e[_0x5955('0x8a')]]['transfercalleridnum']=_0x2a427e[_0x5955('0x93')];this[_0x5955('0x1c')][_0x2a427e[_0x5955('0x8a')]][_0x5955('0x94')]=_0x2a427e[_0x5955('0x95')];this['syncHangup']({'event':'BlindTransfer','uniqueid':_0x2a427e['transfereeuniqueid'],'context':_0x2a427e[_0x5955('0x45')],'channel':_0x2a427e[_0x5955('0x96')]});}}}catch(_0x55cdcd){logger[_0x5955('0x4c')](_0x5955('0x97'),util[_0x5955('0x3c')](_0x55cdcd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5955('0x34')][_0x5955('0x98')]=function(_0x51f0eb){try{if(this['isNotNull'](_0x51f0eb)){if(this[_0x5955('0x1c')][_0x51f0eb[_0x5955('0x37')]]){if(!_[_0x5955('0x70')](this[_0x5955('0x1c')][_0x51f0eb[_0x5955('0x37')]][_0x5955('0x87')])){this['channels'][_0x51f0eb[_0x5955('0x37')]][_0x5955('0x99')]=moment()['format'](_0x5955('0x41'));}}}}catch(_0x355771){logger[_0x5955('0x4c')](_0x5955('0x9a'),util[_0x5955('0x3c')](_0x355771,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5955('0x34')][_0x5955('0x2d')]=function(_0x1144ee){try{if(this['isNotNull'](_0x1144ee)){if(this[_0x5955('0x1c')][_0x1144ee[_0x5955('0x37')]]){if(!_[_0x5955('0x70')](this[_0x5955('0x1c')][_0x1144ee[_0x5955('0x37')]]['mohstarttime'])){this[_0x5955('0x1c')][_0x1144ee[_0x5955('0x37')]]['mohtime']+=moment()['milliseconds'](0x0)[_0x5955('0x5f')](this[_0x5955('0x1c')][_0x1144ee[_0x5955('0x37')]][_0x5955('0x99')],_0x5955('0x55'));delete this[_0x5955('0x1c')][_0x1144ee[_0x5955('0x37')]]['mohstarttime'];}}}}catch(_0x366889){logger[_0x5955('0x4c')](_0x5955('0x9b'),util[_0x5955('0x3c')](_0x366889,{'showHidden':![],'depth':null}));}};module[_0x5955('0x9c')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 58d0732..c50519f 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 _0x4971=['../../../config/logger','ami','../ami','redis','defaults','outboundChannels','outbound','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','isNotNull','prototype','merge','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','event','privilege','emit','channels','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','custom:dialconnect','voice:outbound','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','outboundrouteid','isUndefined','variables','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','includes','syncHangup','duration','endtime','starttime','seconds','complete','total','answered','holdtime','diff','sumHoldTime','sumBillable','billableseconds','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','util','ioredis','../../../config/environment'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x4971,0xa4));var _0x1497=function(_0x534a4b,_0x44c67a){_0x534a4b=_0x534a4b-0x0;var _0x311ed6=_0x4971[_0x534a4b];return _0x311ed6;};'use strict';var _=require(_0x1497('0x0'));var moment=require('moment');var util=require(_0x1497('0x1'));var Redis=require(_0x1497('0x2'));var config=require(_0x1497('0x3'));var logger=require(_0x1497('0x4'))(_0x1497('0x5'));var ami=require(_0x1497('0x6'));config[_0x1497('0x7')]=_[_0x1497('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x29f1c4){this['channels']=_0x29f1c4[_0x1497('0x9')];this['outbound']=_0x29f1c4[_0x1497('0xa')];this['variables']={};ami['on'](_0x1497('0xb'),this[_0x1497('0xc')][_0x1497('0xd')](this));ami['on'](_0x1497('0xe'),this[_0x1497('0xf')]['bind'](this));ami['on']('varset',this[_0x1497('0x10')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0x1497('0xd')](this));}VoiceDialReport['prototype'][_0x1497('0x11')]=function(_0x3cdf8d){return _0x3cdf8d!==null&&!_['isUndefined'](_0x3cdf8d);};VoiceDialReport[_0x1497('0x12')]['emit']=function(_0x545834,_0x5c0c95,_0x55fd86){io['to'](_0x545834)['emit'](_0x5c0c95,_0x55fd86);};VoiceDialReport['prototype'][_0x1497('0xc')]=function(_0x464984){try{if(this[_0x1497('0x11')](_0x464984)){if(this['channels'][_0x464984['uniqueid']]){_[_0x1497('0x13')](this['channels'][_0x464984[_0x1497('0x14')]],{'starttime':moment()[_0x1497('0x15')](_0x1497('0x16')),'lastevent':_0x1497('0x17'),'interface':_0x464984[_0x1497('0x18')][_0x1497('0x19')](0x0,_0x464984['channel'][_0x1497('0x1a')]('-')),'membername':_0x464984[_0x1497('0x18')][_0x1497('0x19')](_0x464984[_0x1497('0x18')][_0x1497('0x1a')]('/')+0x1,_0x464984[_0x1497('0x18')][_0x1497('0x1a')]('-'))},_['omit'](_0x464984,[_0x1497('0x1b'),_0x1497('0x1c')]));this[_0x1497('0x1d')]('voice:outbound','voice_outbound_channel:save',this[_0x1497('0x1e')][_0x464984[_0x1497('0x14')]]);ami['emit']('custom:dialbegin',this[_0x1497('0x1e')][_0x464984[_0x1497('0x14')]]);}}}catch(_0x622853){logger[_0x1497('0x1f')](_0x1497('0x20'),util[_0x1497('0x21')](_0x622853,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1497('0x12')][_0x1497('0xf')]=function(_0x3561f3){try{if(this['isNotNull'](_0x3561f3)){if(this[_0x1497('0x1e')][_0x3561f3[_0x1497('0x14')]]){this['channels'][_0x3561f3[_0x1497('0x14')]][_0x1497('0x22')]=_0x3561f3['dialstatus'];if(_0x3561f3[_0x1497('0x22')]===_0x1497('0x23')){this[_0x1497('0x1e')][_0x3561f3[_0x1497('0x14')]][_0x1497('0x24')]=_0x3561f3[_0x1497('0x24')];this[_0x1497('0x1e')][_0x3561f3[_0x1497('0x14')]][_0x1497('0x25')]=_0x3561f3[_0x1497('0x25')];this['channels'][_0x3561f3['uniqueid']][_0x1497('0x26')]=moment()[_0x1497('0x15')](_0x1497('0x16'));this[_0x1497('0x1e')][_0x3561f3['uniqueid']][_0x1497('0x27')]=_0x1497('0x28');ami[_0x1497('0x1d')](_0x1497('0x29'),this[_0x1497('0x1e')][_0x3561f3[_0x1497('0x14')]]);}this[_0x1497('0x1d')](_0x1497('0x2a'),'voice_outbound_channel:save',this[_0x1497('0x1e')][_0x3561f3[_0x1497('0x14')]]);}}}catch(_0x206813){logger[_0x1497('0x1f')](_0x1497('0x2b'),util[_0x1497('0x21')](_0x206813,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x1497('0x10')]=function(_0x3b33ee){try{if(this[_0x1497('0x11')](_0x3b33ee)){this[_0x1497('0x2c')](_0x3b33ee['uniqueid'],_[_0x1497('0x2d')](_0x3b33ee['variable'])[0x0],_0x3b33ee['value']);if(this[_0x1497('0x11')](_0x3b33ee[_0x1497('0x2e')])&&this[_0x1497('0x11')](_0x3b33ee[_0x1497('0x2e')][_0x1497('0x2f')])){if(_[_0x1497('0x30')](this[_0x1497('0x1e')][_0x3b33ee[_0x1497('0x14')]])){this[_0x1497('0x1e')][_0x3b33ee['uniqueid']]={'routeId':_0x3b33ee['value'],'variables':this[_0x1497('0x31')][_0x3b33ee[_0x1497('0x14')]]};this[_0x1497('0x1d')](_0x1497('0x2a'),'voice_outbound_channel:save',this['channels'][_0x3b33ee[_0x1497('0x14')]]);}}}}catch(_0x5b2117){logger[_0x1497('0x1f')](_0x1497('0x32'),util['inspect'](_0x5b2117,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1497('0x12')]['addVariable']=function(_0x188032,_0x282095,_0x42fe28){var _0x4be9fb=['rtpaudioqos',_0x1497('0x33'),'rtpaudioqosjitter',_0x1497('0x34'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x1497('0x35'),_0x1497('0x36'),'sipcallid','sipuri','bridgepeer',_0x1497('0x37'),_0x1497('0x38'),_0x1497('0x39'),_0x1497('0x3a'),_0x1497('0x3b'),_0x1497('0x3c'),_0x1497('0x3d'),'memberrealtime'];if(!_['isNil'](_0x282095)&&!_[_0x1497('0x3e')](_0x4be9fb,_0x282095)){if(_[_0x1497('0x30')](this[_0x1497('0x31')][_0x188032])){this[_0x1497('0x31')][_0x188032]={};}this['variables'][_0x188032][_0x282095]=_0x42fe28;}};VoiceDialReport['prototype'][_0x1497('0x3f')]=function(_0x36ad50){try{if(this[_0x1497('0x11')](_0x36ad50)){if(this[_0x1497('0x1e')][_0x36ad50[_0x1497('0x14')]]){this[_0x1497('0x1e')][_0x36ad50[_0x1497('0x14')]]['endtime']=moment()[_0x1497('0x15')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1497('0x1e')][_0x36ad50['uniqueid']][_0x1497('0x40')]=moment(this[_0x1497('0x1e')][_0x36ad50['uniqueid']][_0x1497('0x41')])['diff'](this[_0x1497('0x1e')][_0x36ad50['uniqueid']][_0x1497('0x42')],_0x1497('0x43'));this['channels'][_0x36ad50[_0x1497('0x14')]]['lastevent']=_0x1497('0x44');this[_0x1497('0xa')][_0x1497('0x45')]+=0x1;if(this[_0x1497('0x1e')][_0x36ad50[_0x1497('0x14')]][_0x1497('0x26')]){this[_0x1497('0xa')][_0x1497('0x46')]+=0x1;this['channels'][_0x36ad50[_0x1497('0x14')]][_0x1497('0x47')]=moment(this[_0x1497('0x1e')][_0x36ad50[_0x1497('0x14')]][_0x1497('0x26')])[_0x1497('0x48')](this[_0x1497('0x1e')][_0x36ad50[_0x1497('0x14')]][_0x1497('0x42')],_0x1497('0x43'));this['channels'][_0x36ad50[_0x1497('0x14')]]['billableseconds']=moment(this[_0x1497('0x1e')][_0x36ad50[_0x1497('0x14')]][_0x1497('0x41')])[_0x1497('0x48')](this[_0x1497('0x1e')][_0x36ad50['uniqueid']][_0x1497('0x26')],'seconds');this[_0x1497('0xa')][_0x1497('0x49')]+=this[_0x1497('0x1e')][_0x36ad50[_0x1497('0x14')]][_0x1497('0x47')]||0x0;this[_0x1497('0xa')][_0x1497('0x4a')]+=this['channels'][_0x36ad50[_0x1497('0x14')]][_0x1497('0x4b')];}this['outbound'][_0x1497('0x4c')]+=this[_0x1497('0x1e')][_0x36ad50[_0x1497('0x14')]][_0x1497('0x40')];ami[_0x1497('0x1d')](_0x1497('0x4d'),this[_0x1497('0x1e')][_0x36ad50[_0x1497('0x14')]]);ami[_0x1497('0x1d')](_0x1497('0x4e'),this['channels'][_0x36ad50['uniqueid']]);this[_0x1497('0x1d')](_0x1497('0x2a'),_0x1497('0x4f'),this[_0x1497('0xa')]);logger['info'](_0x1497('0x50'),JSON['stringify'](this['channels'][_0x36ad50['uniqueid']]));this[_0x1497('0x1d')](_0x1497('0x2a'),_0x1497('0x51'),this[_0x1497('0x1e')][_0x36ad50[_0x1497('0x14')]]);delete this['channels'][_0x36ad50[_0x1497('0x14')]];}if(this[_0x1497('0x31')][_0x36ad50[_0x1497('0x14')]]){delete this['variables'][_0x36ad50[_0x1497('0x14')]];}}}catch(_0x19d4ec){logger[_0x1497('0x1f')](_0x1497('0x52'),util[_0x1497('0x21')](_0x19d4ec,{'showHidden':![],'depth':null}));}};module[_0x1497('0x53')]=VoiceDialReport; \ No newline at end of file +var _0x4444=['redis','channels','outboundChannels','outbound','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','uniqueid','merge','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','event','privilege','voice_outbound_channel:save','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','lastevent','connect','custom:dialconnect','voice:outbound','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','variables','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','membername','memberrealtime','isNil','includes','endtime','diff','starttime','complete','total','answered','holdtime','sumHoldTime','sumBillable','sumDuration','custom:dialend','voice_outbound:save','info','stringify','[syncHangup][VoiceDialReport]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami'];(function(_0x56138f,_0x1e9ebb){var _0x1acaf7=function(_0x48690d){while(--_0x48690d){_0x56138f['push'](_0x56138f['shift']());}};_0x1acaf7(++_0x1e9ebb);}(_0x4444,0xa3));var _0x4444=function(_0x39c684,_0x1e0093){_0x39c684=_0x39c684-0x0;var _0x3da800=_0x4444[_0x39c684];return _0x3da800;};'use strict';var _=require(_0x4444('0x0'));var moment=require(_0x4444('0x1'));var util=require('util');var Redis=require(_0x4444('0x2'));var config=require(_0x4444('0x3'));var logger=require(_0x4444('0x4'))(_0x4444('0x5'));var ami=require(_0x4444('0x6'));config['redis']=_['defaults'](config[_0x4444('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4444('0x7')]));function VoiceDialReport(_0xcae5b5){this[_0x4444('0x8')]=_0xcae5b5[_0x4444('0x9')];this[_0x4444('0xa')]=_0xcae5b5[_0x4444('0xa')];this['variables']={};ami['on'](_0x4444('0xb'),this[_0x4444('0xc')][_0x4444('0xd')](this));ami['on'](_0x4444('0xe'),this[_0x4444('0xf')][_0x4444('0xd')](this));ami['on'](_0x4444('0x10'),this[_0x4444('0x11')][_0x4444('0xd')](this));ami['on'](_0x4444('0x12'),this[_0x4444('0x13')][_0x4444('0xd')](this));}VoiceDialReport['prototype'][_0x4444('0x14')]=function(_0x4b304f){return _0x4b304f!==null&&!_[_0x4444('0x15')](_0x4b304f);};VoiceDialReport[_0x4444('0x16')][_0x4444('0x17')]=function(_0x20b86d,_0x4daaa4,_0x4714f4){io['to'](_0x20b86d)[_0x4444('0x17')](_0x4daaa4,_0x4714f4);};VoiceDialReport[_0x4444('0x16')][_0x4444('0xc')]=function(_0x4587e3){try{if(this[_0x4444('0x14')](_0x4587e3)){if(this[_0x4444('0x8')][_0x4587e3[_0x4444('0x18')]]){_[_0x4444('0x19')](this[_0x4444('0x8')][_0x4587e3[_0x4444('0x18')]],{'starttime':moment()['format'](_0x4444('0x1a')),'lastevent':_0x4444('0x1b'),'interface':_0x4587e3['channel'][_0x4444('0x1c')](0x0,_0x4587e3[_0x4444('0x1d')][_0x4444('0x1e')]('-')),'membername':_0x4587e3[_0x4444('0x1d')][_0x4444('0x1c')](_0x4587e3['channel'][_0x4444('0x1e')]('/')+0x1,_0x4587e3['channel'][_0x4444('0x1e')]('-'))},_['omit'](_0x4587e3,[_0x4444('0x1f'),_0x4444('0x20')]));this[_0x4444('0x17')]('voice:outbound',_0x4444('0x21'),this['channels'][_0x4587e3['uniqueid']]);ami[_0x4444('0x17')]('custom:dialbegin',this[_0x4444('0x8')][_0x4587e3['uniqueid']]);}}}catch(_0x27cb3d){logger[_0x4444('0x22')](_0x4444('0x23'),util[_0x4444('0x24')](_0x27cb3d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4444('0x16')][_0x4444('0xf')]=function(_0x25e169){try{if(this['isNotNull'](_0x25e169)){if(this[_0x4444('0x8')][_0x25e169[_0x4444('0x18')]]){this[_0x4444('0x8')][_0x25e169[_0x4444('0x18')]][_0x4444('0x25')]=_0x25e169[_0x4444('0x25')];if(_0x25e169[_0x4444('0x25')]===_0x4444('0x26')){this['channels'][_0x25e169['uniqueid']][_0x4444('0x27')]=_0x25e169[_0x4444('0x27')];this['channels'][_0x25e169[_0x4444('0x18')]][_0x4444('0x28')]=_0x25e169[_0x4444('0x28')];this[_0x4444('0x8')][_0x25e169[_0x4444('0x18')]][_0x4444('0x29')]=moment()[_0x4444('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4444('0x8')][_0x25e169[_0x4444('0x18')]][_0x4444('0x2b')]=_0x4444('0x2c');ami[_0x4444('0x17')](_0x4444('0x2d'),this[_0x4444('0x8')][_0x25e169['uniqueid']]);}this[_0x4444('0x17')](_0x4444('0x2e'),_0x4444('0x21'),this[_0x4444('0x8')][_0x25e169[_0x4444('0x18')]]);}}}catch(_0x325deb){logger['error'](_0x4444('0x2f'),util[_0x4444('0x24')](_0x325deb,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4444('0x16')][_0x4444('0x11')]=function(_0xf2a6bb){try{if(this['isNotNull'](_0xf2a6bb)){this[_0x4444('0x30')](_0xf2a6bb[_0x4444('0x18')],_[_0x4444('0x31')](_0xf2a6bb[_0x4444('0x32')])[0x0],_0xf2a6bb[_0x4444('0x33')]);if(this[_0x4444('0x14')](_0xf2a6bb['variable'])&&this['isNotNull'](_0xf2a6bb[_0x4444('0x32')]['outboundrouteid'])){if(_[_0x4444('0x15')](this[_0x4444('0x8')][_0xf2a6bb[_0x4444('0x18')]])){this[_0x4444('0x8')][_0xf2a6bb[_0x4444('0x18')]]={'routeId':_0xf2a6bb['value'],'variables':this[_0x4444('0x34')][_0xf2a6bb[_0x4444('0x18')]]};this[_0x4444('0x17')]('voice:outbound',_0x4444('0x21'),this[_0x4444('0x8')][_0xf2a6bb[_0x4444('0x18')]]);}}}}catch(_0x270ec6){logger['error'](_0x4444('0x35'),util['inspect'](_0x270ec6,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x5d139c,_0x21a9d3,_0xf86a0f){var _0x34b9ca=['rtpaudioqos',_0x4444('0x36'),_0x4444('0x37'),_0x4444('0x38'),_0x4444('0x39'),_0x4444('0x3a'),'rtpaudioqosrtt',_0x4444('0x3b'),_0x4444('0x3c'),'sipuri',_0x4444('0x3d'),_0x4444('0x3e'),'membercalls',_0x4444('0x3f'),_0x4444('0x40'),'memberlastcall',_0x4444('0x41'),'memberpenalty',_0x4444('0x42')];if(!_[_0x4444('0x43')](_0x21a9d3)&&!_[_0x4444('0x44')](_0x34b9ca,_0x21a9d3)){if(_[_0x4444('0x15')](this['variables'][_0x5d139c])){this[_0x4444('0x34')][_0x5d139c]={};}this[_0x4444('0x34')][_0x5d139c][_0x21a9d3]=_0xf86a0f;}};VoiceDialReport['prototype'][_0x4444('0x13')]=function(_0x38aa4a){try{if(this['isNotNull'](_0x38aa4a)){if(this[_0x4444('0x8')][_0x38aa4a[_0x4444('0x18')]]){this['channels'][_0x38aa4a[_0x4444('0x18')]]['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x4444('0x8')][_0x38aa4a[_0x4444('0x18')]]['duration']=moment(this['channels'][_0x38aa4a[_0x4444('0x18')]][_0x4444('0x45')])[_0x4444('0x46')](this[_0x4444('0x8')][_0x38aa4a['uniqueid']][_0x4444('0x47')],'seconds');this[_0x4444('0x8')][_0x38aa4a[_0x4444('0x18')]]['lastevent']=_0x4444('0x48');this[_0x4444('0xa')][_0x4444('0x49')]+=0x1;if(this[_0x4444('0x8')][_0x38aa4a[_0x4444('0x18')]]['answertime']){this[_0x4444('0xa')][_0x4444('0x4a')]+=0x1;this[_0x4444('0x8')][_0x38aa4a[_0x4444('0x18')]][_0x4444('0x4b')]=moment(this[_0x4444('0x8')][_0x38aa4a[_0x4444('0x18')]][_0x4444('0x29')])[_0x4444('0x46')](this[_0x4444('0x8')][_0x38aa4a['uniqueid']][_0x4444('0x47')],'seconds');this[_0x4444('0x8')][_0x38aa4a[_0x4444('0x18')]]['billableseconds']=moment(this[_0x4444('0x8')][_0x38aa4a['uniqueid']][_0x4444('0x45')])[_0x4444('0x46')](this[_0x4444('0x8')][_0x38aa4a['uniqueid']][_0x4444('0x29')],'seconds');this['outbound'][_0x4444('0x4c')]+=this[_0x4444('0x8')][_0x38aa4a[_0x4444('0x18')]]['holdtime']||0x0;this['outbound'][_0x4444('0x4d')]+=this['channels'][_0x38aa4a['uniqueid']]['billableseconds'];}this[_0x4444('0xa')][_0x4444('0x4e')]+=this['channels'][_0x38aa4a['uniqueid']]['duration'];ami[_0x4444('0x17')]('custom:voiceDialReport',this[_0x4444('0x8')][_0x38aa4a['uniqueid']]);ami[_0x4444('0x17')](_0x4444('0x4f'),this[_0x4444('0x8')][_0x38aa4a[_0x4444('0x18')]]);this[_0x4444('0x17')]('voice:outbound',_0x4444('0x50'),this[_0x4444('0xa')]);logger[_0x4444('0x51')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x4444('0x52')](this[_0x4444('0x8')][_0x38aa4a[_0x4444('0x18')]]));this['emit']('voice:outbound','voice_outbound_channel:remove',this[_0x4444('0x8')][_0x38aa4a['uniqueid']]);delete this[_0x4444('0x8')][_0x38aa4a[_0x4444('0x18')]];}if(this[_0x4444('0x34')][_0x38aa4a[_0x4444('0x18')]]){delete this[_0x4444('0x34')][_0x38aa4a[_0x4444('0x18')]];}}}catch(_0xc16d4e){logger[_0x4444('0x22')](_0x4444('0x53'),util[_0x4444('0x24')](_0xc16d4e,{'showHidden':![],'depth':null}));}};module[_0x4444('0x54')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 35c5a9f..0a34552 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 _0xa216=['switch','isNil','Action','channel','catch','No\x20such\x20channel','[voiceQueueReport][checkChannel]','error','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','inspect','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','emitVoiceQueueChannelRemove','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','name','strategy','answered','available','loggedIn','pTalking','total','unmanaged','abandoned','Trunk','active','callerid','Interval','voice_queue:save','isNotNull','queues','[queues]','flagQueueSummary','queuesummary','then','[queuesummary]','queue','countBy','callers','toNumber','loggedin','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','YYYY-MM-DD\x20HH:mm:ss','position','merge','[syncQueueCallerJoin][VoiceQueueReport]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerexitreason','ABANDONED','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','syncQueueCallerLeave','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','syncAgentConnect','queuecallercomplete','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','queuecallerabandonAt','assigned','queuecallerexit','transfer','reason','COMPLETED','startsWith','toLowerCase','local/','queuecallerexitAt','queuecallerjoinAt','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','linkedid','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','addVariable','keys','variable','value','TIMEOUT','timeout','custom:timeout','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','membername','includes','length','diff','seconds','sumDuration','milliseconds','sumBillable','lastevent','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','BLIND','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','bluebird','util','md5','ioredis','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','campaigns','variables','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncAgentComplete','agentconnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','loopQueueSummary','isUndefined','hasOwnProperty','isEmpty','originated','talking','waiting','queueStatusComplete','prototype','clearZombieChannels'];(function(_0x5b2c50,_0x4db66b){var _0x47f2f9=function(_0xef76e4){while(--_0xef76e4){_0x5b2c50['push'](_0x5b2c50['shift']());}};_0x47f2f9(++_0x4db66b);}(_0xa216,0x158));var _0x6a21=function(_0x1efa26,_0x431db3){_0x1efa26=_0x1efa26-0x0;var _0x16a0b4=_0xa216[_0x1efa26];return _0x16a0b4;};'use strict';var _=require(_0x6a21('0x0'));var moment=require('moment');var BPromise=require(_0x6a21('0x1'));var util=require(_0x6a21('0x2'));var md5=require(_0x6a21('0x3'));var Redis=require(_0x6a21('0x4'));var config=require('../../../config/environment');var logger=require(_0x6a21('0x5'))(_0x6a21('0x6'));var ami=require(_0x6a21('0x7'));var QueueReport=require('../model/queueReport');config[_0x6a21('0x8')]=_[_0x6a21('0x9')](config[_0x6a21('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x6a21('0xa'))(new Redis(config[_0x6a21('0x8')]));var Sequence=function(){};Sequence['prototype'][_0x6a21('0xb')]=function(_0x19efc4){this[_0x6a21('0xc')]=this[_0x6a21('0xc')]?this[_0x6a21('0xc')][_0x6a21('0xd')](_0x19efc4):_0x19efc4();};function VoiceQueueReport(_0x1f870b){this[_0x6a21('0xe')]=new Sequence();this[_0x6a21('0xf')]={};this[_0x6a21('0x10')]=_0x1f870b[_0x6a21('0x10')];this[_0x6a21('0x11')]=_0x1f870b[_0x6a21('0x12')];this[_0x6a21('0x13')]=_0x1f870b[_0x6a21('0x13')];this['flagQueueSummary']=!![];this[_0x6a21('0x14')]=_0x1f870b[_0x6a21('0x14')];this[_0x6a21('0x15')]={};ami['on']('queuesummary',this[_0x6a21('0x16')][_0x6a21('0x17')](this));ami['on'](_0x6a21('0x18'),this[_0x6a21('0x19')][_0x6a21('0x17')](this));ami['on'](_0x6a21('0x1a'),this[_0x6a21('0x1b')][_0x6a21('0x17')](this));ami['on'](_0x6a21('0x1c'),this[_0x6a21('0x1d')][_0x6a21('0x17')](this));ami['on'](_0x6a21('0x1e'),this['syncQueueCallerLeave'][_0x6a21('0x17')](this));ami['on']('agentcomplete',this[_0x6a21('0x1f')][_0x6a21('0x17')](this));ami['on'](_0x6a21('0x20'),this['syncAgentConnect'][_0x6a21('0x17')](this));ami['on'](_0x6a21('0x21'),this[_0x6a21('0x22')][_0x6a21('0x17')](this));ami['on'](_0x6a21('0x23'),this[_0x6a21('0x24')][_0x6a21('0x17')](this));ami['on'](_0x6a21('0x25'),this[_0x6a21('0x26')]['bind'](this));ami['on'](_0x6a21('0x27'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x6a21('0x28'),this[_0x6a21('0x29')][_0x6a21('0x17')](this));ami['on'](_0x6a21('0x2a'),this[_0x6a21('0x2b')][_0x6a21('0x17')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x6a21('0x17')](this));this[_0x6a21('0x2c')]();this['loopQueueShow']();}function isNotNull(_0x8a81e0){return _0x8a81e0!==null&&!_[_0x6a21('0x2d')](_0x8a81e0);}function clearChannels(_0x2530c8){if(!_['isEmpty'](_0x2530c8)){for(var _0x239e87 in _0x2530c8){if(_0x2530c8[_0x6a21('0x2e')](_0x239e87)){delete _0x2530c8[_0x239e87];}}}}function clearCampaigns(_0x51505a){if(!_[_0x6a21('0x2f')](_0x51505a)){for(var _0x4dfa2f in _0x51505a){if(_0x51505a[_0x6a21('0x2e')](_0x4dfa2f)){_0x51505a[_0x4dfa2f][_0x6a21('0x30')]=0x0;}}}}function clearVoiceQueues(_0x3a1da7){if(!_['isEmpty'](_0x3a1da7)){for(var _0x1484d3 in _0x3a1da7){if(_0x3a1da7[_0x6a21('0x2e')](_0x1484d3)){_0x3a1da7[_0x1484d3][_0x6a21('0x30')]=0x0;_0x3a1da7[_0x1484d3][_0x6a21('0x31')]=0x0;_0x3a1da7[_0x1484d3]['pTalking']=0x0;_0x3a1da7[_0x1484d3][_0x6a21('0x32')]=0x0;_0x3a1da7[_0x1484d3][_0x6a21('0x33')]=!![];}}}}function clearAgentBooked(_0x1782c7){if(!_[_0x6a21('0x2f')](_0x1782c7)){for(var _0x436ee7 in _0x1782c7){if(_0x1782c7[_0x6a21('0x2e')](_0x436ee7)){_0x1782c7[_0x436ee7]['unlockRR']=!![];}}}}VoiceQueueReport[_0x6a21('0x34')][_0x6a21('0x35')]=function(){var _0x4c3359=this;for(var _0x44c996 in this[_0x6a21('0x11')]){if(this[_0x6a21('0x11')]['hasOwnProperty'](_0x44c996)&&!this[_0x6a21('0x11')][_0x44c996][_0x6a21('0x36')]){this[_0x6a21('0xe')][_0x6a21('0xb')](function(){if(!_[_0x6a21('0x37')](_0x4c3359[_0x6a21('0x11')][_0x44c996])){return ami[_0x6a21('0x38')]({'action':'status','channel':_0x4c3359[_0x6a21('0x11')][_0x44c996][_0x6a21('0x39')]})[_0x6a21('0x3a')](function(_0x4c75ca){if(_0x4c75ca['message']===_0x6a21('0x3b')){setTimeout(function(){if(_0x4c3359['channels'][_0x44c996]){delete _0x4c3359['channels'][_0x44c996];logger['error'](_0x6a21('0x3c'),_0x44c996);}if(_0x4c3359[_0x6a21('0xf')][_0x44c996]){delete _0x4c3359[_0x6a21('0xf')][_0x44c996];logger[_0x6a21('0x3d')]('[voiceQueueReport][checkQueueReport]',_0x44c996);}if(_0x4c3359[_0x6a21('0x15')][_0x44c996]){delete _0x4c3359['variables'][_0x44c996];logger['error'](_0x6a21('0x3e'),_0x44c996);}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x6a21('0x26')]=function(){logger[_0x6a21('0x3d')](_0x6a21('0x3f'));clearChannels(this['channels']);this[_0x6a21('0x40')](this[_0x6a21('0xf')]);clearAgentBooked(this[_0x6a21('0x10')]);clearVoiceQueues(this[_0x6a21('0x13')]);clearCampaigns(this[_0x6a21('0x14')]);};VoiceQueueReport[_0x6a21('0x34')]['clearQueueReport']=function(_0x4c53b7){var _0x407526=this;if(!_[_0x6a21('0x2f')](_0x4c53b7)){for(var _0x2a969e in _0x4c53b7){if(_0x4c53b7[_0x6a21('0x2e')](_0x2a969e)){_0x407526['emitVoiceQueueChannelRemove'](_0x4c53b7[_0x2a969e]);delete _0x4c53b7[_0x2a969e];}}}};function loggerCatch(_0x569c7e){return function(_0x43ce8f){logger[_0x6a21('0x3d')](_0x569c7e,util[_0x6a21('0x41')](_0x43ce8f,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x6a21('0x34')]['emit']=function(_0x15a9b6,_0x39679f,_0x12c4a7){io['to'](_0x15a9b6)[_0x6a21('0x42')](_0x39679f,_0x12c4a7);};VoiceQueueReport[_0x6a21('0x34')][_0x6a21('0x43')]=function(_0x4a611d){this[_0x6a21('0x42')](util[_0x6a21('0x44')](_0x6a21('0x45'),_0x4a611d['name']),'voice_queue_channel:save',_0x4a611d);};VoiceQueueReport[_0x6a21('0x34')][_0x6a21('0x46')]=function(_0x4a5d66){logger['info'](_0x6a21('0x47'),JSON[_0x6a21('0x48')](_0x4a5d66));this[_0x6a21('0x42')](util[_0x6a21('0x44')]('voice:queue:%s',_0x4a5d66['name']),_0x6a21('0x49'),_0x4a5d66);};VoiceQueueReport[_0x6a21('0x34')][_0x6a21('0x4a')]=function(_0x2729f5){if(_0x2729f5[_0x6a21('0x4b')]===_0x6a21('0x4c')){var _0x309def={'id':_0x2729f5['id'],'name':_0x2729f5[_0x6a21('0x4d')],'strategy':_0x2729f5[_0x6a21('0x4e')],'answered':_0x2729f5[_0x6a21('0x4f')],'available':_0x2729f5[_0x6a21('0x50')],'loggedIn':_0x2729f5[_0x6a21('0x51')],'pTalking':_0x2729f5[_0x6a21('0x52')],'sumBillable':_0x2729f5['sumBillable'],'sumDuration':_0x2729f5['sumDuration'],'sumHoldTime':_0x2729f5['sumHoldTime']||0x0,'talking':_0x2729f5['talking'],'total':_0x2729f5[_0x6a21('0x53')],'type':_0x2729f5[_0x6a21('0x4b')],'unmanaged':_0x2729f5[_0x6a21('0x54')],'abandoned':_0x2729f5[_0x6a21('0x55')],'waiting':_0x2729f5[_0x6a21('0x32')]};if(_0x2729f5[_0x6a21('0x56')]){_0x309def[_0x6a21('0x56')]={'id':_0x2729f5[_0x6a21('0x56')]['id'],'name':_0x2729f5['Trunk'][_0x6a21('0x4d')],'active':_0x2729f5[_0x6a21('0x56')][_0x6a21('0x57')],'callerid':_0x2729f5[_0x6a21('0x56')][_0x6a21('0x58')]};}if(_0x2729f5['Interval']){_0x309def[_0x6a21('0x59')]={'id':_0x2729f5['Interval']['id'],'name':_0x2729f5[_0x6a21('0x59')][_0x6a21('0x4d')]};}var _0x161589=md5(JSON[_0x6a21('0x48')](_0x309def));if(_0x2729f5[_0x6a21('0x3')]!==_0x161589){_0x2729f5[_0x6a21('0x3')]=_0x161589;this[_0x6a21('0x42')](util[_0x6a21('0x44')]('voice:queue:%s',_0x309def[_0x6a21('0x4d')]),_0x6a21('0x5a'),_0x309def);}}};VoiceQueueReport[_0x6a21('0x34')][_0x6a21('0x5b')]=function(_0xcf8b41){return _0xcf8b41!==null&&!_[_0x6a21('0x2d')](_0xcf8b41);};VoiceQueueReport[_0x6a21('0x34')]['loopQueueShow']=function(){var _0xb5a957=this;setInterval(function(){_0xb5a957[_0x6a21('0x35')]();ami[_0x6a21('0x38')]({'action':_0x6a21('0x5c')})[_0x6a21('0x3a')](loggerCatch(_0x6a21('0x5d')));},0x2710);};VoiceQueueReport[_0x6a21('0x34')][_0x6a21('0x2c')]=function(){var _0x5f5819=this;setInterval(function(){if(_0x5f5819[_0x6a21('0x5e')]){return ami[_0x6a21('0x38')]({'action':_0x6a21('0x5f')})[_0x6a21('0x60')](function(_0x3a5413){_0x5f5819[_0x6a21('0x5e')]=![];})[_0x6a21('0x3a')](loggerCatch(_0x6a21('0x61')));}},0x3e8);};VoiceQueueReport['prototype'][_0x6a21('0x16')]=function(_0x2a2dc7){try{if(this[_0x6a21('0x5b')](_0x2a2dc7)&&this[_0x6a21('0x5b')](_0x2a2dc7[_0x6a21('0x62')])){if(this[_0x6a21('0x13')][_0x2a2dc7[_0x6a21('0x62')]]){var _0x11e52a=_[_0x6a21('0x63')](this[_0x6a21('0x11')],_0x6a21('0x62'))[_0x2a2dc7[_0x6a21('0x62')]]||0x0;var _0x213d97=_0x11e52a-_0x2a2dc7[_0x6a21('0x64')];if(this[_0x6a21('0x13')][_0x2a2dc7[_0x6a21('0x62')]][_0x6a21('0x32')]!==_['toNumber'](_0x2a2dc7['callers'])||this[_0x6a21('0x13')][_0x2a2dc7[_0x6a21('0x62')]]['loggedIn']!==_[_0x6a21('0x65')](_0x2a2dc7[_0x6a21('0x66')])||this[_0x6a21('0x13')][_0x2a2dc7['queue']][_0x6a21('0x50')]!==_[_0x6a21('0x65')](_0x2a2dc7[_0x6a21('0x50')])||this[_0x6a21('0x13')][_0x2a2dc7[_0x6a21('0x62')]]['talking']!==_0x213d97){this['voiceQueues'][_0x2a2dc7[_0x6a21('0x62')]][_0x6a21('0x32')]=_[_0x6a21('0x65')](_0x2a2dc7[_0x6a21('0x64')]);this[_0x6a21('0x13')][_0x2a2dc7[_0x6a21('0x62')]][_0x6a21('0x51')]=_[_0x6a21('0x65')](_0x2a2dc7[_0x6a21('0x66')]);this[_0x6a21('0x13')][_0x2a2dc7[_0x6a21('0x62')]][_0x6a21('0x50')]=_[_0x6a21('0x65')](_0x2a2dc7[_0x6a21('0x50')]);this[_0x6a21('0x13')][_0x2a2dc7[_0x6a21('0x62')]][_0x6a21('0x31')]=_0x213d97>0x0?_0x213d97:0x0;this['voiceQueues'][_0x2a2dc7[_0x6a21('0x62')]]['talking']=this[_0x6a21('0x13')][_0x2a2dc7[_0x6a21('0x62')]][_0x6a21('0x31')]>_[_0x6a21('0x65')](_0x2a2dc7[_0x6a21('0x66')])?_[_0x6a21('0x65')](_0x2a2dc7[_0x6a21('0x66')]):this['voiceQueues'][_0x2a2dc7[_0x6a21('0x62')]][_0x6a21('0x31')];this[_0x6a21('0x4a')](this[_0x6a21('0x13')][_0x2a2dc7['queue']]);}ami[_0x6a21('0x42')]('custom:queuesummary',this['voiceQueues'][_0x2a2dc7[_0x6a21('0x62')]]);}}}catch(_0x2583e5){logger[_0x6a21('0x3d')](_0x6a21('0x67'),util[_0x6a21('0x41')](_0x2583e5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6a21('0x19')]=function(_0xf0271){this['flagQueueSummary']=!![];};VoiceQueueReport['prototype'][_0x6a21('0x68')]=function(_0x14de04){};VoiceQueueReport['prototype'][_0x6a21('0x1b')]=function(_0x244380){try{if(this['isNotNull'](_0x244380)){if(_[_0x6a21('0x2d')](this[_0x6a21('0xf')][_0x244380[_0x6a21('0x69')]])){this[_0x6a21('0xf')][_0x244380['uniqueid']]=[];this[_0x6a21('0x11')][_0x244380[_0x6a21('0x69')]]={};}var _0x47c32d=new QueueReport();_0x47c32d[_0x6a21('0x4d')]=_0x244380[_0x6a21('0x62')];_0x47c32d[_0x6a21('0x4b')]=this[_0x6a21('0x13')][_0x47c32d[_0x6a21('0x4d')]]&&this[_0x6a21('0x13')][_0x47c32d[_0x6a21('0x4d')]][_0x6a21('0x4b')]?this[_0x6a21('0x13')][_0x47c32d[_0x6a21('0x4d')]]['type']||'inbound':_0x6a21('0x4c');_0x47c32d[_0x6a21('0x62')]=_0x244380[_0x6a21('0x62')];_0x47c32d['queuecallerjoinAt']=moment()['format'](_0x6a21('0x6a'));_0x47c32d[_0x6a21('0x6b')]=_0x244380[_0x6a21('0x6b')];_0x47c32d['count']=_0x244380['count'];_[_0x6a21('0x6c')](_0x47c32d,_['pick'](_0x244380,_['keys'](_0x47c32d)));this[_0x6a21('0xf')][_0x244380[_0x6a21('0x69')]]['push'](_0x47c32d);this[_0x6a21('0x11')][_0x244380[_0x6a21('0x69')]]=_0x47c32d;this[_0x6a21('0x43')](_0x47c32d);}}catch(_0x40a023){logger[_0x6a21('0x3d')](_0x6a21('0x6d'),util['inspect'](_0x40a023,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a21('0x34')]['syncQueueCallerAbandon']=function(_0x53c704){try{if(this[_0x6a21('0x5b')](_0x53c704)){if(this['queueReports'][_0x53c704[_0x6a21('0x69')]]){var _0x123fae=_[_0x6a21('0x6e')](this[_0x6a21('0xf')][_0x53c704['uniqueid']]);_0x123fae['queuecallercomplete']=![];_0x123fae[_0x6a21('0x6f')]=null;_0x123fae[_0x6a21('0x70')]=_0x53c704[_0x6a21('0x70')];_0x123fae[_0x6a21('0x71')]=_0x53c704[_0x6a21('0x71')];_0x123fae['queuecallerabandon']=!![];_0x123fae['queuecallerabandonAt']=moment()[_0x6a21('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x123fae[_0x6a21('0x72')]=_0x6a21('0x73');_0x123fae[_0x6a21('0x74')]=null;this[_0x6a21('0x11')][_0x53c704[_0x6a21('0x69')]]=_0x123fae;this[_0x6a21('0x46')](_0x123fae);}}}catch(_0x56450d){logger['error'](_0x6a21('0x75'),util[_0x6a21('0x41')](_0x56450d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6a21('0x76')]=function(_0x40c590){try{if(this[_0x6a21('0x5b')](_0x40c590)){if(this[_0x6a21('0xf')][_0x40c590[_0x6a21('0x69')]]){var _0x4abfca=_[_0x6a21('0x6e')](this[_0x6a21('0xf')][_0x40c590[_0x6a21('0x69')]]);_0x4abfca[_0x6a21('0x77')]=moment()[_0x6a21('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x4abfca[_0x6a21('0x78')]=_0x40c590[_0x6a21('0x78')];_0x4abfca[_0x6a21('0x79')]=_0x40c590[_0x6a21('0x79')];this[_0x6a21('0x11')][_0x40c590[_0x6a21('0x69')]]=_0x4abfca;this[_0x6a21('0x43')](_0x4abfca);}}}catch(_0x1d32e2){logger['error'](_0x6a21('0x7a'),util[_0x6a21('0x41')](_0x1d32e2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a21('0x34')][_0x6a21('0x7b')]=function(_0xc0de83){try{if(this[_0x6a21('0x5b')](_0xc0de83)){if(this[_0x6a21('0xf')][_0xc0de83['uniqueid']]){var _0x48499a=_[_0x6a21('0x6e')](this['queueReports'][_0xc0de83[_0x6a21('0x69')]]);_0x48499a[_0x6a21('0x7c')]=!![];_0x48499a[_0x6a21('0x72')]=_0x6a21('0x7d');}}}catch(_0x5d4af5){logger[_0x6a21('0x3d')](_0x6a21('0x7e'),util[_0x6a21('0x41')](_0x5d4af5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a21('0x34')][_0x6a21('0x1f')]=function(_0x42172f){try{if(this[_0x6a21('0x5b')](_0x42172f)){if(this[_0x6a21('0xf')][_0x42172f[_0x6a21('0x69')]]){var _0x1a630a=_[_0x6a21('0x6e')](this[_0x6a21('0xf')][_0x42172f[_0x6a21('0x69')]]);_0x1a630a[_0x6a21('0x1c')]=![];_0x1a630a[_0x6a21('0x7f')]=null;_0x1a630a[_0x6a21('0x80')]=!![];_0x1a630a[_0x6a21('0x74')]=_0x42172f['membername'];_0x1a630a[_0x6a21('0x70')]=_0x42172f[_0x6a21('0x70')];_0x1a630a[_0x6a21('0x7c')]=!![];_0x1a630a[_0x6a21('0x81')]=![];_0x1a630a['queuecallerexitAt']=null;if(!_0x1a630a[_0x6a21('0x82')]){if(_0x42172f[_0x6a21('0x83')]=='transfer'){_0x1a630a[_0x6a21('0x72')]=_0x6a21('0x84');}else{if(_[_0x6a21('0x85')](_0x42172f[_0x6a21('0x39')][_0x6a21('0x86')](),_0x6a21('0x87'))){if(this['queueReports'][_0x42172f['linkedid']]){var _0x2d315a=_['last'](this[_0x6a21('0xf')][_0x42172f['linkedid']]);_0x2d315a[_0x6a21('0x7c')]=![];_0x2d315a[_0x6a21('0x81')]=!![];_0x2d315a[_0x6a21('0x88')]=moment(_0x1a630a[_0x6a21('0x89')])['add'](_0x42172f['holdtime'],'seconds')[_0x6a21('0x44')](_0x6a21('0x6a'));_0x2d315a['queuecallerexitreason']=_0x6a21('0x8a');_0x2d315a[_0x6a21('0x82')]=!![];_0x2d315a[_0x6a21('0x8b')]=_0x6a21('0x8c');_0x2d315a[_0x6a21('0x8d')]=_0x42172f[_0x6a21('0x8e')];_0x2d315a[_0x6a21('0x8f')]=_0x42172f[_0x6a21('0x69')];var _0x11765e=this[_0x6a21('0xf')][_0x42172f[_0x6a21('0x90')]];this[_0x6a21('0xf')][_0x42172f[_0x6a21('0x90')]]=this[_0x6a21('0xf')][_0x42172f[_0x6a21('0x69')]];this['queueReports'][_0x42172f[_0x6a21('0x69')]]=_0x11765e;}}else{_0x1a630a[_0x6a21('0x72')]=_0x6a21('0x91')+_0x42172f[_0x6a21('0x83')][_0x6a21('0x92')]();}}}this[_0x6a21('0x11')][_0x42172f[_0x6a21('0x69')]]=_0x1a630a;this[_0x6a21('0x46')](_0x1a630a);}}}catch(_0x4b72a0){logger['error'](_0x6a21('0x93'),util[_0x6a21('0x41')](_0x4b72a0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a21('0x34')][_0x6a21('0x22')]=function(_0xada731){try{if(this['isNotNull'](_0xada731)){this[_0x6a21('0x94')](_0xada731['uniqueid'],_[_0x6a21('0x95')](_0xada731[_0x6a21('0x96')])[0x0],_0xada731['value']);if(this[_0x6a21('0xf')][_0xada731[_0x6a21('0x69')]]){var _0x2255fb=_[_0x6a21('0x6e')](this[_0x6a21('0xf')][_0xada731['uniqueid']]);if(_0x2255fb){if(this[_0x6a21('0x5b')](_0xada731[_0x6a21('0x96')])&&this['isNotNull'](_0xada731['variable']['queuestatus'])){switch(_0xada731[_0x6a21('0x97')]){case'CONTINUE':_0x2255fb[_0x6a21('0x81')]=![];_0x2255fb['queuecallerexitAt']=null;break;case _0x6a21('0x98'):_0x2255fb['lastevent']=_0x6a21('0x99');ami[_0x6a21('0x42')](_0x6a21('0x9a'),_0x2255fb);break;default:_0x2255fb[_0x6a21('0x81')]=!![];_0x2255fb[_0x6a21('0x88')]=moment()[_0x6a21('0x44')](_0x6a21('0x6a'));_0x2255fb[_0x6a21('0x77')]=moment()[_0x6a21('0x44')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2255fb[_0x6a21('0x1c')]=![];_0x2255fb[_0x6a21('0x7f')]=null;_0x2255fb[_0x6a21('0x72')]=_0xada731[_0x6a21('0x97')];this[_0x6a21('0x11')][_0xada731[_0x6a21('0x69')]]=_0x2255fb;this[_0x6a21('0x46')](_0x2255fb);}else if(this[_0x6a21('0x5b')](_0xada731[_0x6a21('0x96')])&&this[_0x6a21('0x5b')](_0xada731['variable']['queueposition'])){if(!_0x2255fb[_0x6a21('0x1c')]){_0x2255fb['queuecallerexit']=!![];_0x2255fb[_0x6a21('0x88')]=moment()[_0x6a21('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x2255fb[_0x6a21('0x72')]=_0x6a21('0x9b');_0x2255fb[_0x6a21('0x77')]=moment()[_0x6a21('0x44')](_0x6a21('0x6a'));this[_0x6a21('0x11')][_0xada731[_0x6a21('0x69')]]=_0x2255fb;}}_0x2255fb['variables']=this[_0x6a21('0x15')][_0xada731[_0x6a21('0x69')]];}}}}catch(_0x28f5f9){logger[_0x6a21('0x3d')](_0x6a21('0x9c'),util[_0x6a21('0x41')](_0x28f5f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a21('0x34')]['addVariable']=function(_0x1c6861,_0x25b57a,_0x288b9f){var _0x3a7d33=[_0x6a21('0x9d'),_0x6a21('0x9e'),_0x6a21('0x9f'),_0x6a21('0xa0'),'rtpaudioqosloss',_0x6a21('0xa1'),_0x6a21('0xa2'),_0x6a21('0xa3'),'sipcallid','sipuri','bridgepeer',_0x6a21('0xa4'),_0x6a21('0xa5'),_0x6a21('0xa6'),'memberinterface',_0x6a21('0xa7'),_0x6a21('0xa8'),'memberpenalty','memberrealtime'];if(!_[_0x6a21('0x37')](_0x25b57a)&&!_[_0x6a21('0xa9')](_0x3a7d33,_0x25b57a)){if(_[_0x6a21('0x2d')](this['variables'][_0x1c6861])){this[_0x6a21('0x15')][_0x1c6861]={};}this['variables'][_0x1c6861][_0x25b57a]=_0x288b9f;}};VoiceQueueReport[_0x6a21('0x34')][_0x6a21('0x24')]=function(_0x5e7dc6){try{if(this['isNotNull'](_0x5e7dc6)){if(this['queueReports'][_0x5e7dc6[_0x6a21('0x69')]]){for(var _0x3b8f9c=0x0,_0xf19dde={};_0x3b8f9c0x0?_0x116555:0x0;this[_0x3cb9('0x13')][_0x265d09[_0x3cb9('0x66')]]['talking']=this[_0x3cb9('0x13')][_0x265d09['queue']]['talking']>_[_0x3cb9('0x68')](_0x265d09['loggedin'])?_[_0x3cb9('0x68')](_0x265d09[_0x3cb9('0x6a')]):this[_0x3cb9('0x13')][_0x265d09['queue']][_0x3cb9('0x2c')];this[_0x3cb9('0x6c')](this[_0x3cb9('0x13')][_0x265d09[_0x3cb9('0x66')]]);}ami[_0x3cb9('0x44')](_0x3cb9('0x6d'),this['voiceQueues'][_0x265d09[_0x3cb9('0x66')]]);}}}catch(_0x3b06eb){logger['error'](_0x3cb9('0x6e'),util['inspect'](_0x3b06eb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3cb9('0xb')][_0x3cb9('0x18')]=function(_0x46bd60){this[_0x3cb9('0x14')]=!![];};VoiceQueueReport['prototype'][_0x3cb9('0x6f')]=function(_0x3cce3c){};VoiceQueueReport[_0x3cb9('0xb')][_0x3cb9('0x1a')]=function(_0x4b9d4e){try{if(this[_0x3cb9('0x5d')](_0x4b9d4e)){if(_[_0x3cb9('0x5e')](this[_0x3cb9('0x10')][_0x4b9d4e[_0x3cb9('0x70')]])){this[_0x3cb9('0x10')][_0x4b9d4e[_0x3cb9('0x70')]]=[];this[_0x3cb9('0x32')][_0x4b9d4e[_0x3cb9('0x70')]]={};}var _0x5629c7=new QueueReport();_0x5629c7[_0x3cb9('0x48')]=_0x4b9d4e['queue'];_0x5629c7[_0x3cb9('0x4e')]=this[_0x3cb9('0x13')][_0x5629c7[_0x3cb9('0x48')]]&&this[_0x3cb9('0x13')][_0x5629c7['name']][_0x3cb9('0x4e')]?this[_0x3cb9('0x13')][_0x5629c7[_0x3cb9('0x48')]][_0x3cb9('0x4e')]||_0x3cb9('0x4f'):_0x3cb9('0x4f');_0x5629c7[_0x3cb9('0x66')]=_0x4b9d4e[_0x3cb9('0x66')];_0x5629c7[_0x3cb9('0x71')]=moment()[_0x3cb9('0x46')](_0x3cb9('0x72'));_0x5629c7['position']=_0x4b9d4e['position'];_0x5629c7[_0x3cb9('0x73')]=_0x4b9d4e[_0x3cb9('0x73')];_[_0x3cb9('0x74')](_0x5629c7,_['pick'](_0x4b9d4e,_['keys'](_0x5629c7)));this[_0x3cb9('0x10')][_0x4b9d4e[_0x3cb9('0x70')]][_0x3cb9('0x75')](_0x5629c7);this['channels'][_0x4b9d4e['uniqueid']]=_0x5629c7;this['emitVoiceQueueChannelSave'](_0x5629c7);}}catch(_0x5902b5){logger['error']('[syncQueueCallerJoin][VoiceQueueReport]',util[_0x3cb9('0x43')](_0x5902b5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3cb9('0xb')][_0x3cb9('0x1c')]=function(_0x47b1b9){try{if(this[_0x3cb9('0x5d')](_0x47b1b9)){if(this[_0x3cb9('0x10')][_0x47b1b9[_0x3cb9('0x70')]]){var _0x5d30b1=_['last'](this['queueReports'][_0x47b1b9[_0x3cb9('0x70')]]);_0x5d30b1[_0x3cb9('0x76')]=![];_0x5d30b1[_0x3cb9('0x77')]=null;_0x5d30b1[_0x3cb9('0x78')]=_0x47b1b9[_0x3cb9('0x78')];_0x5d30b1[_0x3cb9('0x79')]=_0x47b1b9[_0x3cb9('0x79')];_0x5d30b1[_0x3cb9('0x1b')]=!![];_0x5d30b1['queuecallerabandonAt']=moment()[_0x3cb9('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d30b1[_0x3cb9('0x7a')]=_0x3cb9('0x7b');_0x5d30b1['lastAssignedTo']=null;this[_0x3cb9('0x32')][_0x47b1b9[_0x3cb9('0x70')]]=_0x5d30b1;this[_0x3cb9('0x42')](_0x5d30b1);}}}catch(_0x283948){logger[_0x3cb9('0x3a')](_0x3cb9('0x7c'),util[_0x3cb9('0x43')](_0x283948,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3cb9('0x1d')]=function(_0x1b5683){try{if(this[_0x3cb9('0x5d')](_0x1b5683)){if(this[_0x3cb9('0x10')][_0x1b5683[_0x3cb9('0x70')]]){var _0x1a5233=_[_0x3cb9('0x7d')](this[_0x3cb9('0x10')][_0x1b5683[_0x3cb9('0x70')]]);_0x1a5233[_0x3cb9('0x7e')]=moment()[_0x3cb9('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x1a5233['connectedlinenum']=_0x1b5683['connectedlinenum'];_0x1a5233['connectedlinename']=_0x1b5683['connectedlinename'];this[_0x3cb9('0x32')][_0x1b5683[_0x3cb9('0x70')]]=_0x1a5233;this[_0x3cb9('0x45')](_0x1a5233);}}}catch(_0x47bdff){logger[_0x3cb9('0x3a')](_0x3cb9('0x7f'),util['inspect'](_0x47bdff,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3cb9('0xb')][_0x3cb9('0x80')]=function(_0x34b17c){try{if(this[_0x3cb9('0x5d')](_0x34b17c)){if(this['queueReports'][_0x34b17c[_0x3cb9('0x70')]]){var _0x22e40e=_[_0x3cb9('0x7d')](this[_0x3cb9('0x10')][_0x34b17c[_0x3cb9('0x70')]]);_0x22e40e[_0x3cb9('0x76')]=!![];_0x22e40e['queuecallerexitreason']=_0x3cb9('0x81');}}}catch(_0x490df3){logger[_0x3cb9('0x3a')](_0x3cb9('0x82'),util[_0x3cb9('0x43')](_0x490df3,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x556c35){try{if(this['isNotNull'](_0x556c35)){if(this[_0x3cb9('0x10')][_0x556c35['uniqueid']]){var _0x421ba7=_['last'](this[_0x3cb9('0x10')][_0x556c35[_0x3cb9('0x70')]]);_0x421ba7[_0x3cb9('0x1b')]=![];_0x421ba7[_0x3cb9('0x83')]=null;_0x421ba7[_0x3cb9('0x84')]=!![];_0x421ba7['lastAssignedTo']=_0x556c35[_0x3cb9('0x85')];_0x421ba7[_0x3cb9('0x78')]=_0x556c35[_0x3cb9('0x78')];_0x421ba7[_0x3cb9('0x76')]=!![];_0x421ba7[_0x3cb9('0x86')]=![];_0x421ba7[_0x3cb9('0x87')]=null;if(!_0x421ba7[_0x3cb9('0x88')]){if(_0x556c35[_0x3cb9('0x89')]=='transfer'){_0x421ba7[_0x3cb9('0x7a')]=_0x3cb9('0x8a');}else{if(_[_0x3cb9('0x8b')](_0x556c35[_0x3cb9('0x36')]['toLowerCase'](),'local/')){if(this[_0x3cb9('0x10')][_0x556c35[_0x3cb9('0x8c')]]){var _0x202433=_[_0x3cb9('0x7d')](this[_0x3cb9('0x10')][_0x556c35[_0x3cb9('0x8c')]]);_0x202433[_0x3cb9('0x76')]=![];_0x202433[_0x3cb9('0x86')]=!![];_0x202433[_0x3cb9('0x87')]=moment(_0x421ba7[_0x3cb9('0x71')])[_0x3cb9('0x8d')](_0x556c35[_0x3cb9('0x78')],_0x3cb9('0x8e'))[_0x3cb9('0x46')](_0x3cb9('0x72'));_0x202433[_0x3cb9('0x7a')]=_0x3cb9('0x8f');_0x202433['transfer']=!![];_0x202433[_0x3cb9('0x90')]=_0x3cb9('0x91');_0x202433[_0x3cb9('0x92')]=_0x556c35[_0x3cb9('0x93')];_0x202433[_0x3cb9('0x94')]=_0x556c35[_0x3cb9('0x70')];var _0x530a89=this[_0x3cb9('0x10')][_0x556c35[_0x3cb9('0x8c')]];this['queueReports'][_0x556c35[_0x3cb9('0x8c')]]=this['queueReports'][_0x556c35[_0x3cb9('0x70')]];this[_0x3cb9('0x10')][_0x556c35['uniqueid']]=_0x530a89;}}else{_0x421ba7[_0x3cb9('0x7a')]=_0x3cb9('0x95')+_0x556c35[_0x3cb9('0x89')][_0x3cb9('0x96')]();}}}this['channels'][_0x556c35[_0x3cb9('0x70')]]=_0x421ba7;this[_0x3cb9('0x42')](_0x421ba7);}}}catch(_0x2a0a94){logger[_0x3cb9('0x3a')](_0x3cb9('0x97'),util['inspect'](_0x2a0a94,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3cb9('0xb')]['syncVarSet']=function(_0x5687e2){try{if(this[_0x3cb9('0x5d')](_0x5687e2)){this['addVariable'](_0x5687e2['uniqueid'],_[_0x3cb9('0x98')](_0x5687e2[_0x3cb9('0x99')])[0x0],_0x5687e2[_0x3cb9('0x9a')]);if(this[_0x3cb9('0x10')][_0x5687e2[_0x3cb9('0x70')]]){var _0x5e0d4a=_['last'](this[_0x3cb9('0x10')][_0x5687e2['uniqueid']]);if(_0x5e0d4a){if(this[_0x3cb9('0x5d')](_0x5687e2['variable'])&&this[_0x3cb9('0x5d')](_0x5687e2['variable'][_0x3cb9('0x9b')])){switch(_0x5687e2[_0x3cb9('0x9a')]){case _0x3cb9('0x9c'):_0x5e0d4a[_0x3cb9('0x86')]=![];_0x5e0d4a[_0x3cb9('0x87')]=null;break;case _0x3cb9('0x9d'):_0x5e0d4a[_0x3cb9('0x9e')]='timeout';ami[_0x3cb9('0x44')](_0x3cb9('0x9f'),_0x5e0d4a);break;default:_0x5e0d4a[_0x3cb9('0x86')]=!![];_0x5e0d4a[_0x3cb9('0x87')]=moment()[_0x3cb9('0x46')](_0x3cb9('0x72'));_0x5e0d4a[_0x3cb9('0x7e')]=moment()[_0x3cb9('0x46')](_0x3cb9('0x72'));}_0x5e0d4a[_0x3cb9('0x1b')]=![];_0x5e0d4a[_0x3cb9('0x83')]=null;_0x5e0d4a[_0x3cb9('0x7a')]=_0x5687e2['value'];this[_0x3cb9('0x32')][_0x5687e2[_0x3cb9('0x70')]]=_0x5e0d4a;this[_0x3cb9('0x42')](_0x5e0d4a);}else if(this[_0x3cb9('0x5d')](_0x5687e2[_0x3cb9('0x99')])&&this[_0x3cb9('0x5d')](_0x5687e2[_0x3cb9('0x99')][_0x3cb9('0xa0')])){if(!_0x5e0d4a[_0x3cb9('0x1b')]){_0x5e0d4a[_0x3cb9('0x86')]=!![];_0x5e0d4a[_0x3cb9('0x87')]=moment()[_0x3cb9('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e0d4a['queuecallerexitreason']='EXITWITHKEY';_0x5e0d4a[_0x3cb9('0x7e')]=moment()[_0x3cb9('0x46')](_0x3cb9('0x72'));this[_0x3cb9('0x32')][_0x5687e2[_0x3cb9('0x70')]]=_0x5e0d4a;}}_0x5e0d4a[_0x3cb9('0x3d')]=this[_0x3cb9('0x3d')][_0x5687e2['uniqueid']];}}}}catch(_0x402592){logger[_0x3cb9('0x3a')](_0x3cb9('0xa1'),util[_0x3cb9('0x43')](_0x402592,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3cb9('0xb')]['addVariable']=function(_0x16926e,_0x173dc9,_0x239259){var _0x2bfa26=[_0x3cb9('0xa2'),'rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x3cb9('0xa3'),'rtpaudioqoslossbridged',_0x3cb9('0xa4'),_0x3cb9('0xa5'),_0x3cb9('0xa6'),_0x3cb9('0xa7'),'bridgepeer',_0x3cb9('0xa8'),_0x3cb9('0xa9'),_0x3cb9('0xaa'),'memberinterface',_0x3cb9('0xab'),_0x3cb9('0x85'),_0x3cb9('0xac'),'memberrealtime'];if(!_['isNil'](_0x173dc9)&&!_[_0x3cb9('0xad')](_0x2bfa26,_0x173dc9)){if(_[_0x3cb9('0x5e')](this['variables'][_0x16926e])){this[_0x3cb9('0x3d')][_0x16926e]={};}this[_0x3cb9('0x3d')][_0x16926e][_0x173dc9]=_0x239259;}};VoiceQueueReport[_0x3cb9('0xb')]['syncHangup']=function(_0x11e32f){try{if(this[_0x3cb9('0x5d')](_0x11e32f)){if(this[_0x3cb9('0x10')][_0x11e32f[_0x3cb9('0x70')]]){for(var _0x4d71e9=0x0,_0x598887={};_0x4d71e9=0x0?moment(_0x2bf26f[_0xa5c7('0x1b')])[_0xa5c7('0x1c')](_0x2bf26f[_0xa5c7('0x1a')],'seconds'):null,'data1':_0xa5c7('0x1d'),'data2':_0x2bf26f[_0xa5c7('0x16')],'data3':_0x2bf26f[_0xa5c7('0x13')],'data4':_0x2bf26f[_0xa5c7('0x1e')]||null,'role':'agent','internal':_0x2bf26f[_0xa5c7('0x16')]?_[_0xa5c7('0x1f')](_0x2bf26f[_0xa5c7('0x16')]):undefined,'uniqueid':_0x2bf26f[_0xa5c7('0x17')]},'log':_0xa5c7('0x7')});}; \ No newline at end of file +var _0x4fab=['toNumber','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','dialstring','agent','moment','lodash','util','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','diff','seconds','inbound','calleridnum','exten','queue','accountcode'];(function(_0x1f802f,_0x2245ce){var _0x955ac6=function(_0x5d80e2){while(--_0x5d80e2){_0x1f802f['push'](_0x1f802f['shift']());}};_0x955ac6(++_0x2245ce);}(_0x4fab,0x159));var _0xb4fa=function(_0x399af8,_0x29a254){_0x399af8=_0x399af8-0x0;var _0x141965=_0x4fab[_0x399af8];return _0x141965;};'use strict';var moment=require(_0xb4fa('0x0'));var _=require(_0xb4fa('0x1'));var util=require(_0xb4fa('0x2'));var client=require('../client');exports['voiceQueueReport']=function(_0x301afe){var _0x1746ec=_0x301afe['queuecallercompleteAt']||_0x301afe['queuecallerexitAt'];return client[_0xb4fa('0x3')](_0xb4fa('0x4'),{'body':{'channel':_0xb4fa('0x5'),'membername':_0x301afe[_0xb4fa('0x6')],'interface':_[_0xb4fa('0x7')](_0x301afe[_0xb4fa('0x8')])?util[_0xb4fa('0x9')](_0xb4fa('0xa'),_0x301afe['lastAssignedTo']):_0x301afe[_0xb4fa('0x8')],'type':_0xb4fa('0xb'),'enterAt':_0x301afe['queuecallerleaveAt'],'exitAt':_0x1746ec,'duration':moment(_0x1746ec)[_0xb4fa('0xc')](_0x301afe['queuecallerleaveAt'],_0xb4fa('0xd')),'data1':_0xb4fa('0xe'),'data2':_0x301afe[_0xb4fa('0xf')],'data3':_0x301afe[_0xb4fa('0x10')],'data4':null,'data5':_0x301afe[_0xb4fa('0x11')],'role':'agent','internal':_0x301afe[_0xb4fa('0x12')]?_[_0xb4fa('0x13')](_0x301afe['accountcode']):undefined,'uniqueid':_0x301afe[_0xb4fa('0x14')]},'log':'CreateMemberReport'});};exports[_0xb4fa('0x15')]=function(_0x8c5d61){return client[_0xb4fa('0x3')](_0xb4fa('0x4'),{'body':{'channel':_0xb4fa('0x5'),'membername':_0x8c5d61[_0xb4fa('0x16')],'interface':_0x8c5d61[_0xb4fa('0x8')],'type':'TALKING','enterAt':_0x8c5d61[_0xb4fa('0x17')],'exitAt':_0x8c5d61[_0xb4fa('0x18')],'duration':moment(_0x8c5d61[_0xb4fa('0x18')])[_0xb4fa('0xc')](_0x8c5d61[_0xb4fa('0x17')],'seconds')>=0x0?moment(_0x8c5d61[_0xb4fa('0x18')])[_0xb4fa('0xc')](_0x8c5d61[_0xb4fa('0x17')],'seconds'):null,'data1':_0xb4fa('0x19'),'data2':_0x8c5d61[_0xb4fa('0x12')],'data3':_0x8c5d61[_0xb4fa('0x10')],'data4':_0x8c5d61[_0xb4fa('0x1a')]||null,'role':_0xb4fa('0x1b'),'internal':_0x8c5d61[_0xb4fa('0x12')]?_[_0xb4fa('0x13')](_0x8c5d61['accountcode']):undefined,'uniqueid':_0x8c5d61[_0xb4fa('0x14')]},'log':_0xb4fa('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index c55a09a..e1d97a7 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 _0xe739=['../client','Request','GetTemplate'];(function(_0x2edc4e,_0x1e20c3){var _0x23116f=function(_0x4f6030){while(--_0x4f6030){_0x2edc4e['push'](_0x2edc4e['shift']());}};_0x23116f(++_0x1e20c3);}(_0xe739,0x105));var _0x9e73=function(_0x4615ed,_0x2d62a2){_0x4615ed=_0x4615ed-0x0;var _0x208a62=_0xe739[_0x4615ed];return _0x208a62;};'use strict';var client=require(_0x9e73('0x0'));exports['getTemplates']=function(_0x43bd09){return function(_0x1620a4){return client[_0x9e73('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id','name','html']},'log':_0x9e73('0x2')});};}; \ No newline at end of file +var _0x765e=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x765e,0x131));var _0xe765=function(_0x40e6eb,_0x542271){_0x40e6eb=_0x40e6eb-0x0;var _0x29d09c=_0x765e[_0x40e6eb];return _0x29d09c;};'use strict';var client=require(_0xe765('0x0'));exports[_0xe765('0x1')]=function(_0x90232d){return function(_0x12ca51){return client[_0xe765('0x2')](_0xe765('0x3'),{'options':{'raw':!![],'attributes':['id',_0xe765('0x4'),_0xe765('0x5')]},'log':_0xe765('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index ebc46aa..44c394a 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 _0xc9ed=['AllConditions','operator','Condition','field','Action','Actions','action','data1','data2','data3','data5','data6','data7','../client','GetTrigger','name','status'];(function(_0x3df1e9,_0x3cd30e){var _0xd6b371=function(_0x4b5457){while(--_0x4b5457){_0x3df1e9['push'](_0x3df1e9['shift']());}};_0xd6b371(++_0x3cd30e);}(_0xc9ed,0x183));var _0xdc9e=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0xc9ed[_0x4450b1];return _0x399b0b;};'use strict';var client=require(_0xdc9e('0x0'));exports['getTriggers']=function(_0x2ba4a3){return function(_0x4482b4){return client['Request'](_0xdc9e('0x1'),{'options':{'raw':![],'attributes':['id',_0xdc9e('0x2'),'channel',_0xdc9e('0x3')],'include':[{'model':'Condition','as':_0xdc9e('0x4'),'attributes':['id','field',_0xdc9e('0x5'),'value']},{'model':_0xdc9e('0x6'),'as':'AnyConditions','attributes':['id',_0xdc9e('0x7'),_0xdc9e('0x5'),'value']},{'model':_0xdc9e('0x8'),'as':_0xdc9e('0x9'),'attributes':['id',_0xdc9e('0xa'),_0xdc9e('0xb'),_0xdc9e('0xc'),_0xdc9e('0xd'),'data4',_0xdc9e('0xe'),_0xdc9e('0xf'),_0xdc9e('0x10')]}]},'log':_0xdc9e('0x1')});};}; \ No newline at end of file +var _0xc2b6=['AllConditions','field','operator','value','AnyConditions','Action','action','data4','data5','data6','../client','Request','GetTrigger','name','status','Condition'];(function(_0x58080b,_0x161f05){var _0x3404e5=function(_0x36893b){while(--_0x36893b){_0x58080b['push'](_0x58080b['shift']());}};_0x3404e5(++_0x161f05);}(_0xc2b6,0xea));var _0x6c2b=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0xc2b6[_0x999b85];return _0x1d7124;};'use strict';var client=require(_0x6c2b('0x0'));exports['getTriggers']=function(_0x49a734){return function(_0x317692){return client[_0x6c2b('0x1')](_0x6c2b('0x2'),{'options':{'raw':![],'attributes':['id',_0x6c2b('0x3'),'channel',_0x6c2b('0x4')],'include':[{'model':_0x6c2b('0x5'),'as':_0x6c2b('0x6'),'attributes':['id',_0x6c2b('0x7'),_0x6c2b('0x8'),_0x6c2b('0x9')]},{'model':_0x6c2b('0x5'),'as':_0x6c2b('0xa'),'attributes':['id',_0x6c2b('0x7'),_0x6c2b('0x8'),_0x6c2b('0x9')]},{'model':_0x6c2b('0xb'),'as':'Actions','attributes':['id',_0x6c2b('0xc'),'data1','data2','data3',_0x6c2b('0xd'),_0x6c2b('0xe'),_0x6c2b('0xf'),'data7']}]},'log':_0x6c2b('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 1a35010..087817c 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 _0x995a=['GetTrunk','name','registry','../client','getTrunks'];(function(_0x18b403,_0x32f84){var _0x79ed0d=function(_0x3c689b){while(--_0x3c689b){_0x18b403['push'](_0x18b403['shift']());}};_0x79ed0d(++_0x32f84);}(_0x995a,0x125));var _0xa995=function(_0x371fe9,_0x5ce393){_0x371fe9=_0x371fe9-0x0;var _0xa7d7a1=_0x995a[_0x371fe9];return _0xa7d7a1;};'use strict';var client=require(_0xa995('0x0'));exports[_0xa995('0x1')]=function(_0x45b9a4){return function(_0x124cf5){return client['Request'](_0xa995('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa995('0x3'),_0xa995('0x4')]},'log':_0xa995('0x2')});};}; \ No newline at end of file +var _0xaa4b=['getTrunks','Request','GetTrunk','name','registry'];(function(_0x105978,_0x27caeb){var _0x138b69=function(_0x10305f){while(--_0x10305f){_0x105978['push'](_0x105978['shift']());}};_0x138b69(++_0x27caeb);}(_0xaa4b,0xe6));var _0xbaa4=function(_0x565fed,_0x518410){_0x565fed=_0x565fed-0x0;var _0x4633ca=_0xaa4b[_0x565fed];return _0x4633ca;};'use strict';var client=require('../client');exports[_0xbaa4('0x0')]=function(_0x414811){return function(_0x115b0e){return client[_0xbaa4('0x1')](_0xbaa4('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xbaa4('0x3'),_0xbaa4('0x4')]},'log':_0xbaa4('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 174083e..e78bdf6 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 _0xed90=['online','lastLoginAt','pauseType','lastPauseAt','voicePause','mobile','getTelephones','telephone','internal','savePause','PauseUser','UnpauseUser','ShowUser','fullname','interface','getAgent','../client','getAgents','Request','GetUser','agent','name','email','accountcode'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xed90,0x70));var _0x0ed9=function(_0x15d6b7,_0x460e4c){_0x15d6b7=_0x15d6b7-0x0;var _0x36803f=_0xed90[_0x15d6b7];return _0x36803f;};'use strict';var client=require(_0x0ed9('0x0'));exports[_0x0ed9('0x1')]=function(){return function(){return client[_0x0ed9('0x2')](_0x0ed9('0x3'),{'options':{'raw':![],'where':{'role':_0x0ed9('0x4')},'attributes':['id',_0x0ed9('0x5'),_0x0ed9('0x6'),_0x0ed9('0x7'),'fullname',_0x0ed9('0x8'),_0x0ed9('0x9'),_0x0ed9('0xa'),_0x0ed9('0xb'),_0x0ed9('0xc'),'phone',_0x0ed9('0xd'),'interface']},'log':_0x0ed9('0x1')});};};exports[_0x0ed9('0xe')]=function(){return function(){return client[_0x0ed9('0x2')](_0x0ed9('0x3'),{'options':{'raw':!![],'where':{'role':_0x0ed9('0xf')},'attributes':['id',_0x0ed9('0x5'),_0x0ed9('0x7'),_0x0ed9('0x10')]},'log':'getTelephones'});};};exports[_0x0ed9('0x11')]=function(_0x565876,_0x95f6b,_0x4942ba){return client['Request'](_0x0ed9('0x12'),{'body':{'type':_0x95f6b,'uniqueid':_0x4942ba},'options':{'where':{'id':_0x565876['id']}},'log':_0x0ed9('0x11')});};exports['saveUnpause']=function(_0x23b747){return client['Request'](_0x0ed9('0x13'),{'body':{},'options':{'where':{'id':_0x23b747['id']}},'log':'savePause'});};exports['getAgent']=function(_0x403174){return client[_0x0ed9('0x2')](_0x0ed9('0x14'),{'options':{'raw':![],'where':{'role':'agent','id':_0x403174},'attributes':['id','name',_0x0ed9('0x6'),_0x0ed9('0x7'),_0x0ed9('0x15'),'online',_0x0ed9('0x9'),'pauseType','lastPauseAt',_0x0ed9('0xc'),_0x0ed9('0x16')]},'log':_0x0ed9('0x17')});}; \ No newline at end of file +var _0x8bc0=['getTelephones','GetUser','telephone','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','../client','Request','agent','email','accountcode','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','interface','getAgents'];(function(_0x7097db,_0x4b1103){var _0x719cd8=function(_0x40f174){while(--_0x40f174){_0x7097db['push'](_0x7097db['shift']());}};_0x719cd8(++_0x4b1103);}(_0x8bc0,0x158));var _0x08bc=function(_0x2fda9f,_0x5c7478){_0x2fda9f=_0x2fda9f-0x0;var _0x5c5416=_0x8bc0[_0x2fda9f];return _0x5c5416;};'use strict';var client=require(_0x08bc('0x0'));exports['getAgents']=function(){return function(){return client[_0x08bc('0x1')]('GetUser',{'options':{'raw':![],'where':{'role':_0x08bc('0x2')},'attributes':['id','name',_0x08bc('0x3'),_0x08bc('0x4'),'fullname',_0x08bc('0x5'),_0x08bc('0x6'),_0x08bc('0x7'),_0x08bc('0x8'),_0x08bc('0x9'),_0x08bc('0xa'),'mobile',_0x08bc('0xb')]},'log':_0x08bc('0xc')});};};exports[_0x08bc('0xd')]=function(){return function(){return client[_0x08bc('0x1')](_0x08bc('0xe'),{'options':{'raw':!![],'where':{'role':_0x08bc('0xf')},'attributes':['id','name',_0x08bc('0x4'),'internal']},'log':'getTelephones'});};};exports['savePause']=function(_0x2f1e71,_0x4f5394,_0x46555a){return client[_0x08bc('0x1')]('PauseUser',{'body':{'type':_0x4f5394,'uniqueid':_0x46555a},'options':{'where':{'id':_0x2f1e71['id']}},'log':_0x08bc('0x10')});};exports[_0x08bc('0x11')]=function(_0x5eba6e){return client[_0x08bc('0x1')](_0x08bc('0x12'),{'body':{},'options':{'where':{'id':_0x5eba6e['id']}},'log':_0x08bc('0x10')});};exports[_0x08bc('0x13')]=function(_0x457870){return client[_0x08bc('0x1')](_0x08bc('0x14'),{'options':{'raw':![],'where':{'role':_0x08bc('0x2'),'id':_0x457870},'attributes':['id','name','email',_0x08bc('0x4'),'fullname',_0x08bc('0x5'),_0x08bc('0x6'),_0x08bc('0x7'),_0x08bc('0x8'),_0x08bc('0x9'),'interface']},'log':_0x08bc('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 1562523..ded5621 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 _0x3126=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x1572aa,_0x59cc0c){var _0x54818b=function(_0x4f3dd9){while(--_0x4f3dd9){_0x1572aa['push'](_0x1572aa['shift']());}};_0x54818b(++_0x59cc0c);}(_0x3126,0x9a));var _0x6312=function(_0x513f34,_0x54030f){_0x513f34=_0x513f34-0x0;var _0x2852ba=_0x3126[_0x513f34];return _0x2852ba;};'use strict';var client=require(_0x6312('0x0'));exports[_0x6312('0x1')]=function(_0x54838a){return client[_0x6312('0x2')](_0x6312('0x3'),{'body':_0x54838a,'log':'CreateVoiceAgentReport'});};exports[_0x6312('0x4')]=function(_0x40a271,_0x2b96fa,_0x337fea){return client[_0x6312('0x2')](_0x6312('0x5'),{'body':_0x40a271,'options':{'where':{'uniqueid':_0x2b96fa,'interface':_0x337fea,'agentcomplete':!![]}},'log':_0x6312('0x5')});}; \ No newline at end of file +var _0xb01f=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create'];(function(_0x29d46f,_0x100347){var _0x1815aa=function(_0x8d8fab){while(--_0x8d8fab){_0x29d46f['push'](_0x29d46f['shift']());}};_0x1815aa(++_0x100347);}(_0xb01f,0x184));var _0xfb01=function(_0x499f12,_0x5f2d5e){_0x499f12=_0x499f12-0x0;var _0x2dce04=_0xb01f[_0x499f12];return _0x2dce04;};'use strict';var client=require(_0xfb01('0x0'));exports[_0xfb01('0x1')]=function(_0x46c0d5){return client[_0xfb01('0x2')]('CreateVoiceAgentReport',{'body':_0x46c0d5,'log':_0xfb01('0x3')});};exports['update']=function(_0xe2d70e,_0x418a35,_0x49782f){return client['Request'](_0xfb01('0x4'),{'body':_0xe2d70e,'options':{'where':{'uniqueid':_0x418a35,'interface':_0x49782f,'agentcomplete':!![]}},'log':_0xfb01('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index db0e762..5df7b8c 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 _0xd01a=['type','disposition','duration','billableseconds','moment','util','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd01a,0x1e4));var _0xad01=function(_0x321aab,_0x1dacef){_0x321aab=_0x321aab-0x0;var _0x392d4e=_0xd01a[_0x321aab];return _0x392d4e;};'use strict';var moment=require(_0xad01('0x0'));var util=require(_0xad01('0x1'));var _=require('lodash');var client=require(_0xad01('0x2'));exports[_0xad01('0x3')]=function(_0x40d86e){return client[_0xad01('0x4')](_0xad01('0x5'),{'body':_[_0xad01('0x6')](_0x40d86e,{'source':_0x40d86e[_0xad01('0x7')],'destinationcontext':_0x40d86e[_0xad01('0x8')],'callerid':_0x40d86e['callerid'],'amaflags':_0xad01('0x9')}),'log':_0xad01('0x5')});};exports[_0xad01('0xa')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xad01('0xb')](_0xad01('0xc'))[_0xad01('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xad01('0xe')](_0xad01('0xc'))['format'](_0xad01('0xf'))]}},'attributes':[_0xad01('0x10'),_0xad01('0x11'),_0xad01('0x12'),_0xad01('0x13')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xd024=['billableseconds','GetVoiceCallReports','util','lodash','../client','Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration'];(function(_0xb79438,_0x4c0cc2){var _0x3f985c=function(_0x303e9a){while(--_0x303e9a){_0xb79438['push'](_0xb79438['shift']());}};_0x3f985c(++_0x4c0cc2);}(_0xd024,0xf9));var _0x4d02=function(_0x2de008,_0x2e133d){_0x2de008=_0x2de008-0x0;var _0x264dfc=_0xd024[_0x2de008];return _0x264dfc;};'use strict';var moment=require('moment');var util=require(_0x4d02('0x0'));var _=require(_0x4d02('0x1'));var client=require(_0x4d02('0x2'));exports['create']=function(_0x478c7d){return client[_0x4d02('0x3')](_0x4d02('0x4'),{'body':_['merge'](_0x478c7d,{'source':_0x478c7d[_0x4d02('0x5')],'destinationcontext':_0x478c7d[_0x4d02('0x6')],'callerid':_0x478c7d[_0x4d02('0x7')],'amaflags':_0x4d02('0x8')}),'log':_0x4d02('0x4')});};exports[_0x4d02('0x9')]=function(){return function(){return client[_0x4d02('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x4d02('0xa')](_0x4d02('0xb'))[_0x4d02('0xc')](_0x4d02('0xd')),moment()['endOf'](_0x4d02('0xb'))[_0x4d02('0xc')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x4d02('0xe'),_0x4d02('0xf'),_0x4d02('0x10'),_0x4d02('0x11')]},'log':_0x4d02('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a62ee58..9354587 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 _0xd5fc=['create','CreateVoiceDialReport','../client'];(function(_0x1e1d5d,_0x213f5b){var _0x1830ac=function(_0x55efb0){while(--_0x55efb0){_0x1e1d5d['push'](_0x1e1d5d['shift']());}};_0x1830ac(++_0x213f5b);}(_0xd5fc,0x11f));var _0xcd5f=function(_0x276ee8,_0xe6986d){_0x276ee8=_0x276ee8-0x0;var _0x222aa0=_0xd5fc[_0x276ee8];return _0x222aa0;};'use strict';var client=require(_0xcd5f('0x0'));exports[_0xcd5f('0x1')]=function(_0x4937ad){return client['Request'](_0xcd5f('0x2'),{'body':_0x4937ad,'log':_0xcd5f('0x2')});}; \ No newline at end of file +var _0xc480=['CreateVoiceDialReport','../client'];(function(_0x337e1b,_0x34e77f){var _0x1de6fb=function(_0x70eda3){while(--_0x70eda3){_0x337e1b['push'](_0x337e1b['shift']());}};_0x1de6fb(++_0x34e77f);}(_0xc480,0xf1));var _0x0c48=function(_0x281a20,_0x11fe1e){_0x281a20=_0x281a20-0x0;var _0x57255d=_0xc480[_0x281a20];return _0x57255d;};'use strict';var client=require(_0x0c48('0x0'));exports['create']=function(_0x6155b5){return client['Request'](_0x0c48('0x1'),{'body':_0x6155b5,'log':_0x0c48('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 188bfe5..6f0c0e9 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 _0x081e=['recordingFormat','../client','getVoiceExtensions','GetVoiceExtension'];(function(_0x22a81f,_0x30f102){var _0x3d2788=function(_0x5185af){while(--_0x5185af){_0x22a81f['push'](_0x22a81f['shift']());}};_0x3d2788(++_0x30f102);}(_0x081e,0xc5));var _0xe081=function(_0x31295c,_0x2f2b82){_0x31295c=_0x31295c-0x0;var _0x2c150e=_0x081e[_0x31295c];return _0x2c150e;};'use strict';var client=require(_0xe081('0x0'));exports[_0xe081('0x1')]=function(){return function(){return client['Request'](_0xe081('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0xe081('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xe081('0x1')});};}; \ No newline at end of file +var _0x98b7=['GetVoiceExtension','../client','getVoiceExtensions','Request'];(function(_0x2ac5f8,_0x4c3a9f){var _0x3b8229=function(_0x46a3c0){while(--_0x46a3c0){_0x2ac5f8['push'](_0x2ac5f8['shift']());}};_0x3b8229(++_0x4c3a9f);}(_0x98b7,0xc1));var _0x798b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x98b7[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0x798b('0x0'));exports[_0x798b('0x1')]=function(){return function(){return client[_0x798b('0x2')](_0x798b('0x3'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 0ec7330..69fce3b 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 _0x8ad7=['dialMachineMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDGreeting','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','timeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x571363,_0x522282){var _0x3b5196=function(_0x1099bf){while(--_0x1099bf){_0x571363['push'](_0x571363['shift']());}};_0x3b5196(++_0x522282);}(_0x8ad7,0xb3));var _0x78ad=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x8ad7[_0x2112d4];return _0x434972;};'use strict';var client=require(_0x78ad('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x78ad('0x1')](_0x78ad('0x2'),{'options':{'raw':![],'attributes':['id',_0x78ad('0x3'),_0x78ad('0x4'),_0x78ad('0x5'),_0x78ad('0x6'),_0x78ad('0x7'),'type',_0x78ad('0x8'),'dialMethod',_0x78ad('0x9'),'dialLimitQueue',_0x78ad('0xa'),_0x78ad('0xb'),_0x78ad('0xc'),'dialPredictiveInterval','dialOriginateCallerIdName',_0x78ad('0xd'),_0x78ad('0xe'),'dialQueueOptions','dialQueueTimeout',_0x78ad('0xf'),_0x78ad('0x10'),_0x78ad('0x11'),_0x78ad('0x12'),_0x78ad('0x13'),_0x78ad('0x14'),_0x78ad('0x15'),_0x78ad('0x16'),_0x78ad('0x17'),_0x78ad('0x18'),_0x78ad('0x19'),'dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence',_0x78ad('0x1a'),'dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime',_0x78ad('0x1b'),_0x78ad('0x1c'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x78ad('0x1d'),_0x78ad('0x1e'),'dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt',_0x78ad('0x1f'),_0x78ad('0x20'),_0x78ad('0x21'),_0x78ad('0x7'),_0x78ad('0x22'),_0x78ad('0x23'),'dialCutDigit',_0x78ad('0x24'),'dialNoSuchNumberRetryFrequency',_0x78ad('0x25'),_0x78ad('0x26'),_0x78ad('0x27'),_0x78ad('0x28'),_0x78ad('0x29'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x78ad('0x2a'),'mandatoryDisposition',_0x78ad('0x2b'),_0x78ad('0x2c')],'include':[{'model':'Trunk','as':_0x78ad('0x2d'),'attributes':['id',_0x78ad('0x3'),_0x78ad('0x2e'),_0x78ad('0x2f')]},{'model':_0x78ad('0x30'),'as':_0x78ad('0x31'),'attributes':['id',_0x78ad('0x3')]},{'model':'Trunk','as':_0x78ad('0x32'),'attributes':['id',_0x78ad('0x3'),_0x78ad('0x2e'),'active']},{'model':_0x78ad('0x33'),'as':_0x78ad('0x33'),'attributes':['id','name'],'include':[{'model':_0x78ad('0x33'),'as':_0x78ad('0x34'),'attributes':['id','name',_0x78ad('0x35')]}]}]},'log':_0x78ad('0x36')});};}; \ No newline at end of file +var _0x6b25=['dialGlobalInterval','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','getVoiceQueues','Request','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone'];(function(_0x7b484,_0x195ad4){var _0x2ae1cf=function(_0x2e6247){while(--_0x2e6247){_0x7b484['push'](_0x7b484['shift']());}};_0x2ae1cf(++_0x195ad4);}(_0x6b25,0x112));var _0x56b2=function(_0x5e7a5c,_0x28a4e8){_0x5e7a5c=_0x5e7a5c-0x0;var _0x1a5760=_0x6b25[_0x5e7a5c];return _0x1a5760;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client[_0x56b2('0x0')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0x56b2('0x1'),_0x56b2('0x2'),_0x56b2('0x3'),_0x56b2('0x4'),_0x56b2('0x5'),_0x56b2('0x6'),_0x56b2('0x7'),'dialLimitChannel','dialLimitQueue',_0x56b2('0x8'),_0x56b2('0x9'),_0x56b2('0xa'),_0x56b2('0xb'),_0x56b2('0xc'),'dialOriginateCallerIdNumber',_0x56b2('0xd'),'dialQueueOptions',_0x56b2('0xe'),_0x56b2('0xf'),_0x56b2('0x10'),'dialCongestionRetryFrequency',_0x56b2('0x11'),_0x56b2('0x12'),_0x56b2('0x13'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x56b2('0x14'),_0x56b2('0x15'),'dialPrefix',_0x56b2('0x16'),'dialAMDActive',_0x56b2('0x17'),_0x56b2('0x18'),_0x56b2('0x19'),_0x56b2('0x1a'),_0x56b2('0x1b'),_0x56b2('0x1c'),_0x56b2('0x1d'),_0x56b2('0x1e'),_0x56b2('0x1f'),'timeout','dialRecallMeTimeout',_0x56b2('0x20'),_0x56b2('0x21'),_0x56b2('0x22'),_0x56b2('0x23'),_0x56b2('0x24'),_0x56b2('0x4'),_0x56b2('0x25'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0x56b2('0x26'),'dialNoSuchNumberRetryFrequency',_0x56b2('0x27'),_0x56b2('0x28'),_0x56b2('0x29'),_0x56b2('0x2a'),_0x56b2('0x2b'),_0x56b2('0x2c'),_0x56b2('0x2d'),_0x56b2('0x2e'),'mandatoryDisposition',_0x56b2('0x2f'),_0x56b2('0x30')],'include':[{'model':_0x56b2('0x31'),'as':_0x56b2('0x31'),'attributes':['id',_0x56b2('0x32'),_0x56b2('0x33'),_0x56b2('0x34')]},{'model':_0x56b2('0x35'),'as':_0x56b2('0x36'),'attributes':['id',_0x56b2('0x32')]},{'model':'Trunk','as':_0x56b2('0x37'),'attributes':['id',_0x56b2('0x32'),'callerid',_0x56b2('0x34')]},{'model':_0x56b2('0x38'),'as':'Interval','attributes':['id','name'],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x56b2('0x32'),_0x56b2('0x39')]}]}]},'log':_0x56b2('0x3a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index b336747..b736e3f 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 _0xa03d=['queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','day','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queuecallerleaveAt','queuecallercomplete'];(function(_0x552b88,_0x217051){var _0x49d7d4=function(_0x1163fa){while(--_0x1163fa){_0x552b88['push'](_0x552b88['shift']());}};_0x49d7d4(++_0x217051);}(_0xa03d,0x15b));var _0xda03=function(_0x479650,_0x44fb98){_0x479650=_0x479650-0x0;var _0x1dc9d6=_0xa03d[_0x479650];return _0x1dc9d6;};'use strict';var moment=require(_0xda03('0x0'));var _=require(_0xda03('0x1'));var client=require('../client');exports[_0xda03('0x2')]=function(_0x54ff07){return client[_0xda03('0x3')]('CreateVoiceQueueReport',{'body':_0x54ff07,'log':_0xda03('0x4')});};exports[_0xda03('0x5')]=function(){return function(){return client['Request'](_0xda03('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xda03('0x7'))[_0xda03('0x8')](_0xda03('0x9')),moment()['endOf'](_0xda03('0x7'))[_0xda03('0x8')](_0xda03('0x9'))]}},'attributes':[_0xda03('0xa'),'queue','queuecallerjoinAt',_0xda03('0xb'),_0xda03('0xc'),_0xda03('0xd'),_0xda03('0xe'),_0xda03('0xf'),'queuecallerabandon',_0xda03('0x10')]},'log':_0xda03('0x11')});};}; \ No newline at end of file +var _0x6525=['getVoiceQueueReports','Request','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','CreateVoiceQueueReport'];(function(_0x13c5a9,_0x95fb6a){var _0x393ee6=function(_0x136d23){while(--_0x136d23){_0x13c5a9['push'](_0x13c5a9['shift']());}};_0x393ee6(++_0x95fb6a);}(_0x6525,0x1ac));var _0x5652=function(_0x485201,_0x3c533a){_0x485201=_0x485201-0x0;var _0x9ca98a=_0x6525[_0x485201];return _0x9ca98a;};'use strict';var moment=require(_0x5652('0x0'));var _=require(_0x5652('0x1'));var client=require(_0x5652('0x2'));exports['create']=function(_0x564bed){return client['Request'](_0x5652('0x3'),{'body':_0x564bed,'log':_0x5652('0x3')});};exports[_0x5652('0x4')]=function(){return function(){return client[_0x5652('0x5')](_0x5652('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x5652('0x7')](_0x5652('0x8'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf']('day')[_0x5652('0x9')](_0x5652('0xa'))]}},'attributes':[_0x5652('0xb'),'queue',_0x5652('0xc'),_0x5652('0xd'),_0x5652('0xe'),_0x5652('0xf'),'queuecallerexit','queuecallerexitAt','queuecallerabandon',_0x5652('0x10')]},'log':_0x5652('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index dbac726..683a440 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 _0xac00=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0x12a7a3,_0x3a2bbb){var _0x335ac1=function(_0x422377){while(--_0x422377){_0x12a7a3['push'](_0x12a7a3['shift']());}};_0x335ac1(++_0x3a2bbb);}(_0xac00,0x65));var _0x0ac0=function(_0x8261bb,_0x48e718){_0x8261bb=_0x8261bb-0x0;var _0x530867=_0xac00[_0x8261bb];return _0x530867;};'use strict';var client=require(_0x0ac0('0x0'));exports['getVoiceQueueRtPauses']=function(_0x378f1e){return function(){return client['Request'](_0x0ac0('0x1'),{'options':{'where':{'VoiceQueueId':_0x378f1e,'paused':!![]},'raw':!![]},'log':_0x0ac0('0x2')});};}; \ No newline at end of file +var _0xf6ab=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x18dfde,_0xda0822){var _0x1702e2=function(_0xdcda0d){while(--_0xdcda0d){_0x18dfde['push'](_0x18dfde['shift']());}};_0x1702e2(++_0xda0822);}(_0xf6ab,0x1d6));var _0xbf6a=function(_0x1f2fa6,_0xbbd441){_0x1f2fa6=_0x1f2fa6-0x0;var _0x309dfa=_0xf6ab[_0x1f2fa6];return _0x309dfa;};'use strict';var client=require(_0xbf6a('0x0'));exports[_0xbf6a('0x1')]=function(_0x402593){return function(){return client[_0xbf6a('0x2')](_0xbf6a('0x3'),{'options':{'where':{'VoiceQueueId':_0x402593,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index fbf2d31..6c2bc3d 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 _0xf6ab=['create','Request','CreateVoiceRecording','merge','lodash','../client'];(function(_0x3a153e,_0xb6f72b){var _0x551fe5=function(_0x434292){while(--_0x434292){_0x3a153e['push'](_0x3a153e['shift']());}};_0x551fe5(++_0xb6f72b);}(_0xf6ab,0xfa));var _0xbf6a=function(_0x1d9f05,_0x1cc1c4){_0x1d9f05=_0x1d9f05-0x0;var _0x255f98=_0xf6ab[_0x1d9f05];return _0x255f98;};'use strict';var _=require(_0xbf6a('0x0'));var client=require(_0xbf6a('0x1'));exports[_0xbf6a('0x2')]=function(_0x432726){return client[_0xbf6a('0x3')](_0xbf6a('0x4'),{'body':_[_0xbf6a('0x5')](_0x432726,{'value':_0x432726['monitorFilename']}),'log':_0xbf6a('0x4')});}; \ No newline at end of file +var _0x6bf9=['create','Request','CreateVoiceRecording','merge','monitorFilename','lodash','../client'];(function(_0x5dee38,_0x3af489){var _0x12689a=function(_0x5f08c5){while(--_0x5f08c5){_0x5dee38['push'](_0x5dee38['shift']());}};_0x12689a(++_0x3af489);}(_0x6bf9,0x19b));var _0x96bf=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0x6bf9[_0xc40b9f];return _0x535b9c;};'use strict';var _=require(_0x96bf('0x0'));var client=require(_0x96bf('0x1'));exports[_0x96bf('0x2')]=function(_0x1ba7a9){return client[_0x96bf('0x3')](_0x96bf('0x4'),{'body':_[_0x96bf('0x5')](_0x1ba7a9,{'value':_0x1ba7a9[_0x96bf('0x6')]}),'log':_0x96bf('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index bf45aa0..39b19ad 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 _0x3b60=['../client','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransfererexten','attended'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x3b60,0xd7));var _0x03b6=function(_0x5c6417,_0x553499){_0x5c6417=_0x5c6417-0x0;var _0x2a5f1a=_0x3b60[_0x5c6417];return _0x2a5f1a;};'use strict';var client=require(_0x03b6('0x0'));exports[_0x03b6('0x1')]=function(_0xcc5668){return client[_0x03b6('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0xcc5668[_0x03b6('0x3')],'transfererchannel':_0xcc5668[_0x03b6('0x4')],'transferercalleridnum':_0xcc5668[_0x03b6('0x5')],'transferercalleridname':_0xcc5668[_0x03b6('0x6')],'transfererconnectedlinenum':_0xcc5668['transfererconnectedlinenum'],'transfererconnectedlinename':_0xcc5668[_0x03b6('0x7')],'transfereraccountcode':_0xcc5668[_0x03b6('0x8')],'transferercontext':_0xcc5668[_0x03b6('0x9')],'transfererexten':_0xcc5668[_0x03b6('0xa')],'transfererlinkedid':_0xcc5668[_0x03b6('0xb')],'transfereechannel':_0xcc5668[_0x03b6('0xc')],'transfereecalleridnum':_0xcc5668[_0x03b6('0xd')],'transfereecalleridname':_0xcc5668[_0x03b6('0xe')],'transfereeconnectedlinenum':_0xcc5668[_0x03b6('0xf')],'transfereeconnectedlinename':_0xcc5668[_0x03b6('0x10')],'transfereeaccountcode':_0xcc5668[_0x03b6('0x11')],'transfereecontext':_0xcc5668[_0x03b6('0x12')],'transfereeexten':_0xcc5668[_0x03b6('0x13')],'transfereelinkedid':_0xcc5668[_0x03b6('0x14')],'isexternal':_0xcc5668[_0x03b6('0x15')],'context':_0xcc5668[_0x03b6('0x16')],'extension':_0xcc5668[_0x03b6('0x17')],'type':_0x03b6('0x18')},'log':_0x03b6('0x19')});};exports[_0x03b6('0x1a')]=function(_0x4317be){return client[_0x03b6('0x2')](_0x03b6('0x19'),{'body':{'result':_0x4317be[_0x03b6('0x3')],'transfererchannel':_0x4317be[_0x03b6('0x1b')],'transferercalleridnum':_0x4317be[_0x03b6('0x1c')],'transferercalleridname':_0x4317be[_0x03b6('0x1d')],'transfererconnectedlinenum':_0x4317be[_0x03b6('0x1e')],'transfererconnectedlinename':_0x4317be[_0x03b6('0x1f')],'transfereraccountcode':_0x4317be[_0x03b6('0x20')],'transferercontext':_0x4317be[_0x03b6('0x21')],'transfererexten':_0x4317be['secondtransfererexten'],'transfererlinkedid':_0x4317be['origtransfererlinkedid'],'transfereechannel':_0x4317be['transfertargetchannel'],'transfereecalleridnum':_0x4317be[_0x03b6('0x22')],'transfereecalleridname':_0x4317be[_0x03b6('0x23')],'transfereeconnectedlinenum':_0x4317be[_0x03b6('0x24')],'transfereeconnectedlinename':_0x4317be[_0x03b6('0x25')],'transfereeaccountcode':_0x4317be[_0x03b6('0x26')],'transfereecontext':_0x4317be[_0x03b6('0x27')],'transfereeexten':_0x4317be['transfertargetexten'],'transfereelinkedid':_0x4317be[_0x03b6('0x28')],'isexternal':_0x4317be[_0x03b6('0x15')],'context':_0x4317be['origtransferercontext'],'extension':_0x4317be[_0x03b6('0x29')],'type':_0x03b6('0x2a')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x0374=['transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','../client','blindTransfer','Request','result','transferercalleridnum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid'];(function(_0x3d738b,_0x2225de){var _0x3e4f57=function(_0xa1b1c8){while(--_0xa1b1c8){_0x3d738b['push'](_0x3d738b['shift']());}};_0x3e4f57(++_0x2225de);}(_0x0374,0x8a));var _0x4037=function(_0x48f117,_0x2e4e24){_0x48f117=_0x48f117-0x0;var _0x554f8f=_0x0374[_0x48f117];return _0x554f8f;};'use strict';var client=require(_0x4037('0x0'));exports[_0x4037('0x1')]=function(_0x3e1f3b){return client[_0x4037('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x3e1f3b[_0x4037('0x3')],'transfererchannel':_0x3e1f3b['transfererchannel'],'transferercalleridnum':_0x3e1f3b[_0x4037('0x4')],'transferercalleridname':_0x3e1f3b['transferercalleridname'],'transfererconnectedlinenum':_0x3e1f3b['transfererconnectedlinenum'],'transfererconnectedlinename':_0x3e1f3b[_0x4037('0x5')],'transfereraccountcode':_0x3e1f3b[_0x4037('0x6')],'transferercontext':_0x3e1f3b[_0x4037('0x7')],'transfererexten':_0x3e1f3b[_0x4037('0x8')],'transfererlinkedid':_0x3e1f3b[_0x4037('0x9')],'transfereechannel':_0x3e1f3b[_0x4037('0xa')],'transfereecalleridnum':_0x3e1f3b[_0x4037('0xb')],'transfereecalleridname':_0x3e1f3b['transfereecalleridname'],'transfereeconnectedlinenum':_0x3e1f3b[_0x4037('0xc')],'transfereeconnectedlinename':_0x3e1f3b[_0x4037('0xd')],'transfereeaccountcode':_0x3e1f3b[_0x4037('0xe')],'transfereecontext':_0x3e1f3b[_0x4037('0xf')],'transfereeexten':_0x3e1f3b[_0x4037('0x10')],'transfereelinkedid':_0x3e1f3b[_0x4037('0x11')],'isexternal':_0x3e1f3b[_0x4037('0x12')],'context':_0x3e1f3b[_0x4037('0x13')],'extension':_0x3e1f3b['extension'],'type':_0x4037('0x14')},'log':_0x4037('0x15')});};exports[_0x4037('0x16')]=function(_0x38e989){return client['Request'](_0x4037('0x15'),{'body':{'result':_0x38e989[_0x4037('0x3')],'transfererchannel':_0x38e989[_0x4037('0x17')],'transferercalleridnum':_0x38e989[_0x4037('0x18')],'transferercalleridname':_0x38e989[_0x4037('0x19')],'transfererconnectedlinenum':_0x38e989['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x38e989['secondtransfererconnectedlinename'],'transfereraccountcode':_0x38e989['origtransfereraccountcode'],'transferercontext':_0x38e989[_0x4037('0x1a')],'transfererexten':_0x38e989[_0x4037('0x1b')],'transfererlinkedid':_0x38e989[_0x4037('0x1c')],'transfereechannel':_0x38e989['transfertargetchannel'],'transfereecalleridnum':_0x38e989[_0x4037('0x1d')],'transfereecalleridname':_0x38e989[_0x4037('0x1e')],'transfereeconnectedlinenum':_0x38e989[_0x4037('0x1f')],'transfereeconnectedlinename':_0x38e989['transfertargetconnectedlinename'],'transfereeaccountcode':_0x38e989[_0x4037('0x20')],'transfereecontext':_0x38e989[_0x4037('0x21')],'transfereeexten':_0x38e989[_0x4037('0x22')],'transfereelinkedid':_0x38e989['transfertargetlinkedid'],'isexternal':_0x38e989[_0x4037('0x12')],'context':_0x38e989[_0x4037('0x23')],'extension':_0x38e989[_0x4037('0x24')],'type':'attended'},'log':_0x4037('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 30bcbef..324ea68 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 _0xecc9=['message','catch','command','Command','then','content','voiceQueues','hasOwnProperty','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','values','channels','map','find','uniqueid','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','channel','destinationchannel','stop','status','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','run','emit','event','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','../../../config/environment','../properties','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xecc9,0x173));var _0x9ecc=function(_0x56daff,_0xadca9a){_0x56daff=_0x56daff-0x0;var _0x132c82=_0xecc9[_0x56daff];return _0x132c82;};'use strict';var _=require(_0x9ecc('0x0'));var util=require(_0x9ecc('0x1'));var jayson=require(_0x9ecc('0x2'));var schema=require(_0x9ecc('0x3'));var BPromise=require(_0x9ecc('0x4'));var moment=require('moment');var config=require(_0x9ecc('0x5'));var properties=require(_0x9ecc('0x6'));var ami=require('../ami');exports[_0x9ecc('0x7')]=function(_0x3a6df1,_0x54c0f8,_0x496dfe){return new BPromise(function(_0x29d0c5,_0x558c23){var _0x51b489={'QueuePause':function(_0x3d296b){return new Promise(function(_0x52be69,_0x1dfd08){var _0x259014=util[_0x9ecc('0x8')](_0x9ecc('0x9'),_0x9ecc('0xa'),_0x3d296b[_0x9ecc('0xb')]);if(_0x3a6df1[_0x9ecc('0xc')]&&_0x3a6df1[_0x9ecc('0xc')][_0x259014]&&_0x3a6df1[_0x9ecc('0xc')][_0x259014]['timer']){_0x3a6df1[_0x9ecc('0xc')][_0x259014][_0x9ecc('0xd')]();}if(_0x3a6df1[_0x9ecc('0xe')][_0x259014]){_0x3a6df1[_0x9ecc('0xe')][_0x259014][_0x9ecc('0xf')]({'statePause':_0x3d296b['pause']?!![]:![]});}_0x52be69({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x585f81){var _0x156ba4=this;return new Promise(function(_0x5e88db,_0x36c513){if(ami[_0x9ecc('0x10')]()==![]){return _0x36c513(_0x156ba4[_0x9ecc('0x11')](0x1f4,[config[_0x9ecc('0x12')]['ip'],config[_0x9ecc('0x12')][_0x9ecc('0x13')],_0x9ecc('0x14')][_0x9ecc('0x15')]('\x20')));}_0x585f81=_[_0x9ecc('0x16')](_0x585f81,_[_0x9ecc('0x17')](properties[_0x9ecc('0x18')]));_0x585f81[_0x9ecc('0x19')]=_0x9ecc('0x1a');return ami[_0x9ecc('0x1b')](_0x585f81)['then'](function(_0x2d6f2d){_0x5e88db({'code':0xc8,'message':_0x2d6f2d[_0x9ecc('0x1c')]});})[_0x9ecc('0x1d')](function(_0x56cf36){_0x36c513(_0x156ba4['error'](0x1f5,_0x56cf36[_0x9ecc('0x1c')]));});});},'Command':function(_0x54d0be){var _0xf2738f=this;return new Promise(function(_0xaf76c4,_0x521606){if(ami['isConnected']()==![]){return _0x521606(_0xf2738f['error'](0x1f4,[config[_0x9ecc('0x12')]['ip'],config[_0x9ecc('0x12')][_0x9ecc('0x13')],_0x9ecc('0x14')]['join']('\x20')));}_0x54d0be=_[_0x9ecc('0x16')](_0x54d0be,_0x9ecc('0x1e'));_0x54d0be[_0x9ecc('0x19')]=_0x9ecc('0x1f');return ami['Action'](_0x54d0be)[_0x9ecc('0x20')](function(_0x4db464){_0xaf76c4({'code':0xc8,'message':_0x4db464[_0x9ecc('0x21')]});})[_0x9ecc('0x1d')](function(_0x4c8716){_0x521606(_0xf2738f[_0x9ecc('0x11')](0x1f5,_0x4c8716[_0x9ecc('0x1c')]));});});},'VoiceQueues':function(_0x45086b){return new Promise(function(_0x122acc,_0x4c2b7f){var _0x236e5d=[];for(var _0x18b7c8 in _0x3a6df1['voiceQueues']){if(_0x3a6df1[_0x9ecc('0x22')][_0x9ecc('0x23')](_0x18b7c8)){var _0x2a7102=_0x3a6df1[_0x9ecc('0x22')][_0x18b7c8];var _0x8082a3={'id':_0x2a7102['id'],'name':_0x2a7102[_0x9ecc('0xb')],'strategy':_0x2a7102[_0x9ecc('0x24')],'answered':_0x2a7102['answered'],'available':_0x2a7102[_0x9ecc('0x25')],'loggedIn':_0x2a7102[_0x9ecc('0x26')],'pTalking':_0x2a7102[_0x9ecc('0x27')],'sumBillable':_0x2a7102[_0x9ecc('0x28')],'sumDuration':_0x2a7102[_0x9ecc('0x29')],'sumHoldTime':_0x2a7102[_0x9ecc('0x2a')]||0x0,'talking':_0x2a7102['talking'],'total':_0x2a7102[_0x9ecc('0x2b')],'type':_0x2a7102[_0x9ecc('0x2c')],'unmanaged':_0x2a7102[_0x9ecc('0x2d')],'abandoned':_0x2a7102[_0x9ecc('0x2e')],'waiting':_0x2a7102[_0x9ecc('0x2f')],'loggedInDb':_0x2a7102[_0x9ecc('0x30')]};if(_0x2a7102[_0x9ecc('0x2c')]===_0x9ecc('0x31')){_0x8082a3[_0x9ecc('0x32')]=_0x2a7102['dialActive'];_0x8082a3[_0x9ecc('0x33')]=_0x2a7102[_0x9ecc('0x33')];_0x8082a3['dialOriginateCallerIdName']=_0x2a7102['dialOriginateCallerIdName'];_0x8082a3[_0x9ecc('0x34')]=_0x2a7102['dialOriginateCallerIdNumber'];_0x8082a3['dialOriginateTimeout']=_0x2a7102[_0x9ecc('0x35')];_0x8082a3[_0x9ecc('0x36')]=_0x2a7102[_0x9ecc('0x36')];_0x8082a3[_0x9ecc('0x37')]=_0x2a7102[_0x9ecc('0x37')];_0x8082a3[_0x9ecc('0x38')]=_0x2a7102[_0x9ecc('0x38')];_0x8082a3[_0x9ecc('0x39')]=_0x2a7102[_0x9ecc('0x39')];_0x8082a3[_0x9ecc('0x3a')]=_0x2a7102['outboundBusyCallsDay'];_0x8082a3['outboundCongestionCallsDay']=_0x2a7102['outboundCongestionCallsDay'];_0x8082a3[_0x9ecc('0x3b')]=_0x2a7102[_0x9ecc('0x3b')];_0x8082a3[_0x9ecc('0x3c')]=_0x2a7102[_0x9ecc('0x3c')];_0x8082a3[_0x9ecc('0x3d')]=_0x2a7102[_0x9ecc('0x3d')];_0x8082a3['outboundNoAnswerCallsDay']=_0x2a7102[_0x9ecc('0x3e')];_0x8082a3[_0x9ecc('0x3f')]=_0x2a7102[_0x9ecc('0x3f')];_0x8082a3['outboundOriginateFailureCallsDay']=_0x2a7102[_0x9ecc('0x40')];_0x8082a3[_0x9ecc('0x41')]=_0x2a7102[_0x9ecc('0x41')];_0x8082a3['outboundRejectCallsDay']=_0x2a7102[_0x9ecc('0x42')];_0x8082a3[_0x9ecc('0x43')]=_0x2a7102[_0x9ecc('0x43')];_0x8082a3[_0x9ecc('0x44')]=_0x2a7102[_0x9ecc('0x44')];_0x8082a3[_0x9ecc('0x45')]=_0x2a7102[_0x9ecc('0x45')];_0x8082a3[_0x9ecc('0x46')]=_0x2a7102['predictiveIntervalAvgTalktime'];_0x8082a3[_0x9ecc('0x47')]=_0x2a7102[_0x9ecc('0x47')];_0x8082a3[_0x9ecc('0x48')]=_0x2a7102[_0x9ecc('0x48')];_0x8082a3['predictiveIntervalErlangCalls']=_0x2a7102[_0x9ecc('0x49')];_0x8082a3[_0x9ecc('0x4a')]=_0x2a7102['predictiveIntervalErlangCallsDroppedCalls'];_0x8082a3[_0x9ecc('0x4b')]=_0x2a7102[_0x9ecc('0x4b')];_0x8082a3[_0x9ecc('0x4c')]=_0x2a7102['predictiveIntervalMultiplicativeFactor'];_0x8082a3['predictiveIntervalPauses']=_0x2a7102['predictiveIntervalPauses'];_0x8082a3['predictiveIntervalAvailable']=_0x2a7102[_0x9ecc('0x4d')];_0x8082a3['predictiveIntervalTotalCalls']=_0x2a7102[_0x9ecc('0x4e')];_0x8082a3[_0x9ecc('0x1c')]=_0x2a7102[_0x9ecc('0x1c')];_0x8082a3[_0x9ecc('0x4f')]=_0x2a7102[_0x9ecc('0x4f')];_0x8082a3['erlangCalls']=_0x2a7102[_0x9ecc('0x50')];_0x8082a3['erlangCallToSecond']=_0x2a7102['erlangCallToSecond'];_0x8082a3[_0x9ecc('0x51')]=_0x2a7102['erlangAbandonmentRate'];_0x8082a3[_0x9ecc('0x52')]=_0x2a7102[_0x9ecc('0x52')];_0x8082a3[_0x9ecc('0x53')]=_0x2a7102[_0x9ecc('0x53')];_0x8082a3[_0x9ecc('0x54')]=_0x2a7102[_0x9ecc('0x54')];}if(_0x2a7102[_0x9ecc('0x55')]){_0x8082a3[_0x9ecc('0x55')]={'id':_0x2a7102[_0x9ecc('0x55')]['id'],'name':_0x2a7102[_0x9ecc('0x55')][_0x9ecc('0xb')],'active':_0x2a7102[_0x9ecc('0x55')]['active'],'callerid':_0x2a7102['Trunk'][_0x9ecc('0x56')]};}if(_0x2a7102[_0x9ecc('0x57')]){_0x8082a3[_0x9ecc('0x57')]={'id':_0x2a7102['Interval']['id'],'name':_0x2a7102['Interval'][_0x9ecc('0xb')]};}_0x236e5d[_0x9ecc('0x58')](_0x8082a3);}}_0x122acc({'count':_0x236e5d[_0x9ecc('0x59')],'rows':_0x236e5d});});},'VoiceChannels':function(_0x4768da){return new Promise(function(_0x28bfe8,_0x58b1b7){var _0x41877a=_[_0x9ecc('0x5a')](_0x3a6df1[_0x9ecc('0x5b')]);_0x28bfe8({'count':_0x41877a['length'],'rows':_0x41877a});});},'VoiceChannelMixMonitor':function(_0x4265b2){var _0x96cdeb=this;return new Promise(function(_0xcccea3,_0x56e31c){if(ami[_0x9ecc('0x10')]()==![]){return _0x56e31c(_0x96cdeb[_0x9ecc('0x11')](0x1f4,[config[_0x9ecc('0x12')]['ip'],config[_0x9ecc('0x12')][_0x9ecc('0x13')],_0x9ecc('0x14')][_0x9ecc('0x15')]('\x20')));}var _0x2f4bbf=schema(properties['voicechannel'])['validate'](_0x4265b2);if(_0x2f4bbf[_0x9ecc('0x59')]>0x0){return _0x56e31c(_0x96cdeb[_0x9ecc('0x11')](0x1f4,_[_0x9ecc('0x5c')](_0x2f4bbf,'message')[_0x9ecc('0x15')](',\x20')));}var _0xd6822c=_[_0x9ecc('0x5d')](_0x3a6df1['channels'],{'uniqueid':_0x4265b2[_0x9ecc('0x5e')]});if(_0xd6822c&&_0xd6822c['channel']){var _0x2b3aea=util[_0x9ecc('0x8')](_0x9ecc('0x5f'),_0x4265b2[_0x9ecc('0x60')]||_0x4265b2['uniqueid'],_0x4265b2[_0x9ecc('0x8')]||_0x9ecc('0x61'));return ami[_0x9ecc('0x1b')]({'action':_0x9ecc('0x62'),'channel':_0xd6822c['channel'],'file':_0x2b3aea,'options':_0x9ecc('0x63')})['then'](function(_0x433b1e){var _0xdc8558=_['find'](_0xd6822c[_0x9ecc('0x64')],{'filename':_0x9ecc('0x65')+_0x2b3aea[_0x9ecc('0x66')]()});if(_[_0x9ecc('0x67')](_0xdc8558)){_0xd6822c['monitors']['push']({'filename':_0x9ecc('0x65')+_0x2b3aea[_0x9ecc('0x66')](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x433b1e[_0x9ecc('0x68')],'status':_0x9ecc('0x69')});}else{_0xdc8558['mixmonitorid']=_0x433b1e['mixmonitorid'];_0xdc8558['status']=_0x9ecc('0x69');}_0xcccea3({'code':0xc8,'message':[_0x4265b2[_0x9ecc('0x5e')],_0x9ecc('0x6a'),_0x433b1e[_0x9ecc('0x68')]][_0x9ecc('0x15')]('\x20'),'mixmonitorid':_0x433b1e[_0x9ecc('0x68')]});})[_0x9ecc('0x1d')](function(_0x1ea6cf){_0x56e31c(_0x96cdeb[_0x9ecc('0x11')](0x1f5,[_0x4265b2[_0x9ecc('0x5e')],_0x1ea6cf[_0x9ecc('0x1c')]['toLowerCase']()][_0x9ecc('0x15')]('\x20')));});}else{return _0x56e31c(_0x96cdeb[_0x9ecc('0x11')](0x1f5,_0x9ecc('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x59990c){var _0x1588f8=this;return new Promise(function(_0x44c7a5,_0x4568d4){if(ami[_0x9ecc('0x10')]()==![]){return _0x4568d4(_0x1588f8[_0x9ecc('0x11')](0x1f4,[config[_0x9ecc('0x12')]['ip'],config[_0x9ecc('0x12')][_0x9ecc('0x13')],_0x9ecc('0x14')]['join']('\x20')));}var _0x30d719=schema(properties[_0x9ecc('0x6c')])['validate'](_0x59990c);if(_0x30d719[_0x9ecc('0x59')]>0x0){return _0x4568d4(_0x1588f8[_0x9ecc('0x11')](0x1f4,_[_0x9ecc('0x5c')](_0x30d719,_0x9ecc('0x1c'))[_0x9ecc('0x15')](',\x20')));}var _0x1e5584=_[_0x9ecc('0x5d')](_0x3a6df1[_0x9ecc('0x5b')],{'uniqueid':_0x59990c[_0x9ecc('0x5e')]});if(_0x1e5584){return BPromise['resolve']()[_0x9ecc('0x20')](function(){if(_0x1e5584['channel']){return ami[_0x9ecc('0x1b')]({'action':'StopMixMonitor','channel':_0x1e5584[_0x9ecc('0x6d')],'mixmonitorid':_0x59990c[_0x9ecc('0x68')]})['catch'](function(_0x28ee24){});}})[_0x9ecc('0x20')](function(){if(_0x1e5584[_0x9ecc('0x6e')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x1e5584[_0x9ecc('0x6e')],'mixmonitorid':_0x59990c[_0x9ecc('0x68')]})[_0x9ecc('0x1d')](function(_0x33b257){});}})[_0x9ecc('0x20')](function(_0x4c9532){var _0x344496=_[_0x9ecc('0x5d')](_0x1e5584[_0x9ecc('0x64')],{'mixmonitorid':_0x59990c[_0x9ecc('0x68')]});if(_0x344496){_0x344496['status']=_0x9ecc('0x6f');}})[_0x9ecc('0x20')](function(){var _0x4f0a57=util[_0x9ecc('0x8')](_0x9ecc('0x5f'),_0x59990c[_0x9ecc('0x60')]||_0x59990c[_0x9ecc('0x5e')],_0x59990c[_0x9ecc('0x8')]||_0x9ecc('0x61'));var _0x3fe6d0=_[_0x9ecc('0x5d')](_0x1e5584[_0x9ecc('0x64')],{'filename':_0x9ecc('0x65')+_0x4f0a57[_0x9ecc('0x66')]()});if(_0x3fe6d0){_0x3fe6d0[_0x9ecc('0x70')]=_0x9ecc('0x6f');}})[_0x9ecc('0x20')](function(){_0x44c7a5({'code':0xc8,'message':[_0x59990c[_0x9ecc('0x5e')],_0x9ecc('0x71')][_0x9ecc('0x15')]('\x20')});})['catch'](function(_0x2140c9){_0x4568d4(_0x1588f8[_0x9ecc('0x11')](0x1f5,[_0x59990c['uniqueid'],_0x2140c9[_0x9ecc('0x1c')][_0x9ecc('0x66')]()][_0x9ecc('0x15')]('\x20')));});}else{return _0x4568d4(_0x1588f8['error'](0x1f5,_0x9ecc('0x6b')));}});},'VoiceQueuesChannels':function(_0x3f2ef9){return new Promise(function(_0x49720d,_0x55a166){var _0x52668c=_[_0x9ecc('0x5a')](_0x3a6df1[_0x9ecc('0x72')]);_0x49720d({'count':_0x52668c[_0x9ecc('0x59')],'rows':_0x52668c});});},'VoiceQueuesChannel':function(_0x3d74b9){var _0x4aaeb7=this;return new Promise(function(_0x238001,_0x19b14d){var _0x4a3fc3=schema(properties['voicequeuechannel'])[_0x9ecc('0x3')](_0x3d74b9);if(_0x4a3fc3[_0x9ecc('0x59')]>0x0){return _0x19b14d(_0x4aaeb7['error'](0x1f4,_['map'](_0x4a3fc3,'message')[_0x9ecc('0x15')](',\x20')));}var _0x3f79f5=_[_0x9ecc('0x5d')](_0x3a6df1[_0x9ecc('0x72')],{'uniqueid':_0x3d74b9[_0x9ecc('0x5e')]});if(_0x3f79f5){_0x238001(_0x3f79f5);}else{return _0x19b14d(_0x4aaeb7[_0x9ecc('0x11')](0x1f5,_0x9ecc('0x6b')));}});},'VoiceQueuesChannelHangup':function(_0x36b133){var _0x528b55=this;return new Promise(function(_0x2d5722,_0x5cb8ac){if(ami[_0x9ecc('0x10')]()==![]){return _0x5cb8ac(_0x528b55['error'](0x1f4,[config['asterisk']['ip'],config[_0x9ecc('0x12')]['username'],_0x9ecc('0x14')][_0x9ecc('0x15')]('\x20')));}var _0x3fb22f=schema(properties[_0x9ecc('0x73')])['validate'](_0x36b133);if(_0x3fb22f[_0x9ecc('0x59')]>0x0){return _0x5cb8ac(_0x528b55[_0x9ecc('0x11')](0x1f4,_['map'](_0x3fb22f,'message')[_0x9ecc('0x15')](',\x20')));}var _0x1c05e6=_[_0x9ecc('0x5d')](_0x3a6df1['queueChannels'],{'uniqueid':_0x36b133['uniqueid']});if(_0x1c05e6&&_0x1c05e6[_0x9ecc('0x6d')]){return ami[_0x9ecc('0x1b')]({'action':_0x9ecc('0x74'),'channel':_0x1c05e6[_0x9ecc('0x6d')]})[_0x9ecc('0x20')](function(_0x9bd363){_0x2d5722({'code':0xc8,'message':[_0x36b133[_0x9ecc('0x5e')],_0x9bd363['message'][_0x9ecc('0x66')]()][_0x9ecc('0x15')]('\x20')});})[_0x9ecc('0x1d')](function(_0x55554c){_0x5cb8ac(_0x528b55[_0x9ecc('0x11')](0x1f5,[_0x36b133[_0x9ecc('0x5e')],_0x55554c['message'][_0x9ecc('0x66')]()][_0x9ecc('0x15')]('\x20')));});}else{return _0x5cb8ac(_0x528b55[_0x9ecc('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x17ce9d){var _0x4b566c=this;return new Promise(function(_0x3607eb,_0x441217){if(ami['isConnected']()==![]){return _0x441217(_0x4b566c[_0x9ecc('0x11')](0x1f4,[config[_0x9ecc('0x12')]['ip'],config['asterisk'][_0x9ecc('0x13')],_0x9ecc('0x14')][_0x9ecc('0x15')]('\x20')));}var _0x131a43=schema(properties[_0x9ecc('0x75')])['validate'](_0x17ce9d);if(_0x131a43[_0x9ecc('0x59')]>0x0){return _0x441217(_0x4b566c[_0x9ecc('0x11')](0x1f4,_[_0x9ecc('0x5c')](_0x131a43,_0x9ecc('0x1c'))[_0x9ecc('0x15')](',\x20')));}var _0x28116c=_['find'](_0x3a6df1[_0x9ecc('0x72')],{'uniqueid':_0x17ce9d[_0x9ecc('0x5e')]});if(_0x28116c&&_0x28116c[_0x9ecc('0x6d')]){return ami[_0x9ecc('0x1b')]({'action':_0x9ecc('0x76'),'channel':_0x28116c[_0x9ecc('0x6d')],'exten':_0x17ce9d[_0x9ecc('0x77')],'context':_0x17ce9d[_0x9ecc('0x78')]||_0x28116c[_0x9ecc('0x78')],'priority':0x1})[_0x9ecc('0x20')](function(_0x28ac26){_0x3607eb({'code':0xc8,'message':[_0x17ce9d['uniqueid'],_0x28ac26[_0x9ecc('0x1c')][_0x9ecc('0x66')]()][_0x9ecc('0x15')]('\x20')});})[_0x9ecc('0x1d')](function(_0x311ccd){_0x441217(_0x4b566c[_0x9ecc('0x11')](0x1f5,[_0x17ce9d[_0x9ecc('0x5e')],_0x311ccd[_0x9ecc('0x1c')][_0x9ecc('0x66')]()]['join']('\x20')));});}else{return _0x441217(_0x4b566c[_0x9ecc('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x104ddd){return new Promise(function(_0x3bfbf3,_0x124326){var _0x59c537=_[_0x9ecc('0x5a')](_0x3a6df1[_0x9ecc('0xe')]);_0x3bfbf3({'count':_0x59c537[_0x9ecc('0x59')],'rows':_0x59c537});});},'Telephones':function(_0x29b27b){return new Promise(function(_0xdb03a0,_0x310460){var _0xc35450=_[_0x9ecc('0x5a')](_0x3a6df1[_0x9ecc('0x79')]);_0xdb03a0({'count':_0xc35450[_0x9ecc('0x59')],'rows':_0xc35450});});},'Trunks':function(_0x31453e){return new Promise(function(_0x35479e,_0x2e0175){var _0x20c218=_['values'](_0x3a6df1[_0x9ecc('0x7a')]);_0x35479e({'count':_0x20c218[_0x9ecc('0x59')],'rows':_0x20c218});});},'OutboundChannels':function(_0x237d7d){return new Promise(function(_0x3f37c9,_0x3a6025){var _0x12452e=_[_0x9ecc('0x5a')](_0x3a6df1['outboundChannels']);_0x3f37c9({'count':_0x12452e[_0x9ecc('0x59')],'rows':_0x12452e});});},'Outbound':function(_0x11e970){return new Promise(function(_0x163f57,_0x4ce7a0){_0x163f57(_0x3a6df1[_0x9ecc('0x31')]);});},'Campaigns':function(_0x2c22eb){return new Promise(function(_0x53e804,_0x1591d2){var _0x4d615b=_[_0x9ecc('0x5a')](_0x3a6df1['campaigns']);_0x53e804({'count':_0x4d615b[_0x9ecc('0x59')],'rows':_0x4d615b});});},'VoiceQueuesPreview':function(_0xf5650){var _0x3be788=this;return new Promise(function(_0x20e62d,_0x3fa852){_0x54c0f8[_0x9ecc('0x7b')](_0xf5650['id'])[_0x9ecc('0x20')](function(_0x2d23a0){_0x20e62d({'code':0xc8,'message':_0x2d23a0['message']});})[_0x9ecc('0x1d')](function(_0x2c247f){_0x3fa852(_0x3be788[_0x9ecc('0x11')](0x1f4,_0x2c247f[_0x9ecc('0x1c')]));});});},'EventManager':function(_0x165997){var _0xf6070f=this;return new Promise(function(_0x33292a,_0x3ad6f5){if(!_0x165997['event']){return _0x3ad6f5(_0xf6070f[_0x9ecc('0x11')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x9ecc('0x7c')]('custom:'+_0x165997[_0x9ecc('0x7d')],_0x165997[_0x9ecc('0x1c')]);_0x33292a({'code':0xc8,'message':_0x165997});});},'FaxAccounts':function(_0x32de90){return new Promise(function(_0x218750,_0x30f8be){var _0x969e1a=_[_0x9ecc('0x5a')](_0x3a6df1[_0x9ecc('0x7e')]);_0x218750({'count':_0x969e1a[_0x9ecc('0x59')],'rows':_0x969e1a});});},'SendFax':function(_0x30df5c){var _0x25abbf=this;return new Promise(function(_0x93a6f7,_0x4a9e15){_0x496dfe[_0x9ecc('0x7f')](_0x30df5c)['then'](function(_0x3b6370){_0x93a6f7({'code':0xc8,'message':_0x3b6370[_0x9ecc('0x1c')]});})[_0x9ecc('0x1d')](function(_0x6cf645){_0x4a9e15(_0x25abbf[_0x9ecc('0x11')](0x1f4,_0x6cf645[_0x9ecc('0x1c')]));});});},'CheckAfterSend':function(_0x4d3f32){var _0x429ab3=this;return new Promise(function(_0x4652b7,_0xc7612b){_0x496dfe[_0x9ecc('0x80')](_0x4d3f32)[_0x9ecc('0x20')](function(_0x5ccd17){_0x4652b7({'code':0xc8,'message':_0x5ccd17[_0x9ecc('0x1c')]});})['catch'](function(_0x5a347b){_0xc7612b(_0x429ab3[_0x9ecc('0x11')](0x1f4,_0x5a347b[_0x9ecc('0x1c')]));});});}};var _0x3a1a44=jayson[_0x9ecc('0x81')](_0x51b489)[_0x9ecc('0x82')]();_0x3a1a44['on'](_0x9ecc('0x11'),function(_0x139be9){return _0x558c23(_0x139be9);});_0x3a1a44[_0x9ecc('0x7')](0x232a,_0x9ecc('0x83'),function(){console['log'](_0x9ecc('0x84'),0x232a);return _0x29d0c5('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xbe35=['asterisk','username','ami\x20disconnected','pick','module','action','Reload','Action','then','message','isConnected','command','Command','content','catch','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','callerid','Interval','push','values','channels','length','join','voicechannel','map','find','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','destinationchannel','StopMixMonitor','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','context','trunks','outboundChannels','campaigns','run','event','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','QueuePause','error'];(function(_0x4110a2,_0x2ef39e){var _0xf4a037=function(_0x4f87db){while(--_0x4f87db){_0x4110a2['push'](_0x4110a2['shift']());}};_0xf4a037(++_0x2ef39e);}(_0xbe35,0x75));var _0x5be3=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xbe35[_0x17406a];return _0x1501ff;};'use strict';var _=require(_0x5be3('0x0'));var util=require(_0x5be3('0x1'));var jayson=require(_0x5be3('0x2'));var schema=require(_0x5be3('0x3'));var BPromise=require(_0x5be3('0x4'));var moment=require(_0x5be3('0x5'));var config=require(_0x5be3('0x6'));var properties=require(_0x5be3('0x7'));var ami=require(_0x5be3('0x8'));exports[_0x5be3('0x9')]=function(_0x4cb870,_0x4573fa,_0x99d187){return new BPromise(function(_0x566d38,_0xe2cab6){var _0x5667ce={'QueuePause':function(_0xbc2c05){return new Promise(function(_0x4e10bf,_0x96f6bb){var _0x82fcd6=util[_0x5be3('0xa')](_0x5be3('0xb'),_0x5be3('0xc'),_0xbc2c05[_0x5be3('0xd')]);if(_0x4cb870['timers']&&_0x4cb870[_0x5be3('0xe')][_0x82fcd6]&&_0x4cb870[_0x5be3('0xe')][_0x82fcd6][_0x5be3('0xf')]){_0x4cb870[_0x5be3('0xe')][_0x82fcd6]['updateAcw']();}if(_0x4cb870['agents'][_0x82fcd6]){_0x4cb870[_0x5be3('0x10')][_0x82fcd6][_0x5be3('0x11')]({'statePause':_0xbc2c05['pause']?!![]:![]});}_0x4e10bf({'code':0xc8,'message':_0x5be3('0x12')});});},'Reload':function(_0x303ea2){var _0x5cb41e=this;return new Promise(function(_0x29d417,_0x173a80){if(ami['isConnected']()==![]){return _0x173a80(_0x5cb41e[_0x5be3('0x13')](0x1f4,[config[_0x5be3('0x14')]['ip'],config[_0x5be3('0x14')][_0x5be3('0x15')],_0x5be3('0x16')]['join']('\x20')));}_0x303ea2=_[_0x5be3('0x17')](_0x303ea2,_['keys'](properties[_0x5be3('0x18')]));_0x303ea2[_0x5be3('0x19')]=_0x5be3('0x1a');return ami[_0x5be3('0x1b')](_0x303ea2)[_0x5be3('0x1c')](function(_0x3a9f75){_0x29d417({'code':0xc8,'message':_0x3a9f75[_0x5be3('0x1d')]});})['catch'](function(_0x13fe31){_0x173a80(_0x5cb41e['error'](0x1f5,_0x13fe31[_0x5be3('0x1d')]));});});},'Command':function(_0x23ef2c){var _0x48482c=this;return new Promise(function(_0x23d19b,_0x43d682){if(ami[_0x5be3('0x1e')]()==![]){return _0x43d682(_0x48482c[_0x5be3('0x13')](0x1f4,[config[_0x5be3('0x14')]['ip'],config['asterisk'][_0x5be3('0x15')],_0x5be3('0x16')]['join']('\x20')));}_0x23ef2c=_[_0x5be3('0x17')](_0x23ef2c,_0x5be3('0x1f'));_0x23ef2c[_0x5be3('0x19')]=_0x5be3('0x20');return ami[_0x5be3('0x1b')](_0x23ef2c)[_0x5be3('0x1c')](function(_0x35c557){_0x23d19b({'code':0xc8,'message':_0x35c557[_0x5be3('0x21')]});})[_0x5be3('0x22')](function(_0x58c320){_0x43d682(_0x48482c[_0x5be3('0x13')](0x1f5,_0x58c320[_0x5be3('0x1d')]));});});},'VoiceQueues':function(_0x296595){return new Promise(function(_0x19165f,_0x2e905a){var _0x11ec43=[];for(var _0x2bf6f0 in _0x4cb870[_0x5be3('0x23')]){if(_0x4cb870['voiceQueues'][_0x5be3('0x24')](_0x2bf6f0)){var _0x23521e=_0x4cb870[_0x5be3('0x23')][_0x2bf6f0];var _0x50497b={'id':_0x23521e['id'],'name':_0x23521e['name'],'strategy':_0x23521e[_0x5be3('0x25')],'answered':_0x23521e[_0x5be3('0x26')],'available':_0x23521e[_0x5be3('0x27')],'loggedIn':_0x23521e[_0x5be3('0x28')],'pTalking':_0x23521e[_0x5be3('0x29')],'sumBillable':_0x23521e[_0x5be3('0x2a')],'sumDuration':_0x23521e['sumDuration'],'sumHoldTime':_0x23521e[_0x5be3('0x2b')]||0x0,'talking':_0x23521e[_0x5be3('0x2c')],'total':_0x23521e[_0x5be3('0x2d')],'type':_0x23521e[_0x5be3('0x2e')],'unmanaged':_0x23521e['unmanaged'],'abandoned':_0x23521e[_0x5be3('0x2f')],'waiting':_0x23521e[_0x5be3('0x30')],'loggedInDb':_0x23521e[_0x5be3('0x31')]};if(_0x23521e[_0x5be3('0x2e')]===_0x5be3('0x32')){_0x50497b[_0x5be3('0x33')]=_0x23521e[_0x5be3('0x33')];_0x50497b['dialMethod']=_0x23521e[_0x5be3('0x34')];_0x50497b['dialOriginateCallerIdName']=_0x23521e[_0x5be3('0x35')];_0x50497b[_0x5be3('0x36')]=_0x23521e[_0x5be3('0x36')];_0x50497b['dialOriginateTimeout']=_0x23521e[_0x5be3('0x37')];_0x50497b[_0x5be3('0x38')]=_0x23521e[_0x5be3('0x38')];_0x50497b[_0x5be3('0x39')]=_0x23521e['outboundAnswerAgiCallsDay'];_0x50497b[_0x5be3('0x3a')]=_0x23521e['outboundAnswerCallsDay'];_0x50497b[_0x5be3('0x3b')]=_0x23521e[_0x5be3('0x3b')];_0x50497b['outboundBusyCallsDay']=_0x23521e['outboundBusyCallsDay'];_0x50497b[_0x5be3('0x3c')]=_0x23521e[_0x5be3('0x3c')];_0x50497b[_0x5be3('0x3d')]=_0x23521e[_0x5be3('0x3d')];_0x50497b[_0x5be3('0x3e')]=_0x23521e[_0x5be3('0x3e')];_0x50497b[_0x5be3('0x3f')]=_0x23521e[_0x5be3('0x3f')];_0x50497b[_0x5be3('0x40')]=_0x23521e[_0x5be3('0x40')];_0x50497b[_0x5be3('0x41')]=_0x23521e[_0x5be3('0x41')];_0x50497b['outboundOriginateFailureCallsDay']=_0x23521e[_0x5be3('0x42')];_0x50497b[_0x5be3('0x43')]=_0x23521e[_0x5be3('0x43')];_0x50497b['outboundRejectCallsDay']=_0x23521e[_0x5be3('0x44')];_0x50497b[_0x5be3('0x45')]=_0x23521e[_0x5be3('0x45')];_0x50497b[_0x5be3('0x46')]=_0x23521e[_0x5be3('0x46')];_0x50497b['predictiveIntervalAvgHoldtime']=_0x23521e[_0x5be3('0x47')];_0x50497b[_0x5be3('0x48')]=_0x23521e[_0x5be3('0x48')];_0x50497b[_0x5be3('0x49')]=_0x23521e['predictiveIntervalDroppedCallsCallersExit'];_0x50497b[_0x5be3('0x4a')]=_0x23521e[_0x5be3('0x4a')];_0x50497b[_0x5be3('0x4b')]=_0x23521e[_0x5be3('0x4b')];_0x50497b['predictiveIntervalErlangCallsDroppedCalls']=_0x23521e[_0x5be3('0x4c')];_0x50497b[_0x5be3('0x4d')]=_0x23521e[_0x5be3('0x4d')];_0x50497b[_0x5be3('0x4e')]=_0x23521e[_0x5be3('0x4e')];_0x50497b['predictiveIntervalPauses']=_0x23521e[_0x5be3('0x4f')];_0x50497b[_0x5be3('0x50')]=_0x23521e['predictiveIntervalAvailable'];_0x50497b[_0x5be3('0x51')]=_0x23521e['predictiveIntervalTotalCalls'];_0x50497b['message']=_0x23521e['message'];_0x50497b[_0x5be3('0x52')]=_0x23521e[_0x5be3('0x52')];_0x50497b[_0x5be3('0x53')]=_0x23521e[_0x5be3('0x53')];_0x50497b[_0x5be3('0x54')]=_0x23521e[_0x5be3('0x54')];_0x50497b[_0x5be3('0x55')]=_0x23521e[_0x5be3('0x55')];_0x50497b['erlangBusyFactor']=_0x23521e['erlangBusyFactor'];_0x50497b[_0x5be3('0x56')]=_0x23521e[_0x5be3('0x56')];_0x50497b[_0x5be3('0x57')]=_0x23521e[_0x5be3('0x57')];}if(_0x23521e[_0x5be3('0x58')]){_0x50497b[_0x5be3('0x58')]={'id':_0x23521e['Trunk']['id'],'name':_0x23521e['Trunk']['name'],'active':_0x23521e[_0x5be3('0x58')]['active'],'callerid':_0x23521e[_0x5be3('0x58')][_0x5be3('0x59')]};}if(_0x23521e['Interval']){_0x50497b[_0x5be3('0x5a')]={'id':_0x23521e[_0x5be3('0x5a')]['id'],'name':_0x23521e[_0x5be3('0x5a')]['name']};}_0x11ec43[_0x5be3('0x5b')](_0x50497b);}}_0x19165f({'count':_0x11ec43['length'],'rows':_0x11ec43});});},'VoiceChannels':function(_0x2bd25c){return new Promise(function(_0x3fd353,_0x30d2e8){var _0x652e26=_[_0x5be3('0x5c')](_0x4cb870[_0x5be3('0x5d')]);_0x3fd353({'count':_0x652e26[_0x5be3('0x5e')],'rows':_0x652e26});});},'VoiceChannelMixMonitor':function(_0x4048bc){var _0x5f08df=this;return new Promise(function(_0x1b5dd2,_0x5581cb){if(ami[_0x5be3('0x1e')]()==![]){return _0x5581cb(_0x5f08df['error'](0x1f4,[config[_0x5be3('0x14')]['ip'],config[_0x5be3('0x14')][_0x5be3('0x15')],_0x5be3('0x16')][_0x5be3('0x5f')]('\x20')));}var _0x14bbf0=schema(properties[_0x5be3('0x60')])[_0x5be3('0x3')](_0x4048bc);if(_0x14bbf0[_0x5be3('0x5e')]>0x0){return _0x5581cb(_0x5f08df[_0x5be3('0x13')](0x1f4,_[_0x5be3('0x61')](_0x14bbf0,_0x5be3('0x1d'))['join'](',\x20')));}var _0x12eb67=_[_0x5be3('0x62')](_0x4cb870[_0x5be3('0x5d')],{'uniqueid':_0x4048bc[_0x5be3('0x63')]});if(_0x12eb67&&_0x12eb67[_0x5be3('0x64')]){var _0x26cdc5=util[_0x5be3('0xa')](_0x5be3('0x65'),_0x4048bc[_0x5be3('0x66')]||_0x4048bc[_0x5be3('0x63')],_0x4048bc[_0x5be3('0xa')]||_0x5be3('0x67'));return ami[_0x5be3('0x1b')]({'action':'MixMonitor','channel':_0x12eb67[_0x5be3('0x64')],'file':_0x26cdc5,'options':_0x5be3('0x68')})[_0x5be3('0x1c')](function(_0x230917){var _0x4e51bb=_['find'](_0x12eb67[_0x5be3('0x69')],{'filename':_0x5be3('0x6a')+_0x26cdc5[_0x5be3('0x6b')]()});if(_[_0x5be3('0x6c')](_0x4e51bb)){_0x12eb67[_0x5be3('0x69')][_0x5be3('0x5b')]({'filename':_0x5be3('0x6a')+_0x26cdc5['toLowerCase'](),'createdAt':moment()[_0x5be3('0xa')](_0x5be3('0x6d')),'mixmonitorid':_0x230917[_0x5be3('0x6e')],'status':_0x5be3('0x6f')});}else{_0x4e51bb[_0x5be3('0x6e')]=_0x230917[_0x5be3('0x6e')];_0x4e51bb[_0x5be3('0x70')]=_0x5be3('0x6f');}_0x1b5dd2({'code':0xc8,'message':[_0x4048bc[_0x5be3('0x63')],_0x5be3('0x71'),_0x230917[_0x5be3('0x6e')]][_0x5be3('0x5f')]('\x20'),'mixmonitorid':_0x230917['mixmonitorid']});})[_0x5be3('0x22')](function(_0x567510){_0x5581cb(_0x5f08df[_0x5be3('0x13')](0x1f5,[_0x4048bc[_0x5be3('0x63')],_0x567510[_0x5be3('0x1d')][_0x5be3('0x6b')]()][_0x5be3('0x5f')]('\x20')));});}else{return _0x5581cb(_0x5f08df[_0x5be3('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x78b593){var _0x4c4fb4=this;return new Promise(function(_0x3b2221,_0x452c85){if(ami['isConnected']()==![]){return _0x452c85(_0x4c4fb4[_0x5be3('0x13')](0x1f4,[config[_0x5be3('0x14')]['ip'],config['asterisk'][_0x5be3('0x15')],_0x5be3('0x16')]['join']('\x20')));}var _0x56b326=schema(properties['voicechannel'])['validate'](_0x78b593);if(_0x56b326[_0x5be3('0x5e')]>0x0){return _0x452c85(_0x4c4fb4['error'](0x1f4,_['map'](_0x56b326,_0x5be3('0x1d'))[_0x5be3('0x5f')](',\x20')));}var _0x13c385=_[_0x5be3('0x62')](_0x4cb870[_0x5be3('0x5d')],{'uniqueid':_0x78b593[_0x5be3('0x63')]});if(_0x13c385){return BPromise['resolve']()[_0x5be3('0x1c')](function(){if(_0x13c385[_0x5be3('0x64')]){return ami[_0x5be3('0x1b')]({'action':'StopMixMonitor','channel':_0x13c385[_0x5be3('0x64')],'mixmonitorid':_0x78b593['mixmonitorid']})['catch'](function(_0x4772ae){});}})['then'](function(){if(_0x13c385[_0x5be3('0x72')]){return ami[_0x5be3('0x1b')]({'action':_0x5be3('0x73'),'channel':_0x13c385[_0x5be3('0x72')],'mixmonitorid':_0x78b593[_0x5be3('0x6e')]})[_0x5be3('0x22')](function(_0x3490a0){});}})[_0x5be3('0x1c')](function(_0xea89d9){var _0x5d14b2=_[_0x5be3('0x62')](_0x13c385['monitors'],{'mixmonitorid':_0x78b593[_0x5be3('0x6e')]});if(_0x5d14b2){_0x5d14b2[_0x5be3('0x70')]=_0x5be3('0x74');}})['then'](function(){var _0x11c49d=util[_0x5be3('0xa')](_0x5be3('0x65'),_0x78b593[_0x5be3('0x66')]||_0x78b593['uniqueid'],_0x78b593[_0x5be3('0xa')]||_0x5be3('0x67'));var _0x12f4c8=_[_0x5be3('0x62')](_0x13c385[_0x5be3('0x69')],{'filename':'/var/spool/asterisk/monitor/'+_0x11c49d[_0x5be3('0x6b')]()});if(_0x12f4c8){_0x12f4c8['status']=_0x5be3('0x74');}})[_0x5be3('0x1c')](function(){_0x3b2221({'code':0xc8,'message':[_0x78b593[_0x5be3('0x63')],_0x5be3('0x75')]['join']('\x20')});})['catch'](function(_0x4bc5ad){_0x452c85(_0x4c4fb4[_0x5be3('0x13')](0x1f5,[_0x78b593[_0x5be3('0x63')],_0x4bc5ad['message']['toLowerCase']()][_0x5be3('0x5f')]('\x20')));});}else{return _0x452c85(_0x4c4fb4[_0x5be3('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x2ec6e4){return new Promise(function(_0x4e34d0,_0x19a5a3){var _0x22a268=_[_0x5be3('0x5c')](_0x4cb870[_0x5be3('0x76')]);_0x4e34d0({'count':_0x22a268[_0x5be3('0x5e')],'rows':_0x22a268});});},'VoiceQueuesChannel':function(_0x1db8ea){var _0x34a70b=this;return new Promise(function(_0x4e3aac,_0x489170){var _0x2c7be6=schema(properties[_0x5be3('0x77')])[_0x5be3('0x3')](_0x1db8ea);if(_0x2c7be6[_0x5be3('0x5e')]>0x0){return _0x489170(_0x34a70b[_0x5be3('0x13')](0x1f4,_['map'](_0x2c7be6,'message')[_0x5be3('0x5f')](',\x20')));}var _0x42ec12=_['find'](_0x4cb870[_0x5be3('0x76')],{'uniqueid':_0x1db8ea[_0x5be3('0x63')]});if(_0x42ec12){_0x4e3aac(_0x42ec12);}else{return _0x489170(_0x34a70b['error'](0x1f5,_0x5be3('0x78')));}});},'VoiceQueuesChannelHangup':function(_0x1a01b1){var _0x563391=this;return new Promise(function(_0x4c87e9,_0x77bed0){if(ami[_0x5be3('0x1e')]()==![]){return _0x77bed0(_0x563391[_0x5be3('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x5be3('0x14')][_0x5be3('0x15')],_0x5be3('0x16')][_0x5be3('0x5f')]('\x20')));}var _0x194d18=schema(properties[_0x5be3('0x79')])[_0x5be3('0x3')](_0x1a01b1);if(_0x194d18[_0x5be3('0x5e')]>0x0){return _0x77bed0(_0x563391[_0x5be3('0x13')](0x1f4,_[_0x5be3('0x61')](_0x194d18,'message')[_0x5be3('0x5f')](',\x20')));}var _0x4ecf84=_[_0x5be3('0x62')](_0x4cb870[_0x5be3('0x76')],{'uniqueid':_0x1a01b1[_0x5be3('0x63')]});if(_0x4ecf84&&_0x4ecf84[_0x5be3('0x64')]){return ami[_0x5be3('0x1b')]({'action':_0x5be3('0x7a'),'channel':_0x4ecf84[_0x5be3('0x64')]})[_0x5be3('0x1c')](function(_0x5e6dfd){_0x4c87e9({'code':0xc8,'message':[_0x1a01b1['uniqueid'],_0x5e6dfd[_0x5be3('0x1d')][_0x5be3('0x6b')]()][_0x5be3('0x5f')]('\x20')});})[_0x5be3('0x22')](function(_0x2b7efb){_0x77bed0(_0x563391[_0x5be3('0x13')](0x1f5,[_0x1a01b1['uniqueid'],_0x2b7efb['message'][_0x5be3('0x6b')]()][_0x5be3('0x5f')]('\x20')));});}else{return _0x77bed0(_0x563391[_0x5be3('0x13')](0x1f5,_0x5be3('0x78')));}});},'VoiceQueuesChannelRedirect':function(_0x575ef1){var _0x40d06d=this;return new Promise(function(_0xac81fc,_0x42650e){if(ami[_0x5be3('0x1e')]()==![]){return _0x42650e(_0x40d06d[_0x5be3('0x13')](0x1f4,[config[_0x5be3('0x14')]['ip'],config[_0x5be3('0x14')][_0x5be3('0x15')],_0x5be3('0x16')][_0x5be3('0x5f')]('\x20')));}var _0x38eb70=schema(properties['voicequeuechannelredirect'])[_0x5be3('0x3')](_0x575ef1);if(_0x38eb70[_0x5be3('0x5e')]>0x0){return _0x42650e(_0x40d06d[_0x5be3('0x13')](0x1f4,_[_0x5be3('0x61')](_0x38eb70,_0x5be3('0x1d'))['join'](',\x20')));}var _0x23da6d=_['find'](_0x4cb870[_0x5be3('0x76')],{'uniqueid':_0x575ef1[_0x5be3('0x63')]});if(_0x23da6d&&_0x23da6d[_0x5be3('0x64')]){return ami[_0x5be3('0x1b')]({'action':'Redirect','channel':_0x23da6d[_0x5be3('0x64')],'exten':_0x575ef1['exten'],'context':_0x575ef1[_0x5be3('0x7b')]||_0x23da6d['context'],'priority':0x1})[_0x5be3('0x1c')](function(_0x2848db){_0xac81fc({'code':0xc8,'message':[_0x575ef1[_0x5be3('0x63')],_0x2848db['message'][_0x5be3('0x6b')]()][_0x5be3('0x5f')]('\x20')});})[_0x5be3('0x22')](function(_0x1cc134){_0x42650e(_0x40d06d[_0x5be3('0x13')](0x1f5,[_0x575ef1['uniqueid'],_0x1cc134['message'][_0x5be3('0x6b')]()]['join']('\x20')));});}else{return _0x42650e(_0x40d06d[_0x5be3('0x13')](0x1f5,_0x5be3('0x78')));}});},'Agents':function(_0x291ce0){return new Promise(function(_0x37b3a6,_0x4baaf2){var _0x210c3b=_[_0x5be3('0x5c')](_0x4cb870[_0x5be3('0x10')]);_0x37b3a6({'count':_0x210c3b[_0x5be3('0x5e')],'rows':_0x210c3b});});},'Telephones':function(_0x1ec136){return new Promise(function(_0x14e67a,_0x756421){var _0x3583ac=_['values'](_0x4cb870['telephones']);_0x14e67a({'count':_0x3583ac[_0x5be3('0x5e')],'rows':_0x3583ac});});},'Trunks':function(_0x557320){return new Promise(function(_0xbe594a,_0x499f20){var _0x496e0c=_[_0x5be3('0x5c')](_0x4cb870[_0x5be3('0x7c')]);_0xbe594a({'count':_0x496e0c[_0x5be3('0x5e')],'rows':_0x496e0c});});},'OutboundChannels':function(_0x131dca){return new Promise(function(_0x135dc7,_0xb84853){var _0xf93945=_[_0x5be3('0x5c')](_0x4cb870[_0x5be3('0x7d')]);_0x135dc7({'count':_0xf93945[_0x5be3('0x5e')],'rows':_0xf93945});});},'Outbound':function(_0x768237){return new Promise(function(_0x44580d,_0x2e9400){_0x44580d(_0x4cb870['outbound']);});},'Campaigns':function(_0x5f9d9b){return new Promise(function(_0x478778,_0x535347){var _0x3ea61b=_[_0x5be3('0x5c')](_0x4cb870[_0x5be3('0x7e')]);_0x478778({'count':_0x3ea61b[_0x5be3('0x5e')],'rows':_0x3ea61b});});},'VoiceQueuesPreview':function(_0x44a7b6){var _0x241e2b=this;return new Promise(function(_0x120a24,_0x58f9c9){_0x4573fa[_0x5be3('0x7f')](_0x44a7b6['id'])['then'](function(_0x1053e5){_0x120a24({'code':0xc8,'message':_0x1053e5['message']});})[_0x5be3('0x22')](function(_0x1f8365){_0x58f9c9(_0x241e2b[_0x5be3('0x13')](0x1f4,_0x1f8365['message']));});});},'EventManager':function(_0x32a386){var _0x4eab7d=this;return new Promise(function(_0x35737b,_0x283b6f){if(!_0x32a386[_0x5be3('0x80')]){return _0x283b6f(_0x4eab7d[_0x5be3('0x13')](0x1f4,'Event\x20name\x20mandatory'));}ami['emit']('custom:'+_0x32a386[_0x5be3('0x80')],_0x32a386[_0x5be3('0x1d')]);_0x35737b({'code':0xc8,'message':_0x32a386});});},'FaxAccounts':function(_0x55e01f){return new Promise(function(_0x38dcbd,_0x2db145){var _0x4d5fb1=_[_0x5be3('0x5c')](_0x4cb870[_0x5be3('0x81')]);_0x38dcbd({'count':_0x4d5fb1[_0x5be3('0x5e')],'rows':_0x4d5fb1});});},'SendFax':function(_0xff4727){var _0x5efd09=this;return new Promise(function(_0x55b775,_0x113e22){_0x99d187[_0x5be3('0x82')](_0xff4727)['then'](function(_0x72a99f){_0x55b775({'code':0xc8,'message':_0x72a99f[_0x5be3('0x1d')]});})[_0x5be3('0x22')](function(_0x35baf8){_0x113e22(_0x5efd09['error'](0x1f4,_0x35baf8['message']));});});},'CheckAfterSend':function(_0x31c431){var _0x126a6b=this;return new Promise(function(_0x2534c9,_0x469191){_0x99d187[_0x5be3('0x83')](_0x31c431)[_0x5be3('0x1c')](function(_0x56b3c1){_0x2534c9({'code':0xc8,'message':_0x56b3c1[_0x5be3('0x1d')]});})[_0x5be3('0x22')](function(_0x4de1cc){_0x469191(_0x126a6b[_0x5be3('0x13')](0x1f4,_0x4de1cc['message']));});});}};var _0x5b5ccd=jayson[_0x5be3('0x84')](_0x5667ce)[_0x5be3('0x85')]();_0x5b5ccd['on'](_0x5be3('0x13'),function(_0x129dc7){return _0xe2cab6(_0x129dc7);});_0x5b5ccd['listen'](0x232a,_0x5be3('0x86'),function(){console[_0x5be3('0x87')](_0x5be3('0x88'),0x232a);return _0x566d38('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 63c26fc..c900e9a 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 _0x6bdc=['uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Autocreate\x20enabled','data4','isNil','routeId','destcalleridnum','firstName','calleridname','','Unknown','destcalleridname','resolve','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','exec','data1','data2','xmd-contactid2','isEmpty','ListId','data3','split','phone','$or','map','calleridnum','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s'];(function(_0x28fa5e,_0x52a665){var _0x28bad8=function(_0x5ab856){while(--_0x5ab856){_0x28fa5e['push'](_0x28fa5e['shift']());}};_0x28bad8(++_0x52a665);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x1f2f4e,_0x566d58){_0x1f2f4e=_0x1f2f4e-0x0;var _0x11951f=_0x6bdc[_0x1f2f4e];return _0x11951f;};'use strict';var _=require(_0xc6bd('0x0'));var BPromise=require(_0xc6bd('0x1'));var Redis=require(_0xc6bd('0x2'));var util=require(_0xc6bd('0x3'));var config=require(_0xc6bd('0x4'));var logger=require(_0xc6bd('0x5'))(_0xc6bd('0x6'));var cmContactRpc=require(_0xc6bd('0x7'));config[_0xc6bd('0x8')]=_[_0xc6bd('0x9')](config['redis'],{'host':_0xc6bd('0xa'),'port':0x18eb});var io=require(_0xc6bd('0xb'))(new Redis(config[_0xc6bd('0x8')]));function emit(_0x3f5327,_0x2c1c68,_0x8bd379,_0x5ca385,_0x374067){logger[_0xc6bd('0xc')](_0xc6bd('0xd'),_0x3f5327,_0x2c1c68['id'],_0x8bd379,_0x5ca385,JSON['stringify'](_0x374067));io['to'](_0x8bd379)['emit'](_0x5ca385,_0x374067);}exports[_0xc6bd('0xe')]=function(_0x582cbe,_0x3fdffe,_0x5923df,_0x3150d8){var _0x2198cf,_0x21dacc;var _0x1a37fd={};var _0x23dcb0=Number(_0x5923df[_0xc6bd('0xf')]);var _0x3866de=_0x5923df[_0xc6bd('0x10')]?Boolean(Number(_0x5923df[_0xc6bd('0x10')])):![];if(_0x3150d8[_0xc6bd('0x11')]&&!_[_0xc6bd('0x12')](_0x3150d8[_0xc6bd('0x11')]))_0x1a37fd['id']=_0x3150d8[_0xc6bd('0x11')];if(!_0x1a37fd['id']){_0x1a37fd[_0xc6bd('0x13')]=_0x23dcb0;var _0x54e9ce=_0x5923df[_0xc6bd('0x14')]&&_0x5923df['data3']!=='0'?_0x5923df['data3'][_0xc6bd('0x15')](','):[_0xc6bd('0x16')];_0x1a37fd[_0xc6bd('0x17')]=_[_0xc6bd('0x18')](_0x54e9ce,function(_0x3d1d8f){return{['field']:_0x3150d8['routeId']?_0x3150d8['destcalleridnum']:_0x3150d8[_0xc6bd('0x19')]};});}BPromise['resolve']()[_0xc6bd('0x1a')](cmContactRpc[_0xc6bd('0x1b')]({'where':_0x1a37fd}))[_0xc6bd('0x1a')](function(_0x4efe46){_0x21dacc=_0x4efe46;if(!_[_0xc6bd('0x12')](_0x21dacc)){if(_0x21dacc[_0xc6bd('0x1c')]===0x1){_0x2198cf=_0x21dacc[0x0];logger[_0xc6bd('0xc')](_0xc6bd('0x1d'),_0x3150d8[_0xc6bd('0x1e')],_0x3fdffe['id'],_0x2198cf['id']);}else{logger[_0xc6bd('0xc')](_0xc6bd('0x1f'),_0x3150d8[_0xc6bd('0x1e')],_0x3fdffe['id'],_['map'](_0x21dacc,'id')[_0xc6bd('0x20')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x3150d8['uniqueid'],_0x3fdffe['id']);if(_0x3866de){logger[_0xc6bd('0xc')](_0xc6bd('0x21'),_0x3150d8[_0xc6bd('0x1e')],_0x3fdffe['id']);var _0x235b15=_0x5923df[_0xc6bd('0x22')]&&_0x5923df['data4']!=='0'?_0x5923df[_0xc6bd('0x22')]:'phone';var _0x5d45f6={'ListId':_0x23dcb0,['creationField']:_[_0xc6bd('0x23')](_0x3150d8[_0xc6bd('0x24')])?_0x3150d8[_0xc6bd('0x19')]:_0x3150d8[_0xc6bd('0x25')]};if(_[_0xc6bd('0x23')](_0x3150d8[_0xc6bd('0x24')])){_0x5d45f6[_0xc6bd('0x26')]=_0x3150d8[_0xc6bd('0x27')]&&_0x3150d8['calleridname']!==_0xc6bd('0x28')?_0x3150d8[_0xc6bd('0x27')]:_0xc6bd('0x29');}else{_0x5d45f6[_0xc6bd('0x26')]=_0x3150d8[_0xc6bd('0x2a')]&&_0x3150d8[_0xc6bd('0x2a')]!==_0xc6bd('0x28')?_0x3150d8[_0xc6bd('0x2a')]:_0xc6bd('0x29');}return BPromise[_0xc6bd('0x2b')]()['then'](cmContactRpc[_0xc6bd('0x2c')](_0x5d45f6))[_0xc6bd('0x1a')](function(_0x532fb2){_0x2198cf=_0x532fb2;if(_0x2198cf){logger[_0xc6bd('0xc')](_0xc6bd('0x2d'),_0x3150d8[_0xc6bd('0x1e')],_0x3fdffe['id'],_0x2198cf['id']);}return;});}else{logger['info'](_0xc6bd('0x2e'),_0x3150d8['uniqueid'],_0x3fdffe['id']);return;}}})[_0xc6bd('0x1a')](function(){if(_0x582cbe){emit(_0x3150d8[_0xc6bd('0x1e')],_0x3fdffe,util[_0xc6bd('0x2f')](_0xc6bd('0x30'),_0x582cbe[_0xc6bd('0x31')]),util[_0xc6bd('0x2f')](_0xc6bd('0x32'),_0x5923df['action'][_0xc6bd('0x33')]()),{'evt':_['merge'](_0x3150d8,{'autoCreate':_0x3866de}),'contact':_0x2198cf,'contacts':!_0x2198cf?_0x21dacc:undefined});}});}; \ No newline at end of file +var _0x9957=['[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid2','isEmpty','ListId','data3','split','phone','$or','destcalleridnum','calleridnum','resolve','then','getContacts','length','uniqueid','info','[CM][%s][%s]\x20Contact\x20not\x20found','[CM][%s][%s]\x20Autocreate\x20enabled','data4','isNil','routeId','firstName','calleridname','','Unknown','destcalleridname'];(function(_0x3e2e3a,_0xc025db){var _0xf6669c=function(_0x5d02c9){while(--_0x5d02c9){_0x3e2e3a['push'](_0x3e2e3a['shift']());}};_0xf6669c(++_0xc025db);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var Redis=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var config=require('../../../../config/environment');var logger=require(_0x7995('0x4'))(_0x7995('0x5'));var cmContactRpc=require(_0x7995('0x6'));config[_0x7995('0x7')]=_['defaults'](config[_0x7995('0x7')],{'host':_0x7995('0x8'),'port':0x18eb});var io=require(_0x7995('0x9'))(new Redis(config[_0x7995('0x7')]));function emit(_0xbda126,_0x326741,_0x4996ca,_0x465276,_0x1cad37){logger['info'](_0x7995('0xa'),_0xbda126,_0x326741['id'],_0x4996ca,_0x465276,JSON[_0x7995('0xb')](_0x1cad37));io['to'](_0x4996ca)[_0x7995('0xc')](_0x465276,_0x1cad37);}exports[_0x7995('0xd')]=function(_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){var _0x245143,_0x41c652;var _0x581f22={};var _0xb0c872=Number(_0x341672[_0x7995('0xe')]);var _0x19a27e=_0x341672[_0x7995('0xf')]?Boolean(Number(_0x341672[_0x7995('0xf')])):![];if(_0x524f7b[_0x7995('0x10')]&&!_[_0x7995('0x11')](_0x524f7b['xmd-contactid2']))_0x581f22['id']=_0x524f7b['xmd-contactid2'];if(!_0x581f22['id']){_0x581f22[_0x7995('0x12')]=_0xb0c872;var _0x2233dd=_0x341672[_0x7995('0x13')]&&_0x341672[_0x7995('0x13')]!=='0'?_0x341672[_0x7995('0x13')][_0x7995('0x14')](','):[_0x7995('0x15')];_0x581f22[_0x7995('0x16')]=_['map'](_0x2233dd,function(_0x2eeacc){return{['field']:_0x524f7b['routeId']?_0x524f7b[_0x7995('0x17')]:_0x524f7b[_0x7995('0x18')]};});}BPromise[_0x7995('0x19')]()[_0x7995('0x1a')](cmContactRpc[_0x7995('0x1b')]({'where':_0x581f22}))[_0x7995('0x1a')](function(_0x4faa60){_0x41c652=_0x4faa60;if(!_['isEmpty'](_0x41c652)){if(_0x41c652[_0x7995('0x1c')]===0x1){_0x245143=_0x41c652[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0x524f7b[_0x7995('0x1d')],_0x1e400a['id'],_0x245143['id']);}else{logger[_0x7995('0x1e')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x524f7b[_0x7995('0x1d')],_0x1e400a['id'],_['map'](_0x41c652,'id')['join'](','));}return;}else{logger[_0x7995('0x1e')](_0x7995('0x1f'),_0x524f7b[_0x7995('0x1d')],_0x1e400a['id']);if(_0x19a27e){logger[_0x7995('0x1e')](_0x7995('0x20'),_0x524f7b[_0x7995('0x1d')],_0x1e400a['id']);var _0x5d40ae=_0x341672[_0x7995('0x21')]&&_0x341672[_0x7995('0x21')]!=='0'?_0x341672[_0x7995('0x21')]:_0x7995('0x15');var _0x563799={'ListId':_0xb0c872,['creationField']:_[_0x7995('0x22')](_0x524f7b[_0x7995('0x23')])?_0x524f7b[_0x7995('0x18')]:_0x524f7b['destcalleridnum']};if(_[_0x7995('0x22')](_0x524f7b[_0x7995('0x23')])){_0x563799[_0x7995('0x24')]=_0x524f7b[_0x7995('0x25')]&&_0x524f7b[_0x7995('0x25')]!==_0x7995('0x26')?_0x524f7b['calleridname']:_0x7995('0x27');}else{_0x563799['firstName']=_0x524f7b[_0x7995('0x28')]&&_0x524f7b[_0x7995('0x28')]!==_0x7995('0x26')?_0x524f7b[_0x7995('0x28')]:_0x7995('0x27');}return BPromise['resolve']()[_0x7995('0x1a')](cmContactRpc['createContact'](_0x563799))[_0x7995('0x1a')](function(_0x3250e0){_0x245143=_0x3250e0;if(_0x245143){logger[_0x7995('0x1e')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x524f7b['uniqueid'],_0x1e400a['id'],_0x245143['id']);}return;});}else{logger['info'](_0x7995('0x29'),_0x524f7b[_0x7995('0x1d')],_0x1e400a['id']);return;}}})[_0x7995('0x1a')](function(){if(_0x3c1d19){emit(_0x524f7b[_0x7995('0x1d')],_0x1e400a,util[_0x7995('0x2a')](_0x7995('0x2b'),_0x3c1d19['name']),util['format'](_0x7995('0x2c'),_0x341672['action'][_0x7995('0x2d')]()),{'evt':_[_0x7995('0x2e')](_0x524f7b,{'autoCreate':_0x19a27e}),'contact':_0x245143,'contacts':!_0x245143?_0x41c652:undefined});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 5479473..ba3ef0a 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 _0x62c0=['search','AllConditions','every','checkConditions','AnyConditions','channel','field','account','chat','ChatWebsiteId','value','upperFirst','AccountId','interaction','message','event','operator','agent','membername','lastevent','exports','lodash','url','mustache','./urlforward','./integration','./cmContact','../../../config/logger','trigger','../ami','redis','localhost','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','deskAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','prototype','emit','info','stringify','clone','checkTriggers','interface','hasOwnProperty','status','checkTrigger','variables','Actions','length','action','motionbar','data1','TemplateId','data2','html','template\x20not\x20found','uri','buildUri','isNil','data3','uriLocation','windowWidth','data5','800','windowHeight','600','winApplication','winArguments','render','format','user:%s','name','trigger:%s:%s','merge','trigger:%s','toLowerCase','exec','integration','queue','routeId','urlforward'];(function(_0x2c534a,_0x18a19e){var _0x3f5c99=function(_0x4c085f){while(--_0x4c085f){_0x2c534a['push'](_0x2c534a['shift']());}};_0x3f5c99(++_0x18a19e);}(_0x62c0,0x1d9));var _0x062c=function(_0x5ef55a,_0x2a03b1){_0x5ef55a=_0x5ef55a-0x0;var _0x20ae40=_0x62c0[_0x5ef55a];return _0x20ae40;};'use strict';var util=require('util');var _=require(_0x062c('0x0'));var url=require(_0x062c('0x1'));var Mustache=require(_0x062c('0x2'));var Redis=require('ioredis');var urlforward=require(_0x062c('0x3'));var integration=require(_0x062c('0x4'));var cmContact=require(_0x062c('0x5'));var script=require('./script');var config=require('../../../config/environment');var logger=require(_0x062c('0x6'))(_0x062c('0x7'));var ami=require(_0x062c('0x8'));config[_0x062c('0x9')]=_['defaults'](config[_0x062c('0x9')],{'host':_0x062c('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x062c('0x9')]));var operators={'equals':function(_0x104985,_0x4dcd95){return _0x104985==_0x4dcd95;},'not_equals':function(_0x101c85,_0x501057){return _0x101c85!=_0x501057;}};var barAndWebActions=[_0x062c('0xb'),_0x062c('0x1'),'winapp'];function Trigger(_0x2727b6){this[_0x062c('0xc')]=_0x2727b6[_0x062c('0xc')];this[_0x062c('0xd')]=_0x2727b6[_0x062c('0xd')];this[_0x062c('0xe')]=_0x2727b6[_0x062c('0xe')];this[_0x062c('0xf')]=_0x2727b6[_0x062c('0xf')];this[_0x062c('0x10')]=_0x2727b6[_0x062c('0x10')];this['zendeskAccounts']=_0x2727b6[_0x062c('0x11')];this[_0x062c('0x12')]=_0x2727b6['freshdeskAccounts'];this[_0x062c('0x13')]=_0x2727b6[_0x062c('0x13')];this[_0x062c('0x14')]=_0x2727b6[_0x062c('0x14')];this['zohoAccounts']=_0x2727b6[_0x062c('0x15')];this['deskAccounts']=_0x2727b6['deskAccounts'];this['vtigerAccounts']=_0x2727b6[_0x062c('0x16')];this[_0x062c('0x17')]=_0x2727b6['servicenowAccounts'];this['dynamics365Accounts']=_0x2727b6[_0x062c('0x18')];this[_0x062c('0x19')]=_0x2727b6[_0x062c('0x19')];this[_0x062c('0x1a')]={'zendesk':this[_0x062c('0x11')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x062c('0x12')],'sugarcrm':this[_0x062c('0x14')],'zoho':this[_0x062c('0x15')],'desk':this[_0x062c('0x1b')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x062c('0x18')],'freshsales':this[_0x062c('0x19')],'servicenow':this[_0x062c('0x17')]};ami['on'](_0x062c('0x1c'),this[_0x062c('0x1d')]['bind'](this));ami['on'](_0x062c('0x1e'),this[_0x062c('0x1d')][_0x062c('0x1f')](this));ami['on']('custom:agentringnoanswer',this[_0x062c('0x1d')][_0x062c('0x1f')](this));ami['on'](_0x062c('0x20'),this['syncCustomEvent']['bind'](this));ami['on'](_0x062c('0x21'),this['syncCustomEvent'][_0x062c('0x1f')](this));ami['on']('custom:agentnoanswer',this['syncCustomEvent']['bind'](this));ami['on'](_0x062c('0x22'),this[_0x062c('0x1d')][_0x062c('0x1f')](this));ami['on'](_0x062c('0x23'),this[_0x062c('0x1d')]['bind'](this));ami['on'](_0x062c('0x24'),this[_0x062c('0x1d')]['bind'](this));ami['on'](_0x062c('0x25'),this[_0x062c('0x1d')]['bind'](this));ami['on'](_0x062c('0x26'),this[_0x062c('0x1d')][_0x062c('0x1f')](this));ami['on'](_0x062c('0x27'),this[_0x062c('0x28')][_0x062c('0x1f')](this));ami['on'](_0x062c('0x29'),this[_0x062c('0x28')][_0x062c('0x1f')](this));ami['on'](_0x062c('0x2a'),this[_0x062c('0x28')][_0x062c('0x1f')](this));ami['on'](_0x062c('0x2b'),this[_0x062c('0x1d')]['bind'](this));ami['on'](_0x062c('0x2c'),this[_0x062c('0x1d')][_0x062c('0x1f')](this));ami['on'](_0x062c('0x2d'),this[_0x062c('0x1d')][_0x062c('0x1f')](this));ami['on'](_0x062c('0x2e'),this['syncCustomEvent'][_0x062c('0x1f')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent']['bind'](this));ami['on']('custom:rejectmessage',this['syncCustomEvent'][_0x062c('0x1f')](this));}Trigger[_0x062c('0x2f')][_0x062c('0x30')]=function(_0x2161e2,_0xefe41d,_0x310c28){logger[_0x062c('0x31')](_0x2161e2,_0xefe41d,JSON[_0x062c('0x32')](_0x310c28));io['to'](_0x2161e2)['emit'](_0xefe41d,_0x310c28);};Trigger[_0x062c('0x2f')][_0x062c('0x1d')]=function(_0x298757){var _0x452b92=_[_0x062c('0x33')](_0x298757);this[_0x062c('0x34')](_0x452b92);};Trigger[_0x062c('0x2f')][_0x062c('0x28')]=function(_0x4ecfa3){if(this['agents'][_0x4ecfa3[_0x062c('0x35')]]){this[_0x062c('0x1d')](_0x4ecfa3);}};Trigger[_0x062c('0x2f')][_0x062c('0x34')]=function(_0x540d78){var _0x5b55f3;for(var _0x194ffc in this[_0x062c('0xc')]){if(this[_0x062c('0xc')][_0x062c('0x36')](_0x194ffc)){if(this[_0x062c('0xc')][_0x194ffc][_0x062c('0x37')]){_0x5b55f3=this[_0x062c('0x38')](this['triggers'][_0x194ffc],_0x540d78);if(_0x5b55f3){_['merge'](_0x540d78,_0x540d78[_0x062c('0x39')]);for(var _0x3b41ea=0x0,_0x489839,_0x711d9c,_0x34f2a9;_0x3b41ea0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file +var _0xa9e0=['Getting\x20agent\x20with\x20email','format','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','work','length','map','forEach','type','string','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','Motion','CTI','Tags','Descriptions','user','Fields','%s/customers/%d/cases','POST','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','validateEmail','info'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var md5=require(_0x0a9e('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a9e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));config[_0x0a9e('0x6')]=_[_0x0a9e('0x7')](config[_0x0a9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0x8'))(new Redis(config[_0x0a9e('0x6')]));function emit(_0x2cc193,_0x5f41ea,_0x503809){io['to'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea,_0x503809);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x39753a,_0xf81284){if(intUtil[_0x0a9e('0xa')](_0xf81284)===!![]){logger[_0x0a9e('0xb')](_0x0a9e('0xc'),_0xf81284);return request({'uri':util[_0x0a9e('0xd')]('%s/users',_0x39753a['remoteUri'])})['then'](function(_0x4cfe67){if(_0x4cfe67[_0x0a9e('0xe')]){return _[_0x0a9e('0xf')](_0x4cfe67[_0x0a9e('0x10')][_0x0a9e('0x11')],{'email':_0xf81284});}})[_0x0a9e('0x12')](function(_0x69aeb7){if(_0x69aeb7){logger['info'](_0x0a9e('0x13'));return _0x69aeb7;}else{logger[_0x0a9e('0xb')](_0x0a9e('0x14'));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x15'),_0x39753a[_0x0a9e('0x16')])});}});}else{logger['info'](_0x0a9e('0x17'));return request({'uri':util['format'](_0x0a9e('0x15'),_0x39753a['remoteUri'])});}}function request(_0x16033c){logger[_0x0a9e('0x18')]('[HTTP]',JSON[_0x0a9e('0x19')](_0x16033c));return rp(_['defaults'](_0x16033c,{'method':_0x0a9e('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x478723){var _0x106033;if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x1c')){_0x106033=util[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x1f')]);}else if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x20')){_0x106033=util[_0x0a9e('0xd')]('%s/token:%s',_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x20')]);}return util['format'](_0x0a9e('0x21'),new Buffer(_0x106033)['toString']('base64'));}function getEndUser(_0x3a02e1,_0x432e56,_0x38e7c4){logger[_0x0a9e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x38e7c4);return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x22'),_0x3a02e1[_0x0a9e('0x16')]),'qs':{'phone':_0x38e7c4}})[_0x0a9e('0x12')](function(_0x370d86){if(_0x370d86[_0x0a9e('0xe')]){logger[_0x0a9e('0xb')]('Enduser\x20found!');return _0x370d86['_embedded'][_0x0a9e('0x11')][0x0];}else{logger[_0x0a9e('0xb')](_0x0a9e('0x23'));return request({'uri':util[_0x0a9e('0xd')]('%s/customers',_0x3a02e1[_0x0a9e('0x16')]),'method':'POST','body':{'first_name':_0x432e56,'title':_0x432e56,'phone_numbers':[{'type':_0x0a9e('0x24'),'value':_0x38e7c4}]}});}});}function getTags(_0x5bfb33,_0x1dc186){var _0x34dc65=[];if(_0x5bfb33&&_0x5bfb33[_0x0a9e('0x25')]>0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 5af1f50..da5e449 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 _0xe453=['recordingFormat',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','redis','localhost','POST','clientId','username','password','then','catch','error',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','userId','systemuserid','internalemailaddress','toLowerCase','outbound','contacts','odata-entityid','substring','lastIndexOf','contacts?$select=telephone1','destcalleridnum','calleridnum','telephone1','enduserId','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','nameField','customField','idField','indexOf','ticketType','incident','incidents','Subjects','/systemusers(','Fields','phonecall','phonecalls','getString','Descriptions','/contacts(','queue','callDirection','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','remoteUri','serverUrl','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe453,0x1ea));var _0x3e45=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe453[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x3e45('0x0'));var BPromise=require('bluebird');var rp=require(_0x3e45('0x1'));var util=require(_0x3e45('0x2'));var intUtil=require(_0x3e45('0x3'));var md5=require(_0x3e45('0x4'));var Redis=require(_0x3e45('0x5'));var logger=require(_0x3e45('0x6'))('dynamics365');var config=require('../../../../config/environment');config['redis']=_['defaults'](config[_0x3e45('0x7')],{'host':_0x3e45('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3e45('0x7')]));function getAuthToken(_0x20b153,_0x46f5ee,_0x1b1614){var _0x56536a={'method':_0x3e45('0x9'),'uri':_0x46f5ee,'form':{'client_id':_0x20b153[_0x3e45('0xa')],'resource':_0x20b153['remoteUri'],'username':_0x20b153[_0x3e45('0xb')],'password':_0x20b153[_0x3e45('0xc')],'grant_type':_0x3e45('0xc'),'client_secret':_0x20b153['clientSecret']},'json':!![]};return rp(_0x56536a)[_0x3e45('0xd')](function(_0xdc355){return _0xdc355['access_token'];})[_0x3e45('0xe')](function(_0x45617a){logger[_0x3e45('0xf')]('['+[_0x1b1614['toUpperCase']()]+_0x3e45('0x10'));return _0x45617a[_0x3e45('0x11')];});}function getUser(_0x3f4db9,_0x1d6de6,_0x267d4e,_0x53b9db,_0x5c045d,_0x9a8883){return new BPromise(function(_0x4bceb8,_0x3f4736){return getAuthToken(_0x1d6de6,_0x53b9db,_0x9a8883)[_0x3e45('0xd')](function(_0x164f2b){var _0xe7d156={'method':_0x3e45('0x12'),'uri':_0x5c045d+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x3e45('0x13')+_0x164f2b,'OData-Version':_0x3e45('0x14')},'json':!![]};return rp(_0xe7d156);})[_0x3e45('0xd')](function(_0x224556){var _0x2049f0=_0x224556[_0x3e45('0x15')];var _0x7c5490=![];var _0x29c852=null;if(!_[_0x3e45('0x16')](_0x267d4e)){if(intUtil[_0x3e45('0x17')](_0x267d4e[_0x3e45('0x18')])){_0x3f4db9[_0x3e45('0x19')]=_0x267d4e['email'];for(_0x29c852=0x0;_0x29c852<_0x2049f0[_0x3e45('0x1a')];_0x29c852++){if(_0x2049f0[_0x29c852]['internalemailaddress']===_0x267d4e[_0x3e45('0x18')]&&!_0x2049f0[_0x29c852][_0x3e45('0x1b')]){_0x7c5490=!![];logger[_0x3e45('0x1c')]('['+[_0x9a8883[_0x3e45('0x1d')]()]+_0x3e45('0x1e')+_0x2049f0[_0x29c852]['systemuserid']+'!');_0x3f4db9[_0x3e45('0x1f')]=_0x2049f0[_0x29c852][_0x3e45('0x20')];}}}}if(!_0x7c5490){logger[_0x3e45('0x1c')]('['+[_0x9a8883[_0x3e45('0x1d')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x3f4db9[_0x3e45('0x19')]=_0x1d6de6[_0x3e45('0xb')];for(_0x29c852=0x0;_0x29c852<_0x2049f0[_0x3e45('0x1a')];_0x29c852++){if(_0x2049f0[_0x29c852][_0x3e45('0x21')]===_0x1d6de6['username']){_0x3f4db9['userId']=_0x2049f0[_0x29c852]['systemuserid'];}}}_0x4bceb8(_0x3f4db9);})[_0x3e45('0xe')](function(_0xbf640a){_0x3f4736(_0xbf640a[_0x3e45('0x11')]);});});}function createEndUser(_0x411e79,_0x1b8b2e,_0x1e151d,_0x520c6a,_0x2280bc,_0x20292b){return new BPromise(function(_0x5cfedb,_0x1755e5){return getAuthToken(_0x1b8b2e,_0x1e151d,_0x20292b)[_0x3e45('0xd')](function(_0x1d783b){var _0x1e9ba2=_0x20292b[_0x3e45('0x22')]()===_0x3e45('0x23')?_0x2280bc['destcalleridnum']:_0x2280bc['calleridnum'];var _0x2e2bec={'method':_0x3e45('0x9'),'uri':_0x520c6a+_0x3e45('0x24'),'body':{'telephone1':_0x1e9ba2,'fullname':_0x1e9ba2,'firstname':_0x1e9ba2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x411e79[_0x3e45('0x1f')]+')'},'headers':{'Authorization':_0x3e45('0x13')+_0x1d783b,'OData-Version':_0x3e45('0x14')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2e2bec);})[_0x3e45('0xd')](function(_0x509d3a){var _0x4eaa75=_0x509d3a['headers'][_0x3e45('0x25')];var _0x5622fb=_0x4eaa75[_0x3e45('0x26')](_0x4eaa75['lastIndexOf']('(')+0x1,_0x4eaa75[_0x3e45('0x27')](')'));_0x411e79['enduserId']=_0x5622fb;_0x5cfedb(_0x411e79);})[_0x3e45('0xe')](function(_0x4e2893){_0x1755e5(_0x4e2893['message']);});});}function getEndUser(_0x4b7486,_0x8dc655,_0x5b8c77,_0x29bdfb,_0x22f31d,_0x508f91){return new BPromise(function(_0x21d097,_0x9e0264){return getAuthToken(_0x8dc655,_0x5b8c77,_0x508f91)[_0x3e45('0xd')](function(_0x191832){var _0x40172c={'method':_0x3e45('0x12'),'uri':_0x29bdfb+_0x3e45('0x28'),'headers':{'Authorization':_0x3e45('0x13')+_0x191832,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x40172c);})[_0x3e45('0xd')](function(_0x5d5cc3){var _0x15fe24=null;if(_0x5d5cc3){var _0x149e03=_0x5d5cc3[_0x3e45('0x15')];var _0x5f41cf=![];for(_0x15fe24=0x0;_0x15fe24<_0x149e03['length'];_0x15fe24++){var _0x41f668=_0x508f91[_0x3e45('0x22')]()===_0x3e45('0x23')?_0x22f31d[_0x3e45('0x29')]:_0x22f31d[_0x3e45('0x2a')];if(_0x149e03[_0x15fe24][_0x3e45('0x2b')]===_0x41f668){_0x5f41cf=!![];_0x4b7486[_0x3e45('0x2c')]=_0x149e03[_0x15fe24][_0x3e45('0x2d')];}}if(_0x5f41cf){_0x21d097(_0x4b7486);}else{return createEndUser(_0x4b7486,_0x8dc655,_0x5b8c77,_0x29bdfb,_0x22f31d,_0x508f91)['then'](function(_0xa0099a){logger[_0x3e45('0x1c')]('['+[_0x508f91[_0x3e45('0x1d')]()]+_0x3e45('0x2e'),_0xa0099a['enduserId']);_0x21d097(_0xa0099a);});}}else{return createEndUser(_0x4b7486,_0x8dc655,_0x5b8c77,_0x29bdfb,_0x22f31d,_0x508f91)[_0x3e45('0xd')](function(_0x180077){logger['info']('['+[_0x508f91[_0x3e45('0x1d')]()]+_0x3e45('0x2f'),_0x180077[_0x3e45('0x2c')]);_0x21d097(_0x180077);});}});});}function getCustomFields(_0x5d3f7a,_0xf26ea0,_0x196fd1){var _0x5444a0={};if(_0x5d3f7a[_0x3e45('0x1a')]>0x0){_[_0x3e45('0x30')](_0x5d3f7a,function(_0x4ddf66){if(_0x4ddf66[_0x3e45('0x31')]===_0x3e45('0x32')&&_0x4ddf66[_0x3e45('0x33')]&&!_0x4ddf66[_0x3e45('0x34')]){var _0x4cc933=_0x4ddf66[_0x3e45('0x35')][_0x3e45('0x22')]();var _0x5d6991=_0x4cc933[_0x3e45('0x26')](0x0,_0x4cc933['indexOf']('_'));var _0x2f0040=_0x4cc933[_0x3e45('0x26')](_0x4cc933[_0x3e45('0x36')]('_')+0x1);if(_0x5d6991===_0x196fd1){_0x5444a0[_0x2f0040]=_0x4ddf66['content'];}}});}return _0x5444a0;}function getTicket(_0x369ac5,_0x5437f0,_0x1a50b3,_0x112ad2,_0x32da57,_0x4f96fe,_0x299587){return new BPromise(function(_0x4dc7a3,_0x5cb994){var _0x3a1938;return getAuthToken(_0x5437f0,_0x1a50b3,_0x299587)['then'](function(_0x184bf7){if(_0x4f96fe[_0x3e45('0x37')]===_0x3e45('0x38')){_0x3a1938={'method':'POST','uri':_0x112ad2+_0x3e45('0x39'),'body':Object['assign']({},{'title':intUtil['getString'](_0x4f96fe[_0x3e45('0x3a')],_0x32da57,'\x20'),'description':intUtil['getString'](_0x4f96fe['Descriptions'],_0x32da57,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x369ac5[_0x3e45('0x2c')]+')','ownerid@odata.bind':_0x3e45('0x3b')+_0x369ac5[_0x3e45('0x1f')]+')','caseorigincode':'1'},getCustomFields(_0x4f96fe[_0x3e45('0x3c')],_0x32da57,_0x4f96fe[_0x3e45('0x37')])),'headers':{'Authorization':_0x3e45('0x13')+_0x184bf7,'OData-Version':_0x3e45('0x14')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4f96fe['ticketType']===_0x3e45('0x3d')){_0x3a1938={'method':'POST','uri':_0x112ad2+_0x3e45('0x3e'),'body':Object['assign']({},{'subject':intUtil[_0x3e45('0x3f')](_0x4f96fe[_0x3e45('0x3a')],_0x32da57,'\x20'),'phonenumber':String(_0x32da57[_0x3e45('0x2a')]),'description':intUtil[_0x3e45('0x3f')](_0x4f96fe[_0x3e45('0x40')],_0x32da57,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3e45('0x41')+_0x369ac5[_0x3e45('0x2c')]+')','ownerid@odata.bind':_0x3e45('0x3b')+_0x369ac5[_0x3e45('0x1f')]+')','directioncode':_0x369ac5['callDirection']===_0x3e45('0x42')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x3e45('0x3b')+_0x369ac5[_0x3e45('0x1f')]+')','participationtypemask':_0x369ac5[_0x3e45('0x43')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x3e45('0x41')+_0x369ac5[_0x3e45('0x2c')]+')','participationtypemask':_0x369ac5[_0x3e45('0x43')]===_0x3e45('0x42')?0x1:0x2}]},getCustomFields(_0x4f96fe[_0x3e45('0x3c')],_0x32da57,_0x4f96fe[_0x3e45('0x37')])),'headers':{'Authorization':'Bearer\x20'+_0x184bf7,'OData-Version':_0x3e45('0x14')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3a1938);})[_0x3e45('0xd')](function(_0x59cb1a){var _0x1dd363=_0x59cb1a[_0x3e45('0x44')][_0x3e45('0x25')];var _0x3d6a1d=_0x1dd363[_0x3e45('0x26')](_0x1dd363[_0x3e45('0x27')]('(')+0x1,_0x1dd363[_0x3e45('0x27')](')'));_0x369ac5[_0x3e45('0x45')]=_0x3d6a1d;_0x4dc7a3(_0x369ac5);})[_0x3e45('0xe')](function(_0x4ae821){_0x5cb994(_0x4ae821[_0x3e45('0x11')]);});});}function emit(_0x5d05f0,_0x5ad152,_0x500d0b,_0x37cb4c){var _0x5058dc={'uri':util[_0x3e45('0x46')](_0x3e45('0x47'),_0x5d05f0,_0x500d0b,_0x37cb4c)};io['to'](util['format'](_0x3e45('0x48'),_0x5ad152))[_0x3e45('0x49')]('trigger:browser:url',_0x5058dc);}exports['cs']=function(_0xb7257,_0x4ca0f7,_0x451738,_0x348be4,_0x36a64b,_0x77d08f,_0x3c2509,_0x3e917b){var _0x1f1502={};_0x77d08f[_0x3e45('0x4a')]=intUtil['stripTrailingSlash'](_0x77d08f[_0x3e45('0x4a')]);_0x77d08f[_0x3e45('0x4b')]=intUtil[_0x3e45('0x4c')](_0x77d08f['serverUrl']);_0x1f1502[_0x3e45('0x43')]=_0x3e917b===_0x3e45('0x42')||_0x3e917b===_0x3e45('0x4d')?_0x3e45('0x42'):_0x3e45('0x23');var _0x516969=util[_0x3e45('0x46')](_0x3e45('0x4e'),_0x77d08f[_0x3e45('0x4a')]);var _0x34e3eb=util['format'](_0x3e45('0x4f'),_0x77d08f[_0x3e45('0x50')]);var _0x2868d6=util[_0x3e45('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x77d08f['serverUrl'],_0x4ca0f7['uniqueid'],md5(_0x4ca0f7[_0x3e45('0x51')]));if(_0x36a64b&&_0x36a64b[_0x3e45('0x52')]){logger[_0x3e45('0x1c')](_0x3e45('0x53'),_0x3e45('0x54'));_0x4ca0f7[_0x3e45('0x55')]=_0x2868d6;}else if(_0x3c2509&&_0x3c2509[_0x3e45('0x56')]&&_0x3c2509[_0x3e45('0x56')]!=='none'){logger['info']('[OUTBOUND]',_0x3e45('0x54'));_0x4ca0f7[_0x3e45('0x55')]=_0x2868d6;}else{_0x4ca0f7[_0x3e45('0x55')]='';}return getUser(_0x1f1502,_0x77d08f,_0x348be4,_0x34e3eb,_0x516969,_0x3e917b)[_0x3e45('0xd')](function(_0x4d5f50){logger[_0x3e45('0x1c')]('['+_0x3e917b[_0x3e45('0x1d')]()+_0x3e45('0x57'),_0x4d5f50[_0x3e45('0x1f')]);logger['info']('['+_0x3e917b['toUpperCase']()+_0x3e45('0x58'),_0x4d5f50[_0x3e45('0x19')]);return getEndUser(_0x4d5f50,_0x77d08f,_0x34e3eb,_0x516969,_0x4ca0f7,_0x3e917b);})[_0x3e45('0xd')](function(_0x1b9640){logger[_0x3e45('0x1c')]('['+_0x3e917b[_0x3e45('0x1d')]()+_0x3e45('0x59'),_0x1b9640['enduserId']);logger['info']('['+_0x3e917b[_0x3e45('0x1d')]()+_0x3e45('0x5a'),_0x4ca0f7[_0x3e45('0x2a')]);return getTicket(_0x1b9640,_0x77d08f,_0x34e3eb,_0x516969,_0x4ca0f7,_0x451738,_0x3e917b);})[_0x3e45('0xd')](function(_0x576b6a){logger['info'](util[_0x3e45('0x46')]('['+_0x3e917b[_0x3e45('0x1d')]()+_0x3e45('0x5b'),_0x451738['ticketType'],_0x576b6a[_0x3e45('0x45')]));logger[_0x3e45('0x1c')](util[_0x3e45('0x46')]('['+_0x3e917b[_0x3e45('0x1d')]()+_0x3e45('0x5c'),_0x3e917b));if(_0x3e917b!=='unmanaged'){logger[_0x3e45('0x1c')]('['+_0x3e917b[_0x3e45('0x1d')]()+']',_0x3e45('0x5d'));emit(_0x77d08f[_0x3e45('0x4a')],_0x348be4[_0x3e45('0x5e')],_0x451738['ticketType'],_0x576b6a[_0x3e45('0x45')]);}})['catch'](function(_0x155158){logger[_0x3e45('0xf')]('['+_0x3e917b[_0x3e45('0x1d')]()+_0x3e45('0x5f'),util['inspect'](_0x155158,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe903=['string','nameField','customField','idField','indexOf','ticketType','incidents','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','Bearer\x20','phonecall','phonecalls','callDirection','queue','ticketId','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','../../../../config/logger','redis','socket.io-emitter','POST','clientId','remoteUri','password','clientSecret','then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','value','isNil','validateEmail','email','userEmail','internalemailaddress','isdisabled','info','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','username','toLowerCase','destcalleridnum','calleridnum','contacts','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','4.0','outbound','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xe903,0x13e));var _0x3e90=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xe903[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x3e90('0x0'));var BPromise=require(_0x3e90('0x1'));var rp=require(_0x3e90('0x2'));var util=require(_0x3e90('0x3'));var intUtil=require(_0x3e90('0x4'));var md5=require(_0x3e90('0x5'));var Redis=require('ioredis');var logger=require(_0x3e90('0x6'))('dynamics365');var config=require('../../../../config/environment');config['redis']=_['defaults'](config[_0x3e90('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x3e90('0x8'))(new Redis(config['redis']));function getAuthToken(_0x4ca325,_0x2fa610,_0x4904ac){var _0x2d4267={'method':_0x3e90('0x9'),'uri':_0x2fa610,'form':{'client_id':_0x4ca325[_0x3e90('0xa')],'resource':_0x4ca325[_0x3e90('0xb')],'username':_0x4ca325['username'],'password':_0x4ca325[_0x3e90('0xc')],'grant_type':_0x3e90('0xc'),'client_secret':_0x4ca325[_0x3e90('0xd')]},'json':!![]};return rp(_0x2d4267)[_0x3e90('0xe')](function(_0x10c3a4){return _0x10c3a4['access_token'];})[_0x3e90('0xf')](function(_0x31d581){logger[_0x3e90('0x10')]('['+[_0x4904ac[_0x3e90('0x11')]()]+_0x3e90('0x12'));return _0x31d581[_0x3e90('0x13')];});}function getUser(_0x29e51e,_0x4f9113,_0x182712,_0x43dedd,_0x4b093a,_0x5ba8d8){return new BPromise(function(_0x52e4e3,_0x37e76d){return getAuthToken(_0x4f9113,_0x43dedd,_0x5ba8d8)[_0x3e90('0xe')](function(_0x5f2e13){var _0x1ef665={'method':_0x3e90('0x14'),'uri':_0x4b093a+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x5f2e13,'OData-Version':'4.0'},'json':!![]};return rp(_0x1ef665);})[_0x3e90('0xe')](function(_0x538ce6){var _0x2b8b39=_0x538ce6[_0x3e90('0x15')];var _0x318688=![];var _0x4693ad=null;if(!_[_0x3e90('0x16')](_0x182712)){if(intUtil[_0x3e90('0x17')](_0x182712[_0x3e90('0x18')])){_0x29e51e[_0x3e90('0x19')]=_0x182712['email'];for(_0x4693ad=0x0;_0x4693ad<_0x2b8b39['length'];_0x4693ad++){if(_0x2b8b39[_0x4693ad][_0x3e90('0x1a')]===_0x182712['email']&&!_0x2b8b39[_0x4693ad][_0x3e90('0x1b')]){_0x318688=!![];logger[_0x3e90('0x1c')]('['+[_0x5ba8d8[_0x3e90('0x11')]()]+']\x20Agent\x20found\x20'+_0x2b8b39[_0x4693ad]['systemuserid']+'!');_0x29e51e[_0x3e90('0x1d')]=_0x2b8b39[_0x4693ad]['systemuserid'];}}}}if(!_0x318688){logger[_0x3e90('0x1c')]('['+[_0x5ba8d8[_0x3e90('0x11')]()]+_0x3e90('0x1e'));_0x29e51e[_0x3e90('0x19')]=_0x4f9113['username'];for(_0x4693ad=0x0;_0x4693ad<_0x2b8b39[_0x3e90('0x1f')];_0x4693ad++){if(_0x2b8b39[_0x4693ad][_0x3e90('0x1a')]===_0x4f9113[_0x3e90('0x20')]){_0x29e51e[_0x3e90('0x1d')]=_0x2b8b39[_0x4693ad]['systemuserid'];}}}_0x52e4e3(_0x29e51e);})[_0x3e90('0xf')](function(_0x1fcc92){_0x37e76d(_0x1fcc92[_0x3e90('0x13')]);});});}function createEndUser(_0x4e8cc6,_0x1be32e,_0x13c561,_0x5813e3,_0x1f327a,_0xd04d2f){return new BPromise(function(_0x2746f2,_0x506421){return getAuthToken(_0x1be32e,_0x13c561,_0xd04d2f)['then'](function(_0x202969){var _0x4bfd4d=_0xd04d2f[_0x3e90('0x21')]()==='outbound'?_0x1f327a[_0x3e90('0x22')]:_0x1f327a[_0x3e90('0x23')];var _0x6108b7={'method':_0x3e90('0x9'),'uri':_0x5813e3+_0x3e90('0x24'),'body':{'telephone1':_0x4bfd4d,'fullname':_0x4bfd4d,'firstname':_0x4bfd4d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x4e8cc6['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x202969,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x6108b7);})['then'](function(_0x5d4e44){var _0xdefec0=_0x5d4e44[_0x3e90('0x25')][_0x3e90('0x26')];var _0x321576=_0xdefec0[_0x3e90('0x27')](_0xdefec0[_0x3e90('0x28')]('(')+0x1,_0xdefec0['lastIndexOf'](')'));_0x4e8cc6[_0x3e90('0x29')]=_0x321576;_0x2746f2(_0x4e8cc6);})[_0x3e90('0xf')](function(_0x27f59c){_0x506421(_0x27f59c[_0x3e90('0x13')]);});});}function getEndUser(_0x3ba384,_0x289f8a,_0x3b5ab8,_0x16d862,_0x365da3,_0x26f07d){return new BPromise(function(_0x3a0211,_0x2d4034){return getAuthToken(_0x289f8a,_0x3b5ab8,_0x26f07d)[_0x3e90('0xe')](function(_0x3e1502){var _0x29a0c0={'method':_0x3e90('0x14'),'uri':_0x16d862+_0x3e90('0x2a'),'headers':{'Authorization':'Bearer\x20'+_0x3e1502,'If-None-Match':null,'OData-Version':_0x3e90('0x2b')},'json':!![]};return rp(_0x29a0c0);})[_0x3e90('0xe')](function(_0xf4212f){var _0x24c7cd=null;if(_0xf4212f){var _0x181146=_0xf4212f[_0x3e90('0x15')];var _0x2195e8=![];for(_0x24c7cd=0x0;_0x24c7cd<_0x181146['length'];_0x24c7cd++){var _0x459848=_0x26f07d['toLowerCase']()===_0x3e90('0x2c')?_0x365da3[_0x3e90('0x22')]:_0x365da3[_0x3e90('0x23')];if(_0x181146[_0x24c7cd][_0x3e90('0x2d')]===_0x459848){_0x2195e8=!![];_0x3ba384['enduserId']=_0x181146[_0x24c7cd][_0x3e90('0x2e')];}}if(_0x2195e8){_0x3a0211(_0x3ba384);}else{return createEndUser(_0x3ba384,_0x289f8a,_0x3b5ab8,_0x16d862,_0x365da3,_0x26f07d)[_0x3e90('0xe')](function(_0x2b2501){logger[_0x3e90('0x1c')]('['+[_0x26f07d['toUpperCase']()]+_0x3e90('0x2f'),_0x2b2501[_0x3e90('0x29')]);_0x3a0211(_0x2b2501);});}}else{return createEndUser(_0x3ba384,_0x289f8a,_0x3b5ab8,_0x16d862,_0x365da3,_0x26f07d)[_0x3e90('0xe')](function(_0x55d0ed){logger[_0x3e90('0x1c')]('['+[_0x26f07d[_0x3e90('0x11')]()]+_0x3e90('0x30'),_0x55d0ed[_0x3e90('0x29')]);_0x3a0211(_0x55d0ed);});}});});}function getCustomFields(_0x1ad12c,_0xa514f9,_0x1db7fa){var _0x8edc3a={};if(_0x1ad12c[_0x3e90('0x1f')]>0x0){_[_0x3e90('0x31')](_0x1ad12c,function(_0x34923b){if(_0x34923b['type']===_0x3e90('0x32')&&_0x34923b[_0x3e90('0x33')]&&!_0x34923b[_0x3e90('0x34')]){var _0x4a2aa8=_0x34923b[_0x3e90('0x35')][_0x3e90('0x21')]();var _0x2a651c=_0x4a2aa8['substring'](0x0,_0x4a2aa8[_0x3e90('0x36')]('_'));var _0x49906f=_0x4a2aa8[_0x3e90('0x27')](_0x4a2aa8[_0x3e90('0x36')]('_')+0x1);if(_0x2a651c===_0x1db7fa){_0x8edc3a[_0x49906f]=_0x34923b['content'];}}});}return _0x8edc3a;}function getTicket(_0x4e9a5e,_0x21496f,_0x528701,_0x24b4a6,_0x5ccab8,_0x290f59,_0x56ae38){return new BPromise(function(_0x5530ad,_0x3db79c){var _0x56d819;return getAuthToken(_0x21496f,_0x528701,_0x56ae38)[_0x3e90('0xe')](function(_0x45ae73){if(_0x290f59[_0x3e90('0x37')]==='incident'){_0x56d819={'method':_0x3e90('0x9'),'uri':_0x24b4a6+_0x3e90('0x38'),'body':Object['assign']({},{'title':intUtil[_0x3e90('0x39')](_0x290f59[_0x3e90('0x3a')],_0x5ccab8,'\x20'),'description':intUtil[_0x3e90('0x39')](_0x290f59[_0x3e90('0x3b')],_0x5ccab8,'\x0a'),'customerid_contact@odata.bind':_0x3e90('0x3c')+_0x4e9a5e['enduserId']+')','ownerid@odata.bind':_0x3e90('0x3d')+_0x4e9a5e[_0x3e90('0x1d')]+')','caseorigincode':'1'},getCustomFields(_0x290f59[_0x3e90('0x3e')],_0x5ccab8,_0x290f59[_0x3e90('0x37')])),'headers':{'Authorization':_0x3e90('0x3f')+_0x45ae73,'OData-Version':_0x3e90('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x290f59[_0x3e90('0x37')]===_0x3e90('0x40')){_0x56d819={'method':'POST','uri':_0x24b4a6+_0x3e90('0x41'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x290f59[_0x3e90('0x3a')],_0x5ccab8,'\x20'),'phonenumber':String(_0x5ccab8[_0x3e90('0x23')]),'description':intUtil[_0x3e90('0x39')](_0x290f59['Descriptions'],_0x5ccab8,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3e90('0x3c')+_0x4e9a5e[_0x3e90('0x29')]+')','ownerid@odata.bind':'/systemusers('+_0x4e9a5e[_0x3e90('0x1d')]+')','directioncode':_0x4e9a5e[_0x3e90('0x42')]===_0x3e90('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x3e90('0x3d')+_0x4e9a5e[_0x3e90('0x1d')]+')','participationtypemask':_0x4e9a5e[_0x3e90('0x42')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x3e90('0x3c')+_0x4e9a5e['enduserId']+')','participationtypemask':_0x4e9a5e[_0x3e90('0x42')]===_0x3e90('0x43')?0x1:0x2}]},getCustomFields(_0x290f59[_0x3e90('0x3e')],_0x5ccab8,_0x290f59[_0x3e90('0x37')])),'headers':{'Authorization':'Bearer\x20'+_0x45ae73,'OData-Version':_0x3e90('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x56d819);})[_0x3e90('0xe')](function(_0x55de4){var _0x2f4b8d=_0x55de4['headers']['odata-entityid'];var _0x14d8a7=_0x2f4b8d[_0x3e90('0x27')](_0x2f4b8d[_0x3e90('0x28')]('(')+0x1,_0x2f4b8d[_0x3e90('0x28')](')'));_0x4e9a5e[_0x3e90('0x44')]=_0x14d8a7;_0x5530ad(_0x4e9a5e);})[_0x3e90('0xf')](function(_0x4915a1){_0x3db79c(_0x4915a1[_0x3e90('0x13')]);});});}function emit(_0x15818f,_0x1c8dc5,_0x67ddc2,_0x34043e){var _0x3732c4={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x15818f,_0x67ddc2,_0x34043e)};io['to'](util[_0x3e90('0x45')](_0x3e90('0x46'),_0x1c8dc5))['emit'](_0x3e90('0x47'),_0x3732c4);}exports['cs']=function(_0x31605b,_0x55011f,_0x3572af,_0x3d7557,_0x20e96f,_0x2b6bac,_0x5db7d2,_0x20de85){var _0xef70e={};_0x2b6bac[_0x3e90('0xb')]=intUtil[_0x3e90('0x48')](_0x2b6bac[_0x3e90('0xb')]);_0x2b6bac[_0x3e90('0x49')]=intUtil[_0x3e90('0x48')](_0x2b6bac['serverUrl']);_0xef70e[_0x3e90('0x42')]=_0x20de85===_0x3e90('0x43')||_0x20de85===_0x3e90('0x4a')?'queue':_0x3e90('0x2c');var _0x46b2ef=util[_0x3e90('0x45')](_0x3e90('0x4b'),_0x2b6bac['remoteUri']);var _0x126ca6=util[_0x3e90('0x45')](_0x3e90('0x4c'),_0x2b6bac[_0x3e90('0x4d')]);var _0x1ea41e=util[_0x3e90('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b6bac[_0x3e90('0x49')],_0x55011f[_0x3e90('0x4e')],md5(_0x55011f['uniqueid']));if(_0x20e96f&&_0x20e96f[_0x3e90('0x4f')]){logger[_0x3e90('0x1c')](_0x3e90('0x50'),_0x3e90('0x51'));_0x55011f[_0x3e90('0x52')]=_0x1ea41e;}else if(_0x5db7d2&&_0x5db7d2[_0x3e90('0x53')]&&_0x5db7d2[_0x3e90('0x53')]!==_0x3e90('0x54')){logger[_0x3e90('0x1c')](_0x3e90('0x55'),_0x3e90('0x51'));_0x55011f[_0x3e90('0x52')]=_0x1ea41e;}else{_0x55011f[_0x3e90('0x52')]='';}return getUser(_0xef70e,_0x2b6bac,_0x3d7557,_0x126ca6,_0x46b2ef,_0x20de85)['then'](function(_0x1f3296){logger[_0x3e90('0x1c')]('['+_0x20de85['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x1f3296[_0x3e90('0x1d')]);logger['info']('['+_0x20de85[_0x3e90('0x11')]()+']\x20The\x20User\x20email\x20is:',_0x1f3296[_0x3e90('0x19')]);return getEndUser(_0x1f3296,_0x2b6bac,_0x126ca6,_0x46b2ef,_0x55011f,_0x20de85);})['then'](function(_0x3de6ea){logger['info']('['+_0x20de85[_0x3e90('0x11')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x3de6ea[_0x3e90('0x29')]);logger[_0x3e90('0x1c')]('['+_0x20de85[_0x3e90('0x11')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x55011f[_0x3e90('0x23')]);return getTicket(_0x3de6ea,_0x2b6bac,_0x126ca6,_0x46b2ef,_0x55011f,_0x3572af,_0x20de85);})[_0x3e90('0xe')](function(_0x5d1326){logger['info'](util['format']('['+_0x20de85[_0x3e90('0x11')]()+_0x3e90('0x56'),_0x3572af['ticketType'],_0x5d1326[_0x3e90('0x44')]));logger[_0x3e90('0x1c')](util[_0x3e90('0x45')]('['+_0x20de85[_0x3e90('0x11')]()+_0x3e90('0x57'),_0x20de85));if(_0x20de85!==_0x3e90('0x4a')){logger[_0x3e90('0x1c')]('['+_0x20de85[_0x3e90('0x11')]()+']',_0x3e90('0x58'));emit(_0x2b6bac[_0x3e90('0xb')],_0x3d7557[_0x3e90('0x59')],_0x3572af[_0x3e90('0x37')],_0x5d1326[_0x3e90('0x44')]);}})['catch'](function(_0x46362f){logger[_0x3e90('0x10')]('['+_0x20de85['toUpperCase']()+_0x3e90('0x5a'),util[_0x3e90('0x5b')](_0x46362f,{'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 b781493..91b9e10 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 _0x771b=['name','Fields','mapValues','value','%s/api/v2/tickets','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','contact','email','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','forEach','type','string','customField','nameField','toLowerCase','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','user:%s','error','lastevent','Authorization','toUpperCase','lodash','request-promise','md5','util','../../../../config/environment','freshdesk','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags'];(function(_0x248fc8,_0x121ebf){var _0x1ec5d1=function(_0x4784fc){while(--_0x4784fc){_0x248fc8['push'](_0x248fc8['shift']());}};_0x1ec5d1(++_0x121ebf);}(_0x771b,0x156));var _0xb771=function(_0x14d269,_0x6517c2){_0x14d269=_0x14d269-0x0;var _0xd0b684=_0x771b[_0x14d269];return _0xd0b684;};'use strict';var _=require(_0xb771('0x0'));var rp=require(_0xb771('0x1'));var md5=require(_0xb771('0x2'));var util=require(_0xb771('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xb771('0x4'));var logger=require('../../../../config/logger')(_0xb771('0x5'));config[_0xb771('0x6')]=_[_0xb771('0x7')](config[_0xb771('0x6')],{'host':_0xb771('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb771('0x6')]));var headers={'Content-Type':_0xb771('0x9'),'Accept':_0xb771('0x9')};function emit(_0xb0e44a,_0xc92108,_0x125e26){io['to'](_0xb0e44a)['emit'](_0xc92108,_0x125e26);}function getTicket(_0x66ebc9,_0x5cd042,_0x5dcd81,_0x13c2fc,_0x12245c){logger[_0xb771('0xa')](_0xb771('0xb'));var _0x9deb1f=_[_0xb771('0xc')]({'responder_id':_0x5cd042['id'],'requester_id':_0x5dcd81['id'],'name':util[_0xb771('0xd')](_0xb771('0xe'),_0x12245c[_0xb771('0xf')]),'phone':_0x12245c[_0xb771('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb771('0x11')](_0x13c2fc[_0xb771('0x12')],_0x12245c,'\x20'),'description':intUtil[_0xb771('0x11')](_0x13c2fc[_0xb771('0x13')],_0x12245c,_0xb771('0x14')),'tags':getTags(_0x13c2fc[_0xb771('0x15')],_0xb771('0x16'))},getCustomFields(_0x13c2fc[_0xb771('0x17')],_0x12245c));_0x9deb1f['custom_fields']=_[_0xb771('0x18')](_['keyBy'](_0x9deb1f['custom_fields'],'id'),_0xb771('0x19'));return request({'uri':util[_0xb771('0xd')](_0xb771('0x1a'),_0x66ebc9['remoteUri']),'method':'POST','body':_0x9deb1f})[_0xb771('0x1b')](function(_0x356820){logger[_0xb771('0xa')](_0xb771('0x1c'));return _0x356820;});}function getUser(_0x3552a4,_0x4e463a){if(intUtil[_0xb771('0x1d')](_0x4e463a)){return request({'uri':util['format'](_0xb771('0x1e'),_0x3552a4[_0xb771('0x1f')]),'qs':{'email':_0x4e463a}})[_0xb771('0x1b')](function(_0x2cf1c2){if(_0x2cf1c2[_0xb771('0x20')]){logger[_0xb771('0xa')](_0xb771('0x21'));return _['find'](_0x2cf1c2,function(_0x331458){return _0x331458[_0xb771('0x22')][_0xb771('0x23')]===_0x4e463a;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb771('0xd')]('%s/api/v2/agents/me',_0x3552a4['remoteUri'])})['then'](function(_0x4abda5){logger[_0xb771('0xa')]('Admin\x20account\x20selected.');return _0x4abda5;});}});}else{logger[_0xb771('0xa')](_0xb771('0x24'));return request({'uri':util[_0xb771('0xd')]('%s/api/v2/agents/me',_0x3552a4[_0xb771('0x1f')])})['then'](function(_0x1dc739){logger[_0xb771('0xa')](_0xb771('0x25'));return _0x1dc739;});}}function getEndUser(_0x52c3b0,_0x52be9e,_0x5e431e){logger['info'](_0xb771('0x26'),_0x5e431e);return request({'uri':util[_0xb771('0xd')]('%s/api/v2/contacts',_0x52c3b0['remoteUri']),'qs':{'phone':_0x5e431e}})['then'](function(_0x45251f){if(_0x45251f[_0xb771('0x20')]){logger[_0xb771('0xa')](_0xb771('0x27'));return _[_0xb771('0x28')](_0x45251f,{'phone':_0x5e431e});}else{logger[_0xb771('0xa')](_0xb771('0x29'));return request({'uri':util['format'](_0xb771('0x2a'),_0x52c3b0[_0xb771('0x1f')]),'method':_0xb771('0x2b'),'body':{'name':_0x52be9e,'phone':_0x5e431e}})['then'](function(_0x4dd0c9){logger[_0xb771('0xa')]('Enduser\x20created.');return _0x4dd0c9;});}});}function getAuth(_0x6bdfc1){return util[_0xb771('0xd')](_0xb771('0x2c'),new Buffer(_0x6bdfc1[_0xb771('0x2d')]+':X')[_0xb771('0x2e')](_0xb771('0x2f')));}function request(_0x3da5e2){logger[_0xb771('0x30')](_0xb771('0x31'),JSON[_0xb771('0x32')](_0x3da5e2));return rp(_[_0xb771('0x7')](_0x3da5e2,{'method':_0xb771('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x316e92,_0x292cc1){var _0x4b1edf=[];if(_0x316e92&&_0x316e92[_0xb771('0x20')]>0x0){_0x4b1edf=_['map'](_0x316e92,_0x292cc1);}return _0x4b1edf;}function getCustomFields(_0x1d130c,_0x2a8067){var _0x24138d=[];var _0x5316d6={'custom_fields':[]};if(_0x1d130c[_0xb771('0x20')]>0x0){_[_0xb771('0x34')](_0x1d130c,function(_0x59b28c){if(_0x59b28c[_0xb771('0x35')]===_0xb771('0x36')&&_0x59b28c['nameField']&&!_0x59b28c[_0xb771('0x37')]){_0x5316d6[_0x59b28c[_0xb771('0x38')][_0xb771('0x39')]()]=_0x59b28c['content'][_0xb771('0x2e')]();}else if(_0x59b28c[_0xb771('0x35')]===_0xb771('0x36')&&_0x59b28c[_0xb771('0x3a')]&&_0x59b28c[_0xb771('0x37')]){_0x5316d6[_0xb771('0x3b')][_0xb771('0x3c')]({'id':_0x59b28c[_0xb771('0x3a')],'value':_0x59b28c[_0xb771('0x3d')]['toString']()});}else if(_0x59b28c[_0xb771('0x35')]===_0xb771('0x3e')&&_0x59b28c[_0xb771('0x3f')]&&_0x59b28c[_0xb771('0x3a')]&&_0x59b28c['customField']){_0x2a8067[_0x59b28c[_0xb771('0x3f')]]&&_0x5316d6[_0xb771('0x3b')]['push']({'id':_0x59b28c['idField'],'value':_0x2a8067[_0x59b28c[_0xb771('0x3f')]][_0xb771('0x2e')]()});}else if(_0x59b28c[_0xb771('0x35')]===_0xb771('0x40')&&_0x59b28c[_0xb771('0x41')]&&_0x59b28c['Variable'][_0xb771('0x16')]&&_0x59b28c[_0xb771('0x3a')]&&_0x59b28c[_0xb771('0x37')]){_0x2a8067[_0x59b28c[_0xb771('0x41')][_0xb771('0x16')][_0xb771('0x39')]()]&&_0x5316d6[_0xb771('0x3b')][_0xb771('0x3c')]({'id':_0x59b28c[_0xb771('0x3a')],'value':_0x2a8067[_0x59b28c['Variable'][_0xb771('0x16')][_0xb771('0x39')]()]['toString']()});}});}return _0x5316d6;}exports['queue']=function(_0x267c67,_0x718951,_0x3bd9cf,_0x1b41f6,_0x4660b8,_0x26bb89){var _0x87bf04,_0x5eec2e;_0x26bb89[_0xb771('0x1f')]=intUtil[_0xb771('0x42')](_0x26bb89['remoteUri']);_0x26bb89['serverUrl']=intUtil['stripTrailingSlash'](_0x26bb89[_0xb771('0x43')]);if(_0x4660b8&&_0x4660b8[_0xb771('0x44')]){logger['info'](_0xb771('0x45'),'Recording\x20is\x20enabled!');_0x718951[_0xb771('0x46')]=util[_0xb771('0xd')](_0xb771('0x47'),_0x26bb89[_0xb771('0x43')],_0x718951['uniqueid'],md5(_0x718951[_0xb771('0x48')]));}else{_0x718951[_0xb771('0x46')]='';}headers['Authorization']=getAuth(_0x26bb89);return getUser(_0x26bb89,_0x1b41f6['email'])[_0xb771('0x1b')](function(_0xeeedba){_0x87bf04=_0xeeedba;logger[_0xb771('0xa')](_0xb771('0x49'),_0x87bf04['id']);return getEndUser(_0x26bb89,_0x718951['calleridname'],_0x718951[_0xb771('0x10')]);})[_0xb771('0x1b')](function(_0x30497f){_0x5eec2e=_0x30497f;logger[_0xb771('0xa')]('The\x20Enduser\x20ID\x20is:',_0x5eec2e['id']);return getTicket(_0x26bb89,_0x87bf04,_0x5eec2e,_0x3bd9cf,_0x718951);})[_0xb771('0x1b')](function(_0x56113f){if(_0x56113f&&_0x56113f['id']){logger[_0xb771('0xa')](_0xb771('0x1c'));logger['info'](_0xb771('0x4a'),_0x56113f['id']);logger['info'](_0xb771('0x45'),_0xb771('0x4b'));emit(util[_0xb771('0xd')]('user:%s',_0x1b41f6[_0xb771('0x16')]),_0xb771('0x4c'),{'uri':util[_0xb771('0xd')](_0xb771('0x4d'),_0x26bb89[_0xb771('0x1f')],_0x56113f['id'])});}})[_0xb771('0x4e')](function(_0x8f9c2e){logger['error'](_0xb771('0x45'),JSON[_0xb771('0x32')](_0x8f9c2e));});};exports[_0xb771('0x4f')]=function(_0x4d2bb1,_0x5b43ed,_0x3737ca,_0x41a957,_0x6063c3,_0x31d492,_0x140129){var _0xa441fe,_0x2c5c5d;_0x31d492['remoteUri']=intUtil[_0xb771('0x42')](_0x31d492['remoteUri']);_0x31d492[_0xb771('0x43')]=intUtil[_0xb771('0x42')](_0x31d492[_0xb771('0x43')]);if(_0x140129&&_0x140129['recordingFormat']&&_0x140129[_0xb771('0x50')]!==_0xb771('0x51')){logger[_0xb771('0xa')]('[OUTBOUND]',_0xb771('0x52'));_0x5b43ed[_0xb771('0x46')]=util[_0xb771('0xd')](_0xb771('0x47'),_0x31d492['serverUrl'],_0x5b43ed[_0xb771('0x48')],md5(_0x5b43ed[_0xb771('0x48')]));}headers['Authorization']=getAuth(_0x31d492);return getUser(_0x31d492,_0x41a957[_0xb771('0x23')])[_0xb771('0x1b')](function(_0x3b4fb1){_0xa441fe=_0x3b4fb1;logger[_0xb771('0xa')](_0xb771('0x49'),_0xa441fe['id']);return getEndUser(_0x31d492,_0x5b43ed['destcalleridname'],_0x5b43ed[_0xb771('0x53')]);})['then'](function(_0x1cf417){_0x2c5c5d=_0x1cf417;logger[_0xb771('0xa')](_0xb771('0x54'),_0x2c5c5d['id']);return getTicket(_0x31d492,_0xa441fe,_0x2c5c5d,_0x3737ca,_0x5b43ed);})[_0xb771('0x1b')](function(_0x5c9797){if(_0x5c9797&&_0x5c9797['id']){logger[_0xb771('0xa')]('Ticket\x20created!');logger['info'](_0xb771('0x4a'),_0x5c9797['id']);logger[_0xb771('0xa')](_0xb771('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb771('0xd')](_0xb771('0x56'),_0x41a957[_0xb771('0x16')]),'trigger:browser:url',{'uri':util[_0xb771('0xd')](_0xb771('0x4d'),_0x31d492[_0xb771('0x1f')],_0x5c9797['id'])});}})[_0xb771('0x4e')](function(_0x330dfe){logger[_0xb771('0x57')](_0xb771('0x55'),JSON[_0xb771('0x32')](_0x330dfe));});};exports['unmanaged']=function(_0x1e2935,_0x3782a3,_0x2f3972,_0x1a2fa8,_0x2f9136,_0x1a66e4){var _0x121f51,_0x20da1d;_0x1a66e4[_0xb771('0x1f')]=intUtil['stripTrailingSlash'](_0x1a66e4[_0xb771('0x1f')]);_0x1a66e4['serverUrl']=intUtil[_0xb771('0x42')](_0x1a66e4[_0xb771('0x43')]);if(_0x2f9136&&_0x2f9136['monitor_format']){logger['info']('['+_0x3782a3[_0xb771('0x58')]['toUpperCase']()+']',_0xb771('0x52'));_0x3782a3[_0xb771('0x46')]=util['format'](_0xb771('0x47'),_0x1a66e4['serverUrl'],_0x3782a3['uniqueid'],md5(_0x3782a3[_0xb771('0x48')]));}else{_0x3782a3[_0xb771('0x46')]='';}headers[_0xb771('0x59')]=getAuth(_0x1a66e4);return getUser(_0x1a66e4,'')[_0xb771('0x1b')](function(_0x517265){_0x121f51=_0x517265;logger[_0xb771('0xa')](_0xb771('0x49'),_0x121f51['id']);return getEndUser(_0x1a66e4,_0x3782a3[_0xb771('0xf')],_0x3782a3[_0xb771('0x10')]);})[_0xb771('0x1b')](function(_0x2ba073){_0x20da1d=_0x2ba073;logger[_0xb771('0xa')](_0xb771('0x54'),_0x20da1d['id']);return getTicket(_0x1a66e4,_0x121f51,_0x20da1d,_0x2f3972,_0x3782a3);})['then'](function(_0x23178b){if(_0x23178b){logger[_0xb771('0xa')](_0xb771('0x1c'));logger['info'](_0xb771('0x4a'),_0x23178b['id']);}})['catch'](function(_0x1c9252){logger['error']('['+_0x3782a3['lastevent'][_0xb771('0x5a')]()+']',JSON[_0xb771('0x32')](_0x1c9252));});}; \ No newline at end of file +var _0x39db=['./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','remoteUri','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','forEach','type','string','nameField','toLowerCase','content','toString','idField','customField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','catch','error','[OUTBOUND]','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','ioredis'];(function(_0x45762f,_0x37326a){var _0xf77f01=function(_0x217181){while(--_0x217181){_0x45762f['push'](_0x45762f['shift']());}};_0xf77f01(++_0x37326a);}(_0x39db,0x1be));var _0xb39d=function(_0x290694,_0x281935){_0x290694=_0x290694-0x0;var _0x5a0f2e=_0x39db[_0x290694];return _0x5a0f2e;};'use strict';var _=require(_0xb39d('0x0'));var rp=require(_0xb39d('0x1'));var md5=require(_0xb39d('0x2'));var util=require('util');var Redis=require(_0xb39d('0x3'));var intUtil=require(_0xb39d('0x4'));var config=require(_0xb39d('0x5'));var logger=require(_0xb39d('0x6'))('freshdesk');config['redis']=_[_0xb39d('0x7')](config[_0xb39d('0x8')],{'host':_0xb39d('0x9'),'port':0x18eb});var io=require(_0xb39d('0xa'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0xb39d('0xb')};function emit(_0x40017e,_0xe892e7,_0x3a1352){io['to'](_0x40017e)[_0xb39d('0xc')](_0xe892e7,_0x3a1352);}function getTicket(_0x1e4bb2,_0x332a91,_0x31b623,_0x363092,_0x5bf512){logger[_0xb39d('0xd')]('Creating\x20new\x20ticket...');var _0x52ed9d=_[_0xb39d('0xe')]({'responder_id':_0x332a91['id'],'requester_id':_0x31b623['id'],'name':util[_0xb39d('0xf')]('Caller\x20-\x20%s',_0x5bf512[_0xb39d('0x10')]),'phone':_0x5bf512[_0xb39d('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb39d('0x12')](_0x363092[_0xb39d('0x13')],_0x5bf512,'\x20'),'description':intUtil[_0xb39d('0x12')](_0x363092[_0xb39d('0x14')],_0x5bf512,_0xb39d('0x15')),'tags':getTags(_0x363092['Tags'],_0xb39d('0x16'))},getCustomFields(_0x363092[_0xb39d('0x17')],_0x5bf512));_0x52ed9d[_0xb39d('0x18')]=_['mapValues'](_['keyBy'](_0x52ed9d[_0xb39d('0x18')],'id'),'value');return request({'uri':util[_0xb39d('0xf')]('%s/api/v2/tickets',_0x1e4bb2[_0xb39d('0x19')]),'method':'POST','body':_0x52ed9d})['then'](function(_0x1ed15b){logger[_0xb39d('0xd')](_0xb39d('0x1a'));return _0x1ed15b;});}function getUser(_0x4f3e65,_0xf23b9b){if(intUtil[_0xb39d('0x1b')](_0xf23b9b)){return request({'uri':util['format'](_0xb39d('0x1c'),_0x4f3e65[_0xb39d('0x19')]),'qs':{'email':_0xf23b9b}})[_0xb39d('0x1d')](function(_0xc78571){if(_0xc78571[_0xb39d('0x1e')]){logger[_0xb39d('0xd')]('Agent\x20found!');return _[_0xb39d('0x1f')](_0xc78571,function(_0x36d4b8){return _0x36d4b8[_0xb39d('0x20')][_0xb39d('0x21')]===_0xf23b9b;});}else{logger[_0xb39d('0xd')](_0xb39d('0x22'));return request({'uri':util[_0xb39d('0xf')](_0xb39d('0x23'),_0x4f3e65[_0xb39d('0x19')])})['then'](function(_0x4e0979){logger[_0xb39d('0xd')](_0xb39d('0x24'));return _0x4e0979;});}});}else{logger[_0xb39d('0xd')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xb39d('0x23'),_0x4f3e65['remoteUri'])})[_0xb39d('0x1d')](function(_0x1c7abd){logger[_0xb39d('0xd')](_0xb39d('0x24'));return _0x1c7abd;});}}function getEndUser(_0x168b50,_0x20f725,_0x7f32f3){logger[_0xb39d('0xd')]('Searching\x20enduser\x20with\x20phone',_0x7f32f3);return request({'uri':util['format']('%s/api/v2/contacts',_0x168b50[_0xb39d('0x19')]),'qs':{'phone':_0x7f32f3}})[_0xb39d('0x1d')](function(_0x2f833b){if(_0x2f833b[_0xb39d('0x1e')]){logger[_0xb39d('0xd')](_0xb39d('0x25'));return _[_0xb39d('0x1f')](_0x2f833b,{'phone':_0x7f32f3});}else{logger['info'](_0xb39d('0x26'));return request({'uri':util[_0xb39d('0xf')](_0xb39d('0x27'),_0x168b50[_0xb39d('0x19')]),'method':_0xb39d('0x28'),'body':{'name':_0x20f725,'phone':_0x7f32f3}})['then'](function(_0x4b3a42){logger[_0xb39d('0xd')]('Enduser\x20created.');return _0x4b3a42;});}});}function getAuth(_0xb081b7){return util[_0xb39d('0xf')](_0xb39d('0x29'),new Buffer(_0xb081b7['apiKey']+':X')['toString'](_0xb39d('0x2a')));}function request(_0x4b9ee7){logger[_0xb39d('0x2b')](_0xb39d('0x2c'),JSON[_0xb39d('0x2d')](_0x4b9ee7));return rp(_[_0xb39d('0x7')](_0x4b9ee7,{'method':_0xb39d('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x5f497e,_0x132bdf){var _0xc08251=[];if(_0x5f497e&&_0x5f497e[_0xb39d('0x1e')]>0x0){_0xc08251=_[_0xb39d('0x2f')](_0x5f497e,_0x132bdf);}return _0xc08251;}function getCustomFields(_0xf11628,_0x268025){var _0x42d2ff=[];var _0x98fa18={'custom_fields':[]};if(_0xf11628['length']>0x0){_[_0xb39d('0x30')](_0xf11628,function(_0x2d9d88){if(_0x2d9d88[_0xb39d('0x31')]===_0xb39d('0x32')&&_0x2d9d88[_0xb39d('0x33')]&&!_0x2d9d88['customField']){_0x98fa18[_0x2d9d88[_0xb39d('0x33')][_0xb39d('0x34')]()]=_0x2d9d88[_0xb39d('0x35')][_0xb39d('0x36')]();}else if(_0x2d9d88[_0xb39d('0x31')]===_0xb39d('0x32')&&_0x2d9d88[_0xb39d('0x37')]&&_0x2d9d88[_0xb39d('0x38')]){_0x98fa18[_0xb39d('0x18')][_0xb39d('0x39')]({'id':_0x2d9d88[_0xb39d('0x37')],'value':_0x2d9d88['content'][_0xb39d('0x36')]()});}else if(_0x2d9d88['type']===_0xb39d('0x3a')&&_0x2d9d88['variableName']&&_0x2d9d88[_0xb39d('0x37')]&&_0x2d9d88[_0xb39d('0x38')]){_0x268025[_0x2d9d88[_0xb39d('0x3b')]]&&_0x98fa18[_0xb39d('0x18')][_0xb39d('0x39')]({'id':_0x2d9d88['idField'],'value':_0x268025[_0x2d9d88[_0xb39d('0x3b')]][_0xb39d('0x36')]()});}else if(_0x2d9d88[_0xb39d('0x31')]===_0xb39d('0x3c')&&_0x2d9d88[_0xb39d('0x3d')]&&_0x2d9d88[_0xb39d('0x3d')][_0xb39d('0x16')]&&_0x2d9d88[_0xb39d('0x37')]&&_0x2d9d88['customField']){_0x268025[_0x2d9d88[_0xb39d('0x3d')]['name'][_0xb39d('0x34')]()]&&_0x98fa18[_0xb39d('0x18')][_0xb39d('0x39')]({'id':_0x2d9d88[_0xb39d('0x37')],'value':_0x268025[_0x2d9d88[_0xb39d('0x3d')][_0xb39d('0x16')]['toLowerCase']()][_0xb39d('0x36')]()});}});}return _0x98fa18;}exports[_0xb39d('0x3e')]=function(_0x270fc8,_0x277628,_0x560fef,_0x34be6b,_0x208345,_0x3f044a){var _0x19bdf8,_0x4f7c3d;_0x3f044a[_0xb39d('0x19')]=intUtil[_0xb39d('0x3f')](_0x3f044a[_0xb39d('0x19')]);_0x3f044a[_0xb39d('0x40')]=intUtil[_0xb39d('0x3f')](_0x3f044a[_0xb39d('0x40')]);if(_0x208345&&_0x208345['monitor_format']){logger[_0xb39d('0xd')](_0xb39d('0x41'),'Recording\x20is\x20enabled!');_0x277628['recordingURL']=util[_0xb39d('0xf')](_0xb39d('0x42'),_0x3f044a[_0xb39d('0x40')],_0x277628[_0xb39d('0x43')],md5(_0x277628[_0xb39d('0x43')]));}else{_0x277628[_0xb39d('0x44')]='';}headers[_0xb39d('0x45')]=getAuth(_0x3f044a);return getUser(_0x3f044a,_0x34be6b['email'])['then'](function(_0x4b2a78){_0x19bdf8=_0x4b2a78;logger[_0xb39d('0xd')](_0xb39d('0x46'),_0x19bdf8['id']);return getEndUser(_0x3f044a,_0x277628[_0xb39d('0x10')],_0x277628[_0xb39d('0x11')]);})[_0xb39d('0x1d')](function(_0x2683b3){_0x4f7c3d=_0x2683b3;logger[_0xb39d('0xd')](_0xb39d('0x47'),_0x4f7c3d['id']);return getTicket(_0x3f044a,_0x19bdf8,_0x4f7c3d,_0x560fef,_0x277628);})[_0xb39d('0x1d')](function(_0x478fdc){if(_0x478fdc&&_0x478fdc['id']){logger[_0xb39d('0xd')](_0xb39d('0x1a'));logger[_0xb39d('0xd')]('The\x20Ticket\x20ID\x20is:',_0x478fdc['id']);logger[_0xb39d('0xd')](_0xb39d('0x41'),_0xb39d('0x48'));emit(util[_0xb39d('0xf')](_0xb39d('0x49'),_0x34be6b[_0xb39d('0x16')]),_0xb39d('0x4a'),{'uri':util['format'](_0xb39d('0x4b'),_0x3f044a[_0xb39d('0x19')],_0x478fdc['id'])});}})['catch'](function(_0x175696){logger['error'](_0xb39d('0x41'),JSON[_0xb39d('0x2d')](_0x175696));});};exports[_0xb39d('0x4c')]=function(_0x5435f9,_0x5e0c7f,_0x1783d0,_0x5655f1,_0xd7f19c,_0x1bd4b4,_0x4fd840){var _0x5f4ce8,_0x4305c8;_0x1bd4b4['remoteUri']=intUtil[_0xb39d('0x3f')](_0x1bd4b4[_0xb39d('0x19')]);_0x1bd4b4[_0xb39d('0x40')]=intUtil[_0xb39d('0x3f')](_0x1bd4b4[_0xb39d('0x40')]);if(_0x4fd840&&_0x4fd840[_0xb39d('0x4d')]&&_0x4fd840[_0xb39d('0x4d')]!==_0xb39d('0x4e')){logger[_0xb39d('0xd')]('[OUTBOUND]',_0xb39d('0x4f'));_0x5e0c7f['recordingURL']=util[_0xb39d('0xf')](_0xb39d('0x42'),_0x1bd4b4[_0xb39d('0x40')],_0x5e0c7f['uniqueid'],md5(_0x5e0c7f[_0xb39d('0x43')]));}headers['Authorization']=getAuth(_0x1bd4b4);return getUser(_0x1bd4b4,_0x5655f1[_0xb39d('0x21')])[_0xb39d('0x1d')](function(_0x301437){_0x5f4ce8=_0x301437;logger[_0xb39d('0xd')](_0xb39d('0x46'),_0x5f4ce8['id']);return getEndUser(_0x1bd4b4,_0x5e0c7f[_0xb39d('0x50')],_0x5e0c7f[_0xb39d('0x51')]);})['then'](function(_0x471a24){_0x4305c8=_0x471a24;logger['info'](_0xb39d('0x47'),_0x4305c8['id']);return getTicket(_0x1bd4b4,_0x5f4ce8,_0x4305c8,_0x1783d0,_0x5e0c7f);})['then'](function(_0x34f8ab){if(_0x34f8ab&&_0x34f8ab['id']){logger['info'](_0xb39d('0x1a'));logger[_0xb39d('0xd')](_0xb39d('0x52'),_0x34f8ab['id']);logger[_0xb39d('0xd')]('[OUTBOUND]',_0xb39d('0x48'));emit(util[_0xb39d('0xf')](_0xb39d('0x49'),_0x5655f1[_0xb39d('0x16')]),_0xb39d('0x4a'),{'uri':util[_0xb39d('0xf')](_0xb39d('0x4b'),_0x1bd4b4[_0xb39d('0x19')],_0x34f8ab['id'])});}})[_0xb39d('0x53')](function(_0x15ab16){logger[_0xb39d('0x54')](_0xb39d('0x55'),JSON[_0xb39d('0x2d')](_0x15ab16));});};exports[_0xb39d('0x56')]=function(_0x329082,_0x386a17,_0x4ca3e6,_0x3be560,_0x38fbd9,_0x51c02d){var _0x38d9c9,_0x2b0535;_0x51c02d[_0xb39d('0x19')]=intUtil['stripTrailingSlash'](_0x51c02d['remoteUri']);_0x51c02d[_0xb39d('0x40')]=intUtil[_0xb39d('0x3f')](_0x51c02d[_0xb39d('0x40')]);if(_0x38fbd9&&_0x38fbd9[_0xb39d('0x57')]){logger[_0xb39d('0xd')]('['+_0x386a17[_0xb39d('0x58')][_0xb39d('0x59')]()+']',_0xb39d('0x4f'));_0x386a17[_0xb39d('0x44')]=util['format'](_0xb39d('0x42'),_0x51c02d[_0xb39d('0x40')],_0x386a17['uniqueid'],md5(_0x386a17[_0xb39d('0x43')]));}else{_0x386a17[_0xb39d('0x44')]='';}headers[_0xb39d('0x45')]=getAuth(_0x51c02d);return getUser(_0x51c02d,'')[_0xb39d('0x1d')](function(_0x18d74b){_0x38d9c9=_0x18d74b;logger[_0xb39d('0xd')]('The\x20User\x20ID\x20is:',_0x38d9c9['id']);return getEndUser(_0x51c02d,_0x386a17['calleridname'],_0x386a17[_0xb39d('0x11')]);})[_0xb39d('0x1d')](function(_0x29ce54){_0x2b0535=_0x29ce54;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2b0535['id']);return getTicket(_0x51c02d,_0x38d9c9,_0x2b0535,_0x4ca3e6,_0x386a17);})['then'](function(_0x200ebe){if(_0x200ebe){logger[_0xb39d('0xd')](_0xb39d('0x1a'));logger[_0xb39d('0xd')](_0xb39d('0x52'),_0x200ebe['id']);}})[_0xb39d('0x53')](function(_0x15ccf3){logger[_0xb39d('0x54')]('['+_0x386a17[_0xb39d('0x58')][_0xb39d('0x59')]()+']',JSON[_0xb39d('0x2d')](_0x15ccf3));});}; \ 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 c5f2437..b12c29d 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 _0x363f=['username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','Getting\x20contacts\x20filter','filters','forEach','name','Getting\x20contact\x20list','/api/contacts/view/','contactNumber','length','find','contacts','work_number','mobile_number','Contact\x20found:','endUserId','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','/api/tasks','getString','Descriptions','Contact','add','format','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','serverUrl','stripTrailingSlash'];(function(_0x214e94,_0x5a69fa){var _0x260edb=function(_0x4627b3){while(--_0x4627b3){_0x214e94['push'](_0x214e94['shift']());}};_0x260edb(++_0x5a69fa);}(_0x363f,0x1cb));var _0xf363=function(_0x48425e,_0x39932e){_0x48425e=_0x48425e-0x0;var _0x203065=_0x363f[_0x48425e];return _0x203065;};'use strict';var _=require(_0xf363('0x0'));var rp=require(_0xf363('0x1'));var md5=require(_0xf363('0x2'));var util=require(_0xf363('0x3'));var moment=require(_0xf363('0x4'));var Promise=require(_0xf363('0x5'));var Redis=require(_0xf363('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xf363('0x7'))(_0xf363('0x8'));config[_0xf363('0x9')]=_[_0xf363('0xa')](config[_0xf363('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xf363('0xb'))(new Redis(config[_0xf363('0x9')]));function getAdminId(_0x3777a1,_0x3aff4c,_0x48ff3d,_0x9b41da){return new Promise(function(_0x26269c,_0x3ffa74){var _0x1005c1=![];var _0x4daa88={'method':_0xf363('0xc'),'uri':_0x9b41da+_0xf363('0xd'),'json':!![]};_0x4daa88[_0xf363('0xe')]=_0x48ff3d;logger[_0xf363('0xf')](_0xf363('0x10'));return rp(_0x4daa88)[_0xf363('0x11')](function(_0x51f6c5){if(_0x51f6c5){var _0x353847=_0x51f6c5[_0xf363('0x12')];var _0x12d54d=null;for(_0x12d54d=0x0;_0x12d54d<_0x353847['length'];_0x12d54d++){if(_0x353847[_0x12d54d][_0xf363('0x13')]===_0x3777a1[_0xf363('0x14')]){_0x3777a1[_0xf363('0x15')]=_0x353847[_0x12d54d]['id'];_0x1005c1=!![];}}if(_0x1005c1){logger[_0xf363('0xf')]('Admin\x20found:',_0x3777a1[_0xf363('0x15')]);_0x26269c(_0x3777a1);}else{_0x3ffa74({'statusCode':0x194,'message':_0xf363('0x16')});}}else{_0x3ffa74({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xf363('0x17')](function(_0x265e40){logger[_0xf363('0x18')]('['+[_0x3aff4c[_0xf363('0x19')]()]+']',_0x265e40[_0xf363('0x1a')]);_0x3ffa74(_0x265e40);});});}function getUser(_0x5b4b19,_0x4aee0b,_0x5cb98b){return function(_0x4ce33f){return new Promise(function(_0x1b9f2f,_0x4cff51){var _0x4f4351={'method':_0xf363('0xc'),'uri':_0x5cb98b+_0xf363('0xd'),'json':!![]};_0x4f4351[_0xf363('0xe')]=_0x4aee0b;logger[_0xf363('0xf')](_0xf363('0x1b'));return rp(_0x4f4351)[_0xf363('0x11')](function(_0x28c9b9){if(_0x28c9b9){var _0x5af735=_0x28c9b9[_0xf363('0x12')];var _0x2e500d=![];var _0x5f2947=null;if(_0x4ce33f[_0xf363('0x1c')]!==null){logger[_0xf363('0xf')](_0xf363('0x1d'),_0x4ce33f[_0xf363('0x1c')]);_0x4ce33f[_0xf363('0x1e')]=_0x4ce33f[_0xf363('0x1c')];for(_0x5f2947=0x0;_0x5f2947<_0x5af735['length'];_0x5f2947++){if(_0x5af735[_0x5f2947][_0xf363('0x13')]===_0x4ce33f['agentEmail']){_0x2e500d=!![];_0x4ce33f[_0xf363('0x1f')]=_0x5af735[_0x5f2947]['id'];logger['info'](_0xf363('0x20'),_0x4ce33f['userId']);}}}if(!_0x2e500d){logger[_0xf363('0xf')](_0xf363('0x21'));_0x4ce33f[_0xf363('0x1e')]=_0x4ce33f['adminEmail'];_0x4ce33f[_0xf363('0x1f')]=_0x4ce33f[_0xf363('0x15')];_0x2e500d=!![];}if(_0x2e500d){_0x1b9f2f(_0x4ce33f);}else{_0x4cff51({'statusCode':0x194,'message':_0xf363('0x16')});}}else{_0x4cff51({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xf363('0x17')](function(_0x4d821e){logger[_0xf363('0x18')]('['+[_0x5b4b19[_0xf363('0x19')]()]+']',_0x4d821e[_0xf363('0x1a')]);_0x4cff51(_0x4d821e);});});};}function getEndUser(_0x4d0069,_0x1405ff,_0x24285c){return function(_0x5eb8c7){return new Promise(function(_0x662fe4,_0x5dd08f){var _0x50b7cc=0x0;var _0x263d20={'method':_0xf363('0xc'),'uri':_0x24285c+'/api/contacts/filters','json':!![]};_0x263d20['headers']=_0x1405ff;logger['info'](_0xf363('0x22'));return rp(_0x263d20)[_0xf363('0x11')](function(_0x4857e7){_0x4857e7[_0xf363('0x23')][_0xf363('0x24')](function(_0x55e7fc){if(_0x55e7fc[_0xf363('0x25')]==='All\x20Contacts'){_0x50b7cc=_0x55e7fc['id'];}});})[_0xf363('0x11')](function(){logger[_0xf363('0xf')](_0xf363('0x26'));var _0x2616a6={'method':_0xf363('0xc'),'uri':_0x24285c+_0xf363('0x27')+_0x50b7cc,'json':!![]};_0x2616a6[_0xf363('0xe')]=_0x1405ff;return rp(_0x2616a6);})[_0xf363('0x11')](function(_0x58742f){logger[_0xf363('0xf')]('Searching\x20contact\x20with\x20phone',_0x5eb8c7[_0xf363('0x28')]);if(_0x58742f['contacts'][_0xf363('0x29')]>0x0){var _0x57abd3=_[_0xf363('0x2a')](_0x58742f[_0xf363('0x2b')],function(_0x356ba5){if(_0x356ba5[_0xf363('0x2c')]===_0x5eb8c7[_0xf363('0x28')]||_0x356ba5[_0xf363('0x2d')]===_0x5eb8c7[_0xf363('0x28')]){return _0x356ba5;}});if(_0x57abd3){_0x5eb8c7['endUserId']=_0x57abd3['id'];logger['info'](_0xf363('0x2e'),_0x5eb8c7[_0xf363('0x2f')]);_0x662fe4(_0x5eb8c7);}else{return createEndUser(_0x5eb8c7,_0x4d0069,_0x1405ff,_0x24285c)[_0xf363('0x11')](function(_0x202489){logger[_0xf363('0xf')](_0xf363('0x30'),_0x5eb8c7[_0xf363('0x2f')]);_0x662fe4(_0x202489);});}}else{return createEndUser(_0x5eb8c7,_0x4d0069,_0x1405ff,_0x24285c)['then'](function(_0x3b2c32){logger['info'](_0xf363('0x30'),_0x5eb8c7[_0xf363('0x2f')]);_0x662fe4(_0x3b2c32);});}})['catch'](function(_0x636154){throw new Error(_0x636154[_0xf363('0x1a')]);});});};}function createEndUser(_0x1af33b,_0x2ad8e7,_0x4f852a,_0x1bb615){return new Promise(function(_0x1a23a0,_0x3a6cf1){var _0x134958=moment();var _0x217f8d={'method':_0xf363('0x31'),'uri':_0x1bb615+_0xf363('0x32'),'body':{'contact':{'last_name':_0x1af33b['contactNumber'],'work_number':_0x1af33b['contactNumber'],'mobile_number':_0x1af33b[_0xf363('0x28')],'owner_id':_0x1af33b[_0xf363('0x1f')],'created_at':_0x134958['format'](_0xf363('0x33'))}},'json':!![]};_0x217f8d[_0xf363('0xe')]=_0x4f852a;logger['info'](_0xf363('0x34'));return rp(_0x217f8d)[_0xf363('0x11')](function(_0x232626){_0x1af33b[_0xf363('0x2f')]=_0x232626['contact']['id'];_0x1a23a0(_0x1af33b);})[_0xf363('0x17')](function(_0x10ab2f){logger[_0xf363('0x18')]('['+[_0x2ad8e7['toUpperCase']()]+']',_0x10ab2f[_0xf363('0x1a')]);_0x3a6cf1(_0x10ab2f[_0xf363('0x1a')]);});});}function getTicket(_0x1609bc,_0x374753,_0x30f2b1,_0x5e5649,_0x5777c3){return function(_0x52f13e){logger[_0xf363('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x79952b,_0x451eec){var _0x33ee71=moment();var _0x4feb35={'method':_0xf363('0x31'),'uri':_0x30f2b1+_0xf363('0x35'),'body':{'title':intUtil[_0xf363('0x36')](_0x5e5649['Subjects'],_0x5777c3,'\x20'),'description':intUtil['getString'](_0x5e5649[_0xf363('0x37')],_0x5777c3,'\x0a'),'owner_id':_0x52f13e[_0xf363('0x1f')],'creater_id':_0x52f13e['adminId'],'targetable_id':_0x52f13e[_0xf363('0x2f')],'targetable_type':_0xf363('0x38'),'created_at':_0x33ee71['format'](_0xf363('0x33')),'due_date':_0x33ee71[_0xf363('0x39')](0x1e,'m')[_0xf363('0x3a')](_0xf363('0x33'))},'json':!![]};_0x4feb35[_0xf363('0xe')]=_0x374753;return rp(_0x4feb35)[_0xf363('0x11')](function(_0x27b6a3){_0x52f13e[_0xf363('0x3b')]=_0x27b6a3[_0xf363('0x3c')]['id'];logger[_0xf363('0xf')]('Task\x20created:',_0x52f13e[_0xf363('0x3b')]);_0x79952b(_0x52f13e);})['catch'](function(_0x40cc24){logger[_0xf363('0x18')]('['+[_0x1609bc[_0xf363('0x19')]()]+']',_0x40cc24['message']);_0x451eec(_0x40cc24[_0xf363('0x1a')]);});});};}function emit(_0x431c53,_0x3d651c,_0x5f76b8){var _0x31e39a={'uri':_0x431c53+_0xf363('0x3d')+_0x5f76b8};io['to'](util['format'](_0xf363('0x3e'),_0x3d651c))[_0xf363('0x3f')](_0xf363('0x40'),_0x31e39a);}exports['cs']=function(_0x1415f7,_0x2a8dc7,_0x20b0f2,_0x105ad,_0x761eb6,_0x11e107,_0x3e1864,_0x59ac37){var _0x5560e7={};var _0x1edff1={'Authorization':_0xf363('0x41')+_0x11e107['apiKey']};_0x11e107[_0xf363('0x42')]=intUtil['stripTrailingSlash'](_0x11e107[_0xf363('0x42')]);_0x11e107[_0xf363('0x43')]=intUtil[_0xf363('0x44')](_0x11e107[_0xf363('0x43')]);var _0x536c71=_0x11e107[_0xf363('0x42')];_0x5560e7[_0xf363('0x14')]=_0x11e107[_0xf363('0x45')];_0x5560e7[_0xf363('0x28')]=_0x59ac37[_0xf363('0x46')]()===_0xf363('0x47')?_0x2a8dc7[_0xf363('0x48')]:_0x2a8dc7[_0xf363('0x49')];_0x5560e7[_0xf363('0x4a')]=_0x59ac37===_0xf363('0x4b')||_0x59ac37===_0xf363('0x4c')?_0xf363('0x4b'):'outbound';if(_0x105ad){_0x5560e7[_0xf363('0x1c')]=_0x105ad['email'];}var _0x44ddd8=util[_0xf363('0x3a')](_0xf363('0x4d'),_0x11e107[_0xf363('0x43')],_0x2a8dc7[_0xf363('0x4e')],md5(_0x2a8dc7['uniqueid']));if(_0x761eb6&&_0x761eb6['monitor_format']){logger[_0xf363('0xf')]('[QUEUE]','Recording\x20is\x20enabled!');_0x2a8dc7[_0xf363('0x4f')]=_0x44ddd8;}else if(_0x3e1864&&_0x3e1864[_0xf363('0x50')]&&_0x3e1864[_0xf363('0x50')]!==_0xf363('0x51')){logger[_0xf363('0xf')](_0xf363('0x52'),_0xf363('0x53'));_0x2a8dc7['recordingURL']=_0x44ddd8;}else{_0x2a8dc7[_0xf363('0x4f')]='';}return getAdminId(_0x5560e7,_0x59ac37,_0x1edff1,_0x536c71)[_0xf363('0x11')](getUser(_0x59ac37,_0x1edff1,_0x536c71))[_0xf363('0x11')](getEndUser(_0x59ac37,_0x1edff1,_0x536c71))[_0xf363('0x11')](getTicket(_0x59ac37,_0x1edff1,_0x536c71,_0x20b0f2,_0x2a8dc7))[_0xf363('0x11')](function(_0x3dddbe){logger['info'](util[_0xf363('0x3a')](_0xf363('0x54'),_0x3dddbe[_0xf363('0x3b')]));if(_0x59ac37!==_0xf363('0x4c')){logger[_0xf363('0xf')]('['+[_0x59ac37[_0xf363('0x19')]()]+']',_0xf363('0x55'));emit(_0x536c71,_0x105ad[_0xf363('0x25')],_0x3dddbe[_0xf363('0x2f')]);}})[_0xf363('0x17')](function(_0x2ca08b){logger[_0xf363('0x18')]('['+[_0x59ac37['toUpperCase']()]+_0xf363('0x56'),util[_0xf363('0x57')](_0x2ca08b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3832=['users','length','adminEmail','adminId','info','Requested\x20Resource\x20not\x20Found','catch','error','message','Getting\x20user\x20with\x20email','agentEmail','userId','User\x20found:','Admin\x20selected','userEmail','toUpperCase','/api/contacts/filters','headers','Getting\x20contacts\x20filter','filters','forEach','name','All\x20Contacts','Getting\x20contact\x20list','contacts','find','work_number','mobile_number','contactNumber','Contact\x20found:','endUserId','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','add','task','Task\x20created:','ticketId','user:%s','emit','apiKey','remoteUri','serverUrl','stripTrailingSlash','toLowerCase','outbound','calleridnum','callDirection','unmanaged','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','Getting\x20admin\x20information','then'];(function(_0x5a25bc,_0x12d2ef){var _0x517de4=function(_0x2d0dbb){while(--_0x2d0dbb){_0x5a25bc['push'](_0x5a25bc['shift']());}};_0x517de4(++_0x12d2ef);}(_0x3832,0x9d));var _0x2383=function(_0x5bb0fc,_0x3f88b3){_0x5bb0fc=_0x5bb0fc-0x0;var _0x5e645f=_0x3832[_0x5bb0fc];return _0x5e645f;};'use strict';var _=require(_0x2383('0x0'));var rp=require(_0x2383('0x1'));var md5=require(_0x2383('0x2'));var util=require(_0x2383('0x3'));var moment=require(_0x2383('0x4'));var Promise=require(_0x2383('0x5'));var Redis=require(_0x2383('0x6'));var intUtil=require(_0x2383('0x7'));var config=require('../../../../config/environment');var logger=require(_0x2383('0x8'))(_0x2383('0x9'));config[_0x2383('0xa')]=_['defaults'](config[_0x2383('0xa')],{'host':_0x2383('0xb'),'port':0x18eb});var io=require(_0x2383('0xc'))(new Redis(config['redis']));function getAdminId(_0x37bad5,_0x3f2775,_0x46e8d8,_0x4422b5){return new Promise(function(_0x497b0f,_0x5d6a54){var _0x416dc3=![];var _0x584aa8={'method':_0x2383('0xd'),'uri':_0x4422b5+_0x2383('0xe'),'json':!![]};_0x584aa8['headers']=_0x46e8d8;logger['info'](_0x2383('0xf'));return rp(_0x584aa8)[_0x2383('0x10')](function(_0x5c4dd2){if(_0x5c4dd2){var _0x45348c=_0x5c4dd2[_0x2383('0x11')];var _0x1d94e9=null;for(_0x1d94e9=0x0;_0x1d94e9<_0x45348c[_0x2383('0x12')];_0x1d94e9++){if(_0x45348c[_0x1d94e9]['email']===_0x37bad5[_0x2383('0x13')]){_0x37bad5[_0x2383('0x14')]=_0x45348c[_0x1d94e9]['id'];_0x416dc3=!![];}}if(_0x416dc3){logger[_0x2383('0x15')]('Admin\x20found:',_0x37bad5[_0x2383('0x14')]);_0x497b0f(_0x37bad5);}else{_0x5d6a54({'statusCode':0x194,'message':_0x2383('0x16')});}}else{_0x5d6a54({'statusCode':0x194,'message':_0x2383('0x16')});}})[_0x2383('0x17')](function(_0x4202fc){logger[_0x2383('0x18')]('['+[_0x3f2775['toUpperCase']()]+']',_0x4202fc[_0x2383('0x19')]);_0x5d6a54(_0x4202fc);});});}function getUser(_0xd565b9,_0x4e93d4,_0x52b584){return function(_0x345e05){return new Promise(function(_0x4ec767,_0x46b952){var _0x5f579a={'method':'GET','uri':_0x52b584+_0x2383('0xe'),'json':!![]};_0x5f579a['headers']=_0x4e93d4;logger['info']('Getting\x20user\x20list');return rp(_0x5f579a)[_0x2383('0x10')](function(_0x1260ba){if(_0x1260ba){var _0x41f94c=_0x1260ba[_0x2383('0x11')];var _0x4b54c9=![];var _0x110d98=null;if(_0x345e05['agentEmail']!==null){logger[_0x2383('0x15')](_0x2383('0x1a'),_0x345e05[_0x2383('0x1b')]);_0x345e05['userEmail']=_0x345e05['agentEmail'];for(_0x110d98=0x0;_0x110d98<_0x41f94c[_0x2383('0x12')];_0x110d98++){if(_0x41f94c[_0x110d98]['email']===_0x345e05[_0x2383('0x1b')]){_0x4b54c9=!![];_0x345e05[_0x2383('0x1c')]=_0x41f94c[_0x110d98]['id'];logger[_0x2383('0x15')](_0x2383('0x1d'),_0x345e05['userId']);}}}if(!_0x4b54c9){logger[_0x2383('0x15')](_0x2383('0x1e'));_0x345e05[_0x2383('0x1f')]=_0x345e05[_0x2383('0x13')];_0x345e05[_0x2383('0x1c')]=_0x345e05['adminId'];_0x4b54c9=!![];}if(_0x4b54c9){_0x4ec767(_0x345e05);}else{_0x46b952({'statusCode':0x194,'message':_0x2383('0x16')});}}else{_0x46b952({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x2383('0x17')](function(_0xd76ed7){logger[_0x2383('0x18')]('['+[_0xd565b9[_0x2383('0x20')]()]+']',_0xd76ed7[_0x2383('0x19')]);_0x46b952(_0xd76ed7);});});};}function getEndUser(_0x201296,_0x4cad94,_0x13f48a){return function(_0x1a533f){return new Promise(function(_0x3c63bd,_0x535d39){var _0x1b5b1e=0x0;var _0x5239af={'method':_0x2383('0xd'),'uri':_0x13f48a+_0x2383('0x21'),'json':!![]};_0x5239af[_0x2383('0x22')]=_0x4cad94;logger[_0x2383('0x15')](_0x2383('0x23'));return rp(_0x5239af)[_0x2383('0x10')](function(_0x13df78){_0x13df78[_0x2383('0x24')][_0x2383('0x25')](function(_0x119255){if(_0x119255[_0x2383('0x26')]===_0x2383('0x27')){_0x1b5b1e=_0x119255['id'];}});})[_0x2383('0x10')](function(){logger['info'](_0x2383('0x28'));var _0x36dfbe={'method':_0x2383('0xd'),'uri':_0x13f48a+'/api/contacts/view/'+_0x1b5b1e,'json':!![]};_0x36dfbe[_0x2383('0x22')]=_0x4cad94;return rp(_0x36dfbe);})[_0x2383('0x10')](function(_0x4c0dee){logger[_0x2383('0x15')]('Searching\x20contact\x20with\x20phone',_0x1a533f['contactNumber']);if(_0x4c0dee[_0x2383('0x29')]['length']>0x0){var _0x312ffe=_[_0x2383('0x2a')](_0x4c0dee[_0x2383('0x29')],function(_0x16bcf7){if(_0x16bcf7[_0x2383('0x2b')]===_0x1a533f['contactNumber']||_0x16bcf7[_0x2383('0x2c')]===_0x1a533f[_0x2383('0x2d')]){return _0x16bcf7;}});if(_0x312ffe){_0x1a533f['endUserId']=_0x312ffe['id'];logger['info'](_0x2383('0x2e'),_0x1a533f[_0x2383('0x2f')]);_0x3c63bd(_0x1a533f);}else{return createEndUser(_0x1a533f,_0x201296,_0x4cad94,_0x13f48a)['then'](function(_0x6edd5b){logger['info'](_0x2383('0x30'),_0x1a533f[_0x2383('0x2f')]);_0x3c63bd(_0x6edd5b);});}}else{return createEndUser(_0x1a533f,_0x201296,_0x4cad94,_0x13f48a)[_0x2383('0x10')](function(_0x191454){logger[_0x2383('0x15')]('Contact\x20created:',_0x1a533f[_0x2383('0x2f')]);_0x3c63bd(_0x191454);});}})['catch'](function(_0x4487ec){throw new Error(_0x4487ec[_0x2383('0x19')]);});});};}function createEndUser(_0x33de23,_0xcccd89,_0x204df4,_0x55f757){return new Promise(function(_0x340287,_0x22979d){var _0x20e35d=moment();var _0x282826={'method':_0x2383('0x31'),'uri':_0x55f757+_0x2383('0x32'),'body':{'contact':{'last_name':_0x33de23[_0x2383('0x2d')],'work_number':_0x33de23[_0x2383('0x2d')],'mobile_number':_0x33de23[_0x2383('0x2d')],'owner_id':_0x33de23[_0x2383('0x1c')],'created_at':_0x20e35d[_0x2383('0x33')](_0x2383('0x34'))}},'json':!![]};_0x282826['headers']=_0x204df4;logger[_0x2383('0x15')](_0x2383('0x35'));return rp(_0x282826)[_0x2383('0x10')](function(_0x126fef){_0x33de23['endUserId']=_0x126fef[_0x2383('0x36')]['id'];_0x340287(_0x33de23);})[_0x2383('0x17')](function(_0xb7767a){logger[_0x2383('0x18')]('['+[_0xcccd89[_0x2383('0x20')]()]+']',_0xb7767a[_0x2383('0x19')]);_0x22979d(_0xb7767a['message']);});});}function getTicket(_0x294ef2,_0x3f6f63,_0x3c0932,_0x46b338,_0x5096c){return function(_0x5a47aa){logger[_0x2383('0x15')]('Creating\x20new\x20task');return new Promise(function(_0x4a2370,_0xf35628){var _0x22b948=moment();var _0x30bc8d={'method':_0x2383('0x31'),'uri':_0x3c0932+_0x2383('0x37'),'body':{'title':intUtil[_0x2383('0x38')](_0x46b338[_0x2383('0x39')],_0x5096c,'\x20'),'description':intUtil[_0x2383('0x38')](_0x46b338[_0x2383('0x3a')],_0x5096c,'\x0a'),'owner_id':_0x5a47aa['userId'],'creater_id':_0x5a47aa['adminId'],'targetable_id':_0x5a47aa[_0x2383('0x2f')],'targetable_type':'Contact','created_at':_0x22b948['format'](_0x2383('0x34')),'due_date':_0x22b948[_0x2383('0x3b')](0x1e,'m')[_0x2383('0x33')](_0x2383('0x34'))},'json':!![]};_0x30bc8d[_0x2383('0x22')]=_0x3f6f63;return rp(_0x30bc8d)['then'](function(_0x5aed32){_0x5a47aa['ticketId']=_0x5aed32[_0x2383('0x3c')]['id'];logger[_0x2383('0x15')](_0x2383('0x3d'),_0x5a47aa[_0x2383('0x3e')]);_0x4a2370(_0x5a47aa);})[_0x2383('0x17')](function(_0x437277){logger['error']('['+[_0x294ef2['toUpperCase']()]+']',_0x437277[_0x2383('0x19')]);_0xf35628(_0x437277[_0x2383('0x19')]);});});};}function emit(_0x1c74e3,_0x19402b,_0x133fbb){var _0x39cd72={'uri':_0x1c74e3+'/contacts/'+_0x133fbb};io['to'](util['format'](_0x2383('0x3f'),_0x19402b))[_0x2383('0x40')]('trigger:browser:url',_0x39cd72);}exports['cs']=function(_0x3bdcb4,_0x501cc9,_0x1cf5f9,_0x4df978,_0x15a3e4,_0x233588,_0x419917,_0x42a53b){var _0x2c4996={};var _0x14e928={'Authorization':'Token\x20token='+_0x233588[_0x2383('0x41')]};_0x233588['remoteUri']=intUtil['stripTrailingSlash'](_0x233588[_0x2383('0x42')]);_0x233588[_0x2383('0x43')]=intUtil[_0x2383('0x44')](_0x233588[_0x2383('0x43')]);var _0x2a6534=_0x233588[_0x2383('0x42')];_0x2c4996['adminEmail']=_0x233588['username'];_0x2c4996[_0x2383('0x2d')]=_0x42a53b[_0x2383('0x45')]()===_0x2383('0x46')?_0x501cc9['destcalleridnum']:_0x501cc9[_0x2383('0x47')];_0x2c4996[_0x2383('0x48')]=_0x42a53b==='queue'||_0x42a53b===_0x2383('0x49')?'queue':_0x2383('0x46');if(_0x4df978){_0x2c4996[_0x2383('0x1b')]=_0x4df978[_0x2383('0x4a')];}var _0x16f939=util['format'](_0x2383('0x4b'),_0x233588[_0x2383('0x43')],_0x501cc9[_0x2383('0x4c')],md5(_0x501cc9['uniqueid']));if(_0x15a3e4&&_0x15a3e4[_0x2383('0x4d')]){logger[_0x2383('0x15')](_0x2383('0x4e'),_0x2383('0x4f'));_0x501cc9[_0x2383('0x50')]=_0x16f939;}else if(_0x419917&&_0x419917[_0x2383('0x51')]&&_0x419917['recordingFormat']!==_0x2383('0x52')){logger[_0x2383('0x15')]('[OUTBOUND]',_0x2383('0x4f'));_0x501cc9[_0x2383('0x50')]=_0x16f939;}else{_0x501cc9['recordingURL']='';}return getAdminId(_0x2c4996,_0x42a53b,_0x14e928,_0x2a6534)[_0x2383('0x10')](getUser(_0x42a53b,_0x14e928,_0x2a6534))['then'](getEndUser(_0x42a53b,_0x14e928,_0x2a6534))[_0x2383('0x10')](getTicket(_0x42a53b,_0x14e928,_0x2a6534,_0x1cf5f9,_0x501cc9))[_0x2383('0x10')](function(_0x4322a3){logger[_0x2383('0x15')](util[_0x2383('0x33')](_0x2383('0x53'),_0x4322a3['ticketId']));if(_0x42a53b!==_0x2383('0x49')){logger['info']('['+[_0x42a53b[_0x2383('0x20')]()]+']',_0x2383('0x54'));emit(_0x2a6534,_0x4df978['name'],_0x4322a3[_0x2383('0x2f')]);}})['catch'](function(_0xd1fae){logger[_0x2383('0x18')]('['+[_0x42a53b[_0x2383('0x20')]()]+_0x2383('0x55'),util[_0x2383('0x56')](_0xd1fae,{'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 ac3c583..3114e0e 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 _0x13f6=['includes','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','data1','freshdesk','zoho','desk','unknown\x20integration','error','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','vtiger','dynamics365','freshsales','servicenow'];(function(_0x55d6b8,_0x593e1a){var _0x5ebdc7=function(_0x455461){while(--_0x455461){_0x55d6b8['push'](_0x55d6b8['shift']());}};_0x5ebdc7(++_0x593e1a);}(_0x13f6,0x124));var _0x613f=function(_0x550538,_0x4c1b5b){_0x550538=_0x550538-0x0;var _0x5bd2a5=_0x13f6[_0x550538];return _0x5bd2a5;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x613f('0x2'));var freshdesk=require(_0x613f('0x3'));var zoho=require(_0x613f('0x4'));var desk=require('./desk');var vtiger=require(_0x613f('0x5'));var servicenow=require(_0x613f('0x6'));var dynamics365=require(_0x613f('0x7'));var freshsales=require('./freshsales');var integrations=[_0x613f('0x8'),_0x613f('0x9'),'sugarcrm','freshdesk','zoho','desk',_0x613f('0xa'),_0x613f('0xb'),_0x613f('0xc'),_0x613f('0xd')];exports['exec']=function(_0x1a8dd0,_0x40d7f5,_0xcd514c,_0x5210a0,_0x2622f3,_0x164edf){if(_0xcd514c){if(_[_0x613f('0xe')](integrations,_0x1a8dd0['data1'][_0x613f('0xf')]())){try{var _0xa81fcd=null;var _0x542230='';var _0x4c2a85=_0xcd514c[_0x1a8dd0['data1'][_0x613f('0xf')]()];if(_0x4c2a85){var _0x1ebab5=_0x4c2a85[_0x1a8dd0[_0x613f('0x10')]];if(_0x1ebab5){var _0x375db1=_[_0x613f('0x11')](_0x1ebab5[_0x613f('0x12')],{'id':parseInt(_0x1a8dd0[_0x613f('0x13')],0xa)});if(_0x375db1){if(_0x5210a0){if(_0x2622f3&&_0x40d7f5[_0x613f('0x14')]){_0x542230=_0x613f('0x14');}else if(_0x40d7f5[_0x613f('0x15')]){_0x542230='outbound';}else{console[_0x613f('0x16')]('EVENT\x20UNKNOWN',_0x40d7f5);}}else{_0x542230='unmanaged';}switch(_0x1a8dd0[_0x613f('0x17')][_0x613f('0xf')]()){case'zendesk':zendesk[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0x9'):salesforce[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case'sugarcrm':sugarcrm[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0x18'):freshdesk[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0x19'):zoho[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0x1a'):desk[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0xa'):vtiger[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0xc'):freshsales['cs'](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf,_0x542230);break;case _0x613f('0xd'):servicenow['cs'](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf,_0x542230);break;case'dynamics365':dynamics365['cs'](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf,_0x542230);break;default:console['log'](_0x613f('0x1b'));}}else{_0xa81fcd=require('../../../../config/logger')(_0x1a8dd0['data1'][_0x613f('0xf')]());_0xa81fcd[_0x613f('0x1c')]('[EXEC]',util[_0x613f('0x1d')](_0x613f('0x1e'),_0x1a8dd0[_0x613f('0x17')]['toLowerCase'](),_0x1a8dd0['data3']));}}else{_0xa81fcd=require(_0x613f('0x1f'))(_0x1a8dd0[_0x613f('0x17')][_0x613f('0xf')]());_0xa81fcd['error'](_0x613f('0x20'),util[_0x613f('0x1d')](_0x613f('0x21'),_0x1a8dd0[_0x613f('0x17')][_0x613f('0xf')](),_0x1a8dd0['data2']));}}else{}}catch(_0x30fb15){console[_0x613f('0x1c')](_0x30fb15);}}}}; \ No newline at end of file +var _0xf7b4=['Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshsales','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','lodash','./salesforce','./sugarcrm','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','servicenow','exec','data1','toLowerCase','data2','find'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xf7b4,0x152));var _0x4f7b=function(_0x57ad0d,_0x17b70f){_0x57ad0d=_0x57ad0d-0x0;var _0x5f5bd0=_0xf7b4[_0x57ad0d];return _0x5f5bd0;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0x4f7b('0x1'));var sugarcrm=require(_0x4f7b('0x2'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0x4f7b('0x3'));var vtiger=require(_0x4f7b('0x4'));var servicenow=require(_0x4f7b('0x5'));var dynamics365=require(_0x4f7b('0x6'));var freshsales=require(_0x4f7b('0x7'));var integrations=[_0x4f7b('0x8'),_0x4f7b('0x9'),_0x4f7b('0xa'),_0x4f7b('0xb'),_0x4f7b('0xc'),_0x4f7b('0xd'),_0x4f7b('0xe'),_0x4f7b('0xf'),'freshsales',_0x4f7b('0x10')];exports[_0x4f7b('0x11')]=function(_0x479208,_0xdd1aab,_0x3a3d6c,_0x408e01,_0x119612,_0xd9971a){if(_0x3a3d6c){if(_['includes'](integrations,_0x479208[_0x4f7b('0x12')]['toLowerCase']())){try{var _0x5e5815=null;var _0xd9b349='';var _0x2e8dd9=_0x3a3d6c[_0x479208[_0x4f7b('0x12')][_0x4f7b('0x13')]()];if(_0x2e8dd9){var _0x4f7c2b=_0x2e8dd9[_0x479208[_0x4f7b('0x14')]];if(_0x4f7c2b){var _0x368091=_[_0x4f7b('0x15')](_0x4f7c2b[_0x4f7b('0x16')],{'id':parseInt(_0x479208[_0x4f7b('0x17')],0xa)});if(_0x368091){if(_0x408e01){if(_0x119612&&_0xdd1aab[_0x4f7b('0x18')]){_0xd9b349=_0x4f7b('0x18');}else if(_0xdd1aab[_0x4f7b('0x19')]){_0xd9b349=_0x4f7b('0x1a');}else{console[_0x4f7b('0x1b')](_0x4f7b('0x1c'),_0xdd1aab);}}else{_0xd9b349=_0x4f7b('0x1d');}switch(_0x479208['data1'][_0x4f7b('0x13')]()){case'zendesk':zendesk[_0xd9b349](_0x479208,_0xdd1aab,_0x368091,_0x408e01,_0x119612,_0x4f7c2b,_0xd9971a);break;case'salesforce':salesforce[_0xd9b349](_0x479208,_0xdd1aab,_0x368091,_0x408e01,_0x119612,_0x4f7c2b,_0xd9971a);break;case _0x4f7b('0xa'):sugarcrm[_0xd9b349](_0x479208,_0xdd1aab,_0x368091,_0x408e01,_0x119612,_0x4f7c2b,_0xd9971a);break;case _0x4f7b('0xb'):freshdesk[_0xd9b349](_0x479208,_0xdd1aab,_0x368091,_0x408e01,_0x119612,_0x4f7c2b,_0xd9971a);break;case'zoho':zoho[_0xd9b349](_0x479208,_0xdd1aab,_0x368091,_0x408e01,_0x119612,_0x4f7c2b,_0xd9971a);break;case _0x4f7b('0xd'):desk[_0xd9b349](_0x479208,_0xdd1aab,_0x368091,_0x408e01,_0x119612,_0x4f7c2b,_0xd9971a);break;case _0x4f7b('0xe'):vtiger[_0xd9b349](_0x479208,_0xdd1aab,_0x368091,_0x408e01,_0x119612,_0x4f7c2b,_0xd9971a);break;case _0x4f7b('0x1e'):freshsales['cs'](_0x479208,_0xdd1aab,_0x368091,_0x408e01,_0x119612,_0x4f7c2b,_0xd9971a,_0xd9b349);break;case _0x4f7b('0x10'):servicenow['cs'](_0x479208,_0xdd1aab,_0x368091,_0x408e01,_0x119612,_0x4f7c2b,_0xd9971a,_0xd9b349);break;case'dynamics365':dynamics365['cs'](_0x479208,_0xdd1aab,_0x368091,_0x408e01,_0x119612,_0x4f7c2b,_0xd9971a,_0xd9b349);break;default:console[_0x4f7b('0x1b')]('unknown\x20integration');}}else{_0x5e5815=require(_0x4f7b('0x1f'))(_0x479208[_0x4f7b('0x12')][_0x4f7b('0x13')]());_0x5e5815[_0x4f7b('0x20')](_0x4f7b('0x21'),util[_0x4f7b('0x22')](_0x4f7b('0x23'),_0x479208[_0x4f7b('0x12')][_0x4f7b('0x13')](),_0x479208['data3']));}}else{_0x5e5815=require(_0x4f7b('0x1f'))(_0x479208[_0x4f7b('0x12')][_0x4f7b('0x13')]());_0x5e5815['error'](_0x4f7b('0x21'),util[_0x4f7b('0x22')]('%s\x20account\x20#%s\x20not\x20found',_0x479208[_0x4f7b('0x12')]['toLowerCase'](),_0x479208[_0x4f7b('0x14')]));}}else{}}catch(_0x2429be){console[_0x4f7b('0x20')](_0x2429be);}}}}; \ 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 1c0f075..447d7f4 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 _0x9698=['defaults','localhost','socket.io-emitter','emit','ticketType','Task','assign','utc','Subjects','getString','Case','Descriptions','ContactId','sobject','create','isNil','validateEmail','User','find','execute','Email','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','length','Lead','lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','forEach','type','string','idField','content','toString','variableName','customVariable','Variable','toLowerCase','name','password','concat','securityToken','Connection','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','toUpperCase','calleridname','lastevent',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis'];(function(_0x5a4e1f,_0xf6865b){var _0x58117b=function(_0x2974af){while(--_0x2974af){_0x5a4e1f['push'](_0x5a4e1f['shift']());}};_0x58117b(++_0xf6865b);}(_0x9698,0x148));var _0x8969=function(_0x340b17,_0x15f13b){_0x340b17=_0x340b17-0x0;var _0xf14622=_0x9698[_0x340b17];return _0xf14622;};'use strict';var _=require('lodash');var rp=require(_0x8969('0x0'));var moment=require(_0x8969('0x1'));var BPromise=require(_0x8969('0x2'));var md5=require(_0x8969('0x3'));var jsforce=require(_0x8969('0x4'));var util=require(_0x8969('0x5'));var Redis=require(_0x8969('0x6'));var intUtil=require('./util');var config=require(_0x8969('0x7'));var logger=require(_0x8969('0x8'))(_0x8969('0x9'));config[_0x8969('0xa')]=_[_0x8969('0xb')](config['redis'],{'host':_0x8969('0xc'),'port':0x18eb});var io=require(_0x8969('0xd'))(new Redis(config[_0x8969('0xa')]));function emit(_0x28dfae,_0xce88e5,_0x333e72){io['to'](_0x28dfae)[_0x8969('0xe')](_0xce88e5,_0x333e72);}function getTicket(_0x4977f4,_0x31d38d,_0x583fb4,_0x391cf0,_0x5dfee5,_0x3c02dd,_0x2f3415,_0x4b32f0){var _0x5961d0={};if(_0x391cf0[_0x8969('0xf')]===_0x8969('0x10')){_0x5961d0=Object[_0x8969('0x11')]({},{'OwnerId':_0x31d38d['id'],'ActivityDate':moment[_0x8969('0x12')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x391cf0[_0x8969('0x13')],_0x5dfee5,'\x20'),'Description':intUtil[_0x8969('0x14')](_0x391cf0['Descriptions'],_0x5dfee5,'\x0a')},getCustomFields(_0x3c02dd,_0x5dfee5));if(_0x583fb4){_0x5961d0['WhoId']=_0x583fb4['id'];}}else if(_0x391cf0['ticketType']===_0x8969('0x15')){_0x5961d0=Object[_0x8969('0x11')]({},{'OwnerId':_0x31d38d['id'],'Subject':intUtil[_0x8969('0x14')](_0x391cf0[_0x8969('0x13')],_0x5dfee5,'\x20'),'Description':intUtil[_0x8969('0x14')](_0x391cf0[_0x8969('0x16')],_0x5dfee5,'\x0a')},getCustomFields(_0x3c02dd,_0x5dfee5));if(_0x583fb4){_0x5961d0[_0x8969('0x17')]=_0x583fb4['id'];}}return _0x2f3415[_0x8969('0x18')](_0x391cf0[_0x8969('0xf')])[_0x8969('0x19')](_0x5961d0);}function getUser(_0x141b0c,_0xff6d5c,_0x2933d0){if(!_[_0x8969('0x1a')](_0xff6d5c)&&intUtil[_0x8969('0x1b')](_0xff6d5c)){var _0x97a27={'Email':_0xff6d5c};var _0x293ced={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2933d0[_0x8969('0x18')](_0x8969('0x1c'))[_0x8969('0x1d')](_0x97a27,_0x293ced)[_0x8969('0x1e')]()['then'](function(_0x599288){if(_0x599288['length']){var _0x42f3f8=_[_0x8969('0x1d')](_0x599288,function(_0x2f769c){return _0x2f769c[_0x8969('0x1f')]===_0xff6d5c;});if(_0x42f3f8){logger['info'](_0x8969('0x20'),_0xff6d5c);return BPromise[_0x8969('0x21')]({'id':_0x42f3f8['Id'],'name':_0x42f3f8[_0x8969('0x22')]});}}else{logger[_0x8969('0x23')](_0x8969('0x24'),_0xff6d5c);return _0x2933d0[_0x8969('0x25')]()[_0x8969('0x26')](function(_0x3bc361){return BPromise[_0x8969('0x21')]({'id':_0x3bc361[_0x8969('0x27')],'name':_0x3bc361['display_name']});});}});}else{logger[_0x8969('0x23')](_0x8969('0x24'),_0xff6d5c);return _0x2933d0['identity']()[_0x8969('0x26')](function(_0x1d5671){return BPromise[_0x8969('0x21')]({'id':_0x1d5671[_0x8969('0x27')],'name':_0x1d5671[_0x8969('0x28')]});});}}function getEndUser(_0x26f9e3,_0x53b78c,_0x92eaa1,_0x30fe29,_0x4b3830){var _0x479160={'Phone':_0x30fe29};var _0xe5abd9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x8969('0x26')](function(){if(_0x53b78c[_0x8969('0xf')]===_0x8969('0x10')){logger[_0x8969('0x23')](_0x8969('0x29'),_0x30fe29,_0x53b78c[_0x8969('0x2a')]);switch(_0x53b78c[_0x8969('0x2a')]){case _0x8969('0x2b'):return _0x4b3830[_0x8969('0x18')](_0x8969('0x2c'))[_0x8969('0x1d')](_0x479160,_0xe5abd9)[_0x8969('0x1e')]()[_0x8969('0x26')](function(_0x3509d6){if(_0x3509d6&&_0x3509d6[_0x8969('0x2d')]){return _0x3509d6;}else{return _0x4b3830['sobject'](_0x8969('0x2e'))[_0x8969('0x1d')](_0x479160,_0xe5abd9);}});case'contact':return _0x4b3830[_0x8969('0x18')](_0x8969('0x2c'))[_0x8969('0x1d')](_0x479160,_0xe5abd9)['execute']();case _0x8969('0x2f'):return _0x4b3830[_0x8969('0x18')](_0x8969('0x2e'))[_0x8969('0x1d')](_0x479160,_0xe5abd9);default:return null;}}else if(_0x53b78c['ticketType']===_0x8969('0x15')){logger[_0x8969('0x23')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x30fe29,_0x8969('0x30'));return _0x4b3830['sobject'](_0x8969('0x2c'))[_0x8969('0x1d')](_0x479160,_0xe5abd9)['execute']();}})['then'](function(_0x3903f5){if(_0x3903f5&&_0x3903f5[_0x8969('0x2d')]){var _0x5dfd57=_[_0x8969('0x1d')](_0x3903f5,function(_0xd70119){return _0xd70119[_0x8969('0x31')]===_0x30fe29;});if(_0x5dfd57){return BPromise[_0x8969('0x21')]({'id':_0x5dfd57['Id'],'name':_0x5dfd57[_0x8969('0x22')],'phone':_0x5dfd57['Phone']});}}})['then'](function(_0x5e7ce9){if(_0x5e7ce9){logger[_0x8969('0x23')]('Enduser\x20with\x20phone\x20%s\x20found.',_0x30fe29);return BPromise[_0x8969('0x21')](_0x5e7ce9);}else{logger['info'](_0x8969('0x32'),_0x30fe29);var _0x10f7e8={'LastName':_0x92eaa1!==''?_0x92eaa1:util[_0x8969('0x33')](_0x8969('0x34'),_0x30fe29),'Phone':_0x30fe29};if(_0x53b78c[_0x8969('0x35')]){if(_0x53b78c['moduleCreate']===_0x8969('0x30')){logger[_0x8969('0x23')](_0x8969('0x36'),_0x30fe29,_0x53b78c[_0x8969('0x35')]);}else if(_0x53b78c[_0x8969('0x35')]===_0x8969('0x2f')&&_0x53b78c[_0x8969('0xf')]===_0x8969('0x10')){logger['info'](_0x8969('0x36'),_0x30fe29,_0x53b78c[_0x8969('0x35')]);_0x10f7e8[_0x8969('0x37')]=_0x8969('0x38');}else{return null;}}return _0x4b3830['sobject'](_['upperFirst'](_0x53b78c['moduleCreate']))[_0x8969('0x19')](_0x10f7e8);}});}function getCustomFields(_0x3930a0,_0x449377){var _0x9a0e64={};if(_0x3930a0[_0x8969('0x2d')]>0x0){_[_0x8969('0x39')](_0x3930a0,function(_0x4e43a2){if(_0x4e43a2[_0x8969('0x3a')]===_0x8969('0x3b')&&_0x4e43a2['idField']){_0x9a0e64[_0x4e43a2[_0x8969('0x3c')]]=_0x4e43a2[_0x8969('0x3d')][_0x8969('0x3e')]();}else if(_0x4e43a2[_0x8969('0x3a')]==='variable'&&_0x4e43a2[_0x8969('0x3f')]&&_0x4e43a2[_0x8969('0x3c')]){_0x449377[_0x4e43a2[_0x8969('0x3f')]]&&(_0x9a0e64[_0x4e43a2[_0x8969('0x3c')]]=_0x449377[_0x4e43a2[_0x8969('0x3f')]]['toString']());}else if(_0x4e43a2[_0x8969('0x3a')]===_0x8969('0x40')&&_0x4e43a2[_0x8969('0x41')]&&_0x4e43a2[_0x8969('0x41')]['name']&&_0x4e43a2['idField']){_0x449377[_0x4e43a2[_0x8969('0x41')]['name'][_0x8969('0x42')]()]&&(_0x9a0e64[_0x4e43a2[_0x8969('0x3c')]]=_0x449377[_0x4e43a2['Variable'][_0x8969('0x43')][_0x8969('0x42')]()][_0x8969('0x3e')]());}});}return _0x9a0e64;}function getConnection(_0x5aa369){var _0xe50795=_0x5aa369[_0x8969('0x44')][_0x8969('0x45')](_0x5aa369[_0x8969('0x46')]);var _0x28b0ba=new jsforce[(_0x8969('0x47'))]({'oauth2':{'loginUrl':_0x5aa369[_0x8969('0x48')]||'https://login.salesforce.com','clientId':_0x5aa369[_0x8969('0x49')],'clientSecret':_0x5aa369[_0x8969('0x4a')]}});return _0x28b0ba[_0x8969('0x4b')](_0x5aa369[_0x8969('0x4c')],_0xe50795)[_0x8969('0x26')](function(){logger[_0x8969('0x23')](_0x8969('0x4d'));return _0x28b0ba;});}exports[_0x8969('0x4e')]=function(_0x524790,_0x2107b9,_0x28b6f8,_0x4f21f3,_0x571623,_0xd589fc){var _0x57ff4e,_0x212fdb,_0x4f6645,_0x4fc420;_0xd589fc['serverUrl']=intUtil['stripTrailingSlash'](_0xd589fc['serverUrl']);_0xd589fc[_0x8969('0x48')]=intUtil[_0x8969('0x4f')](_0xd589fc['remoteUri']);if(_0x571623&&_0x571623[_0x8969('0x50')]){logger[_0x8969('0x23')](_0x8969('0x51'),_0x8969('0x52'));_0x2107b9[_0x8969('0x53')]=util[_0x8969('0x33')](_0x8969('0x54'),_0xd589fc[_0x8969('0x55')],_0x2107b9[_0x8969('0x56')],md5(_0x2107b9['uniqueid']));}else{_0x2107b9['recordingURL']='';}return getConnection(_0xd589fc)['then'](function(_0x51f5cc){_0x4fc420=_0x51f5cc;return getUser(_0xd589fc,_0x4f21f3[_0x8969('0x57')],_0x4fc420);})[_0x8969('0x26')](function(_0xa06262){_0x57ff4e=_0xa06262;return getEndUser(_0xd589fc,_0x28b6f8,_0x2107b9['calleridname'],_0x2107b9[_0x8969('0x58')],_0x4fc420);})['then'](function(_0x24cfc3){_0x212fdb=_0x24cfc3;return getTicket(_0xd589fc,_0x57ff4e,_0x212fdb,_0x28b6f8,_0x2107b9,_0x28b6f8[_0x8969('0x59')],_0x4fc420,_0x8969('0x4e'));})[_0x8969('0x26')](function(_0x49d12c){_0x4f6645=_0x49d12c;logger[_0x8969('0x23')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x4f6645['id']);logger[_0x8969('0x23')](_0x8969('0x5a'),_0x4f6645['id'],_0x4f21f3[_0x8969('0x43')],_0xd589fc[_0x8969('0x3a')]);switch(_0xd589fc[_0x8969('0x3a')]){case _0x8969('0x5b'):emit(util[_0x8969('0x33')]('user:%s',_0x4f21f3[_0x8969('0x43')]),_0x8969('0x5c'),{'recordId':_0x4f6645['id']});break;case _0x8969('0x5d'):emit(util[_0x8969('0x33')](_0x8969('0x5e'),_0x4f21f3[_0x8969('0x43')]),'trigger:browser:url',{'uri':util[_0x8969('0x33')](_0x8969('0x5f'),_0x4fc420[_0x8969('0x60')],_0x4f6645['id'])});break;default:logger[_0x8969('0x61')](_0x8969('0x62'));}})[_0x8969('0x63')](function(_0x5f320e){logger[_0x8969('0x61')](_0x8969('0x51'),JSON[_0x8969('0x64')](_0x5f320e));});};exports[_0x8969('0x65')]=function(_0x4b287b,_0x5e6f73,_0x258126,_0x3c8684,_0x567826,_0x4dab8d,_0x34a98f){var _0x4ad733,_0x274240,_0x76031f,_0x1ff504;_0x4dab8d['serverUrl']=intUtil[_0x8969('0x4f')](_0x4dab8d[_0x8969('0x55')]);_0x4dab8d['remoteUri']=intUtil[_0x8969('0x4f')](_0x4dab8d[_0x8969('0x48')]);if(_0x34a98f&&_0x34a98f[_0x8969('0x66')]&&_0x34a98f[_0x8969('0x66')]!==_0x8969('0x67')){logger['info'](_0x8969('0x68'),_0x8969('0x52'));_0x5e6f73['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4dab8d[_0x8969('0x55')],_0x5e6f73[_0x8969('0x56')],md5(_0x5e6f73['uniqueid']));}return getConnection(_0x4dab8d)['then'](function(_0x2b83b4){_0x1ff504=_0x2b83b4;return getUser(_0x4dab8d,_0x3c8684[_0x8969('0x57')],_0x1ff504);})['then'](function(_0x29f3cb){_0x4ad733=_0x29f3cb;return getEndUser(_0x4dab8d,_0x258126,_0x5e6f73['destcalleridname'],_0x5e6f73[_0x8969('0x69')],_0x1ff504);})[_0x8969('0x26')](function(_0x4fdace){_0x274240=_0x4fdace;return getTicket(_0x4dab8d,_0x4ad733,_0x274240,_0x258126,_0x5e6f73,_0x258126[_0x8969('0x59')],_0x1ff504,'outbound');})[_0x8969('0x26')](function(_0x4d6365){_0x76031f=_0x4d6365;logger[_0x8969('0x23')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x76031f['id']);logger[_0x8969('0x23')](_0x8969('0x6a'),_0x76031f['id'],_0x3c8684[_0x8969('0x43')],_0x4dab8d[_0x8969('0x3a')]);switch(_0x4dab8d[_0x8969('0x3a')]){case'integrationTab':emit(util[_0x8969('0x33')](_0x8969('0x5e'),_0x3c8684[_0x8969('0x43')]),_0x8969('0x5c'),{'recordId':_0x76031f['id']});break;case'newTab':emit(util[_0x8969('0x33')]('user:%s',_0x3c8684['name']),_0x8969('0x6b'),{'uri':util[_0x8969('0x33')](_0x8969('0x5f'),_0x1ff504[_0x8969('0x60')],_0x76031f['id'])});break;default:logger['error'](_0x8969('0x68'),_0x8969('0x6c'));}})[_0x8969('0x63')](function(_0x29e320){logger[_0x8969('0x61')]('[OUTBOUND]',JSON[_0x8969('0x64')](_0x29e320));});};exports['unmanaged']=function(_0x26ede6,_0x23577d,_0x3e2ce5,_0x5cd303,_0x43e5bf,_0x917f50){var _0x1bd5a3,_0x399b07,_0x38a734,_0x57b4e5;_0x917f50['serverUrl']=intUtil[_0x8969('0x4f')](_0x917f50[_0x8969('0x55')]);_0x917f50[_0x8969('0x48')]=intUtil[_0x8969('0x4f')](_0x917f50[_0x8969('0x48')]);if(_0x43e5bf&&_0x43e5bf['monitor_format']){logger[_0x8969('0x23')]('['+_0x23577d['lastevent'][_0x8969('0x6d')]()+']','Recording\x20is\x20enabled!');_0x23577d['recordingURL']=util[_0x8969('0x33')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x917f50[_0x8969('0x55')],_0x23577d[_0x8969('0x56')],md5(_0x23577d[_0x8969('0x56')]));}else{_0x23577d[_0x8969('0x53')]='';}return getConnection(_0x917f50)[_0x8969('0x26')](function(_0x54fecd){_0x57b4e5=_0x54fecd;if(!_[_0x8969('0x1a')](_0x5cd303)){return getUser(_0x917f50,_0x5cd303['name'],_0x57b4e5);}else{return getUser(_0x917f50,null,_0x57b4e5);}})['then'](function(_0x34af61){_0x1bd5a3=_0x34af61;return getEndUser(_0x917f50,_0x3e2ce5,_0x23577d[_0x8969('0x6e')],_0x23577d[_0x8969('0x58')],_0x57b4e5);})[_0x8969('0x26')](function(_0x1a1b1a){_0x399b07=_0x1a1b1a;return getTicket(_0x917f50,_0x1bd5a3,_0x399b07,_0x3e2ce5,_0x23577d,_0x3e2ce5[_0x8969('0x59')],_0x57b4e5);})[_0x8969('0x26')](function(_0x59a6fa){_0x38a734=_0x59a6fa;logger[_0x8969('0x23')]('['+_0x23577d['lastevent'][_0x8969('0x6d')]()+']\x20Ticket\x20%s\x20created.',_0x38a734['id']);logger['info']('['+_0x23577d[_0x8969('0x6f')][_0x8969('0x6d')]()+_0x8969('0x70'),_0x917f50['type']);})[_0x8969('0x63')](function(_0x189e3f){logger[_0x8969('0x61')]('['+_0x23577d[_0x8969('0x6f')][_0x8969('0x6d')]()+']',JSON[_0x8969('0x64')](_0x189e3f));});}; \ No newline at end of file +var _0xbebc=['name','toLowerCase','clientId','login','username','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','Recording\x20is\x20enabled!','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','[QUEUE]','stringify','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','ticketType','Task','assign','utc','getString','WhoId','Descriptions','ContactId','create','isNil','User','then','length','find','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','sobject','Contact','execute','Lead','contact','lead','Case','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','Company','upperFirst','forEach','type','idField','content','toString','variable','variableName','customVariable','Variable'];(function(_0x5a2aa2,_0x44741a){var _0x2bdce7=function(_0x1d0fe4){while(--_0x1d0fe4){_0x5a2aa2['push'](_0x5a2aa2['shift']());}};_0x2bdce7(++_0x44741a);}(_0xbebc,0x163));var _0xcbeb=function(_0x43777d,_0x3f00bb){_0x43777d=_0x43777d-0x0;var _0x3841e1=_0xbebc[_0x43777d];return _0x3841e1;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcbeb('0x0'));var md5=require(_0xcbeb('0x1'));var jsforce=require(_0xcbeb('0x2'));var util=require('util');var Redis=require(_0xcbeb('0x3'));var intUtil=require(_0xcbeb('0x4'));var config=require(_0xcbeb('0x5'));var logger=require(_0xcbeb('0x6'))(_0xcbeb('0x7'));config[_0xcbeb('0x8')]=_[_0xcbeb('0x9')](config[_0xcbeb('0x8')],{'host':_0xcbeb('0xa'),'port':0x18eb});var io=require(_0xcbeb('0xb'))(new Redis(config['redis']));function emit(_0x1db3fa,_0x2c079d,_0x2a2f4f){io['to'](_0x1db3fa)['emit'](_0x2c079d,_0x2a2f4f);}function getTicket(_0xda6683,_0x26f486,_0xca5c02,_0x52acda,_0x5624a8,_0x5f5c3b,_0xe1a574,_0x2464a2){var _0x5a72cb={};if(_0x52acda[_0xcbeb('0xc')]===_0xcbeb('0xd')){_0x5a72cb=Object[_0xcbeb('0xe')]({},{'OwnerId':_0x26f486['id'],'ActivityDate':moment[_0xcbeb('0xf')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xcbeb('0x10')](_0x52acda['Subjects'],_0x5624a8,'\x20'),'Description':intUtil['getString'](_0x52acda['Descriptions'],_0x5624a8,'\x0a')},getCustomFields(_0x5f5c3b,_0x5624a8));if(_0xca5c02){_0x5a72cb[_0xcbeb('0x11')]=_0xca5c02['id'];}}else if(_0x52acda[_0xcbeb('0xc')]==='Case'){_0x5a72cb=Object['assign']({},{'OwnerId':_0x26f486['id'],'Subject':intUtil[_0xcbeb('0x10')](_0x52acda['Subjects'],_0x5624a8,'\x20'),'Description':intUtil[_0xcbeb('0x10')](_0x52acda[_0xcbeb('0x12')],_0x5624a8,'\x0a')},getCustomFields(_0x5f5c3b,_0x5624a8));if(_0xca5c02){_0x5a72cb[_0xcbeb('0x13')]=_0xca5c02['id'];}}return _0xe1a574['sobject'](_0x52acda[_0xcbeb('0xc')])[_0xcbeb('0x14')](_0x5a72cb);}function getUser(_0x453ca8,_0x86e28a,_0x57b24b){if(!_[_0xcbeb('0x15')](_0x86e28a)&&intUtil['validateEmail'](_0x86e28a)){var _0x5b8da8={'Email':_0x86e28a};var _0x1a1040={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x57b24b['sobject'](_0xcbeb('0x16'))['find'](_0x5b8da8,_0x1a1040)['execute']()[_0xcbeb('0x17')](function(_0x636771){if(_0x636771[_0xcbeb('0x18')]){var _0x3a58c0=_[_0xcbeb('0x19')](_0x636771,function(_0x36f93e){return _0x36f93e[_0xcbeb('0x1a')]===_0x86e28a;});if(_0x3a58c0){logger[_0xcbeb('0x1b')](_0xcbeb('0x1c'),_0x86e28a);return BPromise[_0xcbeb('0x1d')]({'id':_0x3a58c0['Id'],'name':_0x3a58c0[_0xcbeb('0x1e')]});}}else{logger[_0xcbeb('0x1b')](_0xcbeb('0x1f'),_0x86e28a);return _0x57b24b[_0xcbeb('0x20')]()[_0xcbeb('0x17')](function(_0x1f35e0){return BPromise[_0xcbeb('0x1d')]({'id':_0x1f35e0[_0xcbeb('0x21')],'name':_0x1f35e0[_0xcbeb('0x22')]});});}});}else{logger['info'](_0xcbeb('0x1f'),_0x86e28a);return _0x57b24b['identity']()[_0xcbeb('0x17')](function(_0x1b1e93){return BPromise['resolve']({'id':_0x1b1e93[_0xcbeb('0x21')],'name':_0x1b1e93[_0xcbeb('0x22')]});});}}function getEndUser(_0x1d58b3,_0x7b1bd3,_0x2eaf1a,_0x18c6cf,_0x47d672){var _0x44db1c={'Phone':_0x18c6cf};var _0x56d2e9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xcbeb('0x1d')]()[_0xcbeb('0x17')](function(){if(_0x7b1bd3['ticketType']===_0xcbeb('0xd')){logger[_0xcbeb('0x1b')](_0xcbeb('0x23'),_0x18c6cf,_0x7b1bd3[_0xcbeb('0x24')]);switch(_0x7b1bd3[_0xcbeb('0x24')]){case _0xcbeb('0x25'):return _0x47d672[_0xcbeb('0x26')](_0xcbeb('0x27'))['find'](_0x44db1c,_0x56d2e9)[_0xcbeb('0x28')]()[_0xcbeb('0x17')](function(_0x4329fb){if(_0x4329fb&&_0x4329fb[_0xcbeb('0x18')]){return _0x4329fb;}else{return _0x47d672[_0xcbeb('0x26')](_0xcbeb('0x29'))['find'](_0x44db1c,_0x56d2e9);}});case _0xcbeb('0x2a'):return _0x47d672[_0xcbeb('0x26')]('Contact')[_0xcbeb('0x19')](_0x44db1c,_0x56d2e9)['execute']();case _0xcbeb('0x2b'):return _0x47d672[_0xcbeb('0x26')]('Lead')['find'](_0x44db1c,_0x56d2e9);default:return null;}}else if(_0x7b1bd3[_0xcbeb('0xc')]===_0xcbeb('0x2c')){logger[_0xcbeb('0x1b')](_0xcbeb('0x23'),_0x18c6cf,_0xcbeb('0x2a'));return _0x47d672[_0xcbeb('0x26')](_0xcbeb('0x27'))['find'](_0x44db1c,_0x56d2e9)['execute']();}})[_0xcbeb('0x17')](function(_0x3f70be){if(_0x3f70be&&_0x3f70be[_0xcbeb('0x18')]){var _0xf23011=_[_0xcbeb('0x19')](_0x3f70be,function(_0x10b09e){return _0x10b09e['Phone']===_0x18c6cf;});if(_0xf23011){return BPromise[_0xcbeb('0x1d')]({'id':_0xf23011['Id'],'name':_0xf23011['Name'],'phone':_0xf23011['Phone']});}}})[_0xcbeb('0x17')](function(_0x1aa643){if(_0x1aa643){logger[_0xcbeb('0x1b')](_0xcbeb('0x2d'),_0x18c6cf);return BPromise[_0xcbeb('0x1d')](_0x1aa643);}else{logger[_0xcbeb('0x1b')](_0xcbeb('0x2e'),_0x18c6cf);var _0x1570d4={'LastName':_0x2eaf1a!==_0xcbeb('0x2f')?_0x2eaf1a:util['format']('Caller\x20-\x20%s',_0x18c6cf),'Phone':_0x18c6cf};if(_0x7b1bd3['moduleCreate']){if(_0x7b1bd3['moduleCreate']===_0xcbeb('0x2a')){logger[_0xcbeb('0x1b')](_0xcbeb('0x30'),_0x18c6cf,_0x7b1bd3[_0xcbeb('0x31')]);}else if(_0x7b1bd3[_0xcbeb('0x31')]==='lead'&&_0x7b1bd3[_0xcbeb('0xc')]===_0xcbeb('0xd')){logger[_0xcbeb('0x1b')](_0xcbeb('0x30'),_0x18c6cf,_0x7b1bd3[_0xcbeb('0x31')]);_0x1570d4[_0xcbeb('0x32')]='No\x20Company';}else{return null;}}return _0x47d672[_0xcbeb('0x26')](_[_0xcbeb('0x33')](_0x7b1bd3[_0xcbeb('0x31')]))[_0xcbeb('0x14')](_0x1570d4);}});}function getCustomFields(_0x765e1f,_0x40485b){var _0x52724a={};if(_0x765e1f[_0xcbeb('0x18')]>0x0){_[_0xcbeb('0x34')](_0x765e1f,function(_0x20e374){if(_0x20e374[_0xcbeb('0x35')]==='string'&&_0x20e374[_0xcbeb('0x36')]){_0x52724a[_0x20e374[_0xcbeb('0x36')]]=_0x20e374[_0xcbeb('0x37')][_0xcbeb('0x38')]();}else if(_0x20e374[_0xcbeb('0x35')]===_0xcbeb('0x39')&&_0x20e374[_0xcbeb('0x3a')]&&_0x20e374[_0xcbeb('0x36')]){_0x40485b[_0x20e374[_0xcbeb('0x3a')]]&&(_0x52724a[_0x20e374[_0xcbeb('0x36')]]=_0x40485b[_0x20e374['variableName']][_0xcbeb('0x38')]());}else if(_0x20e374[_0xcbeb('0x35')]===_0xcbeb('0x3b')&&_0x20e374[_0xcbeb('0x3c')]&&_0x20e374[_0xcbeb('0x3c')][_0xcbeb('0x3d')]&&_0x20e374[_0xcbeb('0x36')]){_0x40485b[_0x20e374[_0xcbeb('0x3c')][_0xcbeb('0x3d')][_0xcbeb('0x3e')]()]&&(_0x52724a[_0x20e374[_0xcbeb('0x36')]]=_0x40485b[_0x20e374[_0xcbeb('0x3c')][_0xcbeb('0x3d')]['toLowerCase']()]['toString']());}});}return _0x52724a;}function getConnection(_0x50f4c7){var _0x4d04d0=_0x50f4c7['password']['concat'](_0x50f4c7['securityToken']);var _0x2b4b23=new jsforce['Connection']({'oauth2':{'loginUrl':_0x50f4c7['remoteUri']||'https://login.salesforce.com','clientId':_0x50f4c7[_0xcbeb('0x3f')],'clientSecret':_0x50f4c7['clientSecret']}});return _0x2b4b23[_0xcbeb('0x40')](_0x50f4c7[_0xcbeb('0x41')],_0x4d04d0)[_0xcbeb('0x17')](function(){logger[_0xcbeb('0x1b')]('Connection\x20established.');return _0x2b4b23;});}exports[_0xcbeb('0x42')]=function(_0x5ddc1a,_0x9c6dae,_0x7c4c0d,_0x31de4f,_0xaceb9b,_0x4feedd){var _0x42fd99,_0x155082,_0x2fd259,_0x1aea9b;_0x4feedd[_0xcbeb('0x43')]=intUtil[_0xcbeb('0x44')](_0x4feedd[_0xcbeb('0x43')]);_0x4feedd[_0xcbeb('0x45')]=intUtil['stripTrailingSlash'](_0x4feedd[_0xcbeb('0x45')]);if(_0xaceb9b&&_0xaceb9b[_0xcbeb('0x46')]){logger[_0xcbeb('0x1b')]('[QUEUE]',_0xcbeb('0x47'));_0x9c6dae[_0xcbeb('0x48')]=util[_0xcbeb('0x49')](_0xcbeb('0x4a'),_0x4feedd[_0xcbeb('0x43')],_0x9c6dae[_0xcbeb('0x4b')],md5(_0x9c6dae[_0xcbeb('0x4b')]));}else{_0x9c6dae[_0xcbeb('0x48')]='';}return getConnection(_0x4feedd)[_0xcbeb('0x17')](function(_0x1ee1e7){_0x1aea9b=_0x1ee1e7;return getUser(_0x4feedd,_0x31de4f['email'],_0x1aea9b);})['then'](function(_0x335865){_0x42fd99=_0x335865;return getEndUser(_0x4feedd,_0x7c4c0d,_0x9c6dae[_0xcbeb('0x4c')],_0x9c6dae[_0xcbeb('0x4d')],_0x1aea9b);})[_0xcbeb('0x17')](function(_0x57a5d0){_0x155082=_0x57a5d0;return getTicket(_0x4feedd,_0x42fd99,_0x155082,_0x7c4c0d,_0x9c6dae,_0x7c4c0d[_0xcbeb('0x4e')],_0x1aea9b,_0xcbeb('0x42'));})[_0xcbeb('0x17')](function(_0x5c651){_0x2fd259=_0x5c651;logger[_0xcbeb('0x1b')](_0xcbeb('0x4f'),_0x2fd259['id']);logger[_0xcbeb('0x1b')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2fd259['id'],_0x31de4f[_0xcbeb('0x3d')],_0x4feedd[_0xcbeb('0x35')]);switch(_0x4feedd[_0xcbeb('0x35')]){case'integrationTab':emit(util['format'](_0xcbeb('0x50'),_0x31de4f['name']),'trigger:salesforce:display',{'recordId':_0x2fd259['id']});break;case'newTab':emit(util[_0xcbeb('0x49')]('user:%s',_0x31de4f[_0xcbeb('0x3d')]),_0xcbeb('0x51'),{'uri':util[_0xcbeb('0x49')](_0xcbeb('0x52'),_0x1aea9b[_0xcbeb('0x53')],_0x2fd259['id'])});break;default:logger[_0xcbeb('0x54')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xcbeb('0x55')](function(_0x43153f){logger[_0xcbeb('0x54')](_0xcbeb('0x56'),JSON[_0xcbeb('0x57')](_0x43153f));});};exports[_0xcbeb('0x58')]=function(_0x82c70c,_0xd274a3,_0x309e2c,_0x42482e,_0x426e81,_0xfbcfcb,_0x157115){var _0x283da4,_0x14c17c,_0x3c6fac,_0x423af1;_0xfbcfcb['serverUrl']=intUtil['stripTrailingSlash'](_0xfbcfcb[_0xcbeb('0x43')]);_0xfbcfcb[_0xcbeb('0x45')]=intUtil['stripTrailingSlash'](_0xfbcfcb[_0xcbeb('0x45')]);if(_0x157115&&_0x157115[_0xcbeb('0x59')]&&_0x157115['recordingFormat']!==_0xcbeb('0x5a')){logger[_0xcbeb('0x1b')](_0xcbeb('0x5b'),'Recording\x20is\x20enabled!');_0xd274a3['recordingURL']=util[_0xcbeb('0x49')](_0xcbeb('0x4a'),_0xfbcfcb[_0xcbeb('0x43')],_0xd274a3[_0xcbeb('0x4b')],md5(_0xd274a3[_0xcbeb('0x4b')]));}return getConnection(_0xfbcfcb)[_0xcbeb('0x17')](function(_0x4cc609){_0x423af1=_0x4cc609;return getUser(_0xfbcfcb,_0x42482e[_0xcbeb('0x5c')],_0x423af1);})['then'](function(_0x29027b){_0x283da4=_0x29027b;return getEndUser(_0xfbcfcb,_0x309e2c,_0xd274a3[_0xcbeb('0x5d')],_0xd274a3[_0xcbeb('0x5e')],_0x423af1);})['then'](function(_0x8b4561){_0x14c17c=_0x8b4561;return getTicket(_0xfbcfcb,_0x283da4,_0x14c17c,_0x309e2c,_0xd274a3,_0x309e2c['Fields'],_0x423af1,'outbound');})[_0xcbeb('0x17')](function(_0x442062){_0x3c6fac=_0x442062;logger['info'](_0xcbeb('0x5f'),_0x3c6fac['id']);logger[_0xcbeb('0x1b')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3c6fac['id'],_0x42482e[_0xcbeb('0x3d')],_0xfbcfcb[_0xcbeb('0x35')]);switch(_0xfbcfcb[_0xcbeb('0x35')]){case _0xcbeb('0x60'):emit(util[_0xcbeb('0x49')](_0xcbeb('0x50'),_0x42482e['name']),_0xcbeb('0x61'),{'recordId':_0x3c6fac['id']});break;case'newTab':emit(util[_0xcbeb('0x49')](_0xcbeb('0x50'),_0x42482e[_0xcbeb('0x3d')]),_0xcbeb('0x51'),{'uri':util[_0xcbeb('0x49')](_0xcbeb('0x52'),_0x423af1[_0xcbeb('0x53')],_0x3c6fac['id'])});break;default:logger[_0xcbeb('0x54')](_0xcbeb('0x5b'),_0xcbeb('0x62'));}})[_0xcbeb('0x55')](function(_0x26b08d){logger['error'](_0xcbeb('0x5b'),JSON['stringify'](_0x26b08d));});};exports[_0xcbeb('0x63')]=function(_0x34f640,_0x20d6b9,_0x34831d,_0x5d0db1,_0x76448,_0x5b21fe){var _0x4ae226,_0xdb4237,_0x1c7e7c,_0x4bcb21;_0x5b21fe['serverUrl']=intUtil['stripTrailingSlash'](_0x5b21fe['serverUrl']);_0x5b21fe[_0xcbeb('0x45')]=intUtil[_0xcbeb('0x44')](_0x5b21fe[_0xcbeb('0x45')]);if(_0x76448&&_0x76448[_0xcbeb('0x46')]){logger[_0xcbeb('0x1b')]('['+_0x20d6b9[_0xcbeb('0x64')][_0xcbeb('0x65')]()+']',_0xcbeb('0x47'));_0x20d6b9['recordingURL']=util[_0xcbeb('0x49')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b21fe['serverUrl'],_0x20d6b9[_0xcbeb('0x4b')],md5(_0x20d6b9[_0xcbeb('0x4b')]));}else{_0x20d6b9['recordingURL']='';}return getConnection(_0x5b21fe)[_0xcbeb('0x17')](function(_0xc30e69){_0x4bcb21=_0xc30e69;if(!_[_0xcbeb('0x15')](_0x5d0db1)){return getUser(_0x5b21fe,_0x5d0db1[_0xcbeb('0x3d')],_0x4bcb21);}else{return getUser(_0x5b21fe,null,_0x4bcb21);}})[_0xcbeb('0x17')](function(_0x763af1){_0x4ae226=_0x763af1;return getEndUser(_0x5b21fe,_0x34831d,_0x20d6b9[_0xcbeb('0x4c')],_0x20d6b9[_0xcbeb('0x4d')],_0x4bcb21);})[_0xcbeb('0x17')](function(_0x471d94){_0xdb4237=_0x471d94;return getTicket(_0x5b21fe,_0x4ae226,_0xdb4237,_0x34831d,_0x20d6b9,_0x34831d[_0xcbeb('0x4e')],_0x4bcb21);})[_0xcbeb('0x17')](function(_0x33dfab){_0x1c7e7c=_0x33dfab;logger[_0xcbeb('0x1b')]('['+_0x20d6b9[_0xcbeb('0x64')][_0xcbeb('0x65')]()+_0xcbeb('0x66'),_0x1c7e7c['id']);logger[_0xcbeb('0x1b')]('['+_0x20d6b9[_0xcbeb('0x64')][_0xcbeb('0x65')]()+_0xcbeb('0x67'),_0x5b21fe[_0xcbeb('0x35')]);})[_0xcbeb('0x55')](function(_0x140b25){logger[_0xcbeb('0x54')]('['+_0x20d6b9[_0xcbeb('0x64')][_0xcbeb('0x65')]()+']',JSON[_0xcbeb('0x57')](_0x140b25));});}; \ 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 fa21c7f..42f86c2 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 _0x2ef3=['userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','catch','label','?sysparm_query=name%3D','label_entry','Incident','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','error','message','info','validateEmail'];(function(_0x17370d,_0x50758f){var _0x51b619=function(_0x22035d){while(--_0x22035d){_0x17370d['push'](_0x17370d['shift']());}};_0x51b619(++_0x50758f);}(_0x2ef3,0xba));var _0x32ef=function(_0x28ebe1,_0x5afc0a){_0x28ebe1=_0x28ebe1-0x0;var _0x2bcdd6=_0x2ef3[_0x28ebe1];return _0x2bcdd6;};'use strict';var _=require(_0x32ef('0x0'));var Promise=require(_0x32ef('0x1'));var rp=require(_0x32ef('0x2'));var util=require(_0x32ef('0x3'));var md5=require(_0x32ef('0x4'));var Redis=require(_0x32ef('0x5'));var intUtil=require('./util');var config=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('servicenow');config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));function getAdminUser(_0x367c39,_0x2fb8eb,_0x234863,_0x298066,_0x2484a0,_0x2bbb50){return new Promise(function(_0x28275c,_0x77df79){var _0x56eb42={'method':'GET','uri':_0x298066+_0x32ef('0xb')+'&'+_0x2484a0+'&'+_0x2bbb50,'auth':_0x2fb8eb,'json':!![]};return rp(_0x56eb42)[_0x32ef('0xc')](function(_0x45bfd5){if(_0x45bfd5[_0x32ef('0xd')]['length']>0x0){_0x234863[_0x32ef('0xe')]=_0x45bfd5['result'][0x0][_0x32ef('0xf')];}logger['info']('['+[_0x367c39[_0x32ef('0x10')]()]+_0x32ef('0x11'),_0x234863);_0x28275c(_0x234863);})['catch'](function(_0x539d18){logger[_0x32ef('0x12')]('['+[_0x367c39['toUpperCase']()]+']',_0x539d18[_0x32ef('0x13')]);_0x77df79(_0x539d18[_0x32ef('0x13')]);});});}function getUser(_0x93d492,_0x54c7f5,_0x57aff1,_0x55bf0b,_0x531e30){return function(_0x13db1a){logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x13db1a);return new Promise(function(_0x5d559b,_0x1eb468){if(intUtil[_0x32ef('0x15')](_0x13db1a[_0x32ef('0x16')])){var _0x57863c={'method':_0x32ef('0x17'),'uri':_0x57aff1+_0x32ef('0x18')+_0x13db1a['userEmail']+'&'+_0x55bf0b+'&'+_0x531e30,'auth':_0x54c7f5,'json':!![]};logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x19'),_0x57863c);return rp(_0x57863c)[_0x32ef('0xc')](function(_0x445cda){logger[_0x32ef('0x14')]('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1a'),_0x445cda);if(_0x445cda['result'][_0x32ef('0x1b')]>0x0&&String(_0x445cda[_0x32ef('0xd')][0x0]['active'])===_0x32ef('0x1c')){_0x13db1a[_0x32ef('0x1d')]=_0x445cda[_0x32ef('0xd')][0x0]['sys_id'];}else{_0x13db1a['userId']=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];}logger['info']('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1f'),_0x13db1a);_0x5d559b(_0x13db1a);})['catch'](function(_0x51a412){logger[_0x32ef('0x12')]('['+[_0x93d492[_0x32ef('0x10')]()]+']',_0x51a412[_0x32ef('0x13')]);_0x1eb468(_0x51a412[_0x32ef('0x13')]);});}else{logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x20'));_0x13db1a[_0x32ef('0x1d')]=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];_0x5d559b(_0x13db1a);}});};}function createEndUser(_0xba4b3f,_0x5a88a5,_0xd65fde,_0x2f5d06,_0x5a04cd){logger[_0x32ef('0x14')]('['+[_0xba4b3f[_0x32ef('0x10')]()]+_0x32ef('0x21'),_0xd65fde);return new Promise(function(_0x26e207,_0x50a95b){var _0x10e38c={'method':_0x32ef('0x22'),'uri':_0x2f5d06+_0x32ef('0x23')+_0x5a04cd,'body':{'user_name':_0xd65fde[_0x32ef('0x24')],'roles':_0x32ef('0x25'),'first_name':_0xd65fde[_0x32ef('0x24')],'active':_0x32ef('0x1c'),'date_format':'System','phone':_0xd65fde[_0x32ef('0x24')]},'auth':_0x5a88a5,'json':!![]};return rp(_0x10e38c)['then'](function(_0x38bf73){logger[_0x32ef('0x14')]('['+[_0xba4b3f['toUpperCase']()]+_0x32ef('0x26'),_0x38bf73[_0x32ef('0xd')]);_0xd65fde[_0x32ef('0x27')]=_0x38bf73[_0x32ef('0xd')][_0x32ef('0xf')];_0x26e207(_0xd65fde);})['catch'](function(_0x50ecd6){logger[_0x32ef('0x12')]('['+[_0xba4b3f['toUpperCase']()]+']',_0x50ecd6[_0x32ef('0x13')]);_0x50a95b(_0x50ecd6[_0x32ef('0x13')]);});});}function getEndUser(_0x2f1349,_0x390670,_0x389583,_0x22fa1a,_0x566b56){return function(_0x482d3a){logger['info']('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x28'),_0x482d3a);return new Promise(function(_0x136b02,_0x5f2443){var _0x4fb402={'method':_0x32ef('0x17'),'uri':_0x389583+_0x32ef('0x29')+_0x482d3a[_0x32ef('0x24')]+'&'+_0x22fa1a+'&'+_0x566b56,'auth':_0x390670,'json':!![]};return rp(_0x4fb402)['then'](function(_0x4abbd6){if(_0x4abbd6[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){_0x482d3a[_0x32ef('0x27')]=_0x4abbd6[_0x32ef('0xd')][0x0][_0x32ef('0xf')];logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2a'),_0x482d3a);_0x136b02(_0x482d3a);}else{return createEndUser(_0x2f1349,_0x390670,_0x482d3a,_0x389583,_0x22fa1a)[_0x32ef('0xc')](function(_0x4de939){logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2b'),_0x4de939);_0x136b02(_0x4de939);});}})['catch'](function(_0x365125){logger[_0x32ef('0x12')]('['+[_0x2f1349[_0x32ef('0x10')]()]+']',_0x365125[_0x32ef('0x13')]);_0x5f2443(_0x365125[_0x32ef('0x13')]);});});};}function getCustomFields(_0x33a0fb,_0x256c40){var _0x1cebed={};if(_0x33a0fb[_0x32ef('0x1b')]>0x0){_[_0x32ef('0x2c')](_0x33a0fb,function(_0xb4db74){if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74[_0x32ef('0x2e')]&&!_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74['idField']&&_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')]['toString']();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x34')&&_0xb4db74['variableName']&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0x256c40[_0xb4db74[_0x32ef('0x35')]][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x36')&&_0xb4db74[_0x32ef('0x37')]&&_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')]&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')]['toLowerCase']()]=_0x256c40[_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')][_0x32ef('0x31')]()]['toString']();}});}return _0x1cebed;}function getTicket(_0x502113,_0x230ac9,_0x37b954,_0x241f82,_0x35b4e0,_0x40bf12){return function(_0x12c9e6){logger['info']('['+[_0x502113['toUpperCase']()]+_0x32ef('0x39'),_0x12c9e6);return new Promise(function(_0x270826,_0x27d65b){var _0x13b270=_0x502113[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x12c9e6[_0x32ef('0x1d')]:_0x12c9e6[_0x32ef('0x27')];var _0xc10e7={'method':_0x32ef('0x22'),'uri':_0x37b954+_0x32ef('0x3b')+'?'+_0x40bf12,'body':Object[_0x32ef('0x3c')]({},{'active':_0x32ef('0x1c'),'caller_id':_0x13b270,'assigned_to':_0x12c9e6['userId'],'short_description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3e')],_0x35b4e0,'\x20'),'description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3f')],_0x35b4e0,'\x0a')},getCustomFields(_0x241f82[_0x32ef('0x40')],_0x35b4e0)),'auth':_0x230ac9,'json':!![]};return rp(_0xc10e7)[_0x32ef('0xc')](function(_0x278696){logger[_0x32ef('0x14')]('['+[_0x502113[_0x32ef('0x10')]()]+_0x32ef('0x41'),_0x278696[_0x32ef('0xd')]);_0x12c9e6[_0x32ef('0x42')]=_0x278696[_0x32ef('0xd')][_0x32ef('0xf')];_0x12c9e6[_0x32ef('0x43')]=_0x278696[_0x32ef('0xd')][_0x32ef('0x44')];logger[_0x32ef('0x14')]('['+[_0x502113['toUpperCase']()]+']\x20getTicket\x20crm',_0x12c9e6);_0x270826(_0x12c9e6);})[_0x32ef('0x45')](function(_0x259c32){logger[_0x32ef('0x12')]('['+[_0x502113[_0x32ef('0x10')]()]+']',_0x259c32[_0x32ef('0x13')]);_0x27d65b(_0x259c32[_0x32ef('0x13')]);});});};}function createRemoteTag(_0x1572d9,_0x1f105a,_0x15b640,_0x368bf1){return new Promise(function(_0x3697a7,_0x4a6fd2){var _0x21216d={'method':_0x32ef('0x22'),'uri':_0x15b640+_0x32ef('0x46')+'?'+_0x368bf1,'body':{'short_description':_0x1572d9,'global':!![],'active':!![],'name':_0x1572d9},'auth':_0x1f105a,'json':!![]};return rp(_0x21216d)[_0x32ef('0xc')](function(_0x38314a){var _0x387cf0=_0x38314a['result'][_0x32ef('0xf')];_0x3697a7(_0x387cf0);});});}function getRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa,_0x52692a){return new Promise(function(_0x2ee3dd,_0xbe35b){var _0x579bc1={'method':_0x32ef('0x17'),'uri':_0x56b7ce+'label'+_0x32ef('0x47')+_0x1eeb3e+'&'+_0x1b0faa,'auth':_0x31d5d8,'json':!![]};return rp(_0x579bc1)[_0x32ef('0xc')](function(_0x2bff39){if(_0x2bff39[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){var _0x30e377=_0x2bff39[_0x32ef('0xd')][0x0]['sys_id'];_0x2ee3dd(_0x30e377);}else{return createRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa)['then'](function(_0xdfa103){_0x2ee3dd(_0xdfa103);});}});});}function assignTagToIncident(_0x52232a,_0x4fbab6,_0xb519e9,_0x89d0b3,_0x2ef0f8){return new Promise(function(_0x6aae59,_0x2468e6){var _0x356704={'method':_0x32ef('0x22'),'uri':_0xb519e9+_0x32ef('0x48')+'?'+_0x2ef0f8,'body':{'label':_0x52232a,'table':_0x32ef('0x3b'),'id_type':_0x32ef('0x49'),'table_key':_0x89d0b3['ticketId'],'title':'Incident\x20-\x20'+_0x89d0b3[_0x32ef('0x43')],'id_display':_0x89d0b3[_0x32ef('0x43')]},'auth':_0x4fbab6,'json':!![]};return rp(_0x356704)['then'](function(_0xda1d1){_0x6aae59();})[_0x32ef('0x45')](function(){_0x6aae59();});});}function manageTags(_0x2b5703,_0x49c245,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0,_0x5e6030){return new Promise(function(_0x13ea1a,_0x47d8bf){var _0x17f447=[];_0x49c245['forEach'](function(_0x58b652){_0x17f447[_0x32ef('0x4a')](getRemoteTag(_0x58b652,_0x2ac877,_0x3c31d0,_0x52dfe0,_0x5e6030));});return Promise[_0x32ef('0x4b')](_0x17f447)[_0x32ef('0xc')](function(_0x5dca6a){if(_0x5dca6a[_0x32ef('0x1b')]){logger[_0x32ef('0x14')]('['+[_0x2b5703[_0x32ef('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5dca6a);var _0x4557ce=[];_0x5dca6a[_0x32ef('0x2c')](function(_0x4c3bab){_0x4557ce['push'](assignTagToIncident(_0x4c3bab,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0));});return Promise[_0x32ef('0x4b')](_0x4557ce)[_0x32ef('0xc')](function(){_0x13ea1a();})[_0x32ef('0x45')](function(){_0x13ea1a();});}else{_0x13ea1a();}});});}function getTags(_0x339625,_0x4c4df8,_0x40700e,_0x4c89e8,_0x285330,_0x63b65){return function(_0x25b6d6){return new Promise(function(_0x36ed97,_0x21e930){var _0x340861=[];var _0x1dc755=_0x4c89e8[_0x32ef('0x4c')];if(_0x1dc755&&_0x1dc755[_0x32ef('0x1b')]>0x0){_0x340861=_['map'](_0x1dc755,_0x32ef('0x38'));}if(_0x340861[_0x32ef('0x1b')]>0x0){return manageTags(_0x339625,_0x340861,_0x4c4df8,_0x40700e,_0x25b6d6,_0x285330,_0x63b65)[_0x32ef('0xc')](function(){_0x36ed97(_0x25b6d6);});}else{_0x36ed97(_0x25b6d6);}});};}function emit(_0x1c629d,_0x79ae28,_0x5ad75c){var _0x47c0ed=_0x32ef('0x4d')+_0x32ef('0x4e')+_0x32ef('0x4f')+_0x32ef('0x50');var _0x1a8bad={'uri':_0x1c629d+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x5ad75c+_0x47c0ed};io['to'](util[_0x32ef('0x51')]('user:%s',_0x79ae28))[_0x32ef('0x52')](_0x32ef('0x53'),_0x1a8bad);}exports['cs']=function(_0x48b6f4,_0x5402b4,_0x2c9f7a,_0x1538d0,_0x2e0873,_0x5b378b,_0x52b63b,_0x3b4a8e){var _0x5edd29={};var _0x7d2c3a={'user':_0x5b378b[_0x32ef('0x54')],'pass':_0x5b378b['password']};var _0x476bbf=_0x32ef('0x55');var _0x974974=_0x32ef('0x56');_0x5b378b[_0x32ef('0x57')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x57')]);_0x5b378b[_0x32ef('0x59')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x59')]);var _0x132d9f=util[_0x32ef('0x51')]('%s/api/now/table/',_0x5b378b['remoteUri']);_0x5edd29[_0x32ef('0x16')]=!_[_0x32ef('0x5a')](_0x1538d0)?_0x1538d0['email']:null;_0x5edd29[_0x32ef('0x1e')]=_0x5b378b['email'];_0x5edd29[_0x32ef('0x24')]=_0x3b4a8e[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x5402b4['destcalleridnum']:_0x5402b4[_0x32ef('0x5b')];_0x5edd29['callDirection']=_0x3b4a8e===_0x32ef('0x5c')||_0x3b4a8e===_0x32ef('0x5d')?'queue':'outbound';var _0x3c9039=util['format'](_0x32ef('0x5e'),_0x5b378b['serverUrl'],_0x5402b4[_0x32ef('0x5f')],md5(_0x5402b4[_0x32ef('0x5f')]));if(_0x2e0873&&_0x2e0873[_0x32ef('0x60')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else if(_0x52b63b&&_0x52b63b['recordingFormat']&&_0x52b63b[_0x32ef('0x62')]!==_0x32ef('0x63')){logger[_0x32ef('0x14')](_0x32ef('0x64'),_0x32ef('0x65'));_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else{_0x5402b4['recordingURL']='';}return getAdminUser(_0x3b4a8e,_0x7d2c3a,_0x5edd29,_0x132d9f,_0x974974,_0x476bbf)[_0x32ef('0xc')](getUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getEndUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getTicket(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x2c9f7a,_0x5402b4,_0x974974))[_0x32ef('0xc')](function(_0x5c4f2a){logger[_0x32ef('0x14')](util[_0x32ef('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5c4f2a[_0x32ef('0x42')]));logger[_0x32ef('0x14')](util[_0x32ef('0x51')](_0x32ef('0x66'),_0x3b4a8e));if(_0x3b4a8e!==_0x32ef('0x5d')){logger[_0x32ef('0x14')]('['+[_0x3b4a8e['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5b378b[_0x32ef('0x57')],_0x1538d0['name'],_0x5c4f2a[_0x32ef('0x42')]);}})[_0x32ef('0x45')](function(_0x114d8e){logger[_0x32ef('0x12')]('['+[_0x3b4a8e[_0x32ef('0x10')]()]+_0x32ef('0x67'),util['inspect'](_0x114d8e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2ef3=['userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','catch','label','?sysparm_query=name%3D','label_entry','Incident','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','error','message','info','validateEmail'];(function(_0x487aa4,_0x3b8dd9){var _0x4d8aae=function(_0x2ad586){while(--_0x2ad586){_0x487aa4['push'](_0x487aa4['shift']());}};_0x4d8aae(++_0x3b8dd9);}(_0x2ef3,0xba));var _0x32ef=function(_0xea927c,_0x38ea25){_0xea927c=_0xea927c-0x0;var _0x1d95fa=_0x2ef3[_0xea927c];return _0x1d95fa;};'use strict';var _=require(_0x32ef('0x0'));var Promise=require(_0x32ef('0x1'));var rp=require(_0x32ef('0x2'));var util=require(_0x32ef('0x3'));var md5=require(_0x32ef('0x4'));var Redis=require(_0x32ef('0x5'));var intUtil=require('./util');var config=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('servicenow');config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));function getAdminUser(_0x367c39,_0x2fb8eb,_0x234863,_0x298066,_0x2484a0,_0x2bbb50){return new Promise(function(_0x28275c,_0x77df79){var _0x56eb42={'method':'GET','uri':_0x298066+_0x32ef('0xb')+'&'+_0x2484a0+'&'+_0x2bbb50,'auth':_0x2fb8eb,'json':!![]};return rp(_0x56eb42)[_0x32ef('0xc')](function(_0x45bfd5){if(_0x45bfd5[_0x32ef('0xd')]['length']>0x0){_0x234863[_0x32ef('0xe')]=_0x45bfd5['result'][0x0][_0x32ef('0xf')];}logger['info']('['+[_0x367c39[_0x32ef('0x10')]()]+_0x32ef('0x11'),_0x234863);_0x28275c(_0x234863);})['catch'](function(_0x539d18){logger[_0x32ef('0x12')]('['+[_0x367c39['toUpperCase']()]+']',_0x539d18[_0x32ef('0x13')]);_0x77df79(_0x539d18[_0x32ef('0x13')]);});});}function getUser(_0x93d492,_0x54c7f5,_0x57aff1,_0x55bf0b,_0x531e30){return function(_0x13db1a){logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x13db1a);return new Promise(function(_0x5d559b,_0x1eb468){if(intUtil[_0x32ef('0x15')](_0x13db1a[_0x32ef('0x16')])){var _0x57863c={'method':_0x32ef('0x17'),'uri':_0x57aff1+_0x32ef('0x18')+_0x13db1a['userEmail']+'&'+_0x55bf0b+'&'+_0x531e30,'auth':_0x54c7f5,'json':!![]};logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x19'),_0x57863c);return rp(_0x57863c)[_0x32ef('0xc')](function(_0x445cda){logger[_0x32ef('0x14')]('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1a'),_0x445cda);if(_0x445cda['result'][_0x32ef('0x1b')]>0x0&&String(_0x445cda[_0x32ef('0xd')][0x0]['active'])===_0x32ef('0x1c')){_0x13db1a[_0x32ef('0x1d')]=_0x445cda[_0x32ef('0xd')][0x0]['sys_id'];}else{_0x13db1a['userId']=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];}logger['info']('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1f'),_0x13db1a);_0x5d559b(_0x13db1a);})['catch'](function(_0x51a412){logger[_0x32ef('0x12')]('['+[_0x93d492[_0x32ef('0x10')]()]+']',_0x51a412[_0x32ef('0x13')]);_0x1eb468(_0x51a412[_0x32ef('0x13')]);});}else{logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x20'));_0x13db1a[_0x32ef('0x1d')]=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];_0x5d559b(_0x13db1a);}});};}function createEndUser(_0xba4b3f,_0x5a88a5,_0xd65fde,_0x2f5d06,_0x5a04cd){logger[_0x32ef('0x14')]('['+[_0xba4b3f[_0x32ef('0x10')]()]+_0x32ef('0x21'),_0xd65fde);return new Promise(function(_0x26e207,_0x50a95b){var _0x10e38c={'method':_0x32ef('0x22'),'uri':_0x2f5d06+_0x32ef('0x23')+_0x5a04cd,'body':{'user_name':_0xd65fde[_0x32ef('0x24')],'roles':_0x32ef('0x25'),'first_name':_0xd65fde[_0x32ef('0x24')],'active':_0x32ef('0x1c'),'date_format':'System','phone':_0xd65fde[_0x32ef('0x24')]},'auth':_0x5a88a5,'json':!![]};return rp(_0x10e38c)['then'](function(_0x38bf73){logger[_0x32ef('0x14')]('['+[_0xba4b3f['toUpperCase']()]+_0x32ef('0x26'),_0x38bf73[_0x32ef('0xd')]);_0xd65fde[_0x32ef('0x27')]=_0x38bf73[_0x32ef('0xd')][_0x32ef('0xf')];_0x26e207(_0xd65fde);})['catch'](function(_0x50ecd6){logger[_0x32ef('0x12')]('['+[_0xba4b3f['toUpperCase']()]+']',_0x50ecd6[_0x32ef('0x13')]);_0x50a95b(_0x50ecd6[_0x32ef('0x13')]);});});}function getEndUser(_0x2f1349,_0x390670,_0x389583,_0x22fa1a,_0x566b56){return function(_0x482d3a){logger['info']('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x28'),_0x482d3a);return new Promise(function(_0x136b02,_0x5f2443){var _0x4fb402={'method':_0x32ef('0x17'),'uri':_0x389583+_0x32ef('0x29')+_0x482d3a[_0x32ef('0x24')]+'&'+_0x22fa1a+'&'+_0x566b56,'auth':_0x390670,'json':!![]};return rp(_0x4fb402)['then'](function(_0x4abbd6){if(_0x4abbd6[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){_0x482d3a[_0x32ef('0x27')]=_0x4abbd6[_0x32ef('0xd')][0x0][_0x32ef('0xf')];logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2a'),_0x482d3a);_0x136b02(_0x482d3a);}else{return createEndUser(_0x2f1349,_0x390670,_0x482d3a,_0x389583,_0x22fa1a)[_0x32ef('0xc')](function(_0x4de939){logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2b'),_0x4de939);_0x136b02(_0x4de939);});}})['catch'](function(_0x365125){logger[_0x32ef('0x12')]('['+[_0x2f1349[_0x32ef('0x10')]()]+']',_0x365125[_0x32ef('0x13')]);_0x5f2443(_0x365125[_0x32ef('0x13')]);});});};}function getCustomFields(_0x33a0fb,_0x256c40){var _0x1cebed={};if(_0x33a0fb[_0x32ef('0x1b')]>0x0){_[_0x32ef('0x2c')](_0x33a0fb,function(_0xb4db74){if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74[_0x32ef('0x2e')]&&!_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74['idField']&&_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')]['toString']();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x34')&&_0xb4db74['variableName']&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0x256c40[_0xb4db74[_0x32ef('0x35')]][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x36')&&_0xb4db74[_0x32ef('0x37')]&&_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')]&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')]['toLowerCase']()]=_0x256c40[_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')][_0x32ef('0x31')]()]['toString']();}});}return _0x1cebed;}function getTicket(_0x502113,_0x230ac9,_0x37b954,_0x241f82,_0x35b4e0,_0x40bf12){return function(_0x12c9e6){logger['info']('['+[_0x502113['toUpperCase']()]+_0x32ef('0x39'),_0x12c9e6);return new Promise(function(_0x270826,_0x27d65b){var _0x13b270=_0x502113[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x12c9e6[_0x32ef('0x1d')]:_0x12c9e6[_0x32ef('0x27')];var _0xc10e7={'method':_0x32ef('0x22'),'uri':_0x37b954+_0x32ef('0x3b')+'?'+_0x40bf12,'body':Object[_0x32ef('0x3c')]({},{'active':_0x32ef('0x1c'),'caller_id':_0x13b270,'assigned_to':_0x12c9e6['userId'],'short_description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3e')],_0x35b4e0,'\x20'),'description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3f')],_0x35b4e0,'\x0a')},getCustomFields(_0x241f82[_0x32ef('0x40')],_0x35b4e0)),'auth':_0x230ac9,'json':!![]};return rp(_0xc10e7)[_0x32ef('0xc')](function(_0x278696){logger[_0x32ef('0x14')]('['+[_0x502113[_0x32ef('0x10')]()]+_0x32ef('0x41'),_0x278696[_0x32ef('0xd')]);_0x12c9e6[_0x32ef('0x42')]=_0x278696[_0x32ef('0xd')][_0x32ef('0xf')];_0x12c9e6[_0x32ef('0x43')]=_0x278696[_0x32ef('0xd')][_0x32ef('0x44')];logger[_0x32ef('0x14')]('['+[_0x502113['toUpperCase']()]+']\x20getTicket\x20crm',_0x12c9e6);_0x270826(_0x12c9e6);})[_0x32ef('0x45')](function(_0x259c32){logger[_0x32ef('0x12')]('['+[_0x502113[_0x32ef('0x10')]()]+']',_0x259c32[_0x32ef('0x13')]);_0x27d65b(_0x259c32[_0x32ef('0x13')]);});});};}function createRemoteTag(_0x1572d9,_0x1f105a,_0x15b640,_0x368bf1){return new Promise(function(_0x3697a7,_0x4a6fd2){var _0x21216d={'method':_0x32ef('0x22'),'uri':_0x15b640+_0x32ef('0x46')+'?'+_0x368bf1,'body':{'short_description':_0x1572d9,'global':!![],'active':!![],'name':_0x1572d9},'auth':_0x1f105a,'json':!![]};return rp(_0x21216d)[_0x32ef('0xc')](function(_0x38314a){var _0x387cf0=_0x38314a['result'][_0x32ef('0xf')];_0x3697a7(_0x387cf0);});});}function getRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa,_0x52692a){return new Promise(function(_0x2ee3dd,_0xbe35b){var _0x579bc1={'method':_0x32ef('0x17'),'uri':_0x56b7ce+'label'+_0x32ef('0x47')+_0x1eeb3e+'&'+_0x1b0faa,'auth':_0x31d5d8,'json':!![]};return rp(_0x579bc1)[_0x32ef('0xc')](function(_0x2bff39){if(_0x2bff39[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){var _0x30e377=_0x2bff39[_0x32ef('0xd')][0x0]['sys_id'];_0x2ee3dd(_0x30e377);}else{return createRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa)['then'](function(_0xdfa103){_0x2ee3dd(_0xdfa103);});}});});}function assignTagToIncident(_0x52232a,_0x4fbab6,_0xb519e9,_0x89d0b3,_0x2ef0f8){return new Promise(function(_0x6aae59,_0x2468e6){var _0x356704={'method':_0x32ef('0x22'),'uri':_0xb519e9+_0x32ef('0x48')+'?'+_0x2ef0f8,'body':{'label':_0x52232a,'table':_0x32ef('0x3b'),'id_type':_0x32ef('0x49'),'table_key':_0x89d0b3['ticketId'],'title':'Incident\x20-\x20'+_0x89d0b3[_0x32ef('0x43')],'id_display':_0x89d0b3[_0x32ef('0x43')]},'auth':_0x4fbab6,'json':!![]};return rp(_0x356704)['then'](function(_0xda1d1){_0x6aae59();})[_0x32ef('0x45')](function(){_0x6aae59();});});}function manageTags(_0x2b5703,_0x49c245,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0,_0x5e6030){return new Promise(function(_0x13ea1a,_0x47d8bf){var _0x17f447=[];_0x49c245['forEach'](function(_0x58b652){_0x17f447[_0x32ef('0x4a')](getRemoteTag(_0x58b652,_0x2ac877,_0x3c31d0,_0x52dfe0,_0x5e6030));});return Promise[_0x32ef('0x4b')](_0x17f447)[_0x32ef('0xc')](function(_0x5dca6a){if(_0x5dca6a[_0x32ef('0x1b')]){logger[_0x32ef('0x14')]('['+[_0x2b5703[_0x32ef('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5dca6a);var _0x4557ce=[];_0x5dca6a[_0x32ef('0x2c')](function(_0x4c3bab){_0x4557ce['push'](assignTagToIncident(_0x4c3bab,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0));});return Promise[_0x32ef('0x4b')](_0x4557ce)[_0x32ef('0xc')](function(){_0x13ea1a();})[_0x32ef('0x45')](function(){_0x13ea1a();});}else{_0x13ea1a();}});});}function getTags(_0x339625,_0x4c4df8,_0x40700e,_0x4c89e8,_0x285330,_0x63b65){return function(_0x25b6d6){return new Promise(function(_0x36ed97,_0x21e930){var _0x340861=[];var _0x1dc755=_0x4c89e8[_0x32ef('0x4c')];if(_0x1dc755&&_0x1dc755[_0x32ef('0x1b')]>0x0){_0x340861=_['map'](_0x1dc755,_0x32ef('0x38'));}if(_0x340861[_0x32ef('0x1b')]>0x0){return manageTags(_0x339625,_0x340861,_0x4c4df8,_0x40700e,_0x25b6d6,_0x285330,_0x63b65)[_0x32ef('0xc')](function(){_0x36ed97(_0x25b6d6);});}else{_0x36ed97(_0x25b6d6);}});};}function emit(_0x1c629d,_0x79ae28,_0x5ad75c){var _0x47c0ed=_0x32ef('0x4d')+_0x32ef('0x4e')+_0x32ef('0x4f')+_0x32ef('0x50');var _0x1a8bad={'uri':_0x1c629d+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x5ad75c+_0x47c0ed};io['to'](util[_0x32ef('0x51')]('user:%s',_0x79ae28))[_0x32ef('0x52')](_0x32ef('0x53'),_0x1a8bad);}exports['cs']=function(_0x48b6f4,_0x5402b4,_0x2c9f7a,_0x1538d0,_0x2e0873,_0x5b378b,_0x52b63b,_0x3b4a8e){var _0x5edd29={};var _0x7d2c3a={'user':_0x5b378b[_0x32ef('0x54')],'pass':_0x5b378b['password']};var _0x476bbf=_0x32ef('0x55');var _0x974974=_0x32ef('0x56');_0x5b378b[_0x32ef('0x57')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x57')]);_0x5b378b[_0x32ef('0x59')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x59')]);var _0x132d9f=util[_0x32ef('0x51')]('%s/api/now/table/',_0x5b378b['remoteUri']);_0x5edd29[_0x32ef('0x16')]=!_[_0x32ef('0x5a')](_0x1538d0)?_0x1538d0['email']:null;_0x5edd29[_0x32ef('0x1e')]=_0x5b378b['email'];_0x5edd29[_0x32ef('0x24')]=_0x3b4a8e[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x5402b4['destcalleridnum']:_0x5402b4[_0x32ef('0x5b')];_0x5edd29['callDirection']=_0x3b4a8e===_0x32ef('0x5c')||_0x3b4a8e===_0x32ef('0x5d')?'queue':'outbound';var _0x3c9039=util['format'](_0x32ef('0x5e'),_0x5b378b['serverUrl'],_0x5402b4[_0x32ef('0x5f')],md5(_0x5402b4[_0x32ef('0x5f')]));if(_0x2e0873&&_0x2e0873[_0x32ef('0x60')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else if(_0x52b63b&&_0x52b63b['recordingFormat']&&_0x52b63b[_0x32ef('0x62')]!==_0x32ef('0x63')){logger[_0x32ef('0x14')](_0x32ef('0x64'),_0x32ef('0x65'));_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else{_0x5402b4['recordingURL']='';}return getAdminUser(_0x3b4a8e,_0x7d2c3a,_0x5edd29,_0x132d9f,_0x974974,_0x476bbf)[_0x32ef('0xc')](getUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getEndUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getTicket(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x2c9f7a,_0x5402b4,_0x974974))[_0x32ef('0xc')](function(_0x5c4f2a){logger[_0x32ef('0x14')](util[_0x32ef('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5c4f2a[_0x32ef('0x42')]));logger[_0x32ef('0x14')](util[_0x32ef('0x51')](_0x32ef('0x66'),_0x3b4a8e));if(_0x3b4a8e!==_0x32ef('0x5d')){logger[_0x32ef('0x14')]('['+[_0x3b4a8e['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5b378b[_0x32ef('0x57')],_0x1538d0['name'],_0x5c4f2a[_0x32ef('0x42')]);}})[_0x32ef('0x45')](function(_0x114d8e){logger[_0x32ef('0x12')]('['+[_0x3b4a8e[_0x32ef('0x10')]()]+_0x32ef('0x67'),util['inspect'](_0x114d8e,{'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 dc2b1cd..dd3a79e 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 _0xf31b=['debug','[HTTP]','merge','map','type','nameField','customField','toLowerCase','string','idField','custom_fields','push','content','variable','customVariable','Variable','POST','login','username','password','sessionID','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','trigger:browser:url','catch','unmanaged','lastevent','The\x20Enduser\x20ID\x20is:','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','created_by','description','getString','Descriptions','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','direction','length','forEach','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','name','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','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.'];(function(_0x17fc7e,_0x5c112e){var _0x562ca8=function(_0x7e3d00){while(--_0x7e3d00){_0x17fc7e['push'](_0x17fc7e['shift']());}};_0x562ca8(++_0x5c112e);}(_0xf31b,0x1a0));var _0xbf31=function(_0x3ddb2a,_0x353c9b){_0x3ddb2a=_0x3ddb2a-0x0;var _0x1bb92e=_0xf31b[_0x3ddb2a];return _0x1bb92e;};'use strict';var _=require(_0xbf31('0x0'));var rp=require(_0xbf31('0x1'));var BPromise=require(_0xbf31('0x2'));var md5=require(_0xbf31('0x3'));var util=require(_0xbf31('0x4'));var Redis=require(_0xbf31('0x5'));var intUtil=require(_0xbf31('0x6'));var config=require('../../../../config/environment');var logger=require(_0xbf31('0x7'))(_0xbf31('0x8'));config['redis']=_['defaults'](config[_0xbf31('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xbf31('0xa'))(new Redis(config[_0xbf31('0x9')]));var def={'method':'POST','json':!![]};function emit(_0x4d02dd,_0x3da1a2,_0x4d0b81){io['to'](_0x4d02dd)[_0xbf31('0xb')](_0x3da1a2,_0x4d0b81);}function getTicket(_0x23d576,_0x11cdd6,_0x1cf8cc,_0x132946,_0x77d991,_0x45df48,_0x1dc6ed,_0x363d23){logger[_0xbf31('0xc')](_0xbf31('0xd'));var _0x3d3c33=new Date();var _0x453483=[{'name':'name','value':intUtil['getString'](_0x132946['Subjects'],_0x77d991,'\x20')},{'name':'assigned_user_id','value':_0x11cdd6['id']},{'name':_0xbf31('0xe'),'value':_0x11cdd6['id']},{'name':_0xbf31('0xf'),'value':intUtil[_0xbf31('0x10')](_0x132946[_0xbf31('0x11')],_0x77d991,'\x0a')},{'name':'date_start','value':_0x3d3c33['toISOString']()[_0xbf31('0x12')](0x0,0x13)[_0xbf31('0x13')]('T','\x20')},{'name':_0xbf31('0x14'),'value':'0'},{'name':_0xbf31('0x15'),'value':'15'},{'name':_0xbf31('0x16'),'value':_0x1cf8cc['id']},{'name':'parent_type','value':_0xbf31('0x17')},{'name':'parent_name','value':_0x1cf8cc['name']},{'name':_0xbf31('0x18'),'value':_0x363d23}];if(_0x45df48[_0xbf31('0x19')]){_[_0xbf31('0x1a')](_0x45df48,function(_0x1101e4){if(_0x77d991[_0x1101e4[_0xbf31('0x1b')]]){_0x453483['push']({'name':_0x1101e4['idField'],'value':_0x77d991[_0x1101e4[_0xbf31('0x1b')]]});}});}return request({'form':{'method':_0xbf31('0x1c'),'input_type':_0xbf31('0x1d'),'response_type':'JSON','rest_data':JSON[_0xbf31('0x1e')]({'session':_0x1dc6ed['id'],'module_name':_0xbf31('0x1f'),'name_value_list':_0x453483})}});}function getAuth(_0xf968e5){return util[_0xbf31('0x20')](_0xbf31('0x21'),new Buffer(_0xf968e5['apiKey']+':X')[_0xbf31('0x22')]('base64'));}function getServerInfo(_0x557cd6){return request({'form':{'method':_0xbf31('0x23'),'input_type':_0xbf31('0x1d'),'response_type':_0xbf31('0x1d'),'rest_data':JSON[_0xbf31('0x1e')]({'session':_0x557cd6['id']})}});}function getUser(_0x1217c2,_0x421274,_0x59f899){if(!_[_0xbf31('0x24')](_0x421274)){logger[_0xbf31('0xc')](_0xbf31('0x25'),_0x421274);return request({'form':{'method':_0xbf31('0x26'),'input_type':_0xbf31('0x1d'),'response_type':_0xbf31('0x1d'),'rest_data':JSON['stringify']({'session':_0x59f899['id'],'module_name':_0xbf31('0x27'),'query':util[_0xbf31('0x20')](_0xbf31('0x28'),_0x421274),'order_by':'','offset':'0','select_fields':['id',_0xbf31('0x29'),_0xbf31('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x55ca51){if(_0x55ca51[_0xbf31('0x2b')][_0xbf31('0x19')]){var _0x34c6c1=_[_0xbf31('0x2c')](_0x55ca51['entry_list'],function(_0x5ecaf1){return _0x5ecaf1['name_value_list']['user_name'][_0xbf31('0x2d')]===_0x421274;});if(_0x34c6c1){logger[_0xbf31('0xc')]('Agent\x20found!');return BPromise[_0xbf31('0x2e')]({'id':_0x34c6c1[_0xbf31('0x2f')]['id'][_0xbf31('0x2d')],'name':_0x34c6c1['name_value_list']['name']['value']});}}logger[_0xbf31('0xc')](_0xbf31('0x30'));return BPromise[_0xbf31('0x2e')]({'id':_0x59f899[_0xbf31('0x2f')][_0xbf31('0x31')][_0xbf31('0x2d')],'name':_0x59f899['name_value_list'][_0xbf31('0x2a')][_0xbf31('0x2d')]});});}else{logger[_0xbf31('0xc')](_0xbf31('0x32'));return BPromise[_0xbf31('0x2e')]({'id':_0x59f899[_0xbf31('0x2f')]['user_id'][_0xbf31('0x2d')],'name':_0x59f899['name_value_list']['user_name'][_0xbf31('0x2d')]});}}function getEndUser(_0x30c84c,_0x12abb0,_0x5ee047,_0x391746){logger[_0xbf31('0xc')](_0xbf31('0x33'),_0x5ee047);return request({'form':{'method':_0xbf31('0x26'),'input_type':_0xbf31('0x1d'),'response_type':_0xbf31('0x1d'),'rest_data':JSON[_0xbf31('0x1e')]({'session':_0x391746['id'],'module_name':'Contacts','query':util[_0xbf31('0x20')](_0xbf31('0x34'),_0x5ee047),'order_by':'','offset':'0','select_fields':['id',_0xbf31('0x29'),_0xbf31('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbf31('0x36')](function(_0x5cd331){if(_0x5cd331['entry_list'][_0xbf31('0x19')]){var _0xfd7b36=_[_0xbf31('0x2c')](_0x5cd331[_0xbf31('0x2b')],function(_0x83eae2){return _0x83eae2[_0xbf31('0x2f')]['phone_home'][_0xbf31('0x2d')]===_0x5ee047;});if(_0xfd7b36){logger[_0xbf31('0xc')](_0xbf31('0x37'));return BPromise[_0xbf31('0x2e')]({'id':_0xfd7b36[_0xbf31('0x2f')]['id']['value'],'name':_0xfd7b36[_0xbf31('0x2f')][_0xbf31('0x29')]['value'],'phone':_0xfd7b36['name_value_list'][_0xbf31('0x35')][_0xbf31('0x2d')]});}}else{logger['info'](_0xbf31('0x38'));return request({'form':{'method':_0xbf31('0x1c'),'input_type':_0xbf31('0x1d'),'response_type':_0xbf31('0x1d'),'rest_data':JSON[_0xbf31('0x1e')]({'session':_0x391746['id'],'module_name':_0xbf31('0x17'),'name_value_list':[{'name':_0xbf31('0x39'),'value':_0x12abb0!==_0xbf31('0x3a')?_0x12abb0:util[_0xbf31('0x20')]('Caller\x20-\x20%s',_0x5ee047)},{'name':_0xbf31('0x35'),'value':_0x5ee047}]})}})['then'](function(_0x5b35cd){logger[_0xbf31('0xc')](_0xbf31('0x3b'));return BPromise[_0xbf31('0x2e')]({'id':_0x5b35cd['id'],'name':_0x5b35cd[_0xbf31('0x2b')][_0xbf31('0x39')][_0xbf31('0x2d')],'phone':_0x5b35cd[_0xbf31('0x2b')][_0xbf31('0x35')][_0xbf31('0x2d')]});});}});}function request(_0x20f466){logger[_0xbf31('0x3c')](_0xbf31('0x3d'),JSON[_0xbf31('0x1e')](_0x20f466));return rp(_[_0xbf31('0x3e')](def,_0x20f466));}function getTags(_0x3d0050,_0x34379c){var _0xc5d2a4=[];if(_0x3d0050&&_0x3d0050[_0xbf31('0x19')]>0x0){_0xc5d2a4=_[_0xbf31('0x3f')](_0x3d0050,_0x34379c);}return _0xc5d2a4;}function getCustomFields(_0x565a8a,_0xed81d5){var _0x5ec937=[];var _0x5b2244={'custom_fields':[]};if(_0x565a8a[_0xbf31('0x19')]>0x0){_[_0xbf31('0x1a')](_0x565a8a,function(_0x4179b4){if(_0x4179b4[_0xbf31('0x40')]==='string'&&_0x4179b4[_0xbf31('0x41')]&&!_0x4179b4[_0xbf31('0x42')]){_0x5b2244[_0x4179b4[_0xbf31('0x41')][_0xbf31('0x43')]()]=_0x4179b4['content'][_0xbf31('0x22')]();}else if(_0x4179b4[_0xbf31('0x40')]===_0xbf31('0x44')&&_0x4179b4[_0xbf31('0x45')]&&_0x4179b4['customField']){_0x5b2244[_0xbf31('0x46')][_0xbf31('0x47')]({'id':_0x4179b4[_0xbf31('0x45')],'value':_0x4179b4[_0xbf31('0x48')][_0xbf31('0x22')]()});}else if(_0x4179b4['type']===_0xbf31('0x49')&&_0x4179b4[_0xbf31('0x1b')]&&_0x4179b4[_0xbf31('0x45')]&&_0x4179b4[_0xbf31('0x42')]){_0xed81d5[_0x4179b4[_0xbf31('0x1b')]]&&_0x5b2244[_0xbf31('0x46')][_0xbf31('0x47')]({'id':_0x4179b4['idField'],'value':_0xed81d5[_0x4179b4[_0xbf31('0x1b')]][_0xbf31('0x22')]()});}else if(_0x4179b4[_0xbf31('0x40')]===_0xbf31('0x4a')&&_0x4179b4['Variable']&&_0x4179b4[_0xbf31('0x4b')][_0xbf31('0x29')]&&_0x4179b4[_0xbf31('0x45')]&&_0x4179b4[_0xbf31('0x42')]){_0xed81d5[_0x4179b4[_0xbf31('0x4b')]['name'][_0xbf31('0x43')]()]&&_0x5b2244['custom_fields']['push']({'id':_0x4179b4[_0xbf31('0x45')],'value':_0xed81d5[_0x4179b4[_0xbf31('0x4b')][_0xbf31('0x29')]['toLowerCase']()][_0xbf31('0x22')]()});}});}return _0x5b2244;}function getConnection(_0x131cd8){return request({'method':_0xbf31('0x4c'),'form':{'method':_0xbf31('0x4d'),'input_type':'JSON','response_type':_0xbf31('0x1d'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x131cd8[_0xbf31('0x4e')],'password':_0x131cd8[_0xbf31('0x4f')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0xbf31('0x36')](function(_0xec2134){var _0xb2e8e=_0xec2134;if(_0xb2e8e['id']){def[_0xbf31('0x50')]=_0xb2e8e['id'];return BPromise['resolve'](_0xb2e8e);}else{throw new Error(util[_0xbf31('0x20')]('Account\x20%d\x20is\x20not\x20valid',_0x131cd8['id']));}});}function setRelationship(_0x5abee8,_0x47128a,_0xdf70c4,_0x2822b2){return request({'form':{'method':_0xbf31('0x51'),'input_type':_0xbf31('0x1d'),'response_type':_0xbf31('0x1d'),'rest_data':JSON['stringify']({'session':_0x5abee8['id'],'module_name':_0xbf31('0x1f'),'module_id':_0xdf70c4['id'],'link_field_name':_0x2822b2,'related_ids':[_0x47128a['id']]})}});}exports[_0xbf31('0x52')]=function(_0x35716b,_0x4b65c8,_0x1ed3e0,_0x22f21e,_0x43dc69,_0x5df02b){var _0x57bb85,_0x55aed5,_0x3ef3d0,_0x3ac48d;_0x5df02b[_0xbf31('0x53')]=intUtil['stripTrailingSlash'](_0x5df02b[_0xbf31('0x53')]);_0x5df02b[_0xbf31('0x54')]=intUtil[_0xbf31('0x55')](_0x5df02b['serverUrl']);def[_0xbf31('0x56')]=util[_0xbf31('0x20')](_0xbf31('0x57'),_0x5df02b[_0xbf31('0x53')]);if(_0x43dc69&&_0x43dc69[_0xbf31('0x58')]){logger['info'](_0xbf31('0x59'),_0xbf31('0x5a'));_0x4b65c8['recordingURL']=util[_0xbf31('0x20')](_0xbf31('0x5b'),_0x5df02b[_0xbf31('0x54')],_0x4b65c8[_0xbf31('0x5c')],md5(_0x4b65c8['uniqueid']));}else{_0x4b65c8['recordingURL']='';}return getConnection(_0x5df02b)[_0xbf31('0x36')](function(_0x3b6b4c){_0x3ac48d=_0x3b6b4c;return getUser(_0x5df02b,_0x22f21e[_0xbf31('0x29')],_0x3ac48d);})[_0xbf31('0x36')](function(_0x501611){_0x57bb85=_0x501611;logger[_0xbf31('0xc')](_0xbf31('0x5d'),_0x57bb85['id']);return getEndUser(_0x5df02b,_0x4b65c8[_0xbf31('0x5e')],_0x4b65c8[_0xbf31('0x5f')],_0x3ac48d);})['then'](function(_0x42f222){_0x55aed5=_0x42f222;logger['info']('The\x20Enduser\x20ID\x20is:',_0x55aed5['id']);return getTicket(_0x5df02b,_0x57bb85,_0x55aed5,_0x1ed3e0,_0x4b65c8,_0x1ed3e0[_0xbf31('0x60')],_0x3ac48d,_0xbf31('0x61'));})[_0xbf31('0x36')](function(_0x5667f0){_0x3ef3d0=_0x5667f0;logger[_0xbf31('0xc')](_0xbf31('0x62'));logger[_0xbf31('0xc')](_0xbf31('0x63'),_0x3ef3d0['id']);return setRelationship(_0x3ac48d,_0x57bb85,_0x3ef3d0,_0xbf31('0x64'));})[_0xbf31('0x36')](function(){return setRelationship(_0x3ac48d,_0x55aed5,_0x3ef3d0,_0xbf31('0x65'));})[_0xbf31('0x36')](function(){return getServerInfo(_0x3ac48d);})[_0xbf31('0x36')](function(_0x1409dd){var _0x478292=parseInt(_0x1409dd[_0xbf31('0x66')][_0xbf31('0x67')](0x0));var _0x49b566=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x5df02b[_0xbf31('0x53')],_0x3ef3d0['id']);if(_0x478292>0x6){_0x49b566=util[_0xbf31('0x20')](_0xbf31('0x68'),_0x5df02b[_0xbf31('0x53')],_0x3ef3d0['id']);}logger[_0xbf31('0xc')](_0xbf31('0x59'),_0xbf31('0x69'));emit(util['format'](_0xbf31('0x6a'),_0x22f21e[_0xbf31('0x29')]),'trigger:browser:url',{'uri':_0x49b566});})['catch'](function(_0x287d43){logger['error'](_0xbf31('0x59'),JSON[_0xbf31('0x1e')](_0x287d43));});};exports['outbound']=function(_0x2c9457,_0x5b244c,_0x4ac1aa,_0x4ee981,_0x1a491d,_0x3de960,_0x11741b){var _0x4a5c59,_0x222560,_0x1d2289,_0x241956;_0x3de960[_0xbf31('0x53')]=intUtil['stripTrailingSlash'](_0x3de960['remoteUri']);_0x3de960['serverUrl']=intUtil[_0xbf31('0x55')](_0x3de960[_0xbf31('0x54')]);def['uri']=util[_0xbf31('0x20')](_0xbf31('0x57'),_0x3de960['remoteUri']);if(_0x11741b&&_0x11741b['recordingFormat']&&_0x11741b[_0xbf31('0x6b')]!=='none'){logger['info'](_0xbf31('0x6c'),_0xbf31('0x5a'));_0x5b244c[_0xbf31('0x6d')]=util[_0xbf31('0x20')](_0xbf31('0x5b'),_0x3de960[_0xbf31('0x54')],_0x5b244c[_0xbf31('0x5c')],md5(_0x5b244c[_0xbf31('0x5c')]));}return getConnection(_0x3de960)[_0xbf31('0x36')](function(_0x38a80d){_0x241956=_0x38a80d;return getUser(_0x3de960,_0x4ee981[_0xbf31('0x29')],_0x241956);})[_0xbf31('0x36')](function(_0x54e9bb){_0x4a5c59=_0x54e9bb;logger[_0xbf31('0xc')](_0xbf31('0x5d'),_0x4a5c59['id']);return getEndUser(_0x3de960,_0x5b244c[_0xbf31('0x6e')],_0x5b244c[_0xbf31('0x6f')],_0x241956);})[_0xbf31('0x36')](function(_0x2157b8){_0x222560=_0x2157b8;logger['info']('The\x20Enduser\x20ID\x20is:',_0x222560['id']);return getTicket(_0x3de960,_0x4a5c59,_0x222560,_0x4ac1aa,_0x5b244c,_0x4ac1aa[_0xbf31('0x60')],_0x241956,'Outbound');})['then'](function(_0x6f7151){_0x1d2289=_0x6f7151;logger[_0xbf31('0xc')](_0xbf31('0x62'));logger['info'](_0xbf31('0x63'),_0x1d2289['id']);return setRelationship(_0x241956,_0x4a5c59,_0x1d2289,_0xbf31('0x64'));})['then'](function(){return setRelationship(_0x241956,_0x222560,_0x1d2289,_0xbf31('0x65'));})['then'](function(){return getServerInfo(_0x241956);})['then'](function(_0x336c80){var _0x2af4e6=parseInt(_0x336c80[_0xbf31('0x66')]['charAt'](0x0));var _0x265043=util[_0xbf31('0x20')](_0xbf31('0x70'),_0x3de960[_0xbf31('0x53')],_0x1d2289['id']);if(_0x2af4e6>0x6){_0x265043=util[_0xbf31('0x20')](_0xbf31('0x68'),_0x3de960[_0xbf31('0x53')],_0x1d2289['id']);}logger[_0xbf31('0xc')](_0xbf31('0x6c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbf31('0x20')](_0xbf31('0x6a'),_0x4ee981[_0xbf31('0x29')]),_0xbf31('0x71'),{'uri':_0x265043});})[_0xbf31('0x72')](function(_0x3515c7){logger['error'](_0xbf31('0x6c'),JSON[_0xbf31('0x1e')](_0x3515c7));});};exports[_0xbf31('0x73')]=function(_0x302a68,_0x1a9328,_0x1ac090,_0x188df5,_0x52f858,_0x196f90){var _0x51700d,_0x52ccbf,_0x461224,_0x418d7c;_0x196f90[_0xbf31('0x53')]=intUtil['stripTrailingSlash'](_0x196f90[_0xbf31('0x53')]);_0x196f90['serverUrl']=intUtil[_0xbf31('0x55')](_0x196f90[_0xbf31('0x54')]);def[_0xbf31('0x56')]=util[_0xbf31('0x20')](_0xbf31('0x57'),_0x196f90[_0xbf31('0x53')]);if(_0x52f858&&_0x52f858['monitor_format']){logger[_0xbf31('0xc')]('['+_0x1a9328[_0xbf31('0x74')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1a9328[_0xbf31('0x6d')]=util[_0xbf31('0x20')](_0xbf31('0x5b'),_0x196f90[_0xbf31('0x54')],_0x1a9328['uniqueid'],md5(_0x1a9328[_0xbf31('0x5c')]));}else{_0x1a9328['recordingURL']='';}return getConnection(_0x196f90)[_0xbf31('0x36')](function(_0x3dba76){_0x418d7c=_0x3dba76;if(!_[_0xbf31('0x24')](_0x188df5)){return getUser(_0x196f90,_0x188df5[_0xbf31('0x29')],_0x418d7c);}else{return getUser(_0x196f90,null,_0x418d7c);}})[_0xbf31('0x36')](function(_0x55f4ec){_0x51700d=_0x55f4ec;logger[_0xbf31('0xc')](_0xbf31('0x5d'),_0x51700d['id']);return getEndUser(_0x196f90,_0x1a9328[_0xbf31('0x5e')],_0x1a9328['calleridnum'],_0x418d7c);})[_0xbf31('0x36')](function(_0x3ad9c2){_0x52ccbf=_0x3ad9c2;logger[_0xbf31('0xc')](_0xbf31('0x75'),_0x52ccbf['id']);return getTicket(_0x196f90,_0x51700d,_0x52ccbf,_0x1ac090,_0x1a9328,_0x1ac090['Fields'],_0x418d7c,_0xbf31('0x61'));})[_0xbf31('0x36')](function(_0x10a210){_0x461224=_0x10a210;logger[_0xbf31('0xc')](_0xbf31('0x62'));logger[_0xbf31('0xc')]('The\x20Ticket\x20ID\x20is:',_0x461224['id']);return setRelationship(_0x418d7c,_0x51700d,_0x461224,_0xbf31('0x64'));})[_0xbf31('0x36')](function(){return setRelationship(_0x418d7c,_0x52ccbf,_0x461224,'contacts');})[_0xbf31('0x36')](function(){return getServerInfo(_0x418d7c);})[_0xbf31('0x72')](function(_0x7abe28){logger['error']('['+_0x1a9328[_0xbf31('0x74')][_0xbf31('0x76')]()+']',JSON[_0xbf31('0x1e')](_0x7abe28));});}; \ No newline at end of file +var _0x806b=['assigned_user_id','description','getString','date_start','toISOString','slice','replace','duration_hours','parent_type','parent_name','direction','length','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','base64','get_server_info','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','first_name','','Caller\x20-\x20%s','Enduser\x20created.','map','forEach','type','customField','nameField','toLowerCase','toString','string','variable','customVariable','Variable','custom_fields','POST','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','stripTrailingSlash','serverUrl','uri','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','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','remoteUri','%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','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','unmanaged','lastevent','toUpperCase','isNil','calleridnum','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','Subjects'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x806b,0x163));var _0xb806=function(_0x3ed4e9,_0x158c8d){_0x3ed4e9=_0x3ed4e9-0x0;var _0x556374=_0x806b[_0x3ed4e9];return _0x556374;};'use strict';var _=require(_0xb806('0x0'));var rp=require(_0xb806('0x1'));var BPromise=require(_0xb806('0x2'));var md5=require(_0xb806('0x3'));var util=require(_0xb806('0x4'));var Redis=require(_0xb806('0x5'));var intUtil=require(_0xb806('0x6'));var config=require(_0xb806('0x7'));var logger=require('../../../../config/logger')(_0xb806('0x8'));config[_0xb806('0x9')]=_[_0xb806('0xa')](config[_0xb806('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xb806('0xb'))(new Redis(config[_0xb806('0x9')]));var def={'method':'POST','json':!![]};function emit(_0x3525e8,_0x116ef4,_0x2de376){io['to'](_0x3525e8)[_0xb806('0xc')](_0x116ef4,_0x2de376);}function getTicket(_0x5511f4,_0x2b38df,_0x554c82,_0x466e0f,_0x4cd6b4,_0x355422,_0x579e90,_0xaced5b){logger[_0xb806('0xd')](_0xb806('0xe'));var _0x4e2c3c=new Date();var _0x1675db=[{'name':_0xb806('0xf'),'value':intUtil['getString'](_0x466e0f[_0xb806('0x10')],_0x4cd6b4,'\x20')},{'name':_0xb806('0x11'),'value':_0x2b38df['id']},{'name':'created_by','value':_0x2b38df['id']},{'name':_0xb806('0x12'),'value':intUtil[_0xb806('0x13')](_0x466e0f['Descriptions'],_0x4cd6b4,'\x0a')},{'name':_0xb806('0x14'),'value':_0x4e2c3c[_0xb806('0x15')]()[_0xb806('0x16')](0x0,0x13)[_0xb806('0x17')]('T','\x20')},{'name':_0xb806('0x18'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x554c82['id']},{'name':_0xb806('0x19'),'value':'Contacts'},{'name':_0xb806('0x1a'),'value':_0x554c82[_0xb806('0xf')]},{'name':_0xb806('0x1b'),'value':_0xaced5b}];if(_0x355422[_0xb806('0x1c')]){_['forEach'](_0x355422,function(_0x40635c){if(_0x4cd6b4[_0x40635c[_0xb806('0x1d')]]){_0x1675db[_0xb806('0x1e')]({'name':_0x40635c[_0xb806('0x1f')],'value':_0x4cd6b4[_0x40635c[_0xb806('0x1d')]]});}});}return request({'form':{'method':_0xb806('0x20'),'input_type':'JSON','response_type':_0xb806('0x21'),'rest_data':JSON[_0xb806('0x22')]({'session':_0x579e90['id'],'module_name':'Calls','name_value_list':_0x1675db})}});}function getAuth(_0x34b1fa){return util[_0xb806('0x23')](_0xb806('0x24'),new Buffer(_0x34b1fa[_0xb806('0x25')]+':X')['toString'](_0xb806('0x26')));}function getServerInfo(_0x44e06e){return request({'form':{'method':_0xb806('0x27'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xb806('0x22')]({'session':_0x44e06e['id']})}});}function getUser(_0x2130ef,_0x52f12d,_0x570837){if(!_['isNil'](_0x52f12d)){logger[_0xb806('0xd')]('Getting\x20agent\x20with\x20name',_0x52f12d);return request({'form':{'method':'get_entry_list','input_type':_0xb806('0x21'),'response_type':_0xb806('0x21'),'rest_data':JSON[_0xb806('0x22')]({'session':_0x570837['id'],'module_name':_0xb806('0x28'),'query':util[_0xb806('0x23')](_0xb806('0x29'),_0x52f12d),'order_by':'','offset':'0','select_fields':['id',_0xb806('0xf'),_0xb806('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb806('0x2b')](function(_0x487b6f){if(_0x487b6f['entry_list']['length']){var _0x49c53a=_[_0xb806('0x2c')](_0x487b6f[_0xb806('0x2d')],function(_0x512571){return _0x512571[_0xb806('0x2e')][_0xb806('0x2a')][_0xb806('0x2f')]===_0x52f12d;});if(_0x49c53a){logger['info'](_0xb806('0x30'));return BPromise[_0xb806('0x31')]({'id':_0x49c53a['name_value_list']['id'][_0xb806('0x2f')],'name':_0x49c53a[_0xb806('0x2e')][_0xb806('0xf')][_0xb806('0x2f')]});}}logger[_0xb806('0xd')](_0xb806('0x32'));return BPromise[_0xb806('0x31')]({'id':_0x570837['name_value_list'][_0xb806('0x33')][_0xb806('0x2f')],'name':_0x570837[_0xb806('0x2e')]['user_name'][_0xb806('0x2f')]});});}else{logger[_0xb806('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xb806('0x31')]({'id':_0x570837['name_value_list'][_0xb806('0x33')][_0xb806('0x2f')],'name':_0x570837[_0xb806('0x2e')][_0xb806('0x2a')][_0xb806('0x2f')]});}}function getEndUser(_0x5e79ad,_0x300c5b,_0x1c3dca,_0x34c16a){logger[_0xb806('0xd')](_0xb806('0x34'),_0x1c3dca);return request({'form':{'method':_0xb806('0x35'),'input_type':_0xb806('0x21'),'response_type':_0xb806('0x21'),'rest_data':JSON[_0xb806('0x22')]({'session':_0x34c16a['id'],'module_name':'Contacts','query':util[_0xb806('0x23')](_0xb806('0x36'),_0x1c3dca),'order_by':'','offset':'0','select_fields':['id',_0xb806('0xf'),_0xb806('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb806('0x2b')](function(_0x1ad9e8){if(_0x1ad9e8[_0xb806('0x2d')][_0xb806('0x1c')]){var _0x1f1517=_['find'](_0x1ad9e8[_0xb806('0x2d')],function(_0x586fdd){return _0x586fdd[_0xb806('0x2e')][_0xb806('0x37')][_0xb806('0x2f')]===_0x1c3dca;});if(_0x1f1517){logger[_0xb806('0xd')](_0xb806('0x38'));return BPromise[_0xb806('0x31')]({'id':_0x1f1517[_0xb806('0x2e')]['id'][_0xb806('0x2f')],'name':_0x1f1517[_0xb806('0x2e')][_0xb806('0xf')][_0xb806('0x2f')],'phone':_0x1f1517[_0xb806('0x2e')][_0xb806('0x37')]['value']});}}else{logger[_0xb806('0xd')](_0xb806('0x39'));return request({'form':{'method':_0xb806('0x20'),'input_type':_0xb806('0x21'),'response_type':_0xb806('0x21'),'rest_data':JSON[_0xb806('0x22')]({'session':_0x34c16a['id'],'module_name':_0xb806('0x3a'),'name_value_list':[{'name':_0xb806('0x3b'),'value':_0x300c5b!==_0xb806('0x3c')?_0x300c5b:util[_0xb806('0x23')](_0xb806('0x3d'),_0x1c3dca)},{'name':_0xb806('0x37'),'value':_0x1c3dca}]})}})[_0xb806('0x2b')](function(_0x8376a5){logger[_0xb806('0xd')](_0xb806('0x3e'));return BPromise[_0xb806('0x31')]({'id':_0x8376a5['id'],'name':_0x8376a5[_0xb806('0x2d')][_0xb806('0x3b')][_0xb806('0x2f')],'phone':_0x8376a5[_0xb806('0x2d')][_0xb806('0x37')]['value']});});}});}function request(_0x52662f){logger['debug']('[HTTP]',JSON[_0xb806('0x22')](_0x52662f));return rp(_['merge'](def,_0x52662f));}function getTags(_0x711206,_0x2a8e5a){var _0x33c0bc=[];if(_0x711206&&_0x711206[_0xb806('0x1c')]>0x0){_0x33c0bc=_[_0xb806('0x3f')](_0x711206,_0x2a8e5a);}return _0x33c0bc;}function getCustomFields(_0x161150,_0x5120d0){var _0x565f80=[];var _0x32b586={'custom_fields':[]};if(_0x161150[_0xb806('0x1c')]>0x0){_[_0xb806('0x40')](_0x161150,function(_0xb7bc92){if(_0xb7bc92[_0xb806('0x41')]==='string'&&_0xb7bc92['nameField']&&!_0xb7bc92[_0xb806('0x42')]){_0x32b586[_0xb7bc92[_0xb806('0x43')][_0xb806('0x44')]()]=_0xb7bc92['content'][_0xb806('0x45')]();}else if(_0xb7bc92['type']===_0xb806('0x46')&&_0xb7bc92['idField']&&_0xb7bc92['customField']){_0x32b586['custom_fields'][_0xb806('0x1e')]({'id':_0xb7bc92['idField'],'value':_0xb7bc92['content']['toString']()});}else if(_0xb7bc92['type']===_0xb806('0x47')&&_0xb7bc92[_0xb806('0x1d')]&&_0xb7bc92[_0xb806('0x1f')]&&_0xb7bc92['customField']){_0x5120d0[_0xb7bc92[_0xb806('0x1d')]]&&_0x32b586['custom_fields'][_0xb806('0x1e')]({'id':_0xb7bc92['idField'],'value':_0x5120d0[_0xb7bc92['variableName']][_0xb806('0x45')]()});}else if(_0xb7bc92[_0xb806('0x41')]===_0xb806('0x48')&&_0xb7bc92[_0xb806('0x49')]&&_0xb7bc92[_0xb806('0x49')][_0xb806('0xf')]&&_0xb7bc92[_0xb806('0x1f')]&&_0xb7bc92[_0xb806('0x42')]){_0x5120d0[_0xb7bc92[_0xb806('0x49')]['name'][_0xb806('0x44')]()]&&_0x32b586[_0xb806('0x4a')][_0xb806('0x1e')]({'id':_0xb7bc92[_0xb806('0x1f')],'value':_0x5120d0[_0xb7bc92['Variable']['name'][_0xb806('0x44')]()][_0xb806('0x45')]()});}});}return _0x32b586;}function getConnection(_0x3164fb){return request({'method':_0xb806('0x4b'),'form':{'method':'login','input_type':'JSON','response_type':_0xb806('0x21'),'rest_data':JSON[_0xb806('0x22')]({'user_auth':{'user_name':_0x3164fb[_0xb806('0x4c')],'password':_0x3164fb[_0xb806('0x4d')],'encryption':_0xb806('0x4e')},'application':_0xb806('0x4f')})}})['then'](function(_0x222bc4){var _0x1fdea6=_0x222bc4;if(_0x1fdea6['id']){def[_0xb806('0x50')]=_0x1fdea6['id'];return BPromise[_0xb806('0x31')](_0x1fdea6);}else{throw new Error(util['format'](_0xb806('0x51'),_0x3164fb['id']));}});}function setRelationship(_0x27c12a,_0x3d4a7a,_0x1c21e2,_0x446259){return request({'form':{'method':_0xb806('0x52'),'input_type':_0xb806('0x21'),'response_type':'JSON','rest_data':JSON[_0xb806('0x22')]({'session':_0x27c12a['id'],'module_name':_0xb806('0x53'),'module_id':_0x1c21e2['id'],'link_field_name':_0x446259,'related_ids':[_0x3d4a7a['id']]})}});}exports[_0xb806('0x54')]=function(_0x37a67f,_0x292aaf,_0x420e69,_0x182fa5,_0x2b95cc,_0x4b34e8){var _0x4cc132,_0x46a882,_0x4f4131,_0x5e656e;_0x4b34e8['remoteUri']=intUtil[_0xb806('0x55')](_0x4b34e8['remoteUri']);_0x4b34e8[_0xb806('0x56')]=intUtil[_0xb806('0x55')](_0x4b34e8[_0xb806('0x56')]);def[_0xb806('0x57')]=util['format']('%s/service/v4_1/rest.php',_0x4b34e8['remoteUri']);if(_0x2b95cc&&_0x2b95cc[_0xb806('0x58')]){logger[_0xb806('0xd')]('[QUEUE]',_0xb806('0x59'));_0x292aaf[_0xb806('0x5a')]=util[_0xb806('0x23')](_0xb806('0x5b'),_0x4b34e8[_0xb806('0x56')],_0x292aaf[_0xb806('0x5c')],md5(_0x292aaf[_0xb806('0x5c')]));}else{_0x292aaf[_0xb806('0x5a')]='';}return getConnection(_0x4b34e8)[_0xb806('0x2b')](function(_0x53d0ff){_0x5e656e=_0x53d0ff;return getUser(_0x4b34e8,_0x182fa5[_0xb806('0xf')],_0x5e656e);})[_0xb806('0x2b')](function(_0x24bb13){_0x4cc132=_0x24bb13;logger['info']('The\x20User\x20ID\x20is:',_0x4cc132['id']);return getEndUser(_0x4b34e8,_0x292aaf[_0xb806('0x5d')],_0x292aaf['calleridnum'],_0x5e656e);})[_0xb806('0x2b')](function(_0x2f4c76){_0x46a882=_0x2f4c76;logger['info'](_0xb806('0x5e'),_0x46a882['id']);return getTicket(_0x4b34e8,_0x4cc132,_0x46a882,_0x420e69,_0x292aaf,_0x420e69[_0xb806('0x5f')],_0x5e656e,_0xb806('0x60'));})['then'](function(_0x465b35){_0x4f4131=_0x465b35;logger[_0xb806('0xd')](_0xb806('0x61'));logger['info'](_0xb806('0x62'),_0x4f4131['id']);return setRelationship(_0x5e656e,_0x4cc132,_0x4f4131,_0xb806('0x63'));})[_0xb806('0x2b')](function(){return setRelationship(_0x5e656e,_0x46a882,_0x4f4131,_0xb806('0x64'));})['then'](function(){return getServerInfo(_0x5e656e);})[_0xb806('0x2b')](function(_0x52cf01){var _0x12e31e=parseInt(_0x52cf01[_0xb806('0x65')][_0xb806('0x66')](0x0));var _0x9eed0=util[_0xb806('0x23')](_0xb806('0x67'),_0x4b34e8[_0xb806('0x68')],_0x4f4131['id']);if(_0x12e31e>0x6){_0x9eed0=util['format'](_0xb806('0x69'),_0x4b34e8[_0xb806('0x68')],_0x4f4131['id']);}logger[_0xb806('0xd')](_0xb806('0x6a'),_0xb806('0x6b'));emit(util[_0xb806('0x23')](_0xb806('0x6c'),_0x182fa5['name']),_0xb806('0x6d'),{'uri':_0x9eed0});})[_0xb806('0x6e')](function(_0xc7abd5){logger[_0xb806('0x6f')](_0xb806('0x6a'),JSON['stringify'](_0xc7abd5));});};exports[_0xb806('0x70')]=function(_0x427935,_0x414869,_0x4cb510,_0x5ae1c8,_0x3b3536,_0xe9e14,_0x4bcbdd){var _0x1bd79c,_0x42cf0f,_0x2da88b,_0x5b13e9;_0xe9e14['remoteUri']=intUtil[_0xb806('0x55')](_0xe9e14[_0xb806('0x68')]);_0xe9e14['serverUrl']=intUtil[_0xb806('0x55')](_0xe9e14[_0xb806('0x56')]);def['uri']=util[_0xb806('0x23')]('%s/service/v4_1/rest.php',_0xe9e14[_0xb806('0x68')]);if(_0x4bcbdd&&_0x4bcbdd[_0xb806('0x71')]&&_0x4bcbdd[_0xb806('0x71')]!=='none'){logger['info'](_0xb806('0x72'),_0xb806('0x59'));_0x414869[_0xb806('0x5a')]=util[_0xb806('0x23')](_0xb806('0x5b'),_0xe9e14[_0xb806('0x56')],_0x414869[_0xb806('0x5c')],md5(_0x414869[_0xb806('0x5c')]));}return getConnection(_0xe9e14)[_0xb806('0x2b')](function(_0x2703c3){_0x5b13e9=_0x2703c3;return getUser(_0xe9e14,_0x5ae1c8[_0xb806('0xf')],_0x5b13e9);})[_0xb806('0x2b')](function(_0x458b5c){_0x1bd79c=_0x458b5c;logger[_0xb806('0xd')](_0xb806('0x73'),_0x1bd79c['id']);return getEndUser(_0xe9e14,_0x414869[_0xb806('0x74')],_0x414869[_0xb806('0x75')],_0x5b13e9);})[_0xb806('0x2b')](function(_0x4b7c35){_0x42cf0f=_0x4b7c35;logger['info'](_0xb806('0x5e'),_0x42cf0f['id']);return getTicket(_0xe9e14,_0x1bd79c,_0x42cf0f,_0x4cb510,_0x414869,_0x4cb510[_0xb806('0x5f')],_0x5b13e9,_0xb806('0x76'));})['then'](function(_0x43d403){_0x2da88b=_0x43d403;logger['info'](_0xb806('0x61'));logger[_0xb806('0xd')](_0xb806('0x62'),_0x2da88b['id']);return setRelationship(_0x5b13e9,_0x1bd79c,_0x2da88b,_0xb806('0x63'));})['then'](function(){return setRelationship(_0x5b13e9,_0x42cf0f,_0x2da88b,_0xb806('0x64'));})[_0xb806('0x2b')](function(){return getServerInfo(_0x5b13e9);})[_0xb806('0x2b')](function(_0x14a884){var _0x7914ab=parseInt(_0x14a884[_0xb806('0x65')][_0xb806('0x66')](0x0));var _0x128efc=util[_0xb806('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0xe9e14[_0xb806('0x68')],_0x2da88b['id']);if(_0x7914ab>0x6){_0x128efc=util[_0xb806('0x23')](_0xb806('0x69'),_0xe9e14[_0xb806('0x68')],_0x2da88b['id']);}logger[_0xb806('0xd')](_0xb806('0x72'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x5ae1c8[_0xb806('0xf')]),'trigger:browser:url',{'uri':_0x128efc});})[_0xb806('0x6e')](function(_0x1ac75f){logger[_0xb806('0x6f')](_0xb806('0x72'),JSON['stringify'](_0x1ac75f));});};exports[_0xb806('0x77')]=function(_0x58fe75,_0x1561e0,_0x3c5a58,_0xe98955,_0x44c7fe,_0x5600be){var _0x55efad,_0x7cb484,_0x1919fa,_0x4ce991;_0x5600be[_0xb806('0x68')]=intUtil[_0xb806('0x55')](_0x5600be[_0xb806('0x68')]);_0x5600be[_0xb806('0x56')]=intUtil[_0xb806('0x55')](_0x5600be[_0xb806('0x56')]);def['uri']=util[_0xb806('0x23')]('%s/service/v4_1/rest.php',_0x5600be[_0xb806('0x68')]);if(_0x44c7fe&&_0x44c7fe[_0xb806('0x58')]){logger['info']('['+_0x1561e0[_0xb806('0x78')][_0xb806('0x79')]()+']',_0xb806('0x59'));_0x1561e0[_0xb806('0x5a')]=util[_0xb806('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5600be[_0xb806('0x56')],_0x1561e0[_0xb806('0x5c')],md5(_0x1561e0[_0xb806('0x5c')]));}else{_0x1561e0[_0xb806('0x5a')]='';}return getConnection(_0x5600be)[_0xb806('0x2b')](function(_0x59967e){_0x4ce991=_0x59967e;if(!_[_0xb806('0x7a')](_0xe98955)){return getUser(_0x5600be,_0xe98955[_0xb806('0xf')],_0x4ce991);}else{return getUser(_0x5600be,null,_0x4ce991);}})[_0xb806('0x2b')](function(_0x281f97){_0x55efad=_0x281f97;logger['info'](_0xb806('0x73'),_0x55efad['id']);return getEndUser(_0x5600be,_0x1561e0[_0xb806('0x5d')],_0x1561e0[_0xb806('0x7b')],_0x4ce991);})[_0xb806('0x2b')](function(_0x3d9cca){_0x7cb484=_0x3d9cca;logger[_0xb806('0xd')](_0xb806('0x5e'),_0x7cb484['id']);return getTicket(_0x5600be,_0x55efad,_0x7cb484,_0x3c5a58,_0x1561e0,_0x3c5a58[_0xb806('0x5f')],_0x4ce991,_0xb806('0x60'));})[_0xb806('0x2b')](function(_0x4d7935){_0x1919fa=_0x4d7935;logger[_0xb806('0xd')](_0xb806('0x61'));logger['info'](_0xb806('0x62'),_0x1919fa['id']);return setRelationship(_0x4ce991,_0x55efad,_0x1919fa,_0xb806('0x63'));})[_0xb806('0x2b')](function(){return setRelationship(_0x4ce991,_0x7cb484,_0x1919fa,'contacts');})[_0xb806('0x2b')](function(){return getServerInfo(_0x4ce991);})[_0xb806('0x6e')](function(_0x571906){logger[_0xb806('0x6f')]('['+_0x1561e0[_0xb806('0x78')]['toUpperCase']()+']',JSON[_0xb806('0x22')](_0x571906));});}; \ 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 6c65387..7846cd8 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 _0x4279=['getString','length','sortBy','string','push','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyContent','keyType','join','slice','lastIndexOf','validateEmail','test','lodash','util'];(function(_0x2336ea,_0x46e872){var _0x216bf9=function(_0x14a50d){while(--_0x14a50d){_0x2336ea['push'](_0x2336ea['shift']());}};_0x216bf9(++_0x46e872);}(_0x4279,0x11c));var _0x9427=function(_0x539105,_0x248775){_0x539105=_0x539105-0x0;var _0x29dc18=_0x4279[_0x539105];return _0x29dc18;};'use strict';var _=require(_0x9427('0x0'));var util=require(_0x9427('0x1'));exports[_0x9427('0x2')]=function(_0x1558b5,_0x35832c,_0x32e980){var _0x41ac1e=[];if(_0x1558b5[_0x9427('0x3')]>0x0){var _0x4edbfd=_[_0x9427('0x4')](_0x1558b5,['id']);for(var _0x399828=0x0;_0x399828<_0x4edbfd[_0x9427('0x3')];_0x399828++){var _0x5cdee5=_0x4edbfd[_0x399828];if(_0x5cdee5['type']===_0x9427('0x5')){_0x41ac1e[_0x9427('0x6')](_0x5cdee5['content']);}else if(_0x5cdee5[_0x9427('0x7')]===_0x9427('0x8')&&_0x5cdee5[_0x9427('0x9')]){_0x35832c[_0x5cdee5['variableName']]&&_0x41ac1e[_0x9427('0x6')](_0x35832c[_0x5cdee5[_0x9427('0x9')]][_0x9427('0xa')]());}else if(_0x5cdee5[_0x9427('0x7')]===_0x9427('0xb')&&_0x5cdee5[_0x9427('0xc')]&&_0x5cdee5[_0x9427('0xc')][_0x9427('0xd')]){_0x35832c[_0x5cdee5[_0x9427('0xc')][_0x9427('0xd')][_0x9427('0xe')]()]&&_0x41ac1e['push'](_0x35832c[_0x5cdee5[_0x9427('0xc')][_0x9427('0xd')]['toLowerCase']()]['toString']());}else if(_0x5cdee5[_0x9427('0x7')]===_0x9427('0xf')){if(_0x5cdee5['keyType']===_0x9427('0x5')&&_0x5cdee5[_0x9427('0x10')]){_0x41ac1e[_0x9427('0x6')](util[_0x9427('0x11')](_0x9427('0x12'),_0x5cdee5['key'],_0x5cdee5[_0x9427('0x13')]));}else if(_0x5cdee5[_0x9427('0x14')]===_0x9427('0x8')&&_0x5cdee5[_0x9427('0x9')]&&_0x5cdee5[_0x9427('0x10')]){_0x35832c[_0x5cdee5[_0x9427('0x9')]]&&_0x41ac1e[_0x9427('0x6')](util[_0x9427('0x11')](_0x9427('0x12'),_0x5cdee5[_0x9427('0x10')],_0x35832c[_0x5cdee5[_0x9427('0x9')]]));}else if(_0x5cdee5['keyType']===_0x9427('0xb')&&_0x5cdee5[_0x9427('0xc')]&&_0x5cdee5[_0x9427('0xc')][_0x9427('0xd')]&&_0x5cdee5['key']){_0x35832c[_0x5cdee5[_0x9427('0xc')][_0x9427('0xd')][_0x9427('0xe')]()]&&_0x41ac1e[_0x9427('0x6')](util[_0x9427('0x11')](_0x9427('0x12'),_0x5cdee5[_0x9427('0x10')],_0x35832c[_0x5cdee5[_0x9427('0xc')][_0x9427('0xd')]['toLowerCase']()]));}}}}return _0x41ac1e[_0x9427('0x15')](_0x32e980);};exports['stripTrailingSlash']=function(_0x4aa06c){var _0x2b8703=_0x4aa06c[_0x9427('0x16')](-0x1);if(_0x2b8703==='/'){_0x4aa06c=_0x4aa06c['substring'](0x0,_0x4aa06c[_0x9427('0x17')](_0x2b8703));}return _0x4aa06c;};exports[_0x9427('0x18')]=function(_0x2136b1){if(!_['isNil'](_0x2136b1)&&_0x2136b1!==''){var _0x56955c=/^(([^<>()\[\]\\.,;:\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 _0x56955c[_0x9427('0x19')](String(_0x2136b1)[_0x9427('0xe')]());}else{return![];}}; \ No newline at end of file +var _0xda3d=['validateEmail','isNil','test','getString','length','string','push','content','type','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','customVariable','stripTrailingSlash','slice','lastIndexOf'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xda3d,0x17a));var _0xdda3=function(_0xb945f4,_0xcf8347){_0xb945f4=_0xb945f4-0x0;var _0x17cd70=_0xda3d[_0xb945f4];return _0x17cd70;};'use strict';var _=require('lodash');var util=require('util');exports[_0xdda3('0x0')]=function(_0x9d74c6,_0x33919a,_0x2dfeda){var _0xeb4015=[];if(_0x9d74c6[_0xdda3('0x1')]>0x0){var _0x489a75=_['sortBy'](_0x9d74c6,['id']);for(var _0x178a8d=0x0;_0x178a8d<_0x489a75[_0xdda3('0x1')];_0x178a8d++){var _0x1d7932=_0x489a75[_0x178a8d];if(_0x1d7932['type']===_0xdda3('0x2')){_0xeb4015[_0xdda3('0x3')](_0x1d7932[_0xdda3('0x4')]);}else if(_0x1d7932[_0xdda3('0x5')]===_0xdda3('0x6')&&_0x1d7932[_0xdda3('0x7')]){_0x33919a[_0x1d7932[_0xdda3('0x7')]]&&_0xeb4015[_0xdda3('0x3')](_0x33919a[_0x1d7932[_0xdda3('0x7')]][_0xdda3('0x8')]());}else if(_0x1d7932['type']==='customVariable'&&_0x1d7932[_0xdda3('0x9')]&&_0x1d7932['Variable'][_0xdda3('0xa')]){_0x33919a[_0x1d7932[_0xdda3('0x9')]['name'][_0xdda3('0xb')]()]&&_0xeb4015[_0xdda3('0x3')](_0x33919a[_0x1d7932['Variable'][_0xdda3('0xa')][_0xdda3('0xb')]()][_0xdda3('0x8')]());}else if(_0x1d7932[_0xdda3('0x5')]===_0xdda3('0xc')){if(_0x1d7932[_0xdda3('0xd')]===_0xdda3('0x2')&&_0x1d7932[_0xdda3('0xe')]){_0xeb4015[_0xdda3('0x3')](util[_0xdda3('0xf')](_0xdda3('0x10'),_0x1d7932[_0xdda3('0xe')],_0x1d7932[_0xdda3('0x11')]));}else if(_0x1d7932['keyType']==='variable'&&_0x1d7932['variableName']&&_0x1d7932['key']){_0x33919a[_0x1d7932['variableName']]&&_0xeb4015[_0xdda3('0x3')](util[_0xdda3('0xf')](_0xdda3('0x10'),_0x1d7932[_0xdda3('0xe')],_0x33919a[_0x1d7932[_0xdda3('0x7')]]));}else if(_0x1d7932[_0xdda3('0xd')]===_0xdda3('0x12')&&_0x1d7932[_0xdda3('0x9')]&&_0x1d7932[_0xdda3('0x9')][_0xdda3('0xa')]&&_0x1d7932['key']){_0x33919a[_0x1d7932[_0xdda3('0x9')][_0xdda3('0xa')][_0xdda3('0xb')]()]&&_0xeb4015[_0xdda3('0x3')](util[_0xdda3('0xf')](_0xdda3('0x10'),_0x1d7932['key'],_0x33919a[_0x1d7932[_0xdda3('0x9')]['name'][_0xdda3('0xb')]()]));}}}}return _0xeb4015['join'](_0x2dfeda);};exports[_0xdda3('0x13')]=function(_0x4a0813){var _0x37f985=_0x4a0813[_0xdda3('0x14')](-0x1);if(_0x37f985==='/'){_0x4a0813=_0x4a0813['substring'](0x0,_0x4a0813[_0xdda3('0x15')](_0x37f985));}return _0x4a0813;};exports[_0xdda3('0x16')]=function(_0x5e1b69){if(!_[_0xdda3('0x17')](_0x5e1b69)&&_0x5e1b69!==''){var _0x391892=/^(([^<>()\[\]\\.,;:\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 _0x391892[_0xdda3('0x18')](String(_0x5e1b69)[_0xdda3('0xb')]());}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 69bf01c..61c29a2 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 _0x6e37=['statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','info','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','getUser','userId','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;','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','getEndUser','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','[QUEUE]','user:%s','trigger:browser:url','outbound','recordingFormat','none','destcalleridname','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]','unmanaged','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lastevent','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','length','type','string','idField','content','toString','variableName','Variable','name','toLowerCase','Creating\x20new\x20ticket...','Normal','Open','getString','Descriptions','POST','format','%s/webservice.php','remoteUri','create','username','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch'];(function(_0x3ed2ba,_0x5ebb2f){var _0x3c9ac8=function(_0x2e6304){while(--_0x2e6304){_0x3ed2ba['push'](_0x3ed2ba['shift']());}};_0x3c9ac8(++_0x5ebb2f);}(_0x6e37,0x1bc));var _0x76e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6e37[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x76e3('0x0'));var rp=require(_0x76e3('0x1'));var BPromise=require(_0x76e3('0x2'));var md5=require(_0x76e3('0x3'));var util=require(_0x76e3('0x4'));var Redis=require(_0x76e3('0x5'));var intUtil=require(_0x76e3('0x6'));var config=require(_0x76e3('0x7'));var logger=require(_0x76e3('0x8'))('vTiger');config['redis']=_[_0x76e3('0x9')](config[_0x76e3('0xa')],{'host':_0x76e3('0xb'),'port':0x18eb});var io=require(_0x76e3('0xc'))(new Redis(config[_0x76e3('0xa')]));function emit(_0x39f385,_0x100b22,_0x179e32){io['to'](_0x39f385)['emit'](_0x100b22,_0x179e32);}function getCustomFields(_0x1fae4b,_0x265180){var _0x532521={};if(_0x1fae4b[_0x76e3('0xd')]>0x0){_['forEach'](_0x1fae4b,function(_0x201b8f){if(_0x201b8f[_0x76e3('0xe')]===_0x76e3('0xf')&&_0x201b8f[_0x76e3('0x10')]){_0x532521[_0x201b8f['idField']]=_0x201b8f[_0x76e3('0x11')][_0x76e3('0x12')]();}else if(_0x201b8f[_0x76e3('0xe')]==='variable'&&_0x201b8f[_0x76e3('0x13')]&&_0x201b8f['idField']&&_0x265180[_0x201b8f['variableName']]){_0x532521[_0x201b8f[_0x76e3('0x10')]]=_0x265180[_0x201b8f['variableName']]['toString']();}else if(_0x201b8f[_0x76e3('0xe')]==='customVariable'&&_0x201b8f[_0x76e3('0x14')]&&_0x201b8f['Variable']['name']&&_0x201b8f[_0x76e3('0x10')]&&_0x265180[_0x201b8f[_0x76e3('0x14')][_0x76e3('0x15')][_0x76e3('0x16')]()]){_0x532521[_0x201b8f['idField']]=_0x265180[_0x201b8f[_0x76e3('0x14')][_0x76e3('0x15')][_0x76e3('0x16')]()]['toString']();}});}return _0x532521;}function createTicket(_0x468e52,_0x48602f,_0x42b7cd,_0x486379,_0x2c4fd8,_0x5d9775,_0xb385c5){logger['info'](_0x76e3('0x17'));var _0xa1f7c1=_['merge']({'parent_id':'','assigned_user_id':_0x48602f['id'],'ticketpriorities':_0x76e3('0x18'),'ticketstatus':_0x76e3('0x19'),'ticket_title':intUtil[_0x76e3('0x1a')](_0x486379['Subjects'],_0x2c4fd8,'\x20'),'description':intUtil[_0x76e3('0x1a')](_0x486379[_0x76e3('0x1b')],_0x2c4fd8,'\x0a'),'contact_id':_0x42b7cd['id']},getCustomFields(_0x5d9775,_0x2c4fd8));var _0x4dec6f={'method':_0x76e3('0x1c'),'uri':util[_0x76e3('0x1d')](_0x76e3('0x1e'),_0x468e52[_0x76e3('0x1f')]),'form':{'operation':_0x76e3('0x20'),'username':_0x468e52[_0x76e3('0x21')],'sessionName':_0xb385c5['sessionName'],'elementType':'HelpDesk','element':JSON[_0x76e3('0x22')](_0xa1f7c1)},'json':!![]};return request(_0x4dec6f)[_0x76e3('0x23')](function(_0x219421){if(_0x219421[_0x76e3('0x24')]){return BPromise[_0x76e3('0x25')]({'id':_0x219421[_0x76e3('0x26')]['id']});}else{throw new Error(util[_0x76e3('0x1d')](_0x76e3('0x27'),JSON[_0x76e3('0x22')](_0x219421['error'])));}})[_0x76e3('0x28')](function(_0x4f9d88){var _0x39af4b=_0x4f9d88[_0x76e3('0x29')]||0x1f4;logger[_0x76e3('0x2a')](_0x76e3('0x2b'),_0x76e3('0x2c'),_0x39af4b,JSON[_0x76e3('0x22')](_0x4f9d88));});}function getUser(_0x370819,_0x3cb18e,_0x417bf1){if(intUtil['validateEmail'](_0x3cb18e)){logger[_0x76e3('0x2d')]('Getting\x20agent\x20with\x20email',_0x3cb18e);return request({'method':_0x76e3('0x2e'),'uri':util[_0x76e3('0x1d')]('%s/webservice.php',_0x370819[_0x76e3('0x1f')]),'qs':{'operation':_0x76e3('0x2f'),'username':_0x370819['username'],'sessionName':_0x417bf1[_0x76e3('0x30')],'query':util[_0x76e3('0x1d')](_0x76e3('0x31'),_0x3cb18e)},'json':!![]})['then'](function(_0x1db7a0){if(_0x1db7a0[_0x76e3('0x24')]&&_0x1db7a0[_0x76e3('0x26')][_0x76e3('0xd')]){logger[_0x76e3('0x2d')]('Agent\x20found!');return BPromise[_0x76e3('0x25')]({'id':_0x1db7a0[_0x76e3('0x26')][0x0]['id'],'email':_0x1db7a0[_0x76e3('0x26')][0x0][_0x76e3('0x32')],'name':_0x1db7a0[_0x76e3('0x26')][0x0][_0x76e3('0x33')]+'\x20'+_0x1db7a0[_0x76e3('0x26')]['last_name']});}else{logger['info'](_0x76e3('0x34'));return BPromise[_0x76e3('0x25')]({'id':_0x417bf1['userId'],'email':_0x370819[_0x76e3('0x21')],'name':'admin'});}})[_0x76e3('0x28')](function(_0x505fae){var _0x55083f=_0x505fae[_0x76e3('0x29')]||0x1f4;logger[_0x76e3('0x2a')](_0x76e3('0x2b'),_0x76e3('0x35'),_0x55083f,JSON[_0x76e3('0x22')](_0x505fae));});}else{logger['info'](_0x76e3('0x34'));return BPromise[_0x76e3('0x25')]({'id':_0x417bf1[_0x76e3('0x36')],'email':_0x370819['username'],'name':_0x76e3('0x37')})['catch'](function(_0x500f84){var _0x4fc1ae=_0x500f84['statusCode']||0x1f4;logger[_0x76e3('0x2a')](_0x76e3('0x2b'),'getUser',_0x4fc1ae,JSON[_0x76e3('0x22')](_0x500f84));});}}function getEndUser(_0x501447,_0x43945a,_0x5548bb,_0x3171d7){logger[_0x76e3('0x2d')]('Searching\x20end\x20user\x20with\x20phone',_0x5548bb);return request({'method':_0x76e3('0x2e'),'uri':util['format'](_0x76e3('0x1e'),_0x501447[_0x76e3('0x1f')]),'qs':{'operation':_0x76e3('0x2f'),'username':_0x501447[_0x76e3('0x21')],'sessionName':_0x3171d7[_0x76e3('0x30')],'query':util[_0x76e3('0x1d')](_0x76e3('0x38'),_0x5548bb,_0x5548bb,_0x5548bb,_0x5548bb,_0x5548bb)},'json':!![]})[_0x76e3('0x23')](function(_0x2e5c81){if(_0x2e5c81[_0x76e3('0x24')]&&_0x2e5c81[_0x76e3('0x26')][_0x76e3('0xd')]){logger[_0x76e3('0x2d')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x2e5c81[_0x76e3('0x26')][0x0]['id'],'name':_0x2e5c81[_0x76e3('0x26')][0x0][_0x76e3('0x39')]+'\x20'+_0x2e5c81[_0x76e3('0x26')][0x0][_0x76e3('0x3a')],'phone':_0x5548bb});}else{logger[_0x76e3('0x2d')](_0x76e3('0x3b'));return request({'method':_0x76e3('0x1c'),'uri':util[_0x76e3('0x1d')](_0x76e3('0x1e'),_0x501447[_0x76e3('0x1f')]),'form':{'operation':_0x76e3('0x20'),'sessionName':_0x3171d7[_0x76e3('0x30')],'elementType':_0x76e3('0x3c'),'element':JSON['stringify']({'lastname':_0x43945a,'phone':_0x5548bb,'assigned_user_id':'\x20'})},'json':!![]})[_0x76e3('0x23')](function(_0x23b168){logger[_0x76e3('0x2d')](_0x76e3('0x3d'));return BPromise[_0x76e3('0x25')]({'id':_0x23b168[_0x76e3('0x26')]['id'],'name':_0x23b168['result']['lastname'],'phone':_0x23b168[_0x76e3('0x26')]['phone']});})[_0x76e3('0x28')](function(_0x46c251){var _0x45e0d3=_0x46c251['statusCode']||0x1f4;logger[_0x76e3('0x2a')](_0x76e3('0x2b'),_0x76e3('0x3e'),_0x45e0d3,JSON['stringify'](_0x46c251));});}});}function getConnection(_0x5904f6){var _0xb3db6a=_0x5904f6[_0x76e3('0x21')];var _0x4891a9=_0x5904f6[_0x76e3('0x3f')];return request({'method':_0x76e3('0x2e'),'uri':util[_0x76e3('0x1d')](_0x76e3('0x1e'),_0x5904f6[_0x76e3('0x1f')]),'qs':{'operation':_0x76e3('0x40'),'username':_0xb3db6a},'json':!![]})[_0x76e3('0x23')](function(_0xc17ca5){if(_0xc17ca5[_0x76e3('0x24')]){return request({'method':'POST','uri':util[_0x76e3('0x1d')](_0x76e3('0x1e'),_0x5904f6[_0x76e3('0x1f')]),'form':{'operation':'login','username':_0xb3db6a,'accessKey':md5(_0xc17ca5[_0x76e3('0x26')][_0x76e3('0x41')]+_0x4891a9)},'json':!![]});}})[_0x76e3('0x23')](function(_0x31157e){if(_0x31157e[_0x76e3('0x24')]){return BPromise[_0x76e3('0x25')](_0x31157e[_0x76e3('0x26')]);}else{throw new Error(util[_0x76e3('0x1d')](_0x76e3('0x42'),_0x5904f6['id']));}})[_0x76e3('0x28')](function(_0x15ad5){var _0x22cc8e=_0x15ad5[_0x76e3('0x29')]||0x1f4;logger[_0x76e3('0x2a')]('[vTiger],\x20%s,\x20%s,\x20%s','getConnection',_0x22cc8e,JSON['stringify'](_0x15ad5));});}function request(_0x4b3c68){logger[_0x76e3('0x2d')](_0x76e3('0x43'),JSON[_0x76e3('0x22')](_0x4b3c68));return rp(_0x4b3c68);}exports['queue']=function(_0x270b4f,_0x166ae8,_0x267af1,_0x468d7b,_0x3b3411,_0x1ceb25){var _0x57b0ce,_0x5d727d,_0x235ad0,_0x44a8d4;_0x1ceb25[_0x76e3('0x1f')]=intUtil[_0x76e3('0x44')](_0x1ceb25[_0x76e3('0x1f')]);if(_0x3b3411&&_0x3b3411[_0x76e3('0x45')]){logger['info']('[QUEUE]',_0x76e3('0x46'));_0x166ae8[_0x76e3('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ceb25[_0x76e3('0x48')],_0x166ae8[_0x76e3('0x49')],md5(_0x166ae8[_0x76e3('0x49')]));}else{_0x166ae8[_0x76e3('0x47')]='';}return getConnection(_0x1ceb25)[_0x76e3('0x23')](function(_0x49ae0c){_0x44a8d4=_0x49ae0c;return getUser(_0x1ceb25,_0x468d7b[_0x76e3('0x4a')],_0x44a8d4);})[_0x76e3('0x23')](function(_0xbd8892){_0x57b0ce=_0xbd8892;logger[_0x76e3('0x2d')](_0x76e3('0x4b'),_0x57b0ce['id']);return getEndUser(_0x1ceb25,_0x166ae8[_0x76e3('0x4c')],_0x166ae8[_0x76e3('0x4d')],_0x44a8d4);})[_0x76e3('0x23')](function(_0x2f6da0){_0x5d727d=_0x2f6da0;logger[_0x76e3('0x2d')](_0x76e3('0x4e'),_0x5d727d['id']);return createTicket(_0x1ceb25,_0x57b0ce,_0x5d727d,_0x267af1,_0x166ae8,_0x267af1[_0x76e3('0x4f')],_0x44a8d4);})[_0x76e3('0x23')](function(_0x43e13c){_0x235ad0=_0x43e13c;logger[_0x76e3('0x2d')]('Ticket\x20created!');logger[_0x76e3('0x2d')](_0x76e3('0x50'),_0x235ad0['id']);var _0x5d55f2=util[_0x76e3('0x1d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x1ceb25[_0x76e3('0x1f')],_[_0x76e3('0x51')](_0x235ad0['id'],'x')[0x1]);logger[_0x76e3('0x2d')](_0x76e3('0x52'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x76e3('0x1d')](_0x76e3('0x53'),_0x468d7b[_0x76e3('0x15')]),_0x76e3('0x54'),{'uri':_0x5d55f2});})['catch'](function(_0x3cf326){logger[_0x76e3('0x2a')](_0x76e3('0x52'),JSON[_0x76e3('0x22')](_0x3cf326));});};exports[_0x76e3('0x55')]=function(_0x280cd5,_0x490620,_0x4b694e,_0xa81634,_0x12bf68,_0x41fac7,_0x29a1b5){var _0x727f0e,_0x1f7839,_0x484a1b,_0x191301;_0x41fac7[_0x76e3('0x1f')]=intUtil[_0x76e3('0x44')](_0x41fac7[_0x76e3('0x1f')]);_0x41fac7[_0x76e3('0x48')]=intUtil[_0x76e3('0x44')](_0x41fac7[_0x76e3('0x48')]);if(_0x29a1b5&&_0x29a1b5[_0x76e3('0x56')]&&_0x29a1b5[_0x76e3('0x56')]!==_0x76e3('0x57')){logger[_0x76e3('0x2d')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x490620[_0x76e3('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x41fac7['serverUrl'],_0x490620[_0x76e3('0x49')],md5(_0x490620['uniqueid']));}return getConnection(_0x41fac7)[_0x76e3('0x23')](function(_0x2d7830){_0x191301=_0x2d7830;return getUser(_0x41fac7,_0xa81634[_0x76e3('0x4a')],_0x191301);})[_0x76e3('0x23')](function(_0x5f5203){_0x727f0e=_0x5f5203;logger[_0x76e3('0x2d')]('The\x20User\x20ID\x20is:',_0x727f0e['id']);return getEndUser(_0x41fac7,_0x490620[_0x76e3('0x58')],_0x490620['destcalleridnum'],_0x191301);})[_0x76e3('0x23')](function(_0x8cae8f){_0x1f7839=_0x8cae8f;logger['info'](_0x76e3('0x4e'),_0x1f7839['id']);return createTicket(_0x41fac7,_0x727f0e,_0x1f7839,_0x4b694e,_0x490620,_0x4b694e[_0x76e3('0x4f')],_0x191301);})['then'](function(_0x5bab83){_0x484a1b=_0x5bab83;logger[_0x76e3('0x2d')](_0x76e3('0x59'));logger[_0x76e3('0x2d')](_0x76e3('0x50'),_0x484a1b['id']);var _0x49bea8=util[_0x76e3('0x1d')](_0x76e3('0x5a'),_0x41fac7[_0x76e3('0x1f')],_[_0x76e3('0x51')](_0x484a1b['id'],'x')[0x1]);logger[_0x76e3('0x2d')]('[OUTBOUND]',_0x76e3('0x5b'));emit(util[_0x76e3('0x1d')](_0x76e3('0x53'),_0xa81634[_0x76e3('0x15')]),'trigger:browser:url',{'uri':_0x49bea8});})[_0x76e3('0x28')](function(_0x5aa6fe){logger[_0x76e3('0x2a')](_0x76e3('0x5c'),JSON[_0x76e3('0x22')](_0x5aa6fe));});};exports[_0x76e3('0x5d')]=function(_0x3541f0,_0x42bad2,_0x34dfe1,_0x5c6d86,_0x486419,_0xdbf9d9){var _0x180aa4,_0xb05838,_0x65cf86,_0x19c030;_0xdbf9d9[_0x76e3('0x1f')]=intUtil[_0x76e3('0x44')](_0xdbf9d9[_0x76e3('0x1f')]);_0xdbf9d9['serverUrl']=intUtil[_0x76e3('0x44')](_0xdbf9d9[_0x76e3('0x48')]);if(_0x486419&&_0x486419['monitor_format']){logger[_0x76e3('0x2d')]('['+_0x42bad2['lastevent'][_0x76e3('0x5e')]()+']',_0x76e3('0x46'));_0x42bad2['recordingURL']=util[_0x76e3('0x1d')](_0x76e3('0x5f'),_0xdbf9d9['serverUrl'],_0x42bad2[_0x76e3('0x49')],md5(_0x42bad2[_0x76e3('0x49')]));}else{_0x42bad2[_0x76e3('0x47')]='';}return getConnection(_0xdbf9d9)[_0x76e3('0x23')](function(_0x5765f9){_0x19c030=_0x5765f9;return getUser(_0xdbf9d9,'',_0x19c030);})[_0x76e3('0x23')](function(_0x2336f6){_0x180aa4=_0x2336f6;logger[_0x76e3('0x2d')]('The\x20User\x20ID\x20is:',_0x180aa4['id']);return getEndUser(_0xdbf9d9,_0x42bad2[_0x76e3('0x4c')],_0x42bad2[_0x76e3('0x4d')],_0x19c030);})[_0x76e3('0x23')](function(_0x9729d4){_0xb05838=_0x9729d4;logger[_0x76e3('0x2d')](_0x76e3('0x4e'),_0xb05838['id']);return createTicket(_0xdbf9d9,_0x180aa4,_0xb05838,_0x34dfe1,_0x42bad2,_0x34dfe1[_0x76e3('0x4f')],_0x19c030);})[_0x76e3('0x23')](function(_0x12da09){_0x65cf86=_0x12da09;logger[_0x76e3('0x2d')]('Ticket\x20created!');logger[_0x76e3('0x2d')](_0x76e3('0x50'),_0x65cf86['id']);})[_0x76e3('0x28')](function(_0x5293e4){logger[_0x76e3('0x2a')]('['+_0x42bad2[_0x76e3('0x60')][_0x76e3('0x5e')]()+']',JSON[_0x76e3('0x22')](_0x5293e4));});}; \ No newline at end of file +var _0xabfc=['vTiger','redis','localhost','emit','length','type','string','idField','toString','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','POST','format','remoteUri','create','username','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','Searching\x20end\x20user\x20with\x20phone','sessionName','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','getEndUser','accessKey','getchallenge','login','token','queue','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','email','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','toUpperCase','calleridname','lastevent','lodash','md5','util','./util','../../../../config/environment'];(function(_0x4b2b64,_0x16b920){var _0x5378aa=function(_0x4f13de){while(--_0x4f13de){_0x4b2b64['push'](_0x4b2b64['shift']());}};_0x5378aa(++_0x16b920);}(_0xabfc,0x187));var _0xcabf=function(_0x53ad58,_0x3fb489){_0x53ad58=_0x53ad58-0x0;var _0x554b03=_0xabfc[_0x53ad58];return _0x554b03;};'use strict';var _=require(_0xcabf('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0xcabf('0x1'));var util=require(_0xcabf('0x2'));var Redis=require('ioredis');var intUtil=require(_0xcabf('0x3'));var config=require(_0xcabf('0x4'));var logger=require('../../../../config/logger')(_0xcabf('0x5'));config[_0xcabf('0x6')]=_['defaults'](config[_0xcabf('0x6')],{'host':_0xcabf('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcabf('0x6')]));function emit(_0x352861,_0x5411c2,_0x4145e9){io['to'](_0x352861)[_0xcabf('0x8')](_0x5411c2,_0x4145e9);}function getCustomFields(_0x5ed53a,_0x130a61){var _0x2e557d={};if(_0x5ed53a[_0xcabf('0x9')]>0x0){_['forEach'](_0x5ed53a,function(_0x4c3edd){if(_0x4c3edd[_0xcabf('0xa')]===_0xcabf('0xb')&&_0x4c3edd[_0xcabf('0xc')]){_0x2e557d[_0x4c3edd[_0xcabf('0xc')]]=_0x4c3edd['content'][_0xcabf('0xd')]();}else if(_0x4c3edd[_0xcabf('0xa')]==='variable'&&_0x4c3edd[_0xcabf('0xe')]&&_0x4c3edd[_0xcabf('0xc')]&&_0x130a61[_0x4c3edd[_0xcabf('0xe')]]){_0x2e557d[_0x4c3edd[_0xcabf('0xc')]]=_0x130a61[_0x4c3edd[_0xcabf('0xe')]][_0xcabf('0xd')]();}else if(_0x4c3edd[_0xcabf('0xa')]===_0xcabf('0xf')&&_0x4c3edd[_0xcabf('0x10')]&&_0x4c3edd[_0xcabf('0x10')][_0xcabf('0x11')]&&_0x4c3edd[_0xcabf('0xc')]&&_0x130a61[_0x4c3edd['Variable']['name']['toLowerCase']()]){_0x2e557d[_0x4c3edd['idField']]=_0x130a61[_0x4c3edd[_0xcabf('0x10')]['name'][_0xcabf('0x12')]()][_0xcabf('0xd')]();}});}return _0x2e557d;}function createTicket(_0x1af9ac,_0x15aab9,_0x24d74a,_0x4a3dc8,_0x312685,_0x48ced8,_0x4cdfd0){logger[_0xcabf('0x13')](_0xcabf('0x14'));var _0xb3753=_[_0xcabf('0x15')]({'parent_id':'','assigned_user_id':_0x15aab9['id'],'ticketpriorities':_0xcabf('0x16'),'ticketstatus':_0xcabf('0x17'),'ticket_title':intUtil[_0xcabf('0x18')](_0x4a3dc8[_0xcabf('0x19')],_0x312685,'\x20'),'description':intUtil[_0xcabf('0x18')](_0x4a3dc8[_0xcabf('0x1a')],_0x312685,'\x0a'),'contact_id':_0x24d74a['id']},getCustomFields(_0x48ced8,_0x312685));var _0x1bce5e={'method':_0xcabf('0x1b'),'uri':util[_0xcabf('0x1c')]('%s/webservice.php',_0x1af9ac[_0xcabf('0x1d')]),'form':{'operation':_0xcabf('0x1e'),'username':_0x1af9ac[_0xcabf('0x1f')],'sessionName':_0x4cdfd0['sessionName'],'elementType':'HelpDesk','element':JSON[_0xcabf('0x20')](_0xb3753)},'json':!![]};return request(_0x1bce5e)[_0xcabf('0x21')](function(_0x3b4a18){if(_0x3b4a18[_0xcabf('0x22')]){return BPromise[_0xcabf('0x23')]({'id':_0x3b4a18[_0xcabf('0x24')]['id']});}else{throw new Error(util['format'](_0xcabf('0x25'),JSON[_0xcabf('0x20')](_0x3b4a18[_0xcabf('0x26')])));}})[_0xcabf('0x27')](function(_0x231704){var _0x4c9b5c=_0x231704[_0xcabf('0x28')]||0x1f4;logger[_0xcabf('0x26')](_0xcabf('0x29'),'createTicket',_0x4c9b5c,JSON[_0xcabf('0x20')](_0x231704));});}function getUser(_0x4593af,_0x4b1b46,_0x223500){if(intUtil['validateEmail'](_0x4b1b46)){logger[_0xcabf('0x13')](_0xcabf('0x2a'),_0x4b1b46);return request({'method':_0xcabf('0x2b'),'uri':util[_0xcabf('0x1c')](_0xcabf('0x2c'),_0x4593af[_0xcabf('0x1d')]),'qs':{'operation':_0xcabf('0x2d'),'username':_0x4593af[_0xcabf('0x1f')],'sessionName':_0x223500['sessionName'],'query':util['format'](_0xcabf('0x2e'),_0x4b1b46)},'json':!![]})[_0xcabf('0x21')](function(_0x3b3d46){if(_0x3b3d46['success']&&_0x3b3d46[_0xcabf('0x24')]['length']){logger[_0xcabf('0x13')](_0xcabf('0x2f'));return BPromise[_0xcabf('0x23')]({'id':_0x3b3d46['result'][0x0]['id'],'email':_0x3b3d46[_0xcabf('0x24')][0x0][_0xcabf('0x30')],'name':_0x3b3d46[_0xcabf('0x24')][0x0][_0xcabf('0x31')]+'\x20'+_0x3b3d46['result'][_0xcabf('0x32')]});}else{logger[_0xcabf('0x13')](_0xcabf('0x33'));return BPromise[_0xcabf('0x23')]({'id':_0x223500[_0xcabf('0x34')],'email':_0x4593af[_0xcabf('0x1f')],'name':_0xcabf('0x35')});}})[_0xcabf('0x27')](function(_0x538e72){var _0x583739=_0x538e72[_0xcabf('0x28')]||0x1f4;logger[_0xcabf('0x26')](_0xcabf('0x29'),'getUser',_0x583739,JSON[_0xcabf('0x20')](_0x538e72));});}else{logger[_0xcabf('0x13')](_0xcabf('0x33'));return BPromise[_0xcabf('0x23')]({'id':_0x223500[_0xcabf('0x34')],'email':_0x4593af['username'],'name':'admin'})[_0xcabf('0x27')](function(_0x18ae83){var _0x33753e=_0x18ae83[_0xcabf('0x28')]||0x1f4;logger['error'](_0xcabf('0x29'),_0xcabf('0x36'),_0x33753e,JSON[_0xcabf('0x20')](_0x18ae83));});}}function getEndUser(_0x5dd9a5,_0x555866,_0x2454c5,_0x1a8dfe){logger[_0xcabf('0x13')](_0xcabf('0x37'),_0x2454c5);return request({'method':_0xcabf('0x2b'),'uri':util['format'](_0xcabf('0x2c'),_0x5dd9a5[_0xcabf('0x1d')]),'qs':{'operation':_0xcabf('0x2d'),'username':_0x5dd9a5[_0xcabf('0x1f')],'sessionName':_0x1a8dfe[_0xcabf('0x38')],'query':util[_0xcabf('0x1c')](_0xcabf('0x39'),_0x2454c5,_0x2454c5,_0x2454c5,_0x2454c5,_0x2454c5)},'json':!![]})[_0xcabf('0x21')](function(_0x475cf3){if(_0x475cf3[_0xcabf('0x22')]&&_0x475cf3[_0xcabf('0x24')][_0xcabf('0x9')]){logger['info'](_0xcabf('0x3a'));return BPromise[_0xcabf('0x23')]({'id':_0x475cf3[_0xcabf('0x24')][0x0]['id'],'name':_0x475cf3[_0xcabf('0x24')][0x0][_0xcabf('0x3b')]+'\x20'+_0x475cf3[_0xcabf('0x24')][0x0][_0xcabf('0x3c')],'phone':_0x2454c5});}else{logger[_0xcabf('0x13')](_0xcabf('0x3d'));return request({'method':'POST','uri':util[_0xcabf('0x1c')](_0xcabf('0x2c'),_0x5dd9a5[_0xcabf('0x1d')]),'form':{'operation':'create','sessionName':_0x1a8dfe[_0xcabf('0x38')],'elementType':_0xcabf('0x3e'),'element':JSON[_0xcabf('0x20')]({'lastname':_0x555866,'phone':_0x2454c5,'assigned_user_id':'\x20'})},'json':!![]})[_0xcabf('0x21')](function(_0x4ca506){logger[_0xcabf('0x13')]('Enduser\x20created.');return BPromise[_0xcabf('0x23')]({'id':_0x4ca506[_0xcabf('0x24')]['id'],'name':_0x4ca506[_0xcabf('0x24')][_0xcabf('0x3c')],'phone':_0x4ca506[_0xcabf('0x24')][_0xcabf('0x3f')]});})[_0xcabf('0x27')](function(_0x3c4c1d){var _0x4d287d=_0x3c4c1d[_0xcabf('0x28')]||0x1f4;logger[_0xcabf('0x26')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xcabf('0x40'),_0x4d287d,JSON['stringify'](_0x3c4c1d));});}});}function getConnection(_0x1366ce){var _0x1bf065=_0x1366ce[_0xcabf('0x1f')];var _0x14fc1b=_0x1366ce[_0xcabf('0x41')];return request({'method':_0xcabf('0x2b'),'uri':util['format'](_0xcabf('0x2c'),_0x1366ce[_0xcabf('0x1d')]),'qs':{'operation':_0xcabf('0x42'),'username':_0x1bf065},'json':!![]})[_0xcabf('0x21')](function(_0x54a1d7){if(_0x54a1d7[_0xcabf('0x22')]){return request({'method':'POST','uri':util['format'](_0xcabf('0x2c'),_0x1366ce['remoteUri']),'form':{'operation':_0xcabf('0x43'),'username':_0x1bf065,'accessKey':md5(_0x54a1d7[_0xcabf('0x24')][_0xcabf('0x44')]+_0x14fc1b)},'json':!![]});}})[_0xcabf('0x21')](function(_0x554976){if(_0x554976['success']){return BPromise[_0xcabf('0x23')](_0x554976[_0xcabf('0x24')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x1366ce['id']));}})['catch'](function(_0x4917d0){var _0x11ec6f=_0x4917d0[_0xcabf('0x28')]||0x1f4;logger[_0xcabf('0x26')](_0xcabf('0x29'),'getConnection',_0x11ec6f,JSON[_0xcabf('0x20')](_0x4917d0));});}function request(_0x43f46f){logger['info']('[HTTP]',JSON[_0xcabf('0x20')](_0x43f46f));return rp(_0x43f46f);}exports[_0xcabf('0x45')]=function(_0x291cc5,_0x5b9487,_0x3d52d2,_0x712742,_0x4c2b5d,_0x775f08){var _0x4bca49,_0x37365a,_0x513eb2,_0x1266d8;_0x775f08[_0xcabf('0x1d')]=intUtil['stripTrailingSlash'](_0x775f08[_0xcabf('0x1d')]);if(_0x4c2b5d&&_0x4c2b5d[_0xcabf('0x46')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5b9487[_0xcabf('0x47')]=util['format'](_0xcabf('0x48'),_0x775f08[_0xcabf('0x49')],_0x5b9487[_0xcabf('0x4a')],md5(_0x5b9487['uniqueid']));}else{_0x5b9487[_0xcabf('0x47')]='';}return getConnection(_0x775f08)[_0xcabf('0x21')](function(_0x58bd33){_0x1266d8=_0x58bd33;return getUser(_0x775f08,_0x712742['email'],_0x1266d8);})[_0xcabf('0x21')](function(_0x3bb8e6){_0x4bca49=_0x3bb8e6;logger[_0xcabf('0x13')](_0xcabf('0x4b'),_0x4bca49['id']);return getEndUser(_0x775f08,_0x5b9487['calleridname'],_0x5b9487[_0xcabf('0x4c')],_0x1266d8);})['then'](function(_0x18ee4c){_0x37365a=_0x18ee4c;logger['info'](_0xcabf('0x4d'),_0x37365a['id']);return createTicket(_0x775f08,_0x4bca49,_0x37365a,_0x3d52d2,_0x5b9487,_0x3d52d2[_0xcabf('0x4e')],_0x1266d8);})['then'](function(_0x5d0b63){_0x513eb2=_0x5d0b63;logger[_0xcabf('0x13')](_0xcabf('0x4f'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x513eb2['id']);var _0x2e04b8=util[_0xcabf('0x1c')](_0xcabf('0x50'),_0x775f08[_0xcabf('0x1d')],_[_0xcabf('0x51')](_0x513eb2['id'],'x')[0x1]);logger[_0xcabf('0x13')](_0xcabf('0x52'),_0xcabf('0x53'));emit(util[_0xcabf('0x1c')](_0xcabf('0x54'),_0x712742[_0xcabf('0x11')]),_0xcabf('0x55'),{'uri':_0x2e04b8});})['catch'](function(_0x36e5b4){logger[_0xcabf('0x26')](_0xcabf('0x52'),JSON[_0xcabf('0x20')](_0x36e5b4));});};exports[_0xcabf('0x56')]=function(_0x2db098,_0x1a1c87,_0x10329b,_0x3814d2,_0xb4f92,_0x4f350a,_0x186389){var _0x52f69b,_0x65cb0c,_0x6bdacf,_0x2dd500;_0x4f350a[_0xcabf('0x1d')]=intUtil[_0xcabf('0x57')](_0x4f350a['remoteUri']);_0x4f350a[_0xcabf('0x49')]=intUtil['stripTrailingSlash'](_0x4f350a[_0xcabf('0x49')]);if(_0x186389&&_0x186389[_0xcabf('0x58')]&&_0x186389[_0xcabf('0x58')]!==_0xcabf('0x59')){logger['info'](_0xcabf('0x5a'),_0xcabf('0x5b'));_0x1a1c87[_0xcabf('0x47')]=util[_0xcabf('0x1c')](_0xcabf('0x48'),_0x4f350a[_0xcabf('0x49')],_0x1a1c87['uniqueid'],md5(_0x1a1c87['uniqueid']));}return getConnection(_0x4f350a)[_0xcabf('0x21')](function(_0x1281b4){_0x2dd500=_0x1281b4;return getUser(_0x4f350a,_0x3814d2[_0xcabf('0x5c')],_0x2dd500);})[_0xcabf('0x21')](function(_0xab6921){_0x52f69b=_0xab6921;logger['info']('The\x20User\x20ID\x20is:',_0x52f69b['id']);return getEndUser(_0x4f350a,_0x1a1c87[_0xcabf('0x5d')],_0x1a1c87[_0xcabf('0x5e')],_0x2dd500);})[_0xcabf('0x21')](function(_0x52f138){_0x65cb0c=_0x52f138;logger[_0xcabf('0x13')]('The\x20Enduser\x20ID\x20is:',_0x65cb0c['id']);return createTicket(_0x4f350a,_0x52f69b,_0x65cb0c,_0x10329b,_0x1a1c87,_0x10329b[_0xcabf('0x4e')],_0x2dd500);})[_0xcabf('0x21')](function(_0x39b49f){_0x6bdacf=_0x39b49f;logger[_0xcabf('0x13')](_0xcabf('0x4f'));logger[_0xcabf('0x13')](_0xcabf('0x5f'),_0x6bdacf['id']);var _0x103c4b=util[_0xcabf('0x1c')](_0xcabf('0x50'),_0x4f350a['remoteUri'],_[_0xcabf('0x51')](_0x6bdacf['id'],'x')[0x1]);logger[_0xcabf('0x13')](_0xcabf('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xcabf('0x1c')]('user:%s',_0x3814d2[_0xcabf('0x11')]),_0xcabf('0x55'),{'uri':_0x103c4b});})['catch'](function(_0x132d7b){logger[_0xcabf('0x26')](_0xcabf('0x5a'),JSON['stringify'](_0x132d7b));});};exports['unmanaged']=function(_0x34bf35,_0x1b8e44,_0x2fd926,_0x52c823,_0x54b9a4,_0x4fda74){var _0x2b42f7,_0x50d773,_0x437224,_0xc3c527;_0x4fda74[_0xcabf('0x1d')]=intUtil[_0xcabf('0x57')](_0x4fda74[_0xcabf('0x1d')]);_0x4fda74[_0xcabf('0x49')]=intUtil[_0xcabf('0x57')](_0x4fda74[_0xcabf('0x49')]);if(_0x54b9a4&&_0x54b9a4[_0xcabf('0x46')]){logger[_0xcabf('0x13')]('['+_0x1b8e44['lastevent'][_0xcabf('0x60')]()+']',_0xcabf('0x5b'));_0x1b8e44[_0xcabf('0x47')]=util[_0xcabf('0x1c')](_0xcabf('0x48'),_0x4fda74[_0xcabf('0x49')],_0x1b8e44['uniqueid'],md5(_0x1b8e44[_0xcabf('0x4a')]));}else{_0x1b8e44[_0xcabf('0x47')]='';}return getConnection(_0x4fda74)[_0xcabf('0x21')](function(_0x2e6082){_0xc3c527=_0x2e6082;return getUser(_0x4fda74,'',_0xc3c527);})[_0xcabf('0x21')](function(_0x5ede04){_0x2b42f7=_0x5ede04;logger[_0xcabf('0x13')](_0xcabf('0x4b'),_0x2b42f7['id']);return getEndUser(_0x4fda74,_0x1b8e44[_0xcabf('0x61')],_0x1b8e44[_0xcabf('0x4c')],_0xc3c527);})[_0xcabf('0x21')](function(_0x2ceace){_0x50d773=_0x2ceace;logger[_0xcabf('0x13')](_0xcabf('0x4d'),_0x50d773['id']);return createTicket(_0x4fda74,_0x2b42f7,_0x50d773,_0x2fd926,_0x1b8e44,_0x2fd926[_0xcabf('0x4e')],_0xc3c527);})['then'](function(_0x34360e){_0x437224=_0x34360e;logger[_0xcabf('0x13')](_0xcabf('0x4f'));logger['info'](_0xcabf('0x5f'),_0x437224['id']);})[_0xcabf('0x27')](function(_0x51d174){logger[_0xcabf('0x26')]('['+_0x1b8e44[_0xcabf('0x62')]['toUpperCase']()+']',JSON[_0xcabf('0x20')](_0x51d174));});}; \ 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 2d51225..26a6476 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 _0xe28e=['error','unmanaged','lastevent','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','results','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','%s:%s','username','password','authType','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','GET','map','nameField','content','type','string','idField','customField','push','variable','variableName','Variable','custom_fields','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','integrationTab','user:%s'];(function(_0x589474,_0xc9c331){var _0x2c3017=function(_0x3b04fd){while(--_0x3b04fd){_0x589474['push'](_0x589474['shift']());}};_0x2c3017(++_0xc9c331);}(_0xe28e,0x1ba));var _0xee28=function(_0x395b31,_0x5a55c8){_0x395b31=_0x395b31-0x0;var _0x5135ce=_0xe28e[_0x395b31];return _0x5135ce;};'use strict';var _=require(_0xee28('0x0'));var rp=require(_0xee28('0x1'));var md5=require(_0xee28('0x2'));var util=require(_0xee28('0x3'));var Redis=require(_0xee28('0x4'));var intUtil=require(_0xee28('0x5'));var config=require(_0xee28('0x6'));var logger=require(_0xee28('0x7'))(_0xee28('0x8'));config[_0xee28('0x9')]=_[_0xee28('0xa')](config[_0xee28('0x9')],{'host':_0xee28('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xee28('0x9')]));function emit(_0x30224a,_0x3f9bd9,_0x66d0b6){io['to'](_0x30224a)[_0xee28('0xc')](_0x3f9bd9,_0x66d0b6);}var headers={'Content-Type':_0xee28('0xd'),'Accept':_0xee28('0xd')};function getTicket(_0x5d7562,_0x5afe44,_0x561fe4,_0x31bc22,_0x7e67b2){logger['info'](_0xee28('0xe'));return request({'uri':util[_0xee28('0xf')]('%s/tickets.json',_0x5d7562[_0xee28('0x10')]),'method':_0xee28('0x11'),'body':{'ticket':_[_0xee28('0x12')]({'requester_id':_0x561fe4['id'],'submitter_id':_0x5afe44?_0x5afe44['id']:undefined,'assignee_id':_0x5afe44?_0x5afe44['id']:undefined,'tags':getTags(_0x31bc22[_0xee28('0x13')],_0xee28('0x14')),'subject':intUtil[_0xee28('0x15')](_0x31bc22[_0xee28('0x16')],_0x7e67b2,'\x20'),'description':intUtil['getString'](_0x31bc22[_0xee28('0x17')],_0x7e67b2,'\x0a'),'comment':{'public':![],'body':intUtil[_0xee28('0x15')](_0x31bc22[_0xee28('0x17')],_0x7e67b2,'\x0a')}},getCustomFields(_0x31bc22[_0xee28('0x18')],_0x7e67b2))}})[_0xee28('0x19')](function(_0x5b510a){logger[_0xee28('0x1a')](_0xee28('0x1b'));return _0x5b510a[_0xee28('0x1c')];});}function getUser(_0x343358,_0x1ff99e){if(intUtil[_0xee28('0x1d')](_0x1ff99e)){logger['info'](_0xee28('0x1e'),_0x1ff99e);return request({'uri':util['format'](_0xee28('0x1f'),_0x343358[_0xee28('0x10')]),'qs':{'query':util['format'](_0xee28('0x20'),_0x1ff99e)}})['then'](function(_0x3c9ac6){if(_0x3c9ac6['count']){logger[_0xee28('0x1a')]('Agent\x20found!');return _[_0xee28('0x21')](_0x3c9ac6['results'],{'email':_0x1ff99e,'role':_0xee28('0x22')});}else{logger[_0xee28('0x1a')](_0xee28('0x23'));return request({'uri':util[_0xee28('0xf')](_0xee28('0x24'),_0x343358[_0xee28('0x10')])})[_0xee28('0x19')](function(_0x4bda53){logger[_0xee28('0x1a')](_0xee28('0x25'));return _0x4bda53[_0xee28('0x26')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xee28('0xf')](_0xee28('0x24'),_0x343358[_0xee28('0x10')])})[_0xee28('0x19')](function(_0x57b11a){logger[_0xee28('0x1a')](_0xee28('0x25'));return _0x57b11a[_0xee28('0x26')];});}}function getEndUser(_0x2a7c95,_0x733ca8,_0x281c8a){logger['info'](_0xee28('0x27'),_0x281c8a);return request({'uri':util['format']('%s/search.json',_0x2a7c95['remoteUri']),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x281c8a)}})[_0xee28('0x19')](function(_0x884e7d){var _0x3b64ad;if(_0x884e7d[_0xee28('0x28')][_0xee28('0x29')]){_0x884e7d[_0xee28('0x28')]=_[_0xee28('0x2a')](_0x884e7d['results'],{'suspended':![],'role':_0xee28('0x2b')});if(_0x884e7d[_0xee28('0x28')][_0xee28('0x29')]){_0x3b64ad=_['first'](_0x884e7d[_0xee28('0x28')]);}}if(_0x3b64ad){logger[_0xee28('0x1a')](_0xee28('0x2c'));return _0x3b64ad;}else{logger[_0xee28('0x1a')](_0xee28('0x2d'));return request({'uri':util[_0xee28('0xf')](_0xee28('0x2e'),_0x2a7c95['remoteUri']),'method':_0xee28('0x11'),'body':{'user':{'role':_0xee28('0x2b'),'name':util['format'](_0xee28('0x2f'),_0x733ca8||_0x281c8a),'phone':_0x281c8a}}})[_0xee28('0x19')](function(_0x3e84cc){logger[_0xee28('0x1a')](_0xee28('0x30'));return _0x3e84cc[_0xee28('0x26')];});}});}function getAuth(_0x3cc228){var _0x5a4f48;if(_0x3cc228['authType']==='password'){_0x5a4f48=util[_0xee28('0xf')](_0xee28('0x31'),_0x3cc228[_0xee28('0x32')],_0x3cc228[_0xee28('0x33')]);}else if(_0x3cc228[_0xee28('0x34')]===_0xee28('0x35')){_0x5a4f48=util['format'](_0xee28('0x36'),_0x3cc228[_0xee28('0x32')],_0x3cc228['token']);}return util['format'](_0xee28('0x37'),new Buffer(_0x5a4f48)[_0xee28('0x38')]('base64'));}function request(_0x4e1933){logger[_0xee28('0x39')](_0xee28('0x3a'),JSON['stringify'](_0x4e1933));return rp(_[_0xee28('0xa')](_0x4e1933,{'method':_0xee28('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x2f8e04,_0x2f5785){var _0x94167=[];if(_0x2f8e04&&_0x2f8e04[_0xee28('0x29')]>0x0){_0x94167=_[_0xee28('0x3c')](_0x2f8e04,_0x2f5785);}return _0x94167;}function getCustomFields(_0x1be858,_0x4560fd){var _0x1d182c=[];var _0x43b587={'custom_fields':[]};if(_0x1be858[_0xee28('0x29')]>0x0){_['forEach'](_0x1be858,function(_0x191d7d){if(_0x191d7d['type']==='string'&&_0x191d7d[_0xee28('0x3d')]&&!_0x191d7d['customField']){_0x43b587[_0x191d7d[_0xee28('0x3d')]['toLowerCase']()]=_0x191d7d[_0xee28('0x3e')]['toString']();}else if(_0x191d7d[_0xee28('0x3f')]===_0xee28('0x40')&&_0x191d7d[_0xee28('0x41')]&&_0x191d7d[_0xee28('0x42')]){_0x43b587['custom_fields'][_0xee28('0x43')]({'id':_0x191d7d['idField'],'value':_0x191d7d[_0xee28('0x3e')][_0xee28('0x38')]()});}else if(_0x191d7d[_0xee28('0x3f')]===_0xee28('0x44')&&_0x191d7d[_0xee28('0x45')]&&_0x191d7d[_0xee28('0x41')]&&_0x191d7d[_0xee28('0x42')]){_0x4560fd[_0x191d7d['variableName']]&&_0x43b587['custom_fields'][_0xee28('0x43')]({'id':_0x191d7d['idField'],'value':_0x4560fd[_0x191d7d['variableName']][_0xee28('0x38')]()});}else if(_0x191d7d[_0xee28('0x3f')]==='customVariable'&&_0x191d7d[_0xee28('0x46')]&&_0x191d7d[_0xee28('0x46')][_0xee28('0x14')]&&_0x191d7d[_0xee28('0x41')]&&_0x191d7d[_0xee28('0x42')]){_0x4560fd[_0x191d7d[_0xee28('0x46')][_0xee28('0x14')]['toLowerCase']()]&&_0x43b587[_0xee28('0x47')][_0xee28('0x43')]({'id':_0x191d7d[_0xee28('0x41')],'value':_0x4560fd[_0x191d7d[_0xee28('0x46')][_0xee28('0x14')]['toLowerCase']()][_0xee28('0x38')]()});}});}return _0x43b587;}exports[_0xee28('0x48')]=function(_0x512394,_0xb12ba,_0x3ae670,_0x31e87c,_0xb6b37f,_0x1911f4){var _0x1ce54f,_0x54ab7b;_0x1911f4[_0xee28('0x10')]=intUtil['stripTrailingSlash'](_0x1911f4['remoteUri']);_0x1911f4[_0xee28('0x49')]=intUtil[_0xee28('0x4a')](_0x1911f4['serverUrl']);if(_0xb6b37f&&_0xb6b37f[_0xee28('0x4b')]){logger[_0xee28('0x1a')](_0xee28('0x4c'),'Recording\x20is\x20enabled!');_0xb12ba['recordingURL']=util[_0xee28('0xf')](_0xee28('0x4d'),_0x1911f4[_0xee28('0x49')],_0xb12ba[_0xee28('0x4e')],md5(_0xb12ba[_0xee28('0x4e')]));}else{_0xb12ba[_0xee28('0x4f')]='';}headers[_0xee28('0x50')]=getAuth(_0x1911f4);return getUser(_0x1911f4,_0x31e87c[_0xee28('0x51')])[_0xee28('0x19')](function(_0x2958b2){_0x1ce54f=_0x2958b2;logger['info'](_0xee28('0x52'),_0x1ce54f['id']);return getEndUser(_0x1911f4,_0xb12ba['calleridname'],_0xb12ba[_0xee28('0x53')]);})[_0xee28('0x19')](function(_0x139b50){_0x54ab7b=_0x139b50;logger[_0xee28('0x1a')](_0xee28('0x54'),_0x54ab7b['id']);return getTicket(_0x1911f4,_0x1ce54f,_0x54ab7b,_0x3ae670,_0xb12ba);})['then'](function(_0x5247fe){if(_0x5247fe){logger['info'](_0xee28('0x55'),_0x5247fe['id']);switch(_0x1911f4['type']){case'integrationTab':logger[_0xee28('0x1a')]('[QUEUE]',_0xee28('0x56'));return request({'uri':util[_0xee28('0xf')](_0xee28('0x57'),_0x1911f4[_0xee28('0x10')],_0x1ce54f['id'],_0x5247fe['id']),'method':_0xee28('0x11')});case _0xee28('0x58'):logger[_0xee28('0x1a')](_0xee28('0x4c'),_0xee28('0x59'));emit(util[_0xee28('0xf')]('user:%s',_0x31e87c[_0xee28('0x14')]),_0xee28('0x5a'),{'uri':util[_0xee28('0xf')]('%s/agent/tickets/%s',_0x1911f4['remoteUri'],_0x5247fe['id'])});break;default:logger['error']('[QUEUE]',_0xee28('0x5b'));}}})[_0xee28('0x5c')](function(_0x186306){logger['error'](_0xee28('0x5d'),util[_0xee28('0x5e')](_0x186306,{'showHidden':!![],'depth':null}));});};exports[_0xee28('0x5f')]=function(_0x39b228,_0xfc313b,_0x4d65ca,_0x2a5da9,_0x1c6696,_0x105b48,_0x4bbf41){var _0xda3fb6,_0xd7837a;_0x105b48[_0xee28('0x10')]=intUtil[_0xee28('0x4a')](_0x105b48[_0xee28('0x10')]);_0x105b48[_0xee28('0x49')]=intUtil[_0xee28('0x4a')](_0x105b48['serverUrl']);if(_0x4bbf41&&_0x4bbf41[_0xee28('0x60')]&&_0x4bbf41['recordingFormat']!=='none'){logger['info'](_0xee28('0x61'),_0xee28('0x62'));_0xfc313b[_0xee28('0x4f')]=util[_0xee28('0xf')](_0xee28('0x4d'),_0x105b48[_0xee28('0x49')],_0xfc313b[_0xee28('0x4e')],md5(_0xfc313b[_0xee28('0x4e')]));}headers['Authorization']=getAuth(_0x105b48);return getUser(_0x105b48,_0x2a5da9[_0xee28('0x51')])[_0xee28('0x19')](function(_0x32c06f){_0xda3fb6=_0x32c06f;logger[_0xee28('0x1a')](_0xee28('0x52'),_0xda3fb6['id']);return getEndUser(_0x105b48,_0xfc313b[_0xee28('0x63')],_0xfc313b[_0xee28('0x64')]);})['then'](function(_0x438943){_0xd7837a=_0x438943;logger['info'](_0xee28('0x54'),_0xd7837a['id']);return getTicket(_0x105b48,_0xda3fb6,_0xd7837a,_0x4d65ca,_0xfc313b);})[_0xee28('0x19')](function(_0x55a498){if(_0x55a498){logger[_0xee28('0x1a')](_0xee28('0x55'),_0x55a498['id']);switch(_0x105b48[_0xee28('0x3f')]){case _0xee28('0x65'):logger['info'](_0xee28('0x61'),_0xee28('0x56'));return request({'uri':util[_0xee28('0xf')](_0xee28('0x57'),_0x105b48[_0xee28('0x10')],_0xda3fb6['id'],_0x55a498['id']),'method':_0xee28('0x11')});case _0xee28('0x58'):logger['info'](_0xee28('0x61'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xee28('0xf')](_0xee28('0x66'),_0x2a5da9['name']),'trigger:browser:url',{'uri':util[_0xee28('0xf')]('%s/agent/tickets/%s',_0x105b48[_0xee28('0x10')],_0x55a498['id'])});break;default:logger[_0xee28('0x67')](_0xee28('0x61'),_0xee28('0x5b'));}}})[_0xee28('0x5c')](function(_0x3f35bd){logger[_0xee28('0x67')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xee28('0x5e')](_0x3f35bd,{'showHidden':!![],'depth':null}));});};exports[_0xee28('0x68')]=function(_0x185c8f,_0x57ded5,_0x44d67d,_0x40b1a6,_0x1e190f,_0x3d9926){var _0x354dc0,_0x3457bc;_0x3d9926['remoteUri']=intUtil[_0xee28('0x4a')](_0x3d9926[_0xee28('0x10')]);_0x3d9926[_0xee28('0x49')]=intUtil[_0xee28('0x4a')](_0x3d9926[_0xee28('0x49')]);if(_0x1e190f&&_0x1e190f[_0xee28('0x4b')]){logger['info']('['+_0x57ded5[_0xee28('0x69')][_0xee28('0x6a')]()+']','Recording\x20is\x20enabled!');_0x57ded5['recordingURL']=util['format'](_0xee28('0x4d'),_0x3d9926[_0xee28('0x49')],_0x57ded5['uniqueid'],md5(_0x57ded5[_0xee28('0x4e')]));}else{_0x57ded5[_0xee28('0x4f')]='';}headers[_0xee28('0x50')]=getAuth(_0x3d9926);return getUser(_0x3d9926)['then'](function(_0x3a3894){_0x354dc0=_0x3a3894;logger[_0xee28('0x1a')](_0xee28('0x52'),_0x354dc0['id']);return getEndUser(_0x3d9926,_0x57ded5[_0xee28('0x6b')],_0x57ded5['calleridnum']);})[_0xee28('0x19')](function(_0x4cb851){_0x3457bc=_0x4cb851;logger[_0xee28('0x1a')](_0xee28('0x54'),_0x3457bc['id']);return getTicket(_0x3d9926,_0x354dc0,_0x3457bc,_0x44d67d,_0x57ded5);})[_0xee28('0x19')](function(_0x547188){if(_0x547188){logger[_0xee28('0x1a')](_0xee28('0x55'),_0x547188['id']);}})[_0xee28('0x5c')](function(_0x38d97f){logger['error']('['+_0x57ded5[_0xee28('0x69')]['toUpperCase']()+']'+_0xee28('0x6c'),util[_0xee28('0x5e')](_0x38d97f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x780f=['none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Enduser\x20ID\x20is:','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','info','Creating\x20new\x20ticket...','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','format','%s/search.json','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','filter','end-user','length','first','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','token','%s/token:%s','toString','debug','stringify','GET','map','forEach','nameField','customField','toLowerCase','content','type','idField','custom_fields','push','variable','variableName','Variable','name','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x780f,0x6c));var _0xf780=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0x780f[_0x47cfa0];return _0x386b1d;};'use strict';var _=require(_0xf780('0x0'));var rp=require(_0xf780('0x1'));var md5=require(_0xf780('0x2'));var util=require(_0xf780('0x3'));var Redis=require(_0xf780('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xf780('0x5'))(_0xf780('0x6'));config[_0xf780('0x7')]=_[_0xf780('0x8')](config['redis'],{'host':_0xf780('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf780('0x7')]));function emit(_0x93539d,_0x1c3fdc,_0xa12d00){io['to'](_0x93539d)[_0xf780('0xa')](_0x1c3fdc,_0xa12d00);}var headers={'Content-Type':_0xf780('0xb'),'Accept':'application/json'};function getTicket(_0x2c8221,_0x109b75,_0x121d96,_0x14d6e0,_0x343856){logger[_0xf780('0xc')](_0xf780('0xd'));return request({'uri':util['format']('%s/tickets.json',_0x2c8221[_0xf780('0xe')]),'method':_0xf780('0xf'),'body':{'ticket':_[_0xf780('0x10')]({'requester_id':_0x121d96['id'],'submitter_id':_0x109b75?_0x109b75['id']:undefined,'assignee_id':_0x109b75?_0x109b75['id']:undefined,'tags':getTags(_0x14d6e0[_0xf780('0x11')],'name'),'subject':intUtil[_0xf780('0x12')](_0x14d6e0[_0xf780('0x13')],_0x343856,'\x20'),'description':intUtil[_0xf780('0x12')](_0x14d6e0[_0xf780('0x14')],_0x343856,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x14d6e0[_0xf780('0x14')],_0x343856,'\x0a')}},getCustomFields(_0x14d6e0['Fields'],_0x343856))}})[_0xf780('0x15')](function(_0x2b7056){logger[_0xf780('0xc')](_0xf780('0x16'));return _0x2b7056[_0xf780('0x17')];});}function getUser(_0x335ba6,_0x422ef4){if(intUtil['validateEmail'](_0x422ef4)){logger[_0xf780('0xc')](_0xf780('0x18'),_0x422ef4);return request({'uri':util[_0xf780('0x19')](_0xf780('0x1a'),_0x335ba6[_0xf780('0xe')]),'qs':{'query':util[_0xf780('0x19')]('type:user\x20role:agent\x20email:%s',_0x422ef4)}})[_0xf780('0x15')](function(_0x37cea3){if(_0x37cea3['count']){logger[_0xf780('0xc')](_0xf780('0x1b'));return _['find'](_0x37cea3[_0xf780('0x1c')],{'email':_0x422ef4,'role':_0xf780('0x1d')});}else{logger[_0xf780('0xc')](_0xf780('0x1e'));return request({'uri':util[_0xf780('0x19')](_0xf780('0x1f'),_0x335ba6['remoteUri'])})[_0xf780('0x15')](function(_0x4de546){logger['info'](_0xf780('0x20'));return _0x4de546[_0xf780('0x21')];});}});}else{logger[_0xf780('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf780('0x19')](_0xf780('0x1f'),_0x335ba6['remoteUri'])})[_0xf780('0x15')](function(_0x497d08){logger[_0xf780('0xc')](_0xf780('0x20'));return _0x497d08['user'];});}}function getEndUser(_0x589208,_0x3710bb,_0x1ef4f1){logger[_0xf780('0xc')](_0xf780('0x22'),_0x1ef4f1);return request({'uri':util[_0xf780('0x19')](_0xf780('0x1a'),_0x589208[_0xf780('0xe')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x1ef4f1)}})['then'](function(_0x3f5498){var _0xf595e2;if(_0x3f5498[_0xf780('0x1c')]['length']){_0x3f5498['results']=_[_0xf780('0x23')](_0x3f5498[_0xf780('0x1c')],{'suspended':![],'role':_0xf780('0x24')});if(_0x3f5498['results'][_0xf780('0x25')]){_0xf595e2=_[_0xf780('0x26')](_0x3f5498[_0xf780('0x1c')]);}}if(_0xf595e2){logger[_0xf780('0xc')]('Enduser\x20found!');return _0xf595e2;}else{logger[_0xf780('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xf780('0x19')](_0xf780('0x27'),_0x589208[_0xf780('0xe')]),'method':_0xf780('0xf'),'body':{'user':{'role':_0xf780('0x24'),'name':util[_0xf780('0x19')](_0xf780('0x28'),_0x3710bb||_0x1ef4f1),'phone':_0x1ef4f1}}})[_0xf780('0x15')](function(_0x503d44){logger[_0xf780('0xc')](_0xf780('0x29'));return _0x503d44[_0xf780('0x21')];});}});}function getAuth(_0x1917cb){var _0x58bc24;if(_0x1917cb['authType']===_0xf780('0x2a')){_0x58bc24=util['format'](_0xf780('0x2b'),_0x1917cb[_0xf780('0x2c')],_0x1917cb[_0xf780('0x2a')]);}else if(_0x1917cb['authType']===_0xf780('0x2d')){_0x58bc24=util[_0xf780('0x19')](_0xf780('0x2e'),_0x1917cb[_0xf780('0x2c')],_0x1917cb['token']);}return util[_0xf780('0x19')]('Basic\x20%s',new Buffer(_0x58bc24)[_0xf780('0x2f')]('base64'));}function request(_0x4bf8a5){logger[_0xf780('0x30')]('[HTTP]',JSON[_0xf780('0x31')](_0x4bf8a5));return rp(_[_0xf780('0x8')](_0x4bf8a5,{'method':_0xf780('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x4127b8,_0x50e90c){var _0x22121c=[];if(_0x4127b8&&_0x4127b8[_0xf780('0x25')]>0x0){_0x22121c=_[_0xf780('0x33')](_0x4127b8,_0x50e90c);}return _0x22121c;}function getCustomFields(_0x10795e,_0x4e46fa){var _0x3b506d=[];var _0x160cb4={'custom_fields':[]};if(_0x10795e[_0xf780('0x25')]>0x0){_[_0xf780('0x34')](_0x10795e,function(_0x1a5ebf){if(_0x1a5ebf['type']==='string'&&_0x1a5ebf[_0xf780('0x35')]&&!_0x1a5ebf[_0xf780('0x36')]){_0x160cb4[_0x1a5ebf[_0xf780('0x35')][_0xf780('0x37')]()]=_0x1a5ebf[_0xf780('0x38')]['toString']();}else if(_0x1a5ebf[_0xf780('0x39')]==='string'&&_0x1a5ebf[_0xf780('0x3a')]&&_0x1a5ebf[_0xf780('0x36')]){_0x160cb4[_0xf780('0x3b')][_0xf780('0x3c')]({'id':_0x1a5ebf['idField'],'value':_0x1a5ebf[_0xf780('0x38')][_0xf780('0x2f')]()});}else if(_0x1a5ebf[_0xf780('0x39')]===_0xf780('0x3d')&&_0x1a5ebf[_0xf780('0x3e')]&&_0x1a5ebf[_0xf780('0x3a')]&&_0x1a5ebf[_0xf780('0x36')]){_0x4e46fa[_0x1a5ebf[_0xf780('0x3e')]]&&_0x160cb4[_0xf780('0x3b')][_0xf780('0x3c')]({'id':_0x1a5ebf[_0xf780('0x3a')],'value':_0x4e46fa[_0x1a5ebf[_0xf780('0x3e')]][_0xf780('0x2f')]()});}else if(_0x1a5ebf[_0xf780('0x39')]==='customVariable'&&_0x1a5ebf[_0xf780('0x3f')]&&_0x1a5ebf['Variable'][_0xf780('0x40')]&&_0x1a5ebf[_0xf780('0x3a')]&&_0x1a5ebf['customField']){_0x4e46fa[_0x1a5ebf['Variable']['name']['toLowerCase']()]&&_0x160cb4[_0xf780('0x3b')]['push']({'id':_0x1a5ebf[_0xf780('0x3a')],'value':_0x4e46fa[_0x1a5ebf[_0xf780('0x3f')][_0xf780('0x40')][_0xf780('0x37')]()][_0xf780('0x2f')]()});}});}return _0x160cb4;}exports['queue']=function(_0x55ccbe,_0x5aa2cf,_0x48a303,_0x204f02,_0x20b1f8,_0x211823){var _0x143154,_0xcfee8e;_0x211823[_0xf780('0xe')]=intUtil['stripTrailingSlash'](_0x211823[_0xf780('0xe')]);_0x211823[_0xf780('0x41')]=intUtil[_0xf780('0x42')](_0x211823[_0xf780('0x41')]);if(_0x20b1f8&&_0x20b1f8[_0xf780('0x43')]){logger[_0xf780('0xc')]('[QUEUE]',_0xf780('0x44'));_0x5aa2cf['recordingURL']=util[_0xf780('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x211823[_0xf780('0x41')],_0x5aa2cf['uniqueid'],md5(_0x5aa2cf['uniqueid']));}else{_0x5aa2cf[_0xf780('0x45')]='';}headers[_0xf780('0x46')]=getAuth(_0x211823);return getUser(_0x211823,_0x204f02[_0xf780('0x47')])[_0xf780('0x15')](function(_0x5b60e7){_0x143154=_0x5b60e7;logger[_0xf780('0xc')](_0xf780('0x48'),_0x143154['id']);return getEndUser(_0x211823,_0x5aa2cf[_0xf780('0x49')],_0x5aa2cf[_0xf780('0x4a')]);})[_0xf780('0x15')](function(_0x58a8b7){_0xcfee8e=_0x58a8b7;logger[_0xf780('0xc')]('The\x20Enduser\x20ID\x20is:',_0xcfee8e['id']);return getTicket(_0x211823,_0x143154,_0xcfee8e,_0x48a303,_0x5aa2cf);})[_0xf780('0x15')](function(_0x1b492a){if(_0x1b492a){logger[_0xf780('0xc')](_0xf780('0x4b'),_0x1b492a['id']);switch(_0x211823[_0xf780('0x39')]){case'integrationTab':logger['info'](_0xf780('0x4c'),_0xf780('0x4d'));return request({'uri':util[_0xf780('0x19')](_0xf780('0x4e'),_0x211823['remoteUri'],_0x143154['id'],_0x1b492a['id']),'method':_0xf780('0xf')});case _0xf780('0x4f'):logger[_0xf780('0xc')](_0xf780('0x4c'),_0xf780('0x50'));emit(util[_0xf780('0x19')]('user:%s',_0x204f02[_0xf780('0x40')]),_0xf780('0x51'),{'uri':util['format'](_0xf780('0x52'),_0x211823[_0xf780('0xe')],_0x1b492a['id'])});break;default:logger[_0xf780('0x53')](_0xf780('0x4c'),_0xf780('0x54'));}}})[_0xf780('0x55')](function(_0x2dce7a){logger[_0xf780('0x53')](_0xf780('0x56'),util[_0xf780('0x57')](_0x2dce7a,{'showHidden':!![],'depth':null}));});};exports[_0xf780('0x58')]=function(_0x324f74,_0x577fb4,_0x22745e,_0x4d669e,_0x1815de,_0xa62ca2,_0x48d2fe){var _0x4dee75,_0x59f01b;_0xa62ca2[_0xf780('0xe')]=intUtil[_0xf780('0x42')](_0xa62ca2[_0xf780('0xe')]);_0xa62ca2['serverUrl']=intUtil['stripTrailingSlash'](_0xa62ca2['serverUrl']);if(_0x48d2fe&&_0x48d2fe[_0xf780('0x59')]&&_0x48d2fe['recordingFormat']!==_0xf780('0x5a')){logger[_0xf780('0xc')](_0xf780('0x5b'),'Recording\x20is\x20enabled!');_0x577fb4[_0xf780('0x45')]=util['format'](_0xf780('0x5c'),_0xa62ca2[_0xf780('0x41')],_0x577fb4['uniqueid'],md5(_0x577fb4[_0xf780('0x5d')]));}headers[_0xf780('0x46')]=getAuth(_0xa62ca2);return getUser(_0xa62ca2,_0x4d669e[_0xf780('0x47')])[_0xf780('0x15')](function(_0x2abf0e){_0x4dee75=_0x2abf0e;logger[_0xf780('0xc')](_0xf780('0x48'),_0x4dee75['id']);return getEndUser(_0xa62ca2,_0x577fb4['destcalleridname'],_0x577fb4['destcalleridnum']);})[_0xf780('0x15')](function(_0x3aaba0){_0x59f01b=_0x3aaba0;logger['info'](_0xf780('0x5e'),_0x59f01b['id']);return getTicket(_0xa62ca2,_0x4dee75,_0x59f01b,_0x22745e,_0x577fb4);})[_0xf780('0x15')](function(_0x1c2d39){if(_0x1c2d39){logger[_0xf780('0xc')](_0xf780('0x4b'),_0x1c2d39['id']);switch(_0xa62ca2['type']){case'integrationTab':logger[_0xf780('0xc')]('[OUTBOUND]',_0xf780('0x4d'));return request({'uri':util['format'](_0xf780('0x4e'),_0xa62ca2[_0xf780('0xe')],_0x4dee75['id'],_0x1c2d39['id']),'method':_0xf780('0xf')});case _0xf780('0x4f'):logger[_0xf780('0xc')]('[OUTBOUND]',_0xf780('0x50'));emit(util[_0xf780('0x19')](_0xf780('0x5f'),_0x4d669e['name']),'trigger:browser:url',{'uri':util[_0xf780('0x19')](_0xf780('0x52'),_0xa62ca2[_0xf780('0xe')],_0x1c2d39['id'])});break;default:logger['error']('[OUTBOUND]',_0xf780('0x54'));}}})[_0xf780('0x55')](function(_0x21e7be){logger[_0xf780('0x53')](_0xf780('0x60'),util[_0xf780('0x57')](_0x21e7be,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x6b14e8,_0x33cdcc,_0x304ba6,_0x4c2cac,_0x58f573,_0x1bcf9f){var _0x55a23e,_0xb2f478;_0x1bcf9f[_0xf780('0xe')]=intUtil[_0xf780('0x42')](_0x1bcf9f[_0xf780('0xe')]);_0x1bcf9f[_0xf780('0x41')]=intUtil[_0xf780('0x42')](_0x1bcf9f[_0xf780('0x41')]);if(_0x58f573&&_0x58f573[_0xf780('0x43')]){logger[_0xf780('0xc')]('['+_0x33cdcc[_0xf780('0x61')][_0xf780('0x62')]()+']',_0xf780('0x44'));_0x33cdcc[_0xf780('0x45')]=util[_0xf780('0x19')](_0xf780('0x5c'),_0x1bcf9f[_0xf780('0x41')],_0x33cdcc['uniqueid'],md5(_0x33cdcc[_0xf780('0x5d')]));}else{_0x33cdcc['recordingURL']='';}headers[_0xf780('0x46')]=getAuth(_0x1bcf9f);return getUser(_0x1bcf9f)[_0xf780('0x15')](function(_0x2f0473){_0x55a23e=_0x2f0473;logger['info'](_0xf780('0x48'),_0x55a23e['id']);return getEndUser(_0x1bcf9f,_0x33cdcc[_0xf780('0x49')],_0x33cdcc[_0xf780('0x4a')]);})[_0xf780('0x15')](function(_0x3371f7){_0xb2f478=_0x3371f7;logger[_0xf780('0xc')](_0xf780('0x5e'),_0xb2f478['id']);return getTicket(_0x1bcf9f,_0x55a23e,_0xb2f478,_0x304ba6,_0x33cdcc);})[_0xf780('0x15')](function(_0x451928){if(_0x451928){logger[_0xf780('0xc')](_0xf780('0x4b'),_0x451928['id']);}})['catch'](function(_0x1169cc){logger['error']('['+_0x33cdcc['lastevent'][_0xf780('0x62')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xf780('0x57')](_0x1169cc,{'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 e77278c..6fa6271 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 _0xef1a=['./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','stringify','forEach','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientSecret','refresh_token','then','seconds','catch','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','error','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','startCase','role','first_name','last_name','SUCCESS','details','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','moduleCreate','lead','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Full_Name','First_Name','Last_Name','What_Id','talktime','utc','mm:ss','answertime','Call_Duration','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','user:%s','https://crm.','unmanaged','monitor_format','calleridname','toUpperCase','lodash','request-promise','md5','util'];(function(_0x21065c,_0x23839c){var _0x3500c0=function(_0x59c477){while(--_0x59c477){_0x21065c['push'](_0x21065c['shift']());}};_0x3500c0(++_0x23839c);}(_0xef1a,0x1c1));var _0xaef1=function(_0x21bf4b,_0x1f57d0){_0x21bf4b=_0x21bf4b-0x0;var _0x5964aa=_0xef1a[_0x21bf4b];return _0x5964aa;};'use strict';var _=require(_0xaef1('0x0'));var rp=require(_0xaef1('0x1'));var md5=require(_0xaef1('0x2'));var util=require(_0xaef1('0x3'));var intUtil=require(_0xaef1('0x4'));var moment=require(_0xaef1('0x5'));var Redis=require(_0xaef1('0x6'));var BPromise=require(_0xaef1('0x7'));var config=require(_0xaef1('0x8'));var logger=require(_0xaef1('0x9'))(_0xaef1('0xa'));config[_0xaef1('0xb')]=_[_0xaef1('0xc')](config[_0xaef1('0xb')],{'host':_0xaef1('0xd'),'port':0x18eb});var io=require(_0xaef1('0xe'))(new Redis(config[_0xaef1('0xb')]));function emit(_0x1e1583,_0x5b5ecf,_0xae1ce4){io['to'](_0x1e1583)[_0xaef1('0xf')](_0x5b5ecf,_0xae1ce4);}function request(_0x374c96){logger['debug'](_0xaef1('0x10'),JSON[_0xaef1('0x11')](_0x374c96));return rp(_0x374c96);}function getCustomFields(_0x128171,_0x3f94e4){var _0x170d33={};if(_0x128171['length']>0x0){_[_0xaef1('0x12')](_0x128171,function(_0x5d9f44){if(_0x5d9f44[_0xaef1('0x13')]==='string'&&_0x5d9f44['idField']){_0x170d33[_0x5d9f44[_0xaef1('0x14')]]=_0x5d9f44[_0xaef1('0x15')][_0xaef1('0x16')]();}else if(_0x5d9f44[_0xaef1('0x13')]==='variable'&&_0x5d9f44['variableName']&&_0x5d9f44[_0xaef1('0x14')]&&_0x3f94e4[_0x5d9f44['variableName']]){_0x170d33[_0x5d9f44[_0xaef1('0x14')]]=_0x3f94e4[_0x5d9f44[_0xaef1('0x17')]]['toString']();}else if(_0x5d9f44[_0xaef1('0x13')]===_0xaef1('0x18')&&_0x5d9f44[_0xaef1('0x19')]&&_0x5d9f44[_0xaef1('0x19')][_0xaef1('0x1a')]&&_0x5d9f44[_0xaef1('0x14')]&&_0x3f94e4[_0x5d9f44[_0xaef1('0x19')][_0xaef1('0x1a')][_0xaef1('0x1b')]()]){_0x170d33[_0x5d9f44[_0xaef1('0x14')]]=_0x3f94e4[_0x5d9f44[_0xaef1('0x19')][_0xaef1('0x1a')]['toLowerCase']()]['toString']();}});}return _0x170d33;}function getName(_0x37c4dd){if(_0x37c4dd['indexOf']('\x20')>0x0){var _0x176c52=_0x37c4dd[_0xaef1('0x1c')](/ (.+)/);if(_0x176c52[0x1]){return _0x176c52;}}return[_0x37c4dd,_0x37c4dd];}var accountsTokens={};function getAccessToken(_0x3bdfd4){return new Promise(function(_0x4b2388,_0x57e7d3){if(!_['isNil'](accountsTokens[_0x3bdfd4['id']])&&!_[_0xaef1('0x1d')](accountsTokens[_0x3bdfd4['id']][_0xaef1('0x1e')])){if(moment()['isBefore'](accountsTokens[_0x3bdfd4['id']][_0xaef1('0x1f')])){_0x4b2388(accountsTokens[_0x3bdfd4['id']][_0xaef1('0x1e')]);}}var _0x1867e9;switch(_0x3bdfd4[_0xaef1('0x20')]){case'US':_0x1867e9='https://accounts.zoho.com';break;case'AU':_0x1867e9=_0xaef1('0x21');break;case'EU':_0x1867e9=_0xaef1('0x22');break;case'IN':_0x1867e9=_0xaef1('0x23');break;case'CN':_0x1867e9=_0xaef1('0x24');break;default:_0x1867e9=_0xaef1('0x22');break;}var _0x34eeb1={'method':_0xaef1('0x25'),'uri':_0x1867e9+'/oauth/v2/token','qs':{'refresh_token':_0x3bdfd4[_0xaef1('0x26')],'client_id':_0x3bdfd4['clientId'],'client_secret':_0x3bdfd4[_0xaef1('0x27')],'grant_type':_0xaef1('0x28')},'json':!![]};return rp(_0x34eeb1)[_0xaef1('0x29')](function(_0x276ecd){accountsTokens[_0x3bdfd4['id']]={'access_token':_0x276ecd[_0xaef1('0x1e')],'expires_in':moment()['add'](_0x276ecd[_0xaef1('0x1f')],_0xaef1('0x2a'))};_0x4b2388(_0x276ecd['access_token']);})[_0xaef1('0x2b')](function(_0xa3342){logger['error']('Failing\x20creating\x20the\x20access_token',_0xa3342[_0xaef1('0x2c')]);_0x57e7d3(_0xa3342);});});}function getUser(_0x55d019,_0xb66e30,_0x5ac53a,_0x8024d4){logger[_0xaef1('0x2d')]('Search\x20user');return request({'method':_0xaef1('0x2e'),'uri':util[_0xaef1('0x2f')](_0xaef1('0x30'),_0xb66e30),'qs':{'type':_0xaef1('0x31')},'headers':{'Authorization':_0xaef1('0x32')+_0x55d019},'json':!![]})['then'](function(_0x34a5e1){if(_0x34a5e1['users']){var _0x5caf93=-0x1;if(_[_0xaef1('0x33')](_0x34a5e1[_0xaef1('0x34')])){if(!_[_0xaef1('0x1d')](_0x8024d4)){_0x5caf93=_['findIndex'](_0x34a5e1[_0xaef1('0x34')],function(_0x3cadc2){return _0x3cadc2[_0xaef1('0x35')]===_0x8024d4;});}if(_0x5caf93>=0x0){logger[_0xaef1('0x2d')](_0xaef1('0x36'));}else{logger[_0xaef1('0x2d')](_0xaef1('0x37'));_0x5caf93=_['findIndex'](_0x34a5e1[_0xaef1('0x34')],function(_0xbb402c){return _0xbb402c['profile'][_0xaef1('0x1a')]===_0xaef1('0x38');});}return _0x34a5e1[_0xaef1('0x34')][_0x5caf93];}else{if(_0x34a5e1[_0xaef1('0x39')][_0xaef1('0x3a')][_0xaef1('0x1a')]===_0xaef1('0x38')){logger[_0xaef1('0x2d')](_0xaef1('0x37'));user=_0x34a5e1['user'];return user;}else{logger[_0xaef1('0x3b')](_0xaef1('0x3c'),JSON['stringify'](_0x34a5e1));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xaef1('0x11')](_0x34a5e1));}}}else{logger[_0xaef1('0x3b')](_0xaef1('0x3c'),JSON['stringify'](_0x34a5e1));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xaef1('0x11')](_0x34a5e1));}})[_0xaef1('0x2b')](function(_0x76d09b){console[_0xaef1('0x3b')](_0x76d09b);});}function getZohoUser(_0x5b8f5b,_0xccc0cb){return new BPromise(function(_0x5c0903,_0x2dccf0){request(_0x5b8f5b)[_0xaef1('0x29')](function(_0x20e049){var _0x52f395=null;if(_0x20e049){_0x52f395=_0x20e049[_0xaef1('0x3d')][0x0];_0x52f395[_0xaef1('0x3e')]=_0xccc0cb;}_0x5c0903(_0x52f395);})[_0xaef1('0x2b')](function(_0x14d017){_0x2dccf0(_0x14d017);});});}function createEndUser(_0x4de181,_0x4b0f96,_0x15316c,_0x453b66,_0x3e711c,_0xaa507d){var _0x15316c=getName(_0x15316c);return request({'method':'POST','uri':_0xaef1('0x3f')+_0x4b0f96+'/crm/v2/'+_[_0xaef1('0x40')](_0xaa507d['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x15316c[0x1],'First_Name':_0x15316c[0x0],'Phone':_0x453b66,'Owner':{'name':!_[_0xaef1('0x1d')](_0x3e711c[_0xaef1('0x41')][_0xaef1('0x1a')])?_0x3e711c['role'][_0xaef1('0x1a')]:!_[_0xaef1('0x1d')](_0x3e711c[_0xaef1('0x42')])?_0x3e711c[_0xaef1('0x42')]+'\x20'+_0x3e711c['last_name']:_0x3e711c[_0xaef1('0x43')],'id':_0x3e711c['id']}}]},'headers':{'Authorization':_0xaef1('0x32')+_0x4de181},'json':!![]})[_0xaef1('0x29')](function(_0x38918b){if(_0x38918b&&_0x38918b['data'][0x0]['code']===_0xaef1('0x44')){var _0x11d3ea=_0x38918b['data'][0x0][_0xaef1('0x45')];_0x11d3ea['enduserType']=_[_0xaef1('0x40')](_0xaa507d['moduleCreate'])+'s';return _0x11d3ea;}logger[_0xaef1('0x3b')](_0xaef1('0x3c'),JSON[_0xaef1('0x11')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0xaef1('0x2b')](function(_0x11c0de){console[_0xaef1('0x46')](_0xaef1('0x47'),_0x11c0de);});}function getEndUser(_0x538905,_0x3df48a,_0x33ba56,_0x1e7f21,_0x1cc205,_0x4837e,_0x221c64){var _0x3da1ef={'method':'GET','uri':'','headers':{'Authorization':_0xaef1('0x32')+_0x538905},'json':!![]};switch(_0x221c64[_0xaef1('0x48')]){case _0xaef1('0x49'):_0x3da1ef[_0xaef1('0x4a')]='https://www.zohoapis.'+_0x3df48a+_0xaef1('0x4b')+_0x1cc205+'))';return getZohoUser(_0x3da1ef,_0xaef1('0x4c'))[_0xaef1('0x29')](function(_0x4945b7){if(_0x4945b7)return _0x4945b7;_0x3da1ef[_0xaef1('0x4a')]=_0xaef1('0x3f')+_0x3df48a+_0xaef1('0x4d')+_0x1cc205+'))';return getZohoUser(_0x3da1ef,_0xaef1('0x4e'))[_0xaef1('0x29')](function(_0x203f68){if(_0x203f68)return _0x203f68;if(_0x221c64['moduleCreate']!=_0xaef1('0x4f')){return createEndUser(_0x538905,_0x3df48a,_0x1e7f21,_0x1cc205,_0x4837e,_0x221c64);}else{return{};}});});break;case _0xaef1('0x50'):_0x3da1ef['uri']=_0xaef1('0x3f')+_0x3df48a+_0xaef1('0x4b')+_0x1cc205+'))';return getZohoUser(_0x3da1ef,_0xaef1('0x4c'))[_0xaef1('0x29')](function(_0x43895b){if(_0x43895b)return _0x43895b;if(_0x221c64[_0xaef1('0x51')]!=_0xaef1('0x4f')){return createEndUser(_0x538905,_0x3df48a,_0x1e7f21,_0x1cc205,_0x4837e,_0x221c64);}else{return{};}});break;case _0xaef1('0x52'):_0x3da1ef[_0xaef1('0x4a')]='https://www.zohoapis.'+_0x3df48a+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1cc205+'))';return getZohoUser(_0x3da1ef,_0xaef1('0x4e'))[_0xaef1('0x29')](function(_0x5cc472){if(_0x5cc472)return _0x5cc472;if(_0x221c64[_0xaef1('0x51')]!=_0xaef1('0x4f')){return createEndUser(_0x538905,_0x3df48a,_0x1e7f21,_0x1cc205,_0x4837e,_0x221c64);}else{return{};}});break;}}function getCall(_0x18b21b,_0x4911d3,_0x41f26e,_0x14a499,_0x4c0937,_0x347229,_0x6905ff,_0x550abc){logger['info'](_0xaef1('0x53'));var _0x121d06={};_0x121d06[_0xaef1('0x54')]={'name':!_['isNil'](_0x14a499[_0xaef1('0x41')]['name'])&&!_[_0xaef1('0x1d')](_0x14a499[_0xaef1('0x3a')][_0xaef1('0x1a')])&&_0x14a499[_0xaef1('0x3a')]['name']===_0xaef1('0x55')?_0x14a499[_0xaef1('0x41')][_0xaef1('0x1a')]:!_[_0xaef1('0x1d')](_0x14a499['first_name'])?_0x14a499[_0xaef1('0x42')]+'\x20'+_0x14a499[_0xaef1('0x43')]:_0x14a499[_0xaef1('0x43')],'id':_0x14a499['id']};_0x121d06['Subject']=intUtil[_0xaef1('0x56')](_0x347229[_0xaef1('0x57')],_0x6905ff,'\x20');_0x121d06[_0xaef1('0x58')]=intUtil[_0xaef1('0x56')](_0x347229['Descriptions'],_0x6905ff,'\x0a');if(_0x4c0937['enduserType']===_0xaef1('0x4c')){_0x121d06['Who_Id']={'name':!_[_0xaef1('0x1d')](_0x4c0937[_0xaef1('0x59')])?_0x4c0937[_0xaef1('0x59')]:!_[_0xaef1('0x1d')](_0x4c0937[_0xaef1('0x5a')])?_0x4c0937['First_Name']+'\x20'+_0x4c0937['Last_Name']:_0x4c0937[_0xaef1('0x5b')],'id':_0x4c0937['id']};}if(_0x4c0937[_0xaef1('0x3e')]===_0xaef1('0x4e')){_0x121d06[_0xaef1('0x5c')]={'name':!_[_0xaef1('0x1d')](_0x4c0937[_0xaef1('0x59')])?_0x4c0937[_0xaef1('0x59')]:!_['isNil'](_0x4c0937[_0xaef1('0x5a')])?_0x4c0937['First_Name']+'\x20'+_0x4c0937['Last_Name']:_0x4c0937['Last_Name'],'id':_0x4c0937['id']};_0x121d06['$se_module']=_['startCase'](_0x4c0937[_0xaef1('0x3e')]);}if(_0x6905ff[_0xaef1('0x5d')]){_0x121d06['Call_Duration']=moment[_0xaef1('0x5e')](parseInt(_0x6905ff[_0xaef1('0x5d')])*0x3e8)[_0xaef1('0x2f')](_0xaef1('0x5f'));}else if(_0x6905ff[_0xaef1('0x60')]&&_0x6905ff['endtime']){_0x121d06[_0xaef1('0x61')]=moment[_0xaef1('0x5e')](moment(_0x6905ff[_0xaef1('0x62')],_0xaef1('0x63'))[_0xaef1('0x64')](moment(_0x6905ff[_0xaef1('0x65')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0xaef1('0x5f'));}switch(_0x6905ff[_0xaef1('0x66')]){case _0xaef1('0x67'):_0x121d06[_0xaef1('0x68')]=_0xaef1('0x69');break;case'complete':case'connect':_0x121d06[_0xaef1('0x68')]=_0xaef1('0x6a');break;case _0xaef1('0x6b'):_0x121d06[_0xaef1('0x68')]=_0xaef1('0x6c');break;case _0xaef1('0x6d'):_0x121d06['Call_Result']=_0xaef1('0x6e');break;case'timeout':_0x121d06[_0xaef1('0x68')]=_0xaef1('0x6f');default:}_0x121d06[_0xaef1('0x70')]=(_0x550abc===_0xaef1('0x71')?moment(_0x6905ff[_0xaef1('0x65')])['format'](_0xaef1('0x63')):moment(_0x6905ff['agentcalledAt'])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xaef1('0x2f')]('YYYY-MM-DDTHH:mm:ss');_0x121d06[_0xaef1('0x72')]=_0x550abc||_0xaef1('0x73');_0x121d06=_[_0xaef1('0x74')](_0x121d06,getCustomFields(_0x347229[_0xaef1('0x75')],_0x6905ff));return request({'method':_0xaef1('0x25'),'uri':'https://www.zohoapis.'+_0x4911d3+_0xaef1('0x76'),'headers':{'Authorization':_0xaef1('0x32')+_0x18b21b},'body':{'data':[_0x121d06]},'json':!![]})['then'](function(_0x5d879c){if(_0x5d879c&&_0x5d879c[_0xaef1('0x3d')][0x0][_0xaef1('0x77')]===_0xaef1('0x44')){logger[_0xaef1('0x2d')]('Call\x20created!');return{'id':_0x5d879c[_0xaef1('0x3d')][0x0][_0xaef1('0x45')]['id']};}})['catch'](function(_0x564809){logger[_0xaef1('0x2d')](_0xaef1('0x78'),_0x564809[_0xaef1('0x2c')]);console['log']('err',_0x564809);});}exports[_0xaef1('0x79')]=function(_0x30fe83,_0x2964c3,_0x4180c8,_0x1fce91,_0x2909e5,_0x1d64b0){var _0x23325c,_0x359c26,_0x3254ef;_0x1d64b0[_0xaef1('0x7a')]=intUtil[_0xaef1('0x7b')](_0x1d64b0[_0xaef1('0x7a')]);_0x1d64b0['serverUrl']=intUtil[_0xaef1('0x7b')](_0x1d64b0[_0xaef1('0x7c')]);if(_0x2909e5&&_0x2909e5['monitor_format']){logger[_0xaef1('0x2d')](_0xaef1('0x7d'),_0xaef1('0x7e'));_0x2964c3[_0xaef1('0x7f')]=_0x1d64b0[_0xaef1('0x7c')]+_0xaef1('0x80')+_0x2964c3[_0xaef1('0x81')]+_0xaef1('0x82')+md5(_0x2964c3['uniqueid']);}else{_0x2964c3[_0xaef1('0x7f')]='';}var _0x2313aa=_0x1d64b0['host']===_0xaef1('0x83')?'eu':_0xaef1('0x84');return getAccessToken(_0x1d64b0)[_0xaef1('0x29')](function(_0xb18bd8){_0x3254ef=_0xb18bd8;return getUser(_0x3254ef,_0x2313aa,_0x1d64b0,_0x1fce91[_0xaef1('0x35')]);})[_0xaef1('0x29')](function(_0x316b9a){_0x23325c=_0x316b9a;logger[_0xaef1('0x2d')](_0xaef1('0x85'),_0x23325c['id']);return getEndUser(_0x3254ef,_0x2313aa,_0x1d64b0,_0x2964c3['calleridname'],_0x2964c3[_0xaef1('0x86')],_0x23325c,_0x4180c8);})[_0xaef1('0x29')](function(_0x2f0ba8){_0x359c26=_0x2f0ba8;return getCall(_0x3254ef,_0x2313aa,_0x1d64b0,_0x23325c,_0x359c26,_0x4180c8,_0x2964c3,_0xaef1('0x73'));})[_0xaef1('0x29')](function(_0x3304db){if(_0x3304db){logger[_0xaef1('0x2d')]('The\x20Call\x20ID\x20is:',_0x3304db['id']);logger['info'](_0xaef1('0x7d'),_0xaef1('0x87'));emit(util[_0xaef1('0x2f')]('user:%s',_0x1fce91['name']),_0xaef1('0x88'),{'uri':'https://crm.'+_0x1d64b0[_0xaef1('0x7a')]+_0xaef1('0x89')+_0x3304db['id']});}})[_0xaef1('0x2b')](function(_0x3f3ce6){logger[_0xaef1('0x3b')](_0xaef1('0x7d'),JSON[_0xaef1('0x11')](_0x3f3ce6));});};exports['outbound']=function(_0x26b505,_0x17717a,_0xbcbc0f,_0x3c807b,_0x4a1d67,_0x2e08a9,_0x44187f){var _0x5e3e82,_0x7eee2c,_0x171137;_0x2e08a9[_0xaef1('0x7a')]=intUtil['stripTrailingSlash'](_0x2e08a9[_0xaef1('0x7a')]);_0x2e08a9[_0xaef1('0x7c')]=intUtil['stripTrailingSlash'](_0x2e08a9['serverUrl']);if(_0x44187f&&_0x44187f[_0xaef1('0x8a')]&&_0x44187f[_0xaef1('0x8a')]!==_0xaef1('0x8b')){logger[_0xaef1('0x2d')](_0xaef1('0x8c'),'Recording\x20is\x20enabled!');_0x17717a[_0xaef1('0x7f')]=_0x2e08a9['serverUrl']+_0xaef1('0x80')+_0x17717a[_0xaef1('0x81')]+_0xaef1('0x82')+md5(_0x17717a['uniqueid']);}var _0x42a410=_0x2e08a9[_0xaef1('0x7a')]===_0xaef1('0x83')?'eu':_0xaef1('0x84');return getAccessToken(_0x2e08a9)[_0xaef1('0x29')](function(_0x49e63b){_0x171137=_0x49e63b;return getUser(_0x171137,_0x42a410,_0x2e08a9,_0x3c807b[_0xaef1('0x35')]);})[_0xaef1('0x29')](function(_0x5e48cf){_0x5e3e82=_0x5e48cf;logger[_0xaef1('0x2d')]('The\x20User\x20ID\x20is:',_0x5e3e82['id']);return getEndUser(_0x171137,_0x42a410,_0x2e08a9,_0x17717a[_0xaef1('0x8d')],_0x17717a[_0xaef1('0x8e')],_0x5e3e82,_0xbcbc0f);})[_0xaef1('0x29')](function(_0x154517){_0x7eee2c=_0x154517;return getCall(_0x171137,_0x42a410,_0x2e08a9,_0x5e3e82,_0x7eee2c,_0xbcbc0f,_0x17717a,_0xaef1('0x8f'));})[_0xaef1('0x29')](function(_0x35868e){if(_0x35868e){logger[_0xaef1('0x2d')](_0xaef1('0x90'),_0x35868e['id']);logger[_0xaef1('0x2d')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xaef1('0x2f')](_0xaef1('0x91'),_0x3c807b['name']),_0xaef1('0x88'),{'uri':_0xaef1('0x92')+_0x2e08a9[_0xaef1('0x7a')]+_0xaef1('0x89')+_0x35868e['id']});}})[_0xaef1('0x2b')](function(_0x14ff07){logger[_0xaef1('0x3b')](_0xaef1('0x8c'),JSON['stringify'](_0x14ff07));});};exports[_0xaef1('0x93')]=function(_0x113785,_0x1e3840,_0x385e02,_0x437b4c,_0x15af6d,_0x360a2f){var _0x1fe06c,_0x965910,_0xa6e51f;_0x360a2f['host']=intUtil[_0xaef1('0x7b')](_0x360a2f[_0xaef1('0x7a')]);_0x360a2f[_0xaef1('0x7c')]=intUtil[_0xaef1('0x7b')](_0x360a2f[_0xaef1('0x7c')]);if(_0x15af6d&&_0x15af6d[_0xaef1('0x94')]){logger[_0xaef1('0x2d')]('['+_0x1e3840[_0xaef1('0x66')]['toUpperCase']()+']',_0xaef1('0x7e'));_0x1e3840[_0xaef1('0x7f')]=_0x360a2f[_0xaef1('0x7c')]+'/api/voice/recordings/'+_0x1e3840['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x1e3840[_0xaef1('0x81')]);}else{_0x1e3840[_0xaef1('0x7f')]='';}var _0x1bb712=_0x360a2f[_0xaef1('0x7a')]===_0xaef1('0x83')?'eu':_0xaef1('0x84');return getAccessToken(_0x360a2f)[_0xaef1('0x29')](function(_0x1006f0){_0xa6e51f=_0x1006f0;return getUser(_0xa6e51f,_0x1bb712,_0x360a2f);})[_0xaef1('0x29')](function(_0x3a89f2){_0x1fe06c=_0x3a89f2;logger['info']('The\x20User\x20ID\x20is:',_0x1fe06c['id']);return getEndUser(_0xa6e51f,_0x1bb712,_0x360a2f,_0x1e3840[_0xaef1('0x95')],_0x1e3840['calleridnum'],_0x1fe06c,_0x385e02);})[_0xaef1('0x29')](function(_0x8a8ed5){_0x965910=_0x8a8ed5;return getCall(_0xa6e51f,_0x1bb712,_0x360a2f,_0x1fe06c,_0x965910,_0x385e02,_0x1e3840,_0xaef1('0x73'));})[_0xaef1('0x29')](function(_0x56aa30){if(_0x56aa30){logger['info'](_0xaef1('0x90'),_0x56aa30['id']);}})[_0xaef1('0x2b')](function(_0x4add31){logger[_0xaef1('0x3b')]('['+_0x1e3840[_0xaef1('0x66')][_0xaef1('0x96')]()+']',JSON[_0xaef1('0x11')](_0x4add31));});}; \ No newline at end of file +var _0x2106=['defaults','redis','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','data','SUCCESS','details','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Who_Id','Full_Name','What_Id','First_Name','Last_Name','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','complete','connect','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','stack','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','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=','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridnum','Outbound','unmanaged','toUpperCase','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','zoho'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x2106,0x133));var _0x6210=function(_0x476403,_0x38b012){_0x476403=_0x476403-0x0;var _0x164487=_0x2106[_0x476403];return _0x164487;};'use strict';var _=require('lodash');var rp=require(_0x6210('0x0'));var md5=require(_0x6210('0x1'));var util=require(_0x6210('0x2'));var intUtil=require(_0x6210('0x3'));var moment=require(_0x6210('0x4'));var Redis=require(_0x6210('0x5'));var BPromise=require(_0x6210('0x6'));var config=require('../../../../config/environment');var logger=require(_0x6210('0x7'))(_0x6210('0x8'));config['redis']=_[_0x6210('0x9')](config[_0x6210('0xa')],{'host':_0x6210('0xb'),'port':0x18eb});var io=require(_0x6210('0xc'))(new Redis(config[_0x6210('0xa')]));function emit(_0x42da60,_0x27d7e8,_0xc90cd2){io['to'](_0x42da60)[_0x6210('0xd')](_0x27d7e8,_0xc90cd2);}function request(_0x4a5f14){logger['debug'](_0x6210('0xe'),JSON[_0x6210('0xf')](_0x4a5f14));return rp(_0x4a5f14);}function getCustomFields(_0x4941cf,_0x4896a0){var _0x42fbe8={};if(_0x4941cf[_0x6210('0x10')]>0x0){_[_0x6210('0x11')](_0x4941cf,function(_0x51ffa7){if(_0x51ffa7[_0x6210('0x12')]===_0x6210('0x13')&&_0x51ffa7[_0x6210('0x14')]){_0x42fbe8[_0x51ffa7[_0x6210('0x14')]]=_0x51ffa7[_0x6210('0x15')][_0x6210('0x16')]();}else if(_0x51ffa7[_0x6210('0x12')]===_0x6210('0x17')&&_0x51ffa7[_0x6210('0x18')]&&_0x51ffa7['idField']&&_0x4896a0[_0x51ffa7[_0x6210('0x18')]]){_0x42fbe8[_0x51ffa7[_0x6210('0x14')]]=_0x4896a0[_0x51ffa7[_0x6210('0x18')]][_0x6210('0x16')]();}else if(_0x51ffa7['type']===_0x6210('0x19')&&_0x51ffa7[_0x6210('0x1a')]&&_0x51ffa7[_0x6210('0x1a')][_0x6210('0x1b')]&&_0x51ffa7[_0x6210('0x14')]&&_0x4896a0[_0x51ffa7[_0x6210('0x1a')][_0x6210('0x1b')][_0x6210('0x1c')]()]){_0x42fbe8[_0x51ffa7[_0x6210('0x14')]]=_0x4896a0[_0x51ffa7[_0x6210('0x1a')]['name'][_0x6210('0x1c')]()][_0x6210('0x16')]();}});}return _0x42fbe8;}function getName(_0x45b4bb){if(_0x45b4bb['indexOf']('\x20')>0x0){var _0x12cc1b=_0x45b4bb[_0x6210('0x1d')](/ (.+)/);if(_0x12cc1b[0x1]){return _0x12cc1b;}}return[_0x45b4bb,_0x45b4bb];}var accountsTokens={};function getAccessToken(_0x18f348){return new Promise(function(_0x443d6c,_0x257645){if(!_[_0x6210('0x1e')](accountsTokens[_0x18f348['id']])&&!_[_0x6210('0x1e')](accountsTokens[_0x18f348['id']][_0x6210('0x1f')])){if(moment()['isBefore'](accountsTokens[_0x18f348['id']]['expires_in'])){_0x443d6c(accountsTokens[_0x18f348['id']][_0x6210('0x1f')]);}}var _0x2177c0;switch(_0x18f348[_0x6210('0x20')]){case'US':_0x2177c0=_0x6210('0x21');break;case'AU':_0x2177c0=_0x6210('0x22');break;case'EU':_0x2177c0=_0x6210('0x23');break;case'IN':_0x2177c0=_0x6210('0x24');break;case'CN':_0x2177c0=_0x6210('0x25');break;default:_0x2177c0=_0x6210('0x23');break;}var _0x1805e3={'method':_0x6210('0x26'),'uri':_0x2177c0+_0x6210('0x27'),'qs':{'refresh_token':_0x18f348[_0x6210('0x28')],'client_id':_0x18f348[_0x6210('0x29')],'client_secret':_0x18f348[_0x6210('0x2a')],'grant_type':_0x6210('0x2b')},'json':!![]};return rp(_0x1805e3)[_0x6210('0x2c')](function(_0x13e541){accountsTokens[_0x18f348['id']]={'access_token':_0x13e541[_0x6210('0x1f')],'expires_in':moment()[_0x6210('0x2d')](_0x13e541[_0x6210('0x2e')],_0x6210('0x2f'))};_0x443d6c(_0x13e541[_0x6210('0x1f')]);})[_0x6210('0x30')](function(_0x4a15d5){logger[_0x6210('0x31')](_0x6210('0x32'),_0x4a15d5['stack']);_0x257645(_0x4a15d5);});});}function getUser(_0x2b5932,_0x2c255e,_0x4224ff,_0x600286){logger[_0x6210('0x33')](_0x6210('0x34'));return request({'method':_0x6210('0x35'),'uri':util[_0x6210('0x36')](_0x6210('0x37'),_0x2c255e),'qs':{'type':_0x6210('0x38')},'headers':{'Authorization':_0x6210('0x39')+_0x2b5932},'json':!![]})[_0x6210('0x2c')](function(_0x5e3c23){if(_0x5e3c23[_0x6210('0x3a')]){var _0xcd7bc7=-0x1;if(_[_0x6210('0x3b')](_0x5e3c23['users'])){if(!_[_0x6210('0x1e')](_0x600286)){_0xcd7bc7=_[_0x6210('0x3c')](_0x5e3c23[_0x6210('0x3a')],function(_0x53842e){return _0x53842e[_0x6210('0x3d')]===_0x600286;});}if(_0xcd7bc7>=0x0){logger[_0x6210('0x33')]('Agent\x20found!');}else{logger[_0x6210('0x33')](_0x6210('0x3e'));_0xcd7bc7=_['findIndex'](_0x5e3c23[_0x6210('0x3a')],function(_0x3367ef){return _0x3367ef[_0x6210('0x3f')][_0x6210('0x1b')]===_0x6210('0x40');});}return _0x5e3c23[_0x6210('0x3a')][_0xcd7bc7];}else{if(_0x5e3c23[_0x6210('0x41')][_0x6210('0x3f')]['name']===_0x6210('0x40')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x5e3c23[_0x6210('0x41')];return user;}else{logger[_0x6210('0x31')]('The\x20failing\x20result\x20is',JSON[_0x6210('0xf')](_0x5e3c23));throw new Error(_0x6210('0x42')+JSON['stringify'](_0x5e3c23));}}}else{logger[_0x6210('0x31')](_0x6210('0x43'),JSON['stringify'](_0x5e3c23));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x5e3c23));}})['catch'](function(_0x2f972d){console[_0x6210('0x31')](_0x2f972d);});}function getZohoUser(_0x3b3767,_0x43ec6d){return new BPromise(function(_0xc4db6d,_0x40b5db){request(_0x3b3767)[_0x6210('0x2c')](function(_0x292297){var _0x1e6b80=null;if(_0x292297){_0x1e6b80=_0x292297['data'][0x0];_0x1e6b80[_0x6210('0x44')]=_0x43ec6d;}_0xc4db6d(_0x1e6b80);})[_0x6210('0x30')](function(_0xe0d84c){_0x40b5db(_0xe0d84c);});});}function createEndUser(_0x949109,_0x2b0d98,_0x36e776,_0x6d4859,_0x4add89,_0x47b635){var _0x36e776=getName(_0x36e776);return request({'method':_0x6210('0x26'),'uri':_0x6210('0x45')+_0x2b0d98+'/crm/v2/'+_[_0x6210('0x46')](_0x47b635[_0x6210('0x47')])+'s','body':{'data':[{'Last_Name':_0x36e776[0x1],'First_Name':_0x36e776[0x0],'Phone':_0x6d4859,'Owner':{'name':!_[_0x6210('0x1e')](_0x4add89[_0x6210('0x48')][_0x6210('0x1b')])?_0x4add89[_0x6210('0x48')]['name']:!_['isNil'](_0x4add89[_0x6210('0x49')])?_0x4add89[_0x6210('0x49')]+'\x20'+_0x4add89[_0x6210('0x4a')]:_0x4add89[_0x6210('0x4a')],'id':_0x4add89['id']}}]},'headers':{'Authorization':_0x6210('0x39')+_0x949109},'json':!![]})['then'](function(_0x53c7a5){if(_0x53c7a5&&_0x53c7a5[_0x6210('0x4b')][0x0]['code']===_0x6210('0x4c')){var _0x4ac310=_0x53c7a5[_0x6210('0x4b')][0x0][_0x6210('0x4d')];_0x4ac310[_0x6210('0x44')]=_[_0x6210('0x46')](_0x47b635['moduleCreate'])+'s';return _0x4ac310;}logger['error'](_0x6210('0x43'),JSON[_0x6210('0xf')](data));throw new Error('Error:\x20'+JSON[_0x6210('0xf')](data));})[_0x6210('0x30')](function(_0x5b3689){console[_0x6210('0x4e')](_0x6210('0x4f'),_0x5b3689);});}function getEndUser(_0x4d2569,_0x33f0ab,_0x30ceb8,_0x3400ef,_0x5e84c9,_0x142482,_0x1bdff1){var _0x23cdf9={'method':'GET','uri':'','headers':{'Authorization':_0x6210('0x39')+_0x4d2569},'json':!![]};switch(_0x1bdff1[_0x6210('0x50')]){case _0x6210('0x51'):_0x23cdf9[_0x6210('0x52')]=_0x6210('0x45')+_0x33f0ab+_0x6210('0x53')+_0x5e84c9+'))';return getZohoUser(_0x23cdf9,_0x6210('0x54'))[_0x6210('0x2c')](function(_0x401b75){if(_0x401b75)return _0x401b75;_0x23cdf9[_0x6210('0x52')]='https://www.zohoapis.'+_0x33f0ab+_0x6210('0x55')+_0x5e84c9+'))';return getZohoUser(_0x23cdf9,_0x6210('0x56'))[_0x6210('0x2c')](function(_0x47ff53){if(_0x47ff53)return _0x47ff53;if(_0x1bdff1[_0x6210('0x47')]!=_0x6210('0x57')){return createEndUser(_0x4d2569,_0x33f0ab,_0x3400ef,_0x5e84c9,_0x142482,_0x1bdff1);}else{return{};}});});break;case'contact':_0x23cdf9['uri']='https://www.zohoapis.'+_0x33f0ab+_0x6210('0x53')+_0x5e84c9+'))';return getZohoUser(_0x23cdf9,_0x6210('0x54'))[_0x6210('0x2c')](function(_0x512356){if(_0x512356)return _0x512356;if(_0x1bdff1[_0x6210('0x47')]!='nothing'){return createEndUser(_0x4d2569,_0x33f0ab,_0x3400ef,_0x5e84c9,_0x142482,_0x1bdff1);}else{return{};}});break;case'lead':_0x23cdf9[_0x6210('0x52')]='https://www.zohoapis.'+_0x33f0ab+_0x6210('0x55')+_0x5e84c9+'))';return getZohoUser(_0x23cdf9,_0x6210('0x56'))[_0x6210('0x2c')](function(_0x5d3bfc){if(_0x5d3bfc)return _0x5d3bfc;if(_0x1bdff1[_0x6210('0x47')]!=_0x6210('0x57')){return createEndUser(_0x4d2569,_0x33f0ab,_0x3400ef,_0x5e84c9,_0x142482,_0x1bdff1);}else{return{};}});break;}}function getCall(_0x16ff77,_0x726cd9,_0x31020d,_0xf06901,_0x28392a,_0x12f438,_0x32ccaa,_0x479941){logger['info'](_0x6210('0x58'));var _0x5727b6={};_0x5727b6['Owner']={'name':!_[_0x6210('0x1e')](_0xf06901[_0x6210('0x48')][_0x6210('0x1b')])&&!_[_0x6210('0x1e')](_0xf06901[_0x6210('0x3f')][_0x6210('0x1b')])&&_0xf06901[_0x6210('0x3f')][_0x6210('0x1b')]===_0x6210('0x59')?_0xf06901[_0x6210('0x48')][_0x6210('0x1b')]:!_[_0x6210('0x1e')](_0xf06901[_0x6210('0x49')])?_0xf06901[_0x6210('0x49')]+'\x20'+_0xf06901[_0x6210('0x4a')]:_0xf06901[_0x6210('0x4a')],'id':_0xf06901['id']};_0x5727b6[_0x6210('0x5a')]=intUtil[_0x6210('0x5b')](_0x12f438[_0x6210('0x5c')],_0x32ccaa,'\x20');_0x5727b6[_0x6210('0x5d')]=intUtil[_0x6210('0x5b')](_0x12f438['Descriptions'],_0x32ccaa,'\x0a');if(_0x28392a[_0x6210('0x44')]===_0x6210('0x54')){_0x5727b6[_0x6210('0x5e')]={'name':!_['isNil'](_0x28392a[_0x6210('0x5f')])?_0x28392a[_0x6210('0x5f')]:!_[_0x6210('0x1e')](_0x28392a['First_Name'])?_0x28392a['First_Name']+'\x20'+_0x28392a['Last_Name']:_0x28392a['Last_Name'],'id':_0x28392a['id']};}if(_0x28392a[_0x6210('0x44')]===_0x6210('0x56')){_0x5727b6[_0x6210('0x60')]={'name':!_[_0x6210('0x1e')](_0x28392a[_0x6210('0x5f')])?_0x28392a['Full_Name']:!_[_0x6210('0x1e')](_0x28392a[_0x6210('0x61')])?_0x28392a[_0x6210('0x61')]+'\x20'+_0x28392a['Last_Name']:_0x28392a[_0x6210('0x62')],'id':_0x28392a['id']};_0x5727b6['$se_module']=_[_0x6210('0x46')](_0x28392a[_0x6210('0x44')]);}if(_0x32ccaa['talktime']){_0x5727b6[_0x6210('0x63')]=moment[_0x6210('0x64')](parseInt(_0x32ccaa[_0x6210('0x65')])*0x3e8)[_0x6210('0x36')](_0x6210('0x66'));}else if(_0x32ccaa[_0x6210('0x67')]&&_0x32ccaa[_0x6210('0x68')]){_0x5727b6[_0x6210('0x63')]=moment[_0x6210('0x64')](moment(_0x32ccaa[_0x6210('0x68')],_0x6210('0x69'))['diff'](moment(_0x32ccaa[_0x6210('0x6a')],_0x6210('0x69'))))[_0x6210('0x36')](_0x6210('0x66'));}switch(_0x32ccaa[_0x6210('0x6b')]){case _0x6210('0x6c'):_0x5727b6[_0x6210('0x6d')]=_0x6210('0x6e');break;case _0x6210('0x6f'):case _0x6210('0x70'):_0x5727b6[_0x6210('0x6d')]='Answered';break;case'rejected':_0x5727b6[_0x6210('0x6d')]=_0x6210('0x71');break;case _0x6210('0x72'):_0x5727b6['Call_Result']='Abandoned';break;case _0x6210('0x73'):_0x5727b6[_0x6210('0x6d')]=_0x6210('0x74');default:}_0x5727b6[_0x6210('0x75')]=(_0x479941===_0x6210('0x76')?moment(_0x32ccaa[_0x6210('0x6a')])[_0x6210('0x36')](_0x6210('0x69')):moment(_0x32ccaa[_0x6210('0x77')])['format'](_0x6210('0x69')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x5727b6[_0x6210('0x78')]=_0x479941||_0x6210('0x79');_0x5727b6=_[_0x6210('0x7a')](_0x5727b6,getCustomFields(_0x12f438[_0x6210('0x7b')],_0x32ccaa));return request({'method':_0x6210('0x26'),'uri':_0x6210('0x45')+_0x726cd9+_0x6210('0x7c'),'headers':{'Authorization':_0x6210('0x39')+_0x16ff77},'body':{'data':[_0x5727b6]},'json':!![]})['then'](function(_0x3ff1ac){if(_0x3ff1ac&&_0x3ff1ac['data'][0x0][_0x6210('0x7d')]===_0x6210('0x4c')){logger[_0x6210('0x33')](_0x6210('0x7e'));return{'id':_0x3ff1ac[_0x6210('0x4b')][0x0][_0x6210('0x4d')]['id']};}})['catch'](function(_0x1450d7){logger['info']('err',_0x1450d7[_0x6210('0x7f')]);console['log'](_0x6210('0x80'),_0x1450d7);});}exports[_0x6210('0x81')]=function(_0x493eae,_0x5bbe57,_0x2393d4,_0xd45efc,_0x5bb67f,_0x4b5e92){var _0x188915,_0x583f35,_0x1e2433;_0x4b5e92[_0x6210('0x82')]=intUtil[_0x6210('0x83')](_0x4b5e92['host']);_0x4b5e92['serverUrl']=intUtil[_0x6210('0x83')](_0x4b5e92[_0x6210('0x84')]);if(_0x5bb67f&&_0x5bb67f[_0x6210('0x85')]){logger[_0x6210('0x33')](_0x6210('0x86'),_0x6210('0x87'));_0x5bbe57[_0x6210('0x88')]=_0x4b5e92['serverUrl']+_0x6210('0x89')+_0x5bbe57[_0x6210('0x8a')]+'/downloads?type=uniqueid&token='+md5(_0x5bbe57[_0x6210('0x8a')]);}else{_0x5bbe57[_0x6210('0x88')]='';}var _0x306a32=_0x4b5e92['host']===_0x6210('0x8b')?'eu':_0x6210('0x8c');return getAccessToken(_0x4b5e92)['then'](function(_0x565404){_0x1e2433=_0x565404;return getUser(_0x1e2433,_0x306a32,_0x4b5e92,_0xd45efc['email']);})['then'](function(_0x163082){_0x188915=_0x163082;logger['info'](_0x6210('0x8d'),_0x188915['id']);return getEndUser(_0x1e2433,_0x306a32,_0x4b5e92,_0x5bbe57[_0x6210('0x8e')],_0x5bbe57[_0x6210('0x8f')],_0x188915,_0x2393d4);})[_0x6210('0x2c')](function(_0x1f0ab7){_0x583f35=_0x1f0ab7;return getCall(_0x1e2433,_0x306a32,_0x4b5e92,_0x188915,_0x583f35,_0x2393d4,_0x5bbe57,_0x6210('0x79'));})['then'](function(_0x4b3e24){if(_0x4b3e24){logger[_0x6210('0x33')](_0x6210('0x90'),_0x4b3e24['id']);logger[_0x6210('0x33')]('[QUEUE]',_0x6210('0x91'));emit(util[_0x6210('0x36')](_0x6210('0x92'),_0xd45efc['name']),_0x6210('0x93'),{'uri':_0x6210('0x94')+_0x4b5e92['host']+_0x6210('0x95')+_0x4b3e24['id']});}})[_0x6210('0x30')](function(_0x508d07){logger['error'](_0x6210('0x86'),JSON['stringify'](_0x508d07));});};exports[_0x6210('0x76')]=function(_0x5de479,_0x3aa4f4,_0x4f8098,_0x5d9aa4,_0x228135,_0x36bf6d,_0x2617a6){var _0x3d136f,_0x27fd25,_0x106706;_0x36bf6d['host']=intUtil[_0x6210('0x83')](_0x36bf6d[_0x6210('0x82')]);_0x36bf6d[_0x6210('0x84')]=intUtil['stripTrailingSlash'](_0x36bf6d[_0x6210('0x84')]);if(_0x2617a6&&_0x2617a6['recordingFormat']&&_0x2617a6[_0x6210('0x96')]!==_0x6210('0x97')){logger['info'](_0x6210('0x98'),_0x6210('0x87'));_0x3aa4f4['recordingURL']=_0x36bf6d[_0x6210('0x84')]+_0x6210('0x89')+_0x3aa4f4[_0x6210('0x8a')]+_0x6210('0x99')+md5(_0x3aa4f4['uniqueid']);}var _0x3ee35c=_0x36bf6d[_0x6210('0x82')]==='zoho.eu'?'eu':_0x6210('0x8c');return getAccessToken(_0x36bf6d)[_0x6210('0x2c')](function(_0x472c54){_0x106706=_0x472c54;return getUser(_0x106706,_0x3ee35c,_0x36bf6d,_0x5d9aa4[_0x6210('0x3d')]);})[_0x6210('0x2c')](function(_0x1dabb0){_0x3d136f=_0x1dabb0;logger['info'](_0x6210('0x8d'),_0x3d136f['id']);return getEndUser(_0x106706,_0x3ee35c,_0x36bf6d,_0x3aa4f4['destcalleridname'],_0x3aa4f4[_0x6210('0x9a')],_0x3d136f,_0x4f8098);})[_0x6210('0x2c')](function(_0x367d22){_0x27fd25=_0x367d22;return getCall(_0x106706,_0x3ee35c,_0x36bf6d,_0x3d136f,_0x27fd25,_0x4f8098,_0x3aa4f4,_0x6210('0x9b'));})[_0x6210('0x2c')](function(_0x2ce775){if(_0x2ce775){logger[_0x6210('0x33')](_0x6210('0x90'),_0x2ce775['id']);logger[_0x6210('0x33')](_0x6210('0x98'),_0x6210('0x91'));emit(util['format']('user:%s',_0x5d9aa4['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x36bf6d['host']+_0x6210('0x95')+_0x2ce775['id']});}})[_0x6210('0x30')](function(_0x438e87){logger['error'](_0x6210('0x98'),JSON[_0x6210('0xf')](_0x438e87));});};exports[_0x6210('0x9c')]=function(_0x2f1581,_0x2b1719,_0x38c791,_0x4059ec,_0x128e65,_0x536329){var _0x43a73d,_0x15bd1d,_0x5cdf43;_0x536329['host']=intUtil[_0x6210('0x83')](_0x536329[_0x6210('0x82')]);_0x536329[_0x6210('0x84')]=intUtil['stripTrailingSlash'](_0x536329[_0x6210('0x84')]);if(_0x128e65&&_0x128e65[_0x6210('0x85')]){logger[_0x6210('0x33')]('['+_0x2b1719[_0x6210('0x6b')][_0x6210('0x9d')]()+']',_0x6210('0x87'));_0x2b1719[_0x6210('0x88')]=_0x536329[_0x6210('0x84')]+_0x6210('0x89')+_0x2b1719[_0x6210('0x8a')]+_0x6210('0x99')+md5(_0x2b1719[_0x6210('0x8a')]);}else{_0x2b1719[_0x6210('0x88')]='';}var _0x412f9b=_0x536329[_0x6210('0x82')]===_0x6210('0x8b')?'eu':'com';return getAccessToken(_0x536329)[_0x6210('0x2c')](function(_0x35f2a0){_0x5cdf43=_0x35f2a0;return getUser(_0x5cdf43,_0x412f9b,_0x536329);})['then'](function(_0x2b4cf4){_0x43a73d=_0x2b4cf4;logger['info'](_0x6210('0x8d'),_0x43a73d['id']);return getEndUser(_0x5cdf43,_0x412f9b,_0x536329,_0x2b1719[_0x6210('0x8e')],_0x2b1719['calleridnum'],_0x43a73d,_0x38c791);})[_0x6210('0x2c')](function(_0x3a0af4){_0x15bd1d=_0x3a0af4;return getCall(_0x5cdf43,_0x412f9b,_0x536329,_0x43a73d,_0x15bd1d,_0x38c791,_0x2b1719,'Inbound');})['then'](function(_0x45768b){if(_0x45768b){logger[_0x6210('0x33')](_0x6210('0x90'),_0x45768b['id']);}})[_0x6210('0x30')](function(_0x370a71){logger[_0x6210('0x31')]('['+_0x2b1719['lastevent'][_0x6210('0x9d')]()+']',JSON[_0x6210('0xf')](_0x370a71));});}; \ 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 8e411a8..a724aac 100644 --- a/server/services/ami/trigger/script/index.js +++ b/server/services/ami/trigger/script/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x4ec900,_0x137e4b){var _0x5c6a3f=function(_0x116e35){while(--_0x116e35){_0x4ec900['push'](_0x4ec900['shift']());}};_0x5c6a3f(++_0x137e4b);}(_0x7a54,0x106));var _0x47a5=function(_0x3a52c3,_0x592f73){_0x3a52c3=_0x3a52c3-0x0;var _0x168446=_0x7a54[_0x3a52c3];return _0x168446;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x3d9e66,_0x5de87f){var _0x59ecad=function(_0x3cc879){while(--_0x3cc879){_0x3d9e66['push'](_0x3d9e66['shift']());}};_0x59ecad(++_0x5de87f);}(_0x7a54,0x106));var _0x47a5=function(_0x3c246d,_0x5e1749){_0x3c246d=_0x3c246d-0x0;var _0x3c1e0d=_0x7a54[_0x3c246d];return _0x3c1e0d;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index 9424ddc..344bd02 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 _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\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','name','message','request-promise','util'];(function(_0x221290,_0x52a4cd){var _0x5845f0=function(_0x243c66){while(--_0x243c66){_0x221290['push'](_0x221290['shift']());}};_0x5845f0(++_0x52a4cd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x38beb8,_0x1f64b1){_0x38beb8=_0x38beb8-0x0;var _0x5a459f=_0x5f2f[_0x38beb8];return _0x5a459f;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\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','name','message','request-promise','util'];(function(_0x4e2c1e,_0x30c07d){var _0x12f144=function(_0x4b1579){while(--_0x4b1579){_0x4e2c1e['push'](_0x4e2c1e['shift']());}};_0x12f144(++_0x30c07d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x53ea22,_0xb35462){_0x53ea22=_0x53ea22-0x0;var _0x55393a=_0x5f2f[_0x53ea22];return _0x55393a;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 189ec43..ee0ac61 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 _0xaa5c=['rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','request','then'];(function(_0x2f90f9,_0x3a55b7){var _0x2944b6=function(_0x2e15e9){while(--_0x2e15e9){_0x2f90f9['push'](_0x2f90f9['shift']());}};_0x2944b6(++_0x3a55b7);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x3ecd97,_0x242785){_0x3ecd97=_0x3ecd97-0x0;var _0x564d7b=_0xaa5c[_0x3ecd97];return _0x564d7b;};'use strict';var jayson=require(_0xcaa5('0x0'));var BPromise=require(_0xcaa5('0x1'));var logger=require(_0xcaa5('0x2'))(_0xcaa5('0x3'));var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x4fd28b,_0x2125b9){return new BPromise(function(_0x4d1b66,_0x49c3ac){return client[_0xcaa5('0x4')](_0x4fd28b,_0x2125b9)[_0xcaa5('0x5')](function(_0x1877d0){logger['debug'](_0xcaa5('0x6'),_0xcaa5('0x3'),_0x4fd28b,_0x2125b9,_0x1877d0);if(_0x1877d0[_0xcaa5('0x7')]){logger[_0xcaa5('0x7')]('rpc',_0xcaa5('0x3'),_0x4fd28b,_0x1877d0[_0xcaa5('0x7')]['message'],_0x2125b9);return _0x49c3ac(_0x1877d0['error'][_0xcaa5('0x8')]);}else{return _0x4d1b66(_0x1877d0[_0xcaa5('0x9')]);}})[_0xcaa5('0xa')](function(_0x52481f){logger[_0xcaa5('0x7')]('rpc',_0xcaa5('0x3'),_0x4fd28b,_0x52481f,_0x2125b9);return _0x49c3ac(_0x52481f);});});};module[_0xcaa5('0xb')]=client; \ No newline at end of file +var _0x28a2=['debug','error','rpc','message','result','catch','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then'];(function(_0x2e913b,_0x4b7071){var _0x173899=function(_0x2a7d22){while(--_0x2a7d22){_0x2e913b['push'](_0x2e913b['shift']());}};_0x173899(++_0x4b7071);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x228a('0x0'));var BPromise=require(_0x228a('0x1'));var logger=require(_0x228a('0x2'))(_0x228a('0x3'));var client=jayson[_0x228a('0x4')][_0x228a('0x5')]({'port':0x2329});client[_0x228a('0x6')]=function(_0x5ce39e,_0x6efce7){return new BPromise(function(_0x51e9e9,_0x2ac105){return client[_0x228a('0x7')](_0x5ce39e,_0x6efce7)[_0x228a('0x8')](function(_0xf86d1d){logger[_0x228a('0x9')]('rpc',_0x228a('0x3'),_0x5ce39e,_0x6efce7,_0xf86d1d);if(_0xf86d1d[_0x228a('0xa')]){logger[_0x228a('0xa')](_0x228a('0xb'),'routing',_0x5ce39e,_0xf86d1d[_0x228a('0xa')][_0x228a('0xc')],_0x6efce7);return _0x2ac105(_0xf86d1d[_0x228a('0xa')][_0x228a('0xc')]);}else{return _0x51e9e9(_0xf86d1d[_0x228a('0xd')]);}})[_0x228a('0xe')](function(_0x42d236){logger[_0x228a('0xa')]('rpc','routing',_0x5ce39e,_0x42d236,_0x6efce7);return _0x2ac105(_0x42d236);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 29a8dd2..daa9525 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 _0x7250=['./server','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','Setting','findOne','loginMailFrequency','log','bluebird'];(function(_0x459322,_0x310ae1){var _0x373823=function(_0x36f93f){while(--_0x36f93f){_0x459322['push'](_0x459322['shift']());}};_0x373823(++_0x310ae1);}(_0x7250,0x1b1));var _0x0725=function(_0x2d1008,_0x4bc5c2){_0x2d1008=_0x2d1008-0x0;var _0x315ca6=_0x7250[_0x2d1008];return _0x315ca6;};'use strict';var BPromise=require(_0x0725('0x0'));var server=require(_0x0725('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0x0725('0x2'));var mailAccount=require(_0x0725('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x0725('0x4'))['db'];function initRealtime(){return BPromise[_0x0725('0x5')]()[_0x0725('0x6')](mailAccount[_0x0725('0x7')]())['then'](realtime[_0x0725('0x8')]())['then'](function(){email['refresh'](realtime[_0x0725('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x0725('0x6')](function(_0x415a9c){return initRealtime();})['then'](function(_0x2f34e5){return db[_0x0725('0xa')][_0x0725('0xb')]({'attributes':['id',_0x0725('0xc')],'raw':!![]});})[_0x0725('0x6')](function(_0x26b7c4){return setInterval(initRealtime,_0x26b7c4[_0x0725('0xc')]*0x3e8);})['catch'](function(_0x148b69){console[_0x0725('0xd')](_0x148b69);});}main(); \ No newline at end of file +var _0x56a4=['getMailAccounts','initMailAccounts','mailAccounts','findOne','loginMailFrequency','catch','log','bluebird','./server','./lib/email','./rpc/mailAccount','then'];(function(_0x3491f5,_0x222f0c){var _0x26e38a=function(_0x58392b){while(--_0x58392b){_0x3491f5['push'](_0x3491f5['shift']());}};_0x26e38a(++_0x222f0c);}(_0x56a4,0x11b));var _0x456a=function(_0x530151,_0x27ab6d){_0x530151=_0x530151-0x0;var _0x129774=_0x56a4[_0x530151];return _0x129774;};'use strict';var BPromise=require(_0x456a('0x0'));var server=require(_0x456a('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0x456a('0x2'));var mailAccount=require(_0x456a('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise['resolve']()[_0x456a('0x4')](mailAccount[_0x456a('0x5')]())[_0x456a('0x4')](realtime[_0x456a('0x6')]())[_0x456a('0x4')](function(){email['refresh'](realtime[_0x456a('0x7')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(_0x2b6329){return initRealtime();})[_0x456a('0x4')](function(_0x37f1b4){return db['Setting'][_0x456a('0x8')]({'attributes':['id','loginMailFrequency'],'raw':!![]});})[_0x456a('0x4')](function(_0x29073f){return setInterval(initRealtime,_0x29073f[_0x456a('0x9')]*0x3e8);})[_0x456a('0xa')](function(_0x2706a7){console[_0x456a('0xb')](_0x2706a7);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 2f13cd3..78156eb 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 _0x4bf1=['total','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','handleImapEmail','bind','end','handleImapError','disabled','handleImapBox','status','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','Mail\x20accepted\x20from\x20routing','error','handleImapEnd','lastSync','sendMail','verifySmtp','Smtp','smtp','then','verified','catch','verify','exports','lodash','moment','bluebird','md5','../../../config/logger','email','redis','defaults','localhost','./imap','info','start\x20email\x20channel','mailAccounts','imapAccounts','emit','name','key','Imap','messageStatus'];(function(_0x28fbbd,_0x3faaee){var _0x5c2cf5=function(_0x47bb56){while(--_0x47bb56){_0x28fbbd['push'](_0x28fbbd['shift']());}};_0x5c2cf5(++_0x3faaee);}(_0x4bf1,0x89));var _0x14bf=function(_0x2a3316,_0xe22ce9){_0x2a3316=_0x2a3316-0x0;var _0xd2f9e4=_0x4bf1[_0x2a3316];return _0xd2f9e4;};'use strict';var _=require(_0x14bf('0x0'));var moment=require(_0x14bf('0x1'));var BPromise=require(_0x14bf('0x2'));var md5=require(_0x14bf('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x14bf('0x4'))(_0x14bf('0x5'));config[_0x14bf('0x6')]=_[_0x14bf('0x7')](config[_0x14bf('0x6')],{'host':_0x14bf('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x14bf('0x6')]));var EmailImap=require(_0x14bf('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x4b5502){logger[_0x14bf('0xa')](_0x14bf('0xb'));this[_0x14bf('0xc')]=_0x4b5502[_0x14bf('0xc')];this[_0x14bf('0xd')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x14bf('0xe')]=function(_0x5af258){var _0x140cba=this[_0x14bf('0xc')][_0x5af258];var _0x4a828a={'id':_0x140cba['id'],'name':_0x140cba[_0x14bf('0xf')],'key':_0x140cba[_0x14bf('0x10')],'active':_0x140cba['active'],'Imap':{'status':_0x140cba[_0x14bf('0x11')]['status'],'messageStatus':_0x140cba['Imap'][_0x14bf('0x12')],'total':_0x140cba['Imap'][_0x14bf('0x13')]}};if(_[_0x14bf('0x14')](md5Accounts[_0x5af258])){md5Accounts[_0x5af258]={};}var _0x26b2c4=md5(JSON[_0x14bf('0x15')](_0x4a828a));if(md5Accounts[_0x5af258][_0x14bf('0x3')]!==_0x26b2c4){md5Accounts[_0x5af258][_0x14bf('0x3')]=_0x26b2c4;io[_0x14bf('0xe')](_0x14bf('0x16'),_0x4a828a);}};EmailChannel[_0x14bf('0x17')][_0x14bf('0x18')]=function(_0x33ef36){for(var _0x573b01 in _0x33ef36){if(_0x33ef36['hasOwnProperty'](_0x573b01)){if(_0x33ef36[_0x573b01]['Imap']&&_0x33ef36[_0x573b01]['active']){var _0x24fafc=_0x33ef36[_0x573b01][_0x14bf('0x11')];if(!this[_0x14bf('0xd')][_0x14bf('0x19')](_0x24fafc['id'])){this['imapAccounts'][_0x24fafc['id']]=new EmailImap(_0x24fafc,_0x33ef36[_0x573b01][_0x14bf('0x5')]);this[_0x14bf('0xd')][_0x24fafc['id']]['on']('box',this['handleImapBox']['bind'](this,_0x573b01));this['imapAccounts'][_0x24fafc['id']]['on'](_0x14bf('0x5'),this[_0x14bf('0x1a')][_0x14bf('0x1b')](this,_0x573b01));this[_0x14bf('0xd')][_0x24fafc['id']]['on'](_0x14bf('0x1c'),this['handleImapEnd'][_0x14bf('0x1b')](this,_0x573b01));this['imapAccounts'][_0x24fafc['id']]['on']('error',this[_0x14bf('0x1d')][_0x14bf('0x1b')](this,_0x573b01));}}else{if(_[_0x14bf('0x14')](this[_0x14bf('0xc')][_0x573b01][_0x14bf('0x11')])){this[_0x14bf('0xc')][_0x573b01]['Imap']={};}this[_0x14bf('0xc')][_0x573b01][_0x14bf('0x11')]['status']=_0x14bf('0x1e');this[_0x14bf('0xc')][_0x573b01]['Imap']['messageStatus']='';this['emit'](_0x573b01);}}}};EmailChannel['prototype'][_0x14bf('0x1f')]=function(_0x53d219,_0xf73ac7){if(this[_0x14bf('0xc')][_0x53d219]){this['mailAccounts'][_0x53d219][_0x14bf('0x11')][_0x14bf('0x20')]=_0x14bf('0x21');this['mailAccounts'][_0x53d219]['Imap']['messageStatus']=_0xf73ac7[_0x14bf('0xf')];if(_0xf73ac7[_0x14bf('0x22')]){this[_0x14bf('0xc')][_0x53d219][_0x14bf('0x11')]['total']=_0xf73ac7[_0x14bf('0x22')]['total'];}return this[_0x14bf('0xe')](_0x53d219);}};EmailChannel[_0x14bf('0x17')][_0x14bf('0x1a')]=function(_0x28bfe3,_0x6e3f45){logger[_0x14bf('0xa')](_0x14bf('0x23'),_0x6e3f45[_0x14bf('0x24')],_0x6e3f45['lastName'],_0x6e3f45[_0x14bf('0x25')],_0x28bfe3);if(this[_0x14bf('0xc')][_0x28bfe3]){return mailAccount[_0x14bf('0x26')](_0x28bfe3,_0x6e3f45)['then'](function(_0x160fb9){if(_0x160fb9){logger[_0x14bf('0xa')](_0x14bf('0x27'));}})['catch'](function(_0x154b99){logger[_0x14bf('0x28')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x14bf('0x15')](_0x154b99));});}};EmailChannel[_0x14bf('0x17')][_0x14bf('0x29')]=function(_0x34617a){if(this[_0x14bf('0xc')][_0x34617a]&&this['mailAccounts'][_0x34617a][_0x14bf('0x11')]){if(this[_0x14bf('0xd')][this[_0x14bf('0xc')][_0x34617a]['Imap']['id']]){delete this[_0x14bf('0xd')][this[_0x14bf('0xc')][_0x34617a]['Imap']['id']];}this['mailAccounts'][_0x34617a][_0x14bf('0x11')][_0x14bf('0x2a')]=moment();this[_0x14bf('0xe')](_0x34617a);}};EmailChannel['prototype'][_0x14bf('0x1d')]=function(_0x3ffa7e,_0x2aeb98){if(this[_0x14bf('0xc')][_0x3ffa7e]){this[_0x14bf('0xc')][_0x3ffa7e]['Imap']['status']='error';this['mailAccounts'][_0x3ffa7e][_0x14bf('0x11')][_0x14bf('0x12')]=_0x2aeb98;return this[_0x14bf('0xe')](_0x3ffa7e);}};EmailChannel[_0x14bf('0x17')][_0x14bf('0x2b')]=function(_0x22d96d,_0x29a38e){return this['smtp']['send'](_0x22d96d,_0x29a38e);};EmailChannel[_0x14bf('0x17')][_0x14bf('0x2c')]=function(_0x371438){var _0x39f58b=this;if(this['mailAccounts'][_0x371438['id']]){if(_[_0x14bf('0x14')](this[_0x14bf('0xc')][_0x371438['id']][_0x14bf('0x2d')])){this[_0x14bf('0xc')][_0x371438['id']]['Smtp']={};}this[_0x14bf('0xc')][_0x371438['id']]['Smtp'][_0x14bf('0x2a')]=moment();return new BPromise(function(_0x2a4e50,_0x729c4c){return _0x39f58b[_0x14bf('0x2e')]['verify'](_0x371438)[_0x14bf('0x2f')](function(_0x471d1c){_0x39f58b[_0x14bf('0xc')][_0x371438['id']][_0x14bf('0x2d')][_0x14bf('0x20')]=_0x14bf('0x30');_0x39f58b['mailAccounts'][_0x371438['id']]['Smtp']['messageStatus']='';_0x39f58b[_0x14bf('0xe')](_0x371438['id']);_0x2a4e50(_0x471d1c);})[_0x14bf('0x31')](function(_0x56c658){_0x39f58b[_0x14bf('0xc')][_0x371438['id']][_0x14bf('0x2d')][_0x14bf('0x20')]='error';_0x39f58b[_0x14bf('0xc')][_0x371438['id']][_0x14bf('0x2d')]['messageStatus']=_0x56c658;_0x39f58b[_0x14bf('0xe')](_0x371438['id']);_0x729c4c(_0x56c658);});});}return this[_0x14bf('0x2e')][_0x14bf('0x32')](_0x371438);};module[_0x14bf('0x33')]=EmailChannel; \ No newline at end of file +var _0x900c=['bluebird','md5','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','name','key','active','Imap','messageStatus','stringify','emit','mailAccount:update','imapAccounts','hasOwnProperty','box','bind','end','handleImapEnd','handleImapError','isNil','status','disabled','handleImapBox','connected','messages','total','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','error','sendMail','send','verifySmtp','Smtp','verify','verified','lodash','moment'];(function(_0x35c5a8,_0x8ecb48){var _0x34782c=function(_0x1b23ec){while(--_0x1b23ec){_0x35c5a8['push'](_0x35c5a8['shift']());}};_0x34782c(++_0x8ecb48);}(_0x900c,0xa9));var _0xc900=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x900c[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xc900('0x0'));var moment=require(_0xc900('0x1'));var BPromise=require(_0xc900('0x2'));var md5=require(_0xc900('0x3'));var Redis=require('ioredis');var config=require(_0xc900('0x4'));var logger=require('../../../config/logger')(_0xc900('0x5'));config[_0xc900('0x6')]=_[_0xc900('0x7')](config[_0xc900('0x6')],{'host':_0xc900('0x8'),'port':0x18eb});var io=require(_0xc900('0x9'))(new Redis(config['redis']));var EmailImap=require(_0xc900('0xa'));var EmailSmtp=require(_0xc900('0xb'));var mailAccount=require(_0xc900('0xc'));var md5Accounts={};function EmailChannel(_0x4984e1){logger[_0xc900('0xd')](_0xc900('0xe'));this['mailAccounts']=_0x4984e1[_0xc900('0xf')];this['imapAccounts']={};this[_0xc900('0x10')]=new EmailSmtp();}EmailChannel[_0xc900('0x11')]['emit']=function(_0x1c3938){var _0x501b9a=this['mailAccounts'][_0x1c3938];var _0x57d41c={'id':_0x501b9a['id'],'name':_0x501b9a[_0xc900('0x12')],'key':_0x501b9a[_0xc900('0x13')],'active':_0x501b9a[_0xc900('0x14')],'Imap':{'status':_0x501b9a[_0xc900('0x15')]['status'],'messageStatus':_0x501b9a[_0xc900('0x15')][_0xc900('0x16')],'total':_0x501b9a[_0xc900('0x15')]['total']}};if(_['isNil'](md5Accounts[_0x1c3938])){md5Accounts[_0x1c3938]={};}var _0x1332c6=md5(JSON[_0xc900('0x17')](_0x57d41c));if(md5Accounts[_0x1c3938]['md5']!==_0x1332c6){md5Accounts[_0x1c3938][_0xc900('0x3')]=_0x1332c6;io[_0xc900('0x18')](_0xc900('0x19'),_0x57d41c);}};EmailChannel[_0xc900('0x11')]['refresh']=function(_0x12459d){for(var _0x208eaa in _0x12459d){if(_0x12459d['hasOwnProperty'](_0x208eaa)){if(_0x12459d[_0x208eaa][_0xc900('0x15')]&&_0x12459d[_0x208eaa][_0xc900('0x14')]){var _0x1a3f82=_0x12459d[_0x208eaa][_0xc900('0x15')];if(!this[_0xc900('0x1a')][_0xc900('0x1b')](_0x1a3f82['id'])){this['imapAccounts'][_0x1a3f82['id']]=new EmailImap(_0x1a3f82,_0x12459d[_0x208eaa]['email']);this['imapAccounts'][_0x1a3f82['id']]['on'](_0xc900('0x1c'),this['handleImapBox'][_0xc900('0x1d')](this,_0x208eaa));this[_0xc900('0x1a')][_0x1a3f82['id']]['on'](_0xc900('0x5'),this['handleImapEmail'][_0xc900('0x1d')](this,_0x208eaa));this[_0xc900('0x1a')][_0x1a3f82['id']]['on'](_0xc900('0x1e'),this[_0xc900('0x1f')]['bind'](this,_0x208eaa));this[_0xc900('0x1a')][_0x1a3f82['id']]['on']('error',this[_0xc900('0x20')][_0xc900('0x1d')](this,_0x208eaa));}}else{if(_[_0xc900('0x21')](this['mailAccounts'][_0x208eaa][_0xc900('0x15')])){this[_0xc900('0xf')][_0x208eaa]['Imap']={};}this[_0xc900('0xf')][_0x208eaa]['Imap'][_0xc900('0x22')]=_0xc900('0x23');this[_0xc900('0xf')][_0x208eaa][_0xc900('0x15')]['messageStatus']='';this[_0xc900('0x18')](_0x208eaa);}}}};EmailChannel['prototype'][_0xc900('0x24')]=function(_0x4f93da,_0x50fbd4){if(this[_0xc900('0xf')][_0x4f93da]){this[_0xc900('0xf')][_0x4f93da]['Imap'][_0xc900('0x22')]=_0xc900('0x25');this[_0xc900('0xf')][_0x4f93da]['Imap'][_0xc900('0x16')]=_0x50fbd4[_0xc900('0x12')];if(_0x50fbd4[_0xc900('0x26')]){this[_0xc900('0xf')][_0x4f93da][_0xc900('0x15')][_0xc900('0x27')]=_0x50fbd4['messages'][_0xc900('0x27')];}return this[_0xc900('0x18')](_0x4f93da);}};EmailChannel[_0xc900('0x11')][_0xc900('0x28')]=function(_0x1c3755,_0x18775b){logger[_0xc900('0xd')](_0xc900('0x29'),_0x18775b['firstName'],_0x18775b[_0xc900('0x2a')],_0x18775b[_0xc900('0x2b')],_0x1c3755);if(this[_0xc900('0xf')][_0x1c3755]){return mailAccount[_0xc900('0x2c')](_0x1c3755,_0x18775b)[_0xc900('0x2d')](function(_0x463e71){if(_0x463e71){logger[_0xc900('0xd')](_0xc900('0x2e'));}})[_0xc900('0x2f')](function(_0x467e74){logger['error'](_0xc900('0x30'),JSON[_0xc900('0x17')](_0x467e74));});}};EmailChannel['prototype'][_0xc900('0x1f')]=function(_0x1502e5){if(this['mailAccounts'][_0x1502e5]&&this['mailAccounts'][_0x1502e5][_0xc900('0x15')]){if(this[_0xc900('0x1a')][this[_0xc900('0xf')][_0x1502e5][_0xc900('0x15')]['id']]){delete this[_0xc900('0x1a')][this[_0xc900('0xf')][_0x1502e5][_0xc900('0x15')]['id']];}this[_0xc900('0xf')][_0x1502e5][_0xc900('0x15')][_0xc900('0x31')]=moment();this['emit'](_0x1502e5);}};EmailChannel[_0xc900('0x11')][_0xc900('0x20')]=function(_0x3b389f,_0x10edd1){if(this[_0xc900('0xf')][_0x3b389f]){this[_0xc900('0xf')][_0x3b389f][_0xc900('0x15')][_0xc900('0x22')]=_0xc900('0x32');this[_0xc900('0xf')][_0x3b389f][_0xc900('0x15')][_0xc900('0x16')]=_0x10edd1;return this[_0xc900('0x18')](_0x3b389f);}};EmailChannel['prototype'][_0xc900('0x33')]=function(_0x1469d0,_0x178c75){return this['smtp'][_0xc900('0x34')](_0x1469d0,_0x178c75);};EmailChannel['prototype'][_0xc900('0x35')]=function(_0x2d7ab7){var _0x31c478=this;if(this[_0xc900('0xf')][_0x2d7ab7['id']]){if(_[_0xc900('0x21')](this[_0xc900('0xf')][_0x2d7ab7['id']][_0xc900('0x36')])){this[_0xc900('0xf')][_0x2d7ab7['id']][_0xc900('0x36')]={};}this[_0xc900('0xf')][_0x2d7ab7['id']]['Smtp'][_0xc900('0x31')]=moment();return new BPromise(function(_0x46ed30,_0x3cfe2c){return _0x31c478[_0xc900('0x10')][_0xc900('0x37')](_0x2d7ab7)['then'](function(_0x126aa9){_0x31c478[_0xc900('0xf')][_0x2d7ab7['id']]['Smtp'][_0xc900('0x22')]=_0xc900('0x38');_0x31c478['mailAccounts'][_0x2d7ab7['id']][_0xc900('0x36')][_0xc900('0x16')]='';_0x31c478['emit'](_0x2d7ab7['id']);_0x46ed30(_0x126aa9);})[_0xc900('0x2f')](function(_0x3da2a7){_0x31c478[_0xc900('0xf')][_0x2d7ab7['id']]['Smtp']['status']=_0xc900('0x32');_0x31c478[_0xc900('0xf')][_0x2d7ab7['id']][_0xc900('0x36')][_0xc900('0x16')]=_0x3da2a7;_0x31c478[_0xc900('0x18')](_0x2d7ab7['id']);_0x3cfe2c(_0x3da2a7);});});}return this[_0xc900('0x10')][_0xc900('0x37')](_0x2d7ab7);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 580fece..55d7606 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 _0x28ad=['isNil','authentication','user','password','port','tls','autotls','host','service','anonymous@xcally.com','openBox','handleOpenBox','handleError','emit','box','handleCloseBox','readUnseen','search','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','account','stringify','textCode','hasOwnProperty','path','util','lodash','mailparser','iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','imap','ready','handleReady','bind','once','end','handleEnd','error','prototype','connTimeout','authTimeout'];(function(_0x3d3bfb,_0x4ee783){var _0x20a781=function(_0x4cd84b){while(--_0x4cd84b){_0x3d3bfb['push'](_0x3d3bfb['shift']());}};_0x20a781(++_0x4ee783);}(_0x28ad,0x99));var _0xd28a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x28ad[_0x14add3];return _0x4a174f;};'use strict';var fs=require('fs');var path=require(_0xd28a('0x0'));var util=require(_0xd28a('0x1'));var Imap=require('imap');var _=require(_0xd28a('0x2'));var rs=require('randomstring');var simpleParser=require(_0xd28a('0x3'))['simpleParser'];var Iconv=require(_0xd28a('0x4'))['Iconv'];var EventEmitter=require(_0xd28a('0x5'))[_0xd28a('0x6')];var utils=require(_0xd28a('0x7'));var logger=require(_0xd28a('0x8'))(_0xd28a('0x9'));function EmailImap(_0x101a07,_0x22a2d8){this[_0xd28a('0xa')]=_0xd28a('0xb');this['account']=this[_0xd28a('0xc')](_0x101a07,_0x22a2d8);this[_0xd28a('0xd')]=new Imap(this['account']);this[_0xd28a('0xd')]['once'](_0xd28a('0xe'),this[_0xd28a('0xf')][_0xd28a('0x10')](this));this['imap'][_0xd28a('0x11')](_0xd28a('0x12'),this[_0xd28a('0x13')][_0xd28a('0x10')](this));this[_0xd28a('0xd')]['on'](_0xd28a('0x14'),this['handleError']['bind'](this));this[_0xd28a('0xd')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xd28a('0x15')][_0xd28a('0xc')]=function(_0x468726,_0xd64b6a){var _0x436045={'connTimeout':_0x468726[_0xd28a('0x16')]?_0x468726['connTimeout']*0x3e8:0x2710,'authTimeout':_0x468726[_0xd28a('0x17')]?_0x468726[_0xd28a('0x17')]*0x3e8:0x1388};if(_[_0xd28a('0x18')](_0x468726['service'])){if(_0x468726[_0xd28a('0x19')]){_0x436045[_0xd28a('0x1a')]=_0x468726[_0xd28a('0x1a')];_0x436045[_0xd28a('0x1b')]=_0x468726[_0xd28a('0x1b')];}_0x436045['host']=_0x468726['host'];_0x436045['port']=_0x468726[_0xd28a('0x1c')]||0x3e1;if(_0x468726[_0xd28a('0x1d')]){_0x436045[_0xd28a('0x1d')]=!![];}else{_0x436045[_0xd28a('0x1d')]=![];_0x436045[_0xd28a('0x1e')]='required';}}else{_0x436045['user']=_0x468726[_0xd28a('0x1a')];_0x436045['password']=_0x468726[_0xd28a('0x1b')];_0x436045[_0xd28a('0x1f')]=utils['getHost'](_0x468726[_0xd28a('0x20')]);_0x436045['port']=0x3e1;_0x436045[_0xd28a('0x1d')]=!![];}_0x436045['email']=_0xd64b6a||_0x468726[_0xd28a('0x1a')]||_0xd28a('0x21');return _0x436045;};EmailImap['prototype'][_0xd28a('0xf')]=function(){this[_0xd28a('0xd')][_0xd28a('0x22')](this[_0xd28a('0xa')],![],this[_0xd28a('0x23')][_0xd28a('0x10')](this));};EmailImap[_0xd28a('0x15')][_0xd28a('0x23')]=function(_0x5e1d67,_0x151282){if(_0x5e1d67){this[_0xd28a('0x24')](_0x5e1d67,!![]);}else{this[_0xd28a('0x25')](_0xd28a('0x26'),_0x151282);this['readUnseen']();}};EmailImap['prototype'][_0xd28a('0x27')]=function(_0x302d43){if(_0x302d43){this[_0xd28a('0x24')](_0x302d43,!![]);}else{this['imap'][_0xd28a('0x12')]();}};EmailImap[_0xd28a('0x15')][_0xd28a('0x28')]=function(){this[_0xd28a('0xd')][_0xd28a('0x29')](['UNSEEN'],this[_0xd28a('0x2a')][_0xd28a('0x10')](this));};EmailImap[_0xd28a('0x15')][_0xd28a('0x2a')]=function(_0x4828de,_0x22bf3e){if(_0x4828de){this[_0xd28a('0x24')](_0x4828de,!![]);}else{if(_0x22bf3e[_0xd28a('0x2b')]){try{var _0x5a809d=this[_0xd28a('0xd')][_0xd28a('0x2c')](_0x22bf3e,{'bodies':'','markSeen':!![]});_0x5a809d['on']('message',this[_0xd28a('0x2d')][_0xd28a('0x10')](this));_0x5a809d['once'](_0xd28a('0x14'),this['handleFetchError'][_0xd28a('0x10')](this));_0x5a809d[_0xd28a('0x11')]('end',this[_0xd28a('0x2e')]['bind'](this));}catch(_0x2a2a28){logger[_0xd28a('0x14')](_0x2a2a28);}}else{this['imap'][_0xd28a('0x2f')](!![],this[_0xd28a('0x27')]['bind'](this));}}};EmailImap[_0xd28a('0x15')][_0xd28a('0x2d')]=function(_0x4acfd3,_0x8eff49){_0x4acfd3['on'](_0xd28a('0x30'),this[_0xd28a('0x31')][_0xd28a('0x10')](this));_0x4acfd3[_0xd28a('0x11')](_0xd28a('0x32'),this[_0xd28a('0x33')]['bind'](this));_0x4acfd3['once'](_0xd28a('0x12'),this[_0xd28a('0x34')][_0xd28a('0x10')](this));};EmailImap[_0xd28a('0x15')][_0xd28a('0x31')]=function(_0x3702c9,_0x1d2ca4){simpleParser(_0x3702c9,{'Iconv':Iconv},this[_0xd28a('0x35')]['bind'](this));};EmailImap[_0xd28a('0x15')][_0xd28a('0x33')]=function(_0x3bb98d){};EmailImap[_0xd28a('0x15')][_0xd28a('0x34')]=function(){};EmailImap[_0xd28a('0x15')][_0xd28a('0x35')]=function(_0xb66914,_0x67a594){if(_0xb66914){logger[_0xd28a('0x14')](_0xb66914);}else{var _0x510b0f=this;utils[_0xd28a('0x36')](this[_0xd28a('0x37')],_0x67a594,function(_0x5ada9b){_0x510b0f[_0xd28a('0x25')](_0xd28a('0x9'),_0x5ada9b);});}};EmailImap[_0xd28a('0x15')][_0xd28a('0x2e')]=function(){this[_0xd28a('0xd')][_0xd28a('0x2f')](!![],this[_0xd28a('0x27')][_0xd28a('0x10')](this));};EmailImap[_0xd28a('0x15')]['handleFetchError']=function(_0x40f85b){this['handleError'](_0x40f85b);this[_0xd28a('0xd')][_0xd28a('0x2f')](!![],this[_0xd28a('0x27')]['bind'](this));};EmailImap[_0xd28a('0x15')][_0xd28a('0x13')]=function(){this[_0xd28a('0x25')](_0xd28a('0x12'));};EmailImap['prototype'][_0xd28a('0x24')]=function(_0x3de1c3,_0x2b99a7){logger['error'](_0xd28a('0x24'),this[_0xd28a('0x37')][_0xd28a('0x9')],JSON[_0xd28a('0x38')](_0x3de1c3));var _0x10e18c='';if(_0x3de1c3){if(_0x3de1c3[_0xd28a('0x39')]){_0x10e18c=_0x3de1c3['textCode'];}else{for(var _0x30f5fd in _0x3de1c3){if(_0x3de1c3[_0xd28a('0x3a')](_0x30f5fd)){_0x10e18c+=_['upperFirst'](_0x30f5fd)+':\x20'+_0x3de1c3[_0x30f5fd]+'\x0a';}}}}if(_0x2b99a7){this[_0xd28a('0xd')][_0xd28a('0x12')]();}else{this['emit'](_0xd28a('0x14'),_0x10e18c);this[_0xd28a('0x25')]('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0xd8ad=['prototype','connTimeout','isNil','authentication','user','password','host','port','tls','autotls','required','getHost','service','email','anonymous@xcally.com','openBox','emit','readUnseen','end','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','lodash','randomstring','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','mailbox','INBOX','account','getAccount','imap','once','ready','handleReady','bind','handleError','connect'];(function(_0x315ba1,_0x29ded4){var _0x320402=function(_0x265e78){while(--_0x265e78){_0x315ba1['push'](_0x315ba1['shift']());}};_0x320402(++_0x29ded4);}(_0xd8ad,0xe7));var _0xdd8a=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0xd8ad[_0x5466ab];return _0x40751a;};'use strict';var fs=require('fs');var path=require(_0xdd8a('0x0'));var util=require(_0xdd8a('0x1'));var Imap=require('imap');var _=require(_0xdd8a('0x2'));var rs=require(_0xdd8a('0x3'));var simpleParser=require(_0xdd8a('0x4'))[_0xdd8a('0x5')];var Iconv=require('iconv')[_0xdd8a('0x6')];var EventEmitter=require(_0xdd8a('0x7'))[_0xdd8a('0x8')];var utils=require(_0xdd8a('0x9'));var logger=require('../../../config/logger')('email');function EmailImap(_0x2f5637,_0x38ca68){this[_0xdd8a('0xa')]=_0xdd8a('0xb');this[_0xdd8a('0xc')]=this[_0xdd8a('0xd')](_0x2f5637,_0x38ca68);this[_0xdd8a('0xe')]=new Imap(this[_0xdd8a('0xc')]);this[_0xdd8a('0xe')][_0xdd8a('0xf')](_0xdd8a('0x10'),this[_0xdd8a('0x11')][_0xdd8a('0x12')](this));this[_0xdd8a('0xe')]['once']('end',this['handleEnd'][_0xdd8a('0x12')](this));this[_0xdd8a('0xe')]['on']('error',this[_0xdd8a('0x13')][_0xdd8a('0x12')](this));this[_0xdd8a('0xe')][_0xdd8a('0x14')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xdd8a('0x15')][_0xdd8a('0xd')]=function(_0x548d96,_0x14b57c){var _0x4d0681={'connTimeout':_0x548d96[_0xdd8a('0x16')]?_0x548d96[_0xdd8a('0x16')]*0x3e8:0x2710,'authTimeout':_0x548d96['authTimeout']?_0x548d96['authTimeout']*0x3e8:0x1388};if(_[_0xdd8a('0x17')](_0x548d96['service'])){if(_0x548d96[_0xdd8a('0x18')]){_0x4d0681[_0xdd8a('0x19')]=_0x548d96[_0xdd8a('0x19')];_0x4d0681[_0xdd8a('0x1a')]=_0x548d96['password'];}_0x4d0681['host']=_0x548d96[_0xdd8a('0x1b')];_0x4d0681[_0xdd8a('0x1c')]=_0x548d96[_0xdd8a('0x1c')]||0x3e1;if(_0x548d96['tls']){_0x4d0681[_0xdd8a('0x1d')]=!![];}else{_0x4d0681['tls']=![];_0x4d0681[_0xdd8a('0x1e')]=_0xdd8a('0x1f');}}else{_0x4d0681['user']=_0x548d96[_0xdd8a('0x19')];_0x4d0681[_0xdd8a('0x1a')]=_0x548d96[_0xdd8a('0x1a')];_0x4d0681['host']=utils[_0xdd8a('0x20')](_0x548d96[_0xdd8a('0x21')]);_0x4d0681[_0xdd8a('0x1c')]=0x3e1;_0x4d0681[_0xdd8a('0x1d')]=!![];}_0x4d0681[_0xdd8a('0x22')]=_0x14b57c||_0x548d96[_0xdd8a('0x19')]||_0xdd8a('0x23');return _0x4d0681;};EmailImap[_0xdd8a('0x15')][_0xdd8a('0x11')]=function(){this[_0xdd8a('0xe')][_0xdd8a('0x24')](this['mailbox'],![],this['handleOpenBox']['bind'](this));};EmailImap['prototype']['handleOpenBox']=function(_0x279cbf,_0x405a92){if(_0x279cbf){this['handleError'](_0x279cbf,!![]);}else{this[_0xdd8a('0x25')]('box',_0x405a92);this[_0xdd8a('0x26')]();}};EmailImap[_0xdd8a('0x15')]['handleCloseBox']=function(_0x285262){if(_0x285262){this[_0xdd8a('0x13')](_0x285262,!![]);}else{this[_0xdd8a('0xe')][_0xdd8a('0x27')]();}};EmailImap[_0xdd8a('0x15')]['readUnseen']=function(){this[_0xdd8a('0xe')]['search']([_0xdd8a('0x28')],this['handleReadUnseen'][_0xdd8a('0x12')](this));};EmailImap[_0xdd8a('0x15')][_0xdd8a('0x29')]=function(_0x3030fa,_0x5f2b86){if(_0x3030fa){this[_0xdd8a('0x13')](_0x3030fa,!![]);}else{if(_0x5f2b86[_0xdd8a('0x2a')]){try{var _0x1553bf=this['imap'][_0xdd8a('0x2b')](_0x5f2b86,{'bodies':'','markSeen':!![]});_0x1553bf['on'](_0xdd8a('0x2c'),this[_0xdd8a('0x2d')]['bind'](this));_0x1553bf[_0xdd8a('0xf')](_0xdd8a('0x2e'),this[_0xdd8a('0x2f')][_0xdd8a('0x12')](this));_0x1553bf[_0xdd8a('0xf')](_0xdd8a('0x27'),this[_0xdd8a('0x30')][_0xdd8a('0x12')](this));}catch(_0x33219c){logger[_0xdd8a('0x2e')](_0x33219c);}}else{this[_0xdd8a('0xe')][_0xdd8a('0x31')](!![],this[_0xdd8a('0x32')]['bind'](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x4e46a8,_0x524027){_0x4e46a8['on'](_0xdd8a('0x33'),this[_0xdd8a('0x34')]['bind'](this));_0x4e46a8['once'](_0xdd8a('0x35'),this[_0xdd8a('0x36')][_0xdd8a('0x12')](this));_0x4e46a8[_0xdd8a('0xf')](_0xdd8a('0x27'),this[_0xdd8a('0x37')][_0xdd8a('0x12')](this));};EmailImap[_0xdd8a('0x15')][_0xdd8a('0x34')]=function(_0xf01e4b,_0x168937){simpleParser(_0xf01e4b,{'Iconv':Iconv},this[_0xdd8a('0x38')][_0xdd8a('0x12')](this));};EmailImap[_0xdd8a('0x15')][_0xdd8a('0x36')]=function(_0x117445){};EmailImap[_0xdd8a('0x15')][_0xdd8a('0x37')]=function(){};EmailImap[_0xdd8a('0x15')][_0xdd8a('0x38')]=function(_0x1f7aeb,_0x5d31a4){if(_0x1f7aeb){logger[_0xdd8a('0x2e')](_0x1f7aeb);}else{var _0x3850a6=this;utils[_0xdd8a('0x39')](this[_0xdd8a('0xc')],_0x5d31a4,function(_0x9382e2){_0x3850a6[_0xdd8a('0x25')](_0xdd8a('0x22'),_0x9382e2);});}};EmailImap[_0xdd8a('0x15')][_0xdd8a('0x30')]=function(){this['imap'][_0xdd8a('0x31')](!![],this[_0xdd8a('0x32')][_0xdd8a('0x12')](this));};EmailImap[_0xdd8a('0x15')][_0xdd8a('0x2f')]=function(_0x1fde4e){this[_0xdd8a('0x13')](_0x1fde4e);this['imap'][_0xdd8a('0x31')](!![],this[_0xdd8a('0x32')]['bind'](this));};EmailImap[_0xdd8a('0x15')]['handleEnd']=function(){this[_0xdd8a('0x25')]('end');};EmailImap[_0xdd8a('0x15')]['handleError']=function(_0xb514dc,_0x24be3a){logger[_0xdd8a('0x2e')](_0xdd8a('0x13'),this[_0xdd8a('0xc')][_0xdd8a('0x22')],JSON[_0xdd8a('0x3a')](_0xb514dc));var _0x1a8174='';if(_0xb514dc){if(_0xb514dc[_0xdd8a('0x3b')]){_0x1a8174=_0xb514dc[_0xdd8a('0x3b')];}else{for(var _0xde74d3 in _0xb514dc){if(_0xb514dc[_0xdd8a('0x3c')](_0xde74d3)){_0x1a8174+=_[_0xdd8a('0x3d')](_0xde74d3)+':\x20'+_0xb514dc[_0xde74d3]+'\x0a';}}}}if(_0x24be3a){this['imap'][_0xdd8a('0x27')]();}else{this['emit']('error',_0x1a8174);this[_0xdd8a('0x25')](_0xdd8a('0x27'));}};module[_0xdd8a('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 586b117..28d1dbd 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 _0x8940=['sendMail','toString','verify','Not\x20verifired','bluebird','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile'];(function(_0x187124,_0x2e5520){var _0x34608f=function(_0x53168e){while(--_0x53168e){_0x187124['push'](_0x187124['shift']());}};_0x34608f(++_0x2e5520);}(_0x8940,0x14e));var _0x0894=function(_0x68d299,_0x39f2a5){_0x68d299=_0x68d299-0x0;var _0x512b25=_0x8940[_0x68d299];return _0x512b25;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x0894('0x0'));var inlineBase64=require(_0x0894('0x1'));function EmailSmtp(){}EmailSmtp[_0x0894('0x2')]['send']=function(_0x1f5ebe,_0x9ed6c8){return new BPromise(function(_0x3b01ee,_0x4a62aa){var _0x559948=nodemailer[_0x0894('0x3')](_0x1f5ebe);_0x559948[_0x0894('0x4')](_0x0894('0x5'),inlineBase64());_0x559948[_0x0894('0x6')](_0x9ed6c8,function(_0xcf518b,_0x50907d){if(_0xcf518b){_0x4a62aa(_0xcf518b[_0x0894('0x7')]());}else{_0x3b01ee(_0x50907d);}});});};EmailSmtp[_0x0894('0x2')][_0x0894('0x8')]=function(_0xa10e71){return new BPromise(function(_0x1911ef,_0x1a439e){var _0x7edaed=nodemailer[_0x0894('0x3')](_0xa10e71);_0x7edaed[_0x0894('0x8')](function(_0x3f47b4,_0x3f6abd){if(_0x3f47b4){_0x1a439e(_0x3f47b4[_0x0894('0x7')]());}else{if(_0x3f6abd){_0x1911ef(_0x3f6abd);}else{_0x1a439e(_0x0894('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x68bb=['createTransport','use','compile','sendMail','toString','verify','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x68bb,0xf7));var _0xb68b=function(_0x2c54ab,_0x2a643f){_0x2c54ab=_0x2c54ab-0x0;var _0xc7e9a2=_0x68bb[_0x2c54ab];return _0xc7e9a2;};'use strict';var nodemailer=require(_0xb68b('0x0'));var BPromise=require(_0xb68b('0x1'));var inlineBase64=require(_0xb68b('0x2'));function EmailSmtp(){}EmailSmtp[_0xb68b('0x3')][_0xb68b('0x4')]=function(_0x36f64c,_0x52567f){return new BPromise(function(_0xcd6981,_0x381207){var _0x2af53f=nodemailer[_0xb68b('0x5')](_0x36f64c);_0x2af53f[_0xb68b('0x6')](_0xb68b('0x7'),inlineBase64());_0x2af53f[_0xb68b('0x8')](_0x52567f,function(_0x55a4e4,_0x54424d){if(_0x55a4e4){_0x381207(_0x55a4e4[_0xb68b('0x9')]());}else{_0xcd6981(_0x54424d);}});});};EmailSmtp['prototype'][_0xb68b('0xa')]=function(_0x14f33d){return new BPromise(function(_0x1fbc9b,_0x5f48c3){var _0xe9a9f0=nodemailer[_0xb68b('0x5')](_0x14f33d);_0xe9a9f0[_0xb68b('0xa')](function(_0x5cdcdc,_0x10a0ae){if(_0x5cdcdc){_0x5f48c3(_0x5cdcdc['toString']());}else{if(_0x10a0ae){_0x1fbc9b(_0x10a0ae);}else{_0x5f48c3('Not\x20verifired');}}});});};module[_0xb68b('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 5db01fe..2f19b8a 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 _0xb346=['includes','bcc','attachments','length','attachment','attachment-','format','now','root','writeFileSync','content','push','contentType','parser','from','subject','messageId','inReplyTo','date','textAsHtml','application/ms-tnef','info','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash','randomstring','path','util','node-tnef','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','split','join','Anonymous','pop','isEmpty','html','test','body','replace','message','originTo','originCc'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0xb346,0x154));var _0x6b34=function(_0x434980,_0x30e686){_0x434980=_0x434980-0x0;var _0xfba91=_0xb346[_0x434980];return _0xfba91;};'use strict';var _=require(_0x6b34('0x0'));var moment=require('moment');var random=require(_0x6b34('0x1'));var fs=require('fs');var path=require(_0x6b34('0x2'));var util=require(_0x6b34('0x3'));var tnef=require(_0x6b34('0x4'));var logger=require('../../../config/logger')(_0x6b34('0x5'));var config=require(_0x6b34('0x6'));function getAddress(_0x416a6c){var _0x15b82b=_['head'](_0x416a6c[_0x6b34('0x7')]);return _0x15b82b&&_0x15b82b[_0x6b34('0x8')]?_0x15b82b[_0x6b34('0x8')]:_0x6b34('0x9')+random[_0x6b34('0xa')](0x6)+_0x6b34('0xb');}function getFirstName(_0x24a8cf){var _0x5075fe=_[_0x6b34('0xc')](_0x24a8cf[_0x6b34('0x7')]);if(_0x5075fe&&_0x5075fe[_0x6b34('0xd')]){var _0x3a8f75=_0x5075fe['name'][_0x6b34('0xe')](/\s+/);return _0x3a8f75['length']?_0x3a8f75['slice'](0x0,-0x1)[_0x6b34('0xf')]('\x20'):_0x5075fe[_0x6b34('0xd')];}return _0x6b34('0x10');}function getLastName(_0x537041){var _0x135dfd=_[_0x6b34('0xc')](_0x537041[_0x6b34('0x7')]);if(_0x135dfd&&_0x135dfd[_0x6b34('0xd')]){var _0x2122e8=_0x135dfd['name'][_0x6b34('0xe')](/\s+/);return _0x2122e8['length']>0x1?_0x2122e8[_0x6b34('0x11')]():'';}return'';}function getMails(_0x1e1b3c,_0x435e7b){var _0x4744c6='';for(var _0x1b7ccd=0x0;_0x1b7ccd<_0x435e7b[_0x6b34('0x7')]['length'];_0x1b7ccd+=0x1){if(_0x435e7b[_0x6b34('0x7')][_0x1b7ccd][_0x6b34('0x8')]!==_0x1e1b3c){if(!_[_0x6b34('0x12')](_0x4744c6)){_0x4744c6+=',';}_0x4744c6+=_0x435e7b[_0x6b34('0x7')][_0x1b7ccd][_0x6b34('0xd')]||_0x435e7b[_0x6b34('0x7')][_0x1b7ccd][_0x6b34('0x8')]||'';_0x4744c6+='\x20<';_0x4744c6+=_0x435e7b[_0x6b34('0x7')][_0x1b7ccd][_0x6b34('0x8')]?_0x435e7b[_0x6b34('0x7')][_0x1b7ccd][_0x6b34('0x8')]:'anonymous'+random[_0x6b34('0xa')](0x6)+_0x6b34('0xb');_0x4744c6+='>';}}return _0x4744c6;}function parseEmail(_0x2a374b,_0x1c9dcc,_0x2e8cea){if(_0x1c9dcc[_0x6b34('0x13')]){var _0x2c3656=/)<[^<]*)*<\/script>/gi;while(_0x2c3656[_0x6b34('0x14')](_0x1c9dcc['html'])){_0x1c9dcc['html']=_0x1c9dcc[_0x6b34('0x13')]['replace'](_0x2c3656,'');}_0x2e8cea[_0x6b34('0x15')]=_0x1c9dcc[_0x6b34('0x13')];}else{_0x2e8cea['body']=_0x1c9dcc['textAsHtml'];}if(_0x2e8cea[_0x6b34('0x15')]){_0x2e8cea[_0x6b34('0x15')]=_0x2e8cea[_0x6b34('0x15')][_0x6b34('0x16')](/Empty\x20message

','Attachments','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','anonymous','@xcally.com','name','split','slice','Anonymous','length','pop'];(function(_0x1ed1cc,_0x1dcf94){var _0x249445=function(_0x8a942a){while(--_0x8a942a){_0x1ed1cc['push'](_0x1ed1cc['shift']());}};_0x249445(++_0x1dcf94);}(_0x0f42,0x176));var _0x20f4=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x0f42[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var moment=require('moment');var random=require('randomstring');var fs=require('fs');var path=require(_0x20f4('0x0'));var util=require(_0x20f4('0x1'));var tnef=require(_0x20f4('0x2'));var logger=require(_0x20f4('0x3'))('email');var config=require(_0x20f4('0x4'));function getAddress(_0x19c45f){var _0x4428fb=_[_0x20f4('0x5')](_0x19c45f[_0x20f4('0x6')]);return _0x4428fb&&_0x4428fb[_0x20f4('0x7')]?_0x4428fb[_0x20f4('0x7')]:_0x20f4('0x8')+random['generate'](0x6)+_0x20f4('0x9');}function getFirstName(_0x5ae0ef){var _0x979543=_['head'](_0x5ae0ef[_0x20f4('0x6')]);if(_0x979543&&_0x979543[_0x20f4('0xa')]){var _0x11dfe4=_0x979543[_0x20f4('0xa')][_0x20f4('0xb')](/\s+/);return _0x11dfe4['length']?_0x11dfe4[_0x20f4('0xc')](0x0,-0x1)['join']('\x20'):_0x979543[_0x20f4('0xa')];}return _0x20f4('0xd');}function getLastName(_0x242d2a){var _0x363c66=_['head'](_0x242d2a['value']);if(_0x363c66&&_0x363c66[_0x20f4('0xa')]){var _0x5e91df=_0x363c66[_0x20f4('0xa')][_0x20f4('0xb')](/\s+/);return _0x5e91df[_0x20f4('0xe')]>0x1?_0x5e91df[_0x20f4('0xf')]():'';}return'';}function getMails(_0x30d9ab,_0x5a19ab){var _0x983203='';for(var _0x4dcc25=0x0;_0x4dcc25<_0x5a19ab[_0x20f4('0x6')]['length'];_0x4dcc25+=0x1){if(_0x5a19ab['value'][_0x4dcc25][_0x20f4('0x7')]!==_0x30d9ab){if(!_['isEmpty'](_0x983203)){_0x983203+=',';}_0x983203+=_0x5a19ab[_0x20f4('0x6')][_0x4dcc25]['name']||_0x5a19ab['value'][_0x4dcc25][_0x20f4('0x7')]||'';_0x983203+='\x20<';_0x983203+=_0x5a19ab[_0x20f4('0x6')][_0x4dcc25]['address']?_0x5a19ab['value'][_0x4dcc25]['address']:_0x20f4('0x8')+random[_0x20f4('0x10')](0x6)+'@xcally.com';_0x983203+='>';}}return _0x983203;}function parseEmail(_0x4a4f10,_0x2c4646,_0x1f4123){if(_0x2c4646[_0x20f4('0x11')]){var _0x258c46=/)<[^<]*)*<\/script>/gi;while(_0x258c46['test'](_0x2c4646['html'])){_0x2c4646[_0x20f4('0x11')]=_0x2c4646['html'][_0x20f4('0x12')](_0x258c46,'');}_0x1f4123[_0x20f4('0x13')]=_0x2c4646[_0x20f4('0x11')];}else{_0x1f4123[_0x20f4('0x13')]=_0x2c4646[_0x20f4('0x14')];}if(_0x1f4123[_0x20f4('0x13')]){_0x1f4123[_0x20f4('0x13')]=_0x1f4123[_0x20f4('0x13')]['replace'](/0x0){if(this[_0x34d189+_0xaf3a('0x27')]>0x0&&this[_0x34d189+'CurrentCapacity']>=this[_0x34d189+'Capacity']){return _0xaf3a('0x28');}else{return _0xaf3a('0x29');}}else{return _0xaf3a('0x2a');}};Agent['prototype'][_0xaf3a('0x23')]=function(){var _0x1610e6=['mail',_0xaf3a('0x2b'),_0xaf3a('0x2c'),_0xaf3a('0x2d'),_0xaf3a('0x2e'),_0xaf3a('0x2f')];for(var _0x409a27=0x0;_0x409a27<_0x1610e6[_0xaf3a('0x30')];_0x409a27+=0x1){var _0x2a895d=this['getChannelStatus'](_0x1610e6[_0x409a27]);if(this[_0x1610e6[_0x409a27]+'Status']!==_0x2a895d){this[_0x1610e6[_0x409a27]+'StatusTime']=_[_0xaf3a('0x31')](moment()['format']('x'));}this[_0x1610e6[_0x409a27]+_0xaf3a('0x32')]=_0x2a895d;}var _0x2c703f={'id':this['id'],'name':this[_0xaf3a('0x7')],'online':this[_0xaf3a('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0xaf3a('0x9')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0xaf3a('0xb')],'openchannelPause':this[_0xaf3a('0xd')],'chatStatus':this[_0xaf3a('0x33')],'chatStatusTime':this[_0xaf3a('0xf')],'chatCapacity':this[_0xaf3a('0x10')],'chatCurrentCapacity':this[_0xaf3a('0x11')],'mailStatus':this[_0xaf3a('0x12')],'mailStatusTime':this[_0xaf3a('0x13')],'mailCapacity':this[_0xaf3a('0x14')],'mailCurrentCapacity':this[_0xaf3a('0x15')],'faxStatus':this[_0xaf3a('0x34')],'faxStatusTime':this[_0xaf3a('0x16')],'faxCapacity':this[_0xaf3a('0x17')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xaf3a('0x19')],'smsStatusTime':this[_0xaf3a('0x1a')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xaf3a('0x1c')],'whatsappStatus':this[_0xaf3a('0x35')],'whatsappStatusTime':this[_0xaf3a('0x1d')],'whatsappCapacity':this[_0xaf3a('0x36')],'whatsappCurrentCapacity':this[_0xaf3a('0x1e')],'openchannelStatus':this[_0xaf3a('0x37')],'openchannelStatusTime':this[_0xaf3a('0x1f')],'openchannelCapacity':this[_0xaf3a('0x20')],'openchannelCurrentCapacity':this[_0xaf3a('0x21')],'busy':this[_0xaf3a('0x38')],'busyQueue':this['busyQueue']};var _0x21dda7=md5(JSON[_0xaf3a('0x39')](_0x2c703f));if(this[_0xaf3a('0x2')]!==_0x21dda7){this[_0xaf3a('0x2')]=_0x21dda7;io[_0xaf3a('0x3a')](_0xaf3a('0x3b'),_0x2c703f);}};module[_0xaf3a('0x3c')]=Agent; \ No newline at end of file +var _0xf6ed=['Status','StatusTime','format','chatStatusTime','chatCurrentCapacity','faxStatus','faxStatusTime','whatsappStatus','whatsappCapacity','openchannelStatusTime','stringify','emit','user:save','exports','lodash','md5','ioredis','../../../config/environment','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','prototype','getChannelStatus','Capacity','maxcapacity','idle','updateRealtime','openchannel','sms','whatsapp','length'];(function(_0x50d0e2,_0x2f7b56){var _0x516f3b=function(_0x3658cc){while(--_0x3658cc){_0x50d0e2['push'](_0x50d0e2['shift']());}};_0x516f3b(++_0x2f7b56);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x4ffc32,_0x2a465a){_0x4ffc32=_0x4ffc32-0x0;var _0x550717=_0xf6ed[_0x4ffc32];return _0x550717;};'use strict';var _=require(_0xdf6e('0x0'));var moment=require('moment');var md5=require(_0xdf6e('0x1'));var Redis=require(_0xdf6e('0x2'));var config=require(_0xdf6e('0x3'));config['redis']=_['defaults'](config[_0xdf6e('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdf6e('0x4')]));function Agent(_0x5be8b9){this['id']=_0x5be8b9['id']||0x0;this[_0xdf6e('0x5')]=_0x5be8b9['name']||'';this[_0xdf6e('0x6')]=_0x5be8b9[_0xdf6e('0x6')]||!![];this[_0xdf6e('0x7')]=_0x5be8b9[_0xdf6e('0x7')]||![];this['chatPause']=_0x5be8b9[_0xdf6e('0x8')]||![];this[_0xdf6e('0x9')]=_0x5be8b9[_0xdf6e('0x9')]||![];this[_0xdf6e('0xa')]=_0x5be8b9[_0xdf6e('0xa')]||![];this['smsPause']=_0x5be8b9[_0xdf6e('0xb')]||![];this['openchannelPause']=_0x5be8b9[_0xdf6e('0xc')]||![];this['chatStatus']=_0xdf6e('0xd');this['chatStatusTime']=0x0;this[_0xdf6e('0xe')]=_0x5be8b9[_0xdf6e('0xe')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xdf6e('0xf')]=_0xdf6e('0xd');this[_0xdf6e('0x10')]=0x0;this[_0xdf6e('0x11')]=_0x5be8b9[_0xdf6e('0x11')]||0x0;this[_0xdf6e('0x12')]=0x0;this['faxStatus']=_0xdf6e('0xd');this['faxStatusTime']=0x0;this[_0xdf6e('0x13')]=_0x5be8b9[_0xdf6e('0x13')]||0x0;this[_0xdf6e('0x14')]=0x0;this[_0xdf6e('0x15')]=_0xdf6e('0xd');this[_0xdf6e('0x16')]=0x0;this[_0xdf6e('0x17')]=_0x5be8b9['smsCapacity']||0x0;this[_0xdf6e('0x18')]=0x0;this['whatsappStatus']=_0xdf6e('0xd');this[_0xdf6e('0x19')]=0x0;this['whatsappCapacity']=_0x5be8b9['whatsappCapacity']||0x0;this[_0xdf6e('0x1a')]=0x0;this[_0xdf6e('0x1b')]=_0xdf6e('0xd');this['openchannelStatusTime']=0x0;this[_0xdf6e('0x1c')]=_0x5be8b9[_0xdf6e('0x1c')]||0x0;this[_0xdf6e('0x1d')]=0x0;this[_0xdf6e('0x1e')]=![];this[_0xdf6e('0x1f')]=undefined;this[_0xdf6e('0x1')]='';this['updateRealtime']();}Agent[_0xdf6e('0x20')][_0xdf6e('0x21')]=function(_0x28957d){if(this[_0x28957d+'CurrentCapacity']>0x0){if(this[_0x28957d+_0xdf6e('0x22')]>0x0&&this[_0x28957d+'CurrentCapacity']>=this[_0x28957d+_0xdf6e('0x22')]){return _0xdf6e('0x23');}else{return'working';}}else{return _0xdf6e('0x24');}};Agent[_0xdf6e('0x20')][_0xdf6e('0x25')]=function(){var _0x44caed=['mail','chat',_0xdf6e('0x26'),'fax',_0xdf6e('0x27'),_0xdf6e('0x28')];for(var _0x70ef58=0x0;_0x70ef58<_0x44caed[_0xdf6e('0x29')];_0x70ef58+=0x1){var _0x5d4897=this[_0xdf6e('0x21')](_0x44caed[_0x70ef58]);if(this[_0x44caed[_0x70ef58]+_0xdf6e('0x2a')]!==_0x5d4897){this[_0x44caed[_0x70ef58]+_0xdf6e('0x2b')]=_['toNumber'](moment()[_0xdf6e('0x2c')]('x'));}this[_0x44caed[_0x70ef58]+_0xdf6e('0x2a')]=_0x5d4897;}var _0x2d198d={'id':this['id'],'name':this[_0xdf6e('0x5')],'online':this['online'],'voicePause':this[_0xdf6e('0x7')],'chatPause':this[_0xdf6e('0x8')],'mailPause':this['mailPause'],'smsPause':this[_0xdf6e('0xb')],'faxPause':this['faxPause'],'openchannelPause':this[_0xdf6e('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xdf6e('0x2d')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xdf6e('0x2e')],'mailStatus':this[_0xdf6e('0xf')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xdf6e('0x11')],'mailCurrentCapacity':this[_0xdf6e('0x12')],'faxStatus':this[_0xdf6e('0x2f')],'faxStatusTime':this[_0xdf6e('0x30')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xdf6e('0x14')],'smsStatus':this[_0xdf6e('0x15')],'smsStatusTime':this[_0xdf6e('0x16')],'smsCapacity':this[_0xdf6e('0x17')],'smsCurrentCapacity':this[_0xdf6e('0x18')],'whatsappStatus':this[_0xdf6e('0x31')],'whatsappStatusTime':this[_0xdf6e('0x19')],'whatsappCapacity':this[_0xdf6e('0x32')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xdf6e('0x33')],'openchannelCapacity':this[_0xdf6e('0x1c')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0xdf6e('0x1f')]};var _0x4038e5=md5(JSON[_0xdf6e('0x34')](_0x2d198d));if(this[_0xdf6e('0x1')]!==_0x4038e5){this[_0xdf6e('0x1')]=_0x4038e5;io[_0xdf6e('0x35')](_0xdf6e('0x36'),_0x2d198d);}};module[_0xdf6e('0x37')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 6ce0f19..98557a6 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 _0x76ae=['emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','chatPause','available','format','chat:queue:%s','name'];(function(_0x74a9ea,_0x22132f){var _0x353b38=function(_0x5a5324){while(--_0x5a5324){_0x74a9ea['push'](_0x74a9ea['shift']());}};_0x353b38(++_0x22132f);}(_0x76ae,0x1cd));var _0xe76a=function(_0x4a12a,_0x513a06){_0x4a12a=_0x4a12a-0x0;var _0x88174c=_0x76ae[_0x4a12a];return _0x88174c;};'use strict';var _=require(_0xe76a('0x0'));var md5=require(_0xe76a('0x1'));var util=require(_0xe76a('0x2'));var Redis=require(_0xe76a('0x3'));var config=require(_0xe76a('0x4'));config[_0xe76a('0x5')]=_[_0xe76a('0x6')](config[_0xe76a('0x5')],{'host':_0xe76a('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x5c6ff2){this['id']=_0x5c6ff2['id']||0x0;this['name']=_0x5c6ff2['name']||'';this[_0xe76a('0x8')]=_0x5c6ff2[_0xe76a('0x8')]||0xa;this['strategy']=_0x5c6ff2[_0xe76a('0x9')]||'beepall';this[_0xe76a('0xa')]=_0x5c6ff2[_0xe76a('0xa')];this[_0xe76a('0xb')]={};this[_0xe76a('0xc')]=0x0;this[_0xe76a('0x1')]='';this[_0xe76a('0xd')]();this[_0xe76a('0xe')]();}ChatQueue['prototype'][_0xe76a('0xd')]=function(){var _0x27603c=this['mapAgentsId'][_0xe76a('0xf')];this[_0xe76a('0xb')]=_[_0xe76a('0x10')](this['Agents'],'id');this[_0xe76a('0xb')]['_rr']=_0x27603c;};ChatQueue['prototype']['updateRealtime']=function(){this[_0xe76a('0x11')]=0x0;this[_0xe76a('0x12')]=0x0;for(var _0x56b05d=0x0;_0x56b05d=0x0?this['available']:0x0;var _0xe4b81={'id':this['id'],'available':this[_0xe76a('0x15')],'loggedIn':this[_0xe76a('0x11')],'name':this['name'],'paused':this[_0xe76a('0x12')],'waiting':this['waiting']};var _0xd734f5=md5(JSON['stringify'](_0xe4b81));if(this[_0xe76a('0x1')]!==_0xd734f5){this[_0xe76a('0x1')]=_0xd734f5;io['to'](util[_0xe76a('0x16')](_0xe76a('0x17'),_0xe4b81[_0xe76a('0x18')]))[_0xe76a('0x19')]('chat_queue:save',_0xe4b81);}};module[_0xe76a('0x1a')]=ChatQueue; \ No newline at end of file +var _0xc7ec=['mapAgentsId','_rr','map','prototype','loggedIn','paused','length','online','chatPause','available','stringify','format','emit','lodash','md5','ioredis','../../../config/environment','defaults','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime'];(function(_0x18dd9c,_0x432c49){var _0x363c21=function(_0x9b4fb7){while(--_0x9b4fb7){_0x18dd9c['push'](_0x18dd9c['shift']());}};_0x363c21(++_0x432c49);}(_0xc7ec,0x141));var _0xcc7e=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0xc7ec[_0x1c34e7];return _0x378cb1;};'use strict';var _=require(_0xcc7e('0x0'));var md5=require(_0xcc7e('0x1'));var util=require('util');var Redis=require(_0xcc7e('0x2'));var config=require(_0xcc7e('0x3'));config['redis']=_[_0xcc7e('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xcc7e('0x5'))(new Redis(config[_0xcc7e('0x6')]));function ChatQueue(_0x20b3e0){this['id']=_0x20b3e0['id']||0x0;this[_0xcc7e('0x7')]=_0x20b3e0[_0xcc7e('0x7')]||'';this[_0xcc7e('0x8')]=_0x20b3e0[_0xcc7e('0x8')]||0xa;this[_0xcc7e('0x9')]=_0x20b3e0['strategy']||_0xcc7e('0xa');this['Agents']=_0x20b3e0[_0xcc7e('0xb')];this['mapAgentsId']={};this[_0xcc7e('0xc')]=0x0;this['md5']='';this[_0xcc7e('0xd')]();this[_0xcc7e('0xe')]();}ChatQueue['prototype'][_0xcc7e('0xd')]=function(){var _0x58563b=this[_0xcc7e('0xf')][_0xcc7e('0x10')];this[_0xcc7e('0xf')]=_[_0xcc7e('0x11')](this['Agents'],'id');this[_0xcc7e('0xf')][_0xcc7e('0x10')]=_0x58563b;};ChatQueue[_0xcc7e('0x12')]['updateRealtime']=function(){this[_0xcc7e('0x13')]=0x0;this[_0xcc7e('0x14')]=0x0;for(var _0x52e14e=0x0;_0x52e14e=0x0?this['available']:0x0;var _0x3ddc3e={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xcc7e('0x7')],'paused':this[_0xcc7e('0x14')],'waiting':this[_0xcc7e('0xc')]};var _0x1ce089=md5(JSON[_0xcc7e('0x19')](_0x3ddc3e));if(this['md5']!==_0x1ce089){this[_0xcc7e('0x1')]=_0x1ce089;io['to'](util[_0xcc7e('0x1a')]('chat:queue:%s',_0x3ddc3e[_0xcc7e('0x7')]))[_0xcc7e('0x1b')]('chat_queue:save',_0x3ddc3e);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 6414899..97f7570 100644 --- a/server/services/routing/model/faxQueue.js +++ b/server/services/routing/model/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x3048a9,_0x267316){var _0xa1e73d=function(_0x39d208){while(--_0x39d208){_0x3048a9['push'](_0x3048a9['shift']());}};_0xa1e73d(++_0x267316);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x42fb36,_0xb8456e){var _0x15a423=function(_0x23e679){while(--_0x23e679){_0x42fb36['push'](_0x42fb36['shift']());}};_0x15a423(++_0xb8456e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 6832286..15b6939 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 _0x7c07=['name'];(function(_0x7626f1,_0x205ed8){var _0x460cf9=function(_0x1ab72b){while(--_0x1ab72b){_0x7626f1['push'](_0x7626f1['shift']());}};_0x460cf9(++_0x205ed8);}(_0x7c07,0x17a));var _0x77c0=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x7c07[_0x580576];return _0x3f55a0;};'use strict';function Interval(_0x3fca4a){this['id']=_0x3fca4a['id']||0x0;this['name']=_0x3fca4a[_0x77c0('0x0')]||'';this['Intervals']=_0x3fca4a['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0xcf06=['Intervals','name'];(function(_0xb28a18,_0x495c63){var _0x1ebea2=function(_0x1d617c){while(--_0x1d617c){_0xb28a18['push'](_0xb28a18['shift']());}};_0x1ebea2(++_0x495c63);}(_0xcf06,0x8f));var _0x6cf0=function(_0x50ff12,_0x121cfe){_0x50ff12=_0x50ff12-0x0;var _0x547940=_0xcf06[_0x50ff12];return _0x547940;};'use strict';function Interval(_0x35ce81){this['id']=_0x35ce81['id']||0x0;this[_0x6cf0('0x0')]=_0x35ce81[_0x6cf0('0x0')]||'';this[_0x6cf0('0x1')]=_0x35ce81[_0x6cf0('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 7e159ab..6203518 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 _0xcabf=['strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','available','format','emit','mail_queue:save','exports','lodash','md5','redis','socket.io-emitter','name','timeout'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0xcabf,0x102));var _0xfcab=function(_0x359d71,_0x4b8a39){_0x359d71=_0x359d71-0x0;var _0x514f84=_0xcabf[_0x359d71];return _0x514f84;};'use strict';var _=require(_0xfcab('0x0'));var md5=require(_0xfcab('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xfcab('0x2')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xfcab('0x3'))(new Redis(config['redis']));function MailQueue(_0x1eb951){this['id']=_0x1eb951['id']||0x0;this[_0xfcab('0x4')]=_0x1eb951[_0xfcab('0x4')]||'';this['timeout']=_0x1eb951[_0xfcab('0x5')]||0xa;this[_0xfcab('0x6')]=_0x1eb951[_0xfcab('0x6')]||'beepall';this[_0xfcab('0x7')]=_0x1eb951[_0xfcab('0x7')];this[_0xfcab('0x8')]={};this[_0xfcab('0x9')]=0x0;this['md5']='';this[_0xfcab('0xa')]();this[_0xfcab('0xb')]();}MailQueue['prototype'][_0xfcab('0xa')]=function(){var _0x5ba1a8=this[_0xfcab('0x8')][_0xfcab('0xc')];this['mapAgentsId']=_[_0xfcab('0xd')](this[_0xfcab('0x7')],'id');this['mapAgentsId']['_rr']=_0x5ba1a8;};MailQueue[_0xfcab('0xe')][_0xfcab('0xb')]=function(){this[_0xfcab('0xf')]=0x0;this[_0xfcab('0x10')]=0x0;for(var _0x5e074b=0x0;_0x5e074b=0x0?this[_0xfcab('0x13')]:0x0;var _0x340011={'id':this['id'],'available':this[_0xfcab('0x13')],'loggedIn':this[_0xfcab('0xf')],'name':this['name'],'paused':this[_0xfcab('0x10')],'waiting':this['waiting']};var _0x59514b=md5(JSON['stringify'](_0x340011));if(this[_0xfcab('0x1')]!==_0x59514b){this[_0xfcab('0x1')]=_0x59514b;io['to'](util[_0xfcab('0x14')]('mail:queue:%s',_0x340011['name']))[_0xfcab('0x15')](_0xfcab('0x16'),_0x340011);}};module[_0xfcab('0x17')]=MailQueue; \ No newline at end of file +var _0xbc36=['timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','waiting','stringify','format','name','mail_queue:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','socket.io-emitter'];(function(_0x391cb8,_0x2c70ab){var _0xe666f5=function(_0x409ce1){while(--_0x409ce1){_0x391cb8['push'](_0x391cb8['shift']());}};_0xe666f5(++_0x2c70ab);}(_0xbc36,0x166));var _0x6bc3=function(_0x50b1c6,_0x502d10){_0x50b1c6=_0x50b1c6-0x0;var _0x4a8796=_0xbc36[_0x50b1c6];return _0x4a8796;};'use strict';var _=require(_0x6bc3('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x6bc3('0x1'));var config=require(_0x6bc3('0x2'));config[_0x6bc3('0x3')]=_[_0x6bc3('0x4')](config[_0x6bc3('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x6bc3('0x5'))(new Redis(config[_0x6bc3('0x3')]));function MailQueue(_0x5bb576){this['id']=_0x5bb576['id']||0x0;this['name']=_0x5bb576['name']||'';this[_0x6bc3('0x6')]=_0x5bb576[_0x6bc3('0x6')]||0xa;this[_0x6bc3('0x7')]=_0x5bb576[_0x6bc3('0x7')]||_0x6bc3('0x8');this['Agents']=_0x5bb576[_0x6bc3('0x9')];this[_0x6bc3('0xa')]={};this['waiting']=0x0;this[_0x6bc3('0xb')]='';this[_0x6bc3('0xc')]();this[_0x6bc3('0xd')]();}MailQueue[_0x6bc3('0xe')][_0x6bc3('0xc')]=function(){var _0x5c1c76=this['mapAgentsId'][_0x6bc3('0xf')];this[_0x6bc3('0xa')]=_[_0x6bc3('0x10')](this[_0x6bc3('0x9')],'id');this[_0x6bc3('0xa')]['_rr']=_0x5c1c76;};MailQueue[_0x6bc3('0xe')][_0x6bc3('0xd')]=function(){this[_0x6bc3('0x11')]=0x0;this[_0x6bc3('0x12')]=0x0;for(var _0x562acb=0x0;_0x562acb=0x0?this['available']:0x0;var _0x5739a0={'id':this['id'],'available':this[_0x6bc3('0x15')],'loggedIn':this[_0x6bc3('0x11')],'name':this['name'],'paused':this[_0x6bc3('0x12')],'waiting':this[_0x6bc3('0x16')]};var _0x3f54ed=md5(JSON[_0x6bc3('0x17')](_0x5739a0));if(this[_0x6bc3('0xb')]!==_0x3f54ed){this[_0x6bc3('0xb')]=_0x3f54ed;io['to'](util[_0x6bc3('0x18')]('mail:queue:%s',_0x5739a0[_0x6bc3('0x19')]))['emit'](_0x6bc3('0x1a'),_0x5739a0);}};module[_0x6bc3('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 1a063af..397c4d6 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 _0x82a9=['name','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','loggedIn','paused','length','online','openchannelPause','available','format','openchannel:queue:%s','emit','openchannel_queue:save','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x5d02aa,_0x284f04){var _0xcb4e0b=function(_0x36005a){while(--_0x36005a){_0x5d02aa['push'](_0x5d02aa['shift']());}};_0xcb4e0b(++_0x284f04);}(_0x82a9,0xd8));var _0x982a=function(_0x14e136,_0x25055d){_0x14e136=_0x14e136-0x0;var _0x333c39=_0x82a9[_0x14e136];return _0x333c39;};'use strict';var _=require('lodash');var md5=require(_0x982a('0x0'));var util=require(_0x982a('0x1'));var Redis=require(_0x982a('0x2'));var config=require(_0x982a('0x3'));config[_0x982a('0x4')]=_[_0x982a('0x5')](config['redis'],{'host':_0x982a('0x6'),'port':0x18eb});var io=require(_0x982a('0x7'))(new Redis(config['redis']));function OpenchannelQueue(_0x8e22db){this['id']=_0x8e22db['id']||0x0;this[_0x982a('0x8')]=_0x8e22db['name']||'';this['timeout']=_0x8e22db['timeout']||0xa;this[_0x982a('0x9')]=_0x8e22db[_0x982a('0x9')]||_0x982a('0xa');this[_0x982a('0xb')]=_0x8e22db[_0x982a('0xb')];this['mapAgentsId']={};this[_0x982a('0xc')]=0x0;this[_0x982a('0x0')]='';this[_0x982a('0xd')]();this[_0x982a('0xe')]();}OpenchannelQueue[_0x982a('0xf')][_0x982a('0xd')]=function(){var _0x339991=this['mapAgentsId'][_0x982a('0x10')];this[_0x982a('0x11')]=_['map'](this[_0x982a('0xb')],'id');this[_0x982a('0x11')][_0x982a('0x10')]=_0x339991;};OpenchannelQueue[_0x982a('0xf')][_0x982a('0xe')]=function(){this[_0x982a('0x12')]=0x0;this[_0x982a('0x13')]=0x0;for(var _0x296772=0x0;_0x296772=0x0?this['available']:0x0;var _0x409fda={'id':this['id'],'available':this[_0x982a('0x17')],'loggedIn':this[_0x982a('0x12')],'name':this[_0x982a('0x8')],'paused':this[_0x982a('0x13')],'waiting':this[_0x982a('0xc')]};var _0x5cdefa=md5(JSON['stringify'](_0x409fda));if(this[_0x982a('0x0')]!==_0x5cdefa){this[_0x982a('0x0')]=_0x5cdefa;io['to'](util[_0x982a('0x18')](_0x982a('0x19'),_0x409fda[_0x982a('0x8')]))[_0x982a('0x1a')](_0x982a('0x1b'),_0x409fda);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x3516=['waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','length','online','openchannelPause','paused','available','stringify','md5','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x2733e4,_0xfe3883){var _0x5487fb=function(_0x877cb){while(--_0x877cb){_0x2733e4['push'](_0x2733e4['shift']());}};_0x5487fb(++_0xfe3883);}(_0x3516,0x168));var _0x6351=function(_0x11ef8e,_0xbd124e){_0x11ef8e=_0x11ef8e-0x0;var _0xdbf06f=_0x3516[_0x11ef8e];return _0xdbf06f;};'use strict';var _=require(_0x6351('0x0'));var md5=require('md5');var util=require(_0x6351('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x6351('0x2')]=_[_0x6351('0x3')](config['redis'],{'host':_0x6351('0x4'),'port':0x18eb});var io=require(_0x6351('0x5'))(new Redis(config[_0x6351('0x2')]));function OpenchannelQueue(_0x3907fe){this['id']=_0x3907fe['id']||0x0;this[_0x6351('0x6')]=_0x3907fe[_0x6351('0x6')]||'';this['timeout']=_0x3907fe[_0x6351('0x7')]||0xa;this[_0x6351('0x8')]=_0x3907fe[_0x6351('0x8')]||_0x6351('0x9');this[_0x6351('0xa')]=_0x3907fe['Agents'];this[_0x6351('0xb')]={};this[_0x6351('0xc')]=0x0;this['md5']='';this[_0x6351('0xd')]();this[_0x6351('0xe')]();}OpenchannelQueue['prototype'][_0x6351('0xd')]=function(){var _0x3ff3ab=this['mapAgentsId'][_0x6351('0xf')];this[_0x6351('0xb')]=_[_0x6351('0x10')](this['Agents'],'id');this[_0x6351('0xb')][_0x6351('0xf')]=_0x3ff3ab;};OpenchannelQueue[_0x6351('0x11')]['updateRealtime']=function(){this[_0x6351('0x12')]=0x0;this['paused']=0x0;for(var _0xedfc85=0x0;_0xedfc85=0x0?this['available']:0x0;var _0x3efc83={'id':this['id'],'available':this[_0x6351('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x6351('0x6')],'paused':this[_0x6351('0x16')],'waiting':this[_0x6351('0xc')]};var _0x1a31b5=md5(JSON[_0x6351('0x18')](_0x3efc83));if(this[_0x6351('0x19')]!==_0x1a31b5){this['md5']=_0x1a31b5;io['to'](util[_0x6351('0x1a')](_0x6351('0x1b'),_0x3efc83[_0x6351('0x6')]))[_0x6351('0x1c')](_0x6351('0x1d'),_0x3efc83);}};module[_0x6351('0x1e')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 540edd8..95e61e3 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 _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x31f50e,_0x1a1130){var _0x1ec606=function(_0x1121da){while(--_0x1121da){_0x31f50e['push'](_0x31f50e['shift']());}};_0x1ec606(++_0x1a1130);}(_0xb7e7,0x121));var _0x7b7e=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xb7e7[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file +var _0xbaf0=['online','paused','available','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var md5=require(_0x0baf('0x0'));var util=require(_0x0baf('0x1'));var Redis=require(_0x0baf('0x2'));var config=require(_0x0baf('0x3'));config[_0x0baf('0x4')]=_[_0x0baf('0x5')](config['redis'],{'host':_0x0baf('0x6'),'port':0x18eb});var io=require(_0x0baf('0x7'))(new Redis(config[_0x0baf('0x4')]));function SmsQueue(_0x39b8f3){this['id']=_0x39b8f3['id']||0x0;this[_0x0baf('0x8')]=_0x39b8f3[_0x0baf('0x8')]||'';this[_0x0baf('0x9')]=_0x39b8f3[_0x0baf('0x9')]||0xa;this[_0x0baf('0xa')]=_0x39b8f3['strategy']||_0x0baf('0xb');this['Agents']=_0x39b8f3[_0x0baf('0xc')];this[_0x0baf('0xd')]={};this[_0x0baf('0xe')]=0x0;this[_0x0baf('0x0')]='';this[_0x0baf('0xf')]();this[_0x0baf('0x10')]();}SmsQueue[_0x0baf('0x11')][_0x0baf('0xf')]=function(){var _0x1fc6b2=this[_0x0baf('0xd')][_0x0baf('0x12')];this['mapAgentsId']=_['map'](this[_0x0baf('0xc')],'id');this[_0x0baf('0xd')][_0x0baf('0x12')]=_0x1fc6b2;};SmsQueue[_0x0baf('0x11')]['updateRealtime']=function(){this[_0x0baf('0x13')]=0x0;this['paused']=0x0;for(var _0x1c76a8=0x0;_0x1c76a8=0x0?this['available']:0x0;var _0x63c820={'id':this['id'],'available':this[_0x0baf('0x17')],'loggedIn':this[_0x0baf('0x13')],'name':this[_0x0baf('0x8')],'paused':this[_0x0baf('0x16')],'waiting':this[_0x0baf('0xe')]};var _0x4ff793=md5(JSON['stringify'](_0x63c820));if(this[_0x0baf('0x0')]!==_0x4ff793){this[_0x0baf('0x0')]=_0x4ff793;io['to'](util[_0x0baf('0x18')](_0x0baf('0x19'),_0x63c820[_0x0baf('0x8')]))[_0x0baf('0x1a')](_0x0baf('0x1b'),_0x63c820);}};module[_0x0baf('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 0e3d405..29ffd52 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 _0x09bf=['map','prototype','paused','length','online','loggedIn','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr'];(function(_0x1dcae4,_0x3d1b06){var _0x4f99ba=function(_0x24e772){while(--_0x24e772){_0x1dcae4['push'](_0x1dcae4['shift']());}};_0x4f99ba(++_0x3d1b06);}(_0x09bf,0x85));var _0xf09b=function(_0x13a80e,_0xc146b9){_0x13a80e=_0x13a80e-0x0;var _0x3462c0=_0x09bf[_0x13a80e];return _0x3462c0;};'use strict';var _=require(_0xf09b('0x0'));var md5=require('md5');var util=require(_0xf09b('0x1'));var Redis=require(_0xf09b('0x2'));var config=require(_0xf09b('0x3'));config[_0xf09b('0x4')]=_[_0xf09b('0x5')](config[_0xf09b('0x4')],{'host':_0xf09b('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x1727dd){this['id']=_0x1727dd['id']||0x0;this[_0xf09b('0x7')]=_0x1727dd['name']||'';this['timeout']=_0x1727dd[_0xf09b('0x8')]||0xa;this['strategy']=_0x1727dd['strategy']||_0xf09b('0x9');this[_0xf09b('0xa')]=_0x1727dd[_0xf09b('0xa')];this[_0xf09b('0xb')]={};this[_0xf09b('0xc')]=0x0;this[_0xf09b('0xd')]='';this[_0xf09b('0xe')]();this[_0xf09b('0xf')]();}WhatsappQueue['prototype'][_0xf09b('0xe')]=function(){var _0x21476e=this['mapAgentsId'][_0xf09b('0x10')];this[_0xf09b('0xb')]=_[_0xf09b('0x11')](this[_0xf09b('0xa')],'id');this['mapAgentsId'][_0xf09b('0x10')]=_0x21476e;};WhatsappQueue[_0xf09b('0x12')][_0xf09b('0xf')]=function(){this['loggedIn']=0x0;this[_0xf09b('0x13')]=0x0;for(var _0x4d4912=0x0;_0x4d4912=0x0?this[_0xf09b('0x18')]:0x0;var _0x1d5e63={'id':this['id'],'available':this[_0xf09b('0x18')],'loggedIn':this[_0xf09b('0x16')],'name':this[_0xf09b('0x7')],'paused':this[_0xf09b('0x13')],'waiting':this[_0xf09b('0xc')]};var _0x19cc76=md5(JSON[_0xf09b('0x19')](_0x1d5e63));if(this[_0xf09b('0xd')]!==_0x19cc76){this[_0xf09b('0xd')]=_0x19cc76;io['to'](util[_0xf09b('0x1a')](_0xf09b('0x1b'),_0x1d5e63[_0xf09b('0x7')]))[_0xf09b('0x1c')](_0xf09b('0x1d'),_0x1d5e63);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x3251=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x4d6915,_0x54db92){var _0x4a934d=function(_0x443093){while(--_0x443093){_0x4d6915['push'](_0x4d6915['shift']());}};_0x4a934d(++_0x54db92);}(_0x3251,0x16a));var _0x1325=function(_0x31d3b8,_0xd47928){_0x31d3b8=_0x31d3b8-0x0;var _0x258cac=_0x3251[_0x31d3b8];return _0x258cac;};'use strict';var _=require(_0x1325('0x0'));var md5=require(_0x1325('0x1'));var util=require(_0x1325('0x2'));var Redis=require(_0x1325('0x3'));var config=require(_0x1325('0x4'));config[_0x1325('0x5')]=_[_0x1325('0x6')](config['redis'],{'host':_0x1325('0x7'),'port':0x18eb});var io=require(_0x1325('0x8'))(new Redis(config[_0x1325('0x5')]));function WhatsappQueue(_0x45ccee){this['id']=_0x45ccee['id']||0x0;this[_0x1325('0x9')]=_0x45ccee['name']||'';this[_0x1325('0xa')]=_0x45ccee[_0x1325('0xa')]||0xa;this[_0x1325('0xb')]=_0x45ccee['strategy']||_0x1325('0xc');this[_0x1325('0xd')]=_0x45ccee['Agents'];this[_0x1325('0xe')]={};this[_0x1325('0xf')]=0x0;this[_0x1325('0x1')]='';this[_0x1325('0x10')]();this[_0x1325('0x11')]();}WhatsappQueue[_0x1325('0x12')][_0x1325('0x10')]=function(){var _0x5a5535=this[_0x1325('0xe')][_0x1325('0x13')];this[_0x1325('0xe')]=_[_0x1325('0x14')](this[_0x1325('0xd')],'id');this['mapAgentsId'][_0x1325('0x13')]=_0x5a5535;};WhatsappQueue[_0x1325('0x12')][_0x1325('0x11')]=function(){this[_0x1325('0x15')]=0x0;this[_0x1325('0x16')]=0x0;for(var _0x43432e=0x0;_0x43432e=0x0?this[_0x1325('0x1a')]:0x0;var _0x5058cc={'id':this['id'],'available':this[_0x1325('0x1a')],'loggedIn':this['loggedIn'],'name':this[_0x1325('0x9')],'paused':this[_0x1325('0x16')],'waiting':this[_0x1325('0xf')]};var _0x10f1dd=md5(JSON[_0x1325('0x1b')](_0x5058cc));if(this[_0x1325('0x1')]!==_0x10f1dd){this[_0x1325('0x1')]=_0x10f1dd;io['to'](util[_0x1325('0x1c')](_0x1325('0x1d'),_0x5058cc[_0x1325('0x9')]))[_0x1325('0x1e')]('whatsapp_queue:save',_0x5058cc);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 444de3b..30a46af 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 _0xedd9=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initOpenchannelQueues','openchannelQueues','updateRealtime','initChatQueues','updateRouting','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','exports','util','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','chatQueues','mailQueues'];(function(_0x41ec2b,_0x387664){var _0x542ff4=function(_0x55e527){while(--_0x55e527){_0x41ec2b['push'](_0x41ec2b['shift']());}};_0x542ff4(++_0x387664);}(_0xedd9,0xfc));var _0x9edd=function(_0x5ec7c9,_0x2b7369){_0x5ec7c9=_0x5ec7c9-0x0;var _0x153f11=_0xedd9[_0x5ec7c9];return _0x153f11;};'use strict';var BPromise=require('bluebird');var util=require(_0x9edd('0x0'));var _=require(_0x9edd('0x1'));var moment=require(_0x9edd('0x2'));var Agent=require(_0x9edd('0x3'));var Interval=require(_0x9edd('0x4'));var OpenchannelQueue=require(_0x9edd('0x5'));var ChatQueue=require(_0x9edd('0x6'));var SmsQueue=require(_0x9edd('0x7'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x9edd('0x8'));var WhatsappQueue=require(_0x9edd('0x9'));var Realtime=function(){this[_0x9edd('0xa')]={};this[_0x9edd('0xb')]={};this['openchannelQueues']={};this[_0x9edd('0xc')]={};this['smsQueues']={};this[_0x9edd('0xd')]={};this[_0x9edd('0xe')]={};this[_0x9edd('0xf')]={};this[_0x9edd('0x10')]={};this['mailQueuesWaitingInteractions']={};this[_0x9edd('0x11')]={};this['smsQueuesWaitingInteractions']={};this[_0x9edd('0x12')]={};this[_0x9edd('0x13')]={};};function freeIsNotKey(_0x523026,_0xbf9da6,_0x13dc4f){var _0x5b6c00=_[_0x9edd('0x14')](_0x523026,function(_0x1b73d1,_0x25e64c){return _0x1b73d1[_0x13dc4f];});for(var _0xfd544a in _0xbf9da6){if(_0xbf9da6[_0x9edd('0x15')](_0xfd544a)){if(!_0x5b6c00[_0xfd544a]){delete _0xbf9da6[_0xfd544a];}}}}Realtime[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0xef5498,_0x47eb64){for(var _0x176bfa in _0x47eb64){if(_0xef5498[_0x9edd('0x15')](_0x176bfa)){_0xef5498[_0x176bfa]=_0x47eb64[_0x176bfa];}}};Realtime[_0x9edd('0x16')][_0x9edd('0x18')]=function(){var _0x13b6b6=this;return function(_0x338f3c){if(_0x338f3c){freeIsNotKey(_0x338f3c,_0x13b6b6[_0x9edd('0xa')],'id');for(var _0x75a4ab=0x0,_0x4ea60f={},_0x5f5bf4={};_0x75a4ab<_0x338f3c[_0x9edd('0x19')];_0x75a4ab+=0x1){_0x4ea60f=_0x338f3c[_0x75a4ab];if(_[_0x9edd('0x1a')](_0x13b6b6['agents'][_0x4ea60f['id']])){_0x13b6b6[_0x9edd('0xa')][_0x4ea60f['id']]=new Agent(_0x4ea60f);}else{_0x13b6b6[_0x9edd('0x17')](_0x13b6b6[_0x9edd('0xa')][_0x4ea60f['id']],_0x4ea60f);}}}return _0x13b6b6['agents'];};};Realtime[_0x9edd('0x16')]['initIntervals']=function(){var _0x2cdcef=this;return function(_0x1083e4){if(_0x1083e4){freeIsNotKey(_0x1083e4,_0x2cdcef['intervals'],'id');for(var _0x498977=0x0,_0x45c3ab={},_0x50338f={};_0x498977<_0x1083e4[_0x9edd('0x19')];_0x498977+=0x1){_0x45c3ab=_0x1083e4[_0x498977];if(_['isUndefined'](_0x2cdcef['intervals'][_0x45c3ab['id']])){_0x2cdcef[_0x9edd('0xb')][_0x45c3ab['id']]=new Interval(_0x45c3ab);}else{_0x2cdcef[_0x9edd('0x17')](_0x2cdcef['intervals'][_0x45c3ab['id']],_0x45c3ab);}}}return _0x2cdcef['intervals'];};};Realtime[_0x9edd('0x16')][_0x9edd('0x1b')]=function(){var _0x477878=this;return function(_0x542172){if(_0x542172){freeIsNotKey(_0x542172,_0x477878[_0x9edd('0x1c')],'id');for(var _0x1dca43=0x0,_0x44a6c1={},_0x2ca65f={};_0x1dca43<_0x542172[_0x9edd('0x19')];_0x1dca43+=0x1){_0x44a6c1=_0x542172[_0x1dca43];if(_['isUndefined'](_0x477878[_0x9edd('0x1c')][_0x44a6c1['id']])){_0x477878[_0x9edd('0x1c')][_0x44a6c1['id']]=new OpenchannelQueue(_0x44a6c1);}else{_0x477878[_0x9edd('0x17')](_0x477878[_0x9edd('0x1c')][_0x44a6c1['id']],_0x44a6c1);}_0x477878[_0x9edd('0x1c')][_0x44a6c1['id']]['updateRouting']();_0x477878['openchannelQueues'][_0x44a6c1['id']][_0x9edd('0x1d')]();}}return _0x477878[_0x9edd('0x1c')];};};Realtime[_0x9edd('0x16')][_0x9edd('0x1e')]=function(){var _0x3c2227=this;return function(_0x4fe471){if(_0x4fe471){freeIsNotKey(_0x4fe471,_0x3c2227['chatQueues'],'id');for(var _0x214d0a=0x0,_0x257a26={},_0x1c762c={};_0x214d0a<_0x4fe471['length'];_0x214d0a+=0x1){_0x257a26=_0x4fe471[_0x214d0a];if(_[_0x9edd('0x1a')](_0x3c2227[_0x9edd('0xc')][_0x257a26['id']])){_0x3c2227[_0x9edd('0xc')][_0x257a26['id']]=new ChatQueue(_0x257a26);}else{_0x3c2227[_0x9edd('0x17')](_0x3c2227['chatQueues'][_0x257a26['id']],_0x257a26);}_0x3c2227[_0x9edd('0xc')][_0x257a26['id']][_0x9edd('0x1f')]();_0x3c2227[_0x9edd('0xc')][_0x257a26['id']][_0x9edd('0x1d')]();}}return _0x3c2227[_0x9edd('0xc')];};};Realtime[_0x9edd('0x16')][_0x9edd('0x20')]=function(){var _0x1fba7b=this;return function(_0x19b6c1){if(_0x19b6c1){freeIsNotKey(_0x19b6c1,_0x1fba7b[_0x9edd('0x21')],'id');for(var _0x4fd03f=0x0,_0x138002={},_0x6907a5={};_0x4fd03f<_0x19b6c1[_0x9edd('0x19')];_0x4fd03f+=0x1){_0x138002=_0x19b6c1[_0x4fd03f];if(_[_0x9edd('0x1a')](_0x1fba7b['smsQueues'][_0x138002['id']])){_0x1fba7b[_0x9edd('0x21')][_0x138002['id']]=new SmsQueue(_0x138002);}else{_0x1fba7b[_0x9edd('0x17')](_0x1fba7b[_0x9edd('0x21')][_0x138002['id']],_0x138002);}_0x1fba7b['smsQueues'][_0x138002['id']][_0x9edd('0x1f')]();_0x1fba7b[_0x9edd('0x21')][_0x138002['id']][_0x9edd('0x1d')]();}}return _0x1fba7b[_0x9edd('0x21')];};};Realtime[_0x9edd('0x16')][_0x9edd('0x22')]=function(){var _0x473068=this;return function(_0x438a5d){if(_0x438a5d){freeIsNotKey(_0x438a5d,_0x473068[_0x9edd('0xd')],'id');for(var _0x2539c6=0x0,_0x29e789={},_0x42c1d9={};_0x2539c6<_0x438a5d[_0x9edd('0x19')];_0x2539c6+=0x1){_0x29e789=_0x438a5d[_0x2539c6];if(_[_0x9edd('0x1a')](_0x473068['mailQueues'][_0x29e789['id']])){_0x473068[_0x9edd('0xd')][_0x29e789['id']]=new MailQueue(_0x29e789);}else{_0x473068['mergeFromDatabase'](_0x473068[_0x9edd('0xd')][_0x29e789['id']],_0x29e789);}_0x473068[_0x9edd('0xd')][_0x29e789['id']][_0x9edd('0x1f')]();_0x473068[_0x9edd('0xd')][_0x29e789['id']][_0x9edd('0x1d')]();}}return _0x473068['mailQueues'];};};Realtime[_0x9edd('0x16')][_0x9edd('0x23')]=function(){var _0x2b3469=this;return function(_0x38e9be){if(_0x38e9be){freeIsNotKey(_0x38e9be,_0x2b3469[_0x9edd('0xe')],'id');for(var _0x337e6c=0x0,_0x5c0627={},_0x1cbbac={};_0x337e6c<_0x38e9be[_0x9edd('0x19')];_0x337e6c+=0x1){_0x5c0627=_0x38e9be[_0x337e6c];if(_[_0x9edd('0x1a')](_0x2b3469['faxQueues'][_0x5c0627['id']])){_0x2b3469[_0x9edd('0xe')][_0x5c0627['id']]=new FaxQueue(_0x5c0627);}else{_0x2b3469['mergeFromDatabase'](_0x2b3469[_0x9edd('0xe')][_0x5c0627['id']],_0x5c0627);}_0x2b3469['faxQueues'][_0x5c0627['id']][_0x9edd('0x1f')]();_0x2b3469[_0x9edd('0xe')][_0x5c0627['id']][_0x9edd('0x1d')]();}}return _0x2b3469['faxQueues'];};};Realtime[_0x9edd('0x16')][_0x9edd('0x24')]=function(){var _0x2f8f61=this;return function(_0x48958a){if(_0x48958a){freeIsNotKey(_0x48958a,_0x2f8f61[_0x9edd('0xf')],'id');for(var _0x51ad91=0x0,_0x1fc4fb={},_0xfbc492={};_0x51ad91<_0x48958a['length'];_0x51ad91+=0x1){_0x1fc4fb=_0x48958a[_0x51ad91];if(_[_0x9edd('0x1a')](_0x2f8f61[_0x9edd('0xf')][_0x1fc4fb['id']])){_0x2f8f61[_0x9edd('0xf')][_0x1fc4fb['id']]=new WhatsappQueue(_0x1fc4fb);}else{_0x2f8f61[_0x9edd('0x17')](_0x2f8f61['whatsappQueues'][_0x1fc4fb['id']],_0x1fc4fb);}_0x2f8f61[_0x9edd('0xf')][_0x1fc4fb['id']]['updateRouting']();_0x2f8f61[_0x9edd('0xf')][_0x1fc4fb['id']][_0x9edd('0x1d')]();}}return _0x2f8f61['whatsappQueues'];};};module[_0x9edd('0x25')]=Realtime; \ No newline at end of file +var _0xa41a=['../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','intervals','smsQueues','mailQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','openchannelQueues','initChatQueues','chatQueues','initSmsQueues','updateRouting','updateRealtime','initFaxQueues','faxQueues','bluebird','util','moment','../model/agent'];(function(_0x26d8cf,_0x356dbb){var _0x5ebd91=function(_0x3630ca){while(--_0x3630ca){_0x26d8cf['push'](_0x26d8cf['shift']());}};_0x5ebd91(++_0x356dbb);}(_0xa41a,0x6b));var _0xaa41=function(_0x2326ff,_0x27e552){_0x2326ff=_0x2326ff-0x0;var _0x54bd8d=_0xa41a[_0x2326ff];return _0x54bd8d;};'use strict';var BPromise=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var _=require('lodash');var moment=require(_0xaa41('0x2'));var Agent=require(_0xaa41('0x3'));var Interval=require(_0xaa41('0x4'));var OpenchannelQueue=require(_0xaa41('0x5'));var ChatQueue=require(_0xaa41('0x6'));var SmsQueue=require(_0xaa41('0x7'));var MailQueue=require(_0xaa41('0x8'));var FaxQueue=require(_0xaa41('0x9'));var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this[_0xaa41('0xa')]={};this[_0xaa41('0xb')]={};this['openchannelQueues']={};this['chatQueues']={};this[_0xaa41('0xc')]={};this[_0xaa41('0xd')]={};this['faxQueues']={};this[_0xaa41('0xe')]={};this[_0xaa41('0xf')]={};this[_0xaa41('0x10')]={};this[_0xaa41('0x11')]={};this[_0xaa41('0x12')]={};this[_0xaa41('0x13')]={};this[_0xaa41('0x14')]={};};function freeIsNotKey(_0x423a19,_0x1c291e,_0x5c9fc7){var _0x1d3aac=_[_0xaa41('0x15')](_0x423a19,function(_0x524cab,_0x54827c){return _0x524cab[_0x5c9fc7];});for(var _0x1d0a54 in _0x1c291e){if(_0x1c291e['hasOwnProperty'](_0x1d0a54)){if(!_0x1d3aac[_0x1d0a54]){delete _0x1c291e[_0x1d0a54];}}}}Realtime[_0xaa41('0x16')][_0xaa41('0x17')]=function(_0x2f64bc,_0x889d44){for(var _0x6f9ade in _0x889d44){if(_0x2f64bc['hasOwnProperty'](_0x6f9ade)){_0x2f64bc[_0x6f9ade]=_0x889d44[_0x6f9ade];}}};Realtime[_0xaa41('0x16')][_0xaa41('0x18')]=function(){var _0x1934e9=this;return function(_0x1ef7d9){if(_0x1ef7d9){freeIsNotKey(_0x1ef7d9,_0x1934e9[_0xaa41('0xa')],'id');for(var _0x2005ae=0x0,_0x1e1e02={},_0x550ad5={};_0x2005ae<_0x1ef7d9[_0xaa41('0x19')];_0x2005ae+=0x1){_0x1e1e02=_0x1ef7d9[_0x2005ae];if(_[_0xaa41('0x1a')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']])){_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']]=new Agent(_0x1e1e02);}else{_0x1934e9[_0xaa41('0x17')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']],_0x1e1e02);}}}return _0x1934e9[_0xaa41('0xa')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1b')]=function(){var _0x4fe1a4=this;return function(_0x5cd936){if(_0x5cd936){freeIsNotKey(_0x5cd936,_0x4fe1a4[_0xaa41('0xb')],'id');for(var _0x22de55=0x0,_0x35c753={},_0x54c488={};_0x22de55<_0x5cd936[_0xaa41('0x19')];_0x22de55+=0x1){_0x35c753=_0x5cd936[_0x22de55];if(_[_0xaa41('0x1a')](_0x4fe1a4['intervals'][_0x35c753['id']])){_0x4fe1a4['intervals'][_0x35c753['id']]=new Interval(_0x35c753);}else{_0x4fe1a4[_0xaa41('0x17')](_0x4fe1a4['intervals'][_0x35c753['id']],_0x35c753);}}}return _0x4fe1a4[_0xaa41('0xb')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1c')]=function(){var _0x1f27f3=this;return function(_0x1d623c){if(_0x1d623c){freeIsNotKey(_0x1d623c,_0x1f27f3['openchannelQueues'],'id');for(var _0x43c430=0x0,_0x43a85c={},_0x448a21={};_0x43c430<_0x1d623c[_0xaa41('0x19')];_0x43c430+=0x1){_0x43a85c=_0x1d623c[_0x43c430];if(_[_0xaa41('0x1a')](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']])){_0x1f27f3['openchannelQueues'][_0x43a85c['id']]=new OpenchannelQueue(_0x43a85c);}else{_0x1f27f3['mergeFromDatabase'](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']],_0x43a85c);}_0x1f27f3['openchannelQueues'][_0x43a85c['id']]['updateRouting']();_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']]['updateRealtime']();}}return _0x1f27f3['openchannelQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1e')]=function(){var _0x392214=this;return function(_0x632fd2){if(_0x632fd2){freeIsNotKey(_0x632fd2,_0x392214[_0xaa41('0x1f')],'id');for(var _0xa7269f=0x0,_0x57ef96={},_0x30a174={};_0xa7269f<_0x632fd2[_0xaa41('0x19')];_0xa7269f+=0x1){_0x57ef96=_0x632fd2[_0xa7269f];if(_[_0xaa41('0x1a')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']])){_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]=new ChatQueue(_0x57ef96);}else{_0x392214[_0xaa41('0x17')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']],_0x57ef96);}_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRouting']();_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRealtime']();}}return _0x392214['chatQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x20')]=function(){var _0x534a85=this;return function(_0x392b5d){if(_0x392b5d){freeIsNotKey(_0x392b5d,_0x534a85[_0xaa41('0xc')],'id');for(var _0x4e3b44=0x0,_0x5022fb={},_0x5c25fb={};_0x4e3b44<_0x392b5d[_0xaa41('0x19')];_0x4e3b44+=0x1){_0x5022fb=_0x392b5d[_0x4e3b44];if(_[_0xaa41('0x1a')](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']])){_0x534a85[_0xaa41('0xc')][_0x5022fb['id']]=new SmsQueue(_0x5022fb);}else{_0x534a85['mergeFromDatabase'](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']],_0x5022fb);}_0x534a85[_0xaa41('0xc')][_0x5022fb['id']][_0xaa41('0x21')]();_0x534a85['smsQueues'][_0x5022fb['id']][_0xaa41('0x22')]();}}return _0x534a85[_0xaa41('0xc')];};};Realtime[_0xaa41('0x16')]['initMailQueues']=function(){var _0x252c62=this;return function(_0x374117){if(_0x374117){freeIsNotKey(_0x374117,_0x252c62['mailQueues'],'id');for(var _0x23eb50=0x0,_0x13b6d4={},_0x2298ed={};_0x23eb50<_0x374117['length'];_0x23eb50+=0x1){_0x13b6d4=_0x374117[_0x23eb50];if(_[_0xaa41('0x1a')](_0x252c62['mailQueues'][_0x13b6d4['id']])){_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']]=new MailQueue(_0x13b6d4);}else{_0x252c62[_0xaa41('0x17')](_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']],_0x13b6d4);}_0x252c62['mailQueues'][_0x13b6d4['id']]['updateRouting']();_0x252c62['mailQueues'][_0x13b6d4['id']][_0xaa41('0x22')]();}}return _0x252c62[_0xaa41('0xd')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x23')]=function(){var _0x4fbb92=this;return function(_0x53a2e4){if(_0x53a2e4){freeIsNotKey(_0x53a2e4,_0x4fbb92[_0xaa41('0x24')],'id');for(var _0x5673c=0x0,_0x951e52={},_0x4e8d2e={};_0x5673c<_0x53a2e4[_0xaa41('0x19')];_0x5673c+=0x1){_0x951e52=_0x53a2e4[_0x5673c];if(_[_0xaa41('0x1a')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']])){_0x4fbb92['faxQueues'][_0x951e52['id']]=new FaxQueue(_0x951e52);}else{_0x4fbb92[_0xaa41('0x17')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']],_0x951e52);}_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']][_0xaa41('0x21')]();_0x4fbb92['faxQueues'][_0x951e52['id']]['updateRealtime']();}}return _0x4fbb92[_0xaa41('0x24')];};};Realtime[_0xaa41('0x16')]['initWhatsappQueues']=function(){var _0x4101ab=this;return function(_0x563687){if(_0x563687){freeIsNotKey(_0x563687,_0x4101ab[_0xaa41('0xe')],'id');for(var _0x25f2df=0x0,_0x1a2d11={},_0x466eee={};_0x25f2df<_0x563687[_0xaa41('0x19')];_0x25f2df+=0x1){_0x1a2d11=_0x563687[_0x25f2df];if(_[_0xaa41('0x1a')](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']])){_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']]=new WhatsappQueue(_0x1a2d11);}else{_0x4101ab['mergeFromDatabase'](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']],_0x1a2d11);}_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x21')]();_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x22')]();}}return _0x4101ab[_0xaa41('0xe')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 884fac6..91b5cf6 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 _0x486a=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x1110a0,_0x29c030){var _0x548582=function(_0x4517cd){while(--_0x4517cd){_0x1110a0['push'](_0x1110a0['shift']());}};_0x548582(++_0x29c030);}(_0x486a,0x1a9));var _0xa486=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0x486a[_0x5c72ee];return _0x231876;};'use strict';var client=require(_0xa486('0x0'));exports[_0xa486('0x1')]=function(_0xde45a4,_0x41aa4b){return client[_0xa486('0x2')](_0xa486('0x3'),{'body':_0x41aa4b,'options':{'where':{'id':_0xde45a4}},'log':_0xa486('0x4')});};exports[_0xa486('0x5')]=function(_0x49345b,_0x557dfc){return client[_0xa486('0x2')](_0xa486('0x6'),{'body':_0x557dfc,'options':{'where':{'id':_0x49345b}},'log':_0xa486('0x7')});}; \ No newline at end of file +var _0xc755=['updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x263705,_0x321748){var _0x678d2a=function(_0x2ba6f0){while(--_0x2ba6f0){_0x263705['push'](_0x263705['shift']());}};_0x678d2a(++_0x321748);}(_0xc755,0xf9));var _0x5c75=function(_0xb20aea,_0xc04cb2){_0xb20aea=_0xb20aea-0x0;var _0x3f0d55=_0xc755[_0xb20aea];return _0x3f0d55;};'use strict';var client=require(_0x5c75('0x0'));exports[_0x5c75('0x1')]=function(_0x2016d7,_0x4b6c83){return client[_0x5c75('0x2')]('UpdateChatInteraction',{'body':_0x4b6c83,'options':{'where':{'id':_0x2016d7}},'log':_0x5c75('0x3')});};exports[_0x5c75('0x4')]=function(_0x1f4591,_0x4c7579){return client[_0x5c75('0x2')](_0x5c75('0x5'),{'body':_0x4c7579,'options':{'where':{'id':_0x1f4591}},'log':_0x5c75('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 66f376a..28d6bb8 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 _0xa70f=['createChatMessage','CreateChatMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa70f,0x121));var _0xfa70=function(_0x18343b,_0x4d0ddb){_0x18343b=_0x18343b-0x0;var _0x3488d5=_0xa70f[_0x18343b];return _0x3488d5;};'use strict';var client=require('../client');exports['create']=function(_0x415652){return client['Request'](_0xfa70('0x0'),{'body':_0x415652,'log':_0xfa70('0x1')});}; \ No newline at end of file +var _0x693e=['CreateChatMessage','createChatMessage','create'];(function(_0xb373b3,_0x34b7ba){var _0x416542=function(_0x308aef){while(--_0x308aef){_0xb373b3['push'](_0xb373b3['shift']());}};_0x416542(++_0x34b7ba);}(_0x693e,0x170));var _0xe693=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x693e[_0x57b54c];return _0x59cc19;};'use strict';var client=require('../client');exports[_0xe693('0x0')]=function(_0x289b6c){return client['Request'](_0xe693('0x1'),{'body':_0x289b6c,'log':_0xe693('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index ac2f63d..8b862d1 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 _0x9c8d=['Agents','online','chatPause','getChatQueues','GetChatQueue','name','strategy','User'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0x9c8d,0xfb));var _0xd9c8=function(_0x4f16fa,_0x4d1790){_0x4f16fa=_0x4f16fa-0x0;var _0x3933bb=_0x9c8d[_0x4f16fa];return _0x3933bb;};'use strict';var client=require('../client');exports[_0xd9c8('0x0')]=function(){return function(){return client['Request'](_0xd9c8('0x1'),{'options':{'raw':![],'attributes':['id',_0xd9c8('0x2'),'timeout',_0xd9c8('0x3')],'include':[{'model':_0xd9c8('0x4'),'as':_0xd9c8('0x5'),'attributes':['id','name',_0xd9c8('0x6'),_0xd9c8('0x7')]}]},'log':_0xd9c8('0x0')});};}; \ No newline at end of file +var _0xb092=['strategy','User','Agents','online','chatPause','../client','getChatQueues','GetChatQueue','name','timeout'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xb092,0x113));var _0x2b09=function(_0x416359,_0xaf3934){_0x416359=_0x416359-0x0;var _0x5d3120=_0xb092[_0x416359];return _0x5d3120;};'use strict';var client=require(_0x2b09('0x0'));exports[_0x2b09('0x1')]=function(){return function(){return client['Request'](_0x2b09('0x2'),{'options':{'raw':![],'attributes':['id',_0x2b09('0x3'),_0x2b09('0x4'),_0x2b09('0x5')],'include':[{'model':_0x2b09('0x6'),'as':_0x2b09('0x7'),'attributes':['id',_0x2b09('0x3'),_0x2b09('0x8'),_0x2b09('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 2a32c9e..58bf36a 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 _0x12fd=['update','UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport'];(function(_0x150da8,_0x205fe2){var _0x3e0f9c=function(_0x2bc129){while(--_0x2bc129){_0x150da8['push'](_0x150da8['shift']());}};_0x3e0f9c(++_0x205fe2);}(_0x12fd,0x199));var _0xd12f=function(_0x51b90b,_0x51bdec){_0x51b90b=_0x51b90b-0x0;var _0x38332c=_0x12fd[_0x51b90b];return _0x38332c;};'use strict';var client=require(_0xd12f('0x0'));exports[_0xd12f('0x1')]=function(_0x718bb5){return client[_0xd12f('0x2')](_0xd12f('0x3'),{'body':_0x718bb5,'log':'CreateChatQueueReport'});};exports[_0xd12f('0x4')]=function(_0x37f6b4,_0x13efed){return client[_0xd12f('0x2')](_0xd12f('0x5'),{'body':_0x13efed,'options':{'where':{'uniqueid':_0x37f6b4},'order':[['id',_0xd12f('0x6')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xea1a=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x4e63dd,_0x588a20){var _0x119e03=function(_0x46867b){while(--_0x46867b){_0x4e63dd['push'](_0x4e63dd['shift']());}};_0x119e03(++_0x588a20);}(_0xea1a,0x158));var _0xaea1=function(_0x427534,_0x4c2692){_0x427534=_0x427534-0x0;var _0x365b3c=_0xea1a[_0x427534];return _0x365b3c;};'use strict';var client=require(_0xaea1('0x0'));exports[_0xaea1('0x1')]=function(_0xe7738c){return client[_0xaea1('0x2')]('CreateChatQueueReport',{'body':_0xe7738c,'log':_0xaea1('0x3')});};exports[_0xaea1('0x4')]=function(_0x21644a,_0x4584dd){return client[_0xaea1('0x2')](_0xaea1('0x5'),{'body':_0x4584dd,'options':{'where':{'uniqueid':_0x21644a},'order':[['id',_0xaea1('0x6')]],'limit':0x1},'log':_0xaea1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index cf49597..ccc17a1 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 _0x9120=['UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','update','Request'];(function(_0x37d4b3,_0x4fb260){var _0x5355e0=function(_0x5330cc){while(--_0x5330cc){_0x37d4b3['push'](_0x37d4b3['shift']());}};_0x5355e0(++_0x4fb260);}(_0x9120,0xe8));var _0x0912=function(_0x38272f,_0xc02c32){_0x38272f=_0x38272f-0x0;var _0x3449b8=_0x9120[_0x38272f];return _0x3449b8;};'use strict';var client=require('../client');exports[_0x0912('0x0')]=function(_0x3398b5,_0x5ef0d9){return client[_0x0912('0x1')](_0x0912('0x2'),{'body':_0x5ef0d9,'options':{'where':{'id':_0x3398b5}},'log':_0x0912('0x3')});};exports[_0x0912('0x4')]=function(_0x1ee6fb,_0x298fcf){return client[_0x0912('0x1')](_0x0912('0x5'),{'body':_0x298fcf,'options':{'where':{'id':_0x1ee6fb}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x5dae=['addTags','../client','update','Request','updateFaxInteraction'];(function(_0x48f1db,_0x554c57){var _0x27de48=function(_0x3cd347){while(--_0x3cd347){_0x48f1db['push'](_0x48f1db['shift']());}};_0x27de48(++_0x554c57);}(_0x5dae,0x7e));var _0xe5da=function(_0x3a05e0,_0x938f2b){_0x3a05e0=_0x3a05e0-0x0;var _0x131404=_0x5dae[_0x3a05e0];return _0x131404;};'use strict';var client=require(_0xe5da('0x0'));exports[_0xe5da('0x1')]=function(_0x4ee2ba,_0x4d78c8){return client[_0xe5da('0x2')]('UpdateFaxInteraction',{'body':_0x4d78c8,'options':{'where':{'id':_0x4ee2ba}},'log':_0xe5da('0x3')});};exports[_0xe5da('0x4')]=function(_0xa332d7,_0x3c6aa6){return client[_0xe5da('0x2')]('AddTagsToFaxInteraction',{'body':_0x3c6aa6,'options':{'where':{'id':_0xa332d7}},'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 2a8048e..2b5349b 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 _0xde61=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x99ed08,_0x1a1f47){var _0x26c376=function(_0x5c3a1c){while(--_0x5c3a1c){_0x99ed08['push'](_0x99ed08['shift']());}};_0x26c376(++_0x1a1f47);}(_0xde61,0x12e));var _0x1de6=function(_0x4d5c17,_0x1b1295){_0x4d5c17=_0x4d5c17-0x0;var _0x56ea0e=_0xde61[_0x4d5c17];return _0x56ea0e;};'use strict';var client=require(_0x1de6('0x0'));exports[_0x1de6('0x1')]=function(_0x3664bc){return client[_0x1de6('0x2')](_0x1de6('0x3'),{'body':_0x3664bc,'log':_0x1de6('0x4')});}; \ No newline at end of file +var _0x7944=['create','Request','createFaxMessage'];(function(_0x35d8af,_0x14fd75){var _0x1d08b0=function(_0x36b437){while(--_0x36b437){_0x35d8af['push'](_0x35d8af['shift']());}};_0x1d08b0(++_0x14fd75);}(_0x7944,0xc3));var _0x4794=function(_0x163cd0,_0x461c03){_0x163cd0=_0x163cd0-0x0;var _0x166213=_0x7944[_0x163cd0];return _0x166213;};'use strict';var client=require('../client');exports[_0x4794('0x0')]=function(_0x1668be){return client[_0x4794('0x1')]('CreateFaxMessage',{'body':_0x1668be,'log':_0x4794('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index f063c76..7178c89 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 _0x9154=['faxPause','getFaxQueues','GetFaxQueue','name','timeout','User','Agents'];(function(_0x45d7b0,_0x3e54f7){var _0x390b67=function(_0x217e17){while(--_0x217e17){_0x45d7b0['push'](_0x45d7b0['shift']());}};_0x390b67(++_0x3e54f7);}(_0x9154,0x189));var _0x4915=function(_0x119c28,_0x2554a4){_0x119c28=_0x119c28-0x0;var _0x480a53=_0x9154[_0x119c28];return _0x480a53;};'use strict';var client=require('../client');exports[_0x4915('0x0')]=function(){return function(){return client['Request'](_0x4915('0x1'),{'options':{'raw':![],'attributes':['id',_0x4915('0x2'),_0x4915('0x3'),'strategy'],'include':[{'model':_0x4915('0x4'),'as':_0x4915('0x5'),'attributes':['id',_0x4915('0x2'),'online',_0x4915('0x6')]}]},'log':_0x4915('0x0')});};}; \ No newline at end of file +var _0xdf02=['../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','online','faxPause'];(function(_0x2e35e4,_0x4a5532){var _0xbfa45e=function(_0x52aa0d){while(--_0x52aa0d){_0x2e35e4['push'](_0x2e35e4['shift']());}};_0xbfa45e(++_0x4a5532);}(_0xdf02,0x118));var _0x2df0=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xdf02[_0xc4001c];return _0x49f7bc;};'use strict';var client=require(_0x2df0('0x0'));exports[_0x2df0('0x1')]=function(){return function(){return client[_0x2df0('0x2')](_0x2df0('0x3'),{'options':{'raw':![],'attributes':['id',_0x2df0('0x4'),_0x2df0('0x5'),_0x2df0('0x6')],'include':[{'model':_0x2df0('0x7'),'as':'Agents','attributes':['id',_0x2df0('0x4'),_0x2df0('0x8'),_0x2df0('0x9')]}]},'log':_0x2df0('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index b7d229b..a495e63 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 _0x514e=['update','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport'];(function(_0x27ea94,_0x4fb196){var _0x3d5e81=function(_0x4e067c){while(--_0x4e067c){_0x27ea94['push'](_0x27ea94['shift']());}};_0x3d5e81(++_0x4fb196);}(_0x514e,0x146));var _0xe514=function(_0x25d3cb,_0x201a7d){_0x25d3cb=_0x25d3cb-0x0;var _0x53a675=_0x514e[_0x25d3cb];return _0x53a675;};'use strict';var client=require(_0xe514('0x0'));exports[_0xe514('0x1')]=function(_0x24939b){return client[_0xe514('0x2')]('CreateFaxQueueReport',{'body':_0x24939b,'log':_0xe514('0x3')});};exports[_0xe514('0x4')]=function(_0x1d0df6,_0x4430fb){return client[_0xe514('0x2')](_0xe514('0x5'),{'body':_0x4430fb,'options':{'where':{'uniqueid':_0x1d0df6},'order':[['id','DESC']],'limit':0x1},'log':_0xe514('0x5')});}; \ No newline at end of file +var _0xc651=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x440092,_0x470fc5){var _0x284ae9=function(_0x250bc9){while(--_0x250bc9){_0x440092['push'](_0x440092['shift']());}};_0x284ae9(++_0x470fc5);}(_0xc651,0x16a));var _0x1c65=function(_0x27860f,_0x572308){_0x27860f=_0x27860f-0x0;var _0x4db99b=_0xc651[_0x27860f];return _0x4db99b;};'use strict';var client=require(_0x1c65('0x0'));exports[_0x1c65('0x1')]=function(_0x9421e7){return client[_0x1c65('0x2')](_0x1c65('0x3'),{'body':_0x9421e7,'log':_0x1c65('0x3')});};exports[_0x1c65('0x4')]=function(_0x2af65b,_0x2e4d27){return client[_0x1c65('0x2')](_0x1c65('0x5'),{'body':_0x2e4d27,'options':{'where':{'uniqueid':_0x2af65b},'order':[['id',_0x1c65('0x6')]],'limit':0x1},'log':_0x1c65('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index d7672b2..9884c5c 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 _0xd7d1=['Interval','Intervals','interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x137325,_0x29920c){var _0x1bfae6=function(_0x3f8c6b){while(--_0x3f8c6b){_0x137325['push'](_0x137325['shift']());}};_0x1bfae6(++_0x29920c);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x5aa227,_0x3a939c){_0x5aa227=_0x5aa227-0x0;var _0x247f29=_0xd7d1[_0x5aa227];return _0x247f29;};'use strict';var client=require(_0x1d7d('0x0'));exports[_0x1d7d('0x1')]=function(){return function(){return client[_0x1d7d('0x2')](_0x1d7d('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x1d7d('0x4')],'include':[{'model':_0x1d7d('0x5'),'as':_0x1d7d('0x6'),'attributes':['id',_0x1d7d('0x4'),_0x1d7d('0x7')]}]},'log':_0x1d7d('0x1')});};}; \ No newline at end of file +var _0x6f2f=['Interval','interval','../client','getIntervals'];(function(_0x19a72c,_0x2229cb){var _0x3c6199=function(_0x4293e9){while(--_0x4293e9){_0x19a72c['push'](_0x19a72c['shift']());}};_0x3c6199(++_0x2229cb);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x6f2f[_0x3c8e9a];return _0x2d4c57;};'use strict';var client=require(_0xf6f2('0x0'));exports[_0xf6f2('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xf6f2('0x2'),'as':'Intervals','attributes':['id','name',_0xf6f2('0x3')]}]},'log':_0xf6f2('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 3938faa..376c4cc 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 _0x05e2=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x73dd4c,_0x432744){var _0x4320e7=function(_0x5ba5d5){while(--_0x5ba5d5){_0x73dd4c['push'](_0x73dd4c['shift']());}};_0x4320e7(++_0x432744);}(_0x05e2,0xb8));var _0x205e=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0x05e2[_0x29c261];return _0x1a9335;};'use strict';var client=require(_0x205e('0x0'));exports['update']=function(_0x427eee,_0x177367){return client['Request'](_0x205e('0x1'),{'body':_0x177367,'options':{'where':{'id':_0x427eee}},'log':_0x205e('0x2')});};exports[_0x205e('0x3')]=function(_0x3bee75,_0x2d561b){return client[_0x205e('0x4')](_0x205e('0x5'),{'body':_0x2d561b,'options':{'where':{'id':_0x3bee75}},'log':_0x205e('0x6')});}; \ No newline at end of file +var _0x41fa=['updateMailInteraction','addTags','AddTagsToMailInteraction','../client','update','Request'];(function(_0x4d733f,_0x5e61cf){var _0x6df091=function(_0x4770bb){while(--_0x4770bb){_0x4d733f['push'](_0x4d733f['shift']());}};_0x6df091(++_0x5e61cf);}(_0x41fa,0x1e9));var _0xa41f=function(_0x4bd67a,_0x4f9725){_0x4bd67a=_0x4bd67a-0x0;var _0x2be5fb=_0x41fa[_0x4bd67a];return _0x2be5fb;};'use strict';var client=require(_0xa41f('0x0'));exports[_0xa41f('0x1')]=function(_0x1de0f5,_0xb78dc8){return client[_0xa41f('0x2')]('UpdateMailInteraction',{'body':_0xb78dc8,'options':{'where':{'id':_0x1de0f5}},'log':_0xa41f('0x3')});};exports[_0xa41f('0x4')]=function(_0x5e2c0a,_0x50e5bb){return client['Request'](_0xa41f('0x5'),{'body':_0x50e5bb,'options':{'where':{'id':_0x5e2c0a}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index cf2cc4e..fdb0cb9 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 _0x8b1f=['../client','Request','CreateMailMessage','createMailMessage'];(function(_0xaffb0e,_0x45c2bb){var _0xc89c7c=function(_0x44cc7e){while(--_0x44cc7e){_0xaffb0e['push'](_0xaffb0e['shift']());}};_0xc89c7c(++_0x45c2bb);}(_0x8b1f,0xc4));var _0xf8b1=function(_0x2abc4d,_0x7ce0d9){_0x2abc4d=_0x2abc4d-0x0;var _0x4eca93=_0x8b1f[_0x2abc4d];return _0x4eca93;};'use strict';var client=require(_0xf8b1('0x0'));exports['create']=function(_0x64ba7a){return client[_0xf8b1('0x1')](_0xf8b1('0x2'),{'body':_0x64ba7a,'log':_0xf8b1('0x3')});}; \ No newline at end of file +var _0x423d=['create','CreateMailMessage','createMailMessage','../client'];(function(_0x5104a5,_0xf13b67){var _0x26e59f=function(_0x408709){while(--_0x408709){_0x5104a5['push'](_0x5104a5['shift']());}};_0x26e59f(++_0xf13b67);}(_0x423d,0x1b3));var _0xd423=function(_0x180e39,_0xd92357){_0x180e39=_0x180e39-0x0;var _0x10303b=_0x423d[_0x180e39];return _0x10303b;};'use strict';var client=require(_0xd423('0x0'));exports[_0xd423('0x1')]=function(_0x56be6c){return client['Request'](_0xd423('0x2'),{'body':_0x56be6c,'log':_0xd423('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 243f0c1..d1e912d 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 _0xb80d=['../client','getMailQueues','Request','name','User','Agents','online','mailPause'];(function(_0x3e4168,_0xb2f4b7){var _0x49ae3c=function(_0x293fdf){while(--_0x293fdf){_0x3e4168['push'](_0x3e4168['shift']());}};_0x49ae3c(++_0xb2f4b7);}(_0xb80d,0x1a8));var _0xdb80=function(_0x899a7b,_0x47f3fe){_0x899a7b=_0x899a7b-0x0;var _0x501574=_0xb80d[_0x899a7b];return _0x501574;};'use strict';var client=require(_0xdb80('0x0'));exports[_0xdb80('0x1')]=function(){return function(){return client[_0xdb80('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xdb80('0x3'),'timeout','strategy'],'include':[{'model':_0xdb80('0x4'),'as':_0xdb80('0x5'),'attributes':['id','name',_0xdb80('0x6'),_0xdb80('0x7')]}]},'log':_0xdb80('0x1')});};}; \ No newline at end of file +var _0xe3f4=['online','mailPause','../client','getMailQueues','timeout','User','Agents','name'];(function(_0x4ff7fc,_0x1ab55d){var _0x15e400=function(_0x4ca58e){while(--_0x4ca58e){_0x4ff7fc['push'](_0x4ff7fc['shift']());}};_0x15e400(++_0x1ab55d);}(_0xe3f4,0x1ca));var _0x4e3f=function(_0x278a43,_0x37c203){_0x278a43=_0x278a43-0x0;var _0x5a63c8=_0xe3f4[_0x278a43];return _0x5a63c8;};'use strict';var client=require(_0x4e3f('0x0'));exports[_0x4e3f('0x1')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0x4e3f('0x2'),'strategy'],'include':[{'model':_0x4e3f('0x3'),'as':_0x4e3f('0x4'),'attributes':['id',_0x4e3f('0x5'),_0x4e3f('0x6'),_0x4e3f('0x7')]}]},'log':_0x4e3f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 674bbee..d6ecd2b 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 _0x2225=['DESC','../client','Request','CreateMailQueueReport'];(function(_0x58246c,_0x58d989){var _0x2dc3ab=function(_0x3f3b6a){while(--_0x3f3b6a){_0x58246c['push'](_0x58246c['shift']());}};_0x2dc3ab(++_0x58d989);}(_0x2225,0xe5));var _0x5222=function(_0x20cbdc,_0xe600f5){_0x20cbdc=_0x20cbdc-0x0;var _0x5e7312=_0x2225[_0x20cbdc];return _0x5e7312;};'use strict';var client=require(_0x5222('0x0'));exports['create']=function(_0x27df3a){return client[_0x5222('0x1')](_0x5222('0x2'),{'body':_0x27df3a,'log':_0x5222('0x2')});};exports['update']=function(_0x34e927,_0x32e7ee){return client['Request']('UpdateMailQueueReport',{'body':_0x32e7ee,'options':{'where':{'uniqueid':_0x34e927},'order':[['id',_0x5222('0x3')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x8e1b=['CreateMailQueueReport','update','DESC','../client','create','Request'];(function(_0x5219aa,_0x357da6){var _0x479261=function(_0x552e4e){while(--_0x552e4e){_0x5219aa['push'](_0x5219aa['shift']());}};_0x479261(++_0x357da6);}(_0x8e1b,0x165));var _0xb8e1=function(_0xc33905,_0x3fa99b){_0xc33905=_0xc33905-0x0;var _0x7d4df6=_0x8e1b[_0xc33905];return _0x7d4df6;};'use strict';var client=require(_0xb8e1('0x0'));exports[_0xb8e1('0x1')]=function(_0x37a2f2){return client[_0xb8e1('0x2')](_0xb8e1('0x3'),{'body':_0x37a2f2,'log':'CreateMailQueueReport'});};exports[_0xb8e1('0x4')]=function(_0x2180b2,_0x2ad1b7){return client['Request']('UpdateMailQueueReport',{'body':_0x2ad1b7,'options':{'where':{'uniqueid':_0x2180b2},'order':[['id',_0xb8e1('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 7adfdbe..4ef4171 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 _0xd04a=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x165d7f,_0x2cab71){var _0xd3c44=function(_0xbf493a){while(--_0xbf493a){_0x165d7f['push'](_0x165d7f['shift']());}};_0xd3c44(++_0x2cab71);}(_0xd04a,0x94));var _0xad04=function(_0x4ab93a,_0x287eda){_0x4ab93a=_0x4ab93a-0x0;var _0x1bc7b9=_0xd04a[_0x4ab93a];return _0x1bc7b9;};'use strict';var client=require(_0xad04('0x0'));exports[_0xad04('0x1')]=function(_0x4e4b2b,_0x375d1f){return client[_0xad04('0x2')](_0xad04('0x3'),{'body':_0x375d1f,'options':{'where':{'id':_0x4e4b2b}},'log':'updateOpenchannelInteraction'});};exports[_0xad04('0x4')]=function(_0x318c09,_0x4b5c37){return client[_0xad04('0x2')](_0xad04('0x5'),{'body':_0x4b5c37,'options':{'where':{'id':_0x318c09}},'log':_0xad04('0x6')});}; \ No newline at end of file +var _0x5b24=['UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','update','Request'];(function(_0x22de93,_0x175f6e){var _0xcd801=function(_0x23ea7e){while(--_0x23ea7e){_0x22de93['push'](_0x22de93['shift']());}};_0xcd801(++_0x175f6e);}(_0x5b24,0x1f2));var _0x45b2=function(_0x5cf94d,_0x3e9b52){_0x5cf94d=_0x5cf94d-0x0;var _0x3242a6=_0x5b24[_0x5cf94d];return _0x3242a6;};'use strict';var client=require('../client');exports[_0x45b2('0x0')]=function(_0xfc302,_0x121f36){return client[_0x45b2('0x1')](_0x45b2('0x2'),{'body':_0x121f36,'options':{'where':{'id':_0xfc302}},'log':'updateOpenchannelInteraction'});};exports[_0x45b2('0x3')]=function(_0x1d2809,_0x5e90d1){return client[_0x45b2('0x1')](_0x45b2('0x4'),{'body':_0x5e90d1,'options':{'where':{'id':_0x1d2809}},'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 4717594..4bf70ee 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 _0x750a=['CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0xaced19,_0x4fa58f){var _0x352cda=function(_0x26e45f){while(--_0x26e45f){_0xaced19['push'](_0xaced19['shift']());}};_0x352cda(++_0x4fa58f);}(_0x750a,0x140));var _0xa750=function(_0x407749,_0x4aa96b){_0x407749=_0x407749-0x0;var _0x5e1b0d=_0x750a[_0x407749];return _0x5e1b0d;};'use strict';var client=require('../client');exports[_0xa750('0x0')]=function(_0x5368b2){return client['Request'](_0xa750('0x1'),{'body':_0x5368b2,'log':_0xa750('0x2')});}; \ No newline at end of file +var _0xb821=['createOpenchannelMessage','create'];(function(_0x2a5455,_0x3a0f17){var _0x5c5ea0=function(_0x2d4be5){while(--_0x2d4be5){_0x2a5455['push'](_0x2a5455['shift']());}};_0x5c5ea0(++_0x3a0f17);}(_0xb821,0xa7));var _0x1b82=function(_0x3d31fa,_0x566a6c){_0x3d31fa=_0x3d31fa-0x0;var _0x450c6c=_0xb821[_0x3d31fa];return _0x450c6c;};'use strict';var client=require('../client');exports[_0x1b82('0x0')]=function(_0x4f6190){return client['Request']('CreateOpenchannelMessage',{'body':_0x4f6190,'log':_0x1b82('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 2113208..26554a7 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 _0xc398=['name','strategy','User','Agents','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue'];(function(_0x27a0b3,_0x461d16){var _0x24df43=function(_0x3b81b7){while(--_0x3b81b7){_0x27a0b3['push'](_0x27a0b3['shift']());}};_0x24df43(++_0x461d16);}(_0xc398,0x19d));var _0x8c39=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0xc398[_0x1344d6];return _0xf45b24;};'use strict';var client=require(_0x8c39('0x0'));exports[_0x8c39('0x1')]=function(){return function(){return client['Request'](_0x8c39('0x2'),{'options':{'raw':![],'attributes':['id',_0x8c39('0x3'),'timeout',_0x8c39('0x4')],'include':[{'model':_0x8c39('0x5'),'as':_0x8c39('0x6'),'attributes':['id',_0x8c39('0x3'),'online',_0x8c39('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x9937=['GetOpenchannelQueue','name','timeout','User','online','../client','getOpenchannelQueues','Request'];(function(_0x4627ef,_0x3a385f){var _0x16ca04=function(_0x29c71f){while(--_0x29c71f){_0x4627ef['push'](_0x4627ef['shift']());}};_0x16ca04(++_0x3a385f);}(_0x9937,0x1ed));var _0x7993=function(_0x1f7916,_0x8b7355){_0x1f7916=_0x1f7916-0x0;var _0x39ad22=_0x9937[_0x1f7916];return _0x39ad22;};'use strict';var client=require(_0x7993('0x0'));exports[_0x7993('0x1')]=function(){return function(){return client[_0x7993('0x2')](_0x7993('0x3'),{'options':{'raw':![],'attributes':['id',_0x7993('0x4'),_0x7993('0x5'),'strategy'],'include':[{'model':_0x7993('0x6'),'as':'Agents','attributes':['id',_0x7993('0x4'),_0x7993('0x7'),'openchannelPause']}]},'log':_0x7993('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 1f01361..599a06e 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 _0x4292=['CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','create','Request'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x4292,0x14e));var _0x2429=function(_0x1ed198,_0x27f904){_0x1ed198=_0x1ed198-0x0;var _0x42507d=_0x4292[_0x1ed198];return _0x42507d;};'use strict';var client=require('../client');exports[_0x2429('0x0')]=function(_0x256c7e){return client[_0x2429('0x1')]('CreateOpenchannelQueueReport',{'body':_0x256c7e,'log':_0x2429('0x2')});};exports[_0x2429('0x3')]=function(_0x3630df,_0x5f432c){return client[_0x2429('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x5f432c,'options':{'where':{'uniqueid':_0x3630df},'order':[['id',_0x2429('0x4')]],'limit':0x1},'log':_0x2429('0x5')});}; \ No newline at end of file +var _0x316e=['DESC','../client','create','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0x316e,0x1d5));var _0xe316=function(_0x5a2c5e,_0x4acfa8){_0x5a2c5e=_0x5a2c5e-0x0;var _0x919b31=_0x316e[_0x5a2c5e];return _0x919b31;};'use strict';var client=require(_0xe316('0x0'));exports[_0xe316('0x1')]=function(_0x20815c){return client['Request'](_0xe316('0x2'),{'body':_0x20815c,'log':_0xe316('0x2')});};exports[_0xe316('0x3')]=function(_0x45e1a0,_0x9e220){return client['Request'](_0xe316('0x4'),{'body':_0x9e220,'options':{'where':{'uniqueid':_0x45e1a0},'order':[['id',_0xe316('0x5')]],'limit':0x1},'log':_0xe316('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 74924cb..bde755b 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 _0x1197=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1197,0x1ad));var _0x7119=function(_0x261046,_0x248b70){_0x261046=_0x261046-0x0;var _0x490dd7=_0x1197[_0x261046];return _0x490dd7;};'use strict';var client=require(_0x7119('0x0'));exports[_0x7119('0x1')]=function(_0x995aa3,_0x4a7bb9){return client['Request'](_0x7119('0x2'),{'body':_0x4a7bb9,'options':{'where':{'id':_0x995aa3}},'log':_0x7119('0x3')});};exports['addTags']=function(_0x155cd3,_0x42b206){return client[_0x7119('0x4')](_0x7119('0x5'),{'body':_0x42b206,'options':{'where':{'id':_0x155cd3}},'log':_0x7119('0x6')});}; \ No newline at end of file +var _0x7fa1=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x1f8541,_0x478be6){var _0x58d505=function(_0x4ad5c3){while(--_0x4ad5c3){_0x1f8541['push'](_0x1f8541['shift']());}};_0x58d505(++_0x478be6);}(_0x7fa1,0x9d));var _0x17fa=function(_0x61c065,_0xc8f703){_0x61c065=_0x61c065-0x0;var _0x367152=_0x7fa1[_0x61c065];return _0x367152;};'use strict';var client=require(_0x17fa('0x0'));exports[_0x17fa('0x1')]=function(_0x23bae2,_0x4a1586){return client[_0x17fa('0x2')](_0x17fa('0x3'),{'body':_0x4a1586,'options':{'where':{'id':_0x23bae2}},'log':_0x17fa('0x4')});};exports[_0x17fa('0x5')]=function(_0x117837,_0x36b3bd){return client[_0x17fa('0x2')](_0x17fa('0x6'),{'body':_0x36b3bd,'options':{'where':{'id':_0x117837}},'log':_0x17fa('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 35d4ece..8dbb7f7 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 _0x1b8c=['../client','createSmsMessage'];(function(_0x2f1022,_0x3d101f){var _0x1b0977=function(_0x33a204){while(--_0x33a204){_0x2f1022['push'](_0x2f1022['shift']());}};_0x1b0977(++_0x3d101f);}(_0x1b8c,0x130));var _0xc1b8=function(_0x1178fb,_0x4658ed){_0x1178fb=_0x1178fb-0x0;var _0x51395d=_0x1b8c[_0x1178fb];return _0x51395d;};'use strict';var client=require(_0xc1b8('0x0'));exports['create']=function(_0x143375){return client['Request']('CreateSmsMessage',{'body':_0x143375,'log':_0xc1b8('0x1')});}; \ No newline at end of file +var _0xbe02=['Request','createSmsMessage','../client','create'];(function(_0x12d812,_0x496bb7){var _0x3711ab=function(_0x3259da){while(--_0x3259da){_0x12d812['push'](_0x12d812['shift']());}};_0x3711ab(++_0x496bb7);}(_0xbe02,0x146));var _0x2be0=function(_0x338a80,_0x5ca727){_0x338a80=_0x338a80-0x0;var _0x6ac41d=_0xbe02[_0x338a80];return _0x6ac41d;};'use strict';var client=require(_0x2be0('0x0'));exports[_0x2be0('0x1')]=function(_0x20d2b7){return client[_0x2be0('0x2')]('CreateSmsMessage',{'body':_0x20d2b7,'log':_0x2be0('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index f51b998..1c89214 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 _0xf130=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','User','online','smsPause','../client'];(function(_0x5d09db,_0x2127f1){var _0x455781=function(_0x55c7c6){while(--_0x55c7c6){_0x5d09db['push'](_0x5d09db['shift']());}};_0x455781(++_0x2127f1);}(_0xf130,0x149));var _0x0f13=function(_0x21a9ad,_0x1d3ea9){_0x21a9ad=_0x21a9ad-0x0;var _0x4389cb=_0xf130[_0x21a9ad];return _0x4389cb;};'use strict';var client=require(_0x0f13('0x0'));exports[_0x0f13('0x1')]=function(){return function(){return client[_0x0f13('0x2')](_0x0f13('0x3'),{'options':{'raw':![],'attributes':['id',_0x0f13('0x4'),_0x0f13('0x5'),_0x0f13('0x6')],'include':[{'model':_0x0f13('0x7'),'as':'Agents','attributes':['id',_0x0f13('0x4'),_0x0f13('0x8'),_0x0f13('0x9')]}]},'log':_0x0f13('0x1')});};}; \ No newline at end of file +var _0x986b=['getSmsQueues','Request','strategy','User','Agents','name','../client'];(function(_0x3451da,_0x1d161f){var _0x5f25a3=function(_0x43df41){while(--_0x43df41){_0x3451da['push'](_0x3451da['shift']());}};_0x5f25a3(++_0x1d161f);}(_0x986b,0x156));var _0xb986=function(_0x74a3e5,_0x3fe04b){_0x74a3e5=_0x74a3e5-0x0;var _0xbc600a=_0x986b[_0x74a3e5];return _0xbc600a;};'use strict';var client=require(_0xb986('0x0'));exports[_0xb986('0x1')]=function(){return function(){return client[_0xb986('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0xb986('0x3')],'include':[{'model':_0xb986('0x4'),'as':_0xb986('0x5'),'attributes':['id',_0xb986('0x6'),'online','smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index c371b67..1e5bd05 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 _0x0f46=['update','UpdateSmsQueueReport','DESC','../client','create','Request'];(function(_0x1c1067,_0x6a9c54){var _0x4f11aa=function(_0x26a62f){while(--_0x26a62f){_0x1c1067['push'](_0x1c1067['shift']());}};_0x4f11aa(++_0x6a9c54);}(_0x0f46,0x1a1));var _0x60f4=function(_0x1a3ca9,_0x49a10f){_0x1a3ca9=_0x1a3ca9-0x0;var _0x12fbf7=_0x0f46[_0x1a3ca9];return _0x12fbf7;};'use strict';var client=require(_0x60f4('0x0'));exports[_0x60f4('0x1')]=function(_0x406894){return client[_0x60f4('0x2')]('CreateSmsQueueReport',{'body':_0x406894,'log':'CreateSmsQueueReport'});};exports[_0x60f4('0x3')]=function(_0x4e30a9,_0x37e5d8){return client[_0x60f4('0x2')](_0x60f4('0x4'),{'body':_0x37e5d8,'options':{'where':{'uniqueid':_0x4e30a9},'order':[['id',_0x60f4('0x5')]],'limit':0x1},'log':_0x60f4('0x4')});}; \ No newline at end of file +var _0x9563=['CreateSmsQueueReport','update','DESC','UpdateSmsQueueReport','../client','create','Request'];(function(_0x1d3a51,_0x3e6cf2){var _0xc8d110=function(_0x596199){while(--_0x596199){_0x1d3a51['push'](_0x1d3a51['shift']());}};_0xc8d110(++_0x3e6cf2);}(_0x9563,0x1e7));var _0x3956=function(_0x12afda,_0x308568){_0x12afda=_0x12afda-0x0;var _0x904f33=_0x9563[_0x12afda];return _0x904f33;};'use strict';var client=require(_0x3956('0x0'));exports[_0x3956('0x1')]=function(_0x515fbe){return client[_0x3956('0x2')](_0x3956('0x3'),{'body':_0x515fbe,'log':_0x3956('0x3')});};exports[_0x3956('0x4')]=function(_0x5c89e9,_0x58382b){return client[_0x3956('0x2')]('UpdateSmsQueueReport',{'body':_0x58382b,'options':{'where':{'uniqueid':_0x5c89e9},'order':[['id',_0x3956('0x5')]],'limit':0x1},'log':_0x3956('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 01d06bb..357633d 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 _0x9773=['online','lastPauseAt','voicePause','chatPause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','../client','Request','agent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9773,0x1bf));var _0x3977=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9773[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x3977('0x0'));exports['getAgents']=function(){return function(){return client[_0x3977('0x1')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x3977('0x2')},'attributes':['id','name',_0x3977('0x3'),'pauseType',_0x3977('0x4'),_0x3977('0x5'),_0x3977('0x6'),'mailPause',_0x3977('0x7'),_0x3977('0x8'),_0x3977('0x9'),_0x3977('0xa'),_0x3977('0xb'),_0x3977('0xc'),_0x3977('0xd'),_0x3977('0xe'),_0x3977('0xf'),_0x3977('0x10')]},'log':_0x3977('0x11')});};}; \ No newline at end of file +var _0x15fe=['faxPause','smsPause','chatCapacity','mailCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','agent','name','pauseType','lastPauseAt','voicePause','chatPause','mailPause'];(function(_0x58ecb4,_0x2c03c4){var _0x4b2adc=function(_0x1f4ac0){while(--_0x1f4ac0){_0x58ecb4['push'](_0x58ecb4['shift']());}};_0x4b2adc(++_0x2c03c4);}(_0x15fe,0x1a6));var _0xe15f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x15fe[_0x397e5f];return _0x5302b8;};'use strict';var client=require(_0xe15f('0x0'));exports[_0xe15f('0x1')]=function(){return function(){return client[_0xe15f('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0xe15f('0x3')},'attributes':['id',_0xe15f('0x4'),'online',_0xe15f('0x5'),_0xe15f('0x6'),_0xe15f('0x7'),_0xe15f('0x8'),_0xe15f('0x9'),_0xe15f('0xa'),_0xe15f('0xb'),'whatsappPause','openchannelPause',_0xe15f('0xc'),_0xe15f('0xd'),'faxCapacity',_0xe15f('0xe'),'whatsappCapacity',_0xe15f('0xf')]},'log':_0xe15f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 157b489..16094c6 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 _0x34e8=['update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','../client'];(function(_0x425b1b,_0x5556d5){var _0x201ff0=function(_0x13801f){while(--_0x13801f){_0x425b1b['push'](_0x425b1b['shift']());}};_0x201ff0(++_0x5556d5);}(_0x34e8,0x12c));var _0x834e=function(_0x269dea,_0x482f69){_0x269dea=_0x269dea-0x0;var _0x7714b7=_0x34e8[_0x269dea];return _0x7714b7;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339,_0x35e6fb){return client['Request'](_0x834e('0x2'),{'body':_0x35e6fb,'options':{'where':{'id':_0x8b339}},'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x31bf20,_0x289ef2){return client[_0x834e('0x5')](_0x834e('0x6'),{'body':_0x289ef2,'options':{'where':{'id':_0x31bf20}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x2821=['addTags','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x2821,0x87));var _0x1282=function(_0x4480f3,_0x359f64){_0x4480f3=_0x4480f3-0x0;var _0xe35398=_0x2821[_0x4480f3];return _0xe35398;};'use strict';var client=require(_0x1282('0x0'));exports[_0x1282('0x1')]=function(_0x333849,_0x356903){return client[_0x1282('0x2')](_0x1282('0x3'),{'body':_0x356903,'options':{'where':{'id':_0x333849}},'log':_0x1282('0x4')});};exports[_0x1282('0x5')]=function(_0x3f5e68,_0x7c8e0f){return client[_0x1282('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x7c8e0f,'options':{'where':{'id':_0x3f5e68}},'log':_0x1282('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 37912bc..f1708db 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 _0x1548=['createWhatsappMessage','../client','CreateWhatsappMessage'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0x1548,0x11b));var _0x8154=function(_0x29ca69,_0x418fdc){_0x29ca69=_0x29ca69-0x0;var _0x341711=_0x1548[_0x29ca69];return _0x341711;};'use strict';var client=require(_0x8154('0x0'));exports['create']=function(_0x4c1f82){return client['Request'](_0x8154('0x1'),{'body':_0x4c1f82,'log':_0x8154('0x2')});}; \ No newline at end of file +var _0x2c0e=['create','Request','CreateWhatsappMessage','../client'];(function(_0x1c64b0,_0x57d581){var _0x11ac72=function(_0x1562fd){while(--_0x1562fd){_0x1c64b0['push'](_0x1c64b0['shift']());}};_0x11ac72(++_0x57d581);}(_0x2c0e,0x127));var _0xe2c0=function(_0x8550ba,_0x57c10d){_0x8550ba=_0x8550ba-0x0;var _0x432399=_0x2c0e[_0x8550ba];return _0x432399;};'use strict';var client=require(_0xe2c0('0x0'));exports[_0xe2c0('0x1')]=function(_0x15931d){return client[_0xe2c0('0x2')](_0xe2c0('0x3'),{'body':_0x15931d,'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 763c21e..8e8cd3f 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 _0x1be1=['strategy','User','Agents','online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','timeout'];(function(_0xae9fcc,_0x122d28){var _0x42edbf=function(_0x2d44fe){while(--_0x2d44fe){_0xae9fcc['push'](_0xae9fcc['shift']());}};_0x42edbf(++_0x122d28);}(_0x1be1,0x192));var _0x11be=function(_0x114d7a,_0x558c8f){_0x114d7a=_0x114d7a-0x0;var _0x2d8f1a=_0x1be1[_0x114d7a];return _0x2d8f1a;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x11be('0x0')](_0x11be('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x11be('0x2'),_0x11be('0x3')],'include':[{'model':_0x11be('0x4'),'as':_0x11be('0x5'),'attributes':['id','name',_0x11be('0x6'),_0x11be('0x7')]}]},'log':_0x11be('0x8')});};}; \ No newline at end of file +var _0x750a=['getWhatsappQueues','name','timeout','strategy','User','Agents','online','whatsappPause'];(function(_0x5ec8fe,_0x5d5799){var _0x2964b3=function(_0xc94c00){while(--_0xc94c00){_0x5ec8fe['push'](_0x5ec8fe['shift']());}};_0x2964b3(++_0x5d5799);}(_0x750a,0x140));var _0xa750=function(_0x2971ec,_0x1b8e64){_0x2971ec=_0x2971ec-0x0;var _0x404bdf=_0x750a[_0x2971ec];return _0x404bdf;};'use strict';var client=require('../client');exports[_0xa750('0x0')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xa750('0x1'),_0xa750('0x2'),_0xa750('0x3')],'include':[{'model':_0xa750('0x4'),'as':_0xa750('0x5'),'attributes':['id',_0xa750('0x1'),_0xa750('0x6'),_0xa750('0x7')]}]},'log':_0xa750('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index cbf9d62..1b2b858 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 _0xd6dc=['Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC'];(function(_0x1b710d,_0x3317b2){var _0x23397e=function(_0x2b48ab){while(--_0x2b48ab){_0x1b710d['push'](_0x1b710d['shift']());}};_0x23397e(++_0x3317b2);}(_0xd6dc,0x184));var _0xcd6d=function(_0x4148e0,_0x1e9ceb){_0x4148e0=_0x4148e0-0x0;var _0x26af68=_0xd6dc[_0x4148e0];return _0x26af68;};'use strict';var client=require('../client');exports['create']=function(_0x53f5c7){return client[_0xcd6d('0x0')](_0xcd6d('0x1'),{'body':_0x53f5c7,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0xf7cf93,_0x4544b0){return client['Request'](_0xcd6d('0x2'),{'body':_0x4544b0,'options':{'where':{'uniqueid':_0xf7cf93},'order':[['id',_0xcd6d('0x3')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x33e5=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create'];(function(_0x313ef4,_0x4fccd2){var _0x5ab0b5=function(_0x41b7b6){while(--_0x41b7b6){_0x313ef4['push'](_0x313ef4['shift']());}};_0x5ab0b5(++_0x4fccd2);}(_0x33e5,0xcb));var _0x533e=function(_0x137683,_0x5b50ee){_0x137683=_0x137683-0x0;var _0x103d70=_0x33e5[_0x137683];return _0x103d70;};'use strict';var client=require('../client');exports[_0x533e('0x0')]=function(_0x430848){return client[_0x533e('0x1')](_0x533e('0x2'),{'body':_0x430848,'log':_0x533e('0x2')});};exports[_0x533e('0x3')]=function(_0x56978a,_0x1859e0){return client['Request'](_0x533e('0x4'),{'body':_0x1859e0,'options':{'where':{'uniqueid':_0x56978a},'order':[['id',_0x533e('0x5')]],'limit':0x1},'log':_0x533e('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 ce60dc6..b8bf689 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 _0x5a25=['stack','validate','lodash','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','length','map','join','stop','agents','timeout','atimeout','channel','START:%s','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','error'];(function(_0x202d1a,_0x1c7f55){var _0x5c789f=function(_0x172696){while(--_0x172696){_0x202d1a['push'](_0x202d1a['shift']());}};_0x5c789f(++_0x1c7f55);}(_0x5a25,0xcc));var _0x55a2=function(_0x46af7e,_0x3e32c7){_0x46af7e=_0x46af7e-0x0;var _0x4c0447=_0x5a25[_0x46af7e];return _0x4c0447;};'use strict';var schema=require(_0x55a2('0x0'));var _=require(_0x55a2('0x1'));var util=require('util');var seqqueue=require(_0x55a2('0x2'));var logger=require(_0x55a2('0x3'))(_0x55a2('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x55a2('0x5')},'timeout':{'type':_0x55a2('0x6'),'message':_0x55a2('0x7')}});function writeLog(_0x19b439,_0x1a47a7,_0x230aff){return logger[_0x55a2('0x8')](util[_0x55a2('0x9')](_0x55a2('0xa'),_0x19b439,_0x1a47a7[_0x55a2('0xb')],_0x230aff));}function handleFindAgent(_0x1d775e){return function(_0x36b79c){return _0x36b79c['name']['toLowerCase']()===_0x1d775e['toLowerCase']();};}exports['consequence']=function(_0x7cd665,_0x220c36,_0x524253,_0x478ff5){return function(_0x49ae84){try{var _0x226675={'name':_0x220c36[0x0],'timeout':_0x220c36[0x1]};var _0x4556b5=queue[_0x55a2('0x0')](_0x226675,{'typecast':!![]});if(_0x4556b5[_0x55a2('0xc')]){logger['error']('[%s][AGENT]\x20%s',_0x7cd665,_[_0x55a2('0xd')](_0x4556b5,'message')[_0x55a2('0xe')](',\x20'));_0x49ae84[_0x55a2('0xf')]();}else{var _0x5f59d2=_['find'](_0x524253[_0x55a2('0x10')],handleFindAgent(_0x226675[_0x55a2('0xb')]));if(_0x5f59d2){var _0x458349=(_0x226675[_0x55a2('0x11')]||0xa)*0x3e8;var _0x801dde,_0xd28799;var _0x37e797=seqqueue['createQueue'](_0x458349);_0x37e797['id']=_0x7cd665;_0x37e797[_0x55a2('0x12')]=_0x458349;_0x37e797[_0x55a2('0x13')]=_0x478ff5[_0x55a2('0x13')];writeLog(_0x7cd665,_0x5f59d2,util[_0x55a2('0x9')](_0x55a2('0x14'),_0x458349));_0x524253[_0x55a2('0x15')][_0x7cd665]['on'](_0x55a2('0x16'),function(){logger[_0x55a2('0x8')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x7cd665);clearTimeout(_0xd28799);_0xd28799=undefined;_0x37e797[_0x55a2('0x17')]();if(_0x524253[_0x55a2('0x15')][_0x7cd665]){delete _0x524253['rules'][_0x7cd665];}_0x49ae84[_0x55a2('0xf')]();});_0x524253[_0x55a2('0x15')][_0x7cd665]['on'](_0x55a2('0x18'),function(){if(_0x524253[_0x55a2('0x15')][_0x7cd665]){delete _0x524253[_0x55a2('0x15')][_0x7cd665];}});_0xd28799=setTimeout(function(){logger[_0x55a2('0x8')](_0x55a2('0x19'),_0x7cd665);clearTimeout(_0xd28799);_0x37e797[_0x55a2('0x17')]();_0x49ae84['next']();},_0x458349);strategy['agent'](_0x37e797,_0x5f59d2,_0x524253,_0x478ff5);}else{logger['error'](_0x55a2('0x1a'),_0x7cd665,_0x226675[_0x55a2('0xb')]);_0x49ae84[_0x55a2('0xf')]();}}}catch(_0x5f7cff){console['log'](_0x5f7cff);logger[_0x55a2('0x1b')]('[%s][QUEUE]\x20%s',_0x7cd665,_0x5f7cff[_0x55a2('0x1c')]);_0x49ae84[_0x55a2('0xf')]();}};}; \ No newline at end of file +var _0xf5bf=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','join','stop','find','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent'];(function(_0x4a5312,_0x6cf5db){var _0x3b5f28=function(_0x30bcf9){while(--_0x30bcf9){_0x4a5312['push'](_0x4a5312['shift']());}};_0x3b5f28(++_0x6cf5db);}(_0xf5bf,0xed));var _0xff5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5bf[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xff5b('0x0'));var _=require(_0xff5b('0x1'));var util=require(_0xff5b('0x2'));var seqqueue=require(_0xff5b('0x3'));var logger=require(_0xff5b('0x4'))('routing');var strategy=require(_0xff5b('0x5'));var queue=schema({'name':{'type':_0xff5b('0x6'),'required':!![],'message':_0xff5b('0x7')},'timeout':{'type':_0xff5b('0x8'),'message':_0xff5b('0x9')}});function writeLog(_0x2b53d6,_0x338b4f,_0x573591){return logger[_0xff5b('0xa')](util[_0xff5b('0xb')](_0xff5b('0xc'),_0x2b53d6,_0x338b4f[_0xff5b('0xd')],_0x573591));}function handleFindAgent(_0xbe272c){return function(_0x5a387a){return _0x5a387a[_0xff5b('0xd')][_0xff5b('0xe')]()===_0xbe272c[_0xff5b('0xe')]();};}exports[_0xff5b('0xf')]=function(_0x3eb079,_0x2312b7,_0x1eff24,_0x1a92b1){return function(_0x76b908){try{var _0x1d94a8={'name':_0x2312b7[0x0],'timeout':_0x2312b7[0x1]};var _0x162604=queue[_0xff5b('0x0')](_0x1d94a8,{'typecast':!![]});if(_0x162604[_0xff5b('0x10')]){logger[_0xff5b('0x11')]('[%s][AGENT]\x20%s',_0x3eb079,_[_0xff5b('0x12')](_0x162604,_0xff5b('0x13'))[_0xff5b('0x14')](',\x20'));_0x76b908[_0xff5b('0x15')]();}else{var _0x1e8171=_[_0xff5b('0x16')](_0x1eff24['agents'],handleFindAgent(_0x1d94a8[_0xff5b('0xd')]));if(_0x1e8171){var _0x9010db=(_0x1d94a8[_0xff5b('0x17')]||0xa)*0x3e8;var _0x57ec83,_0x10ad93;var _0x28b674=seqqueue[_0xff5b('0x18')](_0x9010db);_0x28b674['id']=_0x3eb079;_0x28b674[_0xff5b('0x19')]=_0x9010db;_0x28b674['channel']=_0x1a92b1[_0xff5b('0x1a')];writeLog(_0x3eb079,_0x1e8171,util[_0xff5b('0xb')](_0xff5b('0x1b'),_0x9010db));_0x1eff24[_0xff5b('0x1c')][_0x3eb079]['on'](_0xff5b('0x1d'),function(){logger['info'](_0xff5b('0x1e'),_0x3eb079);clearTimeout(_0x10ad93);_0x10ad93=undefined;_0x28b674['close']();if(_0x1eff24['rules'][_0x3eb079]){delete _0x1eff24[_0xff5b('0x1c')][_0x3eb079];}_0x76b908['stop']();});_0x1eff24[_0xff5b('0x1c')][_0x3eb079]['on'](_0xff5b('0x1f'),function(){if(_0x1eff24[_0xff5b('0x1c')][_0x3eb079]){delete _0x1eff24['rules'][_0x3eb079];}});_0x10ad93=setTimeout(function(){logger[_0xff5b('0xa')](_0xff5b('0x20'),_0x3eb079);clearTimeout(_0x10ad93);_0x28b674[_0xff5b('0x21')]();_0x76b908[_0xff5b('0x22')]();},_0x9010db);strategy[_0xff5b('0x23')](_0x28b674,_0x1e8171,_0x1eff24,_0x1a92b1);}else{logger[_0xff5b('0x11')](_0xff5b('0x24'),_0x3eb079,_0x1d94a8[_0xff5b('0xd')]);_0x76b908[_0xff5b('0x15')]();}}}catch(_0x4873d0){console['log'](_0x4873d0);logger[_0xff5b('0x11')](_0xff5b('0x25'),_0x3eb079,_0x4873d0[_0xff5b('0x26')]);_0x76b908[_0xff5b('0x15')]();}};}; \ 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 55d877c..301fb07 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 _0x1261=['error','amazonlex','Message','then','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','create','catch','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','postText'];(function(_0x46f336,_0x12fe9b){var _0x40addc=function(_0x3feacd){while(--_0x3feacd){_0x46f336['push'](_0x46f336['shift']());}};_0x40addc(++_0x12fe9b);}(_0x1261,0x144));var _0x1126=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x1261[_0x50bf5a];return _0x4ddc1d;};'use strict';var _=require('lodash');var moment=require(_0x1126('0x0'));var AWS=require(_0x1126('0x1'));var utils=require(_0x1126('0x2'));var logger=require(_0x1126('0x3'))(_0x1126('0x4'));var rpc={'chatMessage':require(_0x1126('0x5')),'openchannelMessage':require(_0x1126('0x6')),'mailMessage':require(_0x1126('0x7')),'smsMessage':require(_0x1126('0x8')),'faxMessage':require(_0x1126('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x40ba58,_0x907180){return function(_0x4f239c){try{if(!_[_0x1126('0xa')](this[_0x1126('0xb')][_0x1126('0xc')])){logger[_0x1126('0xd')](_0x1126('0xe'),_0x40ba58,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4f239c[_0x1126('0xf')]();}var _0x18dbe6={'ContactId':this[_0x1126('0x10')]['id'],'sentAt':moment()['format'](_0x1126('0x11')),'direction':'out'};var _0x52ef15=this[_0x1126('0x12')];if(_0x52ef15==='chat'){_0x18dbe6[_0x1126('0x13')]=this[_0x1126('0x14')]['id'];}else{_0x18dbe6[_[_0x1126('0x15')](_0x52ef15)+_0x1126('0x16')]=this[_0x1126('0x14')]['id'];}_0x18dbe6[_[_0x1126('0x15')](_0x52ef15)+_0x1126('0x17')]=this[_0x1126('0xb')]['id'];if(this[_0x1126('0xb')]['created']){var _0x5de9a7=_0x907180[0x4];if(!_[_0x1126('0x18')](_0x5de9a7)){_0x18dbe6[_0x1126('0x19')]=utils[_0x1126('0x1a')](_0x5de9a7,this);return rpc[_0x52ef15+'Message'][_0x1126('0x1b')](_0x18dbe6)['then'](function(_0x35fe9f){logger[_0x1126('0xd')](_0x1126('0xe'),_0x40ba58,_0x18dbe6['body']);})[_0x1126('0x1c')](function(_0x1695f6){logger['error']('[%s][AMAZONLEX]\x20%s',_0x40ba58,JSON[_0x1126('0x1d')](_0x1695f6));})[_0x1126('0x1e')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x40ba58);_0x4f239c[_0x1126('0x1f')]();});}else{logger['info'](_0x1126('0x20'),_0x40ba58);_0x4f239c[_0x1126('0x1f')]();}}else{var _0x2f70ac=this;var _0x54400a=new AWS[(_0x1126('0x21'))]({'accessKeyId':_0x907180[0x0],'secretAccessKey':_0x907180[0x1],'region':_0x907180[0x2]});var _0x49d209={'botAlias':'$LATEST','botName':_0x907180[0x3],'inputText':this[_0x1126('0x22')][_0x1126('0x19')],'userId':this[_0x1126('0x12')]+':'+this[_0x1126('0xb')]['id']['toString']()};_0x54400a[_0x1126('0x23')](_0x49d209,function(_0x477e6a,_0x48a08d){if(_0x477e6a){logger[_0x1126('0x24')]('[%s][AMAZONLEX]\x20%s',_0x40ba58,_0x477e6a['message']);_0x4f239c['next']();}else if(_0x48a08d&&_0x48a08d[_0x1126('0x22')]){_0x2f70ac[_0x1126('0x19')][_0x1126('0x25')]=_0x48a08d;_0x18dbe6[_0x1126('0x19')]=_0x48a08d[_0x1126('0x22')];return rpc[_0x52ef15+_0x1126('0x26')][_0x1126('0x1b')](_0x18dbe6)[_0x1126('0x27')](function(_0x589725){logger[_0x1126('0xd')](_0x1126('0xe'),_0x40ba58,_0x18dbe6[_0x1126('0x19')]);if(_0x48a08d['dialogState']=='Failed'){_0x4f239c[_0x1126('0xf')]();}else{_0x4f239c[_0x1126('0x1f')]();}})['catch'](function(_0x2fb797){logger[_0x1126('0x24')]('[%s][AMAZONLEX]\x20%s',_0x40ba58,JSON[_0x1126('0x1d')](_0x2fb797));_0x4f239c['next']();});}else{_0x4f239c[_0x1126('0xf')]();}});}}catch(_0x4bd50b){logger[_0x1126('0x24')]('[%s][AMAZONLEX]\x20%s',_0x40ba58,JSON[_0x1126('0x1d')](_0x4bd50b));_0x4f239c['stop']();}};}; \ No newline at end of file +var _0x53ec=['../../rpc/faxMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','channel','then','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage'];(function(_0x1aafc7,_0x5926ff){var _0x3863b1=function(_0x4ba875){while(--_0x4ba875){_0x1aafc7['push'](_0x1aafc7['shift']());}};_0x3863b1(++_0x5926ff);}(_0x53ec,0x192));var _0xc53e=function(_0x5880d8,_0x30b0a5){_0x5880d8=_0x5880d8-0x0;var _0x88264a=_0x53ec[_0x5880d8];return _0x88264a;};'use strict';var _=require(_0xc53e('0x0'));var moment=require(_0xc53e('0x1'));var AWS=require(_0xc53e('0x2'));var utils=require(_0xc53e('0x3'));var logger=require(_0xc53e('0x4'))(_0xc53e('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xc53e('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc53e('0x7')),'faxMessage':require(_0xc53e('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xc53e('0x9')]=function(_0x4f989b,_0x41a9e8){return function(_0x2de88b){try{if(!_['isNil'](this[_0xc53e('0xa')][_0xc53e('0xb')])){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x4f989b,_0xc53e('0xe'));return _0x2de88b[_0xc53e('0xf')]();}var _0xd82002={'ContactId':this[_0xc53e('0x10')]['id'],'sentAt':moment()[_0xc53e('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};var _0x35128a=this['channel'];if(_0x35128a==='chat'){_0xd82002[_0xc53e('0x12')]=this[_0xc53e('0x13')]['id'];}else{_0xd82002[_[_0xc53e('0x14')](_0x35128a)+_0xc53e('0x15')]=this['account']['id'];}_0xd82002[_['upperFirst'](_0x35128a)+_0xc53e('0x16')]=this[_0xc53e('0xa')]['id'];if(this[_0xc53e('0xa')][_0xc53e('0x17')]){var _0x358ef3=_0x41a9e8[0x4];if(!_[_0xc53e('0x18')](_0x358ef3)){_0xd82002[_0xc53e('0x19')]=utils[_0xc53e('0x1a')](_0x358ef3,this);return rpc[_0x35128a+_0xc53e('0x1b')][_0xc53e('0x1c')](_0xd82002)['then'](function(_0x8a522e){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x4f989b,_0xd82002[_0xc53e('0x19')]);})[_0xc53e('0x1d')](function(_0x270c78){logger[_0xc53e('0x1e')](_0xc53e('0xd'),_0x4f989b,JSON[_0xc53e('0x1f')](_0x270c78));})['finally'](function(){logger['info'](_0xc53e('0x20'),_0x4f989b);_0x2de88b[_0xc53e('0x21')]();});}else{logger[_0xc53e('0xc')](_0xc53e('0x22'),_0x4f989b);_0x2de88b[_0xc53e('0x21')]();}}else{var _0x2cfe2b=this;var _0x15a015=new AWS[(_0xc53e('0x23'))]({'accessKeyId':_0x41a9e8[0x0],'secretAccessKey':_0x41a9e8[0x1],'region':_0x41a9e8[0x2]});var _0x364c80={'botAlias':_0xc53e('0x24'),'botName':_0x41a9e8[0x3],'inputText':this[_0xc53e('0x25')][_0xc53e('0x19')],'userId':this[_0xc53e('0x26')]+':'+this['interaction']['id']['toString']()};_0x15a015['postText'](_0x364c80,function(_0x4f4304,_0x384218){if(_0x4f4304){logger[_0xc53e('0x1e')](_0xc53e('0xd'),_0x4f989b,_0x4f4304[_0xc53e('0x25')]);_0x2de88b['next']();}else if(_0x384218&&_0x384218['message']){_0x2cfe2b[_0xc53e('0x19')]['amazonlex']=_0x384218;_0xd82002[_0xc53e('0x19')]=_0x384218[_0xc53e('0x25')];return rpc[_0x35128a+_0xc53e('0x1b')][_0xc53e('0x1c')](_0xd82002)[_0xc53e('0x27')](function(_0x4df8cf){logger[_0xc53e('0xc')]('[%s][AMAZONLEX]\x20%s',_0x4f989b,_0xd82002['body']);if(_0x384218['dialogState']==_0xc53e('0x28')){_0x2de88b['next']();}else{_0x2de88b[_0xc53e('0x21')]();}})['catch'](function(_0x24a77e){logger['error']('[%s][AMAZONLEX]\x20%s',_0x4f989b,JSON[_0xc53e('0x1f')](_0x24a77e));_0x2de88b[_0xc53e('0xf')]();});}else{_0x2de88b[_0xc53e('0xf')]();}});}}catch(_0x2fa20b){logger[_0xc53e('0x1e')](_0xc53e('0xd'),_0x4f989b,JSON[_0xc53e('0x1f')](_0x2fa20b));_0x2de88b[_0xc53e('0x21')]();}};}; \ 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 02cb9ab..4da82bc 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 _0xb441=['phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','mail','Smtp','service','host','port','secure','authentication','auth','pass','inReplyTo','messageId','html','','replace','body','','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Message','stop','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','getMustacheRender','contact','format','out','message','from'];(function(_0x19ce7a,_0x2317f7){var _0x57d7b1=function(_0x547bb1){while(--_0x547bb1){_0x19ce7a['push'](_0x19ce7a['shift']());}};_0x57d7b1(++_0x2317f7);}(_0xb441,0xdf));var _0x1b44=function(_0x1d0487,_0x24e562){_0x1d0487=_0x1d0487-0x0;var _0x2d3823=_0xb441[_0x1d0487];return _0x2d3823;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x1b44('0x0'));var logger=require(_0x1b44('0x1'))(_0x1b44('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x1b44('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x1b44('0x4')),'faxMessage':require(_0x1b44('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};var mailRpc=require('../../mailRpc');exports[_0x1b44('0x6')]=function(_0x5d2076,_0x228079){return function(_0x472d68){try{if(_0x228079[0x0]==='1'&&(_[_0x1b44('0x7')](this[_0x1b44('0x8')]['created'])||!this[_0x1b44('0x8')][_0x1b44('0x9')])){logger[_0x1b44('0xa')](_0x1b44('0xb'),_0x5d2076,_0x1b44('0xc'));return _0x472d68[_0x1b44('0xd')]();}var _0x5d4638=this[_0x1b44('0xe')];var _0x599b35={'body':utils[_0x1b44('0xf')](_0x228079[0x1],this),'ContactId':this[_0x1b44('0x10')]['id'],'sentAt':moment()[_0x1b44('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x1b44('0x12')};if(this[_0x1b44('0x13')]){_0x599b35['to']=this[_0x1b44('0x13')][_0x1b44('0x14')]||'';_0x599b35['cc']=this[_0x1b44('0x13')]['cc']||'';_0x599b35[_0x1b44('0x14')]=this[_0x1b44('0x13')]['to']||'';_0x599b35[_0x1b44('0x15')]=this[_0x1b44('0x13')][_0x1b44('0x15')]||'';_0x599b35[_0x1b44('0x16')]=!![];if(this[_0x1b44('0x13')]['subject']){_0x599b35['subject']='';_0x599b35[_0x1b44('0x17')]+=_[_0x1b44('0x18')](this[_0x1b44('0x13')][_0x1b44('0x17')],_0x1b44('0x19'))?'':'Re:\x20';_0x599b35['subject']+=this[_0x1b44('0x13')][_0x1b44('0x17')];}}if(this[_0x1b44('0xe')]===_0x1b44('0x1a')){_0x599b35[_0x1b44('0x1b')]=this[_0x1b44('0x1c')]['id'];}else{_0x599b35[_[_0x1b44('0x1d')](this[_0x1b44('0xe')])+_0x1b44('0x1e')]=this[_0x1b44('0x1c')]['id'];}_0x599b35[_['upperFirst'](this[_0x1b44('0xe')])+_0x1b44('0x1f')]=this[_0x1b44('0x8')]['id'];if(rpc[this[_0x1b44('0xe')]+'Message']){if(this[_0x1b44('0xe')]===_0x1b44('0x20')){var _0x282aea={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x1b44('0x21')]['service']){_0x282aea['service']=this[_0x1b44('0x1c')]['Smtp'][_0x1b44('0x22')];}else{_0x282aea[_0x1b44('0x23')]=this[_0x1b44('0x1c')][_0x1b44('0x21')][_0x1b44('0x23')];_0x282aea[_0x1b44('0x24')]=this[_0x1b44('0x1c')][_0x1b44('0x21')][_0x1b44('0x24')];_0x282aea[_0x1b44('0x25')]=this[_0x1b44('0x1c')][_0x1b44('0x21')][_0x1b44('0x25')];}if(this[_0x1b44('0x1c')][_0x1b44('0x21')][_0x1b44('0x26')]){_0x282aea[_0x1b44('0x27')]={'user':this[_0x1b44('0x1c')][_0x1b44('0x21')]['user'],'pass':this[_0x1b44('0x1c')][_0x1b44('0x21')][_0x1b44('0x28')]};}_0x599b35[_0x1b44('0x29')]=this[_0x1b44('0x13')][_0x1b44('0x2a')];_0x599b35[_0x1b44('0x2b')]=_0x1b44('0x2c')+_[_0x1b44('0x2d')](_0x599b35[_0x1b44('0x2e')],_0x1b44('0x2f'),_0x1b44('0x30'))+_0x1b44('0x31');return mailRpc[_0x1b44('0x32')](_0x282aea,_0x599b35)[_0x1b44('0x33')](function(_0x493254){logger['info'](_0x1b44('0x34'),_0x5d2076);_0x599b35[_0x1b44('0x2a')]=_0x493254[_0x1b44('0x13')]['messageId'];return rpc[_0x5d4638+'Message'][_0x1b44('0x35')](_0x599b35);})[_0x1b44('0x33')](function(_0x400d55){logger[_0x1b44('0xa')](_0x1b44('0xb'),_0x5d2076,JSON[_0x1b44('0x36')](_0x400d55));})[_0x1b44('0x37')](function(_0x5ea720){logger[_0x1b44('0x38')](_0x1b44('0x39'),_0x5d2076,JSON[_0x1b44('0x36')](_0x5ea720));})[_0x1b44('0x3a')](function(){_0x472d68[_0x1b44('0xd')]();});}else{return rpc[this[_0x1b44('0xe')]+_0x1b44('0x3b')][_0x1b44('0x35')](_0x599b35)[_0x1b44('0x33')](function(_0x590d5a){logger['info'](_0x1b44('0xb'),_0x5d2076,_0x599b35[_0x1b44('0x2e')]);})['catch'](function(_0x56ace0){logger['error'](_0x1b44('0xb'),_0x5d2076,JSON['stringify'](_0x56ace0));})[_0x1b44('0x3a')](function(){_0x472d68[_0x1b44('0xd')]();});}}}catch(_0x140eeb){logger[_0x1b44('0x38')](_0x1b44('0xb'),_0x5d2076,JSON['stringify'](_0x140eeb));_0x472d68[_0x1b44('0x3c')]();}};}; \ No newline at end of file +var _0xae7e=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','isNil','created','interaction','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','subject','Re:','Re:\x20','ChatWebsiteId','account','AccountId','InteractionId','Smtp','service','host','port','secure','inReplyTo','','replace','body','','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','error','finally','Message','next','stop','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage'];(function(_0x56c605,_0x35e83f){var _0x5497b7=function(_0x5ef2a3){while(--_0x5ef2a3){_0x56c605['push'](_0x56c605['shift']());}};_0x5497b7(++_0x35e83f);}(_0xae7e,0x145));var _0xeae7=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xae7e[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var moment=require(_0xeae7('0x0'));var utils=require(_0xeae7('0x1'));var logger=require(_0xeae7('0x2'))(_0xeae7('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xeae7('0x4')),'mailMessage':require(_0xeae7('0x5')),'smsMessage':require(_0xeae7('0x6')),'faxMessage':require(_0xeae7('0x7')),'whatsappMessage':require(_0xeae7('0x8'))};var mailRpc=require(_0xeae7('0x9'));exports['consequence']=function(_0x3b335d,_0x25a184){return function(_0x554534){try{if(_0x25a184[0x0]==='1'&&(_[_0xeae7('0xa')](this['interaction'][_0xeae7('0xb')])||!this[_0xeae7('0xc')][_0xeae7('0xb')])){logger[_0xeae7('0xd')](_0xeae7('0xe'),_0x3b335d,_0xeae7('0xf'));return _0x554534['next']();}var _0x1a0628=this[_0xeae7('0x10')];var _0x6d171={'body':utils[_0xeae7('0x11')](_0x25a184[0x1],this),'ContactId':this[_0xeae7('0x12')]['id'],'sentAt':moment()[_0xeae7('0x13')](_0xeae7('0x14')),'direction':_0xeae7('0x15')};if(this[_0xeae7('0x16')]){_0x6d171['to']=this[_0xeae7('0x16')][_0xeae7('0x17')]||'';_0x6d171['cc']=this[_0xeae7('0x16')]['cc']||'';_0x6d171[_0xeae7('0x17')]=this[_0xeae7('0x16')]['to']||'';_0x6d171['phone']=this[_0xeae7('0x16')]['phone']||'';_0x6d171['read']=!![];if(this[_0xeae7('0x16')][_0xeae7('0x18')]){_0x6d171[_0xeae7('0x18')]='';_0x6d171[_0xeae7('0x18')]+=_['startsWith'](this[_0xeae7('0x16')]['subject'],_0xeae7('0x19'))?'':_0xeae7('0x1a');_0x6d171[_0xeae7('0x18')]+=this['message']['subject'];}}if(this['channel']==='chat'){_0x6d171[_0xeae7('0x1b')]=this[_0xeae7('0x1c')]['id'];}else{_0x6d171[_['upperFirst'](this[_0xeae7('0x10')])+_0xeae7('0x1d')]=this['account']['id'];}_0x6d171[_['upperFirst'](this[_0xeae7('0x10')])+_0xeae7('0x1e')]=this[_0xeae7('0xc')]['id'];if(rpc[this[_0xeae7('0x10')]+'Message']){if(this['channel']==='mail'){var _0x158e2b={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0xeae7('0x1f')][_0xeae7('0x20')]){_0x158e2b[_0xeae7('0x20')]=this[_0xeae7('0x1c')][_0xeae7('0x1f')][_0xeae7('0x20')];}else{_0x158e2b[_0xeae7('0x21')]=this[_0xeae7('0x1c')][_0xeae7('0x1f')][_0xeae7('0x21')];_0x158e2b['port']=this[_0xeae7('0x1c')][_0xeae7('0x1f')][_0xeae7('0x22')];_0x158e2b['secure']=this['account'][_0xeae7('0x1f')][_0xeae7('0x23')];}if(this[_0xeae7('0x1c')][_0xeae7('0x1f')]['authentication']){_0x158e2b['auth']={'user':this['account'][_0xeae7('0x1f')]['user'],'pass':this[_0xeae7('0x1c')][_0xeae7('0x1f')]['pass']};}_0x6d171[_0xeae7('0x24')]=this[_0xeae7('0x16')]['messageId'];_0x6d171['html']=_0xeae7('0x25')+_[_0xeae7('0x26')](_0x6d171[_0xeae7('0x27')],_0xeae7('0x28'),_0xeae7('0x29'))+_0xeae7('0x2a');return mailRpc[_0xeae7('0x2b')](_0x158e2b,_0x6d171)[_0xeae7('0x2c')](function(_0x2a999f){logger[_0xeae7('0xd')](_0xeae7('0x2d'),_0x3b335d);_0x6d171[_0xeae7('0x2e')]=_0x2a999f[_0xeae7('0x16')][_0xeae7('0x2e')];return rpc[_0x1a0628+'Message'][_0xeae7('0x2f')](_0x6d171);})[_0xeae7('0x2c')](function(_0x245611){logger[_0xeae7('0xd')](_0xeae7('0xe'),_0x3b335d,JSON[_0xeae7('0x30')](_0x245611));})[_0xeae7('0x31')](function(_0x4b3431){logger[_0xeae7('0x32')]('[RPC][%s][AUTOREPLY]\x20%s',_0x3b335d,JSON[_0xeae7('0x30')](_0x4b3431));})[_0xeae7('0x33')](function(){_0x554534['next']();});}else{return rpc[this['channel']+_0xeae7('0x34')][_0xeae7('0x2f')](_0x6d171)[_0xeae7('0x2c')](function(_0x537c14){logger[_0xeae7('0xd')](_0xeae7('0xe'),_0x3b335d,_0x6d171[_0xeae7('0x27')]);})['catch'](function(_0x4aaa79){logger[_0xeae7('0x32')](_0xeae7('0xe'),_0x3b335d,JSON['stringify'](_0x4aaa79));})[_0xeae7('0x33')](function(){_0x554534[_0xeae7('0x35')]();});}}}catch(_0x44b7a7){logger[_0xeae7('0x32')](_0xeae7('0xe'),_0x3b335d,JSON[_0xeae7('0x30')](_0x44b7a7));_0x554534[_0xeae7('0x36')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 2c99b91..f4df9bf 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x905a=['[%s][CLOSE]\x20%s','stringify','finally','stop','moment','routing','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','error'];(function(_0x3b07d7,_0x374e44){var _0x2a9b53=function(_0x11a0e5){while(--_0x11a0e5){_0x3b07d7['push'](_0x3b07d7['shift']());}};_0x2a9b53(++_0x374e44);}(_0x905a,0xeb));var _0xa905=function(_0xdd5dea,_0x427f6e){_0xdd5dea=_0xdd5dea-0x0;var _0x5c9139=_0x905a[_0xdd5dea];return _0x5c9139;};'use strict';var moment=require(_0xa905('0x0'));var logger=require('../../../../config/logger')(_0xa905('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xa905('0x2')),'mailInteraction':require(_0xa905('0x3')),'faxInteraction':require(_0xa905('0x4')),'whatsappInteraction':require(_0xa905('0x5'))};exports[_0xa905('0x6')]=function(_0xb2f96a,_0x7e4032,_0x312150,_0x7667dd){return function(_0x3a0072){try{logger[_0xa905('0x7')](_0xa905('0x8'),_0xb2f96a,_0x7e4032[0x0]);var _0x314e6d={'closed':0x1,'closedAt':moment()['format'](_0xa905('0x9')),'closeReason':'system','disposition':_0x7e4032[0x0]};if(rpc[_0x7667dd[_0xa905('0xa')]+'Interaction']){rpc[_0x7667dd['channel']+_0xa905('0xb')][_0xa905('0xc')](_0x7667dd['interaction']['id'],_0x314e6d)[_0xa905('0xd')](function(_0x593fab){logger['info'](_0xa905('0xe'),_0xb2f96a,_0x7667dd[_0xa905('0xf')]['id']);})['catch'](function(_0x54e06c){logger[_0xa905('0x10')](_0xa905('0x11'),_0xb2f96a,JSON[_0xa905('0x12')](_0x54e06c));})[_0xa905('0x13')](function(){_0x3a0072[_0xa905('0x14')]();});}}catch(_0xbe0d64){logger['error'](_0xa905('0x11'),_0xb2f96a,JSON['stringify'](_0xbe0d64));_0x3a0072[_0xa905('0x14')]();}};}; \ No newline at end of file +var _0xee8f=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','stop','../../../../config/logger'];(function(_0x443cc5,_0x237fca){var _0x6271e9=function(_0x57a38){while(--_0x57a38){_0x443cc5['push'](_0x443cc5['shift']());}};_0x6271e9(++_0x237fca);}(_0xee8f,0x1ed));var _0xfee8=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xee8f[_0x13d07a];return _0x5ee0ee;};'use strict';var moment=require('moment');var logger=require(_0xfee8('0x0'))('routing');var rpc={'chatInteraction':require(_0xfee8('0x1')),'openchannelInteraction':require(_0xfee8('0x2')),'smsInteraction':require(_0xfee8('0x3')),'mailInteraction':require(_0xfee8('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x1652fc,_0x32ac18,_0x42dfba,_0x5b393e){return function(_0x1edd18){try{logger[_0xfee8('0x5')]('[%s][CLOSE]\x20reason\x20%s',_0x1652fc,_0x32ac18[0x0]);var _0x4e5440={'closed':0x1,'closedAt':moment()[_0xfee8('0x6')](_0xfee8('0x7')),'closeReason':_0xfee8('0x8'),'disposition':_0x32ac18[0x0]};if(rpc[_0x5b393e['channel']+'Interaction']){rpc[_0x5b393e[_0xfee8('0x9')]+_0xfee8('0xa')][_0xfee8('0xb')](_0x5b393e[_0xfee8('0xc')]['id'],_0x4e5440)[_0xfee8('0xd')](function(_0x40c842){logger[_0xfee8('0x5')](_0xfee8('0xe'),_0x1652fc,_0x5b393e['interaction']['id']);})['catch'](function(_0x55023b){logger[_0xfee8('0xf')](_0xfee8('0x10'),_0x1652fc,JSON[_0xfee8('0x11')](_0x55023b));})['finally'](function(){_0x1edd18['stop']();});}}catch(_0x16364d){logger[_0xfee8('0xf')](_0xfee8('0x10'),_0x1652fc,JSON[_0xfee8('0x11')](_0x16364d));_0x1edd18[_0xfee8('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 6034e69..c9178fd 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bdd=['error','stringify','stop','textRequest','message','then','dialogflow','fulfillment','speech','metadata','endConversation','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','catch'];(function(_0x4b0b10,_0x33423a){var _0x5033dd=function(_0x195532){while(--_0x195532){_0x4b0b10['push'](_0x4b0b10['shift']());}};_0x5033dd(++_0x33423a);}(_0x6bdd,0x101));var _0xd6bd=function(_0x48fff1,_0x50c537){_0x48fff1=_0x48fff1-0x0;var _0x127a1d=_0x6bdd[_0x48fff1];return _0x127a1d;};'use strict';var _=require(_0xd6bd('0x0'));var moment=require(_0xd6bd('0x1'));var apiai=require('apiai-promise');var md5=require(_0xd6bd('0x2'));var utils=require(_0xd6bd('0x3'));var logger=require(_0xd6bd('0x4'))(_0xd6bd('0x5'));var rpc={'chatMessage':require(_0xd6bd('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd6bd('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd6bd('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x2593c6,_0x514f1d){return function(_0x4be1d3){try{if(!_[_0xd6bd('0x9')](this[_0xd6bd('0xa')][_0xd6bd('0xb')])){logger[_0xd6bd('0xc')](_0xd6bd('0xd'),_0x2593c6,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4be1d3[_0xd6bd('0xe')]();}var _0xdbf03b={'ContactId':this['contact']['id'],'sentAt':moment()[_0xd6bd('0xf')](_0xd6bd('0x10')),'direction':_0xd6bd('0x11')};var _0x342294=this[_0xd6bd('0x12')];if(_0x342294==='chat'){_0xdbf03b[_0xd6bd('0x13')]=this[_0xd6bd('0x14')]['id'];}else{_0xdbf03b[_[_0xd6bd('0x15')](_0x342294)+_0xd6bd('0x16')]=this[_0xd6bd('0x14')]['id'];}_0xdbf03b[_[_0xd6bd('0x15')](_0x342294)+'InteractionId']=this[_0xd6bd('0xa')]['id'];if(this[_0xd6bd('0xa')][_0xd6bd('0x17')]){var _0x2bda8f=_0x514f1d[0x2];if(!_[_0xd6bd('0x18')](_0x2bda8f)){_0xdbf03b[_0xd6bd('0x19')]=utils[_0xd6bd('0x1a')](_0x2bda8f,this);return rpc[_0x342294+_0xd6bd('0x1b')][_0xd6bd('0x1c')](_0xdbf03b)['then'](function(_0x1eeb1){logger[_0xd6bd('0xc')](_0xd6bd('0xd'),_0x2593c6,_0xdbf03b['body']);})[_0xd6bd('0x1d')](function(_0x50aae6){logger[_0xd6bd('0x1e')](_0xd6bd('0xd'),_0x2593c6,JSON[_0xd6bd('0x1f')](_0x50aae6));})['finally'](function(){logger[_0xd6bd('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2593c6);_0x4be1d3[_0xd6bd('0x20')]();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2593c6);_0x4be1d3['stop']();}}else{var _0x55e5bf=this;var _0x363e99=apiai(_0x514f1d[0x0],{'language':_0x514f1d[0x1]||'en'});return _0x363e99[_0xd6bd('0x21')](this[_0xd6bd('0x22')][_0xd6bd('0x19')],{'sessionId':md5(this['interaction']['id'])})[_0xd6bd('0x23')](function(_0x10043d){_0x55e5bf[_0xd6bd('0x19')][_0xd6bd('0x24')]=_0x10043d;_0xdbf03b[_0xd6bd('0x19')]=_0x10043d['result'][_0xd6bd('0x25')][_0xd6bd('0x26')];return rpc[_0x342294+_0xd6bd('0x1b')]['create'](_0xdbf03b)['then'](function(_0x53a283){logger[_0xd6bd('0xc')](_0xd6bd('0xd'),_0x2593c6,_0xdbf03b[_0xd6bd('0x19')]);if(_0x10043d['result'][_0xd6bd('0x27')][_0xd6bd('0x28')]){_0x4be1d3['next']();}else{_0x4be1d3[_0xd6bd('0x20')]();}})['catch'](function(_0x4d2232){logger[_0xd6bd('0x1e')](_0xd6bd('0xd'),_0x2593c6,JSON[_0xd6bd('0x1f')](_0x4d2232));_0x4be1d3['next']();});})[_0xd6bd('0x1d')](function(_0x5d0c08){logger[_0xd6bd('0x1e')](_0xd6bd('0xd'),_0x2593c6,_0x5d0c08[_0xd6bd('0x22')]);_0x4be1d3[_0xd6bd('0xe')]();});}}catch(_0x5dfa41){logger[_0xd6bd('0x1e')](_0xd6bd('0xd'),_0x2593c6,JSON['stringify'](_0x5dfa41));_0x4be1d3[_0xd6bd('0x20')]();}};}; \ No newline at end of file +var _0x91db=['interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','chat','account','AccountId','upperFirst','InteractionId','created','isEmpty','body','Message','create','then','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','dialogflow','fulfillment','result','endConversation','next','catch','message','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil'];(function(_0x403b00,_0x43387b){var _0xfd23a9=function(_0x152f83){while(--_0x152f83){_0x403b00['push'](_0x403b00['shift']());}};_0xfd23a9(++_0x43387b);}(_0x91db,0x11a));var _0xb91d=function(_0x1444d6,_0x27fc98){_0x1444d6=_0x1444d6-0x0;var _0x4e491e=_0x91db[_0x1444d6];return _0x4e491e;};'use strict';var _=require('lodash');var moment=require(_0xb91d('0x0'));var apiai=require(_0xb91d('0x1'));var md5=require(_0xb91d('0x2'));var utils=require(_0xb91d('0x3'));var logger=require(_0xb91d('0x4'))(_0xb91d('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xb91d('0x6')),'mailMessage':require(_0xb91d('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xb91d('0x8')),'whatsappMessage':require(_0xb91d('0x9'))};exports[_0xb91d('0xa')]=function(_0x2436f7,_0x35db45){return function(_0x4e8c7d){try{if(!_[_0xb91d('0xb')](this[_0xb91d('0xc')][_0xb91d('0xd')])){logger[_0xb91d('0xe')](_0xb91d('0xf'),_0x2436f7,_0xb91d('0x10'));return _0x4e8c7d['next']();}var _0x44bff4={'ContactId':this[_0xb91d('0x11')]['id'],'sentAt':moment()[_0xb91d('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};var _0x5146e9=this['channel'];if(_0x5146e9===_0xb91d('0x13')){_0x44bff4['ChatWebsiteId']=this[_0xb91d('0x14')]['id'];}else{_0x44bff4[_['upperFirst'](_0x5146e9)+_0xb91d('0x15')]=this[_0xb91d('0x14')]['id'];}_0x44bff4[_[_0xb91d('0x16')](_0x5146e9)+_0xb91d('0x17')]=this[_0xb91d('0xc')]['id'];if(this[_0xb91d('0xc')][_0xb91d('0x18')]){var _0xea4806=_0x35db45[0x2];if(!_[_0xb91d('0x19')](_0xea4806)){_0x44bff4[_0xb91d('0x1a')]=utils['getMustacheRender'](_0xea4806,this);return rpc[_0x5146e9+_0xb91d('0x1b')][_0xb91d('0x1c')](_0x44bff4)[_0xb91d('0x1d')](function(_0x23308a){logger[_0xb91d('0xe')](_0xb91d('0xf'),_0x2436f7,_0x44bff4[_0xb91d('0x1a')]);})['catch'](function(_0x288d79){logger[_0xb91d('0x1e')](_0xb91d('0xf'),_0x2436f7,JSON[_0xb91d('0x1f')](_0x288d79));})['finally'](function(){logger[_0xb91d('0xe')](_0xb91d('0x20'),_0x2436f7);_0x4e8c7d[_0xb91d('0x21')]();});}else{logger[_0xb91d('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2436f7);_0x4e8c7d[_0xb91d('0x21')]();}}else{var _0x5c4206=this;var _0x35ad04=apiai(_0x35db45[0x0],{'language':_0x35db45[0x1]||'en'});return _0x35ad04[_0xb91d('0x22')](this['message'][_0xb91d('0x1a')],{'sessionId':md5(this[_0xb91d('0xc')]['id'])})[_0xb91d('0x1d')](function(_0x3fe1a4){_0x5c4206[_0xb91d('0x1a')][_0xb91d('0x23')]=_0x3fe1a4;_0x44bff4[_0xb91d('0x1a')]=_0x3fe1a4['result'][_0xb91d('0x24')]['speech'];return rpc[_0x5146e9+_0xb91d('0x1b')][_0xb91d('0x1c')](_0x44bff4)[_0xb91d('0x1d')](function(_0x1e1d8d){logger['info'](_0xb91d('0xf'),_0x2436f7,_0x44bff4['body']);if(_0x3fe1a4[_0xb91d('0x25')]['metadata'][_0xb91d('0x26')]){_0x4e8c7d[_0xb91d('0x27')]();}else{_0x4e8c7d[_0xb91d('0x21')]();}})['catch'](function(_0x3037bc){logger[_0xb91d('0x1e')](_0xb91d('0xf'),_0x2436f7,JSON[_0xb91d('0x1f')](_0x3037bc));_0x4e8c7d[_0xb91d('0x27')]();});})[_0xb91d('0x28')](function(_0xed850){logger[_0xb91d('0x1e')](_0xb91d('0xf'),_0x2436f7,_0xed850[_0xb91d('0x29')]);_0x4e8c7d[_0xb91d('0x27')]();});}}catch(_0xc6af06){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x2436f7,JSON[_0xb91d('0x1f')](_0xc6af06));_0x4e8c7d[_0xb91d('0x21')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 5d2f62b..2bfebfe 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x275e=['message','join','stop','priorityTrue','priorityFalse','info','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','getMustacheRender','replace','error','[%s][GOTOIF]\x20%s','map'];(function(_0x509e79,_0xe6bbaa){var _0x16be11=function(_0x5f36ab){while(--_0x5f36ab){_0x509e79['push'](_0x509e79['shift']());}};_0x16be11(++_0xe6bbaa);}(_0x275e,0x187));var _0xe275=function(_0x141c1e,_0x2a0fcf){_0x141c1e=_0x141c1e-0x0;var _0x1d6118=_0x275e[_0x141c1e];return _0x1d6118;};'use strict';var schema=require(_0xe275('0x0'));var _=require(_0xe275('0x1'));var htmlToText=require(_0xe275('0x2'));var utils=require(_0xe275('0x3'));var logger=require(_0xe275('0x4'))(_0xe275('0x5'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xe275('0x6')},'priorityTrue':{'type':_0xe275('0x7'),'message':_0xe275('0x8')},'priorityFalse':{'type':'number','message':_0xe275('0x9')}});exports['consequence']=function(_0x31497e,_0x36bb61){return function(_0x2aa83b){try{var _0x2519e9={'condition':htmlToText['fromString'](utils[_0xe275('0xa')](_0x36bb61[0x0],this),{'wordwrap':![]})[_0xe275('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x36bb61[0x1],'priorityFalse':_0x36bb61[0x2]};var _0x26dbb9=gotoif[_0xe275('0x0')](_0x2519e9,{'typecast':!![]});if(_0x26dbb9['length']){logger[_0xe275('0xc')](_0xe275('0xd'),_0x31497e,_[_0xe275('0xe')](_0x26dbb9,_0xe275('0xf'))[_0xe275('0x10')](',\x20'));_0x2aa83b[_0xe275('0x11')]();}else{try{var _0x79c25d=eval('('+_0x2519e9['condition']+')');var _0x1f5fe3=_0x79c25d?_0x2519e9[_0xe275('0x12')]:_0x2519e9[_0xe275('0x13')];logger[_0xe275('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x31497e,_0x2519e9[_0xe275('0x15')],_0x79c25d,_0x1f5fe3||_0xe275('0x16'));if(_0x1f5fe3){var _0x319417=_[_0xe275('0x17')](_0x2aa83b[_0xe275('0x18')](),{'p':_0x1f5fe3});if(_0x319417>=0x0){logger['info'](_0xe275('0x19'),_0x31497e,_0x1f5fe3||_0xe275('0x16'),_0x319417);_0x2aa83b[_0xe275('0x16')](_0x319417);}else{logger['info'](_0xe275('0x1a'),_0x31497e,_0x1f5fe3||_0xe275('0x16'));_0x2aa83b['stop']();}}else{_0x2aa83b[_0xe275('0x16')]();}}catch(_0x4568db){logger[_0xe275('0xc')](_0xe275('0x1b'),_0x31497e,_0x4568db['message']);_0x2aa83b[_0xe275('0x11')]();}}}catch(_0x33e546){logger[_0xe275('0xc')](_0xe275('0xd'),_0x31497e,JSON[_0xe275('0x1c')](_0x33e546));_0x2aa83b[_0xe275('0x11')]();}};}; \ No newline at end of file +var _0x132a=['length','error','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','message','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender'];(function(_0x2b0028,_0x55764f){var _0x595e2f=function(_0x47a930){while(--_0x47a930){_0x2b0028['push'](_0x2b0028['shift']());}};_0x595e2f(++_0x55764f);}(_0x132a,0x160));var _0xa132=function(_0x211698,_0x3b178f){_0x211698=_0x211698-0x0;var _0x4dbba0=_0x132a[_0x211698];return _0x4dbba0;};'use strict';var schema=require(_0xa132('0x0'));var _=require(_0xa132('0x1'));var htmlToText=require(_0xa132('0x2'));var utils=require('./utils');var logger=require(_0xa132('0x3'))(_0xa132('0x4'));var gotoif=schema({'condition':{'type':_0xa132('0x5'),'required':!![],'message':_0xa132('0x6')},'priorityTrue':{'type':'number','message':_0xa132('0x7')},'priorityFalse':{'type':'number','message':_0xa132('0x8')}});exports[_0xa132('0x9')]=function(_0x2b2975,_0x537d0a){return function(_0xfc8aab){try{var _0x21df5d={'condition':htmlToText[_0xa132('0xa')](utils[_0xa132('0xb')](_0x537d0a[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x537d0a[0x1],'priorityFalse':_0x537d0a[0x2]};var _0x396e54=gotoif[_0xa132('0x0')](_0x21df5d,{'typecast':!![]});if(_0x396e54[_0xa132('0xc')]){logger[_0xa132('0xd')](_0xa132('0xe'),_0x2b2975,_[_0xa132('0xf')](_0x396e54,'message')[_0xa132('0x10')](',\x20'));_0xfc8aab[_0xa132('0x11')]();}else{try{var _0x3ca3d4=eval('('+_0x21df5d[_0xa132('0x12')]+')');var _0x1c3458=_0x3ca3d4?_0x21df5d[_0xa132('0x13')]:_0x21df5d[_0xa132('0x14')];logger[_0xa132('0x15')](_0xa132('0x16'),_0x2b2975,_0x21df5d['condition'],_0x3ca3d4,_0x1c3458||_0xa132('0x17'));if(_0x1c3458){var _0x55f1c6=_[_0xa132('0x18')](_0xfc8aab[_0xa132('0x19')](),{'p':_0x1c3458});if(_0x55f1c6>=0x0){logger[_0xa132('0x15')](_0xa132('0x1a'),_0x2b2975,_0x1c3458||'next',_0x55f1c6);_0xfc8aab[_0xa132('0x17')](_0x55f1c6);}else{logger[_0xa132('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x2b2975,_0x1c3458||_0xa132('0x17'));_0xfc8aab['stop']();}}else{_0xfc8aab[_0xa132('0x17')]();}}catch(_0x2ce95a){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x2b2975,_0x2ce95a[_0xa132('0x1b')]);_0xfc8aab['stop']();}}}catch(_0x5eba79){logger[_0xa132('0xd')](_0xa132('0xe'),_0x2b2975,JSON['stringify'](_0x5eba79));_0xfc8aab[_0xa132('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index f36caee..d27091c 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 _0xc4e5=['consequence','length','error','map','message','join','stop','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x1ae31c,_0x8dcd2d){var _0x19519d=function(_0x22b8cd){while(--_0x22b8cd){_0x1ae31c['push'](_0x1ae31c['shift']());}};_0x19519d(++_0x8dcd2d);}(_0xc4e5,0x188));var _0x5c4e=function(_0x5ef7b8,_0x15cc07){_0x5ef7b8=_0x5ef7b8-0x0;var _0x2c7148=_0xc4e5[_0x5ef7b8];return _0x2c7148;};'use strict';var schema=require('validate');var _=require(_0x5c4e('0x0'));var logger=require(_0x5c4e('0x1'))('routing');var gotop=schema({'priority':{'type':_0x5c4e('0x2'),'required':!![],'message':_0x5c4e('0x3')}});exports[_0x5c4e('0x4')]=function(_0x1fdeed,_0xf90ef3){return function(_0x75b747){try{var _0xc53668={'priority':_0xf90ef3[0x0]};var _0x2fce42=gotop['validate'](_0xc53668,{'typecast':!![]});if(_0x2fce42[_0x5c4e('0x5')]){logger[_0x5c4e('0x6')]('[%s][GOTOP]\x20%s',_0x1fdeed,_[_0x5c4e('0x7')](_0x2fce42,_0x5c4e('0x8'))[_0x5c4e('0x9')](',\x20'));_0x75b747[_0x5c4e('0xa')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x1fdeed,_0xc53668['priority']);if(_0xc53668[_0x5c4e('0xb')]){var _0x2379e2=_[_0x5c4e('0xc')](_0x75b747['rules'](),{'p':_0xc53668[_0x5c4e('0xb')]});if(_0x2379e2>=0x0){logger['info'](_0x5c4e('0xd'),_0x1fdeed,_0xc53668['priority']||_0x5c4e('0xe'),_0x2379e2);_0x75b747['next'](_0x2379e2);}else{logger[_0x5c4e('0xf')](_0x5c4e('0x10'),_0x1fdeed,_0xc53668[_0x5c4e('0xb')]||'next');_0x75b747[_0x5c4e('0xa')]();}}else{_0x75b747[_0x5c4e('0xe')]();}}}catch(_0x128540){logger['error'](_0x5c4e('0x11'),_0x1fdeed,JSON['stringify'](_0x128540));_0x75b747['stop']();}};}; \ No newline at end of file +var _0x4cba=['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','error','stringify','validate','lodash','routing','consequence','length','[%s][GOTOP]\x20%s','map','message','join','stop'];(function(_0x3cc8b4,_0x33bc7d){var _0x20ff15=function(_0x5c30c2){while(--_0x5c30c2){_0x3cc8b4['push'](_0x3cc8b4['shift']());}};_0x20ff15(++_0x33bc7d);}(_0x4cba,0x122));var _0xa4cb=function(_0x446c6c,_0x3a5ad7){_0x446c6c=_0x446c6c-0x0;var _0xd1e592=_0x4cba[_0x446c6c];return _0xd1e592;};'use strict';var schema=require(_0xa4cb('0x0'));var _=require(_0xa4cb('0x1'));var logger=require('../../../../config/logger')(_0xa4cb('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xa4cb('0x3')]=function(_0x2084e2,_0xadbd76){return function(_0x1f0e92){try{var _0x7a5bb5={'priority':_0xadbd76[0x0]};var _0x421a0f=gotop['validate'](_0x7a5bb5,{'typecast':!![]});if(_0x421a0f[_0xa4cb('0x4')]){logger['error'](_0xa4cb('0x5'),_0x2084e2,_[_0xa4cb('0x6')](_0x421a0f,_0xa4cb('0x7'))[_0xa4cb('0x8')](',\x20'));_0x1f0e92[_0xa4cb('0x9')]();}else{logger[_0xa4cb('0xa')](_0xa4cb('0xb'),_0x2084e2,_0x7a5bb5['priority']);if(_0x7a5bb5[_0xa4cb('0xc')]){var _0x23d51a=_[_0xa4cb('0xd')](_0x1f0e92[_0xa4cb('0xe')](),{'p':_0x7a5bb5['priority']});if(_0x23d51a>=0x0){logger[_0xa4cb('0xa')](_0xa4cb('0xf'),_0x2084e2,_0x7a5bb5[_0xa4cb('0xc')]||_0xa4cb('0x10'),_0x23d51a);_0x1f0e92[_0xa4cb('0x10')](_0x23d51a);}else{logger[_0xa4cb('0xa')](_0xa4cb('0x11'),_0x2084e2,_0x7a5bb5[_0xa4cb('0xc')]||_0xa4cb('0x10'));_0x1f0e92[_0xa4cb('0x9')]();}}else{_0x1f0e92[_0xa4cb('0x10')]();}}}catch(_0x1f5a94){logger[_0xa4cb('0x12')](_0xa4cb('0x5'),_0x2084e2,JSON[_0xa4cb('0x13')](_0x1f5a94));_0x1f0e92[_0xa4cb('0x9')]();}};}; \ 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 3f69e08..506e72f 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 _0x3579=['AccountId','InteractionId','Message','create','then','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','./utils','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','contact','chat','ChatWebsiteId','account','upperFirst','channel'];(function(_0x37d4e2,_0x21361d){var _0x1cbbcc=function(_0x243d4f){while(--_0x243d4f){_0x37d4e2['push'](_0x37d4e2['shift']());}};_0x1cbbcc(++_0x21361d);}(_0x3579,0xf1));var _0x9357=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x3579[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x9357('0x0'));var utils=require(_0x9357('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x9357('0x2')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x9357('0x3')),'faxMessage':require(_0x9357('0x4')),'whatsappMessage':require(_0x9357('0x5'))};exports['consequence']=function(_0x3a451a,_0x21dd63){return function(_0x5d926c){try{var _0x4353a4={'body':utils['getMustacheRender'](_0x21dd63[0x0],this),'ContactId':this[_0x9357('0x6')]['id']};if(this['channel']===_0x9357('0x7')){_0x4353a4[_0x9357('0x8')]=this[_0x9357('0x9')]['id'];}else{_0x4353a4[_[_0x9357('0xa')](this[_0x9357('0xb')])+_0x9357('0xc')]=this[_0x9357('0x9')]['id'];}_0x4353a4[_[_0x9357('0xa')](this[_0x9357('0xb')])+_0x9357('0xd')]=this['interaction']['id'];if(rpc[this[_0x9357('0xb')]+_0x9357('0xe')]){return rpc[this[_0x9357('0xb')]+'Message'][_0x9357('0xf')](_0x4353a4)[_0x9357('0x10')](function(_0x218976){logger['info'](_0x9357('0x11'),_0x3a451a,_0x4353a4[_0x9357('0x12')]);_0x5d926c['next']();})[_0x9357('0x13')](function(_0x3c62cf){logger[_0x9357('0x14')](_0x9357('0x11'),_0x3a451a,JSON['stringify'](_0x3c62cf));_0x5d926c['stop']();});}}catch(_0x4044c3){logger[_0x9357('0x14')](_0x9357('0x11'),_0x3a451a,JSON[_0x9357('0x15')](_0x4044c3));_0x5d926c[_0x9357('0x16')]();}};}; \ No newline at end of file +var _0xf84a=['then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stop','stringify','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','interaction','Message'];(function(_0x8f977f,_0x2b0ff3){var _0x15cc65=function(_0x33dfc8){while(--_0x33dfc8){_0x8f977f['push'](_0x8f977f['shift']());}};_0x15cc65(++_0x2b0ff3);}(_0xf84a,0x10d));var _0xaf84=function(_0x2e899a,_0x35e110){_0x2e899a=_0x2e899a-0x0;var _0x4de7c8=_0xf84a[_0x2e899a];return _0x4de7c8;};'use strict';var _=require('lodash');var utils=require(_0xaf84('0x0'));var logger=require(_0xaf84('0x1'))(_0xaf84('0x2'));var rpc={'chatMessage':require(_0xaf84('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xaf84('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xaf84('0x5')),'whatsappMessage':require(_0xaf84('0x6'))};exports['consequence']=function(_0x3a3af6,_0x112623){return function(_0x1e33b5){try{var _0x26ad42={'body':utils[_0xaf84('0x7')](_0x112623[0x0],this),'ContactId':this[_0xaf84('0x8')]['id']};if(this[_0xaf84('0x9')]===_0xaf84('0xa')){_0x26ad42[_0xaf84('0xb')]=this['account']['id'];}else{_0x26ad42[_[_0xaf84('0xc')](this[_0xaf84('0x9')])+_0xaf84('0xd')]=this['account']['id'];}_0x26ad42[_[_0xaf84('0xc')](this[_0xaf84('0x9')])+_0xaf84('0xe')]=this[_0xaf84('0xf')]['id'];if(rpc[this[_0xaf84('0x9')]+_0xaf84('0x10')]){return rpc[this[_0xaf84('0x9')]+_0xaf84('0x10')]['create'](_0x26ad42)[_0xaf84('0x11')](function(_0x3c9233){logger[_0xaf84('0x12')](_0xaf84('0x13'),_0x3a3af6,_0x26ad42[_0xaf84('0x14')]);_0x1e33b5[_0xaf84('0x15')]();})[_0xaf84('0x16')](function(_0x28672e){logger[_0xaf84('0x17')]('[%s][MESSAGE]\x20%s',_0x3a3af6,JSON['stringify'](_0x28672e));_0x1e33b5[_0xaf84('0x18')]();});}}catch(_0x46d5ca){logger['error'](_0xaf84('0x13'),_0x3a3af6,JSON[_0xaf84('0x19')](_0x46d5ca));_0x1e33b5[_0xaf84('0x18')]();}};}; \ 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 711352e..f3d65b4 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 _0x8e50=['stringify','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0x8e50,0x109));var _0x08e5=function(_0x1d4cd8,_0x30b4d5){_0x1d4cd8=_0x1d4cd8-0x0;var _0x53aa47=_0x8e50[_0x1d4cd8];return _0x53aa47;};'use strict';var utils=require('./utils');var logger=require(_0x08e5('0x0'))('routing');exports[_0x08e5('0x1')]=function(_0x268345,_0x46b0aa){return function(_0x4776a5){try{logger[_0x08e5('0x2')](_0x08e5('0x3'),_0x268345,utils[_0x08e5('0x4')](_0x46b0aa[0x0],this));_0x4776a5[_0x08e5('0x5')]();}catch(_0x1cd27b){logger[_0x08e5('0x6')](_0x08e5('0x3'),_0x268345,JSON[_0x08e5('0x7')](_0x1cd27b));_0x4776a5['stop']();}};}; \ No newline at end of file +var _0x5ad0=['[%s][NOOP]\x20%s','getMustacheRender','stringify','./utils','../../../../config/logger','routing','consequence','info'];(function(_0x4548cb,_0x29d95f){var _0xd0493b=function(_0xaa221c){while(--_0xaa221c){_0x4548cb['push'](_0x4548cb['shift']());}};_0xd0493b(++_0x29d95f);}(_0x5ad0,0x113));var _0x05ad=function(_0x3976ae,_0x1f21a2){_0x3976ae=_0x3976ae-0x0;var _0x5f3080=_0x5ad0[_0x3976ae];return _0x5f3080;};'use strict';var utils=require(_0x05ad('0x0'));var logger=require(_0x05ad('0x1'))(_0x05ad('0x2'));exports[_0x05ad('0x3')]=function(_0x586329,_0x49924d){return function(_0x1e2356){try{logger[_0x05ad('0x4')](_0x05ad('0x5'),_0x586329,utils[_0x05ad('0x6')](_0x49924d[0x0],this));_0x1e2356['next']();}catch(_0x4ca7e5){logger['error'](_0x05ad('0x5'),_0x586329,JSON[_0x05ad('0x7')](_0x4ca7e5));_0x1e2356['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 6ca57dc..4c16c50 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 _0xedd9=['[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','close','rules','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','account','queue','from','joinAt','emit','clone','queue_id','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','chat','AccountId','info','name','message','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted'];(function(_0x317179,_0x3fc5c4){var _0x344ad5=function(_0x144aa4){while(--_0x144aa4){_0x317179['push'](_0x317179['shift']());}};_0x344ad5(++_0x3fc5c4);}(_0xedd9,0xfc));var _0x9edd=function(_0x30ca5c,_0x15815a){_0x30ca5c=_0x30ca5c-0x0;var _0x316a29=_0xedd9[_0x30ca5c];return _0x316a29;};'use strict';var schema=require('validate');var _=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var seqqueue=require(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var Redis=require(_0x9edd('0x4'));var config=require(_0x9edd('0x5'));var logger=require(_0x9edd('0x6'))(_0x9edd('0x7'));var strategy=require('./strategy');config[_0x9edd('0x8')]=_[_0x9edd('0x9')](config[_0x9edd('0x8')],{'host':_0x9edd('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9edd('0x8')]));var attributes=['id','queue_id',_0x9edd('0xb'),_0x9edd('0xc'),_0x9edd('0xd'),_0x9edd('0xe')];function emit(_0x49d5e3,_0x494a24,_0x5d2f90){io['to'](_0x49d5e3)[_0x9edd('0xf')](_0x494a24,_0x5d2f90);}function emitChannelQueueInteraction(_0x138767,_0x523026,_0xbf9da6,_0x13dc4f,_0x5b6c00,_0x30c0d7,_0x1b73d1,_0x25e64c){var _0xfd544a=_[_0x9edd('0x10')](_0xbf9da6);_0xfd544a[_0x9edd('0x11')]=_0x25e64c;_0xfd544a[_0x9edd('0xc')]=_0x523026;_0xfd544a[_0x9edd('0xb')]=_0x13dc4f;_0xfd544a['id']=_0x5b6c00;if(_0x30c0d7){_0x1b73d1[util['format'](_0x9edd('0x12'),_0x138767)][_0x5b6c00]=_[_0x9edd('0x13')](_0xfd544a,attributes);}else{delete _0x1b73d1[util[_0x9edd('0x14')](_0x9edd('0x12'),_0x138767)][_0x5b6c00];}emit(util[_0x9edd('0x14')](_0x9edd('0x15'),_0x138767,_0x523026),util[_0x9edd('0x14')](_0x9edd('0x16'),_0x138767,_0x30c0d7?'save':_0x9edd('0x17')),_[_0x9edd('0x13')](_0xfd544a,attributes));}var rpc={'openchannelQueueReport':require(_0x9edd('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x9edd('0x19')),'smsQueueReport':require(_0x9edd('0x1a')),'faxQueueReport':require(_0x9edd('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x9edd('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9edd('0x1d'),'message':_0x9edd('0x1e')}});function startRouting(_0x4bdb88,_0x498977,_0x45c3ab,_0x50338f){if(_0x4bdb88&&_0x498977&&_0x45c3ab){_0x498977[_0x9edd('0x1f')]+=0x1;var _0x54a03f={'uniqueid':_0x4bdb88,'from':_0x45c3ab['body']?_0x45c3ab[_0x9edd('0x20')][_0x9edd('0xd')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x45c3ab[_0x9edd('0x21')]?_0x45c3ab[_0x9edd('0x21')]['id']:null,'ListId':_0x45c3ab[_0x9edd('0x22')]?_0x45c3ab['list']['id']:null};_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x25')]=_0x498977['id']||null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+'InteractionId']=_0x45c3ab[_0x9edd('0x26')]?_0x45c3ab[_0x9edd('0x26')]['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x27')]=_0x45c3ab['message']?_0x45c3ab['message']['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+(_0x45c3ab[_0x9edd('0x24')]!==_0x9edd('0x28')?_0x9edd('0x29'):'WebsiteId')]=_0x45c3ab['account']?_0x45c3ab[_0x9edd('0xb')]['id']:null;logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x4bdb88,_0x498977[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x45c3ab[_0x9edd('0x24')],_0x498977[_0x9edd('0x2b')],_0x54a03f,_0x45c3ab[_0x9edd('0xb')]['name'],_0x45c3ab[_0x9edd('0x2c')]['id'],!![],_0x50338f,_0x498977['id']);if(rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')][_0x9edd('0x2e')](_0x54a03f)[_0x9edd('0x2f')](function(_0x1fba7b){logger[_0x9edd('0x30')](_0x9edd('0x31'));});}}}function stopRouting(_0x4fd03f,_0x138002,_0x6907a5,_0xa55906){if(_0x4fd03f&&_0x138002){_0x138002[_0x9edd('0x1f')]-=0x1;var _0x5af178={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'acceptAt':moment()[_0x9edd('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x9edd('0x33')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')](_0x9edd('0x34'),_0x4fd03f,_0x138002[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x6907a5[_0x9edd('0x24')],_0x138002[_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x20')],_0x6907a5[_0x9edd('0xb')][_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x2c')]['id'],![],_0xa55906,_0x138002['id']);if(rpc[_0x6907a5[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x6907a5[_0x9edd('0x24')]+'QueueReport'][_0x9edd('0x35')](_0x4fd03f,_0x5af178)['catch'](function(_0x968303){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function endRouting(_0x434d26,_0x16770e,_0x4fa5ab,_0x6de835){if(_0x434d26&&_0x16770e){_0x16770e[_0x9edd('0x1f')]-=0x1;var _0x2b3469={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'exitAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'reason':_0x9edd('0x37')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x434d26,_0x16770e[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x4fa5ab['channel'],_0x16770e[_0x9edd('0x2b')],_0x4fa5ab['body'],_0x4fa5ab[_0x9edd('0xb')][_0x9edd('0x2b')],_0x4fa5ab[_0x9edd('0x2c')]['id'],![],_0x6de835);if(rpc[_0x4fa5ab['channel']+_0x9edd('0x2d')]){return rpc[_0x4fa5ab[_0x9edd('0x24')]+_0x9edd('0x2d')]['update'](_0x434d26,_0x2b3469)[_0x9edd('0x2f')](function(_0x51ad91){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function handleFindQueue(_0x50be2c){return function(_0x315f52){return _0x315f52[_0x9edd('0x2b')][_0x9edd('0x38')]()===_0x50be2c[_0x9edd('0x38')]();};}exports['consequence']=function(_0x449f01,_0x5bbdf8,_0x2bdb3f,_0xc1e657){return function(_0x587d74){try{var _0x318757={'name':_0x5bbdf8[0x0],'timeout':_0x5bbdf8[0x1]};var _0x49a128=queue['validate'](_0x318757,{'typecast':!![]});if(_0x49a128[_0x9edd('0x39')]){logger[_0x9edd('0x30')](_0x9edd('0x3a'),_0x449f01,_[_0x9edd('0x3b')](_0x49a128,_0x9edd('0x2c'))[_0x9edd('0x3c')](',\x20'));_0x587d74[_0x9edd('0x3d')]();}else{var _0x75efbe=_[_0x9edd('0x3e')](_0x2bdb3f[_0xc1e657[_0x9edd('0x24')]+_0x9edd('0x3f')],handleFindQueue(_0x318757[_0x9edd('0x2b')]));if(_0x75efbe){startRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);var _0x3d5eba=(_0x75efbe[_0x9edd('0x37')]||0xa)*0x3e8;var _0x46e9f4=(_0x318757['timeout']||0x14)*0x3e8;var _0x13197d,_0x2570e3;if(_0x3d5eba>_0x46e9f4){_0x46e9f4=_0x3d5eba;}var _0x2231c1=seqqueue[_0x9edd('0x40')](_0x3d5eba);_0x2231c1['id']=_0x449f01;_0x2231c1[_0x9edd('0x41')]=_0x3d5eba;_0x2231c1[_0x9edd('0x42')]=_0x46e9f4;_0x2231c1[_0x9edd('0x24')]=_0xc1e657['channel'];_0x2bdb3f['rules'][_0x449f01]['on']('end',function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x449f01);stopRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x13197d=undefined;_0x2231c1[_0x9edd('0x43')](!![]);if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}_0x587d74[_0x9edd('0x3d')]();});_0x2bdb3f[_0x9edd('0x44')][_0x449f01]['on']('complete',function(){if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}});_0x13197d=setTimeout(function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x449f01);endRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x2231c1[_0x9edd('0x43')](!![]);_0x587d74[_0x9edd('0x45')]();},_0x46e9f4);switch(_0x75efbe[_0x9edd('0x46')]){case _0x9edd('0x47'):strategy[_0x9edd('0x47')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);break;default:strategy[_0x9edd('0x48')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);}}else{logger['error'](_0x9edd('0x49'),_0x449f01,_0x318757[_0x9edd('0x2b')]);_0x587d74['stop']();}}}catch(_0xb93816){console[_0x9edd('0x4a')](_0xb93816);logger['error'](_0x9edd('0x3a'),_0x449f01,_0xb93816[_0x9edd('0x4b')]);_0x587d74[_0x9edd('0x3d')]();}};}; \ No newline at end of file +var _0x008c=['contact','list','upperFirst','QueueId','InteractionId','interaction','message','channel','info','[%s][START:QUEUE][NAME:%s]','name','account','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','body','update','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','timeout','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','clone','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5bd277,_0x70d841){var _0x116309=function(_0x1fe439){while(--_0x1fe439){_0x5bd277['push'](_0x5bd277['shift']());}};_0x116309(++_0x70d841);}(_0x008c,0x188));var _0xc008=function(_0x23c77e,_0x110c62){_0x23c77e=_0x23c77e-0x0;var _0x57d2be=_0x008c[_0x23c77e];return _0x57d2be;};'use strict';var schema=require(_0xc008('0x0'));var _=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var seqqueue=require(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var Redis=require('ioredis');var config=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var strategy=require(_0xc008('0x8'));config[_0xc008('0x9')]=_[_0xc008('0xa')](config[_0xc008('0x9')],{'host':_0xc008('0xb'),'port':0x18eb});var io=require(_0xc008('0xc'))(new Redis(config['redis']));var attributes=['id',_0xc008('0xd'),'account',_0xc008('0xe'),'from','joinAt'];function emit(_0x27830d,_0x7231b4,_0x57c46d){io['to'](_0x27830d)['emit'](_0x7231b4,_0x57c46d);}function emitChannelQueueInteraction(_0x543eb8,_0x1eacfa,_0xc881aa,_0x5b2004,_0xae2dab,_0x332fd4,_0x2ea200,_0x2a5b4e){var _0x9ffa93=_[_0xc008('0xf')](_0xc881aa);_0x9ffa93[_0xc008('0xd')]=_0x2a5b4e;_0x9ffa93['queue']=_0x1eacfa;_0x9ffa93['account']=_0x5b2004;_0x9ffa93['id']=_0xae2dab;if(_0x332fd4){_0x2ea200[util[_0xc008('0x10')]('%sQueuesWaitingInteractions',_0x543eb8)][_0xae2dab]=_[_0xc008('0x11')](_0x9ffa93,attributes);}else{delete _0x2ea200[util[_0xc008('0x10')](_0xc008('0x12'),_0x543eb8)][_0xae2dab];}emit(util[_0xc008('0x10')](_0xc008('0x13'),_0x543eb8,_0x1eacfa),util['format']('%s_queue_waiting_interaction:%s',_0x543eb8,_0x332fd4?'save':_0xc008('0x14')),_[_0xc008('0x11')](_0x9ffa93,attributes));}var rpc={'openchannelQueueReport':require(_0xc008('0x15')),'mailQueueReport':require(_0xc008('0x16')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xc008('0x17'),'required':!![],'message':_0xc008('0x18')},'timeout':{'type':'number','message':_0xc008('0x19')}});function startRouting(_0x5906e6,_0x4bd611,_0x543e5d,_0x50261c){if(_0x5906e6&&_0x4bd611&&_0x543e5d){_0x4bd611[_0xc008('0x1a')]+=0x1;var _0x4b9726={'uniqueid':_0x5906e6,'from':_0x543e5d['body']?_0x543e5d['body']['from']:'','joinAt':moment()['format'](_0xc008('0x1b')),'ContactId':_0x543e5d[_0xc008('0x1c')]?_0x543e5d[_0xc008('0x1c')]['id']:null,'ListId':_0x543e5d[_0xc008('0x1d')]?_0x543e5d[_0xc008('0x1d')]['id']:null};_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+_0xc008('0x1f')]=_0x4bd611['id']||null;_0x4b9726[_['upperFirst'](_0x543e5d['channel'])+_0xc008('0x20')]=_0x543e5d[_0xc008('0x21')]?_0x543e5d[_0xc008('0x21')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+'MessageId']=_0x543e5d['message']?_0x543e5d[_0xc008('0x22')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d[_0xc008('0x23')])+(_0x543e5d[_0xc008('0x23')]!=='chat'?'AccountId':'WebsiteId')]=_0x543e5d['account']?_0x543e5d['account']['id']:null;logger[_0xc008('0x24')](util[_0xc008('0x10')](_0xc008('0x25'),_0x5906e6,_0x4bd611['name']));emitChannelQueueInteraction(_0x543e5d[_0xc008('0x23')],_0x4bd611[_0xc008('0x26')],_0x4b9726,_0x543e5d[_0xc008('0x27')][_0xc008('0x26')],_0x543e5d['message']['id'],!![],_0x50261c,_0x4bd611['id']);if(rpc[_0x543e5d[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x543e5d['channel']+'QueueReport']['create'](_0x4b9726)[_0xc008('0x29')](function(_0x267abd){logger[_0xc008('0x2a')](_0xc008('0x2b'));});}}}function stopRouting(_0x1de04b,_0xceebc3,_0x294f97,_0x22d8e8){if(_0x1de04b&&_0xceebc3){_0xceebc3[_0xc008('0x1a')]-=0x1;var _0x2b862d={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'acceptAt':moment()['format'](_0xc008('0x1b')),'reason':_0xc008('0x2c')};logger['info'](util[_0xc008('0x10')](_0xc008('0x2d'),_0x1de04b,_0xceebc3[_0xc008('0x26')]));emitChannelQueueInteraction(_0x294f97[_0xc008('0x23')],_0xceebc3[_0xc008('0x26')],_0x294f97[_0xc008('0x2e')],_0x294f97[_0xc008('0x27')][_0xc008('0x26')],_0x294f97[_0xc008('0x22')]['id'],![],_0x22d8e8,_0xceebc3['id']);if(rpc[_0x294f97['channel']+_0xc008('0x28')]){return rpc[_0x294f97[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x1de04b,_0x2b862d)[_0xc008('0x29')](function(_0x315562){logger[_0xc008('0x2a')]('update\x20queue\x20report');});}}}function endRouting(_0x35f360,_0x21763f,_0x50e1d4,_0x399b64){if(_0x35f360&&_0x21763f){_0x21763f[_0xc008('0x1a')]-=0x1;var _0x5e38d5={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'exitAt':moment()[_0xc008('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0xc008('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x35f360,_0x21763f[_0xc008('0x26')]));emitChannelQueueInteraction(_0x50e1d4[_0xc008('0x23')],_0x21763f[_0xc008('0x26')],_0x50e1d4[_0xc008('0x2e')],_0x50e1d4[_0xc008('0x27')][_0xc008('0x26')],_0x50e1d4[_0xc008('0x22')]['id'],![],_0x399b64);if(rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x35f360,_0x5e38d5)[_0xc008('0x29')](function(_0x2bf3fd){logger['error'](_0xc008('0x30'));});}}}function handleFindQueue(_0x23c4db){return function(_0x30b7df){return _0x30b7df[_0xc008('0x26')]['toLowerCase']()===_0x23c4db[_0xc008('0x31')]();};}exports[_0xc008('0x32')]=function(_0xc8cb91,_0x36e7ae,_0x2d142d,_0x5706bb){return function(_0x398cdd){try{var _0x3323f4={'name':_0x36e7ae[0x0],'timeout':_0x36e7ae[0x1]};var _0x3794b0=queue[_0xc008('0x0')](_0x3323f4,{'typecast':!![]});if(_0x3794b0[_0xc008('0x33')]){logger['error'](_0xc008('0x34'),_0xc8cb91,_[_0xc008('0x35')](_0x3794b0,_0xc008('0x22'))[_0xc008('0x36')](',\x20'));_0x398cdd['stop']();}else{var _0x26cd05=_[_0xc008('0x37')](_0x2d142d[_0x5706bb[_0xc008('0x23')]+'Queues'],handleFindQueue(_0x3323f4[_0xc008('0x26')]));if(_0x26cd05){startRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);var _0x49a176=(_0x26cd05[_0xc008('0x38')]||0xa)*0x3e8;var _0x5d3a72=(_0x3323f4[_0xc008('0x38')]||0x14)*0x3e8;var _0x213014,_0x5a5d85;if(_0x49a176>_0x5d3a72){_0x5d3a72=_0x49a176;}var _0x31007c=seqqueue[_0xc008('0x39')](_0x49a176);_0x31007c['id']=_0xc8cb91;_0x31007c[_0xc008('0x3a')]=_0x49a176;_0x31007c['qtimeout']=_0x5d3a72;_0x31007c[_0xc008('0x23')]=_0x5706bb[_0xc008('0x23')];_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3c'),function(){logger[_0xc008('0x24')](_0xc008('0x3d'),_0xc8cb91);stopRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x213014=undefined;_0x31007c['close'](!![]);if(_0x2d142d['rules'][_0xc8cb91]){delete _0x2d142d['rules'][_0xc8cb91];}_0x398cdd[_0xc008('0x3e')]();});_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3f'),function(){if(_0x2d142d[_0xc008('0x3b')][_0xc8cb91]){delete _0x2d142d[_0xc008('0x3b')][_0xc8cb91];}});_0x213014=setTimeout(function(){logger[_0xc008('0x24')](_0xc008('0x40'),_0xc8cb91);endRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x31007c[_0xc008('0x41')](!![]);_0x398cdd['next']();},_0x5d3a72);switch(_0x26cd05['strategy']){case'rrmemory':strategy[_0xc008('0x42')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);break;default:strategy[_0xc008('0x43')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);}}else{logger[_0xc008('0x2a')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xc8cb91,_0x3323f4[_0xc008('0x26')]);_0x398cdd[_0xc008('0x3e')]();}}}catch(_0x17ab1a){console[_0xc008('0x44')](_0x17ab1a);logger[_0xc008('0x2a')](_0xc008('0x34'),_0xc8cb91,_0x17ab1a[_0xc008('0x45')]);_0x398cdd[_0xc008('0x3e')]();}};}; \ 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 f36a8e3..5eb16b3 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 _0x83cb=['./util','routing','notificationId','squeue','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','push','info','agent','agents','forcedOwnership','isAgentAvailable','channel','realtime','busyQueue','showNotification','writeLog','RINGING',':FORCED','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','STOP','TIMEOUT','exports','lodash','uuid'];(function(_0x30e393,_0x4f9c04){var _0x45d77f=function(_0x256051){while(--_0x256051){_0x30e393['push'](_0x30e393['shift']());}};_0x45d77f(++_0x4f9c04);}(_0x83cb,0x148));var _0xb83c=function(_0x3c60fc,_0x593ef5){_0x3c60fc=_0x3c60fc-0x0;var _0x495fd2=_0x83cb[_0x3c60fc];return _0x495fd2;};'use strict';var _=require(_0xb83c('0x0'));var uuid=require(_0xb83c('0x1'));var util=require(_0xb83c('0x2'));var logger=require('../../../../../config/logger')(_0xb83c('0x3'));var Agent=function(_0x18fd9b,_0x3f7ff7,_0x10a652,_0x4365bf){this[_0xb83c('0x4')]=uuid['v4']();this[_0xb83c('0x5')]=_0x18fd9b;this['agent']=_0x3f7ff7;this['realtime']=_0x10a652;this[_0xb83c('0x3')]=_0x4365bf;this[_0xb83c('0x5')]['push'](this[_0xb83c('0x6')][_0xb83c('0x7')](this),this[_0xb83c('0x8')][_0xb83c('0x7')](this));this[_0xb83c('0x5')]['on'](_0xb83c('0x9'),this[_0xb83c('0x8')][_0xb83c('0x7')](this));this['squeue']['on']('drained',this[_0xb83c('0xa')][_0xb83c('0x7')](this));};Agent[_0xb83c('0xb')][_0xb83c('0xc')]=function(){this[_0xb83c('0x5')][_0xb83c('0xc')](this[_0xb83c('0x6')]['bind'](this),this[_0xb83c('0x8')]['bind'](this));};Agent[_0xb83c('0xb')][_0xb83c('0xa')]=function(){this[_0xb83c('0x8')](!![]);};Agent[_0xb83c('0xb')][_0xb83c('0x6')]=function(_0x51aa84){logger[_0xb83c('0xd')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xb83c('0x5')]['id'],this[_0xb83c('0xe')]['id']);if(_['isNil'](this['realtime'][_0xb83c('0xf')][this[_0xb83c('0xe')]['id']])){logger[_0xb83c('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xb83c('0x5')]['id'],this[_0xb83c('0xe')]['id']);setTimeout(this[_0xb83c('0xc')]['bind'](this),0x3e8);}else{if(this[_0xb83c('0x3')][_0xb83c('0x10')]||util[_0xb83c('0x11')](this[_0xb83c('0x5')]['id'],this['realtime'][_0xb83c('0xf')][this[_0xb83c('0xe')]['id']],this['squeue'][_0xb83c('0x12')],![])){this[_0xb83c('0x13')][_0xb83c('0xf')][this[_0xb83c('0xe')]['id']]['busy']=!![];this['realtime']['agents'][this[_0xb83c('0xe')]['id']][_0xb83c('0x14')]=undefined;util[_0xb83c('0x15')](this['notificationId'],this['squeue']['id'],this[_0xb83c('0x13')]['agents'][this[_0xb83c('0xe')]['id']],null,this[_0xb83c('0x3')]);util[_0xb83c('0x16')](this['squeue']['id'],this['realtime'][_0xb83c('0xf')][this[_0xb83c('0xe')]['id']],_0xb83c('0x17')+(this[_0xb83c('0x3')]['forcedOwnership']?_0xb83c('0x18'):''));}else{logger[_0xb83c('0xd')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0xb83c('0xe')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent['prototype'][_0xb83c('0x8')]=function(_0x35e35e){if(_[_0xb83c('0x19')](this[_0xb83c('0x13')][_0xb83c('0xf')][this[_0xb83c('0xe')]['id']])){return logger[_0xb83c('0xd')](_0xb83c('0x1a'),this[_0xb83c('0x5')]['id'],this[_0xb83c('0xe')]['id']);}else{logger[_0xb83c('0xd')](_0xb83c('0x1b'),this['squeue']['id'],this[_0xb83c('0xe')]['id']);util[_0xb83c('0x1c')](this[_0xb83c('0x4')],this[_0xb83c('0x5')]['id'],this[_0xb83c('0x13')][_0xb83c('0xf')][this[_0xb83c('0xe')]['id']],null,this[_0xb83c('0x3')]);this['realtime'][_0xb83c('0xf')][this[_0xb83c('0xe')]['id']][_0xb83c('0x1d')]=![];this[_0xb83c('0x13')][_0xb83c('0xf')][this[_0xb83c('0xe')]['id']]['busyQueue']=undefined;util['writeLog'](this['squeue']['id'],this[_0xb83c('0x13')]['agents'][this[_0xb83c('0xe')]['id']],_0x35e35e?_0xb83c('0x1e'):_0xb83c('0x1f'));}if(!_0x35e35e){setTimeout(this[_0xb83c('0xc')][_0xb83c('0x7')](this),0x3e8);}};function agent(_0x21fae6,_0x523f4f,_0x1f0936,_0x6a6b44){return new Agent(_0x21fae6,_0x523f4f,_0x1f0936,_0x6a6b44);}module[_0xb83c('0x20')]=agent; \ No newline at end of file +var _0x3e3d=['busy','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','notificationId','STOP','exports','lodash','uuid','routing','squeue','realtime','handleRun','bind','handleTimeout','timeout','drained','prototype','push','handleDrained','agent','isNil','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3e3d,0x78));var _0xd3e3=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3e3d[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xd3e3('0x0'));var uuid=require(_0xd3e3('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0xd3e3('0x2'));var Agent=function(_0x9a55fc,_0x2a593b,_0x4390e3,_0x19c5db){this['notificationId']=uuid['v4']();this[_0xd3e3('0x3')]=_0x9a55fc;this['agent']=_0x2a593b;this[_0xd3e3('0x4')]=_0x4390e3;this[_0xd3e3('0x2')]=_0x19c5db;this['squeue']['push'](this[_0xd3e3('0x5')][_0xd3e3('0x6')](this),this[_0xd3e3('0x7')]['bind'](this));this['squeue']['on'](_0xd3e3('0x8'),this[_0xd3e3('0x7')][_0xd3e3('0x6')](this));this['squeue']['on'](_0xd3e3('0x9'),this['handleDrained'][_0xd3e3('0x6')](this));};Agent[_0xd3e3('0xa')][_0xd3e3('0xb')]=function(){this[_0xd3e3('0x3')][_0xd3e3('0xb')](this[_0xd3e3('0x5')][_0xd3e3('0x6')](this),this[_0xd3e3('0x7')][_0xd3e3('0x6')](this));};Agent[_0xd3e3('0xa')][_0xd3e3('0xc')]=function(){this[_0xd3e3('0x7')](!![]);};Agent[_0xd3e3('0xa')][_0xd3e3('0x5')]=function(_0x3d2b1d){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this[_0xd3e3('0x3')]['id'],this[_0xd3e3('0xd')]['id']);if(_[_0xd3e3('0xe')](this['realtime'][_0xd3e3('0xf')][this['agent']['id']])){logger[_0xd3e3('0x10')](_0xd3e3('0x11'),this[_0xd3e3('0x3')]['id'],this[_0xd3e3('0xd')]['id']);setTimeout(this['push'][_0xd3e3('0x6')](this),0x3e8);}else{if(this[_0xd3e3('0x2')][_0xd3e3('0x12')]||util[_0xd3e3('0x13')](this[_0xd3e3('0x3')]['id'],this[_0xd3e3('0x4')][_0xd3e3('0xf')][this[_0xd3e3('0xd')]['id']],this[_0xd3e3('0x3')]['channel'],![])){this[_0xd3e3('0x4')][_0xd3e3('0xf')][this[_0xd3e3('0xd')]['id']][_0xd3e3('0x14')]=!![];this['realtime'][_0xd3e3('0xf')][this['agent']['id']]['busyQueue']=undefined;util[_0xd3e3('0x15')](this['notificationId'],this[_0xd3e3('0x3')]['id'],this[_0xd3e3('0x4')][_0xd3e3('0xf')][this[_0xd3e3('0xd')]['id']],null,this[_0xd3e3('0x2')]);util[_0xd3e3('0x16')](this[_0xd3e3('0x3')]['id'],this[_0xd3e3('0x4')][_0xd3e3('0xf')][this[_0xd3e3('0xd')]['id']],'RINGING'+(this[_0xd3e3('0x2')][_0xd3e3('0x12')]?_0xd3e3('0x17'):''));}else{logger['info'](_0xd3e3('0x18'),this[_0xd3e3('0x3')]['id'],this[_0xd3e3('0xd')]['id']);setTimeout(this['push'][_0xd3e3('0x6')](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x22c64c){if(_[_0xd3e3('0xe')](this[_0xd3e3('0x4')][_0xd3e3('0xf')][this[_0xd3e3('0xd')]['id']])){return logger[_0xd3e3('0x10')](_0xd3e3('0x11'),this[_0xd3e3('0x3')]['id'],this['agent']['id']);}else{logger[_0xd3e3('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xd3e3('0x3')]['id'],this[_0xd3e3('0xd')]['id']);util['hideNotification'](this[_0xd3e3('0x19')],this[_0xd3e3('0x3')]['id'],this[_0xd3e3('0x4')][_0xd3e3('0xf')][this[_0xd3e3('0xd')]['id']],null,this['routing']);this['realtime'][_0xd3e3('0xf')][this['agent']['id']][_0xd3e3('0x14')]=![];this[_0xd3e3('0x4')]['agents'][this[_0xd3e3('0xd')]['id']]['busyQueue']=undefined;util[_0xd3e3('0x16')](this[_0xd3e3('0x3')]['id'],this[_0xd3e3('0x4')][_0xd3e3('0xf')][this['agent']['id']],_0x22c64c?_0xd3e3('0x1a'):'TIMEOUT');}if(!_0x22c64c){setTimeout(this[_0xd3e3('0xb')]['bind'](this),0x3e8);}};function agent(_0x232360,_0x55651c,_0xc0aae2,_0x1892cf){return new Agent(_0x232360,_0x55651c,_0xc0aae2,_0x1892cf);}module[_0xd3e3('0x1b')]=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 9aefc6b..811bdbc 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 _0xe3f6=['realtime','push','bind','handleTimeout','prototype','handleRun','handleDrained','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busyQueue','name','showNotification','info','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busy','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','queue'];(function(_0x5d68e8,_0x182b07){var _0x3bef55=function(_0x43d8b3){while(--_0x43d8b3){_0x5d68e8['push'](_0x5d68e8['shift']());}};_0x3bef55(++_0x182b07);}(_0xe3f6,0x1a6));var _0x6e3f=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xe3f6[_0x45b034];return _0x509cb0;};'use strict';var _=require(_0x6e3f('0x0'));var uuid=require(_0x6e3f('0x1'));var util=require('./util');var logger=require(_0x6e3f('0x2'))(_0x6e3f('0x3'));var Beepall=function(_0xd3f550,_0x21b233,_0x1577f3,_0x4e300e){this[_0x6e3f('0x4')]=uuid['v4']();this[_0x6e3f('0x5')]=_0xd3f550;this[_0x6e3f('0x6')]=_0x21b233;this[_0x6e3f('0x7')]=_0x1577f3;this[_0x6e3f('0x3')]=_0x4e300e;this['squeue'][_0x6e3f('0x8')](this['handleRun'][_0x6e3f('0x9')](this),this['handleTimeout'][_0x6e3f('0x9')](this));this['squeue']['on']('timeout',this[_0x6e3f('0xa')][_0x6e3f('0x9')](this));this[_0x6e3f('0x5')]['on']('drained',this['handleDrained'][_0x6e3f('0x9')](this));};Beepall[_0x6e3f('0xb')][_0x6e3f('0x8')]=function(){this[_0x6e3f('0x5')][_0x6e3f('0x8')](this[_0x6e3f('0xc')][_0x6e3f('0x9')](this),this[_0x6e3f('0xa')][_0x6e3f('0x9')](this));};Beepall[_0x6e3f('0xb')][_0x6e3f('0xd')]=function(_0x55ebeb){this[_0x6e3f('0xa')](!![]);};Beepall['prototype'][_0x6e3f('0xc')]=function(_0x2cfecf){var _0x1a1c13=!![];if(!_[_0x6e3f('0xe')](this[_0x6e3f('0x6')])&&!_[_0x6e3f('0xe')](this[_0x6e3f('0x6')][_0x6e3f('0xf')])&&this[_0x6e3f('0x6')][_0x6e3f('0xf')]['length']>0x0){for(var _0x198f24=0x0,_0x4c53ec;_0x198f240x0){for(var _0xa1ddfc=0x0,_0x27de2b;_0xa1ddfc0x0&&_0x58ac15[_0x5e7bcd+_0x19b1('0x25')]>=_0x58ac15[_0x5e7bcd+_0x19b1('0x24')]){writeLog(_0x566960,_0x58ac15,_0x5e7bcd[_0x19b1('0x26')]()+_0x19b1('0x27'));return![];}}return!![];};exports[_0x19b1('0x28')]=function(_0x4d6894,_0x176387,_0xeec0c2,_0x559bb2,_0x495e48){return sendNotification(!![],_0x4d6894,_0x176387,_0xeec0c2,_0x559bb2,_0x495e48);};exports['hideNotification']=function(_0x273ecd,_0x1cc895,_0x428752,_0x3682d8,_0x547ea7){return sendNotification(![],_0x273ecd,_0x1cc895,_0x428752,_0x3682d8,_0x547ea7);};exports[_0x19b1('0x29')]=writeLog; \ No newline at end of file +var _0x7dab=['emit','format','user:%s','name','account','notificationSound','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','message','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','OFFLINE','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','lodash','util','../utils','mustache','ioredis','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter'];(function(_0x1f190a,_0x528a22){var _0x1de2a3=function(_0x2ba704){while(--_0x2ba704){_0x1f190a['push'](_0x1f190a['shift']());}};_0x1de2a3(++_0x528a22);}(_0x7dab,0xe5));var _0xb7da=function(_0x27b66f,_0x219041){_0x27b66f=_0x27b66f-0x0;var _0x33cc7a=_0x7dab[_0x27b66f];return _0x33cc7a;};'use strict';var _=require(_0xb7da('0x0'));var util=require(_0xb7da('0x1'));var utils=require(_0xb7da('0x2'));var Mustache=require(_0xb7da('0x3'));var Redis=require(_0xb7da('0x4'));var config=require('../../../../../config/environment');var logger=require(_0xb7da('0x5'))(_0xb7da('0x6'));config[_0xb7da('0x7')]=_[_0xb7da('0x8')](config[_0xb7da('0x7')],{'host':_0xb7da('0x9'),'port':0x18eb});var io=require(_0xb7da('0xa'))(new Redis(config[_0xb7da('0x7')]));function emit(_0x4c980f,_0x3ccdc3,_0x16dd2e){io['to'](_0x4c980f)[_0xb7da('0xb')](_0x3ccdc3,_0x16dd2e);}function sendNotification(_0x4dd98f,_0x5d55a1,_0x3a7d28,_0x17bbaa,_0x23abc7,_0x19d89e){io['to'](util[_0xb7da('0xc')](_0xb7da('0xd'),_0x17bbaa[_0xb7da('0xe')]))[_0xb7da('0xb')]('user:save',_0x17bbaa);var _0x20f85d=_0x19d89e||{};var _0x2bd2a2=_0x3a7d28['split']('.');var _0x155225={'uniqueid':_0x5d55a1,'channel':_0x2bd2a2[0x0],'id':_0x2bd2a2[0x1],'title':_0x2bd2a2[0x0]+'\x20interaction','interactionId':_0x2bd2a2[0x2],'queue':_0x23abc7?_0x23abc7[_0xb7da('0xe')]:null,'sound':_0x20f85d[_0xb7da('0xf')][_0xb7da('0x10')],'shake':_0x20f85d[_0xb7da('0xf')]['notificationShake']};try{if(!_0x20f85d['body']){_0x20f85d[_0xb7da('0x11')]={};}if(_0x23abc7){_0x20f85d[_0xb7da('0x11')][_0xb7da('0x12')]=_0x23abc7;}else if(_0x20f85d['body'][_0xb7da('0x12')]){delete _0x20f85d[_0xb7da('0x11')][_0xb7da('0x12')];}_0x155225[_0xb7da('0x13')]=utils['getMustacheRender'](_0x20f85d[_0xb7da('0xf')][_0xb7da('0x14')],_0x20f85d);}catch(_0x23c5f5){_0x155225['msg']=_0xb7da('0x15');logger[_0xb7da('0x16')](util[_0xb7da('0xc')]('[%s][QUEUE]\x20%s',_0x5d55a1,_0x23c5f5[_0xb7da('0x17')]));}io['to'](util['format'](_0xb7da('0xd'),_0x17bbaa[_0xb7da('0xe')]))[_0xb7da('0xb')](util[_0xb7da('0xc')](_0xb7da('0x18'),_0x4dd98f?_0xb7da('0x19'):_0xb7da('0x1a')),_0x155225);}function writeLog(_0x20b250,_0x3b81fa,_0x805e91){return logger[_0xb7da('0x1b')](util[_0xb7da('0xc')](_0xb7da('0x1c'),_0x20b250,_0x3b81fa[_0xb7da('0xe')],_0x805e91));}exports[_0xb7da('0x1d')]=function(_0x1ec57c,_0x3bae3a,_0x44eb3a,_0x2d6a9e){if(_0x3bae3a['busy']){writeLog(_0x1ec57c,_0x3bae3a,_0xb7da('0x1e'));return![];}if(!_0x3bae3a[_0xb7da('0x1f')]){writeLog(_0x1ec57c,_0x3bae3a,_0xb7da('0x20'));return![];}if(_0x3bae3a[_0x44eb3a+'Pause']){writeLog(_0x1ec57c,_0x3bae3a,_0xb7da('0x21'));return![];}if(_0x2d6a9e&&_0x3bae3a['hasOwnProperty'](_0x44eb3a+_0xb7da('0x22'))&&_0x3bae3a[_0xb7da('0x23')](_0x44eb3a+_0xb7da('0x24'))){if(_0x3bae3a[_0x44eb3a+_0xb7da('0x22')]>0x0&&_0x3bae3a[_0x44eb3a+_0xb7da('0x24')]>=_0x3bae3a[_0x44eb3a+'Capacity']){writeLog(_0x1ec57c,_0x3bae3a,_0x44eb3a[_0xb7da('0x25')]()+_0xb7da('0x26'));return![];}}return!![];};exports[_0xb7da('0x27')]=function(_0x1726f4,_0x4f99b1,_0xfb9c2b,_0xbcab52,_0x1829dc){return sendNotification(!![],_0x1726f4,_0x4f99b1,_0xfb9c2b,_0xbcab52,_0x1829dc);};exports['hideNotification']=function(_0x13da4c,_0x491e07,_0x36f907,_0x36916b,_0x518306){return sendNotification(![],_0x13da4c,_0x491e07,_0x36f907,_0x36916b,_0x518306);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 7432aa3..8abd8b0 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 _0x7ba8=['isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace'];(function(_0x1b0011,_0x403cc8){var _0x29b74c=function(_0x1edb84){while(--_0x1edb84){_0x1b0011['push'](_0x1b0011['shift']());}};_0x29b74c(++_0x403cc8);}(_0x7ba8,0x1d1));var _0x87ba=function(_0x66effc,_0x5d877e){_0x66effc=_0x66effc-0x0;var _0x4936cc=_0x7ba8[_0x66effc];return _0x4936cc;};'use strict';var schema=require(_0x87ba('0x0'));var sh=require(_0x87ba('0x1'));var _=require(_0x87ba('0x2'));var utils=require(_0x87ba('0x3'));var logger=require(_0x87ba('0x4'))(_0x87ba('0x5'));var system=schema({'command':{'type':_0x87ba('0x6'),'required':!![],'message':_0x87ba('0x7')}});exports[_0x87ba('0x8')]=function(_0x5b0982,_0x426681){return function(_0x5d013c){try{var _0x5f2452={'command':_0x426681[0x0]};var _0x485d3d=system['validate'](_0x5f2452,{'typecast':!![]});if(_0x485d3d[_0x87ba('0x9')]){logger['error'](_0x87ba('0xa'),_0x5b0982,_[_0x87ba('0xb')](_0x485d3d,'message')[_0x87ba('0xc')](',\x20'));logger[_0x87ba('0xd')](_0x87ba('0xe'),_0x5b0982);_0x5d013c[_0x87ba('0xf')]();}else{var _0x366663=this;var _0x3e4d16=utils[_0x87ba('0x10')](_0x426681[0x0],this);logger[_0x87ba('0xd')](_0x87ba('0x11'),_0x5b0982,_0x3e4d16);sh[_0x87ba('0x12')](_['trim'](_0x3e4d16),function(_0xcb21e5,_0x3818f8){logger[_0x87ba('0xd')](_0x87ba('0x13'),_0x5b0982,_0xcb21e5);if(_0xcb21e5==0x0){var _0x9b8d98=_0x3818f8[_0x87ba('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x87ba('0x15')](_0x426681[0x1])||_[_0x87ba('0x16')](_0x426681[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x5b0982);_0x366663[_0x87ba('0x17')][_0x426681[0x1]]=_0x9b8d98;}else{logger[_0x87ba('0xd')](_0x87ba('0x18'),_0x5b0982,_0x426681[0x1],_0x9b8d98);_0x366663[_0x87ba('0x17')][_0x426681[0x1]]=_0x9b8d98;}}_0x5d013c[_0x87ba('0xf')]();});}}catch(_0x5bc756){logger[_0x87ba('0x19')](_0x87ba('0xa'),_0x5b0982,_[_0x87ba('0x1a')](_0x5bc756)?JSON['stringify'](_0x5bc756):_0x5bc756);logger[_0x87ba('0xd')](_0x87ba('0xe'),_0x5b0982);_0x5d013c[_0x87ba('0xf')]();}};}; \ No newline at end of file +var _0xedc7=['routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','message','join','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','info','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','lodash','./utils','../../../../config/logger'];(function(_0x3cc259,_0xe5d289){var _0x55f13d=function(_0x5923a3){while(--_0x5923a3){_0x3cc259['push'](_0x3cc259['shift']());}};_0x55f13d(++_0xe5d289);}(_0xedc7,0xc1));var _0x7edc=function(_0xa97d1c,_0x37743a){_0xa97d1c=_0xa97d1c-0x0;var _0x4004b7=_0xedc7[_0xa97d1c];return _0x4004b7;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x7edc('0x0'));var utils=require(_0x7edc('0x1'));var logger=require(_0x7edc('0x2'))(_0x7edc('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0x7edc('0x4')}});exports[_0x7edc('0x5')]=function(_0x5854a2,_0x16d675){return function(_0x417a7c){try{var _0x40e8cc={'command':_0x16d675[0x0]};var _0x30869a=system[_0x7edc('0x6')](_0x40e8cc,{'typecast':!![]});if(_0x30869a[_0x7edc('0x7')]){logger[_0x7edc('0x8')](_0x7edc('0x9'),_0x5854a2,_[_0x7edc('0xa')](_0x30869a,_0x7edc('0xb'))[_0x7edc('0xc')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5854a2);_0x417a7c[_0x7edc('0xd')]();}else{var _0x2918cf=this;var _0x50cb31=utils[_0x7edc('0xe')](_0x16d675[0x0],this);logger['info'](_0x7edc('0xf'),_0x5854a2,_0x50cb31);sh[_0x7edc('0x10')](_[_0x7edc('0x11')](_0x50cb31),function(_0x194b15,_0x202a31){logger['info'](_0x7edc('0x12'),_0x5854a2,_0x194b15);if(_0x194b15==0x0){var _0x247e02=_0x202a31[_0x7edc('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x7edc('0x14')](_0x16d675[0x1])||_[_0x7edc('0x15')](_0x16d675[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x5854a2);_0x2918cf[_0x7edc('0x16')][_0x16d675[0x1]]=_0x247e02;}else{logger[_0x7edc('0x17')](_0x7edc('0x18'),_0x5854a2,_0x16d675[0x1],_0x247e02);_0x2918cf[_0x7edc('0x16')][_0x16d675[0x1]]=_0x247e02;}}_0x417a7c['next']();});}}catch(_0x38156b){logger[_0x7edc('0x8')]('[%s][SYSTEM]\x20%s',_0x5854a2,_[_0x7edc('0x19')](_0x38156b)?JSON[_0x7edc('0x1a')](_0x38156b):_0x38156b);logger[_0x7edc('0x17')](_0x7edc('0x1b'),_0x5854a2);_0x417a7c[_0x7edc('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index cac8868..3b0ad0c 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 _0xe908=['join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','finally','isObject','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','message'];(function(_0x39ed2a,_0x4988be){var _0x315daf=function(_0x208e89){while(--_0x208e89){_0x39ed2a['push'](_0x39ed2a['shift']());}};_0x315daf(++_0x4988be);}(_0xe908,0xdd));var _0x8e90=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xe908[_0x8c43de];return _0xa6591b;};'use strict';var schema=require(_0x8e90('0x0'));var _=require(_0x8e90('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x8e90('0x2')),'smsInteraction':require(_0x8e90('0x3')),'mailInteraction':require(_0x8e90('0x4')),'faxInteraction':require(_0x8e90('0x5')),'whatsappInteraction':require(_0x8e90('0x6'))};var logger=require('../../../../config/logger')(_0x8e90('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x8e90('0x8')}});exports[_0x8e90('0x9')]=function(_0x3a85e3,_0x29d99d,_0x16f05a,_0x30e2eb){return function(_0x4d2c30){try{var _0x40b33a={'tag':_0x29d99d[0x0]};var _0x11da0c=tag[_0x8e90('0x0')](_0x40b33a,{'typecast':!![]});if(_0x11da0c[_0x8e90('0xa')]){logger[_0x8e90('0xb')]('[%s][TAG]\x20%s',_0x3a85e3,_['map'](_0x11da0c,_0x8e90('0xc'))[_0x8e90('0xd')](',\x20'));logger['info'](_0x8e90('0xe'),_0x3a85e3);_0x4d2c30[_0x8e90('0xf')]();}else{var _0x1abe99={'ids':[_0x29d99d[0x0]]};if(rpc[_0x30e2eb[_0x8e90('0x10')]+_0x8e90('0x11')]){rpc[_0x30e2eb[_0x8e90('0x10')]+_0x8e90('0x11')]['addTags'](_0x30e2eb[_0x8e90('0x12')]['id'],_0x1abe99)['then'](function(_0x555f08){logger[_0x8e90('0x13')](_0x8e90('0x14'),_0x3a85e3,_0x29d99d[0x1],_0x30e2eb['channel'],_0x30e2eb['interaction']['id']);})[_0x8e90('0x15')](function(_0x211473){logger['error'](_0x8e90('0x16'),_0x3a85e3,JSON[_0x8e90('0x17')](_0x211473));logger[_0x8e90('0x13')](_0x8e90('0xe'),_0x3a85e3);})[_0x8e90('0x18')](function(){_0x4d2c30[_0x8e90('0xf')]();});}}}catch(_0x4cb04e){logger[_0x8e90('0xb')](_0x8e90('0x16'),_0x3a85e3,_[_0x8e90('0x19')](_0x4cb04e)?JSON['stringify'](_0x4cb04e):_0x4cb04e);logger[_0x8e90('0x13')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3a85e3);_0x4d2c30[_0x8e90('0xf')]();}};}; \ No newline at end of file +var _0x41aa=['stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','[%s][TAG]\x20%s','map','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','interaction','catch','error'];(function(_0xa7ee44,_0x389bd9){var _0x4a8ef2=function(_0x313b3e){while(--_0x313b3e){_0xa7ee44['push'](_0xa7ee44['shift']());}};_0x4a8ef2(++_0x389bd9);}(_0x41aa,0x74));var _0xa41a=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0x41aa[_0x29e35f];return _0x266b74;};'use strict';var schema=require(_0xa41a('0x0'));var _=require(_0xa41a('0x1'));var rpc={'chatInteraction':require(_0xa41a('0x2')),'openchannelInteraction':require(_0xa41a('0x3')),'smsInteraction':require(_0xa41a('0x4')),'mailInteraction':require(_0xa41a('0x5')),'faxInteraction':require(_0xa41a('0x6')),'whatsappInteraction':require(_0xa41a('0x7'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0xa41a('0x8'),'required':!![],'message':_0xa41a('0x9')}});exports['consequence']=function(_0x3c00d2,_0x11649d,_0x23cdf7,_0x34d87a){return function(_0x11edf6){try{var _0x4137bd={'tag':_0x11649d[0x0]};var _0x3db827=tag[_0xa41a('0x0')](_0x4137bd,{'typecast':!![]});if(_0x3db827['length']){logger['error'](_0xa41a('0xa'),_0x3c00d2,_[_0xa41a('0xb')](_0x3db827,'message')['join'](',\x20'));logger['info'](_0xa41a('0xc'),_0x3c00d2);_0x11edf6[_0xa41a('0xd')]();}else{var _0x38d9aa={'ids':[_0x11649d[0x0]]};if(rpc[_0x34d87a['channel']+_0xa41a('0xe')]){rpc[_0x34d87a['channel']+_0xa41a('0xe')]['addTags'](_0x34d87a['interaction']['id'],_0x38d9aa)[_0xa41a('0xf')](function(_0x4c08a8){logger[_0xa41a('0x10')](_0xa41a('0x11'),_0x3c00d2,_0x11649d[0x1],_0x34d87a[_0xa41a('0x12')],_0x34d87a[_0xa41a('0x13')]['id']);})[_0xa41a('0x14')](function(_0xe8e524){logger[_0xa41a('0x15')]('[%s][TAG]\x20%s',_0x3c00d2,JSON[_0xa41a('0x16')](_0xe8e524));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3c00d2);})['finally'](function(){_0x11edf6[_0xa41a('0xd')]();});}}}catch(_0x3be141){logger[_0xa41a('0x15')]('[%s][TAG]\x20%s',_0x3c00d2,_['isObject'](_0x3be141)?JSON['stringify'](_0x3be141):_0x3be141);logger[_0xa41a('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3c00d2);_0x11edf6[_0xa41a('0xd')]();}};}; \ 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 9b4054f..880ba82 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 _0x2121=['body','contact','account','list','mustache','lodash','render','merge'];(function(_0x49ed67,_0x290989){var _0x1523d5=function(_0x34a179){while(--_0x34a179){_0x49ed67['push'](_0x49ed67['shift']());}};_0x1523d5(++_0x290989);}(_0x2121,0x1b4));var _0x1212=function(_0x334da5,_0x53f769){_0x334da5=_0x334da5-0x0;var _0x3c4e17=_0x2121[_0x334da5];return _0x3c4e17;};'use strict';var Mustache=require(_0x1212('0x0'));var _=require(_0x1212('0x1'));module['exports']={'getMustacheRender':function(_0x5b91ba,_0x1e00c4){return Mustache[_0x1212('0x2')](_0x5b91ba,_[_0x1212('0x3')](_0x1e00c4[_0x1212('0x4')],{'contact':_0x1e00c4[_0x1212('0x5')],'message':_0x1e00c4['message'],'account':_0x1e00c4[_0x1212('0x6')],'interaction':_0x1e00c4['interaction'],'list':_0x1e00c4[_0x1212('0x7')]}))||'';}}; \ No newline at end of file +var _0x0a9a=['interaction','list','lodash','render','merge','contact','message'];(function(_0x4e738d,_0x3e38cb){var _0x38bd4=function(_0x15a6c8){while(--_0x15a6c8){_0x4e738d['push'](_0x4e738d['shift']());}};_0x38bd4(++_0x3e38cb);}(_0x0a9a,0x183));var _0xa0a9=function(_0xf6a373,_0x267b02){_0xf6a373=_0xf6a373-0x0;var _0x3a9454=_0x0a9a[_0xf6a373];return _0x3a9454;};'use strict';var Mustache=require('mustache');var _=require(_0xa0a9('0x0'));module['exports']={'getMustacheRender':function(_0x3b1a40,_0x3cff22){return Mustache[_0xa0a9('0x1')](_0x3b1a40,_[_0xa0a9('0x2')](_0x3cff22['body'],{'contact':_0x3cff22[_0xa0a9('0x3')],'message':_0x3cff22[_0xa0a9('0x4')],'account':_0x3cff22['account'],'interaction':_0x3cff22[_0xa0a9('0x5')],'list':_0x3cff22[_0xa0a9('0x6')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 77061c0..3ac4a70 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 _0xa69f=['end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','stack','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','applications','length','existsSync','join','.js','app','toLowerCase','autoreply','push','slice','dialogflow','amazonlex','appdata','split','tag','TagId','%s:%s:%s','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','stringify','emit','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty'];(function(_0xc39d2f,_0x21362d){var _0x979f90=function(_0x57eae7){while(--_0x57eae7){_0xc39d2f['push'](_0xc39d2f['shift']());}};_0x979f90(++_0x21362d);}(_0xa69f,0x83));var _0xfa69=function(_0xac6ae7,_0x173851){_0xac6ae7=_0xac6ae7-0x0;var _0x4e2341=_0xa69f[_0xac6ae7];return _0x4e2341;};'use strict';var _=require(_0xfa69('0x0'));var util=require(_0xfa69('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0xfa69('0x2'));var BPromise=require(_0xfa69('0x3'));var uuid=require(_0xfa69('0x4'));var config=require('../../../config/environment');var logger=require(_0xfa69('0x5'))(_0xfa69('0x6'));var rpc={'openchannelQueueReport':require(_0xfa69('0x7')),'mailQueueReport':require(_0xfa69('0x8')),'chatQueueReport':require(_0xfa69('0x9')),'smsQueueReport':require(_0xfa69('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xfa69('0xb'))};var RuleEngine=require(_0xfa69('0xc'));function getId(_0x4f04c8,_0x4a96e3,_0x23d59c){return util[_0xfa69('0xd')]('%s.%s.%s',_0x4f04c8,_0x4a96e3||0x0,_0x23d59c||0x0);}function getIntervals(_0x591fb6,_0x54e1df){var _0x576c4c=[];if(!_[_0xfa69('0xe')](_0x54e1df[_0xfa69('0xf')])&&!_[_0xfa69('0xe')](_0x591fb6[_0x54e1df[_0xfa69('0xf')]])&&!_[_0xfa69('0xe')](_0x591fb6[_0x54e1df['IntervalId']][_0xfa69('0x10')])){_0x576c4c=_[_0xfa69('0x11')](_0x591fb6[_0x54e1df[_0xfa69('0xf')]][_0xfa69('0x10')],_0xfa69('0x12'));}else if(!_['isNil'](_0x54e1df[_0xfa69('0x12')])){_0x576c4c=[_0x54e1df[_0xfa69('0x12')]];}return _0x576c4c;}exports['listen']=function(_0x201f86){_0x201f86[_0xfa69('0x13')]={};return new BPromise(function(_0x449e09,_0x26cc80){var _0x3d7a53={'Start':function(_0x4489c5){var _0x3f14b4=this;return new Promise(function(_0x4ad8ef,_0x9ec90c){if(_0x4489c5){try{var _0x4c0031=[];var _0x3afcd3=getId(_0x4489c5[_0xfa69('0x14')],_0x4489c5['message']?_0x4489c5[_0xfa69('0x15')]['id']:0x0,_0x4489c5[_0xfa69('0x16')]?_0x4489c5[_0xfa69('0x16')]['id']:0x0);if(_0x4489c5[_0xfa69('0x17')]&&_['isArray'](_0x4489c5['applications'])&&_0x4489c5[_0xfa69('0x17')][_0xfa69('0x18')]){for(var _0x53edda=0x0;_0x53edda<_0x4489c5['applications']['length'];_0x53edda+=0x1){var _0x543edc=_0x4489c5[_0xfa69('0x17')][_0x53edda];if(fs[_0xfa69('0x19')](path[_0xfa69('0x1a')](__dirname,_0xfa69('0x17'),_0x543edc['app']+_0xfa69('0x1b')))){var _0x55e3a5=[];switch(_0x543edc[_0xfa69('0x1c')][_0xfa69('0x1d')]()){case _0xfa69('0x1e'):var _0x5aa8f8=_0x543edc['appdata']['split'](',');_0x55e3a5[_0xfa69('0x1f')](_0x5aa8f8[0x0]);_0x55e3a5[_0xfa69('0x1f')](_0x5aa8f8[_0xfa69('0x20')](0x1,_0x5aa8f8[_0xfa69('0x18')])[_0xfa69('0x1a')](','));break;case _0xfa69('0x21'):var _0x153fe3=_0x543edc['appdata']['split'](',');_0x55e3a5['push'](_0x153fe3[0x0]);_0x55e3a5['push'](_0x153fe3[0x1]);_0x55e3a5[_0xfa69('0x1f')](_0x153fe3[_0xfa69('0x20')](0x2,_0x153fe3[_0xfa69('0x18')])[_0xfa69('0x1a')](','));break;case _0xfa69('0x22'):var _0x1c4b84=_0x543edc[_0xfa69('0x23')][_0xfa69('0x24')](',');_0x55e3a5[_0xfa69('0x1f')](_0x1c4b84[0x0]);_0x55e3a5[_0xfa69('0x1f')](_0x1c4b84[0x1]);_0x55e3a5[_0xfa69('0x1f')](_0x1c4b84[0x2]);_0x55e3a5[_0xfa69('0x1f')](_0x1c4b84[0x3]);_0x55e3a5[_0xfa69('0x1f')](_0x1c4b84[_0xfa69('0x20')](0x4,_0x1c4b84['length'])['join'](','));break;case'message':_0x55e3a5['push'](_0x543edc[_0xfa69('0x23')]);break;case _0xfa69('0x25'):_0x55e3a5['push'](_0x543edc[_0xfa69('0x26')]);_0x55e3a5[_0xfa69('0x1f')](_0x543edc[_0xfa69('0x23')]);break;default:_0x55e3a5=_[_0xfa69('0xe')](_0x543edc[_0xfa69('0x23')])?[]:_0x543edc['appdata'][_0xfa69('0x24')](',');}var _0x3172cd={'id':util['format'](_0xfa69('0x27'),_0x3afcd3,_0x543edc['id'],_0x543edc[_0xfa69('0x1c')]),'condition':require('./interval')[_0xfa69('0x28')](_0x3afcd3,getIntervals(_0x201f86[_0xfa69('0x29')],_0x543edc),_0x201f86),'consequence':require(_0xfa69('0x2a')+_0x543edc['app'])[_0xfa69('0x2b')](_0x3afcd3,_0x55e3a5,_0x201f86,_0x4489c5),'p':_0x543edc[_0xfa69('0x2c')]||0x0};logger[_0xfa69('0x2d')](_0xfa69('0x2e'),_0x3172cd['id'],_0xfa69('0x2f'),getIntervals(_0x201f86['intervals'],_0x543edc)[_0xfa69('0x1a')]('\x20|\x20'));_0x4c0031['push'](_0x3172cd);}else{logger[_0xfa69('0x30')](_0xfa69('0x31'),path[_0xfa69('0x1a')](__dirname,_0xfa69('0x17'),_0x543edc['app']+_0xfa69('0x1b')));}}_0x201f86[_0xfa69('0x13')][_0x3afcd3]=new RuleEngine(_0x4c0031);_0x201f86['rules'][_0x3afcd3]['execute'](_0x4489c5,function(_0x3555d0){logger[_0xfa69('0x2d')]('Applications\x20executed',JSON[_0xfa69('0x32')](_0x3555d0['matchPath']));if(_0x201f86['rules'][_0x3afcd3]){_0x201f86['rules'][_0x3afcd3][_0xfa69('0x33')](_0xfa69('0x34'));}});return _0x4ad8ef({'code':0xc8,'message':_0x4489c5});}else{logger[_0xfa69('0x2d')](_0xfa69('0x35'));return _0x4ad8ef({'code':0xc8,'message':_0x4489c5});}}catch(_0x5548bd){logger[_0xfa69('0x30')](_0x5548bd['stack']);return _0x9ec90c(_0x3f14b4[_0xfa69('0x30')](0x1f4,_0x5548bd));}}return _0x9ec90c(_0xfa69('0x36'));});},'AcceptMessage':function(_0x219a29){var _0xb2ce83=this;return new Promise(function(_0x4ba287,_0x455028){if(_0x219a29['message']&&_0x219a29['message']['id']){try{var _0x2a3b41=getId(_0x219a29[_0xfa69('0x14')],_0x219a29[_0xfa69('0x15')]?_0x219a29[_0xfa69('0x15')]['id']:0x0,_0x219a29[_0xfa69('0x16')]?_0x219a29['interaction']['id']:0x0);if(_0x201f86['rules'][_0x2a3b41]){_0x201f86[_0xfa69('0x13')][_0x2a3b41][_0xfa69('0x33')](_0xfa69('0x37'));if(rpc[_0x219a29[_0xfa69('0x14')]+_0xfa69('0x38')]){rpc[_0x219a29[_0xfa69('0x14')]+_0xfa69('0x38')]['update'](_0x2a3b41,{'UserId':_0x219a29[_0xfa69('0x15')][_0xfa69('0x39')]})[_0xfa69('0x3a')](function(_0x279bfb){logger['error'](_0xfa69('0x3b'));});}}return _0x4ba287({'code':0xc8,'message':_0x219a29});}catch(_0x169a53){logger[_0xfa69('0x30')](_0x169a53['stack']);return _0x455028(_0xb2ce83[_0xfa69('0x30')](0x1f4,_0x169a53));}}logger[_0xfa69('0x30')](_0xfa69('0x3c'));return _0x455028(_0xb2ce83[_0xfa69('0x30')](0x1f4,_0xfa69('0x3c')));});},'RejectMessage':function(_0x2625d6){var _0x2b70e5=this;return new Promise(function(_0x5d4423,_0x3b0969){if(_0x2625d6[_0xfa69('0x3d')]&&_0x2625d6[_0xfa69('0x3d')]['id']){try{if(_0x201f86['agents'][_0x2625d6[_0xfa69('0x3d')]['id']]){_0x201f86[_0xfa69('0x3e')][_0x2625d6['agent']['id']][_0xfa69('0x3f')]=![];_0x201f86[_0xfa69('0x3e')][_0x2625d6[_0xfa69('0x3d')]['id']]['busyQueue']=undefined;}return _0x5d4423({'code':0xc8,'message':_0x2625d6});}catch(_0x4fff61){logger[_0xfa69('0x30')](_0x4fff61[_0xfa69('0x40')]);return _0x3b0969(_0x2b70e5[_0xfa69('0x30')](0x1f4,_0x4fff61));}}logger[_0xfa69('0x30')]('message\x20is\x20empty');return _0x3b0969(_0x2b70e5[_0xfa69('0x30')](0x1f4,_0xfa69('0x3c')));});},'AbandonInteraction':function(_0x1b4e83){var _0x4a371f=this;return new Promise(function(_0x1662c3,_0x3810cc){if(_0x1b4e83[_0xfa69('0x14')]&&_0x1b4e83[_0xfa69('0x16')]&&_0x1b4e83[_0xfa69('0x16')]['id']){try{var _0x98527d=getId(_0x1b4e83[_0xfa69('0x14')],_0x1b4e83[_0xfa69('0x15')]?_0x1b4e83[_0xfa69('0x15')]['id']:0x0,_0x1b4e83[_0xfa69('0x16')]?_0x1b4e83[_0xfa69('0x16')]['id']:0x0);if(_0x201f86[_0xfa69('0x13')][_0x98527d]){_0x201f86[_0xfa69('0x13')][_0x98527d][_0xfa69('0x33')](_0xfa69('0x37'));}return _0x1662c3({'code':0xc8,'message':_0x1b4e83});}catch(_0x5e9244){logger[_0xfa69('0x30')](_0x5e9244[_0xfa69('0x40')]);return _0x3810cc(_0x4a371f['error'](0x1f4,_0x5e9244));}}logger[_0xfa69('0x30')](_0xfa69('0x3c'));return _0x3810cc(_0x4a371f[_0xfa69('0x30')](0x1f4,_0xfa69('0x3c')));});},'AgentCapacity':function(_0x4f9165){var _0x1b8421=this;return new Promise(function(_0x53779a,_0x2b734e){if(_0x201f86[_0xfa69('0x3e')][_0xfa69('0x41')](_0x4f9165['id'])){for(var _0x492067 in _0x4f9165[_0xfa69('0x42')]){if(_0x4f9165[_0xfa69('0x42')][_0xfa69('0x41')](_0x492067)){if(_0x201f86['agents'][_0x4f9165['id']][_0xfa69('0x41')](_0x492067+_0xfa69('0x43'))){_0x201f86[_0xfa69('0x3e')][_0x4f9165['id']][_0x492067+_0xfa69('0x43')]=parseInt(_0x4f9165[_0xfa69('0x42')][_0x492067],0xa);}}}_0x201f86[_0xfa69('0x3e')][_0x4f9165['id']][_0xfa69('0x44')]();return _0x53779a({'code':0xc8,'message':_0x201f86[_0xfa69('0x3e')][_0x4f9165['id']]});}else{return _0x2b734e(_0x1b8421[_0xfa69('0x30')](0x1f4,_0xfa69('0x45')));}});},'Agents':function(_0x4548a7){return new Promise(function(_0x43356a,_0x3021eb){var _0x86226f=_[_0xfa69('0x46')](_0x201f86['agents']);_0x43356a({'count':_0x86226f[_0xfa69('0x18')],'rows':_0x86226f});});},'ChatQueues':function(_0x452884){return new Promise(function(_0x367994,_0x264519){var _0x13d0fc=[];for(var _0x1339ff in _0x201f86[_0xfa69('0x47')]){if(_0x201f86[_0xfa69('0x47')][_0xfa69('0x41')](_0x1339ff)){var _0x230268=_0x201f86[_0xfa69('0x47')][_0x1339ff];var _0x12f9a7={'id':_0x230268['id'],'available':_0x230268[_0xfa69('0x48')],'loggedIn':_0x230268[_0xfa69('0x49')],'name':_0x230268[_0xfa69('0x4a')],'paused':_0x230268[_0xfa69('0x4b')],'waiting':_0x230268['waiting']};_0x13d0fc[_0xfa69('0x1f')](_0x12f9a7);}}_0x367994({'count':_0x13d0fc['length'],'rows':_0x13d0fc});});},'MailQueues':function(_0x2d6535){return new Promise(function(_0x613201,_0x3632d2){var _0x23fe86=[];for(var _0x40f951 in _0x201f86[_0xfa69('0x4c')]){if(_0x201f86[_0xfa69('0x4c')][_0xfa69('0x41')](_0x40f951)){var _0x1543ce=_0x201f86['mailQueues'][_0x40f951];var _0x23a7e6={'id':_0x1543ce['id'],'available':_0x1543ce[_0xfa69('0x48')],'loggedIn':_0x1543ce[_0xfa69('0x49')],'name':_0x1543ce['name'],'paused':_0x1543ce['paused'],'waiting':_0x1543ce['waiting']};_0x23fe86[_0xfa69('0x1f')](_0x23a7e6);}}_0x613201({'count':_0x23fe86[_0xfa69('0x18')],'rows':_0x23fe86});});},'OpenchannelQueues':function(_0xac9f42){return new Promise(function(_0x38ee05,_0x45317a){var _0xe29996=[];for(var _0x56e22f in _0x201f86['openchannelQueues']){if(_0x201f86['openchannelQueues'][_0xfa69('0x41')](_0x56e22f)){var _0x5737c2=_0x201f86['openchannelQueues'][_0x56e22f];var _0x43eba4={'id':_0x5737c2['id'],'available':_0x5737c2[_0xfa69('0x48')],'loggedIn':_0x5737c2[_0xfa69('0x49')],'name':_0x5737c2[_0xfa69('0x4a')],'paused':_0x5737c2['paused'],'waiting':_0x5737c2[_0xfa69('0x4d')]};_0xe29996[_0xfa69('0x1f')](_0x43eba4);}}_0x38ee05({'count':_0xe29996[_0xfa69('0x18')],'rows':_0xe29996});});},'SmsQueues':function(_0x7d64fb){return new Promise(function(_0x4642fd,_0x7a5f5b){var _0x5d7d6f=[];for(var _0x4571cb in _0x201f86[_0xfa69('0x4e')]){if(_0x201f86[_0xfa69('0x4e')]['hasOwnProperty'](_0x4571cb)){var _0x3feb04=_0x201f86['smsQueues'][_0x4571cb];var _0x44ce37={'id':_0x3feb04['id'],'available':_0x3feb04[_0xfa69('0x48')],'loggedIn':_0x3feb04[_0xfa69('0x49')],'name':_0x3feb04[_0xfa69('0x4a')],'paused':_0x3feb04[_0xfa69('0x4b')],'waiting':_0x3feb04['waiting']};_0x5d7d6f['push'](_0x44ce37);}}_0x4642fd({'count':_0x5d7d6f[_0xfa69('0x18')],'rows':_0x5d7d6f});});},'FaxQueues':function(_0x2ab122){return new Promise(function(_0x50d83b,_0x30a8ca){var _0x5a2311=[];for(var _0x2320b4 in _0x201f86[_0xfa69('0x4f')]){if(_0x201f86[_0xfa69('0x4f')][_0xfa69('0x41')](_0x2320b4)){var _0x2cf4f2=_0x201f86[_0xfa69('0x4f')][_0x2320b4];var _0x1ec849={'id':_0x2cf4f2['id'],'available':_0x2cf4f2[_0xfa69('0x48')],'loggedIn':_0x2cf4f2[_0xfa69('0x49')],'name':_0x2cf4f2[_0xfa69('0x4a')],'paused':_0x2cf4f2[_0xfa69('0x4b')],'waiting':_0x2cf4f2[_0xfa69('0x4d')]};_0x5a2311[_0xfa69('0x1f')](_0x1ec849);}}_0x50d83b({'count':_0x5a2311[_0xfa69('0x18')],'rows':_0x5a2311});});},'WhatsappQueues':function(_0x449b22){return new Promise(function(_0x1382ce,_0x55f0c1){var _0x113347=[];for(var _0x1bcff0 in _0x201f86[_0xfa69('0x50')]){if(_0x201f86['whatsappQueues'][_0xfa69('0x41')](_0x1bcff0)){var _0x424fe6=_0x201f86[_0xfa69('0x50')][_0x1bcff0];var _0x17d5eb={'id':_0x424fe6['id'],'available':_0x424fe6[_0xfa69('0x48')],'loggedIn':_0x424fe6['loggedIn'],'name':_0x424fe6[_0xfa69('0x4a')],'paused':_0x424fe6[_0xfa69('0x4b')],'waiting':_0x424fe6['waiting']};_0x113347['push'](_0x17d5eb);}}_0x1382ce({'count':_0x113347[_0xfa69('0x18')],'rows':_0x113347});});},'ChatQueuesWaitingInteractions':function(_0x6d28cd){return new Promise(function(_0x273bf8,_0x43a124){var _0x31637d=_[_0xfa69('0x46')](_0x201f86[_0xfa69('0x51')]);_0x273bf8({'count':_0x31637d['length'],'rows':_0x31637d});});},'MailQueuesWaitingInteractions':function(_0x3cf70c){return new Promise(function(_0x2a8a10,_0x5e8feb){var _0x56a858=_[_0xfa69('0x46')](_0x201f86[_0xfa69('0x52')]);_0x2a8a10({'count':_0x56a858[_0xfa69('0x18')],'rows':_0x56a858});});},'OpenchannelQueuesWaitingInteractions':function(_0x7fcd8a){return new Promise(function(_0x158300,_0x18a963){var _0xd9529b=_[_0xfa69('0x46')](_0x201f86[_0xfa69('0x53')]);_0x158300({'count':_0xd9529b[_0xfa69('0x18')],'rows':_0xd9529b});});},'SmsQueuesWaitingInteractions':function(_0x12ffc4){return new Promise(function(_0x4f30f1,_0x2bee74){var _0x2be0c2=_['values'](_0x201f86[_0xfa69('0x54')]);_0x4f30f1({'count':_0x2be0c2[_0xfa69('0x18')],'rows':_0x2be0c2});});},'FaxQueuesWaitingInteractions':function(_0x7fd25a){return new Promise(function(_0x3edf69,_0x4b61cd){var _0x137295=_[_0xfa69('0x46')](_0x201f86[_0xfa69('0x55')]);_0x3edf69({'count':_0x137295[_0xfa69('0x18')],'rows':_0x137295});});},'WhatsappQueuesWaitingInteractions':function(_0x5b9579){return new Promise(function(_0x53b6d7,_0x30e8f6){var _0x412834=_[_0xfa69('0x46')](_0x201f86[_0xfa69('0x56')]);_0x53b6d7({'count':_0x412834[_0xfa69('0x18')],'rows':_0x412834});});}};var _0x489be9=jayson['server'](_0x3d7a53)[_0xfa69('0x57')]();_0x489be9['on'](_0xfa69('0x30'),function(_0x5882dd){logger[_0xfa69('0x30')](JSON['stringify'](_0x5882dd));return _0x26cc80(_0x5882dd);});_0x489be9[_0xfa69('0x58')](0x232c,_0xfa69('0x59'),function(){console[_0xfa69('0x5a')](_0xfa69('0x5b'),0x232c);return _0x449e09(_0xfa69('0x5c')+0x232c);});});}; \ No newline at end of file +var _0x8226=['join','app','toLowerCase','autoreply','appdata','push','dialogflow','split','slice','amazonlex','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','on\x20interval','error','.js','rules','execute','Applications\x20executed','stringify','emit','complete','info','No\x20applications\x20to\x20execute','routing\x20is\x20empty','end','QueueReport','UserId','catch','stack','message\x20is\x20empty','agent','agents','busyQueue','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','isArray','applications','length','existsSync'];(function(_0x3ea3b1,_0x4de91a){var _0x136b44=function(_0x3bbe80){while(--_0x3bbe80){_0x3ea3b1['push'](_0x3ea3b1['shift']());}};_0x136b44(++_0x4de91a);}(_0x8226,0x95));var _0x6822=function(_0xb517fb,_0x1ae8bc){_0xb517fb=_0xb517fb-0x0;var _0x348a16=_0x8226[_0xb517fb];return _0x348a16;};'use strict';var _=require(_0x6822('0x0'));var util=require('util');var path=require(_0x6822('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x6822('0x2'));var uuid=require('uuid');var config=require(_0x6822('0x3'));var logger=require(_0x6822('0x4'))(_0x6822('0x5'));var rpc={'openchannelQueueReport':require(_0x6822('0x6')),'mailQueueReport':require(_0x6822('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x6822('0x8')),'faxQueueReport':require(_0x6822('0x9')),'whatsappQueueReport':require(_0x6822('0xa'))};var RuleEngine=require(_0x6822('0xb'));function getId(_0x54c018,_0x3dccfa,_0x48acac){return util[_0x6822('0xc')](_0x6822('0xd'),_0x54c018,_0x3dccfa||0x0,_0x48acac||0x0);}function getIntervals(_0x3fe5a3,_0x3eecec){var _0x413062=[];if(!_[_0x6822('0xe')](_0x3eecec[_0x6822('0xf')])&&!_[_0x6822('0xe')](_0x3fe5a3[_0x3eecec[_0x6822('0xf')]])&&!_[_0x6822('0xe')](_0x3fe5a3[_0x3eecec[_0x6822('0xf')]][_0x6822('0x10')])){_0x413062=_[_0x6822('0x11')](_0x3fe5a3[_0x3eecec['IntervalId']][_0x6822('0x10')],_0x6822('0x12'));}else if(!_[_0x6822('0xe')](_0x3eecec['interval'])){_0x413062=[_0x3eecec['interval']];}return _0x413062;}exports[_0x6822('0x13')]=function(_0xead642){_0xead642['rules']={};return new BPromise(function(_0x123c2b,_0x488e7c){var _0x987686={'Start':function(_0x3625b5){var _0x2e9bb8=this;return new Promise(function(_0x190b4c,_0x5286f2){if(_0x3625b5){try{var _0x13a87a=[];var _0x3b51ab=getId(_0x3625b5[_0x6822('0x14')],_0x3625b5[_0x6822('0x15')]?_0x3625b5['message']['id']:0x0,_0x3625b5[_0x6822('0x16')]?_0x3625b5[_0x6822('0x16')]['id']:0x0);if(_0x3625b5['applications']&&_[_0x6822('0x17')](_0x3625b5[_0x6822('0x18')])&&_0x3625b5[_0x6822('0x18')][_0x6822('0x19')]){for(var _0x43a581=0x0;_0x43a581<_0x3625b5['applications'][_0x6822('0x19')];_0x43a581+=0x1){var _0x493bde=_0x3625b5[_0x6822('0x18')][_0x43a581];if(fs[_0x6822('0x1a')](path[_0x6822('0x1b')](__dirname,_0x6822('0x18'),_0x493bde[_0x6822('0x1c')]+'.js'))){var _0x3485b9=[];switch(_0x493bde[_0x6822('0x1c')][_0x6822('0x1d')]()){case _0x6822('0x1e'):var _0x315430=_0x493bde[_0x6822('0x1f')]['split'](',');_0x3485b9[_0x6822('0x20')](_0x315430[0x0]);_0x3485b9[_0x6822('0x20')](_0x315430['slice'](0x1,_0x315430['length'])[_0x6822('0x1b')](','));break;case _0x6822('0x21'):var _0x2403c4=_0x493bde[_0x6822('0x1f')][_0x6822('0x22')](',');_0x3485b9[_0x6822('0x20')](_0x2403c4[0x0]);_0x3485b9[_0x6822('0x20')](_0x2403c4[0x1]);_0x3485b9[_0x6822('0x20')](_0x2403c4[_0x6822('0x23')](0x2,_0x2403c4['length'])[_0x6822('0x1b')](','));break;case _0x6822('0x24'):var _0x4c7176=_0x493bde[_0x6822('0x1f')][_0x6822('0x22')](',');_0x3485b9[_0x6822('0x20')](_0x4c7176[0x0]);_0x3485b9[_0x6822('0x20')](_0x4c7176[0x1]);_0x3485b9[_0x6822('0x20')](_0x4c7176[0x2]);_0x3485b9[_0x6822('0x20')](_0x4c7176[0x3]);_0x3485b9[_0x6822('0x20')](_0x4c7176[_0x6822('0x23')](0x4,_0x4c7176[_0x6822('0x19')])[_0x6822('0x1b')](','));break;case _0x6822('0x15'):_0x3485b9[_0x6822('0x20')](_0x493bde['appdata']);break;case'tag':_0x3485b9[_0x6822('0x20')](_0x493bde[_0x6822('0x25')]);_0x3485b9[_0x6822('0x20')](_0x493bde[_0x6822('0x1f')]);break;default:_0x3485b9=_[_0x6822('0xe')](_0x493bde[_0x6822('0x1f')])?[]:_0x493bde[_0x6822('0x1f')]['split'](',');}var _0x19d83c={'id':util['format'](_0x6822('0x26'),_0x3b51ab,_0x493bde['id'],_0x493bde[_0x6822('0x1c')]),'condition':require(_0x6822('0x27'))[_0x6822('0x28')](_0x3b51ab,getIntervals(_0xead642[_0x6822('0x29')],_0x493bde),_0xead642),'consequence':require(_0x6822('0x2a')+_0x493bde[_0x6822('0x1c')])[_0x6822('0x2b')](_0x3b51ab,_0x3485b9,_0xead642,_0x3625b5),'p':_0x493bde['priority']||0x0};logger['info']('Push\x20new\x20rule',_0x19d83c['id'],_0x6822('0x2c'),getIntervals(_0xead642[_0x6822('0x29')],_0x493bde)[_0x6822('0x1b')]('\x20|\x20'));_0x13a87a['push'](_0x19d83c);}else{logger[_0x6822('0x2d')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x6822('0x1b')](__dirname,_0x6822('0x18'),_0x493bde[_0x6822('0x1c')]+_0x6822('0x2e')));}}_0xead642[_0x6822('0x2f')][_0x3b51ab]=new RuleEngine(_0x13a87a);_0xead642[_0x6822('0x2f')][_0x3b51ab][_0x6822('0x30')](_0x3625b5,function(_0x4b19df){logger['info'](_0x6822('0x31'),JSON[_0x6822('0x32')](_0x4b19df['matchPath']));if(_0xead642[_0x6822('0x2f')][_0x3b51ab]){_0xead642[_0x6822('0x2f')][_0x3b51ab][_0x6822('0x33')](_0x6822('0x34'));}});return _0x190b4c({'code':0xc8,'message':_0x3625b5});}else{logger[_0x6822('0x35')](_0x6822('0x36'));return _0x190b4c({'code':0xc8,'message':_0x3625b5});}}catch(_0x2b7485){logger[_0x6822('0x2d')](_0x2b7485['stack']);return _0x5286f2(_0x2e9bb8['error'](0x1f4,_0x2b7485));}}return _0x5286f2(_0x6822('0x37'));});},'AcceptMessage':function(_0x3ec933){var _0x2c64af=this;return new Promise(function(_0x3e2292,_0x35a212){if(_0x3ec933[_0x6822('0x15')]&&_0x3ec933[_0x6822('0x15')]['id']){try{var _0x238d8e=getId(_0x3ec933['channel'],_0x3ec933[_0x6822('0x15')]?_0x3ec933[_0x6822('0x15')]['id']:0x0,_0x3ec933[_0x6822('0x16')]?_0x3ec933[_0x6822('0x16')]['id']:0x0);if(_0xead642[_0x6822('0x2f')][_0x238d8e]){_0xead642[_0x6822('0x2f')][_0x238d8e][_0x6822('0x33')](_0x6822('0x38'));if(rpc[_0x3ec933[_0x6822('0x14')]+_0x6822('0x39')]){rpc[_0x3ec933[_0x6822('0x14')]+'QueueReport']['update'](_0x238d8e,{'UserId':_0x3ec933['message'][_0x6822('0x3a')]})[_0x6822('0x3b')](function(_0x564182){logger['error']('error\x20update\x20queue\x20report');});}}return _0x3e2292({'code':0xc8,'message':_0x3ec933});}catch(_0x45cb2c){logger[_0x6822('0x2d')](_0x45cb2c[_0x6822('0x3c')]);return _0x35a212(_0x2c64af[_0x6822('0x2d')](0x1f4,_0x45cb2c));}}logger['error'](_0x6822('0x3d'));return _0x35a212(_0x2c64af['error'](0x1f4,_0x6822('0x3d')));});},'RejectMessage':function(_0x5ce7fe){var _0x2cb840=this;return new Promise(function(_0x46bdc4,_0x589c8d){if(_0x5ce7fe[_0x6822('0x3e')]&&_0x5ce7fe[_0x6822('0x3e')]['id']){try{if(_0xead642['agents'][_0x5ce7fe[_0x6822('0x3e')]['id']]){_0xead642[_0x6822('0x3f')][_0x5ce7fe[_0x6822('0x3e')]['id']]['busy']=![];_0xead642[_0x6822('0x3f')][_0x5ce7fe[_0x6822('0x3e')]['id']][_0x6822('0x40')]=undefined;}return _0x46bdc4({'code':0xc8,'message':_0x5ce7fe});}catch(_0x55aa72){logger[_0x6822('0x2d')](_0x55aa72[_0x6822('0x3c')]);return _0x589c8d(_0x2cb840[_0x6822('0x2d')](0x1f4,_0x55aa72));}}logger[_0x6822('0x2d')]('message\x20is\x20empty');return _0x589c8d(_0x2cb840['error'](0x1f4,_0x6822('0x3d')));});},'AbandonInteraction':function(_0x18fb05){var _0x5122bc=this;return new Promise(function(_0x26a0bf,_0x274bed){if(_0x18fb05[_0x6822('0x14')]&&_0x18fb05['interaction']&&_0x18fb05[_0x6822('0x16')]['id']){try{var _0x24e814=getId(_0x18fb05['channel'],_0x18fb05['message']?_0x18fb05['message']['id']:0x0,_0x18fb05['interaction']?_0x18fb05[_0x6822('0x16')]['id']:0x0);if(_0xead642[_0x6822('0x2f')][_0x24e814]){_0xead642[_0x6822('0x2f')][_0x24e814]['emit']('end');}return _0x26a0bf({'code':0xc8,'message':_0x18fb05});}catch(_0x202ffc){logger[_0x6822('0x2d')](_0x202ffc[_0x6822('0x3c')]);return _0x274bed(_0x5122bc[_0x6822('0x2d')](0x1f4,_0x202ffc));}}logger[_0x6822('0x2d')](_0x6822('0x3d'));return _0x274bed(_0x5122bc[_0x6822('0x2d')](0x1f4,_0x6822('0x3d')));});},'AgentCapacity':function(_0x47ab37){var _0x40ffab=this;return new Promise(function(_0x213b21,_0x37b233){if(_0xead642[_0x6822('0x3f')][_0x6822('0x41')](_0x47ab37['id'])){for(var _0x56388b in _0x47ab37[_0x6822('0x42')]){if(_0x47ab37[_0x6822('0x42')][_0x6822('0x41')](_0x56388b)){if(_0xead642[_0x6822('0x3f')][_0x47ab37['id']][_0x6822('0x41')](_0x56388b+_0x6822('0x43'))){_0xead642[_0x6822('0x3f')][_0x47ab37['id']][_0x56388b+_0x6822('0x43')]=parseInt(_0x47ab37[_0x6822('0x42')][_0x56388b],0xa);}}}_0xead642['agents'][_0x47ab37['id']]['updateRealtime']();return _0x213b21({'code':0xc8,'message':_0xead642[_0x6822('0x3f')][_0x47ab37['id']]});}else{return _0x37b233(_0x40ffab['error'](0x1f4,_0x6822('0x44')));}});},'Agents':function(_0x12c341){return new Promise(function(_0x1452ab,_0x33eeb1){var _0x532d61=_[_0x6822('0x45')](_0xead642[_0x6822('0x3f')]);_0x1452ab({'count':_0x532d61[_0x6822('0x19')],'rows':_0x532d61});});},'ChatQueues':function(_0x314b71){return new Promise(function(_0xfe7407,_0x4d827f){var _0xd2b7d5=[];for(var _0x456813 in _0xead642[_0x6822('0x46')]){if(_0xead642['chatQueues'][_0x6822('0x41')](_0x456813)){var _0x14a25b=_0xead642[_0x6822('0x46')][_0x456813];var _0x15a840={'id':_0x14a25b['id'],'available':_0x14a25b[_0x6822('0x47')],'loggedIn':_0x14a25b[_0x6822('0x48')],'name':_0x14a25b[_0x6822('0x49')],'paused':_0x14a25b[_0x6822('0x4a')],'waiting':_0x14a25b[_0x6822('0x4b')]};_0xd2b7d5[_0x6822('0x20')](_0x15a840);}}_0xfe7407({'count':_0xd2b7d5[_0x6822('0x19')],'rows':_0xd2b7d5});});},'MailQueues':function(_0x3eac94){return new Promise(function(_0xa8cc52,_0x26cc9d){var _0x2a6717=[];for(var _0x324f19 in _0xead642[_0x6822('0x4c')]){if(_0xead642[_0x6822('0x4c')]['hasOwnProperty'](_0x324f19)){var _0x3b52a0=_0xead642[_0x6822('0x4c')][_0x324f19];var _0x3deac9={'id':_0x3b52a0['id'],'available':_0x3b52a0['available'],'loggedIn':_0x3b52a0[_0x6822('0x48')],'name':_0x3b52a0[_0x6822('0x49')],'paused':_0x3b52a0['paused'],'waiting':_0x3b52a0[_0x6822('0x4b')]};_0x2a6717['push'](_0x3deac9);}}_0xa8cc52({'count':_0x2a6717['length'],'rows':_0x2a6717});});},'OpenchannelQueues':function(_0x13a563){return new Promise(function(_0x23a852,_0x27835c){var _0x2b206c=[];for(var _0x2ded41 in _0xead642['openchannelQueues']){if(_0xead642[_0x6822('0x4d')][_0x6822('0x41')](_0x2ded41)){var _0x547072=_0xead642['openchannelQueues'][_0x2ded41];var _0x40d676={'id':_0x547072['id'],'available':_0x547072[_0x6822('0x47')],'loggedIn':_0x547072[_0x6822('0x48')],'name':_0x547072[_0x6822('0x49')],'paused':_0x547072[_0x6822('0x4a')],'waiting':_0x547072[_0x6822('0x4b')]};_0x2b206c[_0x6822('0x20')](_0x40d676);}}_0x23a852({'count':_0x2b206c[_0x6822('0x19')],'rows':_0x2b206c});});},'SmsQueues':function(_0x508aa5){return new Promise(function(_0x42d956,_0x32c5d7){var _0x36c114=[];for(var _0x1d0339 in _0xead642[_0x6822('0x4e')]){if(_0xead642[_0x6822('0x4e')]['hasOwnProperty'](_0x1d0339)){var _0x3ce9fa=_0xead642[_0x6822('0x4e')][_0x1d0339];var _0x793613={'id':_0x3ce9fa['id'],'available':_0x3ce9fa['available'],'loggedIn':_0x3ce9fa[_0x6822('0x48')],'name':_0x3ce9fa['name'],'paused':_0x3ce9fa[_0x6822('0x4a')],'waiting':_0x3ce9fa[_0x6822('0x4b')]};_0x36c114[_0x6822('0x20')](_0x793613);}}_0x42d956({'count':_0x36c114[_0x6822('0x19')],'rows':_0x36c114});});},'FaxQueues':function(_0x1a661e){return new Promise(function(_0x12d5c5,_0x50d44e){var _0x561586=[];for(var _0x9e4364 in _0xead642['faxQueues']){if(_0xead642[_0x6822('0x4f')][_0x6822('0x41')](_0x9e4364)){var _0x546839=_0xead642['faxQueues'][_0x9e4364];var _0x2275ea={'id':_0x546839['id'],'available':_0x546839[_0x6822('0x47')],'loggedIn':_0x546839['loggedIn'],'name':_0x546839[_0x6822('0x49')],'paused':_0x546839[_0x6822('0x4a')],'waiting':_0x546839[_0x6822('0x4b')]};_0x561586[_0x6822('0x20')](_0x2275ea);}}_0x12d5c5({'count':_0x561586['length'],'rows':_0x561586});});},'WhatsappQueues':function(_0x168e0e){return new Promise(function(_0x516204,_0x48321d){var _0xfae16e=[];for(var _0x1281c0 in _0xead642['whatsappQueues']){if(_0xead642['whatsappQueues']['hasOwnProperty'](_0x1281c0)){var _0x494479=_0xead642['whatsappQueues'][_0x1281c0];var _0x2d0954={'id':_0x494479['id'],'available':_0x494479[_0x6822('0x47')],'loggedIn':_0x494479['loggedIn'],'name':_0x494479[_0x6822('0x49')],'paused':_0x494479[_0x6822('0x4a')],'waiting':_0x494479[_0x6822('0x4b')]};_0xfae16e[_0x6822('0x20')](_0x2d0954);}}_0x516204({'count':_0xfae16e[_0x6822('0x19')],'rows':_0xfae16e});});},'ChatQueuesWaitingInteractions':function(_0x5f442c){return new Promise(function(_0xd79706,_0x11b5aa){var _0x191b95=_['values'](_0xead642[_0x6822('0x50')]);_0xd79706({'count':_0x191b95[_0x6822('0x19')],'rows':_0x191b95});});},'MailQueuesWaitingInteractions':function(_0x402d6b){return new Promise(function(_0x10622c,_0x21ab1f){var _0x1fba6f=_[_0x6822('0x45')](_0xead642['mailQueuesWaitingInteractions']);_0x10622c({'count':_0x1fba6f[_0x6822('0x19')],'rows':_0x1fba6f});});},'OpenchannelQueuesWaitingInteractions':function(_0x48a14b){return new Promise(function(_0x5dd052,_0x5b9a6b){var _0x5a39c5=_[_0x6822('0x45')](_0xead642['openchannelQueuesWaitingInteractions']);_0x5dd052({'count':_0x5a39c5[_0x6822('0x19')],'rows':_0x5a39c5});});},'SmsQueuesWaitingInteractions':function(_0x1e23fc){return new Promise(function(_0x4864ab,_0x3cd970){var _0x4d5486=_['values'](_0xead642['smsQueuesWaitingInteractions']);_0x4864ab({'count':_0x4d5486[_0x6822('0x19')],'rows':_0x4d5486});});},'FaxQueuesWaitingInteractions':function(_0x225348){return new Promise(function(_0x106536,_0x118e2e){var _0x1bada1=_[_0x6822('0x45')](_0xead642[_0x6822('0x51')]);_0x106536({'count':_0x1bada1['length'],'rows':_0x1bada1});});},'WhatsappQueuesWaitingInteractions':function(_0x5042a5){return new Promise(function(_0x51686f,_0x3112cb){var _0x15c5de=_[_0x6822('0x45')](_0xead642[_0x6822('0x52')]);_0x51686f({'count':_0x15c5de[_0x6822('0x19')],'rows':_0x15c5de});});}};var _0x167170=jayson[_0x6822('0x53')](_0x987686)[_0x6822('0x54')]();_0x167170['on'](_0x6822('0x2d'),function(_0x16212e){logger[_0x6822('0x2d')](JSON[_0x6822('0x32')](_0x16212e));return _0x488e7c(_0x16212e);});_0x167170[_0x6822('0x13')](0x232c,_0x6822('0x55'),function(){console['log'](_0x6822('0x56'),0x232c);return _0x123c2b(_0x6822('0x57')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index a84ca1d..0d48aa0 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 _0xb38e=['lodash','../../../config/logger','routing','http','request','then','error','result','catch','rules','info','length','push','Command','format','iftime\x20%s','message','indexOf','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','log','\x20|\x20','stack','stop','util','bluebird','jayson/promise'];(function(_0x227441,_0x52ec0f){var _0x49d795=function(_0x5ea193){while(--_0x5ea193){_0x227441['push'](_0x227441['shift']());}};_0x49d795(++_0x52ec0f);}(_0xb38e,0xed));var _0xeb38=function(_0x543ff9,_0x5ade16){_0x543ff9=_0x543ff9-0x0;var _0x5996ac=_0xb38e[_0x543ff9];return _0x5996ac;};'use strict';var util=require(_0xeb38('0x0'));var BPromise=require(_0xeb38('0x1'));var jayson=require(_0xeb38('0x2'));var _=require(_0xeb38('0x3'));var logger=require(_0xeb38('0x4'))(_0xeb38('0x5'));var client=jayson['client'][_0xeb38('0x6')]({'port':0x232a});function request(_0x2911e0,_0xc1f51){return new BPromise(function(_0x22532f,_0x28778c){return client[_0xeb38('0x7')](_0x2911e0,_0xc1f51)[_0xeb38('0x8')](function(_0x336f75){if(_0x336f75['error']){return _0x28778c(_0x336f75[_0xeb38('0x9')]['message']);}else{return _0x22532f(_0x336f75[_0xeb38('0xa')]);}})[_0xeb38('0xb')](function(_0x4cd403){return _0x28778c(_0x4cd403);});});}exports['condition']=function(_0x4e85a7,_0x173909,_0x3a8ab7){return function(_0x2c3800){if(_0x3a8ab7[_0xeb38('0xc')]&&!_0x3a8ab7['rules'][_0x4e85a7]){logger[_0xeb38('0xd')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x4e85a7);return _0x2c3800['stop']();}var _0x540d3e=[];for(var _0x59e1cd=0x0;_0x59e1cd<_0x173909[_0xeb38('0xe')];_0x59e1cd+=0x1){_0x540d3e[_0xeb38('0xf')](request(_0xeb38('0x10'),{'command':util[_0xeb38('0x11')](_0xeb38('0x12'),_0x173909[_0x59e1cd])})[_0xeb38('0x8')](function(_0xd018bb){return _0xd018bb&&_0xd018bb[_0xeb38('0x13')]&&_0xd018bb[_0xeb38('0x13')][_0xeb38('0x14')]('true')>=0x0?!![]:![];})[_0xeb38('0xb')](function(_0x4dd62f){logger[_0xeb38('0x9')](_0xeb38('0x15'),_0x4e85a7,_0x173909[_0x59e1cd]);}));}BPromise[_0xeb38('0x16')](_0x540d3e)['then'](function(_0x46f78f){var _0x4e07a0=_[_0xeb38('0x17')](_0x46f78f);logger['info'](_0xeb38('0x18'),_0x4e85a7,_0x173909[_0xeb38('0x19')]('\x20|\x20'),_0x4e07a0);_0x2c3800['when'](_0x4e07a0);})[_0xeb38('0xb')](function(_0xb0358b){console[_0xeb38('0x1a')](_0xb0358b);logger[_0xeb38('0x9')](_0xeb38('0x18'),_0x4e85a7,_0x173909[_0xeb38('0x19')](_0xeb38('0x1b')),_0xb0358b[_0xeb38('0x1c')]);_0x2c3800[_0xeb38('0x1d')]();});};}; \ No newline at end of file +var _0x73e1=['all','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','then','true','[%s][INTERVAL]\x20%s'];(function(_0x3dd613,_0x49e290){var _0xc77857=function(_0x489354){while(--_0x489354){_0x3dd613['push'](_0x3dd613['shift']());}};_0xc77857(++_0x49e290);}(_0x73e1,0x7a));var _0x173e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x73e1[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x173e('0x0'));var BPromise=require(_0x173e('0x1'));var jayson=require(_0x173e('0x2'));var _=require(_0x173e('0x3'));var logger=require(_0x173e('0x4'))(_0x173e('0x5'));var client=jayson[_0x173e('0x6')]['http']({'port':0x232a});function request(_0x52b30d,_0x127f49){return new BPromise(function(_0x154d6c,_0x17a94f){return client['request'](_0x52b30d,_0x127f49)['then'](function(_0x5d8eae){if(_0x5d8eae[_0x173e('0x7')]){return _0x17a94f(_0x5d8eae['error'][_0x173e('0x8')]);}else{return _0x154d6c(_0x5d8eae['result']);}})[_0x173e('0x9')](function(_0x33cee3){return _0x17a94f(_0x33cee3);});});}exports[_0x173e('0xa')]=function(_0x5a39f6,_0x24f2fd,_0x1b239e){return function(_0x5c460b){if(_0x1b239e[_0x173e('0xb')]&&!_0x1b239e['rules'][_0x5a39f6]){logger[_0x173e('0xc')](_0x173e('0xd'),_0x5a39f6);return _0x5c460b[_0x173e('0xe')]();}var _0xb4e55=[];for(var _0x471b66=0x0;_0x471b66<_0x24f2fd[_0x173e('0xf')];_0x471b66+=0x1){_0xb4e55[_0x173e('0x10')](request(_0x173e('0x11'),{'command':util[_0x173e('0x12')](_0x173e('0x13'),_0x24f2fd[_0x471b66])})[_0x173e('0x14')](function(_0x429b7b){return _0x429b7b&&_0x429b7b[_0x173e('0x8')]&&_0x429b7b[_0x173e('0x8')]['indexOf'](_0x173e('0x15'))>=0x0?!![]:![];})[_0x173e('0x9')](function(_0x3fe38a){logger[_0x173e('0x7')](_0x173e('0x16'),_0x5a39f6,_0x24f2fd[_0x471b66]);}));}BPromise[_0x173e('0x17')](_0xb4e55)[_0x173e('0x14')](function(_0x47ef3d){var _0x168b4d=_['some'](_0x47ef3d);logger[_0x173e('0xc')](_0x173e('0x18'),_0x5a39f6,_0x24f2fd[_0x173e('0x19')]('\x20|\x20'),_0x168b4d);_0x5c460b[_0x173e('0x1a')](_0x168b4d);})[_0x173e('0x9')](function(_0xd72a2){console[_0x173e('0x1b')](_0xd72a2);logger['error'](_0x173e('0x18'),_0x5a39f6,_0x24f2fd['join'](_0x173e('0x1c')),_0xd72a2['stack']);_0x5c460b[_0x173e('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 39eefff..88fbb9c 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 _0xa736=['transferexten','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfertype','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','indexOf','splice','diffTime','agent','util','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','membername','calleridnum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','connectedlinenum','connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','forIn','uniqueid','includes','abandoned','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcompleteAt','blindtransfer','transfereruniqueid','blind'];(function(_0x3a1217,_0x16388d){var _0x36e1ac=function(_0x15ea9e){while(--_0x15ea9e){_0x3a1217['push'](_0x3a1217['shift']());}};_0x36e1ac(++_0x16388d);}(_0xa736,0xe8));var _0x6a73=function(_0x134945,_0x3f377e){_0x134945=_0x134945-0x0;var _0x9cec86=_0xa736[_0x134945];return _0x9cec86;};'use strict';var _=require('lodash');var util=require(_0x6a73('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x2d9bce,_0x46e6d){utils[_0x6a73('0x1')](util[_0x6a73('0x2')](_0x6a73('0x3'),_0x2d9bce['uniqueid'],_0x2d9bce['channel'],_0x2d9bce['queue'],_0x2d9bce[_0x6a73('0x4')],_0x2d9bce['interface'],_0x2d9bce[_0x6a73('0x5')],_0x2d9bce['connectedlinenum'],_0x2d9bce[_0x6a73('0x6')]));if(_0x2d9bce[_0x6a73('0x7')]){utils[_0x6a73('0x8')](_0x2d9bce[_0x6a73('0x7')])[_0x6a73('0x9')](function(_0x2ea1b7){if(_0x2ea1b7){_0x2d9bce['type']=_0x2ea1b7[_0x6a73('0xa')];_0x2d9bce[_0x6a73('0xb')]=_0x2d9bce[_0x6a73('0xc')]?_0x2ea1b7[_0x6a73('0xd')]:![];_0x2d9bce[_0x6a73('0xe')]=_0x2d9bce[_0x6a73('0xb')]?_0x2ea1b7[_0x6a73('0xf')]:0x0;}utils[_0x6a73('0x10')](_0x6a73('0x11'),_0x2d9bce);});}else{utils[_0x6a73('0x10')]('CreateVoiceAgentReport',_0x2d9bce);}if(_0x46e6d){delete transfers[_0x2d9bce['uniqueid']];}else{delete agents[_0x2d9bce[_0x6a73('0x12')]];}}exports[_0x6a73('0x13')]=function(_0x1974fa){try{agents[_0x1974fa[_0x6a73('0x12')]]=_0x1974fa;agents[_0x1974fa['destuniqueid']][_0x6a73('0x14')]=utils[_0x6a73('0x15')]();agents[_0x1974fa[_0x6a73('0x12')]]['lastevent']='called';agents[_0x1974fa[_0x6a73('0x12')]][_0x6a73('0x16')]=null;agents[_0x1974fa[_0x6a73('0x12')]][_0x6a73('0x17')]=null;}catch(_0x33c11d){utils[_0x6a73('0x18')](_0x33c11d[_0x6a73('0x19')]);}};exports[_0x6a73('0x1a')]=function(_0x2cf11e){try{if(!_[_0x6a73('0x1b')](agents[_0x2cf11e[_0x6a73('0x12')]])){agents[_0x2cf11e['destuniqueid']]['agentringnoanswer']=!![];agents[_0x2cf11e[_0x6a73('0x12')]][_0x6a73('0x1c')]=utils[_0x6a73('0x15')]();agents[_0x2cf11e[_0x6a73('0x12')]][_0x6a73('0x6')]=_0x6a73('0x1d');agents[_0x2cf11e[_0x6a73('0x12')]][_0x6a73('0x1e')]='timeout';agents[_0x2cf11e[_0x6a73('0x12')]][_0x6a73('0x1f')]=_0x2cf11e[_0x6a73('0x20')]?parseInt(_0x2cf11e[_0x6a73('0x20')])/0x3e8:0x0;agents[_0x2cf11e[_0x6a73('0x12')]][_0x6a73('0x21')]=0x0;unanswered[_0x6a73('0x22')](_0x2cf11e[_0x6a73('0x12')]);}}catch(_0xede803){utils[_0x6a73('0x18')](_0xede803[_0x6a73('0x19')]);}};exports['queuecallerabandon']=function(_0x3672af){try{_[_0x6a73('0x23')](agents,function(_0x1e7d5c,_0x443b61){if(_0x1e7d5c[_0x6a73('0x24')]==_0x3672af[_0x6a73('0x24')]&&!_[_0x6a73('0x25')](unanswered,_0x1e7d5c['destuniqueid'])){_0x1e7d5c[_0x6a73('0x1a')]=!![];_0x1e7d5c[_0x6a73('0x1c')]=utils['now']();_0x1e7d5c[_0x6a73('0x6')]=_0x6a73('0x26');_0x1e7d5c[_0x6a73('0x1e')]=_0x6a73('0x26');_0x1e7d5c['holdtime']=_0x3672af['holdtime'];_0x1e7d5c['talktime']=0x0;writeDB(_0x1e7d5c);}});}catch(_0x26a51b){utils[_0x6a73('0x18')](_0x26a51b[_0x6a73('0x19')]);}};exports['agentconnect']=function(_0x4e4e13){try{if(agents[_0x4e4e13[_0x6a73('0x12')]]){agents[_0x4e4e13[_0x6a73('0x12')]][_0x6a73('0x27')]=utils[_0x6a73('0x15')]();agents[_0x4e4e13['destuniqueid']][_0x6a73('0x16')]=_0x4e4e13[_0x6a73('0x16')];agents[_0x4e4e13[_0x6a73('0x12')]][_0x6a73('0x17')]=_0x4e4e13[_0x6a73('0x17')];agents[_0x4e4e13['destuniqueid']]['holdtime']=_0x4e4e13['ringtime'];agents[_0x4e4e13['destuniqueid']][_0x6a73('0x6')]=_0x6a73('0x28');_[_0x6a73('0x23')](agents,function(_0x22648a,_0x18b902){if(_0x22648a[_0x6a73('0x12')]!=_0x4e4e13[_0x6a73('0x12')]&&_0x22648a[_0x6a73('0x24')]==_0x4e4e13[_0x6a73('0x24')]){_0x22648a[_0x6a73('0x21')]=0x0;_0x22648a[_0x6a73('0x1f')]=_0x4e4e13[_0x6a73('0x20')];_0x22648a[_0x6a73('0x1a')]=!![];_0x22648a[_0x6a73('0x1c')]=utils[_0x6a73('0x15')]();_0x22648a[_0x6a73('0x6')]=_0x6a73('0x29');_0x22648a['reason']=_0x6a73('0x29');_0x22648a[_0x6a73('0x2a')]=_0x4e4e13[_0x6a73('0x12')];_0x22648a[_0x6a73('0x2b')]=_0x4e4e13[_0x6a73('0x4')];writeDB(_0x22648a);}});}}catch(_0x5231bc){utils[_0x6a73('0x18')](_0x5231bc[_0x6a73('0x19')]);}};exports['agentcomplete']=function(_0x56e078){try{if(!_[_0x6a73('0x1b')](agents[_0x56e078['destuniqueid']])){agents[_0x56e078[_0x6a73('0x12')]]['agentcomplete']=!![];agents[_0x56e078[_0x6a73('0x12')]][_0x6a73('0x2c')]=utils[_0x6a73('0x15')]();agents[_0x56e078['destuniqueid']][_0x6a73('0x21')]=utils['diffTime'](agents[_0x56e078[_0x6a73('0x12')]][_0x6a73('0x2c')],agents[_0x56e078[_0x6a73('0x12')]]['agentconnectAt']);agents[_0x56e078[_0x6a73('0x12')]][_0x6a73('0x1e')]=_0x56e078['reason'];agents[_0x56e078['destuniqueid']][_0x6a73('0x6')]='complete';writeDB(agents[_0x56e078['destuniqueid']]);}}catch(_0x1e5c05){utils[_0x6a73('0x18')](_0x1e5c05[_0x6a73('0x19')]);}};exports[_0x6a73('0x2d')]=function(_0x13e617){try{if(!_[_0x6a73('0x1b')](agents[_0x13e617[_0x6a73('0x2e')]])){agents[_0x13e617[_0x6a73('0x2e')]]['transfer']=!![];agents[_0x13e617[_0x6a73('0x2e')]]['transfertype']=_0x6a73('0x2f');agents[_0x13e617['transfereruniqueid']][_0x6a73('0x30')]=_0x13e617['extension'];agents[_0x13e617[_0x6a73('0x2e')]][_0x6a73('0x31')]=agents[_0x13e617['transfereruniqueid']][_0x6a73('0x24')];}}catch(_0x478a7c){utils[_0x6a73('0x18')](_0x478a7c[_0x6a73('0x19')]);}};exports[_0x6a73('0x32')]=function(_0x1d3fee){try{if(_0x1d3fee[_0x6a73('0x33')]==_0x1d3fee[_0x6a73('0x34')]){if(!_['isNil'](agents[_0x1d3fee[_0x6a73('0x35')]])){agents[_0x1d3fee[_0x6a73('0x35')]]['transfer']=!![];agents[_0x1d3fee[_0x6a73('0x35')]][_0x6a73('0x36')]='ATTENDED';agents[_0x1d3fee[_0x6a73('0x35')]][_0x6a73('0x30')]=_0x1d3fee['origtransfererexten'];agents[_0x1d3fee[_0x6a73('0x35')]]['transferuniqueid']=_0x1d3fee[_0x6a73('0x33')];}if(_0x1d3fee[_0x6a73('0x37')]&&agents[_0x1d3fee[_0x6a73('0x37')]]){agents[_0x1d3fee[_0x6a73('0x37')]][_0x6a73('0x38')]=0x1;transfers[_0x1d3fee[_0x6a73('0x37')]]=_[_0x6a73('0x39')](agents[_0x1d3fee[_0x6a73('0x37')]]);transfers[_0x1d3fee[_0x6a73('0x37')]][_0x6a73('0x5')]=agents[_0x1d3fee['secondtransfereruniqueid']][_0x6a73('0x5')];transfers[_0x1d3fee[_0x6a73('0x37')]][_0x6a73('0x3a')]=agents[_0x1d3fee[_0x6a73('0x35')]]['calleridname'];transfers[_0x1d3fee[_0x6a73('0x37')]]['agentcalledAt']=utils[_0x6a73('0x15')]();transfers[_0x1d3fee[_0x6a73('0x37')]][_0x6a73('0x27')]=utils['now']();transfers[_0x1d3fee[_0x6a73('0x37')]][_0x6a73('0x1f')]=0x0;transfers[_0x1d3fee['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x1d3fee[_0x6a73('0x35')]==_0x1d3fee[_0x6a73('0x3b')]){if(!_[_0x6a73('0x1b')](agents[_0x1d3fee[_0x6a73('0x33')]])){agents[_0x1d3fee[_0x6a73('0x33')]]['transfer']=!![];agents[_0x1d3fee[_0x6a73('0x33')]][_0x6a73('0x36')]=_0x6a73('0x3c');agents[_0x1d3fee[_0x6a73('0x33')]]['transferexten']=_0x1d3fee[_0x6a73('0x3d')];agents[_0x1d3fee[_0x6a73('0x33')]][_0x6a73('0x31')]=_0x1d3fee[_0x6a73('0x35')];}if(_0x1d3fee[_0x6a73('0x3e')]&&agents[_0x1d3fee[_0x6a73('0x3e')]]){agents[_0x1d3fee[_0x6a73('0x3e')]][_0x6a73('0x38')]=0x1;transfers[_0x1d3fee[_0x6a73('0x3e')]]=_[_0x6a73('0x39')](agents[_0x1d3fee['transfertargetuniqueid']]);transfers[_0x1d3fee[_0x6a73('0x3e')]][_0x6a73('0x5')]=agents[_0x1d3fee[_0x6a73('0x33')]][_0x6a73('0x5')];transfers[_0x1d3fee[_0x6a73('0x3e')]]['calleridname']=agents[_0x1d3fee[_0x6a73('0x33')]][_0x6a73('0x3a')];transfers[_0x1d3fee[_0x6a73('0x3e')]][_0x6a73('0x14')]=utils[_0x6a73('0x15')]();transfers[_0x1d3fee[_0x6a73('0x3e')]][_0x6a73('0x27')]=utils[_0x6a73('0x15')]();transfers[_0x1d3fee[_0x6a73('0x3e')]][_0x6a73('0x1f')]=0x0;transfers[_0x1d3fee[_0x6a73('0x3e')]]['agententerreason']=0x2;}}}catch(_0x492200){utils[_0x6a73('0x18')](_0x492200[_0x6a73('0x19')]);}};exports[_0x6a73('0x3f')]=function(_0x4dbaa4){try{if(agents[_0x4dbaa4[_0x6a73('0x24')]]&&agents[_0x4dbaa4[_0x6a73('0x24')]][_0x6a73('0x1e')]===_0x6a73('0x1d')){if(_0x4dbaa4[_0x6a73('0x40')]==='21'){agents[_0x4dbaa4[_0x6a73('0x24')]]['reason']=_0x6a73('0x41');agents[_0x4dbaa4[_0x6a73('0x24')]]['lastevent']=_0x6a73('0x41');}writeDB(agents[_0x4dbaa4['uniqueid']]);var _0x1b3c98=unanswered[_0x6a73('0x42')](_0x4dbaa4[_0x6a73('0x24')]);if(_0x1b3c98>-0x1)unanswered[_0x6a73('0x43')](_0x1b3c98,0x1);}if(transfers[_0x4dbaa4[_0x6a73('0x24')]]){transfers[_0x4dbaa4[_0x6a73('0x24')]][_0x6a73('0xc')]=!![];transfers[_0x4dbaa4['uniqueid']]['agentcompleteAt']=utils[_0x6a73('0x15')]();transfers[_0x4dbaa4[_0x6a73('0x24')]]['talktime']=utils[_0x6a73('0x44')](transfers[_0x4dbaa4[_0x6a73('0x24')]][_0x6a73('0x2c')],transfers[_0x4dbaa4[_0x6a73('0x24')]]['agentconnectAt']);transfers[_0x4dbaa4[_0x6a73('0x24')]]['reason']=_0x6a73('0x45');transfers[_0x4dbaa4['uniqueid']][_0x6a73('0x6')]='complete';writeDB(transfers[_0x4dbaa4[_0x6a73('0x24')]],!![]);}if(agents[_0x4dbaa4[_0x6a73('0x24')]]&&agents[_0x4dbaa4[_0x6a73('0x24')]][_0x6a73('0x27')]){agents[_0x4dbaa4[_0x6a73('0x24')]][_0x6a73('0xc')]=!![];agents[_0x4dbaa4[_0x6a73('0x24')]][_0x6a73('0x2c')]=utils[_0x6a73('0x15')]();agents[_0x4dbaa4['uniqueid']][_0x6a73('0x21')]=utils[_0x6a73('0x44')](agents[_0x4dbaa4[_0x6a73('0x24')]][_0x6a73('0x2c')],agents[_0x4dbaa4['uniqueid']][_0x6a73('0x27')]);agents[_0x4dbaa4['uniqueid']][_0x6a73('0x1e')]=agents[_0x4dbaa4[_0x6a73('0x24')]]['transfer']?'transfer':_0x6a73('0x45');agents[_0x4dbaa4[_0x6a73('0x24')]][_0x6a73('0x6')]='complete';writeDB(agents[_0x4dbaa4[_0x6a73('0x24')]]);}}catch(_0x2479b1){utils[_0x6a73('0x18')](_0x2479b1[_0x6a73('0x19')]);}}; \ No newline at end of file +var _0xe84f=['forIn','answered_elsewhere','membername','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfertype','transferexten','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','transfer','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','calleridname','agententerreason','secondtransfererlinkedid','transfertargetuniqueid','agentcalledAt','hangup','cause','rejected','indexOf','splice','agent','lodash','util','info','format','uniqueid','interface','calleridnum','connectedlinenum','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','now','lastevent','called','connectedlinename','isNil','agentringnoanswerAt','reason','timeout','holdtime','ringtime','talktime','error','queuecallerabandon','includes','agentringnoanswer','abandoned','stack','agentconnect','agentconnectAt','connect'];(function(_0x32e585,_0x1c86cc){var _0x524568=function(_0x230f01){while(--_0x230f01){_0x32e585['push'](_0x32e585['shift']());}};_0x524568(++_0x1c86cc);}(_0xe84f,0x129));var _0xfe84=function(_0x36c9da,_0x5d7591){_0x36c9da=_0x36c9da-0x0;var _0x566eab=_0xe84f[_0x36c9da];return _0x566eab;};'use strict';var _=require(_0xfe84('0x0'));var util=require(_0xfe84('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x82a6d5,_0x1bb514){utils[_0xfe84('0x2')](util[_0xfe84('0x3')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x82a6d5[_0xfe84('0x4')],_0x82a6d5['channel'],_0x82a6d5['queue'],_0x82a6d5['membername'],_0x82a6d5[_0xfe84('0x5')],_0x82a6d5[_0xfe84('0x6')],_0x82a6d5[_0xfe84('0x7')],_0x82a6d5['lastevent']));if(_0x82a6d5[_0xfe84('0x8')]){utils[_0xfe84('0x9')](_0x82a6d5[_0xfe84('0x8')])[_0xfe84('0xa')](function(_0x4fd195){if(_0x4fd195){_0x82a6d5[_0xfe84('0xb')]=_0x4fd195[_0xfe84('0xb')];_0x82a6d5[_0xfe84('0xc')]=_0x82a6d5[_0xfe84('0xd')]?_0x4fd195['acw']:![];_0x82a6d5['acwtime']=_0x82a6d5[_0xfe84('0xc')]?_0x4fd195[_0xfe84('0xe')]:0x0;}utils[_0xfe84('0xf')]('CreateVoiceAgentReport',_0x82a6d5);});}else{utils[_0xfe84('0xf')](_0xfe84('0x10'),_0x82a6d5);}if(_0x1bb514){delete transfers[_0x82a6d5[_0xfe84('0x4')]];}else{delete agents[_0x82a6d5[_0xfe84('0x11')]];}}exports['agentcalled']=function(_0x4779d7){try{agents[_0x4779d7[_0xfe84('0x11')]]=_0x4779d7;agents[_0x4779d7[_0xfe84('0x11')]]['agentcalledAt']=utils[_0xfe84('0x12')]();agents[_0x4779d7[_0xfe84('0x11')]][_0xfe84('0x13')]=_0xfe84('0x14');agents[_0x4779d7[_0xfe84('0x11')]][_0xfe84('0x7')]=null;agents[_0x4779d7[_0xfe84('0x11')]][_0xfe84('0x15')]=null;}catch(_0x5b2075){utils['error'](_0x5b2075['stack']);}};exports['agentringnoanswer']=function(_0xc6b797){try{if(!_[_0xfe84('0x16')](agents[_0xc6b797[_0xfe84('0x11')]])){agents[_0xc6b797['destuniqueid']]['agentringnoanswer']=!![];agents[_0xc6b797[_0xfe84('0x11')]][_0xfe84('0x17')]=utils['now']();agents[_0xc6b797[_0xfe84('0x11')]][_0xfe84('0x13')]='timeout';agents[_0xc6b797[_0xfe84('0x11')]][_0xfe84('0x18')]=_0xfe84('0x19');agents[_0xc6b797[_0xfe84('0x11')]][_0xfe84('0x1a')]=_0xc6b797[_0xfe84('0x1b')]?parseInt(_0xc6b797['ringtime'])/0x3e8:0x0;agents[_0xc6b797[_0xfe84('0x11')]][_0xfe84('0x1c')]=0x0;unanswered['push'](_0xc6b797[_0xfe84('0x11')]);}}catch(_0xc19e6e){utils[_0xfe84('0x1d')](_0xc19e6e['stack']);}};exports[_0xfe84('0x1e')]=function(_0x5d32db){try{_['forIn'](agents,function(_0x235d13,_0x302b40){if(_0x235d13[_0xfe84('0x4')]==_0x5d32db[_0xfe84('0x4')]&&!_[_0xfe84('0x1f')](unanswered,_0x235d13['destuniqueid'])){_0x235d13[_0xfe84('0x20')]=!![];_0x235d13['agentringnoanswerAt']=utils['now']();_0x235d13[_0xfe84('0x13')]=_0xfe84('0x21');_0x235d13[_0xfe84('0x18')]=_0xfe84('0x21');_0x235d13['holdtime']=_0x5d32db[_0xfe84('0x1a')];_0x235d13[_0xfe84('0x1c')]=0x0;writeDB(_0x235d13);}});}catch(_0x5d0e58){utils[_0xfe84('0x1d')](_0x5d0e58[_0xfe84('0x22')]);}};exports[_0xfe84('0x23')]=function(_0x46d4d1){try{if(agents[_0x46d4d1[_0xfe84('0x11')]]){agents[_0x46d4d1[_0xfe84('0x11')]][_0xfe84('0x24')]=utils[_0xfe84('0x12')]();agents[_0x46d4d1['destuniqueid']][_0xfe84('0x7')]=_0x46d4d1[_0xfe84('0x7')];agents[_0x46d4d1[_0xfe84('0x11')]][_0xfe84('0x15')]=_0x46d4d1[_0xfe84('0x15')];agents[_0x46d4d1['destuniqueid']][_0xfe84('0x1a')]=_0x46d4d1[_0xfe84('0x1b')];agents[_0x46d4d1['destuniqueid']][_0xfe84('0x13')]=_0xfe84('0x25');_[_0xfe84('0x26')](agents,function(_0x53e025,_0x4c41c5){if(_0x53e025[_0xfe84('0x11')]!=_0x46d4d1[_0xfe84('0x11')]&&_0x53e025[_0xfe84('0x4')]==_0x46d4d1[_0xfe84('0x4')]){_0x53e025['talktime']=0x0;_0x53e025[_0xfe84('0x1a')]=_0x46d4d1[_0xfe84('0x1b')];_0x53e025[_0xfe84('0x20')]=!![];_0x53e025['agentringnoanswerAt']=utils[_0xfe84('0x12')]();_0x53e025[_0xfe84('0x13')]='answered_elsewhere';_0x53e025[_0xfe84('0x18')]=_0xfe84('0x27');_0x53e025['answeredelsewheredestinationuniqueid']=_0x46d4d1[_0xfe84('0x11')];_0x53e025['answeredelsewheremembername']=_0x46d4d1[_0xfe84('0x28')];writeDB(_0x53e025);}});}}catch(_0x115ebd){utils['error'](_0x115ebd['stack']);}};exports[_0xfe84('0xd')]=function(_0x4305db){try{if(!_['isNil'](agents[_0x4305db[_0xfe84('0x11')]])){agents[_0x4305db[_0xfe84('0x11')]][_0xfe84('0xd')]=!![];agents[_0x4305db['destuniqueid']][_0xfe84('0x29')]=utils['now']();agents[_0x4305db[_0xfe84('0x11')]][_0xfe84('0x1c')]=utils[_0xfe84('0x2a')](agents[_0x4305db[_0xfe84('0x11')]][_0xfe84('0x29')],agents[_0x4305db[_0xfe84('0x11')]][_0xfe84('0x24')]);agents[_0x4305db[_0xfe84('0x11')]]['reason']=_0x4305db[_0xfe84('0x18')];agents[_0x4305db[_0xfe84('0x11')]][_0xfe84('0x13')]=_0xfe84('0x2b');writeDB(agents[_0x4305db[_0xfe84('0x11')]]);}}catch(_0x493224){utils[_0xfe84('0x1d')](_0x493224[_0xfe84('0x22')]);}};exports[_0xfe84('0x2c')]=function(_0x62344c){try{if(!_[_0xfe84('0x16')](agents[_0x62344c[_0xfe84('0x2d')]])){agents[_0x62344c[_0xfe84('0x2d')]]['transfer']=!![];agents[_0x62344c[_0xfe84('0x2d')]][_0xfe84('0x2e')]='blind';agents[_0x62344c[_0xfe84('0x2d')]][_0xfe84('0x2f')]=_0x62344c['extension'];agents[_0x62344c[_0xfe84('0x2d')]][_0xfe84('0x30')]=agents[_0x62344c[_0xfe84('0x2d')]][_0xfe84('0x4')];}}catch(_0x41a8ae){utils['error'](_0x41a8ae[_0xfe84('0x22')]);}};exports[_0xfe84('0x31')]=function(_0x15b5ae){try{if(_0x15b5ae[_0xfe84('0x32')]==_0x15b5ae[_0xfe84('0x33')]){if(!_[_0xfe84('0x16')](agents[_0x15b5ae['secondtransfereruniqueid']])){agents[_0x15b5ae['secondtransfereruniqueid']][_0xfe84('0x34')]=!![];agents[_0x15b5ae[_0xfe84('0x35')]][_0xfe84('0x2e')]=_0xfe84('0x36');agents[_0x15b5ae[_0xfe84('0x35')]][_0xfe84('0x2f')]=_0x15b5ae['origtransfererexten'];agents[_0x15b5ae[_0xfe84('0x35')]][_0xfe84('0x30')]=_0x15b5ae[_0xfe84('0x32')];}if(_0x15b5ae['transfereeuniqueid']&&agents[_0x15b5ae[_0xfe84('0x37')]]){agents[_0x15b5ae[_0xfe84('0x37')]]['agententerreason']=0x1;transfers[_0x15b5ae[_0xfe84('0x37')]]=_['clone'](agents[_0x15b5ae[_0xfe84('0x37')]]);transfers[_0x15b5ae[_0xfe84('0x37')]]['calleridnum']=agents[_0x15b5ae[_0xfe84('0x35')]][_0xfe84('0x6')];transfers[_0x15b5ae[_0xfe84('0x37')]][_0xfe84('0x38')]=agents[_0x15b5ae[_0xfe84('0x35')]]['calleridname'];transfers[_0x15b5ae[_0xfe84('0x37')]]['agentcalledAt']=utils['now']();transfers[_0x15b5ae[_0xfe84('0x37')]][_0xfe84('0x24')]=utils[_0xfe84('0x12')]();transfers[_0x15b5ae[_0xfe84('0x37')]][_0xfe84('0x1a')]=0x0;transfers[_0x15b5ae['transfereeuniqueid']][_0xfe84('0x39')]=0x2;}}else if(_0x15b5ae[_0xfe84('0x35')]==_0x15b5ae[_0xfe84('0x3a')]){if(!_[_0xfe84('0x16')](agents[_0x15b5ae[_0xfe84('0x32')]])){agents[_0x15b5ae['origtransfereruniqueid']][_0xfe84('0x34')]=!![];agents[_0x15b5ae[_0xfe84('0x32')]][_0xfe84('0x2e')]='ATTENDED';agents[_0x15b5ae[_0xfe84('0x32')]][_0xfe84('0x2f')]=_0x15b5ae['secondtransfererexten'];agents[_0x15b5ae[_0xfe84('0x32')]][_0xfe84('0x30')]=_0x15b5ae[_0xfe84('0x35')];}if(_0x15b5ae[_0xfe84('0x3b')]&&agents[_0x15b5ae['transfertargetuniqueid']]){agents[_0x15b5ae[_0xfe84('0x3b')]][_0xfe84('0x39')]=0x1;transfers[_0x15b5ae[_0xfe84('0x3b')]]=_['clone'](agents[_0x15b5ae[_0xfe84('0x3b')]]);transfers[_0x15b5ae[_0xfe84('0x3b')]][_0xfe84('0x6')]=agents[_0x15b5ae['origtransfereruniqueid']]['calleridnum'];transfers[_0x15b5ae[_0xfe84('0x3b')]][_0xfe84('0x38')]=agents[_0x15b5ae[_0xfe84('0x32')]][_0xfe84('0x38')];transfers[_0x15b5ae[_0xfe84('0x3b')]][_0xfe84('0x3c')]=utils[_0xfe84('0x12')]();transfers[_0x15b5ae['transfertargetuniqueid']][_0xfe84('0x24')]=utils['now']();transfers[_0x15b5ae[_0xfe84('0x3b')]][_0xfe84('0x1a')]=0x0;transfers[_0x15b5ae['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x5755e1){utils[_0xfe84('0x1d')](_0x5755e1[_0xfe84('0x22')]);}};exports[_0xfe84('0x3d')]=function(_0x59f2f1){try{if(agents[_0x59f2f1[_0xfe84('0x4')]]&&agents[_0x59f2f1[_0xfe84('0x4')]][_0xfe84('0x18')]===_0xfe84('0x19')){if(_0x59f2f1[_0xfe84('0x3e')]==='21'){agents[_0x59f2f1[_0xfe84('0x4')]][_0xfe84('0x18')]=_0xfe84('0x3f');agents[_0x59f2f1[_0xfe84('0x4')]]['lastevent']=_0xfe84('0x3f');}writeDB(agents[_0x59f2f1[_0xfe84('0x4')]]);var _0x8cde2c=unanswered[_0xfe84('0x40')](_0x59f2f1[_0xfe84('0x4')]);if(_0x8cde2c>-0x1)unanswered[_0xfe84('0x41')](_0x8cde2c,0x1);}if(transfers[_0x59f2f1[_0xfe84('0x4')]]){transfers[_0x59f2f1['uniqueid']][_0xfe84('0xd')]=!![];transfers[_0x59f2f1[_0xfe84('0x4')]]['agentcompleteAt']=utils[_0xfe84('0x12')]();transfers[_0x59f2f1[_0xfe84('0x4')]][_0xfe84('0x1c')]=utils[_0xfe84('0x2a')](transfers[_0x59f2f1[_0xfe84('0x4')]]['agentcompleteAt'],transfers[_0x59f2f1[_0xfe84('0x4')]][_0xfe84('0x24')]);transfers[_0x59f2f1[_0xfe84('0x4')]][_0xfe84('0x18')]=_0xfe84('0x42');transfers[_0x59f2f1['uniqueid']][_0xfe84('0x13')]='complete';writeDB(transfers[_0x59f2f1[_0xfe84('0x4')]],!![]);}if(agents[_0x59f2f1['uniqueid']]&&agents[_0x59f2f1['uniqueid']][_0xfe84('0x24')]){agents[_0x59f2f1[_0xfe84('0x4')]][_0xfe84('0xd')]=!![];agents[_0x59f2f1[_0xfe84('0x4')]][_0xfe84('0x29')]=utils[_0xfe84('0x12')]();agents[_0x59f2f1[_0xfe84('0x4')]]['talktime']=utils[_0xfe84('0x2a')](agents[_0x59f2f1[_0xfe84('0x4')]]['agentcompleteAt'],agents[_0x59f2f1['uniqueid']]['agentconnectAt']);agents[_0x59f2f1[_0xfe84('0x4')]][_0xfe84('0x18')]=agents[_0x59f2f1[_0xfe84('0x4')]][_0xfe84('0x34')]?_0xfe84('0x34'):'agent';agents[_0x59f2f1[_0xfe84('0x4')]][_0xfe84('0x13')]='complete';writeDB(agents[_0x59f2f1['uniqueid']]);}}catch(_0x5a84c9){utils[_0xfe84('0x1d')](_0x5a84c9[_0xfe84('0x22')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index e4bd991..b590e65 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 _0xd1f4=['destination','callerid','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','exten','now','DOCUMENTATION','error','stack','newstate','channelstate','isNil','systemanswertime','transfer','destinationchannel','toNumber','hangup','calleridname','endtime','duration','starttime','billableseconds','answertime','diffTime','attendedtransfer','localtwolinkedid','transfereechannel','userfield','_attended','transfertargetchannel','musiconholdstart','musiconholdstartAt','variable','xmd-originatecalleridnum','value','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-queue','xmcs-queue','Queue','lastdata','queue','ContactId','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','application','toLowerCase','set','startsWith','appdata','substring','lastIndexOf','includes','execif','gotoif','lastapplication','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','channel','type','accountcode','source'];(function(_0xa4b7ba,_0x1076a8){var _0x3e3250=function(_0x3e53e7){while(--_0x3e53e7){_0xa4b7ba['push'](_0xa4b7ba['shift']());}};_0x3e3250(++_0x1076a8);}(_0xd1f4,0x134));var _0x4d1f=function(_0x1962bd,_0x1e8a35){_0x1962bd=_0x1962bd-0x0;var _0x1eca49=_0xd1f4[_0x1962bd];return _0x1eca49;};'use strict';var _=require(_0x4d1f('0x0'));var util=require(_0x4d1f('0x1'));var utils=require(_0x4d1f('0x2'));var dispositions=[_0x4d1f('0x3'),'FAILED',_0x4d1f('0x4'),_0x4d1f('0x3'),_0x4d1f('0x3'),_0x4d1f('0x3'),_0x4d1f('0x5'),_0x4d1f('0x6'),_0x4d1f('0x4'),'FAILED','FAILED'];var channels={};function writeDB(_0x406d68){utils['info'](util['format']('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x406d68[_0x4d1f('0x7')],_0x406d68[_0x4d1f('0x8')],_0x406d68[_0x4d1f('0x9')],_0x406d68[_0x4d1f('0xa')],_0x406d68[_0x4d1f('0xb')],_0x406d68[_0x4d1f('0xc')],_0x406d68[_0x4d1f('0xd')],_0x406d68[_0x4d1f('0xe')]));if(_0x406d68[_0x4d1f('0xa')]){utils[_0x4d1f('0xf')](_0x406d68[_0x4d1f('0xa')])[_0x4d1f('0x10')](function(_0x322a47){if(_0x322a47){_0x406d68[_0x4d1f('0x11')]=_0x322a47['id'];}utils[_0x4d1f('0x12')](_0x4d1f('0x13'),_0x406d68);});}else{utils['request']('CreateVoiceCallReport',_0x406d68);}if(channels[_0x406d68[_0x4d1f('0x7')]]){delete channels[_0x406d68[_0x4d1f('0x7')]];}}exports[_0x4d1f('0x14')]=function(_0x57226f){try{if(_0x57226f[_0x4d1f('0x7')]==_0x57226f[_0x4d1f('0x15')]&&_0x57226f['channel']!=_0x4d1f('0x16')){channels[_0x57226f[_0x4d1f('0x7')]]={'uniqueid':_0x57226f[_0x4d1f('0x7')],'accountcode':_0x57226f[_0x4d1f('0xa')],'source':_0x57226f[_0x4d1f('0x17')],'destination':_0x57226f[_0x4d1f('0x18')],'destinationcontext':_0x57226f['context'],'channel':_0x57226f[_0x4d1f('0x8')],'starttime':utils[_0x4d1f('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x4d1f('0x1a')};}}catch(_0x76a0a){utils[_0x4d1f('0x1b')](_0x76a0a[_0x4d1f('0x1c')]);}};exports[_0x4d1f('0x1d')]=function(_0x778f55){try{if(!_['isNil'](channels[_0x778f55[_0x4d1f('0x7')]])&&_0x778f55[_0x4d1f('0x1e')]==0x6){if(_[_0x4d1f('0x1f')](channels[_0x778f55['uniqueid']][_0x4d1f('0x20')])){channels[_0x778f55['uniqueid']][_0x4d1f('0x20')]=utils[_0x4d1f('0x19')]();}}else if(!_[_0x4d1f('0x1f')](channels[_0x778f55[_0x4d1f('0x15')]])&&_0x778f55[_0x4d1f('0x1e')]==0x6&&_0x778f55['context']!=_0x4d1f('0x21')){channels[_0x778f55['linkedid']]['accountcode']=_0x778f55['accountcode'];channels[_0x778f55[_0x4d1f('0x15')]][_0x4d1f('0x22')]=_0x778f55['channel'];if(_[_0x4d1f('0x1f')](channels[_0x778f55[_0x4d1f('0x15')]]['answertime'])){channels[_0x778f55[_0x4d1f('0x15')]]['answertime']=utils[_0x4d1f('0x19')]();}channels[_0x778f55[_0x4d1f('0x15')]]['disposition']=dispositions[_[_0x4d1f('0x23')](_0x778f55[_0x4d1f('0x1e')])]||_0x4d1f('0x5');}}catch(_0x397326){utils['error'](_0x397326['stack']);}};exports[_0x4d1f('0x24')]=function(_0x542ff1){try{if(!_[_0x4d1f('0x1f')](channels[_0x542ff1[_0x4d1f('0x7')]])){if(_['isNil'](channels[_0x542ff1[_0x4d1f('0x7')]][_0x4d1f('0xd')])){channels[_0x542ff1[_0x4d1f('0x7')]]['callerid']=_0x542ff1[_0x4d1f('0x25')]+'\x20<'+_0x542ff1[_0x4d1f('0x17')]+'>';}channels[_0x542ff1[_0x4d1f('0x7')]][_0x4d1f('0x26')]=utils[_0x4d1f('0x19')]();channels[_0x542ff1[_0x4d1f('0x7')]][_0x4d1f('0x27')]=utils['diffTime'](channels[_0x542ff1[_0x4d1f('0x7')]]['endtime'],channels[_0x542ff1[_0x4d1f('0x7')]][_0x4d1f('0x28')]);channels[_0x542ff1[_0x4d1f('0x7')]][_0x4d1f('0x29')]=channels[_0x542ff1[_0x4d1f('0x7')]][_0x4d1f('0x2a')]?utils[_0x4d1f('0x2b')](channels[_0x542ff1[_0x4d1f('0x7')]][_0x4d1f('0x26')],channels[_0x542ff1[_0x4d1f('0x7')]][_0x4d1f('0x2a')]):0x0;writeDB(channels[_0x542ff1[_0x4d1f('0x7')]]);}}catch(_0x820c59){utils['error'](_0x820c59['stack']);}};exports[_0x4d1f('0x2c')]=function(_0x312561){try{if(!_[_0x4d1f('0x1f')](channels[_0x312561[_0x4d1f('0x2d')]])){if(channels[_0x312561[_0x4d1f('0x2d')]]['channel']==_0x312561[_0x4d1f('0x2e')]){channels[_0x312561[_0x4d1f('0x2d')]][_0x4d1f('0x22')]=_0x312561['secondtransfererchannel'];channels[_0x312561[_0x4d1f('0x2d')]][_0x4d1f('0x2f')]=_0x4d1f('0x30');}else if(channels[_0x312561['localtwolinkedid']][_0x4d1f('0x8')]=_0x312561[_0x4d1f('0x31')]){channels[_0x312561[_0x4d1f('0x2d')]]['destinationchannel']=_0x312561['origtransfererchannel'];channels[_0x312561['localtwolinkedid']][_0x4d1f('0x2f')]=_0x4d1f('0x30');}}}catch(_0x1c32e1){utils[_0x4d1f('0x1b')](_0x1c32e1[_0x4d1f('0x1c')]);}};exports[_0x4d1f('0x32')]=function(_0x3fc2df){try{if(!_['isNil'](channels[_0x3fc2df['uniqueid']])){channels[_0x3fc2df['uniqueid']]['musiconholdstartAt']=utils[_0x4d1f('0x19')]();}}catch(_0xb19c73){utils[_0x4d1f('0x1b')](_0xb19c73[_0x4d1f('0x1c')]);}};exports['musiconholdstop']=function(_0xca88c9){try{if(!_['isNil'](channels[_0xca88c9['uniqueid']])){if(!_[_0x4d1f('0x1f')](channels[_0xca88c9['uniqueid']][_0x4d1f('0x33')])){channels[_0xca88c9['uniqueid']]['mohtime']+=utils[_0x4d1f('0x2b')](utils[_0x4d1f('0x19')](),channels[_0xca88c9[_0x4d1f('0x7')]][_0x4d1f('0x33')]);delete channels[_0xca88c9[_0x4d1f('0x7')]]['musiconholdstartAt'];}}}catch(_0x3a6133){utils[_0x4d1f('0x1b')](_0x3a6133[_0x4d1f('0x1c')]);}};exports['varset']=function(_0xa80941){try{if(!_['isNil'](channels[_0xa80941[_0x4d1f('0x7')]])){if(!_['isNil'](_0xa80941[_0x4d1f('0x34')][_0x4d1f('0x35')])){channels[_0xa80941[_0x4d1f('0x7')]]['source']=_0xa80941[_0x4d1f('0x36')];}if(!_[_0x4d1f('0x1f')](_0xa80941[_0x4d1f('0x34')][_0x4d1f('0x37')])){channels[_0xa80941[_0x4d1f('0x7')]][_0x4d1f('0xc')]=_0xa80941[_0x4d1f('0x36')];channels[_0xa80941[_0x4d1f('0x7')]][_0x4d1f('0xd')]='\x22'+_0xa80941[_0x4d1f('0x36')]+_0x4d1f('0x38')+_0xa80941[_0x4d1f('0x36')]+'>';}if(!_[_0x4d1f('0x1f')](_0xa80941[_0x4d1f('0x34')][_0x4d1f('0x39')])||!_[_0x4d1f('0x1f')](_0xa80941[_0x4d1f('0x34')]['xmd-callerid'])){channels[_0xa80941['uniqueid']][_0x4d1f('0xd')]=_0xa80941[_0x4d1f('0x36')];}if(!_['isNil'](_0xa80941[_0x4d1f('0x34')][_0x4d1f('0x3a')])||!_['isNil'](_0xa80941['variable'][_0x4d1f('0x3b')])){channels[_0xa80941[_0x4d1f('0x7')]]['lastapplication']=_0x4d1f('0x3c');channels[_0xa80941['uniqueid']][_0x4d1f('0x3d')]=_0xa80941['value'];channels[_0xa80941[_0x4d1f('0x7')]][_0x4d1f('0x3e')]=!![];}if(!_[_0x4d1f('0x1f')](_0xa80941[_0x4d1f('0x34')]['xmd-contactid'])){channels[_0xa80941[_0x4d1f('0x7')]][_0x4d1f('0x3f')]=_0xa80941[_0x4d1f('0x36')];}if(!_['isNil'](_0xa80941['variable'][_0x4d1f('0x40')])){channels[_0xa80941[_0x4d1f('0x7')]][_0x4d1f('0x9')]=_0xa80941[_0x4d1f('0x36')];}if(!_[_0x4d1f('0x1f')](_0xa80941[_0x4d1f('0x34')][_0x4d1f('0x41')])){channels[_0xa80941['uniqueid']][_0x4d1f('0x42')]=_0xa80941['value'];}if(!_[_0x4d1f('0x1f')](_0xa80941[_0x4d1f('0x34')][_0x4d1f('0x43')])){channels[_0xa80941['uniqueid']]['sipcallid']=_0xa80941['value'];}}}catch(_0x4557f0){utils[_0x4d1f('0x1b')](_0x4557f0[_0x4d1f('0x1c')]);}};exports[_0x4d1f('0x44')]=function(_0x344c4a){try{if(!_[_0x4d1f('0x1f')](channels[_0x344c4a[_0x4d1f('0x7')]])){if(_0x344c4a[_0x4d1f('0x45')][_0x4d1f('0x46')]()==_0x4d1f('0x47')&&_[_0x4d1f('0x48')](_0x344c4a[_0x4d1f('0x49')][_0x4d1f('0x46')](),'cdr')){var _0x471d21=_0x344c4a['appdata']['split']('=');var _0x506ee0=_0x471d21[0x0][_0x4d1f('0x4a')](_0x471d21[0x0]['lastIndexOf']('(')+0x1,_0x471d21[0x0][_0x4d1f('0x4b')](')'));var _0x58062a=_0x471d21[0x1];channels[_0x344c4a[_0x4d1f('0x7')]][_0x506ee0]=_0x58062a;}if(!_[_0x4d1f('0x4c')]([_0x4d1f('0x24'),'noop',_0x4d1f('0x4d'),_0x4d1f('0x47'),_0x4d1f('0x4e')],_0x344c4a[_0x4d1f('0x45')][_0x4d1f('0x46')]())){channels[_0x344c4a[_0x4d1f('0x7')]][_0x4d1f('0x4f')]=_0x344c4a[_0x4d1f('0x45')];channels[_0x344c4a[_0x4d1f('0x7')]][_0x4d1f('0x3d')]=_0x344c4a[_0x4d1f('0x49')];}}}catch(_0x58e06c){utils['error'](_0x58e06c[_0x4d1f('0x1c')]);}}; \ No newline at end of file +var _0x0544=['set','appdata','toLowerCase','split','substring','lastIndexOf','hangup','noop','execif','gotoif','lastapplication','lastdata','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','uniqueid','channel','type','source','destination','callerid','accountcode','getUserByInternal','then','UserId','request','newchannel','linkedid','exten','context','now','error','stack','newstate','isNil','systemanswertime','channelstate','destinationchannel','answertime','disposition','toNumber','calleridname','calleridnum','endtime','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','varset','variable','xmd-originatecalleridnum','value','xmd-phone','xmd-callerid','xmd-queue','xmcs-queue','Queue','queue','xmd-contactid','routeid','sipcallid','newexten','application'];(function(_0x49bce7,_0x36ee05){var _0x54faf3=function(_0x26e1be){while(--_0x26e1be){_0x49bce7['push'](_0x49bce7['shift']());}};_0x54faf3(++_0x36ee05);}(_0x0544,0xa8));var _0x4054=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x0544[_0x5a776b];return _0xbbef59;};'use strict';var _=require('lodash');var util=require(_0x4054('0x0'));var utils=require(_0x4054('0x1'));var dispositions=[_0x4054('0x2'),_0x4054('0x3'),_0x4054('0x3'),_0x4054('0x2'),_0x4054('0x2'),_0x4054('0x2'),_0x4054('0x4'),_0x4054('0x5'),_0x4054('0x3'),_0x4054('0x3'),_0x4054('0x3')];var channels={};function writeDB(_0x9f7949){utils[_0x4054('0x6')](util['format']('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x9f7949[_0x4054('0x7')],_0x9f7949[_0x4054('0x8')],_0x9f7949[_0x4054('0x9')],_0x9f7949['accountcode'],_0x9f7949[_0x4054('0xa')],_0x9f7949[_0x4054('0xb')],_0x9f7949[_0x4054('0xc')],_0x9f7949['disposition']));if(_0x9f7949[_0x4054('0xd')]){utils[_0x4054('0xe')](_0x9f7949[_0x4054('0xd')])[_0x4054('0xf')](function(_0x1eceb8){if(_0x1eceb8){_0x9f7949[_0x4054('0x10')]=_0x1eceb8['id'];}utils[_0x4054('0x11')]('CreateVoiceCallReport',_0x9f7949);});}else{utils[_0x4054('0x11')]('CreateVoiceCallReport',_0x9f7949);}if(channels[_0x9f7949[_0x4054('0x7')]]){delete channels[_0x9f7949[_0x4054('0x7')]];}}exports[_0x4054('0x12')]=function(_0x33a6cd){try{if(_0x33a6cd[_0x4054('0x7')]==_0x33a6cd[_0x4054('0x13')]&&_0x33a6cd[_0x4054('0x8')]!='OutgoingSpoolFailed'){channels[_0x33a6cd[_0x4054('0x7')]]={'uniqueid':_0x33a6cd[_0x4054('0x7')],'accountcode':_0x33a6cd[_0x4054('0xd')],'source':_0x33a6cd['calleridnum'],'destination':_0x33a6cd[_0x4054('0x14')],'destinationcontext':_0x33a6cd[_0x4054('0x15')],'channel':_0x33a6cd[_0x4054('0x8')],'starttime':utils[_0x4054('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x4054('0x2'),'amaflags':'DOCUMENTATION'};}}catch(_0x18762a){utils[_0x4054('0x17')](_0x18762a[_0x4054('0x18')]);}};exports[_0x4054('0x19')]=function(_0x3d7cc6){try{if(!_[_0x4054('0x1a')](channels[_0x3d7cc6[_0x4054('0x7')]])&&_0x3d7cc6['channelstate']==0x6){if(_[_0x4054('0x1a')](channels[_0x3d7cc6[_0x4054('0x7')]][_0x4054('0x1b')])){channels[_0x3d7cc6[_0x4054('0x7')]][_0x4054('0x1b')]=utils[_0x4054('0x16')]();}}else if(!_[_0x4054('0x1a')](channels[_0x3d7cc6[_0x4054('0x13')]])&&_0x3d7cc6[_0x4054('0x1c')]==0x6&&_0x3d7cc6['context']!='transfer'){channels[_0x3d7cc6[_0x4054('0x13')]]['accountcode']=_0x3d7cc6[_0x4054('0xd')];channels[_0x3d7cc6[_0x4054('0x13')]][_0x4054('0x1d')]=_0x3d7cc6[_0x4054('0x8')];if(_[_0x4054('0x1a')](channels[_0x3d7cc6[_0x4054('0x13')]][_0x4054('0x1e')])){channels[_0x3d7cc6[_0x4054('0x13')]][_0x4054('0x1e')]=utils[_0x4054('0x16')]();}channels[_0x3d7cc6[_0x4054('0x13')]][_0x4054('0x1f')]=dispositions[_[_0x4054('0x20')](_0x3d7cc6[_0x4054('0x1c')])]||_0x4054('0x4');}}catch(_0x4646b8){utils[_0x4054('0x17')](_0x4646b8[_0x4054('0x18')]);}};exports['hangup']=function(_0x34a035){try{if(!_[_0x4054('0x1a')](channels[_0x34a035[_0x4054('0x7')]])){if(_[_0x4054('0x1a')](channels[_0x34a035['uniqueid']]['callerid'])){channels[_0x34a035[_0x4054('0x7')]]['callerid']=_0x34a035[_0x4054('0x21')]+'\x20<'+_0x34a035[_0x4054('0x22')]+'>';}channels[_0x34a035[_0x4054('0x7')]][_0x4054('0x23')]=utils[_0x4054('0x16')]();channels[_0x34a035[_0x4054('0x7')]]['duration']=utils[_0x4054('0x24')](channels[_0x34a035[_0x4054('0x7')]]['endtime'],channels[_0x34a035[_0x4054('0x7')]][_0x4054('0x25')]);channels[_0x34a035[_0x4054('0x7')]][_0x4054('0x26')]=channels[_0x34a035['uniqueid']][_0x4054('0x1e')]?utils[_0x4054('0x24')](channels[_0x34a035[_0x4054('0x7')]][_0x4054('0x23')],channels[_0x34a035[_0x4054('0x7')]][_0x4054('0x1e')]):0x0;writeDB(channels[_0x34a035['uniqueid']]);}}catch(_0x437189){utils[_0x4054('0x17')](_0x437189['stack']);}};exports[_0x4054('0x27')]=function(_0x39532f){try{if(!_[_0x4054('0x1a')](channels[_0x39532f[_0x4054('0x28')]])){if(channels[_0x39532f[_0x4054('0x28')]]['channel']==_0x39532f[_0x4054('0x29')]){channels[_0x39532f[_0x4054('0x28')]][_0x4054('0x1d')]=_0x39532f[_0x4054('0x2a')];channels[_0x39532f[_0x4054('0x28')]][_0x4054('0x2b')]='_attended';}else if(channels[_0x39532f[_0x4054('0x28')]][_0x4054('0x8')]=_0x39532f[_0x4054('0x2c')]){channels[_0x39532f[_0x4054('0x28')]][_0x4054('0x1d')]=_0x39532f[_0x4054('0x2d')];channels[_0x39532f[_0x4054('0x28')]][_0x4054('0x2b')]=_0x4054('0x2e');}}}catch(_0x23edaf){utils[_0x4054('0x17')](_0x23edaf['stack']);}};exports[_0x4054('0x2f')]=function(_0x39cfe2){try{if(!_[_0x4054('0x1a')](channels[_0x39cfe2['uniqueid']])){channels[_0x39cfe2['uniqueid']][_0x4054('0x30')]=utils[_0x4054('0x16')]();}}catch(_0x42fc66){utils['error'](_0x42fc66['stack']);}};exports[_0x4054('0x31')]=function(_0x5338b6){try{if(!_[_0x4054('0x1a')](channels[_0x5338b6[_0x4054('0x7')]])){if(!_[_0x4054('0x1a')](channels[_0x5338b6[_0x4054('0x7')]][_0x4054('0x30')])){channels[_0x5338b6[_0x4054('0x7')]][_0x4054('0x32')]+=utils[_0x4054('0x24')](utils[_0x4054('0x16')](),channels[_0x5338b6['uniqueid']][_0x4054('0x30')]);delete channels[_0x5338b6['uniqueid']][_0x4054('0x30')];}}}catch(_0x45a6f5){utils['error'](_0x45a6f5['stack']);}};exports[_0x4054('0x33')]=function(_0x389b02){try{if(!_['isNil'](channels[_0x389b02[_0x4054('0x7')]])){if(!_[_0x4054('0x1a')](_0x389b02[_0x4054('0x34')][_0x4054('0x35')])){channels[_0x389b02[_0x4054('0x7')]]['source']=_0x389b02[_0x4054('0x36')];}if(!_[_0x4054('0x1a')](_0x389b02[_0x4054('0x34')][_0x4054('0x37')])){channels[_0x389b02[_0x4054('0x7')]][_0x4054('0xb')]=_0x389b02[_0x4054('0x36')];channels[_0x389b02[_0x4054('0x7')]][_0x4054('0xc')]='\x22'+_0x389b02['value']+'\x22\x20<'+_0x389b02['value']+'>';}if(!_[_0x4054('0x1a')](_0x389b02[_0x4054('0x34')]['xmd-callerid-preview'])||!_[_0x4054('0x1a')](_0x389b02[_0x4054('0x34')][_0x4054('0x38')])){channels[_0x389b02[_0x4054('0x7')]]['callerid']=_0x389b02['value'];}if(!_[_0x4054('0x1a')](_0x389b02['variable'][_0x4054('0x39')])||!_[_0x4054('0x1a')](_0x389b02[_0x4054('0x34')][_0x4054('0x3a')])){channels[_0x389b02[_0x4054('0x7')]]['lastapplication']=_0x4054('0x3b');channels[_0x389b02[_0x4054('0x7')]]['lastdata']=_0x389b02['value'];channels[_0x389b02[_0x4054('0x7')]][_0x4054('0x3c')]=!![];}if(!_['isNil'](_0x389b02['variable'][_0x4054('0x3d')])){channels[_0x389b02[_0x4054('0x7')]]['ContactId']=_0x389b02['value'];}if(!_[_0x4054('0x1a')](_0x389b02[_0x4054('0x34')]['xmd-cdrtype'])){channels[_0x389b02[_0x4054('0x7')]][_0x4054('0x9')]=_0x389b02[_0x4054('0x36')];}if(!_[_0x4054('0x1a')](_0x389b02[_0x4054('0x34')]['outboundrouteid'])){channels[_0x389b02[_0x4054('0x7')]][_0x4054('0x3e')]=_0x389b02[_0x4054('0x36')];}if(!_[_0x4054('0x1a')](_0x389b02['variable'][_0x4054('0x3f')])){channels[_0x389b02[_0x4054('0x7')]][_0x4054('0x3f')]=_0x389b02[_0x4054('0x36')];}}}catch(_0x3ab7be){utils[_0x4054('0x17')](_0x3ab7be[_0x4054('0x18')]);}};exports[_0x4054('0x40')]=function(_0xf61253){try{if(!_[_0x4054('0x1a')](channels[_0xf61253['uniqueid']])){if(_0xf61253[_0x4054('0x41')]['toLowerCase']()==_0x4054('0x42')&&_['startsWith'](_0xf61253[_0x4054('0x43')][_0x4054('0x44')](),'cdr')){var _0x46bf24=_0xf61253[_0x4054('0x43')][_0x4054('0x45')]('=');var _0x57a16b=_0x46bf24[0x0][_0x4054('0x46')](_0x46bf24[0x0][_0x4054('0x47')]('(')+0x1,_0x46bf24[0x0][_0x4054('0x47')](')'));var _0x4ace9c=_0x46bf24[0x1];channels[_0xf61253[_0x4054('0x7')]][_0x57a16b]=_0x4ace9c;}if(!_['includes']([_0x4054('0x48'),_0x4054('0x49'),_0x4054('0x4a'),_0x4054('0x42'),_0x4054('0x4b')],_0xf61253[_0x4054('0x41')][_0x4054('0x44')]())){channels[_0xf61253[_0x4054('0x7')]][_0x4054('0x4c')]=_0xf61253[_0x4054('0x41')];channels[_0xf61253[_0x4054('0x7')]][_0x4054('0x4d')]=_0xf61253[_0x4054('0x43')];}}}catch(_0x20383d){utils[_0x4054('0x17')](_0x20383d[_0x4054('0x18')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 3574892..8e4fa87 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 _0x0295=['info','SHUTDOWN','fullybooted','FULLYBOOTED','error','close','./utils'];(function(_0x3a0a08,_0x3ca7ba){var _0xa44d13=function(_0xe2b4e4){while(--_0xe2b4e4){_0x3a0a08['push'](_0x3a0a08['shift']());}};_0xa44d13(++_0x3ca7ba);}(_0x0295,0x1f0));var _0x5029=function(_0x1d8a15,_0x4acbca){_0x1d8a15=_0x1d8a15-0x0;var _0x17b14b=_0x0295[_0x1d8a15];return _0x17b14b;};'use strict';var utils=require(_0x5029('0x0'));var _=require('lodash');exports['connect']=function(){utils[_0x5029('0x1')]('CONNECTED');};exports['shutdown']=function(){utils[_0x5029('0x1')](_0x5029('0x2'));};exports[_0x5029('0x3')]=function(){utils[_0x5029('0x1')](_0x5029('0x4'));};exports[_0x5029('0x5')]=function(_0x200217){utils[_0x5029('0x5')](_0x200217);};exports[_0x5029('0x6')]=function(){utils['info']('CLOSE');};exports['managerevent']=function(_0xf4459b){}; \ No newline at end of file +var _0x8f9d=['FULLYBOOTED','error','close','CLOSE','./utils','connect','CONNECTED','shutdown','info','SHUTDOWN','fullybooted'];(function(_0x5aadbc,_0x4bc893){var _0x5de90c=function(_0x524b0b){while(--_0x524b0b){_0x5aadbc['push'](_0x5aadbc['shift']());}};_0x5de90c(++_0x4bc893);}(_0x8f9d,0x93));var _0xd8f9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8f9d[_0x321bb2];return _0x9c12ed;};'use strict';var utils=require(_0xd8f9('0x0'));var _=require('lodash');exports[_0xd8f9('0x1')]=function(){utils['info'](_0xd8f9('0x2'));};exports[_0xd8f9('0x3')]=function(){utils[_0xd8f9('0x4')](_0xd8f9('0x5'));};exports[_0xd8f9('0x6')]=function(){utils[_0xd8f9('0x4')](_0xd8f9('0x7'));};exports['error']=function(_0x1c37be){utils[_0xd8f9('0x8')](_0x1c37be);};exports[_0xd8f9('0x9')]=function(){utils[_0xd8f9('0x4')](_0xd8f9('0xa'));};exports['managerevent']=function(_0x46babd){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 91c220a..a46a04f 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 _0x98b7=['holdtime','answertime','billableseconds','lodash','util','./utils','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','newexten','application','toLowerCase','startsWith','appdata','split','error','stack','varset','isNil','outboundrouteid','value','dialbegin','assign','starttime','now','lastevent','called','dialend','dialstatus','ANSWER','connect','hangup','duration','diffTime','endtime'];(function(_0x150ffb,_0x4dc2d0){var _0x2fd1e2=function(_0x1016f4){while(--_0x1016f4){_0x150ffb['push'](_0x150ffb['shift']());}};_0x2fd1e2(++_0x4dc2d0);}(_0x98b7,0xc1));var _0x798b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x98b7[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x798b('0x0'));var util=require(_0x798b('0x1'));var utils=require(_0x798b('0x2'));var dials={};function writeDB(_0x2916ea){utils['info'](util['format']('DIAL|%s|%s|%s|%s|%s|%s',_0x2916ea[_0x798b('0x3')],_0x2916ea[_0x798b('0x4')],_0x2916ea[_0x798b('0x5')],_0x2916ea[_0x798b('0x6')],_0x2916ea[_0x798b('0x7')],_0x2916ea['dialstatus']));utils[_0x798b('0x8')]('CreateVoiceDialReport',_0x2916ea);delete dials[_0x2916ea[_0x798b('0x3')]];}exports[_0x798b('0x9')]=function(_0x3fb4de){try{if(_0x3fb4de[_0x798b('0xa')][_0x798b('0xb')]()=='set'&&_[_0x798b('0xc')](_0x3fb4de['appdata'][_0x798b('0xb')](),'cdr(routeid)')){var _0x34ca9b=_0x3fb4de[_0x798b('0xd')][_0x798b('0xe')]('=');dials[_0x3fb4de['uniqueid']]={'routeId':_0x34ca9b[0x1]};}}catch(_0x5bafb6){utils[_0x798b('0xf')](_0x5bafb6[_0x798b('0x10')]);}};exports[_0x798b('0x11')]=function(_0x5455a7){try{if(!_[_0x798b('0x12')](_0x5455a7['variable'][_0x798b('0x13')])){dials[_0x5455a7['uniqueid']]={'routeId':_0x5455a7[_0x798b('0x14')]};}}catch(_0x2aacd7){utils[_0x798b('0xf')](_0x2aacd7[_0x798b('0x10')]);}};exports[_0x798b('0x15')]=function(_0x35172b){try{if(!_[_0x798b('0x12')](dials[_0x35172b['uniqueid']])){dials[_0x35172b['uniqueid']]=_[_0x798b('0x16')](dials[_0x35172b[_0x798b('0x3')]],_0x35172b);dials[_0x35172b[_0x798b('0x3')]][_0x798b('0x17')]=utils[_0x798b('0x18')]();dials[_0x35172b[_0x798b('0x3')]][_0x798b('0x19')]=_0x798b('0x1a');}}catch(_0x32350a){utils[_0x798b('0xf')](_0x32350a[_0x798b('0x10')]);}};exports[_0x798b('0x1b')]=function(_0x3d2520){try{if(!_[_0x798b('0x12')](dials[_0x3d2520[_0x798b('0x3')]])){dials[_0x3d2520['uniqueid']][_0x798b('0x1c')]=_0x3d2520[_0x798b('0x1c')];if(_0x3d2520[_0x798b('0x1c')]==_0x798b('0x1d')){dials[_0x3d2520[_0x798b('0x3')]]=_[_0x798b('0x16')](dials[_0x3d2520[_0x798b('0x3')]],_0x3d2520);dials[_0x3d2520[_0x798b('0x3')]]['answertime']=utils[_0x798b('0x18')]();dials[_0x3d2520[_0x798b('0x3')]][_0x798b('0x19')]=_0x798b('0x1e');}}}catch(_0x50f66c){utils[_0x798b('0xf')](_0x50f66c[_0x798b('0x10')]);}};exports[_0x798b('0x1f')]=function(_0x2d1ab9){try{if(!_['isNil'](dials[_0x2d1ab9[_0x798b('0x3')]])){dials[_0x2d1ab9['uniqueid']]=_[_0x798b('0x16')](dials[_0x2d1ab9[_0x798b('0x3')]],{'endtime':utils[_0x798b('0x18')](),'lastevent':'complete'});dials[_0x2d1ab9[_0x798b('0x3')]][_0x798b('0x20')]=utils[_0x798b('0x21')](dials[_0x2d1ab9[_0x798b('0x3')]][_0x798b('0x22')],dials[_0x2d1ab9[_0x798b('0x3')]][_0x798b('0x17')]);dials[_0x2d1ab9['uniqueid']][_0x798b('0x23')]=utils['diffTime'](dials[_0x2d1ab9[_0x798b('0x3')]][_0x798b('0x24')]||dials[_0x2d1ab9[_0x798b('0x3')]][_0x798b('0x22')],dials[_0x2d1ab9[_0x798b('0x3')]]['starttime']);dials[_0x2d1ab9['uniqueid']][_0x798b('0x25')]=dials[_0x2d1ab9[_0x798b('0x3')]][_0x798b('0x24')]?utils[_0x798b('0x21')](dials[_0x2d1ab9['uniqueid']][_0x798b('0x22')],dials[_0x2d1ab9[_0x798b('0x3')]][_0x798b('0x24')]):0x0;writeDB(dials[_0x2d1ab9[_0x798b('0x3')]]);}}catch(_0x559d57){utils[_0x798b('0xf')](_0x559d57[_0x798b('0x10')]);}}; \ No newline at end of file +var _0xbdb1=['startsWith','appdata','cdr(routeid)','split','error','varset','isNil','variable','outboundrouteid','value','dialbegin','assign','starttime','now','lastevent','called','stack','dialend','dialstatus','ANSWER','answertime','connect','complete','duration','diffTime','endtime','holdtime','lodash','util','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','CreateVoiceDialReport','newexten','application','toLowerCase','set'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbdb1,0x6d));var _0x1bdb=function(_0x39b316,_0x3def1e){_0x39b316=_0x39b316-0x0;var _0x182ab1=_0xbdb1[_0x39b316];return _0x182ab1;};'use strict';var _=require(_0x1bdb('0x0'));var util=require(_0x1bdb('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x201cb5){utils[_0x1bdb('0x2')](util[_0x1bdb('0x3')]('DIAL|%s|%s|%s|%s|%s|%s',_0x201cb5[_0x1bdb('0x4')],_0x201cb5[_0x1bdb('0x5')],_0x201cb5[_0x1bdb('0x6')],_0x201cb5[_0x1bdb('0x7')],_0x201cb5[_0x1bdb('0x8')],_0x201cb5['dialstatus']));utils['request'](_0x1bdb('0x9'),_0x201cb5);delete dials[_0x201cb5[_0x1bdb('0x4')]];}exports[_0x1bdb('0xa')]=function(_0x164764){try{if(_0x164764[_0x1bdb('0xb')][_0x1bdb('0xc')]()==_0x1bdb('0xd')&&_[_0x1bdb('0xe')](_0x164764[_0x1bdb('0xf')]['toLowerCase'](),_0x1bdb('0x10'))){var _0x1674d1=_0x164764['appdata'][_0x1bdb('0x11')]('=');dials[_0x164764[_0x1bdb('0x4')]]={'routeId':_0x1674d1[0x1]};}}catch(_0x57e3ac){utils[_0x1bdb('0x12')](_0x57e3ac['stack']);}};exports[_0x1bdb('0x13')]=function(_0x44e590){try{if(!_[_0x1bdb('0x14')](_0x44e590[_0x1bdb('0x15')][_0x1bdb('0x16')])){dials[_0x44e590[_0x1bdb('0x4')]]={'routeId':_0x44e590[_0x1bdb('0x17')]};}}catch(_0x27032f){utils[_0x1bdb('0x12')](_0x27032f['stack']);}};exports[_0x1bdb('0x18')]=function(_0x38df34){try{if(!_[_0x1bdb('0x14')](dials[_0x38df34[_0x1bdb('0x4')]])){dials[_0x38df34[_0x1bdb('0x4')]]=_[_0x1bdb('0x19')](dials[_0x38df34[_0x1bdb('0x4')]],_0x38df34);dials[_0x38df34[_0x1bdb('0x4')]][_0x1bdb('0x1a')]=utils[_0x1bdb('0x1b')]();dials[_0x38df34[_0x1bdb('0x4')]][_0x1bdb('0x1c')]=_0x1bdb('0x1d');}}catch(_0x2f4769){utils[_0x1bdb('0x12')](_0x2f4769[_0x1bdb('0x1e')]);}};exports[_0x1bdb('0x1f')]=function(_0x447c7f){try{if(!_[_0x1bdb('0x14')](dials[_0x447c7f[_0x1bdb('0x4')]])){dials[_0x447c7f[_0x1bdb('0x4')]][_0x1bdb('0x20')]=_0x447c7f[_0x1bdb('0x20')];if(_0x447c7f[_0x1bdb('0x20')]==_0x1bdb('0x21')){dials[_0x447c7f[_0x1bdb('0x4')]]=_[_0x1bdb('0x19')](dials[_0x447c7f[_0x1bdb('0x4')]],_0x447c7f);dials[_0x447c7f[_0x1bdb('0x4')]][_0x1bdb('0x22')]=utils['now']();dials[_0x447c7f[_0x1bdb('0x4')]][_0x1bdb('0x1c')]=_0x1bdb('0x23');}}}catch(_0x398f65){utils[_0x1bdb('0x12')](_0x398f65['stack']);}};exports['hangup']=function(_0x490404){try{if(!_['isNil'](dials[_0x490404['uniqueid']])){dials[_0x490404['uniqueid']]=_['assign'](dials[_0x490404[_0x1bdb('0x4')]],{'endtime':utils['now'](),'lastevent':_0x1bdb('0x24')});dials[_0x490404[_0x1bdb('0x4')]][_0x1bdb('0x25')]=utils[_0x1bdb('0x26')](dials[_0x490404[_0x1bdb('0x4')]][_0x1bdb('0x27')],dials[_0x490404['uniqueid']][_0x1bdb('0x1a')]);dials[_0x490404[_0x1bdb('0x4')]][_0x1bdb('0x28')]=utils[_0x1bdb('0x26')](dials[_0x490404[_0x1bdb('0x4')]][_0x1bdb('0x22')]||dials[_0x490404['uniqueid']][_0x1bdb('0x27')],dials[_0x490404[_0x1bdb('0x4')]][_0x1bdb('0x1a')]);dials[_0x490404[_0x1bdb('0x4')]]['billableseconds']=dials[_0x490404[_0x1bdb('0x4')]]['answertime']?utils['diffTime'](dials[_0x490404[_0x1bdb('0x4')]][_0x1bdb('0x27')],dials[_0x490404[_0x1bdb('0x4')]]['answertime']):0x0;writeDB(dials[_0x490404['uniqueid']]);}}catch(_0x1cca82){utils['error'](_0x1cca82[_0x1bdb('0x1e')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 0e44127..b3d9103 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 _0x9d1e=['queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','asterisk','port','username','password','keepConnected','xdr','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0x9d1e,0x1d1));var _0xe9d1=function(_0x18293b,_0x99cd95){_0x18293b=_0x18293b-0x0;var _0x31bf2e=_0x9d1e[_0x18293b];return _0x31bf2e;};var AsteriskManager=require(_0xe9d1('0x0'));var config=require(_0xe9d1('0x1'));var utils=require(_0xe9d1('0x2'));var ami=new AsteriskManager(config[_0xe9d1('0x3')][_0xe9d1('0x4')],config[_0xe9d1('0x3')]['ip'],config['asterisk'][_0xe9d1('0x5')],config['asterisk'][_0xe9d1('0x6')],!![]);ami[_0xe9d1('0x7')]();if(config[_0xe9d1('0x8')]&&config[_0xe9d1('0x8')]['disabled']){utils[_0xe9d1('0x9')]('XDR\x20DISABLED');}else{var agents=require(_0xe9d1('0xa'));var calls=require(_0xe9d1('0xb'));var queues=require(_0xe9d1('0xc'));var recordings=require(_0xe9d1('0xd'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xe9d1('0xe'));var core=require(_0xe9d1('0xf'));ami['on']('connect',core[_0xe9d1('0x10')]);ami['on']('shutdown',core[_0xe9d1('0x11')]);ami['on'](_0xe9d1('0x12'),core['fullybooted']);ami['on'](_0xe9d1('0x13'),core[_0xe9d1('0x13')]);ami['on'](_0xe9d1('0x14'),core['close']);ami['on']('managerevent',core['managerevent']);ami['on'](_0xe9d1('0x15'),function(_0x5581e9){try{members['devicestatechange'](_0x5581e9);}catch(_0x4efa82){utils[_0xe9d1('0x13')](_0x4efa82);}});ami['on'](_0xe9d1('0x16'),function(_0x25577f){try{agents['agentcalled'](_0x25577f);}catch(_0x54cda4){utils[_0xe9d1('0x13')](_0x54cda4);}});ami['on'](_0xe9d1('0x17'),function(_0x30d9e4){try{agents[_0xe9d1('0x17')](_0x30d9e4);}catch(_0x15ba87){utils['error'](_0x15ba87);}});ami['on'](_0xe9d1('0x18'),function(_0x4d9a90){try{agents[_0xe9d1('0x18')](_0x4d9a90);queues[_0xe9d1('0x18')](_0x4d9a90);}catch(_0x32166c){utils[_0xe9d1('0x13')](_0x32166c);}});ami['on']('agentcomplete',function(_0x1acf23){try{agents[_0xe9d1('0x19')](_0x1acf23);queues['agentcomplete'](_0x1acf23);members[_0xe9d1('0x19')](_0x1acf23);}catch(_0x167363){utils[_0xe9d1('0x13')](_0x167363);}});ami['on']('queuecallerabandon',function(_0x5adbd0){try{agents['queuecallerabandon'](_0x5adbd0);queues[_0xe9d1('0x1a')](_0x5adbd0);}catch(_0x7c30ce){utils[_0xe9d1('0x13')](_0x7c30ce);}});ami['on'](_0xe9d1('0x1b'),function(_0x8745a5){try{queues[_0xe9d1('0x1b')](_0x8745a5);recordings[_0xe9d1('0x1b')](_0x8745a5);}catch(_0x3c2766){utils[_0xe9d1('0x13')](_0x3c2766);}});ami['on']('queuecallerleave',function(_0x6f0ea5){try{queues[_0xe9d1('0x1c')](_0x6f0ea5);}catch(_0x29370b){utils[_0xe9d1('0x13')](_0x29370b);}});ami['on']('musiconholdstart',function(_0x174edd){try{queues['musiconholdstart'](_0x174edd);calls[_0xe9d1('0x1d')](_0x174edd);}catch(_0x4439c8){utils[_0xe9d1('0x13')](_0x4439c8);}});ami['on'](_0xe9d1('0x1e'),function(_0x2516f1){try{queues[_0xe9d1('0x1e')](_0x2516f1);calls[_0xe9d1('0x1e')](_0x2516f1);}catch(_0x25cee1){utils['error'](_0x25cee1);}});ami['on'](_0xe9d1('0x1f'),function(_0x1d9400){try{calls[_0xe9d1('0x1f')](_0x1d9400);recordings['newstate'](_0x1d9400);}catch(_0x37af6b){utils[_0xe9d1('0x13')](_0x37af6b);}});ami['on'](_0xe9d1('0x20'),function(_0x3585b1){try{calls[_0xe9d1('0x20')](_0x3585b1);recordings['hangup'](_0x3585b1);dials[_0xe9d1('0x20')](_0x3585b1);agents[_0xe9d1('0x20')](_0x3585b1);queues['hangup'](_0x3585b1);}catch(_0x7ef966){utils[_0xe9d1('0x13')](_0x7ef966);}});ami['on']('cdr',function(_0x4347fa){try{members[_0xe9d1('0x21')](_0x4347fa);}catch(_0x2e16ab){utils[_0xe9d1('0x13')](_0x2e16ab);}});ami['on']('blindtransfer',function(_0xfd3190){try{queues[_0xe9d1('0x22')](_0xfd3190);agents['blindtransfer'](_0xfd3190);transfers[_0xe9d1('0x22')](_0xfd3190);}catch(_0x3048cd){utils['error'](_0x3048cd);}});ami['on']('attendedtransfer',function(_0xae5e65){try{queues['attendedtransfer'](_0xae5e65);transfers[_0xe9d1('0x23')](_0xae5e65);agents['attendedtransfer'](_0xae5e65);calls['attendedtransfer'](_0xae5e65);}catch(_0xde8498){utils['error'](_0xde8498);}});ami['on'](_0xe9d1('0x24'),function(_0x20c914){try{queues[_0xe9d1('0x24')](_0x20c914);recordings[_0xe9d1('0x24')](_0x20c914);calls['varset'](_0x20c914);dials['varset'](_0x20c914);}catch(_0x26824e){utils[_0xe9d1('0x13')](_0x26824e);}});ami['on'](_0xe9d1('0x25'),function(_0x4b72d5){try{calls['newexten'](_0x4b72d5);recordings['newexten'](_0x4b72d5);dials[_0xe9d1('0x25')](_0x4b72d5);}catch(_0x52d1e0){utils[_0xe9d1('0x13')](_0x52d1e0);}});ami['on'](_0xe9d1('0x26'),function(_0x38d5f0){try{calls[_0xe9d1('0x26')](_0x38d5f0);recordings[_0xe9d1('0x26')](_0x38d5f0);}catch(_0x3001c1){utils[_0xe9d1('0x13')](_0x3001c1);}});ami['on'](_0xe9d1('0x27'),function(_0x5a4dc6){try{dials[_0xe9d1('0x27')](_0x5a4dc6);}catch(_0x59e858){utils['error'](_0x59e858);}});ami['on'](_0xe9d1('0x28'),function(_0x710e88){try{dials[_0xe9d1('0x28')](_0x710e88);}catch(_0x5c9d52){utils[_0xe9d1('0x13')](_0x5c9d52);}});} \ No newline at end of file +var _0x7192=['attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','../../config/environment','./utils','asterisk','port','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','hangup','cdr','blindtransfer'];(function(_0x290115,_0x16b8da){var _0x1f59b8=function(_0x3f4d32){while(--_0x3f4d32){_0x290115['push'](_0x290115['shift']());}};_0x1f59b8(++_0x16b8da);}(_0x7192,0x13e));var _0x2719=function(_0x15864c,_0x1ad457){_0x15864c=_0x15864c-0x0;var _0x3bcd8e=_0x7192[_0x15864c];return _0x3bcd8e;};var AsteriskManager=require('asterisk-manager');var config=require(_0x2719('0x0'));var utils=require(_0x2719('0x1'));var ami=new AsteriskManager(config[_0x2719('0x2')][_0x2719('0x3')],config[_0x2719('0x2')]['ip'],config[_0x2719('0x2')]['username'],config['asterisk']['password'],!![]);ami[_0x2719('0x4')]();if(config[_0x2719('0x5')]&&config['xdr'][_0x2719('0x6')]){utils[_0x2719('0x7')](_0x2719('0x8'));}else{var agents=require(_0x2719('0x9'));var calls=require(_0x2719('0xa'));var queues=require(_0x2719('0xb'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x2719('0xc'));var transfers=require(_0x2719('0xd'));var core=require('./core.controller');ami['on'](_0x2719('0xe'),core[_0x2719('0xe')]);ami['on'](_0x2719('0xf'),core[_0x2719('0xf')]);ami['on'](_0x2719('0x10'),core['fullybooted']);ami['on']('error',core[_0x2719('0x11')]);ami['on'](_0x2719('0x12'),core[_0x2719('0x12')]);ami['on'](_0x2719('0x13'),core[_0x2719('0x13')]);ami['on']('devicestatechange',function(_0x205e02){try{members[_0x2719('0x14')](_0x205e02);}catch(_0x3b7aea){utils[_0x2719('0x11')](_0x3b7aea);}});ami['on'](_0x2719('0x15'),function(_0x3d6bd0){try{agents[_0x2719('0x15')](_0x3d6bd0);}catch(_0x101080){utils[_0x2719('0x11')](_0x101080);}});ami['on'](_0x2719('0x16'),function(_0x480194){try{agents[_0x2719('0x16')](_0x480194);}catch(_0x2135f1){utils[_0x2719('0x11')](_0x2135f1);}});ami['on'](_0x2719('0x17'),function(_0x5e429d){try{agents[_0x2719('0x17')](_0x5e429d);queues[_0x2719('0x17')](_0x5e429d);}catch(_0x2bbf7f){utils[_0x2719('0x11')](_0x2bbf7f);}});ami['on']('agentcomplete',function(_0x205578){try{agents[_0x2719('0x18')](_0x205578);queues[_0x2719('0x18')](_0x205578);members[_0x2719('0x18')](_0x205578);}catch(_0x25c3fc){utils['error'](_0x25c3fc);}});ami['on']('queuecallerabandon',function(_0x2328ee){try{agents[_0x2719('0x19')](_0x2328ee);queues[_0x2719('0x19')](_0x2328ee);}catch(_0x54498b){utils['error'](_0x54498b);}});ami['on'](_0x2719('0x1a'),function(_0x3f321f){try{queues[_0x2719('0x1a')](_0x3f321f);recordings['queuecallerjoin'](_0x3f321f);}catch(_0x585b8f){utils['error'](_0x585b8f);}});ami['on']('queuecallerleave',function(_0x433700){try{queues[_0x2719('0x1b')](_0x433700);}catch(_0x49019c){utils['error'](_0x49019c);}});ami['on'](_0x2719('0x1c'),function(_0x507e80){try{queues['musiconholdstart'](_0x507e80);calls[_0x2719('0x1c')](_0x507e80);}catch(_0x34b00e){utils['error'](_0x34b00e);}});ami['on'](_0x2719('0x1d'),function(_0x52e629){try{queues[_0x2719('0x1d')](_0x52e629);calls[_0x2719('0x1d')](_0x52e629);}catch(_0x26a9a8){utils['error'](_0x26a9a8);}});ami['on']('newstate',function(_0x15835e){try{calls['newstate'](_0x15835e);recordings['newstate'](_0x15835e);}catch(_0xc17be1){utils[_0x2719('0x11')](_0xc17be1);}});ami['on'](_0x2719('0x1e'),function(_0x380241){try{calls[_0x2719('0x1e')](_0x380241);recordings[_0x2719('0x1e')](_0x380241);dials['hangup'](_0x380241);agents['hangup'](_0x380241);queues[_0x2719('0x1e')](_0x380241);}catch(_0xbae5bb){utils[_0x2719('0x11')](_0xbae5bb);}});ami['on']('cdr',function(_0x107ae4){try{members[_0x2719('0x1f')](_0x107ae4);}catch(_0x588fa9){utils[_0x2719('0x11')](_0x588fa9);}});ami['on']('blindtransfer',function(_0x452685){try{queues['blindtransfer'](_0x452685);agents['blindtransfer'](_0x452685);transfers[_0x2719('0x20')](_0x452685);}catch(_0x46becc){utils['error'](_0x46becc);}});ami['on']('attendedtransfer',function(_0x2f4283){try{queues[_0x2719('0x21')](_0x2f4283);transfers[_0x2719('0x21')](_0x2f4283);agents[_0x2719('0x21')](_0x2f4283);calls['attendedtransfer'](_0x2f4283);}catch(_0xcfacd){utils[_0x2719('0x11')](_0xcfacd);}});ami['on']('varset',function(_0x185082){try{queues['varset'](_0x185082);recordings['varset'](_0x185082);calls[_0x2719('0x22')](_0x185082);dials['varset'](_0x185082);}catch(_0x167301){utils[_0x2719('0x11')](_0x167301);}});ami['on']('newexten',function(_0x4ce01c){try{calls[_0x2719('0x23')](_0x4ce01c);recordings[_0x2719('0x23')](_0x4ce01c);dials[_0x2719('0x23')](_0x4ce01c);}catch(_0x943bd4){utils[_0x2719('0x11')](_0x943bd4);}});ami['on'](_0x2719('0x24'),function(_0x5ac627){try{calls[_0x2719('0x24')](_0x5ac627);recordings[_0x2719('0x24')](_0x5ac627);}catch(_0x477e38){utils[_0x2719('0x11')](_0x477e38);}});ami['on']('dialbegin',function(_0x198ee6){try{dials[_0x2719('0x25')](_0x198ee6);}catch(_0xc95843){utils['error'](_0xc95843);}});ami['on']('dialend',function(_0x3d8402){try{dials[_0x2719('0x26')](_0x3d8402);}catch(_0x4c9102){utils[_0x2719('0x11')](_0x4c9102);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index c520cd8..e5dc7dd 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 _0xfac9=['BUSY','device','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','uniqueid','assign','source','destinationchannel','split','data1','destination','lodash','./utils','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','interface','channel','data2','type','getUserByInterface','internal','request','CreateMemberReport','getUserByName','then','membername','catch','startsWith','state'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xfac9,0xfc));var _0x9fac=function(_0x49fe47,_0x3557ef){_0x49fe47=_0x49fe47-0x0;var _0x29abe9=_0xfac9[_0x49fe47];return _0x29abe9;};'use strict';var _=require(_0x9fac('0x0'));var util=require('util');var utils=require(_0x9fac('0x1'));var members={};var exclude=[_0x9fac('0x2'),_0x9fac('0x3')];function writeDB(_0x2f4fb5){utils[_0x9fac('0x4')](util[_0x9fac('0x5')](_0x9fac('0x6'),_0x2f4fb5['uniqueid'],_0x2f4fb5[_0x9fac('0x7')],_0x2f4fb5[_0x9fac('0x8')],_0x2f4fb5[_0x9fac('0x9')],_0x2f4fb5['membername'],_0x2f4fb5[_0x9fac('0xa')]));if(_0x2f4fb5[_0x9fac('0x7')]){utils[_0x9fac('0xb')](_0x2f4fb5['interface'])['then'](function(_0x2220a7){if(_0x2220a7){_0x2f4fb5['membername']=_0x2220a7['name'];_0x2f4fb5[_0x9fac('0xc')]=_0x2220a7[_0x9fac('0xc')];utils[_0x9fac('0xd')](_0x9fac('0xe'),_0x2f4fb5);}else{utils[_0x9fac('0xf')](_0x2f4fb5[_0x9fac('0x7')]['split']('/')[0x1])[_0x9fac('0x10')](function(_0x5608cb){if(_0x5608cb){_0x2f4fb5[_0x9fac('0x11')]=_0x5608cb['name'];_0x2f4fb5[_0x9fac('0xc')]=_0x5608cb[_0x9fac('0xc')];utils['request'](_0x9fac('0xe'),_0x2f4fb5);}});}})[_0x9fac('0x12')](function(_0xf5c4dc){utils['error'](_0xf5c4dc);});}delete members[_0x2f4fb5[_0x9fac('0x7')]];}function startsWith(_0x3587ef,_0x3e8fdf){return _['some'](_0x3587ef,function(_0x28cbda){return _[_0x9fac('0x13')](_0x3e8fdf,_0x28cbda);});}exports['devicestatechange']=function(_0x5f3981){switch(_0x5f3981[_0x9fac('0x14')]){case'INUSE':case _0x9fac('0x15'):if(!startsWith(exclude,_0x5f3981[_0x9fac('0x16')])){members[_0x5f3981[_0x9fac('0x16')]]={'channel':_0x9fac('0x17'),'interface':_0x5f3981[_0x9fac('0x16')],'type':_0x9fac('0x18'),'enterAt':utils[_0x9fac('0x19')](),'role':'agent'};}break;case _0x9fac('0x1a'):if(!_[_0x9fac('0x1b')](members[_0x5f3981[_0x9fac('0x16')]])){members[_0x5f3981[_0x9fac('0x16')]][_0x9fac('0x1c')]=utils['now']();members[_0x5f3981['device']][_0x9fac('0x1d')]=utils[_0x9fac('0x1e')](members[_0x5f3981[_0x9fac('0x16')]][_0x9fac('0x1c')],members[_0x5f3981[_0x9fac('0x16')]][_0x9fac('0x1f')]);if(members[_0x5f3981[_0x9fac('0x16')]][_0x9fac('0x20')]){writeDB(members[_0x5f3981[_0x9fac('0x16')]]);}}default:break;}};exports['agentcomplete']=function(_0x4d9b0d){if(!_[_0x9fac('0x1b')](members[_0x4d9b0d[_0x9fac('0x7')]])){members[_0x4d9b0d['interface']]=_['assign'](members[_0x4d9b0d[_0x9fac('0x7')]],{'data4':_0x4d9b0d['queue'],'uniqueid':_0x4d9b0d['uniqueid']});}};exports['cdr']=function(_0x192acf){if(_0x192acf[_0x9fac('0x8')]){var _0xbf358=_0x192acf[_0x9fac('0x8')]['split']('-')[0x0];if(!_[_0x9fac('0x1b')](members[_0xbf358])){members[_0xbf358]=_[_0x9fac('0x21')](members[_0xbf358],{'data1':members[_0xbf358]['data1']||_0x192acf[_0x9fac('0xa')],'data2':members[_0xbf358]['data2']||_0x192acf[_0x9fac('0x22')],'data3':members[_0xbf358]['data3']||_0x192acf['destination'],'uniqueid':members[_0xbf358][_0x9fac('0x20')]||_0x192acf['uniqueid']});if(members[_0xbf358]['exitAt']){writeDB(members[_0xbf358]);}}}if(_0x192acf[_0x9fac('0x23')]){var _0xfd2db6=_0x192acf[_0x9fac('0x23')][_0x9fac('0x24')]('-')[0x0];if(!_['isNil'](members[_0xfd2db6])){members[_0xfd2db6]=_['assign'](members[_0xfd2db6],{'data1':members[_0xfd2db6][_0x9fac('0x25')]||_0x192acf['type'],'data2':members[_0xfd2db6][_0x9fac('0x9')]||_0x192acf[_0x9fac('0x22')],'data3':members[_0xfd2db6]['data3']||_0x192acf[_0x9fac('0x26')],'uniqueid':members[_0xfd2db6][_0x9fac('0x20')]||_0x192acf['uniqueid']});if(members[_0xfd2db6][_0x9fac('0x1c')]){writeDB(members[_0xfd2db6]);}}}}; \ No newline at end of file +var _0xbf47=['state','BUSY','device','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration','queue','cdr','assign','source','destination','destinationchannel','data1','data3','lodash','util','Local/_attended@transfer','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','channel','data2','membername','type','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','interface','split','request','catch','startsWith'];(function(_0x3bab2b,_0x3e9256){var _0x1eeaed=function(_0x20d7d6){while(--_0x20d7d6){_0x3bab2b['push'](_0x3bab2b['shift']());}};_0x1eeaed(++_0x3e9256);}(_0xbf47,0x152));var _0x7bf4=function(_0x4a5653,_0x2a0dde){_0x4a5653=_0x4a5653-0x0;var _0x3ff381=_0xbf47[_0x4a5653];return _0x3ff381;};'use strict';var _=require(_0x7bf4('0x0'));var util=require(_0x7bf4('0x1'));var utils=require('./utils');var members={};var exclude=[_0x7bf4('0x2'),'Queue:'];function writeDB(_0x255fa9){utils[_0x7bf4('0x3')](util[_0x7bf4('0x4')](_0x7bf4('0x5'),_0x255fa9[_0x7bf4('0x6')],_0x255fa9['interface'],_0x255fa9[_0x7bf4('0x7')],_0x255fa9[_0x7bf4('0x8')],_0x255fa9[_0x7bf4('0x9')],_0x255fa9[_0x7bf4('0xa')]));if(_0x255fa9['interface']){utils[_0x7bf4('0xb')](_0x255fa9['interface'])[_0x7bf4('0xc')](function(_0x3a9134){if(_0x3a9134){_0x255fa9['membername']=_0x3a9134[_0x7bf4('0xd')];_0x255fa9[_0x7bf4('0xe')]=_0x3a9134[_0x7bf4('0xe')];utils['request'](_0x7bf4('0xf'),_0x255fa9);}else{utils[_0x7bf4('0x10')](_0x255fa9[_0x7bf4('0x11')][_0x7bf4('0x12')]('/')[0x1])[_0x7bf4('0xc')](function(_0x43b84b){if(_0x43b84b){_0x255fa9['membername']=_0x43b84b[_0x7bf4('0xd')];_0x255fa9[_0x7bf4('0xe')]=_0x43b84b['internal'];utils[_0x7bf4('0x13')]('CreateMemberReport',_0x255fa9);}});}})[_0x7bf4('0x14')](function(_0x2610e8){utils['error'](_0x2610e8);});}delete members[_0x255fa9[_0x7bf4('0x11')]];}function startsWith(_0x380a46,_0x541469){return _['some'](_0x380a46,function(_0x53be4a){return _[_0x7bf4('0x15')](_0x541469,_0x53be4a);});}exports['devicestatechange']=function(_0x4b983e){switch(_0x4b983e[_0x7bf4('0x16')]){case'INUSE':case _0x7bf4('0x17'):if(!startsWith(exclude,_0x4b983e[_0x7bf4('0x18')])){members[_0x4b983e['device']]={'channel':_0x7bf4('0x19'),'interface':_0x4b983e[_0x7bf4('0x18')],'type':_0x7bf4('0x1a'),'enterAt':utils[_0x7bf4('0x1b')](),'role':'agent'};}break;case _0x7bf4('0x1c'):if(!_[_0x7bf4('0x1d')](members[_0x4b983e['device']])){members[_0x4b983e[_0x7bf4('0x18')]][_0x7bf4('0x1e')]=utils[_0x7bf4('0x1b')]();members[_0x4b983e[_0x7bf4('0x18')]][_0x7bf4('0x1f')]=utils['diffTime'](members[_0x4b983e[_0x7bf4('0x18')]][_0x7bf4('0x1e')],members[_0x4b983e['device']]['enterAt']);if(members[_0x4b983e[_0x7bf4('0x18')]][_0x7bf4('0x6')]){writeDB(members[_0x4b983e[_0x7bf4('0x18')]]);}}default:break;}};exports['agentcomplete']=function(_0x2747e2){if(!_[_0x7bf4('0x1d')](members[_0x2747e2[_0x7bf4('0x11')]])){members[_0x2747e2['interface']]=_['assign'](members[_0x2747e2['interface']],{'data4':_0x2747e2[_0x7bf4('0x20')],'uniqueid':_0x2747e2[_0x7bf4('0x6')]});}};exports[_0x7bf4('0x21')]=function(_0x37bff8){if(_0x37bff8[_0x7bf4('0x7')]){var _0x11ffe1=_0x37bff8[_0x7bf4('0x7')][_0x7bf4('0x12')]('-')[0x0];if(!_[_0x7bf4('0x1d')](members[_0x11ffe1])){members[_0x11ffe1]=_[_0x7bf4('0x22')](members[_0x11ffe1],{'data1':members[_0x11ffe1]['data1']||_0x37bff8[_0x7bf4('0xa')],'data2':members[_0x11ffe1][_0x7bf4('0x8')]||_0x37bff8[_0x7bf4('0x23')],'data3':members[_0x11ffe1]['data3']||_0x37bff8[_0x7bf4('0x24')],'uniqueid':members[_0x11ffe1][_0x7bf4('0x6')]||_0x37bff8[_0x7bf4('0x6')]});if(members[_0x11ffe1][_0x7bf4('0x1e')]){writeDB(members[_0x11ffe1]);}}}if(_0x37bff8[_0x7bf4('0x25')]){var _0x21d83f=_0x37bff8['destinationchannel'][_0x7bf4('0x12')]('-')[0x0];if(!_[_0x7bf4('0x1d')](members[_0x21d83f])){members[_0x21d83f]=_['assign'](members[_0x21d83f],{'data1':members[_0x21d83f][_0x7bf4('0x26')]||_0x37bff8['type'],'data2':members[_0x21d83f][_0x7bf4('0x8')]||_0x37bff8[_0x7bf4('0x23')],'data3':members[_0x21d83f][_0x7bf4('0x27')]||_0x37bff8['destination'],'uniqueid':members[_0x21d83f][_0x7bf4('0x6')]||_0x37bff8[_0x7bf4('0x6')]});if(members[_0x21d83f][_0x7bf4('0x1e')]){writeDB(members[_0x21d83f]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 2d3c2a9..d6af733 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 _0xa46a=['EXITWITHKEY','queuecallerexitAt','ABANDONED','queuecallerleave','holdtime','queuecallerjoinAt','position','count','connectedlinenum','connectedlinename','agentconnect','assigned','destaccountcode','membername','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','transferexten','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','secondtransfereruniqueid','ATTENDED','secondtransfererexten','transfertargetlinkedid','mohtime','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','queuecallerexitreason','COMPLETEDBYAGENT','queuecallerenterreason','varset','isNil','variable','CONTINUE','queuecallerabandonAt','value','toUpperCase'];(function(_0x325d3a,_0x4000a6){var _0x569f27=function(_0x1925fe){while(--_0x1925fe){_0x325d3a['push'](_0x325d3a['shift']());}};_0x569f27(++_0x4000a6);}(_0xa46a,0x121));var _0xaa46=function(_0x1e2939,_0x1f1ddc){_0x1e2939=_0x1e2939-0x0;var _0x1a1028=_0xa46a[_0x1e2939];return _0x1a1028;};'use strict';var _=require(_0xaa46('0x0'));var util=require(_0xaa46('0x1'));var utils=require(_0xaa46('0x2'));var queues={};function writeDB(_0x382707){utils[_0xaa46('0x3')](util[_0xaa46('0x4')](_0xaa46('0x5'),_0x382707[_0xaa46('0x6')],_0x382707['channel'],_0x382707[_0xaa46('0x7')],_0x382707[_0xaa46('0x8')],_0x382707[_0xaa46('0x9')],_0x382707[_0xaa46('0xa')],_0x382707['queuecallerexitreason']));if(_0x382707[_0xaa46('0x7')]){utils[_0xaa46('0xb')](_0x382707[_0xaa46('0x7')])[_0xaa46('0xc')](function(_0x4b0886){if(_0x4b0886){_0x382707['type']=_0x4b0886[_0xaa46('0xd')];}utils[_0xaa46('0xe')](_0xaa46('0xf'),_0x382707);});}else{utils['request']('CreateVoiceQueueReport',_0x382707);}if(_0x382707['transfereduniqueid']){delete queues[_0x382707[_0xaa46('0x10')]];}else{delete queues[_0x382707[_0xaa46('0x6')]];}}exports[_0xaa46('0x11')]=function(_0x182c25){queues[_0x182c25['uniqueid']]=_[_0xaa46('0x12')](_0x182c25,{'originalposition':_0x182c25['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports['hangup']=function(_0x3ed515){if(!_['isNil'](queues[_0x3ed515[_0xaa46('0x6')]])){if(queues[_0x3ed515[_0xaa46('0x6')]][_0xaa46('0x13')]){if(!queues[_0x3ed515[_0xaa46('0x6')]][_0xaa46('0x14')]&&!queues[_0x3ed515[_0xaa46('0x6')]][_0xaa46('0x15')]){queues[_0x3ed515[_0xaa46('0x6')]][_0xaa46('0x16')]=!![];queues[_0x3ed515[_0xaa46('0x6')]][_0xaa46('0x17')]=utils[_0xaa46('0x18')]();queues[_0x3ed515[_0xaa46('0x6')]][_0xaa46('0x19')]=_0xaa46('0x1a');}writeDB(queues[_0x3ed515[_0xaa46('0x6')]]);}else{if(queues[_0x3ed515[_0xaa46('0x6')]][_0xaa46('0x10')]){queues[queues[_0x3ed515['uniqueid']][_0xaa46('0x10')]]=queues[_0x3ed515[_0xaa46('0x6')]];queues[queues[_0x3ed515['uniqueid']][_0xaa46('0x10')]][_0xaa46('0x1b')]=0x2;delete queues[_0x3ed515[_0xaa46('0x6')]];}}}};exports[_0xaa46('0x1c')]=function(_0x38e3e4){if(!_[_0xaa46('0x1d')](_0x38e3e4[_0xaa46('0x1e')]['queuestatus'])&&_0x38e3e4['value']['toUpperCase']()!==_0xaa46('0x1f')){if(!_[_0xaa46('0x1d')](queues[_0x38e3e4['uniqueid']])){queues[_0x38e3e4['uniqueid']][_0xaa46('0x14')]=![];queues[_0x38e3e4[_0xaa46('0x6')]][_0xaa46('0x20')]=null;queues[_0x38e3e4['uniqueid']][_0xaa46('0x15')]=!![];queues[_0x38e3e4[_0xaa46('0x6')]]['queuecallerexitAt']=utils['now']();queues[_0x38e3e4[_0xaa46('0x6')]][_0xaa46('0x19')]=_0x38e3e4[_0xaa46('0x21')][_0xaa46('0x22')]();writeDB(queues[_0x38e3e4[_0xaa46('0x6')]]);}}else if(!_[_0xaa46('0x1d')](_0x38e3e4[_0xaa46('0x1e')]['queueposition'])){if(!_[_0xaa46('0x1d')](queues[_0x38e3e4[_0xaa46('0x6')]])&&!queues[_0x38e3e4['uniqueid']][_0xaa46('0x14')]){queues[_0x38e3e4[_0xaa46('0x6')]]['queuecallerabandon']=![];queues[_0x38e3e4[_0xaa46('0x6')]][_0xaa46('0x20')]=null;queues[_0x38e3e4['uniqueid']][_0xaa46('0x15')]=!![];queues[_0x38e3e4[_0xaa46('0x6')]]['queuecallerexitAt']=utils['now']();queues[_0x38e3e4['uniqueid']]['queuecallerexitreason']=_0xaa46('0x23');}}};exports[_0xaa46('0x14')]=function(_0x3db18a){if(!_[_0xaa46('0x1d')](queues[_0x3db18a['uniqueid']])){queues[_0x3db18a['uniqueid']][_0xaa46('0x15')]=![];queues[_0x3db18a[_0xaa46('0x6')]][_0xaa46('0x24')]=null;queues[_0x3db18a[_0xaa46('0x6')]][_0xaa46('0x14')]=!![];queues[_0x3db18a[_0xaa46('0x6')]][_0xaa46('0x20')]=utils[_0xaa46('0x18')]();queues[_0x3db18a[_0xaa46('0x6')]][_0xaa46('0x19')]=_0xaa46('0x25');}};exports['queuecallerleave']=function(_0x5e8123){if(!_['isNil'](queues[_0x5e8123[_0xaa46('0x6')]])){queues[_0x5e8123[_0xaa46('0x6')]][_0xaa46('0x26')]=!![];queues[_0x5e8123[_0xaa46('0x6')]]['queuecallerleaveAt']=utils[_0xaa46('0x18')]();queues[_0x5e8123[_0xaa46('0x6')]][_0xaa46('0x27')]=utils['diffTime'](queues[_0x5e8123[_0xaa46('0x6')]][_0xaa46('0x13')],queues[_0x5e8123[_0xaa46('0x6')]][_0xaa46('0x28')]);queues[_0x5e8123[_0xaa46('0x6')]][_0xaa46('0x29')]=_0x5e8123[_0xaa46('0x29')];queues[_0x5e8123[_0xaa46('0x6')]]['count']=_0x5e8123[_0xaa46('0x2a')];queues[_0x5e8123['uniqueid']][_0xaa46('0x2b')]=_0x5e8123[_0xaa46('0x2b')];queues[_0x5e8123['uniqueid']][_0xaa46('0x2c')]=_0x5e8123[_0xaa46('0x2c')];}};exports[_0xaa46('0x2d')]=function(_0x55b31e){if(!_[_0xaa46('0x1d')](queues[_0x55b31e['uniqueid']])){queues[_0x55b31e[_0xaa46('0x6')]][_0xaa46('0x14')]=![];queues[_0x55b31e[_0xaa46('0x6')]]['queuecallerabandon']=![];queues[_0x55b31e['uniqueid']][_0xaa46('0x20')]=null;queues[_0x55b31e['uniqueid']][_0xaa46('0x15')]=![];queues[_0x55b31e['uniqueid']]['queuecallerexitreason']=null;queues[_0x55b31e[_0xaa46('0x6')]][_0xaa46('0x24')]=null;queues[_0x55b31e['uniqueid']][_0xaa46('0x2e')]=!![];queues[_0x55b31e[_0xaa46('0x6')]]['accountcode']=_0x55b31e[_0xaa46('0x2f')];queues[_0x55b31e['uniqueid']][_0xaa46('0x8')]=_0x55b31e[_0xaa46('0x30')];}};exports[_0xaa46('0x31')]=function(_0x37654b){if(!_['isNil'](queues[_0x37654b[_0xaa46('0x6')]])){if(queues[_0x37654b['uniqueid']][_0xaa46('0x13')]){queues[_0x37654b[_0xaa46('0x6')]]['queuecallerabandon']=![];queues[_0x37654b[_0xaa46('0x6')]][_0xaa46('0x14')]=![];queues[_0x37654b['uniqueid']][_0xaa46('0x20')]=null;queues[_0x37654b[_0xaa46('0x6')]][_0xaa46('0x15')]=![];queues[_0x37654b[_0xaa46('0x6')]]['queuecallerexitAt']=null;queues[_0x37654b[_0xaa46('0x6')]][_0xaa46('0x2e')]=!![];queues[_0x37654b['uniqueid']][_0xaa46('0x8')]=_0x37654b[_0xaa46('0x30')];queues[_0x37654b[_0xaa46('0x6')]][_0xaa46('0x16')]=!![];queues[_0x37654b[_0xaa46('0x6')]]['queuecallercompleteAt']=utils[_0xaa46('0x18')]();if(_0x37654b[_0xaa46('0x32')]==_0xaa46('0x33')){if(!queues[_0x37654b['uniqueid']][_0xaa46('0x33')]){queues[_0x37654b[_0xaa46('0x6')]]['queuecallerexitreason']=_0xaa46('0x34');}}else{queues[_0x37654b['uniqueid']][_0xaa46('0x19')]=_0xaa46('0x35')+_0x37654b[_0xaa46('0x32')][_0xaa46('0x22')]();}writeDB(queues[_0x37654b[_0xaa46('0x6')]]);}}};exports[_0xaa46('0x36')]=function(_0x39e61b){if(!_[_0xaa46('0x1d')](queues[_0x39e61b['transfereeuniqueid']])){queues[_0x39e61b['transfereeuniqueid']][_0xaa46('0x33')]=!![];queues[_0x39e61b[_0xaa46('0x37')]][_0xaa46('0x38')]=_0xaa46('0x39');queues[_0x39e61b['transfereeuniqueid']]['transferexten']=_0x39e61b[_0xaa46('0x3a')];queues[_0x39e61b[_0xaa46('0x37')]][_0xaa46('0x3b')]=_0x39e61b[_0xaa46('0x37')];queues[_0x39e61b[_0xaa46('0x37')]][_0xaa46('0x19')]=_0xaa46('0x3c');}};exports[_0xaa46('0x3d')]=function(_0x1f6c0d){try{if(_0x1f6c0d[_0xaa46('0x3e')]==_0x1f6c0d[_0xaa46('0x3f')]){if(!_[_0xaa46('0x1d')](queues[_0x1f6c0d[_0xaa46('0x40')]])){queues[_0x1f6c0d[_0xaa46('0x40')]][_0xaa46('0x33')]=!![];queues[_0x1f6c0d['secondtransfererlinkedid']][_0xaa46('0x38')]='ATTENDED';queues[_0x1f6c0d[_0xaa46('0x40')]][_0xaa46('0x41')]=_0x1f6c0d[_0xaa46('0x42')];queues[_0x1f6c0d[_0xaa46('0x40')]][_0xaa46('0x3b')]=_0x1f6c0d['origtransfereruniqueid'];queues[_0x1f6c0d[_0xaa46('0x40')]]['queuecallerexitreason']=_0xaa46('0x43');}if(!_[_0xaa46('0x1d')](queues[_0x1f6c0d[_0xaa46('0x3f')]])){if(_0x1f6c0d[_0xaa46('0x44')]&&queues[_0x1f6c0d[_0xaa46('0x44')]]){queues[_0x1f6c0d[_0xaa46('0x44')]][_0xaa46('0x1b')]=0x1;queues[_0x1f6c0d[_0xaa46('0x37')]]=_['clone'](queues[_0x1f6c0d[_0xaa46('0x44')]]);queues[_0x1f6c0d[_0xaa46('0x37')]][_0xaa46('0x10')]=_0x1f6c0d[_0xaa46('0x45')];queues[_0x1f6c0d['transfereeuniqueid']][_0xaa46('0x1b')]=0x2;queues[_0x1f6c0d[_0xaa46('0x37')]]['calleridnum']=queues[_0x1f6c0d[_0xaa46('0x40')]]['calleridnum'];queues[_0x1f6c0d['transfereeuniqueid']]['calleridname']=queues[_0x1f6c0d['secondtransfererlinkedid']][_0xaa46('0x46')];queues[_0x1f6c0d[_0xaa46('0x37')]][_0xaa46('0x28')]=utils['now']();queues[_0x1f6c0d['transfereeuniqueid']][_0xaa46('0x13')]=utils['now']();queues[_0x1f6c0d[_0xaa46('0x37')]][_0xaa46('0x27')]=0x0;queues[_0x1f6c0d[_0xaa46('0x37')]]['mohtime']=0x0;}else{queues[_0x1f6c0d['origtransfererlinkedid']][_0xaa46('0x10')]=_0x1f6c0d['secondtransfererlinkedid'];}}}else if(_0x1f6c0d[_0xaa46('0x47')]==_0x1f6c0d['secondtransfererlinkedid']){if(!_[_0xaa46('0x1d')](queues[_0x1f6c0d[_0xaa46('0x3f')]])){queues[_0x1f6c0d[_0xaa46('0x3f')]][_0xaa46('0x33')]=!![];queues[_0x1f6c0d[_0xaa46('0x3f')]][_0xaa46('0x38')]=_0xaa46('0x48');queues[_0x1f6c0d['origtransfererlinkedid']]['transferexten']=_0x1f6c0d[_0xaa46('0x49')];queues[_0x1f6c0d[_0xaa46('0x3f')]][_0xaa46('0x3b')]=_0x1f6c0d[_0xaa46('0x47')];queues[_0x1f6c0d[_0xaa46('0x3f')]]['queuecallerexitreason']=_0xaa46('0x43');}if(!_[_0xaa46('0x1d')](queues[_0x1f6c0d[_0xaa46('0x40')]])){if(_0x1f6c0d['transfertargetlinkedid']&&queues[_0x1f6c0d['transfertargetlinkedid']]){queues[_0x1f6c0d[_0xaa46('0x4a')]][_0xaa46('0x1b')]=0x1;queues[_0x1f6c0d[_0xaa46('0x45')]]=_['clone'](queues[_0x1f6c0d['transfertargetlinkedid']]);queues[_0x1f6c0d[_0xaa46('0x45')]][_0xaa46('0x10')]=_0x1f6c0d[_0xaa46('0x45')];queues[_0x1f6c0d[_0xaa46('0x45')]][_0xaa46('0x1b')]=0x2;queues[_0x1f6c0d['transfertargetuniqueid']][_0xaa46('0x9')]=queues[_0x1f6c0d[_0xaa46('0x3f')]]['calleridnum'];queues[_0x1f6c0d['transfertargetuniqueid']][_0xaa46('0x46')]=queues[_0x1f6c0d['origtransfererlinkedid']][_0xaa46('0x46')];queues[_0x1f6c0d[_0xaa46('0x45')]]['queuecallerjoinAt']=utils['now']();queues[_0x1f6c0d[_0xaa46('0x45')]][_0xaa46('0x13')]=utils['now']();queues[_0x1f6c0d[_0xaa46('0x45')]][_0xaa46('0x27')]=0x0;queues[_0x1f6c0d[_0xaa46('0x45')]][_0xaa46('0x4b')]=0x0;}else{queues[_0x1f6c0d[_0xaa46('0x40')]]['transfereduniqueid']=_0x1f6c0d[_0xaa46('0x3f')];}}}}catch(_0x4bff5e){utils[_0xaa46('0x4c')](_0x4bff5e[_0xaa46('0x4d')]);}};exports[_0xaa46('0x4e')]=function(_0x3a9de8){if(!_[_0xaa46('0x1d')](queues[_0x3a9de8['uniqueid']])){queues[_0x3a9de8[_0xaa46('0x6')]][_0xaa46('0x4f')]=utils[_0xaa46('0x18')]();}};exports[_0xaa46('0x50')]=function(_0x476d75){if(!_[_0xaa46('0x1d')](queues[_0x476d75[_0xaa46('0x6')]])){if(!_[_0xaa46('0x1d')](queues[_0x476d75['uniqueid']]['musiconholdstartAt'])){queues[_0x476d75[_0xaa46('0x6')]][_0xaa46('0x4b')]+=utils['diffTime'](utils['now'](),queues[_0x476d75['uniqueid']][_0xaa46('0x4f')]);delete queues[_0x476d75[_0xaa46('0x6')]][_0xaa46('0x4f')];}}}; \ No newline at end of file +var _0x3a3b=['queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','queuecallerenterreason','queuestatus','queuecallerabandonAt','queuecallerexitAt','variable','queueposition','ABANDONED','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','assigned','membername','reason','transfer','TRANSFER','COMPLETEDBY','toUpperCase','blindtransfer','transfereeuniqueid','transferexten','extension','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','transfertype','transferuniqueid','ATTENDEDTRANSFER','clone','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','ATTENDED','secondtransfererexten','transfertargetlinkedid','stack','musiconholdstart','musiconholdstop','musiconholdstartAt','util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','position','now','hangup','isNil','queuecallerleaveAt'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x3a3b,0x7c));var _0xb3a3=function(_0x4b29e5,_0x271a17){_0x4b29e5=_0x4b29e5-0x0;var _0x2963d1=_0x3a3b[_0x4b29e5];return _0x2963d1;};'use strict';var _=require('lodash');var util=require(_0xb3a3('0x0'));var utils=require(_0xb3a3('0x1'));var queues={};function writeDB(_0x2b4a49){utils[_0xb3a3('0x2')](util[_0xb3a3('0x3')](_0xb3a3('0x4'),_0x2b4a49[_0xb3a3('0x5')],_0x2b4a49[_0xb3a3('0x6')],_0x2b4a49['queue'],_0x2b4a49[_0xb3a3('0x7')],_0x2b4a49[_0xb3a3('0x8')],_0x2b4a49[_0xb3a3('0x9')],_0x2b4a49[_0xb3a3('0xa')]));if(_0x2b4a49['queue']){utils[_0xb3a3('0xb')](_0x2b4a49[_0xb3a3('0xc')])[_0xb3a3('0xd')](function(_0x53c46d){if(_0x53c46d){_0x2b4a49['type']=_0x53c46d[_0xb3a3('0xe')];}utils[_0xb3a3('0xf')](_0xb3a3('0x10'),_0x2b4a49);});}else{utils[_0xb3a3('0xf')](_0xb3a3('0x10'),_0x2b4a49);}if(_0x2b4a49[_0xb3a3('0x11')]){delete queues[_0x2b4a49[_0xb3a3('0x11')]];}else{delete queues[_0x2b4a49[_0xb3a3('0x5')]];}}exports[_0xb3a3('0x12')]=function(_0x280cf3){queues[_0x280cf3[_0xb3a3('0x5')]]=_['assign'](_0x280cf3,{'originalposition':_0x280cf3[_0xb3a3('0x13')],'queuecallerjoinAt':utils[_0xb3a3('0x14')](),'mohtime':0x0});};exports[_0xb3a3('0x15')]=function(_0x752d6f){if(!_[_0xb3a3('0x16')](queues[_0x752d6f[_0xb3a3('0x5')]])){if(queues[_0x752d6f['uniqueid']][_0xb3a3('0x17')]){if(!queues[_0x752d6f[_0xb3a3('0x5')]][_0xb3a3('0x18')]&&!queues[_0x752d6f['uniqueid']][_0xb3a3('0x19')]){queues[_0x752d6f[_0xb3a3('0x5')]][_0xb3a3('0x1a')]=!![];queues[_0x752d6f['uniqueid']][_0xb3a3('0x1b')]=utils['now']();queues[_0x752d6f[_0xb3a3('0x5')]][_0xb3a3('0xa')]=_0xb3a3('0x1c');}writeDB(queues[_0x752d6f['uniqueid']]);}else{if(queues[_0x752d6f[_0xb3a3('0x5')]][_0xb3a3('0x11')]){queues[queues[_0x752d6f[_0xb3a3('0x5')]][_0xb3a3('0x11')]]=queues[_0x752d6f[_0xb3a3('0x5')]];queues[queues[_0x752d6f['uniqueid']]['transfereduniqueid']][_0xb3a3('0x1d')]=0x2;delete queues[_0x752d6f['uniqueid']];}}}};exports['varset']=function(_0x1c9cdb){if(!_[_0xb3a3('0x16')](_0x1c9cdb['variable'][_0xb3a3('0x1e')])&&_0x1c9cdb['value']['toUpperCase']()!=='CONTINUE'){if(!_[_0xb3a3('0x16')](queues[_0x1c9cdb[_0xb3a3('0x5')]])){queues[_0x1c9cdb[_0xb3a3('0x5')]][_0xb3a3('0x18')]=![];queues[_0x1c9cdb[_0xb3a3('0x5')]][_0xb3a3('0x1f')]=null;queues[_0x1c9cdb[_0xb3a3('0x5')]][_0xb3a3('0x19')]=!![];queues[_0x1c9cdb[_0xb3a3('0x5')]][_0xb3a3('0x20')]=utils[_0xb3a3('0x14')]();queues[_0x1c9cdb[_0xb3a3('0x5')]][_0xb3a3('0xa')]=_0x1c9cdb['value']['toUpperCase']();writeDB(queues[_0x1c9cdb[_0xb3a3('0x5')]]);}}else if(!_[_0xb3a3('0x16')](_0x1c9cdb[_0xb3a3('0x21')][_0xb3a3('0x22')])){if(!_[_0xb3a3('0x16')](queues[_0x1c9cdb[_0xb3a3('0x5')]])&&!queues[_0x1c9cdb['uniqueid']][_0xb3a3('0x18')]){queues[_0x1c9cdb['uniqueid']][_0xb3a3('0x18')]=![];queues[_0x1c9cdb['uniqueid']][_0xb3a3('0x1f')]=null;queues[_0x1c9cdb[_0xb3a3('0x5')]][_0xb3a3('0x19')]=!![];queues[_0x1c9cdb[_0xb3a3('0x5')]][_0xb3a3('0x20')]=utils[_0xb3a3('0x14')]();queues[_0x1c9cdb['uniqueid']][_0xb3a3('0xa')]='EXITWITHKEY';}}};exports['queuecallerabandon']=function(_0x2a1600){if(!_['isNil'](queues[_0x2a1600['uniqueid']])){queues[_0x2a1600[_0xb3a3('0x5')]][_0xb3a3('0x19')]=![];queues[_0x2a1600[_0xb3a3('0x5')]][_0xb3a3('0x20')]=null;queues[_0x2a1600[_0xb3a3('0x5')]][_0xb3a3('0x18')]=!![];queues[_0x2a1600[_0xb3a3('0x5')]]['queuecallerabandonAt']=utils['now']();queues[_0x2a1600[_0xb3a3('0x5')]][_0xb3a3('0xa')]=_0xb3a3('0x23');}};exports[_0xb3a3('0x24')]=function(_0x40122e){if(!_[_0xb3a3('0x16')](queues[_0x40122e['uniqueid']])){queues[_0x40122e[_0xb3a3('0x5')]]['queuecallerleave']=!![];queues[_0x40122e[_0xb3a3('0x5')]][_0xb3a3('0x17')]=utils['now']();queues[_0x40122e[_0xb3a3('0x5')]][_0xb3a3('0x25')]=utils[_0xb3a3('0x26')](queues[_0x40122e[_0xb3a3('0x5')]][_0xb3a3('0x17')],queues[_0x40122e[_0xb3a3('0x5')]][_0xb3a3('0x27')]);queues[_0x40122e[_0xb3a3('0x5')]][_0xb3a3('0x13')]=_0x40122e[_0xb3a3('0x13')];queues[_0x40122e[_0xb3a3('0x5')]]['count']=_0x40122e[_0xb3a3('0x28')];queues[_0x40122e[_0xb3a3('0x5')]][_0xb3a3('0x29')]=_0x40122e['connectedlinenum'];queues[_0x40122e[_0xb3a3('0x5')]][_0xb3a3('0x2a')]=_0x40122e[_0xb3a3('0x2a')];}};exports[_0xb3a3('0x2b')]=function(_0x136048){if(!_[_0xb3a3('0x16')](queues[_0x136048['uniqueid']])){queues[_0x136048[_0xb3a3('0x5')]][_0xb3a3('0x18')]=![];queues[_0x136048['uniqueid']][_0xb3a3('0x18')]=![];queues[_0x136048['uniqueid']][_0xb3a3('0x1f')]=null;queues[_0x136048[_0xb3a3('0x5')]]['queuecallerexit']=![];queues[_0x136048['uniqueid']]['queuecallerexitreason']=null;queues[_0x136048[_0xb3a3('0x5')]]['queuecallerexitAt']=null;queues[_0x136048[_0xb3a3('0x5')]][_0xb3a3('0x2c')]=!![];queues[_0x136048[_0xb3a3('0x5')]][_0xb3a3('0x9')]=_0x136048['destaccountcode'];queues[_0x136048[_0xb3a3('0x5')]][_0xb3a3('0x7')]=_0x136048[_0xb3a3('0x2d')];}};exports['agentcomplete']=function(_0x846fd5){if(!_[_0xb3a3('0x16')](queues[_0x846fd5[_0xb3a3('0x5')]])){if(queues[_0x846fd5[_0xb3a3('0x5')]][_0xb3a3('0x17')]){queues[_0x846fd5[_0xb3a3('0x5')]][_0xb3a3('0x18')]=![];queues[_0x846fd5['uniqueid']]['queuecallerabandon']=![];queues[_0x846fd5['uniqueid']][_0xb3a3('0x1f')]=null;queues[_0x846fd5[_0xb3a3('0x5')]][_0xb3a3('0x19')]=![];queues[_0x846fd5[_0xb3a3('0x5')]][_0xb3a3('0x20')]=null;queues[_0x846fd5[_0xb3a3('0x5')]][_0xb3a3('0x2c')]=!![];queues[_0x846fd5['uniqueid']]['lastAssignedTo']=_0x846fd5[_0xb3a3('0x2d')];queues[_0x846fd5['uniqueid']]['queuecallercomplete']=!![];queues[_0x846fd5[_0xb3a3('0x5')]][_0xb3a3('0x1b')]=utils['now']();if(_0x846fd5[_0xb3a3('0x2e')]==_0xb3a3('0x2f')){if(!queues[_0x846fd5['uniqueid']][_0xb3a3('0x2f')]){queues[_0x846fd5[_0xb3a3('0x5')]]['queuecallerexitreason']=_0xb3a3('0x30');}}else{queues[_0x846fd5[_0xb3a3('0x5')]][_0xb3a3('0xa')]=_0xb3a3('0x31')+_0x846fd5[_0xb3a3('0x2e')][_0xb3a3('0x32')]();}writeDB(queues[_0x846fd5[_0xb3a3('0x5')]]);}}};exports[_0xb3a3('0x33')]=function(_0x25823e){if(!_[_0xb3a3('0x16')](queues[_0x25823e[_0xb3a3('0x34')]])){queues[_0x25823e[_0xb3a3('0x34')]]['transfer']=!![];queues[_0x25823e['transfereeuniqueid']]['transfertype']='BLIND';queues[_0x25823e[_0xb3a3('0x34')]][_0xb3a3('0x35')]=_0x25823e[_0xb3a3('0x36')];queues[_0x25823e[_0xb3a3('0x34')]]['transferuniqueid']=_0x25823e[_0xb3a3('0x34')];queues[_0x25823e[_0xb3a3('0x34')]][_0xb3a3('0xa')]='BLINDTRANSFER';}};exports['attendedtransfer']=function(_0xc18f36){try{if(_0xc18f36[_0xb3a3('0x37')]==_0xc18f36[_0xb3a3('0x38')]){if(!_[_0xb3a3('0x16')](queues[_0xc18f36[_0xb3a3('0x39')]])){queues[_0xc18f36[_0xb3a3('0x39')]][_0xb3a3('0x2f')]=!![];queues[_0xc18f36[_0xb3a3('0x39')]][_0xb3a3('0x3a')]='ATTENDED';queues[_0xc18f36['secondtransfererlinkedid']]['transferexten']=_0xc18f36['origtransfererexten'];queues[_0xc18f36['secondtransfererlinkedid']][_0xb3a3('0x3b')]=_0xc18f36[_0xb3a3('0x37')];queues[_0xc18f36[_0xb3a3('0x39')]]['queuecallerexitreason']=_0xb3a3('0x3c');}if(!_[_0xb3a3('0x16')](queues[_0xc18f36[_0xb3a3('0x38')]])){if(_0xc18f36['transfereelinkedid']&&queues[_0xc18f36['transfereelinkedid']]){queues[_0xc18f36['transfereelinkedid']][_0xb3a3('0x1d')]=0x1;queues[_0xc18f36[_0xb3a3('0x34')]]=_[_0xb3a3('0x3d')](queues[_0xc18f36[_0xb3a3('0x3e')]]);queues[_0xc18f36['transfereeuniqueid']][_0xb3a3('0x11')]=_0xc18f36[_0xb3a3('0x3f')];queues[_0xc18f36[_0xb3a3('0x34')]][_0xb3a3('0x1d')]=0x2;queues[_0xc18f36[_0xb3a3('0x34')]]['calleridnum']=queues[_0xc18f36[_0xb3a3('0x39')]][_0xb3a3('0x8')];queues[_0xc18f36[_0xb3a3('0x34')]][_0xb3a3('0x40')]=queues[_0xc18f36['secondtransfererlinkedid']][_0xb3a3('0x40')];queues[_0xc18f36['transfereeuniqueid']][_0xb3a3('0x27')]=utils[_0xb3a3('0x14')]();queues[_0xc18f36[_0xb3a3('0x34')]][_0xb3a3('0x17')]=utils[_0xb3a3('0x14')]();queues[_0xc18f36[_0xb3a3('0x34')]]['holdtime']=0x0;queues[_0xc18f36[_0xb3a3('0x34')]][_0xb3a3('0x41')]=0x0;}else{queues[_0xc18f36[_0xb3a3('0x38')]][_0xb3a3('0x11')]=_0xc18f36[_0xb3a3('0x39')];}}}else if(_0xc18f36[_0xb3a3('0x42')]==_0xc18f36[_0xb3a3('0x39')]){if(!_[_0xb3a3('0x16')](queues[_0xc18f36[_0xb3a3('0x38')]])){queues[_0xc18f36['origtransfererlinkedid']][_0xb3a3('0x2f')]=!![];queues[_0xc18f36['origtransfererlinkedid']][_0xb3a3('0x3a')]=_0xb3a3('0x43');queues[_0xc18f36['origtransfererlinkedid']][_0xb3a3('0x35')]=_0xc18f36[_0xb3a3('0x44')];queues[_0xc18f36['origtransfererlinkedid']][_0xb3a3('0x3b')]=_0xc18f36['secondtransfereruniqueid'];queues[_0xc18f36['origtransfererlinkedid']][_0xb3a3('0xa')]='ATTENDEDTRANSFER';}if(!_[_0xb3a3('0x16')](queues[_0xc18f36['secondtransfererlinkedid']])){if(_0xc18f36[_0xb3a3('0x45')]&&queues[_0xc18f36[_0xb3a3('0x45')]]){queues[_0xc18f36['transfertargetlinkedid']][_0xb3a3('0x1d')]=0x1;queues[_0xc18f36[_0xb3a3('0x3f')]]=_[_0xb3a3('0x3d')](queues[_0xc18f36['transfertargetlinkedid']]);queues[_0xc18f36[_0xb3a3('0x3f')]][_0xb3a3('0x11')]=_0xc18f36['transfertargetuniqueid'];queues[_0xc18f36['transfertargetuniqueid']][_0xb3a3('0x1d')]=0x2;queues[_0xc18f36['transfertargetuniqueid']]['calleridnum']=queues[_0xc18f36[_0xb3a3('0x38')]]['calleridnum'];queues[_0xc18f36[_0xb3a3('0x3f')]]['calleridname']=queues[_0xc18f36['origtransfererlinkedid']][_0xb3a3('0x40')];queues[_0xc18f36[_0xb3a3('0x3f')]][_0xb3a3('0x27')]=utils[_0xb3a3('0x14')]();queues[_0xc18f36[_0xb3a3('0x3f')]][_0xb3a3('0x17')]=utils[_0xb3a3('0x14')]();queues[_0xc18f36['transfertargetuniqueid']][_0xb3a3('0x25')]=0x0;queues[_0xc18f36[_0xb3a3('0x3f')]]['mohtime']=0x0;}else{queues[_0xc18f36['secondtransfererlinkedid']][_0xb3a3('0x11')]=_0xc18f36['origtransfererlinkedid'];}}}}catch(_0x1db8c0){utils['error'](_0x1db8c0[_0xb3a3('0x46')]);}};exports[_0xb3a3('0x47')]=function(_0x2c66f6){if(!_[_0xb3a3('0x16')](queues[_0x2c66f6['uniqueid']])){queues[_0x2c66f6[_0xb3a3('0x5')]]['musiconholdstartAt']=utils[_0xb3a3('0x14')]();}};exports[_0xb3a3('0x48')]=function(_0x3bf07f){if(!_[_0xb3a3('0x16')](queues[_0x3bf07f['uniqueid']])){if(!_['isNil'](queues[_0x3bf07f[_0xb3a3('0x5')]]['musiconholdstartAt'])){queues[_0x3bf07f[_0xb3a3('0x5')]][_0xb3a3('0x41')]+=utils[_0xb3a3('0x26')](utils['now'](),queues[_0x3bf07f['uniqueid']]['musiconholdstartAt']);delete queues[_0x3bf07f['uniqueid']][_0xb3a3('0x49')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 129be03..7fcd9df 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 _0xe706=['CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','isNil','channelstate','stack','varset','variable','value','.WAV','find','monitors','hangup','calleridname','connectedlinenum','connectedlinename','forEach','clone','newexten','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','accountcode','getUserByInternal','then','membername','name','UserId','request'];(function(_0x25712f,_0xba7424){var _0x16386f=function(_0x64fc49){while(--_0x64fc49){_0x25712f['push'](_0x25712f['shift']());}};_0x16386f(++_0xba7424);}(_0xe706,0xa3));var _0x6e70=function(_0x4853fc,_0x52cd55){_0x4853fc=_0x4853fc-0x0;var _0x23be73=_0xe706[_0x4853fc];return _0x23be73;};'use strict';var _=require(_0x6e70('0x0'));var utils=require(_0x6e70('0x1'));var recordings={};function writeDB(_0x311951){utils['debug'](_0x311951);if(_0x311951[_0x6e70('0x2')]){utils[_0x6e70('0x3')](_0x311951[_0x6e70('0x2')])[_0x6e70('0x4')](function(_0x142c27){if(_0x142c27){_0x311951[_0x6e70('0x5')]=_0x142c27[_0x6e70('0x6')];_0x311951[_0x6e70('0x7')]=_0x142c27['id'];}utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);});}else{utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);}}exports[_0x6e70('0xa')]=function(_0x188ed3){try{if(_0x188ed3[_0x6e70('0xb')]==_0x188ed3[_0x6e70('0xc')]){recordings[_0x188ed3[_0x6e70('0xb')]]={'uniqueid':_0x188ed3[_0x6e70('0xb')],'accountcode':_0x188ed3[_0x6e70('0x2')],'exten':_0x188ed3[_0x6e70('0xd')],'context':_0x188ed3[_0x6e70('0xe')],'channel':_0x188ed3[_0x6e70('0xf')],'monitors':[]};}}catch(_0x37b3e0){utils[_0x6e70('0x10')](_0x37b3e0['stack']);}};exports['newstate']=function(_0x3594c1){try{if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xb')]])&&_0x3594c1[_0x6e70('0x12')]==0x6){}else if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xc')]])&&_0x3594c1[_0x6e70('0x12')]==0x6&&_0x3594c1[_0x6e70('0xe')]!='transfer'){recordings[_0x3594c1['linkedid']]['accountcode']=_0x3594c1[_0x6e70('0x2')];}}catch(_0x5a37a6){utils['error'](_0x5a37a6[_0x6e70('0x13')]);}};exports[_0x6e70('0x14')]=function(_0x5d9263){try{if(!_[_0x6e70('0x11')](_0x5d9263['variable'])&&!_[_0x6e70('0x11')](_0x5d9263[_0x6e70('0x15')]['mixmonitor_filename'])){if(_['endsWith'](_0x5d9263[_0x6e70('0x16')],'.wav49')){_0x5d9263[_0x6e70('0x16')]=_0x5d9263[_0x6e70('0x16')]['replace']('.wav49',_0x6e70('0x17'));}if(recordings[_0x5d9263[_0x6e70('0xc')]]){var _0x2368eb=_[_0x6e70('0x18')](recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')],{'value':_0x5d9263[_0x6e70('0x16')]});if(_[_0x6e70('0x11')](_0x2368eb)){recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')]['push']({'value':_0x5d9263[_0x6e70('0x16')]});}}}}catch(_0x344b65){utils[_0x6e70('0x10')](_0x344b65['stack']);}};exports[_0x6e70('0x1a')]=function(_0xa5d49){try{if(!_[_0x6e70('0x11')](recordings[_0xa5d49['uniqueid']])){recordings[_0xa5d49[_0x6e70('0xb')]]['calleridnum']=_0xa5d49['calleridnum'];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1b')]=_0xa5d49[_0x6e70('0x1b')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1c')]=_0xa5d49[_0x6e70('0x1c')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1d')]=_0xa5d49[_0x6e70('0x1d')];if(recordings[_0xa5d49[_0x6e70('0xb')]]['type']=='outbound'&&recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x2')]){recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1c')]=recordings[_0xa5d49[_0x6e70('0xb')]]['accountcode'];recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1d')]='';}recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x19')][_0x6e70('0x1e')](_0x20a225=>{var _0x3f78d2=_[_0x6e70('0x1f')](recordings[_0xa5d49[_0x6e70('0xb')]]);_0x3f78d2[_0x6e70('0x16')]=_0x20a225['value'];writeDB(_0x3f78d2);});delete recordings[_0xa5d49[_0x6e70('0xb')]];}}catch(_0x50d60b){utils[_0x6e70('0x10')](_0x50d60b['stack']);}};exports[_0x6e70('0x20')]=function(_0x2722e8){try{if(!_[_0x6e70('0x11')](recordings[_0x2722e8['uniqueid']])){if(_0x2722e8[_0x6e70('0x21')][_0x6e70('0x22')]()=='set'&&_[_0x6e70('0x23')](_0x2722e8[_0x6e70('0x24')]['toLowerCase'](),_0x6e70('0x25'))){var _0x3665a1=_0x2722e8[_0x6e70('0x24')][_0x6e70('0x26')]('=');var _0x3b4a13=_0x3665a1[0x0][_0x6e70('0x27')](_0x3665a1[0x0][_0x6e70('0x28')]('(')+0x1,_0x3665a1[0x0][_0x6e70('0x28')](')'));var _0xf146fd=_0x3665a1[0x1];recordings[_0x2722e8[_0x6e70('0xb')]][_0x3b4a13]=_0xf146fd;}}}catch(_0x4d32d8){utils[_0x6e70('0x10')](_0x4d32d8['stack']);}};exports[_0x6e70('0x29')]=function(_0x3222a2){try{if(!_[_0x6e70('0x11')](recordings[_0x3222a2[_0x6e70('0xb')]])){recordings[_0x3222a2[_0x6e70('0xb')]][_0x6e70('0x2a')]=_0x3222a2[_0x6e70('0x2a')];}}catch(_0xdd0bee){utils[_0x6e70('0x10')](_0xdd0bee[_0x6e70('0x13')]);}}; \ No newline at end of file +var _0xcb91=['uniqueid','channelstate','transfer','error','varset','variable','mixmonitor_filename','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','debug','accountcode','getUserByInternal','then','name','UserId','CreateVoiceRecording','request','newchannel','linkedid','exten','context','channel','stack','newstate','isNil'];(function(_0x253543,_0x476083){var _0x42a5cd=function(_0xc959cd){while(--_0xc959cd){_0x253543['push'](_0x253543['shift']());}};_0x42a5cd(++_0x476083);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xcb91[_0x51c819];return _0x15c5d2;};'use strict';var _=require('lodash');var utils=require('./utils');var recordings={};function writeDB(_0x26fe42){utils[_0x1cb9('0x0')](_0x26fe42);if(_0x26fe42[_0x1cb9('0x1')]){utils[_0x1cb9('0x2')](_0x26fe42['accountcode'])[_0x1cb9('0x3')](function(_0x2c17b8){if(_0x2c17b8){_0x26fe42['membername']=_0x2c17b8[_0x1cb9('0x4')];_0x26fe42[_0x1cb9('0x5')]=_0x2c17b8['id'];}utils['request'](_0x1cb9('0x6'),_0x26fe42);});}else{utils[_0x1cb9('0x7')]('CreateVoiceRecording',_0x26fe42);}}exports[_0x1cb9('0x8')]=function(_0x12567c){try{if(_0x12567c['uniqueid']==_0x12567c[_0x1cb9('0x9')]){recordings[_0x12567c['uniqueid']]={'uniqueid':_0x12567c['uniqueid'],'accountcode':_0x12567c[_0x1cb9('0x1')],'exten':_0x12567c[_0x1cb9('0xa')],'context':_0x12567c[_0x1cb9('0xb')],'channel':_0x12567c[_0x1cb9('0xc')],'monitors':[]};}}catch(_0x2fc627){utils['error'](_0x2fc627[_0x1cb9('0xd')]);}};exports[_0x1cb9('0xe')]=function(_0x3af35f){try{if(!_[_0x1cb9('0xf')](recordings[_0x3af35f[_0x1cb9('0x10')]])&&_0x3af35f['channelstate']==0x6){}else if(!_['isNil'](recordings[_0x3af35f['linkedid']])&&_0x3af35f[_0x1cb9('0x11')]==0x6&&_0x3af35f[_0x1cb9('0xb')]!=_0x1cb9('0x12')){recordings[_0x3af35f[_0x1cb9('0x9')]]['accountcode']=_0x3af35f[_0x1cb9('0x1')];}}catch(_0x6ef389){utils[_0x1cb9('0x13')](_0x6ef389[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x14')]=function(_0x5806d8){try{if(!_['isNil'](_0x5806d8[_0x1cb9('0x15')])&&!_[_0x1cb9('0xf')](_0x5806d8[_0x1cb9('0x15')][_0x1cb9('0x16')])){if(_[_0x1cb9('0x17')](_0x5806d8[_0x1cb9('0x18')],_0x1cb9('0x19'))){_0x5806d8['value']=_0x5806d8['value'][_0x1cb9('0x1a')](_0x1cb9('0x19'),_0x1cb9('0x1b'));}if(recordings[_0x5806d8[_0x1cb9('0x9')]]){var _0x280a84=_[_0x1cb9('0x1c')](recordings[_0x5806d8[_0x1cb9('0x9')]]['monitors'],{'value':_0x5806d8['value']});if(_[_0x1cb9('0xf')](_0x280a84)){recordings[_0x5806d8['linkedid']][_0x1cb9('0x1d')][_0x1cb9('0x1e')]({'value':_0x5806d8['value']});}}}}catch(_0x599275){utils[_0x1cb9('0x13')](_0x599275[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x1f')]=function(_0x4601b8){try{if(!_[_0x1cb9('0xf')](recordings[_0x4601b8[_0x1cb9('0x10')]])){recordings[_0x4601b8['uniqueid']]['calleridnum']=_0x4601b8[_0x1cb9('0x20')];recordings[_0x4601b8['uniqueid']][_0x1cb9('0x21')]=_0x4601b8[_0x1cb9('0x21')];recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x22')]=_0x4601b8[_0x1cb9('0x22')];recordings[_0x4601b8['uniqueid']][_0x1cb9('0x23')]=_0x4601b8[_0x1cb9('0x23')];if(recordings[_0x4601b8['uniqueid']][_0x1cb9('0x24')]==_0x1cb9('0x25')&&recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x1')]){recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x22')]=recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x1')];recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x23')]='';}recordings[_0x4601b8['uniqueid']][_0x1cb9('0x1d')]['forEach'](_0x110282=>{var _0x4efebc=_[_0x1cb9('0x26')](recordings[_0x4601b8[_0x1cb9('0x10')]]);_0x4efebc[_0x1cb9('0x18')]=_0x110282[_0x1cb9('0x18')];writeDB(_0x4efebc);});delete recordings[_0x4601b8['uniqueid']];}}catch(_0x1c701f){utils['error'](_0x1c701f[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x27')]=function(_0x4220d7){try{if(!_['isNil'](recordings[_0x4220d7[_0x1cb9('0x10')]])){if(_0x4220d7['application'][_0x1cb9('0x28')]()=='set'&&_[_0x1cb9('0x29')](_0x4220d7[_0x1cb9('0x2a')][_0x1cb9('0x28')](),_0x1cb9('0x2b'))){var _0x56c3e0=_0x4220d7[_0x1cb9('0x2a')][_0x1cb9('0x2c')]('=');var _0x3467d5=_0x56c3e0[0x0][_0x1cb9('0x2d')](_0x56c3e0[0x0][_0x1cb9('0x2e')]('(')+0x1,_0x56c3e0[0x0][_0x1cb9('0x2e')](')'));var _0xc6d5fd=_0x56c3e0[0x1];recordings[_0x4220d7[_0x1cb9('0x10')]][_0x3467d5]=_0xc6d5fd;}}}catch(_0x386e8b){utils[_0x1cb9('0x13')](_0x386e8b[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x2f')]=function(_0x29f149){try{if(!_['isNil'](recordings[_0x29f149['uniqueid']])){recordings[_0x29f149[_0x1cb9('0x10')]][_0x1cb9('0x30')]=_0x29f149[_0x1cb9('0x30')];}}catch(_0x29f451){utils[_0x1cb9('0x13')](_0x29f451[_0x1cb9('0xd')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index be40db4..7ef9b75 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 _0x7a2c=['transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','./utils','info','format','TRANSFER|%s','type','request','CreateVoiceTransferReport','stack','attendedtransfer','assign','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x231b2e,_0x2a33f9){var _0x3feb2a=function(_0x5aa472){while(--_0x5aa472){_0x231b2e['push'](_0x231b2e['shift']());}};_0x3feb2a(++_0x2a33f9);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x22ac4e,_0x2d8dd0){_0x22ac4e=_0x22ac4e-0x0;var _0xf63226=_0x7a2c[_0x22ac4e];return _0xf63226;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var utils=require(_0xc7a2('0x1'));function writeDB(_0x469747){utils[_0xc7a2('0x2')](util[_0xc7a2('0x3')](_0xc7a2('0x4'),_0x469747[_0xc7a2('0x5')]));utils[_0xc7a2('0x6')](_0xc7a2('0x7'),_0x469747);}exports['blindtransfer']=function(_0x3a47c8){try{_0x3a47c8[_0xc7a2('0x5')]='blind';writeDB(_0x3a47c8);}catch(_0x481430){utils['error'](_0x481430[_0xc7a2('0x8')]);}};exports[_0xc7a2('0x9')]=function(_0x3f0573){try{_0x3f0573=_[_0xc7a2('0xa')](_0x3f0573,{'transfererchannel':_0x3f0573['origtransfererchannel'],'transferercalleridnum':_0x3f0573[_0xc7a2('0xb')],'transferercalleridname':_0x3f0573[_0xc7a2('0xc')],'transfererconnectedlinenum':_0x3f0573[_0xc7a2('0xd')],'transfererconnectedlinename':_0x3f0573['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3f0573[_0xc7a2('0xe')],'transferercontext':_0x3f0573['secondtransferercontext'],'transfererexten':_0x3f0573[_0xc7a2('0xf')],'transfererlinkedid':_0x3f0573[_0xc7a2('0x10')],'context':_0x3f0573[_0xc7a2('0x11')],'extension':_0x3f0573['origtransfererexten'],'type':_0xc7a2('0x12')});if(_[_0xc7a2('0x13')](_0x3f0573[_0xc7a2('0x14')])){_0x3f0573=_['assign'](_0x3f0573,{'transfereechannel':_0x3f0573[_0xc7a2('0x15')],'transfereecalleridnum':_0x3f0573[_0xc7a2('0x16')],'transfereecalleridname':_0x3f0573[_0xc7a2('0x17')],'transfereeconnectedlinenum':_0x3f0573[_0xc7a2('0x18')],'transfereeconnectedlinename':_0x3f0573[_0xc7a2('0x19')],'transfereeaccountcode':_0x3f0573[_0xc7a2('0x1a')],'transfereecontext':_0x3f0573[_0xc7a2('0x1b')],'transfereeexten':_0x3f0573[_0xc7a2('0x1c')],'transfereelinkedid':_0x3f0573[_0xc7a2('0x1d')]});}writeDB(_0x3f0573);}catch(_0xcc0d1f){utils[_0xc7a2('0x1e')](_0xcc0d1f[_0xc7a2('0x8')]);}}; \ No newline at end of file +var _0xdf71=['transfertargetcontext','stack','lodash','./utils','info','format','TRANSFER|%s','type','request','blindtransfer','error','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode'];(function(_0x4c93e5,_0x4d8883){var _0x5ccca1=function(_0x367ff2){while(--_0x367ff2){_0x4c93e5['push'](_0x4c93e5['shift']());}};_0x5ccca1(++_0x4d8883);}(_0xdf71,0x1d2));var _0x1df7=function(_0x2b9cd6,_0x1aacbd){_0x2b9cd6=_0x2b9cd6-0x0;var _0x2536ee=_0xdf71[_0x2b9cd6];return _0x2536ee;};'use strict';var _=require(_0x1df7('0x0'));var util=require('util');var utils=require(_0x1df7('0x1'));function writeDB(_0x22631a){utils[_0x1df7('0x2')](util[_0x1df7('0x3')](_0x1df7('0x4'),_0x22631a[_0x1df7('0x5')]));utils[_0x1df7('0x6')]('CreateVoiceTransferReport',_0x22631a);}exports[_0x1df7('0x7')]=function(_0x3297c0){try{_0x3297c0['type']='blind';writeDB(_0x3297c0);}catch(_0xa181be){utils[_0x1df7('0x8')](_0xa181be['stack']);}};exports[_0x1df7('0x9')]=function(_0x542f22){try{_0x542f22=_[_0x1df7('0xa')](_0x542f22,{'transfererchannel':_0x542f22[_0x1df7('0xb')],'transferercalleridnum':_0x542f22[_0x1df7('0xc')],'transferercalleridname':_0x542f22[_0x1df7('0xd')],'transfererconnectedlinenum':_0x542f22['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x542f22[_0x1df7('0xe')],'transfereraccountcode':_0x542f22[_0x1df7('0xf')],'transferercontext':_0x542f22[_0x1df7('0x10')],'transfererexten':_0x542f22[_0x1df7('0x11')],'transfererlinkedid':_0x542f22[_0x1df7('0x12')],'context':_0x542f22[_0x1df7('0x13')],'extension':_0x542f22['origtransfererexten'],'type':_0x1df7('0x14')});if(_['isNil'](_0x542f22[_0x1df7('0x15')])){_0x542f22=_[_0x1df7('0xa')](_0x542f22,{'transfereechannel':_0x542f22[_0x1df7('0x16')],'transfereecalleridnum':_0x542f22[_0x1df7('0x17')],'transfereecalleridname':_0x542f22[_0x1df7('0x18')],'transfereeconnectedlinenum':_0x542f22['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x542f22[_0x1df7('0x19')],'transfereeaccountcode':_0x542f22[_0x1df7('0x1a')],'transfereecontext':_0x542f22[_0x1df7('0x1b')],'transfereeexten':_0x542f22['transfertargetexten'],'transfereelinkedid':_0x542f22['transfertargetlinkedid']});}writeDB(_0x542f22);}catch(_0x8cfd99){utils['error'](_0x8cfd99[_0x1df7('0x1c')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 46fbd7e..5f7f4b2 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 _0x4c69=['http','../../config/logger','xdr','info','debug','stringify','stack','request','then','catch','error','internal','name','interface','GETUSER|','result','length','FOUND','NOTFOUND','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','GETVOICEQUEUEBYNAME|','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','format','isAfter','isBefore','jayson/promise','client'];(function(_0x27497d,_0xc211c9){var _0x187b9f=function(_0x5bace6){while(--_0x5bace6){_0x27497d['push'](_0x27497d['shift']());}};_0x187b9f(++_0xc211c9);}(_0x4c69,0x1b6));var _0x94c6=function(_0x46f8d2,_0xbebace){_0x46f8d2=_0x46f8d2-0x0;var _0x2ce5c2=_0x4c69[_0x46f8d2];return _0x2ce5c2;};'use strict';var jayson=require(_0x94c6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var client=jayson[_0x94c6('0x1')][_0x94c6('0x2')]({'port':0x2329});var logger=require(_0x94c6('0x3'))(_0x94c6('0x4'));exports[_0x94c6('0x5')]=function(_0x3dfd47){logger[_0x94c6('0x5')](_0x3dfd47);};exports[_0x94c6('0x6')]=function(_0x5455c3){logger[_0x94c6('0x6')](JSON[_0x94c6('0x7')](_0x5455c3));};exports['error']=function(_0x5c9ca6){logger['error'](_0x5c9ca6[_0x94c6('0x8')]);};exports[_0x94c6('0x9')]=function(_0x127264,_0x41c930){return client[_0x94c6('0x9')](_0x127264,{'body':_0x41c930})[_0x94c6('0xa')](function(_0x2b57cc){logger[_0x94c6('0x6')](JSON[_0x94c6('0x7')](_0x2b57cc));})[_0x94c6('0xb')](function(_0xfb7430){logger[_0x94c6('0xc')](_0xfb7430['stack']);});};function getUser(_0x509211){return client[_0x94c6('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x94c6('0xd'),_0x94c6('0xe'),_0x94c6('0xf')],'where':_0x509211,'limit':0x1}})[_0x94c6('0xa')](function(_0x4172dd){logger['info'](_0x94c6('0x10')+JSON[_0x94c6('0x7')](_0x509211)+'|'+(_0x4172dd[_0x94c6('0x11')][_0x94c6('0x12')]?_0x94c6('0x13'):_0x94c6('0x14')));return _0x4172dd[_0x94c6('0x11')][_0x94c6('0x12')]?_0x4172dd[_0x94c6('0x11')][0x0]:null;});}exports['getUserByInternal']=function(_0x1cfd2d){return new BPromise(function(_0x56a290,_0x314127){if(_0x1cfd2d){return getUser({'internal':_0x1cfd2d})[_0x94c6('0xa')](function(_0x166a47){return _0x56a290(_0x166a47);})['catch'](function(_0x2d1dd8){logger[_0x94c6('0xc')](_0x2d1dd8[_0x94c6('0x8')]);return _0x56a290(null);});}else{return _0x56a290(null);}});};exports[_0x94c6('0x15')]=function(_0x3c1cd2){return new BPromise(function(_0x1de0d3,_0x2d48e6){if(_0x3c1cd2){return getUser({'interface':_0x3c1cd2})[_0x94c6('0xa')](function(_0x271812){return _0x1de0d3(_0x271812);})['catch'](function(_0xd5347a){logger['error'](_0xd5347a[_0x94c6('0x8')]);return _0x1de0d3(null);});}else{return _0x1de0d3(null);}});};exports[_0x94c6('0x16')]=function(_0x46b8ab){return new BPromise(function(_0xe324b,_0x2f9664){if(_0x46b8ab){return getUser({'name':_0x46b8ab})[_0x94c6('0xa')](function(_0x166239){return _0xe324b(_0x166239);})[_0x94c6('0xb')](function(_0x344163){logger[_0x94c6('0xc')](_0x344163[_0x94c6('0x8')]);return _0xe324b(null);});}else{return _0xe324b(null);}});};exports[_0x94c6('0x17')]=function(_0x22a4e2){return new BPromise(function(_0x528d9e,_0x14972f){if(_0x22a4e2){return client[_0x94c6('0x9')](_0x94c6('0x18'),{'options':{'raw':!![],'attributes':['id','name',_0x94c6('0x19'),'acw','acwTimeout'],'where':{'name':_0x22a4e2},'limit':0x1}})[_0x94c6('0xa')](function(_0x44dd74){logger[_0x94c6('0x5')](_0x94c6('0x1a')+_0x22a4e2+'|'+(_0x44dd74['result']['length']?_0x94c6('0x13'):_0x94c6('0x14')));return _0x528d9e(_0x44dd74['result'][_0x94c6('0x12')]?_0x44dd74['result'][0x0]:null);})[_0x94c6('0xb')](function(_0x1f7b7b){logger[_0x94c6('0xc')](_0x1f7b7b[_0x94c6('0x8')]);return _0x528d9e(null);});}else{return _0x528d9e(null);}});};exports[_0x94c6('0x1b')]=function(_0xfc5960,_0x47e1c2){return moment(_0xfc5960)[_0x94c6('0x1c')](_0x47e1c2,_0x94c6('0x1d'))['format'](_0x94c6('0x1e'));};exports[_0x94c6('0x1f')]=function(_0x1add7c,_0x342948){return moment(_0x1add7c)[_0x94c6('0x20')](_0x342948,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x94c6('0x21')]=function(_0x44c6c8,_0x1acf90){return moment(_0x44c6c8)[_0x94c6('0x22')](moment(_0x1acf90),_0x94c6('0x1d'));};exports[_0x94c6('0x23')]=function(_0x10ca66,_0x3eba11){return parseInt(_0x10ca66,0xa)+parseInt(_0x3eba11,0xa);};exports[_0x94c6('0x24')]=function(){return moment()[_0x94c6('0x25')](_0x94c6('0x1e'));};exports[_0x94c6('0x26')]=function(_0x36fb12,_0x1638dc){if(_0x1638dc){return moment(_0x36fb12)[_0x94c6('0x26')](_0x1638dc);}else{return!![];}};exports[_0x94c6('0x27')]=function(_0xcc610,_0x2b0f9a){if(_0x2b0f9a){return moment(_0xcc610)[_0x94c6('0x27')](_0x2b0f9a);}else if(_0xcc610){return!![];}else{return![];}}; \ No newline at end of file +var _0x9e26=['now','isAfter','isBefore','jayson/promise','moment','bluebird','client','http','../../config/logger','xdr','info','debug','stack','request','then','stringify','catch','error','GetUser','internal','name','result','length','NOTFOUND','getUserByInternal','getUserByInterface','getUserByName','GetVoiceQueue','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','FOUND','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diffTime','diff','sumTime'];(function(_0x11f0e1,_0x520662){var _0x383b23=function(_0x397ed4){while(--_0x397ed4){_0x11f0e1['push'](_0x11f0e1['shift']());}};_0x383b23(++_0x520662);}(_0x9e26,0xd5));var _0x69e2=function(_0x367735,_0x416778){_0x367735=_0x367735-0x0;var _0x24fbdd=_0x9e26[_0x367735];return _0x24fbdd;};'use strict';var jayson=require(_0x69e2('0x0'));var moment=require(_0x69e2('0x1'));var BPromise=require(_0x69e2('0x2'));var client=jayson[_0x69e2('0x3')][_0x69e2('0x4')]({'port':0x2329});var logger=require(_0x69e2('0x5'))(_0x69e2('0x6'));exports[_0x69e2('0x7')]=function(_0x353058){logger[_0x69e2('0x7')](_0x353058);};exports[_0x69e2('0x8')]=function(_0x249ce0){logger[_0x69e2('0x8')](JSON['stringify'](_0x249ce0));};exports['error']=function(_0x4ed6a4){logger['error'](_0x4ed6a4[_0x69e2('0x9')]);};exports[_0x69e2('0xa')]=function(_0x4de649,_0x2eb4c5){return client[_0x69e2('0xa')](_0x4de649,{'body':_0x2eb4c5})[_0x69e2('0xb')](function(_0x43ef9f){logger[_0x69e2('0x8')](JSON[_0x69e2('0xc')](_0x43ef9f));})[_0x69e2('0xd')](function(_0x1e09c8){logger[_0x69e2('0xe')](_0x1e09c8[_0x69e2('0x9')]);});};function getUser(_0x33ceb9){return client[_0x69e2('0xa')](_0x69e2('0xf'),{'options':{'raw':!![],'attributes':['id',_0x69e2('0x10'),_0x69e2('0x11'),'interface'],'where':_0x33ceb9,'limit':0x1}})[_0x69e2('0xb')](function(_0x89ac8a){logger[_0x69e2('0x7')]('GETUSER|'+JSON[_0x69e2('0xc')](_0x33ceb9)+'|'+(_0x89ac8a[_0x69e2('0x12')][_0x69e2('0x13')]?'FOUND':_0x69e2('0x14')));return _0x89ac8a['result'][_0x69e2('0x13')]?_0x89ac8a[_0x69e2('0x12')][0x0]:null;});}exports[_0x69e2('0x15')]=function(_0x10603f){return new BPromise(function(_0x19808a,_0x470788){if(_0x10603f){return getUser({'internal':_0x10603f})[_0x69e2('0xb')](function(_0x1770cd){return _0x19808a(_0x1770cd);})[_0x69e2('0xd')](function(_0x5c70ad){logger[_0x69e2('0xe')](_0x5c70ad['stack']);return _0x19808a(null);});}else{return _0x19808a(null);}});};exports[_0x69e2('0x16')]=function(_0x256b97){return new BPromise(function(_0x4697ab,_0x59514e){if(_0x256b97){return getUser({'interface':_0x256b97})[_0x69e2('0xb')](function(_0x529995){return _0x4697ab(_0x529995);})[_0x69e2('0xd')](function(_0x57d11e){logger[_0x69e2('0xe')](_0x57d11e[_0x69e2('0x9')]);return _0x4697ab(null);});}else{return _0x4697ab(null);}});};exports[_0x69e2('0x17')]=function(_0x4bdbce){return new BPromise(function(_0x4f2764,_0x1b2397){if(_0x4bdbce){return getUser({'name':_0x4bdbce})[_0x69e2('0xb')](function(_0xe23925){return _0x4f2764(_0xe23925);})[_0x69e2('0xd')](function(_0x3adee5){logger[_0x69e2('0xe')](_0x3adee5['stack']);return _0x4f2764(null);});}else{return _0x4f2764(null);}});};exports['getVoiceQueueByName']=function(_0x18a2a3){return new BPromise(function(_0x5c7ec0,_0x1143b5){if(_0x18a2a3){return client[_0x69e2('0xa')](_0x69e2('0x18'),{'options':{'raw':!![],'attributes':['id',_0x69e2('0x11'),_0x69e2('0x19'),_0x69e2('0x1a'),_0x69e2('0x1b')],'where':{'name':_0x18a2a3},'limit':0x1}})[_0x69e2('0xb')](function(_0x251d78){logger[_0x69e2('0x7')](_0x69e2('0x1c')+_0x18a2a3+'|'+(_0x251d78[_0x69e2('0x12')][_0x69e2('0x13')]?_0x69e2('0x1d'):'NOTFOUND'));return _0x5c7ec0(_0x251d78[_0x69e2('0x12')]['length']?_0x251d78['result'][0x0]:null);})[_0x69e2('0xd')](function(_0x54f95b){logger[_0x69e2('0xe')](_0x54f95b[_0x69e2('0x9')]);return _0x5c7ec0(null);});}else{return _0x5c7ec0(null);}});};exports[_0x69e2('0x1e')]=function(_0x1e6ace,_0x8e9be2){return moment(_0x1e6ace)[_0x69e2('0x1f')](_0x8e9be2,_0x69e2('0x20'))['format'](_0x69e2('0x21'));};exports['subtractTime']=function(_0x57fa57,_0x4ea1b7){return moment(_0x57fa57)[_0x69e2('0x22')](_0x4ea1b7,_0x69e2('0x20'))[_0x69e2('0x23')](_0x69e2('0x21'));};exports[_0x69e2('0x24')]=function(_0xfedb21,_0x526c86){return moment(_0xfedb21)[_0x69e2('0x25')](moment(_0x526c86),_0x69e2('0x20'));};exports[_0x69e2('0x26')]=function(_0x5ef136,_0x3be542){return parseInt(_0x5ef136,0xa)+parseInt(_0x3be542,0xa);};exports[_0x69e2('0x27')]=function(){return moment()[_0x69e2('0x23')](_0x69e2('0x21'));};exports[_0x69e2('0x28')]=function(_0x31ce56,_0x277386){if(_0x277386){return moment(_0x31ce56)[_0x69e2('0x28')](_0x277386);}else{return!![];}};exports[_0x69e2('0x29')]=function(_0x2e43c0,_0x459610){if(_0x459610){return moment(_0x2e43c0)['isBefore'](_0x459610);}else if(_0x2e43c0){return!![];}else{return![];}}; \ No newline at end of file